From: support Date: Wed, 27 Apr 2022 15:20:01 +0000 (+0000) Subject: Built motion from commit 082d4841.|2.6.9 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22?a=commitdiff_plain;h=fc7add2c2798f5d6cc131e799db7d95abd8a2fec;p=motion2.git Built motion from commit 082d4841.|2.6.9 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index ddaca6b..2121fc3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-27T14:10:39.517Z", + "time": "2022-04-27T15:12:09.800Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9e84374..439a9fa 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-27T14:10:39.517Z", + "time": "2022-04-27T15:12:09.800Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/public/tvox/answer.controller.js b/public/tvox/answer.controller.js index 177b62b..9aa5de5 100644 --- a/public/tvox/answer.controller.js +++ b/public/tvox/answer.controller.js @@ -50,6 +50,7 @@ angular.module('AnswerApp', ['ngMaterial', 'ngCookies', 'motion', 'ngResource', $scope.dispo.mandatoryDisposition = false; $scope.dispo.mandatoryDispositionPause = ''; $scope.dispo.note = ''; + tvoxCallId = ""; @@ -99,6 +100,7 @@ angular.module('AnswerApp', ['ngMaterial', 'ngCookies', 'motion', 'ngResource', } } + this.$onInit = function() { var urlParams = new URLSearchParams(window.location.search); var params = urlParams.get("params"); @@ -304,6 +306,7 @@ angular.module('AnswerApp', ['ngMaterial', 'ngCookies', 'motion', 'ngResource', }). then( function ret(response) { + console.log("RMID", response.data.id); $scope.reportMemberId = response.data.id; } ); diff --git a/public/tvox/answer.html b/public/tvox/answer.html index f4edc0d..36fd6cd 100644 --- a/public/tvox/answer.html +++ b/public/tvox/answer.html @@ -53,14 +53,14 @@
{{contactName}} - {{ message.createdAt | date: 'medium'}} + {{message.createdAt.substring(11,16)}}
- {{ message.createdAt | date: 'medium' }} + {{message.createdAt.substring(11,16)}}
diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 87dac77..d1766e6 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 _0xa566=['exports','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[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[body]','sequelize'];(function(_0x4120a6,_0x5ae598){var _0x7c2220=function(_0x3fd0ef){while(--_0x3fd0ef){_0x4120a6['push'](_0x4120a6['shift']());}};_0x7c2220(++_0x5ae598);}(_0xa566,0x1c1));var _0x6a56=function(_0x4a6a8b,_0x4e9b87){_0x4a6a8b=_0x4a6a8b-0x0;var _0x3548ed=_0xa566[_0x4a6a8b];return _0x3548ed;};'use strict';var Sequelize=require(_0x6a56('0x0'));module[_0x6a56('0x1')]={'name':{'type':Sequelize[_0x6a56('0x2')],'get':function(_0x5ccd87){return this[_0x6a56('0x3')](_0x6a56('0x4'));}},'action':{'type':Sequelize[_0x6a56('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6a56('0x6'),'integration',_0x6a56('0x7'),'jscripty','urlForward','browser','bot',_0x6a56('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x6a56('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x6a56('0xa')},'data2':{'type':Sequelize[_0x6a56('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x6a56('0x5')](0x1000),'comment':_0x6a56('0xb')},'data4':{'type':Sequelize[_0x6a56('0x5')](0x1000),'comments':_0x6a56('0xc')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x6a56('0xd')},'data6':{'type':Sequelize[_0x6a56('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x6a56('0xe')}}; \ No newline at end of file +var _0xefe2=['STRING','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0xefe2,0x178));var _0x2efe=function(_0xe17f73,_0x270de8){_0xe17f73=_0xe17f73-0x0;var _0x585156=_0xefe2[_0xe17f73];return _0x585156;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3de1ac){return this[_0x2efe('0x2')](_0x2efe('0x3'));}},'action':{'type':Sequelize[_0x2efe('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x2efe('0x5'),_0x2efe('0x6'),_0x2efe('0x7'),_0x2efe('0x8'),_0x2efe('0x9'),_0x2efe('0xa'),_0x2efe('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x2efe('0xc')},'data1':{'type':Sequelize[_0x2efe('0x4')](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[_0x2efe('0x4')](0x1000),'comment':_0x2efe('0xd')},'data3':{'type':Sequelize[_0x2efe('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x2efe('0xe')},'data5':{'type':Sequelize[_0x2efe('0x4')](0x1000),'comments':_0x2efe('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0x2efe('0x10')},'data7':{'type':Sequelize[_0x2efe('0x11')],'comments':_0x2efe('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 98cd05c..9c746fc 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 _0x9c49=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','body','find','params','Action','catch','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x9c49,0x1b1));var _0x99c4=function(_0x5befc7,_0x68c46d){_0x5befc7=_0x5befc7-0x0;var _0x294581=_0x9c49[_0x5befc7];return _0x294581;};'use strict';var emlformat=require(_0x99c4('0x0'));var rimraf=require(_0x99c4('0x1'));var zipdir=require(_0x99c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x99c4('0x3'));var BPromise=require(_0x99c4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x99c4('0x5'));var sox=require(_0x99c4('0x6'));var csv=require(_0x99c4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99c4('0x8'));var _=require(_0x99c4('0x9'));var squel=require(_0x99c4('0xa'));var crypto=require('crypto');var jsforce=require(_0x99c4('0xb'));var deskjs=require(_0x99c4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x99c4('0xd'));var Papa=require(_0x99c4('0xe'));var Redis=require(_0x99c4('0xf'));var authService=require(_0x99c4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x99c4('0x11'));var hardwareService=require(_0x99c4('0x12'));var logger=require('../../config/logger')(_0x99c4('0x13'));var utils=require(_0x99c4('0x14'));var config=require(_0x99c4('0x15'));var licenseUtil=require(_0x99c4('0x16'));var db=require(_0x99c4('0x17'))['db'];function respondWithStatusCode(_0x364dd5,_0x3b0778){_0x3b0778=_0x3b0778||0xcc;return function(_0x5cd823){if(_0x5cd823){return _0x364dd5['sendStatus'](_0x3b0778);}return _0x364dd5[_0x99c4('0x18')](_0x3b0778)['end']();};}function respondWithResult(_0x298c47,_0x371ac2){_0x371ac2=_0x371ac2||0xc8;return function(_0x526e0b){if(_0x526e0b){return _0x298c47[_0x99c4('0x18')](_0x371ac2)[_0x99c4('0x19')](_0x526e0b);}};}function respondWithFilteredResult(_0x2e85af,_0xa2d7bd){return function(_0x4269c0){if(_0x4269c0){var _0x327565=typeof _0xa2d7bd[_0x99c4('0x1a')]==='undefined'&&typeof _0xa2d7bd[_0x99c4('0x1b')]===_0x99c4('0x1c');var _0x50179e=_0x4269c0[_0x99c4('0x1d')];var _0x19d2b0=_0x327565?0x0:_0xa2d7bd[_0x99c4('0x1a')];var _0x3f7e97=_0x327565?_0x4269c0[_0x99c4('0x1d')]:_0xa2d7bd[_0x99c4('0x1a')]+_0xa2d7bd[_0x99c4('0x1b')];var _0x4cfac5;if(_0x3f7e97>=_0x50179e){_0x3f7e97=_0x50179e;_0x4cfac5=0xc8;}else{_0x4cfac5=0xce;}_0x2e85af[_0x99c4('0x18')](_0x4cfac5);return _0x2e85af[_0x99c4('0x1e')](_0x99c4('0x1f'),_0x19d2b0+'-'+_0x3f7e97+'/'+_0x50179e)['json'](_0x4269c0);}return null;};}function patchUpdates(_0x3f2001){return function(_0x4c22d7){try{jsonpatch[_0x99c4('0x20')](_0x4c22d7,_0x3f2001,!![]);}catch(_0x10e54f){return BPromise[_0x99c4('0x21')](_0x10e54f);}return _0x4c22d7[_0x99c4('0x22')]();};}function saveUpdates(_0x50237c,_0xbaa780){return function(_0x2db03b){if(_0x2db03b){return _0x2db03b[_0x99c4('0x23')](_0x50237c)['then'](function(_0x51e042){return _0x51e042;});}return null;};}function removeEntity(_0x47eefa,_0xd9a591){return function(_0x188fdb){if(_0x188fdb){return _0x188fdb[_0x99c4('0x24')]()[_0x99c4('0x25')](function(){_0x47eefa[_0x99c4('0x18')](0xcc)[_0x99c4('0x26')]();});}};}function handleEntityNotFound(_0x278469,_0x2ef9c4){return function(_0x209212){if(!_0x209212){_0x278469[_0x99c4('0x27')](0x194);}return _0x209212;};}function handleError(_0x5827d2,_0x50b30a){_0x50b30a=_0x50b30a||0x1f4;return function(_0x3ef3c4){logger[_0x99c4('0x28')](_0x3ef3c4[_0x99c4('0x29')]);if(_0x3ef3c4[_0x99c4('0x2a')]){delete _0x3ef3c4['name'];}_0x5827d2['status'](_0x50b30a)[_0x99c4('0x2b')](_0x3ef3c4);};}exports[_0x99c4('0x23')]=function(_0x1c486d,_0x4bccf5){if(_0x1c486d[_0x99c4('0x2c')]['id']){delete _0x1c486d['body']['id'];}return db['Action'][_0x99c4('0x2d')]({'where':{'id':_0x1c486d[_0x99c4('0x2e')]['id']}})[_0x99c4('0x25')](handleEntityNotFound(_0x4bccf5,null))[_0x99c4('0x25')](saveUpdates(_0x1c486d[_0x99c4('0x2c')],null))[_0x99c4('0x25')](respondWithResult(_0x4bccf5,null))['catch'](handleError(_0x4bccf5,null));};exports[_0x99c4('0x24')]=function(_0x2203ea,_0x1674f0){return db[_0x99c4('0x2f')][_0x99c4('0x2d')]({'where':{'id':_0x2203ea[_0x99c4('0x2e')]['id']}})[_0x99c4('0x25')](handleEntityNotFound(_0x1674f0,null))[_0x99c4('0x25')](removeEntity(_0x1674f0,null))[_0x99c4('0x30')](handleError(_0x1674f0,null));}; \ No newline at end of file +var _0x80b8=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','update','Action','find','params','body','catch','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x40d69c,_0x17a711){var _0xb7f3c=function(_0x3fd9d4){while(--_0x3fd9d4){_0x40d69c['push'](_0x40d69c['shift']());}};_0xb7f3c(++_0x17a711);}(_0x80b8,0x1ec));var _0x880b=function(_0x149fdd,_0x1f095b){_0x149fdd=_0x149fdd-0x0;var _0x11db5e=_0x80b8[_0x149fdd];return _0x11db5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x880b('0x0'));var zipdir=require(_0x880b('0x1'));var jsonpatch=require(_0x880b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x880b('0x3'));var Mustache=require(_0x880b('0x4'));var util=require(_0x880b('0x5'));var path=require('path');var sox=require(_0x880b('0x6'));var csv=require(_0x880b('0x7'));var ejs=require(_0x880b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x880b('0x9'));var squel=require('squel');var crypto=require(_0x880b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x880b('0x7'));var querystring=require(_0x880b('0xb'));var Papa=require(_0x880b('0xc'));var Redis=require('ioredis');var authService=require(_0x880b('0xd'));var qs=require(_0x880b('0xe'));var as=require(_0x880b('0xf'));var hardwareService=require(_0x880b('0x10'));var logger=require(_0x880b('0x11'))('api');var utils=require(_0x880b('0x12'));var config=require(_0x880b('0x13'));var licenseUtil=require(_0x880b('0x14'));var db=require(_0x880b('0x15'))['db'];function respondWithStatusCode(_0x4d9797,_0x555ec3){_0x555ec3=_0x555ec3||0xcc;return function(_0x3cc8d6){if(_0x3cc8d6){return _0x4d9797[_0x880b('0x16')](_0x555ec3);}return _0x4d9797['status'](_0x555ec3)[_0x880b('0x17')]();};}function respondWithResult(_0x211673,_0x5a4646){_0x5a4646=_0x5a4646||0xc8;return function(_0x4d1d7e){if(_0x4d1d7e){return _0x211673[_0x880b('0x18')](_0x5a4646)['json'](_0x4d1d7e);}};}function respondWithFilteredResult(_0x1f435a,_0x4328d6){return function(_0x283a1f){if(_0x283a1f){var _0x162a12=typeof _0x4328d6[_0x880b('0x19')]===_0x880b('0x1a')&&typeof _0x4328d6[_0x880b('0x1b')]===_0x880b('0x1a');var _0x2cea05=_0x283a1f['count'];var _0x31f095=_0x162a12?0x0:_0x4328d6[_0x880b('0x19')];var _0xb6e64f=_0x162a12?_0x283a1f[_0x880b('0x1c')]:_0x4328d6[_0x880b('0x19')]+_0x4328d6['limit'];var _0xe7aa3f;if(_0xb6e64f>=_0x2cea05){_0xb6e64f=_0x2cea05;_0xe7aa3f=0xc8;}else{_0xe7aa3f=0xce;}_0x1f435a[_0x880b('0x18')](_0xe7aa3f);return _0x1f435a[_0x880b('0x1d')](_0x880b('0x1e'),_0x31f095+'-'+_0xb6e64f+'/'+_0x2cea05)[_0x880b('0x1f')](_0x283a1f);}return null;};}function patchUpdates(_0x309b8b){return function(_0x233643){try{jsonpatch[_0x880b('0x20')](_0x233643,_0x309b8b,!![]);}catch(_0xa13455){return BPromise[_0x880b('0x21')](_0xa13455);}return _0x233643[_0x880b('0x22')]();};}function saveUpdates(_0x2f0ecd,_0x34e1d7){return function(_0x2a8876){if(_0x2a8876){return _0x2a8876['update'](_0x2f0ecd)[_0x880b('0x23')](function(_0x2fed28){return _0x2fed28;});}return null;};}function removeEntity(_0x1fe258,_0x57acf6){return function(_0x52beeb){if(_0x52beeb){return _0x52beeb[_0x880b('0x24')]()['then'](function(){_0x1fe258['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bde84,_0xb8b325){return function(_0x1079e7){if(!_0x1079e7){_0x5bde84['sendStatus'](0x194);}return _0x1079e7;};}function handleError(_0xc428d5,_0x2c580d){_0x2c580d=_0x2c580d||0x1f4;return function(_0x44f6cf){logger[_0x880b('0x25')](_0x44f6cf[_0x880b('0x26')]);if(_0x44f6cf[_0x880b('0x27')]){delete _0x44f6cf[_0x880b('0x27')];}_0xc428d5[_0x880b('0x18')](_0x2c580d)[_0x880b('0x28')](_0x44f6cf);};}exports[_0x880b('0x29')]=function(_0x1cb447,_0x1e03f7){if(_0x1cb447['body']['id']){delete _0x1cb447['body']['id'];}return db[_0x880b('0x2a')][_0x880b('0x2b')]({'where':{'id':_0x1cb447[_0x880b('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1e03f7,null))[_0x880b('0x23')](saveUpdates(_0x1cb447[_0x880b('0x2d')],null))[_0x880b('0x23')](respondWithResult(_0x1e03f7,null))['catch'](handleError(_0x1e03f7,null));};exports[_0x880b('0x24')]=function(_0x34c17d,_0x3a0711){return db[_0x880b('0x2a')][_0x880b('0x2b')]({'where':{'id':_0x34c17d[_0x880b('0x2c')]['id']}})[_0x880b('0x23')](handleEntityNotFound(_0x3a0711,null))[_0x880b('0x23')](removeEntity(_0x3a0711,null))[_0x880b('0x2e')](handleError(_0x3a0711,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 4100721..741d0b4 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 _0x4131=['path','rimraf','../../config/environment','./action.attributes','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2005a6,_0x5c9f66){var _0x16cf92=function(_0x1ee89b){while(--_0x1ee89b){_0x2005a6['push'](_0x2005a6['shift']());}};_0x16cf92(++_0x5c9f66);}(_0x4131,0x10e));var _0x1413=function(_0xcf0d77,_0x2195aa){_0xcf0d77=_0xcf0d77-0x0;var _0x13b05f=_0x4131[_0xcf0d77];return _0x13b05f;};'use strict';var _=require(_0x1413('0x0'));var util=require(_0x1413('0x1'));var logger=require(_0x1413('0x2'))(_0x1413('0x3'));var moment=require(_0x1413('0x4'));var BPromise=require(_0x1413('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1413('0x6'));var rimraf=require(_0x1413('0x7'));var config=require(_0x1413('0x8'));var attributes=require(_0x1413('0x9'));module['exports']=function(_0x133add,_0xecefba){return _0x133add[_0x1413('0xa')]('Action',attributes,{'tableName':_0x1413('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaab=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./action.attributes','exports','Action','util'];(function(_0x376f50,_0x194398){var _0x218263=function(_0x568a01){while(--_0x568a01){_0x376f50['push'](_0x376f50['shift']());}};_0x218263(++_0x194398);}(_0xdaab,0x1c1));var _0xbdaa=function(_0x6f5229,_0x1e9031){_0x6f5229=_0x6f5229-0x0;var _0x5d2f3d=_0xdaab[_0x6f5229];return _0x5d2f3d;};'use strict';var _=require('lodash');var util=require(_0xbdaa('0x0'));var logger=require(_0xbdaa('0x1'))(_0xbdaa('0x2'));var moment=require(_0xbdaa('0x3'));var BPromise=require(_0xbdaa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdaa('0x5'));var config=require(_0xbdaa('0x6'));var attributes=require(_0xbdaa('0x7'));module[_0xbdaa('0x8')]=function(_0x2c867a,_0x2282b1){return _0x2c867a['define'](_0xbdaa('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 0461288..2ab4bc1 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xf494,0x1c6));var _0x4f49=function(_0x3105ad,_0x57d140){_0x3105ad=_0x3105ad-0x0;var _0x51c358=_0xf494[_0x3105ad];return _0x51c358;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x7a54=['info','Action,\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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x29c8a8,_0x4d316c){_0x29c8a8=_0x29c8a8-0x0;var _0x12a847=_0x7a54[_0x29c8a8];return _0x12a847;};'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')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 4900ed4..0fe1f48 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 _0x41c7=['./action.controller','isAuthenticated','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2e831b,_0x2685a3){var _0x90026e=function(_0x3abbaf){while(--_0x3abbaf){_0x2e831b['push'](_0x2e831b['shift']());}};_0x90026e(++_0x2685a3);}(_0x41c7,0x15f));var _0x741c=function(_0x4ef5fe,_0x55cdf5){_0x4ef5fe=_0x4ef5fe-0x0;var _0x4537f4=_0x41c7[_0x4ef5fe];return _0x4537f4;};'use strict';var multer=require(_0x741c('0x0'));var util=require(_0x741c('0x1'));var path=require(_0x741c('0x2'));var timeout=require(_0x741c('0x3'));var express=require(_0x741c('0x4'));var router=express[_0x741c('0x5')]();var fs_extra=require(_0x741c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x741c('0x7'));var config=require(_0x741c('0x8'));var controller=require(_0x741c('0x9'));router['put']('/:id',auth[_0x741c('0xa')](),controller['update']);router[_0x741c('0xb')](_0x741c('0xc'),auth['isAuthenticated'](),controller[_0x741c('0xd')]);module[_0x741c('0xe')]=router; \ No newline at end of file +var _0x997e=['isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x4be317,_0x91c396){var _0x16282e=function(_0x28978e){while(--_0x28978e){_0x4be317['push'](_0x4be317['shift']());}};_0x16282e(++_0x91c396);}(_0x997e,0x1a5));var _0xe997=function(_0x471ec4,_0x42c871){_0x471ec4=_0x471ec4-0x0;var _0x43ab60=_0x997e[_0x471ec4];return _0x43ab60;};'use strict';var multer=require(_0xe997('0x0'));var util=require('util');var path=require(_0xe997('0x1'));var timeout=require(_0xe997('0x2'));var express=require(_0xe997('0x3'));var router=express['Router']();var fs_extra=require(_0xe997('0x4'));var auth=require(_0xe997('0x5'));var interaction=require(_0xe997('0x6'));var config=require(_0xe997('0x7'));var controller=require(_0xe997('0x8'));router[_0xe997('0x9')](_0xe997('0xa'),auth[_0xe997('0xb')](),controller[_0xe997('0xc')]);router[_0xe997('0xd')](_0xe997('0xa'),auth[_0xe997('0xb')](),controller[_0xe997('0xe')]);module[_0xe997('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 05dd201..c905ce4 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x1e016c,_0x5b378b){var _0x30bf42=function(_0x346db8){while(--_0x346db8){_0x1e016c['push'](_0x1e016c['shift']());}};_0x30bf42(++_0x5b378b);}(_0xeda8,0x104));var _0x8eda=function(_0x3824d0,_0x56c1a7){_0x3824d0=_0x3824d0-0x0;var _0x52f3b5=_0xeda8[_0x3824d0];return _0x52f3b5;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x46ed,0x168));var _0xd46e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 714736d..d5c743a 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 _0xe8a1=['to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','select','from','table','MetricId','metric','field','function','replace','groupBy','order','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20NULL','AnalyticMetric','keyBy','output','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','countTable','COUNT(*)','run','runReport','debug','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto'];(function(_0x29ca31,_0x533b71){var _0xe163bc=function(_0x2e9432){while(--_0x2e9432){_0x29ca31['push'](_0x29ca31['shift']());}};_0xe163bc(++_0x533b71);}(_0xe8a1,0x1d8));var _0x1e8a=function(_0x26ba35,_0x40e9fa){_0x26ba35=_0x26ba35-0x0;var _0x5c2561=_0xe8a1[_0x26ba35];return _0x5c2561;};'use strict';var emlformat=require(_0x1e8a('0x0'));var rimraf=require(_0x1e8a('0x1'));var zipdir=require(_0x1e8a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e8a('0x3'));var moment=require(_0x1e8a('0x4'));var BPromise=require(_0x1e8a('0x5'));var Mustache=require(_0x1e8a('0x6'));var util=require(_0x1e8a('0x7'));var path=require(_0x1e8a('0x8'));var sox=require(_0x1e8a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e8a('0xa'));var _=require(_0x1e8a('0xb'));var squel=require(_0x1e8a('0xc'));var crypto=require(_0x1e8a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e8a('0xe'));var querystring=require('querystring');var Papa=require(_0x1e8a('0xf'));var Redis=require(_0x1e8a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e8a('0x11'));var hardwareService=require(_0x1e8a('0x12'));var logger=require(_0x1e8a('0x13'))('api');var utils=require(_0x1e8a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1e8a('0x15'));var db=require(_0x1e8a('0x16'))['db'];var dbH=require(_0x1e8a('0x16'))[_0x1e8a('0x17')];function respondWithStatusCode(_0x486f09,_0x50a1a8){_0x50a1a8=_0x50a1a8||0xcc;return function(_0x53dcb3){if(_0x53dcb3){return _0x486f09['sendStatus'](_0x50a1a8);}return _0x486f09[_0x1e8a('0x18')](_0x50a1a8)[_0x1e8a('0x19')]();};}function respondWithResult(_0x2187e7,_0x5f2006){_0x5f2006=_0x5f2006||0xc8;return function(_0x5a70bf){if(_0x5a70bf){return _0x2187e7[_0x1e8a('0x18')](_0x5f2006)[_0x1e8a('0x1a')](_0x5a70bf);}};}function respondWithFilteredResult(_0x5dc0d3,_0x1a466a){return function(_0x2546f7){if(_0x2546f7){var _0x14654e=typeof _0x1a466a[_0x1e8a('0x1b')]===_0x1e8a('0x1c')&&typeof _0x1a466a['limit']===_0x1e8a('0x1c');var _0x5aab0e=_0x2546f7[_0x1e8a('0x1d')];var _0x54d6fc=_0x14654e?0x0:_0x1a466a[_0x1e8a('0x1b')];var _0x4d0e63=_0x14654e?_0x2546f7['count']:_0x1a466a['offset']+_0x1a466a[_0x1e8a('0x1e')];var _0x2a9e0e;if(_0x4d0e63>=_0x5aab0e){_0x4d0e63=_0x5aab0e;_0x2a9e0e=0xc8;}else{_0x2a9e0e=0xce;}_0x5dc0d3[_0x1e8a('0x18')](_0x2a9e0e);return _0x5dc0d3['set'](_0x1e8a('0x1f'),_0x54d6fc+'-'+_0x4d0e63+'/'+_0x5aab0e)['json'](_0x2546f7);}return null;};}function patchUpdates(_0x546f0e){return function(_0x4d7995){try{jsonpatch['apply'](_0x4d7995,_0x546f0e,!![]);}catch(_0x3fdb89){return BPromise[_0x1e8a('0x20')](_0x3fdb89);}return _0x4d7995['save']();};}function saveUpdates(_0xb957c7,_0x184d2b){return function(_0x84c223){if(_0x84c223){return _0x84c223[_0x1e8a('0x21')](_0xb957c7)[_0x1e8a('0x22')](function(_0x45a515){return _0x45a515;});}return null;};}function removeEntity(_0x4f9815,_0x1de545){return function(_0x52985e){if(_0x52985e){return _0x52985e[_0x1e8a('0x23')]()['then'](function(){var _0x57e70c=_0x52985e['get']({'plain':!![]});var _0xd4a087=_0x1e8a('0x24');return db[_0x1e8a('0x25')][_0x1e8a('0x23')]({'where':{'type':_0xd4a087,'resourceId':_0x57e70c['id']}})[_0x1e8a('0x22')](function(){return _0x52985e;});})[_0x1e8a('0x22')](function(){_0x4f9815[_0x1e8a('0x18')](0xcc)[_0x1e8a('0x19')]();});}};}function handleEntityNotFound(_0x1fa07b,_0x925562){return function(_0x3963ce){if(!_0x3963ce){_0x1fa07b[_0x1e8a('0x26')](0x194);}return _0x3963ce;};}function handleError(_0x5eea6c,_0x3ee751){_0x3ee751=_0x3ee751||0x1f4;return function(_0x235427){logger[_0x1e8a('0x27')](_0x235427[_0x1e8a('0x28')]);if(_0x235427[_0x1e8a('0x29')]){delete _0x235427[_0x1e8a('0x29')];}_0x5eea6c['status'](_0x3ee751)[_0x1e8a('0x2a')](_0x235427);};}exports[_0x1e8a('0x2b')]=function(_0x307dca,_0x33d056){var _0x2bd9a9={},_0x162611={},_0x514ed7={'count':0x0,'rows':[]};var _0xa3042e=_[_0x1e8a('0x2c')](db[_0x1e8a('0x2d')][_0x1e8a('0x2e')],function(_0x264d8f){return{'name':_0x264d8f['fieldName'],'type':_0x264d8f[_0x1e8a('0x2f')][_0x1e8a('0x30')]};});_0x162611[_0x1e8a('0x31')]=_[_0x1e8a('0x2c')](_0xa3042e,_0x1e8a('0x29'));_0x162611[_0x1e8a('0x32')]=_['keys'](_0x307dca[_0x1e8a('0x32')]);_0x162611[_0x1e8a('0x33')]=_[_0x1e8a('0x34')](_0x162611[_0x1e8a('0x31')],_0x162611['query']);_0x2bd9a9[_0x1e8a('0x35')]=_[_0x1e8a('0x34')](_0x162611[_0x1e8a('0x31')],qs[_0x1e8a('0x36')](_0x307dca[_0x1e8a('0x32')][_0x1e8a('0x36')]));_0x2bd9a9[_0x1e8a('0x35')]=_0x2bd9a9['attributes'][_0x1e8a('0x37')]?_0x2bd9a9['attributes']:_0x162611['model'];if(!_0x307dca['query']['hasOwnProperty'](_0x1e8a('0x38'))){_0x2bd9a9['limit']=qs[_0x1e8a('0x1e')](_0x307dca[_0x1e8a('0x32')][_0x1e8a('0x1e')]);_0x2bd9a9['offset']=qs['offset'](_0x307dca[_0x1e8a('0x32')][_0x1e8a('0x1b')]);}_0x2bd9a9['order']=qs[_0x1e8a('0x39')](_0x307dca[_0x1e8a('0x32')]['sort']);_0x2bd9a9[_0x1e8a('0x3a')]=qs[_0x1e8a('0x33')](_[_0x1e8a('0x3b')](_0x307dca['query'],_0x162611['filters']),_0xa3042e);if(_0x307dca[_0x1e8a('0x32')]['filter']){_0x2bd9a9[_0x1e8a('0x3a')]=_[_0x1e8a('0x3c')](_0x2bd9a9[_0x1e8a('0x3a')],{'$or':_[_0x1e8a('0x2c')](_0xa3042e,function(_0x257718){if(_0x257718[_0x1e8a('0x2f')]!==_0x1e8a('0x3d')){var _0xed3bee={};_0xed3bee[_0x257718[_0x1e8a('0x29')]]={'$like':'%'+_0x307dca[_0x1e8a('0x32')]['filter']+'%'};return _0xed3bee;}})});}_0x2bd9a9=_[_0x1e8a('0x3c')]({},_0x2bd9a9,_0x307dca[_0x1e8a('0x3e')]);var _0x98facc={'where':_0x2bd9a9[_0x1e8a('0x3a')]};return db[_0x1e8a('0x2d')][_0x1e8a('0x1d')](_0x98facc)[_0x1e8a('0x22')](function(_0x77cdc2){_0x514ed7[_0x1e8a('0x1d')]=_0x77cdc2;if(_0x307dca[_0x1e8a('0x32')][_0x1e8a('0x3f')]){_0x2bd9a9[_0x1e8a('0x40')]=[{'all':!![]}];}return db[_0x1e8a('0x2d')][_0x1e8a('0x41')](_0x2bd9a9);})['then'](function(_0x198d1f){_0x514ed7[_0x1e8a('0x42')]=_0x198d1f;return _0x514ed7;})[_0x1e8a('0x22')](respondWithFilteredResult(_0x33d056,_0x2bd9a9))[_0x1e8a('0x43')](handleError(_0x33d056,null));};exports[_0x1e8a('0x44')]=function(_0x22c709,_0x4a9a14){var _0x22c600={'raw':![],'where':{'id':_0x22c709[_0x1e8a('0x45')]['id']}},_0x1fbf0a={};_0x1fbf0a[_0x1e8a('0x31')]=_[_0x1e8a('0x46')](db[_0x1e8a('0x2d')][_0x1e8a('0x2e')]);_0x1fbf0a[_0x1e8a('0x32')]=_[_0x1e8a('0x46')](_0x22c709[_0x1e8a('0x32')]);_0x1fbf0a[_0x1e8a('0x33')]=_[_0x1e8a('0x34')](_0x1fbf0a[_0x1e8a('0x31')],_0x1fbf0a[_0x1e8a('0x32')]);_0x22c600['attributes']=_[_0x1e8a('0x34')](_0x1fbf0a[_0x1e8a('0x31')],qs['fields'](_0x22c709[_0x1e8a('0x32')][_0x1e8a('0x36')]));_0x22c600[_0x1e8a('0x35')]=_0x22c600['attributes'][_0x1e8a('0x37')]?_0x22c600[_0x1e8a('0x35')]:_0x1fbf0a[_0x1e8a('0x31')];if(_0x22c709[_0x1e8a('0x32')]['includeAll']){_0x22c600[_0x1e8a('0x40')]=[{'all':!![]}];}_0x22c600=_[_0x1e8a('0x3c')]({},_0x22c600,_0x22c709[_0x1e8a('0x3e')]);return db['AnalyticCustomReport'][_0x1e8a('0x47')](_0x22c600)[_0x1e8a('0x22')](handleEntityNotFound(_0x4a9a14,null))[_0x1e8a('0x22')](respondWithResult(_0x4a9a14,null))[_0x1e8a('0x43')](handleError(_0x4a9a14,null));};exports[_0x1e8a('0x48')]=function(_0x162e62,_0x32e243){return db[_0x1e8a('0x2d')][_0x1e8a('0x48')](_0x162e62[_0x1e8a('0x49')],{})[_0x1e8a('0x22')](function(_0x270eb8){var _0x219fec=_0x162e62[_0x1e8a('0x4a')][_0x1e8a('0x4b')]({'plain':!![]});if(!_0x219fec)throw new Error(_0x1e8a('0x4c'));if(_0x219fec['role']==='user'){var _0xe774f1=_0x270eb8['get']({'plain':!![]});var _0x2c825b=_0x1e8a('0x4d');return db['UserProfileSection'][_0x1e8a('0x47')]({'where':{'name':_0x2c825b,'userProfileId':_0x219fec[_0x1e8a('0x4e')]},'raw':!![]})[_0x1e8a('0x22')](function(_0x2ece68){if(_0x2ece68&&_0x2ece68[_0x1e8a('0x4f')]===0x0){return db[_0x1e8a('0x25')][_0x1e8a('0x48')]({'name':_0xe774f1[_0x1e8a('0x29')],'resourceId':_0xe774f1['id'],'type':_0x1e8a('0x24'),'sectionId':_0x2ece68['id']},{})[_0x1e8a('0x22')](function(){return _0x270eb8;});}else{return _0x270eb8;}})['catch'](function(_0x55cad5){logger[_0x1e8a('0x27')](_0x1e8a('0x50'),_0x55cad5);throw _0x55cad5;});}return _0x270eb8;})['then'](respondWithResult(_0x32e243,0xc9))[_0x1e8a('0x43')](handleError(_0x32e243,null));};exports[_0x1e8a('0x21')]=function(_0x70c6e5,_0x25106f){if(_0x70c6e5[_0x1e8a('0x49')]['id']){delete _0x70c6e5[_0x1e8a('0x49')]['id'];}return db[_0x1e8a('0x2d')]['find']({'where':{'id':_0x70c6e5[_0x1e8a('0x45')]['id']}})[_0x1e8a('0x22')](handleEntityNotFound(_0x25106f,null))[_0x1e8a('0x22')](saveUpdates(_0x70c6e5['body'],null))[_0x1e8a('0x22')](respondWithResult(_0x25106f,null))[_0x1e8a('0x43')](handleError(_0x25106f,null));};exports[_0x1e8a('0x23')]=function(_0x1a1b97,_0x4d2235){return db[_0x1e8a('0x2d')][_0x1e8a('0x47')]({'where':{'id':_0x1a1b97['params']['id']}})['then'](handleEntityNotFound(_0x4d2235,null))['then'](removeEntity(_0x4d2235,null))['catch'](handleError(_0x4d2235,null));};exports['preview']=function(_0x3f4e0d,_0x3f4a2c){var _0x50cc55=0xa;var _0x6dd56d=[_0x1e8a('0x51'),_0x1e8a('0x52'),_0x1e8a('0x53'),_0x1e8a('0x54')];var _0x34656a={'SUM':_0x1e8a('0x55'),'COUNT':_0x1e8a('0x56'),'COUNT DISTINCT':_0x1e8a('0x57'),'MAX':_0x1e8a('0x58'),'MIN':_0x1e8a('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1e8a('0x5a'),'GROUP_CONCAT ASC':_0x1e8a('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x304ec9={'SEC_TO_TIME':_0x1e8a('0x5c'),'DATE':_0x1e8a('0x5d'),'HOUR':_0x1e8a('0x5e'),'ROUND':_0x1e8a('0x5f'),'UNIX_TIMESTAMP':_0x1e8a('0x60')};var _0x439e46=function(_0x142baf){return!_[_0x1e8a('0x61')]([_0x1e8a('0x62'),'IS\x20NOT\x20NULL',_0x1e8a('0x63'),_0x1e8a('0x64')],_0x142baf);};var _0x4dc35b=function(_0x396e69){if(!_0x396e69||!_0x396e69[_0x1e8a('0x65')][_0x1e8a('0x37')]){return'';}for(var _0x15f2ab='(',_0x5a3d3a=0x0;_0x5a3d3a<_0x396e69[_0x1e8a('0x65')]['length'];_0x5a3d3a+=0x1){_0x5a3d3a>0x0&&(_0x15f2ab+='\x20'+_0x396e69[_0x1e8a('0x66')]+'\x20');_0x15f2ab+=_0x396e69['rules'][_0x5a3d3a][_0x1e8a('0x67')]?_0x4dc35b(_0x396e69[_0x1e8a('0x65')][_0x5a3d3a][_0x1e8a('0x67')]):_0x396e69['rules'][_0x5a3d3a]['field']+'\x20'+_0x396e69[_0x1e8a('0x65')][_0x5a3d3a][_0x1e8a('0x68')]+(_0x439e46(_0x396e69[_0x1e8a('0x65')][_0x5a3d3a][_0x1e8a('0x68')])?'\x20'+_0x396e69[_0x1e8a('0x65')][_0x5a3d3a][_0x1e8a('0x69')]:'');}return _0x15f2ab+')';};var _0x26c238={'where':{'id':_0x3f4e0d['params']['id']}},_0x59d62a,_0xf48a10,_0x50411e,_0xf8c3ba,_0x40e5cd;_0x26c238=_['merge']({},_0x26c238,_0x3f4e0d[_0x1e8a('0x3e')]);return db['AnalyticCustomReport'][_0x1e8a('0x47')](_0x26c238)[_0x1e8a('0x22')](function(_0x5deed9){if(_0x5deed9){_0x59d62a=_0x5deed9;return _0x5deed9[_0x1e8a('0x6a')]();}return null;})[_0x1e8a('0x22')](function(_0x4b6feb){if(_0x4b6feb){if(!_0x4b6feb['length']){throw new db[(_0x1e8a('0x6b'))][(_0x1e8a('0x6c'))](_0x1e8a('0x6d'),0x193);}_0xf48a10=_0x4b6feb;return db['AnalyticMetric'][_0x1e8a('0x41')]({'raw':!![]});}return null;})[_0x1e8a('0x22')](function(_0x463f83){if(_0x463f83){_0x50411e=_['keyBy'](_0x463f83,'id');var _0x28a29a;var _0x216c32=squel[_0x1e8a('0x6e')]();_0x216c32[_0x1e8a('0x6f')](_0x59d62a[_0x1e8a('0x70')]);for(var _0x59fb72=0x0;_0x59fb72<_0xf48a10['length'];_0x59fb72+=0x1){_0x28a29a=_0xf48a10[_0x59fb72][_0x1e8a('0x71')]?_0x50411e[_0xf48a10[_0x59fb72][_0x1e8a('0x71')]][_0x1e8a('0x72')]:_0xf48a10[_0x59fb72][_0x1e8a('0x73')];_0x28a29a=_0xf48a10[_0x59fb72][_0x1e8a('0x74')]?_[_0x1e8a('0x75')](_0x34656a[_0xf48a10[_0x59fb72][_0x1e8a('0x74')]],'%s',_0x28a29a):_0x28a29a;_0x28a29a=_0xf48a10[_0x59fb72]['format']?_[_0x1e8a('0x75')](_0x304ec9[_0xf48a10[_0x59fb72]['format']],'%s',_0x28a29a):_0x28a29a;if(_0xf48a10[_0x59fb72][_0x1e8a('0x76')]){_0x216c32[_0x1e8a('0x67')](_0x28a29a);}_0xf48a10[_0x59fb72]['orderBy']&&_0x216c32[_0x1e8a('0x77')](_0x28a29a,_0xf48a10[_0x59fb72][_0x1e8a('0x78')]===_0x1e8a('0x79')?![]:!![]);_0x216c32[_0x1e8a('0x73')](_0x28a29a,_0xf48a10[_0x59fb72][_0x1e8a('0x7a')]||_0x28a29a);}if(_0x59d62a[_0x1e8a('0x7b')]){_0x59d62a['joins']=JSON[_0x1e8a('0x7c')](_0x59d62a[_0x1e8a('0x7b')]);for(var _0x349deb=0x0;_0x349deb<_0x59d62a[_0x1e8a('0x7b')]['length'];_0x349deb+=0x1){if(_0x59d62a[_0x1e8a('0x7b')][_0x349deb]['type']&&_[_0x1e8a('0x61')](_0x6dd56d,_0x59d62a[_0x1e8a('0x7b')][_0x349deb][_0x1e8a('0x2f')])&&_0x59d62a['joins'][_0x349deb][_0x1e8a('0x7d')]&&_0x59d62a[_0x1e8a('0x7b')][_0x349deb][_0x1e8a('0x7e')]&&_0x59d62a[_0x1e8a('0x7b')][_0x349deb][_0x1e8a('0x7f')]){_0x216c32[_0x59d62a[_0x1e8a('0x7b')][_0x349deb][_0x1e8a('0x2f')]](_0x59d62a[_0x1e8a('0x7b')][_0x349deb][_0x1e8a('0x7e')],null,util[_0x1e8a('0x80')](_0x1e8a('0x81'),_0x59d62a['table'],_0x59d62a[_0x1e8a('0x7b')][_0x349deb]['parentKey'],_0x59d62a[_0x1e8a('0x7b')][_0x349deb][_0x1e8a('0x7e')],_0x59d62a[_0x1e8a('0x7b')][_0x349deb]['foreignKey']));}}}if(_0x59d62a['conditions']){_0x59d62a[_0x1e8a('0x82')]=JSON[_0x1e8a('0x7c')](_0x59d62a[_0x1e8a('0x82')]);_0x216c32[_0x1e8a('0x3a')](_0x4dc35b(_0x59d62a['conditions'][_0x1e8a('0x67')]));}_0x40e5cd=_0x216c32[_0x1e8a('0x83')]();_0x216c32[_0x1e8a('0x1e')](_0x50cc55);_0x216c32[_0x1e8a('0x1b')](0x0);logger['debug'](_0x1e8a('0x84'),_0x216c32['toString']());return dbH[_0x1e8a('0x85')][_0x1e8a('0x32')](_0x216c32[_0x1e8a('0x86')](),{'type':dbH[_0x1e8a('0x85')][_0x1e8a('0x87')][_0x1e8a('0x88')]});}})[_0x1e8a('0x22')](respondWithResult(_0x3f4a2c,null))['catch'](handleError(_0x3f4a2c,null));};function runReport(_0x339271,_0x3d773c,_0x4c42f6){var _0x18dff7=_0x3d773c['name'];var _0x3654af=0xa;var _0x16a7f6=[_0x1e8a('0x51'),_0x1e8a('0x52'),_0x1e8a('0x53'),_0x1e8a('0x54')];var _0x1ab659={'SUM':_0x1e8a('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1e8a('0x58'),'MIN':_0x1e8a('0x59'),'AVG':_0x1e8a('0x89'),'GROUP_CONCAT':_0x1e8a('0x5a'),'GROUP_CONCAT ASC':_0x1e8a('0x5b'),'GROUP_CONCAT DESC':_0x1e8a('0x8a')};var _0x3e3a25={'SEC_TO_TIME':_0x1e8a('0x5c'),'DATE':_0x1e8a('0x5d'),'HOUR':_0x1e8a('0x5e'),'ROUND':_0x1e8a('0x5f'),'UNIX_TIMESTAMP':_0x1e8a('0x60')};var _0x7e6620=function(_0x17fed3){return!_['includes'](['IS\x20NULL',_0x1e8a('0x8b'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x17fed3);};var _0x4bcf58=function(_0x3fec7d){if(!_0x3fec7d||!_0x3fec7d[_0x1e8a('0x65')]['length']){return'';}for(var _0x144941='(',_0x4b6f15=0x0;_0x4b6f15<_0x3fec7d['rules'][_0x1e8a('0x37')];_0x4b6f15+=0x1){_0x4b6f15>0x0&&(_0x144941+='\x20'+_0x3fec7d[_0x1e8a('0x66')]+'\x20');_0x144941+=_0x3fec7d[_0x1e8a('0x65')][_0x4b6f15][_0x1e8a('0x67')]?_0x4bcf58(_0x3fec7d[_0x1e8a('0x65')][_0x4b6f15][_0x1e8a('0x67')]):_0x3fec7d[_0x1e8a('0x65')][_0x4b6f15][_0x1e8a('0x73')]+'\x20'+_0x3fec7d[_0x1e8a('0x65')][_0x4b6f15][_0x1e8a('0x68')]+(_0x7e6620(_0x3fec7d['rules'][_0x4b6f15][_0x1e8a('0x68')])?'\x20'+_0x3fec7d['rules'][_0x4b6f15]['value']:'');}return _0x144941+')';};var _0x1052ad={'where':{'id':_0x339271['id']}},_0x99724e,_0x131f9f,_0x1485b7,_0x2074b8,_0x167d20;_0x1052ad=_[_0x1e8a('0x3c')]({},_0x1052ad,_0x4c42f6);return db[_0x1e8a('0x2d')][_0x1e8a('0x47')](_0x1052ad)[_0x1e8a('0x22')](function(_0x5575a7){if(_0x5575a7){_0x99724e=_0x5575a7;return _0x5575a7[_0x1e8a('0x6a')]();}return null;})[_0x1e8a('0x22')](function(_0x414050){if(_0x414050){if(!_0x414050[_0x1e8a('0x37')]){throw new db[(_0x1e8a('0x6b'))][(_0x1e8a('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x131f9f=_0x414050;return db[_0x1e8a('0x8c')]['findAll']({'raw':!![]});}return null;})[_0x1e8a('0x22')](function(_0x470d41){if(_0x470d41){_0x1485b7=_[_0x1e8a('0x8d')](_0x470d41,'id');var _0x350eb4;var _0x461d1d=squel['select']();_0x461d1d['from'](_0x99724e[_0x1e8a('0x70')]);for(var _0x3c2f3a=0x0;_0x3c2f3a<_0x131f9f['length'];_0x3c2f3a+=0x1){_0x350eb4=_0x131f9f[_0x3c2f3a]['MetricId']?_0x1485b7[_0x131f9f[_0x3c2f3a][_0x1e8a('0x71')]]['metric']:_0x131f9f[_0x3c2f3a][_0x1e8a('0x73')];_0x350eb4=_0x131f9f[_0x3c2f3a][_0x1e8a('0x74')]?_[_0x1e8a('0x75')](_0x1ab659[_0x131f9f[_0x3c2f3a][_0x1e8a('0x74')]],'%s',_0x350eb4):_0x350eb4;_0x350eb4=_0x131f9f[_0x3c2f3a][_0x1e8a('0x80')]?_[_0x1e8a('0x75')](_0x3e3a25[_0x131f9f[_0x3c2f3a]['format']],'%s',_0x350eb4):_0x350eb4;if(_0x131f9f[_0x3c2f3a][_0x1e8a('0x76')]){_0x461d1d[_0x1e8a('0x67')](_0x350eb4);}_0x131f9f[_0x3c2f3a][_0x1e8a('0x78')]&&_0x461d1d[_0x1e8a('0x77')](_0x350eb4,_0x131f9f[_0x3c2f3a][_0x1e8a('0x78')]===_0x1e8a('0x79')?![]:!![]);_0x461d1d[_0x1e8a('0x73')](_0x350eb4,_0x131f9f[_0x3c2f3a][_0x1e8a('0x7a')]||_0x350eb4);}if(_0x99724e[_0x1e8a('0x7b')]){_0x99724e['joins']=JSON[_0x1e8a('0x7c')](_0x99724e[_0x1e8a('0x7b')]);for(var _0x456976=0x0;_0x456976<_0x99724e['joins'][_0x1e8a('0x37')];_0x456976+=0x1){if(_0x99724e['joins'][_0x456976][_0x1e8a('0x2f')]&&_['includes'](_0x16a7f6,_0x99724e[_0x1e8a('0x7b')][_0x456976][_0x1e8a('0x2f')])&&_0x99724e[_0x1e8a('0x7b')][_0x456976]['parentKey']&&_0x99724e[_0x1e8a('0x7b')][_0x456976][_0x1e8a('0x7e')]&&_0x99724e['joins'][_0x456976][_0x1e8a('0x7f')]){_0x461d1d[_0x99724e['joins'][_0x456976][_0x1e8a('0x2f')]](_0x99724e[_0x1e8a('0x7b')][_0x456976][_0x1e8a('0x7e')],null,util[_0x1e8a('0x80')](_0x1e8a('0x81'),_0x99724e[_0x1e8a('0x70')],_0x99724e[_0x1e8a('0x7b')][_0x456976][_0x1e8a('0x7d')],_0x99724e[_0x1e8a('0x7b')][_0x456976][_0x1e8a('0x7e')],_0x99724e[_0x1e8a('0x7b')][_0x456976][_0x1e8a('0x7f')]));}}}if(_0x99724e[_0x1e8a('0x82')]){_0x99724e[_0x1e8a('0x82')]=JSON['parse'](_0x99724e[_0x1e8a('0x82')]);_0x461d1d[_0x1e8a('0x3a')](_0x4bcf58(_0x99724e[_0x1e8a('0x82')][_0x1e8a('0x67')]));}_0x167d20=_0x461d1d[_0x1e8a('0x83')]();_0x461d1d[_0x1e8a('0x1e')](_0x3654af);_0x461d1d[_0x1e8a('0x1b')](0x0);return;}})[_0x1e8a('0x22')](function(){if(_0x3d773c[_0x1e8a('0x8e')]==='web'){return null;}var _0x11756d=_[_0x1e8a('0x3c')](_0x3d773c,{'name':_0x3d773c[_0x1e8a('0x8f')]||_0x3d773c[_0x1e8a('0x29')]||_0x99724e[_0x1e8a('0x29')],'basename':_0x18dff7,'savename':util[_0x1e8a('0x80')]('%s-%s.%s',_0x3d773c['name']||_0x99724e[_0x1e8a('0x29')],require(_0x1e8a('0x90'))[_0x1e8a('0x91')](0x4),_0x3d773c[_0x1e8a('0x8e')]||_0x1e8a('0x92')),'reportId':_0x99724e['id'],'reportType':_0x1e8a('0x93')});return db[_0x1e8a('0x94')][_0x1e8a('0x48')](_0x11756d,{'raw':!![]});})[_0x1e8a('0x22')](function(_0x3729ec){if(_0x99724e[_0x1e8a('0x70')]===_0x1e8a('0x95')){_0x167d20[_0x1e8a('0x3a')](_0x99724e[_0x1e8a('0x70')]+_0x1e8a('0x96'),_0x3d773c[_0x1e8a('0x97')],_0x3d773c[_0x1e8a('0x98')]);}else{_0x167d20[_0x1e8a('0x3a')](_0x99724e[_0x1e8a('0x70')]+_0x1e8a('0x99'),_0x3d773c[_0x1e8a('0x97')],_0x3d773c[_0x1e8a('0x98')]);}if(_0x3729ec){logger['info'](_0x1e8a('0x9a'),_0x167d20[_0x1e8a('0x86')]());require('child_process')[_0x1e8a('0x9b')](path[_0x1e8a('0x51')](__dirname,_0x1e8a('0x9c'),_0x3729ec[_0x1e8a('0x8e')]),[_0x3729ec['id'],_0x167d20[_0x1e8a('0x86')](),path[_0x1e8a('0x51')](__dirname,'../../files/reports',_0x3729ec['savename']),_0x18dff7]);return _0x3729ec;}else{var _0x18e215=squel[_0x1e8a('0x6e')]();_0x18e215['from']('('+_0x167d20['toString']()+')',_0x1e8a('0x9d'));_0x18e215[_0x1e8a('0x73')](_0x1e8a('0x9e'),'count');_0x167d20['limit'](_0x3d773c[_0x1e8a('0x1e')]||_0x3654af);_0x167d20[_0x1e8a('0x1b')](_0x3d773c[_0x1e8a('0x1b')]||0x0);return dbH['sequelize'][_0x1e8a('0x32')](_0x18e215[_0x1e8a('0x86')](),{'type':dbH[_0x1e8a('0x85')][_0x1e8a('0x87')][_0x1e8a('0x88')]})[_0x1e8a('0x22')](function(_0x435847){if(!_0x435847[_0x1e8a('0x37')]){_0x2074b8=0x0;}else{_0x2074b8=_0x435847[0x0][_0x1e8a('0x1d')]||0x0;}return dbH['sequelize'][_0x1e8a('0x32')](_0x167d20['toString'](),{'type':dbH[_0x1e8a('0x85')][_0x1e8a('0x87')][_0x1e8a('0x88')]});})[_0x1e8a('0x22')](function(_0x2a25e1){return{'rows':_0x2a25e1||[],'count':_0x2074b8};});}});}exports[_0x1e8a('0x9f')]=function(_0xcf4992,_0x52c5e3){return runReport(_0xcf4992[_0x1e8a('0x45')],_0xcf4992[_0x1e8a('0x32')],_0xcf4992['options'])[_0x1e8a('0x22')](respondWithResult(_0x52c5e3,null))[_0x1e8a('0x43')](handleError(_0x52c5e3,null));};exports[_0x1e8a('0xa0')]=runReport;exports[_0x1e8a('0x32')]=function(_0x5a5ac5,_0x390e8f){var _0x165a27=0xa;var _0x3c9cf4=[_0x1e8a('0x51'),_0x1e8a('0x52'),_0x1e8a('0x53'),_0x1e8a('0x54')];var _0x409c02={'SUM':_0x1e8a('0x55'),'COUNT':_0x1e8a('0x56'),'COUNT DISTINCT':_0x1e8a('0x57'),'MAX':'MAX(%s)','MIN':_0x1e8a('0x59'),'AVG':_0x1e8a('0x89'),'GROUP_CONCAT':_0x1e8a('0x5a'),'GROUP_CONCAT ASC':_0x1e8a('0x5b'),'GROUP_CONCAT DESC':_0x1e8a('0x8a')};var _0x3362c4={'SEC_TO_TIME':_0x1e8a('0x5c'),'DATE':_0x1e8a('0x5d'),'HOUR':_0x1e8a('0x5e'),'ROUND':_0x1e8a('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45acee=function(_0x2ff9a9){return!_[_0x1e8a('0x61')](['IS\x20NULL',_0x1e8a('0x8b'),_0x1e8a('0x63'),'IS\x20NOT\x20EMPTY'],_0x2ff9a9);};var _0xee3c=function(_0x498c51){if(!_0x498c51||!_0x498c51[_0x1e8a('0x65')][_0x1e8a('0x37')]){return'';}for(var _0x3539b7='(',_0x259e77=0x0;_0x259e77<_0x498c51['rules'][_0x1e8a('0x37')];_0x259e77+=0x1){_0x259e77>0x0&&(_0x3539b7+='\x20'+_0x498c51[_0x1e8a('0x66')]+'\x20');_0x3539b7+=_0x498c51[_0x1e8a('0x65')][_0x259e77][_0x1e8a('0x67')]?_0xee3c(_0x498c51[_0x1e8a('0x65')][_0x259e77]['group']):_0x498c51[_0x1e8a('0x65')][_0x259e77][_0x1e8a('0x73')]+'\x20'+_0x498c51[_0x1e8a('0x65')][_0x259e77][_0x1e8a('0x68')]+(_0x45acee(_0x498c51['rules'][_0x259e77][_0x1e8a('0x68')])?'\x20'+_0x498c51['rules'][_0x259e77][_0x1e8a('0x69')]:'');}return _0x3539b7+')';};var _0x5b736b={'where':{'id':_0x5a5ac5['params']['id']}},_0x37c405,_0x59f590,_0x198333,_0x34b541,_0x5a3da1;_0x5b736b=_['merge']({},_0x5b736b,_0x5a5ac5[_0x1e8a('0x3e')]);return db[_0x1e8a('0x2d')][_0x1e8a('0x47')](_0x5b736b)['then'](function(_0x3cb6f9){if(_0x3cb6f9){_0x37c405=_0x3cb6f9;return _0x3cb6f9[_0x1e8a('0x6a')]();}return null;})['then'](function(_0x3f3cfb){if(_0x3f3cfb){if(!_0x3f3cfb[_0x1e8a('0x37')]){throw new db[(_0x1e8a('0x6b'))][(_0x1e8a('0x6c'))](_0x1e8a('0x6d'),0x193);}_0x59f590=_0x3f3cfb;return db['AnalyticMetric'][_0x1e8a('0x41')]({'raw':!![]});}return null;})[_0x1e8a('0x22')](function(_0x17d7f2){if(_0x17d7f2){_0x198333=_[_0x1e8a('0x8d')](_0x17d7f2,'id');var _0x57317b;var _0x5bc22e=squel[_0x1e8a('0x6e')]();_0x5bc22e[_0x1e8a('0x6f')](_0x37c405[_0x1e8a('0x70')]);for(var _0x1ee05e=0x0;_0x1ee05e<_0x59f590[_0x1e8a('0x37')];_0x1ee05e+=0x1){_0x57317b=_0x59f590[_0x1ee05e][_0x1e8a('0x71')]?_0x198333[_0x59f590[_0x1ee05e]['MetricId']]['metric']:_0x59f590[_0x1ee05e][_0x1e8a('0x73')];_0x57317b=_0x59f590[_0x1ee05e]['function']?_[_0x1e8a('0x75')](_0x409c02[_0x59f590[_0x1ee05e][_0x1e8a('0x74')]],'%s',_0x57317b):_0x57317b;_0x57317b=_0x59f590[_0x1ee05e]['format']?_['replace'](_0x3362c4[_0x59f590[_0x1ee05e][_0x1e8a('0x80')]],'%s',_0x57317b):_0x57317b;if(_0x59f590[_0x1ee05e]['groupBy']){_0x5bc22e[_0x1e8a('0x67')](_0x57317b);}_0x59f590[_0x1ee05e][_0x1e8a('0x78')]&&_0x5bc22e['order'](_0x57317b,_0x59f590[_0x1ee05e]['orderBy']===_0x1e8a('0x79')?![]:!![]);_0x5bc22e['field'](_0x57317b,_0x59f590[_0x1ee05e]['alias']||_0x57317b);}if(_0x37c405[_0x1e8a('0x7b')]){_0x37c405[_0x1e8a('0x7b')]=JSON[_0x1e8a('0x7c')](_0x37c405[_0x1e8a('0x7b')]);for(var _0x36f5f7=0x0;_0x36f5f7<_0x37c405[_0x1e8a('0x7b')]['length'];_0x36f5f7+=0x1){if(_0x37c405['joins'][_0x36f5f7]['type']&&_[_0x1e8a('0x61')](_0x3c9cf4,_0x37c405[_0x1e8a('0x7b')][_0x36f5f7]['type'])&&_0x37c405[_0x1e8a('0x7b')][_0x36f5f7][_0x1e8a('0x7d')]&&_0x37c405[_0x1e8a('0x7b')][_0x36f5f7][_0x1e8a('0x7e')]&&_0x37c405['joins'][_0x36f5f7]['foreignKey']){_0x5bc22e[_0x37c405[_0x1e8a('0x7b')][_0x36f5f7]['type']](_0x37c405['joins'][_0x36f5f7][_0x1e8a('0x7e')],null,util[_0x1e8a('0x80')](_0x1e8a('0x81'),_0x37c405[_0x1e8a('0x70')],_0x37c405[_0x1e8a('0x7b')][_0x36f5f7][_0x1e8a('0x7d')],_0x37c405[_0x1e8a('0x7b')][_0x36f5f7][_0x1e8a('0x7e')],_0x37c405[_0x1e8a('0x7b')][_0x36f5f7][_0x1e8a('0x7f')]));}}}if(_0x37c405['conditions']){_0x37c405[_0x1e8a('0x82')]=JSON[_0x1e8a('0x7c')](_0x37c405[_0x1e8a('0x82')]);_0x5bc22e[_0x1e8a('0x3a')](_0xee3c(_0x37c405[_0x1e8a('0x82')][_0x1e8a('0x67')]));}_0x5a3da1=_0x5bc22e[_0x1e8a('0x83')]();_0x5bc22e['limit'](_0x165a27);_0x5bc22e[_0x1e8a('0x1b')](0x0);logger[_0x1e8a('0xa1')](_0x1e8a('0x84'),_0x5bc22e['toString']());return dbH['sequelize']['query'](_0x5bc22e[_0x1e8a('0x86')](),{'type':dbH[_0x1e8a('0x85')][_0x1e8a('0x87')][_0x1e8a('0x88')]});}})[_0x1e8a('0x22')](function(){return{'sql':_0x5a3da1[_0x1e8a('0x86')]()};})[_0x1e8a('0x22')](respondWithResult(_0x390e8f,null))['catch'](handleError(_0x390e8f,null));}; \ No newline at end of file +var _0xaf23=['type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','catch','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','MetricId','function','replace','format','groupBy','group','orderBy','order','DESC','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','toString','sequelize','QueryTypes','SELECT','right_join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','field','Sequelize','keyBy','metric','alias','clone','output','fullPath','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','COUNT(DISTINCT\x20%s)','ValidationErrorItem','debug','Limited\x20Query:','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','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','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf23,0x11a));var _0x3af2=function(_0x1c883a,_0x36ff38){_0x1c883a=_0x1c883a-0x0;var _0xbb8ec0=_0xaf23[_0x1c883a];return _0xbb8ec0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3af2('0x0'));var jsonpatch=require(_0x3af2('0x1'));var rp=require(_0x3af2('0x2'));var moment=require('moment');var BPromise=require(_0x3af2('0x3'));var Mustache=require(_0x3af2('0x4'));var util=require('util');var path=require(_0x3af2('0x5'));var sox=require('sox');var csv=require(_0x3af2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3af2('0x7'));var squel=require(_0x3af2('0x8'));var crypto=require(_0x3af2('0x9'));var jsforce=require(_0x3af2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3af2('0x6'));var querystring=require('querystring');var Papa=require(_0x3af2('0xb'));var Redis=require('ioredis');var authService=require(_0x3af2('0xc'));var qs=require(_0x3af2('0xd'));var as=require(_0x3af2('0xe'));var hardwareService=require(_0x3af2('0xf'));var logger=require(_0x3af2('0x10'))(_0x3af2('0x11'));var utils=require(_0x3af2('0x12'));var config=require(_0x3af2('0x13'));var licenseUtil=require(_0x3af2('0x14'));var db=require(_0x3af2('0x15'))['db'];var dbH=require('../../mysqldb')[_0x3af2('0x16')];function respondWithStatusCode(_0x308943,_0x4246c2){_0x4246c2=_0x4246c2||0xcc;return function(_0x597c56){if(_0x597c56){return _0x308943['sendStatus'](_0x4246c2);}return _0x308943[_0x3af2('0x17')](_0x4246c2)[_0x3af2('0x18')]();};}function respondWithResult(_0x3f5667,_0xe0c6c8){_0xe0c6c8=_0xe0c6c8||0xc8;return function(_0x5dbb0d){if(_0x5dbb0d){return _0x3f5667[_0x3af2('0x17')](_0xe0c6c8)[_0x3af2('0x19')](_0x5dbb0d);}};}function respondWithFilteredResult(_0x821374,_0x5a8f5f){return function(_0x191d2d){if(_0x191d2d){var _0x2d1817=typeof _0x5a8f5f[_0x3af2('0x1a')]===_0x3af2('0x1b')&&typeof _0x5a8f5f['limit']==='undefined';var _0x3303b3=_0x191d2d[_0x3af2('0x1c')];var _0x4c2c56=_0x2d1817?0x0:_0x5a8f5f[_0x3af2('0x1a')];var _0x2552f5=_0x2d1817?_0x191d2d[_0x3af2('0x1c')]:_0x5a8f5f[_0x3af2('0x1a')]+_0x5a8f5f['limit'];var _0x54a55e;if(_0x2552f5>=_0x3303b3){_0x2552f5=_0x3303b3;_0x54a55e=0xc8;}else{_0x54a55e=0xce;}_0x821374[_0x3af2('0x17')](_0x54a55e);return _0x821374[_0x3af2('0x1d')](_0x3af2('0x1e'),_0x4c2c56+'-'+_0x2552f5+'/'+_0x3303b3)[_0x3af2('0x19')](_0x191d2d);}return null;};}function patchUpdates(_0x128bea){return function(_0x54c6ce){try{jsonpatch['apply'](_0x54c6ce,_0x128bea,!![]);}catch(_0xe59a68){return BPromise[_0x3af2('0x1f')](_0xe59a68);}return _0x54c6ce[_0x3af2('0x20')]();};}function saveUpdates(_0x1f10d9,_0x570471){return function(_0x472d10){if(_0x472d10){return _0x472d10[_0x3af2('0x21')](_0x1f10d9)[_0x3af2('0x22')](function(_0x1487ec){return _0x1487ec;});}return null;};}function removeEntity(_0x5248cc,_0xe3d844){return function(_0xf684aa){if(_0xf684aa){return _0xf684aa['destroy']()[_0x3af2('0x22')](function(){var _0x394218=_0xf684aa[_0x3af2('0x23')]({'plain':!![]});var _0x1ebc54=_0x3af2('0x24');return db[_0x3af2('0x25')][_0x3af2('0x26')]({'where':{'type':_0x1ebc54,'resourceId':_0x394218['id']}})[_0x3af2('0x22')](function(){return _0xf684aa;});})['then'](function(){_0x5248cc[_0x3af2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24aa22,_0x1f9cc4){return function(_0x4923fa){if(!_0x4923fa){_0x24aa22[_0x3af2('0x27')](0x194);}return _0x4923fa;};}function handleError(_0x54318b,_0x283603){_0x283603=_0x283603||0x1f4;return function(_0x550f44){logger[_0x3af2('0x28')](_0x550f44[_0x3af2('0x29')]);if(_0x550f44[_0x3af2('0x2a')]){delete _0x550f44[_0x3af2('0x2a')];}_0x54318b[_0x3af2('0x17')](_0x283603)[_0x3af2('0x2b')](_0x550f44);};}exports[_0x3af2('0x2c')]=function(_0x1a981c,_0xfcd2a8){var _0x2fcc14={},_0x575b6f={},_0x2840f5={'count':0x0,'rows':[]};var _0x387624=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x13c7f0){return{'name':_0x13c7f0[_0x3af2('0x2d')],'type':_0x13c7f0[_0x3af2('0x2e')][_0x3af2('0x2f')]};});_0x575b6f['model']=_['map'](_0x387624,_0x3af2('0x2a'));_0x575b6f['query']=_[_0x3af2('0x30')](_0x1a981c[_0x3af2('0x31')]);_0x575b6f[_0x3af2('0x32')]=_[_0x3af2('0x33')](_0x575b6f[_0x3af2('0x34')],_0x575b6f['query']);_0x2fcc14[_0x3af2('0x35')]=_['intersection'](_0x575b6f[_0x3af2('0x34')],qs[_0x3af2('0x36')](_0x1a981c[_0x3af2('0x31')][_0x3af2('0x36')]));_0x2fcc14[_0x3af2('0x35')]=_0x2fcc14['attributes'][_0x3af2('0x37')]?_0x2fcc14[_0x3af2('0x35')]:_0x575b6f[_0x3af2('0x34')];if(!_0x1a981c[_0x3af2('0x31')][_0x3af2('0x38')](_0x3af2('0x39'))){_0x2fcc14[_0x3af2('0x3a')]=qs['limit'](_0x1a981c[_0x3af2('0x31')]['limit']);_0x2fcc14[_0x3af2('0x1a')]=qs[_0x3af2('0x1a')](_0x1a981c[_0x3af2('0x31')]['offset']);}_0x2fcc14['order']=qs[_0x3af2('0x3b')](_0x1a981c[_0x3af2('0x31')]['sort']);_0x2fcc14[_0x3af2('0x3c')]=qs['filters'](_[_0x3af2('0x3d')](_0x1a981c['query'],_0x575b6f[_0x3af2('0x32')]),_0x387624);if(_0x1a981c['query'][_0x3af2('0x3e')]){_0x2fcc14[_0x3af2('0x3c')]=_[_0x3af2('0x3f')](_0x2fcc14[_0x3af2('0x3c')],{'$or':_[_0x3af2('0x40')](_0x387624,function(_0x20ef21){if(_0x20ef21['type']!==_0x3af2('0x41')){var _0x4eba5a={};_0x4eba5a[_0x20ef21[_0x3af2('0x2a')]]={'$like':'%'+_0x1a981c['query'][_0x3af2('0x3e')]+'%'};return _0x4eba5a;}})});}_0x2fcc14=_[_0x3af2('0x3f')]({},_0x2fcc14,_0x1a981c[_0x3af2('0x42')]);var _0x89b9d1={'where':_0x2fcc14['where']};return db[_0x3af2('0x43')]['count'](_0x89b9d1)[_0x3af2('0x22')](function(_0x170e59){_0x2840f5['count']=_0x170e59;if(_0x1a981c[_0x3af2('0x31')][_0x3af2('0x44')]){_0x2fcc14[_0x3af2('0x45')]=[{'all':!![]}];}return db[_0x3af2('0x43')][_0x3af2('0x46')](_0x2fcc14);})[_0x3af2('0x22')](function(_0x25b03f){_0x2840f5['rows']=_0x25b03f;return _0x2840f5;})[_0x3af2('0x22')](respondWithFilteredResult(_0xfcd2a8,_0x2fcc14))[_0x3af2('0x47')](handleError(_0xfcd2a8,null));};exports['show']=function(_0xd38c78,_0x192108){var _0x5b0c14={'raw':![],'where':{'id':_0xd38c78[_0x3af2('0x48')]['id']}},_0x3ac01b={};_0x3ac01b[_0x3af2('0x34')]=_['keys'](db[_0x3af2('0x43')][_0x3af2('0x49')]);_0x3ac01b[_0x3af2('0x31')]=_['keys'](_0xd38c78[_0x3af2('0x31')]);_0x3ac01b[_0x3af2('0x32')]=_['intersection'](_0x3ac01b[_0x3af2('0x34')],_0x3ac01b[_0x3af2('0x31')]);_0x5b0c14[_0x3af2('0x35')]=_[_0x3af2('0x33')](_0x3ac01b[_0x3af2('0x34')],qs[_0x3af2('0x36')](_0xd38c78[_0x3af2('0x31')][_0x3af2('0x36')]));_0x5b0c14[_0x3af2('0x35')]=_0x5b0c14[_0x3af2('0x35')][_0x3af2('0x37')]?_0x5b0c14[_0x3af2('0x35')]:_0x3ac01b[_0x3af2('0x34')];if(_0xd38c78[_0x3af2('0x31')]['includeAll']){_0x5b0c14['include']=[{'all':!![]}];}_0x5b0c14=_[_0x3af2('0x3f')]({},_0x5b0c14,_0xd38c78[_0x3af2('0x42')]);return db[_0x3af2('0x43')]['find'](_0x5b0c14)[_0x3af2('0x22')](handleEntityNotFound(_0x192108,null))[_0x3af2('0x22')](respondWithResult(_0x192108,null))[_0x3af2('0x47')](handleError(_0x192108,null));};exports['create']=function(_0x371803,_0x5490e1){return db[_0x3af2('0x43')][_0x3af2('0x4a')](_0x371803[_0x3af2('0x4b')],{})[_0x3af2('0x22')](function(_0x12dcf7){var _0x4e8894=_0x371803['user'][_0x3af2('0x23')]({'plain':!![]});if(!_0x4e8894)throw new Error(_0x3af2('0x4c'));if(_0x4e8894[_0x3af2('0x4d')]===_0x3af2('0x4e')){var _0x5a66a8=_0x12dcf7[_0x3af2('0x23')]({'plain':!![]});var _0x5185a1='Reports';return db['UserProfileSection'][_0x3af2('0x4f')]({'where':{'name':_0x5185a1,'userProfileId':_0x4e8894[_0x3af2('0x50')]},'raw':!![]})[_0x3af2('0x22')](function(_0x3b6a69){if(_0x3b6a69&&_0x3b6a69[_0x3af2('0x51')]===0x0){return db['UserProfileResource'][_0x3af2('0x4a')]({'name':_0x5a66a8[_0x3af2('0x2a')],'resourceId':_0x5a66a8['id'],'type':_0x3af2('0x24'),'sectionId':_0x3b6a69['id']},{})[_0x3af2('0x22')](function(){return _0x12dcf7;});}else{return _0x12dcf7;}})[_0x3af2('0x47')](function(_0xb5a4d6){logger[_0x3af2('0x28')](_0x3af2('0x52'),_0xb5a4d6);throw _0xb5a4d6;});}return _0x12dcf7;})[_0x3af2('0x22')](respondWithResult(_0x5490e1,0xc9))[_0x3af2('0x47')](handleError(_0x5490e1,null));};exports[_0x3af2('0x21')]=function(_0x9e6bfa,_0x521007){if(_0x9e6bfa[_0x3af2('0x4b')]['id']){delete _0x9e6bfa['body']['id'];}return db[_0x3af2('0x43')][_0x3af2('0x4f')]({'where':{'id':_0x9e6bfa[_0x3af2('0x48')]['id']}})[_0x3af2('0x22')](handleEntityNotFound(_0x521007,null))['then'](saveUpdates(_0x9e6bfa[_0x3af2('0x4b')],null))['then'](respondWithResult(_0x521007,null))[_0x3af2('0x47')](handleError(_0x521007,null));};exports[_0x3af2('0x26')]=function(_0x20b1b0,_0x53c5b5){return db[_0x3af2('0x43')][_0x3af2('0x4f')]({'where':{'id':_0x20b1b0['params']['id']}})['then'](handleEntityNotFound(_0x53c5b5,null))[_0x3af2('0x22')](removeEntity(_0x53c5b5,null))[_0x3af2('0x47')](handleError(_0x53c5b5,null));};exports[_0x3af2('0x53')]=function(_0x45eb09,_0x52b4aa){var _0x48259d=0xa;var _0x228c46=[_0x3af2('0x54'),_0x3af2('0x55'),'right_join',_0x3af2('0x56')];var _0xa04015={'SUM':_0x3af2('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x3af2('0x58'),'MIN':_0x3af2('0x59'),'AVG':_0x3af2('0x5a'),'GROUP_CONCAT':_0x3af2('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x3af2('0x5c')};var _0x50556f={'SEC_TO_TIME':_0x3af2('0x5d'),'DATE':_0x3af2('0x5e'),'HOUR':_0x3af2('0x5f'),'ROUND':_0x3af2('0x60'),'UNIX_TIMESTAMP':_0x3af2('0x61')};var _0x47b563=function(_0x1f4596){return!_[_0x3af2('0x62')]([_0x3af2('0x63'),'IS\x20NOT\x20NULL',_0x3af2('0x64'),_0x3af2('0x65')],_0x1f4596);};var _0x467ccd=function(_0x16c9c9){if(!_0x16c9c9||!_0x16c9c9[_0x3af2('0x66')][_0x3af2('0x37')]){return'';}for(var _0x4859bc='(',_0x232ea9=0x0;_0x232ea9<_0x16c9c9['rules']['length'];_0x232ea9+=0x1){_0x232ea9>0x0&&(_0x4859bc+='\x20'+_0x16c9c9[_0x3af2('0x67')]+'\x20');_0x4859bc+=_0x16c9c9[_0x3af2('0x66')][_0x232ea9]['group']?_0x467ccd(_0x16c9c9[_0x3af2('0x66')][_0x232ea9]['group']):_0x16c9c9[_0x3af2('0x66')][_0x232ea9]['field']+'\x20'+_0x16c9c9['rules'][_0x232ea9]['condition']+(_0x47b563(_0x16c9c9[_0x3af2('0x66')][_0x232ea9][_0x3af2('0x68')])?'\x20'+_0x16c9c9[_0x3af2('0x66')][_0x232ea9][_0x3af2('0x69')]:'');}return _0x4859bc+')';};var _0xd62e18={'where':{'id':_0x45eb09[_0x3af2('0x48')]['id']}},_0x5a342c,_0x536463,_0x570441,_0xc680e9,_0x1bebe3;_0xd62e18=_[_0x3af2('0x3f')]({},_0xd62e18,_0x45eb09[_0x3af2('0x42')]);return db['AnalyticCustomReport'][_0x3af2('0x4f')](_0xd62e18)[_0x3af2('0x22')](function(_0x1a24e8){if(_0x1a24e8){_0x5a342c=_0x1a24e8;return _0x1a24e8[_0x3af2('0x6a')]();}return null;})['then'](function(_0x3dae0e){if(_0x3dae0e){if(!_0x3dae0e[_0x3af2('0x37')]){throw new db['Sequelize']['ValidationErrorItem'](_0x3af2('0x6b'),0x193);}_0x536463=_0x3dae0e;return db[_0x3af2('0x6c')][_0x3af2('0x46')]({'raw':!![]});}return null;})[_0x3af2('0x22')](function(_0x438cbd){if(_0x438cbd){_0x570441=_['keyBy'](_0x438cbd,'id');var _0x3a47c1;var _0x2f5942=squel[_0x3af2('0x6d')]();_0x2f5942[_0x3af2('0x6e')](_0x5a342c['table']);for(var _0x4f0aed=0x0;_0x4f0aed<_0x536463[_0x3af2('0x37')];_0x4f0aed+=0x1){_0x3a47c1=_0x536463[_0x4f0aed][_0x3af2('0x6f')]?_0x570441[_0x536463[_0x4f0aed]['MetricId']]['metric']:_0x536463[_0x4f0aed]['field'];_0x3a47c1=_0x536463[_0x4f0aed][_0x3af2('0x70')]?_[_0x3af2('0x71')](_0xa04015[_0x536463[_0x4f0aed]['function']],'%s',_0x3a47c1):_0x3a47c1;_0x3a47c1=_0x536463[_0x4f0aed][_0x3af2('0x72')]?_[_0x3af2('0x71')](_0x50556f[_0x536463[_0x4f0aed][_0x3af2('0x72')]],'%s',_0x3a47c1):_0x3a47c1;if(_0x536463[_0x4f0aed][_0x3af2('0x73')]){_0x2f5942[_0x3af2('0x74')](_0x3a47c1);}_0x536463[_0x4f0aed][_0x3af2('0x75')]&&_0x2f5942[_0x3af2('0x76')](_0x3a47c1,_0x536463[_0x4f0aed][_0x3af2('0x75')]===_0x3af2('0x77')?![]:!![]);_0x2f5942['field'](_0x3a47c1,_0x536463[_0x4f0aed]['alias']||_0x3a47c1);}if(_0x5a342c[_0x3af2('0x78')]){_0x5a342c[_0x3af2('0x78')]=JSON[_0x3af2('0x79')](_0x5a342c[_0x3af2('0x78')]);for(var _0x25a25d=0x0;_0x25a25d<_0x5a342c[_0x3af2('0x78')][_0x3af2('0x37')];_0x25a25d+=0x1){if(_0x5a342c['joins'][_0x25a25d][_0x3af2('0x2e')]&&_['includes'](_0x228c46,_0x5a342c[_0x3af2('0x78')][_0x25a25d][_0x3af2('0x2e')])&&_0x5a342c['joins'][_0x25a25d][_0x3af2('0x7a')]&&_0x5a342c['joins'][_0x25a25d][_0x3af2('0x7b')]&&_0x5a342c[_0x3af2('0x78')][_0x25a25d]['foreignKey']){_0x2f5942[_0x5a342c[_0x3af2('0x78')][_0x25a25d][_0x3af2('0x2e')]](_0x5a342c[_0x3af2('0x78')][_0x25a25d][_0x3af2('0x7b')],null,util['format'](_0x3af2('0x7c'),_0x5a342c[_0x3af2('0x7d')],_0x5a342c[_0x3af2('0x78')][_0x25a25d][_0x3af2('0x7a')],_0x5a342c['joins'][_0x25a25d][_0x3af2('0x7b')],_0x5a342c['joins'][_0x25a25d][_0x3af2('0x7e')]));}}}if(_0x5a342c['conditions']){_0x5a342c[_0x3af2('0x7f')]=JSON[_0x3af2('0x79')](_0x5a342c[_0x3af2('0x7f')]);_0x2f5942[_0x3af2('0x3c')](_0x467ccd(_0x5a342c[_0x3af2('0x7f')]['group']));}_0x1bebe3=_0x2f5942['clone']();_0x2f5942[_0x3af2('0x3a')](_0x48259d);_0x2f5942[_0x3af2('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x2f5942[_0x3af2('0x80')]());return dbH[_0x3af2('0x81')]['query'](_0x2f5942[_0x3af2('0x80')](),{'type':dbH[_0x3af2('0x81')][_0x3af2('0x82')][_0x3af2('0x83')]});}})[_0x3af2('0x22')](respondWithResult(_0x52b4aa,null))[_0x3af2('0x47')](handleError(_0x52b4aa,null));};function runReport(_0x2c0ff6,_0xd1fc9d,_0x425a82){var _0x1a26f6=_0xd1fc9d[_0x3af2('0x2a')];var _0x186853=0xa;var _0xd0ae5d=['join','left_join',_0x3af2('0x84'),_0x3af2('0x56')];var _0x12ba5a={'SUM':_0x3af2('0x57'),'COUNT':_0x3af2('0x85'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x3af2('0x58'),'MIN':_0x3af2('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x3af2('0x86'),'GROUP_CONCAT DESC':_0x3af2('0x5c')};var _0x237bb3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3af2('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x3af2('0x60'),'UNIX_TIMESTAMP':_0x3af2('0x61')};var _0x204234=function(_0x22c04d){return!_[_0x3af2('0x62')]([_0x3af2('0x63'),_0x3af2('0x87'),_0x3af2('0x64'),_0x3af2('0x65')],_0x22c04d);};var _0x2a43f8=function(_0x364563){if(!_0x364563||!_0x364563['rules'][_0x3af2('0x37')]){return'';}for(var _0x11374c='(',_0x3a77c5=0x0;_0x3a77c5<_0x364563[_0x3af2('0x66')][_0x3af2('0x37')];_0x3a77c5+=0x1){_0x3a77c5>0x0&&(_0x11374c+='\x20'+_0x364563[_0x3af2('0x67')]+'\x20');_0x11374c+=_0x364563[_0x3af2('0x66')][_0x3a77c5]['group']?_0x2a43f8(_0x364563['rules'][_0x3a77c5][_0x3af2('0x74')]):_0x364563['rules'][_0x3a77c5][_0x3af2('0x88')]+'\x20'+_0x364563['rules'][_0x3a77c5]['condition']+(_0x204234(_0x364563[_0x3af2('0x66')][_0x3a77c5]['condition'])?'\x20'+_0x364563[_0x3af2('0x66')][_0x3a77c5][_0x3af2('0x69')]:'');}return _0x11374c+')';};var _0x4c5293={'where':{'id':_0x2c0ff6['id']}},_0x76098,_0xa83425,_0x40b3c6,_0x2f38da,_0x53da97;_0x4c5293=_[_0x3af2('0x3f')]({},_0x4c5293,_0x425a82);return db[_0x3af2('0x43')]['find'](_0x4c5293)['then'](function(_0x3d2e74){if(_0x3d2e74){_0x76098=_0x3d2e74;return _0x3d2e74[_0x3af2('0x6a')]();}return null;})[_0x3af2('0x22')](function(_0x35a848){if(_0x35a848){if(!_0x35a848[_0x3af2('0x37')]){throw new db[(_0x3af2('0x89'))]['ValidationErrorItem'](_0x3af2('0x6b'),0x193);}_0xa83425=_0x35a848;return db[_0x3af2('0x6c')][_0x3af2('0x46')]({'raw':!![]});}return null;})[_0x3af2('0x22')](function(_0x172cce){if(_0x172cce){_0x40b3c6=_[_0x3af2('0x8a')](_0x172cce,'id');var _0x34cc92;var _0x5b5873=squel[_0x3af2('0x6d')]();_0x5b5873[_0x3af2('0x6e')](_0x76098[_0x3af2('0x7d')]);for(var _0x296e3b=0x0;_0x296e3b<_0xa83425['length'];_0x296e3b+=0x1){_0x34cc92=_0xa83425[_0x296e3b][_0x3af2('0x6f')]?_0x40b3c6[_0xa83425[_0x296e3b][_0x3af2('0x6f')]][_0x3af2('0x8b')]:_0xa83425[_0x296e3b][_0x3af2('0x88')];_0x34cc92=_0xa83425[_0x296e3b][_0x3af2('0x70')]?_[_0x3af2('0x71')](_0x12ba5a[_0xa83425[_0x296e3b][_0x3af2('0x70')]],'%s',_0x34cc92):_0x34cc92;_0x34cc92=_0xa83425[_0x296e3b][_0x3af2('0x72')]?_[_0x3af2('0x71')](_0x237bb3[_0xa83425[_0x296e3b]['format']],'%s',_0x34cc92):_0x34cc92;if(_0xa83425[_0x296e3b][_0x3af2('0x73')]){_0x5b5873[_0x3af2('0x74')](_0x34cc92);}_0xa83425[_0x296e3b][_0x3af2('0x75')]&&_0x5b5873[_0x3af2('0x76')](_0x34cc92,_0xa83425[_0x296e3b][_0x3af2('0x75')]==='DESC'?![]:!![]);_0x5b5873[_0x3af2('0x88')](_0x34cc92,_0xa83425[_0x296e3b][_0x3af2('0x8c')]||_0x34cc92);}if(_0x76098['joins']){_0x76098[_0x3af2('0x78')]=JSON[_0x3af2('0x79')](_0x76098[_0x3af2('0x78')]);for(var _0x4fcf09=0x0;_0x4fcf09<_0x76098[_0x3af2('0x78')]['length'];_0x4fcf09+=0x1){if(_0x76098['joins'][_0x4fcf09]['type']&&_[_0x3af2('0x62')](_0xd0ae5d,_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x2e')])&&_0x76098[_0x3af2('0x78')][_0x4fcf09]['parentKey']&&_0x76098['joins'][_0x4fcf09][_0x3af2('0x7b')]&&_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x7e')]){_0x5b5873[_0x76098[_0x3af2('0x78')][_0x4fcf09]['type']](_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x76098[_0x3af2('0x7d')],_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x7a')],_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x7b')],_0x76098['joins'][_0x4fcf09][_0x3af2('0x7e')]));}}}if(_0x76098[_0x3af2('0x7f')]){_0x76098[_0x3af2('0x7f')]=JSON[_0x3af2('0x79')](_0x76098[_0x3af2('0x7f')]);_0x5b5873[_0x3af2('0x3c')](_0x2a43f8(_0x76098[_0x3af2('0x7f')]['group']));}_0x53da97=_0x5b5873[_0x3af2('0x8d')]();_0x5b5873[_0x3af2('0x3a')](_0x186853);_0x5b5873[_0x3af2('0x1a')](0x0);return;}})[_0x3af2('0x22')](function(){if(_0xd1fc9d[_0x3af2('0x8e')]==='web'){return null;}var _0x450f11=_[_0x3af2('0x3f')](_0xd1fc9d,{'name':_0xd1fc9d[_0x3af2('0x8f')]||_0xd1fc9d[_0x3af2('0x2a')]||_0x76098[_0x3af2('0x2a')],'basename':_0x1a26f6,'savename':util[_0x3af2('0x72')]('%s-%s.%s',_0xd1fc9d['name']||_0x76098[_0x3af2('0x2a')],require('randomstring')[_0x3af2('0x90')](0x4),_0xd1fc9d[_0x3af2('0x8e')]||_0x3af2('0x91')),'reportId':_0x76098['id'],'reportType':_0x3af2('0x92')});return db[_0x3af2('0x93')]['create'](_0x450f11,{'raw':!![]});})[_0x3af2('0x22')](function(_0x22c334){if(_0x76098[_0x3af2('0x7d')]===_0x3af2('0x94')){_0x53da97[_0x3af2('0x3c')](_0x76098[_0x3af2('0x7d')]+_0x3af2('0x95'),_0xd1fc9d[_0x3af2('0x96')],_0xd1fc9d['endDate']);}else{_0x53da97[_0x3af2('0x3c')](_0x76098[_0x3af2('0x7d')]+_0x3af2('0x97'),_0xd1fc9d[_0x3af2('0x96')],_0xd1fc9d['endDate']);}if(_0x22c334){logger['info']('Run\x20Query:',_0x53da97[_0x3af2('0x80')]());require(_0x3af2('0x98'))[_0x3af2('0x99')](path[_0x3af2('0x54')](__dirname,_0x3af2('0x9a'),_0x22c334[_0x3af2('0x8e')]),[_0x22c334['id'],_0x53da97['toString'](),path[_0x3af2('0x54')](__dirname,_0x3af2('0x9b'),_0x22c334[_0x3af2('0x9c')]),_0x1a26f6]);return _0x22c334;}else{var _0x40bb47=squel[_0x3af2('0x6d')]();_0x40bb47[_0x3af2('0x6e')]('('+_0x53da97[_0x3af2('0x80')]()+')',_0x3af2('0x9d'));_0x40bb47[_0x3af2('0x88')](_0x3af2('0x9e'),'count');_0x53da97[_0x3af2('0x3a')](_0xd1fc9d[_0x3af2('0x3a')]||_0x186853);_0x53da97['offset'](_0xd1fc9d[_0x3af2('0x1a')]||0x0);return dbH[_0x3af2('0x81')]['query'](_0x40bb47[_0x3af2('0x80')](),{'type':dbH['sequelize'][_0x3af2('0x82')]['SELECT']})[_0x3af2('0x22')](function(_0x2636e3){if(!_0x2636e3[_0x3af2('0x37')]){_0x2f38da=0x0;}else{_0x2f38da=_0x2636e3[0x0][_0x3af2('0x1c')]||0x0;}return dbH[_0x3af2('0x81')]['query'](_0x53da97[_0x3af2('0x80')](),{'type':dbH[_0x3af2('0x81')][_0x3af2('0x82')]['SELECT']});})[_0x3af2('0x22')](function(_0x59d855){return{'rows':_0x59d855||[],'count':_0x2f38da};});}});}exports[_0x3af2('0x9f')]=function(_0x321d84,_0xd14745){return runReport(_0x321d84[_0x3af2('0x48')],_0x321d84[_0x3af2('0x31')],_0x321d84[_0x3af2('0x42')])[_0x3af2('0x22')](respondWithResult(_0xd14745,null))[_0x3af2('0x47')](handleError(_0xd14745,null));};exports['runReport']=runReport;exports['query']=function(_0x582529,_0x4830c8){var _0x2e6575=0xa;var _0xee75eb=['join',_0x3af2('0x55'),'right_join',_0x3af2('0x56')];var _0x1ab75e={'SUM':_0x3af2('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3af2('0xa0'),'MAX':_0x3af2('0x58'),'MIN':'MIN(%s)','AVG':_0x3af2('0x5a'),'GROUP_CONCAT':_0x3af2('0x5b'),'GROUP_CONCAT ASC':_0x3af2('0x86'),'GROUP_CONCAT DESC':_0x3af2('0x5c')};var _0x339d6f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3af2('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x3af2('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x52a7a5=function(_0x17fefa){return!_[_0x3af2('0x62')]([_0x3af2('0x63'),'IS\x20NOT\x20NULL',_0x3af2('0x64'),_0x3af2('0x65')],_0x17fefa);};var _0x348675=function(_0x925bac){if(!_0x925bac||!_0x925bac['rules'][_0x3af2('0x37')]){return'';}for(var _0x570044='(',_0x12bcf0=0x0;_0x12bcf0<_0x925bac['rules']['length'];_0x12bcf0+=0x1){_0x12bcf0>0x0&&(_0x570044+='\x20'+_0x925bac[_0x3af2('0x67')]+'\x20');_0x570044+=_0x925bac['rules'][_0x12bcf0][_0x3af2('0x74')]?_0x348675(_0x925bac[_0x3af2('0x66')][_0x12bcf0]['group']):_0x925bac[_0x3af2('0x66')][_0x12bcf0][_0x3af2('0x88')]+'\x20'+_0x925bac['rules'][_0x12bcf0][_0x3af2('0x68')]+(_0x52a7a5(_0x925bac[_0x3af2('0x66')][_0x12bcf0][_0x3af2('0x68')])?'\x20'+_0x925bac[_0x3af2('0x66')][_0x12bcf0][_0x3af2('0x69')]:'');}return _0x570044+')';};var _0x388cea={'where':{'id':_0x582529[_0x3af2('0x48')]['id']}},_0x52f2fe,_0x545525,_0x359c09,_0x322f8d,_0xfcc67c;_0x388cea=_[_0x3af2('0x3f')]({},_0x388cea,_0x582529['options']);return db[_0x3af2('0x43')][_0x3af2('0x4f')](_0x388cea)[_0x3af2('0x22')](function(_0x48c09a){if(_0x48c09a){_0x52f2fe=_0x48c09a;return _0x48c09a[_0x3af2('0x6a')]();}return null;})['then'](function(_0x275bfc){if(_0x275bfc){if(!_0x275bfc[_0x3af2('0x37')]){throw new db[(_0x3af2('0x89'))][(_0x3af2('0xa1'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x545525=_0x275bfc;return db['AnalyticMetric'][_0x3af2('0x46')]({'raw':!![]});}return null;})[_0x3af2('0x22')](function(_0x3fe8b3){if(_0x3fe8b3){_0x359c09=_[_0x3af2('0x8a')](_0x3fe8b3,'id');var _0xf6cd8d;var _0xf20f9d=squel[_0x3af2('0x6d')]();_0xf20f9d[_0x3af2('0x6e')](_0x52f2fe[_0x3af2('0x7d')]);for(var _0x92392c=0x0;_0x92392c<_0x545525[_0x3af2('0x37')];_0x92392c+=0x1){_0xf6cd8d=_0x545525[_0x92392c][_0x3af2('0x6f')]?_0x359c09[_0x545525[_0x92392c][_0x3af2('0x6f')]][_0x3af2('0x8b')]:_0x545525[_0x92392c][_0x3af2('0x88')];_0xf6cd8d=_0x545525[_0x92392c][_0x3af2('0x70')]?_[_0x3af2('0x71')](_0x1ab75e[_0x545525[_0x92392c][_0x3af2('0x70')]],'%s',_0xf6cd8d):_0xf6cd8d;_0xf6cd8d=_0x545525[_0x92392c][_0x3af2('0x72')]?_[_0x3af2('0x71')](_0x339d6f[_0x545525[_0x92392c][_0x3af2('0x72')]],'%s',_0xf6cd8d):_0xf6cd8d;if(_0x545525[_0x92392c][_0x3af2('0x73')]){_0xf20f9d['group'](_0xf6cd8d);}_0x545525[_0x92392c]['orderBy']&&_0xf20f9d[_0x3af2('0x76')](_0xf6cd8d,_0x545525[_0x92392c][_0x3af2('0x75')]===_0x3af2('0x77')?![]:!![]);_0xf20f9d[_0x3af2('0x88')](_0xf6cd8d,_0x545525[_0x92392c][_0x3af2('0x8c')]||_0xf6cd8d);}if(_0x52f2fe[_0x3af2('0x78')]){_0x52f2fe[_0x3af2('0x78')]=JSON[_0x3af2('0x79')](_0x52f2fe[_0x3af2('0x78')]);for(var _0x5ed600=0x0;_0x5ed600<_0x52f2fe[_0x3af2('0x78')]['length'];_0x5ed600+=0x1){if(_0x52f2fe[_0x3af2('0x78')][_0x5ed600]['type']&&_[_0x3af2('0x62')](_0xee75eb,_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x2e')])&&_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x7a')]&&_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x7b')]&&_0x52f2fe['joins'][_0x5ed600][_0x3af2('0x7e')]){_0xf20f9d[_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x2e')]](_0x52f2fe[_0x3af2('0x78')][_0x5ed600]['foreignTable'],null,util[_0x3af2('0x72')]('%s.%s\x20=\x20%s.%s',_0x52f2fe[_0x3af2('0x7d')],_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x7a')],_0x52f2fe['joins'][_0x5ed600][_0x3af2('0x7b')],_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x7e')]));}}}if(_0x52f2fe[_0x3af2('0x7f')]){_0x52f2fe[_0x3af2('0x7f')]=JSON[_0x3af2('0x79')](_0x52f2fe[_0x3af2('0x7f')]);_0xf20f9d[_0x3af2('0x3c')](_0x348675(_0x52f2fe['conditions']['group']));}_0xfcc67c=_0xf20f9d['clone']();_0xf20f9d[_0x3af2('0x3a')](_0x2e6575);_0xf20f9d[_0x3af2('0x1a')](0x0);logger[_0x3af2('0xa2')](_0x3af2('0xa3'),_0xf20f9d[_0x3af2('0x80')]());return dbH[_0x3af2('0x81')][_0x3af2('0x31')](_0xf20f9d[_0x3af2('0x80')](),{'type':dbH[_0x3af2('0x81')][_0x3af2('0x82')][_0x3af2('0x83')]});}})[_0x3af2('0x22')](function(){return{'sql':_0xfcc67c[_0x3af2('0x80')]()};})[_0x3af2('0x22')](respondWithResult(_0x4830c8,null))[_0x3af2('0x47')](handleError(_0x4830c8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index fb4b977..9c75766 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 _0xbb40=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','lodash','util','../../config/logger'];(function(_0x3b557e,_0x40c2b5){var _0x56c690=function(_0x3d991b){while(--_0x3d991b){_0x3b557e['push'](_0x3b557e['shift']());}};_0x56c690(++_0x40c2b5);}(_0xbb40,0x1e9));var _0x0bb4=function(_0x3cfe4c,_0x14a5bc){_0x3cfe4c=_0x3cfe4c-0x0;var _0x4f6f43=_0xbb40[_0x3cfe4c];return _0x4f6f43;};'use strict';var _=require(_0x0bb4('0x0'));var util=require(_0x0bb4('0x1'));var logger=require(_0x0bb4('0x2'))(_0x0bb4('0x3'));var moment=require(_0x0bb4('0x4'));var BPromise=require(_0x0bb4('0x5'));var rp=require(_0x0bb4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bb4('0x7'));var config=require(_0x0bb4('0x8'));var attributes=require(_0x0bb4('0x9'));module[_0x0bb4('0xa')]=function(_0x3853ed,_0x105719){return _0x3853ed['define'](_0x0bb4('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc74=['define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x924c29,_0x309120){var _0x24ddd6=function(_0x1c8a9e){while(--_0x1c8a9e){_0x924c29['push'](_0x924c29['shift']());}};_0x24ddd6(++_0x309120);}(_0xdc74,0xfe));var _0x4dc7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdc74[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x4dc7('0x0'));var util=require(_0x4dc7('0x1'));var logger=require(_0x4dc7('0x2'))(_0x4dc7('0x3'));var moment=require(_0x4dc7('0x4'));var BPromise=require(_0x4dc7('0x5'));var rp=require(_0x4dc7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4dc7('0x7'));var attributes=require(_0x4dc7('0x8'));module[_0x4dc7('0x9')]=function(_0x5a65f1,_0x12a15c){return _0x5a65f1[_0x4dc7('0xa')](_0x4dc7('0xb'),attributes,{'tableName':'analytics_custom_reports','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 e90a98c..cd907cb 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 _0x62d0=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xded36,_0x1462cb){var _0x39e06c=function(_0x3068dc){while(--_0x3068dc){_0xded36['push'](_0xded36['shift']());}};_0x39e06c(++_0x1462cb);}(_0x62d0,0xdc));var _0x062d=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x62d0[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x062d('0x0'));var util=require(_0x062d('0x1'));var moment=require(_0x062d('0x2'));var BPromise=require(_0x062d('0x3'));var rs=require(_0x062d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x062d('0x5'));var logger=require(_0x062d('0x6'))(_0x062d('0x7'));var config=require(_0x062d('0x8'));var jayson=require(_0x062d('0x9'));var client=jayson[_0x062d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c4fe0,_0x280afe,_0x297157){return new BPromise(function(_0x5b86ef,_0x55860d){return client[_0x062d('0xb')](_0x4c4fe0,_0x297157)[_0x062d('0xc')](function(_0x168b48){logger[_0x062d('0xd')](_0x062d('0xe'),_0x280afe,_0x062d('0xf'));logger[_0x062d('0x10')](_0x062d('0x11'),_0x280afe,_0x062d('0xf'),JSON[_0x062d('0x12')](_0x168b48));if(_0x168b48[_0x062d('0x13')]){if(_0x168b48[_0x062d('0x13')][_0x062d('0x14')]===0x1f4){logger['error'](_0x062d('0xe'),_0x280afe,_0x168b48[_0x062d('0x13')][_0x062d('0x15')]);return _0x55860d(_0x168b48['error'][_0x062d('0x15')]);}logger['error'](_0x062d('0xe'),_0x280afe,_0x168b48[_0x062d('0x13')]['message']);return _0x5b86ef(_0x168b48[_0x062d('0x13')][_0x062d('0x15')]);}else{logger[_0x062d('0xd')](_0x062d('0xe'),_0x280afe,_0x062d('0xf'));_0x5b86ef(_0x168b48[_0x062d('0x16')][_0x062d('0x15')]);}})[_0x062d('0x17')](function(_0x256296){logger[_0x062d('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x280afe,_0x256296);_0x55860d(_0x256296);});});} \ No newline at end of file +var _0x3e3b=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e3b,0x1f1));var _0xb3e3=function(_0x5d8122,_0x1bc2d4){_0x5d8122=_0x5d8122-0x0;var _0x1a8208=_0x3e3b[_0x5d8122];return _0x1a8208;};'use strict';var _=require(_0xb3e3('0x0'));var util=require(_0xb3e3('0x1'));var moment=require(_0xb3e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xb3e3('0x3'));var fs=require('fs');var Redis=require(_0xb3e3('0x4'));var db=require(_0xb3e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3e3('0x6'))('rpc');var config=require(_0xb3e3('0x7'));var jayson=require(_0xb3e3('0x8'));var client=jayson[_0xb3e3('0x9')][_0xb3e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f3705,_0x19b452,_0x45747c){return new BPromise(function(_0xed5ac0,_0x25e23e){return client[_0xb3e3('0xb')](_0x4f3705,_0x45747c)[_0xb3e3('0xc')](function(_0x247a58){logger[_0xb3e3('0xd')](_0xb3e3('0xe'),_0x19b452,_0xb3e3('0xf'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x19b452,_0xb3e3('0xf'),JSON[_0xb3e3('0x10')](_0x247a58));if(_0x247a58[_0xb3e3('0x11')]){if(_0x247a58['error'][_0xb3e3('0x12')]===0x1f4){logger[_0xb3e3('0x11')](_0xb3e3('0xe'),_0x19b452,_0x247a58[_0xb3e3('0x11')][_0xb3e3('0x13')]);return _0x25e23e(_0x247a58[_0xb3e3('0x11')]['message']);}logger[_0xb3e3('0x11')](_0xb3e3('0xe'),_0x19b452,_0x247a58[_0xb3e3('0x11')][_0xb3e3('0x13')]);return _0xed5ac0(_0x247a58['error'][_0xb3e3('0x13')]);}else{logger[_0xb3e3('0xd')](_0xb3e3('0xe'),_0x19b452,_0xb3e3('0xf'));_0xed5ac0(_0x247a58['result'][_0xb3e3('0x13')]);}})[_0xb3e3('0x14')](function(_0x531c62){logger['error'](_0xb3e3('0xe'),_0x19b452,_0x531c62);_0x25e23e(_0x531c62);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index f52c1ef..97804cf 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 _0x3d03=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','put','update','delete','destroy','exports','util'];(function(_0x1e3d6e,_0x487503){var _0x52b481=function(_0x11edfe){while(--_0x11edfe){_0x1e3d6e['push'](_0x1e3d6e['shift']());}};_0x52b481(++_0x487503);}(_0x3d03,0x17f));var _0x33d0=function(_0x5d0e5c,_0x1eb95f){_0x5d0e5c=_0x5d0e5c-0x0;var _0x2c4bd4=_0x3d03[_0x5d0e5c];return _0x2c4bd4;};'use strict';var multer=require('multer');var util=require(_0x33d0('0x0'));var path=require(_0x33d0('0x1'));var timeout=require(_0x33d0('0x2'));var express=require(_0x33d0('0x3'));var router=express['Router']();var fs_extra=require(_0x33d0('0x4'));var auth=require(_0x33d0('0x5'));var interaction=require(_0x33d0('0x6'));var config=require(_0x33d0('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x33d0('0x8')]('/',auth[_0x33d0('0x9')](),controller[_0x33d0('0xa')]);router[_0x33d0('0x8')](_0x33d0('0xb'),auth[_0x33d0('0x9')](),controller[_0x33d0('0xc')]);router[_0x33d0('0x8')](_0x33d0('0xd'),auth['isAuthenticated'](),controller[_0x33d0('0xe')]);router[_0x33d0('0x8')](_0x33d0('0xf'),auth[_0x33d0('0x9')](),controller[_0x33d0('0x10')]);router['get']('/:id/query',auth[_0x33d0('0x9')](),controller[_0x33d0('0x11')]);router[_0x33d0('0x12')]('/',auth[_0x33d0('0x9')](),controller['create']);router[_0x33d0('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x33d0('0x14')]);router[_0x33d0('0x15')](_0x33d0('0xb'),auth[_0x33d0('0x9')](),controller[_0x33d0('0x16')]);module[_0x33d0('0x17')]=router; \ No newline at end of file +var _0x4663=['../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id/preview','preview','/:id/run','/:id/query','query','post','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3b9f02,_0x35077a){var _0x1df9ad=function(_0x51cc3){while(--_0x51cc3){_0x3b9f02['push'](_0x3b9f02['shift']());}};_0x1df9ad(++_0x35077a);}(_0x4663,0x135));var _0x3466=function(_0x4143e8,_0x4ddf23){_0x4143e8=_0x4143e8-0x0;var _0x5706c8=_0x4663[_0x4143e8];return _0x5706c8;};'use strict';var multer=require(_0x3466('0x0'));var util=require('util');var path=require(_0x3466('0x1'));var timeout=require(_0x3466('0x2'));var express=require('express');var router=express[_0x3466('0x3')]();var fs_extra=require(_0x3466('0x4'));var auth=require(_0x3466('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3466('0x6'));var controller=require(_0x3466('0x7'));router['get']('/',auth[_0x3466('0x8')](),controller['index']);router[_0x3466('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3466('0x9')](_0x3466('0xa'),auth['isAuthenticated'](),controller[_0x3466('0xb')]);router[_0x3466('0x9')](_0x3466('0xc'),auth[_0x3466('0x8')](),controller['run']);router['get'](_0x3466('0xd'),auth[_0x3466('0x8')](),controller[_0x3466('0xe')]);router[_0x3466('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3466('0x10')](_0x3466('0x11'),auth[_0x3466('0x8')](),controller[_0x3466('0x12')]);router['delete'](_0x3466('0x11'),auth['isAuthenticated'](),controller[_0x3466('0x13')]);module[_0x3466('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index dc126e9..10e3d0a 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x5d4db8,_0x4ad01b){var _0x415548=function(_0x7ae456){while(--_0x7ae456){_0x5d4db8['push'](_0x5d4db8['shift']());}};_0x415548(++_0x4ad01b);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0xf2ca[_0x1ff2ec];return _0x405683;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0xae24=['sequelize','STRING'];(function(_0x38b6c4,_0x4c18fe){var _0x136c57=function(_0x313087){while(--_0x313087){_0x38b6c4['push'](_0x38b6c4['shift']());}};_0x136c57(++_0x4c18fe);}(_0xae24,0x182));var _0x4ae2=function(_0xfaff70,_0x5105a7){_0xfaff70=_0xfaff70-0x0;var _0xea98c2=_0xae24[_0xfaff70];return _0xea98c2;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index a3d0552..12dd724 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 _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x5a8e88,_0x513cab){var _0x2132d2=function(_0x138459){while(--_0x138459){_0x5a8e88['push'](_0x5a8e88['shift']());}};_0x2132d2(++_0x513cab);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_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)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x2ae956,_0x3240b1){var _0x457b71=function(_0x33fe66){while(--_0x33fe66){_0x2ae956['push'](_0x2ae956['shift']());}};_0x457b71(++_0x3240b1);}(_0x2675,0x75));var _0x5267=function(_0x10c13d,_0x104641){_0x10c13d=_0x10c13d-0x0;var _0x25002b=_0x2675[_0x10c13d];return _0x25002b;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b7543b3..2d8d165 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 _0xd290=['exports','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x3d078a,_0x28ee11){var _0x390a12=function(_0x1bdd3d){while(--_0x1bdd3d){_0x3d078a['push'](_0x3d078a['shift']());}};_0x390a12(++_0x28ee11);}(_0xd290,0x1a8));var _0x0d29=function(_0x5b14d7,_0x10b373){_0x5b14d7=_0x5b14d7-0x0;var _0x1eb341=_0xd290[_0x5b14d7];return _0x1eb341;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var logger=require(_0x0d29('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0d29('0x3'));var fs=require('fs');var path=require(_0x0d29('0x4'));var rimraf=require(_0x0d29('0x5'));var config=require(_0x0d29('0x6'));var attributes=require(_0x0d29('0x7'));module[_0x0d29('0x8')]=function(_0x27e2ac,_0x4a1168){return _0x27e2ac['define']('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x262b=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x262b,0x81));var _0xb262=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x262b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb262('0x0'));var util=require(_0xb262('0x1'));var logger=require(_0xb262('0x2'))(_0xb262('0x3'));var moment=require(_0xb262('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb262('0x5'));var rimraf=require(_0xb262('0x6'));var config=require(_0xb262('0x7'));var attributes=require(_0xb262('0x8'));module[_0xb262('0x9')]=function(_0x31f4a3,_0x7c7325){return _0x31f4a3[_0xb262('0xa')](_0xb262('0xb'),attributes,{'tableName':_0xb262('0xc'),'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 f77ac8f..9173f26 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 _0xcf91=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug'];(function(_0x113388,_0x15e949){var _0x312b39=function(_0x234ec5){while(--_0x234ec5){_0x113388['push'](_0x113388['shift']());}};_0x312b39(++_0x15e949);}(_0xcf91,0x193));var _0x1cf9=function(_0xc5926f,_0x4c3d57){_0xc5926f=_0xc5926f-0x0;var _0x322997=_0xcf91[_0xc5926f];return _0x322997;};'use strict';var _=require(_0x1cf9('0x0'));var util=require('util');var moment=require(_0x1cf9('0x1'));var BPromise=require(_0x1cf9('0x2'));var rs=require(_0x1cf9('0x3'));var fs=require('fs');var Redis=require(_0x1cf9('0x4'));var db=require(_0x1cf9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1cf9('0x6'))('rpc');var config=require(_0x1cf9('0x7'));var jayson=require(_0x1cf9('0x8'));var client=jayson[_0x1cf9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3adb15,_0x384d40,_0x3ea7c5){return new BPromise(function(_0x3c342c,_0x5ea854){return client[_0x1cf9('0xa')](_0x3adb15,_0x3ea7c5)[_0x1cf9('0xb')](function(_0x283399){logger[_0x1cf9('0xc')](_0x1cf9('0xd'),_0x384d40,'request\x20sent');logger[_0x1cf9('0xe')](_0x1cf9('0xf'),_0x384d40,_0x1cf9('0x10'),JSON[_0x1cf9('0x11')](_0x283399));if(_0x283399[_0x1cf9('0x12')]){if(_0x283399[_0x1cf9('0x12')]['code']===0x1f4){logger[_0x1cf9('0x12')](_0x1cf9('0xd'),_0x384d40,_0x283399['error'][_0x1cf9('0x13')]);return _0x5ea854(_0x283399[_0x1cf9('0x12')]['message']);}logger['error'](_0x1cf9('0xd'),_0x384d40,_0x283399[_0x1cf9('0x12')][_0x1cf9('0x13')]);return _0x3c342c(_0x283399[_0x1cf9('0x12')][_0x1cf9('0x13')]);}else{logger[_0x1cf9('0xc')](_0x1cf9('0xd'),_0x384d40,_0x1cf9('0x10'));_0x3c342c(_0x283399[_0x1cf9('0x14')]['message']);}})[_0x1cf9('0x15')](function(_0x3bd881){logger[_0x1cf9('0x12')](_0x1cf9('0xd'),_0x384d40,_0x3bd881);_0x5ea854(_0x3bd881);});});} \ No newline at end of file +var _0x12b0=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x3a4473,_0x1d03fe){var _0xb617ba=function(_0x2d7ec6){while(--_0x2d7ec6){_0x3a4473['push'](_0x3a4473['shift']());}};_0xb617ba(++_0x1d03fe);}(_0x12b0,0xc6));var _0x012b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x12b0[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x012b('0x0'));var util=require('util');var moment=require(_0x012b('0x1'));var BPromise=require(_0x012b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x012b('0x3'));var db=require(_0x012b('0x4'))['db'];var utils=require(_0x012b('0x5'));var logger=require(_0x012b('0x6'))(_0x012b('0x7'));var config=require(_0x012b('0x8'));var jayson=require(_0x012b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8e8e1a,_0x16ad2b,_0x199b3d){return new BPromise(function(_0x1df548,_0xab7a4a){return client[_0x012b('0xa')](_0x8e8e1a,_0x199b3d)[_0x012b('0xb')](function(_0x36b6d5){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x16ad2b,_0x012b('0xc'));logger[_0x012b('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x16ad2b,_0x012b('0xc'),JSON[_0x012b('0xe')](_0x36b6d5));if(_0x36b6d5[_0x012b('0xf')]){if(_0x36b6d5[_0x012b('0xf')]['code']===0x1f4){logger[_0x012b('0xf')](_0x012b('0x10'),_0x16ad2b,_0x36b6d5[_0x012b('0xf')][_0x012b('0x11')]);return _0xab7a4a(_0x36b6d5['error'][_0x012b('0x11')]);}logger[_0x012b('0xf')](_0x012b('0x10'),_0x16ad2b,_0x36b6d5[_0x012b('0xf')][_0x012b('0x11')]);return _0x1df548(_0x36b6d5['error'][_0x012b('0x11')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x16ad2b,_0x012b('0xc'));_0x1df548(_0x36b6d5[_0x012b('0x12')][_0x012b('0x11')]);}})[_0x012b('0x13')](function(_0x3c0df7){logger['error'](_0x012b('0x10'),_0x16ad2b,_0x3c0df7);_0xab7a4a(_0x3c0df7);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index b696388..bba0faf 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 _0xb4de=['express','Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xb4de,0x194));var _0xeb4d=function(_0x417eb7,_0x4a0779){_0x417eb7=_0x417eb7-0x0;var _0xf00a10=_0xb4de[_0x417eb7];return _0xf00a10;};'use strict';var multer=require(_0xeb4d('0x0'));var util=require(_0xeb4d('0x1'));var path=require(_0xeb4d('0x2'));var timeout=require(_0xeb4d('0x3'));var express=require(_0xeb4d('0x4'));var router=express[_0xeb4d('0x5')]();var fs_extra=require(_0xeb4d('0x6'));var auth=require(_0xeb4d('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeb4d('0x8'));router[_0xeb4d('0x9')]('/',auth[_0xeb4d('0xa')](),controller[_0xeb4d('0xb')]);router[_0xeb4d('0x9')](_0xeb4d('0xc'),auth[_0xeb4d('0xa')](),controller[_0xeb4d('0xd')]);router[_0xeb4d('0x9')](_0xeb4d('0xe'),auth[_0xeb4d('0xa')](),controller[_0xeb4d('0xf')]);router[_0xeb4d('0x9')](_0xeb4d('0x10'),auth[_0xeb4d('0xa')](),controller[_0xeb4d('0x11')]);router[_0xeb4d('0x9')]('/:id/query',auth[_0xeb4d('0xa')](),controller[_0xeb4d('0x12')]);router[_0xeb4d('0x13')]('/',auth[_0xeb4d('0xa')](),controller['create']);router[_0xeb4d('0x14')](_0xeb4d('0xc'),auth[_0xeb4d('0xa')](),controller[_0xeb4d('0x15')]);router['delete']('/:id',auth[_0xeb4d('0xa')](),controller[_0xeb4d('0x16')]);module[_0xeb4d('0x17')]=router; \ No newline at end of file +var _0xcd8d=['path','connect-timeout','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/query','post','create','put','delete','destroy','multer','util'];(function(_0x5d0bea,_0x5acdc8){var _0x187a4c=function(_0x4cb48d){while(--_0x4cb48d){_0x5d0bea['push'](_0x5d0bea['shift']());}};_0x187a4c(++_0x5acdc8);}(_0xcd8d,0x13e));var _0xdcd8=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0xcd8d[_0x5db313];return _0x36d503;};'use strict';var multer=require(_0xdcd8('0x0'));var util=require(_0xdcd8('0x1'));var path=require(_0xdcd8('0x2'));var timeout=require(_0xdcd8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdcd8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdcd8('0x5'));var controller=require(_0xdcd8('0x6'));router[_0xdcd8('0x7')]('/',auth[_0xdcd8('0x8')](),controller[_0xdcd8('0x9')]);router[_0xdcd8('0x7')](_0xdcd8('0xa'),auth[_0xdcd8('0x8')](),controller[_0xdcd8('0xb')]);router[_0xdcd8('0x7')](_0xdcd8('0xc'),auth[_0xdcd8('0x8')](),controller[_0xdcd8('0xd')]);router['get']('/:id/run',auth[_0xdcd8('0x8')](),controller['run']);router[_0xdcd8('0x7')](_0xdcd8('0xe'),auth[_0xdcd8('0x8')](),controller['query']);router[_0xdcd8('0xf')]('/',auth[_0xdcd8('0x8')](),controller[_0xdcd8('0x10')]);router[_0xdcd8('0x11')](_0xdcd8('0xa'),auth[_0xdcd8('0x8')](),controller['update']);router[_0xdcd8('0x12')](_0xdcd8('0xa'),auth['isAuthenticated'](),controller[_0xdcd8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 16c04fb..59307d6 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 _0x462f=['INTEGER','UNSIGNED','sequelize','moment','csv','pdf','xlsx','STRING','Loading','ENUM','manual','scheduled'];(function(_0x41f745,_0x4b5c4a){var _0x2cbbcb=function(_0x4d5c74){while(--_0x4d5c74){_0x41f745['push'](_0x41f745['shift']());}};_0x2cbbcb(++_0x4b5c4a);}(_0x462f,0x9e));var _0xf462=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0x462f[_0x339129];return _0x1570df;};'use strict';var Sequelize=require(_0xf462('0x0'));var moment=require(_0xf462('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xf462('0x2'),_0xf462('0x3'),_0xf462('0x4')),'allowNull':![],'defaultValue':_0xf462('0x2')},'savename':{'type':Sequelize[_0xf462('0x5')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xf462('0x5')],'defaultValue':_0xf462('0x6')},'type':{'type':Sequelize[_0xf462('0x7')](_0xf462('0x8'),_0xf462('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xf462('0xa')](0xb)[_0xf462('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x48ba=['xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x48ba,0x159));var _0xa48b=function(_0x45681e,_0x2c2ddb){_0x45681e=_0x45681e-0x0;var _0x369a92=_0x48ba[_0x45681e];return _0x369a92;};'use strict';var Sequelize=require(_0xa48b('0x0'));var moment=require(_0xa48b('0x1'));module['exports']={'name':{'type':Sequelize[_0xa48b('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xa48b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xa48b('0x3')](_0xa48b('0x4'),_0xa48b('0x5'),_0xa48b('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xa48b('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa48b('0x7')]},'endDate':{'type':Sequelize[_0xa48b('0x7')]},'status':{'type':Sequelize[_0xa48b('0x2')],'defaultValue':_0xa48b('0x8')},'type':{'type':Sequelize[_0xa48b('0x3')](_0xa48b('0x9'),_0xa48b('0xa')),'allowNull':![],'defaultValue':_0xa48b('0x9')},'reportId':{'type':Sequelize[_0xa48b('0xb')](0xb)[_0xa48b('0xc')]},'reportType':{'type':Sequelize[_0xa48b('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d69a83e..76b3717 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 _0x4ffe=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','root','server/files/reports','ValidationError','exists','download','join','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','AnalyticExtractedReport','rawAttributes','key','model','map','query','keys','filters','intersection'];(function(_0xbc8df5,_0x3311d3){var _0x1eddd2=function(_0x1466d5){while(--_0x1466d5){_0xbc8df5['push'](_0xbc8df5['shift']());}};_0x1eddd2(++_0x3311d3);}(_0x4ffe,0x1b5));var _0xe4ff=function(_0x51dada,_0x4ddb59){_0x51dada=_0x51dada-0x0;var _0x209d74=_0x4ffe[_0x51dada];return _0x209d74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4ff('0x0'));var zipdir=require(_0xe4ff('0x1'));var jsonpatch=require(_0xe4ff('0x2'));var rp=require(_0xe4ff('0x3'));var moment=require('moment');var BPromise=require(_0xe4ff('0x4'));var Mustache=require(_0xe4ff('0x5'));var util=require(_0xe4ff('0x6'));var path=require(_0xe4ff('0x7'));var sox=require(_0xe4ff('0x8'));var csv=require(_0xe4ff('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4ff('0xa'));var _=require(_0xe4ff('0xb'));var squel=require(_0xe4ff('0xc'));var crypto=require(_0xe4ff('0xd'));var jsforce=require(_0xe4ff('0xe'));var deskjs=require(_0xe4ff('0xf'));var toCsv=require(_0xe4ff('0x9'));var querystring=require(_0xe4ff('0x10'));var Papa=require(_0xe4ff('0x11'));var Redis=require(_0xe4ff('0x12'));var authService=require(_0xe4ff('0x13'));var qs=require(_0xe4ff('0x14'));var as=require(_0xe4ff('0x15'));var hardwareService=require(_0xe4ff('0x16'));var logger=require('../../config/logger')(_0xe4ff('0x17'));var utils=require(_0xe4ff('0x18'));var config=require(_0xe4ff('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4ff('0x1a'))['db'];function respondWithStatusCode(_0x581678,_0x241a41){_0x241a41=_0x241a41||0xcc;return function(_0x5906e8){if(_0x5906e8){return _0x581678[_0xe4ff('0x1b')](_0x241a41);}return _0x581678['status'](_0x241a41)[_0xe4ff('0x1c')]();};}function respondWithResult(_0x4d1cfa,_0x366136){_0x366136=_0x366136||0xc8;return function(_0x53f892){if(_0x53f892){return _0x4d1cfa[_0xe4ff('0x1d')](_0x366136)[_0xe4ff('0x1e')](_0x53f892);}};}function respondWithFilteredResult(_0x41e44c,_0x510fba){return function(_0x446817){if(_0x446817){var _0x11000a=typeof _0x510fba[_0xe4ff('0x1f')]===_0xe4ff('0x20')&&typeof _0x510fba[_0xe4ff('0x21')]===_0xe4ff('0x20');var _0x597f96=_0x446817[_0xe4ff('0x22')];var _0x2a3c5b=_0x11000a?0x0:_0x510fba[_0xe4ff('0x1f')];var _0x17ac12=_0x11000a?_0x446817[_0xe4ff('0x22')]:_0x510fba[_0xe4ff('0x1f')]+_0x510fba[_0xe4ff('0x21')];var _0x31b830;if(_0x17ac12>=_0x597f96){_0x17ac12=_0x597f96;_0x31b830=0xc8;}else{_0x31b830=0xce;}_0x41e44c['status'](_0x31b830);return _0x41e44c[_0xe4ff('0x23')](_0xe4ff('0x24'),_0x2a3c5b+'-'+_0x17ac12+'/'+_0x597f96)['json'](_0x446817);}return null;};}function patchUpdates(_0x166f03){return function(_0x3487ff){try{jsonpatch[_0xe4ff('0x25')](_0x3487ff,_0x166f03,!![]);}catch(_0x326d8d){return BPromise[_0xe4ff('0x26')](_0x326d8d);}return _0x3487ff[_0xe4ff('0x27')]();};}function saveUpdates(_0x3e6655,_0x569218){return function(_0x2874c9){if(_0x2874c9){return _0x2874c9[_0xe4ff('0x28')](_0x3e6655)[_0xe4ff('0x29')](function(_0x4fc17b){return _0x4fc17b;});}return null;};}function removeEntity(_0x4e0dbc,_0x42c5e9){return function(_0x405354){if(_0x405354){return _0x405354[_0xe4ff('0x2a')]()[_0xe4ff('0x29')](function(){var _0xea010e=_0x405354[_0xe4ff('0x2b')]({'plain':!![]});var _0x562fe8=_0xe4ff('0x2c');return db[_0xe4ff('0x2d')][_0xe4ff('0x2a')]({'where':{'type':_0x562fe8,'resourceId':_0xea010e['id']}})['then'](function(){return _0x405354;});})[_0xe4ff('0x29')](function(){_0x4e0dbc[_0xe4ff('0x1d')](0xcc)[_0xe4ff('0x1c')]();});}};}function handleEntityNotFound(_0x9d3a0d,_0x19107d){return function(_0x515b86){if(!_0x515b86){_0x9d3a0d[_0xe4ff('0x1b')](0x194);}return _0x515b86;};}function handleError(_0x5ab6cb,_0x5dafd0){_0x5dafd0=_0x5dafd0||0x1f4;return function(_0x1c3afb){logger['error'](_0x1c3afb[_0xe4ff('0x2e')]);if(_0x1c3afb[_0xe4ff('0x2f')]){delete _0x1c3afb[_0xe4ff('0x2f')];}_0x5ab6cb[_0xe4ff('0x1d')](_0x5dafd0)[_0xe4ff('0x30')](_0x1c3afb);};}exports['index']=function(_0x499942,_0x47d105){var _0x543b90={},_0x56705b={},_0x21b72f={'count':0x0,'rows':[]};var _0x2e5f94=_['map'](db[_0xe4ff('0x31')][_0xe4ff('0x32')],function(_0x3f7a2d){return{'name':_0x3f7a2d['fieldName'],'type':_0x3f7a2d['type'][_0xe4ff('0x33')]};});_0x56705b[_0xe4ff('0x34')]=_[_0xe4ff('0x35')](_0x2e5f94,_0xe4ff('0x2f'));_0x56705b[_0xe4ff('0x36')]=_[_0xe4ff('0x37')](_0x499942['query']);_0x56705b[_0xe4ff('0x38')]=_[_0xe4ff('0x39')](_0x56705b[_0xe4ff('0x34')],_0x56705b[_0xe4ff('0x36')]);_0x543b90[_0xe4ff('0x3a')]=_[_0xe4ff('0x39')](_0x56705b[_0xe4ff('0x34')],qs['fields'](_0x499942[_0xe4ff('0x36')][_0xe4ff('0x3b')]));_0x543b90['attributes']=_0x543b90['attributes'][_0xe4ff('0x3c')]?_0x543b90[_0xe4ff('0x3a')]:_0x56705b[_0xe4ff('0x34')];if(!_0x499942[_0xe4ff('0x36')][_0xe4ff('0x3d')](_0xe4ff('0x3e'))){_0x543b90[_0xe4ff('0x21')]=qs[_0xe4ff('0x21')](_0x499942['query']['limit']);_0x543b90[_0xe4ff('0x1f')]=qs[_0xe4ff('0x1f')](_0x499942[_0xe4ff('0x36')]['offset']);}_0x543b90['order']=qs[_0xe4ff('0x3f')](_0x499942[_0xe4ff('0x36')][_0xe4ff('0x3f')]);_0x543b90[_0xe4ff('0x40')]=qs[_0xe4ff('0x38')](_[_0xe4ff('0x41')](_0x499942['query'],_0x56705b['filters']),_0x2e5f94);if(_0x499942[_0xe4ff('0x36')][_0xe4ff('0x42')]){_0x543b90[_0xe4ff('0x40')]=_[_0xe4ff('0x43')](_0x543b90[_0xe4ff('0x40')],{'$or':_[_0xe4ff('0x35')](_0x2e5f94,function(_0x2fa725){if(_0x2fa725['type']!==_0xe4ff('0x44')){var _0x1359af={};_0x1359af[_0x2fa725['name']]={'$like':'%'+_0x499942['query'][_0xe4ff('0x42')]+'%'};return _0x1359af;}})});}_0x543b90=_['merge']({},_0x543b90,_0x499942[_0xe4ff('0x45')]);var _0x25dd48={'where':_0x543b90['where']};return db['AnalyticExtractedReport'][_0xe4ff('0x22')](_0x25dd48)['then'](function(_0x3a22d7){_0x21b72f[_0xe4ff('0x22')]=_0x3a22d7;if(_0x499942['query']['includeAll']){_0x543b90[_0xe4ff('0x46')]=[{'all':!![]}];}return db[_0xe4ff('0x31')][_0xe4ff('0x47')](_0x543b90);})[_0xe4ff('0x29')](function(_0x13e41f){_0x21b72f[_0xe4ff('0x48')]=_0x13e41f;return _0x21b72f;})[_0xe4ff('0x29')](respondWithFilteredResult(_0x47d105,_0x543b90))[_0xe4ff('0x49')](handleError(_0x47d105,null));};exports[_0xe4ff('0x4a')]=function(_0x47b298,_0x5531e7){var _0x2eba3a={'raw':!![],'where':{'id':_0x47b298[_0xe4ff('0x4b')]['id']}},_0x378851={};_0x378851['model']=_[_0xe4ff('0x37')](db[_0xe4ff('0x31')][_0xe4ff('0x32')]);_0x378851['query']=_[_0xe4ff('0x37')](_0x47b298[_0xe4ff('0x36')]);_0x378851[_0xe4ff('0x38')]=_[_0xe4ff('0x39')](_0x378851[_0xe4ff('0x34')],_0x378851[_0xe4ff('0x36')]);_0x2eba3a['attributes']=_[_0xe4ff('0x39')](_0x378851[_0xe4ff('0x34')],qs['fields'](_0x47b298[_0xe4ff('0x36')][_0xe4ff('0x3b')]));_0x2eba3a['attributes']=_0x2eba3a[_0xe4ff('0x3a')]['length']?_0x2eba3a[_0xe4ff('0x3a')]:_0x378851[_0xe4ff('0x34')];if(_0x47b298[_0xe4ff('0x36')][_0xe4ff('0x4c')]){_0x2eba3a['include']=[{'all':!![]}];}_0x2eba3a=_[_0xe4ff('0x43')]({},_0x2eba3a,_0x47b298[_0xe4ff('0x45')]);return db[_0xe4ff('0x31')][_0xe4ff('0x4d')](_0x2eba3a)['then'](handleEntityNotFound(_0x5531e7,null))[_0xe4ff('0x29')](respondWithResult(_0x5531e7,null))['catch'](handleError(_0x5531e7,null));};exports[_0xe4ff('0x4e')]=function(_0x8b5472,_0x34ff6b){return db[_0xe4ff('0x31')][_0xe4ff('0x4e')](_0x8b5472[_0xe4ff('0x4f')],{})['then'](function(_0x158a9b){var _0x3b8f16=_0x8b5472[_0xe4ff('0x50')][_0xe4ff('0x2b')]({'plain':!![]});if(!_0x3b8f16)throw new Error(_0xe4ff('0x51'));if(_0x3b8f16['role']===_0xe4ff('0x50')){var _0x4fcd78=_0x158a9b[_0xe4ff('0x2b')]({'plain':!![]});var _0x33233e='ExtractedReports';return db[_0xe4ff('0x52')][_0xe4ff('0x4d')]({'where':{'name':_0x33233e,'userProfileId':_0x3b8f16['userProfileId']},'raw':!![]})[_0xe4ff('0x29')](function(_0xd84209){if(_0xd84209&&_0xd84209[_0xe4ff('0x53')]===0x0){return db[_0xe4ff('0x2d')][_0xe4ff('0x4e')]({'name':_0x4fcd78[_0xe4ff('0x2f')],'resourceId':_0x4fcd78['id'],'type':_0xd84209[_0xe4ff('0x2f')],'sectionId':_0xd84209['id']},{})['then'](function(){return _0x158a9b;});}else{return _0x158a9b;}})['catch'](function(_0x212242){logger[_0xe4ff('0x54')](_0xe4ff('0x55'),_0x212242);throw _0x212242;});}return _0x158a9b;})[_0xe4ff('0x29')](respondWithResult(_0x34ff6b,0xc9))[_0xe4ff('0x49')](handleError(_0x34ff6b,null));};exports[_0xe4ff('0x28')]=function(_0x5ee54d,_0x5ed702){if(_0x5ee54d['body']['id']){delete _0x5ee54d[_0xe4ff('0x4f')]['id'];}return db[_0xe4ff('0x31')][_0xe4ff('0x4d')]({'where':{'id':_0x5ee54d[_0xe4ff('0x4b')]['id']}})[_0xe4ff('0x29')](handleEntityNotFound(_0x5ed702,null))[_0xe4ff('0x29')](saveUpdates(_0x5ee54d[_0xe4ff('0x4f')],null))[_0xe4ff('0x29')](respondWithResult(_0x5ed702,null))['catch'](handleError(_0x5ed702,null));};exports[_0xe4ff('0x2a')]=function(_0x1da0d9,_0x2ce9f1){return db['AnalyticExtractedReport'][_0xe4ff('0x4d')]({'where':{'id':_0x1da0d9[_0xe4ff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ce9f1,null))[_0xe4ff('0x29')](removeEntity(_0x2ce9f1,null))[_0xe4ff('0x49')](handleError(_0x2ce9f1,null));};exports['download']=function(_0x1ed118,_0x151fc1,_0x251ba6){return db[_0xe4ff('0x31')][_0xe4ff('0x4d')]({'where':{'id':_0x1ed118[_0xe4ff('0x4b')]['id']},'attributes':[_0xe4ff('0x2f'),_0xe4ff('0x56'),_0xe4ff('0x57'),_0xe4ff('0x58')],'raw':!![]})[_0xe4ff('0x29')](handleEntityNotFound(_0x151fc1,null))[_0xe4ff('0x29')](function(_0x53db4a){if(_0x53db4a){if(!fs[_0xe4ff('0x59')](path['join'](config[_0xe4ff('0x5a')],_0xe4ff('0x5b'),_0x53db4a[_0xe4ff('0x57')]))){throw new db['Sequelize'][(_0xe4ff('0x5c'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x1ed118['query'][_0xe4ff('0x5d')]){return _0x151fc1[_0xe4ff('0x1b')](0xc8);}return _0x151fc1[_0xe4ff('0x5e')](path[_0xe4ff('0x5f')](config[_0xe4ff('0x5a')],'server/files/reports',_0x53db4a[_0xe4ff('0x57')]),util[_0xe4ff('0x60')](_0xe4ff('0x61'),_0x53db4a[_0xe4ff('0x56')]||_0x53db4a[_0xe4ff('0x2f')],_0x53db4a[_0xe4ff('0x58')][_0xe4ff('0x62')]()));}})[_0xe4ff('0x49')](handleError(_0x151fc1,null));}; \ No newline at end of file +var _0x39c1=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','user','get','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','download','basename','savename','output','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','format','toLowerCase','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0x39c1,0x112));var _0x139c=function(_0x3e1249,_0x329d83){_0x3e1249=_0x3e1249-0x0;var _0xc3b9d0=_0x39c1[_0x3e1249];return _0xc3b9d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x139c('0x0'));var zipdir=require(_0x139c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x139c('0x2'));var moment=require('moment');var BPromise=require(_0x139c('0x3'));var Mustache=require(_0x139c('0x4'));var util=require(_0x139c('0x5'));var path=require(_0x139c('0x6'));var sox=require(_0x139c('0x7'));var csv=require(_0x139c('0x8'));var ejs=require(_0x139c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x139c('0xa'));var squel=require(_0x139c('0xb'));var crypto=require('crypto');var jsforce=require(_0x139c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x139c('0x8'));var querystring=require(_0x139c('0xd'));var Papa=require('papaparse');var Redis=require(_0x139c('0xe'));var authService=require(_0x139c('0xf'));var qs=require(_0x139c('0x10'));var as=require(_0x139c('0x11'));var hardwareService=require(_0x139c('0x12'));var logger=require('../../config/logger')(_0x139c('0x13'));var utils=require(_0x139c('0x14'));var config=require(_0x139c('0x15'));var licenseUtil=require(_0x139c('0x16'));var db=require(_0x139c('0x17'))['db'];function respondWithStatusCode(_0x1bdd0b,_0x5b53eb){_0x5b53eb=_0x5b53eb||0xcc;return function(_0x4345b8){if(_0x4345b8){return _0x1bdd0b['sendStatus'](_0x5b53eb);}return _0x1bdd0b[_0x139c('0x18')](_0x5b53eb)[_0x139c('0x19')]();};}function respondWithResult(_0x5e8a9c,_0x44595f){_0x44595f=_0x44595f||0xc8;return function(_0x50a29f){if(_0x50a29f){return _0x5e8a9c[_0x139c('0x18')](_0x44595f)[_0x139c('0x1a')](_0x50a29f);}};}function respondWithFilteredResult(_0x312ac1,_0x1e9c35){return function(_0x45a0a9){if(_0x45a0a9){var _0x3b4a6e=typeof _0x1e9c35['offset']==='undefined'&&typeof _0x1e9c35[_0x139c('0x1b')]===_0x139c('0x1c');var _0x4f351f=_0x45a0a9[_0x139c('0x1d')];var _0x594fef=_0x3b4a6e?0x0:_0x1e9c35[_0x139c('0x1e')];var _0x1fc1b1=_0x3b4a6e?_0x45a0a9[_0x139c('0x1d')]:_0x1e9c35['offset']+_0x1e9c35[_0x139c('0x1b')];var _0x1bb6c7;if(_0x1fc1b1>=_0x4f351f){_0x1fc1b1=_0x4f351f;_0x1bb6c7=0xc8;}else{_0x1bb6c7=0xce;}_0x312ac1[_0x139c('0x18')](_0x1bb6c7);return _0x312ac1[_0x139c('0x1f')](_0x139c('0x20'),_0x594fef+'-'+_0x1fc1b1+'/'+_0x4f351f)[_0x139c('0x1a')](_0x45a0a9);}return null;};}function patchUpdates(_0x3381ec){return function(_0x471fbe){try{jsonpatch[_0x139c('0x21')](_0x471fbe,_0x3381ec,!![]);}catch(_0x4a6a72){return BPromise[_0x139c('0x22')](_0x4a6a72);}return _0x471fbe[_0x139c('0x23')]();};}function saveUpdates(_0xd31087,_0x1b6511){return function(_0x1412e1){if(_0x1412e1){return _0x1412e1['update'](_0xd31087)[_0x139c('0x24')](function(_0x2f337d){return _0x2f337d;});}return null;};}function removeEntity(_0x4ca3a1,_0x16229d){return function(_0x33515d){if(_0x33515d){return _0x33515d['destroy']()[_0x139c('0x24')](function(){var _0x5f48af=_0x33515d['get']({'plain':!![]});var _0x4cfa8c=_0x139c('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4cfa8c,'resourceId':_0x5f48af['id']}})[_0x139c('0x24')](function(){return _0x33515d;});})[_0x139c('0x24')](function(){_0x4ca3a1['status'](0xcc)[_0x139c('0x19')]();});}};}function handleEntityNotFound(_0x202e27,_0x3db0ac){return function(_0x3d885e){if(!_0x3d885e){_0x202e27['sendStatus'](0x194);}return _0x3d885e;};}function handleError(_0x1bad27,_0x990d57){_0x990d57=_0x990d57||0x1f4;return function(_0x5325ea){logger[_0x139c('0x26')](_0x5325ea[_0x139c('0x27')]);if(_0x5325ea[_0x139c('0x28')]){delete _0x5325ea[_0x139c('0x28')];}_0x1bad27[_0x139c('0x18')](_0x990d57)[_0x139c('0x29')](_0x5325ea);};}exports[_0x139c('0x2a')]=function(_0x51e74f,_0x5332c4){var _0x26b5cb={},_0x202909={},_0xf32714={'count':0x0,'rows':[]};var _0x721c13=_[_0x139c('0x2b')](db[_0x139c('0x2c')][_0x139c('0x2d')],function(_0x4ba8c7){return{'name':_0x4ba8c7['fieldName'],'type':_0x4ba8c7[_0x139c('0x2e')][_0x139c('0x2f')]};});_0x202909[_0x139c('0x30')]=_[_0x139c('0x2b')](_0x721c13,_0x139c('0x28'));_0x202909[_0x139c('0x31')]=_['keys'](_0x51e74f[_0x139c('0x31')]);_0x202909['filters']=_[_0x139c('0x32')](_0x202909[_0x139c('0x30')],_0x202909[_0x139c('0x31')]);_0x26b5cb[_0x139c('0x33')]=_['intersection'](_0x202909['model'],qs[_0x139c('0x34')](_0x51e74f[_0x139c('0x31')][_0x139c('0x34')]));_0x26b5cb[_0x139c('0x33')]=_0x26b5cb[_0x139c('0x33')][_0x139c('0x35')]?_0x26b5cb['attributes']:_0x202909[_0x139c('0x30')];if(!_0x51e74f[_0x139c('0x31')][_0x139c('0x36')](_0x139c('0x37'))){_0x26b5cb[_0x139c('0x1b')]=qs[_0x139c('0x1b')](_0x51e74f[_0x139c('0x31')][_0x139c('0x1b')]);_0x26b5cb[_0x139c('0x1e')]=qs[_0x139c('0x1e')](_0x51e74f[_0x139c('0x31')][_0x139c('0x1e')]);}_0x26b5cb['order']=qs[_0x139c('0x38')](_0x51e74f[_0x139c('0x31')][_0x139c('0x38')]);_0x26b5cb[_0x139c('0x39')]=qs[_0x139c('0x3a')](_[_0x139c('0x3b')](_0x51e74f['query'],_0x202909['filters']),_0x721c13);if(_0x51e74f[_0x139c('0x31')][_0x139c('0x3c')]){_0x26b5cb[_0x139c('0x39')]=_[_0x139c('0x3d')](_0x26b5cb[_0x139c('0x39')],{'$or':_['map'](_0x721c13,function(_0x48cfca){if(_0x48cfca[_0x139c('0x2e')]!==_0x139c('0x3e')){var _0x26411e={};_0x26411e[_0x48cfca[_0x139c('0x28')]]={'$like':'%'+_0x51e74f[_0x139c('0x31')][_0x139c('0x3c')]+'%'};return _0x26411e;}})});}_0x26b5cb=_['merge']({},_0x26b5cb,_0x51e74f['options']);var _0x8ff527={'where':_0x26b5cb[_0x139c('0x39')]};return db[_0x139c('0x2c')][_0x139c('0x1d')](_0x8ff527)[_0x139c('0x24')](function(_0x37efde){_0xf32714['count']=_0x37efde;if(_0x51e74f[_0x139c('0x31')][_0x139c('0x3f')]){_0x26b5cb[_0x139c('0x40')]=[{'all':!![]}];}return db[_0x139c('0x2c')][_0x139c('0x41')](_0x26b5cb);})['then'](function(_0x1206dd){_0xf32714[_0x139c('0x42')]=_0x1206dd;return _0xf32714;})[_0x139c('0x24')](respondWithFilteredResult(_0x5332c4,_0x26b5cb))[_0x139c('0x43')](handleError(_0x5332c4,null));};exports['show']=function(_0x2edfb8,_0x31ca7e){var _0x42f8a1={'raw':!![],'where':{'id':_0x2edfb8[_0x139c('0x44')]['id']}},_0x3da03a={};_0x3da03a[_0x139c('0x30')]=_[_0x139c('0x45')](db[_0x139c('0x2c')][_0x139c('0x2d')]);_0x3da03a[_0x139c('0x31')]=_[_0x139c('0x45')](_0x2edfb8[_0x139c('0x31')]);_0x3da03a[_0x139c('0x3a')]=_[_0x139c('0x32')](_0x3da03a[_0x139c('0x30')],_0x3da03a[_0x139c('0x31')]);_0x42f8a1[_0x139c('0x33')]=_[_0x139c('0x32')](_0x3da03a[_0x139c('0x30')],qs[_0x139c('0x34')](_0x2edfb8[_0x139c('0x31')][_0x139c('0x34')]));_0x42f8a1[_0x139c('0x33')]=_0x42f8a1['attributes'][_0x139c('0x35')]?_0x42f8a1['attributes']:_0x3da03a[_0x139c('0x30')];if(_0x2edfb8[_0x139c('0x31')][_0x139c('0x3f')]){_0x42f8a1[_0x139c('0x40')]=[{'all':!![]}];}_0x42f8a1=_[_0x139c('0x3d')]({},_0x42f8a1,_0x2edfb8[_0x139c('0x46')]);return db[_0x139c('0x2c')][_0x139c('0x47')](_0x42f8a1)[_0x139c('0x24')](handleEntityNotFound(_0x31ca7e,null))['then'](respondWithResult(_0x31ca7e,null))[_0x139c('0x43')](handleError(_0x31ca7e,null));};exports[_0x139c('0x48')]=function(_0xcc1051,_0x636de5){return db['AnalyticExtractedReport'][_0x139c('0x48')](_0xcc1051['body'],{})['then'](function(_0x3788da){var _0x5c6408=_0xcc1051[_0x139c('0x49')]['get']({'plain':!![]});if(!_0x5c6408)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c6408['role']==='user'){var _0x1c04d6=_0x3788da[_0x139c('0x4a')]({'plain':!![]});var _0x1d8d13='ExtractedReports';return db['UserProfileSection'][_0x139c('0x47')]({'where':{'name':_0x1d8d13,'userProfileId':_0x5c6408[_0x139c('0x4b')]},'raw':!![]})[_0x139c('0x24')](function(_0x26b200){if(_0x26b200&&_0x26b200['autoAssociation']===0x0){return db[_0x139c('0x4c')][_0x139c('0x48')]({'name':_0x1c04d6[_0x139c('0x28')],'resourceId':_0x1c04d6['id'],'type':_0x26b200['name'],'sectionId':_0x26b200['id']},{})[_0x139c('0x24')](function(){return _0x3788da;});}else{return _0x3788da;}})[_0x139c('0x43')](function(_0x497399){logger['error'](_0x139c('0x4d'),_0x497399);throw _0x497399;});}return _0x3788da;})[_0x139c('0x24')](respondWithResult(_0x636de5,0xc9))[_0x139c('0x43')](handleError(_0x636de5,null));};exports[_0x139c('0x4e')]=function(_0x3c63cd,_0x5b0e26){if(_0x3c63cd[_0x139c('0x4f')]['id']){delete _0x3c63cd[_0x139c('0x4f')]['id'];}return db[_0x139c('0x2c')]['find']({'where':{'id':_0x3c63cd[_0x139c('0x44')]['id']}})[_0x139c('0x24')](handleEntityNotFound(_0x5b0e26,null))['then'](saveUpdates(_0x3c63cd[_0x139c('0x4f')],null))['then'](respondWithResult(_0x5b0e26,null))[_0x139c('0x43')](handleError(_0x5b0e26,null));};exports[_0x139c('0x50')]=function(_0x373747,_0x1071dd){return db[_0x139c('0x2c')][_0x139c('0x47')]({'where':{'id':_0x373747[_0x139c('0x44')]['id']}})[_0x139c('0x24')](handleEntityNotFound(_0x1071dd,null))['then'](removeEntity(_0x1071dd,null))[_0x139c('0x43')](handleError(_0x1071dd,null));};exports[_0x139c('0x51')]=function(_0x1a991a,_0x4d967b,_0xa32a2e){return db[_0x139c('0x2c')]['find']({'where':{'id':_0x1a991a[_0x139c('0x44')]['id']},'attributes':[_0x139c('0x28'),_0x139c('0x52'),_0x139c('0x53'),_0x139c('0x54')],'raw':!![]})[_0x139c('0x24')](handleEntityNotFound(_0x4d967b,null))['then'](function(_0x1a8238){if(_0x1a8238){if(!fs['existsSync'](path[_0x139c('0x55')](config['root'],_0x139c('0x56'),_0x1a8238[_0x139c('0x53')]))){throw new db[(_0x139c('0x57'))][(_0x139c('0x58'))](_0x139c('0x59'));}if(_0x1a991a[_0x139c('0x31')]['exists']){return _0x4d967b['sendStatus'](0xc8);}return _0x4d967b['download'](path[_0x139c('0x55')](config[_0x139c('0x5a')],_0x139c('0x56'),_0x1a8238[_0x139c('0x53')]),util[_0x139c('0x5b')]('%s.%s',_0x1a8238['basename']||_0x1a8238[_0x139c('0x28')],_0x1a8238['output'][_0x139c('0x5c')]()));}})['catch'](handleError(_0x4d967b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b60f380..1cef542 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 _0x3f13=['../../config/environment','define','AnalyticExtractedReport','analytics_extracted_reports','api','request-promise','path'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x3f13,0x1bd));var _0x33f1=function(_0x35338c,_0x51792c){_0x35338c=_0x35338c-0x0;var _0x400ed5=_0x3f13[_0x35338c];return _0x400ed5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x33f1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x33f1('0x1'));var fs=require('fs');var path=require(_0x33f1('0x2'));var rimraf=require('rimraf');var config=require(_0x33f1('0x3'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x340aec,_0xce26dd){return _0x340aec[_0x33f1('0x4')](_0x33f1('0x5'),attributes,{'tableName':_0x33f1('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6921=['define','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x2852cf,_0xcd3407){var _0xa77966=function(_0x394936){while(--_0x394936){_0x2852cf['push'](_0x2852cf['shift']());}};_0xa77966(++_0xcd3407);}(_0x6921,0x121));var _0x1692=function(_0x16a998,_0x579f1f){_0x16a998=_0x16a998-0x0;var _0x56f7f2=_0x6921[_0x16a998];return _0x56f7f2;};'use strict';var _=require(_0x1692('0x0'));var util=require(_0x1692('0x1'));var logger=require('../../config/logger')(_0x1692('0x2'));var moment=require(_0x1692('0x3'));var BPromise=require(_0x1692('0x4'));var rp=require(_0x1692('0x5'));var fs=require('fs');var path=require(_0x1692('0x6'));var rimraf=require(_0x1692('0x7'));var config=require(_0x1692('0x8'));var attributes=require(_0x1692('0x9'));module[_0x1692('0xa')]=function(_0x1244a4,_0x14a783){return _0x1244a4[_0x1692('0xb')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index b5e894a..0ef3d07 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 _0x253d=['rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','result','AnalyticExtractedReport,\x20%s,\x20%s','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x253d,0x1b3));var _0xd253=function(_0x2284b7,_0x3c5ab8){_0x2284b7=_0x2284b7-0x0;var _0x5aac1e=_0x253d[_0x2284b7];return _0x5aac1e;};'use strict';var _=require(_0xd253('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd253('0x1'));var db=require(_0xd253('0x2'))['db'];var utils=require(_0xd253('0x3'));var logger=require(_0xd253('0x4'))(_0xd253('0x5'));var config=require('../../config/environment');var jayson=require(_0xd253('0x6'));var client=jayson[_0xd253('0x7')][_0xd253('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17589a,_0xf4b457,_0x487f4e){return new BPromise(function(_0x2c4de4,_0x712c81){return client[_0xd253('0x9')](_0x17589a,_0x487f4e)[_0xd253('0xa')](function(_0x351047){logger[_0xd253('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xf4b457,'request\x20sent');logger[_0xd253('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'),JSON[_0xd253('0xe')](_0x351047));if(_0x351047[_0xd253('0xf')]){if(_0x351047[_0xd253('0xf')][_0xd253('0x10')]===0x1f4){logger[_0xd253('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xf4b457,_0x351047['error'][_0xd253('0x11')]);return _0x712c81(_0x351047[_0xd253('0xf')][_0xd253('0x11')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0xf4b457,_0x351047[_0xd253('0xf')][_0xd253('0x11')]);return _0x2c4de4(_0x351047[_0xd253('0xf')]['message']);}else{logger[_0xd253('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xf4b457,_0xd253('0xd'));_0x2c4de4(_0x351047[_0xd253('0x12')][_0xd253('0x11')]);}})['catch'](function(_0x1b7ed1){logger['error'](_0xd253('0x13'),_0xf4b457,_0x1b7ed1);_0x712c81(_0x1b7ed1);});});} \ No newline at end of file +var _0xb6b2=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment'];(function(_0x4db55e,_0x382904){var _0x1510db=function(_0x29db68){while(--_0x29db68){_0x4db55e['push'](_0x4db55e['shift']());}};_0x1510db(++_0x382904);}(_0xb6b2,0x1e0));var _0x2b6b=function(_0x1c9671,_0x3cf964){_0x1c9671=_0x1c9671-0x0;var _0x1dd552=_0xb6b2[_0x1c9671];return _0x1dd552;};'use strict';var _=require(_0x2b6b('0x0'));var util=require(_0x2b6b('0x1'));var moment=require(_0x2b6b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b6b('0x4'))(_0x2b6b('0x5'));var config=require(_0x2b6b('0x6'));var jayson=require(_0x2b6b('0x7'));var client=jayson[_0x2b6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x796fe4,_0x9b95c1,_0x3228e2){return new BPromise(function(_0x56029c,_0xe2c8d){return client[_0x2b6b('0x9')](_0x796fe4,_0x3228e2)[_0x2b6b('0xa')](function(_0x1e7f99){logger[_0x2b6b('0xb')](_0x2b6b('0xc'),_0x9b95c1,_0x2b6b('0xd'));logger[_0x2b6b('0xe')](_0x2b6b('0xf'),_0x9b95c1,_0x2b6b('0xd'),JSON[_0x2b6b('0x10')](_0x1e7f99));if(_0x1e7f99['error']){if(_0x1e7f99['error'][_0x2b6b('0x11')]===0x1f4){logger[_0x2b6b('0x12')](_0x2b6b('0xc'),_0x9b95c1,_0x1e7f99[_0x2b6b('0x12')][_0x2b6b('0x13')]);return _0xe2c8d(_0x1e7f99[_0x2b6b('0x12')][_0x2b6b('0x13')]);}logger[_0x2b6b('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x9b95c1,_0x1e7f99[_0x2b6b('0x12')]['message']);return _0x56029c(_0x1e7f99[_0x2b6b('0x12')][_0x2b6b('0x13')]);}else{logger[_0x2b6b('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x9b95c1,_0x2b6b('0xd'));_0x56029c(_0x1e7f99['result']['message']);}})[_0x2b6b('0x14')](function(_0x92f5bb){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x9b95c1,_0x92f5bb);_0xe2c8d(_0x92f5bb);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 02ffcb1..4c0f1dc 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 _0x1a71=['post','create','put','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1a71,0xcc));var _0x11a7=function(_0x2770a9,_0x3bb210){_0x2770a9=_0x2770a9-0x0;var _0x59d922=_0x1a71[_0x2770a9];return _0x59d922;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11a7('0x0'));var timeout=require('connect-timeout');var express=require(_0x11a7('0x1'));var router=express['Router']();var fs_extra=require(_0x11a7('0x2'));var auth=require(_0x11a7('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x11a7('0x4'));router[_0x11a7('0x5')]('/',auth[_0x11a7('0x6')](),controller[_0x11a7('0x7')]);router[_0x11a7('0x5')](_0x11a7('0x8'),auth[_0x11a7('0x6')](),controller[_0x11a7('0x9')]);router['get'](_0x11a7('0xa'),auth['isAuthenticated'](),controller[_0x11a7('0xb')]);router[_0x11a7('0xc')]('/',auth[_0x11a7('0x6')](),controller[_0x11a7('0xd')]);router[_0x11a7('0xe')](_0x11a7('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x11a7('0xf')](_0x11a7('0x8'),auth[_0x11a7('0x6')](),controller[_0x11a7('0x10')]);module[_0x11a7('0x11')]=router; \ No newline at end of file +var _0xbc31=['get','/:id','download','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index'];(function(_0x4069f5,_0x58dfe4){var _0x3f2d81=function(_0x4b6aba){while(--_0x4b6aba){_0x4069f5['push'](_0x4069f5['shift']());}};_0x3f2d81(++_0x58dfe4);}(_0xbc31,0xed));var _0x1bc3=function(_0x1cdc3c,_0x5bea4a){_0x1cdc3c=_0x1cdc3c-0x0;var _0x2fcda8=_0xbc31[_0x1cdc3c];return _0x2fcda8;};'use strict';var multer=require(_0x1bc3('0x0'));var util=require(_0x1bc3('0x1'));var path=require(_0x1bc3('0x2'));var timeout=require('connect-timeout');var express=require(_0x1bc3('0x3'));var router=express[_0x1bc3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1bc3('0x5'));var interaction=require(_0x1bc3('0x6'));var config=require('../../config/environment');var controller=require(_0x1bc3('0x7'));router['get']('/',auth[_0x1bc3('0x8')](),controller[_0x1bc3('0x9')]);router[_0x1bc3('0xa')](_0x1bc3('0xb'),auth[_0x1bc3('0x8')](),controller['show']);router[_0x1bc3('0xa')]('/:id/download',auth[_0x1bc3('0x8')](),controller[_0x1bc3('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1bc3('0xd')]);router[_0x1bc3('0xe')](_0x1bc3('0xb'),auth[_0x1bc3('0x8')](),controller[_0x1bc3('0xf')]);router[_0x1bc3('0x10')](_0x1bc3('0xb'),auth[_0x1bc3('0x8')](),controller[_0x1bc3('0x11')]);module[_0x1bc3('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 7e2bf68..358fd73 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 _0x2eb2=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2eb2,0x189));var _0x22eb=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x2eb2[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x22eb('0x0'));module[_0x22eb('0x1')]={'field':{'type':Sequelize[_0x22eb('0x2')]},'alias':{'type':Sequelize[_0x22eb('0x3')]},'function':{'type':Sequelize[_0x22eb('0x3')]},'format':{'type':Sequelize[_0x22eb('0x3')]},'groupBy':{'type':Sequelize[_0x22eb('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x22eb('0x3')]},'custom':{'type':Sequelize[_0x22eb('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xcb5d=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0xa2e45a,_0x4df624){var _0x181eb2=function(_0x40c466){while(--_0x40c466){_0xa2e45a['push'](_0xa2e45a['shift']());}};_0x181eb2(++_0x4df624);}(_0xcb5d,0x79));var _0xdcb5=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xcb5d[_0x3b150c];return _0x5cd414;};'use strict';var Sequelize=require(_0xdcb5('0x0'));module[_0xdcb5('0x1')]={'field':{'type':Sequelize[_0xdcb5('0x2')]},'alias':{'type':Sequelize[_0xdcb5('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xdcb5('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xdcb5('0x3')]},'custom':{'type':Sequelize[_0xdcb5('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 8e5946f..f29791e 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 _0x735a=['body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create'];(function(_0x2a1db7,_0x5dfed8){var _0x217a9d=function(_0x5068cd){while(--_0x5068cd){_0x2a1db7['push'](_0x2a1db7['shift']());}};_0x217a9d(++_0x5dfed8);}(_0x735a,0x1e2));var _0xa735=function(_0xa71865,_0x3d5638){_0xa71865=_0xa71865-0x0;var _0x313116=_0x735a[_0xa71865];return _0x313116;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa735('0x0'));var jsonpatch=require(_0xa735('0x1'));var rp=require(_0xa735('0x2'));var moment=require(_0xa735('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa735('0x4'));var util=require(_0xa735('0x5'));var path=require('path');var sox=require(_0xa735('0x6'));var csv=require('to-csv');var ejs=require(_0xa735('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa735('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa735('0x9'));var deskjs=require(_0xa735('0xa'));var toCsv=require(_0xa735('0xb'));var querystring=require(_0xa735('0xc'));var Papa=require('papaparse');var Redis=require(_0xa735('0xd'));var authService=require(_0xa735('0xe'));var qs=require(_0xa735('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa735('0x10'));var logger=require(_0xa735('0x11'))(_0xa735('0x12'));var utils=require('../../config/utils');var config=require(_0xa735('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa735('0x14'))['db'];function respondWithStatusCode(_0xcee60d,_0x9d2fac){_0x9d2fac=_0x9d2fac||0xcc;return function(_0x5b0b5e){if(_0x5b0b5e){return _0xcee60d[_0xa735('0x15')](_0x9d2fac);}return _0xcee60d[_0xa735('0x16')](_0x9d2fac)[_0xa735('0x17')]();};}function respondWithResult(_0x2bc1c4,_0x113a1d){_0x113a1d=_0x113a1d||0xc8;return function(_0x9644a){if(_0x9644a){return _0x2bc1c4['status'](_0x113a1d)[_0xa735('0x18')](_0x9644a);}};}function respondWithFilteredResult(_0x1091bc,_0x466c88){return function(_0x572486){if(_0x572486){var _0xa31d2f=typeof _0x466c88['offset']==='undefined'&&typeof _0x466c88['limit']===_0xa735('0x19');var _0x37d5ed=_0x572486['count'];var _0x213f92=_0xa31d2f?0x0:_0x466c88['offset'];var _0x5f3381=_0xa31d2f?_0x572486[_0xa735('0x1a')]:_0x466c88[_0xa735('0x1b')]+_0x466c88['limit'];var _0x1d6793;if(_0x5f3381>=_0x37d5ed){_0x5f3381=_0x37d5ed;_0x1d6793=0xc8;}else{_0x1d6793=0xce;}_0x1091bc[_0xa735('0x16')](_0x1d6793);return _0x1091bc[_0xa735('0x1c')](_0xa735('0x1d'),_0x213f92+'-'+_0x5f3381+'/'+_0x37d5ed)[_0xa735('0x18')](_0x572486);}return null;};}function patchUpdates(_0x1b58a4){return function(_0x4f5181){try{jsonpatch[_0xa735('0x1e')](_0x4f5181,_0x1b58a4,!![]);}catch(_0x552378){return BPromise[_0xa735('0x1f')](_0x552378);}return _0x4f5181[_0xa735('0x20')]();};}function saveUpdates(_0x1b36a9,_0x306853){return function(_0x130f56){if(_0x130f56){return _0x130f56[_0xa735('0x21')](_0x1b36a9)[_0xa735('0x22')](function(_0x135d2b){return _0x135d2b;});}return null;};}function removeEntity(_0x4cf2d0,_0x450b88){return function(_0x56b901){if(_0x56b901){return _0x56b901[_0xa735('0x23')]()[_0xa735('0x22')](function(){_0x4cf2d0[_0xa735('0x16')](0xcc)[_0xa735('0x17')]();});}};}function handleEntityNotFound(_0x6d9906,_0x3b54ea){return function(_0x117ca4){if(!_0x117ca4){_0x6d9906[_0xa735('0x15')](0x194);}return _0x117ca4;};}function handleError(_0x3fffc7,_0x32f704){_0x32f704=_0x32f704||0x1f4;return function(_0x341f81){logger[_0xa735('0x24')](_0x341f81['stack']);if(_0x341f81[_0xa735('0x25')]){delete _0x341f81['name'];}_0x3fffc7['status'](_0x32f704)[_0xa735('0x26')](_0x341f81);};}exports[_0xa735('0x27')]=function(_0x55d65e,_0x41196d){var _0x4060f7={},_0x27d862={},_0x52c456={'count':0x0,'rows':[]};var _0x2cbf3e=_[_0xa735('0x28')](db[_0xa735('0x29')][_0xa735('0x2a')],function(_0x45aa7e){return{'name':_0x45aa7e[_0xa735('0x2b')],'type':_0x45aa7e[_0xa735('0x2c')][_0xa735('0x2d')]};});_0x27d862[_0xa735('0x2e')]=_[_0xa735('0x28')](_0x2cbf3e,_0xa735('0x25'));_0x27d862[_0xa735('0x2f')]=_[_0xa735('0x30')](_0x55d65e[_0xa735('0x2f')]);_0x27d862[_0xa735('0x31')]=_[_0xa735('0x32')](_0x27d862[_0xa735('0x2e')],_0x27d862[_0xa735('0x2f')]);_0x4060f7[_0xa735('0x33')]=_[_0xa735('0x32')](_0x27d862[_0xa735('0x2e')],qs[_0xa735('0x34')](_0x55d65e[_0xa735('0x2f')]['fields']));_0x4060f7[_0xa735('0x33')]=_0x4060f7['attributes'][_0xa735('0x35')]?_0x4060f7['attributes']:_0x27d862[_0xa735('0x2e')];if(!_0x55d65e[_0xa735('0x2f')]['hasOwnProperty']('nolimit')){_0x4060f7['limit']=qs[_0xa735('0x36')](_0x55d65e['query'][_0xa735('0x36')]);_0x4060f7[_0xa735('0x1b')]=qs[_0xa735('0x1b')](_0x55d65e[_0xa735('0x2f')]['offset']);}_0x4060f7[_0xa735('0x37')]=qs['sort'](_0x55d65e[_0xa735('0x2f')][_0xa735('0x38')]);_0x4060f7[_0xa735('0x39')]=qs[_0xa735('0x31')](_[_0xa735('0x3a')](_0x55d65e[_0xa735('0x2f')],_0x27d862[_0xa735('0x31')]),_0x2cbf3e);if(_0x55d65e[_0xa735('0x2f')]['filter']){_0x4060f7[_0xa735('0x39')]=_['merge'](_0x4060f7[_0xa735('0x39')],{'$or':_[_0xa735('0x28')](_0x2cbf3e,function(_0x5bc264){if(_0x5bc264['type']!==_0xa735('0x3b')){var _0x410208={};_0x410208[_0x5bc264[_0xa735('0x25')]]={'$like':'%'+_0x55d65e[_0xa735('0x2f')][_0xa735('0x3c')]+'%'};return _0x410208;}})});}_0x4060f7=_[_0xa735('0x3d')]({},_0x4060f7,_0x55d65e[_0xa735('0x3e')]);var _0x4c7a5e={'where':_0x4060f7['where']};return db[_0xa735('0x29')][_0xa735('0x1a')](_0x4c7a5e)[_0xa735('0x22')](function(_0x5416f4){_0x52c456[_0xa735('0x1a')]=_0x5416f4;if(_0x55d65e[_0xa735('0x2f')][_0xa735('0x3f')]){_0x4060f7[_0xa735('0x40')]=[{'all':!![]}];}return db[_0xa735('0x29')][_0xa735('0x41')](_0x4060f7);})[_0xa735('0x22')](function(_0x232686){_0x52c456[_0xa735('0x42')]=_0x232686;return _0x52c456;})[_0xa735('0x22')](respondWithFilteredResult(_0x41196d,_0x4060f7))[_0xa735('0x43')](handleError(_0x41196d,null));};exports['show']=function(_0x1e4f6b,_0x2d0112){var _0x5d6a40={'raw':![],'where':{'id':_0x1e4f6b[_0xa735('0x44')]['id']}},_0x4b3813={};_0x4b3813['model']=_[_0xa735('0x30')](db[_0xa735('0x29')][_0xa735('0x2a')]);_0x4b3813[_0xa735('0x2f')]=_[_0xa735('0x30')](_0x1e4f6b[_0xa735('0x2f')]);_0x4b3813[_0xa735('0x31')]=_['intersection'](_0x4b3813[_0xa735('0x2e')],_0x4b3813[_0xa735('0x2f')]);_0x5d6a40[_0xa735('0x33')]=_[_0xa735('0x32')](_0x4b3813['model'],qs[_0xa735('0x34')](_0x1e4f6b[_0xa735('0x2f')][_0xa735('0x34')]));_0x5d6a40[_0xa735('0x33')]=_0x5d6a40[_0xa735('0x33')]['length']?_0x5d6a40[_0xa735('0x33')]:_0x4b3813['model'];if(_0x1e4f6b[_0xa735('0x2f')][_0xa735('0x3f')]){_0x5d6a40[_0xa735('0x40')]=[{'all':!![]}];}_0x5d6a40=_[_0xa735('0x3d')]({},_0x5d6a40,_0x1e4f6b['options']);return db[_0xa735('0x29')][_0xa735('0x45')](_0x5d6a40)['then'](handleEntityNotFound(_0x2d0112,null))['then'](respondWithResult(_0x2d0112,null))['catch'](handleError(_0x2d0112,null));};exports['create']=function(_0x2b4578,_0x58f5ae){return db[_0xa735('0x29')][_0xa735('0x46')](_0x2b4578[_0xa735('0x47')],{})[_0xa735('0x22')](respondWithResult(_0x58f5ae,0xc9))[_0xa735('0x43')](handleError(_0x58f5ae,null));};exports['bulkCreate']=function(_0x1a6510,_0x1452f3){return db[_0xa735('0x29')][_0xa735('0x48')](_0x1a6510['body'],{'raw':![],'individualHooks':!![]})[_0xa735('0x22')](respondWithResult(_0x1452f3,0xc9))[_0xa735('0x43')](handleError(_0x1452f3,null));};exports[_0xa735('0x21')]=function(_0x550189,_0x3c8504){if(_0x550189['body']['id']){delete _0x550189['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x550189[_0xa735('0x44')]['id']}})[_0xa735('0x22')](handleEntityNotFound(_0x3c8504,null))[_0xa735('0x22')](saveUpdates(_0x550189[_0xa735('0x47')],null))[_0xa735('0x22')](respondWithResult(_0x3c8504,null))['catch'](handleError(_0x3c8504,null));};exports[_0xa735('0x23')]=function(_0x3785a2,_0x4de626){return db[_0xa735('0x29')][_0xa735('0x45')]({'where':{'id':_0x3785a2[_0xa735('0x44')]['id']}})[_0xa735('0x22')](handleEntityNotFound(_0x4de626,null))[_0xa735('0x22')](removeEntity(_0x4de626,null))[_0xa735('0x43')](handleError(_0x4de626,null));};exports['bulkDestroy']=function(_0x1ff224,_0x1a6c84){return db['AnalyticFieldReport'][_0xa735('0x23')]({'where':{'id':_0x1ff224['query'][_0xa735('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xa735('0x22')](respondWithResult(_0x1a6c84,0xcc))[_0xa735('0x43')](handleError(_0x1a6c84,null));};exports[_0xa735('0x4a')]=function(_0x5ffcb0,_0xc84b18,_0x563b42){return db[_0xa735('0x4b')][_0xa735('0x4c')]({'where':{'id':_0x5ffcb0['params']['id']}})[_0xa735('0x22')](handleEntityNotFound(_0xc84b18,null))['then'](function(_0x83c832){if(_0x83c832){return db[_0xa735('0x4d')]['transaction'](function(_0x191771){return db[_0xa735('0x29')][_0xa735('0x23')]({'where':{'CustomReportId':_0x5ffcb0[_0xa735('0x44')]['id']},'transaction':_0x191771})[_0xa735('0x22')](function(_0x50950e){var _0x344c25=_[_0xa735('0x28')](_0x5ffcb0[_0xa735('0x47')],function(_0x5c4e85){delete _0x5c4e85['id'];_0x5c4e85[_0xa735('0x4e')]=_0x5ffcb0[_0xa735('0x44')]['id'];return _0x5c4e85;});return db[_0xa735('0x29')][_0xa735('0x48')](_0x344c25,{'transaction':_0x191771});});})[_0xa735('0x22')](function(){return db[_0xa735('0x29')][_0xa735('0x41')]({'where':{'CustomReportId':_0x5ffcb0['params']['id']}});});}})['then'](respondWithResult(_0xc84b18,null))['catch'](handleError(_0xc84b18,null));}; \ No newline at end of file +var _0xc880=['merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where'];(function(_0x32229f,_0x1edd37){var _0x149363=function(_0x59b347){while(--_0x59b347){_0x32229f['push'](_0x32229f['shift']());}};_0x149363(++_0x1edd37);}(_0xc880,0x66));var _0x0c88=function(_0x140f42,_0x4c71f6){_0x140f42=_0x140f42-0x0;var _0x1f92f6=_0xc880[_0x140f42];return _0x1f92f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c88('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c88('0x1'));var rp=require('request-promise');var moment=require(_0x0c88('0x2'));var BPromise=require(_0x0c88('0x3'));var Mustache=require('mustache');var util=require(_0x0c88('0x4'));var path=require(_0x0c88('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0c88('0x6'));var fs=require('fs');var fs_extra=require(_0x0c88('0x7'));var _=require(_0x0c88('0x8'));var squel=require(_0x0c88('0x9'));var crypto=require(_0x0c88('0xa'));var jsforce=require(_0x0c88('0xb'));var deskjs=require(_0x0c88('0xc'));var toCsv=require(_0x0c88('0xd'));var querystring=require(_0x0c88('0xe'));var Papa=require('papaparse');var Redis=require(_0x0c88('0xf'));var authService=require(_0x0c88('0x10'));var qs=require(_0x0c88('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c88('0x12'));var logger=require('../../config/logger')(_0x0c88('0x13'));var utils=require(_0x0c88('0x14'));var config=require(_0x0c88('0x15'));var licenseUtil=require(_0x0c88('0x16'));var db=require(_0x0c88('0x17'))['db'];function respondWithStatusCode(_0x6ffb77,_0x2cfa5c){_0x2cfa5c=_0x2cfa5c||0xcc;return function(_0x269a87){if(_0x269a87){return _0x6ffb77['sendStatus'](_0x2cfa5c);}return _0x6ffb77[_0x0c88('0x18')](_0x2cfa5c)[_0x0c88('0x19')]();};}function respondWithResult(_0x35f022,_0x1645ff){_0x1645ff=_0x1645ff||0xc8;return function(_0x3635d7){if(_0x3635d7){return _0x35f022[_0x0c88('0x18')](_0x1645ff)['json'](_0x3635d7);}};}function respondWithFilteredResult(_0x15e9f0,_0x5d3139){return function(_0x2610d8){if(_0x2610d8){var _0x43253c=typeof _0x5d3139['offset']===_0x0c88('0x1a')&&typeof _0x5d3139[_0x0c88('0x1b')]===_0x0c88('0x1a');var _0x1171ed=_0x2610d8['count'];var _0x1b1342=_0x43253c?0x0:_0x5d3139[_0x0c88('0x1c')];var _0x54e095=_0x43253c?_0x2610d8[_0x0c88('0x1d')]:_0x5d3139[_0x0c88('0x1c')]+_0x5d3139['limit'];var _0x4a1366;if(_0x54e095>=_0x1171ed){_0x54e095=_0x1171ed;_0x4a1366=0xc8;}else{_0x4a1366=0xce;}_0x15e9f0[_0x0c88('0x18')](_0x4a1366);return _0x15e9f0['set'](_0x0c88('0x1e'),_0x1b1342+'-'+_0x54e095+'/'+_0x1171ed)[_0x0c88('0x1f')](_0x2610d8);}return null;};}function patchUpdates(_0x42eaa3){return function(_0x507b62){try{jsonpatch[_0x0c88('0x20')](_0x507b62,_0x42eaa3,!![]);}catch(_0x2eea2d){return BPromise[_0x0c88('0x21')](_0x2eea2d);}return _0x507b62[_0x0c88('0x22')]();};}function saveUpdates(_0x19d1a9,_0x5e5e1f){return function(_0x23e648){if(_0x23e648){return _0x23e648[_0x0c88('0x23')](_0x19d1a9)[_0x0c88('0x24')](function(_0x4ffbaf){return _0x4ffbaf;});}return null;};}function removeEntity(_0x5bdc58,_0x274a33){return function(_0x275082){if(_0x275082){return _0x275082['destroy']()[_0x0c88('0x24')](function(){_0x5bdc58[_0x0c88('0x18')](0xcc)[_0x0c88('0x19')]();});}};}function handleEntityNotFound(_0x100f7e,_0xabf113){return function(_0x5b52a4){if(!_0x5b52a4){_0x100f7e[_0x0c88('0x25')](0x194);}return _0x5b52a4;};}function handleError(_0x5e2094,_0x181717){_0x181717=_0x181717||0x1f4;return function(_0x2f3d7d){logger[_0x0c88('0x26')](_0x2f3d7d[_0x0c88('0x27')]);if(_0x2f3d7d[_0x0c88('0x28')]){delete _0x2f3d7d['name'];}_0x5e2094[_0x0c88('0x18')](_0x181717)[_0x0c88('0x29')](_0x2f3d7d);};}exports[_0x0c88('0x2a')]=function(_0x2fab31,_0x103f60){var _0x3e5415={},_0x4634c3={},_0x107dca={'count':0x0,'rows':[]};var _0x520dc=_[_0x0c88('0x2b')](db[_0x0c88('0x2c')][_0x0c88('0x2d')],function(_0x4022af){return{'name':_0x4022af[_0x0c88('0x2e')],'type':_0x4022af[_0x0c88('0x2f')][_0x0c88('0x30')]};});_0x4634c3[_0x0c88('0x31')]=_[_0x0c88('0x2b')](_0x520dc,_0x0c88('0x28'));_0x4634c3[_0x0c88('0x32')]=_[_0x0c88('0x33')](_0x2fab31[_0x0c88('0x32')]);_0x4634c3[_0x0c88('0x34')]=_[_0x0c88('0x35')](_0x4634c3[_0x0c88('0x31')],_0x4634c3['query']);_0x3e5415[_0x0c88('0x36')]=_[_0x0c88('0x35')](_0x4634c3['model'],qs[_0x0c88('0x37')](_0x2fab31[_0x0c88('0x32')][_0x0c88('0x37')]));_0x3e5415['attributes']=_0x3e5415[_0x0c88('0x36')][_0x0c88('0x38')]?_0x3e5415[_0x0c88('0x36')]:_0x4634c3[_0x0c88('0x31')];if(!_0x2fab31[_0x0c88('0x32')]['hasOwnProperty']('nolimit')){_0x3e5415[_0x0c88('0x1b')]=qs['limit'](_0x2fab31[_0x0c88('0x32')][_0x0c88('0x1b')]);_0x3e5415[_0x0c88('0x1c')]=qs['offset'](_0x2fab31[_0x0c88('0x32')][_0x0c88('0x1c')]);}_0x3e5415[_0x0c88('0x39')]=qs[_0x0c88('0x3a')](_0x2fab31[_0x0c88('0x32')][_0x0c88('0x3a')]);_0x3e5415['where']=qs[_0x0c88('0x34')](_[_0x0c88('0x3b')](_0x2fab31[_0x0c88('0x32')],_0x4634c3['filters']),_0x520dc);if(_0x2fab31[_0x0c88('0x32')][_0x0c88('0x3c')]){_0x3e5415[_0x0c88('0x3d')]=_[_0x0c88('0x3e')](_0x3e5415['where'],{'$or':_['map'](_0x520dc,function(_0x19dacb){if(_0x19dacb[_0x0c88('0x2f')]!=='VIRTUAL'){var _0x151a48={};_0x151a48[_0x19dacb[_0x0c88('0x28')]]={'$like':'%'+_0x2fab31[_0x0c88('0x32')]['filter']+'%'};return _0x151a48;}})});}_0x3e5415=_['merge']({},_0x3e5415,_0x2fab31[_0x0c88('0x3f')]);var _0x4cfb22={'where':_0x3e5415[_0x0c88('0x3d')]};return db[_0x0c88('0x2c')][_0x0c88('0x1d')](_0x4cfb22)[_0x0c88('0x24')](function(_0x15f195){_0x107dca['count']=_0x15f195;if(_0x2fab31[_0x0c88('0x32')][_0x0c88('0x40')]){_0x3e5415['include']=[{'all':!![]}];}return db[_0x0c88('0x2c')][_0x0c88('0x41')](_0x3e5415);})['then'](function(_0x171275){_0x107dca[_0x0c88('0x42')]=_0x171275;return _0x107dca;})[_0x0c88('0x24')](respondWithFilteredResult(_0x103f60,_0x3e5415))[_0x0c88('0x43')](handleError(_0x103f60,null));};exports['show']=function(_0xda4cab,_0x2cb394){var _0x9e5b83={'raw':![],'where':{'id':_0xda4cab[_0x0c88('0x44')]['id']}},_0x2a0c0f={};_0x2a0c0f[_0x0c88('0x31')]=_[_0x0c88('0x33')](db[_0x0c88('0x2c')][_0x0c88('0x2d')]);_0x2a0c0f['query']=_[_0x0c88('0x33')](_0xda4cab[_0x0c88('0x32')]);_0x2a0c0f[_0x0c88('0x34')]=_[_0x0c88('0x35')](_0x2a0c0f[_0x0c88('0x31')],_0x2a0c0f[_0x0c88('0x32')]);_0x9e5b83[_0x0c88('0x36')]=_[_0x0c88('0x35')](_0x2a0c0f[_0x0c88('0x31')],qs[_0x0c88('0x37')](_0xda4cab[_0x0c88('0x32')][_0x0c88('0x37')]));_0x9e5b83['attributes']=_0x9e5b83[_0x0c88('0x36')][_0x0c88('0x38')]?_0x9e5b83[_0x0c88('0x36')]:_0x2a0c0f['model'];if(_0xda4cab[_0x0c88('0x32')][_0x0c88('0x40')]){_0x9e5b83[_0x0c88('0x45')]=[{'all':!![]}];}_0x9e5b83=_[_0x0c88('0x3e')]({},_0x9e5b83,_0xda4cab[_0x0c88('0x3f')]);return db[_0x0c88('0x2c')][_0x0c88('0x46')](_0x9e5b83)[_0x0c88('0x24')](handleEntityNotFound(_0x2cb394,null))['then'](respondWithResult(_0x2cb394,null))[_0x0c88('0x43')](handleError(_0x2cb394,null));};exports[_0x0c88('0x47')]=function(_0x55ce51,_0x415f7b){return db[_0x0c88('0x2c')][_0x0c88('0x47')](_0x55ce51[_0x0c88('0x48')],{})[_0x0c88('0x24')](respondWithResult(_0x415f7b,0xc9))['catch'](handleError(_0x415f7b,null));};exports[_0x0c88('0x49')]=function(_0x56c85b,_0x49704e){return db[_0x0c88('0x2c')][_0x0c88('0x49')](_0x56c85b['body'],{'raw':![],'individualHooks':!![]})[_0x0c88('0x24')](respondWithResult(_0x49704e,0xc9))['catch'](handleError(_0x49704e,null));};exports['update']=function(_0x2c3364,_0x48a8ff){if(_0x2c3364[_0x0c88('0x48')]['id']){delete _0x2c3364[_0x0c88('0x48')]['id'];}return db['AnalyticFieldReport'][_0x0c88('0x46')]({'where':{'id':_0x2c3364['params']['id']}})[_0x0c88('0x24')](handleEntityNotFound(_0x48a8ff,null))['then'](saveUpdates(_0x2c3364[_0x0c88('0x48')],null))['then'](respondWithResult(_0x48a8ff,null))['catch'](handleError(_0x48a8ff,null));};exports[_0x0c88('0x4a')]=function(_0x498e8e,_0x1f3602){return db[_0x0c88('0x2c')]['find']({'where':{'id':_0x498e8e['params']['id']}})[_0x0c88('0x24')](handleEntityNotFound(_0x1f3602,null))[_0x0c88('0x24')](removeEntity(_0x1f3602,null))[_0x0c88('0x43')](handleError(_0x1f3602,null));};exports[_0x0c88('0x4b')]=function(_0x594048,_0x2fcd31){return db[_0x0c88('0x2c')]['destroy']({'where':{'id':_0x594048['query'][_0x0c88('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2fcd31,0xcc))[_0x0c88('0x43')](handleError(_0x2fcd31,null));};exports[_0x0c88('0x4d')]=function(_0x503000,_0x3da207,_0x37b478){return db[_0x0c88('0x4e')][_0x0c88('0x4f')]({'where':{'id':_0x503000[_0x0c88('0x44')]['id']}})[_0x0c88('0x24')](handleEntityNotFound(_0x3da207,null))['then'](function(_0x3ac760){if(_0x3ac760){return db[_0x0c88('0x50')]['transaction'](function(_0x5c8605){return db[_0x0c88('0x2c')]['destroy']({'where':{'CustomReportId':_0x503000['params']['id']},'transaction':_0x5c8605})[_0x0c88('0x24')](function(_0x32258d){var _0x35c97f=_[_0x0c88('0x2b')](_0x503000[_0x0c88('0x48')],function(_0x3fbd3b){delete _0x3fbd3b['id'];_0x3fbd3b[_0x0c88('0x51')]=_0x503000[_0x0c88('0x44')]['id'];return _0x3fbd3b;});return db[_0x0c88('0x2c')][_0x0c88('0x49')](_0x35c97f,{'transaction':_0x5c8605});});})['then'](function(){return db['AnalyticFieldReport'][_0x0c88('0x41')]({'where':{'CustomReportId':_0x503000[_0x0c88('0x44')]['id']}});});}})['then'](respondWithResult(_0x3da207,null))[_0x0c88('0x43')](handleError(_0x3da207,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a13656e..fa608a0 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 _0x3235=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x74b300,_0x1f13c2){var _0x5ae816=function(_0x14b63a){while(--_0x14b63a){_0x74b300['push'](_0x74b300['shift']());}};_0x5ae816(++_0x1f13c2);}(_0x3235,0xc8));var _0x5323=function(_0x298409,_0x44df24){_0x298409=_0x298409-0x0;var _0x191bf1=_0x3235[_0x298409];return _0x191bf1;};'use strict';var _=require(_0x5323('0x0'));var util=require(_0x5323('0x1'));var logger=require(_0x5323('0x2'))(_0x5323('0x3'));var moment=require(_0x5323('0x4'));var BPromise=require(_0x5323('0x5'));var rp=require(_0x5323('0x6'));var fs=require('fs');var path=require(_0x5323('0x7'));var rimraf=require(_0x5323('0x8'));var config=require(_0x5323('0x9'));var attributes=require(_0x5323('0xa'));module[_0x5323('0xb')]=function(_0x3703c6,_0x186ba4){return _0x3703c6[_0x5323('0xc')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd68e=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x46c1e1,_0x4067bd){var _0x21ea17=function(_0x36ca0b){while(--_0x36ca0b){_0x46c1e1['push'](_0x46c1e1['shift']());}};_0x21ea17(++_0x4067bd);}(_0xd68e,0x9d));var _0xed68=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xd68e[_0x5d8631];return _0x34c15e;};'use strict';var _=require(_0xed68('0x0'));var util=require(_0xed68('0x1'));var logger=require(_0xed68('0x2'))(_0xed68('0x3'));var moment=require(_0xed68('0x4'));var BPromise=require(_0xed68('0x5'));var rp=require(_0xed68('0x6'));var fs=require('fs');var path=require(_0xed68('0x7'));var rimraf=require('rimraf');var config=require(_0xed68('0x8'));var attributes=require(_0xed68('0x9'));module[_0xed68('0xa')]=function(_0x3a1708,_0x3b979d){return _0x3a1708[_0xed68('0xb')](_0xed68('0xc'),attributes,{'tableName':_0xed68('0xd'),'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 40788d3..876d946 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 _0x7a44=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a44,0x157));var _0x47a4=function(_0x1ca457,_0x16e557){_0x1ca457=_0x1ca457-0x0;var _0x492788=_0x7a44[_0x1ca457];return _0x492788;};'use strict';var _=require(_0x47a4('0x0'));var util=require(_0x47a4('0x1'));var moment=require(_0x47a4('0x2'));var BPromise=require(_0x47a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x47a4('0x4'));var logger=require(_0x47a4('0x5'))(_0x47a4('0x6'));var config=require(_0x47a4('0x7'));var jayson=require(_0x47a4('0x8'));var client=jayson['client'][_0x47a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56d693,_0x201050,_0x4e2514){return new BPromise(function(_0x67eac,_0x47b291){return client['request'](_0x56d693,_0x4e2514)[_0x47a4('0xa')](function(_0x43e3ae){logger[_0x47a4('0xb')](_0x47a4('0xc'),_0x201050,_0x47a4('0xd'));logger[_0x47a4('0xe')](_0x47a4('0xf'),_0x201050,'request\x20sent',JSON[_0x47a4('0x10')](_0x43e3ae));if(_0x43e3ae['error']){if(_0x43e3ae[_0x47a4('0x11')][_0x47a4('0x12')]===0x1f4){logger['error'](_0x47a4('0xc'),_0x201050,_0x43e3ae[_0x47a4('0x11')][_0x47a4('0x13')]);return _0x47b291(_0x43e3ae[_0x47a4('0x11')]['message']);}logger[_0x47a4('0x11')](_0x47a4('0xc'),_0x201050,_0x43e3ae[_0x47a4('0x11')]['message']);return _0x67eac(_0x43e3ae[_0x47a4('0x11')][_0x47a4('0x13')]);}else{logger[_0x47a4('0xb')](_0x47a4('0xc'),_0x201050,_0x47a4('0xd'));_0x67eac(_0x43e3ae[_0x47a4('0x14')]['message']);}})['catch'](function(_0x4ddf29){logger[_0x47a4('0x11')](_0x47a4('0xc'),_0x201050,_0x4ddf29);_0x47b291(_0x4ddf29);});});} \ No newline at end of file +var _0xa9dd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x28a52e,_0x30f3eb){var _0x13c1f7=function(_0x36f588){while(--_0x36f588){_0x28a52e['push'](_0x28a52e['shift']());}};_0x13c1f7(++_0x30f3eb);}(_0xa9dd,0x14c));var _0xda9d=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xa9dd[_0x3e7e96];return _0x13f6f0;};'use strict';var _=require(_0xda9d('0x0'));var util=require(_0xda9d('0x1'));var moment=require(_0xda9d('0x2'));var BPromise=require('bluebird');var rs=require(_0xda9d('0x3'));var fs=require('fs');var Redis=require(_0xda9d('0x4'));var db=require(_0xda9d('0x5'))['db'];var utils=require(_0xda9d('0x6'));var logger=require(_0xda9d('0x7'))(_0xda9d('0x8'));var config=require('../../config/environment');var jayson=require(_0xda9d('0x9'));var client=jayson['client'][_0xda9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b546a,_0x5e8b2a,_0x3cee91){return new BPromise(function(_0x2a2502,_0x341714){return client[_0xda9d('0xb')](_0x2b546a,_0x3cee91)[_0xda9d('0xc')](function(_0x3036f2){logger[_0xda9d('0xd')](_0xda9d('0xe'),_0x5e8b2a,_0xda9d('0xf'));logger[_0xda9d('0x10')](_0xda9d('0x11'),_0x5e8b2a,_0xda9d('0xf'),JSON[_0xda9d('0x12')](_0x3036f2));if(_0x3036f2[_0xda9d('0x13')]){if(_0x3036f2['error'][_0xda9d('0x14')]===0x1f4){logger[_0xda9d('0x13')](_0xda9d('0xe'),_0x5e8b2a,_0x3036f2[_0xda9d('0x13')][_0xda9d('0x15')]);return _0x341714(_0x3036f2[_0xda9d('0x13')][_0xda9d('0x15')]);}logger['error'](_0xda9d('0xe'),_0x5e8b2a,_0x3036f2[_0xda9d('0x13')]['message']);return _0x2a2502(_0x3036f2[_0xda9d('0x13')][_0xda9d('0x15')]);}else{logger[_0xda9d('0xd')](_0xda9d('0xe'),_0x5e8b2a,_0xda9d('0xf'));_0x2a2502(_0x3036f2[_0xda9d('0x16')]['message']);}})[_0xda9d('0x17')](function(_0xd1b0ea){logger[_0xda9d('0x13')](_0xda9d('0xe'),_0x5e8b2a,_0xd1b0ea);_0x341714(_0xd1b0ea);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c3579a9..9d333e2 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(_0x173af1,_0x535ff4){var _0x44e325=function(_0x49aaa4){while(--_0x49aaa4){_0x173af1['push'](_0x173af1['shift']());}};_0x44e325(++_0x535ff4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x6ac181,_0x4249b9){var _0xdde47=function(_0xf48d8b){while(--_0xf48d8b){_0x6ac181['push'](_0x6ac181['shift']());}};_0xdde47(++_0x4249b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 3e2025a..bc78d8c 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 _0x4899=['sequelize','STRING'];(function(_0x26c8c7,_0x511542){var _0x5cd45c=function(_0x122ad8){while(--_0x122ad8){_0x26c8c7['push'](_0x26c8c7['shift']());}};_0x5cd45c(++_0x511542);}(_0x4899,0x74));var _0x9489=function(_0x1cdc90,_0x3a68ec){_0x1cdc90=_0x1cdc90-0x0;var _0x24f444=_0x4899[_0x1cdc90];return _0x24f444;};'use strict';var Sequelize=require(_0x9489('0x0'));module['exports']={'name':{'type':Sequelize[_0x9489('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x9489('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x9489('0x1')]}}; \ No newline at end of file +var _0x3c1a=['STRING','name','TEXT','sequelize','exports'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0x3c1a,0xda));var _0xa3c1=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x3c1a[_0x23e6bb];return _0x1e3b4c;};'use strict';var Sequelize=require(_0xa3c1('0x0'));module[_0xa3c1('0x1')]={'name':{'type':Sequelize[_0xa3c1('0x2')],'allowNull':![],'unique':_0xa3c1('0x3')},'table':{'type':Sequelize[_0xa3c1('0x2')]},'metric':{'type':Sequelize[_0xa3c1('0x4')]},'description':{'type':Sequelize[_0xa3c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 8582cfc..bac8b2a 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 _0xdbf5=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2338fe,_0x431abc){var _0x40ca9d=function(_0x214abc){while(--_0x214abc){_0x2338fe['push'](_0x2338fe['shift']());}};_0x40ca9d(++_0x431abc);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2e6b66,_0x16b353){_0x2e6b66=_0x2e6b66-0x0;var _0x27c02e=_0xdbf5[_0x2e6b66];return _0x27c02e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){var _0x226b93=_0x2d3e1b[_0x5dbf('0x22')]({'plain':!![]});var _0x20ab1b=_0x5dbf('0x23');return db[_0x5dbf('0x24')][_0x5dbf('0x21')]({'where':{'type':_0x20ab1b,'resourceId':_0x226b93['id']}})[_0x5dbf('0x20')](function(){return _0x2d3e1b;});})[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x25')]();});}};}function handleEntityNotFound(_0x17f135,_0x466985){return function(_0x3f8341){if(!_0x3f8341){_0x17f135[_0x5dbf('0x16')](0x194);}return _0x3f8341;};}function handleError(_0x22ec42,_0x6a9757){_0x6a9757=_0x6a9757||0x1f4;return function(_0x471027){logger[_0x5dbf('0x26')](_0x471027['stack']);if(_0x471027[_0x5dbf('0x27')]){delete _0x471027[_0x5dbf('0x27')];}_0x22ec42[_0x5dbf('0x17')](_0x6a9757)[_0x5dbf('0x28')](_0x471027);};}exports[_0x5dbf('0x29')]=function(_0x6a276d,_0x2a65c5){var _0x31d57a={},_0x406ce6={},_0x273b63={'count':0x0,'rows':[]};var _0x294dd7=_['map'](db['AnalyticMetric'][_0x5dbf('0x2a')],function(_0x19015a){return{'name':_0x19015a[_0x5dbf('0x2b')],'type':_0x19015a[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x406ce6['model']=_['map'](_0x294dd7,_0x5dbf('0x27'));_0x406ce6[_0x5dbf('0x2e')]=_['keys'](_0x6a276d[_0x5dbf('0x2e')]);_0x406ce6[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],_0x406ce6[_0x5dbf('0x2e')]);_0x31d57a['attributes']=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x32')]));_0x31d57a['attributes']=_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x34')]?_0x31d57a[_0x5dbf('0x33')]:_0x406ce6[_0x5dbf('0x31')];if(!_0x6a276d['query'][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x31d57a[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x37')]);_0x31d57a[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x19')]);}_0x31d57a[_0x5dbf('0x38')]=qs['sort'](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x39')]);_0x31d57a[_0x5dbf('0x3a')]=qs['filters'](_[_0x5dbf('0x3b')](_0x6a276d[_0x5dbf('0x2e')],_0x406ce6[_0x5dbf('0x2f')]),_0x294dd7);if(_0x6a276d['query'][_0x5dbf('0x3c')]){_0x31d57a[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x31d57a['where'],{'$or':_[_0x5dbf('0x3e')](_0x294dd7,function(_0x29a62d){if(_0x29a62d[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x10537d={};_0x10537d[_0x29a62d[_0x5dbf('0x27')]]={'$like':'%'+_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x3c')]+'%'};return _0x10537d;}})});}_0x31d57a=_['merge']({},_0x31d57a,_0x6a276d['options']);var _0x57ee72={'where':_0x31d57a['where']};return db[_0x5dbf('0x40')][_0x5dbf('0x1b')](_0x57ee72)['then'](function(_0x3ef0eb){_0x273b63[_0x5dbf('0x1b')]=_0x3ef0eb;if(_0x6a276d['query'][_0x5dbf('0x41')]){_0x31d57a[_0x5dbf('0x42')]=[{'all':!![]}];}return db[_0x5dbf('0x40')][_0x5dbf('0x43')](_0x31d57a);})[_0x5dbf('0x20')](function(_0x7c390d){_0x273b63[_0x5dbf('0x44')]=_0x7c390d;return _0x273b63;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x2a65c5,_0x31d57a))[_0x5dbf('0x45')](handleError(_0x2a65c5,null));};exports[_0x5dbf('0x46')]=function(_0x50ac70,_0x78aef3){var _0x22f958={'raw':!![],'where':{'id':_0x50ac70['params']['id']}},_0xec1d28={};_0xec1d28[_0x5dbf('0x31')]=_[_0x5dbf('0x47')](db[_0x5dbf('0x40')][_0x5dbf('0x2a')]);_0xec1d28['query']=_[_0x5dbf('0x47')](_0x50ac70['query']);_0xec1d28[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0xec1d28[_0x5dbf('0x31')],_0xec1d28[_0x5dbf('0x2e')]);_0x22f958['attributes']=_['intersection'](_0xec1d28[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x50ac70[_0x5dbf('0x2e')]['fields']));_0x22f958[_0x5dbf('0x33')]=_0x22f958['attributes']['length']?_0x22f958['attributes']:_0xec1d28['model'];if(_0x50ac70[_0x5dbf('0x2e')][_0x5dbf('0x41')]){_0x22f958['include']=[{'all':!![]}];}_0x22f958=_[_0x5dbf('0x3d')]({},_0x22f958,_0x50ac70[_0x5dbf('0x48')]);return db['AnalyticMetric'][_0x5dbf('0x49')](_0x22f958)[_0x5dbf('0x20')](handleEntityNotFound(_0x78aef3,null))['then'](respondWithResult(_0x78aef3,null))[_0x5dbf('0x45')](handleError(_0x78aef3,null));};exports['create']=function(_0x5ab862,_0x337897){return db[_0x5dbf('0x40')][_0x5dbf('0x4a')](_0x5ab862['body'],{})['then'](function(_0x442a43){var _0x3e8612=_0x5ab862[_0x5dbf('0x4b')][_0x5dbf('0x22')]({'plain':!![]});if(!_0x3e8612)throw new Error(_0x5dbf('0x4c'));if(_0x3e8612[_0x5dbf('0x4d')]===_0x5dbf('0x4b')){var _0x319906=_0x442a43['get']({'plain':!![]});var _0x3f38a0=_0x5dbf('0x23');return db[_0x5dbf('0x4e')][_0x5dbf('0x49')]({'where':{'name':_0x3f38a0,'userProfileId':_0x3e8612[_0x5dbf('0x4f')]},'raw':!![]})[_0x5dbf('0x20')](function(_0x328dc5){if(_0x328dc5&&_0x328dc5['autoAssociation']===0x0){return db[_0x5dbf('0x24')]['create']({'name':_0x319906[_0x5dbf('0x27')],'resourceId':_0x319906['id'],'type':_0x328dc5[_0x5dbf('0x27')],'sectionId':_0x328dc5['id']},{})[_0x5dbf('0x20')](function(){return _0x442a43;});}else{return _0x442a43;}})[_0x5dbf('0x45')](function(_0x78ab84){logger[_0x5dbf('0x26')](_0x5dbf('0x50'),_0x78ab84);throw _0x78ab84;});}return _0x442a43;})['then'](respondWithResult(_0x337897,0xc9))['catch'](handleError(_0x337897,null));};exports['update']=function(_0x1e1876,_0xfdacc7){if(_0x1e1876[_0x5dbf('0x51')]['id']){delete _0x1e1876['body']['id'];}return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x1e1876[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0xfdacc7,null))['then'](saveUpdates(_0x1e1876[_0x5dbf('0x51')],null))['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0x45')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x21')]=function(_0x2145ea,_0x5da14b){return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x2145ea[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x5da14b,null))[_0x5dbf('0x20')](removeEntity(_0x5da14b,null))['catch'](handleError(_0x5da14b,null));}; \ No newline at end of file +var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x27edb9,_0x48fe4b){var _0xc82084=function(_0x154b36){while(--_0x154b36){_0x27edb9['push'](_0x27edb9['shift']());}};_0xc82084(++_0x48fe4b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x5fc3[_0x7c0074];return _0x13e95b;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 1080c61..abd9a4e 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 _0xbd0a=['analytics_metrics','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x12adcf,_0x4fbf64){_0x12adcf=_0x12adcf-0x0;var _0x495347=_0xbd0a[_0x12adcf];return _0x495347;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var logger=require(_0xabd0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xabd0('0x2'));var fs=require('fs');var path=require(_0xabd0('0x3'));var rimraf=require(_0xabd0('0x4'));var config=require(_0xabd0('0x5'));var attributes=require(_0xabd0('0x6'));module[_0xabd0('0x7')]=function(_0x221368,_0xb41697){return _0x221368[_0xabd0('0x8')]('AnalyticMetric',attributes,{'tableName':_0xabd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cb5=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4cb5,0x8f));var _0x54cb=function(_0xd9098c,_0x154b1c){_0xd9098c=_0xd9098c-0x0;var _0x1ff6f1=_0x4cb5[_0xd9098c];return _0x1ff6f1;};'use strict';var _=require(_0x54cb('0x0'));var util=require(_0x54cb('0x1'));var logger=require(_0x54cb('0x2'))(_0x54cb('0x3'));var moment=require('moment');var BPromise=require(_0x54cb('0x4'));var rp=require(_0x54cb('0x5'));var fs=require('fs');var path=require(_0x54cb('0x6'));var rimraf=require(_0x54cb('0x7'));var config=require(_0x54cb('0x8'));var attributes=require(_0x54cb('0x9'));module[_0x54cb('0xa')]=function(_0x48aed1,_0x44f36d){return _0x48aed1[_0x54cb('0xb')]('AnalyticMetric',attributes,{'tableName':_0x54cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 1b70e02..f5c1296 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 _0x753d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result'];(function(_0x911331,_0x429378){var _0x2d63da=function(_0x13affe){while(--_0x13affe){_0x911331['push'](_0x911331['shift']());}};_0x2d63da(++_0x429378);}(_0x753d,0x1c9));var _0xd753=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x753d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd753('0x0'));var util=require(_0xd753('0x1'));var moment=require(_0xd753('0x2'));var BPromise=require(_0xd753('0x3'));var rs=require(_0xd753('0x4'));var fs=require('fs');var Redis=require(_0xd753('0x5'));var db=require(_0xd753('0x6'))['db'];var utils=require(_0xd753('0x7'));var logger=require(_0xd753('0x8'))(_0xd753('0x9'));var config=require(_0xd753('0xa'));var jayson=require(_0xd753('0xb'));var client=jayson[_0xd753('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51579e,_0x100bfc,_0x41cf5d){return new BPromise(function(_0x4c289e,_0x28493b){return client[_0xd753('0xd')](_0x51579e,_0x41cf5d)[_0xd753('0xe')](function(_0x69053b){logger[_0xd753('0xf')](_0xd753('0x10'),_0x100bfc,'request\x20sent');logger[_0xd753('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x100bfc,_0xd753('0x12'),JSON['stringify'](_0x69053b));if(_0x69053b[_0xd753('0x13')]){if(_0x69053b[_0xd753('0x13')][_0xd753('0x14')]===0x1f4){logger[_0xd753('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x100bfc,_0x69053b[_0xd753('0x13')][_0xd753('0x15')]);return _0x28493b(_0x69053b[_0xd753('0x13')][_0xd753('0x15')]);}logger[_0xd753('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x100bfc,_0x69053b[_0xd753('0x13')][_0xd753('0x15')]);return _0x4c289e(_0x69053b[_0xd753('0x13')][_0xd753('0x15')]);}else{logger[_0xd753('0xf')](_0xd753('0x10'),_0x100bfc,_0xd753('0x12'));_0x4c289e(_0x69053b[_0xd753('0x16')][_0xd753('0x15')]);}})[_0xd753('0x17')](function(_0xcd9fb6){logger['error'](_0xd753('0x10'),_0x100bfc,_0xcd9fb6);_0x28493b(_0xcd9fb6);});});} \ No newline at end of file +var _0xb906=['request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x1d9a25,_0x50665d){var _0x1cc281=function(_0x129ec8){while(--_0x129ec8){_0x1d9a25['push'](_0x1d9a25['shift']());}};_0x1cc281(++_0x50665d);}(_0xb906,0x182));var _0x6b90=function(_0x317e5c,_0x5213a8){_0x317e5c=_0x317e5c-0x0;var _0x3693bb=_0xb906[_0x317e5c];return _0x3693bb;};'use strict';var _=require(_0x6b90('0x0'));var util=require(_0x6b90('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b90('0x3'))['db'];var utils=require(_0x6b90('0x4'));var logger=require('../../config/logger')(_0x6b90('0x5'));var config=require('../../config/environment');var jayson=require(_0x6b90('0x6'));var client=jayson[_0x6b90('0x7')][_0x6b90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27b76c,_0x1ebba4,_0x213d05){return new BPromise(function(_0x176287,_0x55467d){return client[_0x6b90('0x9')](_0x27b76c,_0x213d05)[_0x6b90('0xa')](function(_0xe37a0c){logger[_0x6b90('0xb')](_0x6b90('0xc'),_0x1ebba4,_0x6b90('0xd'));logger['debug'](_0x6b90('0xe'),_0x1ebba4,_0x6b90('0xd'),JSON[_0x6b90('0xf')](_0xe37a0c));if(_0xe37a0c['error']){if(_0xe37a0c[_0x6b90('0x10')]['code']===0x1f4){logger[_0x6b90('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1ebba4,_0xe37a0c['error'][_0x6b90('0x11')]);return _0x55467d(_0xe37a0c['error'][_0x6b90('0x11')]);}logger[_0x6b90('0x10')](_0x6b90('0xc'),_0x1ebba4,_0xe37a0c[_0x6b90('0x10')][_0x6b90('0x11')]);return _0x176287(_0xe37a0c['error'][_0x6b90('0x11')]);}else{logger[_0x6b90('0xb')](_0x6b90('0xc'),_0x1ebba4,'request\x20sent');_0x176287(_0xe37a0c['result'][_0x6b90('0x11')]);}})[_0x6b90('0x12')](function(_0x2f8e72){logger[_0x6b90('0x10')](_0x6b90('0xc'),_0x1ebba4,_0x2f8e72);_0x55467d(_0x2f8e72);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 2c8f161..b1c06d4 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 _0xa992=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util','path'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa992,0x18c));var _0x2a99=function(_0x9e7850,_0x36ec88){_0x9e7850=_0x9e7850-0x0;var _0x1b482e=_0xa992[_0x9e7850];return _0x1b482e;};'use strict';var multer=require(_0x2a99('0x0'));var util=require(_0x2a99('0x1'));var path=require(_0x2a99('0x2'));var timeout=require(_0x2a99('0x3'));var express=require('express');var router=express[_0x2a99('0x4')]();var fs_extra=require(_0x2a99('0x5'));var auth=require(_0x2a99('0x6'));var interaction=require(_0x2a99('0x7'));var config=require(_0x2a99('0x8'));var controller=require(_0x2a99('0x9'));router[_0x2a99('0xa')]('/',auth[_0x2a99('0xb')](),controller[_0x2a99('0xc')]);router[_0x2a99('0xa')]('/:id',auth[_0x2a99('0xb')](),controller[_0x2a99('0xd')]);router[_0x2a99('0xe')]('/',auth[_0x2a99('0xb')](),controller[_0x2a99('0xf')]);router[_0x2a99('0x10')](_0x2a99('0x11'),auth[_0x2a99('0xb')](),controller[_0x2a99('0x12')]);router[_0x2a99('0x13')](_0x2a99('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x2a99('0x14')]=router; \ No newline at end of file +var _0x04f1=['get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','index'];(function(_0x3f6af9,_0x553094){var _0x6cc311=function(_0x11a9a4){while(--_0x11a9a4){_0x3f6af9['push'](_0x3f6af9['shift']());}};_0x6cc311(++_0x553094);}(_0x04f1,0x92));var _0x104f=function(_0x1e221a,_0x1de447){_0x1e221a=_0x1e221a-0x0;var _0x6ba1fe=_0x04f1[_0x1e221a];return _0x6ba1fe;};'use strict';var multer=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var path=require(_0x104f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x104f('0x3')]();var fs_extra=require(_0x104f('0x4'));var auth=require(_0x104f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x104f('0x6')]);router[_0x104f('0x7')](_0x104f('0x8'),auth[_0x104f('0x9')](),controller['show']);router[_0x104f('0xa')]('/',auth[_0x104f('0x9')](),controller[_0x104f('0xb')]);router[_0x104f('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x104f('0xd')]);router[_0x104f('0xe')](_0x104f('0x8'),auth[_0x104f('0x9')](),controller[_0x104f('0xf')]);module[_0x104f('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 6e956d2..bd80aae 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 _0xa190=['TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa190,0xc3));var _0x0a19=function(_0x3ec19a,_0x1c052e){_0x3ec19a=_0x3ec19a-0x0;var _0x4860f8=_0xa190[_0x3ec19a];return _0x4860f8;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x0a19('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xdf01=['TEXT','sequelize'];(function(_0xe6c88a,_0x2c8464){var _0x1c09e8=function(_0x453c4a){while(--_0x453c4a){_0xe6c88a['push'](_0xe6c88a['shift']());}};_0x1c09e8(++_0x2c8464);}(_0xdf01,0xdb));var _0x1df0=function(_0xcd9d04,_0x3d87eb){_0xcd9d04=_0xcd9d04-0x0;var _0x48eeb1=_0xdf01[_0xcd9d04];return _0x48eeb1;};'use strict';var Sequelize=require(_0x1df0('0x0'));module['exports']={'tree':{'type':Sequelize[_0x1df0('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 406f3b3..05ece73 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 _0x278c=['find','eml-format','request-promise','bluebird','mustache','util','path','ejs','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','reject','save','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','keys','intersection','includeAll','create','body','update'];(function(_0x4b0765,_0x4cf05b){var _0x26464a=function(_0x3b55cf){while(--_0x3b55cf){_0x4b0765['push'](_0x4b0765['shift']());}};_0x26464a(++_0x4cf05b);}(_0x278c,0x178));var _0xc278=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x278c[_0x582f72];return _0x4cd5fe;};'use strict';var emlformat=require(_0xc278('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc278('0x1'));var moment=require('moment');var BPromise=require(_0xc278('0x2'));var Mustache=require(_0xc278('0x3'));var util=require(_0xc278('0x4'));var path=require(_0xc278('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc278('0x6'));var fs=require('fs');var fs_extra=require(_0xc278('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc278('0x8'));var deskjs=require(_0xc278('0x9'));var toCsv=require(_0xc278('0xa'));var querystring=require('querystring');var Papa=require(_0xc278('0xb'));var Redis=require(_0xc278('0xc'));var authService=require(_0xc278('0xd'));var qs=require(_0xc278('0xe'));var as=require(_0xc278('0xf'));var hardwareService=require(_0xc278('0x10'));var logger=require(_0xc278('0x11'))(_0xc278('0x12'));var utils=require(_0xc278('0x13'));var config=require(_0xc278('0x14'));var licenseUtil=require(_0xc278('0x15'));var db=require(_0xc278('0x16'))['db'];function respondWithStatusCode(_0x7addb,_0xd62731){_0xd62731=_0xd62731||0xcc;return function(_0x133d11){if(_0x133d11){return _0x7addb[_0xc278('0x17')](_0xd62731);}return _0x7addb[_0xc278('0x18')](_0xd62731)[_0xc278('0x19')]();};}function respondWithResult(_0x2c026c,_0x44eb47){_0x44eb47=_0x44eb47||0xc8;return function(_0x13cb79){if(_0x13cb79){return _0x2c026c['status'](_0x44eb47)['json'](_0x13cb79);}};}function respondWithFilteredResult(_0x1e481a,_0x468f66){return function(_0x1a0f56){if(_0x1a0f56){var _0x307909=typeof _0x468f66['offset']===_0xc278('0x1a')&&typeof _0x468f66[_0xc278('0x1b')]==='undefined';var _0x51a230=_0x1a0f56['count'];var _0x2feaa2=_0x307909?0x0:_0x468f66[_0xc278('0x1c')];var _0xc0325e=_0x307909?_0x1a0f56['count']:_0x468f66[_0xc278('0x1c')]+_0x468f66[_0xc278('0x1b')];var _0x186a91;if(_0xc0325e>=_0x51a230){_0xc0325e=_0x51a230;_0x186a91=0xc8;}else{_0x186a91=0xce;}_0x1e481a[_0xc278('0x18')](_0x186a91);return _0x1e481a[_0xc278('0x1d')](_0xc278('0x1e'),_0x2feaa2+'-'+_0xc0325e+'/'+_0x51a230)[_0xc278('0x1f')](_0x1a0f56);}return null;};}function patchUpdates(_0x22b8de){return function(_0x3cd0f1){try{jsonpatch['apply'](_0x3cd0f1,_0x22b8de,!![]);}catch(_0x1364e9){return BPromise[_0xc278('0x20')](_0x1364e9);}return _0x3cd0f1[_0xc278('0x21')]();};}function saveUpdates(_0x1f86a8,_0x1b32e6){return function(_0x5642a9){if(_0x5642a9){return _0x5642a9['update'](_0x1f86a8)[_0xc278('0x22')](function(_0x31d9df){return _0x31d9df;});}return null;};}function removeEntity(_0x81ff90,_0x399a4c){return function(_0x4e689f){if(_0x4e689f){return _0x4e689f['destroy']()[_0xc278('0x22')](function(){_0x81ff90['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x291795,_0x4a36d){return function(_0xa15cc4){if(!_0xa15cc4){_0x291795[_0xc278('0x17')](0x194);}return _0xa15cc4;};}function handleError(_0x34f5db,_0x1aedfe){_0x1aedfe=_0x1aedfe||0x1f4;return function(_0x570f99){logger[_0xc278('0x23')](_0x570f99[_0xc278('0x24')]);if(_0x570f99['name']){delete _0x570f99[_0xc278('0x25')];}_0x34f5db[_0xc278('0x18')](_0x1aedfe)[_0xc278('0x26')](_0x570f99);};}exports[_0xc278('0x27')]=function(_0x70a6f,_0x1d5477){var _0x197916={},_0x1d82d7={},_0x2ab2ea={'count':0x0,'rows':[]};var _0x2c1e1a=_[_0xc278('0x28')](db[_0xc278('0x29')][_0xc278('0x2a')],function(_0x2b3558){return{'name':_0x2b3558[_0xc278('0x2b')],'type':_0x2b3558[_0xc278('0x2c')][_0xc278('0x2d')]};});_0x1d82d7[_0xc278('0x2e')]=_[_0xc278('0x28')](_0x2c1e1a,_0xc278('0x25'));_0x1d82d7[_0xc278('0x2f')]=_['keys'](_0x70a6f['query']);_0x1d82d7[_0xc278('0x30')]=_['intersection'](_0x1d82d7[_0xc278('0x2e')],_0x1d82d7[_0xc278('0x2f')]);_0x197916[_0xc278('0x31')]=_['intersection'](_0x1d82d7[_0xc278('0x2e')],qs[_0xc278('0x32')](_0x70a6f[_0xc278('0x2f')]['fields']));_0x197916['attributes']=_0x197916[_0xc278('0x31')][_0xc278('0x33')]?_0x197916['attributes']:_0x1d82d7['model'];if(!_0x70a6f[_0xc278('0x2f')][_0xc278('0x34')](_0xc278('0x35'))){_0x197916[_0xc278('0x1b')]=qs[_0xc278('0x1b')](_0x70a6f['query'][_0xc278('0x1b')]);_0x197916[_0xc278('0x1c')]=qs[_0xc278('0x1c')](_0x70a6f['query']['offset']);}_0x197916[_0xc278('0x36')]=qs[_0xc278('0x37')](_0x70a6f[_0xc278('0x2f')][_0xc278('0x37')]);_0x197916['where']=qs['filters'](_[_0xc278('0x38')](_0x70a6f[_0xc278('0x2f')],_0x1d82d7[_0xc278('0x30')]),_0x2c1e1a);if(_0x70a6f[_0xc278('0x2f')][_0xc278('0x39')]){_0x197916[_0xc278('0x3a')]=_[_0xc278('0x3b')](_0x197916['where'],{'$or':_['map'](_0x2c1e1a,function(_0x1430e7){if(_0x1430e7[_0xc278('0x2c')]!==_0xc278('0x3c')){var _0x56f7ee={};_0x56f7ee[_0x1430e7[_0xc278('0x25')]]={'$like':'%'+_0x70a6f[_0xc278('0x2f')][_0xc278('0x39')]+'%'};return _0x56f7ee;}})});}_0x197916=_['merge']({},_0x197916,_0x70a6f[_0xc278('0x3d')]);var _0x39d6c3={'where':_0x197916[_0xc278('0x3a')]};return db[_0xc278('0x29')][_0xc278('0x3e')](_0x39d6c3)[_0xc278('0x22')](function(_0x475236){_0x2ab2ea['count']=_0x475236;if(_0x70a6f[_0xc278('0x2f')]['includeAll']){_0x197916[_0xc278('0x3f')]=[{'all':!![]}];}return db[_0xc278('0x29')][_0xc278('0x40')](_0x197916);})[_0xc278('0x22')](function(_0x2ec931){_0x2ab2ea[_0xc278('0x41')]=_0x2ec931;return _0x2ab2ea;})[_0xc278('0x22')](respondWithFilteredResult(_0x1d5477,_0x197916))[_0xc278('0x42')](handleError(_0x1d5477,null));};exports['show']=function(_0x3edb92,_0x2fab1d){var _0x38bd37={'raw':!![],'where':{'id':_0x3edb92[_0xc278('0x43')]['id']}},_0x33a351={};_0x33a351[_0xc278('0x2e')]=_[_0xc278('0x44')](db[_0xc278('0x29')][_0xc278('0x2a')]);_0x33a351['query']=_[_0xc278('0x44')](_0x3edb92[_0xc278('0x2f')]);_0x33a351[_0xc278('0x30')]=_[_0xc278('0x45')](_0x33a351['model'],_0x33a351[_0xc278('0x2f')]);_0x38bd37[_0xc278('0x31')]=_['intersection'](_0x33a351[_0xc278('0x2e')],qs[_0xc278('0x32')](_0x3edb92[_0xc278('0x2f')][_0xc278('0x32')]));_0x38bd37[_0xc278('0x31')]=_0x38bd37[_0xc278('0x31')]['length']?_0x38bd37['attributes']:_0x33a351[_0xc278('0x2e')];if(_0x3edb92[_0xc278('0x2f')][_0xc278('0x46')]){_0x38bd37[_0xc278('0x3f')]=[{'all':!![]}];}_0x38bd37=_[_0xc278('0x3b')]({},_0x38bd37,_0x3edb92[_0xc278('0x3d')]);return db['AnalyticTreeReport']['find'](_0x38bd37)['then'](handleEntityNotFound(_0x2fab1d,null))[_0xc278('0x22')](respondWithResult(_0x2fab1d,null))['catch'](handleError(_0x2fab1d,null));};exports[_0xc278('0x47')]=function(_0x2c85fe,_0x1a47ef){return db[_0xc278('0x29')][_0xc278('0x47')](_0x2c85fe[_0xc278('0x48')],{})[_0xc278('0x22')](respondWithResult(_0x1a47ef,0xc9))[_0xc278('0x42')](handleError(_0x1a47ef,null));};exports[_0xc278('0x49')]=function(_0x34a1a6,_0x27d1f2){if(_0x34a1a6['body']['id']){delete _0x34a1a6[_0xc278('0x48')]['id'];}return db['AnalyticTreeReport'][_0xc278('0x4a')]({'where':{'id':_0x34a1a6[_0xc278('0x43')]['id']}})[_0xc278('0x22')](handleEntityNotFound(_0x27d1f2,null))[_0xc278('0x22')](saveUpdates(_0x34a1a6[_0xc278('0x48')],null))[_0xc278('0x22')](respondWithResult(_0x27d1f2,null))[_0xc278('0x42')](handleError(_0x27d1f2,null));};exports['destroy']=function(_0x116905,_0x1a46aa){return db[_0xc278('0x29')]['find']({'where':{'id':_0x116905[_0xc278('0x43')]['id']}})[_0xc278('0x22')](handleEntityNotFound(_0x1a46aa,null))[_0xc278('0x22')](removeEntity(_0x1a46aa,null))[_0xc278('0x42')](handleError(_0x1a46aa,null));}; \ No newline at end of file +var _0x8b32=['VIRTUAL','merge','options','includeAll','include','rows','catch','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','send','index','map','AnalyticTreeReport','rawAttributes','type','key','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x26628d,_0x370d44){var _0x4f07e6=function(_0x5864a0){while(--_0x5864a0){_0x26628d['push'](_0x26628d['shift']());}};_0x4f07e6(++_0x370d44);}(_0x8b32,0x19c));var _0x28b3=function(_0x3d4379,_0x1d514c){_0x3d4379=_0x3d4379-0x0;var _0x31dec6=_0x8b32[_0x3d4379];return _0x31dec6;};'use strict';var emlformat=require(_0x28b3('0x0'));var rimraf=require(_0x28b3('0x1'));var zipdir=require(_0x28b3('0x2'));var jsonpatch=require(_0x28b3('0x3'));var rp=require(_0x28b3('0x4'));var moment=require(_0x28b3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x28b3('0x6'));var util=require(_0x28b3('0x7'));var path=require(_0x28b3('0x8'));var sox=require(_0x28b3('0x9'));var csv=require('to-csv');var ejs=require(_0x28b3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28b3('0xb'));var squel=require('squel');var crypto=require(_0x28b3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x28b3('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x28b3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28b3('0xf'));var logger=require(_0x28b3('0x10'))(_0x28b3('0x11'));var utils=require('../../config/utils');var config=require(_0x28b3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x28b3('0x13'))['db'];function respondWithStatusCode(_0x1b8ef3,_0x492f53){_0x492f53=_0x492f53||0xcc;return function(_0x58ba9f){if(_0x58ba9f){return _0x1b8ef3[_0x28b3('0x14')](_0x492f53);}return _0x1b8ef3[_0x28b3('0x15')](_0x492f53)[_0x28b3('0x16')]();};}function respondWithResult(_0x30dd75,_0x521126){_0x521126=_0x521126||0xc8;return function(_0x2a6e37){if(_0x2a6e37){return _0x30dd75['status'](_0x521126)[_0x28b3('0x17')](_0x2a6e37);}};}function respondWithFilteredResult(_0x26c72d,_0x3fcebd){return function(_0x3cabba){if(_0x3cabba){var _0x107d81=typeof _0x3fcebd['offset']===_0x28b3('0x18')&&typeof _0x3fcebd['limit']===_0x28b3('0x18');var _0x2b1070=_0x3cabba[_0x28b3('0x19')];var _0x68c13=_0x107d81?0x0:_0x3fcebd['offset'];var _0x3fc555=_0x107d81?_0x3cabba[_0x28b3('0x19')]:_0x3fcebd[_0x28b3('0x1a')]+_0x3fcebd[_0x28b3('0x1b')];var _0x85a011;if(_0x3fc555>=_0x2b1070){_0x3fc555=_0x2b1070;_0x85a011=0xc8;}else{_0x85a011=0xce;}_0x26c72d[_0x28b3('0x15')](_0x85a011);return _0x26c72d[_0x28b3('0x1c')](_0x28b3('0x1d'),_0x68c13+'-'+_0x3fc555+'/'+_0x2b1070)[_0x28b3('0x17')](_0x3cabba);}return null;};}function patchUpdates(_0x41c051){return function(_0x46f093){try{jsonpatch[_0x28b3('0x1e')](_0x46f093,_0x41c051,!![]);}catch(_0x34fb66){return BPromise[_0x28b3('0x1f')](_0x34fb66);}return _0x46f093[_0x28b3('0x20')]();};}function saveUpdates(_0x4eff95,_0x471a1e){return function(_0x1d8ddd){if(_0x1d8ddd){return _0x1d8ddd['update'](_0x4eff95)[_0x28b3('0x21')](function(_0x5599e6){return _0x5599e6;});}return null;};}function removeEntity(_0x5819ad,_0xae0288){return function(_0xce5438){if(_0xce5438){return _0xce5438[_0x28b3('0x22')]()[_0x28b3('0x21')](function(){_0x5819ad[_0x28b3('0x15')](0xcc)[_0x28b3('0x16')]();});}};}function handleEntityNotFound(_0x21fd95,_0x41d6ad){return function(_0x397296){if(!_0x397296){_0x21fd95['sendStatus'](0x194);}return _0x397296;};}function handleError(_0xf81380,_0x2cdbf9){_0x2cdbf9=_0x2cdbf9||0x1f4;return function(_0x3f56dc){logger['error'](_0x3f56dc['stack']);if(_0x3f56dc['name']){delete _0x3f56dc['name'];}_0xf81380[_0x28b3('0x15')](_0x2cdbf9)[_0x28b3('0x23')](_0x3f56dc);};}exports[_0x28b3('0x24')]=function(_0x3cbdfc,_0x4d750e){var _0x303f73={},_0x24a986={},_0x52821f={'count':0x0,'rows':[]};var _0x2522b4=_[_0x28b3('0x25')](db[_0x28b3('0x26')][_0x28b3('0x27')],function(_0x59ec57){return{'name':_0x59ec57['fieldName'],'type':_0x59ec57[_0x28b3('0x28')][_0x28b3('0x29')]};});_0x24a986['model']=_['map'](_0x2522b4,_0x28b3('0x2a'));_0x24a986['query']=_[_0x28b3('0x2b')](_0x3cbdfc[_0x28b3('0x2c')]);_0x24a986[_0x28b3('0x2d')]=_[_0x28b3('0x2e')](_0x24a986[_0x28b3('0x2f')],_0x24a986[_0x28b3('0x2c')]);_0x303f73['attributes']=_['intersection'](_0x24a986[_0x28b3('0x2f')],qs['fields'](_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x30')]));_0x303f73[_0x28b3('0x31')]=_0x303f73[_0x28b3('0x31')][_0x28b3('0x32')]?_0x303f73[_0x28b3('0x31')]:_0x24a986[_0x28b3('0x2f')];if(!_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x33')]('nolimit')){_0x303f73[_0x28b3('0x1b')]=qs[_0x28b3('0x1b')](_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x1b')]);_0x303f73[_0x28b3('0x1a')]=qs[_0x28b3('0x1a')](_0x3cbdfc['query'][_0x28b3('0x1a')]);}_0x303f73[_0x28b3('0x34')]=qs[_0x28b3('0x35')](_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x35')]);_0x303f73[_0x28b3('0x36')]=qs[_0x28b3('0x2d')](_[_0x28b3('0x37')](_0x3cbdfc[_0x28b3('0x2c')],_0x24a986[_0x28b3('0x2d')]),_0x2522b4);if(_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x38')]){_0x303f73[_0x28b3('0x36')]=_['merge'](_0x303f73[_0x28b3('0x36')],{'$or':_[_0x28b3('0x25')](_0x2522b4,function(_0x1dd468){if(_0x1dd468['type']!==_0x28b3('0x39')){var _0x22bf22={};_0x22bf22[_0x1dd468[_0x28b3('0x2a')]]={'$like':'%'+_0x3cbdfc['query'][_0x28b3('0x38')]+'%'};return _0x22bf22;}})});}_0x303f73=_[_0x28b3('0x3a')]({},_0x303f73,_0x3cbdfc[_0x28b3('0x3b')]);var _0x4fc922={'where':_0x303f73[_0x28b3('0x36')]};return db[_0x28b3('0x26')]['count'](_0x4fc922)[_0x28b3('0x21')](function(_0x38df69){_0x52821f['count']=_0x38df69;if(_0x3cbdfc['query'][_0x28b3('0x3c')]){_0x303f73[_0x28b3('0x3d')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x303f73);})[_0x28b3('0x21')](function(_0x3fcf62){_0x52821f[_0x28b3('0x3e')]=_0x3fcf62;return _0x52821f;})[_0x28b3('0x21')](respondWithFilteredResult(_0x4d750e,_0x303f73))[_0x28b3('0x3f')](handleError(_0x4d750e,null));};exports['show']=function(_0x19a7b9,_0x430257){var _0x536424={'raw':!![],'where':{'id':_0x19a7b9['params']['id']}},_0x3616f0={};_0x3616f0['model']=_[_0x28b3('0x2b')](db[_0x28b3('0x26')]['rawAttributes']);_0x3616f0[_0x28b3('0x2c')]=_[_0x28b3('0x2b')](_0x19a7b9[_0x28b3('0x2c')]);_0x3616f0['filters']=_[_0x28b3('0x2e')](_0x3616f0[_0x28b3('0x2f')],_0x3616f0[_0x28b3('0x2c')]);_0x536424[_0x28b3('0x31')]=_[_0x28b3('0x2e')](_0x3616f0['model'],qs['fields'](_0x19a7b9[_0x28b3('0x2c')][_0x28b3('0x30')]));_0x536424[_0x28b3('0x31')]=_0x536424[_0x28b3('0x31')]['length']?_0x536424[_0x28b3('0x31')]:_0x3616f0[_0x28b3('0x2f')];if(_0x19a7b9['query']['includeAll']){_0x536424['include']=[{'all':!![]}];}_0x536424=_[_0x28b3('0x3a')]({},_0x536424,_0x19a7b9[_0x28b3('0x3b')]);return db['AnalyticTreeReport'][_0x28b3('0x40')](_0x536424)[_0x28b3('0x21')](handleEntityNotFound(_0x430257,null))['then'](respondWithResult(_0x430257,null))[_0x28b3('0x3f')](handleError(_0x430257,null));};exports['create']=function(_0x446d92,_0x317d0c){return db['AnalyticTreeReport']['create'](_0x446d92[_0x28b3('0x41')],{})[_0x28b3('0x21')](respondWithResult(_0x317d0c,0xc9))[_0x28b3('0x3f')](handleError(_0x317d0c,null));};exports['update']=function(_0x27d8d4,_0x5814ab){if(_0x27d8d4[_0x28b3('0x41')]['id']){delete _0x27d8d4['body']['id'];}return db[_0x28b3('0x26')][_0x28b3('0x40')]({'where':{'id':_0x27d8d4['params']['id']}})[_0x28b3('0x21')](handleEntityNotFound(_0x5814ab,null))[_0x28b3('0x21')](saveUpdates(_0x27d8d4['body'],null))[_0x28b3('0x21')](respondWithResult(_0x5814ab,null))[_0x28b3('0x3f')](handleError(_0x5814ab,null));};exports[_0x28b3('0x22')]=function(_0x356783,_0x59ed05){return db[_0x28b3('0x26')]['find']({'where':{'id':_0x356783[_0x28b3('0x42')]['id']}})[_0x28b3('0x21')](handleEntityNotFound(_0x59ed05,null))[_0x28b3('0x21')](removeEntity(_0x59ed05,null))[_0x28b3('0x3f')](handleError(_0x59ed05,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index eee28ce..36fe015 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 _0xbbac=['request-promise','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment'];(function(_0x4fe3a7,_0x3feb48){var _0x4c509b=function(_0x4bdbfd){while(--_0x4bdbfd){_0x4fe3a7['push'](_0x4fe3a7['shift']());}};_0x4c509b(++_0x3feb48);}(_0xbbac,0x1ad));var _0xcbba=function(_0x491c20,_0x3ff510){_0x491c20=_0x491c20-0x0;var _0x22e2a1=_0xbbac[_0x491c20];return _0x22e2a1;};'use strict';var _=require('lodash');var util=require(_0xcbba('0x0'));var logger=require(_0xcbba('0x1'))('api');var moment=require(_0xcbba('0x2'));var BPromise=require('bluebird');var rp=require(_0xcbba('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcbba('0x4'));var attributes=require('./analyticTreeReport.attributes');module[_0xcbba('0x5')]=function(_0x2550c6,_0x4e87bf){return _0x2550c6[_0xcbba('0x6')](_0xcbba('0x7'),attributes,{'tableName':_0xcbba('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x981e=['request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','moment'];(function(_0x5535b6,_0x5193e1){var _0x79cb7d=function(_0x485ac1){while(--_0x485ac1){_0x5535b6['push'](_0x5535b6['shift']());}};_0x79cb7d(++_0x5193e1);}(_0x981e,0xe3));var _0xe981=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x981e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe981('0x0'));var util=require(_0xe981('0x1'));var logger=require(_0xe981('0x2'))('api');var moment=require(_0xe981('0x3'));var BPromise=require('bluebird');var rp=require(_0xe981('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe981('0x5'));var config=require(_0xe981('0x6'));var attributes=require(_0xe981('0x7'));module['exports']=function(_0x3790d0,_0x36942e){return _0x3790d0[_0xe981('0x8')](_0xe981('0x9'),attributes,{'tableName':_0xe981('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 3defc12..b3cc5bf 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5ac8a7,_0x2bd449){var _0x2041e5=function(_0x411224){while(--_0x411224){_0x5ac8a7['push'](_0x5ac8a7['shift']());}};_0x2041e5(++_0x2bd449);}(_0x1261,0x144));var _0x1126=function(_0x5bba11,_0xe514ce){_0x5bba11=_0x5bba11-0x0;var _0xfb4bb1=_0x1261[_0x5bba11];return _0xfb4bb1;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x215c16,_0xa1c92a){var _0x109038=function(_0x325138){while(--_0x325138){_0x215c16['push'](_0x215c16['shift']());}};_0x109038(++_0xa1c92a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xc4aa[_0x465a0c];return _0x1e202e;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 98f7e87..70b6d35 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 _0x414b=['put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x414b,0xe9));var _0xb414=function(_0x7fbdf8,_0x123a28){_0x7fbdf8=_0x7fbdf8-0x0;var _0xc8aa3a=_0x414b[_0x7fbdf8];return _0xc8aa3a;};'use strict';var multer=require(_0xb414('0x0'));var util=require(_0xb414('0x1'));var path=require(_0xb414('0x2'));var timeout=require(_0xb414('0x3'));var express=require('express');var router=express[_0xb414('0x4')]();var fs_extra=require(_0xb414('0x5'));var auth=require(_0xb414('0x6'));var interaction=require(_0xb414('0x7'));var config=require(_0xb414('0x8'));var controller=require('./analyticTreeReport.controller');router[_0xb414('0x9')]('/',auth[_0xb414('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb414('0xb')]);router[_0xb414('0xc')]('/',auth['isAuthenticated'](),controller[_0xb414('0xd')]);router[_0xb414('0xe')]('/:id',auth[_0xb414('0xa')](),controller['update']);router[_0xb414('0xf')](_0xb414('0x10'),auth[_0xb414('0xa')](),controller[_0xb414('0x11')]);module[_0xb414('0x12')]=router; \ No newline at end of file +var _0x7d45=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7d45,0xeb));var _0x57d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7d45[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x57d4('0x0'));var timeout=require(_0x57d4('0x1'));var express=require(_0x57d4('0x2'));var router=express[_0x57d4('0x3')]();var fs_extra=require(_0x57d4('0x4'));var auth=require(_0x57d4('0x5'));var interaction=require(_0x57d4('0x6'));var config=require(_0x57d4('0x7'));var controller=require(_0x57d4('0x8'));router[_0x57d4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x57d4('0x9')](_0x57d4('0xa'),auth[_0x57d4('0xb')](),controller[_0x57d4('0xc')]);router[_0x57d4('0xd')]('/',auth[_0x57d4('0xb')](),controller[_0x57d4('0xe')]);router[_0x57d4('0xf')](_0x57d4('0xa'),auth[_0x57d4('0xb')](),controller[_0x57d4('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x57d4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8726fca..257a166 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 _0x8bdf=['sequelize','exports','STRING'];(function(_0x2ccb91,_0xa2c1b4){var _0x4136ca=function(_0x4326f0){while(--_0x4326f0){_0x2ccb91['push'](_0x2ccb91['shift']());}};_0x4136ca(++_0xa2c1b4);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8bdf[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0xf8bd('0x0'));module[_0xf8bd('0x1')]={'name':{'type':Sequelize[_0xf8bd('0x2')]},'basename':{'type':Sequelize[_0xf8bd('0x2')]},'type':{'type':Sequelize[_0xf8bd('0x2')]}}; \ No newline at end of file +var _0x8743=['exports','STRING','sequelize'];(function(_0x3a36e4,_0x420a62){var _0x3e3628=function(_0x528795){while(--_0x528795){_0x3a36e4['push'](_0x3a36e4['shift']());}};_0x3e3628(++_0x420a62);}(_0x8743,0x7a));var _0x3874=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8743[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x3874('0x0'));module[_0x3874('0x1')]={'name':{'type':Sequelize[_0x3874('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3874('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1c8edc7..0f33c51 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 _0xab6f=['params','rawAttributes','include','find','clone','get','omit','createdAt','updatedAt','body','create','destroy','file','originalname','basename','filename','download','findOne','join','root','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','index','map','Attachment','fieldName','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x18cafc,_0x36c9f7){var _0x4fa9d2=function(_0x2e54f3){while(--_0x2e54f3){_0x18cafc['push'](_0x18cafc['shift']());}};_0x4fa9d2(++_0x36c9f7);}(_0xab6f,0x1ce));var _0xfab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab6f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfab6('0x0'));var zipdir=require(_0xfab6('0x1'));var jsonpatch=require(_0xfab6('0x2'));var rp=require(_0xfab6('0x3'));var moment=require(_0xfab6('0x4'));var BPromise=require(_0xfab6('0x5'));var Mustache=require(_0xfab6('0x6'));var util=require(_0xfab6('0x7'));var path=require(_0xfab6('0x8'));var sox=require('sox');var csv=require(_0xfab6('0x9'));var ejs=require(_0xfab6('0xa'));var fs=require('fs');var fs_extra=require(_0xfab6('0xb'));var _=require(_0xfab6('0xc'));var squel=require(_0xfab6('0xd'));var crypto=require(_0xfab6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfab6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfab6('0x10'));var Papa=require(_0xfab6('0x11'));var Redis=require(_0xfab6('0x12'));var authService=require(_0xfab6('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfab6('0x14'));var logger=require(_0xfab6('0x15'))(_0xfab6('0x16'));var utils=require(_0xfab6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfab6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cb064,_0x24495b){_0x24495b=_0x24495b||0xcc;return function(_0x4bfb44){if(_0x4bfb44){return _0x3cb064[_0xfab6('0x19')](_0x24495b);}return _0x3cb064[_0xfab6('0x1a')](_0x24495b)[_0xfab6('0x1b')]();};}function respondWithResult(_0x547c6e,_0x2213b6){_0x2213b6=_0x2213b6||0xc8;return function(_0x2ef188){if(_0x2ef188){return _0x547c6e[_0xfab6('0x1a')](_0x2213b6)[_0xfab6('0x1c')](_0x2ef188);}};}function respondWithFilteredResult(_0x4b033c,_0xd2be4){return function(_0xc3ebbd){if(_0xc3ebbd){var _0x3562c1=typeof _0xd2be4[_0xfab6('0x1d')]===_0xfab6('0x1e')&&typeof _0xd2be4[_0xfab6('0x1f')]==='undefined';var _0x3c1535=_0xc3ebbd[_0xfab6('0x20')];var _0x352a3e=_0x3562c1?0x0:_0xd2be4[_0xfab6('0x1d')];var _0x3532eb=_0x3562c1?_0xc3ebbd[_0xfab6('0x20')]:_0xd2be4['offset']+_0xd2be4[_0xfab6('0x1f')];var _0x497a9d;if(_0x3532eb>=_0x3c1535){_0x3532eb=_0x3c1535;_0x497a9d=0xc8;}else{_0x497a9d=0xce;}_0x4b033c[_0xfab6('0x1a')](_0x497a9d);return _0x4b033c[_0xfab6('0x21')](_0xfab6('0x22'),_0x352a3e+'-'+_0x3532eb+'/'+_0x3c1535)[_0xfab6('0x1c')](_0xc3ebbd);}return null;};}function patchUpdates(_0x11a71f){return function(_0x500962){try{jsonpatch[_0xfab6('0x23')](_0x500962,_0x11a71f,!![]);}catch(_0x17caca){return BPromise['reject'](_0x17caca);}return _0x500962['save']();};}function saveUpdates(_0x561ba4,_0x2043c4){return function(_0x54ef84){if(_0x54ef84){return _0x54ef84[_0xfab6('0x24')](_0x561ba4)[_0xfab6('0x25')](function(_0x11e41a){return _0x11e41a;});}return null;};}function removeEntity(_0x7210ef,_0xfb6b3e){return function(_0x4ef6ea){if(_0x4ef6ea){return _0x4ef6ea['destroy']()[_0xfab6('0x25')](function(){_0x7210ef[_0xfab6('0x1a')](0xcc)[_0xfab6('0x1b')]();});}};}function handleEntityNotFound(_0x11420c,_0x2c39f5){return function(_0x939ca4){if(!_0x939ca4){_0x11420c[_0xfab6('0x19')](0x194);}return _0x939ca4;};}function handleError(_0x1f6d81,_0x576520){_0x576520=_0x576520||0x1f4;return function(_0x80735a){logger[_0xfab6('0x26')](_0x80735a[_0xfab6('0x27')]);if(_0x80735a[_0xfab6('0x28')]){delete _0x80735a['name'];}_0x1f6d81[_0xfab6('0x1a')](_0x576520)['send'](_0x80735a);};}exports[_0xfab6('0x29')]=function(_0x50f965,_0x4c8656){var _0x3c7515={},_0x57f658={},_0x45d707={'count':0x0,'rows':[]};var _0xdb336f=_[_0xfab6('0x2a')](db[_0xfab6('0x2b')]['rawAttributes'],function(_0x38dab2){return{'name':_0x38dab2[_0xfab6('0x2c')],'type':_0x38dab2['type']['key']};});_0x57f658[_0xfab6('0x2d')]=_[_0xfab6('0x2a')](_0xdb336f,_0xfab6('0x28'));_0x57f658[_0xfab6('0x2e')]=_[_0xfab6('0x2f')](_0x50f965[_0xfab6('0x2e')]);_0x57f658['filters']=_['intersection'](_0x57f658[_0xfab6('0x2d')],_0x57f658['query']);_0x3c7515[_0xfab6('0x30')]=_[_0xfab6('0x31')](_0x57f658[_0xfab6('0x2d')],qs['fields'](_0x50f965[_0xfab6('0x2e')][_0xfab6('0x32')]));_0x3c7515[_0xfab6('0x30')]=_0x3c7515[_0xfab6('0x30')][_0xfab6('0x33')]?_0x3c7515[_0xfab6('0x30')]:_0x57f658[_0xfab6('0x2d')];if(!_0x50f965['query']['hasOwnProperty'](_0xfab6('0x34'))){_0x3c7515[_0xfab6('0x1f')]=qs[_0xfab6('0x1f')](_0x50f965['query']['limit']);_0x3c7515['offset']=qs[_0xfab6('0x1d')](_0x50f965[_0xfab6('0x2e')][_0xfab6('0x1d')]);}_0x3c7515[_0xfab6('0x35')]=qs[_0xfab6('0x36')](_0x50f965[_0xfab6('0x2e')][_0xfab6('0x36')]);_0x3c7515['where']=qs[_0xfab6('0x37')](_['pick'](_0x50f965[_0xfab6('0x2e')],_0x57f658[_0xfab6('0x37')]),_0xdb336f);if(_0x50f965[_0xfab6('0x2e')][_0xfab6('0x38')]){_0x3c7515[_0xfab6('0x39')]=_[_0xfab6('0x3a')](_0x3c7515[_0xfab6('0x39')],{'$or':_[_0xfab6('0x2a')](_0xdb336f,function(_0x1eae37){if(_0x1eae37[_0xfab6('0x3b')]!==_0xfab6('0x3c')){var _0x16f792={};_0x16f792[_0x1eae37[_0xfab6('0x28')]]={'$like':'%'+_0x50f965[_0xfab6('0x2e')][_0xfab6('0x38')]+'%'};return _0x16f792;}})});}_0x3c7515=_[_0xfab6('0x3a')]({},_0x3c7515,_0x50f965[_0xfab6('0x3d')]);var _0x1b5e42={'where':_0x3c7515[_0xfab6('0x39')]};return db[_0xfab6('0x2b')][_0xfab6('0x20')](_0x1b5e42)[_0xfab6('0x25')](function(_0x4382b2){_0x45d707[_0xfab6('0x20')]=_0x4382b2;if(_0x50f965[_0xfab6('0x2e')][_0xfab6('0x3e')]){_0x3c7515['include']=[{'all':!![]}];}return db['Attachment'][_0xfab6('0x3f')](_0x3c7515);})[_0xfab6('0x25')](function(_0xbf8eb4){_0x45d707[_0xfab6('0x40')]=_0xbf8eb4;return _0x45d707;})[_0xfab6('0x25')](respondWithFilteredResult(_0x4c8656,_0x3c7515))[_0xfab6('0x41')](handleError(_0x4c8656,null));};exports['show']=function(_0x1ce884,_0x29036e){var _0x57c447={'raw':!![],'where':{'id':_0x1ce884[_0xfab6('0x42')]['id']}},_0x15967b={};_0x15967b[_0xfab6('0x2d')]=_[_0xfab6('0x2f')](db[_0xfab6('0x2b')][_0xfab6('0x43')]);_0x15967b['query']=_[_0xfab6('0x2f')](_0x1ce884[_0xfab6('0x2e')]);_0x15967b[_0xfab6('0x37')]=_[_0xfab6('0x31')](_0x15967b[_0xfab6('0x2d')],_0x15967b[_0xfab6('0x2e')]);_0x57c447['attributes']=_[_0xfab6('0x31')](_0x15967b[_0xfab6('0x2d')],qs[_0xfab6('0x32')](_0x1ce884[_0xfab6('0x2e')][_0xfab6('0x32')]));_0x57c447[_0xfab6('0x30')]=_0x57c447['attributes'][_0xfab6('0x33')]?_0x57c447['attributes']:_0x15967b[_0xfab6('0x2d')];if(_0x1ce884[_0xfab6('0x2e')][_0xfab6('0x3e')]){_0x57c447[_0xfab6('0x44')]=[{'all':!![]}];}_0x57c447=_[_0xfab6('0x3a')]({},_0x57c447,_0x1ce884[_0xfab6('0x3d')]);return db['Attachment'][_0xfab6('0x45')](_0x57c447)[_0xfab6('0x25')](handleEntityNotFound(_0x29036e,null))['then'](respondWithResult(_0x29036e,null))[_0xfab6('0x41')](handleError(_0x29036e,null));};exports[_0xfab6('0x46')]=function(_0x3e93ca,_0x261706){var _0x35ee65={'where':{'id':_0x3e93ca[_0xfab6('0x42')]['id']}},_0xc2e137={};_0xc2e137[_0xfab6('0x2d')]=_[_0xfab6('0x2f')](db[_0xfab6('0x2b')][_0xfab6('0x43')]);_0x35ee65['attributes']=_['intersection'](_0xc2e137['model'],qs['fields'](_0x3e93ca[_0xfab6('0x2e')]['fields']));_0x35ee65[_0xfab6('0x30')]=_0x35ee65[_0xfab6('0x30')][_0xfab6('0x33')]?_0x35ee65['attributes']:_0xc2e137[_0xfab6('0x2d')];if(_0x3e93ca[_0xfab6('0x2e')][_0xfab6('0x3e')]){_0x35ee65[_0xfab6('0x44')]=[{'all':!![]}];}_0x35ee65=_[_0xfab6('0x3a')]({},_0x35ee65,_0x3e93ca[_0xfab6('0x3d')]);return db[_0xfab6('0x2b')][_0xfab6('0x45')](_0x35ee65)['then'](handleEntityNotFound(_0x261706,null))[_0xfab6('0x25')](function(_0x54b2bb){if(_0x54b2bb){var _0x59baf0=_0x54b2bb[_0xfab6('0x47')]({'plain':!![]});_0x59baf0=qs[_0xfab6('0x48')](_0x59baf0,['id',_0xfab6('0x49'),_0xfab6('0x4a')]);_0x3e93ca[_0xfab6('0x4b')]=_['omit'](_0x3e93ca['body'],['id',_0xfab6('0x49'),_0xfab6('0x4a')]);return db['Attachment'][_0xfab6('0x4c')](_[_0xfab6('0x3a')](_0x59baf0,_0x3e93ca[_0xfab6('0x4b')]),{'include':_0x3e93ca[_0xfab6('0x2e')][_0xfab6('0x3e')]?[{'all':!![]}]:undefined});}})[_0xfab6('0x25')](respondWithResult(_0x261706,0xc9))[_0xfab6('0x41')](handleError(_0x261706,null));};exports[_0xfab6('0x24')]=function(_0xefd31e,_0x3426b0){if(_0xefd31e['body']['id']){delete _0xefd31e[_0xfab6('0x4b')]['id'];}return db[_0xfab6('0x2b')][_0xfab6('0x45')]({'where':{'id':_0xefd31e[_0xfab6('0x42')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x3426b0,null))[_0xfab6('0x25')](saveUpdates(_0xefd31e[_0xfab6('0x4b')],null))[_0xfab6('0x25')](respondWithResult(_0x3426b0,null))['catch'](handleError(_0x3426b0,null));};exports[_0xfab6('0x4d')]=function(_0x55d393,_0x517e28){return db[_0xfab6('0x2b')][_0xfab6('0x45')]({'where':{'id':_0x55d393[_0xfab6('0x42')]['id']}})[_0xfab6('0x25')](handleEntityNotFound(_0x517e28,null))['then'](removeEntity(_0x517e28,null))[_0xfab6('0x41')](handleError(_0x517e28,null));};exports[_0xfab6('0x4c')]=function(_0x598c37,_0x2cb006,_0x22f0fb){_0x598c37['body']['name']=_0x598c37[_0xfab6('0x4e')][_0xfab6('0x4f')];_0x598c37[_0xfab6('0x4b')][_0xfab6('0x50')]=_0x598c37[_0xfab6('0x4e')][_0xfab6('0x51')];_0x598c37[_0xfab6('0x4b')]['type']=_0x598c37[_0xfab6('0x4e')]['mimetype'];return db[_0xfab6('0x2b')][_0xfab6('0x4c')](_0x598c37[_0xfab6('0x4b')])[_0xfab6('0x25')](respondWithResult(_0x2cb006,0xc9))[_0xfab6('0x41')](handleError(_0x2cb006,null));};exports[_0xfab6('0x52')]=function(_0x817606,_0x8e7056,_0x59717a){return db[_0xfab6('0x2b')][_0xfab6('0x53')]({'where':{'id':_0x817606['params']['id']},'raw':!![]})[_0xfab6('0x25')](handleEntityNotFound(_0x8e7056,null))[_0xfab6('0x25')](function(_0x33c302){if(_0x33c302){var _0x44dfe8=_0x33c302['ChatOfflineMessageId']!==null;var _0x3c937d=path[_0xfab6('0x54')](config[_0xfab6('0x55')],_0xfab6('0x56'));if(_0x44dfe8){_0x3c937d=path[_0xfab6('0x54')](_0x3c937d,_0xfab6('0x57'));}var _0x2ef3e0=path['join'](_0x3c937d,_0x33c302[_0xfab6('0x50')]);return _0x8e7056['download'](_0x2ef3e0);}})[_0xfab6('0x41')](handleError(_0x8e7056,null));}; \ No newline at end of file +var _0x052e=['findAll','catch','show','params','find','clone','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','download','ChatOfflineMessageId','join','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','Attachment','includeAll','include'];(function(_0x5d00ee,_0x17acee){var _0x2c4d97=function(_0x195592){while(--_0x195592){_0x5d00ee['push'](_0x5d00ee['shift']());}};_0x2c4d97(++_0x17acee);}(_0x052e,0x157));var _0xe052=function(_0x50e2d4,_0x5df027){_0x50e2d4=_0x50e2d4-0x0;var _0x27033c=_0x052e[_0x50e2d4];return _0x27033c;};'use strict';var emlformat=require(_0xe052('0x0'));var rimraf=require(_0xe052('0x1'));var zipdir=require(_0xe052('0x2'));var jsonpatch=require(_0xe052('0x3'));var rp=require(_0xe052('0x4'));var moment=require(_0xe052('0x5'));var BPromise=require(_0xe052('0x6'));var Mustache=require(_0xe052('0x7'));var util=require('util');var path=require(_0xe052('0x8'));var sox=require(_0xe052('0x9'));var csv=require(_0xe052('0xa'));var ejs=require(_0xe052('0xb'));var fs=require('fs');var fs_extra=require(_0xe052('0xc'));var _=require(_0xe052('0xd'));var squel=require(_0xe052('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe052('0xa'));var querystring=require(_0xe052('0xf'));var Papa=require(_0xe052('0x10'));var Redis=require(_0xe052('0x11'));var authService=require(_0xe052('0x12'));var qs=require(_0xe052('0x13'));var as=require(_0xe052('0x14'));var hardwareService=require(_0xe052('0x15'));var logger=require('../../config/logger')(_0xe052('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe052('0x17'))['db'];function respondWithStatusCode(_0x29c75c,_0xe24774){_0xe24774=_0xe24774||0xcc;return function(_0x2ec527){if(_0x2ec527){return _0x29c75c[_0xe052('0x18')](_0xe24774);}return _0x29c75c[_0xe052('0x19')](_0xe24774)[_0xe052('0x1a')]();};}function respondWithResult(_0xcbbed4,_0xa981e3){_0xa981e3=_0xa981e3||0xc8;return function(_0x5ea1e5){if(_0x5ea1e5){return _0xcbbed4['status'](_0xa981e3)[_0xe052('0x1b')](_0x5ea1e5);}};}function respondWithFilteredResult(_0x37f1e3,_0x1bcc49){return function(_0x1796c9){if(_0x1796c9){var _0x123845=typeof _0x1bcc49['offset']===_0xe052('0x1c')&&typeof _0x1bcc49[_0xe052('0x1d')]==='undefined';var _0xba1752=_0x1796c9[_0xe052('0x1e')];var _0x491063=_0x123845?0x0:_0x1bcc49[_0xe052('0x1f')];var _0x318e38=_0x123845?_0x1796c9['count']:_0x1bcc49[_0xe052('0x1f')]+_0x1bcc49[_0xe052('0x1d')];var _0x821c69;if(_0x318e38>=_0xba1752){_0x318e38=_0xba1752;_0x821c69=0xc8;}else{_0x821c69=0xce;}_0x37f1e3['status'](_0x821c69);return _0x37f1e3['set'](_0xe052('0x20'),_0x491063+'-'+_0x318e38+'/'+_0xba1752)[_0xe052('0x1b')](_0x1796c9);}return null;};}function patchUpdates(_0x4161e4){return function(_0xf9cc75){try{jsonpatch[_0xe052('0x21')](_0xf9cc75,_0x4161e4,!![]);}catch(_0x4a4e30){return BPromise['reject'](_0x4a4e30);}return _0xf9cc75['save']();};}function saveUpdates(_0x43b7af,_0x27d152){return function(_0x1e8b5f){if(_0x1e8b5f){return _0x1e8b5f[_0xe052('0x22')](_0x43b7af)[_0xe052('0x23')](function(_0x1358cd){return _0x1358cd;});}return null;};}function removeEntity(_0x50e2fc,_0x31a200){return function(_0x484ec2){if(_0x484ec2){return _0x484ec2[_0xe052('0x24')]()[_0xe052('0x23')](function(){_0x50e2fc[_0xe052('0x19')](0xcc)[_0xe052('0x1a')]();});}};}function handleEntityNotFound(_0x35217c,_0x49ff64){return function(_0x347ed7){if(!_0x347ed7){_0x35217c[_0xe052('0x18')](0x194);}return _0x347ed7;};}function handleError(_0x3d765e,_0x238325){_0x238325=_0x238325||0x1f4;return function(_0x2c53e6){logger[_0xe052('0x25')](_0x2c53e6[_0xe052('0x26')]);if(_0x2c53e6[_0xe052('0x27')]){delete _0x2c53e6[_0xe052('0x27')];}_0x3d765e['status'](_0x238325)[_0xe052('0x28')](_0x2c53e6);};}exports['index']=function(_0x21519a,_0x491ef7){var _0x544b5a={},_0x16fbb5={},_0x34fe77={'count':0x0,'rows':[]};var _0x520e56=_[_0xe052('0x29')](db['Attachment'][_0xe052('0x2a')],function(_0x41e69f){return{'name':_0x41e69f[_0xe052('0x2b')],'type':_0x41e69f[_0xe052('0x2c')]['key']};});_0x16fbb5[_0xe052('0x2d')]=_[_0xe052('0x29')](_0x520e56,_0xe052('0x27'));_0x16fbb5[_0xe052('0x2e')]=_[_0xe052('0x2f')](_0x21519a['query']);_0x16fbb5[_0xe052('0x30')]=_[_0xe052('0x31')](_0x16fbb5['model'],_0x16fbb5[_0xe052('0x2e')]);_0x544b5a[_0xe052('0x32')]=_[_0xe052('0x31')](_0x16fbb5[_0xe052('0x2d')],qs[_0xe052('0x33')](_0x21519a[_0xe052('0x2e')][_0xe052('0x33')]));_0x544b5a[_0xe052('0x32')]=_0x544b5a['attributes'][_0xe052('0x34')]?_0x544b5a[_0xe052('0x32')]:_0x16fbb5[_0xe052('0x2d')];if(!_0x21519a[_0xe052('0x2e')]['hasOwnProperty']('nolimit')){_0x544b5a[_0xe052('0x1d')]=qs['limit'](_0x21519a['query'][_0xe052('0x1d')]);_0x544b5a[_0xe052('0x1f')]=qs['offset'](_0x21519a['query'][_0xe052('0x1f')]);}_0x544b5a[_0xe052('0x35')]=qs[_0xe052('0x36')](_0x21519a[_0xe052('0x2e')][_0xe052('0x36')]);_0x544b5a[_0xe052('0x37')]=qs[_0xe052('0x30')](_['pick'](_0x21519a[_0xe052('0x2e')],_0x16fbb5[_0xe052('0x30')]),_0x520e56);if(_0x21519a[_0xe052('0x2e')][_0xe052('0x38')]){_0x544b5a['where']=_[_0xe052('0x39')](_0x544b5a[_0xe052('0x37')],{'$or':_[_0xe052('0x29')](_0x520e56,function(_0x1220ad){if(_0x1220ad['type']!=='VIRTUAL'){var _0x383c21={};_0x383c21[_0x1220ad[_0xe052('0x27')]]={'$like':'%'+_0x21519a[_0xe052('0x2e')][_0xe052('0x38')]+'%'};return _0x383c21;}})});}_0x544b5a=_[_0xe052('0x39')]({},_0x544b5a,_0x21519a[_0xe052('0x3a')]);var _0x143345={'where':_0x544b5a['where']};return db[_0xe052('0x3b')][_0xe052('0x1e')](_0x143345)['then'](function(_0x4ff158){_0x34fe77[_0xe052('0x1e')]=_0x4ff158;if(_0x21519a[_0xe052('0x2e')][_0xe052('0x3c')]){_0x544b5a[_0xe052('0x3d')]=[{'all':!![]}];}return db[_0xe052('0x3b')][_0xe052('0x3e')](_0x544b5a);})['then'](function(_0xdce2c7){_0x34fe77['rows']=_0xdce2c7;return _0x34fe77;})[_0xe052('0x23')](respondWithFilteredResult(_0x491ef7,_0x544b5a))[_0xe052('0x3f')](handleError(_0x491ef7,null));};exports[_0xe052('0x40')]=function(_0x447cd1,_0x116b58){var _0x56607a={'raw':!![],'where':{'id':_0x447cd1[_0xe052('0x41')]['id']}},_0x4dcbc7={};_0x4dcbc7['model']=_[_0xe052('0x2f')](db[_0xe052('0x3b')][_0xe052('0x2a')]);_0x4dcbc7['query']=_['keys'](_0x447cd1[_0xe052('0x2e')]);_0x4dcbc7[_0xe052('0x30')]=_['intersection'](_0x4dcbc7[_0xe052('0x2d')],_0x4dcbc7[_0xe052('0x2e')]);_0x56607a[_0xe052('0x32')]=_[_0xe052('0x31')](_0x4dcbc7[_0xe052('0x2d')],qs[_0xe052('0x33')](_0x447cd1['query'][_0xe052('0x33')]));_0x56607a[_0xe052('0x32')]=_0x56607a[_0xe052('0x32')][_0xe052('0x34')]?_0x56607a['attributes']:_0x4dcbc7[_0xe052('0x2d')];if(_0x447cd1[_0xe052('0x2e')]['includeAll']){_0x56607a[_0xe052('0x3d')]=[{'all':!![]}];}_0x56607a=_[_0xe052('0x39')]({},_0x56607a,_0x447cd1['options']);return db['Attachment'][_0xe052('0x42')](_0x56607a)[_0xe052('0x23')](handleEntityNotFound(_0x116b58,null))['then'](respondWithResult(_0x116b58,null))[_0xe052('0x3f')](handleError(_0x116b58,null));};exports[_0xe052('0x43')]=function(_0x2dfc37,_0x1ee9b2){var _0x320c2f={'where':{'id':_0x2dfc37[_0xe052('0x41')]['id']}},_0x2564f7={};_0x2564f7[_0xe052('0x2d')]=_[_0xe052('0x2f')](db[_0xe052('0x3b')][_0xe052('0x2a')]);_0x320c2f[_0xe052('0x32')]=_[_0xe052('0x31')](_0x2564f7[_0xe052('0x2d')],qs[_0xe052('0x33')](_0x2dfc37[_0xe052('0x2e')][_0xe052('0x33')]));_0x320c2f[_0xe052('0x32')]=_0x320c2f[_0xe052('0x32')][_0xe052('0x34')]?_0x320c2f[_0xe052('0x32')]:_0x2564f7[_0xe052('0x2d')];if(_0x2dfc37[_0xe052('0x2e')][_0xe052('0x3c')]){_0x320c2f[_0xe052('0x3d')]=[{'all':!![]}];}_0x320c2f=_['merge']({},_0x320c2f,_0x2dfc37[_0xe052('0x3a')]);return db[_0xe052('0x3b')][_0xe052('0x42')](_0x320c2f)[_0xe052('0x23')](handleEntityNotFound(_0x1ee9b2,null))[_0xe052('0x23')](function(_0x44c4d9){if(_0x44c4d9){var _0x4fdffd=_0x44c4d9['get']({'plain':!![]});_0x4fdffd=qs[_0xe052('0x44')](_0x4fdffd,['id',_0xe052('0x45'),_0xe052('0x46')]);_0x2dfc37['body']=_['omit'](_0x2dfc37[_0xe052('0x47')],['id',_0xe052('0x45'),_0xe052('0x46')]);return db[_0xe052('0x3b')][_0xe052('0x48')](_[_0xe052('0x39')](_0x4fdffd,_0x2dfc37[_0xe052('0x47')]),{'include':_0x2dfc37[_0xe052('0x2e')][_0xe052('0x3c')]?[{'all':!![]}]:undefined});}})[_0xe052('0x23')](respondWithResult(_0x1ee9b2,0xc9))[_0xe052('0x3f')](handleError(_0x1ee9b2,null));};exports['update']=function(_0x2f12eb,_0x1a9f38){if(_0x2f12eb[_0xe052('0x47')]['id']){delete _0x2f12eb[_0xe052('0x47')]['id'];}return db[_0xe052('0x3b')][_0xe052('0x42')]({'where':{'id':_0x2f12eb['params']['id']}})[_0xe052('0x23')](handleEntityNotFound(_0x1a9f38,null))[_0xe052('0x23')](saveUpdates(_0x2f12eb['body'],null))['then'](respondWithResult(_0x1a9f38,null))[_0xe052('0x3f')](handleError(_0x1a9f38,null));};exports[_0xe052('0x24')]=function(_0x2531ef,_0x3cdb9b){return db[_0xe052('0x3b')][_0xe052('0x42')]({'where':{'id':_0x2531ef[_0xe052('0x41')]['id']}})[_0xe052('0x23')](handleEntityNotFound(_0x3cdb9b,null))[_0xe052('0x23')](removeEntity(_0x3cdb9b,null))[_0xe052('0x3f')](handleError(_0x3cdb9b,null));};exports[_0xe052('0x48')]=function(_0x27f6aa,_0x4872d6,_0xa44273){_0x27f6aa[_0xe052('0x47')]['name']=_0x27f6aa[_0xe052('0x49')][_0xe052('0x4a')];_0x27f6aa[_0xe052('0x47')][_0xe052('0x4b')]=_0x27f6aa[_0xe052('0x49')]['filename'];_0x27f6aa[_0xe052('0x47')][_0xe052('0x2c')]=_0x27f6aa[_0xe052('0x49')][_0xe052('0x4c')];return db[_0xe052('0x3b')][_0xe052('0x48')](_0x27f6aa[_0xe052('0x47')])[_0xe052('0x23')](respondWithResult(_0x4872d6,0xc9))[_0xe052('0x3f')](handleError(_0x4872d6,null));};exports[_0xe052('0x4d')]=function(_0x519cd7,_0x105a0f,_0x482287){return db[_0xe052('0x3b')]['findOne']({'where':{'id':_0x519cd7['params']['id']},'raw':!![]})[_0xe052('0x23')](handleEntityNotFound(_0x105a0f,null))[_0xe052('0x23')](function(_0x230016){if(_0x230016){var _0x186543=_0x230016[_0xe052('0x4e')]!==null;var _0x30d7c4=path[_0xe052('0x4f')](config['root'],_0xe052('0x50'));if(_0x186543){_0x30d7c4=path[_0xe052('0x4f')](_0x30d7c4,'offline-chat/');}var _0xd503c7=path[_0xe052('0x4f')](_0x30d7c4,_0x230016[_0xe052('0x4b')]);return _0x105a0f[_0xe052('0x4d')](_0xd503c7);}})[_0xe052('0x3f')](handleError(_0x105a0f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5e877d0..072f99c 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 _0x37a4=['Attachment','attachments','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./attachment.attributes','define'];(function(_0x4f1618,_0x23340c){var _0xb80243=function(_0x15d8b7){while(--_0x15d8b7){_0x4f1618['push'](_0x4f1618['shift']());}};_0xb80243(++_0x23340c);}(_0x37a4,0x14c));var _0x437a=function(_0x38e50e,_0x19af56){_0x38e50e=_0x38e50e-0x0;var _0x1da741=_0x37a4[_0x38e50e];return _0x1da741;};'use strict';var _=require(_0x437a('0x0'));var util=require(_0x437a('0x1'));var logger=require(_0x437a('0x2'))('api');var moment=require(_0x437a('0x3'));var BPromise=require(_0x437a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x437a('0x5'));var config=require(_0x437a('0x6'));var attributes=require(_0x437a('0x7'));module['exports']=function(_0x28f203,_0x12a6fd){return _0x28f203[_0x437a('0x8')](_0x437a('0x9'),attributes,{'tableName':_0x437a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f62=['define','attachments','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x4f383a,_0x23e2db){var _0x2c30b1=function(_0x219098){while(--_0x219098){_0x4f383a['push'](_0x4f383a['shift']());}};_0x2c30b1(++_0x23e2db);}(_0x2f62,0x66));var _0x22f6=function(_0x32a981,_0x19b64e){_0x32a981=_0x32a981-0x0;var _0x1a48ff=_0x2f62[_0x32a981];return _0x1a48ff;};'use strict';var _=require(_0x22f6('0x0'));var util=require('util');var logger=require(_0x22f6('0x1'))(_0x22f6('0x2'));var moment=require('moment');var BPromise=require(_0x22f6('0x3'));var rp=require(_0x22f6('0x4'));var fs=require('fs');var path=require(_0x22f6('0x5'));var rimraf=require('rimraf');var config=require(_0x22f6('0x6'));var attributes=require('./attachment.attributes');module[_0x22f6('0x7')]=function(_0x421544,_0x2dcdb4){return _0x421544[_0x22f6('0x8')]('Attachment',attributes,{'tableName':_0x22f6('0x9'),'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 a5c6f8f..efafcff 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 _0x407f=['rpc','../../config/environment','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateAttachment','Attachment','create','body','options','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x531e45,_0x409428){var _0x5ec65c=function(_0x1f02ab){while(--_0x1f02ab){_0x531e45['push'](_0x531e45['shift']());}};_0x5ec65c(++_0x409428);}(_0x407f,0xc2));var _0xf407=function(_0xe166e1,_0x4becb1){_0xe166e1=_0xe166e1-0x0;var _0x1b66f2=_0x407f[_0xe166e1];return _0x1b66f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf407('0x0'));var rs=require(_0xf407('0x1'));var fs=require('fs');var Redis=require(_0xf407('0x2'));var db=require(_0xf407('0x3'))['db'];var utils=require(_0xf407('0x4'));var logger=require(_0xf407('0x5'))(_0xf407('0x6'));var config=require(_0xf407('0x7'));var jayson=require(_0xf407('0x8'));var client=jayson[_0xf407('0x9')][_0xf407('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bce9d,_0x2d4ec6,_0x3ac774){return new BPromise(function(_0x38ee37,_0x3ab539){return client['request'](_0x2bce9d,_0x3ac774)[_0xf407('0xb')](function(_0xc3473a){logger[_0xf407('0xc')](_0xf407('0xd'),_0x2d4ec6,'request\x20sent');logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x2d4ec6,_0xf407('0xe'),JSON[_0xf407('0xf')](_0xc3473a));if(_0xc3473a[_0xf407('0x10')]){if(_0xc3473a[_0xf407('0x10')][_0xf407('0x11')]===0x1f4){logger['error'](_0xf407('0xd'),_0x2d4ec6,_0xc3473a[_0xf407('0x10')][_0xf407('0x12')]);return _0x3ab539(_0xc3473a[_0xf407('0x10')][_0xf407('0x12')]);}logger[_0xf407('0x10')](_0xf407('0xd'),_0x2d4ec6,_0xc3473a[_0xf407('0x10')]['message']);return _0x38ee37(_0xc3473a['error'][_0xf407('0x12')]);}else{logger['info'](_0xf407('0xd'),_0x2d4ec6,'request\x20sent');_0x38ee37(_0xc3473a['result'][_0xf407('0x12')]);}})[_0xf407('0x13')](function(_0x1cdc81){logger[_0xf407('0x10')](_0xf407('0xd'),_0x2d4ec6,_0x1cdc81);_0x3ab539(_0x1cdc81);});});}exports[_0xf407('0x14')]=function(_0x4ddbe6){var _0x2e346f=this;return new Promise(function(_0x588fe4,_0x128faf){return db[_0xf407('0x15')][_0xf407('0x16')](_0x4ddbe6[_0xf407('0x17')],{'raw':_0x4ddbe6[_0xf407('0x18')]?_0x4ddbe6[_0xf407('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf407('0xb')](function(_0x39febd){logger[_0xf407('0xc')](_0xf407('0x14'),_0x4ddbe6);logger['debug'](_0xf407('0x14'),_0x4ddbe6,JSON[_0xf407('0xf')](_0x39febd));_0x588fe4(_0x39febd);})[_0xf407('0x13')](function(_0xa6f11e){logger['error']('CreateAttachment',_0xa6f11e[_0xf407('0x12')],_0x4ddbe6);_0x128faf(_0x2e346f[_0xf407('0x10')](0x1f4,_0xa6f11e[_0xf407('0x12')]));});});}; \ No newline at end of file +var _0xf257=['http','request','then','info','Attachment,\x20%s,\x20%s','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','debug','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0xf257,0x82));var _0x7f25=function(_0x18a7c6,_0xf5e617){_0x18a7c6=_0x18a7c6-0x0;var _0x2eb5d4=_0xf257[_0x18a7c6];return _0x2eb5d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f25('0x0'));var BPromise=require(_0x7f25('0x1'));var rs=require(_0x7f25('0x2'));var fs=require('fs');var Redis=require(_0x7f25('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f25('0x4'));var logger=require(_0x7f25('0x5'))(_0x7f25('0x6'));var config=require(_0x7f25('0x7'));var jayson=require(_0x7f25('0x8'));var client=jayson[_0x7f25('0x9')][_0x7f25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242a3e,_0x369a09,_0x16e278){return new BPromise(function(_0x31a5d8,_0x1ae607){return client[_0x7f25('0xb')](_0x242a3e,_0x16e278)[_0x7f25('0xc')](function(_0x57ba17){logger[_0x7f25('0xd')](_0x7f25('0xe'),_0x369a09,'request\x20sent');logger['debug'](_0x7f25('0xf'),_0x369a09,'request\x20sent',JSON[_0x7f25('0x10')](_0x57ba17));if(_0x57ba17[_0x7f25('0x11')]){if(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x12')]===0x1f4){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')]['message']);return _0x1ae607(_0x57ba17['error'][_0x7f25('0x13')]);}logger['error'](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);return _0x31a5d8(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x369a09,'request\x20sent');_0x31a5d8(_0x57ba17[_0x7f25('0x14')][_0x7f25('0x13')]);}})[_0x7f25('0x15')](function(_0x167363){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x167363);_0x1ae607(_0x167363);});});}exports[_0x7f25('0x16')]=function(_0x26d4aa){var _0x5e0067=this;return new Promise(function(_0x23f30c,_0x1cd6c1){return db[_0x7f25('0x17')][_0x7f25('0x18')](_0x26d4aa[_0x7f25('0x19')],{'raw':_0x26d4aa[_0x7f25('0x1a')]?_0x26d4aa['options']['raw']===undefined?!![]:![]:!![]})[_0x7f25('0xc')](function(_0x57275e){logger[_0x7f25('0xd')](_0x7f25('0x16'),_0x26d4aa);logger[_0x7f25('0x1b')](_0x7f25('0x16'),_0x26d4aa,JSON[_0x7f25('0x10')](_0x57275e));_0x23f30c(_0x57275e);})[_0x7f25('0x15')](function(_0x31bf5f){logger['error'](_0x7f25('0x16'),_0x31bf5f[_0x7f25('0x13')],_0x26d4aa);_0x1cd6c1(_0x5e0067[_0x7f25('0x11')](0x1f4,_0x31bf5f[_0x7f25('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 16092ea..995b0e6 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 _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(_0x3dae5e,_0x95f6b6){_0x3dae5e=_0x3dae5e-0x0;var _0x52fbad=_0xdb28[_0x3dae5e];return _0x52fbad;};'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 +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1af655,_0x28b928){_0x1af655=_0x1af655-0x0;var _0x29da01=_0x0b0e[_0x1af655];return _0x29da01;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 66cab23..f35f4e9 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b5c=['then','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','signToken','json','online','use','User','passport-local','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','role','disabled','blocked','blockedAt','admin','user','agent'];(function(_0x1c946a,_0x5b312d){var _0x5b1e14=function(_0x3d621d){while(--_0x3d621d){_0x1c946a['push'](_0x1c946a['shift']());}};_0x5b1e14(++_0x5b312d);}(_0x8b5c,0x1bf));var _0xc8b5=function(_0x150983,_0x5b97db){_0x150983=_0x150983-0x0;var _0x271597=_0x8b5c[_0x150983];return _0x271597;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xc8b5('0x0'))['Strategy'];var moment=require(_0xc8b5('0x1'));var ActiveDirectory=require(_0xc8b5('0x2'));var BPromise=require('bluebird');var util=require(_0xc8b5('0x3'));var db=require(_0xc8b5('0x4'))['db'];var authService=require(_0xc8b5('0x5'));var utils=require(_0xc8b5('0x6'));var config=require(_0xc8b5('0x7'));var logger=require(_0xc8b5('0x8'))(_0xc8b5('0x9'));function isActiveDirectoryConfigured(_0x6cdee1){var _0x38a84a=![];if(typeof _0x6cdee1[_0xc8b5('0xa')]!==_0xc8b5('0xb')){_0x38a84a=_0x6cdee1[_0xc8b5('0xa')]['baseDN']&&_0x6cdee1[_0xc8b5('0xa')][_0xc8b5('0xc')]&&_0x6cdee1[_0xc8b5('0xa')]['domain'];}return _0x38a84a;}function adAuthenticate(_0x11070f,_0x584c0f,_0xdac9f2){return new BPromise(function(_0x428d39,_0x114b84){try{var _0x2d774e=new ActiveDirectory(_0x11070f);_0x2d774e[_0xc8b5('0xd')](_0x584c0f,_0xdac9f2,function(_0x573b21,_0x310964){if(_0x573b21){logger['error'](_0xc8b5('0xe'),_0x584c0f,util[_0xc8b5('0xf')](_0x573b21,{'showHidden':![],'depth':null}));_0x114b84('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x310964){logger[_0xc8b5('0x10')](_0xc8b5('0x11'),_0x584c0f);_0x114b84('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x428d39(_0x310964);}});}catch(_0x357da4){_0x114b84(_0x357da4);}});}function ActiveDirectoryAuthenticate(_0x1f3415,_0x334af5,_0x3b9fcd,_0x4d5d18){var _0xa678d,_0x44d77e;if(!isActiveDirectoryConfigured(config)){logger[_0xc8b5('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x334af5);return _0x4d5d18(null,![],{'message':_0xc8b5('0x12')});}return db[_0xc8b5('0x13')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xc8b5('0x14')],'raw':!![]})['then'](function(_0x500cf5){_0xa678d=_0x500cf5;if(!_0xa678d[_0xc8b5('0x15')]){logger[_0xc8b5('0x10')](_0xc8b5('0x16'),_0x334af5);throw new Error(_0xc8b5('0x12'));}return _0x1f3415[_0xc8b5('0x17')]({'attributes':['id',_0xc8b5('0x18'),_0xc8b5('0x19'),'salt',_0xc8b5('0x1a'),_0xc8b5('0x1b'),_0xc8b5('0x1c'),_0xc8b5('0x1d'),'online'],'where':{'name':_0x334af5,'role':{'$or':[_0xc8b5('0x1e'),_0xc8b5('0x1f'),_0xc8b5('0x20')]},'adSsoEnabled':!![]}});})[_0xc8b5('0x21')](function(_0x3f053a){if(!_0x3f053a||_0x3f053a&&_0x3f053a[_0xc8b5('0x18')]!==_0x334af5){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x44d77e=_0x3f053a;var _0x337b2c=_0x44d77e[_0xc8b5('0x18')]+'@'+config[_0xc8b5('0xa')]['domain'];return adAuthenticate(config['activedirectory'],_0x337b2c,_0x3b9fcd);})[_0xc8b5('0x21')](function(_0x4384de){if(_0x44d77e[_0xc8b5('0x1b')]){throw new Error(_0xc8b5('0x12'));}if(_0xa678d['blockDuration']>0x0){if(_0x44d77e[_0xc8b5('0x1c')]){if(moment(_0x44d77e[_0xc8b5('0x1d')])['add'](_0xa678d['blockDuration'],_0xc8b5('0x22'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xc8b5('0x23')](_0x44d77e,0x0,![],null)[_0xc8b5('0x21')](function(){return utils['getLicense'](_0x44d77e);})['then'](function(){return _0x4d5d18(null,_0x44d77e);});}else{return utils['getLicense'](_0x44d77e)[_0xc8b5('0x21')](function(){return _0x4d5d18(null,_0x44d77e);});}}else{return utils[_0xc8b5('0x24')](_0x44d77e)[_0xc8b5('0x21')](function(){return _0x4d5d18(null,_0x44d77e);});}})[_0xc8b5('0x25')](function(_0x49db7b){return _0x4d5d18(null,![],_0x49db7b);});}function handleError(_0x8f1eec,_0x5e972c,_0x37537a){return _0x8f1eec[_0xc8b5('0x26')](_0x5e972c||0x1f4)[_0xc8b5('0x27')]({'message':_0x37537a?_0x37537a[_0xc8b5('0x28')]||_0x37537a:''});}exports[_0xc8b5('0x29')]=function(_0x501a3c,_0x943837,_0xdf1196){passport['authenticate'](_0xc8b5('0x2a'),function(_0x377bfc,_0x3ec33a,_0x10dcb1){var _0x131003=_0x377bfc||_0x10dcb1;if(_0x131003){return handleError(_0x943837,0x191,_0x131003);}if(!_0x3ec33a){return handleError(_0x943837,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x48af49={'payload':{'id':_0x3ec33a['id'],'role':_0x3ec33a[_0xc8b5('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xc8b5('0x2b')](_0x48af49)['then'](function(_0x47aa75){_0x943837[_0xc8b5('0x2c')]({'id':_0x3ec33a['id'],'token':_0x47aa75,'statusCall':'','isAlreadyLogged':_0x3ec33a[_0xc8b5('0x2d')]});});}})(_0x501a3c,_0x943837,_0xdf1196);};passport[_0xc8b5('0x2e')](_0xc8b5('0x2a'),new LocalStrategy({'usernameField':_0xc8b5('0x18'),'passwordField':_0xc8b5('0x19')},function(_0x20b000,_0x32b2de,_0x3e66d5){return ActiveDirectoryAuthenticate(db[_0xc8b5('0x2f')],_0x20b000,_0x32b2de,_0x3e66d5);})); \ No newline at end of file +var _0xe0a4=['bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blockedAt','online','admin','user','agent','disabled','blocked','add','minutes','clearBlockUser','getLicense','catch','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','Strategy','activedirectory2'];(function(_0x5d7abc,_0x4bbc98){var _0x536e72=function(_0x47d01e){while(--_0x47d01e){_0x5d7abc['push'](_0x5d7abc['shift']());}};_0x536e72(++_0x4bbc98);}(_0xe0a4,0x18d));var _0x4e0a=function(_0x4eaf8a,_0x134b6c){_0x4eaf8a=_0x4eaf8a-0x0;var _0x217d22=_0xe0a4[_0x4eaf8a];return _0x217d22;};'use strict';var passport=require(_0x4e0a('0x0'));var LocalStrategy=require('passport-local')[_0x4e0a('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x4e0a('0x2'));var BPromise=require(_0x4e0a('0x3'));var util=require(_0x4e0a('0x4'));var db=require(_0x4e0a('0x5'))['db'];var authService=require(_0x4e0a('0x6'));var utils=require(_0x4e0a('0x7'));var config=require(_0x4e0a('0x8'));var logger=require(_0x4e0a('0x9'))(_0x4e0a('0xa'));function isActiveDirectoryConfigured(_0x14b516){var _0x893320=![];if(typeof _0x14b516[_0x4e0a('0xb')]!==_0x4e0a('0xc')){_0x893320=_0x14b516[_0x4e0a('0xb')][_0x4e0a('0xd')]&&_0x14b516[_0x4e0a('0xb')][_0x4e0a('0xe')]&&_0x14b516[_0x4e0a('0xb')][_0x4e0a('0xf')];}return _0x893320;}function adAuthenticate(_0x25a87a,_0x3b18f7,_0x4559bf){return new BPromise(function(_0x4e8d1b,_0x23d040){try{var _0x1d4ff1=new ActiveDirectory(_0x25a87a);_0x1d4ff1[_0x4e0a('0x10')](_0x3b18f7,_0x4559bf,function(_0x4789f0,_0x24ade1){if(_0x4789f0){logger[_0x4e0a('0x11')]('Error\x20authenticate\x20%s:\x20%s',_0x3b18f7,util[_0x4e0a('0x12')](_0x4789f0,{'showHidden':![],'depth':null}));_0x23d040(_0x4e0a('0x13'));}else if(!_0x24ade1){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3b18f7);_0x23d040(_0x4e0a('0x13'));}else{_0x4e8d1b(_0x24ade1);}});}catch(_0x3a7edd){_0x23d040(_0x3a7edd);}});}function ActiveDirectoryAuthenticate(_0x323200,_0x5faa38,_0x51a3a8,_0x552f30){var _0x209bd8,_0x573cde;if(!isActiveDirectoryConfigured(config)){logger[_0x4e0a('0x11')](_0x4e0a('0x14'),_0x5faa38);return _0x552f30(null,![],{'message':_0x4e0a('0x13')});}return db[_0x4e0a('0x15')]['findOne']({'where':{'id':0x1},'attributes':[_0x4e0a('0x16'),_0x4e0a('0x17')],'raw':!![]})[_0x4e0a('0x18')](function(_0x20e7ef){_0x209bd8=_0x20e7ef;if(!_0x209bd8[_0x4e0a('0x16')]){logger[_0x4e0a('0x11')](_0x4e0a('0x19'),_0x5faa38);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x323200['findOne']({'attributes':['id',_0x4e0a('0x1a'),_0x4e0a('0x1b'),_0x4e0a('0x1c'),_0x4e0a('0x1d'),'disabled','blocked',_0x4e0a('0x1e'),_0x4e0a('0x1f')],'where':{'name':_0x5faa38,'role':{'$or':[_0x4e0a('0x20'),_0x4e0a('0x21'),_0x4e0a('0x22')]},'adSsoEnabled':!![]}});})[_0x4e0a('0x18')](function(_0xcd1b5d){if(!_0xcd1b5d||_0xcd1b5d&&_0xcd1b5d[_0x4e0a('0x1a')]!==_0x5faa38){throw new Error(_0x4e0a('0x13'));}_0x573cde=_0xcd1b5d;var _0xd8e61f=_0x573cde[_0x4e0a('0x1a')]+'@'+config[_0x4e0a('0xb')]['domain'];return adAuthenticate(config[_0x4e0a('0xb')],_0xd8e61f,_0x51a3a8);})['then'](function(_0x2c7b17){if(_0x573cde[_0x4e0a('0x23')]){throw new Error(_0x4e0a('0x13'));}if(_0x209bd8[_0x4e0a('0x17')]>0x0){if(_0x573cde[_0x4e0a('0x24')]){if(moment(_0x573cde[_0x4e0a('0x1e')])[_0x4e0a('0x25')](_0x209bd8[_0x4e0a('0x17')],_0x4e0a('0x26'))>moment()){throw new Error(_0x4e0a('0x13'));}return utils[_0x4e0a('0x27')](_0x573cde,0x0,![],null)[_0x4e0a('0x18')](function(){return utils[_0x4e0a('0x28')](_0x573cde);})[_0x4e0a('0x18')](function(){return _0x552f30(null,_0x573cde);});}else{return utils['getLicense'](_0x573cde)[_0x4e0a('0x18')](function(){return _0x552f30(null,_0x573cde);});}}else{return utils['getLicense'](_0x573cde)[_0x4e0a('0x18')](function(){return _0x552f30(null,_0x573cde);});}})[_0x4e0a('0x29')](function(_0x5646e3){return _0x552f30(null,![],_0x5646e3);});}function handleError(_0x57634f,_0x22df2f,_0x5f02d7){return _0x57634f['status'](_0x22df2f||0x1f4)['send']({'message':_0x5f02d7?_0x5f02d7[_0x4e0a('0x2a')]||_0x5f02d7:''});}exports[_0x4e0a('0x2b')]=function(_0x4a3791,_0x4f20f4,_0x320f9c){passport[_0x4e0a('0x10')](_0x4e0a('0x2c'),function(_0x5f0b53,_0x19c551,_0x50f14f){var _0x1c6909=_0x5f0b53||_0x50f14f;if(_0x1c6909){return handleError(_0x4f20f4,0x191,_0x1c6909);}if(!_0x19c551){return handleError(_0x4f20f4,0x194,{'message':_0x4e0a('0x2d')});}else{var _0x41a5b2={'payload':{'id':_0x19c551['id'],'role':_0x19c551[_0x4e0a('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x4e0a('0x2e')](_0x41a5b2)[_0x4e0a('0x18')](function(_0x263d2e){_0x4f20f4[_0x4e0a('0x2f')]({'id':_0x19c551['id'],'token':_0x263d2e,'statusCall':'','isAlreadyLogged':_0x19c551[_0x4e0a('0x1f')]});});}})(_0x4a3791,_0x4f20f4,_0x320f9c);};passport[_0x4e0a('0x30')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x4e0a('0x1b')},function(_0x2e8840,_0x21d708,_0x3d35f2){return ActiveDirectoryAuthenticate(db[_0x4e0a('0x31')],_0x2e8840,_0x21d708,_0x3d35f2);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 5afff6a..08fb0aa 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc2f=['login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x14145a,_0x561605){var _0x3231f5=function(_0x501f94){while(--_0x501f94){_0x14145a['push'](_0x14145a['shift']());}};_0x3231f5(++_0x561605);}(_0xbc2f,0x1a1));var _0xfbc2=function(_0x4e8a59,_0x32bc84){_0x4e8a59=_0x4e8a59-0x0;var _0x22ba3e=_0xbc2f[_0x4e8a59];return _0x22ba3e;};'use strict';var express=require(_0xfbc2('0x0'));var router=express[_0xfbc2('0x1')]();var controller=require(_0xfbc2('0x2'));router['post']('/',controller[_0xfbc2('0x3')]);module[_0xfbc2('0x4')]=router; \ No newline at end of file +var _0xd89d=['Router','./authActiveDirectory.controller','post','login','exports','express'];(function(_0x5acac3,_0x3d7346){var _0x243e59=function(_0x39e045){while(--_0x39e045){_0x5acac3['push'](_0x5acac3['shift']());}};_0x243e59(++_0x3d7346);}(_0xd89d,0x14f));var _0xdd89=function(_0x3c2ec1,_0x271c28){_0x3c2ec1=_0x3c2ec1-0x0;var _0x5467e5=_0xd89d[_0x3c2ec1];return _0x5467e5;};'use strict';var express=require(_0xdd89('0x0'));var router=express[_0xdd89('0x1')]();var controller=require(_0xdd89('0x2'));router[_0xdd89('0x3')]('/',controller[_0xdd89('0x4')]);module[_0xdd89('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 85cd622..2f8365b 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x7a54,0x106));var _0x47a5=function(_0x21bf69,_0x518b68){_0x21bf69=_0x21bf69-0x0;var _0x2ee24f=_0x7a54[_0x21bf69];return _0x2ee24f;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x7a54,0x106));var _0x47a5=function(_0x28baf3,_0x565c8f){_0x28baf3=_0x28baf3-0x0;var _0x2857e9=_0x7a54[_0x28baf3];return _0x2857e9;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 18c1ac8..5caa55e 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 _0x3bd0=['get','login','callback','isMiddleware','setTokenCookie','exports','passport','Router','./authGoogle.controller','../../components/auth/service'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x3bd0,0x196));var _0x03bd=function(_0x5bc3fc,_0x54db61){_0x5bc3fc=_0x5bc3fc-0x0;var _0x1253d0=_0x3bd0[_0x5bc3fc];return _0x1253d0;};'use strict';var express=require('express');var passport=require(_0x03bd('0x0'));var router=express[_0x03bd('0x1')]();var controller=require(_0x03bd('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x03bd('0x3'));router[_0x03bd('0x4')]('/',controller[_0x03bd('0x5')]);router['get']('/callback',controller[_0x03bd('0x6')],authService[_0x03bd('0x7')],userController[_0x03bd('0x5')],authService[_0x03bd('0x8')]);module[_0x03bd('0x9')]=router; \ No newline at end of file +var _0x4a99=['login','setTokenCookie','express','./authGoogle.controller','../user/user.controller.js','get','/callback','callback'];(function(_0x5f05af,_0x4d1040){var _0x4fc2d8=function(_0x48fef5){while(--_0x48fef5){_0x5f05af['push'](_0x5f05af['shift']());}};_0x4fc2d8(++_0x4d1040);}(_0x4a99,0x1aa));var _0x94a9=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x4a99[_0x376b45];return _0x2341b3;};'use strict';var express=require(_0x94a9('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x94a9('0x1'));var userController=require(_0x94a9('0x2'));var authService=require('../../components/auth/service');router[_0x94a9('0x3')]('/',controller['login']);router[_0x94a9('0x3')](_0x94a9('0x4'),controller[_0x94a9('0x5')],authService['isMiddleware'],userController[_0x94a9('0x6')],authService[_0x94a9('0x7')]);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 93866aa..66403ed 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 _0xcc8d=['Setting','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','resetPasswordExpires','Password\x20reset!','use','local-login','util','passport','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','findOne','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','blockDuration','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.'];(function(_0x416468,_0x2e7a72){var _0x2ee9b7=function(_0xf354ce){while(--_0xf354ce){_0x416468['push'](_0x416468['shift']());}};_0x2ee9b7(++_0x2e7a72);}(_0xcc8d,0xfc));var _0xdcc8=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0xcc8d[_0x40b3f2];return _0x4ce90c;};'use strict';var util=require(_0xdcc8('0x0'));var passport=require(_0xdcc8('0x1'));var LocalStrategy=require('passport-local')[_0xdcc8('0x2')];var jayson=require('jayson/promise');var _=require(_0xdcc8('0x3'));var rs=require(_0xdcc8('0x4'));var moment=require(_0xdcc8('0x5'));var db=require(_0xdcc8('0x6'))['db'];var authService=require(_0xdcc8('0x7'));var utils=require('../../config/utils');var client=jayson[_0xdcc8('0x8')][_0xdcc8('0x9')]({'port':0x232b});function localAuthenticate(_0x50bf40,_0x2c5482,_0x1e7153,_0x29b045){var _0x4f3511,_0x1a94a2;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x118448){_0x4f3511=_0x118448;return _0x50bf40[_0xdcc8('0xa')]({'attributes':['id',_0xdcc8('0xb'),_0xdcc8('0xc'),_0xdcc8('0xd'),_0xdcc8('0xe'),_0xdcc8('0xf'),_0xdcc8('0x10'),_0xdcc8('0x11'),_0xdcc8('0x12')],'where':{'name':_0x2c5482,'role':{'$or':[_0xdcc8('0x13'),_0xdcc8('0x14'),_0xdcc8('0x15')]}}});})['then'](function(_0x2da1ae){if(!_0x2da1ae||_0x2da1ae&&_0x2da1ae[_0xdcc8('0xb')]!==_0x2c5482){throw new Error(_0xdcc8('0x16'));}else{_0x1a94a2=_0x2da1ae;return _0x1a94a2;}})[_0xdcc8('0x17')](function(){_0x1a94a2[_0xdcc8('0x18')](_0x1e7153,function(_0xcc88f0,_0x193be9){var _0x2eb6a3=_0x1a94a2['loginAttempts']+0x1;if(_0xcc88f0){return _0x29b045(_0xcc88f0);}else if(!_0x193be9){if(_0x1a94a2[_0xdcc8('0xf')]){return _0x29b045(null,![],{'message':_0xdcc8('0x16')});}else if(_0x4f3511['allowedLoginAttempts']>0x0){if(_0x1a94a2[_0xdcc8('0x10')]){if(_0x4f3511[_0xdcc8('0x19')]>0x0){if(moment(_0x1a94a2[_0xdcc8('0x11')])[_0xdcc8('0x1a')](_0x4f3511[_0xdcc8('0x19')],_0xdcc8('0x1b'))>moment()){return _0x29b045(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x1a94a2,_0x2eb6a3,![],null)[_0xdcc8('0x17')](function(){return _0x29b045(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x29b045(null,![],{'message':_0xdcc8('0x16')});}}else{if(_0x2eb6a3>=_0x4f3511['allowedLoginAttempts']){return utils['clearBlockUser'](_0x1a94a2,0x0,!![],moment())['then'](function(){return _0x29b045(null,![],{'message':_0xdcc8('0x16')});});}else{return utils[_0xdcc8('0x1c')](_0x1a94a2,_0x2eb6a3,![],null)['then'](function(){return _0x29b045(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x29b045(null,![],{'message':_0xdcc8('0x16')});}}else{if(_0x1a94a2[_0xdcc8('0xf')]){return _0x29b045(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4f3511['allowedLoginAttempts']>0x0){if(_0x1a94a2[_0xdcc8('0x10')]){if(_0x4f3511[_0xdcc8('0x19')]>0x0){if(moment(_0x1a94a2[_0xdcc8('0x11')])[_0xdcc8('0x1a')](_0x4f3511['blockDuration'],'minutes')>moment()){return _0x29b045(null,![],{'message':_0xdcc8('0x16')});}else{return utils[_0xdcc8('0x1c')](_0x1a94a2,0x0,![],null)[_0xdcc8('0x17')](function(){return utils['getLicense'](_0x1a94a2);})['then'](function(){return _0x29b045(null,_0x1a94a2);});}}else{return _0x29b045(null,![],{'message':_0xdcc8('0x16')});}}else{return utils[_0xdcc8('0x1c')](_0x1a94a2,0x0,![],null)[_0xdcc8('0x17')](function(){return utils['getLicense'](_0x1a94a2);})[_0xdcc8('0x17')](function(){return _0x29b045(null,_0x1a94a2);})['catch'](function(_0x3d8fc7){return _0x29b045(null,![],_0x3d8fc7);});}}else{if(_0x1a94a2[_0xdcc8('0x10')]){return _0x29b045(null,![],{'message':_0xdcc8('0x16')});}else{return utils[_0xdcc8('0x1d')](_0x1a94a2)[_0xdcc8('0x17')](function(){return _0x29b045(null,_0x1a94a2);});}}}});})[_0xdcc8('0x1e')](function(_0x25963e){return _0x29b045(null,![],_0x25963e);});}function sendServiceMail(_0x50ed1c){return db['MailAccount'][_0xdcc8('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xdcc8('0xb'),'email'],'include':[{'model':db[_0xdcc8('0x20')],'as':_0xdcc8('0x21'),'include':[{'model':db[_0xdcc8('0x22')],'as':_0xdcc8('0x22')}]}]})['then'](function(_0xe505a9){if(!_0xe505a9){throw new Error(_0xdcc8('0x23'));}var _0x5f01df=_0xe505a9[_0xdcc8('0x24')]();var _0x330a14={'account':_0x5f01df,'message':_[_0xdcc8('0x25')]({'from':util['format']('\x22%s\x22\x20<%s>',_0xe505a9[_0xdcc8('0xb')],_0xe505a9[_0xdcc8('0x26')]||_0xe505a9[_0xdcc8('0x21')][_0xdcc8('0x14')])},_0x50ed1c)};return client[_0xdcc8('0x27')](_0xdcc8('0x28'),_0x330a14);})[_0xdcc8('0x17')](function(_0x1b0179){if(_0x1b0179[_0xdcc8('0x29')]){throw new Error(util['format'](_0xdcc8('0x2a'),_0x1b0179[_0xdcc8('0x29')][_0xdcc8('0x2b')]||JSON[_0xdcc8('0x2c')](_0x1b0179[_0xdcc8('0x29')])));}return!![];});}function handleError(_0x54e641,_0x50ce7a,_0x439b65){return _0x54e641[_0xdcc8('0x2d')](_0x50ce7a||0x1f4)[_0xdcc8('0x2e')]({'message':_0x439b65?_0x439b65[_0xdcc8('0x2b')]||_0x439b65:''});}exports[_0xdcc8('0x2f')]=function(_0xf8d100,_0x816007,_0x68d0cb){passport[_0xdcc8('0x18')]('local-login',function(_0x4fd973,_0x3dab3c,_0x15baac){var _0x183281=_0x4fd973||_0x15baac;if(_0x183281){return handleError(_0x816007,0x191,_0x183281);}if(!_0x3dab3c){return handleError(_0x816007,0x194,{'message':_0xdcc8('0x30')});}else{var _0x4e1291={'payload':{'id':_0x3dab3c['id'],'role':_0x3dab3c['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4e1291)['then'](function(_0xe97dc0){_0x816007[_0xdcc8('0x31')]({'id':_0x3dab3c['id'],'token':_0xe97dc0,'statusCall':'','isAlreadyLogged':_0x3dab3c[_0xdcc8('0x32')]});});}})(_0xf8d100,_0x816007,_0x68d0cb);};exports[_0xdcc8('0x33')]=function(_0x56ea43,_0x436b60){if(!_0x56ea43[_0xdcc8('0x34')][_0xdcc8('0x26')]){return handleError(_0x436b60,0x1f4,{'message':_0xdcc8('0x35')});}var _0x288367=rs[_0xdcc8('0x36')]();_0x56ea43[_0xdcc8('0x34')]['email']=_0x56ea43[_0xdcc8('0x34')][_0xdcc8('0x26')]['trim']()['toLowerCase']();var _0x420f53;return db['Setting'][_0xdcc8('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xdcc8('0x17')](function(_0x5718a6){_0x420f53=_0x5718a6;return db[_0xdcc8('0x37')]['find']({'where':{'email':_0x56ea43[_0xdcc8('0x34')][_0xdcc8('0x26')]}});})[_0xdcc8('0x17')](function(_0x11ebce){if(!_0x11ebce){throw new Error(_0xdcc8('0x38'));}if(_0x11ebce[_0xdcc8('0xf')]){throw new Error(_0xdcc8('0x39'));}if(_0x11ebce[_0xdcc8('0x10')]){if(moment(_0x11ebce[_0xdcc8('0x11')])[_0xdcc8('0x1a')](_0x420f53[_0xdcc8('0x19')],_0xdcc8('0x1b'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x11ebce[_0xdcc8('0x10')]=![];_0x11ebce[_0xdcc8('0x11')]=null;}}_0x11ebce[_0xdcc8('0x3a')]=_0x288367;_0x11ebce['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x11ebce[_0xdcc8('0x3b')]();})[_0xdcc8('0x17')](function(){return sendServiceMail({'to':_0x56ea43[_0xdcc8('0x34')][_0xdcc8('0x26')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xdcc8('0x3c')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xdcc8('0x3d')+_0x56ea43[_0xdcc8('0x3e')][_0xdcc8('0x3f')]+_0xdcc8('0x40')+_0x288367+'\x0a\x0a'+_0xdcc8('0x41')});})[_0xdcc8('0x17')](function(){_0x436b60[_0xdcc8('0x2d')](0xc8)[_0xdcc8('0x2e')]({'message':_0xdcc8('0x42')});})[_0xdcc8('0x1e')](function(_0x1fa8ca){return handleError(_0x436b60,0x1f4,_0x1fa8ca);});};exports[_0xdcc8('0x43')]=function(_0x3520f7,_0x259e55){return db[_0xdcc8('0x37')][_0xdcc8('0x1f')]({'where':{'resetPasswordToken':_0x3520f7[_0xdcc8('0x44')][_0xdcc8('0x45')],'resetPasswordExpires':{'$gt':Date[_0xdcc8('0x46')]()}}})[_0xdcc8('0x17')](function(_0x557270){if(!_0x557270){throw new Error(_0xdcc8('0x47'));}return db[_0xdcc8('0x48')][_0xdcc8('0xa')]({'attributes':['id',_0xdcc8('0x49'),_0xdcc8('0x4a'),_0xdcc8('0x4b')]})[_0xdcc8('0x17')](function(_0x2fbe26){if(_0x2fbe26[_0xdcc8('0x49')])authService['validatePasswordPattern'](_0x3520f7[_0xdcc8('0x34')][_0xdcc8('0xc')]);if(!_0x2fbe26[_0xdcc8('0x4a')]||!_0x557270[_0xdcc8('0x4c')])return _0x557270;authService['validatePasswordHistory'](_0x3520f7[_0xdcc8('0x34')][_0xdcc8('0xc')],_0x557270['previousPasswords'],_0x2fbe26[_0xdcc8('0x4b')]);return _0x557270;})[_0xdcc8('0x17')](function(){_0x557270[_0xdcc8('0xc')]=_0x3520f7[_0xdcc8('0x34')][_0xdcc8('0xc')];_0x557270[_0xdcc8('0x3a')]=null;_0x557270[_0xdcc8('0x4d')]=null;return _0x557270[_0xdcc8('0x3b')]();});})[_0xdcc8('0x17')](function(){_0x259e55[_0xdcc8('0x2d')](0xc8)['send']({'message':_0xdcc8('0x4e')});})[_0xdcc8('0x1e')](function(_0x268c96){return handleError(_0x259e55,0x1f4,_0x268c96);});};passport[_0xdcc8('0x4f')](_0xdcc8('0x50'),new LocalStrategy({'usernameField':_0xdcc8('0xb'),'passwordField':_0xdcc8('0xc')},function(_0x11800f,_0x498ed2,_0x1aabd3){return localAuthenticate(db[_0xdcc8('0x37')],_0x11800f,_0x498ed2,_0x1aabd3);})); \ No newline at end of file +var _0x988c=['json','online','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x988c,0x15d));var _0xc988=function(_0xaca4df,_0x536f61){_0xaca4df=_0xaca4df-0x0;var _0x3c7916=_0x988c[_0xaca4df];return _0x3c7916;};'use strict';var util=require('util');var passport=require(_0xc988('0x0'));var LocalStrategy=require(_0xc988('0x1'))[_0xc988('0x2')];var jayson=require(_0xc988('0x3'));var _=require('lodash');var rs=require(_0xc988('0x4'));var moment=require(_0xc988('0x5'));var db=require(_0xc988('0x6'))['db'];var authService=require(_0xc988('0x7'));var utils=require(_0xc988('0x8'));var client=jayson[_0xc988('0x9')][_0xc988('0xa')]({'port':0x232b});function localAuthenticate(_0x30dec3,_0x2743b3,_0x10ff6c,_0x5423aa){var _0x54308a,_0x55e64f;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc988('0xb')],'raw':!![]})[_0xc988('0xc')](function(_0x2fcd35){_0x54308a=_0x2fcd35;return _0x30dec3[_0xc988('0xd')]({'attributes':['id',_0xc988('0xe'),_0xc988('0xf'),_0xc988('0x10'),_0xc988('0x11'),_0xc988('0x12'),_0xc988('0x13'),_0xc988('0x14'),_0xc988('0x15')],'where':{'name':_0x2743b3,'role':{'$or':[_0xc988('0x16'),_0xc988('0x17'),_0xc988('0x18')]}}});})['then'](function(_0x489a32){if(!_0x489a32||_0x489a32&&_0x489a32[_0xc988('0xe')]!==_0x2743b3){throw new Error(_0xc988('0x19'));}else{_0x55e64f=_0x489a32;return _0x55e64f;}})[_0xc988('0xc')](function(){_0x55e64f['authenticate'](_0x10ff6c,function(_0x5456cd,_0x1bc3c0){var _0x4b2698=_0x55e64f[_0xc988('0x15')]+0x1;if(_0x5456cd){return _0x5423aa(_0x5456cd);}else if(!_0x1bc3c0){if(_0x55e64f[_0xc988('0x12')]){return _0x5423aa(null,![],{'message':_0xc988('0x19')});}else if(_0x54308a[_0xc988('0x1a')]>0x0){if(_0x55e64f[_0xc988('0x13')]){if(_0x54308a[_0xc988('0xb')]>0x0){if(moment(_0x55e64f[_0xc988('0x14')])[_0xc988('0x1b')](_0x54308a[_0xc988('0xb')],_0xc988('0x1c'))>moment()){return _0x5423aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc988('0x1d')](_0x55e64f,_0x4b2698,![],null)[_0xc988('0xc')](function(){return _0x5423aa(null,![],{'message':_0xc988('0x19')});});}}else{return _0x5423aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4b2698>=_0x54308a[_0xc988('0x1a')]){return utils[_0xc988('0x1d')](_0x55e64f,0x0,!![],moment())['then'](function(){return _0x5423aa(null,![],{'message':_0xc988('0x19')});});}else{return utils[_0xc988('0x1d')](_0x55e64f,_0x4b2698,![],null)[_0xc988('0xc')](function(){return _0x5423aa(null,![],{'message':_0xc988('0x19')});});}}}else{return _0x5423aa(null,![],{'message':_0xc988('0x19')});}}else{if(_0x55e64f[_0xc988('0x12')]){return _0x5423aa(null,![],{'message':_0xc988('0x19')});}else if(_0x54308a[_0xc988('0x1a')]>0x0){if(_0x55e64f[_0xc988('0x13')]){if(_0x54308a[_0xc988('0xb')]>0x0){if(moment(_0x55e64f['blockedAt'])[_0xc988('0x1b')](_0x54308a['blockDuration'],_0xc988('0x1c'))>moment()){return _0x5423aa(null,![],{'message':_0xc988('0x19')});}else{return utils['clearBlockUser'](_0x55e64f,0x0,![],null)[_0xc988('0xc')](function(){return utils['getLicense'](_0x55e64f);})[_0xc988('0xc')](function(){return _0x5423aa(null,_0x55e64f);});}}else{return _0x5423aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xc988('0x1d')](_0x55e64f,0x0,![],null)[_0xc988('0xc')](function(){return utils[_0xc988('0x1e')](_0x55e64f);})['then'](function(){return _0x5423aa(null,_0x55e64f);})['catch'](function(_0x1485cd){return _0x5423aa(null,![],_0x1485cd);});}}else{if(_0x55e64f['blocked']){return _0x5423aa(null,![],{'message':_0xc988('0x19')});}else{return utils[_0xc988('0x1e')](_0x55e64f)[_0xc988('0xc')](function(){return _0x5423aa(null,_0x55e64f);});}}}});})[_0xc988('0x1f')](function(_0x4f710f){return _0x5423aa(null,![],_0x4f710f);});}function sendServiceMail(_0x574828){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0xc988('0xe'),_0xc988('0x20')],'include':[{'model':db[_0xc988('0x21')],'as':_0xc988('0x22'),'include':[{'model':db[_0xc988('0x23')],'as':_0xc988('0x23')}]}]})['then'](function(_0x34f661){if(!_0x34f661){throw new Error(_0xc988('0x24'));}var _0x504bd0=_0x34f661['getSmtpOptions']();var _0x1a936a={'account':_0x504bd0,'message':_[_0xc988('0x25')]({'from':util[_0xc988('0x26')](_0xc988('0x27'),_0x34f661[_0xc988('0xe')],_0x34f661['email']||_0x34f661[_0xc988('0x22')][_0xc988('0x17')])},_0x574828)};return client[_0xc988('0x28')](_0xc988('0x29'),_0x1a936a);})[_0xc988('0xc')](function(_0x494e7f){if(_0x494e7f[_0xc988('0x2a')]){throw new Error(util[_0xc988('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x494e7f[_0xc988('0x2a')][_0xc988('0x2b')]||JSON[_0xc988('0x2c')](_0x494e7f[_0xc988('0x2a')])));}return!![];});}function handleError(_0x1724da,_0x50439c,_0x556ae9){return _0x1724da[_0xc988('0x2d')](_0x50439c||0x1f4)[_0xc988('0x2e')]({'message':_0x556ae9?_0x556ae9[_0xc988('0x2b')]||_0x556ae9:''});}exports[_0xc988('0x2f')]=function(_0x4cc441,_0x454b00,_0x222ba4){passport['authenticate'](_0xc988('0x30'),function(_0x48e550,_0x6dceb9,_0x3877de){var _0x3ad936=_0x48e550||_0x3877de;if(_0x3ad936){return handleError(_0x454b00,0x191,_0x3ad936);}if(!_0x6dceb9){return handleError(_0x454b00,0x194,{'message':_0xc988('0x31')});}else{var _0x71199={'payload':{'id':_0x6dceb9['id'],'role':_0x6dceb9[_0xc988('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xc988('0x32')](_0x71199)[_0xc988('0xc')](function(_0xb71049){_0x454b00[_0xc988('0x33')]({'id':_0x6dceb9['id'],'token':_0xb71049,'statusCall':'','isAlreadyLogged':_0x6dceb9[_0xc988('0x34')]});});}})(_0x4cc441,_0x454b00,_0x222ba4);};exports['forgot']=function(_0x30f3b4,_0x3aea01){if(!_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')]){return handleError(_0x3aea01,0x1f4,{'message':_0xc988('0x36')});}var _0x589789=rs['generate']();_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')]=_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')][_0xc988('0x37')]()[_0xc988('0x38')]();var _0x2a6b49;return db[_0xc988('0x39')][_0xc988('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc988('0xb')],'raw':!![]})['then'](function(_0x48415a){_0x2a6b49=_0x48415a;return db[_0xc988('0x3a')]['find']({'where':{'email':_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')]}});})['then'](function(_0xfb97e){if(!_0xfb97e){throw new Error(_0xc988('0x3b'));}if(_0xfb97e[_0xc988('0x12')]){throw new Error(_0xc988('0x3c'));}if(_0xfb97e[_0xc988('0x13')]){if(moment(_0xfb97e[_0xc988('0x14')])[_0xc988('0x1b')](_0x2a6b49[_0xc988('0xb')],_0xc988('0x1c'))>moment()){throw new Error(_0xc988('0x3d'));}else{_0xfb97e[_0xc988('0x13')]=![];_0xfb97e[_0xc988('0x14')]=null;}}_0xfb97e['resetPasswordToken']=_0x589789;_0xfb97e[_0xc988('0x3e')]=Date[_0xc988('0x3f')]()+0x36ee80;return _0xfb97e['save']();})[_0xc988('0xc')](function(){return sendServiceMail({'to':_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')],'subject':_0xc988('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xc988('0x41')+_0xc988('0x42')+_0x30f3b4[_0xc988('0x43')][_0xc988('0x44')]+_0xc988('0x45')+_0x589789+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xc988('0xc')](function(){_0x3aea01[_0xc988('0x2d')](0xc8)[_0xc988('0x2e')]({'message':_0xc988('0x46')});})[_0xc988('0x1f')](function(_0x54d8fc){return handleError(_0x3aea01,0x1f4,_0x54d8fc);});};exports['reset']=function(_0x5c2a58,_0x4eb7e4){return db[_0xc988('0x3a')]['find']({'where':{'resetPasswordToken':_0x5c2a58[_0xc988('0x47')][_0xc988('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x25cda0){if(!_0x25cda0){throw new Error(_0xc988('0x49'));}return db[_0xc988('0x39')][_0xc988('0xd')]({'attributes':['id',_0xc988('0x4a'),'enforcePasswordHistory',_0xc988('0x4b')]})[_0xc988('0xc')](function(_0x265474){if(_0x265474['securePassword'])authService[_0xc988('0x4c')](_0x5c2a58['body'][_0xc988('0xf')]);if(!_0x265474['enforcePasswordHistory']||!_0x25cda0[_0xc988('0x4d')])return _0x25cda0;authService[_0xc988('0x4e')](_0x5c2a58[_0xc988('0x35')][_0xc988('0xf')],_0x25cda0[_0xc988('0x4d')],_0x265474['passwordHistoryLimit']);return _0x25cda0;})[_0xc988('0xc')](function(){_0x25cda0[_0xc988('0xf')]=_0x5c2a58[_0xc988('0x35')][_0xc988('0xf')];_0x25cda0['resetPasswordToken']=null;_0x25cda0[_0xc988('0x3e')]=null;return _0x25cda0['save']();});})[_0xc988('0xc')](function(){_0x4eb7e4[_0xc988('0x2d')](0xc8)[_0xc988('0x2e')]({'message':_0xc988('0x4f')});})[_0xc988('0x1f')](function(_0x2e92be){return handleError(_0x4eb7e4,0x1f4,_0x2e92be);});};passport['use'](_0xc988('0x30'),new LocalStrategy({'usernameField':_0xc988('0xe'),'passwordField':'password'},function(_0x5879c5,_0x79d09f,_0x41130f){return localAuthenticate(db['User'],_0x5879c5,_0x79d09f,_0x41130f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index dbfc4ad..b7fc52b 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 _0xd724=['post','login','forgot','reset','exports','express','Router','./authLocal.controller'];(function(_0x1c57a5,_0x433064){var _0x3dadb9=function(_0x5cf957){while(--_0x5cf957){_0x1c57a5['push'](_0x1c57a5['shift']());}};_0x3dadb9(++_0x433064);}(_0xd724,0x6d));var _0x4d72=function(_0x5a5d3a,_0x1cc3b5){_0x5a5d3a=_0x5a5d3a-0x0;var _0x5856fb=_0xd724[_0x5a5d3a];return _0x5856fb;};'use strict';var express=require(_0x4d72('0x0'));var router=express[_0x4d72('0x1')]();var controller=require(_0x4d72('0x2'));router[_0x4d72('0x3')]('/',controller[_0x4d72('0x4')]);router['post']('/forgot',controller[_0x4d72('0x5')]);router['post']('/reset/:token',controller[_0x4d72('0x6')]);module[_0x4d72('0x7')]=router; \ No newline at end of file +var _0x4144=['./authLocal.controller','post','/reset/:token','reset','exports','Router'];(function(_0x4b1347,_0x50e4df){var _0x29674c=function(_0x5eab1a){while(--_0x5eab1a){_0x4b1347['push'](_0x4b1347['shift']());}};_0x29674c(++_0x50e4df);}(_0x4144,0x17f));var _0x4414=function(_0xcb2e4f,_0x3bbb12){_0xcb2e4f=_0xcb2e4f-0x0;var _0x575cb5=_0x4144[_0xcb2e4f];return _0x575cb5;};'use strict';var express=require('express');var router=express[_0x4414('0x0')]();var controller=require(_0x4414('0x1'));router[_0x4414('0x2')]('/',controller['login']);router[_0x4414('0x2')]('/forgot',controller['forgot']);router[_0x4414('0x2')](_0x4414('0x3'),controller[_0x4414('0x4')]);module[_0x4414('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index bd46664..572cafc 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 _0x7e8c=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x24c010,_0xfe4e6f){var _0x702c25=function(_0x994200){while(--_0x994200){_0x24c010['push'](_0x24c010['shift']());}};_0x702c25(++_0xfe4e6f);}(_0x7e8c,0x135));var _0xc7e8=function(_0x5d4982,_0x3a3cad){_0x5d4982=_0x5d4982-0x0;var _0x53156e=_0x7e8c[_0x5d4982];return _0x53156e;};'use strict';var Sequelize=require(_0xc7e8('0x0'));module['exports']={'name':{'type':Sequelize[_0xc7e8('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc7e8('0x1')]},'status':{'type':Sequelize[_0xc7e8('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc7e8('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xdba8=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdba8,0x146));var _0x8dba=function(_0xfed2cc,_0x3d092b){_0xfed2cc=_0xfed2cc-0x0;var _0x1880ef=_0xdba8[_0xfed2cc];return _0x1880ef;};'use strict';var Sequelize=require(_0x8dba('0x0'));module[_0x8dba('0x1')]={'name':{'type':Sequelize[_0x8dba('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x8dba('0x2')]},'description':{'type':Sequelize[_0x8dba('0x2')]},'status':{'type':Sequelize[_0x8dba('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8dba('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 90139c1..d7fc791 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 _0x19e3=['mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','name','send','index','Automation','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','pick','filter','nolimit','addActions','Action','getActions','eml-format','rimraf','request-promise','bluebird'];(function(_0x455d72,_0xeec814){var _0x54343b=function(_0x65e0f2){while(--_0x65e0f2){_0x455d72['push'](_0x455d72['shift']());}};_0x54343b(++_0xeec814);}(_0x19e3,0x1e8));var _0x319e=function(_0x48c147,_0x2aa77f){_0x48c147=_0x48c147-0x0;var _0x4b1a3b=_0x19e3[_0x48c147];return _0x4b1a3b;};'use strict';var emlformat=require(_0x319e('0x0'));var rimraf=require(_0x319e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x319e('0x2'));var moment=require('moment');var BPromise=require(_0x319e('0x3'));var Mustache=require(_0x319e('0x4'));var util=require(_0x319e('0x5'));var path=require(_0x319e('0x6'));var sox=require(_0x319e('0x7'));var csv=require(_0x319e('0x8'));var ejs=require(_0x319e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x319e('0xa'));var crypto=require(_0x319e('0xb'));var jsforce=require(_0x319e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x319e('0x8'));var querystring=require(_0x319e('0xd'));var Papa=require(_0x319e('0xe'));var Redis=require('ioredis');var authService=require(_0x319e('0xf'));var qs=require(_0x319e('0x10'));var as=require(_0x319e('0x11'));var hardwareService=require(_0x319e('0x12'));var logger=require('../../config/logger')(_0x319e('0x13'));var utils=require(_0x319e('0x14'));var config=require(_0x319e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x319e('0x16'))['db'];function respondWithStatusCode(_0x35b4a1,_0x3d0a4c){_0x3d0a4c=_0x3d0a4c||0xcc;return function(_0x5385f7){if(_0x5385f7){return _0x35b4a1[_0x319e('0x17')](_0x3d0a4c);}return _0x35b4a1['status'](_0x3d0a4c)[_0x319e('0x18')]();};}function respondWithResult(_0x2014bd,_0x42c3d0){_0x42c3d0=_0x42c3d0||0xc8;return function(_0x1bbf9d){if(_0x1bbf9d){return _0x2014bd[_0x319e('0x19')](_0x42c3d0)[_0x319e('0x1a')](_0x1bbf9d);}};}function respondWithFilteredResult(_0x41ffea,_0x30d2c9){return function(_0xbcb9c1){if(_0xbcb9c1){var _0x1bc0d8=typeof _0x30d2c9['offset']===_0x319e('0x1b')&&typeof _0x30d2c9[_0x319e('0x1c')]===_0x319e('0x1b');var _0xf9a7da=_0xbcb9c1[_0x319e('0x1d')];var _0x1154b4=_0x1bc0d8?0x0:_0x30d2c9[_0x319e('0x1e')];var _0x3c3633=_0x1bc0d8?_0xbcb9c1['count']:_0x30d2c9['offset']+_0x30d2c9[_0x319e('0x1c')];var _0x1b240d;if(_0x3c3633>=_0xf9a7da){_0x3c3633=_0xf9a7da;_0x1b240d=0xc8;}else{_0x1b240d=0xce;}_0x41ffea[_0x319e('0x19')](_0x1b240d);return _0x41ffea['set'](_0x319e('0x1f'),_0x1154b4+'-'+_0x3c3633+'/'+_0xf9a7da)[_0x319e('0x1a')](_0xbcb9c1);}return null;};}function patchUpdates(_0x2fa583){return function(_0x29f477){try{jsonpatch[_0x319e('0x20')](_0x29f477,_0x2fa583,!![]);}catch(_0x14a25c){return BPromise[_0x319e('0x21')](_0x14a25c);}return _0x29f477['save']();};}function saveUpdates(_0xede7fb,_0x5b1ef4){return function(_0x4145fd){if(_0x4145fd){return _0x4145fd[_0x319e('0x22')](_0xede7fb)[_0x319e('0x23')](function(_0x94398c){return _0x94398c;});}return null;};}function removeEntity(_0x595f02,_0x4ed22a){return function(_0x3b70f5){if(_0x3b70f5){return _0x3b70f5[_0x319e('0x24')]()[_0x319e('0x23')](function(){_0x595f02[_0x319e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x496c07,_0x32a840){return function(_0x26691d){if(!_0x26691d){_0x496c07[_0x319e('0x17')](0x194);}return _0x26691d;};}function handleError(_0x11e03a,_0x23eb71){_0x23eb71=_0x23eb71||0x1f4;return function(_0x29dcc3){logger[_0x319e('0x25')](_0x29dcc3['stack']);if(_0x29dcc3[_0x319e('0x26')]){delete _0x29dcc3[_0x319e('0x26')];}_0x11e03a[_0x319e('0x19')](_0x23eb71)[_0x319e('0x27')](_0x29dcc3);};}exports[_0x319e('0x28')]=function(_0xd71007,_0xa806ad){var _0x36152e={},_0x2544c8={},_0x613948={'count':0x0,'rows':[]};var _0x4c3b2d=_['map'](db[_0x319e('0x29')]['rawAttributes'],function(_0x128d93){return{'name':_0x128d93[_0x319e('0x2a')],'type':_0x128d93['type']['key']};});_0x2544c8['model']=_[_0x319e('0x2b')](_0x4c3b2d,'name');_0x2544c8['query']=_[_0x319e('0x2c')](_0xd71007[_0x319e('0x2d')]);_0x2544c8[_0x319e('0x2e')]=_[_0x319e('0x2f')](_0x2544c8[_0x319e('0x30')],_0x2544c8['query']);_0x36152e[_0x319e('0x31')]=_[_0x319e('0x2f')](_0x2544c8[_0x319e('0x30')],qs[_0x319e('0x32')](_0xd71007['query'][_0x319e('0x32')]));_0x36152e[_0x319e('0x31')]=_0x36152e[_0x319e('0x31')][_0x319e('0x33')]?_0x36152e[_0x319e('0x31')]:_0x2544c8[_0x319e('0x30')];if(!_0xd71007[_0x319e('0x2d')][_0x319e('0x34')]('nolimit')){_0x36152e[_0x319e('0x1c')]=qs[_0x319e('0x1c')](_0xd71007[_0x319e('0x2d')][_0x319e('0x1c')]);_0x36152e['offset']=qs['offset'](_0xd71007['query']['offset']);}_0x36152e[_0x319e('0x35')]=qs[_0x319e('0x36')](_0xd71007['query']['sort']);_0x36152e[_0x319e('0x37')]=qs[_0x319e('0x2e')](_['pick'](_0xd71007['query'],_0x2544c8[_0x319e('0x2e')]),_0x4c3b2d);if(_0xd71007[_0x319e('0x2d')]['filter']){_0x36152e[_0x319e('0x37')]=_[_0x319e('0x38')](_0x36152e[_0x319e('0x37')],{'$or':_['map'](_0x4c3b2d,function(_0x5d5e42){if(_0x5d5e42[_0x319e('0x39')]!==_0x319e('0x3a')){var _0x2314a3={};_0x2314a3[_0x5d5e42[_0x319e('0x26')]]={'$like':'%'+_0xd71007[_0x319e('0x2d')]['filter']+'%'};return _0x2314a3;}})});}_0x36152e=_['merge']({},_0x36152e,_0xd71007[_0x319e('0x3b')]);var _0x202f1d={'where':_0x36152e[_0x319e('0x37')]};return db[_0x319e('0x29')][_0x319e('0x1d')](_0x202f1d)[_0x319e('0x23')](function(_0x37ed6a){_0x613948[_0x319e('0x1d')]=_0x37ed6a;if(_0xd71007[_0x319e('0x2d')][_0x319e('0x3c')]){_0x36152e['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x36152e);})[_0x319e('0x23')](function(_0x48695b){_0x613948[_0x319e('0x3d')]=_0x48695b;return _0x613948;})['then'](respondWithFilteredResult(_0xa806ad,_0x36152e))[_0x319e('0x3e')](handleError(_0xa806ad,null));};exports[_0x319e('0x3f')]=function(_0x41320a,_0x6d7bc7){var _0x51fee1={'raw':![],'where':{'id':_0x41320a[_0x319e('0x40')]['id']}},_0x2b59ab={};_0x2b59ab['model']=_[_0x319e('0x2c')](db['Automation'][_0x319e('0x41')]);_0x2b59ab[_0x319e('0x2d')]=_['keys'](_0x41320a[_0x319e('0x2d')]);_0x2b59ab[_0x319e('0x2e')]=_['intersection'](_0x2b59ab['model'],_0x2b59ab[_0x319e('0x2d')]);_0x51fee1[_0x319e('0x31')]=_[_0x319e('0x2f')](_0x2b59ab[_0x319e('0x30')],qs['fields'](_0x41320a[_0x319e('0x2d')][_0x319e('0x32')]));_0x51fee1['attributes']=_0x51fee1[_0x319e('0x31')][_0x319e('0x33')]?_0x51fee1['attributes']:_0x2b59ab[_0x319e('0x30')];if(_0x41320a['query'][_0x319e('0x3c')]){_0x51fee1[_0x319e('0x42')]=[{'all':!![]}];}_0x51fee1=_['merge']({},_0x51fee1,_0x41320a['options']);return db[_0x319e('0x29')][_0x319e('0x43')](_0x51fee1)['then'](handleEntityNotFound(_0x6d7bc7,null))[_0x319e('0x23')](respondWithResult(_0x6d7bc7,null))[_0x319e('0x3e')](handleError(_0x6d7bc7,null));};exports[_0x319e('0x44')]=function(_0x492589,_0x2152c9){return db[_0x319e('0x29')]['create'](_0x492589['body'],{})[_0x319e('0x23')](respondWithResult(_0x2152c9,0xc9))['catch'](handleError(_0x2152c9,null));};exports[_0x319e('0x22')]=function(_0x1dca36,_0x4e9f1f){if(_0x1dca36[_0x319e('0x45')]['id']){delete _0x1dca36['body']['id'];}return db['Automation'][_0x319e('0x43')]({'where':{'id':_0x1dca36['params']['id']}})[_0x319e('0x23')](handleEntityNotFound(_0x4e9f1f,null))[_0x319e('0x23')](saveUpdates(_0x1dca36['body'],null))[_0x319e('0x23')](respondWithResult(_0x4e9f1f,null))[_0x319e('0x3e')](handleError(_0x4e9f1f,null));};exports['destroy']=function(_0x1b7716,_0x47f666){return db[_0x319e('0x29')][_0x319e('0x43')]({'where':{'id':_0x1b7716[_0x319e('0x40')]['id']}})[_0x319e('0x23')](handleEntityNotFound(_0x47f666,null))[_0x319e('0x23')](removeEntity(_0x47f666,null))[_0x319e('0x3e')](handleError(_0x47f666,null));};exports[_0x319e('0x46')]=function(_0x163d06,_0x522103,_0x3837d4){return db[_0x319e('0x47')][_0x319e('0x43')]({'where':{'id':_0x163d06['params']['id']}})[_0x319e('0x23')](handleEntityNotFound(_0x522103,null))[_0x319e('0x23')](function(_0x8c8602){if(_0x8c8602){return _0x8c8602[_0x319e('0x46')](_0x163d06[_0x319e('0x45')][_0x319e('0x48')],_[_0x319e('0x49')](_0x163d06[_0x319e('0x45')],['ids','id'])||{});}})[_0x319e('0x23')](respondWithResult(_0x522103,null))[_0x319e('0x3e')](handleError(_0x522103,null));};exports[_0x319e('0x4a')]=function(_0x23c2d6,_0x1bda81,_0x2c4549){var _0x5e5331={};var _0x585606={};var _0x4e4961;var _0x3a8d56;return db[_0x319e('0x29')][_0x319e('0x4b')]({'where':{'id':_0x23c2d6['params']['id']}})['then'](handleEntityNotFound(_0x1bda81,null))[_0x319e('0x23')](function(_0x103ba9){if(_0x103ba9){_0x4e4961=_0x103ba9;_0x585606[_0x319e('0x30')]=_[_0x319e('0x2c')](db[_0x319e('0x47')][_0x319e('0x41')]);_0x585606[_0x319e('0x2d')]=_[_0x319e('0x2c')](_0x23c2d6[_0x319e('0x2d')]);_0x585606['filters']=_[_0x319e('0x2f')](_0x585606['model'],_0x585606[_0x319e('0x2d')]);_0x5e5331['attributes']=_[_0x319e('0x2f')](_0x585606[_0x319e('0x30')],qs[_0x319e('0x32')](_0x23c2d6[_0x319e('0x2d')][_0x319e('0x32')]));_0x5e5331[_0x319e('0x31')]=_0x5e5331[_0x319e('0x31')][_0x319e('0x33')]?_0x5e5331[_0x319e('0x31')]:_0x585606['model'];_0x5e5331[_0x319e('0x35')]=qs[_0x319e('0x36')](_0x23c2d6['query'][_0x319e('0x36')]);_0x5e5331[_0x319e('0x37')]=qs[_0x319e('0x2e')](_[_0x319e('0x4c')](_0x23c2d6['query'],_0x585606['filters']));if(_0x23c2d6[_0x319e('0x2d')][_0x319e('0x4d')]){_0x5e5331['where']=_['merge'](_0x5e5331[_0x319e('0x37')],{'$or':_['map'](_0x5e5331[_0x319e('0x31')],function(_0x20fd0e){var _0x578b50={};_0x578b50[_0x20fd0e]={'$like':'%'+_0x23c2d6[_0x319e('0x2d')][_0x319e('0x4d')]+'%'};return _0x578b50;})});}_0x5e5331=_['merge']({},_0x5e5331,_0x23c2d6['options']);return _0x4e4961[_0x319e('0x4a')](_0x5e5331);}})['then'](function(_0x54c9aa){if(_0x54c9aa){_0x3a8d56=_0x54c9aa[_0x319e('0x33')];if(!_0x23c2d6[_0x319e('0x2d')][_0x319e('0x34')](_0x319e('0x4e'))){_0x5e5331[_0x319e('0x1c')]=qs['limit'](_0x23c2d6['query'][_0x319e('0x1c')]);_0x5e5331['offset']=qs[_0x319e('0x1e')](_0x23c2d6[_0x319e('0x2d')]['offset']);}return _0x4e4961[_0x319e('0x4a')](_0x5e5331);}})[_0x319e('0x23')](function(_0x35028a){if(_0x35028a){return _0x35028a?{'count':_0x3a8d56,'rows':_0x35028a}:null;}})['then'](respondWithResult(_0x1bda81,null))[_0x319e('0x3e')](handleError(_0x1bda81,null));};exports[_0x319e('0x4f')]=function(_0x172503,_0x12a5ed,_0x548e99){return db['Action']['find']({'where':{'id':_0x172503['params']['id']}})[_0x319e('0x23')](handleEntityNotFound(_0x12a5ed,null))[_0x319e('0x23')](function(_0x6d7753){if(_0x6d7753){return _0x6d7753[_0x319e('0x4f')](_0x172503[_0x319e('0x45')][_0x319e('0x48')],_[_0x319e('0x49')](_0x172503[_0x319e('0x45')],[_0x319e('0x48'),'id'])||{});}})[_0x319e('0x23')](respondWithResult(_0x12a5ed,null))[_0x319e('0x3e')](handleError(_0x12a5ed,null));};exports['getActions']=function(_0x2678af,_0x326875,_0x1ea841){var _0x5e890e={};var _0x28bca3={};var _0x3c9b69;var _0x4f859e;return db['Automation'][_0x319e('0x4b')]({'where':{'id':_0x2678af[_0x319e('0x40')]['id']}})[_0x319e('0x23')](handleEntityNotFound(_0x326875,null))['then'](function(_0x282362){if(_0x282362){_0x3c9b69=_0x282362;_0x28bca3['model']=_[_0x319e('0x2c')](db[_0x319e('0x50')][_0x319e('0x41')]);_0x28bca3[_0x319e('0x2d')]=_[_0x319e('0x2c')](_0x2678af[_0x319e('0x2d')]);_0x28bca3[_0x319e('0x2e')]=_['intersection'](_0x28bca3[_0x319e('0x30')],_0x28bca3['query']);_0x5e890e['attributes']=_['intersection'](_0x28bca3['model'],qs[_0x319e('0x32')](_0x2678af['query'][_0x319e('0x32')]));_0x5e890e[_0x319e('0x31')]=_0x5e890e['attributes'][_0x319e('0x33')]?_0x5e890e['attributes']:_0x28bca3[_0x319e('0x30')];_0x5e890e['order']=qs[_0x319e('0x36')](_0x2678af[_0x319e('0x2d')][_0x319e('0x36')]);_0x5e890e[_0x319e('0x37')]=qs['filters'](_['pick'](_0x2678af[_0x319e('0x2d')],_0x28bca3[_0x319e('0x2e')]));if(_0x2678af['query'][_0x319e('0x4d')]){_0x5e890e[_0x319e('0x37')]=_[_0x319e('0x38')](_0x5e890e[_0x319e('0x37')],{'$or':_[_0x319e('0x2b')](_0x5e890e[_0x319e('0x31')],function(_0x3f36eb){var _0x13e00a={};_0x13e00a[_0x3f36eb]={'$like':'%'+_0x2678af[_0x319e('0x2d')][_0x319e('0x4d')]+'%'};return _0x13e00a;})});}_0x5e890e=_['merge']({},_0x5e890e,_0x2678af[_0x319e('0x3b')]);return _0x3c9b69[_0x319e('0x51')](_0x5e890e);}})[_0x319e('0x23')](function(_0xeccb08){if(_0xeccb08){_0x4f859e=_0xeccb08[_0x319e('0x33')];if(!_0x2678af[_0x319e('0x2d')][_0x319e('0x34')](_0x319e('0x4e'))){_0x5e890e[_0x319e('0x1c')]=qs[_0x319e('0x1c')](_0x2678af[_0x319e('0x2d')][_0x319e('0x1c')]);_0x5e890e['offset']=qs[_0x319e('0x1e')](_0x2678af[_0x319e('0x2d')][_0x319e('0x1e')]);}return _0x3c9b69['getActions'](_0x5e890e);}})[_0x319e('0x23')](function(_0x1a527b){if(_0x1a527b){return _0x1a527b?{'count':_0x4f859e,'rows':_0x1a527b}:null;}})[_0x319e('0x23')](respondWithResult(_0x326875,null))['catch'](handleError(_0x326875,null));}; \ No newline at end of file +var _0x3e03=['type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','destroy','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','addActions','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','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','end','status','json','undefined','offset','count','set','Content-Range','reject','save','then','sendStatus','error','name','send','map','Automation','rawAttributes'];(function(_0x437e16,_0x155dd6){var _0x5f0594=function(_0x210613){while(--_0x210613){_0x437e16['push'](_0x437e16['shift']());}};_0x5f0594(++_0x155dd6);}(_0x3e03,0xd2));var _0x33e0=function(_0x5bff9e,_0x39ea3a){_0x5bff9e=_0x5bff9e-0x0;var _0x7f42ef=_0x3e03[_0x5bff9e];return _0x7f42ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x33e0('0x0'));var jsonpatch=require(_0x33e0('0x1'));var rp=require(_0x33e0('0x2'));var moment=require(_0x33e0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x33e0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x33e0('0x5'));var csv=require(_0x33e0('0x6'));var ejs=require(_0x33e0('0x7'));var fs=require('fs');var fs_extra=require(_0x33e0('0x8'));var _=require('lodash');var squel=require(_0x33e0('0x9'));var crypto=require(_0x33e0('0xa'));var jsforce=require(_0x33e0('0xb'));var deskjs=require(_0x33e0('0xc'));var toCsv=require(_0x33e0('0x6'));var querystring=require(_0x33e0('0xd'));var Papa=require(_0x33e0('0xe'));var Redis=require(_0x33e0('0xf'));var authService=require(_0x33e0('0x10'));var qs=require(_0x33e0('0x11'));var as=require(_0x33e0('0x12'));var hardwareService=require(_0x33e0('0x13'));var logger=require(_0x33e0('0x14'))(_0x33e0('0x15'));var utils=require('../../config/utils');var config=require(_0x33e0('0x16'));var licenseUtil=require(_0x33e0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5214e0,_0x2fb430){_0x2fb430=_0x2fb430||0xcc;return function(_0x2b8a85){if(_0x2b8a85){return _0x5214e0['sendStatus'](_0x2fb430);}return _0x5214e0['status'](_0x2fb430)[_0x33e0('0x18')]();};}function respondWithResult(_0x448755,_0x3eacc0){_0x3eacc0=_0x3eacc0||0xc8;return function(_0x3dc8cb){if(_0x3dc8cb){return _0x448755[_0x33e0('0x19')](_0x3eacc0)[_0x33e0('0x1a')](_0x3dc8cb);}};}function respondWithFilteredResult(_0x3d120f,_0x486f34){return function(_0x3e33a4){if(_0x3e33a4){var _0x4bd25e=typeof _0x486f34['offset']===_0x33e0('0x1b')&&typeof _0x486f34['limit']===_0x33e0('0x1b');var _0x1aafb7=_0x3e33a4['count'];var _0x6ec072=_0x4bd25e?0x0:_0x486f34[_0x33e0('0x1c')];var _0x43017f=_0x4bd25e?_0x3e33a4[_0x33e0('0x1d')]:_0x486f34[_0x33e0('0x1c')]+_0x486f34['limit'];var _0x250001;if(_0x43017f>=_0x1aafb7){_0x43017f=_0x1aafb7;_0x250001=0xc8;}else{_0x250001=0xce;}_0x3d120f[_0x33e0('0x19')](_0x250001);return _0x3d120f[_0x33e0('0x1e')](_0x33e0('0x1f'),_0x6ec072+'-'+_0x43017f+'/'+_0x1aafb7)[_0x33e0('0x1a')](_0x3e33a4);}return null;};}function patchUpdates(_0xb0640c){return function(_0x4d7f4e){try{jsonpatch['apply'](_0x4d7f4e,_0xb0640c,!![]);}catch(_0x220a8b){return BPromise[_0x33e0('0x20')](_0x220a8b);}return _0x4d7f4e[_0x33e0('0x21')]();};}function saveUpdates(_0x5eb099,_0x5c6e07){return function(_0x5021c3){if(_0x5021c3){return _0x5021c3['update'](_0x5eb099)[_0x33e0('0x22')](function(_0x47bb2f){return _0x47bb2f;});}return null;};}function removeEntity(_0x5e618c,_0x4e9f97){return function(_0x35c9e1){if(_0x35c9e1){return _0x35c9e1['destroy']()[_0x33e0('0x22')](function(){_0x5e618c[_0x33e0('0x19')](0xcc)[_0x33e0('0x18')]();});}};}function handleEntityNotFound(_0x3bcc6a,_0x1a9106){return function(_0x42458c){if(!_0x42458c){_0x3bcc6a[_0x33e0('0x23')](0x194);}return _0x42458c;};}function handleError(_0x35d824,_0x591d77){_0x591d77=_0x591d77||0x1f4;return function(_0xe5234){logger[_0x33e0('0x24')](_0xe5234['stack']);if(_0xe5234[_0x33e0('0x25')]){delete _0xe5234[_0x33e0('0x25')];}_0x35d824[_0x33e0('0x19')](_0x591d77)[_0x33e0('0x26')](_0xe5234);};}exports['index']=function(_0x13c5cf,_0x45b429){var _0x344317={},_0xcc0e9a={},_0x56aef1={'count':0x0,'rows':[]};var _0x2ea991=_[_0x33e0('0x27')](db[_0x33e0('0x28')][_0x33e0('0x29')],function(_0x43458a){return{'name':_0x43458a['fieldName'],'type':_0x43458a[_0x33e0('0x2a')][_0x33e0('0x2b')]};});_0xcc0e9a[_0x33e0('0x2c')]=_[_0x33e0('0x27')](_0x2ea991,_0x33e0('0x25'));_0xcc0e9a['query']=_[_0x33e0('0x2d')](_0x13c5cf[_0x33e0('0x2e')]);_0xcc0e9a[_0x33e0('0x2f')]=_['intersection'](_0xcc0e9a[_0x33e0('0x2c')],_0xcc0e9a[_0x33e0('0x2e')]);_0x344317['attributes']=_[_0x33e0('0x30')](_0xcc0e9a['model'],qs['fields'](_0x13c5cf['query'][_0x33e0('0x31')]));_0x344317[_0x33e0('0x32')]=_0x344317['attributes'][_0x33e0('0x33')]?_0x344317[_0x33e0('0x32')]:_0xcc0e9a['model'];if(!_0x13c5cf[_0x33e0('0x2e')][_0x33e0('0x34')]('nolimit')){_0x344317[_0x33e0('0x35')]=qs['limit'](_0x13c5cf['query'][_0x33e0('0x35')]);_0x344317['offset']=qs['offset'](_0x13c5cf[_0x33e0('0x2e')][_0x33e0('0x1c')]);}_0x344317[_0x33e0('0x36')]=qs['sort'](_0x13c5cf[_0x33e0('0x2e')][_0x33e0('0x37')]);_0x344317[_0x33e0('0x38')]=qs[_0x33e0('0x2f')](_[_0x33e0('0x39')](_0x13c5cf[_0x33e0('0x2e')],_0xcc0e9a['filters']),_0x2ea991);if(_0x13c5cf['query'][_0x33e0('0x3a')]){_0x344317['where']=_[_0x33e0('0x3b')](_0x344317[_0x33e0('0x38')],{'$or':_[_0x33e0('0x27')](_0x2ea991,function(_0x387029){if(_0x387029[_0x33e0('0x2a')]!==_0x33e0('0x3c')){var _0x100760={};_0x100760[_0x387029['name']]={'$like':'%'+_0x13c5cf['query']['filter']+'%'};return _0x100760;}})});}_0x344317=_[_0x33e0('0x3b')]({},_0x344317,_0x13c5cf[_0x33e0('0x3d')]);var _0x55e206={'where':_0x344317['where']};return db[_0x33e0('0x28')]['count'](_0x55e206)[_0x33e0('0x22')](function(_0x3e0c60){_0x56aef1[_0x33e0('0x1d')]=_0x3e0c60;if(_0x13c5cf['query']['includeAll']){_0x344317[_0x33e0('0x3e')]=[{'all':!![]}];}return db['Automation'][_0x33e0('0x3f')](_0x344317);})['then'](function(_0x9b0952){_0x56aef1[_0x33e0('0x40')]=_0x9b0952;return _0x56aef1;})['then'](respondWithFilteredResult(_0x45b429,_0x344317))[_0x33e0('0x41')](handleError(_0x45b429,null));};exports[_0x33e0('0x42')]=function(_0x13ec54,_0x29d6cc){var _0x45533c={'raw':![],'where':{'id':_0x13ec54['params']['id']}},_0x3ef275={};_0x3ef275[_0x33e0('0x2c')]=_[_0x33e0('0x2d')](db[_0x33e0('0x28')][_0x33e0('0x29')]);_0x3ef275[_0x33e0('0x2e')]=_[_0x33e0('0x2d')](_0x13ec54[_0x33e0('0x2e')]);_0x3ef275[_0x33e0('0x2f')]=_['intersection'](_0x3ef275[_0x33e0('0x2c')],_0x3ef275['query']);_0x45533c[_0x33e0('0x32')]=_[_0x33e0('0x30')](_0x3ef275['model'],qs[_0x33e0('0x31')](_0x13ec54[_0x33e0('0x2e')][_0x33e0('0x31')]));_0x45533c[_0x33e0('0x32')]=_0x45533c[_0x33e0('0x32')][_0x33e0('0x33')]?_0x45533c[_0x33e0('0x32')]:_0x3ef275[_0x33e0('0x2c')];if(_0x13ec54[_0x33e0('0x2e')][_0x33e0('0x43')]){_0x45533c[_0x33e0('0x3e')]=[{'all':!![]}];}_0x45533c=_[_0x33e0('0x3b')]({},_0x45533c,_0x13ec54['options']);return db[_0x33e0('0x28')][_0x33e0('0x44')](_0x45533c)[_0x33e0('0x22')](handleEntityNotFound(_0x29d6cc,null))['then'](respondWithResult(_0x29d6cc,null))[_0x33e0('0x41')](handleError(_0x29d6cc,null));};exports['create']=function(_0x42ed4d,_0x33af8b){return db[_0x33e0('0x28')][_0x33e0('0x45')](_0x42ed4d[_0x33e0('0x46')],{})[_0x33e0('0x22')](respondWithResult(_0x33af8b,0xc9))[_0x33e0('0x41')](handleError(_0x33af8b,null));};exports[_0x33e0('0x47')]=function(_0x57b569,_0x3f9abd){if(_0x57b569[_0x33e0('0x46')]['id']){delete _0x57b569['body']['id'];}return db[_0x33e0('0x28')][_0x33e0('0x44')]({'where':{'id':_0x57b569[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x3f9abd,null))[_0x33e0('0x22')](saveUpdates(_0x57b569[_0x33e0('0x46')],null))[_0x33e0('0x22')](respondWithResult(_0x3f9abd,null))[_0x33e0('0x41')](handleError(_0x3f9abd,null));};exports[_0x33e0('0x49')]=function(_0x17526c,_0x1ed1b4){return db[_0x33e0('0x28')][_0x33e0('0x44')]({'where':{'id':_0x17526c[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x1ed1b4,null))[_0x33e0('0x22')](removeEntity(_0x1ed1b4,null))[_0x33e0('0x41')](handleError(_0x1ed1b4,null));};exports[_0x33e0('0x4a')]=function(_0x29adf9,_0x54f3ed,_0xca7656){return db[_0x33e0('0x4b')][_0x33e0('0x44')]({'where':{'id':_0x29adf9[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x54f3ed,null))['then'](function(_0x1f6af1){if(_0x1f6af1){return _0x1f6af1[_0x33e0('0x4a')](_0x29adf9['body'][_0x33e0('0x4c')],_[_0x33e0('0x4d')](_0x29adf9[_0x33e0('0x46')],['ids','id'])||{});}})[_0x33e0('0x22')](respondWithResult(_0x54f3ed,null))[_0x33e0('0x41')](handleError(_0x54f3ed,null));};exports[_0x33e0('0x4e')]=function(_0x3d6741,_0x3bc1c5,_0xc79c61){var _0x49c1c0={};var _0x5e0242={};var _0x161480;var _0x1187f3;return db[_0x33e0('0x28')][_0x33e0('0x4f')]({'where':{'id':_0x3d6741[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x3bc1c5,null))[_0x33e0('0x22')](function(_0x54a829){if(_0x54a829){_0x161480=_0x54a829;_0x5e0242['model']=_[_0x33e0('0x2d')](db[_0x33e0('0x4b')]['rawAttributes']);_0x5e0242['query']=_[_0x33e0('0x2d')](_0x3d6741['query']);_0x5e0242[_0x33e0('0x2f')]=_[_0x33e0('0x30')](_0x5e0242[_0x33e0('0x2c')],_0x5e0242[_0x33e0('0x2e')]);_0x49c1c0[_0x33e0('0x32')]=_[_0x33e0('0x30')](_0x5e0242[_0x33e0('0x2c')],qs['fields'](_0x3d6741[_0x33e0('0x2e')][_0x33e0('0x31')]));_0x49c1c0[_0x33e0('0x32')]=_0x49c1c0['attributes']['length']?_0x49c1c0[_0x33e0('0x32')]:_0x5e0242[_0x33e0('0x2c')];_0x49c1c0[_0x33e0('0x36')]=qs['sort'](_0x3d6741['query'][_0x33e0('0x37')]);_0x49c1c0[_0x33e0('0x38')]=qs[_0x33e0('0x2f')](_[_0x33e0('0x39')](_0x3d6741[_0x33e0('0x2e')],_0x5e0242[_0x33e0('0x2f')]));if(_0x3d6741[_0x33e0('0x2e')][_0x33e0('0x3a')]){_0x49c1c0[_0x33e0('0x38')]=_[_0x33e0('0x3b')](_0x49c1c0[_0x33e0('0x38')],{'$or':_['map'](_0x49c1c0[_0x33e0('0x32')],function(_0x5a2b41){var _0x2ccb11={};_0x2ccb11[_0x5a2b41]={'$like':'%'+_0x3d6741[_0x33e0('0x2e')]['filter']+'%'};return _0x2ccb11;})});}_0x49c1c0=_[_0x33e0('0x3b')]({},_0x49c1c0,_0x3d6741[_0x33e0('0x3d')]);return _0x161480[_0x33e0('0x4e')](_0x49c1c0);}})[_0x33e0('0x22')](function(_0x2ab6ae){if(_0x2ab6ae){_0x1187f3=_0x2ab6ae[_0x33e0('0x33')];if(!_0x3d6741['query'][_0x33e0('0x34')](_0x33e0('0x50'))){_0x49c1c0[_0x33e0('0x35')]=qs['limit'](_0x3d6741[_0x33e0('0x2e')][_0x33e0('0x35')]);_0x49c1c0[_0x33e0('0x1c')]=qs[_0x33e0('0x1c')](_0x3d6741['query'][_0x33e0('0x1c')]);}return _0x161480['getConditions'](_0x49c1c0);}})[_0x33e0('0x22')](function(_0x41b9ed){if(_0x41b9ed){return _0x41b9ed?{'count':_0x1187f3,'rows':_0x41b9ed}:null;}})[_0x33e0('0x22')](respondWithResult(_0x3bc1c5,null))[_0x33e0('0x41')](handleError(_0x3bc1c5,null));};exports[_0x33e0('0x51')]=function(_0x469874,_0x4c05ad,_0x638c00){return db[_0x33e0('0x52')][_0x33e0('0x44')]({'where':{'id':_0x469874['params']['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x4c05ad,null))['then'](function(_0x266311){if(_0x266311){return _0x266311['addActions'](_0x469874['body'][_0x33e0('0x4c')],_[_0x33e0('0x4d')](_0x469874[_0x33e0('0x46')],[_0x33e0('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x4c05ad,null))['catch'](handleError(_0x4c05ad,null));};exports[_0x33e0('0x53')]=function(_0x78c5b5,_0x44796f,_0x378542){var _0x551c1a={};var _0x49e283={};var _0xbd8670;var _0x2f61fd;return db[_0x33e0('0x28')]['findOne']({'where':{'id':_0x78c5b5[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x44796f,null))[_0x33e0('0x22')](function(_0x51bd58){if(_0x51bd58){_0xbd8670=_0x51bd58;_0x49e283['model']=_['keys'](db[_0x33e0('0x52')][_0x33e0('0x29')]);_0x49e283[_0x33e0('0x2e')]=_['keys'](_0x78c5b5['query']);_0x49e283[_0x33e0('0x2f')]=_['intersection'](_0x49e283[_0x33e0('0x2c')],_0x49e283['query']);_0x551c1a[_0x33e0('0x32')]=_['intersection'](_0x49e283[_0x33e0('0x2c')],qs[_0x33e0('0x31')](_0x78c5b5[_0x33e0('0x2e')][_0x33e0('0x31')]));_0x551c1a['attributes']=_0x551c1a['attributes']['length']?_0x551c1a[_0x33e0('0x32')]:_0x49e283['model'];_0x551c1a['order']=qs[_0x33e0('0x37')](_0x78c5b5['query'][_0x33e0('0x37')]);_0x551c1a['where']=qs[_0x33e0('0x2f')](_[_0x33e0('0x39')](_0x78c5b5['query'],_0x49e283[_0x33e0('0x2f')]));if(_0x78c5b5[_0x33e0('0x2e')]['filter']){_0x551c1a[_0x33e0('0x38')]=_[_0x33e0('0x3b')](_0x551c1a['where'],{'$or':_[_0x33e0('0x27')](_0x551c1a['attributes'],function(_0xe55ae5){var _0x1700ad={};_0x1700ad[_0xe55ae5]={'$like':'%'+_0x78c5b5[_0x33e0('0x2e')][_0x33e0('0x3a')]+'%'};return _0x1700ad;})});}_0x551c1a=_[_0x33e0('0x3b')]({},_0x551c1a,_0x78c5b5[_0x33e0('0x3d')]);return _0xbd8670[_0x33e0('0x53')](_0x551c1a);}})['then'](function(_0x1452cb){if(_0x1452cb){_0x2f61fd=_0x1452cb[_0x33e0('0x33')];if(!_0x78c5b5[_0x33e0('0x2e')]['hasOwnProperty']('nolimit')){_0x551c1a['limit']=qs['limit'](_0x78c5b5[_0x33e0('0x2e')][_0x33e0('0x35')]);_0x551c1a[_0x33e0('0x1c')]=qs[_0x33e0('0x1c')](_0x78c5b5['query'][_0x33e0('0x1c')]);}return _0xbd8670[_0x33e0('0x53')](_0x551c1a);}})[_0x33e0('0x22')](function(_0x13ca5c){if(_0x13ca5c){return _0x13ca5c?{'count':_0x2f61fd,'rows':_0x13ca5c}:null;}})['then'](respondWithResult(_0x44796f,null))[_0x33e0('0x41')](handleError(_0x44796f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ffc63bc..a1a88f3 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 _0xfbf9=['request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','tools_automations','lodash','../../config/logger','api'];(function(_0x4dc520,_0x152c05){var _0x48a121=function(_0x280801){while(--_0x280801){_0x4dc520['push'](_0x4dc520['shift']());}};_0x48a121(++_0x152c05);}(_0xfbf9,0x9d));var _0x9fbf=function(_0x7074d5,_0x427953){_0x7074d5=_0x7074d5-0x0;var _0xced075=_0xfbf9[_0x7074d5];return _0xced075;};'use strict';var _=require(_0x9fbf('0x0'));var util=require('util');var logger=require(_0x9fbf('0x1'))(_0x9fbf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9fbf('0x3'));var fs=require('fs');var path=require(_0x9fbf('0x4'));var rimraf=require(_0x9fbf('0x5'));var config=require(_0x9fbf('0x6'));var attributes=require(_0x9fbf('0x7'));module[_0x9fbf('0x8')]=function(_0x2aa471,_0x108ae3){return _0x2aa471['define']('Automation',attributes,{'tableName':_0x9fbf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa63=['./automation.attributes','exports','tools_automations','util','moment','rimraf','../../config/environment'];(function(_0x25fdf0,_0x480a7e){var _0x5f459d=function(_0x28dadd){while(--_0x28dadd){_0x25fdf0['push'](_0x25fdf0['shift']());}};_0x5f459d(++_0x480a7e);}(_0xfa63,0x137));var _0x3fa6=function(_0x3e547a,_0x1b840d){_0x3e547a=_0x3e547a-0x0;var _0x280827=_0xfa63[_0x3e547a];return _0x280827;};'use strict';var _=require('lodash');var util=require(_0x3fa6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3fa6('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3fa6('0x2'));var config=require(_0x3fa6('0x3'));var attributes=require(_0x3fa6('0x4'));module[_0x3fa6('0x5')]=function(_0x13f1c3,_0x5979c1){return _0x13f1c3['define']('Automation',attributes,{'tableName':_0x3fa6('0x6'),'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 f04535d..1f89251 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 _0x9805=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x432546,_0x3a28da){var _0x331a54=function(_0x46f73e){while(--_0x46f73e){_0x432546['push'](_0x432546['shift']());}};_0x331a54(++_0x3a28da);}(_0x9805,0x18f));var _0x5980=function(_0x26cb03,_0x38d271){_0x26cb03=_0x26cb03-0x0;var _0x5b7ac9=_0x9805[_0x26cb03];return _0x5b7ac9;};'use strict';var _=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var moment=require(_0x5980('0x2'));var BPromise=require(_0x5980('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5980('0x4'))['db'];var utils=require(_0x5980('0x5'));var logger=require(_0x5980('0x6'))(_0x5980('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5980('0x8')][_0x5980('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x326b9b,_0x1d6536,_0x175728){return new BPromise(function(_0x3399a9,_0xf8b3c0){return client[_0x5980('0xa')](_0x326b9b,_0x175728)[_0x5980('0xb')](function(_0x35b0ad){logger[_0x5980('0xc')](_0x5980('0xd'),_0x1d6536,'request\x20sent');logger['debug'](_0x5980('0xe'),_0x1d6536,_0x5980('0xf'),JSON[_0x5980('0x10')](_0x35b0ad));if(_0x35b0ad[_0x5980('0x11')]){if(_0x35b0ad['error'][_0x5980('0x12')]===0x1f4){logger[_0x5980('0x11')]('Automation,\x20%s,\x20%s',_0x1d6536,_0x35b0ad['error'][_0x5980('0x13')]);return _0xf8b3c0(_0x35b0ad[_0x5980('0x11')][_0x5980('0x13')]);}logger[_0x5980('0x11')](_0x5980('0xd'),_0x1d6536,_0x35b0ad[_0x5980('0x11')][_0x5980('0x13')]);return _0x3399a9(_0x35b0ad[_0x5980('0x11')]['message']);}else{logger[_0x5980('0xc')]('Automation,\x20%s,\x20%s',_0x1d6536,_0x5980('0xf'));_0x3399a9(_0x35b0ad[_0x5980('0x14')][_0x5980('0x13')]);}})[_0x5980('0x15')](function(_0x183261){logger['error'](_0x5980('0xd'),_0x1d6536,_0x183261);_0xf8b3c0(_0x183261);});});} \ No newline at end of file +var _0x15b8=['request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2faac6,_0x27651f){var _0x502958=function(_0x211d9a){while(--_0x211d9a){_0x2faac6['push'](_0x2faac6['shift']());}};_0x502958(++_0x27651f);}(_0x15b8,0xcd));var _0x815b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x15b8[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('Automation,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d6be0f8..48ff5a9 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 _0x9b83=['/:id/conditions','addConditions','addActions','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/actions','getActions','post','create'];(function(_0x298ab3,_0x55d7c0){var _0x44e6ed=function(_0x4e49c9){while(--_0x4e49c9){_0x298ab3['push'](_0x298ab3['shift']());}};_0x44e6ed(++_0x55d7c0);}(_0x9b83,0x84));var _0x39b8=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x9b83[_0x18abd2];return _0x1dcad6;};'use strict';var multer=require(_0x39b8('0x0'));var util=require(_0x39b8('0x1'));var path=require(_0x39b8('0x2'));var timeout=require(_0x39b8('0x3'));var express=require(_0x39b8('0x4'));var router=express[_0x39b8('0x5')]();var fs_extra=require(_0x39b8('0x6'));var auth=require(_0x39b8('0x7'));var interaction=require(_0x39b8('0x8'));var config=require(_0x39b8('0x9'));var controller=require('./automation.controller');router[_0x39b8('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x39b8('0xa')](_0x39b8('0xb'),auth[_0x39b8('0xc')](),controller[_0x39b8('0xd')]);router[_0x39b8('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller['getConditions']);router[_0x39b8('0xa')](_0x39b8('0xe'),auth[_0x39b8('0xc')](),controller[_0x39b8('0xf')]);router[_0x39b8('0x10')]('/',auth[_0x39b8('0xc')](),controller[_0x39b8('0x11')]);router[_0x39b8('0x10')](_0x39b8('0x12'),auth['isAuthenticated'](),controller[_0x39b8('0x13')]);router['post'](_0x39b8('0xe'),auth[_0x39b8('0xc')](),controller[_0x39b8('0x14')]);router[_0x39b8('0x15')]('/:id',auth[_0x39b8('0xc')](),controller[_0x39b8('0x16')]);router[_0x39b8('0x17')](_0x39b8('0xb'),auth['isAuthenticated'](),controller[_0x39b8('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf675=['/:id','/:id/conditions','/:id/actions','getActions','post','addConditions','addActions','put','update','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xf675,0x199));var _0x5f67=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xf675[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var path=require(_0x5f67('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f67('0x3'));var router=express['Router']();var fs_extra=require(_0x5f67('0x4'));var auth=require(_0x5f67('0x5'));var interaction=require(_0x5f67('0x6'));var config=require('../../config/environment');var controller=require(_0x5f67('0x7'));router[_0x5f67('0x8')]('/',auth[_0x5f67('0x9')](),controller[_0x5f67('0xa')]);router['get'](_0x5f67('0xb'),auth[_0x5f67('0x9')](),controller['show']);router['get'](_0x5f67('0xc'),auth[_0x5f67('0x9')](),controller['getConditions']);router['get'](_0x5f67('0xd'),auth[_0x5f67('0x9')](),controller[_0x5f67('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5f67('0xf')](_0x5f67('0xc'),auth['isAuthenticated'](),controller[_0x5f67('0x10')]);router['post'](_0x5f67('0xd'),auth['isAuthenticated'](),controller[_0x5f67('0x11')]);router[_0x5f67('0x12')](_0x5f67('0xb'),auth['isAuthenticated'](),controller[_0x5f67('0x13')]);router['delete'](_0x5f67('0xb'),auth['isAuthenticated'](),controller[_0x5f67('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e1d7700..82989ea 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 _0x9af4=['#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x2dcbb4,_0x5101ee){var _0x1cd307=function(_0x1516e9){while(--_0x1516e9){_0x2dcbb4['push'](_0x2dcbb4['shift']());}};_0x1cd307(++_0x5101ee);}(_0x9af4,0x1a7));var _0x49af=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9af4[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x49af('0x0'));module['exports']={'name':{'type':Sequelize[_0x49af('0x1')],'unique':_0x49af('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x49af('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x49af('0x1')]},'active':{'type':Sequelize[_0x49af('0x4')],'defaultValue':0x0,'comment':_0x49af('0x5')},'limitCalls':{'type':Sequelize[_0x49af('0x6')](0x4)[_0x49af('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x49af('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x49af('0x6')](0x3)[_0x49af('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x49af('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x49af('0x6')](0x3)[_0x49af('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x49af('0x6')](0x5)[_0x49af('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x49af('0x6')](0x3)[_0x49af('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x49af('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x49af('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x49af('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x49af('0x6')](0x3)[_0x49af('0x7')],'defaultValue':0x3,'comment':_0x49af('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x49af('0x6')](0x5)[_0x49af('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x49af('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x49af('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x49af('0xd')},'dialTimezone':{'type':Sequelize[_0x49af('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x49af('0x1')],'defaultValue':_0x49af('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x49af('0xf')](_0x49af('0x10'),_0x49af('0x11'),_0x49af('0x12')),'defaultValue':_0x49af('0x10')},'dialAMDActive':{'type':Sequelize[_0x49af('0x4')],'defaultValue':0x0,'comment':_0x49af('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x49af('0x6')](0x9)[_0x49af('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x49af('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x49af('0x6')](0x9)[_0x49af('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x49af('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x49af('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x49af('0x6')](0x9)[_0x49af('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x49af('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x49af('0x6')](0x9)[_0x49af('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x49af('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x49af('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x49af('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x49af('0x6')](0x5)[_0x49af('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x49af('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x49af('0x6')](0x9)[_0x49af('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x49af('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x49af('0xf')](_0x49af('0x1c'),_0x49af('0x1d')),'defaultValue':_0x49af('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x49af('0x6')](0x3)[_0x49af('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x49af('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x49af('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x49af('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x49af('0x6')](0x5)[_0x49af('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x49af('0x6')](0x3)[_0x49af('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x49af('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x49af('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x49af('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x49af('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x49af('0x6')](0x5)[_0x49af('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x49af('0x6')](0x3)[_0x49af('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x49af('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x49af('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x49af('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x49af('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x49af('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x49af('0x6')](0x5)[_0x49af('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x9c9c=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x2f55e0,_0x187824){var _0x140f59=function(_0x562b68){while(--_0x562b68){_0x2f55e0['push'](_0x2f55e0['shift']());}};_0x140f59(++_0x187824);}(_0x9c9c,0x1e4));var _0xc9c9=function(_0x5d2699,_0xbb63f2){_0x5d2699=_0x5d2699-0x0;var _0x2a2ee6=_0x9c9c[_0x5d2699];return _0x2a2ee6;};'use strict';var Sequelize=require(_0xc9c9('0x0'));module[_0xc9c9('0x1')]={'name':{'type':Sequelize[_0xc9c9('0x2')],'unique':_0xc9c9('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xc9c9('0x4')),'allowNull':![],'defaultValue':_0xc9c9('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc9c9('0x5')],'defaultValue':0x0,'comment':_0xc9c9('0x6')},'limitCalls':{'type':Sequelize[_0xc9c9('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc9c9('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc9c9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc9c9('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc9c9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'comment':_0xc9c9('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc9c9('0x10')},'dialTimezone':{'type':Sequelize[_0xc9c9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc9c9('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc9c9('0x11'),_0xc9c9('0x12'),_0xc9c9('0x13')),'defaultValue':_0xc9c9('0x11')},'dialAMDActive':{'type':Sequelize[_0xc9c9('0x5')],'defaultValue':0x0,'comment':_0xc9c9('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xc9c9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc9c9('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xc9c9('0x7')](0x9)[_0xc9c9('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc9c9('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc9c9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc9c9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc9c9('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xc9c9('0x7')](0x9)[_0xc9c9('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc9c9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc9c9('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc9c9('0x7')](0x9)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc9c9('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc9c9('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc9c9('0x7')](0x9)[_0xc9c9('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc9c9('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc9c9('0x1b')](_0xc9c9('0x1c'),_0xc9c9('0x1d')),'defaultValue':_0xc9c9('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc9c9('0x1e')},'dialCutDigit':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 712f821..e9b1cbe 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 _0x9d62=['onlyIfOpen','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','CmHopper','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','destroy','then','get','IvrCampaigns','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Campaign','include','findAll','rows','catch','options','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','clone','params','includeAll','omit','createdAt','updatedAt','findOne','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)'];(function(_0x319919,_0x2343ec){var _0xd9976e=function(_0x27add6){while(--_0x27add6){_0x319919['push'](_0x319919['shift']());}};_0xd9976e(++_0x2343ec);}(_0x9d62,0xaf));var _0x29d6=function(_0x4aa7aa,_0x1ba934){_0x4aa7aa=_0x4aa7aa-0x0;var _0x5390a0=_0x9d62[_0x4aa7aa];return _0x5390a0;};'use strict';var emlformat=require(_0x29d6('0x0'));var rimraf=require(_0x29d6('0x1'));var zipdir=require(_0x29d6('0x2'));var jsonpatch=require(_0x29d6('0x3'));var rp=require(_0x29d6('0x4'));var moment=require('moment');var BPromise=require(_0x29d6('0x5'));var Mustache=require(_0x29d6('0x6'));var util=require(_0x29d6('0x7'));var path=require(_0x29d6('0x8'));var sox=require(_0x29d6('0x9'));var csv=require('to-csv');var ejs=require(_0x29d6('0xa'));var fs=require('fs');var fs_extra=require(_0x29d6('0xb'));var _=require(_0x29d6('0xc'));var squel=require(_0x29d6('0xd'));var crypto=require(_0x29d6('0xe'));var jsforce=require(_0x29d6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x29d6('0x10'));var querystring=require(_0x29d6('0x11'));var Papa=require(_0x29d6('0x12'));var Redis=require(_0x29d6('0x13'));var authService=require(_0x29d6('0x14'));var qs=require(_0x29d6('0x15'));var as=require(_0x29d6('0x16'));var hardwareService=require(_0x29d6('0x17'));var logger=require('../../config/logger')(_0x29d6('0x18'));var utils=require(_0x29d6('0x19'));var config=require(_0x29d6('0x1a'));var licenseUtil=require(_0x29d6('0x1b'));var db=require(_0x29d6('0x1c'))['db'];function respondWithStatusCode(_0x5ab9fb,_0x4666f9){_0x4666f9=_0x4666f9||0xcc;return function(_0x4bb3e2){if(_0x4bb3e2){return _0x5ab9fb[_0x29d6('0x1d')](_0x4666f9);}return _0x5ab9fb['status'](_0x4666f9)[_0x29d6('0x1e')]();};}function respondWithResult(_0x16b739,_0x2f4968){_0x2f4968=_0x2f4968||0xc8;return function(_0x305a69){if(_0x305a69){return _0x16b739['status'](_0x2f4968)['json'](_0x305a69);}};}function respondWithFilteredResult(_0x4efeb8,_0x158e45){return function(_0x30d39f){if(_0x30d39f){var _0x261225=typeof _0x158e45[_0x29d6('0x1f')]===_0x29d6('0x20')&&typeof _0x158e45[_0x29d6('0x21')]===_0x29d6('0x20');var _0x59355a=_0x30d39f[_0x29d6('0x22')];var _0x46307e=_0x261225?0x0:_0x158e45[_0x29d6('0x1f')];var _0x50c734=_0x261225?_0x30d39f[_0x29d6('0x22')]:_0x158e45[_0x29d6('0x1f')]+_0x158e45[_0x29d6('0x21')];var _0x294764;if(_0x50c734>=_0x59355a){_0x50c734=_0x59355a;_0x294764=0xc8;}else{_0x294764=0xce;}_0x4efeb8[_0x29d6('0x23')](_0x294764);return _0x4efeb8[_0x29d6('0x24')](_0x29d6('0x25'),_0x46307e+'-'+_0x50c734+'/'+_0x59355a)[_0x29d6('0x26')](_0x30d39f);}return null;};}function patchUpdates(_0x5ccdac){return function(_0x4701ca){try{jsonpatch[_0x29d6('0x27')](_0x4701ca,_0x5ccdac,!![]);}catch(_0x5c2774){return BPromise[_0x29d6('0x28')](_0x5c2774);}return _0x4701ca[_0x29d6('0x29')]();};}function saveUpdates(_0x3e254f,_0x585e72){return function(_0x53f285){if(_0x53f285){return _0x53f285[_0x29d6('0x2a')](_0x3e254f)['then'](function(_0x473fde){return _0x473fde;});}return null;};}function removeEntity(_0x1c2920,_0x51cff7){return function(_0x8d91f5){if(_0x8d91f5){return _0x8d91f5[_0x29d6('0x2b')]()[_0x29d6('0x2c')](function(){var _0xe7997e=_0x8d91f5[_0x29d6('0x2d')]({'plain':!![]});var _0x4d0f45=_0x29d6('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x4d0f45,'resourceId':_0xe7997e['id']}})['then'](function(){return _0x8d91f5;});})[_0x29d6('0x2c')](function(){_0x1c2920['status'](0xcc)[_0x29d6('0x1e')]();});}};}function handleEntityNotFound(_0xd911f7,_0x54ea45){return function(_0x210ee1){if(!_0x210ee1){_0xd911f7['sendStatus'](0x194);}return _0x210ee1;};}function handleError(_0x469c2f,_0x4abf4f){_0x4abf4f=_0x4abf4f||0x1f4;return function(_0x4af26f){logger[_0x29d6('0x2f')](_0x4af26f[_0x29d6('0x30')]);if(_0x4af26f['name']){delete _0x4af26f[_0x29d6('0x31')];}_0x469c2f[_0x29d6('0x23')](_0x4abf4f)[_0x29d6('0x32')](_0x4af26f);};}exports[_0x29d6('0x33')]=function(_0x4fc84e,_0xa9b5e){var _0x5eb783={},_0x49abc9={},_0x47ebba={'count':0x0,'rows':[]};var _0x420a15=_[_0x29d6('0x34')](db['Campaign'][_0x29d6('0x35')],function(_0xdf63d7){return{'name':_0xdf63d7[_0x29d6('0x36')],'type':_0xdf63d7[_0x29d6('0x37')][_0x29d6('0x38')]};});_0x49abc9['model']=_[_0x29d6('0x34')](_0x420a15,_0x29d6('0x31'));_0x49abc9[_0x29d6('0x39')]=_[_0x29d6('0x3a')](_0x4fc84e['query']);_0x49abc9[_0x29d6('0x3b')]=_[_0x29d6('0x3c')](_0x49abc9[_0x29d6('0x3d')],_0x49abc9[_0x29d6('0x39')]);_0x5eb783[_0x29d6('0x3e')]=_['intersection'](_0x49abc9[_0x29d6('0x3d')],qs[_0x29d6('0x3f')](_0x4fc84e[_0x29d6('0x39')][_0x29d6('0x3f')]));_0x5eb783[_0x29d6('0x3e')]=_0x5eb783[_0x29d6('0x3e')][_0x29d6('0x40')]?_0x5eb783[_0x29d6('0x3e')]:_0x49abc9[_0x29d6('0x3d')];if(!_0x4fc84e[_0x29d6('0x39')][_0x29d6('0x41')](_0x29d6('0x42'))){_0x5eb783['limit']=qs['limit'](_0x4fc84e['query'][_0x29d6('0x21')]);_0x5eb783[_0x29d6('0x1f')]=qs['offset'](_0x4fc84e[_0x29d6('0x39')][_0x29d6('0x1f')]);}_0x5eb783[_0x29d6('0x43')]=qs[_0x29d6('0x44')](_0x4fc84e[_0x29d6('0x39')][_0x29d6('0x44')]);_0x5eb783['where']=qs[_0x29d6('0x3b')](_[_0x29d6('0x45')](_0x4fc84e[_0x29d6('0x39')],_0x49abc9[_0x29d6('0x3b')]),_0x420a15);if(_0x4fc84e[_0x29d6('0x39')][_0x29d6('0x46')]){_0x5eb783[_0x29d6('0x47')]=_[_0x29d6('0x48')](_0x5eb783[_0x29d6('0x47')],{'$or':_[_0x29d6('0x34')](_0x420a15,function(_0x369150){if(_0x369150[_0x29d6('0x37')]!==_0x29d6('0x49')){var _0x1d651e={};_0x1d651e[_0x369150[_0x29d6('0x31')]]={'$like':'%'+_0x4fc84e[_0x29d6('0x39')][_0x29d6('0x46')]+'%'};return _0x1d651e;}})});}_0x5eb783=_['merge']({},_0x5eb783,_0x4fc84e['options']);var _0x4598bc={'where':_0x5eb783[_0x29d6('0x47')]};return db[_0x29d6('0x4a')][_0x29d6('0x22')](_0x4598bc)[_0x29d6('0x2c')](function(_0x24313f){_0x47ebba[_0x29d6('0x22')]=_0x24313f;if(_0x4fc84e[_0x29d6('0x39')]['includeAll']){_0x5eb783[_0x29d6('0x4b')]=[{'all':!![]}];}return db[_0x29d6('0x4a')][_0x29d6('0x4c')](_0x5eb783);})[_0x29d6('0x2c')](function(_0x2b4ebd){_0x47ebba[_0x29d6('0x4d')]=_0x2b4ebd;return _0x47ebba;})[_0x29d6('0x2c')](respondWithFilteredResult(_0xa9b5e,_0x5eb783))[_0x29d6('0x4e')](handleError(_0xa9b5e,null));};exports['show']=function(_0x40bfb5,_0x3df6a3){var _0x2c3cd5={'raw':![],'where':{'id':_0x40bfb5['params']['id']}},_0x43042d={};_0x43042d[_0x29d6('0x3d')]=_[_0x29d6('0x3a')](db[_0x29d6('0x4a')][_0x29d6('0x35')]);_0x43042d[_0x29d6('0x39')]=_[_0x29d6('0x3a')](_0x40bfb5[_0x29d6('0x39')]);_0x43042d['filters']=_[_0x29d6('0x3c')](_0x43042d[_0x29d6('0x3d')],_0x43042d[_0x29d6('0x39')]);_0x2c3cd5['attributes']=_['intersection'](_0x43042d[_0x29d6('0x3d')],qs[_0x29d6('0x3f')](_0x40bfb5[_0x29d6('0x39')][_0x29d6('0x3f')]));_0x2c3cd5[_0x29d6('0x3e')]=_0x2c3cd5['attributes'][_0x29d6('0x40')]?_0x2c3cd5[_0x29d6('0x3e')]:_0x43042d['model'];if(_0x40bfb5['query']['includeAll']){_0x2c3cd5[_0x29d6('0x4b')]=[{'all':!![]}];}_0x2c3cd5=_[_0x29d6('0x48')]({},_0x2c3cd5,_0x40bfb5[_0x29d6('0x4f')]);return db[_0x29d6('0x4a')][_0x29d6('0x50')](_0x2c3cd5)[_0x29d6('0x2c')](handleEntityNotFound(_0x3df6a3,null))[_0x29d6('0x2c')](respondWithResult(_0x3df6a3,null))['catch'](handleError(_0x3df6a3,null));};exports[_0x29d6('0x51')]=function(_0x1845a7,_0x2979c1){return db['Campaign'][_0x29d6('0x51')](_0x1845a7[_0x29d6('0x52')],{})[_0x29d6('0x2c')](function(_0xe839b7){var _0x1eb37d=_0x1845a7[_0x29d6('0x53')][_0x29d6('0x2d')]({'plain':!![]});if(!_0x1eb37d)throw new Error(_0x29d6('0x54'));if(_0x1eb37d[_0x29d6('0x55')]==='user'){var _0x3127b1=_0xe839b7[_0x29d6('0x2d')]({'plain':!![]});var _0x1acbac=_0x29d6('0x2e');return db[_0x29d6('0x56')][_0x29d6('0x50')]({'where':{'name':_0x1acbac,'userProfileId':_0x1eb37d[_0x29d6('0x57')]},'raw':!![]})[_0x29d6('0x2c')](function(_0x4cbad3){if(_0x4cbad3&&_0x4cbad3[_0x29d6('0x58')]===0x0){return db[_0x29d6('0x59')][_0x29d6('0x51')]({'name':_0x3127b1['name'],'resourceId':_0x3127b1['id'],'type':_0x4cbad3[_0x29d6('0x31')],'sectionId':_0x4cbad3['id']},{})[_0x29d6('0x2c')](function(){return _0xe839b7;});}else{return _0xe839b7;}})['catch'](function(_0x27ddad){logger[_0x29d6('0x2f')](_0x29d6('0x5a'),_0x27ddad);throw _0x27ddad;});}return _0xe839b7;})[_0x29d6('0x2c')](respondWithResult(_0x2979c1,0xc9))[_0x29d6('0x4e')](handleError(_0x2979c1,null));};exports[_0x29d6('0x5b')]=function(_0x5ae807,_0x152148){var _0x59f9ea={'where':{'id':_0x5ae807[_0x29d6('0x5c')]['id']}},_0x49e2fe={};_0x49e2fe[_0x29d6('0x3d')]=_['keys'](db[_0x29d6('0x4a')][_0x29d6('0x35')]);_0x59f9ea['attributes']=_[_0x29d6('0x3c')](_0x49e2fe[_0x29d6('0x3d')],qs[_0x29d6('0x3f')](_0x5ae807[_0x29d6('0x39')][_0x29d6('0x3f')]));_0x59f9ea[_0x29d6('0x3e')]=_0x59f9ea[_0x29d6('0x3e')][_0x29d6('0x40')]?_0x59f9ea[_0x29d6('0x3e')]:_0x49e2fe['model'];if(_0x5ae807[_0x29d6('0x39')][_0x29d6('0x5d')]){_0x59f9ea['include']=[{'all':!![]}];}_0x59f9ea=_[_0x29d6('0x48')]({},_0x59f9ea,_0x5ae807['options']);return db[_0x29d6('0x4a')][_0x29d6('0x50')](_0x59f9ea)[_0x29d6('0x2c')](handleEntityNotFound(_0x152148,null))[_0x29d6('0x2c')](function(_0x36296c){if(_0x36296c){var _0x94cd94=_0x36296c[_0x29d6('0x2d')]({'plain':!![]});_0x94cd94=qs[_0x29d6('0x5e')](_0x94cd94,['id',_0x29d6('0x5f'),_0x29d6('0x60')]);_0x5ae807[_0x29d6('0x52')]=_[_0x29d6('0x5e')](_0x5ae807[_0x29d6('0x52')],['id',_0x29d6('0x5f'),'updatedAt']);return db[_0x29d6('0x4a')][_0x29d6('0x51')](_[_0x29d6('0x48')](_0x94cd94,_0x5ae807[_0x29d6('0x52')]),{'include':_0x5ae807['query']['includeAll']?[{'all':!![]}]:undefined})[_0x29d6('0x2c')](function(_0x355237){var _0x42bc78=_0x5ae807[_0x29d6('0x53')][_0x29d6('0x2d')]({'plain':!![]});if(!_0x42bc78)throw new Error(_0x29d6('0x54'));if(_0x42bc78['role']===_0x29d6('0x53')){var _0x4c3398=_0x355237['get']({'plain':!![]});var _0x37c370=_0x29d6('0x2e');return db[_0x29d6('0x56')][_0x29d6('0x50')]({'where':{'name':_0x37c370,'userProfileId':_0x42bc78[_0x29d6('0x57')]},'raw':!![]})['then'](function(_0x24c549){if(_0x24c549&&_0x24c549[_0x29d6('0x58')]===0x0){return db[_0x29d6('0x59')][_0x29d6('0x51')]({'name':_0x4c3398[_0x29d6('0x31')],'resourceId':_0x4c3398['id'],'type':_0x24c549['name'],'sectionId':_0x24c549['id']},{})[_0x29d6('0x2c')](function(){return _0x355237;});}else{return _0x355237;}})[_0x29d6('0x4e')](function(_0x48eb9b){logger[_0x29d6('0x2f')](_0x29d6('0x5a'),_0x48eb9b);throw _0x48eb9b;});}return _0x355237;});}})[_0x29d6('0x2c')](respondWithResult(_0x152148,0xc9))['catch'](handleError(_0x152148,null));};exports['update']=function(_0x54ab3b,_0x13132e){if(_0x54ab3b[_0x29d6('0x52')]['id']){delete _0x54ab3b[_0x29d6('0x52')]['id'];}return db[_0x29d6('0x4a')][_0x29d6('0x50')]({'where':{'id':_0x54ab3b['params']['id']}})[_0x29d6('0x2c')](handleEntityNotFound(_0x13132e,null))['then'](saveUpdates(_0x54ab3b[_0x29d6('0x52')],null))['then'](respondWithResult(_0x13132e,null))['catch'](handleError(_0x13132e,null));};exports['destroy']=function(_0x1dac11,_0x168636){return db['Campaign'][_0x29d6('0x50')]({'where':{'id':_0x1dac11[_0x29d6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x168636,null))['then'](removeEntity(_0x168636,null))[_0x29d6('0x4e')](handleError(_0x168636,null));};exports['getHoppers']=function(_0x166d9f,_0x4a12cd,_0x4ae73b){var _0x56f05f={'raw':!![],'where':{}};var _0x353c4c={};var _0x437724={'count':0x0,'rows':[]};return db[_0x29d6('0x4a')][_0x29d6('0x61')]({'where':{'id':_0x166d9f[_0x29d6('0x5c')]['id']}})[_0x29d6('0x2c')](handleEntityNotFound(_0x4a12cd,null))[_0x29d6('0x2c')](function(_0x2eba2e){if(_0x2eba2e){_0x353c4c[_0x29d6('0x3d')]=_[_0x29d6('0x3a')](db['CmHopper'][_0x29d6('0x35')]);_0x353c4c[_0x29d6('0x39')]=_['keys'](_0x166d9f['query']);_0x353c4c[_0x29d6('0x3b')]=_[_0x29d6('0x3c')](_0x353c4c[_0x29d6('0x3d')],_0x353c4c[_0x29d6('0x39')]);_0x56f05f[_0x29d6('0x3e')]=_[_0x29d6('0x3c')](_0x353c4c[_0x29d6('0x3d')],qs[_0x29d6('0x3f')](_0x166d9f[_0x29d6('0x39')][_0x29d6('0x3f')]));_0x56f05f[_0x29d6('0x3e')]=_0x56f05f[_0x29d6('0x3e')]['length']?_0x56f05f['attributes']:_0x353c4c[_0x29d6('0x3d')];if(!_0x166d9f[_0x29d6('0x39')]['hasOwnProperty'](_0x29d6('0x42'))){_0x56f05f[_0x29d6('0x21')]=qs[_0x29d6('0x21')](_0x166d9f[_0x29d6('0x39')][_0x29d6('0x21')]);_0x56f05f[_0x29d6('0x1f')]=qs[_0x29d6('0x1f')](_0x166d9f[_0x29d6('0x39')][_0x29d6('0x1f')]);}_0x56f05f[_0x29d6('0x43')]=qs[_0x29d6('0x44')](_0x166d9f[_0x29d6('0x39')][_0x29d6('0x44')]);_0x56f05f[_0x29d6('0x47')]=qs[_0x29d6('0x3b')](_['pick'](_0x166d9f[_0x29d6('0x39')],_0x353c4c[_0x29d6('0x3b')]));_0x56f05f[_0x29d6('0x47')][_0x29d6('0x62')]=_0x2eba2e['id'];if(_0x166d9f[_0x29d6('0x39')]['filter']){_0x56f05f[_0x29d6('0x47')]=_[_0x29d6('0x48')](_0x56f05f[_0x29d6('0x47')],{'$or':_[_0x29d6('0x34')](_0x56f05f[_0x29d6('0x3e')],function(_0x7559da){var _0x2abf89={};_0x2abf89[_0x7559da]={'$like':'%'+_0x166d9f[_0x29d6('0x39')][_0x29d6('0x46')]+'%'};return _0x2abf89;})});}_0x56f05f=_[_0x29d6('0x48')]({},_0x56f05f,_0x166d9f[_0x29d6('0x4f')]);return db['CmHopper']['count']({'where':_0x56f05f[_0x29d6('0x47')]})[_0x29d6('0x2c')](function(_0x315f51){_0x437724['count']=_0x315f51;if(_0x166d9f[_0x29d6('0x39')][_0x29d6('0x5d')]){_0x56f05f[_0x29d6('0x4b')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x56f05f);})[_0x29d6('0x2c')](function(_0x40e0a4){_0x437724[_0x29d6('0x4d')]=_0x40e0a4;return _0x437724;});}})[_0x29d6('0x2c')](respondWithFilteredResult(_0x4a12cd,_0x56f05f))[_0x29d6('0x4e')](handleError(_0x4a12cd,null));};exports[_0x29d6('0x63')]=function(_0x37523a,_0x1ce77f,_0x3e96e8){var _0xd954fc={'raw':!![],'where':{}};var _0x183fce={};var _0x29a070={'count':0x0,'rows':[]};return db[_0x29d6('0x4a')][_0x29d6('0x61')]({'where':{'id':_0x37523a[_0x29d6('0x5c')]['id']}})[_0x29d6('0x2c')](handleEntityNotFound(_0x1ce77f,null))[_0x29d6('0x2c')](function(_0x12a698){if(_0x12a698){_0x183fce[_0x29d6('0x3d')]=_[_0x29d6('0x3a')](db[_0x29d6('0x64')][_0x29d6('0x35')]);_0x183fce['query']=_[_0x29d6('0x3a')](_0x37523a['query']);_0x183fce[_0x29d6('0x3b')]=_['intersection'](_0x183fce['model'],_0x183fce[_0x29d6('0x39')]);_0xd954fc['attributes']=_[_0x29d6('0x3c')](_0x183fce[_0x29d6('0x3d')],qs[_0x29d6('0x3f')](_0x37523a[_0x29d6('0x39')][_0x29d6('0x3f')]));_0xd954fc[_0x29d6('0x3e')]=_0xd954fc[_0x29d6('0x3e')][_0x29d6('0x40')]?_0xd954fc['attributes']:_0x183fce['model'];if(!_0x37523a['query']['hasOwnProperty']('nolimit')){_0xd954fc[_0x29d6('0x21')]=qs[_0x29d6('0x21')](_0x37523a[_0x29d6('0x39')]['limit']);_0xd954fc[_0x29d6('0x1f')]=qs[_0x29d6('0x1f')](_0x37523a[_0x29d6('0x39')][_0x29d6('0x1f')]);}_0xd954fc[_0x29d6('0x43')]=qs['sort'](_0x37523a[_0x29d6('0x39')][_0x29d6('0x44')]);_0xd954fc[_0x29d6('0x47')]=qs[_0x29d6('0x3b')](_[_0x29d6('0x45')](_0x37523a['query'],_0x183fce['filters']));_0xd954fc[_0x29d6('0x47')][_0x29d6('0x62')]=_0x12a698['id'];if(_0x37523a[_0x29d6('0x39')][_0x29d6('0x46')]){_0xd954fc['where']=_['merge'](_0xd954fc[_0x29d6('0x47')],{'$or':_[_0x29d6('0x34')](_0xd954fc['attributes'],function(_0x4f2330){var _0x235e84={};_0x235e84[_0x4f2330]={'$like':'%'+_0x37523a[_0x29d6('0x39')]['filter']+'%'};return _0x235e84;})});}_0xd954fc=_['merge']({},_0xd954fc,_0x37523a[_0x29d6('0x4f')]);return db[_0x29d6('0x64')][_0x29d6('0x22')]({'where':_0xd954fc[_0x29d6('0x47')]})[_0x29d6('0x2c')](function(_0xbf4e80){_0x29a070[_0x29d6('0x22')]=_0xbf4e80;if(_0x37523a[_0x29d6('0x39')][_0x29d6('0x5d')]){_0xd954fc[_0x29d6('0x4b')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xd954fc);})['then'](function(_0xd44129){_0x29a070[_0x29d6('0x4d')]=_0xd44129;return _0x29a070;});}})[_0x29d6('0x2c')](respondWithFilteredResult(_0x1ce77f,_0xd954fc))[_0x29d6('0x4e')](handleError(_0x1ce77f,null));};exports[_0x29d6('0x65')]=function(_0x1b2091,_0x4fd697,_0xf2a47a){var _0x1d1f54={'raw':!![],'where':{}};var _0x4c8c36={};var _0x245c72={'count':0x0,'rows':[]};return db[_0x29d6('0x4a')][_0x29d6('0x61')]({'where':{'id':_0x1b2091[_0x29d6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4fd697,null))[_0x29d6('0x2c')](function(_0x581263){if(_0x581263){_0x4c8c36[_0x29d6('0x3d')]=_[_0x29d6('0x3a')](db['CmHopperFinal'][_0x29d6('0x35')]);_0x4c8c36[_0x29d6('0x39')]=_[_0x29d6('0x3a')](_0x1b2091[_0x29d6('0x39')]);_0x4c8c36[_0x29d6('0x3b')]=_['intersection'](_0x4c8c36[_0x29d6('0x3d')],_0x4c8c36[_0x29d6('0x39')]);_0x1d1f54[_0x29d6('0x3e')]=_['intersection'](_0x4c8c36[_0x29d6('0x3d')],qs[_0x29d6('0x3f')](_0x1b2091[_0x29d6('0x39')][_0x29d6('0x3f')]));_0x1d1f54[_0x29d6('0x3e')]=_0x1d1f54[_0x29d6('0x3e')]['length']?_0x1d1f54[_0x29d6('0x3e')]:_0x4c8c36[_0x29d6('0x3d')];if(!_0x1b2091[_0x29d6('0x39')][_0x29d6('0x41')](_0x29d6('0x42'))){_0x1d1f54[_0x29d6('0x21')]=qs['limit'](_0x1b2091[_0x29d6('0x39')][_0x29d6('0x21')]);_0x1d1f54[_0x29d6('0x1f')]=qs[_0x29d6('0x1f')](_0x1b2091[_0x29d6('0x39')][_0x29d6('0x1f')]);}_0x1d1f54['order']=qs[_0x29d6('0x44')](_0x1b2091[_0x29d6('0x39')]['sort']);_0x1d1f54[_0x29d6('0x47')]=qs[_0x29d6('0x3b')](_[_0x29d6('0x45')](_0x1b2091[_0x29d6('0x39')],_0x4c8c36[_0x29d6('0x3b')]));_0x1d1f54[_0x29d6('0x47')][_0x29d6('0x62')]=_0x581263['id'];if(_0x1b2091[_0x29d6('0x39')][_0x29d6('0x46')]){_0x1d1f54[_0x29d6('0x47')]=_[_0x29d6('0x48')](_0x1d1f54[_0x29d6('0x47')],{'$or':_[_0x29d6('0x34')](_0x1d1f54[_0x29d6('0x3e')],function(_0x477ebb){var _0x2e3d05={};_0x2e3d05[_0x477ebb]={'$like':'%'+_0x1b2091[_0x29d6('0x39')][_0x29d6('0x46')]+'%'};return _0x2e3d05;})});}_0x1d1f54=_[_0x29d6('0x48')]({},_0x1d1f54,_0x1b2091[_0x29d6('0x4f')]);return db[_0x29d6('0x66')][_0x29d6('0x22')]({'where':_0x1d1f54['where']})[_0x29d6('0x2c')](function(_0x39e027){_0x245c72['count']=_0x39e027;if(_0x1b2091[_0x29d6('0x39')][_0x29d6('0x5d')]){_0x1d1f54[_0x29d6('0x4b')]=[{'all':!![]}];}return db[_0x29d6('0x66')][_0x29d6('0x4c')](_0x1d1f54);})[_0x29d6('0x2c')](function(_0x2a87ae){_0x245c72['rows']=_0x2a87ae;return _0x245c72;});}})[_0x29d6('0x2c')](respondWithFilteredResult(_0x4fd697,_0x1d1f54))[_0x29d6('0x4e')](handleError(_0x4fd697,null));};exports['getHopperBlacks']=function(_0x3da35f,_0x31abea,_0x5b3eb0){var _0x504046={'raw':!![],'where':{}};var _0x5b1e2b={};var _0x3705f9={'count':0x0,'rows':[]};return db[_0x29d6('0x4a')][_0x29d6('0x61')]({'where':{'id':_0x3da35f['params']['id']}})[_0x29d6('0x2c')](handleEntityNotFound(_0x31abea,null))[_0x29d6('0x2c')](function(_0x243e35){if(_0x243e35){_0x5b1e2b['model']=_['keys'](db[_0x29d6('0x67')]['rawAttributes']);_0x5b1e2b['query']=_[_0x29d6('0x3a')](_0x3da35f[_0x29d6('0x39')]);_0x5b1e2b[_0x29d6('0x3b')]=_['intersection'](_0x5b1e2b[_0x29d6('0x3d')],_0x5b1e2b[_0x29d6('0x39')]);_0x504046[_0x29d6('0x3e')]=_[_0x29d6('0x3c')](_0x5b1e2b[_0x29d6('0x3d')],qs['fields'](_0x3da35f['query'][_0x29d6('0x3f')]));_0x504046[_0x29d6('0x3e')]=_0x504046[_0x29d6('0x3e')]['length']?_0x504046[_0x29d6('0x3e')]:_0x5b1e2b['model'];if(!_0x3da35f[_0x29d6('0x39')][_0x29d6('0x41')](_0x29d6('0x42'))){_0x504046[_0x29d6('0x21')]=qs[_0x29d6('0x21')](_0x3da35f['query'][_0x29d6('0x21')]);_0x504046[_0x29d6('0x1f')]=qs[_0x29d6('0x1f')](_0x3da35f[_0x29d6('0x39')]['offset']);}_0x504046['order']=qs[_0x29d6('0x44')](_0x3da35f['query'][_0x29d6('0x44')]);_0x504046[_0x29d6('0x47')]=qs[_0x29d6('0x3b')](_['pick'](_0x3da35f[_0x29d6('0x39')],_0x5b1e2b[_0x29d6('0x3b')]));_0x504046[_0x29d6('0x47')][_0x29d6('0x62')]=_0x243e35['id'];if(_0x3da35f[_0x29d6('0x39')][_0x29d6('0x46')]){_0x504046[_0x29d6('0x47')]=_[_0x29d6('0x48')](_0x504046[_0x29d6('0x47')],{'$or':_[_0x29d6('0x34')](_0x504046['attributes'],function(_0x1f507c){var _0xa3fb5a={};_0xa3fb5a[_0x1f507c]={'$like':'%'+_0x3da35f[_0x29d6('0x39')][_0x29d6('0x46')]+'%'};return _0xa3fb5a;})});}_0x504046=_[_0x29d6('0x48')]({},_0x504046,_0x3da35f[_0x29d6('0x4f')]);return db[_0x29d6('0x67')][_0x29d6('0x22')]({'where':_0x504046['where']})['then'](function(_0x58e06c){_0x3705f9[_0x29d6('0x22')]=_0x58e06c;if(_0x3da35f['query'][_0x29d6('0x5d')]){_0x504046[_0x29d6('0x4b')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x29d6('0x4c')](_0x504046);})[_0x29d6('0x2c')](function(_0x1ad7c9){_0x3705f9['rows']=_0x1ad7c9;return _0x3705f9;});}})[_0x29d6('0x2c')](respondWithFilteredResult(_0x31abea,_0x504046))[_0x29d6('0x4e')](handleError(_0x31abea,null));};exports['getLists']=function(_0x21502e,_0x3af990,_0x1154b7){var _0x25291a={};var _0x36d761={};var _0x4fa5f4;var _0x14fa36;return db[_0x29d6('0x4a')][_0x29d6('0x61')]({'where':{'id':_0x21502e[_0x29d6('0x5c')]['id']}})[_0x29d6('0x2c')](handleEntityNotFound(_0x3af990,null))['then'](function(_0x49b131){if(_0x49b131){_0x4fa5f4=_0x49b131;_0x36d761[_0x29d6('0x3d')]=_[_0x29d6('0x3a')](db[_0x29d6('0x68')][_0x29d6('0x35')]);_0x36d761[_0x29d6('0x39')]=_['keys'](_0x21502e['query']);_0x36d761[_0x29d6('0x3b')]=_[_0x29d6('0x3c')](_0x36d761[_0x29d6('0x3d')],_0x36d761[_0x29d6('0x39')]);_0x25291a[_0x29d6('0x3e')]=_['intersection'](_0x36d761[_0x29d6('0x3d')],qs['fields'](_0x21502e['query'][_0x29d6('0x3f')]));_0x25291a[_0x29d6('0x3e')]=_0x25291a[_0x29d6('0x3e')]['length']?_0x25291a[_0x29d6('0x3e')]:_0x36d761[_0x29d6('0x3d')];_0x25291a['order']=qs[_0x29d6('0x44')](_0x21502e[_0x29d6('0x39')][_0x29d6('0x44')]);_0x25291a[_0x29d6('0x47')]=qs['filters'](_[_0x29d6('0x45')](_0x21502e['query'],_0x36d761[_0x29d6('0x3b')]));if(_0x21502e[_0x29d6('0x39')][_0x29d6('0x46')]){_0x25291a[_0x29d6('0x47')]=_[_0x29d6('0x48')](_0x25291a[_0x29d6('0x47')],{'$or':_[_0x29d6('0x34')](_0x25291a['attributes'],function(_0x1aaf17){var _0x43c26f={};_0x43c26f[_0x1aaf17]={'$like':'%'+_0x21502e[_0x29d6('0x39')]['filter']+'%'};return _0x43c26f;})});}_0x25291a=_[_0x29d6('0x48')]({},_0x25291a,_0x21502e[_0x29d6('0x4f')]);return _0x4fa5f4[_0x29d6('0x69')](_0x25291a);}})[_0x29d6('0x2c')](function(_0x47b67d){if(_0x47b67d){_0x14fa36=_0x47b67d[_0x29d6('0x40')];if(!_0x21502e[_0x29d6('0x39')]['hasOwnProperty'](_0x29d6('0x42'))){_0x25291a[_0x29d6('0x21')]=qs[_0x29d6('0x21')](_0x21502e[_0x29d6('0x39')][_0x29d6('0x21')]);_0x25291a[_0x29d6('0x1f')]=qs[_0x29d6('0x1f')](_0x21502e[_0x29d6('0x39')][_0x29d6('0x1f')]);}return _0x4fa5f4[_0x29d6('0x69')](_0x25291a);}})['then'](function(_0x18ae0b){if(_0x18ae0b){return _0x18ae0b?{'count':_0x14fa36,'rows':_0x18ae0b}:null;}})[_0x29d6('0x2c')](respondWithResult(_0x3af990,null))[_0x29d6('0x4e')](handleError(_0x3af990,null));};exports['addLists']=function(_0x2a3999,_0x33e2f9,_0x43fa17){var _0x206cff,_0x45c707;var _0x81e1f0=[];var _0x3a1c44=moment()['format'](_0x29d6('0x6a'));return db[_0x29d6('0x4a')][_0x29d6('0x50')]({'where':{'id':_0x2a3999[_0x29d6('0x5c')]['id']}})[_0x29d6('0x2c')](handleEntityNotFound(_0x33e2f9,null))['then'](function(_0x1853b7){if(_0x1853b7){_0x45c707=_0x1853b7;return _0x1853b7[_0x29d6('0x6b')](_0x2a3999[_0x29d6('0x52')][_0x29d6('0x6c')],_[_0x29d6('0x5e')](_0x2a3999[_0x29d6('0x52')],[_0x29d6('0x6c'),'id'])||{});}return null;})['spread'](function(_0x4d5bbf){var _0x23af0e;var _0x168c4a;_0x206cff=_0x4d5bbf||[];var _0x238208=[];if(_0x4d5bbf){for(var _0x520390=0x0;_0x520390<_0x4d5bbf[_0x29d6('0x40')];_0x520390+=0x1){var _0x28fc89=_0x4d5bbf[_0x520390]['get']({'plain':!![]});_0x45c707[_0x29d6('0x6d')]=_0x2a3999['body'][_0x29d6('0x6d')]?_0x2a3999['body'][_0x29d6('0x6d')]:_0x45c707[_0x29d6('0x6d')];switch(_0x45c707['dialCheckDuplicateType']){case _0x29d6('0x6e'):_0x23af0e=squel[_0x29d6('0x6f')]()[_0x29d6('0x70')](_0x29d6('0x71'))[_0x29d6('0x72')]([_0x29d6('0x73'),_0x29d6('0x74'),_0x29d6('0x75'),_0x29d6('0x76'),_0x29d6('0x62'),_0x29d6('0x5f'),'updatedAt'],squel[_0x29d6('0x77')]()[_0x29d6('0x78')](_0x29d6('0x73'),_0x29d6('0x73'))[_0x29d6('0x78')](_0x29d6('0x79'),_0x29d6('0x74'))['field']('id',_0x29d6('0x75'))[_0x29d6('0x78')](_0x28fc89[_0x29d6('0x7a')][_0x29d6('0x7b')](),_0x29d6('0x76'))[_0x29d6('0x78')](_0x2a3999[_0x29d6('0x5c')]['id']['toString'](),_0x29d6('0x62'))[_0x29d6('0x78')]('\x27'+_0x3a1c44+'\x27',_0x29d6('0x5f'))['field']('\x27'+_0x3a1c44+'\x27',_0x29d6('0x60'))[_0x29d6('0x7c')](_0x29d6('0x7d'))[_0x29d6('0x47')](_0x29d6('0x7e'))[_0x29d6('0x47')](_0x29d6('0x7f'),_0x28fc89['CmListId']['toString']())[_0x29d6('0x47')](_0x29d6('0x80'))[_0x29d6('0x47')](_0x29d6('0x81'),squel[_0x29d6('0x77')]()[_0x29d6('0x78')]('COALESCE(calleridnum,\x27\x27)')[_0x29d6('0x7c')](_0x29d6('0x82'))[_0x29d6('0x47')](_0x29d6('0x83'),_0x2a3999['params']['id'][_0x29d6('0x7b')]()))[_0x29d6('0x47')](_0x29d6('0x81'),squel[_0x29d6('0x77')]()[_0x29d6('0x78')](_0x29d6('0x84'))[_0x29d6('0x7c')]('cm_hopper')[_0x29d6('0x47')](_0x29d6('0x83'),_0x2a3999[_0x29d6('0x5c')]['id']['toString']())))[_0x29d6('0x7b')]();break;case _0x29d6('0x85'):_0x23af0e=squel[_0x29d6('0x6f')]()[_0x29d6('0x70')](_0x29d6('0x71'))['fromQuery']([_0x29d6('0x73'),_0x29d6('0x74'),'ContactId',_0x29d6('0x76'),_0x29d6('0x62'),_0x29d6('0x5f'),_0x29d6('0x60')],squel['select']()[_0x29d6('0x78')](_0x29d6('0x73'),'phone')['field'](_0x29d6('0x79'),_0x29d6('0x74'))['field']('id',_0x29d6('0x75'))['field'](_0x28fc89['CmListId'][_0x29d6('0x7b')](),'ListId')[_0x29d6('0x78')](_0x2a3999['params']['id'][_0x29d6('0x7b')](),_0x29d6('0x62'))[_0x29d6('0x78')]('\x27'+_0x3a1c44+'\x27','createdAt')['field']('\x27'+_0x3a1c44+'\x27','updatedAt')[_0x29d6('0x7c')]('cm_contacts')[_0x29d6('0x47')]('deletedAt\x20IS\x20NULL')[_0x29d6('0x47')]('ListId\x20=\x20?',_0x28fc89[_0x29d6('0x7a')][_0x29d6('0x7b')]())[_0x29d6('0x47')](_0x29d6('0x80'))[_0x29d6('0x47')](_0x29d6('0x81'),squel['select']()[_0x29d6('0x78')]('COALESCE(phone,\x27\x27)')['from'](_0x29d6('0x71'))['where'](_0x29d6('0x83'),_0x2a3999[_0x29d6('0x5c')]['id'][_0x29d6('0x7b')]())))[_0x29d6('0x7b')]();break;default:_0x23af0e=squel[_0x29d6('0x6f')]()[_0x29d6('0x70')]('cm_hopper')[_0x29d6('0x72')]([_0x29d6('0x73'),_0x29d6('0x74'),_0x29d6('0x75'),_0x29d6('0x76'),'CampaignId',_0x29d6('0x5f'),'updatedAt'],squel[_0x29d6('0x77')]()[_0x29d6('0x78')](_0x29d6('0x73'),'phone')[_0x29d6('0x78')]('NOW()',_0x29d6('0x74'))[_0x29d6('0x78')]('id',_0x29d6('0x75'))['field'](_0x28fc89[_0x29d6('0x7a')][_0x29d6('0x7b')](),_0x29d6('0x76'))[_0x29d6('0x78')](_0x2a3999[_0x29d6('0x5c')]['id'][_0x29d6('0x7b')](),_0x29d6('0x62'))[_0x29d6('0x78')]('\x27'+_0x3a1c44+'\x27',_0x29d6('0x5f'))[_0x29d6('0x78')]('\x27'+_0x3a1c44+'\x27',_0x29d6('0x60'))[_0x29d6('0x7c')]('cm_contacts')[_0x29d6('0x47')]('deletedAt\x20IS\x20NULL')[_0x29d6('0x47')](_0x29d6('0x7f'),_0x28fc89[_0x29d6('0x7a')][_0x29d6('0x7b')]())[_0x29d6('0x47')](_0x29d6('0x80')))[_0x29d6('0x7b')]();}_0x168c4a=squel[_0x29d6('0x6f')]()[_0x29d6('0x70')](_0x29d6('0x86'))['fromQuery']([_0x29d6('0x87'),'scheduledAt',_0x29d6('0x73'),_0x29d6('0x88'),_0x29d6('0x5f'),'updatedAt'],squel['select']()['field'](_0x29d6('0x89'),'id')[_0x29d6('0x78')]('NOW()',_0x29d6('0x74'))['field'](_0x29d6('0x8a'),_0x29d6('0x73'))[_0x29d6('0x78')](_0x29d6('0x8b'),_0x29d6('0x88'))[_0x29d6('0x78')]('\x27'+_0x3a1c44+'\x27',_0x29d6('0x5f'))[_0x29d6('0x78')]('\x27'+_0x3a1c44+'\x27',_0x29d6('0x60'))[_0x29d6('0x7c')](_0x29d6('0x8c'),'ci')[_0x29d6('0x8d')](_0x29d6('0x71'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x29d6('0x47')]('h.ListId\x20=\x20?',_0x28fc89['CmListId'][_0x29d6('0x7b')]())[_0x29d6('0x47')](_0x29d6('0x8e'),_0x2a3999[_0x29d6('0x5c')]['id'][_0x29d6('0x7b')]())[_0x29d6('0x47')](_0x29d6('0x8f'),_0x3a1c44))['toString']();_0x238208[_0x29d6('0x90')](db['sequelize'][_0x29d6('0x39')](_0x23af0e));_0x81e1f0[_0x29d6('0x90')](db[_0x29d6('0x91')]['query'](_0x168c4a));}return BPromise[_0x29d6('0x92')](_0x238208);}})[_0x29d6('0x2c')](function(){return BPromise['all'](_0x81e1f0);})[_0x29d6('0x2c')](function(){return _0x206cff;})[_0x29d6('0x2c')](respondWithResult(_0x33e2f9,null))[_0x29d6('0x4e')](handleError(_0x33e2f9,null));};exports[_0x29d6('0x93')]=function(_0x245b8e,_0x511eaf,_0x1b84d9){return db[_0x29d6('0x4a')]['find']({'where':{'id':_0x245b8e['params']['id']}})[_0x29d6('0x2c')](handleEntityNotFound(_0x511eaf,null))[_0x29d6('0x2c')](function(_0xb2d8e4){if(_0xb2d8e4){return _0xb2d8e4[_0x29d6('0x93')](_0x245b8e[_0x29d6('0x39')][_0x29d6('0x6c')]);}})[_0x29d6('0x2c')](function(_0x3a323e){if(_0x3a323e){return db[_0x29d6('0x94')][_0x29d6('0x2b')]({'where':{'ListId':_0x245b8e['query']['ids'],'CampaignId':_0x245b8e[_0x29d6('0x5c')]['id']}})[_0x29d6('0x2c')](function(){return _0x3a323e;});}})[_0x29d6('0x2c')](respondWithStatusCode(_0x511eaf,null))[_0x29d6('0x4e')](handleError(_0x511eaf,null));};exports[_0x29d6('0x95')]=function(_0x56fc6c,_0x2c30e9,_0x247035){var _0x1c91d8={};var _0x330a7a={};var _0x333d3c;var _0x749cb1;return db['Campaign'][_0x29d6('0x61')]({'where':{'id':_0x56fc6c[_0x29d6('0x5c')]['id']}})[_0x29d6('0x2c')](handleEntityNotFound(_0x2c30e9,null))[_0x29d6('0x2c')](function(_0x56183d){if(_0x56183d){_0x333d3c=_0x56183d;_0x330a7a[_0x29d6('0x3d')]=_['keys'](db[_0x29d6('0x68')][_0x29d6('0x35')]);_0x330a7a['query']=_[_0x29d6('0x3a')](_0x56fc6c['query']);_0x330a7a['filters']=_[_0x29d6('0x3c')](_0x330a7a[_0x29d6('0x3d')],_0x330a7a[_0x29d6('0x39')]);_0x1c91d8['attributes']=_[_0x29d6('0x3c')](_0x330a7a[_0x29d6('0x3d')],qs['fields'](_0x56fc6c[_0x29d6('0x39')][_0x29d6('0x3f')]));_0x1c91d8[_0x29d6('0x3e')]=_0x1c91d8['attributes'][_0x29d6('0x40')]?_0x1c91d8['attributes']:_0x330a7a[_0x29d6('0x3d')];_0x1c91d8[_0x29d6('0x43')]=qs[_0x29d6('0x44')](_0x56fc6c[_0x29d6('0x39')][_0x29d6('0x44')]);_0x1c91d8['where']=qs[_0x29d6('0x3b')](_[_0x29d6('0x45')](_0x56fc6c[_0x29d6('0x39')],_0x330a7a[_0x29d6('0x3b')]));if(_0x56fc6c[_0x29d6('0x39')][_0x29d6('0x46')]){_0x1c91d8[_0x29d6('0x47')]=_[_0x29d6('0x48')](_0x1c91d8['where'],{'$or':_[_0x29d6('0x34')](_0x1c91d8['attributes'],function(_0x2e555e){var _0x13f78c={};_0x13f78c[_0x2e555e]={'$like':'%'+_0x56fc6c[_0x29d6('0x39')]['filter']+'%'};return _0x13f78c;})});}_0x1c91d8=_[_0x29d6('0x48')]({},_0x1c91d8,_0x56fc6c['options']);return _0x333d3c['getBlackLists'](_0x1c91d8);}})[_0x29d6('0x2c')](function(_0x213b19){if(_0x213b19){_0x749cb1=_0x213b19[_0x29d6('0x40')];if(!_0x56fc6c['query'][_0x29d6('0x41')](_0x29d6('0x42'))){_0x1c91d8[_0x29d6('0x21')]=qs[_0x29d6('0x21')](_0x56fc6c[_0x29d6('0x39')][_0x29d6('0x21')]);_0x1c91d8[_0x29d6('0x1f')]=qs[_0x29d6('0x1f')](_0x56fc6c[_0x29d6('0x39')][_0x29d6('0x1f')]);}return _0x333d3c[_0x29d6('0x95')](_0x1c91d8);}})[_0x29d6('0x2c')](function(_0x5cb616){if(_0x5cb616){return _0x5cb616?{'count':_0x749cb1,'rows':_0x5cb616}:null;}})[_0x29d6('0x2c')](respondWithResult(_0x2c30e9,null))[_0x29d6('0x4e')](handleError(_0x2c30e9,null));};exports[_0x29d6('0x96')]=function(_0x19a601,_0x3471d0,_0x267fe3){var _0x54f859,_0x2cfbbd;var _0x21dc0f=[];var _0x415f68=moment()['format'](_0x29d6('0x6a'));return db['Campaign'][_0x29d6('0x50')]({'where':{'id':_0x19a601[_0x29d6('0x5c')]['id']}})[_0x29d6('0x2c')](handleEntityNotFound(_0x3471d0,null))[_0x29d6('0x2c')](function(_0x5695d7){if(_0x5695d7){_0x2cfbbd=_0x5695d7;return _0x5695d7['addBlackLists'](_0x19a601[_0x29d6('0x52')][_0x29d6('0x6c')],_['omit'](_0x19a601['body'],[_0x29d6('0x6c'),'id'])||{});}return null;})[_0x29d6('0x97')](function(_0x39ac3e){var _0x1ef741;var _0x184ba3;_0x54f859=_0x39ac3e||[];var _0x435ab8=[];if(_0x39ac3e){for(var _0x5ab7ec=0x0;_0x5ab7ec<_0x39ac3e[_0x29d6('0x40')];_0x5ab7ec+=0x1){var _0x79b417=_0x39ac3e[_0x5ab7ec][_0x29d6('0x2d')]({'plain':!![]});_0x1ef741=squel[_0x29d6('0x6f')]()['into'](_0x29d6('0x98'))['fromQuery']([_0x29d6('0x73'),'ContactId',_0x29d6('0x76'),'CampaignId',_0x29d6('0x5f'),'updatedAt'],squel[_0x29d6('0x77')]()[_0x29d6('0x78')]('phone',_0x29d6('0x73'))[_0x29d6('0x78')]('id',_0x29d6('0x75'))[_0x29d6('0x78')](_0x79b417[_0x29d6('0x7a')][_0x29d6('0x7b')](),'ListId')[_0x29d6('0x78')](_0x19a601[_0x29d6('0x5c')]['id'][_0x29d6('0x7b')](),'CampaignId')[_0x29d6('0x78')](_0x29d6('0x79'),'createdAt')[_0x29d6('0x78')](_0x29d6('0x79'),_0x29d6('0x60'))['from'](_0x29d6('0x7d'))[_0x29d6('0x47')]('deletedAt\x20IS\x20NULL')[_0x29d6('0x47')](_0x29d6('0x7f'),_0x79b417[_0x29d6('0x7a')]['toString']())[_0x29d6('0x47')](_0x29d6('0x80')))[_0x29d6('0x7b')]();_0x435ab8[_0x29d6('0x90')](db[_0x29d6('0x91')]['query'](_0x1ef741));}return BPromise['all'](_0x435ab8);}})[_0x29d6('0x2c')](function(){return _0x54f859;})[_0x29d6('0x2c')](respondWithResult(_0x3471d0,null))[_0x29d6('0x4e')](handleError(_0x3471d0,null));};exports[_0x29d6('0x99')]=function(_0x234c1e,_0x2de2ea,_0x2b37a8){return db[_0x29d6('0x4a')]['find']({'where':{'id':_0x234c1e[_0x29d6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2de2ea,null))[_0x29d6('0x2c')](function(_0x59046e){if(_0x59046e){return _0x59046e['removeBlackLists'](_0x234c1e[_0x29d6('0x39')][_0x29d6('0x6c')]);}})['then'](function(_0x40af2e){if(_0x40af2e){return db[_0x29d6('0x67')][_0x29d6('0x2b')]({'where':{'ListId':_0x234c1e[_0x29d6('0x39')][_0x29d6('0x6c')],'CampaignId':_0x234c1e[_0x29d6('0x5c')]['id']}})[_0x29d6('0x2c')](function(){return _0x40af2e;});}})[_0x29d6('0x2c')](respondWithStatusCode(_0x2de2ea,null))[_0x29d6('0x4e')](handleError(_0x2de2ea,null));}; \ No newline at end of file +var _0x6085=['hasOwnProperty','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','CampaignId','CmHopperBlack','getLists','CmList','addLists','format','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','CmListId','toString','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','get','IvrCampaigns','UserProfileResource','then','stack','name','index','rawAttributes','fieldName','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Campaign','includeAll','include','findAll','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','UserProfileSection','autoAssociation','getHoppers','CmHopper'];(function(_0x292b1f,_0x18bb11){var _0x3cb50a=function(_0x3e3e3c){while(--_0x3e3e3c){_0x292b1f['push'](_0x292b1f['shift']());}};_0x3cb50a(++_0x18bb11);}(_0x6085,0x15d));var _0x5608=function(_0x11e9ef,_0xcdff5b){_0x11e9ef=_0x11e9ef-0x0;var _0x3b46f3=_0x6085[_0x11e9ef];return _0x3b46f3;};'use strict';var emlformat=require(_0x5608('0x0'));var rimraf=require(_0x5608('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5608('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5608('0x3'));var util=require(_0x5608('0x4'));var path=require('path');var sox=require(_0x5608('0x5'));var csv=require(_0x5608('0x6'));var ejs=require(_0x5608('0x7'));var fs=require('fs');var fs_extra=require(_0x5608('0x8'));var _=require(_0x5608('0x9'));var squel=require('squel');var crypto=require(_0x5608('0xa'));var jsforce=require(_0x5608('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5608('0x6'));var querystring=require(_0x5608('0xc'));var Papa=require('papaparse');var Redis=require(_0x5608('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5608('0xe'));var hardwareService=require(_0x5608('0xf'));var logger=require(_0x5608('0x10'))(_0x5608('0x11'));var utils=require(_0x5608('0x12'));var config=require(_0x5608('0x13'));var licenseUtil=require(_0x5608('0x14'));var db=require(_0x5608('0x15'))['db'];function respondWithStatusCode(_0x1f9e24,_0x53acef){_0x53acef=_0x53acef||0xcc;return function(_0x3100c0){if(_0x3100c0){return _0x1f9e24[_0x5608('0x16')](_0x53acef);}return _0x1f9e24['status'](_0x53acef)[_0x5608('0x17')]();};}function respondWithResult(_0xfb28fc,_0x29c995){_0x29c995=_0x29c995||0xc8;return function(_0x5bc006){if(_0x5bc006){return _0xfb28fc[_0x5608('0x18')](_0x29c995)[_0x5608('0x19')](_0x5bc006);}};}function respondWithFilteredResult(_0x316620,_0x2b1dbf){return function(_0x554d01){if(_0x554d01){var _0x2c128d=typeof _0x2b1dbf['offset']===_0x5608('0x1a')&&typeof _0x2b1dbf[_0x5608('0x1b')]===_0x5608('0x1a');var _0x5109b2=_0x554d01[_0x5608('0x1c')];var _0x80f1dc=_0x2c128d?0x0:_0x2b1dbf[_0x5608('0x1d')];var _0x228ae2=_0x2c128d?_0x554d01['count']:_0x2b1dbf[_0x5608('0x1d')]+_0x2b1dbf['limit'];var _0xd921c5;if(_0x228ae2>=_0x5109b2){_0x228ae2=_0x5109b2;_0xd921c5=0xc8;}else{_0xd921c5=0xce;}_0x316620[_0x5608('0x18')](_0xd921c5);return _0x316620[_0x5608('0x1e')](_0x5608('0x1f'),_0x80f1dc+'-'+_0x228ae2+'/'+_0x5109b2)[_0x5608('0x19')](_0x554d01);}return null;};}function patchUpdates(_0x273170){return function(_0x112bc4){try{jsonpatch['apply'](_0x112bc4,_0x273170,!![]);}catch(_0x18e50f){return BPromise[_0x5608('0x20')](_0x18e50f);}return _0x112bc4[_0x5608('0x21')]();};}function saveUpdates(_0x10404e,_0x356a6c){return function(_0x3764ca){if(_0x3764ca){return _0x3764ca[_0x5608('0x22')](_0x10404e)['then'](function(_0x505d26){return _0x505d26;});}return null;};}function removeEntity(_0x5864b7,_0x15146b){return function(_0x3bcbaf){if(_0x3bcbaf){return _0x3bcbaf[_0x5608('0x23')]()['then'](function(){var _0x312b7b=_0x3bcbaf[_0x5608('0x24')]({'plain':!![]});var _0x3779ca=_0x5608('0x25');return db[_0x5608('0x26')]['destroy']({'where':{'type':_0x3779ca,'resourceId':_0x312b7b['id']}})['then'](function(){return _0x3bcbaf;});})[_0x5608('0x27')](function(){_0x5864b7[_0x5608('0x18')](0xcc)[_0x5608('0x17')]();});}};}function handleEntityNotFound(_0x1be8d1,_0x5b359c){return function(_0x1953ef){if(!_0x1953ef){_0x1be8d1['sendStatus'](0x194);}return _0x1953ef;};}function handleError(_0x171b39,_0x516683){_0x516683=_0x516683||0x1f4;return function(_0x5961c4){logger['error'](_0x5961c4[_0x5608('0x28')]);if(_0x5961c4[_0x5608('0x29')]){delete _0x5961c4[_0x5608('0x29')];}_0x171b39['status'](_0x516683)['send'](_0x5961c4);};}exports[_0x5608('0x2a')]=function(_0x4198fa,_0x28f9af){var _0x16413e={},_0x44438b={},_0x23156b={'count':0x0,'rows':[]};var _0x1c1733=_['map'](db['Campaign'][_0x5608('0x2b')],function(_0x18b465){return{'name':_0x18b465[_0x5608('0x2c')],'type':_0x18b465['type'][_0x5608('0x2d')]};});_0x44438b['model']=_[_0x5608('0x2e')](_0x1c1733,_0x5608('0x29'));_0x44438b[_0x5608('0x2f')]=_['keys'](_0x4198fa['query']);_0x44438b[_0x5608('0x30')]=_[_0x5608('0x31')](_0x44438b['model'],_0x44438b[_0x5608('0x2f')]);_0x16413e[_0x5608('0x32')]=_[_0x5608('0x31')](_0x44438b[_0x5608('0x33')],qs[_0x5608('0x34')](_0x4198fa['query'][_0x5608('0x34')]));_0x16413e[_0x5608('0x32')]=_0x16413e[_0x5608('0x32')][_0x5608('0x35')]?_0x16413e[_0x5608('0x32')]:_0x44438b[_0x5608('0x33')];if(!_0x4198fa[_0x5608('0x2f')]['hasOwnProperty'](_0x5608('0x36'))){_0x16413e[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x4198fa[_0x5608('0x2f')][_0x5608('0x1b')]);_0x16413e[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x4198fa['query'][_0x5608('0x1d')]);}_0x16413e[_0x5608('0x37')]=qs[_0x5608('0x38')](_0x4198fa['query'][_0x5608('0x38')]);_0x16413e[_0x5608('0x39')]=qs[_0x5608('0x30')](_[_0x5608('0x3a')](_0x4198fa[_0x5608('0x2f')],_0x44438b[_0x5608('0x30')]),_0x1c1733);if(_0x4198fa[_0x5608('0x2f')]['filter']){_0x16413e['where']=_[_0x5608('0x3b')](_0x16413e[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x1c1733,function(_0x4243d7){if(_0x4243d7[_0x5608('0x3c')]!==_0x5608('0x3d')){var _0x208f90={};_0x208f90[_0x4243d7[_0x5608('0x29')]]={'$like':'%'+_0x4198fa[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x208f90;}})});}_0x16413e=_[_0x5608('0x3b')]({},_0x16413e,_0x4198fa[_0x5608('0x3f')]);var _0x2ccd32={'where':_0x16413e[_0x5608('0x39')]};return db[_0x5608('0x40')][_0x5608('0x1c')](_0x2ccd32)[_0x5608('0x27')](function(_0x2ff1b0){_0x23156b[_0x5608('0x1c')]=_0x2ff1b0;if(_0x4198fa[_0x5608('0x2f')][_0x5608('0x41')]){_0x16413e[_0x5608('0x42')]=[{'all':!![]}];}return db[_0x5608('0x40')][_0x5608('0x43')](_0x16413e);})[_0x5608('0x27')](function(_0x2f721b){_0x23156b[_0x5608('0x44')]=_0x2f721b;return _0x23156b;})[_0x5608('0x27')](respondWithFilteredResult(_0x28f9af,_0x16413e))[_0x5608('0x45')](handleError(_0x28f9af,null));};exports['show']=function(_0x4ba682,_0x3d7f99){var _0xff08ee={'raw':![],'where':{'id':_0x4ba682[_0x5608('0x46')]['id']}},_0x18d2db={};_0x18d2db['model']=_[_0x5608('0x47')](db[_0x5608('0x40')][_0x5608('0x2b')]);_0x18d2db['query']=_[_0x5608('0x47')](_0x4ba682['query']);_0x18d2db[_0x5608('0x30')]=_[_0x5608('0x31')](_0x18d2db[_0x5608('0x33')],_0x18d2db['query']);_0xff08ee[_0x5608('0x32')]=_[_0x5608('0x31')](_0x18d2db[_0x5608('0x33')],qs[_0x5608('0x34')](_0x4ba682['query'][_0x5608('0x34')]));_0xff08ee[_0x5608('0x32')]=_0xff08ee[_0x5608('0x32')][_0x5608('0x35')]?_0xff08ee['attributes']:_0x18d2db['model'];if(_0x4ba682['query']['includeAll']){_0xff08ee['include']=[{'all':!![]}];}_0xff08ee=_[_0x5608('0x3b')]({},_0xff08ee,_0x4ba682[_0x5608('0x3f')]);return db[_0x5608('0x40')][_0x5608('0x48')](_0xff08ee)[_0x5608('0x27')](handleEntityNotFound(_0x3d7f99,null))[_0x5608('0x27')](respondWithResult(_0x3d7f99,null))[_0x5608('0x45')](handleError(_0x3d7f99,null));};exports[_0x5608('0x49')]=function(_0x37ca95,_0x397785){return db[_0x5608('0x40')][_0x5608('0x49')](_0x37ca95[_0x5608('0x4a')],{})['then'](function(_0x236319){var _0x46edef=_0x37ca95['user'][_0x5608('0x24')]({'plain':!![]});if(!_0x46edef)throw new Error(_0x5608('0x4b'));if(_0x46edef[_0x5608('0x4c')]===_0x5608('0x4d')){var _0xb876af=_0x236319['get']({'plain':!![]});var _0x5baa25=_0x5608('0x25');return db['UserProfileSection'][_0x5608('0x48')]({'where':{'name':_0x5baa25,'userProfileId':_0x46edef[_0x5608('0x4e')]},'raw':!![]})[_0x5608('0x27')](function(_0x4c945a){if(_0x4c945a&&_0x4c945a['autoAssociation']===0x0){return db[_0x5608('0x26')]['create']({'name':_0xb876af['name'],'resourceId':_0xb876af['id'],'type':_0x4c945a[_0x5608('0x29')],'sectionId':_0x4c945a['id']},{})[_0x5608('0x27')](function(){return _0x236319;});}else{return _0x236319;}})[_0x5608('0x45')](function(_0x333ed3){logger[_0x5608('0x4f')](_0x5608('0x50'),_0x333ed3);throw _0x333ed3;});}return _0x236319;})[_0x5608('0x27')](respondWithResult(_0x397785,0xc9))[_0x5608('0x45')](handleError(_0x397785,null));};exports[_0x5608('0x51')]=function(_0x264158,_0x5c0b6e){var _0x3123c9={'where':{'id':_0x264158['params']['id']}},_0x1257d4={};_0x1257d4['model']=_[_0x5608('0x47')](db[_0x5608('0x40')]['rawAttributes']);_0x3123c9[_0x5608('0x32')]=_[_0x5608('0x31')](_0x1257d4[_0x5608('0x33')],qs[_0x5608('0x34')](_0x264158[_0x5608('0x2f')][_0x5608('0x34')]));_0x3123c9['attributes']=_0x3123c9[_0x5608('0x32')]['length']?_0x3123c9[_0x5608('0x32')]:_0x1257d4[_0x5608('0x33')];if(_0x264158[_0x5608('0x2f')][_0x5608('0x41')]){_0x3123c9[_0x5608('0x42')]=[{'all':!![]}];}_0x3123c9=_[_0x5608('0x3b')]({},_0x3123c9,_0x264158[_0x5608('0x3f')]);return db[_0x5608('0x40')][_0x5608('0x48')](_0x3123c9)[_0x5608('0x27')](handleEntityNotFound(_0x5c0b6e,null))[_0x5608('0x27')](function(_0x66c551){if(_0x66c551){var _0x498d02=_0x66c551[_0x5608('0x24')]({'plain':!![]});_0x498d02=qs[_0x5608('0x52')](_0x498d02,['id','createdAt',_0x5608('0x53')]);_0x264158[_0x5608('0x4a')]=_[_0x5608('0x52')](_0x264158[_0x5608('0x4a')],['id',_0x5608('0x54'),_0x5608('0x53')]);return db[_0x5608('0x40')]['create'](_[_0x5608('0x3b')](_0x498d02,_0x264158['body']),{'include':_0x264158[_0x5608('0x2f')][_0x5608('0x41')]?[{'all':!![]}]:undefined})[_0x5608('0x27')](function(_0x4a5de0){var _0x7c35e=_0x264158[_0x5608('0x4d')][_0x5608('0x24')]({'plain':!![]});if(!_0x7c35e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7c35e[_0x5608('0x4c')]==='user'){var _0x2ff6ad=_0x4a5de0[_0x5608('0x24')]({'plain':!![]});var _0x4d2ef0=_0x5608('0x25');return db[_0x5608('0x55')][_0x5608('0x48')]({'where':{'name':_0x4d2ef0,'userProfileId':_0x7c35e[_0x5608('0x4e')]},'raw':!![]})[_0x5608('0x27')](function(_0x587185){if(_0x587185&&_0x587185[_0x5608('0x56')]===0x0){return db[_0x5608('0x26')]['create']({'name':_0x2ff6ad[_0x5608('0x29')],'resourceId':_0x2ff6ad['id'],'type':_0x587185[_0x5608('0x29')],'sectionId':_0x587185['id']},{})[_0x5608('0x27')](function(){return _0x4a5de0;});}else{return _0x4a5de0;}})[_0x5608('0x45')](function(_0x206ad8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x206ad8);throw _0x206ad8;});}return _0x4a5de0;});}})['then'](respondWithResult(_0x5c0b6e,0xc9))['catch'](handleError(_0x5c0b6e,null));};exports[_0x5608('0x22')]=function(_0x43170f,_0x3d394d){if(_0x43170f[_0x5608('0x4a')]['id']){delete _0x43170f['body']['id'];}return db[_0x5608('0x40')][_0x5608('0x48')]({'where':{'id':_0x43170f[_0x5608('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d394d,null))[_0x5608('0x27')](saveUpdates(_0x43170f['body'],null))[_0x5608('0x27')](respondWithResult(_0x3d394d,null))[_0x5608('0x45')](handleError(_0x3d394d,null));};exports[_0x5608('0x23')]=function(_0xa0c4a5,_0x2dbdd2){return db[_0x5608('0x40')][_0x5608('0x48')]({'where':{'id':_0xa0c4a5[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x2dbdd2,null))[_0x5608('0x27')](removeEntity(_0x2dbdd2,null))[_0x5608('0x45')](handleError(_0x2dbdd2,null));};exports[_0x5608('0x57')]=function(_0x3b5359,_0x468754,_0x5b7ecc){var _0x32bd83={'raw':!![],'where':{}};var _0x864ef8={};var _0x250ef2={'count':0x0,'rows':[]};return db[_0x5608('0x40')]['findOne']({'where':{'id':_0x3b5359[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x468754,null))[_0x5608('0x27')](function(_0x2e20ae){if(_0x2e20ae){_0x864ef8[_0x5608('0x33')]=_[_0x5608('0x47')](db[_0x5608('0x58')][_0x5608('0x2b')]);_0x864ef8[_0x5608('0x2f')]=_['keys'](_0x3b5359[_0x5608('0x2f')]);_0x864ef8['filters']=_['intersection'](_0x864ef8[_0x5608('0x33')],_0x864ef8[_0x5608('0x2f')]);_0x32bd83['attributes']=_[_0x5608('0x31')](_0x864ef8[_0x5608('0x33')],qs['fields'](_0x3b5359['query'][_0x5608('0x34')]));_0x32bd83[_0x5608('0x32')]=_0x32bd83[_0x5608('0x32')][_0x5608('0x35')]?_0x32bd83[_0x5608('0x32')]:_0x864ef8[_0x5608('0x33')];if(!_0x3b5359[_0x5608('0x2f')][_0x5608('0x59')](_0x5608('0x36'))){_0x32bd83[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x3b5359[_0x5608('0x2f')][_0x5608('0x1b')]);_0x32bd83[_0x5608('0x1d')]=qs['offset'](_0x3b5359['query']['offset']);}_0x32bd83[_0x5608('0x37')]=qs['sort'](_0x3b5359[_0x5608('0x2f')][_0x5608('0x38')]);_0x32bd83[_0x5608('0x39')]=qs[_0x5608('0x30')](_['pick'](_0x3b5359['query'],_0x864ef8[_0x5608('0x30')]));_0x32bd83[_0x5608('0x39')]['CampaignId']=_0x2e20ae['id'];if(_0x3b5359['query'][_0x5608('0x3e')]){_0x32bd83[_0x5608('0x39')]=_[_0x5608('0x3b')](_0x32bd83[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x32bd83[_0x5608('0x32')],function(_0x326a15){var _0x1e23c6={};_0x1e23c6[_0x326a15]={'$like':'%'+_0x3b5359['query']['filter']+'%'};return _0x1e23c6;})});}_0x32bd83=_[_0x5608('0x3b')]({},_0x32bd83,_0x3b5359[_0x5608('0x3f')]);return db['CmHopper'][_0x5608('0x1c')]({'where':_0x32bd83[_0x5608('0x39')]})['then'](function(_0x4dbdfe){_0x250ef2[_0x5608('0x1c')]=_0x4dbdfe;if(_0x3b5359[_0x5608('0x2f')][_0x5608('0x41')]){_0x32bd83[_0x5608('0x42')]=[{'all':!![]}];}return db[_0x5608('0x58')][_0x5608('0x43')](_0x32bd83);})['then'](function(_0x26579d){_0x250ef2['rows']=_0x26579d;return _0x250ef2;});}})[_0x5608('0x27')](respondWithFilteredResult(_0x468754,_0x32bd83))['catch'](handleError(_0x468754,null));};exports[_0x5608('0x5a')]=function(_0x573fe8,_0x308ce8,_0x14ca1a){var _0x44b83e={'raw':!![],'where':{}};var _0xc1b813={};var _0x9a2163={'count':0x0,'rows':[]};return db[_0x5608('0x40')][_0x5608('0x5b')]({'where':{'id':_0x573fe8[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x308ce8,null))[_0x5608('0x27')](function(_0x65ce06){if(_0x65ce06){_0xc1b813['model']=_[_0x5608('0x47')](db['CmHopperHistory']['rawAttributes']);_0xc1b813[_0x5608('0x2f')]=_['keys'](_0x573fe8['query']);_0xc1b813[_0x5608('0x30')]=_[_0x5608('0x31')](_0xc1b813[_0x5608('0x33')],_0xc1b813[_0x5608('0x2f')]);_0x44b83e[_0x5608('0x32')]=_[_0x5608('0x31')](_0xc1b813[_0x5608('0x33')],qs[_0x5608('0x34')](_0x573fe8[_0x5608('0x2f')]['fields']));_0x44b83e[_0x5608('0x32')]=_0x44b83e['attributes']['length']?_0x44b83e[_0x5608('0x32')]:_0xc1b813[_0x5608('0x33')];if(!_0x573fe8[_0x5608('0x2f')][_0x5608('0x59')]('nolimit')){_0x44b83e[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x573fe8[_0x5608('0x2f')][_0x5608('0x1b')]);_0x44b83e[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x573fe8[_0x5608('0x2f')][_0x5608('0x1d')]);}_0x44b83e[_0x5608('0x37')]=qs[_0x5608('0x38')](_0x573fe8[_0x5608('0x2f')]['sort']);_0x44b83e[_0x5608('0x39')]=qs['filters'](_['pick'](_0x573fe8[_0x5608('0x2f')],_0xc1b813['filters']));_0x44b83e[_0x5608('0x39')]['CampaignId']=_0x65ce06['id'];if(_0x573fe8['query'][_0x5608('0x3e')]){_0x44b83e['where']=_[_0x5608('0x3b')](_0x44b83e['where'],{'$or':_['map'](_0x44b83e[_0x5608('0x32')],function(_0x22f316){var _0x4c4f9f={};_0x4c4f9f[_0x22f316]={'$like':'%'+_0x573fe8[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x4c4f9f;})});}_0x44b83e=_[_0x5608('0x3b')]({},_0x44b83e,_0x573fe8[_0x5608('0x3f')]);return db[_0x5608('0x5c')][_0x5608('0x1c')]({'where':_0x44b83e[_0x5608('0x39')]})['then'](function(_0x2eb7fc){_0x9a2163[_0x5608('0x1c')]=_0x2eb7fc;if(_0x573fe8['query']['includeAll']){_0x44b83e[_0x5608('0x42')]=[{'all':!![]}];}return db[_0x5608('0x5c')][_0x5608('0x43')](_0x44b83e);})[_0x5608('0x27')](function(_0x4d2de1){_0x9a2163['rows']=_0x4d2de1;return _0x9a2163;});}})[_0x5608('0x27')](respondWithFilteredResult(_0x308ce8,_0x44b83e))[_0x5608('0x45')](handleError(_0x308ce8,null));};exports['getHopperFinals']=function(_0x95ec8d,_0x57e019,_0x414953){var _0x212172={'raw':!![],'where':{}};var _0x3ad2ee={};var _0x46e2f7={'count':0x0,'rows':[]};return db[_0x5608('0x40')][_0x5608('0x5b')]({'where':{'id':_0x95ec8d['params']['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x57e019,null))['then'](function(_0x11bdfb){if(_0x11bdfb){_0x3ad2ee['model']=_[_0x5608('0x47')](db[_0x5608('0x5d')][_0x5608('0x2b')]);_0x3ad2ee['query']=_[_0x5608('0x47')](_0x95ec8d['query']);_0x3ad2ee[_0x5608('0x30')]=_['intersection'](_0x3ad2ee[_0x5608('0x33')],_0x3ad2ee[_0x5608('0x2f')]);_0x212172[_0x5608('0x32')]=_[_0x5608('0x31')](_0x3ad2ee['model'],qs['fields'](_0x95ec8d[_0x5608('0x2f')]['fields']));_0x212172[_0x5608('0x32')]=_0x212172['attributes'][_0x5608('0x35')]?_0x212172['attributes']:_0x3ad2ee[_0x5608('0x33')];if(!_0x95ec8d[_0x5608('0x2f')]['hasOwnProperty'](_0x5608('0x36'))){_0x212172[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x95ec8d[_0x5608('0x2f')][_0x5608('0x1b')]);_0x212172[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x95ec8d['query'][_0x5608('0x1d')]);}_0x212172['order']=qs[_0x5608('0x38')](_0x95ec8d['query'][_0x5608('0x38')]);_0x212172['where']=qs[_0x5608('0x30')](_['pick'](_0x95ec8d[_0x5608('0x2f')],_0x3ad2ee[_0x5608('0x30')]));_0x212172['where'][_0x5608('0x5e')]=_0x11bdfb['id'];if(_0x95ec8d[_0x5608('0x2f')][_0x5608('0x3e')]){_0x212172[_0x5608('0x39')]=_[_0x5608('0x3b')](_0x212172[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x212172[_0x5608('0x32')],function(_0x3fe130){var _0x4c311b={};_0x4c311b[_0x3fe130]={'$like':'%'+_0x95ec8d[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x4c311b;})});}_0x212172=_[_0x5608('0x3b')]({},_0x212172,_0x95ec8d[_0x5608('0x3f')]);return db[_0x5608('0x5d')][_0x5608('0x1c')]({'where':_0x212172['where']})[_0x5608('0x27')](function(_0x3a5125){_0x46e2f7[_0x5608('0x1c')]=_0x3a5125;if(_0x95ec8d[_0x5608('0x2f')]['includeAll']){_0x212172['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x212172);})[_0x5608('0x27')](function(_0x3bea2d){_0x46e2f7[_0x5608('0x44')]=_0x3bea2d;return _0x46e2f7;});}})[_0x5608('0x27')](respondWithFilteredResult(_0x57e019,_0x212172))[_0x5608('0x45')](handleError(_0x57e019,null));};exports['getHopperBlacks']=function(_0x3833dd,_0x166008,_0x3fc92b){var _0x33c4aa={'raw':!![],'where':{}};var _0x653d44={};var _0x2ef730={'count':0x0,'rows':[]};return db[_0x5608('0x40')][_0x5608('0x5b')]({'where':{'id':_0x3833dd['params']['id']}})['then'](handleEntityNotFound(_0x166008,null))[_0x5608('0x27')](function(_0x617d9c){if(_0x617d9c){_0x653d44[_0x5608('0x33')]=_[_0x5608('0x47')](db['CmHopperBlack'][_0x5608('0x2b')]);_0x653d44[_0x5608('0x2f')]=_[_0x5608('0x47')](_0x3833dd[_0x5608('0x2f')]);_0x653d44['filters']=_[_0x5608('0x31')](_0x653d44[_0x5608('0x33')],_0x653d44[_0x5608('0x2f')]);_0x33c4aa[_0x5608('0x32')]=_[_0x5608('0x31')](_0x653d44[_0x5608('0x33')],qs[_0x5608('0x34')](_0x3833dd[_0x5608('0x2f')][_0x5608('0x34')]));_0x33c4aa[_0x5608('0x32')]=_0x33c4aa[_0x5608('0x32')]['length']?_0x33c4aa[_0x5608('0x32')]:_0x653d44[_0x5608('0x33')];if(!_0x3833dd[_0x5608('0x2f')]['hasOwnProperty'](_0x5608('0x36'))){_0x33c4aa['limit']=qs[_0x5608('0x1b')](_0x3833dd[_0x5608('0x2f')][_0x5608('0x1b')]);_0x33c4aa[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x3833dd[_0x5608('0x2f')][_0x5608('0x1d')]);}_0x33c4aa['order']=qs[_0x5608('0x38')](_0x3833dd[_0x5608('0x2f')]['sort']);_0x33c4aa[_0x5608('0x39')]=qs[_0x5608('0x30')](_[_0x5608('0x3a')](_0x3833dd[_0x5608('0x2f')],_0x653d44[_0x5608('0x30')]));_0x33c4aa['where'][_0x5608('0x5e')]=_0x617d9c['id'];if(_0x3833dd[_0x5608('0x2f')][_0x5608('0x3e')]){_0x33c4aa[_0x5608('0x39')]=_[_0x5608('0x3b')](_0x33c4aa[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x33c4aa[_0x5608('0x32')],function(_0x29bcfb){var _0x2b2a65={};_0x2b2a65[_0x29bcfb]={'$like':'%'+_0x3833dd[_0x5608('0x2f')]['filter']+'%'};return _0x2b2a65;})});}_0x33c4aa=_[_0x5608('0x3b')]({},_0x33c4aa,_0x3833dd[_0x5608('0x3f')]);return db['CmHopperBlack'][_0x5608('0x1c')]({'where':_0x33c4aa[_0x5608('0x39')]})['then'](function(_0x2130b0){_0x2ef730[_0x5608('0x1c')]=_0x2130b0;if(_0x3833dd[_0x5608('0x2f')][_0x5608('0x41')]){_0x33c4aa[_0x5608('0x42')]=[{'all':!![]}];}return db[_0x5608('0x5f')][_0x5608('0x43')](_0x33c4aa);})[_0x5608('0x27')](function(_0x3a6767){_0x2ef730[_0x5608('0x44')]=_0x3a6767;return _0x2ef730;});}})[_0x5608('0x27')](respondWithFilteredResult(_0x166008,_0x33c4aa))[_0x5608('0x45')](handleError(_0x166008,null));};exports[_0x5608('0x60')]=function(_0x29c8a2,_0x20a119,_0x5067d0){var _0x3502a5={};var _0x4c07b8={};var _0x27761e;var _0x58883d;return db[_0x5608('0x40')]['findOne']({'where':{'id':_0x29c8a2['params']['id']}})['then'](handleEntityNotFound(_0x20a119,null))[_0x5608('0x27')](function(_0x24c275){if(_0x24c275){_0x27761e=_0x24c275;_0x4c07b8[_0x5608('0x33')]=_['keys'](db[_0x5608('0x61')]['rawAttributes']);_0x4c07b8[_0x5608('0x2f')]=_[_0x5608('0x47')](_0x29c8a2[_0x5608('0x2f')]);_0x4c07b8[_0x5608('0x30')]=_[_0x5608('0x31')](_0x4c07b8[_0x5608('0x33')],_0x4c07b8[_0x5608('0x2f')]);_0x3502a5[_0x5608('0x32')]=_[_0x5608('0x31')](_0x4c07b8[_0x5608('0x33')],qs[_0x5608('0x34')](_0x29c8a2[_0x5608('0x2f')][_0x5608('0x34')]));_0x3502a5[_0x5608('0x32')]=_0x3502a5[_0x5608('0x32')][_0x5608('0x35')]?_0x3502a5['attributes']:_0x4c07b8[_0x5608('0x33')];_0x3502a5['order']=qs[_0x5608('0x38')](_0x29c8a2[_0x5608('0x2f')][_0x5608('0x38')]);_0x3502a5[_0x5608('0x39')]=qs[_0x5608('0x30')](_[_0x5608('0x3a')](_0x29c8a2[_0x5608('0x2f')],_0x4c07b8['filters']));if(_0x29c8a2[_0x5608('0x2f')]['filter']){_0x3502a5['where']=_[_0x5608('0x3b')](_0x3502a5['where'],{'$or':_[_0x5608('0x2e')](_0x3502a5[_0x5608('0x32')],function(_0x4087a4){var _0x21e7a3={};_0x21e7a3[_0x4087a4]={'$like':'%'+_0x29c8a2[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x21e7a3;})});}_0x3502a5=_[_0x5608('0x3b')]({},_0x3502a5,_0x29c8a2['options']);return _0x27761e[_0x5608('0x60')](_0x3502a5);}})[_0x5608('0x27')](function(_0xc10258){if(_0xc10258){_0x58883d=_0xc10258[_0x5608('0x35')];if(!_0x29c8a2[_0x5608('0x2f')]['hasOwnProperty'](_0x5608('0x36'))){_0x3502a5[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x29c8a2[_0x5608('0x2f')]['limit']);_0x3502a5[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x29c8a2[_0x5608('0x2f')]['offset']);}return _0x27761e[_0x5608('0x60')](_0x3502a5);}})[_0x5608('0x27')](function(_0x5ecd6c){if(_0x5ecd6c){return _0x5ecd6c?{'count':_0x58883d,'rows':_0x5ecd6c}:null;}})['then'](respondWithResult(_0x20a119,null))[_0x5608('0x45')](handleError(_0x20a119,null));};exports[_0x5608('0x62')]=function(_0x372f71,_0x1df229,_0x563924){var _0x2895a7,_0x3ea04c;var _0x28f8b3=[];var _0x4b3846=moment()[_0x5608('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign']['find']({'where':{'id':_0x372f71[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x1df229,null))[_0x5608('0x27')](function(_0x28660c){if(_0x28660c){_0x3ea04c=_0x28660c;return _0x28660c['addLists'](_0x372f71[_0x5608('0x4a')][_0x5608('0x64')],_[_0x5608('0x52')](_0x372f71['body'],['ids','id'])||{});}return null;})['spread'](function(_0x64af13){var _0xff1183;var _0x37a69a;_0x2895a7=_0x64af13||[];var _0x3fd1c3=[];if(_0x64af13){for(var _0x49c0fc=0x0;_0x49c0fc<_0x64af13[_0x5608('0x35')];_0x49c0fc+=0x1){var _0x233126=_0x64af13[_0x49c0fc][_0x5608('0x24')]({'plain':!![]});_0x3ea04c[_0x5608('0x65')]=_0x372f71['body'][_0x5608('0x65')]?_0x372f71['body'][_0x5608('0x65')]:_0x3ea04c[_0x5608('0x65')];switch(_0x3ea04c[_0x5608('0x65')]){case _0x5608('0x66'):_0xff1183=squel[_0x5608('0x67')]()[_0x5608('0x68')](_0x5608('0x69'))[_0x5608('0x6a')]([_0x5608('0x6b'),_0x5608('0x6c'),_0x5608('0x6d'),'ListId',_0x5608('0x5e'),_0x5608('0x54'),_0x5608('0x53')],squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x6b'),_0x5608('0x6b'))[_0x5608('0x6f')]('NOW()','scheduledAt')['field']('id',_0x5608('0x6d'))[_0x5608('0x6f')](_0x233126[_0x5608('0x70')][_0x5608('0x71')](),'ListId')[_0x5608('0x6f')](_0x372f71[_0x5608('0x46')]['id']['toString'](),_0x5608('0x5e'))[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x54'))[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x53'))[_0x5608('0x72')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x5608('0x39')](_0x5608('0x73'),_0x233126['CmListId'][_0x5608('0x71')]())[_0x5608('0x39')](_0x5608('0x74'))[_0x5608('0x39')](_0x5608('0x75'),squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x76'))[_0x5608('0x72')](_0x5608('0x77'))['where'](_0x5608('0x78'),_0x372f71[_0x5608('0x46')]['id']['toString']()))[_0x5608('0x39')](_0x5608('0x75'),squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x79'))[_0x5608('0x72')](_0x5608('0x69'))[_0x5608('0x39')]('CampaignId\x20=\x20?',_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')]())))[_0x5608('0x71')]();break;case _0x5608('0x7a'):_0xff1183=squel[_0x5608('0x67')]()[_0x5608('0x68')](_0x5608('0x69'))[_0x5608('0x6a')]([_0x5608('0x6b'),_0x5608('0x6c'),'ContactId','ListId','CampaignId',_0x5608('0x54'),_0x5608('0x53')],squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x6b'),_0x5608('0x6b'))['field'](_0x5608('0x7b'),'scheduledAt')['field']('id',_0x5608('0x6d'))[_0x5608('0x6f')](_0x233126['CmListId']['toString'](),'ListId')['field'](_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')](),_0x5608('0x5e'))[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x54'))['field']('\x27'+_0x4b3846+'\x27',_0x5608('0x53'))['from'](_0x5608('0x7c'))[_0x5608('0x39')](_0x5608('0x7d'))['where'](_0x5608('0x73'),_0x233126['CmListId'][_0x5608('0x71')]())[_0x5608('0x39')](_0x5608('0x74'))[_0x5608('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x79'))[_0x5608('0x72')](_0x5608('0x69'))[_0x5608('0x39')]('CampaignId\x20=\x20?',_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')]())))[_0x5608('0x71')]();break;default:_0xff1183=squel[_0x5608('0x67')]()[_0x5608('0x68')](_0x5608('0x69'))[_0x5608('0x6a')]([_0x5608('0x6b'),_0x5608('0x6c'),_0x5608('0x6d'),_0x5608('0x7e'),_0x5608('0x5e'),'createdAt','updatedAt'],squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x6b'),_0x5608('0x6b'))[_0x5608('0x6f')]('NOW()',_0x5608('0x6c'))[_0x5608('0x6f')]('id',_0x5608('0x6d'))[_0x5608('0x6f')](_0x233126[_0x5608('0x70')][_0x5608('0x71')](),_0x5608('0x7e'))['field'](_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')](),_0x5608('0x5e'))['field']('\x27'+_0x4b3846+'\x27','createdAt')[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x53'))['from'](_0x5608('0x7c'))[_0x5608('0x39')](_0x5608('0x7d'))[_0x5608('0x39')](_0x5608('0x73'),_0x233126['CmListId'][_0x5608('0x71')]())[_0x5608('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x5608('0x71')]();}_0x37a69a=squel['insert']()[_0x5608('0x68')](_0x5608('0x7f'))[_0x5608('0x6a')]([_0x5608('0x80'),'scheduledAt',_0x5608('0x6b'),_0x5608('0x81'),_0x5608('0x54'),_0x5608('0x53')],squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x82'),'id')[_0x5608('0x6f')](_0x5608('0x7b'),_0x5608('0x6c'))[_0x5608('0x6f')](_0x5608('0x83'),_0x5608('0x6b'))['field']('ci.OrderBY','OrderBy')[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x54'))[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27','updatedAt')[_0x5608('0x72')](_0x5608('0x84'),'ci')[_0x5608('0x85')]('cm_hopper','h',_0x5608('0x86'))[_0x5608('0x39')]('h.ListId\x20=\x20?',_0x233126[_0x5608('0x70')][_0x5608('0x71')]())[_0x5608('0x39')]('h.CampaignId=?',_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')]())[_0x5608('0x39')](_0x5608('0x87'),_0x4b3846))['toString']();_0x3fd1c3[_0x5608('0x88')](db[_0x5608('0x89')][_0x5608('0x2f')](_0xff1183));_0x28f8b3[_0x5608('0x88')](db[_0x5608('0x89')]['query'](_0x37a69a));}return BPromise[_0x5608('0x8a')](_0x3fd1c3);}})['then'](function(){return BPromise[_0x5608('0x8a')](_0x28f8b3);})[_0x5608('0x27')](function(){return _0x2895a7;})[_0x5608('0x27')](respondWithResult(_0x1df229,null))['catch'](handleError(_0x1df229,null));};exports[_0x5608('0x8b')]=function(_0x1013b2,_0x1bec67,_0xd054c0){return db[_0x5608('0x40')]['find']({'where':{'id':_0x1013b2['params']['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x1bec67,null))['then'](function(_0x359ad6){if(_0x359ad6){return _0x359ad6['removeLists'](_0x1013b2['query']['ids']);}})[_0x5608('0x27')](function(_0x3a3fc5){if(_0x3a3fc5){return db[_0x5608('0x58')][_0x5608('0x23')]({'where':{'ListId':_0x1013b2[_0x5608('0x2f')][_0x5608('0x64')],'CampaignId':_0x1013b2[_0x5608('0x46')]['id']}})['then'](function(){return _0x3a3fc5;});}})[_0x5608('0x27')](respondWithStatusCode(_0x1bec67,null))[_0x5608('0x45')](handleError(_0x1bec67,null));};exports[_0x5608('0x8c')]=function(_0x820c5,_0x161adb,_0x411f93){var _0x1a2561={};var _0x13723a={};var _0x1601be;var _0x4ffa2e;return db['Campaign'][_0x5608('0x5b')]({'where':{'id':_0x820c5[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x161adb,null))[_0x5608('0x27')](function(_0x24e7a4){if(_0x24e7a4){_0x1601be=_0x24e7a4;_0x13723a['model']=_[_0x5608('0x47')](db[_0x5608('0x61')][_0x5608('0x2b')]);_0x13723a['query']=_['keys'](_0x820c5[_0x5608('0x2f')]);_0x13723a[_0x5608('0x30')]=_['intersection'](_0x13723a[_0x5608('0x33')],_0x13723a[_0x5608('0x2f')]);_0x1a2561[_0x5608('0x32')]=_[_0x5608('0x31')](_0x13723a['model'],qs['fields'](_0x820c5[_0x5608('0x2f')][_0x5608('0x34')]));_0x1a2561['attributes']=_0x1a2561[_0x5608('0x32')][_0x5608('0x35')]?_0x1a2561[_0x5608('0x32')]:_0x13723a[_0x5608('0x33')];_0x1a2561[_0x5608('0x37')]=qs[_0x5608('0x38')](_0x820c5[_0x5608('0x2f')]['sort']);_0x1a2561[_0x5608('0x39')]=qs['filters'](_[_0x5608('0x3a')](_0x820c5[_0x5608('0x2f')],_0x13723a[_0x5608('0x30')]));if(_0x820c5[_0x5608('0x2f')]['filter']){_0x1a2561[_0x5608('0x39')]=_[_0x5608('0x3b')](_0x1a2561[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x1a2561[_0x5608('0x32')],function(_0x5c320a){var _0x2a82ad={};_0x2a82ad[_0x5c320a]={'$like':'%'+_0x820c5[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x2a82ad;})});}_0x1a2561=_[_0x5608('0x3b')]({},_0x1a2561,_0x820c5[_0x5608('0x3f')]);return _0x1601be['getBlackLists'](_0x1a2561);}})[_0x5608('0x27')](function(_0x372cf3){if(_0x372cf3){_0x4ffa2e=_0x372cf3[_0x5608('0x35')];if(!_0x820c5[_0x5608('0x2f')][_0x5608('0x59')](_0x5608('0x36'))){_0x1a2561[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x820c5[_0x5608('0x2f')][_0x5608('0x1b')]);_0x1a2561[_0x5608('0x1d')]=qs['offset'](_0x820c5['query'][_0x5608('0x1d')]);}return _0x1601be[_0x5608('0x8c')](_0x1a2561);}})['then'](function(_0x3c27e5){if(_0x3c27e5){return _0x3c27e5?{'count':_0x4ffa2e,'rows':_0x3c27e5}:null;}})[_0x5608('0x27')](respondWithResult(_0x161adb,null))['catch'](handleError(_0x161adb,null));};exports['addBlackLists']=function(_0x4d0e22,_0x5dc08d,_0x4a33e0){var _0x4365f6,_0x12e676;var _0xa99465=[];var _0x51ebfc=moment()[_0x5608('0x63')](_0x5608('0x8d'));return db[_0x5608('0x40')][_0x5608('0x48')]({'where':{'id':_0x4d0e22[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x5dc08d,null))['then'](function(_0x1be058){if(_0x1be058){_0x12e676=_0x1be058;return _0x1be058[_0x5608('0x8e')](_0x4d0e22['body'][_0x5608('0x64')],_['omit'](_0x4d0e22[_0x5608('0x4a')],[_0x5608('0x64'),'id'])||{});}return null;})[_0x5608('0x8f')](function(_0x2e0d46){var _0x4e58ca;var _0x73916e;_0x4365f6=_0x2e0d46||[];var _0x13f3fc=[];if(_0x2e0d46){for(var _0x606ace=0x0;_0x606ace<_0x2e0d46[_0x5608('0x35')];_0x606ace+=0x1){var _0x560805=_0x2e0d46[_0x606ace][_0x5608('0x24')]({'plain':!![]});_0x4e58ca=squel[_0x5608('0x67')]()[_0x5608('0x68')](_0x5608('0x90'))['fromQuery'](['phone',_0x5608('0x6d'),_0x5608('0x7e'),_0x5608('0x5e'),_0x5608('0x54'),_0x5608('0x53')],squel['select']()['field'](_0x5608('0x6b'),'phone')[_0x5608('0x6f')]('id',_0x5608('0x6d'))['field'](_0x560805['CmListId']['toString'](),'ListId')['field'](_0x4d0e22[_0x5608('0x46')]['id']['toString'](),_0x5608('0x5e'))[_0x5608('0x6f')](_0x5608('0x7b'),'createdAt')[_0x5608('0x6f')](_0x5608('0x7b'),'updatedAt')[_0x5608('0x72')](_0x5608('0x7c'))['where'](_0x5608('0x7d'))[_0x5608('0x39')](_0x5608('0x73'),_0x560805[_0x5608('0x70')][_0x5608('0x71')]())['where'](_0x5608('0x74')))['toString']();_0x13f3fc[_0x5608('0x88')](db['sequelize'][_0x5608('0x2f')](_0x4e58ca));}return BPromise[_0x5608('0x8a')](_0x13f3fc);}})[_0x5608('0x27')](function(){return _0x4365f6;})[_0x5608('0x27')](respondWithResult(_0x5dc08d,null))['catch'](handleError(_0x5dc08d,null));};exports[_0x5608('0x91')]=function(_0x25dea3,_0x47ac94,_0x48b75e){return db['Campaign'][_0x5608('0x48')]({'where':{'id':_0x25dea3['params']['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x47ac94,null))[_0x5608('0x27')](function(_0x516565){if(_0x516565){return _0x516565['removeBlackLists'](_0x25dea3[_0x5608('0x2f')][_0x5608('0x64')]);}})[_0x5608('0x27')](function(_0x281ecc){if(_0x281ecc){return db[_0x5608('0x5f')][_0x5608('0x23')]({'where':{'ListId':_0x25dea3[_0x5608('0x2f')][_0x5608('0x64')],'CampaignId':_0x25dea3[_0x5608('0x46')]['id']}})[_0x5608('0x27')](function(){return _0x281ecc;});}})['then'](respondWithStatusCode(_0x47ac94,null))[_0x5608('0x45')](handleError(_0x47ac94,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index e7fc9eb..486f0dc 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(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 21d1d56..99f2aff 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 _0x3379=['attributes','map','include','model','GetCampaign','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','Campaign','findAll','options','raw','where'];(function(_0x381119,_0x5e11f9){var _0x144927=function(_0x5a3938){while(--_0x5a3938){_0x381119['push'](_0x381119['shift']());}};_0x144927(++_0x5e11f9);}(_0x3379,0x115));var _0x9337=function(_0x2cad47,_0x4df2a3){_0x2cad47=_0x2cad47-0x0;var _0x34d75f=_0x3379[_0x2cad47];return _0x34d75f;};'use strict';var _=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var moment=require(_0x9337('0x2'));var BPromise=require(_0x9337('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9337('0x4'));var db=require(_0x9337('0x5'))['db'];var utils=require(_0x9337('0x6'));var logger=require(_0x9337('0x7'))('rpc');var config=require(_0x9337('0x8'));var jayson=require(_0x9337('0x9'));var client=jayson[_0x9337('0xa')][_0x9337('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a59ab,_0x16e2a4,_0x5b1986){return new BPromise(function(_0x268943,_0xdaec59){return client[_0x9337('0xc')](_0x5a59ab,_0x5b1986)[_0x9337('0xd')](function(_0x15c578){logger['info'](_0x9337('0xe'),_0x16e2a4,_0x9337('0xf'));logger[_0x9337('0x10')](_0x9337('0x11'),_0x16e2a4,_0x9337('0xf'),JSON['stringify'](_0x15c578));if(_0x15c578[_0x9337('0x12')]){if(_0x15c578[_0x9337('0x12')][_0x9337('0x13')]===0x1f4){logger[_0x9337('0x12')](_0x9337('0xe'),_0x16e2a4,_0x15c578[_0x9337('0x12')][_0x9337('0x14')]);return _0xdaec59(_0x15c578['error']['message']);}logger[_0x9337('0x12')](_0x9337('0xe'),_0x16e2a4,_0x15c578[_0x9337('0x12')][_0x9337('0x14')]);return _0x268943(_0x15c578['error']['message']);}else{logger[_0x9337('0x15')]('Campaign,\x20%s,\x20%s',_0x16e2a4,'request\x20sent');_0x268943(_0x15c578[_0x9337('0x16')][_0x9337('0x14')]);}})[_0x9337('0x17')](function(_0x48644e){logger[_0x9337('0x12')](_0x9337('0xe'),_0x16e2a4,_0x48644e);_0xdaec59(_0x48644e);});});}exports['GetCampaign']=function(_0x5e49e7){var _0x424f11=this;return new Promise(function(_0x462196,_0x4a27cc){return db[_0x9337('0x18')][_0x9337('0x19')]({'raw':_0x5e49e7['options']?_0x5e49e7[_0x9337('0x1a')][_0x9337('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e49e7['options']?_0x5e49e7[_0x9337('0x1a')][_0x9337('0x1c')]||null:null,'attributes':_0x5e49e7['options']?_0x5e49e7['options'][_0x9337('0x1d')]||null:null,'limit':_0x5e49e7['options']?_0x5e49e7[_0x9337('0x1a')]['limit']||null:null,'include':_0x5e49e7[_0x9337('0x1a')]?_0x5e49e7['options']['include']?_[_0x9337('0x1e')](_0x5e49e7['options'][_0x9337('0x1f')],function(_0x543cfc){return{'model':db[_0x543cfc[_0x9337('0x20')]],'as':_0x543cfc['as'],'attributes':_0x543cfc[_0x9337('0x1d')],'include':_0x543cfc[_0x9337('0x1f')]?_[_0x9337('0x1e')](_0x543cfc[_0x9337('0x1f')],function(_0xb49ff1){return{'model':db[_0xb49ff1['model']],'as':_0xb49ff1['as'],'attributes':_0xb49ff1['attributes'],'include':_0xb49ff1[_0x9337('0x1f')]?_[_0x9337('0x1e')](_0xb49ff1[_0x9337('0x1f')],function(_0x178ed5){return{'model':db[_0x178ed5['model']],'as':_0x178ed5['as'],'attributes':_0x178ed5[_0x9337('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e2c6e){logger[_0x9337('0x15')](_0x9337('0x21'),_0x5e49e7);logger[_0x9337('0x10')]('GetCampaign',_0x5e49e7,JSON['stringify'](_0x2e2c6e));_0x462196(_0x2e2c6e);})[_0x9337('0x17')](function(_0x1bcb04){logger[_0x9337('0x12')](_0x9337('0x21'),_0x1bcb04[_0x9337('0x14')],_0x5e49e7);_0x4a27cc(_0x424f11['error'](0x1f4,_0x1bcb04[_0x9337('0x14')]));});});}; \ No newline at end of file +var _0x44f8=['raw','where','attributes','limit','include','map','model','then','GetCampaign','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request\x20sent','error','Campaign,\x20%s,\x20%s','message','result','catch','options'];(function(_0x1942c9,_0x5dbf2d){var _0x2e0a33=function(_0x90740e){while(--_0x90740e){_0x1942c9['push'](_0x1942c9['shift']());}};_0x2e0a33(++_0x5dbf2d);}(_0x44f8,0x1de));var _0x844f=function(_0x32b557,_0x4f0f7c){_0x32b557=_0x32b557-0x0;var _0x215581=_0x44f8[_0x32b557];return _0x215581;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require(_0x844f('0x3'));var rs=require(_0x844f('0x4'));var fs=require('fs');var Redis=require(_0x844f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x844f('0x7')][_0x844f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46eb2c,_0x38a334,_0x37b697){return new BPromise(function(_0x1987a9,_0x188f88){return client['request'](_0x46eb2c,_0x37b697)['then'](function(_0x39416d){logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x38a334,'request\x20sent',JSON['stringify'](_0x39416d));if(_0x39416d[_0x844f('0xa')]){if(_0x39416d[_0x844f('0xa')]['code']===0x1f4){logger[_0x844f('0xa')](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')]['message']);return _0x188f88(_0x39416d['error'][_0x844f('0xc')]);}logger['error'](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);return _0x1987a9(_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));_0x1987a9(_0x39416d[_0x844f('0xd')][_0x844f('0xc')]);}})[_0x844f('0xe')](function(_0x4f7ce4){logger[_0x844f('0xa')]('Campaign,\x20%s,\x20%s',_0x38a334,_0x4f7ce4);_0x188f88(_0x4f7ce4);});});}exports['GetCampaign']=function(_0x1f96d0){var _0x2cca8e=this;return new Promise(function(_0x5cc55c,_0x24e386){return db['Campaign']['findAll']({'raw':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x10')]===undefined?!![]:![]:!![],'where':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x11')]||null:null,'attributes':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x12')]||null:null,'limit':_0x1f96d0['options']?_0x1f96d0['options'][_0x844f('0x13')]||null:null,'include':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x14')]?_[_0x844f('0x15')](_0x1f96d0['options'][_0x844f('0x14')],function(_0x4bd66d){return{'model':db[_0x4bd66d[_0x844f('0x16')]],'as':_0x4bd66d['as'],'attributes':_0x4bd66d['attributes'],'include':_0x4bd66d[_0x844f('0x14')]?_[_0x844f('0x15')](_0x4bd66d[_0x844f('0x14')],function(_0x7dc0c9){return{'model':db[_0x7dc0c9[_0x844f('0x16')]],'as':_0x7dc0c9['as'],'attributes':_0x7dc0c9[_0x844f('0x12')],'include':_0x7dc0c9[_0x844f('0x14')]?_['map'](_0x7dc0c9[_0x844f('0x14')],function(_0x16d7ad){return{'model':db[_0x16d7ad[_0x844f('0x16')]],'as':_0x16d7ad['as'],'attributes':_0x16d7ad[_0x844f('0x12')]};}):[]};}):[]};}):[]:[]})[_0x844f('0x17')](function(_0x29d224){logger['info'](_0x844f('0x18'),_0x1f96d0);logger[_0x844f('0x19')](_0x844f('0x18'),_0x1f96d0,JSON['stringify'](_0x29d224));_0x5cc55c(_0x29d224);})['catch'](function(_0x1e243c){logger[_0x844f('0xa')](_0x844f('0x18'),_0x1e243c['message'],_0x1f96d0);_0x24e386(_0x2cca8e[_0x844f('0xa')](0x1f4,_0x1e243c['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 1135903..6e4dd3a 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 _0x2881=['removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','delete','destroy','removeLists'];(function(_0x29fc26,_0x2d112a){var _0x21a90c=function(_0x17075f){while(--_0x17075f){_0x29fc26['push'](_0x29fc26['shift']());}};_0x21a90c(++_0x2d112a);}(_0x2881,0x1f1));var _0x1288=function(_0x26945f,_0x18aabc){_0x26945f=_0x26945f-0x0;var _0x4b7041=_0x2881[_0x26945f];return _0x4b7041;};'use strict';var multer=require(_0x1288('0x0'));var util=require(_0x1288('0x1'));var path=require(_0x1288('0x2'));var timeout=require(_0x1288('0x3'));var express=require(_0x1288('0x4'));var router=express['Router']();var fs_extra=require(_0x1288('0x5'));var auth=require(_0x1288('0x6'));var interaction=require(_0x1288('0x7'));var config=require('../../config/environment');var controller=require(_0x1288('0x8'));router[_0x1288('0x9')]('/',auth[_0x1288('0xa')](),controller[_0x1288('0xb')]);router[_0x1288('0x9')](_0x1288('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1288('0x9')](_0x1288('0xd'),auth[_0x1288('0xa')](),controller[_0x1288('0xe')]);router[_0x1288('0x9')]('/:id/hopper_histories',auth[_0x1288('0xa')](),controller[_0x1288('0xf')]);router[_0x1288('0x9')](_0x1288('0x10'),auth[_0x1288('0xa')](),controller['getHopperFinals']);router[_0x1288('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x1288('0x11')]);router[_0x1288('0x9')]('/:id/lists',auth[_0x1288('0xa')](),controller[_0x1288('0x12')]);router['get'](_0x1288('0x13'),auth['isAuthenticated'](),controller[_0x1288('0x14')]);router['post']('/',auth[_0x1288('0xa')](),controller['create']);router[_0x1288('0x15')](_0x1288('0x16'),auth[_0x1288('0xa')](),controller[_0x1288('0x17')]);router[_0x1288('0x15')](_0x1288('0x18'),auth['isAuthenticated'](),controller[_0x1288('0x19')]);router[_0x1288('0x15')](_0x1288('0x13'),auth['isAuthenticated'](),controller[_0x1288('0x1a')]);router[_0x1288('0x1b')]('/:id',auth[_0x1288('0xa')](),controller['update']);router[_0x1288('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x1288('0x1d')]);router[_0x1288('0x1c')](_0x1288('0x18'),auth['isAuthenticated'](),controller[_0x1288('0x1e')]);router['delete'](_0x1288('0x13'),auth[_0x1288('0xa')](),controller[_0x1288('0x1f')]);module[_0x1288('0x20')]=router; \ No newline at end of file +var _0x38fb=['post','create','/:id/clone','clone','/:id/blacklists','put','update','delete','removeBlackLists','multer','util','express','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','/:id','show','get','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x38fb,0xd1));var _0xb38f=function(_0x337537,_0x4ea7b8){_0x337537=_0x337537-0x0;var _0x4fdd67=_0x38fb[_0x337537];return _0x4fdd67;};'use strict';var multer=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb38f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb38f('0x3'));var interaction=require(_0xb38f('0x4'));var config=require('../../config/environment');var controller=require(_0xb38f('0x5'));router['get']('/',auth[_0xb38f('0x6')](),controller['index']);router['get'](_0xb38f('0x7'),auth['isAuthenticated'](),controller[_0xb38f('0x8')]);router[_0xb38f('0x9')](_0xb38f('0xa'),auth[_0xb38f('0x6')](),controller['getHoppers']);router[_0xb38f('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xb38f('0xb')]);router[_0xb38f('0x9')](_0xb38f('0xc'),auth[_0xb38f('0x6')](),controller[_0xb38f('0xd')]);router[_0xb38f('0x9')](_0xb38f('0xe'),auth[_0xb38f('0x6')](),controller['getHopperBlacks']);router[_0xb38f('0x9')](_0xb38f('0xf'),auth[_0xb38f('0x6')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0xb38f('0x6')](),controller['getBlackLists']);router[_0xb38f('0x10')]('/',auth[_0xb38f('0x6')](),controller[_0xb38f('0x11')]);router[_0xb38f('0x10')](_0xb38f('0x12'),auth['isAuthenticated'](),controller[_0xb38f('0x13')]);router[_0xb38f('0x10')](_0xb38f('0xf'),auth[_0xb38f('0x6')](),controller['addLists']);router[_0xb38f('0x10')](_0xb38f('0x14'),auth[_0xb38f('0x6')](),controller['addBlackLists']);router[_0xb38f('0x15')]('/:id',auth[_0xb38f('0x6')](),controller[_0xb38f('0x16')]);router['delete'](_0xb38f('0x7'),auth[_0xb38f('0x6')](),controller['destroy']);router[_0xb38f('0x17')](_0xb38f('0xf'),auth[_0xb38f('0x6')](),controller['removeLists']);router[_0xb38f('0x17')](_0xb38f('0x14'),auth[_0xb38f('0x6')](),controller[_0xb38f('0x18')]);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 e3a9dbb..be669c4 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 _0x4b35=['sequelize','exports','STRING','TEXT','getDataValue','key'];(function(_0x39a7da,_0x18f312){var _0x1e0fc5=function(_0x2ed66d){while(--_0x2ed66d){_0x39a7da['push'](_0x39a7da['shift']());}};_0x1e0fc5(++_0x18f312);}(_0x4b35,0x66));var _0x54b3=function(_0x5ad85a,_0x5bdc6d){_0x5ad85a=_0x5ad85a-0x0;var _0x6eeeb5=_0x4b35[_0x5ad85a];return _0x6eeeb5;};'use strict';var Sequelize=require(_0x54b3('0x0'));module[_0x54b3('0x1')]={'key':{'type':Sequelize[_0x54b3('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x54b3('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x54b3('0x4')](_0x54b3('0x5'));}}}; \ No newline at end of file +var _0xa0b8=['key','STRING','getDataValue'];(function(_0x21d9ad,_0x1b9905){var _0x4f9ca1=function(_0x31ea3b){while(--_0x31ea3b){_0x21d9ad['push'](_0x21d9ad['shift']());}};_0x4f9ca1(++_0x1b9905);}(_0xa0b8,0x178));var _0x8a0b=function(_0x217a6f,_0x3ecd8b){_0x217a6f=_0x217a6f-0x0;var _0x5553f3=_0xa0b8[_0x217a6f];return _0x5553f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x8a0b('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8a0b('0x1')](_0x8a0b('0x2'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 02328aa..833f7b1 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 _0xe601=['offset','apply','reject','save','update','then','destroy','get','sendStatus','name','index','map','CannedAnswer','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','include','findAll','show','params','options','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','UserProfileSection','CannedAnswers','userProfileId','UserProfileResource','error','eml-format','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count'];(function(_0x46fcc4,_0x3170b1){var _0x564b70=function(_0x330191){while(--_0x330191){_0x46fcc4['push'](_0x46fcc4['shift']());}};_0x564b70(++_0x3170b1);}(_0xe601,0xd5));var _0x1e60=function(_0x3715a3,_0x28c18d){_0x3715a3=_0x3715a3-0x0;var _0x2cc886=_0xe601[_0x3715a3];return _0x2cc886;};'use strict';var emlformat=require(_0x1e60('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1e60('0x1'));var moment=require(_0x1e60('0x2'));var BPromise=require(_0x1e60('0x3'));var Mustache=require(_0x1e60('0x4'));var util=require(_0x1e60('0x5'));var path=require(_0x1e60('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e60('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1e60('0x8'));var jsforce=require(_0x1e60('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x1e60('0xa'));var querystring=require(_0x1e60('0xb'));var Papa=require(_0x1e60('0xc'));var Redis=require(_0x1e60('0xd'));var authService=require(_0x1e60('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1e60('0xf'));var hardwareService=require(_0x1e60('0x10'));var logger=require('../../config/logger')(_0x1e60('0x11'));var utils=require('../../config/utils');var config=require(_0x1e60('0x12'));var licenseUtil=require(_0x1e60('0x13'));var db=require(_0x1e60('0x14'))['db'];function respondWithStatusCode(_0x722d36,_0x45d276){_0x45d276=_0x45d276||0xcc;return function(_0x507978){if(_0x507978){return _0x722d36['sendStatus'](_0x45d276);}return _0x722d36[_0x1e60('0x15')](_0x45d276)[_0x1e60('0x16')]();};}function respondWithResult(_0x17291f,_0xcd078){_0xcd078=_0xcd078||0xc8;return function(_0x3c1dd2){if(_0x3c1dd2){return _0x17291f[_0x1e60('0x15')](_0xcd078)[_0x1e60('0x17')](_0x3c1dd2);}};}function respondWithFilteredResult(_0x47a0c7,_0x213ba8){return function(_0x5c1393){if(_0x5c1393){var _0x271be7=typeof _0x213ba8['offset']===_0x1e60('0x18')&&typeof _0x213ba8[_0x1e60('0x19')]===_0x1e60('0x18');var _0x43b407=_0x5c1393[_0x1e60('0x1a')];var _0x1134f7=_0x271be7?0x0:_0x213ba8[_0x1e60('0x1b')];var _0x59b48c=_0x271be7?_0x5c1393[_0x1e60('0x1a')]:_0x213ba8[_0x1e60('0x1b')]+_0x213ba8[_0x1e60('0x19')];var _0xa8ba1b;if(_0x59b48c>=_0x43b407){_0x59b48c=_0x43b407;_0xa8ba1b=0xc8;}else{_0xa8ba1b=0xce;}_0x47a0c7[_0x1e60('0x15')](_0xa8ba1b);return _0x47a0c7['set']('Content-Range',_0x1134f7+'-'+_0x59b48c+'/'+_0x43b407)[_0x1e60('0x17')](_0x5c1393);}return null;};}function patchUpdates(_0x347b94){return function(_0x5aa2ae){try{jsonpatch[_0x1e60('0x1c')](_0x5aa2ae,_0x347b94,!![]);}catch(_0x1715cd){return BPromise[_0x1e60('0x1d')](_0x1715cd);}return _0x5aa2ae[_0x1e60('0x1e')]();};}function saveUpdates(_0x39141e,_0x44f665){return function(_0x13709d){if(_0x13709d){return _0x13709d[_0x1e60('0x1f')](_0x39141e)[_0x1e60('0x20')](function(_0x1783df){return _0x1783df;});}return null;};}function removeEntity(_0x555722,_0x718902){return function(_0x37241e){if(_0x37241e){return _0x37241e[_0x1e60('0x21')]()[_0x1e60('0x20')](function(){var _0x5a02ce=_0x37241e[_0x1e60('0x22')]({'plain':!![]});var _0x376c9a='CannedAnswers';return db['UserProfileResource'][_0x1e60('0x21')]({'where':{'type':_0x376c9a,'resourceId':_0x5a02ce['id']}})[_0x1e60('0x20')](function(){return _0x37241e;});})['then'](function(){_0x555722['status'](0xcc)[_0x1e60('0x16')]();});}};}function handleEntityNotFound(_0x2d1732,_0x3f6955){return function(_0x2e50e9){if(!_0x2e50e9){_0x2d1732[_0x1e60('0x23')](0x194);}return _0x2e50e9;};}function handleError(_0x340952,_0x2e099e){_0x2e099e=_0x2e099e||0x1f4;return function(_0x269af9){logger['error'](_0x269af9['stack']);if(_0x269af9[_0x1e60('0x24')]){delete _0x269af9[_0x1e60('0x24')];}_0x340952[_0x1e60('0x15')](_0x2e099e)['send'](_0x269af9);};}exports[_0x1e60('0x25')]=function(_0x501930,_0x44bb7d){var _0x304b60={},_0x509145={},_0x7b4e17={'count':0x0,'rows':[]};var _0x333b60=_[_0x1e60('0x26')](db[_0x1e60('0x27')][_0x1e60('0x28')],function(_0x184a8e){return{'name':_0x184a8e['fieldName'],'type':_0x184a8e[_0x1e60('0x29')][_0x1e60('0x2a')]};});_0x509145[_0x1e60('0x2b')]=_['map'](_0x333b60,_0x1e60('0x24'));_0x509145['query']=_[_0x1e60('0x2c')](_0x501930[_0x1e60('0x2d')]);_0x509145[_0x1e60('0x2e')]=_[_0x1e60('0x2f')](_0x509145[_0x1e60('0x2b')],_0x509145['query']);_0x304b60[_0x1e60('0x30')]=_['intersection'](_0x509145[_0x1e60('0x2b')],qs[_0x1e60('0x31')](_0x501930['query'][_0x1e60('0x31')]));_0x304b60[_0x1e60('0x30')]=_0x304b60[_0x1e60('0x30')][_0x1e60('0x32')]?_0x304b60[_0x1e60('0x30')]:_0x509145['model'];if(!_0x501930[_0x1e60('0x2d')][_0x1e60('0x33')](_0x1e60('0x34'))){_0x304b60[_0x1e60('0x19')]=qs['limit'](_0x501930[_0x1e60('0x2d')][_0x1e60('0x19')]);_0x304b60[_0x1e60('0x1b')]=qs[_0x1e60('0x1b')](_0x501930[_0x1e60('0x2d')][_0x1e60('0x1b')]);}_0x304b60[_0x1e60('0x35')]=qs['sort'](_0x501930[_0x1e60('0x2d')][_0x1e60('0x36')]);_0x304b60['where']=qs[_0x1e60('0x2e')](_['pick'](_0x501930[_0x1e60('0x2d')],_0x509145[_0x1e60('0x2e')]),_0x333b60);if(_0x501930['query']['filter']){_0x304b60[_0x1e60('0x37')]=_[_0x1e60('0x38')](_0x304b60['where'],{'$or':[{'key':{'$like':'%'+_0x501930[_0x1e60('0x2d')][_0x1e60('0x39')]+'%'}},{'value':{'$like':'%'+_0x501930[_0x1e60('0x2d')][_0x1e60('0x39')]+'%'}}]});}_0x304b60=_[_0x1e60('0x38')]({},_0x304b60,_0x501930['options']);var _0x44b477={'where':_0x304b60[_0x1e60('0x37')]};return db['CannedAnswer'][_0x1e60('0x1a')](_0x44b477)['then'](function(_0x43fd46){_0x7b4e17[_0x1e60('0x1a')]=_0x43fd46;if(_0x501930['query'][_0x1e60('0x3a')]){_0x304b60[_0x1e60('0x3b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1e60('0x3c')](_0x304b60);})[_0x1e60('0x20')](function(_0x49339a){_0x7b4e17['rows']=_0x49339a;return _0x7b4e17;})[_0x1e60('0x20')](respondWithFilteredResult(_0x44bb7d,_0x304b60))['catch'](handleError(_0x44bb7d,null));};exports[_0x1e60('0x3d')]=function(_0x5a1171,_0x235d8a){var _0x5ba803={'raw':!![],'where':{'id':_0x5a1171[_0x1e60('0x3e')]['id']}},_0x4e4c86={};_0x4e4c86['model']=_['keys'](db[_0x1e60('0x27')]['rawAttributes']);_0x4e4c86[_0x1e60('0x2d')]=_[_0x1e60('0x2c')](_0x5a1171[_0x1e60('0x2d')]);_0x4e4c86[_0x1e60('0x2e')]=_['intersection'](_0x4e4c86[_0x1e60('0x2b')],_0x4e4c86[_0x1e60('0x2d')]);_0x5ba803[_0x1e60('0x30')]=_['intersection'](_0x4e4c86[_0x1e60('0x2b')],qs[_0x1e60('0x31')](_0x5a1171[_0x1e60('0x2d')][_0x1e60('0x31')]));_0x5ba803[_0x1e60('0x30')]=_0x5ba803[_0x1e60('0x30')][_0x1e60('0x32')]?_0x5ba803[_0x1e60('0x30')]:_0x4e4c86[_0x1e60('0x2b')];if(_0x5a1171[_0x1e60('0x2d')][_0x1e60('0x3a')]){_0x5ba803['include']=[{'all':!![]}];}_0x5ba803=_[_0x1e60('0x38')]({},_0x5ba803,_0x5a1171[_0x1e60('0x3f')]);return db[_0x1e60('0x27')][_0x1e60('0x40')](_0x5ba803)[_0x1e60('0x20')](handleEntityNotFound(_0x235d8a,null))['then'](respondWithResult(_0x235d8a,null))[_0x1e60('0x41')](handleError(_0x235d8a,null));};exports['update']=function(_0x3e0035,_0x483f37){if(_0x3e0035[_0x1e60('0x42')]['id']){delete _0x3e0035['body']['id'];}return db[_0x1e60('0x27')][_0x1e60('0x40')]({'where':{'id':_0x3e0035[_0x1e60('0x3e')]['id']}})['then'](handleEntityNotFound(_0x483f37,null))[_0x1e60('0x20')](saveUpdates(_0x3e0035['body'],null))[_0x1e60('0x20')](respondWithResult(_0x483f37,null))[_0x1e60('0x41')](handleError(_0x483f37,null));};exports[_0x1e60('0x21')]=function(_0x19dc61,_0x594f75){return db[_0x1e60('0x27')][_0x1e60('0x40')]({'where':{'id':_0x19dc61[_0x1e60('0x3e')]['id']}})[_0x1e60('0x20')](handleEntityNotFound(_0x594f75,null))[_0x1e60('0x20')](removeEntity(_0x594f75,null))[_0x1e60('0x41')](handleError(_0x594f75,null));};exports[_0x1e60('0x43')]=function(_0x471548,_0xed3537){var _0x25c518={'key':_0x471548[_0x1e60('0x42')][_0x1e60('0x2a')]};if(_0x471548[_0x1e60('0x42')]['MailAccountId']){_0x25c518[_0x1e60('0x44')]=_0x471548[_0x1e60('0x42')][_0x1e60('0x44')];}else if(_0x471548['body'][_0x1e60('0x45')]){_0x25c518[_0x1e60('0x45')]=_0x471548[_0x1e60('0x42')][_0x1e60('0x45')];}else if(_0x471548[_0x1e60('0x42')][_0x1e60('0x46')]){_0x25c518[_0x1e60('0x46')]=_0x471548[_0x1e60('0x42')][_0x1e60('0x46')];}else if(_0x471548['body']['ChatWebsiteId']){_0x25c518[_0x1e60('0x47')]=_0x471548[_0x1e60('0x42')][_0x1e60('0x47')];}return db[_0x1e60('0x27')][_0x1e60('0x40')]({'where':_0x25c518})[_0x1e60('0x20')](function(_0x6e45a6){if(_0x6e45a6){throw new db[(_0x1e60('0x48'))][(_0x1e60('0x49'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x1e60('0x27')][_0x1e60('0x43')](_0x471548[_0x1e60('0x42')]);})['then'](function(_0x3a2658){var _0xdef4be=_0x471548[_0x1e60('0x4a')][_0x1e60('0x22')]({'plain':!![]});if(!_0xdef4be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xdef4be['role']===_0x1e60('0x4a')){var _0x27a128=_0x3a2658[_0x1e60('0x22')]({'plain':!![]});return db[_0x1e60('0x4b')][_0x1e60('0x40')]({'where':{'name':_0x1e60('0x4c'),'userProfileId':_0xdef4be[_0x1e60('0x4d')]},'raw':!![]})[_0x1e60('0x20')](function(_0x4e75d4){if(_0x4e75d4&&_0x4e75d4['autoAssociation']===0x0){return db[_0x1e60('0x4e')][_0x1e60('0x43')]({'name':_0x27a128[_0x1e60('0x24')],'resourceId':_0x27a128['id'],'type':_0x4e75d4[_0x1e60('0x24')],'sectionId':_0x4e75d4['id']},{})[_0x1e60('0x20')](function(){return _0x3a2658;});}else{return _0x3a2658;}})['catch'](function(_0x56e155){logger[_0x1e60('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56e155);throw _0x56e155;});}return _0x3a2658;})[_0x1e60('0x20')](respondWithResult(_0xed3537,0xc9))[_0x1e60('0x41')](handleError(_0xed3537,null));}; \ No newline at end of file +var _0x3525=['set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','index','map','CannedAnswer','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','options','includeAll','include','findAll','rows','catch','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x3525,0x84));var _0x5352=function(_0x30c8a6,_0x3ae227){_0x30c8a6=_0x30c8a6-0x0;var _0x4faeef=_0x3525[_0x30c8a6];return _0x4faeef;};'use strict';var emlformat=require(_0x5352('0x0'));var rimraf=require(_0x5352('0x1'));var zipdir=require(_0x5352('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5352('0x3'));var moment=require('moment');var BPromise=require(_0x5352('0x4'));var Mustache=require(_0x5352('0x5'));var util=require(_0x5352('0x6'));var path=require(_0x5352('0x7'));var sox=require(_0x5352('0x8'));var csv=require(_0x5352('0x9'));var ejs=require(_0x5352('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5352('0xb'));var crypto=require('crypto');var jsforce=require(_0x5352('0xc'));var deskjs=require(_0x5352('0xd'));var toCsv=require(_0x5352('0x9'));var querystring=require(_0x5352('0xe'));var Papa=require('papaparse');var Redis=require(_0x5352('0xf'));var authService=require(_0x5352('0x10'));var qs=require(_0x5352('0x11'));var as=require(_0x5352('0x12'));var hardwareService=require(_0x5352('0x13'));var logger=require(_0x5352('0x14'))(_0x5352('0x15'));var utils=require(_0x5352('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5352('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57b5db,_0x20aa0b){_0x20aa0b=_0x20aa0b||0xcc;return function(_0x32c1c4){if(_0x32c1c4){return _0x57b5db[_0x5352('0x18')](_0x20aa0b);}return _0x57b5db[_0x5352('0x19')](_0x20aa0b)[_0x5352('0x1a')]();};}function respondWithResult(_0x4ea6fe,_0x3c1907){_0x3c1907=_0x3c1907||0xc8;return function(_0x799955){if(_0x799955){return _0x4ea6fe[_0x5352('0x19')](_0x3c1907)[_0x5352('0x1b')](_0x799955);}};}function respondWithFilteredResult(_0x1e2320,_0x5305cb){return function(_0x2f6b72){if(_0x2f6b72){var _0x2ea60d=typeof _0x5305cb[_0x5352('0x1c')]===_0x5352('0x1d')&&typeof _0x5305cb[_0x5352('0x1e')]===_0x5352('0x1d');var _0x48f1cf=_0x2f6b72[_0x5352('0x1f')];var _0x414fe0=_0x2ea60d?0x0:_0x5305cb[_0x5352('0x1c')];var _0x1100cc=_0x2ea60d?_0x2f6b72[_0x5352('0x1f')]:_0x5305cb[_0x5352('0x1c')]+_0x5305cb[_0x5352('0x1e')];var _0x1285cc;if(_0x1100cc>=_0x48f1cf){_0x1100cc=_0x48f1cf;_0x1285cc=0xc8;}else{_0x1285cc=0xce;}_0x1e2320[_0x5352('0x19')](_0x1285cc);return _0x1e2320[_0x5352('0x20')](_0x5352('0x21'),_0x414fe0+'-'+_0x1100cc+'/'+_0x48f1cf)['json'](_0x2f6b72);}return null;};}function patchUpdates(_0x276ea8){return function(_0x4a2802){try{jsonpatch[_0x5352('0x22')](_0x4a2802,_0x276ea8,!![]);}catch(_0x5d06bf){return BPromise[_0x5352('0x23')](_0x5d06bf);}return _0x4a2802['save']();};}function saveUpdates(_0x275f61,_0x306f8b){return function(_0x4aa930){if(_0x4aa930){return _0x4aa930[_0x5352('0x24')](_0x275f61)[_0x5352('0x25')](function(_0x39eb04){return _0x39eb04;});}return null;};}function removeEntity(_0x1780b8,_0x2eaf35){return function(_0x191b63){if(_0x191b63){return _0x191b63[_0x5352('0x26')]()[_0x5352('0x25')](function(){var _0x114029=_0x191b63[_0x5352('0x27')]({'plain':!![]});var _0x513810='CannedAnswers';return db[_0x5352('0x28')][_0x5352('0x26')]({'where':{'type':_0x513810,'resourceId':_0x114029['id']}})[_0x5352('0x25')](function(){return _0x191b63;});})['then'](function(){_0x1780b8[_0x5352('0x19')](0xcc)[_0x5352('0x1a')]();});}};}function handleEntityNotFound(_0x25d6ef,_0x2ddc0b){return function(_0x430424){if(!_0x430424){_0x25d6ef[_0x5352('0x18')](0x194);}return _0x430424;};}function handleError(_0x4c5c40,_0x30efb3){_0x30efb3=_0x30efb3||0x1f4;return function(_0x357b38){logger['error'](_0x357b38[_0x5352('0x29')]);if(_0x357b38[_0x5352('0x2a')]){delete _0x357b38[_0x5352('0x2a')];}_0x4c5c40[_0x5352('0x19')](_0x30efb3)['send'](_0x357b38);};}exports[_0x5352('0x2b')]=function(_0x1d13fa,_0x2dca72){var _0x35bdc1={},_0x205830={},_0x28416c={'count':0x0,'rows':[]};var _0x3dde4d=_[_0x5352('0x2c')](db[_0x5352('0x2d')][_0x5352('0x2e')],function(_0x5a8e0e){return{'name':_0x5a8e0e['fieldName'],'type':_0x5a8e0e[_0x5352('0x2f')][_0x5352('0x30')]};});_0x205830[_0x5352('0x31')]=_['map'](_0x3dde4d,_0x5352('0x2a'));_0x205830[_0x5352('0x32')]=_['keys'](_0x1d13fa[_0x5352('0x32')]);_0x205830[_0x5352('0x33')]=_[_0x5352('0x34')](_0x205830[_0x5352('0x31')],_0x205830[_0x5352('0x32')]);_0x35bdc1[_0x5352('0x35')]=_[_0x5352('0x34')](_0x205830[_0x5352('0x31')],qs[_0x5352('0x36')](_0x1d13fa[_0x5352('0x32')][_0x5352('0x36')]));_0x35bdc1[_0x5352('0x35')]=_0x35bdc1[_0x5352('0x35')][_0x5352('0x37')]?_0x35bdc1[_0x5352('0x35')]:_0x205830[_0x5352('0x31')];if(!_0x1d13fa[_0x5352('0x32')]['hasOwnProperty'](_0x5352('0x38'))){_0x35bdc1[_0x5352('0x1e')]=qs[_0x5352('0x1e')](_0x1d13fa[_0x5352('0x32')][_0x5352('0x1e')]);_0x35bdc1[_0x5352('0x1c')]=qs['offset'](_0x1d13fa[_0x5352('0x32')][_0x5352('0x1c')]);}_0x35bdc1[_0x5352('0x39')]=qs[_0x5352('0x3a')](_0x1d13fa[_0x5352('0x32')][_0x5352('0x3a')]);_0x35bdc1['where']=qs[_0x5352('0x33')](_['pick'](_0x1d13fa[_0x5352('0x32')],_0x205830[_0x5352('0x33')]),_0x3dde4d);if(_0x1d13fa[_0x5352('0x32')][_0x5352('0x3b')]){_0x35bdc1[_0x5352('0x3c')]=_['merge'](_0x35bdc1[_0x5352('0x3c')],{'$or':[{'key':{'$like':'%'+_0x1d13fa[_0x5352('0x32')]['filter']+'%'}},{'value':{'$like':'%'+_0x1d13fa[_0x5352('0x32')][_0x5352('0x3b')]+'%'}}]});}_0x35bdc1=_['merge']({},_0x35bdc1,_0x1d13fa[_0x5352('0x3d')]);var _0x127015={'where':_0x35bdc1['where']};return db[_0x5352('0x2d')]['count'](_0x127015)['then'](function(_0x42f6af){_0x28416c[_0x5352('0x1f')]=_0x42f6af;if(_0x1d13fa['query'][_0x5352('0x3e')]){_0x35bdc1[_0x5352('0x3f')]=[{'all':!![]}];}return db[_0x5352('0x2d')][_0x5352('0x40')](_0x35bdc1);})['then'](function(_0xb80e35){_0x28416c[_0x5352('0x41')]=_0xb80e35;return _0x28416c;})['then'](respondWithFilteredResult(_0x2dca72,_0x35bdc1))[_0x5352('0x42')](handleError(_0x2dca72,null));};exports['show']=function(_0x1fc873,_0x235305){var _0xf72e55={'raw':!![],'where':{'id':_0x1fc873[_0x5352('0x43')]['id']}},_0x147b1f={};_0x147b1f['model']=_[_0x5352('0x44')](db[_0x5352('0x2d')][_0x5352('0x2e')]);_0x147b1f['query']=_[_0x5352('0x44')](_0x1fc873['query']);_0x147b1f['filters']=_[_0x5352('0x34')](_0x147b1f['model'],_0x147b1f[_0x5352('0x32')]);_0xf72e55[_0x5352('0x35')]=_['intersection'](_0x147b1f[_0x5352('0x31')],qs[_0x5352('0x36')](_0x1fc873['query'][_0x5352('0x36')]));_0xf72e55['attributes']=_0xf72e55[_0x5352('0x35')][_0x5352('0x37')]?_0xf72e55['attributes']:_0x147b1f[_0x5352('0x31')];if(_0x1fc873[_0x5352('0x32')]['includeAll']){_0xf72e55[_0x5352('0x3f')]=[{'all':!![]}];}_0xf72e55=_['merge']({},_0xf72e55,_0x1fc873[_0x5352('0x3d')]);return db['CannedAnswer'][_0x5352('0x45')](_0xf72e55)['then'](handleEntityNotFound(_0x235305,null))['then'](respondWithResult(_0x235305,null))[_0x5352('0x42')](handleError(_0x235305,null));};exports[_0x5352('0x24')]=function(_0x55d6dd,_0x1966ce){if(_0x55d6dd['body']['id']){delete _0x55d6dd[_0x5352('0x46')]['id'];}return db[_0x5352('0x2d')][_0x5352('0x45')]({'where':{'id':_0x55d6dd[_0x5352('0x43')]['id']}})['then'](handleEntityNotFound(_0x1966ce,null))[_0x5352('0x25')](saveUpdates(_0x55d6dd[_0x5352('0x46')],null))[_0x5352('0x25')](respondWithResult(_0x1966ce,null))[_0x5352('0x42')](handleError(_0x1966ce,null));};exports[_0x5352('0x26')]=function(_0x4b4ad9,_0x2251ea){return db['CannedAnswer'][_0x5352('0x45')]({'where':{'id':_0x4b4ad9[_0x5352('0x43')]['id']}})[_0x5352('0x25')](handleEntityNotFound(_0x2251ea,null))[_0x5352('0x25')](removeEntity(_0x2251ea,null))[_0x5352('0x42')](handleError(_0x2251ea,null));};exports[_0x5352('0x47')]=function(_0x86ce7a,_0x42c6bc){var _0x6c40d={'key':_0x86ce7a[_0x5352('0x46')][_0x5352('0x30')]};if(_0x86ce7a[_0x5352('0x46')]['MailAccountId']){_0x6c40d['MailAccountId']=_0x86ce7a[_0x5352('0x46')][_0x5352('0x48')];}else if(_0x86ce7a['body'][_0x5352('0x49')]){_0x6c40d['SmsAccountId']=_0x86ce7a[_0x5352('0x46')][_0x5352('0x49')];}else if(_0x86ce7a[_0x5352('0x46')][_0x5352('0x4a')]){_0x6c40d[_0x5352('0x4a')]=_0x86ce7a[_0x5352('0x46')][_0x5352('0x4a')];}else if(_0x86ce7a[_0x5352('0x46')][_0x5352('0x4b')]){_0x6c40d[_0x5352('0x4b')]=_0x86ce7a[_0x5352('0x46')][_0x5352('0x4b')];}return db[_0x5352('0x2d')][_0x5352('0x45')]({'where':_0x6c40d})['then'](function(_0x5d0dca){if(_0x5d0dca){throw new db['Sequelize']['ValidationError'](_0x5352('0x4c'));}return db[_0x5352('0x2d')]['create'](_0x86ce7a['body']);})[_0x5352('0x25')](function(_0x4f5e26){var _0x24f9d6=_0x86ce7a[_0x5352('0x4d')][_0x5352('0x27')]({'plain':!![]});if(!_0x24f9d6)throw new Error(_0x5352('0x4e'));if(_0x24f9d6['role']==='user'){var _0x28b200=_0x4f5e26[_0x5352('0x27')]({'plain':!![]});return db[_0x5352('0x4f')]['find']({'where':{'name':_0x5352('0x50'),'userProfileId':_0x24f9d6[_0x5352('0x51')]},'raw':!![]})[_0x5352('0x25')](function(_0xbb3339){if(_0xbb3339&&_0xbb3339['autoAssociation']===0x0){return db[_0x5352('0x28')][_0x5352('0x47')]({'name':_0x28b200[_0x5352('0x2a')],'resourceId':_0x28b200['id'],'type':_0xbb3339[_0x5352('0x2a')],'sectionId':_0xbb3339['id']},{})[_0x5352('0x25')](function(){return _0x4f5e26;});}else{return _0x4f5e26;}})[_0x5352('0x42')](function(_0x46262d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46262d);throw _0x46262d;});}return _0x4f5e26;})[_0x5352('0x25')](respondWithResult(_0x42c6bc,0xc9))[_0x5352('0x42')](handleError(_0x42c6bc,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 5c12dc6..56774d6 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 _0x418f=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','tools_canned_answers'];(function(_0x1780d6,_0x2fac42){var _0x463634=function(_0x5bf6d9){while(--_0x5bf6d9){_0x1780d6['push'](_0x1780d6['shift']());}};_0x463634(++_0x2fac42);}(_0x418f,0xdf));var _0xf418=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x418f[_0x4aba15];return _0x1c8122;};'use strict';var _=require(_0xf418('0x0'));var util=require(_0xf418('0x1'));var logger=require(_0xf418('0x2'))(_0xf418('0x3'));var moment=require(_0xf418('0x4'));var BPromise=require('bluebird');var rp=require(_0xf418('0x5'));var fs=require('fs');var path=require(_0xf418('0x6'));var rimraf=require(_0xf418('0x7'));var config=require(_0xf418('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0xf418('0x9')]=function(_0x535456,_0x544059){return _0x535456['define']('CannedAnswer',attributes,{'tableName':_0xf418('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf418('0xb'),'collate':_0xf418('0xc')});}; \ No newline at end of file +var _0x626f=['request-promise','path','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x3eadd2,_0x1ac10b){var _0x362829=function(_0x4b23c7){while(--_0x4b23c7){_0x3eadd2['push'](_0x3eadd2['shift']());}};_0x362829(++_0x1ac10b);}(_0x626f,0xdb));var _0xf626=function(_0x64b218,_0x4df215){_0x64b218=_0x64b218-0x0;var _0x213cb4=_0x626f[_0x64b218];return _0x213cb4;};'use strict';var _=require(_0xf626('0x0'));var util=require(_0xf626('0x1'));var logger=require(_0xf626('0x2'))(_0xf626('0x3'));var moment=require('moment');var BPromise=require(_0xf626('0x4'));var rp=require(_0xf626('0x5'));var fs=require('fs');var path=require(_0xf626('0x6'));var rimraf=require(_0xf626('0x7'));var config=require(_0xf626('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0xf626('0x9')]=function(_0x2331c7,_0x1714e1){return _0x2331c7['define'](_0xf626('0xa'),attributes,{'tableName':_0xf626('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf626('0xc'),'collate':_0xf626('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e835ed7..50f88c8 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(_0x21b7c0,_0xc5bdd5){var _0x2df891=function(_0x1bc8f2){while(--_0x1bc8f2){_0x21b7c0['push'](_0x21b7c0['shift']());}};_0x2df891(++_0xc5bdd5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x670593,_0x388f3f){var _0x50eae8=function(_0x1ba14a){while(--_0x1ba14a){_0x670593['push'](_0x670593['shift']());}};_0x50eae8(++_0x388f3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 2f9ad38..b142eff 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 _0x3049=['/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get'];(function(_0x343e70,_0xe5f373){var _0x2742fd=function(_0x27e56e){while(--_0x27e56e){_0x343e70['push'](_0x343e70['shift']());}};_0x2742fd(++_0xe5f373);}(_0x3049,0xcc));var _0x9304=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x3049[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x9304('0x0'));var util=require(_0x9304('0x1'));var path=require(_0x9304('0x2'));var timeout=require(_0x9304('0x3'));var express=require(_0x9304('0x4'));var router=express[_0x9304('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9304('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9304('0x7'));var controller=require(_0x9304('0x8'));router['get']('/',auth[_0x9304('0x9')](),controller[_0x9304('0xa')]);router[_0x9304('0xb')](_0x9304('0xc'),auth[_0x9304('0x9')](),controller[_0x9304('0xd')]);router[_0x9304('0xe')]('/',auth[_0x9304('0x9')](),controller[_0x9304('0xf')]);router[_0x9304('0x10')](_0x9304('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9304('0xc'),auth[_0x9304('0x9')](),controller['destroy']);module[_0x9304('0x11')]=router; \ No newline at end of file +var _0x9a2a=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated'];(function(_0x3b59ed,_0x281a70){var _0x5cf829=function(_0xca820){while(--_0xca820){_0x3b59ed['push'](_0x3b59ed['shift']());}};_0x5cf829(++_0x281a70);}(_0x9a2a,0xfa));var _0xa9a2=function(_0xb19bc6,_0x2dd9b5){_0xb19bc6=_0xb19bc6-0x0;var _0x2e3f77=_0x9a2a[_0xb19bc6];return _0x2e3f77;};'use strict';var multer=require(_0xa9a2('0x0'));var util=require(_0xa9a2('0x1'));var path=require(_0xa9a2('0x2'));var timeout=require(_0xa9a2('0x3'));var express=require(_0xa9a2('0x4'));var router=express[_0xa9a2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa9a2('0x6'));var interaction=require(_0xa9a2('0x7'));var config=require(_0xa9a2('0x8'));var controller=require(_0xa9a2('0x9'));router[_0xa9a2('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a2('0xb')]);router[_0xa9a2('0xa')](_0xa9a2('0xc'),auth[_0xa9a2('0xd')](),controller[_0xa9a2('0xe')]);router[_0xa9a2('0xf')]('/',auth[_0xa9a2('0xd')](),controller[_0xa9a2('0x10')]);router[_0xa9a2('0x11')](_0xa9a2('0xc'),auth[_0xa9a2('0xd')](),controller[_0xa9a2('0x12')]);router[_0xa9a2('0x13')](_0xa9a2('0xc'),auth['isAuthenticated'](),controller[_0xa9a2('0x14')]);module[_0xa9a2('0x15')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index a087ac5..90e9112 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 _0x69e6=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x2656a4,_0x28dd1b){var _0x48ce85=function(_0x41d957){while(--_0x41d957){_0x2656a4['push'](_0x2656a4['shift']());}};_0x48ce85(++_0x28dd1b);}(_0x69e6,0x1e0));var _0x669e=function(_0x3152e8,_0x3d2089){_0x3152e8=_0x3152e8-0x0;var _0x35dad6=_0x69e6[_0x3152e8];return _0x35dad6;};'use strict';var Sequelize=require('sequelize');module[_0x669e('0x0')]={'calldate':{'type':Sequelize[_0x669e('0x1')],'allowNull':![],'defaultValue':_0x669e('0x2')},'clid':{'type':Sequelize[_0x669e('0x3')]},'src':{'type':Sequelize[_0x669e('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x669e('0x3')]},'channel':{'type':Sequelize[_0x669e('0x3')]},'dstchannel':{'type':Sequelize[_0x669e('0x3')]},'lastapp':{'type':Sequelize[_0x669e('0x3')]},'lastdata':{'type':Sequelize[_0x669e('0x3')]},'duration':{'type':Sequelize[_0x669e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x669e('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x669e('0x3')]},'amaflags':{'type':Sequelize[_0x669e('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x669e('0x3')]},'userfield':{'type':Sequelize[_0x669e('0x3')]},'uniqueid':{'type':Sequelize[_0x669e('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x669e('0x3')]},'peeraccount':{'type':Sequelize[_0x669e('0x3')]},'type':{'type':Sequelize[_0x669e('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x68f9=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x68f9,0xca));var _0x968f=function(_0x22398c,_0x4fd56d){_0x22398c=_0x22398c-0x0;var _0x40864c=_0x68f9[_0x22398c];return _0x40864c;};'use strict';var Sequelize=require(_0x968f('0x0'));module[_0x968f('0x1')]={'calldate':{'type':Sequelize[_0x968f('0x2')],'allowNull':![],'defaultValue':_0x968f('0x3')},'clid':{'type':Sequelize[_0x968f('0x4')]},'src':{'type':Sequelize[_0x968f('0x4')]},'dst':{'type':Sequelize[_0x968f('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x968f('0x4')]},'dstchannel':{'type':Sequelize[_0x968f('0x4')]},'lastapp':{'type':Sequelize[_0x968f('0x4')]},'lastdata':{'type':Sequelize[_0x968f('0x4')]},'duration':{'type':Sequelize[_0x968f('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x968f('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x968f('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x968f('0x4')]},'uniqueid':{'type':Sequelize[_0x968f('0x4')]},'linkedid':{'type':Sequelize[_0x968f('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x968f('0x4')]},'type':{'type':Sequelize[_0x968f('0x4')]},'tag':{'type':Sequelize[_0x968f('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index acf1449..3812768 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 _0x0bde=['end','json','offset','undefined','count','set','Content-Range','reject','save','then','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','Cdr','include','findAll','rows','catch','params','length','includeAll','merge','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5cf17d,_0x16d5dd){var _0x53efb0=function(_0x559aaf){while(--_0x559aaf){_0x5cf17d['push'](_0x5cf17d['shift']());}};_0x53efb0(++_0x16d5dd);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xe0bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0bd('0x1'));var jsonpatch=require(_0xe0bd('0x2'));var rp=require('request-promise');var moment=require(_0xe0bd('0x3'));var BPromise=require(_0xe0bd('0x4'));var Mustache=require(_0xe0bd('0x5'));var util=require('util');var path=require(_0xe0bd('0x6'));var sox=require(_0xe0bd('0x7'));var csv=require(_0xe0bd('0x8'));var ejs=require(_0xe0bd('0x9'));var fs=require('fs');var fs_extra=require(_0xe0bd('0xa'));var _=require(_0xe0bd('0xb'));var squel=require(_0xe0bd('0xc'));var crypto=require(_0xe0bd('0xd'));var jsforce=require(_0xe0bd('0xe'));var deskjs=require(_0xe0bd('0xf'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0x10'));var Papa=require(_0xe0bd('0x11'));var Redis=require('ioredis');var authService=require(_0xe0bd('0x12'));var qs=require(_0xe0bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0bd('0x14'));var logger=require('../../config/logger')(_0xe0bd('0x15'));var utils=require(_0xe0bd('0x16'));var config=require(_0xe0bd('0x17'));var licenseUtil=require(_0xe0bd('0x18'));var db=require(_0xe0bd('0x19'))['db'];function respondWithStatusCode(_0x16c3a9,_0x1905b2){_0x1905b2=_0x1905b2||0xcc;return function(_0x500a9e){if(_0x500a9e){return _0x16c3a9[_0xe0bd('0x1a')](_0x1905b2);}return _0x16c3a9[_0xe0bd('0x1b')](_0x1905b2)[_0xe0bd('0x1c')]();};}function respondWithResult(_0x5c76f1,_0x479438){_0x479438=_0x479438||0xc8;return function(_0x48afde){if(_0x48afde){return _0x5c76f1[_0xe0bd('0x1b')](_0x479438)[_0xe0bd('0x1d')](_0x48afde);}};}function respondWithFilteredResult(_0x3f5ef7,_0x3042e1){return function(_0x361429){if(_0x361429){var _0x302f5f=typeof _0x3042e1[_0xe0bd('0x1e')]===_0xe0bd('0x1f')&&typeof _0x3042e1['limit']==='undefined';var _0x2d2ba3=_0x361429[_0xe0bd('0x20')];var _0x1c4533=_0x302f5f?0x0:_0x3042e1[_0xe0bd('0x1e')];var _0xa6be32=_0x302f5f?_0x361429[_0xe0bd('0x20')]:_0x3042e1['offset']+_0x3042e1['limit'];var _0x29bd21;if(_0xa6be32>=_0x2d2ba3){_0xa6be32=_0x2d2ba3;_0x29bd21=0xc8;}else{_0x29bd21=0xce;}_0x3f5ef7[_0xe0bd('0x1b')](_0x29bd21);return _0x3f5ef7[_0xe0bd('0x21')](_0xe0bd('0x22'),_0x1c4533+'-'+_0xa6be32+'/'+_0x2d2ba3)[_0xe0bd('0x1d')](_0x361429);}return null;};}function patchUpdates(_0x154480){return function(_0x3dbd98){try{jsonpatch['apply'](_0x3dbd98,_0x154480,!![]);}catch(_0x5ad8bf){return BPromise[_0xe0bd('0x23')](_0x5ad8bf);}return _0x3dbd98[_0xe0bd('0x24')]();};}function saveUpdates(_0x3927ab,_0xdcb789){return function(_0x290c1e){if(_0x290c1e){return _0x290c1e['update'](_0x3927ab)[_0xe0bd('0x25')](function(_0x4795ac){return _0x4795ac;});}return null;};}function removeEntity(_0x242cbe,_0x296f64){return function(_0x3f24b6){if(_0x3f24b6){return _0x3f24b6['destroy']()[_0xe0bd('0x25')](function(){_0x242cbe[_0xe0bd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ca10,_0x5e6496){return function(_0x2debcb){if(!_0x2debcb){_0x41ca10['sendStatus'](0x194);}return _0x2debcb;};}function handleError(_0x198a1c,_0x72e284){_0x72e284=_0x72e284||0x1f4;return function(_0x3c851d){logger['error'](_0x3c851d[_0xe0bd('0x26')]);if(_0x3c851d['name']){delete _0x3c851d[_0xe0bd('0x27')];}_0x198a1c[_0xe0bd('0x1b')](_0x72e284)['send'](_0x3c851d);};}exports['index']=function(_0x273b95,_0x3789a1){var _0x441475={},_0x23a317={},_0x2d7f2f={'count':0x0,'rows':[]};var _0x17e614=_[_0xe0bd('0x28')](db['Cdr'][_0xe0bd('0x29')],function(_0x137206){return{'name':_0x137206[_0xe0bd('0x2a')],'type':_0x137206[_0xe0bd('0x2b')][_0xe0bd('0x2c')]};});_0x23a317[_0xe0bd('0x2d')]=_['map'](_0x17e614,_0xe0bd('0x27'));_0x23a317[_0xe0bd('0x2e')]=_[_0xe0bd('0x2f')](_0x273b95[_0xe0bd('0x2e')]);_0x23a317[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x23a317[_0xe0bd('0x2d')],_0x23a317[_0xe0bd('0x2e')]);_0x441475['attributes']=_['intersection'](_0x23a317[_0xe0bd('0x2d')],qs[_0xe0bd('0x32')](_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x32')]));_0x441475[_0xe0bd('0x33')]=_0x441475['attributes']['length']?_0x441475['attributes']:_0x23a317[_0xe0bd('0x2d')];if(!_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x34')](_0xe0bd('0x35'))){_0x441475[_0xe0bd('0x36')]=qs[_0xe0bd('0x36')](_0x273b95['query'][_0xe0bd('0x36')]);_0x441475[_0xe0bd('0x1e')]=qs[_0xe0bd('0x1e')](_0x273b95['query'][_0xe0bd('0x1e')]);}_0x441475[_0xe0bd('0x37')]=qs['sort'](_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x38')]);_0x441475[_0xe0bd('0x39')]=qs['filters'](_[_0xe0bd('0x3a')](_0x273b95['query'],_0x23a317[_0xe0bd('0x30')]),_0x17e614);if(_0x273b95[_0xe0bd('0x2e')][_0xe0bd('0x3b')]){_0x441475[_0xe0bd('0x39')]=_['merge'](_0x441475[_0xe0bd('0x39')],{'$or':_[_0xe0bd('0x28')](_0x17e614,function(_0x7f9272){if(_0x7f9272['type']!=='VIRTUAL'){var _0x23064a={};_0x23064a[_0x7f9272[_0xe0bd('0x27')]]={'$like':'%'+_0x273b95[_0xe0bd('0x2e')]['filter']+'%'};return _0x23064a;}})});}_0x441475=_['merge']({},_0x441475,_0x273b95[_0xe0bd('0x3c')]);var _0x383b08={'where':_0x441475[_0xe0bd('0x39')]};return db[_0xe0bd('0x3d')]['count'](_0x383b08)[_0xe0bd('0x25')](function(_0x23b596){_0x2d7f2f[_0xe0bd('0x20')]=_0x23b596;if(_0x273b95['query']['includeAll']){_0x441475[_0xe0bd('0x3e')]=[{'all':!![]}];}return db[_0xe0bd('0x3d')][_0xe0bd('0x3f')](_0x441475);})[_0xe0bd('0x25')](function(_0x5ada76){_0x2d7f2f[_0xe0bd('0x40')]=_0x5ada76;return _0x2d7f2f;})[_0xe0bd('0x25')](respondWithFilteredResult(_0x3789a1,_0x441475))[_0xe0bd('0x41')](handleError(_0x3789a1,null));};exports['show']=function(_0x499e16,_0x27a582){var _0x52a0af={'raw':!![],'where':{'id':_0x499e16[_0xe0bd('0x42')]['id']}},_0x24be53={};_0x24be53['model']=_[_0xe0bd('0x2f')](db[_0xe0bd('0x3d')][_0xe0bd('0x29')]);_0x24be53['query']=_[_0xe0bd('0x2f')](_0x499e16[_0xe0bd('0x2e')]);_0x24be53[_0xe0bd('0x30')]=_[_0xe0bd('0x31')](_0x24be53[_0xe0bd('0x2d')],_0x24be53[_0xe0bd('0x2e')]);_0x52a0af[_0xe0bd('0x33')]=_[_0xe0bd('0x31')](_0x24be53['model'],qs[_0xe0bd('0x32')](_0x499e16[_0xe0bd('0x2e')][_0xe0bd('0x32')]));_0x52a0af[_0xe0bd('0x33')]=_0x52a0af[_0xe0bd('0x33')][_0xe0bd('0x43')]?_0x52a0af[_0xe0bd('0x33')]:_0x24be53[_0xe0bd('0x2d')];if(_0x499e16['query'][_0xe0bd('0x44')]){_0x52a0af[_0xe0bd('0x3e')]=[{'all':!![]}];}_0x52a0af=_[_0xe0bd('0x45')]({},_0x52a0af,_0x499e16[_0xe0bd('0x3c')]);return db[_0xe0bd('0x3d')]['find'](_0x52a0af)[_0xe0bd('0x25')](handleEntityNotFound(_0x27a582,null))['then'](respondWithResult(_0x27a582,null))['catch'](handleError(_0x27a582,null));};exports['create']=function(_0x2d7e00,_0x55dd83){return db['Cdr'][_0xe0bd('0x46')](_0x2d7e00[_0xe0bd('0x47')],{})[_0xe0bd('0x25')](respondWithResult(_0x55dd83,0xc9))[_0xe0bd('0x41')](handleError(_0x55dd83,null));};exports[_0xe0bd('0x48')]=function(_0x220147,_0xe2b989){if(_0x220147[_0xe0bd('0x47')]['id']){delete _0x220147[_0xe0bd('0x47')]['id'];}return db[_0xe0bd('0x3d')]['find']({'where':{'id':_0x220147[_0xe0bd('0x42')]['id']}})['then'](handleEntityNotFound(_0xe2b989,null))['then'](saveUpdates(_0x220147[_0xe0bd('0x47')],null))[_0xe0bd('0x25')](respondWithResult(_0xe2b989,null))[_0xe0bd('0x41')](handleError(_0xe2b989,null));};exports['destroy']=function(_0x281a60,_0x3fe076){return db[_0xe0bd('0x3d')][_0xe0bd('0x49')]({'where':{'id':_0x281a60[_0xe0bd('0x42')]['id']}})[_0xe0bd('0x25')](handleEntityNotFound(_0x3fe076,null))[_0xe0bd('0x25')](removeEntity(_0x3fe076,null))[_0xe0bd('0x41')](handleError(_0x3fe076,null));};exports[_0xe0bd('0x4a')]=function(_0x1f85ef,_0x29c7f8){return db[_0xe0bd('0x3d')]['describe']()[_0xe0bd('0x25')](respondWithResult(_0x29c7f8,null))[_0xe0bd('0x41')](handleError(_0x29c7f8,null));}; \ No newline at end of file +var _0xe14b=['rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe14b,0x93));var _0xbe14=function(_0x1ffbeb,_0x25c075){_0x1ffbeb=_0x1ffbeb-0x0;var _0x113bde=_0xe14b[_0x1ffbeb];return _0x113bde;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25'));_0x19252f[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x3c3613[_0xbe14('0x2e')]);_0x19252f[_0xbe14('0x30')]=_['intersection'](_0x19252f[_0xbe14('0x2d')],_0x19252f['query']);_0x1c7cc7['attributes']=_[_0xbe14('0x31')](_0x19252f['model'],qs[_0xbe14('0x32')](_0x3c3613[_0xbe14('0x2e')]['fields']));_0x1c7cc7['attributes']=_0x1c7cc7['attributes'][_0xbe14('0x33')]?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f['model'];if(!_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x3c3613['query']['limit']);_0x1c7cc7[_0xbe14('0x1c')]=qs['offset'](_0x3c3613['query']['offset']);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x30')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x2e')],_0x19252f[_0xbe14('0x30')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]){_0x1c7cc7[_0xbe14('0x39')]=_['merge'](_0x1c7cc7['where'],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x2951e1){if(_0x2951e1[_0xbe14('0x2b')]!=='VIRTUAL'){var _0x326329={};_0x326329[_0x2951e1[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]+'%'};return _0x326329;}})});}_0x1c7cc7=_[_0xbe14('0x3c')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3d')]);var _0x19fa30={'where':_0x1c7cc7[_0xbe14('0x39')]};return db[_0xbe14('0x28')]['count'](_0x19fa30)[_0xbe14('0x22')](function(_0x841b71){_0x34d648[_0xbe14('0x1b')]=_0x841b71;if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3e')]){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x1220c9){_0x34d648[_0xbe14('0x41')]=_0x1220c9;return _0x34d648;})['then'](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))['catch'](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0xe417b,_0x3272ae){var _0x51c859={'raw':!![],'where':{'id':_0xe417b[_0xbe14('0x43')]['id']}},_0x5d5318={};_0x5d5318['model']=_['keys'](db[_0xbe14('0x28')][_0xbe14('0x29')]);_0x5d5318[_0xbe14('0x2e')]=_['keys'](_0xe417b['query']);_0x5d5318['filters']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],_0x5d5318[_0xbe14('0x2e')]);_0x51c859['attributes']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],qs[_0xbe14('0x32')](_0xe417b[_0xbe14('0x2e')]['fields']));_0x51c859['attributes']=_0x51c859[_0xbe14('0x34')][_0xbe14('0x33')]?_0x51c859[_0xbe14('0x34')]:_0x5d5318[_0xbe14('0x2d')];if(_0xe417b[_0xbe14('0x2e')]['includeAll']){_0x51c859['include']=[{'all':!![]}];}_0x51c859=_[_0xbe14('0x3c')]({},_0x51c859,_0xe417b[_0xbe14('0x3d')]);return db[_0xbe14('0x28')][_0xbe14('0x44')](_0x51c859)['then'](handleEntityNotFound(_0x3272ae,null))[_0xbe14('0x22')](respondWithResult(_0x3272ae,null))[_0xbe14('0x45')](handleError(_0x3272ae,null));};exports['create']=function(_0x396e40,_0x2a35e5){return db[_0xbe14('0x28')][_0xbe14('0x46')](_0x396e40['body'],{})['then'](respondWithResult(_0x2a35e5,0xc9))[_0xbe14('0x45')](handleError(_0x2a35e5,null));};exports[_0xbe14('0x21')]=function(_0x4a1a37,_0x5acf90){if(_0x4a1a37[_0xbe14('0x47')]['id']){delete _0x4a1a37[_0xbe14('0x47')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x44')]({'where':{'id':_0x4a1a37[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x22')](saveUpdates(_0x4a1a37['body'],null))[_0xbe14('0x22')](respondWithResult(_0x5acf90,null))[_0xbe14('0x45')](handleError(_0x5acf90,null));};exports[_0xbe14('0x48')]=function(_0x22b1f8,_0x2fc073){return db['Cdr'][_0xbe14('0x44')]({'where':{'id':_0x22b1f8[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x2fc073,null))[_0xbe14('0x22')](removeEntity(_0x2fc073,null))[_0xbe14('0x45')](handleError(_0x2fc073,null));};exports[_0xbe14('0x49')]=function(_0x505829,_0x5aeea9){return db[_0xbe14('0x28')][_0xbe14('0x49')]()[_0xbe14('0x22')](respondWithResult(_0x5aeea9,null))['catch'](handleError(_0x5aeea9,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 1a0b22e..5f1e25f 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(_0x1d9ef2,_0x53bd86){var _0x1610ae=function(_0x236a1f){while(--_0x236a1f){_0x1d9ef2['push'](_0x1d9ef2['shift']());}};_0x1610ae(++_0x53bd86);}(_0x7a54,0x106));var _0x47a5=function(_0x5e1d06,_0x3c1d88){_0x5e1d06=_0x5e1d06-0x0;var _0x4ce180=_0x7a54[_0x5e1d06];return _0x4ce180;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x55546b,_0x24cf25){var _0x257851=function(_0x281aae){while(--_0x281aae){_0x55546b['push'](_0x55546b['shift']());}};_0x257851(++_0x24cf25);}(_0x7a54,0x106));var _0x47a5=function(_0x20eac0,_0x246d92){_0x20eac0=_0x20eac0-0x0;var _0x1bcc95=_0x7a54[_0x20eac0];return _0x1bcc95;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 4a2cf91..c53660c 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 _0xbc09=['Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x5515c1,_0xfcf523){var _0x4ea4cc=function(_0x1016f8){while(--_0x1016f8){_0x5515c1['push'](_0x5515c1['shift']());}};_0x4ea4cc(++_0xfcf523);}(_0xbc09,0x1d5));var _0x9bc0=function(_0x51b779,_0x1f28b3){_0x51b779=_0x51b779-0x0;var _0x3899f4=_0xbc09[_0x51b779];return _0x3899f4;};'use strict';var _=require(_0x9bc0('0x0'));var util=require(_0x9bc0('0x1'));var moment=require(_0x9bc0('0x2'));var BPromise=require(_0x9bc0('0x3'));var rs=require(_0x9bc0('0x4'));var fs=require('fs');var Redis=require(_0x9bc0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9bc0('0x6'))(_0x9bc0('0x7'));var config=require(_0x9bc0('0x8'));var jayson=require(_0x9bc0('0x9'));var client=jayson[_0x9bc0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ec9cc,_0x395f56,_0x3d1bb8){return new BPromise(function(_0x4b56f0,_0x3c1aa4){return client[_0x9bc0('0xb')](_0x5ec9cc,_0x3d1bb8)[_0x9bc0('0xc')](function(_0x45d5c8){logger[_0x9bc0('0xd')](_0x9bc0('0xe'),_0x395f56,'request\x20sent');logger[_0x9bc0('0xf')](_0x9bc0('0x10'),_0x395f56,_0x9bc0('0x11'),JSON[_0x9bc0('0x12')](_0x45d5c8));if(_0x45d5c8[_0x9bc0('0x13')]){if(_0x45d5c8['error'][_0x9bc0('0x14')]===0x1f4){logger[_0x9bc0('0x13')]('Cdr,\x20%s,\x20%s',_0x395f56,_0x45d5c8[_0x9bc0('0x13')][_0x9bc0('0x15')]);return _0x3c1aa4(_0x45d5c8[_0x9bc0('0x13')][_0x9bc0('0x15')]);}logger[_0x9bc0('0x13')](_0x9bc0('0xe'),_0x395f56,_0x45d5c8[_0x9bc0('0x13')]['message']);return _0x4b56f0(_0x45d5c8[_0x9bc0('0x13')][_0x9bc0('0x15')]);}else{logger[_0x9bc0('0xd')](_0x9bc0('0xe'),_0x395f56,_0x9bc0('0x11'));_0x4b56f0(_0x45d5c8['result']['message']);}})[_0x9bc0('0x16')](function(_0x8af69){logger[_0x9bc0('0x13')](_0x9bc0('0xe'),_0x395f56,_0x8af69);_0x3c1aa4(_0x8af69);});});} \ No newline at end of file +var _0xb9f5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird'];(function(_0x70c202,_0x30af97){var _0x343b57=function(_0x595219){while(--_0x595219){_0x70c202['push'](_0x70c202['shift']());}};_0x343b57(++_0x30af97);}(_0xb9f5,0x135));var _0x5b9f=function(_0xd3e16a,_0x28517e){_0xd3e16a=_0xd3e16a-0x0;var _0x449538=_0xb9f5[_0xd3e16a];return _0x449538;};'use strict';var _=require(_0x5b9f('0x0'));var util=require(_0x5b9f('0x1'));var moment=require('moment');var BPromise=require(_0x5b9f('0x2'));var rs=require(_0x5b9f('0x3'));var fs=require('fs');var Redis=require(_0x5b9f('0x4'));var db=require(_0x5b9f('0x5'))['db'];var utils=require(_0x5b9f('0x6'));var logger=require(_0x5b9f('0x7'))(_0x5b9f('0x8'));var config=require(_0x5b9f('0x9'));var jayson=require(_0x5b9f('0xa'));var client=jayson['client'][_0x5b9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36714f,_0x44d01d,_0x12eff3){return new BPromise(function(_0x202417,_0xc25864){return client[_0x5b9f('0xc')](_0x36714f,_0x12eff3)[_0x5b9f('0xd')](function(_0x75465d){logger['info']('Cdr,\x20%s,\x20%s',_0x44d01d,_0x5b9f('0xe'));logger['debug'](_0x5b9f('0xf'),_0x44d01d,_0x5b9f('0xe'),JSON[_0x5b9f('0x10')](_0x75465d));if(_0x75465d[_0x5b9f('0x11')]){if(_0x75465d['error'][_0x5b9f('0x12')]===0x1f4){logger[_0x5b9f('0x11')]('Cdr,\x20%s,\x20%s',_0x44d01d,_0x75465d[_0x5b9f('0x11')]['message']);return _0xc25864(_0x75465d[_0x5b9f('0x11')][_0x5b9f('0x13')]);}logger[_0x5b9f('0x11')](_0x5b9f('0x14'),_0x44d01d,_0x75465d['error'][_0x5b9f('0x13')]);return _0x202417(_0x75465d[_0x5b9f('0x11')][_0x5b9f('0x13')]);}else{logger[_0x5b9f('0x15')](_0x5b9f('0x14'),_0x44d01d,_0x5b9f('0xe'));_0x202417(_0x75465d[_0x5b9f('0x16')][_0x5b9f('0x13')]);}})[_0x5b9f('0x17')](function(_0x4fb513){logger[_0x5b9f('0x11')](_0x5b9f('0x14'),_0x44d01d,_0x4fb513);_0xc25864(_0x4fb513);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 00a31ce..177ed2e 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _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(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_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('./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 d2d2f96..9ba2e4d 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 _0x570b=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x570b,0x159));var _0xb570=function(_0x4f37ab,_0x137060){_0x4f37ab=_0x4f37ab-0x0;var _0x198d33=_0x570b[_0x4f37ab];return _0x198d33;};'use strict';var Sequelize=require(_0xb570('0x0'));module[_0xb570('0x1')]={'priority':{'type':Sequelize[_0xb570('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb570('0x3')],'allowNull':![],'defaultValue':_0xb570('0x4')},'appdata':{'type':Sequelize[_0xb570('0x5')]()},'description':{'type':Sequelize[_0xb570('0x3')]},'interval':{'type':Sequelize[_0xb570('0x3')],'defaultValue':_0xb570('0x6')}}; \ No newline at end of file +var _0x79bf=['INTEGER','STRING','noop','exports'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x79bf,0x87));var _0xf79b=function(_0x103ac4,_0x137d0c){_0x103ac4=_0x103ac4-0x0;var _0x39d4c0=_0x79bf[_0x103ac4];return _0x39d4c0;};'use strict';var Sequelize=require('sequelize');module[_0xf79b('0x0')]={'priority':{'type':Sequelize[_0xf79b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf79b('0x2')],'allowNull':![],'defaultValue':_0xf79b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf79b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ac19da7..d71a936 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 _0x6c50=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','filters','model','attributes','fields','length','query','includeAll','include','merge','catch','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6c50,0xa4));var _0x06c5=function(_0x31a2fa,_0x41f9f7){_0x31a2fa=_0x31a2fa-0x0;var _0x32c763=_0x6c50[_0x31a2fa];return _0x32c763;};'use strict';var emlformat=require(_0x06c5('0x0'));var rimraf=require(_0x06c5('0x1'));var zipdir=require(_0x06c5('0x2'));var jsonpatch=require(_0x06c5('0x3'));var rp=require('request-promise');var moment=require(_0x06c5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x06c5('0x5'));var util=require(_0x06c5('0x6'));var path=require(_0x06c5('0x7'));var sox=require(_0x06c5('0x8'));var csv=require(_0x06c5('0x9'));var ejs=require(_0x06c5('0xa'));var fs=require('fs');var fs_extra=require(_0x06c5('0xb'));var _=require(_0x06c5('0xc'));var squel=require(_0x06c5('0xd'));var crypto=require(_0x06c5('0xe'));var jsforce=require(_0x06c5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x06c5('0x9'));var querystring=require(_0x06c5('0x10'));var Papa=require(_0x06c5('0x11'));var Redis=require(_0x06c5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06c5('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x06c5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x06c5('0x15'))['db'];function respondWithStatusCode(_0x2d7502,_0x68194e){_0x68194e=_0x68194e||0xcc;return function(_0x4ce581){if(_0x4ce581){return _0x2d7502[_0x06c5('0x16')](_0x68194e);}return _0x2d7502[_0x06c5('0x17')](_0x68194e)[_0x06c5('0x18')]();};}function respondWithResult(_0x39e176,_0x5d456e){_0x5d456e=_0x5d456e||0xc8;return function(_0x4e8669){if(_0x4e8669){return _0x39e176[_0x06c5('0x17')](_0x5d456e)[_0x06c5('0x19')](_0x4e8669);}};}function respondWithFilteredResult(_0x13a8d4,_0x4eeeca){return function(_0x16c36e){if(_0x16c36e){var _0x117371=typeof _0x4eeeca['offset']===_0x06c5('0x1a')&&typeof _0x4eeeca[_0x06c5('0x1b')]===_0x06c5('0x1a');var _0xb48b48=_0x16c36e[_0x06c5('0x1c')];var _0x36b9e9=_0x117371?0x0:_0x4eeeca[_0x06c5('0x1d')];var _0x18a070=_0x117371?_0x16c36e[_0x06c5('0x1c')]:_0x4eeeca[_0x06c5('0x1d')]+_0x4eeeca[_0x06c5('0x1b')];var _0x46471b;if(_0x18a070>=_0xb48b48){_0x18a070=_0xb48b48;_0x46471b=0xc8;}else{_0x46471b=0xce;}_0x13a8d4[_0x06c5('0x17')](_0x46471b);return _0x13a8d4[_0x06c5('0x1e')](_0x06c5('0x1f'),_0x36b9e9+'-'+_0x18a070+'/'+_0xb48b48)[_0x06c5('0x19')](_0x16c36e);}return null;};}function patchUpdates(_0x26a653){return function(_0x4ba7e9){try{jsonpatch[_0x06c5('0x20')](_0x4ba7e9,_0x26a653,!![]);}catch(_0x3c2d52){return BPromise[_0x06c5('0x21')](_0x3c2d52);}return _0x4ba7e9[_0x06c5('0x22')]();};}function saveUpdates(_0xa3659b,_0x3c9e49){return function(_0x29db18){if(_0x29db18){return _0x29db18['update'](_0xa3659b)[_0x06c5('0x23')](function(_0x1b0cc7){return _0x1b0cc7;});}return null;};}function removeEntity(_0x414dda,_0x20ba9e){return function(_0x368e2f){if(_0x368e2f){return _0x368e2f[_0x06c5('0x24')]()[_0x06c5('0x23')](function(){_0x414dda['status'](0xcc)[_0x06c5('0x18')]();});}};}function handleEntityNotFound(_0x5aeb6c,_0x564f96){return function(_0x512dbc){if(!_0x512dbc){_0x5aeb6c['sendStatus'](0x194);}return _0x512dbc;};}function handleError(_0xa33539,_0x2f6a65){_0x2f6a65=_0x2f6a65||0x1f4;return function(_0x1067e1){logger[_0x06c5('0x25')](_0x1067e1[_0x06c5('0x26')]);if(_0x1067e1['name']){delete _0x1067e1[_0x06c5('0x27')];}_0xa33539[_0x06c5('0x17')](_0x2f6a65)[_0x06c5('0x28')](_0x1067e1);};}exports[_0x06c5('0x29')]=function(_0x2f8ac9,_0x4d4d04){var _0x38f6a7={'raw':!![],'where':{'id':_0x2f8ac9[_0x06c5('0x2a')]['id']}},_0x432de5={};_0x432de5['model']=_[_0x06c5('0x2b')](db[_0x06c5('0x2c')][_0x06c5('0x2d')]);_0x432de5['query']=_['keys'](_0x2f8ac9['query']);_0x432de5[_0x06c5('0x2e')]=_['intersection'](_0x432de5[_0x06c5('0x2f')],_0x432de5['query']);_0x38f6a7[_0x06c5('0x30')]=_['intersection'](_0x432de5[_0x06c5('0x2f')],qs['fields'](_0x2f8ac9['query'][_0x06c5('0x31')]));_0x38f6a7['attributes']=_0x38f6a7['attributes'][_0x06c5('0x32')]?_0x38f6a7[_0x06c5('0x30')]:_0x432de5[_0x06c5('0x2f')];if(_0x2f8ac9[_0x06c5('0x33')][_0x06c5('0x34')]){_0x38f6a7[_0x06c5('0x35')]=[{'all':!![]}];}_0x38f6a7=_[_0x06c5('0x36')]({},_0x38f6a7,_0x2f8ac9['options']);return db[_0x06c5('0x2c')]['find'](_0x38f6a7)['then'](handleEntityNotFound(_0x4d4d04,null))[_0x06c5('0x23')](respondWithResult(_0x4d4d04,null))[_0x06c5('0x37')](handleError(_0x4d4d04,null));};exports[_0x06c5('0x38')]=function(_0x31bd7f,_0x1e9d9f){if(_0x31bd7f[_0x06c5('0x39')]['id']){delete _0x31bd7f[_0x06c5('0x39')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x31bd7f[_0x06c5('0x2a')]['id']}})[_0x06c5('0x23')](handleEntityNotFound(_0x1e9d9f,null))['then'](saveUpdates(_0x31bd7f['body'],null))[_0x06c5('0x23')](respondWithResult(_0x1e9d9f,null))[_0x06c5('0x37')](handleError(_0x1e9d9f,null));};exports[_0x06c5('0x24')]=function(_0x503d3f,_0x44b651){return db[_0x06c5('0x2c')][_0x06c5('0x3a')]({'where':{'id':_0x503d3f['params']['id']}})[_0x06c5('0x23')](handleEntityNotFound(_0x44b651,null))[_0x06c5('0x23')](removeEntity(_0x44b651,null))['catch'](handleError(_0x44b651,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x5cf3a3,_0x29327c){var _0x349b78=function(_0x465240){while(--_0x465240){_0x5cf3a3['push'](_0x5cf3a3['shift']());}};_0x349b78(++_0x29327c);}(_0xe706,0xa3));var _0x6e70=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xe706[_0x26a906];return _0x495575;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['ChatApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index dac261c..798c58e 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 _0x2b51=['../../config/logger','api','moment','bluebird','path','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0x2b51,0x1c5));var _0x12b5=function(_0x4d2753,_0x331d3b){_0x4d2753=_0x4d2753-0x0;var _0x8f4643=_0x2b51[_0x4d2753];return _0x8f4643;};'use strict';var _=require(_0x12b5('0x0'));var util=require(_0x12b5('0x1'));var logger=require(_0x12b5('0x2'))(_0x12b5('0x3'));var moment=require(_0x12b5('0x4'));var BPromise=require(_0x12b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12b5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x12b5('0x7'));module[_0x12b5('0x8')]=function(_0x38a245,_0x3fa276){return _0x38a245[_0x12b5('0x9')](_0x12b5('0xa'),attributes,{'tableName':_0x12b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x12b5('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x319c=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x319c,0x1d9));var _0xc319=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x319c[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0xc319('0x0'));var util=require('util');var logger=require(_0xc319('0x1'))(_0xc319('0x2'));var moment=require(_0xc319('0x3'));var BPromise=require('bluebird');var rp=require(_0xc319('0x4'));var fs=require('fs');var path=require(_0xc319('0x5'));var rimraf=require(_0xc319('0x6'));var config=require(_0xc319('0x7'));var attributes=require(_0xc319('0x8'));module[_0xc319('0x9')]=function(_0xd892a7,_0x1c6cc6){return _0xd892a7[_0xc319('0xa')](_0xc319('0xb'),attributes,{'tableName':_0xc319('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc319('0xd'),'collate':_0xc319('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e673aa5..5a70fd2 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 _0x73c3=['ChatApplication,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0x73c3,0x157));var _0x373c=function(_0x4222e3,_0x269e2e){_0x4222e3=_0x4222e3-0x0;var _0x1249c3=_0x73c3[_0x4222e3];return _0x1249c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x373c('0x0'));var BPromise=require(_0x373c('0x1'));var rs=require(_0x373c('0x2'));var fs=require('fs');var Redis=require(_0x373c('0x3'));var db=require(_0x373c('0x4'))['db'];var utils=require(_0x373c('0x5'));var logger=require(_0x373c('0x6'))('rpc');var config=require(_0x373c('0x7'));var jayson=require(_0x373c('0x8'));var client=jayson[_0x373c('0x9')][_0x373c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57dd78,_0x29fd3c,_0x537233){return new BPromise(function(_0x11c73e,_0x11de73){return client[_0x373c('0xb')](_0x57dd78,_0x537233)[_0x373c('0xc')](function(_0x20e314){logger['info']('ChatApplication,\x20%s,\x20%s',_0x29fd3c,_0x373c('0xd'));logger[_0x373c('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x29fd3c,'request\x20sent',JSON['stringify'](_0x20e314));if(_0x20e314[_0x373c('0xf')]){if(_0x20e314[_0x373c('0xf')][_0x373c('0x10')]===0x1f4){logger[_0x373c('0xf')](_0x373c('0x11'),_0x29fd3c,_0x20e314['error']['message']);return _0x11de73(_0x20e314[_0x373c('0xf')][_0x373c('0x12')]);}logger[_0x373c('0xf')]('ChatApplication,\x20%s,\x20%s',_0x29fd3c,_0x20e314[_0x373c('0xf')]['message']);return _0x11c73e(_0x20e314[_0x373c('0xf')]['message']);}else{logger['info'](_0x373c('0x11'),_0x29fd3c,_0x373c('0xd'));_0x11c73e(_0x20e314['result'][_0x373c('0x12')]);}})[_0x373c('0x13')](function(_0x3f765a){logger['error'](_0x373c('0x11'),_0x29fd3c,_0x3f765a);_0x11de73(_0x3f765a);});});} \ No newline at end of file +var _0x0df0=['code','error','ChatApplication,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0df0,0x9e));var _0x00df=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0x0df0[_0x50aea5];return _0x4657f1;};'use strict';var _=require(_0x00df('0x0'));var util=require(_0x00df('0x1'));var moment=require(_0x00df('0x2'));var BPromise=require('bluebird');var rs=require(_0x00df('0x3'));var fs=require('fs');var Redis=require(_0x00df('0x4'));var db=require(_0x00df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x00df('0x6'))(_0x00df('0x7'));var config=require(_0x00df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x00df('0x9')][_0x00df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1be127,_0x2ab690,_0x19a2b3){return new BPromise(function(_0x16b199,_0x16feaf){return client[_0x00df('0xb')](_0x1be127,_0x19a2b3)[_0x00df('0xc')](function(_0x491225){logger[_0x00df('0xd')]('ChatApplication,\x20%s,\x20%s',_0x2ab690,_0x00df('0xe'));logger[_0x00df('0xf')](_0x00df('0x10'),_0x2ab690,_0x00df('0xe'),JSON[_0x00df('0x11')](_0x491225));if(_0x491225['error']){if(_0x491225['error'][_0x00df('0x12')]===0x1f4){logger[_0x00df('0x13')](_0x00df('0x14'),_0x2ab690,_0x491225[_0x00df('0x13')][_0x00df('0x15')]);return _0x16feaf(_0x491225[_0x00df('0x13')][_0x00df('0x15')]);}logger[_0x00df('0x13')](_0x00df('0x14'),_0x2ab690,_0x491225[_0x00df('0x13')][_0x00df('0x15')]);return _0x16b199(_0x491225[_0x00df('0x13')][_0x00df('0x15')]);}else{logger[_0x00df('0xd')]('ChatApplication,\x20%s,\x20%s',_0x2ab690,'request\x20sent');_0x16b199(_0x491225['result'][_0x00df('0x15')]);}})['catch'](function(_0x52bee2){logger[_0x00df('0x13')](_0x00df('0x14'),_0x2ab690,_0x52bee2);_0x16feaf(_0x52bee2);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 89137c3..264aba3 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 _0xfa75=['../../config/environment','./chatApplication.controller','get','isAuthenticated','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5dd4c9,_0x5ddabd){var _0x27e0b5=function(_0x37056e){while(--_0x37056e){_0x5dd4c9['push'](_0x5dd4c9['shift']());}};_0x27e0b5(++_0x5ddabd);}(_0xfa75,0x98));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5fa7('0x0'));var util=require(_0x5fa7('0x1'));var path=require(_0x5fa7('0x2'));var timeout=require(_0x5fa7('0x3'));var express=require(_0x5fa7('0x4'));var router=express[_0x5fa7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5fa7('0x6'));var interaction=require(_0x5fa7('0x7'));var config=require(_0x5fa7('0x8'));var controller=require(_0x5fa7('0x9'));router[_0x5fa7('0xa')]('/:id',auth[_0x5fa7('0xb')](),controller['show']);router['put'](_0x5fa7('0xc'),auth['isAuthenticated'](),controller[_0x5fa7('0xd')]);router['delete'](_0x5fa7('0xc'),auth[_0x5fa7('0xb')](),controller[_0x5fa7('0xe')]);module[_0x5fa7('0xf')]=router; \ No newline at end of file +var _0x8529=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','./chatApplication.controller','get','/:id','show','put','update'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x8529,0x7f));var _0x9852=function(_0x5136dc,_0x38b7c2){_0x5136dc=_0x5136dc-0x0;var _0x46f3bb=_0x8529[_0x5136dc];return _0x46f3bb;};'use strict';var multer=require(_0x9852('0x0'));var util=require(_0x9852('0x1'));var path=require(_0x9852('0x2'));var timeout=require(_0x9852('0x3'));var express=require(_0x9852('0x4'));var router=express[_0x9852('0x5')]();var fs_extra=require(_0x9852('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9852('0x7'));router[_0x9852('0x8')](_0x9852('0x9'),auth['isAuthenticated'](),controller[_0x9852('0xa')]);router[_0x9852('0xb')](_0x9852('0x9'),auth['isAuthenticated'](),controller[_0x9852('0xc')]);router[_0x9852('0xd')](_0x9852('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 1ff5d26..6407cd6 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 _0xd9a5=['BOOLEAN','sequelize','exports','STRING'];(function(_0x47da0c,_0x35e485){var _0x121316=function(_0x1f4599){while(--_0x1f4599){_0x47da0c['push'](_0x47da0c['shift']());}};_0x121316(++_0x35e485);}(_0xd9a5,0x135));var _0x5d9a=function(_0x39eaa6,_0x360b97){_0x39eaa6=_0x39eaa6-0x0;var _0xdeae9b=_0xd9a5[_0x39eaa6];return _0xdeae9b;};'use strict';var Sequelize=require(_0x5d9a('0x0'));module[_0x5d9a('0x1')]={'name':{'type':Sequelize[_0x5d9a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5d9a('0x2')]},'write':{'type':Sequelize[_0x5d9a('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbdc2=['STRING','sequelize','exports'];(function(_0x4a9cb5,_0x5aa119){var _0x2dd0d2=function(_0x2aac77){while(--_0x2aac77){_0x4a9cb5['push'](_0x4a9cb5['shift']());}};_0x2dd0d2(++_0x5aa119);}(_0xbdc2,0x148));var _0x2bdc=function(_0x219daf,_0x36b307){_0x219daf=_0x219daf-0x0;var _0x4c2e61=_0xbdc2[_0x219daf];return _0x4c2e61;};'use strict';var Sequelize=require(_0x2bdc('0x0'));module[_0x2bdc('0x1')]={'name':{'type':Sequelize[_0x2bdc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2bdc('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b80e117..c01e1af 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 _0x6d22=['redis','localhost','./chatGroup.socket','register','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','ChatGroup','includeAll','include','show','params','length','options','find','catch','create','body','getUnread','user','toInteger','addMembers','omit','ids','getMembers','rawAttributes','removeMembers','addMessage','ChatInternalMessage','findOne','$gte','format','getMessages','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults'];(function(_0x2d82e1,_0x196524){var _0x38fd08=function(_0x5b3ddb){while(--_0x5b3ddb){_0x2d82e1['push'](_0x2d82e1['shift']());}};_0x38fd08(++_0x196524);}(_0x6d22,0x100));var _0x26d2=function(_0x9a28d6,_0x5e2125){_0x9a28d6=_0x9a28d6-0x0;var _0x438c21=_0x6d22[_0x9a28d6];return _0x438c21;};'use strict';var emlformat=require(_0x26d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26d2('0x1'));var jsonpatch=require(_0x26d2('0x2'));var rp=require(_0x26d2('0x3'));var moment=require(_0x26d2('0x4'));var BPromise=require(_0x26d2('0x5'));var Mustache=require(_0x26d2('0x6'));var util=require(_0x26d2('0x7'));var path=require('path');var sox=require(_0x26d2('0x8'));var csv=require(_0x26d2('0x9'));var ejs=require(_0x26d2('0xa'));var fs=require('fs');var fs_extra=require(_0x26d2('0xb'));var _=require('lodash');var squel=require(_0x26d2('0xc'));var crypto=require(_0x26d2('0xd'));var jsforce=require(_0x26d2('0xe'));var deskjs=require(_0x26d2('0xf'));var toCsv=require(_0x26d2('0x9'));var querystring=require(_0x26d2('0x10'));var Papa=require(_0x26d2('0x11'));var Redis=require('ioredis');var authService=require(_0x26d2('0x12'));var qs=require(_0x26d2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x26d2('0x14'));var utils=require(_0x26d2('0x15'));var config=require(_0x26d2('0x16'));var licenseUtil=require(_0x26d2('0x17'));var db=require(_0x26d2('0x18'))['db'];config['redis']=_[_0x26d2('0x19')](config[_0x26d2('0x1a')],{'host':_0x26d2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x26d2('0x1a')]));require(_0x26d2('0x1c'))[_0x26d2('0x1d')](socket);function respondWithStatusCode(_0x5d2a19,_0x174b4d){_0x174b4d=_0x174b4d||0xcc;return function(_0x3dd519){if(_0x3dd519){return _0x5d2a19['sendStatus'](_0x174b4d);}return _0x5d2a19[_0x26d2('0x1e')](_0x174b4d)[_0x26d2('0x1f')]();};}function respondWithResult(_0x38438d,_0xaad5d4){_0xaad5d4=_0xaad5d4||0xc8;return function(_0x1c5df8){if(_0x1c5df8){return _0x38438d[_0x26d2('0x1e')](_0xaad5d4)['json'](_0x1c5df8);}};}function respondWithFilteredResult(_0x4301e4,_0x1d61f0){return function(_0x5dd221){if(_0x5dd221){var _0x4559b3=typeof _0x1d61f0['offset']===_0x26d2('0x20')&&typeof _0x1d61f0[_0x26d2('0x21')]===_0x26d2('0x20');var _0x5c5a19=_0x5dd221[_0x26d2('0x22')];var _0x30391b=_0x4559b3?0x0:_0x1d61f0[_0x26d2('0x23')];var _0x47abb9=_0x4559b3?_0x5dd221[_0x26d2('0x22')]:_0x1d61f0['offset']+_0x1d61f0[_0x26d2('0x21')];var _0x4b1271;if(_0x47abb9>=_0x5c5a19){_0x47abb9=_0x5c5a19;_0x4b1271=0xc8;}else{_0x4b1271=0xce;}_0x4301e4['status'](_0x4b1271);return _0x4301e4[_0x26d2('0x24')](_0x26d2('0x25'),_0x30391b+'-'+_0x47abb9+'/'+_0x5c5a19)[_0x26d2('0x26')](_0x5dd221);}return null;};}function patchUpdates(_0x3f468e){return function(_0x4da47e){try{jsonpatch[_0x26d2('0x27')](_0x4da47e,_0x3f468e,!![]);}catch(_0x6be2bc){return BPromise[_0x26d2('0x28')](_0x6be2bc);}return _0x4da47e[_0x26d2('0x29')]();};}function saveUpdates(_0x8cb31e,_0x19a1a8){return function(_0xfe1704){if(_0xfe1704){return _0xfe1704[_0x26d2('0x2a')](_0x8cb31e)['then'](function(_0x2f8713){return _0x2f8713;});}return null;};}function removeEntity(_0x4c46ba,_0x254e14){return function(_0xe52127){if(_0xe52127){return _0xe52127['destroy']()[_0x26d2('0x2b')](function(){_0x4c46ba[_0x26d2('0x1e')](0xcc)[_0x26d2('0x1f')]();});}};}function handleEntityNotFound(_0x435533,_0x3d3621){return function(_0x4759f6){if(!_0x4759f6){_0x435533[_0x26d2('0x2c')](0x194);}return _0x4759f6;};}function handleError(_0x1cbc71,_0x41066b){_0x41066b=_0x41066b||0x1f4;return function(_0x4533e9){logger[_0x26d2('0x2d')](_0x4533e9[_0x26d2('0x2e')]);if(_0x4533e9[_0x26d2('0x2f')]){delete _0x4533e9[_0x26d2('0x2f')];}_0x1cbc71[_0x26d2('0x1e')](_0x41066b)[_0x26d2('0x30')](_0x4533e9);};}exports[_0x26d2('0x31')]=function(_0x5d9198,_0x3bbdfa){var _0xbd159b={},_0x581df7={},_0x1bbb30={'count':0x0,'rows':[]};var _0x3c8693=_[_0x26d2('0x32')](db['ChatGroup']['rawAttributes'],function(_0x13df3a){return{'name':_0x13df3a['fieldName'],'type':_0x13df3a['type'][_0x26d2('0x33')]};});_0x581df7[_0x26d2('0x34')]=_['map'](_0x3c8693,'name');_0x581df7['query']=_[_0x26d2('0x35')](_0x5d9198[_0x26d2('0x36')]);_0x581df7[_0x26d2('0x37')]=_[_0x26d2('0x38')](_0x581df7[_0x26d2('0x34')],_0x581df7['query']);_0xbd159b['attributes']=_[_0x26d2('0x38')](_0x581df7['model'],qs[_0x26d2('0x39')](_0x5d9198[_0x26d2('0x36')][_0x26d2('0x39')]));_0xbd159b['attributes']=_0xbd159b[_0x26d2('0x3a')]['length']?_0xbd159b['attributes']:_0x581df7[_0x26d2('0x34')];if(!_0x5d9198[_0x26d2('0x36')][_0x26d2('0x3b')](_0x26d2('0x3c'))){_0xbd159b[_0x26d2('0x21')]=qs[_0x26d2('0x21')](_0x5d9198[_0x26d2('0x36')]['limit']);_0xbd159b[_0x26d2('0x23')]=qs['offset'](_0x5d9198[_0x26d2('0x36')]['offset']);}_0xbd159b[_0x26d2('0x3d')]=qs['sort'](_0x5d9198[_0x26d2('0x36')][_0x26d2('0x3e')]);_0xbd159b['where']=qs[_0x26d2('0x37')](_[_0x26d2('0x3f')](_0x5d9198['query'],_0x581df7[_0x26d2('0x37')]),_0x3c8693);if(_0x5d9198[_0x26d2('0x36')]['filter']){_0xbd159b[_0x26d2('0x40')]=_['merge'](_0xbd159b[_0x26d2('0x40')],{'$or':_[_0x26d2('0x32')](_0x3c8693,function(_0x9faf07){if(_0x9faf07['type']!==_0x26d2('0x41')){var _0x457483={};_0x457483[_0x9faf07[_0x26d2('0x2f')]]={'$like':'%'+_0x5d9198['query'][_0x26d2('0x42')]+'%'};return _0x457483;}})});}_0xbd159b=_[_0x26d2('0x43')]({},_0xbd159b,_0x5d9198['options']);var _0x2eb262={'where':_0xbd159b[_0x26d2('0x40')]};return db[_0x26d2('0x44')][_0x26d2('0x22')](_0x2eb262)[_0x26d2('0x2b')](function(_0x2f5373){_0x1bbb30['count']=_0x2f5373;if(_0x5d9198[_0x26d2('0x36')][_0x26d2('0x45')]){_0xbd159b[_0x26d2('0x46')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0xbd159b);})['then'](function(_0x2290bb){_0x1bbb30['rows']=_0x2290bb;return _0x1bbb30;})[_0x26d2('0x2b')](respondWithFilteredResult(_0x3bbdfa,_0xbd159b))['catch'](handleError(_0x3bbdfa,null));};exports[_0x26d2('0x47')]=function(_0x340c38,_0x11ccd9){var _0x265db5={'raw':!![],'where':{'id':_0x340c38[_0x26d2('0x48')]['id']}},_0x31da16={};_0x31da16[_0x26d2('0x34')]=_[_0x26d2('0x35')](db['ChatGroup']['rawAttributes']);_0x31da16[_0x26d2('0x36')]=_['keys'](_0x340c38[_0x26d2('0x36')]);_0x31da16['filters']=_['intersection'](_0x31da16['model'],_0x31da16[_0x26d2('0x36')]);_0x265db5['attributes']=_[_0x26d2('0x38')](_0x31da16[_0x26d2('0x34')],qs['fields'](_0x340c38[_0x26d2('0x36')]['fields']));_0x265db5['attributes']=_0x265db5[_0x26d2('0x3a')][_0x26d2('0x49')]?_0x265db5[_0x26d2('0x3a')]:_0x31da16[_0x26d2('0x34')];if(_0x340c38[_0x26d2('0x36')][_0x26d2('0x45')]){_0x265db5['include']=[{'all':!![]}];}_0x265db5=_[_0x26d2('0x43')]({},_0x265db5,_0x340c38[_0x26d2('0x4a')]);return db['ChatGroup'][_0x26d2('0x4b')](_0x265db5)[_0x26d2('0x2b')](handleEntityNotFound(_0x11ccd9,null))['then'](respondWithResult(_0x11ccd9,null))[_0x26d2('0x4c')](handleError(_0x11ccd9,null));};exports[_0x26d2('0x4d')]=function(_0x38768b,_0x3511ab){return db[_0x26d2('0x44')][_0x26d2('0x4d')](_0x38768b['body'],{})[_0x26d2('0x2b')](respondWithResult(_0x3511ab,0xc9))[_0x26d2('0x4c')](handleError(_0x3511ab,null));};exports[_0x26d2('0x2a')]=function(_0x461d17,_0x358a0d){if(_0x461d17[_0x26d2('0x4e')]['id']){delete _0x461d17[_0x26d2('0x4e')]['id'];}return db[_0x26d2('0x44')][_0x26d2('0x4b')]({'where':{'id':_0x461d17[_0x26d2('0x48')]['id']}})[_0x26d2('0x2b')](handleEntityNotFound(_0x358a0d,null))[_0x26d2('0x2b')](saveUpdates(_0x461d17[_0x26d2('0x4e')],null))[_0x26d2('0x2b')](respondWithResult(_0x358a0d,null))[_0x26d2('0x4c')](handleError(_0x358a0d,null));};exports['destroy']=function(_0x564862,_0x31aa08){return db[_0x26d2('0x44')][_0x26d2('0x4b')]({'where':{'id':_0x564862['params']['id']}})[_0x26d2('0x2b')](handleEntityNotFound(_0x31aa08,null))[_0x26d2('0x2b')](removeEntity(_0x31aa08,null))[_0x26d2('0x4c')](handleError(_0x31aa08,null));};exports['describe']=function(_0x4a582a,_0x5a0f57){return db['ChatGroup']['describe']()[_0x26d2('0x2b')](respondWithResult(_0x5a0f57,null))[_0x26d2('0x4c')](handleError(_0x5a0f57,null));};exports[_0x26d2('0x4f')]=function(_0x185928,_0x15befe,_0x405033){return db['ChatInternalMessage'][_0x26d2('0x22')]({'where':{'ChatGroupId':_0x185928[_0x26d2('0x48')]['id'],'ToId':_0x185928[_0x26d2('0x50')]['id'],'read':![]}})[_0x26d2('0x2b')](function(_0x3601d6){return{'id':_[_0x26d2('0x51')](_0x185928['params']['id']),'count':_0x3601d6};})[_0x26d2('0x2b')](respondWithResult(_0x15befe,null))[_0x26d2('0x4c')](handleError(_0x15befe,null));};exports[_0x26d2('0x52')]=function(_0x4b891c,_0x1a58b9,_0x1dc930){return db['ChatGroup'][_0x26d2('0x4b')]({'where':{'id':_0x4b891c[_0x26d2('0x48')]['id']}})[_0x26d2('0x2b')](handleEntityNotFound(_0x1a58b9,null))['then'](function(_0x2a8de1){if(_0x2a8de1){return _0x2a8de1[_0x26d2('0x52')](_0x4b891c['body']['ids'],_[_0x26d2('0x53')](_0x4b891c[_0x26d2('0x4e')],[_0x26d2('0x54'),'id'])||{});}})['then'](respondWithResult(_0x1a58b9,null))[_0x26d2('0x4c')](handleError(_0x1a58b9,null));};exports[_0x26d2('0x55')]=function(_0x1a3ff5,_0x1d4a07,_0x1e90e0){var _0x46c7ea={};var _0x2a9d37={};var _0x5c0fcb;var _0x42d35d;return db[_0x26d2('0x44')]['findOne']({'where':{'id':_0x1a3ff5['params']['id']}})['then'](handleEntityNotFound(_0x1d4a07,null))[_0x26d2('0x2b')](function(_0x1e2079){if(_0x1e2079){_0x5c0fcb=_0x1e2079;_0x2a9d37[_0x26d2('0x34')]=_[_0x26d2('0x35')](db['User'][_0x26d2('0x56')]);_0x2a9d37['query']=_[_0x26d2('0x35')](_0x1a3ff5[_0x26d2('0x36')]);_0x2a9d37[_0x26d2('0x37')]=_[_0x26d2('0x38')](_0x2a9d37[_0x26d2('0x34')],_0x2a9d37['query']);_0x46c7ea[_0x26d2('0x3a')]=_['intersection'](_0x2a9d37[_0x26d2('0x34')],qs[_0x26d2('0x39')](_0x1a3ff5[_0x26d2('0x36')][_0x26d2('0x39')]));_0x46c7ea[_0x26d2('0x3a')]=_0x46c7ea[_0x26d2('0x3a')][_0x26d2('0x49')]?_0x46c7ea[_0x26d2('0x3a')]:_0x2a9d37[_0x26d2('0x34')];_0x46c7ea[_0x26d2('0x3d')]=qs['sort'](_0x1a3ff5[_0x26d2('0x36')]['sort']);_0x46c7ea[_0x26d2('0x40')]=qs[_0x26d2('0x37')](_[_0x26d2('0x3f')](_0x1a3ff5['query'],_0x2a9d37[_0x26d2('0x37')]));if(_0x1a3ff5['query'][_0x26d2('0x42')]){_0x46c7ea[_0x26d2('0x40')]=_[_0x26d2('0x43')](_0x46c7ea['where'],{'$or':_['map'](_0x46c7ea['attributes'],function(_0x31700c){var _0x220979={};_0x220979[_0x31700c]={'$like':'%'+_0x1a3ff5[_0x26d2('0x36')][_0x26d2('0x42')]+'%'};return _0x220979;})});}_0x46c7ea=_[_0x26d2('0x43')]({},_0x46c7ea,_0x1a3ff5[_0x26d2('0x4a')]);return _0x5c0fcb[_0x26d2('0x55')](_0x46c7ea);}})[_0x26d2('0x2b')](function(_0x1ac11e){if(_0x1ac11e){_0x42d35d=_0x1ac11e[_0x26d2('0x49')];if(!_0x1a3ff5['query'][_0x26d2('0x3b')]('nolimit')){_0x46c7ea[_0x26d2('0x21')]=qs[_0x26d2('0x21')](_0x1a3ff5[_0x26d2('0x36')]['limit']);_0x46c7ea['offset']=qs[_0x26d2('0x23')](_0x1a3ff5[_0x26d2('0x36')][_0x26d2('0x23')]);}return _0x5c0fcb[_0x26d2('0x55')](_0x46c7ea);}})['then'](function(_0x3f4dbf){if(_0x3f4dbf){return _0x3f4dbf?{'count':_0x42d35d,'rows':_0x3f4dbf}:null;}})[_0x26d2('0x2b')](respondWithResult(_0x1d4a07,null))[_0x26d2('0x4c')](handleError(_0x1d4a07,null));};exports[_0x26d2('0x57')]=function(_0x2bda90,_0x20ebde,_0x2214ec){return db[_0x26d2('0x44')][_0x26d2('0x4b')]({'where':{'id':_0x2bda90[_0x26d2('0x48')]['id']}})[_0x26d2('0x2b')](handleEntityNotFound(_0x20ebde,null))[_0x26d2('0x2b')](function(_0x521658){if(_0x521658){return _0x521658[_0x26d2('0x57')](_0x2bda90[_0x26d2('0x36')][_0x26d2('0x54')]);}})[_0x26d2('0x2b')](respondWithStatusCode(_0x20ebde,null))[_0x26d2('0x4c')](handleError(_0x20ebde,null));};exports[_0x26d2('0x58')]=function(_0x3c47a0,_0x173fbb,_0x1760de){if(_0x3c47a0[_0x26d2('0x4e')]['id']){delete _0x3c47a0[_0x26d2('0x4e')]['id'];}return db['ChatGroup'][_0x26d2('0x4b')]({'where':{'id':_0x3c47a0[_0x26d2('0x48')]['id']}})[_0x26d2('0x2b')](handleEntityNotFound(_0x173fbb,null))[_0x26d2('0x2b')](function(_0x553758){if(_0x553758){_0x3c47a0['body']['ChatGroupId']=_0x553758['id'];return db[_0x26d2('0x59')][_0x26d2('0x4d')](_0x3c47a0[_0x26d2('0x4e')]);}})[_0x26d2('0x2b')](respondWithResult(_0x173fbb,null))[_0x26d2('0x4c')](handleError(_0x173fbb,null));};exports['getMessages']=function(_0x3a4861,_0x5d944e,_0x27df7f){var _0x4f2280={};var _0x497d8c={};var _0x492f99;var _0x4c72df;return db['ChatGroup'][_0x26d2('0x5a')]({'where':{'id':_0x3a4861[_0x26d2('0x48')]['id']}})[_0x26d2('0x2b')](handleEntityNotFound(_0x5d944e,null))['then'](function(_0x10e539){if(_0x10e539){_0x492f99=_0x10e539;_0x497d8c[_0x26d2('0x34')]=_['keys'](db['ChatInternalMessage'][_0x26d2('0x56')]);_0x497d8c[_0x26d2('0x36')]=_[_0x26d2('0x35')](_0x3a4861['query']);_0x497d8c['filters']=_['intersection'](_0x497d8c['model'],_0x497d8c[_0x26d2('0x36')]);_0x4f2280[_0x26d2('0x3a')]=_[_0x26d2('0x38')](_0x497d8c[_0x26d2('0x34')],qs[_0x26d2('0x39')](_0x3a4861[_0x26d2('0x36')]['fields']));_0x4f2280[_0x26d2('0x3a')]=_0x4f2280[_0x26d2('0x3a')][_0x26d2('0x49')]?_0x4f2280[_0x26d2('0x3a')]:_0x497d8c[_0x26d2('0x34')];_0x4f2280[_0x26d2('0x3d')]=qs['sort'](_0x3a4861[_0x26d2('0x36')][_0x26d2('0x3e')]);_0x4f2280[_0x26d2('0x40')]=qs[_0x26d2('0x37')](_[_0x26d2('0x3f')](_0x3a4861[_0x26d2('0x36')],_0x497d8c[_0x26d2('0x37')]));if(_0x3a4861[_0x26d2('0x36')][_0x26d2('0x42')]){_0x4f2280['where']=_[_0x26d2('0x43')](_0x4f2280[_0x26d2('0x40')],{'$or':_[_0x26d2('0x32')](_0x4f2280[_0x26d2('0x3a')],function(_0x44697f){var _0x430e8c={};_0x430e8c[_0x44697f]={'$like':'%'+_0x3a4861[_0x26d2('0x36')][_0x26d2('0x42')]+'%'};return _0x430e8c;})});}if(_0x3a4861[_0x26d2('0x36')][_0x26d2('0x5b')]){var _0x2ad87b=_0x3a4861['query']['$gte']['split'](',');var _0x5b4809={};_0x5b4809[_0x2ad87b[0x0]]={'$gte':moment(_0x2ad87b[0x1])[_0x26d2('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4f2280[_0x26d2('0x40')]=_[_0x26d2('0x43')](_0x4f2280['where'],_0x5b4809);}_0x4f2280=_[_0x26d2('0x43')]({},_0x4f2280,_0x3a4861[_0x26d2('0x4a')]);return _0x492f99[_0x26d2('0x5d')](_0x4f2280);}})['then'](function(_0x2ccdc4){if(_0x2ccdc4){_0x4c72df=_0x2ccdc4[_0x26d2('0x49')];if(!_0x3a4861['query'][_0x26d2('0x3b')](_0x26d2('0x3c'))){_0x4f2280[_0x26d2('0x21')]=qs[_0x26d2('0x21')](_0x3a4861[_0x26d2('0x36')][_0x26d2('0x21')]);_0x4f2280[_0x26d2('0x23')]=qs[_0x26d2('0x23')](_0x3a4861[_0x26d2('0x36')]['offset']);}return _0x492f99[_0x26d2('0x5d')](_0x4f2280);}})[_0x26d2('0x2b')](function(_0x49dd07){if(_0x49dd07){return _0x49dd07?{'count':_0x4c72df,'rows':_0x49dd07}:null;}})[_0x26d2('0x2b')](respondWithResult(_0x5d944e,null))[_0x26d2('0x4c')](handleError(_0x5d944e,null));}; \ No newline at end of file +var _0x6748=['request-promise','moment','bluebird','util','path','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','redis','localhost','socket.io-emitter','./chatGroup.socket','register','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','length','filter','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','zip-dir','fast-json-patch'];(function(_0xac15c3,_0x2451ea){var _0x3ef3db=function(_0x361906){while(--_0x361906){_0xac15c3['push'](_0xac15c3['shift']());}};_0x3ef3db(++_0x2451ea);}(_0x6748,0xc9));var _0x8674=function(_0x2beca6,_0x5f2313){_0x2beca6=_0x2beca6-0x0;var _0x4a9cea=_0x6748[_0x2beca6];return _0x4a9cea;};'use strict';var emlformat=require(_0x8674('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8674('0x1'));var jsonpatch=require(_0x8674('0x2'));var rp=require(_0x8674('0x3'));var moment=require(_0x8674('0x4'));var BPromise=require(_0x8674('0x5'));var Mustache=require('mustache');var util=require(_0x8674('0x6'));var path=require(_0x8674('0x7'));var sox=require('sox');var csv=require(_0x8674('0x8'));var ejs=require(_0x8674('0x9'));var fs=require('fs');var fs_extra=require(_0x8674('0xa'));var _=require(_0x8674('0xb'));var squel=require(_0x8674('0xc'));var crypto=require(_0x8674('0xd'));var jsforce=require(_0x8674('0xe'));var deskjs=require(_0x8674('0xf'));var toCsv=require(_0x8674('0x8'));var querystring=require(_0x8674('0x10'));var Papa=require(_0x8674('0x11'));var Redis=require('ioredis');var authService=require(_0x8674('0x12'));var qs=require(_0x8674('0x13'));var as=require(_0x8674('0x14'));var hardwareService=require(_0x8674('0x15'));var logger=require(_0x8674('0x16'))(_0x8674('0x17'));var utils=require(_0x8674('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8674('0x19')]=_['defaults'](config[_0x8674('0x19')],{'host':_0x8674('0x1a'),'port':0x18eb});var socket=require(_0x8674('0x1b'))(new Redis(config[_0x8674('0x19')]));require(_0x8674('0x1c'))[_0x8674('0x1d')](socket);function respondWithStatusCode(_0x15cd1a,_0x31677a){_0x31677a=_0x31677a||0xcc;return function(_0x51a053){if(_0x51a053){return _0x15cd1a['sendStatus'](_0x31677a);}return _0x15cd1a['status'](_0x31677a)[_0x8674('0x1e')]();};}function respondWithResult(_0x26ebb4,_0x2b9258){_0x2b9258=_0x2b9258||0xc8;return function(_0x27c8c7){if(_0x27c8c7){return _0x26ebb4['status'](_0x2b9258)['json'](_0x27c8c7);}};}function respondWithFilteredResult(_0x11df36,_0xaa46b2){return function(_0x52cfc4){if(_0x52cfc4){var _0x4d4b62=typeof _0xaa46b2['offset']===_0x8674('0x1f')&&typeof _0xaa46b2[_0x8674('0x20')]==='undefined';var _0x130ec4=_0x52cfc4[_0x8674('0x21')];var _0x58ed83=_0x4d4b62?0x0:_0xaa46b2[_0x8674('0x22')];var _0x195c4e=_0x4d4b62?_0x52cfc4[_0x8674('0x21')]:_0xaa46b2['offset']+_0xaa46b2[_0x8674('0x20')];var _0x3f5d36;if(_0x195c4e>=_0x130ec4){_0x195c4e=_0x130ec4;_0x3f5d36=0xc8;}else{_0x3f5d36=0xce;}_0x11df36[_0x8674('0x23')](_0x3f5d36);return _0x11df36[_0x8674('0x24')](_0x8674('0x25'),_0x58ed83+'-'+_0x195c4e+'/'+_0x130ec4)[_0x8674('0x26')](_0x52cfc4);}return null;};}function patchUpdates(_0x5355d0){return function(_0x4b0ef1){try{jsonpatch[_0x8674('0x27')](_0x4b0ef1,_0x5355d0,!![]);}catch(_0x245b80){return BPromise[_0x8674('0x28')](_0x245b80);}return _0x4b0ef1[_0x8674('0x29')]();};}function saveUpdates(_0x4af696,_0x24c95d){return function(_0xc150ba){if(_0xc150ba){return _0xc150ba[_0x8674('0x2a')](_0x4af696)['then'](function(_0x1e5a06){return _0x1e5a06;});}return null;};}function removeEntity(_0x1e72cd,_0x1963f5){return function(_0x480879){if(_0x480879){return _0x480879[_0x8674('0x2b')]()[_0x8674('0x2c')](function(){_0x1e72cd[_0x8674('0x23')](0xcc)[_0x8674('0x1e')]();});}};}function handleEntityNotFound(_0x7c4622,_0x5eb596){return function(_0x5a03d6){if(!_0x5a03d6){_0x7c4622[_0x8674('0x2d')](0x194);}return _0x5a03d6;};}function handleError(_0x53ec08,_0x327ff4){_0x327ff4=_0x327ff4||0x1f4;return function(_0x5e4f66){logger['error'](_0x5e4f66[_0x8674('0x2e')]);if(_0x5e4f66[_0x8674('0x2f')]){delete _0x5e4f66['name'];}_0x53ec08[_0x8674('0x23')](_0x327ff4)[_0x8674('0x30')](_0x5e4f66);};}exports[_0x8674('0x31')]=function(_0x2a31fe,_0x3a40a1){var _0x4f1170={},_0x120769={},_0x2f23e0={'count':0x0,'rows':[]};var _0x1373e0=_[_0x8674('0x32')](db[_0x8674('0x33')]['rawAttributes'],function(_0x2e5657){return{'name':_0x2e5657[_0x8674('0x34')],'type':_0x2e5657[_0x8674('0x35')][_0x8674('0x36')]};});_0x120769[_0x8674('0x37')]=_[_0x8674('0x32')](_0x1373e0,_0x8674('0x2f'));_0x120769[_0x8674('0x38')]=_[_0x8674('0x39')](_0x2a31fe[_0x8674('0x38')]);_0x120769[_0x8674('0x3a')]=_[_0x8674('0x3b')](_0x120769[_0x8674('0x37')],_0x120769[_0x8674('0x38')]);_0x4f1170['attributes']=_[_0x8674('0x3b')](_0x120769[_0x8674('0x37')],qs[_0x8674('0x3c')](_0x2a31fe[_0x8674('0x38')][_0x8674('0x3c')]));_0x4f1170[_0x8674('0x3d')]=_0x4f1170[_0x8674('0x3d')]['length']?_0x4f1170[_0x8674('0x3d')]:_0x120769[_0x8674('0x37')];if(!_0x2a31fe['query'][_0x8674('0x3e')]('nolimit')){_0x4f1170['limit']=qs['limit'](_0x2a31fe['query'][_0x8674('0x20')]);_0x4f1170[_0x8674('0x22')]=qs['offset'](_0x2a31fe[_0x8674('0x38')][_0x8674('0x22')]);}_0x4f1170[_0x8674('0x3f')]=qs['sort'](_0x2a31fe[_0x8674('0x38')][_0x8674('0x40')]);_0x4f1170['where']=qs[_0x8674('0x3a')](_[_0x8674('0x41')](_0x2a31fe[_0x8674('0x38')],_0x120769[_0x8674('0x3a')]),_0x1373e0);if(_0x2a31fe[_0x8674('0x38')]['filter']){_0x4f1170[_0x8674('0x42')]=_[_0x8674('0x43')](_0x4f1170[_0x8674('0x42')],{'$or':_['map'](_0x1373e0,function(_0x383ada){if(_0x383ada[_0x8674('0x35')]!==_0x8674('0x44')){var _0x12729f={};_0x12729f[_0x383ada['name']]={'$like':'%'+_0x2a31fe[_0x8674('0x38')]['filter']+'%'};return _0x12729f;}})});}_0x4f1170=_[_0x8674('0x43')]({},_0x4f1170,_0x2a31fe[_0x8674('0x45')]);var _0x474f2a={'where':_0x4f1170[_0x8674('0x42')]};return db[_0x8674('0x33')][_0x8674('0x21')](_0x474f2a)[_0x8674('0x2c')](function(_0x54d08e){_0x2f23e0[_0x8674('0x21')]=_0x54d08e;if(_0x2a31fe[_0x8674('0x38')]['includeAll']){_0x4f1170['include']=[{'all':!![]}];}return db['ChatGroup'][_0x8674('0x46')](_0x4f1170);})['then'](function(_0x4a6598){_0x2f23e0[_0x8674('0x47')]=_0x4a6598;return _0x2f23e0;})[_0x8674('0x2c')](respondWithFilteredResult(_0x3a40a1,_0x4f1170))[_0x8674('0x48')](handleError(_0x3a40a1,null));};exports[_0x8674('0x49')]=function(_0x43998a,_0x3fa793){var _0x5c3df5={'raw':!![],'where':{'id':_0x43998a[_0x8674('0x4a')]['id']}},_0x2f2b43={};_0x2f2b43['model']=_[_0x8674('0x39')](db[_0x8674('0x33')][_0x8674('0x4b')]);_0x2f2b43[_0x8674('0x38')]=_[_0x8674('0x39')](_0x43998a[_0x8674('0x38')]);_0x2f2b43[_0x8674('0x3a')]=_[_0x8674('0x3b')](_0x2f2b43[_0x8674('0x37')],_0x2f2b43[_0x8674('0x38')]);_0x5c3df5[_0x8674('0x3d')]=_[_0x8674('0x3b')](_0x2f2b43[_0x8674('0x37')],qs['fields'](_0x43998a[_0x8674('0x38')][_0x8674('0x3c')]));_0x5c3df5[_0x8674('0x3d')]=_0x5c3df5['attributes']['length']?_0x5c3df5[_0x8674('0x3d')]:_0x2f2b43[_0x8674('0x37')];if(_0x43998a[_0x8674('0x38')][_0x8674('0x4c')]){_0x5c3df5[_0x8674('0x4d')]=[{'all':!![]}];}_0x5c3df5=_[_0x8674('0x43')]({},_0x5c3df5,_0x43998a[_0x8674('0x45')]);return db[_0x8674('0x33')][_0x8674('0x4e')](_0x5c3df5)[_0x8674('0x2c')](handleEntityNotFound(_0x3fa793,null))[_0x8674('0x2c')](respondWithResult(_0x3fa793,null))[_0x8674('0x48')](handleError(_0x3fa793,null));};exports['create']=function(_0x560375,_0x5045ce){return db[_0x8674('0x33')][_0x8674('0x4f')](_0x560375['body'],{})[_0x8674('0x2c')](respondWithResult(_0x5045ce,0xc9))[_0x8674('0x48')](handleError(_0x5045ce,null));};exports[_0x8674('0x2a')]=function(_0x38afb1,_0x507402){if(_0x38afb1[_0x8674('0x50')]['id']){delete _0x38afb1[_0x8674('0x50')]['id'];}return db[_0x8674('0x33')]['find']({'where':{'id':_0x38afb1['params']['id']}})['then'](handleEntityNotFound(_0x507402,null))['then'](saveUpdates(_0x38afb1['body'],null))[_0x8674('0x2c')](respondWithResult(_0x507402,null))[_0x8674('0x48')](handleError(_0x507402,null));};exports[_0x8674('0x2b')]=function(_0x272757,_0x36cac1){return db[_0x8674('0x33')][_0x8674('0x4e')]({'where':{'id':_0x272757[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x36cac1,null))[_0x8674('0x2c')](removeEntity(_0x36cac1,null))[_0x8674('0x48')](handleError(_0x36cac1,null));};exports[_0x8674('0x51')]=function(_0x24216c,_0x2fc8dc){return db[_0x8674('0x33')]['describe']()[_0x8674('0x2c')](respondWithResult(_0x2fc8dc,null))[_0x8674('0x48')](handleError(_0x2fc8dc,null));};exports[_0x8674('0x52')]=function(_0x5830fc,_0x6712f1,_0x52f403){return db[_0x8674('0x53')][_0x8674('0x21')]({'where':{'ChatGroupId':_0x5830fc[_0x8674('0x4a')]['id'],'ToId':_0x5830fc[_0x8674('0x54')]['id'],'read':![]}})[_0x8674('0x2c')](function(_0x17224a){return{'id':_[_0x8674('0x55')](_0x5830fc['params']['id']),'count':_0x17224a};})['then'](respondWithResult(_0x6712f1,null))['catch'](handleError(_0x6712f1,null));};exports[_0x8674('0x56')]=function(_0x10411c,_0x1e5e0f,_0x284d5d){return db[_0x8674('0x33')][_0x8674('0x4e')]({'where':{'id':_0x10411c[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x1e5e0f,null))[_0x8674('0x2c')](function(_0x3553f0){if(_0x3553f0){return _0x3553f0[_0x8674('0x56')](_0x10411c[_0x8674('0x50')][_0x8674('0x57')],_[_0x8674('0x58')](_0x10411c[_0x8674('0x50')],[_0x8674('0x57'),'id'])||{});}})[_0x8674('0x2c')](respondWithResult(_0x1e5e0f,null))[_0x8674('0x48')](handleError(_0x1e5e0f,null));};exports[_0x8674('0x59')]=function(_0x57bb82,_0x47541d,_0x1028bb){var _0x110f80={};var _0x195436={};var _0x474874;var _0x32a3f6;return db[_0x8674('0x33')][_0x8674('0x5a')]({'where':{'id':_0x57bb82[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x47541d,null))[_0x8674('0x2c')](function(_0x9cab85){if(_0x9cab85){_0x474874=_0x9cab85;_0x195436[_0x8674('0x37')]=_[_0x8674('0x39')](db[_0x8674('0x5b')]['rawAttributes']);_0x195436[_0x8674('0x38')]=_[_0x8674('0x39')](_0x57bb82[_0x8674('0x38')]);_0x195436[_0x8674('0x3a')]=_['intersection'](_0x195436[_0x8674('0x37')],_0x195436[_0x8674('0x38')]);_0x110f80['attributes']=_[_0x8674('0x3b')](_0x195436[_0x8674('0x37')],qs[_0x8674('0x3c')](_0x57bb82['query'][_0x8674('0x3c')]));_0x110f80[_0x8674('0x3d')]=_0x110f80[_0x8674('0x3d')][_0x8674('0x5c')]?_0x110f80[_0x8674('0x3d')]:_0x195436[_0x8674('0x37')];_0x110f80[_0x8674('0x3f')]=qs[_0x8674('0x40')](_0x57bb82[_0x8674('0x38')][_0x8674('0x40')]);_0x110f80[_0x8674('0x42')]=qs[_0x8674('0x3a')](_[_0x8674('0x41')](_0x57bb82['query'],_0x195436[_0x8674('0x3a')]));if(_0x57bb82[_0x8674('0x38')][_0x8674('0x5d')]){_0x110f80['where']=_[_0x8674('0x43')](_0x110f80[_0x8674('0x42')],{'$or':_[_0x8674('0x32')](_0x110f80[_0x8674('0x3d')],function(_0x161b85){var _0x48662e={};_0x48662e[_0x161b85]={'$like':'%'+_0x57bb82[_0x8674('0x38')][_0x8674('0x5d')]+'%'};return _0x48662e;})});}_0x110f80=_[_0x8674('0x43')]({},_0x110f80,_0x57bb82[_0x8674('0x45')]);return _0x474874[_0x8674('0x59')](_0x110f80);}})[_0x8674('0x2c')](function(_0x1d62c2){if(_0x1d62c2){_0x32a3f6=_0x1d62c2[_0x8674('0x5c')];if(!_0x57bb82[_0x8674('0x38')]['hasOwnProperty']('nolimit')){_0x110f80[_0x8674('0x20')]=qs['limit'](_0x57bb82[_0x8674('0x38')][_0x8674('0x20')]);_0x110f80[_0x8674('0x22')]=qs[_0x8674('0x22')](_0x57bb82['query'][_0x8674('0x22')]);}return _0x474874[_0x8674('0x59')](_0x110f80);}})[_0x8674('0x2c')](function(_0x712112){if(_0x712112){return _0x712112?{'count':_0x32a3f6,'rows':_0x712112}:null;}})[_0x8674('0x2c')](respondWithResult(_0x47541d,null))['catch'](handleError(_0x47541d,null));};exports['removeMembers']=function(_0x28e256,_0x30db9b,_0xa16f8f){return db['ChatGroup']['find']({'where':{'id':_0x28e256[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x30db9b,null))['then'](function(_0x46afa7){if(_0x46afa7){return _0x46afa7[_0x8674('0x5e')](_0x28e256[_0x8674('0x38')][_0x8674('0x57')]);}})[_0x8674('0x2c')](respondWithStatusCode(_0x30db9b,null))[_0x8674('0x48')](handleError(_0x30db9b,null));};exports[_0x8674('0x5f')]=function(_0x2da7de,_0x3f5953,_0x3e25c8){if(_0x2da7de[_0x8674('0x50')]['id']){delete _0x2da7de[_0x8674('0x50')]['id'];}return db[_0x8674('0x33')][_0x8674('0x4e')]({'where':{'id':_0x2da7de[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x3f5953,null))[_0x8674('0x2c')](function(_0x228ed9){if(_0x228ed9){_0x2da7de[_0x8674('0x50')][_0x8674('0x60')]=_0x228ed9['id'];return db[_0x8674('0x53')][_0x8674('0x4f')](_0x2da7de[_0x8674('0x50')]);}})[_0x8674('0x2c')](respondWithResult(_0x3f5953,null))[_0x8674('0x48')](handleError(_0x3f5953,null));};exports[_0x8674('0x61')]=function(_0x53d3a0,_0x5151de,_0x1bbe7f){var _0xa26d5c={};var _0x5ec7cd={};var _0x325a44;var _0x49ff45;return db[_0x8674('0x33')][_0x8674('0x5a')]({'where':{'id':_0x53d3a0['params']['id']}})['then'](handleEntityNotFound(_0x5151de,null))[_0x8674('0x2c')](function(_0x5165dc){if(_0x5165dc){_0x325a44=_0x5165dc;_0x5ec7cd[_0x8674('0x37')]=_[_0x8674('0x39')](db['ChatInternalMessage'][_0x8674('0x4b')]);_0x5ec7cd['query']=_['keys'](_0x53d3a0[_0x8674('0x38')]);_0x5ec7cd['filters']=_[_0x8674('0x3b')](_0x5ec7cd['model'],_0x5ec7cd['query']);_0xa26d5c[_0x8674('0x3d')]=_['intersection'](_0x5ec7cd[_0x8674('0x37')],qs[_0x8674('0x3c')](_0x53d3a0[_0x8674('0x38')][_0x8674('0x3c')]));_0xa26d5c['attributes']=_0xa26d5c[_0x8674('0x3d')][_0x8674('0x5c')]?_0xa26d5c[_0x8674('0x3d')]:_0x5ec7cd['model'];_0xa26d5c[_0x8674('0x3f')]=qs[_0x8674('0x40')](_0x53d3a0[_0x8674('0x38')][_0x8674('0x40')]);_0xa26d5c[_0x8674('0x42')]=qs[_0x8674('0x3a')](_[_0x8674('0x41')](_0x53d3a0[_0x8674('0x38')],_0x5ec7cd[_0x8674('0x3a')]));if(_0x53d3a0['query']['filter']){_0xa26d5c['where']=_[_0x8674('0x43')](_0xa26d5c[_0x8674('0x42')],{'$or':_[_0x8674('0x32')](_0xa26d5c[_0x8674('0x3d')],function(_0x4715a3){var _0x4bec18={};_0x4bec18[_0x4715a3]={'$like':'%'+_0x53d3a0[_0x8674('0x38')]['filter']+'%'};return _0x4bec18;})});}if(_0x53d3a0[_0x8674('0x38')][_0x8674('0x62')]){var _0x397d70=_0x53d3a0[_0x8674('0x38')][_0x8674('0x62')]['split'](',');var _0x18e553={};_0x18e553[_0x397d70[0x0]]={'$gte':moment(_0x397d70[0x1])[_0x8674('0x63')](_0x8674('0x64'))};_0xa26d5c['where']=_['merge'](_0xa26d5c[_0x8674('0x42')],_0x18e553);}_0xa26d5c=_[_0x8674('0x43')]({},_0xa26d5c,_0x53d3a0['options']);return _0x325a44[_0x8674('0x61')](_0xa26d5c);}})[_0x8674('0x2c')](function(_0x176bb5){if(_0x176bb5){_0x49ff45=_0x176bb5['length'];if(!_0x53d3a0[_0x8674('0x38')][_0x8674('0x3e')](_0x8674('0x65'))){_0xa26d5c['limit']=qs[_0x8674('0x20')](_0x53d3a0[_0x8674('0x38')][_0x8674('0x20')]);_0xa26d5c[_0x8674('0x22')]=qs[_0x8674('0x22')](_0x53d3a0['query'][_0x8674('0x22')]);}return _0x325a44['getMessages'](_0xa26d5c);}})[_0x8674('0x2c')](function(_0x5e54e5){if(_0x5e54e5){return _0x5e54e5?{'count':_0x49ff45,'rows':_0x5e54e5}:null;}})['then'](respondWithResult(_0x5151de,null))['catch'](handleError(_0x5151de,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fc3610a..caf360c 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 _0x9931=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x9931,0x1b6));var _0x1993=function(_0x2dcf37,_0x2b80f6){_0x2dcf37=_0x2dcf37-0x0;var _0x29bd77=_0x9931[_0x2dcf37];return _0x29bd77;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x1993('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1993('0x1')](0x0);var events={'afterCreate':_0x1993('0x2'),'afterUpdate':_0x1993('0x3'),'afterDestroy':_0x1993('0x4')};function emitEvent(_0x311444){return function(_0x38e764,_0x31e1a5,_0x401ac4){ChatGroupEvents[_0x1993('0x5')](_0x311444+':'+_0x38e764['id'],_0x38e764);ChatGroupEvents[_0x1993('0x5')](_0x311444,_0x38e764);_0x401ac4(null);};}for(var e in events){if(events[_0x1993('0x6')](e)){var event=events[e];ChatGroup[_0x1993('0x7')](e,emitEvent(event));}}module[_0x1993('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x9a78=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','ChatGroup'];(function(_0x1a11aa,_0x13ad5b){var _0xf96024=function(_0x329cb3){while(--_0x329cb3){_0x1a11aa['push'](_0x1a11aa['shift']());}};_0xf96024(++_0x13ad5b);}(_0x9a78,0x1b6));var _0x89a7=function(_0x36564c,_0x39d543){_0x36564c=_0x36564c-0x0;var _0x767851=_0x9a78[_0x36564c];return _0x767851;};'use strict';var EventEmitter=require(_0x89a7('0x0'));var ChatGroup=require(_0x89a7('0x1'))['db'][_0x89a7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x89a7('0x3')](0x0);var events={'afterCreate':_0x89a7('0x4'),'afterUpdate':_0x89a7('0x5'),'afterDestroy':_0x89a7('0x6')};function emitEvent(_0x27bd96){return function(_0x1932a,_0x236c9f,_0xda9675){ChatGroupEvents[_0x89a7('0x7')](_0x27bd96+':'+_0x1932a['id'],_0x1932a);ChatGroupEvents[_0x89a7('0x7')](_0x27bd96,_0x1932a);_0xda9675(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x89a7('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index cff1a68..0c646f8 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 _0xc8de=['moment','bluebird','request-promise','path','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','api'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc8de,0xe1));var _0xec8d=function(_0x2c701e,_0x23e272){_0x2c701e=_0x2c701e-0x0;var _0x4b5dfe=_0xc8de[_0x2c701e];return _0x4b5dfe;};'use strict';var _=require(_0xec8d('0x0'));var util=require(_0xec8d('0x1'));var logger=require('../../config/logger')(_0xec8d('0x2'));var moment=require(_0xec8d('0x3'));var BPromise=require(_0xec8d('0x4'));var rp=require(_0xec8d('0x5'));var fs=require('fs');var path=require(_0xec8d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xec8d('0x7'));module[_0xec8d('0x8')]=function(_0x40310d,_0x2071ec){return _0x40310d[_0xec8d('0x9')](_0xec8d('0xa'),attributes,{'tableName':_0xec8d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5308=['path','rimraf','../../config/environment','exports','define','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1c5201,_0x130b4b){var _0xe369ee=function(_0x103373){while(--_0x103373){_0x1c5201['push'](_0x1c5201['shift']());}};_0xe369ee(++_0x130b4b);}(_0x5308,0x8a));var _0x8530=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x5308[_0x4eafed];return _0x159c85;};'use strict';var _=require(_0x8530('0x0'));var util=require(_0x8530('0x1'));var logger=require(_0x8530('0x2'))('api');var moment=require(_0x8530('0x3'));var BPromise=require(_0x8530('0x4'));var rp=require(_0x8530('0x5'));var fs=require('fs');var path=require(_0x8530('0x6'));var rimraf=require(_0x8530('0x7'));var config=require(_0x8530('0x8'));var attributes=require('./chatGroup.attributes');module[_0x8530('0x9')]=function(_0x156948,_0x2630e2){return _0x156948[_0x8530('0xa')]('ChatGroup',attributes,{'tableName':_0x8530('0xb'),'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 5ed3f3e..eebe28d 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 _0x3edb=['localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis'];(function(_0x56d117,_0x55c2a4){var _0x47ee45=function(_0xa35897){while(--_0xa35897){_0x56d117['push'](_0x56d117['shift']());}};_0x47ee45(++_0x55c2a4);}(_0x3edb,0x1c9));var _0xb3ed=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x3edb[_0xbb091];return _0x467a04;};'use strict';var _=require(_0xb3ed('0x0'));var util=require(_0xb3ed('0x1'));var moment=require('moment');var BPromise=require(_0xb3ed('0x2'));var rs=require(_0xb3ed('0x3'));var fs=require('fs');var Redis=require(_0xb3ed('0x4'));var db=require(_0xb3ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3ed('0x6'))('rpc');var config=require(_0xb3ed('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb3ed('0x8')][_0xb3ed('0x9')]({'port':0x232a});config[_0xb3ed('0xa')]=_['defaults'](config[_0xb3ed('0xa')],{'host':_0xb3ed('0xb'),'port':0x18eb});var socket=require(_0xb3ed('0xc'))(new Redis(config[_0xb3ed('0xa')]));require(_0xb3ed('0xd'))[_0xb3ed('0xe')](socket);function respondWithRpcPromise(_0x4f1692,_0x21fa7f,_0x5c5fec){return new BPromise(function(_0x5402f0,_0x245eec){return client[_0xb3ed('0xf')](_0x4f1692,_0x5c5fec)[_0xb3ed('0x10')](function(_0xda646b){logger[_0xb3ed('0x11')]('ChatGroup,\x20%s,\x20%s',_0x21fa7f,_0xb3ed('0x12'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x21fa7f,_0xb3ed('0x12'),JSON[_0xb3ed('0x13')](_0xda646b));if(_0xda646b['error']){if(_0xda646b[_0xb3ed('0x14')][_0xb3ed('0x15')]===0x1f4){logger[_0xb3ed('0x14')](_0xb3ed('0x16'),_0x21fa7f,_0xda646b[_0xb3ed('0x14')][_0xb3ed('0x17')]);return _0x245eec(_0xda646b['error'][_0xb3ed('0x17')]);}logger[_0xb3ed('0x14')]('ChatGroup,\x20%s,\x20%s',_0x21fa7f,_0xda646b[_0xb3ed('0x14')][_0xb3ed('0x17')]);return _0x5402f0(_0xda646b[_0xb3ed('0x14')]['message']);}else{logger['info'](_0xb3ed('0x16'),_0x21fa7f,_0xb3ed('0x12'));_0x5402f0(_0xda646b[_0xb3ed('0x18')][_0xb3ed('0x17')]);}})[_0xb3ed('0x19')](function(_0x184038){logger[_0xb3ed('0x14')](_0xb3ed('0x16'),_0x21fa7f,_0x184038);_0x245eec(_0x184038);});});} \ No newline at end of file +var _0xfaec=['error','code','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xfaec,0x12f));var _0xcfae=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfaec[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xcfae('0x0'));var util=require(_0xcfae('0x1'));var moment=require(_0xcfae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfae('0x3'))['db'];var utils=require(_0xcfae('0x4'));var logger=require(_0xcfae('0x5'))(_0xcfae('0x6'));var config=require(_0xcfae('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfae('0x8')]({'port':0x232a});config[_0xcfae('0x9')]=_['defaults'](config[_0xcfae('0x9')],{'host':_0xcfae('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcfae('0xb'))[_0xcfae('0xc')](socket);function respondWithRpcPromise(_0x21b991,_0x37b9f3,_0x54b749){return new BPromise(function(_0x331670,_0x383684){return client['request'](_0x21b991,_0x54b749)[_0xcfae('0xd')](function(_0xd38855){logger[_0xcfae('0xe')](_0xcfae('0xf'),_0x37b9f3,'request\x20sent');logger[_0xcfae('0x10')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x37b9f3,_0xcfae('0x11'),JSON[_0xcfae('0x12')](_0xd38855));if(_0xd38855[_0xcfae('0x13')]){if(_0xd38855['error'][_0xcfae('0x14')]===0x1f4){logger[_0xcfae('0x13')](_0xcfae('0xf'),_0x37b9f3,_0xd38855[_0xcfae('0x13')][_0xcfae('0x15')]);return _0x383684(_0xd38855['error'][_0xcfae('0x15')]);}logger[_0xcfae('0x13')](_0xcfae('0xf'),_0x37b9f3,_0xd38855[_0xcfae('0x13')]['message']);return _0x331670(_0xd38855[_0xcfae('0x13')][_0xcfae('0x15')]);}else{logger[_0xcfae('0xe')]('ChatGroup,\x20%s,\x20%s',_0x37b9f3,'request\x20sent');_0x331670(_0xd38855[_0xcfae('0x16')]['message']);}})['catch'](function(_0x35158b){logger['error'](_0xcfae('0xf'),_0x37b9f3,_0x35158b);_0x383684(_0x35158b);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1c7e4b7..c5232d3 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 _0x75b3=['emit','removeListener','chatGroup:','./chatGroup.events','remove','update'];(function(_0x2f10ab,_0x50177c){var _0x4c238d=function(_0x4351cf){while(--_0x4351cf){_0x2f10ab['push'](_0x2f10ab['shift']());}};_0x4c238d(++_0x50177c);}(_0x75b3,0x189));var _0x375b=function(_0x1d3552,_0x3fd22d){_0x1d3552=_0x1d3552-0x0;var _0x3e4a3f=_0x75b3[_0x1d3552];return _0x3e4a3f;};'use strict';var ChatGroupEvents=require(_0x375b('0x0'));var events=['save',_0x375b('0x1'),_0x375b('0x2')];function createListener(_0x4a5ca9,_0x341202){return function(_0x4095bf){_0x341202[_0x375b('0x3')](_0x4a5ca9,_0x4095bf);};}function removeListener(_0x3b0b66,_0x51fdba){return function(){ChatGroupEvents[_0x375b('0x4')](_0x3b0b66,_0x51fdba);};}exports['register']=function(_0x1eb50e){for(var _0x2d0eac=0x0,_0x367256=events['length'];_0x2d0eac<_0x367256;_0x2d0eac++){var _0x20135f=events[_0x2d0eac];var _0x548436=createListener(_0x375b('0x5')+_0x20135f,_0x1eb50e);ChatGroupEvents['on'](_0x20135f,_0x548436);}}; \ No newline at end of file +var _0xfe17=['save','remove','update','emit','removeListener','register','length','./chatGroup.events'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xfe17,0xbf));var _0x7fe1=function(_0xb47cd8,_0x4520f7){_0xb47cd8=_0xb47cd8-0x0;var _0x63672a=_0xfe17[_0xb47cd8];return _0x63672a;};'use strict';var ChatGroupEvents=require(_0x7fe1('0x0'));var events=[_0x7fe1('0x1'),_0x7fe1('0x2'),_0x7fe1('0x3')];function createListener(_0x5f5c57,_0x4f6b05){return function(_0x169133){_0x4f6b05[_0x7fe1('0x4')](_0x5f5c57,_0x169133);};}function removeListener(_0x25edb2,_0x4060be){return function(){ChatGroupEvents[_0x7fe1('0x5')](_0x25edb2,_0x4060be);};}exports[_0x7fe1('0x6')]=function(_0x6ed96b){for(var _0x3a8bf2=0x0,_0x3dd0e1=events[_0x7fe1('0x7')];_0x3a8bf2<_0x3dd0e1;_0x3a8bf2++){var _0x4ce9f4=events[_0x3a8bf2];var _0x1de308=createListener('chatGroup:'+_0x4ce9f4,_0x6ed96b);ChatGroupEvents['on'](_0x4ce9f4,_0x1de308);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e2c7625..6e4b09f 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 _0xffd9=['../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','/:id/messages','getMessages','post','create','/:id/members','addMessage','put','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x250f2e,_0x2a8b40){var _0x49a437=function(_0x44946b){while(--_0x44946b){_0x250f2e['push'](_0x250f2e['shift']());}};_0x49a437(++_0x2a8b40);}(_0xffd9,0x14a));var _0x9ffd=function(_0x44da75,_0x4e4ef9){_0x44da75=_0x44da75-0x0;var _0x293c52=_0xffd9[_0x44da75];return _0x293c52;};'use strict';var multer=require(_0x9ffd('0x0'));var util=require(_0x9ffd('0x1'));var path=require(_0x9ffd('0x2'));var timeout=require(_0x9ffd('0x3'));var express=require(_0x9ffd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9ffd('0x5'));var interaction=require(_0x9ffd('0x6'));var config=require(_0x9ffd('0x7'));var controller=require(_0x9ffd('0x8'));router[_0x9ffd('0x9')]('/',auth[_0x9ffd('0xa')](),controller[_0x9ffd('0xb')]);router[_0x9ffd('0x9')](_0x9ffd('0xc'),auth[_0x9ffd('0xa')](),controller[_0x9ffd('0xd')]);router['get'](_0x9ffd('0xe'),auth[_0x9ffd('0xa')](),controller[_0x9ffd('0xf')]);router[_0x9ffd('0x9')](_0x9ffd('0x10'),auth[_0x9ffd('0xa')](),controller['getUnread']);router[_0x9ffd('0x9')]('/:id/members',auth[_0x9ffd('0xa')](),controller['getMembers']);router['get'](_0x9ffd('0x11'),auth[_0x9ffd('0xa')](),controller[_0x9ffd('0x12')]);router[_0x9ffd('0x13')]('/',auth[_0x9ffd('0xa')](),controller[_0x9ffd('0x14')]);router[_0x9ffd('0x13')](_0x9ffd('0x15'),auth[_0x9ffd('0xa')](),controller['addMembers']);router[_0x9ffd('0x13')](_0x9ffd('0x11'),auth[_0x9ffd('0xa')](),controller[_0x9ffd('0x16')]);router[_0x9ffd('0x17')](_0x9ffd('0xe'),auth[_0x9ffd('0xa')](),controller['update']);router[_0x9ffd('0x18')](_0x9ffd('0xe'),auth[_0x9ffd('0xa')](),controller[_0x9ffd('0x19')]);router[_0x9ffd('0x18')](_0x9ffd('0x15'),auth[_0x9ffd('0xa')](),controller[_0x9ffd('0x1a')]);module[_0x9ffd('0x1b')]=router; \ No newline at end of file +var _0x577d=['post','create','addMessage','update','delete','destroy','removeMembers','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages'];(function(_0xb43c5e,_0x59d9fc){var _0xed2ad1=function(_0x3360a8){while(--_0x3360a8){_0xb43c5e['push'](_0xb43c5e['shift']());}};_0xed2ad1(++_0x59d9fc);}(_0x577d,0x1b0));var _0xd577=function(_0x326c9a,_0x1180e8){_0x326c9a=_0x326c9a-0x0;var _0x2dc1c3=_0x577d[_0x326c9a];return _0x2dc1c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd577('0x0'));var timeout=require('connect-timeout');var express=require(_0xd577('0x1'));var router=express[_0xd577('0x2')]();var fs_extra=require(_0xd577('0x3'));var auth=require(_0xd577('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd577('0x5'));var controller=require(_0xd577('0x6'));router[_0xd577('0x7')]('/',auth[_0xd577('0x8')](),controller[_0xd577('0x9')]);router[_0xd577('0x7')]('/describe',auth[_0xd577('0x8')](),controller['describe']);router['get'](_0xd577('0xa'),auth[_0xd577('0x8')](),controller[_0xd577('0xb')]);router[_0xd577('0x7')](_0xd577('0xc'),auth[_0xd577('0x8')](),controller[_0xd577('0xd')]);router[_0xd577('0x7')](_0xd577('0xe'),auth[_0xd577('0x8')](),controller[_0xd577('0xf')]);router[_0xd577('0x7')](_0xd577('0x10'),auth[_0xd577('0x8')](),controller[_0xd577('0x11')]);router[_0xd577('0x12')]('/',auth[_0xd577('0x8')](),controller[_0xd577('0x13')]);router[_0xd577('0x12')](_0xd577('0xe'),auth[_0xd577('0x8')](),controller['addMembers']);router[_0xd577('0x12')](_0xd577('0x10'),auth[_0xd577('0x8')](),controller[_0xd577('0x14')]);router['put']('/:id',auth[_0xd577('0x8')](),controller[_0xd577('0x15')]);router[_0xd577('0x16')](_0xd577('0xa'),auth[_0xd577('0x8')](),controller[_0xd577('0x17')]);router[_0xd577('0x16')]('/:id/members',auth[_0xd577('0x8')](),controller[_0xd577('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index fd16cdf..be30276 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 _0x7275=['STRING','long','DATE','out','sequelize','exports','BOOLEAN','ENUM','thumb','star','TEXT'];(function(_0x6dc4a5,_0x58a155){var _0x57b3e2=function(_0xe3f0d){while(--_0xe3f0d){_0x6dc4a5['push'](_0x6dc4a5['shift']());}};_0x57b3e2(++_0x58a155);}(_0x7275,0x143));var _0x5727=function(_0x3f410b,_0x42ab42){_0x3f410b=_0x3f410b-0x0;var _0x327295=_0x7275[_0x3f410b];return _0x327295;};'use strict';var Sequelize=require(_0x5727('0x0'));module[_0x5727('0x1')]={'closed':{'type':Sequelize[_0x5727('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x5727('0x3')]('star',_0x5727('0x4')),'defaultValue':_0x5727('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x5727('0x6')]},'mailTranscript':{'type':Sequelize[_0x5727('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5727('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x5727('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x5727('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x5727('0x7')]},'deviceVendor':{'type':Sequelize[_0x5727('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x5727('0x6')]},'customerIp':{'type':Sequelize[_0x5727('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x5727('0x8'))},'read1stAt':{'type':Sequelize[_0x5727('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5727('0x3')]('in',_0x5727('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5727('0x7')]},'customerPort':{'type':Sequelize[_0x5727('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x5727('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x5727('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7033=['star','thumb','TEXT','STRING','DATE','long','ENUM','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7033,0x19e));var _0x3703=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7033[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x3703('0x0'));module[_0x3703('0x1')]={'closed':{'type':Sequelize[_0x3703('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3703('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x3703('0x4'),_0x3703('0x5')),'defaultValue':_0x3703('0x4')},'ratingMessage':{'type':Sequelize[_0x3703('0x6')]},'pathTranscript':{'type':Sequelize[_0x3703('0x6')]},'mailTranscript':{'type':Sequelize[_0x3703('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3703('0x8')]},'disposition':{'type':Sequelize[_0x3703('0x7')]},'secondDisposition':{'type':Sequelize[_0x3703('0x7')]},'thirdDisposition':{'type':Sequelize[_0x3703('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x3703('0x7')]},'osVersion':{'type':Sequelize[_0x3703('0x7')]},'deviceModel':{'type':Sequelize[_0x3703('0x7')]},'deviceVendor':{'type':Sequelize[_0x3703('0x7')]},'deviceType':{'type':Sequelize[_0x3703('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x3703('0x7')]},'formData':{'type':Sequelize[_0x3703('0x6')](_0x3703('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3703('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3703('0x7')]},'customerPort':{'type':Sequelize[_0x3703('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x3703('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x3703('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 00d0fa4..ded4087 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 _0x565d=['now','User','ChatWebsiteId','ContactId','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','MailAccount','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','order','options','push','addTags','omit','spread','Tag','color','chatInteractionTags:save','removeTags','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','mkdirSync','toString','closedAt','browserName','osName','referer','customerIp','customerPort','map','existsSync','createReadStream','createWriteStream','value','views','downloadInteraction.ejs','transcript-','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','name','render','merge','body','agent','interaction','account','index','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','chat','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','create','find','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','user','fullname','contact','POST','email','isNull','vidaooNote','follow','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format'];(function(_0x3def66,_0x230a16){var _0x28e91e=function(_0x46fe0e){while(--_0x46fe0e){_0x3def66['push'](_0x3def66['shift']());}};_0x28e91e(++_0x230a16);}(_0x565d,0x1f3));var _0xd565=function(_0x5ee390,_0x5edd64){_0x5ee390=_0x5ee390-0x0;var _0x1d7dc4=_0x565d[_0x5ee390];return _0x1d7dc4;};'use strict';var rimraf=require(_0xd565('0x0'));var zipdir=require(_0xd565('0x1'));var rp=require(_0xd565('0x2'));var moment=require(_0xd565('0x3'));var BPromise=require(_0xd565('0x4'));var Mustache=require('mustache');var util=require(_0xd565('0x5'));var path=require(_0xd565('0x6'));var ejs=require(_0xd565('0x7'));var fs=require('fs');var _=require(_0xd565('0x8'));var Redis=require(_0xd565('0x9'));var interaction=require(_0xd565('0xa'));var qs=require(_0xd565('0xb'));var pdf=require(_0xd565('0xc'));var logger=require(_0xd565('0xd'))(_0xd565('0xe'));var config=require(_0xd565('0xf'));var db=require(_0xd565('0x10'))['db'];config[_0xd565('0x11')]=_[_0xd565('0x12')](config[_0xd565('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0xd565('0x13'))(new Redis(config['redis']));require(_0xd565('0x14'))[_0xd565('0x15')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd565('0x16')][_0xd565('0x17')]({'port':0x232b});var client9004=jayson[_0xd565('0x16')][_0xd565('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x1ef575,_0x3aca43,_0x3a046a,_0x1214b4){return new BPromise(function(_0x5d6dd1,_0x54b5e4){var _0x22e304=_0x1214b4||client;return _0x22e304[_0xd565('0x18')](_0x1ef575,_0x3a046a)[_0xd565('0x19')](function(_0x374854){logger[_0xd565('0x1a')](_0xd565('0x1b'),_0x3aca43,_0xd565('0x1c'));logger[_0xd565('0x1d')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3aca43,'request\x20sent',JSON[_0xd565('0x1e')](_0x374854));if(_0x374854[_0xd565('0x1f')]){if(_0x374854['error'][_0xd565('0x20')]===0x1f4){logger[_0xd565('0x1f')](_0xd565('0x1b'),_0x3aca43,_0x374854[_0xd565('0x1f')]['message']);return _0x54b5e4(_0x374854['error'][_0xd565('0x21')]);}logger['error'](_0xd565('0x1b'),_0x3aca43,_0x374854[_0xd565('0x1f')][_0xd565('0x21')]);return _0x5d6dd1(_0x374854[_0xd565('0x1f')]['message']);}else{logger[_0xd565('0x1a')](_0xd565('0x1b'),_0x3aca43,_0xd565('0x1c'));_0x5d6dd1(_0x374854[_0xd565('0x22')]['message']);}})[_0xd565('0x23')](function(_0x7722ed){logger[_0xd565('0x1f')](_0xd565('0x1b'),_0x3aca43,_0x7722ed);_0x54b5e4(_0x7722ed);});});}function respondWithStatusCode(_0x1cd195,_0x261bec){_0x261bec=_0x261bec||0xcc;return function(_0x1ca4cc){if(_0x1ca4cc){return _0x1cd195[_0xd565('0x24')](_0x261bec);}return _0x1cd195[_0xd565('0x25')](_0x261bec)[_0xd565('0x26')]();};}function respondWithResult(_0x16db93,_0x252028){_0x252028=_0x252028||0xc8;return function(_0xccdc6c){if(_0xccdc6c){return _0x16db93['status'](_0x252028)[_0xd565('0x27')](_0xccdc6c);}};}function respondWithFilteredResult(_0x25eb45,_0x25094a){return function(_0x11a7db){if(_0x11a7db){var _0x52dd91=typeof _0x25094a[_0xd565('0x28')]===_0xd565('0x29')&&typeof _0x25094a['limit']===_0xd565('0x29');var _0x43e728=_0x11a7db[_0xd565('0x2a')];var _0x1cc9ec=_0x52dd91?0x0:_0x25094a[_0xd565('0x28')];var _0x52e0ed=_0x52dd91?_0x11a7db['count']:_0x25094a[_0xd565('0x28')]+_0x25094a[_0xd565('0x2b')];var _0xe33117;if(_0x52e0ed>=_0x43e728){_0x52e0ed=_0x43e728;_0xe33117=0xc8;}else{_0xe33117=0xce;}_0x25eb45[_0xd565('0x25')](_0xe33117);return _0x25eb45[_0xd565('0x2c')](_0xd565('0x2d'),_0x1cc9ec+'-'+_0x52e0ed+'/'+_0x43e728)['json'](_0x11a7db);}return null;};}function saveUpdates(_0x53b76e){return function(_0x2a192b){if(_0x2a192b){return _0x2a192b[_0xd565('0x2e')](_0x53b76e)['then'](function(_0x4e1d8a){return _0x4e1d8a;});}return null;};}function removeEntity(_0x5ead40){return function(_0xa42576){if(_0xa42576){return _0xa42576[_0xd565('0x2f')]()[_0xd565('0x19')](function(){_0x5ead40[_0xd565('0x25')](0xcc)[_0xd565('0x26')]();});}};}function handleEntityNotFound(_0x24dc63){return function(_0xdddef8){if(!_0xdddef8){_0x24dc63['sendStatus'](0x194);}return _0xdddef8;};}function handleError(_0x308e66,_0x72c9b3){_0x72c9b3=_0x72c9b3||0x1f4;return function(_0x2c6ed4){logger[_0xd565('0x1f')](_0x2c6ed4['stack']);if(_0x2c6ed4['name']){delete _0x2c6ed4[_0xd565('0x30')];}_0x308e66[_0xd565('0x25')](_0x72c9b3)['send'](_0x2c6ed4);};}function getMustacheRender(_0x41870c,_0x428f0f){return Mustache[_0xd565('0x31')](_0x41870c,_[_0xd565('0x32')](_0x428f0f[_0xd565('0x33')],{'contact':_0x428f0f['contact'],'message':_0x428f0f[_0xd565('0x21')],'agent':_0x428f0f[_0xd565('0x34')],'interaction':_0x428f0f[_0xd565('0x35')],'account':_0x428f0f[_0xd565('0x36')]}))||'';}exports[_0xd565('0x37')]=function(_0x108c1b,_0x380b55){var _0x2819ae={};var _0x385ffb=_['map'](db[_0xd565('0x38')][_0xd565('0x39')],function(_0x42a3cb){return{'name':_0x42a3cb[_0xd565('0x3a')],'type':_0x42a3cb[_0xd565('0x3b')]['key']};});_0x2819ae=qs[_0xd565('0x3c')](_0x385ffb,_0x108c1b);return interaction[_0xd565('0x3d')](_0xd565('0x3e'),_0x108c1b['query'],_0x108c1b['user'],_0x2819ae,_0x385ffb)[_0xd565('0x19')](respondWithFilteredResult(_0x380b55,_0x2819ae))[_0xd565('0x23')](handleError(_0x380b55,null));};exports['show']=function(_0x56c779,_0x48f193){var _0x1f8f2e={'raw':![],'where':{'id':_0x56c779[_0xd565('0x3f')]['id']}},_0x2c08a5={};_0x2c08a5[_0xd565('0x40')]=_[_0xd565('0x41')](db[_0xd565('0x38')]['rawAttributes']);_0x2c08a5['query']=_[_0xd565('0x41')](_0x56c779[_0xd565('0x42')]);_0x2c08a5[_0xd565('0x43')]=_[_0xd565('0x44')](_0x2c08a5[_0xd565('0x40')],_0x2c08a5[_0xd565('0x42')]);_0x1f8f2e[_0xd565('0x45')]=_[_0xd565('0x44')](_0x2c08a5['model'],qs[_0xd565('0x46')](_0x56c779[_0xd565('0x42')][_0xd565('0x46')]));_0x1f8f2e[_0xd565('0x45')]=_0x1f8f2e[_0xd565('0x45')][_0xd565('0x47')]?_0x1f8f2e[_0xd565('0x45')]:_0x2c08a5['model'];if(_0x56c779[_0xd565('0x42')][_0xd565('0x48')]){_0x1f8f2e[_0xd565('0x49')]=[{'all':!![]}];}_0x1f8f2e=_[_0xd565('0x32')]({},_0x1f8f2e,_0x56c779['options']);return db[_0xd565('0x38')]['find'](_0x1f8f2e)[_0xd565('0x19')](handleEntityNotFound(_0x48f193,null))['then'](respondWithResult(_0x48f193,null))[_0xd565('0x23')](handleError(_0x48f193,null));};exports[_0xd565('0x4a')]=function(_0x93ec6b,_0x586e4a){return db['ChatInteraction'][_0xd565('0x4a')](_0x93ec6b[_0xd565('0x33')],{})[_0xd565('0x19')](respondWithResult(_0x586e4a,0xc9))[_0xd565('0x23')](handleError(_0x586e4a,null));};exports['update']=function(_0x4ea7c7,_0x3b1caf){if(_0x4ea7c7[_0xd565('0x33')]['id']){delete _0x4ea7c7[_0xd565('0x33')]['id'];}return db[_0xd565('0x38')][_0xd565('0x4b')]({'where':{'id':_0x4ea7c7['params']['id']}})[_0xd565('0x19')](handleEntityNotFound(_0x3b1caf,null))[_0xd565('0x19')](saveUpdates(_0x4ea7c7['body'],null))[_0xd565('0x19')](respondWithResult(_0x3b1caf,null))[_0xd565('0x23')](handleError(_0x3b1caf,null));};exports[_0xd565('0x2f')]=function(_0x35e725,_0x3b14f1){return db[_0xd565('0x38')][_0xd565('0x4b')]({'where':{'id':_0x35e725[_0xd565('0x3f')]['id']}})[_0xd565('0x19')](handleEntityNotFound(_0x3b14f1,null))[_0xd565('0x19')](removeEntity(_0x3b14f1,null))[_0xd565('0x23')](handleError(_0x3b14f1,null));};exports['describe']=function(_0x5bd551,_0x2831be){return db[_0xd565('0x38')]['describe']()[_0xd565('0x19')](respondWithResult(_0x2831be,null))[_0xd565('0x23')](handleError(_0x2831be,null));};exports[_0xd565('0x4c')]=function(_0x4f1c63,_0x1ab15a){var _0x5c802b=_0x4f1c63['params']['id'];var _0x32fbcd;var _0x2c1e80;var _0x40ac86;return db[_0xd565('0x38')]['findOne']({'where':{'id':_0x5c802b}})['then'](function(_0x582856){_0x32fbcd=_0x582856;return db[_0xd565('0x4d')][_0xd565('0x4e')]({'where':{'id':_0x582856['ChatWebsiteId']},'attributes':['id',_0xd565('0x4f'),'vidaooEscalation',_0xd565('0x50'),'vidaooNote',_0xd565('0x51')],'raw':!![]});})[_0xd565('0x19')](function(_0x2c327){if(_0x2c327&&_0x2c327[_0xd565('0x4f')]&&_0x2c327[_0xd565('0x52')]){_0x2c1e80=_0x2c327;var _0x2bc8a8={'interaction':{'id':_0x5c802b},'agent':{'id':_0x4f1c63[_0xd565('0x53')]['id'],'name':_0x4f1c63[_0xd565('0x53')][_0xd565('0x30')],'fullname':_0x4f1c63[_0xd565('0x53')][_0xd565('0x54')],'email':_0x4f1c63[_0xd565('0x53')]['email']},'contact':_0x4f1c63[_0xd565('0x33')][_0xd565('0x55')],'account':_0x4f1c63[_0xd565('0x33')]['account']};var _0x386db5={'rejectUnauthorized':![],'method':_0xd565('0x56'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2c327[_0xd565('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4f1c63[_0xd565('0x53')][_0xd565('0x57')]],'buttons':null,'topic':_0x2c1e80[_0xd565('0x50')],'note':_[_0xd565('0x58')](_0x2c1e80[_0xd565('0x59')])?null:getMustacheRender(_0x2c1e80[_0xd565('0x59')],_0x2bc8a8),'metadata':null},'redirect':_0xd565('0x5a'),'json':!![]};try{if(!_[_0xd565('0x58')](_0x2c1e80[_0xd565('0x51')])){var _0x2366f8=getMustacheRender(_0x2c1e80[_0xd565('0x51')],_0x2bc8a8);var _0x281c63=JSON[_0xd565('0x5b')](_0x2366f8);_0x386db5[_0xd565('0x33')][_0xd565('0x5c')]=_0x281c63;}}catch(_0x3d01cc){throw new db['Sequelize'][(_0xd565('0x5d'))](_0xd565('0x5e'));}return rp(_0x386db5);}else{throw new db[(_0xd565('0x5f'))][(_0xd565('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xd565('0x19')](function(_0x1b71a0){_0x40ac86=_0x1b71a0;if(_0x40ac86['id']){var _0x4b852d={'body':_0x40ac86[_0xd565('0x60')],'ChatWebsiteId':_0x2c1e80['id'],'ChatInteractionId':_0x32fbcd['id'],'direction':_0xd565('0x61'),'UserId':_0x4f1c63[_0xd565('0x53')]['id']};return db[_0xd565('0x62')][_0xd565('0x4a')](_0x4b852d,{});}else{throw new db[(_0xd565('0x5f'))][(_0xd565('0x5d'))](_0xd565('0x63'));}})['then'](function(){return _0x32fbcd[_0xd565('0x64')]({'vidaooSessionId':_0x40ac86['id']});})['then'](respondWithResult(_0x1ab15a,null))[_0xd565('0x23')](handleError(_0x1ab15a,null));};exports[_0xd565('0x65')]=function(_0x2ef829,_0xb86652){if(_0x2ef829[_0xd565('0x33')]['id']){delete _0x2ef829[_0xd565('0x33')]['id'];}return db['ChatInteraction'][_0xd565('0x4b')]({'where':{'id':_0x2ef829['params']['id']},'include':[{'model':db[_0xd565('0x66')],'as':_0xd565('0x67')}]})[_0xd565('0x19')](handleEntityNotFound(_0xb86652,null))[_0xd565('0x19')](saveUpdates(_0x2ef829[_0xd565('0x33')],null))['then'](respondWithResult(_0xb86652,null))[_0xd565('0x23')](handleError(_0xb86652,null));};exports['abandon']=function(_0x4e3308,_0x11245d){if(_0x4e3308['body']['id']){delete _0x4e3308[_0xd565('0x33')]['id'];}return db[_0xd565('0x38')][_0xd565('0x4b')]({'where':{'id':_0x4e3308['params']['id']}})[_0xd565('0x19')](function(_0x4054e5){if(!_0x4054e5){logger[_0xd565('0x1f')](_0xd565('0x68'),_0xd565('0x69'),0x194,_0xd565('0x6a'));_0x11245d[_0xd565('0x24')](0x194);}else{if(_0x4054e5[_0xd565('0x6b')]){throw new db[(_0xd565('0x5f'))][(_0xd565('0x5d'))]('Interaction\x20already\x20assigned');}}return _0x4054e5;})[_0xd565('0x19')](function(_0x5b8691){if(_0x5b8691){return _0x5b8691[_0xd565('0x2e')]({'closed':_0x4e3308['body'][_0xd565('0x6c')],'disposition':_0x4e3308['body'][_0xd565('0x6d')]})[_0xd565('0x19')](function(_0x111079){return _0x111079;});}})[_0xd565('0x19')](function(){return respondWithRpcPromise(_0xd565('0x6e'),'abandon',_0x4e3308[_0xd565('0x33')],client9004);})[_0xd565('0x19')](respondWithResult(_0x11245d,null))[_0xd565('0x23')](handleError(_0x11245d,null));};exports['attachmentUpload']=function(_0x1f73d8,_0x4d19af){_0x1f73d8[_0xd565('0x33')][_0xd565('0x30')]=_0x1f73d8[_0xd565('0x6f')]['originalname'];_0x1f73d8['body'][_0xd565('0x70')]=_0x1f73d8['file'][_0xd565('0x71')];_0x1f73d8['body'][_0xd565('0x3b')]=_0x1f73d8[_0xd565('0x6f')][_0xd565('0x72')];return db['Attachment']['create'](_0x1f73d8[_0xd565('0x33')])[_0xd565('0x19')](respondWithResult(_0x4d19af,0xc9))[_0xd565('0x23')](handleError(_0x4d19af,null));};exports[_0xd565('0x73')]=function(_0x2aca1f,_0x3301f8){return db['ChatInteraction'][_0xd565('0x4e')]({'where':{'id':_0x2aca1f['params']['id']},'raw':!![]})[_0xd565('0x19')](handleEntityNotFound(_0x3301f8,null))[_0xd565('0x19')](function(_0x4d4141){if(_0x4d4141){if(_0x4d4141[_0xd565('0x6c')]){return _0x3301f8[_0xd565('0x25')](0x193)[_0xd565('0x27')]({'status':0x193,'message':_0xd565('0x74')});}return db[_0xd565('0x75')][_0xd565('0x4e')]({'where':{'id':_0x2aca1f[_0xd565('0x42')][_0xd565('0x76')]},'raw':!![]})[_0xd565('0x19')](handleEntityNotFound(_0x3301f8,null));}})[_0xd565('0x19')](function(_0x5e6dc3){if(_0x5e6dc3){var _0x2d1537=_0x5e6dc3[_0xd565('0x77')]!==null;var _0x3edaca=path[_0xd565('0x78')](config[_0xd565('0x79')],_0xd565('0x7a'));if(_0x2d1537){_0x3edaca=path[_0xd565('0x78')](_0x3edaca,_0xd565('0x7b'));}var _0x39f9b9=path['join'](_0x3edaca,_0x5e6dc3[_0xd565('0x70')]);return _0x3301f8[_0xd565('0x7c')](_0x39f9b9);}})[_0xd565('0x23')](handleError(_0x3301f8,null));};exports[_0xd565('0x7d')]=function(_0x1241d6,_0x22c905){var _0x14ba71=null;var _0x580cc8=null;var _0x3bdfff=null;if(_0x1241d6[_0xd565('0x33')]['id']){delete _0x1241d6[_0xd565('0x33')]['id'];}if(_0x1241d6['body'][_0xd565('0x7e')]){_0x3bdfff=path[_0xd565('0x78')](config['root'],'server/files/chat/upload/',util[_0xd565('0x7f')]('transcript-%s.txt',Date[_0xd565('0x80')]()));_0x1241d6[_0xd565('0x33')]['pathTranscript']=_0x3bdfff;}return db[_0xd565('0x38')][_0xd565('0x4b')]({'where':{'id':_0x1241d6[_0xd565('0x3f')]['id']},'include':[{'model':db[_0xd565('0x62')],'as':'Messages','include':[{'model':db[_0xd565('0x81')],'as':'User'}]}]})[_0xd565('0x19')](handleEntityNotFound(_0x22c905,null))[_0xd565('0x19')](saveUpdates(_0x1241d6[_0xd565('0x33')],null))['then'](function(_0x16605b){if(_0x16605b){_0x14ba71=_0x16605b;return db[_0xd565('0x4d')][_0xd565('0x4b')]({'where':{'id':_0x14ba71[_0xd565('0x82')]}});}})[_0xd565('0x19')](function(_0x540599){if(_0x540599){_0x580cc8=_0x540599;return db[_0xd565('0x66')][_0xd565('0x4b')]({'where':{'id':_0x14ba71[_0xd565('0x83')]}});}})['then'](function(_0x31d519){if(_0x31d519){if(_0x3bdfff){var _0x57e0bd=null;for(var _0x2c40ec=0x1;_0x2c40ec<_0x14ba71[_0xd565('0x84')]['length'];++_0x2c40ec){_0x57e0bd=_0x14ba71['Messages'][_0x2c40ec];var _0x51cdf2=_0x57e0bd[_0xd565('0x6b')]?util[_0xd565('0x7f')](_0xd565('0x85'),_0x580cc8[_0xd565('0x86')],_0x57e0bd['UserId']):_0xd565('0x87');var _0x585d90=_0x1241d6['body'][_0xd565('0x88')]||util[_0xd565('0x7f')](_0xd565('0x85'),_0xd565('0x89'),_0x57e0bd[_0xd565('0x83')]);switch(_0x580cc8[_0xd565('0x8a')]){case _0xd565('0x8b'):_0x51cdf2=_0x57e0bd[_0xd565('0x6b')]?util[_0xd565('0x7f')](_0xd565('0x85'),_0x580cc8['agentAlias'],_0x57e0bd[_0xd565('0x6b')]):_0xd565('0x87');break;case _0xd565('0x8c'):_0x51cdf2=_0x57e0bd['UserId']?_0x57e0bd[_0xd565('0x81')][_0xd565('0x8d')]||_0x57e0bd[_0xd565('0x81')]['fullname']:_0xd565('0x87');break;case _0xd565('0x8e'):_0x51cdf2=_0x57e0bd[_0xd565('0x6b')]?_0x57e0bd[_0xd565('0x81')][_0xd565('0x54')]:_0xd565('0x87');break;default:_0x51cdf2=_0x57e0bd['UserId']?util['format'](_0xd565('0x85'),_0x580cc8[_0xd565('0x86')],_0x57e0bd[_0xd565('0x6b')]):'System';}var _0x4bf091=util['format'](_0xd565('0x8f'),moment(_0x57e0bd[_0xd565('0x90')])[_0xd565('0x7f')]('MM/DD/YYYY\x20HH:mm:ss'),_0x57e0bd[_0xd565('0x91')]==='in'?_0x585d90:_0x51cdf2,_0x57e0bd[_0xd565('0x33')]);if(!_0x57e0bd[_0xd565('0x92')]){fs['appendFileSync'](_0x3bdfff,_0x4bf091);}}return db[_0xd565('0x93')][_0xd565('0x4e')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd565('0x94'),'raw':!![]}]}]});}}})[_0xd565('0x19')](function(_0x8b0270){if(!_0x8b0270||!_0x8b0270[_0xd565('0x95')]||!_0x1241d6[_0xd565('0x33')])return _0x14ba71;var _0x26ebf9=_0x8b0270[_0xd565('0x96')]();return respondWithRpcPromise(_0xd565('0x97'),_0xd565('0x98'),{'account':_0x26ebf9,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x8b0270[_0xd565('0x30')],_0x8b0270[_0xd565('0x57')]||_0x8b0270['Smtp']['user']),'to':_0x1241d6[_0xd565('0x33')][_0xd565('0x7e')],'subject':'Mail\x20Transcript','text':util[_0xd565('0x7f')](_0xd565('0x99'),_0x1241d6[_0xd565('0x33')][_0xd565('0x7e')]),'attachments':[{'path':_0x3bdfff}]}})[_0xd565('0x19')](function(){return _0x14ba71;})['catch'](function(_0x2e6487){logger['error'](_0x2e6487);});})[_0xd565('0x19')](respondWithStatusCode(_0x22c905,0xc8))[_0xd565('0x23')](handleError(_0x22c905,null));};exports['addMessage']=function(_0x20685c,_0x4d42cd){return db[_0xd565('0x62')]['find']({'where':{'id':_0x20685c['params']['id']}})[_0xd565('0x19')](handleEntityNotFound(_0x4d42cd,null))[_0xd565('0x19')](function(_0x4c3315){if(_0x4c3315){return _0x4c3315[_0xd565('0x9a')](_0x20685c['body'][_0xd565('0x9b')],_['omit'](_0x20685c[_0xd565('0x33')],['ids','id'])||{});}})[_0xd565('0x19')](respondWithResult(_0x4d42cd,null))[_0xd565('0x23')](handleError(_0x4d42cd,null));};exports[_0xd565('0x9c')]=function(_0x20e9f0,_0x597174){var _0x4231d6={'raw':![],'where':{}};var _0x34b8cb={};var _0x25eec3={'count':0x0,'rows':[]};return db[_0xd565('0x38')][_0xd565('0x4e')]({'where':{'id':_0x20e9f0[_0xd565('0x3f')]['id']}})[_0xd565('0x19')](handleEntityNotFound(_0x597174,null))[_0xd565('0x19')](function(_0x24bc8b){if(_0x24bc8b){_0x34b8cb['model']=_[_0xd565('0x41')](db['ChatMessage'][_0xd565('0x39')]);_0x34b8cb['query']=_[_0xd565('0x41')](_0x20e9f0[_0xd565('0x42')]);_0x34b8cb[_0xd565('0x43')]=_['intersection'](_0x34b8cb[_0xd565('0x40')],_0x34b8cb[_0xd565('0x42')]);_0x4231d6[_0xd565('0x45')]=_['intersection'](_0x34b8cb['model'],qs[_0xd565('0x46')](_0x20e9f0[_0xd565('0x42')][_0xd565('0x46')]));_0x4231d6['attributes']=_0x4231d6[_0xd565('0x45')][_0xd565('0x47')]?_0x4231d6[_0xd565('0x45')]:_0x34b8cb['model'];if(!_0x20e9f0[_0xd565('0x42')][_0xd565('0x9d')](_0xd565('0x9e'))){_0x4231d6['limit']=qs[_0xd565('0x2b')](_0x20e9f0[_0xd565('0x42')][_0xd565('0x2b')]);_0x4231d6['offset']=qs[_0xd565('0x28')](_0x20e9f0['query'][_0xd565('0x28')]);}_0x4231d6['order']=qs[_0xd565('0x9f')](_0x20e9f0['query']['sort']);_0x4231d6[_0xd565('0xa0')]=qs[_0xd565('0x43')](_[_0xd565('0xa1')](_0x20e9f0[_0xd565('0x42')],_0x34b8cb[_0xd565('0x43')]));_0x4231d6[_0xd565('0xa0')][_0xd565('0xa2')]=_0x24bc8b['id'];if(_0x20e9f0[_0xd565('0x42')][_0xd565('0xa3')]){_0x4231d6[_0xd565('0xa0')]=_['merge'](_0x4231d6[_0xd565('0xa0')],{'$or':_['map'](_0x4231d6[_0xd565('0x45')],function(_0x1a626c){var _0x3e2c7b={};_0x3e2c7b[_0x1a626c]={'$like':'%'+_0x20e9f0[_0xd565('0x42')][_0xd565('0xa3')]+'%'};return _0x3e2c7b;})});}if(_0x20e9f0['query'][_0xd565('0xa4')]){var _0x145463=_0x20e9f0[_0xd565('0x42')]['$gte'][_0xd565('0xa5')](',');var _0x9c583={};_0x9c583[_0x145463[0x0]]={'$gte':moment(_0x145463[0x1])[_0xd565('0x7f')](_0xd565('0xa6'))};_0x4231d6['where']=_[_0xd565('0x32')](_0x4231d6[_0xd565('0xa0')],_0x9c583);}_0x4231d6=_[_0xd565('0x32')]({},_0x4231d6,_0x20e9f0['options']);return db[_0xd565('0x62')][_0xd565('0x2a')]({'where':_0x4231d6[_0xd565('0xa0')]})[_0xd565('0x19')](function(_0x28197f){_0x25eec3[_0xd565('0x2a')]=_0x28197f;if(_0x20e9f0['query'][_0xd565('0x48')]){_0x4231d6[_0xd565('0x49')]=[{'all':!![]}];}return db[_0xd565('0x62')][_0xd565('0x3d')](_0x4231d6);})[_0xd565('0x19')](function(_0x545704){_0x25eec3[_0xd565('0xa7')]=_0x545704;return _0x25eec3;});}})['then'](respondWithFilteredResult(_0x597174,_0x4231d6))[_0xd565('0x23')](handleError(_0x597174,null));};exports['getMyMessages']=function(_0x7a10b8,_0x32ad28){var _0x43daf5={'where':{}},_0xf4f022={},_0x16da94={'count':0x0,'rows':[]};return db[_0xd565('0x38')][_0xd565('0x4e')]({'where':{'id':_0x7a10b8[_0xd565('0x3f')]['id']}})['then'](handleEntityNotFound(_0x32ad28,null))[_0xd565('0x19')](function(_0x302b7d){if(_0x302b7d){_0xf4f022[_0xd565('0x40')]=_[_0xd565('0x41')](db[_0xd565('0x62')][_0xd565('0x39')]);_0xf4f022[_0xd565('0x42')]=_['keys'](_0x7a10b8[_0xd565('0x42')]);_0xf4f022['filters']=_['intersection'](_0xf4f022[_0xd565('0x40')],_0xf4f022[_0xd565('0x42')]);_0x43daf5[_0xd565('0x45')]=_[_0xd565('0x44')](_0xf4f022[_0xd565('0x40')],qs[_0xd565('0x46')](_0x7a10b8[_0xd565('0x42')][_0xd565('0x46')]));_0x43daf5[_0xd565('0x45')]=_0x43daf5[_0xd565('0x45')]['length']?_0x43daf5[_0xd565('0x45')]:_0xf4f022[_0xd565('0x40')];if(!_0x7a10b8[_0xd565('0x42')][_0xd565('0x9d')](_0xd565('0x9e'))){_0x43daf5[_0xd565('0x2b')]=qs['limit'](_0x7a10b8[_0xd565('0x42')]['limit']);_0x43daf5['offset']=qs[_0xd565('0x28')](_0x7a10b8[_0xd565('0x42')][_0xd565('0x28')]);}_0x43daf5[_0xd565('0xa8')]=qs[_0xd565('0x9f')](_0x7a10b8[_0xd565('0x42')][_0xd565('0x9f')]);_0x43daf5[_0xd565('0xa0')]=qs[_0xd565('0x43')](_[_0xd565('0xa1')](_0x7a10b8[_0xd565('0x42')],_0xf4f022[_0xd565('0x43')]));_0x43daf5[_0xd565('0xa0')]['ChatInteractionId']=_0x302b7d['id'];if(_0x7a10b8[_0xd565('0x42')][_0xd565('0xa3')]){_0x43daf5[_0xd565('0xa0')]=_[_0xd565('0x32')](_0x43daf5[_0xd565('0xa0')],{'$or':_['map'](_0x43daf5[_0xd565('0x45')],function(_0x1153da){var _0x3a2e68={};_0x3a2e68[_0x1153da]={'$like':'%'+_0x7a10b8[_0xd565('0x42')][_0xd565('0xa3')]+'%'};return _0x3a2e68;})});}_0x43daf5[_0xd565('0xa0')]['secret']=![];if(_0x7a10b8[_0xd565('0x42')]['id']){_0x43daf5[_0xd565('0xa0')]['id']={'$gt':_0x7a10b8[_0xd565('0x42')]['id']};}_0x43daf5=_[_0xd565('0x32')]({},_0x43daf5,_0x7a10b8[_0xd565('0xa9')]);return db[_0xd565('0x62')][_0xd565('0x2a')]({'where':_0x43daf5[_0xd565('0xa0')]})[_0xd565('0x19')](function(_0x5183de){_0x16da94['count']=_0x5183de;_0x43daf5[_0xd565('0x49')]=[];if(_0x7a10b8[_0xd565('0x42')]['includeAgent']){_0x43daf5[_0xd565('0x49')][_0xd565('0xaa')]({'model':db[_0xd565('0x81')],'as':_0xd565('0x81'),'attributes':['id',_0xd565('0x54'),'alias']});}if(_0x7a10b8['query']['includeAll']){_0x43daf5[_0xd565('0x49')]=[{'all':!![]}];}return db[_0xd565('0x62')]['findAll'](_0x43daf5);})[_0xd565('0x19')](function(_0x585176){_0x16da94[_0xd565('0xa7')]=_0x585176;return _0x16da94;});}})[_0xd565('0x19')](respondWithFilteredResult(_0x32ad28,_0x43daf5))[_0xd565('0x23')](handleError(_0x32ad28,null));};exports[_0xd565('0xab')]=function(_0x209f41,_0x502e70){return db[_0xd565('0x38')]['find']({'where':{'id':_0x209f41['params']['id']}})['then'](handleEntityNotFound(_0x502e70,null))[_0xd565('0x19')](function(_0x1ff1cf){if(_0x1ff1cf){return _0x1ff1cf['setTags'](_0x209f41[_0xd565('0x33')]['ids'],_[_0xd565('0xac')](_0x209f41[_0xd565('0x33')],[_0xd565('0x9b'),'id'])||{})[_0xd565('0xad')](function(){return db[_0xd565('0xae')][_0xd565('0x3d')]({'attributes':['id',_0xd565('0x30'),_0xd565('0xaf')],'where':{'id':_0x209f41[_0xd565('0x33')][_0xd565('0x9b')]}});})['then'](function(_0x52797d){socket['emit'](_0xd565('0xb0'),{'id':Number(_0x209f41[_0xd565('0x3f')]['id']),'tags':_0x52797d||[]});return{'id':Number(_0x209f41[_0xd565('0x3f')]['id']),'tags':_0x52797d||[]};});}})[_0xd565('0x19')](respondWithResult(_0x502e70,null))[_0xd565('0x23')](handleError(_0x502e70,null));};exports[_0xd565('0xb1')]=function(_0x184fbe,_0x511445){return db['ChatInteraction']['find']({'where':{'id':_0x184fbe['params']['id']}})['then'](handleEntityNotFound(_0x511445,null))[_0xd565('0x19')](function(_0x3b15b6){if(_0x3b15b6){return _0x3b15b6[_0xd565('0xb1')](_0x184fbe[_0xd565('0x42')][_0xd565('0x9b')]);}})[_0xd565('0x19')](respondWithStatusCode(_0x511445,null))[_0xd565('0x23')](handleError(_0x511445,null));};exports[_0xd565('0x7c')]=function(_0x2fd4b7,_0x3e5503){var _0x42861e=moment()['unix']()['toString']();var _0x422e8b=path[_0xd565('0x78')](config[_0xd565('0x79')],_0xd565('0xb2'),'files',_0xd565('0xb3'));var _0x5a511b=path[_0xd565('0x78')](config[_0xd565('0x79')],_0xd565('0xb2'),_0xd565('0xb4'),_0xd565('0xb5'));var _0x2dd0ec=path[_0xd565('0x78')](_0x422e8b,_0x42861e);var _0x316dbf=util['format'](_0xd565('0xb6'),_0x2fd4b7['params']['id'],_0x42861e);var _0x13c03f=path[_0xd565('0x78')](_0x422e8b,_0x316dbf);var _0x27306e=[];_0x27306e[_0xd565('0xaa')]({'model':db[_0xd565('0x81')],'as':_0xd565('0x81'),'attributes':['id',_0xd565('0x54')],'raw':!![]});_0x27306e[_0xd565('0xaa')]({'model':db[_0xd565('0x66')],'as':_0xd565('0x67'),'attributes':['id',_0xd565('0xb7'),_0xd565('0xb8')],'raw':!![]});if(_0x2fd4b7[_0xd565('0x42')][_0xd565('0xb5')]){_0x27306e[_0xd565('0xaa')]({'model':db[_0xd565('0x75')],'as':'Attachment','raw':!![]});}var _0x32487f=[{'model':db[_0xd565('0x62')],'as':'Messages','attributes':['id',_0xd565('0x33'),_0xd565('0x90'),_0xd565('0x91'),_0xd565('0x92'),_0xd565('0xb9')],'include':_0x27306e}];_0x32487f[_0xd565('0xaa')]({'model':db['ChatWebsite'],'as':_0xd565('0xba'),'attributes':['id','name']});_0x32487f[_0xd565('0xaa')]({'model':db[_0xd565('0x81')],'as':_0xd565('0xbb'),'attributes':['id',_0xd565('0x54')]});return db[_0xd565('0x38')][_0xd565('0x4b')]({'where':{'id':_0x2fd4b7[_0xd565('0x3f')]['id']},'include':_0x32487f})[_0xd565('0x19')](handleEntityNotFound(_0x3e5503,null))[_0xd565('0x19')](function(_0x411bb5){if(_0x411bb5){var _0x21fe52=_0x411bb5[_0xd565('0xbc')]({'plain':!![]});fs[_0xd565('0xbd')](_0x2dd0ec);var _0x473069={'channel':'Chat','account':_0x21fe52[_0xd565('0xba')][_0xd565('0x30')],'agent':_0x21fe52['Owner']?_0x21fe52[_0xd565('0xbb')][_0xd565('0x54')]:'N.A.','createdAt':moment(_0x21fe52[_0xd565('0x90')])[_0xd565('0x7f')](_0xd565('0xa6'))[_0xd565('0xbe')](),'closedAt':_0x21fe52[_0xd565('0x6c')]?moment(_0x21fe52[_0xd565('0xbf')])[_0xd565('0x7f')](_0xd565('0xa6'))['toString']():'','disposition':_0x21fe52['disposition'],'chatInfo':{'browser':_0x21fe52[_0xd565('0xc0')],'os':_0x21fe52[_0xd565('0xc1')],'referer':_0x21fe52[_0xd565('0xc2')],'customerIp':_0x21fe52[_0xd565('0xc3')],'customerPort':_0x21fe52['customerPort']?_0x21fe52[_0xd565('0xc4')]:'N.A.'},'messages':_(_0x21fe52[_0xd565('0x84')])['tail']()['filter']({'secret':![]})[_0xd565('0xc5')](function(_0xe5fbd1){if(_0xe5fbd1[_0xd565('0x75')]){var _0x51d776=path[_0xd565('0x78')](_0x5a511b,_0xe5fbd1['Attachment']['basename']);if(fs[_0xd565('0xc6')](_0x51d776)){fs[_0xd565('0xc7')](_0x51d776)['pipe'](fs[_0xd565('0xc8')](path[_0xd565('0x78')](_0x2dd0ec,_0xe5fbd1[_0xd565('0x75')][_0xd565('0x70')])));}}return{'date':moment(_0xe5fbd1[_0xd565('0x90')])[_0xd565('0x7f')](_0xd565('0xa6'))[_0xd565('0xbe')](),'sender':_0xe5fbd1[_0xd565('0x91')]===_0xd565('0x61')?_0xe5fbd1[_0xd565('0x81')]?_0xe5fbd1[_0xd565('0x81')][_0xd565('0x54')]:_0xd565('0x87'):_0xe5fbd1['Contact'][_0xd565('0xb7')]+(_0xe5fbd1[_0xd565('0x67')][_0xd565('0xb8')]?'\x20'+_0xe5fbd1[_0xd565('0x67')]['lastName']:''),'body':_0xe5fbd1[_0xd565('0x75')]?_0xe5fbd1[_0xd565('0x75')][_0xd565('0x70')]:_0xe5fbd1['body'],'direction':_0xe5fbd1[_0xd565('0x91')]===_0xd565('0x61')?'A':'C','secret':_0xe5fbd1[_0xd565('0x92')],'read':_0xe5fbd1['read'],'attachment':_0xe5fbd1[_0xd565('0x75')]};})[_0xd565('0xc9')]()};return ejs['renderFile'](path[_0xd565('0x78')](config[_0xd565('0x79')],_0xd565('0xb2'),_0xd565('0xca'),_0xd565('0xcb')),{'interaction':_0x473069})[_0xd565('0x19')](function(_0x41a892){var _0x2971bc=path['join'](_0x2dd0ec,_0xd565('0xcc')+_0x21fe52['id']+'-'+_0x42861e+'.pdf');var _0x3a756b={'path':_0x2971bc,'channel':_0xd565('0xcd'),'interactionId':_0x21fe52['id']};return pdf[_0xd565('0xce')](_0x41a892,_0x3a756b);})['then'](function(){return new Promise(function(_0x2e9556,_0x306fa7){zipdir(_0x2dd0ec,{'saveTo':_0x13c03f},function(_0x5081ba,_0x47861b){if(_0x5081ba)return _0x306fa7(_0x5081ba);return _0x2e9556(_0x47861b);});})[_0xd565('0x19')](function(){return new BPromise(function(_0x339db1,_0x416ae2){rimraf(_0x2dd0ec,function(_0x4800ad){if(_0x4800ad)_0x416ae2(_0x4800ad);return _0x339db1();});});})[_0xd565('0x19')](function(){return _0x3e5503[_0xd565('0x7c')](_0x13c03f,_0x316dbf,function(_0x3d8420){if(_0x3d8420){logger[_0xd565('0x1f')](_0xd565('0xcf'),_0x3d8420);}else{fs[_0xd565('0xd0')](_0x13c03f);}});});});}else{return _0x3e5503[_0xd565('0x24')](0xc8);}})[_0xd565('0x23')](handleError(_0x3e5503,null));}; \ No newline at end of file +var _0x32d4=['findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooApiKey','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','vidaooMetadata','parse','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','CmContact','Contact','abandon','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','System','customer','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','SendMail','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','getMessages','filters','hasOwnProperty','nolimit','sort','where','filter','$gte','count','includeAll','rows','getMyMessages','order','pick','ChatInteractionId','push','addTags','setTags','omit','spread','findAll','color','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','read','Account','Owner','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','lastName','value','views','downloadInteraction.ejs','transcript-','err','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','Content-Range','update','destroy','then','name','render','merge','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','getOptions','chat','query','user','show','params','model','keys','intersection','attributes','fields','length','include','options','find','create','body','describe','createVidaooSession'];(function(_0x49a18a,_0x2f1f40){var _0x54d278=function(_0x32d7cf){while(--_0x32d7cf){_0x49a18a['push'](_0x49a18a['shift']());}};_0x54d278(++_0x2f1f40);}(_0x32d4,0x82));var _0x432d=function(_0xd08b7,_0xa23b89){_0xd08b7=_0xd08b7-0x0;var _0x10310b=_0x32d4[_0xd08b7];return _0x10310b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x432d('0x0'));var rp=require('request-promise');var moment=require(_0x432d('0x1'));var BPromise=require(_0x432d('0x2'));var Mustache=require(_0x432d('0x3'));var util=require(_0x432d('0x4'));var path=require(_0x432d('0x5'));var ejs=require(_0x432d('0x6'));var fs=require('fs');var _=require(_0x432d('0x7'));var Redis=require('ioredis');var interaction=require(_0x432d('0x8'));var qs=require(_0x432d('0x9'));var pdf=require(_0x432d('0xa'));var logger=require('../../config/logger')(_0x432d('0xb'));var config=require(_0x432d('0xc'));var db=require(_0x432d('0xd'))['db'];config[_0x432d('0xe')]=_[_0x432d('0xf')](config[_0x432d('0xe')],{'host':_0x432d('0x10'),'port':0x18eb});var socket=require(_0x432d('0x11'))(new Redis(config[_0x432d('0xe')]));require('./chatInteraction.socket')[_0x432d('0x12')](socket);var jayson=require(_0x432d('0x13'));var client=jayson[_0x432d('0x14')]['http']({'port':0x232b});var client9004=jayson['client'][_0x432d('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x5f0c43,_0x4b050b,_0x3d899c,_0x2be426){return new BPromise(function(_0x1d51c0,_0xd0324b){var _0xe863be=_0x2be426||client;return _0xe863be[_0x432d('0x16')](_0x5f0c43,_0x3d899c)['then'](function(_0x4d2b72){logger[_0x432d('0x17')](_0x432d('0x18'),_0x4b050b,'request\x20sent');logger[_0x432d('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4b050b,'request\x20sent',JSON[_0x432d('0x1a')](_0x4d2b72));if(_0x4d2b72[_0x432d('0x1b')]){if(_0x4d2b72[_0x432d('0x1b')]['code']===0x1f4){logger[_0x432d('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x4b050b,_0x4d2b72[_0x432d('0x1b')][_0x432d('0x1c')]);return _0xd0324b(_0x4d2b72['error'][_0x432d('0x1c')]);}logger[_0x432d('0x1b')](_0x432d('0x18'),_0x4b050b,_0x4d2b72[_0x432d('0x1b')][_0x432d('0x1c')]);return _0x1d51c0(_0x4d2b72['error']['message']);}else{logger[_0x432d('0x17')](_0x432d('0x18'),_0x4b050b,_0x432d('0x1d'));_0x1d51c0(_0x4d2b72[_0x432d('0x1e')][_0x432d('0x1c')]);}})[_0x432d('0x1f')](function(_0x2218ff){logger[_0x432d('0x1b')](_0x432d('0x18'),_0x4b050b,_0x2218ff);_0xd0324b(_0x2218ff);});});}function respondWithStatusCode(_0x1c317d,_0x59a68c){_0x59a68c=_0x59a68c||0xcc;return function(_0x2d2a9b){if(_0x2d2a9b){return _0x1c317d[_0x432d('0x20')](_0x59a68c);}return _0x1c317d[_0x432d('0x21')](_0x59a68c)[_0x432d('0x22')]();};}function respondWithResult(_0x1e9247,_0xa76f36){_0xa76f36=_0xa76f36||0xc8;return function(_0x115505){if(_0x115505){return _0x1e9247[_0x432d('0x21')](_0xa76f36)[_0x432d('0x23')](_0x115505);}};}function respondWithFilteredResult(_0x31c619,_0xd5049f){return function(_0x38224a){if(_0x38224a){var _0x45709a=typeof _0xd5049f[_0x432d('0x24')]===_0x432d('0x25')&&typeof _0xd5049f[_0x432d('0x26')]===_0x432d('0x25');var _0x504738=_0x38224a['count'];var _0x3cefaf=_0x45709a?0x0:_0xd5049f['offset'];var _0x5053cb=_0x45709a?_0x38224a['count']:_0xd5049f[_0x432d('0x24')]+_0xd5049f[_0x432d('0x26')];var _0x431d5b;if(_0x5053cb>=_0x504738){_0x5053cb=_0x504738;_0x431d5b=0xc8;}else{_0x431d5b=0xce;}_0x31c619[_0x432d('0x21')](_0x431d5b);return _0x31c619['set'](_0x432d('0x27'),_0x3cefaf+'-'+_0x5053cb+'/'+_0x504738)[_0x432d('0x23')](_0x38224a);}return null;};}function saveUpdates(_0x47accb){return function(_0x4f6117){if(_0x4f6117){return _0x4f6117[_0x432d('0x28')](_0x47accb)['then'](function(_0xb0d98){return _0xb0d98;});}return null;};}function removeEntity(_0x10d9a1){return function(_0x7dc9ef){if(_0x7dc9ef){return _0x7dc9ef[_0x432d('0x29')]()[_0x432d('0x2a')](function(){_0x10d9a1[_0x432d('0x21')](0xcc)[_0x432d('0x22')]();});}};}function handleEntityNotFound(_0x13bc73){return function(_0x46ad86){if(!_0x46ad86){_0x13bc73['sendStatus'](0x194);}return _0x46ad86;};}function handleError(_0x1b783f,_0x442e43){_0x442e43=_0x442e43||0x1f4;return function(_0x6dc3c3){logger[_0x432d('0x1b')](_0x6dc3c3['stack']);if(_0x6dc3c3[_0x432d('0x2b')]){delete _0x6dc3c3['name'];}_0x1b783f[_0x432d('0x21')](_0x442e43)['send'](_0x6dc3c3);};}function getMustacheRender(_0x1bf603,_0x21e97c){return Mustache[_0x432d('0x2c')](_0x1bf603,_[_0x432d('0x2d')](_0x21e97c['body'],{'contact':_0x21e97c[_0x432d('0x2e')],'message':_0x21e97c[_0x432d('0x1c')],'agent':_0x21e97c[_0x432d('0x2f')],'interaction':_0x21e97c[_0x432d('0x30')],'account':_0x21e97c[_0x432d('0x31')]}))||'';}exports[_0x432d('0x32')]=function(_0x45c73c,_0x368deb){var _0x5ed556={};var _0x5322be=_[_0x432d('0x33')](db[_0x432d('0x34')][_0x432d('0x35')],function(_0x3f7581){return{'name':_0x3f7581[_0x432d('0x36')],'type':_0x3f7581['type']['key']};});_0x5ed556=qs[_0x432d('0x37')](_0x5322be,_0x45c73c);return interaction['findAll'](_0x432d('0x38'),_0x45c73c[_0x432d('0x39')],_0x45c73c[_0x432d('0x3a')],_0x5ed556,_0x5322be)[_0x432d('0x2a')](respondWithFilteredResult(_0x368deb,_0x5ed556))[_0x432d('0x1f')](handleError(_0x368deb,null));};exports[_0x432d('0x3b')]=function(_0x32f5de,_0x41e7dd){var _0x4427b9={'raw':![],'where':{'id':_0x32f5de[_0x432d('0x3c')]['id']}},_0x4a0606={};_0x4a0606[_0x432d('0x3d')]=_[_0x432d('0x3e')](db[_0x432d('0x34')][_0x432d('0x35')]);_0x4a0606[_0x432d('0x39')]=_[_0x432d('0x3e')](_0x32f5de[_0x432d('0x39')]);_0x4a0606['filters']=_[_0x432d('0x3f')](_0x4a0606['model'],_0x4a0606[_0x432d('0x39')]);_0x4427b9[_0x432d('0x40')]=_[_0x432d('0x3f')](_0x4a0606['model'],qs[_0x432d('0x41')](_0x32f5de[_0x432d('0x39')][_0x432d('0x41')]));_0x4427b9[_0x432d('0x40')]=_0x4427b9[_0x432d('0x40')][_0x432d('0x42')]?_0x4427b9[_0x432d('0x40')]:_0x4a0606[_0x432d('0x3d')];if(_0x32f5de[_0x432d('0x39')]['includeAll']){_0x4427b9[_0x432d('0x43')]=[{'all':!![]}];}_0x4427b9=_['merge']({},_0x4427b9,_0x32f5de[_0x432d('0x44')]);return db['ChatInteraction'][_0x432d('0x45')](_0x4427b9)[_0x432d('0x2a')](handleEntityNotFound(_0x41e7dd,null))[_0x432d('0x2a')](respondWithResult(_0x41e7dd,null))[_0x432d('0x1f')](handleError(_0x41e7dd,null));};exports[_0x432d('0x46')]=function(_0x5ba360,_0x12534a){return db['ChatInteraction']['create'](_0x5ba360[_0x432d('0x47')],{})[_0x432d('0x2a')](respondWithResult(_0x12534a,0xc9))[_0x432d('0x1f')](handleError(_0x12534a,null));};exports[_0x432d('0x28')]=function(_0x415234,_0x450ec0){if(_0x415234[_0x432d('0x47')]['id']){delete _0x415234[_0x432d('0x47')]['id'];}return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x415234[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x450ec0,null))[_0x432d('0x2a')](saveUpdates(_0x415234[_0x432d('0x47')],null))[_0x432d('0x2a')](respondWithResult(_0x450ec0,null))[_0x432d('0x1f')](handleError(_0x450ec0,null));};exports[_0x432d('0x29')]=function(_0x5ccde7,_0x70460c){return db['ChatInteraction'][_0x432d('0x45')]({'where':{'id':_0x5ccde7['params']['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x70460c,null))[_0x432d('0x2a')](removeEntity(_0x70460c,null))[_0x432d('0x1f')](handleError(_0x70460c,null));};exports[_0x432d('0x48')]=function(_0x167151,_0x4615f5){return db[_0x432d('0x34')]['describe']()[_0x432d('0x2a')](respondWithResult(_0x4615f5,null))[_0x432d('0x1f')](handleError(_0x4615f5,null));};exports[_0x432d('0x49')]=function(_0x4d56ce,_0x2911e2){var _0xa2e045=_0x4d56ce['params']['id'];var _0x260e44;var _0xbd9b11;var _0x3ed02d;return db[_0x432d('0x34')][_0x432d('0x4a')]({'where':{'id':_0xa2e045}})[_0x432d('0x2a')](function(_0xc58515){_0x260e44=_0xc58515;return db[_0x432d('0x4b')][_0x432d('0x4a')]({'where':{'id':_0xc58515[_0x432d('0x4c')]},'attributes':['id','vidaooApiKey',_0x432d('0x4d'),_0x432d('0x4e'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x432d('0x2a')](function(_0x2d98db){if(_0x2d98db&&_0x2d98db[_0x432d('0x4f')]&&_0x2d98db[_0x432d('0x4d')]){_0xbd9b11=_0x2d98db;var _0x1da43d={'interaction':{'id':_0xa2e045},'agent':{'id':_0x4d56ce[_0x432d('0x3a')]['id'],'name':_0x4d56ce[_0x432d('0x3a')][_0x432d('0x2b')],'fullname':_0x4d56ce[_0x432d('0x3a')][_0x432d('0x50')],'email':_0x4d56ce[_0x432d('0x3a')][_0x432d('0x51')]},'contact':_0x4d56ce[_0x432d('0x47')][_0x432d('0x2e')],'account':_0x4d56ce[_0x432d('0x47')][_0x432d('0x31')]};var _0x36e562={'rejectUnauthorized':![],'method':_0x432d('0x52'),'url':_0x432d('0x53'),'headers':{'X-APIKEY':_0x2d98db[_0x432d('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4d56ce['user'][_0x432d('0x51')]],'buttons':null,'topic':_0xbd9b11[_0x432d('0x4e')],'note':_['isNull'](_0xbd9b11[_0x432d('0x54')])?null:getMustacheRender(_0xbd9b11[_0x432d('0x54')],_0x1da43d),'metadata':null},'redirect':_0x432d('0x55'),'json':!![]};try{if(!_[_0x432d('0x56')](_0xbd9b11['vidaooMetadata'])){var _0x2d5345=getMustacheRender(_0xbd9b11[_0x432d('0x57')],_0x1da43d);var _0x4e812e=JSON[_0x432d('0x58')](_0x2d5345);_0x36e562[_0x432d('0x47')]['metadata']=_0x4e812e;}}catch(_0x2cfce2){throw new db[(_0x432d('0x59'))][(_0x432d('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x36e562);}else{throw new db['Sequelize'][(_0x432d('0x5a'))](_0x432d('0x5b'));}})[_0x432d('0x2a')](function(_0x3b7925){_0x3ed02d=_0x3b7925;if(_0x3ed02d['id']){var _0x4682a2={'body':_0x3ed02d[_0x432d('0x5c')],'ChatWebsiteId':_0xbd9b11['id'],'ChatInteractionId':_0x260e44['id'],'direction':_0x432d('0x5d'),'UserId':_0x4d56ce[_0x432d('0x3a')]['id']};return db[_0x432d('0x5e')][_0x432d('0x46')](_0x4682a2,{});}else{throw new db[(_0x432d('0x59'))][(_0x432d('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x432d('0x2a')](function(){return _0x260e44['updateAttributes']({'vidaooSessionId':_0x3ed02d['id']});})[_0x432d('0x2a')](respondWithResult(_0x2911e2,null))['catch'](handleError(_0x2911e2,null));};exports[_0x432d('0x5f')]=function(_0x4609d8,_0x3ba2fe){if(_0x4609d8[_0x432d('0x47')]['id']){delete _0x4609d8[_0x432d('0x47')]['id'];}return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x4609d8[_0x432d('0x3c')]['id']},'include':[{'model':db[_0x432d('0x60')],'as':_0x432d('0x61')}]})[_0x432d('0x2a')](handleEntityNotFound(_0x3ba2fe,null))[_0x432d('0x2a')](saveUpdates(_0x4609d8[_0x432d('0x47')],null))[_0x432d('0x2a')](respondWithResult(_0x3ba2fe,null))[_0x432d('0x1f')](handleError(_0x3ba2fe,null));};exports[_0x432d('0x62')]=function(_0x239f77,_0x493dbe){if(_0x239f77[_0x432d('0x47')]['id']){delete _0x239f77[_0x432d('0x47')]['id'];}return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x239f77[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](function(_0x286dc7){if(!_0x286dc7){logger[_0x432d('0x1b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x432d('0x62'),0x194,'entity\x20not\x20found');_0x493dbe['sendStatus'](0x194);}else{if(_0x286dc7[_0x432d('0x63')]){throw new db[(_0x432d('0x59'))][(_0x432d('0x5a'))](_0x432d('0x64'));}}return _0x286dc7;})[_0x432d('0x2a')](function(_0x1f440a){if(_0x1f440a){return _0x1f440a[_0x432d('0x28')]({'closed':_0x239f77[_0x432d('0x47')][_0x432d('0x65')],'disposition':_0x239f77['body']['disposition']})['then'](function(_0x5aa60c){return _0x5aa60c;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x432d('0x62'),_0x239f77[_0x432d('0x47')],client9004);})['then'](respondWithResult(_0x493dbe,null))[_0x432d('0x1f')](handleError(_0x493dbe,null));};exports[_0x432d('0x66')]=function(_0x3dd194,_0x3ef0cf){_0x3dd194[_0x432d('0x47')]['name']=_0x3dd194[_0x432d('0x67')][_0x432d('0x68')];_0x3dd194[_0x432d('0x47')][_0x432d('0x69')]=_0x3dd194[_0x432d('0x67')]['filename'];_0x3dd194['body']['type']=_0x3dd194[_0x432d('0x67')][_0x432d('0x6a')];return db[_0x432d('0x6b')]['create'](_0x3dd194[_0x432d('0x47')])[_0x432d('0x2a')](respondWithResult(_0x3ef0cf,0xc9))[_0x432d('0x1f')](handleError(_0x3ef0cf,null));};exports[_0x432d('0x6c')]=function(_0x197ec6,_0x56cae2){return db['ChatInteraction'][_0x432d('0x4a')]({'where':{'id':_0x197ec6[_0x432d('0x3c')]['id']},'raw':!![]})[_0x432d('0x2a')](handleEntityNotFound(_0x56cae2,null))[_0x432d('0x2a')](function(_0x2ad1a6){if(_0x2ad1a6){if(_0x2ad1a6[_0x432d('0x65')]){return _0x56cae2['status'](0x193)[_0x432d('0x23')]({'status':0x193,'message':_0x432d('0x6d')});}return db[_0x432d('0x6b')][_0x432d('0x4a')]({'where':{'id':_0x197ec6[_0x432d('0x39')]['attachId']},'raw':!![]})[_0x432d('0x2a')](handleEntityNotFound(_0x56cae2,null));}})[_0x432d('0x2a')](function(_0x5c4609){if(_0x5c4609){var _0x471233=_0x5c4609[_0x432d('0x6e')]!==null;var _0x46f51d=path[_0x432d('0x6f')](config[_0x432d('0x70')],_0x432d('0x71'));if(_0x471233){_0x46f51d=path[_0x432d('0x6f')](_0x46f51d,_0x432d('0x72'));}var _0x3a8e49=path[_0x432d('0x6f')](_0x46f51d,_0x5c4609[_0x432d('0x69')]);return _0x56cae2[_0x432d('0x73')](_0x3a8e49);}})[_0x432d('0x1f')](handleError(_0x56cae2,null));};exports[_0x432d('0x74')]=function(_0x40bd86,_0x8ad1c){var _0x274efd=null;var _0x6b2994=null;var _0x555024=null;if(_0x40bd86['body']['id']){delete _0x40bd86[_0x432d('0x47')]['id'];}if(_0x40bd86[_0x432d('0x47')][_0x432d('0x75')]){_0x555024=path[_0x432d('0x6f')](config['root'],'server/files/chat/upload/',util[_0x432d('0x76')](_0x432d('0x77'),Date[_0x432d('0x78')]()));_0x40bd86[_0x432d('0x47')][_0x432d('0x79')]=_0x555024;}return db[_0x432d('0x34')]['find']({'where':{'id':_0x40bd86[_0x432d('0x3c')]['id']},'include':[{'model':db[_0x432d('0x5e')],'as':_0x432d('0x7a'),'include':[{'model':db[_0x432d('0x7b')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x8ad1c,null))[_0x432d('0x2a')](saveUpdates(_0x40bd86[_0x432d('0x47')],null))['then'](function(_0x495489){if(_0x495489){_0x274efd=_0x495489;return db[_0x432d('0x4b')][_0x432d('0x45')]({'where':{'id':_0x274efd['ChatWebsiteId']}});}})[_0x432d('0x2a')](function(_0x2002bd){if(_0x2002bd){_0x6b2994=_0x2002bd;return db[_0x432d('0x60')][_0x432d('0x45')]({'where':{'id':_0x274efd[_0x432d('0x7c')]}});}})['then'](function(_0xbb7227){if(_0xbb7227){if(_0x555024){var _0xae2d39=null;for(var _0x2fe0a0=0x1;_0x2fe0a0<_0x274efd[_0x432d('0x7a')]['length'];++_0x2fe0a0){_0xae2d39=_0x274efd['Messages'][_0x2fe0a0];var _0x419778=_0xae2d39[_0x432d('0x63')]?util[_0x432d('0x76')](_0x432d('0x7d'),_0x6b2994[_0x432d('0x7e')],_0xae2d39[_0x432d('0x63')]):_0x432d('0x7f');var _0xaa18ff=_0x40bd86[_0x432d('0x47')][_0x432d('0x80')]||util[_0x432d('0x76')](_0x432d('0x7d'),'Visitor',_0xae2d39[_0x432d('0x7c')]);switch(_0x6b2994['agentIdentifier']){case _0x432d('0x81'):_0x419778=_0xae2d39['UserId']?util['format'](_0x432d('0x7d'),_0x6b2994[_0x432d('0x7e')],_0xae2d39[_0x432d('0x63')]):_0x432d('0x7f');break;case _0x432d('0x82'):_0x419778=_0xae2d39[_0x432d('0x63')]?_0xae2d39[_0x432d('0x7b')][_0x432d('0x83')]||_0xae2d39[_0x432d('0x7b')][_0x432d('0x50')]:_0x432d('0x7f');break;case'agent_fullname':_0x419778=_0xae2d39[_0x432d('0x63')]?_0xae2d39[_0x432d('0x7b')][_0x432d('0x50')]:_0x432d('0x7f');break;default:_0x419778=_0xae2d39[_0x432d('0x63')]?util['format'](_0x432d('0x7d'),_0x6b2994[_0x432d('0x7e')],_0xae2d39[_0x432d('0x63')]):'System';}var _0x7ab2f4=util[_0x432d('0x76')](_0x432d('0x84'),moment(_0xae2d39[_0x432d('0x85')])[_0x432d('0x76')](_0x432d('0x86')),_0xae2d39[_0x432d('0x87')]==='in'?_0xaa18ff:_0x419778,_0xae2d39[_0x432d('0x47')]);if(!_0xae2d39[_0x432d('0x88')]){fs[_0x432d('0x89')](_0x555024,_0x7ab2f4);}}return db[_0x432d('0x8a')][_0x432d('0x4a')]({'where':{'service':!![]},'include':[{'model':db[_0x432d('0x8b')],'as':_0x432d('0x8c'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x432d('0x2a')](function(_0x46a336){if(!_0x46a336||!_0x46a336['Smtp']||!_0x40bd86['body'])return _0x274efd;var _0x365946=_0x46a336[_0x432d('0x8d')]();return respondWithRpcPromise(_0x432d('0x8e'),_0x432d('0x8f'),{'account':_0x365946,'message':{'from':util[_0x432d('0x76')](_0x432d('0x90'),_0x46a336[_0x432d('0x2b')],_0x46a336[_0x432d('0x51')]||_0x46a336[_0x432d('0x8c')]['user']),'to':_0x40bd86['body'][_0x432d('0x75')],'subject':_0x432d('0x91'),'text':util[_0x432d('0x76')](_0x432d('0x92'),_0x40bd86[_0x432d('0x47')][_0x432d('0x75')]),'attachments':[{'path':_0x555024}]}})[_0x432d('0x2a')](function(){return _0x274efd;})[_0x432d('0x1f')](function(_0xfaecb6){logger[_0x432d('0x1b')](_0xfaecb6);});})['then'](respondWithStatusCode(_0x8ad1c,0xc8))['catch'](handleError(_0x8ad1c,null));};exports[_0x432d('0x93')]=function(_0x22acf0,_0x41dbee){return db[_0x432d('0x5e')][_0x432d('0x45')]({'where':{'id':_0x22acf0[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x41dbee,null))[_0x432d('0x2a')](function(_0x5ea083){if(_0x5ea083){return _0x5ea083[_0x432d('0x93')](_0x22acf0[_0x432d('0x47')][_0x432d('0x94')],_['omit'](_0x22acf0[_0x432d('0x47')],[_0x432d('0x94'),'id'])||{});}})[_0x432d('0x2a')](respondWithResult(_0x41dbee,null))['catch'](handleError(_0x41dbee,null));};exports[_0x432d('0x95')]=function(_0x43d40d,_0x36c674){var _0x21808a={'raw':![],'where':{}};var _0xead355={};var _0xf29485={'count':0x0,'rows':[]};return db[_0x432d('0x34')][_0x432d('0x4a')]({'where':{'id':_0x43d40d[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x36c674,null))['then'](function(_0x33cf6a){if(_0x33cf6a){_0xead355['model']=_[_0x432d('0x3e')](db[_0x432d('0x5e')][_0x432d('0x35')]);_0xead355['query']=_[_0x432d('0x3e')](_0x43d40d[_0x432d('0x39')]);_0xead355[_0x432d('0x96')]=_[_0x432d('0x3f')](_0xead355[_0x432d('0x3d')],_0xead355['query']);_0x21808a[_0x432d('0x40')]=_[_0x432d('0x3f')](_0xead355['model'],qs[_0x432d('0x41')](_0x43d40d[_0x432d('0x39')][_0x432d('0x41')]));_0x21808a[_0x432d('0x40')]=_0x21808a[_0x432d('0x40')][_0x432d('0x42')]?_0x21808a[_0x432d('0x40')]:_0xead355[_0x432d('0x3d')];if(!_0x43d40d[_0x432d('0x39')][_0x432d('0x97')](_0x432d('0x98'))){_0x21808a['limit']=qs[_0x432d('0x26')](_0x43d40d['query'][_0x432d('0x26')]);_0x21808a[_0x432d('0x24')]=qs[_0x432d('0x24')](_0x43d40d[_0x432d('0x39')]['offset']);}_0x21808a['order']=qs[_0x432d('0x99')](_0x43d40d[_0x432d('0x39')][_0x432d('0x99')]);_0x21808a[_0x432d('0x9a')]=qs['filters'](_['pick'](_0x43d40d['query'],_0xead355['filters']));_0x21808a[_0x432d('0x9a')]['ChatInteractionId']=_0x33cf6a['id'];if(_0x43d40d['query'][_0x432d('0x9b')]){_0x21808a['where']=_['merge'](_0x21808a[_0x432d('0x9a')],{'$or':_[_0x432d('0x33')](_0x21808a[_0x432d('0x40')],function(_0x48f337){var _0x3d8b6a={};_0x3d8b6a[_0x48f337]={'$like':'%'+_0x43d40d[_0x432d('0x39')][_0x432d('0x9b')]+'%'};return _0x3d8b6a;})});}if(_0x43d40d['query'][_0x432d('0x9c')]){var _0x29563c=_0x43d40d[_0x432d('0x39')]['$gte']['split'](',');var _0x56314f={};_0x56314f[_0x29563c[0x0]]={'$gte':moment(_0x29563c[0x1])[_0x432d('0x76')]('YYYY-MM-DD\x20HH:mm:ss')};_0x21808a[_0x432d('0x9a')]=_['merge'](_0x21808a[_0x432d('0x9a')],_0x56314f);}_0x21808a=_[_0x432d('0x2d')]({},_0x21808a,_0x43d40d['options']);return db['ChatMessage'][_0x432d('0x9d')]({'where':_0x21808a[_0x432d('0x9a')]})[_0x432d('0x2a')](function(_0x2218e5){_0xf29485[_0x432d('0x9d')]=_0x2218e5;if(_0x43d40d[_0x432d('0x39')][_0x432d('0x9e')]){_0x21808a[_0x432d('0x43')]=[{'all':!![]}];}return db[_0x432d('0x5e')]['findAll'](_0x21808a);})[_0x432d('0x2a')](function(_0x4603ca){_0xf29485[_0x432d('0x9f')]=_0x4603ca;return _0xf29485;});}})['then'](respondWithFilteredResult(_0x36c674,_0x21808a))[_0x432d('0x1f')](handleError(_0x36c674,null));};exports[_0x432d('0xa0')]=function(_0x3b631e,_0x1574b2){var _0x9681bd={'where':{}},_0x26e129={},_0xc62975={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x432d('0x4a')]({'where':{'id':_0x3b631e[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x1574b2,null))[_0x432d('0x2a')](function(_0x1f48c9){if(_0x1f48c9){_0x26e129['model']=_[_0x432d('0x3e')](db[_0x432d('0x5e')]['rawAttributes']);_0x26e129[_0x432d('0x39')]=_[_0x432d('0x3e')](_0x3b631e[_0x432d('0x39')]);_0x26e129['filters']=_[_0x432d('0x3f')](_0x26e129['model'],_0x26e129[_0x432d('0x39')]);_0x9681bd[_0x432d('0x40')]=_[_0x432d('0x3f')](_0x26e129['model'],qs[_0x432d('0x41')](_0x3b631e[_0x432d('0x39')][_0x432d('0x41')]));_0x9681bd[_0x432d('0x40')]=_0x9681bd[_0x432d('0x40')][_0x432d('0x42')]?_0x9681bd[_0x432d('0x40')]:_0x26e129[_0x432d('0x3d')];if(!_0x3b631e['query'][_0x432d('0x97')](_0x432d('0x98'))){_0x9681bd[_0x432d('0x26')]=qs[_0x432d('0x26')](_0x3b631e[_0x432d('0x39')][_0x432d('0x26')]);_0x9681bd[_0x432d('0x24')]=qs['offset'](_0x3b631e[_0x432d('0x39')][_0x432d('0x24')]);}_0x9681bd[_0x432d('0xa1')]=qs[_0x432d('0x99')](_0x3b631e[_0x432d('0x39')]['sort']);_0x9681bd[_0x432d('0x9a')]=qs['filters'](_[_0x432d('0xa2')](_0x3b631e[_0x432d('0x39')],_0x26e129[_0x432d('0x96')]));_0x9681bd[_0x432d('0x9a')][_0x432d('0xa3')]=_0x1f48c9['id'];if(_0x3b631e[_0x432d('0x39')]['filter']){_0x9681bd[_0x432d('0x9a')]=_[_0x432d('0x2d')](_0x9681bd[_0x432d('0x9a')],{'$or':_[_0x432d('0x33')](_0x9681bd[_0x432d('0x40')],function(_0x31342f){var _0x547e59={};_0x547e59[_0x31342f]={'$like':'%'+_0x3b631e[_0x432d('0x39')]['filter']+'%'};return _0x547e59;})});}_0x9681bd[_0x432d('0x9a')][_0x432d('0x88')]=![];if(_0x3b631e[_0x432d('0x39')]['id']){_0x9681bd[_0x432d('0x9a')]['id']={'$gt':_0x3b631e[_0x432d('0x39')]['id']};}_0x9681bd=_['merge']({},_0x9681bd,_0x3b631e[_0x432d('0x44')]);return db['ChatMessage'][_0x432d('0x9d')]({'where':_0x9681bd[_0x432d('0x9a')]})[_0x432d('0x2a')](function(_0x84ff3d){_0xc62975[_0x432d('0x9d')]=_0x84ff3d;_0x9681bd[_0x432d('0x43')]=[];if(_0x3b631e['query']['includeAgent']){_0x9681bd[_0x432d('0x43')][_0x432d('0xa4')]({'model':db['User'],'as':_0x432d('0x7b'),'attributes':['id',_0x432d('0x50'),_0x432d('0x83')]});}if(_0x3b631e[_0x432d('0x39')][_0x432d('0x9e')]){_0x9681bd[_0x432d('0x43')]=[{'all':!![]}];}return db[_0x432d('0x5e')]['findAll'](_0x9681bd);})[_0x432d('0x2a')](function(_0x1c05ea){_0xc62975[_0x432d('0x9f')]=_0x1c05ea;return _0xc62975;});}})[_0x432d('0x2a')](respondWithFilteredResult(_0x1574b2,_0x9681bd))[_0x432d('0x1f')](handleError(_0x1574b2,null));};exports[_0x432d('0xa5')]=function(_0x1bd9e0,_0x5b4cd3){return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x1bd9e0[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x5b4cd3,null))[_0x432d('0x2a')](function(_0x106eb0){if(_0x106eb0){return _0x106eb0[_0x432d('0xa6')](_0x1bd9e0['body'][_0x432d('0x94')],_[_0x432d('0xa7')](_0x1bd9e0[_0x432d('0x47')],[_0x432d('0x94'),'id'])||{})[_0x432d('0xa8')](function(){return db['Tag'][_0x432d('0xa9')]({'attributes':['id',_0x432d('0x2b'),_0x432d('0xaa')],'where':{'id':_0x1bd9e0[_0x432d('0x47')][_0x432d('0x94')]}});})[_0x432d('0x2a')](function(_0xeb0f50){socket['emit'](_0x432d('0xab'),{'id':Number(_0x1bd9e0[_0x432d('0x3c')]['id']),'tags':_0xeb0f50||[]});return{'id':Number(_0x1bd9e0[_0x432d('0x3c')]['id']),'tags':_0xeb0f50||[]};});}})[_0x432d('0x2a')](respondWithResult(_0x5b4cd3,null))['catch'](handleError(_0x5b4cd3,null));};exports[_0x432d('0xac')]=function(_0x2c1ec9,_0x3f2d98){return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x2c1ec9[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x3f2d98,null))[_0x432d('0x2a')](function(_0x361563){if(_0x361563){return _0x361563[_0x432d('0xac')](_0x2c1ec9[_0x432d('0x39')][_0x432d('0x94')]);}})[_0x432d('0x2a')](respondWithStatusCode(_0x3f2d98,null))[_0x432d('0x1f')](handleError(_0x3f2d98,null));};exports[_0x432d('0x73')]=function(_0xf6f32,_0xe985b6){var _0x579ef0=moment()['unix']()['toString']();var _0xa5cf4b=path[_0x432d('0x6f')](config['root'],_0x432d('0xad'),_0x432d('0xae'),_0x432d('0xaf'));var _0x54583b=path[_0x432d('0x6f')](config['root'],_0x432d('0xad'),'files',_0x432d('0xb0'));var _0x16a575=path[_0x432d('0x6f')](_0xa5cf4b,_0x579ef0);var _0x5ec41c=util['format'](_0x432d('0xb1'),_0xf6f32[_0x432d('0x3c')]['id'],_0x579ef0);var _0x943af4=path[_0x432d('0x6f')](_0xa5cf4b,_0x5ec41c);var _0x57892e=[];_0x57892e[_0x432d('0xa4')]({'model':db[_0x432d('0x7b')],'as':_0x432d('0x7b'),'attributes':['id',_0x432d('0x50')],'raw':!![]});_0x57892e[_0x432d('0xa4')]({'model':db['CmContact'],'as':_0x432d('0x61'),'attributes':['id',_0x432d('0xb2'),'lastName'],'raw':!![]});if(_0xf6f32[_0x432d('0x39')][_0x432d('0xb0')]){_0x57892e[_0x432d('0xa4')]({'model':db[_0x432d('0x6b')],'as':'Attachment','raw':!![]});}var _0x19a893=[{'model':db[_0x432d('0x5e')],'as':_0x432d('0x7a'),'attributes':['id',_0x432d('0x47'),_0x432d('0x85'),'direction','secret',_0x432d('0xb3')],'include':_0x57892e}];_0x19a893[_0x432d('0xa4')]({'model':db[_0x432d('0x4b')],'as':_0x432d('0xb4'),'attributes':['id',_0x432d('0x2b')]});_0x19a893[_0x432d('0xa4')]({'model':db[_0x432d('0x7b')],'as':_0x432d('0xb5'),'attributes':['id',_0x432d('0x50')]});return db[_0x432d('0x34')]['find']({'where':{'id':_0xf6f32[_0x432d('0x3c')]['id']},'include':_0x19a893})['then'](handleEntityNotFound(_0xe985b6,null))[_0x432d('0x2a')](function(_0x3f2b16){if(_0x3f2b16){var _0x1654c4=_0x3f2b16['get']({'plain':!![]});fs[_0x432d('0xb6')](_0x16a575);var _0x4bc30f={'channel':_0x432d('0xb7'),'account':_0x1654c4[_0x432d('0xb4')][_0x432d('0x2b')],'agent':_0x1654c4[_0x432d('0xb5')]?_0x1654c4[_0x432d('0xb5')][_0x432d('0x50')]:_0x432d('0xb8'),'createdAt':moment(_0x1654c4[_0x432d('0x85')])[_0x432d('0x76')](_0x432d('0xb9'))[_0x432d('0xba')](),'closedAt':_0x1654c4[_0x432d('0x65')]?moment(_0x1654c4[_0x432d('0xbb')])[_0x432d('0x76')](_0x432d('0xb9'))[_0x432d('0xba')]():'','disposition':_0x1654c4[_0x432d('0xbc')],'chatInfo':{'browser':_0x1654c4[_0x432d('0xbd')],'os':_0x1654c4[_0x432d('0xbe')],'referer':_0x1654c4[_0x432d('0xbf')],'customerIp':_0x1654c4[_0x432d('0xc0')],'customerPort':_0x1654c4[_0x432d('0xc1')]?_0x1654c4[_0x432d('0xc1')]:'N.A.'},'messages':_(_0x1654c4[_0x432d('0x7a')])['tail']()[_0x432d('0x9b')]({'secret':![]})[_0x432d('0x33')](function(_0x696da0){if(_0x696da0[_0x432d('0x6b')]){var _0x94c1d7=path[_0x432d('0x6f')](_0x54583b,_0x696da0[_0x432d('0x6b')][_0x432d('0x69')]);if(fs[_0x432d('0xc2')](_0x94c1d7)){fs[_0x432d('0xc3')](_0x94c1d7)[_0x432d('0xc4')](fs[_0x432d('0xc5')](path[_0x432d('0x6f')](_0x16a575,_0x696da0[_0x432d('0x6b')]['basename'])));}}return{'date':moment(_0x696da0['createdAt'])[_0x432d('0x76')](_0x432d('0xb9'))['toString'](),'sender':_0x696da0['direction']==='out'?_0x696da0[_0x432d('0x7b')]?_0x696da0[_0x432d('0x7b')][_0x432d('0x50')]:_0x432d('0x7f'):_0x696da0[_0x432d('0x61')][_0x432d('0xb2')]+(_0x696da0[_0x432d('0x61')][_0x432d('0xc6')]?'\x20'+_0x696da0[_0x432d('0x61')]['lastName']:''),'body':_0x696da0[_0x432d('0x6b')]?_0x696da0['Attachment'][_0x432d('0x69')]:_0x696da0[_0x432d('0x47')],'direction':_0x696da0[_0x432d('0x87')]==='out'?'A':'C','secret':_0x696da0['secret'],'read':_0x696da0[_0x432d('0xb3')],'attachment':_0x696da0[_0x432d('0x6b')]};})[_0x432d('0xc7')]()};return ejs['renderFile'](path[_0x432d('0x6f')](config[_0x432d('0x70')],_0x432d('0xad'),_0x432d('0xc8'),_0x432d('0xc9')),{'interaction':_0x4bc30f})['then'](function(_0x3ce3c4){var _0x1ae260=path[_0x432d('0x6f')](_0x16a575,_0x432d('0xca')+_0x1654c4['id']+'-'+_0x579ef0+'.pdf');var _0x3d5686={'path':_0x1ae260,'channel':'Chat','interactionId':_0x1654c4['id']};return pdf['createPdfFromHTML'](_0x3ce3c4,_0x3d5686);})[_0x432d('0x2a')](function(){return new Promise(function(_0xd673c7,_0x1eef53){zipdir(_0x16a575,{'saveTo':_0x943af4},function(_0x4de395,_0x112414){if(_0x4de395)return _0x1eef53(_0x4de395);return _0xd673c7(_0x112414);});})['then'](function(){return new BPromise(function(_0x3927f9,_0x175747){rimraf(_0x16a575,function(_0x118b43){if(_0x118b43)_0x175747(_0x118b43);return _0x3927f9();});});})[_0x432d('0x2a')](function(){return _0xe985b6['download'](_0x943af4,_0x5ec41c,function(_0x3591d7){if(_0x3591d7){logger[_0x432d('0x1b')](_0x432d('0xcb'),_0x3591d7);}else{fs['unlinkSync'](_0x943af4);}});});});}else{return _0xe985b6[_0x432d('0x20')](0xc8);}})[_0x432d('0x1f')](handleError(_0xe985b6,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 795c922..0f0152a 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 _0x58d5=['hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','catch'];(function(_0x49b766,_0x3304bd){var _0x5556d7=function(_0x3ac4c6){while(--_0x3ac4c6){_0x49b766['push'](_0x49b766['shift']());}};_0x5556d7(++_0x3304bd);}(_0x58d5,0x146));var _0x558d=function(_0x31dcfb,_0x24c91c){_0x31dcfb=_0x31dcfb-0x0;var _0x5c9f04=_0x58d5[_0x31dcfb];return _0x5c9f04;};'use strict';var EventEmitter=require(_0x558d('0x0'));var ChatInteraction=require(_0x558d('0x1'))['db'][_0x558d('0x2')];var ChatMessage=require(_0x558d('0x1'))['db'][_0x558d('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x558d('0x4')](0x0);var events={'afterCreate':_0x558d('0x5'),'afterUpdate':'update','afterDestroy':_0x558d('0x6')};function emitEvent(_0xe49697){return function(_0x4f1237,_0x3ffda6,_0x291590){_0x4f1237[_0x558d('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1ff123){_0x4f1237[_0x558d('0x8')](_0x558d('0x9'),_0x1ff123[_0x558d('0xa')](function(_0x1e0def){return{'id':_0x1e0def['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4f1237['id'],'direction':'in','read':![]},'raw':!![]});})[_0x558d('0xb')](function(_0x5ddf4b){_0x4f1237[_0x558d('0x8')](_0x558d('0xc'),_0x5ddf4b[_0x558d('0xd')]);ChatInteractionEvents[_0x558d('0xe')](_0xe49697+':'+_0x4f1237['id'],_0x4f1237);ChatInteractionEvents['emit'](_0xe49697,_0x4f1237);_0x291590(null);})[_0x558d('0xf')](_0x291590(null));};}for(var e in events){if(events[_0x558d('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x558d('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x6758=['ChatMessage','save','update','getUsers','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb'];(function(_0xd3eb27,_0x212bb6){var _0x49c92b=function(_0x229dec){while(--_0x229dec){_0xd3eb27['push'](_0xd3eb27['shift']());}};_0x49c92b(++_0x212bb6);}(_0x6758,0xcd));var _0x8675=function(_0x5ae4a1,_0x1f73bb){_0x5ae4a1=_0x5ae4a1-0x0;var _0x452fb2=_0x6758[_0x5ae4a1];return _0x452fb2;};'use strict';var EventEmitter=require(_0x8675('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x8675('0x1')];var ChatMessage=require(_0x8675('0x2'))['db'][_0x8675('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8675('0x4'),'afterUpdate':_0x8675('0x5'),'afterDestroy':'remove'};function emitEvent(_0x813881){return function(_0x9bff78,_0x18bee8,_0x56852f){_0x9bff78[_0x8675('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25c4f3){_0x9bff78[_0x8675('0x7')]('Users',_0x25c4f3[_0x8675('0x8')](function(_0x3b5d76){return{'id':_0x3b5d76['id']};}));return ChatMessage[_0x8675('0x9')]({'where':{'ChatInteractionId':_0x9bff78['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x228284){_0x9bff78['setDataValue'](_0x8675('0xa'),_0x228284['length']);ChatInteractionEvents[_0x8675('0xb')](_0x813881+':'+_0x9bff78['id'],_0x9bff78);ChatInteractionEvents[_0x8675('0xb')](_0x813881,_0x9bff78);_0x56852f(null);})[_0x8675('0xc')](_0x56852f(null));};}for(var e in events){if(events[_0x8675('0xd')](e)){var event=events[e];ChatInteraction[_0x8675('0xe')](e,emitEvent(event));}}module[_0x8675('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index adbbe87..fe24e1c 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 _0x960d=['path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','closedAt','format','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird'];(function(_0x59f201,_0x2bc0a3){var _0x35750d=function(_0x19bd14){while(--_0x19bd14){_0x59f201['push'](_0x59f201['shift']());}};_0x35750d(++_0x2bc0a3);}(_0x960d,0x1cd));var _0xd960=function(_0x346e25,_0x3bd1ad){_0x346e25=_0x346e25-0x0;var _0x1be589=_0x960d[_0x346e25];return _0x1be589;};'use strict';var _=require('lodash');var util=require(_0xd960('0x0'));var logger=require(_0xd960('0x1'))(_0xd960('0x2'));var moment=require('moment');var BPromise=require(_0xd960('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd960('0x4'));var rimraf=require(_0xd960('0x5'));var config=require(_0xd960('0x6'));var attributes=require(_0xd960('0x7'));module[_0xd960('0x8')]=function(_0x104473,_0x55b442){return _0x104473[_0xd960('0x9')](_0xd960('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x565846,_0x51d82c,_0x20caca){if(_0x565846['changed']('closed')){_0x565846[_0xd960('0xb')]=moment()[_0xd960('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x20caca(null,_0x565846);}},'charset':_0xd960('0xd'),'collate':_0xd960('0xe')});}; \ No newline at end of file +var _0x3d8b=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x3d8b,0x9b));var _0xb3d8=function(_0x1853d1,_0x188d19){_0x1853d1=_0x1853d1-0x0;var _0x5d3703=_0x3d8b[_0x1853d1];return _0x5d3703;};'use strict';var _=require(_0xb3d8('0x0'));var util=require(_0xb3d8('0x1'));var logger=require(_0xb3d8('0x2'))('api');var moment=require(_0xb3d8('0x3'));var BPromise=require('bluebird');var rp=require(_0xb3d8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3d8('0x5'));var config=require(_0xb3d8('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xb3d8('0x7')]=function(_0x245caf,_0x2e1f73){return _0x245caf[_0xb3d8('0x8')](_0xb3d8('0x9'),attributes,{'tableName':_0xb3d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x521a26,_0xeebccf,_0x2e7313){if(_0x521a26[_0xb3d8('0xb')](_0xb3d8('0xc'))){_0x521a26['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2e7313(null,_0x521a26);}},'charset':'utf8mb4','collate':_0xb3d8('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d12fb21..b34c69b 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 _0x89da=['../../mysqldb','../../config/logger','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x9447f1,_0x2c6eba){var _0x4aed96=function(_0x4d78b6){while(--_0x4d78b6){_0x9447f1['push'](_0x9447f1['shift']());}};_0x4aed96(++_0x2c6eba);}(_0x89da,0xa6));var _0xa89d=function(_0xbbbca0,_0x219e6f){_0xbbbca0=_0xbbbca0-0x0;var _0x45fc29=_0x89da[_0xbbbca0];return _0x45fc29;};'use strict';var _=require(_0xa89d('0x0'));var util=require(_0xa89d('0x1'));var moment=require(_0xa89d('0x2'));var BPromise=require(_0xa89d('0x3'));var rs=require(_0xa89d('0x4'));var fs=require('fs');var Redis=require(_0xa89d('0x5'));var db=require(_0xa89d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa89d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa89d('0x8')][_0xa89d('0x9')]({'port':0x232a});config[_0xa89d('0xa')]=_['defaults'](config[_0xa89d('0xa')],{'host':_0xa89d('0xb'),'port':0x18eb});var socket=require(_0xa89d('0xc'))(new Redis(config['redis']));require(_0xa89d('0xd'))[_0xa89d('0xe')](socket);function respondWithRpcPromise(_0x52fc86,_0x199e73,_0x56c945){return new BPromise(function(_0x300390,_0x1b0df3){return client[_0xa89d('0xf')](_0x52fc86,_0x56c945)[_0xa89d('0x10')](function(_0x84f3a6){logger['info'](_0xa89d('0x11'),_0x199e73,_0xa89d('0x12'));logger[_0xa89d('0x13')](_0xa89d('0x14'),_0x199e73,_0xa89d('0x12'),JSON[_0xa89d('0x15')](_0x84f3a6));if(_0x84f3a6[_0xa89d('0x16')]){if(_0x84f3a6['error'][_0xa89d('0x17')]===0x1f4){logger[_0xa89d('0x16')](_0xa89d('0x11'),_0x199e73,_0x84f3a6[_0xa89d('0x16')][_0xa89d('0x18')]);return _0x1b0df3(_0x84f3a6['error'][_0xa89d('0x18')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x199e73,_0x84f3a6['error']['message']);return _0x300390(_0x84f3a6[_0xa89d('0x16')][_0xa89d('0x18')]);}else{logger[_0xa89d('0x19')](_0xa89d('0x11'),_0x199e73,_0xa89d('0x12'));_0x300390(_0x84f3a6[_0xa89d('0x1a')][_0xa89d('0x18')]);}})[_0xa89d('0x1b')](function(_0x5e7325){logger[_0xa89d('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x199e73,_0x5e7325);_0x1b0df3(_0x5e7325);});});}exports[_0xa89d('0x1c')]=function(_0x15a6bc){var _0x3bb56d=this;return new Promise(function(_0xa3d797,_0x2e9864){return db[_0xa89d('0x1d')][_0xa89d('0x1e')](_0x15a6bc[_0xa89d('0x1f')],{'raw':_0x15a6bc[_0xa89d('0x20')]?_0x15a6bc[_0xa89d('0x20')][_0xa89d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15a6bc['options']?_0x15a6bc[_0xa89d('0x20')]['where']||null:null,'attributes':_0x15a6bc[_0xa89d('0x20')]?_0x15a6bc['options'][_0xa89d('0x22')]||null:null,'limit':_0x15a6bc[_0xa89d('0x20')]?_0x15a6bc['options'][_0xa89d('0x23')]||null:null})[_0xa89d('0x10')](function(_0x4111e0){logger['info']('UpdateChatInteraction',_0x15a6bc);logger['debug'](_0xa89d('0x1c'),_0x15a6bc,JSON[_0xa89d('0x15')](_0x4111e0));_0xa3d797(_0x4111e0);})[_0xa89d('0x1b')](function(_0x2b8dad){logger['error'](_0xa89d('0x1c'),_0x2b8dad[_0xa89d('0x18')],_0x15a6bc);_0x2e9864(_0x3bb56d[_0xa89d('0x16')](0x1f4,_0x2b8dad[_0xa89d('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x498d0f){return new Promise(function(_0x16ae72,_0x2b952b){return db[_0xa89d('0x1d')][_0xa89d('0x24')]({'where':_0x498d0f[_0xa89d('0x20')]?_0x498d0f[_0xa89d('0x20')][_0xa89d('0x25')]||null:null})[_0xa89d('0x10')](function(_0x433e3f){if(_0x433e3f){return _0x433e3f[_0xa89d('0x26')](_0x498d0f['body'][_0xa89d('0x27')],_[_0xa89d('0x28')](_0x498d0f[_0xa89d('0x1f')],['ids','id'])||{});}})[_0xa89d('0x29')](function(_0x32f5d5){logger[_0xa89d('0x19')](_0xa89d('0x2a'),_0x498d0f);logger[_0xa89d('0x13')]('AddTags',_0x498d0f,JSON[_0xa89d('0x15')](_0x32f5d5));_0x16ae72(_0x32f5d5);})[_0xa89d('0x1b')](function(_0xf096c){logger[_0xa89d('0x16')](_0xa89d('0x2a'),_0xf096c[_0xa89d('0x18')],_0x498d0f);_0x2b952b(_this['error'](0x1f4,_0xf096c[_0xa89d('0x18')]));});});}; \ No newline at end of file +var _0x3523=['spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','AddTagsToChatInteraction','find','addTags','ids'];(function(_0x4cbc38,_0xc6e5fc){var _0x298c45=function(_0x3c66ed){while(--_0x3c66ed){_0x4cbc38['push'](_0x4cbc38['shift']());}};_0x298c45(++_0xc6e5fc);}(_0x3523,0xa6));var _0x3352=function(_0x4facd0,_0xf373ea){_0x4facd0=_0x4facd0-0x0;var _0x24829e=_0x3523[_0x4facd0];return _0x24829e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3352('0x0'));var BPromise=require(_0x3352('0x1'));var rs=require(_0x3352('0x2'));var fs=require('fs');var Redis=require(_0x3352('0x3'));var db=require(_0x3352('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3352('0x5'))(_0x3352('0x6'));var config=require('../../config/environment');var jayson=require(_0x3352('0x7'));var client=jayson[_0x3352('0x8')][_0x3352('0x9')]({'port':0x232a});config[_0x3352('0xa')]=_[_0x3352('0xb')](config['redis'],{'host':_0x3352('0xc'),'port':0x18eb});var socket=require(_0x3352('0xd'))(new Redis(config[_0x3352('0xa')]));require(_0x3352('0xe'))[_0x3352('0xf')](socket);function respondWithRpcPromise(_0x4a74ad,_0x570a7d,_0x57cfef){return new BPromise(function(_0x4a17d3,_0x12269e){return client['request'](_0x4a74ad,_0x57cfef)[_0x3352('0x10')](function(_0x8b9935){logger['info'](_0x3352('0x11'),_0x570a7d,_0x3352('0x12'));logger[_0x3352('0x13')](_0x3352('0x14'),_0x570a7d,_0x3352('0x12'),JSON[_0x3352('0x15')](_0x8b9935));if(_0x8b9935[_0x3352('0x16')]){if(_0x8b9935[_0x3352('0x16')][_0x3352('0x17')]===0x1f4){logger[_0x3352('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x570a7d,_0x8b9935[_0x3352('0x16')][_0x3352('0x18')]);return _0x12269e(_0x8b9935['error'][_0x3352('0x18')]);}logger[_0x3352('0x16')](_0x3352('0x11'),_0x570a7d,_0x8b9935[_0x3352('0x16')][_0x3352('0x18')]);return _0x4a17d3(_0x8b9935['error']['message']);}else{logger[_0x3352('0x19')](_0x3352('0x11'),_0x570a7d,_0x3352('0x12'));_0x4a17d3(_0x8b9935[_0x3352('0x1a')]['message']);}})[_0x3352('0x1b')](function(_0x15d807){logger[_0x3352('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x570a7d,_0x15d807);_0x12269e(_0x15d807);});});}exports[_0x3352('0x1c')]=function(_0x1faac2){var _0x5a77d0=this;return new Promise(function(_0x4b6da4,_0x5b8575){return db[_0x3352('0x1d')]['update'](_0x1faac2[_0x3352('0x1e')],{'raw':_0x1faac2['options']?_0x1faac2[_0x3352('0x1f')][_0x3352('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1faac2[_0x3352('0x1f')]?_0x1faac2[_0x3352('0x1f')][_0x3352('0x21')]||null:null,'attributes':_0x1faac2[_0x3352('0x1f')]?_0x1faac2[_0x3352('0x1f')][_0x3352('0x22')]||null:null,'limit':_0x1faac2[_0x3352('0x1f')]?_0x1faac2[_0x3352('0x1f')]['limit']||null:null})[_0x3352('0x10')](function(_0x3bef56){logger['info']('UpdateChatInteraction',_0x1faac2);logger[_0x3352('0x13')](_0x3352('0x1c'),_0x1faac2,JSON[_0x3352('0x15')](_0x3bef56));_0x4b6da4(_0x3bef56);})[_0x3352('0x1b')](function(_0x4faa71){logger[_0x3352('0x16')]('UpdateChatInteraction',_0x4faa71[_0x3352('0x18')],_0x1faac2);_0x5b8575(_0x5a77d0[_0x3352('0x16')](0x1f4,_0x4faa71[_0x3352('0x18')]));});});};exports[_0x3352('0x23')]=function(_0x3006e0){return new Promise(function(_0x405006,_0x507531){return db[_0x3352('0x1d')][_0x3352('0x24')]({'where':_0x3006e0[_0x3352('0x1f')]?_0x3006e0[_0x3352('0x1f')]['where']||null:null})[_0x3352('0x10')](function(_0x398b15){if(_0x398b15){return _0x398b15[_0x3352('0x25')](_0x3006e0[_0x3352('0x1e')][_0x3352('0x26')],_['omit'](_0x3006e0[_0x3352('0x1e')],[_0x3352('0x26'),'id'])||{});}})[_0x3352('0x27')](function(_0x587458){logger[_0x3352('0x19')](_0x3352('0x28'),_0x3006e0);logger[_0x3352('0x13')](_0x3352('0x28'),_0x3006e0,JSON[_0x3352('0x15')](_0x587458));_0x405006(_0x587458);})[_0x3352('0x1b')](function(_0xfe973a){logger[_0x3352('0x16')]('AddTags',_0xfe973a[_0x3352('0x18')],_0x3006e0);_0x507531(_this[_0x3352('0x16')](0x1f4,_0xfe973a[_0x3352('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index fb5c382..bf0d2b3 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 _0xe79a=['register','chatInteraction:','remove','emit','removeListener'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0xe79a,0x70));var _0xae79=function(_0x1d73ab,_0x4db32c){_0x1d73ab=_0x1d73ab-0x0;var _0x2ed1df=_0xe79a[_0x1d73ab];return _0x2ed1df;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0xae79('0x0'),'update'];function createListener(_0x9b2c0d,_0x1d8bf8){return function(_0x42d748){_0x1d8bf8[_0xae79('0x1')](_0x9b2c0d,_0x42d748);};}function removeListener(_0x492be8,_0x33b85d){return function(){ChatInteractionEvents[_0xae79('0x2')](_0x492be8,_0x33b85d);};}exports[_0xae79('0x3')]=function(_0x590be7){for(var _0x1a9185=0x0,_0x3a92bf=events['length'];_0x1a9185<_0x3a92bf;_0x1a9185++){var _0x54e61d=events[_0x1a9185];var _0x459e6d=createListener(_0xae79('0x4')+_0x54e61d,_0x590be7);ChatInteractionEvents['on'](_0x54e61d,_0x459e6d);}}; \ No newline at end of file +var _0x5e93=['register','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x40b7ea,_0x550490){var _0x2627ec=function(_0x78fd8e){while(--_0x78fd8e){_0x40b7ea['push'](_0x40b7ea['shift']());}};_0x2627ec(++_0x550490);}(_0x5e93,0x174));var _0x35e9=function(_0x300429,_0x310e7a){_0x300429=_0x300429-0x0;var _0x5d433c=_0x5e93[_0x300429];return _0x5d433c;};'use strict';var ChatInteractionEvents=require(_0x35e9('0x0'));var events=[_0x35e9('0x1'),_0x35e9('0x2'),_0x35e9('0x3')];function createListener(_0xe13072,_0x311857){return function(_0x2802d0){_0x311857[_0x35e9('0x4')](_0xe13072,_0x2802d0);};}function removeListener(_0x37d735,_0x26a7b6){return function(){ChatInteractionEvents[_0x35e9('0x5')](_0x37d735,_0x26a7b6);};}exports[_0x35e9('0x6')]=function(_0x47d2a8){for(var _0x115d4c=0x0,_0x28a267=events['length'];_0x115d4c<_0x28a267;_0x115d4c++){var _0x5df77d=events[_0x115d4c];var _0x205178=createListener('chatInteraction:'+_0x5df77d,_0x47d2a8);ChatInteractionEvents['on'](_0x5df77d,_0x205178);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 8074ca8..58a4d0d 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 _0x2534=['/:id/close','delete','chatinteraction:destroy','removeTags','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','isChatInteractionAuthorized','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','abandon'];(function(_0x30c06c,_0x253c3d){var _0x5b1d52=function(_0x1a2ca3){while(--_0x1a2ca3){_0x30c06c['push'](_0x30c06c['shift']());}};_0x5b1d52(++_0x253c3d);}(_0x2534,0x8b));var _0x4253=function(_0x2c1e29,_0x82a5e6){_0x2c1e29=_0x2c1e29-0x0;var _0x45c600=_0x2534[_0x2c1e29];return _0x45c600;};'use strict';var multer=require('multer');var util=require(_0x4253('0x0'));var path=require('path');var timeout=require(_0x4253('0x1'));var express=require('express');var router=express[_0x4253('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4253('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4253('0x4'));var controller=require('./chatInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4253('0x5')](_0x4253('0x6'),auth[_0x4253('0x7')](),controller[_0x4253('0x8')]);router[_0x4253('0x5')](_0x4253('0x9'),auth['isChatInteractionAuthorized'](),controller[_0x4253('0xa')]);router[_0x4253('0x5')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x4253('0xb')]);router[_0x4253('0x5')](_0x4253('0xc'),auth[_0x4253('0x7')](),controller['getMessages']);router[_0x4253('0x5')](_0x4253('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x4253('0xe')]);router['get'](_0x4253('0xf'),auth[_0x4253('0x7')](),controller[_0x4253('0x10')]);router[_0x4253('0x11')]('/',auth[_0x4253('0x7')](),controller[_0x4253('0x12')]);router[_0x4253('0x11')]('/:id/vidaoo',auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x4253('0x13')]({'destination':function(_0x2b613c,_0x23350e,_0x4223f8){_0x4223f8(null,path[_0x4253('0x14')](config[_0x4253('0x15')],_0x4253('0x16')));},'filename':function(_0x247f7f,_0xf810f9,_0x499139){_0x499139(null,util[_0x4253('0x17')](_0x4253('0x18'),Date[_0x4253('0x19')](),_0xf810f9['originalname'][_0x4253('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x4253('0x1b'),upload[_0x4253('0x1c')](_0x4253('0x1d')),controller['attachmentUpload']);router[_0x4253('0x11')]('/:id/messages',auth[_0x4253('0x1e')](),controller[_0x4253('0x1f')]);router[_0x4253('0x11')]('/:id/tags',auth[_0x4253('0x7')](),interaction[_0x4253('0x20')](_0x4253('0x21'),_0x4253('0x22')),controller[_0x4253('0x23')]);router[_0x4253('0x24')](_0x4253('0x9'),auth[_0x4253('0x7')](),interaction[_0x4253('0x20')](_0x4253('0x21'),_0x4253('0x25')),controller['update']);router[_0x4253('0x24')](_0x4253('0x26'),controller[_0x4253('0x27')]);router[_0x4253('0x24')]('/:id/abandon',auth[_0x4253('0x1e')](),controller[_0x4253('0x28')]);router['put'](_0x4253('0x29'),controller['close']);router[_0x4253('0x2a')](_0x4253('0x9'),auth[_0x4253('0x7')](),interaction[_0x4253('0x20')](_0x4253('0x21'),_0x4253('0x2b')),controller['destroy']);router['delete']('/:id/tags',auth[_0x4253('0x7')](),controller[_0x4253('0x2c')]);module['exports']=router; \ No newline at end of file +var _0x957c=['join','server/files/attachments/','format','now','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download','download','post','createVidaooSession','diskStorage'];(function(_0x2d23fa,_0x3487e7){var _0x5992a8=function(_0x3b2a79){while(--_0x3b2a79){_0x2d23fa['push'](_0x2d23fa['shift']());}};_0x5992a8(++_0x3487e7);}(_0x957c,0x102));var _0xc957=function(_0x45db27,_0x54699a){_0x45db27=_0x45db27-0x0;var _0x5a8977=_0x957c[_0x45db27];return _0x5a8977;};'use strict';var multer=require('multer');var util=require(_0xc957('0x0'));var path=require(_0xc957('0x1'));var timeout=require(_0xc957('0x2'));var express=require(_0xc957('0x3'));var router=express[_0xc957('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc957('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc957('0x6'));router['get']('/',auth[_0xc957('0x7')](),controller[_0xc957('0x8')]);router[_0xc957('0x9')](_0xc957('0xa'),auth['isAuthenticated'](),controller[_0xc957('0xb')]);router['get'](_0xc957('0xc'),auth[_0xc957('0xd')](),controller[_0xc957('0xe')]);router[_0xc957('0x9')](_0xc957('0xf'),auth[_0xc957('0xd')](),controller[_0xc957('0x10')]);router[_0xc957('0x9')](_0xc957('0x11'),auth[_0xc957('0x7')](),controller['getMessages']);router['get'](_0xc957('0x12'),auth[_0xc957('0xd')](),controller['getMyMessages']);router[_0xc957('0x9')](_0xc957('0x13'),auth[_0xc957('0x7')](),controller[_0xc957('0x14')]);router['post']('/',auth[_0xc957('0x7')](),controller['create']);router[_0xc957('0x15')]('/:id/vidaoo',auth[_0xc957('0x7')](),controller[_0xc957('0x16')]);var upload=multer({'storage':multer[_0xc957('0x17')]({'destination':function(_0x2af877,_0x3fd3a2,_0x5e4da4){_0x5e4da4(null,path[_0xc957('0x18')](config['root'],_0xc957('0x19')));},'filename':function(_0x41c034,_0x2ad0cb,_0x1f240a){_0x1f240a(null,util[_0xc957('0x1a')]('%s-%s',Date[_0xc957('0x1b')](),_0x2ad0cb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xc957('0x1c'),upload[_0xc957('0x1d')](_0xc957('0x1e')),controller['attachmentUpload']);router['post'](_0xc957('0x11'),auth[_0xc957('0xd')](),controller[_0xc957('0x1f')]);router[_0xc957('0x15')](_0xc957('0x20'),auth[_0xc957('0x7')](),interaction[_0xc957('0x21')]('chat',_0xc957('0x22')),controller['addTags']);router[_0xc957('0x23')](_0xc957('0xc'),auth[_0xc957('0x7')](),interaction['tracked'](_0xc957('0x24'),_0xc957('0x25')),controller[_0xc957('0x26')]);router[_0xc957('0x23')](_0xc957('0x27'),controller[_0xc957('0x28')]);router[_0xc957('0x23')](_0xc957('0x29'),auth['isChatInteractionAuthorized'](),controller[_0xc957('0x2a')]);router[_0xc957('0x23')]('/:id/close',controller['close']);router[_0xc957('0x2b')]('/:id',auth[_0xc957('0x7')](),interaction[_0xc957('0x21')](_0xc957('0x24'),'chatinteraction:destroy'),controller[_0xc957('0x2c')]);router[_0xc957('0x2b')](_0xc957('0x20'),auth[_0xc957('0x7')](),controller[_0xc957('0x2d')]);module[_0xc957('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index c751b42..122c007 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 _0x83ed=['sequelize','exports','TEXT','BOOLEAN','INTEGER'];(function(_0x496c5b,_0x4d5916){var _0x3d3764=function(_0x4cb006){while(--_0x4cb006){_0x496c5b['push'](_0x496c5b['shift']());}};_0x3d3764(++_0x4d5916);}(_0x83ed,0x1d6));var _0xd83e=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x83ed[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0xd83e('0x0'));module[_0xd83e('0x1')]={'body':{'type':Sequelize[_0xd83e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd83e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd83e('0x4')]}}; \ No newline at end of file +var _0xbad5=['TEXT','INTEGER','sequelize','exports'];(function(_0x1616d3,_0x1e12aa){var _0x3707a9=function(_0x101533){while(--_0x101533){_0x1616d3['push'](_0x1616d3['shift']());}};_0x3707a9(++_0x1e12aa);}(_0xbad5,0x106));var _0x5bad=function(_0x45bb37,_0x27793c){_0x45bb37=_0x45bb37-0x0;var _0x5194bf=_0xbad5[_0x45bb37];return _0x5194bf;};'use strict';var Sequelize=require(_0x5bad('0x0'));module[_0x5bad('0x1')]={'body':{'type':Sequelize[_0x5bad('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5bad('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 430d0f3..5bf8885 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 _0x78cd=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','rows','catch','show','params','fields','length','include','find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','admin','user','fullname','userpic','internal','online','allowmessenger','showWebBar','VoiceQueue','get','role','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x2233bb,_0x1fd7ed){var _0x4fb754=function(_0x46869f){while(--_0x46869f){_0x2233bb['push'](_0x2233bb['shift']());}};_0x4fb754(++_0x1fd7ed);}(_0x78cd,0xcf));var _0xd78c=function(_0x209eca,_0x2e57d1){_0x209eca=_0x209eca-0x0;var _0x2dad03=_0x78cd[_0x209eca];return _0x2dad03;};'use strict';var emlformat=require(_0xd78c('0x0'));var rimraf=require(_0xd78c('0x1'));var zipdir=require(_0xd78c('0x2'));var jsonpatch=require(_0xd78c('0x3'));var rp=require(_0xd78c('0x4'));var moment=require(_0xd78c('0x5'));var BPromise=require(_0xd78c('0x6'));var Mustache=require(_0xd78c('0x7'));var util=require(_0xd78c('0x8'));var path=require(_0xd78c('0x9'));var sox=require('sox');var csv=require(_0xd78c('0xa'));var ejs=require(_0xd78c('0xb'));var fs=require('fs');var fs_extra=require(_0xd78c('0xc'));var _=require(_0xd78c('0xd'));var squel=require('squel');var crypto=require(_0xd78c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd78c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd78c('0x10'));var Papa=require(_0xd78c('0x11'));var Redis=require(_0xd78c('0x12'));var authService=require(_0xd78c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd78c('0x14'));var hardwareService=require(_0xd78c('0x15'));var logger=require(_0xd78c('0x16'))(_0xd78c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd78c('0x18'));var db=require(_0xd78c('0x19'))['db'];config[_0xd78c('0x1a')]=_[_0xd78c('0x1b')](config[_0xd78c('0x1a')],{'host':_0xd78c('0x1c'),'port':0x18eb});var socket=require(_0xd78c('0x1d'))(new Redis(config[_0xd78c('0x1a')]));require(_0xd78c('0x1e'))['register'](socket);function respondWithStatusCode(_0x15f61f,_0x4040d6){_0x4040d6=_0x4040d6||0xcc;return function(_0x1b2be7){if(_0x1b2be7){return _0x15f61f['sendStatus'](_0x4040d6);}return _0x15f61f[_0xd78c('0x1f')](_0x4040d6)[_0xd78c('0x20')]();};}function respondWithResult(_0x17b88d,_0x565d9e){_0x565d9e=_0x565d9e||0xc8;return function(_0x4f0f0a){if(_0x4f0f0a){return _0x17b88d['status'](_0x565d9e)[_0xd78c('0x21')](_0x4f0f0a);}};}function respondWithFilteredResult(_0x5b7c7d,_0x2cb5e3){return function(_0xa7f1b){if(_0xa7f1b){var _0x3c503f=typeof _0x2cb5e3[_0xd78c('0x22')]===_0xd78c('0x23')&&typeof _0x2cb5e3[_0xd78c('0x24')]===_0xd78c('0x23');var _0x1d5fa=_0xa7f1b[_0xd78c('0x25')];var _0x10c560=_0x3c503f?0x0:_0x2cb5e3[_0xd78c('0x22')];var _0x58ea72=_0x3c503f?_0xa7f1b[_0xd78c('0x25')]:_0x2cb5e3[_0xd78c('0x22')]+_0x2cb5e3[_0xd78c('0x24')];var _0x4835af;if(_0x58ea72>=_0x1d5fa){_0x58ea72=_0x1d5fa;_0x4835af=0xc8;}else{_0x4835af=0xce;}_0x5b7c7d['status'](_0x4835af);return _0x5b7c7d[_0xd78c('0x26')]('Content-Range',_0x10c560+'-'+_0x58ea72+'/'+_0x1d5fa)[_0xd78c('0x21')](_0xa7f1b);}return null;};}function patchUpdates(_0x4abc00){return function(_0x12717c){try{jsonpatch[_0xd78c('0x27')](_0x12717c,_0x4abc00,!![]);}catch(_0x762593){return BPromise['reject'](_0x762593);}return _0x12717c[_0xd78c('0x28')]();};}function saveUpdates(_0x4384f0,_0x30954d){return function(_0x2446ba){if(_0x2446ba){return _0x2446ba[_0xd78c('0x29')](_0x4384f0)[_0xd78c('0x2a')](function(_0x1a0190){return _0x1a0190;});}return null;};}function removeEntity(_0x23b78b,_0x51e441){return function(_0x3d9b6d){if(_0x3d9b6d){return _0x3d9b6d[_0xd78c('0x2b')]()[_0xd78c('0x2a')](function(){_0x23b78b['status'](0xcc)[_0xd78c('0x20')]();});}};}function handleEntityNotFound(_0x727068,_0x263815){return function(_0x4478d3){if(!_0x4478d3){_0x727068[_0xd78c('0x2c')](0x194);}return _0x4478d3;};}function handleError(_0x107abe,_0x591599){_0x591599=_0x591599||0x1f4;return function(_0x48fae4){logger['error'](_0x48fae4[_0xd78c('0x2d')]);if(_0x48fae4[_0xd78c('0x2e')]){delete _0x48fae4['name'];}_0x107abe[_0xd78c('0x1f')](_0x591599)[_0xd78c('0x2f')](_0x48fae4);};}exports[_0xd78c('0x30')]=function(_0x4e894d,_0x3ac797){var _0x483f89={},_0xb5528e={},_0x570e4b={'count':0x0,'rows':[]};var _0x17d13f=_[_0xd78c('0x31')](db[_0xd78c('0x32')][_0xd78c('0x33')],function(_0x1ddfb9){return{'name':_0x1ddfb9['fieldName'],'type':_0x1ddfb9[_0xd78c('0x34')][_0xd78c('0x35')]};});_0xb5528e[_0xd78c('0x36')]=_[_0xd78c('0x31')](_0x17d13f,_0xd78c('0x2e'));_0xb5528e['query']=_[_0xd78c('0x37')](_0x4e894d[_0xd78c('0x38')]);_0xb5528e[_0xd78c('0x39')]=_[_0xd78c('0x3a')](_0xb5528e[_0xd78c('0x36')],_0xb5528e[_0xd78c('0x38')]);_0x483f89[_0xd78c('0x3b')]=_[_0xd78c('0x3a')](_0xb5528e[_0xd78c('0x36')],qs['fields'](_0x4e894d[_0xd78c('0x38')]['fields']));_0x483f89[_0xd78c('0x3b')]=_0x483f89[_0xd78c('0x3b')]['length']?_0x483f89[_0xd78c('0x3b')]:_0xb5528e['model'];if(!_0x4e894d[_0xd78c('0x38')][_0xd78c('0x3c')](_0xd78c('0x3d'))){_0x483f89['limit']=qs[_0xd78c('0x24')](_0x4e894d[_0xd78c('0x38')]['limit']);_0x483f89['offset']=qs[_0xd78c('0x22')](_0x4e894d[_0xd78c('0x38')]['offset']);}_0x483f89[_0xd78c('0x3e')]=qs[_0xd78c('0x3f')](_0x4e894d[_0xd78c('0x38')][_0xd78c('0x3f')]);_0x483f89[_0xd78c('0x40')]=qs[_0xd78c('0x39')](_['pick'](_0x4e894d[_0xd78c('0x38')],_0xb5528e[_0xd78c('0x39')]),_0x17d13f);if(_0x4e894d['query']['filter']){_0x483f89[_0xd78c('0x40')]=_['merge'](_0x483f89['where'],{'$or':_[_0xd78c('0x31')](_0x17d13f,function(_0x52f0fc){if(_0x52f0fc[_0xd78c('0x34')]!==_0xd78c('0x41')){var _0x19e69d={};_0x19e69d[_0x52f0fc['name']]={'$like':'%'+_0x4e894d[_0xd78c('0x38')][_0xd78c('0x42')]+'%'};return _0x19e69d;}})});}_0x483f89=_[_0xd78c('0x43')]({},_0x483f89,_0x4e894d[_0xd78c('0x44')]);var _0x26081d={'where':_0x483f89[_0xd78c('0x40')]};return db['ChatInternalMessage'][_0xd78c('0x25')](_0x26081d)['then'](function(_0x4f9d17){_0x570e4b[_0xd78c('0x25')]=_0x4f9d17;if(_0x4e894d['query'][_0xd78c('0x45')]){_0x483f89['include']=[{'all':!![]}];}return db[_0xd78c('0x32')]['findAll'](_0x483f89);})[_0xd78c('0x2a')](function(_0x9d3cb2){_0x570e4b[_0xd78c('0x46')]=_0x9d3cb2;return _0x570e4b;})[_0xd78c('0x2a')](respondWithFilteredResult(_0x3ac797,_0x483f89))[_0xd78c('0x47')](handleError(_0x3ac797,null));};exports[_0xd78c('0x48')]=function(_0x1378e0,_0x510c4b){var _0x1bd061={'raw':!![],'where':{'id':_0x1378e0[_0xd78c('0x49')]['id']}},_0xb14681={};_0xb14681[_0xd78c('0x36')]=_[_0xd78c('0x37')](db['ChatInternalMessage']['rawAttributes']);_0xb14681['query']=_['keys'](_0x1378e0[_0xd78c('0x38')]);_0xb14681[_0xd78c('0x39')]=_[_0xd78c('0x3a')](_0xb14681[_0xd78c('0x36')],_0xb14681[_0xd78c('0x38')]);_0x1bd061[_0xd78c('0x3b')]=_[_0xd78c('0x3a')](_0xb14681['model'],qs[_0xd78c('0x4a')](_0x1378e0['query'][_0xd78c('0x4a')]));_0x1bd061[_0xd78c('0x3b')]=_0x1bd061['attributes'][_0xd78c('0x4b')]?_0x1bd061[_0xd78c('0x3b')]:_0xb14681[_0xd78c('0x36')];if(_0x1378e0[_0xd78c('0x38')]['includeAll']){_0x1bd061[_0xd78c('0x4c')]=[{'all':!![]}];}_0x1bd061=_[_0xd78c('0x43')]({},_0x1bd061,_0x1378e0['options']);return db[_0xd78c('0x32')][_0xd78c('0x4d')](_0x1bd061)[_0xd78c('0x2a')](handleEntityNotFound(_0x510c4b,null))[_0xd78c('0x2a')](respondWithResult(_0x510c4b,null))[_0xd78c('0x47')](handleError(_0x510c4b,null));};exports[_0xd78c('0x4e')]=function(_0x281b07,_0x4c47f0){return db['ChatInternalMessage'][_0xd78c('0x4e')](_0x281b07['body'],{})[_0xd78c('0x2a')](respondWithResult(_0x4c47f0,0xc9))[_0xd78c('0x47')](handleError(_0x4c47f0,null));};exports[_0xd78c('0x29')]=function(_0x4828f8,_0x14bc03){if(_0x4828f8[_0xd78c('0x4f')]['id']){delete _0x4828f8[_0xd78c('0x4f')]['id'];}return db[_0xd78c('0x32')][_0xd78c('0x4d')]({'where':{'id':_0x4828f8[_0xd78c('0x49')]['id']}})[_0xd78c('0x2a')](handleEntityNotFound(_0x14bc03,null))['then'](saveUpdates(_0x4828f8['body'],null))[_0xd78c('0x2a')](respondWithResult(_0x14bc03,null))[_0xd78c('0x47')](handleError(_0x14bc03,null));};exports[_0xd78c('0x2b')]=function(_0x5a57f8,_0x270620){return db[_0xd78c('0x32')]['find']({'where':{'id':_0x5a57f8['params']['id']}})[_0xd78c('0x2a')](handleEntityNotFound(_0x270620,null))[_0xd78c('0x2a')](removeEntity(_0x270620,null))[_0xd78c('0x47')](handleError(_0x270620,null));};exports[_0xd78c('0x50')]=function(_0x4d4b64,_0x2825c0){return db[_0xd78c('0x32')][_0xd78c('0x50')]()[_0xd78c('0x2a')](respondWithResult(_0x2825c0,null))[_0xd78c('0x47')](handleError(_0x2825c0,null));};function wrapUser(_0x2765ea){return function(_0x10a6d1){var _0x1267b9=_0x2765ea['get']({'plain':!![]});_0x1267b9[_0xd78c('0x51')]=[];if(_0x10a6d1){_0x1267b9[_0xd78c('0x52')]=_0x10a6d1[_0xd78c('0x53')];_0x1267b9[_0xd78c('0x54')]=_0x10a6d1;}else{_0x1267b9[_0xd78c('0x52')]=moment(0x0)[_0xd78c('0x55')](_0xd78c('0x56'));_0x1267b9[_0xd78c('0x54')]={};}return _0x1267b9;};}exports[_0xd78c('0x57')]=function(_0x8bb1a0,_0x935537,_0x367bfb){var _0x2bf4b2=[];return db[_0xd78c('0x58')][_0xd78c('0x59')]({'where':{'role':['agent',_0xd78c('0x5a'),_0xd78c('0x5b')]},'attributes':['id',_0xd78c('0x5c'),_0xd78c('0x2e'),'role',_0xd78c('0x5d'),_0xd78c('0x5e'),_0xd78c('0x5f'),'lastLoginAt',_0xd78c('0x60'),_0xd78c('0x61')],'order':qs['sort']('-online'),'include':[{'model':db[_0xd78c('0x62')],'as':'VoiceQueues','attributes':['id','name',_0xd78c('0x34')],'through':{'attributes':[]}}]})[_0xd78c('0x2a')](function(_0x442247){if(_0x442247){var _0x1912e4=_0x8bb1a0[_0xd78c('0x5b')][_0xd78c('0x63')]({'plain':!![]});if(!_0x1912e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1912e4[_0xd78c('0x64')]===_0xd78c('0x5b')){return db[_0xd78c('0x65')][_0xd78c('0x4d')]({'where':{'name':_0xd78c('0x66'),'userProfileId':_0x1912e4[_0xd78c('0x67')]},'raw':!![]})[_0xd78c('0x2a')](function(_0x5ad07c){if(_0x5ad07c){if(_0x5ad07c['autoAssociation']===0x0){return db[_0xd78c('0x68')][_0xd78c('0x59')]({'where':{'sectionId':_0x5ad07c['id']},'raw':!![]})[_0xd78c('0x2a')](function(_0x5628f6){var _0xf73a2e=[];if(_[_0xd78c('0x69')](_0x5628f6)){_0xf73a2e=_[_0xd78c('0x42')](_0x442247,function(_0x4d6d64){if(_0x4d6d64[_0xd78c('0x64')]!=='agent'){return _0x4d6d64;}});return _0xf73a2e;}else{for(var _0x3ed513=0x0;_0x3ed513<_0x442247['length'];_0x3ed513++){var _0x315a5c=_0x442247[_0x3ed513];if(_0x315a5c['role']===_0xd78c('0x6a')){var _0x4f9ea7=_[_0xd78c('0x4d')](_0x5628f6,function(_0x3149e7){return _0x3149e7[_0xd78c('0x6b')]===_0x315a5c['id'];});if(_0x4f9ea7)_0xf73a2e['push'](_0x315a5c);}else{_0xf73a2e[_0xd78c('0x6c')](_0x315a5c);}}return _0xf73a2e;}});}else{return _0x442247;}}else{var _0x968963=_[_0xd78c('0x42')](_0x442247,function(_0x59e8fa){if(_0x59e8fa[_0xd78c('0x64')]!==_0xd78c('0x6a')){return _0x59e8fa;}});return _0x968963;}});}else{return _0x442247;}}})[_0xd78c('0x2a')](function(_0x2a0f02){var _0x2c2ee9=[];if(_0x2a0f02){_0x2bf4b2=_0x2a0f02;for(var _0x3d7d38=0x0;_0x3d7d38<_0x2a0f02[_0xd78c('0x4b')];_0x3d7d38+=0x1){_0x2bf4b2[_0x3d7d38]['messages']=[];_0x2c2ee9[_0xd78c('0x6c')](db[_0xd78c('0x32')]['find']({'where':{'FromId':[_0x8bb1a0[_0xd78c('0x5b')]['id'],_0x2a0f02[_0x3d7d38]['id']],'ToId':[_0x8bb1a0[_0xd78c('0x5b')]['id'],_0x2a0f02[_0x3d7d38]['id']],'ChatGroupId':null},'attributes':['id',_0xd78c('0x53'),_0xd78c('0x6d'),_0xd78c('0x6e'),_0xd78c('0x6f'),_0xd78c('0x4f')],'order':qs[_0xd78c('0x3f')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd78c('0x2a')](wrapUser(_0x2a0f02[_0x3d7d38])));}return BPromise[_0xd78c('0x70')](_0x2c2ee9);}return[];})[_0xd78c('0x2a')](function(_0x5757fd){return{'rows':_0x5757fd,'count':_0x5757fd['length']};})['then'](respondWithResult(_0x935537,null))[_0xd78c('0x47')](handleError(_0x935537,null));}; \ No newline at end of file +var _0x7753=['name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filters','filter','merge','ChatInternalMessage','count','includeAll','findAll','catch','params','keys','include','options','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','sort','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7753,0x1eb));var _0x3775=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0x7753[_0x543c51];return _0x360555;};'use strict';var emlformat=require(_0x3775('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3775('0x1'));var jsonpatch=require(_0x3775('0x2'));var rp=require(_0x3775('0x3'));var moment=require(_0x3775('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3775('0x5'));var util=require(_0x3775('0x6'));var path=require(_0x3775('0x7'));var sox=require(_0x3775('0x8'));var csv=require(_0x3775('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3775('0xa'));var _=require(_0x3775('0xb'));var squel=require(_0x3775('0xc'));var crypto=require(_0x3775('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3775('0xe'));var toCsv=require(_0x3775('0x9'));var querystring=require(_0x3775('0xf'));var Papa=require('papaparse');var Redis=require(_0x3775('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3775('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3775('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3775('0x13'))['db'];config[_0x3775('0x14')]=_[_0x3775('0x15')](config[_0x3775('0x14')],{'host':_0x3775('0x16'),'port':0x18eb});var socket=require(_0x3775('0x17'))(new Redis(config[_0x3775('0x14')]));require(_0x3775('0x18'))[_0x3775('0x19')](socket);function respondWithStatusCode(_0x468c62,_0x13f5fc){_0x13f5fc=_0x13f5fc||0xcc;return function(_0x3365f5){if(_0x3365f5){return _0x468c62[_0x3775('0x1a')](_0x13f5fc);}return _0x468c62[_0x3775('0x1b')](_0x13f5fc)[_0x3775('0x1c')]();};}function respondWithResult(_0x1d5d8c,_0x326a4e){_0x326a4e=_0x326a4e||0xc8;return function(_0x5e7b97){if(_0x5e7b97){return _0x1d5d8c[_0x3775('0x1b')](_0x326a4e)[_0x3775('0x1d')](_0x5e7b97);}};}function respondWithFilteredResult(_0x3cc547,_0x3ac160){return function(_0x4bc9a2){if(_0x4bc9a2){var _0x1df5f8=typeof _0x3ac160['offset']===_0x3775('0x1e')&&typeof _0x3ac160[_0x3775('0x1f')]===_0x3775('0x1e');var _0x22bba4=_0x4bc9a2['count'];var _0xa8f0ab=_0x1df5f8?0x0:_0x3ac160[_0x3775('0x20')];var _0x574bff=_0x1df5f8?_0x4bc9a2['count']:_0x3ac160[_0x3775('0x20')]+_0x3ac160[_0x3775('0x1f')];var _0x459ce5;if(_0x574bff>=_0x22bba4){_0x574bff=_0x22bba4;_0x459ce5=0xc8;}else{_0x459ce5=0xce;}_0x3cc547[_0x3775('0x1b')](_0x459ce5);return _0x3cc547[_0x3775('0x21')](_0x3775('0x22'),_0xa8f0ab+'-'+_0x574bff+'/'+_0x22bba4)[_0x3775('0x1d')](_0x4bc9a2);}return null;};}function patchUpdates(_0x46b789){return function(_0xd30d39){try{jsonpatch['apply'](_0xd30d39,_0x46b789,!![]);}catch(_0x566686){return BPromise['reject'](_0x566686);}return _0xd30d39[_0x3775('0x23')]();};}function saveUpdates(_0x55fde2,_0x2d79d8){return function(_0x5926db){if(_0x5926db){return _0x5926db[_0x3775('0x24')](_0x55fde2)[_0x3775('0x25')](function(_0x358042){return _0x358042;});}return null;};}function removeEntity(_0x51413b,_0x441a4a){return function(_0x3a88c1){if(_0x3a88c1){return _0x3a88c1[_0x3775('0x26')]()['then'](function(){_0x51413b[_0x3775('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x513c91,_0x3655bd){return function(_0x3ce2c0){if(!_0x3ce2c0){_0x513c91[_0x3775('0x1a')](0x194);}return _0x3ce2c0;};}function handleError(_0x22c560,_0x3d46a1){_0x3d46a1=_0x3d46a1||0x1f4;return function(_0xfa57e4){logger['error'](_0xfa57e4['stack']);if(_0xfa57e4[_0x3775('0x27')]){delete _0xfa57e4[_0x3775('0x27')];}_0x22c560[_0x3775('0x1b')](_0x3d46a1)[_0x3775('0x28')](_0xfa57e4);};}exports[_0x3775('0x29')]=function(_0x3f9c01,_0x93397){var _0xa174ac={},_0x21277c={},_0x4882c7={'count':0x0,'rows':[]};var _0xae154d=_[_0x3775('0x2a')](db['ChatInternalMessage'][_0x3775('0x2b')],function(_0x326dd7){return{'name':_0x326dd7[_0x3775('0x2c')],'type':_0x326dd7[_0x3775('0x2d')][_0x3775('0x2e')]};});_0x21277c['model']=_[_0x3775('0x2a')](_0xae154d,'name');_0x21277c[_0x3775('0x2f')]=_['keys'](_0x3f9c01[_0x3775('0x2f')]);_0x21277c['filters']=_[_0x3775('0x30')](_0x21277c[_0x3775('0x31')],_0x21277c[_0x3775('0x2f')]);_0xa174ac[_0x3775('0x32')]=_['intersection'](_0x21277c['model'],qs[_0x3775('0x33')](_0x3f9c01['query'][_0x3775('0x33')]));_0xa174ac[_0x3775('0x32')]=_0xa174ac[_0x3775('0x32')][_0x3775('0x34')]?_0xa174ac[_0x3775('0x32')]:_0x21277c[_0x3775('0x31')];if(!_0x3f9c01[_0x3775('0x2f')][_0x3775('0x35')](_0x3775('0x36'))){_0xa174ac[_0x3775('0x1f')]=qs['limit'](_0x3f9c01[_0x3775('0x2f')][_0x3775('0x1f')]);_0xa174ac[_0x3775('0x20')]=qs[_0x3775('0x20')](_0x3f9c01['query'][_0x3775('0x20')]);}_0xa174ac['order']=qs['sort'](_0x3f9c01[_0x3775('0x2f')]['sort']);_0xa174ac[_0x3775('0x37')]=qs[_0x3775('0x38')](_['pick'](_0x3f9c01[_0x3775('0x2f')],_0x21277c[_0x3775('0x38')]),_0xae154d);if(_0x3f9c01[_0x3775('0x2f')][_0x3775('0x39')]){_0xa174ac[_0x3775('0x37')]=_[_0x3775('0x3a')](_0xa174ac['where'],{'$or':_['map'](_0xae154d,function(_0x4e1d4a){if(_0x4e1d4a[_0x3775('0x2d')]!=='VIRTUAL'){var _0x446e2c={};_0x446e2c[_0x4e1d4a[_0x3775('0x27')]]={'$like':'%'+_0x3f9c01['query'][_0x3775('0x39')]+'%'};return _0x446e2c;}})});}_0xa174ac=_[_0x3775('0x3a')]({},_0xa174ac,_0x3f9c01['options']);var _0xd78efa={'where':_0xa174ac[_0x3775('0x37')]};return db[_0x3775('0x3b')][_0x3775('0x3c')](_0xd78efa)[_0x3775('0x25')](function(_0x347165){_0x4882c7[_0x3775('0x3c')]=_0x347165;if(_0x3f9c01[_0x3775('0x2f')][_0x3775('0x3d')]){_0xa174ac['include']=[{'all':!![]}];}return db[_0x3775('0x3b')][_0x3775('0x3e')](_0xa174ac);})['then'](function(_0x46826e){_0x4882c7['rows']=_0x46826e;return _0x4882c7;})[_0x3775('0x25')](respondWithFilteredResult(_0x93397,_0xa174ac))[_0x3775('0x3f')](handleError(_0x93397,null));};exports['show']=function(_0x2d1cef,_0x89fc98){var _0x4bad02={'raw':!![],'where':{'id':_0x2d1cef[_0x3775('0x40')]['id']}},_0x13301f={};_0x13301f[_0x3775('0x31')]=_[_0x3775('0x41')](db[_0x3775('0x3b')][_0x3775('0x2b')]);_0x13301f[_0x3775('0x2f')]=_[_0x3775('0x41')](_0x2d1cef[_0x3775('0x2f')]);_0x13301f['filters']=_['intersection'](_0x13301f[_0x3775('0x31')],_0x13301f[_0x3775('0x2f')]);_0x4bad02[_0x3775('0x32')]=_[_0x3775('0x30')](_0x13301f[_0x3775('0x31')],qs[_0x3775('0x33')](_0x2d1cef['query']['fields']));_0x4bad02[_0x3775('0x32')]=_0x4bad02['attributes'][_0x3775('0x34')]?_0x4bad02[_0x3775('0x32')]:_0x13301f[_0x3775('0x31')];if(_0x2d1cef[_0x3775('0x2f')][_0x3775('0x3d')]){_0x4bad02[_0x3775('0x42')]=[{'all':!![]}];}_0x4bad02=_[_0x3775('0x3a')]({},_0x4bad02,_0x2d1cef[_0x3775('0x43')]);return db['ChatInternalMessage']['find'](_0x4bad02)[_0x3775('0x25')](handleEntityNotFound(_0x89fc98,null))[_0x3775('0x25')](respondWithResult(_0x89fc98,null))['catch'](handleError(_0x89fc98,null));};exports['create']=function(_0x198955,_0x141e93){return db[_0x3775('0x3b')][_0x3775('0x44')](_0x198955[_0x3775('0x45')],{})[_0x3775('0x25')](respondWithResult(_0x141e93,0xc9))[_0x3775('0x3f')](handleError(_0x141e93,null));};exports[_0x3775('0x24')]=function(_0x29d824,_0xdca0dc){if(_0x29d824['body']['id']){delete _0x29d824[_0x3775('0x45')]['id'];}return db['ChatInternalMessage'][_0x3775('0x46')]({'where':{'id':_0x29d824['params']['id']}})[_0x3775('0x25')](handleEntityNotFound(_0xdca0dc,null))[_0x3775('0x25')](saveUpdates(_0x29d824['body'],null))['then'](respondWithResult(_0xdca0dc,null))[_0x3775('0x3f')](handleError(_0xdca0dc,null));};exports[_0x3775('0x26')]=function(_0x21176f,_0x1bd415){return db[_0x3775('0x3b')][_0x3775('0x46')]({'where':{'id':_0x21176f[_0x3775('0x40')]['id']}})['then'](handleEntityNotFound(_0x1bd415,null))['then'](removeEntity(_0x1bd415,null))['catch'](handleError(_0x1bd415,null));};exports[_0x3775('0x47')]=function(_0x5ce0e1,_0x2bdd87){return db['ChatInternalMessage'][_0x3775('0x47')]()['then'](respondWithResult(_0x2bdd87,null))['catch'](handleError(_0x2bdd87,null));};function wrapUser(_0x23fb78){return function(_0x3ace91){var _0x3bd3b1=_0x23fb78[_0x3775('0x48')]({'plain':!![]});_0x3bd3b1[_0x3775('0x49')]=[];if(_0x3ace91){_0x3bd3b1[_0x3775('0x4a')]=_0x3ace91[_0x3775('0x4b')];_0x3bd3b1[_0x3775('0x4c')]=_0x3ace91;}else{_0x3bd3b1[_0x3775('0x4a')]=moment(0x0)[_0x3775('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bd3b1['lastMessage']={};}return _0x3bd3b1;};}exports[_0x3775('0x4e')]=function(_0x52fcdf,_0x1a1fb9,_0x17aaf7){var _0x1aaa9e=[];return db[_0x3775('0x4f')][_0x3775('0x3e')]({'where':{'role':[_0x3775('0x50'),_0x3775('0x51'),_0x3775('0x52')]},'attributes':['id',_0x3775('0x53'),_0x3775('0x27'),_0x3775('0x54'),_0x3775('0x55'),_0x3775('0x56'),_0x3775('0x57'),_0x3775('0x58'),_0x3775('0x59'),'showWebBar'],'order':qs[_0x3775('0x5a')](_0x3775('0x5b')),'include':[{'model':db[_0x3775('0x5c')],'as':_0x3775('0x5d'),'attributes':['id',_0x3775('0x27'),'type'],'through':{'attributes':[]}}]})[_0x3775('0x25')](function(_0x59d144){if(_0x59d144){var _0x52c45b=_0x52fcdf['user'][_0x3775('0x48')]({'plain':!![]});if(!_0x52c45b)throw new Error(_0x3775('0x5e'));if(_0x52c45b[_0x3775('0x54')]===_0x3775('0x52')){return db[_0x3775('0x5f')]['find']({'where':{'name':_0x3775('0x60'),'userProfileId':_0x52c45b[_0x3775('0x61')]},'raw':!![]})[_0x3775('0x25')](function(_0x79e080){if(_0x79e080){if(_0x79e080[_0x3775('0x62')]===0x0){return db[_0x3775('0x63')][_0x3775('0x3e')]({'where':{'sectionId':_0x79e080['id']},'raw':!![]})['then'](function(_0x14f6c9){var _0x5eb2b0=[];if(_[_0x3775('0x64')](_0x14f6c9)){_0x5eb2b0=_['filter'](_0x59d144,function(_0x24e66e){if(_0x24e66e['role']!==_0x3775('0x50')){return _0x24e66e;}});return _0x5eb2b0;}else{for(var _0x3244e4=0x0;_0x3244e4<_0x59d144[_0x3775('0x34')];_0x3244e4++){var _0xa8862b=_0x59d144[_0x3244e4];if(_0xa8862b[_0x3775('0x54')]===_0x3775('0x50')){var _0x208f83=_[_0x3775('0x46')](_0x14f6c9,function(_0x25b7da){return _0x25b7da[_0x3775('0x65')]===_0xa8862b['id'];});if(_0x208f83)_0x5eb2b0[_0x3775('0x66')](_0xa8862b);}else{_0x5eb2b0[_0x3775('0x66')](_0xa8862b);}}return _0x5eb2b0;}});}else{return _0x59d144;}}else{var _0x154134=_['filter'](_0x59d144,function(_0x9a7833){if(_0x9a7833['role']!==_0x3775('0x50')){return _0x9a7833;}});return _0x154134;}});}else{return _0x59d144;}}})[_0x3775('0x25')](function(_0x21f7df){var _0x42a135=[];if(_0x21f7df){_0x1aaa9e=_0x21f7df;for(var _0x267052=0x0;_0x267052<_0x21f7df[_0x3775('0x34')];_0x267052+=0x1){_0x1aaa9e[_0x267052][_0x3775('0x49')]=[];_0x42a135[_0x3775('0x66')](db['ChatInternalMessage'][_0x3775('0x46')]({'where':{'FromId':[_0x52fcdf[_0x3775('0x52')]['id'],_0x21f7df[_0x267052]['id']],'ToId':[_0x52fcdf[_0x3775('0x52')]['id'],_0x21f7df[_0x267052]['id']],'ChatGroupId':null},'attributes':['id',_0x3775('0x4b'),_0x3775('0x67'),_0x3775('0x68'),_0x3775('0x69'),_0x3775('0x45')],'order':qs[_0x3775('0x5a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x21f7df[_0x267052])));}return BPromise['all'](_0x42a135);}return[];})[_0x3775('0x25')](function(_0x40a1e3){return{'rows':_0x40a1e3,'count':_0x40a1e3[_0x3775('0x34')]};})['then'](respondWithResult(_0x1a1fb9,null))[_0x3775('0x3f')](handleError(_0x1a1fb9,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 45a6234..52bc73a 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 _0x6755=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x1a45e3,_0x385589){var _0x3615f8=function(_0x40ce0a){while(--_0x40ce0a){_0x1a45e3['push'](_0x1a45e3['shift']());}};_0x3615f8(++_0x385589);}(_0x6755,0x193));var _0x5675=function(_0x2ff24c,_0x14a10f){_0x2ff24c=_0x2ff24c-0x0;var _0xad1b68=_0x6755[_0x2ff24c];return _0xad1b68;};'use strict';var EventEmitter=require(_0x5675('0x0'));var ChatInternalMessage=require(_0x5675('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5675('0x2')](0x0);var events={'afterCreate':_0x5675('0x3'),'afterUpdate':'update','afterDestroy':_0x5675('0x4')};function emitEvent(_0x33a71d){return function(_0x507a30,_0x16f508,_0x4a87ab){ChatInternalMessageEvents[_0x5675('0x5')](_0x33a71d+':'+_0x507a30['id'],_0x507a30);ChatInternalMessageEvents[_0x5675('0x5')](_0x33a71d,_0x507a30);_0x4a87ab(null);};}for(var e in events){if(events[_0x5675('0x6')](e)){var event=events[e];ChatInternalMessage[_0x5675('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x9c1e=['hook','exports','events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dab2b,_0x573330){var _0x30aad0=function(_0x40c6b0){while(--_0x40c6b0){_0x3dab2b['push'](_0x3dab2b['shift']());}};_0x30aad0(++_0x573330);}(_0x9c1e,0x66));var _0xe9c1=function(_0x45e05c,_0x149951){_0x45e05c=_0x45e05c-0x0;var _0x877000=_0x9c1e[_0x45e05c];return _0x877000;};'use strict';var EventEmitter=require(_0xe9c1('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xe9c1('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe9c1('0x2')](0x0);var events={'afterCreate':_0xe9c1('0x3'),'afterUpdate':_0xe9c1('0x4'),'afterDestroy':_0xe9c1('0x5')};function emitEvent(_0x2dd36b){return function(_0x13a41d,_0x3c7da2,_0x47a8c8){ChatInternalMessageEvents[_0xe9c1('0x6')](_0x2dd36b+':'+_0x13a41d['id'],_0x13a41d);ChatInternalMessageEvents['emit'](_0x2dd36b,_0x13a41d);_0x47a8c8(null);};}for(var e in events){if(events[_0xe9c1('0x7')](e)){var event=events[e];ChatInternalMessage[_0xe9c1('0x8')](e,emitEvent(event));}}module[_0xe9c1('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 374747f..f049657 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 _0x529c=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','util','../../config/logger','api','path','../../config/environment','./chatInternalMessage.attributes'];(function(_0x242c29,_0x168f0a){var _0x3f4d1c=function(_0x87d119){while(--_0x87d119){_0x242c29['push'](_0x242c29['shift']());}};_0x3f4d1c(++_0x168f0a);}(_0x529c,0x170));var _0xc529=function(_0x542fc9,_0x19be0f){_0x542fc9=_0x542fc9-0x0;var _0x14f212=_0x529c[_0x542fc9];return _0x14f212;};'use strict';var _=require('lodash');var util=require(_0xc529('0x0'));var logger=require(_0xc529('0x1'))(_0xc529('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc529('0x3'));var rimraf=require('rimraf');var config=require(_0xc529('0x4'));var attributes=require(_0xc529('0x5'));module[_0xc529('0x6')]=function(_0x36b6f1,_0x260672){return _0x36b6f1[_0xc529('0x7')](_0xc529('0x8'),attributes,{'tableName':_0xc529('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc529('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x05f3=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes'];(function(_0x509b9d,_0x5d08e9){var _0x312b58=function(_0x314649){while(--_0x314649){_0x509b9d['push'](_0x509b9d['shift']());}};_0x312b58(++_0x5d08e9);}(_0x05f3,0x19b));var _0x305f=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x05f3[_0x25662e];return _0x59b7bc;};'use strict';var _=require(_0x305f('0x0'));var util=require(_0x305f('0x1'));var logger=require('../../config/logger')(_0x305f('0x2'));var moment=require(_0x305f('0x3'));var BPromise=require(_0x305f('0x4'));var rp=require(_0x305f('0x5'));var fs=require('fs');var path=require(_0x305f('0x6'));var rimraf=require('rimraf');var config=require(_0x305f('0x7'));var attributes=require(_0x305f('0x8'));module[_0x305f('0x9')]=function(_0x152167,_0x527440){return _0x152167[_0x305f('0xa')](_0x305f('0xb'),attributes,{'tableName':_0x305f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x305f('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index bedfbc1..4f564fb 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 _0xaff8=['register','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaff8,0x78));var _0x8aff=function(_0x4cd22f,_0x57c3ea){_0x4cd22f=_0x4cd22f-0x0;var _0x2342d3=_0xaff8[_0x4cd22f];return _0x2342d3;};'use strict';var _=require(_0x8aff('0x0'));var util=require('util');var moment=require(_0x8aff('0x1'));var BPromise=require(_0x8aff('0x2'));var rs=require(_0x8aff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8aff('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8aff('0x5'));var config=require(_0x8aff('0x6'));var jayson=require(_0x8aff('0x7'));var client=jayson[_0x8aff('0x8')][_0x8aff('0x9')]({'port':0x232a});config['redis']=_[_0x8aff('0xa')](config['redis'],{'host':_0x8aff('0xb'),'port':0x18eb});var socket=require(_0x8aff('0xc'))(new Redis(config[_0x8aff('0xd')]));require(_0x8aff('0xe'))[_0x8aff('0xf')](socket);function respondWithRpcPromise(_0x3b8a8c,_0x1e6747,_0x4a8b09){return new BPromise(function(_0x3ecdc9,_0x575fe7){return client['request'](_0x3b8a8c,_0x4a8b09)[_0x8aff('0x10')](function(_0x549613){logger[_0x8aff('0x11')](_0x8aff('0x12'),_0x1e6747,'request\x20sent');logger['debug'](_0x8aff('0x13'),_0x1e6747,_0x8aff('0x14'),JSON[_0x8aff('0x15')](_0x549613));if(_0x549613[_0x8aff('0x16')]){if(_0x549613[_0x8aff('0x16')][_0x8aff('0x17')]===0x1f4){logger[_0x8aff('0x16')](_0x8aff('0x12'),_0x1e6747,_0x549613[_0x8aff('0x16')]['message']);return _0x575fe7(_0x549613[_0x8aff('0x16')][_0x8aff('0x18')]);}logger[_0x8aff('0x16')](_0x8aff('0x12'),_0x1e6747,_0x549613[_0x8aff('0x16')][_0x8aff('0x18')]);return _0x3ecdc9(_0x549613['error'][_0x8aff('0x18')]);}else{logger[_0x8aff('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x1e6747,_0x8aff('0x14'));_0x3ecdc9(_0x549613[_0x8aff('0x19')][_0x8aff('0x18')]);}})[_0x8aff('0x1a')](function(_0x2ee920){logger[_0x8aff('0x16')](_0x8aff('0x12'),_0x1e6747,_0x2ee920);_0x575fe7(_0x2ee920);});});} \ No newline at end of file +var _0x2c2b=['catch','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result'];(function(_0x555128,_0x534dae){var _0x504b88=function(_0x29b551){while(--_0x29b551){_0x555128['push'](_0x555128['shift']());}};_0x504b88(++_0x534dae);}(_0x2c2b,0x1b1));var _0xb2c2=function(_0x477b78,_0x302499){_0x477b78=_0x477b78-0x0;var _0x2f3f99=_0x2c2b[_0x477b78];return _0x2f3f99;};'use strict';var _=require('lodash');var util=require(_0xb2c2('0x0'));var moment=require(_0xb2c2('0x1'));var BPromise=require(_0xb2c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2c2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2c2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb2c2('0x5'));var client=jayson[_0xb2c2('0x6')][_0xb2c2('0x7')]({'port':0x232a});config[_0xb2c2('0x8')]=_[_0xb2c2('0x9')](config[_0xb2c2('0x8')],{'host':_0xb2c2('0xa'),'port':0x18eb});var socket=require(_0xb2c2('0xb'))(new Redis(config[_0xb2c2('0x8')]));require(_0xb2c2('0xc'))[_0xb2c2('0xd')](socket);function respondWithRpcPromise(_0x2280ca,_0x475bae,_0x45d1c5){return new BPromise(function(_0x32301c,_0x2876d9){return client[_0xb2c2('0xe')](_0x2280ca,_0x45d1c5)[_0xb2c2('0xf')](function(_0x19e897){logger[_0xb2c2('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x475bae,_0xb2c2('0x11'));logger[_0xb2c2('0x12')](_0xb2c2('0x13'),_0x475bae,_0xb2c2('0x11'),JSON[_0xb2c2('0x14')](_0x19e897));if(_0x19e897['error']){if(_0x19e897[_0xb2c2('0x15')][_0xb2c2('0x16')]===0x1f4){logger[_0xb2c2('0x15')](_0xb2c2('0x17'),_0x475bae,_0x19e897[_0xb2c2('0x15')][_0xb2c2('0x18')]);return _0x2876d9(_0x19e897[_0xb2c2('0x15')]['message']);}logger[_0xb2c2('0x15')](_0xb2c2('0x17'),_0x475bae,_0x19e897[_0xb2c2('0x15')][_0xb2c2('0x18')]);return _0x32301c(_0x19e897['error'][_0xb2c2('0x18')]);}else{logger[_0xb2c2('0x10')](_0xb2c2('0x17'),_0x475bae,_0xb2c2('0x11'));_0x32301c(_0x19e897[_0xb2c2('0x19')]['message']);}})[_0xb2c2('0x1a')](function(_0x15469b){logger[_0xb2c2('0x15')](_0xb2c2('0x17'),_0x475bae,_0x15469b);_0x2876d9(_0x15469b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d1f8624..f3ca89c 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 _0x5073=['save','remove','update','emit','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x1db506,_0x1a4765){var _0x398baf=function(_0x47fbbb){while(--_0x47fbbb){_0x1db506['push'](_0x1db506['shift']());}};_0x398baf(++_0x1a4765);}(_0x5073,0x157));var _0x3507=function(_0x5645ad,_0x580ea3){_0x5645ad=_0x5645ad-0x0;var _0x17d292=_0x5073[_0x5645ad];return _0x17d292;};'use strict';var ChatInternalMessageEvents=require(_0x3507('0x0'));var events=[_0x3507('0x1'),_0x3507('0x2'),_0x3507('0x3')];function createListener(_0x3cb018,_0x5ded8d){return function(_0x240145){_0x5ded8d[_0x3507('0x4')](_0x3cb018,_0x240145);};}function removeListener(_0x384dad,_0x3fe81f){return function(){ChatInternalMessageEvents['removeListener'](_0x384dad,_0x3fe81f);};}exports[_0x3507('0x5')]=function(_0x1f31e1){for(var _0x916f32=0x0,_0x48ed0d=events[_0x3507('0x6')];_0x916f32<_0x48ed0d;_0x916f32++){var _0x464be5=events[_0x916f32];var _0x49a6bd=createListener(_0x3507('0x7')+_0x464be5,_0x1f31e1);ChatInternalMessageEvents['on'](_0x464be5,_0x49a6bd);}}; \ No newline at end of file +var _0x0c3a=['register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0c3a,0x1d2));var _0xa0c3=function(_0x28b33c,_0x360db3){_0x28b33c=_0x28b33c-0x0;var _0x238f9d=_0x0c3a[_0x28b33c];return _0x238f9d;};'use strict';var ChatInternalMessageEvents=require(_0xa0c3('0x0'));var events=[_0xa0c3('0x1'),_0xa0c3('0x2'),_0xa0c3('0x3')];function createListener(_0x2d069c,_0x28ef30){return function(_0x27f2d1){_0x28ef30[_0xa0c3('0x4')](_0x2d069c,_0x27f2d1);};}function removeListener(_0x3ab239,_0x18b0b9){return function(){ChatInternalMessageEvents[_0xa0c3('0x5')](_0x3ab239,_0x18b0b9);};}exports[_0xa0c3('0x6')]=function(_0x9621d9){for(var _0x49d14a=0x0,_0x2dca15=events['length'];_0x49d14a<_0x2dca15;_0x49d14a++){var _0x480fa0=events[_0x49d14a];var _0x5579b4=createListener(_0xa0c3('0x7')+_0x480fa0,_0x9621d9);ChatInternalMessageEvents['on'](_0x480fa0,_0x5579b4);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a2e878d..8cb2790 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 _0xcf31=['put','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getUsers','/:id','show','post'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xcf31,0x7b));var _0x1cf3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf31[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x1cf3('0x0'));var util=require(_0x1cf3('0x1'));var path=require(_0x1cf3('0x2'));var timeout=require(_0x1cf3('0x3'));var express=require(_0x1cf3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1cf3('0x5'));var interaction=require(_0x1cf3('0x6'));var config=require(_0x1cf3('0x7'));var controller=require('./chatInternalMessage.controller');router[_0x1cf3('0x8')]('/',auth[_0x1cf3('0x9')](),controller[_0x1cf3('0xa')]);router[_0x1cf3('0x8')](_0x1cf3('0xb'),auth[_0x1cf3('0x9')](),controller[_0x1cf3('0xc')]);router[_0x1cf3('0x8')]('/users',auth['isAuthenticated'](),controller[_0x1cf3('0xd')]);router['get'](_0x1cf3('0xe'),auth['isAuthenticated'](),controller[_0x1cf3('0xf')]);router[_0x1cf3('0x10')]('/',auth[_0x1cf3('0x9')](),controller['create']);router[_0x1cf3('0x11')](_0x1cf3('0xe'),controller['update']);router[_0x1cf3('0x12')]('/:id',auth[_0x1cf3('0x9')](),controller['destroy']);module[_0x1cf3('0x13')]=router; \ No newline at end of file +var _0x97cb=['../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x14933b,_0x2cb50f){var _0x2b4ee0=function(_0x5c92d0){while(--_0x5c92d0){_0x14933b['push'](_0x14933b['shift']());}};_0x2b4ee0(++_0x2cb50f);}(_0x97cb,0x125));var _0xb97c=function(_0x5a0a6b,_0x90bce8){_0x5a0a6b=_0x5a0a6b-0x0;var _0x1cf79d=_0x97cb[_0x5a0a6b];return _0x1cf79d;};'use strict';var multer=require(_0xb97c('0x0'));var util=require(_0xb97c('0x1'));var path=require(_0xb97c('0x2'));var timeout=require(_0xb97c('0x3'));var express=require('express');var router=express[_0xb97c('0x4')]();var fs_extra=require(_0xb97c('0x5'));var auth=require(_0xb97c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb97c('0x7'));var controller=require(_0xb97c('0x8'));router[_0xb97c('0x9')]('/',auth[_0xb97c('0xa')](),controller[_0xb97c('0xb')]);router[_0xb97c('0x9')](_0xb97c('0xc'),auth[_0xb97c('0xa')](),controller[_0xb97c('0xd')]);router[_0xb97c('0x9')](_0xb97c('0xe'),auth['isAuthenticated'](),controller[_0xb97c('0xf')]);router[_0xb97c('0x9')]('/:id',auth[_0xb97c('0xa')](),controller[_0xb97c('0x10')]);router[_0xb97c('0x11')]('/',auth[_0xb97c('0xa')](),controller[_0xb97c('0x12')]);router[_0xb97c('0x13')](_0xb97c('0x14'),controller['update']);router[_0xb97c('0x15')](_0xb97c('0x14'),auth[_0xb97c('0xa')](),controller['destroy']);module[_0xb97c('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f4ebcb7..2b7d7c1 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 _0xf7b4=['STRING','TEXT','sequelize','medium','BOOLEAN','out','DATE'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xf7b4,0x152));var _0x4f7b=function(_0x44ba3d,_0x363415){_0x44ba3d=_0x44ba3d-0x0;var _0x350ad9=_0xf7b4[_0x44ba3d];return _0x350ad9;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x4f7b('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4f7b('0x3')),'defaultValue':_0x4f7b('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4f7b('0x4')]},'providerName':{'type':Sequelize[_0x4f7b('0x5')]},'providerResponse':{'type':Sequelize[_0x4f7b('0x6')]}}; \ No newline at end of file +var _0x6739=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6739,0xd3));var _0x9673=function(_0x417835,_0x568e4b){_0x417835=_0x417835-0x0;var _0x35c48f=_0x6739[_0x417835];return _0x35c48f;};'use strict';var Sequelize=require(_0x9673('0x0'));module[_0x9673('0x1')]={'body':{'type':Sequelize[_0x9673('0x2')](_0x9673('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9673('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9673('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x9673('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x9673('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 488a559..e816c14 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 _0xfd12=['socket.io-emitter','./chatMessage.socket','register','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ChatMessage','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','find','create','body','chat-interactions','accept','chat','read','readAt','format','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','info','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','event','rejectmessage','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost'];(function(_0x59f2e1,_0x484830){var _0x3e4dfb=function(_0x1c6dbe){while(--_0x1c6dbe){_0x59f2e1['push'](_0x59f2e1['shift']());}};_0x3e4dfb(++_0x484830);}(_0xfd12,0x182));var _0x2fd1=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0xfd12[_0x1d04b5];return _0x161342;};'use strict';var emlformat=require(_0x2fd1('0x0'));var rimraf=require(_0x2fd1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2fd1('0x2'));var rp=require('request-promise');var moment=require(_0x2fd1('0x3'));var BPromise=require(_0x2fd1('0x4'));var Mustache=require(_0x2fd1('0x5'));var util=require(_0x2fd1('0x6'));var path=require(_0x2fd1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2fd1('0x8'));var fs=require('fs');var fs_extra=require(_0x2fd1('0x9'));var _=require(_0x2fd1('0xa'));var squel=require(_0x2fd1('0xb'));var crypto=require('crypto');var jsforce=require(_0x2fd1('0xc'));var deskjs=require(_0x2fd1('0xd'));var toCsv=require(_0x2fd1('0xe'));var querystring=require(_0x2fd1('0xf'));var Papa=require(_0x2fd1('0x10'));var Redis=require(_0x2fd1('0x11'));var authService=require(_0x2fd1('0x12'));var qs=require(_0x2fd1('0x13'));var as=require(_0x2fd1('0x14'));var hardwareService=require(_0x2fd1('0x15'));var logger=require(_0x2fd1('0x16'))(_0x2fd1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2fd1('0x18'))['db'];config[_0x2fd1('0x19')]=_[_0x2fd1('0x1a')](config[_0x2fd1('0x19')],{'host':_0x2fd1('0x1b'),'port':0x18eb});var socket=require(_0x2fd1('0x1c'))(new Redis(config[_0x2fd1('0x19')]));require(_0x2fd1('0x1d'))[_0x2fd1('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2fd1('0x1f')][_0x2fd1('0x20')]({'port':0x232c});var client9002=jayson[_0x2fd1('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ab88,_0x20590a,_0x54c126,_0xaee9fc){return new BPromise(function(_0x34236b,_0x558c51){var _0x3fb9e6=_0xaee9fc||client;return _0x3fb9e6[_0x2fd1('0x21')](_0x30ab88,_0x54c126)[_0x2fd1('0x22')](function(_0x440667){logger['info']('ChatMessage,\x20%s,\x20%s',_0x20590a,_0x2fd1('0x23'));logger[_0x2fd1('0x24')](_0x2fd1('0x25'),_0x20590a,_0x2fd1('0x23'),JSON[_0x2fd1('0x26')](_0x440667));if(_0x440667[_0x2fd1('0x27')]){if(_0x440667[_0x2fd1('0x27')][_0x2fd1('0x28')]===0x1f4){logger['error'](_0x2fd1('0x29'),_0x20590a,_0x440667[_0x2fd1('0x27')][_0x2fd1('0x2a')]);return _0x558c51(_0x440667['error'][_0x2fd1('0x2a')]);}logger[_0x2fd1('0x27')]('ChatMessage,\x20%s,\x20%s',_0x20590a,_0x440667['error'][_0x2fd1('0x2a')]);return _0x34236b(_0x440667['error']['message']);}else{logger['info'](_0x2fd1('0x29'),_0x20590a,_0x2fd1('0x23'));_0x34236b(_0x440667[_0x2fd1('0x2b')][_0x2fd1('0x2a')]);}})[_0x2fd1('0x2c')](function(_0x14208e){logger[_0x2fd1('0x27')]('ChatMessage,\x20%s,\x20%s',_0x20590a,_0x14208e);_0x558c51(_0x14208e);});});}function respondWithStatusCode(_0x493663,_0xb0532f){_0xb0532f=_0xb0532f||0xcc;return function(_0x204a9d){if(_0x204a9d){return _0x493663[_0x2fd1('0x2d')](_0xb0532f);}return _0x493663[_0x2fd1('0x2e')](_0xb0532f)[_0x2fd1('0x2f')]();};}function respondWithResult(_0x5d2b4c,_0x482748){_0x482748=_0x482748||0xc8;return function(_0x229613){if(_0x229613){return _0x5d2b4c['status'](_0x482748)[_0x2fd1('0x30')](_0x229613);}};}function respondWithFilteredResult(_0x1ccd14,_0x466110){return function(_0x4d6de9){if(_0x4d6de9){var _0x33fcda=typeof _0x466110[_0x2fd1('0x31')]===_0x2fd1('0x32')&&typeof _0x466110['limit']===_0x2fd1('0x32');var _0x2994f2=_0x4d6de9[_0x2fd1('0x33')];var _0x10d848=_0x33fcda?0x0:_0x466110['offset'];var _0x1bbcea=_0x33fcda?_0x4d6de9[_0x2fd1('0x33')]:_0x466110[_0x2fd1('0x31')]+_0x466110[_0x2fd1('0x34')];var _0x4a475c;if(_0x1bbcea>=_0x2994f2){_0x1bbcea=_0x2994f2;_0x4a475c=0xc8;}else{_0x4a475c=0xce;}_0x1ccd14[_0x2fd1('0x2e')](_0x4a475c);return _0x1ccd14[_0x2fd1('0x35')](_0x2fd1('0x36'),_0x10d848+'-'+_0x1bbcea+'/'+_0x2994f2)['json'](_0x4d6de9);}return null;};}function patchUpdates(_0x4286e8){return function(_0x37f281){try{jsonpatch[_0x2fd1('0x37')](_0x37f281,_0x4286e8,!![]);}catch(_0x4b6ceb){return BPromise[_0x2fd1('0x38')](_0x4b6ceb);}return _0x37f281[_0x2fd1('0x39')]();};}function saveUpdates(_0x15bfe3,_0x25b65f){return function(_0x287457){if(_0x287457){return _0x287457[_0x2fd1('0x3a')](_0x15bfe3)['then'](function(_0x5a1787){return _0x5a1787;});}return null;};}function removeEntity(_0x5c87bf,_0x1cff54){return function(_0x4d08d2){if(_0x4d08d2){return _0x4d08d2[_0x2fd1('0x3b')]()[_0x2fd1('0x22')](function(){_0x5c87bf[_0x2fd1('0x2e')](0xcc)[_0x2fd1('0x2f')]();});}};}function handleEntityNotFound(_0x52ea0d,_0x2245b5){return function(_0x14458e){if(!_0x14458e){_0x52ea0d['sendStatus'](0x194);}return _0x14458e;};}function handleError(_0x1b9f11,_0x3ccb12){_0x3ccb12=_0x3ccb12||0x1f4;return function(_0x37db3c){logger[_0x2fd1('0x27')](_0x37db3c['stack']);if(_0x37db3c[_0x2fd1('0x3c')]){delete _0x37db3c['name'];}_0x1b9f11[_0x2fd1('0x2e')](_0x3ccb12)[_0x2fd1('0x3d')](_0x37db3c);};}exports[_0x2fd1('0x3e')]=function(_0x2d9a09,_0x26baaf){var _0x9fed8={},_0x50eb8f={},_0x87e288={'count':0x0,'rows':[]};var _0xae0211=_[_0x2fd1('0x3f')](db[_0x2fd1('0x40')][_0x2fd1('0x41')],function(_0x3ed34b){return{'name':_0x3ed34b['fieldName'],'type':_0x3ed34b[_0x2fd1('0x42')]['key']};});_0x50eb8f[_0x2fd1('0x43')]=_['map'](_0xae0211,_0x2fd1('0x3c'));_0x50eb8f[_0x2fd1('0x44')]=_['keys'](_0x2d9a09['query']);_0x50eb8f[_0x2fd1('0x45')]=_[_0x2fd1('0x46')](_0x50eb8f[_0x2fd1('0x43')],_0x50eb8f[_0x2fd1('0x44')]);_0x9fed8[_0x2fd1('0x47')]=_['intersection'](_0x50eb8f[_0x2fd1('0x43')],qs[_0x2fd1('0x48')](_0x2d9a09[_0x2fd1('0x44')][_0x2fd1('0x48')]));_0x9fed8[_0x2fd1('0x47')]=_0x9fed8[_0x2fd1('0x47')][_0x2fd1('0x49')]?_0x9fed8['attributes']:_0x50eb8f[_0x2fd1('0x43')];if(!_0x2d9a09[_0x2fd1('0x44')][_0x2fd1('0x4a')](_0x2fd1('0x4b'))){_0x9fed8[_0x2fd1('0x34')]=qs[_0x2fd1('0x34')](_0x2d9a09[_0x2fd1('0x44')][_0x2fd1('0x34')]);_0x9fed8[_0x2fd1('0x31')]=qs[_0x2fd1('0x31')](_0x2d9a09[_0x2fd1('0x44')][_0x2fd1('0x31')]);}_0x9fed8[_0x2fd1('0x4c')]=qs[_0x2fd1('0x4d')](_0x2d9a09[_0x2fd1('0x44')][_0x2fd1('0x4d')]);_0x9fed8['where']=qs[_0x2fd1('0x45')](_[_0x2fd1('0x4e')](_0x2d9a09[_0x2fd1('0x44')],_0x50eb8f[_0x2fd1('0x45')]),_0xae0211);if(_0x2d9a09[_0x2fd1('0x44')][_0x2fd1('0x4f')]){_0x9fed8[_0x2fd1('0x50')]=_['merge'](_0x9fed8[_0x2fd1('0x50')],{'$or':_['map'](_0xae0211,function(_0x5ff344){if(_0x5ff344['type']!==_0x2fd1('0x51')){var _0x2c0f07={};_0x2c0f07[_0x5ff344[_0x2fd1('0x3c')]]={'$like':'%'+_0x2d9a09[_0x2fd1('0x44')]['filter']+'%'};return _0x2c0f07;}})});}_0x9fed8=_[_0x2fd1('0x52')]({},_0x9fed8,_0x2d9a09[_0x2fd1('0x53')]);var _0x564d45={'where':_0x9fed8[_0x2fd1('0x50')]};return db['ChatMessage'][_0x2fd1('0x33')](_0x564d45)['then'](function(_0x56ceb1){_0x87e288[_0x2fd1('0x33')]=_0x56ceb1;if(_0x2d9a09[_0x2fd1('0x44')]['includeAll']){_0x9fed8['include']=[{'all':!![]}];}return db[_0x2fd1('0x40')][_0x2fd1('0x54')](_0x9fed8);})[_0x2fd1('0x22')](function(_0x26b37b){_0x87e288[_0x2fd1('0x55')]=_0x26b37b;return _0x87e288;})[_0x2fd1('0x22')](respondWithFilteredResult(_0x26baaf,_0x9fed8))[_0x2fd1('0x2c')](handleError(_0x26baaf,null));};exports[_0x2fd1('0x56')]=function(_0x5bcdb5,_0x4b9b22){var _0x524cc1={'raw':!![],'where':{'id':_0x5bcdb5[_0x2fd1('0x57')]['id']}},_0x3ab610={};_0x3ab610['model']=_[_0x2fd1('0x58')](db[_0x2fd1('0x40')][_0x2fd1('0x41')]);_0x3ab610[_0x2fd1('0x44')]=_[_0x2fd1('0x58')](_0x5bcdb5[_0x2fd1('0x44')]);_0x3ab610['filters']=_[_0x2fd1('0x46')](_0x3ab610[_0x2fd1('0x43')],_0x3ab610[_0x2fd1('0x44')]);_0x524cc1[_0x2fd1('0x47')]=_[_0x2fd1('0x46')](_0x3ab610['model'],qs[_0x2fd1('0x48')](_0x5bcdb5[_0x2fd1('0x44')][_0x2fd1('0x48')]));_0x524cc1[_0x2fd1('0x47')]=_0x524cc1['attributes'][_0x2fd1('0x49')]?_0x524cc1[_0x2fd1('0x47')]:_0x3ab610[_0x2fd1('0x43')];if(_0x5bcdb5['query'][_0x2fd1('0x59')]){_0x524cc1[_0x2fd1('0x5a')]=[{'all':!![]}];}_0x524cc1=_['merge']({},_0x524cc1,_0x5bcdb5[_0x2fd1('0x53')]);return db['ChatMessage'][_0x2fd1('0x5b')](_0x524cc1)[_0x2fd1('0x22')](handleEntityNotFound(_0x4b9b22,null))[_0x2fd1('0x22')](respondWithResult(_0x4b9b22,null))[_0x2fd1('0x2c')](handleError(_0x4b9b22,null));};exports['create']=function(_0x2df881,_0x1177b8){return db[_0x2fd1('0x40')][_0x2fd1('0x5c')](_0x2df881['body'],{})[_0x2fd1('0x22')](respondWithResult(_0x1177b8,0xc9))[_0x2fd1('0x2c')](handleError(_0x1177b8,null));};exports['update']=function(_0x597694,_0x8f6958){if(_0x597694[_0x2fd1('0x5d')]['id']){delete _0x597694['body']['id'];}return db[_0x2fd1('0x40')]['find']({'where':{'id':_0x597694['params']['id']}})[_0x2fd1('0x22')](handleEntityNotFound(_0x8f6958,null))[_0x2fd1('0x22')](saveUpdates(_0x597694[_0x2fd1('0x5d')],null))[_0x2fd1('0x22')](respondWithResult(_0x8f6958,null))[_0x2fd1('0x2c')](handleError(_0x8f6958,null));};exports['destroy']=function(_0x217bab,_0xbe5945){return db[_0x2fd1('0x40')]['find']({'where':{'id':_0x217bab['params']['id']}})[_0x2fd1('0x22')](handleEntityNotFound(_0xbe5945,null))[_0x2fd1('0x22')](removeEntity(_0xbe5945,null))['catch'](handleError(_0xbe5945,null));};exports['describe']=function(_0x1482d7,_0x3dd884){return db[_0x2fd1('0x40')]['describe']()[_0x2fd1('0x22')](respondWithResult(_0x3dd884,null))[_0x2fd1('0x2c')](handleError(_0x3dd884,null));};var interaction_log=require(_0x2fd1('0x16'))(_0x2fd1('0x5e'));exports[_0x2fd1('0x5f')]=function(_0x47205b,_0x4fbc65,_0x43e866){var _0x51d885={'agent':{},'channel':_0x2fd1('0x60')};if(_0x47205b[_0x2fd1('0x5d')]['id']){delete _0x47205b[_0x2fd1('0x5d')]['id'];}_0x47205b[_0x2fd1('0x5d')][_0x2fd1('0x61')]=!![];_0x47205b[_0x2fd1('0x5d')][_0x2fd1('0x62')]=moment()[_0x2fd1('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x47205b['body']['UserId']=_0x47205b['body'][_0x2fd1('0x64')]||_0x47205b['user']['id'];_0x51d885[_0x2fd1('0x65')]['id']=_0x47205b[_0x2fd1('0x5d')][_0x2fd1('0x64')];return db[_0x2fd1('0x40')][_0x2fd1('0x5b')]({'where':{'id':_0x47205b[_0x2fd1('0x57')]['id'],'UserId':null}})[_0x2fd1('0x22')](handleEntityNotFound(_0x4fbc65,null))[_0x2fd1('0x22')](saveUpdates(_0x47205b['body'],null))[_0x2fd1('0x22')](function(_0x39b75b){if(_0x39b75b){_0x51d885[_0x2fd1('0x2a')]=_0x39b75b[_0x2fd1('0x66')]({'plain':!![]});return db[_0x2fd1('0x67')]['find']({'where':{'id':_0x39b75b[_0x2fd1('0x68')]}});}return null;})[_0x2fd1('0x22')](handleEntityNotFound(_0x4fbc65,null))[_0x2fd1('0x22')](function(_0x4deb12){if(_0x4deb12){return _0x4deb12['update']({'UserId':_0x47205b['body']['UserId'],'read1stAt':_[_0x2fd1('0x69')](_0x4deb12['read1stAt'])?moment()[_0x2fd1('0x63')](_0x2fd1('0x6a')):undefined});}return null;})[_0x2fd1('0x22')](function(_0x28fc2c){if(_0x28fc2c){_0x51d885[_0x2fd1('0x6b')]=_0x28fc2c[_0x2fd1('0x66')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47205b[_0x2fd1('0x6c')]['id'],_0x47205b[_0x2fd1('0x6c')][_0x2fd1('0x3c')],_0x47205b[_0x2fd1('0x6c')][_0x2fd1('0x6d')],_0x51d885['interaction']['id'],_0x47205b[_0x2fd1('0x5d')]?JSON['stringify'](_0x47205b[_0x2fd1('0x5d')]):_0x2fd1('0x6e'));return respondWithRpcPromise(_0x2fd1('0x6f'),_0x2fd1('0x70'),_0x51d885);}return null;})[_0x2fd1('0x22')](function(_0xe90551){var _0x553c36=_0x2fd1('0x71')+_0xe90551[_0x2fd1('0x2a')][_0x2fd1('0x72')];return db[_0x2fd1('0x73')][_0x2fd1('0x44')](_0x553c36,{'type':db[_0x2fd1('0x74')]['QueryTypes'][_0x2fd1('0x75')],'raw':!![]})[_0x2fd1('0x22')](function(_0x1dca8c){return _0x1dca8c;});})[_0x2fd1('0x22')](function(_0x1c1475){if(_0x1c1475){_0x51d885[_0x2fd1('0x2a')]['contact']=_0x1c1475[0x0];if(!_0x47205b[_0x2fd1('0x5d')]['UserId'])return;return db[_0x2fd1('0x76')][_0x2fd1('0x5b')]({'where':{'id':_0x47205b['body'][_0x2fd1('0x64')],'role':_0x2fd1('0x65')},'attributes':['id',_0x2fd1('0x3c'),_0x2fd1('0x77'),_0x2fd1('0x78'),_0x2fd1('0x79')],'raw':!![]});}return null;})['then'](function(_0x100596){if(!_0x100596)return null;_0x51d885[_0x2fd1('0x2a')][_0x2fd1('0x65')]=_0x100596;return _0x51d885;})[_0x2fd1('0x22')](function(_0xe272a2){if(_0xe272a2){if(_0x47205b[_0x2fd1('0x5d')][_0x2fd1('0x7a')]){_0x51d885[_0x2fd1('0x2a')][_0x2fd1('0x7b')]=util[_0x2fd1('0x63')](_0x2fd1('0x7c'),_0x47205b[_0x2fd1('0x6c')][_0x2fd1('0x3c')]);_0x51d885[_0x2fd1('0x2a')][_0x2fd1('0x7d')]=_0x51d885[_0x2fd1('0x7d')];_0x51d885[_0x2fd1('0x2a')][_0x2fd1('0x7e')]=_0x51d885[_0x2fd1('0x7d')];_0x51d885[_0x2fd1('0x2a')]['event']=_0x2fd1('0x5f');return respondWithRpcPromise(_0x2fd1('0x7f'),_0x2fd1('0x7f'),{'event':_0x2fd1('0x80'),'message':_['merge'](_0x51d885['message'],JSON[_0x2fd1('0x81')](_0x51d885['interaction'][_0x2fd1('0x82')]))},client9002)['then'](function(){return _0x51d885;});}return _0x51d885;}return null;})[_0x2fd1('0x22')](respondWithResult(_0x4fbc65,null))[_0x2fd1('0x2c')](handleError(_0x4fbc65,null));};var interaction_log=require('../../config/logger')(_0x2fd1('0x5e'));exports[_0x2fd1('0x38')]=function(_0x3258ba,_0x1eeba4,_0x21311f){var _0x5b8b58={'agent':{},'channel':_0x2fd1('0x60')};if(_0x3258ba[_0x2fd1('0x5d')]['id']){delete _0x3258ba[_0x2fd1('0x5d')]['id'];}_0x3258ba['body'][_0x2fd1('0x64')]=_0x3258ba[_0x2fd1('0x5d')][_0x2fd1('0x64')]||_0x3258ba[_0x2fd1('0x6c')]['id'];_0x5b8b58[_0x2fd1('0x65')]['id']=_0x3258ba[_0x2fd1('0x5d')]['UserId'];return db[_0x2fd1('0x40')]['find']({'where':{'id':_0x3258ba[_0x2fd1('0x57')]['id'],'UserId':null}})[_0x2fd1('0x22')](handleEntityNotFound(_0x1eeba4,null))[_0x2fd1('0x22')](function(_0x581a71){if(_0x581a71){_0x5b8b58[_0x2fd1('0x2a')]=_0x581a71[_0x2fd1('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x2fd1('0x5b')]({'where':{'id':_0x581a71[_0x2fd1('0x68')]}});}return null;})[_0x2fd1('0x22')](handleEntityNotFound(_0x1eeba4,null))[_0x2fd1('0x22')](function(_0x14c6f6){if(_0x14c6f6){_0x5b8b58['interaction']=_0x14c6f6['get']({'plain':!![]});interaction_log[_0x2fd1('0x83')](_0x2fd1('0x84'),_0x3258ba[_0x2fd1('0x6c')]['id'],_0x3258ba[_0x2fd1('0x6c')][_0x2fd1('0x3c')],_0x3258ba['user'][_0x2fd1('0x6d')],_0x5b8b58['interaction']['id'],_0x3258ba[_0x2fd1('0x5d')]?JSON[_0x2fd1('0x26')](_0x3258ba[_0x2fd1('0x5d')]):_0x2fd1('0x6e'));return respondWithRpcPromise(_0x2fd1('0x85'),_0x2fd1('0x86'),_0x5b8b58);}return null;})['then'](function(_0x5e4dd9){var _0x37f5f4=_0x2fd1('0x71')+_0x5e4dd9[_0x2fd1('0x2a')][_0x2fd1('0x72')];return db[_0x2fd1('0x73')]['query'](_0x37f5f4,{'type':db[_0x2fd1('0x74')]['QueryTypes'][_0x2fd1('0x75')],'raw':!![]})['then'](function(_0x422263){return _0x422263;});})[_0x2fd1('0x22')](function(_0x1f7c8c){if(_0x1f7c8c){_0x5b8b58[_0x2fd1('0x2a')][_0x2fd1('0x87')]=_0x1f7c8c[0x0];if(!_0x3258ba[_0x2fd1('0x5d')]['UserId'])return;return db[_0x2fd1('0x76')]['find']({'where':{'id':_0x3258ba[_0x2fd1('0x5d')][_0x2fd1('0x64')],'role':_0x2fd1('0x65')},'attributes':['id',_0x2fd1('0x3c'),_0x2fd1('0x77'),_0x2fd1('0x78'),_0x2fd1('0x79')],'raw':!![]});}return null;})[_0x2fd1('0x22')](function(_0x2dd721){if(!_0x2dd721)return null;_0x5b8b58[_0x2fd1('0x2a')][_0x2fd1('0x65')]=_0x2dd721;return _0x5b8b58;})[_0x2fd1('0x22')](function(_0x1cec20){if(_0x1cec20){_0x1cec20['message']['interface']=util[_0x2fd1('0x63')]('SIP/%s',_0x3258ba[_0x2fd1('0x6c')][_0x2fd1('0x3c')]);_0x1cec20[_0x2fd1('0x2a')][_0x2fd1('0x7d')]=_0x5b8b58[_0x2fd1('0x7d')];_0x1cec20['message'][_0x2fd1('0x7e')]=_0x5b8b58[_0x2fd1('0x7d')];_0x1cec20[_0x2fd1('0x2a')][_0x2fd1('0x88')]=_0x2fd1('0x38');respondWithRpcPromise('EventManager',_0x2fd1('0x7f'),{'event':_0x2fd1('0x89'),'message':_[_0x2fd1('0x52')](_0x5b8b58[_0x2fd1('0x2a')],JSON['parse'](_0x5b8b58[_0x2fd1('0x6b')][_0x2fd1('0x82')]))},client9002);return _0x5b8b58;}return null;})['then'](respondWithResult(_0x1eeba4,null))[_0x2fd1('0x2c')](handleError(_0x1eeba4,null));}; \ No newline at end of file +var _0xd6f3=['key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','intersection','include','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','interface','channel','motionChannel','event','EventManager','parse','interaction','formData','reject','RejectMessage','rejectMessage','SELECT','SIP/%s','rejectmessage','eml-format','rimraf','fast-json-patch','moment','util','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','name','map','ChatMessage','rawAttributes','fieldName'];(function(_0x7725cb,_0x4f6d61){var _0x37d020=function(_0x81e287){while(--_0x81e287){_0x7725cb['push'](_0x7725cb['shift']());}};_0x37d020(++_0x4f6d61);}(_0xd6f3,0xc1));var _0x3d6f=function(_0x316288,_0x48e05a){_0x316288=_0x316288-0x0;var _0x20a02a=_0xd6f3[_0x316288];return _0x20a02a;};'use strict';var emlformat=require(_0x3d6f('0x0'));var rimraf=require(_0x3d6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d6f('0x2'));var rp=require('request-promise');var moment=require(_0x3d6f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3d6f('0x4'));var path=require(_0x3d6f('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d6f('0x6'));var fs=require('fs');var fs_extra=require(_0x3d6f('0x7'));var _=require('lodash');var squel=require(_0x3d6f('0x8'));var crypto=require('crypto');var jsforce=require(_0x3d6f('0x9'));var deskjs=require(_0x3d6f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3d6f('0xb'));var Papa=require(_0x3d6f('0xc'));var Redis=require(_0x3d6f('0xd'));var authService=require(_0x3d6f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3d6f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d6f('0x10'))(_0x3d6f('0x11'));var utils=require(_0x3d6f('0x12'));var config=require(_0x3d6f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3d6f('0x14')]=_[_0x3d6f('0x15')](config[_0x3d6f('0x14')],{'host':_0x3d6f('0x16'),'port':0x18eb});var socket=require(_0x3d6f('0x17'))(new Redis(config[_0x3d6f('0x14')]));require(_0x3d6f('0x18'))[_0x3d6f('0x19')](socket);var jayson=require(_0x3d6f('0x1a'));var client=jayson[_0x3d6f('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x3d6f('0x1b')][_0x3d6f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x30c771,_0x41fb41,_0x1b4aaf,_0x178311){return new BPromise(function(_0x10e53a,_0x2080a3){var _0x3ed505=_0x178311||client;return _0x3ed505[_0x3d6f('0x1d')](_0x30c771,_0x1b4aaf)[_0x3d6f('0x1e')](function(_0x568c97){logger['info']('ChatMessage,\x20%s,\x20%s',_0x41fb41,_0x3d6f('0x1f'));logger[_0x3d6f('0x20')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x41fb41,_0x3d6f('0x1f'),JSON[_0x3d6f('0x21')](_0x568c97));if(_0x568c97['error']){if(_0x568c97[_0x3d6f('0x22')][_0x3d6f('0x23')]===0x1f4){logger[_0x3d6f('0x22')](_0x3d6f('0x24'),_0x41fb41,_0x568c97[_0x3d6f('0x22')][_0x3d6f('0x25')]);return _0x2080a3(_0x568c97[_0x3d6f('0x22')][_0x3d6f('0x25')]);}logger[_0x3d6f('0x22')](_0x3d6f('0x24'),_0x41fb41,_0x568c97[_0x3d6f('0x22')][_0x3d6f('0x25')]);return _0x10e53a(_0x568c97[_0x3d6f('0x22')]['message']);}else{logger[_0x3d6f('0x26')]('ChatMessage,\x20%s,\x20%s',_0x41fb41,_0x3d6f('0x1f'));_0x10e53a(_0x568c97['result'][_0x3d6f('0x25')]);}})[_0x3d6f('0x27')](function(_0x21708e){logger['error'](_0x3d6f('0x24'),_0x41fb41,_0x21708e);_0x2080a3(_0x21708e);});});}function respondWithStatusCode(_0x310d6e,_0xacfeb9){_0xacfeb9=_0xacfeb9||0xcc;return function(_0x4385af){if(_0x4385af){return _0x310d6e[_0x3d6f('0x28')](_0xacfeb9);}return _0x310d6e[_0x3d6f('0x29')](_0xacfeb9)[_0x3d6f('0x2a')]();};}function respondWithResult(_0xe16696,_0x1d75bc){_0x1d75bc=_0x1d75bc||0xc8;return function(_0x3e4fee){if(_0x3e4fee){return _0xe16696[_0x3d6f('0x29')](_0x1d75bc)[_0x3d6f('0x2b')](_0x3e4fee);}};}function respondWithFilteredResult(_0x33faf5,_0x35a364){return function(_0x4d5628){if(_0x4d5628){var _0x2d910e=typeof _0x35a364['offset']==='undefined'&&typeof _0x35a364[_0x3d6f('0x2c')]===_0x3d6f('0x2d');var _0x3b656a=_0x4d5628[_0x3d6f('0x2e')];var _0x14ad4f=_0x2d910e?0x0:_0x35a364[_0x3d6f('0x2f')];var _0x3fb7dc=_0x2d910e?_0x4d5628[_0x3d6f('0x2e')]:_0x35a364[_0x3d6f('0x2f')]+_0x35a364[_0x3d6f('0x2c')];var _0x482eb7;if(_0x3fb7dc>=_0x3b656a){_0x3fb7dc=_0x3b656a;_0x482eb7=0xc8;}else{_0x482eb7=0xce;}_0x33faf5[_0x3d6f('0x29')](_0x482eb7);return _0x33faf5[_0x3d6f('0x30')](_0x3d6f('0x31'),_0x14ad4f+'-'+_0x3fb7dc+'/'+_0x3b656a)[_0x3d6f('0x2b')](_0x4d5628);}return null;};}function patchUpdates(_0x43ec63){return function(_0xc16b4){try{jsonpatch[_0x3d6f('0x32')](_0xc16b4,_0x43ec63,!![]);}catch(_0x486b2d){return BPromise['reject'](_0x486b2d);}return _0xc16b4[_0x3d6f('0x33')]();};}function saveUpdates(_0x28c49c,_0x4bd5e0){return function(_0x352118){if(_0x352118){return _0x352118[_0x3d6f('0x34')](_0x28c49c)[_0x3d6f('0x1e')](function(_0x56ab5e){return _0x56ab5e;});}return null;};}function removeEntity(_0x4476bc,_0x50f7cb){return function(_0x45094c){if(_0x45094c){return _0x45094c[_0x3d6f('0x35')]()[_0x3d6f('0x1e')](function(){_0x4476bc[_0x3d6f('0x29')](0xcc)[_0x3d6f('0x2a')]();});}};}function handleEntityNotFound(_0x42d7c9,_0xe2388c){return function(_0x1d20df){if(!_0x1d20df){_0x42d7c9[_0x3d6f('0x28')](0x194);}return _0x1d20df;};}function handleError(_0x42ec36,_0x2cf5b1){_0x2cf5b1=_0x2cf5b1||0x1f4;return function(_0x15b5ea){logger[_0x3d6f('0x22')](_0x15b5ea['stack']);if(_0x15b5ea[_0x3d6f('0x36')]){delete _0x15b5ea[_0x3d6f('0x36')];}_0x42ec36['status'](_0x2cf5b1)['send'](_0x15b5ea);};}exports['index']=function(_0x29f8ae,_0x2d32c9){var _0x269a6d={},_0x562901={},_0x3d1b14={'count':0x0,'rows':[]};var _0x5c0852=_[_0x3d6f('0x37')](db[_0x3d6f('0x38')][_0x3d6f('0x39')],function(_0x59284c){return{'name':_0x59284c[_0x3d6f('0x3a')],'type':_0x59284c['type'][_0x3d6f('0x3b')]};});_0x562901[_0x3d6f('0x3c')]=_['map'](_0x5c0852,_0x3d6f('0x36'));_0x562901[_0x3d6f('0x3d')]=_[_0x3d6f('0x3e')](_0x29f8ae['query']);_0x562901[_0x3d6f('0x3f')]=_['intersection'](_0x562901[_0x3d6f('0x3c')],_0x562901[_0x3d6f('0x3d')]);_0x269a6d[_0x3d6f('0x40')]=_['intersection'](_0x562901[_0x3d6f('0x3c')],qs[_0x3d6f('0x41')](_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x41')]));_0x269a6d['attributes']=_0x269a6d['attributes']['length']?_0x269a6d[_0x3d6f('0x40')]:_0x562901[_0x3d6f('0x3c')];if(!_0x29f8ae[_0x3d6f('0x3d')]['hasOwnProperty'](_0x3d6f('0x42'))){_0x269a6d[_0x3d6f('0x2c')]=qs[_0x3d6f('0x2c')](_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x2c')]);_0x269a6d[_0x3d6f('0x2f')]=qs[_0x3d6f('0x2f')](_0x29f8ae[_0x3d6f('0x3d')]['offset']);}_0x269a6d[_0x3d6f('0x43')]=qs[_0x3d6f('0x44')](_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x44')]);_0x269a6d[_0x3d6f('0x45')]=qs[_0x3d6f('0x3f')](_[_0x3d6f('0x46')](_0x29f8ae[_0x3d6f('0x3d')],_0x562901[_0x3d6f('0x3f')]),_0x5c0852);if(_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x47')]){_0x269a6d[_0x3d6f('0x45')]=_[_0x3d6f('0x48')](_0x269a6d['where'],{'$or':_[_0x3d6f('0x37')](_0x5c0852,function(_0x14ca1b){if(_0x14ca1b['type']!==_0x3d6f('0x49')){var _0x2b9ac2={};_0x2b9ac2[_0x14ca1b[_0x3d6f('0x36')]]={'$like':'%'+_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x47')]+'%'};return _0x2b9ac2;}})});}_0x269a6d=_['merge']({},_0x269a6d,_0x29f8ae[_0x3d6f('0x4a')]);var _0x407bb4={'where':_0x269a6d['where']};return db['ChatMessage']['count'](_0x407bb4)['then'](function(_0x28453b){_0x3d1b14[_0x3d6f('0x2e')]=_0x28453b;if(_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x4b')]){_0x269a6d['include']=[{'all':!![]}];}return db[_0x3d6f('0x38')][_0x3d6f('0x4c')](_0x269a6d);})['then'](function(_0xca223b){_0x3d1b14['rows']=_0xca223b;return _0x3d1b14;})[_0x3d6f('0x1e')](respondWithFilteredResult(_0x2d32c9,_0x269a6d))[_0x3d6f('0x27')](handleError(_0x2d32c9,null));};exports['show']=function(_0x25aa9a,_0x196382){var _0x361e8e={'raw':!![],'where':{'id':_0x25aa9a[_0x3d6f('0x4d')]['id']}},_0x1935f8={};_0x1935f8[_0x3d6f('0x3c')]=_[_0x3d6f('0x3e')](db[_0x3d6f('0x38')][_0x3d6f('0x39')]);_0x1935f8[_0x3d6f('0x3d')]=_[_0x3d6f('0x3e')](_0x25aa9a[_0x3d6f('0x3d')]);_0x1935f8[_0x3d6f('0x3f')]=_['intersection'](_0x1935f8['model'],_0x1935f8[_0x3d6f('0x3d')]);_0x361e8e[_0x3d6f('0x40')]=_[_0x3d6f('0x4e')](_0x1935f8['model'],qs['fields'](_0x25aa9a['query']['fields']));_0x361e8e[_0x3d6f('0x40')]=_0x361e8e[_0x3d6f('0x40')]['length']?_0x361e8e[_0x3d6f('0x40')]:_0x1935f8[_0x3d6f('0x3c')];if(_0x25aa9a[_0x3d6f('0x3d')][_0x3d6f('0x4b')]){_0x361e8e[_0x3d6f('0x4f')]=[{'all':!![]}];}_0x361e8e=_[_0x3d6f('0x48')]({},_0x361e8e,_0x25aa9a[_0x3d6f('0x4a')]);return db[_0x3d6f('0x38')][_0x3d6f('0x50')](_0x361e8e)[_0x3d6f('0x1e')](handleEntityNotFound(_0x196382,null))[_0x3d6f('0x1e')](respondWithResult(_0x196382,null))[_0x3d6f('0x27')](handleError(_0x196382,null));};exports['create']=function(_0x5bb158,_0x16e5d2){return db['ChatMessage'][_0x3d6f('0x51')](_0x5bb158[_0x3d6f('0x52')],{})['then'](respondWithResult(_0x16e5d2,0xc9))[_0x3d6f('0x27')](handleError(_0x16e5d2,null));};exports[_0x3d6f('0x34')]=function(_0x2a64b4,_0x3af775){if(_0x2a64b4[_0x3d6f('0x52')]['id']){delete _0x2a64b4['body']['id'];}return db[_0x3d6f('0x38')][_0x3d6f('0x50')]({'where':{'id':_0x2a64b4['params']['id']}})[_0x3d6f('0x1e')](handleEntityNotFound(_0x3af775,null))['then'](saveUpdates(_0x2a64b4[_0x3d6f('0x52')],null))[_0x3d6f('0x1e')](respondWithResult(_0x3af775,null))['catch'](handleError(_0x3af775,null));};exports[_0x3d6f('0x35')]=function(_0x57506b,_0x2e0976){return db[_0x3d6f('0x38')]['find']({'where':{'id':_0x57506b[_0x3d6f('0x4d')]['id']}})[_0x3d6f('0x1e')](handleEntityNotFound(_0x2e0976,null))[_0x3d6f('0x1e')](removeEntity(_0x2e0976,null))[_0x3d6f('0x27')](handleError(_0x2e0976,null));};exports['describe']=function(_0x42fcd5,_0x315487){return db[_0x3d6f('0x38')][_0x3d6f('0x53')]()[_0x3d6f('0x1e')](respondWithResult(_0x315487,null))[_0x3d6f('0x27')](handleError(_0x315487,null));};var interaction_log=require(_0x3d6f('0x10'))(_0x3d6f('0x54'));exports[_0x3d6f('0x55')]=function(_0x59a202,_0xd74be7,_0x2e4408){var _0x429437={'agent':{},'channel':_0x3d6f('0x56')};if(_0x59a202[_0x3d6f('0x52')]['id']){delete _0x59a202['body']['id'];}_0x59a202['body'][_0x3d6f('0x57')]=!![];_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x58')]=moment()[_0x3d6f('0x59')](_0x3d6f('0x5a'));_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x5b')]=_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x5b')]||_0x59a202[_0x3d6f('0x5c')]['id'];_0x429437[_0x3d6f('0x5d')]['id']=_0x59a202['body']['UserId'];return db['ChatMessage'][_0x3d6f('0x50')]({'where':{'id':_0x59a202[_0x3d6f('0x4d')]['id'],'UserId':null}})[_0x3d6f('0x1e')](handleEntityNotFound(_0xd74be7,null))[_0x3d6f('0x1e')](saveUpdates(_0x59a202['body'],null))[_0x3d6f('0x1e')](function(_0x39c472){if(_0x39c472){_0x429437[_0x3d6f('0x25')]=_0x39c472[_0x3d6f('0x5e')]({'plain':!![]});return db[_0x3d6f('0x5f')]['find']({'where':{'id':_0x39c472[_0x3d6f('0x60')]}});}return null;})[_0x3d6f('0x1e')](handleEntityNotFound(_0xd74be7,null))[_0x3d6f('0x1e')](function(_0x3cd3ec){if(_0x3cd3ec){return _0x3cd3ec[_0x3d6f('0x34')]({'UserId':_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x5b')],'read1stAt':_['isNil'](_0x3cd3ec[_0x3d6f('0x61')])?moment()[_0x3d6f('0x59')](_0x3d6f('0x5a')):undefined});}return null;})[_0x3d6f('0x1e')](function(_0xd3f098){if(_0xd3f098){_0x429437['interaction']=_0xd3f098[_0x3d6f('0x5e')]({'plain':!![]});interaction_log[_0x3d6f('0x26')](_0x3d6f('0x62'),_0x59a202[_0x3d6f('0x5c')]['id'],_0x59a202[_0x3d6f('0x5c')][_0x3d6f('0x36')],_0x59a202[_0x3d6f('0x5c')][_0x3d6f('0x63')],_0x429437['interaction']['id'],_0x59a202[_0x3d6f('0x52')]?JSON[_0x3d6f('0x21')](_0x59a202[_0x3d6f('0x52')]):_0x3d6f('0x64'));return respondWithRpcPromise(_0x3d6f('0x65'),_0x3d6f('0x66'),_0x429437);}return null;})['then'](function(_0x425cf9){var _0x3f4956=_0x3d6f('0x67')+_0x425cf9[_0x3d6f('0x25')][_0x3d6f('0x68')];return db[_0x3d6f('0x69')]['query'](_0x3f4956,{'type':db[_0x3d6f('0x6a')][_0x3d6f('0x6b')]['SELECT'],'raw':!![]})[_0x3d6f('0x1e')](function(_0x2b43d3){return _0x2b43d3;});})['then'](function(_0x1c80d3){if(_0x1c80d3){_0x429437[_0x3d6f('0x25')][_0x3d6f('0x6c')]=_0x1c80d3[0x0];if(!_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x5b')])return;return db[_0x3d6f('0x6d')][_0x3d6f('0x50')]({'where':{'id':_0x59a202[_0x3d6f('0x52')]['UserId'],'role':'agent'},'attributes':['id',_0x3d6f('0x36'),_0x3d6f('0x6e'),_0x3d6f('0x6f'),'internal'],'raw':!![]});}return null;})[_0x3d6f('0x1e')](function(_0x58fb68){if(!_0x58fb68)return null;_0x429437['message'][_0x3d6f('0x5d')]=_0x58fb68;return _0x429437;})[_0x3d6f('0x1e')](function(_0x139379){if(_0x139379){if(_0x59a202['body']['manual']){_0x429437[_0x3d6f('0x25')][_0x3d6f('0x70')]=util['format']('SIP/%s',_0x59a202[_0x3d6f('0x5c')][_0x3d6f('0x36')]);_0x429437['message']['channel']=_0x429437[_0x3d6f('0x71')];_0x429437[_0x3d6f('0x25')][_0x3d6f('0x72')]=_0x429437[_0x3d6f('0x71')];_0x429437[_0x3d6f('0x25')][_0x3d6f('0x73')]='accept';return respondWithRpcPromise(_0x3d6f('0x74'),_0x3d6f('0x74'),{'event':'acceptmessage','message':_[_0x3d6f('0x48')](_0x429437[_0x3d6f('0x25')],JSON[_0x3d6f('0x75')](_0x429437[_0x3d6f('0x76')][_0x3d6f('0x77')]))},client9002)['then'](function(){return _0x429437;});}return _0x429437;}return null;})['then'](respondWithResult(_0xd74be7,null))['catch'](handleError(_0xd74be7,null));};var interaction_log=require(_0x3d6f('0x10'))(_0x3d6f('0x54'));exports[_0x3d6f('0x78')]=function(_0x4fc773,_0x241267,_0x54f0de){var _0x1ee8b2={'agent':{},'channel':_0x3d6f('0x56')};if(_0x4fc773[_0x3d6f('0x52')]['id']){delete _0x4fc773['body']['id'];}_0x4fc773[_0x3d6f('0x52')][_0x3d6f('0x5b')]=_0x4fc773[_0x3d6f('0x52')][_0x3d6f('0x5b')]||_0x4fc773[_0x3d6f('0x5c')]['id'];_0x1ee8b2['agent']['id']=_0x4fc773[_0x3d6f('0x52')][_0x3d6f('0x5b')];return db[_0x3d6f('0x38')][_0x3d6f('0x50')]({'where':{'id':_0x4fc773[_0x3d6f('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x241267,null))['then'](function(_0x29f4bf){if(_0x29f4bf){_0x1ee8b2[_0x3d6f('0x25')]=_0x29f4bf[_0x3d6f('0x5e')]({'plain':!![]});return db[_0x3d6f('0x5f')][_0x3d6f('0x50')]({'where':{'id':_0x29f4bf['ChatInteractionId']}});}return null;})[_0x3d6f('0x1e')](handleEntityNotFound(_0x241267,null))['then'](function(_0x1ea481){if(_0x1ea481){_0x1ee8b2[_0x3d6f('0x76')]=_0x1ea481['get']({'plain':!![]});interaction_log[_0x3d6f('0x26')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fc773['user']['id'],_0x4fc773[_0x3d6f('0x5c')][_0x3d6f('0x36')],_0x4fc773['user']['role'],_0x1ee8b2['interaction']['id'],_0x4fc773[_0x3d6f('0x52')]?JSON['stringify'](_0x4fc773['body']):'null');return respondWithRpcPromise(_0x3d6f('0x79'),_0x3d6f('0x7a'),_0x1ee8b2);}return null;})[_0x3d6f('0x1e')](function(_0x2aa509){var _0x5ac030='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2aa509[_0x3d6f('0x25')][_0x3d6f('0x68')];return db[_0x3d6f('0x69')][_0x3d6f('0x3d')](_0x5ac030,{'type':db['Sequelize'][_0x3d6f('0x6b')][_0x3d6f('0x7b')],'raw':!![]})['then'](function(_0xcc8495){return _0xcc8495;});})[_0x3d6f('0x1e')](function(_0x5cec45){if(_0x5cec45){_0x1ee8b2['message'][_0x3d6f('0x6c')]=_0x5cec45[0x0];if(!_0x4fc773[_0x3d6f('0x52')][_0x3d6f('0x5b')])return;return db[_0x3d6f('0x6d')][_0x3d6f('0x50')]({'where':{'id':_0x4fc773['body'][_0x3d6f('0x5b')],'role':'agent'},'attributes':['id',_0x3d6f('0x36'),'fullname',_0x3d6f('0x6f'),'internal'],'raw':!![]});}return null;})[_0x3d6f('0x1e')](function(_0x453fa4){if(!_0x453fa4)return null;_0x1ee8b2['message'][_0x3d6f('0x5d')]=_0x453fa4;return _0x1ee8b2;})[_0x3d6f('0x1e')](function(_0x1d31c5){if(_0x1d31c5){_0x1d31c5[_0x3d6f('0x25')][_0x3d6f('0x70')]=util[_0x3d6f('0x59')](_0x3d6f('0x7c'),_0x4fc773[_0x3d6f('0x5c')]['name']);_0x1d31c5[_0x3d6f('0x25')][_0x3d6f('0x71')]=_0x1ee8b2[_0x3d6f('0x71')];_0x1d31c5[_0x3d6f('0x25')][_0x3d6f('0x72')]=_0x1ee8b2[_0x3d6f('0x71')];_0x1d31c5[_0x3d6f('0x25')][_0x3d6f('0x73')]=_0x3d6f('0x78');respondWithRpcPromise(_0x3d6f('0x74'),_0x3d6f('0x74'),{'event':_0x3d6f('0x7d'),'message':_[_0x3d6f('0x48')](_0x1ee8b2[_0x3d6f('0x25')],JSON[_0x3d6f('0x75')](_0x1ee8b2['interaction'][_0x3d6f('0x77')]))},client9002);return _0x1ee8b2;}return null;})[_0x3d6f('0x1e')](respondWithResult(_0x241267,null))[_0x3d6f('0x27')](handleError(_0x241267,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index daef9c1..f5ec747 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 _0x49dd=['hasOwnProperty','hook','exports','events','setMaxListeners','save','remove','emit'];(function(_0x338ddb,_0x360186){var _0x438bc1=function(_0x157ff3){while(--_0x157ff3){_0x338ddb['push'](_0x338ddb['shift']());}};_0x438bc1(++_0x360186);}(_0x49dd,0x1bb));var _0xd49d=function(_0x9a3bfe,_0x3ef590){_0x9a3bfe=_0x9a3bfe-0x0;var _0x59beba=_0x49dd[_0x9a3bfe];return _0x59beba;};'use strict';var EventEmitter=require(_0xd49d('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd49d('0x1')](0x0);var events={'afterCreate':_0xd49d('0x2'),'afterUpdate':'update','afterDestroy':_0xd49d('0x3')};function emitEvent(_0x54dc15){return function(_0x3c05a6,_0x1dfa77,_0x479547){ChatMessageEvents[_0xd49d('0x4')](_0x54dc15+':'+_0x3c05a6['id'],_0x3c05a6);ChatMessageEvents[_0xd49d('0x4')](_0x54dc15,_0x3c05a6);_0x479547(null);};}for(var e in events){if(events[_0xd49d('0x5')](e)){var event=events[e];ChatMessage[_0xd49d('0x6')](e,emitEvent(event));}}module[_0xd49d('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x8f0d=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2ea189,_0x594b6d){var _0x17a7c8=function(_0x214b09){while(--_0x214b09){_0x2ea189['push'](_0x2ea189['shift']());}};_0x17a7c8(++_0x594b6d);}(_0x8f0d,0x1da));var _0xd8f0=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8f0d[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0xd8f0('0x0'));var ChatMessage=require(_0xd8f0('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd8f0('0x2'),'afterDestroy':_0xd8f0('0x3')};function emitEvent(_0x121ee3){return function(_0x4a939c,_0x271d06,_0x5d7288){ChatMessageEvents['emit'](_0x121ee3+':'+_0x4a939c['id'],_0x4a939c);ChatMessageEvents[_0xd8f0('0x4')](_0x121ee3,_0x4a939c);_0x5d7288(null);};}for(var e in events){if(events[_0xd8f0('0x5')](e)){var event=events[e];ChatMessage[_0xd8f0('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 59ccf81..370032d 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 _0x628a=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','ChatInteraction','findOne','then','update','createdAt','catch'];(function(_0x2a810a,_0x18fd80){var _0x18a4fa=function(_0x5db930){while(--_0x5db930){_0x2a810a['push'](_0x2a810a['shift']());}};_0x18a4fa(++_0x18fd80);}(_0x628a,0x16e));var _0xa628=function(_0x54c374,_0x55f5f9){_0x54c374=_0x54c374-0x0;var _0x207e08=_0x628a[_0x54c374];return _0x207e08;};'use strict';var _=require('lodash');var util=require(_0xa628('0x0'));var logger=require(_0xa628('0x1'))(_0xa628('0x2'));var moment=require(_0xa628('0x3'));var BPromise=require(_0xa628('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa628('0x5'));var rimraf=require(_0xa628('0x6'));var config=require(_0xa628('0x7'));var attributes=require(_0xa628('0x8'));module[_0xa628('0x9')]=function(_0x4bb082,_0xb75c03){return _0x4bb082[_0xa628('0xa')]('ChatMessage',attributes,{'tableName':_0xa628('0xb'),'paranoid':![],'indexes':[{'name':_0xa628('0xc'),'fields':[_0xa628('0xd')],'type':_0xa628('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15953a,_0x4bdfab,_0x1e17cc){var _0x489744=_0x4bb082[_0xa628('0xf')];var _0x5d14cc=_0x15953a[_0xa628('0x10')]({'plain':!![]});if(_0x5d14cc[_0xa628('0x11')][_0xa628('0x12')]()==='in'||_0x5d14cc['direction'][_0xa628('0x12')]()===_0xa628('0x13')&&!_0x5d14cc['secret']&&!_['isNil'](_0x5d14cc['UserId'])){_0x489744[_0xa628('0x14')][_0xa628('0x15')]({'where':{'id':_0x5d14cc['ChatInteractionId']}})[_0xa628('0x16')](function(_0x1f7bb2){if(_0x1f7bb2){_0x1f7bb2[_0xa628('0x17')]({'lastMsgAt':_0x5d14cc[_0xa628('0x18')],'lastMsgDirection':_0x5d14cc[_0xa628('0x11')][_0xa628('0x12')]()});}})[_0xa628('0x19')](function(_0x43b79d){console['error'](_0x43b79d);});}_0x1e17cc();}},'charset':_0xa628('0x1a'),'collate':_0xa628('0x1b')});}; \ No newline at end of file +var _0xa5ef=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util'];(function(_0x343801,_0x5c99de){var _0x89bc33=function(_0x664184){while(--_0x664184){_0x343801['push'](_0x343801['shift']());}};_0x89bc33(++_0x5c99de);}(_0xa5ef,0x120));var _0xfa5e=function(_0x16a326,_0x3d0456){_0x16a326=_0x16a326-0x0;var _0x120392=_0xa5ef[_0x16a326];return _0x120392;};'use strict';var _=require(_0xfa5e('0x0'));var util=require(_0xfa5e('0x1'));var logger=require(_0xfa5e('0x2'))(_0xfa5e('0x3'));var moment=require(_0xfa5e('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa5e('0x5'));var fs=require('fs');var path=require(_0xfa5e('0x6'));var rimraf=require(_0xfa5e('0x7'));var config=require(_0xfa5e('0x8'));var attributes=require('./chatMessage.attributes');module[_0xfa5e('0x9')]=function(_0x16df33,_0x595f89){return _0x16df33[_0xfa5e('0xa')](_0xfa5e('0xb'),attributes,{'tableName':_0xfa5e('0xc'),'paranoid':![],'indexes':[{'name':_0xfa5e('0xd'),'fields':[_0xfa5e('0xe')],'type':_0xfa5e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x389b54,_0x450b1b,_0x427596){var _0x43e396=_0x16df33[_0xfa5e('0x10')];var _0x113d67=_0x389b54[_0xfa5e('0x11')]({'plain':!![]});if(_0x113d67[_0xfa5e('0x12')][_0xfa5e('0x13')]()==='in'||_0x113d67[_0xfa5e('0x12')][_0xfa5e('0x13')]()==='out'&&!_0x113d67[_0xfa5e('0x14')]&&!_['isNil'](_0x113d67[_0xfa5e('0x15')])){_0x43e396['ChatInteraction'][_0xfa5e('0x16')]({'where':{'id':_0x113d67[_0xfa5e('0x17')]}})[_0xfa5e('0x18')](function(_0x315cf2){if(_0x315cf2){_0x315cf2['update']({'lastMsgAt':_0x113d67[_0xfa5e('0x19')],'lastMsgDirection':_0x113d67['direction'][_0xfa5e('0x13')]()});}})[_0xfa5e('0x1a')](function(_0x8b1f2f){console[_0xfa5e('0x1b')](_0x8b1f2f);});}_0x427596();}},'charset':'utf8mb4','collate':_0xfa5e('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 3732704..e5105a6 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 _0x689b=['redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14c65b,_0x10b662){var _0x7ed29a=function(_0x70006){while(--_0x70006){_0x14c65b['push'](_0x14c65b['shift']());}};_0x7ed29a(++_0x10b662);}(_0x689b,0x85));var _0xb689=function(_0x4eb323,_0x49d8f9){_0x4eb323=_0x4eb323-0x0;var _0x7f586b=_0x689b[_0x4eb323];return _0x7f586b;};'use strict';var _=require('lodash');var util=require(_0xb689('0x0'));var moment=require(_0xb689('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb689('0x2'));var db=require(_0xb689('0x3'))['db'];var utils=require(_0xb689('0x4'));var logger=require(_0xb689('0x5'))(_0xb689('0x6'));var config=require(_0xb689('0x7'));var jayson=require(_0xb689('0x8'));var client=jayson[_0xb689('0x9')][_0xb689('0xa')]({'port':0x232a});config[_0xb689('0xb')]=_[_0xb689('0xc')](config[_0xb689('0xb')],{'host':_0xb689('0xd'),'port':0x18eb});var socket=require(_0xb689('0xe'))(new Redis(config[_0xb689('0xb')]));require(_0xb689('0xf'))[_0xb689('0x10')](socket);function respondWithRpcPromise(_0xb66f20,_0x540d0a,_0x28bf5a){return new BPromise(function(_0x8c1455,_0x329dbd){return client[_0xb689('0x11')](_0xb66f20,_0x28bf5a)['then'](function(_0x4f791e){logger[_0xb689('0x12')](_0xb689('0x13'),_0x540d0a,_0xb689('0x14'));logger[_0xb689('0x15')](_0xb689('0x16'),_0x540d0a,_0xb689('0x14'),JSON[_0xb689('0x17')](_0x4f791e));if(_0x4f791e['error']){if(_0x4f791e[_0xb689('0x18')][_0xb689('0x19')]===0x1f4){logger[_0xb689('0x18')](_0xb689('0x13'),_0x540d0a,_0x4f791e[_0xb689('0x18')][_0xb689('0x1a')]);return _0x329dbd(_0x4f791e['error'][_0xb689('0x1a')]);}logger['error'](_0xb689('0x13'),_0x540d0a,_0x4f791e[_0xb689('0x18')]['message']);return _0x8c1455(_0x4f791e[_0xb689('0x18')]['message']);}else{logger[_0xb689('0x12')](_0xb689('0x13'),_0x540d0a,_0xb689('0x14'));_0x8c1455(_0x4f791e[_0xb689('0x1b')][_0xb689('0x1a')]);}})[_0xb689('0x1c')](function(_0x433448){logger['error']('ChatMessage,\x20%s,\x20%s',_0x540d0a,_0x433448);_0x329dbd(_0x433448);});});}exports[_0xb689('0x1d')]=function(_0x10c612){var _0x4faccd=this;return new Promise(function(_0x20e71b,_0x47ae2d){return db[_0xb689('0x1e')][_0xb689('0x1f')](_0x10c612[_0xb689('0x20')],{'raw':_0x10c612[_0xb689('0x21')]?_0x10c612['options'][_0xb689('0x22')]===undefined?!![]:![]:!![]})[_0xb689('0x23')](function(_0xd97bd){logger['info']('CreateChatMessage',_0x10c612);logger[_0xb689('0x15')](_0xb689('0x1d'),_0x10c612,JSON[_0xb689('0x17')](_0xd97bd));_0x20e71b(_0xd97bd);})['catch'](function(_0x168991){logger[_0xb689('0x18')](_0xb689('0x1d'),_0x168991['message'],_0x10c612);_0x47ae2d(_0x4faccd[_0xb689('0x18')](0x1f4,_0x168991[_0xb689('0x1a')]));});});}; \ No newline at end of file +var _0xbf0c=['client','redis','localhost','socket.io-emitter','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateChatMessage','ChatMessage','create','raw','lodash','util','bluebird','randomstring','rpc','jayson/promise'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0xbf0c,0x180));var _0xcbf0=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0xbf0c[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0xcbf0('0x0'));var util=require(_0xcbf0('0x1'));var moment=require('moment');var BPromise=require(_0xcbf0('0x2'));var rs=require(_0xcbf0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcbf0('0x4'));var config=require('../../config/environment');var jayson=require(_0xcbf0('0x5'));var client=jayson[_0xcbf0('0x6')]['http']({'port':0x232a});config[_0xcbf0('0x7')]=_['defaults'](config[_0xcbf0('0x7')],{'host':_0xcbf0('0x8'),'port':0x18eb});var socket=require(_0xcbf0('0x9'))(new Redis(config['redis']));require(_0xcbf0('0xa'))['register'](socket);function respondWithRpcPromise(_0x1294a5,_0x57f74e,_0x32d6c5){return new BPromise(function(_0x343609,_0x238ecb){return client[_0xcbf0('0xb')](_0x1294a5,_0x32d6c5)[_0xcbf0('0xc')](function(_0xd40cc5){logger['info'](_0xcbf0('0xd'),_0x57f74e,_0xcbf0('0xe'));logger[_0xcbf0('0xf')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x57f74e,_0xcbf0('0xe'),JSON[_0xcbf0('0x10')](_0xd40cc5));if(_0xd40cc5[_0xcbf0('0x11')]){if(_0xd40cc5[_0xcbf0('0x11')][_0xcbf0('0x12')]===0x1f4){logger[_0xcbf0('0x11')](_0xcbf0('0xd'),_0x57f74e,_0xd40cc5[_0xcbf0('0x11')][_0xcbf0('0x13')]);return _0x238ecb(_0xd40cc5[_0xcbf0('0x11')][_0xcbf0('0x13')]);}logger[_0xcbf0('0x11')](_0xcbf0('0xd'),_0x57f74e,_0xd40cc5[_0xcbf0('0x11')][_0xcbf0('0x13')]);return _0x343609(_0xd40cc5['error']['message']);}else{logger[_0xcbf0('0x14')](_0xcbf0('0xd'),_0x57f74e,'request\x20sent');_0x343609(_0xd40cc5[_0xcbf0('0x15')][_0xcbf0('0x13')]);}})['catch'](function(_0xe5d872){logger['error'](_0xcbf0('0xd'),_0x57f74e,_0xe5d872);_0x238ecb(_0xe5d872);});});}exports[_0xcbf0('0x16')]=function(_0x36590c){var _0x376273=this;return new Promise(function(_0x45b228,_0x58ed38){return db[_0xcbf0('0x17')][_0xcbf0('0x18')](_0x36590c['body'],{'raw':_0x36590c['options']?_0x36590c['options'][_0xcbf0('0x19')]===undefined?!![]:![]:!![]})[_0xcbf0('0xc')](function(_0x3918f2){logger[_0xcbf0('0x14')]('CreateChatMessage',_0x36590c);logger[_0xcbf0('0xf')](_0xcbf0('0x16'),_0x36590c,JSON[_0xcbf0('0x10')](_0x3918f2));_0x45b228(_0x3918f2);})['catch'](function(_0x46541b){logger['error'](_0xcbf0('0x16'),_0x46541b[_0xcbf0('0x13')],_0x36590c);_0x58ed38(_0x376273[_0xcbf0('0x11')](0x1f4,_0x46541b[_0xcbf0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index b43fc9d..7a8ec6f 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 _0x56a4=['removeListener','register','chatMessage:','./chatMessage.events','save','update','emit'];(function(_0x161923,_0x577a7f){var _0x2421b5=function(_0x4100ad){while(--_0x4100ad){_0x161923['push'](_0x161923['shift']());}};_0x2421b5(++_0x577a7f);}(_0x56a4,0x11b));var _0x456a=function(_0x4f9c46,_0x361afe){_0x4f9c46=_0x4f9c46-0x0;var _0x155365=_0x56a4[_0x4f9c46];return _0x155365;};'use strict';var ChatMessageEvents=require(_0x456a('0x0'));var events=[_0x456a('0x1'),'remove',_0x456a('0x2')];function createListener(_0x93d98f,_0x5f3fe1){return function(_0x478cac){_0x5f3fe1[_0x456a('0x3')](_0x93d98f,_0x478cac);};}function removeListener(_0x3a11ee,_0x143999){return function(){ChatMessageEvents[_0x456a('0x4')](_0x3a11ee,_0x143999);};}exports[_0x456a('0x5')]=function(_0x4b8eec){for(var _0x3b0145=0x0,_0x52b38d=events['length'];_0x3b0145<_0x52b38d;_0x3b0145++){var _0x2b6329=events[_0x3b0145];var _0x20c8e0=createListener(_0x456a('0x6')+_0x2b6329,_0x4b8eec);ChatMessageEvents['on'](_0x2b6329,_0x20c8e0);}}; \ No newline at end of file +var _0xc03e=['register','length','chatMessage:','./chatMessage.events','update','emit','removeListener'];(function(_0x2150af,_0x518e6b){var _0x18b16f=function(_0x359ab7){while(--_0x359ab7){_0x2150af['push'](_0x2150af['shift']());}};_0x18b16f(++_0x518e6b);}(_0xc03e,0x15a));var _0xec03=function(_0x2b90dc,_0x10b832){_0x2b90dc=_0x2b90dc-0x0;var _0x4794a6=_0xc03e[_0x2b90dc];return _0x4794a6;};'use strict';var ChatMessageEvents=require(_0xec03('0x0'));var events=['save','remove',_0xec03('0x1')];function createListener(_0x58e2d6,_0x3af7cc){return function(_0x5b2577){_0x3af7cc[_0xec03('0x2')](_0x58e2d6,_0x5b2577);};}function removeListener(_0x269001,_0x3e3a78){return function(){ChatMessageEvents[_0xec03('0x3')](_0x269001,_0x3e3a78);};}exports[_0xec03('0x4')]=function(_0x1ce78a){for(var _0x31db21=0x0,_0xcaaf03=events[_0xec03('0x5')];_0x31db21<_0xcaaf03;_0x31db21++){var _0x529ebd=events[_0x31db21];var _0x4205e9=createListener(_0xec03('0x6')+_0x529ebd,_0x1ce78a);ChatMessageEvents['on'](_0x529ebd,_0x4205e9);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index cc0415f..41f8850 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 _0xf139=['delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','chat','create','put','/:id/accept','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf139,0x1ac));var _0x9f13=function(_0x1ae85a,_0x51954e){_0x1ae85a=_0x1ae85a-0x0;var _0x3b3f6e=_0xf139[_0x1ae85a];return _0x3b3f6e;};'use strict';var multer=require(_0x9f13('0x0'));var util=require(_0x9f13('0x1'));var path=require(_0x9f13('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f13('0x3'));var router=express['Router']();var fs_extra=require(_0x9f13('0x4'));var auth=require(_0x9f13('0x5'));var interaction=require(_0x9f13('0x6'));var config=require('../../config/environment');var controller=require(_0x9f13('0x7'));router['get']('/',auth[_0x9f13('0x8')](),controller[_0x9f13('0x9')]);router[_0x9f13('0xa')](_0x9f13('0xb'),auth['isAuthenticated'](),controller[_0x9f13('0xc')]);router[_0x9f13('0xa')](_0x9f13('0xd'),auth['isAuthenticated'](),controller[_0x9f13('0xe')]);router[_0x9f13('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9f13('0x10')](_0x9f13('0x11'),'chatmessage:create'),controller[_0x9f13('0x12')]);router[_0x9f13('0x13')](_0x9f13('0xd'),controller['update']);router['put'](_0x9f13('0x14'),auth[_0x9f13('0x8')](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x9f13('0x15')]);router[_0x9f13('0x16')](_0x9f13('0xd'),auth[_0x9f13('0x8')](),controller[_0x9f13('0x17')]);module[_0x9f13('0x18')]=router; \ No newline at end of file +var _0xdcff=['put','accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','chat','chatmessage:create','create'];(function(_0x40692d,_0x5c4d2b){var _0x412625=function(_0x5efafd){while(--_0x5efafd){_0x40692d['push'](_0x40692d['shift']());}};_0x412625(++_0x5c4d2b);}(_0xdcff,0x65));var _0xfdcf=function(_0x387c07,_0x200c86){_0x387c07=_0x387c07-0x0;var _0x58d945=_0xdcff[_0x387c07];return _0x58d945;};'use strict';var multer=require(_0xfdcf('0x0'));var util=require(_0xfdcf('0x1'));var path=require(_0xfdcf('0x2'));var timeout=require(_0xfdcf('0x3'));var express=require('express');var router=express[_0xfdcf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfdcf('0x5'));var interaction=require(_0xfdcf('0x6'));var config=require(_0xfdcf('0x7'));var controller=require(_0xfdcf('0x8'));router[_0xfdcf('0x9')]('/',auth[_0xfdcf('0xa')](),controller[_0xfdcf('0xb')]);router[_0xfdcf('0x9')](_0xfdcf('0xc'),auth[_0xfdcf('0xa')](),controller['describe']);router[_0xfdcf('0x9')](_0xfdcf('0xd'),auth[_0xfdcf('0xa')](),controller[_0xfdcf('0xe')]);router[_0xfdcf('0xf')]('/',auth[_0xfdcf('0xa')](),interaction['tracked'](_0xfdcf('0x10'),_0xfdcf('0x11')),controller[_0xfdcf('0x12')]);router[_0xfdcf('0x13')](_0xfdcf('0xd'),controller['update']);router[_0xfdcf('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xfdcf('0x14')]);router[_0xfdcf('0x13')](_0xfdcf('0x15'),auth[_0xfdcf('0xa')](),controller[_0xfdcf('0x16')]);router['delete'](_0xfdcf('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xfdcf('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index d8cfa43..f5258c2 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x51a552,_0x2538a0){var _0x64c74f=function(_0x28b3fe){while(--_0x28b3fe){_0x51a552['push'](_0x51a552['shift']());}};_0x64c74f(++_0x2538a0);}(_0xdb28,0x106));var _0x8db2=function(_0x246bc3,_0x568e40){_0x246bc3=_0x246bc3-0x0;var _0x4d7565=_0xdb28[_0x246bc3];return _0x4d7565;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x293884,_0xc006bb){var _0xfac0d9=function(_0x346977){while(--_0x346977){_0x293884['push'](_0x293884['shift']());}};_0xfac0d9(++_0xc006bb);}(_0xadb5,0xad));var _0x5adb=function(_0x42d78a,_0x538a72){_0x42d78a=_0x42d78a-0x0;var _0x393c9f=_0xadb5[_0x42d78a];return _0x393c9f;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 6ef6c85..41fef83 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2382bd,_0x200fa9){var _0x910c96=function(_0x10d6b8){while(--_0x10d6b8){_0x2382bd['push'](_0x2382bd['shift']());}};_0x910c96(++_0x200fa9);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7a54,0x106));var _0x47a5=function(_0x1e62e0,_0x4f6fde){_0x1e62e0=_0x1e62e0-0x0;var _0x378acc=_0x7a54[_0x1e62e0];return _0x378acc;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 467c8e8..5dff23c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4ff=['../../mysqldb','save','update','emit','exports','events'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0xd4ff,0x18b));var _0xfd4f=function(_0x10156d,_0x5a451a){_0x10156d=_0x10156d-0x0;var _0x4ba0c6=_0xd4ff[_0x10156d];return _0x4ba0c6;};'use strict';var EventEmitter=require(_0xfd4f('0x0'));var ChatOfflineMessage=require(_0xfd4f('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd4f('0x2'),'afterUpdate':_0xfd4f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x33e7ef){return function(_0x46677e,_0x2d507d,_0x601134){ChatOfflineMessageEvents[_0xfd4f('0x4')](_0x33e7ef+':'+_0x46677e['id'],_0x46677e);ChatOfflineMessageEvents[_0xfd4f('0x4')](_0x33e7ef,_0x46677e);_0x601134(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xfd4f('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x5679=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x319249,_0x3ca975){var _0x500412=function(_0xa59d5c){while(--_0xa59d5c){_0x319249['push'](_0x319249['shift']());}};_0x500412(++_0x3ca975);}(_0x5679,0x104));var _0x9567=function(_0x3d7f60,_0x2e469b){_0x3d7f60=_0x3d7f60-0x0;var _0x29a887=_0x5679[_0x3d7f60];return _0x29a887;};'use strict';var EventEmitter=require(_0x9567('0x0'));var ChatOfflineMessage=require(_0x9567('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9567('0x2')](0x0);var events={'afterCreate':_0x9567('0x3'),'afterUpdate':_0x9567('0x4'),'afterDestroy':_0x9567('0x5')};function emitEvent(_0xa14cc9){return function(_0x43c13a,_0x158d44,_0x4a0636){ChatOfflineMessageEvents[_0x9567('0x6')](_0xa14cc9+':'+_0x43c13a['id'],_0x43c13a);ChatOfflineMessageEvents[_0x9567('0x6')](_0xa14cc9,_0x43c13a);_0x4a0636(null);};}for(var e in events){if(events[_0x9567('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x9567('0x8')](e,emitEvent(event));}}module[_0x9567('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 15995b2..a84f603 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 _0xd6cf=['utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x4c6d08,_0x3ed890){var _0x4d7854=function(_0x3eea59){while(--_0x3eea59){_0x4c6d08['push'](_0x4c6d08['shift']());}};_0x4d7854(++_0x3ed890);}(_0xd6cf,0x73));var _0xfd6c=function(_0x4b5409,_0x472b71){_0x4b5409=_0x4b5409-0x0;var _0x90b623=_0xd6cf[_0x4b5409];return _0x90b623;};'use strict';var attributes=require(_0xfd6c('0x0'));module[_0xfd6c('0x1')]=function(_0x32db12){return _0x32db12[_0xfd6c('0x2')](_0xfd6c('0x3'),attributes,{'tableName':_0xfd6c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfd6c('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf2b3=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage','utf8mb4'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xf2b3,0xd3));var _0x3f2b=function(_0x3cf504,_0x2cc551){_0x3cf504=_0x3cf504-0x0;var _0x130459=_0xf2b3[_0x3cf504];return _0x130459;};'use strict';var attributes=require(_0x3f2b('0x0'));module['exports']=function(_0x6b7509){return _0x6b7509[_0x3f2b('0x1')](_0x3f2b('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f2b('0x3'),'collate':_0x3f2b('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f7d7070..46f4498 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 _0x3be5=['code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x220f7d,_0x6be322){var _0x2dbe6a=function(_0x35e6d7){while(--_0x35e6d7){_0x220f7d['push'](_0x220f7d['shift']());}};_0x2dbe6a(++_0x6be322);}(_0x3be5,0x155));var _0x53be=function(_0x4d2865,_0x1f9567){_0x4d2865=_0x4d2865-0x0;var _0x2476c9=_0x3be5[_0x4d2865];return _0x2476c9;};'use strict';var _=require(_0x53be('0x0'));var util=require('util');var moment=require(_0x53be('0x1'));var BPromise=require(_0x53be('0x2'));var rs=require(_0x53be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53be('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x53be('0x5'));var jayson=require(_0x53be('0x6'));var client=jayson[_0x53be('0x7')][_0x53be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24d38b,_0x3bfe8f,_0x2672ca){return new BPromise(function(_0x4e694e,_0x5e4340){return client[_0x53be('0x9')](_0x24d38b,_0x2672ca)[_0x53be('0xa')](function(_0x5e7b6b){logger[_0x53be('0xb')](_0x53be('0xc'),_0x3bfe8f,_0x53be('0xd'));logger[_0x53be('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x3bfe8f,_0x53be('0xd'),JSON[_0x53be('0xf')](_0x5e7b6b));if(_0x5e7b6b['error']){if(_0x5e7b6b['error'][_0x53be('0x10')]===0x1f4){logger['error'](_0x53be('0xc'),_0x3bfe8f,_0x5e7b6b['error']['message']);return _0x5e4340(_0x5e7b6b[_0x53be('0x11')][_0x53be('0x12')]);}logger[_0x53be('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3bfe8f,_0x5e7b6b[_0x53be('0x11')][_0x53be('0x12')]);return _0x4e694e(_0x5e7b6b[_0x53be('0x11')][_0x53be('0x12')]);}else{logger[_0x53be('0xb')](_0x53be('0xc'),_0x3bfe8f,_0x53be('0xd'));_0x4e694e(_0x5e7b6b[_0x53be('0x13')][_0x53be('0x12')]);}})[_0x53be('0x14')](function(_0x360775){logger[_0x53be('0x11')](_0x53be('0xc'),_0x3bfe8f,_0x360775);_0x5e4340(_0x360775);});});} \ No newline at end of file +var _0x95b2=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x308a1d,_0x3d379d){var _0x5eb875=function(_0x464dbe){while(--_0x464dbe){_0x308a1d['push'](_0x308a1d['shift']());}};_0x5eb875(++_0x3d379d);}(_0x95b2,0x144));var _0x295b=function(_0x22b8dc,_0x222e30){_0x22b8dc=_0x22b8dc-0x0;var _0x1c4bdf=_0x95b2[_0x22b8dc];return _0x1c4bdf;};'use strict';var _=require(_0x295b('0x0'));var util=require(_0x295b('0x1'));var moment=require(_0x295b('0x2'));var BPromise=require(_0x295b('0x3'));var rs=require(_0x295b('0x4'));var fs=require('fs');var Redis=require(_0x295b('0x5'));var db=require(_0x295b('0x6'))['db'];var utils=require(_0x295b('0x7'));var logger=require(_0x295b('0x8'))('rpc');var config=require(_0x295b('0x9'));var jayson=require(_0x295b('0xa'));var client=jayson[_0x295b('0xb')][_0x295b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xef543d,_0x52a60b,_0x1172b6){return new BPromise(function(_0x454eb2,_0xf90f02){return client[_0x295b('0xd')](_0xef543d,_0x1172b6)[_0x295b('0xe')](function(_0x3c23e5){logger[_0x295b('0xf')](_0x295b('0x10'),_0x52a60b,_0x295b('0x11'));logger['debug'](_0x295b('0x12'),_0x52a60b,_0x295b('0x11'),JSON[_0x295b('0x13')](_0x3c23e5));if(_0x3c23e5['error']){if(_0x3c23e5['error'][_0x295b('0x14')]===0x1f4){logger[_0x295b('0x15')](_0x295b('0x10'),_0x52a60b,_0x3c23e5[_0x295b('0x15')]['message']);return _0xf90f02(_0x3c23e5[_0x295b('0x15')]['message']);}logger[_0x295b('0x15')](_0x295b('0x10'),_0x52a60b,_0x3c23e5['error'][_0x295b('0x16')]);return _0x454eb2(_0x3c23e5[_0x295b('0x15')][_0x295b('0x16')]);}else{logger[_0x295b('0xf')](_0x295b('0x10'),_0x52a60b,_0x295b('0x11'));_0x454eb2(_0x3c23e5[_0x295b('0x17')][_0x295b('0x16')]);}})['catch'](function(_0xc9604d){logger[_0x295b('0x15')](_0x295b('0x10'),_0x52a60b,_0xc9604d);_0xf90f02(_0xc9604d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e0961b9..39375d2 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 _0x2f34=['../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x1e8ef9,_0x357b01){var _0x48cbb0=function(_0x436482){while(--_0x436482){_0x1e8ef9['push'](_0x1e8ef9['shift']());}};_0x48cbb0(++_0x357b01);}(_0x2f34,0x6e));var _0x42f3=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x2f34[_0xe66cf2];return _0x2d84e7;};'use strict';var multer=require(_0x42f3('0x0'));var util=require(_0x42f3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x42f3('0x2'));var router=express[_0x42f3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x42f3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x42f3('0x5')]('/',auth[_0x42f3('0x6')](),controller[_0x42f3('0x7')]);router[_0x42f3('0x5')](_0x42f3('0x8'),auth[_0x42f3('0x6')](),controller[_0x42f3('0x9')]);router[_0x42f3('0x5')](_0x42f3('0xa'),auth[_0x42f3('0x6')](),controller[_0x42f3('0xb')]);router[_0x42f3('0xc')]('/',auth[_0x42f3('0x6')](),controller[_0x42f3('0xd')]);router[_0x42f3('0xe')](_0x42f3('0xa'),auth[_0x42f3('0x6')](),controller[_0x42f3('0xf')]);router[_0x42f3('0x10')]('/:id',auth[_0x42f3('0x6')](),controller[_0x42f3('0x11')]);module[_0x42f3('0x12')]=router; \ No newline at end of file +var _0xd748=['delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','/:id'];(function(_0x225379,_0x198c44){var _0x5b2308=function(_0x20c8ef){while(--_0x20c8ef){_0x225379['push'](_0x225379['shift']());}};_0x5b2308(++_0x198c44);}(_0xd748,0x111));var _0x8d74=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0xd748[_0x2b91c5];return _0xbd5531;};'use strict';var multer=require('multer');var util=require(_0x8d74('0x0'));var path=require('path');var timeout=require(_0x8d74('0x1'));var express=require(_0x8d74('0x2'));var router=express[_0x8d74('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8d74('0x4'));var interaction=require(_0x8d74('0x5'));var config=require(_0x8d74('0x6'));var controller=require(_0x8d74('0x7'));router[_0x8d74('0x8')]('/',auth[_0x8d74('0x9')](),controller[_0x8d74('0xa')]);router[_0x8d74('0x8')](_0x8d74('0xb'),auth[_0x8d74('0x9')](),controller[_0x8d74('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8d74('0xd')]);router[_0x8d74('0xe')]('/',auth[_0x8d74('0x9')](),controller['create']);router['put'](_0x8d74('0xf'),auth[_0x8d74('0x9')](),controller['update']);router[_0x8d74('0x10')]('/:id',auth[_0x8d74('0x9')](),controller['destroy']);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 7b5b0f5..5479ab7 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 _0x4322=['timeout','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4322,0xd9));var _0x2432=function(_0x3609a6,_0x398caf){_0x3609a6=_0x3609a6-0x0;var _0x18429b=_0x4322[_0x3609a6];return _0x18429b;};'use strict';var Sequelize=require(_0x2432('0x0'));module[_0x2432('0x1')]={'name':{'type':Sequelize[_0x2432('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2432('0x3')](_0x2432('0x4'),_0x2432('0x5')),'defaultValue':_0x2432('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x51f3=['INTEGER','sequelize','exports','timeout','mouseOver','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x51f3,0x73));var _0x351f=function(_0x4c026f,_0x1004bb){_0x4c026f=_0x4c026f-0x0;var _0x2fb4c8=_0x51f3[_0x4c026f];return _0x2fb4c8;};'use strict';var Sequelize=require(_0x351f('0x0'));module[_0x351f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x351f('0x2')),'defaultValue':_0x351f('0x3')},'selector':{'type':Sequelize[_0x351f('0x4')]},'timeout':{'type':Sequelize[_0x351f('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 0785bb2..7597a56 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 _0x85d0=['util','path','to-csv','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','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','keys','query','intersection','fields','attributes','length','includeAll','include','merge','options','catch','create','body','find','request-promise','moment','bluebird','mustache'];(function(_0x1e0b4c,_0x592811){var _0x333654=function(_0x28f012){while(--_0x28f012){_0x1e0b4c['push'](_0x1e0b4c['shift']());}};_0x333654(++_0x592811);}(_0x85d0,0x164));var _0x085d=function(_0x37a2c3,_0x326611){_0x37a2c3=_0x37a2c3-0x0;var _0x508f89=_0x85d0[_0x37a2c3];return _0x508f89;};'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(_0x085d('0x0'));var moment=require(_0x085d('0x1'));var BPromise=require(_0x085d('0x2'));var Mustache=require(_0x085d('0x3'));var util=require(_0x085d('0x4'));var path=require(_0x085d('0x5'));var sox=require('sox');var csv=require(_0x085d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x085d('0x7'));var _=require(_0x085d('0x8'));var squel=require(_0x085d('0x9'));var crypto=require('crypto');var jsforce=require(_0x085d('0xa'));var deskjs=require(_0x085d('0xb'));var toCsv=require(_0x085d('0x6'));var querystring=require(_0x085d('0xc'));var Papa=require(_0x085d('0xd'));var Redis=require(_0x085d('0xe'));var authService=require(_0x085d('0xf'));var qs=require(_0x085d('0x10'));var as=require(_0x085d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x085d('0x12'))(_0x085d('0x13'));var utils=require(_0x085d('0x14'));var config=require(_0x085d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x085d('0x16'))['db'];function respondWithStatusCode(_0x2bd6ae,_0x5c6c27){_0x5c6c27=_0x5c6c27||0xcc;return function(_0x2e0714){if(_0x2e0714){return _0x2bd6ae[_0x085d('0x17')](_0x5c6c27);}return _0x2bd6ae[_0x085d('0x18')](_0x5c6c27)[_0x085d('0x19')]();};}function respondWithResult(_0x5a5252,_0x4b87b9){_0x4b87b9=_0x4b87b9||0xc8;return function(_0x19ce18){if(_0x19ce18){return _0x5a5252['status'](_0x4b87b9)['json'](_0x19ce18);}};}function respondWithFilteredResult(_0x267374,_0x334263){return function(_0x1d041b){if(_0x1d041b){var _0x5f8e18=typeof _0x334263[_0x085d('0x1a')]==='undefined'&&typeof _0x334263[_0x085d('0x1b')]===_0x085d('0x1c');var _0x1efea9=_0x1d041b[_0x085d('0x1d')];var _0x3e566f=_0x5f8e18?0x0:_0x334263[_0x085d('0x1a')];var _0x5c046e=_0x5f8e18?_0x1d041b[_0x085d('0x1d')]:_0x334263[_0x085d('0x1a')]+_0x334263['limit'];var _0xba531c;if(_0x5c046e>=_0x1efea9){_0x5c046e=_0x1efea9;_0xba531c=0xc8;}else{_0xba531c=0xce;}_0x267374[_0x085d('0x18')](_0xba531c);return _0x267374[_0x085d('0x1e')](_0x085d('0x1f'),_0x3e566f+'-'+_0x5c046e+'/'+_0x1efea9)[_0x085d('0x20')](_0x1d041b);}return null;};}function patchUpdates(_0x54eff1){return function(_0xb9d0ad){try{jsonpatch[_0x085d('0x21')](_0xb9d0ad,_0x54eff1,!![]);}catch(_0x39a85e){return BPromise[_0x085d('0x22')](_0x39a85e);}return _0xb9d0ad['save']();};}function saveUpdates(_0x5b3f9c,_0x4cdb11){return function(_0x2b7cdc){if(_0x2b7cdc){return _0x2b7cdc[_0x085d('0x23')](_0x5b3f9c)[_0x085d('0x24')](function(_0x10aa9d){return _0x10aa9d;});}return null;};}function removeEntity(_0x4715d6,_0x17dafb){return function(_0x576d95){if(_0x576d95){return _0x576d95[_0x085d('0x25')]()[_0x085d('0x24')](function(){_0x4715d6[_0x085d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38cddc,_0x290658){return function(_0xbacfbc){if(!_0xbacfbc){_0x38cddc[_0x085d('0x17')](0x194);}return _0xbacfbc;};}function handleError(_0x300295,_0x4b9032){_0x4b9032=_0x4b9032||0x1f4;return function(_0x5e5228){logger['error'](_0x5e5228[_0x085d('0x26')]);if(_0x5e5228[_0x085d('0x27')]){delete _0x5e5228[_0x085d('0x27')];}_0x300295['status'](_0x4b9032)[_0x085d('0x28')](_0x5e5228);};}exports[_0x085d('0x29')]=function(_0x3faf6b,_0x5c7849){var _0x2f670c={'raw':!![],'where':{'id':_0x3faf6b[_0x085d('0x2a')]['id']}},_0x2eae2c={};_0x2eae2c[_0x085d('0x2b')]=_['keys'](db[_0x085d('0x2c')][_0x085d('0x2d')]);_0x2eae2c['query']=_[_0x085d('0x2e')](_0x3faf6b[_0x085d('0x2f')]);_0x2eae2c['filters']=_[_0x085d('0x30')](_0x2eae2c[_0x085d('0x2b')],_0x2eae2c[_0x085d('0x2f')]);_0x2f670c['attributes']=_[_0x085d('0x30')](_0x2eae2c[_0x085d('0x2b')],qs[_0x085d('0x31')](_0x3faf6b['query'][_0x085d('0x31')]));_0x2f670c['attributes']=_0x2f670c[_0x085d('0x32')][_0x085d('0x33')]?_0x2f670c[_0x085d('0x32')]:_0x2eae2c[_0x085d('0x2b')];if(_0x3faf6b['query'][_0x085d('0x34')]){_0x2f670c[_0x085d('0x35')]=[{'all':!![]}];}_0x2f670c=_[_0x085d('0x36')]({},_0x2f670c,_0x3faf6b[_0x085d('0x37')]);return db['ChatProactiveAction']['find'](_0x2f670c)[_0x085d('0x24')](handleEntityNotFound(_0x5c7849,null))[_0x085d('0x24')](respondWithResult(_0x5c7849,null))[_0x085d('0x38')](handleError(_0x5c7849,null));};exports[_0x085d('0x39')]=function(_0x22a83f,_0x2f2b65){return db[_0x085d('0x2c')][_0x085d('0x39')](_0x22a83f[_0x085d('0x3a')],{})['then'](respondWithResult(_0x2f2b65,0xc9))[_0x085d('0x38')](handleError(_0x2f2b65,null));};exports[_0x085d('0x23')]=function(_0x5cf104,_0x254a9b){if(_0x5cf104['body']['id']){delete _0x5cf104[_0x085d('0x3a')]['id'];}return db[_0x085d('0x2c')]['find']({'where':{'id':_0x5cf104[_0x085d('0x2a')]['id']}})[_0x085d('0x24')](handleEntityNotFound(_0x254a9b,null))[_0x085d('0x24')](saveUpdates(_0x5cf104[_0x085d('0x3a')],null))[_0x085d('0x24')](respondWithResult(_0x254a9b,null))['catch'](handleError(_0x254a9b,null));};exports[_0x085d('0x25')]=function(_0x4842c3,_0x5d52be){return db[_0x085d('0x2c')][_0x085d('0x3b')]({'where':{'id':_0x4842c3[_0x085d('0x2a')]['id']}})[_0x085d('0x24')](handleEntityNotFound(_0x5d52be,null))[_0x085d('0x24')](removeEntity(_0x5d52be,null))['catch'](handleError(_0x5d52be,null));}; \ No newline at end of file +var _0xeb0d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','ChatProactiveAction','keys','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','create','body','find','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x339cb7,_0x54ba58){var _0x216132=function(_0x21265e){while(--_0x21265e){_0x339cb7['push'](_0x339cb7['shift']());}};_0x216132(++_0x54ba58);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x3c009b,_0x13da02){_0x3c009b=_0x3c009b-0x0;var _0x560161=_0xeb0d[_0x3c009b];return _0x560161;};'use strict';var emlformat=require(_0xdeb0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdeb0('0x1'));var moment=require(_0xdeb0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdeb0('0x3'));var util=require(_0xdeb0('0x4'));var path=require(_0xdeb0('0x5'));var sox=require(_0xdeb0('0x6'));var csv=require(_0xdeb0('0x7'));var ejs=require(_0xdeb0('0x8'));var fs=require('fs');var fs_extra=require(_0xdeb0('0x9'));var _=require(_0xdeb0('0xa'));var squel=require('squel');var crypto=require(_0xdeb0('0xb'));var jsforce=require(_0xdeb0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdeb0('0x7'));var querystring=require(_0xdeb0('0xd'));var Papa=require(_0xdeb0('0xe'));var Redis=require(_0xdeb0('0xf'));var authService=require(_0xdeb0('0x10'));var qs=require(_0xdeb0('0x11'));var as=require(_0xdeb0('0x12'));var hardwareService=require(_0xdeb0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdeb0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdeb0('0x15'));var db=require(_0xdeb0('0x16'))['db'];function respondWithStatusCode(_0x30ef3a,_0x3cce39){_0x3cce39=_0x3cce39||0xcc;return function(_0xcf93dc){if(_0xcf93dc){return _0x30ef3a[_0xdeb0('0x17')](_0x3cce39);}return _0x30ef3a[_0xdeb0('0x18')](_0x3cce39)[_0xdeb0('0x19')]();};}function respondWithResult(_0x1f065c,_0x50e782){_0x50e782=_0x50e782||0xc8;return function(_0xf0995d){if(_0xf0995d){return _0x1f065c[_0xdeb0('0x18')](_0x50e782)[_0xdeb0('0x1a')](_0xf0995d);}};}function respondWithFilteredResult(_0x244001,_0x35fce3){return function(_0x55fab1){if(_0x55fab1){var _0x1510ce=typeof _0x35fce3['offset']===_0xdeb0('0x1b')&&typeof _0x35fce3[_0xdeb0('0x1c')]===_0xdeb0('0x1b');var _0x5c3c97=_0x55fab1[_0xdeb0('0x1d')];var _0x51e7ee=_0x1510ce?0x0:_0x35fce3[_0xdeb0('0x1e')];var _0x2b1efa=_0x1510ce?_0x55fab1[_0xdeb0('0x1d')]:_0x35fce3['offset']+_0x35fce3[_0xdeb0('0x1c')];var _0x5a44be;if(_0x2b1efa>=_0x5c3c97){_0x2b1efa=_0x5c3c97;_0x5a44be=0xc8;}else{_0x5a44be=0xce;}_0x244001[_0xdeb0('0x18')](_0x5a44be);return _0x244001[_0xdeb0('0x1f')](_0xdeb0('0x20'),_0x51e7ee+'-'+_0x2b1efa+'/'+_0x5c3c97)[_0xdeb0('0x1a')](_0x55fab1);}return null;};}function patchUpdates(_0x486f0d){return function(_0x2ba1ff){try{jsonpatch[_0xdeb0('0x21')](_0x2ba1ff,_0x486f0d,!![]);}catch(_0x2f6cac){return BPromise[_0xdeb0('0x22')](_0x2f6cac);}return _0x2ba1ff[_0xdeb0('0x23')]();};}function saveUpdates(_0x2a3ec4,_0x3173a2){return function(_0xd48473){if(_0xd48473){return _0xd48473[_0xdeb0('0x24')](_0x2a3ec4)[_0xdeb0('0x25')](function(_0x32cdf6){return _0x32cdf6;});}return null;};}function removeEntity(_0x5d7565,_0x566f1f){return function(_0x539652){if(_0x539652){return _0x539652[_0xdeb0('0x26')]()['then'](function(){_0x5d7565['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38bd4d,_0xbfa9e8){return function(_0x2076c4){if(!_0x2076c4){_0x38bd4d[_0xdeb0('0x17')](0x194);}return _0x2076c4;};}function handleError(_0x3ae683,_0x2cd180){_0x2cd180=_0x2cd180||0x1f4;return function(_0x19456b){logger[_0xdeb0('0x27')](_0x19456b[_0xdeb0('0x28')]);if(_0x19456b[_0xdeb0('0x29')]){delete _0x19456b[_0xdeb0('0x29')];}_0x3ae683[_0xdeb0('0x18')](_0x2cd180)[_0xdeb0('0x2a')](_0x19456b);};}exports[_0xdeb0('0x2b')]=function(_0x8f5bb3,_0x224528){var _0x9ac567={'raw':!![],'where':{'id':_0x8f5bb3[_0xdeb0('0x2c')]['id']}},_0x59cc01={};_0x59cc01[_0xdeb0('0x2d')]=_['keys'](db[_0xdeb0('0x2e')]['rawAttributes']);_0x59cc01['query']=_[_0xdeb0('0x2f')](_0x8f5bb3[_0xdeb0('0x30')]);_0x59cc01[_0xdeb0('0x31')]=_[_0xdeb0('0x32')](_0x59cc01['model'],_0x59cc01[_0xdeb0('0x30')]);_0x9ac567[_0xdeb0('0x33')]=_[_0xdeb0('0x32')](_0x59cc01['model'],qs[_0xdeb0('0x34')](_0x8f5bb3['query'][_0xdeb0('0x34')]));_0x9ac567[_0xdeb0('0x33')]=_0x9ac567[_0xdeb0('0x33')]['length']?_0x9ac567[_0xdeb0('0x33')]:_0x59cc01['model'];if(_0x8f5bb3[_0xdeb0('0x30')][_0xdeb0('0x35')]){_0x9ac567[_0xdeb0('0x36')]=[{'all':!![]}];}_0x9ac567=_[_0xdeb0('0x37')]({},_0x9ac567,_0x8f5bb3[_0xdeb0('0x38')]);return db[_0xdeb0('0x2e')]['find'](_0x9ac567)[_0xdeb0('0x25')](handleEntityNotFound(_0x224528,null))[_0xdeb0('0x25')](respondWithResult(_0x224528,null))[_0xdeb0('0x39')](handleError(_0x224528,null));};exports['create']=function(_0x301f28,_0x634bea){return db['ChatProactiveAction'][_0xdeb0('0x3a')](_0x301f28[_0xdeb0('0x3b')],{})[_0xdeb0('0x25')](respondWithResult(_0x634bea,0xc9))[_0xdeb0('0x39')](handleError(_0x634bea,null));};exports[_0xdeb0('0x24')]=function(_0x15e6ae,_0x57297c){if(_0x15e6ae[_0xdeb0('0x3b')]['id']){delete _0x15e6ae[_0xdeb0('0x3b')]['id'];}return db[_0xdeb0('0x2e')][_0xdeb0('0x3c')]({'where':{'id':_0x15e6ae['params']['id']}})[_0xdeb0('0x25')](handleEntityNotFound(_0x57297c,null))['then'](saveUpdates(_0x15e6ae[_0xdeb0('0x3b')],null))[_0xdeb0('0x25')](respondWithResult(_0x57297c,null))[_0xdeb0('0x39')](handleError(_0x57297c,null));};exports[_0xdeb0('0x26')]=function(_0x5526e0,_0x23215f){return db[_0xdeb0('0x2e')][_0xdeb0('0x3c')]({'where':{'id':_0x5526e0[_0xdeb0('0x2c')]['id']}})[_0xdeb0('0x25')](handleEntityNotFound(_0x23215f,null))[_0xdeb0('0x25')](removeEntity(_0x23215f,null))[_0xdeb0('0x39')](handleError(_0x23215f,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 141204f..f6ac48c 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 _0xdf3d=['moment','bluebird','request-promise','path','./chatProactiveAction.attributes','exports','define','util','../../config/logger','api'];(function(_0x24783a,_0x75041){var _0x227a77=function(_0x2b736d){while(--_0x2b736d){_0x24783a['push'](_0x24783a['shift']());}};_0x227a77(++_0x75041);}(_0xdf3d,0x115));var _0xddf3=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0xdf3d[_0x462999];return _0x4b1366;};'use strict';var _=require('lodash');var util=require(_0xddf3('0x0'));var logger=require(_0xddf3('0x1'))(_0xddf3('0x2'));var moment=require(_0xddf3('0x3'));var BPromise=require(_0xddf3('0x4'));var rp=require(_0xddf3('0x5'));var fs=require('fs');var path=require(_0xddf3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xddf3('0x7'));module[_0xddf3('0x8')]=function(_0xbfd3c9,_0x4e97a2){return _0xbfd3c9[_0xddf3('0x9')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8baf=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0xa41fca,_0x43e18b){var _0xca9b1e=function(_0x23cd03){while(--_0x23cd03){_0xa41fca['push'](_0xa41fca['shift']());}};_0xca9b1e(++_0x43e18b);}(_0x8baf,0xd1));var _0xf8ba=function(_0xf6affc,_0x3b7442){_0xf6affc=_0xf6affc-0x0;var _0x56199f=_0x8baf[_0xf6affc];return _0x56199f;};'use strict';var _=require(_0xf8ba('0x0'));var util=require(_0xf8ba('0x1'));var logger=require('../../config/logger')(_0xf8ba('0x2'));var moment=require(_0xf8ba('0x3'));var BPromise=require(_0xf8ba('0x4'));var rp=require(_0xf8ba('0x5'));var fs=require('fs');var path=require(_0xf8ba('0x6'));var rimraf=require(_0xf8ba('0x7'));var config=require(_0xf8ba('0x8'));var attributes=require(_0xf8ba('0x9'));module[_0xf8ba('0xa')]=function(_0x543ca9,_0x558575){return _0x543ca9[_0xf8ba('0xb')](_0xf8ba('0xc'),attributes,{'tableName':_0xf8ba('0xd'),'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 585a702..d7bc969 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 _0xa672=['error','code','message','ChatProactiveAction,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x11ca1f,_0x41cdac){var _0x5e05a0=function(_0x304e0f){while(--_0x304e0f){_0x11ca1f['push'](_0x11ca1f['shift']());}};_0x5e05a0(++_0x41cdac);}(_0xa672,0x131));var _0x2a67=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xa672[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x2a67('0x0'));var util=require(_0x2a67('0x1'));var moment=require('moment');var BPromise=require(_0x2a67('0x2'));var rs=require(_0x2a67('0x3'));var fs=require('fs');var Redis=require(_0x2a67('0x4'));var db=require(_0x2a67('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a67('0x6'))(_0x2a67('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2a67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e9d16,_0x55be85,_0x5078b1){return new BPromise(function(_0x1c330b,_0x72c365){return client[_0x2a67('0x9')](_0x1e9d16,_0x5078b1)[_0x2a67('0xa')](function(_0x1f8f84){logger[_0x2a67('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x55be85,_0x2a67('0xc'));logger[_0x2a67('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x55be85,'request\x20sent',JSON[_0x2a67('0xe')](_0x1f8f84));if(_0x1f8f84[_0x2a67('0xf')]){if(_0x1f8f84[_0x2a67('0xf')][_0x2a67('0x10')]===0x1f4){logger[_0x2a67('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x55be85,_0x1f8f84[_0x2a67('0xf')]['message']);return _0x72c365(_0x1f8f84[_0x2a67('0xf')][_0x2a67('0x11')]);}logger[_0x2a67('0xf')](_0x2a67('0x12'),_0x55be85,_0x1f8f84[_0x2a67('0xf')][_0x2a67('0x11')]);return _0x1c330b(_0x1f8f84['error'][_0x2a67('0x11')]);}else{logger[_0x2a67('0xb')](_0x2a67('0x12'),_0x55be85,'request\x20sent');_0x1c330b(_0x1f8f84['result'][_0x2a67('0x11')]);}})[_0x2a67('0x13')](function(_0x4a7129){logger[_0x2a67('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x55be85,_0x4a7129);_0x72c365(_0x4a7129);});});} \ No newline at end of file +var _0x0a36=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x21f2bd,_0x37c406){var _0x4de4f9=function(_0x1ff6cd){while(--_0x1ff6cd){_0x21f2bd['push'](_0x21f2bd['shift']());}};_0x4de4f9(++_0x37c406);}(_0x0a36,0x199));var _0x60a3=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x0a36[_0xf2628e];return _0x13863a;};'use strict';var _=require('lodash');var util=require(_0x60a3('0x0'));var moment=require(_0x60a3('0x1'));var BPromise=require(_0x60a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x60a3('0x3'));var logger=require(_0x60a3('0x4'))(_0x60a3('0x5'));var config=require('../../config/environment');var jayson=require(_0x60a3('0x6'));var client=jayson[_0x60a3('0x7')][_0x60a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39b781,_0x417309,_0x378dbe){return new BPromise(function(_0x105a9e,_0x9edc24){return client[_0x60a3('0x9')](_0x39b781,_0x378dbe)[_0x60a3('0xa')](function(_0x1c6169){logger['info'](_0x60a3('0xb'),_0x417309,_0x60a3('0xc'));logger[_0x60a3('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x417309,'request\x20sent',JSON[_0x60a3('0xe')](_0x1c6169));if(_0x1c6169['error']){if(_0x1c6169[_0x60a3('0xf')][_0x60a3('0x10')]===0x1f4){logger[_0x60a3('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x417309,_0x1c6169[_0x60a3('0xf')][_0x60a3('0x11')]);return _0x9edc24(_0x1c6169[_0x60a3('0xf')][_0x60a3('0x11')]);}logger[_0x60a3('0xf')](_0x60a3('0xb'),_0x417309,_0x1c6169[_0x60a3('0xf')][_0x60a3('0x11')]);return _0x105a9e(_0x1c6169[_0x60a3('0xf')][_0x60a3('0x11')]);}else{logger[_0x60a3('0x12')](_0x60a3('0xb'),_0x417309,_0x60a3('0xc'));_0x105a9e(_0x1c6169[_0x60a3('0x13')][_0x60a3('0x11')]);}})['catch'](function(_0x452306){logger[_0x60a3('0xf')](_0x60a3('0xb'),_0x417309,_0x452306);_0x9edc24(_0x452306);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c4befd7..134e87a 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 _0x7c09=['delete','/:id','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','show','post','isAuthenticated','create','put'];(function(_0x593941,_0x54b080){var _0x292692=function(_0x9eaf6c){while(--_0x9eaf6c){_0x593941['push'](_0x593941['shift']());}};_0x292692(++_0x54b080);}(_0x7c09,0x102));var _0x97c0=function(_0x15f5a5,_0x24f721){_0x15f5a5=_0x15f5a5-0x0;var _0x5b8ca8=_0x7c09[_0x15f5a5];return _0x5b8ca8;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var fs_extra=require(_0x97c0('0x4'));var auth=require(_0x97c0('0x5'));var interaction=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var controller=require(_0x97c0('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x97c0('0x9')]);router[_0x97c0('0xa')]('/',auth[_0x97c0('0xb')](),controller[_0x97c0('0xc')]);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xb')](),controller['update']);router[_0x97c0('0xe')](_0x97c0('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x97c0('0x10')]=router; \ No newline at end of file +var _0x4819=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x3fb372,_0x2d9fc4){var _0x4d7b70=function(_0x517dfc){while(--_0x517dfc){_0x3fb372['push'](_0x3fb372['shift']());}};_0x4d7b70(++_0x2d9fc4);}(_0x4819,0xcd));var _0x9481=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0x4819[_0x114b7c];return _0x47185f;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get'](_0x9481('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9481('0xb')]('/',auth[_0x9481('0xc')](),controller[_0x9481('0xd')]);router[_0x9481('0xe')](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['delete'](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);module[_0x9481('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 db2b247..81443bd 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 _0xa35a=['ENUM','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0xefea40,_0x11f910){var _0x344a2b=function(_0x4b3252){while(--_0x4b3252){_0xefea40['push'](_0xefea40['shift']());}};_0x344a2b(++_0x11f910);}(_0xa35a,0x1b8));var _0xaa35=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xa35a[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0xaa35('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa35('0x1')],'unique':_0xaa35('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xaa35('0x1')]},'timeout':{'type':Sequelize[_0xaa35('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaa35('0x4')]('rrmemory','beepall',_0xaa35('0x5'))}}; \ No newline at end of file +var _0x426c=['ENUM','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x4a49e2,_0x4dff6f){var _0x229ace=function(_0x4b217d){while(--_0x4b217d){_0x4a49e2['push'](_0x4a49e2['shift']());}};_0x229ace(++_0x4dff6f);}(_0x426c,0x1d1));var _0xc426=function(_0x32b301,_0x380389){_0x32b301=_0x32b301-0x0;var _0xd0c417=_0x426c[_0x32b301];return _0xd0c417;};'use strict';var Sequelize=require('sequelize');module[_0xc426('0x0')]={'name':{'type':Sequelize[_0xc426('0x1')],'unique':_0xc426('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc426('0x1')]},'timeout':{'type':Sequelize[_0xc426('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc426('0x4')]('rrmemory',_0xc426('0x5'),_0xc426('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d7dcc4b..92dd6ac 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 _0x2f2f=['ids','Agents','online','interface','flatMap','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../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','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','ChatQueues','UserProfileResource','destroy','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','describe','findOne','UserChatQueue','length','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams'];(function(_0x59db48,_0xe2798){var _0xe15da0=function(_0x331df8){while(--_0x331df8){_0x59db48['push'](_0x59db48['shift']());}};_0xe15da0(++_0xe2798);}(_0x2f2f,0xbf));var _0xf2f2=function(_0x4b27ac,_0x2d12a4){_0x4b27ac=_0x4b27ac-0x0;var _0x32a496=_0x2f2f[_0x4b27ac];return _0x32a496;};'use strict';var emlformat=require(_0xf2f2('0x0'));var rimraf=require(_0xf2f2('0x1'));var zipdir=require(_0xf2f2('0x2'));var jsonpatch=require(_0xf2f2('0x3'));var rp=require(_0xf2f2('0x4'));var moment=require(_0xf2f2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf2f2('0x6'));var util=require(_0xf2f2('0x7'));var path=require('path');var sox=require(_0xf2f2('0x8'));var csv=require(_0xf2f2('0x9'));var ejs=require(_0xf2f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf2f2('0xb'));var _=require(_0xf2f2('0xc'));var squel=require(_0xf2f2('0xd'));var crypto=require(_0xf2f2('0xe'));var jsforce=require(_0xf2f2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf2f2('0x9'));var querystring=require(_0xf2f2('0x10'));var Papa=require('papaparse');var Redis=require(_0xf2f2('0x11'));var authService=require(_0xf2f2('0x12'));var qs=require(_0xf2f2('0x13'));var as=require(_0xf2f2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2f2('0x15'))(_0xf2f2('0x16'));var utils=require(_0xf2f2('0x17'));var config=require(_0xf2f2('0x18'));var licenseUtil=require(_0xf2f2('0x19'));var db=require(_0xf2f2('0x1a'))['db'];config[_0xf2f2('0x1b')]=_['defaults'](config[_0xf2f2('0x1b')],{'host':_0xf2f2('0x1c'),'port':0x18eb});var socket=require(_0xf2f2('0x1d'))(new Redis(config[_0xf2f2('0x1b')]));require('./chatQueue.socket')[_0xf2f2('0x1e')](socket);var jayson=require(_0xf2f2('0x1f'));var client=jayson[_0xf2f2('0x20')][_0xf2f2('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5b782a,_0x4fded7,_0x2a5d51,_0x3b6b26){return new BPromise(function(_0x315fd8,_0x1f52d6){var _0x363083=_0x3b6b26||client;return _0x363083[_0xf2f2('0x22')](_0x5b782a,_0x2a5d51)[_0xf2f2('0x23')](function(_0x4704b3){logger[_0xf2f2('0x24')](_0xf2f2('0x25'),_0x4fded7,_0xf2f2('0x26'));logger[_0xf2f2('0x27')](_0xf2f2('0x28'),_0x4fded7,_0xf2f2('0x26'),JSON[_0xf2f2('0x29')](_0x4704b3));if(_0x4704b3[_0xf2f2('0x2a')]){if(_0x4704b3[_0xf2f2('0x2a')][_0xf2f2('0x2b')]===0x1f4){logger[_0xf2f2('0x2a')](_0xf2f2('0x25'),_0x4fded7,_0x4704b3[_0xf2f2('0x2a')]['message']);return _0x1f52d6(_0x4704b3[_0xf2f2('0x2a')][_0xf2f2('0x2c')]);}logger[_0xf2f2('0x2a')](_0xf2f2('0x25'),_0x4fded7,_0x4704b3[_0xf2f2('0x2a')][_0xf2f2('0x2c')]);return _0x315fd8(_0x4704b3['error'][_0xf2f2('0x2c')]);}else{logger[_0xf2f2('0x24')](_0xf2f2('0x25'),_0x4fded7,_0xf2f2('0x26'));_0x315fd8(_0x4704b3['result']['message']);}})[_0xf2f2('0x2d')](function(_0x3e6ad4){logger['error'](_0xf2f2('0x25'),_0x4fded7,_0x3e6ad4);_0x1f52d6(_0x3e6ad4);});});}function respondWithStatusCode(_0x32ecd8,_0xf0bdd9){_0xf0bdd9=_0xf0bdd9||0xcc;return function(_0x124d4b){if(_0x124d4b){return _0x32ecd8[_0xf2f2('0x2e')](_0xf0bdd9);}return _0x32ecd8['status'](_0xf0bdd9)[_0xf2f2('0x2f')]();};}function respondWithResult(_0x35f658,_0xbb452f){_0xbb452f=_0xbb452f||0xc8;return function(_0x1aade7){if(_0x1aade7){return _0x35f658[_0xf2f2('0x30')](_0xbb452f)[_0xf2f2('0x31')](_0x1aade7);}};}function respondWithFilteredResult(_0xa1d7b8,_0x525d5c){return function(_0x1d4288){if(_0x1d4288){var _0x2f40aa=typeof _0x525d5c[_0xf2f2('0x32')]===_0xf2f2('0x33')&&typeof _0x525d5c[_0xf2f2('0x34')]===_0xf2f2('0x33');var _0x6edecd=_0x1d4288[_0xf2f2('0x35')];var _0x1bd886=_0x2f40aa?0x0:_0x525d5c['offset'];var _0x3ee65c=_0x2f40aa?_0x1d4288[_0xf2f2('0x35')]:_0x525d5c[_0xf2f2('0x32')]+_0x525d5c[_0xf2f2('0x34')];var _0x1aa42d;if(_0x3ee65c>=_0x6edecd){_0x3ee65c=_0x6edecd;_0x1aa42d=0xc8;}else{_0x1aa42d=0xce;}_0xa1d7b8[_0xf2f2('0x30')](_0x1aa42d);return _0xa1d7b8['set']('Content-Range',_0x1bd886+'-'+_0x3ee65c+'/'+_0x6edecd)['json'](_0x1d4288);}return null;};}function patchUpdates(_0x559417){return function(_0x5e964e){try{jsonpatch['apply'](_0x5e964e,_0x559417,!![]);}catch(_0x49aa75){return BPromise[_0xf2f2('0x36')](_0x49aa75);}return _0x5e964e[_0xf2f2('0x37')]();};}function saveUpdates(_0x56ac38,_0x580572){return function(_0x2248d2){if(_0x2248d2){return _0x2248d2[_0xf2f2('0x38')](_0x56ac38)[_0xf2f2('0x23')](function(_0x3da1cf){return _0x3da1cf;});}return null;};}function removeEntity(_0x209bc0,_0x357a57){return function(_0x675e7c){if(_0x675e7c){return _0x675e7c['destroy']()[_0xf2f2('0x23')](function(){var _0x324fe8=_0x675e7c['get']({'plain':!![]});var _0x290e53=_0xf2f2('0x39');return db[_0xf2f2('0x3a')][_0xf2f2('0x3b')]({'where':{'type':_0x290e53,'resourceId':_0x324fe8['id']}})[_0xf2f2('0x23')](function(){return _0x675e7c;});})[_0xf2f2('0x23')](function(){_0x209bc0[_0xf2f2('0x30')](0xcc)[_0xf2f2('0x2f')]();});}};}function handleEntityNotFound(_0x1ad0ec,_0xb153e){return function(_0x236792){if(!_0x236792){_0x1ad0ec[_0xf2f2('0x2e')](0x194);}return _0x236792;};}function handleError(_0x379122,_0x373ee0){_0x373ee0=_0x373ee0||0x1f4;return function(_0x318005){logger[_0xf2f2('0x2a')](_0x318005['stack']);if(_0x318005[_0xf2f2('0x3c')]){delete _0x318005['name'];}_0x379122[_0xf2f2('0x30')](_0x373ee0)[_0xf2f2('0x3d')](_0x318005);};}exports[_0xf2f2('0x3e')]=function(_0x4013e9,_0x27dbfe){var _0x5c8492={},_0x4909e1={},_0x22f7ae={'count':0x0,'rows':[]};var _0x551b95=_[_0xf2f2('0x3f')](db[_0xf2f2('0x40')][_0xf2f2('0x41')],function(_0x293bb0){return{'name':_0x293bb0[_0xf2f2('0x42')],'type':_0x293bb0[_0xf2f2('0x43')][_0xf2f2('0x44')]};});_0x4909e1[_0xf2f2('0x45')]=_[_0xf2f2('0x3f')](_0x551b95,'name');_0x4909e1['query']=_[_0xf2f2('0x46')](_0x4013e9[_0xf2f2('0x47')]);_0x4909e1[_0xf2f2('0x48')]=_['intersection'](_0x4909e1['model'],_0x4909e1['query']);_0x5c8492[_0xf2f2('0x49')]=_[_0xf2f2('0x4a')](_0x4909e1[_0xf2f2('0x45')],qs[_0xf2f2('0x4b')](_0x4013e9[_0xf2f2('0x47')][_0xf2f2('0x4b')]));_0x5c8492[_0xf2f2('0x49')]=_0x5c8492[_0xf2f2('0x49')]['length']?_0x5c8492[_0xf2f2('0x49')]:_0x4909e1[_0xf2f2('0x45')];if(!_0x4013e9['query'][_0xf2f2('0x4c')](_0xf2f2('0x4d'))){_0x5c8492['limit']=qs[_0xf2f2('0x34')](_0x4013e9[_0xf2f2('0x47')]['limit']);_0x5c8492[_0xf2f2('0x32')]=qs[_0xf2f2('0x32')](_0x4013e9[_0xf2f2('0x47')][_0xf2f2('0x32')]);}_0x5c8492[_0xf2f2('0x4e')]=qs[_0xf2f2('0x4f')](_0x4013e9[_0xf2f2('0x47')][_0xf2f2('0x4f')]);_0x5c8492['where']=qs[_0xf2f2('0x48')](_[_0xf2f2('0x50')](_0x4013e9[_0xf2f2('0x47')],_0x4909e1[_0xf2f2('0x48')]),_0x551b95);if(_0x4013e9['query'][_0xf2f2('0x51')]){_0x5c8492[_0xf2f2('0x52')]=_[_0xf2f2('0x53')](_0x5c8492['where'],{'$or':_[_0xf2f2('0x3f')](_0x551b95,function(_0x205daf){if(_0x205daf[_0xf2f2('0x43')]!==_0xf2f2('0x54')){var _0x557a62={};_0x557a62[_0x205daf[_0xf2f2('0x3c')]]={'$like':'%'+_0x4013e9[_0xf2f2('0x47')]['filter']+'%'};return _0x557a62;}})});}_0x5c8492=_[_0xf2f2('0x53')]({},_0x5c8492,_0x4013e9[_0xf2f2('0x55')]);var _0x433471={'where':_0x5c8492[_0xf2f2('0x52')]};return db[_0xf2f2('0x40')][_0xf2f2('0x35')](_0x433471)[_0xf2f2('0x23')](function(_0x55153c){_0x22f7ae['count']=_0x55153c;if(_0x4013e9[_0xf2f2('0x47')][_0xf2f2('0x56')]){_0x5c8492[_0xf2f2('0x57')]=[{'all':!![]}];}return db[_0xf2f2('0x40')][_0xf2f2('0x58')](_0x5c8492);})[_0xf2f2('0x23')](function(_0x72ba68){_0x22f7ae[_0xf2f2('0x59')]=_0x72ba68;return _0x22f7ae;})[_0xf2f2('0x23')](respondWithFilteredResult(_0x27dbfe,_0x5c8492))['catch'](handleError(_0x27dbfe,null));};exports[_0xf2f2('0x5a')]=function(_0x2c136e,_0x3ec912){var _0x529f81={'raw':!![],'where':{'id':_0x2c136e[_0xf2f2('0x5b')]['id']}},_0x25d0f6={};_0x25d0f6[_0xf2f2('0x45')]=_[_0xf2f2('0x46')](db[_0xf2f2('0x40')][_0xf2f2('0x41')]);_0x25d0f6[_0xf2f2('0x47')]=_[_0xf2f2('0x46')](_0x2c136e['query']);_0x25d0f6[_0xf2f2('0x48')]=_[_0xf2f2('0x4a')](_0x25d0f6[_0xf2f2('0x45')],_0x25d0f6[_0xf2f2('0x47')]);_0x529f81[_0xf2f2('0x49')]=_[_0xf2f2('0x4a')](_0x25d0f6['model'],qs[_0xf2f2('0x4b')](_0x2c136e['query'][_0xf2f2('0x4b')]));_0x529f81[_0xf2f2('0x49')]=_0x529f81[_0xf2f2('0x49')]['length']?_0x529f81['attributes']:_0x25d0f6['model'];if(_0x2c136e['query']['includeAll']){_0x529f81[_0xf2f2('0x57')]=[{'all':!![]}];}_0x529f81=_['merge']({},_0x529f81,_0x2c136e['options']);return db[_0xf2f2('0x40')][_0xf2f2('0x5c')](_0x529f81)[_0xf2f2('0x23')](handleEntityNotFound(_0x3ec912,null))['then'](respondWithResult(_0x3ec912,null))['catch'](handleError(_0x3ec912,null));};exports[_0xf2f2('0x5d')]=function(_0x3df991,_0x499316){return db[_0xf2f2('0x40')][_0xf2f2('0x5d')](_0x3df991['body'],{})[_0xf2f2('0x23')](function(_0x42a6d6){var _0x115f13=_0x3df991['user'][_0xf2f2('0x5e')]({'plain':!![]});if(!_0x115f13)throw new Error(_0xf2f2('0x5f'));if(_0x115f13[_0xf2f2('0x60')]===_0xf2f2('0x61')){var _0x58062a=_0x42a6d6['get']({'plain':!![]});var _0x201942='ChatQueues';return db[_0xf2f2('0x62')]['find']({'where':{'name':_0x201942,'userProfileId':_0x115f13[_0xf2f2('0x63')]},'raw':!![]})['then'](function(_0x1feb6a){if(_0x1feb6a&&_0x1feb6a[_0xf2f2('0x64')]===0x0){return db[_0xf2f2('0x3a')]['create']({'name':_0x58062a[_0xf2f2('0x3c')],'resourceId':_0x58062a['id'],'type':_0x1feb6a[_0xf2f2('0x3c')],'sectionId':_0x1feb6a['id']},{})[_0xf2f2('0x23')](function(){return _0x42a6d6;});}else{return _0x42a6d6;}})[_0xf2f2('0x2d')](function(_0x385af4){logger[_0xf2f2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x385af4);throw _0x385af4;});}return _0x42a6d6;})['then'](respondWithResult(_0x499316,0xc9))[_0xf2f2('0x2d')](handleError(_0x499316,null));};exports['update']=function(_0x212455,_0x77b4ff){if(_0x212455['body']['id']){delete _0x212455[_0xf2f2('0x65')]['id'];}return db['ChatQueue'][_0xf2f2('0x5c')]({'where':{'id':_0x212455[_0xf2f2('0x5b')]['id']}})[_0xf2f2('0x23')](handleEntityNotFound(_0x77b4ff,null))[_0xf2f2('0x23')](saveUpdates(_0x212455[_0xf2f2('0x65')],null))[_0xf2f2('0x23')](respondWithResult(_0x77b4ff,null))[_0xf2f2('0x2d')](handleError(_0x77b4ff,null));};exports[_0xf2f2('0x3b')]=function(_0x34413e,_0x645cb3){return db[_0xf2f2('0x40')]['find']({'where':{'id':_0x34413e[_0xf2f2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x645cb3,null))[_0xf2f2('0x23')](removeEntity(_0x645cb3,null))[_0xf2f2('0x2d')](handleError(_0x645cb3,null));};exports['describe']=function(_0x160c09,_0x45658c){return db[_0xf2f2('0x40')][_0xf2f2('0x66')]()[_0xf2f2('0x23')](respondWithResult(_0x45658c,null))[_0xf2f2('0x2d')](handleError(_0x45658c,null));};exports['getMembers']=function(_0x2802ed,_0x4228aa,_0x314287){var _0x2153a5={'raw':!![],'where':{}},_0x30a966={},_0xf126ab;return db['ChatQueue'][_0xf2f2('0x67')]({'where':{'id':_0x2802ed[_0xf2f2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4228aa,null))[_0xf2f2('0x23')](function(_0x140029){if(_0x140029){_0xf126ab=_0x140029['get']({'plain':!![]});_0x30a966[_0xf2f2('0x45')]=_[_0xf2f2('0x46')](db[_0xf2f2('0x68')]['rawAttributes']);_0x30a966[_0xf2f2('0x47')]=_['keys'](_0x2802ed[_0xf2f2('0x47')]);_0x30a966['filters']=_[_0xf2f2('0x4a')](_0x30a966['model'],_0x30a966[_0xf2f2('0x47')]);_0x2153a5[_0xf2f2('0x49')]=_[_0xf2f2('0x4a')](_0x30a966['model'],qs[_0xf2f2('0x4b')](_0x2802ed[_0xf2f2('0x47')][_0xf2f2('0x4b')]));_0x2153a5[_0xf2f2('0x49')]=_0x2153a5[_0xf2f2('0x49')][_0xf2f2('0x69')]?_0x2153a5[_0xf2f2('0x49')]:_0x30a966['model'];if(!_0x2802ed[_0xf2f2('0x47')][_0xf2f2('0x4c')](_0xf2f2('0x4d'))){_0x2153a5[_0xf2f2('0x34')]=qs[_0xf2f2('0x34')](_0x2802ed[_0xf2f2('0x47')][_0xf2f2('0x34')]);_0x2153a5[_0xf2f2('0x32')]=qs[_0xf2f2('0x32')](_0x2802ed[_0xf2f2('0x47')][_0xf2f2('0x32')]);}_0x2153a5[_0xf2f2('0x4e')]=qs[_0xf2f2('0x4f')](_0x2802ed['query'][_0xf2f2('0x4f')]);_0x2153a5[_0xf2f2('0x52')]=qs[_0xf2f2('0x48')](_[_0xf2f2('0x50')](_0x2802ed[_0xf2f2('0x47')],_0x30a966['filters']));_0x2153a5['where'][_0xf2f2('0x6a')]=_0x140029['id'];if(_0x2802ed[_0xf2f2('0x47')][_0xf2f2('0x51')]){_0x2153a5[_0xf2f2('0x52')]=_[_0xf2f2('0x53')](_0x2153a5[_0xf2f2('0x52')],{'$or':_['map'](_0x2153a5[_0xf2f2('0x49')],function(_0x4d96b6){var _0x454077={};_0x454077[_0x4d96b6]={'$like':'%'+_0x2802ed[_0xf2f2('0x47')][_0xf2f2('0x51')]+'%'};return _0x454077;})});}_0x2153a5=_[_0xf2f2('0x53')]({},_0x2153a5,_0x2802ed[_0xf2f2('0x55')]);return db[_0xf2f2('0x68')]['findAll'](_0x2153a5);}})['then'](function(_0x599ec8){if(_0x599ec8){return db[_0xf2f2('0x6b')][_0xf2f2('0x6c')]({'where':{'id':_[_0xf2f2('0x3f')](_0x599ec8,'UserId'),'role':_0xf2f2('0x6d')},'attributes':['id','name',_0xf2f2('0x6e'),_0xf2f2('0x6f'),_0xf2f2('0x70')]});}})[_0xf2f2('0x23')](function(_0x3f06a6){if(_0x3f06a6){return{'count':_0x3f06a6[_0xf2f2('0x35')],'rows':_[_0xf2f2('0x3f')](_0x3f06a6[_0xf2f2('0x59')],function(_0x121b2e){return{'membername':_0x121b2e[_0xf2f2('0x3c')],'UserId':_0x121b2e['id'],'queue_name':_0xf126ab[_0xf2f2('0x3c')],'ChatQueueId':_0xf126ab['id'],'interface':util['format'](_0xf2f2('0x71'),'SIP',_0x121b2e[_0xf2f2('0x3c')]),'penalty':0x0,'paused':_0x121b2e[_0xf2f2('0x6e')],'createdAt':_0x121b2e['createdAt'],'updatedAt':_0x121b2e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf2f2('0x23')](respondWithFilteredResult(_0x4228aa,_0x2153a5))[_0xf2f2('0x2d')](handleError(_0x4228aa,null));};exports[_0xf2f2('0x72')]=function(_0x10f826,_0x42dc8f,_0x3281cf){var _0x49c7e4={};var _0x2223d9={};var _0x41d3d1;var _0x388f8a;return db[_0xf2f2('0x40')][_0xf2f2('0x67')]({'where':{'id':_0x10f826[_0xf2f2('0x5b')]['id']}})[_0xf2f2('0x23')](handleEntityNotFound(_0x42dc8f,null))[_0xf2f2('0x23')](function(_0x57e832){if(_0x57e832){_0x41d3d1=_0x57e832;_0x2223d9[_0xf2f2('0x45')]=_[_0xf2f2('0x46')](db[_0xf2f2('0x73')]['rawAttributes']);_0x2223d9['query']=_[_0xf2f2('0x46')](_0x10f826['query']);_0x2223d9[_0xf2f2('0x48')]=_[_0xf2f2('0x4a')](_0x2223d9[_0xf2f2('0x45')],_0x2223d9[_0xf2f2('0x47')]);_0x49c7e4['attributes']=_['intersection'](_0x2223d9[_0xf2f2('0x45')],qs[_0xf2f2('0x4b')](_0x10f826[_0xf2f2('0x47')][_0xf2f2('0x4b')]));_0x49c7e4[_0xf2f2('0x49')]=_0x49c7e4[_0xf2f2('0x49')][_0xf2f2('0x69')]?_0x49c7e4['attributes']:_0x2223d9[_0xf2f2('0x45')];_0x49c7e4[_0xf2f2('0x4e')]=qs[_0xf2f2('0x4f')](_0x10f826[_0xf2f2('0x47')][_0xf2f2('0x4f')]);_0x49c7e4[_0xf2f2('0x52')]=qs['filters'](_[_0xf2f2('0x50')](_0x10f826[_0xf2f2('0x47')],_0x2223d9[_0xf2f2('0x48')]));if(_0x10f826['query']['filter']){_0x49c7e4[_0xf2f2('0x52')]=_[_0xf2f2('0x53')](_0x49c7e4[_0xf2f2('0x52')],{'$or':_['map'](_0x49c7e4[_0xf2f2('0x49')],function(_0x40e4e9){var _0x26011c={};_0x26011c[_0x40e4e9]={'$like':'%'+_0x10f826[_0xf2f2('0x47')][_0xf2f2('0x51')]+'%'};return _0x26011c;})});}_0x49c7e4=_[_0xf2f2('0x53')]({},_0x49c7e4,_0x10f826['options']);return _0x41d3d1[_0xf2f2('0x72')](_0x49c7e4);}})['then'](function(_0x5350c6){if(_0x5350c6){_0x388f8a=_0x5350c6['length'];if(!_0x10f826[_0xf2f2('0x47')][_0xf2f2('0x4c')](_0xf2f2('0x4d'))){_0x49c7e4[_0xf2f2('0x34')]=qs[_0xf2f2('0x34')](_0x10f826[_0xf2f2('0x47')][_0xf2f2('0x34')]);_0x49c7e4[_0xf2f2('0x32')]=qs[_0xf2f2('0x32')](_0x10f826[_0xf2f2('0x47')]['offset']);}return _0x41d3d1[_0xf2f2('0x72')](_0x49c7e4);}})[_0xf2f2('0x23')](function(_0x5905da){if(_0x5905da){return _0x5905da?{'count':_0x388f8a,'rows':_0x5905da}:null;}})[_0xf2f2('0x23')](respondWithResult(_0x42dc8f,null))['catch'](handleError(_0x42dc8f,null));};exports[_0xf2f2('0x74')]=function(_0x5b6e42,_0x40ce5f,_0x487702){var _0x358c32=_0x5b6e42[_0xf2f2('0x65')][_0xf2f2('0x75')];return db['Team'][_0xf2f2('0x58')]({'where':{'id':_0x358c32},'attributes':['id'],'include':[{'model':db[_0xf2f2('0x6b')],'as':_0xf2f2('0x76'),'attributes':['id','name',_0xf2f2('0x77'),'voicePause',_0xf2f2('0x78')],'raw':!![]}]})[_0xf2f2('0x23')](function(_0x3fe11a){if(_0x3fe11a){var _0x1019fe=_[_0xf2f2('0x79')](_0x3fe11a,function(_0x43239f){var _0x2f0ab0=_0x43239f['get']({'plain':!![]});return _0x2f0ab0[_0xf2f2('0x76')];});return db['ChatQueue']['find']({'where':{'id':_0x5b6e42[_0xf2f2('0x5b')]['id']}})['then'](function(_0x271014){return db['sequelize']['transaction'](function(_0x1da1b9){return _0x271014[_0xf2f2('0x74')](_0x358c32,{'transaction':_0x1da1b9})['then'](function(){return BPromise['each'](_0x1019fe,function(_0x386283){return db[_0xf2f2('0x68')][_0xf2f2('0x7a')]({'where':{'UserId':_0x386283['id'],'ChatQueueId':_0x5b6e42[_0xf2f2('0x5b')]['id']},'transaction':_0x1da1b9});});})[_0xf2f2('0x23')](function(){_0x1019fe[_0xf2f2('0x7b')](function(_0x28b0c0){socket[_0xf2f2('0x7c')](_0xf2f2('0x7d'),{'UserId':_0x28b0c0['id'],'ChatQueueId':_0x271014['id']});});});});});}})['then'](respondWithStatusCode(_0x40ce5f,null))[_0xf2f2('0x2d')](handleError(_0x40ce5f,null));};exports[_0xf2f2('0x7e')]=function(_0x333dbe,_0x268f1d,_0x24f9c5){return db[_0xf2f2('0x73')]['findAll']({'where':{'id':_0x333dbe[_0xf2f2('0x47')][_0xf2f2('0x75')]},'attributes':['id'],'include':[{'model':db[_0xf2f2('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf2f2('0x23')](handleEntityNotFound(_0x268f1d,null))[_0xf2f2('0x23')](function(_0x1e361b){var _0x85ac8f=_['map'](_0x1e361b,'id');var _0x1b199c=[];var _0x382f03=[];var _0x57d969=squel[_0xf2f2('0x7f')]();_0x57d969[_0xf2f2('0x80')](_0xf2f2('0x81'))[_0xf2f2('0x82')](_0xf2f2('0x83'),'tq')[_0xf2f2('0x84')](_0xf2f2('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf2f2('0x52')](_0xf2f2('0x86'),_0x333dbe[_0xf2f2('0x5b')]['id']);for(var _0x42badf=0x0;_0x42badf<_0x1e361b[_0xf2f2('0x69')];_0x42badf+=0x1){let _0x525988=_0x1e361b[_0x42badf];for(var _0x355903=0x0;_0x355903<_0x525988[_0xf2f2('0x76')][_0xf2f2('0x69')];_0x355903+=0x1){let _0x514318=_0x525988[_0xf2f2('0x76')][_0x355903];var _0x12d417=_0x57d969[_0xf2f2('0x87')]();_0x12d417['where'](_0xf2f2('0x88'),_0x514318['id']);_0x382f03[_0xf2f2('0x89')](db[_0xf2f2('0x8a')][_0xf2f2('0x47')](_0x12d417[_0xf2f2('0x8b')](),{'type':db['sequelize'][_0xf2f2('0x8c')][_0xf2f2('0x8d')]})[_0xf2f2('0x23')](function(_0x48ae39){if(_0x48ae39[_0xf2f2('0x69')]===0x1){return _0x514318['id'];}else{var _0x3af329=_[_0xf2f2('0x8e')](_[_0xf2f2('0x3f')](_0x48ae39,'TeamId'),function(_0x371810){return _[_0xf2f2('0x8f')](_0x85ac8f,_0x371810);});if(_0x3af329){return _0x514318['id'];}}}));}}return BPromise[_0xf2f2('0x90')](_0x382f03)[_0xf2f2('0x23')](function(_0x39e021){_0x1b199c=_(_0x1b199c)['union'](_0x39e021)[_0xf2f2('0x91')]()[_0xf2f2('0x92')]();return db[_0xf2f2('0x40')][_0xf2f2('0x5c')]({'where':{'id':_0x333dbe[_0xf2f2('0x5b')]['id']}})[_0xf2f2('0x23')](function(_0x1a2311){return db[_0xf2f2('0x8a')]['transaction'](function(_0x2e2ee9){return _0x1a2311['removeTeams'](_0x333dbe[_0xf2f2('0x47')][_0xf2f2('0x75')],{'transaction':_0x2e2ee9})[_0xf2f2('0x23')](function(){if(!_[_0xf2f2('0x93')](_0x1b199c)){return _0x1a2311['removeAgents'](_0x1b199c,{'transaction':_0x2e2ee9});}})[_0xf2f2('0x23')](function(){_0x1b199c[_0xf2f2('0x7b')](function(_0x47c51a){socket[_0xf2f2('0x7c')](_0xf2f2('0x94'),{'UserId':_0x47c51a,'ChatQueueId':_0x1a2311['id']});});});});});});})['then'](respondWithStatusCode(_0x268f1d,null))['catch'](handleError(_0x268f1d,null));};exports[_0xf2f2('0x95')]=function(_0x5034b4,_0x215f43,_0x21455e){return db[_0xf2f2('0x40')][_0xf2f2('0x5c')]({'where':{'id':_0x5034b4[_0xf2f2('0x5b')]['id']}})[_0xf2f2('0x23')](handleEntityNotFound(_0x215f43,null))[_0xf2f2('0x23')](function(_0x13bcb9){if(_0x13bcb9){return _0x13bcb9['addAgents'](_0x5034b4[_0xf2f2('0x65')][_0xf2f2('0x75')],_[_0xf2f2('0x96')](_0x5034b4[_0xf2f2('0x65')],[_0xf2f2('0x75'),'id'])||{})[_0xf2f2('0x97')](function(_0x1ab7bc){for(var _0x4ef2b3=0x0;_0x4ef2b3<_0x5034b4[_0xf2f2('0x65')][_0xf2f2('0x75')][_0xf2f2('0x69')];_0x4ef2b3+=0x1){socket['emit'](_0xf2f2('0x7d'),{'UserId':Number(_0x5034b4[_0xf2f2('0x65')][_0xf2f2('0x75')][_0x4ef2b3]),'ChatQueueId':Number(_0x5034b4[_0xf2f2('0x5b')]['id'])});}return _0x1ab7bc;});}})[_0xf2f2('0x23')](respondWithResult(_0x215f43,null))[_0xf2f2('0x2d')](handleError(_0x215f43,null));};exports['removeAgents']=function(_0x4d7614,_0x100fc5,_0x114a9b){return db['ChatQueue'][_0xf2f2('0x5c')]({'where':{'id':_0x4d7614[_0xf2f2('0x5b')]['id']}})[_0xf2f2('0x23')](handleEntityNotFound(_0x100fc5,null))[_0xf2f2('0x23')](function(_0x310abf){if(_0x310abf){return _0x310abf[_0xf2f2('0x98')](_0x4d7614[_0xf2f2('0x47')][_0xf2f2('0x75')])[_0xf2f2('0x23')](function(){if(_['isArray'](_0x4d7614[_0xf2f2('0x47')][_0xf2f2('0x75')])){for(var _0x5d99ee=0x0;_0x5d99ee<_0x4d7614[_0xf2f2('0x47')][_0xf2f2('0x75')][_0xf2f2('0x69')];_0x5d99ee+=0x1){socket[_0xf2f2('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x4d7614[_0xf2f2('0x47')][_0xf2f2('0x75')][_0x5d99ee]),'ChatQueueId':Number(_0x4d7614[_0xf2f2('0x5b')]['id'])});}}else{socket['emit'](_0xf2f2('0x94'),{'UserId':Number(_0x4d7614[_0xf2f2('0x47')][_0xf2f2('0x75')]),'ChatQueueId':Number(_0x4d7614[_0xf2f2('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x100fc5,null))[_0xf2f2('0x2d')](handleError(_0x100fc5,null));};exports[_0xf2f2('0x99')]=function(_0x219ace,_0x3a61b6,_0x10f82d){var _0x15046a={};var _0x1c0b91={};var _0x414b03;var _0x2e07d5;return db[_0xf2f2('0x40')][_0xf2f2('0x67')]({'where':{'id':_0x219ace[_0xf2f2('0x5b')]['id']}})[_0xf2f2('0x23')](handleEntityNotFound(_0x3a61b6,null))['then'](function(_0x17ffa3){if(_0x17ffa3){_0x414b03=_0x17ffa3;_0x1c0b91['model']=_[_0xf2f2('0x46')](db['User']['rawAttributes']);_0x1c0b91[_0xf2f2('0x47')]=_[_0xf2f2('0x46')](_0x219ace[_0xf2f2('0x47')]);_0x1c0b91[_0xf2f2('0x48')]=_[_0xf2f2('0x4a')](_0x1c0b91[_0xf2f2('0x45')],_0x1c0b91[_0xf2f2('0x47')]);_0x15046a[_0xf2f2('0x49')]=_[_0xf2f2('0x4a')](_0x1c0b91['model'],qs['fields'](_0x219ace[_0xf2f2('0x47')][_0xf2f2('0x4b')]));_0x15046a[_0xf2f2('0x49')]=_0x15046a[_0xf2f2('0x49')][_0xf2f2('0x69')]?_0x15046a[_0xf2f2('0x49')]:_0x1c0b91[_0xf2f2('0x45')];_0x15046a[_0xf2f2('0x4e')]=qs[_0xf2f2('0x4f')](_0x219ace[_0xf2f2('0x47')]['sort']);_0x15046a[_0xf2f2('0x52')]=qs[_0xf2f2('0x48')](_['pick'](_0x219ace['query'],_0x1c0b91['filters']));if(_0x219ace[_0xf2f2('0x47')][_0xf2f2('0x51')]){_0x15046a[_0xf2f2('0x52')]=_[_0xf2f2('0x53')](_0x15046a[_0xf2f2('0x52')],{'$or':_[_0xf2f2('0x3f')](_0x15046a['attributes'],function(_0x77979b){var _0xeb6f94={};_0xeb6f94[_0x77979b]={'$like':'%'+_0x219ace[_0xf2f2('0x47')]['filter']+'%'};return _0xeb6f94;})});}_0x15046a=_[_0xf2f2('0x53')]({},_0x15046a,_0x219ace['options']);return _0x414b03[_0xf2f2('0x99')](_0x15046a);}})['then'](function(_0x2134c7){if(_0x2134c7){_0x2e07d5=_0x2134c7[_0xf2f2('0x69')];if(!_0x219ace[_0xf2f2('0x47')]['hasOwnProperty'](_0xf2f2('0x4d'))){_0x15046a[_0xf2f2('0x34')]=qs[_0xf2f2('0x34')](_0x219ace[_0xf2f2('0x47')][_0xf2f2('0x34')]);_0x15046a[_0xf2f2('0x32')]=qs[_0xf2f2('0x32')](_0x219ace[_0xf2f2('0x47')]['offset']);}return _0x414b03[_0xf2f2('0x99')](_0x15046a);}})[_0xf2f2('0x23')](function(_0x4c854d){if(_0x4c854d){return _0x4c854d?{'count':_0x2e07d5,'rows':_0x4c854d}:null;}})[_0xf2f2('0x23')](respondWithResult(_0x3a61b6,null))[_0xf2f2('0x2d')](handleError(_0x3a61b6,null));}; \ No newline at end of file +var _0x5217=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','offset','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','type','filter','options','ChatQueue','includeAll','include','rows','catch','show','length','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','UserChatQueue','ChatQueueId','findAll','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','findOrCreate','forEach','emit','userChatQueue:save','User','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','value','removeTeams','isEmpty','userChatQueue:remove','addAgents','omit','removeAgents','getAgents','nolimit','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5217,0x1ad));var _0x7521=function(_0x5315e1,_0x235063){_0x5315e1=_0x5315e1-0x0;var _0x215a35=_0x5217[_0x5315e1];return _0x215a35;};'use strict';var emlformat=require(_0x7521('0x0'));var rimraf=require(_0x7521('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7521('0x2'));var moment=require(_0x7521('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7521('0x4'));var util=require(_0x7521('0x5'));var path=require('path');var sox=require(_0x7521('0x6'));var csv=require(_0x7521('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7521('0x8'));var _=require(_0x7521('0x9'));var squel=require(_0x7521('0xa'));var crypto=require('crypto');var jsforce=require(_0x7521('0xb'));var deskjs=require(_0x7521('0xc'));var toCsv=require(_0x7521('0x7'));var querystring=require(_0x7521('0xd'));var Papa=require('papaparse');var Redis=require(_0x7521('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7521('0xf'));var as=require(_0x7521('0x10'));var hardwareService=require(_0x7521('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7521('0x12'));var config=require(_0x7521('0x13'));var licenseUtil=require(_0x7521('0x14'));var db=require(_0x7521('0x15'))['db'];config[_0x7521('0x16')]=_[_0x7521('0x17')](config['redis'],{'host':_0x7521('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7521('0x16')]));require(_0x7521('0x19'))[_0x7521('0x1a')](socket);var jayson=require(_0x7521('0x1b'));var client=jayson[_0x7521('0x1c')][_0x7521('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x47dd8d,_0x4668ed,_0x351918,_0x5e4789){return new BPromise(function(_0x4d6cc2,_0x53a14a){var _0x2562bd=_0x5e4789||client;return _0x2562bd[_0x7521('0x1e')](_0x47dd8d,_0x351918)[_0x7521('0x1f')](function(_0x19f621){logger[_0x7521('0x20')](_0x7521('0x21'),_0x4668ed,_0x7521('0x22'));logger['debug'](_0x7521('0x23'),_0x4668ed,'request\x20sent',JSON[_0x7521('0x24')](_0x19f621));if(_0x19f621[_0x7521('0x25')]){if(_0x19f621[_0x7521('0x25')][_0x7521('0x26')]===0x1f4){logger[_0x7521('0x25')](_0x7521('0x21'),_0x4668ed,_0x19f621[_0x7521('0x25')][_0x7521('0x27')]);return _0x53a14a(_0x19f621[_0x7521('0x25')][_0x7521('0x27')]);}logger[_0x7521('0x25')](_0x7521('0x21'),_0x4668ed,_0x19f621[_0x7521('0x25')][_0x7521('0x27')]);return _0x4d6cc2(_0x19f621[_0x7521('0x25')][_0x7521('0x27')]);}else{logger[_0x7521('0x20')](_0x7521('0x21'),_0x4668ed,_0x7521('0x22'));_0x4d6cc2(_0x19f621[_0x7521('0x28')][_0x7521('0x27')]);}})['catch'](function(_0x407ba6){logger['error'](_0x7521('0x21'),_0x4668ed,_0x407ba6);_0x53a14a(_0x407ba6);});});}function respondWithStatusCode(_0x616010,_0x4887c0){_0x4887c0=_0x4887c0||0xcc;return function(_0x14a4e9){if(_0x14a4e9){return _0x616010[_0x7521('0x29')](_0x4887c0);}return _0x616010['status'](_0x4887c0)[_0x7521('0x2a')]();};}function respondWithResult(_0x547e7c,_0x435fb){_0x435fb=_0x435fb||0xc8;return function(_0x480ddc){if(_0x480ddc){return _0x547e7c[_0x7521('0x2b')](_0x435fb)['json'](_0x480ddc);}};}function respondWithFilteredResult(_0x486a56,_0x4bf3cf){return function(_0x49e7de){if(_0x49e7de){var _0x4ee851=typeof _0x4bf3cf[_0x7521('0x2c')]==='undefined'&&typeof _0x4bf3cf['limit']==='undefined';var _0x253e2a=_0x49e7de['count'];var _0xe872d8=_0x4ee851?0x0:_0x4bf3cf[_0x7521('0x2c')];var _0x512c13=_0x4ee851?_0x49e7de[_0x7521('0x2d')]:_0x4bf3cf[_0x7521('0x2c')]+_0x4bf3cf[_0x7521('0x2e')];var _0x1cd97a;if(_0x512c13>=_0x253e2a){_0x512c13=_0x253e2a;_0x1cd97a=0xc8;}else{_0x1cd97a=0xce;}_0x486a56[_0x7521('0x2b')](_0x1cd97a);return _0x486a56[_0x7521('0x2f')](_0x7521('0x30'),_0xe872d8+'-'+_0x512c13+'/'+_0x253e2a)[_0x7521('0x31')](_0x49e7de);}return null;};}function patchUpdates(_0x1331ea){return function(_0x1f4cda){try{jsonpatch[_0x7521('0x32')](_0x1f4cda,_0x1331ea,!![]);}catch(_0x2d8593){return BPromise[_0x7521('0x33')](_0x2d8593);}return _0x1f4cda[_0x7521('0x34')]();};}function saveUpdates(_0x419b50,_0x2ff493){return function(_0x20c9ce){if(_0x20c9ce){return _0x20c9ce[_0x7521('0x35')](_0x419b50)['then'](function(_0x2b1821){return _0x2b1821;});}return null;};}function removeEntity(_0xfa5e7,_0x598979){return function(_0x2e40d0){if(_0x2e40d0){return _0x2e40d0[_0x7521('0x36')]()[_0x7521('0x1f')](function(){var _0x32b93a=_0x2e40d0[_0x7521('0x37')]({'plain':!![]});var _0x380d42=_0x7521('0x38');return db[_0x7521('0x39')][_0x7521('0x36')]({'where':{'type':_0x380d42,'resourceId':_0x32b93a['id']}})['then'](function(){return _0x2e40d0;});})[_0x7521('0x1f')](function(){_0xfa5e7[_0x7521('0x2b')](0xcc)[_0x7521('0x2a')]();});}};}function handleEntityNotFound(_0x3bce1e,_0xd32c2e){return function(_0x226d3b){if(!_0x226d3b){_0x3bce1e[_0x7521('0x29')](0x194);}return _0x226d3b;};}function handleError(_0x2bdba4,_0xedeef6){_0xedeef6=_0xedeef6||0x1f4;return function(_0x4a832e){logger[_0x7521('0x25')](_0x4a832e[_0x7521('0x3a')]);if(_0x4a832e[_0x7521('0x3b')]){delete _0x4a832e[_0x7521('0x3b')];}_0x2bdba4[_0x7521('0x2b')](_0xedeef6)['send'](_0x4a832e);};}exports[_0x7521('0x3c')]=function(_0x13250e,_0x2f4e7b){var _0x457461={},_0x366152={},_0x1b6abc={'count':0x0,'rows':[]};var _0xac6bf4=_[_0x7521('0x3d')](db['ChatQueue'][_0x7521('0x3e')],function(_0x4bc8db){return{'name':_0x4bc8db['fieldName'],'type':_0x4bc8db['type'][_0x7521('0x3f')]};});_0x366152[_0x7521('0x40')]=_['map'](_0xac6bf4,'name');_0x366152[_0x7521('0x41')]=_[_0x7521('0x42')](_0x13250e[_0x7521('0x41')]);_0x366152[_0x7521('0x43')]=_[_0x7521('0x44')](_0x366152['model'],_0x366152[_0x7521('0x41')]);_0x457461[_0x7521('0x45')]=_['intersection'](_0x366152[_0x7521('0x40')],qs['fields'](_0x13250e['query'][_0x7521('0x46')]));_0x457461[_0x7521('0x45')]=_0x457461['attributes']['length']?_0x457461[_0x7521('0x45')]:_0x366152['model'];if(!_0x13250e['query'][_0x7521('0x47')]('nolimit')){_0x457461['limit']=qs[_0x7521('0x2e')](_0x13250e[_0x7521('0x41')][_0x7521('0x2e')]);_0x457461['offset']=qs[_0x7521('0x2c')](_0x13250e[_0x7521('0x41')][_0x7521('0x2c')]);}_0x457461[_0x7521('0x48')]=qs[_0x7521('0x49')](_0x13250e[_0x7521('0x41')][_0x7521('0x49')]);_0x457461[_0x7521('0x4a')]=qs[_0x7521('0x43')](_[_0x7521('0x4b')](_0x13250e[_0x7521('0x41')],_0x366152[_0x7521('0x43')]),_0xac6bf4);if(_0x13250e[_0x7521('0x41')]['filter']){_0x457461[_0x7521('0x4a')]=_['merge'](_0x457461[_0x7521('0x4a')],{'$or':_['map'](_0xac6bf4,function(_0x46a7b0){if(_0x46a7b0[_0x7521('0x4c')]!=='VIRTUAL'){var _0x557709={};_0x557709[_0x46a7b0[_0x7521('0x3b')]]={'$like':'%'+_0x13250e['query'][_0x7521('0x4d')]+'%'};return _0x557709;}})});}_0x457461=_['merge']({},_0x457461,_0x13250e[_0x7521('0x4e')]);var _0x1be7fb={'where':_0x457461[_0x7521('0x4a')]};return db[_0x7521('0x4f')][_0x7521('0x2d')](_0x1be7fb)['then'](function(_0x432071){_0x1b6abc[_0x7521('0x2d')]=_0x432071;if(_0x13250e[_0x7521('0x41')][_0x7521('0x50')]){_0x457461[_0x7521('0x51')]=[{'all':!![]}];}return db[_0x7521('0x4f')]['findAll'](_0x457461);})[_0x7521('0x1f')](function(_0x26b58e){_0x1b6abc[_0x7521('0x52')]=_0x26b58e;return _0x1b6abc;})[_0x7521('0x1f')](respondWithFilteredResult(_0x2f4e7b,_0x457461))[_0x7521('0x53')](handleError(_0x2f4e7b,null));};exports[_0x7521('0x54')]=function(_0x2c1d71,_0x57e585){var _0x4c4030={'raw':!![],'where':{'id':_0x2c1d71['params']['id']}},_0x2c03f9={};_0x2c03f9[_0x7521('0x40')]=_['keys'](db[_0x7521('0x4f')][_0x7521('0x3e')]);_0x2c03f9[_0x7521('0x41')]=_[_0x7521('0x42')](_0x2c1d71['query']);_0x2c03f9[_0x7521('0x43')]=_['intersection'](_0x2c03f9[_0x7521('0x40')],_0x2c03f9[_0x7521('0x41')]);_0x4c4030[_0x7521('0x45')]=_['intersection'](_0x2c03f9[_0x7521('0x40')],qs[_0x7521('0x46')](_0x2c1d71[_0x7521('0x41')]['fields']));_0x4c4030[_0x7521('0x45')]=_0x4c4030[_0x7521('0x45')][_0x7521('0x55')]?_0x4c4030['attributes']:_0x2c03f9[_0x7521('0x40')];if(_0x2c1d71[_0x7521('0x41')][_0x7521('0x50')]){_0x4c4030['include']=[{'all':!![]}];}_0x4c4030=_[_0x7521('0x56')]({},_0x4c4030,_0x2c1d71[_0x7521('0x4e')]);return db['ChatQueue'][_0x7521('0x57')](_0x4c4030)[_0x7521('0x1f')](handleEntityNotFound(_0x57e585,null))[_0x7521('0x1f')](respondWithResult(_0x57e585,null))[_0x7521('0x53')](handleError(_0x57e585,null));};exports[_0x7521('0x58')]=function(_0x49938d,_0x14adab){return db[_0x7521('0x4f')][_0x7521('0x58')](_0x49938d['body'],{})['then'](function(_0x58fd8d){var _0x24d29e=_0x49938d['user'][_0x7521('0x37')]({'plain':!![]});if(!_0x24d29e)throw new Error(_0x7521('0x59'));if(_0x24d29e['role']==='user'){var _0x828664=_0x58fd8d[_0x7521('0x37')]({'plain':!![]});var _0x3e978c='ChatQueues';return db[_0x7521('0x5a')][_0x7521('0x57')]({'where':{'name':_0x3e978c,'userProfileId':_0x24d29e[_0x7521('0x5b')]},'raw':!![]})[_0x7521('0x1f')](function(_0x526c91){if(_0x526c91&&_0x526c91[_0x7521('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x828664[_0x7521('0x3b')],'resourceId':_0x828664['id'],'type':_0x526c91[_0x7521('0x3b')],'sectionId':_0x526c91['id']},{})[_0x7521('0x1f')](function(){return _0x58fd8d;});}else{return _0x58fd8d;}})['catch'](function(_0x1f405a){logger[_0x7521('0x25')](_0x7521('0x5d'),_0x1f405a);throw _0x1f405a;});}return _0x58fd8d;})[_0x7521('0x1f')](respondWithResult(_0x14adab,0xc9))[_0x7521('0x53')](handleError(_0x14adab,null));};exports[_0x7521('0x35')]=function(_0x228ac4,_0x2fe1cd){if(_0x228ac4[_0x7521('0x5e')]['id']){delete _0x228ac4['body']['id'];}return db[_0x7521('0x4f')]['find']({'where':{'id':_0x228ac4[_0x7521('0x5f')]['id']}})[_0x7521('0x1f')](handleEntityNotFound(_0x2fe1cd,null))['then'](saveUpdates(_0x228ac4[_0x7521('0x5e')],null))[_0x7521('0x1f')](respondWithResult(_0x2fe1cd,null))['catch'](handleError(_0x2fe1cd,null));};exports[_0x7521('0x36')]=function(_0x1b2b40,_0x32e06c){return db[_0x7521('0x4f')][_0x7521('0x57')]({'where':{'id':_0x1b2b40[_0x7521('0x5f')]['id']}})['then'](handleEntityNotFound(_0x32e06c,null))[_0x7521('0x1f')](removeEntity(_0x32e06c,null))[_0x7521('0x53')](handleError(_0x32e06c,null));};exports[_0x7521('0x60')]=function(_0x26093a,_0x58a547){return db[_0x7521('0x4f')][_0x7521('0x60')]()[_0x7521('0x1f')](respondWithResult(_0x58a547,null))[_0x7521('0x53')](handleError(_0x58a547,null));};exports['getMembers']=function(_0x13267a,_0x428ddf,_0x51b4a7){var _0x3bcdc0={'raw':!![],'where':{}},_0x114a3b={},_0x343d9d;return db[_0x7521('0x4f')]['findOne']({'where':{'id':_0x13267a['params']['id']}})['then'](handleEntityNotFound(_0x428ddf,null))['then'](function(_0x413fce){if(_0x413fce){_0x343d9d=_0x413fce['get']({'plain':!![]});_0x114a3b[_0x7521('0x40')]=_[_0x7521('0x42')](db[_0x7521('0x61')][_0x7521('0x3e')]);_0x114a3b[_0x7521('0x41')]=_[_0x7521('0x42')](_0x13267a[_0x7521('0x41')]);_0x114a3b[_0x7521('0x43')]=_[_0x7521('0x44')](_0x114a3b[_0x7521('0x40')],_0x114a3b[_0x7521('0x41')]);_0x3bcdc0[_0x7521('0x45')]=_[_0x7521('0x44')](_0x114a3b[_0x7521('0x40')],qs[_0x7521('0x46')](_0x13267a[_0x7521('0x41')][_0x7521('0x46')]));_0x3bcdc0['attributes']=_0x3bcdc0['attributes']['length']?_0x3bcdc0[_0x7521('0x45')]:_0x114a3b[_0x7521('0x40')];if(!_0x13267a['query']['hasOwnProperty']('nolimit')){_0x3bcdc0['limit']=qs['limit'](_0x13267a[_0x7521('0x41')]['limit']);_0x3bcdc0[_0x7521('0x2c')]=qs[_0x7521('0x2c')](_0x13267a[_0x7521('0x41')]['offset']);}_0x3bcdc0['order']=qs[_0x7521('0x49')](_0x13267a[_0x7521('0x41')]['sort']);_0x3bcdc0[_0x7521('0x4a')]=qs[_0x7521('0x43')](_[_0x7521('0x4b')](_0x13267a[_0x7521('0x41')],_0x114a3b['filters']));_0x3bcdc0['where'][_0x7521('0x62')]=_0x413fce['id'];if(_0x13267a['query'][_0x7521('0x4d')]){_0x3bcdc0[_0x7521('0x4a')]=_['merge'](_0x3bcdc0['where'],{'$or':_[_0x7521('0x3d')](_0x3bcdc0['attributes'],function(_0x2a6396){var _0x59d874={};_0x59d874[_0x2a6396]={'$like':'%'+_0x13267a['query']['filter']+'%'};return _0x59d874;})});}_0x3bcdc0=_[_0x7521('0x56')]({},_0x3bcdc0,_0x13267a[_0x7521('0x4e')]);return db[_0x7521('0x61')][_0x7521('0x63')](_0x3bcdc0);}})[_0x7521('0x1f')](function(_0x427b24){if(_0x427b24){return db['User'][_0x7521('0x64')]({'where':{'id':_[_0x7521('0x3d')](_0x427b24,_0x7521('0x65')),'role':_0x7521('0x66')},'attributes':['id',_0x7521('0x3b'),_0x7521('0x67'),_0x7521('0x68'),_0x7521('0x69')]});}})[_0x7521('0x1f')](function(_0x57419b){if(_0x57419b){return{'count':_0x57419b[_0x7521('0x2d')],'rows':_[_0x7521('0x3d')](_0x57419b[_0x7521('0x52')],function(_0x1fb99d){return{'membername':_0x1fb99d[_0x7521('0x3b')],'UserId':_0x1fb99d['id'],'queue_name':_0x343d9d[_0x7521('0x3b')],'ChatQueueId':_0x343d9d['id'],'interface':util[_0x7521('0x6a')]('%s/%s',_0x7521('0x6b'),_0x1fb99d[_0x7521('0x3b')]),'penalty':0x0,'paused':_0x1fb99d['chatPause'],'createdAt':_0x1fb99d[_0x7521('0x69')],'updatedAt':_0x1fb99d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x428ddf,_0x3bcdc0))[_0x7521('0x53')](handleError(_0x428ddf,null));};exports[_0x7521('0x6c')]=function(_0x3be1cc,_0x373d12,_0x870ebd){var _0x336afc={};var _0x22c45d={};var _0x414332;var _0x1f8d89;return db[_0x7521('0x4f')][_0x7521('0x6d')]({'where':{'id':_0x3be1cc[_0x7521('0x5f')]['id']}})['then'](handleEntityNotFound(_0x373d12,null))[_0x7521('0x1f')](function(_0xc7b498){if(_0xc7b498){_0x414332=_0xc7b498;_0x22c45d[_0x7521('0x40')]=_['keys'](db[_0x7521('0x6e')][_0x7521('0x3e')]);_0x22c45d[_0x7521('0x41')]=_[_0x7521('0x42')](_0x3be1cc['query']);_0x22c45d[_0x7521('0x43')]=_[_0x7521('0x44')](_0x22c45d[_0x7521('0x40')],_0x22c45d['query']);_0x336afc['attributes']=_['intersection'](_0x22c45d['model'],qs['fields'](_0x3be1cc[_0x7521('0x41')][_0x7521('0x46')]));_0x336afc[_0x7521('0x45')]=_0x336afc[_0x7521('0x45')]['length']?_0x336afc[_0x7521('0x45')]:_0x22c45d[_0x7521('0x40')];_0x336afc[_0x7521('0x48')]=qs['sort'](_0x3be1cc[_0x7521('0x41')][_0x7521('0x49')]);_0x336afc['where']=qs[_0x7521('0x43')](_['pick'](_0x3be1cc[_0x7521('0x41')],_0x22c45d[_0x7521('0x43')]));if(_0x3be1cc[_0x7521('0x41')][_0x7521('0x4d')]){_0x336afc[_0x7521('0x4a')]=_[_0x7521('0x56')](_0x336afc[_0x7521('0x4a')],{'$or':_[_0x7521('0x3d')](_0x336afc[_0x7521('0x45')],function(_0x5320da){var _0x181f49={};_0x181f49[_0x5320da]={'$like':'%'+_0x3be1cc[_0x7521('0x41')][_0x7521('0x4d')]+'%'};return _0x181f49;})});}_0x336afc=_['merge']({},_0x336afc,_0x3be1cc[_0x7521('0x4e')]);return _0x414332[_0x7521('0x6c')](_0x336afc);}})[_0x7521('0x1f')](function(_0x3b8887){if(_0x3b8887){_0x1f8d89=_0x3b8887[_0x7521('0x55')];if(!_0x3be1cc[_0x7521('0x41')]['hasOwnProperty']('nolimit')){_0x336afc['limit']=qs[_0x7521('0x2e')](_0x3be1cc[_0x7521('0x41')][_0x7521('0x2e')]);_0x336afc['offset']=qs[_0x7521('0x2c')](_0x3be1cc[_0x7521('0x41')][_0x7521('0x2c')]);}return _0x414332[_0x7521('0x6c')](_0x336afc);}})[_0x7521('0x1f')](function(_0x5e0c92){if(_0x5e0c92){return _0x5e0c92?{'count':_0x1f8d89,'rows':_0x5e0c92}:null;}})[_0x7521('0x1f')](respondWithResult(_0x373d12,null))[_0x7521('0x53')](handleError(_0x373d12,null));};exports[_0x7521('0x6f')]=function(_0x3f4b21,_0x1f2b6a,_0x4924bc){var _0xb7a4e2=_0x3f4b21[_0x7521('0x5e')][_0x7521('0x70')];return db['Team'][_0x7521('0x63')]({'where':{'id':_0xb7a4e2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7521('0x71'),'attributes':['id',_0x7521('0x3b'),_0x7521('0x72'),_0x7521('0x73'),'interface'],'raw':!![]}]})[_0x7521('0x1f')](function(_0x27a38f){if(_0x27a38f){var _0x3001ea=_[_0x7521('0x74')](_0x27a38f,function(_0x297e14){var _0xfb3ca=_0x297e14[_0x7521('0x37')]({'plain':!![]});return _0xfb3ca[_0x7521('0x71')];});return db[_0x7521('0x4f')][_0x7521('0x57')]({'where':{'id':_0x3f4b21[_0x7521('0x5f')]['id']}})[_0x7521('0x1f')](function(_0xe06ae8){return db['sequelize'][_0x7521('0x75')](function(_0x12a5e0){return _0xe06ae8[_0x7521('0x6f')](_0xb7a4e2,{'transaction':_0x12a5e0})[_0x7521('0x1f')](function(){return BPromise['each'](_0x3001ea,function(_0x2629db){return db[_0x7521('0x61')][_0x7521('0x76')]({'where':{'UserId':_0x2629db['id'],'ChatQueueId':_0x3f4b21[_0x7521('0x5f')]['id']},'transaction':_0x12a5e0});});})[_0x7521('0x1f')](function(){_0x3001ea[_0x7521('0x77')](function(_0x5a083a){socket[_0x7521('0x78')](_0x7521('0x79'),{'UserId':_0x5a083a['id'],'ChatQueueId':_0xe06ae8['id']});});});});});}})[_0x7521('0x1f')](respondWithStatusCode(_0x1f2b6a,null))[_0x7521('0x53')](handleError(_0x1f2b6a,null));};exports['removeTeams']=function(_0x4fedb9,_0x452589,_0x16470d){return db['Team'][_0x7521('0x63')]({'where':{'id':_0x4fedb9[_0x7521('0x41')][_0x7521('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7521('0x7a')],'as':_0x7521('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x452589,null))[_0x7521('0x1f')](function(_0x18e475){var _0x5414db=_['map'](_0x18e475,'id');var _0x30624d=[];var _0x17f853=[];var _0x41f02e=squel['select']();_0x41f02e[_0x7521('0x7b')](_0x7521('0x7c'))['from'](_0x7521('0x7d'),'tq')[_0x7521('0x7e')](_0x7521('0x7f'),'ut',_0x7521('0x80'))[_0x7521('0x4a')](_0x7521('0x81'),_0x4fedb9[_0x7521('0x5f')]['id']);for(var _0x57b9d6=0x0;_0x57b9d6<_0x18e475[_0x7521('0x55')];_0x57b9d6+=0x1){let _0x4b978e=_0x18e475[_0x57b9d6];for(var _0x3840fc=0x0;_0x3840fc<_0x4b978e[_0x7521('0x71')][_0x7521('0x55')];_0x3840fc+=0x1){let _0x3d7a5f=_0x4b978e[_0x7521('0x71')][_0x3840fc];var _0x121e94=_0x41f02e[_0x7521('0x82')]();_0x121e94[_0x7521('0x4a')](_0x7521('0x83'),_0x3d7a5f['id']);_0x17f853[_0x7521('0x84')](db['sequelize'][_0x7521('0x41')](_0x121e94[_0x7521('0x85')](),{'type':db[_0x7521('0x86')][_0x7521('0x87')][_0x7521('0x88')]})['then'](function(_0x357ae9){if(_0x357ae9[_0x7521('0x55')]===0x1){return _0x3d7a5f['id'];}else{var _0x12d3b8=_[_0x7521('0x89')](_[_0x7521('0x3d')](_0x357ae9,_0x7521('0x8a')),function(_0x10d619){return _[_0x7521('0x8b')](_0x5414db,_0x10d619);});if(_0x12d3b8){return _0x3d7a5f['id'];}}}));}}return BPromise['all'](_0x17f853)[_0x7521('0x1f')](function(_0x24b701){_0x30624d=_(_0x30624d)['union'](_0x24b701)['compact']()[_0x7521('0x8c')]();return db['ChatQueue'][_0x7521('0x57')]({'where':{'id':_0x4fedb9[_0x7521('0x5f')]['id']}})['then'](function(_0x56f866){return db[_0x7521('0x86')][_0x7521('0x75')](function(_0x301038){return _0x56f866[_0x7521('0x8d')](_0x4fedb9[_0x7521('0x41')]['ids'],{'transaction':_0x301038})[_0x7521('0x1f')](function(){if(!_[_0x7521('0x8e')](_0x30624d)){return _0x56f866['removeAgents'](_0x30624d,{'transaction':_0x301038});}})[_0x7521('0x1f')](function(){_0x30624d[_0x7521('0x77')](function(_0x18cd1c){socket[_0x7521('0x78')](_0x7521('0x8f'),{'UserId':_0x18cd1c,'ChatQueueId':_0x56f866['id']});});});});});});})[_0x7521('0x1f')](respondWithStatusCode(_0x452589,null))[_0x7521('0x53')](handleError(_0x452589,null));};exports[_0x7521('0x90')]=function(_0x4022ab,_0x3408e0,_0x296dff){return db[_0x7521('0x4f')][_0x7521('0x57')]({'where':{'id':_0x4022ab['params']['id']}})[_0x7521('0x1f')](handleEntityNotFound(_0x3408e0,null))[_0x7521('0x1f')](function(_0x237472){if(_0x237472){return _0x237472[_0x7521('0x90')](_0x4022ab[_0x7521('0x5e')][_0x7521('0x70')],_[_0x7521('0x91')](_0x4022ab[_0x7521('0x5e')],[_0x7521('0x70'),'id'])||{})['spread'](function(_0x250825){for(var _0x46aa59=0x0;_0x46aa59<_0x4022ab[_0x7521('0x5e')][_0x7521('0x70')][_0x7521('0x55')];_0x46aa59+=0x1){socket['emit'](_0x7521('0x79'),{'UserId':Number(_0x4022ab[_0x7521('0x5e')][_0x7521('0x70')][_0x46aa59]),'ChatQueueId':Number(_0x4022ab[_0x7521('0x5f')]['id'])});}return _0x250825;});}})['then'](respondWithResult(_0x3408e0,null))[_0x7521('0x53')](handleError(_0x3408e0,null));};exports['removeAgents']=function(_0x394c12,_0x43329f,_0x21a4a1){return db[_0x7521('0x4f')][_0x7521('0x57')]({'where':{'id':_0x394c12[_0x7521('0x5f')]['id']}})[_0x7521('0x1f')](handleEntityNotFound(_0x43329f,null))['then'](function(_0x282a7a){if(_0x282a7a){return _0x282a7a[_0x7521('0x92')](_0x394c12[_0x7521('0x41')]['ids'])['then'](function(){if(_['isArray'](_0x394c12['query'][_0x7521('0x70')])){for(var _0x182cd4=0x0;_0x182cd4<_0x394c12[_0x7521('0x41')][_0x7521('0x70')][_0x7521('0x55')];_0x182cd4+=0x1){socket[_0x7521('0x78')](_0x7521('0x8f'),{'UserId':Number(_0x394c12[_0x7521('0x41')][_0x7521('0x70')][_0x182cd4]),'ChatQueueId':Number(_0x394c12[_0x7521('0x5f')]['id'])});}}else{socket[_0x7521('0x78')](_0x7521('0x8f'),{'UserId':Number(_0x394c12['query'][_0x7521('0x70')]),'ChatQueueId':Number(_0x394c12[_0x7521('0x5f')]['id'])});}});}})[_0x7521('0x1f')](respondWithStatusCode(_0x43329f,null))[_0x7521('0x53')](handleError(_0x43329f,null));};exports[_0x7521('0x93')]=function(_0x193695,_0x2c0b6b,_0x371b01){var _0x2b7ef7={};var _0x36ab1d={};var _0x385999;var _0x6cbe40;return db[_0x7521('0x4f')][_0x7521('0x6d')]({'where':{'id':_0x193695['params']['id']}})['then'](handleEntityNotFound(_0x2c0b6b,null))[_0x7521('0x1f')](function(_0x3982c4){if(_0x3982c4){_0x385999=_0x3982c4;_0x36ab1d[_0x7521('0x40')]=_[_0x7521('0x42')](db[_0x7521('0x7a')][_0x7521('0x3e')]);_0x36ab1d[_0x7521('0x41')]=_[_0x7521('0x42')](_0x193695[_0x7521('0x41')]);_0x36ab1d[_0x7521('0x43')]=_[_0x7521('0x44')](_0x36ab1d[_0x7521('0x40')],_0x36ab1d['query']);_0x2b7ef7[_0x7521('0x45')]=_[_0x7521('0x44')](_0x36ab1d[_0x7521('0x40')],qs[_0x7521('0x46')](_0x193695[_0x7521('0x41')][_0x7521('0x46')]));_0x2b7ef7[_0x7521('0x45')]=_0x2b7ef7[_0x7521('0x45')][_0x7521('0x55')]?_0x2b7ef7[_0x7521('0x45')]:_0x36ab1d[_0x7521('0x40')];_0x2b7ef7[_0x7521('0x48')]=qs['sort'](_0x193695[_0x7521('0x41')][_0x7521('0x49')]);_0x2b7ef7[_0x7521('0x4a')]=qs[_0x7521('0x43')](_[_0x7521('0x4b')](_0x193695[_0x7521('0x41')],_0x36ab1d[_0x7521('0x43')]));if(_0x193695['query'][_0x7521('0x4d')]){_0x2b7ef7[_0x7521('0x4a')]=_[_0x7521('0x56')](_0x2b7ef7[_0x7521('0x4a')],{'$or':_[_0x7521('0x3d')](_0x2b7ef7[_0x7521('0x45')],function(_0x403e92){var _0x110777={};_0x110777[_0x403e92]={'$like':'%'+_0x193695['query'][_0x7521('0x4d')]+'%'};return _0x110777;})});}_0x2b7ef7=_[_0x7521('0x56')]({},_0x2b7ef7,_0x193695[_0x7521('0x4e')]);return _0x385999[_0x7521('0x93')](_0x2b7ef7);}})[_0x7521('0x1f')](function(_0x29ca0f){if(_0x29ca0f){_0x6cbe40=_0x29ca0f['length'];if(!_0x193695[_0x7521('0x41')]['hasOwnProperty'](_0x7521('0x94'))){_0x2b7ef7[_0x7521('0x2e')]=qs[_0x7521('0x2e')](_0x193695[_0x7521('0x41')][_0x7521('0x2e')]);_0x2b7ef7['offset']=qs[_0x7521('0x2c')](_0x193695[_0x7521('0x41')][_0x7521('0x2c')]);}return _0x385999[_0x7521('0x93')](_0x2b7ef7);}})[_0x7521('0x1f')](function(_0x2e8b40){if(_0x2e8b40){return _0x2e8b40?{'count':_0x6cbe40,'rows':_0x2e8b40}:null;}})[_0x7521('0x1f')](respondWithResult(_0x2c0b6b,null))[_0x7521('0x53')](handleError(_0x2c0b6b,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e1884a0..bddfb21 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 _0xfb9d=['events','ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xfb9d,0x120));var _0xdfb9=function(_0x4944a7,_0x3d6fca){_0x4944a7=_0x4944a7-0x0;var _0x2878a3=_0xfb9d[_0x4944a7];return _0x2878a3;};'use strict';var EventEmitter=require(_0xdfb9('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xdfb9('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xdfb9('0x2')](0x0);var events={'afterCreate':_0xdfb9('0x3'),'afterUpdate':'update','afterDestroy':_0xdfb9('0x4')};function emitEvent(_0x123fa0){return function(_0xf306c7,_0x3ba62d,_0x39c690){ChatQueueEvents[_0xdfb9('0x5')](_0x123fa0+':'+_0xf306c7['id'],_0xf306c7);ChatQueueEvents['emit'](_0x123fa0,_0xf306c7);_0x39c690(null);};}for(var e in events){if(events[_0xdfb9('0x6')](e)){var event=events[e];ChatQueue[_0xdfb9('0x7')](e,emitEvent(event));}}module[_0xdfb9('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x7e68=['ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xf1e6e1,_0x58d076){var _0x43102f=function(_0x5c6ce8){while(--_0x5c6ce8){_0xf1e6e1['push'](_0xf1e6e1['shift']());}};_0x43102f(++_0x58d076);}(_0x7e68,0xd8));var _0x87e6=function(_0xbeb80a,_0x5791e2){_0xbeb80a=_0xbeb80a-0x0;var _0x522a3d=_0x7e68[_0xbeb80a];return _0x522a3d;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x87e6('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x87e6('0x1')](0x0);var events={'afterCreate':_0x87e6('0x2'),'afterUpdate':_0x87e6('0x3'),'afterDestroy':_0x87e6('0x4')};function emitEvent(_0x3691bf){return function(_0x31d611,_0xd7ecde,_0x3638e3){ChatQueueEvents[_0x87e6('0x5')](_0x3691bf+':'+_0x31d611['id'],_0x31d611);ChatQueueEvents['emit'](_0x3691bf,_0x31d611);_0x3638e3(null);};}for(var e in events){if(events[_0x87e6('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x87e6('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index af37bfc..402d4e5 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 _0x6b21=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0x403282,_0x39ab19){var _0x41f290=function(_0x34f4c0){while(--_0x34f4c0){_0x403282['push'](_0x403282['shift']());}};_0x41f290(++_0x39ab19);}(_0x6b21,0x84));var _0x16b2=function(_0x3bf2d3,_0x5c5f34){_0x3bf2d3=_0x3bf2d3-0x0;var _0x4f6be4=_0x6b21[_0x3bf2d3];return _0x4f6be4;};'use strict';var _=require(_0x16b2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x16b2('0x1'));var moment=require(_0x16b2('0x2'));var BPromise=require(_0x16b2('0x3'));var rp=require(_0x16b2('0x4'));var fs=require('fs');var path=require(_0x16b2('0x5'));var rimraf=require(_0x16b2('0x6'));var config=require(_0x16b2('0x7'));var attributes=require(_0x16b2('0x8'));module[_0x16b2('0x9')]=function(_0x48ae95,_0x20634e){return _0x48ae95[_0x16b2('0xa')](_0x16b2('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedbb=['api','moment','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','../../config/logger'];(function(_0x3d4a88,_0x62234f){var _0x24bfc1=function(_0x4a2ae8){while(--_0x4a2ae8){_0x3d4a88['push'](_0x3d4a88['shift']());}};_0x24bfc1(++_0x62234f);}(_0xedbb,0x149));var _0xbedb=function(_0x12896d,_0x4e2b28){_0x12896d=_0x12896d-0x0;var _0x58b846=_0xedbb[_0x12896d];return _0x58b846;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbedb('0x0'))(_0xbedb('0x1'));var moment=require(_0xbedb('0x2'));var BPromise=require('bluebird');var rp=require(_0xbedb('0x3'));var fs=require('fs');var path=require(_0xbedb('0x4'));var rimraf=require('rimraf');var config=require(_0xbedb('0x5'));var attributes=require(_0xbedb('0x6'));module[_0xbedb('0x7')]=function(_0x14b391,_0x40926e){return _0x14b391[_0xbedb('0x8')](_0xbedb('0x9'),attributes,{'tableName':_0xbedb('0xa'),'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 52e8bb7..aebb0f2 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 _0xb16f=['attributes','include','map','model','catch','GetChatQueue','ShowChatQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ChatQueue','options','raw','where'];(function(_0x428890,_0x5e452d){var _0x1de408=function(_0x311ee2){while(--_0x311ee2){_0x428890['push'](_0x428890['shift']());}};_0x1de408(++_0x5e452d);}(_0xb16f,0x1c4));var _0xfb16=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0xb16f[_0x34933a];return _0x36abb4;};'use strict';var _=require('lodash');var util=require(_0xfb16('0x0'));var moment=require(_0xfb16('0x1'));var BPromise=require(_0xfb16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb16('0x3'));var db=require(_0xfb16('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb16('0x5'))('rpc');var config=require(_0xfb16('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfb16('0x7')][_0xfb16('0x8')]({'port':0x232a});config[_0xfb16('0x9')]=_[_0xfb16('0xa')](config['redis'],{'host':_0xfb16('0xb'),'port':0x18eb});var socket=require(_0xfb16('0xc'))(new Redis(config[_0xfb16('0x9')]));require('./chatQueue.socket')[_0xfb16('0xd')](socket);function respondWithRpcPromise(_0x1fdf1c,_0x1b61e2,_0x1a564b){return new BPromise(function(_0x23bb4d,_0x1bb347){return client[_0xfb16('0xe')](_0x1fdf1c,_0x1a564b)[_0xfb16('0xf')](function(_0x84bb36){logger[_0xfb16('0x10')](_0xfb16('0x11'),_0x1b61e2,_0xfb16('0x12'));logger[_0xfb16('0x13')](_0xfb16('0x14'),_0x1b61e2,_0xfb16('0x12'),JSON[_0xfb16('0x15')](_0x84bb36));if(_0x84bb36['error']){if(_0x84bb36[_0xfb16('0x16')]['code']===0x1f4){logger[_0xfb16('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1b61e2,_0x84bb36[_0xfb16('0x16')][_0xfb16('0x17')]);return _0x1bb347(_0x84bb36[_0xfb16('0x16')][_0xfb16('0x17')]);}logger[_0xfb16('0x16')](_0xfb16('0x11'),_0x1b61e2,_0x84bb36[_0xfb16('0x16')]['message']);return _0x23bb4d(_0x84bb36[_0xfb16('0x16')]['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x1b61e2,_0xfb16('0x12'));_0x23bb4d(_0x84bb36[_0xfb16('0x18')][_0xfb16('0x17')]);}})['catch'](function(_0x132c6f){logger[_0xfb16('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1b61e2,_0x132c6f);_0x1bb347(_0x132c6f);});});}exports['GetChatQueue']=function(_0x1fab1e){var _0x5efe9e=this;return new Promise(function(_0xf956ab,_0x4e566a){return db[_0xfb16('0x19')]['findAll']({'raw':_0x1fab1e[_0xfb16('0x1a')]?_0x1fab1e[_0xfb16('0x1a')][_0xfb16('0x1b')]===undefined?!![]:![]:!![],'where':_0x1fab1e['options']?_0x1fab1e[_0xfb16('0x1a')][_0xfb16('0x1c')]||null:null,'attributes':_0x1fab1e[_0xfb16('0x1a')]?_0x1fab1e[_0xfb16('0x1a')][_0xfb16('0x1d')]||null:null,'limit':_0x1fab1e[_0xfb16('0x1a')]?_0x1fab1e[_0xfb16('0x1a')]['limit']||null:null,'include':_0x1fab1e[_0xfb16('0x1a')]?_0x1fab1e[_0xfb16('0x1a')][_0xfb16('0x1e')]?_[_0xfb16('0x1f')](_0x1fab1e[_0xfb16('0x1a')][_0xfb16('0x1e')],function(_0x513fd7){return{'model':db[_0x513fd7['model']],'as':_0x513fd7['as'],'attributes':_0x513fd7[_0xfb16('0x1d')],'include':_0x513fd7[_0xfb16('0x1e')]?_[_0xfb16('0x1f')](_0x513fd7[_0xfb16('0x1e')],function(_0xa216c7){return{'model':db[_0xa216c7['model']],'as':_0xa216c7['as'],'attributes':_0xa216c7[_0xfb16('0x1d')],'include':_0xa216c7[_0xfb16('0x1e')]?_[_0xfb16('0x1f')](_0xa216c7[_0xfb16('0x1e')],function(_0x1fbeb5){return{'model':db[_0x1fbeb5[_0xfb16('0x20')]],'as':_0x1fbeb5['as'],'attributes':_0x1fbeb5[_0xfb16('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfb16('0xf')](function(_0x1cd14a){logger['info']('GetChatQueue',_0x1fab1e);logger[_0xfb16('0x13')]('GetChatQueue',_0x1fab1e,JSON[_0xfb16('0x15')](_0x1cd14a));_0xf956ab(_0x1cd14a);})[_0xfb16('0x21')](function(_0x3db7fe){logger['error'](_0xfb16('0x22'),_0x3db7fe[_0xfb16('0x17')],_0x1fab1e);_0x4e566a(_0x5efe9e[_0xfb16('0x16')](0x1f4,_0x3db7fe[_0xfb16('0x17')]));});});};exports[_0xfb16('0x23')]=function(_0x932497){var _0x2848e8=this;return new Promise(function(_0x2e532b,_0x55fd0c){return db[_0xfb16('0x19')][_0xfb16('0x24')]({'raw':_0x932497[_0xfb16('0x1a')]?_0x932497[_0xfb16('0x1a')][_0xfb16('0x1b')]===undefined?!![]:![]:!![],'where':_0x932497[_0xfb16('0x1a')]?_0x932497[_0xfb16('0x1a')][_0xfb16('0x1c')]||null:null,'attributes':_0x932497[_0xfb16('0x1a')]?_0x932497[_0xfb16('0x1a')][_0xfb16('0x1d')]||null:null,'include':_0x932497[_0xfb16('0x1a')]?_0x932497[_0xfb16('0x1a')][_0xfb16('0x1e')]?_[_0xfb16('0x1f')](_0x932497['options'][_0xfb16('0x1e')],function(_0x395dcc){return{'model':db[_0x395dcc['model']],'as':_0x395dcc['as'],'attributes':_0x395dcc[_0xfb16('0x1d')],'include':_0x395dcc[_0xfb16('0x1e')]?_['map'](_0x395dcc[_0xfb16('0x1e')],function(_0x6b4141){return{'model':db[_0x6b4141[_0xfb16('0x20')]],'as':_0x6b4141['as'],'attributes':_0x6b4141[_0xfb16('0x1d')],'include':_0x6b4141[_0xfb16('0x1e')]?_[_0xfb16('0x1f')](_0x6b4141['include'],function(_0x2b0975){return{'model':db[_0x2b0975[_0xfb16('0x20')]],'as':_0x2b0975['as'],'attributes':_0x2b0975[_0xfb16('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e35f){logger[_0xfb16('0x10')](_0xfb16('0x23'),_0x932497);logger[_0xfb16('0x13')](_0xfb16('0x23'),_0x932497,JSON['stringify'](_0x57e35f));_0x2e532b(_0x57e35f);})[_0xfb16('0x21')](function(_0xbb805b){logger['error'](_0xfb16('0x23'),_0xbb805b[_0xfb16('0x17')],_0x932497);_0x55fd0c(_0x2848e8[_0xfb16('0x16')](0x1f4,_0xbb805b[_0xfb16('0x17')]));});});}; \ No newline at end of file +var _0x14c7=['attributes','GetChatQueue','find','raw','ShowChatQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ChatQueue','findAll','options','where','limit','map','include','model'];(function(_0x33e0db,_0x2b8d53){var _0x3f7a38=function(_0x23f437){while(--_0x23f437){_0x33e0db['push'](_0x33e0db['shift']());}};_0x3f7a38(++_0x2b8d53);}(_0x14c7,0x1d9));var _0x714c=function(_0x2d9893,_0xe29c7d){_0x2d9893=_0x2d9893-0x0;var _0x2bcfaa=_0x14c7[_0x2d9893];return _0x2bcfaa;};'use strict';var _=require(_0x714c('0x0'));var util=require(_0x714c('0x1'));var moment=require(_0x714c('0x2'));var BPromise=require('bluebird');var rs=require(_0x714c('0x3'));var fs=require('fs');var Redis=require(_0x714c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x714c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x714c('0x6'));var client=jayson[_0x714c('0x7')][_0x714c('0x8')]({'port':0x232a});config[_0x714c('0x9')]=_['defaults'](config[_0x714c('0x9')],{'host':_0x714c('0xa'),'port':0x18eb});var socket=require(_0x714c('0xb'))(new Redis(config[_0x714c('0x9')]));require(_0x714c('0xc'))['register'](socket);function respondWithRpcPromise(_0x1dc208,_0x4c420f,_0x210519){return new BPromise(function(_0x43ca0e,_0x3c3f7e){return client[_0x714c('0xd')](_0x1dc208,_0x210519)[_0x714c('0xe')](function(_0x185ee7){logger['info'](_0x714c('0xf'),_0x4c420f,'request\x20sent');logger[_0x714c('0x10')](_0x714c('0x11'),_0x4c420f,_0x714c('0x12'),JSON[_0x714c('0x13')](_0x185ee7));if(_0x185ee7['error']){if(_0x185ee7[_0x714c('0x14')][_0x714c('0x15')]===0x1f4){logger[_0x714c('0x14')](_0x714c('0xf'),_0x4c420f,_0x185ee7[_0x714c('0x14')][_0x714c('0x16')]);return _0x3c3f7e(_0x185ee7[_0x714c('0x14')]['message']);}logger[_0x714c('0x14')](_0x714c('0xf'),_0x4c420f,_0x185ee7[_0x714c('0x14')][_0x714c('0x16')]);return _0x43ca0e(_0x185ee7[_0x714c('0x14')][_0x714c('0x16')]);}else{logger[_0x714c('0x17')](_0x714c('0xf'),_0x4c420f,_0x714c('0x12'));_0x43ca0e(_0x185ee7[_0x714c('0x18')][_0x714c('0x16')]);}})[_0x714c('0x19')](function(_0x5cd454){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4c420f,_0x5cd454);_0x3c3f7e(_0x5cd454);});});}exports['GetChatQueue']=function(_0x204c4e){var _0x294e98=this;return new Promise(function(_0x32a97d,_0x171240){return db[_0x714c('0x1a')][_0x714c('0x1b')]({'raw':_0x204c4e[_0x714c('0x1c')]?_0x204c4e['options']['raw']===undefined?!![]:![]:!![],'where':_0x204c4e[_0x714c('0x1c')]?_0x204c4e[_0x714c('0x1c')][_0x714c('0x1d')]||null:null,'attributes':_0x204c4e[_0x714c('0x1c')]?_0x204c4e['options']['attributes']||null:null,'limit':_0x204c4e[_0x714c('0x1c')]?_0x204c4e[_0x714c('0x1c')][_0x714c('0x1e')]||null:null,'include':_0x204c4e[_0x714c('0x1c')]?_0x204c4e[_0x714c('0x1c')]['include']?_[_0x714c('0x1f')](_0x204c4e[_0x714c('0x1c')][_0x714c('0x20')],function(_0x37d3ad){return{'model':db[_0x37d3ad[_0x714c('0x21')]],'as':_0x37d3ad['as'],'attributes':_0x37d3ad[_0x714c('0x22')],'include':_0x37d3ad['include']?_[_0x714c('0x1f')](_0x37d3ad['include'],function(_0x132f4a){return{'model':db[_0x132f4a[_0x714c('0x21')]],'as':_0x132f4a['as'],'attributes':_0x132f4a[_0x714c('0x22')],'include':_0x132f4a[_0x714c('0x20')]?_[_0x714c('0x1f')](_0x132f4a[_0x714c('0x20')],function(_0x965577){return{'model':db[_0x965577[_0x714c('0x21')]],'as':_0x965577['as'],'attributes':_0x965577[_0x714c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x714c('0xe')](function(_0x2ef5e6){logger[_0x714c('0x17')](_0x714c('0x23'),_0x204c4e);logger[_0x714c('0x10')](_0x714c('0x23'),_0x204c4e,JSON['stringify'](_0x2ef5e6));_0x32a97d(_0x2ef5e6);})[_0x714c('0x19')](function(_0x43c086){logger['error'](_0x714c('0x23'),_0x43c086['message'],_0x204c4e);_0x171240(_0x294e98[_0x714c('0x14')](0x1f4,_0x43c086[_0x714c('0x16')]));});});};exports['ShowChatQueue']=function(_0x5619db){var _0x542084=this;return new Promise(function(_0xc5454b,_0x2e8fae){return db['ChatQueue'][_0x714c('0x24')]({'raw':_0x5619db[_0x714c('0x1c')]?_0x5619db[_0x714c('0x1c')][_0x714c('0x25')]===undefined?!![]:![]:!![],'where':_0x5619db[_0x714c('0x1c')]?_0x5619db[_0x714c('0x1c')][_0x714c('0x1d')]||null:null,'attributes':_0x5619db[_0x714c('0x1c')]?_0x5619db[_0x714c('0x1c')]['attributes']||null:null,'include':_0x5619db[_0x714c('0x1c')]?_0x5619db[_0x714c('0x1c')][_0x714c('0x20')]?_[_0x714c('0x1f')](_0x5619db['options'][_0x714c('0x20')],function(_0x290fc6){return{'model':db[_0x290fc6[_0x714c('0x21')]],'as':_0x290fc6['as'],'attributes':_0x290fc6[_0x714c('0x22')],'include':_0x290fc6[_0x714c('0x20')]?_[_0x714c('0x1f')](_0x290fc6['include'],function(_0x205991){return{'model':db[_0x205991[_0x714c('0x21')]],'as':_0x205991['as'],'attributes':_0x205991['attributes'],'include':_0x205991['include']?_[_0x714c('0x1f')](_0x205991[_0x714c('0x20')],function(_0x4e673e){return{'model':db[_0x4e673e[_0x714c('0x21')]],'as':_0x4e673e['as'],'attributes':_0x4e673e[_0x714c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d15b7){logger[_0x714c('0x17')](_0x714c('0x26'),_0x5619db);logger[_0x714c('0x10')](_0x714c('0x26'),_0x5619db,JSON[_0x714c('0x13')](_0x3d15b7));_0xc5454b(_0x3d15b7);})[_0x714c('0x19')](function(_0x260f62){logger[_0x714c('0x14')](_0x714c('0x26'),_0x260f62['message'],_0x5619db);_0x2e8fae(_0x542084[_0x714c('0x14')](0x1f4,_0x260f62['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 34de2f8..24c50ac 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 _0xd6d6=['chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2a2167,_0x5470b3){var _0x405afe=function(_0x552a77){while(--_0x552a77){_0x2a2167['push'](_0x2a2167['shift']());}};_0x405afe(++_0x5470b3);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x286363,_0x261f1b){_0x286363=_0x286363-0x0;var _0x5db3ac=_0xd6d6[_0x286363];return _0x5db3ac;};'use strict';var ChatQueueEvents=require(_0x6d6d('0x0'));var events=[_0x6d6d('0x1'),_0x6d6d('0x2'),_0x6d6d('0x3')];function createListener(_0x536523,_0x2e1aed){return function(_0x3b743d){_0x2e1aed[_0x6d6d('0x4')](_0x536523,_0x3b743d);};}function removeListener(_0x2a838a,_0x5207c9){return function(){ChatQueueEvents[_0x6d6d('0x5')](_0x2a838a,_0x5207c9);};}exports[_0x6d6d('0x6')]=function(_0x5702dc){for(var _0x210ff7=0x0,_0x1bf731=events[_0x6d6d('0x7')];_0x210ff7<_0x1bf731;_0x210ff7++){var _0x18f824=events[_0x210ff7];var _0xd49f57=createListener(_0x6d6d('0x8')+_0x18f824,_0x5702dc);ChatQueueEvents['on'](_0x18f824,_0xd49f57);}}; \ No newline at end of file +var _0xf109=['remove','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf109,0xce));var _0x9f10=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf109[_0x46698a];return _0x356db0;};'use strict';var ChatQueueEvents=require(_0x9f10('0x0'));var events=[_0x9f10('0x1'),_0x9f10('0x2'),'update'];function createListener(_0x5b381d,_0x4cbc7a){return function(_0x3659ce){_0x4cbc7a[_0x9f10('0x3')](_0x5b381d,_0x3659ce);};}function removeListener(_0x74d0ee,_0x26f01c){return function(){ChatQueueEvents[_0x9f10('0x4')](_0x74d0ee,_0x26f01c);};}exports[_0x9f10('0x5')]=function(_0x408fe8){for(var _0xd3137b=0x0,_0x227a29=events[_0x9f10('0x6')];_0xd3137b<_0x227a29;_0xd3137b++){var _0x3fd82f=events[_0xd3137b];var _0x5c8719=createListener(_0x9f10('0x7')+_0x3fd82f,_0x408fe8);ChatQueueEvents['on'](_0x3fd82f,_0x5c8719);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0386f2a..570cab6 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x14eed8,_0x4b11c9){var _0x31956d=function(_0x27e244){while(--_0x27e244){_0x14eed8['push'](_0x14eed8['shift']());}};_0x31956d(++_0x4b11c9);}(_0x814b,0x1a2));var _0xb814=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x814b[_0x4cbf20];return _0x582ae4;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x315d75,_0x2ef646){var _0x30f11e=function(_0x69a0f){while(--_0x69a0f){_0x315d75['push'](_0x315d75['shift']());}};_0x30f11e(++_0x2ef646);}(_0xe14b,0x93));var _0xbe14=function(_0x4be773,_0x3963ca){_0x4be773=_0x4be773-0x0;var _0xde2a81=_0xe14b[_0x4be773];return _0xde2a81;};'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['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index a983f91..18b5970 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 _0x09da=['sequelize','exports','STRING','DATE'];(function(_0x53350e,_0xedc458){var _0x244c47=function(_0x3f0837){while(--_0x3f0837){_0x53350e['push'](_0x53350e['shift']());}};_0x244c47(++_0xedc458);}(_0x09da,0xf4));var _0xa09d=function(_0x388bfa,_0x1f518c){_0x388bfa=_0x388bfa-0x0;var _0x11d6a6=_0x09da[_0x388bfa];return _0x11d6a6;};'use strict';var moment=require('moment');var Sequelize=require(_0xa09d('0x0'));module[_0xa09d('0x1')]={'uniqueid':{'type':Sequelize[_0xa09d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa09d('0x2')]},'joinAt':{'type':Sequelize[_0xa09d('0x3')]},'leaveAt':{'type':Sequelize[_0xa09d('0x3')]},'acceptAt':{'type':Sequelize[_0xa09d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa09d('0x2')]}}; \ No newline at end of file +var _0x70ff=['STRING','DATE','moment','sequelize','exports'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x70ff,0x1ce));var _0xf70f=function(_0x3c2c62,_0x2033c2){_0x3c2c62=_0x3c2c62-0x0;var _0x58bcb8=_0x70ff[_0x3c2c62];return _0x58bcb8;};'use strict';var moment=require(_0xf70f('0x0'));var Sequelize=require(_0xf70f('0x1'));module[_0xf70f('0x2')]={'uniqueid':{'type':Sequelize[_0xf70f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf70f('0x3')]},'joinAt':{'type':Sequelize[_0xf70f('0x4')]},'leaveAt':{'type':Sequelize[_0xf70f('0x4')]},'acceptAt':{'type':Sequelize[_0xf70f('0x4')]},'exitAt':{'type':Sequelize[_0xf70f('0x4')]},'reason':{'type':Sequelize[_0xf70f('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index cbaae96..8be2d1f 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 _0x631c=['length','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','send','index','ChatQueueReport','rawAttributes','type','key','map','name','query','keys','filters','intersection','model','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','catch','show'];(function(_0x5c4d30,_0x2bc47a){var _0x120851=function(_0x458736){while(--_0x458736){_0x5c4d30['push'](_0x5c4d30['shift']());}};_0x120851(++_0x2bc47a);}(_0x631c,0x1b6));var _0xc631=function(_0x1ed203,_0x11b9d9){_0x1ed203=_0x1ed203-0x0;var _0x251884=_0x631c[_0x1ed203];return _0x251884;};'use strict';var emlformat=require(_0xc631('0x0'));var rimraf=require(_0xc631('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc631('0x2'));var rp=require(_0xc631('0x3'));var moment=require('moment');var BPromise=require(_0xc631('0x4'));var Mustache=require(_0xc631('0x5'));var util=require(_0xc631('0x6'));var path=require('path');var sox=require(_0xc631('0x7'));var csv=require(_0xc631('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc631('0x9'));var _=require('lodash');var squel=require(_0xc631('0xa'));var crypto=require(_0xc631('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc631('0xc'));var Papa=require('papaparse');var Redis=require(_0xc631('0xd'));var authService=require(_0xc631('0xe'));var qs=require(_0xc631('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc631('0x10'));var logger=require(_0xc631('0x11'))(_0xc631('0x12'));var utils=require(_0xc631('0x13'));var config=require(_0xc631('0x14'));var licenseUtil=require(_0xc631('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a5efd,_0x277360){_0x277360=_0x277360||0xcc;return function(_0x2e9ac8){if(_0x2e9ac8){return _0x3a5efd[_0xc631('0x16')](_0x277360);}return _0x3a5efd[_0xc631('0x17')](_0x277360)['end']();};}function respondWithResult(_0x241e39,_0x1aba68){_0x1aba68=_0x1aba68||0xc8;return function(_0x59363c){if(_0x59363c){return _0x241e39[_0xc631('0x17')](_0x1aba68)[_0xc631('0x18')](_0x59363c);}};}function respondWithFilteredResult(_0x3cc2a5,_0xac3441){return function(_0x418a7c){if(_0x418a7c){var _0x734989=typeof _0xac3441[_0xc631('0x19')]===_0xc631('0x1a')&&typeof _0xac3441[_0xc631('0x1b')]==='undefined';var _0x9acf07=_0x418a7c['count'];var _0x1943ce=_0x734989?0x0:_0xac3441['offset'];var _0x2bf21a=_0x734989?_0x418a7c['count']:_0xac3441[_0xc631('0x19')]+_0xac3441[_0xc631('0x1b')];var _0x2d09b8;if(_0x2bf21a>=_0x9acf07){_0x2bf21a=_0x9acf07;_0x2d09b8=0xc8;}else{_0x2d09b8=0xce;}_0x3cc2a5[_0xc631('0x17')](_0x2d09b8);return _0x3cc2a5[_0xc631('0x1c')](_0xc631('0x1d'),_0x1943ce+'-'+_0x2bf21a+'/'+_0x9acf07)[_0xc631('0x18')](_0x418a7c);}return null;};}function patchUpdates(_0x487bf9){return function(_0x433225){try{jsonpatch[_0xc631('0x1e')](_0x433225,_0x487bf9,!![]);}catch(_0x47efa9){return BPromise[_0xc631('0x1f')](_0x47efa9);}return _0x433225['save']();};}function saveUpdates(_0x229859,_0x1982ee){return function(_0x106961){if(_0x106961){return _0x106961[_0xc631('0x20')](_0x229859)[_0xc631('0x21')](function(_0x31f871){return _0x31f871;});}return null;};}function removeEntity(_0x41a5bc,_0x2486f3){return function(_0x5a5dbe){if(_0x5a5dbe){return _0x5a5dbe[_0xc631('0x22')]()[_0xc631('0x21')](function(){_0x41a5bc['status'](0xcc)[_0xc631('0x23')]();});}};}function handleEntityNotFound(_0x5e7404,_0x40534a){return function(_0x599dea){if(!_0x599dea){_0x5e7404[_0xc631('0x16')](0x194);}return _0x599dea;};}function handleError(_0x2e6d21,_0x51292b){_0x51292b=_0x51292b||0x1f4;return function(_0x43c2f8){logger[_0xc631('0x24')](_0x43c2f8[_0xc631('0x25')]);if(_0x43c2f8['name']){delete _0x43c2f8['name'];}_0x2e6d21[_0xc631('0x17')](_0x51292b)[_0xc631('0x26')](_0x43c2f8);};}exports[_0xc631('0x27')]=function(_0x4fd97a,_0x186092){var _0x62938e={},_0x16467a={},_0x34cd5a={'count':0x0,'rows':[]};var _0x1b8a1c=_['map'](db[_0xc631('0x28')][_0xc631('0x29')],function(_0x35d49c){return{'name':_0x35d49c['fieldName'],'type':_0x35d49c[_0xc631('0x2a')][_0xc631('0x2b')]};});_0x16467a['model']=_[_0xc631('0x2c')](_0x1b8a1c,_0xc631('0x2d'));_0x16467a[_0xc631('0x2e')]=_[_0xc631('0x2f')](_0x4fd97a[_0xc631('0x2e')]);_0x16467a[_0xc631('0x30')]=_[_0xc631('0x31')](_0x16467a[_0xc631('0x32')],_0x16467a[_0xc631('0x2e')]);_0x62938e[_0xc631('0x33')]=_[_0xc631('0x31')](_0x16467a['model'],qs['fields'](_0x4fd97a['query']['fields']));_0x62938e[_0xc631('0x33')]=_0x62938e[_0xc631('0x33')]['length']?_0x62938e['attributes']:_0x16467a[_0xc631('0x32')];if(!_0x4fd97a[_0xc631('0x2e')][_0xc631('0x34')]('nolimit')){_0x62938e[_0xc631('0x1b')]=qs[_0xc631('0x1b')](_0x4fd97a['query'][_0xc631('0x1b')]);_0x62938e[_0xc631('0x19')]=qs[_0xc631('0x19')](_0x4fd97a[_0xc631('0x2e')]['offset']);}_0x62938e[_0xc631('0x35')]=qs[_0xc631('0x36')](_0x4fd97a[_0xc631('0x2e')][_0xc631('0x36')]);_0x62938e['where']=qs[_0xc631('0x30')](_[_0xc631('0x37')](_0x4fd97a[_0xc631('0x2e')],_0x16467a[_0xc631('0x30')]),_0x1b8a1c);if(_0x4fd97a['query'][_0xc631('0x38')]){_0x62938e[_0xc631('0x39')]=_['merge'](_0x62938e[_0xc631('0x39')],{'$or':_[_0xc631('0x2c')](_0x1b8a1c,function(_0x3a3fab){if(_0x3a3fab[_0xc631('0x2a')]!==_0xc631('0x3a')){var _0x384c9c={};_0x384c9c[_0x3a3fab[_0xc631('0x2d')]]={'$like':'%'+_0x4fd97a[_0xc631('0x2e')]['filter']+'%'};return _0x384c9c;}})});}_0x62938e=_[_0xc631('0x3b')]({},_0x62938e,_0x4fd97a[_0xc631('0x3c')]);var _0x172484={'where':_0x62938e[_0xc631('0x39')]};return db[_0xc631('0x28')][_0xc631('0x3d')](_0x172484)[_0xc631('0x21')](function(_0x3723c1){_0x34cd5a[_0xc631('0x3d')]=_0x3723c1;if(_0x4fd97a[_0xc631('0x2e')][_0xc631('0x3e')]){_0x62938e[_0xc631('0x3f')]=[{'all':!![]}];}return db[_0xc631('0x28')]['findAll'](_0x62938e);})['then'](function(_0x58ce03){_0x34cd5a['rows']=_0x58ce03;return _0x34cd5a;})[_0xc631('0x21')](respondWithFilteredResult(_0x186092,_0x62938e))[_0xc631('0x40')](handleError(_0x186092,null));};exports[_0xc631('0x41')]=function(_0x2e81da,_0x1368ff){var _0x12a587={'raw':!![],'where':{'id':_0x2e81da['params']['id']}},_0x5df634={};_0x5df634[_0xc631('0x32')]=_[_0xc631('0x2f')](db[_0xc631('0x28')][_0xc631('0x29')]);_0x5df634[_0xc631('0x2e')]=_[_0xc631('0x2f')](_0x2e81da['query']);_0x5df634['filters']=_['intersection'](_0x5df634[_0xc631('0x32')],_0x5df634[_0xc631('0x2e')]);_0x12a587['attributes']=_[_0xc631('0x31')](_0x5df634[_0xc631('0x32')],qs['fields'](_0x2e81da[_0xc631('0x2e')]['fields']));_0x12a587[_0xc631('0x33')]=_0x12a587[_0xc631('0x33')][_0xc631('0x42')]?_0x12a587[_0xc631('0x33')]:_0x5df634[_0xc631('0x32')];if(_0x2e81da[_0xc631('0x2e')][_0xc631('0x3e')]){_0x12a587[_0xc631('0x3f')]=[{'all':!![]}];}_0x12a587=_[_0xc631('0x3b')]({},_0x12a587,_0x2e81da[_0xc631('0x3c')]);return db[_0xc631('0x28')][_0xc631('0x43')](_0x12a587)[_0xc631('0x21')](handleEntityNotFound(_0x1368ff,null))['then'](respondWithResult(_0x1368ff,null))[_0xc631('0x40')](handleError(_0x1368ff,null));};exports[_0xc631('0x44')]=function(_0x2ce29a,_0x2adc41){return db[_0xc631('0x28')][_0xc631('0x44')](_0x2ce29a['body'],{})['then'](respondWithResult(_0x2adc41,0xc9))[_0xc631('0x40')](handleError(_0x2adc41,null));};exports[_0xc631('0x20')]=function(_0x566d18,_0x596d65){if(_0x566d18[_0xc631('0x45')]['id']){delete _0x566d18[_0xc631('0x45')]['id'];}return db['ChatQueueReport'][_0xc631('0x43')]({'where':{'id':_0x566d18[_0xc631('0x46')]['id']}})['then'](handleEntityNotFound(_0x596d65,null))[_0xc631('0x21')](saveUpdates(_0x566d18['body'],null))[_0xc631('0x21')](respondWithResult(_0x596d65,null))[_0xc631('0x40')](handleError(_0x596d65,null));};exports[_0xc631('0x22')]=function(_0x1a0112,_0x3b9776){return db[_0xc631('0x28')][_0xc631('0x43')]({'where':{'id':_0x1a0112[_0xc631('0x46')]['id']}})[_0xc631('0x21')](handleEntityNotFound(_0x3b9776,null))[_0xc631('0x21')](removeEntity(_0x3b9776,null))[_0xc631('0x40')](handleError(_0x3b9776,null));};exports[_0xc631('0x47')]=function(_0x344023,_0x4f9c0a){return db[_0xc631('0x28')]['describe']()[_0xc631('0x21')](respondWithResult(_0x4f9c0a,null))[_0xc631('0x40')](handleError(_0x4f9c0a,null));}; \ No newline at end of file +var _0x1921=['rows','catch','show','length','options','create','body','find','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','update','then','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatQueueReport','includeAll','include','findAll'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x1921,0xf2));var _0x1192=function(_0x33c729,_0x75ce23){_0x33c729=_0x33c729-0x0;var _0x1a868a=_0x1921[_0x33c729];return _0x1a868a;};'use strict';var emlformat=require(_0x1192('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1192('0x1'));var jsonpatch=require(_0x1192('0x2'));var rp=require(_0x1192('0x3'));var moment=require(_0x1192('0x4'));var BPromise=require(_0x1192('0x5'));var Mustache=require(_0x1192('0x6'));var util=require(_0x1192('0x7'));var path=require(_0x1192('0x8'));var sox=require(_0x1192('0x9'));var csv=require(_0x1192('0xa'));var ejs=require(_0x1192('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1192('0xc'));var crypto=require(_0x1192('0xd'));var jsforce=require(_0x1192('0xe'));var deskjs=require(_0x1192('0xf'));var toCsv=require(_0x1192('0xa'));var querystring=require(_0x1192('0x10'));var Papa=require(_0x1192('0x11'));var Redis=require(_0x1192('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1192('0x13'));var hardwareService=require(_0x1192('0x14'));var logger=require(_0x1192('0x15'))(_0x1192('0x16'));var utils=require(_0x1192('0x17'));var config=require(_0x1192('0x18'));var licenseUtil=require(_0x1192('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b997,_0x594596){_0x594596=_0x594596||0xcc;return function(_0x3b7ba7){if(_0x3b7ba7){return _0x33b997[_0x1192('0x1a')](_0x594596);}return _0x33b997['status'](_0x594596)[_0x1192('0x1b')]();};}function respondWithResult(_0x1e5fcc,_0x406b97){_0x406b97=_0x406b97||0xc8;return function(_0x4c17d3){if(_0x4c17d3){return _0x1e5fcc[_0x1192('0x1c')](_0x406b97)[_0x1192('0x1d')](_0x4c17d3);}};}function respondWithFilteredResult(_0x55755b,_0x2021f2){return function(_0x3397d1){if(_0x3397d1){var _0x2a162b=typeof _0x2021f2['offset']===_0x1192('0x1e')&&typeof _0x2021f2['limit']===_0x1192('0x1e');var _0x4757bb=_0x3397d1[_0x1192('0x1f')];var _0x13a5ca=_0x2a162b?0x0:_0x2021f2[_0x1192('0x20')];var _0x24c2e1=_0x2a162b?_0x3397d1['count']:_0x2021f2['offset']+_0x2021f2[_0x1192('0x21')];var _0x1b46e2;if(_0x24c2e1>=_0x4757bb){_0x24c2e1=_0x4757bb;_0x1b46e2=0xc8;}else{_0x1b46e2=0xce;}_0x55755b[_0x1192('0x1c')](_0x1b46e2);return _0x55755b[_0x1192('0x22')]('Content-Range',_0x13a5ca+'-'+_0x24c2e1+'/'+_0x4757bb)[_0x1192('0x1d')](_0x3397d1);}return null;};}function patchUpdates(_0x2da521){return function(_0x141c9b){try{jsonpatch['apply'](_0x141c9b,_0x2da521,!![]);}catch(_0x1cfcd6){return BPromise[_0x1192('0x23')](_0x1cfcd6);}return _0x141c9b['save']();};}function saveUpdates(_0x40bee5,_0x22f4c8){return function(_0x402e64){if(_0x402e64){return _0x402e64[_0x1192('0x24')](_0x40bee5)['then'](function(_0x4ad6b4){return _0x4ad6b4;});}return null;};}function removeEntity(_0x406c87,_0x5a7774){return function(_0x3cc973){if(_0x3cc973){return _0x3cc973['destroy']()[_0x1192('0x25')](function(){_0x406c87['status'](0xcc)[_0x1192('0x1b')]();});}};}function handleEntityNotFound(_0x18e4cc,_0x572d29){return function(_0x40bdb5){if(!_0x40bdb5){_0x18e4cc[_0x1192('0x1a')](0x194);}return _0x40bdb5;};}function handleError(_0x1e198c,_0x148c22){_0x148c22=_0x148c22||0x1f4;return function(_0x288ac6){logger[_0x1192('0x26')](_0x288ac6['stack']);if(_0x288ac6[_0x1192('0x27')]){delete _0x288ac6[_0x1192('0x27')];}_0x1e198c[_0x1192('0x1c')](_0x148c22)[_0x1192('0x28')](_0x288ac6);};}exports[_0x1192('0x29')]=function(_0x3a0736,_0x469fcd){var _0x2c7c9b={},_0x3d2c78={},_0x3c2d80={'count':0x0,'rows':[]};var _0x51e8bd=_[_0x1192('0x2a')](db['ChatQueueReport']['rawAttributes'],function(_0x7218dc){return{'name':_0x7218dc[_0x1192('0x2b')],'type':_0x7218dc[_0x1192('0x2c')][_0x1192('0x2d')]};});_0x3d2c78[_0x1192('0x2e')]=_[_0x1192('0x2a')](_0x51e8bd,_0x1192('0x27'));_0x3d2c78[_0x1192('0x2f')]=_[_0x1192('0x30')](_0x3a0736[_0x1192('0x2f')]);_0x3d2c78[_0x1192('0x31')]=_[_0x1192('0x32')](_0x3d2c78[_0x1192('0x2e')],_0x3d2c78[_0x1192('0x2f')]);_0x2c7c9b[_0x1192('0x33')]=_[_0x1192('0x32')](_0x3d2c78[_0x1192('0x2e')],qs[_0x1192('0x34')](_0x3a0736[_0x1192('0x2f')][_0x1192('0x34')]));_0x2c7c9b[_0x1192('0x33')]=_0x2c7c9b['attributes']['length']?_0x2c7c9b['attributes']:_0x3d2c78[_0x1192('0x2e')];if(!_0x3a0736[_0x1192('0x2f')][_0x1192('0x35')](_0x1192('0x36'))){_0x2c7c9b['limit']=qs[_0x1192('0x21')](_0x3a0736[_0x1192('0x2f')][_0x1192('0x21')]);_0x2c7c9b[_0x1192('0x20')]=qs[_0x1192('0x20')](_0x3a0736[_0x1192('0x2f')][_0x1192('0x20')]);}_0x2c7c9b[_0x1192('0x37')]=qs['sort'](_0x3a0736['query'][_0x1192('0x38')]);_0x2c7c9b[_0x1192('0x39')]=qs[_0x1192('0x31')](_[_0x1192('0x3a')](_0x3a0736[_0x1192('0x2f')],_0x3d2c78[_0x1192('0x31')]),_0x51e8bd);if(_0x3a0736['query'][_0x1192('0x3b')]){_0x2c7c9b[_0x1192('0x39')]=_[_0x1192('0x3c')](_0x2c7c9b[_0x1192('0x39')],{'$or':_[_0x1192('0x2a')](_0x51e8bd,function(_0x40ca5a){if(_0x40ca5a['type']!==_0x1192('0x3d')){var _0x3229f7={};_0x3229f7[_0x40ca5a['name']]={'$like':'%'+_0x3a0736[_0x1192('0x2f')][_0x1192('0x3b')]+'%'};return _0x3229f7;}})});}_0x2c7c9b=_[_0x1192('0x3c')]({},_0x2c7c9b,_0x3a0736['options']);var _0x57f4d2={'where':_0x2c7c9b['where']};return db[_0x1192('0x3e')][_0x1192('0x1f')](_0x57f4d2)['then'](function(_0x2974a1){_0x3c2d80[_0x1192('0x1f')]=_0x2974a1;if(_0x3a0736[_0x1192('0x2f')][_0x1192('0x3f')]){_0x2c7c9b[_0x1192('0x40')]=[{'all':!![]}];}return db[_0x1192('0x3e')][_0x1192('0x41')](_0x2c7c9b);})[_0x1192('0x25')](function(_0x1c4198){_0x3c2d80[_0x1192('0x42')]=_0x1c4198;return _0x3c2d80;})[_0x1192('0x25')](respondWithFilteredResult(_0x469fcd,_0x2c7c9b))[_0x1192('0x43')](handleError(_0x469fcd,null));};exports[_0x1192('0x44')]=function(_0xbae0b2,_0x17cc55){var _0x290a87={'raw':!![],'where':{'id':_0xbae0b2['params']['id']}},_0x553896={};_0x553896[_0x1192('0x2e')]=_[_0x1192('0x30')](db[_0x1192('0x3e')]['rawAttributes']);_0x553896[_0x1192('0x2f')]=_[_0x1192('0x30')](_0xbae0b2[_0x1192('0x2f')]);_0x553896['filters']=_[_0x1192('0x32')](_0x553896[_0x1192('0x2e')],_0x553896['query']);_0x290a87[_0x1192('0x33')]=_[_0x1192('0x32')](_0x553896[_0x1192('0x2e')],qs['fields'](_0xbae0b2[_0x1192('0x2f')][_0x1192('0x34')]));_0x290a87[_0x1192('0x33')]=_0x290a87[_0x1192('0x33')][_0x1192('0x45')]?_0x290a87['attributes']:_0x553896['model'];if(_0xbae0b2[_0x1192('0x2f')]['includeAll']){_0x290a87[_0x1192('0x40')]=[{'all':!![]}];}_0x290a87=_[_0x1192('0x3c')]({},_0x290a87,_0xbae0b2[_0x1192('0x46')]);return db[_0x1192('0x3e')]['find'](_0x290a87)[_0x1192('0x25')](handleEntityNotFound(_0x17cc55,null))[_0x1192('0x25')](respondWithResult(_0x17cc55,null))[_0x1192('0x43')](handleError(_0x17cc55,null));};exports[_0x1192('0x47')]=function(_0x2ecd11,_0x144149){return db[_0x1192('0x3e')]['create'](_0x2ecd11[_0x1192('0x48')],{})[_0x1192('0x25')](respondWithResult(_0x144149,0xc9))['catch'](handleError(_0x144149,null));};exports[_0x1192('0x24')]=function(_0x2ad1cf,_0x2822f8){if(_0x2ad1cf[_0x1192('0x48')]['id']){delete _0x2ad1cf[_0x1192('0x48')]['id'];}return db[_0x1192('0x3e')][_0x1192('0x49')]({'where':{'id':_0x2ad1cf['params']['id']}})[_0x1192('0x25')](handleEntityNotFound(_0x2822f8,null))[_0x1192('0x25')](saveUpdates(_0x2ad1cf[_0x1192('0x48')],null))['then'](respondWithResult(_0x2822f8,null))[_0x1192('0x43')](handleError(_0x2822f8,null));};exports[_0x1192('0x4a')]=function(_0xcdda33,_0x5b735c){return db['ChatQueueReport']['find']({'where':{'id':_0xcdda33[_0x1192('0x4b')]['id']}})[_0x1192('0x25')](handleEntityNotFound(_0x5b735c,null))[_0x1192('0x25')](removeEntity(_0x5b735c,null))['catch'](handleError(_0x5b735c,null));};exports['describe']=function(_0x5e2c2e,_0x239b6c){return db['ChatQueueReport'][_0x1192('0x4c')]()[_0x1192('0x25')](respondWithResult(_0x239b6c,null))[_0x1192('0x43')](handleError(_0x239b6c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index e093105..455798b 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0xf9d5e9,_0x427534){var _0x3c6991=function(_0x3bd5fe){while(--_0x3bd5fe){_0xf9d5e9['push'](_0xf9d5e9['shift']());}};_0x3c6991(++_0x427534);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xe706,0xa3));var _0x6e70=function(_0x546f9f,_0xcce640){_0x546f9f=_0x546f9f-0x0;var _0x3513dd=_0xe706[_0x546f9f];return _0x3513dd;};'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/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b4bfb13..9f08392 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 _0x0446=['stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x2ee838,_0x1d06a2){var _0x1ca49c=function(_0x1fe126){while(--_0x1fe126){_0x2ee838['push'](_0x2ee838['shift']());}};_0x1ca49c(++_0x1d06a2);}(_0x0446,0x11d));var _0x6044=function(_0x30340c,_0x4d68d9){_0x30340c=_0x30340c-0x0;var _0x4cdaca=_0x0446[_0x30340c];return _0x4cdaca;};'use strict';var _=require(_0x6044('0x0'));var util=require('util');var moment=require(_0x6044('0x1'));var BPromise=require(_0x6044('0x2'));var rs=require(_0x6044('0x3'));var fs=require('fs');var Redis=require(_0x6044('0x4'));var db=require(_0x6044('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6044('0x6'))('rpc');var config=require(_0x6044('0x7'));var jayson=require(_0x6044('0x8'));var client=jayson[_0x6044('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x259d6e,_0x57244b,_0x2b649a){return new BPromise(function(_0x591925,_0x5ad050){return client['request'](_0x259d6e,_0x2b649a)[_0x6044('0xa')](function(_0x578287){logger[_0x6044('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x57244b,_0x6044('0xc'));logger[_0x6044('0xd')](_0x6044('0xe'),_0x57244b,_0x6044('0xc'),JSON[_0x6044('0xf')](_0x578287));if(_0x578287[_0x6044('0x10')]){if(_0x578287[_0x6044('0x10')][_0x6044('0x11')]===0x1f4){logger[_0x6044('0x10')](_0x6044('0x12'),_0x57244b,_0x578287[_0x6044('0x10')]['message']);return _0x5ad050(_0x578287['error'][_0x6044('0x13')]);}logger[_0x6044('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x57244b,_0x578287['error'][_0x6044('0x13')]);return _0x591925(_0x578287['error'][_0x6044('0x13')]);}else{logger[_0x6044('0xb')](_0x6044('0x12'),_0x57244b,'request\x20sent');_0x591925(_0x578287[_0x6044('0x14')][_0x6044('0x13')]);}})['catch'](function(_0x50c2cf){logger['error'](_0x6044('0x12'),_0x57244b,_0x50c2cf);_0x5ad050(_0x50c2cf);});});}exports[_0x6044('0x15')]=function(_0x5448a7){var _0x5a4082=this;return new Promise(function(_0x2a3f98,_0x7d3d4c){return db[_0x6044('0x16')][_0x6044('0x17')](_0x5448a7[_0x6044('0x18')],{'raw':_0x5448a7[_0x6044('0x19')]?_0x5448a7[_0x6044('0x19')][_0x6044('0x1a')]===undefined?!![]:![]:!![]})[_0x6044('0xa')](function(_0xf2d29f){logger['info']('CreateChatQueueReport',_0x5448a7);logger[_0x6044('0xd')]('CreateChatQueueReport',_0x5448a7,JSON[_0x6044('0xf')](_0xf2d29f));_0x2a3f98(_0xf2d29f);})['catch'](function(_0xab96d4){logger[_0x6044('0x10')](_0x6044('0x15'),_0xab96d4[_0x6044('0x13')],_0x5448a7);_0x7d3d4c(_0x5a4082[_0x6044('0x10')](0x1f4,_0xab96d4[_0x6044('0x13')]));});});};exports[_0x6044('0x1b')]=function(_0x101a5e){var _0x34d149=this;return new Promise(function(_0x42241e,_0x2669d8){return db[_0x6044('0x16')][_0x6044('0x1c')](_0x101a5e['body'],{'raw':_0x101a5e[_0x6044('0x19')]?_0x101a5e['options'][_0x6044('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101a5e['options']?_0x101a5e[_0x6044('0x19')]['where']||null:null,'attributes':_0x101a5e[_0x6044('0x19')]?_0x101a5e['options'][_0x6044('0x1d')]||null:null,'limit':_0x101a5e[_0x6044('0x19')]?_0x101a5e[_0x6044('0x19')]['limit']||null:null})[_0x6044('0xa')](function(_0x132757){logger[_0x6044('0xb')](_0x6044('0x1b'),_0x101a5e);logger['debug'](_0x6044('0x1b'),_0x101a5e,JSON[_0x6044('0xf')](_0x132757));_0x42241e(_0x132757);})['catch'](function(_0xf009bf){logger['error'](_0x6044('0x1b'),_0xf009bf['message'],_0x101a5e);_0x2669d8(_0x34d149[_0x6044('0x10')](0x1f4,_0xf009bf['message']));});});}; \ No newline at end of file +var _0xf929=['stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf929,0x164));var _0x9f92=function(_0x17be90,_0x200dfd){_0x17be90=_0x17be90-0x0;var _0x5a6276=_0xf929[_0x17be90];return _0x5a6276;};'use strict';var _=require(_0x9f92('0x0'));var util=require('util');var moment=require(_0x9f92('0x1'));var BPromise=require(_0x9f92('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f92('0x3'));var db=require(_0x9f92('0x4'))['db'];var utils=require(_0x9f92('0x5'));var logger=require(_0x9f92('0x6'))(_0x9f92('0x7'));var config=require(_0x9f92('0x8'));var jayson=require(_0x9f92('0x9'));var client=jayson[_0x9f92('0xa')][_0x9f92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29a770,_0x77aa18,_0x5f343f){return new BPromise(function(_0x98a2f5,_0x2d4115){return client[_0x9f92('0xc')](_0x29a770,_0x5f343f)[_0x9f92('0xd')](function(_0x35adc2){logger[_0x9f92('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x77aa18,_0x9f92('0xf'));logger[_0x9f92('0x10')](_0x9f92('0x11'),_0x77aa18,_0x9f92('0xf'),JSON[_0x9f92('0x12')](_0x35adc2));if(_0x35adc2[_0x9f92('0x13')]){if(_0x35adc2[_0x9f92('0x13')][_0x9f92('0x14')]===0x1f4){logger[_0x9f92('0x13')](_0x9f92('0x15'),_0x77aa18,_0x35adc2[_0x9f92('0x13')]['message']);return _0x2d4115(_0x35adc2[_0x9f92('0x13')][_0x9f92('0x16')]);}logger[_0x9f92('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x77aa18,_0x35adc2[_0x9f92('0x13')]['message']);return _0x98a2f5(_0x35adc2[_0x9f92('0x13')][_0x9f92('0x16')]);}else{logger[_0x9f92('0xe')](_0x9f92('0x15'),_0x77aa18,_0x9f92('0xf'));_0x98a2f5(_0x35adc2['result']['message']);}})[_0x9f92('0x17')](function(_0x27dcf4){logger[_0x9f92('0x13')](_0x9f92('0x15'),_0x77aa18,_0x27dcf4);_0x2d4115(_0x27dcf4);});});}exports['CreateChatQueueReport']=function(_0x1045c1){var _0x1ead43=this;return new Promise(function(_0x31acf3,_0x1d058a){return db[_0x9f92('0x18')][_0x9f92('0x19')](_0x1045c1[_0x9f92('0x1a')],{'raw':_0x1045c1[_0x9f92('0x1b')]?_0x1045c1[_0x9f92('0x1b')][_0x9f92('0x1c')]===undefined?!![]:![]:!![]})[_0x9f92('0xd')](function(_0x340e0a){logger[_0x9f92('0xe')](_0x9f92('0x1d'),_0x1045c1);logger['debug'](_0x9f92('0x1d'),_0x1045c1,JSON[_0x9f92('0x12')](_0x340e0a));_0x31acf3(_0x340e0a);})[_0x9f92('0x17')](function(_0x5b6f2f){logger[_0x9f92('0x13')](_0x9f92('0x1d'),_0x5b6f2f[_0x9f92('0x16')],_0x1045c1);_0x1d058a(_0x1ead43[_0x9f92('0x13')](0x1f4,_0x5b6f2f[_0x9f92('0x16')]));});});};exports[_0x9f92('0x1e')]=function(_0xf2b1db){var _0x2c2812=this;return new Promise(function(_0x5ca0f2,_0x214dfd){return db['ChatQueueReport']['update'](_0xf2b1db[_0x9f92('0x1a')],{'raw':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x1f')]||null:null,'attributes':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x20')]||null:null,'limit':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x21')]||null:null})['then'](function(_0x2dc012){logger['info'](_0x9f92('0x1e'),_0xf2b1db);logger[_0x9f92('0x10')]('UpdateChatQueueReport',_0xf2b1db,JSON[_0x9f92('0x12')](_0x2dc012));_0x5ca0f2(_0x2dc012);})[_0x9f92('0x17')](function(_0x56b814){logger[_0x9f92('0x13')](_0x9f92('0x1e'),_0x56b814['message'],_0xf2b1db);_0x214dfd(_0x2c2812['error'](0x1f4,_0x56b814['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 33ed313..1a60a75 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 _0xd093=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x29ab06,_0x201766){var _0x32de07=function(_0x28174a){while(--_0x28174a){_0x29ab06['push'](_0x29ab06['shift']());}};_0x32de07(++_0x201766);}(_0xd093,0xda));var _0x3d09=function(_0x417e2a,_0x1065f6){_0x417e2a=_0x417e2a-0x0;var _0x5ebd52=_0xd093[_0x417e2a];return _0x5ebd52;};'use strict';var multer=require(_0x3d09('0x0'));var util=require(_0x3d09('0x1'));var path=require(_0x3d09('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d09('0x3'));var router=express['Router']();var fs_extra=require(_0x3d09('0x4'));var auth=require(_0x3d09('0x5'));var interaction=require(_0x3d09('0x6'));var config=require(_0x3d09('0x7'));var controller=require(_0x3d09('0x8'));router[_0x3d09('0x9')]('/',auth[_0x3d09('0xa')](),controller['index']);router[_0x3d09('0x9')](_0x3d09('0xb'),auth[_0x3d09('0xa')](),controller[_0x3d09('0xc')]);router[_0x3d09('0x9')](_0x3d09('0xd'),auth[_0x3d09('0xa')](),controller[_0x3d09('0xe')]);router[_0x3d09('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3d09('0x10')]('/:id',auth[_0x3d09('0xa')](),controller[_0x3d09('0x11')]);router[_0x3d09('0x12')](_0x3d09('0xd'),auth[_0x3d09('0xa')](),controller[_0x3d09('0x13')]);module[_0x3d09('0x14')]=router; \ No newline at end of file +var _0xd853=['describe','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','./chatQueueReport.controller','get','isAuthenticated','/describe'];(function(_0xb03acb,_0x2e9075){var _0x2e3fff=function(_0x14a82e){while(--_0x14a82e){_0xb03acb['push'](_0xb03acb['shift']());}};_0x2e3fff(++_0x2e9075);}(_0xd853,0x14c));var _0x3d85=function(_0x27332e,_0x247ad6){_0x27332e=_0x27332e-0x0;var _0x5882fc=_0xd853[_0x27332e];return _0x5882fc;};'use strict';var multer=require('multer');var util=require(_0x3d85('0x0'));var path=require('path');var timeout=require(_0x3d85('0x1'));var express=require('express');var router=express[_0x3d85('0x2')]();var fs_extra=require(_0x3d85('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d85('0x4'));router[_0x3d85('0x5')]('/',auth[_0x3d85('0x6')](),controller['index']);router[_0x3d85('0x5')](_0x3d85('0x7'),auth[_0x3d85('0x6')](),controller[_0x3d85('0x8')]);router[_0x3d85('0x5')](_0x3d85('0x9'),auth[_0x3d85('0x6')](),controller[_0x3d85('0xa')]);router[_0x3d85('0xb')]('/',auth[_0x3d85('0x6')](),controller[_0x3d85('0xc')]);router[_0x3d85('0xd')](_0x3d85('0x9'),auth[_0x3d85('0x6')](),controller[_0x3d85('0xe')]);router['delete'](_0x3d85('0x9'),auth[_0x3d85('0x6')](),controller[_0x3d85('0xf')]);module[_0x3d85('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 77c6d64..7fcba68 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(_0x131b68,_0xf6b0d){var _0x231e17=function(_0x347c0f){while(--_0x347c0f){_0x131b68['push'](_0x131b68['shift']());}};_0x231e17(++_0xf6b0d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4f568d,_0x2eb8f4){_0x4f568d=_0x4f568d-0x0;var _0x2a4698=_0xf4eb[_0x4f568d];return _0x2a4698;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x418909,_0x37114c){_0x418909=_0x418909-0x0;var _0x477448=_0x9bde[_0x418909];return _0x477448;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index cc346b5..34050fc 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 _0x118a=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','update','then','destroy','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','body','catch','describe'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x118a,0x128));var _0xa118=function(_0x2c1f11,_0xeff74d){_0x2c1f11=_0x2c1f11-0x0;var _0x49a14e=_0x118a[_0x2c1f11];return _0x49a14e;};'use strict';var emlformat=require(_0xa118('0x0'));var rimraf=require(_0xa118('0x1'));var zipdir=require(_0xa118('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa118('0x3'));var moment=require(_0xa118('0x4'));var BPromise=require(_0xa118('0x5'));var Mustache=require(_0xa118('0x6'));var util=require(_0xa118('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa118('0x8'));var ejs=require(_0xa118('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa118('0xa'));var squel=require('squel');var crypto=require(_0xa118('0xb'));var jsforce=require(_0xa118('0xc'));var deskjs=require(_0xa118('0xd'));var toCsv=require(_0xa118('0x8'));var querystring=require('querystring');var Papa=require(_0xa118('0xe'));var Redis=require(_0xa118('0xf'));var authService=require(_0xa118('0x10'));var qs=require(_0xa118('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa118('0x12'));var logger=require(_0xa118('0x13'))(_0xa118('0x14'));var utils=require(_0xa118('0x15'));var config=require(_0xa118('0x16'));var licenseUtil=require(_0xa118('0x17'));var db=require(_0xa118('0x18'))['db'];function respondWithStatusCode(_0x170de0,_0x34bf6e){_0x34bf6e=_0x34bf6e||0xcc;return function(_0x4f196d){if(_0x4f196d){return _0x170de0[_0xa118('0x19')](_0x34bf6e);}return _0x170de0['status'](_0x34bf6e)[_0xa118('0x1a')]();};}function respondWithResult(_0x14fed5,_0x32712e){_0x32712e=_0x32712e||0xc8;return function(_0x4a87d6){if(_0x4a87d6){return _0x14fed5[_0xa118('0x1b')](_0x32712e)[_0xa118('0x1c')](_0x4a87d6);}};}function respondWithFilteredResult(_0x27536a,_0x4b79b6){return function(_0x41a0ef){if(_0x41a0ef){var _0x3bd39b=typeof _0x4b79b6[_0xa118('0x1d')]===_0xa118('0x1e')&&typeof _0x4b79b6['limit']===_0xa118('0x1e');var _0x8fe0ab=_0x41a0ef[_0xa118('0x1f')];var _0x284318=_0x3bd39b?0x0:_0x4b79b6[_0xa118('0x1d')];var _0x2ef65c=_0x3bd39b?_0x41a0ef[_0xa118('0x1f')]:_0x4b79b6[_0xa118('0x1d')]+_0x4b79b6[_0xa118('0x20')];var _0x2ce11e;if(_0x2ef65c>=_0x8fe0ab){_0x2ef65c=_0x8fe0ab;_0x2ce11e=0xc8;}else{_0x2ce11e=0xce;}_0x27536a[_0xa118('0x1b')](_0x2ce11e);return _0x27536a[_0xa118('0x21')]('Content-Range',_0x284318+'-'+_0x2ef65c+'/'+_0x8fe0ab)[_0xa118('0x1c')](_0x41a0ef);}return null;};}function patchUpdates(_0x18b6de){return function(_0x5debaf){try{jsonpatch['apply'](_0x5debaf,_0x18b6de,!![]);}catch(_0x27e6dc){return BPromise[_0xa118('0x22')](_0x27e6dc);}return _0x5debaf['save']();};}function saveUpdates(_0x2047dd,_0x23dc11){return function(_0x2b89b8){if(_0x2b89b8){return _0x2b89b8[_0xa118('0x23')](_0x2047dd)[_0xa118('0x24')](function(_0x5e9c64){return _0x5e9c64;});}return null;};}function removeEntity(_0x2ae489,_0x54f5d9){return function(_0x4dbc9a){if(_0x4dbc9a){return _0x4dbc9a[_0xa118('0x25')]()[_0xa118('0x24')](function(){_0x2ae489['status'](0xcc)[_0xa118('0x1a')]();});}};}function handleEntityNotFound(_0x2b2a10,_0xdac55e){return function(_0x169484){if(!_0x169484){_0x2b2a10['sendStatus'](0x194);}return _0x169484;};}function handleError(_0x258ea2,_0x5f1628){_0x5f1628=_0x5f1628||0x1f4;return function(_0x30bca6){logger['error'](_0x30bca6[_0xa118('0x26')]);if(_0x30bca6[_0xa118('0x27')]){delete _0x30bca6[_0xa118('0x27')];}_0x258ea2[_0xa118('0x1b')](_0x5f1628)[_0xa118('0x28')](_0x30bca6);};}exports[_0xa118('0x29')]=function(_0x4390f3,_0x4a36ab){var _0x465f31={},_0x357cf0={},_0x79abe9={'count':0x0,'rows':[]};var _0x11aac7=_[_0xa118('0x2a')](db[_0xa118('0x2b')][_0xa118('0x2c')],function(_0x537f6a){return{'name':_0x537f6a[_0xa118('0x2d')],'type':_0x537f6a['type'][_0xa118('0x2e')]};});_0x357cf0[_0xa118('0x2f')]=_['map'](_0x11aac7,_0xa118('0x27'));_0x357cf0['query']=_['keys'](_0x4390f3[_0xa118('0x30')]);_0x357cf0['filters']=_[_0xa118('0x31')](_0x357cf0['model'],_0x357cf0['query']);_0x465f31['attributes']=_['intersection'](_0x357cf0[_0xa118('0x2f')],qs[_0xa118('0x32')](_0x4390f3[_0xa118('0x30')][_0xa118('0x32')]));_0x465f31['attributes']=_0x465f31['attributes'][_0xa118('0x33')]?_0x465f31[_0xa118('0x34')]:_0x357cf0[_0xa118('0x2f')];if(!_0x4390f3[_0xa118('0x30')][_0xa118('0x35')](_0xa118('0x36'))){_0x465f31[_0xa118('0x20')]=qs['limit'](_0x4390f3[_0xa118('0x30')]['limit']);_0x465f31[_0xa118('0x1d')]=qs['offset'](_0x4390f3[_0xa118('0x30')]['offset']);}_0x465f31[_0xa118('0x37')]=qs['sort'](_0x4390f3[_0xa118('0x30')][_0xa118('0x38')]);_0x465f31['where']=qs[_0xa118('0x39')](_['pick'](_0x4390f3[_0xa118('0x30')],_0x357cf0[_0xa118('0x39')]),_0x11aac7);if(_0x4390f3[_0xa118('0x30')][_0xa118('0x3a')]){_0x465f31[_0xa118('0x3b')]=_[_0xa118('0x3c')](_0x465f31['where'],{'$or':_[_0xa118('0x2a')](_0x11aac7,function(_0x5c7878){if(_0x5c7878['type']!==_0xa118('0x3d')){var _0x160d99={};_0x160d99[_0x5c7878[_0xa118('0x27')]]={'$like':'%'+_0x4390f3['query'][_0xa118('0x3a')]+'%'};return _0x160d99;}})});}_0x465f31=_[_0xa118('0x3c')]({},_0x465f31,_0x4390f3[_0xa118('0x3e')]);var _0x4ef34a={'where':_0x465f31[_0xa118('0x3b')]};return db['ChatTransferReport'][_0xa118('0x1f')](_0x4ef34a)[_0xa118('0x24')](function(_0x2dc135){_0x79abe9[_0xa118('0x1f')]=_0x2dc135;if(_0x4390f3[_0xa118('0x30')][_0xa118('0x3f')]){_0x465f31[_0xa118('0x40')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xa118('0x41')](_0x465f31);})[_0xa118('0x24')](function(_0x5c60a7){_0x79abe9[_0xa118('0x42')]=_0x5c60a7;return _0x79abe9;})[_0xa118('0x24')](respondWithFilteredResult(_0x4a36ab,_0x465f31))['catch'](handleError(_0x4a36ab,null));};exports[_0xa118('0x43')]=function(_0x39516f,_0x15933d){var _0x106b3d={'raw':!![],'where':{'id':_0x39516f[_0xa118('0x44')]['id']}},_0x18fd60={};_0x18fd60[_0xa118('0x2f')]=_[_0xa118('0x45')](db[_0xa118('0x2b')][_0xa118('0x2c')]);_0x18fd60['query']=_['keys'](_0x39516f[_0xa118('0x30')]);_0x18fd60['filters']=_[_0xa118('0x31')](_0x18fd60['model'],_0x18fd60[_0xa118('0x30')]);_0x106b3d[_0xa118('0x34')]=_[_0xa118('0x31')](_0x18fd60[_0xa118('0x2f')],qs[_0xa118('0x32')](_0x39516f[_0xa118('0x30')][_0xa118('0x32')]));_0x106b3d[_0xa118('0x34')]=_0x106b3d[_0xa118('0x34')][_0xa118('0x33')]?_0x106b3d['attributes']:_0x18fd60[_0xa118('0x2f')];if(_0x39516f['query'][_0xa118('0x3f')]){_0x106b3d[_0xa118('0x40')]=[{'all':!![]}];}_0x106b3d=_[_0xa118('0x3c')]({},_0x106b3d,_0x39516f[_0xa118('0x3e')]);return db['ChatTransferReport'][_0xa118('0x46')](_0x106b3d)[_0xa118('0x24')](handleEntityNotFound(_0x15933d,null))[_0xa118('0x24')](respondWithResult(_0x15933d,null))['catch'](handleError(_0x15933d,null));};exports['create']=function(_0x5b47cb,_0x272080){return db[_0xa118('0x2b')]['create'](_0x5b47cb[_0xa118('0x47')],{})[_0xa118('0x24')](respondWithResult(_0x272080,0xc9))[_0xa118('0x48')](handleError(_0x272080,null));};exports[_0xa118('0x23')]=function(_0x4bc0e6,_0x2b1b89){if(_0x4bc0e6['body']['id']){delete _0x4bc0e6['body']['id'];}return db[_0xa118('0x2b')]['find']({'where':{'id':_0x4bc0e6['params']['id']}})['then'](handleEntityNotFound(_0x2b1b89,null))['then'](saveUpdates(_0x4bc0e6['body'],null))[_0xa118('0x24')](respondWithResult(_0x2b1b89,null))[_0xa118('0x48')](handleError(_0x2b1b89,null));};exports[_0xa118('0x25')]=function(_0x1d48ef,_0x1559b9){return db[_0xa118('0x2b')][_0xa118('0x46')]({'where':{'id':_0x1d48ef[_0xa118('0x44')]['id']}})[_0xa118('0x24')](handleEntityNotFound(_0x1559b9,null))[_0xa118('0x24')](removeEntity(_0x1559b9,null))['catch'](handleError(_0x1559b9,null));};exports['describe']=function(_0x1a4764,_0x510944){return db[_0xa118('0x2b')][_0xa118('0x49')]()[_0xa118('0x24')](respondWithResult(_0x510944,null))[_0xa118('0x48')](handleError(_0x510944,null));}; \ No newline at end of file +var _0x80de=['map','ChatTransferReport','rawAttributes','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','params','keys','includeAll','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','stack','name','index'];(function(_0x7de12c,_0x5cbe98){var _0x135672=function(_0x5b9d32){while(--_0x5b9d32){_0x7de12c['push'](_0x7de12c['shift']());}};_0x135672(++_0x5cbe98);}(_0x80de,0xb5));var _0xe80d=function(_0x5d7d7f,_0x15ecee){_0x5d7d7f=_0x5d7d7f-0x0;var _0x30d103=_0x80de[_0x5d7d7f];return _0x30d103;};'use strict';var emlformat=require(_0xe80d('0x0'));var rimraf=require(_0xe80d('0x1'));var zipdir=require(_0xe80d('0x2'));var jsonpatch=require(_0xe80d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe80d('0x4'));var Mustache=require(_0xe80d('0x5'));var util=require(_0xe80d('0x6'));var path=require(_0xe80d('0x7'));var sox=require(_0xe80d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe80d('0x9'));var _=require(_0xe80d('0xa'));var squel=require(_0xe80d('0xb'));var crypto=require(_0xe80d('0xc'));var jsforce=require(_0xe80d('0xd'));var deskjs=require(_0xe80d('0xe'));var toCsv=require(_0xe80d('0xf'));var querystring=require(_0xe80d('0x10'));var Papa=require(_0xe80d('0x11'));var Redis=require(_0xe80d('0x12'));var authService=require(_0xe80d('0x13'));var qs=require(_0xe80d('0x14'));var as=require(_0xe80d('0x15'));var hardwareService=require(_0xe80d('0x16'));var logger=require(_0xe80d('0x17'))(_0xe80d('0x18'));var utils=require(_0xe80d('0x19'));var config=require(_0xe80d('0x1a'));var licenseUtil=require(_0xe80d('0x1b'));var db=require(_0xe80d('0x1c'))['db'];function respondWithStatusCode(_0x46ffaa,_0x3c47d6){_0x3c47d6=_0x3c47d6||0xcc;return function(_0x28726a){if(_0x28726a){return _0x46ffaa['sendStatus'](_0x3c47d6);}return _0x46ffaa[_0xe80d('0x1d')](_0x3c47d6)['end']();};}function respondWithResult(_0x204508,_0x3df3a2){_0x3df3a2=_0x3df3a2||0xc8;return function(_0x1117ed){if(_0x1117ed){return _0x204508['status'](_0x3df3a2)[_0xe80d('0x1e')](_0x1117ed);}};}function respondWithFilteredResult(_0x141d1b,_0x49aca6){return function(_0x358538){if(_0x358538){var _0x3c3610=typeof _0x49aca6['offset']===_0xe80d('0x1f')&&typeof _0x49aca6['limit']==='undefined';var _0x2a91ea=_0x358538['count'];var _0x2cb14e=_0x3c3610?0x0:_0x49aca6[_0xe80d('0x20')];var _0x397ad3=_0x3c3610?_0x358538[_0xe80d('0x21')]:_0x49aca6['offset']+_0x49aca6[_0xe80d('0x22')];var _0x5a22a0;if(_0x397ad3>=_0x2a91ea){_0x397ad3=_0x2a91ea;_0x5a22a0=0xc8;}else{_0x5a22a0=0xce;}_0x141d1b['status'](_0x5a22a0);return _0x141d1b[_0xe80d('0x23')](_0xe80d('0x24'),_0x2cb14e+'-'+_0x397ad3+'/'+_0x2a91ea)['json'](_0x358538);}return null;};}function patchUpdates(_0x159ab9){return function(_0x11f396){try{jsonpatch[_0xe80d('0x25')](_0x11f396,_0x159ab9,!![]);}catch(_0x56ee1e){return BPromise[_0xe80d('0x26')](_0x56ee1e);}return _0x11f396['save']();};}function saveUpdates(_0x3fa3f5,_0x163e93){return function(_0x2cd947){if(_0x2cd947){return _0x2cd947[_0xe80d('0x27')](_0x3fa3f5)[_0xe80d('0x28')](function(_0x11f207){return _0x11f207;});}return null;};}function removeEntity(_0x5460ed,_0x28f2d8){return function(_0x48c012){if(_0x48c012){return _0x48c012[_0xe80d('0x29')]()[_0xe80d('0x28')](function(){_0x5460ed[_0xe80d('0x1d')](0xcc)[_0xe80d('0x2a')]();});}};}function handleEntityNotFound(_0x236960,_0xb3abf3){return function(_0x13b38f){if(!_0x13b38f){_0x236960[_0xe80d('0x2b')](0x194);}return _0x13b38f;};}function handleError(_0x4e62c9,_0x2e3e2e){_0x2e3e2e=_0x2e3e2e||0x1f4;return function(_0x12c063){logger['error'](_0x12c063[_0xe80d('0x2c')]);if(_0x12c063[_0xe80d('0x2d')]){delete _0x12c063[_0xe80d('0x2d')];}_0x4e62c9[_0xe80d('0x1d')](_0x2e3e2e)['send'](_0x12c063);};}exports[_0xe80d('0x2e')]=function(_0x301b65,_0x13ddb1){var _0x2c4e79={},_0x4f0bab={},_0x12e827={'count':0x0,'rows':[]};var _0x4758b2=_[_0xe80d('0x2f')](db[_0xe80d('0x30')][_0xe80d('0x31')],function(_0x44a7ce){return{'name':_0x44a7ce['fieldName'],'type':_0x44a7ce[_0xe80d('0x32')]['key']};});_0x4f0bab['model']=_[_0xe80d('0x2f')](_0x4758b2,_0xe80d('0x2d'));_0x4f0bab[_0xe80d('0x33')]=_['keys'](_0x301b65[_0xe80d('0x33')]);_0x4f0bab[_0xe80d('0x34')]=_[_0xe80d('0x35')](_0x4f0bab['model'],_0x4f0bab['query']);_0x2c4e79[_0xe80d('0x36')]=_[_0xe80d('0x35')](_0x4f0bab[_0xe80d('0x37')],qs[_0xe80d('0x38')](_0x301b65[_0xe80d('0x33')][_0xe80d('0x38')]));_0x2c4e79[_0xe80d('0x36')]=_0x2c4e79['attributes'][_0xe80d('0x39')]?_0x2c4e79[_0xe80d('0x36')]:_0x4f0bab[_0xe80d('0x37')];if(!_0x301b65[_0xe80d('0x33')][_0xe80d('0x3a')](_0xe80d('0x3b'))){_0x2c4e79['limit']=qs['limit'](_0x301b65[_0xe80d('0x33')][_0xe80d('0x22')]);_0x2c4e79[_0xe80d('0x20')]=qs[_0xe80d('0x20')](_0x301b65['query'][_0xe80d('0x20')]);}_0x2c4e79[_0xe80d('0x3c')]=qs[_0xe80d('0x3d')](_0x301b65[_0xe80d('0x33')][_0xe80d('0x3d')]);_0x2c4e79[_0xe80d('0x3e')]=qs[_0xe80d('0x34')](_['pick'](_0x301b65[_0xe80d('0x33')],_0x4f0bab[_0xe80d('0x34')]),_0x4758b2);if(_0x301b65[_0xe80d('0x33')]['filter']){_0x2c4e79[_0xe80d('0x3e')]=_[_0xe80d('0x3f')](_0x2c4e79[_0xe80d('0x3e')],{'$or':_[_0xe80d('0x2f')](_0x4758b2,function(_0x2c5fd8){if(_0x2c5fd8['type']!==_0xe80d('0x40')){var _0x21612e={};_0x21612e[_0x2c5fd8[_0xe80d('0x2d')]]={'$like':'%'+_0x301b65['query']['filter']+'%'};return _0x21612e;}})});}_0x2c4e79=_['merge']({},_0x2c4e79,_0x301b65[_0xe80d('0x41')]);var _0x21e30b={'where':_0x2c4e79[_0xe80d('0x3e')]};return db['ChatTransferReport']['count'](_0x21e30b)[_0xe80d('0x28')](function(_0x17544f){_0x12e827[_0xe80d('0x21')]=_0x17544f;if(_0x301b65[_0xe80d('0x33')]['includeAll']){_0x2c4e79[_0xe80d('0x42')]=[{'all':!![]}];}return db[_0xe80d('0x30')][_0xe80d('0x43')](_0x2c4e79);})[_0xe80d('0x28')](function(_0x1a67af){_0x12e827['rows']=_0x1a67af;return _0x12e827;})[_0xe80d('0x28')](respondWithFilteredResult(_0x13ddb1,_0x2c4e79))['catch'](handleError(_0x13ddb1,null));};exports['show']=function(_0xa6eab3,_0x5da828){var _0x5b1d47={'raw':!![],'where':{'id':_0xa6eab3[_0xe80d('0x44')]['id']}},_0x3c6c59={};_0x3c6c59[_0xe80d('0x37')]=_[_0xe80d('0x45')](db[_0xe80d('0x30')][_0xe80d('0x31')]);_0x3c6c59['query']=_[_0xe80d('0x45')](_0xa6eab3[_0xe80d('0x33')]);_0x3c6c59[_0xe80d('0x34')]=_[_0xe80d('0x35')](_0x3c6c59['model'],_0x3c6c59[_0xe80d('0x33')]);_0x5b1d47[_0xe80d('0x36')]=_['intersection'](_0x3c6c59[_0xe80d('0x37')],qs[_0xe80d('0x38')](_0xa6eab3['query'][_0xe80d('0x38')]));_0x5b1d47[_0xe80d('0x36')]=_0x5b1d47['attributes']['length']?_0x5b1d47[_0xe80d('0x36')]:_0x3c6c59['model'];if(_0xa6eab3[_0xe80d('0x33')][_0xe80d('0x46')]){_0x5b1d47[_0xe80d('0x42')]=[{'all':!![]}];}_0x5b1d47=_[_0xe80d('0x3f')]({},_0x5b1d47,_0xa6eab3['options']);return db[_0xe80d('0x30')]['find'](_0x5b1d47)[_0xe80d('0x28')](handleEntityNotFound(_0x5da828,null))[_0xe80d('0x28')](respondWithResult(_0x5da828,null))['catch'](handleError(_0x5da828,null));};exports[_0xe80d('0x47')]=function(_0x4c3760,_0x2b988b){return db[_0xe80d('0x30')][_0xe80d('0x47')](_0x4c3760[_0xe80d('0x48')],{})[_0xe80d('0x28')](respondWithResult(_0x2b988b,0xc9))[_0xe80d('0x49')](handleError(_0x2b988b,null));};exports[_0xe80d('0x27')]=function(_0x4d39cb,_0x1afc07){if(_0x4d39cb[_0xe80d('0x48')]['id']){delete _0x4d39cb[_0xe80d('0x48')]['id'];}return db[_0xe80d('0x30')][_0xe80d('0x4a')]({'where':{'id':_0x4d39cb[_0xe80d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1afc07,null))[_0xe80d('0x28')](saveUpdates(_0x4d39cb[_0xe80d('0x48')],null))[_0xe80d('0x28')](respondWithResult(_0x1afc07,null))[_0xe80d('0x49')](handleError(_0x1afc07,null));};exports[_0xe80d('0x29')]=function(_0x5f3f26,_0x1d48ba){return db[_0xe80d('0x30')][_0xe80d('0x4a')]({'where':{'id':_0x5f3f26[_0xe80d('0x44')]['id']}})[_0xe80d('0x28')](handleEntityNotFound(_0x1d48ba,null))[_0xe80d('0x28')](removeEntity(_0x1d48ba,null))['catch'](handleError(_0x1d48ba,null));};exports[_0xe80d('0x4b')]=function(_0x2a3165,_0x42985f){return db[_0xe80d('0x30')][_0xe80d('0x4b')]()[_0xe80d('0x28')](respondWithResult(_0x42985f,null))['catch'](handleError(_0x42985f,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e8c5149..4f80982 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 _0x3fe9=['../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x339948,_0x1e07fe){var _0x3fe9cc=function(_0x5bfc39){while(--_0x5bfc39){_0x339948['push'](_0x339948['shift']());}};_0x3fe9cc(++_0x1e07fe);}(_0x3fe9,0xf4));var _0x93fe=function(_0x4778bc,_0x4345c7){_0x4778bc=_0x4778bc-0x0;var _0x1b0e0f=_0x3fe9[_0x4778bc];return _0x1b0e0f;};'use strict';var _=require(_0x93fe('0x0'));var util=require(_0x93fe('0x1'));var logger=require(_0x93fe('0x2'))(_0x93fe('0x3'));var moment=require('moment');var BPromise=require(_0x93fe('0x4'));var rp=require(_0x93fe('0x5'));var fs=require('fs');var path=require(_0x93fe('0x6'));var rimraf=require(_0x93fe('0x7'));var config=require(_0x93fe('0x8'));var attributes=require(_0x93fe('0x9'));module[_0x93fe('0xa')]=function(_0x2c5a33,_0xad1bd6){return _0x2c5a33['define'](_0x93fe('0xb'),attributes,{'tableName':_0x93fe('0xc'),'paranoid':![],'indexes':[{'name':_0x93fe('0xd'),'fields':[_0x93fe('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab73=['moment','bluebird','path','rimraf','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid','lodash','util','api'];(function(_0x157c38,_0x192d07){var _0xea7e3a=function(_0x1631bb){while(--_0x1631bb){_0x157c38['push'](_0x157c38['shift']());}};_0xea7e3a(++_0x192d07);}(_0xab73,0xe4));var _0x3ab7=function(_0x3ba98d,_0xba1a74){_0x3ba98d=_0x3ba98d-0x0;var _0x3f90a1=_0xab73[_0x3ba98d];return _0x3f90a1;};'use strict';var _=require(_0x3ab7('0x0'));var util=require(_0x3ab7('0x1'));var logger=require('../../config/logger')(_0x3ab7('0x2'));var moment=require(_0x3ab7('0x3'));var BPromise=require(_0x3ab7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab7('0x5'));var rimraf=require(_0x3ab7('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ab7('0x7'));module[_0x3ab7('0x8')]=function(_0x4d0433,_0x40d39f){return _0x4d0433['define'](_0x3ab7('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3ab7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index fb68c4f..57d24d9 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 _0x2daa=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4dfa76,_0x53e4fb){var _0x14d3eb=function(_0x3ccf07){while(--_0x3ccf07){_0x4dfa76['push'](_0x4dfa76['shift']());}};_0x14d3eb(++_0x53e4fb);}(_0x2daa,0x67));var _0xa2da=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0x2daa[_0x1d70db];return _0x3060c6;};'use strict';var _=require(_0xa2da('0x0'));var util=require('util');var moment=require(_0xa2da('0x1'));var BPromise=require(_0xa2da('0x2'));var rs=require(_0xa2da('0x3'));var fs=require('fs');var Redis=require(_0xa2da('0x4'));var db=require(_0xa2da('0x5'))['db'];var utils=require(_0xa2da('0x6'));var logger=require(_0xa2da('0x7'))(_0xa2da('0x8'));var config=require(_0xa2da('0x9'));var jayson=require(_0xa2da('0xa'));var client=jayson[_0xa2da('0xb')][_0xa2da('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ca6d4,_0x38cb93,_0x2e1298){return new BPromise(function(_0x6f9b92,_0x4b7bd7){return client['request'](_0x4ca6d4,_0x2e1298)[_0xa2da('0xd')](function(_0x4e159b){logger[_0xa2da('0xe')](_0xa2da('0xf'),_0x38cb93,_0xa2da('0x10'));logger[_0xa2da('0x11')](_0xa2da('0x12'),_0x38cb93,_0xa2da('0x10'),JSON[_0xa2da('0x13')](_0x4e159b));if(_0x4e159b[_0xa2da('0x14')]){if(_0x4e159b[_0xa2da('0x14')]['code']===0x1f4){logger[_0xa2da('0x14')](_0xa2da('0xf'),_0x38cb93,_0x4e159b['error'][_0xa2da('0x15')]);return _0x4b7bd7(_0x4e159b['error'][_0xa2da('0x15')]);}logger[_0xa2da('0x14')](_0xa2da('0xf'),_0x38cb93,_0x4e159b[_0xa2da('0x14')][_0xa2da('0x15')]);return _0x6f9b92(_0x4e159b[_0xa2da('0x14')][_0xa2da('0x15')]);}else{logger[_0xa2da('0xe')](_0xa2da('0xf'),_0x38cb93,_0xa2da('0x10'));_0x6f9b92(_0x4e159b[_0xa2da('0x16')][_0xa2da('0x15')]);}})[_0xa2da('0x17')](function(_0x2fd1bc){logger[_0xa2da('0x14')](_0xa2da('0xf'),_0x38cb93,_0x2fd1bc);_0x4b7bd7(_0x2fd1bc);});});} \ No newline at end of file +var _0x66ba=['jayson/promise','http','request','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2189ba,_0x4e74f7){var _0x18d3ae=function(_0x19d088){while(--_0x19d088){_0x2189ba['push'](_0x2189ba['shift']());}};_0x18d3ae(++_0x4e74f7);}(_0x66ba,0xbf));var _0xa66b=function(_0x47a03a,_0x1367f9){_0x47a03a=_0x47a03a-0x0;var _0x4aa157=_0x66ba[_0x47a03a];return _0x4aa157;};'use strict';var _=require('lodash');var util=require(_0xa66b('0x0'));var moment=require('moment');var BPromise=require(_0xa66b('0x1'));var rs=require(_0xa66b('0x2'));var fs=require('fs');var Redis=require(_0xa66b('0x3'));var db=require(_0xa66b('0x4'))['db'];var utils=require(_0xa66b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa66b('0x6'));var jayson=require(_0xa66b('0x7'));var client=jayson['client'][_0xa66b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e5db6,_0x578f75,_0x542484){return new BPromise(function(_0x132dd1,_0x5df9ad){return client[_0xa66b('0x9')](_0x4e5db6,_0x542484)[_0xa66b('0xa')](function(_0x4874f8){logger['info'](_0xa66b('0xb'),_0x578f75,'request\x20sent');logger[_0xa66b('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x578f75,_0xa66b('0xd'),JSON['stringify'](_0x4874f8));if(_0x4874f8[_0xa66b('0xe')]){if(_0x4874f8['error']['code']===0x1f4){logger[_0xa66b('0xe')](_0xa66b('0xb'),_0x578f75,_0x4874f8['error'][_0xa66b('0xf')]);return _0x5df9ad(_0x4874f8[_0xa66b('0xe')][_0xa66b('0xf')]);}logger[_0xa66b('0xe')](_0xa66b('0xb'),_0x578f75,_0x4874f8['error']['message']);return _0x132dd1(_0x4874f8[_0xa66b('0xe')][_0xa66b('0xf')]);}else{logger[_0xa66b('0x10')](_0xa66b('0xb'),_0x578f75,_0xa66b('0xd'));_0x132dd1(_0x4874f8['result']['message']);}})[_0xa66b('0x11')](function(_0x51075c){logger[_0xa66b('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x578f75,_0x51075c);_0x5df9ad(_0x51075c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 02b7585..13cc752 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 _0x389f=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x389f,0x99));var _0xf389=function(_0x12daa3,_0x5725c8){_0x12daa3=_0x12daa3-0x0;var _0x219113=_0x389f[_0x12daa3];return _0x219113;};'use strict';var multer=require(_0xf389('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf389('0x1'));var express=require(_0xf389('0x2'));var router=express[_0xf389('0x3')]();var fs_extra=require(_0xf389('0x4'));var auth=require(_0xf389('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf389('0x6'));var controller=require(_0xf389('0x7'));router[_0xf389('0x8')]('/',auth[_0xf389('0x9')](),controller[_0xf389('0xa')]);router[_0xf389('0x8')](_0xf389('0xb'),auth[_0xf389('0x9')](),controller[_0xf389('0xc')]);router['get'](_0xf389('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf389('0xe')]('/',auth[_0xf389('0x9')](),controller[_0xf389('0xf')]);router[_0xf389('0x10')](_0xf389('0xd'),auth[_0xf389('0x9')](),controller[_0xf389('0x11')]);router[_0xf389('0x12')]('/:id',auth[_0xf389('0x9')](),controller[_0xf389('0x13')]);module[_0xf389('0x14')]=router; \ No newline at end of file +var _0x90bd=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x90bd,0x1db));var _0xd90b=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x90bd[_0x12d951];return _0x44de17;};'use strict';var multer=require('multer');var util=require(_0xd90b('0x0'));var path=require(_0xd90b('0x1'));var timeout=require(_0xd90b('0x2'));var express=require(_0xd90b('0x3'));var router=express[_0xd90b('0x4')]();var fs_extra=require(_0xd90b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd90b('0x6'));var config=require(_0xd90b('0x7'));var controller=require('./chatTransferReport.controller');router[_0xd90b('0x8')]('/',auth[_0xd90b('0x9')](),controller[_0xd90b('0xa')]);router[_0xd90b('0x8')](_0xd90b('0xb'),auth[_0xd90b('0x9')](),controller['describe']);router[_0xd90b('0x8')](_0xd90b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd90b('0xd')]('/',auth['isAuthenticated'](),controller[_0xd90b('0xe')]);router[_0xd90b('0xf')](_0xd90b('0xc'),auth[_0xd90b('0x9')](),controller[_0xd90b('0x10')]);router[_0xd90b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd90b('0x12')]);module[_0xd90b('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 3d60cf5..3594532 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 _0xaa88=['#011F6A','#ffffff','BOOLEAN','ENUM','rounded','Chat','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Send','Skip','Feedback','star','thumb','input','text','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','INTEGER','CHAT','#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','address','email','Agent'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xaa88,0x137));var _0x8aa8=function(_0x3794a0,_0x1a9cfc){_0x3794a0=_0x3794a0-0x0;var _0x5bdaba=_0xaa88[_0x3794a0];return _0x5bdaba;};'use strict';var Sequelize=require(_0x8aa8('0x0'));var rs=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'name':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8aa8('0x4')},'description':{'type':Sequelize[_0x8aa8('0x3')]},'mapKey':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x5')},'mapKeyOffline':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8aa8('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8aa8('0x3')]},'animation':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8aa8('0xa')](_0x8aa8('0xb'),'squared'),'defaultValue':_0x8aa8('0xb')},'header_online':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0xc')},'offline_chat_button':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0xd')},'download_transcript':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8aa8('0xe')]},'closingQuestion':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x11')},'noteTitle':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x13')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x14')},'conditionAgreement':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x15')},'ratingType':{'type':Sequelize[_0x8aa8('0xa')](_0x8aa8('0x16'),_0x8aa8('0x17')),'defaultValue':_0x8aa8('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8aa8('0x18'),'variable':null,'config':{'placeholder':'name','type':_0x8aa8('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8aa8('0x18'),'props':{'title':_0x8aa8('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x8aa8('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8aa8('0x1a')](_0x8aa8('0x1b'))?JSON[_0x8aa8('0x1c')](this['getDataValue']('onlineForm')):{};},'set':function(_0x2d1508){return this[_0x8aa8('0x1d')](_0x8aa8('0x1b'),JSON[_0x8aa8('0x1e')](_0x2d1508));}},'offlineForm':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8aa8('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x8aa8('0x5'),'type':_0x8aa8('0x5')},'variable':null},{'type':_0x8aa8('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x8aa8('0x20')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x8aa8('0x21'))?JSON[_0x8aa8('0x1c')](this[_0x8aa8('0x1a')](_0x8aa8('0x21'))):{};},'set':function(_0xe07a83){return this['setDataValue'](_0x8aa8('0x21'),JSON[_0x8aa8('0x1e')](_0xe07a83));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8aa8('0x22')]();}},'autoclose':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8aa8('0x3')]},'forwardOffline':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8aa8('0x3')]},'waitingTitle':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x23')},'waitingMessage':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x25')},'offlineMessageBody':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x27')},'skipUnmanaged':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x14')},'sendUnmanaged':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x13')},'enableCustomerAttachment':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':function(){return _0x8aa8('0x28');}},'notificationSound':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x2a')},'verticalAlignment':{'type':Sequelize[_0x8aa8('0x2b')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x8aa8('0x2c')},'messagesAlignment':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x8aa8('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8aa8('0x2b')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8aa8('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8aa8('0x2b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':_0x8aa8('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8aa8('0x2b')],'comment':_0x8aa8('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8aa8('0x30'),'set':function(_0x3c6115){if(!_0x3c6115)this[_0x8aa8('0x1d')](_0x8aa8('0x31'),null);this[_0x8aa8('0x1d')](_0x8aa8('0x32'),_0x3c6115);}},'vidaooEscalation':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8aa8('0x3')]},'vidaooTopic':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![],'defaultValue':_0x8aa8('0x33')},'vidaooNote':{'type':Sequelize[_0x8aa8('0x3')],'defaultValue':function(){return _0x8aa8('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x8aa8('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8aa8('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8aa8('0xe')]}}; \ No newline at end of file +var _0x99e9=['System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x413c57,_0x14d136){var _0x31a8bf=function(_0x58eb49){while(--_0x58eb49){_0x413c57['push'](_0x413c57['shift']());}};_0x31a8bf(++_0x14d136);}(_0x99e9,0xb4));var _0x999e=function(_0x191f9d,_0x21976f){_0x191f9d=_0x191f9d-0x0;var _0x58e60d=_0x99e9[_0x191f9d];return _0x58e60d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x999e('0x0'));module[_0x999e('0x1')]={'name':{'type':Sequelize[_0x999e('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x999e('0x2')]},'mapKey':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x4')},'customerAlias':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x999e('0x2')]},'animation':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x999e('0x9')](_0x999e('0xa'),_0x999e('0xb')),'defaultValue':_0x999e('0xa')},'header_online':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xc')},'start_chat_button':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0xf')},'download_transcript':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x999e('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x13')},'noteTitle':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x15')},'closingMessageButton':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xe')},'skipMessageButton':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x16')},'conditionAgreement':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0x999e('0x18'),_0x999e('0x19')),'defaultValue':_0x999e('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x999e('0x11')],'defaultValue':function(){return JSON[_0x999e('0x1a')]({'items':[{'type':_0x999e('0x1b'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x999e('0x1c'),'helpText':''}},{'type':_0x999e('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x999e('0x3'),'type':_0x999e('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x999e('0x1d')](_0x999e('0x1e'))?JSON[_0x999e('0x1f')](this[_0x999e('0x1d')]('onlineForm')):{};},'set':function(_0x2e1cc5){return this[_0x999e('0x20')](_0x999e('0x1e'),JSON[_0x999e('0x1a')](_0x2e1cc5));}},'offlineForm':{'type':Sequelize[_0x999e('0x11')],'defaultValue':function(){return JSON[_0x999e('0x1a')]({'items':[{'type':_0x999e('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x999e('0x3'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x999e('0x21')},'props':{'title':_0x999e('0x21'),'helpText':_0x999e('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x999e('0x23'))?JSON[_0x999e('0x1f')](this[_0x999e('0x1d')](_0x999e('0x23'))):{};},'set':function(_0x15dca1){return this[_0x999e('0x20')](_0x999e('0x23'),JSON[_0x999e('0x1a')](_0x15dca1));}},'token':{'type':Sequelize[_0x999e('0x2')],'defaultValue':function(){return rs[_0x999e('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x999e('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x999e('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x16')},'sendUnmanaged':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x999e('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x999e('0x2')]},'notificationTemplate':{'type':Sequelize[_0x999e('0x11')],'defaultValue':function(){return _0x999e('0x27');}},'notificationSound':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x999e('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x999e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x999e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x28')},'systemAvatar':{'type':Sequelize[_0x999e('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x999e('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![],'comment':_0x999e('0x29'),'set':function(_0x1e1229){if(!_0x1e1229)this[_0x999e('0x20')]('mandatoryDispositionPauseId',null);this[_0x999e('0x20')]('mandatoryDisposition',_0x1e1229);}},'vidaooEscalation':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x999e('0x2')]},'vidaooTopic':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x2a')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x999e('0x2b');}},'vidaooMetadata':{'type':Sequelize[_0x999e('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index fa9aef5..65c43b5 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 _0x8e34=['autoAssociation','update','params','describe','ChatWebsiteId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','../../config/license/util','custom','isNil','existsSync','join','root','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','showCustomerAvatar','getSystemAvatar','user-agent-parser','setUA','headers','chat','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','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','List','ChatApplication','account','applications','list','orderBy','priority','asc','Applications','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','ContactId','interaction','spread','firstName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','notify','offline','files','no\x20available\x20attributes','from\x20is\x20mandatory','send','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','from','MailAccount','findOrCreate','render','ChatOfflineMessage','originalname','server','attachments','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','email','offlineMessageSubject','openNewInteraction','MailAccountId','mimetype','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','fullname','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','some','readFileSync','server/files/chat/iframe.ejs','utf8','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','color','labelText','textColor','textButtonColor','backgroundColor','addApplications','Transaction','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','fs-extra','lodash','querystring','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-to-text','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','result','sendStatus','status','json','offset','undefined','count','Content-Range','then','destroy','get','ChatWebsites','UserProfileResource','end','name','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','map','VIRTUAL','where','includeAll','include','findAll','catch','show','Pause','options','find','create','body','user','role','UserProfileSection','userProfileId'];(function(_0x2a3163,_0x488192){var _0x263b1b=function(_0x47078e){while(--_0x47078e){_0x2a3163['push'](_0x2a3163['shift']());}};_0x263b1b(++_0x488192);}(_0x8e34,0xcb));var _0x48e3=function(_0x48d993,_0x4968b1){_0x48d993=_0x48d993-0x0;var _0x67aa86=_0x8e34[_0x48d993];return _0x67aa86;};'use strict';var BPromise=require(_0x48e3('0x0'));var Mustache=require(_0x48e3('0x1'));var util=require(_0x48e3('0x2'));var path=require('path');var ejs=require(_0x48e3('0x3'));var fs=require('fs');var fs_extra=require(_0x48e3('0x4'));var _=require(_0x48e3('0x5'));var querystring=require(_0x48e3('0x6'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x48e3('0x7'))('api');var config=require('../../config/environment');var db=require(_0x48e3('0x8'))['db'];config[_0x48e3('0x9')]=_[_0x48e3('0xa')](config[_0x48e3('0x9')],{'host':_0x48e3('0xb'),'port':0x18eb});var socket=require(_0x48e3('0xc'))(new Redis(config[_0x48e3('0x9')]));require('./chatWebsite.socket')['register'](socket);var htmlToText=require(_0x48e3('0xd'));var jayson=require('jayson/promise');var client=jayson[_0x48e3('0xe')][_0x48e3('0xf')]({'port':0x232c});var client9002=jayson[_0x48e3('0xe')][_0x48e3('0xf')]({'port':0x232a});var client9003=jayson[_0x48e3('0xe')]['http']({'port':0x232b});var client9001=jayson[_0x48e3('0xe')][_0x48e3('0xf')]({'port':0x2329});function respondWithRpcPromise(_0x1a61e2,_0x4257a9,_0x28a250,_0x465cad){return new BPromise(function(_0x3e7aa5,_0x3a7836){var _0x10b8cb=_0x465cad||client;return _0x10b8cb[_0x48e3('0x10')](_0x1a61e2,_0x28a250)['then'](function(_0x58412f){logger[_0x48e3('0x11')](_0x48e3('0x12'),_0x4257a9,_0x48e3('0x13'));logger[_0x48e3('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4257a9,'request\x20sent',JSON['stringify'](_0x58412f));if(_0x58412f['error']){if(_0x58412f[_0x48e3('0x15')]['code']===0x1f4){logger['error'](_0x48e3('0x12'),_0x4257a9,_0x58412f[_0x48e3('0x15')][_0x48e3('0x16')]);return _0x3a7836(_0x58412f[_0x48e3('0x15')][_0x48e3('0x16')]);}logger[_0x48e3('0x15')](_0x48e3('0x12'),_0x4257a9,_0x58412f[_0x48e3('0x15')][_0x48e3('0x16')]);return _0x3e7aa5(_0x58412f[_0x48e3('0x15')]['message']);}else{logger[_0x48e3('0x11')](_0x48e3('0x12'),_0x4257a9,_0x48e3('0x13'));_0x3e7aa5(_0x58412f[_0x48e3('0x17')]['message']);}})['catch'](function(_0x40357d){logger[_0x48e3('0x15')](_0x48e3('0x12'),_0x4257a9,_0x40357d);_0x3a7836(_0x40357d);});});}function respondWithStatusCode(_0x4c2997,_0x17ad00){_0x17ad00=_0x17ad00||0xcc;return function(_0x5aaded){if(_0x5aaded){return _0x4c2997[_0x48e3('0x18')](_0x17ad00);}return _0x4c2997[_0x48e3('0x19')](_0x17ad00)['end']();};}function respondWithResult(_0x4ce7bf,_0x79a9f2){_0x79a9f2=_0x79a9f2||0xc8;return function(_0x39e765){if(_0x39e765){return _0x4ce7bf[_0x48e3('0x19')](_0x79a9f2)[_0x48e3('0x1a')](_0x39e765);}};}function respondWithFilteredResult(_0x643eb9,_0x55212f){return function(_0x2e6771){if(_0x2e6771){var _0x193282=typeof _0x55212f[_0x48e3('0x1b')]==='undefined'&&typeof _0x55212f['limit']===_0x48e3('0x1c');var _0x1a789f=_0x2e6771[_0x48e3('0x1d')];var _0x502720=_0x193282?0x0:_0x55212f[_0x48e3('0x1b')];var _0xcb5713=_0x193282?_0x2e6771[_0x48e3('0x1d')]:_0x55212f[_0x48e3('0x1b')]+_0x55212f['limit'];var _0x11fc8e;if(_0xcb5713>=_0x1a789f){_0xcb5713=_0x1a789f;_0x11fc8e=0xc8;}else{_0x11fc8e=0xce;}_0x643eb9['status'](_0x11fc8e);return _0x643eb9['set'](_0x48e3('0x1e'),_0x502720+'-'+_0xcb5713+'/'+_0x1a789f)[_0x48e3('0x1a')](_0x2e6771);}return null;};}function saveUpdates(_0xbebeb4){return function(_0x1b763e){if(_0x1b763e){return _0x1b763e['update'](_0xbebeb4)[_0x48e3('0x1f')](function(_0x417124){return _0x417124;});}return null;};}function removeEntity(_0x22522b){return function(_0x1f903b){if(_0x1f903b){return _0x1f903b[_0x48e3('0x20')]()[_0x48e3('0x1f')](function(){var _0x4be9b8=_0x1f903b[_0x48e3('0x21')]({'plain':!![]});var _0x2b1875=_0x48e3('0x22');return db[_0x48e3('0x23')][_0x48e3('0x20')]({'where':{'type':_0x2b1875,'resourceId':_0x4be9b8['id']}})[_0x48e3('0x1f')](function(){return _0x1f903b;});})[_0x48e3('0x1f')](function(){_0x22522b['status'](0xcc)[_0x48e3('0x24')]();});}};}function handleEntityNotFound(_0x5cd706){return function(_0x48588a){if(!_0x48588a){_0x5cd706[_0x48e3('0x18')](0x194);}return _0x48588a;};}function handleError(_0x5511e3,_0x1ddda6){_0x1ddda6=_0x1ddda6||0x1f4;return function(_0x282f5d){logger[_0x48e3('0x15')](_0x282f5d['stack']);if(_0x282f5d[_0x48e3('0x25')]){delete _0x282f5d['name'];}_0x5511e3[_0x48e3('0x19')](_0x1ddda6)['send'](_0x282f5d);};}exports['index']=function(_0x30802a,_0x3eca8e){var _0x18ae61={'include':[{'model':db['Pause'],'as':_0x48e3('0x26')}]},_0x2e450a={},_0x526a2f={'count':0x0,'rows':[]};var _0x1678d9=_['map'](db[_0x48e3('0x27')][_0x48e3('0x28')],function(_0x38f98f){return{'name':_0x38f98f[_0x48e3('0x29')],'type':_0x38f98f[_0x48e3('0x2a')][_0x48e3('0x2b')]};});_0x2e450a[_0x48e3('0x2c')]=_['map'](_0x1678d9,_0x48e3('0x25'));_0x2e450a[_0x48e3('0x2d')]=_[_0x48e3('0x2e')](_0x30802a[_0x48e3('0x2d')]);_0x2e450a[_0x48e3('0x2f')]=_[_0x48e3('0x30')](_0x2e450a[_0x48e3('0x2c')],_0x2e450a[_0x48e3('0x2d')]);_0x18ae61['attributes']=_['intersection'](_0x2e450a[_0x48e3('0x2c')],qs[_0x48e3('0x31')](_0x30802a[_0x48e3('0x2d')][_0x48e3('0x31')]));_0x18ae61[_0x48e3('0x32')]=_0x18ae61[_0x48e3('0x32')][_0x48e3('0x33')]?_0x18ae61[_0x48e3('0x32')]:_0x2e450a[_0x48e3('0x2c')];if(!_0x30802a[_0x48e3('0x2d')][_0x48e3('0x34')](_0x48e3('0x35'))){_0x18ae61[_0x48e3('0x36')]=qs['limit'](_0x30802a['query'][_0x48e3('0x36')]);_0x18ae61[_0x48e3('0x1b')]=qs['offset'](_0x30802a[_0x48e3('0x2d')][_0x48e3('0x1b')]);}_0x18ae61[_0x48e3('0x37')]=qs['sort'](_0x30802a[_0x48e3('0x2d')][_0x48e3('0x38')]);_0x18ae61['where']=qs[_0x48e3('0x2f')](_[_0x48e3('0x39')](_0x30802a['query'],_0x2e450a[_0x48e3('0x2f')]),_0x1678d9);if(_0x30802a[_0x48e3('0x2d')][_0x48e3('0x3a')]){_0x18ae61['where']=_[_0x48e3('0x3b')](_0x18ae61['where'],{'$or':_[_0x48e3('0x3c')](_0x1678d9,function(_0x188df7){if(_0x188df7[_0x48e3('0x2a')]!==_0x48e3('0x3d')){var _0x18f3b2={};_0x18f3b2[_0x188df7['name']]={'$like':'%'+_0x30802a[_0x48e3('0x2d')][_0x48e3('0x3a')]+'%'};return _0x18f3b2;}})});}_0x18ae61=_[_0x48e3('0x3b')]({},_0x18ae61,_0x30802a['options']);var _0x3c0673={'where':_0x18ae61[_0x48e3('0x3e')]};return db[_0x48e3('0x27')][_0x48e3('0x1d')](_0x3c0673)[_0x48e3('0x1f')](function(_0x2e0a9f){_0x526a2f[_0x48e3('0x1d')]=_0x2e0a9f;if(_0x30802a[_0x48e3('0x2d')][_0x48e3('0x3f')]){_0x18ae61[_0x48e3('0x40')]=[{'all':!![]}];}return db[_0x48e3('0x27')][_0x48e3('0x41')](_0x18ae61);})[_0x48e3('0x1f')](function(_0x1132c9){_0x526a2f['rows']=_0x1132c9;return _0x526a2f;})[_0x48e3('0x1f')](respondWithFilteredResult(_0x3eca8e,_0x18ae61))[_0x48e3('0x42')](handleError(_0x3eca8e,null));};exports[_0x48e3('0x43')]=function(_0x1fa6dd,_0x10dd0e){var _0x2ef256={'raw':![],'where':{'id':_0x1fa6dd['params']['id']},'include':[{'model':db[_0x48e3('0x44')],'as':_0x48e3('0x26')}]},_0x46dd10={};_0x46dd10[_0x48e3('0x2c')]=_[_0x48e3('0x2e')](db[_0x48e3('0x27')][_0x48e3('0x28')]);_0x46dd10[_0x48e3('0x2d')]=_[_0x48e3('0x2e')](_0x1fa6dd['query']);_0x46dd10[_0x48e3('0x2f')]=_[_0x48e3('0x30')](_0x46dd10[_0x48e3('0x2c')],_0x46dd10[_0x48e3('0x2d')]);_0x2ef256['attributes']=_['intersection'](_0x46dd10['model'],qs[_0x48e3('0x31')](_0x1fa6dd['query'][_0x48e3('0x31')]));_0x2ef256[_0x48e3('0x32')]=_0x2ef256['attributes'][_0x48e3('0x33')]?_0x2ef256[_0x48e3('0x32')]:_0x46dd10[_0x48e3('0x2c')];if(_0x1fa6dd[_0x48e3('0x2d')][_0x48e3('0x3f')]){_0x2ef256[_0x48e3('0x40')]=[{'all':!![]}];}_0x2ef256=_[_0x48e3('0x3b')]({},_0x2ef256,_0x1fa6dd[_0x48e3('0x45')]);return db[_0x48e3('0x27')][_0x48e3('0x46')](_0x2ef256)[_0x48e3('0x1f')](handleEntityNotFound(_0x10dd0e,null))[_0x48e3('0x1f')](respondWithResult(_0x10dd0e,null))['catch'](handleError(_0x10dd0e,null));};exports['create']=function(_0x549bf3,_0x3851e7){return db['ChatWebsite'][_0x48e3('0x47')](_0x549bf3[_0x48e3('0x48')],{})[_0x48e3('0x1f')](function(_0x3cc52d){var _0x329595=_0x549bf3[_0x48e3('0x49')][_0x48e3('0x21')]({'plain':!![]});if(!_0x329595)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x329595[_0x48e3('0x4a')]===_0x48e3('0x49')){var _0x422a0e=_0x3cc52d[_0x48e3('0x21')]({'plain':!![]});var _0x4bf973='ChatWebsites';return db[_0x48e3('0x4b')][_0x48e3('0x46')]({'where':{'name':_0x4bf973,'userProfileId':_0x329595[_0x48e3('0x4c')]},'raw':!![]})[_0x48e3('0x1f')](function(_0xa42367){if(_0xa42367&&_0xa42367[_0x48e3('0x4d')]===0x0){return db[_0x48e3('0x23')][_0x48e3('0x47')]({'name':_0x422a0e['name'],'resourceId':_0x422a0e['id'],'type':_0xa42367['name'],'sectionId':_0xa42367['id']},{})[_0x48e3('0x1f')](function(){return _0x3cc52d;});}else{return _0x3cc52d;}})['catch'](function(_0xb838b1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb838b1);throw _0xb838b1;});}return _0x3cc52d;})[_0x48e3('0x1f')](respondWithResult(_0x3851e7,0xc9))['catch'](handleError(_0x3851e7,null));};exports[_0x48e3('0x4e')]=function(_0x161b95,_0x5ca440){if(_0x161b95[_0x48e3('0x48')]['id']){delete _0x161b95[_0x48e3('0x48')]['id'];}return db[_0x48e3('0x27')]['find']({'where':{'id':_0x161b95[_0x48e3('0x4f')]['id']},'include':[{'model':db['Pause'],'as':_0x48e3('0x26')}]})[_0x48e3('0x1f')](handleEntityNotFound(_0x5ca440,null))['then'](saveUpdates(_0x161b95['body'],null))[_0x48e3('0x1f')](respondWithResult(_0x5ca440,null))[_0x48e3('0x42')](handleError(_0x5ca440,null));};exports[_0x48e3('0x20')]=function(_0x9441e6,_0x49086f){return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0x9441e6[_0x48e3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x49086f,null))[_0x48e3('0x1f')](removeEntity(_0x49086f,null))[_0x48e3('0x42')](handleError(_0x49086f,null));};exports['describe']=function(_0x58408b,_0x3a9f4a){return db['ChatWebsite'][_0x48e3('0x50')]()[_0x48e3('0x1f')](respondWithResult(_0x3a9f4a,null))[_0x48e3('0x42')](handleError(_0x3a9f4a,null));};exports['addDisposition']=function(_0x22a023,_0x2612df){if(_0x22a023[_0x48e3('0x48')]['id']){delete _0x22a023[_0x48e3('0x48')]['id'];}return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0x22a023['params']['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x2612df,null))[_0x48e3('0x1f')](function(_0x4ab2ff){if(_0x4ab2ff){_0x22a023[_0x48e3('0x48')][_0x48e3('0x51')]=_0x4ab2ff['id'];return db[_0x48e3('0x52')][_0x48e3('0x47')](_0x22a023[_0x48e3('0x48')]);}})[_0x48e3('0x1f')](respondWithResult(_0x2612df,null))[_0x48e3('0x42')](handleError(_0x2612df,null));};exports[_0x48e3('0x53')]=function(_0x16b06d,_0x360d85){var _0x1dd31={'raw':![],'where':{}};var _0x2d520b={};var _0x1cd553={'count':0x0,'rows':[]};return db[_0x48e3('0x27')][_0x48e3('0x54')]({'where':{'id':_0x16b06d[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x360d85,null))[_0x48e3('0x1f')](function(_0x36f191){if(_0x36f191){_0x2d520b[_0x48e3('0x2c')]=_[_0x48e3('0x2e')](db[_0x48e3('0x52')][_0x48e3('0x28')]);_0x2d520b[_0x48e3('0x2d')]=_[_0x48e3('0x2e')](_0x16b06d[_0x48e3('0x2d')]);_0x2d520b['filters']=_[_0x48e3('0x30')](_0x2d520b[_0x48e3('0x2c')],_0x2d520b[_0x48e3('0x2d')]);_0x1dd31[_0x48e3('0x32')]=_[_0x48e3('0x30')](_0x2d520b[_0x48e3('0x2c')],qs[_0x48e3('0x31')](_0x16b06d[_0x48e3('0x2d')]['fields']));_0x1dd31[_0x48e3('0x32')]=_0x1dd31[_0x48e3('0x32')][_0x48e3('0x33')]?_0x1dd31[_0x48e3('0x32')]:_0x2d520b[_0x48e3('0x2c')];if(!_0x16b06d[_0x48e3('0x2d')][_0x48e3('0x34')]('nolimit')){_0x1dd31['limit']=qs[_0x48e3('0x36')](_0x16b06d[_0x48e3('0x2d')][_0x48e3('0x36')]);_0x1dd31[_0x48e3('0x1b')]=qs[_0x48e3('0x1b')](_0x16b06d[_0x48e3('0x2d')][_0x48e3('0x1b')]);}_0x1dd31['order']=qs[_0x48e3('0x38')](_0x16b06d['query'][_0x48e3('0x38')]);_0x1dd31['where']=qs[_0x48e3('0x2f')](_[_0x48e3('0x39')](_0x16b06d[_0x48e3('0x2d')],_0x2d520b[_0x48e3('0x2f')]));_0x1dd31[_0x48e3('0x3e')][_0x48e3('0x51')]=_0x36f191['id'];if(_0x16b06d[_0x48e3('0x2d')][_0x48e3('0x3a')]){_0x1dd31['where']=_[_0x48e3('0x3b')](_0x1dd31[_0x48e3('0x3e')],{'$or':_[_0x48e3('0x3c')](_0x1dd31[_0x48e3('0x32')],function(_0x24ba54){var _0x5cccd9={};_0x5cccd9[_0x24ba54]={'$like':'%'+_0x16b06d['query']['filter']+'%'};return _0x5cccd9;})});}_0x1dd31=_[_0x48e3('0x3b')]({},_0x1dd31,_0x16b06d['options']);return db[_0x48e3('0x52')][_0x48e3('0x1d')]({'where':_0x1dd31['where']})['then'](function(_0x111043){_0x1cd553[_0x48e3('0x1d')]=_0x111043;if(_0x16b06d[_0x48e3('0x2d')][_0x48e3('0x3f')]){_0x1dd31[_0x48e3('0x40')]=[{'all':!![]}];}return db[_0x48e3('0x52')][_0x48e3('0x41')](_0x1dd31);})[_0x48e3('0x1f')](function(_0x5f153f){_0x1cd553[_0x48e3('0x55')]=_0x5f153f;return _0x1cd553;});}})['then'](respondWithFilteredResult(_0x360d85,_0x1dd31))[_0x48e3('0x42')](handleError(_0x360d85,null));};exports['removeDispositions']=function(_0x476c66,_0x48397b){return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0x476c66[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x48397b,null))[_0x48e3('0x1f')](function(_0x53d7b7){if(_0x53d7b7){return _0x53d7b7[_0x48e3('0x56')](_0x476c66['query'][_0x48e3('0x57')]);}})[_0x48e3('0x1f')](respondWithStatusCode(_0x48397b,null))[_0x48e3('0x42')](handleError(_0x48397b,null));};exports[_0x48e3('0x58')]=function(_0xfd1d02,_0x11890f){if(_0xfd1d02[_0x48e3('0x48')]['id']){delete _0xfd1d02[_0x48e3('0x48')]['id'];}return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0xfd1d02['params']['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x11890f,null))[_0x48e3('0x1f')](function(_0x5baab4){if(_0x5baab4){_0xfd1d02[_0x48e3('0x48')][_0x48e3('0x51')]=_0x5baab4['id'];return db[_0x48e3('0x59')]['create'](_0xfd1d02[_0x48e3('0x48')]);}})['then'](respondWithResult(_0x11890f,null))['catch'](handleError(_0x11890f,null));};exports[_0x48e3('0x5a')]=function(_0x497384,_0x12aa85){var _0x40e16b={'raw':![],'where':{}};var _0x5f0ec6={};var _0x35fa8f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x48e3('0x54')]({'where':{'id':_0x497384[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x12aa85,null))['then'](function(_0x28d680){if(_0x28d680){_0x5f0ec6[_0x48e3('0x2c')]=_[_0x48e3('0x2e')](db[_0x48e3('0x59')][_0x48e3('0x28')]);_0x5f0ec6['query']=_[_0x48e3('0x2e')](_0x497384[_0x48e3('0x2d')]);_0x5f0ec6[_0x48e3('0x2f')]=_[_0x48e3('0x30')](_0x5f0ec6[_0x48e3('0x2c')],_0x5f0ec6['query']);_0x40e16b[_0x48e3('0x32')]=_[_0x48e3('0x30')](_0x5f0ec6[_0x48e3('0x2c')],qs['fields'](_0x497384[_0x48e3('0x2d')]['fields']));_0x40e16b[_0x48e3('0x32')]=_0x40e16b[_0x48e3('0x32')][_0x48e3('0x33')]?_0x40e16b['attributes']:_0x5f0ec6[_0x48e3('0x2c')];if(!_0x497384[_0x48e3('0x2d')][_0x48e3('0x34')](_0x48e3('0x35'))){_0x40e16b[_0x48e3('0x36')]=qs[_0x48e3('0x36')](_0x497384['query'][_0x48e3('0x36')]);_0x40e16b['offset']=qs[_0x48e3('0x1b')](_0x497384['query']['offset']);}_0x40e16b[_0x48e3('0x37')]=qs['sort'](_0x497384[_0x48e3('0x2d')][_0x48e3('0x38')]);_0x40e16b[_0x48e3('0x3e')]=qs[_0x48e3('0x2f')](_['pick'](_0x497384['query'],_0x5f0ec6[_0x48e3('0x2f')]));_0x40e16b[_0x48e3('0x3e')]['ChatWebsiteId']=_0x28d680['id'];if(_0x497384[_0x48e3('0x2d')][_0x48e3('0x3a')]){_0x40e16b[_0x48e3('0x3e')]=_['merge'](_0x40e16b['where'],{'$or':_[_0x48e3('0x3c')](_0x40e16b['attributes'],function(_0x55527e){var _0x44537d={};_0x44537d[_0x55527e]={'$like':'%'+_0x497384[_0x48e3('0x2d')][_0x48e3('0x3a')]+'%'};return _0x44537d;})});}_0x40e16b=_[_0x48e3('0x3b')]({},_0x40e16b,_0x497384[_0x48e3('0x45')]);return db['CannedAnswer'][_0x48e3('0x1d')]({'where':_0x40e16b[_0x48e3('0x3e')]})[_0x48e3('0x1f')](function(_0x15263a){_0x35fa8f[_0x48e3('0x1d')]=_0x15263a;if(_0x497384['query'][_0x48e3('0x3f')]){_0x40e16b[_0x48e3('0x40')]=[{'all':!![]}];}return db[_0x48e3('0x59')][_0x48e3('0x41')](_0x40e16b);})[_0x48e3('0x1f')](function(_0x5f288e){_0x35fa8f[_0x48e3('0x55')]=_0x5f288e;return _0x35fa8f;});}})[_0x48e3('0x1f')](respondWithFilteredResult(_0x12aa85,_0x40e16b))[_0x48e3('0x42')](handleError(_0x12aa85,null));};exports[_0x48e3('0x5b')]=function(_0x1af9b7,_0x87b085){return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0x1af9b7[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x87b085,null))[_0x48e3('0x1f')](function(_0x2dec3f){if(_0x2dec3f){return _0x2dec3f['removeAnswers'](_0x1af9b7[_0x48e3('0x2d')][_0x48e3('0x57')]);}})[_0x48e3('0x1f')](respondWithStatusCode(_0x87b085,null))['catch'](handleError(_0x87b085,null));};exports[_0x48e3('0x5c')]=function(_0x41dfc7,_0x1e47ff){_0x41dfc7[_0x48e3('0x48')][_0x48e3('0x5d')]=_0x41dfc7[_0x48e3('0x5e')][_0x48e3('0x5f')];return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0x41dfc7['params']['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x1e47ff,null))[_0x48e3('0x1f')](saveUpdates(_0x41dfc7[_0x48e3('0x48')],null))[_0x48e3('0x1f')](respondWithResult(_0x1e47ff,null))['catch'](handleError(_0x1e47ff,null));};exports[_0x48e3('0x60')]=function(_0x494c3b,_0x397a41){_0x494c3b[_0x48e3('0x48')][_0x48e3('0x61')]=_0x494c3b[_0x48e3('0x5e')][_0x48e3('0x5f')];return db[_0x48e3('0x27')]['find']({'where':{'id':_0x494c3b[_0x48e3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x397a41,null))['then'](saveUpdates(_0x494c3b['body'],null))[_0x48e3('0x1f')](respondWithResult(_0x397a41,null))[_0x48e3('0x42')](handleError(_0x397a41,null));};exports[_0x48e3('0x62')]=function(_0x490dcd,_0x19848c){_0x490dcd['body'][_0x48e3('0x63')]=_0x490dcd['file'][_0x48e3('0x5f')];return db['ChatWebsite'][_0x48e3('0x46')]({'where':{'id':_0x490dcd[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x19848c,null))[_0x48e3('0x1f')](saveUpdates(_0x490dcd[_0x48e3('0x48')],null))[_0x48e3('0x1f')](respondWithResult(_0x19848c,null))[_0x48e3('0x42')](handleError(_0x19848c,null));};exports[_0x48e3('0x64')]=function(_0x5b2499,_0x3d76ef){_0x5b2499[_0x48e3('0x48')][_0x48e3('0x65')]=_0x5b2499[_0x48e3('0x5e')]['filename'];return db['ChatWebsite'][_0x48e3('0x46')]({'where':{'id':_0x5b2499[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x3d76ef,null))[_0x48e3('0x1f')](saveUpdates(_0x5b2499['body'],null))[_0x48e3('0x1f')](respondWithResult(_0x3d76ef,null))[_0x48e3('0x42')](handleError(_0x3d76ef,null));};exports['getLogo']=function(_0x5f1faf,_0x403990){var _0x2298f9=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x20a9a3={'where':{'id':_0x5f1faf[_0x48e3('0x4f')]['id']},'attributes':['id',_0x48e3('0x5d')],'raw':!![]};var _0xc12fcd=![];return require(_0x48e3('0x66'))['getLicense']()[_0x48e3('0x1f')](function(_0x9196f2){if(_0x9196f2){_0xc12fcd=_0x9196f2[_0x48e3('0x67')];}})[_0x48e3('0x1f')](function(){return db[_0x48e3('0x27')][_0x48e3('0x46')](_0x20a9a3);})['then'](handleEntityNotFound(_0x403990,null))['then'](function(_0x2f0c48){if(_0x2f0c48){if(!_[_0x48e3('0x68')](_0x2f0c48[_0x48e3('0x5d')])){if(fs[_0x48e3('0x69')](path[_0x48e3('0x6a')](config[_0x48e3('0x6b')],_0x48e3('0x6c'),_0x2f0c48['sitepic']))&&_0xc12fcd){_0x2298f9=path['join'](config[_0x48e3('0x6b')],_0x48e3('0x6c'),_0x2f0c48[_0x48e3('0x5d')]);}}return _0x403990['download'](_0x2298f9);}})['catch'](handleError(_0x403990,null));};exports[_0x48e3('0x6d')]=function(_0x1dd6e8,_0x5b40f6){var _0x1214ec=path[_0x48e3('0x6a')](config['root'],_0x48e3('0x6e'));var _0x557003={'where':{'id':_0x1dd6e8[_0x48e3('0x4f')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x48e3('0x46')](_0x557003)[_0x48e3('0x1f')](handleEntityNotFound(_0x5b40f6,null))[_0x48e3('0x1f')](function(_0x253dd2){if(_0x253dd2){if(!_[_0x48e3('0x68')](_0x253dd2['agentAvatar'])){if(fs[_0x48e3('0x69')](path[_0x48e3('0x6a')](config[_0x48e3('0x6b')],_0x48e3('0x6f'),_0x253dd2[_0x48e3('0x61')]))){_0x1214ec=path[_0x48e3('0x6a')](config[_0x48e3('0x6b')],_0x48e3('0x6f'),_0x253dd2[_0x48e3('0x61')]);}}return _0x5b40f6[_0x48e3('0x70')](_0x1214ec);}})[_0x48e3('0x42')](handleError(_0x5b40f6,null));};exports['getCustomerAvatar']=function(_0x21ba4e,_0xca8659){var _0xcd3b84=path[_0x48e3('0x6a')](config[_0x48e3('0x6b')],'server/files/images/avatars/customer_avatar.png');var _0x194b52={'where':{'id':_0x21ba4e[_0x48e3('0x4f')]['id']},'attributes':['id','customerAvatar',_0x48e3('0x71')],'raw':!![]};return db[_0x48e3('0x27')][_0x48e3('0x46')](_0x194b52)[_0x48e3('0x1f')](handleEntityNotFound(_0xca8659,null))[_0x48e3('0x1f')](function(_0x56c658){if(_0x56c658){if(!_[_0x48e3('0x68')](_0x56c658['customerAvatar'])){if(fs[_0x48e3('0x69')](path['join'](config[_0x48e3('0x6b')],_0x48e3('0x6f'),_0x56c658['customerAvatar']))&&_0x56c658[_0x48e3('0x71')]){_0xcd3b84=path[_0x48e3('0x6a')](config['root'],_0x48e3('0x6f'),_0x56c658[_0x48e3('0x63')]);}}return _0xca8659[_0x48e3('0x70')](_0xcd3b84);}})[_0x48e3('0x42')](handleError(_0xca8659,null));};exports[_0x48e3('0x72')]=function(_0x180235,_0x388217){var _0x1e0926=path[_0x48e3('0x6a')](config[_0x48e3('0x6b')],'server/files/images/avatars/system_avatar.png');var _0x13036f={'where':{'id':_0x180235[_0x48e3('0x4f')]['id']},'attributes':['id',_0x48e3('0x65')],'raw':!![]};return db[_0x48e3('0x27')][_0x48e3('0x46')](_0x13036f)[_0x48e3('0x1f')](handleEntityNotFound(_0x388217,null))['then'](function(_0x33a445){if(_0x33a445){if(!_[_0x48e3('0x68')](_0x33a445[_0x48e3('0x65')])){if(fs['existsSync'](path['join'](config[_0x48e3('0x6b')],_0x48e3('0x6f'),_0x33a445['systemAvatar']))){_0x1e0926=path[_0x48e3('0x6a')](config[_0x48e3('0x6b')],_0x48e3('0x6f'),_0x33a445['systemAvatar']);}}return _0x388217[_0x48e3('0x70')](_0x1e0926);}})['catch'](handleError(_0x388217,null));};exports['notify']=function(_0x2d9138,_0x5dd215){var _0x49e5aa=require(_0x48e3('0x73'));var _0x1e5c2e=new _0x49e5aa();var _0x4fad9e=_0x1e5c2e[_0x48e3('0x74')](_0x2d9138[_0x48e3('0x75')]['user-agent'])['getResult']();var _0x27bcf0={'body':_0x2d9138[_0x48e3('0x48')],'channel':_0x48e3('0x76')};var _0x101e7a=[];var _0x47c288=[];var _0x152740={};var _0x1c4115=![];return db[_0x48e3('0x77')]['describe']()['then'](function(_0x1655a8){if(!_0x1655a8){throw new db[(_0x48e3('0x78'))][(_0x48e3('0x79'))]('no\x20available\x20attributes');}_0x101e7a=_['difference'](_['keys'](_0x1655a8),[_0x48e3('0x7a'),_0x48e3('0x7b')]);_0x47c288=_[_0x48e3('0x7c')](_['keys'](_0x1655a8),['createdAt','updatedAt',_0x48e3('0x7d'),_0x48e3('0x7e')]);if(_0x2d9138[_0x48e3('0x48')]['id']){delete _0x2d9138[_0x48e3('0x48')]['id'];}if(_['isNil'](_0x2d9138[_0x48e3('0x48')]['from'])){throw new db[(_0x48e3('0x78'))][(_0x48e3('0x79'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2d9138['body']['body'])||_0x2d9138[_0x48e3('0x48')][_0x48e3('0x48')]===''){throw new db[(_0x48e3('0x78'))][(_0x48e3('0x79'))](_0x48e3('0x7f'));}if(_[_0x48e3('0x68')](_0x2d9138['body'][_0x48e3('0x80')])){throw new db[(_0x48e3('0x78'))][(_0x48e3('0x79'))](_0x48e3('0x81')+_0x47c288);}if(!_[_0x48e3('0x82')](_0x47c288,_0x2d9138['body'][_0x48e3('0x80')])){throw new db['Sequelize'][(_0x48e3('0x79'))](_0x48e3('0x83')+_0x47c288);}_0x152740[_0x2d9138[_0x48e3('0x48')][_0x48e3('0x80')]]=_0x2d9138[_0x48e3('0x48')]['from'];})[_0x48e3('0x1f')](function(){return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0x2d9138[_0x48e3('0x4f')]['id']},'include':[{'model':db['CmList'],'as':_0x48e3('0x84'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x152740,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x48e3('0x85')],'as':'Applications'}]});})[_0x48e3('0x1f')](handleEntityNotFound(_0x5dd215,null))[_0x48e3('0x1f')](function(_0x41429f){if(_0x41429f&&_0x41429f[_0x48e3('0x84')]){_0x27bcf0[_0x48e3('0x86')]=_0x41429f;_0x27bcf0[_0x48e3('0x87')]=_0x41429f['Applications'];_0x27bcf0[_0x48e3('0x88')]=_0x41429f[_0x48e3('0x84')];_0x27bcf0[_0x48e3('0x87')]=_[_0x48e3('0x89')](_0x27bcf0['applications'],[_0x48e3('0x8a')],[_0x48e3('0x8b')]);if(_0x27bcf0[_0x48e3('0x86')][_0x48e3('0x8c')]){delete _0x27bcf0[_0x48e3('0x86')]['Applications'];}if(_0x27bcf0[_0x48e3('0x86')][_0x48e3('0x84')]&&_0x27bcf0[_0x48e3('0x86')][_0x48e3('0x84')]['Contacts']['length']){return _0x27bcf0[_0x48e3('0x86')]['List'][_0x48e3('0x8d')][0x0];}var _0xf3a7af=_[_0x48e3('0xa')](_0x2d9138[_0x48e3('0x48')],{'firstName':_0x2d9138[_0x48e3('0x48')]['from'],'ListId':_0x41429f['ListId']});_0xf3a7af[_0x2d9138[_0x48e3('0x48')][_0x48e3('0x80')]]=_0x2d9138[_0x48e3('0x48')]['from'];return db['CmContact']['create'](_0xf3a7af,{'fields':_0x101e7a,'raw':!![]});}})['then'](handleEntityNotFound(_0x5dd215,null))[_0x48e3('0x1f')](function(_0x54ddac){_0x27bcf0[_0x48e3('0x8e')]=_0x54ddac;var _0x3da491=_0x2d9138[_0x48e3('0x48')][_0x48e3('0x8f')];if(_0x2d9138[_0x48e3('0x75')][_0x48e3('0x90')]){_0x3da491=_0x2d9138[_0x48e3('0x75')][_0x48e3('0x90')];}else if(_0x2d9138[_0x48e3('0x75')]['x-forwarded-for']){_0x3da491=_['first'](_0x2d9138[_0x48e3('0x75')][_0x48e3('0x91')]['split'](','));}if(_0x54ddac){var _0xa279a={'ContactId':_0x54ddac['id'],'ChatWebsiteId':_0x2d9138[_0x48e3('0x4f')]['id'],'from':(_0x54ddac['firstName']||'')+'\x20'+(_0x54ddac[_0x48e3('0x92')]||''),'customerIp':_0x3da491,'customerPort':_0x2d9138[_0x48e3('0x75')][_0x48e3('0x93')]?_0x2d9138[_0x48e3('0x75')]['x-real-port']:null,'referer':_0x2d9138[_0x48e3('0x48')][_0x48e3('0x94')],'browserName':_0x4fad9e[_0x48e3('0x95')][_0x48e3('0x25')]&&_0x4fad9e[_0x48e3('0x95')][_0x48e3('0x96')]?util[_0x48e3('0x97')](_0x48e3('0x98'),_0x4fad9e['browser'][_0x48e3('0x25')],_0x4fad9e[_0x48e3('0x95')][_0x48e3('0x96')]):_0x48e3('0x99'),'browserVersion':_0x4fad9e[_0x48e3('0x95')]['version']||_0x48e3('0x99'),'osName':util['format']('%s\x20%s',_0x4fad9e['os']['name'],_0x4fad9e['os'][_0x48e3('0x96')]),'osVersion':_0x4fad9e['os'][_0x48e3('0x96')],'deviceModel':_0x4fad9e[_0x48e3('0x9a')][_0x48e3('0x2c')]&&_0x4fad9e[_0x48e3('0x9a')]['vendor']?util[_0x48e3('0x97')](_0x48e3('0x9b'),_0x4fad9e[_0x48e3('0x9a')][_0x48e3('0x2c')],_0x4fad9e[_0x48e3('0x9a')][_0x48e3('0x9c')],_0x4fad9e['device'][_0x48e3('0x2a')]):null,'deviceVendor':_0x4fad9e[_0x48e3('0x9a')][_0x48e3('0x9c')],'deviceType':_0x4fad9e[_0x48e3('0x9a')][_0x48e3('0x2a')],'formData':JSON['stringify'](_0x2d9138['body'])};var _0x4a44ec={'ChatWebsiteId':_0x2d9138[_0x48e3('0x4f')]['id'],'closed':![]};if(_0x2d9138['body'][_0x48e3('0x9d')]){_0x4a44ec[_0x48e3('0x9d')]=_0x2d9138[_0x48e3('0x48')][_0x48e3('0x9d')];return db[_0x48e3('0x9e')][_0x48e3('0x46')]({'where':_0x4a44ec})[_0x48e3('0x1f')](function(_0x5c7751){if(_0x5c7751){return[_0x5c7751,![]];}_0xa279a['threadId']=_0x2d9138[_0x48e3('0x48')]['threadId'];_0xa279a['externalUrl']=_0x2d9138[_0x48e3('0x48')]['externalUrl'];return db[_0x48e3('0x9e')][_0x48e3('0x47')](_0xa279a)[_0x48e3('0x1f')](function(_0x243afa){return[_0x243afa,!![]];});});}_0x4a44ec[_0x48e3('0x9f')]=_0x54ddac['id'];if(_0x2d9138[_0x48e3('0x48')]['interaction']&&_0x2d9138[_0x48e3('0x48')][_0x48e3('0xa0')]['id']){_0x4a44ec['id']=_0x2d9138[_0x48e3('0x48')]['interaction']['id'];return db[_0x48e3('0x9e')][_0x48e3('0x46')]({'where':_0x4a44ec})[_0x48e3('0x1f')](function(_0x3609b5){if(_0x3609b5){return[_0x3609b5,![]];}return db[_0x48e3('0x9e')][_0x48e3('0x47')](_0xa279a)[_0x48e3('0x1f')](function(_0x5a4454){return[_0x5a4454,!![]];});});}return db[_0x48e3('0x9e')][_0x48e3('0x47')](_0xa279a)[_0x48e3('0x1f')](function(_0x4e99d8){return[_0x4e99d8,!![]];});}})[_0x48e3('0xa1')](function(_0x2a1a56,_0x5d9256){if(_0x2a1a56){_0x1c4115=_0x5d9256;if(!_0x5d9256){var _0x5422fc={'from':(_0x27bcf0[_0x48e3('0x8e')][_0x48e3('0xa2')]||'')+'\x20'+(_0x27bcf0[_0x48e3('0x8e')]['lastName']||'')};if(_0x2d9138['body'][_0x48e3('0x9d')]&&_0x2d9138['body'][_0x48e3('0xa3')]&&_0x2d9138[_0x48e3('0x48')][_0x48e3('0x9d')]!=_0x2d9138[_0x48e3('0x48')][_0x48e3('0xa3')]){_0x5422fc['threadId']=_0x2d9138[_0x48e3('0x48')][_0x48e3('0xa3')];}return _0x2a1a56[_0x48e3('0x4e')](_0x5422fc);}else{return _0x2a1a56;}}})[_0x48e3('0x1f')](function(_0x5972ce){_0x27bcf0['interaction']=_0x5972ce[_0x48e3('0x21')]({'plain':!![]});_0x27bcf0[_0x48e3('0xa0')][_0x48e3('0xa4')]=_0x1c4115;if(_0x27bcf0[_0x48e3('0xa0')][_0x48e3('0xa4')]){if(_0x27bcf0['account'][_0x48e3('0xa5')]){_0x27bcf0['applications'][_0x48e3('0xa6')]({'id':0x0,'priority':_0x27bcf0[_0x48e3('0x87')][_0x48e3('0x33')]+0x1,'app':_0x48e3('0xa7'),'appdata':_0x48e3('0xa8'),'interval':_0x48e3('0xa9')});}}return db[_0x48e3('0xaa')][_0x48e3('0x47')]({'body':_0x2d9138[_0x48e3('0x48')][_0x48e3('0x48')],'ChatWebsiteId':_0x2d9138['params']['id'],'ChatInteractionId':_0x5972ce['id'],'direction':'in','ContactId':_0x27bcf0[_0x48e3('0x8e')]['id'],'AttachmentId':_0x2d9138['body'][_0x48e3('0xab')]});})[_0x48e3('0x1f')](function(_0x38396b){_0x27bcf0[_0x48e3('0x16')]=_0x38396b;if(_0x27bcf0[_0x48e3('0xa0')][_0x48e3('0xac')]){return db[_0x48e3('0xad')][_0x48e3('0x46')]({'attributes':['id','name'],'where':{'id':_0x27bcf0[_0x48e3('0xa0')]['UserId']}})[_0x48e3('0x1f')](function(_0x3a311c){if(_0x3a311c){_0x27bcf0['applications'][_0x48e3('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3a311c[_0x48e3('0x25')]+','+(_0x27bcf0['account'][_0x48e3('0xaf')]||0xa),'interval':_0x48e3('0xa9')});_0x27bcf0[_0x48e3('0xb0')]=!![];}return respondWithRpcPromise('Start',_0x48e3('0xb1'),_0x27bcf0);});}return respondWithRpcPromise(_0x48e3('0xb2'),_0x48e3('0xb1'),_0x27bcf0);})['then'](function(_0x2d5def){respondWithRpcPromise(_0x48e3('0xb3'),_0x48e3('0xb3'),{'event':_0x48e3('0xb4'),'message':_0x2d5def},client9002);return _0x2d5def;})[_0x48e3('0x1f')](respondWithResult(_0x5dd215,null))[_0x48e3('0x42')](handleError(_0x5dd215,null));};exports[_0x48e3('0xb5')]=function(_0x4bd524,_0xaf4fa4){var _0x5d9268,_0x555077,_0x230770;var _0x406b8a=[];var _0x52349a={};var _0x5ab192=_0x4bd524[_0x48e3('0xb6')]||[];var _0x9b69fa=[];var _0x5e8e99;return db[_0x48e3('0x77')]['describe']()['then'](function(_0x57bf57){if(!_0x57bf57){throw new db[(_0x48e3('0x78'))][(_0x48e3('0x79'))](_0x48e3('0xb7'));}_0x406b8a=_[_0x48e3('0x7c')](_[_0x48e3('0x2e')](_0x57bf57),[_0x48e3('0x7a'),'updatedAt',_0x48e3('0x7d'),_0x48e3('0x7e')]);if(_0x4bd524[_0x48e3('0x48')]['id']){delete _0x4bd524[_0x48e3('0x48')]['id'];}if(_[_0x48e3('0x68')](_0x4bd524[_0x48e3('0x48')]['from'])){throw _0xaf4fa4['status'](0x1f4)['send'](new db[(_0x48e3('0x78'))][(_0x48e3('0x79'))](_0x48e3('0xb8')));}if(_[_0x48e3('0x68')](_0x4bd524['body']['body'])||_0x4bd524[_0x48e3('0x48')][_0x48e3('0x48')]===''){throw _0xaf4fa4[_0x48e3('0x19')](0x1f4)[_0x48e3('0xb9')](new db[(_0x48e3('0x78'))][(_0x48e3('0x79'))](_0x48e3('0x7f')));}if(_[_0x48e3('0x68')](_0x4bd524[_0x48e3('0x48')]['mapKeyOffline'])){throw _0xaf4fa4[_0x48e3('0x19')](0x1f4)[_0x48e3('0xb9')](new db[(_0x48e3('0x78'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x406b8a));}if(!_[_0x48e3('0x82')](_0x406b8a,_0x4bd524[_0x48e3('0x48')]['mapKeyOffline'])){throw _0xaf4fa4[_0x48e3('0x19')](0x1f4)[_0x48e3('0xb9')](new db[(_0x48e3('0x78'))][(_0x48e3('0x79'))](_0x48e3('0xba')+_0x406b8a));}_0x52349a[_0x4bd524[_0x48e3('0x48')][_0x48e3('0xbb')]]=_0x4bd524['body'][_0x48e3('0xbc')];})[_0x48e3('0x1f')](function(){return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0x4bd524[_0x48e3('0x4f')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x48e3('0xbd')],'as':_0x48e3('0xbd')}]});})[_0x48e3('0x1f')](handleEntityNotFound(_0xaf4fa4,null))[_0x48e3('0x1f')](function(_0x30a854){if(_0x30a854&&_0x30a854['List']){_0x555077=_0x30a854;var _0x5f1e29=_[_0x48e3('0xa')](_0x4bd524[_0x48e3('0x48')],{'firstName':_0x4bd524['body']['from'],'phone':_0x4bd524[_0x48e3('0x48')]['from'],'ListId':_0x30a854[_0x48e3('0x7e')]});_0x5f1e29[_0x4bd524[_0x48e3('0x48')][_0x48e3('0xbb')]]=_0x4bd524['body'][_0x48e3('0xbc')];return db['CmContact'][_0x48e3('0xbe')]({'where':_0x52349a,'defaults':_0x5f1e29});}})[_0x48e3('0xa1')](function(_0x36185f){if(_0x36185f){_0x230770=_0x36185f;var _0xe7c29c=fs['readFileSync'](path[_0x48e3('0x6a')](config[_0x48e3('0x6b')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x1fdeba=ejs[_0x48e3('0xbf')](_0xe7c29c,{'body':_['toPairs'](_0x4bd524[_0x48e3('0x48')][_0x48e3('0x48')]),'bodyTitle':_0x555077['offlineMessageBody']});return db[_0x48e3('0xc0')][_0x48e3('0x47')]({'body':_0x1fdeba,'plainBody':htmlToText['fromString'](_0x1fdeba),'ContactId':_0x36185f['id'],'ChatWebsiteId':_0x555077['id']});}})['then'](function(_0x2ee07d){_0x5e8e99=_0x2ee07d;if(_0x5ab192[_0x48e3('0x33')]){var _0xdabd49=_0x5ab192[_0x48e3('0x3c')](function(_0x2bae2b){return{'name':_0x2bae2b[_0x48e3('0xc1')],'basename':_0x2bae2b[_0x48e3('0x5f')],'type':_0x2bae2b['mimetype'],'ChatOfflineMessageId':_0x2ee07d['id']};});_0x9b69fa=_0xdabd49[_0x48e3('0x3c')](_0x48e8a6=>{var _0x160243={'filename':_0x48e8a6[_0x48e3('0x25')],'path':path['join'](config[_0x48e3('0x6b')],_0x48e3('0xc2'),'files',_0x48e3('0xc3'),'offline-chat',_0x48e8a6['basename'])};return _0x160243;});if(!_0x555077['openNewInteraction']){return db[_0x48e3('0xc4')][_0x48e3('0xc5')](function(_0x151644){return db[_0x48e3('0xc6')][_0x48e3('0xc7')](_0xdabd49,{'transaction':_0x151644});});}}})[_0x48e3('0x1f')](function(){if(_0x5e8e99){_0x5d9268=_0x5e8e99;return db[_0x48e3('0xbd')][_0x48e3('0x54')]({'where':{'service':!![]},'include':[{'model':db[_0x48e3('0xc8')],'as':_0x48e3('0xc9'),'raw':!![],'include':[{'model':db[_0x48e3('0xca')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x48e3('0x1f')](function(_0x50cd5f){if(_0x50cd5f&&_0x50cd5f[_0x48e3('0xc9')]&&_0x555077['forwardOffline']&&_0x555077[_0x48e3('0xcb')]){var _0x44ab3a=_0x50cd5f[_0x48e3('0xcc')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x44ab3a,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x50cd5f[_0x48e3('0x25')],_0x50cd5f[_0x48e3('0xcd')]||_0x50cd5f[_0x48e3('0xc9')][_0x48e3('0x49')]),'to':_0x555077[_0x48e3('0xcb')],'subject':_0x555077[_0x48e3('0xce')],'html':_0x5d9268[_0x48e3('0x48')],'attachments':_0x9b69fa}},client9003)[_0x48e3('0x1f')](function(){return _0x5d9268;})[_0x48e3('0x42')](function(_0x4fe9f7){logger[_0x48e3('0x15')](_0x4fe9f7);});}})[_0x48e3('0x1f')](function(){if(_0x555077&&_0x555077[_0x48e3('0xcf')]&&_0x555077[_0x48e3('0xd0')]){var _0x2d7c50=[];if(_0x5ab192['length']){_0x2d7c50=_0x5ab192['map'](function(_0x132de0){return{'name':_0x132de0[_0x48e3('0xc1')],'basename':_0x132de0[_0x48e3('0x5f')],'type':_0x132de0[_0x48e3('0xd1')],'ChatOfflineMessageId':_0x5e8e99['id']};});}var _0x804fce;if(!_[_0x48e3('0x68')](_0x555077[_0x48e3('0xd2')])){var _0x5dfde3=_[_0x48e3('0x3c')](_0x4bd524['body'],function(_0x18962f){return _0x18962f;});var _0x4807e0=_['toPairsIn'](_0x5dfde3)[0x0];var _0x269332=_[_0x48e3('0xd3')](_0x4807e0,function(_0x3056cf){return _0x3056cf;});_0x804fce=_0x269332[0x1][_0x555077['subjectOffline']];}var _0x4c9c16={'from':_0x230770[_0x48e3('0xcd')],'firstName':_0x230770['firstName'],'lastName':_0x230770[_0x48e3('0x92')],'mapKey':_0x48e3('0xcd'),'message':{'from':_0x230770[_0x48e3('0xcd')],'to':_0x555077[_0x48e3('0xbd')][_0x48e3('0xcd')],'cc':'','subject':_[_0x48e3('0x68')](_0x804fce)?_0x555077['offlineMessageSubject']:_0x804fce,'messageId':'','sentAt':new Date(),'attach':_0x2d7c50[_0x48e3('0x33')],'attachments':_0x2d7c50,'originChannel':_0x48e3('0xd4'),'ChatWebsiteId':_0x555077['id'],'ChatOfflineMessageId':_0x5d9268['id'],'originTo':_0x555077['MailAccount']['email']},'body':_0x5d9268[_0x48e3('0x48')]};var _0xb2e222={'account':{'id':_0x555077[_0x48e3('0xd0')]},'body':_0x4c9c16,'log':_0x48e3('0xd5')};return respondWithRpcPromise(_0x48e3('0xd5'),_0x48e3('0xd6'),_0xb2e222,client9001)['then'](function(){return _0x5d9268;})[_0x48e3('0x42')](function(_0x4dfc93){logger[_0x48e3('0x15')](_0x4dfc93);});}return;})[_0x48e3('0x1f')](function(){if(_0x5d9268){return _0x5d9268;}})[_0x48e3('0x1f')](respondWithResult(_0xaf4fa4,null))[_0x48e3('0x42')](function(_0x28acc3){logger['error'](_0x48e3('0x42'),_0x28acc3);for(var _0x16cc6d of _0x5ab192){var _0x11804c=path[_0x48e3('0x6a')](config[_0x48e3('0x6b')],_0x48e3('0xc2'),_0x48e3('0xb6'),'attachments',_0x48e3('0xd7'),_0x16cc6d[_0x48e3('0x5f')]);fs_extra[_0x48e3('0xd8')](_0x11804c)[_0x48e3('0x42')](function(_0x56b3c6){logger[_0x48e3('0x15')](_0x48e3('0xd9'),_0x11804c,_0x56b3c6);});}});};exports['addInteraction']=function(_0x20d9ae,_0x5423c3){return db[_0x48e3('0x9e')][_0x48e3('0x46')]({'where':{'id':_0x20d9ae[_0x48e3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5423c3,null))[_0x48e3('0x1f')](function(_0x4d02db){if(_0x4d02db){return _0x4d02db[_0x48e3('0xda')](_0x20d9ae['body'][_0x48e3('0x57')],_[_0x48e3('0xdb')](_0x20d9ae[_0x48e3('0x48')],[_0x48e3('0x57'),'id'])||{});}})['then'](respondWithResult(_0x5423c3,null))[_0x48e3('0x42')](handleError(_0x5423c3,null));};exports['getInteractions']=function(_0x13c3d8,_0x4c502d){var _0x3c22b5={'raw':![],'where':{}};var _0x494eac={};var _0x203882={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x48e3('0x54')]({'where':{'id':_0x13c3d8[_0x48e3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4c502d,null))[_0x48e3('0x1f')](function(_0xe3be79){if(_0xe3be79){_0x494eac[_0x48e3('0x2c')]=_[_0x48e3('0x2e')](db[_0x48e3('0x9e')][_0x48e3('0x28')]);_0x494eac[_0x48e3('0x2d')]=_[_0x48e3('0x2e')](_0x13c3d8[_0x48e3('0x2d')]);_0x494eac[_0x48e3('0x2f')]=_[_0x48e3('0x30')](_0x494eac[_0x48e3('0x2c')],_0x494eac[_0x48e3('0x2d')]);_0x3c22b5[_0x48e3('0x32')]=_['intersection'](_0x494eac[_0x48e3('0x2c')],qs['fields'](_0x13c3d8[_0x48e3('0x2d')][_0x48e3('0x31')]));_0x3c22b5[_0x48e3('0x32')]=_0x3c22b5[_0x48e3('0x32')][_0x48e3('0x33')]?_0x3c22b5[_0x48e3('0x32')]:_0x494eac[_0x48e3('0x2c')];if(!_0x13c3d8[_0x48e3('0x2d')][_0x48e3('0x34')]('nolimit')){_0x3c22b5[_0x48e3('0x36')]=qs['limit'](_0x13c3d8[_0x48e3('0x2d')][_0x48e3('0x36')]);_0x3c22b5[_0x48e3('0x1b')]=qs[_0x48e3('0x1b')](_0x13c3d8['query'][_0x48e3('0x1b')]);}_0x3c22b5[_0x48e3('0x37')]=qs[_0x48e3('0x38')](_0x13c3d8[_0x48e3('0x2d')]['sort']);_0x3c22b5[_0x48e3('0x3e')]=qs['filters'](_[_0x48e3('0x39')](_0x13c3d8[_0x48e3('0x2d')],_0x494eac['filters']));_0x3c22b5[_0x48e3('0x3e')]['ChatWebsiteId']=_0xe3be79['id'];if(_0x13c3d8[_0x48e3('0x2d')][_0x48e3('0x3a')]){_0x3c22b5[_0x48e3('0x3e')]=_[_0x48e3('0x3b')](_0x3c22b5[_0x48e3('0x3e')],{'$or':_[_0x48e3('0x3c')](_0x3c22b5['attributes'],function(_0x2cc93f){var _0x48a267={};_0x48a267[_0x2cc93f]={'$like':'%'+_0x13c3d8[_0x48e3('0x2d')]['filter']+'%'};return _0x48a267;})});}_0x3c22b5=_['merge']({},_0x3c22b5,_0x13c3d8[_0x48e3('0x45')]);return db[_0x48e3('0x9e')]['count']({'where':_0x3c22b5[_0x48e3('0x3e')]})['then'](function(_0xcbe458){_0x203882[_0x48e3('0x1d')]=_0xcbe458;if(_0x13c3d8['query'][_0x48e3('0x3f')]){_0x3c22b5[_0x48e3('0x40')]=[{'model':db[_0x48e3('0x77')],'as':_0x48e3('0xdc'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x48e3('0xdd'),'internal'],'required':![]},{'model':db[_0x48e3('0xde')],'as':_0x48e3('0xdf'),'attributes':['id',_0x48e3('0x25'),'color'],'where':_0x13c3d8[_0x48e3('0x2d')][_0x48e3('0xe0')]?{'id':_0x13c3d8[_0x48e3('0x2d')][_0x48e3('0xe0')]}:undefined,'required':_0x13c3d8[_0x48e3('0x2d')][_0x48e3('0xe0')]?!![]:![]}];}return db[_0x48e3('0x9e')][_0x48e3('0x41')](_0x3c22b5);})[_0x48e3('0x1f')](function(_0x41afb0){_0x203882[_0x48e3('0x55')]=_0x41afb0;return _0x203882;});}})[_0x48e3('0x1f')](respondWithFilteredResult(_0x4c502d,_0x3c22b5))[_0x48e3('0x42')](handleError(_0x4c502d,null));};function iftimePromise(_0xd98ba3,_0x1b46f0){return respondWithRpcPromise(_0x48e3('0xe1'),_0x48e3('0xe2'),{'command':_0x1b46f0[_0x48e3('0xe3')]?util[_0x48e3('0x97')](_0x48e3('0xe4'),_0xd98ba3['interval'],_0x1b46f0['timezone']):util[_0x48e3('0x97')](_0x48e3('0xe5'),_0xd98ba3[_0x48e3('0xe6')])},client9002)[_0x48e3('0x1f')](function(_0x2d3ede){var _0x20a276=_0x2d3ede&&_0x2d3ede[_0x48e3('0xe7')](_0x48e3('0xe8'))>=0x0?!![]:![];logger[_0x48e3('0x11')](_0x48e3('0xe9'),_0x1b46f0['id'],_0xd98ba3['id'],_0xd98ba3[_0x48e3('0xe6')],_0x20a276?_0x48e3('0xea'):_0x48e3('0xeb'),_0x1b46f0[_0x48e3('0xe3')]?_0x1b46f0[_0x48e3('0xe3')]:_0x48e3('0xec'));return _0x20a276;})['catch'](function(_0x2ef449){logger[_0x48e3('0x15')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1b46f0['id'],_0xd98ba3['id'],_0xd98ba3[_0x48e3('0xe6')],util[_0x48e3('0xed')](_0x2ef449,{'showHidden':![],'depth':null}),_0x1b46f0['timezone']?_0x1b46f0[_0x48e3('0xe3')]:_0x48e3('0xec'));return![];});}exports['getSnippet']=function(_0x34d732,_0x29b8cb){var _0x760d13=0x0;var _0x8a46a0=0x0;var _0x303351=![];var _0x67a852;var _0x157e3f;return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0x34d732[_0x48e3('0x4f')]['id']},'include':[{'model':db[_0x48e3('0xee')],'as':_0x48e3('0xee'),'include':[{'model':db[_0x48e3('0xee')],'as':'Intervals','attributes':['id',_0x48e3('0xe6')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x29b8cb,null))[_0x48e3('0x1f')](function(_0x1dba21){if(_0x1dba21){_0x67a852=_0x1dba21;return _0x1dba21[_0x48e3('0xef')]({'raw':!![]});}})[_0x48e3('0x1f')](function(_0x11dbbf){if(_0x67a852){if(_0x11dbbf){_0x157e3f=_0x11dbbf;}}return require(_0x48e3('0x66'))['getLicense']();})[_0x48e3('0x1f')](function(_0x50f58b){if(_0x50f58b){_0x8a46a0=_0x50f58b[_0x48e3('0xf0')];_0x303351=_0x50f58b[_0x48e3('0x67')];}})[_0x48e3('0x1f')](function(){return db[_0x48e3('0x9e')][_0x48e3('0x1d')]({'where':{'closed':![]}});})['then'](function(_0x249200){_0x760d13=_0x249200;if(_0x8a46a0&&_0x249200>_0x8a46a0){return db[_0x48e3('0xf1')]['findOne']({'where':{'id':0x1}})[_0x48e3('0x1f')](function(_0x192204){if(_0x192204){_0x192204[_0x48e3('0xf2')](_0x48e3('0xf3'));}});}})[_0x48e3('0x1f')](function(){if(_0x67a852[_0x48e3('0xee')]&&_0x67a852[_0x48e3('0xee')][_0x48e3('0xf4')]){var _0x55eb1d=[];for(var _0x21a121=0x0;_0x21a121<_0x67a852[_0x48e3('0xee')]['Intervals'][_0x48e3('0x33')];_0x21a121++){var _0x56a084=_0x67a852[_0x48e3('0xee')][_0x48e3('0xf4')][_0x21a121]['get']({'plain':!![]});_0x55eb1d[_0x48e3('0xa6')](iftimePromise(_0x56a084,_0x67a852));}return BPromise['all'](_0x55eb1d)['then'](function(_0x1bece2){return _[_0x48e3('0xf5')](_0x1bece2);});}else{return!![];}})[_0x48e3('0x1f')](function(_0x3a7dd1){var _0x51c84a=fs[_0x48e3('0xf6')](path['join'](config['root'],_0x48e3('0xf7')),_0x48e3('0xf8'));var _0x2654e3={'remote':_0x67a852[_0x48e3('0xf9')],'query':querystring['stringify'](_['merge'](_0x67a852[_0x48e3('0x21')]({'plain':!![]}),{'customerIp':_0x34d732[_0x48e3('0x75')][_0x48e3('0x91')]||_0x34d732[_0x48e3('0x75')][_0x48e3('0xfa')]||_0x34d732[_0x48e3('0xfb')][_0x48e3('0xfc')]||_0x34d732['ip'],'referer':_0x34d732[_0x48e3('0x75')]['referer'],'openedInteractions':_0x760d13,'maxInteractions':_0x8a46a0,'virtual':_0x303351[_0x48e3('0xf0')],'online':_0x3a7dd1,'custom':_0x303351}))[_0x48e3('0xfd')](/'/g,'\x5c\x27')};_0x29b8cb[_0x48e3('0xb9')](ejs[_0x48e3('0xbf')](Mustache['render'](_0x51c84a,_0x2654e3),{'proactiveActions':_0x157e3f,'alignment':_0x67a852['alignment'],'verticalAlignment':_0x67a852[_0x48e3('0xfe')],'div_color':_0x67a852[_0x48e3('0xff')],'labelText':_0x67a852[_0x48e3('0x100')],'text_color':_0x67a852[_0x48e3('0x101')],'text_button_color':_0x67a852[_0x48e3('0x102')],'button_color':_0x67a852['color_button'],'background_color':_0x67a852[_0x48e3('0x103')],'hideWhenOffline':_0x67a852['hideWhenOffline'],'interval':_0x67a852['IntervalId']}));})[_0x48e3('0x42')](handleError(_0x29b8cb,null));};exports[_0x48e3('0x104')]=function(_0x4c8a38,_0x4912d6){var _0x38560b=_0x4c8a38[_0x48e3('0x4f')]['id'];var _0x53faa9=_0x4c8a38['body'];var _0x1abc1d=0xc8;var _0x50b622=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x48e3('0xc4')][_0x48e3('0x105')]['ISOLATION_LEVELS'][_0x48e3('0x106')]},function(_0x2e03bc){return db[_0x48e3('0x27')]['findOne']({'where':{'id':_0x38560b},'transaction':_0x2e03bc})[_0x48e3('0x1f')](function(_0x19f325){if(_0x19f325){return db[_0x48e3('0x85')][_0x48e3('0x20')]({'where':{'ChatWebsiteId':_0x38560b},'transaction':_0x2e03bc})[_0x48e3('0x1f')](function(){var _0x16f046=_[_0x48e3('0x3c')](_0x53faa9,function(_0x7617df){_0x7617df[_0x48e3('0x51')]=_0x38560b;return _0x7617df;});return db['ChatApplication'][_0x48e3('0xc7')](_0x16f046,{'transaction':_0x2e03bc});});}else{_0x1abc1d=0x194;_0x50b622=[];}});})[_0x48e3('0x1f')](function(){if(_0x1abc1d!==0x194){return db[_0x48e3('0x85')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x38560b},'order':_0x48e3('0x8a')})['then'](function(_0x185ad0){_0x50b622=_0x185ad0;});}})['catch'](function(_0x3aac19){_0x1abc1d=0x1f4;logger[_0x48e3('0x15')](_0x3aac19['stack']);if(_0x3aac19[_0x48e3('0x25')]){delete _0x3aac19[_0x48e3('0x25')];}_0x50b622=_0x3aac19;})[_0x48e3('0x107')](function(){if(_0x50b622===null){_0x4912d6[_0x48e3('0x18')](_0x1abc1d);}else{if(_0x1abc1d===0x1f4){_0x4912d6[_0x48e3('0x19')](_0x1abc1d)['send'](_0x50b622);}else{_0x4912d6['status'](_0x1abc1d)['json'](_0x50b622);}}});};exports[_0x48e3('0x108')]=function(_0x12c2a7,_0x55c407){var _0x319f99={};var _0x4ef119={};var _0xf3442c;var _0x25a734;return db[_0x48e3('0x27')][_0x48e3('0x54')]({'where':{'id':_0x12c2a7[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x55c407,null))[_0x48e3('0x1f')](function(_0x378925){if(_0x378925){_0xf3442c=_0x378925;_0x4ef119[_0x48e3('0x2c')]=_[_0x48e3('0x2e')](db[_0x48e3('0x85')][_0x48e3('0x28')]);_0x4ef119[_0x48e3('0x2d')]=_[_0x48e3('0x2e')](_0x12c2a7[_0x48e3('0x2d')]);_0x4ef119[_0x48e3('0x2f')]=_['intersection'](_0x4ef119[_0x48e3('0x2c')],_0x4ef119[_0x48e3('0x2d')]);_0x319f99[_0x48e3('0x32')]=_[_0x48e3('0x30')](_0x4ef119[_0x48e3('0x2c')],qs[_0x48e3('0x31')](_0x12c2a7['query'][_0x48e3('0x31')]));_0x319f99['attributes']=_0x319f99[_0x48e3('0x32')][_0x48e3('0x33')]?_0x319f99['attributes']:_0x4ef119[_0x48e3('0x2c')];_0x319f99['order']=qs[_0x48e3('0x38')](_0x12c2a7[_0x48e3('0x2d')]['sort']);_0x319f99[_0x48e3('0x3e')]=qs['filters'](_[_0x48e3('0x39')](_0x12c2a7['query'],_0x4ef119[_0x48e3('0x2f')]));if(_0x12c2a7[_0x48e3('0x2d')][_0x48e3('0x3a')]){_0x319f99['where']=_[_0x48e3('0x3b')](_0x319f99[_0x48e3('0x3e')],{'$or':_['map'](_0x319f99['attributes'],function(_0x31ff3d){var _0x519ef9={};_0x519ef9[_0x31ff3d]={'$like':'%'+_0x12c2a7[_0x48e3('0x2d')][_0x48e3('0x3a')]+'%'};return _0x519ef9;})});}_0x319f99=_[_0x48e3('0x3b')]({},_0x319f99,_0x12c2a7[_0x48e3('0x45')]);return _0xf3442c[_0x48e3('0x108')](_0x319f99);}})[_0x48e3('0x1f')](function(_0x34da7d){if(_0x34da7d){_0x25a734=_0x34da7d[_0x48e3('0x33')];if(!_0x12c2a7[_0x48e3('0x2d')][_0x48e3('0x34')](_0x48e3('0x35'))){_0x319f99[_0x48e3('0x36')]=qs[_0x48e3('0x36')](_0x12c2a7[_0x48e3('0x2d')][_0x48e3('0x36')]);_0x319f99[_0x48e3('0x1b')]=qs['offset'](_0x12c2a7[_0x48e3('0x2d')]['offset']);}return _0xf3442c[_0x48e3('0x108')](_0x319f99);}})[_0x48e3('0x1f')](function(_0x1582ab){if(_0x1582ab){return _0x1582ab?{'count':_0x25a734,'rows':_0x1582ab}:null;}})[_0x48e3('0x1f')](respondWithResult(_0x55c407,null))[_0x48e3('0x42')](handleError(_0x55c407,null));};exports[_0x48e3('0x109')]=function(_0x169772,_0x3c98d9){return db[_0x48e3('0x10a')][_0x48e3('0x46')]({'where':{'id':_0x169772[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x3c98d9,null))[_0x48e3('0x1f')](function(_0x5cd1da){if(_0x5cd1da){return _0x5cd1da[_0x48e3('0x109')](_0x169772[_0x48e3('0x48')][_0x48e3('0x57')],_[_0x48e3('0xdb')](_0x169772[_0x48e3('0x48')],['ids','id'])||{});}})[_0x48e3('0x1f')](respondWithResult(_0x3c98d9,null))[_0x48e3('0x42')](handleError(_0x3c98d9,null));};exports[_0x48e3('0xef')]=function(_0x5e6dde,_0x173d25){var _0x5e9b23={};var _0x35f32d={};var _0x59bead;var _0x4e9f2d;return db[_0x48e3('0x27')]['findOne']({'where':{'id':_0x5e6dde['params']['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x173d25,null))[_0x48e3('0x1f')](function(_0x401999){if(_0x401999){_0x59bead=_0x401999;_0x35f32d[_0x48e3('0x2c')]=_[_0x48e3('0x2e')](db['ChatProactiveAction'][_0x48e3('0x28')]);_0x35f32d[_0x48e3('0x2d')]=_[_0x48e3('0x2e')](_0x5e6dde[_0x48e3('0x2d')]);_0x35f32d[_0x48e3('0x2f')]=_['intersection'](_0x35f32d[_0x48e3('0x2c')],_0x35f32d[_0x48e3('0x2d')]);_0x5e9b23[_0x48e3('0x32')]=_[_0x48e3('0x30')](_0x35f32d[_0x48e3('0x2c')],qs[_0x48e3('0x31')](_0x5e6dde[_0x48e3('0x2d')]['fields']));_0x5e9b23['attributes']=_0x5e9b23[_0x48e3('0x32')]['length']?_0x5e9b23[_0x48e3('0x32')]:_0x35f32d[_0x48e3('0x2c')];_0x5e9b23[_0x48e3('0x37')]=qs[_0x48e3('0x38')](_0x5e6dde[_0x48e3('0x2d')][_0x48e3('0x38')]);_0x5e9b23['where']=qs[_0x48e3('0x2f')](_['pick'](_0x5e6dde[_0x48e3('0x2d')],_0x35f32d[_0x48e3('0x2f')]));if(_0x5e6dde[_0x48e3('0x2d')]['filter']){_0x5e9b23['where']=_[_0x48e3('0x3b')](_0x5e9b23[_0x48e3('0x3e')],{'$or':_[_0x48e3('0x3c')](_0x5e9b23[_0x48e3('0x32')],function(_0x19f544){var _0x16c190={};_0x16c190[_0x19f544]={'$like':'%'+_0x5e6dde[_0x48e3('0x2d')][_0x48e3('0x3a')]+'%'};return _0x16c190;})});}_0x5e9b23=_[_0x48e3('0x3b')]({},_0x5e9b23,_0x5e6dde['options']);return _0x59bead['getProactiveActions'](_0x5e9b23);}})[_0x48e3('0x1f')](function(_0x240abd){if(_0x240abd){_0x4e9f2d=_0x240abd[_0x48e3('0x33')];if(!_0x5e6dde[_0x48e3('0x2d')][_0x48e3('0x34')](_0x48e3('0x35'))){_0x5e9b23[_0x48e3('0x36')]=qs[_0x48e3('0x36')](_0x5e6dde[_0x48e3('0x2d')][_0x48e3('0x36')]);_0x5e9b23['offset']=qs[_0x48e3('0x1b')](_0x5e6dde[_0x48e3('0x2d')][_0x48e3('0x1b')]);}return _0x59bead[_0x48e3('0xef')](_0x5e9b23);}})[_0x48e3('0x1f')](function(_0x31ccf){if(_0x31ccf){return _0x31ccf?{'count':_0x4e9f2d,'rows':_0x31ccf}:null;}})[_0x48e3('0x1f')](respondWithResult(_0x173d25,null))[_0x48e3('0x42')](handleError(_0x173d25,null));};exports[_0x48e3('0x10b')]=function(_0x5ad5b9,_0xb0676d){var _0x38fe52=_0x5ad5b9[_0x48e3('0x2d')][_0x48e3('0x10c')]==='false'?_0x48e3('0x10d'):_0x48e3('0x10e');return db['ChatWebsite'][_0x48e3('0x46')]({'attributes':['id',_0x38fe52],'where':{'id':_0x5ad5b9[_0x48e3('0x4f')]['id']}})['then'](handleEntityNotFound(_0xb0676d,null))['then'](function(_0x313d5f){if(_0x313d5f){var _0x7ba85a=_0x313d5f[_0x38fe52];var _0x383919=_0x7ba85a&&_0x7ba85a[_0x48e3('0x10f')]?_0x7ba85a[_0x48e3('0x10f')]:[];_0xb0676d['send']({'fromKey':_[_0x48e3('0x68')](_0x7ba85a[_0x48e3('0x110')])?undefined:_0x7ba85a[_0x48e3('0x110')],'count':_0x383919[_0x48e3('0x33')],'rows':_0x383919});}})['catch'](handleError(_0xb0676d,null));};exports['getOfflineMessages']=function(_0x10a6a0,_0x499d0d){var _0x14295c={'raw':![],'where':{}};var _0x2bff68={};var _0x4e0d83={'count':0x0,'rows':[]};return db[_0x48e3('0x27')]['findOne']({'where':{'id':_0x10a6a0[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x499d0d,null))[_0x48e3('0x1f')](function(_0x10ed5b){if(_0x10ed5b){_0x2bff68[_0x48e3('0x2c')]=_['keys'](db[_0x48e3('0xc0')]['rawAttributes']);_0x2bff68[_0x48e3('0x2d')]=_[_0x48e3('0x2e')](_0x10a6a0[_0x48e3('0x2d')]);_0x2bff68[_0x48e3('0x2f')]=_[_0x48e3('0x30')](_0x2bff68['model'],_0x2bff68[_0x48e3('0x2d')]);_0x14295c[_0x48e3('0x32')]=_[_0x48e3('0x30')](_0x2bff68[_0x48e3('0x2c')],qs[_0x48e3('0x31')](_0x10a6a0['query']['fields']));_0x14295c[_0x48e3('0x32')]=_0x14295c['attributes']['length']?_0x14295c[_0x48e3('0x32')]:_0x2bff68[_0x48e3('0x2c')];if(!_0x10a6a0[_0x48e3('0x2d')][_0x48e3('0x34')](_0x48e3('0x35'))){_0x14295c[_0x48e3('0x36')]=qs[_0x48e3('0x36')](_0x10a6a0[_0x48e3('0x2d')][_0x48e3('0x36')]);_0x14295c[_0x48e3('0x1b')]=qs[_0x48e3('0x1b')](_0x10a6a0[_0x48e3('0x2d')][_0x48e3('0x1b')]);}_0x14295c[_0x48e3('0x37')]=qs[_0x48e3('0x38')](_0x10a6a0[_0x48e3('0x2d')][_0x48e3('0x38')]);_0x14295c[_0x48e3('0x3e')]=qs[_0x48e3('0x2f')](_[_0x48e3('0x39')](_0x10a6a0[_0x48e3('0x2d')],_0x2bff68[_0x48e3('0x2f')]));_0x14295c[_0x48e3('0x3e')][_0x48e3('0x51')]=_0x10ed5b['id'];if(_0x10a6a0[_0x48e3('0x2d')][_0x48e3('0x3a')]){_0x14295c['where']=_[_0x48e3('0x3b')](_0x14295c[_0x48e3('0x3e')],{'$or':_[_0x48e3('0x3c')](_0x14295c['attributes'],function(_0x4a8e9d){var _0x55a1c5={};_0x55a1c5[_0x4a8e9d]={'$like':'%'+_0x10a6a0[_0x48e3('0x2d')][_0x48e3('0x3a')]+'%'};return _0x55a1c5;})});}_0x14295c=_[_0x48e3('0x3b')]({},_0x14295c,_0x10a6a0['options']);return db['ChatOfflineMessage'][_0x48e3('0x1d')]({'where':_0x14295c[_0x48e3('0x3e')]})[_0x48e3('0x1f')](function(_0x18adee){_0x4e0d83[_0x48e3('0x1d')]=_0x18adee;if(_0x10a6a0[_0x48e3('0x2d')]['includeAll']){_0x14295c['include']=[{'all':!![]}];}else{_0x14295c[_0x48e3('0x40')]=[{'model':db[_0x48e3('0x77')],'as':'Contact','required':![]},{'model':db[_0x48e3('0xc6')],'as':_0x48e3('0x111'),'required':![]}];}return db['ChatOfflineMessage'][_0x48e3('0x41')](_0x14295c);})[_0x48e3('0x1f')](function(_0x3613a2){_0x4e0d83['rows']=_0x3613a2;return _0x4e0d83;});}})['then'](respondWithFilteredResult(_0x499d0d,_0x14295c))['catch'](handleError(_0x499d0d,null));};exports[_0x48e3('0x112')]=function(_0xdf740d,_0x32cef2){return db['ChatWebsite'][_0x48e3('0x46')]({'where':{'id':_0xdf740d[_0x48e3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x32cef2,null))[_0x48e3('0x1f')](function(_0x32af93){if(_0x32af93){return _0x32af93['addAgents'](_0xdf740d[_0x48e3('0x48')][_0x48e3('0x57')],_[_0x48e3('0xdb')](_0xdf740d[_0x48e3('0x48')],[_0x48e3('0x57'),'id'])||{})['spread'](function(_0x23a4c0){for(var _0x15580f=0x0;_0x15580f<_0xdf740d['body'][_0x48e3('0x57')][_0x48e3('0x33')];_0x15580f+=0x1){socket['emit'](_0x48e3('0x113'),{'UserId':Number(_0xdf740d[_0x48e3('0x48')][_0x48e3('0x57')][_0x15580f]),'ChatWebsiteId':Number(_0xdf740d['params']['id'])});}return _0x23a4c0;});}})[_0x48e3('0x1f')](respondWithResult(_0x32cef2,null))[_0x48e3('0x42')](handleError(_0x32cef2,null));};exports[_0x48e3('0x114')]=function(_0x4918b4,_0x1004fe){return db[_0x48e3('0x27')][_0x48e3('0x46')]({'where':{'id':_0x4918b4[_0x48e3('0x4f')]['id']}})[_0x48e3('0x1f')](handleEntityNotFound(_0x1004fe,null))[_0x48e3('0x1f')](function(_0x55e4d3){if(_0x55e4d3){return _0x55e4d3[_0x48e3('0x114')](_0x4918b4[_0x48e3('0x2d')][_0x48e3('0x57')])[_0x48e3('0x1f')](function(){if(_['isArray'](_0x4918b4[_0x48e3('0x2d')][_0x48e3('0x57')])){for(var _0x4d79ea=0x0;_0x4d79ea<_0x4918b4[_0x48e3('0x2d')][_0x48e3('0x57')][_0x48e3('0x33')];_0x4d79ea+=0x1){socket[_0x48e3('0x115')](_0x48e3('0x116'),{'UserId':Number(_0x4918b4[_0x48e3('0x2d')]['ids'][_0x4d79ea]),'ChatWebsiteId':Number(_0x4918b4[_0x48e3('0x4f')]['id'])});}}else{socket[_0x48e3('0x115')](_0x48e3('0x116'),{'UserId':Number(_0x4918b4[_0x48e3('0x2d')]['ids']),'ChatWebsiteId':Number(_0x4918b4[_0x48e3('0x4f')]['id'])});}});}})[_0x48e3('0x1f')](respondWithStatusCode(_0x1004fe,null))[_0x48e3('0x42')](handleError(_0x1004fe,null));};exports['getAgents']=function(_0xd51046,_0x13b970){var _0x2b3065={};var _0x649dc2={};var _0x28b484;var _0x25367b;return db[_0x48e3('0x27')]['findOne']({'where':{'id':_0xd51046['params']['id']}})['then'](handleEntityNotFound(_0x13b970,null))[_0x48e3('0x1f')](function(_0x3c3f34){if(_0x3c3f34){_0x28b484=_0x3c3f34;_0x649dc2[_0x48e3('0x2c')]=_[_0x48e3('0x2e')](db[_0x48e3('0xad')]['rawAttributes']);_0x649dc2[_0x48e3('0x2d')]=_[_0x48e3('0x2e')](_0xd51046[_0x48e3('0x2d')]);_0x649dc2[_0x48e3('0x2f')]=_['intersection'](_0x649dc2[_0x48e3('0x2c')],_0x649dc2[_0x48e3('0x2d')]);_0x2b3065[_0x48e3('0x32')]=_['intersection'](_0x649dc2[_0x48e3('0x2c')],qs['fields'](_0xd51046[_0x48e3('0x2d')][_0x48e3('0x31')]));_0x2b3065[_0x48e3('0x32')]=_0x2b3065[_0x48e3('0x32')][_0x48e3('0x33')]?_0x2b3065[_0x48e3('0x32')]:_0x649dc2[_0x48e3('0x2c')];_0x2b3065['order']=qs[_0x48e3('0x38')](_0xd51046[_0x48e3('0x2d')]['sort']);_0x2b3065[_0x48e3('0x3e')]=qs['filters'](_[_0x48e3('0x39')](_0xd51046[_0x48e3('0x2d')],_0x649dc2['filters']));if(_0xd51046[_0x48e3('0x2d')][_0x48e3('0x3a')]){_0x2b3065['where']=_[_0x48e3('0x3b')](_0x2b3065[_0x48e3('0x3e')],{'$or':_[_0x48e3('0x3c')](_0x2b3065[_0x48e3('0x32')],function(_0x2c71c6){var _0x1f0ae2={};_0x1f0ae2[_0x2c71c6]={'$like':'%'+_0xd51046[_0x48e3('0x2d')][_0x48e3('0x3a')]+'%'};return _0x1f0ae2;})});}_0x2b3065=_[_0x48e3('0x3b')]({},_0x2b3065,_0xd51046[_0x48e3('0x45')]);return _0x28b484[_0x48e3('0x117')](_0x2b3065);}})['then'](function(_0x22abd6){if(_0x22abd6){_0x25367b=_0x22abd6[_0x48e3('0x33')];if(!_0xd51046[_0x48e3('0x2d')]['hasOwnProperty']('nolimit')){_0x2b3065[_0x48e3('0x36')]=qs[_0x48e3('0x36')](_0xd51046['query'][_0x48e3('0x36')]);_0x2b3065['offset']=qs[_0x48e3('0x1b')](_0xd51046[_0x48e3('0x2d')]['offset']);}return _0x28b484[_0x48e3('0x117')](_0x2b3065);}})[_0x48e3('0x1f')](function(_0x1fb6cb){if(_0x1fb6cb){return _0x1fb6cb?{'count':_0x25367b,'rows':_0x1fb6cb}:null;}})[_0x48e3('0x1f')](respondWithResult(_0x13b970,null))['catch'](handleError(_0x13b970,null));}; \ No newline at end of file +var _0x3763=['interval','format','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','increment','chatLicenseExceeded','remote','connection','remoteAddress','virtual','replace','render','alignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','getApplications','addProactiveActions','ChatProactiveAction','online','false','offlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','ChatWebsite','findAll','catch','show','params','options','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','ChatApplication','Applications','account','list','orderBy','applications','asc','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','firstName','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','email','Smtp','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','omit','getInteractions','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s'];(function(_0x27ab99,_0x5a6d79){var _0x1e66c2=function(_0x8d4dc9){while(--_0x8d4dc9){_0x27ab99['push'](_0x27ab99['shift']());}};_0x1e66c2(++_0x5a6d79);}(_0x3763,0x15c));var _0x3376=function(_0x32f657,_0x3bcd12){_0x32f657=_0x32f657-0x0;var _0x2dd60e=_0x3763[_0x32f657];return _0x2dd60e;};'use strict';var BPromise=require(_0x3376('0x0'));var Mustache=require('mustache');var util=require(_0x3376('0x1'));var path=require('path');var ejs=require(_0x3376('0x2'));var fs=require('fs');var fs_extra=require(_0x3376('0x3'));var _=require(_0x3376('0x4'));var querystring=require(_0x3376('0x5'));var Redis=require(_0x3376('0x6'));var qs=require(_0x3376('0x7'));var logger=require(_0x3376('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x3376('0x9')]=_[_0x3376('0xa')](config[_0x3376('0x9')],{'host':_0x3376('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3376('0x9')]));require(_0x3376('0xc'))[_0x3376('0xd')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x3376('0xe'));var client=jayson[_0x3376('0xf')][_0x3376('0x10')]({'port':0x232c});var client9002=jayson[_0x3376('0xf')][_0x3376('0x10')]({'port':0x232a});var client9003=jayson[_0x3376('0xf')][_0x3376('0x10')]({'port':0x232b});var client9001=jayson['client'][_0x3376('0x10')]({'port':0x2329});function respondWithRpcPromise(_0xf8d7d6,_0x50b383,_0x21f536,_0x237d2f){return new BPromise(function(_0x1c0d43,_0x37c1ae){var _0x2f6a58=_0x237d2f||client;return _0x2f6a58[_0x3376('0x11')](_0xf8d7d6,_0x21f536)[_0x3376('0x12')](function(_0x16975b){logger['info'](_0x3376('0x13'),_0x50b383,_0x3376('0x14'));logger[_0x3376('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x50b383,'request\x20sent',JSON[_0x3376('0x16')](_0x16975b));if(_0x16975b[_0x3376('0x17')]){if(_0x16975b[_0x3376('0x17')][_0x3376('0x18')]===0x1f4){logger[_0x3376('0x17')](_0x3376('0x13'),_0x50b383,_0x16975b[_0x3376('0x17')]['message']);return _0x37c1ae(_0x16975b[_0x3376('0x17')][_0x3376('0x19')]);}logger['error'](_0x3376('0x13'),_0x50b383,_0x16975b[_0x3376('0x17')][_0x3376('0x19')]);return _0x1c0d43(_0x16975b[_0x3376('0x17')][_0x3376('0x19')]);}else{logger[_0x3376('0x1a')](_0x3376('0x13'),_0x50b383,_0x3376('0x14'));_0x1c0d43(_0x16975b['result']['message']);}})['catch'](function(_0x33516c){logger[_0x3376('0x17')](_0x3376('0x13'),_0x50b383,_0x33516c);_0x37c1ae(_0x33516c);});});}function respondWithStatusCode(_0x394df7,_0x21f067){_0x21f067=_0x21f067||0xcc;return function(_0x33ca11){if(_0x33ca11){return _0x394df7[_0x3376('0x1b')](_0x21f067);}return _0x394df7['status'](_0x21f067)[_0x3376('0x1c')]();};}function respondWithResult(_0x1db7d0,_0x4cf9b4){_0x4cf9b4=_0x4cf9b4||0xc8;return function(_0xae48a3){if(_0xae48a3){return _0x1db7d0[_0x3376('0x1d')](_0x4cf9b4)[_0x3376('0x1e')](_0xae48a3);}};}function respondWithFilteredResult(_0x3f063e,_0x4f16ec){return function(_0x42c8e1){if(_0x42c8e1){var _0xfc2667=typeof _0x4f16ec[_0x3376('0x1f')]===_0x3376('0x20')&&typeof _0x4f16ec[_0x3376('0x21')]===_0x3376('0x20');var _0x11e029=_0x42c8e1[_0x3376('0x22')];var _0x1c6edd=_0xfc2667?0x0:_0x4f16ec[_0x3376('0x1f')];var _0x21b315=_0xfc2667?_0x42c8e1[_0x3376('0x22')]:_0x4f16ec['offset']+_0x4f16ec[_0x3376('0x21')];var _0x430368;if(_0x21b315>=_0x11e029){_0x21b315=_0x11e029;_0x430368=0xc8;}else{_0x430368=0xce;}_0x3f063e[_0x3376('0x1d')](_0x430368);return _0x3f063e[_0x3376('0x23')](_0x3376('0x24'),_0x1c6edd+'-'+_0x21b315+'/'+_0x11e029)[_0x3376('0x1e')](_0x42c8e1);}return null;};}function saveUpdates(_0x189025){return function(_0x3fc936){if(_0x3fc936){return _0x3fc936[_0x3376('0x25')](_0x189025)['then'](function(_0x208b22){return _0x208b22;});}return null;};}function removeEntity(_0x36c2ef){return function(_0x4f29ab){if(_0x4f29ab){return _0x4f29ab[_0x3376('0x26')]()[_0x3376('0x12')](function(){var _0x4fa476=_0x4f29ab[_0x3376('0x27')]({'plain':!![]});var _0x257243=_0x3376('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x257243,'resourceId':_0x4fa476['id']}})[_0x3376('0x12')](function(){return _0x4f29ab;});})[_0x3376('0x12')](function(){_0x36c2ef['status'](0xcc)[_0x3376('0x1c')]();});}};}function handleEntityNotFound(_0x504810){return function(_0x12a9f4){if(!_0x12a9f4){_0x504810[_0x3376('0x1b')](0x194);}return _0x12a9f4;};}function handleError(_0x417c26,_0x3e30e0){_0x3e30e0=_0x3e30e0||0x1f4;return function(_0xb6ca47){logger[_0x3376('0x17')](_0xb6ca47[_0x3376('0x29')]);if(_0xb6ca47[_0x3376('0x2a')]){delete _0xb6ca47[_0x3376('0x2a')];}_0x417c26[_0x3376('0x1d')](_0x3e30e0)[_0x3376('0x2b')](_0xb6ca47);};}exports[_0x3376('0x2c')]=function(_0x6c2aaf,_0x5dfc41){var _0x334020={'include':[{'model':db[_0x3376('0x2d')],'as':_0x3376('0x2e')}]},_0x186669={},_0x11f2db={'count':0x0,'rows':[]};var _0x5b2227=_[_0x3376('0x2f')](db['ChatWebsite'][_0x3376('0x30')],function(_0x4ee9d0){return{'name':_0x4ee9d0[_0x3376('0x31')],'type':_0x4ee9d0['type'][_0x3376('0x32')]};});_0x186669[_0x3376('0x33')]=_[_0x3376('0x2f')](_0x5b2227,_0x3376('0x2a'));_0x186669[_0x3376('0x34')]=_[_0x3376('0x35')](_0x6c2aaf['query']);_0x186669[_0x3376('0x36')]=_[_0x3376('0x37')](_0x186669[_0x3376('0x33')],_0x186669[_0x3376('0x34')]);_0x334020['attributes']=_[_0x3376('0x37')](_0x186669[_0x3376('0x33')],qs[_0x3376('0x38')](_0x6c2aaf[_0x3376('0x34')][_0x3376('0x38')]));_0x334020[_0x3376('0x39')]=_0x334020[_0x3376('0x39')][_0x3376('0x3a')]?_0x334020['attributes']:_0x186669[_0x3376('0x33')];if(!_0x6c2aaf[_0x3376('0x34')]['hasOwnProperty'](_0x3376('0x3b'))){_0x334020[_0x3376('0x21')]=qs[_0x3376('0x21')](_0x6c2aaf[_0x3376('0x34')]['limit']);_0x334020[_0x3376('0x1f')]=qs['offset'](_0x6c2aaf[_0x3376('0x34')]['offset']);}_0x334020['order']=qs[_0x3376('0x3c')](_0x6c2aaf[_0x3376('0x34')][_0x3376('0x3c')]);_0x334020[_0x3376('0x3d')]=qs[_0x3376('0x36')](_[_0x3376('0x3e')](_0x6c2aaf[_0x3376('0x34')],_0x186669[_0x3376('0x36')]),_0x5b2227);if(_0x6c2aaf[_0x3376('0x34')]['filter']){_0x334020[_0x3376('0x3d')]=_['merge'](_0x334020['where'],{'$or':_['map'](_0x5b2227,function(_0x5e3c86){if(_0x5e3c86[_0x3376('0x3f')]!==_0x3376('0x40')){var _0xb30db4={};_0xb30db4[_0x5e3c86[_0x3376('0x2a')]]={'$like':'%'+_0x6c2aaf[_0x3376('0x34')][_0x3376('0x41')]+'%'};return _0xb30db4;}})});}_0x334020=_[_0x3376('0x42')]({},_0x334020,_0x6c2aaf['options']);var _0x174672={'where':_0x334020[_0x3376('0x3d')]};return db['ChatWebsite'][_0x3376('0x22')](_0x174672)[_0x3376('0x12')](function(_0x4bd641){_0x11f2db[_0x3376('0x22')]=_0x4bd641;if(_0x6c2aaf[_0x3376('0x34')][_0x3376('0x43')]){_0x334020[_0x3376('0x44')]=[{'all':!![]}];}return db[_0x3376('0x45')][_0x3376('0x46')](_0x334020);})[_0x3376('0x12')](function(_0x348560){_0x11f2db['rows']=_0x348560;return _0x11f2db;})[_0x3376('0x12')](respondWithFilteredResult(_0x5dfc41,_0x334020))[_0x3376('0x47')](handleError(_0x5dfc41,null));};exports[_0x3376('0x48')]=function(_0x558d6d,_0x13a955){var _0x42f276={'raw':![],'where':{'id':_0x558d6d[_0x3376('0x49')]['id']},'include':[{'model':db[_0x3376('0x2d')],'as':_0x3376('0x2e')}]},_0x4fe462={};_0x4fe462[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0x45')][_0x3376('0x30')]);_0x4fe462[_0x3376('0x34')]=_['keys'](_0x558d6d[_0x3376('0x34')]);_0x4fe462['filters']=_[_0x3376('0x37')](_0x4fe462[_0x3376('0x33')],_0x4fe462[_0x3376('0x34')]);_0x42f276[_0x3376('0x39')]=_['intersection'](_0x4fe462[_0x3376('0x33')],qs[_0x3376('0x38')](_0x558d6d[_0x3376('0x34')][_0x3376('0x38')]));_0x42f276[_0x3376('0x39')]=_0x42f276[_0x3376('0x39')][_0x3376('0x3a')]?_0x42f276[_0x3376('0x39')]:_0x4fe462[_0x3376('0x33')];if(_0x558d6d['query'][_0x3376('0x43')]){_0x42f276[_0x3376('0x44')]=[{'all':!![]}];}_0x42f276=_[_0x3376('0x42')]({},_0x42f276,_0x558d6d[_0x3376('0x4a')]);return db[_0x3376('0x45')][_0x3376('0x4b')](_0x42f276)[_0x3376('0x12')](handleEntityNotFound(_0x13a955,null))['then'](respondWithResult(_0x13a955,null))[_0x3376('0x47')](handleError(_0x13a955,null));};exports[_0x3376('0x4c')]=function(_0x57666b,_0x37076b){return db['ChatWebsite'][_0x3376('0x4c')](_0x57666b[_0x3376('0x4d')],{})['then'](function(_0xace4f9){var _0x2b1dfd=_0x57666b['user'][_0x3376('0x27')]({'plain':!![]});if(!_0x2b1dfd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b1dfd[_0x3376('0x4e')]===_0x3376('0x4f')){var _0x506783=_0xace4f9['get']({'plain':!![]});var _0x3bc66b=_0x3376('0x28');return db[_0x3376('0x50')]['find']({'where':{'name':_0x3bc66b,'userProfileId':_0x2b1dfd[_0x3376('0x51')]},'raw':!![]})['then'](function(_0x12cf51){if(_0x12cf51&&_0x12cf51['autoAssociation']===0x0){return db[_0x3376('0x52')][_0x3376('0x4c')]({'name':_0x506783[_0x3376('0x2a')],'resourceId':_0x506783['id'],'type':_0x12cf51[_0x3376('0x2a')],'sectionId':_0x12cf51['id']},{})[_0x3376('0x12')](function(){return _0xace4f9;});}else{return _0xace4f9;}})[_0x3376('0x47')](function(_0x56500b){logger[_0x3376('0x17')](_0x3376('0x53'),_0x56500b);throw _0x56500b;});}return _0xace4f9;})[_0x3376('0x12')](respondWithResult(_0x37076b,0xc9))['catch'](handleError(_0x37076b,null));};exports[_0x3376('0x25')]=function(_0x2f2157,_0x980f1b){if(_0x2f2157['body']['id']){delete _0x2f2157[_0x3376('0x4d')]['id'];}return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x2f2157['params']['id']},'include':[{'model':db[_0x3376('0x2d')],'as':_0x3376('0x2e')}]})[_0x3376('0x12')](handleEntityNotFound(_0x980f1b,null))[_0x3376('0x12')](saveUpdates(_0x2f2157[_0x3376('0x4d')],null))[_0x3376('0x12')](respondWithResult(_0x980f1b,null))['catch'](handleError(_0x980f1b,null));};exports[_0x3376('0x26')]=function(_0x4a9d6f,_0x4c44c7){return db['ChatWebsite'][_0x3376('0x4b')]({'where':{'id':_0x4a9d6f[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x4c44c7,null))[_0x3376('0x12')](removeEntity(_0x4c44c7,null))[_0x3376('0x47')](handleError(_0x4c44c7,null));};exports[_0x3376('0x54')]=function(_0x2bbbec,_0x145e00){return db[_0x3376('0x45')]['describe']()[_0x3376('0x12')](respondWithResult(_0x145e00,null))['catch'](handleError(_0x145e00,null));};exports[_0x3376('0x55')]=function(_0x38e4c5,_0x20dcac){if(_0x38e4c5['body']['id']){delete _0x38e4c5['body']['id'];}return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x38e4c5[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x20dcac,null))[_0x3376('0x12')](function(_0x46176e){if(_0x46176e){_0x38e4c5[_0x3376('0x4d')][_0x3376('0x56')]=_0x46176e['id'];return db[_0x3376('0x57')][_0x3376('0x4c')](_0x38e4c5[_0x3376('0x4d')]);}})[_0x3376('0x12')](respondWithResult(_0x20dcac,null))[_0x3376('0x47')](handleError(_0x20dcac,null));};exports[_0x3376('0x58')]=function(_0xd053e4,_0x3aa529){var _0xa0bc6c={'raw':![],'where':{}};var _0x2a57bf={};var _0x1625b0={'count':0x0,'rows':[]};return db[_0x3376('0x45')][_0x3376('0x59')]({'where':{'id':_0xd053e4['params']['id']}})['then'](handleEntityNotFound(_0x3aa529,null))[_0x3376('0x12')](function(_0x18987a){if(_0x18987a){_0x2a57bf[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0x57')][_0x3376('0x30')]);_0x2a57bf[_0x3376('0x34')]=_[_0x3376('0x35')](_0xd053e4['query']);_0x2a57bf[_0x3376('0x36')]=_[_0x3376('0x37')](_0x2a57bf[_0x3376('0x33')],_0x2a57bf[_0x3376('0x34')]);_0xa0bc6c[_0x3376('0x39')]=_[_0x3376('0x37')](_0x2a57bf[_0x3376('0x33')],qs[_0x3376('0x38')](_0xd053e4['query'][_0x3376('0x38')]));_0xa0bc6c[_0x3376('0x39')]=_0xa0bc6c[_0x3376('0x39')][_0x3376('0x3a')]?_0xa0bc6c['attributes']:_0x2a57bf[_0x3376('0x33')];if(!_0xd053e4[_0x3376('0x34')]['hasOwnProperty'](_0x3376('0x3b'))){_0xa0bc6c['limit']=qs[_0x3376('0x21')](_0xd053e4[_0x3376('0x34')][_0x3376('0x21')]);_0xa0bc6c['offset']=qs[_0x3376('0x1f')](_0xd053e4[_0x3376('0x34')]['offset']);}_0xa0bc6c[_0x3376('0x5a')]=qs[_0x3376('0x3c')](_0xd053e4[_0x3376('0x34')][_0x3376('0x3c')]);_0xa0bc6c['where']=qs[_0x3376('0x36')](_['pick'](_0xd053e4[_0x3376('0x34')],_0x2a57bf[_0x3376('0x36')]));_0xa0bc6c[_0x3376('0x3d')][_0x3376('0x56')]=_0x18987a['id'];if(_0xd053e4[_0x3376('0x34')][_0x3376('0x41')]){_0xa0bc6c['where']=_['merge'](_0xa0bc6c[_0x3376('0x3d')],{'$or':_['map'](_0xa0bc6c[_0x3376('0x39')],function(_0x2d2505){var _0xb02b3e={};_0xb02b3e[_0x2d2505]={'$like':'%'+_0xd053e4[_0x3376('0x34')][_0x3376('0x41')]+'%'};return _0xb02b3e;})});}_0xa0bc6c=_[_0x3376('0x42')]({},_0xa0bc6c,_0xd053e4['options']);return db['Disposition'][_0x3376('0x22')]({'where':_0xa0bc6c[_0x3376('0x3d')]})[_0x3376('0x12')](function(_0x2f6b60){_0x1625b0[_0x3376('0x22')]=_0x2f6b60;if(_0xd053e4[_0x3376('0x34')][_0x3376('0x43')]){_0xa0bc6c[_0x3376('0x44')]=[{'all':!![]}];}return db[_0x3376('0x57')][_0x3376('0x46')](_0xa0bc6c);})[_0x3376('0x12')](function(_0x26d183){_0x1625b0[_0x3376('0x5b')]=_0x26d183;return _0x1625b0;});}})[_0x3376('0x12')](respondWithFilteredResult(_0x3aa529,_0xa0bc6c))[_0x3376('0x47')](handleError(_0x3aa529,null));};exports[_0x3376('0x5c')]=function(_0x59e3a0,_0x1a6b59){return db['ChatWebsite'][_0x3376('0x4b')]({'where':{'id':_0x59e3a0[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x1a6b59,null))[_0x3376('0x12')](function(_0x3c3e7c){if(_0x3c3e7c){return _0x3c3e7c[_0x3376('0x5c')](_0x59e3a0[_0x3376('0x34')][_0x3376('0x5d')]);}})['then'](respondWithStatusCode(_0x1a6b59,null))[_0x3376('0x47')](handleError(_0x1a6b59,null));};exports[_0x3376('0x5e')]=function(_0x4cccc6,_0x7550df){if(_0x4cccc6[_0x3376('0x4d')]['id']){delete _0x4cccc6[_0x3376('0x4d')]['id'];}return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x4cccc6[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x7550df,null))[_0x3376('0x12')](function(_0xb2208d){if(_0xb2208d){_0x4cccc6[_0x3376('0x4d')][_0x3376('0x56')]=_0xb2208d['id'];return db['CannedAnswer'][_0x3376('0x4c')](_0x4cccc6[_0x3376('0x4d')]);}})['then'](respondWithResult(_0x7550df,null))['catch'](handleError(_0x7550df,null));};exports[_0x3376('0x5f')]=function(_0x520c18,_0x1151d1){var _0x5a502f={'raw':![],'where':{}};var _0x401670={};var _0xbf6dda={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3376('0x59')]({'where':{'id':_0x520c18['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x1151d1,null))[_0x3376('0x12')](function(_0x472cc2){if(_0x472cc2){_0x401670[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0x60')]['rawAttributes']);_0x401670[_0x3376('0x34')]=_[_0x3376('0x35')](_0x520c18['query']);_0x401670[_0x3376('0x36')]=_[_0x3376('0x37')](_0x401670[_0x3376('0x33')],_0x401670[_0x3376('0x34')]);_0x5a502f['attributes']=_[_0x3376('0x37')](_0x401670[_0x3376('0x33')],qs[_0x3376('0x38')](_0x520c18[_0x3376('0x34')][_0x3376('0x38')]));_0x5a502f[_0x3376('0x39')]=_0x5a502f['attributes']['length']?_0x5a502f[_0x3376('0x39')]:_0x401670[_0x3376('0x33')];if(!_0x520c18[_0x3376('0x34')][_0x3376('0x61')](_0x3376('0x3b'))){_0x5a502f['limit']=qs[_0x3376('0x21')](_0x520c18[_0x3376('0x34')][_0x3376('0x21')]);_0x5a502f['offset']=qs['offset'](_0x520c18[_0x3376('0x34')][_0x3376('0x1f')]);}_0x5a502f[_0x3376('0x5a')]=qs[_0x3376('0x3c')](_0x520c18['query'][_0x3376('0x3c')]);_0x5a502f[_0x3376('0x3d')]=qs['filters'](_[_0x3376('0x3e')](_0x520c18[_0x3376('0x34')],_0x401670[_0x3376('0x36')]));_0x5a502f['where'][_0x3376('0x56')]=_0x472cc2['id'];if(_0x520c18[_0x3376('0x34')][_0x3376('0x41')]){_0x5a502f[_0x3376('0x3d')]=_[_0x3376('0x42')](_0x5a502f[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x5a502f[_0x3376('0x39')],function(_0x1c2e43){var _0x252a3f={};_0x252a3f[_0x1c2e43]={'$like':'%'+_0x520c18[_0x3376('0x34')]['filter']+'%'};return _0x252a3f;})});}_0x5a502f=_[_0x3376('0x42')]({},_0x5a502f,_0x520c18[_0x3376('0x4a')]);return db['CannedAnswer']['count']({'where':_0x5a502f[_0x3376('0x3d')]})['then'](function(_0x2198b5){_0xbf6dda['count']=_0x2198b5;if(_0x520c18[_0x3376('0x34')][_0x3376('0x43')]){_0x5a502f[_0x3376('0x44')]=[{'all':!![]}];}return db[_0x3376('0x60')][_0x3376('0x46')](_0x5a502f);})[_0x3376('0x12')](function(_0x20c656){_0xbf6dda[_0x3376('0x5b')]=_0x20c656;return _0xbf6dda;});}})['then'](respondWithFilteredResult(_0x1151d1,_0x5a502f))[_0x3376('0x47')](handleError(_0x1151d1,null));};exports['removeAnswers']=function(_0x361128,_0x46efcb){return db[_0x3376('0x45')]['find']({'where':{'id':_0x361128[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x46efcb,null))['then'](function(_0x180405){if(_0x180405){return _0x180405[_0x3376('0x62')](_0x361128['query'][_0x3376('0x5d')]);}})[_0x3376('0x12')](respondWithStatusCode(_0x46efcb,null))[_0x3376('0x47')](handleError(_0x46efcb,null));};exports[_0x3376('0x63')]=function(_0x1e006f,_0x288af6){_0x1e006f[_0x3376('0x4d')][_0x3376('0x64')]=_0x1e006f[_0x3376('0x65')][_0x3376('0x66')];return db['ChatWebsite']['find']({'where':{'id':_0x1e006f[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x288af6,null))[_0x3376('0x12')](saveUpdates(_0x1e006f[_0x3376('0x4d')],null))['then'](respondWithResult(_0x288af6,null))['catch'](handleError(_0x288af6,null));};exports[_0x3376('0x67')]=function(_0x40510e,_0x32862b){_0x40510e[_0x3376('0x4d')][_0x3376('0x68')]=_0x40510e[_0x3376('0x65')][_0x3376('0x66')];return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x40510e['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x32862b,null))[_0x3376('0x12')](saveUpdates(_0x40510e['body'],null))[_0x3376('0x12')](respondWithResult(_0x32862b,null))[_0x3376('0x47')](handleError(_0x32862b,null));};exports['addCustomerAvatar']=function(_0x5927e0,_0x2d02ed){_0x5927e0[_0x3376('0x4d')]['customerAvatar']=_0x5927e0[_0x3376('0x65')]['filename'];return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x5927e0[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x2d02ed,null))[_0x3376('0x12')](saveUpdates(_0x5927e0['body'],null))[_0x3376('0x12')](respondWithResult(_0x2d02ed,null))[_0x3376('0x47')](handleError(_0x2d02ed,null));};exports[_0x3376('0x69')]=function(_0x216633,_0x61d4b5){_0x216633['body'][_0x3376('0x6a')]=_0x216633[_0x3376('0x65')][_0x3376('0x66')];return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x216633[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x61d4b5,null))['then'](saveUpdates(_0x216633[_0x3376('0x4d')],null))[_0x3376('0x12')](respondWithResult(_0x61d4b5,null))['catch'](handleError(_0x61d4b5,null));};exports['getLogo']=function(_0x3cd2b6,_0xdb9c39){var _0x21f671=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x6d'));var _0x4b333d={'where':{'id':_0x3cd2b6[_0x3376('0x49')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x21c89e=![];return require(_0x3376('0x6e'))[_0x3376('0x6f')]()[_0x3376('0x12')](function(_0x2b9e47){if(_0x2b9e47){_0x21c89e=_0x2b9e47[_0x3376('0x70')];}})[_0x3376('0x12')](function(){return db[_0x3376('0x45')][_0x3376('0x4b')](_0x4b333d);})[_0x3376('0x12')](handleEntityNotFound(_0xdb9c39,null))[_0x3376('0x12')](function(_0x75f7b3){if(_0x75f7b3){if(!_[_0x3376('0x71')](_0x75f7b3[_0x3376('0x64')])){if(fs[_0x3376('0x72')](path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x73'),_0x75f7b3['sitepic']))&&_0x21c89e){_0x21f671=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x73'),_0x75f7b3[_0x3376('0x64')]);}}return _0xdb9c39[_0x3376('0x74')](_0x21f671);}})[_0x3376('0x47')](handleError(_0xdb9c39,null));};exports[_0x3376('0x75')]=function(_0x127c1f,_0x516ff6){var _0xfdc6f1=path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server/files/images/avatars/default_avatar.png');var _0x29968f={'where':{'id':_0x127c1f[_0x3376('0x49')]['id']},'attributes':['id',_0x3376('0x68')],'raw':!![]};return db['ChatWebsite'][_0x3376('0x4b')](_0x29968f)[_0x3376('0x12')](handleEntityNotFound(_0x516ff6,null))[_0x3376('0x12')](function(_0x4a9cc7){if(_0x4a9cc7){if(!_[_0x3376('0x71')](_0x4a9cc7[_0x3376('0x68')])){if(fs['existsSync'](path['join'](config[_0x3376('0x6c')],_0x3376('0x76'),_0x4a9cc7['agentAvatar']))){_0xfdc6f1=path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server/files/images/avatars/',_0x4a9cc7['agentAvatar']);}}return _0x516ff6[_0x3376('0x74')](_0xfdc6f1);}})[_0x3376('0x47')](handleError(_0x516ff6,null));};exports[_0x3376('0x77')]=function(_0x4dd7d0,_0x271257){var _0xbe2f36=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x78'));var _0xaccca4={'where':{'id':_0x4dd7d0[_0x3376('0x49')]['id']},'attributes':['id',_0x3376('0x79'),_0x3376('0x7a')],'raw':!![]};return db['ChatWebsite']['find'](_0xaccca4)[_0x3376('0x12')](handleEntityNotFound(_0x271257,null))[_0x3376('0x12')](function(_0xeff34a){if(_0xeff34a){if(!_[_0x3376('0x71')](_0xeff34a[_0x3376('0x79')])){if(fs[_0x3376('0x72')](path[_0x3376('0x6b')](config['root'],'server/files/images/avatars/',_0xeff34a[_0x3376('0x79')]))&&_0xeff34a['showCustomerAvatar']){_0xbe2f36=path['join'](config[_0x3376('0x6c')],_0x3376('0x76'),_0xeff34a[_0x3376('0x79')]);}}return _0x271257[_0x3376('0x74')](_0xbe2f36);}})['catch'](handleError(_0x271257,null));};exports[_0x3376('0x7b')]=function(_0x524ea9,_0x2c2cc2){var _0x30e357=path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server/files/images/avatars/system_avatar.png');var _0x5dc46e={'where':{'id':_0x524ea9[_0x3376('0x49')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x3376('0x45')][_0x3376('0x4b')](_0x5dc46e)['then'](handleEntityNotFound(_0x2c2cc2,null))[_0x3376('0x12')](function(_0x42a250){if(_0x42a250){if(!_['isNil'](_0x42a250[_0x3376('0x6a')])){if(fs[_0x3376('0x72')](path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x76'),_0x42a250[_0x3376('0x6a')]))){_0x30e357=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x76'),_0x42a250[_0x3376('0x6a')]);}}return _0x2c2cc2[_0x3376('0x74')](_0x30e357);}})[_0x3376('0x47')](handleError(_0x2c2cc2,null));};exports[_0x3376('0x7c')]=function(_0x1dadf0,_0x53fddc){var _0x2bd794=require(_0x3376('0x7d'));var _0x3a0933=new _0x2bd794();var _0x182bcc=_0x3a0933[_0x3376('0x7e')](_0x1dadf0[_0x3376('0x7f')][_0x3376('0x80')])[_0x3376('0x81')]();var _0x14963e={'body':_0x1dadf0[_0x3376('0x4d')],'channel':_0x3376('0x82')};var _0x52726c=[];var _0x3f3eec=[];var _0x379f28={};var _0xab62d=![];return db['CmContact'][_0x3376('0x54')]()[_0x3376('0x12')](function(_0xfdf5e4){if(!_0xfdf5e4){throw new db[(_0x3376('0x83'))][(_0x3376('0x84'))]('no\x20available\x20attributes');}_0x52726c=_[_0x3376('0x85')](_[_0x3376('0x35')](_0xfdf5e4),[_0x3376('0x86'),_0x3376('0x87')]);_0x3f3eec=_[_0x3376('0x85')](_[_0x3376('0x35')](_0xfdf5e4),[_0x3376('0x86'),'updatedAt',_0x3376('0x88'),_0x3376('0x89')]);if(_0x1dadf0[_0x3376('0x4d')]['id']){delete _0x1dadf0[_0x3376('0x4d')]['id'];}if(_[_0x3376('0x71')](_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8a')])){throw new db[(_0x3376('0x83'))][(_0x3376('0x84'))](_0x3376('0x8b'));}if(_[_0x3376('0x71')](_0x1dadf0[_0x3376('0x4d')][_0x3376('0x4d')])||_0x1dadf0['body'][_0x3376('0x4d')]===''){throw new db[(_0x3376('0x83'))]['ValidationError'](_0x3376('0x8c'));}if(_[_0x3376('0x71')](_0x1dadf0['body'][_0x3376('0x8d')])){throw new db[(_0x3376('0x83'))][(_0x3376('0x84'))](_0x3376('0x8e')+_0x3f3eec);}if(!_['includes'](_0x3f3eec,_0x1dadf0['body'][_0x3376('0x8d')])){throw new db[(_0x3376('0x83'))]['ValidationError'](_0x3376('0x8f')+_0x3f3eec);}_0x379f28[_0x1dadf0['body'][_0x3376('0x8d')]]=_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8a')];})['then'](function(){return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x1dadf0[_0x3376('0x49')]['id']},'include':[{'model':db[_0x3376('0x90')],'as':_0x3376('0x91'),'include':[{'model':db[_0x3376('0x92')],'as':_0x3376('0x93'),'where':_0x379f28,'limit':0x1,'order':[[_0x3376('0x87'),'DESC']]}]},{'model':db[_0x3376('0x94')],'as':_0x3376('0x95')}]});})[_0x3376('0x12')](handleEntityNotFound(_0x53fddc,null))['then'](function(_0x532f39){if(_0x532f39&&_0x532f39[_0x3376('0x91')]){_0x14963e[_0x3376('0x96')]=_0x532f39;_0x14963e['applications']=_0x532f39[_0x3376('0x95')];_0x14963e[_0x3376('0x97')]=_0x532f39[_0x3376('0x91')];_0x14963e['applications']=_[_0x3376('0x98')](_0x14963e[_0x3376('0x99')],['priority'],[_0x3376('0x9a')]);if(_0x14963e[_0x3376('0x96')][_0x3376('0x95')]){delete _0x14963e[_0x3376('0x96')]['Applications'];}if(_0x14963e[_0x3376('0x96')][_0x3376('0x91')]&&_0x14963e[_0x3376('0x96')][_0x3376('0x91')][_0x3376('0x93')][_0x3376('0x3a')]){return _0x14963e['account'][_0x3376('0x91')]['Contacts'][0x0];}var _0x487081=_[_0x3376('0xa')](_0x1dadf0[_0x3376('0x4d')],{'firstName':_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8a')],'ListId':_0x532f39[_0x3376('0x89')]});_0x487081[_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8d')]]=_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8a')];return db['CmContact'][_0x3376('0x4c')](_0x487081,{'fields':_0x52726c,'raw':!![]});}})[_0x3376('0x12')](handleEntityNotFound(_0x53fddc,null))[_0x3376('0x12')](function(_0x1e5e80){_0x14963e['contact']=_0x1e5e80;var _0x19cee5=_0x1dadf0[_0x3376('0x4d')][_0x3376('0x9b')];if(_0x1dadf0['headers'][_0x3376('0x9c')]){_0x19cee5=_0x1dadf0[_0x3376('0x7f')][_0x3376('0x9c')];}else if(_0x1dadf0[_0x3376('0x7f')][_0x3376('0x9d')]){_0x19cee5=_[_0x3376('0x9e')](_0x1dadf0['headers'][_0x3376('0x9d')][_0x3376('0x9f')](','));}if(_0x1e5e80){var _0xc2e5ba={'ContactId':_0x1e5e80['id'],'ChatWebsiteId':_0x1dadf0[_0x3376('0x49')]['id'],'from':(_0x1e5e80['firstName']||'')+'\x20'+(_0x1e5e80[_0x3376('0xa0')]||''),'customerIp':_0x19cee5,'customerPort':_0x1dadf0[_0x3376('0x7f')][_0x3376('0xa1')]?_0x1dadf0['headers'][_0x3376('0xa1')]:null,'referer':_0x1dadf0[_0x3376('0x4d')][_0x3376('0xa2')],'browserName':_0x182bcc[_0x3376('0xa3')][_0x3376('0x2a')]&&_0x182bcc['browser'][_0x3376('0xa4')]?util['format'](_0x3376('0xa5'),_0x182bcc[_0x3376('0xa3')][_0x3376('0x2a')],_0x182bcc[_0x3376('0xa3')][_0x3376('0xa4')]):_0x3376('0xa6'),'browserVersion':_0x182bcc[_0x3376('0xa3')]['version']||_0x3376('0xa6'),'osName':util['format'](_0x3376('0xa5'),_0x182bcc['os'][_0x3376('0x2a')],_0x182bcc['os']['version']),'osVersion':_0x182bcc['os']['version'],'deviceModel':_0x182bcc[_0x3376('0xa7')][_0x3376('0x33')]&&_0x182bcc[_0x3376('0xa7')][_0x3376('0xa8')]?util['format'](_0x3376('0xa9'),_0x182bcc['device']['model'],_0x182bcc['device'][_0x3376('0xa8')],_0x182bcc['device']['type']):null,'deviceVendor':_0x182bcc[_0x3376('0xa7')][_0x3376('0xa8')],'deviceType':_0x182bcc[_0x3376('0xa7')]['type'],'formData':JSON[_0x3376('0x16')](_0x1dadf0[_0x3376('0x4d')])};var _0x114b0e={'ChatWebsiteId':_0x1dadf0[_0x3376('0x49')]['id'],'closed':![]};if(_0x1dadf0[_0x3376('0x4d')]['threadId']){_0x114b0e['threadId']=_0x1dadf0[_0x3376('0x4d')][_0x3376('0xaa')];return db[_0x3376('0xab')][_0x3376('0x4b')]({'where':_0x114b0e})[_0x3376('0x12')](function(_0x523cc4){if(_0x523cc4){return[_0x523cc4,![]];}_0xc2e5ba[_0x3376('0xaa')]=_0x1dadf0[_0x3376('0x4d')]['threadId'];_0xc2e5ba[_0x3376('0xac')]=_0x1dadf0[_0x3376('0x4d')][_0x3376('0xac')];return db[_0x3376('0xab')]['create'](_0xc2e5ba)['then'](function(_0x52ae33){return[_0x52ae33,!![]];});});}_0x114b0e[_0x3376('0xad')]=_0x1e5e80['id'];if(_0x1dadf0['body'][_0x3376('0xae')]&&_0x1dadf0[_0x3376('0x4d')][_0x3376('0xae')]['id']){_0x114b0e['id']=_0x1dadf0[_0x3376('0x4d')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0x114b0e})[_0x3376('0x12')](function(_0x5cba15){if(_0x5cba15){return[_0x5cba15,![]];}return db['ChatInteraction'][_0x3376('0x4c')](_0xc2e5ba)[_0x3376('0x12')](function(_0x4521a4){return[_0x4521a4,!![]];});});}return db[_0x3376('0xab')]['create'](_0xc2e5ba)[_0x3376('0x12')](function(_0x570423){return[_0x570423,!![]];});}})[_0x3376('0xaf')](function(_0x454df8,_0x467846){if(_0x454df8){_0xab62d=_0x467846;if(!_0x467846){var _0x51b692={'from':(_0x14963e[_0x3376('0xb0')][_0x3376('0xb1')]||'')+'\x20'+(_0x14963e[_0x3376('0xb0')]['lastName']||'')};if(_0x1dadf0[_0x3376('0x4d')][_0x3376('0xaa')]&&_0x1dadf0['body'][_0x3376('0xb2')]&&_0x1dadf0['body'][_0x3376('0xaa')]!=_0x1dadf0[_0x3376('0x4d')][_0x3376('0xb2')]){_0x51b692['threadId']=_0x1dadf0[_0x3376('0x4d')][_0x3376('0xb2')];}return _0x454df8[_0x3376('0x25')](_0x51b692);}else{return _0x454df8;}}})[_0x3376('0x12')](function(_0x1ecfc8){_0x14963e[_0x3376('0xae')]=_0x1ecfc8[_0x3376('0x27')]({'plain':!![]});_0x14963e[_0x3376('0xae')][_0x3376('0xb3')]=_0xab62d;if(_0x14963e[_0x3376('0xae')][_0x3376('0xb3')]){if(_0x14963e[_0x3376('0x96')]['autoclose']){_0x14963e[_0x3376('0x99')][_0x3376('0xb4')]({'id':0x0,'priority':_0x14963e[_0x3376('0x99')][_0x3376('0x3a')]+0x1,'app':'close','appdata':_0x3376('0xb5'),'interval':_0x3376('0xb6')});}}return db[_0x3376('0xb7')][_0x3376('0x4c')]({'body':_0x1dadf0[_0x3376('0x4d')][_0x3376('0x4d')],'ChatWebsiteId':_0x1dadf0[_0x3376('0x49')]['id'],'ChatInteractionId':_0x1ecfc8['id'],'direction':'in','ContactId':_0x14963e[_0x3376('0xb0')]['id'],'AttachmentId':_0x1dadf0[_0x3376('0x4d')][_0x3376('0xb8')]});})['then'](function(_0x4f8596){_0x14963e[_0x3376('0x19')]=_0x4f8596;if(_0x14963e[_0x3376('0xae')][_0x3376('0xb9')]){return db[_0x3376('0xba')]['find']({'attributes':['id','name'],'where':{'id':_0x14963e['interaction'][_0x3376('0xb9')]}})[_0x3376('0x12')](function(_0x5162f4){if(_0x5162f4){_0x14963e[_0x3376('0x99')][_0x3376('0xbb')]({'id':0x0,'priority':0x0,'app':_0x3376('0xbc'),'appdata':_0x5162f4[_0x3376('0x2a')]+','+(_0x14963e[_0x3376('0x96')][_0x3376('0xbd')]||0xa),'interval':_0x3376('0xb6')});_0x14963e[_0x3376('0xbe')]=!![];}return respondWithRpcPromise(_0x3376('0xbf'),_0x3376('0xc0'),_0x14963e);});}return respondWithRpcPromise(_0x3376('0xbf'),_0x3376('0xc0'),_0x14963e);})[_0x3376('0x12')](function(_0x596732){respondWithRpcPromise(_0x3376('0xc1'),'EventManager',{'event':'notify','message':_0x596732},client9002);return _0x596732;})[_0x3376('0x12')](respondWithResult(_0x53fddc,null))[_0x3376('0x47')](handleError(_0x53fddc,null));};exports[_0x3376('0xc2')]=function(_0x111691,_0x5317ce){var _0x298549,_0x27deff,_0xdcbab1;var _0x210ffe=[];var _0xfdd552={};var _0x10ba2f=_0x111691[_0x3376('0xc3')]||[];var _0x62862=[];var _0x13a00b;return db[_0x3376('0x92')]['describe']()[_0x3376('0x12')](function(_0x1ea14d){if(!_0x1ea14d){throw new db['Sequelize'][(_0x3376('0x84'))](_0x3376('0xc4'));}_0x210ffe=_[_0x3376('0x85')](_[_0x3376('0x35')](_0x1ea14d),[_0x3376('0x86'),_0x3376('0x87'),'CompanyId','ListId']);if(_0x111691[_0x3376('0x4d')]['id']){delete _0x111691[_0x3376('0x4d')]['id'];}if(_[_0x3376('0x71')](_0x111691[_0x3376('0x4d')][_0x3376('0x8a')])){throw _0x5317ce[_0x3376('0x1d')](0x1f4)[_0x3376('0x2b')](new db['Sequelize'][(_0x3376('0x84'))](_0x3376('0x8b')));}if(_[_0x3376('0x71')](_0x111691[_0x3376('0x4d')][_0x3376('0x4d')])||_0x111691['body'][_0x3376('0x4d')]===''){throw _0x5317ce[_0x3376('0x1d')](0x1f4)['send'](new db[(_0x3376('0x83'))][(_0x3376('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x111691[_0x3376('0x4d')][_0x3376('0xc5')])){throw _0x5317ce[_0x3376('0x1d')](0x1f4)[_0x3376('0x2b')](new db[(_0x3376('0x83'))]['ValidationError'](_0x3376('0xc6')+_0x210ffe));}if(!_[_0x3376('0xc7')](_0x210ffe,_0x111691[_0x3376('0x4d')][_0x3376('0xc5')])){throw _0x5317ce[_0x3376('0x1d')](0x1f4)[_0x3376('0x2b')](new db[(_0x3376('0x83'))][(_0x3376('0x84'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x210ffe));}_0xfdd552[_0x111691[_0x3376('0x4d')]['mapKeyOffline']]=_0x111691['body']['from'];})[_0x3376('0x12')](function(){return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x111691['params']['id']},'include':[{'model':db[_0x3376('0x90')],'as':_0x3376('0x91')},{'model':db[_0x3376('0xc8')],'as':_0x3376('0xc8')}]});})[_0x3376('0x12')](handleEntityNotFound(_0x5317ce,null))[_0x3376('0x12')](function(_0x4b76b4){if(_0x4b76b4&&_0x4b76b4[_0x3376('0x91')]){_0x27deff=_0x4b76b4;var _0x5e322a=_[_0x3376('0xa')](_0x111691[_0x3376('0x4d')],{'firstName':_0x111691[_0x3376('0x4d')]['from'],'phone':_0x111691[_0x3376('0x4d')][_0x3376('0x8a')],'ListId':_0x4b76b4['ListId']});_0x5e322a[_0x111691[_0x3376('0x4d')][_0x3376('0xc5')]]=_0x111691['body']['from'];return db['CmContact']['findOrCreate']({'where':_0xfdd552,'defaults':_0x5e322a});}})[_0x3376('0xaf')](function(_0x55f25d){if(_0x55f25d){_0xdcbab1=_0x55f25d;var _0x50a308=fs[_0x3376('0xc9')](path[_0x3376('0x6b')](config['root'],_0x3376('0xca')),_0x3376('0xcb'));var _0x15c488=ejs['render'](_0x50a308,{'body':_['toPairs'](_0x111691[_0x3376('0x4d')]['body']),'bodyTitle':_0x27deff[_0x3376('0xcc')]});return db[_0x3376('0xcd')]['create']({'body':_0x15c488,'plainBody':htmlToText[_0x3376('0xce')](_0x15c488),'ContactId':_0x55f25d['id'],'ChatWebsiteId':_0x27deff['id']});}})[_0x3376('0x12')](function(_0x2ee6d3){_0x13a00b=_0x2ee6d3;if(_0x10ba2f[_0x3376('0x3a')]){var _0x8e717b=_0x10ba2f[_0x3376('0x2f')](function(_0x1f237e){return{'name':_0x1f237e[_0x3376('0xcf')],'basename':_0x1f237e['filename'],'type':_0x1f237e[_0x3376('0xd0')],'ChatOfflineMessageId':_0x2ee6d3['id']};});_0x62862=_0x8e717b[_0x3376('0x2f')](_0x57dda7=>{var _0x4a6224={'filename':_0x57dda7[_0x3376('0x2a')],'path':path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server',_0x3376('0xc3'),_0x3376('0xd1'),_0x3376('0xd2'),_0x57dda7[_0x3376('0xd3')])};return _0x4a6224;});if(!_0x27deff['openNewInteraction']){return db[_0x3376('0xd4')][_0x3376('0xd5')](function(_0x30c282){return db[_0x3376('0xd6')][_0x3376('0xd7')](_0x8e717b,{'transaction':_0x30c282});});}}})[_0x3376('0x12')](function(){if(_0x13a00b){_0x298549=_0x13a00b;return db[_0x3376('0xc8')][_0x3376('0x59')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x3376('0xd8')],'as':_0x3376('0xd8'),'raw':!![]}]}]});}})[_0x3376('0x12')](function(_0x96a06b){if(_0x96a06b&&_0x96a06b['Smtp']&&_0x27deff[_0x3376('0xd9')]&&_0x27deff[_0x3376('0xda')]){var _0xd90095=_0x96a06b['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0xd90095,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x96a06b['name'],_0x96a06b[_0x3376('0xdb')]||_0x96a06b[_0x3376('0xdc')][_0x3376('0x4f')]),'to':_0x27deff[_0x3376('0xda')],'subject':_0x27deff[_0x3376('0xdd')],'html':_0x298549[_0x3376('0x4d')],'attachments':_0x62862}},client9003)[_0x3376('0x12')](function(){return _0x298549;})[_0x3376('0x47')](function(_0x2ec796){logger[_0x3376('0x17')](_0x2ec796);});}})[_0x3376('0x12')](function(){if(_0x27deff&&_0x27deff[_0x3376('0xde')]&&_0x27deff[_0x3376('0xdf')]){var _0x28b2e7=[];if(_0x10ba2f['length']){_0x28b2e7=_0x10ba2f[_0x3376('0x2f')](function(_0x3940b5){return{'name':_0x3940b5['originalname'],'basename':_0x3940b5[_0x3376('0x66')],'type':_0x3940b5['mimetype'],'ChatOfflineMessageId':_0x13a00b['id']};});}var _0x416780;if(!_[_0x3376('0x71')](_0x27deff[_0x3376('0xe0')])){var _0xb47ba4=_[_0x3376('0x2f')](_0x111691[_0x3376('0x4d')],function(_0xcbf102){return _0xcbf102;});var _0x14b527=_[_0x3376('0xe1')](_0xb47ba4)[0x0];var _0x15e2b0=_['mapValues'](_0x14b527,function(_0x439031){return _0x439031;});_0x416780=_0x15e2b0[0x1][_0x27deff[_0x3376('0xe0')]];}var _0x1e550e={'from':_0xdcbab1[_0x3376('0xdb')],'firstName':_0xdcbab1['firstName'],'lastName':_0xdcbab1[_0x3376('0xa0')],'mapKey':_0x3376('0xdb'),'message':{'from':_0xdcbab1[_0x3376('0xdb')],'to':_0x27deff['MailAccount']['email'],'cc':'','subject':_[_0x3376('0x71')](_0x416780)?_0x27deff['offlineMessageSubject']:_0x416780,'messageId':'','sentAt':new Date(),'attach':_0x28b2e7['length'],'attachments':_0x28b2e7,'originChannel':'Chat','ChatWebsiteId':_0x27deff['id'],'ChatOfflineMessageId':_0x298549['id'],'originTo':_0x27deff[_0x3376('0xc8')][_0x3376('0xdb')]},'body':_0x298549[_0x3376('0x4d')]};var _0x348c11={'account':{'id':_0x27deff[_0x3376('0xdf')]},'body':_0x1e550e,'log':_0x3376('0xe2')};return respondWithRpcPromise('NotifyMailAccount',_0x3376('0xe3'),_0x348c11,client9001)[_0x3376('0x12')](function(){return _0x298549;})['catch'](function(_0x304647){logger['error'](_0x304647);});}return;})['then'](function(){if(_0x298549){return _0x298549;}})[_0x3376('0x12')](respondWithResult(_0x5317ce,null))[_0x3376('0x47')](function(_0x479ff3){logger[_0x3376('0x17')](_0x3376('0x47'),_0x479ff3);for(var _0x5fb0b2 of _0x10ba2f){var _0x2f8d92=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0xe4'),_0x3376('0xc3'),_0x3376('0xd1'),_0x3376('0xd2'),_0x5fb0b2['filename']);fs_extra[_0x3376('0xe5')](_0x2f8d92)[_0x3376('0x47')](function(_0x4ea6d3){logger[_0x3376('0x17')](_0x3376('0xe6'),_0x2f8d92,_0x4ea6d3);});}});};exports['addInteraction']=function(_0x41ee52,_0x40255f){return db[_0x3376('0xab')][_0x3376('0x4b')]({'where':{'id':_0x41ee52[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x40255f,null))['then'](function(_0x4fcf14){if(_0x4fcf14){return _0x4fcf14['addInteraction'](_0x41ee52[_0x3376('0x4d')][_0x3376('0x5d')],_[_0x3376('0xe7')](_0x41ee52['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x40255f,null))['catch'](handleError(_0x40255f,null));};exports[_0x3376('0xe8')]=function(_0x4e2737,_0x3772c8){var _0x4404ec={'raw':![],'where':{}};var _0x20ad74={};var _0x3a9e06={'count':0x0,'rows':[]};return db[_0x3376('0x45')]['findOne']({'where':{'id':_0x4e2737['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x3772c8,null))['then'](function(_0x12ad75){if(_0x12ad75){_0x20ad74[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0xab')][_0x3376('0x30')]);_0x20ad74[_0x3376('0x34')]=_[_0x3376('0x35')](_0x4e2737[_0x3376('0x34')]);_0x20ad74[_0x3376('0x36')]=_[_0x3376('0x37')](_0x20ad74[_0x3376('0x33')],_0x20ad74[_0x3376('0x34')]);_0x4404ec[_0x3376('0x39')]=_[_0x3376('0x37')](_0x20ad74[_0x3376('0x33')],qs[_0x3376('0x38')](_0x4e2737[_0x3376('0x34')][_0x3376('0x38')]));_0x4404ec[_0x3376('0x39')]=_0x4404ec[_0x3376('0x39')]['length']?_0x4404ec[_0x3376('0x39')]:_0x20ad74[_0x3376('0x33')];if(!_0x4e2737[_0x3376('0x34')][_0x3376('0x61')](_0x3376('0x3b'))){_0x4404ec[_0x3376('0x21')]=qs[_0x3376('0x21')](_0x4e2737[_0x3376('0x34')][_0x3376('0x21')]);_0x4404ec['offset']=qs[_0x3376('0x1f')](_0x4e2737[_0x3376('0x34')][_0x3376('0x1f')]);}_0x4404ec['order']=qs['sort'](_0x4e2737[_0x3376('0x34')][_0x3376('0x3c')]);_0x4404ec[_0x3376('0x3d')]=qs[_0x3376('0x36')](_[_0x3376('0x3e')](_0x4e2737[_0x3376('0x34')],_0x20ad74['filters']));_0x4404ec[_0x3376('0x3d')][_0x3376('0x56')]=_0x12ad75['id'];if(_0x4e2737[_0x3376('0x34')][_0x3376('0x41')]){_0x4404ec[_0x3376('0x3d')]=_['merge'](_0x4404ec[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x4404ec[_0x3376('0x39')],function(_0x56e009){var _0x3a2eb3={};_0x3a2eb3[_0x56e009]={'$like':'%'+_0x4e2737[_0x3376('0x34')][_0x3376('0x41')]+'%'};return _0x3a2eb3;})});}_0x4404ec=_[_0x3376('0x42')]({},_0x4404ec,_0x4e2737['options']);return db[_0x3376('0xab')]['count']({'where':_0x4404ec[_0x3376('0x3d')]})[_0x3376('0x12')](function(_0x2752a7){_0x3a9e06[_0x3376('0x22')]=_0x2752a7;if(_0x4e2737['query'][_0x3376('0x43')]){_0x4404ec[_0x3376('0x44')]=[{'model':db[_0x3376('0x92')],'as':'Contact','required':![]},{'model':db[_0x3376('0xba')],'as':_0x3376('0xe9'),'attributes':[_0x3376('0x2a'),_0x3376('0xea'),_0x3376('0xeb')],'required':![]},{'model':db['Tag'],'as':_0x3376('0xec'),'attributes':['id',_0x3376('0x2a'),_0x3376('0xed')],'where':_0x4e2737[_0x3376('0x34')][_0x3376('0xee')]?{'id':_0x4e2737[_0x3376('0x34')][_0x3376('0xee')]}:undefined,'required':_0x4e2737[_0x3376('0x34')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0x3376('0x46')](_0x4404ec);})[_0x3376('0x12')](function(_0x417085){_0x3a9e06['rows']=_0x417085;return _0x3a9e06;});}})['then'](respondWithFilteredResult(_0x3772c8,_0x4404ec))['catch'](handleError(_0x3772c8,null));};function iftimePromise(_0x2e7bd5,_0x3f4da3){return respondWithRpcPromise(_0x3376('0xef'),_0x3376('0xf0'),{'command':_0x3f4da3['timezone']?util['format'](_0x3376('0xf1'),_0x2e7bd5[_0x3376('0xf2')],_0x3f4da3['timezone']):util[_0x3376('0xf3')](_0x3376('0xf4'),_0x2e7bd5['interval'])},client9002)[_0x3376('0x12')](function(_0x110314){var _0x2572c1=_0x110314&&_0x110314[_0x3376('0xf5')](_0x3376('0xf6'))>=0x0?!![]:![];logger['info'](_0x3376('0xf7'),_0x3f4da3['id'],_0x2e7bd5['id'],_0x2e7bd5['interval'],_0x2572c1?_0x3376('0xf8'):_0x3376('0xf9'),_0x3f4da3[_0x3376('0xfa')]?_0x3f4da3[_0x3376('0xfa')]:_0x3376('0xfb'));return _0x2572c1;})[_0x3376('0x47')](function(_0x131371){logger[_0x3376('0x17')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3f4da3['id'],_0x2e7bd5['id'],_0x2e7bd5[_0x3376('0xf2')],util[_0x3376('0xfc')](_0x131371,{'showHidden':![],'depth':null}),_0x3f4da3[_0x3376('0xfa')]?_0x3f4da3[_0x3376('0xfa')]:_0x3376('0xfb'));return![];});}exports[_0x3376('0xf0')]=function(_0x2c13f6,_0x5779bc){var _0x118370=0x0;var _0x4b3178=0x0;var _0x34e9d0=![];var _0x27b3b6;var _0x14f0c2;return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x2c13f6[_0x3376('0x49')]['id']},'include':[{'model':db[_0x3376('0xfd')],'as':_0x3376('0xfd'),'include':[{'model':db[_0x3376('0xfd')],'as':_0x3376('0xfe'),'attributes':['id',_0x3376('0xf2')],'raw':!![]}]}]})[_0x3376('0x12')](handleEntityNotFound(_0x5779bc,null))['then'](function(_0x4d4a0f){if(_0x4d4a0f){_0x27b3b6=_0x4d4a0f;return _0x4d4a0f[_0x3376('0xff')]({'raw':!![]});}})['then'](function(_0x386f00){if(_0x27b3b6){if(_0x386f00){_0x14f0c2=_0x386f00;}}return require(_0x3376('0x6e'))[_0x3376('0x6f')]();})['then'](function(_0x41cb33){if(_0x41cb33){_0x4b3178=_0x41cb33['virtual'];_0x34e9d0=_0x41cb33[_0x3376('0x70')];}})[_0x3376('0x12')](function(){return db[_0x3376('0xab')]['count']({'where':{'closed':![]}});})[_0x3376('0x12')](function(_0x2b0529){_0x118370=_0x2b0529;if(_0x4b3178&&_0x2b0529>_0x4b3178){return db['License'][_0x3376('0x59')]({'where':{'id':0x1}})[_0x3376('0x12')](function(_0x42e622){if(_0x42e622){_0x42e622[_0x3376('0x100')](_0x3376('0x101'));}});}})['then'](function(){if(_0x27b3b6['Interval']&&_0x27b3b6[_0x3376('0xfd')][_0x3376('0xfe')]){var _0x209f03=[];for(var _0x303d58=0x0;_0x303d58<_0x27b3b6[_0x3376('0xfd')][_0x3376('0xfe')][_0x3376('0x3a')];_0x303d58++){var _0x482f5b=_0x27b3b6[_0x3376('0xfd')][_0x3376('0xfe')][_0x303d58]['get']({'plain':!![]});_0x209f03[_0x3376('0xb4')](iftimePromise(_0x482f5b,_0x27b3b6));}return BPromise['all'](_0x209f03)[_0x3376('0x12')](function(_0x4b527d){return _['some'](_0x4b527d);});}else{return!![];}})['then'](function(_0x13eb6f){var _0xbfd25f=fs['readFileSync'](path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server/files/chat/iframe.ejs'),_0x3376('0xcb'));var _0x27ded8={'remote':_0x27b3b6[_0x3376('0x102')],'query':querystring[_0x3376('0x16')](_[_0x3376('0x42')](_0x27b3b6[_0x3376('0x27')]({'plain':!![]}),{'customerIp':_0x2c13f6[_0x3376('0x7f')]['x-forwarded-for']||_0x2c13f6[_0x3376('0x7f')]['x-real-ip']||_0x2c13f6[_0x3376('0x103')][_0x3376('0x104')]||_0x2c13f6['ip'],'referer':_0x2c13f6['headers'][_0x3376('0xa2')],'openedInteractions':_0x118370,'maxInteractions':_0x4b3178,'virtual':_0x34e9d0[_0x3376('0x105')],'online':_0x13eb6f,'custom':_0x34e9d0}))[_0x3376('0x106')](/'/g,'\x5c\x27')};_0x5779bc['send'](ejs['render'](Mustache[_0x3376('0x107')](_0xbfd25f,_0x27ded8),{'proactiveActions':_0x14f0c2,'alignment':_0x27b3b6[_0x3376('0x108')],'verticalAlignment':_0x27b3b6['verticalAlignment'],'div_color':_0x27b3b6[_0x3376('0xed')],'labelText':_0x27b3b6[_0x3376('0x109')],'text_color':_0x27b3b6[_0x3376('0x10a')],'text_button_color':_0x27b3b6[_0x3376('0x10b')],'button_color':_0x27b3b6[_0x3376('0x10c')],'background_color':_0x27b3b6[_0x3376('0x10d')],'hideWhenOffline':_0x27b3b6[_0x3376('0x10e')],'interval':_0x27b3b6[_0x3376('0x10f')]}));})[_0x3376('0x47')](handleError(_0x5779bc,null));};exports['addApplications']=function(_0x3ed193,_0x3096b0){var _0x5377ce=_0x3ed193[_0x3376('0x49')]['id'];var _0x1a9863=_0x3ed193[_0x3376('0x4d')];var _0x3b9250=0xc8;var _0x455ac2=null;return db[_0x3376('0xd4')]['transaction']({'isolationLevel':db['sequelize'][_0x3376('0x110')][_0x3376('0x111')][_0x3376('0x112')]},function(_0x4fc043){return db['ChatWebsite'][_0x3376('0x59')]({'where':{'id':_0x5377ce},'transaction':_0x4fc043})['then'](function(_0x3c1bf9){if(_0x3c1bf9){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x5377ce},'transaction':_0x4fc043})[_0x3376('0x12')](function(){var _0x1754fa=_[_0x3376('0x2f')](_0x1a9863,function(_0x548d9c){_0x548d9c[_0x3376('0x56')]=_0x5377ce;return _0x548d9c;});return db[_0x3376('0x94')][_0x3376('0xd7')](_0x1754fa,{'transaction':_0x4fc043});});}else{_0x3b9250=0x194;_0x455ac2=[];}});})[_0x3376('0x12')](function(){if(_0x3b9250!==0x194){return db[_0x3376('0x94')][_0x3376('0x113')]({'where':{'ChatWebsiteId':_0x5377ce},'order':_0x3376('0x114')})['then'](function(_0x1307ec){_0x455ac2=_0x1307ec;});}})[_0x3376('0x47')](function(_0x2af281){_0x3b9250=0x1f4;logger['error'](_0x2af281[_0x3376('0x29')]);if(_0x2af281['name']){delete _0x2af281[_0x3376('0x2a')];}_0x455ac2=_0x2af281;})['finally'](function(){if(_0x455ac2===null){_0x3096b0[_0x3376('0x1b')](_0x3b9250);}else{if(_0x3b9250===0x1f4){_0x3096b0['status'](_0x3b9250)[_0x3376('0x2b')](_0x455ac2);}else{_0x3096b0[_0x3376('0x1d')](_0x3b9250)[_0x3376('0x1e')](_0x455ac2);}}});};exports['getApplications']=function(_0x1ca712,_0x10afc0){var _0x2fccd3={};var _0x3b39c8={};var _0x50baec;var _0x1c0b1d;return db[_0x3376('0x45')][_0x3376('0x59')]({'where':{'id':_0x1ca712[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x10afc0,null))[_0x3376('0x12')](function(_0x44b4e2){if(_0x44b4e2){_0x50baec=_0x44b4e2;_0x3b39c8['model']=_[_0x3376('0x35')](db['ChatApplication']['rawAttributes']);_0x3b39c8[_0x3376('0x34')]=_['keys'](_0x1ca712[_0x3376('0x34')]);_0x3b39c8['filters']=_[_0x3376('0x37')](_0x3b39c8['model'],_0x3b39c8['query']);_0x2fccd3['attributes']=_[_0x3376('0x37')](_0x3b39c8['model'],qs[_0x3376('0x38')](_0x1ca712[_0x3376('0x34')][_0x3376('0x38')]));_0x2fccd3['attributes']=_0x2fccd3[_0x3376('0x39')]['length']?_0x2fccd3[_0x3376('0x39')]:_0x3b39c8[_0x3376('0x33')];_0x2fccd3[_0x3376('0x5a')]=qs[_0x3376('0x3c')](_0x1ca712[_0x3376('0x34')][_0x3376('0x3c')]);_0x2fccd3[_0x3376('0x3d')]=qs[_0x3376('0x36')](_['pick'](_0x1ca712[_0x3376('0x34')],_0x3b39c8[_0x3376('0x36')]));if(_0x1ca712[_0x3376('0x34')]['filter']){_0x2fccd3[_0x3376('0x3d')]=_[_0x3376('0x42')](_0x2fccd3['where'],{'$or':_[_0x3376('0x2f')](_0x2fccd3[_0x3376('0x39')],function(_0x58040a){var _0x1ede0b={};_0x1ede0b[_0x58040a]={'$like':'%'+_0x1ca712['query'][_0x3376('0x41')]+'%'};return _0x1ede0b;})});}_0x2fccd3=_[_0x3376('0x42')]({},_0x2fccd3,_0x1ca712[_0x3376('0x4a')]);return _0x50baec[_0x3376('0x115')](_0x2fccd3);}})['then'](function(_0x20b48c){if(_0x20b48c){_0x1c0b1d=_0x20b48c[_0x3376('0x3a')];if(!_0x1ca712['query'][_0x3376('0x61')](_0x3376('0x3b'))){_0x2fccd3[_0x3376('0x21')]=qs[_0x3376('0x21')](_0x1ca712[_0x3376('0x34')][_0x3376('0x21')]);_0x2fccd3['offset']=qs[_0x3376('0x1f')](_0x1ca712['query'][_0x3376('0x1f')]);}return _0x50baec['getApplications'](_0x2fccd3);}})['then'](function(_0x1ed0a0){if(_0x1ed0a0){return _0x1ed0a0?{'count':_0x1c0b1d,'rows':_0x1ed0a0}:null;}})['then'](respondWithResult(_0x10afc0,null))[_0x3376('0x47')](handleError(_0x10afc0,null));};exports[_0x3376('0x116')]=function(_0x6163b9,_0x5ee2c8){return db['chatProactiveAction']['find']({'where':{'id':_0x6163b9[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x5ee2c8,null))[_0x3376('0x12')](function(_0xb9bcaf){if(_0xb9bcaf){return _0xb9bcaf['addProactiveActions'](_0x6163b9[_0x3376('0x4d')][_0x3376('0x5d')],_[_0x3376('0xe7')](_0x6163b9['body'],[_0x3376('0x5d'),'id'])||{});}})[_0x3376('0x12')](respondWithResult(_0x5ee2c8,null))['catch'](handleError(_0x5ee2c8,null));};exports[_0x3376('0xff')]=function(_0x1f8554,_0x55fea7){var _0x20e341={};var _0x21d463={};var _0x56b762;var _0x1d99a7;return db[_0x3376('0x45')][_0x3376('0x59')]({'where':{'id':_0x1f8554['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x55fea7,null))[_0x3376('0x12')](function(_0xb52e37){if(_0xb52e37){_0x56b762=_0xb52e37;_0x21d463['model']=_[_0x3376('0x35')](db[_0x3376('0x117')][_0x3376('0x30')]);_0x21d463['query']=_[_0x3376('0x35')](_0x1f8554['query']);_0x21d463[_0x3376('0x36')]=_['intersection'](_0x21d463[_0x3376('0x33')],_0x21d463[_0x3376('0x34')]);_0x20e341[_0x3376('0x39')]=_[_0x3376('0x37')](_0x21d463['model'],qs[_0x3376('0x38')](_0x1f8554[_0x3376('0x34')][_0x3376('0x38')]));_0x20e341[_0x3376('0x39')]=_0x20e341[_0x3376('0x39')][_0x3376('0x3a')]?_0x20e341[_0x3376('0x39')]:_0x21d463['model'];_0x20e341['order']=qs[_0x3376('0x3c')](_0x1f8554[_0x3376('0x34')][_0x3376('0x3c')]);_0x20e341['where']=qs[_0x3376('0x36')](_['pick'](_0x1f8554[_0x3376('0x34')],_0x21d463[_0x3376('0x36')]));if(_0x1f8554[_0x3376('0x34')]['filter']){_0x20e341[_0x3376('0x3d')]=_['merge'](_0x20e341[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x20e341[_0x3376('0x39')],function(_0x1f7d06){var _0x2502be={};_0x2502be[_0x1f7d06]={'$like':'%'+_0x1f8554[_0x3376('0x34')]['filter']+'%'};return _0x2502be;})});}_0x20e341=_[_0x3376('0x42')]({},_0x20e341,_0x1f8554['options']);return _0x56b762[_0x3376('0xff')](_0x20e341);}})[_0x3376('0x12')](function(_0x7666f8){if(_0x7666f8){_0x1d99a7=_0x7666f8[_0x3376('0x3a')];if(!_0x1f8554['query'][_0x3376('0x61')]('nolimit')){_0x20e341[_0x3376('0x21')]=qs[_0x3376('0x21')](_0x1f8554[_0x3376('0x34')]['limit']);_0x20e341['offset']=qs['offset'](_0x1f8554[_0x3376('0x34')][_0x3376('0x1f')]);}return _0x56b762[_0x3376('0xff')](_0x20e341);}})['then'](function(_0x5903c2){if(_0x5903c2){return _0x5903c2?{'count':_0x1d99a7,'rows':_0x5903c2}:null;}})[_0x3376('0x12')](respondWithResult(_0x55fea7,null))[_0x3376('0x47')](handleError(_0x55fea7,null));};exports['getFields']=function(_0x3df3de,_0x2ef2db){var _0x1827b0=_0x3df3de[_0x3376('0x34')][_0x3376('0x118')]===_0x3376('0x119')?_0x3376('0x11a'):'onlineForm';return db[_0x3376('0x45')][_0x3376('0x4b')]({'attributes':['id',_0x1827b0],'where':{'id':_0x3df3de[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ef2db,null))[_0x3376('0x12')](function(_0x4b5c68){if(_0x4b5c68){var _0x2aa1e1=_0x4b5c68[_0x1827b0];var _0x47ecb2=_0x2aa1e1&&_0x2aa1e1[_0x3376('0x11b')]?_0x2aa1e1[_0x3376('0x11b')]:[];_0x2ef2db['send']({'fromKey':_[_0x3376('0x71')](_0x2aa1e1['fromKey'])?undefined:_0x2aa1e1[_0x3376('0x11c')],'count':_0x47ecb2[_0x3376('0x3a')],'rows':_0x47ecb2});}})[_0x3376('0x47')](handleError(_0x2ef2db,null));};exports[_0x3376('0x11d')]=function(_0x374753,_0x51c378){var _0x44eee2={'raw':![],'where':{}};var _0x159875={};var _0x301875={'count':0x0,'rows':[]};return db[_0x3376('0x45')]['findOne']({'where':{'id':_0x374753['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x51c378,null))[_0x3376('0x12')](function(_0xadb751){if(_0xadb751){_0x159875[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0xcd')][_0x3376('0x30')]);_0x159875[_0x3376('0x34')]=_['keys'](_0x374753[_0x3376('0x34')]);_0x159875[_0x3376('0x36')]=_[_0x3376('0x37')](_0x159875[_0x3376('0x33')],_0x159875[_0x3376('0x34')]);_0x44eee2[_0x3376('0x39')]=_[_0x3376('0x37')](_0x159875[_0x3376('0x33')],qs[_0x3376('0x38')](_0x374753['query'][_0x3376('0x38')]));_0x44eee2[_0x3376('0x39')]=_0x44eee2[_0x3376('0x39')][_0x3376('0x3a')]?_0x44eee2[_0x3376('0x39')]:_0x159875[_0x3376('0x33')];if(!_0x374753[_0x3376('0x34')][_0x3376('0x61')]('nolimit')){_0x44eee2[_0x3376('0x21')]=qs['limit'](_0x374753[_0x3376('0x34')][_0x3376('0x21')]);_0x44eee2[_0x3376('0x1f')]=qs[_0x3376('0x1f')](_0x374753[_0x3376('0x34')]['offset']);}_0x44eee2[_0x3376('0x5a')]=qs[_0x3376('0x3c')](_0x374753[_0x3376('0x34')][_0x3376('0x3c')]);_0x44eee2[_0x3376('0x3d')]=qs[_0x3376('0x36')](_[_0x3376('0x3e')](_0x374753[_0x3376('0x34')],_0x159875[_0x3376('0x36')]));_0x44eee2['where']['ChatWebsiteId']=_0xadb751['id'];if(_0x374753['query'][_0x3376('0x41')]){_0x44eee2[_0x3376('0x3d')]=_[_0x3376('0x42')](_0x44eee2[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x44eee2[_0x3376('0x39')],function(_0x45b319){var _0x5a09b8={};_0x5a09b8[_0x45b319]={'$like':'%'+_0x374753['query'][_0x3376('0x41')]+'%'};return _0x5a09b8;})});}_0x44eee2=_[_0x3376('0x42')]({},_0x44eee2,_0x374753[_0x3376('0x4a')]);return db['ChatOfflineMessage'][_0x3376('0x22')]({'where':_0x44eee2[_0x3376('0x3d')]})[_0x3376('0x12')](function(_0xf6f247){_0x301875[_0x3376('0x22')]=_0xf6f247;if(_0x374753[_0x3376('0x34')]['includeAll']){_0x44eee2[_0x3376('0x44')]=[{'all':!![]}];}else{_0x44eee2[_0x3376('0x44')]=[{'model':db[_0x3376('0x92')],'as':_0x3376('0x11e'),'required':![]},{'model':db[_0x3376('0xd6')],'as':_0x3376('0x11f'),'required':![]}];}return db[_0x3376('0xcd')][_0x3376('0x46')](_0x44eee2);})[_0x3376('0x12')](function(_0x24452c){_0x301875[_0x3376('0x5b')]=_0x24452c;return _0x301875;});}})['then'](respondWithFilteredResult(_0x51c378,_0x44eee2))[_0x3376('0x47')](handleError(_0x51c378,null));};exports[_0x3376('0x120')]=function(_0x2793dd,_0x43227b){return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x2793dd['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x43227b,null))[_0x3376('0x12')](function(_0x198632){if(_0x198632){return _0x198632[_0x3376('0x120')](_0x2793dd[_0x3376('0x4d')][_0x3376('0x5d')],_[_0x3376('0xe7')](_0x2793dd['body'],[_0x3376('0x5d'),'id'])||{})[_0x3376('0xaf')](function(_0x4dd6d){for(var _0x2fa161=0x0;_0x2fa161<_0x2793dd[_0x3376('0x4d')][_0x3376('0x5d')][_0x3376('0x3a')];_0x2fa161+=0x1){socket['emit'](_0x3376('0x121'),{'UserId':Number(_0x2793dd[_0x3376('0x4d')][_0x3376('0x5d')][_0x2fa161]),'ChatWebsiteId':Number(_0x2793dd[_0x3376('0x49')]['id'])});}return _0x4dd6d;});}})[_0x3376('0x12')](respondWithResult(_0x43227b,null))[_0x3376('0x47')](handleError(_0x43227b,null));};exports[_0x3376('0x122')]=function(_0xb521cf,_0x154747){return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0xb521cf[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x154747,null))[_0x3376('0x12')](function(_0x16fd13){if(_0x16fd13){return _0x16fd13[_0x3376('0x122')](_0xb521cf[_0x3376('0x34')]['ids'])[_0x3376('0x12')](function(){if(_[_0x3376('0x123')](_0xb521cf['query']['ids'])){for(var _0x440668=0x0;_0x440668<_0xb521cf['query'][_0x3376('0x5d')][_0x3376('0x3a')];_0x440668+=0x1){socket[_0x3376('0x124')]('userChatWebsite:remove',{'UserId':Number(_0xb521cf[_0x3376('0x34')][_0x3376('0x5d')][_0x440668]),'ChatWebsiteId':Number(_0xb521cf[_0x3376('0x49')]['id'])});}}else{socket['emit'](_0x3376('0x125'),{'UserId':Number(_0xb521cf['query'][_0x3376('0x5d')]),'ChatWebsiteId':Number(_0xb521cf[_0x3376('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x154747,null))[_0x3376('0x47')](handleError(_0x154747,null));};exports[_0x3376('0x126')]=function(_0x11b6fa,_0x3a61e9){var _0x127359={};var _0x2c08f7={};var _0xb17d60;var _0x3e4bda;return db[_0x3376('0x45')][_0x3376('0x59')]({'where':{'id':_0x11b6fa[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a61e9,null))[_0x3376('0x12')](function(_0xf169ae){if(_0xf169ae){_0xb17d60=_0xf169ae;_0x2c08f7['model']=_[_0x3376('0x35')](db[_0x3376('0xba')][_0x3376('0x30')]);_0x2c08f7[_0x3376('0x34')]=_[_0x3376('0x35')](_0x11b6fa['query']);_0x2c08f7[_0x3376('0x36')]=_['intersection'](_0x2c08f7[_0x3376('0x33')],_0x2c08f7['query']);_0x127359[_0x3376('0x39')]=_[_0x3376('0x37')](_0x2c08f7[_0x3376('0x33')],qs['fields'](_0x11b6fa[_0x3376('0x34')][_0x3376('0x38')]));_0x127359[_0x3376('0x39')]=_0x127359['attributes'][_0x3376('0x3a')]?_0x127359[_0x3376('0x39')]:_0x2c08f7[_0x3376('0x33')];_0x127359[_0x3376('0x5a')]=qs['sort'](_0x11b6fa['query'][_0x3376('0x3c')]);_0x127359[_0x3376('0x3d')]=qs[_0x3376('0x36')](_['pick'](_0x11b6fa['query'],_0x2c08f7['filters']));if(_0x11b6fa['query'][_0x3376('0x41')]){_0x127359[_0x3376('0x3d')]=_['merge'](_0x127359[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x127359['attributes'],function(_0x3a79df){var _0x5081b6={};_0x5081b6[_0x3a79df]={'$like':'%'+_0x11b6fa['query']['filter']+'%'};return _0x5081b6;})});}_0x127359=_[_0x3376('0x42')]({},_0x127359,_0x11b6fa[_0x3376('0x4a')]);return _0xb17d60[_0x3376('0x126')](_0x127359);}})[_0x3376('0x12')](function(_0x452542){if(_0x452542){_0x3e4bda=_0x452542[_0x3376('0x3a')];if(!_0x11b6fa[_0x3376('0x34')]['hasOwnProperty'](_0x3376('0x3b'))){_0x127359[_0x3376('0x21')]=qs['limit'](_0x11b6fa['query'][_0x3376('0x21')]);_0x127359['offset']=qs[_0x3376('0x1f')](_0x11b6fa[_0x3376('0x34')][_0x3376('0x1f')]);}return _0xb17d60[_0x3376('0x126')](_0x127359);}})[_0x3376('0x12')](function(_0x399b55){if(_0x399b55){return _0x399b55?{'count':_0x3e4bda,'rows':_0x399b55}:null;}})[_0x3376('0x12')](respondWithResult(_0x3a61e9,null))[_0x3376('0x47')](handleError(_0x3a61e9,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 880cb95..e63e79e 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 _0x6c7b=['emit','hasOwnProperty','hook','events','save','remove'];(function(_0x28d6f7,_0x4dfc89){var _0x50d268=function(_0x5c4f5e){while(--_0x5c4f5e){_0x28d6f7['push'](_0x28d6f7['shift']());}};_0x50d268(++_0x4dfc89);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x56b5d1,_0x59be02){_0x56b5d1=_0x56b5d1-0x0;var _0x5bfe4a=_0x6c7b[_0x56b5d1];return _0x5bfe4a;};'use strict';var EventEmitter=require(_0xb6c7('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6c7('0x1'),'afterUpdate':'update','afterDestroy':_0xb6c7('0x2')};function emitEvent(_0x438aa8){return function(_0x35674b,_0x5857e0,_0x294dc9){ChatWebsiteEvents[_0xb6c7('0x3')](_0x438aa8+':'+_0x35674b['id'],_0x35674b);ChatWebsiteEvents[_0xb6c7('0x3')](_0x438aa8,_0x35674b);_0x294dc9(null);};}for(var e in events){if(events[_0xb6c7('0x4')](e)){var event=events[e];ChatWebsite[_0xb6c7('0x5')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xf3cd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0x1b892b,_0x4efe48){var _0xa99e57=function(_0x3f957a){while(--_0x3f957a){_0x1b892b['push'](_0x1b892b['shift']());}};_0xa99e57(++_0x4efe48);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x25c044,_0xbd05f8){_0x25c044=_0x25c044-0x0;var _0x558ee5=_0xf3cd[_0x25c044];return _0x558ee5;};'use strict';var EventEmitter=require(_0xdf3c('0x0'));var ChatWebsite=require(_0xdf3c('0x1'))['db'][_0xdf3c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xdf3c('0x3')](0x0);var events={'afterCreate':_0xdf3c('0x4'),'afterUpdate':_0xdf3c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x401518){return function(_0x71b446,_0x9f71cb,_0x573076){ChatWebsiteEvents[_0xdf3c('0x6')](_0x401518+':'+_0x71b446['id'],_0x71b446);ChatWebsiteEvents[_0xdf3c('0x6')](_0x401518,_0x71b446);_0x573076(null);};}for(var e in events){if(events[_0xdf3c('0x7')](e)){var event=events[e];ChatWebsite[_0xdf3c('0x8')](e,emitEvent(event));}}module[_0xdf3c('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 8918521..a914a59 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 _0xfdda=['./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1107ac,_0x45de13){var _0xe10cd=function(_0x5844a8){while(--_0x5844a8){_0x1107ac['push'](_0x1107ac['shift']());}};_0xe10cd(++_0x45de13);}(_0xfdda,0x171));var _0xafdd=function(_0x4e37bc,_0x8174e7){_0x4e37bc=_0x4e37bc-0x0;var _0x48a8b7=_0xfdda[_0x4e37bc];return _0x48a8b7;};'use strict';var _=require('lodash');var util=require(_0xafdd('0x0'));var logger=require(_0xafdd('0x1'))(_0xafdd('0x2'));var moment=require(_0xafdd('0x3'));var BPromise=require('bluebird');var rp=require(_0xafdd('0x4'));var fs=require('fs');var path=require(_0xafdd('0x5'));var rimraf=require(_0xafdd('0x6'));var config=require(_0xafdd('0x7'));var attributes=require(_0xafdd('0x8'));module[_0xafdd('0x9')]=function(_0x2b1142,_0x25c33f){return _0x2b1142[_0xafdd('0xa')](_0xafdd('0xb'),attributes,{'tableName':_0xafdd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf659=['ChatWebsite','chat_websites','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x5d8725,_0x1096cc){var _0x23ddb2=function(_0x5b6b12){while(--_0x5b6b12){_0x5d8725['push'](_0x5d8725['shift']());}};_0x23ddb2(++_0x1096cc);}(_0xf659,0x12e));var _0x9f65=function(_0x93aa7d,_0x1d64b5){_0x93aa7d=_0x93aa7d-0x0;var _0xc0a2a8=_0xf659[_0x93aa7d];return _0xc0a2a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9f65('0x0'))('api');var moment=require(_0x9f65('0x1'));var BPromise=require('bluebird');var rp=require(_0x9f65('0x2'));var fs=require('fs');var path=require(_0x9f65('0x3'));var rimraf=require(_0x9f65('0x4'));var config=require(_0x9f65('0x5'));var attributes=require(_0x9f65('0x6'));module[_0x9f65('0x7')]=function(_0x15d0b9,_0x42190f){return _0x15d0b9['define'](_0x9f65('0x8'),attributes,{'tableName':_0x9f65('0x9'),'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 0732707..5eec2f0 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 _0x6f7c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x53e971,_0x1a6b00){var _0x85706d=function(_0x488e99){while(--_0x488e99){_0x53e971['push'](_0x53e971['shift']());}};_0x85706d(++_0x1a6b00);}(_0x6f7c,0x15a));var _0xc6f7=function(_0x325636,_0x47a944){_0x325636=_0x325636-0x0;var _0x2d4346=_0x6f7c[_0x325636];return _0x2d4346;};'use strict';var _=require('lodash');var util=require(_0xc6f7('0x0'));var moment=require(_0xc6f7('0x1'));var BPromise=require(_0xc6f7('0x2'));var rs=require(_0xc6f7('0x3'));var fs=require('fs');var Redis=require(_0xc6f7('0x4'));var db=require(_0xc6f7('0x5'))['db'];var utils=require(_0xc6f7('0x6'));var logger=require(_0xc6f7('0x7'))('rpc');var config=require(_0xc6f7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc6f7('0x9')][_0xc6f7('0xa')]({'port':0x232a});config['redis']=_[_0xc6f7('0xb')](config[_0xc6f7('0xc')],{'host':_0xc6f7('0xd'),'port':0x18eb});var socket=require(_0xc6f7('0xe'))(new Redis(config['redis']));require(_0xc6f7('0xf'))[_0xc6f7('0x10')](socket);function respondWithRpcPromise(_0x5aa009,_0x2533fd,_0x3a4a0f){return new BPromise(function(_0x4de3cc,_0x59fc2c){return client[_0xc6f7('0x11')](_0x5aa009,_0x3a4a0f)[_0xc6f7('0x12')](function(_0x46d051){logger[_0xc6f7('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x2533fd,_0xc6f7('0x14'));logger[_0xc6f7('0x15')](_0xc6f7('0x16'),_0x2533fd,_0xc6f7('0x14'),JSON[_0xc6f7('0x17')](_0x46d051));if(_0x46d051['error']){if(_0x46d051[_0xc6f7('0x18')]['code']===0x1f4){logger[_0xc6f7('0x18')](_0xc6f7('0x19'),_0x2533fd,_0x46d051[_0xc6f7('0x18')][_0xc6f7('0x1a')]);return _0x59fc2c(_0x46d051[_0xc6f7('0x18')][_0xc6f7('0x1a')]);}logger[_0xc6f7('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x2533fd,_0x46d051[_0xc6f7('0x18')][_0xc6f7('0x1a')]);return _0x4de3cc(_0x46d051[_0xc6f7('0x18')][_0xc6f7('0x1a')]);}else{logger[_0xc6f7('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x2533fd,_0xc6f7('0x14'));_0x4de3cc(_0x46d051[_0xc6f7('0x1b')][_0xc6f7('0x1a')]);}})[_0xc6f7('0x1c')](function(_0x1b7099){logger[_0xc6f7('0x18')](_0xc6f7('0x19'),_0x2533fd,_0x1b7099);_0x59fc2c(_0x1b7099);});});} \ No newline at end of file +var _0x7a9b=['request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0xfda098,_0x533f6b){var _0x502996=function(_0x321b32){while(--_0x321b32){_0xfda098['push'](_0xfda098['shift']());}};_0x502996(++_0x533f6b);}(_0x7a9b,0x1cc));var _0xb7a9=function(_0x201852,_0x2ce317){_0x201852=_0x201852-0x0;var _0x1a3fc5=_0x7a9b[_0x201852];return _0x1a3fc5;};'use strict';var _=require(_0xb7a9('0x0'));var util=require(_0xb7a9('0x1'));var moment=require('moment');var BPromise=require(_0xb7a9('0x2'));var rs=require(_0xb7a9('0x3'));var fs=require('fs');var Redis=require(_0xb7a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb7a9('0x5'));var logger=require(_0xb7a9('0x6'))(_0xb7a9('0x7'));var config=require(_0xb7a9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb7a9('0x9')][_0xb7a9('0xa')]({'port':0x232a});config['redis']=_[_0xb7a9('0xb')](config[_0xb7a9('0xc')],{'host':_0xb7a9('0xd'),'port':0x18eb});var socket=require(_0xb7a9('0xe'))(new Redis(config[_0xb7a9('0xc')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x29b864,_0x5d71c9,_0x2b6e42){return new BPromise(function(_0x421eb8,_0x9eea46){return client[_0xb7a9('0xf')](_0x29b864,_0x2b6e42)['then'](function(_0x4d962e){logger[_0xb7a9('0x10')](_0xb7a9('0x11'),_0x5d71c9,_0xb7a9('0x12'));logger[_0xb7a9('0x13')](_0xb7a9('0x14'),_0x5d71c9,_0xb7a9('0x12'),JSON['stringify'](_0x4d962e));if(_0x4d962e[_0xb7a9('0x15')]){if(_0x4d962e[_0xb7a9('0x15')][_0xb7a9('0x16')]===0x1f4){logger[_0xb7a9('0x15')](_0xb7a9('0x11'),_0x5d71c9,_0x4d962e[_0xb7a9('0x15')][_0xb7a9('0x17')]);return _0x9eea46(_0x4d962e[_0xb7a9('0x15')][_0xb7a9('0x17')]);}logger[_0xb7a9('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x5d71c9,_0x4d962e['error'][_0xb7a9('0x17')]);return _0x421eb8(_0x4d962e['error'][_0xb7a9('0x17')]);}else{logger['info'](_0xb7a9('0x11'),_0x5d71c9,_0xb7a9('0x12'));_0x421eb8(_0x4d962e[_0xb7a9('0x18')][_0xb7a9('0x17')]);}})['catch'](function(_0x4d4a1a){logger[_0xb7a9('0x15')](_0xb7a9('0x11'),_0x5d71c9,_0x4d4a1a);_0x9eea46(_0x4d4a1a);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a49be91..bb99668 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 _0xee00=['chatWebsite:','./chatWebsite.events','save','update','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee00,0x6d));var _0x0ee0=function(_0x342c6c,_0x3540ee){_0x342c6c=_0x342c6c-0x0;var _0x55c059=_0xee00[_0x342c6c];return _0x55c059;};'use strict';var ChatWebsiteEvents=require(_0x0ee0('0x0'));var events=[_0x0ee0('0x1'),'remove',_0x0ee0('0x2')];function createListener(_0x3094c7,_0x5ecd37){return function(_0x51cb22){_0x5ecd37['emit'](_0x3094c7,_0x51cb22);};}function removeListener(_0x5029e2,_0x255364){return function(){ChatWebsiteEvents[_0x0ee0('0x3')](_0x5029e2,_0x255364);};}exports['register']=function(_0x4587ec){for(var _0x15523a=0x0,_0x5cf367=events[_0x0ee0('0x4')];_0x15523a<_0x5cf367;_0x15523a++){var _0x12ab4e=events[_0x15523a];var _0x57ae4c=createListener(_0x0ee0('0x5')+_0x12ab4e,_0x4587ec);ChatWebsiteEvents['on'](_0x12ab4e,_0x57ae4c);}}; \ No newline at end of file +var _0x8596=['./chatWebsite.events','save','remove','emit','register','length','chatWebsite:'];(function(_0x5de6c9,_0x471538){var _0x4f45f6=function(_0xe0c086){while(--_0xe0c086){_0x5de6c9['push'](_0x5de6c9['shift']());}};_0x4f45f6(++_0x471538);}(_0x8596,0x9a));var _0x6859=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8596[_0x4565bf];return _0x5610ba;};'use strict';var ChatWebsiteEvents=require(_0x6859('0x0'));var events=[_0x6859('0x1'),_0x6859('0x2'),'update'];function createListener(_0x1d9015,_0xb93d6){return function(_0x3b8f63){_0xb93d6[_0x6859('0x3')](_0x1d9015,_0x3b8f63);};}function removeListener(_0x34b9a6,_0x64330c){return function(){ChatWebsiteEvents['removeListener'](_0x34b9a6,_0x64330c);};}exports[_0x6859('0x4')]=function(_0x47227d){for(var _0x27dba8=0x0,_0x304f8b=events[_0x6859('0x5')];_0x27dba8<_0x304f8b;_0x27dba8++){var _0x5cc9f2=events[_0x27dba8];var _0x5d94dd=createListener(_0x6859('0x6')+_0x5cc9f2,_0x47227d);ChatWebsiteEvents['on'](_0x5cc9f2,_0x5d94dd);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8be97db..7c22f20 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 _0x84a1=['addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','/:id/proactive_actions','/:id/fields','/:id/users','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','single','file','addLogo','join','server/files/images/avatars/','now','addAvatar','originalname','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','extname','/:id/offline','any','offline','addInteraction'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x84a1,0x1ba));var _0x184a=function(_0x37b14e,_0x3a79bb){_0x37b14e=_0x37b14e-0x0;var _0x42d59d=_0x84a1[_0x37b14e];return _0x42d59d;};'use strict';var multer=require(_0x184a('0x0'));var util=require(_0x184a('0x1'));var path=require(_0x184a('0x2'));var timeout=require(_0x184a('0x3'));var express=require(_0x184a('0x4'));var router=express['Router']();var fs_extra=require(_0x184a('0x5'));var auth=require(_0x184a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x184a('0x7'));router['get']('/',auth[_0x184a('0x8')](),controller[_0x184a('0x9')]);router[_0x184a('0xa')](_0x184a('0xb'),auth['isAuthenticated'](),controller[_0x184a('0xc')]);router[_0x184a('0xa')](_0x184a('0xd'),auth[_0x184a('0x8')](),controller[_0x184a('0xe')]);router['get'](_0x184a('0xf'),auth[_0x184a('0x8')](),controller[_0x184a('0x10')]);router[_0x184a('0xa')](_0x184a('0x11'),auth[_0x184a('0x8')](),controller[_0x184a('0x12')]);router['get'](_0x184a('0x13'),controller['getLogo']);router[_0x184a('0xa')](_0x184a('0x14'),controller[_0x184a('0x15')]);router['get'](_0x184a('0x16'),controller[_0x184a('0x17')]);router[_0x184a('0xa')]('/:id/system_avatar',controller[_0x184a('0x18')]);router[_0x184a('0xa')](_0x184a('0x19'),auth[_0x184a('0x8')](),controller[_0x184a('0x1a')]);router[_0x184a('0xa')](_0x184a('0x1b'),controller['getSnippet']);router[_0x184a('0xa')](_0x184a('0x1c'),auth[_0x184a('0x8')](),controller['getApplications']);router[_0x184a('0xa')](_0x184a('0x1d'),auth[_0x184a('0x8')](),controller['getProactiveActions']);router[_0x184a('0xa')](_0x184a('0x1e'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0x184a('0x8')](),controller['getOfflineMessages']);router[_0x184a('0xa')](_0x184a('0x1f'),auth[_0x184a('0x8')](),controller['getAgents']);router[_0x184a('0x20')]('/',auth[_0x184a('0x8')](),controller[_0x184a('0x21')]);router[_0x184a('0x20')]('/:id/dispositions',auth[_0x184a('0x8')](),controller[_0x184a('0x22')]);router[_0x184a('0x20')](_0x184a('0x11'),auth[_0x184a('0x8')](),controller[_0x184a('0x23')]);var upload=multer({'storage':multer[_0x184a('0x24')]({'destination':function(_0x3e0af9,_0xdd54bc,_0x32e48e){_0x32e48e(null,path['join'](config[_0x184a('0x25')],_0x184a('0x26')));},'filename':function(_0x99f5b3,_0x1751e8,_0x58af80){_0x58af80(null,util[_0x184a('0x27')](_0x184a('0x28'),Date['now'](),_0x1751e8['originalname']));}})});router['post'](_0x184a('0x13'),upload[_0x184a('0x29')](_0x184a('0x2a')),controller[_0x184a('0x2b')]);var upload=multer({'storage':multer[_0x184a('0x24')]({'destination':function(_0x3f7a2c,_0x45dac2,_0x125ae7){_0x125ae7(null,path[_0x184a('0x2c')](config[_0x184a('0x25')],_0x184a('0x2d')));},'filename':function(_0x5d553b,_0x2fd7a8,_0x394f62){_0x394f62(null,util[_0x184a('0x27')](_0x184a('0x28'),Date[_0x184a('0x2e')](),_0x2fd7a8['originalname']));}})});router[_0x184a('0x20')]('/:id/avatar',upload['single'](_0x184a('0x2a')),controller[_0x184a('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5743a0,_0x467895,_0x8a56d0){_0x8a56d0(null,path[_0x184a('0x2c')](config['root'],_0x184a('0x2d')));},'filename':function(_0x3d0fee,_0x3996eb,_0x4b66b8){_0x4b66b8(null,util[_0x184a('0x27')](_0x184a('0x28'),Date[_0x184a('0x2e')](),_0x3996eb[_0x184a('0x30')]));}})});router['post']('/:id/customer_avatar',upload[_0x184a('0x29')](_0x184a('0x2a')),controller[_0x184a('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x9c3fe6,_0x1f40e4,_0xf0dc83){_0xf0dc83(null,path['join'](config[_0x184a('0x25')],_0x184a('0x2d')));},'filename':function(_0x1c6d7a,_0x14f8d7,_0x549fc8){_0x549fc8(null,util[_0x184a('0x27')]('%s-%s',Date[_0x184a('0x2e')](),_0x14f8d7[_0x184a('0x30')]));}})});router[_0x184a('0x20')](_0x184a('0x32'),upload[_0x184a('0x29')](_0x184a('0x2a')),controller[_0x184a('0x33')]);router[_0x184a('0x20')](_0x184a('0x34'),controller[_0x184a('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x184a('0x24')]({'destination':function(_0x2f1fd9,_0xcdc0f,_0x188ef7){const _0x43f0c5=path[_0x184a('0x2c')](config[_0x184a('0x25')],_0x184a('0x36'),_0x184a('0x37'),_0x184a('0x38'));fs_extra['ensureDir'](_0x43f0c5,function(){_0x188ef7(null,_0x43f0c5);});},'filename':function(_0x36b758,_0x156a96,_0x4491ba){const _0x5b01e6=_0x156a96[_0x184a('0x30')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x553301=path[_0x184a('0x39')](_0x5b01e6);const _0x11047b=Date[_0x184a('0x2e')]()+'-'+_0x5b01e6['replace'](_0x553301,'')+_0x553301;_0x4491ba(null,_0x11047b);}})});router[_0x184a('0x20')](_0x184a('0x3a'),offlineUploadMulter[_0x184a('0x3b')](),controller[_0x184a('0x3c')]);router[_0x184a('0x20')](_0x184a('0x19'),auth[_0x184a('0x8')](),controller[_0x184a('0x3d')]);router[_0x184a('0x20')]('/:id/applications',auth[_0x184a('0x8')](),controller[_0x184a('0x3e')]);router[_0x184a('0x20')](_0x184a('0x1d'),auth[_0x184a('0x8')](),controller[_0x184a('0x3f')]);router[_0x184a('0x20')](_0x184a('0x1f'),auth['isAuthenticated'](),controller[_0x184a('0x40')]);router[_0x184a('0x41')](_0x184a('0xd'),auth[_0x184a('0x8')](),controller[_0x184a('0x42')]);router[_0x184a('0x43')](_0x184a('0xd'),auth[_0x184a('0x8')](),controller[_0x184a('0x44')]);router[_0x184a('0x43')](_0x184a('0xf'),auth[_0x184a('0x8')](),controller[_0x184a('0x45')]);router['delete'](_0x184a('0x11'),auth[_0x184a('0x8')](),controller[_0x184a('0x46')]);router[_0x184a('0x43')](_0x184a('0x1f'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x184a('0x47')]=router; \ No newline at end of file +var _0xa48d=['server/files/images/avatars/','%s-%s','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','format','now','originalname','/:id/logo','single','file','addLogo','root'];(function(_0x3395c0,_0x935260){var _0x4c9ea7=function(_0x27e3bc){while(--_0x27e3bc){_0x3395c0['push'](_0x3395c0['shift']());}};_0x4c9ea7(++_0x935260);}(_0xa48d,0x170));var _0xda48=function(_0x2c1933,_0x37433d){_0x2c1933=_0x2c1933-0x0;var _0xe44b8a=_0xa48d[_0x2c1933];return _0xe44b8a;};'use strict';var multer=require(_0xda48('0x0'));var util=require(_0xda48('0x1'));var path=require(_0xda48('0x2'));var timeout=require(_0xda48('0x3'));var express=require(_0xda48('0x4'));var router=express[_0xda48('0x5')]();var fs_extra=require(_0xda48('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda48('0x7'));var controller=require('./chatWebsite.controller');router[_0xda48('0x8')]('/',auth[_0xda48('0x9')](),controller[_0xda48('0xa')]);router[_0xda48('0x8')](_0xda48('0xb'),auth['isAuthenticated'](),controller[_0xda48('0xc')]);router[_0xda48('0x8')]('/:id',auth[_0xda48('0x9')](),controller[_0xda48('0xd')]);router[_0xda48('0x8')](_0xda48('0xe'),auth[_0xda48('0x9')](),controller['getDispositions']);router[_0xda48('0x8')](_0xda48('0xf'),auth['isAuthenticated'](),controller[_0xda48('0x10')]);router[_0xda48('0x8')]('/:id/logo',controller[_0xda48('0x11')]);router[_0xda48('0x8')](_0xda48('0x12'),controller[_0xda48('0x13')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller[_0xda48('0x14')]);router['get'](_0xda48('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xda48('0x8')](_0xda48('0x16'),controller['getSnippet']);router['get'](_0xda48('0x17'),auth[_0xda48('0x9')](),controller[_0xda48('0x18')]);router[_0xda48('0x8')](_0xda48('0x19'),auth[_0xda48('0x9')](),controller['getProactiveActions']);router[_0xda48('0x8')](_0xda48('0x1a'),controller[_0xda48('0x1b')]);router[_0xda48('0x8')](_0xda48('0x1c'),auth[_0xda48('0x9')](),controller[_0xda48('0x1d')]);router[_0xda48('0x8')](_0xda48('0x1e'),auth[_0xda48('0x9')](),controller[_0xda48('0x1f')]);router[_0xda48('0x20')]('/',auth[_0xda48('0x9')](),controller[_0xda48('0x21')]);router[_0xda48('0x20')](_0xda48('0xe'),auth['isAuthenticated'](),controller[_0xda48('0x22')]);router['post'](_0xda48('0xf'),auth['isAuthenticated'](),controller[_0xda48('0x23')]);var upload=multer({'storage':multer[_0xda48('0x24')]({'destination':function(_0x1fb848,_0x59d412,_0x23b64f){_0x23b64f(null,path[_0xda48('0x25')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1acd4a,_0x43d762,_0xa47276){_0xa47276(null,util[_0xda48('0x26')]('%s-%s',Date[_0xda48('0x27')](),_0x43d762[_0xda48('0x28')]));}})});router[_0xda48('0x20')](_0xda48('0x29'),upload[_0xda48('0x2a')](_0xda48('0x2b')),controller[_0xda48('0x2c')]);var upload=multer({'storage':multer[_0xda48('0x24')]({'destination':function(_0x6dc2a1,_0x40247e,_0x5ea3b0){_0x5ea3b0(null,path[_0xda48('0x25')](config[_0xda48('0x2d')],_0xda48('0x2e')));},'filename':function(_0x51bd91,_0x27e73f,_0x1eac1e){_0x1eac1e(null,util[_0xda48('0x26')]('%s-%s',Date[_0xda48('0x27')](),_0x27e73f['originalname']));}})});router[_0xda48('0x20')](_0xda48('0x12'),upload[_0xda48('0x2a')](_0xda48('0x2b')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3ce05a,_0x4f95be,_0x43bcc4){_0x43bcc4(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x268875,_0x187198,_0x311bb4){_0x311bb4(null,util[_0xda48('0x26')](_0xda48('0x2f'),Date[_0xda48('0x27')](),_0x187198[_0xda48('0x28')]));}})});router[_0xda48('0x20')](_0xda48('0x30'),upload['single'](_0xda48('0x2b')),controller[_0xda48('0x31')]);var upload=multer({'storage':multer[_0xda48('0x24')]({'destination':function(_0x5175bf,_0x4650e3,_0x20a80d){_0x20a80d(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0xd33a88,_0xbb2104,_0xc1fabe){_0xc1fabe(null,util['format']('%s-%s',Date[_0xda48('0x27')](),_0xbb2104[_0xda48('0x28')]));}})});router[_0xda48('0x20')](_0xda48('0x32'),upload[_0xda48('0x2a')](_0xda48('0x2b')),controller[_0xda48('0x33')]);router[_0xda48('0x20')](_0xda48('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xda48('0x24')]({'destination':function(_0x18a2df,_0xc3b5f8,_0x565ecd){const _0x36df46=path[_0xda48('0x25')](config[_0xda48('0x2d')],_0xda48('0x35'),_0xda48('0x36'),_0xda48('0x37'));fs_extra['ensureDir'](_0x36df46,function(){_0x565ecd(null,_0x36df46);});},'filename':function(_0x1a03cc,_0x144140,_0xf5588){const _0x33387d=_0x144140[_0xda48('0x28')][_0xda48('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xfc3bf8=path['extname'](_0x33387d);const _0x43bc72=Date['now']()+'-'+_0x33387d[_0xda48('0x38')](_0xfc3bf8,'')+_0xfc3bf8;_0xf5588(null,_0x43bc72);}})});router[_0xda48('0x20')](_0xda48('0x39'),offlineUploadMulter['any'](),controller[_0xda48('0x3a')]);router[_0xda48('0x20')]('/:id/interactions',auth[_0xda48('0x9')](),controller[_0xda48('0x3b')]);router[_0xda48('0x20')]('/:id/applications',auth[_0xda48('0x9')](),controller['addApplications']);router['post'](_0xda48('0x19'),auth['isAuthenticated'](),controller[_0xda48('0x3c')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xda48('0x3d')]);router[_0xda48('0x3e')](_0xda48('0x3f'),auth[_0xda48('0x9')](),controller[_0xda48('0x40')]);router[_0xda48('0x41')](_0xda48('0x3f'),auth[_0xda48('0x9')](),controller[_0xda48('0x42')]);router[_0xda48('0x41')](_0xda48('0xe'),auth[_0xda48('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xda48('0x9')](),controller[_0xda48('0x43')]);router[_0xda48('0x41')](_0xda48('0x1e'),auth[_0xda48('0x9')](),controller['removeAgents']);module[_0xda48('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 94c1361..dc59342 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0931=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../config/environment','Router','production','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x55eccf,_0x1530aa){var _0x2bc059=function(_0x276719){while(--_0x276719){_0x55eccf['push'](_0x55eccf['shift']());}};_0x2bc059(++_0x1530aa);}(_0x0931,0xb4));var _0x1093=function(_0x185543,_0x1305c0){_0x185543=_0x185543-0x0;var _0x92ecb0=_0x0931[_0x185543];return _0x92ecb0;};var beaverLogger=require(_0x1093('0x0'));var express=require(_0x1093('0x1'));var auth=require('../components/auth/service');var config=require(_0x1093('0x2'));var router=express[_0x1093('0x3')]();var isProduction=config['env']===_0x1093('0x4')||![];function clientSideLogs(_0x1c3881,_0x24a634,_0x4f66d0){var _0x2cdd29=_0x1c3881['app']['get'](_0x1093('0x5'));if(!_0x2cdd29){throw new Error(_0x1093('0x6'));}return beaverLogger['expressEndpoint']({'uri':_0x1093('0x7'),'logger':_0x2cdd29,'enableCors':!isProduction})(_0x1c3881,_0x24a634,_0x4f66d0);}router[_0x1093('0x8')](auth[_0x1093('0x9')](),clientSideLogs);module[_0x1093('0xa')]=router; \ No newline at end of file +var _0xadaf=['exports','../components/auth/service','../config/environment','Router','app','get','Client-Side\x20logger\x20not\x20found!','use'];(function(_0xc14e9b,_0x5c3047){var _0x48f298=function(_0x3ddc68){while(--_0x3ddc68){_0xc14e9b['push'](_0xc14e9b['shift']());}};_0x48f298(++_0x5c3047);}(_0xadaf,0x199));var _0xfada=function(_0x58bd72,_0x9919db){_0x58bd72=_0x58bd72-0x0;var _0x5bd2c9=_0xadaf[_0x58bd72];return _0x5bd2c9;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xfada('0x0'));var config=require(_0xfada('0x1'));var router=express[_0xfada('0x2')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x3893f2,_0x4ee33f,_0x2eb551){var _0x392017=_0x3893f2[_0xfada('0x3')][_0xfada('0x4')]('client-side-logger');if(!_0x392017){throw new Error(_0xfada('0x5'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x392017,'enableCors':!isProduction})(_0x3893f2,_0x4ee33f,_0x2eb551);}router[_0xfada('0x6')](auth['isAuthenticated'](),clientSideLogs);module[_0xfada('0x7')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 40a2c65..d251765 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 _0xd4d2=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x100268,_0x572d6d){var _0x378b1f=function(_0x5e414a){while(--_0x5e414a){_0x100268['push'](_0x100268['shift']());}};_0x378b1f(++_0x572d6d);}(_0xd4d2,0x9b));var _0x2d4d=function(_0x1d517a,_0x12a6f8){_0x1d517a=_0x1d517a-0x0;var _0x102e48=_0xd4d2[_0x1d517a];return _0x102e48;};'use strict';var Sequelize=require(_0x2d4d('0x0'));module[_0x2d4d('0x1')]={'name':{'type':Sequelize[_0x2d4d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x2d4d('0x3')](_0x2d4d('0x4'),_0x2d4d('0x5'),_0x2d4d('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x2d4d('0x3')]('Outlook365',_0x2d4d('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x2d4d('0x2')],'comment':_0x2d4d('0x8')},'data3':{'type':Sequelize[_0x2d4d('0x2')],'comment':_0x2d4d('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0x2d4d('0xa')},'data5':{'type':Sequelize[_0x2d4d('0xb')],'comment':_0x2d4d('0xc')},'data6':{'type':Sequelize[_0x2d4d('0xb')],'comment':_0x2d4d('0xd')},'data7':{'type':Sequelize[_0x2d4d('0xb')],'comment':_0x2d4d('0xe')}}; \ No newline at end of file +var _0x0eaa=['sequelize','STRING','ENUM','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x32ee10,_0x29ade5){var _0x39ec1b=function(_0x57fda3){while(--_0x57fda3){_0x32ee10['push'](_0x32ee10['shift']());}};_0x39ec1b(++_0x29ade5);}(_0x0eaa,0x15e));var _0xa0ea=function(_0x3e100c,_0x4fab6c){_0x3e100c=_0x3e100c-0x0;var _0x138d89=_0x0eaa[_0x3e100c];return _0x138d89;};'use strict';var Sequelize=require(_0xa0ea('0x0'));module['exports']={'name':{'type':Sequelize[_0xa0ea('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa0ea('0x2')]('AmazonAWS',_0xa0ea('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa0ea('0x4'),_0xa0ea('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0xa0ea('0x6')},'data2':{'type':Sequelize[_0xa0ea('0x1')],'comment':_0xa0ea('0x7')},'data3':{'type':Sequelize[_0xa0ea('0x1')],'comment':_0xa0ea('0x8')},'data4':{'type':Sequelize[_0xa0ea('0x1')],'comment':_0xa0ea('0x9')},'data5':{'type':Sequelize[_0xa0ea('0xa')],'comment':_0xa0ea('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0xa0ea('0xc')},'data7':{'type':Sequelize[_0xa0ea('0xa')],'comment':_0xa0ea('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 93b978d..8554b46 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 _0xd459=['Content-Range','then','end','error','stack','name','send','padEnd','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CloudProvider','includeAll','include','rows','decryptString','data3','catch','params','find','service','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','update','destroy','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','state','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','localhost','sendStatus','status','json','offset','undefined','count','limit'];(function(_0xed44ee,_0x2e967c){var _0x2b798a=function(_0x1e83e7){while(--_0x1e83e7){_0xed44ee['push'](_0xed44ee['shift']());}};_0x2b798a(++_0x2e967c);}(_0xd459,0x1c7));var _0x9d45=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xd459[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var Redis=require(_0x9d45('0x0'));var qs=require(_0x9d45('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x9d45('0x2'));var logger=require(_0x9d45('0x3'))('api');var db=require(_0x9d45('0x4'))['db'];var oauth=require(_0x9d45('0x5'));config[_0x9d45('0x6')]=_['defaults'](config[_0x9d45('0x6')],{'host':_0x9d45('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d45('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x53f2b9,_0x48ea4a){_0x48ea4a=_0x48ea4a||0xcc;return function(_0xbb6813){if(_0xbb6813){return _0x53f2b9[_0x9d45('0x8')](_0x48ea4a);}return _0x53f2b9[_0x9d45('0x9')](_0x48ea4a)['end']();};}function respondWithResult(_0xd4af7f,_0x5b6cee){_0x5b6cee=_0x5b6cee||0xc8;return function(_0x1bd8d6){if(_0x1bd8d6){return _0xd4af7f['status'](_0x5b6cee)[_0x9d45('0xa')](_0x1bd8d6);}};}function respondWithFilteredResult(_0x2de273,_0x4a4cc7){return function(_0x10c171){if(_0x10c171){var _0x30a035=typeof _0x4a4cc7[_0x9d45('0xb')]==='undefined'&&typeof _0x4a4cc7['limit']===_0x9d45('0xc');var _0x381b0c=_0x10c171['count'];var _0x3416b5=_0x30a035?0x0:_0x4a4cc7['offset'];var _0x9fe6ab=_0x30a035?_0x10c171[_0x9d45('0xd')]:_0x4a4cc7[_0x9d45('0xb')]+_0x4a4cc7[_0x9d45('0xe')];var _0x4f43fe;if(_0x9fe6ab>=_0x381b0c){_0x9fe6ab=_0x381b0c;_0x4f43fe=0xc8;}else{_0x4f43fe=0xce;}_0x2de273[_0x9d45('0x9')](_0x4f43fe);return _0x2de273['set'](_0x9d45('0xf'),_0x3416b5+'-'+_0x9fe6ab+'/'+_0x381b0c)[_0x9d45('0xa')](_0x10c171);}return null;};}function saveUpdates(_0x31cb53){return function(_0x4fb38a){if(_0x4fb38a){return _0x4fb38a['update'](_0x31cb53)[_0x9d45('0x10')](function(_0x1beaa2){return _0x1beaa2;});}return null;};}function removeEntity(_0x5d6b48){return function(_0x56c2b7){if(_0x56c2b7){return _0x56c2b7['destroy']()[_0x9d45('0x10')](function(){_0x5d6b48[_0x9d45('0x9')](0xcc)[_0x9d45('0x11')]();});}};}function handleEntityNotFound(_0x369bf7){return function(_0x2fa89c){if(!_0x2fa89c){_0x369bf7['sendStatus'](0x194);}return _0x2fa89c;};}function handleError(_0x5006c5,_0x9acd15){_0x9acd15=_0x9acd15||0x1f4;return function(_0x1f4650){logger[_0x9d45('0x12')](_0x1f4650[_0x9d45('0x13')]);if(_0x1f4650[_0x9d45('0x14')]){delete _0x1f4650[_0x9d45('0x14')];}_0x5006c5[_0x9d45('0x9')](_0x9acd15)[_0x9d45('0x15')](_0x1f4650);};}function maskClientSecret(_0x5cc9ea){return _[_0x9d45('0x16')](_0x5cc9ea['slice'](0x0,0x3),0x14,'*');}exports[_0x9d45('0x17')]=function(_0x3a6998,_0x46752d){var _0x44a2e3={},_0x52e986={},_0x5ab5fc={'count':0x0,'rows':[]};var _0x58ae5e=_[_0x9d45('0x18')](db['CloudProvider'][_0x9d45('0x19')],function(_0x4b35be){return{'name':_0x4b35be[_0x9d45('0x1a')],'type':_0x4b35be['type'][_0x9d45('0x1b')]};});_0x52e986[_0x9d45('0x1c')]=_[_0x9d45('0x18')](_0x58ae5e,_0x9d45('0x14'));_0x52e986[_0x9d45('0x1d')]=_[_0x9d45('0x1e')](_0x3a6998[_0x9d45('0x1d')]);_0x52e986[_0x9d45('0x1f')]=_[_0x9d45('0x20')](_0x52e986[_0x9d45('0x1c')],_0x52e986[_0x9d45('0x1d')]);_0x44a2e3[_0x9d45('0x21')]=_[_0x9d45('0x20')](_0x52e986['model'],qs['fields'](_0x3a6998['query'][_0x9d45('0x22')]));_0x44a2e3[_0x9d45('0x21')]=_0x44a2e3[_0x9d45('0x21')][_0x9d45('0x23')]?_0x44a2e3[_0x9d45('0x21')]:_0x52e986[_0x9d45('0x1c')];if(!_0x3a6998[_0x9d45('0x1d')][_0x9d45('0x24')](_0x9d45('0x25'))){_0x44a2e3[_0x9d45('0xe')]=qs[_0x9d45('0xe')](_0x3a6998[_0x9d45('0x1d')]['limit']);_0x44a2e3[_0x9d45('0xb')]=qs[_0x9d45('0xb')](_0x3a6998[_0x9d45('0x1d')][_0x9d45('0xb')]);}_0x44a2e3[_0x9d45('0x26')]=qs['sort'](_0x3a6998[_0x9d45('0x1d')][_0x9d45('0x27')]);_0x44a2e3[_0x9d45('0x28')]=qs[_0x9d45('0x1f')](_[_0x9d45('0x29')](_0x3a6998[_0x9d45('0x1d')],_0x52e986['filters']),_0x58ae5e);if(_0x3a6998[_0x9d45('0x1d')][_0x9d45('0x2a')]){_0x44a2e3['where']=_[_0x9d45('0x2b')](_0x44a2e3[_0x9d45('0x28')],{'$or':_[_0x9d45('0x18')](_0x58ae5e,function(_0x11fdd2){if(_0x11fdd2[_0x9d45('0x2c')]!==_0x9d45('0x2d')){var _0x157206={};_0x157206[_0x11fdd2[_0x9d45('0x14')]]={'$like':'%'+_0x3a6998['query'][_0x9d45('0x2a')]+'%'};return _0x157206;}})});}_0x44a2e3=_[_0x9d45('0x2b')]({},_0x44a2e3,_0x3a6998[_0x9d45('0x2e')]);var _0x1c3d58={'where':_0x44a2e3[_0x9d45('0x28')]};return db[_0x9d45('0x2f')][_0x9d45('0xd')](_0x1c3d58)[_0x9d45('0x10')](function(_0x5b0acb){_0x5ab5fc[_0x9d45('0xd')]=_0x5b0acb;if(_0x3a6998[_0x9d45('0x1d')][_0x9d45('0x30')]){_0x44a2e3[_0x9d45('0x31')]=[{'all':!![]}];}return db[_0x9d45('0x2f')]['findAll'](_0x44a2e3);})[_0x9d45('0x10')](function(_0x1b83a3){_0x5ab5fc[_0x9d45('0x32')]=_['map'](_0x1b83a3,function(_0x37c46e){if(_0x37c46e['service']==='MicrosoftAzure'){var _0x50d8fd=encryptor[_0x9d45('0x33')](_0x37c46e[_0x9d45('0x34')]);_0x37c46e[_0x9d45('0x34')]=maskClientSecret(_0x50d8fd);}return _0x37c46e;});return _0x5ab5fc;})['then'](respondWithFilteredResult(_0x46752d,_0x44a2e3))[_0x9d45('0x35')](handleError(_0x46752d,null));};exports['show']=function(_0x1654bf,_0x14e40c){var _0x2cbf6b={'raw':!![],'where':{'id':_0x1654bf[_0x9d45('0x36')]['id']}},_0x527da9={};_0x527da9[_0x9d45('0x1c')]=_[_0x9d45('0x1e')](db[_0x9d45('0x2f')][_0x9d45('0x19')]);_0x527da9[_0x9d45('0x1d')]=_[_0x9d45('0x1e')](_0x1654bf['query']);_0x527da9[_0x9d45('0x1f')]=_[_0x9d45('0x20')](_0x527da9[_0x9d45('0x1c')],_0x527da9[_0x9d45('0x1d')]);_0x2cbf6b[_0x9d45('0x21')]=_['intersection'](_0x527da9[_0x9d45('0x1c')],qs[_0x9d45('0x22')](_0x1654bf[_0x9d45('0x1d')][_0x9d45('0x22')]));_0x2cbf6b[_0x9d45('0x21')]=_0x2cbf6b['attributes']['length']?_0x2cbf6b[_0x9d45('0x21')]:_0x527da9[_0x9d45('0x1c')];if(_0x1654bf[_0x9d45('0x1d')][_0x9d45('0x30')]){_0x2cbf6b[_0x9d45('0x31')]=[{'all':!![]}];}_0x2cbf6b=_[_0x9d45('0x2b')]({},_0x2cbf6b,_0x1654bf[_0x9d45('0x2e')]);return db[_0x9d45('0x2f')][_0x9d45('0x37')](_0x2cbf6b)[_0x9d45('0x10')](handleEntityNotFound(_0x14e40c,null))[_0x9d45('0x10')](function(_0x5f4577){if(_0x5f4577[_0x9d45('0x38')]===_0x9d45('0x39')){var _0x43b9fe=encryptor['decryptString'](_0x5f4577['data3']);_0x5f4577['data3']=maskClientSecret(_0x43b9fe);}return _0x5f4577;})[_0x9d45('0x10')](respondWithResult(_0x14e40c,null))[_0x9d45('0x35')](handleError(_0x14e40c,null));};exports[_0x9d45('0x3a')]=function(_0x4f603d,_0x393f92){if(!_0x4f603d[_0x9d45('0x3b')][_0x9d45('0x14')])throw new Error(_0x9d45('0x3c'));if(!_0x4f603d[_0x9d45('0x3b')][_0x9d45('0x38')])throw new Error(_0x9d45('0x3d'));var _0x8f878f=db[_0x9d45('0x2f')][_0x9d45('0x19')][_0x9d45('0x38')][_0x9d45('0x3e')];if(!_0x8f878f[_0x9d45('0x3f')](_0x4f603d[_0x9d45('0x3b')][_0x9d45('0x38')]))throw new Error(_0x9d45('0x40')+_0x8f878f['join'](',\x20'));if(_0x4f603d[_0x9d45('0x3b')][_0x9d45('0x38')]===_0x9d45('0x39')&&_0x4f603d['body']['data3']){_0x4f603d['body'][_0x9d45('0x34')]=encryptor['encryptString'](_0x4f603d[_0x9d45('0x3b')][_0x9d45('0x34')]);}return db['CloudProvider']['create'](_0x4f603d[_0x9d45('0x3b')],{})['then'](respondWithResult(_0x393f92,0xc9))['catch'](handleError(_0x393f92,null));};exports[_0x9d45('0x41')]=function(_0x39d816,_0x2b0cf5){if(_0x39d816[_0x9d45('0x3b')]['id']){delete _0x39d816[_0x9d45('0x3b')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x39d816['params']['id']}})['then'](handleEntityNotFound(_0x2b0cf5,null))[_0x9d45('0x10')](function(_0x2fa93a){if(_0x2fa93a[_0x9d45('0x38')]==='MicrosoftAzure'&&_0x39d816[_0x9d45('0x3b')][_0x9d45('0x34')]){_0x39d816[_0x9d45('0x3b')][_0x9d45('0x34')]=encryptor['encryptString'](_0x39d816[_0x9d45('0x3b')][_0x9d45('0x34')]);}return _0x2fa93a;})[_0x9d45('0x10')](saveUpdates(_0x39d816[_0x9d45('0x3b')],null))[_0x9d45('0x10')](respondWithResult(_0x2b0cf5,null))[_0x9d45('0x35')](handleError(_0x2b0cf5,null));};exports[_0x9d45('0x42')]=function(_0xc34af5,_0x15f4a9){return db[_0x9d45('0x2f')][_0x9d45('0x37')]({'where':{'id':_0xc34af5[_0x9d45('0x36')]['id']}})[_0x9d45('0x10')](handleEntityNotFound(_0x15f4a9,null))['then'](removeEntity(_0x15f4a9,null))['catch'](handleError(_0x15f4a9,null));};exports['oauth2MicrosoftAuthorize']=function(_0xe4b1a9,_0x30a367){return db[_0x9d45('0x2f')][_0x9d45('0x43')]({'where':{'id':_0xe4b1a9['params']['id']},'raw':!![]})[_0x9d45('0x10')](function(_0x4b747){if(!_0x4b747)return _0x30a367['sendStatus'](0x194);return{'url':oauth[_0x9d45('0x44')](_0x4b747,_0xe4b1a9[_0x9d45('0x45')]['id'])};})[_0x9d45('0x10')](respondWithResult(_0x30a367,null))[_0x9d45('0x35')](handleError(_0x30a367,null));};exports[_0x9d45('0x46')]=function(_0xb9da1e,_0x4ff82d){var _0x5d8df9=_0xb9da1e[_0x9d45('0x3b')];var _0x5eff8c;var _0x39f3ef;if(_0x5d8df9[_0x9d45('0x12')])throw _0x5d8df9;redis[_0x9d45('0x47')](_0x5d8df9['state'])[_0x9d45('0x10')](function(_0x4ed95d){if(!_0x4ed95d)throw new Error(_0x9d45('0x48'));_0x5eff8c=JSON['parse'](_0x4ed95d);var _0x343927=Buffer['from'](_0x5d8df9[_0x9d45('0x49')],_0x9d45('0x4a'))[_0x9d45('0x4b')](_0x9d45('0x4c'));_0x39f3ef=JSON['parse'](_0x343927);if(!oauth[_0x9d45('0x4d')](_0x5d8df9['id_token'],_0x5eff8c[_0x9d45('0x4e')]))throw new Error(_0x9d45('0x4f'));redis[_0x9d45('0x50')](_0x5d8df9['state']);return oauth[_0x9d45('0x51')](_0x5d8df9[_0x9d45('0x52')],_0x5eff8c);})[_0x9d45('0x10')](function(_0x4e6bc4){_0x5eff8c[_0x9d45('0x53')]=_0x4e6bc4[_0x9d45('0x54')];_0x5eff8c[_0x9d45('0x55')]=_0x4e6bc4['refresh_token'];return db[_0x9d45('0x2f')][_0x9d45('0x41')]({'data5':_0x5eff8c['data5'],'data6':_0x5eff8c[_0x9d45('0x55')]},{'where':{'id':_0x5eff8c['id']}});})['then'](function(){oauth[_0x9d45('0x56')](_0x5eff8c);socket[_0x9d45('0x57')](_0x9d45('0x58'),{'id':_0x39f3ef['id']});return;})['then'](respondWithStatusCode(_0x4ff82d,null))[_0x9d45('0x35')](function(_0x584ef9){if(_0x39f3ef){socket[_0x9d45('0x57')](_0x9d45('0x59'),{'id':_0x39f3ef['id']});}if(!_0x5eff8c){logger[_0x9d45('0x12')](_0x9d45('0x5a'),_0x584ef9);return _0x4ff82d['status'](0x1f4)[_0x9d45('0x15')](_0x584ef9[_0x9d45('0x5b')]);}logger['error'](_0x9d45('0x5c'),_0x5eff8c['id'],JSON[_0x9d45('0x5d')](_0x584ef9));});}; \ No newline at end of file +var _0x45ce=['sort','where','pick','filter','merge','VIRTUAL','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','keys','includeAll','include','options','find','service','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x221fb4,_0x20af17){var _0x32e53d=function(_0x624c3b){while(--_0x624c3b){_0x221fb4['push'](_0x221fb4['shift']());}};_0x32e53d(++_0x20af17);}(_0x45ce,0xf5));var _0xe45c=function(_0x2bb268,_0x47314a){_0x2bb268=_0x2bb268-0x0;var _0x1df5c0=_0x45ce[_0x2bb268];return _0x1df5c0;};'use strict';var _=require(_0xe45c('0x0'));var Redis=require(_0xe45c('0x1'));var qs=require(_0xe45c('0x2'));var encryptor=require(_0xe45c('0x3'));var config=require(_0xe45c('0x4'));var logger=require('../../config/logger')(_0xe45c('0x5'));var db=require(_0xe45c('0x6'))['db'];var oauth=require(_0xe45c('0x7'));config[_0xe45c('0x8')]=_['defaults'](config[_0xe45c('0x8')],{'host':_0xe45c('0x9'),'port':0x18eb});var socket=require(_0xe45c('0xa'))(new Redis(config[_0xe45c('0x8')]));var redis=new Redis(config[_0xe45c('0x8')]);function respondWithStatusCode(_0x3002f0,_0x4f9719){_0x4f9719=_0x4f9719||0xcc;return function(_0x5c51b5){if(_0x5c51b5){return _0x3002f0[_0xe45c('0xb')](_0x4f9719);}return _0x3002f0[_0xe45c('0xc')](_0x4f9719)['end']();};}function respondWithResult(_0x294f82,_0xd8dde3){_0xd8dde3=_0xd8dde3||0xc8;return function(_0xb97f1e){if(_0xb97f1e){return _0x294f82[_0xe45c('0xc')](_0xd8dde3)[_0xe45c('0xd')](_0xb97f1e);}};}function respondWithFilteredResult(_0x30757e,_0x5a3748){return function(_0x2fcafc){if(_0x2fcafc){var _0x49f70f=typeof _0x5a3748[_0xe45c('0xe')]===_0xe45c('0xf')&&typeof _0x5a3748[_0xe45c('0x10')]===_0xe45c('0xf');var _0xe72599=_0x2fcafc['count'];var _0x49704b=_0x49f70f?0x0:_0x5a3748[_0xe45c('0xe')];var _0x2240fa=_0x49f70f?_0x2fcafc[_0xe45c('0x11')]:_0x5a3748[_0xe45c('0xe')]+_0x5a3748['limit'];var _0x3d775f;if(_0x2240fa>=_0xe72599){_0x2240fa=_0xe72599;_0x3d775f=0xc8;}else{_0x3d775f=0xce;}_0x30757e[_0xe45c('0xc')](_0x3d775f);return _0x30757e['set'](_0xe45c('0x12'),_0x49704b+'-'+_0x2240fa+'/'+_0xe72599)[_0xe45c('0xd')](_0x2fcafc);}return null;};}function saveUpdates(_0x54d241){return function(_0x59664b){if(_0x59664b){return _0x59664b[_0xe45c('0x13')](_0x54d241)[_0xe45c('0x14')](function(_0x1be06c){return _0x1be06c;});}return null;};}function removeEntity(_0x35cd75){return function(_0x1c5ac8){if(_0x1c5ac8){return _0x1c5ac8['destroy']()[_0xe45c('0x14')](function(){_0x35cd75['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5132de){return function(_0x5bfc59){if(!_0x5bfc59){_0x5132de[_0xe45c('0xb')](0x194);}return _0x5bfc59;};}function handleError(_0x466577,_0x2d35c8){_0x2d35c8=_0x2d35c8||0x1f4;return function(_0x488a99){logger[_0xe45c('0x15')](_0x488a99[_0xe45c('0x16')]);if(_0x488a99['name']){delete _0x488a99[_0xe45c('0x17')];}_0x466577['status'](_0x2d35c8)[_0xe45c('0x18')](_0x488a99);};}function maskClientSecret(_0x3bccc1){return _[_0xe45c('0x19')](_0x3bccc1[_0xe45c('0x1a')](0x0,0x3),0x14,'*');}exports[_0xe45c('0x1b')]=function(_0x11dbbb,_0x3826fe){var _0x148d95={},_0x44efa9={},_0x6fca68={'count':0x0,'rows':[]};var _0x384c3c=_[_0xe45c('0x1c')](db[_0xe45c('0x1d')][_0xe45c('0x1e')],function(_0x517acd){return{'name':_0x517acd[_0xe45c('0x1f')],'type':_0x517acd['type'][_0xe45c('0x20')]};});_0x44efa9[_0xe45c('0x21')]=_['map'](_0x384c3c,'name');_0x44efa9[_0xe45c('0x22')]=_['keys'](_0x11dbbb[_0xe45c('0x22')]);_0x44efa9[_0xe45c('0x23')]=_[_0xe45c('0x24')](_0x44efa9[_0xe45c('0x21')],_0x44efa9[_0xe45c('0x22')]);_0x148d95[_0xe45c('0x25')]=_[_0xe45c('0x24')](_0x44efa9['model'],qs[_0xe45c('0x26')](_0x11dbbb[_0xe45c('0x22')]['fields']));_0x148d95['attributes']=_0x148d95[_0xe45c('0x25')][_0xe45c('0x27')]?_0x148d95['attributes']:_0x44efa9[_0xe45c('0x21')];if(!_0x11dbbb['query']['hasOwnProperty']('nolimit')){_0x148d95[_0xe45c('0x10')]=qs[_0xe45c('0x10')](_0x11dbbb[_0xe45c('0x22')][_0xe45c('0x10')]);_0x148d95[_0xe45c('0xe')]=qs[_0xe45c('0xe')](_0x11dbbb[_0xe45c('0x22')][_0xe45c('0xe')]);}_0x148d95['order']=qs['sort'](_0x11dbbb[_0xe45c('0x22')][_0xe45c('0x28')]);_0x148d95[_0xe45c('0x29')]=qs[_0xe45c('0x23')](_[_0xe45c('0x2a')](_0x11dbbb[_0xe45c('0x22')],_0x44efa9[_0xe45c('0x23')]),_0x384c3c);if(_0x11dbbb['query'][_0xe45c('0x2b')]){_0x148d95[_0xe45c('0x29')]=_[_0xe45c('0x2c')](_0x148d95['where'],{'$or':_[_0xe45c('0x1c')](_0x384c3c,function(_0x56d75a){if(_0x56d75a['type']!==_0xe45c('0x2d')){var _0x5caaa6={};_0x5caaa6[_0x56d75a[_0xe45c('0x17')]]={'$like':'%'+_0x11dbbb[_0xe45c('0x22')][_0xe45c('0x2b')]+'%'};return _0x5caaa6;}})});}_0x148d95=_['merge']({},_0x148d95,_0x11dbbb['options']);var _0x358f5b={'where':_0x148d95[_0xe45c('0x29')]};return db[_0xe45c('0x1d')][_0xe45c('0x11')](_0x358f5b)[_0xe45c('0x14')](function(_0x2f0a57){_0x6fca68[_0xe45c('0x11')]=_0x2f0a57;if(_0x11dbbb[_0xe45c('0x22')]['includeAll']){_0x148d95['include']=[{'all':!![]}];}return db[_0xe45c('0x1d')][_0xe45c('0x2e')](_0x148d95);})[_0xe45c('0x14')](function(_0xf14f57){_0x6fca68[_0xe45c('0x2f')]=_['map'](_0xf14f57,function(_0x557c5a){if(_0x557c5a['service']===_0xe45c('0x30')){var _0x3924e5=encryptor[_0xe45c('0x31')](_0x557c5a[_0xe45c('0x32')]);_0x557c5a[_0xe45c('0x32')]=maskClientSecret(_0x3924e5);}return _0x557c5a;});return _0x6fca68;})[_0xe45c('0x14')](respondWithFilteredResult(_0x3826fe,_0x148d95))[_0xe45c('0x33')](handleError(_0x3826fe,null));};exports[_0xe45c('0x34')]=function(_0x591cf9,_0x24d0f0){var _0x20504a={'raw':!![],'where':{'id':_0x591cf9[_0xe45c('0x35')]['id']}},_0x300695={};_0x300695[_0xe45c('0x21')]=_['keys'](db['CloudProvider'][_0xe45c('0x1e')]);_0x300695['query']=_[_0xe45c('0x36')](_0x591cf9[_0xe45c('0x22')]);_0x300695[_0xe45c('0x23')]=_[_0xe45c('0x24')](_0x300695['model'],_0x300695[_0xe45c('0x22')]);_0x20504a[_0xe45c('0x25')]=_[_0xe45c('0x24')](_0x300695[_0xe45c('0x21')],qs[_0xe45c('0x26')](_0x591cf9[_0xe45c('0x22')][_0xe45c('0x26')]));_0x20504a[_0xe45c('0x25')]=_0x20504a['attributes']['length']?_0x20504a[_0xe45c('0x25')]:_0x300695[_0xe45c('0x21')];if(_0x591cf9['query'][_0xe45c('0x37')]){_0x20504a[_0xe45c('0x38')]=[{'all':!![]}];}_0x20504a=_[_0xe45c('0x2c')]({},_0x20504a,_0x591cf9[_0xe45c('0x39')]);return db['CloudProvider'][_0xe45c('0x3a')](_0x20504a)[_0xe45c('0x14')](handleEntityNotFound(_0x24d0f0,null))[_0xe45c('0x14')](function(_0x4c5842){if(_0x4c5842[_0xe45c('0x3b')]===_0xe45c('0x30')){var _0x3ba77f=encryptor[_0xe45c('0x31')](_0x4c5842[_0xe45c('0x32')]);_0x4c5842[_0xe45c('0x32')]=maskClientSecret(_0x3ba77f);}return _0x4c5842;})['then'](respondWithResult(_0x24d0f0,null))['catch'](handleError(_0x24d0f0,null));};exports['create']=function(_0x2d01a1,_0x53f941){if(!_0x2d01a1['body'][_0xe45c('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x2d01a1[_0xe45c('0x3c')]['service'])throw new Error(_0xe45c('0x3d'));var _0x4419d2=db['CloudProvider'][_0xe45c('0x1e')][_0xe45c('0x3b')]['values'];if(!_0x4419d2[_0xe45c('0x3e')](_0x2d01a1[_0xe45c('0x3c')][_0xe45c('0x3b')]))throw new Error(_0xe45c('0x3f')+_0x4419d2['join'](',\x20'));if(_0x2d01a1[_0xe45c('0x3c')][_0xe45c('0x3b')]==='MicrosoftAzure'&&_0x2d01a1[_0xe45c('0x3c')][_0xe45c('0x32')]){_0x2d01a1[_0xe45c('0x3c')]['data3']=encryptor[_0xe45c('0x40')](_0x2d01a1[_0xe45c('0x3c')]['data3']);}return db[_0xe45c('0x1d')]['create'](_0x2d01a1[_0xe45c('0x3c')],{})[_0xe45c('0x14')](respondWithResult(_0x53f941,0xc9))['catch'](handleError(_0x53f941,null));};exports[_0xe45c('0x13')]=function(_0x44ce75,_0x4cc2f2){if(_0x44ce75[_0xe45c('0x3c')]['id']){delete _0x44ce75[_0xe45c('0x3c')]['id'];}return db[_0xe45c('0x1d')][_0xe45c('0x3a')]({'where':{'id':_0x44ce75[_0xe45c('0x35')]['id']}})[_0xe45c('0x14')](handleEntityNotFound(_0x4cc2f2,null))[_0xe45c('0x14')](function(_0x50fe75){if(_0x50fe75[_0xe45c('0x3b')]===_0xe45c('0x30')&&_0x44ce75['body'][_0xe45c('0x32')]){_0x44ce75['body'][_0xe45c('0x32')]=encryptor[_0xe45c('0x40')](_0x44ce75[_0xe45c('0x3c')]['data3']);}return _0x50fe75;})[_0xe45c('0x14')](saveUpdates(_0x44ce75['body'],null))[_0xe45c('0x14')](respondWithResult(_0x4cc2f2,null))[_0xe45c('0x33')](handleError(_0x4cc2f2,null));};exports[_0xe45c('0x41')]=function(_0x3d6b3a,_0x5a3681){return db[_0xe45c('0x1d')][_0xe45c('0x3a')]({'where':{'id':_0x3d6b3a[_0xe45c('0x35')]['id']}})[_0xe45c('0x14')](handleEntityNotFound(_0x5a3681,null))['then'](removeEntity(_0x5a3681,null))[_0xe45c('0x33')](handleError(_0x5a3681,null));};exports[_0xe45c('0x42')]=function(_0x1427cf,_0xd62d45){return db[_0xe45c('0x1d')][_0xe45c('0x43')]({'where':{'id':_0x1427cf[_0xe45c('0x35')]['id']},'raw':!![]})['then'](function(_0x412be8){if(!_0x412be8)return _0xd62d45['sendStatus'](0x194);return{'url':oauth[_0xe45c('0x44')](_0x412be8,_0x1427cf[_0xe45c('0x45')]['id'])};})[_0xe45c('0x14')](respondWithResult(_0xd62d45,null))[_0xe45c('0x33')](handleError(_0xd62d45,null));};exports[_0xe45c('0x46')]=function(_0x7664c6,_0x344937){var _0x21b93b=_0x7664c6[_0xe45c('0x3c')];var _0x17e69e;var _0x1ab70b;if(_0x21b93b[_0xe45c('0x15')])throw _0x21b93b;redis[_0xe45c('0x47')](_0x21b93b[_0xe45c('0x48')])['then'](function(_0x3d4728){if(!_0x3d4728)throw new Error(_0xe45c('0x49'));_0x17e69e=JSON[_0xe45c('0x4a')](_0x3d4728);var _0x139287=Buffer[_0xe45c('0x4b')](_0x21b93b[_0xe45c('0x48')],_0xe45c('0x4c'))['toString'](_0xe45c('0x4d'));_0x1ab70b=JSON[_0xe45c('0x4a')](_0x139287);if(!oauth[_0xe45c('0x4e')](_0x21b93b[_0xe45c('0x4f')],_0x17e69e[_0xe45c('0x50')]))throw new Error(_0xe45c('0x51'));redis[_0xe45c('0x52')](_0x21b93b[_0xe45c('0x48')]);return oauth[_0xe45c('0x53')](_0x21b93b[_0xe45c('0x54')],_0x17e69e);})[_0xe45c('0x14')](function(_0x338ca8){_0x17e69e[_0xe45c('0x55')]=_0x338ca8['access_token'];_0x17e69e[_0xe45c('0x56')]=_0x338ca8[_0xe45c('0x57')];return db[_0xe45c('0x1d')]['update']({'data5':_0x17e69e['data5'],'data6':_0x17e69e[_0xe45c('0x56')]},{'where':{'id':_0x17e69e['id']}});})[_0xe45c('0x14')](function(){oauth['startRefreshInterval'](_0x17e69e);socket[_0xe45c('0x58')](_0xe45c('0x59'),{'id':_0x1ab70b['id']});return;})[_0xe45c('0x14')](respondWithStatusCode(_0x344937,null))[_0xe45c('0x33')](function(_0x1c284e){if(_0x1ab70b){socket[_0xe45c('0x58')](_0xe45c('0x5a'),{'id':_0x1ab70b['id']});}if(!_0x17e69e){logger[_0xe45c('0x15')](_0xe45c('0x5b'),_0x1c284e);return _0x344937['status'](0x1f4)[_0xe45c('0x18')](_0x1c284e[_0xe45c('0x5c')]);}logger[_0xe45c('0x15')](_0xe45c('0x5d'),_0x17e69e['id'],JSON[_0xe45c('0x5e')](_0x1c284e));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2547107..6bcb5dd 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 _0x331a=['bluebird','path','rimraf','exports','define','CloudProvider','cloud_providers','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x331a,0x1a5));var _0xa331=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0x331a[_0x1f1fb4];return _0x12fa15;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa331('0x0'));var moment=require(_0xa331('0x1'));var BPromise=require(_0xa331('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa331('0x3'));var rimraf=require(_0xa331('0x4'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0xa331('0x5')]=function(_0x26fd6e,_0x56f264){return _0x26fd6e[_0xa331('0x6')](_0xa331('0x7'),attributes,{'tableName':_0xa331('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x692e=['bluebird','request-promise','rimraf','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','../../config/logger','api','moment'];(function(_0x4c1991,_0x11a24b){var _0x4fbd4a=function(_0x4f478f){while(--_0x4f478f){_0x4c1991['push'](_0x4c1991['shift']());}};_0x4fbd4a(++_0x11a24b);}(_0x692e,0xa3));var _0xe692=function(_0x2bbd83,_0x3aeddb){_0x2bbd83=_0x2bbd83-0x0;var _0x45cf9d=_0x692e[_0x2bbd83];return _0x45cf9d;};'use strict';var _=require(_0xe692('0x0'));var util=require(_0xe692('0x1'));var logger=require(_0xe692('0x2'))(_0xe692('0x3'));var moment=require(_0xe692('0x4'));var BPromise=require(_0xe692('0x5'));var rp=require(_0xe692('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe692('0x7'));var config=require('../../config/environment');var attributes=require(_0xe692('0x8'));module[_0xe692('0x9')]=function(_0x571dc5,_0x595c05){return _0x571dc5[_0xe692('0xa')]('CloudProvider',attributes,{'tableName':_0xe692('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 43bc10c..17c2441 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac8b=['CloudProvider','update','catch','error','intervals','bind','findAll','all','inspect','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','map','type','push','data7','join','Outlook365','/.default','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','redirect_uri','response_mode','scope','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','data1','set','decode','iss','issuer','aud','audience','isAfter','resolve','then','findOne','refresh_token','data6','data4','decryptString','data3','POST','data5','access_token'];(function(_0x55dd92,_0x4d0dbb){var _0x1b6f9e=function(_0x212ec7){while(--_0x212ec7){_0x55dd92['push'](_0x55dd92['shift']());}};_0x1b6f9e(++_0x4d0dbb);}(_0xac8b,0x190));var _0xbac8=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xac8b[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0xbac8('0x0'));var crypto=require(_0xbac8('0x1'));var jwt=require(_0xbac8('0x2'));var moment=require(_0xbac8('0x3'));var Redis=require(_0xbac8('0x4'));var rp=require(_0xbac8('0x5'));var util=require(_0xbac8('0x6'));var encryptor=require(_0xbac8('0x7'));var config=require(_0xbac8('0x8'));var logger=require(_0xbac8('0x9'))('api');var schedule=require(_0xbac8('0xa'));var db=require(_0xbac8('0xb'))['db'];config['redis']=_[_0xbac8('0xc')](config['redis'],{'host':_0xbac8('0xd'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xbac8('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xbac8('0xf'),'profile','email',_0xbac8('0x10'),_0xbac8('0x11'),_0xbac8('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xbac8('0xf'),_0xbac8('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xbac8('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xbac8('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x35b646){var _0x3e05ca=_[_0xbac8('0x15')](AZURE_AUTH_SCOPES[_0x35b646[_0xbac8('0x16')]]);if(_0x35b646[_0xbac8('0x16')]==='Dynamics365')_0x3e05ca[_0xbac8('0x17')](_0x35b646[_0xbac8('0x18')]+'/.default');return _0x3e05ca[_0xbac8('0x19')]('\x20');}function getAccessTokenScope(_0x34c37d){if(_0x34c37d['type']===_0xbac8('0x1a'))return _0xbac8('0x11');if(_0x34c37d[_0xbac8('0x16')]==='Dynamics365')return _0x34c37d['data7']+_0xbac8('0x1b');}function generateMicrosoftAuthorizationUrl(_0x362823,_0x347452){var _0x2f3847=MICROSOFT_AUTH_URL['replace'](_0xbac8('0x1c'),_0x362823[_0xbac8('0x1d')]);var _0x48ef87=['code',_0xbac8('0x1e')];var _0x45a230=Buffer[_0xbac8('0x1f')](JSON[_0xbac8('0x20')]({'id':_0x347452}))[_0xbac8('0x21')](_0xbac8('0x22'));var _0x4cd942=crypto[_0xbac8('0x23')](0x10)[_0xbac8('0x21')](_0xbac8('0x24'));var _0x52598d=getAuthorizationScopes(_0x362823);var _0x35fe3a=[{'key':_0xbac8('0x25'),'value':_0x362823['data1']},{'key':'response_type','value':encodeURIComponent(_0x48ef87[_0xbac8('0x19')]('\x20'))},{'key':_0xbac8('0x26'),'value':_0x362823['data4']},{'key':_0xbac8('0x27'),'value':'form_post'},{'key':_0xbac8('0x28'),'value':encodeURIComponent(_0x52598d)},{'key':'state','value':_0x45a230},{'key':_0xbac8('0x29'),'value':_0x4cd942},{'key':_0xbac8('0x2a'),'value':_0xbac8('0x2b')}];var _0x4631a9=_0x2f3847+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xbac8('0x15')](_0x35fe3a,function(_0x1c7dd2){return _0x1c7dd2[_0xbac8('0x2c')]+'='+_0x1c7dd2[_0xbac8('0x2d')];})[_0xbac8('0x19')]('&');_0x362823[_0xbac8('0x2e')]={'issuer':_0x2f3847[_0xbac8('0x2f')](_0xbac8('0x30'),''),'audience':_0x362823[_0xbac8('0x31')],'state':_0x45a230,'nonce':_0x4cd942};redis[_0xbac8('0x32')](_0x45a230,JSON[_0xbac8('0x20')](_0x362823));return _0x4631a9;}function isValidIdToken(_0x4fa04e,_0x34ee18){try{var _0x4d4e8f=jwt[_0xbac8('0x33')](_0x4fa04e,{'complete':!![]});var _0x1bea57=_0x4d4e8f['payload'];if(_0x1bea57[_0xbac8('0x34')]!==_0x34ee18[_0xbac8('0x35')])return![];if(_0x1bea57[_0xbac8('0x36')]!==_0x34ee18[_0xbac8('0x37')])return![];if(_0x1bea57[_0xbac8('0x29')]!==_0x34ee18['nonce'])return![];if(moment()[_0xbac8('0x38')](moment['unix'](_0x1bea57['exp'])))return![];return!![];}catch(_0x4435a1){throw _0x4435a1;}}function refreshOauth2MicrosoftAccessToken(_0x116ad3){return Promise[_0xbac8('0x39')]()[_0xbac8('0x3a')](function(){if(_0x116ad3['data3'])return _0x116ad3;return db['CloudProvider'][_0xbac8('0x3b')]({'where':{'id':_0x116ad3['id']},'raw':!![]});})['then'](function(_0x20f5c1){var _0x5f8e3d={'grant_type':_0xbac8('0x3c'),'refresh_token':_0x20f5c1[_0xbac8('0x3d')],'scope':getAccessTokenScope(_0x20f5c1),'redirect_uri':_0x20f5c1[_0xbac8('0x3e')],'client_id':_0x20f5c1[_0xbac8('0x31')],'client_secret':encryptor[_0xbac8('0x3f')](_0x20f5c1[_0xbac8('0x40')])};var _0x252a7e={'method':_0xbac8('0x41'),'uri':MICROSOFT_AUTH_URL[_0xbac8('0x2f')](_0xbac8('0x1c'),_0x20f5c1[_0xbac8('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5f8e3d,'json':!![]};return rp(_0x252a7e);})['then'](function(_0x4c8d06){_0x116ad3[_0xbac8('0x42')]=_0x4c8d06[_0xbac8('0x43')];_0x116ad3[_0xbac8('0x3d')]=_0x4c8d06[_0xbac8('0x3c')];return db[_0xbac8('0x44')][_0xbac8('0x45')]({'data5':_0x116ad3[_0xbac8('0x42')],'data6':_0x116ad3[_0xbac8('0x3d')]},{'where':{'id':_0x116ad3['id']}});})[_0xbac8('0x3a')](function(){return _0x116ad3;})[_0xbac8('0x46')](function(_0x364dba){logger[_0xbac8('0x47')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x116ad3['id'],_0x364dba);});}function getOauth2MicrosoftAccessToken(_0x1d7a58,_0x168069){var _0x5ad207={'grant_type':'authorization_code','code':_0x1d7a58,'scope':getAccessTokenScope(_0x168069),'redirect_uri':_0x168069['data4'],'client_id':_0x168069['data1'],'client_secret':encryptor[_0xbac8('0x3f')](_0x168069[_0xbac8('0x40')])};var _0x363f2d={'method':_0xbac8('0x41'),'uri':MICROSOFT_AUTH_URL[_0xbac8('0x2f')](_0xbac8('0x1c'),_0x168069['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5ad207,'json':!![]};return rp(_0x363f2d);}function startRefreshInterval(_0x304938){var _0x4f850=schedule[_0xbac8('0x48')];if(_0x4f850[_0x304938['id']])clearInterval(_0x4f850[_0x304938['id']]);_0x4f850[_0x304938['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xbac8('0x49')](this,{'id':_0x304938['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4f850;}function startAllRefreshIntervals(){return db[_0xbac8('0x44')][_0xbac8('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x5eeaa6){var _0x2b86f1=_0x5eeaa6[_0xbac8('0x15')](function(_0x3a5d9e){return refreshOauth2MicrosoftAccessToken(_0x3a5d9e)['then'](function(_0x1d1a80){startRefreshInterval(_0x1d1a80);});});return Promise[_0xbac8('0x4b')](_0x2b86f1);})['catch'](function(_0x3023dc){var _0x2686e5=_0x3023dc?util[_0xbac8('0x4c')](_0x3023dc,{'showHidden':![],'depth':null}):'';logger[_0xbac8('0x47')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x2686e5);});}module[_0xbac8('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x702a=['client_id','data1','data4','response_mode','scope','state','nonce','prompt','login','value','oauth2Claims','oauth2/','set','decode','iss','issuer','isAfter','exp','resolve','then','findOne','data6','decryptString','POST','data2','access_token','refresh_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','intervals','bind','CloudProvider','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','code','id_token','from','stringify','toString','base64','randomBytes'];(function(_0x4eae3c,_0xba4fe4){var _0x4265a6=function(_0xead087){while(--_0xead087){_0x4eae3c['push'](_0x4eae3c['shift']());}};_0x4265a6(++_0xba4fe4);}(_0x702a,0x1ba));var _0xa702=function(_0x24dade,_0x449b06){_0x24dade=_0x24dade-0x0;var _0x17eca3=_0x702a[_0x24dade];return _0x17eca3;};'use strict';var _=require(_0xa702('0x0'));var crypto=require('crypto');var jwt=require(_0xa702('0x1'));var moment=require(_0xa702('0x2'));var Redis=require('ioredis');var rp=require(_0xa702('0x3'));var util=require(_0xa702('0x4'));var encryptor=require(_0xa702('0x5'));var config=require(_0xa702('0x6'));var logger=require(_0xa702('0x7'))(_0xa702('0x8'));var schedule=require(_0xa702('0x9'));var db=require('../../mysqldb')['db'];config[_0xa702('0xa')]=_[_0xa702('0xb')](config[_0xa702('0xa')],{'host':_0xa702('0xc'),'port':0x18eb});var redis=new Redis(config[_0xa702('0xa')]);var MICROSOFT_AUTH_URL=_0xa702('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa702('0xe'),_0xa702('0xf'),'email',_0xa702('0x10'),_0xa702('0x11'),_0xa702('0x12'),_0xa702('0x13')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xa702('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x207b64){var _0x1869e8=_[_0xa702('0x15')](AZURE_AUTH_SCOPES[_0x207b64['type']]);if(_0x207b64[_0xa702('0x16')]===_0xa702('0x17'))_0x1869e8[_0xa702('0x18')](_0x207b64[_0xa702('0x19')]+_0xa702('0x1a'));return _0x1869e8[_0xa702('0x1b')]('\x20');}function getAccessTokenScope(_0xa32011){if(_0xa32011[_0xa702('0x16')]===_0xa702('0x1c'))return _0xa702('0x11');if(_0xa32011[_0xa702('0x16')]===_0xa702('0x17'))return _0xa32011['data7']+_0xa702('0x1a');}function generateMicrosoftAuthorizationUrl(_0x402f72,_0x11d27d){var _0xd23ddf=MICROSOFT_AUTH_URL[_0xa702('0x1d')](_0xa702('0x1e'),_0x402f72['data2']);var _0x5df0d6=[_0xa702('0x1f'),_0xa702('0x20')];var _0x220f0b=Buffer[_0xa702('0x21')](JSON[_0xa702('0x22')]({'id':_0x11d27d}))[_0xa702('0x23')](_0xa702('0x24'));var _0x42bd75=crypto[_0xa702('0x25')](0x10)[_0xa702('0x23')]('hex');var _0x28ed17=getAuthorizationScopes(_0x402f72);var _0x128104=[{'key':_0xa702('0x26'),'value':_0x402f72[_0xa702('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x5df0d6[_0xa702('0x1b')]('\x20'))},{'key':'redirect_uri','value':_0x402f72[_0xa702('0x28')]},{'key':_0xa702('0x29'),'value':'form_post'},{'key':_0xa702('0x2a'),'value':encodeURIComponent(_0x28ed17)},{'key':_0xa702('0x2b'),'value':_0x220f0b},{'key':_0xa702('0x2c'),'value':_0x42bd75},{'key':_0xa702('0x2d'),'value':_0xa702('0x2e')}];var _0x3cbdff=_0xd23ddf+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x128104,function(_0x18dce1){return _0x18dce1['key']+'='+_0x18dce1[_0xa702('0x2f')];})['join']('&');_0x402f72[_0xa702('0x30')]={'issuer':_0xd23ddf[_0xa702('0x1d')](_0xa702('0x31'),''),'audience':_0x402f72['data1'],'state':_0x220f0b,'nonce':_0x42bd75};redis[_0xa702('0x32')](_0x220f0b,JSON[_0xa702('0x22')](_0x402f72));return _0x3cbdff;}function isValidIdToken(_0x27b8e6,_0x55cbf1){try{var _0x2d7dfe=jwt[_0xa702('0x33')](_0x27b8e6,{'complete':!![]});var _0x1a3a6d=_0x2d7dfe['payload'];if(_0x1a3a6d[_0xa702('0x34')]!==_0x55cbf1[_0xa702('0x35')])return![];if(_0x1a3a6d['aud']!==_0x55cbf1['audience'])return![];if(_0x1a3a6d['nonce']!==_0x55cbf1['nonce'])return![];if(moment()[_0xa702('0x36')](moment['unix'](_0x1a3a6d[_0xa702('0x37')])))return![];return!![];}catch(_0xf99eae){throw _0xf99eae;}}function refreshOauth2MicrosoftAccessToken(_0x5858b7){return Promise[_0xa702('0x38')]()[_0xa702('0x39')](function(){if(_0x5858b7['data3'])return _0x5858b7;return db['CloudProvider'][_0xa702('0x3a')]({'where':{'id':_0x5858b7['id']},'raw':!![]});})[_0xa702('0x39')](function(_0x40de28){var _0x5d1d6e={'grant_type':'refresh_token','refresh_token':_0x40de28[_0xa702('0x3b')],'scope':getAccessTokenScope(_0x40de28),'redirect_uri':_0x40de28['data4'],'client_id':_0x40de28[_0xa702('0x27')],'client_secret':encryptor[_0xa702('0x3c')](_0x40de28['data3'])};var _0x3d949b={'method':_0xa702('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xa702('0x1d')](_0xa702('0x1e'),_0x40de28[_0xa702('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5d1d6e,'json':!![]};return rp(_0x3d949b);})[_0xa702('0x39')](function(_0x4219a6){_0x5858b7['data5']=_0x4219a6[_0xa702('0x3f')];_0x5858b7['data6']=_0x4219a6[_0xa702('0x40')];return db['CloudProvider'][_0xa702('0x41')]({'data5':_0x5858b7[_0xa702('0x42')],'data6':_0x5858b7['data6']},{'where':{'id':_0x5858b7['id']}});})['then'](function(){return _0x5858b7;})[_0xa702('0x43')](function(_0x34a00a){logger[_0xa702('0x44')](_0xa702('0x45'),_0x5858b7['id'],_0x34a00a);});}function getOauth2MicrosoftAccessToken(_0x228a8c,_0x20ca7c){var _0xb37884={'grant_type':_0xa702('0x46'),'code':_0x228a8c,'scope':getAccessTokenScope(_0x20ca7c),'redirect_uri':_0x20ca7c[_0xa702('0x28')],'client_id':_0x20ca7c[_0xa702('0x27')],'client_secret':encryptor[_0xa702('0x3c')](_0x20ca7c[_0xa702('0x47')])};var _0x43f9fa={'method':_0xa702('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xa702('0x1d')](_0xa702('0x1e'),_0x20ca7c[_0xa702('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xb37884,'json':!![]};return rp(_0x43f9fa);}function startRefreshInterval(_0xb54067){var _0x2ce412=schedule[_0xa702('0x48')];if(_0x2ce412[_0xb54067['id']])clearInterval(_0x2ce412[_0xb54067['id']]);_0x2ce412[_0xb54067['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa702('0x49')](this,{'id':_0xb54067['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x2ce412;}function startAllRefreshIntervals(){return db[_0xa702('0x4a')][_0xa702('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa702('0x39')](function(_0x53afbe){var _0x2b6a6c=_0x53afbe[_0xa702('0x15')](function(_0x145f82){return refreshOauth2MicrosoftAccessToken(_0x145f82)[_0xa702('0x39')](function(_0xa337d){startRefreshInterval(_0xa337d);});});return Promise[_0xa702('0x4c')](_0x2b6a6c);})[_0xa702('0x43')](function(_0x2302d1){var _0x31a778=_0x2302d1?util[_0xa702('0x4d')](_0x2302d1,{'showHidden':![],'depth':null}):'';logger[_0xa702('0x44')](_0xa702('0x4e'),_0x31a778);});}module[_0xa702('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index ba53930..5f5134c 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 _0xd6f9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0xcdf96f,_0xc63784){var _0xb59f45=function(_0xee7cc8){while(--_0xee7cc8){_0xcdf96f['push'](_0xcdf96f['shift']());}};_0xb59f45(++_0xc63784);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xd6f9[_0x37b3e5];return _0x207f20;};'use strict';var _=require(_0x9d6f('0x0'));var util=require(_0x9d6f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d6f('0x2'));var fs=require('fs');var Redis=require(_0x9d6f('0x3'));var db=require(_0x9d6f('0x4'))['db'];var utils=require(_0x9d6f('0x5'));var logger=require('../../config/logger')(_0x9d6f('0x6'));var config=require(_0x9d6f('0x7'));var jayson=require(_0x9d6f('0x8'));var client=jayson['client'][_0x9d6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x511811,_0x555c60,_0x2011db){return new BPromise(function(_0x523a52,_0x193661){return client[_0x9d6f('0xa')](_0x511811,_0x2011db)[_0x9d6f('0xb')](function(_0x5f7600){logger[_0x9d6f('0xc')]('CloudProvider,\x20%s,\x20%s',_0x555c60,'request\x20sent');logger['debug'](_0x9d6f('0xd'),_0x555c60,_0x9d6f('0xe'),JSON[_0x9d6f('0xf')](_0x5f7600));if(_0x5f7600[_0x9d6f('0x10')]){if(_0x5f7600[_0x9d6f('0x10')]['code']===0x1f4){logger[_0x9d6f('0x10')](_0x9d6f('0x11'),_0x555c60,_0x5f7600[_0x9d6f('0x10')][_0x9d6f('0x12')]);return _0x193661(_0x5f7600[_0x9d6f('0x10')]['message']);}logger[_0x9d6f('0x10')](_0x9d6f('0x11'),_0x555c60,_0x5f7600[_0x9d6f('0x10')][_0x9d6f('0x12')]);return _0x523a52(_0x5f7600[_0x9d6f('0x10')]['message']);}else{logger[_0x9d6f('0xc')](_0x9d6f('0x11'),_0x555c60,_0x9d6f('0xe'));_0x523a52(_0x5f7600[_0x9d6f('0x13')]['message']);}})[_0x9d6f('0x14')](function(_0x11e6ca){logger[_0x9d6f('0x10')](_0x9d6f('0x11'),_0x555c60,_0x11e6ca);_0x193661(_0x11e6ca);});});} \ No newline at end of file +var _0x0c2b=['code','CloudProvider,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0c2b,0x194));var _0xb0c2=function(_0x4b6bad,_0x2d8cfb){_0x4b6bad=_0x4b6bad-0x0;var _0x30b494=_0x0c2b[_0x4b6bad];return _0x30b494;};'use strict';var _=require(_0xb0c2('0x0'));var util=require(_0xb0c2('0x1'));var moment=require('moment');var BPromise=require(_0xb0c2('0x2'));var rs=require(_0xb0c2('0x3'));var fs=require('fs');var Redis=require(_0xb0c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0c2('0x5'))(_0xb0c2('0x6'));var config=require(_0xb0c2('0x7'));var jayson=require(_0xb0c2('0x8'));var client=jayson[_0xb0c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18649a,_0x3fe284,_0x13d064){return new BPromise(function(_0x5052b8,_0x247201){return client[_0xb0c2('0xa')](_0x18649a,_0x13d064)[_0xb0c2('0xb')](function(_0x281dd2){logger['info']('CloudProvider,\x20%s,\x20%s',_0x3fe284,_0xb0c2('0xc'));logger[_0xb0c2('0xd')](_0xb0c2('0xe'),_0x3fe284,_0xb0c2('0xc'),JSON['stringify'](_0x281dd2));if(_0x281dd2[_0xb0c2('0xf')]){if(_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x10')]===0x1f4){logger[_0xb0c2('0xf')](_0xb0c2('0x11'),_0x3fe284,_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);return _0x247201(_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);}logger[_0xb0c2('0xf')](_0xb0c2('0x11'),_0x3fe284,_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);return _0x5052b8(_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);}else{logger['info'](_0xb0c2('0x11'),_0x3fe284,_0xb0c2('0xc'));_0x5052b8(_0x281dd2[_0xb0c2('0x13')]['message']);}})['catch'](function(_0x332d44){logger[_0xb0c2('0xf')](_0xb0c2('0x11'),_0x3fe284,_0x332d44);_0x247201(_0x332d44);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b8389aa..c4bf6b3 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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x3f8dfa,_0x4ca511){var _0x4fd797=function(_0x57eb4d){while(--_0x57eb4d){_0x3f8dfa['push'](_0x3f8dfa['shift']());}};_0x4fd797(++_0x4ca511);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x43979e,_0x1377b1){var _0x18b594=function(_0x131f80){while(--_0x131f80){_0x43979e['push'](_0x43979e['shift']());}};_0x18b594(++_0x1377b1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 38505a9..5515285 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 _0x1373=['STRING','name','sequelize','exports'];(function(_0x5a6983,_0x38627f){var _0x516234=function(_0x22fcdc){while(--_0x22fcdc){_0x5a6983['push'](_0x5a6983['shift']());}};_0x516234(++_0x38627f);}(_0x1373,0xa2));var _0x3137=function(_0x1cb2f0,_0x72db6e){_0x1cb2f0=_0x1cb2f0-0x0;var _0x2fba8b=_0x1373[_0x1cb2f0];return _0x2fba8b;};'use strict';var Sequelize=require(_0x3137('0x0'));module[_0x3137('0x1')]={'name':{'type':Sequelize[_0x3137('0x2')],'unique':_0x3137('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3137('0x2')]},'companyId':{'type':Sequelize[_0x3137('0x2')]},'website':{'type':Sequelize[_0x3137('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x3137('0x2')]},'type':{'type':Sequelize[_0x3137('0x2')]},'street':{'type':Sequelize[_0x3137('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3137('0x2')]},'country':{'type':Sequelize[_0x3137('0x2')]},'email':{'type':Sequelize[_0x3137('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3137('0x2')]},'sStreet':{'type':Sequelize[_0x3137('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3137('0x2')]}}; \ No newline at end of file +var _0x57fa=['exports','name','STRING'];(function(_0x53ee0b,_0x18950a){var _0x40074a=function(_0x571888){while(--_0x571888){_0x53ee0b['push'](_0x53ee0b['shift']());}};_0x40074a(++_0x18950a);}(_0x57fa,0x7e));var _0xa57f=function(_0x38bc5d,_0x8ba01a){_0x38bc5d=_0x38bc5d-0x0;var _0x1c729c=_0x57fa[_0x38bc5d];return _0x1c729c;};'use strict';var Sequelize=require('sequelize');module[_0xa57f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa57f('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa57f('0x2')]},'companyId':{'type':Sequelize[_0xa57f('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa57f('0x2')]},'type':{'type':Sequelize[_0xa57f('0x2')]},'street':{'type':Sequelize[_0xa57f('0x2')]},'postalCode':{'type':Sequelize[_0xa57f('0x2')]},'city':{'type':Sequelize[_0xa57f('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa57f('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xa57f('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xa57f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2b1ffd8..cb2d1e2 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 _0x011e=['undefined','limit','Content-Range','save','update','then','destroy','get','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','count','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','params','addContacts','CmContact','ids','omit','findOne','order','pick','map','options','getContacts','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset'];(function(_0x59684c,_0x4f23bd){var _0x6e9beb=function(_0x316cde){while(--_0x316cde){_0x59684c['push'](_0x59684c['shift']());}};_0x6e9beb(++_0x4f23bd);}(_0x011e,0x8f));var _0xe011=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x011e[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require(_0xe011('0x0'));var rimraf=require(_0xe011('0x1'));var zipdir=require(_0xe011('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe011('0x3'));var moment=require(_0xe011('0x4'));var BPromise=require(_0xe011('0x5'));var Mustache=require(_0xe011('0x6'));var util=require(_0xe011('0x7'));var path=require('path');var sox=require(_0xe011('0x8'));var csv=require('to-csv');var ejs=require(_0xe011('0x9'));var fs=require('fs');var fs_extra=require(_0xe011('0xa'));var _=require(_0xe011('0xb'));var squel=require(_0xe011('0xc'));var crypto=require(_0xe011('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe011('0xe'));var toCsv=require(_0xe011('0xf'));var querystring=require(_0xe011('0x10'));var Papa=require(_0xe011('0x11'));var Redis=require(_0xe011('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe011('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe011('0x14'));var logger=require(_0xe011('0x15'))(_0xe011('0x16'));var utils=require('../../config/utils');var config=require(_0xe011('0x17'));var licenseUtil=require(_0xe011('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46472e,_0x241e92){_0x241e92=_0x241e92||0xcc;return function(_0x1f8a6f){if(_0x1f8a6f){return _0x46472e[_0xe011('0x19')](_0x241e92);}return _0x46472e[_0xe011('0x1a')](_0x241e92)[_0xe011('0x1b')]();};}function respondWithResult(_0x18d8a4,_0x7b2475){_0x7b2475=_0x7b2475||0xc8;return function(_0x471f5e){if(_0x471f5e){return _0x18d8a4['status'](_0x7b2475)['json'](_0x471f5e);}};}function respondWithFilteredResult(_0x1834c3,_0x22eafb){return function(_0x16e700){if(_0x16e700){var _0x1e1a8b=typeof _0x22eafb[_0xe011('0x1c')]===_0xe011('0x1d')&&typeof _0x22eafb[_0xe011('0x1e')]===_0xe011('0x1d');var _0x34d31e=_0x16e700['count'];var _0x5a3f61=_0x1e1a8b?0x0:_0x22eafb[_0xe011('0x1c')];var _0x52a205=_0x1e1a8b?_0x16e700['count']:_0x22eafb[_0xe011('0x1c')]+_0x22eafb[_0xe011('0x1e')];var _0x2eee76;if(_0x52a205>=_0x34d31e){_0x52a205=_0x34d31e;_0x2eee76=0xc8;}else{_0x2eee76=0xce;}_0x1834c3[_0xe011('0x1a')](_0x2eee76);return _0x1834c3['set'](_0xe011('0x1f'),_0x5a3f61+'-'+_0x52a205+'/'+_0x34d31e)['json'](_0x16e700);}return null;};}function patchUpdates(_0x351cc7){return function(_0x3cbd95){try{jsonpatch['apply'](_0x3cbd95,_0x351cc7,!![]);}catch(_0x5206fa){return BPromise['reject'](_0x5206fa);}return _0x3cbd95[_0xe011('0x20')]();};}function saveUpdates(_0x166225,_0x19c2ae){return function(_0x10be34){if(_0x10be34){return _0x10be34[_0xe011('0x21')](_0x166225)[_0xe011('0x22')](function(_0x447301){return _0x447301;});}return null;};}function removeEntity(_0x403f50,_0x2924b3){return function(_0x4af8f){if(_0x4af8f){return _0x4af8f[_0xe011('0x23')]()[_0xe011('0x22')](function(){var _0xc93b96=_0x4af8f[_0xe011('0x24')]({'plain':!![]});var _0x346396=_0xe011('0x25');return db[_0xe011('0x26')][_0xe011('0x23')]({'where':{'type':_0x346396,'resourceId':_0xc93b96['id']}})[_0xe011('0x22')](function(){return _0x4af8f;});})[_0xe011('0x22')](function(){_0x403f50[_0xe011('0x1a')](0xcc)[_0xe011('0x1b')]();});}};}function handleEntityNotFound(_0x131d5e,_0x5727ca){return function(_0x533382){if(!_0x533382){_0x131d5e[_0xe011('0x19')](0x194);}return _0x533382;};}function handleError(_0x118bb0,_0x3c2034){_0x3c2034=_0x3c2034||0x1f4;return function(_0x6c0765){logger['error'](_0x6c0765[_0xe011('0x27')]);if(_0x6c0765[_0xe011('0x28')]){delete _0x6c0765[_0xe011('0x28')];}_0x118bb0[_0xe011('0x1a')](_0x3c2034)[_0xe011('0x29')](_0x6c0765);};}exports[_0xe011('0x2a')]=function(_0x41b20f,_0x553557){var _0x214662={},_0x17b731={},_0x2f13c2={'count':0x0,'rows':[]};return db[_0xe011('0x2b')][_0xe011('0x2c')]()[_0xe011('0x22')](function(_0x1f9c30){_0x17b731['model']=_[_0xe011('0x2d')](_0x1f9c30);_0x17b731[_0xe011('0x2e')]=_['keys'](_0x41b20f[_0xe011('0x2e')]);_0x17b731[_0xe011('0x2f')]=_['intersection'](_0x17b731[_0xe011('0x30')],_0x17b731['query']);_0x214662[_0xe011('0x31')]=_[_0xe011('0x32')](_0x17b731[_0xe011('0x30')],qs[_0xe011('0x33')](_0x41b20f['query'][_0xe011('0x33')]));_0x214662[_0xe011('0x31')]=_0x214662['attributes'][_0xe011('0x34')]?_0x214662[_0xe011('0x31')]:_0x17b731[_0xe011('0x30')];if(!_0x41b20f['query'][_0xe011('0x35')](_0xe011('0x36'))){_0x214662[_0xe011('0x1e')]=qs['limit'](_0x41b20f[_0xe011('0x2e')][_0xe011('0x1e')]);_0x214662[_0xe011('0x1c')]=qs[_0xe011('0x1c')](_0x41b20f['query'][_0xe011('0x1c')]);}_0x214662['order']=qs[_0xe011('0x37')](_0x41b20f[_0xe011('0x2e')][_0xe011('0x37')]);_0x214662[_0xe011('0x38')]=qs[_0xe011('0x2f')](_['pick'](_0x41b20f[_0xe011('0x2e')],_0x17b731[_0xe011('0x2f')]),_0x1f9c30);if(_0x41b20f[_0xe011('0x2e')][_0xe011('0x39')]){_0x214662[_0xe011('0x38')]=_[_0xe011('0x3a')](_0x214662[_0xe011('0x38')],{'$or':_['map'](_0x214662[_0xe011('0x31')],function(_0x5114a1){var _0x1700f3={};_0x1700f3[_0x5114a1]={'$like':'%'+_0x41b20f[_0xe011('0x2e')][_0xe011('0x39')]+'%'};return _0x1700f3;})});}_0x214662=_[_0xe011('0x3a')]({},_0x214662,_0x41b20f['options']);var _0x5f18a7={'where':_0x214662[_0xe011('0x38')]};return db[_0xe011('0x2b')]['count'](_0x5f18a7)['then'](function(_0x38e612){_0x2f13c2[_0xe011('0x3b')]=_0x38e612;if(_0x41b20f[_0xe011('0x2e')][_0xe011('0x3c')]){_0x214662[_0xe011('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xe011('0x3e')](_0x214662);})[_0xe011('0x22')](function(_0x4f4f38){_0x2f13c2[_0xe011('0x3f')]=_0x4f4f38;return _0x2f13c2;})['then'](respondWithFilteredResult(_0x553557,_0x214662))[_0xe011('0x40')](handleError(_0x553557,null));})[_0xe011('0x40')](handleError(_0x553557,null));};exports[_0xe011('0x41')]=function(_0x4ab92b,_0x37261e){var _0x5fc099={'raw':![],'where':{'id':_0x4ab92b['params']['id']}},_0xafdbb1={};_0xafdbb1['model']=_[_0xe011('0x2d')](db[_0xe011('0x2b')][_0xe011('0x42')]);_0xafdbb1[_0xe011('0x2e')]=_[_0xe011('0x2d')](_0x4ab92b[_0xe011('0x2e')]);_0xafdbb1['filters']=_[_0xe011('0x32')](_0xafdbb1[_0xe011('0x30')],_0xafdbb1['query']);_0x5fc099[_0xe011('0x31')]=_[_0xe011('0x32')](_0xafdbb1[_0xe011('0x30')],qs[_0xe011('0x33')](_0x4ab92b[_0xe011('0x2e')]['fields']));_0x5fc099[_0xe011('0x31')]=_0x5fc099[_0xe011('0x31')]['length']?_0x5fc099[_0xe011('0x31')]:_0xafdbb1[_0xe011('0x30')];if(_0x4ab92b[_0xe011('0x2e')][_0xe011('0x3c')]){_0x5fc099['include']=[{'all':!![]}];}_0x5fc099=_[_0xe011('0x3a')]({},_0x5fc099,_0x4ab92b['options']);return db[_0xe011('0x2b')][_0xe011('0x43')](_0x5fc099)['then'](handleEntityNotFound(_0x37261e,null))[_0xe011('0x22')](respondWithResult(_0x37261e,null))[_0xe011('0x40')](handleError(_0x37261e,null));};exports[_0xe011('0x44')]=function(_0x4b13ca,_0x2cb0cd){return db['CmCompany']['create'](_0x4b13ca[_0xe011('0x45')],{})[_0xe011('0x22')](function(_0x4b71a5){var _0x1341eb=_0x4b13ca[_0xe011('0x46')]['get']({'plain':!![]});if(!_0x1341eb)throw new Error(_0xe011('0x47'));if(_0x1341eb['role']===_0xe011('0x46')){var _0x52bb01=_0x4b71a5[_0xe011('0x24')]({'plain':!![]});var _0x42a6a8=_0xe011('0x25');return db[_0xe011('0x48')][_0xe011('0x43')]({'where':{'name':_0x42a6a8,'userProfileId':_0x1341eb['userProfileId']},'raw':!![]})['then'](function(_0x35147f){if(_0x35147f&&_0x35147f[_0xe011('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x52bb01[_0xe011('0x28')],'resourceId':_0x52bb01['id'],'type':_0x35147f[_0xe011('0x28')],'sectionId':_0x35147f['id']},{})['then'](function(){return _0x4b71a5;});}else{return _0x4b71a5;}})['catch'](function(_0x1b8a89){logger[_0xe011('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b8a89);throw _0x1b8a89;});}return _0x4b71a5;})['then'](respondWithResult(_0x2cb0cd,0xc9))[_0xe011('0x40')](handleError(_0x2cb0cd,null));};exports[_0xe011('0x21')]=function(_0x1cd6cc,_0xe645b8){if(_0x1cd6cc[_0xe011('0x45')]['id']){delete _0x1cd6cc[_0xe011('0x45')]['id'];}return db[_0xe011('0x2b')][_0xe011('0x43')]({'where':{'id':_0x1cd6cc[_0xe011('0x4b')]['id']}})[_0xe011('0x22')](handleEntityNotFound(_0xe645b8,null))['then'](saveUpdates(_0x1cd6cc[_0xe011('0x45')],null))[_0xe011('0x22')](respondWithResult(_0xe645b8,null))[_0xe011('0x40')](handleError(_0xe645b8,null));};exports['destroy']=function(_0x117804,_0x46414b){return db[_0xe011('0x2b')][_0xe011('0x43')]({'where':{'id':_0x117804[_0xe011('0x4b')]['id']}})[_0xe011('0x22')](handleEntityNotFound(_0x46414b,null))[_0xe011('0x22')](removeEntity(_0x46414b,null))[_0xe011('0x40')](handleError(_0x46414b,null));};exports['describe']=function(_0x2141be,_0x4a18be){return db[_0xe011('0x2b')][_0xe011('0x2c')]()[_0xe011('0x22')](respondWithResult(_0x4a18be,null))[_0xe011('0x40')](handleError(_0x4a18be,null));};exports[_0xe011('0x4c')]=function(_0x478036,_0x5351ae,_0x559a65){return db[_0xe011('0x4d')][_0xe011('0x43')]({'where':{'id':_0x478036['params']['id']}})[_0xe011('0x22')](handleEntityNotFound(_0x5351ae,null))[_0xe011('0x22')](function(_0x35d3c0){if(_0x35d3c0){return _0x35d3c0[_0xe011('0x4c')](_0x478036[_0xe011('0x45')][_0xe011('0x4e')],_[_0xe011('0x4f')](_0x478036['body'],['ids','id'])||{});}})[_0xe011('0x22')](respondWithResult(_0x5351ae,null))[_0xe011('0x40')](handleError(_0x5351ae,null));};exports['getContacts']=function(_0x3784ca,_0x1f46cb,_0x5e9a0b){var _0x7e0b47={};var _0x3d37b5={};var _0x1d050d;var _0x38deaa;return db['CmCompany'][_0xe011('0x50')]({'where':{'id':_0x3784ca[_0xe011('0x4b')]['id']}})[_0xe011('0x22')](handleEntityNotFound(_0x1f46cb,null))[_0xe011('0x22')](function(_0x2dc36a){if(_0x2dc36a){_0x1d050d=_0x2dc36a;_0x3d37b5[_0xe011('0x30')]=_['keys'](db['CmContact'][_0xe011('0x42')]);_0x3d37b5[_0xe011('0x2e')]=_[_0xe011('0x2d')](_0x3784ca[_0xe011('0x2e')]);_0x3d37b5[_0xe011('0x2f')]=_[_0xe011('0x32')](_0x3d37b5[_0xe011('0x30')],_0x3d37b5[_0xe011('0x2e')]);_0x7e0b47[_0xe011('0x31')]=_[_0xe011('0x32')](_0x3d37b5[_0xe011('0x30')],qs[_0xe011('0x33')](_0x3784ca['query'][_0xe011('0x33')]));_0x7e0b47[_0xe011('0x31')]=_0x7e0b47[_0xe011('0x31')][_0xe011('0x34')]?_0x7e0b47[_0xe011('0x31')]:_0x3d37b5[_0xe011('0x30')];_0x7e0b47[_0xe011('0x51')]=qs['sort'](_0x3784ca[_0xe011('0x2e')][_0xe011('0x37')]);_0x7e0b47[_0xe011('0x38')]=qs[_0xe011('0x2f')](_[_0xe011('0x52')](_0x3784ca[_0xe011('0x2e')],_0x3d37b5[_0xe011('0x2f')]));if(_0x3784ca[_0xe011('0x2e')]['filter']){_0x7e0b47[_0xe011('0x38')]=_['merge'](_0x7e0b47[_0xe011('0x38')],{'$or':_[_0xe011('0x53')](_0x7e0b47[_0xe011('0x31')],function(_0x307502){var _0x233c60={};_0x233c60[_0x307502]={'$like':'%'+_0x3784ca[_0xe011('0x2e')][_0xe011('0x39')]+'%'};return _0x233c60;})});}_0x7e0b47=_[_0xe011('0x3a')]({},_0x7e0b47,_0x3784ca[_0xe011('0x54')]);return _0x1d050d[_0xe011('0x55')](_0x7e0b47);}})['then'](function(_0x1e675f){if(_0x1e675f){_0x38deaa=_0x1e675f[_0xe011('0x34')];if(!_0x3784ca[_0xe011('0x2e')]['hasOwnProperty'](_0xe011('0x36'))){_0x7e0b47[_0xe011('0x1e')]=qs[_0xe011('0x1e')](_0x3784ca['query'][_0xe011('0x1e')]);_0x7e0b47['offset']=qs[_0xe011('0x1c')](_0x3784ca[_0xe011('0x2e')]['offset']);}return _0x1d050d[_0xe011('0x55')](_0x7e0b47);}})[_0xe011('0x22')](function(_0xd11191){if(_0xd11191){return _0xd11191?{'count':_0x38deaa,'rows':_0xd11191}:null;}})[_0xe011('0x22')](respondWithResult(_0x1f46cb,null))[_0xe011('0x40')](handleError(_0x1f46cb,null));}; \ No newline at end of file +var _0x367b=['moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','error','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','intersection','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','body','CmContact','addContacts','ids','getContacts','findOne','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x367b,0xad));var _0xb367=function(_0x2b0a4d,_0xbe72f3){_0x2b0a4d=_0x2b0a4d-0x0;var _0x2bd3b8=_0x367b[_0x2b0a4d];return _0x2bd3b8;};'use strict';var emlformat=require(_0xb367('0x0'));var rimraf=require(_0xb367('0x1'));var zipdir=require(_0xb367('0x2'));var jsonpatch=require(_0xb367('0x3'));var rp=require(_0xb367('0x4'));var moment=require(_0xb367('0x5'));var BPromise=require(_0xb367('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb367('0x7'));var csv=require(_0xb367('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb367('0x9'));var _=require(_0xb367('0xa'));var squel=require(_0xb367('0xb'));var crypto=require(_0xb367('0xc'));var jsforce=require(_0xb367('0xd'));var deskjs=require(_0xb367('0xe'));var toCsv=require(_0xb367('0x8'));var querystring=require('querystring');var Papa=require(_0xb367('0xf'));var Redis=require(_0xb367('0x10'));var authService=require(_0xb367('0x11'));var qs=require(_0xb367('0x12'));var as=require(_0xb367('0x13'));var hardwareService=require(_0xb367('0x14'));var logger=require(_0xb367('0x15'))(_0xb367('0x16'));var utils=require(_0xb367('0x17'));var config=require(_0xb367('0x18'));var licenseUtil=require(_0xb367('0x19'));var db=require(_0xb367('0x1a'))['db'];function respondWithStatusCode(_0x579e78,_0x42e559){_0x42e559=_0x42e559||0xcc;return function(_0x5ee3fd){if(_0x5ee3fd){return _0x579e78[_0xb367('0x1b')](_0x42e559);}return _0x579e78[_0xb367('0x1c')](_0x42e559)[_0xb367('0x1d')]();};}function respondWithResult(_0x36d5ad,_0x42a186){_0x42a186=_0x42a186||0xc8;return function(_0x2aeffe){if(_0x2aeffe){return _0x36d5ad[_0xb367('0x1c')](_0x42a186)[_0xb367('0x1e')](_0x2aeffe);}};}function respondWithFilteredResult(_0x5e418f,_0x45954d){return function(_0xadaef7){if(_0xadaef7){var _0x25b985=typeof _0x45954d[_0xb367('0x1f')]===_0xb367('0x20')&&typeof _0x45954d[_0xb367('0x21')]===_0xb367('0x20');var _0x1ba6c1=_0xadaef7[_0xb367('0x22')];var _0x27109a=_0x25b985?0x0:_0x45954d[_0xb367('0x1f')];var _0x334cee=_0x25b985?_0xadaef7[_0xb367('0x22')]:_0x45954d['offset']+_0x45954d[_0xb367('0x21')];var _0x162bac;if(_0x334cee>=_0x1ba6c1){_0x334cee=_0x1ba6c1;_0x162bac=0xc8;}else{_0x162bac=0xce;}_0x5e418f[_0xb367('0x1c')](_0x162bac);return _0x5e418f[_0xb367('0x23')](_0xb367('0x24'),_0x27109a+'-'+_0x334cee+'/'+_0x1ba6c1)[_0xb367('0x1e')](_0xadaef7);}return null;};}function patchUpdates(_0x9e34e){return function(_0xe68626){try{jsonpatch[_0xb367('0x25')](_0xe68626,_0x9e34e,!![]);}catch(_0x33c666){return BPromise[_0xb367('0x26')](_0x33c666);}return _0xe68626[_0xb367('0x27')]();};}function saveUpdates(_0x6eed21,_0x6a1563){return function(_0x2fb98b){if(_0x2fb98b){return _0x2fb98b[_0xb367('0x28')](_0x6eed21)[_0xb367('0x29')](function(_0x631109){return _0x631109;});}return null;};}function removeEntity(_0x5e0d23,_0x485e06){return function(_0x54bf6f){if(_0x54bf6f){return _0x54bf6f[_0xb367('0x2a')]()['then'](function(){var _0xd35e34=_0x54bf6f[_0xb367('0x2b')]({'plain':!![]});var _0x5c4780='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x5c4780,'resourceId':_0xd35e34['id']}})[_0xb367('0x29')](function(){return _0x54bf6f;});})[_0xb367('0x29')](function(){_0x5e0d23['status'](0xcc)[_0xb367('0x1d')]();});}};}function handleEntityNotFound(_0x5d32e5,_0x30bf7e){return function(_0x9e4643){if(!_0x9e4643){_0x5d32e5['sendStatus'](0x194);}return _0x9e4643;};}function handleError(_0x41736a,_0x380d7a){_0x380d7a=_0x380d7a||0x1f4;return function(_0x46584c){logger[_0xb367('0x2c')](_0x46584c['stack']);if(_0x46584c[_0xb367('0x2d')]){delete _0x46584c['name'];}_0x41736a['status'](_0x380d7a)[_0xb367('0x2e')](_0x46584c);};}exports[_0xb367('0x2f')]=function(_0x398b62,_0x4b2fd5){var _0x1f74e0={},_0x2267f2={},_0x3bf422={'count':0x0,'rows':[]};return db[_0xb367('0x30')][_0xb367('0x31')]()['then'](function(_0x524224){_0x2267f2[_0xb367('0x32')]=_[_0xb367('0x33')](_0x524224);_0x2267f2[_0xb367('0x34')]=_[_0xb367('0x33')](_0x398b62[_0xb367('0x34')]);_0x2267f2[_0xb367('0x35')]=_['intersection'](_0x2267f2[_0xb367('0x32')],_0x2267f2[_0xb367('0x34')]);_0x1f74e0[_0xb367('0x36')]=_['intersection'](_0x2267f2['model'],qs[_0xb367('0x37')](_0x398b62['query']['fields']));_0x1f74e0[_0xb367('0x36')]=_0x1f74e0[_0xb367('0x36')]['length']?_0x1f74e0[_0xb367('0x36')]:_0x2267f2[_0xb367('0x32')];if(!_0x398b62[_0xb367('0x34')][_0xb367('0x38')](_0xb367('0x39'))){_0x1f74e0[_0xb367('0x21')]=qs[_0xb367('0x21')](_0x398b62[_0xb367('0x34')][_0xb367('0x21')]);_0x1f74e0[_0xb367('0x1f')]=qs['offset'](_0x398b62[_0xb367('0x34')][_0xb367('0x1f')]);}_0x1f74e0[_0xb367('0x3a')]=qs['sort'](_0x398b62[_0xb367('0x34')][_0xb367('0x3b')]);_0x1f74e0[_0xb367('0x3c')]=qs[_0xb367('0x35')](_[_0xb367('0x3d')](_0x398b62[_0xb367('0x34')],_0x2267f2[_0xb367('0x35')]),_0x524224);if(_0x398b62[_0xb367('0x34')][_0xb367('0x3e')]){_0x1f74e0[_0xb367('0x3c')]=_[_0xb367('0x3f')](_0x1f74e0[_0xb367('0x3c')],{'$or':_[_0xb367('0x40')](_0x1f74e0['attributes'],function(_0x5d9f87){var _0x1961a5={};_0x1961a5[_0x5d9f87]={'$like':'%'+_0x398b62[_0xb367('0x34')][_0xb367('0x3e')]+'%'};return _0x1961a5;})});}_0x1f74e0=_[_0xb367('0x3f')]({},_0x1f74e0,_0x398b62[_0xb367('0x41')]);var _0x508526={'where':_0x1f74e0[_0xb367('0x3c')]};return db[_0xb367('0x30')]['count'](_0x508526)[_0xb367('0x29')](function(_0x30d5fc){_0x3bf422[_0xb367('0x22')]=_0x30d5fc;if(_0x398b62[_0xb367('0x34')][_0xb367('0x42')]){_0x1f74e0[_0xb367('0x43')]=[{'all':!![]}];}return db[_0xb367('0x30')]['findAll'](_0x1f74e0);})['then'](function(_0x2d8010){_0x3bf422[_0xb367('0x44')]=_0x2d8010;return _0x3bf422;})[_0xb367('0x29')](respondWithFilteredResult(_0x4b2fd5,_0x1f74e0))[_0xb367('0x45')](handleError(_0x4b2fd5,null));})[_0xb367('0x45')](handleError(_0x4b2fd5,null));};exports[_0xb367('0x46')]=function(_0x46f6c0,_0x5eaeca){var _0x20ddd2={'raw':![],'where':{'id':_0x46f6c0[_0xb367('0x47')]['id']}},_0x94519={};_0x94519['model']=_[_0xb367('0x33')](db[_0xb367('0x30')]['rawAttributes']);_0x94519['query']=_[_0xb367('0x33')](_0x46f6c0['query']);_0x94519['filters']=_[_0xb367('0x48')](_0x94519[_0xb367('0x32')],_0x94519[_0xb367('0x34')]);_0x20ddd2[_0xb367('0x36')]=_[_0xb367('0x48')](_0x94519[_0xb367('0x32')],qs[_0xb367('0x37')](_0x46f6c0['query'][_0xb367('0x37')]));_0x20ddd2[_0xb367('0x36')]=_0x20ddd2[_0xb367('0x36')][_0xb367('0x49')]?_0x20ddd2[_0xb367('0x36')]:_0x94519[_0xb367('0x32')];if(_0x46f6c0[_0xb367('0x34')][_0xb367('0x42')]){_0x20ddd2['include']=[{'all':!![]}];}_0x20ddd2=_['merge']({},_0x20ddd2,_0x46f6c0[_0xb367('0x41')]);return db[_0xb367('0x30')][_0xb367('0x4a')](_0x20ddd2)['then'](handleEntityNotFound(_0x5eaeca,null))['then'](respondWithResult(_0x5eaeca,null))[_0xb367('0x45')](handleError(_0x5eaeca,null));};exports[_0xb367('0x4b')]=function(_0x335e2a,_0x4e3551){return db[_0xb367('0x30')][_0xb367('0x4b')](_0x335e2a['body'],{})[_0xb367('0x29')](function(_0x47b934){var _0x4a67e6=_0x335e2a[_0xb367('0x4c')][_0xb367('0x2b')]({'plain':!![]});if(!_0x4a67e6)throw new Error(_0xb367('0x4d'));if(_0x4a67e6[_0xb367('0x4e')]===_0xb367('0x4c')){var _0x45af76=_0x47b934[_0xb367('0x2b')]({'plain':!![]});var _0x5b6245='Companies';return db['UserProfileSection']['find']({'where':{'name':_0x5b6245,'userProfileId':_0x4a67e6[_0xb367('0x4f')]},'raw':!![]})[_0xb367('0x29')](function(_0x3afcd5){if(_0x3afcd5&&_0x3afcd5[_0xb367('0x50')]===0x0){return db[_0xb367('0x51')]['create']({'name':_0x45af76[_0xb367('0x2d')],'resourceId':_0x45af76['id'],'type':_0x3afcd5[_0xb367('0x2d')],'sectionId':_0x3afcd5['id']},{})[_0xb367('0x29')](function(){return _0x47b934;});}else{return _0x47b934;}})[_0xb367('0x45')](function(_0x589942){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x589942);throw _0x589942;});}return _0x47b934;})['then'](respondWithResult(_0x4e3551,0xc9))[_0xb367('0x45')](handleError(_0x4e3551,null));};exports['update']=function(_0x121057,_0x11a904){if(_0x121057[_0xb367('0x52')]['id']){delete _0x121057[_0xb367('0x52')]['id'];}return db[_0xb367('0x30')]['find']({'where':{'id':_0x121057['params']['id']}})[_0xb367('0x29')](handleEntityNotFound(_0x11a904,null))[_0xb367('0x29')](saveUpdates(_0x121057[_0xb367('0x52')],null))[_0xb367('0x29')](respondWithResult(_0x11a904,null))[_0xb367('0x45')](handleError(_0x11a904,null));};exports[_0xb367('0x2a')]=function(_0x89cbef,_0x2df46c){return db[_0xb367('0x30')][_0xb367('0x4a')]({'where':{'id':_0x89cbef[_0xb367('0x47')]['id']}})[_0xb367('0x29')](handleEntityNotFound(_0x2df46c,null))['then'](removeEntity(_0x2df46c,null))['catch'](handleError(_0x2df46c,null));};exports[_0xb367('0x31')]=function(_0x3525cb,_0x3dfce2){return db[_0xb367('0x30')]['describe']()[_0xb367('0x29')](respondWithResult(_0x3dfce2,null))[_0xb367('0x45')](handleError(_0x3dfce2,null));};exports['addContacts']=function(_0x161d70,_0x3c0b2a,_0x1bb34c){return db[_0xb367('0x53')][_0xb367('0x4a')]({'where':{'id':_0x161d70['params']['id']}})[_0xb367('0x29')](handleEntityNotFound(_0x3c0b2a,null))['then'](function(_0x297236){if(_0x297236){return _0x297236[_0xb367('0x54')](_0x161d70[_0xb367('0x52')][_0xb367('0x55')],_['omit'](_0x161d70[_0xb367('0x52')],['ids','id'])||{});}})[_0xb367('0x29')](respondWithResult(_0x3c0b2a,null))[_0xb367('0x45')](handleError(_0x3c0b2a,null));};exports[_0xb367('0x56')]=function(_0x3083ce,_0x7e7c8c,_0x467df4){var _0x216a26={};var _0x31142f={};var _0x591100;var _0xe3817e;return db[_0xb367('0x30')][_0xb367('0x57')]({'where':{'id':_0x3083ce[_0xb367('0x47')]['id']}})[_0xb367('0x29')](handleEntityNotFound(_0x7e7c8c,null))[_0xb367('0x29')](function(_0x2550c1){if(_0x2550c1){_0x591100=_0x2550c1;_0x31142f['model']=_[_0xb367('0x33')](db[_0xb367('0x53')][_0xb367('0x58')]);_0x31142f[_0xb367('0x34')]=_['keys'](_0x3083ce['query']);_0x31142f[_0xb367('0x35')]=_[_0xb367('0x48')](_0x31142f[_0xb367('0x32')],_0x31142f['query']);_0x216a26[_0xb367('0x36')]=_[_0xb367('0x48')](_0x31142f['model'],qs[_0xb367('0x37')](_0x3083ce['query'][_0xb367('0x37')]));_0x216a26[_0xb367('0x36')]=_0x216a26[_0xb367('0x36')][_0xb367('0x49')]?_0x216a26[_0xb367('0x36')]:_0x31142f[_0xb367('0x32')];_0x216a26[_0xb367('0x3a')]=qs[_0xb367('0x3b')](_0x3083ce[_0xb367('0x34')][_0xb367('0x3b')]);_0x216a26['where']=qs['filters'](_['pick'](_0x3083ce[_0xb367('0x34')],_0x31142f[_0xb367('0x35')]));if(_0x3083ce[_0xb367('0x34')][_0xb367('0x3e')]){_0x216a26['where']=_[_0xb367('0x3f')](_0x216a26[_0xb367('0x3c')],{'$or':_[_0xb367('0x40')](_0x216a26[_0xb367('0x36')],function(_0x5e8230){var _0x254144={};_0x254144[_0x5e8230]={'$like':'%'+_0x3083ce[_0xb367('0x34')][_0xb367('0x3e')]+'%'};return _0x254144;})});}_0x216a26=_[_0xb367('0x3f')]({},_0x216a26,_0x3083ce[_0xb367('0x41')]);return _0x591100[_0xb367('0x56')](_0x216a26);}})[_0xb367('0x29')](function(_0x18f983){if(_0x18f983){_0xe3817e=_0x18f983['length'];if(!_0x3083ce[_0xb367('0x34')][_0xb367('0x38')](_0xb367('0x39'))){_0x216a26['limit']=qs['limit'](_0x3083ce[_0xb367('0x34')][_0xb367('0x21')]);_0x216a26['offset']=qs[_0xb367('0x1f')](_0x3083ce[_0xb367('0x34')][_0xb367('0x1f')]);}return _0x591100[_0xb367('0x56')](_0x216a26);}})[_0xb367('0x29')](function(_0x2710d4){if(_0x2710d4){return _0x2710d4?{'count':_0xe3817e,'rows':_0x2710d4}:null;}})[_0xb367('0x29')](respondWithResult(_0x7e7c8c,null))[_0xb367('0x45')](handleError(_0x7e7c8c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8e6a620..7e5ef52 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 _0x989a=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','CmCompany','cm_companies','lodash','util'];(function(_0x4e14f2,_0x3443fd){var _0x54d490=function(_0x559743){while(--_0x559743){_0x4e14f2['push'](_0x4e14f2['shift']());}};_0x54d490(++_0x3443fd);}(_0x989a,0x9a));var _0xa989=function(_0x5bb1ef,_0x554b89){_0x5bb1ef=_0x5bb1ef-0x0;var _0x2d03f7=_0x989a[_0x5bb1ef];return _0x2d03f7;};'use strict';var _=require(_0xa989('0x0'));var util=require(_0xa989('0x1'));var logger=require(_0xa989('0x2'))(_0xa989('0x3'));var moment=require(_0xa989('0x4'));var BPromise=require(_0xa989('0x5'));var rp=require(_0xa989('0x6'));var fs=require('fs');var path=require(_0xa989('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0xa989('0x8')]=function(_0x40962a,_0x4f4c95){return _0x40962a[_0xa989('0x9')](_0xa989('0xa'),attributes,{'tableName':_0xa989('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26d0=['define','CmCompany','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x3ed054,_0x4d4f16){var _0x16dd95=function(_0xc0c19c){while(--_0xc0c19c){_0x3ed054['push'](_0x3ed054['shift']());}};_0x16dd95(++_0x4d4f16);}(_0x26d0,0x1c4));var _0x026d=function(_0x4cdf55,_0x23f4d0){_0x4cdf55=_0x4cdf55-0x0;var _0x2e3101=_0x26d0[_0x4cdf55];return _0x2e3101;};'use strict';var _=require('lodash');var util=require(_0x026d('0x0'));var logger=require('../../config/logger')(_0x026d('0x1'));var moment=require(_0x026d('0x2'));var BPromise=require('bluebird');var rp=require(_0x026d('0x3'));var fs=require('fs');var path=require(_0x026d('0x4'));var rimraf=require('rimraf');var config=require(_0x026d('0x5'));var attributes=require('./cmCompany.attributes');module[_0x026d('0x6')]=function(_0x3ad979,_0xc5e5e1){return _0x3ad979[_0x026d('0x7')](_0x026d('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 efc3378..a4609a9 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 _0x66d4=['client','then','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1330ee,_0x2b16bf){var _0x33eea4=function(_0x5b4ad0){while(--_0x5b4ad0){_0x1330ee['push'](_0x1330ee['shift']());}};_0x33eea4(++_0x2b16bf);}(_0x66d4,0x90));var _0x466d=function(_0x4f11cb,_0x14e174){_0x4f11cb=_0x4f11cb-0x0;var _0x491488=_0x66d4[_0x4f11cb];return _0x491488;};'use strict';var _=require(_0x466d('0x0'));var util=require(_0x466d('0x1'));var moment=require(_0x466d('0x2'));var BPromise=require(_0x466d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x466d('0x4'));var db=require(_0x466d('0x5'))['db'];var utils=require(_0x466d('0x6'));var logger=require(_0x466d('0x7'))('rpc');var config=require(_0x466d('0x8'));var jayson=require(_0x466d('0x9'));var client=jayson[_0x466d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24360b,_0x3afd79,_0x5bad1d){return new BPromise(function(_0x3b76b0,_0x4140ed){return client['request'](_0x24360b,_0x5bad1d)[_0x466d('0xb')](function(_0x6c06dd){logger['info']('CmCompany,\x20%s,\x20%s',_0x3afd79,'request\x20sent');logger[_0x466d('0xc')](_0x466d('0xd'),_0x3afd79,_0x466d('0xe'),JSON[_0x466d('0xf')](_0x6c06dd));if(_0x6c06dd['error']){if(_0x6c06dd[_0x466d('0x10')][_0x466d('0x11')]===0x1f4){logger['error'](_0x466d('0x12'),_0x3afd79,_0x6c06dd[_0x466d('0x10')][_0x466d('0x13')]);return _0x4140ed(_0x6c06dd[_0x466d('0x10')][_0x466d('0x13')]);}logger['error'](_0x466d('0x12'),_0x3afd79,_0x6c06dd[_0x466d('0x10')][_0x466d('0x13')]);return _0x3b76b0(_0x6c06dd[_0x466d('0x10')]['message']);}else{logger[_0x466d('0x14')](_0x466d('0x12'),_0x3afd79,_0x466d('0xe'));_0x3b76b0(_0x6c06dd['result'][_0x466d('0x13')]);}})[_0x466d('0x15')](function(_0x50b03){logger[_0x466d('0x10')](_0x466d('0x12'),_0x3afd79,_0x50b03);_0x4140ed(_0x50b03);});});} \ No newline at end of file +var _0x84bd=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x214d57,_0x1bc9c5){var _0x59dfb1=function(_0x4652c1){while(--_0x4652c1){_0x214d57['push'](_0x214d57['shift']());}};_0x59dfb1(++_0x1bc9c5);}(_0x84bd,0x94));var _0xd84b=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x84bd[_0x2ba740];return _0x358bda;};'use strict';var _=require(_0xd84b('0x0'));var util=require(_0xd84b('0x1'));var moment=require(_0xd84b('0x2'));var BPromise=require('bluebird');var rs=require(_0xd84b('0x3'));var fs=require('fs');var Redis=require(_0xd84b('0x4'));var db=require(_0xd84b('0x5'))['db'];var utils=require(_0xd84b('0x6'));var logger=require(_0xd84b('0x7'))(_0xd84b('0x8'));var config=require(_0xd84b('0x9'));var jayson=require(_0xd84b('0xa'));var client=jayson[_0xd84b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x485a5c,_0x1e831b,_0x3ef017){return new BPromise(function(_0x85abf5,_0x5c2ed1){return client[_0xd84b('0xc')](_0x485a5c,_0x3ef017)[_0xd84b('0xd')](function(_0x5668e7){logger[_0xd84b('0xe')]('CmCompany,\x20%s,\x20%s',_0x1e831b,_0xd84b('0xf'));logger[_0xd84b('0x10')](_0xd84b('0x11'),_0x1e831b,_0xd84b('0xf'),JSON[_0xd84b('0x12')](_0x5668e7));if(_0x5668e7[_0xd84b('0x13')]){if(_0x5668e7[_0xd84b('0x13')][_0xd84b('0x14')]===0x1f4){logger[_0xd84b('0x13')](_0xd84b('0x15'),_0x1e831b,_0x5668e7['error'][_0xd84b('0x16')]);return _0x5c2ed1(_0x5668e7[_0xd84b('0x13')]['message']);}logger['error']('CmCompany,\x20%s,\x20%s',_0x1e831b,_0x5668e7[_0xd84b('0x13')][_0xd84b('0x16')]);return _0x85abf5(_0x5668e7[_0xd84b('0x13')]['message']);}else{logger[_0xd84b('0xe')](_0xd84b('0x15'),_0x1e831b,_0xd84b('0xf'));_0x85abf5(_0x5668e7[_0xd84b('0x17')][_0xd84b('0x16')]);}})[_0xd84b('0x18')](function(_0x70d9af){logger[_0xd84b('0x13')](_0xd84b('0x15'),_0x1e831b,_0x70d9af);_0x5c2ed1(_0x70d9af);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 49b57b9..04346be 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 _0x53ec=['describe','/:id','show','/:id/contacts','getContacts','create','addContacts','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','get','/describe'];(function(_0x55f435,_0x1e9ffa){var _0x456300=function(_0x560790){while(--_0x560790){_0x55f435['push'](_0x55f435['shift']());}};_0x456300(++_0x1e9ffa);}(_0x53ec,0x192));var _0xc53e=function(_0x5c6f37,_0x53bc84){_0x5c6f37=_0x5c6f37-0x0;var _0x4ae388=_0x53ec[_0x5c6f37];return _0x4ae388;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc53e('0x11')]);router['post']('/:id/contacts',auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0x13')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xc53e('0x14')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x15')]);module[_0xc53e('0x16')]=router; \ No newline at end of file +var _0xd562=['getContacts','post','create','addContacts','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','show','/:id/contacts'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0xd562,0x18f));var _0x2d56=function(_0x4a5bb1,_0x19cd7a){_0x4a5bb1=_0x4a5bb1-0x0;var _0x240fbc=_0xd562[_0x4a5bb1];return _0x240fbc;};'use strict';var multer=require(_0x2d56('0x0'));var util=require(_0x2d56('0x1'));var path=require(_0x2d56('0x2'));var timeout=require(_0x2d56('0x3'));var express=require('express');var router=express[_0x2d56('0x4')]();var fs_extra=require(_0x2d56('0x5'));var auth=require(_0x2d56('0x6'));var interaction=require(_0x2d56('0x7'));var config=require(_0x2d56('0x8'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2d56('0x9')](_0x2d56('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2d56('0x9')](_0x2d56('0xb'),auth[_0x2d56('0xc')](),controller[_0x2d56('0xd')]);router['get'](_0x2d56('0xe'),auth[_0x2d56('0xc')](),controller[_0x2d56('0xf')]);router[_0x2d56('0x10')]('/',auth[_0x2d56('0xc')](),controller[_0x2d56('0x11')]);router[_0x2d56('0x10')](_0x2d56('0xe'),auth[_0x2d56('0xc')](),controller[_0x2d56('0x12')]);router[_0x2d56('0x13')](_0x2d56('0xb'),auth[_0x2d56('0xc')](),controller['update']);router[_0x2d56('0x14')]('/:id',auth[_0x2d56('0xc')](),controller[_0x2d56('0x15')]);module[_0x2d56('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3835f3c..5692770 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 _0x1e64=['INTEGER','lodash','sequelize','exports','STRING','TEXT','UNSIGNED','DATE','NOW'];(function(_0x11bdd4,_0x2f0483){var _0x6fde61=function(_0x5239cf){while(--_0x5239cf){_0x11bdd4['push'](_0x11bdd4['shift']());}};_0x6fde61(++_0x2f0483);}(_0x1e64,0x184));var _0x41e6=function(_0x2518b1,_0x2d0062){_0x2518b1=_0x2518b1-0x0;var _0x336a4f=_0x1e64[_0x2518b1];return _0x336a4f;};'use strict';var _=require(_0x41e6('0x0'));var Sequelize=require(_0x41e6('0x1'));module[_0x41e6('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x41e6('0x3')]},'street':{'type':Sequelize[_0x41e6('0x3')]},'postalCode':{'type':Sequelize[_0x41e6('0x3')]},'city':{'type':Sequelize[_0x41e6('0x3')]},'country':{'type':Sequelize[_0x41e6('0x3')]},'dateOfBirth':{'type':Sequelize[_0x41e6('0x3')]},'description':{'type':Sequelize[_0x41e6('0x4')]},'phone':{'type':Sequelize[_0x41e6('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x41e6('0x3')]},'email':{'type':Sequelize[_0x41e6('0x3')]},'url':{'type':Sequelize[_0x41e6('0x3')]},'facebook':{'type':Sequelize[_0x41e6('0x3')]},'fb_data':{'type':Sequelize[_0x41e6('0x3')]},'twitter':{'type':Sequelize[_0x41e6('0x3')]},'skype':{'type':Sequelize[_0x41e6('0x3')]},'teams':{'type':Sequelize[_0x41e6('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x41e6('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x41e6('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x41e6('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x41e6('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x41e6('0x6')],'defaultValue':Sequelize[_0x41e6('0x7')]},'dialTimezone':{'type':Sequelize[_0x41e6('0x3')]},'utcOffset':{'type':Sequelize[_0x41e6('0x8')]}}; \ No newline at end of file +var _0xf59b=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x370592,_0x3ad7a2){var _0x26872d=function(_0x1d1c64){while(--_0x1d1c64){_0x370592['push'](_0x370592['shift']());}};_0x26872d(++_0x3ad7a2);}(_0xf59b,0x18d));var _0xbf59=function(_0x457759,_0x4fb33a){_0x457759=_0x457759-0x0;var _0xc50bc9=_0xf59b[_0x457759];return _0xc50bc9;};'use strict';var _=require(_0xbf59('0x0'));var Sequelize=require(_0xbf59('0x1'));module[_0xbf59('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xbf59('0x3')]},'street':{'type':Sequelize[_0xbf59('0x3')]},'postalCode':{'type':Sequelize[_0xbf59('0x3')]},'city':{'type':Sequelize[_0xbf59('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf59('0x4')]},'phone':{'type':Sequelize[_0xbf59('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbf59('0x3')]},'email':{'type':Sequelize[_0xbf59('0x3')]},'url':{'type':Sequelize[_0xbf59('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xbf59('0x3')]},'twitter':{'type':Sequelize[_0xbf59('0x3')]},'skype':{'type':Sequelize[_0xbf59('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xbf59('0x3')]},'line':{'type':Sequelize[_0xbf59('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xbf59('0x3')]},'UserId':{'type':Sequelize[_0xbf59('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xbf59('0x3')]},'priority':{'type':Sequelize[_0xbf59('0x5')](0x2)[_0xbf59('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xbf59('0x7')],'defaultValue':Sequelize[_0xbf59('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xbf59('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a5770b2..113d9de 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index b66d573..93c3249 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75bf=['hasOwnProperty','hook','exports','events','setMaxListeners','save','remove','emit'];(function(_0x3665b9,_0x3b5d4f){var _0x524099=function(_0x876977){while(--_0x876977){_0x3665b9['push'](_0x3665b9['shift']());}};_0x524099(++_0x3b5d4f);}(_0x75bf,0x153));var _0xf75b=function(_0x355677,_0x443963){_0x355677=_0x355677-0x0;var _0x3dc60e=_0x75bf[_0x355677];return _0x3dc60e;};'use strict';var EventEmitter=require(_0xf75b('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf75b('0x1')](0x0);var events={'afterCreate':_0xf75b('0x2'),'afterUpdate':'update','afterDestroy':_0xf75b('0x3')};function emitEvent(_0x38990b){return function(_0x1672c3,_0xed710,_0x2f0800){CmContactEvents[_0xf75b('0x4')](_0x38990b+':'+_0x1672c3['id'],_0x1672c3);CmContactEvents['emit'](_0x38990b,_0x1672c3);_0x2f0800(null);};}for(var e in events){if(events[_0xf75b('0x5')](e)){var event=events[e];CmContact[_0xf75b('0x6')](e,emitEvent(event));}}module[_0xf75b('0x7')]=CmContactEvents; \ No newline at end of file +var _0x3b4c=['events','../../mysqldb','CmContact','setMaxListeners','update','emit','hook','exports'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x3b4c,0xe0));var _0xc3b4=function(_0x3b9a03,_0x5cc72d){_0x3b9a03=_0x3b9a03-0x0;var _0x3437ce=_0x3b4c[_0x3b9a03];return _0x3437ce;};'use strict';var EventEmitter=require(_0xc3b4('0x0'));var CmContact=require(_0xc3b4('0x1'))['db'][_0xc3b4('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc3b4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc3b4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x135436){return function(_0x3b6c4b,_0x1b1779,_0x3b4f4c){CmContactEvents['emit'](_0x135436+':'+_0x3b6c4b['id'],_0x3b6c4b);CmContactEvents[_0xc3b4('0x5')](_0x135436,_0x3b6c4b);_0x3b4f4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xc3b4('0x6')](e,emitEvent(event));}}module[_0xc3b4('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 839d307..3931088 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x741b=['Campaign','timezones','minutes','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','BlackLists','CmHopperBlack','message','onlyIfOpen','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','exports','define','cm_contacts','phone','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','isNil','dialTimezone','utcOffset','then','CmHopper','findOne','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'];(function(_0x5f53ab,_0x324327){var _0x116166=function(_0x2e8e6a){while(--_0x2e8e6a){_0x5f53ab['push'](_0x5f53ab['shift']());}};_0x116166(++_0x324327);}(_0x741b,0x182));var _0xb741=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x741b[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xb741('0x0'));var util=require('util');var logger=require(_0xb741('0x1'))(_0xb741('0x2'));var moment=require(_0xb741('0x3'));var BPromise=require(_0xb741('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb741('0x5'));var rimraf=require(_0xb741('0x6'));var config=require(_0xb741('0x7'));var shared=require(_0xb741('0x8'));var attributes=require('./cmContact.attributes');module[_0xb741('0x9')]=function(_0x36d5d7,_0x5528cc){return _0x36d5d7[_0xb741('0xa')]('CmContact',attributes,{'tableName':_0xb741('0xb'),'paranoid':!![],'indexes':[{'name':_0xb741('0xc'),'fields':[_0xb741('0xc')]},{'name':'fti_cm_contacts','fields':[_0xb741('0xd'),'lastName','phone',_0xb741('0xe'),_0xb741('0xf'),_0xb741('0x10')],'type':_0xb741('0x11')}],'timestamps':!![],'charset':_0xb741('0x12'),'collate':_0xb741('0x13'),'hooks':{'afterCreate':function(_0x1537ba,_0x3644ec,_0x2ad808){var _0x31fb18=_0x36d5d7[_0xb741('0x14')];var _0x2446b6=_0x1537ba[_0xb741('0x15')]({'plain':!![]});function _0x421af5(){return function(_0x1dcce2){logger[_0xb741('0x16')](_0xb741('0x17'),_0xb741('0x18'),util[_0xb741('0x19')](_0x1dcce2,{'showHidden':![],'depth':null}));};}function _0x5b2d20(_0x2afc6a,_0x433ef1){var _0x11977a=_0x433ef1[_0xb741('0x1a')]?_0x433ef1[_0xb741('0x1a')]:moment()[_0xb741('0x1b')](_0xb741('0x1c'));return new BPromise(function(_0xb2fd36,_0x5443d3){if(_['isNil'](_0x433ef1['dialTimezone'])){_0xb2fd36({'ret':_0x11977a});}else{_0x31fb18[_0xb741('0x1d')]['findOne']({'where':{'id':_0x2afc6a['id']}})['then'](function(_0x15fb0f){if(!_[_0xb741('0x1e')](_0x15fb0f)){var _0x521aac=_0x15fb0f[_0xb741('0x1f')];if(!_[_0xb741('0x1e')](_0x521aac)){var _0x182ce0=shared['timezones'];var _0x3e0785=_0x182ce0[_0x521aac];var _0x41b525=_0x182ce0[_0x433ef1[_0xb741('0x1f')]];if(!_[_0xb741('0x1e')](_0x3e0785)&&!_[_0xb741('0x1e')](_0x41b525)){var _0x4e304f=_0x3e0785[_0xb741('0x20')]-_0x41b525[_0xb741('0x20')];_0x11977a=_0x433ef1[_0xb741('0x1a')]?_0x433ef1['scheduledat']:moment();var _0xf92c50=moment(_0x11977a)['add'](_0x4e304f,'minutes');_0xb2fd36({'ret':_0xf92c50[_0xb741('0x1b')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0xb2fd36({'ret':_0x11977a});}else _0xb2fd36({'ret':_0x11977a});}else{_0xb2fd36({'ret':_0x11977a});}});}});return 0xa;}var _0x5ba5ab=function(_0x5804e1){return new BPromise(function(_0x1dcefd,_0x44c979){_0x5b2d20(_0x5804e1,_0x2446b6)[_0xb741('0x21')](function(_0x3de85f){_0x2446b6[_0xb741('0x1a')]=_0x3de85f['ret'];_0x31fb18[_0xb741('0x22')][_0xb741('0x23')]({'where':{'phone':_0x2446b6[_0xb741('0xc')],'VoiceQueueId':_0x5804e1['id']}})[_0xb741('0x21')](function(_0x46c206){if(!_[_0xb741('0x1e')](_0x46c206)){throw new Error(_0xb741('0x24')+_0x2446b6[_0xb741('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5804e1['id']);}return _0x31fb18[_0xb741('0x22')][_0xb741('0x25')]({'phone':_0x2446b6[_0xb741('0xc')],'ContactId':_0x2446b6['id'],'ListId':_0x2446b6[_0xb741('0x26')],'priority':_0x2446b6[_0xb741('0x27')]?_0x2446b6['priority']:0x2,'scheduledat':_0x2446b6['scheduledat']?_0x2446b6[_0xb741('0x1a')]:moment()[_0xb741('0x1b')](_0xb741('0x1c')),'callback':_0x2446b6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2446b6[_0xb741('0x28')]?_0x2446b6[_0xb741('0x28')]:undefined,'callbackat':_0x2446b6[_0xb741('0x28')]?moment()[_0xb741('0x1b')](_0xb741('0x1c')):undefined,'VoiceQueueId':_0x5804e1['id']});})[_0xb741('0x29')](function(_0x5b130f){_0x44c979(_0x5b130f);});});});};var _0x4e85e3=function(_0x2865ae){return new BPromise(function(_0x216f28,_0x1bee8e){_0x5b2d20(_0x2865ae,_0x2446b6)['then'](function(_0x21bdcb){_0x2446b6[_0xb741('0x1a')]=_0x21bdcb[_0xb741('0x2a')];_0x31fb18[_0xb741('0x22')][_0xb741('0x23')]({'where':{'phone':_0x2446b6['phone'],'VoiceQueueId':_0x2865ae['id']}})[_0xb741('0x21')](function(_0x4447e7){if(!_[_0xb741('0x1e')](_0x4447e7)){throw new Error(_0xb741('0x24')+_0x2446b6['phone']+_0xb741('0x2b')+_0x2865ae['id']);}return _0x31fb18['CmHopperFinal'][_0xb741('0x23')]({'where':{'calleridnum':_0x2446b6[_0xb741('0xc')],'VoiceQueueId':_0x2865ae['id']}});})['then'](function(_0x163e7b){if(!_[_0xb741('0x1e')](_0x163e7b)){throw new Error(_0xb741('0x2c')+_0x2446b6[_0xb741('0xc')]+_0xb741('0x2d')+_0x2865ae['id']);}return _0x31fb18[_0xb741('0x22')][_0xb741('0x25')]({'phone':_0x2446b6[_0xb741('0xc')],'ContactId':_0x2446b6['id'],'ListId':_0x2446b6[_0xb741('0x26')],'priority':_0x2446b6['priority']?_0x2446b6[_0xb741('0x27')]:0x2,'scheduledat':_0x2446b6['scheduledat']?_0x2446b6[_0xb741('0x1a')]:moment()['format'](_0xb741('0x1c')),'callback':_0x2446b6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2446b6[_0xb741('0x28')]?_0x2446b6[_0xb741('0x28')]:undefined,'callbackat':_0x2446b6[_0xb741('0x28')]?moment()[_0xb741('0x1b')](_0xb741('0x1c')):undefined,'VoiceQueueId':_0x2865ae['id']});})[_0xb741('0x29')](function(_0x1c4ca6){_0x1bee8e(_0x1c4ca6);});});});};function _0x3efeee(){return function(_0x5393e3){logger[_0xb741('0x16')](_0xb741('0x17'),_0xb741('0x18'),util['inspect'](_0x5393e3,{'showHidden':![],'depth':null}));};}function _0x5cfc1b(_0x4d11af,_0x46c74f){var _0x286fb6=_0x46c74f[_0xb741('0x1a')]?_0x46c74f[_0xb741('0x1a')]:moment()[_0xb741('0x1b')](_0xb741('0x1c'));return new BPromise(function(_0x5eaa63,_0x5c5bd0){if(_[_0xb741('0x1e')](_0x46c74f[_0xb741('0x1f')])){_0x5eaa63({'ret':_0x286fb6});}else{_0x31fb18[_0xb741('0x2e')][_0xb741('0x23')]({'where':{'id':_0x4d11af['id']}})[_0xb741('0x21')](function(_0x4341fb){if(!_[_0xb741('0x1e')](_0x4341fb)){var _0x2f03da=_0x4341fb['dialTimezone'];if(!_[_0xb741('0x1e')](_0x2f03da)){var _0x4f3f6f=shared[_0xb741('0x2f')];var _0x106714=_0x4f3f6f[_0x2f03da];var _0x32d6df=_0x4f3f6f[_0x46c74f['dialTimezone']];if(!_[_0xb741('0x1e')](_0x106714)&&!_[_0xb741('0x1e')](_0x32d6df)){var _0x35d749=_0x106714['utcOffset']-_0x32d6df[_0xb741('0x20')];_0x286fb6=_0x46c74f[_0xb741('0x1a')]?_0x46c74f[_0xb741('0x1a')]:moment();var _0xb1793d=moment(_0x286fb6)['add'](_0x35d749,_0xb741('0x30'));_0x5eaa63({'ret':_0xb1793d[_0xb741('0x1b')](_0xb741('0x1c'))});}else _0x5eaa63({'ret':_0x286fb6});}else _0x5eaa63({'ret':_0x286fb6});}else{_0x5eaa63({'ret':_0x286fb6});}});}});return 0xa;}var _0x4f286f=function(_0xa545f4){return new BPromise(function(_0x2ce0aa,_0x87283d){_0x5cfc1b(_0xa545f4,_0x2446b6)[_0xb741('0x21')](function(_0x224fd3){_0x2446b6[_0xb741('0x1a')]=_0x224fd3['ret'];_0x31fb18[_0xb741('0x22')][_0xb741('0x23')]({'where':{'phone':_0x2446b6[_0xb741('0xc')],'CampaignId':_0xa545f4['id']}})[_0xb741('0x21')](function(_0x536ded){if(!_['isNil'](_0x536ded)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2446b6[_0xb741('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0xa545f4['id']);}return _0x31fb18[_0xb741('0x22')]['create']({'phone':_0x2446b6['phone'],'ContactId':_0x2446b6['id'],'ListId':_0x2446b6[_0xb741('0x26')],'priority':_0x2446b6[_0xb741('0x27')]?_0x2446b6[_0xb741('0x27')]:0x2,'scheduledat':_0x2446b6[_0xb741('0x1a')]?_0x2446b6[_0xb741('0x1a')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2446b6[_0xb741('0x28')]?!![]:![],'callbackuniqueid':_0x2446b6[_0xb741('0x28')]?_0x2446b6['callbackUniqueid']:undefined,'callbackat':_0x2446b6[_0xb741('0x28')]?moment()[_0xb741('0x1b')](_0xb741('0x1c')):undefined,'CampaignId':_0xa545f4['id']});})[_0xb741('0x29')](function(_0x9c52bf){_0x87283d(_0x9c52bf);});});});};var _0x49e4db=function(_0x614a87){return new BPromise(function(_0x5ef342,_0x496c24){_0x5cfc1b(_0x614a87,_0x2446b6)[_0xb741('0x21')](function(_0x5b3569){_0x2446b6[_0xb741('0x1a')]=_0x5b3569[_0xb741('0x2a')];_0x31fb18[_0xb741('0x22')][_0xb741('0x23')]({'where':{'phone':_0x2446b6[_0xb741('0xc')],'CampaignId':_0x614a87['id']}})[_0xb741('0x21')](function(_0x334b72){if(!_[_0xb741('0x1e')](_0x334b72)){throw new Error(_0xb741('0x24')+_0x2446b6['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x614a87['id']);}return _0x31fb18[_0xb741('0x31')]['findOne']({'where':{'calleridnum':_0x2446b6[_0xb741('0xc')],'CampaignId':_0x614a87['id']}});})[_0xb741('0x21')](function(_0x3e2cb1){if(!_[_0xb741('0x1e')](_0x3e2cb1)){throw new Error(_0xb741('0x2c')+_0x2446b6[_0xb741('0xc')]+_0xb741('0x32')+_0x614a87['id']);}return _0x31fb18['CmHopper'][_0xb741('0x25')]({'phone':_0x2446b6[_0xb741('0xc')],'ContactId':_0x2446b6['id'],'ListId':_0x2446b6[_0xb741('0x26')],'priority':_0x2446b6['priority']?_0x2446b6[_0xb741('0x27')]:0x2,'scheduledat':_0x2446b6['scheduledat']?_0x2446b6['scheduledat']:moment()[_0xb741('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2446b6[_0xb741('0x28')]?!![]:![],'callbackuniqueid':_0x2446b6[_0xb741('0x28')]?_0x2446b6['callbackUniqueid']:undefined,'callbackat':_0x2446b6[_0xb741('0x28')]?moment()[_0xb741('0x1b')](_0xb741('0x1c')):undefined,'CampaignId':_0x614a87['id']});})[_0xb741('0x29')](function(_0x57c456){_0x496c24(_0x57c456);});});});};if(_0x2446b6['ListId']){_0x31fb18[_0xb741('0x1d')][_0xb741('0x33')]({'where':{'type':_0xb741('0x34')},'attributes':['id',_0xb741('0x35'),_0xb741('0x1f')],'include':[{'model':_0x31fb18[_0xb741('0x36')],'as':_0xb741('0x37'),'where':{'id':_0x2446b6[_0xb741('0x26')]}}]})[_0xb741('0x21')](function(_0x284e13){if(_0x284e13){var _0x707e99=[];for(var _0x460748=0x0,_0x4c9705;_0x460748<_0x284e13[_0xb741('0x38')];_0x460748+=0x1){_0x4c9705=_0x284e13[_0x460748][_0xb741('0x15')]({'plain':!![]});switch(_0x4c9705['dialCheckDuplicateType']){case _0xb741('0x39'):_0x4e85e3(_0x4c9705)[_0xb741('0x29')](_0x421af5());break;case'onlyIfOpen':_0x5ba5ab(_0x4c9705)[_0xb741('0x29')](_0x421af5());break;default:_0x5cfc1b(_0x4c9705,_0x2446b6)[_0xb741('0x21')](function(_0x37111c){_0x2446b6[_0xb741('0x1a')]=_0x37111c[_0xb741('0x2a')];_0x31fb18[_0xb741('0x22')][_0xb741('0x25')]({'phone':_0x2446b6[_0xb741('0xc')],'ContactId':_0x2446b6['id'],'ListId':_0x2446b6[_0xb741('0x26')],'scheduledat':_0x2446b6['scheduledat']?_0x2446b6['scheduledat']:moment()[_0xb741('0x1b')](_0xb741('0x1c')),'priority':_0x2446b6[_0xb741('0x27')]?_0x2446b6[_0xb741('0x27')]:0x2,'callback':_0x2446b6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2446b6[_0xb741('0x28')]?_0x2446b6[_0xb741('0x28')]:undefined,'callbackat':_0x2446b6[_0xb741('0x28')]?moment()[_0xb741('0x1b')](_0xb741('0x1c')):undefined,'VoiceQueueId':_0x4c9705['id']})[_0xb741('0x29')](_0x421af5());});}}}})['then'](function(){return _0x31fb18['VoiceQueue']['findAll']({'where':{'type':_0xb741('0x34')},'attributes':['id'],'include':[{'model':_0x31fb18[_0xb741('0x36')],'as':_0xb741('0x3a'),'where':{'id':_0x2446b6[_0xb741('0x26')]}}]})['then'](function(_0x363e10){if(_0x363e10){var _0x5ca4b2=[];for(var _0x1118e0=0x0,_0x27f67c;_0x1118e0<_0x363e10[_0xb741('0x38')];_0x1118e0+=0x1){_0x27f67c=_0x363e10[_0x1118e0][_0xb741('0x15')]({'plain':!![]});_0x31fb18[_0xb741('0x3b')][_0xb741('0x25')]({'phone':_0x2446b6['phone'],'ContactId':_0x2446b6['id'],'ListId':_0x2446b6['ListId'],'VoiceQueueId':_0x27f67c['id']})[_0xb741('0x29')](function(_0x1136a6){logger[_0xb741('0x16')]('cmContact,\x20%s,\x20%s',_0xb741('0x18'),_0x1136a6[_0xb741('0x3c')]);});}}});})['then'](function(){return _0x31fb18[_0xb741('0x2e')][_0xb741('0x33')]({'attributes':['id',_0xb741('0x35'),_0xb741('0x1f')],'include':[{'model':_0x31fb18['CmList'],'as':_0xb741('0x37'),'where':{'id':_0x2446b6['ListId']}}]})[_0xb741('0x21')](function(_0x251181){if(_0x251181){var _0x4a5de9=[];for(var _0x1808af=0x0,_0xfdf4cb;_0x1808af<_0x251181[_0xb741('0x38')];_0x1808af+=0x1){_0xfdf4cb=_0x251181[_0x1808af]['get']({'plain':!![]});switch(_0xfdf4cb[_0xb741('0x35')]){case'always':_0x49e4db(_0xfdf4cb)[_0xb741('0x29')](_0x3efeee());break;case _0xb741('0x3d'):_0x4f286f(_0xfdf4cb)[_0xb741('0x29')](_0x3efeee());break;default:_0x31fb18[_0xb741('0x22')][_0xb741('0x25')]({'phone':_0x2446b6['phone'],'ContactId':_0x2446b6['id'],'ListId':_0x2446b6['ListId'],'scheduledat':_0x2446b6[_0xb741('0x1a')]?_0x2446b6[_0xb741('0x1a')]:moment()[_0xb741('0x1b')](_0xb741('0x1c')),'priority':_0x2446b6['priority']?_0x2446b6['priority']:0x2,'callback':_0x2446b6[_0xb741('0x28')]?!![]:![],'callbackuniqueid':_0x2446b6['callbackUniqueid']?_0x2446b6[_0xb741('0x28')]:undefined,'callbackat':_0x2446b6[_0xb741('0x28')]?moment()[_0xb741('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0xfdf4cb['id']})[_0xb741('0x29')](_0x3efeee());}}}});})['then'](function(){return _0x31fb18[_0xb741('0x2e')][_0xb741('0x33')]({'attributes':['id'],'include':[{'model':_0x31fb18['CmList'],'as':_0xb741('0x3a'),'where':{'id':_0x2446b6[_0xb741('0x26')]}}]})['then'](function(_0x321a07){if(_0x321a07){var _0x230235=[];for(var _0x4fe04c=0x0,_0x23c90a;_0x4fe04c<_0x321a07[_0xb741('0x38')];_0x4fe04c+=0x1){_0x23c90a=_0x321a07[_0x4fe04c]['get']({'plain':!![]});_0x31fb18[_0xb741('0x3b')][_0xb741('0x25')]({'phone':_0x2446b6[_0xb741('0xc')],'ContactId':_0x2446b6['id'],'ListId':_0x2446b6[_0xb741('0x26')],'CampaignId':_0x23c90a['id']})['catch'](function(_0x48525d){logger[_0xb741('0x16')](_0xb741('0x3e'),_0xb741('0x18'),_0x48525d[_0xb741('0x3c')]);});}}});})[_0xb741('0x21')](function(){_0x2ad808();})[_0xb741('0x29')](function(_0x5482bb){logger[_0xb741('0x16')](_0xb741('0x3e'),_0xb741('0x18'),_0x5482bb[_0xb741('0x3c')]);_0x2ad808(_0x5482bb);});}else{_0x2ad808(new Error(_0xb741('0x3f')));}},'afterDestroy':function(_0x5b5f56,_0x1c1769,_0x1c6212){var _0x81efce=_0x36d5d7['models'];var _0x386f8d=_0x5b5f56['get']({'plain':!![]});return _0x81efce[_0xb741('0x22')][_0xb741('0x33')]({'raw':!![],'where':{'ListId':_0x386f8d[_0xb741('0x26')],'ContactId':_0x386f8d['id']}})[_0xb741('0x21')](function(_0x5f5588){if(!_[_0xb741('0x40')](_0x5f5588)){var _0x186670=[];for(var _0x4d9678=0x0;_0x4d9678<_0x5f5588[_0xb741('0x38')];_0x4d9678+=0x1){var _0x5e77c4=_0x81efce['CmHopper'][_0xb741('0x41')]({'where':{'ListId':_0x5f5588[_0x4d9678][_0xb741('0x26')],'ContactId':_0x5f5588[_0x4d9678][_0xb741('0x42')],'VoiceQueueId':_0x5f5588[_0x4d9678][_0xb741('0x43')],'CampaignId':_0x5f5588[_0x4d9678]['CampaignId']}});_0x186670[_0xb741('0x44')](_0x5e77c4);}return BPromise['all'](_0x186670);}})['then'](function(_0x35e9b4){logger[_0xb741('0x45')](_0xb741('0x46'),util['inspect'](_0x35e9b4,{'showHidden':![],'depth':null}));_0x1c6212();})[_0xb741('0x29')](function(_0x4c5892){logger[_0xb741('0x16')](_0xb741('0x47'),util[_0xb741('0x19')](_0x4c5892,{'showHidden':![],'depth':null}));_0x1c6212(_0x4c5892);});}}});}; \ No newline at end of file +var _0x3611=['info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','request-promise','path','../../config/environment','../../config/environment/shared','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','models','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','cmContact','Campaign','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','onlyIfOpen','CmList','BlackLists','CmHopperBlack','message','always','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','push','all'];(function(_0x23c052,_0x529c10){var _0x4f9d57=function(_0x2dac0d){while(--_0x2dac0d){_0x23c052['push'](_0x23c052['shift']());}};_0x4f9d57(++_0x529c10);}(_0x3611,0x95));var _0x1361=function(_0xedf6dd,_0x5991e4){_0xedf6dd=_0xedf6dd-0x0;var _0x48d026=_0x3611[_0xedf6dd];return _0x48d026;};'use strict';var _=require('lodash');var util=require(_0x1361('0x0'));var logger=require(_0x1361('0x1'))(_0x1361('0x2'));var moment=require(_0x1361('0x3'));var BPromise=require('bluebird');var rp=require(_0x1361('0x4'));var fs=require('fs');var path=require(_0x1361('0x5'));var rimraf=require('rimraf');var config=require(_0x1361('0x6'));var shared=require(_0x1361('0x7'));var attributes=require('./cmContact.attributes');module[_0x1361('0x8')]=function(_0x54ff14,_0x37ba5a){return _0x54ff14[_0x1361('0x9')]('CmContact',attributes,{'tableName':_0x1361('0xa'),'paranoid':!![],'indexes':[{'name':_0x1361('0xb'),'fields':['phone']},{'name':_0x1361('0xc'),'fields':[_0x1361('0xd'),'lastName','phone',_0x1361('0xe'),_0x1361('0xf'),'email'],'type':_0x1361('0x10')}],'timestamps':!![],'charset':_0x1361('0x11'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x16d966,_0x228b3f,_0x2a9f18){var _0x51ee0e=_0x54ff14[_0x1361('0x12')];var _0x1f6f6c=_0x16d966[_0x1361('0x13')]({'plain':!![]});function _0x2232fe(){return function(_0x5ead2b){logger[_0x1361('0x14')]('cmContact',_0x1361('0x15'),util[_0x1361('0x16')](_0x5ead2b,{'showHidden':![],'depth':null}));};}function _0x246bca(_0xb102c6,_0x384b70){var _0x9bfc42=_0x384b70[_0x1361('0x17')]?_0x384b70[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19'));return new BPromise(function(_0x87f85e,_0x25a628){if(_[_0x1361('0x1a')](_0x384b70[_0x1361('0x1b')])){_0x87f85e({'ret':_0x9bfc42});}else{_0x51ee0e[_0x1361('0x1c')][_0x1361('0x1d')]({'where':{'id':_0xb102c6['id']}})[_0x1361('0x1e')](function(_0xf0ca69){if(!_[_0x1361('0x1a')](_0xf0ca69)){var _0x2ca8c2=_0xf0ca69[_0x1361('0x1b')];if(!_['isNil'](_0x2ca8c2)){var _0x106ce5=shared[_0x1361('0x1f')];var _0x2e191f=_0x106ce5[_0x2ca8c2];var _0x340003=_0x106ce5[_0x384b70[_0x1361('0x1b')]];if(!_['isNil'](_0x2e191f)&&!_[_0x1361('0x1a')](_0x340003)){var _0x1f0a3d=_0x2e191f['utcOffset']-_0x340003[_0x1361('0x20')];_0x9bfc42=_0x384b70['scheduledat']?_0x384b70[_0x1361('0x17')]:moment();var _0xfcd8f=moment(_0x9bfc42)[_0x1361('0x21')](_0x1f0a3d,'minutes');_0x87f85e({'ret':_0xfcd8f[_0x1361('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x87f85e({'ret':_0x9bfc42});}else _0x87f85e({'ret':_0x9bfc42});}else{_0x87f85e({'ret':_0x9bfc42});}});}});return 0xa;}var _0x43705b=function(_0x32dec1){return new BPromise(function(_0x5450cb,_0x291496){_0x246bca(_0x32dec1,_0x1f6f6c)['then'](function(_0x5da1a5){_0x1f6f6c[_0x1361('0x17')]=_0x5da1a5[_0x1361('0x22')];_0x51ee0e[_0x1361('0x23')]['findOne']({'where':{'phone':_0x1f6f6c[_0x1361('0xb')],'VoiceQueueId':_0x32dec1['id']}})[_0x1361('0x1e')](function(_0xd18153){if(!_[_0x1361('0x1a')](_0xd18153)){throw new Error(_0x1361('0x24')+_0x1f6f6c[_0x1361('0xb')]+_0x1361('0x25')+_0x32dec1['id']);}return _0x51ee0e[_0x1361('0x23')]['create']({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'priority':_0x1f6f6c['priority']?_0x1f6f6c[_0x1361('0x27')]:0x2,'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19')),'callback':_0x1f6f6c[_0x1361('0x28')]?!![]:![],'callbackuniqueid':_0x1f6f6c[_0x1361('0x28')]?_0x1f6f6c[_0x1361('0x28')]:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()[_0x1361('0x18')](_0x1361('0x19')):undefined,'VoiceQueueId':_0x32dec1['id']});})[_0x1361('0x29')](function(_0x1efdd0){_0x291496(_0x1efdd0);});});});};var _0x41236c=function(_0x58e308){return new BPromise(function(_0x1f194e,_0x41319e){_0x246bca(_0x58e308,_0x1f6f6c)['then'](function(_0x50d719){_0x1f6f6c[_0x1361('0x17')]=_0x50d719[_0x1361('0x22')];_0x51ee0e[_0x1361('0x23')][_0x1361('0x1d')]({'where':{'phone':_0x1f6f6c[_0x1361('0xb')],'VoiceQueueId':_0x58e308['id']}})[_0x1361('0x1e')](function(_0x107fb8){if(!_[_0x1361('0x1a')](_0x107fb8)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1f6f6c['phone']+_0x1361('0x2a')+_0x58e308['id']);}return _0x51ee0e[_0x1361('0x2b')]['findOne']({'where':{'calleridnum':_0x1f6f6c[_0x1361('0xb')],'VoiceQueueId':_0x58e308['id']}});})[_0x1361('0x1e')](function(_0x2cd8cb){if(!_[_0x1361('0x1a')](_0x2cd8cb)){throw new Error(_0x1361('0x2c')+_0x1f6f6c[_0x1361('0xb')]+_0x1361('0x2d')+_0x58e308['id']);}return _0x51ee0e[_0x1361('0x23')][_0x1361('0x2e')]({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'priority':_0x1f6f6c['priority']?_0x1f6f6c['priority']:0x2,'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()['format'](_0x1361('0x19')),'callback':_0x1f6f6c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1f6f6c['callbackUniqueid']?_0x1f6f6c[_0x1361('0x28')]:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()[_0x1361('0x18')](_0x1361('0x19')):undefined,'VoiceQueueId':_0x58e308['id']});})[_0x1361('0x29')](function(_0x5db825){_0x41319e(_0x5db825);});});});};function _0x3b3023(){return function(_0x3361ca){logger[_0x1361('0x14')](_0x1361('0x2f'),_0x1361('0x15'),util[_0x1361('0x16')](_0x3361ca,{'showHidden':![],'depth':null}));};}function _0x3372e1(_0x361503,_0x25c741){var _0x1168ff=_0x25c741[_0x1361('0x17')]?_0x25c741[_0x1361('0x17')]:moment()['format'](_0x1361('0x19'));return new BPromise(function(_0x31b194,_0x1a24dc){if(_[_0x1361('0x1a')](_0x25c741['dialTimezone'])){_0x31b194({'ret':_0x1168ff});}else{_0x51ee0e[_0x1361('0x30')][_0x1361('0x1d')]({'where':{'id':_0x361503['id']}})['then'](function(_0x379f2a){if(!_[_0x1361('0x1a')](_0x379f2a)){var _0xebdb11=_0x379f2a[_0x1361('0x1b')];if(!_['isNil'](_0xebdb11)){var _0x452006=shared['timezones'];var _0x4c6eae=_0x452006[_0xebdb11];var _0x495ba5=_0x452006[_0x25c741[_0x1361('0x1b')]];if(!_[_0x1361('0x1a')](_0x4c6eae)&&!_[_0x1361('0x1a')](_0x495ba5)){var _0x4dc01b=_0x4c6eae['utcOffset']-_0x495ba5[_0x1361('0x20')];_0x1168ff=_0x25c741[_0x1361('0x17')]?_0x25c741[_0x1361('0x17')]:moment();var _0x34160e=moment(_0x1168ff)[_0x1361('0x21')](_0x4dc01b,_0x1361('0x31'));_0x31b194({'ret':_0x34160e[_0x1361('0x18')](_0x1361('0x19'))});}else _0x31b194({'ret':_0x1168ff});}else _0x31b194({'ret':_0x1168ff});}else{_0x31b194({'ret':_0x1168ff});}});}});return 0xa;}var _0xf4e6bf=function(_0x26121d){return new BPromise(function(_0x29e18f,_0x4fdddb){_0x3372e1(_0x26121d,_0x1f6f6c)[_0x1361('0x1e')](function(_0x5cede6){_0x1f6f6c[_0x1361('0x17')]=_0x5cede6[_0x1361('0x22')];_0x51ee0e[_0x1361('0x23')][_0x1361('0x1d')]({'where':{'phone':_0x1f6f6c[_0x1361('0xb')],'CampaignId':_0x26121d['id']}})[_0x1361('0x1e')](function(_0xcf2638){if(!_['isNil'](_0xcf2638)){throw new Error(_0x1361('0x24')+_0x1f6f6c[_0x1361('0xb')]+_0x1361('0x32')+_0x26121d['id']);}return _0x51ee0e[_0x1361('0x23')]['create']({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'priority':_0x1f6f6c['priority']?_0x1f6f6c[_0x1361('0x27')]:0x2,'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1f6f6c[_0x1361('0x28')]?!![]:![],'callbackuniqueid':_0x1f6f6c['callbackUniqueid']?_0x1f6f6c[_0x1361('0x28')]:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()[_0x1361('0x18')](_0x1361('0x19')):undefined,'CampaignId':_0x26121d['id']});})[_0x1361('0x29')](function(_0x3d9ef5){_0x4fdddb(_0x3d9ef5);});});});};var _0x2a6eba=function(_0x1f7b5a){return new BPromise(function(_0x468d0c,_0x2eca60){_0x3372e1(_0x1f7b5a,_0x1f6f6c)[_0x1361('0x1e')](function(_0x332e38){_0x1f6f6c[_0x1361('0x17')]=_0x332e38['ret'];_0x51ee0e[_0x1361('0x23')][_0x1361('0x1d')]({'where':{'phone':_0x1f6f6c[_0x1361('0xb')],'CampaignId':_0x1f7b5a['id']}})[_0x1361('0x1e')](function(_0xc2f9dc){if(!_[_0x1361('0x1a')](_0xc2f9dc)){throw new Error(_0x1361('0x24')+_0x1f6f6c['phone']+_0x1361('0x33')+_0x1f7b5a['id']);}return _0x51ee0e['CmHopperFinal'][_0x1361('0x1d')]({'where':{'calleridnum':_0x1f6f6c[_0x1361('0xb')],'CampaignId':_0x1f7b5a['id']}});})[_0x1361('0x1e')](function(_0x5a4eee){if(!_[_0x1361('0x1a')](_0x5a4eee)){throw new Error(_0x1361('0x2c')+_0x1f6f6c[_0x1361('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x1f7b5a['id']);}return _0x51ee0e['CmHopper'][_0x1361('0x2e')]({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'priority':_0x1f6f6c[_0x1361('0x27')]?_0x1f6f6c['priority']:0x2,'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19')),'callback':_0x1f6f6c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1f6f6c[_0x1361('0x28')]?_0x1f6f6c['callbackUniqueid']:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1f7b5a['id']});})['catch'](function(_0x109f24){_0x2eca60(_0x109f24);});});});};if(_0x1f6f6c[_0x1361('0x26')]){_0x51ee0e[_0x1361('0x1c')][_0x1361('0x34')]({'where':{'type':_0x1361('0x35')},'attributes':['id',_0x1361('0x36'),_0x1361('0x1b')],'include':[{'model':_0x51ee0e['CmList'],'as':_0x1361('0x37'),'where':{'id':_0x1f6f6c[_0x1361('0x26')]}}]})[_0x1361('0x1e')](function(_0x2bd241){if(_0x2bd241){var _0x414713=[];for(var _0x2330b0=0x0,_0x339009;_0x2330b0<_0x2bd241[_0x1361('0x38')];_0x2330b0+=0x1){_0x339009=_0x2bd241[_0x2330b0]['get']({'plain':!![]});switch(_0x339009[_0x1361('0x36')]){case'always':_0x41236c(_0x339009)['catch'](_0x2232fe());break;case _0x1361('0x39'):_0x43705b(_0x339009)[_0x1361('0x29')](_0x2232fe());break;default:_0x3372e1(_0x339009,_0x1f6f6c)[_0x1361('0x1e')](function(_0xae21e5){_0x1f6f6c[_0x1361('0x17')]=_0xae21e5[_0x1361('0x22')];_0x51ee0e[_0x1361('0x23')][_0x1361('0x2e')]({'phone':_0x1f6f6c['phone'],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19')),'priority':_0x1f6f6c[_0x1361('0x27')]?_0x1f6f6c[_0x1361('0x27')]:0x2,'callback':_0x1f6f6c[_0x1361('0x28')]?!![]:![],'callbackuniqueid':_0x1f6f6c[_0x1361('0x28')]?_0x1f6f6c[_0x1361('0x28')]:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()['format'](_0x1361('0x19')):undefined,'VoiceQueueId':_0x339009['id']})['catch'](_0x2232fe());});}}}})[_0x1361('0x1e')](function(){return _0x51ee0e['VoiceQueue'][_0x1361('0x34')]({'where':{'type':_0x1361('0x35')},'attributes':['id'],'include':[{'model':_0x51ee0e[_0x1361('0x3a')],'as':_0x1361('0x3b'),'where':{'id':_0x1f6f6c[_0x1361('0x26')]}}]})[_0x1361('0x1e')](function(_0x3cdc2b){if(_0x3cdc2b){var _0x51d81b=[];for(var _0x4620fb=0x0,_0x211535;_0x4620fb<_0x3cdc2b[_0x1361('0x38')];_0x4620fb+=0x1){_0x211535=_0x3cdc2b[_0x4620fb][_0x1361('0x13')]({'plain':!![]});_0x51ee0e[_0x1361('0x3c')]['create']({'phone':_0x1f6f6c['phone'],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'VoiceQueueId':_0x211535['id']})['catch'](function(_0x53624c){logger['error']('cmContact,\x20%s,\x20%s',_0x1361('0x15'),_0x53624c[_0x1361('0x3d')]);});}}});})[_0x1361('0x1e')](function(){return _0x51ee0e[_0x1361('0x30')][_0x1361('0x34')]({'attributes':['id',_0x1361('0x36'),_0x1361('0x1b')],'include':[{'model':_0x51ee0e[_0x1361('0x3a')],'as':_0x1361('0x37'),'where':{'id':_0x1f6f6c[_0x1361('0x26')]}}]})[_0x1361('0x1e')](function(_0x1e4fd6){if(_0x1e4fd6){var _0x3cf6a8=[];for(var _0x1160d8=0x0,_0x29fc2f;_0x1160d8<_0x1e4fd6[_0x1361('0x38')];_0x1160d8+=0x1){_0x29fc2f=_0x1e4fd6[_0x1160d8]['get']({'plain':!![]});switch(_0x29fc2f[_0x1361('0x36')]){case _0x1361('0x3e'):_0x2a6eba(_0x29fc2f)[_0x1361('0x29')](_0x3b3023());break;case _0x1361('0x39'):_0xf4e6bf(_0x29fc2f)['catch'](_0x3b3023());break;default:_0x51ee0e['CmHopper'][_0x1361('0x2e')]({'phone':_0x1f6f6c['phone'],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c['ListId'],'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19')),'priority':_0x1f6f6c[_0x1361('0x27')]?_0x1f6f6c['priority']:0x2,'callback':_0x1f6f6c[_0x1361('0x28')]?!![]:![],'callbackuniqueid':_0x1f6f6c[_0x1361('0x28')]?_0x1f6f6c['callbackUniqueid']:undefined,'callbackat':_0x1f6f6c['callbackUniqueid']?moment()[_0x1361('0x18')](_0x1361('0x19')):undefined,'CampaignId':_0x29fc2f['id']})[_0x1361('0x29')](_0x3b3023());}}}});})['then'](function(){return _0x51ee0e[_0x1361('0x30')]['findAll']({'attributes':['id'],'include':[{'model':_0x51ee0e['CmList'],'as':'BlackLists','where':{'id':_0x1f6f6c[_0x1361('0x26')]}}]})['then'](function(_0x137d99){if(_0x137d99){var _0x5597a1=[];for(var _0x3cd374=0x0,_0x25551e;_0x3cd374<_0x137d99[_0x1361('0x38')];_0x3cd374+=0x1){_0x25551e=_0x137d99[_0x3cd374][_0x1361('0x13')]({'plain':!![]});_0x51ee0e['CmHopperBlack'][_0x1361('0x2e')]({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c['ListId'],'CampaignId':_0x25551e['id']})['catch'](function(_0x1e1905){logger[_0x1361('0x14')](_0x1361('0x3f'),'afterCreate',_0x1e1905['message']);});}}});})[_0x1361('0x1e')](function(){_0x2a9f18();})['catch'](function(_0x2aa984){logger['error'](_0x1361('0x3f'),'afterCreate',_0x2aa984[_0x1361('0x3d')]);_0x2a9f18(_0x2aa984);});}else{_0x2a9f18(new Error(_0x1361('0x40')));}},'afterDestroy':function(_0x30742e,_0x21996d,_0x16aa58){var _0x3e718d=_0x54ff14[_0x1361('0x12')];var _0x3c5cc3=_0x30742e[_0x1361('0x13')]({'plain':!![]});return _0x3e718d['CmHopper'][_0x1361('0x34')]({'raw':!![],'where':{'ListId':_0x3c5cc3[_0x1361('0x26')],'ContactId':_0x3c5cc3['id']}})[_0x1361('0x1e')](function(_0x204981){if(!_[_0x1361('0x41')](_0x204981)){var _0x1065c0=[];for(var _0x17ec38=0x0;_0x17ec38<_0x204981[_0x1361('0x38')];_0x17ec38+=0x1){var _0x339f6e=_0x3e718d[_0x1361('0x23')]['destroy']({'where':{'ListId':_0x204981[_0x17ec38]['ListId'],'ContactId':_0x204981[_0x17ec38][_0x1361('0x42')],'VoiceQueueId':_0x204981[_0x17ec38][_0x1361('0x43')],'CampaignId':_0x204981[_0x17ec38]['CampaignId']}});_0x1065c0[_0x1361('0x44')](_0x339f6e);}return BPromise[_0x1361('0x45')](_0x1065c0);}})[_0x1361('0x1e')](function(_0x269002){logger[_0x1361('0x46')](_0x1361('0x47'),util[_0x1361('0x16')](_0x269002,{'showHidden':![],'depth':null}));_0x16aa58();})[_0x1361('0x29')](function(_0x2ae36b){logger['error'](_0x1361('0x48'),util[_0x1361('0x16')](_0x2ae36b,{'showHidden':![],'depth':null}));_0x16aa58(_0x2ae36b);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 0f4de93..e8a58fa 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x527125,_0x3bd784){var _0x42a0c7=function(_0x12ad7c){while(--_0x12ad7c){_0x527125['push'](_0x527125['shift']());}};_0x42a0c7(++_0x3bd784);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index ae498e1..fd54764 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37f8=['STRING','PHONE','exports','INTEGER'];(function(_0x2b0e19,_0x413fc4){var _0x255fce=function(_0x30d9fc){while(--_0x30d9fc){_0x2b0e19['push'](_0x2b0e19['shift']());}};_0x255fce(++_0x413fc4);}(_0x37f8,0xd2));var _0x837f=function(_0x4cda25,_0x42ba34){_0x4cda25=_0x4cda25-0x0;var _0x3fba39=_0x37f8[_0x4cda25];return _0x3fba39;};'use strict';var Sequelize=require('sequelize');module[_0x837f('0x0')]={'CmContactId':{'type':Sequelize[_0x837f('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x837f('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x837f('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x837f('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xbe02=['exports','INTEGER','STRING','PHONE'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xbe02,0x124));var _0x2be0=function(_0x4c0ede,_0x190772){_0x4c0ede=_0x4c0ede-0x0;var _0x3b6132=_0xbe02[_0x4c0ede];return _0x3b6132;};'use strict';var Sequelize=require('sequelize');module[_0x2be0('0x0')]={'CmContactId':{'type':Sequelize[_0x2be0('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2be0('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x2be0('0x3')},'OrderBy':{'type':Sequelize[_0x2be0('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 8e30ba5..a9dbfbb 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6675=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','findAll','show','params','includeAll','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','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','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','CmContactHasItems','destroy','error','stack','name','send','index','map','CmContactHasItem','rawAttributes'];(function(_0x5e3991,_0x594bac){var _0x48df8b=function(_0x9e41a0){while(--_0x9e41a0){_0x5e3991['push'](_0x5e3991['shift']());}};_0x48df8b(++_0x594bac);}(_0x6675,0x1cc));var _0x5667=function(_0x5e7533,_0x3b6b12){_0x5e7533=_0x5e7533-0x0;var _0x1d6917=_0x6675[_0x5e7533];return _0x1d6917;};'use strict';var emlformat=require(_0x5667('0x0'));var rimraf=require(_0x5667('0x1'));var zipdir=require(_0x5667('0x2'));var jsonpatch=require(_0x5667('0x3'));var rp=require(_0x5667('0x4'));var moment=require(_0x5667('0x5'));var BPromise=require(_0x5667('0x6'));var Mustache=require(_0x5667('0x7'));var util=require(_0x5667('0x8'));var path=require('path');var sox=require(_0x5667('0x9'));var csv=require(_0x5667('0xa'));var ejs=require(_0x5667('0xb'));var fs=require('fs');var fs_extra=require(_0x5667('0xc'));var _=require(_0x5667('0xd'));var squel=require(_0x5667('0xe'));var crypto=require(_0x5667('0xf'));var jsforce=require(_0x5667('0x10'));var deskjs=require(_0x5667('0x11'));var toCsv=require(_0x5667('0xa'));var querystring=require(_0x5667('0x12'));var Papa=require('papaparse');var Redis=require(_0x5667('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5667('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5667('0x15'));var logger=require(_0x5667('0x16'))('api');var utils=require(_0x5667('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5667('0x18'));var db=require(_0x5667('0x19'))['db'];function respondWithStatusCode(_0x3915ae,_0x2c51e2){_0x2c51e2=_0x2c51e2||0xcc;return function(_0x13797e){if(_0x13797e){return _0x3915ae[_0x5667('0x1a')](_0x2c51e2);}return _0x3915ae['status'](_0x2c51e2)['end']();};}function respondWithResult(_0x54783d,_0x32998b){_0x32998b=_0x32998b||0xc8;return function(_0x253189){if(_0x253189){return _0x54783d[_0x5667('0x1b')](_0x32998b)[_0x5667('0x1c')](_0x253189);}};}function respondWithFilteredResult(_0x1026bc,_0x300531){return function(_0x589335){if(_0x589335){var _0x45b448=typeof _0x300531[_0x5667('0x1d')]==='undefined'&&typeof _0x300531[_0x5667('0x1e')]===_0x5667('0x1f');var _0x10f80c=_0x589335[_0x5667('0x20')];var _0x1d592b=_0x45b448?0x0:_0x300531[_0x5667('0x1d')];var _0x4538f4=_0x45b448?_0x589335['count']:_0x300531['offset']+_0x300531[_0x5667('0x1e')];var _0x768fbe;if(_0x4538f4>=_0x10f80c){_0x4538f4=_0x10f80c;_0x768fbe=0xc8;}else{_0x768fbe=0xce;}_0x1026bc[_0x5667('0x1b')](_0x768fbe);return _0x1026bc[_0x5667('0x21')](_0x5667('0x22'),_0x1d592b+'-'+_0x4538f4+'/'+_0x10f80c)[_0x5667('0x1c')](_0x589335);}return null;};}function patchUpdates(_0x22f5b1){return function(_0x3de606){try{jsonpatch[_0x5667('0x23')](_0x3de606,_0x22f5b1,!![]);}catch(_0x97bab9){return BPromise[_0x5667('0x24')](_0x97bab9);}return _0x3de606[_0x5667('0x25')]();};}function saveUpdates(_0x3d794d,_0x1b4de3){return function(_0x2597f3){if(_0x2597f3){return _0x2597f3[_0x5667('0x26')](_0x3d794d)[_0x5667('0x27')](function(_0x5879bb){return _0x5879bb;});}return null;};}function removeEntity(_0x5792f9,_0x4e85d2){return function(_0x1fb1a9){if(_0x1fb1a9){return _0x1fb1a9['destroy']()[_0x5667('0x27')](function(){var _0x5501a2=_0x1fb1a9['get']({'plain':!![]});var _0x437862=_0x5667('0x28');return db['UserProfileResource'][_0x5667('0x29')]({'where':{'type':_0x437862,'resourceId':_0x5501a2['id']}})['then'](function(){return _0x1fb1a9;});})[_0x5667('0x27')](function(){_0x5792f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459403,_0x7f010b){return function(_0x2d6e9f){if(!_0x2d6e9f){_0x459403['sendStatus'](0x194);}return _0x2d6e9f;};}function handleError(_0xaef55e,_0x29b5c2){_0x29b5c2=_0x29b5c2||0x1f4;return function(_0x52c00d){logger[_0x5667('0x2a')](_0x52c00d[_0x5667('0x2b')]);if(_0x52c00d['name']){delete _0x52c00d[_0x5667('0x2c')];}_0xaef55e['status'](_0x29b5c2)[_0x5667('0x2d')](_0x52c00d);};}exports[_0x5667('0x2e')]=function(_0x312a07,_0x16d359){var _0x2a69e4={},_0x231d28={},_0x3ce907={'count':0x0,'rows':[]};var _0x3be6ae=_[_0x5667('0x2f')](db[_0x5667('0x30')][_0x5667('0x31')],function(_0x25b68e){return{'name':_0x25b68e[_0x5667('0x32')],'type':_0x25b68e['type'][_0x5667('0x33')]};});_0x231d28[_0x5667('0x34')]=_[_0x5667('0x2f')](_0x3be6ae,_0x5667('0x2c'));_0x231d28[_0x5667('0x35')]=_[_0x5667('0x36')](_0x312a07[_0x5667('0x35')]);_0x231d28[_0x5667('0x37')]=_[_0x5667('0x38')](_0x231d28[_0x5667('0x34')],_0x231d28['query']);_0x2a69e4[_0x5667('0x39')]=_['intersection'](_0x231d28[_0x5667('0x34')],qs[_0x5667('0x3a')](_0x312a07['query'][_0x5667('0x3a')]));_0x2a69e4[_0x5667('0x39')]=_0x2a69e4[_0x5667('0x39')][_0x5667('0x3b')]?_0x2a69e4[_0x5667('0x39')]:_0x231d28[_0x5667('0x34')];if(!_0x312a07['query']['hasOwnProperty'](_0x5667('0x3c'))){_0x2a69e4[_0x5667('0x1e')]=qs['limit'](_0x312a07[_0x5667('0x35')][_0x5667('0x1e')]);_0x2a69e4['offset']=qs[_0x5667('0x1d')](_0x312a07[_0x5667('0x35')][_0x5667('0x1d')]);}_0x2a69e4[_0x5667('0x3d')]=qs[_0x5667('0x3e')](_0x312a07['query'][_0x5667('0x3e')]);_0x2a69e4[_0x5667('0x3f')]=qs['filters'](_[_0x5667('0x40')](_0x312a07[_0x5667('0x35')],_0x231d28[_0x5667('0x37')]),_0x3be6ae);if(_0x312a07[_0x5667('0x35')][_0x5667('0x41')]){_0x2a69e4[_0x5667('0x3f')]=_[_0x5667('0x42')](_0x2a69e4['where'],{'$or':_[_0x5667('0x2f')](_0x3be6ae,function(_0x1d2faa){if(_0x1d2faa[_0x5667('0x43')]!=='VIRTUAL'){var _0x359349={};_0x359349[_0x1d2faa[_0x5667('0x2c')]]={'$like':'%'+_0x312a07[_0x5667('0x35')][_0x5667('0x41')]+'%'};return _0x359349;}})});}_0x2a69e4=_[_0x5667('0x42')]({},_0x2a69e4,_0x312a07[_0x5667('0x44')]);var _0x201c7e={'where':_0x2a69e4[_0x5667('0x3f')]};return db[_0x5667('0x30')]['count'](_0x201c7e)['then'](function(_0x2d4dc2){_0x3ce907[_0x5667('0x20')]=_0x2d4dc2;if(_0x312a07['query']['includeAll']){_0x2a69e4['include']=[{'all':!![]}];}return db[_0x5667('0x30')][_0x5667('0x45')](_0x2a69e4);})['then'](function(_0x1ba066){_0x3ce907['rows']=_0x1ba066;return _0x3ce907;})[_0x5667('0x27')](respondWithFilteredResult(_0x16d359,_0x2a69e4))['catch'](handleError(_0x16d359,null));};exports[_0x5667('0x46')]=function(_0x165ccc,_0x57536d){var _0x329d99={'raw':!![],'where':{'id':_0x165ccc[_0x5667('0x47')]['id']}},_0x5291bc={};_0x5291bc[_0x5667('0x34')]=_['keys'](db[_0x5667('0x30')][_0x5667('0x31')]);_0x5291bc[_0x5667('0x35')]=_[_0x5667('0x36')](_0x165ccc[_0x5667('0x35')]);_0x5291bc['filters']=_['intersection'](_0x5291bc['model'],_0x5291bc[_0x5667('0x35')]);_0x329d99[_0x5667('0x39')]=_[_0x5667('0x38')](_0x5291bc['model'],qs[_0x5667('0x3a')](_0x165ccc[_0x5667('0x35')][_0x5667('0x3a')]));_0x329d99[_0x5667('0x39')]=_0x329d99['attributes']['length']?_0x329d99['attributes']:_0x5291bc[_0x5667('0x34')];if(_0x165ccc['query'][_0x5667('0x48')]){_0x329d99[_0x5667('0x49')]=[{'all':!![]}];}_0x329d99=_[_0x5667('0x42')]({},_0x329d99,_0x165ccc[_0x5667('0x44')]);return db[_0x5667('0x30')][_0x5667('0x4a')](_0x329d99)[_0x5667('0x27')](handleEntityNotFound(_0x57536d,null))[_0x5667('0x27')](respondWithResult(_0x57536d,null))[_0x5667('0x4b')](handleError(_0x57536d,null));};exports[_0x5667('0x4c')]=function(_0x12fe7c,_0x55653d){return db[_0x5667('0x30')][_0x5667('0x4c')](_0x12fe7c[_0x5667('0x4d')],{})[_0x5667('0x27')](function(_0x5c4aaa){var _0x20378b=_0x12fe7c[_0x5667('0x4e')][_0x5667('0x4f')]({'plain':!![]});if(!_0x20378b)throw new Error(_0x5667('0x50'));if(_0x20378b['role']==='user'){var _0x5d9ea1=_0x5c4aaa[_0x5667('0x4f')]({'plain':!![]});var _0x54c07d=_0x5667('0x28');return db[_0x5667('0x51')][_0x5667('0x4a')]({'where':{'name':_0x54c07d,'userProfileId':_0x20378b['userProfileId']},'raw':!![]})['then'](function(_0x4e306c){if(_0x4e306c&&_0x4e306c[_0x5667('0x52')]===0x0){return db[_0x5667('0x53')][_0x5667('0x4c')]({'name':_0x5d9ea1[_0x5667('0x2c')],'resourceId':_0x5d9ea1['id'],'type':_0x4e306c['name'],'sectionId':_0x4e306c['id']},{})[_0x5667('0x27')](function(){return _0x5c4aaa;});}else{return _0x5c4aaa;}})['catch'](function(_0x3ddbf6){logger['error'](_0x5667('0x54'),_0x3ddbf6);throw _0x3ddbf6;});}return _0x5c4aaa;})[_0x5667('0x27')](respondWithResult(_0x55653d,0xc9))[_0x5667('0x4b')](handleError(_0x55653d,null));};exports['update']=function(_0x14dbe9,_0x1edaff){if(_0x14dbe9[_0x5667('0x4d')]['id']){delete _0x14dbe9[_0x5667('0x4d')]['id'];}return db[_0x5667('0x30')][_0x5667('0x4a')]({'where':{'id':_0x14dbe9['params']['id']}})[_0x5667('0x27')](handleEntityNotFound(_0x1edaff,null))['then'](saveUpdates(_0x14dbe9[_0x5667('0x4d')],null))[_0x5667('0x27')](respondWithResult(_0x1edaff,null))['catch'](handleError(_0x1edaff,null));};exports[_0x5667('0x29')]=function(_0xa77c82,_0x888a77){return db[_0x5667('0x30')][_0x5667('0x4a')]({'where':{'id':_0xa77c82[_0x5667('0x47')]['id']}})[_0x5667('0x27')](handleEntityNotFound(_0x888a77,null))[_0x5667('0x27')](removeEntity(_0x888a77,null))['catch'](handleError(_0x888a77,null));}; \ No newline at end of file +var _0xf1c3=['where','VIRTUAL','merge','includeAll','include','findAll','show','params','options','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','CmContactHasItems','UserProfileResource','error','name','map','CmContactHasItem','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','sort','pick','filter'];(function(_0x2f8431,_0x10a4b4){var _0x2640c7=function(_0x3ecf4b){while(--_0x3ecf4b){_0x2f8431['push'](_0x2f8431['shift']());}};_0x2640c7(++_0x10a4b4);}(_0xf1c3,0xbb));var _0x3f1c=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0xf1c3[_0x5ff517];return _0x19a245;};'use strict';var emlformat=require(_0x3f1c('0x0'));var rimraf=require(_0x3f1c('0x1'));var zipdir=require(_0x3f1c('0x2'));var jsonpatch=require(_0x3f1c('0x3'));var rp=require(_0x3f1c('0x4'));var moment=require(_0x3f1c('0x5'));var BPromise=require(_0x3f1c('0x6'));var Mustache=require(_0x3f1c('0x7'));var util=require(_0x3f1c('0x8'));var path=require(_0x3f1c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f1c('0xb'));var squel=require(_0x3f1c('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f1c('0xd'));var deskjs=require(_0x3f1c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3f1c('0xf'));var Papa=require('papaparse');var Redis=require(_0x3f1c('0x10'));var authService=require(_0x3f1c('0x11'));var qs=require(_0x3f1c('0x12'));var as=require(_0x3f1c('0x13'));var hardwareService=require(_0x3f1c('0x14'));var logger=require(_0x3f1c('0x15'))(_0x3f1c('0x16'));var utils=require(_0x3f1c('0x17'));var config=require(_0x3f1c('0x18'));var licenseUtil=require(_0x3f1c('0x19'));var db=require(_0x3f1c('0x1a'))['db'];function respondWithStatusCode(_0x8fe82c,_0x7f36cd){_0x7f36cd=_0x7f36cd||0xcc;return function(_0x26692b){if(_0x26692b){return _0x8fe82c[_0x3f1c('0x1b')](_0x7f36cd);}return _0x8fe82c['status'](_0x7f36cd)[_0x3f1c('0x1c')]();};}function respondWithResult(_0x1b8959,_0x5bca51){_0x5bca51=_0x5bca51||0xc8;return function(_0x551f53){if(_0x551f53){return _0x1b8959[_0x3f1c('0x1d')](_0x5bca51)[_0x3f1c('0x1e')](_0x551f53);}};}function respondWithFilteredResult(_0x1fe3df,_0x31832e){return function(_0x4658fc){if(_0x4658fc){var _0x76f5a8=typeof _0x31832e['offset']===_0x3f1c('0x1f')&&typeof _0x31832e[_0x3f1c('0x20')]===_0x3f1c('0x1f');var _0xfd7f73=_0x4658fc[_0x3f1c('0x21')];var _0xb2347b=_0x76f5a8?0x0:_0x31832e[_0x3f1c('0x22')];var _0x50c82a=_0x76f5a8?_0x4658fc['count']:_0x31832e[_0x3f1c('0x22')]+_0x31832e['limit'];var _0x2b2efe;if(_0x50c82a>=_0xfd7f73){_0x50c82a=_0xfd7f73;_0x2b2efe=0xc8;}else{_0x2b2efe=0xce;}_0x1fe3df[_0x3f1c('0x1d')](_0x2b2efe);return _0x1fe3df[_0x3f1c('0x23')](_0x3f1c('0x24'),_0xb2347b+'-'+_0x50c82a+'/'+_0xfd7f73)[_0x3f1c('0x1e')](_0x4658fc);}return null;};}function patchUpdates(_0x5df655){return function(_0x29f437){try{jsonpatch[_0x3f1c('0x25')](_0x29f437,_0x5df655,!![]);}catch(_0x495f8a){return BPromise['reject'](_0x495f8a);}return _0x29f437[_0x3f1c('0x26')]();};}function saveUpdates(_0x289eef,_0x18954d){return function(_0x3f8bc3){if(_0x3f8bc3){return _0x3f8bc3['update'](_0x289eef)[_0x3f1c('0x27')](function(_0x1c2e35){return _0x1c2e35;});}return null;};}function removeEntity(_0x539b22,_0x36cef4){return function(_0x4e3df3){if(_0x4e3df3){return _0x4e3df3[_0x3f1c('0x28')]()['then'](function(){var _0x32aa5a=_0x4e3df3['get']({'plain':!![]});var _0x3da6c8=_0x3f1c('0x29');return db[_0x3f1c('0x2a')][_0x3f1c('0x28')]({'where':{'type':_0x3da6c8,'resourceId':_0x32aa5a['id']}})[_0x3f1c('0x27')](function(){return _0x4e3df3;});})[_0x3f1c('0x27')](function(){_0x539b22[_0x3f1c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3272cf,_0x1f9ed4){return function(_0x1485f9){if(!_0x1485f9){_0x3272cf[_0x3f1c('0x1b')](0x194);}return _0x1485f9;};}function handleError(_0xf22a0b,_0x4992e1){_0x4992e1=_0x4992e1||0x1f4;return function(_0x4f130b){logger[_0x3f1c('0x2b')](_0x4f130b['stack']);if(_0x4f130b[_0x3f1c('0x2c')]){delete _0x4f130b['name'];}_0xf22a0b[_0x3f1c('0x1d')](_0x4992e1)['send'](_0x4f130b);};}exports['index']=function(_0x17084c,_0x14d441){var _0x4a747f={},_0x5c2d49={},_0x3c6f52={'count':0x0,'rows':[]};var _0xcc39e8=_[_0x3f1c('0x2d')](db[_0x3f1c('0x2e')]['rawAttributes'],function(_0xf37efe){return{'name':_0xf37efe[_0x3f1c('0x2f')],'type':_0xf37efe[_0x3f1c('0x30')][_0x3f1c('0x31')]};});_0x5c2d49['model']=_[_0x3f1c('0x2d')](_0xcc39e8,_0x3f1c('0x2c'));_0x5c2d49['query']=_[_0x3f1c('0x32')](_0x17084c[_0x3f1c('0x33')]);_0x5c2d49[_0x3f1c('0x34')]=_['intersection'](_0x5c2d49[_0x3f1c('0x35')],_0x5c2d49[_0x3f1c('0x33')]);_0x4a747f[_0x3f1c('0x36')]=_[_0x3f1c('0x37')](_0x5c2d49[_0x3f1c('0x35')],qs['fields'](_0x17084c[_0x3f1c('0x33')][_0x3f1c('0x38')]));_0x4a747f[_0x3f1c('0x36')]=_0x4a747f[_0x3f1c('0x36')][_0x3f1c('0x39')]?_0x4a747f['attributes']:_0x5c2d49[_0x3f1c('0x35')];if(!_0x17084c[_0x3f1c('0x33')]['hasOwnProperty'](_0x3f1c('0x3a'))){_0x4a747f[_0x3f1c('0x20')]=qs[_0x3f1c('0x20')](_0x17084c[_0x3f1c('0x33')][_0x3f1c('0x20')]);_0x4a747f[_0x3f1c('0x22')]=qs[_0x3f1c('0x22')](_0x17084c[_0x3f1c('0x33')][_0x3f1c('0x22')]);}_0x4a747f['order']=qs[_0x3f1c('0x3b')](_0x17084c['query'][_0x3f1c('0x3b')]);_0x4a747f['where']=qs[_0x3f1c('0x34')](_[_0x3f1c('0x3c')](_0x17084c[_0x3f1c('0x33')],_0x5c2d49[_0x3f1c('0x34')]),_0xcc39e8);if(_0x17084c['query'][_0x3f1c('0x3d')]){_0x4a747f[_0x3f1c('0x3e')]=_['merge'](_0x4a747f[_0x3f1c('0x3e')],{'$or':_['map'](_0xcc39e8,function(_0x3287fd){if(_0x3287fd[_0x3f1c('0x30')]!==_0x3f1c('0x3f')){var _0x51eb3e={};_0x51eb3e[_0x3287fd['name']]={'$like':'%'+_0x17084c[_0x3f1c('0x33')]['filter']+'%'};return _0x51eb3e;}})});}_0x4a747f=_[_0x3f1c('0x40')]({},_0x4a747f,_0x17084c['options']);var _0x51678d={'where':_0x4a747f[_0x3f1c('0x3e')]};return db[_0x3f1c('0x2e')][_0x3f1c('0x21')](_0x51678d)['then'](function(_0xd0080e){_0x3c6f52[_0x3f1c('0x21')]=_0xd0080e;if(_0x17084c[_0x3f1c('0x33')][_0x3f1c('0x41')]){_0x4a747f[_0x3f1c('0x42')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x3f1c('0x43')](_0x4a747f);})[_0x3f1c('0x27')](function(_0x3e64bf){_0x3c6f52['rows']=_0x3e64bf;return _0x3c6f52;})[_0x3f1c('0x27')](respondWithFilteredResult(_0x14d441,_0x4a747f))['catch'](handleError(_0x14d441,null));};exports[_0x3f1c('0x44')]=function(_0xa7a118,_0x1a3ced){var _0x39bfbf={'raw':!![],'where':{'id':_0xa7a118[_0x3f1c('0x45')]['id']}},_0x3dfeee={};_0x3dfeee[_0x3f1c('0x35')]=_['keys'](db[_0x3f1c('0x2e')]['rawAttributes']);_0x3dfeee[_0x3f1c('0x33')]=_[_0x3f1c('0x32')](_0xa7a118[_0x3f1c('0x33')]);_0x3dfeee[_0x3f1c('0x34')]=_[_0x3f1c('0x37')](_0x3dfeee['model'],_0x3dfeee[_0x3f1c('0x33')]);_0x39bfbf[_0x3f1c('0x36')]=_[_0x3f1c('0x37')](_0x3dfeee[_0x3f1c('0x35')],qs[_0x3f1c('0x38')](_0xa7a118['query'][_0x3f1c('0x38')]));_0x39bfbf[_0x3f1c('0x36')]=_0x39bfbf[_0x3f1c('0x36')][_0x3f1c('0x39')]?_0x39bfbf[_0x3f1c('0x36')]:_0x3dfeee[_0x3f1c('0x35')];if(_0xa7a118[_0x3f1c('0x33')][_0x3f1c('0x41')]){_0x39bfbf[_0x3f1c('0x42')]=[{'all':!![]}];}_0x39bfbf=_[_0x3f1c('0x40')]({},_0x39bfbf,_0xa7a118[_0x3f1c('0x46')]);return db[_0x3f1c('0x2e')][_0x3f1c('0x47')](_0x39bfbf)[_0x3f1c('0x27')](handleEntityNotFound(_0x1a3ced,null))[_0x3f1c('0x27')](respondWithResult(_0x1a3ced,null))[_0x3f1c('0x48')](handleError(_0x1a3ced,null));};exports['create']=function(_0x370d99,_0x5d6594){return db[_0x3f1c('0x2e')]['create'](_0x370d99[_0x3f1c('0x49')],{})['then'](function(_0x516cd2){var _0x4d7765=_0x370d99[_0x3f1c('0x4a')][_0x3f1c('0x4b')]({'plain':!![]});if(!_0x4d7765)throw new Error(_0x3f1c('0x4c'));if(_0x4d7765[_0x3f1c('0x4d')]===_0x3f1c('0x4a')){var _0x324290=_0x516cd2[_0x3f1c('0x4b')]({'plain':!![]});var _0x3248db=_0x3f1c('0x29');return db[_0x3f1c('0x4e')][_0x3f1c('0x47')]({'where':{'name':_0x3248db,'userProfileId':_0x4d7765[_0x3f1c('0x4f')]},'raw':!![]})['then'](function(_0x32d130){if(_0x32d130&&_0x32d130['autoAssociation']===0x0){return db[_0x3f1c('0x2a')][_0x3f1c('0x50')]({'name':_0x324290['name'],'resourceId':_0x324290['id'],'type':_0x32d130[_0x3f1c('0x2c')],'sectionId':_0x32d130['id']},{})[_0x3f1c('0x27')](function(){return _0x516cd2;});}else{return _0x516cd2;}})[_0x3f1c('0x48')](function(_0x33d3ae){logger['error'](_0x3f1c('0x51'),_0x33d3ae);throw _0x33d3ae;});}return _0x516cd2;})[_0x3f1c('0x27')](respondWithResult(_0x5d6594,0xc9))[_0x3f1c('0x48')](handleError(_0x5d6594,null));};exports[_0x3f1c('0x52')]=function(_0x313397,_0x2247f1){if(_0x313397[_0x3f1c('0x49')]['id']){delete _0x313397['body']['id'];}return db[_0x3f1c('0x2e')][_0x3f1c('0x47')]({'where':{'id':_0x313397[_0x3f1c('0x45')]['id']}})[_0x3f1c('0x27')](handleEntityNotFound(_0x2247f1,null))[_0x3f1c('0x27')](saveUpdates(_0x313397[_0x3f1c('0x49')],null))[_0x3f1c('0x27')](respondWithResult(_0x2247f1,null))[_0x3f1c('0x48')](handleError(_0x2247f1,null));};exports['destroy']=function(_0x293722,_0x4985c4){return db[_0x3f1c('0x2e')][_0x3f1c('0x47')]({'where':{'id':_0x293722[_0x3f1c('0x45')]['id']}})['then'](handleEntityNotFound(_0x4985c4,null))[_0x3f1c('0x27')](removeEntity(_0x4985c4,null))[_0x3f1c('0x48')](handleError(_0x4985c4,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 58596a4..8391619 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9e6=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x4d16d5,_0x308d71){var _0x36ef17=function(_0x1ace49){while(--_0x1ace49){_0x4d16d5['push'](_0x4d16d5['shift']());}};_0x36ef17(++_0x308d71);}(_0xe9e6,0x178));var _0x6e9e=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0xe9e6[_0x5e2cb4];return _0x282902;};'use strict';var _=require(_0x6e9e('0x0'));var util=require(_0x6e9e('0x1'));var logger=require(_0x6e9e('0x2'))(_0x6e9e('0x3'));var moment=require('moment');var BPromise=require(_0x6e9e('0x4'));var rp=require(_0x6e9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e9e('0x6'));var config=require(_0x6e9e('0x7'));var attributes=require(_0x6e9e('0x8'));module[_0x6e9e('0x9')]=function(_0x4cb6a1,_0x536c15){return _0x4cb6a1[_0x6e9e('0xa')](_0x6e9e('0xb'),attributes,{'tableName':_0x6e9e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52d1=['request-promise','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','moment','bluebird'];(function(_0x2826d9,_0x33059e){var _0x440eca=function(_0x93e748){while(--_0x93e748){_0x2826d9['push'](_0x2826d9['shift']());}};_0x440eca(++_0x33059e);}(_0x52d1,0x193));var _0x152d=function(_0x5d9efd,_0x2adcc4){_0x5d9efd=_0x5d9efd-0x0;var _0x488b00=_0x52d1[_0x5d9efd];return _0x488b00;};'use strict';var _=require(_0x152d('0x0'));var util=require(_0x152d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x152d('0x2'));var BPromise=require(_0x152d('0x3'));var rp=require(_0x152d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x152d('0x5'));var attributes=require(_0x152d('0x6'));module[_0x152d('0x7')]=function(_0x3b0a04,_0x15564d){return _0x3b0a04[_0x152d('0x8')](_0x152d('0x9'),attributes,{'tableName':_0x152d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 935557c..6f3c266 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x701b=['jayson/promise','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0x701b,0x124));var _0xb701=function(_0x40e680,_0x798186){_0x40e680=_0x40e680-0x0;var _0x2debea=_0x701b[_0x40e680];return _0x2debea;};'use strict';var _=require('lodash');var util=require(_0xb701('0x0'));var moment=require(_0xb701('0x1'));var BPromise=require('bluebird');var rs=require(_0xb701('0x2'));var fs=require('fs');var Redis=require(_0xb701('0x3'));var db=require(_0xb701('0x4'))['db'];var utils=require(_0xb701('0x5'));var logger=require('../../config/logger')(_0xb701('0x6'));var config=require(_0xb701('0x7'));var jayson=require(_0xb701('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba3ee,_0x4d67b3,_0x18763b){return new BPromise(function(_0x230588,_0x1d73cf){return client[_0xb701('0x9')](_0x4ba3ee,_0x18763b)[_0xb701('0xa')](function(_0x12db69){logger['info'](_0xb701('0xb'),_0x4d67b3,_0xb701('0xc'));logger['debug'](_0xb701('0xd'),_0x4d67b3,_0xb701('0xc'),JSON[_0xb701('0xe')](_0x12db69));if(_0x12db69[_0xb701('0xf')]){if(_0x12db69[_0xb701('0xf')][_0xb701('0x10')]===0x1f4){logger[_0xb701('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x4d67b3,_0x12db69[_0xb701('0xf')]['message']);return _0x1d73cf(_0x12db69[_0xb701('0xf')][_0xb701('0x11')]);}logger[_0xb701('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x4d67b3,_0x12db69['error'][_0xb701('0x11')]);return _0x230588(_0x12db69[_0xb701('0xf')][_0xb701('0x11')]);}else{logger[_0xb701('0x12')](_0xb701('0xb'),_0x4d67b3,_0xb701('0xc'));_0x230588(_0x12db69[_0xb701('0x13')][_0xb701('0x11')]);}})['catch'](function(_0x34e3a2){logger[_0xb701('0xf')](_0xb701('0xb'),_0x4d67b3,_0x34e3a2);_0x1d73cf(_0x34e3a2);});});} \ No newline at end of file +var _0x2ef5=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3d235c,_0xa18dd1){var _0x56ae19=function(_0x13e842){while(--_0x13e842){_0x3d235c['push'](_0x3d235c['shift']());}};_0x56ae19(++_0xa18dd1);}(_0x2ef5,0x9b));var _0x52ef=function(_0x334a89,_0x198192){_0x334a89=_0x334a89-0x0;var _0x4665d9=_0x2ef5[_0x334a89];return _0x4665d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x52ef('0x0'));var BPromise=require(_0x52ef('0x1'));var rs=require(_0x52ef('0x2'));var fs=require('fs');var Redis=require(_0x52ef('0x3'));var db=require(_0x52ef('0x4'))['db'];var utils=require(_0x52ef('0x5'));var logger=require(_0x52ef('0x6'))(_0x52ef('0x7'));var config=require(_0x52ef('0x8'));var jayson=require(_0x52ef('0x9'));var client=jayson['client'][_0x52ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2020b7,_0xb36fe0,_0x33df60){return new BPromise(function(_0x161410,_0x5cd98d){return client[_0x52ef('0xb')](_0x2020b7,_0x33df60)['then'](function(_0x6b7939){logger[_0x52ef('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0xb36fe0,'request\x20sent');logger[_0x52ef('0xd')](_0x52ef('0xe'),_0xb36fe0,_0x52ef('0xf'),JSON[_0x52ef('0x10')](_0x6b7939));if(_0x6b7939[_0x52ef('0x11')]){if(_0x6b7939[_0x52ef('0x11')][_0x52ef('0x12')]===0x1f4){logger[_0x52ef('0x11')](_0x52ef('0x13'),_0xb36fe0,_0x6b7939[_0x52ef('0x11')][_0x52ef('0x14')]);return _0x5cd98d(_0x6b7939[_0x52ef('0x11')][_0x52ef('0x14')]);}logger['error'](_0x52ef('0x13'),_0xb36fe0,_0x6b7939[_0x52ef('0x11')]['message']);return _0x161410(_0x6b7939['error'][_0x52ef('0x14')]);}else{logger['info'](_0x52ef('0x13'),_0xb36fe0,_0x52ef('0xf'));_0x161410(_0x6b7939[_0x52ef('0x15')][_0x52ef('0x14')]);}})[_0x52ef('0x16')](function(_0x403ff3){logger[_0x52ef('0x11')](_0x52ef('0x13'),_0xb36fe0,_0x403ff3);_0x5cd98d(_0x403ff3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b1b0147..e1a9069 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dfd=['/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0x36b966,_0x474401){var _0xf1edfd=function(_0x5011dd){while(--_0x5011dd){_0x36b966['push'](_0x36b966['shift']());}};_0xf1edfd(++_0x474401);}(_0x4dfd,0x148));var _0xd4df=function(_0x8d66c3,_0x2fa3a7){_0x8d66c3=_0x8d66c3-0x0;var _0xb10481=_0x4dfd[_0x8d66c3];return _0xb10481;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd4df('0x0'));var timeout=require(_0xd4df('0x1'));var express=require(_0xd4df('0x2'));var router=express[_0xd4df('0x3')]();var fs_extra=require(_0xd4df('0x4'));var auth=require(_0xd4df('0x5'));var interaction=require(_0xd4df('0x6'));var config=require(_0xd4df('0x7'));var controller=require(_0xd4df('0x8'));router[_0xd4df('0x9')]('/',auth[_0xd4df('0xa')](),controller[_0xd4df('0xb')]);router['get'](_0xd4df('0xc'),auth[_0xd4df('0xa')](),controller[_0xd4df('0xd')]);router[_0xd4df('0xe')]('/',auth[_0xd4df('0xa')](),controller[_0xd4df('0xf')]);router[_0xd4df('0x10')]('/:id',auth[_0xd4df('0xa')](),controller[_0xd4df('0x11')]);router[_0xd4df('0x12')](_0xd4df('0xc'),auth[_0xd4df('0xa')](),controller[_0xd4df('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe1b8=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy'];(function(_0x226e1d,_0x150a35){var _0x2eee4b=function(_0x36a75e){while(--_0x36a75e){_0x226e1d['push'](_0x226e1d['shift']());}};_0x2eee4b(++_0x150a35);}(_0xe1b8,0x110));var _0x8e1b=function(_0x17bbc8,_0x3c9663){_0x17bbc8=_0x17bbc8-0x0;var _0x58723e=_0xe1b8[_0x17bbc8];return _0x58723e;};'use strict';var multer=require(_0x8e1b('0x0'));var util=require(_0x8e1b('0x1'));var path=require(_0x8e1b('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e1b('0x3'));var router=express[_0x8e1b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e1b('0x5'));var interaction=require(_0x8e1b('0x6'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8e1b('0x7')](_0x8e1b('0x8'),auth['isAuthenticated'](),controller[_0x8e1b('0x9')]);router[_0x8e1b('0xa')]('/',auth[_0x8e1b('0xb')](),controller[_0x8e1b('0xc')]);router[_0x8e1b('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8e1b('0xe')]);router[_0x8e1b('0xf')](_0x8e1b('0x8'),auth[_0x8e1b('0xb')](),controller[_0x8e1b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 95ad115..b435b0e 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 _0x048e=['ENUM','sequelize','exports','VIRTUAL','getDataValue','STRING','setDataValue','name','TEXT','long','type','select','parse','values','stringify','BOOLEAN'];(function(_0x10c34c,_0x3c7882){var _0x1f2f9d=function(_0x419c87){while(--_0x419c87){_0x10c34c['push'](_0x10c34c['shift']());}};_0x1f2f9d(++_0x3c7882);}(_0x048e,0x191));var _0xe048=function(_0xc8052d,_0xf4a4a6){_0xc8052d=_0xc8052d-0x0;var _0x2b6f49=_0x048e[_0xc8052d];return _0x2b6f49;};'use strict';var Sequelize=require(_0xe048('0x0'));var _=require('lodash');module[_0xe048('0x1')]={'name':{'type':Sequelize[_0xe048('0x2')],'get':function(_0x5b3e7e){return this[_0xe048('0x3')]('alias');}},'alias':{'type':Sequelize[_0xe048('0x4')],'allowNull':![],'set':function(_0x18323a){this[_0xe048('0x5')]('alias',_0x18323a?_0x18323a:this[_0xe048('0x3')](_0xe048('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xe048('0x7')](_0xe048('0x8')),'get':function(){if(this[_0xe048('0x3')](_0xe048('0x9'))===_0xe048('0xa')){return JSON[_0xe048('0xb')](this[_0xe048('0x3')]('values'));}else{return this[_0xe048('0x3')](_0xe048('0xc'));}},'set':function(_0x23c0ca){if(Array['isArray'](_0x23c0ca)){this[_0xe048('0x5')]('values',JSON[_0xe048('0xd')](_0x23c0ca));}else{this[_0xe048('0x5')](_0xe048('0xc'),_0x23c0ca);}}},'required':{'type':Sequelize[_0xe048('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe048('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe048('0xf')]('voice')}}; \ No newline at end of file +var _0xd31c=['alias','name','long','select','parse','values','setDataValue','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x3bdd7a,_0x533977){var _0x78e7b=function(_0x22aaa8){while(--_0x22aaa8){_0x3bdd7a['push'](_0x3bdd7a['shift']());}};_0x78e7b(++_0x533977);}(_0xd31c,0xb1));var _0xcd31=function(_0x2fa021,_0x122a26){_0x2fa021=_0x2fa021-0x0;var _0x585f7d=_0xd31c[_0x2fa021];return _0x585f7d;};'use strict';var Sequelize=require(_0xcd31('0x0'));var _=require(_0xcd31('0x1'));module[_0xcd31('0x2')]={'name':{'type':Sequelize[_0xcd31('0x3')],'get':function(_0x27e667){return this[_0xcd31('0x4')](_0xcd31('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x49c9af){this['setDataValue'](_0xcd31('0x5'),_0x49c9af?_0x49c9af:this[_0xcd31('0x4')](_0xcd31('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xcd31('0x7')),'get':function(){if(this[_0xcd31('0x4')]('type')===_0xcd31('0x8')){return JSON[_0xcd31('0x9')](this[_0xcd31('0x4')](_0xcd31('0xa')));}else{return this[_0xcd31('0x4')](_0xcd31('0xa'));}},'set':function(_0x336b67){if(Array['isArray'](_0x336b67)){this[_0xcd31('0xb')]('values',JSON[_0xcd31('0xc')](_0x336b67));}else{this[_0xcd31('0xb')]('values',_0x336b67);}}},'required':{'type':Sequelize[_0xcd31('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 28dd232..4a2e68e 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 _0xa6c8=['format','cf_%d','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','CmCustomField','fieldName','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','type','merge','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','body','create','sequelize','transaction','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts'];(function(_0x32f5f4,_0xe88faa){var _0x47d0ce=function(_0x22540b){while(--_0x22540b){_0x32f5f4['push'](_0x32f5f4['shift']());}};_0x47d0ce(++_0xe88faa);}(_0xa6c8,0x15a));var _0x8a6c=function(_0x2f63a9,_0xdddf20){_0x2f63a9=_0x2f63a9-0x0;var _0x58c61f=_0xa6c8[_0x2f63a9];return _0x58c61f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a6c('0x0'));var zipdir=require(_0x8a6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a6c('0x2'));var moment=require(_0x8a6c('0x3'));var BPromise=require(_0x8a6c('0x4'));var Mustache=require(_0x8a6c('0x5'));var util=require(_0x8a6c('0x6'));var path=require(_0x8a6c('0x7'));var sox=require(_0x8a6c('0x8'));var csv=require(_0x8a6c('0x9'));var ejs=require(_0x8a6c('0xa'));var fs=require('fs');var fs_extra=require(_0x8a6c('0xb'));var _=require('lodash');var squel=require(_0x8a6c('0xc'));var crypto=require(_0x8a6c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8a6c('0x9'));var querystring=require(_0x8a6c('0xe'));var Papa=require(_0x8a6c('0xf'));var Redis=require(_0x8a6c('0x10'));var authService=require(_0x8a6c('0x11'));var qs=require(_0x8a6c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a6c('0x13'));var logger=require(_0x8a6c('0x14'))(_0x8a6c('0x15'));var utils=require(_0x8a6c('0x16'));var config=require(_0x8a6c('0x17'));var licenseUtil=require(_0x8a6c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21fa77,_0x240167){_0x240167=_0x240167||0xcc;return function(_0x28012a){if(_0x28012a){return _0x21fa77[_0x8a6c('0x19')](_0x240167);}return _0x21fa77[_0x8a6c('0x1a')](_0x240167)['end']();};}function respondWithResult(_0x3a39ae,_0x160874){_0x160874=_0x160874||0xc8;return function(_0x4ea18b){if(_0x4ea18b){return _0x3a39ae['status'](_0x160874)[_0x8a6c('0x1b')](_0x4ea18b);}};}function respondWithFilteredResult(_0x4ee85d,_0x3d4b71){return function(_0x23745f){if(_0x23745f){var _0x590bfc=typeof _0x3d4b71[_0x8a6c('0x1c')]===_0x8a6c('0x1d')&&typeof _0x3d4b71['limit']==='undefined';var _0x625d6=_0x23745f['count'];var _0x428fc0=_0x590bfc?0x0:_0x3d4b71[_0x8a6c('0x1c')];var _0x39fb41=_0x590bfc?_0x23745f[_0x8a6c('0x1e')]:_0x3d4b71[_0x8a6c('0x1c')]+_0x3d4b71[_0x8a6c('0x1f')];var _0x1ad52c;if(_0x39fb41>=_0x625d6){_0x39fb41=_0x625d6;_0x1ad52c=0xc8;}else{_0x1ad52c=0xce;}_0x4ee85d[_0x8a6c('0x1a')](_0x1ad52c);return _0x4ee85d['set'](_0x8a6c('0x20'),_0x428fc0+'-'+_0x39fb41+'/'+_0x625d6)[_0x8a6c('0x1b')](_0x23745f);}return null;};}function patchUpdates(_0x45e682){return function(_0x44c89b){try{jsonpatch[_0x8a6c('0x21')](_0x44c89b,_0x45e682,!![]);}catch(_0x1987a5){return BPromise[_0x8a6c('0x22')](_0x1987a5);}return _0x44c89b['save']();};}function saveUpdates(_0x43a03a,_0x2c1e6c){return function(_0x2a73b7){if(_0x2a73b7){return _0x2a73b7[_0x8a6c('0x23')](_0x43a03a)[_0x8a6c('0x24')](function(_0x440e7b){return _0x440e7b;});}return null;};}function removeEntity(_0x3db147,_0x448c30){return function(_0x31837d){if(_0x31837d){return _0x31837d[_0x8a6c('0x25')]()[_0x8a6c('0x24')](function(){_0x3db147[_0x8a6c('0x1a')](0xcc)[_0x8a6c('0x26')]();});}};}function handleEntityNotFound(_0x418c17,_0x17ffa5){return function(_0x4f8ae1){if(!_0x4f8ae1){_0x418c17[_0x8a6c('0x19')](0x194);}return _0x4f8ae1;};}function handleError(_0x1f6925,_0x26a3af){_0x26a3af=_0x26a3af||0x1f4;return function(_0x2eec9a){logger[_0x8a6c('0x27')](_0x2eec9a[_0x8a6c('0x28')]);if(_0x2eec9a[_0x8a6c('0x29')]){delete _0x2eec9a[_0x8a6c('0x29')];}_0x1f6925[_0x8a6c('0x1a')](_0x26a3af)[_0x8a6c('0x2a')](_0x2eec9a);};}exports['index']=function(_0x3ad56f,_0x2a8571){var _0x58555f={},_0x286cf7={},_0x28e925={'count':0x0,'rows':[]};var _0x2769d3=_['map'](db[_0x8a6c('0x2b')]['rawAttributes'],function(_0x30c5bf){return{'name':_0x30c5bf[_0x8a6c('0x2c')],'type':_0x30c5bf['type']['key']};});_0x286cf7[_0x8a6c('0x2d')]=_[_0x8a6c('0x2e')](_['map'](_0x2769d3,_0x8a6c('0x29')),[_0x8a6c('0x29')]);_0x286cf7['query']=_[_0x8a6c('0x2f')](_0x3ad56f[_0x8a6c('0x30')]);_0x286cf7[_0x8a6c('0x31')]=_[_0x8a6c('0x32')](_0x286cf7[_0x8a6c('0x2d')],_0x286cf7[_0x8a6c('0x30')]);_0x58555f[_0x8a6c('0x33')]=_[_0x8a6c('0x32')](_0x286cf7[_0x8a6c('0x2d')],qs[_0x8a6c('0x34')](_0x3ad56f[_0x8a6c('0x30')][_0x8a6c('0x34')]));_0x58555f[_0x8a6c('0x33')]=_0x58555f['attributes'][_0x8a6c('0x35')]?_0x58555f[_0x8a6c('0x33')]:_0x286cf7[_0x8a6c('0x2d')];if(!_0x3ad56f[_0x8a6c('0x30')][_0x8a6c('0x36')]('nolimit')){_0x58555f[_0x8a6c('0x1f')]=qs[_0x8a6c('0x1f')](_0x3ad56f[_0x8a6c('0x30')][_0x8a6c('0x1f')]);_0x58555f['offset']=qs[_0x8a6c('0x1c')](_0x3ad56f[_0x8a6c('0x30')][_0x8a6c('0x1c')]);}_0x58555f['order']=qs['sort'](_0x3ad56f[_0x8a6c('0x30')]['sort']);_0x58555f[_0x8a6c('0x37')]=qs[_0x8a6c('0x31')](_[_0x8a6c('0x38')](_0x3ad56f[_0x8a6c('0x30')],_0x286cf7[_0x8a6c('0x31')]),_0x2769d3);if(_0x3ad56f['query'][_0x8a6c('0x39')]){_0x58555f['where']=_['merge'](_0x58555f[_0x8a6c('0x37')],{'$or':_['map'](_0x2769d3,function(_0x5ca87a){if(_0x5ca87a[_0x8a6c('0x3a')]!=='VIRTUAL'){var _0x373e24={};_0x373e24[_0x5ca87a[_0x8a6c('0x29')]]={'$like':'%'+_0x3ad56f[_0x8a6c('0x30')][_0x8a6c('0x39')]+'%'};return _0x373e24;}})});}_0x58555f=_[_0x8a6c('0x3b')]({},_0x58555f,_0x3ad56f['options']);var _0x14391a={'where':_0x58555f[_0x8a6c('0x37')]};return db['CmCustomField'][_0x8a6c('0x1e')](_0x14391a)[_0x8a6c('0x24')](function(_0x1159d9){_0x28e925['count']=_0x1159d9;if(_0x3ad56f[_0x8a6c('0x30')]['includeAll']){_0x58555f[_0x8a6c('0x3c')]=[{'all':!![]}];}return db[_0x8a6c('0x2b')][_0x8a6c('0x3d')](_0x58555f);})[_0x8a6c('0x24')](function(_0x349611){_0x28e925[_0x8a6c('0x3e')]=_0x349611;return _0x28e925;})[_0x8a6c('0x24')](respondWithFilteredResult(_0x2a8571,_0x58555f))[_0x8a6c('0x3f')](handleError(_0x2a8571,null));};exports[_0x8a6c('0x40')]=function(_0x42dd95,_0x45d02f){var _0x4d402e={'raw':!![],'where':{'id':_0x42dd95[_0x8a6c('0x41')]['id']}},_0xfc0a5b={};_0xfc0a5b[_0x8a6c('0x2d')]=_['keys'](db[_0x8a6c('0x2b')][_0x8a6c('0x42')]);_0xfc0a5b[_0x8a6c('0x30')]=_[_0x8a6c('0x2f')](_0x42dd95[_0x8a6c('0x30')]);_0xfc0a5b['filters']=_[_0x8a6c('0x32')](_0xfc0a5b[_0x8a6c('0x2d')],_0xfc0a5b[_0x8a6c('0x30')]);_0x4d402e[_0x8a6c('0x33')]=_[_0x8a6c('0x32')](_0xfc0a5b[_0x8a6c('0x2d')],qs[_0x8a6c('0x34')](_0x42dd95['query'][_0x8a6c('0x34')]));_0x4d402e[_0x8a6c('0x33')]=_0x4d402e[_0x8a6c('0x33')][_0x8a6c('0x35')]?_0x4d402e[_0x8a6c('0x33')]:_0xfc0a5b[_0x8a6c('0x2d')];if(_0x42dd95[_0x8a6c('0x30')][_0x8a6c('0x43')]){_0x4d402e[_0x8a6c('0x3c')]=[{'all':!![]}];}_0x4d402e=_['merge']({},_0x4d402e,_0x42dd95[_0x8a6c('0x44')]);return db[_0x8a6c('0x2b')][_0x8a6c('0x45')](_0x4d402e)[_0x8a6c('0x24')](handleEntityNotFound(_0x45d02f,null))[_0x8a6c('0x24')](respondWithResult(_0x45d02f,null))[_0x8a6c('0x3f')](handleError(_0x45d02f,null));};exports[_0x8a6c('0x23')]=function(_0x5e502e,_0x31f2f1){if(_0x5e502e['body']['id']){delete _0x5e502e[_0x8a6c('0x46')]['id'];}return db[_0x8a6c('0x2b')][_0x8a6c('0x45')]({'where':{'id':_0x5e502e[_0x8a6c('0x41')]['id']}})[_0x8a6c('0x24')](handleEntityNotFound(_0x31f2f1,null))[_0x8a6c('0x24')](saveUpdates(_0x5e502e['body'],null))['then'](respondWithResult(_0x31f2f1,null))[_0x8a6c('0x3f')](handleError(_0x31f2f1,null));};exports[_0x8a6c('0x25')]=function(_0x3a10fe,_0x2e5c50){return db['CmCustomField'][_0x8a6c('0x45')]({'where':{'id':_0x3a10fe[_0x8a6c('0x41')]['id']}})[_0x8a6c('0x24')](handleEntityNotFound(_0x2e5c50,null))[_0x8a6c('0x24')](removeEntity(_0x2e5c50,null))['catch'](handleError(_0x2e5c50,null));};exports[_0x8a6c('0x47')]=function(_0x581e5b,_0x9d62bf){var _0x3259e5;return db[_0x8a6c('0x48')][_0x8a6c('0x49')](function(_0x152171){return db[_0x8a6c('0x2b')][_0x8a6c('0x47')](_0x581e5b[_0x8a6c('0x46')],{'transaction':_0x152171})['then'](function(_0x554f2e){_0x3259e5=_0x554f2e;var _0x1ed41b={'type':db[_0x8a6c('0x4a')]['TEXT'],'transaction':_0x152171};switch(_0x581e5b[_0x8a6c('0x46')][_0x8a6c('0x3a')]){case _0x8a6c('0x4b'):_0x1ed41b[_0x8a6c('0x3a')]=db['Sequelize'][_0x8a6c('0x4c')];break;case'number':_0x1ed41b[_0x8a6c('0x3a')]=db[_0x8a6c('0x4a')][_0x8a6c('0x4d')];break;case _0x8a6c('0x4e'):_0x1ed41b['type']=db['Sequelize'][_0x8a6c('0x4f')];_0x1ed41b[_0x8a6c('0x50')]=![];break;default:}return db[_0x8a6c('0x48')][_0x8a6c('0x51')][_0x8a6c('0x52')](_0x8a6c('0x53'),util[_0x8a6c('0x54')](_0x8a6c('0x55'),_0x3259e5['id']),_0x1ed41b);})['then'](function(){return _0x3259e5;});})[_0x8a6c('0x24')](respondWithResult(_0x9d62bf,0xc9))['catch'](handleError(_0x9d62bf,null));}; \ No newline at end of file +var _0x5315=['../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','end','error','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','fields','options','find','body','destroy','sequelize','transaction','text','Sequelize','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5315,0x14a));var _0x5531=function(_0x575bd0,_0x37f9ad){_0x575bd0=_0x575bd0-0x0;var _0x4c9e5c=_0x5315[_0x575bd0];return _0x4c9e5c;};'use strict';var emlformat=require(_0x5531('0x0'));var rimraf=require(_0x5531('0x1'));var zipdir=require(_0x5531('0x2'));var jsonpatch=require(_0x5531('0x3'));var rp=require(_0x5531('0x4'));var moment=require(_0x5531('0x5'));var BPromise=require(_0x5531('0x6'));var Mustache=require(_0x5531('0x7'));var util=require(_0x5531('0x8'));var path=require(_0x5531('0x9'));var sox=require(_0x5531('0xa'));var csv=require(_0x5531('0xb'));var ejs=require(_0x5531('0xc'));var fs=require('fs');var fs_extra=require(_0x5531('0xd'));var _=require(_0x5531('0xe'));var squel=require(_0x5531('0xf'));var crypto=require(_0x5531('0x10'));var jsforce=require(_0x5531('0x11'));var deskjs=require(_0x5531('0x12'));var toCsv=require('to-csv');var querystring=require(_0x5531('0x13'));var Papa=require(_0x5531('0x14'));var Redis=require('ioredis');var authService=require(_0x5531('0x15'));var qs=require(_0x5531('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5531('0x17'));var logger=require('../../config/logger')(_0x5531('0x18'));var utils=require(_0x5531('0x19'));var config=require(_0x5531('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c12b4,_0xb4fe93){_0xb4fe93=_0xb4fe93||0xcc;return function(_0x2736ee){if(_0x2736ee){return _0x3c12b4[_0x5531('0x1b')](_0xb4fe93);}return _0x3c12b4[_0x5531('0x1c')](_0xb4fe93)['end']();};}function respondWithResult(_0x5ceef7,_0xa44625){_0xa44625=_0xa44625||0xc8;return function(_0x5bc9d4){if(_0x5bc9d4){return _0x5ceef7[_0x5531('0x1c')](_0xa44625)['json'](_0x5bc9d4);}};}function respondWithFilteredResult(_0x4362a1,_0x166567){return function(_0x1999d6){if(_0x1999d6){var _0x2c128f=typeof _0x166567[_0x5531('0x1d')]===_0x5531('0x1e')&&typeof _0x166567[_0x5531('0x1f')]==='undefined';var _0x3ea2c3=_0x1999d6[_0x5531('0x20')];var _0x2db502=_0x2c128f?0x0:_0x166567['offset'];var _0x40fce2=_0x2c128f?_0x1999d6['count']:_0x166567[_0x5531('0x1d')]+_0x166567[_0x5531('0x1f')];var _0x5cadbf;if(_0x40fce2>=_0x3ea2c3){_0x40fce2=_0x3ea2c3;_0x5cadbf=0xc8;}else{_0x5cadbf=0xce;}_0x4362a1[_0x5531('0x1c')](_0x5cadbf);return _0x4362a1[_0x5531('0x21')](_0x5531('0x22'),_0x2db502+'-'+_0x40fce2+'/'+_0x3ea2c3)[_0x5531('0x23')](_0x1999d6);}return null;};}function patchUpdates(_0x3103d5){return function(_0x140468){try{jsonpatch['apply'](_0x140468,_0x3103d5,!![]);}catch(_0x13e351){return BPromise[_0x5531('0x24')](_0x13e351);}return _0x140468[_0x5531('0x25')]();};}function saveUpdates(_0x78fff3,_0x5c535b){return function(_0x223deb){if(_0x223deb){return _0x223deb[_0x5531('0x26')](_0x78fff3)[_0x5531('0x27')](function(_0x4a97a3){return _0x4a97a3;});}return null;};}function removeEntity(_0x1e69e2,_0x3cf0fd){return function(_0xe51bc4){if(_0xe51bc4){return _0xe51bc4['destroy']()[_0x5531('0x27')](function(){_0x1e69e2[_0x5531('0x1c')](0xcc)[_0x5531('0x28')]();});}};}function handleEntityNotFound(_0x459cc6,_0x31d344){return function(_0x145213){if(!_0x145213){_0x459cc6[_0x5531('0x1b')](0x194);}return _0x145213;};}function handleError(_0x2e9f60,_0x176ee4){_0x176ee4=_0x176ee4||0x1f4;return function(_0x49a9f7){logger[_0x5531('0x29')](_0x49a9f7['stack']);if(_0x49a9f7[_0x5531('0x2a')]){delete _0x49a9f7[_0x5531('0x2a')];}_0x2e9f60[_0x5531('0x1c')](_0x176ee4)[_0x5531('0x2b')](_0x49a9f7);};}exports[_0x5531('0x2c')]=function(_0x1e37de,_0x1653b9){var _0x48c0e9={},_0x2645d2={},_0x3111d2={'count':0x0,'rows':[]};var _0xd65b26=_['map'](db[_0x5531('0x2d')][_0x5531('0x2e')],function(_0x188def){return{'name':_0x188def[_0x5531('0x2f')],'type':_0x188def[_0x5531('0x30')][_0x5531('0x31')]};});_0x2645d2[_0x5531('0x32')]=_[_0x5531('0x33')](_[_0x5531('0x34')](_0xd65b26,_0x5531('0x2a')),['name']);_0x2645d2[_0x5531('0x35')]=_[_0x5531('0x36')](_0x1e37de['query']);_0x2645d2[_0x5531('0x37')]=_[_0x5531('0x38')](_0x2645d2[_0x5531('0x32')],_0x2645d2[_0x5531('0x35')]);_0x48c0e9[_0x5531('0x39')]=_[_0x5531('0x38')](_0x2645d2[_0x5531('0x32')],qs['fields'](_0x1e37de[_0x5531('0x35')]['fields']));_0x48c0e9['attributes']=_0x48c0e9[_0x5531('0x39')]['length']?_0x48c0e9[_0x5531('0x39')]:_0x2645d2[_0x5531('0x32')];if(!_0x1e37de[_0x5531('0x35')][_0x5531('0x3a')]('nolimit')){_0x48c0e9['limit']=qs[_0x5531('0x1f')](_0x1e37de[_0x5531('0x35')]['limit']);_0x48c0e9['offset']=qs[_0x5531('0x1d')](_0x1e37de[_0x5531('0x35')][_0x5531('0x1d')]);}_0x48c0e9[_0x5531('0x3b')]=qs[_0x5531('0x3c')](_0x1e37de[_0x5531('0x35')][_0x5531('0x3c')]);_0x48c0e9[_0x5531('0x3d')]=qs[_0x5531('0x37')](_['pick'](_0x1e37de['query'],_0x2645d2[_0x5531('0x37')]),_0xd65b26);if(_0x1e37de[_0x5531('0x35')][_0x5531('0x3e')]){_0x48c0e9['where']=_[_0x5531('0x3f')](_0x48c0e9['where'],{'$or':_['map'](_0xd65b26,function(_0x468e4a){if(_0x468e4a[_0x5531('0x30')]!==_0x5531('0x40')){var _0x5d09={};_0x5d09[_0x468e4a[_0x5531('0x2a')]]={'$like':'%'+_0x1e37de[_0x5531('0x35')]['filter']+'%'};return _0x5d09;}})});}_0x48c0e9=_[_0x5531('0x3f')]({},_0x48c0e9,_0x1e37de['options']);var _0x697b6e={'where':_0x48c0e9[_0x5531('0x3d')]};return db[_0x5531('0x2d')][_0x5531('0x20')](_0x697b6e)[_0x5531('0x27')](function(_0x550ab3){_0x3111d2[_0x5531('0x20')]=_0x550ab3;if(_0x1e37de[_0x5531('0x35')][_0x5531('0x41')]){_0x48c0e9[_0x5531('0x42')]=[{'all':!![]}];}return db[_0x5531('0x2d')][_0x5531('0x43')](_0x48c0e9);})[_0x5531('0x27')](function(_0x63c671){_0x3111d2[_0x5531('0x44')]=_0x63c671;return _0x3111d2;})[_0x5531('0x27')](respondWithFilteredResult(_0x1653b9,_0x48c0e9))[_0x5531('0x45')](handleError(_0x1653b9,null));};exports['show']=function(_0x5db831,_0x343d97){var _0xb8864a={'raw':!![],'where':{'id':_0x5db831[_0x5531('0x46')]['id']}},_0x46d9c9={};_0x46d9c9[_0x5531('0x32')]=_[_0x5531('0x36')](db[_0x5531('0x2d')]['rawAttributes']);_0x46d9c9[_0x5531('0x35')]=_[_0x5531('0x36')](_0x5db831['query']);_0x46d9c9['filters']=_['intersection'](_0x46d9c9[_0x5531('0x32')],_0x46d9c9[_0x5531('0x35')]);_0xb8864a[_0x5531('0x39')]=_[_0x5531('0x38')](_0x46d9c9[_0x5531('0x32')],qs[_0x5531('0x47')](_0x5db831['query'][_0x5531('0x47')]));_0xb8864a['attributes']=_0xb8864a[_0x5531('0x39')]['length']?_0xb8864a['attributes']:_0x46d9c9['model'];if(_0x5db831[_0x5531('0x35')][_0x5531('0x41')]){_0xb8864a[_0x5531('0x42')]=[{'all':!![]}];}_0xb8864a=_[_0x5531('0x3f')]({},_0xb8864a,_0x5db831[_0x5531('0x48')]);return db[_0x5531('0x2d')][_0x5531('0x49')](_0xb8864a)[_0x5531('0x27')](handleEntityNotFound(_0x343d97,null))[_0x5531('0x27')](respondWithResult(_0x343d97,null))['catch'](handleError(_0x343d97,null));};exports[_0x5531('0x26')]=function(_0x1b9bbc,_0x1b1f0b){if(_0x1b9bbc[_0x5531('0x4a')]['id']){delete _0x1b9bbc[_0x5531('0x4a')]['id'];}return db[_0x5531('0x2d')][_0x5531('0x49')]({'where':{'id':_0x1b9bbc[_0x5531('0x46')]['id']}})[_0x5531('0x27')](handleEntityNotFound(_0x1b1f0b,null))[_0x5531('0x27')](saveUpdates(_0x1b9bbc[_0x5531('0x4a')],null))[_0x5531('0x27')](respondWithResult(_0x1b1f0b,null))[_0x5531('0x45')](handleError(_0x1b1f0b,null));};exports[_0x5531('0x4b')]=function(_0x413d17,_0xf6baab){return db[_0x5531('0x2d')][_0x5531('0x49')]({'where':{'id':_0x413d17[_0x5531('0x46')]['id']}})[_0x5531('0x27')](handleEntityNotFound(_0xf6baab,null))[_0x5531('0x27')](removeEntity(_0xf6baab,null))['catch'](handleError(_0xf6baab,null));};exports['create']=function(_0x3c5d88,_0x2ee823){var _0x4a63c8;return db[_0x5531('0x4c')][_0x5531('0x4d')](function(_0x16fd6f){return db[_0x5531('0x2d')]['create'](_0x3c5d88[_0x5531('0x4a')],{'transaction':_0x16fd6f})['then'](function(_0x1ab43d){_0x4a63c8=_0x1ab43d;var _0x5219d4={'type':db['Sequelize']['TEXT'],'transaction':_0x16fd6f};switch(_0x3c5d88[_0x5531('0x4a')][_0x5531('0x30')]){case _0x5531('0x4e'):_0x5219d4['type']=db[_0x5531('0x4f')]['TEXT'];break;case _0x5531('0x50'):_0x5219d4['type']=db['Sequelize']['INTEGER'];break;case _0x5531('0x51'):_0x5219d4[_0x5531('0x30')]=db[_0x5531('0x4f')][_0x5531('0x52')];_0x5219d4[_0x5531('0x53')]=![];break;default:}return db['sequelize'][_0x5531('0x54')][_0x5531('0x55')](_0x5531('0x56'),util[_0x5531('0x57')](_0x5531('0x58'),_0x4a63c8['id']),_0x5219d4);})['then'](function(){return _0x4a63c8;});})[_0x5531('0x27')](respondWithResult(_0x2ee823,0xc9))[_0x5531('0x45')](handleError(_0x2ee823,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index a37436f..00ffbf0 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 _0x0cc9=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','request-promise'];(function(_0xb43d1b,_0x3935cf){var _0x4aafca=function(_0x3b26d2){while(--_0x3b26d2){_0xb43d1b['push'](_0xb43d1b['shift']());}};_0x4aafca(++_0x3935cf);}(_0x0cc9,0x131));var _0x90cc=function(_0x5cf1a1,_0x1ab924){_0x5cf1a1=_0x5cf1a1-0x0;var _0x52cbcc=_0x0cc9[_0x5cf1a1];return _0x52cbcc;};'use strict';var _=require(_0x90cc('0x0'));var util=require(_0x90cc('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x90cc('0x2'));var fs=require('fs');var path=require(_0x90cc('0x3'));var rimraf=require(_0x90cc('0x4'));var config=require(_0x90cc('0x5'));var attributes=require(_0x90cc('0x6'));module[_0x90cc('0x7')]=function(_0x42a3e6,_0x114fd7){return _0x42a3e6[_0x90cc('0x8')](_0x90cc('0x9'),attributes,{'tableName':_0x90cc('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd66f=['path','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment'];(function(_0x2ae5ce,_0x481760){var _0x3ccd3c=function(_0x3b870c){while(--_0x3b870c){_0x2ae5ce['push'](_0x2ae5ce['shift']());}};_0x3ccd3c(++_0x481760);}(_0xd66f,0xf6));var _0xfd66=function(_0x7754ff,_0x3c3bce){_0x7754ff=_0x7754ff-0x0;var _0x385ffd=_0xd66f[_0x7754ff];return _0x385ffd;};'use strict';var _=require(_0xfd66('0x0'));var util=require('util');var logger=require(_0xfd66('0x1'))(_0xfd66('0x2'));var moment=require(_0xfd66('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd66('0x4'));var rimraf=require('rimraf');var config=require(_0xfd66('0x5'));var attributes=require(_0xfd66('0x6'));module['exports']=function(_0x1fd18b,_0x49b6d8){return _0x1fd18b[_0xfd66('0x7')](_0xfd66('0x8'),attributes,{'tableName':_0xfd66('0x9'),'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 f84a837..a650070 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 _0xffdb=['http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4aa09e,_0xdc743d){var _0x38efe6=function(_0x7ab12c){while(--_0x7ab12c){_0x4aa09e['push'](_0x4aa09e['shift']());}};_0x38efe6(++_0xdc743d);}(_0xffdb,0xb5));var _0xbffd=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xffdb[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xbffd('0x0'));var util=require(_0xbffd('0x1'));var moment=require(_0xbffd('0x2'));var BPromise=require('bluebird');var rs=require(_0xbffd('0x3'));var fs=require('fs');var Redis=require(_0xbffd('0x4'));var db=require(_0xbffd('0x5'))['db'];var utils=require(_0xbffd('0x6'));var logger=require('../../config/logger')(_0xbffd('0x7'));var config=require(_0xbffd('0x8'));var jayson=require(_0xbffd('0x9'));var client=jayson[_0xbffd('0xa')][_0xbffd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x196219,_0x26f745,_0x554db8){return new BPromise(function(_0x12c5f5,_0x57ee75){return client[_0xbffd('0xc')](_0x196219,_0x554db8)['then'](function(_0x5bb051){logger['info'](_0xbffd('0xd'),_0x26f745,_0xbffd('0xe'));logger[_0xbffd('0xf')](_0xbffd('0x10'),_0x26f745,_0xbffd('0xe'),JSON[_0xbffd('0x11')](_0x5bb051));if(_0x5bb051[_0xbffd('0x12')]){if(_0x5bb051[_0xbffd('0x12')][_0xbffd('0x13')]===0x1f4){logger[_0xbffd('0x12')]('CmCustomField,\x20%s,\x20%s',_0x26f745,_0x5bb051[_0xbffd('0x12')]['message']);return _0x57ee75(_0x5bb051[_0xbffd('0x12')][_0xbffd('0x14')]);}logger[_0xbffd('0x12')](_0xbffd('0xd'),_0x26f745,_0x5bb051[_0xbffd('0x12')][_0xbffd('0x14')]);return _0x12c5f5(_0x5bb051['error'][_0xbffd('0x14')]);}else{logger[_0xbffd('0x15')]('CmCustomField,\x20%s,\x20%s',_0x26f745,_0xbffd('0xe'));_0x12c5f5(_0x5bb051[_0xbffd('0x16')]['message']);}})[_0xbffd('0x17')](function(_0x2f54c8){logger[_0xbffd('0x12')](_0xbffd('0xd'),_0x26f745,_0x2f54c8);_0x57ee75(_0x2f54c8);});});} \ No newline at end of file +var _0xb502=['request','info','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4b0f97,_0x24ee19){var _0x58a566=function(_0x185ed8){while(--_0x185ed8){_0x4b0f97['push'](_0x4b0f97['shift']());}};_0x58a566(++_0x24ee19);}(_0xb502,0x1ae));var _0x2b50=function(_0x46c0df,_0x216b97){_0x46c0df=_0x46c0df-0x0;var _0x31ad63=_0xb502[_0x46c0df];return _0x31ad63;};'use strict';var _=require(_0x2b50('0x0'));var util=require(_0x2b50('0x1'));var moment=require('moment');var BPromise=require(_0x2b50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b50('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b50('0x4'));var logger=require(_0x2b50('0x5'))(_0x2b50('0x6'));var config=require(_0x2b50('0x7'));var jayson=require(_0x2b50('0x8'));var client=jayson[_0x2b50('0x9')][_0x2b50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e143c,_0x353b86,_0x137f50){return new BPromise(function(_0x2a03e0,_0x1ce0d3){return client[_0x2b50('0xb')](_0x2e143c,_0x137f50)['then'](function(_0x3f2519){logger[_0x2b50('0xc')]('CmCustomField,\x20%s,\x20%s',_0x353b86,'request\x20sent');logger[_0x2b50('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x353b86,'request\x20sent',JSON[_0x2b50('0xe')](_0x3f2519));if(_0x3f2519[_0x2b50('0xf')]){if(_0x3f2519[_0x2b50('0xf')][_0x2b50('0x10')]===0x1f4){logger['error'](_0x2b50('0x11'),_0x353b86,_0x3f2519[_0x2b50('0xf')][_0x2b50('0x12')]);return _0x1ce0d3(_0x3f2519[_0x2b50('0xf')]['message']);}logger[_0x2b50('0xf')](_0x2b50('0x11'),_0x353b86,_0x3f2519[_0x2b50('0xf')][_0x2b50('0x12')]);return _0x2a03e0(_0x3f2519[_0x2b50('0xf')][_0x2b50('0x12')]);}else{logger['info'](_0x2b50('0x11'),_0x353b86,_0x2b50('0x13'));_0x2a03e0(_0x3f2519[_0x2b50('0x14')]['message']);}})['catch'](function(_0x2855f5){logger[_0x2b50('0xf')]('CmCustomField,\x20%s,\x20%s',_0x353b86,_0x2855f5);_0x1ce0d3(_0x2855f5);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 9d5d373..feb1b7f 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 _0x16cc=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','post','put','/:id','update','destroy','util'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0x16cc,0x120));var _0xc16c=function(_0x252f5c,_0x6cbae6){_0x252f5c=_0x252f5c-0x0;var _0x4eedeb=_0x16cc[_0x252f5c];return _0x4eedeb;};'use strict';var multer=require('multer');var util=require(_0xc16c('0x0'));var path=require(_0xc16c('0x1'));var timeout=require(_0xc16c('0x2'));var express=require(_0xc16c('0x3'));var router=express[_0xc16c('0x4')]();var fs_extra=require(_0xc16c('0x5'));var auth=require(_0xc16c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc16c('0x7'));var controller=require(_0xc16c('0x8'));router[_0xc16c('0x9')]('/',auth[_0xc16c('0xa')](),controller['index']);router[_0xc16c('0x9')]('/:id',auth[_0xc16c('0xa')](),controller[_0xc16c('0xb')]);router[_0xc16c('0xc')]('/',auth[_0xc16c('0xa')](),controller['create']);router[_0xc16c('0xd')](_0xc16c('0xe'),auth[_0xc16c('0xa')](),controller[_0xc16c('0xf')]);router['delete'](_0xc16c('0xe'),auth[_0xc16c('0xa')](),controller[_0xc16c('0x10')]);module['exports']=router; \ No newline at end of file +var _0x624c=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','destroy'];(function(_0x2355eb,_0x3ac32c){var _0x24b059=function(_0x264139){while(--_0x264139){_0x2355eb['push'](_0x2355eb['shift']());}};_0x24b059(++_0x3ac32c);}(_0x624c,0x1ee));var _0xc624=function(_0x9af652,_0x4de743){_0x9af652=_0x9af652-0x0;var _0x2eb16e=_0x624c[_0x9af652];return _0x2eb16e;};'use strict';var multer=require('multer');var util=require(_0xc624('0x0'));var path=require(_0xc624('0x1'));var timeout=require(_0xc624('0x2'));var express=require(_0xc624('0x3'));var router=express[_0xc624('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc624('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc624('0x6'));var controller=require('./cmCustomField.controller');router[_0xc624('0x7')]('/',auth[_0xc624('0x8')](),controller[_0xc624('0x9')]);router[_0xc624('0x7')](_0xc624('0xa'),auth[_0xc624('0x8')](),controller[_0xc624('0xb')]);router['post']('/',auth[_0xc624('0x8')](),controller[_0xc624('0xc')]);router[_0xc624('0xd')]('/:id',auth[_0xc624('0x8')](),controller[_0xc624('0xe')]);router['delete'](_0xc624('0xa'),auth[_0xc624('0x8')](),controller[_0xc624('0xf')]);module[_0xc624('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5ce27a4..7487676 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 _0x37c0=['UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0x37c0,0xde));var _0x037c=function(_0x3d248c,_0x5ef493){_0x3d248c=_0x3d248c-0x0;var _0x556270=_0x37c0[_0x3d248c];return _0x556270;};'use strict';var moment=require(_0x037c('0x0'));var Sequelize=require(_0x037c('0x1'));module['exports']={'phone':{'type':Sequelize[_0x037c('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x037c('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x037c('0x4')],'defaultValue':moment()[_0x037c('0x5')](_0x037c('0x6'))},'countbusyretry':{'type':Sequelize[_0x037c('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x037c('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x037c('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x037c('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x037c('0x4')]},'priority':{'type':Sequelize[_0x037c('0x7')](0x2)[_0x037c('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x037c('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x037c('0x7')],'unique':_0x037c('0x9')},'ListId':{'type':Sequelize[_0x037c('0x7')],'unique':_0x037c('0x9')},'UserId':{'type':Sequelize[_0x037c('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x037c('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x037c('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x037c('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x037c('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x037c('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x037c('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x037c('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x037c('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xe4fe=['exports','STRING','DATE','INTEGER','UNSIGNED','BOOLEAN','contactListQueue','sequelize'];(function(_0x578955,_0x168f8d){var _0xec9286=function(_0x2dd3b5){while(--_0x2dd3b5){_0x578955['push'](_0x578955['shift']());}};_0xec9286(++_0x168f8d);}(_0xe4fe,0x14f));var _0xee4f=function(_0x483017,_0x73092c){_0x483017=_0x483017-0x0;var _0x3cc794=_0xe4fe[_0x483017];return _0x3cc794;};'use strict';var moment=require('moment');var Sequelize=require(_0xee4f('0x0'));module[_0xee4f('0x1')]={'phone':{'type':Sequelize[_0xee4f('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xee4f('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xee4f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xee4f('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xee4f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xee4f('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xee4f('0x7')},'ListId':{'type':Sequelize[_0xee4f('0x4')],'unique':_0xee4f('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xee4f('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xee4f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xee4f('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xee4f('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xee4f('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 31a10f7..771f2dd 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 _0x23f4=['VIRTUAL','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','updatedAt','state','statedesc','deleted','campaign','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','priority','findOne','recallme','LOCK','Contact','CmCompany','Queue','dialActive','getPreviewRecall','transaction','scheduledat','UPDATE','Company','CmList','List','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','api','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','keys','query','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notILike','$overlap','$any','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filter','where'];(function(_0x378eab,_0x17f644){var _0x11a512=function(_0x33f51f){while(--_0x33f51f){_0x378eab['push'](_0x378eab['shift']());}};_0x11a512(++_0x17f644);}(_0x23f4,0x1ee));var _0x423f=function(_0x398215,_0x334573){_0x398215=_0x398215-0x0;var _0x35c5e6=_0x23f4[_0x398215];return _0x35c5e6;};'use strict';var moment=require('moment');var _=require(_0x423f('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x423f('0x1'));var shared=require(_0x423f('0x2'));var db=require(_0x423f('0x3'))['db'];function respondWithResult(_0x3503a0,_0x1ab106){_0x1ab106=_0x1ab106||0xc8;return function(_0x129dba){if(_0x129dba){return _0x3503a0[_0x423f('0x4')](_0x1ab106)[_0x423f('0x5')](_0x129dba);}};}function respondWithFilteredResult(_0x34a2d9,_0x51066b){return function(_0x260eae){if(_0x260eae){var _0x47716d=typeof _0x51066b['offset']===_0x423f('0x6')&&typeof _0x51066b[_0x423f('0x7')]===_0x423f('0x6');var _0x50301a=_0x260eae['count'];var _0x4b8a90=_0x47716d?0x0:_0x51066b[_0x423f('0x8')];var _0x481c41=_0x47716d?_0x260eae[_0x423f('0x9')]:_0x51066b[_0x423f('0x8')]+_0x51066b[_0x423f('0x7')];var _0x162c83;if(_0x481c41>=_0x50301a){_0x481c41=_0x50301a;_0x162c83=0xc8;}else{_0x162c83=0xce;}_0x34a2d9['status'](_0x162c83);return _0x34a2d9[_0x423f('0xa')](_0x423f('0xb'),_0x4b8a90+'-'+_0x481c41+'/'+_0x50301a)[_0x423f('0x5')](_0x260eae);}return null;};}function saveUpdates(_0x3d4027,_0x216360){return function(_0x5275b0){if(_0x5275b0){return _0x5275b0[_0x423f('0xc')](_0x3d4027)[_0x423f('0xd')](function(_0x2ebc8c){return _0x2ebc8c;});}return null;};}function handleEntityNotFound(_0x1c894f,_0x44e1d5){return function(_0x3b531d){if(!_0x3b531d){_0x1c894f[_0x423f('0xe')](0x194);}return _0x3b531d;};}function handleError(_0x21d804,_0x252e6c){_0x252e6c=_0x252e6c||0x1f4;return function(_0x235c86){logger[_0x423f('0xf')](_0x235c86[_0x423f('0x10')]);if(_0x235c86[_0x423f('0x11')]){delete _0x235c86[_0x423f('0x11')];}_0x21d804[_0x423f('0x4')](_0x252e6c)[_0x423f('0x12')](_0x235c86);};}exports[_0x423f('0x13')]=function(_0x34e968,_0x26b6d1){var _0x5424e6={},_0x99435f={},_0x569fd0={'count':0x0,'rows':[]};var _0x504d8b=_[_0x423f('0x14')](db['CmHopper'][_0x423f('0x15')],function(_0xd7b80e){return{'name':_0xd7b80e['fieldName'],'type':_0xd7b80e[_0x423f('0x16')][_0x423f('0x17')]};});_0x99435f['model']=_[_0x423f('0x14')](_0x504d8b,_0x423f('0x11'));_0x99435f['query']=_[_0x423f('0x18')](_0x34e968[_0x423f('0x19')]);_0x99435f['filters']=_[_0x423f('0x1a')](_0x99435f['model'],_0x99435f[_0x423f('0x19')]);_0x99435f[_0x423f('0x1b')]=_[_0x423f('0x1c')](_0x99435f[_0x423f('0x1b')],[_0x423f('0x1d'),_0x423f('0x1e'),_0x423f('0x1f'),_0x423f('0x20'),_0x423f('0x21'),_0x423f('0x22'),_0x423f('0x23'),_0x423f('0x24'),_0x423f('0x25'),_0x423f('0x26'),'$notBetween',_0x423f('0x27'),_0x423f('0x28'),_0x423f('0x29'),'$notLike','$iLike',_0x423f('0x2a'),_0x423f('0x29'),_0x423f('0x2b'),'$contains','$contained',_0x423f('0x2c')]);_0x5424e6[_0x423f('0x2d')]=_['intersection'](_0x99435f[_0x423f('0x2e')],qs[_0x423f('0x2f')](_0x34e968[_0x423f('0x19')][_0x423f('0x2f')]));_0x5424e6['attributes']=_0x5424e6[_0x423f('0x2d')][_0x423f('0x30')]?_0x5424e6[_0x423f('0x2d')]:_0x99435f[_0x423f('0x2e')];if(!_0x34e968['query'][_0x423f('0x31')](_0x423f('0x32'))){_0x5424e6[_0x423f('0x7')]=qs[_0x423f('0x7')](_0x34e968[_0x423f('0x19')][_0x423f('0x7')]);_0x5424e6[_0x423f('0x8')]=qs[_0x423f('0x8')](_0x34e968[_0x423f('0x19')][_0x423f('0x8')]);}_0x5424e6['order']=qs[_0x423f('0x33')](_0x34e968[_0x423f('0x19')][_0x423f('0x33')]);_0x5424e6['where']=qs[_0x423f('0x1b')](_['pick'](_0x34e968[_0x423f('0x19')],_0x99435f[_0x423f('0x1b')]),_0x504d8b);if(_0x34e968[_0x423f('0x19')][_0x423f('0x34')]){_0x5424e6[_0x423f('0x35')]=_['merge'](_0x5424e6['where'],{'$or':_[_0x423f('0x14')](_0x504d8b,function(_0x5a2225){if(_0x5a2225[_0x423f('0x16')]!==_0x423f('0x36')){var _0x3e4c9f={};_0x3e4c9f[_0x5a2225[_0x423f('0x11')]]={'$like':'%'+_0x34e968[_0x423f('0x19')][_0x423f('0x34')]+'%'};return _0x3e4c9f;}})});}_0x5424e6=_[_0x423f('0x37')]({},_0x5424e6,_0x34e968[_0x423f('0x38')]);var _0x3aeb17={'where':_0x5424e6[_0x423f('0x35')]};return db[_0x423f('0x39')]['count'](_0x3aeb17)['then'](function(_0x382f91){_0x569fd0[_0x423f('0x9')]=_0x382f91;if(_0x34e968[_0x423f('0x19')][_0x423f('0x3a')]){_0x5424e6[_0x423f('0x3b')]=[{'all':!![]}];}return db['CmHopper'][_0x423f('0x3c')](_0x5424e6);})[_0x423f('0xd')](function(_0x2e6d28){_0x569fd0[_0x423f('0x3d')]=_0x2e6d28;return _0x569fd0;})[_0x423f('0xd')](respondWithFilteredResult(_0x26b6d1,_0x5424e6))[_0x423f('0x3e')](handleError(_0x26b6d1,null));};exports[_0x423f('0x3f')]=function(_0x1d280f,_0x3464e3){var _0x40571a={'raw':!![],'where':{'id':_0x1d280f['params']['id']}},_0x4fb566={};_0x4fb566[_0x423f('0x2e')]=_[_0x423f('0x18')](db[_0x423f('0x39')][_0x423f('0x15')]);_0x4fb566[_0x423f('0x19')]=_[_0x423f('0x18')](_0x1d280f['query']);_0x4fb566[_0x423f('0x1b')]=_[_0x423f('0x1a')](_0x4fb566[_0x423f('0x2e')],_0x4fb566[_0x423f('0x19')]);_0x40571a[_0x423f('0x2d')]=_[_0x423f('0x1a')](_0x4fb566[_0x423f('0x2e')],qs[_0x423f('0x2f')](_0x1d280f['query'][_0x423f('0x2f')]));_0x40571a[_0x423f('0x2d')]=_0x40571a[_0x423f('0x2d')][_0x423f('0x30')]?_0x40571a[_0x423f('0x2d')]:_0x4fb566[_0x423f('0x2e')];if(_0x1d280f[_0x423f('0x19')][_0x423f('0x3a')]){_0x40571a[_0x423f('0x3b')]=[{'all':!![]}];}_0x40571a=_['merge']({},_0x40571a,_0x1d280f[_0x423f('0x38')]);return db['CmHopper'][_0x423f('0x40')](_0x40571a)[_0x423f('0xd')](handleEntityNotFound(_0x3464e3,null))[_0x423f('0xd')](respondWithResult(_0x3464e3,null))[_0x423f('0x3e')](handleError(_0x3464e3,null));};exports[_0x423f('0x41')]=function(_0x3ad48c,_0x3087e4){return db[_0x423f('0x39')][_0x423f('0x41')](_0x3ad48c[_0x423f('0x42')],{})[_0x423f('0xd')](respondWithResult(_0x3087e4,0xc9))[_0x423f('0x3e')](handleError(_0x3087e4,null));};exports[_0x423f('0xc')]=function(_0x350e11,_0xa7708c){if(_0x350e11[_0x423f('0x42')]['id']){delete _0x350e11[_0x423f('0x42')]['id'];}return db[_0x423f('0x39')][_0x423f('0x40')]({'where':{'id':_0x350e11[_0x423f('0x43')]['id']}})['then'](handleEntityNotFound(_0xa7708c,null))[_0x423f('0xd')](saveUpdates(_0x350e11['body'],null))[_0x423f('0xd')](respondWithResult(_0xa7708c,null))[_0x423f('0x3e')](handleError(_0xa7708c,null));};exports[_0x423f('0x44')]=function(_0x37035a,_0x57f5d6){return db[_0x423f('0x39')][_0x423f('0x44')]()[_0x423f('0xd')](respondWithResult(_0x57f5d6,null))[_0x423f('0x3e')](handleError(_0x57f5d6,null));};exports[_0x423f('0x45')]=function(_0x31b88e,_0x2dcbec){var _0x489894;var _0x1e2b9f=_0x31b88e[_0x423f('0x43')]['id'];return db['CmHopper'][_0x423f('0x40')]({'where':{'id':_0x31b88e['params']['id']}})[_0x423f('0xd')](handleEntityNotFound(_0x2dcbec,null))['then'](function(_0x56e907){if(_0x56e907){return _0x56e907[_0x423f('0x45')]()[_0x423f('0xd')](function(_0x1668d4){return _0x1668d4;});}})[_0x423f('0xd')](function(_0x545476){_0x489894=_0x545476;if(_0x545476){if(_0x545476[_0x423f('0x46')]||_0x545476['CampaignId']){return db[_0x545476[_0x423f('0x46')]?_0x423f('0x47'):_0x423f('0x48')][_0x423f('0x40')]({'where':{'id':_0x545476[_0x423f('0x46')]?_0x545476[_0x423f('0x46')]:_0x545476[_0x423f('0x49')]},'attributes':['id',_0x423f('0x11')],'raw':!![]});}}})[_0x423f('0xd')](function(_0x4e3003){var _0x104fd9={};if(_0x4e3003){_[_0x423f('0x37')](_0x104fd9,_['omit'](_0x489894[_0x423f('0x4a')],['createdAt',_0x423f('0x4b'),'id']));_0x104fd9[_0x423f('0x4c')]=0x15;_0x104fd9[_0x423f('0x4d')]=_0x423f('0x4e');_0x104fd9[_0x423f('0x4f')]=_0x4e3003[_0x423f('0x11')];_0x104fd9['membername']=_0x31b88e['user'][_0x423f('0x11')];_0x104fd9[_0x423f('0x50')]=_0x31b88e[_0x423f('0x51')]['id'];_0x104fd9[_0x423f('0x4e')]=!![];_0x104fd9[_0x423f('0x52')]=moment()[_0x423f('0x53')](_0x423f('0x54'));_0x104fd9[_0x423f('0x55')]=_0x489894[_0x423f('0x56')];_0x104fd9['campaigntype']=_0x489894[_0x423f('0x46')]?_0x423f('0x57'):'ivr';return db[_0x423f('0x58')]['find']({'where':{'id':_0x104fd9[_0x423f('0x59')]},'attributes':[_0x423f('0x5a'),_0x423f('0x5b')]})['then'](function(_0x5c39e4){if(!_[_0x423f('0x5c')](_0x2dcbec)&&!_[_0x423f('0x5c')](_0x5c39e4[_0x423f('0x5a')])){_0x104fd9['calleridname']=_0x5c39e4[_0x423f('0x5a')];if(!_[_0x423f('0x5c')](_0x5c39e4[_0x423f('0x5b')])){_0x104fd9[_0x423f('0x5d')]+='\x20'+_0x5c39e4[_0x423f('0x5b')];}}})[_0x423f('0x5e')](function(){return db[_0x423f('0x5f')]['create'](_0x104fd9);});}})[_0x423f('0xd')](function(_0x588483){return db[_0x423f('0x60')][_0x423f('0x45')]({'where':{'CmHopperId':_0x1e2b9f}});})[_0x423f('0xd')](function(){return _0x2dcbec[_0x423f('0x4')](0xcc)['end']();})[_0x423f('0x3e')](handleError(_0x2dcbec,null));};exports[_0x423f('0x61')]=function(_0x4c33c7,_0x5ae8a9){var _0xfe89a9=[];return db[_0x423f('0x58')]['describe']()[_0x423f('0xd')](function(_0x1897ff){_0xfe89a9=_['keys'](_0x1897ff);return _0x4c33c7['user']['getVoiceQueues']({'where':{'type':_0x423f('0x62'),'dialActive':!![],'dialMethod':_0x423f('0x63')},'attributes':['id',_0x423f('0x64'),_0x423f('0x65')],'raw':!![]});})['then'](function(_0x4fa0ef){if(_0x4fa0ef&&_0x4fa0ef[_0x423f('0x30')]){return db[_0x423f('0x66')]['transaction'](function(_0x43b569){var _0x13ed0b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x423f('0x53')](_0x423f('0x54'))},'VoiceQueueId':{'$in':_[_0x423f('0x14')](_0x4fa0ef,'id')},'$or':[{'UserId':null},{'UserId':_0x4c33c7[_0x423f('0x51')]['id']}]};var _0x116605={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4fa0ef)['filter']([_0x423f('0x65'),0x0])[_0x423f('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4c33c7[_0x423f('0x51')]['id']}]};var _0x223e8c={'$or':[_0x13ed0b,_0x116605]};var _0x3e5d47=[];if(_0x4c33c7['body'][_0x423f('0x67')]&&_0x4c33c7[_0x423f('0x42')][_0x423f('0x67')]===_0x423f('0x68')){if(!_[_0x423f('0x69')](_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')])){_0x223e8c['id']={'$in':_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')]};}_0x3e5d47=[['priority',_0x423f('0x6b')],[_0x423f('0x6c'),_0x4fa0ef[0x0][_0x423f('0x64')]===_0x423f('0x6b')?'DESC':_0x423f('0x6b')],db[_0x423f('0x66')][_0x423f('0x6d')](_0x423f('0x6e')),['id',_0x423f('0x6f')]];}else{if(!_[_0x423f('0x69')](_0x4c33c7[_0x423f('0x42')]['hopperIds'])){_0x223e8c['id']={'$notIn':_0x4c33c7[_0x423f('0x42')][_0x423f('0x6a')]};}_0x3e5d47=[[_0x423f('0x70'),_0x423f('0x6f')],['scheduledAt',_0x4fa0ef[0x0][_0x423f('0x64')]],db[_0x423f('0x66')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x423f('0x6b')]];}return db[_0x423f('0x39')][_0x423f('0x71')]({'attributes':['id','scheduledat',_0x423f('0x56'),_0x423f('0x72')],'where':_0x223e8c,'order':_0x3e5d47,'transaction':_0x43b569,'lock':_0x43b569[_0x423f('0x73')]['UPDATE'],'include':[{'model':db[_0x423f('0x58')],'as':_0x423f('0x74'),'attributes':_0xfe89a9,'include':[{'model':db[_0x423f('0x75')],'as':'Company','attributes':['id',_0x423f('0x11')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x423f('0x11')]},{'model':db[_0x423f('0x47')],'as':_0x423f('0x76'),'attributes':['id',_0x423f('0x11'),_0x423f('0x77')]}]})['then'](function(_0x29e60c){if(_0x29e60c){return _0x29e60c[_0x423f('0xc')]({'UserId':_0x4c33c7[_0x423f('0x51')]['id']},{'transaction':_0x43b569});}});});}})[_0x423f('0xd')](handleEntityNotFound(_0x5ae8a9,null))[_0x423f('0xd')](respondWithResult(_0x5ae8a9,null))[_0x423f('0x3e')](handleError(_0x5ae8a9,null));};exports[_0x423f('0x78')]=function(_0x5b9577,_0x4e1e04,_0xd9409e){var _0x320528=[];var _0xe76487=_0x5b9577[_0x423f('0x43')]['id'];var _0x3cffc3=_0x5b9577['user']['id'];return db[_0x423f('0x58')][_0x423f('0x44')]()[_0x423f('0xd')](function(_0x358ab3){_0x320528=_[_0x423f('0x18')](_0x358ab3);return db[_0x423f('0x66')][_0x423f('0x79')](function(_0x1db383){const _0x20bd00={'id':_0xe76487};return db[_0x423f('0x39')][_0x423f('0x71')]({'attributes':['id',_0x423f('0x7a'),_0x423f('0x72')],'where':_0x20bd00,'transaction':_0x1db383,'lock':_0x1db383['LOCK'][_0x423f('0x7b')],'include':[{'model':db[_0x423f('0x58')],'as':_0x423f('0x74'),'attributes':_0x320528,'include':[{'model':db[_0x423f('0x75')],'as':_0x423f('0x7c'),'attributes':['id','name']}]},{'model':db[_0x423f('0x7d')],'as':_0x423f('0x7e'),'attributes':['id',_0x423f('0x11')]},{'model':db[_0x423f('0x47')],'as':'Queue','attributes':['id',_0x423f('0x11'),_0x423f('0x77')]}]})[_0x423f('0xd')](function(_0x3832b6){if(_0x3832b6){return _0x3832b6[_0x423f('0xc')]({'UserId':_0x3cffc3},{'transaction':_0x1db383});}});});})[_0x423f('0xd')](handleEntityNotFound(_0x4e1e04,null))[_0x423f('0xd')](respondWithResult(_0x4e1e04,null))[_0x423f('0x3e')](handleError(_0x4e1e04,null));};exports[_0x423f('0x7f')]=function(_0x22f2af,_0x3c78c7){return _0x22f2af[_0x423f('0x51')][_0x423f('0x80')]({'where':{'type':_0x423f('0x62'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x423f('0xd')](function(_0x5333b7){if(_0x5333b7&&_0x5333b7['length']){return db[_0x423f('0x39')][_0x423f('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x423f('0x53')](_0x423f('0x54'))},'VoiceQueueId':{'$in':_['map'](_0x5333b7,'id')},'$or':[{'UserId':null},{'UserId':_0x22f2af[_0x423f('0x51')]['id']}]}});}return 0x0;})['then'](function(_0xf18525){if(!_[_0x423f('0x5c')](_0xf18525)&&_[_0x423f('0x81')](_0xf18525)){return _0x3c78c7[_0x423f('0x4')](0xc8)[_0x423f('0x5')]({'contacts':_0xf18525});}else{logger['error'](_0x423f('0x82'),'getOpenContacts',0x194,_0x423f('0x83'));_0x3c78c7['sendStatus'](0x194);}})[_0x423f('0x3e')](handleError(_0x3c78c7,null));};exports[_0x423f('0x84')]=function(_0x1990ec,_0x5697e8){var _0xbcf529=shared[_0x423f('0x85')];var _0x3ecfd5=[];_[_0x423f('0x14')](_0xbcf529,function(_0x5baf51){_0x3ecfd5[_0x423f('0x86')]({'id':_0x5baf51[_0x423f('0x11')],'name':_0x5baf51['name'],'utcOffset':_0x5baf51[_0x423f('0x87')]});});return _0x5697e8[_0x423f('0x4')](0xc8)[_0x423f('0x5')]({'tz':_0x3ecfd5});};exports[_0x423f('0x88')]=function(_0x36241e,_0x2bb2ba){var _0x140db1=shared[_0x423f('0x85')];var _0x2ede33={};if(!_[_0x423f('0x5c')](_0x140db1[_0x36241e['body']['id']]))_0x2ede33=_0x140db1[_0x36241e['body']['id']];return _0x2bb2ba[_0x423f('0x4')](0xc8)['json'](_0x2ede33);}; \ No newline at end of file +var _0x56e7=['index','CmHopper','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$notILike','$overlap','$contained','$any','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','YYYY-MM-DD\x20HH:mm:ss','dialPreviewAutoRecallMe','direction','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','List','VoiceQueue','dialActive','getPreviewRecall','transaction','CmCompany','Company','CmList','Queue','getOpenContacts','isNumber','json','error','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','undefined','count','offset','limit','set','update','then','sendStatus','stack','name','send'];(function(_0x5d722c,_0x5534e1){var _0x13f2a8=function(_0x417eb2){while(--_0x417eb2){_0x5d722c['push'](_0x5d722c['shift']());}};_0x13f2a8(++_0x5534e1);}(_0x56e7,0x7b));var _0x756e=function(_0x3ec380,_0x4dfdfe){_0x3ec380=_0x3ec380-0x0;var _0xb7210a=_0x56e7[_0x3ec380];return _0xb7210a;};'use strict';var moment=require('moment');var _=require(_0x756e('0x0'));var qs=require(_0x756e('0x1'));var logger=require('../../config/logger')(_0x756e('0x2'));var shared=require(_0x756e('0x3'));var db=require(_0x756e('0x4'))['db'];function respondWithResult(_0xb850c9,_0x11ce5f){_0x11ce5f=_0x11ce5f||0xc8;return function(_0x38546a){if(_0x38546a){return _0xb850c9[_0x756e('0x5')](_0x11ce5f)['json'](_0x38546a);}};}function respondWithFilteredResult(_0x3b3b8f,_0x404189){return function(_0x26519d){if(_0x26519d){var _0xcf58ec=typeof _0x404189['offset']===_0x756e('0x6')&&typeof _0x404189['limit']===_0x756e('0x6');var _0x401181=_0x26519d[_0x756e('0x7')];var _0x4738dc=_0xcf58ec?0x0:_0x404189['offset'];var _0x5d5b90=_0xcf58ec?_0x26519d[_0x756e('0x7')]:_0x404189[_0x756e('0x8')]+_0x404189[_0x756e('0x9')];var _0x4c4d7c;if(_0x5d5b90>=_0x401181){_0x5d5b90=_0x401181;_0x4c4d7c=0xc8;}else{_0x4c4d7c=0xce;}_0x3b3b8f[_0x756e('0x5')](_0x4c4d7c);return _0x3b3b8f[_0x756e('0xa')]('Content-Range',_0x4738dc+'-'+_0x5d5b90+'/'+_0x401181)['json'](_0x26519d);}return null;};}function saveUpdates(_0x1b68ef,_0x569e8f){return function(_0x459237){if(_0x459237){return _0x459237[_0x756e('0xb')](_0x1b68ef)[_0x756e('0xc')](function(_0x136052){return _0x136052;});}return null;};}function handleEntityNotFound(_0x252333,_0x4ae32a){return function(_0x4b3660){if(!_0x4b3660){_0x252333[_0x756e('0xd')](0x194);}return _0x4b3660;};}function handleError(_0x11f37b,_0xccccd4){_0xccccd4=_0xccccd4||0x1f4;return function(_0x59956f){logger['error'](_0x59956f[_0x756e('0xe')]);if(_0x59956f[_0x756e('0xf')]){delete _0x59956f[_0x756e('0xf')];}_0x11f37b[_0x756e('0x5')](_0xccccd4)[_0x756e('0x10')](_0x59956f);};}exports[_0x756e('0x11')]=function(_0x124ac0,_0x1a8614){var _0xb17214={},_0x4da91f={},_0x216ffd={'count':0x0,'rows':[]};var _0x47c3c4=_['map'](db[_0x756e('0x12')][_0x756e('0x13')],function(_0x30bc11){return{'name':_0x30bc11[_0x756e('0x14')],'type':_0x30bc11[_0x756e('0x15')][_0x756e('0x16')]};});_0x4da91f[_0x756e('0x17')]=_[_0x756e('0x18')](_0x47c3c4,_0x756e('0xf'));_0x4da91f[_0x756e('0x19')]=_[_0x756e('0x1a')](_0x124ac0[_0x756e('0x19')]);_0x4da91f[_0x756e('0x1b')]=_[_0x756e('0x1c')](_0x4da91f[_0x756e('0x17')],_0x4da91f[_0x756e('0x19')]);_0x4da91f['filters']=_[_0x756e('0x1d')](_0x4da91f['filters'],[_0x756e('0x1e'),_0x756e('0x1f'),_0x756e('0x20'),_0x756e('0x21'),'$lt',_0x756e('0x22'),_0x756e('0x23'),_0x756e('0x24'),'$not',_0x756e('0x25'),_0x756e('0x26'),_0x756e('0x27'),'$notIn',_0x756e('0x28'),_0x756e('0x29'),'$iLike',_0x756e('0x2a'),_0x756e('0x28'),_0x756e('0x2b'),'$contains',_0x756e('0x2c'),_0x756e('0x2d')]);_0xb17214['attributes']=_[_0x756e('0x1c')](_0x4da91f[_0x756e('0x17')],qs['fields'](_0x124ac0[_0x756e('0x19')][_0x756e('0x2e')]));_0xb17214[_0x756e('0x2f')]=_0xb17214[_0x756e('0x2f')][_0x756e('0x30')]?_0xb17214['attributes']:_0x4da91f[_0x756e('0x17')];if(!_0x124ac0['query']['hasOwnProperty'](_0x756e('0x31'))){_0xb17214['limit']=qs[_0x756e('0x9')](_0x124ac0[_0x756e('0x19')][_0x756e('0x9')]);_0xb17214[_0x756e('0x8')]=qs[_0x756e('0x8')](_0x124ac0[_0x756e('0x19')][_0x756e('0x8')]);}_0xb17214[_0x756e('0x32')]=qs[_0x756e('0x33')](_0x124ac0[_0x756e('0x19')][_0x756e('0x33')]);_0xb17214[_0x756e('0x34')]=qs['filters'](_['pick'](_0x124ac0[_0x756e('0x19')],_0x4da91f[_0x756e('0x1b')]),_0x47c3c4);if(_0x124ac0[_0x756e('0x19')][_0x756e('0x35')]){_0xb17214[_0x756e('0x34')]=_[_0x756e('0x36')](_0xb17214[_0x756e('0x34')],{'$or':_['map'](_0x47c3c4,function(_0x5b2b59){if(_0x5b2b59['type']!==_0x756e('0x37')){var _0xa63bf={};_0xa63bf[_0x5b2b59[_0x756e('0xf')]]={'$like':'%'+_0x124ac0['query'][_0x756e('0x35')]+'%'};return _0xa63bf;}})});}_0xb17214=_[_0x756e('0x36')]({},_0xb17214,_0x124ac0['options']);var _0x3ece0f={'where':_0xb17214[_0x756e('0x34')]};return db[_0x756e('0x12')][_0x756e('0x7')](_0x3ece0f)[_0x756e('0xc')](function(_0x26965c){_0x216ffd[_0x756e('0x7')]=_0x26965c;if(_0x124ac0[_0x756e('0x19')]['includeAll']){_0xb17214[_0x756e('0x38')]=[{'all':!![]}];}return db[_0x756e('0x12')][_0x756e('0x39')](_0xb17214);})[_0x756e('0xc')](function(_0x36b7de){_0x216ffd[_0x756e('0x3a')]=_0x36b7de;return _0x216ffd;})[_0x756e('0xc')](respondWithFilteredResult(_0x1a8614,_0xb17214))[_0x756e('0x3b')](handleError(_0x1a8614,null));};exports[_0x756e('0x3c')]=function(_0x64b70d,_0x5bb3bd){var _0x41a100={'raw':!![],'where':{'id':_0x64b70d['params']['id']}},_0x38274c={};_0x38274c[_0x756e('0x17')]=_[_0x756e('0x1a')](db[_0x756e('0x12')]['rawAttributes']);_0x38274c[_0x756e('0x19')]=_[_0x756e('0x1a')](_0x64b70d[_0x756e('0x19')]);_0x38274c['filters']=_[_0x756e('0x1c')](_0x38274c[_0x756e('0x17')],_0x38274c[_0x756e('0x19')]);_0x41a100[_0x756e('0x2f')]=_[_0x756e('0x1c')](_0x38274c[_0x756e('0x17')],qs['fields'](_0x64b70d[_0x756e('0x19')][_0x756e('0x2e')]));_0x41a100['attributes']=_0x41a100[_0x756e('0x2f')][_0x756e('0x30')]?_0x41a100[_0x756e('0x2f')]:_0x38274c[_0x756e('0x17')];if(_0x64b70d[_0x756e('0x19')][_0x756e('0x3d')]){_0x41a100[_0x756e('0x38')]=[{'all':!![]}];}_0x41a100=_[_0x756e('0x36')]({},_0x41a100,_0x64b70d[_0x756e('0x3e')]);return db['CmHopper'][_0x756e('0x3f')](_0x41a100)['then'](handleEntityNotFound(_0x5bb3bd,null))[_0x756e('0xc')](respondWithResult(_0x5bb3bd,null))[_0x756e('0x3b')](handleError(_0x5bb3bd,null));};exports[_0x756e('0x40')]=function(_0x54248c,_0x3fc697){return db[_0x756e('0x12')][_0x756e('0x40')](_0x54248c['body'],{})['then'](respondWithResult(_0x3fc697,0xc9))[_0x756e('0x3b')](handleError(_0x3fc697,null));};exports[_0x756e('0xb')]=function(_0x5a6d3e,_0x499da2){if(_0x5a6d3e[_0x756e('0x41')]['id']){delete _0x5a6d3e[_0x756e('0x41')]['id'];}return db[_0x756e('0x12')]['find']({'where':{'id':_0x5a6d3e[_0x756e('0x42')]['id']}})['then'](handleEntityNotFound(_0x499da2,null))[_0x756e('0xc')](saveUpdates(_0x5a6d3e[_0x756e('0x41')],null))[_0x756e('0xc')](respondWithResult(_0x499da2,null))['catch'](handleError(_0x499da2,null));};exports[_0x756e('0x43')]=function(_0x5224f2,_0x5064a3){return db[_0x756e('0x12')]['describe']()[_0x756e('0xc')](respondWithResult(_0x5064a3,null))[_0x756e('0x3b')](handleError(_0x5064a3,null));};exports[_0x756e('0x44')]=function(_0x2512d3,_0x95061c){var _0x2fb384;var _0x50b86e=_0x2512d3[_0x756e('0x42')]['id'];return db['CmHopper'][_0x756e('0x3f')]({'where':{'id':_0x2512d3['params']['id']}})[_0x756e('0xc')](handleEntityNotFound(_0x95061c,null))['then'](function(_0x2f08d5){if(_0x2f08d5){return _0x2f08d5['destroy']()[_0x756e('0xc')](function(_0x37ddd0){return _0x37ddd0;});}})[_0x756e('0xc')](function(_0x52c976){_0x2fb384=_0x52c976;if(_0x52c976){if(_0x52c976[_0x756e('0x45')]||_0x52c976[_0x756e('0x46')]){return db[_0x52c976['VoiceQueueId']?'VoiceQueue':_0x756e('0x47')][_0x756e('0x3f')]({'where':{'id':_0x52c976[_0x756e('0x45')]?_0x52c976[_0x756e('0x45')]:_0x52c976[_0x756e('0x46')]},'attributes':['id',_0x756e('0xf')],'raw':!![]});}}})[_0x756e('0xc')](function(_0x9e8559){var _0x33f923={};if(_0x9e8559){_['merge'](_0x33f923,_[_0x756e('0x48')](_0x2fb384[_0x756e('0x49')],[_0x756e('0x4a'),_0x756e('0x4b'),'id']));_0x33f923[_0x756e('0x4c')]=0x15;_0x33f923[_0x756e('0x4d')]=_0x756e('0x4e');_0x33f923[_0x756e('0x4f')]=_0x9e8559['name'];_0x33f923[_0x756e('0x50')]=_0x2512d3[_0x756e('0x51')]['name'];_0x33f923[_0x756e('0x52')]=_0x2512d3['user']['id'];_0x33f923[_0x756e('0x4e')]=!![];_0x33f923[_0x756e('0x53')]=moment()[_0x756e('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x33f923[_0x756e('0x55')]=_0x2fb384[_0x756e('0x56')];_0x33f923[_0x756e('0x57')]=_0x2fb384['VoiceQueueId']?_0x756e('0x58'):'ivr';return db[_0x756e('0x59')][_0x756e('0x3f')]({'where':{'id':_0x33f923[_0x756e('0x5a')]},'attributes':[_0x756e('0x5b'),_0x756e('0x5c')]})[_0x756e('0xc')](function(_0x1f0be1){if(!_[_0x756e('0x5d')](_0x95061c)&&!_['isNil'](_0x1f0be1[_0x756e('0x5b')])){_0x33f923[_0x756e('0x5e')]=_0x1f0be1[_0x756e('0x5b')];if(!_[_0x756e('0x5d')](_0x1f0be1[_0x756e('0x5c')])){_0x33f923[_0x756e('0x5e')]+='\x20'+_0x1f0be1[_0x756e('0x5c')];}}})[_0x756e('0x5f')](function(){return db[_0x756e('0x60')][_0x756e('0x40')](_0x33f923);});}})[_0x756e('0xc')](function(_0x176d84){return db[_0x756e('0x61')][_0x756e('0x44')]({'where':{'CmHopperId':_0x50b86e}});})['then'](function(){return _0x95061c[_0x756e('0x5')](0xcc)[_0x756e('0x62')]();})[_0x756e('0x3b')](handleError(_0x95061c,null));};exports[_0x756e('0x63')]=function(_0x674b74,_0xe91378){var _0x58198e=[];return db[_0x756e('0x59')][_0x756e('0x43')]()[_0x756e('0xc')](function(_0x3c5976){_0x58198e=_['keys'](_0x3c5976);return _0x674b74['user'][_0x756e('0x64')]({'where':{'type':_0x756e('0x65'),'dialActive':!![],'dialMethod':_0x756e('0x66')},'attributes':['id',_0x756e('0x67'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x756e('0xc')](function(_0x312715){if(_0x312715&&_0x312715[_0x756e('0x30')]){return db[_0x756e('0x68')]['transaction'](function(_0x5c580b){var _0x207228={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x756e('0x54')](_0x756e('0x69'))},'VoiceQueueId':{'$in':_[_0x756e('0x18')](_0x312715,'id')},'$or':[{'UserId':null},{'UserId':_0x674b74[_0x756e('0x51')]['id']}]};var _0x366dfe={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x312715)[_0x756e('0x35')]([_0x756e('0x6a'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x674b74[_0x756e('0x51')]['id']}]};var _0x86477e={'$or':[_0x207228,_0x366dfe]};var _0x4740ae=[];if(_0x674b74[_0x756e('0x41')][_0x756e('0x6b')]&&_0x674b74[_0x756e('0x41')][_0x756e('0x6b')]==='prev'){if(!_[_0x756e('0x6c')](_0x674b74['body'][_0x756e('0x6d')])){_0x86477e['id']={'$in':_0x674b74['body'][_0x756e('0x6d')]};}_0x4740ae=[[_0x756e('0x6e'),_0x756e('0x6f')],['scheduledAt',_0x312715[0x0][_0x756e('0x67')]===_0x756e('0x6f')?_0x756e('0x70'):_0x756e('0x6f')],db[_0x756e('0x68')][_0x756e('0x71')](_0x756e('0x72')),['id','DESC']];}else{if(!_['isEmpty'](_0x674b74[_0x756e('0x41')][_0x756e('0x6d')])){_0x86477e['id']={'$notIn':_0x674b74[_0x756e('0x41')][_0x756e('0x6d')]};}_0x4740ae=[[_0x756e('0x6e'),_0x756e('0x70')],['scheduledAt',_0x312715[0x0][_0x756e('0x67')]],db[_0x756e('0x68')][_0x756e('0x71')](_0x756e('0x73')),['id',_0x756e('0x6f')]];}return db[_0x756e('0x12')][_0x756e('0x74')]({'attributes':['id',_0x756e('0x75'),'phone',_0x756e('0x76')],'where':_0x86477e,'order':_0x4740ae,'transaction':_0x5c580b,'lock':_0x5c580b[_0x756e('0x77')][_0x756e('0x78')],'include':[{'model':db[_0x756e('0x59')],'as':_0x756e('0x79'),'attributes':_0x58198e,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x756e('0xf')]}]},{'model':db['CmList'],'as':_0x756e('0x7a'),'attributes':['id','name']},{'model':db[_0x756e('0x7b')],'as':'Queue','attributes':['id',_0x756e('0xf'),_0x756e('0x7c')]}]})[_0x756e('0xc')](function(_0x4afbc4){if(_0x4afbc4){return _0x4afbc4[_0x756e('0xb')]({'UserId':_0x674b74['user']['id']},{'transaction':_0x5c580b});}});});}})[_0x756e('0xc')](handleEntityNotFound(_0xe91378,null))[_0x756e('0xc')](respondWithResult(_0xe91378,null))[_0x756e('0x3b')](handleError(_0xe91378,null));};exports[_0x756e('0x7d')]=function(_0x53b551,_0x3b5d8e,_0x38c0c7){var _0x5b087a=[];var _0xe3e3b6=_0x53b551[_0x756e('0x42')]['id'];var _0x5d690a=_0x53b551[_0x756e('0x51')]['id'];return db['CmContact']['describe']()[_0x756e('0xc')](function(_0x50728b){_0x5b087a=_[_0x756e('0x1a')](_0x50728b);return db['sequelize'][_0x756e('0x7e')](function(_0x51a2ec){const _0x4456c0={'id':_0xe3e3b6};return db[_0x756e('0x12')][_0x756e('0x74')]({'attributes':['id',_0x756e('0x75'),_0x756e('0x76')],'where':_0x4456c0,'transaction':_0x51a2ec,'lock':_0x51a2ec[_0x756e('0x77')][_0x756e('0x78')],'include':[{'model':db[_0x756e('0x59')],'as':_0x756e('0x79'),'attributes':_0x5b087a,'include':[{'model':db[_0x756e('0x7f')],'as':_0x756e('0x80'),'attributes':['id',_0x756e('0xf')]}]},{'model':db[_0x756e('0x81')],'as':'List','attributes':['id','name']},{'model':db[_0x756e('0x7b')],'as':_0x756e('0x82'),'attributes':['id',_0x756e('0xf'),_0x756e('0x7c')]}]})[_0x756e('0xc')](function(_0x18df88){if(_0x18df88){return _0x18df88[_0x756e('0xb')]({'UserId':_0x5d690a},{'transaction':_0x51a2ec});}});});})['then'](handleEntityNotFound(_0x3b5d8e,null))[_0x756e('0xc')](respondWithResult(_0x3b5d8e,null))[_0x756e('0x3b')](handleError(_0x3b5d8e,null));};exports[_0x756e('0x83')]=function(_0x421a80,_0xcfaaba){return _0x421a80['user'][_0x756e('0x64')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x756e('0xc')](function(_0x48b8e8){if(_0x48b8e8&&_0x48b8e8[_0x756e('0x30')]){return db[_0x756e('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x756e('0x54')](_0x756e('0x69'))},'VoiceQueueId':{'$in':_[_0x756e('0x18')](_0x48b8e8,'id')},'$or':[{'UserId':null},{'UserId':_0x421a80[_0x756e('0x51')]['id']}]}});}return 0x0;})[_0x756e('0xc')](function(_0x5aeb07){if(!_[_0x756e('0x5d')](_0x5aeb07)&&_[_0x756e('0x84')](_0x5aeb07)){return _0xcfaaba[_0x756e('0x5')](0xc8)[_0x756e('0x85')]({'contacts':_0x5aeb07});}else{logger[_0x756e('0x86')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,'entity\x20not\x20found');_0xcfaaba[_0x756e('0xd')](0x194);}})['catch'](handleError(_0xcfaaba,null));};exports[_0x756e('0x87')]=function(_0x1e5942,_0x23127a){var _0x4e31a8=shared[_0x756e('0x88')];var _0x5d7bd8=[];_[_0x756e('0x18')](_0x4e31a8,function(_0x59cdd4){_0x5d7bd8[_0x756e('0x89')]({'id':_0x59cdd4[_0x756e('0xf')],'name':_0x59cdd4[_0x756e('0xf')],'utcOffset':_0x59cdd4[_0x756e('0x8a')]});});return _0x23127a[_0x756e('0x5')](0xc8)[_0x756e('0x85')]({'tz':_0x5d7bd8});};exports[_0x756e('0x8b')]=function(_0x3e72d6,_0x3b1b92){var _0x51dc21=shared[_0x756e('0x88')];var _0x3b4d66={};if(!_[_0x756e('0x5d')](_0x51dc21[_0x3e72d6[_0x756e('0x41')]['id']]))_0x3b4d66=_0x51dc21[_0x3e72d6[_0x756e('0x41')]['id']];return _0x3b1b92[_0x756e('0x5')](0xc8)[_0x756e('0x85')](_0x3b4d66);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 6795258..752d9a2 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 _0x5d17=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0xb68b7a,_0x559383){var _0x5dee58=function(_0x35e9c6){while(--_0x35e9c6){_0xb68b7a['push'](_0xb68b7a['shift']());}};_0x5dee58(++_0x559383);}(_0x5d17,0x114));var _0x75d1=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x5d17[_0x11155f];return _0xd07e48;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[{'name':_0x75d1('0xc'),'fields':[_0x75d1('0xc')]},{'name':_0x75d1('0xd'),'fields':['phone']},{'name':'priority','fields':[_0x75d1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xabce,0x103));var _0xeabc=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xabce[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0173a83..de3dc0f 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 _0xc819=['Agent','name','voicePause','UserId','push','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','options','raw','where','attributes','map','include','model','debug','catch','ShowCmHopper','body','CreateCmHopper','update','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys'];(function(_0x48c9a9,_0x59c488){var _0xada59a=function(_0x48bc3e){while(--_0x48bc3e){_0x48c9a9['push'](_0x48c9a9['shift']());}};_0xada59a(++_0x59c488);}(_0xc819,0xcd));var _0x9c81=function(_0x1629a2,_0x177b1b){_0x1629a2=_0x1629a2-0x0;var _0x3cdcfc=_0xc819[_0x1629a2];return _0x3cdcfc;};'use strict';var _=require(_0x9c81('0x0'));var util=require(_0x9c81('0x1'));var moment=require(_0x9c81('0x2'));var BPromise=require(_0x9c81('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x9c81('0x4'))(_0x9c81('0x5'));var jayson=require(_0x9c81('0x6'));var client=jayson[_0x9c81('0x7')][_0x9c81('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x569c76,_0x3c87e0,_0x578c44){return new BPromise(function(_0x523496,_0x5bc9d4){return client[_0x9c81('0x9')](_0x569c76,_0x578c44)[_0x9c81('0xa')](function(_0x243552){logger[_0x9c81('0xb')](_0x9c81('0xc'),_0x3c87e0,_0x9c81('0xd'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x3c87e0,_0x9c81('0xd'),JSON[_0x9c81('0xe')](_0x243552));if(_0x243552[_0x9c81('0xf')]){if(_0x243552[_0x9c81('0xf')]['code']===0x1f4){logger[_0x9c81('0xf')](_0x9c81('0xc'),_0x3c87e0,_0x243552['error'][_0x9c81('0x10')]);return _0x5bc9d4(_0x243552[_0x9c81('0xf')][_0x9c81('0x10')]);}logger['error'](_0x9c81('0xc'),_0x3c87e0,_0x243552[_0x9c81('0xf')]['message']);return _0x523496(_0x243552[_0x9c81('0xf')][_0x9c81('0x10')]);}else{logger[_0x9c81('0xb')](_0x9c81('0xc'),_0x3c87e0,_0x9c81('0xd'));_0x523496(_0x243552[_0x9c81('0x11')][_0x9c81('0x10')]);}})['catch'](function(_0x1d0988){logger['error'](_0x9c81('0xc'),_0x3c87e0,_0x1d0988);_0x5bc9d4(_0x1d0988);});});}exports[_0x9c81('0x12')]=function(_0x5e4884){var _0x48b8a1=this;return new Promise(function(_0x5516b3,_0x363bc2){return db[_0x9c81('0x13')]['findAll']({'raw':_0x5e4884[_0x9c81('0x14')]?_0x5e4884[_0x9c81('0x14')][_0x9c81('0x15')]===undefined?!![]:![]:!![],'where':_0x5e4884['options']?_0x5e4884[_0x9c81('0x14')][_0x9c81('0x16')]||null:null,'attributes':_0x5e4884[_0x9c81('0x14')]?_0x5e4884[_0x9c81('0x14')][_0x9c81('0x17')]||null:null,'limit':_0x5e4884[_0x9c81('0x14')]?_0x5e4884[_0x9c81('0x14')]['limit']||null:null,'include':_0x5e4884[_0x9c81('0x14')]?_0x5e4884['options']['include']?_[_0x9c81('0x18')](_0x5e4884[_0x9c81('0x14')][_0x9c81('0x19')],function(_0x4fb195){return{'model':db[_0x4fb195[_0x9c81('0x1a')]],'as':_0x4fb195['as'],'attributes':_0x4fb195[_0x9c81('0x17')],'include':_0x4fb195[_0x9c81('0x19')]?_[_0x9c81('0x18')](_0x4fb195['include'],function(_0x83134c){return{'model':db[_0x83134c[_0x9c81('0x1a')]],'as':_0x83134c['as'],'attributes':_0x83134c[_0x9c81('0x17')],'include':_0x83134c['include']?_[_0x9c81('0x18')](_0x83134c[_0x9c81('0x19')],function(_0x26db1f){return{'model':db[_0x26db1f[_0x9c81('0x1a')]],'as':_0x26db1f['as'],'attributes':_0x26db1f[_0x9c81('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9c81('0xa')](function(_0x1d2c4){logger[_0x9c81('0xb')](_0x9c81('0x12'),_0x5e4884);logger[_0x9c81('0x1b')](_0x9c81('0x12'),_0x5e4884,JSON[_0x9c81('0xe')](_0x1d2c4));_0x5516b3(_0x1d2c4);})[_0x9c81('0x1c')](function(_0x55d7f0){logger[_0x9c81('0xf')]('GetCmHopper',_0x55d7f0['message'],_0x5e4884);_0x363bc2(_0x48b8a1[_0x9c81('0xf')](0x1f4,_0x55d7f0[_0x9c81('0x10')]));});});};exports['ShowCmHopper']=function(_0x2f3f4f){var _0x2d5541=this;return new Promise(function(_0x2ce1c4,_0x4712cd){return db[_0x9c81('0x13')]['find']({'raw':_0x2f3f4f[_0x9c81('0x14')]?_0x2f3f4f['options'][_0x9c81('0x15')]===undefined?!![]:![]:!![],'where':_0x2f3f4f[_0x9c81('0x14')]?_0x2f3f4f[_0x9c81('0x14')][_0x9c81('0x16')]||null:null,'attributes':_0x2f3f4f[_0x9c81('0x14')]?_0x2f3f4f[_0x9c81('0x14')][_0x9c81('0x17')]||null:null,'include':_0x2f3f4f['options']?_0x2f3f4f[_0x9c81('0x14')]['include']?_[_0x9c81('0x18')](_0x2f3f4f[_0x9c81('0x14')][_0x9c81('0x19')],function(_0x4ec41f){return{'model':db[_0x4ec41f[_0x9c81('0x1a')]],'as':_0x4ec41f['as'],'attributes':_0x4ec41f[_0x9c81('0x17')],'include':_0x4ec41f['include']?_[_0x9c81('0x18')](_0x4ec41f[_0x9c81('0x19')],function(_0x23a18b){return{'model':db[_0x23a18b[_0x9c81('0x1a')]],'as':_0x23a18b['as'],'attributes':_0x23a18b[_0x9c81('0x17')],'include':_0x23a18b[_0x9c81('0x19')]?_[_0x9c81('0x18')](_0x23a18b[_0x9c81('0x19')],function(_0x2aa057){return{'model':db[_0x2aa057[_0x9c81('0x1a')]],'as':_0x2aa057['as'],'attributes':_0x2aa057['attributes']};}):[]};}):[]};}):[]:[]})[_0x9c81('0xa')](function(_0x1c13cc){logger[_0x9c81('0xb')](_0x9c81('0x1d'),_0x2f3f4f);logger[_0x9c81('0x1b')](_0x9c81('0x1d'),_0x2f3f4f,JSON[_0x9c81('0xe')](_0x1c13cc));_0x2ce1c4(_0x1c13cc);})['catch'](function(_0x552c6b){logger[_0x9c81('0xf')](_0x9c81('0x1d'),_0x552c6b[_0x9c81('0x10')],_0x2f3f4f);_0x4712cd(_0x2d5541[_0x9c81('0xf')](0x1f4,_0x552c6b['message']));});});};exports['CreateCmHopper']=function(_0x2f2d99){var _0x11797e=this;return new Promise(function(_0x4979c7,_0x44d94f){return db[_0x9c81('0x13')]['create'](_0x2f2d99[_0x9c81('0x1e')],{'raw':_0x2f2d99[_0x9c81('0x14')]?_0x2f2d99[_0x9c81('0x14')][_0x9c81('0x15')]===undefined?!![]:![]:!![]})[_0x9c81('0xa')](function(_0xd38624){logger[_0x9c81('0xb')](_0x9c81('0x1f'),_0x2f2d99);logger[_0x9c81('0x1b')]('CreateCmHopper',_0x2f2d99,JSON[_0x9c81('0xe')](_0xd38624));_0x4979c7(_0xd38624);})[_0x9c81('0x1c')](function(_0x4b92ed){logger[_0x9c81('0xf')]('CreateCmHopper',_0x4b92ed[_0x9c81('0x10')],_0x2f2d99);_0x44d94f(_0x11797e[_0x9c81('0xf')](0x1f4,_0x4b92ed[_0x9c81('0x10')]));});});};exports['UpdateCmHopper']=function(_0x212437){var _0x28c831=this;return new Promise(function(_0x2de412,_0x150a5c){return db['CmHopper'][_0x9c81('0x20')](_0x212437['body'],{'raw':_0x212437[_0x9c81('0x14')]?_0x212437[_0x9c81('0x14')][_0x9c81('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x212437[_0x9c81('0x14')]?_0x212437['options'][_0x9c81('0x16')]||null:null,'attributes':_0x212437[_0x9c81('0x14')]?_0x212437[_0x9c81('0x14')]['attributes']||null:null,'limit':_0x212437[_0x9c81('0x14')]?_0x212437['options'][_0x9c81('0x21')]||null:null})[_0x9c81('0xa')](function(_0x38f0f0){logger['info'](_0x9c81('0x22'),_0x212437);logger[_0x9c81('0xb')](_0x9c81('0x23'),JSON['stringify'](_0x212437[_0x9c81('0x14')]['where']),_0x212437[_0x9c81('0x1e')][_0x9c81('0x24')]);logger['debug']('UpdateCmHopper',_0x212437,JSON['stringify'](_0x38f0f0));_0x2de412(_0x38f0f0);})[_0x9c81('0x1c')](function(_0xb8af28){logger[_0x9c81('0xf')](_0x9c81('0x22'),_0xb8af28[_0x9c81('0x10')],_0x212437);_0x150a5c(_0x28c831[_0x9c81('0xf')](0x1f4,_0xb8af28['message']));});});};exports[_0x9c81('0x25')]=function(_0x54600b){var _0x35aff1=this;return new Promise(function(_0xc36a03,_0x2937f3){return db[_0x9c81('0x13')][_0x9c81('0x26')]({'where':_0x54600b['options']?_0x54600b[_0x9c81('0x14')][_0x9c81('0x16')]||null:null})[_0x9c81('0xa')](function(_0x360e9b){logger[_0x9c81('0xb')](_0x9c81('0x25'),_0x54600b);logger[_0x9c81('0x1b')](_0x9c81('0x25'),_0x54600b,JSON[_0x9c81('0xe')](_0x360e9b));_0xc36a03(_0x360e9b);})['catch'](function(_0x5cf35e){logger['error'](_0x9c81('0x25'),_0x5cf35e[_0x9c81('0x10')],_0x54600b);_0x2937f3(_0x35aff1['error'](0x1f4,_0x5cf35e[_0x9c81('0x10')]));});});};exports[_0x9c81('0x27')]=function(_0x52883d){var _0x53a29a=this;return new Promise(function(_0xbda4bf,_0x47ead2){return db[_0x9c81('0x28')][_0x9c81('0x29')]()[_0x9c81('0xa')](function(_0x2b860a){return db[_0x9c81('0x2a')][_0x9c81('0x2b')](function(_0x35847f){return db[_0x9c81('0x13')][_0x9c81('0x2c')]({'where':_0x52883d[_0x9c81('0x14')]?_0x52883d[_0x9c81('0x14')][_0x9c81('0x16')]||null:null,'attributes':_0x52883d[_0x9c81('0x14')]?_0x52883d[_0x9c81('0x14')][_0x9c81('0x17')]||null:null,'limit':_0x52883d[_0x9c81('0x14')]?_0x52883d[_0x9c81('0x14')][_0x9c81('0x21')]||null:null,'order':_0x52883d[_0x9c81('0x14')]?_0x52883d[_0x9c81('0x14')][_0x9c81('0x2d')]||null:null,'transaction':_0x35847f,'lock':_0x35847f[_0x9c81('0x2e')][_0x9c81('0x2f')],'include':[{'model':db['CmContact'],'as':_0x9c81('0x30'),'attributes':_[_0x9c81('0x31')](_0x2b860a)},{'model':db['User'],'as':_0x9c81('0x32'),'attributes':['id',_0x9c81('0x33'),_0x9c81('0x34')]}]})[_0x9c81('0xa')](function(_0x297de4){var _0x5da89d=[];var _0x34225b=[];for(var _0x3e5e55=0x0;_0x3e5e55<_0x297de4['length'];_0x3e5e55+=0x1){var _0x5c9d4a=_0x297de4[_0x3e5e55][_0x9c81('0x35')];if(_0x5c9d4a===null){_0x5da89d[_0x9c81('0x36')](_0x297de4[_0x3e5e55][_0x9c81('0x20')](_0x52883d[_0x9c81('0x1e')],{'transaction':_0x35847f}));}else if(!_0x34225b['includes'](_0x5c9d4a)){_0x34225b[_0x9c81('0x36')](_0x5c9d4a);_0x5da89d[_0x9c81('0x36')](_0x297de4[_0x3e5e55][_0x9c81('0x20')](_0x52883d[_0x9c81('0x1e')],{'transaction':_0x35847f}));}}return BPromise[_0x9c81('0x37')](_0x5da89d);});})['then'](function(_0x28e9ea){logger[_0x9c81('0xb')](_0x9c81('0x27'),_0x52883d);if(_0x28e9ea[_0x9c81('0x38')]>0x0){logger[_0x9c81('0xb')](_0x9c81('0x39'),_0x28e9ea[0x0][_0x9c81('0x3a')]['id'],_0x28e9ea[0x0]['dataValues'][_0x9c81('0x3b')],_0x28e9ea[0x0][_0x9c81('0x3a')][_0x9c81('0x24')]);}logger['debug'](_0x9c81('0x27'),_0x52883d,JSON[_0x9c81('0xe')](_0x28e9ea));_0xbda4bf(_0x28e9ea);})[_0x9c81('0x1c')](function(_0x377798){logger['error'](_0x9c81('0x27'),_0x377798[_0x9c81('0x10')],_0x52883d);_0x47ead2(_0x53a29a['error'](0x1f4,_0x377798[_0x9c81('0x10')]));});});});};exports[_0x9c81('0x3c')]=function(_0x231bd3){var _0x479383=this;return new Promise(function(_0x4ea774,_0x3c7e9f){return db[_0x9c81('0x2a')][_0x9c81('0x2b')](function(_0x10be26){return db['CmHopperFinal'][_0x9c81('0x3d')](_0x231bd3[_0x9c81('0x1e')],{'raw':_0x231bd3[_0x9c81('0x14')]?_0x231bd3[_0x9c81('0x14')][_0x9c81('0x15')]===undefined?!![]:![]:!![],'transaction':_0x10be26})['then'](function(){logger['info'](_0x9c81('0x3e'),JSON[_0x9c81('0xe')](_0x231bd3[_0x9c81('0x14')][_0x9c81('0x16')]),_0x231bd3['options'][_0x9c81('0x16')][_0x9c81('0x24')]);return db[_0x9c81('0x13')]['destroy']({'where':_0x231bd3['options']?_0x231bd3['options']['where']||null:null,'transaction':_0x10be26});});})[_0x9c81('0xa')](function(_0x1a72e0){logger[_0x9c81('0xb')]('MoveContactManagedDialer',_0x231bd3);logger['debug'](_0x9c81('0x3c'),_0x231bd3,JSON[_0x9c81('0xe')](_0x1a72e0));_0x4ea774(_0x1a72e0);})[_0x9c81('0x1c')](function(_0x4f3f6f){logger[_0x9c81('0xf')](_0x9c81('0x3c'),_0x4f3f6f[_0x9c81('0x10')],_0x231bd3);_0x3c7e9f(_0x479383['error'](0x1f4,_0x4f3f6f[_0x9c81('0x10')]));});});};exports[_0x9c81('0x3f')]=function(_0xbd093c){var _0x547caa=this;return new Promise(function(_0x53264b,_0x2dac73){return db[_0x9c81('0x13')][_0x9c81('0x2c')]({'raw':_0xbd093c['options']?_0xbd093c[_0x9c81('0x14')][_0x9c81('0x15')]===undefined?!![]:![]:!![],'where':_0xbd093c[_0x9c81('0x14')]?_0xbd093c[_0x9c81('0x14')][_0x9c81('0x16')]||null:null,'attributes':[[db[_0x9c81('0x2a')]['fn'](_0x9c81('0x40'),db[_0x9c81('0x2a')]['fn']('IF',db[_0x9c81('0x2a')][_0x9c81('0x41')]('`scheduledat`\x20>=\x20'+util[_0x9c81('0x42')](_0x9c81('0x43'),moment()[_0x9c81('0x42')](_0x9c81('0x44')))+_0x9c81('0x45')))),'contactsRescheduled']]})[_0x9c81('0xa')](function(_0x3d61cc){logger[_0x9c81('0xb')](_0x9c81('0x3f'),_0xbd093c);logger[_0x9c81('0x1b')]('CountReScheduled',_0xbd093c,JSON[_0x9c81('0xe')](_0x3d61cc));_0x53264b(_0x3d61cc);})[_0x9c81('0x1c')](function(_0x5754a6){logger[_0x9c81('0xf')]('CountReScheduled',_0x5754a6[_0x9c81('0x10')],_0xbd093c);_0x2dac73(_0x547caa[_0x9c81('0xf')](0x1f4,_0x5754a6['message']));});});};exports['GetContactRecallMe']=function(_0x4f7bb4){var _0x32d821=this;return new Promise(function(_0x297467,_0x46361a){return db[_0x9c81('0x28')][_0x9c81('0x29')]()[_0x9c81('0xa')](function(_0x3ca844){return db[_0x9c81('0x2a')][_0x9c81('0x2b')](function(_0x4d4092){return db[_0x9c81('0x13')][_0x9c81('0x2c')]({'where':_0x4f7bb4[_0x9c81('0x14')]?_0x4f7bb4[_0x9c81('0x14')]['where']||null:null,'attributes':_0x4f7bb4['options']?_0x4f7bb4[_0x9c81('0x14')]['attributes']||null:null,'limit':0x1,'order':_0x4f7bb4[_0x9c81('0x14')]?_0x4f7bb4[_0x9c81('0x14')][_0x9c81('0x2d')]||null:null,'group':db[_0x9c81('0x13')][_0x9c81('0x35')],'transaction':_0x4d4092,'lock':_0x4d4092[_0x9c81('0x2e')][_0x9c81('0x2f')],'include':_0x4f7bb4['options']?_0x4f7bb4[_0x9c81('0x14')][_0x9c81('0x19')]?_['map'](_0x4f7bb4['options'][_0x9c81('0x19')],function(_0x51bd2a){return{'model':db[_0x51bd2a[_0x9c81('0x1a')]],'as':_0x51bd2a['as'],'attributes':_0x51bd2a[_0x9c81('0x17')],'include':_0x51bd2a[_0x9c81('0x19')]?_[_0x9c81('0x18')](_0x51bd2a[_0x9c81('0x19')],function(_0x2e07dc){return{'model':db[_0x2e07dc['model']],'as':_0x2e07dc['as'],'attributes':_0x2e07dc[_0x9c81('0x17')],'include':_0x2e07dc[_0x9c81('0x19')]?_[_0x9c81('0x18')](_0x2e07dc['include'],function(_0x3a2ed2){return{'model':db[_0x3a2ed2[_0x9c81('0x1a')]],'as':_0x3a2ed2['as'],'attributes':_0x3a2ed2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x240ba6){var _0x16cc88=[];for(var _0x3f35b3=0x0;_0x3f35b3<_0x240ba6[_0x9c81('0x38')];_0x3f35b3+=0x1){_0x16cc88['push'](_0x240ba6[_0x3f35b3]['update'](_0x4f7bb4[_0x9c81('0x1e')],{'transaction':_0x4d4092}));}return BPromise['all'](_0x16cc88);});})['then'](function(_0x820221){logger[_0x9c81('0xb')]('GetContactRecallMe',_0x4f7bb4);logger[_0x9c81('0x1b')](_0x9c81('0x46'),_0x4f7bb4,JSON['stringify'](_0x820221));_0x297467(_0x820221);})[_0x9c81('0x1c')](function(_0x2ee650){logger[_0x9c81('0xf')]('GetContactRecallMe',_0x2ee650[_0x9c81('0x10')],_0x4f7bb4);_0x46361a(_0x32d821[_0x9c81('0xf')](0x1f4,_0x2ee650[_0x9c81('0x10')]));});});});};exports['GetCmHopperPreview']=function(_0x3c9aec){var _0x5d36ad=this;return new Promise(function(_0x1ed5e8,_0x383e89){db[_0x9c81('0x28')]['describe']()[_0x9c81('0xa')](function(_0x32e7df){return db[_0x9c81('0x13')][_0x9c81('0x2c')]({'raw':_0x3c9aec[_0x9c81('0x14')]?_0x3c9aec['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c9aec[_0x9c81('0x14')]?_0x3c9aec[_0x9c81('0x14')]['where']||null:null,'attributes':_0x3c9aec[_0x9c81('0x14')]?_0x3c9aec[_0x9c81('0x14')][_0x9c81('0x17')]||null:null,'limit':_0x3c9aec[_0x9c81('0x14')]?_0x3c9aec[_0x9c81('0x14')][_0x9c81('0x21')]||null:null,'include':_0x3c9aec[_0x9c81('0x14')]?_0x3c9aec[_0x9c81('0x14')][_0x9c81('0x19')]?_[_0x9c81('0x18')](_0x3c9aec[_0x9c81('0x14')][_0x9c81('0x19')],function(_0x228a2a){return{'model':db[_0x228a2a[_0x9c81('0x1a')]],'as':_0x228a2a['as'],'attributes':_0x228a2a['as']===_0x9c81('0x30')?_[_0x9c81('0x31')](_0x32e7df):_0x228a2a[_0x9c81('0x17')],'include':_0x228a2a['include']?_[_0x9c81('0x18')](_0x228a2a[_0x9c81('0x19')],function(_0x45f114){return{'model':db[_0x45f114[_0x9c81('0x1a')]],'as':_0x45f114['as'],'attributes':_0x45f114[_0x9c81('0x17')],'include':_0x45f114[_0x9c81('0x19')]?_['map'](_0x45f114[_0x9c81('0x19')],function(_0xb95877){return{'model':db[_0xb95877[_0x9c81('0x1a')]],'as':_0xb95877['as'],'attributes':_0xb95877['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x378f56){logger['info'](_0x9c81('0x12'),_0x3c9aec);logger[_0x9c81('0x1b')](_0x9c81('0x12'),_0x3c9aec,JSON[_0x9c81('0xe')](_0x378f56));_0x1ed5e8(_0x378f56);})['catch'](function(_0x11be3b){logger[_0x9c81('0xf')](_0x9c81('0x12'),_0x11be3b[_0x9c81('0x10')],_0x3c9aec);_0x383e89(_0x5d36ad['error'](0x1f4,_0x11be3b[_0x9c81('0x10')]));});});});};exports[_0x9c81('0x47')]=function(_0x496fc6){var _0x523c23=this;return new Promise(function(_0x928a06,_0x23dc72){return db['CmContact'][_0x9c81('0x48')]({'raw':!![],'where':{'phone':_0x496fc6[_0x9c81('0x14')][_0x9c81('0x16')][_0x9c81('0x49')]},'attributes':['id','dialTimezone'],'order':[['id',_0x9c81('0x4a')]]})['then'](function(_0xea1f80){logger[_0x9c81('0xb')](_0x9c81('0x4b'),_0x496fc6);logger[_0x9c81('0x1b')](_0x9c81('0x4b'),_0x496fc6,JSON[_0x9c81('0xe')](_0xea1f80));_0x928a06(_0xea1f80);})[_0x9c81('0x1c')](function(_0x45878a){logger[_0x9c81('0xf')]('getContactByPhone',_0x45878a[_0x9c81('0x10')],_0x496fc6);_0x23dc72(_0x523c23[_0x9c81('0xf')](0x1f4,_0x45878a[_0x9c81('0x10')]));});});};exports[_0x9c81('0x4c')]=function(_0x3d8345){var _0x14be41=this;return new Promise(function(_0x281c91,_0x36c0d0){return db['sequelize']['transaction'](function(_0x3161f2){return db[_0x9c81('0x13')][_0x9c81('0x20')](_0x3d8345[_0x9c81('0x1e')],{'where':{},'transaction':_0x3161f2})[_0x9c81('0xa')](function(_0x502287){logger[_0x9c81('0xb')]('ResetActiveCalls',_0x3d8345);logger[_0x9c81('0x1b')](_0x9c81('0x4c'),_0x3d8345,JSON['stringify'](_0x502287));_0x281c91(_0x502287);})[_0x9c81('0x1c')](function(_0x3158a5){logger[_0x9c81('0xf')](_0x9c81('0x4c'),_0x3158a5['message'],_0x3d8345);_0x36c0d0(_0x14be41['error'](0x1f4,_0x3158a5[_0x9c81('0x10')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x534dc0){var _0x27fea4=this;var _0x1accf5=_0x534dc0['body'][_0x9c81('0x16')][_0x9c81('0x4d')];var _0x470cd=_0x534dc0[_0x9c81('0x1e')][_0x9c81('0x16')]['interval'];var _0x121f98=_0x534dc0[_0x9c81('0x1e')][_0x9c81('0x16')][_0x9c81('0x4e')];return new Promise(function(_0x415a32,_0x5a5dab){return db[_0x9c81('0x13')][_0x9c81('0x2c')]({'where':{'voiceQueueId':{'$in':_0x1accf5},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x9c81('0x2a')][_0x9c81('0x41')](_0x9c81('0x4f')+_0x470cd+_0x9c81('0x50')),'$gt':db[_0x9c81('0x2a')][_0x9c81('0x41')](_0x9c81('0x51'))}},'UserId':{'$in':_0x121f98}},'include':[{'model':db['CmContact'],'as':_0x9c81('0x30')},{'model':db[_0x9c81('0x52')],'as':'Agent','attributes':['id','name','voicePause']},{'model':db['CmList'],'as':_0x9c81('0x53')}]})[_0x9c81('0xa')](function(_0x2fa14e){if(_0x2fa14e[_0x9c81('0x38')]>0x0){return db[_0x9c81('0x2a')]['transaction'](function(_0x3b71d8){return db[_0x9c81('0x13')][_0x9c81('0x20')]({'recallmeNotifiedDate':db[_0x9c81('0x2a')][_0x9c81('0x41')](_0x9c81('0x51'))},{'where':{'id':{'$in':_[_0x9c81('0x18')](_0x2fa14e,'id')}},'transaction':_0x3b71d8})[_0x9c81('0xa')](function(){_0x415a32(_0x2fa14e);})[_0x9c81('0x1c')](function(_0xf760a8){logger['error'](_0x9c81('0x54'),_0xf760a8['message'],_0x534dc0);_0x5a5dab(_0x27fea4[_0x9c81('0xf')](0x1f4,_0xf760a8[_0x9c81('0x10')]));});})['catch'](function(_0x209b6b){logger['error'](_0x9c81('0x54'),_0x209b6b[_0x9c81('0x10')],_0x534dc0);_0x5a5dab(_0x27fea4['error'](0x1f4,_0x209b6b[_0x9c81('0x10')]));});}else{_0x415a32(_0x2fa14e);}});});}; \ No newline at end of file +var _0xf804=['getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','name','CmList','List','NOW()','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','map','model','include','then','debug','stringify','catch','error','message','ShowCmHopper','find','info','raw','CreateCmHopper','UpdateCmHopper','body','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','order','UPDATE','Contact','keys','User','Agent','voicePause','length','push','includes','update','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','describe','UserId','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone'];(function(_0xe6391c,_0x322480){var _0x3f396f=function(_0x13f612){while(--_0x13f612){_0xe6391c['push'](_0xe6391c['shift']());}};_0x3f396f(++_0x322480);}(_0xf804,0x197));var _0x4f80=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf804[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x4f80('0x0'));var moment=require(_0x4f80('0x1'));var BPromise=require(_0x4f80('0x2'));var db=require(_0x4f80('0x3'))['db'];var logger=require(_0x4f80('0x4'))('rpc');exports[_0x4f80('0x5')]=function(_0x29ac69){var _0x4ff2b4=this;return new Promise(function(_0x2d469f,_0x43b627){return db[_0x4f80('0x6')][_0x4f80('0x7')]({'raw':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')][_0x4f80('0xa')]||null:null,'limit':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')][_0x4f80('0xb')]||null:null,'include':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')]['include']?_[_0x4f80('0xc')](_0x29ac69[_0x4f80('0x8')]['include'],function(_0x16632a){return{'model':db[_0x16632a[_0x4f80('0xd')]],'as':_0x16632a['as'],'attributes':_0x16632a[_0x4f80('0xa')],'include':_0x16632a[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x16632a[_0x4f80('0xe')],function(_0x2139f7){return{'model':db[_0x2139f7[_0x4f80('0xd')]],'as':_0x2139f7['as'],'attributes':_0x2139f7['attributes'],'include':_0x2139f7[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x2139f7[_0x4f80('0xe')],function(_0x3a1992){return{'model':db[_0x3a1992[_0x4f80('0xd')]],'as':_0x3a1992['as'],'attributes':_0x3a1992[_0x4f80('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4f80('0xf')](function(_0x49df56){logger['info']('GetCmHopper',_0x29ac69);logger[_0x4f80('0x10')](_0x4f80('0x5'),_0x29ac69,JSON[_0x4f80('0x11')](_0x49df56));_0x2d469f(_0x49df56);})[_0x4f80('0x12')](function(_0xfc2304){logger[_0x4f80('0x13')](_0x4f80('0x5'),_0xfc2304[_0x4f80('0x14')],_0x29ac69);_0x43b627(_0x4ff2b4[_0x4f80('0x13')](0x1f4,_0xfc2304[_0x4f80('0x14')]));});});};exports[_0x4f80('0x15')]=function(_0x4f5d95){var _0x394661=this;return new Promise(function(_0x1ac6c8,_0x104939){return db[_0x4f80('0x6')][_0x4f80('0x16')]({'raw':_0x4f5d95['options']?_0x4f5d95['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f5d95[_0x4f80('0x8')]?_0x4f5d95[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x4f5d95[_0x4f80('0x8')]?_0x4f5d95['options']['attributes']||null:null,'include':_0x4f5d95[_0x4f80('0x8')]?_0x4f5d95['options']['include']?_[_0x4f80('0xc')](_0x4f5d95[_0x4f80('0x8')]['include'],function(_0x15ad1c){return{'model':db[_0x15ad1c[_0x4f80('0xd')]],'as':_0x15ad1c['as'],'attributes':_0x15ad1c[_0x4f80('0xa')],'include':_0x15ad1c[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x15ad1c[_0x4f80('0xe')],function(_0x4c1587){return{'model':db[_0x4c1587[_0x4f80('0xd')]],'as':_0x4c1587['as'],'attributes':_0x4c1587[_0x4f80('0xa')],'include':_0x4c1587[_0x4f80('0xe')]?_['map'](_0x4c1587['include'],function(_0x311fc1){return{'model':db[_0x311fc1[_0x4f80('0xd')]],'as':_0x311fc1['as'],'attributes':_0x311fc1['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f80('0xf')](function(_0x479859){logger[_0x4f80('0x17')]('ShowCmHopper',_0x4f5d95);logger[_0x4f80('0x10')](_0x4f80('0x15'),_0x4f5d95,JSON[_0x4f80('0x11')](_0x479859));_0x1ac6c8(_0x479859);})[_0x4f80('0x12')](function(_0x2da16e){logger[_0x4f80('0x13')]('ShowCmHopper',_0x2da16e[_0x4f80('0x14')],_0x4f5d95);_0x104939(_0x394661['error'](0x1f4,_0x2da16e[_0x4f80('0x14')]));});});};exports['CreateCmHopper']=function(_0x3e51d9){var _0x4ba9c5=this;return new Promise(function(_0x515c50,_0x488317){return db[_0x4f80('0x6')]['create'](_0x3e51d9['body'],{'raw':_0x3e51d9[_0x4f80('0x8')]?_0x3e51d9['options'][_0x4f80('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1fd58d){logger['info'](_0x4f80('0x19'),_0x3e51d9);logger[_0x4f80('0x10')](_0x4f80('0x19'),_0x3e51d9,JSON[_0x4f80('0x11')](_0x1fd58d));_0x515c50(_0x1fd58d);})[_0x4f80('0x12')](function(_0xea7f5b){logger[_0x4f80('0x13')](_0x4f80('0x19'),_0xea7f5b[_0x4f80('0x14')],_0x3e51d9);_0x488317(_0x4ba9c5['error'](0x1f4,_0xea7f5b[_0x4f80('0x14')]));});});};exports[_0x4f80('0x1a')]=function(_0x2ce84b){var _0x5d74ce=this;return new Promise(function(_0x1ef62f,_0x9e6623){return db['CmHopper']['update'](_0x2ce84b[_0x4f80('0x1b')],{'raw':_0x2ce84b[_0x4f80('0x8')]?_0x2ce84b[_0x4f80('0x8')][_0x4f80('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ce84b['options']?_0x2ce84b[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x2ce84b[_0x4f80('0x8')]?_0x2ce84b[_0x4f80('0x8')]['attributes']||null:null,'limit':_0x2ce84b['options']?_0x2ce84b[_0x4f80('0x8')][_0x4f80('0xb')]||null:null})['then'](function(_0x21f415){logger[_0x4f80('0x17')](_0x4f80('0x1a'),_0x2ce84b);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x4f80('0x11')](_0x2ce84b[_0x4f80('0x8')]['where']),_0x2ce84b['body']['active']);logger[_0x4f80('0x10')](_0x4f80('0x1a'),_0x2ce84b,JSON[_0x4f80('0x11')](_0x21f415));_0x1ef62f(_0x21f415);})[_0x4f80('0x12')](function(_0x5ab47a){logger[_0x4f80('0x13')](_0x4f80('0x1a'),_0x5ab47a[_0x4f80('0x14')],_0x2ce84b);_0x9e6623(_0x5d74ce[_0x4f80('0x13')](0x1f4,_0x5ab47a[_0x4f80('0x14')]));});});};exports[_0x4f80('0x1c')]=function(_0x4ed733){var _0x123a88=this;return new Promise(function(_0xeb6569,_0x434055){return db[_0x4f80('0x6')][_0x4f80('0x1d')]({'where':_0x4ed733['options']?_0x4ed733['options'][_0x4f80('0x9')]||null:null})[_0x4f80('0xf')](function(_0x607f5a){logger[_0x4f80('0x17')]('DestroyCmHopper',_0x4ed733);logger[_0x4f80('0x10')](_0x4f80('0x1c'),_0x4ed733,JSON[_0x4f80('0x11')](_0x607f5a));_0xeb6569(_0x607f5a);})['catch'](function(_0x572893){logger[_0x4f80('0x13')](_0x4f80('0x1c'),_0x572893['message'],_0x4ed733);_0x434055(_0x123a88['error'](0x1f4,_0x572893['message']));});});};exports[_0x4f80('0x1e')]=function(_0x5dc880){var _0x22da2e=this;return new Promise(function(_0x500f84,_0x544a3a){return db[_0x4f80('0x1f')]['describe']()['then'](function(_0x29a424){return db[_0x4f80('0x20')][_0x4f80('0x21')](function(_0x2efca2){return db['CmHopper']['findAll']({'where':_0x5dc880[_0x4f80('0x8')]?_0x5dc880[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x5dc880['options']?_0x5dc880[_0x4f80('0x8')][_0x4f80('0xa')]||null:null,'limit':_0x5dc880[_0x4f80('0x8')]?_0x5dc880[_0x4f80('0x8')]['limit']||null:null,'order':_0x5dc880[_0x4f80('0x8')]?_0x5dc880[_0x4f80('0x8')][_0x4f80('0x22')]||null:null,'transaction':_0x2efca2,'lock':_0x2efca2['LOCK'][_0x4f80('0x23')],'include':[{'model':db[_0x4f80('0x1f')],'as':_0x4f80('0x24'),'attributes':_[_0x4f80('0x25')](_0x29a424)},{'model':db[_0x4f80('0x26')],'as':_0x4f80('0x27'),'attributes':['id','name',_0x4f80('0x28')]}]})[_0x4f80('0xf')](function(_0x5b759a){var _0x25c48d=[];var _0x49983b=[];for(var _0x48cd7c=0x0;_0x48cd7c<_0x5b759a[_0x4f80('0x29')];_0x48cd7c+=0x1){var _0x341cfb=_0x5b759a[_0x48cd7c]['UserId'];if(_0x341cfb===null){_0x25c48d[_0x4f80('0x2a')](_0x5b759a[_0x48cd7c]['update'](_0x5dc880['body'],{'transaction':_0x2efca2}));}else if(!_0x49983b[_0x4f80('0x2b')](_0x341cfb)){_0x49983b['push'](_0x341cfb);_0x25c48d[_0x4f80('0x2a')](_0x5b759a[_0x48cd7c][_0x4f80('0x2c')](_0x5dc880[_0x4f80('0x1b')],{'transaction':_0x2efca2}));}}return BPromise['all'](_0x25c48d);});})[_0x4f80('0xf')](function(_0x3f897a){logger[_0x4f80('0x17')](_0x4f80('0x1e'),_0x5dc880);if(_0x3f897a[_0x4f80('0x29')]>0x0){logger[_0x4f80('0x17')](_0x4f80('0x2d'),_0x3f897a[0x0][_0x4f80('0x2e')]['id'],_0x3f897a[0x0][_0x4f80('0x2e')]['ContactId'],_0x3f897a[0x0][_0x4f80('0x2e')][_0x4f80('0x2f')]);}logger[_0x4f80('0x10')](_0x4f80('0x1e'),_0x5dc880,JSON[_0x4f80('0x11')](_0x3f897a));_0x500f84(_0x3f897a);})['catch'](function(_0x12485b){logger[_0x4f80('0x13')](_0x4f80('0x1e'),_0x12485b[_0x4f80('0x14')],_0x5dc880);_0x544a3a(_0x22da2e['error'](0x1f4,_0x12485b[_0x4f80('0x14')]));});});});};exports[_0x4f80('0x30')]=function(_0x156896){var _0x11c985=this;return new Promise(function(_0x3b5797,_0x56ffc3){return db[_0x4f80('0x20')][_0x4f80('0x21')](function(_0x54672f){return db[_0x4f80('0x31')][_0x4f80('0x32')](_0x156896['body'],{'raw':_0x156896[_0x4f80('0x8')]?_0x156896[_0x4f80('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x54672f})['then'](function(){logger[_0x4f80('0x17')](_0x4f80('0x33'),JSON['stringify'](_0x156896['options']['where']),_0x156896['options']['where'][_0x4f80('0x2f')]);return db[_0x4f80('0x6')][_0x4f80('0x1d')]({'where':_0x156896[_0x4f80('0x8')]?_0x156896['options']['where']||null:null,'transaction':_0x54672f});});})[_0x4f80('0xf')](function(_0x3e9669){logger[_0x4f80('0x17')]('MoveContactManagedDialer',_0x156896);logger['debug']('MoveContactManagedDialer',_0x156896,JSON['stringify'](_0x3e9669));_0x3b5797(_0x3e9669);})[_0x4f80('0x12')](function(_0x5d0ac4){logger[_0x4f80('0x13')]('MoveContactManagedDialer',_0x5d0ac4['message'],_0x156896);_0x56ffc3(_0x11c985[_0x4f80('0x13')](0x1f4,_0x5d0ac4[_0x4f80('0x14')]));});});};exports[_0x4f80('0x34')]=function(_0x3848f3){var _0x15e8be=this;return new Promise(function(_0xd43ce5,_0x32b60a){return db[_0x4f80('0x6')][_0x4f80('0x7')]({'raw':_0x3848f3[_0x4f80('0x8')]?_0x3848f3[_0x4f80('0x8')][_0x4f80('0x18')]===undefined?!![]:![]:!![],'where':_0x3848f3['options']?_0x3848f3[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':[[db[_0x4f80('0x20')]['fn'](_0x4f80('0x35'),db[_0x4f80('0x20')]['fn']('IF',db[_0x4f80('0x20')][_0x4f80('0x36')](_0x4f80('0x37')+util['format']('\x22%s\x22',moment()[_0x4f80('0x38')](_0x4f80('0x39')))+'\x20,\x201,\x20null'))),_0x4f80('0x3a')]]})[_0x4f80('0xf')](function(_0x2477ed){logger[_0x4f80('0x17')](_0x4f80('0x34'),_0x3848f3);logger[_0x4f80('0x10')]('CountReScheduled',_0x3848f3,JSON['stringify'](_0x2477ed));_0xd43ce5(_0x2477ed);})[_0x4f80('0x12')](function(_0x56cc82){logger['error']('CountReScheduled',_0x56cc82[_0x4f80('0x14')],_0x3848f3);_0x32b60a(_0x15e8be[_0x4f80('0x13')](0x1f4,_0x56cc82[_0x4f80('0x14')]));});});};exports[_0x4f80('0x3b')]=function(_0x38351d){var _0x2df6fa=this;return new Promise(function(_0xeab893,_0x700b7){return db[_0x4f80('0x1f')][_0x4f80('0x3c')]()['then'](function(){return db[_0x4f80('0x20')]['transaction'](function(_0x452df7){return db['CmHopper'][_0x4f80('0x7')]({'where':_0x38351d[_0x4f80('0x8')]?_0x38351d[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x38351d[_0x4f80('0x8')]?_0x38351d['options'][_0x4f80('0xa')]||null:null,'limit':0x1,'order':_0x38351d['options']?_0x38351d[_0x4f80('0x8')]['order']||null:null,'group':db[_0x4f80('0x6')][_0x4f80('0x3d')],'transaction':_0x452df7,'lock':_0x452df7['LOCK']['UPDATE'],'include':_0x38351d[_0x4f80('0x8')]?_0x38351d['options']['include']?_[_0x4f80('0xc')](_0x38351d[_0x4f80('0x8')][_0x4f80('0xe')],function(_0x20854e){return{'model':db[_0x20854e['model']],'as':_0x20854e['as'],'attributes':_0x20854e[_0x4f80('0xa')],'include':_0x20854e[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x20854e[_0x4f80('0xe')],function(_0x5695bf){return{'model':db[_0x5695bf['model']],'as':_0x5695bf['as'],'attributes':_0x5695bf[_0x4f80('0xa')],'include':_0x5695bf[_0x4f80('0xe')]?_['map'](_0x5695bf['include'],function(_0x5112ce){return{'model':db[_0x5112ce[_0x4f80('0xd')]],'as':_0x5112ce['as'],'attributes':_0x5112ce[_0x4f80('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4f80('0xf')](function(_0x1867d1){var _0x1e4e59=[];for(var _0x5e9f6b=0x0;_0x5e9f6b<_0x1867d1[_0x4f80('0x29')];_0x5e9f6b+=0x1){_0x1e4e59[_0x4f80('0x2a')](_0x1867d1[_0x5e9f6b][_0x4f80('0x2c')](_0x38351d['body'],{'transaction':_0x452df7}));}return BPromise['all'](_0x1e4e59);});})['then'](function(_0x1c644b){logger['info'](_0x4f80('0x3b'),_0x38351d);logger[_0x4f80('0x10')](_0x4f80('0x3b'),_0x38351d,JSON[_0x4f80('0x11')](_0x1c644b));_0xeab893(_0x1c644b);})[_0x4f80('0x12')](function(_0x21f874){logger[_0x4f80('0x13')](_0x4f80('0x3b'),_0x21f874['message'],_0x38351d);_0x700b7(_0x2df6fa['error'](0x1f4,_0x21f874[_0x4f80('0x14')]));});});});};exports[_0x4f80('0x3e')]=function(_0x3a3bab){var _0x3c7407=this;return new Promise(function(_0x1946ca,_0x1cb7f1){db[_0x4f80('0x1f')][_0x4f80('0x3c')]()[_0x4f80('0xf')](function(_0x91a723){return db['CmHopper'][_0x4f80('0x7')]({'raw':_0x3a3bab[_0x4f80('0x8')]?_0x3a3bab['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a3bab[_0x4f80('0x8')]?_0x3a3bab[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x3a3bab[_0x4f80('0x8')]?_0x3a3bab[_0x4f80('0x8')][_0x4f80('0xa')]||null:null,'limit':_0x3a3bab['options']?_0x3a3bab[_0x4f80('0x8')][_0x4f80('0xb')]||null:null,'include':_0x3a3bab[_0x4f80('0x8')]?_0x3a3bab[_0x4f80('0x8')][_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x3a3bab['options'][_0x4f80('0xe')],function(_0x2e3b4d){return{'model':db[_0x2e3b4d[_0x4f80('0xd')]],'as':_0x2e3b4d['as'],'attributes':_0x2e3b4d['as']==='Contact'?_[_0x4f80('0x25')](_0x91a723):_0x2e3b4d[_0x4f80('0xa')],'include':_0x2e3b4d[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x2e3b4d['include'],function(_0x4ac25e){return{'model':db[_0x4ac25e[_0x4f80('0xd')]],'as':_0x4ac25e['as'],'attributes':_0x4ac25e[_0x4f80('0xa')],'include':_0x4ac25e[_0x4f80('0xe')]?_['map'](_0x4ac25e[_0x4f80('0xe')],function(_0x536877){return{'model':db[_0x536877[_0x4f80('0xd')]],'as':_0x536877['as'],'attributes':_0x536877['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a595e){logger[_0x4f80('0x17')]('GetCmHopper',_0x3a3bab);logger['debug'](_0x4f80('0x5'),_0x3a3bab,JSON['stringify'](_0x4a595e));_0x1946ca(_0x4a595e);})[_0x4f80('0x12')](function(_0x560366){logger[_0x4f80('0x13')]('GetCmHopper',_0x560366['message'],_0x3a3bab);_0x1cb7f1(_0x3c7407['error'](0x1f4,_0x560366[_0x4f80('0x14')]));});});});};exports[_0x4f80('0x3f')]=function(_0xdab754){var _0x22ec8f=this;return new Promise(function(_0x4d4790,_0x3a96c4){return db[_0x4f80('0x1f')][_0x4f80('0x40')]({'raw':!![],'where':{'phone':_0xdab754[_0x4f80('0x8')]['where'][_0x4f80('0x41')]},'attributes':['id',_0x4f80('0x42')],'order':[['id','DESC']]})['then'](function(_0x35edda){logger['info'](_0x4f80('0x43'),_0xdab754);logger[_0x4f80('0x10')](_0x4f80('0x43'),_0xdab754,JSON[_0x4f80('0x11')](_0x35edda));_0x4d4790(_0x35edda);})['catch'](function(_0x27539c){logger['error']('getContactByPhone',_0x27539c[_0x4f80('0x14')],_0xdab754);_0x3a96c4(_0x22ec8f[_0x4f80('0x13')](0x1f4,_0x27539c[_0x4f80('0x14')]));});});};exports[_0x4f80('0x44')]=function(_0x4d278b){var _0x801ee5=this;return new Promise(function(_0x3f9445,_0xcf4afb){return db[_0x4f80('0x20')][_0x4f80('0x21')](function(_0x35767d){var _0x4a899c=_0x4d278b[_0x4f80('0x8')]&&_0x4d278b[_0x4f80('0x8')][_0x4f80('0x9')]?_0x4d278b[_0x4f80('0x8')][_0x4f80('0x9')]:{};return db[_0x4f80('0x6')][_0x4f80('0x2c')](_0x4d278b[_0x4f80('0x1b')],{'where':_0x4a899c,'transaction':_0x35767d})['then'](function(_0x56b97e){logger['info'](_0x4f80('0x44'),_0x4d278b);logger[_0x4f80('0x10')](_0x4f80('0x44'),_0x4d278b,JSON['stringify'](_0x56b97e));_0x3f9445(_0x56b97e);})['catch'](function(_0x5e0abb){logger['error'](_0x4f80('0x44'),_0x5e0abb[_0x4f80('0x14')],_0x4d278b);_0xcf4afb(_0x801ee5[_0x4f80('0x13')](0x1f4,_0x5e0abb[_0x4f80('0x14')]));});});});};exports[_0x4f80('0x45')]=function(_0x131c34){var _0x1fdfe7=this;var _0x3c0b8c=_0x131c34[_0x4f80('0x1b')][_0x4f80('0x9')][_0x4f80('0x46')];var _0x569e7f=_0x131c34[_0x4f80('0x1b')]['where'][_0x4f80('0x47')];var _0xd2586a=_0x131c34['body'][_0x4f80('0x9')][_0x4f80('0x48')];return new Promise(function(_0x390628,_0x3ff660){return db[_0x4f80('0x6')][_0x4f80('0x7')]({'where':{'voiceQueueId':{'$in':_0x3c0b8c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4f80('0x20')][_0x4f80('0x36')](_0x4f80('0x49')+_0x569e7f+_0x4f80('0x4a')),'$gt':db[_0x4f80('0x20')][_0x4f80('0x36')]('NOW()')}},'UserId':{'$in':_0xd2586a}},'include':[{'model':db['CmContact'],'as':_0x4f80('0x24')},{'model':db[_0x4f80('0x26')],'as':'Agent','attributes':['id',_0x4f80('0x4b'),_0x4f80('0x28')]},{'model':db[_0x4f80('0x4c')],'as':_0x4f80('0x4d')}]})[_0x4f80('0xf')](function(_0x4d4b84){if(_0x4d4b84[_0x4f80('0x29')]>0x0){return db[_0x4f80('0x20')][_0x4f80('0x21')](function(_0x2f8462){return db['CmHopper'][_0x4f80('0x2c')]({'recallmeNotifiedDate':db[_0x4f80('0x20')][_0x4f80('0x36')](_0x4f80('0x4e'))},{'where':{'id':{'$in':_['map'](_0x4d4b84,'id')}},'transaction':_0x2f8462})[_0x4f80('0xf')](function(){_0x390628(_0x4d4b84);})[_0x4f80('0x12')](function(_0x397a6c){logger[_0x4f80('0x13')](_0x4f80('0x45'),_0x397a6c[_0x4f80('0x14')],_0x131c34);_0x3ff660(_0x1fdfe7[_0x4f80('0x13')](0x1f4,_0x397a6c[_0x4f80('0x14')]));});})['catch'](function(_0x12f0e0){logger['error'](_0x4f80('0x45'),_0x12f0e0[_0x4f80('0x14')],_0x131c34);_0x3ff660(_0x1fdfe7[_0x4f80('0x13')](0x1f4,_0x12f0e0[_0x4f80('0x14')]));});}else{_0x390628(_0x4d4b84);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d12ccc5..b80433d 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 _0x4aff=['/timezones','/:id','getPreviewRecall','post','create','/timezone','put','delete','destroy','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts'];(function(_0x42f3a6,_0x45285c){var _0xdf3c33=function(_0x5cc2ec){while(--_0x5cc2ec){_0x42f3a6['push'](_0x42f3a6['shift']());}};_0xdf3c33(++_0x45285c);}(_0x4aff,0xe1));var _0xf4af=function(_0x166f3c,_0x5770af){_0x166f3c=_0x166f3c-0x0;var _0x58e68b=_0x4aff[_0x166f3c];return _0x58e68b;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf4af('0x0'));var controller=require(_0xf4af('0x1'));router[_0xf4af('0x2')]('/',auth[_0xf4af('0x3')](),controller[_0xf4af('0x4')]);router['get'](_0xf4af('0x5'),auth[_0xf4af('0x3')](),controller[_0xf4af('0x6')]);router['get'](_0xf4af('0x7'),auth[_0xf4af('0x3')](),controller[_0xf4af('0x8')]);router[_0xf4af('0x2')](_0xf4af('0x9'),auth[_0xf4af('0x3')](),controller['getTimezones']);router[_0xf4af('0x2')](_0xf4af('0xa'),auth[_0xf4af('0x3')](),controller['show']);router['get']('/:id/previewrecall',auth[_0xf4af('0x3')](),controller[_0xf4af('0xb')]);router[_0xf4af('0xc')]('/',auth['isAuthenticated'](),controller[_0xf4af('0xd')]);router['post']('/preview',auth[_0xf4af('0x3')](),controller['getPreview']);router[_0xf4af('0xc')](_0xf4af('0xe'),auth['isAuthenticated'](),controller['getTimezone']);router[_0xf4af('0xf')](_0xf4af('0xa'),auth[_0xf4af('0x3')](),controller['update']);router[_0xf4af('0x10')](_0xf4af('0xa'),auth['isAuthenticated'](),controller[_0xf4af('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5b44=['/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','create','post','/preview','/timezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','getOpenContacts'];(function(_0x1bcd90,_0xf18e30){var _0x500264=function(_0x37ab1b){while(--_0x37ab1b){_0x1bcd90['push'](_0x1bcd90['shift']());}};_0x500264(++_0xf18e30);}(_0x5b44,0x92));var _0x45b4=function(_0x97b938,_0x138552){_0x97b938=_0x97b938-0x0;var _0x3f1b29=_0x5b44[_0x97b938];return _0x3f1b29;};'use strict';var express=require(_0x45b4('0x0'));var router=express[_0x45b4('0x1')]();var auth=require(_0x45b4('0x2'));var controller=require('./cmHopper.controller');router[_0x45b4('0x3')]('/',auth[_0x45b4('0x4')](),controller[_0x45b4('0x5')]);router['get'](_0x45b4('0x6'),auth[_0x45b4('0x4')](),controller['describe']);router[_0x45b4('0x3')]('/opencontacts',auth[_0x45b4('0x4')](),controller[_0x45b4('0x7')]);router['get'](_0x45b4('0x8'),auth[_0x45b4('0x4')](),controller[_0x45b4('0x9')]);router[_0x45b4('0x3')](_0x45b4('0xa'),auth[_0x45b4('0x4')](),controller['show']);router[_0x45b4('0x3')](_0x45b4('0xb'),auth['isAuthenticated'](),controller[_0x45b4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x45b4('0xd')]);router[_0x45b4('0xe')](_0x45b4('0xf'),auth[_0x45b4('0x4')](),controller['getPreview']);router[_0x45b4('0xe')](_0x45b4('0x10'),auth[_0x45b4('0x4')](),controller['getTimezone']);router[_0x45b4('0x11')](_0x45b4('0xa'),auth[_0x45b4('0x4')](),controller[_0x45b4('0x12')]);router[_0x45b4('0x13')]('/:id',auth[_0x45b4('0x4')](),controller[_0x45b4('0x14')]);module[_0x45b4('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 744b68c..790a123 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1683=['sequelize','exports','INTEGER','STRING','DATE','format','moment'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x1683,0x109));var _0x3168=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x1683[_0x160c73];return _0xd9302;};'use strict';var moment=require(_0x3168('0x0'));var Sequelize=require(_0x3168('0x1'));module[_0x3168('0x2')]={'CmHopperId':{'type':Sequelize[_0x3168('0x3')]},'phone':{'type':Sequelize[_0x3168('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3168('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3168('0x5')],'defaultValue':moment()[_0x3168('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3168('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3168('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3168('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3168('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3168('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3168('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xeca8=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x973f7a,_0x19fd27){var _0x31e2c4=function(_0x28cc0a){while(--_0x28cc0a){_0x973f7a['push'](_0x973f7a['shift']());}};_0x31e2c4(++_0x19fd27);}(_0xeca8,0x16b));var _0x8eca=function(_0x20c047,_0x5edfba){_0x20c047=_0x20c047-0x0;var _0x2e0400=_0xeca8[_0x20c047];return _0x2e0400;};'use strict';var moment=require('moment');var Sequelize=require(_0x8eca('0x0'));module[_0x8eca('0x1')]={'CmHopperId':{'type':Sequelize[_0x8eca('0x2')]},'phone':{'type':Sequelize[_0x8eca('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8eca('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 11a038d..dfb3f40 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4f6=['fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','CmHopperAdditionalPhone','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','error','stack','send','index','map','fieldName','type','name','keys','filters','intersection','model','query','attributes'];(function(_0x9da055,_0x5c2a73){var _0x7ffba7=function(_0x5e4fc3){while(--_0x5e4fc3){_0x9da055['push'](_0x9da055['shift']());}};_0x7ffba7(++_0x5c2a73);}(_0xe4f6,0x1cc));var _0x6e4f=function(_0x251489,_0x5cebd3){_0x251489=_0x251489-0x0;var _0x54f625=_0xe4f6[_0x251489];return _0x54f625;};'use strict';var emlformat=require(_0x6e4f('0x0'));var rimraf=require(_0x6e4f('0x1'));var zipdir=require(_0x6e4f('0x2'));var jsonpatch=require(_0x6e4f('0x3'));var rp=require(_0x6e4f('0x4'));var moment=require(_0x6e4f('0x5'));var BPromise=require(_0x6e4f('0x6'));var Mustache=require(_0x6e4f('0x7'));var util=require(_0x6e4f('0x8'));var path=require(_0x6e4f('0x9'));var sox=require(_0x6e4f('0xa'));var csv=require('to-csv');var ejs=require(_0x6e4f('0xb'));var fs=require('fs');var fs_extra=require(_0x6e4f('0xc'));var _=require('lodash');var squel=require(_0x6e4f('0xd'));var crypto=require(_0x6e4f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6e4f('0xf'));var querystring=require(_0x6e4f('0x10'));var Papa=require(_0x6e4f('0x11'));var Redis=require(_0x6e4f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6e4f('0x13'));var hardwareService=require(_0x6e4f('0x14'));var logger=require(_0x6e4f('0x15'))(_0x6e4f('0x16'));var utils=require(_0x6e4f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6e4f('0x18'));var db=require(_0x6e4f('0x19'))['db'];function respondWithStatusCode(_0x4b2aaa,_0x5aeadd){_0x5aeadd=_0x5aeadd||0xcc;return function(_0xb725bb){if(_0xb725bb){return _0x4b2aaa[_0x6e4f('0x1a')](_0x5aeadd);}return _0x4b2aaa['status'](_0x5aeadd)[_0x6e4f('0x1b')]();};}function respondWithResult(_0x40d02d,_0x279262){_0x279262=_0x279262||0xc8;return function(_0x1bd2e6){if(_0x1bd2e6){return _0x40d02d[_0x6e4f('0x1c')](_0x279262)[_0x6e4f('0x1d')](_0x1bd2e6);}};}function respondWithFilteredResult(_0x220b47,_0x3b6101){return function(_0x325dc8){if(_0x325dc8){var _0x2d9ca8=typeof _0x3b6101[_0x6e4f('0x1e')]===_0x6e4f('0x1f')&&typeof _0x3b6101[_0x6e4f('0x20')]===_0x6e4f('0x1f');var _0x112b57=_0x325dc8[_0x6e4f('0x21')];var _0x3fd7b3=_0x2d9ca8?0x0:_0x3b6101[_0x6e4f('0x1e')];var _0x5d71a2=_0x2d9ca8?_0x325dc8[_0x6e4f('0x21')]:_0x3b6101[_0x6e4f('0x1e')]+_0x3b6101[_0x6e4f('0x20')];var _0x52199c;if(_0x5d71a2>=_0x112b57){_0x5d71a2=_0x112b57;_0x52199c=0xc8;}else{_0x52199c=0xce;}_0x220b47[_0x6e4f('0x1c')](_0x52199c);return _0x220b47['set'](_0x6e4f('0x22'),_0x3fd7b3+'-'+_0x5d71a2+'/'+_0x112b57)[_0x6e4f('0x1d')](_0x325dc8);}return null;};}function patchUpdates(_0xef9977){return function(_0x18cc2b){try{jsonpatch['apply'](_0x18cc2b,_0xef9977,!![]);}catch(_0x10ba06){return BPromise[_0x6e4f('0x23')](_0x10ba06);}return _0x18cc2b[_0x6e4f('0x24')]();};}function saveUpdates(_0x2f6d35,_0x35be97){return function(_0x190649){if(_0x190649){return _0x190649[_0x6e4f('0x25')](_0x2f6d35)[_0x6e4f('0x26')](function(_0x177ffa){return _0x177ffa;});}return null;};}function removeEntity(_0x5e05d8,_0x5a7ac7){return function(_0x781d39){if(_0x781d39){return _0x781d39[_0x6e4f('0x27')]()[_0x6e4f('0x26')](function(){var _0x3d0d17=_0x781d39[_0x6e4f('0x28')]({'plain':!![]});var _0x160afa=_0x6e4f('0x29');return db['UserProfileResource'][_0x6e4f('0x27')]({'where':{'type':_0x160afa,'resourceId':_0x3d0d17['id']}})['then'](function(){return _0x781d39;});})[_0x6e4f('0x26')](function(){_0x5e05d8['status'](0xcc)[_0x6e4f('0x1b')]();});}};}function handleEntityNotFound(_0x10ebe8,_0x23094f){return function(_0x37decc){if(!_0x37decc){_0x10ebe8[_0x6e4f('0x1a')](0x194);}return _0x37decc;};}function handleError(_0x2916ec,_0x13537a){_0x13537a=_0x13537a||0x1f4;return function(_0x29fb26){logger[_0x6e4f('0x2a')](_0x29fb26[_0x6e4f('0x2b')]);if(_0x29fb26['name']){delete _0x29fb26['name'];}_0x2916ec[_0x6e4f('0x1c')](_0x13537a)[_0x6e4f('0x2c')](_0x29fb26);};}exports[_0x6e4f('0x2d')]=function(_0x5c95ab,_0x30117d){var _0x10da46={},_0x40b406={},_0x4ab42a={'count':0x0,'rows':[]};var _0x31c51e=_[_0x6e4f('0x2e')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0xdad235){return{'name':_0xdad235[_0x6e4f('0x2f')],'type':_0xdad235[_0x6e4f('0x30')]['key']};});_0x40b406['model']=_[_0x6e4f('0x2e')](_0x31c51e,_0x6e4f('0x31'));_0x40b406['query']=_[_0x6e4f('0x32')](_0x5c95ab['query']);_0x40b406[_0x6e4f('0x33')]=_[_0x6e4f('0x34')](_0x40b406[_0x6e4f('0x35')],_0x40b406[_0x6e4f('0x36')]);_0x10da46[_0x6e4f('0x37')]=_[_0x6e4f('0x34')](_0x40b406[_0x6e4f('0x35')],qs[_0x6e4f('0x38')](_0x5c95ab[_0x6e4f('0x36')]['fields']));_0x10da46['attributes']=_0x10da46[_0x6e4f('0x37')]['length']?_0x10da46[_0x6e4f('0x37')]:_0x40b406[_0x6e4f('0x35')];if(!_0x5c95ab[_0x6e4f('0x36')][_0x6e4f('0x39')]('nolimit')){_0x10da46[_0x6e4f('0x20')]=qs[_0x6e4f('0x20')](_0x5c95ab['query']['limit']);_0x10da46[_0x6e4f('0x1e')]=qs[_0x6e4f('0x1e')](_0x5c95ab[_0x6e4f('0x36')][_0x6e4f('0x1e')]);}_0x10da46[_0x6e4f('0x3a')]=qs[_0x6e4f('0x3b')](_0x5c95ab[_0x6e4f('0x36')][_0x6e4f('0x3b')]);_0x10da46['where']=qs[_0x6e4f('0x33')](_[_0x6e4f('0x3c')](_0x5c95ab[_0x6e4f('0x36')],_0x40b406[_0x6e4f('0x33')]),_0x31c51e);if(_0x5c95ab[_0x6e4f('0x36')]['filter']){_0x10da46[_0x6e4f('0x3d')]=_[_0x6e4f('0x3e')](_0x10da46[_0x6e4f('0x3d')],{'$or':_[_0x6e4f('0x2e')](_0x31c51e,function(_0x15a3f1){if(_0x15a3f1['type']!==_0x6e4f('0x3f')){var _0x2444e5={};_0x2444e5[_0x15a3f1[_0x6e4f('0x31')]]={'$like':'%'+_0x5c95ab[_0x6e4f('0x36')][_0x6e4f('0x40')]+'%'};return _0x2444e5;}})});}_0x10da46=_[_0x6e4f('0x3e')]({},_0x10da46,_0x5c95ab['options']);var _0x570257={'where':_0x10da46['where']};return db[_0x6e4f('0x41')][_0x6e4f('0x21')](_0x570257)[_0x6e4f('0x26')](function(_0x3c040e){_0x4ab42a[_0x6e4f('0x21')]=_0x3c040e;if(_0x5c95ab[_0x6e4f('0x36')][_0x6e4f('0x42')]){_0x10da46[_0x6e4f('0x43')]=[{'all':!![]}];}return db[_0x6e4f('0x41')][_0x6e4f('0x44')](_0x10da46);})[_0x6e4f('0x26')](function(_0x2f1e7d){_0x4ab42a[_0x6e4f('0x45')]=_0x2f1e7d;return _0x4ab42a;})[_0x6e4f('0x26')](respondWithFilteredResult(_0x30117d,_0x10da46))['catch'](handleError(_0x30117d,null));};exports[_0x6e4f('0x46')]=function(_0x4b5c26,_0x358993){var _0x30f134={'raw':!![],'where':{'id':_0x4b5c26[_0x6e4f('0x47')]['id']}},_0x5290b7={};_0x5290b7[_0x6e4f('0x35')]=_['keys'](db[_0x6e4f('0x41')][_0x6e4f('0x48')]);_0x5290b7[_0x6e4f('0x36')]=_[_0x6e4f('0x32')](_0x4b5c26[_0x6e4f('0x36')]);_0x5290b7[_0x6e4f('0x33')]=_[_0x6e4f('0x34')](_0x5290b7[_0x6e4f('0x35')],_0x5290b7[_0x6e4f('0x36')]);_0x30f134[_0x6e4f('0x37')]=_[_0x6e4f('0x34')](_0x5290b7[_0x6e4f('0x35')],qs[_0x6e4f('0x38')](_0x4b5c26[_0x6e4f('0x36')][_0x6e4f('0x38')]));_0x30f134['attributes']=_0x30f134[_0x6e4f('0x37')]['length']?_0x30f134[_0x6e4f('0x37')]:_0x5290b7[_0x6e4f('0x35')];if(_0x4b5c26[_0x6e4f('0x36')][_0x6e4f('0x42')]){_0x30f134[_0x6e4f('0x43')]=[{'all':!![]}];}_0x30f134=_[_0x6e4f('0x3e')]({},_0x30f134,_0x4b5c26[_0x6e4f('0x49')]);return db[_0x6e4f('0x41')][_0x6e4f('0x4a')](_0x30f134)['then'](handleEntityNotFound(_0x358993,null))['then'](respondWithResult(_0x358993,null))['catch'](handleError(_0x358993,null));};exports['create']=function(_0x5700af,_0x2be064){return db[_0x6e4f('0x41')][_0x6e4f('0x4b')](_0x5700af['body'],{})['then'](function(_0x463abf){var _0x1541cb=_0x5700af[_0x6e4f('0x4c')]['get']({'plain':!![]});if(!_0x1541cb)throw new Error(_0x6e4f('0x4d'));if(_0x1541cb[_0x6e4f('0x4e')]===_0x6e4f('0x4c')){var _0x4aad8b=_0x463abf['get']({'plain':!![]});var _0xfccbb1=_0x6e4f('0x29');return db[_0x6e4f('0x4f')][_0x6e4f('0x4a')]({'where':{'name':_0xfccbb1,'userProfileId':_0x1541cb[_0x6e4f('0x50')]},'raw':!![]})[_0x6e4f('0x26')](function(_0xfc57a){if(_0xfc57a&&_0xfc57a[_0x6e4f('0x51')]===0x0){return db[_0x6e4f('0x52')][_0x6e4f('0x4b')]({'name':_0x4aad8b[_0x6e4f('0x31')],'resourceId':_0x4aad8b['id'],'type':_0xfc57a['name'],'sectionId':_0xfc57a['id']},{})[_0x6e4f('0x26')](function(){return _0x463abf;});}else{return _0x463abf;}})[_0x6e4f('0x53')](function(_0x2b1f5c){logger['error'](_0x6e4f('0x54'),_0x2b1f5c);throw _0x2b1f5c;});}return _0x463abf;})[_0x6e4f('0x26')](respondWithResult(_0x2be064,0xc9))[_0x6e4f('0x53')](handleError(_0x2be064,null));};exports['update']=function(_0x171948,_0x5395e7){if(_0x171948[_0x6e4f('0x55')]['id']){delete _0x171948[_0x6e4f('0x55')]['id'];}return db[_0x6e4f('0x41')][_0x6e4f('0x4a')]({'where':{'id':_0x171948[_0x6e4f('0x47')]['id']}})[_0x6e4f('0x26')](handleEntityNotFound(_0x5395e7,null))[_0x6e4f('0x26')](saveUpdates(_0x171948[_0x6e4f('0x55')],null))['then'](respondWithResult(_0x5395e7,null))['catch'](handleError(_0x5395e7,null));};exports['destroy']=function(_0x6ba0d3,_0xff5cc6){return db[_0x6e4f('0x41')]['find']({'where':{'id':_0x6ba0d3[_0x6e4f('0x47')]['id']}})[_0x6e4f('0x26')](handleEntityNotFound(_0xff5cc6,null))[_0x6e4f('0x26')](removeEntity(_0xff5cc6,null))['catch'](handleError(_0xff5cc6,null));}; \ No newline at end of file +var _0x0d0c=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0xf17786,_0x22bf88){var _0x7d3eb1=function(_0x178705){while(--_0x178705){_0xf17786['push'](_0xf17786['shift']());}};_0x7d3eb1(++_0x22bf88);}(_0x0d0c,0x100));var _0xc0d0=function(_0x315e45,_0x43294c){_0x315e45=_0x315e45-0x0;var _0x578624=_0x0d0c[_0x315e45];return _0x578624;};'use strict';var emlformat=require(_0xc0d0('0x0'));var rimraf=require(_0xc0d0('0x1'));var zipdir=require(_0xc0d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc0d0('0x3'));var BPromise=require(_0xc0d0('0x4'));var Mustache=require('mustache');var util=require(_0xc0d0('0x5'));var path=require('path');var sox=require(_0xc0d0('0x6'));var csv=require(_0xc0d0('0x7'));var ejs=require(_0xc0d0('0x8'));var fs=require('fs');var fs_extra=require(_0xc0d0('0x9'));var _=require(_0xc0d0('0xa'));var squel=require(_0xc0d0('0xb'));var crypto=require(_0xc0d0('0xc'));var jsforce=require(_0xc0d0('0xd'));var deskjs=require(_0xc0d0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc0d0('0xf'));var Redis=require(_0xc0d0('0x10'));var authService=require(_0xc0d0('0x11'));var qs=require(_0xc0d0('0x12'));var as=require(_0xc0d0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0d0('0x14'))('api');var utils=require(_0xc0d0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc0d0('0x16'));var db=require(_0xc0d0('0x17'))['db'];function respondWithStatusCode(_0x5c6b4a,_0x22a732){_0x22a732=_0x22a732||0xcc;return function(_0xf602b3){if(_0xf602b3){return _0x5c6b4a[_0xc0d0('0x18')](_0x22a732);}return _0x5c6b4a[_0xc0d0('0x19')](_0x22a732)[_0xc0d0('0x1a')]();};}function respondWithResult(_0x2a5dc0,_0x2583ba){_0x2583ba=_0x2583ba||0xc8;return function(_0x3c6f51){if(_0x3c6f51){return _0x2a5dc0[_0xc0d0('0x19')](_0x2583ba)[_0xc0d0('0x1b')](_0x3c6f51);}};}function respondWithFilteredResult(_0x286867,_0x583223){return function(_0x2bffe4){if(_0x2bffe4){var _0x4fb027=typeof _0x583223[_0xc0d0('0x1c')]==='undefined'&&typeof _0x583223[_0xc0d0('0x1d')]===_0xc0d0('0x1e');var _0x37409f=_0x2bffe4[_0xc0d0('0x1f')];var _0x5aa230=_0x4fb027?0x0:_0x583223[_0xc0d0('0x1c')];var _0x1f2f2a=_0x4fb027?_0x2bffe4['count']:_0x583223['offset']+_0x583223[_0xc0d0('0x1d')];var _0x329470;if(_0x1f2f2a>=_0x37409f){_0x1f2f2a=_0x37409f;_0x329470=0xc8;}else{_0x329470=0xce;}_0x286867[_0xc0d0('0x19')](_0x329470);return _0x286867[_0xc0d0('0x20')]('Content-Range',_0x5aa230+'-'+_0x1f2f2a+'/'+_0x37409f)['json'](_0x2bffe4);}return null;};}function patchUpdates(_0x1b0922){return function(_0x1c4b5e){try{jsonpatch[_0xc0d0('0x21')](_0x1c4b5e,_0x1b0922,!![]);}catch(_0x51ed92){return BPromise[_0xc0d0('0x22')](_0x51ed92);}return _0x1c4b5e[_0xc0d0('0x23')]();};}function saveUpdates(_0x52f247,_0x55ad70){return function(_0x528875){if(_0x528875){return _0x528875['update'](_0x52f247)[_0xc0d0('0x24')](function(_0x3689c9){return _0x3689c9;});}return null;};}function removeEntity(_0x518d28,_0x169012){return function(_0x47a5de){if(_0x47a5de){return _0x47a5de[_0xc0d0('0x25')]()[_0xc0d0('0x24')](function(){var _0x48b39e=_0x47a5de[_0xc0d0('0x26')]({'plain':!![]});var _0xe46139=_0xc0d0('0x27');return db[_0xc0d0('0x28')][_0xc0d0('0x25')]({'where':{'type':_0xe46139,'resourceId':_0x48b39e['id']}})['then'](function(){return _0x47a5de;});})['then'](function(){_0x518d28[_0xc0d0('0x19')](0xcc)[_0xc0d0('0x1a')]();});}};}function handleEntityNotFound(_0x1a7aa3,_0x2e67bf){return function(_0x1cb64c){if(!_0x1cb64c){_0x1a7aa3['sendStatus'](0x194);}return _0x1cb64c;};}function handleError(_0x5a87fa,_0x317be4){_0x317be4=_0x317be4||0x1f4;return function(_0x464a00){logger[_0xc0d0('0x29')](_0x464a00[_0xc0d0('0x2a')]);if(_0x464a00[_0xc0d0('0x2b')]){delete _0x464a00[_0xc0d0('0x2b')];}_0x5a87fa[_0xc0d0('0x19')](_0x317be4)[_0xc0d0('0x2c')](_0x464a00);};}exports[_0xc0d0('0x2d')]=function(_0x59f9e7,_0x312655){var _0x9abc7b={},_0x42a2f4={},_0x1e48b4={'count':0x0,'rows':[]};var _0x56c0dc=_['map'](db[_0xc0d0('0x2e')][_0xc0d0('0x2f')],function(_0x5af89c){return{'name':_0x5af89c[_0xc0d0('0x30')],'type':_0x5af89c[_0xc0d0('0x31')][_0xc0d0('0x32')]};});_0x42a2f4[_0xc0d0('0x33')]=_[_0xc0d0('0x34')](_0x56c0dc,'name');_0x42a2f4[_0xc0d0('0x35')]=_['keys'](_0x59f9e7[_0xc0d0('0x35')]);_0x42a2f4[_0xc0d0('0x36')]=_['intersection'](_0x42a2f4['model'],_0x42a2f4[_0xc0d0('0x35')]);_0x9abc7b[_0xc0d0('0x37')]=_[_0xc0d0('0x38')](_0x42a2f4[_0xc0d0('0x33')],qs['fields'](_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x39')]));_0x9abc7b[_0xc0d0('0x37')]=_0x9abc7b[_0xc0d0('0x37')][_0xc0d0('0x3a')]?_0x9abc7b[_0xc0d0('0x37')]:_0x42a2f4[_0xc0d0('0x33')];if(!_0x59f9e7['query'][_0xc0d0('0x3b')](_0xc0d0('0x3c'))){_0x9abc7b[_0xc0d0('0x1d')]=qs[_0xc0d0('0x1d')](_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x1d')]);_0x9abc7b[_0xc0d0('0x1c')]=qs['offset'](_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x1c')]);}_0x9abc7b[_0xc0d0('0x3d')]=qs[_0xc0d0('0x3e')](_0x59f9e7['query']['sort']);_0x9abc7b[_0xc0d0('0x3f')]=qs['filters'](_['pick'](_0x59f9e7['query'],_0x42a2f4[_0xc0d0('0x36')]),_0x56c0dc);if(_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x40')]){_0x9abc7b[_0xc0d0('0x3f')]=_[_0xc0d0('0x41')](_0x9abc7b[_0xc0d0('0x3f')],{'$or':_['map'](_0x56c0dc,function(_0x285ad2){if(_0x285ad2[_0xc0d0('0x31')]!==_0xc0d0('0x42')){var _0x3bd7b9={};_0x3bd7b9[_0x285ad2[_0xc0d0('0x2b')]]={'$like':'%'+_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x40')]+'%'};return _0x3bd7b9;}})});}_0x9abc7b=_[_0xc0d0('0x41')]({},_0x9abc7b,_0x59f9e7[_0xc0d0('0x43')]);var _0x1664dc={'where':_0x9abc7b[_0xc0d0('0x3f')]};return db[_0xc0d0('0x2e')][_0xc0d0('0x1f')](_0x1664dc)[_0xc0d0('0x24')](function(_0x1000f9){_0x1e48b4[_0xc0d0('0x1f')]=_0x1000f9;if(_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x44')]){_0x9abc7b['include']=[{'all':!![]}];}return db[_0xc0d0('0x2e')][_0xc0d0('0x45')](_0x9abc7b);})[_0xc0d0('0x24')](function(_0xbcd8a6){_0x1e48b4[_0xc0d0('0x46')]=_0xbcd8a6;return _0x1e48b4;})[_0xc0d0('0x24')](respondWithFilteredResult(_0x312655,_0x9abc7b))[_0xc0d0('0x47')](handleError(_0x312655,null));};exports[_0xc0d0('0x48')]=function(_0x3565e5,_0x7fc060){var _0x578a35={'raw':!![],'where':{'id':_0x3565e5[_0xc0d0('0x49')]['id']}},_0x4b0de5={};_0x4b0de5[_0xc0d0('0x33')]=_['keys'](db[_0xc0d0('0x2e')]['rawAttributes']);_0x4b0de5['query']=_['keys'](_0x3565e5[_0xc0d0('0x35')]);_0x4b0de5[_0xc0d0('0x36')]=_[_0xc0d0('0x38')](_0x4b0de5[_0xc0d0('0x33')],_0x4b0de5[_0xc0d0('0x35')]);_0x578a35[_0xc0d0('0x37')]=_['intersection'](_0x4b0de5['model'],qs['fields'](_0x3565e5[_0xc0d0('0x35')]['fields']));_0x578a35[_0xc0d0('0x37')]=_0x578a35[_0xc0d0('0x37')][_0xc0d0('0x3a')]?_0x578a35[_0xc0d0('0x37')]:_0x4b0de5['model'];if(_0x3565e5[_0xc0d0('0x35')]['includeAll']){_0x578a35[_0xc0d0('0x4a')]=[{'all':!![]}];}_0x578a35=_[_0xc0d0('0x41')]({},_0x578a35,_0x3565e5['options']);return db[_0xc0d0('0x2e')][_0xc0d0('0x4b')](_0x578a35)[_0xc0d0('0x24')](handleEntityNotFound(_0x7fc060,null))[_0xc0d0('0x24')](respondWithResult(_0x7fc060,null))[_0xc0d0('0x47')](handleError(_0x7fc060,null));};exports[_0xc0d0('0x4c')]=function(_0x403fbe,_0xf51390){return db[_0xc0d0('0x2e')]['create'](_0x403fbe['body'],{})[_0xc0d0('0x24')](function(_0x4f6e20){var _0x1cfea4=_0x403fbe[_0xc0d0('0x4d')][_0xc0d0('0x26')]({'plain':!![]});if(!_0x1cfea4)throw new Error(_0xc0d0('0x4e'));if(_0x1cfea4['role']===_0xc0d0('0x4d')){var _0xaca22=_0x4f6e20['get']({'plain':!![]});var _0x79d375=_0xc0d0('0x27');return db[_0xc0d0('0x4f')][_0xc0d0('0x4b')]({'where':{'name':_0x79d375,'userProfileId':_0x1cfea4[_0xc0d0('0x50')]},'raw':!![]})[_0xc0d0('0x24')](function(_0x4138d1){if(_0x4138d1&&_0x4138d1[_0xc0d0('0x51')]===0x0){return db[_0xc0d0('0x28')][_0xc0d0('0x4c')]({'name':_0xaca22[_0xc0d0('0x2b')],'resourceId':_0xaca22['id'],'type':_0x4138d1[_0xc0d0('0x2b')],'sectionId':_0x4138d1['id']},{})['then'](function(){return _0x4f6e20;});}else{return _0x4f6e20;}})[_0xc0d0('0x47')](function(_0x27a6d1){logger[_0xc0d0('0x29')](_0xc0d0('0x52'),_0x27a6d1);throw _0x27a6d1;});}return _0x4f6e20;})[_0xc0d0('0x24')](respondWithResult(_0xf51390,0xc9))[_0xc0d0('0x47')](handleError(_0xf51390,null));};exports['update']=function(_0x51c85c,_0x1d28fe){if(_0x51c85c[_0xc0d0('0x53')]['id']){delete _0x51c85c[_0xc0d0('0x53')]['id'];}return db['CmHopperAdditionalPhone'][_0xc0d0('0x4b')]({'where':{'id':_0x51c85c[_0xc0d0('0x49')]['id']}})[_0xc0d0('0x24')](handleEntityNotFound(_0x1d28fe,null))[_0xc0d0('0x24')](saveUpdates(_0x51c85c[_0xc0d0('0x53')],null))[_0xc0d0('0x24')](respondWithResult(_0x1d28fe,null))[_0xc0d0('0x47')](handleError(_0x1d28fe,null));};exports[_0xc0d0('0x25')]=function(_0x1d10e1,_0x4386af){return db[_0xc0d0('0x2e')]['find']({'where':{'id':_0x1d10e1[_0xc0d0('0x49')]['id']}})[_0xc0d0('0x24')](handleEntityNotFound(_0x4386af,null))['then'](removeEntity(_0x4386af,null))[_0xc0d0('0x47')](handleError(_0x4386af,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index b6c94b0..cb93c00 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc479=['request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird'];(function(_0xc83d92,_0x1193b9){var _0x22f0f9=function(_0x11420f){while(--_0x11420f){_0xc83d92['push'](_0xc83d92['shift']());}};_0x22f0f9(++_0x1193b9);}(_0xc479,0xc7));var _0x9c47=function(_0x543523,_0x355983){_0x543523=_0x543523-0x0;var _0x298e07=_0xc479[_0x543523];return _0x298e07;};'use strict';var _=require(_0x9c47('0x0'));var util=require(_0x9c47('0x1'));var logger=require(_0x9c47('0x2'))(_0x9c47('0x3'));var moment=require('moment');var BPromise=require(_0x9c47('0x4'));var rp=require(_0x9c47('0x5'));var fs=require('fs');var path=require(_0x9c47('0x6'));var rimraf=require(_0x9c47('0x7'));var config=require('../../config/environment');var attributes=require(_0x9c47('0x8'));module[_0x9c47('0x9')]=function(_0x2b63f8,_0x27fe81){return _0x2b63f8['define'](_0x9c47('0xa'),attributes,{'tableName':_0x9c47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e3e=['moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','util','../../config/logger','api'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x1e3e,0xfa));var _0xe1e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1e3e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe1e3('0x0'));var logger=require(_0xe1e3('0x1'))(_0xe1e3('0x2'));var moment=require(_0xe1e3('0x3'));var BPromise=require(_0xe1e3('0x4'));var rp=require(_0xe1e3('0x5'));var fs=require('fs');var path=require(_0xe1e3('0x6'));var rimraf=require('rimraf');var config=require(_0xe1e3('0x7'));var attributes=require(_0xe1e3('0x8'));module[_0xe1e3('0x9')]=function(_0x21f80e,_0x18f17f){return _0x21f80e['define'](_0xe1e3('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 478d62b..64e47e1 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4732=['dialGlobalMaxRetry','countnoanswerretry','countdropretry','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','add','minutes','countbusyretry','createdAt','updatedAt','isNil','sequelize','transaction','update','IncrementPreviewCounters','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','code','CmHopperAdditionalPhone,\x20%s,\x20%s','error','message','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity'];(function(_0x1d3350,_0x2766ef){var _0x2649cc=function(_0xe135d1){while(--_0xe135d1){_0x1d3350['push'](_0x1d3350['shift']());}};_0x2649cc(++_0x2766ef);}(_0x4732,0x11b));var _0x2473=function(_0x216008,_0x2d1023){_0x216008=_0x216008-0x0;var _0x4d384f=_0x4732[_0x216008];return _0x4d384f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2473('0x0'));var BPromise=require(_0x2473('0x1'));var rs=require(_0x2473('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2473('0x3'));var logger=require(_0x2473('0x4'))('rpc');var config=require(_0x2473('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2473('0x6')][_0x2473('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ccc10,_0x57912c,_0x513645){return new BPromise(function(_0x38b529,_0x175606){return client['request'](_0x4ccc10,_0x513645)[_0x2473('0x8')](function(_0x3ddfb2){logger[_0x2473('0x9')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x57912c,_0x2473('0xa'));logger['debug'](_0x2473('0xb'),_0x57912c,_0x2473('0xa'),JSON[_0x2473('0xc')](_0x3ddfb2));if(_0x3ddfb2['error']){if(_0x3ddfb2['error'][_0x2473('0xd')]===0x1f4){logger['error'](_0x2473('0xe'),_0x57912c,_0x3ddfb2[_0x2473('0xf')][_0x2473('0x10')]);return _0x175606(_0x3ddfb2['error'][_0x2473('0x10')]);}logger[_0x2473('0xf')](_0x2473('0xe'),_0x57912c,_0x3ddfb2[_0x2473('0xf')][_0x2473('0x10')]);return _0x38b529(_0x3ddfb2[_0x2473('0xf')][_0x2473('0x10')]);}else{logger[_0x2473('0x9')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x57912c,_0x2473('0xa'));_0x38b529(_0x3ddfb2[_0x2473('0x11')][_0x2473('0x10')]);}})[_0x2473('0x12')](function(_0x529937){logger[_0x2473('0xf')](_0x2473('0xe'),_0x57912c,_0x529937);_0x175606(_0x529937);});});}exports[_0x2473('0x13')]=function(_0x480b7b){var _0x50d476=this;return new Promise(function(_0x3b5333,_0x4e196c){return db['CmHopper'][_0x2473('0x14')]({'raw':!![],'where':{'ContactId':_0x480b7b[_0x2473('0x15')][_0x2473('0x16')],'ListId':_0x480b7b['body'][_0x2473('0x17')],'VoiceQueueId':_0x480b7b[_0x2473('0x15')][_0x2473('0x18')]===undefined?null:_0x480b7b[_0x2473('0x15')]['VoiceQueueId'],'CampaignId':_0x480b7b[_0x2473('0x15')][_0x2473('0x19')]===undefined?null:_0x480b7b[_0x2473('0x15')]['CampaignId']}})[_0x2473('0x8')](function(_0x3f93d2){if(_0x3f93d2!=null){return db[_0x2473('0x1a')][_0x2473('0x14')]({'raw':!![],'where':{'CmHopperId':_0x3f93d2['id'],'OrderBy':{'$gt':_0x3f93d2['OrderBy']}},'order':[[_0x2473('0x1b'),_0x2473('0x1c')]]})[_0x2473('0x8')](function(_0x55d4f6){var _0x352da3=0x0;if(_0x55d4f6){if(_0x55d4f6['countbusyretry']+_0x55d4f6[_0x2473('0x1d')]+_0x55d4f6['countnoanswerretry']+_0x55d4f6[_0x2473('0x1e')]+_0x55d4f6['countdropretry']+_0x55d4f6[_0x2473('0x1f')]+_0x55d4f6[_0x2473('0x20')]+_0x55d4f6[_0x2473('0x21')]<_0x480b7b[_0x2473('0x22')][_0x2473('0x23')])_0x352da3=0x1;_0x3b5333({'additional':_0x352da3});}else{return db['CmHopperAdditionalPhone'][_0x2473('0x14')]({'raw':!![],'where':{'CmHopperId':_0x3f93d2['id']},'order':[['OrderBy',_0x2473('0x1c')]]})[_0x2473('0x8')](function(_0x407c3c){var _0x15bf97=0x0;if(_0x407c3c){if(_0x407c3c['countbusyretry']+_0x407c3c['countcongestionretry']+_0x407c3c[_0x2473('0x24')]+_0x407c3c[_0x2473('0x1e')]+_0x407c3c[_0x2473('0x25')]+_0x407c3c[_0x2473('0x1f')]+_0x407c3c['countmachineretry']+_0x407c3c[_0x2473('0x21')]<_0x480b7b[_0x2473('0x22')][_0x2473('0x23')])_0x15bf97=0x1;_0x3b5333({'additional':_0x15bf97});}else{_0x3b5333({'additional':0x0});}})[_0x2473('0x12')](function(_0x5b5af0){logger[_0x2473('0xf')](_0x2473('0x13'),_0x5b5af0['message']);_0x4e196c(_0x50d476[_0x2473('0xf')](0x1f4,_0x5b5af0['message']));});}})['catch'](function(_0x5f4454){logger[_0x2473('0xf')](_0x2473('0x13'),_0x5f4454[_0x2473('0x10')]);_0x4e196c(_0x50d476[_0x2473('0xf')](0x1f4,_0x5f4454[_0x2473('0x10')]));});}else _0x3b5333({'additional':0x0});});});};exports[_0x2473('0x26')]=function(_0x3a7a98){var _0x168da2=this;return new Promise(function(_0x340e1d,_0x11eac5){return db[_0x2473('0x27')][_0x2473('0x14')]({'raw':!![],'where':{'ContactId':_0x3a7a98[_0x2473('0x15')]['ContactId'],'ListId':_0x3a7a98[_0x2473('0x15')][_0x2473('0x17')],'VoiceQueueId':_0x3a7a98[_0x2473('0x15')][_0x2473('0x18')]===undefined?null:_0x3a7a98[_0x2473('0x15')]['VoiceQueueId'],'CampaignId':_0x3a7a98['body'][_0x2473('0x19')]===undefined?null:_0x3a7a98[_0x2473('0x15')][_0x2473('0x19')]}})[_0x2473('0x8')](function(_0x2516c7){if(_0x2516c7!=null){return db[_0x2473('0x1a')][_0x2473('0x14')]({'raw':!![],'where':{'CmHopperId':_0x2516c7['id'],'OrderBy':{'$gte':_0x2516c7['OrderBy']}},'order':[['OrderBy','ASC']]})['then'](function(_0x40e96b){if(_0x40e96b)return activateAdditionalPhone(_0x2516c7,_0x3a7a98[_0x2473('0x15')],_0x40e96b,_0x3a7a98[_0x2473('0x28')],_0x3a7a98[_0x2473('0x29')])[_0x2473('0x8')](function(_0x7e29d3){_0x340e1d(_0x7e29d3);});else{return db[_0x2473('0x1a')][_0x2473('0x14')]({'raw':!![],'where':{'CmHopperId':_0x2516c7['id']},'order':[['OrderBy',_0x2473('0x1c')]]})['then'](function(_0x43c3e6){if(_0x43c3e6)return activateAdditionalPhone(_0x2516c7,_0x3a7a98[_0x2473('0x15')],_0x43c3e6,_0x3a7a98['duration'],_0x3a7a98['waitTime'])['then'](function(_0x309bac){_0x340e1d(_0x309bac);});else{_0x340e1d({'id':_0x2516c7['id'],'phone':''});}})[_0x2473('0x12')](function(_0x381d50){logger['error'](_0x2473('0x13'),_0x381d50['message']);_0x11eac5(_0x168da2[_0x2473('0xf')](0x1f4,_0x381d50[_0x2473('0x10')]));});}})[_0x2473('0x12')](function(_0x347ea0){logger[_0x2473('0xf')](_0x2473('0x13'),_0x347ea0[_0x2473('0x10')]);_0x11eac5(_0x168da2[_0x2473('0xf')](0x1f4,_0x347ea0[_0x2473('0x10')]));});}else _0x340e1d(0x1);});});};function activateAdditionalPhone(_0x290888,_0x19c20d,_0x418972,_0x182014,_0xfa8d97){return new Promise(function(_0x991acd,_0x59ba60){var _0x3cb2c0;if(_['isNil'](_0x418972[_0x2473('0x2a')])){_0x418972['scheduledat']=moment();}if(moment()>moment(_0x418972['scheduledat'])){_0x3cb2c0=moment()[_0x2473('0x2b')](_0xfa8d97||0x3,_0x2473('0x2c'));}else{if(_0x418972[_0x2473('0x1b')]==0x0){_0x3cb2c0=moment(_0x418972[_0x2473('0x2a')]);}else{_0x3cb2c0=moment()[_0x2473('0x2b')](_0xfa8d97||0x3,_0x2473('0x2c'));}}if(_['isNil'](_0x3cb2c0)){_0x3cb2c0=moment()[_0x2473('0x2b')](_0xfa8d97||0x3,'minutes');}var _0x857276={'phone':_0x290888['phone'],'active':0x0,'OrderBy':_['isNil'](_0x290888[_0x2473('0x1b')])?0x0:_0x290888[_0x2473('0x1b')],'scheduledat':moment()[_0x2473('0x2b')](_0x182014||0x1,_0x2473('0x2c')),'countbusyretry':_0x19c20d[_0x2473('0x2d')],'countcongestionretry':_0x19c20d[_0x2473('0x1d')],'countnoanswerretry':_0x19c20d[_0x2473('0x24')],'countnosuchnumberretry':_0x19c20d[_0x2473('0x1e')],'countdropretry':_0x19c20d[_0x2473('0x25')],'countabandonedretry':_0x19c20d[_0x2473('0x1f')],'countmachineretry':_0x19c20d[_0x2473('0x20')],'countagentrejectretry':_0x19c20d[_0x2473('0x21')],'createdAt':_0x19c20d[_0x2473('0x2e')],'updatedAt':_0x19c20d[_0x2473('0x2f')]};var _0x263e7f={'CmHopperId':_0x290888['id'],'phone':_0x418972['phone'],'active':0x0,'OrderBy':_[_0x2473('0x30')](_0x418972[_0x2473('0x1b')])?0x0:_0x418972[_0x2473('0x1b')],'scheduledat':_0x3cb2c0,'countbusyretry':_0x418972['countbusyretry'],'countcongestionretry':_0x418972[_0x2473('0x1d')],'countnoanswerretry':_0x418972[_0x2473('0x24')],'countnosuchnumberretry':_0x418972[_0x2473('0x1e')],'countdropretry':_0x418972[_0x2473('0x25')],'countabandonedretry':_0x418972[_0x2473('0x1f')],'countmachineretry':_0x418972['countmachineretry'],'countagentrejectretry':_0x418972['countagentrejectretry'],'createdAt':_0x418972['createdAt'],'updatedAt':_0x418972['updatedAt']};return db[_0x2473('0x31')][_0x2473('0x32')](function(_0x3991d7){return db['CmHopperAdditionalPhone'][_0x2473('0x33')](_0x857276,{'where':{'id':_0x418972['id']}},{'transaction':_0x3991d7})[_0x2473('0x8')](function(){return db[_0x2473('0x27')]['update'](_0x263e7f,{'where':{'id':_0x290888['id']}},{'transaction':_0x3991d7});});})['then'](function(_0x21b694){_0x991acd({'id':_0x290888['id'],'phone':_0x418972['phone']});})[_0x2473('0x12')](function(_0xa529cf){logger['error']('activateAdditionalPhone',_0xa529cf[_0x2473('0x10')]);_0x59ba60({'error':_0xa529cf[_0x2473('0x10')]});});});}exports[_0x2473('0x34')]=function(_0x393dca){var _0x20cafe=this;return new Promise(function(_0x368739,_0x11cb0f){return db[_0x2473('0x27')][_0x2473('0x33')](_0x393dca[_0x2473('0x15')]['field'],{'where':{'id':_0x393dca[_0x2473('0x15')]['id']}})[_0x2473('0x8')](function(_0x4f1534){_0x368739(_0x4f1534);})[_0x2473('0x12')](function(_0x28a245){logger[_0x2473('0xf')](_0x2473('0x34'),_0x28a245['message']);_0x11cb0f(_0x20cafe[_0x2473('0xf')](0x1f4,_0x28a245[_0x2473('0x10')]));});});}; \ No newline at end of file +var _0x0758=['CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countnosuchnumberretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','updatedAt','sequelize','update','activateAdditionalPhone','field','IncrementPreviewCounters','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ccb8d,_0x529c1a){var _0x39d361=function(_0x28f512){while(--_0x28f512){_0x1ccb8d['push'](_0x1ccb8d['shift']());}};_0x39d361(++_0x529c1a);}(_0x0758,0x18b));var _0x8075=function(_0xc7bcf7,_0x11b0f8){_0xc7bcf7=_0xc7bcf7-0x0;var _0x214f24=_0x0758[_0xc7bcf7];return _0x214f24;};'use strict';var _=require('lodash');var util=require(_0x8075('0x0'));var moment=require(_0x8075('0x1'));var BPromise=require(_0x8075('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8075('0x3'));var db=require(_0x8075('0x4'))['db'];var utils=require(_0x8075('0x5'));var logger=require(_0x8075('0x6'))(_0x8075('0x7'));var config=require(_0x8075('0x8'));var jayson=require(_0x8075('0x9'));var client=jayson[_0x8075('0xa')][_0x8075('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47c069,_0x5e0bf5,_0xb15836){return new BPromise(function(_0x3c706f,_0x288faa){return client[_0x8075('0xc')](_0x47c069,_0xb15836)[_0x8075('0xd')](function(_0x2005b0){logger[_0x8075('0xe')](_0x8075('0xf'),_0x5e0bf5,_0x8075('0x10'));logger[_0x8075('0x11')](_0x8075('0x12'),_0x5e0bf5,'request\x20sent',JSON[_0x8075('0x13')](_0x2005b0));if(_0x2005b0['error']){if(_0x2005b0[_0x8075('0x14')][_0x8075('0x15')]===0x1f4){logger[_0x8075('0x14')](_0x8075('0xf'),_0x5e0bf5,_0x2005b0['error']['message']);return _0x288faa(_0x2005b0[_0x8075('0x14')][_0x8075('0x16')]);}logger[_0x8075('0x14')](_0x8075('0xf'),_0x5e0bf5,_0x2005b0['error']['message']);return _0x3c706f(_0x2005b0[_0x8075('0x14')][_0x8075('0x16')]);}else{logger[_0x8075('0xe')](_0x8075('0xf'),_0x5e0bf5,'request\x20sent');_0x3c706f(_0x2005b0['result']['message']);}})[_0x8075('0x17')](function(_0x203dbb){logger[_0x8075('0x14')](_0x8075('0xf'),_0x5e0bf5,_0x203dbb);_0x288faa(_0x203dbb);});});}exports[_0x8075('0x18')]=function(_0x46df39){var _0x1c75dd=this;return new Promise(function(_0x269121,_0x273d41){return db[_0x8075('0x19')][_0x8075('0x1a')]({'raw':!![],'where':{'ContactId':_0x46df39[_0x8075('0x1b')][_0x8075('0x1c')],'ListId':_0x46df39[_0x8075('0x1b')][_0x8075('0x1d')],'VoiceQueueId':_0x46df39[_0x8075('0x1b')][_0x8075('0x1e')]===undefined?null:_0x46df39['body'][_0x8075('0x1e')],'CampaignId':_0x46df39[_0x8075('0x1b')][_0x8075('0x1f')]===undefined?null:_0x46df39[_0x8075('0x1b')][_0x8075('0x1f')]}})['then'](function(_0x46361d){if(_0x46361d!=null){return db[_0x8075('0x20')][_0x8075('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x46361d['id'],'OrderBy':{'$gt':_0x46361d['OrderBy']}},'order':[[_0x8075('0x21'),_0x8075('0x22')]]})[_0x8075('0xd')](function(_0x4c3e56){var _0x5cd0=0x0;if(_0x4c3e56){if(_0x4c3e56[_0x8075('0x23')]+_0x4c3e56[_0x8075('0x24')]+_0x4c3e56[_0x8075('0x25')]+_0x4c3e56['countnosuchnumberretry']+_0x4c3e56[_0x8075('0x26')]+_0x4c3e56[_0x8075('0x27')]+_0x4c3e56[_0x8075('0x28')]+_0x4c3e56[_0x8075('0x29')]<_0x46df39[_0x8075('0x2a')]['dialGlobalMaxRetry'])_0x5cd0=0x1;_0x269121({'additional':_0x5cd0});}else{return db['CmHopperAdditionalPhone'][_0x8075('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x46361d['id']},'order':[[_0x8075('0x21'),_0x8075('0x22')]]})[_0x8075('0xd')](function(_0x2df049){var _0x48fc9f=0x0;if(_0x2df049){if(_0x2df049[_0x8075('0x23')]+_0x2df049[_0x8075('0x24')]+_0x2df049[_0x8075('0x25')]+_0x2df049[_0x8075('0x2b')]+_0x2df049[_0x8075('0x26')]+_0x2df049['countabandonedretry']+_0x2df049[_0x8075('0x28')]+_0x2df049[_0x8075('0x29')]<_0x46df39[_0x8075('0x2a')][_0x8075('0x2c')])_0x48fc9f=0x1;_0x269121({'additional':_0x48fc9f});}else{_0x269121({'additional':0x0});}})[_0x8075('0x17')](function(_0x1c7d4b){logger['error'](_0x8075('0x18'),_0x1c7d4b[_0x8075('0x16')]);_0x273d41(_0x1c75dd[_0x8075('0x14')](0x1f4,_0x1c7d4b[_0x8075('0x16')]));});}})[_0x8075('0x17')](function(_0x1ed9bc){logger[_0x8075('0x14')](_0x8075('0x18'),_0x1ed9bc[_0x8075('0x16')]);_0x273d41(_0x1c75dd[_0x8075('0x14')](0x1f4,_0x1ed9bc[_0x8075('0x16')]));});}else _0x269121({'additional':0x0});});});};exports[_0x8075('0x2d')]=function(_0x28e3f9){var _0x53709c=this;return new Promise(function(_0x24b964,_0x37f7e8){return db['CmHopper'][_0x8075('0x1a')]({'raw':!![],'where':{'ContactId':_0x28e3f9[_0x8075('0x1b')][_0x8075('0x1c')],'ListId':_0x28e3f9[_0x8075('0x1b')][_0x8075('0x1d')],'VoiceQueueId':_0x28e3f9[_0x8075('0x1b')]['VoiceQueueId']===undefined?null:_0x28e3f9[_0x8075('0x1b')]['VoiceQueueId'],'CampaignId':_0x28e3f9[_0x8075('0x1b')][_0x8075('0x1f')]===undefined?null:_0x28e3f9['body']['CampaignId']}})['then'](function(_0x637c1d){if(_0x637c1d!=null){return db[_0x8075('0x20')][_0x8075('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x637c1d['id'],'OrderBy':{'$gte':_0x637c1d[_0x8075('0x21')]}},'order':[[_0x8075('0x21'),_0x8075('0x22')]]})[_0x8075('0xd')](function(_0x55a276){if(_0x55a276)return activateAdditionalPhone(_0x637c1d,_0x28e3f9[_0x8075('0x1b')],_0x55a276,_0x28e3f9[_0x8075('0x2e')],_0x28e3f9[_0x8075('0x2f')])['then'](function(_0x3fc6b1){_0x24b964(_0x3fc6b1);});else{return db[_0x8075('0x20')][_0x8075('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x637c1d['id']},'order':[['OrderBy',_0x8075('0x22')]]})['then'](function(_0xf40a98){if(_0xf40a98)return activateAdditionalPhone(_0x637c1d,_0x28e3f9[_0x8075('0x1b')],_0xf40a98,_0x28e3f9[_0x8075('0x2e')],_0x28e3f9[_0x8075('0x2f')])[_0x8075('0xd')](function(_0x2a708e){_0x24b964(_0x2a708e);});else{_0x24b964({'id':_0x637c1d['id'],'phone':''});}})[_0x8075('0x17')](function(_0x128414){logger[_0x8075('0x14')](_0x8075('0x18'),_0x128414[_0x8075('0x16')]);_0x37f7e8(_0x53709c[_0x8075('0x14')](0x1f4,_0x128414['message']));});}})['catch'](function(_0xb101e9){logger[_0x8075('0x14')](_0x8075('0x18'),_0xb101e9['message']);_0x37f7e8(_0x53709c[_0x8075('0x14')](0x1f4,_0xb101e9[_0x8075('0x16')]));});}else _0x24b964(0x1);});});};function activateAdditionalPhone(_0x4b92b7,_0x5d743a,_0x3ee3cb,_0x3b75ef,_0x5ee476){return new Promise(function(_0x3a72d9,_0x150266){var _0xb842fc;if(_['isNil'](_0x3ee3cb[_0x8075('0x30')])){_0x3ee3cb['scheduledat']=moment();}if(moment()>moment(_0x3ee3cb[_0x8075('0x30')])){_0xb842fc=moment()[_0x8075('0x31')](_0x5ee476||0x3,_0x8075('0x32'));}else{if(_0x3ee3cb['OrderBy']==0x0){_0xb842fc=moment(_0x3ee3cb[_0x8075('0x30')]);}else{_0xb842fc=moment()[_0x8075('0x31')](_0x5ee476||0x3,_0x8075('0x32'));}}if(_['isNil'](_0xb842fc)){_0xb842fc=moment()[_0x8075('0x31')](_0x5ee476||0x3,_0x8075('0x32'));}var _0x30cd27={'phone':_0x4b92b7[_0x8075('0x33')],'active':0x0,'OrderBy':_[_0x8075('0x34')](_0x4b92b7['OrderBy'])?0x0:_0x4b92b7['OrderBy'],'scheduledat':moment()[_0x8075('0x31')](_0x3b75ef||0x1,_0x8075('0x32')),'countbusyretry':_0x5d743a[_0x8075('0x23')],'countcongestionretry':_0x5d743a[_0x8075('0x24')],'countnoanswerretry':_0x5d743a['countnoanswerretry'],'countnosuchnumberretry':_0x5d743a[_0x8075('0x2b')],'countdropretry':_0x5d743a['countdropretry'],'countabandonedretry':_0x5d743a[_0x8075('0x27')],'countmachineretry':_0x5d743a[_0x8075('0x28')],'countagentrejectretry':_0x5d743a['countagentrejectretry'],'createdAt':_0x5d743a['createdAt'],'updatedAt':_0x5d743a['updatedAt']};var _0x468534={'CmHopperId':_0x4b92b7['id'],'phone':_0x3ee3cb[_0x8075('0x33')],'active':0x0,'OrderBy':_[_0x8075('0x34')](_0x3ee3cb['OrderBy'])?0x0:_0x3ee3cb[_0x8075('0x21')],'scheduledat':_0xb842fc,'countbusyretry':_0x3ee3cb[_0x8075('0x23')],'countcongestionretry':_0x3ee3cb['countcongestionretry'],'countnoanswerretry':_0x3ee3cb['countnoanswerretry'],'countnosuchnumberretry':_0x3ee3cb[_0x8075('0x2b')],'countdropretry':_0x3ee3cb[_0x8075('0x26')],'countabandonedretry':_0x3ee3cb[_0x8075('0x27')],'countmachineretry':_0x3ee3cb['countmachineretry'],'countagentrejectretry':_0x3ee3cb['countagentrejectretry'],'createdAt':_0x3ee3cb['createdAt'],'updatedAt':_0x3ee3cb[_0x8075('0x35')]};return db[_0x8075('0x36')]['transaction'](function(_0x3e260f){return db[_0x8075('0x20')][_0x8075('0x37')](_0x30cd27,{'where':{'id':_0x3ee3cb['id']}},{'transaction':_0x3e260f})[_0x8075('0xd')](function(){return db['CmHopper'][_0x8075('0x37')](_0x468534,{'where':{'id':_0x4b92b7['id']}},{'transaction':_0x3e260f});});})['then'](function(_0x102825){_0x3a72d9({'id':_0x4b92b7['id'],'phone':_0x3ee3cb[_0x8075('0x33')]});})[_0x8075('0x17')](function(_0x39c3a1){logger[_0x8075('0x14')](_0x8075('0x38'),_0x39c3a1['message']);_0x150266({'error':_0x39c3a1[_0x8075('0x16')]});});});}exports['IncrementPreviewCounters']=function(_0x44cf37){var _0x201195=this;return new Promise(function(_0x1e27af,_0x18870e){return db['CmHopper'][_0x8075('0x37')](_0x44cf37[_0x8075('0x1b')][_0x8075('0x39')],{'where':{'id':_0x44cf37[_0x8075('0x1b')]['id']}})[_0x8075('0xd')](function(_0x395675){_0x1e27af(_0x395675);})[_0x8075('0x17')](function(_0x3e0bf9){logger[_0x8075('0x14')](_0x8075('0x3a'),_0x3e0bf9[_0x8075('0x16')]);_0x18870e(_0x201195[_0x8075('0x14')](0x1f4,_0x3e0bf9[_0x8075('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index f0b6ebd..5616a25 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa769=['fs-extra','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','exports','multer','path','connect-timeout','express'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa769,0xfb));var _0x9a76=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa769[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x9a76('0x0'));var util=require('util');var path=require(_0x9a76('0x1'));var timeout=require(_0x9a76('0x2'));var express=require(_0x9a76('0x3'));var router=express['Router']();var fs_extra=require(_0x9a76('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a76('0x5'));var controller=require(_0x9a76('0x6'));router['get']('/',auth[_0x9a76('0x7')](),controller[_0x9a76('0x8')]);router[_0x9a76('0x9')](_0x9a76('0xa'),auth[_0x9a76('0x7')](),controller[_0x9a76('0xb')]);router[_0x9a76('0xc')]('/',auth['isAuthenticated'](),controller[_0x9a76('0xd')]);router[_0x9a76('0xe')](_0x9a76('0xa'),auth[_0x9a76('0x7')](),controller['update']);router['delete'](_0x9a76('0xa'),auth['isAuthenticated'](),controller[_0x9a76('0xf')]);module[_0x9a76('0x10')]=router; \ No newline at end of file +var _0x4bf2=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4bf2,0xa3));var _0x24bf=function(_0xe3b7bb,_0x263836){_0xe3b7bb=_0xe3b7bb-0x0;var _0x2df486=_0x4bf2[_0xe3b7bb];return _0x2df486;};'use strict';var multer=require('multer');var util=require(_0x24bf('0x0'));var path=require(_0x24bf('0x1'));var timeout=require(_0x24bf('0x2'));var express=require(_0x24bf('0x3'));var router=express[_0x24bf('0x4')]();var fs_extra=require(_0x24bf('0x5'));var auth=require(_0x24bf('0x6'));var interaction=require(_0x24bf('0x7'));var config=require(_0x24bf('0x8'));var controller=require(_0x24bf('0x9'));router['get']('/',auth[_0x24bf('0xa')](),controller['index']);router['get'](_0x24bf('0xb'),auth[_0x24bf('0xa')](),controller[_0x24bf('0xc')]);router['post']('/',auth[_0x24bf('0xa')](),controller[_0x24bf('0xd')]);router[_0x24bf('0xe')](_0x24bf('0xb'),auth['isAuthenticated'](),controller[_0x24bf('0xf')]);router[_0x24bf('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x24bf('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f5a749c..8a73324 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 _0x71ab=['sequelize','STRING','contactListQueue','INTEGER'];(function(_0x33adeb,_0x2a9393){var _0x579bed=function(_0x429cde){while(--_0x429cde){_0x33adeb['push'](_0x33adeb['shift']());}};_0x579bed(++_0x2a9393);}(_0x71ab,0x64));var _0xb71a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71ab[_0x126558];return _0x1f6d14;};'use strict';var moment=require('moment');var Sequelize=require(_0xb71a('0x0'));module['exports']={'phone':{'type':Sequelize[_0xb71a('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xb71a('0x2')},'ListId':{'type':Sequelize[_0xb71a('0x3')],'unique':_0xb71a('0x2')},'VoiceQueueId':{'type':Sequelize[_0xb71a('0x3')],'unique':_0xb71a('0x2')}}; \ No newline at end of file +var _0x6363=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x243011,_0x2be6dc){var _0x5eb4c0=function(_0x1c5cff){while(--_0x1c5cff){_0x243011['push'](_0x243011['shift']());}};_0x5eb4c0(++_0x2be6dc);}(_0x6363,0x13a));var _0x3636=function(_0x13b15e,_0x45fe46){_0x13b15e=_0x13b15e-0x0;var _0x2ef81c=_0x6363[_0x13b15e];return _0x2ef81c;};'use strict';var moment=require(_0x3636('0x0'));var Sequelize=require('sequelize');module[_0x3636('0x1')]={'phone':{'type':Sequelize[_0x3636('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3636('0x3')],'unique':_0x3636('0x4')},'ListId':{'type':Sequelize[_0x3636('0x3')],'unique':_0x3636('0x4')},'VoiceQueueId':{'type':Sequelize[_0x3636('0x3')],'unique':_0x3636('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2a80b2a..f6c37cb 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 _0xdb00=['fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x127394,_0x66443b){var _0x557fd9=function(_0x3a2043){while(--_0x3a2043){_0x127394['push'](_0x127394['shift']());}};_0x557fd9(++_0x66443b);}(_0xdb00,0xd4));var _0x0db0=function(_0x1978cf,_0x106e44){_0x1978cf=_0x1978cf-0x0;var _0x7ec3f5=_0xdb00[_0x1978cf];return _0x7ec3f5;};'use strict';var emlformat=require(_0x0db0('0x0'));var rimraf=require(_0x0db0('0x1'));var zipdir=require(_0x0db0('0x2'));var jsonpatch=require(_0x0db0('0x3'));var rp=require(_0x0db0('0x4'));var moment=require(_0x0db0('0x5'));var BPromise=require(_0x0db0('0x6'));var Mustache=require(_0x0db0('0x7'));var util=require(_0x0db0('0x8'));var path=require(_0x0db0('0x9'));var sox=require(_0x0db0('0xa'));var csv=require(_0x0db0('0xb'));var ejs=require(_0x0db0('0xc'));var fs=require('fs');var fs_extra=require(_0x0db0('0xd'));var _=require(_0x0db0('0xe'));var squel=require(_0x0db0('0xf'));var crypto=require('crypto');var jsforce=require(_0x0db0('0x10'));var deskjs=require(_0x0db0('0x11'));var toCsv=require(_0x0db0('0xb'));var querystring=require(_0x0db0('0x12'));var Papa=require('papaparse');var Redis=require(_0x0db0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0db0('0x14'));var as=require(_0x0db0('0x15'));var hardwareService=require(_0x0db0('0x16'));var logger=require(_0x0db0('0x17'))(_0x0db0('0x18'));var utils=require(_0x0db0('0x19'));var config=require(_0x0db0('0x1a'));var licenseUtil=require(_0x0db0('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1292c6,_0x5788b4){_0x5788b4=_0x5788b4||0xcc;return function(_0x1a8b5c){if(_0x1a8b5c){return _0x1292c6[_0x0db0('0x1c')](_0x5788b4);}return _0x1292c6[_0x0db0('0x1d')](_0x5788b4)['end']();};}function respondWithResult(_0x409ee4,_0x1cad2a){_0x1cad2a=_0x1cad2a||0xc8;return function(_0x90c02e){if(_0x90c02e){return _0x409ee4[_0x0db0('0x1d')](_0x1cad2a)[_0x0db0('0x1e')](_0x90c02e);}};}function respondWithFilteredResult(_0x4e1bef,_0x423e4b){return function(_0x27e15d){if(_0x27e15d){var _0x158a83=typeof _0x423e4b[_0x0db0('0x1f')]==='undefined'&&typeof _0x423e4b[_0x0db0('0x20')]==='undefined';var _0x3be718=_0x27e15d[_0x0db0('0x21')];var _0xc138a8=_0x158a83?0x0:_0x423e4b['offset'];var _0x33c181=_0x158a83?_0x27e15d[_0x0db0('0x21')]:_0x423e4b[_0x0db0('0x1f')]+_0x423e4b['limit'];var _0x22aeae;if(_0x33c181>=_0x3be718){_0x33c181=_0x3be718;_0x22aeae=0xc8;}else{_0x22aeae=0xce;}_0x4e1bef['status'](_0x22aeae);return _0x4e1bef['set'](_0x0db0('0x22'),_0xc138a8+'-'+_0x33c181+'/'+_0x3be718)[_0x0db0('0x1e')](_0x27e15d);}return null;};}function patchUpdates(_0x9394bd){return function(_0x16993d){try{jsonpatch['apply'](_0x16993d,_0x9394bd,!![]);}catch(_0x7f85b3){return BPromise[_0x0db0('0x23')](_0x7f85b3);}return _0x16993d['save']();};}function saveUpdates(_0x44d63b,_0x37e292){return function(_0x5d731d){if(_0x5d731d){return _0x5d731d[_0x0db0('0x24')](_0x44d63b)[_0x0db0('0x25')](function(_0x243960){return _0x243960;});}return null;};}function removeEntity(_0x1a25e2,_0x2dfc15){return function(_0x53aa31){if(_0x53aa31){return _0x53aa31[_0x0db0('0x26')]()['then'](function(){_0x1a25e2[_0x0db0('0x1d')](0xcc)[_0x0db0('0x27')]();});}};}function handleEntityNotFound(_0x385ebf,_0x21cf38){return function(_0x335c81){if(!_0x335c81){_0x385ebf[_0x0db0('0x1c')](0x194);}return _0x335c81;};}function handleError(_0xc2a1c7,_0x173cd7){_0x173cd7=_0x173cd7||0x1f4;return function(_0x221943){logger[_0x0db0('0x28')](_0x221943[_0x0db0('0x29')]);if(_0x221943[_0x0db0('0x2a')]){delete _0x221943[_0x0db0('0x2a')];}_0xc2a1c7['status'](_0x173cd7)[_0x0db0('0x2b')](_0x221943);};}exports[_0x0db0('0x2c')]=function(_0x36aeb0,_0x37b84f){var _0x415997={},_0x34d756={},_0x3d032d={'count':0x0,'rows':[]};var _0x47a0e4=_[_0x0db0('0x2d')](db[_0x0db0('0x2e')][_0x0db0('0x2f')],function(_0x39c593){return{'name':_0x39c593[_0x0db0('0x30')],'type':_0x39c593[_0x0db0('0x31')][_0x0db0('0x32')]};});_0x34d756[_0x0db0('0x33')]=_[_0x0db0('0x2d')](_0x47a0e4,_0x0db0('0x2a'));_0x34d756[_0x0db0('0x34')]=_[_0x0db0('0x35')](_0x36aeb0[_0x0db0('0x34')]);_0x34d756[_0x0db0('0x36')]=_[_0x0db0('0x37')](_0x34d756['model'],_0x34d756['query']);_0x415997[_0x0db0('0x38')]=_[_0x0db0('0x37')](_0x34d756[_0x0db0('0x33')],qs[_0x0db0('0x39')](_0x36aeb0[_0x0db0('0x34')][_0x0db0('0x39')]));_0x415997[_0x0db0('0x38')]=_0x415997[_0x0db0('0x38')][_0x0db0('0x3a')]?_0x415997[_0x0db0('0x38')]:_0x34d756[_0x0db0('0x33')];if(!_0x36aeb0['query'][_0x0db0('0x3b')](_0x0db0('0x3c'))){_0x415997[_0x0db0('0x20')]=qs[_0x0db0('0x20')](_0x36aeb0[_0x0db0('0x34')][_0x0db0('0x20')]);_0x415997[_0x0db0('0x1f')]=qs[_0x0db0('0x1f')](_0x36aeb0['query']['offset']);}_0x415997[_0x0db0('0x3d')]=qs[_0x0db0('0x3e')](_0x36aeb0['query']['sort']);_0x415997['where']=qs[_0x0db0('0x36')](_['pick'](_0x36aeb0[_0x0db0('0x34')],_0x34d756['filters']),_0x47a0e4);if(_0x36aeb0[_0x0db0('0x34')]['filter']){_0x415997[_0x0db0('0x3f')]=_[_0x0db0('0x40')](_0x415997['where'],{'$or':_[_0x0db0('0x2d')](_0x47a0e4,function(_0x31b903){if(_0x31b903[_0x0db0('0x31')]!=='VIRTUAL'){var _0x54f638={};_0x54f638[_0x31b903[_0x0db0('0x2a')]]={'$like':'%'+_0x36aeb0[_0x0db0('0x34')]['filter']+'%'};return _0x54f638;}})});}_0x415997=_[_0x0db0('0x40')]({},_0x415997,_0x36aeb0[_0x0db0('0x41')]);var _0x11a21a={'where':_0x415997[_0x0db0('0x3f')]};return db[_0x0db0('0x2e')]['count'](_0x11a21a)[_0x0db0('0x25')](function(_0x48a240){_0x3d032d[_0x0db0('0x21')]=_0x48a240;if(_0x36aeb0[_0x0db0('0x34')][_0x0db0('0x42')]){_0x415997[_0x0db0('0x43')]=[{'all':!![]}];}return db[_0x0db0('0x2e')][_0x0db0('0x44')](_0x415997);})[_0x0db0('0x25')](function(_0x278260){_0x3d032d[_0x0db0('0x45')]=_0x278260;return _0x3d032d;})[_0x0db0('0x25')](respondWithFilteredResult(_0x37b84f,_0x415997))[_0x0db0('0x46')](handleError(_0x37b84f,null));};exports['show']=function(_0x2c62f9,_0x2055a7){var _0x305a83={'raw':!![],'where':{'id':_0x2c62f9[_0x0db0('0x47')]['id']}},_0x5e9509={};_0x5e9509[_0x0db0('0x33')]=_[_0x0db0('0x35')](db[_0x0db0('0x2e')]['rawAttributes']);_0x5e9509[_0x0db0('0x34')]=_[_0x0db0('0x35')](_0x2c62f9['query']);_0x5e9509[_0x0db0('0x36')]=_[_0x0db0('0x37')](_0x5e9509['model'],_0x5e9509[_0x0db0('0x34')]);_0x305a83[_0x0db0('0x38')]=_[_0x0db0('0x37')](_0x5e9509[_0x0db0('0x33')],qs[_0x0db0('0x39')](_0x2c62f9['query'][_0x0db0('0x39')]));_0x305a83['attributes']=_0x305a83[_0x0db0('0x38')][_0x0db0('0x3a')]?_0x305a83['attributes']:_0x5e9509[_0x0db0('0x33')];if(_0x2c62f9[_0x0db0('0x34')][_0x0db0('0x42')]){_0x305a83[_0x0db0('0x43')]=[{'all':!![]}];}_0x305a83=_[_0x0db0('0x40')]({},_0x305a83,_0x2c62f9[_0x0db0('0x41')]);return db[_0x0db0('0x2e')][_0x0db0('0x48')](_0x305a83)[_0x0db0('0x25')](handleEntityNotFound(_0x2055a7,null))['then'](respondWithResult(_0x2055a7,null))[_0x0db0('0x46')](handleError(_0x2055a7,null));};exports['update']=function(_0x506467,_0xcf4217){if(_0x506467[_0x0db0('0x49')]['id']){delete _0x506467[_0x0db0('0x49')]['id'];}return db[_0x0db0('0x2e')][_0x0db0('0x48')]({'where':{'id':_0x506467[_0x0db0('0x47')]['id']}})['then'](handleEntityNotFound(_0xcf4217,null))[_0x0db0('0x25')](saveUpdates(_0x506467['body'],null))['then'](respondWithResult(_0xcf4217,null))[_0x0db0('0x46')](handleError(_0xcf4217,null));};exports[_0x0db0('0x26')]=function(_0x31baa0,_0x199f1e){return db[_0x0db0('0x2e')][_0x0db0('0x48')]({'where':{'id':_0x31baa0[_0x0db0('0x47')]['id']}})[_0x0db0('0x25')](handleEntityNotFound(_0x199f1e,null))[_0x0db0('0x25')](removeEntity(_0x199f1e,null))[_0x0db0('0x46')](handleError(_0x199f1e,null));};exports[_0x0db0('0x4a')]=function(_0x5eeb97,_0x2cdea7){return db['CmHopperBlack'][_0x0db0('0x4a')]()[_0x0db0('0x25')](respondWithResult(_0x2cdea7,null))[_0x0db0('0x46')](handleError(_0x2cdea7,null));}; \ No newline at end of file +var _0x97f4=['../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x14c04f,_0x1ac242){var _0x5300df=function(_0x56d8f5){while(--_0x56d8f5){_0x14c04f['push'](_0x14c04f['shift']());}};_0x5300df(++_0x1ac242);}(_0x97f4,0xcf));var _0x497f=function(_0x4a1daf,_0x2c758a){_0x4a1daf=_0x4a1daf-0x0;var _0x2df426=_0x97f4[_0x4a1daf];return _0x2df426;};'use strict';var emlformat=require(_0x497f('0x0'));var rimraf=require(_0x497f('0x1'));var zipdir=require(_0x497f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x497f('0x3'));var moment=require(_0x497f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x497f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x497f('0x6'));var csv=require(_0x497f('0x7'));var ejs=require(_0x497f('0x8'));var fs=require('fs');var fs_extra=require(_0x497f('0x9'));var _=require(_0x497f('0xa'));var squel=require('squel');var crypto=require(_0x497f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x497f('0xc'));var toCsv=require(_0x497f('0x7'));var querystring=require(_0x497f('0xd'));var Papa=require(_0x497f('0xe'));var Redis=require('ioredis');var authService=require(_0x497f('0xf'));var qs=require(_0x497f('0x10'));var as=require(_0x497f('0x11'));var hardwareService=require(_0x497f('0x12'));var logger=require(_0x497f('0x13'))(_0x497f('0x14'));var utils=require(_0x497f('0x15'));var config=require(_0x497f('0x16'));var licenseUtil=require(_0x497f('0x17'));var db=require(_0x497f('0x18'))['db'];function respondWithStatusCode(_0x3b9ae7,_0x2e4335){_0x2e4335=_0x2e4335||0xcc;return function(_0x3342b1){if(_0x3342b1){return _0x3b9ae7['sendStatus'](_0x2e4335);}return _0x3b9ae7[_0x497f('0x19')](_0x2e4335)[_0x497f('0x1a')]();};}function respondWithResult(_0x4bca08,_0x5c8b52){_0x5c8b52=_0x5c8b52||0xc8;return function(_0xfa4099){if(_0xfa4099){return _0x4bca08['status'](_0x5c8b52)[_0x497f('0x1b')](_0xfa4099);}};}function respondWithFilteredResult(_0x5caa29,_0xf0f44c){return function(_0x25775f){if(_0x25775f){var _0x981941=typeof _0xf0f44c[_0x497f('0x1c')]==='undefined'&&typeof _0xf0f44c[_0x497f('0x1d')]===_0x497f('0x1e');var _0x3beac5=_0x25775f[_0x497f('0x1f')];var _0xc2692e=_0x981941?0x0:_0xf0f44c[_0x497f('0x1c')];var _0x512ce5=_0x981941?_0x25775f[_0x497f('0x1f')]:_0xf0f44c[_0x497f('0x1c')]+_0xf0f44c[_0x497f('0x1d')];var _0x3a160c;if(_0x512ce5>=_0x3beac5){_0x512ce5=_0x3beac5;_0x3a160c=0xc8;}else{_0x3a160c=0xce;}_0x5caa29[_0x497f('0x19')](_0x3a160c);return _0x5caa29[_0x497f('0x20')](_0x497f('0x21'),_0xc2692e+'-'+_0x512ce5+'/'+_0x3beac5)[_0x497f('0x1b')](_0x25775f);}return null;};}function patchUpdates(_0x544ecc){return function(_0x31760c){try{jsonpatch[_0x497f('0x22')](_0x31760c,_0x544ecc,!![]);}catch(_0x14b54a){return BPromise[_0x497f('0x23')](_0x14b54a);}return _0x31760c[_0x497f('0x24')]();};}function saveUpdates(_0x1ea4cb,_0x1e31ae){return function(_0xe8f13b){if(_0xe8f13b){return _0xe8f13b[_0x497f('0x25')](_0x1ea4cb)[_0x497f('0x26')](function(_0x4bca0c){return _0x4bca0c;});}return null;};}function removeEntity(_0x1adcf2,_0x3af3ea){return function(_0x18a73f){if(_0x18a73f){return _0x18a73f['destroy']()[_0x497f('0x26')](function(){_0x1adcf2[_0x497f('0x19')](0xcc)[_0x497f('0x1a')]();});}};}function handleEntityNotFound(_0x2f9cd8,_0x519b4d){return function(_0x518c39){if(!_0x518c39){_0x2f9cd8[_0x497f('0x27')](0x194);}return _0x518c39;};}function handleError(_0x984d3a,_0x38ecad){_0x38ecad=_0x38ecad||0x1f4;return function(_0x250fa6){logger[_0x497f('0x28')](_0x250fa6[_0x497f('0x29')]);if(_0x250fa6[_0x497f('0x2a')]){delete _0x250fa6[_0x497f('0x2a')];}_0x984d3a[_0x497f('0x19')](_0x38ecad)[_0x497f('0x2b')](_0x250fa6);};}exports['index']=function(_0x15b01c,_0x43841c){var _0x3f2417={},_0x4bce4e={},_0x4e73ea={'count':0x0,'rows':[]};var _0x164efe=_[_0x497f('0x2c')](db[_0x497f('0x2d')][_0x497f('0x2e')],function(_0x31e618){return{'name':_0x31e618[_0x497f('0x2f')],'type':_0x31e618[_0x497f('0x30')][_0x497f('0x31')]};});_0x4bce4e[_0x497f('0x32')]=_[_0x497f('0x2c')](_0x164efe,'name');_0x4bce4e[_0x497f('0x33')]=_['keys'](_0x15b01c[_0x497f('0x33')]);_0x4bce4e['filters']=_[_0x497f('0x34')](_0x4bce4e[_0x497f('0x32')],_0x4bce4e[_0x497f('0x33')]);_0x3f2417[_0x497f('0x35')]=_[_0x497f('0x34')](_0x4bce4e[_0x497f('0x32')],qs[_0x497f('0x36')](_0x15b01c['query'][_0x497f('0x36')]));_0x3f2417['attributes']=_0x3f2417['attributes'][_0x497f('0x37')]?_0x3f2417[_0x497f('0x35')]:_0x4bce4e[_0x497f('0x32')];if(!_0x15b01c[_0x497f('0x33')][_0x497f('0x38')](_0x497f('0x39'))){_0x3f2417[_0x497f('0x1d')]=qs[_0x497f('0x1d')](_0x15b01c['query'][_0x497f('0x1d')]);_0x3f2417[_0x497f('0x1c')]=qs[_0x497f('0x1c')](_0x15b01c[_0x497f('0x33')][_0x497f('0x1c')]);}_0x3f2417[_0x497f('0x3a')]=qs[_0x497f('0x3b')](_0x15b01c['query'][_0x497f('0x3b')]);_0x3f2417[_0x497f('0x3c')]=qs[_0x497f('0x3d')](_['pick'](_0x15b01c[_0x497f('0x33')],_0x4bce4e[_0x497f('0x3d')]),_0x164efe);if(_0x15b01c['query'][_0x497f('0x3e')]){_0x3f2417['where']=_[_0x497f('0x3f')](_0x3f2417[_0x497f('0x3c')],{'$or':_[_0x497f('0x2c')](_0x164efe,function(_0x2c256d){if(_0x2c256d[_0x497f('0x30')]!==_0x497f('0x40')){var _0x1ea0b7={};_0x1ea0b7[_0x2c256d['name']]={'$like':'%'+_0x15b01c[_0x497f('0x33')][_0x497f('0x3e')]+'%'};return _0x1ea0b7;}})});}_0x3f2417=_[_0x497f('0x3f')]({},_0x3f2417,_0x15b01c['options']);var _0x4fa9ef={'where':_0x3f2417[_0x497f('0x3c')]};return db[_0x497f('0x2d')][_0x497f('0x1f')](_0x4fa9ef)['then'](function(_0x4dbf1a){_0x4e73ea['count']=_0x4dbf1a;if(_0x15b01c['query'][_0x497f('0x41')]){_0x3f2417[_0x497f('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x497f('0x43')](_0x3f2417);})[_0x497f('0x26')](function(_0x2e9317){_0x4e73ea['rows']=_0x2e9317;return _0x4e73ea;})[_0x497f('0x26')](respondWithFilteredResult(_0x43841c,_0x3f2417))[_0x497f('0x44')](handleError(_0x43841c,null));};exports[_0x497f('0x45')]=function(_0x4914d6,_0x428974){var _0xf0dc25={'raw':!![],'where':{'id':_0x4914d6[_0x497f('0x46')]['id']}},_0x2e6c24={};_0x2e6c24[_0x497f('0x32')]=_[_0x497f('0x47')](db[_0x497f('0x2d')]['rawAttributes']);_0x2e6c24[_0x497f('0x33')]=_[_0x497f('0x47')](_0x4914d6[_0x497f('0x33')]);_0x2e6c24['filters']=_[_0x497f('0x34')](_0x2e6c24[_0x497f('0x32')],_0x2e6c24[_0x497f('0x33')]);_0xf0dc25['attributes']=_['intersection'](_0x2e6c24[_0x497f('0x32')],qs[_0x497f('0x36')](_0x4914d6[_0x497f('0x33')][_0x497f('0x36')]));_0xf0dc25[_0x497f('0x35')]=_0xf0dc25['attributes'][_0x497f('0x37')]?_0xf0dc25[_0x497f('0x35')]:_0x2e6c24[_0x497f('0x32')];if(_0x4914d6['query'][_0x497f('0x41')]){_0xf0dc25[_0x497f('0x42')]=[{'all':!![]}];}_0xf0dc25=_[_0x497f('0x3f')]({},_0xf0dc25,_0x4914d6[_0x497f('0x48')]);return db[_0x497f('0x2d')]['find'](_0xf0dc25)[_0x497f('0x26')](handleEntityNotFound(_0x428974,null))['then'](respondWithResult(_0x428974,null))[_0x497f('0x44')](handleError(_0x428974,null));};exports[_0x497f('0x25')]=function(_0x40a9f1,_0x234c6d){if(_0x40a9f1[_0x497f('0x49')]['id']){delete _0x40a9f1[_0x497f('0x49')]['id'];}return db['CmHopperBlack'][_0x497f('0x4a')]({'where':{'id':_0x40a9f1['params']['id']}})[_0x497f('0x26')](handleEntityNotFound(_0x234c6d,null))[_0x497f('0x26')](saveUpdates(_0x40a9f1[_0x497f('0x49')],null))[_0x497f('0x26')](respondWithResult(_0x234c6d,null))[_0x497f('0x44')](handleError(_0x234c6d,null));};exports[_0x497f('0x4b')]=function(_0x46b85e,_0x74c76d){return db['CmHopperBlack'][_0x497f('0x4a')]({'where':{'id':_0x46b85e[_0x497f('0x46')]['id']}})[_0x497f('0x26')](handleEntityNotFound(_0x74c76d,null))['then'](removeEntity(_0x74c76d,null))['catch'](handleError(_0x74c76d,null));};exports[_0x497f('0x4c')]=function(_0x3be6a4,_0x6ff5e5){return db['CmHopperBlack']['describe']()[_0x497f('0x26')](respondWithResult(_0x6ff5e5,null))[_0x497f('0x44')](handleError(_0x6ff5e5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3c0e2d3..6458c28 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 _0xd430=['moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','api'];(function(_0x27d517,_0x8e5a42){var _0x2c9c65=function(_0x132259){while(--_0x132259){_0x27d517['push'](_0x27d517['shift']());}};_0x2c9c65(++_0x8e5a42);}(_0xd430,0xfc));var _0x0d43=function(_0x33ceeb,_0x58b863){_0x33ceeb=_0x33ceeb-0x0;var _0x5b6556=_0xd430[_0x33ceeb];return _0x5b6556;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0d43('0x0'));var moment=require(_0x0d43('0x1'));var BPromise=require(_0x0d43('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d43('0x3'));var rimraf=require(_0x0d43('0x4'));var config=require(_0x0d43('0x5'));var attributes=require(_0x0d43('0x6'));module[_0x0d43('0x7')]=function(_0x1da209,_0x2b4448){return _0x1da209[_0x0d43('0x8')](_0x0d43('0x9'),attributes,{'tableName':_0x0d43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58b8=['rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x58b8,0x14b));var _0x858b=function(_0x10d618,_0x1f1c82){_0x10d618=_0x10d618-0x0;var _0x57d044=_0x58b8[_0x10d618];return _0x57d044;};'use strict';var _=require(_0x858b('0x0'));var util=require(_0x858b('0x1'));var logger=require('../../config/logger')(_0x858b('0x2'));var moment=require(_0x858b('0x3'));var BPromise=require(_0x858b('0x4'));var rp=require(_0x858b('0x5'));var fs=require('fs');var path=require(_0x858b('0x6'));var rimraf=require(_0x858b('0x7'));var config=require('../../config/environment');var attributes=require(_0x858b('0x8'));module[_0x858b('0x9')]=function(_0x28cb38,_0x6895bb){return _0x28cb38[_0x858b('0xa')](_0x858b('0xb'),attributes,{'tableName':_0x858b('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 048e584..9ff8658 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 _0xa8ae=['findAll','options','raw','where','limit','include','map','model','attributes','body','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa8ae,0x1e9));var _0xea8a=function(_0x2c6761,_0x39bd9f){_0x2c6761=_0x2c6761-0x0;var _0x8275b0=_0xa8ae[_0x2c6761];return _0x8275b0;};'use strict';var _=require('lodash');var util=require(_0xea8a('0x0'));var moment=require('moment');var BPromise=require(_0xea8a('0x1'));var rs=require(_0xea8a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xea8a('0x3'));var logger=require(_0xea8a('0x4'))(_0xea8a('0x5'));var config=require(_0xea8a('0x6'));var jayson=require(_0xea8a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x297928,_0x277fb8,_0x2f6ab1){return new BPromise(function(_0x14ea75,_0x247dc9){return client['request'](_0x297928,_0x2f6ab1)[_0xea8a('0x8')](function(_0xe941d4){logger[_0xea8a('0x9')](_0xea8a('0xa'),_0x277fb8,_0xea8a('0xb'));logger[_0xea8a('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x277fb8,_0xea8a('0xb'),JSON[_0xea8a('0xd')](_0xe941d4));if(_0xe941d4[_0xea8a('0xe')]){if(_0xe941d4[_0xea8a('0xe')][_0xea8a('0xf')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x277fb8,_0xe941d4[_0xea8a('0xe')]['message']);return _0x247dc9(_0xe941d4[_0xea8a('0xe')][_0xea8a('0x10')]);}logger[_0xea8a('0xe')](_0xea8a('0xa'),_0x277fb8,_0xe941d4[_0xea8a('0xe')][_0xea8a('0x10')]);return _0x14ea75(_0xe941d4[_0xea8a('0xe')][_0xea8a('0x10')]);}else{logger[_0xea8a('0x9')](_0xea8a('0xa'),_0x277fb8,'request\x20sent');_0x14ea75(_0xe941d4[_0xea8a('0x11')]['message']);}})[_0xea8a('0x12')](function(_0x5a2081){logger['error'](_0xea8a('0xa'),_0x277fb8,_0x5a2081);_0x247dc9(_0x5a2081);});});}exports[_0xea8a('0x13')]=function(_0x2fde6e){var _0x1edf29=this;return new Promise(function(_0x1c3827,_0x5df528){return db[_0xea8a('0x14')][_0xea8a('0x15')]({'raw':_0x2fde6e[_0xea8a('0x16')]?_0x2fde6e[_0xea8a('0x16')][_0xea8a('0x17')]===undefined?!![]:![]:!![],'where':_0x2fde6e[_0xea8a('0x16')]?_0x2fde6e[_0xea8a('0x16')][_0xea8a('0x18')]||null:null,'attributes':_0x2fde6e[_0xea8a('0x16')]?_0x2fde6e[_0xea8a('0x16')]['attributes']||null:null,'limit':_0x2fde6e['options']?_0x2fde6e[_0xea8a('0x16')][_0xea8a('0x19')]||null:null,'include':_0x2fde6e['options']?_0x2fde6e[_0xea8a('0x16')][_0xea8a('0x1a')]?_[_0xea8a('0x1b')](_0x2fde6e[_0xea8a('0x16')][_0xea8a('0x1a')],function(_0x1638cb){return{'model':db[_0x1638cb[_0xea8a('0x1c')]],'as':_0x1638cb['as'],'attributes':_0x1638cb['attributes'],'include':_0x1638cb['include']?_[_0xea8a('0x1b')](_0x1638cb[_0xea8a('0x1a')],function(_0x56251b){return{'model':db[_0x56251b[_0xea8a('0x1c')]],'as':_0x56251b['as'],'attributes':_0x56251b[_0xea8a('0x1d')],'include':_0x56251b[_0xea8a('0x1a')]?_['map'](_0x56251b[_0xea8a('0x1a')],function(_0x4e5c6e){return{'model':db[_0x4e5c6e[_0xea8a('0x1c')]],'as':_0x4e5c6e['as'],'attributes':_0x4e5c6e[_0xea8a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xea8a('0x8')](function(_0x247e15){logger[_0xea8a('0x9')](_0xea8a('0x13'),_0x2fde6e);logger['debug'](_0xea8a('0x13'),_0x2fde6e,JSON[_0xea8a('0xd')](_0x247e15));_0x1c3827(_0x247e15);})['catch'](function(_0x539683){logger[_0xea8a('0xe')](_0xea8a('0x13'),_0x539683['message'],_0x2fde6e);_0x5df528(_0x1edf29[_0xea8a('0xe')](0x1f4,_0x539683[_0xea8a('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x562eab){var _0x51f0dd=this;return new Promise(function(_0x510b05,_0x37039a){return db[_0xea8a('0x14')]['update'](_0x562eab[_0xea8a('0x1e')],{'raw':_0x562eab['options']?_0x562eab[_0xea8a('0x16')][_0xea8a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x562eab['options']?_0x562eab[_0xea8a('0x16')]['where']||null:null,'attributes':_0x562eab['options']?_0x562eab[_0xea8a('0x16')][_0xea8a('0x1d')]||null:null,'limit':_0x562eab[_0xea8a('0x16')]?_0x562eab[_0xea8a('0x16')][_0xea8a('0x19')]||null:null})[_0xea8a('0x8')](function(_0x751947){logger[_0xea8a('0x9')](_0xea8a('0x1f'),_0x562eab);logger['debug']('UpdateCmHopperBlack',_0x562eab,JSON['stringify'](_0x751947));_0x510b05(_0x751947);})[_0xea8a('0x12')](function(_0x46039e){logger['error']('UpdateCmHopperBlack',_0x46039e[_0xea8a('0x10')],_0x562eab);_0x37039a(_0x51f0dd[_0xea8a('0xe')](0x1f4,_0x46039e[_0xea8a('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x55cf62){var _0x5e33f0=this;return new Promise(function(_0x4f58a0,_0x55fe35){return db['CmHopperBlack'][_0xea8a('0x20')]({'where':_0x55cf62[_0xea8a('0x16')]?_0x55cf62[_0xea8a('0x16')][_0xea8a('0x18')]||null:null})[_0xea8a('0x8')](function(_0x28451c){logger[_0xea8a('0x9')](_0xea8a('0x21'),_0x55cf62);logger['debug']('DestroyCmHopperBlack',_0x55cf62,JSON['stringify'](_0x28451c));_0x4f58a0(_0x28451c);})[_0xea8a('0x12')](function(_0x5370d6){logger[_0xea8a('0xe')](_0xea8a('0x21'),_0x5370d6[_0xea8a('0x10')],_0x55cf62);_0x55fe35(_0x5e33f0[_0xea8a('0xe')](0x1f4,_0x5370d6['message']));});});}; \ No newline at end of file +var _0xe820=['body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','request\x20sent','stringify','code','error','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','map','include','model','UpdateCmHopperBlack','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe820,0x106));var _0x0e82=function(_0x6746d4,_0x2734c3){_0x6746d4=_0x6746d4-0x0;var _0x24c311=_0xe820[_0x6746d4];return _0x24c311;};'use strict';var _=require('lodash');var util=require(_0x0e82('0x0'));var moment=require(_0x0e82('0x1'));var BPromise=require(_0x0e82('0x2'));var rs=require(_0x0e82('0x3'));var fs=require('fs');var Redis=require(_0x0e82('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e82('0x5'));var logger=require(_0x0e82('0x6'))(_0x0e82('0x7'));var config=require(_0x0e82('0x8'));var jayson=require(_0x0e82('0x9'));var client=jayson[_0x0e82('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15fad5,_0x225bd3,_0x4ed6da){return new BPromise(function(_0x480711,_0x1a2280){return client['request'](_0x15fad5,_0x4ed6da)[_0x0e82('0xb')](function(_0x2616b4){logger[_0x0e82('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x225bd3,'request\x20sent');logger[_0x0e82('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x225bd3,_0x0e82('0xe'),JSON[_0x0e82('0xf')](_0x2616b4));if(_0x2616b4['error']){if(_0x2616b4['error'][_0x0e82('0x10')]===0x1f4){logger[_0x0e82('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x225bd3,_0x2616b4[_0x0e82('0x11')][_0x0e82('0x12')]);return _0x1a2280(_0x2616b4[_0x0e82('0x11')][_0x0e82('0x12')]);}logger[_0x0e82('0x11')](_0x0e82('0x13'),_0x225bd3,_0x2616b4[_0x0e82('0x11')][_0x0e82('0x12')]);return _0x480711(_0x2616b4['error']['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x225bd3,_0x0e82('0xe'));_0x480711(_0x2616b4[_0x0e82('0x14')]['message']);}})[_0x0e82('0x15')](function(_0x4ce50c){logger[_0x0e82('0x11')](_0x0e82('0x13'),_0x225bd3,_0x4ce50c);_0x1a2280(_0x4ce50c);});});}exports[_0x0e82('0x16')]=function(_0x5b80ba){var _0x3c494c=this;return new Promise(function(_0x5722d7,_0x5dc582){return db[_0x0e82('0x17')]['findAll']({'raw':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')][_0x0e82('0x19')]===undefined?!![]:![]:!![],'where':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')][_0x0e82('0x1a')]||null:null,'attributes':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')][_0x0e82('0x1b')]||null:null,'limit':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')][_0x0e82('0x1c')]||null:null,'include':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')]['include']?_[_0x0e82('0x1d')](_0x5b80ba['options'][_0x0e82('0x1e')],function(_0x32e49a){return{'model':db[_0x32e49a[_0x0e82('0x1f')]],'as':_0x32e49a['as'],'attributes':_0x32e49a[_0x0e82('0x1b')],'include':_0x32e49a['include']?_[_0x0e82('0x1d')](_0x32e49a[_0x0e82('0x1e')],function(_0x51db1e){return{'model':db[_0x51db1e[_0x0e82('0x1f')]],'as':_0x51db1e['as'],'attributes':_0x51db1e[_0x0e82('0x1b')],'include':_0x51db1e['include']?_[_0x0e82('0x1d')](_0x51db1e['include'],function(_0x4cea92){return{'model':db[_0x4cea92['model']],'as':_0x4cea92['as'],'attributes':_0x4cea92['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xaa52f9){logger[_0x0e82('0xc')]('GetCmHopperBlack',_0x5b80ba);logger[_0x0e82('0xd')]('GetCmHopperBlack',_0x5b80ba,JSON[_0x0e82('0xf')](_0xaa52f9));_0x5722d7(_0xaa52f9);})['catch'](function(_0x48e6da){logger['error'](_0x0e82('0x16'),_0x48e6da['message'],_0x5b80ba);_0x5dc582(_0x3c494c[_0x0e82('0x11')](0x1f4,_0x48e6da[_0x0e82('0x12')]));});});};exports[_0x0e82('0x20')]=function(_0x43e963){var _0x46e903=this;return new Promise(function(_0x1949a7,_0x2ebe89){return db['CmHopperBlack'][_0x0e82('0x21')](_0x43e963[_0x0e82('0x22')],{'raw':_0x43e963[_0x0e82('0x18')]?_0x43e963[_0x0e82('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e963[_0x0e82('0x18')]?_0x43e963['options'][_0x0e82('0x1a')]||null:null,'attributes':_0x43e963[_0x0e82('0x18')]?_0x43e963[_0x0e82('0x18')]['attributes']||null:null,'limit':_0x43e963[_0x0e82('0x18')]?_0x43e963[_0x0e82('0x18')][_0x0e82('0x1c')]||null:null})['then'](function(_0x333ff2){logger[_0x0e82('0xc')](_0x0e82('0x20'),_0x43e963);logger[_0x0e82('0xd')](_0x0e82('0x20'),_0x43e963,JSON[_0x0e82('0xf')](_0x333ff2));_0x1949a7(_0x333ff2);})[_0x0e82('0x15')](function(_0x19d2de){logger[_0x0e82('0x11')](_0x0e82('0x20'),_0x19d2de[_0x0e82('0x12')],_0x43e963);_0x2ebe89(_0x46e903[_0x0e82('0x11')](0x1f4,_0x19d2de[_0x0e82('0x12')]));});});};exports[_0x0e82('0x23')]=function(_0x4cd9f0){var _0xaf6a71=this;return new Promise(function(_0x274ec8,_0x2592c3){return db[_0x0e82('0x17')][_0x0e82('0x24')]({'where':_0x4cd9f0['options']?_0x4cd9f0[_0x0e82('0x18')][_0x0e82('0x1a')]||null:null})[_0x0e82('0xb')](function(_0x4d5220){logger[_0x0e82('0xc')](_0x0e82('0x23'),_0x4cd9f0);logger[_0x0e82('0xd')]('DestroyCmHopperBlack',_0x4cd9f0,JSON[_0x0e82('0xf')](_0x4d5220));_0x274ec8(_0x4d5220);})['catch'](function(_0x2926e5){logger[_0x0e82('0x11')]('DestroyCmHopperBlack',_0x2926e5[_0x0e82('0x12')],_0x4cd9f0);_0x2592c3(_0xaf6a71[_0x0e82('0x11')](0x1f4,_0x2926e5['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8c1ba8b..233ee82 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 _0xd8fb=['/describe','describe','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','index'];(function(_0x53fc00,_0x5d0ebe){var _0x496db3=function(_0x181493){while(--_0x181493){_0x53fc00['push'](_0x53fc00['shift']());}};_0x496db3(++_0x5d0ebe);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1008d6,_0x274460){_0x1008d6=_0x1008d6-0x0;var _0x31319a=_0xd8fb[_0x1008d6];return _0x31319a;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xb')]);router[_0xbd8f('0xc')](_0xbd8f('0xd'),auth['isAuthenticated'](),controller[_0xbd8f('0xe')]);router[_0xbd8f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0x10')]);module[_0xbd8f('0x11')]=router; \ No newline at end of file +var _0xef17=['show','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','get','describe'];(function(_0xfc1071,_0x46736b){var _0x12e63d=function(_0x5af5a1){while(--_0x5af5a1){_0xfc1071['push'](_0xfc1071['shift']());}};_0x12e63d(++_0x46736b);}(_0xef17,0x136));var _0x7ef1=function(_0x2ca8a3,_0x174c0f){_0x2ca8a3=_0x2ca8a3-0x0;var _0x24aa82=_0xef17[_0x2ca8a3];return _0x24aa82;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var fs_extra=require(_0x7ef1('0x6'));var auth=require(_0x7ef1('0x7'));var interaction=require(_0x7ef1('0x8'));var config=require('../../config/environment');var controller=require(_0x7ef1('0x9'));router['get']('/',auth[_0x7ef1('0xa')](),controller['index']);router[_0x7ef1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7ef1('0xc')]);router[_0x7ef1('0xb')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0xe')](_0x7ef1('0xf'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x10')]);router[_0x7ef1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7ef1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 6504e19..072fa69 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 _0xaba8=['seconds','BOOLEAN','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','followuptime','diff'];(function(_0x137ca4,_0x3866cc){var _0x3266da=function(_0x195f84){while(--_0x195f84){_0x137ca4['push'](_0x137ca4['shift']());}};_0x3266da(++_0x3866cc);}(_0xaba8,0xd3));var _0x8aba=function(_0x120802,_0x144dfd){_0x120802=_0x120802-0x0;var _0xd1e47f=_0xaba8[_0x120802];return _0xd1e47f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8aba('0x0'));module[_0x8aba('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8aba('0x2')]},'scheduledat':{'type':Sequelize[_0x8aba('0x3')]},'countbusyretry':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8aba('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8aba('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8aba('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8aba('0x3')]},'endtime':{'type':Sequelize[_0x8aba('0x3')]},'ringtime':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8aba('0x2')]},'campaign':{'type':Sequelize[_0x8aba('0x2')]},'campaigntype':{'type':Sequelize[_0x8aba('0x2')]},'membername':{'type':Sequelize[_0x8aba('0x2')]},'reason':{'type':Sequelize[_0x8aba('0x2')]},'disposition':{'type':Sequelize[_0x8aba('0x2')]},'secondDisposition':{'type':Sequelize[_0x8aba('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x8aba('0x3')],'set':function(_0x18d5b3){var _0x1b7f44=this[_0x8aba('0x5')](_0x8aba('0x6'));if(_0x1b7f44&&_0x18d5b3){this['setDataValue'](_0x8aba('0x7'),moment(_0x18d5b3)[_0x8aba('0x8')](moment(_0x1b7f44),_0x8aba('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8aba('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8aba('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x8aba('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8aba('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8aba('0x3')]},'deleted':{'type':Sequelize[_0x8aba('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8aba('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8aba('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8aba('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa728=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0xa728,0x9a));var _0x8a72=function(_0x3e391d,_0x28d6fc){_0x3e391d=_0x3e391d-0x0;var _0x1855ef=_0xa728[_0x3e391d];return _0x1855ef;};'use strict';var Sequelize=require(_0x8a72('0x0'));var moment=require('moment');module[_0x8a72('0x1')]={'state':{'type':Sequelize[_0x8a72('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8a72('0x3')]},'scheduledat':{'type':Sequelize[_0x8a72('0x4')]},'countbusyretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8a72('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8a72('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8a72('0x3')]},'calleridnum':{'type':Sequelize[_0x8a72('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8a72('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8a72('0x4')]},'droptime':{'type':Sequelize[_0x8a72('0x4')]},'endtime':{'type':Sequelize[_0x8a72('0x4')]},'ringtime':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8a72('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8a72('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8a72('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8a72('0x3')]},'dispositionat':{'type':Sequelize[_0x8a72('0x4')],'set':function(_0x462712){var _0x35a695=this[_0x8a72('0x5')](_0x8a72('0x6'));if(_0x35a695&&_0x462712){this[_0x8a72('0x7')](_0x8a72('0x8'),moment(_0x462712)[_0x8a72('0x9')](moment(_0x35a695),_0x8a72('0xa')));}}},'amd':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8a72('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8a72('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8a72('0x4')]},'recallme':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8a72('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 0736f5d..0a06e19 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 _0xdb28=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','CmHopperFinal','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','insert','into','cm_hopper','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(CampaignId)','state','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf'];(function(_0xfcf288,_0x42df01){var _0x5b1bcd=function(_0x101c78){while(--_0x101c78){_0xfcf288['push'](_0xfcf288['shift']());}};_0x5b1bcd(++_0x42df01);}(_0xdb28,0x106));var _0x8db2=function(_0x28c6ad,_0x59cfde){_0x28c6ad=_0x28c6ad-0x0;var _0x120b5a=_0xdb28[_0x28c6ad];return _0x120b5a;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['describe']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')]()['then'](respondWithResult(_0x2ada52,null))['catch'](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x2e46d4,_0x164020){if(_0x2e46d4['body']['uniqueid']){delete _0x2e46d4['body'][_0x8db2('0x4a')];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'uniqueid':_0x2e46d4[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x164020,null))[_0x8db2('0x24')](saveUpdates(_0x2e46d4[_0x8db2('0x4b')],null))['then'](respondWithResult(_0x164020,null))['catch'](handleError(_0x164020,null));};exports[_0x8db2('0x4c')]=function(_0x18c6ef,_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x18c6ef[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x54')))),_0x8db2('0x55')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x56')))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8db2('0x58')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5d')))),_0x8db2('0x5e')]]})['then'](handleEntityNotFound(_0x2908e4,null))[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x42')](handleError(_0x2908e4,null));};exports[_0x8db2('0x5f')]=function(_0xc27a7e,_0x349db0,_0x53b2dc){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'CampaignId':_0xc27a7e[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db['sequelize'][_0x8db2('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x8db2('0x55')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x60')))),_0x8db2('0x58')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5d')))),'answeringMachine']]})[_0x8db2('0x24')](handleEntityNotFound(_0x349db0,null))[_0x8db2('0x24')](respondWithResult(_0x349db0,null))[_0x8db2('0x42')](handleError(_0x349db0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x26523b,_0x291375,_0x2cf731){return db['VoiceQueue'][_0x8db2('0x48')]({'where':{'id':_0x26523b[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x291375,null))[_0x8db2('0x24')](function(_0x3a0946){var _0x5923b3;if(_0x3a0946){_0x5923b3=squel[_0x8db2('0x61')]()[_0x8db2('0x62')](_0x8db2('0x63'))['fromQuery'](['phone',_0x8db2('0x64'),_0x8db2('0x65'),'ListId',_0x8db2('0x66'),_0x8db2('0x67'),_0x8db2('0x68')],squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))[_0x8db2('0x6a')](_0x8db2('0x6e'),_0x8db2('0x65'))['field'](_0x8db2('0x6f'),'ListId')[_0x8db2('0x6a')](_0x8db2('0x70'),'VoiceQueueId')[_0x8db2('0x6a')](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())['where']('state\x20=\x20?',_0x26523b[_0x8db2('0x4b')]['state'][_0x8db2('0x74')]())[_0x8db2('0x3b')](_0x8db2('0x75'))['where'](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')]('phone')[_0x8db2('0x71')](_0x8db2('0x63'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b['params']['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id']['toString']())[_0x8db2('0x3b')](_0x8db2('0x78')))[_0x8db2('0x79')]('ContactId'))['toString']();return db['sequelize'][_0x8db2('0x30')](_0x5923b3);}return[];})[_0x8db2('0x24')](respondWithResult(_0x291375,null))[_0x8db2('0x42')](handleError(_0x291375,null));};exports[_0x8db2('0x7a')]=function(_0x2ad024,_0x313918,_0x339d09){return db[_0x8db2('0x7b')][_0x8db2('0x48')]({'where':{'id':_0x2ad024[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x313918,null))['then'](function(_0x360a06){var _0xa2e293;if(_0x360a06){_0xa2e293=squel[_0x8db2('0x61')]()[_0x8db2('0x62')]('cm_hopper')['fromQuery']([_0x8db2('0x6c'),_0x8db2('0x64'),'ContactId',_0x8db2('0x7c'),_0x8db2('0x7d'),_0x8db2('0x67'),'updatedAt'],squel['select']()['field'](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))['field'](_0x8db2('0x6e'),'ContactId')[_0x8db2('0x6a')](_0x8db2('0x6f'),_0x8db2('0x7c'))[_0x8db2('0x6a')](_0x8db2('0x7e'),'CampaignId')['field'](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')]('CampaignId\x20=\x20?',_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x20?',_0x2ad024[_0x8db2('0x4b')][_0x8db2('0x7f')]['toString']())[_0x8db2('0x3b')](_0x8db2('0x75'))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6c'))[_0x8db2('0x71')](_0x8db2('0x63'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x204'))[_0x8db2('0x79')](_0x8db2('0x65')))[_0x8db2('0x74')]();return db['sequelize']['query'](_0xa2e293);}return[];})[_0x8db2('0x24')](respondWithResult(_0x313918,null))[_0x8db2('0x42')](handleError(_0x313918,null));};exports[_0x8db2('0x81')]=function(_0xc83913,_0x4f9ce4,_0xaa2661){return db[_0x8db2('0x82')][_0x8db2('0x83')]({'where':{'VoiceQueueId':_0xc83913[_0x8db2('0x4b')]['VoiceQueueId'],'CampaignId':_0xc83913[_0x8db2('0x4b')][_0x8db2('0x7d')],'ContactId':_0xc83913[_0x8db2('0x4b')]['ContactId']}})['then'](handleEntityNotFound(_0x4f9ce4,null))['then'](function(_0x1ba097){if(_0x1ba097){return _0x1ba097;}return null;})[_0x8db2('0x24')](respondWithResult(_0x4f9ce4,null))[_0x8db2('0x42')](handleError(_0x4f9ce4,null));}; \ No newline at end of file +var _0xd8fb=['updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','toString','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','options','find','describe','body','uniqueid','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt'];(function(_0x4f04b5,_0x5b91c2){var _0x1b3b58=function(_0x4a3ee9){while(--_0x4a3ee9){_0x4f04b5['push'](_0x4f04b5['shift']());}};_0x1b3b58(++_0x5b91c2);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4d0131,_0x1197fb){_0x4d0131=_0x4d0131-0x0;var _0x23c7cc=_0xd8fb[_0x4d0131];return _0x23c7cc;};'use strict';var emlformat=require(_0xbd8f('0x0'));var rimraf=require(_0xbd8f('0x1'));var zipdir=require(_0xbd8f('0x2'));var jsonpatch=require(_0xbd8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd8f('0x4'));var util=require(_0xbd8f('0x5'));var path=require('path');var sox=require(_0xbd8f('0x6'));var csv=require(_0xbd8f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd8f('0x8'));var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=typeof _0xa57e91[_0xbd8f('0x18')]===_0xbd8f('0x19')&&typeof _0xa57e91['limit']===_0xbd8f('0x19');var _0xf5e7a=_0x10d72e['count'];var _0x4435b9=_0x4da96f?0x0:_0xa57e91[_0xbd8f('0x18')];var _0x47d317=_0x4da96f?_0x10d72e['count']:_0xa57e91[_0xbd8f('0x18')]+_0xa57e91['limit'];var _0x5705c5;if(_0x47d317>=_0xf5e7a){_0x47d317=_0xf5e7a;_0x5705c5=0xc8;}else{_0x5705c5=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5705c5);return _0x829fb2['set'](_0xbd8f('0x1a'),_0x4435b9+'-'+_0x47d317+'/'+_0xf5e7a)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0xb47c8e){return function(_0x897f25){try{jsonpatch[_0xbd8f('0x1b')](_0x897f25,_0xb47c8e,!![]);}catch(_0x20cab7){return BPromise[_0xbd8f('0x1c')](_0x20cab7);}return _0x897f25[_0xbd8f('0x1d')]();};}function saveUpdates(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x1e')](_0x2fbe3b)[_0xbd8f('0x1f')](function(_0x15c4a9){return _0x15c4a9;});}return null;};}function removeEntity(_0x320ede,_0xd11ae){return function(_0x395b1b){if(_0x395b1b){return _0x395b1b['destroy']()[_0xbd8f('0x1f')](function(){_0x320ede[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0x2f3df7,_0xa88414){return function(_0x2257fd){if(!_0x2257fd){_0x2f3df7[_0xbd8f('0x14')](0x194);}return _0x2257fd;};}function handleError(_0x264e62,_0x4ea554){_0x4ea554=_0x4ea554||0x1f4;return function(_0x40cb43){logger[_0xbd8f('0x20')](_0x40cb43['stack']);if(_0x40cb43[_0xbd8f('0x21')]){delete _0x40cb43['name'];}_0x264e62[_0xbd8f('0x15')](_0x4ea554)[_0xbd8f('0x22')](_0x40cb43);};}exports[_0xbd8f('0x23')]=function(_0x202126,_0x2aefa2){var _0x247b07={},_0x4c4431={},_0x166de7={'count':0x0,'rows':[]};var _0x14f3cb=_[_0xbd8f('0x24')](db[_0xbd8f('0x25')][_0xbd8f('0x26')],function(_0x2ac26f){return{'name':_0x2ac26f[_0xbd8f('0x27')],'type':_0x2ac26f['type'][_0xbd8f('0x28')]};});_0x4c4431[_0xbd8f('0x29')]=_[_0xbd8f('0x24')](_0x14f3cb,_0xbd8f('0x21'));_0x4c4431['query']=_['keys'](_0x202126[_0xbd8f('0x2a')]);_0x4c4431[_0xbd8f('0x2b')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],_0x4c4431['query']);_0x247b07[_0xbd8f('0x2d')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x202126[_0xbd8f('0x2a')]['fields']));_0x247b07[_0xbd8f('0x2d')]=_0x247b07[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x247b07[_0xbd8f('0x2d')]:_0x4c4431[_0xbd8f('0x29')];if(!_0x202126['query'][_0xbd8f('0x30')]('nolimit')){_0x247b07[_0xbd8f('0x31')]=qs[_0xbd8f('0x31')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x31')]);_0x247b07[_0xbd8f('0x18')]=qs[_0xbd8f('0x18')](_0x202126['query']['offset']);}_0x247b07['order']=qs[_0xbd8f('0x32')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x32')]);_0x247b07[_0xbd8f('0x33')]=qs[_0xbd8f('0x2b')](_[_0xbd8f('0x34')](_0x202126[_0xbd8f('0x2a')],_0x4c4431[_0xbd8f('0x2b')]),_0x14f3cb);if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]){_0x247b07[_0xbd8f('0x33')]=_[_0xbd8f('0x36')](_0x247b07[_0xbd8f('0x33')],{'$or':_[_0xbd8f('0x24')](_0x14f3cb,function(_0x391d45){if(_0x391d45['type']!==_0xbd8f('0x37')){var _0x4181e0={};_0x4181e0[_0x391d45['name']]={'$like':'%'+_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]+'%'};return _0x4181e0;}})});}_0x247b07=_[_0xbd8f('0x36')]({},_0x247b07,_0x202126['options']);var _0x21da54={'where':_0x247b07['where']};return db[_0xbd8f('0x25')][_0xbd8f('0x38')](_0x21da54)[_0xbd8f('0x1f')](function(_0x4f2ebc){_0x166de7[_0xbd8f('0x38')]=_0x4f2ebc;if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x247b07['include']=[{'all':!![]}];}return db[_0xbd8f('0x25')][_0xbd8f('0x3a')](_0x247b07);})[_0xbd8f('0x1f')](function(_0x351027){_0x166de7[_0xbd8f('0x3b')]=_0x351027;return _0x166de7;})[_0xbd8f('0x1f')](respondWithFilteredResult(_0x2aefa2,_0x247b07))[_0xbd8f('0x3c')](handleError(_0x2aefa2,null));};exports[_0xbd8f('0x3d')]=function(_0x14b768,_0x5e1e77){var _0x52c62b={'raw':!![],'where':{'id':_0x14b768[_0xbd8f('0x3e')]['id']}},_0x2907a3={};_0x2907a3[_0xbd8f('0x29')]=_[_0xbd8f('0x3f')](db['CmHopperFinal'][_0xbd8f('0x26')]);_0x2907a3[_0xbd8f('0x2a')]=_[_0xbd8f('0x3f')](_0x14b768[_0xbd8f('0x2a')]);_0x2907a3[_0xbd8f('0x2b')]=_['intersection'](_0x2907a3['model'],_0x2907a3[_0xbd8f('0x2a')]);_0x52c62b['attributes']=_[_0xbd8f('0x2c')](_0x2907a3[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x2e')]));_0x52c62b[_0xbd8f('0x2d')]=_0x52c62b[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x52c62b['attributes']:_0x2907a3[_0xbd8f('0x29')];if(_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x52c62b[_0xbd8f('0x40')]=[{'all':!![]}];}_0x52c62b=_[_0xbd8f('0x36')]({},_0x52c62b,_0x14b768[_0xbd8f('0x41')]);return db[_0xbd8f('0x25')][_0xbd8f('0x42')](_0x52c62b)['then'](handleEntityNotFound(_0x5e1e77,null))[_0xbd8f('0x1f')](respondWithResult(_0x5e1e77,null))[_0xbd8f('0x3c')](handleError(_0x5e1e77,null));};exports[_0xbd8f('0x43')]=function(_0x1f12dd,_0x2fdbd0){return db[_0xbd8f('0x25')][_0xbd8f('0x43')]()[_0xbd8f('0x1f')](respondWithResult(_0x2fdbd0,null))[_0xbd8f('0x3c')](handleError(_0x2fdbd0,null));};exports[_0xbd8f('0x1e')]=function(_0x406741,_0x255c59){if(_0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')]){delete _0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')];}return db[_0xbd8f('0x25')][_0xbd8f('0x42')]({'where':{'uniqueid':_0x406741[_0xbd8f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x255c59,null))[_0xbd8f('0x1f')](saveUpdates(_0x406741[_0xbd8f('0x44')],null))[_0xbd8f('0x1f')](respondWithResult(_0x255c59,null))[_0xbd8f('0x3c')](handleError(_0x255c59,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x1b38ad,_0x5a33c5,_0x9bfe93){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'VoiceQueueId':_0x1b38ad[_0xbd8f('0x3e')]['id']},'attributes':[[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')]('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),_0xbd8f('0x51')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),'reCallContacts'],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x5a33c5,null))[_0xbd8f('0x1f')](respondWithResult(_0x5a33c5,null))[_0xbd8f('0x3c')](handleError(_0x5a33c5,null));};exports[_0xbd8f('0x54')]=function(_0x93452d,_0x4a86a9,_0x5ea275){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'CampaignId':_0x93452d[_0xbd8f('0x3e')]['id']},'attributes':[[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),'abandonedContacts'],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),_0xbd8f('0x55')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x56')))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x4a86a9,null))[_0xbd8f('0x1f')](respondWithResult(_0x4a86a9,null))[_0xbd8f('0x3c')](handleError(_0x4a86a9,null));};exports[_0xbd8f('0x57')]=function(_0x5a8c8f,_0x5c04d9,_0x2407e7){return db[_0xbd8f('0x58')][_0xbd8f('0x42')]({'where':{'id':_0x5a8c8f[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x5c04d9,null))['then'](function(_0x200718){var _0x27ec14;if(_0x200718){_0x27ec14=squel[_0xbd8f('0x59')]()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x61'),_0xbd8f('0x62'),_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x66'),_0xbd8f('0x5d'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),'ListId')['field'](_0xbd8f('0x69'),_0xbd8f('0x61'))['field'](_0xbd8f('0x6a'),'createdAt')[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')]('cm_hopper_final')[_0xbd8f('0x33')](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x5a8c8f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x5d'))[_0xbd8f('0x6b')]('cm_hopper')[_0xbd8f('0x33')]('VoiceQueueId\x20=\x20?',_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()[_0xbd8f('0x65')](_0xbd8f('0x71'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))['where'](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')]('state\x20=\x204'))['group'](_0xbd8f('0x5f')))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x27ec14);}return[];})[_0xbd8f('0x1f')](respondWithResult(_0x5c04d9,null))['catch'](handleError(_0x5c04d9,null));};exports[_0xbd8f('0x74')]=function(_0x13314f,_0x328bd6,_0x11a05a){return db[_0xbd8f('0x75')]['find']({'where':{'id':_0x13314f['params']['id']}})['then'](handleEntityNotFound(_0x328bd6,null))[_0xbd8f('0x1f')](function(_0x5df0e1){var _0x535869;if(_0x5df0e1){_0x535869=squel['insert']()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x76'),'createdAt',_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')]('ANY_VALUE(calleridnum)',_0xbd8f('0x5d'))[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),_0xbd8f('0x60'))['field'](_0xbd8f('0x77'),_0xbd8f('0x76'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x62'))['field'](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))[_0xbd8f('0x33')]('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x13314f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xbd8f('0x64')]()['field']('phone')['from'](_0xbd8f('0x5b'))[_0xbd8f('0x33')](_0xbd8f('0x78'),_0x13314f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()['field'](_0xbd8f('0x71'))['from'](_0xbd8f('0x72'))['where']('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x79')))[_0xbd8f('0x7a')]('ContactId'))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x535869);}return[];})['then'](respondWithResult(_0x328bd6,null))[_0xbd8f('0x3c')](handleError(_0x328bd6,null));};exports[_0xbd8f('0x7b')]=function(_0x38d1a6,_0x31b92c,_0x11fb11){return db[_0xbd8f('0x7c')][_0xbd8f('0x7d')]({'where':{'VoiceQueueId':_0x38d1a6[_0xbd8f('0x44')][_0xbd8f('0x61')],'CampaignId':_0x38d1a6[_0xbd8f('0x44')]['CampaignId'],'ContactId':_0x38d1a6['body']['ContactId']}})['then'](handleEntityNotFound(_0x31b92c,null))[_0xbd8f('0x1f')](function(_0x3ff503){if(_0x3ff503){return _0x3ff503;}return null;})['then'](respondWithResult(_0x31b92c,null))['catch'](handleError(_0x31b92c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8a26dff..09ffd6c 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 _0x6655=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_hopper_final','calleridnum','lodash','util','../../config/logger'];(function(_0x427080,_0x51e019){var _0x4e61d6=function(_0x99138b){while(--_0x99138b){_0x427080['push'](_0x427080['shift']());}};_0x4e61d6(++_0x51e019);}(_0x6655,0x1a1));var _0x5665=function(_0x21219b,_0x215e1f){_0x21219b=_0x21219b-0x0;var _0x54b5ed=_0x6655[_0x21219b];return _0x54b5ed;};'use strict';var _=require(_0x5665('0x0'));var util=require(_0x5665('0x1'));var logger=require(_0x5665('0x2'))(_0x5665('0x3'));var moment=require(_0x5665('0x4'));var BPromise=require(_0x5665('0x5'));var rp=require(_0x5665('0x6'));var fs=require('fs');var path=require(_0x5665('0x7'));var rimraf=require(_0x5665('0x8'));var config=require(_0x5665('0x9'));var attributes=require('./cmHopperFinal.attributes');module[_0x5665('0xa')]=function(_0x1ba58a,_0x10eaa1){return _0x1ba58a[_0x5665('0xb')]('CmHopperFinal',attributes,{'tableName':_0x5665('0xc'),'paranoid':![],'indexes':[{'name':_0x5665('0xd'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b46=['path','rimraf','./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','request-promise'];(function(_0x586685,_0x5a257b){var _0x2d40f5=function(_0x4821dd){while(--_0x4821dd){_0x586685['push'](_0x586685['shift']());}};_0x2d40f5(++_0x5a257b);}(_0x5b46,0x1c3));var _0x65b4=function(_0x2a1cc2,_0x15fea0){_0x2a1cc2=_0x2a1cc2-0x0;var _0x20f8c4=_0x5b46[_0x2a1cc2];return _0x20f8c4;};'use strict';var _=require(_0x65b4('0x0'));var util=require('util');var logger=require(_0x65b4('0x1'))(_0x65b4('0x2'));var moment=require(_0x65b4('0x3'));var BPromise=require('bluebird');var rp=require(_0x65b4('0x4'));var fs=require('fs');var path=require(_0x65b4('0x5'));var rimraf=require(_0x65b4('0x6'));var config=require('../../config/environment');var attributes=require(_0x65b4('0x7'));module[_0x65b4('0x8')]=function(_0x2126bd,_0x1506a7){return _0x2126bd['define']('CmHopperFinal',attributes,{'tableName':_0x65b4('0x9'),'paranoid':![],'indexes':[{'name':_0x65b4('0xa'),'fields':[_0x65b4('0xa')]},{'name':_0x65b4('0xb'),'fields':[_0x65b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 5dbb830..f8e1cbf 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4710e4,_0x587975){var _0x1f3f2d=function(_0x294354){while(--_0x294354){_0x4710e4['push'](_0x4710e4['shift']());}};_0x1f3f2d(++_0x587975);}(_0x7a54,0x106));var _0x47a5=function(_0x31dbe0,_0x5ad6b9){_0x31dbe0=_0x31dbe0-0x0;var _0x3f2ff1=_0x7a54[_0x31dbe0];return _0x3f2ff1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x5e340f,_0x10ce51){var _0x2f014f=function(_0x1bdf59){while(--_0x1bdf59){_0x5e340f['push'](_0x5e340f['shift']());}};_0x2f014f(++_0x10ce51);}(_0x7a54,0x106));var _0x47a5=function(_0x162d90,_0x5e34ef){_0x162d90=_0x162d90-0x0;var _0x55ab7c=_0x7a54[_0x162d90];return _0x55ab7c;};'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 69a9621..343d633 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 _0x8107=['/checkContactHopper','checkContactHopper','/:id','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','isAuthenticated','describe','get','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x32b8a9,_0x59d62b){var _0x40105c=function(_0x54c048){while(--_0x54c048){_0x32b8a9['push'](_0x32b8a9['shift']());}};_0x40105c(++_0x59d62b);}(_0x8107,0x109));var _0x7810=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0x8107[_0x39157f];return _0x1ae4e2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7810('0x0'));var timeout=require(_0x7810('0x1'));var express=require(_0x7810('0x2'));var router=express[_0x7810('0x3')]();var fs_extra=require(_0x7810('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7810('0x5'));var config=require(_0x7810('0x6'));var controller=require(_0x7810('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7810('0x8')]);router['get']('/describe',auth[_0x7810('0x9')](),controller[_0x7810('0xa')]);router[_0x7810('0xb')]('/:id',auth[_0x7810('0x9')](),controller[_0x7810('0xc')]);router[_0x7810('0xb')]('/voice/queue/countAttributes/:id',auth[_0x7810('0x9')](),controller[_0x7810('0xd')]);router[_0x7810('0xb')](_0x7810('0xe'),auth[_0x7810('0x9')](),controller[_0x7810('0xf')]);router['post'](_0x7810('0x10'),auth[_0x7810('0x9')](),controller[_0x7810('0x11')]);router[_0x7810('0x12')](_0x7810('0x13'),auth[_0x7810('0x9')](),controller[_0x7810('0x14')]);router['post'](_0x7810('0x15'),auth['isAuthenticated'](),controller[_0x7810('0x16')]);router['put'](_0x7810('0x17'),auth[_0x7810('0x9')](),controller[_0x7810('0x18')]);module[_0x7810('0x19')]=router; \ No newline at end of file +var _0xe20c=['express','Router','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path'];(function(_0x325590,_0x39b7ef){var _0x4925a5=function(_0x35e447){while(--_0x35e447){_0x325590['push'](_0x325590['shift']());}};_0x4925a5(++_0x39b7ef);}(_0xe20c,0x9f));var _0xce20=function(_0x5b2b80,_0x324e9d){_0x5b2b80=_0x5b2b80-0x0;var _0x401ac7=_0xe20c[_0x5b2b80];return _0x401ac7;};'use strict';var multer=require(_0xce20('0x0'));var util=require('util');var path=require(_0xce20('0x1'));var timeout=require('connect-timeout');var express=require(_0xce20('0x2'));var router=express[_0xce20('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xce20('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xce20('0x5')](),controller['index']);router[_0xce20('0x6')](_0xce20('0x7'),auth[_0xce20('0x5')](),controller[_0xce20('0x8')]);router[_0xce20('0x6')](_0xce20('0x9'),auth[_0xce20('0x5')](),controller[_0xce20('0xa')]);router[_0xce20('0x6')](_0xce20('0xb'),auth[_0xce20('0x5')](),controller[_0xce20('0xc')]);router[_0xce20('0x6')]('/campaign/countAttributes/:id',auth[_0xce20('0x5')](),controller[_0xce20('0xd')]);router[_0xce20('0xe')](_0xce20('0xf'),auth[_0xce20('0x5')](),controller[_0xce20('0x10')]);router[_0xce20('0xe')]('/voice/campaign/moveContacts/:id',auth[_0xce20('0x5')](),controller[_0xce20('0x11')]);router[_0xce20('0xe')](_0xce20('0x12'),auth[_0xce20('0x5')](),controller[_0xce20('0x13')]);router[_0xce20('0x14')](_0xce20('0x9'),auth[_0xce20('0x5')](),controller[_0xce20('0x15')]);module[_0xce20('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 03ddd10..cc41f3b 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 _0xd9cb=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xd9cb,0x1be));var _0xbd9c=function(_0x3c120e,_0x5094e9){_0x3c120e=_0x3c120e-0x0;var _0x21d514=_0xd9cb[_0x3c120e];return _0x21d514;};'use strict';var Sequelize=require(_0xbd9c('0x0'));module['exports']={'state':{'type':Sequelize[_0xbd9c('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xbd9c('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xbd9c('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbd9c('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbd9c('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbd9c('0x2')]},'originatecalleridname':{'type':Sequelize[_0xbd9c('0x2')]},'calleridnum':{'type':Sequelize[_0xbd9c('0x2')]},'calleridname':{'type':Sequelize[_0xbd9c('0x2')]},'starttime':{'type':Sequelize[_0xbd9c('0x3')]},'responsetime':{'type':Sequelize[_0xbd9c('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xbd9c('0x3')]},'endtime':{'type':Sequelize[_0xbd9c('0x3')]},'ringtime':{'type':Sequelize[_0xbd9c('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbd9c('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbd9c('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbd9c('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbd9c('0x2')]},'campaign':{'type':Sequelize[_0xbd9c('0x2')]},'campaigntype':{'type':Sequelize[_0xbd9c('0x2')]},'membername':{'type':Sequelize[_0xbd9c('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xbd9c('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xbd9c('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbd9c('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbd9c('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbd9c('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xbd9c('0x2')]}}; \ No newline at end of file +var _0xadf4=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xadf4,0x8d));var _0x4adf=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xadf4[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require('sequelize');module[_0x4adf('0x0')]={'state':{'type':Sequelize[_0x4adf('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4adf('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4adf('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4adf('0x3')]},'responsetime':{'type':Sequelize[_0x4adf('0x3')]},'answertime':{'type':Sequelize[_0x4adf('0x3')]},'droptime':{'type':Sequelize[_0x4adf('0x3')]},'endtime':{'type':Sequelize[_0x4adf('0x3')]},'ringtime':{'type':Sequelize[_0x4adf('0x1')],'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['STRING']},'campaigntype':{'type':Sequelize[_0x4adf('0x2')]},'membername':{'type':Sequelize[_0x4adf('0x2')]},'reason':{'type':Sequelize[_0x4adf('0x2')]},'amd':{'type':Sequelize[_0x4adf('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4adf('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4adf('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4adf('0x3')]},'recallme':{'type':Sequelize[_0x4adf('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4adf('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4adf('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 86655d5..3aebd92 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 _0xb000=['index','map','CmHopperHistory','fieldName','type','key','keys','intersection','model','query','attributes','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','merge','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','update','then','sendStatus','error','stack','name'];(function(_0x2f987,_0x31a5ec){var _0x45c1d9=function(_0x5ef787){while(--_0x5ef787){_0x2f987['push'](_0x2f987['shift']());}};_0x45c1d9(++_0x31a5ec);}(_0xb000,0x107));var _0x0b00=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0xb000[_0x39872b];return _0x55fa18;};'use strict';var emlformat=require(_0x0b00('0x0'));var rimraf=require(_0x0b00('0x1'));var zipdir=require(_0x0b00('0x2'));var jsonpatch=require(_0x0b00('0x3'));var rp=require(_0x0b00('0x4'));var moment=require('moment');var BPromise=require(_0x0b00('0x5'));var Mustache=require(_0x0b00('0x6'));var util=require(_0x0b00('0x7'));var path=require(_0x0b00('0x8'));var sox=require('sox');var csv=require(_0x0b00('0x9'));var ejs=require(_0x0b00('0xa'));var fs=require('fs');var fs_extra=require(_0x0b00('0xb'));var _=require('lodash');var squel=require(_0x0b00('0xc'));var crypto=require(_0x0b00('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0b00('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0b00('0xf'));var Papa=require('papaparse');var Redis=require(_0x0b00('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0b00('0x11'));var as=require(_0x0b00('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b00('0x13'))(_0x0b00('0x14'));var utils=require(_0x0b00('0x15'));var config=require(_0x0b00('0x16'));var licenseUtil=require(_0x0b00('0x17'));var db=require(_0x0b00('0x18'))['db'];function respondWithStatusCode(_0x5bd346,_0x5a436a){_0x5a436a=_0x5a436a||0xcc;return function(_0x4d7698){if(_0x4d7698){return _0x5bd346['sendStatus'](_0x5a436a);}return _0x5bd346['status'](_0x5a436a)[_0x0b00('0x19')]();};}function respondWithResult(_0x3a75bd,_0x4fe3dc){_0x4fe3dc=_0x4fe3dc||0xc8;return function(_0x45e645){if(_0x45e645){return _0x3a75bd['status'](_0x4fe3dc)['json'](_0x45e645);}};}function respondWithFilteredResult(_0x21983f,_0x1e400b){return function(_0x649356){if(_0x649356){var _0x121d17=typeof _0x1e400b[_0x0b00('0x1a')]==='undefined'&&typeof _0x1e400b[_0x0b00('0x1b')]===_0x0b00('0x1c');var _0x49fd47=_0x649356[_0x0b00('0x1d')];var _0xa85cfd=_0x121d17?0x0:_0x1e400b[_0x0b00('0x1a')];var _0x4cafcb=_0x121d17?_0x649356[_0x0b00('0x1d')]:_0x1e400b[_0x0b00('0x1a')]+_0x1e400b[_0x0b00('0x1b')];var _0x180831;if(_0x4cafcb>=_0x49fd47){_0x4cafcb=_0x49fd47;_0x180831=0xc8;}else{_0x180831=0xce;}_0x21983f[_0x0b00('0x1e')](_0x180831);return _0x21983f[_0x0b00('0x1f')](_0x0b00('0x20'),_0xa85cfd+'-'+_0x4cafcb+'/'+_0x49fd47)[_0x0b00('0x21')](_0x649356);}return null;};}function patchUpdates(_0x5573c1){return function(_0x15157d){try{jsonpatch[_0x0b00('0x22')](_0x15157d,_0x5573c1,!![]);}catch(_0x160124){return BPromise['reject'](_0x160124);}return _0x15157d['save']();};}function saveUpdates(_0x5bf96d,_0x76d74a){return function(_0x568cd1){if(_0x568cd1){return _0x568cd1[_0x0b00('0x23')](_0x5bf96d)[_0x0b00('0x24')](function(_0x30bc09){return _0x30bc09;});}return null;};}function removeEntity(_0x5ca017,_0x46aaba){return function(_0x7541aa){if(_0x7541aa){return _0x7541aa['destroy']()[_0x0b00('0x24')](function(){_0x5ca017['status'](0xcc)[_0x0b00('0x19')]();});}};}function handleEntityNotFound(_0x8956ed,_0x2b49b6){return function(_0x54f2a2){if(!_0x54f2a2){_0x8956ed[_0x0b00('0x25')](0x194);}return _0x54f2a2;};}function handleError(_0x44a4ba,_0x1c70c7){_0x1c70c7=_0x1c70c7||0x1f4;return function(_0x139b65){logger[_0x0b00('0x26')](_0x139b65[_0x0b00('0x27')]);if(_0x139b65['name']){delete _0x139b65[_0x0b00('0x28')];}_0x44a4ba['status'](_0x1c70c7)['send'](_0x139b65);};}exports[_0x0b00('0x29')]=function(_0x52567c,_0x5a8bbc){var _0x1e4206={},_0x387e82={},_0x5e049c={'count':0x0,'rows':[]};var _0x1bbe4f=_[_0x0b00('0x2a')](db[_0x0b00('0x2b')]['rawAttributes'],function(_0x10c04a){return{'name':_0x10c04a[_0x0b00('0x2c')],'type':_0x10c04a[_0x0b00('0x2d')][_0x0b00('0x2e')]};});_0x387e82['model']=_[_0x0b00('0x2a')](_0x1bbe4f,_0x0b00('0x28'));_0x387e82['query']=_[_0x0b00('0x2f')](_0x52567c['query']);_0x387e82['filters']=_[_0x0b00('0x30')](_0x387e82[_0x0b00('0x31')],_0x387e82[_0x0b00('0x32')]);_0x1e4206[_0x0b00('0x33')]=_[_0x0b00('0x30')](_0x387e82[_0x0b00('0x31')],qs['fields'](_0x52567c[_0x0b00('0x32')]['fields']));_0x1e4206[_0x0b00('0x33')]=_0x1e4206[_0x0b00('0x33')][_0x0b00('0x34')]?_0x1e4206['attributes']:_0x387e82[_0x0b00('0x31')];if(!_0x52567c[_0x0b00('0x32')][_0x0b00('0x35')]('nolimit')){_0x1e4206['limit']=qs[_0x0b00('0x1b')](_0x52567c[_0x0b00('0x32')][_0x0b00('0x1b')]);_0x1e4206[_0x0b00('0x1a')]=qs[_0x0b00('0x1a')](_0x52567c['query']['offset']);}_0x1e4206[_0x0b00('0x36')]=qs[_0x0b00('0x37')](_0x52567c[_0x0b00('0x32')][_0x0b00('0x37')]);_0x1e4206[_0x0b00('0x38')]=qs[_0x0b00('0x39')](_['pick'](_0x52567c['query'],_0x387e82['filters']),_0x1bbe4f);if(_0x52567c[_0x0b00('0x32')][_0x0b00('0x3a')]){_0x1e4206[_0x0b00('0x38')]=_['merge'](_0x1e4206[_0x0b00('0x38')],{'$or':_['map'](_0x1bbe4f,function(_0x5a4590){if(_0x5a4590['type']!==_0x0b00('0x3b')){var _0x328940={};_0x328940[_0x5a4590['name']]={'$like':'%'+_0x52567c[_0x0b00('0x32')][_0x0b00('0x3a')]+'%'};return _0x328940;}})});}_0x1e4206=_['merge']({},_0x1e4206,_0x52567c[_0x0b00('0x3c')]);var _0x297153={'where':_0x1e4206[_0x0b00('0x38')]};return db['CmHopperHistory'][_0x0b00('0x1d')](_0x297153)['then'](function(_0x43cda6){_0x5e049c[_0x0b00('0x1d')]=_0x43cda6;if(_0x52567c[_0x0b00('0x32')]['includeAll']){_0x1e4206[_0x0b00('0x3d')]=[{'all':!![]}];}return db[_0x0b00('0x2b')][_0x0b00('0x3e')](_0x1e4206);})[_0x0b00('0x24')](function(_0x1cb36e){_0x5e049c[_0x0b00('0x3f')]=_0x1cb36e;return _0x5e049c;})[_0x0b00('0x24')](respondWithFilteredResult(_0x5a8bbc,_0x1e4206))[_0x0b00('0x40')](handleError(_0x5a8bbc,null));};exports[_0x0b00('0x41')]=function(_0x152412,_0x547aac){var _0x1a2dd3={'raw':!![],'where':{'id':_0x152412[_0x0b00('0x42')]['id']}},_0x3ac844={};_0x3ac844[_0x0b00('0x31')]=_[_0x0b00('0x2f')](db[_0x0b00('0x2b')][_0x0b00('0x43')]);_0x3ac844[_0x0b00('0x32')]=_[_0x0b00('0x2f')](_0x152412[_0x0b00('0x32')]);_0x3ac844[_0x0b00('0x39')]=_[_0x0b00('0x30')](_0x3ac844[_0x0b00('0x31')],_0x3ac844[_0x0b00('0x32')]);_0x1a2dd3[_0x0b00('0x33')]=_['intersection'](_0x3ac844['model'],qs['fields'](_0x152412[_0x0b00('0x32')][_0x0b00('0x44')]));_0x1a2dd3[_0x0b00('0x33')]=_0x1a2dd3[_0x0b00('0x33')][_0x0b00('0x34')]?_0x1a2dd3[_0x0b00('0x33')]:_0x3ac844[_0x0b00('0x31')];if(_0x152412[_0x0b00('0x32')][_0x0b00('0x45')]){_0x1a2dd3['include']=[{'all':!![]}];}_0x1a2dd3=_[_0x0b00('0x46')]({},_0x1a2dd3,_0x152412[_0x0b00('0x3c')]);return db[_0x0b00('0x2b')][_0x0b00('0x47')](_0x1a2dd3)[_0x0b00('0x24')](handleEntityNotFound(_0x547aac,null))[_0x0b00('0x24')](respondWithResult(_0x547aac,null))['catch'](handleError(_0x547aac,null));};exports[_0x0b00('0x48')]=function(_0x54e455,_0x59f9ad){return db[_0x0b00('0x2b')][_0x0b00('0x48')](_0x54e455[_0x0b00('0x49')],{})[_0x0b00('0x24')](respondWithResult(_0x59f9ad,0xc9))[_0x0b00('0x40')](handleError(_0x59f9ad,null));};exports[_0x0b00('0x4a')]=function(_0x5198ff,_0x517ee4){return db['CmHopperHistory'][_0x0b00('0x4a')]()[_0x0b00('0x24')](respondWithResult(_0x517ee4,null))[_0x0b00('0x40')](handleError(_0x517ee4,null));};exports['update']=function(_0x59a81a,_0x47050b){if(_0x59a81a[_0x0b00('0x49')][_0x0b00('0x4b')]){delete _0x59a81a[_0x0b00('0x49')]['uniqueid'];}return db[_0x0b00('0x2b')][_0x0b00('0x47')]({'where':{'uniqueid':_0x59a81a[_0x0b00('0x42')]['id']}})[_0x0b00('0x24')](handleEntityNotFound(_0x47050b,null))[_0x0b00('0x24')](saveUpdates(_0x59a81a['body'],null))['then'](respondWithResult(_0x47050b,null))[_0x0b00('0x40')](handleError(_0x47050b,null));}; \ No newline at end of file +var _0x77e2=['CmHopperHistory','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','uniqueid','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','index','map'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x77e2,0x188));var _0x277e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77e2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x277e('0x0'));var rp=require(_0x277e('0x1'));var moment=require(_0x277e('0x2'));var BPromise=require(_0x277e('0x3'));var Mustache=require(_0x277e('0x4'));var util=require(_0x277e('0x5'));var path=require(_0x277e('0x6'));var sox=require(_0x277e('0x7'));var csv=require(_0x277e('0x8'));var ejs=require(_0x277e('0x9'));var fs=require('fs');var fs_extra=require(_0x277e('0xa'));var _=require(_0x277e('0xb'));var squel=require('squel');var crypto=require(_0x277e('0xc'));var jsforce=require(_0x277e('0xd'));var deskjs=require(_0x277e('0xe'));var toCsv=require(_0x277e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x277e('0xf'));var authService=require(_0x277e('0x10'));var qs=require(_0x277e('0x11'));var as=require(_0x277e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x277e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x277e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1daaa9,_0x201c61){_0x201c61=_0x201c61||0xcc;return function(_0x5a5e6e){if(_0x5a5e6e){return _0x1daaa9[_0x277e('0x15')](_0x201c61);}return _0x1daaa9[_0x277e('0x16')](_0x201c61)[_0x277e('0x17')]();};}function respondWithResult(_0x86fe29,_0x5a8ec9){_0x5a8ec9=_0x5a8ec9||0xc8;return function(_0x53f0e1){if(_0x53f0e1){return _0x86fe29[_0x277e('0x16')](_0x5a8ec9)[_0x277e('0x18')](_0x53f0e1);}};}function respondWithFilteredResult(_0x25533e,_0x47f34f){return function(_0x4bc480){if(_0x4bc480){var _0x4714a4=typeof _0x47f34f[_0x277e('0x19')]===_0x277e('0x1a')&&typeof _0x47f34f[_0x277e('0x1b')]===_0x277e('0x1a');var _0x1e757b=_0x4bc480['count'];var _0x4dafa9=_0x4714a4?0x0:_0x47f34f[_0x277e('0x19')];var _0xfe57f3=_0x4714a4?_0x4bc480[_0x277e('0x1c')]:_0x47f34f[_0x277e('0x19')]+_0x47f34f[_0x277e('0x1b')];var _0x1c9e28;if(_0xfe57f3>=_0x1e757b){_0xfe57f3=_0x1e757b;_0x1c9e28=0xc8;}else{_0x1c9e28=0xce;}_0x25533e[_0x277e('0x16')](_0x1c9e28);return _0x25533e[_0x277e('0x1d')](_0x277e('0x1e'),_0x4dafa9+'-'+_0xfe57f3+'/'+_0x1e757b)[_0x277e('0x18')](_0x4bc480);}return null;};}function patchUpdates(_0x205cf9){return function(_0xbd25a0){try{jsonpatch[_0x277e('0x1f')](_0xbd25a0,_0x205cf9,!![]);}catch(_0xcdb8c7){return BPromise['reject'](_0xcdb8c7);}return _0xbd25a0[_0x277e('0x20')]();};}function saveUpdates(_0x5ccea9,_0x3b5882){return function(_0x38bc8b){if(_0x38bc8b){return _0x38bc8b['update'](_0x5ccea9)[_0x277e('0x21')](function(_0x141eaa){return _0x141eaa;});}return null;};}function removeEntity(_0x527b83,_0x361b30){return function(_0x36f525){if(_0x36f525){return _0x36f525[_0x277e('0x22')]()[_0x277e('0x21')](function(){_0x527b83[_0x277e('0x16')](0xcc)[_0x277e('0x17')]();});}};}function handleEntityNotFound(_0x1a0dd1,_0x606770){return function(_0xb2eb8e){if(!_0xb2eb8e){_0x1a0dd1['sendStatus'](0x194);}return _0xb2eb8e;};}function handleError(_0xc34c8c,_0x2b20b8){_0x2b20b8=_0x2b20b8||0x1f4;return function(_0x29e1c0){logger[_0x277e('0x23')](_0x29e1c0['stack']);if(_0x29e1c0[_0x277e('0x24')]){delete _0x29e1c0[_0x277e('0x24')];}_0xc34c8c[_0x277e('0x16')](_0x2b20b8)[_0x277e('0x25')](_0x29e1c0);};}exports[_0x277e('0x26')]=function(_0x3e6328,_0x463c67){var _0x40847a={},_0x2ac524={},_0x36cde6={'count':0x0,'rows':[]};var _0x52cd05=_[_0x277e('0x27')](db[_0x277e('0x28')][_0x277e('0x29')],function(_0xf021b1){return{'name':_0xf021b1[_0x277e('0x2a')],'type':_0xf021b1[_0x277e('0x2b')][_0x277e('0x2c')]};});_0x2ac524['model']=_['map'](_0x52cd05,_0x277e('0x24'));_0x2ac524['query']=_[_0x277e('0x2d')](_0x3e6328['query']);_0x2ac524[_0x277e('0x2e')]=_[_0x277e('0x2f')](_0x2ac524[_0x277e('0x30')],_0x2ac524[_0x277e('0x31')]);_0x40847a[_0x277e('0x32')]=_[_0x277e('0x2f')](_0x2ac524[_0x277e('0x30')],qs[_0x277e('0x33')](_0x3e6328[_0x277e('0x31')]['fields']));_0x40847a[_0x277e('0x32')]=_0x40847a[_0x277e('0x32')]['length']?_0x40847a[_0x277e('0x32')]:_0x2ac524['model'];if(!_0x3e6328[_0x277e('0x31')][_0x277e('0x34')](_0x277e('0x35'))){_0x40847a[_0x277e('0x1b')]=qs[_0x277e('0x1b')](_0x3e6328['query'][_0x277e('0x1b')]);_0x40847a[_0x277e('0x19')]=qs[_0x277e('0x19')](_0x3e6328['query'][_0x277e('0x19')]);}_0x40847a['order']=qs[_0x277e('0x36')](_0x3e6328['query']['sort']);_0x40847a[_0x277e('0x37')]=qs[_0x277e('0x2e')](_['pick'](_0x3e6328[_0x277e('0x31')],_0x2ac524[_0x277e('0x2e')]),_0x52cd05);if(_0x3e6328[_0x277e('0x31')]['filter']){_0x40847a['where']=_[_0x277e('0x38')](_0x40847a['where'],{'$or':_['map'](_0x52cd05,function(_0x4b03bc){if(_0x4b03bc[_0x277e('0x2b')]!==_0x277e('0x39')){var _0x2ca52b={};_0x2ca52b[_0x4b03bc[_0x277e('0x24')]]={'$like':'%'+_0x3e6328['query'][_0x277e('0x3a')]+'%'};return _0x2ca52b;}})});}_0x40847a=_['merge']({},_0x40847a,_0x3e6328[_0x277e('0x3b')]);var _0x29ef63={'where':_0x40847a[_0x277e('0x37')]};return db[_0x277e('0x28')][_0x277e('0x1c')](_0x29ef63)[_0x277e('0x21')](function(_0x4988e1){_0x36cde6[_0x277e('0x1c')]=_0x4988e1;if(_0x3e6328['query'][_0x277e('0x3c')]){_0x40847a[_0x277e('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x277e('0x3e')](_0x40847a);})[_0x277e('0x21')](function(_0xbff7f){_0x36cde6[_0x277e('0x3f')]=_0xbff7f;return _0x36cde6;})['then'](respondWithFilteredResult(_0x463c67,_0x40847a))[_0x277e('0x40')](handleError(_0x463c67,null));};exports[_0x277e('0x41')]=function(_0x2373e9,_0x4c8169){var _0x112c0c={'raw':!![],'where':{'id':_0x2373e9[_0x277e('0x42')]['id']}},_0x3a93e2={};_0x3a93e2['model']=_[_0x277e('0x2d')](db[_0x277e('0x28')]['rawAttributes']);_0x3a93e2[_0x277e('0x31')]=_[_0x277e('0x2d')](_0x2373e9['query']);_0x3a93e2[_0x277e('0x2e')]=_['intersection'](_0x3a93e2['model'],_0x3a93e2[_0x277e('0x31')]);_0x112c0c[_0x277e('0x32')]=_[_0x277e('0x2f')](_0x3a93e2[_0x277e('0x30')],qs[_0x277e('0x33')](_0x2373e9['query'][_0x277e('0x33')]));_0x112c0c['attributes']=_0x112c0c[_0x277e('0x32')]['length']?_0x112c0c['attributes']:_0x3a93e2[_0x277e('0x30')];if(_0x2373e9[_0x277e('0x31')][_0x277e('0x3c')]){_0x112c0c[_0x277e('0x3d')]=[{'all':!![]}];}_0x112c0c=_[_0x277e('0x38')]({},_0x112c0c,_0x2373e9[_0x277e('0x3b')]);return db['CmHopperHistory'][_0x277e('0x43')](_0x112c0c)[_0x277e('0x21')](handleEntityNotFound(_0x4c8169,null))[_0x277e('0x21')](respondWithResult(_0x4c8169,null))[_0x277e('0x40')](handleError(_0x4c8169,null));};exports[_0x277e('0x44')]=function(_0x677e1c,_0x393c51){return db['CmHopperHistory'][_0x277e('0x44')](_0x677e1c['body'],{})['then'](respondWithResult(_0x393c51,0xc9))[_0x277e('0x40')](handleError(_0x393c51,null));};exports['describe']=function(_0x28d910,_0xcdc49e){return db[_0x277e('0x28')]['describe']()[_0x277e('0x21')](respondWithResult(_0xcdc49e,null))['catch'](handleError(_0xcdc49e,null));};exports[_0x277e('0x45')]=function(_0x426d58,_0x315320){if(_0x426d58[_0x277e('0x46')][_0x277e('0x47')]){delete _0x426d58[_0x277e('0x46')]['uniqueid'];}return db[_0x277e('0x28')][_0x277e('0x43')]({'where':{'uniqueid':_0x426d58[_0x277e('0x42')]['id']}})['then'](handleEntityNotFound(_0x315320,null))['then'](saveUpdates(_0x426d58[_0x277e('0x46')],null))[_0x277e('0x21')](respondWithResult(_0x315320,null))['catch'](handleError(_0x315320,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 7d951ac..7c59987 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 _0x50a8=['request-promise','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','api','moment','bluebird'];(function(_0x2420fe,_0x358729){var _0x591f60=function(_0x398cea){while(--_0x398cea){_0x2420fe['push'](_0x2420fe['shift']());}};_0x591f60(++_0x358729);}(_0x50a8,0x193));var _0x850a=function(_0x496624,_0x16d7ab){_0x496624=_0x496624-0x0;var _0x3c4852=_0x50a8[_0x496624];return _0x3c4852;};'use strict';var _=require('lodash');var util=require(_0x850a('0x0'));var logger=require('../../config/logger')(_0x850a('0x1'));var moment=require(_0x850a('0x2'));var BPromise=require(_0x850a('0x3'));var rp=require(_0x850a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x850a('0x5'));module[_0x850a('0x6')]=function(_0x530b92,_0x31c037){return _0x530b92['define'](_0x850a('0x7'),attributes,{'tableName':_0x850a('0x8'),'paranoid':![],'indexes':[{'name':_0x850a('0x9'),'fields':['endtime']},{'name':_0x850a('0xa'),'fields':[_0x850a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x59bf1d,_0x31cf5a){var _0xd48420=function(_0x3eba23){while(--_0x3eba23){_0x59bf1d['push'](_0x59bf1d['shift']());}};_0xd48420(++_0x31cf5a);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 80f817b..b0f47c1 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 _0x79d3=['outboundReCallsDay','GetVoiceQueueHopperHistory','name','col','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','where','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`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','`state`\x20=\x2016,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'];(function(_0x17ab72,_0x25f422){var _0x2d4c16=function(_0x15ff03){while(--_0x15ff03){_0x17ab72['push'](_0x17ab72['shift']());}};_0x2d4c16(++_0x25f422);}(_0x79d3,0x179));var _0x379d=function(_0x19f040,_0x4b2d63){_0x19f040=_0x19f040-0x0;var _0x3ea60d=_0x79d3[_0x19f040];return _0x3ea60d;};'use strict';var _=require(_0x379d('0x0'));var util=require(_0x379d('0x1'));var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rs=require(_0x379d('0x4'));var fs=require('fs');var Redis=require(_0x379d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x379d('0x6'));var logger=require(_0x379d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x379d('0x8'));var client=jayson[_0x379d('0x9')][_0x379d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x214194,_0x2bf985,_0x4f32c7){return new BPromise(function(_0x226765,_0x1fb281){return client[_0x379d('0xb')](_0x214194,_0x4f32c7)['then'](function(_0x59c547){logger[_0x379d('0xc')](_0x379d('0xd'),_0x2bf985,'request\x20sent');logger[_0x379d('0xe')](_0x379d('0xf'),_0x2bf985,_0x379d('0x10'),JSON[_0x379d('0x11')](_0x59c547));if(_0x59c547['error']){if(_0x59c547[_0x379d('0x12')][_0x379d('0x13')]===0x1f4){logger['error'](_0x379d('0xd'),_0x2bf985,_0x59c547[_0x379d('0x12')]['message']);return _0x1fb281(_0x59c547['error'][_0x379d('0x14')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x2bf985,_0x59c547[_0x379d('0x12')]['message']);return _0x226765(_0x59c547[_0x379d('0x12')]['message']);}else{logger[_0x379d('0xc')](_0x379d('0xd'),_0x2bf985,_0x379d('0x10'));_0x226765(_0x59c547[_0x379d('0x15')][_0x379d('0x14')]);}})[_0x379d('0x16')](function(_0x18f0fb){logger[_0x379d('0x12')](_0x379d('0xd'),_0x2bf985,_0x18f0fb);_0x1fb281(_0x18f0fb);});});}exports[_0x379d('0x17')]=function(_0x58653d){var _0x4c2add=this;return new Promise(function(_0x37f319,_0xf18983){return db[_0x379d('0x18')][_0x379d('0x19')](_0x58653d[_0x379d('0x1a')],{'raw':_0x58653d[_0x379d('0x1b')]?_0x58653d['options'][_0x379d('0x1c')]===undefined?!![]:![]:!![]})[_0x379d('0x1d')](function(_0x34f791){logger[_0x379d('0xc')](_0x379d('0x17'),_0x58653d);logger[_0x379d('0xe')](_0x379d('0x17'),_0x58653d,JSON[_0x379d('0x11')](_0x34f791));_0x37f319(_0x34f791);})[_0x379d('0x16')](function(_0x139d23){logger[_0x379d('0x12')](_0x379d('0x17'),_0x139d23[_0x379d('0x14')],_0x58653d);_0xf18983(_0x4c2add[_0x379d('0x12')](0x1f4,_0x139d23[_0x379d('0x14')]));});});};exports[_0x379d('0x1e')]=function(_0x26e2b3){var _0x1471c8=this;return new Promise(function(_0x15c29c,_0x4a082b){return db[_0x379d('0x18')]['findAll']({'raw':_0x26e2b3[_0x379d('0x1b')]?_0x26e2b3[_0x379d('0x1b')][_0x379d('0x1c')]===undefined?!![]:![]:!![],'where':_0x26e2b3[_0x379d('0x1b')]?_0x26e2b3[_0x379d('0x1b')][_0x379d('0x1f')]||null:null,'attributes':[[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db[_0x379d('0x20')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db[_0x379d('0x20')]['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x23')))),_0x379d('0x24')],[db[_0x379d('0x20')]['fn']('COUNT',db[_0x379d('0x20')]['fn']('IF',db['sequelize'][_0x379d('0x22')](_0x379d('0x25')))),_0x379d('0x26')],[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db[_0x379d('0x20')]['fn']('IF',db['sequelize'][_0x379d('0x22')](_0x379d('0x27')))),_0x379d('0x28')],[db[_0x379d('0x20')]['fn'](_0x379d('0x29'),db['sequelize']['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x2a')))),'predictiveIntervalAvgHoldtime'],[db[_0x379d('0x20')]['fn'](_0x379d('0x29'),db['sequelize']['fn']('IF',db['sequelize'][_0x379d('0x22')](_0x379d('0x2b')))),_0x379d('0x2c')]]})[_0x379d('0x1d')](function(_0xd6bb2d){logger['info'](_0x379d('0x1e'),_0x26e2b3);logger['debug'](_0x379d('0x1e'),_0x26e2b3,JSON[_0x379d('0x11')](_0xd6bb2d));_0x15c29c(_0xd6bb2d);})[_0x379d('0x16')](function(_0x4cc85a){logger['error'](_0x379d('0x1e'),_0x4cc85a[_0x379d('0x14')],_0x26e2b3);_0x4a082b(_0x1471c8['error'](0x1f4,_0x4cc85a[_0x379d('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4f44d7){var _0x5455e3=this;return new Promise(function(_0x408740,_0x459dce){return db[_0x379d('0x18')][_0x379d('0x2d')]({'raw':_0x4f44d7[_0x379d('0x1b')]?_0x4f44d7[_0x379d('0x1b')][_0x379d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f44d7[_0x379d('0x1b')]?_0x4f44d7['options'][_0x379d('0x1f')]||null:null,'attributes':[[_0x379d('0x2e'),'name'],[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db[_0x379d('0x20')]['fn']('IF',db['sequelize'][_0x379d('0x22')](_0x379d('0x2f')))),_0x379d('0x30')],[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db[_0x379d('0x20')]['fn']('IF',db[_0x379d('0x20')]['literal'](_0x379d('0x31')))),_0x379d('0x32')],[db['sequelize']['fn'](_0x379d('0x21'),db['sequelize']['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x23')))),_0x379d('0x33')],[db[_0x379d('0x20')]['fn']('COUNT',db[_0x379d('0x20')]['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x34')))),_0x379d('0x35')],[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db['sequelize']['fn']('IF',db[_0x379d('0x20')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x379d('0x20')]['fn']('COUNT',db[_0x379d('0x20')]['fn']('IF',db['sequelize'][_0x379d('0x22')](_0x379d('0x36')))),'outboundDropCallsDayTimeout'],[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db[_0x379d('0x20')]['fn']('IF',db['sequelize'][_0x379d('0x22')](_0x379d('0x37')))),_0x379d('0x38')],[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db[_0x379d('0x20')]['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x39')))),_0x379d('0x3a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x379d('0x22')](_0x379d('0x3b')))),_0x379d('0x3c')],[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db['sequelize']['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x3d')))),_0x379d('0x3e')],[db[_0x379d('0x20')]['fn']('COUNT',db[_0x379d('0x20')]['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x3f')))),'outboundRejectCallsDay'],[db[_0x379d('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x40')))),'outboundAnswerAgiCallsDay'],[db[_0x379d('0x20')]['fn']('COUNT',db[_0x379d('0x20')]['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x379d('0x41')],[db[_0x379d('0x20')]['fn']('COUNT',db[_0x379d('0x20')]['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x42')))),_0x379d('0x43')]],'group':['campaign']})[_0x379d('0x1d')](function(_0x4fb8fe){logger['info'](_0x379d('0x44'),_0x4f44d7);logger[_0x379d('0xe')](_0x379d('0x44'),_0x4f44d7,JSON[_0x379d('0x11')](_0x4fb8fe));_0x408740(_0x4fb8fe);})['catch'](function(_0x58da4e){logger[_0x379d('0x12')](_0x379d('0x44'),_0x58da4e[_0x379d('0x14')],_0x4f44d7);_0x459dce(_0x5455e3[_0x379d('0x12')](0x1f4,_0x58da4e[_0x379d('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x1fdb72){var _0x11a6c8=this;return new Promise(function(_0x2d07f1,_0x2120e1){return db['CmHopperHistory']['findAll']({'raw':_0x1fdb72['options']?_0x1fdb72[_0x379d('0x1b')][_0x379d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fdb72[_0x379d('0x1b')]?_0x1fdb72[_0x379d('0x1b')][_0x379d('0x1f')]||null:null,'attributes':[[_0x379d('0x2e'),_0x379d('0x45')],[db['sequelize']['fn'](_0x379d('0x21'),db[_0x379d('0x20')][_0x379d('0x46')]('id')),_0x379d('0x47')],[db[_0x379d('0x20')]['fn'](_0x379d('0x21'),db[_0x379d('0x20')]['fn']('IF',db[_0x379d('0x20')][_0x379d('0x22')](_0x379d('0x23')))),_0x379d('0x48')]],'group':['campaign']})[_0x379d('0x1d')](function(_0x5bef33){logger[_0x379d('0xc')]('GetCampaignHopperHistory',_0x1fdb72);logger['debug'](_0x379d('0x49'),_0x1fdb72,JSON['stringify'](_0x5bef33));_0x2d07f1(_0x5bef33);})['catch'](function(_0x57587a){logger[_0x379d('0x12')](_0x379d('0x49'),_0x57587a['message'],_0x1fdb72);_0x2120e1(_0x11a6c8[_0x379d('0x12')](0x1f4,_0x57587a[_0x379d('0x14')]));});});}; \ No newline at end of file +var _0xd73a=['outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CmHopperHistory','create','options','then','CreateCmHopperHistory','stringify','AvgHandleTime','findAll','raw','where','sequelize','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x1aec7c,_0x185063){var _0x471cae=function(_0x304287){while(--_0x304287){_0x1aec7c['push'](_0x1aec7c['shift']());}};_0x471cae(++_0x185063);}(_0xd73a,0x171));var _0xad73=function(_0x27f2d7,_0x548782){_0x27f2d7=_0x27f2d7-0x0;var _0x50b1d6=_0xd73a[_0x27f2d7];return _0x50b1d6;};'use strict';var _=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var moment=require(_0xad73('0x2'));var BPromise=require(_0xad73('0x3'));var rs=require(_0xad73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad73('0x5'));var logger=require(_0xad73('0x6'))(_0xad73('0x7'));var config=require(_0xad73('0x8'));var jayson=require(_0xad73('0x9'));var client=jayson[_0xad73('0xa')][_0xad73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f4736,_0x24d620,_0x15cf28){return new BPromise(function(_0x1352b3,_0x524324){return client[_0xad73('0xc')](_0x2f4736,_0x15cf28)['then'](function(_0x3c07fa){logger[_0xad73('0xd')](_0xad73('0xe'),_0x24d620,'request\x20sent');logger[_0xad73('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x24d620,_0xad73('0x10'),JSON['stringify'](_0x3c07fa));if(_0x3c07fa[_0xad73('0x11')]){if(_0x3c07fa[_0xad73('0x11')][_0xad73('0x12')]===0x1f4){logger['error'](_0xad73('0xe'),_0x24d620,_0x3c07fa[_0xad73('0x11')]['message']);return _0x524324(_0x3c07fa[_0xad73('0x11')][_0xad73('0x13')]);}logger[_0xad73('0x11')](_0xad73('0xe'),_0x24d620,_0x3c07fa[_0xad73('0x11')][_0xad73('0x13')]);return _0x1352b3(_0x3c07fa['error'][_0xad73('0x13')]);}else{logger[_0xad73('0xd')](_0xad73('0xe'),_0x24d620,_0xad73('0x10'));_0x1352b3(_0x3c07fa[_0xad73('0x14')][_0xad73('0x13')]);}})[_0xad73('0x15')](function(_0x367a5d){logger[_0xad73('0x11')](_0xad73('0xe'),_0x24d620,_0x367a5d);_0x524324(_0x367a5d);});});}exports['CreateCmHopperHistory']=function(_0x47381a){var _0x4cafad=this;return new Promise(function(_0x5bd242,_0x28bd73){return db[_0xad73('0x16')][_0xad73('0x17')](_0x47381a['body'],{'raw':_0x47381a[_0xad73('0x18')]?_0x47381a[_0xad73('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xad73('0x19')](function(_0x4289df){logger[_0xad73('0xd')](_0xad73('0x1a'),_0x47381a);logger[_0xad73('0xf')](_0xad73('0x1a'),_0x47381a,JSON[_0xad73('0x1b')](_0x4289df));_0x5bd242(_0x4289df);})['catch'](function(_0xfe2758){logger[_0xad73('0x11')](_0xad73('0x1a'),_0xfe2758[_0xad73('0x13')],_0x47381a);_0x28bd73(_0x4cafad[_0xad73('0x11')](0x1f4,_0xfe2758[_0xad73('0x13')]));});});};exports[_0xad73('0x1c')]=function(_0x439f09){var _0xcdb93d=this;return new Promise(function(_0x68aa8c,_0x18e58b){return db[_0xad73('0x16')][_0xad73('0x1d')]({'raw':_0x439f09[_0xad73('0x18')]?_0x439f09[_0xad73('0x18')][_0xad73('0x1e')]===undefined?!![]:![]:!![],'where':_0x439f09[_0xad73('0x18')]?_0x439f09[_0xad73('0x18')][_0xad73('0x1f')]||null:null,'attributes':[[db[_0xad73('0x20')]['fn']('COUNT',db['sequelize']['col']('id')),_0xad73('0x21')],[db[_0xad73('0x20')]['fn']('COUNT',db[_0xad73('0x20')]['fn']('IF',db['sequelize']['literal'](_0xad73('0x22')))),_0xad73('0x23')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db['sequelize']['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xad73('0x27'),db['sequelize']['fn']('IF',db[_0xad73('0x20')]['literal'](_0xad73('0x28')))),_0xad73('0x29')],[db['sequelize']['fn']('AVG',db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xad73('0x2a')]]})['then'](function(_0x4016ec){logger[_0xad73('0xd')]('AvgHandleTime',_0x439f09);logger[_0xad73('0xf')]('AvgHandleTime',_0x439f09,JSON[_0xad73('0x1b')](_0x4016ec));_0x68aa8c(_0x4016ec);})[_0xad73('0x15')](function(_0x41f470){logger[_0xad73('0x11')](_0xad73('0x1c'),_0x41f470[_0xad73('0x13')],_0x439f09);_0x18e58b(_0xcdb93d[_0xad73('0x11')](0x1f4,_0x41f470[_0xad73('0x13')]));});});};exports[_0xad73('0x2b')]=function(_0x4cb85b){var _0x37e863=this;return new Promise(function(_0x3db333,_0x52169f){return db[_0xad73('0x16')][_0xad73('0x1d')]({'raw':_0x4cb85b[_0xad73('0x18')]?_0x4cb85b[_0xad73('0x18')][_0xad73('0x1e')]===undefined?!![]:![]:!![],'where':_0x4cb85b[_0xad73('0x18')]?_0x4cb85b[_0xad73('0x18')][_0xad73('0x1f')]||null:null,'attributes':[[_0xad73('0x2c'),'name'],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db['sequelize']['literal'](_0xad73('0x2d')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')]('`state`\x20=\x203,\x201,\x20null'))),_0xad73('0x2e')],[db[_0xad73('0x20')]['fn']('COUNT',db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal'](_0xad73('0x22')))),_0xad73('0x2f')],[db[_0xad73('0x20')]['fn']('COUNT',db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x30')))),_0xad73('0x31')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x32')))),_0xad73('0x33')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db['sequelize'][_0xad73('0x25')](_0xad73('0x34')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xad73('0x35')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db['sequelize']['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x36')))),_0xad73('0x37')],[db['sequelize']['fn']('COUNT',db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x38')))),_0xad73('0x39')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0xad73('0x3a')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db['sequelize']['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x3b')))),_0xad73('0x3c')],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal'](_0xad73('0x3d')))),_0xad73('0x3e')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db['sequelize']['fn']('IF',db['sequelize'][_0xad73('0x25')](_0xad73('0x3f')))),_0xad73('0x3c')],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x40')))),_0xad73('0x41')]],'group':[_0xad73('0x2c')]})[_0xad73('0x19')](function(_0x49c661){logger[_0xad73('0xd')]('GetVoiceQueueHopperHistory',_0x4cb85b);logger[_0xad73('0xf')]('GetVoiceQueueHopperHistory',_0x4cb85b,JSON['stringify'](_0x49c661));_0x3db333(_0x49c661);})[_0xad73('0x15')](function(_0x3f0e65){logger['error'](_0xad73('0x2b'),_0x3f0e65[_0xad73('0x13')],_0x4cb85b);_0x52169f(_0x37e863[_0xad73('0x11')](0x1f4,_0x3f0e65[_0xad73('0x13')]));});});};exports[_0xad73('0x42')]=function(_0x1202c4){var _0x3c804f=this;return new Promise(function(_0xf71ea2,_0xeeaa26){return db[_0xad73('0x16')]['findAll']({'raw':_0x1202c4[_0xad73('0x18')]?_0x1202c4['options'][_0xad73('0x1e')]===undefined?!![]:![]:!![],'where':_0x1202c4[_0xad73('0x18')]?_0x1202c4[_0xad73('0x18')][_0xad73('0x1f')]||null:null,'attributes':[['campaign',_0xad73('0x43')],[db['sequelize']['fn']('COUNT',db[_0xad73('0x20')]['col']('id')),_0xad73('0x44')],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal'](_0xad73('0x22')))),_0xad73('0x45')]],'group':[_0xad73('0x2c')]})['then'](function(_0x206e3a){logger['info']('GetCampaignHopperHistory',_0x1202c4);logger[_0xad73('0xf')](_0xad73('0x42'),_0x1202c4,JSON['stringify'](_0x206e3a));_0xf71ea2(_0x206e3a);})['catch'](function(_0x2fc49a){logger[_0xad73('0x11')]('GetCampaignHopperHistory',_0x2fc49a['message'],_0x1202c4);_0xeeaa26(_0x3c804f[_0xad73('0x11')](0x1f4,_0x2fc49a[_0xad73('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 46a4c8f..8baa71d 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=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','exports','util','path','connect-timeout'];(function(_0x51be09,_0x397cfe){var _0x4e2f77=function(_0x1a18c5){while(--_0x1a18c5){_0x51be09['push'](_0x51be09['shift']());}};_0x4e2f77(++_0x397cfe);}(_0xc59e,0xc9));var _0xec59=function(_0x300f1f,_0x598f68){_0x300f1f=_0x300f1f-0x0;var _0x430c2f=_0xc59e[_0x300f1f];return _0x430c2f;};'use strict';var multer=require('multer');var util=require(_0xec59('0x0'));var path=require(_0xec59('0x1'));var timeout=require(_0xec59('0x2'));var express=require(_0xec59('0x3'));var router=express[_0xec59('0x4')]();var fs_extra=require(_0xec59('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xec59('0x6'));var controller=require('./cmHopperHistory.controller');router[_0xec59('0x7')]('/',auth[_0xec59('0x8')](),controller[_0xec59('0x9')]);router['get'](_0xec59('0xa'),auth['isAuthenticated'](),controller[_0xec59('0xb')]);router[_0xec59('0x7')](_0xec59('0xc'),auth[_0xec59('0x8')](),controller['show']);router[_0xec59('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xec59('0xe')](_0xec59('0xc'),auth[_0xec59('0x8')](),controller[_0xec59('0xf')]);module[_0xec59('0x10')]=router; \ No newline at end of file +var _0x76ec=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','create','put','update','exports','multer','path'];(function(_0x1c69f0,_0x1b1385){var _0x437044=function(_0x4da23d){while(--_0x4da23d){_0x1c69f0['push'](_0x1c69f0['shift']());}};_0x437044(++_0x1b1385);}(_0x76ec,0x18d));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc76e('0x0'));var util=require('util');var path=require(_0xc76e('0x1'));var timeout=require(_0xc76e('0x2'));var express=require(_0xc76e('0x3'));var router=express[_0xc76e('0x4')]();var fs_extra=require(_0xc76e('0x5'));var auth=require(_0xc76e('0x6'));var interaction=require(_0xc76e('0x7'));var config=require(_0xc76e('0x8'));var controller=require('./cmHopperHistory.controller');router[_0xc76e('0x9')]('/',auth['isAuthenticated'](),controller[_0xc76e('0xa')]);router[_0xc76e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc76e('0xb')]);router[_0xc76e('0x9')](_0xc76e('0xc'),auth[_0xc76e('0xd')](),controller[_0xc76e('0xe')]);router['post']('/',auth[_0xc76e('0xd')](),controller[_0xc76e('0xf')]);router[_0xc76e('0x10')](_0xc76e('0xc'),auth[_0xc76e('0xd')](),controller[_0xc76e('0x11')]);module[_0xc76e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e0d5fa3..5c14075 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 _0x8c79=['sequelize','STRING'];(function(_0x9ccdee,_0x406dcb){var _0x201ddc=function(_0x4af6ab){while(--_0x4af6ab){_0x9ccdee['push'](_0x9ccdee['shift']());}};_0x201ddc(++_0x406dcb);}(_0x8c79,0xa8));var _0x98c7=function(_0x444adf,_0x8bfe5){_0x444adf=_0x444adf-0x0;var _0x1f8161=_0x8c79[_0x444adf];return _0x1f8161;};'use strict';var Sequelize=require(_0x98c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x98c7('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1793=['STRING','name','sequelize','exports'];(function(_0x2bc48a,_0x4b3055){var _0x3c9c6d=function(_0x1cfed4){while(--_0x1cfed4){_0x2bc48a['push'](_0x2bc48a['shift']());}};_0x3c9c6d(++_0x4b3055);}(_0x1793,0x1ce));var _0x3179=function(_0x17db01,_0x4e3110){_0x17db01=_0x17db01-0x0;var _0x5b02aa=_0x1793[_0x17db01];return _0x5b02aa;};'use strict';var Sequelize=require(_0x3179('0x0'));module[_0x3179('0x1')]={'name':{'type':Sequelize[_0x3179('0x2')],'unique':_0x3179('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x3179('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ca8f899..48ebb7f 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 _0x52f5=['c.cf_','field','item','cm_contact_has_items','additionalPhone_','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sendStatus','sequelize','addCustomFields','Sequelize','text','TEXT','number','switch','BOOLEAN','defaultValue','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','emit','removeAgents','userCmList:remove','getAgents','User','spread','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','index','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','body','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','dataValues','errors','message','concat','CustomFields','format','cf_%d','raw','getContacts','CmCustomField','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null'];(function(_0x9500e9,_0x133a97){var _0x4cdf90=function(_0x3b2df0){while(--_0x3b2df0){_0x9500e9['push'](_0x9500e9['shift']());}};_0x4cdf90(++_0x133a97);}(_0x52f5,0x1f4));var _0x552f=function(_0x502a1c,_0x592f48){_0x502a1c=_0x502a1c-0x0;var _0x269732=_0x52f5[_0x502a1c];return _0x269732;};'use strict';var emlformat=require(_0x552f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x552f('0x1'));var jsonpatch=require(_0x552f('0x2'));var rp=require('request-promise');var moment=require(_0x552f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x552f('0x4'));var util=require('util');var path=require(_0x552f('0x5'));var sox=require(_0x552f('0x6'));var csv=require(_0x552f('0x7'));var ejs=require(_0x552f('0x8'));var fs=require('fs');var fs_extra=require(_0x552f('0x9'));var _=require(_0x552f('0xa'));var squel=require(_0x552f('0xb'));var crypto=require(_0x552f('0xc'));var jsforce=require(_0x552f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x552f('0xe'));var Papa=require(_0x552f('0xf'));var Redis=require(_0x552f('0x10'));var authService=require(_0x552f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x552f('0x12'))(_0x552f('0x13'));var utils=require(_0x552f('0x14'));var config=require(_0x552f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x552f('0x16'))['db'];var csv_results;config[_0x552f('0x17')]=_[_0x552f('0x18')](config[_0x552f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x552f('0x19'))(new Redis(config['redis']));require(_0x552f('0x1a'))[_0x552f('0x1b')](socket);function respondWithStatusCode(_0x1879c6,_0x517d01){_0x517d01=_0x517d01||0xcc;return function(_0x3d0c59){if(_0x3d0c59){return _0x1879c6['sendStatus'](_0x517d01);}return _0x1879c6['status'](_0x517d01)[_0x552f('0x1c')]();};}function respondWithResult(_0x224b77,_0x3edf46){_0x3edf46=_0x3edf46||0xc8;return function(_0x859f41){if(_0x859f41){return _0x224b77[_0x552f('0x1d')](_0x3edf46)[_0x552f('0x1e')](_0x859f41);}};}function respondWithFilteredResult(_0x482d93,_0x3ce3e6){return function(_0x481c35){if(_0x481c35){var _0x412f0a=typeof _0x3ce3e6[_0x552f('0x1f')]==='undefined'&&typeof _0x3ce3e6[_0x552f('0x20')]===_0x552f('0x21');var _0x57985a=_0x481c35[_0x552f('0x22')];var _0x269b17=_0x412f0a?0x0:_0x3ce3e6[_0x552f('0x1f')];var _0x593c2b=_0x412f0a?_0x481c35[_0x552f('0x22')]:_0x3ce3e6[_0x552f('0x1f')]+_0x3ce3e6['limit'];var _0x246055;if(_0x593c2b>=_0x57985a){_0x593c2b=_0x57985a;_0x246055=0xc8;}else{_0x246055=0xce;}_0x482d93[_0x552f('0x1d')](_0x246055);return _0x482d93[_0x552f('0x23')](_0x552f('0x24'),_0x269b17+'-'+_0x593c2b+'/'+_0x57985a)[_0x552f('0x1e')](_0x481c35);}return null;};}function patchUpdates(_0x2f4587){return function(_0x460509){try{jsonpatch['apply'](_0x460509,_0x2f4587,!![]);}catch(_0x1417c0){return BPromise[_0x552f('0x25')](_0x1417c0);}return _0x460509[_0x552f('0x26')]();};}function saveUpdates(_0x323f24,_0x3816bf){return function(_0x5df21a){if(_0x5df21a){return _0x5df21a[_0x552f('0x27')](_0x323f24)['then'](function(_0x31b616){return _0x31b616;});}return null;};}function removeEntity(_0x3536e6,_0x34c17f){return function(_0x161b5e){if(_0x161b5e){return _0x161b5e[_0x552f('0x28')]()[_0x552f('0x29')](function(){var _0x3d760d=_0x161b5e[_0x552f('0x2a')]({'plain':!![]});var _0x414dcb=_0x552f('0x2b');return db[_0x552f('0x2c')]['destroy']({'where':{'type':_0x414dcb,'resourceId':_0x3d760d['id']}})[_0x552f('0x29')](function(){return _0x161b5e;});})[_0x552f('0x29')](function(){_0x3536e6[_0x552f('0x1d')](0xcc)[_0x552f('0x1c')]();});}};}function handleEntityNotFound(_0x2272da,_0x1f78be){return function(_0x1b707c){if(!_0x1b707c){_0x2272da['sendStatus'](0x194);}return _0x1b707c;};}function handleError(_0xf1f48d,_0x46cc35){_0x46cc35=_0x46cc35||0x1f4;return function(_0x2240fe){logger[_0x552f('0x2d')](_0x2240fe[_0x552f('0x2e')]);if(_0x2240fe[_0x552f('0x2f')]){delete _0x2240fe['name'];}_0xf1f48d[_0x552f('0x1d')](_0x46cc35)['send'](_0x2240fe);};}exports[_0x552f('0x30')]=function(_0x54b270,_0x1957ab){var _0x3e2856={},_0x4c57d4={},_0xfc8ee6={'count':0x0,'rows':[]};var _0x54c429=_[_0x552f('0x31')](db[_0x552f('0x32')][_0x552f('0x33')],function(_0x78b4d2){return{'name':_0x78b4d2['fieldName'],'type':_0x78b4d2[_0x552f('0x34')][_0x552f('0x35')]};});_0x4c57d4[_0x552f('0x36')]=_[_0x552f('0x31')](_0x54c429,_0x552f('0x2f'));_0x4c57d4[_0x552f('0x37')]=_[_0x552f('0x38')](_0x54b270[_0x552f('0x37')]);_0x4c57d4[_0x552f('0x39')]=_[_0x552f('0x3a')](_0x4c57d4[_0x552f('0x36')],_0x4c57d4['query']);_0x3e2856[_0x552f('0x3b')]=_[_0x552f('0x3a')](_0x4c57d4['model'],qs[_0x552f('0x3c')](_0x54b270[_0x552f('0x37')]['fields']));_0x3e2856[_0x552f('0x3b')]=_0x3e2856['attributes']['length']?_0x3e2856[_0x552f('0x3b')]:_0x4c57d4[_0x552f('0x36')];if(!_0x54b270[_0x552f('0x37')][_0x552f('0x3d')](_0x552f('0x3e'))){_0x3e2856[_0x552f('0x20')]=qs[_0x552f('0x20')](_0x54b270['query']['limit']);_0x3e2856['offset']=qs['offset'](_0x54b270['query'][_0x552f('0x1f')]);}_0x3e2856[_0x552f('0x3f')]=qs[_0x552f('0x40')](_0x54b270[_0x552f('0x37')]['sort']);_0x3e2856['where']=qs[_0x552f('0x39')](_['pick'](_0x54b270[_0x552f('0x37')],_0x4c57d4[_0x552f('0x39')]),_0x54c429);if(_0x54b270[_0x552f('0x37')][_0x552f('0x41')]){_0x3e2856[_0x552f('0x42')]=_[_0x552f('0x43')](_0x3e2856[_0x552f('0x42')],{'$or':_['map'](_0x54c429,function(_0x32bb15){if(_0x32bb15[_0x552f('0x34')]!==_0x552f('0x44')){var _0x57cc09={};_0x57cc09[_0x32bb15['name']]={'$like':'%'+_0x54b270[_0x552f('0x37')][_0x552f('0x41')]+'%'};return _0x57cc09;}})});}_0x3e2856=_['merge']({},_0x3e2856,_0x54b270[_0x552f('0x45')]);var _0x1fcb85={'where':_0x3e2856[_0x552f('0x42')]};return db[_0x552f('0x32')]['count'](_0x1fcb85)['then'](function(_0x41ee8c){_0xfc8ee6[_0x552f('0x22')]=_0x41ee8c;if(_0x54b270[_0x552f('0x37')]['includeAll']){_0x3e2856[_0x552f('0x46')]=[{'all':!![]}];}return db[_0x552f('0x32')][_0x552f('0x47')](_0x3e2856);})[_0x552f('0x29')](function(_0x18af32){_0xfc8ee6[_0x552f('0x48')]=_0x18af32;return _0xfc8ee6;})[_0x552f('0x29')](respondWithFilteredResult(_0x1957ab,_0x3e2856))[_0x552f('0x49')](handleError(_0x1957ab,null));};exports['show']=function(_0x19ff5d,_0x1a33b6){var _0x188090={'raw':![],'where':{'id':_0x19ff5d[_0x552f('0x4a')]['id']}},_0x4156ad={};_0x4156ad[_0x552f('0x36')]=_['keys'](db[_0x552f('0x32')]['rawAttributes']);_0x4156ad[_0x552f('0x37')]=_[_0x552f('0x38')](_0x19ff5d[_0x552f('0x37')]);_0x4156ad[_0x552f('0x39')]=_['intersection'](_0x4156ad[_0x552f('0x36')],_0x4156ad[_0x552f('0x37')]);_0x188090[_0x552f('0x3b')]=_[_0x552f('0x3a')](_0x4156ad[_0x552f('0x36')],qs[_0x552f('0x3c')](_0x19ff5d[_0x552f('0x37')][_0x552f('0x3c')]));_0x188090['attributes']=_0x188090['attributes'][_0x552f('0x4b')]?_0x188090[_0x552f('0x3b')]:_0x4156ad['model'];if(_0x19ff5d[_0x552f('0x37')][_0x552f('0x4c')]){_0x188090['include']=[{'all':!![]}];}_0x188090=_[_0x552f('0x43')]({},_0x188090,_0x19ff5d[_0x552f('0x45')]);return db[_0x552f('0x32')][_0x552f('0x4d')](_0x188090)[_0x552f('0x29')](handleEntityNotFound(_0x1a33b6,null))[_0x552f('0x29')](respondWithResult(_0x1a33b6,null))[_0x552f('0x49')](handleError(_0x1a33b6,null));};exports[_0x552f('0x4e')]=function(_0x2f1463,_0x231f41){return db[_0x552f('0x32')][_0x552f('0x4e')](_0x2f1463['body'],{})[_0x552f('0x29')](function(_0x146d94){var _0x4fb44a=_0x2f1463[_0x552f('0x4f')][_0x552f('0x2a')]({'plain':!![]});if(!_0x4fb44a)throw new Error(_0x552f('0x50'));if(_0x4fb44a[_0x552f('0x51')]===_0x552f('0x4f')){var _0x23a8e3=_0x146d94[_0x552f('0x2a')]({'plain':!![]});var _0x4e88c7=_0x552f('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x4e88c7,'userProfileId':_0x4fb44a[_0x552f('0x52')]},'raw':!![]})[_0x552f('0x29')](function(_0x5582b8){if(_0x5582b8&&_0x5582b8[_0x552f('0x53')]===0x0){return db[_0x552f('0x2c')][_0x552f('0x4e')]({'name':_0x23a8e3[_0x552f('0x2f')],'resourceId':_0x23a8e3['id'],'type':_0x5582b8[_0x552f('0x2f')],'sectionId':_0x5582b8['id']},{})['then'](function(){return _0x146d94;});}else{return _0x146d94;}})[_0x552f('0x49')](function(_0x4bbe9b){logger[_0x552f('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bbe9b);throw _0x4bbe9b;});}return _0x146d94;})['then'](respondWithResult(_0x231f41,0xc9))[_0x552f('0x49')](handleError(_0x231f41,null));};exports[_0x552f('0x27')]=function(_0x31165d,_0x3046ac){if(_0x31165d[_0x552f('0x54')]['id']){delete _0x31165d[_0x552f('0x54')]['id'];}return db[_0x552f('0x32')]['find']({'where':{'id':_0x31165d[_0x552f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3046ac,null))['then'](saveUpdates(_0x31165d[_0x552f('0x54')],null))[_0x552f('0x29')](respondWithResult(_0x3046ac,null))['catch'](handleError(_0x3046ac,null));};exports['destroy']=function(_0x18bf65,_0x33f874){return db[_0x552f('0x32')][_0x552f('0x4d')]({'where':{'id':_0x18bf65[_0x552f('0x4a')]['id']}})[_0x552f('0x29')](handleEntityNotFound(_0x33f874,null))['then'](removeEntity(_0x33f874,null))['catch'](handleError(_0x33f874,null));};exports[_0x552f('0x55')]=function(_0x475f2c,_0x145bbf){return db[_0x552f('0x32')][_0x552f('0x55')]()[_0x552f('0x29')](respondWithResult(_0x145bbf,null))['catch'](handleError(_0x145bbf,null));};exports[_0x552f('0x56')]=function(_0x14891f,_0x4bee01,_0x3cd68e){if(_0x14891f[_0x552f('0x54')]['id']){delete _0x14891f['body']['id'];}return db[_0x552f('0x32')][_0x552f('0x4d')]({'where':{'id':_0x14891f[_0x552f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4bee01,null))['then'](function(_0x3880f9){if(_0x3880f9){_0x14891f[_0x552f('0x54')][_0x552f('0x57')]=_0x3880f9['id'];return db[_0x552f('0x58')]['create'](_0x14891f[_0x552f('0x54')]);}})[_0x552f('0x29')](respondWithResult(_0x4bee01,null))[_0x552f('0x49')](handleError(_0x4bee01,null));};exports[_0x552f('0x59')]=function(_0x56f1d9,_0xd5f1e2,_0x1461ab){var _0x42f490={'raw':![],'where':{}};var _0x30c42d={};var _0x264492={'count':0x0,'rows':[]};return db[_0x552f('0x32')][_0x552f('0x5a')]({'where':{'id':_0x56f1d9[_0x552f('0x4a')]['id']}})[_0x552f('0x29')](handleEntityNotFound(_0xd5f1e2,null))[_0x552f('0x29')](function(_0x5ab841){if(_0x5ab841){_0x30c42d[_0x552f('0x36')]=_[_0x552f('0x38')](db[_0x552f('0x58')][_0x552f('0x33')]);_0x30c42d['query']=_['keys'](_0x56f1d9['query']);_0x30c42d[_0x552f('0x39')]=_[_0x552f('0x3a')](_0x30c42d[_0x552f('0x36')],_0x30c42d[_0x552f('0x37')]);_0x42f490[_0x552f('0x3b')]=_[_0x552f('0x3a')](_0x30c42d[_0x552f('0x36')],qs[_0x552f('0x3c')](_0x56f1d9[_0x552f('0x37')]['fields']));_0x42f490[_0x552f('0x3b')]=_0x42f490[_0x552f('0x3b')][_0x552f('0x4b')]?_0x42f490[_0x552f('0x3b')]:_0x30c42d['model'];if(!_0x56f1d9[_0x552f('0x37')][_0x552f('0x3d')](_0x552f('0x3e'))){_0x42f490[_0x552f('0x20')]=qs[_0x552f('0x20')](_0x56f1d9['query'][_0x552f('0x20')]);_0x42f490[_0x552f('0x1f')]=qs[_0x552f('0x1f')](_0x56f1d9[_0x552f('0x37')]['offset']);}_0x42f490[_0x552f('0x3f')]=qs[_0x552f('0x40')](_0x56f1d9[_0x552f('0x37')][_0x552f('0x40')]);_0x42f490['where']=qs[_0x552f('0x39')](_[_0x552f('0x5b')](_0x56f1d9[_0x552f('0x37')],_0x30c42d[_0x552f('0x39')]));_0x42f490[_0x552f('0x42')][_0x552f('0x57')]=_0x5ab841['id'];if(_0x56f1d9[_0x552f('0x37')][_0x552f('0x41')]){_0x42f490[_0x552f('0x42')]=_[_0x552f('0x43')](_0x42f490[_0x552f('0x42')],{'$or':_[_0x552f('0x31')](_0x42f490[_0x552f('0x3b')],function(_0x18ed22){var _0x295caa={};_0x295caa[_0x18ed22]={'$like':'%'+_0x56f1d9[_0x552f('0x37')]['filter']+'%'};return _0x295caa;})});}_0x42f490=_[_0x552f('0x43')]({},_0x42f490,_0x56f1d9[_0x552f('0x45')]);return db['Disposition'][_0x552f('0x22')]({'where':_0x42f490[_0x552f('0x42')]})[_0x552f('0x29')](function(_0x3e6851){_0x264492['count']=_0x3e6851;if(_0x56f1d9[_0x552f('0x37')][_0x552f('0x4c')]){_0x42f490[_0x552f('0x46')]=[{'all':!![]}];}return db[_0x552f('0x58')][_0x552f('0x47')](_0x42f490);})[_0x552f('0x29')](function(_0x2d2997){_0x264492[_0x552f('0x48')]=_0x2d2997;return _0x264492;});}})[_0x552f('0x29')](respondWithFilteredResult(_0xd5f1e2,_0x42f490))[_0x552f('0x49')](handleError(_0xd5f1e2,null));};exports['removeDispositions']=function(_0x2bb2ba,_0x1e87d0,_0x1cb7c3){return db[_0x552f('0x32')][_0x552f('0x4d')]({'where':{'id':_0x2bb2ba[_0x552f('0x4a')]['id']}})[_0x552f('0x29')](handleEntityNotFound(_0x1e87d0,null))[_0x552f('0x29')](function(_0x155837){if(_0x155837){return _0x155837[_0x552f('0x5c')](_0x2bb2ba[_0x552f('0x37')][_0x552f('0x5d')]);}})[_0x552f('0x29')](respondWithStatusCode(_0x1e87d0,null))[_0x552f('0x49')](handleError(_0x1e87d0,null));};exports[_0x552f('0x5e')]=function(_0xd8cc34,_0x51a488,_0x3361b9){return db[_0x552f('0x32')][_0x552f('0x4d')]({'where':{'id':_0xd8cc34[_0x552f('0x4a')]['id']}})[_0x552f('0x29')](handleEntityNotFound(_0x51a488,null))[_0x552f('0x29')](function(_0x1143d1){if(_0x1143d1){var _0x3c2fb4=[];var _0x54ed9e={'success':[],'errors':[]};return db[_0x552f('0x5f')][_0x552f('0x55')]()[_0x552f('0x29')](function(_0x56d2c0){if(_0xd8cc34[_0x552f('0x54')]['tags']&&_[_0x552f('0x60')](_0xd8cc34[_0x552f('0x54')][_0x552f('0x61')])){if(_0xd8cc34[_0x552f('0x54')][_0x552f('0x61')][_0x552f('0x4b')]){_0xd8cc34[_0x552f('0x54')][_0x552f('0x61')]=_0xd8cc34[_0x552f('0x54')]['tags'][_0x552f('0x62')](';')+';';}else{_0xd8cc34['body'][_0x552f('0x61')]=null;}}else{_0xd8cc34[_0x552f('0x54')][_0x552f('0x61')]=null;}if(_0xd8cc34[_0x552f('0x54')]&&_[_0x552f('0x60')](_0xd8cc34[_0x552f('0x54')])){for(var _0x58bc61=0x0;_0x58bc61<_0xd8cc34[_0x552f('0x54')][_0x552f('0x4b')];_0x58bc61+=0x1){_0xd8cc34[_0x552f('0x54')][_0x58bc61][_0x552f('0x57')]=_0xd8cc34[_0x552f('0x4a')]['id'];_0x3c2fb4[_0x552f('0x63')](_0xd8cc34[_0x552f('0x54')][_0x58bc61]);}return BPromise[_0x552f('0x64')](_0x3c2fb4,function(_0x4a1122){return db[_0x552f('0x5f')][_0x552f('0x4e')](_['omit'](_0x4a1122,[_0x552f('0x5d'),'id'])||{},{'fields':_[_0x552f('0x38')](_0x56d2c0),'raw':!![]})['then'](function(_0x1911f3){_0x54ed9e['success']['push'](_0x1911f3[_0x552f('0x65')]);})[_0x552f('0x49')](function(_0xa1505){_0x54ed9e[_0x552f('0x66')][_0x552f('0x63')]({'data':_0x4a1122,'error':_0xa1505[_0x552f('0x67')]});});})[_0x552f('0x29')](function(_0x28e9e1){return _0x54ed9e;})['catch'](function(_0x299b04){return _0x299b04;});}else{_0x51a488['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x51a488,null))['catch'](handleError(_0x51a488,null));};exports['getContacts']=function(_0x5e49a1,_0x4e2ca3,_0x27b6ae){var _0x506a78;return db['CmList']['find']({'where':{'id':_0x5e49a1['params']['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x552f('0x29')](handleEntityNotFound(_0x4e2ca3,null))[_0x552f('0x29')](function(_0x1405ec){if(_0x1405ec){_0x506a78=_0x1405ec;return db['CmContact'][_0x552f('0x33')];}})['then'](function(_0x439934){if(_0x439934){var _0x424741={};var _0x1868d7={};_0x1868d7['model']=_[_0x552f('0x68')](_[_0x552f('0x38')](_0x439934),_[_0x552f('0x31')](_0x506a78[_0x552f('0x69')],function(_0x43e9e7){return util[_0x552f('0x6a')](_0x552f('0x6b'),_0x43e9e7['id']);}));_0x1868d7['query']=_[_0x552f('0x38')](_0x5e49a1[_0x552f('0x37')]);_0x1868d7[_0x552f('0x39')]=_[_0x552f('0x3a')](_0x1868d7['model'],_0x1868d7[_0x552f('0x37')]);_0x424741[_0x552f('0x3b')]=_[_0x552f('0x3a')](_0x1868d7[_0x552f('0x36')],qs[_0x552f('0x3c')](_0x5e49a1[_0x552f('0x37')][_0x552f('0x3c')]));_0x424741['attributes']=_0x424741[_0x552f('0x3b')][_0x552f('0x4b')]?_0x424741[_0x552f('0x3b')]:_0x1868d7['model'];if(!_0x5e49a1[_0x552f('0x37')][_0x552f('0x3d')](_0x552f('0x3e'))){_0x424741[_0x552f('0x20')]=qs['limit'](_0x5e49a1[_0x552f('0x37')]['limit']);_0x424741[_0x552f('0x1f')]=qs[_0x552f('0x1f')](_0x5e49a1[_0x552f('0x37')]['offset']);}_0x424741[_0x552f('0x3f')]=qs[_0x552f('0x40')](_0x5e49a1[_0x552f('0x37')][_0x552f('0x40')]);_0x424741['where']=qs[_0x552f('0x39')](_[_0x552f('0x5b')](_0x5e49a1['query'],_0x1868d7[_0x552f('0x39')]));_0x424741[_0x552f('0x6c')]=!![];if(_0x5e49a1['query']['filter']){_0x424741[_0x552f('0x42')]=_['merge'](_0x424741[_0x552f('0x42')],{'$or':_['map'](_0x424741[_0x552f('0x3b')],function(_0x4dfa79){var _0x4b51d8={};_0x4b51d8[_0x4dfa79]={'$like':'%'+_0x5e49a1[_0x552f('0x37')][_0x552f('0x41')]+'%'};return _0x4b51d8;})});}_0x424741=_[_0x552f('0x43')]({},_0x424741,_0x5e49a1[_0x552f('0x45')]);return _0x506a78[_0x552f('0x6d')](_0x424741);}})[_0x552f('0x29')](respondWithResult(_0x4e2ca3,null))[_0x552f('0x49')](handleError(_0x4e2ca3,null));};exports['getContactsCsv']=function(_0xd243ae,_0x449658,_0x387514){var _0xf4b049;var _0x3df022;var _0x3262c9;var _0x5103a6=_0xd243ae[_0x552f('0x4a')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})[_0x552f('0x29')](function(_0x3e6fa){_0xf4b049=_0x3e6fa;var _0x341efe=_['keys'](db[_0x552f('0x5f')][_0x552f('0x33')]);return db[_0x552f('0x6e')][_0x552f('0x47')]({'raw':!![],'attributes':['id',_0x552f('0x6f')]})[_0x552f('0x29')](function(_0x167b49){_0x3df022=_0x167b49;var _0x5d5419=squel['select']()[_0x552f('0x3c')](_0x341efe)[_0x552f('0x70')](_0x552f('0x71'),'c')[_0x552f('0x42')](_0x552f('0x72'),_0x5103a6)['where'](_0x552f('0x73'))['distinct']();for(var _0x4c91cd=0x0;_0x4c91cd<_0x3df022[_0x552f('0x4b')];_0x4c91cd++){_0x5d5419['field'](_0x552f('0x74')+_0x3df022[_0x4c91cd]['id'],'customField_'+_0x3df022[_0x4c91cd][_0x552f('0x6f')]);}for(var _0x4c91cd=0x0;_0x4c91cd<_0xf4b049[_0x552f('0x4b')];_0x4c91cd++){_0x5d5419[_0x552f('0x75')](squel['select']()[_0x552f('0x75')](_0x552f('0x76'))[_0x552f('0x70')](_0x552f('0x77'))[_0x552f('0x42')]('ItemTypeId\x20=\x20?',_0xf4b049[_0x4c91cd]['id'])['where']('CmContactId\x20=\x20c.id'),_0x552f('0x78')+_0xf4b049[_0x4c91cd][_0x552f('0x2f')]);_0x5d5419['field'](squel['select']()['field']('description')[_0x552f('0x70')](_0x552f('0x77'))[_0x552f('0x42')](_0x552f('0x79'),_0xf4b049[_0x4c91cd]['id'])['where'](_0x552f('0x7a')),_0x552f('0x7b')+_0xf4b049[_0x4c91cd][_0x552f('0x2f')]);}var _0x12778d=[];_0x12778d['push'](_0x5d5419['toString']());BPromise['each'](_0x12778d,handleQuery)[_0x552f('0x29')](function(_0x4e3c20){handleQuery(_0x5d5419[_0x552f('0x7c')]());var _0x75fcbd=csv_results[0x0];if(!_['isEmpty'](_0x75fcbd)){var _0x58553b=toCsv(_0x75fcbd);var _0x36f224=Date['now']();fs['writeFileSync'](util[_0x552f('0x6a')]('/tmp/list_%d_%s.csv',_0x5103a6,_0x36f224),_0x58553b);_0x449658[_0x552f('0x7d')]('Content-disposition',_0x552f('0x7e')+util[_0x552f('0x6a')](_0x552f('0x7f'),_0x5103a6,_0x36f224));_0x449658[_0x552f('0x7d')](_0x552f('0x80'),_0x552f('0x81'));return _0x449658[_0x552f('0x82')](util[_0x552f('0x6a')](_0x552f('0x83'),_0x5103a6,_0x36f224));}else{return _0x449658[_0x552f('0x84')](0xcc);}});});});};exports['addCustomField']=function(_0xfc9fac,_0x2daf7f,_0x2c881f){var _0x4c1f38;delete _0xfc9fac[_0x552f('0x54')]['id'];return db[_0x552f('0x32')][_0x552f('0x5a')]({'where':{'id':_0xfc9fac[_0x552f('0x4a')]['id']}})[_0x552f('0x29')](handleEntityNotFound(_0x2daf7f,null))[_0x552f('0x29')](function(_0x2174d9){if(_0x2174d9){return db[_0x552f('0x85')]['transaction'](function(_0x5f0fdb){return db[_0x552f('0x6e')]['create'](_0xfc9fac[_0x552f('0x54')],{'transaction':_0x5f0fdb})[_0x552f('0x29')](function(_0x394f14){_0x4c1f38=_0x394f14;return _0x2174d9[_0x552f('0x86')](_0x394f14,{'transaction':_0x5f0fdb});})[_0x552f('0x29')](function(){var _0x51312a={'type':db[_0x552f('0x87')]['TEXT'],'transaction':_0x5f0fdb};switch(_0xfc9fac['body'][_0x552f('0x34')]){case _0x552f('0x88'):_0x51312a[_0x552f('0x34')]=db[_0x552f('0x87')][_0x552f('0x89')];break;case _0x552f('0x8a'):_0x51312a[_0x552f('0x34')]=db[_0x552f('0x87')]['INTEGER'];break;case _0x552f('0x8b'):_0x51312a['type']=db[_0x552f('0x87')][_0x552f('0x8c')];_0x51312a[_0x552f('0x8d')]=![];break;default:}return db[_0x552f('0x85')]['queryInterface']['addColumn']('cm_contacts',util[_0x552f('0x6a')](_0x552f('0x8e'),_0x4c1f38['id']),_0x51312a);})[_0x552f('0x29')](function(){return _0x4c1f38;});});}})[_0x552f('0x29')](respondWithResult(_0x2daf7f,null))[_0x552f('0x49')](handleError(_0x2daf7f,null));};exports[_0x552f('0x8f')]=function(_0x27bd37,_0x12da18,_0x3c46f1){var _0x323aa1={};var _0x522416={};var _0x1854d1;var _0x4f50d5;return db[_0x552f('0x32')][_0x552f('0x5a')]({'where':{'id':_0x27bd37[_0x552f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12da18,null))[_0x552f('0x29')](function(_0x349d95){if(_0x349d95){_0x1854d1=_0x349d95;_0x522416[_0x552f('0x36')]=_[_0x552f('0x38')](db[_0x552f('0x6e')][_0x552f('0x33')]);_0x522416[_0x552f('0x37')]=_[_0x552f('0x38')](_0x27bd37[_0x552f('0x37')]);_0x522416[_0x552f('0x39')]=_[_0x552f('0x3a')](_0x522416[_0x552f('0x36')],_0x522416[_0x552f('0x37')]);_0x323aa1['attributes']=_['intersection'](_0x522416[_0x552f('0x36')],qs[_0x552f('0x3c')](_0x27bd37['query'][_0x552f('0x3c')]));_0x323aa1[_0x552f('0x3b')]=_0x323aa1[_0x552f('0x3b')][_0x552f('0x4b')]?_0x323aa1[_0x552f('0x3b')]:_0x522416['model'];_0x323aa1[_0x552f('0x3f')]=qs['sort'](_0x27bd37[_0x552f('0x37')]['sort']);_0x323aa1[_0x552f('0x42')]=qs['filters'](_[_0x552f('0x5b')](_0x27bd37[_0x552f('0x37')],_0x522416[_0x552f('0x39')]));_0x323aa1[_0x552f('0x42')]=_[_0x552f('0x43')](_0x323aa1[_0x552f('0x42')],{'$or':[{'ListId':_0x349d95['id']},{'ListId':null}]});if(_0x27bd37[_0x552f('0x37')][_0x552f('0x41')]){_0x323aa1[_0x552f('0x42')]=_[_0x552f('0x43')](_0x323aa1[_0x552f('0x42')],{'$or':_[_0x552f('0x31')](_0x323aa1[_0x552f('0x3b')],function(_0x437ca4){var _0x31ff90={};_0x31ff90[_0x437ca4]={'$like':'%'+_0x27bd37[_0x552f('0x37')]['filter']+'%'};return _0x31ff90;})});}_0x323aa1=_[_0x552f('0x43')]({},_0x323aa1,_0x27bd37[_0x552f('0x45')]);return db[_0x552f('0x6e')][_0x552f('0x90')](_0x323aa1);}})['then'](respondWithResult(_0x12da18,null))['catch'](handleError(_0x12da18,null));};exports[_0x552f('0x91')]=function(_0x5a6ee5,_0x542fb7){return db[_0x552f('0x6e')]['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x542fb7,null))[_0x552f('0x29')](function(_0x141ba4){return _0x141ba4;})['then'](respondWithResult(_0x542fb7,null))[_0x552f('0x49')](handleError(_0x542fb7,null));};exports['addAgents']=function(_0x431ffa,_0x295cad,_0x5d2480){return db['CmList'][_0x552f('0x4d')]({'where':{'id':_0x431ffa[_0x552f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x295cad,null))[_0x552f('0x29')](function(_0x2f8e7e){if(_0x2f8e7e){return _0x2f8e7e[_0x552f('0x92')](_0x431ffa[_0x552f('0x54')][_0x552f('0x5d')],_[_0x552f('0x93')](_0x431ffa['body'],[_0x552f('0x5d'),'id'])||{})['spread'](function(_0x59beec){for(var _0x98564f=0x0;_0x98564f<_0x431ffa['body'][_0x552f('0x5d')][_0x552f('0x4b')];_0x98564f+=0x1){socket[_0x552f('0x94')]('userCmList:save',{'UserId':Number(_0x431ffa[_0x552f('0x54')][_0x552f('0x5d')][_0x98564f]),'CmListId':Number(_0x431ffa[_0x552f('0x4a')]['id'])});}return _0x59beec;});}})['then'](respondWithResult(_0x295cad,null))[_0x552f('0x49')](handleError(_0x295cad,null));};exports[_0x552f('0x95')]=function(_0xad7cd1,_0x494e82,_0x5dec9f){return db[_0x552f('0x32')][_0x552f('0x4d')]({'where':{'id':_0xad7cd1[_0x552f('0x4a')]['id']}})[_0x552f('0x29')](handleEntityNotFound(_0x494e82,null))['then'](function(_0x1fbb4d){if(_0x1fbb4d){return _0x1fbb4d[_0x552f('0x95')](_0xad7cd1[_0x552f('0x37')][_0x552f('0x5d')])[_0x552f('0x29')](function(){if(_[_0x552f('0x60')](_0xad7cd1['query'][_0x552f('0x5d')])){for(var _0x20caa5=0x0;_0x20caa5<_0xad7cd1[_0x552f('0x37')][_0x552f('0x5d')][_0x552f('0x4b')];_0x20caa5+=0x1){socket[_0x552f('0x94')]('userCmList:remove',{'UserId':Number(_0xad7cd1['query'][_0x552f('0x5d')][_0x20caa5]),'CmListId':Number(_0xad7cd1[_0x552f('0x4a')]['id'])});}}else{socket[_0x552f('0x94')](_0x552f('0x96'),{'UserId':Number(_0xad7cd1[_0x552f('0x37')]['ids']),'CmListId':Number(_0xad7cd1[_0x552f('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x494e82,null))[_0x552f('0x49')](handleError(_0x494e82,null));};exports[_0x552f('0x97')]=function(_0xad3107,_0x5e3947,_0x13d9e7){var _0x55d86f={};var _0x18ee23={};var _0xe5fbbd;var _0x40dc34;return db[_0x552f('0x32')][_0x552f('0x5a')]({'where':{'id':_0xad3107['params']['id']}})[_0x552f('0x29')](handleEntityNotFound(_0x5e3947,null))[_0x552f('0x29')](function(_0x4e7ce1){if(_0x4e7ce1){_0xe5fbbd=_0x4e7ce1;_0x18ee23['model']=_['keys'](db[_0x552f('0x98')][_0x552f('0x33')]);_0x18ee23[_0x552f('0x37')]=_['keys'](_0xad3107[_0x552f('0x37')]);_0x18ee23[_0x552f('0x39')]=_[_0x552f('0x3a')](_0x18ee23['model'],_0x18ee23['query']);_0x55d86f[_0x552f('0x3b')]=_[_0x552f('0x3a')](_0x18ee23[_0x552f('0x36')],qs[_0x552f('0x3c')](_0xad3107['query']['fields']));_0x55d86f[_0x552f('0x3b')]=_0x55d86f['attributes'][_0x552f('0x4b')]?_0x55d86f[_0x552f('0x3b')]:_0x18ee23['model'];_0x55d86f[_0x552f('0x3f')]=qs[_0x552f('0x40')](_0xad3107['query'][_0x552f('0x40')]);_0x55d86f['where']=qs[_0x552f('0x39')](_[_0x552f('0x5b')](_0xad3107[_0x552f('0x37')],_0x18ee23[_0x552f('0x39')]));if(_0xad3107[_0x552f('0x37')][_0x552f('0x41')]){_0x55d86f[_0x552f('0x42')]=_['merge'](_0x55d86f['where'],{'$or':_[_0x552f('0x31')](_0x55d86f[_0x552f('0x3b')],function(_0x134d20){var _0x4d76a5={};_0x4d76a5[_0x134d20]={'$like':'%'+_0xad3107[_0x552f('0x37')]['filter']+'%'};return _0x4d76a5;})});}_0x55d86f=_[_0x552f('0x43')]({},_0x55d86f,_0xad3107['options']);return _0xe5fbbd[_0x552f('0x97')](_0x55d86f);}})[_0x552f('0x29')](function(_0xd56418){if(_0xd56418){_0x40dc34=_0xd56418[_0x552f('0x4b')];if(!_0xad3107[_0x552f('0x37')][_0x552f('0x3d')](_0x552f('0x3e'))){_0x55d86f[_0x552f('0x20')]=qs[_0x552f('0x20')](_0xad3107['query']['limit']);_0x55d86f[_0x552f('0x1f')]=qs[_0x552f('0x1f')](_0xad3107[_0x552f('0x37')][_0x552f('0x1f')]);}return _0xe5fbbd[_0x552f('0x97')](_0x55d86f);}})[_0x552f('0x29')](function(_0x279fba){if(_0x279fba){return _0x279fba?{'count':_0x40dc34,'rows':_0x279fba}:null;}})[_0x552f('0x29')](respondWithResult(_0x5e3947,null))[_0x552f('0x49')](handleError(_0x5e3947,null));};function handleQuery(_0x4d3758){logger['info'](_0x4d3758);return db[_0x552f('0x85')][_0x552f('0x37')](_0x4d3758)[_0x552f('0x99')](function(_0x222c06){csv_results[_0x552f('0x63')](_0x222c06);})[_0x552f('0x49')](function(_0x44d0ac){logger[_0x552f('0x2d')](_0x44d0ac[_0x552f('0x67')]);});} \ No newline at end of file +var _0x67f9=['localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','model','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','includeAll','findAll','rows','show','params','keys','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','include','removeDispositions','ids','CmContact','tags','isArray','length','join','push','each','omit','success','dataValues','errors','json','getContacts','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','CmCustomField','alias','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','spread','message','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults'];(function(_0x5706ee,_0x3fa312){var _0x1e63af=function(_0x589630){while(--_0x589630){_0x5706ee['push'](_0x5706ee['shift']());}};_0x1e63af(++_0x3fa312);}(_0x67f9,0x1da));var _0x967f=function(_0x431d3b,_0x3a0377){_0x431d3b=_0x431d3b-0x0;var _0x22bcbb=_0x67f9[_0x431d3b];return _0x22bcbb;};'use strict';var emlformat=require(_0x967f('0x0'));var rimraf=require(_0x967f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x967f('0x2'));var rp=require(_0x967f('0x3'));var moment=require('moment');var BPromise=require(_0x967f('0x4'));var Mustache=require(_0x967f('0x5'));var util=require(_0x967f('0x6'));var path=require('path');var sox=require(_0x967f('0x7'));var csv=require(_0x967f('0x8'));var ejs=require(_0x967f('0x9'));var fs=require('fs');var fs_extra=require(_0x967f('0xa'));var _=require(_0x967f('0xb'));var squel=require(_0x967f('0xc'));var crypto=require(_0x967f('0xd'));var jsforce=require(_0x967f('0xe'));var deskjs=require(_0x967f('0xf'));var toCsv=require(_0x967f('0x8'));var querystring=require(_0x967f('0x10'));var Papa=require('papaparse');var Redis=require(_0x967f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x967f('0x12'));var as=require(_0x967f('0x13'));var hardwareService=require(_0x967f('0x14'));var logger=require('../../config/logger')(_0x967f('0x15'));var utils=require(_0x967f('0x16'));var config=require(_0x967f('0x17'));var licenseUtil=require(_0x967f('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x967f('0x19')]=_[_0x967f('0x1a')](config[_0x967f('0x19')],{'host':_0x967f('0x1b'),'port':0x18eb});var socket=require(_0x967f('0x1c'))(new Redis(config[_0x967f('0x19')]));require(_0x967f('0x1d'))[_0x967f('0x1e')](socket);function respondWithStatusCode(_0x3dc5cd,_0x54493c){_0x54493c=_0x54493c||0xcc;return function(_0x583d60){if(_0x583d60){return _0x3dc5cd[_0x967f('0x1f')](_0x54493c);}return _0x3dc5cd[_0x967f('0x20')](_0x54493c)[_0x967f('0x21')]();};}function respondWithResult(_0x3c8c77,_0x46eb3a){_0x46eb3a=_0x46eb3a||0xc8;return function(_0x56c8de){if(_0x56c8de){return _0x3c8c77['status'](_0x46eb3a)['json'](_0x56c8de);}};}function respondWithFilteredResult(_0x5da617,_0x2f7616){return function(_0x367d7e){if(_0x367d7e){var _0x485100=typeof _0x2f7616['offset']===_0x967f('0x22')&&typeof _0x2f7616['limit']===_0x967f('0x22');var _0x2eeb24=_0x367d7e[_0x967f('0x23')];var _0x1163cb=_0x485100?0x0:_0x2f7616['offset'];var _0x59f1e2=_0x485100?_0x367d7e['count']:_0x2f7616[_0x967f('0x24')]+_0x2f7616[_0x967f('0x25')];var _0xd29432;if(_0x59f1e2>=_0x2eeb24){_0x59f1e2=_0x2eeb24;_0xd29432=0xc8;}else{_0xd29432=0xce;}_0x5da617[_0x967f('0x20')](_0xd29432);return _0x5da617[_0x967f('0x26')]('Content-Range',_0x1163cb+'-'+_0x59f1e2+'/'+_0x2eeb24)['json'](_0x367d7e);}return null;};}function patchUpdates(_0xbdcd20){return function(_0x19424b){try{jsonpatch[_0x967f('0x27')](_0x19424b,_0xbdcd20,!![]);}catch(_0x3c96de){return BPromise[_0x967f('0x28')](_0x3c96de);}return _0x19424b[_0x967f('0x29')]();};}function saveUpdates(_0x1093c6,_0x2cb589){return function(_0x243cbc){if(_0x243cbc){return _0x243cbc[_0x967f('0x2a')](_0x1093c6)[_0x967f('0x2b')](function(_0x4f4680){return _0x4f4680;});}return null;};}function removeEntity(_0x5820a2,_0x1a1de7){return function(_0x70262f){if(_0x70262f){return _0x70262f[_0x967f('0x2c')]()[_0x967f('0x2b')](function(){var _0x11c37d=_0x70262f['get']({'plain':!![]});var _0x14ff93='Lists';return db['UserProfileResource'][_0x967f('0x2c')]({'where':{'type':_0x14ff93,'resourceId':_0x11c37d['id']}})[_0x967f('0x2b')](function(){return _0x70262f;});})[_0x967f('0x2b')](function(){_0x5820a2['status'](0xcc)[_0x967f('0x21')]();});}};}function handleEntityNotFound(_0x1da7b8,_0x1e8fcf){return function(_0x448037){if(!_0x448037){_0x1da7b8['sendStatus'](0x194);}return _0x448037;};}function handleError(_0xba9a58,_0x7eeba7){_0x7eeba7=_0x7eeba7||0x1f4;return function(_0xcc63bb){logger[_0x967f('0x2d')](_0xcc63bb[_0x967f('0x2e')]);if(_0xcc63bb['name']){delete _0xcc63bb[_0x967f('0x2f')];}_0xba9a58[_0x967f('0x20')](_0x7eeba7)[_0x967f('0x30')](_0xcc63bb);};}exports[_0x967f('0x31')]=function(_0x4febb2,_0x498540){var _0x2d845c={},_0x282953={},_0x4e3b7f={'count':0x0,'rows':[]};var _0x548a28=_[_0x967f('0x32')](db[_0x967f('0x33')][_0x967f('0x34')],function(_0x570d40){return{'name':_0x570d40[_0x967f('0x35')],'type':_0x570d40['type']['key']};});_0x282953[_0x967f('0x36')]=_[_0x967f('0x32')](_0x548a28,_0x967f('0x2f'));_0x282953['query']=_['keys'](_0x4febb2[_0x967f('0x37')]);_0x282953['filters']=_['intersection'](_0x282953[_0x967f('0x36')],_0x282953[_0x967f('0x37')]);_0x2d845c[_0x967f('0x38')]=_[_0x967f('0x39')](_0x282953['model'],qs[_0x967f('0x3a')](_0x4febb2['query'][_0x967f('0x3a')]));_0x2d845c[_0x967f('0x38')]=_0x2d845c[_0x967f('0x38')]['length']?_0x2d845c[_0x967f('0x38')]:_0x282953[_0x967f('0x36')];if(!_0x4febb2[_0x967f('0x37')]['hasOwnProperty'](_0x967f('0x3b'))){_0x2d845c[_0x967f('0x25')]=qs[_0x967f('0x25')](_0x4febb2[_0x967f('0x37')][_0x967f('0x25')]);_0x2d845c[_0x967f('0x24')]=qs[_0x967f('0x24')](_0x4febb2[_0x967f('0x37')][_0x967f('0x24')]);}_0x2d845c[_0x967f('0x3c')]=qs[_0x967f('0x3d')](_0x4febb2[_0x967f('0x37')][_0x967f('0x3d')]);_0x2d845c[_0x967f('0x3e')]=qs[_0x967f('0x3f')](_[_0x967f('0x40')](_0x4febb2['query'],_0x282953['filters']),_0x548a28);if(_0x4febb2[_0x967f('0x37')][_0x967f('0x41')]){_0x2d845c[_0x967f('0x3e')]=_['merge'](_0x2d845c[_0x967f('0x3e')],{'$or':_[_0x967f('0x32')](_0x548a28,function(_0x22288b){if(_0x22288b[_0x967f('0x42')]!==_0x967f('0x43')){var _0x2d25bd={};_0x2d25bd[_0x22288b['name']]={'$like':'%'+_0x4febb2[_0x967f('0x37')][_0x967f('0x41')]+'%'};return _0x2d25bd;}})});}_0x2d845c=_['merge']({},_0x2d845c,_0x4febb2['options']);var _0x2e5da4={'where':_0x2d845c[_0x967f('0x3e')]};return db[_0x967f('0x33')][_0x967f('0x23')](_0x2e5da4)[_0x967f('0x2b')](function(_0x11c3cb){_0x4e3b7f['count']=_0x11c3cb;if(_0x4febb2[_0x967f('0x37')][_0x967f('0x44')]){_0x2d845c['include']=[{'all':!![]}];}return db[_0x967f('0x33')][_0x967f('0x45')](_0x2d845c);})['then'](function(_0x1f1baa){_0x4e3b7f[_0x967f('0x46')]=_0x1f1baa;return _0x4e3b7f;})['then'](respondWithFilteredResult(_0x498540,_0x2d845c))['catch'](handleError(_0x498540,null));};exports[_0x967f('0x47')]=function(_0x9e050e,_0x37f4ad){var _0x220c07={'raw':![],'where':{'id':_0x9e050e[_0x967f('0x48')]['id']}},_0x3c674a={};_0x3c674a[_0x967f('0x36')]=_[_0x967f('0x49')](db['CmList'][_0x967f('0x34')]);_0x3c674a[_0x967f('0x37')]=_[_0x967f('0x49')](_0x9e050e['query']);_0x3c674a[_0x967f('0x3f')]=_[_0x967f('0x39')](_0x3c674a[_0x967f('0x36')],_0x3c674a[_0x967f('0x37')]);_0x220c07['attributes']=_[_0x967f('0x39')](_0x3c674a[_0x967f('0x36')],qs[_0x967f('0x3a')](_0x9e050e[_0x967f('0x37')]['fields']));_0x220c07[_0x967f('0x38')]=_0x220c07[_0x967f('0x38')]['length']?_0x220c07[_0x967f('0x38')]:_0x3c674a[_0x967f('0x36')];if(_0x9e050e[_0x967f('0x37')][_0x967f('0x44')]){_0x220c07['include']=[{'all':!![]}];}_0x220c07=_[_0x967f('0x4a')]({},_0x220c07,_0x9e050e[_0x967f('0x4b')]);return db['CmList'][_0x967f('0x4c')](_0x220c07)[_0x967f('0x2b')](handleEntityNotFound(_0x37f4ad,null))[_0x967f('0x2b')](respondWithResult(_0x37f4ad,null))[_0x967f('0x4d')](handleError(_0x37f4ad,null));};exports[_0x967f('0x4e')]=function(_0x1b2e64,_0x17cb2d){return db[_0x967f('0x33')]['create'](_0x1b2e64[_0x967f('0x4f')],{})['then'](function(_0x340c88){var _0x201242=_0x1b2e64[_0x967f('0x50')][_0x967f('0x51')]({'plain':!![]});if(!_0x201242)throw new Error(_0x967f('0x52'));if(_0x201242['role']===_0x967f('0x50')){var _0x2cb0d6=_0x340c88[_0x967f('0x51')]({'plain':!![]});var _0x273437=_0x967f('0x53');return db['UserProfileSection']['find']({'where':{'name':_0x273437,'userProfileId':_0x201242[_0x967f('0x54')]},'raw':!![]})[_0x967f('0x2b')](function(_0x342432){if(_0x342432&&_0x342432[_0x967f('0x55')]===0x0){return db[_0x967f('0x56')][_0x967f('0x4e')]({'name':_0x2cb0d6[_0x967f('0x2f')],'resourceId':_0x2cb0d6['id'],'type':_0x342432[_0x967f('0x2f')],'sectionId':_0x342432['id']},{})['then'](function(){return _0x340c88;});}else{return _0x340c88;}})[_0x967f('0x4d')](function(_0x530108){logger['error'](_0x967f('0x57'),_0x530108);throw _0x530108;});}return _0x340c88;})[_0x967f('0x2b')](respondWithResult(_0x17cb2d,0xc9))[_0x967f('0x4d')](handleError(_0x17cb2d,null));};exports[_0x967f('0x2a')]=function(_0x448662,_0x30110d){if(_0x448662[_0x967f('0x4f')]['id']){delete _0x448662['body']['id'];}return db[_0x967f('0x33')][_0x967f('0x4c')]({'where':{'id':_0x448662[_0x967f('0x48')]['id']}})['then'](handleEntityNotFound(_0x30110d,null))['then'](saveUpdates(_0x448662[_0x967f('0x4f')],null))[_0x967f('0x2b')](respondWithResult(_0x30110d,null))['catch'](handleError(_0x30110d,null));};exports[_0x967f('0x2c')]=function(_0x56f2d0,_0x2dd74c){return db[_0x967f('0x33')]['find']({'where':{'id':_0x56f2d0[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x2dd74c,null))[_0x967f('0x2b')](removeEntity(_0x2dd74c,null))[_0x967f('0x4d')](handleError(_0x2dd74c,null));};exports['describe']=function(_0x3ee3cd,_0x15a8f2){return db[_0x967f('0x33')][_0x967f('0x58')]()[_0x967f('0x2b')](respondWithResult(_0x15a8f2,null))[_0x967f('0x4d')](handleError(_0x15a8f2,null));};exports[_0x967f('0x59')]=function(_0x306634,_0x4078ce,_0x3af1b5){if(_0x306634['body']['id']){delete _0x306634[_0x967f('0x4f')]['id'];}return db['CmList']['find']({'where':{'id':_0x306634[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x4078ce,null))[_0x967f('0x2b')](function(_0x13fc95){if(_0x13fc95){_0x306634[_0x967f('0x4f')][_0x967f('0x5a')]=_0x13fc95['id'];return db[_0x967f('0x5b')]['create'](_0x306634['body']);}})[_0x967f('0x2b')](respondWithResult(_0x4078ce,null))[_0x967f('0x4d')](handleError(_0x4078ce,null));};exports[_0x967f('0x5c')]=function(_0x2d6096,_0xf1f706,_0x337a17){var _0x36ec5c={'raw':![],'where':{}};var _0x29ade8={};var _0x91973c={'count':0x0,'rows':[]};return db[_0x967f('0x33')][_0x967f('0x5d')]({'where':{'id':_0x2d6096['params']['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0xf1f706,null))[_0x967f('0x2b')](function(_0x24318c){if(_0x24318c){_0x29ade8[_0x967f('0x36')]=_[_0x967f('0x49')](db[_0x967f('0x5b')][_0x967f('0x34')]);_0x29ade8[_0x967f('0x37')]=_[_0x967f('0x49')](_0x2d6096[_0x967f('0x37')]);_0x29ade8[_0x967f('0x3f')]=_['intersection'](_0x29ade8[_0x967f('0x36')],_0x29ade8[_0x967f('0x37')]);_0x36ec5c[_0x967f('0x38')]=_[_0x967f('0x39')](_0x29ade8[_0x967f('0x36')],qs['fields'](_0x2d6096['query'][_0x967f('0x3a')]));_0x36ec5c[_0x967f('0x38')]=_0x36ec5c[_0x967f('0x38')]['length']?_0x36ec5c[_0x967f('0x38')]:_0x29ade8[_0x967f('0x36')];if(!_0x2d6096[_0x967f('0x37')][_0x967f('0x5e')]('nolimit')){_0x36ec5c[_0x967f('0x25')]=qs[_0x967f('0x25')](_0x2d6096[_0x967f('0x37')][_0x967f('0x25')]);_0x36ec5c['offset']=qs[_0x967f('0x24')](_0x2d6096[_0x967f('0x37')][_0x967f('0x24')]);}_0x36ec5c['order']=qs['sort'](_0x2d6096[_0x967f('0x37')]['sort']);_0x36ec5c['where']=qs['filters'](_[_0x967f('0x40')](_0x2d6096[_0x967f('0x37')],_0x29ade8[_0x967f('0x3f')]));_0x36ec5c[_0x967f('0x3e')][_0x967f('0x5a')]=_0x24318c['id'];if(_0x2d6096[_0x967f('0x37')][_0x967f('0x41')]){_0x36ec5c[_0x967f('0x3e')]=_[_0x967f('0x4a')](_0x36ec5c[_0x967f('0x3e')],{'$or':_[_0x967f('0x32')](_0x36ec5c[_0x967f('0x38')],function(_0x3021ea){var _0x60f240={};_0x60f240[_0x3021ea]={'$like':'%'+_0x2d6096['query'][_0x967f('0x41')]+'%'};return _0x60f240;})});}_0x36ec5c=_[_0x967f('0x4a')]({},_0x36ec5c,_0x2d6096[_0x967f('0x4b')]);return db['Disposition'][_0x967f('0x23')]({'where':_0x36ec5c[_0x967f('0x3e')]})[_0x967f('0x2b')](function(_0x246908){_0x91973c[_0x967f('0x23')]=_0x246908;if(_0x2d6096[_0x967f('0x37')][_0x967f('0x44')]){_0x36ec5c[_0x967f('0x5f')]=[{'all':!![]}];}return db[_0x967f('0x5b')][_0x967f('0x45')](_0x36ec5c);})[_0x967f('0x2b')](function(_0x1172c6){_0x91973c[_0x967f('0x46')]=_0x1172c6;return _0x91973c;});}})['then'](respondWithFilteredResult(_0xf1f706,_0x36ec5c))['catch'](handleError(_0xf1f706,null));};exports['removeDispositions']=function(_0x55a7d4,_0x420380,_0x3df23b){return db[_0x967f('0x33')][_0x967f('0x4c')]({'where':{'id':_0x55a7d4[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x420380,null))['then'](function(_0x1f6031){if(_0x1f6031){return _0x1f6031[_0x967f('0x60')](_0x55a7d4[_0x967f('0x37')][_0x967f('0x61')]);}})[_0x967f('0x2b')](respondWithStatusCode(_0x420380,null))[_0x967f('0x4d')](handleError(_0x420380,null));};exports['addContacts']=function(_0x3f7766,_0x57c875,_0xd8b2a3){return db['CmList'][_0x967f('0x4c')]({'where':{'id':_0x3f7766[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x57c875,null))['then'](function(_0x24caed){if(_0x24caed){var _0x791f3e=[];var _0x303a45={'success':[],'errors':[]};return db[_0x967f('0x62')][_0x967f('0x58')]()[_0x967f('0x2b')](function(_0x22c415){if(_0x3f7766[_0x967f('0x4f')][_0x967f('0x63')]&&_[_0x967f('0x64')](_0x3f7766['body']['tags'])){if(_0x3f7766['body'][_0x967f('0x63')][_0x967f('0x65')]){_0x3f7766[_0x967f('0x4f')][_0x967f('0x63')]=_0x3f7766[_0x967f('0x4f')][_0x967f('0x63')][_0x967f('0x66')](';')+';';}else{_0x3f7766[_0x967f('0x4f')]['tags']=null;}}else{_0x3f7766[_0x967f('0x4f')][_0x967f('0x63')]=null;}if(_0x3f7766['body']&&_[_0x967f('0x64')](_0x3f7766['body'])){for(var _0x2f6f95=0x0;_0x2f6f95<_0x3f7766[_0x967f('0x4f')][_0x967f('0x65')];_0x2f6f95+=0x1){_0x3f7766[_0x967f('0x4f')][_0x2f6f95][_0x967f('0x5a')]=_0x3f7766[_0x967f('0x48')]['id'];_0x791f3e[_0x967f('0x67')](_0x3f7766['body'][_0x2f6f95]);}return BPromise[_0x967f('0x68')](_0x791f3e,function(_0x6d9913){return db[_0x967f('0x62')][_0x967f('0x4e')](_[_0x967f('0x69')](_0x6d9913,[_0x967f('0x61'),'id'])||{},{'fields':_[_0x967f('0x49')](_0x22c415),'raw':!![]})[_0x967f('0x2b')](function(_0x4aea06){_0x303a45[_0x967f('0x6a')]['push'](_0x4aea06[_0x967f('0x6b')]);})['catch'](function(_0x4b5961){_0x303a45[_0x967f('0x6c')]['push']({'data':_0x6d9913,'error':_0x4b5961['message']});});})[_0x967f('0x2b')](function(_0x2dadfd){return _0x303a45;})['catch'](function(_0xb82ba){return _0xb82ba;});}else{_0x57c875[_0x967f('0x20')](0x190)[_0x967f('0x6d')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x967f('0x2b')](respondWithResult(_0x57c875,null))[_0x967f('0x4d')](handleError(_0x57c875,null));};exports[_0x967f('0x6e')]=function(_0x447338,_0x146ce6,_0x378dcc){var _0x457bd2;return db[_0x967f('0x33')][_0x967f('0x4c')]({'where':{'id':_0x447338['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x967f('0x6f')}]})[_0x967f('0x2b')](handleEntityNotFound(_0x146ce6,null))['then'](function(_0x31de89){if(_0x31de89){_0x457bd2=_0x31de89;return db['CmContact']['rawAttributes'];}})[_0x967f('0x2b')](function(_0x2cf1a4){if(_0x2cf1a4){var _0x70f934={};var _0x55c1c4={};_0x55c1c4[_0x967f('0x36')]=_['concat'](_['keys'](_0x2cf1a4),_['map'](_0x457bd2[_0x967f('0x6f')],function(_0x3b0f2a){return util[_0x967f('0x70')](_0x967f('0x71'),_0x3b0f2a['id']);}));_0x55c1c4['query']=_[_0x967f('0x49')](_0x447338[_0x967f('0x37')]);_0x55c1c4[_0x967f('0x3f')]=_[_0x967f('0x39')](_0x55c1c4[_0x967f('0x36')],_0x55c1c4['query']);_0x70f934['attributes']=_[_0x967f('0x39')](_0x55c1c4[_0x967f('0x36')],qs[_0x967f('0x3a')](_0x447338[_0x967f('0x37')][_0x967f('0x3a')]));_0x70f934[_0x967f('0x38')]=_0x70f934['attributes'][_0x967f('0x65')]?_0x70f934['attributes']:_0x55c1c4[_0x967f('0x36')];if(!_0x447338[_0x967f('0x37')][_0x967f('0x5e')](_0x967f('0x3b'))){_0x70f934[_0x967f('0x25')]=qs[_0x967f('0x25')](_0x447338[_0x967f('0x37')][_0x967f('0x25')]);_0x70f934[_0x967f('0x24')]=qs[_0x967f('0x24')](_0x447338[_0x967f('0x37')][_0x967f('0x24')]);}_0x70f934['order']=qs[_0x967f('0x3d')](_0x447338[_0x967f('0x37')][_0x967f('0x3d')]);_0x70f934['where']=qs[_0x967f('0x3f')](_[_0x967f('0x40')](_0x447338[_0x967f('0x37')],_0x55c1c4[_0x967f('0x3f')]));_0x70f934[_0x967f('0x72')]=!![];if(_0x447338[_0x967f('0x37')][_0x967f('0x41')]){_0x70f934[_0x967f('0x3e')]=_['merge'](_0x70f934[_0x967f('0x3e')],{'$or':_[_0x967f('0x32')](_0x70f934[_0x967f('0x38')],function(_0x54df9e){var _0x296ce2={};_0x296ce2[_0x54df9e]={'$like':'%'+_0x447338['query'][_0x967f('0x41')]+'%'};return _0x296ce2;})});}_0x70f934=_['merge']({},_0x70f934,_0x447338[_0x967f('0x4b')]);return _0x457bd2['getContacts'](_0x70f934);}})[_0x967f('0x2b')](respondWithResult(_0x146ce6,null))[_0x967f('0x4d')](handleError(_0x146ce6,null));};exports[_0x967f('0x73')]=function(_0x2bfdb9,_0x43551a,_0x235698){var _0x187ab3;var _0x433f80;var _0x5f05de;var _0x47e1ca=_0x2bfdb9[_0x967f('0x48')]['id'];csv_results=[];return db[_0x967f('0x74')]['findAll']({'attributes':['id',_0x967f('0x2f')],'raw':!![],'order':[_0x967f('0x75')]})[_0x967f('0x2b')](function(_0x27e2a0){_0x187ab3=_0x27e2a0;var _0xf68ef4=_[_0x967f('0x49')](db[_0x967f('0x62')][_0x967f('0x34')]);return db[_0x967f('0x76')][_0x967f('0x45')]({'raw':!![],'attributes':['id',_0x967f('0x77')]})[_0x967f('0x2b')](function(_0x830fe0){_0x433f80=_0x830fe0;var _0x47503d=squel['select']()['fields'](_0xf68ef4)[_0x967f('0x78')](_0x967f('0x79'),'c')['where'](_0x967f('0x7a'),_0x47e1ca)['where']('c.deletedAt\x20is\x20null')[_0x967f('0x7b')]();for(var _0xa28e11=0x0;_0xa28e11<_0x433f80['length'];_0xa28e11++){_0x47503d[_0x967f('0x7c')]('c.cf_'+_0x433f80[_0xa28e11]['id'],_0x967f('0x7d')+_0x433f80[_0xa28e11][_0x967f('0x77')]);}for(var _0xa28e11=0x0;_0xa28e11<_0x187ab3[_0x967f('0x65')];_0xa28e11++){_0x47503d[_0x967f('0x7c')](squel[_0x967f('0x7e')]()[_0x967f('0x7c')](_0x967f('0x7f'))[_0x967f('0x78')](_0x967f('0x80'))['where'](_0x967f('0x81'),_0x187ab3[_0xa28e11]['id'])['where'](_0x967f('0x82')),'additionalPhone_'+_0x187ab3[_0xa28e11][_0x967f('0x2f')]);_0x47503d[_0x967f('0x7c')](squel[_0x967f('0x7e')]()[_0x967f('0x7c')](_0x967f('0x83'))[_0x967f('0x78')](_0x967f('0x80'))['where']('ItemTypeId\x20=\x20?',_0x187ab3[_0xa28e11]['id'])[_0x967f('0x3e')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x187ab3[_0xa28e11][_0x967f('0x2f')]);}var _0x40f036=[];_0x40f036[_0x967f('0x67')](_0x47503d[_0x967f('0x84')]());BPromise['each'](_0x40f036,handleQuery)[_0x967f('0x2b')](function(_0x3691ec){handleQuery(_0x47503d[_0x967f('0x84')]());var _0x2ac3d9=csv_results[0x0];if(!_[_0x967f('0x85')](_0x2ac3d9)){var _0x113af0=toCsv(_0x2ac3d9);var _0x1b7b07=Date['now']();fs[_0x967f('0x86')](util[_0x967f('0x70')](_0x967f('0x87'),_0x47e1ca,_0x1b7b07),_0x113af0);_0x43551a['setHeader'](_0x967f('0x88'),_0x967f('0x89')+util[_0x967f('0x70')](_0x967f('0x8a'),_0x47e1ca,_0x1b7b07));_0x43551a['setHeader'](_0x967f('0x8b'),_0x967f('0x8c'));return _0x43551a['download'](util[_0x967f('0x70')]('/tmp/list_%d_%s.csv',_0x47e1ca,_0x1b7b07));}else{return _0x43551a['sendStatus'](0xcc);}});});});};exports[_0x967f('0x8d')]=function(_0x1ce2b3,_0x567389,_0x3f0fee){var _0x2157b4;delete _0x1ce2b3[_0x967f('0x4f')]['id'];return db[_0x967f('0x33')]['findOne']({'where':{'id':_0x1ce2b3[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x567389,null))['then'](function(_0x4e7738){if(_0x4e7738){return db[_0x967f('0x8e')]['transaction'](function(_0x31315a){return db[_0x967f('0x76')]['create'](_0x1ce2b3[_0x967f('0x4f')],{'transaction':_0x31315a})[_0x967f('0x2b')](function(_0x332fcc){_0x2157b4=_0x332fcc;return _0x4e7738[_0x967f('0x8f')](_0x332fcc,{'transaction':_0x31315a});})[_0x967f('0x2b')](function(){var _0x31fbe2={'type':db[_0x967f('0x90')][_0x967f('0x91')],'transaction':_0x31315a};switch(_0x1ce2b3[_0x967f('0x4f')][_0x967f('0x42')]){case _0x967f('0x92'):_0x31fbe2['type']=db['Sequelize'][_0x967f('0x91')];break;case _0x967f('0x93'):_0x31fbe2[_0x967f('0x42')]=db[_0x967f('0x90')][_0x967f('0x94')];break;case'switch':_0x31fbe2['type']=db[_0x967f('0x90')][_0x967f('0x95')];_0x31fbe2[_0x967f('0x96')]=![];break;default:}return db[_0x967f('0x8e')][_0x967f('0x97')][_0x967f('0x98')]('cm_contacts',util['format'](_0x967f('0x99'),_0x2157b4['id']),_0x31fbe2);})['then'](function(){return _0x2157b4;});});}})[_0x967f('0x2b')](respondWithResult(_0x567389,null))[_0x967f('0x4d')](handleError(_0x567389,null));};exports[_0x967f('0x9a')]=function(_0x5b3183,_0x305da8,_0x353aac){var _0x69b4b1={};var _0x214244={};var _0x3d1e72;var _0x383acd;return db['CmList'][_0x967f('0x5d')]({'where':{'id':_0x5b3183['params']['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x305da8,null))[_0x967f('0x2b')](function(_0x5e5651){if(_0x5e5651){_0x3d1e72=_0x5e5651;_0x214244[_0x967f('0x36')]=_[_0x967f('0x49')](db[_0x967f('0x76')][_0x967f('0x34')]);_0x214244['query']=_[_0x967f('0x49')](_0x5b3183[_0x967f('0x37')]);_0x214244[_0x967f('0x3f')]=_['intersection'](_0x214244['model'],_0x214244[_0x967f('0x37')]);_0x69b4b1[_0x967f('0x38')]=_[_0x967f('0x39')](_0x214244[_0x967f('0x36')],qs['fields'](_0x5b3183['query'][_0x967f('0x3a')]));_0x69b4b1[_0x967f('0x38')]=_0x69b4b1[_0x967f('0x38')][_0x967f('0x65')]?_0x69b4b1[_0x967f('0x38')]:_0x214244[_0x967f('0x36')];_0x69b4b1[_0x967f('0x3c')]=qs[_0x967f('0x3d')](_0x5b3183[_0x967f('0x37')][_0x967f('0x3d')]);_0x69b4b1['where']=qs['filters'](_[_0x967f('0x40')](_0x5b3183['query'],_0x214244[_0x967f('0x3f')]));_0x69b4b1[_0x967f('0x3e')]=_[_0x967f('0x4a')](_0x69b4b1[_0x967f('0x3e')],{'$or':[{'ListId':_0x5e5651['id']},{'ListId':null}]});if(_0x5b3183['query'][_0x967f('0x41')]){_0x69b4b1[_0x967f('0x3e')]=_['merge'](_0x69b4b1[_0x967f('0x3e')],{'$or':_['map'](_0x69b4b1[_0x967f('0x38')],function(_0x4c68e8){var _0x27c919={};_0x27c919[_0x4c68e8]={'$like':'%'+_0x5b3183['query'][_0x967f('0x41')]+'%'};return _0x27c919;})});}_0x69b4b1=_[_0x967f('0x4a')]({},_0x69b4b1,_0x5b3183[_0x967f('0x4b')]);return db['CmCustomField'][_0x967f('0x9b')](_0x69b4b1);}})[_0x967f('0x2b')](respondWithResult(_0x305da8,null))[_0x967f('0x4d')](handleError(_0x305da8,null));};exports[_0x967f('0x9c')]=function(_0x39b56a,_0x12ad7b){return db[_0x967f('0x76')][_0x967f('0x9b')]({'where':{'ListId':null}})[_0x967f('0x2b')](handleEntityNotFound(_0x12ad7b,null))[_0x967f('0x2b')](function(_0x64b055){return _0x64b055;})['then'](respondWithResult(_0x12ad7b,null))[_0x967f('0x4d')](handleError(_0x12ad7b,null));};exports['addAgents']=function(_0x256e95,_0x535968,_0x47e0a8){return db[_0x967f('0x33')]['find']({'where':{'id':_0x256e95['params']['id']}})['then'](handleEntityNotFound(_0x535968,null))[_0x967f('0x2b')](function(_0x1723d3){if(_0x1723d3){return _0x1723d3[_0x967f('0x9d')](_0x256e95[_0x967f('0x4f')]['ids'],_[_0x967f('0x69')](_0x256e95[_0x967f('0x4f')],[_0x967f('0x61'),'id'])||{})['spread'](function(_0x337c10){for(var _0x1067c6=0x0;_0x1067c6<_0x256e95[_0x967f('0x4f')][_0x967f('0x61')][_0x967f('0x65')];_0x1067c6+=0x1){socket[_0x967f('0x9e')](_0x967f('0x9f'),{'UserId':Number(_0x256e95[_0x967f('0x4f')][_0x967f('0x61')][_0x1067c6]),'CmListId':Number(_0x256e95[_0x967f('0x48')]['id'])});}return _0x337c10;});}})[_0x967f('0x2b')](respondWithResult(_0x535968,null))['catch'](handleError(_0x535968,null));};exports[_0x967f('0xa0')]=function(_0x2264d1,_0x25d0d5,_0x9abb28){return db[_0x967f('0x33')][_0x967f('0x4c')]({'where':{'id':_0x2264d1[_0x967f('0x48')]['id']}})['then'](handleEntityNotFound(_0x25d0d5,null))[_0x967f('0x2b')](function(_0x760e54){if(_0x760e54){return _0x760e54[_0x967f('0xa0')](_0x2264d1['query'][_0x967f('0x61')])['then'](function(){if(_[_0x967f('0x64')](_0x2264d1['query'][_0x967f('0x61')])){for(var _0x2ebfd4=0x0;_0x2ebfd4<_0x2264d1[_0x967f('0x37')]['ids'][_0x967f('0x65')];_0x2ebfd4+=0x1){socket[_0x967f('0x9e')](_0x967f('0xa1'),{'UserId':Number(_0x2264d1[_0x967f('0x37')][_0x967f('0x61')][_0x2ebfd4]),'CmListId':Number(_0x2264d1[_0x967f('0x48')]['id'])});}}else{socket[_0x967f('0x9e')]('userCmList:remove',{'UserId':Number(_0x2264d1[_0x967f('0x37')][_0x967f('0x61')]),'CmListId':Number(_0x2264d1['params']['id'])});}});}})[_0x967f('0x2b')](respondWithStatusCode(_0x25d0d5,null))['catch'](handleError(_0x25d0d5,null));};exports[_0x967f('0xa2')]=function(_0x4aeff9,_0xe1f7d2,_0x4829c1){var _0x3f29c9={};var _0x50e935={};var _0x3e91dd;var _0x4d4f5e;return db[_0x967f('0x33')]['findOne']({'where':{'id':_0x4aeff9[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0xe1f7d2,null))[_0x967f('0x2b')](function(_0x2f2423){if(_0x2f2423){_0x3e91dd=_0x2f2423;_0x50e935[_0x967f('0x36')]=_['keys'](db[_0x967f('0xa3')][_0x967f('0x34')]);_0x50e935[_0x967f('0x37')]=_[_0x967f('0x49')](_0x4aeff9[_0x967f('0x37')]);_0x50e935[_0x967f('0x3f')]=_['intersection'](_0x50e935[_0x967f('0x36')],_0x50e935[_0x967f('0x37')]);_0x3f29c9[_0x967f('0x38')]=_[_0x967f('0x39')](_0x50e935[_0x967f('0x36')],qs[_0x967f('0x3a')](_0x4aeff9[_0x967f('0x37')][_0x967f('0x3a')]));_0x3f29c9[_0x967f('0x38')]=_0x3f29c9[_0x967f('0x38')][_0x967f('0x65')]?_0x3f29c9[_0x967f('0x38')]:_0x50e935[_0x967f('0x36')];_0x3f29c9[_0x967f('0x3c')]=qs[_0x967f('0x3d')](_0x4aeff9[_0x967f('0x37')][_0x967f('0x3d')]);_0x3f29c9[_0x967f('0x3e')]=qs['filters'](_[_0x967f('0x40')](_0x4aeff9[_0x967f('0x37')],_0x50e935[_0x967f('0x3f')]));if(_0x4aeff9[_0x967f('0x37')]['filter']){_0x3f29c9[_0x967f('0x3e')]=_[_0x967f('0x4a')](_0x3f29c9['where'],{'$or':_[_0x967f('0x32')](_0x3f29c9[_0x967f('0x38')],function(_0x28d135){var _0x19a5c6={};_0x19a5c6[_0x28d135]={'$like':'%'+_0x4aeff9[_0x967f('0x37')][_0x967f('0x41')]+'%'};return _0x19a5c6;})});}_0x3f29c9=_['merge']({},_0x3f29c9,_0x4aeff9['options']);return _0x3e91dd[_0x967f('0xa2')](_0x3f29c9);}})[_0x967f('0x2b')](function(_0x4b42cd){if(_0x4b42cd){_0x4d4f5e=_0x4b42cd[_0x967f('0x65')];if(!_0x4aeff9[_0x967f('0x37')][_0x967f('0x5e')](_0x967f('0x3b'))){_0x3f29c9[_0x967f('0x25')]=qs[_0x967f('0x25')](_0x4aeff9['query']['limit']);_0x3f29c9[_0x967f('0x24')]=qs[_0x967f('0x24')](_0x4aeff9[_0x967f('0x37')][_0x967f('0x24')]);}return _0x3e91dd[_0x967f('0xa2')](_0x3f29c9);}})['then'](function(_0x1dbf94){if(_0x1dbf94){return _0x1dbf94?{'count':_0x4d4f5e,'rows':_0x1dbf94}:null;}})[_0x967f('0x2b')](respondWithResult(_0xe1f7d2,null))[_0x967f('0x4d')](handleError(_0xe1f7d2,null));};function handleQuery(_0x23a08d){logger[_0x967f('0xa4')](_0x23a08d);return db[_0x967f('0x8e')][_0x967f('0x37')](_0x23a08d)[_0x967f('0xa5')](function(_0x132338){csv_results[_0x967f('0x67')](_0x132338);})['catch'](function(_0x2af117){logger[_0x967f('0x2d')](_0x2af117[_0x967f('0xa6')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 7b3a57b..3561d94 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1633e9,_0x50a939){var _0x549ace=function(_0x15a157){while(--_0x15a157){_0x1633e9['push'](_0x1633e9['shift']());}};_0x549ace(++_0x50a939);}(_0x814b,0x1a2));var _0xb814=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0x814b[_0x595013];return _0x2a29e3;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x4edb28,_0x1f0292){var _0x5b56c0=function(_0x38e742){while(--_0x38e742){_0x4edb28['push'](_0x4edb28['shift']());}};_0x5b56c0(++_0x1f0292);}(_0x814b,0x1a2));var _0xb814=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x814b[_0x364cf8];return _0x6a59ee;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index e745728..3a79a15 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 _0x2750=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4ded16,_0x23fcbf){var _0x4a525a=function(_0x2c6b5e){while(--_0x2c6b5e){_0x4ded16['push'](_0x4ded16['shift']());}};_0x4a525a(++_0x23fcbf);}(_0x2750,0x13b));var _0x0275=function(_0x357973,_0x360f17){_0x357973=_0x357973-0x0;var _0x3272df=_0x2750[_0x357973];return _0x3272df;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf109=['CmList','cm_lists','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x24516c,_0x59fcd8){var _0xaf2987=function(_0x9f8828){while(--_0x9f8828){_0x24516c['push'](_0x24516c['shift']());}};_0xaf2987(++_0x59fcd8);}(_0xf109,0xce));var _0x9f10=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xf109[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'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 84c5d5f..a81fd44 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 _0x11a9=['result','catch','lodash','util','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3ff3eb,_0x3a311a){var _0x494495=function(_0x5b47e9){while(--_0x5b47e9){_0x3ff3eb['push'](_0x3ff3eb['shift']());}};_0x494495(++_0x3a311a);}(_0x11a9,0x1ab));var _0x911a=function(_0x5a40e6,_0x223ce8){_0x5a40e6=_0x5a40e6-0x0;var _0x28f32b=_0x11a9[_0x5a40e6];return _0x28f32b;};'use strict';var _=require(_0x911a('0x0'));var util=require(_0x911a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x911a('0x2'));var fs=require('fs');var Redis=require(_0x911a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x911a('0x4'));var jayson=require(_0x911a('0x5'));var client=jayson[_0x911a('0x6')][_0x911a('0x7')]({'port':0x232a});config[_0x911a('0x8')]=_[_0x911a('0x9')](config[_0x911a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x911a('0xa'))(new Redis(config[_0x911a('0x8')]));require(_0x911a('0xb'))[_0x911a('0xc')](socket);function respondWithRpcPromise(_0x2669f3,_0x293f5f,_0x5b3a8d){return new BPromise(function(_0x38bd54,_0x542aac){return client[_0x911a('0xd')](_0x2669f3,_0x5b3a8d)[_0x911a('0xe')](function(_0x1b427c){logger[_0x911a('0xf')](_0x911a('0x10'),_0x293f5f,_0x911a('0x11'));logger[_0x911a('0x12')](_0x911a('0x13'),_0x293f5f,_0x911a('0x11'),JSON['stringify'](_0x1b427c));if(_0x1b427c[_0x911a('0x14')]){if(_0x1b427c[_0x911a('0x14')][_0x911a('0x15')]===0x1f4){logger[_0x911a('0x14')](_0x911a('0x10'),_0x293f5f,_0x1b427c[_0x911a('0x14')][_0x911a('0x16')]);return _0x542aac(_0x1b427c[_0x911a('0x14')][_0x911a('0x16')]);}logger[_0x911a('0x14')](_0x911a('0x10'),_0x293f5f,_0x1b427c['error'][_0x911a('0x16')]);return _0x38bd54(_0x1b427c[_0x911a('0x14')][_0x911a('0x16')]);}else{logger['info'](_0x911a('0x10'),_0x293f5f,_0x911a('0x11'));_0x38bd54(_0x1b427c[_0x911a('0x17')][_0x911a('0x16')]);}})[_0x911a('0x18')](function(_0xbe9cdd){logger[_0x911a('0x14')]('CmList,\x20%s,\x20%s',_0x293f5f,_0xbe9cdd);_0x542aac(_0xbe9cdd);});});} \ No newline at end of file +var _0x8335=['jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket','register','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3de0d9,_0x2ccb8f){var _0x161cd9=function(_0x8e23e7){while(--_0x8e23e7){_0x3de0d9['push'](_0x3de0d9['shift']());}};_0x161cd9(++_0x2ccb8f);}(_0x8335,0x15d));var _0x5833=function(_0x1bb3eb,_0x569874){_0x1bb3eb=_0x1bb3eb-0x0;var _0x533c14=_0x8335[_0x1bb3eb];return _0x533c14;};'use strict';var _=require(_0x5833('0x0'));var util=require(_0x5833('0x1'));var moment=require(_0x5833('0x2'));var BPromise=require(_0x5833('0x3'));var rs=require(_0x5833('0x4'));var fs=require('fs');var Redis=require(_0x5833('0x5'));var db=require(_0x5833('0x6'))['db'];var utils=require(_0x5833('0x7'));var logger=require(_0x5833('0x8'))(_0x5833('0x9'));var config=require(_0x5833('0xa'));var jayson=require(_0x5833('0xb'));var client=jayson[_0x5833('0xc')]['http']({'port':0x232a});config[_0x5833('0xd')]=_['defaults'](config[_0x5833('0xd')],{'host':_0x5833('0xe'),'port':0x18eb});var socket=require(_0x5833('0xf'))(new Redis(config[_0x5833('0xd')]));require(_0x5833('0x10'))[_0x5833('0x11')](socket);function respondWithRpcPromise(_0x516329,_0x2ae4d9,_0x456272){return new BPromise(function(_0x384c82,_0x1aca53){return client['request'](_0x516329,_0x456272)[_0x5833('0x12')](function(_0x424a20){logger['info'](_0x5833('0x13'),_0x2ae4d9,_0x5833('0x14'));logger[_0x5833('0x15')](_0x5833('0x16'),_0x2ae4d9,_0x5833('0x14'),JSON[_0x5833('0x17')](_0x424a20));if(_0x424a20[_0x5833('0x18')]){if(_0x424a20[_0x5833('0x18')][_0x5833('0x19')]===0x1f4){logger[_0x5833('0x18')]('CmList,\x20%s,\x20%s',_0x2ae4d9,_0x424a20[_0x5833('0x18')]['message']);return _0x1aca53(_0x424a20[_0x5833('0x18')]['message']);}logger[_0x5833('0x18')](_0x5833('0x13'),_0x2ae4d9,_0x424a20['error'][_0x5833('0x1a')]);return _0x384c82(_0x424a20[_0x5833('0x18')][_0x5833('0x1a')]);}else{logger[_0x5833('0x1b')]('CmList,\x20%s,\x20%s',_0x2ae4d9,_0x5833('0x14'));_0x384c82(_0x424a20[_0x5833('0x1c')][_0x5833('0x1a')]);}})[_0x5833('0x1d')](function(_0x523c49){logger[_0x5833('0x18')]('CmList,\x20%s,\x20%s',_0x2ae4d9,_0x523c49);_0x1aca53(_0x523c49);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index bf82a98..6199628 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 _0x72e9=['update','emit','register','cmList:','./cmList.events','save','remove'];(function(_0x3fa5d4,_0x5eaea4){var _0x2d8f65=function(_0x268360){while(--_0x268360){_0x3fa5d4['push'](_0x3fa5d4['shift']());}};_0x2d8f65(++_0x5eaea4);}(_0x72e9,0xf9));var _0x972e=function(_0x24074e,_0x476b5c){_0x24074e=_0x24074e-0x0;var _0x181463=_0x72e9[_0x24074e];return _0x181463;};'use strict';var CmListEvents=require(_0x972e('0x0'));var events=[_0x972e('0x1'),_0x972e('0x2'),_0x972e('0x3')];function createListener(_0x1384f9,_0x4f3360){return function(_0x353789){_0x4f3360[_0x972e('0x4')](_0x1384f9,_0x353789);};}function removeListener(_0x555cbe,_0x2f2ff2){return function(){CmListEvents['removeListener'](_0x555cbe,_0x2f2ff2);};}exports[_0x972e('0x5')]=function(_0x17da9e){for(var _0x27703e=0x0,_0x1b04f6=events['length'];_0x27703e<_0x1b04f6;_0x27703e++){var _0x595371=events[_0x27703e];var _0x4f911a=createListener(_0x972e('0x6')+_0x595371,_0x17da9e);CmListEvents['on'](_0x595371,_0x4f911a);}}; \ No newline at end of file +var _0x6f9c=['update','removeListener','length','save'];(function(_0x1348c5,_0x47f907){var _0xdeb46e=function(_0x4090f1){while(--_0x4090f1){_0x1348c5['push'](_0x1348c5['shift']());}};_0xdeb46e(++_0x47f907);}(_0x6f9c,0x103));var _0xc6f9=function(_0x3eb98b,_0x5ac541){_0x3eb98b=_0x3eb98b-0x0;var _0x1a7269=_0x6f9c[_0x3eb98b];return _0x1a7269;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xc6f9('0x0'),'remove',_0xc6f9('0x1')];function createListener(_0xfdbf50,_0x8c2bb6){return function(_0x378b29){_0x8c2bb6['emit'](_0xfdbf50,_0x378b29);};}function removeListener(_0x59776f,_0x57f05f){return function(){CmListEvents[_0xc6f9('0x2')](_0x59776f,_0x57f05f);};}exports['register']=function(_0x75ca41){for(var _0x6d47f5=0x0,_0x1edaca=events[_0xc6f9('0x3')];_0x6d47f5<_0x1edaca;_0x6d47f5++){var _0x3ac7a6=events[_0x6d47f5];var _0xfcb38=createListener('cmList:'+_0x3ac7a6,_0x75ca41);CmListEvents['on'](_0x3ac7a6,_0xfcb38);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 0250abc..9b207d7 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 _0x6aa0=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','/:id','show','/:id/dispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','/:id/contacts','addContacts','/:id/fields','addAgents','update','destroy','delete','removeAgents','util','path'];(function(_0x4e2148,_0x382a2c){var _0x323345=function(_0x426339){while(--_0x426339){_0x4e2148['push'](_0x4e2148['shift']());}};_0x323345(++_0x382a2c);}(_0x6aa0,0xb8));var _0x06aa=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x6aa0[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require(_0x06aa('0x0'));var path=require(_0x06aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x06aa('0x2'));var router=express['Router']();var fs_extra=require(_0x06aa('0x3'));var auth=require(_0x06aa('0x4'));var interaction=require(_0x06aa('0x5'));var config=require('../../config/environment');var controller=require(_0x06aa('0x6'));router[_0x06aa('0x7')]('/',auth[_0x06aa('0x8')](),controller[_0x06aa('0x9')]);router[_0x06aa('0x7')]('/describe',auth[_0x06aa('0x8')](),controller[_0x06aa('0xa')]);router['get'](_0x06aa('0xb'),auth[_0x06aa('0x8')](),controller['getGlobalCustomFields']);router['get'](_0x06aa('0xc'),auth[_0x06aa('0x8')](),controller[_0x06aa('0xd')]);router[_0x06aa('0x7')](_0x06aa('0xe'),auth[_0x06aa('0x8')](),controller['getDispositions']);router[_0x06aa('0x7')]('/:id/contacts',auth[_0x06aa('0x8')](),controller[_0x06aa('0xf')]);router[_0x06aa('0x7')](_0x06aa('0x10'),auth[_0x06aa('0x8')](),controller[_0x06aa('0x11')]);router[_0x06aa('0x7')]('/:id/fields',auth[_0x06aa('0x8')](),controller[_0x06aa('0x12')]);router[_0x06aa('0x7')](_0x06aa('0x13'),auth[_0x06aa('0x8')](),controller[_0x06aa('0x14')]);router[_0x06aa('0x15')]('/',auth[_0x06aa('0x8')](),controller[_0x06aa('0x16')]);router[_0x06aa('0x15')]('/:id/dispositions',auth[_0x06aa('0x8')](),controller['addDisposition']);router['post'](_0x06aa('0x17'),auth[_0x06aa('0x8')](),controller[_0x06aa('0x18')]);router[_0x06aa('0x15')](_0x06aa('0x19'),auth['isAuthenticated'](),controller['addCustomField']);router[_0x06aa('0x15')](_0x06aa('0x13'),auth[_0x06aa('0x8')](),controller[_0x06aa('0x1a')]);router['put'](_0x06aa('0xc'),auth['isAuthenticated'](),controller[_0x06aa('0x1b')]);router['delete'](_0x06aa('0xc'),auth[_0x06aa('0x8')](),controller[_0x06aa('0x1c')]);router[_0x06aa('0x1d')](_0x06aa('0xe'),auth[_0x06aa('0x8')](),controller['removeDispositions']);router['delete'](_0x06aa('0x13'),auth[_0x06aa('0x8')](),controller[_0x06aa('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x025c=['/:id/contacts/csv','/:id/fields','getCustomFields','getAgents','post','create','addContacts','addCustomField','/:id/users','put','update','delete','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts'];(function(_0x131a94,_0x3b95ac){var _0x5b807f=function(_0x279e9f){while(--_0x279e9f){_0x131a94['push'](_0x131a94['shift']());}};_0x5b807f(++_0x3b95ac);}(_0x025c,0x1ad));var _0xc025=function(_0x5dcff6,_0x4a8796){_0x5dcff6=_0x5dcff6-0x0;var _0x2699cd=_0x025c[_0x5dcff6];return _0x2699cd;};'use strict';var multer=require('multer');var util=require(_0xc025('0x0'));var path=require(_0xc025('0x1'));var timeout=require(_0xc025('0x2'));var express=require(_0xc025('0x3'));var router=express[_0xc025('0x4')]();var fs_extra=require(_0xc025('0x5'));var auth=require(_0xc025('0x6'));var interaction=require(_0xc025('0x7'));var config=require(_0xc025('0x8'));var controller=require('./cmList.controller');router[_0xc025('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xc025('0xa')](),controller['describe']);router[_0xc025('0x9')](_0xc025('0xb'),auth['isAuthenticated'](),controller[_0xc025('0xc')]);router[_0xc025('0x9')](_0xc025('0xd'),auth[_0xc025('0xa')](),controller[_0xc025('0xe')]);router[_0xc025('0x9')](_0xc025('0xf'),auth[_0xc025('0xa')](),controller[_0xc025('0x10')]);router[_0xc025('0x9')](_0xc025('0x11'),auth[_0xc025('0xa')](),controller[_0xc025('0x12')]);router['get'](_0xc025('0x13'),auth[_0xc025('0xa')](),controller['getContactsCsv']);router[_0xc025('0x9')](_0xc025('0x14'),auth['isAuthenticated'](),controller[_0xc025('0x15')]);router[_0xc025('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xc025('0x16')]);router[_0xc025('0x17')]('/',auth['isAuthenticated'](),controller[_0xc025('0x18')]);router['post'](_0xc025('0xf'),auth[_0xc025('0xa')](),controller['addDisposition']);router[_0xc025('0x17')](_0xc025('0x11'),auth['isAuthenticated'](),controller[_0xc025('0x19')]);router['post'](_0xc025('0x14'),auth[_0xc025('0xa')](),controller[_0xc025('0x1a')]);router[_0xc025('0x17')](_0xc025('0x1b'),auth[_0xc025('0xa')](),controller['addAgents']);router[_0xc025('0x1c')](_0xc025('0xd'),auth[_0xc025('0xa')](),controller[_0xc025('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xc025('0xf'),auth[_0xc025('0xa')](),controller['removeDispositions']);router[_0xc025('0x1e')]('/:id/users',auth[_0xc025('0xa')](),controller[_0xc025('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 25d61dd..fe2b9c2 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 _0xaa6f=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x56898b,_0x489040){var _0xffe6ec=function(_0x2054d7){while(--_0x2054d7){_0x56898b['push'](_0x56898b['shift']());}};_0xffe6ec(++_0x489040);}(_0xaa6f,0xfc));var _0xfaa6=function(_0xb95f4a,_0x28999b){_0xb95f4a=_0xb95f4a-0x0;var _0x2b65c3=_0xaa6f[_0xb95f4a];return _0x2b65c3;};'use strict';var Sequelize=require(_0xfaa6('0x0'));module[_0xfaa6('0x1')]={'name':{'type':Sequelize[_0xfaa6('0x2')],'get':function(_0x22043c){return this[_0xfaa6('0x3')]('field');}},'field':{'type':Sequelize[_0xfaa6('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xfaa6('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8ac2=['VIRTUAL','getDataValue','field','STRING','exports'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x8ac2,0x1a8));var _0x28ac=function(_0x1746a6,_0x441a6f){_0x1746a6=_0x1746a6-0x0;var _0xa7115d=_0x8ac2[_0x1746a6];return _0xa7115d;};'use strict';var Sequelize=require('sequelize');module[_0x28ac('0x0')]={'name':{'type':Sequelize[_0x28ac('0x1')],'get':function(_0x146021){return this[_0x28ac('0x2')](_0x28ac('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x28ac('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x28ac('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 34c23ad..e43acca 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(_0x315fbb,_0x1391f2){var _0x4b415f=function(_0x344b63){while(--_0x344b63){_0x315fbb['push'](_0x315fbb['shift']());}};_0x4b415f(++_0x1391f2);}(_0x7a54,0x106));var _0x47a5=function(_0xcb1eb9,_0x303c66){_0xcb1eb9=_0xcb1eb9-0x0;var _0x41c37c=_0x7a54[_0xcb1eb9];return _0x41c37c;};'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 _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x5984b4,_0x3db51a){var _0x47a3b1=function(_0x5d4af6){while(--_0x5d4af6){_0x5984b4['push'](_0x5984b4['shift']());}};_0x47a3b1(++_0x3db51a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 25df78f..1a89835 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 _0xed9f=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','tools_conditions','lodash'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0xed9f,0x99));var _0xfed9=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0xed9f[_0x3ec333];return _0x15ccb8;};'use strict';var _=require(_0xfed9('0x0'));var util=require(_0xfed9('0x1'));var logger=require(_0xfed9('0x2'))(_0xfed9('0x3'));var moment=require(_0xfed9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfed9('0x5'));var rimraf=require(_0xfed9('0x6'));var config=require(_0xfed9('0x7'));var attributes=require('./condition.attributes');module[_0xfed9('0x8')]=function(_0x16f31e,_0x58c38c){return _0x16f31e[_0xfed9('0x9')]('Condition',attributes,{'tableName':_0xfed9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a76=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash'];(function(_0x2f490e,_0x9adb99){var _0x48d1f6=function(_0x1917db){while(--_0x1917db){_0x2f490e['push'](_0x2f490e['shift']());}};_0x48d1f6(++_0x9adb99);}(_0x1a76,0x1eb));var _0x61a7=function(_0x2d7226,_0x35edb1){_0x2d7226=_0x2d7226-0x0;var _0x59b03f=_0x1a76[_0x2d7226];return _0x59b03f;};'use strict';var _=require(_0x61a7('0x0'));var util=require(_0x61a7('0x1'));var logger=require(_0x61a7('0x2'))('api');var moment=require(_0x61a7('0x3'));var BPromise=require(_0x61a7('0x4'));var rp=require(_0x61a7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61a7('0x6'));var config=require(_0x61a7('0x7'));var attributes=require(_0x61a7('0x8'));module[_0x61a7('0x9')]=function(_0x5613d0,_0x9822e1){return _0x5613d0[_0x61a7('0xa')](_0x61a7('0xb'),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 68cedd9..ad50c7b 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 _0xfc1f=['rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x7d1b89,_0x58faa5){var _0x435a5b=function(_0x358473){while(--_0x358473){_0x7d1b89['push'](_0x7d1b89['shift']());}};_0x435a5b(++_0x58faa5);}(_0xfc1f,0xb2));var _0xffc1=function(_0x4fe17c,_0x3de842){_0x4fe17c=_0x4fe17c-0x0;var _0x14f304=_0xfc1f[_0x4fe17c];return _0x14f304;};'use strict';var _=require(_0xffc1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xffc1('0x1'));var rs=require(_0xffc1('0x2'));var fs=require('fs');var Redis=require(_0xffc1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xffc1('0x4'));var logger=require(_0xffc1('0x5'))(_0xffc1('0x6'));var config=require(_0xffc1('0x7'));var jayson=require(_0xffc1('0x8'));var client=jayson[_0xffc1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21e91d,_0x592900,_0xd6b5ba){return new BPromise(function(_0x42a34e,_0x1eeec6){return client[_0xffc1('0xa')](_0x21e91d,_0xd6b5ba)[_0xffc1('0xb')](function(_0x392a91){logger['info']('Condition,\x20%s,\x20%s',_0x592900,_0xffc1('0xc'));logger[_0xffc1('0xd')](_0xffc1('0xe'),_0x592900,_0xffc1('0xc'),JSON[_0xffc1('0xf')](_0x392a91));if(_0x392a91['error']){if(_0x392a91[_0xffc1('0x10')][_0xffc1('0x11')]===0x1f4){logger[_0xffc1('0x10')](_0xffc1('0x12'),_0x592900,_0x392a91[_0xffc1('0x10')][_0xffc1('0x13')]);return _0x1eeec6(_0x392a91[_0xffc1('0x10')]['message']);}logger['error'](_0xffc1('0x12'),_0x592900,_0x392a91[_0xffc1('0x10')]['message']);return _0x42a34e(_0x392a91[_0xffc1('0x10')][_0xffc1('0x13')]);}else{logger[_0xffc1('0x14')](_0xffc1('0x12'),_0x592900,_0xffc1('0xc'));_0x42a34e(_0x392a91[_0xffc1('0x15')][_0xffc1('0x13')]);}})[_0xffc1('0x16')](function(_0x167ed2){logger[_0xffc1('0x10')](_0xffc1('0x12'),_0x592900,_0x167ed2);_0x1eeec6(_0x167ed2);});});} \ No newline at end of file +var _0x46ab=['then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x46ab,0x1bf));var _0xb46a=function(_0x4aa052,_0x20728d){_0x4aa052=_0x4aa052-0x0;var _0x4ccaf2=_0x46ab[_0x4aa052];return _0x4ccaf2;};'use strict';var _=require(_0xb46a('0x0'));var util=require(_0xb46a('0x1'));var moment=require(_0xb46a('0x2'));var BPromise=require(_0xb46a('0x3'));var rs=require(_0xb46a('0x4'));var fs=require('fs');var Redis=require(_0xb46a('0x5'));var db=require(_0xb46a('0x6'))['db'];var utils=require(_0xb46a('0x7'));var logger=require(_0xb46a('0x8'))(_0xb46a('0x9'));var config=require(_0xb46a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb46a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3caa5c,_0x15ffb7,_0x180d99){return new BPromise(function(_0x1b4900,_0x407a5a){return client[_0xb46a('0xc')](_0x3caa5c,_0x180d99)[_0xb46a('0xd')](function(_0x46d5c4){logger[_0xb46a('0xe')](_0xb46a('0xf'),_0x15ffb7,'request\x20sent');logger[_0xb46a('0x10')](_0xb46a('0x11'),_0x15ffb7,_0xb46a('0x12'),JSON[_0xb46a('0x13')](_0x46d5c4));if(_0x46d5c4[_0xb46a('0x14')]){if(_0x46d5c4[_0xb46a('0x14')]['code']===0x1f4){logger[_0xb46a('0x14')](_0xb46a('0xf'),_0x15ffb7,_0x46d5c4['error'][_0xb46a('0x15')]);return _0x407a5a(_0x46d5c4[_0xb46a('0x14')]['message']);}logger['error'](_0xb46a('0xf'),_0x15ffb7,_0x46d5c4[_0xb46a('0x14')][_0xb46a('0x15')]);return _0x1b4900(_0x46d5c4['error'][_0xb46a('0x15')]);}else{logger['info'](_0xb46a('0xf'),_0x15ffb7,'request\x20sent');_0x1b4900(_0x46d5c4['result']['message']);}})[_0xb46a('0x16')](function(_0x19203d){logger['error']('Condition,\x20%s,\x20%s',_0x15ffb7,_0x19203d);_0x407a5a(_0x19203d);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index d612015..13479fb 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 _0x9007=['multer','util','path','express','Router','fs-extra','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x43c196,_0x24079a){var _0x1640be=function(_0x4e520e){while(--_0x4e520e){_0x43c196['push'](_0x43c196['shift']());}};_0x1640be(++_0x24079a);}(_0x9007,0x14a));var _0x7900=function(_0x3e9ef3,_0x21a7e4){_0x3e9ef3=_0x3e9ef3-0x0;var _0x333748=_0x9007[_0x3e9ef3];return _0x333748;};'use strict';var multer=require(_0x7900('0x0'));var util=require(_0x7900('0x1'));var path=require(_0x7900('0x2'));var timeout=require('connect-timeout');var express=require(_0x7900('0x3'));var router=express[_0x7900('0x4')]();var fs_extra=require(_0x7900('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7900('0x6'));var controller=require(_0x7900('0x7'));router[_0x7900('0x8')](_0x7900('0x9'),auth[_0x7900('0xa')](),controller[_0x7900('0xb')]);router[_0x7900('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x7900('0xd')]);module[_0x7900('0xe')]=router; \ No newline at end of file +var _0x04d0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','exports','multer','path'];(function(_0x5508a1,_0x4d26f5){var _0x52e452=function(_0x41dffd){while(--_0x41dffd){_0x5508a1['push'](_0x5508a1['shift']());}};_0x52e452(++_0x4d26f5);}(_0x04d0,0x12a));var _0x004d=function(_0x558979,_0x1adcf6){_0x558979=_0x558979-0x0;var _0x4d8c58=_0x04d0[_0x558979];return _0x4d8c58;};'use strict';var multer=require(_0x004d('0x0'));var util=require('util');var path=require(_0x004d('0x1'));var timeout=require(_0x004d('0x2'));var express=require(_0x004d('0x3'));var router=express[_0x004d('0x4')]();var fs_extra=require(_0x004d('0x5'));var auth=require(_0x004d('0x6'));var interaction=require(_0x004d('0x7'));var config=require(_0x004d('0x8'));var controller=require('./condition.controller');router[_0x004d('0x9')](_0x004d('0xa'),auth[_0x004d('0xb')](),controller[_0x004d('0xc')]);router[_0x004d('0xd')](_0x004d('0xa'),auth[_0x004d('0xb')](),controller['destroy']);module[_0x004d('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 52bbcf2..3302025 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03a3=['INTEGER','sequelize','exports','STRING'];(function(_0x2c3a81,_0x562263){var _0x854aad=function(_0x5e89e3){while(--_0x5e89e3){_0x2c3a81['push'](_0x2c3a81['shift']());}};_0x854aad(++_0x562263);}(_0x03a3,0x91));var _0x303a=function(_0x53615b,_0xf060d5){_0x53615b=_0x53615b-0x0;var _0x6058f=_0x03a3[_0x53615b];return _0x6058f;};'use strict';var Sequelize=require(_0x303a('0x0'));module[_0x303a('0x1')]={'name':{'type':Sequelize[_0x303a('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x303a('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x303a('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa7ab=['INTEGER','sequelize','exports','STRING'];(function(_0x286494,_0x4c3f5a){var _0x1ffe53=function(_0x52bb31){while(--_0x52bb31){_0x286494['push'](_0x286494['shift']());}};_0x1ffe53(++_0x4c3f5a);}(_0xa7ab,0x121));var _0xba7a=function(_0x2655b7,_0x96c1d){_0x2655b7=_0x2655b7-0x0;var _0x26d1ab=_0xa7ab[_0x2655b7];return _0x26d1ab;};'use strict';var Sequelize=require(_0xba7a('0x0'));module[_0xba7a('0x1')]={'name':{'type':Sequelize[_0xba7a('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xba7a('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xba7a('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 047d491..cee8995 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02ce=['role','UserProfileSection','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','then','destroy','ContactItemTypes','UserProfileResource','end','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','user','get'];(function(_0x4dfe8f,_0x15d58a){var _0x525088=function(_0x44c9a3){while(--_0x44c9a3){_0x4dfe8f['push'](_0x4dfe8f['shift']());}};_0x525088(++_0x15d58a);}(_0x02ce,0x1ac));var _0xe02c=function(_0x1f1fec,_0xb6d0de){_0x1f1fec=_0x1f1fec-0x0;var _0x1bb724=_0x02ce[_0x1f1fec];return _0x1bb724;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){var _0x60b65e=_0xf41d4c['get']({'plain':!![]});var _0xefd882=_0xe02c('0x2a');return db[_0xe02c('0x2b')][_0xe02c('0x29')]({'where':{'type':_0xefd882,'resourceId':_0x60b65e['id']}})[_0xe02c('0x28')](function(){return _0xf41d4c;});})[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)[_0xe02c('0x2c')]();});}};}function handleEntityNotFound(_0x55ef2a,_0x55e475){return function(_0x3790eb){if(!_0x3790eb){_0x55ef2a[_0xe02c('0x1c')](0x194);}return _0x3790eb;};}function handleError(_0x481e02,_0x18b572){_0x18b572=_0x18b572||0x1f4;return function(_0x2d1d98){logger[_0xe02c('0x2d')](_0x2d1d98[_0xe02c('0x2e')]);if(_0x2d1d98[_0xe02c('0x2f')]){delete _0x2d1d98[_0xe02c('0x2f')];}_0x481e02[_0xe02c('0x22')](_0x18b572)[_0xe02c('0x30')](_0x2d1d98);};}exports[_0xe02c('0x31')]=function(_0x288004,_0x17d5b3){var _0x5a2da0={},_0x3c3d2c={},_0x3c1858={'count':0x0,'rows':[]};var _0x22b783=_[_0xe02c('0x32')](db[_0xe02c('0x33')][_0xe02c('0x34')],function(_0x58bf16){return{'name':_0x58bf16[_0xe02c('0x35')],'type':_0x58bf16[_0xe02c('0x36')]['key']};});_0x3c3d2c[_0xe02c('0x37')]=_[_0xe02c('0x32')](_0x22b783,_0xe02c('0x2f'));_0x3c3d2c[_0xe02c('0x38')]=_[_0xe02c('0x39')](_0x288004['query']);_0x3c3d2c['filters']=_[_0xe02c('0x3a')](_0x3c3d2c[_0xe02c('0x37')],_0x3c3d2c['query']);_0x5a2da0[_0xe02c('0x3b')]=_['intersection'](_0x3c3d2c[_0xe02c('0x37')],qs[_0xe02c('0x3c')](_0x288004[_0xe02c('0x38')][_0xe02c('0x3c')]));_0x5a2da0[_0xe02c('0x3b')]=_0x5a2da0['attributes'][_0xe02c('0x3d')]?_0x5a2da0['attributes']:_0x3c3d2c[_0xe02c('0x37')];if(!_0x288004[_0xe02c('0x38')][_0xe02c('0x3e')](_0xe02c('0x3f'))){_0x5a2da0[_0xe02c('0x21')]=qs[_0xe02c('0x21')](_0x288004['query'][_0xe02c('0x21')]);_0x5a2da0[_0xe02c('0x1e')]=qs['offset'](_0x288004[_0xe02c('0x38')][_0xe02c('0x1e')]);}_0x5a2da0['order']=qs[_0xe02c('0x40')](_0x288004['query'][_0xe02c('0x40')]);_0x5a2da0[_0xe02c('0x41')]=qs['filters'](_[_0xe02c('0x42')](_0x288004[_0xe02c('0x38')],_0x3c3d2c[_0xe02c('0x43')]),_0x22b783);if(_0x288004[_0xe02c('0x38')][_0xe02c('0x44')]){_0x5a2da0[_0xe02c('0x41')]=_['merge'](_0x5a2da0[_0xe02c('0x41')],{'$or':_['map'](_0x22b783,function(_0x5ae8cd){if(_0x5ae8cd[_0xe02c('0x36')]!==_0xe02c('0x45')){var _0x42fbac={};_0x42fbac[_0x5ae8cd[_0xe02c('0x2f')]]={'$like':'%'+_0x288004['query'][_0xe02c('0x44')]+'%'};return _0x42fbac;}})});}_0x5a2da0=_[_0xe02c('0x46')]({},_0x5a2da0,_0x288004[_0xe02c('0x47')]);var _0x5baef6={'where':_0x5a2da0['where']};return db[_0xe02c('0x33')][_0xe02c('0x20')](_0x5baef6)[_0xe02c('0x28')](function(_0x2313d2){_0x3c1858[_0xe02c('0x20')]=_0x2313d2;if(_0x288004[_0xe02c('0x38')][_0xe02c('0x48')]){_0x5a2da0[_0xe02c('0x49')]=[{'all':!![]}];}return db[_0xe02c('0x33')]['findAll'](_0x5a2da0);})[_0xe02c('0x28')](function(_0x5ef4a1){_0x3c1858['rows']=_0x5ef4a1;return _0x3c1858;})[_0xe02c('0x28')](respondWithFilteredResult(_0x17d5b3,_0x5a2da0))[_0xe02c('0x4a')](handleError(_0x17d5b3,null));};exports[_0xe02c('0x4b')]=function(_0x1719cf,_0x24d506){var _0x12ca0e={'raw':!![],'where':{'id':_0x1719cf[_0xe02c('0x4c')]['id']}},_0x165f4a={};_0x165f4a['model']=_['keys'](db[_0xe02c('0x33')][_0xe02c('0x34')]);_0x165f4a[_0xe02c('0x38')]=_['keys'](_0x1719cf[_0xe02c('0x38')]);_0x165f4a[_0xe02c('0x43')]=_[_0xe02c('0x3a')](_0x165f4a[_0xe02c('0x37')],_0x165f4a[_0xe02c('0x38')]);_0x12ca0e[_0xe02c('0x3b')]=_[_0xe02c('0x3a')](_0x165f4a[_0xe02c('0x37')],qs[_0xe02c('0x3c')](_0x1719cf[_0xe02c('0x38')]['fields']));_0x12ca0e[_0xe02c('0x3b')]=_0x12ca0e[_0xe02c('0x3b')][_0xe02c('0x3d')]?_0x12ca0e[_0xe02c('0x3b')]:_0x165f4a[_0xe02c('0x37')];if(_0x1719cf[_0xe02c('0x38')][_0xe02c('0x48')]){_0x12ca0e[_0xe02c('0x49')]=[{'all':!![]}];}_0x12ca0e=_[_0xe02c('0x46')]({},_0x12ca0e,_0x1719cf[_0xe02c('0x47')]);return db[_0xe02c('0x33')][_0xe02c('0x4d')](_0x12ca0e)[_0xe02c('0x28')](handleEntityNotFound(_0x24d506,null))['then'](respondWithResult(_0x24d506,null))[_0xe02c('0x4a')](handleError(_0x24d506,null));};exports['create']=function(_0x15b05c,_0x324911){return db[_0xe02c('0x33')][_0xe02c('0x4e')](_0x15b05c[_0xe02c('0x4f')],{})[_0xe02c('0x28')](function(_0x160969){var _0xc2b5dd=_0x15b05c[_0xe02c('0x50')][_0xe02c('0x51')]({'plain':!![]});if(!_0xc2b5dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc2b5dd[_0xe02c('0x52')]===_0xe02c('0x50')){var _0xeb4214=_0x160969['get']({'plain':!![]});var _0xdab6cb='ContactItemTypes';return db[_0xe02c('0x53')]['find']({'where':{'name':_0xdab6cb,'userProfileId':_0xc2b5dd['userProfileId']},'raw':!![]})['then'](function(_0x55cf99){if(_0x55cf99&&_0x55cf99['autoAssociation']===0x0){return db['UserProfileResource'][_0xe02c('0x4e')]({'name':_0xeb4214[_0xe02c('0x2f')],'resourceId':_0xeb4214['id'],'type':_0x55cf99[_0xe02c('0x2f')],'sectionId':_0x55cf99['id']},{})[_0xe02c('0x28')](function(){return _0x160969;});}else{return _0x160969;}})['catch'](function(_0x274beb){logger[_0xe02c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x274beb);throw _0x274beb;});}return _0x160969;})[_0xe02c('0x28')](respondWithResult(_0x324911,0xc9))[_0xe02c('0x4a')](handleError(_0x324911,null));};exports[_0xe02c('0x27')]=function(_0x51f940,_0x57a00f){if(_0x51f940[_0xe02c('0x4f')]['id']){delete _0x51f940[_0xe02c('0x4f')]['id'];}return db[_0xe02c('0x33')]['find']({'where':{'id':_0x51f940[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57a00f,null))['then'](saveUpdates(_0x51f940[_0xe02c('0x4f')],null))[_0xe02c('0x28')](respondWithResult(_0x57a00f,null))['catch'](handleError(_0x57a00f,null));};exports[_0xe02c('0x29')]=function(_0x849eea,_0x1ead72){return db['ContactItemType'][_0xe02c('0x4d')]({'where':{'id':_0x849eea[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ead72,null))[_0xe02c('0x28')](db[_0xe02c('0x54')][_0xe02c('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x849eea[_0xe02c('0x4c')]['id']}}))[_0xe02c('0x28')](removeEntity(_0x1ead72,null))[_0xe02c('0x4a')](handleError(_0x1ead72,null));}; \ No newline at end of file +var _0x5204=['limit','count','offset','set','reject','save','update','destroy','get','ContactItemTypes','then','stack','name','send','index','ContactItemType','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','findAll','rows','catch','params','rawAttributes','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x2fef36,_0x2d9657){var _0x36cb38=function(_0xe2d130){while(--_0xe2d130){_0x2fef36['push'](_0x2fef36['shift']());}};_0x36cb38(++_0x2d9657);}(_0x5204,0xdf));var _0x4520=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x5204[_0xfd5f37];return _0x11bd01;};'use strict';var emlformat=require(_0x4520('0x0'));var rimraf=require(_0x4520('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4520('0x2'));var rp=require(_0x4520('0x3'));var moment=require(_0x4520('0x4'));var BPromise=require(_0x4520('0x5'));var Mustache=require(_0x4520('0x6'));var util=require('util');var path=require(_0x4520('0x7'));var sox=require('sox');var csv=require(_0x4520('0x8'));var ejs=require(_0x4520('0x9'));var fs=require('fs');var fs_extra=require(_0x4520('0xa'));var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x8'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var hardwareService=require(_0x4520('0x14'));var logger=require(_0x4520('0x15'))(_0x4520('0x16'));var utils=require(_0x4520('0x17'));var config=require(_0x4520('0x18'));var licenseUtil=require(_0x4520('0x19'));var db=require(_0x4520('0x1a'))['db'];function respondWithStatusCode(_0x3c7a5d,_0x508ea6){_0x508ea6=_0x508ea6||0xcc;return function(_0x2e3c64){if(_0x2e3c64){return _0x3c7a5d[_0x4520('0x1b')](_0x508ea6);}return _0x3c7a5d[_0x4520('0x1c')](_0x508ea6)[_0x4520('0x1d')]();};}function respondWithResult(_0x426836,_0x34d383){_0x34d383=_0x34d383||0xc8;return function(_0x32950a){if(_0x32950a){return _0x426836['status'](_0x34d383)[_0x4520('0x1e')](_0x32950a);}};}function respondWithFilteredResult(_0x20de6b,_0x1ab841){return function(_0x15a31f){if(_0x15a31f){var _0x32d8aa=typeof _0x1ab841['offset']===_0x4520('0x1f')&&typeof _0x1ab841[_0x4520('0x20')]===_0x4520('0x1f');var _0x283ad4=_0x15a31f[_0x4520('0x21')];var _0x2e00f4=_0x32d8aa?0x0:_0x1ab841[_0x4520('0x22')];var _0x4ba69f=_0x32d8aa?_0x15a31f[_0x4520('0x21')]:_0x1ab841[_0x4520('0x22')]+_0x1ab841[_0x4520('0x20')];var _0x460521;if(_0x4ba69f>=_0x283ad4){_0x4ba69f=_0x283ad4;_0x460521=0xc8;}else{_0x460521=0xce;}_0x20de6b['status'](_0x460521);return _0x20de6b[_0x4520('0x23')]('Content-Range',_0x2e00f4+'-'+_0x4ba69f+'/'+_0x283ad4)['json'](_0x15a31f);}return null;};}function patchUpdates(_0x4c46c5){return function(_0x2b9456){try{jsonpatch['apply'](_0x2b9456,_0x4c46c5,!![]);}catch(_0x39e196){return BPromise[_0x4520('0x24')](_0x39e196);}return _0x2b9456[_0x4520('0x25')]();};}function saveUpdates(_0x534b15,_0x3199a9){return function(_0x4000d4){if(_0x4000d4){return _0x4000d4[_0x4520('0x26')](_0x534b15)['then'](function(_0x198c34){return _0x198c34;});}return null;};}function removeEntity(_0x847d15,_0x24eacd){return function(_0x3a4680){if(_0x3a4680){return _0x3a4680[_0x4520('0x27')]()['then'](function(){var _0x3774bd=_0x3a4680[_0x4520('0x28')]({'plain':!![]});var _0x3532aa=_0x4520('0x29');return db['UserProfileResource'][_0x4520('0x27')]({'where':{'type':_0x3532aa,'resourceId':_0x3774bd['id']}})[_0x4520('0x2a')](function(){return _0x3a4680;});})[_0x4520('0x2a')](function(){_0x847d15[_0x4520('0x1c')](0xcc)[_0x4520('0x1d')]();});}};}function handleEntityNotFound(_0x2c95ea,_0x2d6902){return function(_0x195c58){if(!_0x195c58){_0x2c95ea[_0x4520('0x1b')](0x194);}return _0x195c58;};}function handleError(_0x926ca0,_0x58836d){_0x58836d=_0x58836d||0x1f4;return function(_0x222dbd){logger['error'](_0x222dbd[_0x4520('0x2b')]);if(_0x222dbd[_0x4520('0x2c')]){delete _0x222dbd[_0x4520('0x2c')];}_0x926ca0[_0x4520('0x1c')](_0x58836d)[_0x4520('0x2d')](_0x222dbd);};}exports[_0x4520('0x2e')]=function(_0x5bb163,_0x2c32ce){var _0x508c05={},_0x2585eb={},_0x4a6755={'count':0x0,'rows':[]};var _0xf6caff=_['map'](db[_0x4520('0x2f')]['rawAttributes'],function(_0x5087dc){return{'name':_0x5087dc[_0x4520('0x30')],'type':_0x5087dc[_0x4520('0x31')][_0x4520('0x32')]};});_0x2585eb['model']=_[_0x4520('0x33')](_0xf6caff,_0x4520('0x2c'));_0x2585eb[_0x4520('0x34')]=_[_0x4520('0x35')](_0x5bb163['query']);_0x2585eb['filters']=_[_0x4520('0x36')](_0x2585eb[_0x4520('0x37')],_0x2585eb['query']);_0x508c05[_0x4520('0x38')]=_[_0x4520('0x36')](_0x2585eb[_0x4520('0x37')],qs[_0x4520('0x39')](_0x5bb163[_0x4520('0x34')][_0x4520('0x39')]));_0x508c05['attributes']=_0x508c05[_0x4520('0x38')][_0x4520('0x3a')]?_0x508c05['attributes']:_0x2585eb[_0x4520('0x37')];if(!_0x5bb163['query'][_0x4520('0x3b')](_0x4520('0x3c'))){_0x508c05['limit']=qs['limit'](_0x5bb163['query'][_0x4520('0x20')]);_0x508c05[_0x4520('0x22')]=qs[_0x4520('0x22')](_0x5bb163[_0x4520('0x34')][_0x4520('0x22')]);}_0x508c05[_0x4520('0x3d')]=qs[_0x4520('0x3e')](_0x5bb163['query'][_0x4520('0x3e')]);_0x508c05[_0x4520('0x3f')]=qs[_0x4520('0x40')](_['pick'](_0x5bb163[_0x4520('0x34')],_0x2585eb[_0x4520('0x40')]),_0xf6caff);if(_0x5bb163['query']['filter']){_0x508c05[_0x4520('0x3f')]=_[_0x4520('0x41')](_0x508c05[_0x4520('0x3f')],{'$or':_[_0x4520('0x33')](_0xf6caff,function(_0x538843){if(_0x538843['type']!=='VIRTUAL'){var _0x4f5aa1={};_0x4f5aa1[_0x538843[_0x4520('0x2c')]]={'$like':'%'+_0x5bb163['query'][_0x4520('0x42')]+'%'};return _0x4f5aa1;}})});}_0x508c05=_['merge']({},_0x508c05,_0x5bb163['options']);var _0x2ff616={'where':_0x508c05[_0x4520('0x3f')]};return db[_0x4520('0x2f')][_0x4520('0x21')](_0x2ff616)[_0x4520('0x2a')](function(_0x59d646){_0x4a6755[_0x4520('0x21')]=_0x59d646;if(_0x5bb163[_0x4520('0x34')]['includeAll']){_0x508c05['include']=[{'all':!![]}];}return db[_0x4520('0x2f')][_0x4520('0x43')](_0x508c05);})['then'](function(_0x2978d5){_0x4a6755[_0x4520('0x44')]=_0x2978d5;return _0x4a6755;})[_0x4520('0x2a')](respondWithFilteredResult(_0x2c32ce,_0x508c05))[_0x4520('0x45')](handleError(_0x2c32ce,null));};exports['show']=function(_0xabacde,_0x27649a){var _0x361fb0={'raw':!![],'where':{'id':_0xabacde[_0x4520('0x46')]['id']}},_0xb92e25={};_0xb92e25[_0x4520('0x37')]=_[_0x4520('0x35')](db[_0x4520('0x2f')][_0x4520('0x47')]);_0xb92e25[_0x4520('0x34')]=_[_0x4520('0x35')](_0xabacde[_0x4520('0x34')]);_0xb92e25[_0x4520('0x40')]=_[_0x4520('0x36')](_0xb92e25[_0x4520('0x37')],_0xb92e25[_0x4520('0x34')]);_0x361fb0[_0x4520('0x38')]=_['intersection'](_0xb92e25[_0x4520('0x37')],qs[_0x4520('0x39')](_0xabacde['query']['fields']));_0x361fb0['attributes']=_0x361fb0['attributes'][_0x4520('0x3a')]?_0x361fb0['attributes']:_0xb92e25[_0x4520('0x37')];if(_0xabacde[_0x4520('0x34')][_0x4520('0x48')]){_0x361fb0[_0x4520('0x49')]=[{'all':!![]}];}_0x361fb0=_[_0x4520('0x41')]({},_0x361fb0,_0xabacde[_0x4520('0x4a')]);return db[_0x4520('0x2f')][_0x4520('0x4b')](_0x361fb0)[_0x4520('0x2a')](handleEntityNotFound(_0x27649a,null))[_0x4520('0x2a')](respondWithResult(_0x27649a,null))[_0x4520('0x45')](handleError(_0x27649a,null));};exports[_0x4520('0x4c')]=function(_0x737ba4,_0x1e4821){return db[_0x4520('0x2f')][_0x4520('0x4c')](_0x737ba4[_0x4520('0x4d')],{})[_0x4520('0x2a')](function(_0x4cf80e){var _0x53987b=_0x737ba4[_0x4520('0x4e')][_0x4520('0x28')]({'plain':!![]});if(!_0x53987b)throw new Error(_0x4520('0x4f'));if(_0x53987b['role']===_0x4520('0x4e')){var _0x2288a7=_0x4cf80e[_0x4520('0x28')]({'plain':!![]});var _0x5398c2=_0x4520('0x29');return db[_0x4520('0x50')][_0x4520('0x4b')]({'where':{'name':_0x5398c2,'userProfileId':_0x53987b['userProfileId']},'raw':!![]})['then'](function(_0x38b467){if(_0x38b467&&_0x38b467[_0x4520('0x51')]===0x0){return db[_0x4520('0x52')][_0x4520('0x4c')]({'name':_0x2288a7[_0x4520('0x2c')],'resourceId':_0x2288a7['id'],'type':_0x38b467[_0x4520('0x2c')],'sectionId':_0x38b467['id']},{})[_0x4520('0x2a')](function(){return _0x4cf80e;});}else{return _0x4cf80e;}})[_0x4520('0x45')](function(_0x4d30d3){logger[_0x4520('0x53')](_0x4520('0x54'),_0x4d30d3);throw _0x4d30d3;});}return _0x4cf80e;})[_0x4520('0x2a')](respondWithResult(_0x1e4821,0xc9))[_0x4520('0x45')](handleError(_0x1e4821,null));};exports[_0x4520('0x26')]=function(_0x253011,_0x2b09a1){if(_0x253011[_0x4520('0x4d')]['id']){delete _0x253011[_0x4520('0x4d')]['id'];}return db[_0x4520('0x2f')][_0x4520('0x4b')]({'where':{'id':_0x253011[_0x4520('0x46')]['id']}})[_0x4520('0x2a')](handleEntityNotFound(_0x2b09a1,null))[_0x4520('0x2a')](saveUpdates(_0x253011[_0x4520('0x4d')],null))[_0x4520('0x2a')](respondWithResult(_0x2b09a1,null))[_0x4520('0x45')](handleError(_0x2b09a1,null));};exports['destroy']=function(_0x52bb6c,_0x200a96){return db[_0x4520('0x2f')][_0x4520('0x4b')]({'where':{'id':_0x52bb6c[_0x4520('0x46')]['id']}})[_0x4520('0x2a')](handleEntityNotFound(_0x200a96,null))[_0x4520('0x2a')](db['CmContactHasItem'][_0x4520('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x52bb6c[_0x4520('0x46')]['id']}}))['then'](removeEntity(_0x200a96,null))[_0x4520('0x45')](handleError(_0x200a96,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 67c482a..4e2f145 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a69=['request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','bluebird'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x5a69,0x8c));var _0x95a6=function(_0x17ff07,_0x46a8c3){_0x17ff07=_0x17ff07-0x0;var _0x414a9f=_0x5a69[_0x17ff07];return _0x414a9f;};'use strict';var _=require(_0x95a6('0x0'));var util=require('util');var logger=require(_0x95a6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x95a6('0x2'));var rp=require(_0x95a6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95a6('0x4'));var config=require(_0x95a6('0x5'));var attributes=require(_0x95a6('0x6'));module[_0x95a6('0x7')]=function(_0x4a77db,_0x1d9baa){return _0x4a77db[_0x95a6('0x8')](_0x95a6('0x9'),attributes,{'tableName':_0x95a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d42=['../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xe88157,_0x965589){var _0xa9cf33=function(_0x222d32){while(--_0x222d32){_0xe88157['push'](_0xe88157['shift']());}};_0xa9cf33(++_0x965589);}(_0x8d42,0xea));var _0x28d4=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8d42[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x28d4('0x0'));var util=require('util');var logger=require(_0x28d4('0x1'))(_0x28d4('0x2'));var moment=require('moment');var BPromise=require(_0x28d4('0x3'));var rp=require(_0x28d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28d4('0x5'));var config=require(_0x28d4('0x6'));var attributes=require(_0x28d4('0x7'));module['exports']=function(_0x19698f,_0x59a8c1){return _0x19698f['define'](_0x28d4('0x8'),attributes,{'tableName':_0x28d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 8cb8cf0..5051d4b 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3a2=['ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0xd3a2,0x7c));var _0x2d3a=function(_0x320c77,_0x11fb98){_0x320c77=_0x320c77-0x0;var _0x190ff2=_0xd3a2[_0x320c77];return _0x190ff2;};'use strict';var _=require('lodash');var util=require(_0x2d3a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2d3a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d3a('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d3a('0x3'));var config=require(_0x2d3a('0x4'));var jayson=require(_0x2d3a('0x5'));var client=jayson[_0x2d3a('0x6')][_0x2d3a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48035a,_0x1d2c1c,_0x48380d){return new BPromise(function(_0x1fac6a,_0x2b8073){return client['request'](_0x48035a,_0x48380d)['then'](function(_0x564c97){logger[_0x2d3a('0x8')](_0x2d3a('0x9'),_0x1d2c1c,_0x2d3a('0xa'));logger[_0x2d3a('0xb')](_0x2d3a('0xc'),_0x1d2c1c,_0x2d3a('0xa'),JSON[_0x2d3a('0xd')](_0x564c97));if(_0x564c97[_0x2d3a('0xe')]){if(_0x564c97[_0x2d3a('0xe')][_0x2d3a('0xf')]===0x1f4){logger[_0x2d3a('0xe')](_0x2d3a('0x9'),_0x1d2c1c,_0x564c97[_0x2d3a('0xe')][_0x2d3a('0x10')]);return _0x2b8073(_0x564c97['error']['message']);}logger[_0x2d3a('0xe')](_0x2d3a('0x9'),_0x1d2c1c,_0x564c97[_0x2d3a('0xe')]['message']);return _0x1fac6a(_0x564c97['error'][_0x2d3a('0x10')]);}else{logger[_0x2d3a('0x8')](_0x2d3a('0x9'),_0x1d2c1c,_0x2d3a('0xa'));_0x1fac6a(_0x564c97[_0x2d3a('0x11')][_0x2d3a('0x10')]);}})[_0x2d3a('0x12')](function(_0x41f4d1){logger['error'](_0x2d3a('0x9'),_0x1d2c1c,_0x41f4d1);_0x2b8073(_0x41f4d1);});});} \ No newline at end of file +var _0x953e=['lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x953e,0xb4));var _0xe953=function(_0xc90147,_0x2fcb1e){_0xc90147=_0xc90147-0x0;var _0x44092f=_0x953e[_0xc90147];return _0x44092f;};'use strict';var _=require(_0xe953('0x0'));var util=require(_0xe953('0x1'));var moment=require('moment');var BPromise=require(_0xe953('0x2'));var rs=require(_0xe953('0x3'));var fs=require('fs');var Redis=require(_0xe953('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe953('0x5'))('rpc');var config=require(_0xe953('0x6'));var jayson=require(_0xe953('0x7'));var client=jayson[_0xe953('0x8')][_0xe953('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44a3fe,_0x49c4c0,_0x12fa43){return new BPromise(function(_0x4e13f0,_0x53b752){return client['request'](_0x44a3fe,_0x12fa43)['then'](function(_0x1ce6c5){logger['info'](_0xe953('0xa'),_0x49c4c0,_0xe953('0xb'));logger[_0xe953('0xc')](_0xe953('0xd'),_0x49c4c0,_0xe953('0xb'),JSON[_0xe953('0xe')](_0x1ce6c5));if(_0x1ce6c5[_0xe953('0xf')]){if(_0x1ce6c5[_0xe953('0xf')][_0xe953('0x10')]===0x1f4){logger[_0xe953('0xf')](_0xe953('0xa'),_0x49c4c0,_0x1ce6c5['error'][_0xe953('0x11')]);return _0x53b752(_0x1ce6c5[_0xe953('0xf')][_0xe953('0x11')]);}logger[_0xe953('0xf')]('ContactItemType,\x20%s,\x20%s',_0x49c4c0,_0x1ce6c5[_0xe953('0xf')][_0xe953('0x11')]);return _0x4e13f0(_0x1ce6c5['error'][_0xe953('0x11')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x49c4c0,_0xe953('0xb'));_0x4e13f0(_0x1ce6c5[_0xe953('0x12')][_0xe953('0x11')]);}})[_0xe953('0x13')](function(_0x5c4bc2){logger['error']('ContactItemType,\x20%s,\x20%s',_0x49c4c0,_0x5c4bc2);_0x53b752(_0x5c4bc2);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 9ee063d..7a662e4 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6296=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','post','isAuthenticated','put','/:id','delete','destroy','multer','util'];(function(_0xc67faa,_0x2265a2){var _0x2a306e=function(_0x31b648){while(--_0x31b648){_0xc67faa['push'](_0xc67faa['shift']());}};_0x2a306e(++_0x2265a2);}(_0x6296,0x10c));var _0x6629=function(_0xbf30a9,_0x29e850){_0xbf30a9=_0xbf30a9-0x0;var _0x15dc4e=_0x6296[_0xbf30a9];return _0x15dc4e;};'use strict';var multer=require(_0x6629('0x0'));var util=require(_0x6629('0x1'));var path=require(_0x6629('0x2'));var timeout=require('connect-timeout');var express=require(_0x6629('0x3'));var router=express[_0x6629('0x4')]();var fs_extra=require(_0x6629('0x5'));var auth=require(_0x6629('0x6'));var interaction=require(_0x6629('0x7'));var config=require(_0x6629('0x8'));var controller=require(_0x6629('0x9'));router[_0x6629('0xa')]('/',auth['isAuthenticated'](),controller[_0x6629('0xb')]);router[_0x6629('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6629('0xc')]('/',auth[_0x6629('0xd')](),controller['create']);router[_0x6629('0xe')](_0x6629('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x6629('0x10')](_0x6629('0xf'),auth[_0x6629('0xd')](),controller[_0x6629('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8eec=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','create','update','destroy'];(function(_0x1afc71,_0x78a48a){var _0xe27060=function(_0x1eedb4){while(--_0x1eedb4){_0x1afc71['push'](_0x1afc71['shift']());}};_0xe27060(++_0x78a48a);}(_0x8eec,0xac));var _0xc8ee=function(_0x304070,_0x245ea5){_0x304070=_0x304070-0x0;var _0xc793a7=_0x8eec[_0x304070];return _0xc793a7;};'use strict';var multer=require(_0xc8ee('0x0'));var util=require(_0xc8ee('0x1'));var path=require(_0xc8ee('0x2'));var timeout=require(_0xc8ee('0x3'));var express=require(_0xc8ee('0x4'));var router=express[_0xc8ee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8ee('0x6'));var interaction=require(_0xc8ee('0x7'));var config=require(_0xc8ee('0x8'));var controller=require(_0xc8ee('0x9'));router[_0xc8ee('0xa')]('/',auth[_0xc8ee('0xb')](),controller[_0xc8ee('0xc')]);router['get'](_0xc8ee('0xd'),auth[_0xc8ee('0xb')](),controller[_0xc8ee('0xe')]);router['post']('/',auth[_0xc8ee('0xb')](),controller[_0xc8ee('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc8ee('0x10')]);router['delete'](_0xc8ee('0xd'),auth[_0xc8ee('0xb')](),controller[_0xc8ee('0x11')]);module[_0xc8ee('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9272159..93f2394 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x1135c0,_0x1fcc56){var _0x24fb1a=function(_0x1c020c){while(--_0x1c020c){_0x1135c0['push'](_0x1135c0['shift']());}};_0x24fb1a(++_0x1fcc56);}(_0x757a,0xde));var _0xa757=function(_0x100970,_0x1727dd){_0x100970=_0x100970-0x0;var _0x3ff8a5=_0x757a[_0x100970];return _0x3ff8a5;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x432ef6,_0x377165){var _0x3089e7=function(_0x4bd431){while(--_0x4bd431){_0x432ef6['push'](_0x432ef6['shift']());}};_0x3089e7(++_0x377165);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index ed2e967..b343ddb 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 _0x8d4d=['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','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','get','CustomDashboards','UserProfileResource','end','error','name','index','map','Dashboard','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','omit','createdAt','updatedAt','body','user','destroy','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','attrFaxAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xaabde0,_0xe37c00){var _0x321a26=function(_0x50dd46){while(--_0x50dd46){_0xaabde0['push'](_0xaabde0['shift']());}};_0x321a26(++_0xe37c00);}(_0x8d4d,0x100));var _0xd8d4=function(_0x49af23,_0x37a69f){_0x49af23=_0x49af23-0x0;var _0x3f2489=_0x8d4d[_0x49af23];return _0x3f2489;};'use strict';var emlformat=require(_0xd8d4('0x0'));var rimraf=require(_0xd8d4('0x1'));var zipdir=require(_0xd8d4('0x2'));var jsonpatch=require(_0xd8d4('0x3'));var rp=require(_0xd8d4('0x4'));var moment=require(_0xd8d4('0x5'));var BPromise=require(_0xd8d4('0x6'));var Mustache=require(_0xd8d4('0x7'));var util=require(_0xd8d4('0x8'));var path=require(_0xd8d4('0x9'));var sox=require(_0xd8d4('0xa'));var csv=require(_0xd8d4('0xb'));var ejs=require(_0xd8d4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd8d4('0xd'));var squel=require(_0xd8d4('0xe'));var crypto=require(_0xd8d4('0xf'));var jsforce=require(_0xd8d4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd8d4('0xb'));var querystring=require(_0xd8d4('0x11'));var Papa=require(_0xd8d4('0x12'));var Redis=require(_0xd8d4('0x13'));var authService=require(_0xd8d4('0x14'));var qs=require(_0xd8d4('0x15'));var as=require(_0xd8d4('0x16'));var hardwareService=require(_0xd8d4('0x17'));var logger=require(_0xd8d4('0x18'))(_0xd8d4('0x19'));var utils=require(_0xd8d4('0x1a'));var config=require(_0xd8d4('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8d4('0x1c'))['db'];config[_0xd8d4('0x1d')]=_[_0xd8d4('0x1e')](config['redis'],{'host':_0xd8d4('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8d4('0x1d')]));require(_0xd8d4('0x20'))['register'](socket);function respondWithStatusCode(_0xcf7b6e,_0x18c18b){_0x18c18b=_0x18c18b||0xcc;return function(_0x187e3a){if(_0x187e3a){return _0xcf7b6e[_0xd8d4('0x21')](_0x18c18b);}return _0xcf7b6e[_0xd8d4('0x22')](_0x18c18b)['end']();};}function respondWithResult(_0xb20469,_0x1aed4a){_0x1aed4a=_0x1aed4a||0xc8;return function(_0x4da63f){if(_0x4da63f){return _0xb20469['status'](_0x1aed4a)[_0xd8d4('0x23')](_0x4da63f);}};}function respondWithFilteredResult(_0x48b450,_0x5d264f){return function(_0x484c2e){if(_0x484c2e){var _0x5b761b=typeof _0x5d264f['offset']===_0xd8d4('0x24')&&typeof _0x5d264f[_0xd8d4('0x25')]===_0xd8d4('0x24');var _0x319a49=_0x484c2e['count'];var _0x2aa8ee=_0x5b761b?0x0:_0x5d264f[_0xd8d4('0x26')];var _0x242ceb=_0x5b761b?_0x484c2e[_0xd8d4('0x27')]:_0x5d264f[_0xd8d4('0x26')]+_0x5d264f[_0xd8d4('0x25')];var _0x38a7f7;if(_0x242ceb>=_0x319a49){_0x242ceb=_0x319a49;_0x38a7f7=0xc8;}else{_0x38a7f7=0xce;}_0x48b450[_0xd8d4('0x22')](_0x38a7f7);return _0x48b450[_0xd8d4('0x28')](_0xd8d4('0x29'),_0x2aa8ee+'-'+_0x242ceb+'/'+_0x319a49)[_0xd8d4('0x23')](_0x484c2e);}return null;};}function patchUpdates(_0x26cca2){return function(_0x4fcd4e){try{jsonpatch['apply'](_0x4fcd4e,_0x26cca2,!![]);}catch(_0x5340b1){return BPromise[_0xd8d4('0x2a')](_0x5340b1);}return _0x4fcd4e[_0xd8d4('0x2b')]();};}function saveUpdates(_0x49efc7,_0x226a46){return function(_0x2f8554){if(_0x2f8554){return _0x2f8554[_0xd8d4('0x2c')](_0x49efc7)[_0xd8d4('0x2d')](function(_0x4ac22b){return _0x4ac22b;});}return null;};}function removeEntity(_0xe6a3eb,_0x1db8a7){return function(_0x3f1435){if(_0x3f1435){return _0x3f1435['destroy']()[_0xd8d4('0x2d')](function(){var _0x3cd517=_0x3f1435[_0xd8d4('0x2e')]({'plain':!![]});var _0xd12b53=_0xd8d4('0x2f');return db[_0xd8d4('0x30')]['destroy']({'where':{'type':_0xd12b53,'resourceId':_0x3cd517['id']}})[_0xd8d4('0x2d')](function(){return _0x3f1435;});})[_0xd8d4('0x2d')](function(){_0xe6a3eb[_0xd8d4('0x22')](0xcc)[_0xd8d4('0x31')]();});}};}function handleEntityNotFound(_0x33799b,_0x2811d4){return function(_0x1bd5b3){if(!_0x1bd5b3){_0x33799b['sendStatus'](0x194);}return _0x1bd5b3;};}function handleError(_0x408ec3,_0x4de24c){_0x4de24c=_0x4de24c||0x1f4;return function(_0x1ca018){logger[_0xd8d4('0x32')](_0x1ca018['stack']);if(_0x1ca018[_0xd8d4('0x33')]){delete _0x1ca018[_0xd8d4('0x33')];}_0x408ec3[_0xd8d4('0x22')](_0x4de24c)['send'](_0x1ca018);};}exports[_0xd8d4('0x34')]=function(_0x55e877,_0x194f3a){var _0x4aa217={},_0x329b4f={},_0x430c2c={'count':0x0,'rows':[]};var _0x273f14=_[_0xd8d4('0x35')](db[_0xd8d4('0x36')][_0xd8d4('0x37')],function(_0x52a583){return{'name':_0x52a583[_0xd8d4('0x38')],'type':_0x52a583[_0xd8d4('0x39')]['key']};});_0x329b4f['model']=_[_0xd8d4('0x35')](_0x273f14,_0xd8d4('0x33'));_0x329b4f[_0xd8d4('0x3a')]=_['keys'](_0x55e877[_0xd8d4('0x3a')]);_0x329b4f[_0xd8d4('0x3b')]=_['intersection'](_0x329b4f['model'],_0x329b4f[_0xd8d4('0x3a')]);_0x4aa217['attributes']=_[_0xd8d4('0x3c')](_0x329b4f[_0xd8d4('0x3d')],qs['fields'](_0x55e877['query'][_0xd8d4('0x3e')]));_0x4aa217[_0xd8d4('0x3f')]=_0x4aa217['attributes']['length']?_0x4aa217[_0xd8d4('0x3f')]:_0x329b4f['model'];if(!_0x55e877['query']['hasOwnProperty']('nolimit')){_0x4aa217[_0xd8d4('0x25')]=qs[_0xd8d4('0x25')](_0x55e877[_0xd8d4('0x3a')][_0xd8d4('0x25')]);_0x4aa217['offset']=qs['offset'](_0x55e877[_0xd8d4('0x3a')][_0xd8d4('0x26')]);}_0x4aa217[_0xd8d4('0x40')]=qs['sort'](_0x55e877[_0xd8d4('0x3a')][_0xd8d4('0x41')]);_0x4aa217[_0xd8d4('0x42')]=qs[_0xd8d4('0x3b')](_['pick'](_0x55e877[_0xd8d4('0x3a')],_0x329b4f[_0xd8d4('0x3b')]),_0x273f14);if(_0x55e877[_0xd8d4('0x3a')]['filter']){_0x4aa217[_0xd8d4('0x42')]=_[_0xd8d4('0x43')](_0x4aa217[_0xd8d4('0x42')],{'$or':_[_0xd8d4('0x35')](_0x273f14,function(_0x581ce4){if(_0x581ce4[_0xd8d4('0x39')]!=='VIRTUAL'){var _0xf43a9c={};_0xf43a9c[_0x581ce4['name']]={'$like':'%'+_0x55e877['query'][_0xd8d4('0x44')]+'%'};return _0xf43a9c;}})});}_0x4aa217=_[_0xd8d4('0x43')]({},_0x4aa217,_0x55e877[_0xd8d4('0x45')]);var _0x288dc2={'where':_0x4aa217[_0xd8d4('0x42')]};return db['Dashboard'][_0xd8d4('0x27')](_0x288dc2)[_0xd8d4('0x2d')](function(_0x504b94){_0x430c2c[_0xd8d4('0x27')]=_0x504b94;if(_0x55e877[_0xd8d4('0x3a')][_0xd8d4('0x46')]){_0x4aa217[_0xd8d4('0x47')]=[{'all':!![]}];}return db[_0xd8d4('0x36')][_0xd8d4('0x48')](_0x4aa217);})[_0xd8d4('0x2d')](function(_0x2ac974){_0x430c2c[_0xd8d4('0x49')]=_0x2ac974;return _0x430c2c;})['then'](respondWithFilteredResult(_0x194f3a,_0x4aa217))[_0xd8d4('0x4a')](handleError(_0x194f3a,null));};exports[_0xd8d4('0x4b')]=function(_0x441ea0,_0x4023fa){var _0x2649f8={'raw':![],'where':{'id':_0x441ea0[_0xd8d4('0x4c')]['id']}},_0x3c11c2={};_0x3c11c2[_0xd8d4('0x3d')]=_['keys'](db[_0xd8d4('0x36')][_0xd8d4('0x37')]);_0x3c11c2[_0xd8d4('0x3a')]=_[_0xd8d4('0x4d')](_0x441ea0[_0xd8d4('0x3a')]);_0x3c11c2[_0xd8d4('0x3b')]=_[_0xd8d4('0x3c')](_0x3c11c2[_0xd8d4('0x3d')],_0x3c11c2[_0xd8d4('0x3a')]);_0x2649f8[_0xd8d4('0x3f')]=_['intersection'](_0x3c11c2[_0xd8d4('0x3d')],qs[_0xd8d4('0x3e')](_0x441ea0[_0xd8d4('0x3a')]['fields']));_0x2649f8[_0xd8d4('0x3f')]=_0x2649f8['attributes']['length']?_0x2649f8[_0xd8d4('0x3f')]:_0x3c11c2['model'];if(_0x441ea0['query'][_0xd8d4('0x46')]){_0x2649f8['include']=[{'all':!![]}];}_0x2649f8=_[_0xd8d4('0x43')]({},_0x2649f8,_0x441ea0[_0xd8d4('0x45')]);return db[_0xd8d4('0x36')][_0xd8d4('0x4e')](_0x2649f8)[_0xd8d4('0x2d')](handleEntityNotFound(_0x4023fa,null))[_0xd8d4('0x2d')](respondWithResult(_0x4023fa,null))[_0xd8d4('0x4a')](handleError(_0x4023fa,null));};exports[_0xd8d4('0x4f')]=function(_0x3217fe,_0x100ddf){return db['Dashboard'][_0xd8d4('0x4f')](_0x3217fe['body'],{})[_0xd8d4('0x2d')](function(_0x1d6768){var _0x11d0e1=_0x3217fe['user'][_0xd8d4('0x2e')]({'plain':!![]});if(!_0x11d0e1)throw new Error(_0xd8d4('0x50'));if(_0x11d0e1[_0xd8d4('0x51')]==='user'){var _0x548057=_0x1d6768[_0xd8d4('0x2e')]({'plain':!![]});var _0x51b2fc=_0xd8d4('0x2f');return db[_0xd8d4('0x52')][_0xd8d4('0x4e')]({'where':{'name':_0x51b2fc,'userProfileId':_0x11d0e1[_0xd8d4('0x53')]},'raw':!![]})[_0xd8d4('0x2d')](function(_0x554666){if(_0x554666&&_0x554666[_0xd8d4('0x54')]===0x0){return db[_0xd8d4('0x30')][_0xd8d4('0x4f')]({'name':_0x548057[_0xd8d4('0x33')],'resourceId':_0x548057['id'],'type':_0x554666['name'],'sectionId':_0x554666['id']},{})['then'](function(){return _0x1d6768;});}else{return _0x1d6768;}})[_0xd8d4('0x4a')](function(_0xf51c3b){logger[_0xd8d4('0x32')](_0xd8d4('0x55'),_0xf51c3b);throw _0xf51c3b;});}return _0x1d6768;})[_0xd8d4('0x2d')](respondWithResult(_0x100ddf,0xc9))[_0xd8d4('0x4a')](handleError(_0x100ddf,null));};exports['clone']=function(_0x3245ba,_0x1f57e1){var _0x43fe9c={'where':{'id':_0x3245ba[_0xd8d4('0x4c')]['id']}},_0x493993={};_0x493993[_0xd8d4('0x3d')]=_[_0xd8d4('0x4d')](db[_0xd8d4('0x36')][_0xd8d4('0x37')]);_0x43fe9c[_0xd8d4('0x3f')]=_[_0xd8d4('0x3c')](_0x493993[_0xd8d4('0x3d')],qs['fields'](_0x3245ba['query']['fields']));_0x43fe9c[_0xd8d4('0x3f')]=_0x43fe9c[_0xd8d4('0x3f')][_0xd8d4('0x56')]?_0x43fe9c['attributes']:_0x493993[_0xd8d4('0x3d')];if(_0x3245ba[_0xd8d4('0x3a')]['includeAll']){_0x43fe9c[_0xd8d4('0x47')]=[{'all':!![]}];}_0x43fe9c=_[_0xd8d4('0x43')]({},_0x43fe9c,_0x3245ba['options']);return db[_0xd8d4('0x36')]['find'](_0x43fe9c)['then'](handleEntityNotFound(_0x1f57e1,null))[_0xd8d4('0x2d')](function(_0x460724){if(_0x460724){var _0x115493=_0x460724[_0xd8d4('0x2e')]({'plain':!![]});_0x115493=qs[_0xd8d4('0x57')](_0x115493,['id',_0xd8d4('0x58'),_0xd8d4('0x59')]);_0x3245ba[_0xd8d4('0x5a')]=_[_0xd8d4('0x57')](_0x3245ba['body'],['id','createdAt',_0xd8d4('0x59')]);return db[_0xd8d4('0x36')][_0xd8d4('0x4f')](_['merge'](_0x115493,_0x3245ba['body']),{'include':_0x3245ba[_0xd8d4('0x3a')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x230991){var _0x1a3ada=_0x3245ba[_0xd8d4('0x5b')][_0xd8d4('0x2e')]({'plain':!![]});if(!_0x1a3ada)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a3ada[_0xd8d4('0x51')]===_0xd8d4('0x5b')){var _0xc2a45a=_0x230991[_0xd8d4('0x2e')]({'plain':!![]});var _0x460b72=_0xd8d4('0x2f');return db['UserProfileSection'][_0xd8d4('0x4e')]({'where':{'name':_0x460b72,'userProfileId':_0x1a3ada[_0xd8d4('0x53')]},'raw':!![]})['then'](function(_0x403c65){if(_0x403c65&&_0x403c65[_0xd8d4('0x54')]===0x0){return db[_0xd8d4('0x30')][_0xd8d4('0x4f')]({'name':_0xc2a45a[_0xd8d4('0x33')],'resourceId':_0xc2a45a['id'],'type':_0x403c65[_0xd8d4('0x33')],'sectionId':_0x403c65['id']},{})[_0xd8d4('0x2d')](function(){return _0x230991;});}else{return _0x230991;}})[_0xd8d4('0x4a')](function(_0x36a221){logger[_0xd8d4('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36a221);throw _0x36a221;});}return _0x230991;});}})[_0xd8d4('0x2d')](respondWithResult(_0x1f57e1,0xc9))[_0xd8d4('0x4a')](handleError(_0x1f57e1,null));};exports[_0xd8d4('0x2c')]=function(_0x21a5d6,_0x1ba274){if(_0x21a5d6[_0xd8d4('0x5a')]['id']){delete _0x21a5d6[_0xd8d4('0x5a')]['id'];}return db[_0xd8d4('0x36')][_0xd8d4('0x4e')]({'where':{'id':_0x21a5d6[_0xd8d4('0x4c')]['id']}})[_0xd8d4('0x2d')](handleEntityNotFound(_0x1ba274,null))[_0xd8d4('0x2d')](saveUpdates(_0x21a5d6[_0xd8d4('0x5a')],null))[_0xd8d4('0x2d')](respondWithResult(_0x1ba274,null))[_0xd8d4('0x4a')](handleError(_0x1ba274,null));};exports[_0xd8d4('0x5c')]=function(_0x579759,_0x55d14b){return db[_0xd8d4('0x36')][_0xd8d4('0x4e')]({'where':{'id':_0x579759[_0xd8d4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x55d14b,null))[_0xd8d4('0x2d')](removeEntity(_0x55d14b,null))['catch'](handleError(_0x55d14b,null));};function widgetAttributes(_0x36d89c){try{switch(_0x36d89c[_0xd8d4('0x39')]){case'iframe':return[{'name':_0xd8d4('0x5d'),'value':_0x36d89c['attrUrl']||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c['attrs'][0x0]?_0x36d89c[_0xd8d4('0x5e')][0x0][_0xd8d4('0x5f')]:undefined)||_0xd8d4('0x60')}];case'custom':return[{'name':_0xd8d4('0x61'),'value':_0x36d89c[_0xd8d4('0x61')]||(_0x36d89c['attrs']&&_0x36d89c['attrs'][0x0]?_0x36d89c[_0xd8d4('0x5e')][0x0][_0xd8d4('0x5f')]:undefined)||''}];case _0xd8d4('0x62'):return[{'name':_0xd8d4('0x63'),'value':_0x36d89c['attrHourFormat']||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c['attrs'][0x0]?_0x36d89c[_0xd8d4('0x5e')][0x0][_0xd8d4('0x5f')]:undefined)||_0xd8d4('0x64')},{'name':_0xd8d4('0x65'),'value':_0x36d89c[_0xd8d4('0x65')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x1]?_0x36d89c['attrs'][0x1][_0xd8d4('0x5f')]:undefined)||_0xd8d4('0x66')},{'name':_0xd8d4('0x67'),'value':_0x36d89c[_0xd8d4('0x67')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x2]?_0x36d89c[_0xd8d4('0x5e')][0x2][_0xd8d4('0x5f')]:undefined)||0xc}];case _0xd8d4('0x68'):return[{'name':_0xd8d4('0x69'),'value':_0x36d89c[_0xd8d4('0x69')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c['attrs'][0x0]?_0x36d89c[_0xd8d4('0x5e')][0x0][_0xd8d4('0x5f')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x36d89c['attrVoiceQueues']||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c['attrs'][0x1]?_0x36d89c['attrs'][0x1]['value']:undefined)||[]},{'name':_0xd8d4('0x67'),'value':_0x36d89c[_0xd8d4('0x67')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x2]?_0x36d89c['attrs'][0x2]['value']:undefined)||0x14},{'name':_0xd8d4('0x6a'),'value':_0x36d89c[_0xd8d4('0x6a')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x3]?_0x36d89c[_0xd8d4('0x5e')][0x3][_0xd8d4('0x5f')]:undefined)||_0xd8d4('0x6b')},{'name':'attrEmailAccounts','value':_0x36d89c[_0xd8d4('0x6c')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x4]?_0x36d89c[_0xd8d4('0x5e')][0x4][_0xd8d4('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x36d89c['attrFaxAccounts']||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c['attrs'][0x5]?_0x36d89c[_0xd8d4('0x5e')][0x5][_0xd8d4('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x36d89c[_0xd8d4('0x6d')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x6]?_0x36d89c[_0xd8d4('0x5e')][0x6][_0xd8d4('0x5f')]:undefined)||''},{'name':_0xd8d4('0x6e'),'value':_0x36d89c[_0xd8d4('0x6e')]||(_0x36d89c['attrs']&&_0x36d89c[_0xd8d4('0x5e')][0x7]?_0x36d89c[_0xd8d4('0x5e')][0x7][_0xd8d4('0x5f')]:undefined)||''},{'name':_0xd8d4('0x6f'),'value':_0x36d89c['attrWhatsappAccounts']||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x8]?_0x36d89c[_0xd8d4('0x5e')][0x8]['value']:undefined)||''},{'name':_0xd8d4('0x70'),'value':_0x36d89c[_0xd8d4('0x70')]||(_0x36d89c['attrs']&&_0x36d89c[_0xd8d4('0x5e')][0x9]?_0x36d89c[_0xd8d4('0x5e')][0x9][_0xd8d4('0x5f')]:undefined)||''}];case _0xd8d4('0x71'):case'pie-chart':return[{'name':_0xd8d4('0x72'),'value':_0x36d89c[_0xd8d4('0x72')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x0]?_0x36d89c[_0xd8d4('0x5e')][0x0]['value']:undefined)||_0xd8d4('0x73')},{'name':_0xd8d4('0x74'),'value':_0x36d89c[_0xd8d4('0x74')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x1]?_0x36d89c['attrs'][0x1]['value']:undefined)||null},{'name':_0xd8d4('0x75'),'value':_0x36d89c[_0xd8d4('0x75')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x2]?_0x36d89c[_0xd8d4('0x5e')][0x2][_0xd8d4('0x5f')]:undefined)||null},{'name':_0xd8d4('0x76'),'value':_0x36d89c[_0xd8d4('0x76')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x3]?_0x36d89c[_0xd8d4('0x5e')][0x3][_0xd8d4('0x5f')]:undefined)||[]},{'name':_0xd8d4('0x6a'),'value':_0x36d89c[_0xd8d4('0x6a')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x4]?_0x36d89c['attrs'][0x4][_0xd8d4('0x5f')]:undefined)||'voice'},{'name':_0xd8d4('0x6c'),'value':_0x36d89c[_0xd8d4('0x6c')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x5]?_0x36d89c[_0xd8d4('0x5e')][0x5][_0xd8d4('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x36d89c[_0xd8d4('0x77')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x6]?_0x36d89c['attrs'][0x6][_0xd8d4('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x36d89c[_0xd8d4('0x6d')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x7]?_0x36d89c[_0xd8d4('0x5e')][0x7][_0xd8d4('0x5f')]:undefined)||''},{'name':_0xd8d4('0x6e'),'value':_0x36d89c[_0xd8d4('0x6e')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c['attrs'][0x8]?_0x36d89c[_0xd8d4('0x5e')][0x8][_0xd8d4('0x5f')]:undefined)||''},{'name':_0xd8d4('0x6f'),'value':_0x36d89c[_0xd8d4('0x6f')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x9]?_0x36d89c[_0xd8d4('0x5e')][0x9][_0xd8d4('0x5f')]:undefined)||''},{'name':_0xd8d4('0x70'),'value':_0x36d89c[_0xd8d4('0x70')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0xa]?_0x36d89c['attrs'][0xa][_0xd8d4('0x5f')]:undefined)||''}];case _0xd8d4('0x78'):return[{'name':_0xd8d4('0x79'),'type':_0x36d89c[_0xd8d4('0x7a')]||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c['attrs'][0x0]?_0x36d89c[_0xd8d4('0x5e')][0x0][_0xd8d4('0x39')]:undefined)||null,'value':_0x36d89c[_0xd8d4('0x79')]||(_0x36d89c['attrs']&&_0x36d89c[_0xd8d4('0x5e')][0x0]?_0x36d89c[_0xd8d4('0x5e')][0x0][_0xd8d4('0x5f')]:undefined)||null},{'name':_0xd8d4('0x7b'),'value':_0x36d89c['attrRefresh']||(_0x36d89c[_0xd8d4('0x5e')]&&_0x36d89c[_0xd8d4('0x5e')][0x1]?_0x36d89c[_0xd8d4('0x5e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x56f6cb){logger[_0xd8d4('0x32')](_0xd8d4('0x7c'),JSON[_0xd8d4('0x7d')](_0x56f6cb));return[];}}exports[_0xd8d4('0x7e')]=function(_0x2b548e,_0x5539fc,_0x4231ee){if(_0x2b548e['body']['id']){delete _0x2b548e[_0xd8d4('0x5a')]['id'];}return db[_0xd8d4('0x36')]['find']({'where':{'id':_0x2b548e[_0xd8d4('0x4c')]['id']}})[_0xd8d4('0x2d')](handleEntityNotFound(_0x5539fc,null))[_0xd8d4('0x2d')](function(_0x2d9a15){if(_0x2d9a15){_0x2b548e['body'][_0xd8d4('0x7f')]=_0x2d9a15['id'];_0x2b548e[_0xd8d4('0x5a')]['attrs']=widgetAttributes(_0x2b548e[_0xd8d4('0x5a')]);return db[_0xd8d4('0x80')][_0xd8d4('0x4f')](_0x2b548e[_0xd8d4('0x5a')]);}})[_0xd8d4('0x2d')](respondWithResult(_0x5539fc,null))['catch'](handleError(_0x5539fc,null));};exports['getItems']=function(_0x9e43ca,_0x1525bc,_0x5a98eb){var _0x431a15={};var _0x741917={};var _0x499be1;var _0x37251c;return db[_0xd8d4('0x36')][_0xd8d4('0x81')]({'where':{'id':_0x9e43ca['params']['id']}})[_0xd8d4('0x2d')](handleEntityNotFound(_0x1525bc,null))[_0xd8d4('0x2d')](function(_0x2c7482){if(_0x2c7482){_0x499be1=_0x2c7482;_0x741917[_0xd8d4('0x3d')]=_[_0xd8d4('0x4d')](db[_0xd8d4('0x80')][_0xd8d4('0x37')]);_0x741917['query']=_[_0xd8d4('0x4d')](_0x9e43ca[_0xd8d4('0x3a')]);_0x741917[_0xd8d4('0x3b')]=_[_0xd8d4('0x3c')](_0x741917['model'],_0x741917[_0xd8d4('0x3a')]);_0x431a15[_0xd8d4('0x3f')]=_[_0xd8d4('0x3c')](_0x741917['model'],qs[_0xd8d4('0x3e')](_0x9e43ca[_0xd8d4('0x3a')][_0xd8d4('0x3e')]));_0x431a15[_0xd8d4('0x3f')]=_0x431a15[_0xd8d4('0x3f')]['length']?_0x431a15[_0xd8d4('0x3f')]:_0x741917[_0xd8d4('0x3d')];_0x431a15[_0xd8d4('0x40')]=qs[_0xd8d4('0x41')](_0x9e43ca[_0xd8d4('0x3a')]['sort']);_0x431a15[_0xd8d4('0x42')]=qs['filters'](_['pick'](_0x9e43ca[_0xd8d4('0x3a')],_0x741917[_0xd8d4('0x3b')]));if(_0x9e43ca[_0xd8d4('0x3a')][_0xd8d4('0x44')]){_0x431a15[_0xd8d4('0x42')]=_[_0xd8d4('0x43')](_0x431a15[_0xd8d4('0x42')],{'$or':_[_0xd8d4('0x35')](_0x431a15[_0xd8d4('0x3f')],function(_0x453a24){var _0x28072f={};_0x28072f[_0x453a24]={'$like':'%'+_0x9e43ca[_0xd8d4('0x3a')]['filter']+'%'};return _0x28072f;})});}_0x431a15=_[_0xd8d4('0x43')]({},_0x431a15,_0x9e43ca['options']);return _0x499be1[_0xd8d4('0x82')](_0x431a15);}})[_0xd8d4('0x2d')](function(_0x2eece2){if(_0x2eece2){_0x37251c=_0x2eece2[_0xd8d4('0x56')];if(!_0x9e43ca[_0xd8d4('0x3a')]['hasOwnProperty'](_0xd8d4('0x83'))){_0x431a15['limit']=qs[_0xd8d4('0x25')](_0x9e43ca[_0xd8d4('0x3a')]['limit']);_0x431a15['offset']=qs[_0xd8d4('0x26')](_0x9e43ca[_0xd8d4('0x3a')][_0xd8d4('0x26')]);}return _0x499be1[_0xd8d4('0x82')](_0x431a15);}})[_0xd8d4('0x2d')](function(_0x5943cd){if(_0x5943cd){return _0x5943cd?{'count':_0x37251c,'rows':_0x5943cd}:null;}})[_0xd8d4('0x2d')](respondWithResult(_0x1525bc,null))[_0xd8d4('0x4a')](handleError(_0x1525bc,null));}; \ No newline at end of file +var _0x55df=['where','VIRTUAL','options','rows','catch','show','rawAttributes','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','omit','createdAt','updatedAt','update','params','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','nolimit','eml-format','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./dashboard.socket','sendStatus','status','json','offset','limit','count','set','apply','reject','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0x55df,0xbe));var _0xf55d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x55df[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0xf55d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf55d('0x1'));var moment=require(_0xf55d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf55d('0x3'));var util=require(_0xf55d('0x4'));var path=require('path');var sox=require(_0xf55d('0x5'));var csv=require(_0xf55d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf55d('0x7'));var _=require(_0xf55d('0x8'));var squel=require('squel');var crypto=require(_0xf55d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf55d('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf55d('0xb'));var Redis=require(_0xf55d('0xc'));var authService=require(_0xf55d('0xd'));var qs=require(_0xf55d('0xe'));var as=require(_0xf55d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf55d('0x10'))(_0xf55d('0x11'));var utils=require(_0xf55d('0x12'));var config=require(_0xf55d('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf55d('0x14')]=_[_0xf55d('0x15')](config['redis'],{'host':_0xf55d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf55d('0x14')]));require(_0xf55d('0x17'))['register'](socket);function respondWithStatusCode(_0x550920,_0x267b7e){_0x267b7e=_0x267b7e||0xcc;return function(_0x214c54){if(_0x214c54){return _0x550920[_0xf55d('0x18')](_0x267b7e);}return _0x550920[_0xf55d('0x19')](_0x267b7e)['end']();};}function respondWithResult(_0x57e76c,_0x228e34){_0x228e34=_0x228e34||0xc8;return function(_0x58e2f3){if(_0x58e2f3){return _0x57e76c[_0xf55d('0x19')](_0x228e34)[_0xf55d('0x1a')](_0x58e2f3);}};}function respondWithFilteredResult(_0x1496a8,_0x1406a6){return function(_0x3addfd){if(_0x3addfd){var _0x1b8d16=typeof _0x1406a6[_0xf55d('0x1b')]==='undefined'&&typeof _0x1406a6[_0xf55d('0x1c')]==='undefined';var _0x384cbe=_0x3addfd[_0xf55d('0x1d')];var _0x2df598=_0x1b8d16?0x0:_0x1406a6[_0xf55d('0x1b')];var _0x371560=_0x1b8d16?_0x3addfd[_0xf55d('0x1d')]:_0x1406a6[_0xf55d('0x1b')]+_0x1406a6[_0xf55d('0x1c')];var _0x302666;if(_0x371560>=_0x384cbe){_0x371560=_0x384cbe;_0x302666=0xc8;}else{_0x302666=0xce;}_0x1496a8[_0xf55d('0x19')](_0x302666);return _0x1496a8[_0xf55d('0x1e')]('Content-Range',_0x2df598+'-'+_0x371560+'/'+_0x384cbe)[_0xf55d('0x1a')](_0x3addfd);}return null;};}function patchUpdates(_0x5e09c3){return function(_0x50c928){try{jsonpatch[_0xf55d('0x1f')](_0x50c928,_0x5e09c3,!![]);}catch(_0x1fbc84){return BPromise[_0xf55d('0x20')](_0x1fbc84);}return _0x50c928['save']();};}function saveUpdates(_0x45e5a3,_0x56396c){return function(_0x51d7a1){if(_0x51d7a1){return _0x51d7a1['update'](_0x45e5a3)[_0xf55d('0x21')](function(_0x64d9c3){return _0x64d9c3;});}return null;};}function removeEntity(_0x282de5,_0x2fe29f){return function(_0x3dc2e4){if(_0x3dc2e4){return _0x3dc2e4[_0xf55d('0x22')]()[_0xf55d('0x21')](function(){var _0x6c2b1c=_0x3dc2e4[_0xf55d('0x23')]({'plain':!![]});var _0xd528a6=_0xf55d('0x24');return db[_0xf55d('0x25')]['destroy']({'where':{'type':_0xd528a6,'resourceId':_0x6c2b1c['id']}})['then'](function(){return _0x3dc2e4;});})[_0xf55d('0x21')](function(){_0x282de5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c18e0,_0x5216bd){return function(_0x1ee367){if(!_0x1ee367){_0x3c18e0[_0xf55d('0x18')](0x194);}return _0x1ee367;};}function handleError(_0x55a3bd,_0x501ccb){_0x501ccb=_0x501ccb||0x1f4;return function(_0x35093c){logger[_0xf55d('0x26')](_0x35093c[_0xf55d('0x27')]);if(_0x35093c[_0xf55d('0x28')]){delete _0x35093c[_0xf55d('0x28')];}_0x55a3bd[_0xf55d('0x19')](_0x501ccb)[_0xf55d('0x29')](_0x35093c);};}exports[_0xf55d('0x2a')]=function(_0x5378ad,_0x30a49b){var _0x39202d={},_0x2fb53d={},_0x104869={'count':0x0,'rows':[]};var _0xb15c7a=_['map'](db[_0xf55d('0x2b')]['rawAttributes'],function(_0x38ebfd){return{'name':_0x38ebfd[_0xf55d('0x2c')],'type':_0x38ebfd[_0xf55d('0x2d')][_0xf55d('0x2e')]};});_0x2fb53d['model']=_[_0xf55d('0x2f')](_0xb15c7a,_0xf55d('0x28'));_0x2fb53d[_0xf55d('0x30')]=_[_0xf55d('0x31')](_0x5378ad[_0xf55d('0x30')]);_0x2fb53d[_0xf55d('0x32')]=_[_0xf55d('0x33')](_0x2fb53d[_0xf55d('0x34')],_0x2fb53d[_0xf55d('0x30')]);_0x39202d[_0xf55d('0x35')]=_[_0xf55d('0x33')](_0x2fb53d[_0xf55d('0x34')],qs[_0xf55d('0x36')](_0x5378ad[_0xf55d('0x30')][_0xf55d('0x36')]));_0x39202d[_0xf55d('0x35')]=_0x39202d[_0xf55d('0x35')][_0xf55d('0x37')]?_0x39202d[_0xf55d('0x35')]:_0x2fb53d['model'];if(!_0x5378ad['query'][_0xf55d('0x38')]('nolimit')){_0x39202d[_0xf55d('0x1c')]=qs[_0xf55d('0x1c')](_0x5378ad['query'][_0xf55d('0x1c')]);_0x39202d[_0xf55d('0x1b')]=qs[_0xf55d('0x1b')](_0x5378ad[_0xf55d('0x30')][_0xf55d('0x1b')]);}_0x39202d[_0xf55d('0x39')]=qs[_0xf55d('0x3a')](_0x5378ad[_0xf55d('0x30')][_0xf55d('0x3a')]);_0x39202d['where']=qs[_0xf55d('0x32')](_[_0xf55d('0x3b')](_0x5378ad[_0xf55d('0x30')],_0x2fb53d['filters']),_0xb15c7a);if(_0x5378ad['query'][_0xf55d('0x3c')]){_0x39202d['where']=_[_0xf55d('0x3d')](_0x39202d[_0xf55d('0x3e')],{'$or':_[_0xf55d('0x2f')](_0xb15c7a,function(_0x2d8895){if(_0x2d8895[_0xf55d('0x2d')]!==_0xf55d('0x3f')){var _0x338493={};_0x338493[_0x2d8895[_0xf55d('0x28')]]={'$like':'%'+_0x5378ad[_0xf55d('0x30')][_0xf55d('0x3c')]+'%'};return _0x338493;}})});}_0x39202d=_[_0xf55d('0x3d')]({},_0x39202d,_0x5378ad[_0xf55d('0x40')]);var _0x5edb09={'where':_0x39202d[_0xf55d('0x3e')]};return db[_0xf55d('0x2b')][_0xf55d('0x1d')](_0x5edb09)['then'](function(_0x461615){_0x104869['count']=_0x461615;if(_0x5378ad[_0xf55d('0x30')]['includeAll']){_0x39202d['include']=[{'all':!![]}];}return db[_0xf55d('0x2b')]['findAll'](_0x39202d);})[_0xf55d('0x21')](function(_0x331edb){_0x104869[_0xf55d('0x41')]=_0x331edb;return _0x104869;})[_0xf55d('0x21')](respondWithFilteredResult(_0x30a49b,_0x39202d))[_0xf55d('0x42')](handleError(_0x30a49b,null));};exports[_0xf55d('0x43')]=function(_0x5b3887,_0x1d8d27){var _0x26c277={'raw':![],'where':{'id':_0x5b3887['params']['id']}},_0x5e0d59={};_0x5e0d59[_0xf55d('0x34')]=_[_0xf55d('0x31')](db[_0xf55d('0x2b')][_0xf55d('0x44')]);_0x5e0d59['query']=_['keys'](_0x5b3887['query']);_0x5e0d59[_0xf55d('0x32')]=_[_0xf55d('0x33')](_0x5e0d59[_0xf55d('0x34')],_0x5e0d59[_0xf55d('0x30')]);_0x26c277[_0xf55d('0x35')]=_[_0xf55d('0x33')](_0x5e0d59[_0xf55d('0x34')],qs[_0xf55d('0x36')](_0x5b3887[_0xf55d('0x30')][_0xf55d('0x36')]));_0x26c277['attributes']=_0x26c277[_0xf55d('0x35')][_0xf55d('0x37')]?_0x26c277['attributes']:_0x5e0d59[_0xf55d('0x34')];if(_0x5b3887[_0xf55d('0x30')][_0xf55d('0x45')]){_0x26c277[_0xf55d('0x46')]=[{'all':!![]}];}_0x26c277=_[_0xf55d('0x3d')]({},_0x26c277,_0x5b3887['options']);return db[_0xf55d('0x2b')]['find'](_0x26c277)[_0xf55d('0x21')](handleEntityNotFound(_0x1d8d27,null))['then'](respondWithResult(_0x1d8d27,null))[_0xf55d('0x42')](handleError(_0x1d8d27,null));};exports[_0xf55d('0x47')]=function(_0x4ff3b8,_0x7326fa){return db[_0xf55d('0x2b')][_0xf55d('0x47')](_0x4ff3b8[_0xf55d('0x48')],{})[_0xf55d('0x21')](function(_0x239af7){var _0x33a50a=_0x4ff3b8[_0xf55d('0x49')][_0xf55d('0x23')]({'plain':!![]});if(!_0x33a50a)throw new Error(_0xf55d('0x4a'));if(_0x33a50a[_0xf55d('0x4b')]===_0xf55d('0x49')){var _0x17a9c4=_0x239af7[_0xf55d('0x23')]({'plain':!![]});var _0x3abd04=_0xf55d('0x24');return db[_0xf55d('0x4c')]['find']({'where':{'name':_0x3abd04,'userProfileId':_0x33a50a[_0xf55d('0x4d')]},'raw':!![]})[_0xf55d('0x21')](function(_0x2d4634){if(_0x2d4634&&_0x2d4634[_0xf55d('0x4e')]===0x0){return db[_0xf55d('0x25')][_0xf55d('0x47')]({'name':_0x17a9c4[_0xf55d('0x28')],'resourceId':_0x17a9c4['id'],'type':_0x2d4634[_0xf55d('0x28')],'sectionId':_0x2d4634['id']},{})[_0xf55d('0x21')](function(){return _0x239af7;});}else{return _0x239af7;}})['catch'](function(_0x2d2c59){logger[_0xf55d('0x26')](_0xf55d('0x4f'),_0x2d2c59);throw _0x2d2c59;});}return _0x239af7;})['then'](respondWithResult(_0x7326fa,0xc9))['catch'](handleError(_0x7326fa,null));};exports['clone']=function(_0x2fd485,_0x3b53e3){var _0x90de68={'where':{'id':_0x2fd485['params']['id']}},_0x4fbb50={};_0x4fbb50[_0xf55d('0x34')]=_[_0xf55d('0x31')](db[_0xf55d('0x2b')]['rawAttributes']);_0x90de68[_0xf55d('0x35')]=_[_0xf55d('0x33')](_0x4fbb50[_0xf55d('0x34')],qs['fields'](_0x2fd485[_0xf55d('0x30')][_0xf55d('0x36')]));_0x90de68[_0xf55d('0x35')]=_0x90de68[_0xf55d('0x35')][_0xf55d('0x37')]?_0x90de68[_0xf55d('0x35')]:_0x4fbb50[_0xf55d('0x34')];if(_0x2fd485[_0xf55d('0x30')][_0xf55d('0x45')]){_0x90de68['include']=[{'all':!![]}];}_0x90de68=_[_0xf55d('0x3d')]({},_0x90de68,_0x2fd485[_0xf55d('0x40')]);return db[_0xf55d('0x2b')][_0xf55d('0x50')](_0x90de68)[_0xf55d('0x21')](handleEntityNotFound(_0x3b53e3,null))[_0xf55d('0x21')](function(_0x1d296e){if(_0x1d296e){var _0x36f2fd=_0x1d296e['get']({'plain':!![]});_0x36f2fd=qs[_0xf55d('0x51')](_0x36f2fd,['id',_0xf55d('0x52'),'updatedAt']);_0x2fd485[_0xf55d('0x48')]=_['omit'](_0x2fd485['body'],['id',_0xf55d('0x52'),_0xf55d('0x53')]);return db['Dashboard'][_0xf55d('0x47')](_['merge'](_0x36f2fd,_0x2fd485[_0xf55d('0x48')]),{'include':_0x2fd485[_0xf55d('0x30')][_0xf55d('0x45')]?[{'all':!![]}]:undefined})[_0xf55d('0x21')](function(_0x37d95c){var _0x1a350b=_0x2fd485[_0xf55d('0x49')][_0xf55d('0x23')]({'plain':!![]});if(!_0x1a350b)throw new Error(_0xf55d('0x4a'));if(_0x1a350b['role']===_0xf55d('0x49')){var _0xf0a4cf=_0x37d95c[_0xf55d('0x23')]({'plain':!![]});var _0xa7c6a4=_0xf55d('0x24');return db['UserProfileSection']['find']({'where':{'name':_0xa7c6a4,'userProfileId':_0x1a350b[_0xf55d('0x4d')]},'raw':!![]})[_0xf55d('0x21')](function(_0x274284){if(_0x274284&&_0x274284[_0xf55d('0x4e')]===0x0){return db['UserProfileResource'][_0xf55d('0x47')]({'name':_0xf0a4cf[_0xf55d('0x28')],'resourceId':_0xf0a4cf['id'],'type':_0x274284[_0xf55d('0x28')],'sectionId':_0x274284['id']},{})[_0xf55d('0x21')](function(){return _0x37d95c;});}else{return _0x37d95c;}})[_0xf55d('0x42')](function(_0x311f8c){logger[_0xf55d('0x26')](_0xf55d('0x4f'),_0x311f8c);throw _0x311f8c;});}return _0x37d95c;});}})['then'](respondWithResult(_0x3b53e3,0xc9))['catch'](handleError(_0x3b53e3,null));};exports[_0xf55d('0x54')]=function(_0x3c4d3a,_0x4772b4){if(_0x3c4d3a[_0xf55d('0x48')]['id']){delete _0x3c4d3a[_0xf55d('0x48')]['id'];}return db['Dashboard'][_0xf55d('0x50')]({'where':{'id':_0x3c4d3a['params']['id']}})['then'](handleEntityNotFound(_0x4772b4,null))[_0xf55d('0x21')](saveUpdates(_0x3c4d3a[_0xf55d('0x48')],null))['then'](respondWithResult(_0x4772b4,null))[_0xf55d('0x42')](handleError(_0x4772b4,null));};exports[_0xf55d('0x22')]=function(_0xea5991,_0x273591){return db[_0xf55d('0x2b')][_0xf55d('0x50')]({'where':{'id':_0xea5991[_0xf55d('0x55')]['id']}})[_0xf55d('0x21')](handleEntityNotFound(_0x273591,null))[_0xf55d('0x21')](removeEntity(_0x273591,null))['catch'](handleError(_0x273591,null));};function widgetAttributes(_0x402463){try{switch(_0x402463[_0xf55d('0x2d')]){case _0xf55d('0x56'):return[{'name':'attrUrl','value':_0x402463[_0xf55d('0x57')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463['attrs'][0x0][_0xf55d('0x59')]:undefined)||_0xf55d('0x5a')}];case _0xf55d('0x5b'):return[{'name':_0xf55d('0x5c'),'value':_0x402463[_0xf55d('0x5c')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0]['value']:undefined)||''}];case _0xf55d('0x5d'):return[{'name':'attrHourFormat','value':_0x402463[_0xf55d('0x5e')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0]['value']:undefined)||_0xf55d('0x5f')},{'name':_0xf55d('0x60'),'value':_0x402463['attrTimezone']||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x1]?_0x402463[_0xf55d('0x58')][0x1]['value']:undefined)||_0xf55d('0x61')},{'name':'attrFontSize','value':_0x402463[_0xf55d('0x62')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x2]?_0x402463[_0xf55d('0x58')][0x2][_0xf55d('0x59')]:undefined)||0xc}];case _0xf55d('0x63'):return[{'name':_0xf55d('0x64'),'value':_0x402463[_0xf55d('0x64')]||(_0x402463[_0xf55d('0x58')]&&_0x402463['attrs'][0x0]?_0x402463['attrs'][0x0][_0xf55d('0x59')]:undefined)||_0xf55d('0x65')},{'name':'attrVoiceQueues','value':_0x402463[_0xf55d('0x66')]||(_0x402463['attrs']&&_0x402463['attrs'][0x1]?_0x402463[_0xf55d('0x58')][0x1][_0xf55d('0x59')]:undefined)||[]},{'name':_0xf55d('0x62'),'value':_0x402463[_0xf55d('0x62')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x2]?_0x402463[_0xf55d('0x58')][0x2][_0xf55d('0x59')]:undefined)||0x14},{'name':_0xf55d('0x67'),'value':_0x402463[_0xf55d('0x67')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x3]?_0x402463[_0xf55d('0x58')][0x3][_0xf55d('0x59')]:undefined)||_0xf55d('0x68')},{'name':'attrEmailAccounts','value':_0x402463[_0xf55d('0x69')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x4]?_0x402463['attrs'][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x402463[_0xf55d('0x6a')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x5]?_0x402463['attrs'][0x5][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6b'),'value':_0x402463[_0xf55d('0x6b')]||(_0x402463[_0xf55d('0x58')]&&_0x402463['attrs'][0x6]?_0x402463['attrs'][0x6][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6c'),'value':_0x402463['attrOpenchannelAccounts']||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x7]?_0x402463[_0xf55d('0x58')][0x7][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6d'),'value':_0x402463[_0xf55d('0x6d')]||(_0x402463[_0xf55d('0x58')]&&_0x402463['attrs'][0x8]?_0x402463[_0xf55d('0x58')][0x8][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6e'),'value':_0x402463[_0xf55d('0x6e')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x9]?_0x402463[_0xf55d('0x58')][0x9][_0xf55d('0x59')]:undefined)||''}];case _0xf55d('0x6f'):case _0xf55d('0x70'):return[{'name':_0xf55d('0x71'),'value':_0x402463[_0xf55d('0x71')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0][_0xf55d('0x59')]:undefined)||_0xf55d('0x65')},{'name':_0xf55d('0x72'),'value':_0x402463['attrSerie2']||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x1]?_0x402463[_0xf55d('0x58')][0x1][_0xf55d('0x59')]:undefined)||null},{'name':_0xf55d('0x73'),'value':_0x402463[_0xf55d('0x73')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x2]?_0x402463['attrs'][0x2][_0xf55d('0x59')]:undefined)||null},{'name':_0xf55d('0x66'),'value':_0x402463[_0xf55d('0x66')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x3]?_0x402463[_0xf55d('0x58')][0x3][_0xf55d('0x59')]:undefined)||[]},{'name':_0xf55d('0x67'),'value':_0x402463[_0xf55d('0x67')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x4]?_0x402463['attrs'][0x4][_0xf55d('0x59')]:undefined)||_0xf55d('0x68')},{'name':'attrEmailAccounts','value':_0x402463[_0xf55d('0x69')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x5]?_0x402463[_0xf55d('0x58')][0x5][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6a'),'value':_0x402463[_0xf55d('0x6a')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x6]?_0x402463['attrs'][0x6]['value']:undefined)||''},{'name':_0xf55d('0x6b'),'value':_0x402463[_0xf55d('0x6b')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x7]?_0x402463[_0xf55d('0x58')][0x7]['value']:undefined)||''},{'name':_0xf55d('0x6c'),'value':_0x402463[_0xf55d('0x6c')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x8]?_0x402463[_0xf55d('0x58')][0x8][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6d'),'value':_0x402463[_0xf55d('0x6d')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x9]?_0x402463[_0xf55d('0x58')][0x9][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6e'),'value':_0x402463[_0xf55d('0x6e')]||(_0x402463[_0xf55d('0x58')]&&_0x402463['attrs'][0xa]?_0x402463[_0xf55d('0x58')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x402463[_0xf55d('0x74')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0]['type']:undefined)||null,'value':_0x402463[_0xf55d('0x75')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0][_0xf55d('0x59')]:undefined)||null},{'name':_0xf55d('0x76'),'value':_0x402463['attrRefresh']||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x1]?_0x402463[_0xf55d('0x58')][0x1][_0xf55d('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x32b865){logger['error'](_0xf55d('0x77'),JSON[_0xf55d('0x78')](_0x32b865));return[];}}exports[_0xf55d('0x79')]=function(_0x223816,_0xb40457,_0x424f00){if(_0x223816['body']['id']){delete _0x223816[_0xf55d('0x48')]['id'];}return db[_0xf55d('0x2b')][_0xf55d('0x50')]({'where':{'id':_0x223816[_0xf55d('0x55')]['id']}})[_0xf55d('0x21')](handleEntityNotFound(_0xb40457,null))['then'](function(_0x4571d6){if(_0x4571d6){_0x223816['body'][_0xf55d('0x7a')]=_0x4571d6['id'];_0x223816[_0xf55d('0x48')][_0xf55d('0x58')]=widgetAttributes(_0x223816[_0xf55d('0x48')]);return db[_0xf55d('0x7b')][_0xf55d('0x47')](_0x223816[_0xf55d('0x48')]);}})[_0xf55d('0x21')](respondWithResult(_0xb40457,null))[_0xf55d('0x42')](handleError(_0xb40457,null));};exports[_0xf55d('0x7c')]=function(_0x518763,_0x4af63d,_0x55a6e3){var _0x5746a6={};var _0x53a5e5={};var _0x7df61e;var _0x47418f;return db[_0xf55d('0x2b')]['findOne']({'where':{'id':_0x518763[_0xf55d('0x55')]['id']}})[_0xf55d('0x21')](handleEntityNotFound(_0x4af63d,null))[_0xf55d('0x21')](function(_0x4e3457){if(_0x4e3457){_0x7df61e=_0x4e3457;_0x53a5e5[_0xf55d('0x34')]=_[_0xf55d('0x31')](db[_0xf55d('0x7b')][_0xf55d('0x44')]);_0x53a5e5[_0xf55d('0x30')]=_['keys'](_0x518763[_0xf55d('0x30')]);_0x53a5e5[_0xf55d('0x32')]=_[_0xf55d('0x33')](_0x53a5e5[_0xf55d('0x34')],_0x53a5e5['query']);_0x5746a6[_0xf55d('0x35')]=_[_0xf55d('0x33')](_0x53a5e5['model'],qs[_0xf55d('0x36')](_0x518763['query']['fields']));_0x5746a6[_0xf55d('0x35')]=_0x5746a6[_0xf55d('0x35')]['length']?_0x5746a6[_0xf55d('0x35')]:_0x53a5e5[_0xf55d('0x34')];_0x5746a6[_0xf55d('0x39')]=qs[_0xf55d('0x3a')](_0x518763[_0xf55d('0x30')][_0xf55d('0x3a')]);_0x5746a6[_0xf55d('0x3e')]=qs['filters'](_[_0xf55d('0x3b')](_0x518763[_0xf55d('0x30')],_0x53a5e5[_0xf55d('0x32')]));if(_0x518763[_0xf55d('0x30')][_0xf55d('0x3c')]){_0x5746a6[_0xf55d('0x3e')]=_[_0xf55d('0x3d')](_0x5746a6['where'],{'$or':_[_0xf55d('0x2f')](_0x5746a6[_0xf55d('0x35')],function(_0x51a03b){var _0xea6752={};_0xea6752[_0x51a03b]={'$like':'%'+_0x518763[_0xf55d('0x30')][_0xf55d('0x3c')]+'%'};return _0xea6752;})});}_0x5746a6=_[_0xf55d('0x3d')]({},_0x5746a6,_0x518763[_0xf55d('0x40')]);return _0x7df61e['getItems'](_0x5746a6);}})[_0xf55d('0x21')](function(_0xe67dfe){if(_0xe67dfe){_0x47418f=_0xe67dfe[_0xf55d('0x37')];if(!_0x518763[_0xf55d('0x30')][_0xf55d('0x38')](_0xf55d('0x7d'))){_0x5746a6[_0xf55d('0x1c')]=qs['limit'](_0x518763[_0xf55d('0x30')][_0xf55d('0x1c')]);_0x5746a6[_0xf55d('0x1b')]=qs[_0xf55d('0x1b')](_0x518763[_0xf55d('0x30')][_0xf55d('0x1b')]);}return _0x7df61e[_0xf55d('0x7c')](_0x5746a6);}})[_0xf55d('0x21')](function(_0x1403b3){if(_0x1403b3){return _0x1403b3?{'count':_0x47418f,'rows':_0x1403b3}:null;}})[_0xf55d('0x21')](respondWithResult(_0x4af63d,null))[_0xf55d('0x42')](handleError(_0x4af63d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 57f3ca9..49b2531 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 _0x188f=['hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x6222aa,_0x201283){var _0xb22b95=function(_0x36fb0b){while(--_0x36fb0b){_0x6222aa['push'](_0x6222aa['shift']());}};_0xb22b95(++_0x201283);}(_0x188f,0x1a5));var _0xf188=function(_0x536c4e,_0x100c4c){_0x536c4e=_0x536c4e-0x0;var _0x3b1117=_0x188f[_0x536c4e];return _0x3b1117;};'use strict';var EventEmitter=require(_0xf188('0x0'));var Dashboard=require(_0xf188('0x1'))['db'][_0xf188('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf188('0x3')](0x0);var events={'afterCreate':_0xf188('0x4'),'afterUpdate':_0xf188('0x5'),'afterDestroy':_0xf188('0x6')};function emitEvent(_0x554df6){return function(_0x5637c6,_0x204680,_0x52b670){DashboardEvents['emit'](_0x554df6+':'+_0x5637c6['id'],_0x5637c6);DashboardEvents[_0xf188('0x7')](_0x554df6,_0x5637c6);_0x52b670(null);};}for(var e in events){if(events[_0xf188('0x8')](e)){var event=events[e];Dashboard[_0xf188('0x9')](e,emitEvent(event));}}module[_0xf188('0xa')]=DashboardEvents; \ No newline at end of file +var _0x0810=['update','remove','emit','hasOwnProperty','hook','exports','Dashboard','save'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x0810,0x1e6));var _0x0081=function(_0x4dc863,_0x1afea8){_0x4dc863=_0x4dc863-0x0;var _0x3fc45e=_0x0810[_0x4dc863];return _0x3fc45e;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x0081('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0081('0x1'),'afterUpdate':_0x0081('0x2'),'afterDestroy':_0x0081('0x3')};function emitEvent(_0x5018a7){return function(_0x3ca3cc,_0xd62f7c,_0x1c34db){DashboardEvents[_0x0081('0x4')](_0x5018a7+':'+_0x3ca3cc['id'],_0x3ca3cc);DashboardEvents[_0x0081('0x4')](_0x5018a7,_0x3ca3cc);_0x1c34db(null);};}for(var e in events){if(events[_0x0081('0x5')](e)){var event=events[e];Dashboard[_0x0081('0x6')](e,emitEvent(event));}}module[_0x0081('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 153b745..6e9bb35 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 _0xb84e=['Dashboard','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x4636d2,_0x2d3ed5){var _0x1de008=function(_0x1ffe55){while(--_0x1ffe55){_0x4636d2['push'](_0x4636d2['shift']());}};_0x1de008(++_0x2d3ed5);}(_0xb84e,0xbf));var _0xeb84=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xb84e[_0x111e94];return _0x3de107;};'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':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2d8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util'];(function(_0x6171c0,_0x127af3){var _0x227390=function(_0x2813af){while(--_0x2813af){_0x6171c0['push'](_0x6171c0['shift']());}};_0x227390(++_0x127af3);}(_0xb2d8,0x80));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8b2d('0x0'));var util=require(_0x8b2d('0x1'));var logger=require('../../config/logger')(_0x8b2d('0x2'));var moment=require(_0x8b2d('0x3'));var BPromise=require(_0x8b2d('0x4'));var rp=require(_0x8b2d('0x5'));var fs=require('fs');var path=require(_0x8b2d('0x6'));var rimraf=require(_0x8b2d('0x7'));var config=require(_0x8b2d('0x8'));var attributes=require(_0x8b2d('0x9'));module[_0x8b2d('0xa')]=function(_0x21ca38,_0x1559a3){return _0x21ca38[_0x8b2d('0xb')](_0x8b2d('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 4292497..e2f2038 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 _0x41a7=['socket.io-emitter','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x41a7,0xb0));var _0x741a=function(_0x45e87e,_0x283ffd){_0x45e87e=_0x45e87e-0x0;var _0x21fccf=_0x41a7[_0x45e87e];return _0x21fccf;};'use strict';var _=require(_0x741a('0x0'));var util=require('util');var moment=require(_0x741a('0x1'));var BPromise=require(_0x741a('0x2'));var rs=require(_0x741a('0x3'));var fs=require('fs');var Redis=require(_0x741a('0x4'));var db=require(_0x741a('0x5'))['db'];var utils=require(_0x741a('0x6'));var logger=require(_0x741a('0x7'))(_0x741a('0x8'));var config=require('../../config/environment');var jayson=require(_0x741a('0x9'));var client=jayson[_0x741a('0xa')][_0x741a('0xb')]({'port':0x232a});config[_0x741a('0xc')]=_['defaults'](config[_0x741a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x741a('0xd'))(new Redis(config['redis']));require('./dashboard.socket')[_0x741a('0xe')](socket);function respondWithRpcPromise(_0x4c964c,_0x4cc2d1,_0x376cad){return new BPromise(function(_0x227a4b,_0x466f19){return client[_0x741a('0xf')](_0x4c964c,_0x376cad)['then'](function(_0x3be0f4){logger[_0x741a('0x10')](_0x741a('0x11'),_0x4cc2d1,_0x741a('0x12'));logger[_0x741a('0x13')](_0x741a('0x14'),_0x4cc2d1,_0x741a('0x12'),JSON[_0x741a('0x15')](_0x3be0f4));if(_0x3be0f4['error']){if(_0x3be0f4[_0x741a('0x16')][_0x741a('0x17')]===0x1f4){logger[_0x741a('0x16')](_0x741a('0x11'),_0x4cc2d1,_0x3be0f4['error']['message']);return _0x466f19(_0x3be0f4[_0x741a('0x16')][_0x741a('0x18')]);}logger[_0x741a('0x16')]('Dashboard,\x20%s,\x20%s',_0x4cc2d1,_0x3be0f4[_0x741a('0x16')]['message']);return _0x227a4b(_0x3be0f4[_0x741a('0x16')][_0x741a('0x18')]);}else{logger[_0x741a('0x10')]('Dashboard,\x20%s,\x20%s',_0x4cc2d1,_0x741a('0x12'));_0x227a4b(_0x3be0f4[_0x741a('0x19')][_0x741a('0x18')]);}})[_0x741a('0x1a')](function(_0x4abcba){logger[_0x741a('0x16')](_0x741a('0x11'),_0x4cc2d1,_0x4abcba);_0x466f19(_0x4abcba);});});} \ No newline at end of file +var _0x80d1=['defaults','localhost','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x80d1,0x17a));var _0x180d=function(_0x2a1295,_0x1bf359){_0x2a1295=_0x2a1295-0x0;var _0x5a7b08=_0x80d1[_0x2a1295];return _0x5a7b08;};'use strict';var _=require('lodash');var util=require(_0x180d('0x0'));var moment=require(_0x180d('0x1'));var BPromise=require(_0x180d('0x2'));var rs=require(_0x180d('0x3'));var fs=require('fs');var Redis=require(_0x180d('0x4'));var db=require(_0x180d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x180d('0x6'))(_0x180d('0x7'));var config=require(_0x180d('0x8'));var jayson=require(_0x180d('0x9'));var client=jayson[_0x180d('0xa')]['http']({'port':0x232a});config[_0x180d('0xb')]=_[_0x180d('0xc')](config['redis'],{'host':_0x180d('0xd'),'port':0x18eb});var socket=require(_0x180d('0xe'))(new Redis(config[_0x180d('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x4565fd,_0x330623,_0x4d3fa4){return new BPromise(function(_0x4256d4,_0x116e5d){return client[_0x180d('0xf')](_0x4565fd,_0x4d3fa4)[_0x180d('0x10')](function(_0x159b87){logger[_0x180d('0x11')](_0x180d('0x12'),_0x330623,_0x180d('0x13'));logger['debug'](_0x180d('0x14'),_0x330623,_0x180d('0x13'),JSON[_0x180d('0x15')](_0x159b87));if(_0x159b87['error']){if(_0x159b87[_0x180d('0x16')][_0x180d('0x17')]===0x1f4){logger[_0x180d('0x16')](_0x180d('0x12'),_0x330623,_0x159b87[_0x180d('0x16')][_0x180d('0x18')]);return _0x116e5d(_0x159b87[_0x180d('0x16')][_0x180d('0x18')]);}logger[_0x180d('0x16')](_0x180d('0x12'),_0x330623,_0x159b87['error'][_0x180d('0x18')]);return _0x4256d4(_0x159b87[_0x180d('0x16')][_0x180d('0x18')]);}else{logger[_0x180d('0x11')]('Dashboard,\x20%s,\x20%s',_0x330623,_0x180d('0x13'));_0x4256d4(_0x159b87['result'][_0x180d('0x18')]);}})[_0x180d('0x19')](function(_0x119b1a){logger['error']('Dashboard,\x20%s,\x20%s',_0x330623,_0x119b1a);_0x116e5d(_0x119b1a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 9909e75..1730ec5 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 _0xbe94=['register','./dashboard.events','save','remove'];(function(_0x388e36,_0x323b8c){var _0xf8f3c1=function(_0x137260){while(--_0x137260){_0x388e36['push'](_0x388e36['shift']());}};_0xf8f3c1(++_0x323b8c);}(_0xbe94,0x155));var _0x4be9=function(_0x63e59d,_0x1696a7){_0x63e59d=_0x63e59d-0x0;var _0x5f4893=_0xbe94[_0x63e59d];return _0x5f4893;};'use strict';var DashboardEvents=require(_0x4be9('0x0'));var events=[_0x4be9('0x1'),_0x4be9('0x2'),'update'];function createListener(_0x107211,_0x5aded8){return function(_0x38c549){_0x5aded8['emit'](_0x107211,_0x38c549);};}function removeListener(_0x36f31e,_0x3fa66a){return function(){DashboardEvents['removeListener'](_0x36f31e,_0x3fa66a);};}exports[_0x4be9('0x3')]=function(_0x2011e2){for(var _0x6c6944=0x0,_0x3806d4=events['length'];_0x6c6944<_0x3806d4;_0x6c6944++){var _0x243240=events[_0x6c6944];var _0x4d5a56=createListener('dashboard:'+_0x243240,_0x2011e2);DashboardEvents['on'](_0x243240,_0x4d5a56);}}; \ No newline at end of file +var _0x1875=['remove','update','emit','register','length','dashboard:','./dashboard.events','save'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x1875,0x196));var _0x5187=function(_0x22d648,_0x256241){_0x22d648=_0x22d648-0x0;var _0xe8359d=_0x1875[_0x22d648];return _0xe8359d;};'use strict';var DashboardEvents=require(_0x5187('0x0'));var events=[_0x5187('0x1'),_0x5187('0x2'),_0x5187('0x3')];function createListener(_0x4678e2,_0x176c25){return function(_0x481444){_0x176c25[_0x5187('0x4')](_0x4678e2,_0x481444);};}function removeListener(_0xb36e8e,_0x3926f9){return function(){DashboardEvents['removeListener'](_0xb36e8e,_0x3926f9);};}exports[_0x5187('0x5')]=function(_0x5d9f8d){for(var _0x247267=0x0,_0x39ed56=events[_0x5187('0x6')];_0x247267<_0x39ed56;_0x247267++){var _0x1c2ef9=events[_0x247267];var _0x598550=createListener(_0x5187('0x7')+_0x1c2ef9,_0x5d9f8d);DashboardEvents['on'](_0x1c2ef9,_0x598550);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2a81b5d..02d311f 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 _0x4d9f=['create','/:id/clone','clone','addItem','/:id','update','util','path','connect-timeout','express','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','show','getItems','post'];(function(_0x36dc5d,_0x5828f8){var _0x5b9fcd=function(_0x472f59){while(--_0x472f59){_0x36dc5d['push'](_0x36dc5d['shift']());}};_0x5b9fcd(++_0x5828f8);}(_0x4d9f,0x8e));var _0xf4d9=function(_0x54a006,_0x247502){_0x54a006=_0x54a006-0x0;var _0x10897f=_0x4d9f[_0x54a006];return _0x10897f;};'use strict';var multer=require('multer');var util=require(_0xf4d9('0x0'));var path=require(_0xf4d9('0x1'));var timeout=require(_0xf4d9('0x2'));var express=require(_0xf4d9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf4d9('0x4'));var config=require('../../config/environment');var controller=require(_0xf4d9('0x5'));router[_0xf4d9('0x6')]('/',auth[_0xf4d9('0x7')](),controller['index']);router[_0xf4d9('0x6')]('/:id',auth[_0xf4d9('0x7')](),controller[_0xf4d9('0x8')]);router[_0xf4d9('0x6')]('/:id/items',auth[_0xf4d9('0x7')](),controller[_0xf4d9('0x9')]);router[_0xf4d9('0xa')]('/',auth[_0xf4d9('0x7')](),controller[_0xf4d9('0xb')]);router['post'](_0xf4d9('0xc'),auth[_0xf4d9('0x7')](),controller[_0xf4d9('0xd')]);router[_0xf4d9('0xa')]('/:id/items',auth[_0xf4d9('0x7')](),controller[_0xf4d9('0xe')]);router['put'](_0xf4d9('0xf'),auth[_0xf4d9('0x7')](),controller[_0xf4d9('0x10')]);router['delete']('/:id',auth[_0xf4d9('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5e19=['/:id','/:id/items','post','create','/:id/clone','clone','addItem','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index'];(function(_0x35e079,_0x59efc6){var _0x3bbd91=function(_0x2f942c){while(--_0x2f942c){_0x35e079['push'](_0x35e079['shift']());}};_0x3bbd91(++_0x59efc6);}(_0x5e19,0xc8));var _0x95e1=function(_0x477128,_0x21ab61){_0x477128=_0x477128-0x0;var _0x2ab86b=_0x5e19[_0x477128];return _0x2ab86b;};'use strict';var multer=require(_0x95e1('0x0'));var util=require('util');var path=require(_0x95e1('0x1'));var timeout=require(_0x95e1('0x2'));var express=require(_0x95e1('0x3'));var router=express[_0x95e1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x95e1('0x5'));var config=require('../../config/environment');var controller=require(_0x95e1('0x6'));router[_0x95e1('0x7')]('/',auth[_0x95e1('0x8')](),controller[_0x95e1('0x9')]);router[_0x95e1('0x7')](_0x95e1('0xa'),auth[_0x95e1('0x8')](),controller['show']);router['get'](_0x95e1('0xb'),auth[_0x95e1('0x8')](),controller['getItems']);router[_0x95e1('0xc')]('/',auth[_0x95e1('0x8')](),controller[_0x95e1('0xd')]);router['post'](_0x95e1('0xe'),auth[_0x95e1('0x8')](),controller[_0x95e1('0xf')]);router[_0x95e1('0xc')](_0x95e1('0xb'),auth[_0x95e1('0x8')](),controller[_0x95e1('0x10')]);router['put'](_0x95e1('0xa'),auth[_0x95e1('0x8')](),controller[_0x95e1('0x11')]);router[_0x95e1('0x12')](_0x95e1('0xa'),auth['isAuthenticated'](),controller[_0x95e1('0x13')]);module[_0x95e1('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 15ffc10..7207fcb 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 _0xc1c6=['long','parse','setDataValue','stringify','attrs','INTEGER','#ffffff','sequelize','squel','lodash','STRING','TEXT'];(function(_0x5859d3,_0x26b667){var _0x1698f0=function(_0x15bce2){while(--_0x15bce2){_0x5859d3['push'](_0x5859d3['shift']());}};_0x1698f0(++_0x26b667);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2b90ef,_0x180832){_0x2b90ef=_0x2b90ef-0x0;var _0x2c7893=_0xc1c6[_0x2b90ef];return _0x2c7893;};'use strict';var Sequelize=require(_0x6c1c('0x0'));var squel=require(_0x6c1c('0x1'));var _=require(_0x6c1c('0x2'));module['exports']={'title':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6c1c('0x4')](_0x6c1c('0x5')),'get':function(){try{return JSON[_0x6c1c('0x6')](this['getDataValue']('attrs'));}catch(_0x32af84){return[];}},'set':function(_0x524a6b){try{this[_0x6c1c('0x7')]('attrs',JSON[_0x6c1c('0x8')](_0x524a6b));}catch(_0x2eb1ba){this[_0x6c1c('0x7')](_0x6c1c('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6c1c('0xa')]},'background':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':_0x6c1c('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6c1c('0x3')]},'titleFontSize':{'type':Sequelize[_0x6c1c('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xdbf5=['squel','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x588f72,_0x58a5a7){var _0x504765=function(_0x49aab2){while(--_0x49aab2){_0x588f72['push'](_0x588f72['shift']());}};_0x504765(++_0x58a5a7);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1e391f,_0x41b245){_0x1e391f=_0x1e391f-0x0;var _0x47a592=_0xdbf5[_0x1e391f];return _0x47a592;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5dbf('0x0'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5dbf('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5dbf('0x2')](_0x5dbf('0x3')),'get':function(){try{return JSON[_0x5dbf('0x4')](this[_0x5dbf('0x5')](_0x5dbf('0x6')));}catch(_0x1decd2){return[];}},'set':function(_0x3f8628){try{this[_0x5dbf('0x7')](_0x5dbf('0x6'),JSON[_0x5dbf('0x8')](_0x3f8628));}catch(_0x93e657){this['setDataValue'](_0x5dbf('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5dbf('0x9')]},'col':{'type':Sequelize[_0x5dbf('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dbf('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5dbf('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index cbce0bc..d006fac 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 _0xdded=['register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','end','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','destroy','catch','type','iframe','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x553769,_0x253211){var _0x44fa7b=function(_0x185c03){while(--_0x185c03){_0x553769['push'](_0x553769['shift']());}};_0x44fa7b(++_0x253211);}(_0xdded,0x17a));var _0xddde=function(_0x5cae9c,_0x59a988){_0x5cae9c=_0x5cae9c-0x0;var _0x1a70cb=_0xdded[_0x5cae9c];return _0x1a70cb;};'use strict';var emlformat=require(_0xddde('0x0'));var rimraf=require(_0xddde('0x1'));var zipdir=require(_0xddde('0x2'));var jsonpatch=require(_0xddde('0x3'));var rp=require(_0xddde('0x4'));var moment=require(_0xddde('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddde('0x6'));var util=require(_0xddde('0x7'));var path=require(_0xddde('0x8'));var sox=require(_0xddde('0x9'));var csv=require(_0xddde('0xa'));var ejs=require(_0xddde('0xb'));var fs=require('fs');var fs_extra=require(_0xddde('0xc'));var _=require(_0xddde('0xd'));var squel=require(_0xddde('0xe'));var crypto=require(_0xddde('0xf'));var jsforce=require(_0xddde('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xddde('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddde('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xddde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddde('0x13'))(_0xddde('0x14'));var utils=require(_0xddde('0x15'));var config=require(_0xddde('0x16'));var licenseUtil=require(_0xddde('0x17'));var db=require(_0xddde('0x18'))['db'];config[_0xddde('0x19')]=_[_0xddde('0x1a')](config['redis'],{'host':_0xddde('0x1b'),'port':0x18eb});var socket=require(_0xddde('0x1c'))(new Redis(config[_0xddde('0x19')]));require(_0xddde('0x1d'))[_0xddde('0x1e')](socket);function respondWithStatusCode(_0x31c111,_0x491be5){_0x491be5=_0x491be5||0xcc;return function(_0x20b440){if(_0x20b440){return _0x31c111[_0xddde('0x1f')](_0x491be5);}return _0x31c111[_0xddde('0x20')](_0x491be5)['end']();};}function respondWithResult(_0x5de7ce,_0xadd497){_0xadd497=_0xadd497||0xc8;return function(_0x4e98fd){if(_0x4e98fd){return _0x5de7ce[_0xddde('0x20')](_0xadd497)[_0xddde('0x21')](_0x4e98fd);}};}function respondWithFilteredResult(_0x338fa7,_0x463254){return function(_0x2f0e58){if(_0x2f0e58){var _0x55349b=typeof _0x463254[_0xddde('0x22')]===_0xddde('0x23')&&typeof _0x463254['limit']===_0xddde('0x23');var _0x1185f9=_0x2f0e58['count'];var _0x5ae808=_0x55349b?0x0:_0x463254[_0xddde('0x22')];var _0x4c34b1=_0x55349b?_0x2f0e58[_0xddde('0x24')]:_0x463254['offset']+_0x463254[_0xddde('0x25')];var _0xea045b;if(_0x4c34b1>=_0x1185f9){_0x4c34b1=_0x1185f9;_0xea045b=0xc8;}else{_0xea045b=0xce;}_0x338fa7['status'](_0xea045b);return _0x338fa7['set'](_0xddde('0x26'),_0x5ae808+'-'+_0x4c34b1+'/'+_0x1185f9)[_0xddde('0x21')](_0x2f0e58);}return null;};}function patchUpdates(_0x97bb0f){return function(_0x275f76){try{jsonpatch[_0xddde('0x27')](_0x275f76,_0x97bb0f,!![]);}catch(_0xa663e4){return BPromise[_0xddde('0x28')](_0xa663e4);}return _0x275f76['save']();};}function saveUpdates(_0x59320f,_0x3daa4a){return function(_0x261895){if(_0x261895){return _0x261895[_0xddde('0x29')](_0x59320f)[_0xddde('0x2a')](function(_0xdb57ef){return _0xdb57ef;});}return null;};}function removeEntity(_0x533332,_0x394da0){return function(_0x186ae3){if(_0x186ae3){return _0x186ae3['destroy']()['then'](function(){_0x533332[_0xddde('0x20')](0xcc)[_0xddde('0x2b')]();});}};}function handleEntityNotFound(_0x5ddf57,_0x560e28){return function(_0x45941e){if(!_0x45941e){_0x5ddf57['sendStatus'](0x194);}return _0x45941e;};}function handleError(_0x1d1c3e,_0x41d94b){_0x41d94b=_0x41d94b||0x1f4;return function(_0x2dd131){logger[_0xddde('0x2c')](_0x2dd131[_0xddde('0x2d')]);if(_0x2dd131[_0xddde('0x2e')]){delete _0x2dd131[_0xddde('0x2e')];}_0x1d1c3e[_0xddde('0x20')](_0x41d94b)[_0xddde('0x2f')](_0x2dd131);};}exports[_0xddde('0x30')]=function(_0x3a8226,_0x1ff3e2){var _0xe3d006={'raw':![],'where':{'id':_0x3a8226[_0xddde('0x31')]['id']}},_0x718921={};_0x718921[_0xddde('0x32')]=_[_0xddde('0x33')](db[_0xddde('0x34')][_0xddde('0x35')]);_0x718921[_0xddde('0x36')]=_['keys'](_0x3a8226['query']);_0x718921[_0xddde('0x37')]=_[_0xddde('0x38')](_0x718921[_0xddde('0x32')],_0x718921['query']);_0xe3d006['attributes']=_[_0xddde('0x38')](_0x718921[_0xddde('0x32')],qs[_0xddde('0x39')](_0x3a8226[_0xddde('0x36')]['fields']));_0xe3d006[_0xddde('0x3a')]=_0xe3d006['attributes'][_0xddde('0x3b')]?_0xe3d006[_0xddde('0x3a')]:_0x718921[_0xddde('0x32')];if(_0x3a8226[_0xddde('0x36')][_0xddde('0x3c')]){_0xe3d006[_0xddde('0x3d')]=[{'all':!![]}];}_0xe3d006=_[_0xddde('0x3e')]({},_0xe3d006,_0x3a8226[_0xddde('0x3f')]);return db[_0xddde('0x34')][_0xddde('0x40')](_0xe3d006)[_0xddde('0x2a')](handleEntityNotFound(_0x1ff3e2,null))[_0xddde('0x2a')](respondWithResult(_0x1ff3e2,null))['catch'](handleError(_0x1ff3e2,null));};exports[_0xddde('0x41')]=function(_0x170482,_0x4c68ab){return db['DashboardItem']['find']({'where':{'id':_0x170482[_0xddde('0x31')]['id']}})[_0xddde('0x2a')](handleEntityNotFound(_0x4c68ab,null))[_0xddde('0x2a')](removeEntity(_0x4c68ab,null))[_0xddde('0x42')](handleError(_0x4c68ab,null));};function widgetAttributes(_0x2825c6){try{switch(_0x2825c6[_0xddde('0x43')]){case _0xddde('0x44'):return[{'name':'attrUrl','value':_0x2825c6['attrUrl']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x0]?_0x2825c6[_0xddde('0x45')][0x0][_0xddde('0x46')]:undefined)||'https://'}];case _0xddde('0x47'):return[{'name':_0xddde('0x48'),'value':_0x2825c6[_0xddde('0x48')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x0]?_0x2825c6[_0xddde('0x45')][0x0]['value']:undefined)||''}];case _0xddde('0x49'):return[{'name':_0xddde('0x4a'),'value':_0x2825c6[_0xddde('0x4a')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0]['value']:undefined)||_0xddde('0x4b')},{'name':_0xddde('0x4c'),'value':_0x2825c6[_0xddde('0x4c')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x1]?_0x2825c6['attrs'][0x1][_0xddde('0x46')]:undefined)||_0xddde('0x4d')},{'name':_0xddde('0x4e'),'value':_0x2825c6[_0xddde('0x4e')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x2]?_0x2825c6[_0xddde('0x45')][0x2][_0xddde('0x46')]:undefined)||0xc}];case _0xddde('0x4f'):return[{'name':'attrMetric','value':_0x2825c6[_0xddde('0x50')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0]['value']:undefined)||_0xddde('0x51')},{'name':_0xddde('0x52'),'value':_0x2825c6[_0xddde('0x52')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x1]?_0x2825c6['attrs'][0x1][_0xddde('0x46')]:undefined)||[]},{'name':_0xddde('0x4e'),'value':_0x2825c6[_0xddde('0x4e')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x2]?_0x2825c6[_0xddde('0x45')][0x2][_0xddde('0x46')]:undefined)||0x14},{'name':_0xddde('0x53'),'value':_0x2825c6['attrChannel']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x3]?_0x2825c6[_0xddde('0x45')][0x3][_0xddde('0x46')]:undefined)||_0xddde('0x54')},{'name':'attrEmailAccounts','value':_0x2825c6[_0xddde('0x55')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x4]?_0x2825c6['attrs'][0x4][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x56'),'value':_0x2825c6[_0xddde('0x56')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x5]?_0x2825c6[_0xddde('0x45')][0x5][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x57'),'value':_0x2825c6['attrSmsAccounts']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x6]?_0x2825c6[_0xddde('0x45')][0x6][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x58'),'value':_0x2825c6[_0xddde('0x58')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x7]?_0x2825c6[_0xddde('0x45')][0x7][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x59'),'value':_0x2825c6[_0xddde('0x59')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x8]?_0x2825c6[_0xddde('0x45')][0x8][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x5a'),'value':_0x2825c6[_0xddde('0x5a')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x9]?_0x2825c6[_0xddde('0x45')][0x9][_0xddde('0x46')]:undefined)||''}];case _0xddde('0x5b'):case _0xddde('0x5c'):return[{'name':_0xddde('0x5d'),'value':_0x2825c6[_0xddde('0x5d')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0][_0xddde('0x46')]:undefined)||_0xddde('0x51')},{'name':'attrSerie2','value':_0x2825c6['attrSerie2']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x1]?_0x2825c6[_0xddde('0x45')][0x1][_0xddde('0x46')]:undefined)||null},{'name':_0xddde('0x5e'),'value':_0x2825c6['attrSerie3']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x2]?_0x2825c6[_0xddde('0x45')][0x2][_0xddde('0x46')]:undefined)||null},{'name':_0xddde('0x52'),'value':_0x2825c6[_0xddde('0x52')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x3]?_0x2825c6[_0xddde('0x45')][0x3][_0xddde('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x2825c6[_0xddde('0x53')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x4]?_0x2825c6['attrs'][0x4]['value']:undefined)||_0xddde('0x54')},{'name':'attrEmailAccounts','value':_0x2825c6[_0xddde('0x55')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x5]?_0x2825c6[_0xddde('0x45')][0x5][_0xddde('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2825c6['attrFaxAccounts']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x6]?_0x2825c6['attrs'][0x6][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x57'),'value':_0x2825c6[_0xddde('0x57')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x7]?_0x2825c6[_0xddde('0x45')][0x7][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x58'),'value':_0x2825c6[_0xddde('0x58')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x8]?_0x2825c6[_0xddde('0x45')][0x8]['value']:undefined)||''},{'name':_0xddde('0x59'),'value':_0x2825c6[_0xddde('0x59')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x9]?_0x2825c6['attrs'][0x9][_0xddde('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2825c6[_0xddde('0x5a')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0xa]?_0x2825c6['attrs'][0xa][_0xddde('0x46')]:undefined)||''}];case _0xddde('0x5f'):return[{'name':_0xddde('0x60'),'type':_0x2825c6['reportType']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0][_0xddde('0x43')]:undefined)||null,'value':_0x2825c6[_0xddde('0x60')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6['attrs'][0x0][_0xddde('0x46')]:undefined)||null},{'name':_0xddde('0x61'),'value':_0x2825c6[_0xddde('0x61')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x1]?_0x2825c6[_0xddde('0x45')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xf33175){logger[_0xddde('0x2c')](_0xddde('0x62'),JSON[_0xddde('0x63')](_0xf33175));return[];}}exports[_0xddde('0x64')]=function(_0x4eb8ce,_0x29b5b1){if(_0x4eb8ce[_0xddde('0x65')]){_0x4eb8ce[_0xddde('0x65')]['attrs']=widgetAttributes(_0x4eb8ce[_0xddde('0x65')]);}return db['DashboardItem'][_0xddde('0x64')](_0x4eb8ce[_0xddde('0x65')],{})['then'](respondWithResult(_0x29b5b1,0xc9))[_0xddde('0x42')](handleError(_0x29b5b1,null));};exports[_0xddde('0x29')]=function(_0x378758,_0x54c787){if(_0x378758[_0xddde('0x65')]['id']){delete _0x378758[_0xddde('0x65')]['id'];}_0x378758[_0xddde('0x65')][_0xddde('0x45')]=widgetAttributes(_0x378758['body']);return db[_0xddde('0x34')][_0xddde('0x40')]({'where':{'id':_0x378758[_0xddde('0x31')]['id']}})['then'](handleEntityNotFound(_0x54c787,null))[_0xddde('0x2a')](saveUpdates(_0x378758['body'],null))[_0xddde('0x2a')](respondWithResult(_0x54c787,null))[_0xddde('0x42')](handleError(_0x54c787,null));}; \ No newline at end of file +var _0xd819=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','catch','find','type','attrUrl','attrs','https://','custom','attrPath','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0xd819,0x181));var _0x9d81=function(_0x28a0b3,_0x39b7d1){_0x28a0b3=_0x28a0b3-0x0;var _0x4fd5f3=_0xd819[_0x28a0b3];return _0x4fd5f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d81('0x0'));var zipdir=require(_0x9d81('0x1'));var jsonpatch=require(_0x9d81('0x2'));var rp=require(_0x9d81('0x3'));var moment=require('moment');var BPromise=require(_0x9d81('0x4'));var Mustache=require('mustache');var util=require(_0x9d81('0x5'));var path=require('path');var sox=require(_0x9d81('0x6'));var csv=require(_0x9d81('0x7'));var ejs=require(_0x9d81('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d81('0x9'));var squel=require(_0x9d81('0xa'));var crypto=require(_0x9d81('0xb'));var jsforce=require(_0x9d81('0xc'));var deskjs=require(_0x9d81('0xd'));var toCsv=require(_0x9d81('0x7'));var querystring=require(_0x9d81('0xe'));var Papa=require(_0x9d81('0xf'));var Redis=require(_0x9d81('0x10'));var authService=require(_0x9d81('0x11'));var qs=require(_0x9d81('0x12'));var as=require(_0x9d81('0x13'));var hardwareService=require(_0x9d81('0x14'));var logger=require(_0x9d81('0x15'))('api');var utils=require(_0x9d81('0x16'));var config=require(_0x9d81('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d81('0x18'))['db'];config[_0x9d81('0x19')]=_[_0x9d81('0x1a')](config[_0x9d81('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d81('0x1b'))(new Redis(config['redis']));require(_0x9d81('0x1c'))['register'](socket);function respondWithStatusCode(_0x21508a,_0x3cd9e4){_0x3cd9e4=_0x3cd9e4||0xcc;return function(_0x5d0f0f){if(_0x5d0f0f){return _0x21508a[_0x9d81('0x1d')](_0x3cd9e4);}return _0x21508a[_0x9d81('0x1e')](_0x3cd9e4)[_0x9d81('0x1f')]();};}function respondWithResult(_0x20ee18,_0x2d3648){_0x2d3648=_0x2d3648||0xc8;return function(_0x43452e){if(_0x43452e){return _0x20ee18[_0x9d81('0x1e')](_0x2d3648)[_0x9d81('0x20')](_0x43452e);}};}function respondWithFilteredResult(_0x5bc816,_0x66bd20){return function(_0x1bb0d7){if(_0x1bb0d7){var _0x3309c3=typeof _0x66bd20[_0x9d81('0x21')]===_0x9d81('0x22')&&typeof _0x66bd20['limit']==='undefined';var _0x2879ad=_0x1bb0d7[_0x9d81('0x23')];var _0x3104ad=_0x3309c3?0x0:_0x66bd20[_0x9d81('0x21')];var _0x409720=_0x3309c3?_0x1bb0d7[_0x9d81('0x23')]:_0x66bd20[_0x9d81('0x21')]+_0x66bd20[_0x9d81('0x24')];var _0x291249;if(_0x409720>=_0x2879ad){_0x409720=_0x2879ad;_0x291249=0xc8;}else{_0x291249=0xce;}_0x5bc816[_0x9d81('0x1e')](_0x291249);return _0x5bc816[_0x9d81('0x25')](_0x9d81('0x26'),_0x3104ad+'-'+_0x409720+'/'+_0x2879ad)[_0x9d81('0x20')](_0x1bb0d7);}return null;};}function patchUpdates(_0x4a9c9c){return function(_0x164c2e){try{jsonpatch[_0x9d81('0x27')](_0x164c2e,_0x4a9c9c,!![]);}catch(_0x2ebd66){return BPromise[_0x9d81('0x28')](_0x2ebd66);}return _0x164c2e[_0x9d81('0x29')]();};}function saveUpdates(_0x12a1e4,_0x3d7be7){return function(_0x25f815){if(_0x25f815){return _0x25f815['update'](_0x12a1e4)[_0x9d81('0x2a')](function(_0xcb0df5){return _0xcb0df5;});}return null;};}function removeEntity(_0x288702,_0x220535){return function(_0x49730b){if(_0x49730b){return _0x49730b[_0x9d81('0x2b')]()['then'](function(){_0x288702[_0x9d81('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3835b5,_0x5cba30){return function(_0x3f44c0){if(!_0x3f44c0){_0x3835b5[_0x9d81('0x1d')](0x194);}return _0x3f44c0;};}function handleError(_0x1fd874,_0x3ccdbf){_0x3ccdbf=_0x3ccdbf||0x1f4;return function(_0xb82d79){logger[_0x9d81('0x2c')](_0xb82d79[_0x9d81('0x2d')]);if(_0xb82d79[_0x9d81('0x2e')]){delete _0xb82d79[_0x9d81('0x2e')];}_0x1fd874[_0x9d81('0x1e')](_0x3ccdbf)[_0x9d81('0x2f')](_0xb82d79);};}exports[_0x9d81('0x30')]=function(_0x397957,_0x28a5bf){var _0x25a9e0={'raw':![],'where':{'id':_0x397957['params']['id']}},_0xe0cf0d={};_0xe0cf0d['model']=_[_0x9d81('0x31')](db[_0x9d81('0x32')][_0x9d81('0x33')]);_0xe0cf0d['query']=_[_0x9d81('0x31')](_0x397957[_0x9d81('0x34')]);_0xe0cf0d[_0x9d81('0x35')]=_['intersection'](_0xe0cf0d[_0x9d81('0x36')],_0xe0cf0d[_0x9d81('0x34')]);_0x25a9e0[_0x9d81('0x37')]=_[_0x9d81('0x38')](_0xe0cf0d[_0x9d81('0x36')],qs[_0x9d81('0x39')](_0x397957[_0x9d81('0x34')][_0x9d81('0x39')]));_0x25a9e0[_0x9d81('0x37')]=_0x25a9e0[_0x9d81('0x37')][_0x9d81('0x3a')]?_0x25a9e0[_0x9d81('0x37')]:_0xe0cf0d[_0x9d81('0x36')];if(_0x397957['query'][_0x9d81('0x3b')]){_0x25a9e0[_0x9d81('0x3c')]=[{'all':!![]}];}_0x25a9e0=_[_0x9d81('0x3d')]({},_0x25a9e0,_0x397957[_0x9d81('0x3e')]);return db[_0x9d81('0x32')]['find'](_0x25a9e0)[_0x9d81('0x2a')](handleEntityNotFound(_0x28a5bf,null))[_0x9d81('0x2a')](respondWithResult(_0x28a5bf,null))[_0x9d81('0x3f')](handleError(_0x28a5bf,null));};exports[_0x9d81('0x2b')]=function(_0x3e6d49,_0x351634){return db[_0x9d81('0x32')][_0x9d81('0x40')]({'where':{'id':_0x3e6d49['params']['id']}})[_0x9d81('0x2a')](handleEntityNotFound(_0x351634,null))[_0x9d81('0x2a')](removeEntity(_0x351634,null))[_0x9d81('0x3f')](handleError(_0x351634,null));};function widgetAttributes(_0x55f4e8){try{switch(_0x55f4e8[_0x9d81('0x41')]){case'iframe':return[{'name':_0x9d81('0x42'),'value':_0x55f4e8['attrUrl']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0]['value']:undefined)||_0x9d81('0x44')}];case _0x9d81('0x45'):return[{'name':_0x9d81('0x46'),'value':_0x55f4e8[_0x9d81('0x46')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0][_0x9d81('0x47')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x55f4e8['attrHourFormat']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8['attrs'][0x0][_0x9d81('0x47')]:undefined)||_0x9d81('0x48')},{'name':_0x9d81('0x49'),'value':_0x55f4e8['attrTimezone']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x1]?_0x55f4e8[_0x9d81('0x43')][0x1][_0x9d81('0x47')]:undefined)||_0x9d81('0x4a')},{'name':_0x9d81('0x4b'),'value':_0x55f4e8[_0x9d81('0x4b')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8['attrs'][0x2]?_0x55f4e8[_0x9d81('0x43')][0x2]['value']:undefined)||0xc}];case _0x9d81('0x4c'):return[{'name':_0x9d81('0x4d'),'value':_0x55f4e8[_0x9d81('0x4d')]||(_0x55f4e8['attrs']&&_0x55f4e8['attrs'][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0][_0x9d81('0x47')]:undefined)||'total'},{'name':_0x9d81('0x4e'),'value':_0x55f4e8[_0x9d81('0x4e')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x1]?_0x55f4e8[_0x9d81('0x43')][0x1][_0x9d81('0x47')]:undefined)||[]},{'name':_0x9d81('0x4b'),'value':_0x55f4e8['attrFontSize']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x2]?_0x55f4e8[_0x9d81('0x43')][0x2][_0x9d81('0x47')]:undefined)||0x14},{'name':'attrChannel','value':_0x55f4e8[_0x9d81('0x4f')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x3]?_0x55f4e8[_0x9d81('0x43')][0x3][_0x9d81('0x47')]:undefined)||_0x9d81('0x50')},{'name':_0x9d81('0x51'),'value':_0x55f4e8[_0x9d81('0x51')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8['attrs'][0x4]?_0x55f4e8['attrs'][0x4][_0x9d81('0x47')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x55f4e8[_0x9d81('0x52')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x5]?_0x55f4e8[_0x9d81('0x43')][0x5][_0x9d81('0x47')]:undefined)||''},{'name':_0x9d81('0x53'),'value':_0x55f4e8[_0x9d81('0x53')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x6]?_0x55f4e8[_0x9d81('0x43')][0x6]['value']:undefined)||''},{'name':_0x9d81('0x54'),'value':_0x55f4e8['attrOpenchannelAccounts']||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x7]?_0x55f4e8[_0x9d81('0x43')][0x7][_0x9d81('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x55f4e8[_0x9d81('0x55')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x8]?_0x55f4e8[_0x9d81('0x43')][0x8][_0x9d81('0x47')]:undefined)||''},{'name':_0x9d81('0x56'),'value':_0x55f4e8['attrChatWebsites']||(_0x55f4e8['attrs']&&_0x55f4e8['attrs'][0x9]?_0x55f4e8[_0x9d81('0x43')][0x9]['value']:undefined)||''}];case _0x9d81('0x57'):case'pie-chart':return[{'name':_0x9d81('0x58'),'value':_0x55f4e8[_0x9d81('0x58')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0]['value']:undefined)||'total'},{'name':_0x9d81('0x59'),'value':_0x55f4e8['attrSerie2']||(_0x55f4e8['attrs']&&_0x55f4e8['attrs'][0x1]?_0x55f4e8['attrs'][0x1][_0x9d81('0x47')]:undefined)||null},{'name':_0x9d81('0x5a'),'value':_0x55f4e8[_0x9d81('0x5a')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8['attrs'][0x2]?_0x55f4e8[_0x9d81('0x43')][0x2][_0x9d81('0x47')]:undefined)||null},{'name':_0x9d81('0x4e'),'value':_0x55f4e8[_0x9d81('0x4e')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x3]?_0x55f4e8[_0x9d81('0x43')][0x3][_0x9d81('0x47')]:undefined)||[]},{'name':_0x9d81('0x4f'),'value':_0x55f4e8['attrChannel']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x4]?_0x55f4e8[_0x9d81('0x43')][0x4][_0x9d81('0x47')]:undefined)||_0x9d81('0x50')},{'name':_0x9d81('0x51'),'value':_0x55f4e8[_0x9d81('0x51')]||(_0x55f4e8['attrs']&&_0x55f4e8['attrs'][0x5]?_0x55f4e8['attrs'][0x5][_0x9d81('0x47')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x55f4e8['attrFaxAccounts']||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x6]?_0x55f4e8['attrs'][0x6]['value']:undefined)||''},{'name':_0x9d81('0x53'),'value':_0x55f4e8[_0x9d81('0x53')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x7]?_0x55f4e8[_0x9d81('0x43')][0x7][_0x9d81('0x47')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x55f4e8[_0x9d81('0x54')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x8]?_0x55f4e8[_0x9d81('0x43')][0x8][_0x9d81('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x55f4e8[_0x9d81('0x55')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x9]?_0x55f4e8['attrs'][0x9]['value']:undefined)||''},{'name':_0x9d81('0x56'),'value':_0x55f4e8[_0x9d81('0x56')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8['attrs'][0xa]?_0x55f4e8['attrs'][0xa][_0x9d81('0x47')]:undefined)||''}];case _0x9d81('0x5b'):return[{'name':_0x9d81('0x5c'),'type':_0x55f4e8[_0x9d81('0x5d')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0][_0x9d81('0x41')]:undefined)||null,'value':_0x55f4e8[_0x9d81('0x5c')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0][_0x9d81('0x47')]:undefined)||null},{'name':_0x9d81('0x5e'),'value':_0x55f4e8[_0x9d81('0x5e')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x1]?_0x55f4e8[_0x9d81('0x43')][0x1][_0x9d81('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x2b17d2){logger[_0x9d81('0x2c')]('widgetAttributes:\x20%s',JSON[_0x9d81('0x5f')](_0x2b17d2));return[];}}exports[_0x9d81('0x60')]=function(_0x7ebbdf,_0x365b29){if(_0x7ebbdf[_0x9d81('0x61')]){_0x7ebbdf[_0x9d81('0x61')]['attrs']=widgetAttributes(_0x7ebbdf['body']);}return db[_0x9d81('0x32')]['create'](_0x7ebbdf[_0x9d81('0x61')],{})['then'](respondWithResult(_0x365b29,0xc9))[_0x9d81('0x3f')](handleError(_0x365b29,null));};exports['update']=function(_0x21c23f,_0x579367){if(_0x21c23f['body']['id']){delete _0x21c23f[_0x9d81('0x61')]['id'];}_0x21c23f[_0x9d81('0x61')]['attrs']=widgetAttributes(_0x21c23f['body']);return db['DashboardItem'][_0x9d81('0x40')]({'where':{'id':_0x21c23f['params']['id']}})[_0x9d81('0x2a')](handleEntityNotFound(_0x579367,null))[_0x9d81('0x2a')](saveUpdates(_0x21c23f['body'],null))[_0x9d81('0x2a')](respondWithResult(_0x579367,null))['catch'](handleError(_0x579367,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 871182d..594943f 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 _0x3d40=['update','remove','emit','hasOwnProperty','hook','exports','DashboardItem'];(function(_0x262034,_0x1d61e1){var _0x4d9e4c=function(_0x5f22ac){while(--_0x5f22ac){_0x262034['push'](_0x262034['shift']());}};_0x4d9e4c(++_0x1d61e1);}(_0x3d40,0x1e9));var _0x03d4=function(_0x41df9b,_0x23049a){_0x41df9b=_0x41df9b-0x0;var _0x1e9c77=_0x3d40[_0x41df9b];return _0x1e9c77;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x03d4('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x03d4('0x1'),'afterDestroy':_0x03d4('0x2')};function emitEvent(_0x323d59){return function(_0x31bef9,_0x16f2b3,_0x456609){DashboardItemEvents[_0x03d4('0x3')](_0x323d59+':'+_0x31bef9['id'],_0x31bef9);DashboardItemEvents[_0x03d4('0x3')](_0x323d59,_0x31bef9);_0x456609(null);};}for(var e in events){if(events[_0x03d4('0x4')](e)){var event=events[e];DashboardItem[_0x03d4('0x5')](e,emitEvent(event));}}module[_0x03d4('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x1af6=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x114bdb,_0x5cd54f){var _0x38b98e=function(_0x12b89b){while(--_0x12b89b){_0x114bdb['push'](_0x114bdb['shift']());}};_0x38b98e(++_0x5cd54f);}(_0x1af6,0x121));var _0x61af=function(_0x548911,_0x93233c){_0x548911=_0x548911-0x0;var _0xa41cf8=_0x1af6[_0x548911];return _0xa41cf8;};'use strict';var EventEmitter=require(_0x61af('0x0'));var DashboardItem=require(_0x61af('0x1'))['db'][_0x61af('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x61af('0x3')](0x0);var events={'afterCreate':_0x61af('0x4'),'afterUpdate':_0x61af('0x5'),'afterDestroy':_0x61af('0x6')};function emitEvent(_0x5d5d3a){return function(_0x577e4d,_0x212f19,_0x238ee3){DashboardItemEvents[_0x61af('0x7')](_0x5d5d3a+':'+_0x577e4d['id'],_0x577e4d);DashboardItemEvents['emit'](_0x5d5d3a,_0x577e4d);_0x238ee3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x61af('0x8')](e,emitEvent(event));}}module[_0x61af('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 8cee85d..db3d6ff 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 _0x83b1=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','lodash'];(function(_0x3e1077,_0x1c4f67){var _0x481d19=function(_0x495748){while(--_0x495748){_0x3e1077['push'](_0x3e1077['shift']());}};_0x481d19(++_0x1c4f67);}(_0x83b1,0x128));var _0x183b=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x83b1[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x183b('0x0'));var util=require(_0x183b('0x1'));var logger=require(_0x183b('0x2'))(_0x183b('0x3'));var moment=require(_0x183b('0x4'));var BPromise=require(_0x183b('0x5'));var rp=require(_0x183b('0x6'));var fs=require('fs');var path=require(_0x183b('0x7'));var rimraf=require(_0x183b('0x8'));var config=require(_0x183b('0x9'));var attributes=require('./dashboardItem.attributes');module[_0x183b('0xa')]=function(_0x1fc245,_0x17045d){return _0x1fc245['define']('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7b3=['dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0xcc3caf,_0x11800f){var _0x5d1173=function(_0x398db1){while(--_0x398db1){_0xcc3caf['push'](_0xcc3caf['shift']());}};_0x5d1173(++_0x11800f);}(_0xf7b3,0x112));var _0x3f7b=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0xf7b3[_0x1ae4a9];return _0x54d0b0;};'use strict';var _=require(_0x3f7b('0x0'));var util=require(_0x3f7b('0x1'));var logger=require(_0x3f7b('0x2'))(_0x3f7b('0x3'));var moment=require(_0x3f7b('0x4'));var BPromise=require(_0x3f7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f7b('0x6'));var rimraf=require('rimraf');var config=require(_0x3f7b('0x7'));var attributes=require(_0x3f7b('0x8'));module[_0x3f7b('0x9')]=function(_0x926cef,_0x157f4d){return _0x926cef[_0x3f7b('0xa')](_0x3f7b('0xb'),attributes,{'tableName':_0x3f7b('0xc'),'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 b5d1dc7..59c4a4b 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 _0x662b=['error','message','catch','DashboardItem,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','stringify'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x662b,0x8b));var _0xb662=function(_0x43b4d5,_0xf7dc22){_0x43b4d5=_0x43b4d5-0x0;var _0x347c2f=_0x662b[_0x43b4d5];return _0x347c2f;};'use strict';var _=require(_0xb662('0x0'));var util=require('util');var moment=require(_0xb662('0x1'));var BPromise=require(_0xb662('0x2'));var rs=require(_0xb662('0x3'));var fs=require('fs');var Redis=require(_0xb662('0x4'));var db=require(_0xb662('0x5'))['db'];var utils=require(_0xb662('0x6'));var logger=require(_0xb662('0x7'))(_0xb662('0x8'));var config=require(_0xb662('0x9'));var jayson=require(_0xb662('0xa'));var client=jayson[_0xb662('0xb')]['http']({'port':0x232a});config[_0xb662('0xc')]=_[_0xb662('0xd')](config[_0xb662('0xc')],{'host':_0xb662('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb662('0xc')]));require(_0xb662('0xf'))[_0xb662('0x10')](socket);function respondWithRpcPromise(_0x37d497,_0x308934,_0x4d9bd9){return new BPromise(function(_0x1ba896,_0x4ef2d1){return client[_0xb662('0x11')](_0x37d497,_0x4d9bd9)[_0xb662('0x12')](function(_0x3b5366){logger[_0xb662('0x13')]('DashboardItem,\x20%s,\x20%s',_0x308934,_0xb662('0x14'));logger[_0xb662('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x308934,_0xb662('0x14'),JSON[_0xb662('0x16')](_0x3b5366));if(_0x3b5366['error']){if(_0x3b5366[_0xb662('0x17')]['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x308934,_0x3b5366['error'][_0xb662('0x18')]);return _0x4ef2d1(_0x3b5366['error']['message']);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x308934,_0x3b5366[_0xb662('0x17')][_0xb662('0x18')]);return _0x1ba896(_0x3b5366['error'][_0xb662('0x18')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x308934,_0xb662('0x14'));_0x1ba896(_0x3b5366['result']['message']);}})[_0xb662('0x19')](function(_0x4b1b66){logger[_0xb662('0x17')](_0xb662('0x1a'),_0x308934,_0x4b1b66);_0x4ef2d1(_0x4b1b66);});});} \ No newline at end of file +var _0x83ea=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','then','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','DashboardItem,\x20%s,\x20%s','lodash','util','moment'];(function(_0x544bc4,_0x42bdc8){var _0x264ed5=function(_0x13733e){while(--_0x13733e){_0x544bc4['push'](_0x544bc4['shift']());}};_0x264ed5(++_0x42bdc8);}(_0x83ea,0x1eb));var _0xa83e=function(_0x1caac3,_0x1c3633){_0x1caac3=_0x1caac3-0x0;var _0x233826=_0x83ea[_0x1caac3];return _0x233826;};'use strict';var _=require(_0xa83e('0x0'));var util=require(_0xa83e('0x1'));var moment=require(_0xa83e('0x2'));var BPromise=require(_0xa83e('0x3'));var rs=require(_0xa83e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa83e('0x5'))['db'];var utils=require(_0xa83e('0x6'));var logger=require(_0xa83e('0x7'))(_0xa83e('0x8'));var config=require(_0xa83e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa83e('0xa')]['http']({'port':0x232a});config['redis']=_[_0xa83e('0xb')](config[_0xa83e('0xc')],{'host':_0xa83e('0xd'),'port':0x18eb});var socket=require(_0xa83e('0xe'))(new Redis(config['redis']));require(_0xa83e('0xf'))[_0xa83e('0x10')](socket);function respondWithRpcPromise(_0x5070d1,_0xf7e541,_0x379190){return new BPromise(function(_0x317631,_0x576a85){return client['request'](_0x5070d1,_0x379190)[_0xa83e('0x11')](function(_0x45594a){logger['info']('DashboardItem,\x20%s,\x20%s',_0xf7e541,'request\x20sent');logger[_0xa83e('0x12')](_0xa83e('0x13'),_0xf7e541,_0xa83e('0x14'),JSON['stringify'](_0x45594a));if(_0x45594a[_0xa83e('0x15')]){if(_0x45594a[_0xa83e('0x15')][_0xa83e('0x16')]===0x1f4){logger[_0xa83e('0x15')]('DashboardItem,\x20%s,\x20%s',_0xf7e541,_0x45594a[_0xa83e('0x15')][_0xa83e('0x17')]);return _0x576a85(_0x45594a[_0xa83e('0x15')]['message']);}logger[_0xa83e('0x15')]('DashboardItem,\x20%s,\x20%s',_0xf7e541,_0x45594a[_0xa83e('0x15')][_0xa83e('0x17')]);return _0x317631(_0x45594a[_0xa83e('0x15')][_0xa83e('0x17')]);}else{logger[_0xa83e('0x18')](_0xa83e('0x19'),_0xf7e541,_0xa83e('0x14'));_0x317631(_0x45594a['result'][_0xa83e('0x17')]);}})['catch'](function(_0x4b9f20){logger[_0xa83e('0x15')](_0xa83e('0x19'),_0xf7e541,_0x4b9f20);_0x576a85(_0x4b9f20);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c0b296b..a7f5b07 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 _0x6477=['removeListener','dashboardItem:','./dashboardItem.events','update','emit'];(function(_0x424556,_0x5016eb){var _0x36f8d2=function(_0x3fab0f){while(--_0x3fab0f){_0x424556['push'](_0x424556['shift']());}};_0x36f8d2(++_0x5016eb);}(_0x6477,0x8e));var _0x7647=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0x6477[_0x35b7d4];return _0x4e8cee;};'use strict';var DashboardItemEvents=require(_0x7647('0x0'));var events=['save','remove',_0x7647('0x1')];function createListener(_0x34a6c9,_0x4e3ab0){return function(_0x511f75){_0x4e3ab0[_0x7647('0x2')](_0x34a6c9,_0x511f75);};}function removeListener(_0x2b8b60,_0x20c7e2){return function(){DashboardItemEvents[_0x7647('0x3')](_0x2b8b60,_0x20c7e2);};}exports['register']=function(_0x451ccd){for(var _0x5d3935=0x0,_0x51c290=events['length'];_0x5d3935<_0x51c290;_0x5d3935++){var _0x325712=events[_0x5d3935];var _0xa75d01=createListener(_0x7647('0x4')+_0x325712,_0x451ccd);DashboardItemEvents['on'](_0x325712,_0xa75d01);}}; \ No newline at end of file +var _0x5fb3=['length','./dashboardItem.events','save','update','emit','removeListener','register'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x5fb3,0x143));var _0x35fb=function(_0x15b77d,_0x1d0e76){_0x15b77d=_0x15b77d-0x0;var _0x34c983=_0x5fb3[_0x15b77d];return _0x34c983;};'use strict';var DashboardItemEvents=require(_0x35fb('0x0'));var events=[_0x35fb('0x1'),'remove',_0x35fb('0x2')];function createListener(_0x15377a,_0x15e4d3){return function(_0x169886){_0x15e4d3[_0x35fb('0x3')](_0x15377a,_0x169886);};}function removeListener(_0x2805eb,_0x2481d2){return function(){DashboardItemEvents[_0x35fb('0x4')](_0x2805eb,_0x2481d2);};}exports[_0x35fb('0x5')]=function(_0x48c786){for(var _0xbb2493=0x0,_0x307ad4=events[_0x35fb('0x6')];_0xbb2493<_0x307ad4;_0xbb2493++){var _0x5ee11d=events[_0xbb2493];var _0x159adf=createListener('dashboardItem:'+_0x5ee11d,_0x48c786);DashboardItemEvents['on'](_0x5ee11d,_0x159adf);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b02c7d2..4086903 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 _0x8889=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','create','put','update','delete','exports','multer','util','connect-timeout','Router'];(function(_0x257dd1,_0x35ce94){var _0x41130d=function(_0x153d74){while(--_0x153d74){_0x257dd1['push'](_0x257dd1['shift']());}};_0x41130d(++_0x35ce94);}(_0x8889,0x9c));var _0x9888=function(_0x426fec,_0x16f732){_0x426fec=_0x426fec-0x0;var _0x3e6426=_0x8889[_0x426fec];return _0x3e6426;};'use strict';var multer=require(_0x9888('0x0'));var util=require(_0x9888('0x1'));var path=require('path');var timeout=require(_0x9888('0x2'));var express=require('express');var router=express[_0x9888('0x3')]();var fs_extra=require(_0x9888('0x4'));var auth=require(_0x9888('0x5'));var interaction=require(_0x9888('0x6'));var config=require(_0x9888('0x7'));var controller=require('./dashboardItem.controller');router[_0x9888('0x8')](_0x9888('0x9'),auth[_0x9888('0xa')](),controller['show']);router['post']('/',auth[_0x9888('0xa')](),controller[_0x9888('0xb')]);router[_0x9888('0xc')](_0x9888('0x9'),auth['isAuthenticated'](),controller[_0x9888('0xd')]);router[_0x9888('0xe')](_0x9888('0x9'),auth[_0x9888('0xa')](),controller['destroy']);module[_0x9888('0xf')]=router; \ No newline at end of file +var _0xd80d=['Router','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0xd80d,0x72));var _0xdd80=function(_0x516fa9,_0x3d7f4c){_0x516fa9=_0x516fa9-0x0;var _0x4007a3=_0xd80d[_0x516fa9];return _0x4007a3;};'use strict';var multer=require(_0xdd80('0x0'));var util=require(_0xdd80('0x1'));var path=require(_0xdd80('0x2'));var timeout=require(_0xdd80('0x3'));var express=require(_0xdd80('0x4'));var router=express[_0xdd80('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdd80('0x6'));var controller=require(_0xdd80('0x7'));router[_0xdd80('0x8')](_0xdd80('0x9'),auth[_0xdd80('0xa')](),controller['show']);router[_0xdd80('0xb')]('/',auth[_0xdd80('0xa')](),controller[_0xdd80('0xc')]);router[_0xdd80('0xd')](_0xdd80('0x9'),auth[_0xdd80('0xa')](),controller[_0xdd80('0xe')]);router[_0xdd80('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdd80('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 2dbd6d3..7d81d29 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 _0xb938=['sequelize','exports','first','second','third','STRING'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xb938,0x1ec));var _0x8b93=function(_0x48f143,_0x194cc3){_0x48f143=_0x48f143-0x0;var _0x295ca7=_0xb938[_0x48f143];return _0x295ca7;};'use strict';var Sequelize=require(_0x8b93('0x0'));module[_0x8b93('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x8b93('0x2'),_0x8b93('0x3'),_0x8b93('0x4')),'allowNull':![],'defaultValue':_0x8b93('0x2')},'description':{'type':Sequelize[_0x8b93('0x5')]}}; \ No newline at end of file +var _0xde78=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xde78,0xbe));var _0x8de7=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xde78[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x8de7('0x0'));module[_0x8de7('0x1')]={'name':{'type':Sequelize[_0x8de7('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x8de7('0x3')](_0x8de7('0x4'),_0x8de7('0x5'),_0x8de7('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x8de7('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 87a9c04..7ec0eba 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 _0xc569=['include','findAll','rows','show','params','rawAttributes','length','catch','create','user','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','Dispositions','UserProfileResource','sendStatus','error','index','map','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','Disposition','includeAll'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xc569,0x159));var _0x9c56=function(_0x9dc430,_0x417d97){_0x9dc430=_0x9dc430-0x0;var _0x5a940e=_0xc569[_0x9dc430];return _0x5a940e;};'use strict';var emlformat=require(_0x9c56('0x0'));var rimraf=require(_0x9c56('0x1'));var zipdir=require(_0x9c56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c56('0x3'));var moment=require(_0x9c56('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c56('0x5'));var util=require(_0x9c56('0x6'));var path=require(_0x9c56('0x7'));var sox=require('sox');var csv=require(_0x9c56('0x8'));var ejs=require(_0x9c56('0x9'));var fs=require('fs');var fs_extra=require(_0x9c56('0xa'));var _=require(_0x9c56('0xb'));var squel=require('squel');var crypto=require(_0x9c56('0xc'));var jsforce=require(_0x9c56('0xd'));var deskjs=require(_0x9c56('0xe'));var toCsv=require(_0x9c56('0x8'));var querystring=require(_0x9c56('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9c56('0x10'));var as=require(_0x9c56('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c56('0x12'))('api');var utils=require(_0x9c56('0x13'));var config=require(_0x9c56('0x14'));var licenseUtil=require(_0x9c56('0x15'));var db=require(_0x9c56('0x16'))['db'];function respondWithStatusCode(_0x43b2a9,_0x137123){_0x137123=_0x137123||0xcc;return function(_0xbec6b9){if(_0xbec6b9){return _0x43b2a9['sendStatus'](_0x137123);}return _0x43b2a9[_0x9c56('0x17')](_0x137123)[_0x9c56('0x18')]();};}function respondWithResult(_0x44c0bd,_0xbeb12d){_0xbeb12d=_0xbeb12d||0xc8;return function(_0x2f441e){if(_0x2f441e){return _0x44c0bd['status'](_0xbeb12d)[_0x9c56('0x19')](_0x2f441e);}};}function respondWithFilteredResult(_0x5217c3,_0x37d40a){return function(_0x1f16ce){if(_0x1f16ce){var _0x14ace0=typeof _0x37d40a[_0x9c56('0x1a')]===_0x9c56('0x1b')&&typeof _0x37d40a[_0x9c56('0x1c')]===_0x9c56('0x1b');var _0x36975a=_0x1f16ce[_0x9c56('0x1d')];var _0x3a63c4=_0x14ace0?0x0:_0x37d40a[_0x9c56('0x1a')];var _0x2494cc=_0x14ace0?_0x1f16ce[_0x9c56('0x1d')]:_0x37d40a[_0x9c56('0x1a')]+_0x37d40a[_0x9c56('0x1c')];var _0x4c5d66;if(_0x2494cc>=_0x36975a){_0x2494cc=_0x36975a;_0x4c5d66=0xc8;}else{_0x4c5d66=0xce;}_0x5217c3[_0x9c56('0x17')](_0x4c5d66);return _0x5217c3[_0x9c56('0x1e')](_0x9c56('0x1f'),_0x3a63c4+'-'+_0x2494cc+'/'+_0x36975a)['json'](_0x1f16ce);}return null;};}function patchUpdates(_0xf074f9){return function(_0x1f55b6){try{jsonpatch[_0x9c56('0x20')](_0x1f55b6,_0xf074f9,!![]);}catch(_0x44267e){return BPromise[_0x9c56('0x21')](_0x44267e);}return _0x1f55b6[_0x9c56('0x22')]();};}function saveUpdates(_0x27066c,_0xf4e706){return function(_0x31da15){if(_0x31da15){return _0x31da15['update'](_0x27066c)[_0x9c56('0x23')](function(_0x19ed38){return _0x19ed38;});}return null;};}function removeEntity(_0x573983,_0xe25ab2){return function(_0x1969fe){if(_0x1969fe){return _0x1969fe[_0x9c56('0x24')]()[_0x9c56('0x23')](function(){var _0x2a9f5b=_0x1969fe['get']({'plain':!![]});var _0x51336b=_0x9c56('0x25');return db[_0x9c56('0x26')]['destroy']({'where':{'type':_0x51336b,'resourceId':_0x2a9f5b['id']}})[_0x9c56('0x23')](function(){return _0x1969fe;});})['then'](function(){_0x573983['status'](0xcc)[_0x9c56('0x18')]();});}};}function handleEntityNotFound(_0x42a685,_0x3a0119){return function(_0x2cb39c){if(!_0x2cb39c){_0x42a685[_0x9c56('0x27')](0x194);}return _0x2cb39c;};}function handleError(_0x3be78d,_0x4f4c27){_0x4f4c27=_0x4f4c27||0x1f4;return function(_0x14efdf){logger[_0x9c56('0x28')](_0x14efdf['stack']);if(_0x14efdf['name']){delete _0x14efdf['name'];}_0x3be78d[_0x9c56('0x17')](_0x4f4c27)['send'](_0x14efdf);};}exports[_0x9c56('0x29')]=function(_0x3f68dd,_0x7bcf70){var _0x3a4ea9={},_0x289696={},_0x4241ae={'count':0x0,'rows':[]};var _0x5bfc92=_[_0x9c56('0x2a')](db['Disposition']['rawAttributes'],function(_0x3aa0d6){return{'name':_0x3aa0d6[_0x9c56('0x2b')],'type':_0x3aa0d6[_0x9c56('0x2c')][_0x9c56('0x2d')]};});_0x289696[_0x9c56('0x2e')]=_[_0x9c56('0x2a')](_0x5bfc92,_0x9c56('0x2f'));_0x289696[_0x9c56('0x30')]=_[_0x9c56('0x31')](_0x3f68dd[_0x9c56('0x30')]);_0x289696['filters']=_[_0x9c56('0x32')](_0x289696[_0x9c56('0x2e')],_0x289696['query']);_0x3a4ea9[_0x9c56('0x33')]=_[_0x9c56('0x32')](_0x289696[_0x9c56('0x2e')],qs[_0x9c56('0x34')](_0x3f68dd[_0x9c56('0x30')]['fields']));_0x3a4ea9[_0x9c56('0x33')]=_0x3a4ea9[_0x9c56('0x33')]['length']?_0x3a4ea9['attributes']:_0x289696[_0x9c56('0x2e')];if(!_0x3f68dd[_0x9c56('0x30')][_0x9c56('0x35')]('nolimit')){_0x3a4ea9[_0x9c56('0x1c')]=qs[_0x9c56('0x1c')](_0x3f68dd[_0x9c56('0x30')][_0x9c56('0x1c')]);_0x3a4ea9['offset']=qs[_0x9c56('0x1a')](_0x3f68dd['query']['offset']);}_0x3a4ea9[_0x9c56('0x36')]=qs[_0x9c56('0x37')](_0x3f68dd[_0x9c56('0x30')][_0x9c56('0x37')]);_0x3a4ea9[_0x9c56('0x38')]=qs[_0x9c56('0x39')](_[_0x9c56('0x3a')](_0x3f68dd[_0x9c56('0x30')],_0x289696[_0x9c56('0x39')]),_0x5bfc92);if(_0x3f68dd[_0x9c56('0x30')]['filter']){_0x3a4ea9['where']=_[_0x9c56('0x3b')](_0x3a4ea9[_0x9c56('0x38')],{'$or':_['map'](_0x5bfc92,function(_0x212227){if(_0x212227[_0x9c56('0x2c')]!==_0x9c56('0x3c')){var _0x1c7945={};_0x1c7945[_0x212227[_0x9c56('0x2f')]]={'$like':'%'+_0x3f68dd[_0x9c56('0x30')][_0x9c56('0x3d')]+'%'};return _0x1c7945;}})});}_0x3a4ea9=_[_0x9c56('0x3b')]({},_0x3a4ea9,_0x3f68dd[_0x9c56('0x3e')]);var _0x2bbf2e={'where':_0x3a4ea9[_0x9c56('0x38')]};return db[_0x9c56('0x3f')][_0x9c56('0x1d')](_0x2bbf2e)[_0x9c56('0x23')](function(_0x10c659){_0x4241ae[_0x9c56('0x1d')]=_0x10c659;if(_0x3f68dd[_0x9c56('0x30')][_0x9c56('0x40')]){_0x3a4ea9[_0x9c56('0x41')]=[{'all':!![]}];}return db[_0x9c56('0x3f')][_0x9c56('0x42')](_0x3a4ea9);})[_0x9c56('0x23')](function(_0x15cc65){_0x4241ae[_0x9c56('0x43')]=_0x15cc65;return _0x4241ae;})['then'](respondWithFilteredResult(_0x7bcf70,_0x3a4ea9))['catch'](handleError(_0x7bcf70,null));};exports[_0x9c56('0x44')]=function(_0x20cd64,_0x25eeed){var _0x28bcd9={'raw':!![],'where':{'id':_0x20cd64[_0x9c56('0x45')]['id']}},_0x2e3d12={};_0x2e3d12[_0x9c56('0x2e')]=_[_0x9c56('0x31')](db['Disposition'][_0x9c56('0x46')]);_0x2e3d12[_0x9c56('0x30')]=_[_0x9c56('0x31')](_0x20cd64[_0x9c56('0x30')]);_0x2e3d12['filters']=_['intersection'](_0x2e3d12[_0x9c56('0x2e')],_0x2e3d12[_0x9c56('0x30')]);_0x28bcd9[_0x9c56('0x33')]=_[_0x9c56('0x32')](_0x2e3d12[_0x9c56('0x2e')],qs[_0x9c56('0x34')](_0x20cd64[_0x9c56('0x30')][_0x9c56('0x34')]));_0x28bcd9[_0x9c56('0x33')]=_0x28bcd9['attributes'][_0x9c56('0x47')]?_0x28bcd9[_0x9c56('0x33')]:_0x2e3d12['model'];if(_0x20cd64[_0x9c56('0x30')][_0x9c56('0x40')]){_0x28bcd9['include']=[{'all':!![]}];}_0x28bcd9=_[_0x9c56('0x3b')]({},_0x28bcd9,_0x20cd64[_0x9c56('0x3e')]);return db['Disposition']['find'](_0x28bcd9)['then'](handleEntityNotFound(_0x25eeed,null))['then'](respondWithResult(_0x25eeed,null))[_0x9c56('0x48')](handleError(_0x25eeed,null));};exports[_0x9c56('0x49')]=function(_0x1d01b5,_0x457c79){return db['Disposition'][_0x9c56('0x49')](_0x1d01b5['body'],{})['then'](function(_0x292e8f){var _0x282bc2=_0x1d01b5['user']['get']({'plain':!![]});if(!_0x282bc2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x282bc2['role']===_0x9c56('0x4a')){var _0x3ee3a9=_0x292e8f[_0x9c56('0x4b')]({'plain':!![]});var _0x5315c6='Dispositions';return db[_0x9c56('0x4c')][_0x9c56('0x4d')]({'where':{'name':_0x5315c6,'userProfileId':_0x282bc2[_0x9c56('0x4e')]},'raw':!![]})['then'](function(_0x180ec0){if(_0x180ec0&&_0x180ec0['autoAssociation']===0x0){return db[_0x9c56('0x26')][_0x9c56('0x49')]({'name':_0x3ee3a9[_0x9c56('0x2f')],'resourceId':_0x3ee3a9['id'],'type':_0x180ec0['name'],'sectionId':_0x180ec0['id']},{})['then'](function(){return _0x292e8f;});}else{return _0x292e8f;}})[_0x9c56('0x48')](function(_0x2a18af){logger['error'](_0x9c56('0x4f'),_0x2a18af);throw _0x2a18af;});}return _0x292e8f;})[_0x9c56('0x23')](respondWithResult(_0x457c79,0xc9))[_0x9c56('0x48')](handleError(_0x457c79,null));};exports[_0x9c56('0x50')]=function(_0x2a55c7,_0x116a1d){if(_0x2a55c7['body']['id']){delete _0x2a55c7[_0x9c56('0x51')]['id'];}return db[_0x9c56('0x3f')][_0x9c56('0x4d')]({'where':{'id':_0x2a55c7[_0x9c56('0x45')]['id']}})[_0x9c56('0x23')](handleEntityNotFound(_0x116a1d,null))['then'](saveUpdates(_0x2a55c7[_0x9c56('0x51')],null))[_0x9c56('0x23')](respondWithResult(_0x116a1d,null))['catch'](handleError(_0x116a1d,null));};exports[_0x9c56('0x24')]=function(_0x2b427e,_0x445811){return db[_0x9c56('0x3f')][_0x9c56('0x4d')]({'where':{'id':_0x2b427e['params']['id']}})[_0x9c56('0x23')](handleEntityNotFound(_0x445811,null))['then'](removeEntity(_0x445811,null))[_0x9c56('0x48')](handleError(_0x445811,null));}; \ No newline at end of file +var _0x80d5=['UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Dispositions'];(function(_0x53b7df,_0xdd8632){var _0x384866=function(_0x768494){while(--_0x768494){_0x53b7df['push'](_0x53b7df['shift']());}};_0x384866(++_0xdd8632);}(_0x80d5,0x186));var _0x580d=function(_0x55bbd0,_0x12e624){_0x55bbd0=_0x55bbd0-0x0;var _0x4d44a6=_0x80d5[_0x55bbd0];return _0x4d44a6;};'use strict';var emlformat=require(_0x580d('0x0'));var rimraf=require(_0x580d('0x1'));var zipdir=require(_0x580d('0x2'));var jsonpatch=require(_0x580d('0x3'));var rp=require(_0x580d('0x4'));var moment=require(_0x580d('0x5'));var BPromise=require(_0x580d('0x6'));var Mustache=require(_0x580d('0x7'));var util=require(_0x580d('0x8'));var path=require(_0x580d('0x9'));var sox=require(_0x580d('0xa'));var csv=require(_0x580d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x580d('0xc'));var squel=require(_0x580d('0xd'));var crypto=require(_0x580d('0xe'));var jsforce=require(_0x580d('0xf'));var deskjs=require(_0x580d('0x10'));var toCsv=require(_0x580d('0xb'));var querystring=require(_0x580d('0x11'));var Papa=require(_0x580d('0x12'));var Redis=require(_0x580d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x580d('0x14'));var as=require(_0x580d('0x15'));var hardwareService=require(_0x580d('0x16'));var logger=require(_0x580d('0x17'))(_0x580d('0x18'));var utils=require(_0x580d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x580d('0x1a'));var db=require(_0x580d('0x1b'))['db'];function respondWithStatusCode(_0x48477b,_0x19b04b){_0x19b04b=_0x19b04b||0xcc;return function(_0x34355e){if(_0x34355e){return _0x48477b[_0x580d('0x1c')](_0x19b04b);}return _0x48477b[_0x580d('0x1d')](_0x19b04b)[_0x580d('0x1e')]();};}function respondWithResult(_0x184d3e,_0x37d6d2){_0x37d6d2=_0x37d6d2||0xc8;return function(_0x2f671f){if(_0x2f671f){return _0x184d3e['status'](_0x37d6d2)[_0x580d('0x1f')](_0x2f671f);}};}function respondWithFilteredResult(_0x3e0d4c,_0x2223ee){return function(_0x3915f4){if(_0x3915f4){var _0x1a6c19=typeof _0x2223ee[_0x580d('0x20')]===_0x580d('0x21')&&typeof _0x2223ee[_0x580d('0x22')]===_0x580d('0x21');var _0x4dff2e=_0x3915f4[_0x580d('0x23')];var _0x20946e=_0x1a6c19?0x0:_0x2223ee[_0x580d('0x20')];var _0x2c9a7c=_0x1a6c19?_0x3915f4['count']:_0x2223ee['offset']+_0x2223ee[_0x580d('0x22')];var _0x49f9d7;if(_0x2c9a7c>=_0x4dff2e){_0x2c9a7c=_0x4dff2e;_0x49f9d7=0xc8;}else{_0x49f9d7=0xce;}_0x3e0d4c['status'](_0x49f9d7);return _0x3e0d4c[_0x580d('0x24')](_0x580d('0x25'),_0x20946e+'-'+_0x2c9a7c+'/'+_0x4dff2e)[_0x580d('0x1f')](_0x3915f4);}return null;};}function patchUpdates(_0x1ddb26){return function(_0x1e670b){try{jsonpatch[_0x580d('0x26')](_0x1e670b,_0x1ddb26,!![]);}catch(_0x21be9e){return BPromise[_0x580d('0x27')](_0x21be9e);}return _0x1e670b[_0x580d('0x28')]();};}function saveUpdates(_0x1e4b1a,_0x28c976){return function(_0x51afa5){if(_0x51afa5){return _0x51afa5['update'](_0x1e4b1a)[_0x580d('0x29')](function(_0x2e66b4){return _0x2e66b4;});}return null;};}function removeEntity(_0x525b95,_0x4ec597){return function(_0x5c7641){if(_0x5c7641){return _0x5c7641[_0x580d('0x2a')]()[_0x580d('0x29')](function(){var _0x4e1dae=_0x5c7641[_0x580d('0x2b')]({'plain':!![]});var _0x3f8659=_0x580d('0x2c');return db[_0x580d('0x2d')]['destroy']({'where':{'type':_0x3f8659,'resourceId':_0x4e1dae['id']}})[_0x580d('0x29')](function(){return _0x5c7641;});})[_0x580d('0x29')](function(){_0x525b95['status'](0xcc)[_0x580d('0x1e')]();});}};}function handleEntityNotFound(_0x3362bb,_0x3a73e3){return function(_0x4de3a9){if(!_0x4de3a9){_0x3362bb[_0x580d('0x1c')](0x194);}return _0x4de3a9;};}function handleError(_0x36077d,_0x16cecd){_0x16cecd=_0x16cecd||0x1f4;return function(_0x266885){logger['error'](_0x266885[_0x580d('0x2e')]);if(_0x266885[_0x580d('0x2f')]){delete _0x266885[_0x580d('0x2f')];}_0x36077d[_0x580d('0x1d')](_0x16cecd)[_0x580d('0x30')](_0x266885);};}exports[_0x580d('0x31')]=function(_0x4846ea,_0x5dfe63){var _0x140a74={},_0x407984={},_0x75720={'count':0x0,'rows':[]};var _0x4953da=_[_0x580d('0x32')](db[_0x580d('0x33')][_0x580d('0x34')],function(_0x2be5e3){return{'name':_0x2be5e3['fieldName'],'type':_0x2be5e3[_0x580d('0x35')][_0x580d('0x36')]};});_0x407984['model']=_[_0x580d('0x32')](_0x4953da,'name');_0x407984[_0x580d('0x37')]=_[_0x580d('0x38')](_0x4846ea[_0x580d('0x37')]);_0x407984[_0x580d('0x39')]=_[_0x580d('0x3a')](_0x407984[_0x580d('0x3b')],_0x407984[_0x580d('0x37')]);_0x140a74[_0x580d('0x3c')]=_['intersection'](_0x407984[_0x580d('0x3b')],qs[_0x580d('0x3d')](_0x4846ea['query'][_0x580d('0x3d')]));_0x140a74[_0x580d('0x3c')]=_0x140a74[_0x580d('0x3c')][_0x580d('0x3e')]?_0x140a74['attributes']:_0x407984[_0x580d('0x3b')];if(!_0x4846ea['query']['hasOwnProperty']('nolimit')){_0x140a74[_0x580d('0x22')]=qs[_0x580d('0x22')](_0x4846ea[_0x580d('0x37')][_0x580d('0x22')]);_0x140a74[_0x580d('0x20')]=qs[_0x580d('0x20')](_0x4846ea[_0x580d('0x37')][_0x580d('0x20')]);}_0x140a74[_0x580d('0x3f')]=qs['sort'](_0x4846ea[_0x580d('0x37')]['sort']);_0x140a74['where']=qs[_0x580d('0x39')](_[_0x580d('0x40')](_0x4846ea[_0x580d('0x37')],_0x407984[_0x580d('0x39')]),_0x4953da);if(_0x4846ea['query']['filter']){_0x140a74[_0x580d('0x41')]=_['merge'](_0x140a74[_0x580d('0x41')],{'$or':_[_0x580d('0x32')](_0x4953da,function(_0x14358a){if(_0x14358a[_0x580d('0x35')]!==_0x580d('0x42')){var _0x226e2d={};_0x226e2d[_0x14358a['name']]={'$like':'%'+_0x4846ea[_0x580d('0x37')]['filter']+'%'};return _0x226e2d;}})});}_0x140a74=_[_0x580d('0x43')]({},_0x140a74,_0x4846ea[_0x580d('0x44')]);var _0x542be5={'where':_0x140a74[_0x580d('0x41')]};return db['Disposition']['count'](_0x542be5)['then'](function(_0x2e8cde){_0x75720[_0x580d('0x23')]=_0x2e8cde;if(_0x4846ea[_0x580d('0x37')][_0x580d('0x45')]){_0x140a74[_0x580d('0x46')]=[{'all':!![]}];}return db[_0x580d('0x33')][_0x580d('0x47')](_0x140a74);})[_0x580d('0x29')](function(_0xf7cdb5){_0x75720[_0x580d('0x48')]=_0xf7cdb5;return _0x75720;})[_0x580d('0x29')](respondWithFilteredResult(_0x5dfe63,_0x140a74))[_0x580d('0x49')](handleError(_0x5dfe63,null));};exports[_0x580d('0x4a')]=function(_0x4095bb,_0x53978){var _0x1a7bb2={'raw':!![],'where':{'id':_0x4095bb[_0x580d('0x4b')]['id']}},_0x4412ac={};_0x4412ac[_0x580d('0x3b')]=_[_0x580d('0x38')](db[_0x580d('0x33')][_0x580d('0x34')]);_0x4412ac['query']=_[_0x580d('0x38')](_0x4095bb[_0x580d('0x37')]);_0x4412ac[_0x580d('0x39')]=_[_0x580d('0x3a')](_0x4412ac['model'],_0x4412ac['query']);_0x1a7bb2[_0x580d('0x3c')]=_[_0x580d('0x3a')](_0x4412ac[_0x580d('0x3b')],qs[_0x580d('0x3d')](_0x4095bb[_0x580d('0x37')][_0x580d('0x3d')]));_0x1a7bb2[_0x580d('0x3c')]=_0x1a7bb2[_0x580d('0x3c')][_0x580d('0x3e')]?_0x1a7bb2[_0x580d('0x3c')]:_0x4412ac[_0x580d('0x3b')];if(_0x4095bb[_0x580d('0x37')]['includeAll']){_0x1a7bb2[_0x580d('0x46')]=[{'all':!![]}];}_0x1a7bb2=_[_0x580d('0x43')]({},_0x1a7bb2,_0x4095bb[_0x580d('0x44')]);return db[_0x580d('0x33')][_0x580d('0x4c')](_0x1a7bb2)[_0x580d('0x29')](handleEntityNotFound(_0x53978,null))['then'](respondWithResult(_0x53978,null))[_0x580d('0x49')](handleError(_0x53978,null));};exports[_0x580d('0x4d')]=function(_0x150444,_0xe6b1ad){return db['Disposition']['create'](_0x150444[_0x580d('0x4e')],{})[_0x580d('0x29')](function(_0x913aac){var _0x41b60a=_0x150444[_0x580d('0x4f')][_0x580d('0x2b')]({'plain':!![]});if(!_0x41b60a)throw new Error(_0x580d('0x50'));if(_0x41b60a['role']===_0x580d('0x4f')){var _0x18ce00=_0x913aac['get']({'plain':!![]});var _0x1619b3=_0x580d('0x2c');return db[_0x580d('0x51')][_0x580d('0x4c')]({'where':{'name':_0x1619b3,'userProfileId':_0x41b60a[_0x580d('0x52')]},'raw':!![]})[_0x580d('0x29')](function(_0x52594c){if(_0x52594c&&_0x52594c[_0x580d('0x53')]===0x0){return db['UserProfileResource'][_0x580d('0x4d')]({'name':_0x18ce00[_0x580d('0x2f')],'resourceId':_0x18ce00['id'],'type':_0x52594c['name'],'sectionId':_0x52594c['id']},{})['then'](function(){return _0x913aac;});}else{return _0x913aac;}})['catch'](function(_0x45ee78){logger[_0x580d('0x54')](_0x580d('0x55'),_0x45ee78);throw _0x45ee78;});}return _0x913aac;})['then'](respondWithResult(_0xe6b1ad,0xc9))['catch'](handleError(_0xe6b1ad,null));};exports[_0x580d('0x56')]=function(_0x180050,_0x356fcc){if(_0x180050[_0x580d('0x4e')]['id']){delete _0x180050[_0x580d('0x4e')]['id'];}return db['Disposition'][_0x580d('0x4c')]({'where':{'id':_0x180050[_0x580d('0x4b')]['id']}})[_0x580d('0x29')](handleEntityNotFound(_0x356fcc,null))[_0x580d('0x29')](saveUpdates(_0x180050['body'],null))[_0x580d('0x29')](respondWithResult(_0x356fcc,null))['catch'](handleError(_0x356fcc,null));};exports[_0x580d('0x2a')]=function(_0x304b6e,_0xdec5f){return db['Disposition']['find']({'where':{'id':_0x304b6e[_0x580d('0x4b')]['id']}})[_0x580d('0x29')](handleEntityNotFound(_0xdec5f,null))['then'](removeEntity(_0xdec5f,null))[_0x580d('0x49')](handleError(_0xdec5f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 9a19682..724fea5 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 _0x2944=['WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2944,0x1dc));var _0x4294=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x2944[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x4294('0x0'));var util=require(_0x4294('0x1'));var logger=require('../../config/logger')(_0x4294('0x2'));var moment=require(_0x4294('0x3'));var BPromise=require(_0x4294('0x4'));var rp=require(_0x4294('0x5'));var fs=require('fs');var path=require(_0x4294('0x6'));var rimraf=require(_0x4294('0x7'));var config=require(_0x4294('0x8'));var attributes=require('./disposition.attributes');module[_0x4294('0x9')]=function(_0x403793,_0xec40e9){return _0x403793[_0x4294('0xa')](_0x4294('0xb'),attributes,{'tableName':_0x4294('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4294('0xd'),'fields':[_0x4294('0xe'),_0x4294('0xf')]},{'unique':!![],'name':'name_chat','fields':['name',_0x4294('0x10')]},{'unique':!![],'name':_0x4294('0x11'),'fields':[_0x4294('0xe'),_0x4294('0x12')]},{'unique':!![],'name':_0x4294('0x13'),'fields':['name',_0x4294('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0x4294('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x4294('0x15'),'fields':['name',_0x4294('0x16')]},{'unique':!![],'name':_0x4294('0x17'),'fields':[_0x4294('0xe'),_0x4294('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b9d=['define','Disposition','tools_dispositions','name','ListId','name_chat','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x238b75,_0x389992){var _0x236aff=function(_0x44fece){while(--_0x44fece){_0x238b75['push'](_0x238b75['shift']());}};_0x236aff(++_0x389992);}(_0x4b9d,0x1c3));var _0xd4b9=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x4b9d[_0x7275e9];return _0x17b99d;};'use strict';var _=require(_0xd4b9('0x0'));var util=require(_0xd4b9('0x1'));var logger=require('../../config/logger')(_0xd4b9('0x2'));var moment=require(_0xd4b9('0x3'));var BPromise=require('bluebird');var rp=require(_0xd4b9('0x4'));var fs=require('fs');var path=require(_0xd4b9('0x5'));var rimraf=require(_0xd4b9('0x6'));var config=require(_0xd4b9('0x7'));var attributes=require('./disposition.attributes');module[_0xd4b9('0x8')]=function(_0x58e9f1,_0x3cd18c){return _0x58e9f1[_0xd4b9('0x9')](_0xd4b9('0xa'),attributes,{'tableName':_0xd4b9('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xd4b9('0xc'),_0xd4b9('0xd')]},{'unique':!![],'name':_0xd4b9('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xd4b9('0xf'),'fields':['name',_0xd4b9('0x10')]},{'unique':!![],'name':_0xd4b9('0x11'),'fields':[_0xd4b9('0xc'),'SmsAccountId']},{'unique':!![],'name':_0xd4b9('0x12'),'fields':[_0xd4b9('0xc'),_0xd4b9('0x13')]},{'unique':!![],'name':_0xd4b9('0x14'),'fields':[_0xd4b9('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0xd4b9('0x15'),'fields':[_0xd4b9('0xc'),_0xd4b9('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index bc85590..87cfc33 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(_0x354ce3,_0x62b505){var _0x123067=function(_0x1a5cdb){while(--_0x1a5cdb){_0x354ce3['push'](_0x354ce3['shift']());}};_0x123067(++_0x62b505);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x23540e,_0x7082fb){var _0x31ba8f=function(_0x3969b1){while(--_0x3969b1){_0x23540e['push'](_0x23540e['shift']());}};_0x31ba8f(++_0x7082fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 ae6c862..0c34242 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 _0x55fd=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x55fd,0x95));var _0xd55f=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x55fd[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0xd55f('0x0'));var util=require(_0xd55f('0x1'));var path=require(_0xd55f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd55f('0x3'));var router=express[_0xd55f('0x4')]();var fs_extra=require(_0xd55f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd55f('0x6'));var config=require(_0xd55f('0x7'));var controller=require(_0xd55f('0x8'));router[_0xd55f('0x9')]('/',auth[_0xd55f('0xa')](),controller[_0xd55f('0xb')]);router[_0xd55f('0x9')](_0xd55f('0xc'),auth[_0xd55f('0xa')](),controller[_0xd55f('0xd')]);router[_0xd55f('0xe')]('/',auth[_0xd55f('0xa')](),controller[_0xd55f('0xf')]);router[_0xd55f('0x10')](_0xd55f('0xc'),auth[_0xd55f('0xa')](),controller[_0xd55f('0x11')]);router[_0xd55f('0x12')](_0xd55f('0xc'),auth[_0xd55f('0xa')](),controller[_0xd55f('0x13')]);module[_0xd55f('0x14')]=router; \ No newline at end of file +var _0x43ad=['./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x149947,_0x34b5d6){var _0x1169c9=function(_0x53c932){while(--_0x53c932){_0x149947['push'](_0x149947['shift']());}};_0x1169c9(++_0x34b5d6);}(_0x43ad,0xd1));var _0xd43a=function(_0xbe694d,_0x3893d4){_0xbe694d=_0xbe694d-0x0;var _0x517acf=_0x43ad[_0xbe694d];return _0x517acf;};'use strict';var multer=require(_0xd43a('0x0'));var util=require(_0xd43a('0x1'));var path=require(_0xd43a('0x2'));var timeout=require(_0xd43a('0x3'));var express=require(_0xd43a('0x4'));var router=express[_0xd43a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd43a('0x6'));var controller=require(_0xd43a('0x7'));router['get']('/',auth[_0xd43a('0x8')](),controller[_0xd43a('0x9')]);router[_0xd43a('0xa')](_0xd43a('0xb'),auth[_0xd43a('0x8')](),controller[_0xd43a('0xc')]);router[_0xd43a('0xd')]('/',auth[_0xd43a('0x8')](),controller[_0xd43a('0xe')]);router['put'](_0xd43a('0xb'),auth[_0xd43a('0x8')](),controller[_0xd43a('0xf')]);router['delete']('/:id',auth[_0xd43a('0x8')](),controller[_0xd43a('0x10')]);module[_0xd43a('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 d16d7eb..31e13c4 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 _0x91b1=['9600','12000','14400','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','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200'];(function(_0x2a343e,_0x513981){var _0x4aec98=function(_0xdc55bf){while(--_0xdc55bf){_0x2a343e['push'](_0x2a343e['shift']());}};_0x4aec98(++_0x513981);}(_0x91b1,0x195));var _0x191b=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x91b1[_0x30033a];return _0x5e3518;};'use strict';var Sequelize=require(_0x191b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x191b('0x1')]},'ecm':{'type':Sequelize[_0x191b('0x2')](_0x191b('0x3'),'no'),'defaultValue':_0x191b('0x3')},'headerinfo':{'type':Sequelize[_0x191b('0x1')],'defaultValue':_0x191b('0x4')},'localstationid':{'type':Sequelize[_0x191b('0x1')],'unique':_0x191b('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x191b('0x6'),_0x191b('0x7'),_0x191b('0x8'),_0x191b('0x9'),_0x191b('0xa'),_0x191b('0xb')),'defaultValue':_0x191b('0x7')},'maxrate':{'type':Sequelize[_0x191b('0x2')]('2400',_0x191b('0x7'),_0x191b('0x8'),_0x191b('0x9'),_0x191b('0xa'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x191b('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x191b('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x191b('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x191b('0xd'),_0x191b('0xe'),_0x191b('0xf'),_0x191b('0x10')),'defaultValue':_0x191b('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x191b('0x11')],'defaultValue':function(){return _0x191b('0x12');}},'notificationSound':{'type':Sequelize[_0x191b('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x191b('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x191b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x191b('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x191b('0x13')],'defaultValue':![],'comment':_0x191b('0x14'),'set':function(_0x29cf96){if(!_0x29cf96)this[_0x191b('0x15')]('mandatoryDispositionPauseId',null);this[_0x191b('0x15')](_0x191b('0x16'),_0x29cf96);}}}; \ No newline at end of file +var _0xe856=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','7200','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING'];(function(_0x464c67,_0x3cefd6){var _0x51b2a8=function(_0xca358c){while(--_0xca358c){_0x464c67['push'](_0x464c67['shift']());}};_0x51b2a8(++_0x3cefd6);}(_0xe856,0x1ae));var _0x6e85=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe856[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x6e85('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e85('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6e85('0x1')]},'ecm':{'type':Sequelize[_0x6e85('0x2')](_0x6e85('0x3'),'no'),'defaultValue':_0x6e85('0x3')},'headerinfo':{'type':Sequelize[_0x6e85('0x1')],'defaultValue':_0x6e85('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6e85('0x5')},'minrate':{'type':Sequelize[_0x6e85('0x2')](_0x6e85('0x6'),_0x6e85('0x7'),'7200',_0x6e85('0x8'),'12000',_0x6e85('0x9')),'defaultValue':_0x6e85('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400','4800',_0x6e85('0xa'),_0x6e85('0x8'),_0x6e85('0xb'),_0x6e85('0x9')),'defaultValue':_0x6e85('0x9')},'modem':{'type':Sequelize[_0x6e85('0x1')],'defaultValue':_0x6e85('0xc')},'gateway':{'type':Sequelize[_0x6e85('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6e85('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6e85('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x6e85('0xe'),_0x6e85('0xf'),_0x6e85('0x10'),_0x6e85('0x11')),'defaultValue':_0x6e85('0xe')},'key':{'type':Sequelize[_0x6e85('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6e85('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6e85('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e85('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6e85('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e85('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e85('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e85('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x6e85('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x6e85('0x13')],'defaultValue':![],'comment':_0x6e85('0x15'),'set':function(_0x30baf0){if(!_0x30baf0)this[_0x6e85('0x16')]('mandatoryDispositionPauseId',null);this[_0x6e85('0x16')](_0x6e85('0x17'),_0x30baf0);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 64ea57f..cc8c1fb 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 _0x1129=['split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','List\x20not\x20found','Send\x20Fax\x20failed','out','Contact\x20not\x20found','spread','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./faxAccount.socket','register','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','query','attributes','fields','length','nolimit','sort','pick','filters','where','merge','options','includeAll','include','rows','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','order','filter','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','Contact','User','Owner','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','priority','stack','finally','getApplications','context','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','localstationid','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte'];(function(_0x63eabd,_0x2d29df){var _0x59191b=function(_0x16bc7b){while(--_0x16bc7b){_0x63eabd['push'](_0x63eabd['shift']());}};_0x59191b(++_0x2d29df);}(_0x1129,0x1a3));var _0x9112=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1129[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9112('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9112('0x1'));var jsonpatch=require(_0x9112('0x2'));var rp=require(_0x9112('0x3'));var moment=require(_0x9112('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9112('0x5'));var path=require(_0x9112('0x6'));var sox=require(_0x9112('0x7'));var csv=require(_0x9112('0x8'));var ejs=require(_0x9112('0x9'));var fs=require('fs');var fs_extra=require(_0x9112('0xa'));var _=require('lodash');var squel=require(_0x9112('0xb'));var crypto=require('crypto');var jsforce=require(_0x9112('0xc'));var deskjs=require(_0x9112('0xd'));var toCsv=require(_0x9112('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9112('0xe'));var qs=require(_0x9112('0xf'));var as=require(_0x9112('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9112('0x11'));var utils=require(_0x9112('0x12'));var config=require(_0x9112('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9112('0x14'))['db'];config[_0x9112('0x15')]=_[_0x9112('0x16')](config[_0x9112('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9112('0x17'))[_0x9112('0x18')](socket);var jayson=require(_0x9112('0x19'));var client=jayson['client'][_0x9112('0x1a')]({'port':0x232c});var client9002=jayson[_0x9112('0x1b')][_0x9112('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1ef6ea,_0x389ee9,_0x5038e9,_0x2ea8bd){return new BPromise(function(_0x51e29e,_0x58f2a1){var _0x180f2d=_0x2ea8bd||client;return _0x180f2d[_0x9112('0x1c')](_0x1ef6ea,_0x5038e9)[_0x9112('0x1d')](function(_0x11b5ff){logger[_0x9112('0x1e')](_0x9112('0x1f'),_0x389ee9,_0x9112('0x20'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x389ee9,_0x9112('0x20'),JSON['stringify'](_0x11b5ff));if(_0x11b5ff[_0x9112('0x21')]){if(_0x11b5ff[_0x9112('0x21')]['code']===0x1f4){logger[_0x9112('0x21')]('FaxAccount,\x20%s,\x20%s',_0x389ee9,_0x11b5ff[_0x9112('0x21')][_0x9112('0x22')]);return _0x58f2a1(_0x11b5ff[_0x9112('0x21')][_0x9112('0x22')]);}logger[_0x9112('0x21')](_0x9112('0x1f'),_0x389ee9,_0x11b5ff[_0x9112('0x21')][_0x9112('0x22')]);return _0x51e29e(_0x11b5ff[_0x9112('0x21')][_0x9112('0x22')]);}else{logger['info'](_0x9112('0x1f'),_0x389ee9,_0x9112('0x20'));_0x51e29e(_0x11b5ff[_0x9112('0x23')]['message']);}})[_0x9112('0x24')](function(_0x35f446){logger[_0x9112('0x21')]('FaxAccount,\x20%s,\x20%s',_0x389ee9,_0x35f446);_0x58f2a1(_0x35f446);});});}function respondWithStatusCode(_0xb144ba,_0x316cb4){_0x316cb4=_0x316cb4||0xcc;return function(_0x2501ff){if(_0x2501ff){return _0xb144ba[_0x9112('0x25')](_0x316cb4);}return _0xb144ba[_0x9112('0x26')](_0x316cb4)[_0x9112('0x27')]();};}function respondWithResult(_0x234aeb,_0x1406c7){_0x1406c7=_0x1406c7||0xc8;return function(_0x4736fe){if(_0x4736fe){return _0x234aeb[_0x9112('0x26')](_0x1406c7)[_0x9112('0x28')](_0x4736fe);}};}function respondWithFilteredResult(_0x314715,_0x8ec36c){return function(_0x461653){if(_0x461653){var _0x5028c4=typeof _0x8ec36c[_0x9112('0x29')]===_0x9112('0x2a')&&typeof _0x8ec36c[_0x9112('0x2b')]===_0x9112('0x2a');var _0xcab20c=_0x461653['count'];var _0x276492=_0x5028c4?0x0:_0x8ec36c[_0x9112('0x29')];var _0x3afc35=_0x5028c4?_0x461653[_0x9112('0x2c')]:_0x8ec36c[_0x9112('0x29')]+_0x8ec36c['limit'];var _0x48b9c2;if(_0x3afc35>=_0xcab20c){_0x3afc35=_0xcab20c;_0x48b9c2=0xc8;}else{_0x48b9c2=0xce;}_0x314715['status'](_0x48b9c2);return _0x314715[_0x9112('0x2d')](_0x9112('0x2e'),_0x276492+'-'+_0x3afc35+'/'+_0xcab20c)[_0x9112('0x28')](_0x461653);}return null;};}function patchUpdates(_0x52901e){return function(_0x571bc2){try{jsonpatch[_0x9112('0x2f')](_0x571bc2,_0x52901e,!![]);}catch(_0x271a01){return BPromise[_0x9112('0x30')](_0x271a01);}return _0x571bc2['save']();};}function saveUpdates(_0x19725a,_0x500f08){return function(_0x28e464){if(_0x28e464){return _0x28e464[_0x9112('0x31')](_0x19725a)[_0x9112('0x1d')](function(_0x5e8eeb){return _0x5e8eeb;});}return null;};}function removeEntity(_0x4f209e,_0x5a3a45){return function(_0x256da9){if(_0x256da9){return _0x256da9[_0x9112('0x32')]()[_0x9112('0x1d')](function(){var _0xd17720=_0x256da9['get']({'plain':!![]});var _0x534b95=_0x9112('0x33');return db[_0x9112('0x34')][_0x9112('0x32')]({'where':{'type':_0x534b95,'resourceId':_0xd17720['id']}})[_0x9112('0x1d')](function(){return _0x256da9;});})[_0x9112('0x1d')](function(){_0x4f209e[_0x9112('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d02ac,_0x353279){return function(_0x7e1599){if(!_0x7e1599){_0x2d02ac[_0x9112('0x25')](0x194);}return _0x7e1599;};}function handleError(_0x3b0f43,_0x4e3599){_0x4e3599=_0x4e3599||0x1f4;return function(_0x576e02){logger['error'](_0x576e02['stack']);if(_0x576e02[_0x9112('0x35')]){delete _0x576e02['name'];}_0x3b0f43[_0x9112('0x26')](_0x4e3599)[_0x9112('0x36')](_0x576e02);};}exports[_0x9112('0x37')]=function(_0x3c3a68,_0x1d8044){var _0x5a6eb0={'include':[{'model':db[_0x9112('0x38')],'as':_0x9112('0x39')}]},_0x32242b={},_0x1753ec={'count':0x0,'rows':[]};var _0x1c0972=_[_0x9112('0x3a')](db[_0x9112('0x3b')][_0x9112('0x3c')],function(_0x40bf96){return{'name':_0x40bf96['fieldName'],'type':_0x40bf96[_0x9112('0x3d')][_0x9112('0x3e')]};});_0x32242b[_0x9112('0x3f')]=_['map'](_0x1c0972,_0x9112('0x35'));_0x32242b[_0x9112('0x40')]=_['keys'](_0x3c3a68[_0x9112('0x40')]);_0x32242b['filters']=_['intersection'](_0x32242b[_0x9112('0x3f')],_0x32242b[_0x9112('0x40')]);_0x5a6eb0[_0x9112('0x41')]=_['intersection'](_0x32242b[_0x9112('0x3f')],qs[_0x9112('0x42')](_0x3c3a68[_0x9112('0x40')]['fields']));_0x5a6eb0[_0x9112('0x41')]=_0x5a6eb0['attributes'][_0x9112('0x43')]?_0x5a6eb0['attributes']:_0x32242b['model'];if(!_0x3c3a68[_0x9112('0x40')]['hasOwnProperty'](_0x9112('0x44'))){_0x5a6eb0[_0x9112('0x2b')]=qs[_0x9112('0x2b')](_0x3c3a68[_0x9112('0x40')][_0x9112('0x2b')]);_0x5a6eb0['offset']=qs[_0x9112('0x29')](_0x3c3a68[_0x9112('0x40')]['offset']);}_0x5a6eb0['order']=qs[_0x9112('0x45')](_0x3c3a68[_0x9112('0x40')]['sort']);_0x5a6eb0['where']=qs['filters'](_[_0x9112('0x46')](_0x3c3a68[_0x9112('0x40')],_0x32242b[_0x9112('0x47')]),_0x1c0972);if(_0x3c3a68[_0x9112('0x40')]['filter']){_0x5a6eb0[_0x9112('0x48')]=_[_0x9112('0x49')](_0x5a6eb0[_0x9112('0x48')],{'$or':_['map'](_0x1c0972,function(_0x3ddca9){if(_0x3ddca9[_0x9112('0x3d')]!=='VIRTUAL'){var _0x3df3b4={};_0x3df3b4[_0x3ddca9[_0x9112('0x35')]]={'$like':'%'+_0x3c3a68['query']['filter']+'%'};return _0x3df3b4;}})});}_0x5a6eb0=_[_0x9112('0x49')]({},_0x5a6eb0,_0x3c3a68[_0x9112('0x4a')]);var _0x41d171={'where':_0x5a6eb0[_0x9112('0x48')]};return db[_0x9112('0x3b')]['count'](_0x41d171)['then'](function(_0x2979d8){_0x1753ec['count']=_0x2979d8;if(_0x3c3a68[_0x9112('0x40')][_0x9112('0x4b')]){_0x5a6eb0[_0x9112('0x4c')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x5a6eb0);})[_0x9112('0x1d')](function(_0x21672e){_0x1753ec[_0x9112('0x4d')]=_0x21672e;return _0x1753ec;})[_0x9112('0x1d')](respondWithFilteredResult(_0x1d8044,_0x5a6eb0))[_0x9112('0x24')](handleError(_0x1d8044,null));};exports[_0x9112('0x4e')]=function(_0x3298e0,_0x3acd12){var _0x382cd1={'raw':![],'where':{'id':_0x3298e0[_0x9112('0x4f')]['id']},'include':[{'model':db[_0x9112('0x38')],'as':'mandatoryDispositionPause'}]},_0x172248={};_0x172248[_0x9112('0x3f')]=_[_0x9112('0x50')](db[_0x9112('0x3b')][_0x9112('0x3c')]);_0x172248[_0x9112('0x40')]=_[_0x9112('0x50')](_0x3298e0[_0x9112('0x40')]);_0x172248[_0x9112('0x47')]=_[_0x9112('0x51')](_0x172248[_0x9112('0x3f')],_0x172248['query']);_0x382cd1[_0x9112('0x41')]=_[_0x9112('0x51')](_0x172248[_0x9112('0x3f')],qs[_0x9112('0x42')](_0x3298e0[_0x9112('0x40')][_0x9112('0x42')]));_0x382cd1[_0x9112('0x41')]=_0x382cd1[_0x9112('0x41')][_0x9112('0x43')]?_0x382cd1[_0x9112('0x41')]:_0x172248[_0x9112('0x3f')];if(_0x3298e0[_0x9112('0x40')][_0x9112('0x4b')]){_0x382cd1[_0x9112('0x4c')]=[{'all':!![]}];}_0x382cd1=_[_0x9112('0x49')]({},_0x382cd1,_0x3298e0[_0x9112('0x4a')]);return db[_0x9112('0x3b')][_0x9112('0x52')](_0x382cd1)[_0x9112('0x1d')](handleEntityNotFound(_0x3acd12,null))['then'](respondWithResult(_0x3acd12,null))[_0x9112('0x24')](handleError(_0x3acd12,null));};exports[_0x9112('0x53')]=function(_0x1f71a5,_0x579550){return db[_0x9112('0x3b')][_0x9112('0x53')](_0x1f71a5[_0x9112('0x54')],{})['then'](function(_0x411f27){var _0x1b111a=_0x1f71a5[_0x9112('0x55')]['get']({'plain':!![]});if(!_0x1b111a)throw new Error(_0x9112('0x56'));if(_0x1b111a[_0x9112('0x57')]===_0x9112('0x55')){var _0x1ed10c=_0x411f27[_0x9112('0x58')]({'plain':!![]});var _0x45a02c=_0x9112('0x33');return db[_0x9112('0x59')][_0x9112('0x52')]({'where':{'name':_0x45a02c,'userProfileId':_0x1b111a[_0x9112('0x5a')]},'raw':!![]})['then'](function(_0x20bcb4){if(_0x20bcb4&&_0x20bcb4['autoAssociation']===0x0){return db[_0x9112('0x34')][_0x9112('0x53')]({'name':_0x1ed10c[_0x9112('0x35')],'resourceId':_0x1ed10c['id'],'type':_0x20bcb4[_0x9112('0x35')],'sectionId':_0x20bcb4['id']},{})[_0x9112('0x1d')](function(){return _0x411f27;});}else{return _0x411f27;}})['catch'](function(_0x1661e3){logger[_0x9112('0x21')](_0x9112('0x5b'),_0x1661e3);throw _0x1661e3;});}return _0x411f27;})['then'](respondWithResult(_0x579550,0xc9))[_0x9112('0x24')](handleError(_0x579550,null));};exports[_0x9112('0x31')]=function(_0x526949,_0x3f32be){if(_0x526949['body']['id']){delete _0x526949[_0x9112('0x54')]['id'];}return db[_0x9112('0x3b')][_0x9112('0x52')]({'where':{'id':_0x526949['params']['id']},'include':[{'model':db[_0x9112('0x38')],'as':_0x9112('0x39')}]})['then'](handleEntityNotFound(_0x3f32be,null))[_0x9112('0x1d')](saveUpdates(_0x526949[_0x9112('0x54')],null))[_0x9112('0x1d')](respondWithResult(_0x3f32be,null))[_0x9112('0x24')](handleError(_0x3f32be,null));};exports[_0x9112('0x32')]=function(_0x109492,_0x37ee83){return db[_0x9112('0x3b')][_0x9112('0x52')]({'where':{'id':_0x109492[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x37ee83,null))[_0x9112('0x1d')](removeEntity(_0x37ee83,null))[_0x9112('0x24')](handleError(_0x37ee83,null));};exports[_0x9112('0x5c')]=function(_0xfe6f45,_0x3ea97d){return db[_0x9112('0x3b')][_0x9112('0x5c')]()['then'](respondWithResult(_0x3ea97d,null))[_0x9112('0x24')](handleError(_0x3ea97d,null));};exports[_0x9112('0x5d')]=function(_0x1c645f,_0x47f0b1,_0x32357f){if(_0x1c645f[_0x9112('0x54')]['id']){delete _0x1c645f['body']['id'];}return db['FaxAccount'][_0x9112('0x52')]({'where':{'id':_0x1c645f[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x47f0b1,null))[_0x9112('0x1d')](function(_0x11e9c1){if(_0x11e9c1){_0x1c645f[_0x9112('0x54')][_0x9112('0x5e')]=_0x11e9c1['id'];return db['Disposition'][_0x9112('0x53')](_0x1c645f[_0x9112('0x54')]);}})[_0x9112('0x1d')](respondWithResult(_0x47f0b1,null))[_0x9112('0x24')](handleError(_0x47f0b1,null));};exports[_0x9112('0x5f')]=function(_0x265339,_0x3d86e6,_0x19c993){var _0x288966={'raw':![],'where':{}};var _0x11ad3c={};var _0x2942b4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x265339['params']['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x3d86e6,null))[_0x9112('0x1d')](function(_0x150d4f){if(_0x150d4f){_0x11ad3c[_0x9112('0x3f')]=_[_0x9112('0x50')](db['Disposition'][_0x9112('0x3c')]);_0x11ad3c[_0x9112('0x40')]=_['keys'](_0x265339[_0x9112('0x40')]);_0x11ad3c[_0x9112('0x47')]=_[_0x9112('0x51')](_0x11ad3c[_0x9112('0x3f')],_0x11ad3c['query']);_0x288966[_0x9112('0x41')]=_[_0x9112('0x51')](_0x11ad3c[_0x9112('0x3f')],qs[_0x9112('0x42')](_0x265339[_0x9112('0x40')][_0x9112('0x42')]));_0x288966[_0x9112('0x41')]=_0x288966[_0x9112('0x41')][_0x9112('0x43')]?_0x288966[_0x9112('0x41')]:_0x11ad3c['model'];if(!_0x265339['query']['hasOwnProperty'](_0x9112('0x44'))){_0x288966[_0x9112('0x2b')]=qs[_0x9112('0x2b')](_0x265339[_0x9112('0x40')][_0x9112('0x2b')]);_0x288966[_0x9112('0x29')]=qs['offset'](_0x265339['query'][_0x9112('0x29')]);}_0x288966[_0x9112('0x60')]=qs[_0x9112('0x45')](_0x265339[_0x9112('0x40')][_0x9112('0x45')]);_0x288966['where']=qs[_0x9112('0x47')](_[_0x9112('0x46')](_0x265339[_0x9112('0x40')],_0x11ad3c[_0x9112('0x47')]));_0x288966[_0x9112('0x48')][_0x9112('0x5e')]=_0x150d4f['id'];if(_0x265339[_0x9112('0x40')][_0x9112('0x61')]){_0x288966[_0x9112('0x48')]=_[_0x9112('0x49')](_0x288966[_0x9112('0x48')],{'$or':_['map'](_0x288966[_0x9112('0x41')],function(_0x4a4272){var _0x3add6d={};_0x3add6d[_0x4a4272]={'$like':'%'+_0x265339[_0x9112('0x40')]['filter']+'%'};return _0x3add6d;})});}_0x288966=_['merge']({},_0x288966,_0x265339[_0x9112('0x4a')]);return db[_0x9112('0x62')]['count']({'where':_0x288966[_0x9112('0x48')]})[_0x9112('0x1d')](function(_0x12fa85){_0x2942b4['count']=_0x12fa85;if(_0x265339['query']['includeAll']){_0x288966['include']=[{'all':!![]}];}return db[_0x9112('0x62')][_0x9112('0x63')](_0x288966);})[_0x9112('0x1d')](function(_0x79daa3){_0x2942b4[_0x9112('0x4d')]=_0x79daa3;return _0x2942b4;});}})[_0x9112('0x1d')](respondWithFilteredResult(_0x3d86e6,_0x288966))[_0x9112('0x24')](handleError(_0x3d86e6,null));};exports['removeDispositions']=function(_0x499151,_0x246e4c,_0x2b48ef){return db['FaxAccount']['find']({'where':{'id':_0x499151[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x246e4c,null))[_0x9112('0x1d')](function(_0x3eb48f){if(_0x3eb48f){return _0x3eb48f[_0x9112('0x64')](_0x499151[_0x9112('0x40')][_0x9112('0x65')]);}})[_0x9112('0x1d')](respondWithStatusCode(_0x246e4c,null))[_0x9112('0x24')](handleError(_0x246e4c,null));};exports[_0x9112('0x66')]=function(_0x1d7b12,_0x429294,_0x47f45d){if(_0x1d7b12['body']['id']){delete _0x1d7b12[_0x9112('0x54')]['id'];}return db[_0x9112('0x3b')]['find']({'where':{'id':_0x1d7b12[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x429294,null))['then'](function(_0x487738){if(_0x487738){_0x1d7b12[_0x9112('0x54')]['FaxAccountId']=_0x487738['id'];return db[_0x9112('0x67')][_0x9112('0x53')](_0x1d7b12[_0x9112('0x54')]);}})[_0x9112('0x1d')](respondWithResult(_0x429294,null))['catch'](handleError(_0x429294,null));};exports[_0x9112('0x68')]=function(_0x53542c,_0x3fba75,_0x50f992){var _0x406282={'raw':![],'where':{}};var _0x5518c6={};var _0x43420f={'count':0x0,'rows':[]};return db[_0x9112('0x3b')][_0x9112('0x69')]({'where':{'id':_0x53542c[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x3fba75,null))[_0x9112('0x1d')](function(_0x1e1bbb){if(_0x1e1bbb){_0x5518c6[_0x9112('0x3f')]=_[_0x9112('0x50')](db['CannedAnswer'][_0x9112('0x3c')]);_0x5518c6[_0x9112('0x40')]=_['keys'](_0x53542c[_0x9112('0x40')]);_0x5518c6[_0x9112('0x47')]=_[_0x9112('0x51')](_0x5518c6[_0x9112('0x3f')],_0x5518c6['query']);_0x406282[_0x9112('0x41')]=_[_0x9112('0x51')](_0x5518c6[_0x9112('0x3f')],qs[_0x9112('0x42')](_0x53542c[_0x9112('0x40')][_0x9112('0x42')]));_0x406282[_0x9112('0x41')]=_0x406282[_0x9112('0x41')][_0x9112('0x43')]?_0x406282[_0x9112('0x41')]:_0x5518c6[_0x9112('0x3f')];if(!_0x53542c[_0x9112('0x40')][_0x9112('0x6a')]('nolimit')){_0x406282[_0x9112('0x2b')]=qs[_0x9112('0x2b')](_0x53542c[_0x9112('0x40')]['limit']);_0x406282[_0x9112('0x29')]=qs[_0x9112('0x29')](_0x53542c['query'][_0x9112('0x29')]);}_0x406282[_0x9112('0x60')]=qs[_0x9112('0x45')](_0x53542c[_0x9112('0x40')]['sort']);_0x406282[_0x9112('0x48')]=qs[_0x9112('0x47')](_[_0x9112('0x46')](_0x53542c[_0x9112('0x40')],_0x5518c6['filters']));_0x406282['where'][_0x9112('0x5e')]=_0x1e1bbb['id'];if(_0x53542c[_0x9112('0x40')][_0x9112('0x61')]){_0x406282[_0x9112('0x48')]=_['merge'](_0x406282[_0x9112('0x48')],{'$or':_[_0x9112('0x3a')](_0x406282[_0x9112('0x41')],function(_0x3c4251){var _0x41db20={};_0x41db20[_0x3c4251]={'$like':'%'+_0x53542c[_0x9112('0x40')][_0x9112('0x61')]+'%'};return _0x41db20;})});}_0x406282=_['merge']({},_0x406282,_0x53542c[_0x9112('0x4a')]);return db[_0x9112('0x67')]['count']({'where':_0x406282[_0x9112('0x48')]})[_0x9112('0x1d')](function(_0x21b915){_0x43420f[_0x9112('0x2c')]=_0x21b915;if(_0x53542c[_0x9112('0x40')][_0x9112('0x4b')]){_0x406282[_0x9112('0x4c')]=[{'all':!![]}];}return db[_0x9112('0x67')][_0x9112('0x63')](_0x406282);})[_0x9112('0x1d')](function(_0x2fbb2d){_0x43420f['rows']=_0x2fbb2d;return _0x43420f;});}})[_0x9112('0x1d')](respondWithFilteredResult(_0x3fba75,_0x406282))[_0x9112('0x24')](handleError(_0x3fba75,null));};exports[_0x9112('0x6b')]=function(_0x4460e4,_0x21441f,_0x116842){return db['FaxAccount'][_0x9112('0x52')]({'where':{'id':_0x4460e4[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x21441f,null))[_0x9112('0x1d')](function(_0x54ac59){if(_0x54ac59){return _0x54ac59[_0x9112('0x6b')](_0x4460e4[_0x9112('0x40')][_0x9112('0x65')]);}})[_0x9112('0x1d')](respondWithStatusCode(_0x21441f,null))[_0x9112('0x24')](handleError(_0x21441f,null));};exports[_0x9112('0x6c')]=function(_0x15ee7f,_0x51d962,_0x4799a1){return db['FaxInteraction']['find']({'where':{'id':_0x15ee7f[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x51d962,null))['then'](function(_0x214610){if(_0x214610){return _0x214610['addInteraction'](_0x15ee7f[_0x9112('0x54')]['ids'],_[_0x9112('0x6d')](_0x15ee7f[_0x9112('0x54')],[_0x9112('0x65'),'id'])||{});}})[_0x9112('0x1d')](respondWithResult(_0x51d962,null))[_0x9112('0x24')](handleError(_0x51d962,null));};exports[_0x9112('0x6e')]=function(_0x566cb1,_0x5b84f7,_0x17faf0){var _0x272d35={'raw':![],'where':{}};var _0x2f45b8={};var _0x2c4dad={'count':0x0,'rows':[]};return db[_0x9112('0x3b')][_0x9112('0x69')]({'where':{'id':_0x566cb1[_0x9112('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5b84f7,null))['then'](function(_0x5ae0ce){if(_0x5ae0ce){_0x2f45b8[_0x9112('0x3f')]=_[_0x9112('0x50')](db[_0x9112('0x6f')][_0x9112('0x3c')]);_0x2f45b8[_0x9112('0x40')]=_['keys'](_0x566cb1['query']);_0x2f45b8[_0x9112('0x47')]=_[_0x9112('0x51')](_0x2f45b8[_0x9112('0x3f')],_0x2f45b8[_0x9112('0x40')]);_0x272d35[_0x9112('0x41')]=_[_0x9112('0x51')](_0x2f45b8[_0x9112('0x3f')],qs[_0x9112('0x42')](_0x566cb1[_0x9112('0x40')][_0x9112('0x42')]));_0x272d35['attributes']=_0x272d35['attributes'][_0x9112('0x43')]?_0x272d35['attributes']:_0x2f45b8[_0x9112('0x3f')];if(!_0x566cb1['query'][_0x9112('0x6a')]('nolimit')){_0x272d35[_0x9112('0x2b')]=qs[_0x9112('0x2b')](_0x566cb1[_0x9112('0x40')][_0x9112('0x2b')]);_0x272d35[_0x9112('0x29')]=qs['offset'](_0x566cb1['query'][_0x9112('0x29')]);}_0x272d35[_0x9112('0x60')]=qs['sort'](_0x566cb1[_0x9112('0x40')][_0x9112('0x45')]);_0x272d35[_0x9112('0x48')]=qs[_0x9112('0x47')](_[_0x9112('0x46')](_0x566cb1['query'],_0x2f45b8[_0x9112('0x47')]));_0x272d35[_0x9112('0x48')][_0x9112('0x5e')]=_0x5ae0ce['id'];if(_0x566cb1[_0x9112('0x40')]['filter']){_0x272d35[_0x9112('0x48')]=_['merge'](_0x272d35['where'],{'$or':_[_0x9112('0x3a')](_0x272d35[_0x9112('0x41')],function(_0x388a67){var _0x5611d7={};_0x5611d7[_0x388a67]={'$like':'%'+_0x566cb1[_0x9112('0x40')][_0x9112('0x61')]+'%'};return _0x5611d7;})});}_0x272d35=_['merge']({},_0x272d35,_0x566cb1[_0x9112('0x4a')]);return db[_0x9112('0x6f')]['count']({'where':_0x272d35[_0x9112('0x48')]})[_0x9112('0x1d')](function(_0x2d307a){_0x2c4dad[_0x9112('0x2c')]=_0x2d307a;if(_0x566cb1[_0x9112('0x40')][_0x9112('0x4b')]){_0x272d35['include']=[{'model':db['CmContact'],'as':_0x9112('0x70'),'required':![]},{'model':db[_0x9112('0x71')],'as':_0x9112('0x72'),'attributes':[_0x9112('0x35'),'fullname','internal'],'required':![]},{'model':db[_0x9112('0x73')],'as':_0x9112('0x74'),'attributes':['id',_0x9112('0x35'),_0x9112('0x75')],'where':_0x566cb1[_0x9112('0x40')][_0x9112('0x76')]?{'id':_0x566cb1[_0x9112('0x40')]['tag']}:undefined,'required':_0x566cb1[_0x9112('0x40')]['tag']?!![]:![]}];}return db[_0x9112('0x6f')][_0x9112('0x63')](_0x272d35);})[_0x9112('0x1d')](function(_0x21d2d9){_0x2c4dad[_0x9112('0x4d')]=_0x21d2d9;return _0x2c4dad;});}})['then'](respondWithFilteredResult(_0x5b84f7,_0x272d35))[_0x9112('0x24')](handleError(_0x5b84f7,null));};exports[_0x9112('0x77')]=function(_0x6ece49,_0x4c8cf0){var _0x43100f=_0x6ece49[_0x9112('0x4f')]['id'];var _0x36be79=_0x6ece49[_0x9112('0x54')];var _0xcca046=0xc8;var _0x1f5c4d=null;return db[_0x9112('0x78')][_0x9112('0x79')]({'isolationLevel':db[_0x9112('0x78')]['Transaction'][_0x9112('0x7a')]['READ_COMMITTED']},function(_0x30a71c){return db[_0x9112('0x3b')]['findOne']({'where':{'id':_0x43100f},'transaction':_0x30a71c})['then'](function(_0x57fd7d){if(_0x57fd7d){return db[_0x9112('0x7b')][_0x9112('0x32')]({'where':{'FaxAccountId':_0x43100f},'transaction':_0x30a71c})['then'](function(){var _0x3ecf3c=_[_0x9112('0x3a')](_0x36be79,function(_0x3c47b6){_0x3c47b6['FaxAccountId']=_0x43100f;return _0x3c47b6;});return db['FaxApplication'][_0x9112('0x7c')](_0x3ecf3c,{'transaction':_0x30a71c});});}else{_0xcca046=0x194;_0x1f5c4d=[];}});})[_0x9112('0x1d')](function(){if(_0xcca046!==0x194){return db[_0x9112('0x7b')]['findAndCountAll']({'where':{'FaxAccountId':_0x43100f},'order':_0x9112('0x7d')})[_0x9112('0x1d')](function(_0x5165d2){_0x1f5c4d=_0x5165d2;});}})[_0x9112('0x24')](function(_0x3470be){_0xcca046=0x1f4;logger[_0x9112('0x21')](_0x3470be[_0x9112('0x7e')]);if(_0x3470be['name']){delete _0x3470be[_0x9112('0x35')];}_0x1f5c4d=_0x3470be;})[_0x9112('0x7f')](function(){if(_0x1f5c4d===null){_0x4c8cf0[_0x9112('0x25')](_0xcca046);}else{if(_0xcca046===0x1f4){_0x4c8cf0[_0x9112('0x26')](_0xcca046)[_0x9112('0x36')](_0x1f5c4d);}else{_0x4c8cf0['status'](_0xcca046)[_0x9112('0x28')](_0x1f5c4d);}}});};exports[_0x9112('0x80')]=function(_0x3d8bdd,_0x304264,_0x317a72){var _0x26ca5a={};var _0x42b832={};var _0x536349;var _0x5ab8a7;return db[_0x9112('0x3b')]['findOne']({'where':{'id':_0x3d8bdd[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x304264,null))['then'](function(_0x30558f){if(_0x30558f){_0x536349=_0x30558f;_0x42b832['model']=_[_0x9112('0x50')](db['FaxApplication']['rawAttributes']);_0x42b832[_0x9112('0x40')]=_['keys'](_0x3d8bdd[_0x9112('0x40')]);_0x42b832['filters']=_['intersection'](_0x42b832[_0x9112('0x3f')],_0x42b832[_0x9112('0x40')]);_0x26ca5a['attributes']=_[_0x9112('0x51')](_0x42b832['model'],qs['fields'](_0x3d8bdd[_0x9112('0x40')][_0x9112('0x42')]));_0x26ca5a[_0x9112('0x41')]=_0x26ca5a['attributes']['length']?_0x26ca5a[_0x9112('0x41')]:_0x42b832[_0x9112('0x3f')];_0x26ca5a[_0x9112('0x60')]=qs[_0x9112('0x45')](_0x3d8bdd[_0x9112('0x40')][_0x9112('0x45')]);_0x26ca5a['where']=qs[_0x9112('0x47')](_[_0x9112('0x46')](_0x3d8bdd[_0x9112('0x40')],_0x42b832[_0x9112('0x47')]));if(_0x3d8bdd['query'][_0x9112('0x61')]){_0x26ca5a[_0x9112('0x48')]=_[_0x9112('0x49')](_0x26ca5a[_0x9112('0x48')],{'$or':_[_0x9112('0x3a')](_0x26ca5a['attributes'],function(_0x3af323){var _0x1bd053={};_0x1bd053[_0x3af323]={'$like':'%'+_0x3d8bdd[_0x9112('0x40')][_0x9112('0x61')]+'%'};return _0x1bd053;})});}_0x26ca5a=_[_0x9112('0x49')]({},_0x26ca5a,_0x3d8bdd['options']);return _0x536349['getApplications'](_0x26ca5a);}})[_0x9112('0x1d')](function(_0x4a6b22){if(_0x4a6b22){_0x5ab8a7=_0x4a6b22[_0x9112('0x43')];if(!_0x3d8bdd[_0x9112('0x40')][_0x9112('0x6a')]('nolimit')){_0x26ca5a[_0x9112('0x2b')]=qs['limit'](_0x3d8bdd[_0x9112('0x40')]['limit']);_0x26ca5a[_0x9112('0x29')]=qs[_0x9112('0x29')](_0x3d8bdd['query'][_0x9112('0x29')]);}return _0x536349[_0x9112('0x80')](_0x26ca5a);}})[_0x9112('0x1d')](function(_0x243b31){if(_0x243b31){return _0x243b31?{'count':_0x5ab8a7,'rows':_0x243b31}:null;}})[_0x9112('0x1d')](respondWithResult(_0x304264,null))[_0x9112('0x24')](handleError(_0x304264,null));};function Extension(_0x4d7fbd,_0x58fcb0,_0x4fdf06,_0x41cfd2){this[_0x9112('0x81')]='from-voip-provider';this[_0x9112('0x82')]=_0x4d7fbd['localstationid'];this[_0x9112('0x83')]=_0x41cfd2;this[_0x9112('0x3d')]=_0x9112('0x84');this[_0x9112('0x85')]=_0x9112('0x86');this[_0x9112('0x5e')]=_0x4d7fbd['id'];this[_0x9112('0x7d')]=_0x58fcb0;this[_0x9112('0x87')]=_0x4fdf06;}function createExtensionsReciveFax(_0x2cce87){var _0x422eb4=0x1;var _0x5a9de7=[];_0x5a9de7[_0x9112('0x88')](new Extension(_0x2cce87,_0x422eb4,'',_0x9112('0x89')));_0x422eb4+=0x1;_0x5a9de7['push'](new Extension(_0x2cce87,_0x422eb4,_0x9112('0x8a'),'Set'));_0x422eb4+=0x1;for(var _0x8d294 in _0x2cce87){if(_0x2cce87[_0x9112('0x6a')](_0x8d294)&&(_0x8d294==='ecm'||_0x8d294===_0x9112('0x8b')||_0x8d294==='gateway'||_0x8d294===_0x9112('0x8c')||_0x8d294===_0x9112('0x8d')||_0x8d294===_0x9112('0x8e')||_0x8d294===_0x9112('0x8f')||_0x8d294===_0x9112('0x90')||_0x8d294===_0x9112('0x91'))){_0x5a9de7['push'](new Extension(_0x2cce87,_0x422eb4,'FAXOPT('+_0x8d294+')='+_0x2cce87[_0x8d294],_0x9112('0x92')));_0x422eb4+=0x1;}}_0x5a9de7[_0x9112('0x88')](new Extension(_0x2cce87,_0x422eb4,'6',_0x9112('0x93')));_0x422eb4+=0x1;_0x5a9de7[_0x9112('0x88')](new Extension(_0x2cce87,_0x422eb4,_0x9112('0x94'),_0x9112('0x95')));_0x422eb4=0x0;return _0x5a9de7;}exports[_0x9112('0x96')]=function(_0x556d2a,_0x4ca5e3,_0x229dd4){var _0x7952d8;return db[_0x9112('0x78')][_0x9112('0x79')](function(_0x43008d){return db['FaxAccount'][_0x9112('0x53')](_0x556d2a['body'],{'transaction':_0x43008d})[_0x9112('0x1d')](function(_0x24d8cb){_0x7952d8=_0x24d8cb[_0x9112('0x58')]({'plain':!![]});return db[_0x9112('0x97')][_0x9112('0x7c')](createExtensionsReciveFax(_0x7952d8),{'transaction':_0x43008d});});})['then'](function(){return _0x7952d8;})[_0x9112('0x1d')](respondWithResult(_0x4ca5e3,null))[_0x9112('0x24')](handleError(_0x4ca5e3,null));};exports[_0x9112('0x98')]=function(_0xe9d9a,_0x42aae6,_0x2ef53a){var _0x26293f;return db[_0x9112('0x78')]['transaction'](function(_0x189ef8){return db['FaxAccount'][_0x9112('0x31')](_0xe9d9a[_0x9112('0x54')],{'where':{'id':_0xe9d9a[_0x9112('0x54')]['id']},'transaction':_0x189ef8})['then'](function(_0x3450a8){return db['VoiceExtension'][_0x9112('0x32')]({'where':{'FaxAccountId':_0xe9d9a[_0x9112('0x54')]['id']},'transaction':_0x189ef8})[_0x9112('0x1d')](function(_0x4abe70){return db[_0x9112('0x97')]['bulkCreate'](createExtensionsReciveFax(_[_0x9112('0x6d')](_0xe9d9a[_0x9112('0x54')],['tech',_0x9112('0x3e'),_0x9112('0x99'),_0x9112('0x9a'),'TrunkId',_0x9112('0x9b')])),{'transaction':_0x189ef8});});});})[_0x9112('0x1d')](function(){return db[_0x9112('0x3b')][_0x9112('0x9c')](_0xe9d9a[_0x9112('0x54')]['id']);})[_0x9112('0x1d')](respondWithResult(_0x42aae6,null))[_0x9112('0x24')](handleError(_0x42aae6,null));};exports[_0x9112('0x9d')]=function(_0x160cc5,_0x57243f,_0xa2765e){var _0x149877={'raw':!![],'where':{}};var _0x4a4d51={};var _0x4e2678={'count':0x0,'rows':[]};return db[_0x9112('0x3b')]['findOne']({'where':{'id':_0x160cc5[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x57243f,null))[_0x9112('0x1d')](function(_0x4438b6){if(_0x4438b6){_0x4a4d51['model']=_[_0x9112('0x50')](db[_0x9112('0x9e')][_0x9112('0x3c')]);_0x4a4d51[_0x9112('0x40')]=_[_0x9112('0x50')](_0x160cc5[_0x9112('0x40')]);_0x4a4d51[_0x9112('0x47')]=_[_0x9112('0x51')](_0x4a4d51[_0x9112('0x3f')],_0x4a4d51[_0x9112('0x40')]);_0x149877[_0x9112('0x41')]=_[_0x9112('0x51')](_0x4a4d51['model'],qs[_0x9112('0x42')](_0x160cc5[_0x9112('0x40')][_0x9112('0x42')]));_0x149877['attributes']=_0x149877[_0x9112('0x41')][_0x9112('0x43')]?_0x149877[_0x9112('0x41')]:_0x4a4d51[_0x9112('0x3f')];if(!_0x160cc5[_0x9112('0x40')][_0x9112('0x6a')]('nolimit')){_0x149877[_0x9112('0x2b')]=qs[_0x9112('0x2b')](_0x160cc5['query'][_0x9112('0x2b')]);_0x149877[_0x9112('0x29')]=qs['offset'](_0x160cc5['query']['offset']);}_0x149877[_0x9112('0x60')]=qs['sort'](_0x160cc5[_0x9112('0x40')][_0x9112('0x45')]);_0x149877[_0x9112('0x48')]=qs[_0x9112('0x47')](_[_0x9112('0x46')](_0x160cc5[_0x9112('0x40')],_0x4a4d51[_0x9112('0x47')]));_0x149877[_0x9112('0x48')][_0x9112('0x5e')]=_0x4438b6['id'];if(_0x160cc5[_0x9112('0x40')][_0x9112('0x61')]){_0x149877[_0x9112('0x48')]=_[_0x9112('0x49')](_0x149877[_0x9112('0x48')],{'$or':_[_0x9112('0x3a')](_0x149877[_0x9112('0x41')],function(_0x448030){var _0x165edf={};_0x165edf[_0x448030]={'$like':'%'+_0x160cc5[_0x9112('0x40')][_0x9112('0x61')]+'%'};return _0x165edf;})});}if(_0x160cc5['query'][_0x9112('0x9f')]){var _0x155a7b=_0x160cc5[_0x9112('0x40')][_0x9112('0x9f')][_0x9112('0xa0')](',');var _0x3b4134={};_0x3b4134[_0x155a7b[0x0]]={'$gte':moment(_0x155a7b[0x1])[_0x9112('0xa1')](_0x9112('0xa2'))};_0x149877['where']=_[_0x9112('0x49')](_0x149877['where'],_0x3b4134);}_0x149877=_[_0x9112('0x49')]({},_0x149877,_0x160cc5[_0x9112('0x4a')]);return db['FaxMessage'][_0x9112('0x2c')]({'where':_0x149877[_0x9112('0x48')]})[_0x9112('0x1d')](function(_0x5b2d5e){_0x4e2678[_0x9112('0x2c')]=_0x5b2d5e;if(_0x160cc5[_0x9112('0x40')]['includeAll']){_0x149877['include']=[{'all':!![]}];}return db[_0x9112('0x9e')]['findAll'](_0x149877);})[_0x9112('0x1d')](function(_0x397ce8){_0x4e2678[_0x9112('0x4d')]=_0x397ce8;return _0x4e2678;});}})['then'](respondWithFilteredResult(_0x57243f,_0x149877))[_0x9112('0x24')](handleError(_0x57243f,null));};exports['send']=function(_0x86a7df,_0x4a80d2,_0x42ab31){var _0x1e147d,_0x46d917={},_0x162965;if(_0x86a7df[_0x9112('0x54')]['to']){_0x162965=_0x86a7df[_0x9112('0x54')]['to'][0x0];}return db['FaxAccount'][_0x9112('0x52')]({'where':{'id':_0x86a7df['params']['id']},'include':[{'model':db['CmList'],'as':_0x9112('0xa3'),'include':[{'model':db['CmContact'],'as':_0x9112('0xa4'),'where':{'fax':_0x162965},'limit':0x1,'order':[[_0x9112('0x9a'),_0x9112('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x4a80d2,null))[_0x9112('0x1d')](function(_0x4b1754){_0x1e147d=_0x4b1754;if(_0x86a7df['body']['attachments']&&_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][_0x9112('0x43')]){for(var _0x33be7f=0x0;_0x33be7f<_0x86a7df['body'][_0x9112('0xa6')][_0x9112('0x43')];_0x33be7f+=0x1){_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][_0x33be7f]={'filename':_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][_0x33be7f][_0x9112('0x35')],'id':_0x86a7df['body'][_0x9112('0xa6')][_0x33be7f]['id'],'path':path[_0x9112('0xa7')](config[_0x9112('0xa8')],_0x9112('0xa9'),_0x86a7df['body'][_0x9112('0xa6')][_0x33be7f][_0x9112('0xaa')])};}}return respondWithRpcPromise(_0x9112('0xab'),'CheckAfterSend',{'FaxAccountId':_[_0x9112('0xac')](_0x86a7df['params']['id'])?undefined:_0x86a7df[_0x9112('0x4f')]['id'],'path':_[_0x9112('0xac')](_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][0x0]['path'])?undefined:_0x86a7df[_0x9112('0x54')]['attachments'][0x0]['path'],'fax':_[_0x9112('0xac')](_0x86a7df[_0x9112('0x54')]['to'][0x0])?undefined:_0x86a7df[_0x9112('0x54')]['to'][0x0]},client9002);})[_0x9112('0x1d')](function(){if(_0x1e147d){if(_[_0x9112('0xac')](_0x86a7df[_0x9112('0x54')]['from'])){_0x86a7df[_0x9112('0x54')][_0x9112('0xad')]=util[_0x9112('0xa1')](_0x9112('0xae'),_0x1e147d[_0x9112('0x35')],_0x1e147d[_0x9112('0xaf')]);}if(_0x1e147d['List']){if(_0x1e147d[_0x9112('0xa3')]['Contacts'][_0x9112('0x43')]){return _0x1e147d[_0x9112('0xa3')]['Contacts'][0x0];}else{return db[_0x9112('0xb0')]['create'](_[_0x9112('0x16')](_0x86a7df[_0x9112('0x54')],{'firstName':_0x86a7df['body']['to'][0x0],'phone':_0x86a7df['body']['to'][0x0],'fax':_0x86a7df['body']['to'][0x0],'ListId':_0x1e147d[_0x9112('0x9b')]}));}}else{throw new Error(_0x9112('0xb1'));}}else{throw new Error(_0x9112('0xb2'));}})[_0x9112('0x1d')](function(_0x3e5d50){if(_0x3e5d50){return db['FaxInteraction'][_0x9112('0x52')]({'where':{'ContactId':_0x3e5d50['id'],'closed':![],'FaxAccountId':_0x1e147d['id']}})['then'](function(_0x69ef72){if(_0x69ef72){return[_0x69ef72,![]];}return db[_0x9112('0x6f')][_0x9112('0x53')]({'UserId':_0x86a7df['user']['id'],'ContactId':_0x3e5d50['id'],'FaxAccountId':_0x1e147d['id'],'fax':_0x86a7df[_0x9112('0x54')]['to'][0x0],'firstMsgDirection':_0x9112('0xb3'),'Messages':[_['merge'](_0x86a7df[_0x9112('0x54')],{'read':![],'body':_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][0x0]['filename'],'FaxAccountId':_0x1e147d['id'],'UserId':_0x86a7df['user']['id'],'ContactId':_0x3e5d50['id'],'AttachmentId':_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][0x0]['id']})]},{'include':[{'model':db[_0x9112('0x9e')],'as':'Messages'}]})[_0x9112('0x1d')](function(_0x104eaa){return[_0x104eaa,!![]];});});}else{throw new Error(_0x9112('0xb4'));}})[_0x9112('0xb5')](function(_0x466921,_0x2b1494){if(_0x2b1494){return _0x466921;}return db['FaxMessage'][_0x9112('0x53')]({'direction':_0x9112('0xb3'),'read':![],'body':_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][0x0]['filename'],'FaxAccountId':_0x1e147d['id'],'FaxInteractionId':_0x466921['id'],'UserId':_0x86a7df['user']['id'],'ContactId':_0x466921['ContactId'],'AttachmentId':_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][0x0]['id']})[_0x9112('0x1d')](function(_0x309a01){_0x466921[_0x9112('0xb6')][_0x9112('0xb7')]=[];_0x466921[_0x9112('0xb6')][_0x9112('0xb7')][_0x9112('0x88')](_0x309a01[_0x9112('0xb6')]);return _0x466921;});})[_0x9112('0x1d')](function(_0x500a2a){respondWithRpcPromise(_0x9112('0xb8'),_0x9112('0xb8'),{'FaxAccountId':_[_0x9112('0xac')](_0x86a7df[_0x9112('0x4f')]['id'])?undefined:_0x86a7df['params']['id'],'path':_[_0x9112('0xac')](_0x86a7df[_0x9112('0x54')]['attachments'][0x0]['path'])?undefined:_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][0x0][_0x9112('0x6')],'fax':_[_0x9112('0xac')](_0x86a7df[_0x9112('0x54')]['to'][0x0])?undefined:_0x86a7df[_0x9112('0x54')]['to'][0x0],'AttachmentId':_0x86a7df[_0x9112('0x54')][_0x9112('0xa6')][0x0]['id']},client9002)['then'](function(_0x5109c4){logger[_0x9112('0x1e')](_0x9112('0xb9'),_0x5109c4);})['catch'](function(_0x34a980){logger[_0x9112('0x1e')]('SendFaxRpc,\x20%s',_0x34a980);});return _0x500a2a;})[_0x9112('0x1d')](respondWithResult(_0x4a80d2,null))['catch'](handleError(_0x4a80d2,null));};exports[_0x9112('0xba')]=function(_0x15213a,_0x4e632c,_0x2d1649){return db[_0x9112('0x3b')]['find']({'where':{'id':_0x15213a[_0x9112('0x4f')]['id']}})[_0x9112('0x1d')](handleEntityNotFound(_0x4e632c,null))[_0x9112('0x1d')](function(_0x43198b){if(_0x43198b){return _0x43198b[_0x9112('0xba')](_0x15213a['body']['ids'],_['omit'](_0x15213a[_0x9112('0x54')],[_0x9112('0x65'),'id'])||{})[_0x9112('0xb5')](function(_0x406557){for(var _0x246a38=0x0;_0x246a38<_0x15213a[_0x9112('0x54')][_0x9112('0x65')]['length'];_0x246a38+=0x1){socket[_0x9112('0xbb')](_0x9112('0xbc'),{'UserId':Number(_0x15213a[_0x9112('0x54')]['ids'][_0x246a38]),'FaxAccountId':Number(_0x15213a['params']['id'])});}return _0x406557;});}})['then'](respondWithResult(_0x4e632c,null))[_0x9112('0x24')](handleError(_0x4e632c,null));};exports[_0x9112('0xbd')]=function(_0x2a4680,_0x4402b8,_0x2f2881){return db[_0x9112('0x3b')][_0x9112('0x52')]({'where':{'id':_0x2a4680[_0x9112('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4402b8,null))[_0x9112('0x1d')](function(_0x5bfd6a){if(_0x5bfd6a){return _0x5bfd6a[_0x9112('0xbd')](_0x2a4680[_0x9112('0x40')][_0x9112('0x65')])[_0x9112('0x1d')](function(){if(_[_0x9112('0xbe')](_0x2a4680[_0x9112('0x40')][_0x9112('0x65')])){for(var _0x39b7e8=0x0;_0x39b7e8<_0x2a4680['query']['ids'][_0x9112('0x43')];_0x39b7e8+=0x1){socket[_0x9112('0xbb')](_0x9112('0xbf'),{'UserId':Number(_0x2a4680[_0x9112('0x40')][_0x9112('0x65')][_0x39b7e8]),'FaxAccountId':Number(_0x2a4680[_0x9112('0x4f')]['id'])});}}else{socket[_0x9112('0xbb')](_0x9112('0xbf'),{'UserId':Number(_0x2a4680['query'][_0x9112('0x65')]),'FaxAccountId':Number(_0x2a4680['params']['id'])});}});}})[_0x9112('0x1d')](respondWithStatusCode(_0x4402b8,null))[_0x9112('0x24')](handleError(_0x4402b8,null));};exports[_0x9112('0xc0')]=function(_0x15a81c,_0x8b2ce6,_0x84cf38){var _0x45bf54={};var _0x3984cf={};var _0x1a549c;var _0x4e43a0;return db['FaxAccount'][_0x9112('0x69')]({'where':{'id':_0x15a81c[_0x9112('0x4f')]['id']}})['then'](handleEntityNotFound(_0x8b2ce6,null))['then'](function(_0x32395f){if(_0x32395f){_0x1a549c=_0x32395f;_0x3984cf['model']=_[_0x9112('0x50')](db[_0x9112('0x71')][_0x9112('0x3c')]);_0x3984cf[_0x9112('0x40')]=_[_0x9112('0x50')](_0x15a81c['query']);_0x3984cf[_0x9112('0x47')]=_[_0x9112('0x51')](_0x3984cf[_0x9112('0x3f')],_0x3984cf[_0x9112('0x40')]);_0x45bf54[_0x9112('0x41')]=_[_0x9112('0x51')](_0x3984cf['model'],qs[_0x9112('0x42')](_0x15a81c[_0x9112('0x40')]['fields']));_0x45bf54['attributes']=_0x45bf54[_0x9112('0x41')][_0x9112('0x43')]?_0x45bf54[_0x9112('0x41')]:_0x3984cf['model'];_0x45bf54[_0x9112('0x60')]=qs[_0x9112('0x45')](_0x15a81c[_0x9112('0x40')][_0x9112('0x45')]);_0x45bf54[_0x9112('0x48')]=qs[_0x9112('0x47')](_[_0x9112('0x46')](_0x15a81c[_0x9112('0x40')],_0x3984cf[_0x9112('0x47')]));if(_0x15a81c['query']['filter']){_0x45bf54[_0x9112('0x48')]=_[_0x9112('0x49')](_0x45bf54[_0x9112('0x48')],{'$or':_[_0x9112('0x3a')](_0x45bf54['attributes'],function(_0x6e961a){var _0x5620ce={};_0x5620ce[_0x6e961a]={'$like':'%'+_0x15a81c[_0x9112('0x40')][_0x9112('0x61')]+'%'};return _0x5620ce;})});}_0x45bf54=_[_0x9112('0x49')]({},_0x45bf54,_0x15a81c['options']);return _0x1a549c[_0x9112('0xc0')](_0x45bf54);}})[_0x9112('0x1d')](function(_0x59669c){if(_0x59669c){_0x4e43a0=_0x59669c[_0x9112('0x43')];if(!_0x15a81c[_0x9112('0x40')][_0x9112('0x6a')]('nolimit')){_0x45bf54['limit']=qs[_0x9112('0x2b')](_0x15a81c['query'][_0x9112('0x2b')]);_0x45bf54[_0x9112('0x29')]=qs['offset'](_0x15a81c[_0x9112('0x40')]['offset']);}return _0x1a549c['getAgents'](_0x45bf54);}})['then'](function(_0x45810b){if(_0x45810b){return _0x45810b?{'count':_0x4e43a0,'rows':_0x45810b}:null;}})[_0x9112('0x1d')](respondWithResult(_0x8b2ce6,null))[_0x9112('0x24')](handleError(_0x8b2ce6,null));}; \ No newline at end of file +var _0xee5a=['emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','get','FaxAccounts','UserProfileResource','name','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','CmContact','Contact','Tag','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','send','getApplications','from-voip-provider','exten','localstationid','app','description','appdata','push','Answer','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents'];(function(_0x1381d,_0x189e37){var _0x4715d6=function(_0x264a13){while(--_0x264a13){_0x1381d['push'](_0x1381d['shift']());}};_0x4715d6(++_0x189e37);}(_0xee5a,0xcf));var _0xaee5=function(_0xd7fdbd,_0x4e2759){_0xd7fdbd=_0xd7fdbd-0x0;var _0x5e71b5=_0xee5a[_0xd7fdbd];return _0x5e71b5;};'use strict';var emlformat=require(_0xaee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaee5('0x1'));var jsonpatch=require(_0xaee5('0x2'));var rp=require(_0xaee5('0x3'));var moment=require(_0xaee5('0x4'));var BPromise=require(_0xaee5('0x5'));var Mustache=require(_0xaee5('0x6'));var util=require(_0xaee5('0x7'));var path=require(_0xaee5('0x8'));var sox=require(_0xaee5('0x9'));var csv=require(_0xaee5('0xa'));var ejs=require(_0xaee5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaee5('0xc'));var squel=require(_0xaee5('0xd'));var crypto=require(_0xaee5('0xe'));var jsforce=require(_0xaee5('0xf'));var deskjs=require(_0xaee5('0x10'));var toCsv=require(_0xaee5('0xa'));var querystring=require(_0xaee5('0x11'));var Papa=require(_0xaee5('0x12'));var Redis=require('ioredis');var authService=require(_0xaee5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaee5('0x14'));var hardwareService=require(_0xaee5('0x15'));var logger=require(_0xaee5('0x16'))(_0xaee5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaee5('0x18'))['db'];config[_0xaee5('0x19')]=_[_0xaee5('0x1a')](config[_0xaee5('0x19')],{'host':_0xaee5('0x1b'),'port':0x18eb});var socket=require(_0xaee5('0x1c'))(new Redis(config[_0xaee5('0x19')]));require(_0xaee5('0x1d'))[_0xaee5('0x1e')](socket);var jayson=require(_0xaee5('0x1f'));var client=jayson[_0xaee5('0x20')][_0xaee5('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xaee5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1292f5,_0x303c73,_0x11a764,_0x34ea10){return new BPromise(function(_0x299008,_0x5e5ef4){var _0x3ec5d0=_0x34ea10||client;return _0x3ec5d0[_0xaee5('0x22')](_0x1292f5,_0x11a764)[_0xaee5('0x23')](function(_0x46df3d){logger[_0xaee5('0x24')](_0xaee5('0x25'),_0x303c73,_0xaee5('0x26'));logger[_0xaee5('0x27')](_0xaee5('0x28'),_0x303c73,'request\x20sent',JSON[_0xaee5('0x29')](_0x46df3d));if(_0x46df3d[_0xaee5('0x2a')]){if(_0x46df3d[_0xaee5('0x2a')][_0xaee5('0x2b')]===0x1f4){logger['error'](_0xaee5('0x25'),_0x303c73,_0x46df3d[_0xaee5('0x2a')][_0xaee5('0x2c')]);return _0x5e5ef4(_0x46df3d['error'][_0xaee5('0x2c')]);}logger['error'](_0xaee5('0x25'),_0x303c73,_0x46df3d[_0xaee5('0x2a')][_0xaee5('0x2c')]);return _0x299008(_0x46df3d[_0xaee5('0x2a')][_0xaee5('0x2c')]);}else{logger[_0xaee5('0x24')](_0xaee5('0x25'),_0x303c73,_0xaee5('0x26'));_0x299008(_0x46df3d[_0xaee5('0x2d')][_0xaee5('0x2c')]);}})['catch'](function(_0x4a7791){logger[_0xaee5('0x2a')](_0xaee5('0x25'),_0x303c73,_0x4a7791);_0x5e5ef4(_0x4a7791);});});}function respondWithStatusCode(_0x57c9d3,_0x17ad4b){_0x17ad4b=_0x17ad4b||0xcc;return function(_0x3300e3){if(_0x3300e3){return _0x57c9d3[_0xaee5('0x2e')](_0x17ad4b);}return _0x57c9d3[_0xaee5('0x2f')](_0x17ad4b)[_0xaee5('0x30')]();};}function respondWithResult(_0x34098e,_0x378e5b){_0x378e5b=_0x378e5b||0xc8;return function(_0x599b34){if(_0x599b34){return _0x34098e[_0xaee5('0x2f')](_0x378e5b)[_0xaee5('0x31')](_0x599b34);}};}function respondWithFilteredResult(_0x3568c5,_0x18e023){return function(_0x21b3b8){if(_0x21b3b8){var _0x2281c7=typeof _0x18e023[_0xaee5('0x32')]==='undefined'&&typeof _0x18e023[_0xaee5('0x33')]==='undefined';var _0xb06e51=_0x21b3b8[_0xaee5('0x34')];var _0x15e255=_0x2281c7?0x0:_0x18e023[_0xaee5('0x32')];var _0x5ef4d4=_0x2281c7?_0x21b3b8[_0xaee5('0x34')]:_0x18e023[_0xaee5('0x32')]+_0x18e023[_0xaee5('0x33')];var _0x47eedf;if(_0x5ef4d4>=_0xb06e51){_0x5ef4d4=_0xb06e51;_0x47eedf=0xc8;}else{_0x47eedf=0xce;}_0x3568c5['status'](_0x47eedf);return _0x3568c5[_0xaee5('0x35')](_0xaee5('0x36'),_0x15e255+'-'+_0x5ef4d4+'/'+_0xb06e51)[_0xaee5('0x31')](_0x21b3b8);}return null;};}function patchUpdates(_0x378526){return function(_0x487f65){try{jsonpatch['apply'](_0x487f65,_0x378526,!![]);}catch(_0x386160){return BPromise[_0xaee5('0x37')](_0x386160);}return _0x487f65[_0xaee5('0x38')]();};}function saveUpdates(_0x140ce8,_0x437788){return function(_0x3e6ece){if(_0x3e6ece){return _0x3e6ece[_0xaee5('0x39')](_0x140ce8)[_0xaee5('0x23')](function(_0x55f3a2){return _0x55f3a2;});}return null;};}function removeEntity(_0x1581f4,_0x3e397d){return function(_0x43c87d){if(_0x43c87d){return _0x43c87d['destroy']()[_0xaee5('0x23')](function(){var _0x5d8f69=_0x43c87d[_0xaee5('0x3a')]({'plain':!![]});var _0xf465b=_0xaee5('0x3b');return db[_0xaee5('0x3c')]['destroy']({'where':{'type':_0xf465b,'resourceId':_0x5d8f69['id']}})[_0xaee5('0x23')](function(){return _0x43c87d;});})[_0xaee5('0x23')](function(){_0x1581f4[_0xaee5('0x2f')](0xcc)[_0xaee5('0x30')]();});}};}function handleEntityNotFound(_0x81598,_0x5751cb){return function(_0x16be48){if(!_0x16be48){_0x81598['sendStatus'](0x194);}return _0x16be48;};}function handleError(_0x3604f4,_0x5761c7){_0x5761c7=_0x5761c7||0x1f4;return function(_0x17a773){logger[_0xaee5('0x2a')](_0x17a773['stack']);if(_0x17a773[_0xaee5('0x3d')]){delete _0x17a773[_0xaee5('0x3d')];}_0x3604f4['status'](_0x5761c7)['send'](_0x17a773);};}exports[_0xaee5('0x3e')]=function(_0x2e9a2b,_0x3db219){var _0x934e9f={'include':[{'model':db['Pause'],'as':_0xaee5('0x3f')}]},_0x5c4e8f={},_0x1280bb={'count':0x0,'rows':[]};var _0x5170c9=_['map'](db[_0xaee5('0x40')][_0xaee5('0x41')],function(_0x2f6e8b){return{'name':_0x2f6e8b[_0xaee5('0x42')],'type':_0x2f6e8b['type'][_0xaee5('0x43')]};});_0x5c4e8f[_0xaee5('0x44')]=_[_0xaee5('0x45')](_0x5170c9,'name');_0x5c4e8f['query']=_[_0xaee5('0x46')](_0x2e9a2b[_0xaee5('0x47')]);_0x5c4e8f[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x5c4e8f[_0xaee5('0x44')],_0x5c4e8f[_0xaee5('0x47')]);_0x934e9f[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x5c4e8f['model'],qs['fields'](_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x934e9f[_0xaee5('0x4a')]=_0x934e9f['attributes'][_0xaee5('0x4c')]?_0x934e9f[_0xaee5('0x4a')]:_0x5c4e8f['model'];if(!_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x4d')](_0xaee5('0x4e'))){_0x934e9f[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x33')]);_0x934e9f[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x2e9a2b[_0xaee5('0x47')]['offset']);}_0x934e9f[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x2e9a2b[_0xaee5('0x47')]['sort']);_0x934e9f['where']=qs[_0xaee5('0x48')](_[_0xaee5('0x51')](_0x2e9a2b[_0xaee5('0x47')],_0x5c4e8f[_0xaee5('0x48')]),_0x5170c9);if(_0x2e9a2b[_0xaee5('0x47')]['filter']){_0x934e9f[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x934e9f[_0xaee5('0x52')],{'$or':_['map'](_0x5170c9,function(_0x1a036f){if(_0x1a036f[_0xaee5('0x54')]!==_0xaee5('0x55')){var _0xe7a7ca={};_0xe7a7ca[_0x1a036f['name']]={'$like':'%'+_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x56')]+'%'};return _0xe7a7ca;}})});}_0x934e9f=_[_0xaee5('0x53')]({},_0x934e9f,_0x2e9a2b['options']);var _0x33d8a3={'where':_0x934e9f[_0xaee5('0x52')]};return db[_0xaee5('0x40')][_0xaee5('0x34')](_0x33d8a3)['then'](function(_0x316b01){_0x1280bb[_0xaee5('0x34')]=_0x316b01;if(_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x57')]){_0x934e9f[_0xaee5('0x58')]=[{'all':!![]}];}return db[_0xaee5('0x40')][_0xaee5('0x59')](_0x934e9f);})[_0xaee5('0x23')](function(_0x15c45a){_0x1280bb[_0xaee5('0x5a')]=_0x15c45a;return _0x1280bb;})[_0xaee5('0x23')](respondWithFilteredResult(_0x3db219,_0x934e9f))[_0xaee5('0x5b')](handleError(_0x3db219,null));};exports[_0xaee5('0x5c')]=function(_0x36cd5a,_0x3c5269){var _0x36a4d0={'raw':![],'where':{'id':_0x36cd5a[_0xaee5('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xaee5('0x3f')}]},_0x313c90={};_0x313c90[_0xaee5('0x44')]=_['keys'](db[_0xaee5('0x40')][_0xaee5('0x41')]);_0x313c90[_0xaee5('0x47')]=_[_0xaee5('0x46')](_0x36cd5a['query']);_0x313c90[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x313c90[_0xaee5('0x44')],_0x313c90['query']);_0x36a4d0[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x313c90[_0xaee5('0x44')],qs[_0xaee5('0x4b')](_0x36cd5a[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x36a4d0[_0xaee5('0x4a')]=_0x36a4d0[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x36a4d0[_0xaee5('0x4a')]:_0x313c90[_0xaee5('0x44')];if(_0x36cd5a[_0xaee5('0x47')][_0xaee5('0x57')]){_0x36a4d0[_0xaee5('0x58')]=[{'all':!![]}];}_0x36a4d0=_[_0xaee5('0x53')]({},_0x36a4d0,_0x36cd5a[_0xaee5('0x5e')]);return db[_0xaee5('0x40')][_0xaee5('0x5f')](_0x36a4d0)[_0xaee5('0x23')](handleEntityNotFound(_0x3c5269,null))[_0xaee5('0x23')](respondWithResult(_0x3c5269,null))[_0xaee5('0x5b')](handleError(_0x3c5269,null));};exports[_0xaee5('0x60')]=function(_0xbbf22a,_0x205595){return db[_0xaee5('0x40')]['create'](_0xbbf22a[_0xaee5('0x61')],{})['then'](function(_0x2dc13d){var _0x2567f6=_0xbbf22a['user'][_0xaee5('0x3a')]({'plain':!![]});if(!_0x2567f6)throw new Error(_0xaee5('0x62'));if(_0x2567f6[_0xaee5('0x63')]===_0xaee5('0x64')){var _0x570888=_0x2dc13d[_0xaee5('0x3a')]({'plain':!![]});var _0x2fafd5=_0xaee5('0x3b');return db['UserProfileSection'][_0xaee5('0x5f')]({'where':{'name':_0x2fafd5,'userProfileId':_0x2567f6[_0xaee5('0x65')]},'raw':!![]})['then'](function(_0x62dbf5){if(_0x62dbf5&&_0x62dbf5[_0xaee5('0x66')]===0x0){return db[_0xaee5('0x3c')][_0xaee5('0x60')]({'name':_0x570888[_0xaee5('0x3d')],'resourceId':_0x570888['id'],'type':_0x62dbf5[_0xaee5('0x3d')],'sectionId':_0x62dbf5['id']},{})['then'](function(){return _0x2dc13d;});}else{return _0x2dc13d;}})[_0xaee5('0x5b')](function(_0x2c56d4){logger[_0xaee5('0x2a')](_0xaee5('0x67'),_0x2c56d4);throw _0x2c56d4;});}return _0x2dc13d;})['then'](respondWithResult(_0x205595,0xc9))[_0xaee5('0x5b')](handleError(_0x205595,null));};exports[_0xaee5('0x39')]=function(_0x1eb721,_0x1eabf1){if(_0x1eb721['body']['id']){delete _0x1eb721[_0xaee5('0x61')]['id'];}return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x1eb721[_0xaee5('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xaee5('0x3f')}]})['then'](handleEntityNotFound(_0x1eabf1,null))[_0xaee5('0x23')](saveUpdates(_0x1eb721[_0xaee5('0x61')],null))[_0xaee5('0x23')](respondWithResult(_0x1eabf1,null))[_0xaee5('0x5b')](handleError(_0x1eabf1,null));};exports[_0xaee5('0x68')]=function(_0x2450ac,_0x5a3bd8){return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x2450ac[_0xaee5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5a3bd8,null))['then'](removeEntity(_0x5a3bd8,null))[_0xaee5('0x5b')](handleError(_0x5a3bd8,null));};exports['describe']=function(_0x3213d0,_0xac39f3){return db[_0xaee5('0x40')]['describe']()[_0xaee5('0x23')](respondWithResult(_0xac39f3,null))['catch'](handleError(_0xac39f3,null));};exports[_0xaee5('0x69')]=function(_0x40d5db,_0x240070,_0x39f0aa){if(_0x40d5db[_0xaee5('0x61')]['id']){delete _0x40d5db[_0xaee5('0x61')]['id'];}return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x40d5db[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x240070,null))['then'](function(_0x3ac585){if(_0x3ac585){_0x40d5db[_0xaee5('0x61')][_0xaee5('0x6a')]=_0x3ac585['id'];return db[_0xaee5('0x6b')]['create'](_0x40d5db['body']);}})['then'](respondWithResult(_0x240070,null))[_0xaee5('0x5b')](handleError(_0x240070,null));};exports[_0xaee5('0x6c')]=function(_0x3a38f3,_0x4cfa84,_0x35e1e6){var _0x543c30={'raw':![],'where':{}};var _0xc7bec7={};var _0x5060da={'count':0x0,'rows':[]};return db[_0xaee5('0x40')][_0xaee5('0x6d')]({'where':{'id':_0x3a38f3[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x4cfa84,null))[_0xaee5('0x23')](function(_0x1789d6){if(_0x1789d6){_0xc7bec7[_0xaee5('0x44')]=_[_0xaee5('0x46')](db[_0xaee5('0x6b')][_0xaee5('0x41')]);_0xc7bec7['query']=_['keys'](_0x3a38f3[_0xaee5('0x47')]);_0xc7bec7[_0xaee5('0x48')]=_['intersection'](_0xc7bec7[_0xaee5('0x44')],_0xc7bec7[_0xaee5('0x47')]);_0x543c30[_0xaee5('0x4a')]=_['intersection'](_0xc7bec7[_0xaee5('0x44')],qs[_0xaee5('0x4b')](_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x543c30[_0xaee5('0x4a')]=_0x543c30[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x543c30['attributes']:_0xc7bec7[_0xaee5('0x44')];if(!_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x4d')](_0xaee5('0x4e'))){_0x543c30[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x3a38f3['query'][_0xaee5('0x33')]);_0x543c30[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x3a38f3['query'][_0xaee5('0x32')]);}_0x543c30[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x50')]);_0x543c30['where']=qs['filters'](_['pick'](_0x3a38f3[_0xaee5('0x47')],_0xc7bec7['filters']));_0x543c30['where']['FaxAccountId']=_0x1789d6['id'];if(_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x56')]){_0x543c30['where']=_['merge'](_0x543c30[_0xaee5('0x52')],{'$or':_[_0xaee5('0x45')](_0x543c30['attributes'],function(_0x3a2c95){var _0x3e2e8b={};_0x3e2e8b[_0x3a2c95]={'$like':'%'+_0x3a38f3['query'][_0xaee5('0x56')]+'%'};return _0x3e2e8b;})});}_0x543c30=_[_0xaee5('0x53')]({},_0x543c30,_0x3a38f3[_0xaee5('0x5e')]);return db[_0xaee5('0x6b')][_0xaee5('0x34')]({'where':_0x543c30[_0xaee5('0x52')]})['then'](function(_0x3c3d5c){_0x5060da[_0xaee5('0x34')]=_0x3c3d5c;if(_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x57')]){_0x543c30['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x543c30);})[_0xaee5('0x23')](function(_0x1c602d){_0x5060da[_0xaee5('0x5a')]=_0x1c602d;return _0x5060da;});}})[_0xaee5('0x23')](respondWithFilteredResult(_0x4cfa84,_0x543c30))[_0xaee5('0x5b')](handleError(_0x4cfa84,null));};exports[_0xaee5('0x6e')]=function(_0x51e64d,_0x4208f5,_0xd6711f){return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x51e64d[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x4208f5,null))[_0xaee5('0x23')](function(_0x5a2304){if(_0x5a2304){return _0x5a2304[_0xaee5('0x6e')](_0x51e64d['query']['ids']);}})[_0xaee5('0x23')](respondWithStatusCode(_0x4208f5,null))['catch'](handleError(_0x4208f5,null));};exports[_0xaee5('0x6f')]=function(_0x1431a3,_0x28d60e,_0x1c4a97){if(_0x1431a3[_0xaee5('0x61')]['id']){delete _0x1431a3[_0xaee5('0x61')]['id'];}return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x1431a3['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x28d60e,null))[_0xaee5('0x23')](function(_0x48adeb){if(_0x48adeb){_0x1431a3[_0xaee5('0x61')][_0xaee5('0x6a')]=_0x48adeb['id'];return db[_0xaee5('0x70')][_0xaee5('0x60')](_0x1431a3[_0xaee5('0x61')]);}})[_0xaee5('0x23')](respondWithResult(_0x28d60e,null))[_0xaee5('0x5b')](handleError(_0x28d60e,null));};exports['getAnswers']=function(_0x19c055,_0x24e1a1,_0x553fb9){var _0x2697a2={'raw':![],'where':{}};var _0x3cb5f7={};var _0x448cb1={'count':0x0,'rows':[]};return db[_0xaee5('0x40')][_0xaee5('0x6d')]({'where':{'id':_0x19c055['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x24e1a1,null))[_0xaee5('0x23')](function(_0x15b771){if(_0x15b771){_0x3cb5f7[_0xaee5('0x44')]=_[_0xaee5('0x46')](db['CannedAnswer']['rawAttributes']);_0x3cb5f7[_0xaee5('0x47')]=_[_0xaee5('0x46')](_0x19c055[_0xaee5('0x47')]);_0x3cb5f7[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x3cb5f7[_0xaee5('0x44')],_0x3cb5f7[_0xaee5('0x47')]);_0x2697a2[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x3cb5f7[_0xaee5('0x44')],qs['fields'](_0x19c055[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x2697a2[_0xaee5('0x4a')]=_0x2697a2[_0xaee5('0x4a')]['length']?_0x2697a2[_0xaee5('0x4a')]:_0x3cb5f7[_0xaee5('0x44')];if(!_0x19c055[_0xaee5('0x47')][_0xaee5('0x4d')]('nolimit')){_0x2697a2[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x19c055[_0xaee5('0x47')][_0xaee5('0x33')]);_0x2697a2[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x19c055[_0xaee5('0x47')]['offset']);}_0x2697a2[_0xaee5('0x4f')]=qs['sort'](_0x19c055['query'][_0xaee5('0x50')]);_0x2697a2['where']=qs['filters'](_[_0xaee5('0x51')](_0x19c055['query'],_0x3cb5f7['filters']));_0x2697a2[_0xaee5('0x52')]['FaxAccountId']=_0x15b771['id'];if(_0x19c055[_0xaee5('0x47')][_0xaee5('0x56')]){_0x2697a2['where']=_[_0xaee5('0x53')](_0x2697a2[_0xaee5('0x52')],{'$or':_[_0xaee5('0x45')](_0x2697a2['attributes'],function(_0x615e67){var _0x10784d={};_0x10784d[_0x615e67]={'$like':'%'+_0x19c055[_0xaee5('0x47')]['filter']+'%'};return _0x10784d;})});}_0x2697a2=_[_0xaee5('0x53')]({},_0x2697a2,_0x19c055[_0xaee5('0x5e')]);return db[_0xaee5('0x70')][_0xaee5('0x34')]({'where':_0x2697a2[_0xaee5('0x52')]})['then'](function(_0x1cf88e){_0x448cb1[_0xaee5('0x34')]=_0x1cf88e;if(_0x19c055[_0xaee5('0x47')][_0xaee5('0x57')]){_0x2697a2[_0xaee5('0x58')]=[{'all':!![]}];}return db[_0xaee5('0x70')][_0xaee5('0x59')](_0x2697a2);})['then'](function(_0x4f3a1c){_0x448cb1['rows']=_0x4f3a1c;return _0x448cb1;});}})['then'](respondWithFilteredResult(_0x24e1a1,_0x2697a2))['catch'](handleError(_0x24e1a1,null));};exports['removeAnswers']=function(_0x141e3a,_0x28efd0,_0x7522ef){return db[_0xaee5('0x40')]['find']({'where':{'id':_0x141e3a['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x28efd0,null))[_0xaee5('0x23')](function(_0x1320d7){if(_0x1320d7){return _0x1320d7[_0xaee5('0x71')](_0x141e3a[_0xaee5('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x28efd0,null))['catch'](handleError(_0x28efd0,null));};exports[_0xaee5('0x72')]=function(_0x18cfff,_0x467d3f,_0x22bf0a){return db[_0xaee5('0x73')]['find']({'where':{'id':_0x18cfff[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x467d3f,null))[_0xaee5('0x23')](function(_0x1acb96){if(_0x1acb96){return _0x1acb96[_0xaee5('0x72')](_0x18cfff[_0xaee5('0x61')][_0xaee5('0x74')],_[_0xaee5('0x75')](_0x18cfff[_0xaee5('0x61')],['ids','id'])||{});}})[_0xaee5('0x23')](respondWithResult(_0x467d3f,null))[_0xaee5('0x5b')](handleError(_0x467d3f,null));};exports[_0xaee5('0x76')]=function(_0x32cd7b,_0x7ac540,_0x37da1a){var _0x5803d4={'raw':![],'where':{}};var _0x771b86={};var _0x5111e3={'count':0x0,'rows':[]};return db[_0xaee5('0x40')][_0xaee5('0x6d')]({'where':{'id':_0x32cd7b[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x7ac540,null))[_0xaee5('0x23')](function(_0x5bb932){if(_0x5bb932){_0x771b86[_0xaee5('0x44')]=_['keys'](db[_0xaee5('0x73')]['rawAttributes']);_0x771b86[_0xaee5('0x47')]=_['keys'](_0x32cd7b[_0xaee5('0x47')]);_0x771b86[_0xaee5('0x48')]=_['intersection'](_0x771b86[_0xaee5('0x44')],_0x771b86[_0xaee5('0x47')]);_0x5803d4[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x771b86[_0xaee5('0x44')],qs[_0xaee5('0x4b')](_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x5803d4['attributes']=_0x5803d4[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x5803d4['attributes']:_0x771b86[_0xaee5('0x44')];if(!_0x32cd7b[_0xaee5('0x47')]['hasOwnProperty'](_0xaee5('0x4e'))){_0x5803d4[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x32cd7b[_0xaee5('0x47')]['limit']);_0x5803d4[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x32cd7b['query'][_0xaee5('0x32')]);}_0x5803d4[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x50')]);_0x5803d4['where']=qs[_0xaee5('0x48')](_['pick'](_0x32cd7b[_0xaee5('0x47')],_0x771b86['filters']));_0x5803d4[_0xaee5('0x52')][_0xaee5('0x6a')]=_0x5bb932['id'];if(_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x56')]){_0x5803d4[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x5803d4[_0xaee5('0x52')],{'$or':_[_0xaee5('0x45')](_0x5803d4[_0xaee5('0x4a')],function(_0x5be22e){var _0x6d0871={};_0x6d0871[_0x5be22e]={'$like':'%'+_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x56')]+'%'};return _0x6d0871;})});}_0x5803d4=_[_0xaee5('0x53')]({},_0x5803d4,_0x32cd7b[_0xaee5('0x5e')]);return db[_0xaee5('0x73')][_0xaee5('0x34')]({'where':_0x5803d4[_0xaee5('0x52')]})['then'](function(_0x3231fc){_0x5111e3[_0xaee5('0x34')]=_0x3231fc;if(_0x32cd7b['query'][_0xaee5('0x57')]){_0x5803d4[_0xaee5('0x58')]=[{'model':db[_0xaee5('0x77')],'as':_0xaee5('0x78'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xaee5('0x3d'),'fullname','internal'],'required':![]},{'model':db[_0xaee5('0x79')],'as':'Tags','attributes':['id',_0xaee5('0x3d'),_0xaee5('0x7a')],'where':_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x7b')]?{'id':_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x7b')]}:undefined,'required':_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x7b')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x5803d4);})[_0xaee5('0x23')](function(_0xbe3b68){_0x5111e3[_0xaee5('0x5a')]=_0xbe3b68;return _0x5111e3;});}})[_0xaee5('0x23')](respondWithFilteredResult(_0x7ac540,_0x5803d4))[_0xaee5('0x5b')](handleError(_0x7ac540,null));};exports[_0xaee5('0x7c')]=function(_0x47e3c5,_0x50c04e){var _0x1d6d92=_0x47e3c5['params']['id'];var _0x36b014=_0x47e3c5['body'];var _0x357bf1=0xc8;var _0x12888d=null;return db[_0xaee5('0x7d')]['transaction']({'isolationLevel':db[_0xaee5('0x7d')][_0xaee5('0x7e')][_0xaee5('0x7f')]['READ_COMMITTED']},function(_0x43dec8){return db['FaxAccount'][_0xaee5('0x6d')]({'where':{'id':_0x1d6d92},'transaction':_0x43dec8})['then'](function(_0x77251){if(_0x77251){return db[_0xaee5('0x80')][_0xaee5('0x68')]({'where':{'FaxAccountId':_0x1d6d92},'transaction':_0x43dec8})[_0xaee5('0x23')](function(){var _0x4eef4d=_[_0xaee5('0x45')](_0x36b014,function(_0x344305){_0x344305['FaxAccountId']=_0x1d6d92;return _0x344305;});return db[_0xaee5('0x80')][_0xaee5('0x81')](_0x4eef4d,{'transaction':_0x43dec8});});}else{_0x357bf1=0x194;_0x12888d=[];}});})['then'](function(){if(_0x357bf1!==0x194){return db[_0xaee5('0x80')][_0xaee5('0x82')]({'where':{'FaxAccountId':_0x1d6d92},'order':_0xaee5('0x83')})[_0xaee5('0x23')](function(_0x19c575){_0x12888d=_0x19c575;});}})[_0xaee5('0x5b')](function(_0x14a1a9){_0x357bf1=0x1f4;logger[_0xaee5('0x2a')](_0x14a1a9[_0xaee5('0x84')]);if(_0x14a1a9[_0xaee5('0x3d')]){delete _0x14a1a9['name'];}_0x12888d=_0x14a1a9;})[_0xaee5('0x85')](function(){if(_0x12888d===null){_0x50c04e[_0xaee5('0x2e')](_0x357bf1);}else{if(_0x357bf1===0x1f4){_0x50c04e[_0xaee5('0x2f')](_0x357bf1)[_0xaee5('0x86')](_0x12888d);}else{_0x50c04e[_0xaee5('0x2f')](_0x357bf1)[_0xaee5('0x31')](_0x12888d);}}});};exports[_0xaee5('0x87')]=function(_0x48bc76,_0x581e40,_0x5ecac9){var _0xc5242d={};var _0x4e0565={};var _0x49f44e;var _0x3c9fe3;return db['FaxAccount'][_0xaee5('0x6d')]({'where':{'id':_0x48bc76['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x581e40,null))[_0xaee5('0x23')](function(_0x40cf6c){if(_0x40cf6c){_0x49f44e=_0x40cf6c;_0x4e0565[_0xaee5('0x44')]=_[_0xaee5('0x46')](db[_0xaee5('0x80')][_0xaee5('0x41')]);_0x4e0565[_0xaee5('0x47')]=_['keys'](_0x48bc76['query']);_0x4e0565[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x4e0565[_0xaee5('0x44')],_0x4e0565[_0xaee5('0x47')]);_0xc5242d[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x4e0565['model'],qs['fields'](_0x48bc76[_0xaee5('0x47')]['fields']));_0xc5242d[_0xaee5('0x4a')]=_0xc5242d[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0xc5242d[_0xaee5('0x4a')]:_0x4e0565['model'];_0xc5242d[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x48bc76[_0xaee5('0x47')]['sort']);_0xc5242d[_0xaee5('0x52')]=qs[_0xaee5('0x48')](_[_0xaee5('0x51')](_0x48bc76['query'],_0x4e0565[_0xaee5('0x48')]));if(_0x48bc76[_0xaee5('0x47')][_0xaee5('0x56')]){_0xc5242d['where']=_[_0xaee5('0x53')](_0xc5242d['where'],{'$or':_[_0xaee5('0x45')](_0xc5242d[_0xaee5('0x4a')],function(_0x144573){var _0x9f3cca={};_0x9f3cca[_0x144573]={'$like':'%'+_0x48bc76['query'][_0xaee5('0x56')]+'%'};return _0x9f3cca;})});}_0xc5242d=_['merge']({},_0xc5242d,_0x48bc76[_0xaee5('0x5e')]);return _0x49f44e[_0xaee5('0x87')](_0xc5242d);}})['then'](function(_0x3c90b9){if(_0x3c90b9){_0x3c9fe3=_0x3c90b9['length'];if(!_0x48bc76[_0xaee5('0x47')][_0xaee5('0x4d')](_0xaee5('0x4e'))){_0xc5242d[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x48bc76[_0xaee5('0x47')][_0xaee5('0x33')]);_0xc5242d['offset']=qs['offset'](_0x48bc76[_0xaee5('0x47')][_0xaee5('0x32')]);}return _0x49f44e[_0xaee5('0x87')](_0xc5242d);}})['then'](function(_0xac989){if(_0xac989){return _0xac989?{'count':_0x3c9fe3,'rows':_0xac989}:null;}})['then'](respondWithResult(_0x581e40,null))['catch'](handleError(_0x581e40,null));};function Extension(_0x2e857e,_0x48ac50,_0x4e8a08,_0xd065d1){this['context']=_0xaee5('0x88');this[_0xaee5('0x89')]=_0x2e857e[_0xaee5('0x8a')];this[_0xaee5('0x8b')]=_0xd065d1;this[_0xaee5('0x54')]='system';this[_0xaee5('0x8c')]='Fax\x20Extension';this['FaxAccountId']=_0x2e857e['id'];this[_0xaee5('0x83')]=_0x48ac50;this[_0xaee5('0x8d')]=_0x4e8a08;}function createExtensionsReciveFax(_0x5391ef){var _0xa0e65=0x1;var _0x466165=[];_0x466165[_0xaee5('0x8e')](new Extension(_0x5391ef,_0xa0e65,'',_0xaee5('0x8f')));_0xa0e65+=0x1;_0x466165[_0xaee5('0x8e')](new Extension(_0x5391ef,_0xa0e65,'CDR(type)=inbound-fax',_0xaee5('0x90')));_0xa0e65+=0x1;for(var _0x187eee in _0x5391ef){if(_0x5391ef[_0xaee5('0x4d')](_0x187eee)&&(_0x187eee===_0xaee5('0x91')||_0x187eee===_0xaee5('0x8a')||_0x187eee==='gateway'||_0x187eee===_0xaee5('0x92')||_0x187eee===_0xaee5('0x93')||_0x187eee===_0xaee5('0x94')||_0x187eee===_0xaee5('0x95')||_0x187eee===_0xaee5('0x96')||_0x187eee===_0xaee5('0x97'))){_0x466165[_0xaee5('0x8e')](new Extension(_0x5391ef,_0xa0e65,_0xaee5('0x98')+_0x187eee+')='+_0x5391ef[_0x187eee],_0xaee5('0x90')));_0xa0e65+=0x1;}}_0x466165[_0xaee5('0x8e')](new Extension(_0x5391ef,_0xa0e65,'6',_0xaee5('0x99')));_0xa0e65+=0x1;_0x466165['push'](new Extension(_0x5391ef,_0xa0e65,_0xaee5('0x9a'),_0xaee5('0x9b')));_0xa0e65=0x0;return _0x466165;}exports[_0xaee5('0x9c')]=function(_0xcf9dcf,_0x3ea13e,_0x54159e){var _0x2c35a2;return db[_0xaee5('0x7d')]['transaction'](function(_0xcecb0){return db[_0xaee5('0x40')]['create'](_0xcf9dcf[_0xaee5('0x61')],{'transaction':_0xcecb0})[_0xaee5('0x23')](function(_0x4aeba6){_0x2c35a2=_0x4aeba6[_0xaee5('0x3a')]({'plain':!![]});return db[_0xaee5('0x9d')][_0xaee5('0x81')](createExtensionsReciveFax(_0x2c35a2),{'transaction':_0xcecb0});});})[_0xaee5('0x23')](function(){return _0x2c35a2;})['then'](respondWithResult(_0x3ea13e,null))['catch'](handleError(_0x3ea13e,null));};exports[_0xaee5('0x9e')]=function(_0x514424,_0x5ca5c3,_0x4b0ab0){var _0x56cade;return db[_0xaee5('0x7d')]['transaction'](function(_0x46fd35){return db[_0xaee5('0x40')]['update'](_0x514424['body'],{'where':{'id':_0x514424[_0xaee5('0x61')]['id']},'transaction':_0x46fd35})[_0xaee5('0x23')](function(_0x514696){return db[_0xaee5('0x9d')][_0xaee5('0x68')]({'where':{'FaxAccountId':_0x514424[_0xaee5('0x61')]['id']},'transaction':_0x46fd35})['then'](function(_0x134dd9){return db[_0xaee5('0x9d')][_0xaee5('0x81')](createExtensionsReciveFax(_[_0xaee5('0x75')](_0x514424['body'],[_0xaee5('0x9f'),_0xaee5('0x43'),_0xaee5('0xa0'),_0xaee5('0xa1'),_0xaee5('0xa2'),_0xaee5('0xa3')])),{'transaction':_0x46fd35});});});})['then'](function(){return db[_0xaee5('0x40')][_0xaee5('0xa4')](_0x514424[_0xaee5('0x61')]['id']);})[_0xaee5('0x23')](respondWithResult(_0x5ca5c3,null))[_0xaee5('0x5b')](handleError(_0x5ca5c3,null));};exports[_0xaee5('0xa5')]=function(_0x136e3d,_0x22632b,_0x50b334){var _0x1324bf={'raw':!![],'where':{}};var _0x3e3935={};var _0x56a269={'count':0x0,'rows':[]};return db[_0xaee5('0x40')][_0xaee5('0x6d')]({'where':{'id':_0x136e3d[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x22632b,null))[_0xaee5('0x23')](function(_0x2eb719){if(_0x2eb719){_0x3e3935[_0xaee5('0x44')]=_[_0xaee5('0x46')](db[_0xaee5('0xa6')]['rawAttributes']);_0x3e3935['query']=_[_0xaee5('0x46')](_0x136e3d['query']);_0x3e3935[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x3e3935['model'],_0x3e3935[_0xaee5('0x47')]);_0x1324bf[_0xaee5('0x4a')]=_['intersection'](_0x3e3935[_0xaee5('0x44')],qs[_0xaee5('0x4b')](_0x136e3d[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x1324bf['attributes']=_0x1324bf[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x1324bf[_0xaee5('0x4a')]:_0x3e3935[_0xaee5('0x44')];if(!_0x136e3d[_0xaee5('0x47')][_0xaee5('0x4d')]('nolimit')){_0x1324bf[_0xaee5('0x33')]=qs['limit'](_0x136e3d[_0xaee5('0x47')][_0xaee5('0x33')]);_0x1324bf[_0xaee5('0x32')]=qs['offset'](_0x136e3d[_0xaee5('0x47')][_0xaee5('0x32')]);}_0x1324bf[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x136e3d[_0xaee5('0x47')][_0xaee5('0x50')]);_0x1324bf[_0xaee5('0x52')]=qs[_0xaee5('0x48')](_[_0xaee5('0x51')](_0x136e3d[_0xaee5('0x47')],_0x3e3935[_0xaee5('0x48')]));_0x1324bf[_0xaee5('0x52')][_0xaee5('0x6a')]=_0x2eb719['id'];if(_0x136e3d[_0xaee5('0x47')][_0xaee5('0x56')]){_0x1324bf[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x1324bf[_0xaee5('0x52')],{'$or':_[_0xaee5('0x45')](_0x1324bf[_0xaee5('0x4a')],function(_0x1cbdac){var _0xa9de79={};_0xa9de79[_0x1cbdac]={'$like':'%'+_0x136e3d[_0xaee5('0x47')][_0xaee5('0x56')]+'%'};return _0xa9de79;})});}if(_0x136e3d[_0xaee5('0x47')][_0xaee5('0xa7')]){var _0x5224ed=_0x136e3d[_0xaee5('0x47')]['$gte'][_0xaee5('0xa8')](',');var _0x349003={};_0x349003[_0x5224ed[0x0]]={'$gte':moment(_0x5224ed[0x1])[_0xaee5('0xa9')](_0xaee5('0xaa'))};_0x1324bf[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x1324bf['where'],_0x349003);}_0x1324bf=_['merge']({},_0x1324bf,_0x136e3d[_0xaee5('0x5e')]);return db[_0xaee5('0xa6')][_0xaee5('0x34')]({'where':_0x1324bf['where']})[_0xaee5('0x23')](function(_0x174b16){_0x56a269[_0xaee5('0x34')]=_0x174b16;if(_0x136e3d[_0xaee5('0x47')][_0xaee5('0x57')]){_0x1324bf[_0xaee5('0x58')]=[{'all':!![]}];}return db[_0xaee5('0xa6')][_0xaee5('0x59')](_0x1324bf);})['then'](function(_0x6058e3){_0x56a269[_0xaee5('0x5a')]=_0x6058e3;return _0x56a269;});}})[_0xaee5('0x23')](respondWithFilteredResult(_0x22632b,_0x1324bf))[_0xaee5('0x5b')](handleError(_0x22632b,null));};exports['send']=function(_0x5aa9d5,_0x45fe22,_0x203ab9){var _0x3d56df,_0x31acaa={},_0x59580e;if(_0x5aa9d5[_0xaee5('0x61')]['to']){_0x59580e=_0x5aa9d5['body']['to'][0x0];}return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x5aa9d5[_0xaee5('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0xaee5('0xab'),'include':[{'model':db[_0xaee5('0x77')],'as':_0xaee5('0xac'),'where':{'fax':_0x59580e},'limit':0x1,'order':[[_0xaee5('0xa1'),_0xaee5('0xad')]]}]}]})[_0xaee5('0x23')](handleEntityNotFound(_0x45fe22,null))[_0xaee5('0x23')](function(_0xc46e64){_0x3d56df=_0xc46e64;if(_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')]&&_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][_0xaee5('0x4c')]){for(var _0x35fc8c=0x0;_0x35fc8c<_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][_0xaee5('0x4c')];_0x35fc8c+=0x1){_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][_0x35fc8c]={'filename':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][_0x35fc8c]['name'],'id':_0x5aa9d5['body'][_0xaee5('0xae')][_0x35fc8c]['id'],'path':path[_0xaee5('0xaf')](config[_0xaee5('0xb0')],_0xaee5('0xb1'),_0x5aa9d5[_0xaee5('0x61')]['attachments'][_0x35fc8c]['basename'])};}}return respondWithRpcPromise(_0xaee5('0xb2'),_0xaee5('0xb2'),{'FaxAccountId':_['isNil'](_0x5aa9d5[_0xaee5('0x5d')]['id'])?undefined:_0x5aa9d5[_0xaee5('0x5d')]['id'],'path':_[_0xaee5('0xb3')](_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0][_0xaee5('0x8')])?undefined:_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0][_0xaee5('0x8')],'fax':_[_0xaee5('0xb3')](_0x5aa9d5['body']['to'][0x0])?undefined:_0x5aa9d5['body']['to'][0x0]},client9002);})[_0xaee5('0x23')](function(){if(_0x3d56df){if(_[_0xaee5('0xb3')](_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xb4')])){_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xb4')]=util['format']('\x22%s\x22\x20<%s>',_0x3d56df[_0xaee5('0x3d')],_0x3d56df[_0xaee5('0xb5')]);}if(_0x3d56df[_0xaee5('0xab')]){if(_0x3d56df[_0xaee5('0xab')]['Contacts'][_0xaee5('0x4c')]){return _0x3d56df[_0xaee5('0xab')][_0xaee5('0xac')][0x0];}else{return db[_0xaee5('0x77')][_0xaee5('0x60')](_[_0xaee5('0x1a')](_0x5aa9d5['body'],{'firstName':_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'phone':_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'fax':_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'ListId':_0x3d56df[_0xaee5('0xa3')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xaee5('0xb6'));}})[_0xaee5('0x23')](function(_0x470136){if(_0x470136){return db[_0xaee5('0x73')][_0xaee5('0x5f')]({'where':{'ContactId':_0x470136['id'],'closed':![],'FaxAccountId':_0x3d56df['id']}})[_0xaee5('0x23')](function(_0xa8b6){if(_0xa8b6){return[_0xa8b6,![]];}return db[_0xaee5('0x73')][_0xaee5('0x60')]({'UserId':_0x5aa9d5[_0xaee5('0x64')]['id'],'ContactId':_0x470136['id'],'FaxAccountId':_0x3d56df['id'],'fax':_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'firstMsgDirection':_0xaee5('0xb7'),'Messages':[_['merge'](_0x5aa9d5[_0xaee5('0x61')],{'read':![],'body':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0][_0xaee5('0xb8')],'FaxAccountId':_0x3d56df['id'],'UserId':_0x5aa9d5[_0xaee5('0x64')]['id'],'ContactId':_0x470136['id'],'AttachmentId':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0xaee5('0x23')](function(_0x34487e){return[_0x34487e,!![]];});});}else{throw new Error(_0xaee5('0xb9'));}})[_0xaee5('0xba')](function(_0x5580a5,_0x43fa48){if(_0x43fa48){return _0x5580a5;}return db[_0xaee5('0xa6')][_0xaee5('0x60')]({'direction':_0xaee5('0xb7'),'read':![],'body':_0x5aa9d5[_0xaee5('0x61')]['attachments'][0x0][_0xaee5('0xb8')],'FaxAccountId':_0x3d56df['id'],'FaxInteractionId':_0x5580a5['id'],'UserId':_0x5aa9d5['user']['id'],'ContactId':_0x5580a5[_0xaee5('0xbb')],'AttachmentId':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0]['id']})['then'](function(_0xa5bc9){_0x5580a5[_0xaee5('0xbc')][_0xaee5('0xbd')]=[];_0x5580a5[_0xaee5('0xbc')][_0xaee5('0xbd')]['push'](_0xa5bc9['dataValues']);return _0x5580a5;});})[_0xaee5('0x23')](function(_0x4a99ca){respondWithRpcPromise(_0xaee5('0xbe'),'SendFax',{'FaxAccountId':_['isNil'](_0x5aa9d5[_0xaee5('0x5d')]['id'])?undefined:_0x5aa9d5[_0xaee5('0x5d')]['id'],'path':_[_0xaee5('0xb3')](_0x5aa9d5['body'][_0xaee5('0xae')][0x0]['path'])?undefined:_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0][_0xaee5('0x8')],'fax':_[_0xaee5('0xb3')](_0x5aa9d5['body']['to'][0x0])?undefined:_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'AttachmentId':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0]['id']},client9002)[_0xaee5('0x23')](function(_0x33edf4){logger['info'](_0xaee5('0xbf'),_0x33edf4);})[_0xaee5('0x5b')](function(_0x1b1379){logger[_0xaee5('0x24')](_0xaee5('0xbf'),_0x1b1379);});return _0x4a99ca;})[_0xaee5('0x23')](respondWithResult(_0x45fe22,null))[_0xaee5('0x5b')](handleError(_0x45fe22,null));};exports[_0xaee5('0xc0')]=function(_0x5cbb63,_0x598af0,_0x13ff02){return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x5cbb63[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x598af0,null))[_0xaee5('0x23')](function(_0x56c68d){if(_0x56c68d){return _0x56c68d[_0xaee5('0xc0')](_0x5cbb63['body'][_0xaee5('0x74')],_[_0xaee5('0x75')](_0x5cbb63[_0xaee5('0x61')],[_0xaee5('0x74'),'id'])||{})[_0xaee5('0xba')](function(_0x329ad0){for(var _0x466bf3=0x0;_0x466bf3<_0x5cbb63[_0xaee5('0x61')][_0xaee5('0x74')]['length'];_0x466bf3+=0x1){socket[_0xaee5('0xc1')](_0xaee5('0xc2'),{'UserId':Number(_0x5cbb63[_0xaee5('0x61')][_0xaee5('0x74')][_0x466bf3]),'FaxAccountId':Number(_0x5cbb63[_0xaee5('0x5d')]['id'])});}return _0x329ad0;});}})[_0xaee5('0x23')](respondWithResult(_0x598af0,null))[_0xaee5('0x5b')](handleError(_0x598af0,null));};exports[_0xaee5('0xc3')]=function(_0x1532e2,_0x165c36,_0x361b31){return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x1532e2['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x165c36,null))[_0xaee5('0x23')](function(_0x54e280){if(_0x54e280){return _0x54e280[_0xaee5('0xc3')](_0x1532e2[_0xaee5('0x47')][_0xaee5('0x74')])[_0xaee5('0x23')](function(){if(_[_0xaee5('0xc4')](_0x1532e2[_0xaee5('0x47')][_0xaee5('0x74')])){for(var _0x81282c=0x0;_0x81282c<_0x1532e2[_0xaee5('0x47')][_0xaee5('0x74')]['length'];_0x81282c+=0x1){socket[_0xaee5('0xc1')](_0xaee5('0xc5'),{'UserId':Number(_0x1532e2[_0xaee5('0x47')][_0xaee5('0x74')][_0x81282c]),'FaxAccountId':Number(_0x1532e2[_0xaee5('0x5d')]['id'])});}}else{socket[_0xaee5('0xc1')](_0xaee5('0xc5'),{'UserId':Number(_0x1532e2[_0xaee5('0x47')]['ids']),'FaxAccountId':Number(_0x1532e2['params']['id'])});}});}})[_0xaee5('0x23')](respondWithStatusCode(_0x165c36,null))[_0xaee5('0x5b')](handleError(_0x165c36,null));};exports[_0xaee5('0xc6')]=function(_0x59b28d,_0x2c6d2c,_0x1e48f5){var _0x4d9dec={};var _0x44bcf6={};var _0x39bd70;var _0x3683b3;return db['FaxAccount'][_0xaee5('0x6d')]({'where':{'id':_0x59b28d[_0xaee5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2c6d2c,null))[_0xaee5('0x23')](function(_0x41c8d0){if(_0x41c8d0){_0x39bd70=_0x41c8d0;_0x44bcf6[_0xaee5('0x44')]=_[_0xaee5('0x46')](db[_0xaee5('0xc7')]['rawAttributes']);_0x44bcf6[_0xaee5('0x47')]=_[_0xaee5('0x46')](_0x59b28d[_0xaee5('0x47')]);_0x44bcf6[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x44bcf6[_0xaee5('0x44')],_0x44bcf6['query']);_0x4d9dec[_0xaee5('0x4a')]=_['intersection'](_0x44bcf6['model'],qs[_0xaee5('0x4b')](_0x59b28d['query'][_0xaee5('0x4b')]));_0x4d9dec[_0xaee5('0x4a')]=_0x4d9dec[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x4d9dec[_0xaee5('0x4a')]:_0x44bcf6[_0xaee5('0x44')];_0x4d9dec['order']=qs[_0xaee5('0x50')](_0x59b28d[_0xaee5('0x47')][_0xaee5('0x50')]);_0x4d9dec[_0xaee5('0x52')]=qs['filters'](_['pick'](_0x59b28d[_0xaee5('0x47')],_0x44bcf6[_0xaee5('0x48')]));if(_0x59b28d['query'][_0xaee5('0x56')]){_0x4d9dec[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x4d9dec['where'],{'$or':_[_0xaee5('0x45')](_0x4d9dec[_0xaee5('0x4a')],function(_0x24cc53){var _0x5d5695={};_0x5d5695[_0x24cc53]={'$like':'%'+_0x59b28d[_0xaee5('0x47')][_0xaee5('0x56')]+'%'};return _0x5d5695;})});}_0x4d9dec=_[_0xaee5('0x53')]({},_0x4d9dec,_0x59b28d[_0xaee5('0x5e')]);return _0x39bd70['getAgents'](_0x4d9dec);}})['then'](function(_0x2df1d4){if(_0x2df1d4){_0x3683b3=_0x2df1d4[_0xaee5('0x4c')];if(!_0x59b28d[_0xaee5('0x47')][_0xaee5('0x4d')](_0xaee5('0x4e'))){_0x4d9dec[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x59b28d[_0xaee5('0x47')][_0xaee5('0x33')]);_0x4d9dec[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x59b28d[_0xaee5('0x47')][_0xaee5('0x32')]);}return _0x39bd70[_0xaee5('0xc6')](_0x4d9dec);}})[_0xaee5('0x23')](function(_0x18c30c){if(_0x18c30c){return _0x18c30c?{'count':_0x3683b3,'rows':_0x18c30c}:null;}})[_0xaee5('0x23')](respondWithResult(_0x2c6d2c,null))['catch'](handleError(_0x2c6d2c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2a3d5d9..9c3ec7f 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 _0x53d6=['hasOwnProperty','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save','emit'];(function(_0x5bfb2a,_0x11f206){var _0x3ade2c=function(_0xf2e68){while(--_0xf2e68){_0x5bfb2a['push'](_0x5bfb2a['shift']());}};_0x3ade2c(++_0x11f206);}(_0x53d6,0x113));var _0x653d=function(_0x1a3634,_0x3a5fe7){_0x1a3634=_0x1a3634-0x0;var _0x2338c7=_0x53d6[_0x1a3634];return _0x2338c7;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x653d('0x0'))['db'][_0x653d('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x653d('0x2')](0x0);var events={'afterCreate':_0x653d('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1002a6){return function(_0x1d87bf,_0x147f62,_0x468c9e){FaxAccountEvents[_0x653d('0x4')](_0x1002a6+':'+_0x1d87bf['id'],_0x1d87bf);FaxAccountEvents[_0x653d('0x4')](_0x1002a6,_0x1d87bf);_0x468c9e(null);};}for(var e in events){if(events[_0x653d('0x5')](e)){var event=events[e];FaxAccount[_0x653d('0x6')](e,emitEvent(event));}}module[_0x653d('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xc469=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x48b4f2,_0x1097c0){var _0xa20d72=function(_0x48cd71){while(--_0x48cd71){_0x48b4f2['push'](_0x48b4f2['shift']());}};_0xa20d72(++_0x1097c0);}(_0xc469,0x1f2));var _0x9c46=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xc469[_0x23b655];return _0x364b32;};'use strict';var EventEmitter=require(_0x9c46('0x0'));var FaxAccount=require(_0x9c46('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9c46('0x2')](0x0);var events={'afterCreate':_0x9c46('0x3'),'afterUpdate':'update','afterDestroy':_0x9c46('0x4')};function emitEvent(_0x28ce7a){return function(_0x56afc0,_0x18d122,_0xd64a9a){FaxAccountEvents['emit'](_0x28ce7a+':'+_0x56afc0['id'],_0x56afc0);FaxAccountEvents[_0x9c46('0x5')](_0x28ce7a,_0x56afc0);_0xd64a9a(null);};}for(var e in events){if(events[_0x9c46('0x6')](e)){var event=events[e];FaxAccount[_0x9c46('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e11305b..9da904a 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 _0xef63=['request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x27a036,_0x3c5248){var _0x452696=function(_0x1a7881){while(--_0x1a7881){_0x27a036['push'](_0x27a036['shift']());}};_0x452696(++_0x3c5248);}(_0xef63,0x14c));var _0x3ef6=function(_0x58afc4,_0x2bf44a){_0x58afc4=_0x58afc4-0x0;var _0x4f78a7=_0xef63[_0x58afc4];return _0x4f78a7;};'use strict';var _=require(_0x3ef6('0x0'));var util=require(_0x3ef6('0x1'));var logger=require(_0x3ef6('0x2'))(_0x3ef6('0x3'));var moment=require(_0x3ef6('0x4'));var BPromise=require(_0x3ef6('0x5'));var rp=require(_0x3ef6('0x6'));var fs=require('fs');var path=require(_0x3ef6('0x7'));var rimraf=require(_0x3ef6('0x8'));var config=require('../../config/environment');var attributes=require(_0x3ef6('0x9'));module[_0x3ef6('0xa')]=function(_0x10c1db,_0x528ac0){return _0x10c1db[_0x3ef6('0xb')](_0x3ef6('0xc'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6eae=['./faxAccount.attributes','exports','define','fax_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6eae,0x1d8));var _0xe6ea=function(_0x2e90f9,_0x551105){_0x2e90f9=_0x2e90f9-0x0;var _0x265ccf=_0x6eae[_0x2e90f9];return _0x265ccf;};'use strict';var _=require(_0xe6ea('0x0'));var util=require(_0xe6ea('0x1'));var logger=require(_0xe6ea('0x2'))(_0xe6ea('0x3'));var moment=require(_0xe6ea('0x4'));var BPromise=require('bluebird');var rp=require(_0xe6ea('0x5'));var fs=require('fs');var path=require(_0xe6ea('0x6'));var rimraf=require('rimraf');var config=require(_0xe6ea('0x7'));var attributes=require(_0xe6ea('0x8'));module[_0xe6ea('0x9')]=function(_0x1ab8e3,_0x11be75){return _0x1ab8e3[_0xe6ea('0xa')]('FaxAccount',attributes,{'tableName':_0xe6ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 485fee8..0360628 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 _0x8adb=['../../config/utils','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxAccount.socket','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','NotifyFaxAccount','body','CmContact','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','createdAt','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','List','Contacts','Applications','get','applications','list','priority','asc','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4afe34,_0xfd87b6){var _0x3d75fd=function(_0x4101c4){while(--_0x4101c4){_0x4afe34['push'](_0x4afe34['shift']());}};_0x3d75fd(++_0xfd87b6);}(_0x8adb,0xfb));var _0xb8ad=function(_0x52d676,_0x2a1345){_0x52d676=_0x52d676-0x0;var _0x4e3472=_0x8adb[_0x52d676];return _0x4e3472;};'use strict';var _=require(_0xb8ad('0x0'));var util=require(_0xb8ad('0x1'));var moment=require(_0xb8ad('0x2'));var BPromise=require(_0xb8ad('0x3'));var rs=require(_0xb8ad('0x4'));var fs=require('fs');var Redis=require(_0xb8ad('0x5'));var db=require(_0xb8ad('0x6'))['db'];var utils=require(_0xb8ad('0x7'));var logger=require('../../config/logger')(_0xb8ad('0x8'));var config=require('../../config/environment');var jayson=require(_0xb8ad('0x9'));var client=jayson[_0xb8ad('0xa')][_0xb8ad('0xb')]({'port':0x232c});config['redis']=_[_0xb8ad('0xc')](config[_0xb8ad('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8ad('0xe'))(new Redis(config[_0xb8ad('0xd')]));require(_0xb8ad('0xf'))['register'](socket);function respondWithRpcPromise(_0x3e657b,_0x152216,_0x7d1e27){return new BPromise(function(_0x55cb20,_0x193b80){return client['request'](_0x3e657b,_0x7d1e27)[_0xb8ad('0x10')](function(_0x833ba4){logger['info'](_0xb8ad('0x11'),_0x152216,_0xb8ad('0x12'));logger[_0xb8ad('0x13')](_0xb8ad('0x14'),_0x152216,'request\x20sent',JSON[_0xb8ad('0x15')](_0x833ba4));if(_0x833ba4[_0xb8ad('0x16')]){if(_0x833ba4['error'][_0xb8ad('0x17')]===0x1f4){logger[_0xb8ad('0x16')](_0xb8ad('0x11'),_0x152216,_0x833ba4[_0xb8ad('0x16')][_0xb8ad('0x18')]);return _0x193b80(_0x833ba4['error'][_0xb8ad('0x18')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x152216,_0x833ba4['error'][_0xb8ad('0x18')]);return _0x55cb20(_0x833ba4[_0xb8ad('0x16')]['message']);}else{logger[_0xb8ad('0x19')](_0xb8ad('0x11'),_0x152216,_0xb8ad('0x12'));_0x55cb20(_0x833ba4[_0xb8ad('0x1a')]['message']);}})[_0xb8ad('0x1b')](function(_0x2481e3){logger[_0xb8ad('0x16')]('FaxAccount,\x20%s,\x20%s',_0x152216,_0x2481e3);_0x193b80(_0x2481e3);});});}exports[_0xb8ad('0x1c')]=function(_0x301db2){var _0x432f6f=this;return new Promise(function(_0x28ee98,_0x1d7323){return db[_0xb8ad('0x1d')][_0xb8ad('0x1e')]({'raw':_0x301db2[_0xb8ad('0x1f')]?_0x301db2['options'][_0xb8ad('0x20')]===undefined?!![]:![]:!![],'where':_0x301db2[_0xb8ad('0x1f')]?_0x301db2[_0xb8ad('0x1f')][_0xb8ad('0x21')]||null:null,'attributes':_0x301db2[_0xb8ad('0x1f')]?_0x301db2[_0xb8ad('0x1f')][_0xb8ad('0x22')]||null:null,'limit':_0x301db2[_0xb8ad('0x1f')]?_0x301db2[_0xb8ad('0x1f')][_0xb8ad('0x23')]||null:null,'include':_0x301db2[_0xb8ad('0x1f')]?_0x301db2[_0xb8ad('0x1f')][_0xb8ad('0x24')]?_[_0xb8ad('0x25')](_0x301db2[_0xb8ad('0x1f')][_0xb8ad('0x24')],function(_0x1e47fa){return{'model':db[_0x1e47fa['model']],'as':_0x1e47fa['as'],'attributes':_0x1e47fa[_0xb8ad('0x22')],'include':_0x1e47fa[_0xb8ad('0x24')]?_['map'](_0x1e47fa[_0xb8ad('0x24')],function(_0x359239){return{'model':db[_0x359239['model']],'as':_0x359239['as'],'attributes':_0x359239[_0xb8ad('0x22')],'include':_0x359239[_0xb8ad('0x24')]?_['map'](_0x359239['include'],function(_0x34453a){return{'model':db[_0x34453a['model']],'as':_0x34453a['as'],'attributes':_0x34453a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c0a59){logger['info']('GetFaxAccount',_0x301db2);logger[_0xb8ad('0x13')](_0xb8ad('0x1c'),_0x301db2,JSON[_0xb8ad('0x15')](_0x3c0a59));_0x28ee98(_0x3c0a59);})[_0xb8ad('0x1b')](function(_0x456a5d){logger[_0xb8ad('0x16')]('GetFaxAccount',_0x456a5d[_0xb8ad('0x18')],_0x301db2);_0x1d7323(_0x432f6f[_0xb8ad('0x16')](0x1f4,_0x456a5d['message']));});});};exports[_0xb8ad('0x26')]=function(_0x5a9cdf,_0xd9a815,_0x491654){var _0x18cb28=this;return new Promise(function(_0x23feac,_0x2b7cbf){var _0x3db5d9={'body':_0x5a9cdf[_0xb8ad('0x27')],'channel':'fax'};var _0xe8e4fe=[];var _0x582840=[];var _0x10f9ff={};return db[_0xb8ad('0x28')]['describe']()[_0xb8ad('0x10')](function(_0xf5eeae){if(!_0xf5eeae){throw new db['Sequelize'][(_0xb8ad('0x29'))](_0xb8ad('0x2a'));}_0xe8e4fe=_['difference'](_[_0xb8ad('0x2b')](_0xf5eeae),['createdAt',_0xb8ad('0x2c')]);_0x582840=_[_0xb8ad('0x2d')](_['keys'](_0xf5eeae),[_0xb8ad('0x2e'),_0xb8ad('0x2c'),'CompanyId',_0xb8ad('0x2f')]);if(_0x5a9cdf[_0xb8ad('0x27')]['id']){delete _0x5a9cdf['body']['id'];}if(_[_0xb8ad('0x30')](_0x5a9cdf[_0xb8ad('0x27')][_0xb8ad('0x31')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0xb8ad('0x30')](_0x5a9cdf[_0xb8ad('0x27')][_0xb8ad('0x27')])||_0x5a9cdf[_0xb8ad('0x27')][_0xb8ad('0x27')]===''){throw new db[(_0xb8ad('0x32'))][(_0xb8ad('0x29'))](_0xb8ad('0x33'));}if(_[_0xb8ad('0x30')](_0x5a9cdf['body']['mapKey'])){throw new db[(_0xb8ad('0x32'))][(_0xb8ad('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x582840);}if(!_['includes'](_0x582840,_0x5a9cdf[_0xb8ad('0x27')]['mapKey'])){throw new db[(_0xb8ad('0x32'))][(_0xb8ad('0x29'))](_0xb8ad('0x34')+_0x582840);}_0x10f9ff[_0x5a9cdf[_0xb8ad('0x27')][_0xb8ad('0x35')]]=_0x5a9cdf[_0xb8ad('0x27')][_0xb8ad('0x31')];})[_0xb8ad('0x10')](function(){return db[_0xb8ad('0x1d')][_0xb8ad('0x36')]({'where':{'id':_0x5a9cdf[_0xb8ad('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0xb8ad('0x38'),'include':[{'model':db['CmContact'],'as':_0xb8ad('0x39'),'where':_0x10f9ff,'limit':0x1,'order':[[_0xb8ad('0x2c'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0xb8ad('0x3a')}]});})[_0xb8ad('0x10')](function(_0x54892c){if(_0x54892c&&_0x54892c[_0xb8ad('0x38')]){var _0x3757e3=_0x54892c[_0xb8ad('0x3b')]({'plain':!![]});_0x3db5d9[_0xb8ad('0x37')]=_0x3757e3;_0x3db5d9[_0xb8ad('0x3c')]=_0x3757e3[_0xb8ad('0x3a')];_0x3db5d9[_0xb8ad('0x3d')]=_0x3757e3[_0xb8ad('0x38')];_0x3db5d9[_0xb8ad('0x3c')]=_['orderBy'](_0x3db5d9[_0xb8ad('0x3c')],[_0xb8ad('0x3e')],[_0xb8ad('0x3f')]);if(_0x3db5d9['account']['Applications']){delete _0x3db5d9[_0xb8ad('0x37')][_0xb8ad('0x3a')];}if(_0x3db5d9[_0xb8ad('0x37')][_0xb8ad('0x38')]&&_0x3db5d9[_0xb8ad('0x37')][_0xb8ad('0x38')][_0xb8ad('0x39')][_0xb8ad('0x40')]){return _0x3db5d9[_0xb8ad('0x37')]['List']['Contacts'][0x0];}var _0x3ebf00=_[_0xb8ad('0xc')](_0x5a9cdf[_0xb8ad('0x27')],{'firstName':_0x5a9cdf['body'][_0xb8ad('0x31')],'ListId':_0x3757e3[_0xb8ad('0x2f')]});_0x3ebf00[_0x5a9cdf['body']['mapKey']]=_0x5a9cdf[_0xb8ad('0x27')][_0xb8ad('0x31')];return db[_0xb8ad('0x28')][_0xb8ad('0x41')](_0x3ebf00,{'fields':_0xe8e4fe,'raw':!![]});}})[_0xb8ad('0x10')](function(_0x66a92a){_0x3db5d9[_0xb8ad('0x42')]=_0x66a92a;if(_0x66a92a){var _0x5bc92f={'ContactId':_0x66a92a['id'],'FaxAccountId':_0x5a9cdf[_0xb8ad('0x37')]['id'],'fax':_0x66a92a[_0xb8ad('0x43')]};return db['FaxInteraction'][_0xb8ad('0x36')]({'where':{'ContactId':_0x66a92a['id'],'closed':![],'FaxAccountId':_0x5a9cdf[_0xb8ad('0x37')]['id']}})[_0xb8ad('0x10')](function(_0x40192c){if(_0x40192c){return[_0x40192c,![]];}return db[_0xb8ad('0x44')][_0xb8ad('0x41')](_0x5bc92f)[_0xb8ad('0x10')](function(_0x3cd73f){return[_0x3cd73f,!![]];});});}else{throw new Error(_0xb8ad('0x45'));}})[_0xb8ad('0x46')](function(_0x4c4560,_0x43f3a8){var _0x711431=_0x4c4560['get']({'plain':!![]});if(_0x43f3a8){if(_0x3db5d9[_0xb8ad('0x37')][_0xb8ad('0x47')]){_0x3db5d9[_0xb8ad('0x3c')]['push']({'id':0x0,'priority':_0x3db5d9[_0xb8ad('0x3c')][_0xb8ad('0x40')]+0x1,'app':_0xb8ad('0x48'),'appdata':_0xb8ad('0x49'),'interval':_0xb8ad('0x4a')});}_0x711431['created']=!![];}else{_0x711431[_0xb8ad('0x4b')]=![];}_0x3db5d9[_0xb8ad('0x4c')]=_0x711431;return db[_0xb8ad('0x4d')]['create']({'body':_0x5a9cdf[_0xb8ad('0x27')][_0xb8ad('0x27')],'FaxAccountId':_0x5a9cdf[_0xb8ad('0x37')]['id'],'FaxInteractionId':_0x4c4560['id'],'direction':'in','ContactId':_0x4c4560[_0xb8ad('0x4e')],'AttachmentId':_0x5a9cdf[_0xb8ad('0x27')][_0xb8ad('0x4f')]});})['then'](function(_0x2f0685){_0x3db5d9[_0xb8ad('0x18')]=_0x2f0685;if(_0x3db5d9[_0xb8ad('0x4c')]['UserId']){return db[_0xb8ad('0x50')][_0xb8ad('0x36')]({'attributes':['id',_0xb8ad('0x51')],'where':{'id':_0x3db5d9[_0xb8ad('0x4c')][_0xb8ad('0x52')]}})[_0xb8ad('0x10')](function(_0x29fa7c){if(_0x29fa7c){_0x3db5d9[_0xb8ad('0x3c')][_0xb8ad('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x29fa7c[_0xb8ad('0x51')]+','+(_0x3db5d9[_0xb8ad('0x37')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xb8ad('0x54'),_0x3db5d9);});}return respondWithRpcPromise(_0xb8ad('0x55'),_0xb8ad('0x54'),_0x3db5d9);})[_0xb8ad('0x10')](function(_0x2b29af){_0x23feac(_0x2b29af);})[_0xb8ad('0x1b')](function(_0x4af754){_0x2b7cbf(_0x18cb28[_0xb8ad('0x16')](0x1f4,_0x4af754[_0xb8ad('0x18')]));});});}; \ No newline at end of file +var _0xd9e9=['include','map','model','GetFaxAccount','NotifyFaxAccount','body','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','CmContact','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','defaults','mapKey','contact','fax','FaxInteraction','find','spread','autoclose','length','unmanaged','*,*,*,*','created','interaction','FaxMessage','create','ContactId','User','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxAccount','findAll','options','raw','where','attributes'];(function(_0x4648a8,_0x469d5c){var _0x33ad1c=function(_0x33edfa){while(--_0x33edfa){_0x4648a8['push'](_0x4648a8['shift']());}};_0x33ad1c(++_0x469d5c);}(_0xd9e9,0x97));var _0x9d9e=function(_0x2d3a40,_0x1e31f){_0x2d3a40=_0x2d3a40-0x0;var _0x4da998=_0xd9e9[_0x2d3a40];return _0x4da998;};'use strict';var _=require(_0x9d9e('0x0'));var util=require(_0x9d9e('0x1'));var moment=require(_0x9d9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d9e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9d9e('0x4'))(_0x9d9e('0x5'));var config=require(_0x9d9e('0x6'));var jayson=require(_0x9d9e('0x7'));var client=jayson[_0x9d9e('0x8')][_0x9d9e('0x9')]({'port':0x232c});config[_0x9d9e('0xa')]=_['defaults'](config[_0x9d9e('0xa')],{'host':_0x9d9e('0xb'),'port':0x18eb});var socket=require(_0x9d9e('0xc'))(new Redis(config[_0x9d9e('0xa')]));require(_0x9d9e('0xd'))[_0x9d9e('0xe')](socket);function respondWithRpcPromise(_0x1233c5,_0x1668bd,_0xc88d00){return new BPromise(function(_0x3bfe82,_0x46a1cf){return client[_0x9d9e('0xf')](_0x1233c5,_0xc88d00)[_0x9d9e('0x10')](function(_0x2bbd0e){logger[_0x9d9e('0x11')](_0x9d9e('0x12'),_0x1668bd,_0x9d9e('0x13'));logger[_0x9d9e('0x14')](_0x9d9e('0x15'),_0x1668bd,'request\x20sent',JSON[_0x9d9e('0x16')](_0x2bbd0e));if(_0x2bbd0e['error']){if(_0x2bbd0e['error']['code']===0x1f4){logger['error'](_0x9d9e('0x12'),_0x1668bd,_0x2bbd0e[_0x9d9e('0x17')][_0x9d9e('0x18')]);return _0x46a1cf(_0x2bbd0e[_0x9d9e('0x17')][_0x9d9e('0x18')]);}logger[_0x9d9e('0x17')](_0x9d9e('0x12'),_0x1668bd,_0x2bbd0e[_0x9d9e('0x17')]['message']);return _0x3bfe82(_0x2bbd0e[_0x9d9e('0x17')][_0x9d9e('0x18')]);}else{logger[_0x9d9e('0x11')]('FaxAccount,\x20%s,\x20%s',_0x1668bd,_0x9d9e('0x13'));_0x3bfe82(_0x2bbd0e[_0x9d9e('0x19')][_0x9d9e('0x18')]);}})[_0x9d9e('0x1a')](function(_0x51f196){logger[_0x9d9e('0x17')]('FaxAccount,\x20%s,\x20%s',_0x1668bd,_0x51f196);_0x46a1cf(_0x51f196);});});}exports['GetFaxAccount']=function(_0x2c65e1){var _0xe2c608=this;return new Promise(function(_0x32be8f,_0x2564de){return db[_0x9d9e('0x1b')][_0x9d9e('0x1c')]({'raw':_0x2c65e1[_0x9d9e('0x1d')]?_0x2c65e1[_0x9d9e('0x1d')][_0x9d9e('0x1e')]===undefined?!![]:![]:!![],'where':_0x2c65e1[_0x9d9e('0x1d')]?_0x2c65e1[_0x9d9e('0x1d')][_0x9d9e('0x1f')]||null:null,'attributes':_0x2c65e1[_0x9d9e('0x1d')]?_0x2c65e1[_0x9d9e('0x1d')][_0x9d9e('0x20')]||null:null,'limit':_0x2c65e1['options']?_0x2c65e1[_0x9d9e('0x1d')]['limit']||null:null,'include':_0x2c65e1[_0x9d9e('0x1d')]?_0x2c65e1[_0x9d9e('0x1d')][_0x9d9e('0x21')]?_[_0x9d9e('0x22')](_0x2c65e1['options'][_0x9d9e('0x21')],function(_0x1d1208){return{'model':db[_0x1d1208[_0x9d9e('0x23')]],'as':_0x1d1208['as'],'attributes':_0x1d1208[_0x9d9e('0x20')],'include':_0x1d1208[_0x9d9e('0x21')]?_[_0x9d9e('0x22')](_0x1d1208['include'],function(_0x2686b8){return{'model':db[_0x2686b8[_0x9d9e('0x23')]],'as':_0x2686b8['as'],'attributes':_0x2686b8[_0x9d9e('0x20')],'include':_0x2686b8[_0x9d9e('0x21')]?_['map'](_0x2686b8[_0x9d9e('0x21')],function(_0x2107fa){return{'model':db[_0x2107fa['model']],'as':_0x2107fa['as'],'attributes':_0x2107fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d9e('0x10')](function(_0x2118df){logger['info'](_0x9d9e('0x24'),_0x2c65e1);logger[_0x9d9e('0x14')](_0x9d9e('0x24'),_0x2c65e1,JSON[_0x9d9e('0x16')](_0x2118df));_0x32be8f(_0x2118df);})['catch'](function(_0x116753){logger[_0x9d9e('0x17')](_0x9d9e('0x24'),_0x116753[_0x9d9e('0x18')],_0x2c65e1);_0x2564de(_0xe2c608[_0x9d9e('0x17')](0x1f4,_0x116753['message']));});});};exports[_0x9d9e('0x25')]=function(_0x6ba640,_0x40583f,_0x5a7c2c){var _0xa03f00=this;return new Promise(function(_0xd8333e,_0x2fff4e){var _0x271edb={'body':_0x6ba640[_0x9d9e('0x26')],'channel':'fax'};var _0x4d4be5=[];var _0x214200=[];var _0x4f15df={};return db['CmContact'][_0x9d9e('0x27')]()[_0x9d9e('0x10')](function(_0x3a36c3){if(!_0x3a36c3){throw new db[(_0x9d9e('0x28'))]['ValidationError'](_0x9d9e('0x29'));}_0x4d4be5=_[_0x9d9e('0x2a')](_[_0x9d9e('0x2b')](_0x3a36c3),[_0x9d9e('0x2c'),'updatedAt']);_0x214200=_[_0x9d9e('0x2a')](_[_0x9d9e('0x2b')](_0x3a36c3),[_0x9d9e('0x2c'),_0x9d9e('0x2d'),_0x9d9e('0x2e'),_0x9d9e('0x2f')]);if(_0x6ba640['body']['id']){delete _0x6ba640[_0x9d9e('0x26')]['id'];}if(_['isNil'](_0x6ba640[_0x9d9e('0x26')][_0x9d9e('0x30')])){throw new db[(_0x9d9e('0x28'))][(_0x9d9e('0x31'))](_0x9d9e('0x32'));}if(_[_0x9d9e('0x33')](_0x6ba640['body'][_0x9d9e('0x26')])||_0x6ba640[_0x9d9e('0x26')][_0x9d9e('0x26')]===''){throw new db[(_0x9d9e('0x28'))][(_0x9d9e('0x31'))](_0x9d9e('0x34'));}if(_[_0x9d9e('0x33')](_0x6ba640['body']['mapKey'])){throw new db[(_0x9d9e('0x28'))][(_0x9d9e('0x31'))](_0x9d9e('0x35')+_0x214200);}if(!_[_0x9d9e('0x36')](_0x214200,_0x6ba640[_0x9d9e('0x26')]['mapKey'])){throw new db[(_0x9d9e('0x28'))][(_0x9d9e('0x31'))](_0x9d9e('0x37')+_0x214200);}_0x4f15df[_0x6ba640[_0x9d9e('0x26')]['mapKey']]=_0x6ba640['body'][_0x9d9e('0x30')];})[_0x9d9e('0x10')](function(){return db['FaxAccount']['find']({'where':{'id':_0x6ba640[_0x9d9e('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x9d9e('0x39'),'include':[{'model':db[_0x9d9e('0x3a')],'as':'Contacts','where':_0x4f15df,'limit':0x1,'order':[[_0x9d9e('0x2d'),_0x9d9e('0x3b')]]}]},{'model':db[_0x9d9e('0x3c')],'as':_0x9d9e('0x3d')}]});})['then'](function(_0xf6d822){if(_0xf6d822&&_0xf6d822[_0x9d9e('0x39')]){var _0xf9a195=_0xf6d822[_0x9d9e('0x3e')]({'plain':!![]});_0x271edb[_0x9d9e('0x38')]=_0xf9a195;_0x271edb[_0x9d9e('0x3f')]=_0xf9a195[_0x9d9e('0x3d')];_0x271edb[_0x9d9e('0x40')]=_0xf9a195[_0x9d9e('0x39')];_0x271edb['applications']=_[_0x9d9e('0x41')](_0x271edb['applications'],[_0x9d9e('0x42')],[_0x9d9e('0x43')]);if(_0x271edb[_0x9d9e('0x38')][_0x9d9e('0x3d')]){delete _0x271edb['account']['Applications'];}if(_0x271edb[_0x9d9e('0x38')][_0x9d9e('0x39')]&&_0x271edb['account']['List']['Contacts']['length']){return _0x271edb[_0x9d9e('0x38')]['List']['Contacts'][0x0];}var _0x31266f=_[_0x9d9e('0x44')](_0x6ba640[_0x9d9e('0x26')],{'firstName':_0x6ba640[_0x9d9e('0x26')][_0x9d9e('0x30')],'ListId':_0xf9a195[_0x9d9e('0x2f')]});_0x31266f[_0x6ba640[_0x9d9e('0x26')][_0x9d9e('0x45')]]=_0x6ba640['body'][_0x9d9e('0x30')];return db['CmContact']['create'](_0x31266f,{'fields':_0x4d4be5,'raw':!![]});}})[_0x9d9e('0x10')](function(_0xb055fd){_0x271edb[_0x9d9e('0x46')]=_0xb055fd;if(_0xb055fd){var _0x2e7da7={'ContactId':_0xb055fd['id'],'FaxAccountId':_0x6ba640[_0x9d9e('0x38')]['id'],'fax':_0xb055fd[_0x9d9e('0x47')]};return db[_0x9d9e('0x48')][_0x9d9e('0x49')]({'where':{'ContactId':_0xb055fd['id'],'closed':![],'FaxAccountId':_0x6ba640[_0x9d9e('0x38')]['id']}})[_0x9d9e('0x10')](function(_0x1c5d0d){if(_0x1c5d0d){return[_0x1c5d0d,![]];}return db[_0x9d9e('0x48')]['create'](_0x2e7da7)[_0x9d9e('0x10')](function(_0x9c5f5a){return[_0x9c5f5a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9d9e('0x4a')](function(_0x283007,_0x2b1476){var _0x17b42b=_0x283007[_0x9d9e('0x3e')]({'plain':!![]});if(_0x2b1476){if(_0x271edb['account'][_0x9d9e('0x4b')]){_0x271edb[_0x9d9e('0x3f')]['push']({'id':0x0,'priority':_0x271edb['applications'][_0x9d9e('0x4c')]+0x1,'app':'close','appdata':_0x9d9e('0x4d'),'interval':_0x9d9e('0x4e')});}_0x17b42b[_0x9d9e('0x4f')]=!![];}else{_0x17b42b[_0x9d9e('0x4f')]=![];}_0x271edb[_0x9d9e('0x50')]=_0x17b42b;return db[_0x9d9e('0x51')][_0x9d9e('0x52')]({'body':_0x6ba640['body'][_0x9d9e('0x26')],'FaxAccountId':_0x6ba640[_0x9d9e('0x38')]['id'],'FaxInteractionId':_0x283007['id'],'direction':'in','ContactId':_0x283007[_0x9d9e('0x53')],'AttachmentId':_0x6ba640[_0x9d9e('0x26')]['AttachmentId']});})['then'](function(_0x79eb82){_0x271edb[_0x9d9e('0x18')]=_0x79eb82;if(_0x271edb[_0x9d9e('0x50')]['UserId']){return db[_0x9d9e('0x54')][_0x9d9e('0x49')]({'attributes':['id','name'],'where':{'id':_0x271edb[_0x9d9e('0x50')][_0x9d9e('0x55')]}})[_0x9d9e('0x10')](function(_0x15a099){if(_0x15a099){_0x271edb[_0x9d9e('0x3f')][_0x9d9e('0x56')]({'id':0x0,'priority':0x0,'app':_0x9d9e('0x57'),'appdata':_0x15a099[_0x9d9e('0x58')]+','+(_0x271edb[_0x9d9e('0x38')][_0x9d9e('0x59')]||0xa),'interval':_0x9d9e('0x4e')});}return respondWithRpcPromise(_0x9d9e('0x5a'),_0x9d9e('0x5b'),_0x271edb);});}return respondWithRpcPromise(_0x9d9e('0x5a'),_0x9d9e('0x5b'),_0x271edb);})[_0x9d9e('0x10')](function(_0x440370){_0xd8333e(_0x440370);})['catch'](function(_0x5ee78c){_0x2fff4e(_0xa03f00[_0x9d9e('0x17')](0x1f4,_0x5ee78c['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 80c2fe3..90c9ba0 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 _0xcc1a=['./faxAccount.events','save','update','register','length','faxAccount:'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0xcc1a,0xa8));var _0xacc1=function(_0x3d8ba1,_0x5ba1fd){_0x3d8ba1=_0x3d8ba1-0x0;var _0x87804e=_0xcc1a[_0x3d8ba1];return _0x87804e;};'use strict';var FaxAccountEvents=require(_0xacc1('0x0'));var events=[_0xacc1('0x1'),'remove',_0xacc1('0x2')];function createListener(_0x258fd0,_0x419868){return function(_0x45367b){_0x419868['emit'](_0x258fd0,_0x45367b);};}function removeListener(_0x6211bb,_0x1faac0){return function(){FaxAccountEvents['removeListener'](_0x6211bb,_0x1faac0);};}exports[_0xacc1('0x3')]=function(_0x4fefdd){for(var _0x44513d=0x0,_0x5b9660=events[_0xacc1('0x4')];_0x44513d<_0x5b9660;_0x44513d++){var _0x1b3ea5=events[_0x44513d];var _0x4f2288=createListener(_0xacc1('0x5')+_0x1b3ea5,_0x4fefdd);FaxAccountEvents['on'](_0x1b3ea5,_0x4f2288);}}; \ No newline at end of file +var _0x526c=['register','./faxAccount.events','save','remove','update'];(function(_0x550b36,_0x5c0cc7){var _0x5e7b34=function(_0x1e83b2){while(--_0x1e83b2){_0x550b36['push'](_0x550b36['shift']());}};_0x5e7b34(++_0x5c0cc7);}(_0x526c,0x173));var _0xc526=function(_0x2211b2,_0x3c32a7){_0x2211b2=_0x2211b2-0x0;var _0x1ff209=_0x526c[_0x2211b2];return _0x1ff209;};'use strict';var FaxAccountEvents=require(_0xc526('0x0'));var events=[_0xc526('0x1'),_0xc526('0x2'),_0xc526('0x3')];function createListener(_0xaff817,_0x23ff28){return function(_0x46542a){_0x23ff28['emit'](_0xaff817,_0x46542a);};}function removeListener(_0x5e0104,_0xd08f18){return function(){FaxAccountEvents['removeListener'](_0x5e0104,_0xd08f18);};}exports[_0xc526('0x4')]=function(_0x19f828){for(var _0x322aff=0x0,_0x5f1fc4=events['length'];_0x322aff<_0x5f1fc4;_0x322aff++){var _0x17913c=events[_0x322aff];var _0x411c03=createListener('faxAccount:'+_0x17913c,_0x19f828);FaxAccountEvents['on'](_0x17913c,_0x411c03);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f2f04db..d1bd200 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(_0x35e534,_0x1652a9){var _0x4ea57f=function(_0xd8fae){while(--_0xd8fae){_0x35e534['push'](_0x35e534['shift']());}};_0x4ea57f(++_0x1652a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x3f9383,_0x5da6dd){var _0x14c351=function(_0x10c839){while(--_0x10c839){_0x3f9383['push'](_0x3f9383['shift']());}};_0x14c351(++_0x5da6dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 930d3ea..67e1cb8 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 _0x6fc6=['exports','INTEGER','STRING','sequelize'];(function(_0x5ce850,_0x28bfe5){var _0x12753a=function(_0x5eacdb){while(--_0x5eacdb){_0x5ce850['push'](_0x5ce850['shift']());}};_0x12753a(++_0x28bfe5);}(_0x6fc6,0x1cb));var _0x66fc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6fc6[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x66fc('0x0'));module[_0x66fc('0x1')]={'priority':{'type':Sequelize[_0x66fc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x66fc('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x66fc('0x3')]},'interval':{'type':Sequelize[_0x66fc('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7571=['TEXT','STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x31ba05,_0x1c9962){var _0x44918a=function(_0x516421){while(--_0x516421){_0x31ba05['push'](_0x31ba05['shift']());}};_0x44918a(++_0x1c9962);}(_0x7571,0x14d));var _0x1757=function(_0x4b23ff,_0x4cd098){_0x4b23ff=_0x4b23ff-0x0;var _0x5ebef7=_0x7571[_0x4b23ff];return _0x5ebef7;};'use strict';var Sequelize=require('sequelize');module[_0x1757('0x0')]={'priority':{'type':Sequelize[_0x1757('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1757('0x2')},'appdata':{'type':Sequelize[_0x1757('0x3')]()},'description':{'type':Sequelize[_0x1757('0x4')]},'interval':{'type':Sequelize[_0x1757('0x4')],'defaultValue':_0x1757('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 0daaf0c..e70dea6 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 _0x0505=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','send','index','map','FaxApplication','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','find','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0505,0x7f));var _0x5050=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x0505[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x5050('0x0'));var rimraf=require(_0x5050('0x1'));var zipdir=require(_0x5050('0x2'));var jsonpatch=require(_0x5050('0x3'));var rp=require(_0x5050('0x4'));var moment=require(_0x5050('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5050('0x6'));var util=require(_0x5050('0x7'));var path=require('path');var sox=require(_0x5050('0x8'));var csv=require(_0x5050('0x9'));var ejs=require(_0x5050('0xa'));var fs=require('fs');var fs_extra=require(_0x5050('0xb'));var _=require(_0x5050('0xc'));var squel=require(_0x5050('0xd'));var crypto=require(_0x5050('0xe'));var jsforce=require(_0x5050('0xf'));var deskjs=require(_0x5050('0x10'));var toCsv=require(_0x5050('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5050('0x11'));var authService=require(_0x5050('0x12'));var qs=require(_0x5050('0x13'));var as=require(_0x5050('0x14'));var hardwareService=require(_0x5050('0x15'));var logger=require('../../config/logger')(_0x5050('0x16'));var utils=require(_0x5050('0x17'));var config=require(_0x5050('0x18'));var licenseUtil=require(_0x5050('0x19'));var db=require(_0x5050('0x1a'))['db'];function respondWithStatusCode(_0x135431,_0x3903fe){_0x3903fe=_0x3903fe||0xcc;return function(_0x49c167){if(_0x49c167){return _0x135431[_0x5050('0x1b')](_0x3903fe);}return _0x135431[_0x5050('0x1c')](_0x3903fe)[_0x5050('0x1d')]();};}function respondWithResult(_0x4a9c8b,_0x48df9a){_0x48df9a=_0x48df9a||0xc8;return function(_0x4f6d0f){if(_0x4f6d0f){return _0x4a9c8b[_0x5050('0x1c')](_0x48df9a)[_0x5050('0x1e')](_0x4f6d0f);}};}function respondWithFilteredResult(_0xcd6dca,_0x61a708){return function(_0x997f09){if(_0x997f09){var _0x40d3ac=typeof _0x61a708[_0x5050('0x1f')]===_0x5050('0x20')&&typeof _0x61a708[_0x5050('0x21')]===_0x5050('0x20');var _0x4c89aa=_0x997f09['count'];var _0xa70dea=_0x40d3ac?0x0:_0x61a708[_0x5050('0x1f')];var _0x19b2fa=_0x40d3ac?_0x997f09[_0x5050('0x22')]:_0x61a708[_0x5050('0x1f')]+_0x61a708[_0x5050('0x21')];var _0x2ce422;if(_0x19b2fa>=_0x4c89aa){_0x19b2fa=_0x4c89aa;_0x2ce422=0xc8;}else{_0x2ce422=0xce;}_0xcd6dca['status'](_0x2ce422);return _0xcd6dca[_0x5050('0x23')](_0x5050('0x24'),_0xa70dea+'-'+_0x19b2fa+'/'+_0x4c89aa)[_0x5050('0x1e')](_0x997f09);}return null;};}function patchUpdates(_0x1ea510){return function(_0x6ed5c2){try{jsonpatch[_0x5050('0x25')](_0x6ed5c2,_0x1ea510,!![]);}catch(_0x273d81){return BPromise['reject'](_0x273d81);}return _0x6ed5c2['save']();};}function saveUpdates(_0x17e634,_0x2506da){return function(_0x13d68b){if(_0x13d68b){return _0x13d68b[_0x5050('0x26')](_0x17e634)['then'](function(_0x1d9c19){return _0x1d9c19;});}return null;};}function removeEntity(_0x316733,_0x454a57){return function(_0x2337b7){if(_0x2337b7){return _0x2337b7[_0x5050('0x27')]()[_0x5050('0x28')](function(){_0x316733['status'](0xcc)[_0x5050('0x1d')]();});}};}function handleEntityNotFound(_0x554473,_0x17430a){return function(_0x5e9c5e){if(!_0x5e9c5e){_0x554473[_0x5050('0x1b')](0x194);}return _0x5e9c5e;};}function handleError(_0x37feb7,_0x55925a){_0x55925a=_0x55925a||0x1f4;return function(_0x53c8f4){logger[_0x5050('0x29')](_0x53c8f4[_0x5050('0x2a')]);if(_0x53c8f4['name']){delete _0x53c8f4['name'];}_0x37feb7[_0x5050('0x1c')](_0x55925a)[_0x5050('0x2b')](_0x53c8f4);};}exports[_0x5050('0x2c')]=function(_0x36e517,_0x41e1d8){var _0x29ddef={},_0x45bead={},_0x40b955={'count':0x0,'rows':[]};var _0x29ce7f=_[_0x5050('0x2d')](db[_0x5050('0x2e')]['rawAttributes'],function(_0x4781a0){return{'name':_0x4781a0['fieldName'],'type':_0x4781a0[_0x5050('0x2f')][_0x5050('0x30')]};});_0x45bead[_0x5050('0x31')]=_[_0x5050('0x2d')](_0x29ce7f,_0x5050('0x32'));_0x45bead['query']=_[_0x5050('0x33')](_0x36e517[_0x5050('0x34')]);_0x45bead[_0x5050('0x35')]=_[_0x5050('0x36')](_0x45bead[_0x5050('0x31')],_0x45bead[_0x5050('0x34')]);_0x29ddef[_0x5050('0x37')]=_[_0x5050('0x36')](_0x45bead['model'],qs[_0x5050('0x38')](_0x36e517['query'][_0x5050('0x38')]));_0x29ddef[_0x5050('0x37')]=_0x29ddef['attributes'][_0x5050('0x39')]?_0x29ddef[_0x5050('0x37')]:_0x45bead[_0x5050('0x31')];if(!_0x36e517['query'][_0x5050('0x3a')](_0x5050('0x3b'))){_0x29ddef[_0x5050('0x21')]=qs[_0x5050('0x21')](_0x36e517[_0x5050('0x34')]['limit']);_0x29ddef[_0x5050('0x1f')]=qs['offset'](_0x36e517[_0x5050('0x34')][_0x5050('0x1f')]);}_0x29ddef[_0x5050('0x3c')]=qs[_0x5050('0x3d')](_0x36e517['query'][_0x5050('0x3d')]);_0x29ddef['where']=qs[_0x5050('0x35')](_['pick'](_0x36e517[_0x5050('0x34')],_0x45bead['filters']),_0x29ce7f);if(_0x36e517[_0x5050('0x34')][_0x5050('0x3e')]){_0x29ddef['where']=_[_0x5050('0x3f')](_0x29ddef[_0x5050('0x40')],{'$or':_[_0x5050('0x2d')](_0x29ce7f,function(_0x5ef4f3){if(_0x5ef4f3[_0x5050('0x2f')]!=='VIRTUAL'){var _0x2fe16b={};_0x2fe16b[_0x5ef4f3[_0x5050('0x32')]]={'$like':'%'+_0x36e517[_0x5050('0x34')]['filter']+'%'};return _0x2fe16b;}})});}_0x29ddef=_[_0x5050('0x3f')]({},_0x29ddef,_0x36e517[_0x5050('0x41')]);var _0x5ad491={'where':_0x29ddef['where']};return db['FaxApplication'][_0x5050('0x22')](_0x5ad491)[_0x5050('0x28')](function(_0x1d7c13){_0x40b955[_0x5050('0x22')]=_0x1d7c13;if(_0x36e517[_0x5050('0x34')][_0x5050('0x42')]){_0x29ddef[_0x5050('0x43')]=[{'all':!![]}];}return db[_0x5050('0x2e')][_0x5050('0x44')](_0x29ddef);})['then'](function(_0x41d0e2){_0x40b955[_0x5050('0x45')]=_0x41d0e2;return _0x40b955;})['then'](respondWithFilteredResult(_0x41e1d8,_0x29ddef))[_0x5050('0x46')](handleError(_0x41e1d8,null));};exports[_0x5050('0x47')]=function(_0x2354b5,_0xc7ae52){var _0x47a0e8={'raw':!![],'where':{'id':_0x2354b5[_0x5050('0x48')]['id']}},_0x47c973={};_0x47c973[_0x5050('0x31')]=_[_0x5050('0x33')](db[_0x5050('0x2e')][_0x5050('0x49')]);_0x47c973[_0x5050('0x34')]=_[_0x5050('0x33')](_0x2354b5['query']);_0x47c973[_0x5050('0x35')]=_[_0x5050('0x36')](_0x47c973[_0x5050('0x31')],_0x47c973[_0x5050('0x34')]);_0x47a0e8['attributes']=_[_0x5050('0x36')](_0x47c973[_0x5050('0x31')],qs[_0x5050('0x38')](_0x2354b5[_0x5050('0x34')][_0x5050('0x38')]));_0x47a0e8['attributes']=_0x47a0e8[_0x5050('0x37')][_0x5050('0x39')]?_0x47a0e8['attributes']:_0x47c973[_0x5050('0x31')];if(_0x2354b5[_0x5050('0x34')][_0x5050('0x42')]){_0x47a0e8[_0x5050('0x43')]=[{'all':!![]}];}_0x47a0e8=_[_0x5050('0x3f')]({},_0x47a0e8,_0x2354b5[_0x5050('0x41')]);return db[_0x5050('0x2e')]['find'](_0x47a0e8)[_0x5050('0x28')](handleEntityNotFound(_0xc7ae52,null))[_0x5050('0x28')](respondWithResult(_0xc7ae52,null))[_0x5050('0x46')](handleError(_0xc7ae52,null));};exports['create']=function(_0xe3239c,_0x37da7d){return db[_0x5050('0x2e')]['create'](_0xe3239c[_0x5050('0x4a')],{})[_0x5050('0x28')](respondWithResult(_0x37da7d,0xc9))[_0x5050('0x46')](handleError(_0x37da7d,null));};exports[_0x5050('0x26')]=function(_0x2832cd,_0x181b09){if(_0x2832cd[_0x5050('0x4a')]['id']){delete _0x2832cd[_0x5050('0x4a')]['id'];}return db[_0x5050('0x2e')]['find']({'where':{'id':_0x2832cd[_0x5050('0x48')]['id']}})[_0x5050('0x28')](handleEntityNotFound(_0x181b09,null))[_0x5050('0x28')](saveUpdates(_0x2832cd[_0x5050('0x4a')],null))[_0x5050('0x28')](respondWithResult(_0x181b09,null))[_0x5050('0x46')](handleError(_0x181b09,null));};exports[_0x5050('0x27')]=function(_0x2051b4,_0x46a3dd){return db['FaxApplication'][_0x5050('0x4b')]({'where':{'id':_0x2051b4[_0x5050('0x48')]['id']}})[_0x5050('0x28')](handleEntityNotFound(_0x46a3dd,null))[_0x5050('0x28')](removeEntity(_0x46a3dd,null))[_0x5050('0x46')](handleError(_0x46a3dd,null));}; \ No newline at end of file +var _0xef92=['options','then','includeAll','include','rows','catch','show','merge','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','apply','save','destroy','end','error','stack','name','send','index','map','FaxApplication','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL'];(function(_0x2d4c47,_0xb34b19){var _0x1d761d=function(_0x57a124){while(--_0x57a124){_0x2d4c47['push'](_0x2d4c47['shift']());}};_0x1d761d(++_0xb34b19);}(_0xef92,0xa7));var _0x2ef9=function(_0x259b67,_0x5de37e){_0x259b67=_0x259b67-0x0;var _0x2e7e2b=_0xef92[_0x259b67];return _0x2e7e2b;};'use strict';var emlformat=require(_0x2ef9('0x0'));var rimraf=require(_0x2ef9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ef9('0x2'));var rp=require(_0x2ef9('0x3'));var moment=require(_0x2ef9('0x4'));var BPromise=require(_0x2ef9('0x5'));var Mustache=require(_0x2ef9('0x6'));var util=require(_0x2ef9('0x7'));var path=require(_0x2ef9('0x8'));var sox=require(_0x2ef9('0x9'));var csv=require('to-csv');var ejs=require(_0x2ef9('0xa'));var fs=require('fs');var fs_extra=require(_0x2ef9('0xb'));var _=require(_0x2ef9('0xc'));var squel=require(_0x2ef9('0xd'));var crypto=require(_0x2ef9('0xe'));var jsforce=require(_0x2ef9('0xf'));var deskjs=require(_0x2ef9('0x10'));var toCsv=require(_0x2ef9('0x11'));var querystring=require(_0x2ef9('0x12'));var Papa=require(_0x2ef9('0x13'));var Redis=require(_0x2ef9('0x14'));var authService=require(_0x2ef9('0x15'));var qs=require(_0x2ef9('0x16'));var as=require(_0x2ef9('0x17'));var hardwareService=require(_0x2ef9('0x18'));var logger=require(_0x2ef9('0x19'))('api');var utils=require(_0x2ef9('0x1a'));var config=require(_0x2ef9('0x1b'));var licenseUtil=require(_0x2ef9('0x1c'));var db=require(_0x2ef9('0x1d'))['db'];function respondWithStatusCode(_0x50f22f,_0x22ba46){_0x22ba46=_0x22ba46||0xcc;return function(_0x4d5493){if(_0x4d5493){return _0x50f22f['sendStatus'](_0x22ba46);}return _0x50f22f[_0x2ef9('0x1e')](_0x22ba46)['end']();};}function respondWithResult(_0x2a3860,_0x2dc8a1){_0x2dc8a1=_0x2dc8a1||0xc8;return function(_0x10017f){if(_0x10017f){return _0x2a3860[_0x2ef9('0x1e')](_0x2dc8a1)[_0x2ef9('0x1f')](_0x10017f);}};}function respondWithFilteredResult(_0xd76be,_0x25a204){return function(_0x56594f){if(_0x56594f){var _0x133df9=typeof _0x25a204[_0x2ef9('0x20')]==='undefined'&&typeof _0x25a204[_0x2ef9('0x21')]==='undefined';var _0x3306c6=_0x56594f[_0x2ef9('0x22')];var _0x698e19=_0x133df9?0x0:_0x25a204[_0x2ef9('0x20')];var _0x2847ae=_0x133df9?_0x56594f['count']:_0x25a204['offset']+_0x25a204[_0x2ef9('0x21')];var _0x3387f3;if(_0x2847ae>=_0x3306c6){_0x2847ae=_0x3306c6;_0x3387f3=0xc8;}else{_0x3387f3=0xce;}_0xd76be[_0x2ef9('0x1e')](_0x3387f3);return _0xd76be[_0x2ef9('0x23')]('Content-Range',_0x698e19+'-'+_0x2847ae+'/'+_0x3306c6)[_0x2ef9('0x1f')](_0x56594f);}return null;};}function patchUpdates(_0x24d4ef){return function(_0x2088b1){try{jsonpatch[_0x2ef9('0x24')](_0x2088b1,_0x24d4ef,!![]);}catch(_0x4e3b05){return BPromise['reject'](_0x4e3b05);}return _0x2088b1[_0x2ef9('0x25')]();};}function saveUpdates(_0x1e720d,_0x17ca14){return function(_0x27dbac){if(_0x27dbac){return _0x27dbac['update'](_0x1e720d)['then'](function(_0x508e64){return _0x508e64;});}return null;};}function removeEntity(_0x4545e9,_0x3389aa){return function(_0x5b065c){if(_0x5b065c){return _0x5b065c[_0x2ef9('0x26')]()['then'](function(){_0x4545e9[_0x2ef9('0x1e')](0xcc)[_0x2ef9('0x27')]();});}};}function handleEntityNotFound(_0x1abfd6,_0x57bbee){return function(_0x4f6e79){if(!_0x4f6e79){_0x1abfd6['sendStatus'](0x194);}return _0x4f6e79;};}function handleError(_0x5b4b89,_0x168126){_0x168126=_0x168126||0x1f4;return function(_0x1e9dcf){logger[_0x2ef9('0x28')](_0x1e9dcf[_0x2ef9('0x29')]);if(_0x1e9dcf[_0x2ef9('0x2a')]){delete _0x1e9dcf[_0x2ef9('0x2a')];}_0x5b4b89[_0x2ef9('0x1e')](_0x168126)[_0x2ef9('0x2b')](_0x1e9dcf);};}exports[_0x2ef9('0x2c')]=function(_0x4cd563,_0x2fa259){var _0x4a112a={},_0x1749ee={},_0x127beb={'count':0x0,'rows':[]};var _0x238b09=_[_0x2ef9('0x2d')](db[_0x2ef9('0x2e')]['rawAttributes'],function(_0x433c33){return{'name':_0x433c33['fieldName'],'type':_0x433c33[_0x2ef9('0x2f')][_0x2ef9('0x30')]};});_0x1749ee[_0x2ef9('0x31')]=_['map'](_0x238b09,_0x2ef9('0x2a'));_0x1749ee[_0x2ef9('0x32')]=_[_0x2ef9('0x33')](_0x4cd563[_0x2ef9('0x32')]);_0x1749ee[_0x2ef9('0x34')]=_[_0x2ef9('0x35')](_0x1749ee[_0x2ef9('0x31')],_0x1749ee[_0x2ef9('0x32')]);_0x4a112a[_0x2ef9('0x36')]=_[_0x2ef9('0x35')](_0x1749ee[_0x2ef9('0x31')],qs[_0x2ef9('0x37')](_0x4cd563[_0x2ef9('0x32')][_0x2ef9('0x37')]));_0x4a112a['attributes']=_0x4a112a['attributes'][_0x2ef9('0x38')]?_0x4a112a[_0x2ef9('0x36')]:_0x1749ee[_0x2ef9('0x31')];if(!_0x4cd563['query']['hasOwnProperty'](_0x2ef9('0x39'))){_0x4a112a['limit']=qs['limit'](_0x4cd563['query'][_0x2ef9('0x21')]);_0x4a112a[_0x2ef9('0x20')]=qs[_0x2ef9('0x20')](_0x4cd563['query']['offset']);}_0x4a112a[_0x2ef9('0x3a')]=qs[_0x2ef9('0x3b')](_0x4cd563[_0x2ef9('0x32')]['sort']);_0x4a112a['where']=qs['filters'](_[_0x2ef9('0x3c')](_0x4cd563[_0x2ef9('0x32')],_0x1749ee[_0x2ef9('0x34')]),_0x238b09);if(_0x4cd563['query'][_0x2ef9('0x3d')]){_0x4a112a['where']=_['merge'](_0x4a112a[_0x2ef9('0x3e')],{'$or':_[_0x2ef9('0x2d')](_0x238b09,function(_0x5d0d77){if(_0x5d0d77[_0x2ef9('0x2f')]!==_0x2ef9('0x3f')){var _0x53eaa5={};_0x53eaa5[_0x5d0d77[_0x2ef9('0x2a')]]={'$like':'%'+_0x4cd563[_0x2ef9('0x32')]['filter']+'%'};return _0x53eaa5;}})});}_0x4a112a=_['merge']({},_0x4a112a,_0x4cd563[_0x2ef9('0x40')]);var _0x15e74a={'where':_0x4a112a[_0x2ef9('0x3e')]};return db['FaxApplication'][_0x2ef9('0x22')](_0x15e74a)[_0x2ef9('0x41')](function(_0x98cb95){_0x127beb[_0x2ef9('0x22')]=_0x98cb95;if(_0x4cd563[_0x2ef9('0x32')][_0x2ef9('0x42')]){_0x4a112a[_0x2ef9('0x43')]=[{'all':!![]}];}return db[_0x2ef9('0x2e')]['findAll'](_0x4a112a);})[_0x2ef9('0x41')](function(_0x5787cb){_0x127beb[_0x2ef9('0x44')]=_0x5787cb;return _0x127beb;})[_0x2ef9('0x41')](respondWithFilteredResult(_0x2fa259,_0x4a112a))[_0x2ef9('0x45')](handleError(_0x2fa259,null));};exports[_0x2ef9('0x46')]=function(_0x2882b8,_0x59bbab){var _0x35a23a={'raw':!![],'where':{'id':_0x2882b8['params']['id']}},_0x3f0083={};_0x3f0083[_0x2ef9('0x31')]=_[_0x2ef9('0x33')](db['FaxApplication']['rawAttributes']);_0x3f0083[_0x2ef9('0x32')]=_['keys'](_0x2882b8[_0x2ef9('0x32')]);_0x3f0083[_0x2ef9('0x34')]=_[_0x2ef9('0x35')](_0x3f0083[_0x2ef9('0x31')],_0x3f0083['query']);_0x35a23a['attributes']=_[_0x2ef9('0x35')](_0x3f0083[_0x2ef9('0x31')],qs[_0x2ef9('0x37')](_0x2882b8['query'][_0x2ef9('0x37')]));_0x35a23a['attributes']=_0x35a23a['attributes']['length']?_0x35a23a[_0x2ef9('0x36')]:_0x3f0083[_0x2ef9('0x31')];if(_0x2882b8[_0x2ef9('0x32')][_0x2ef9('0x42')]){_0x35a23a[_0x2ef9('0x43')]=[{'all':!![]}];}_0x35a23a=_[_0x2ef9('0x47')]({},_0x35a23a,_0x2882b8['options']);return db[_0x2ef9('0x2e')][_0x2ef9('0x48')](_0x35a23a)[_0x2ef9('0x41')](handleEntityNotFound(_0x59bbab,null))[_0x2ef9('0x41')](respondWithResult(_0x59bbab,null))[_0x2ef9('0x45')](handleError(_0x59bbab,null));};exports[_0x2ef9('0x49')]=function(_0x31ae39,_0x5b98fb){return db[_0x2ef9('0x2e')][_0x2ef9('0x49')](_0x31ae39[_0x2ef9('0x4a')],{})[_0x2ef9('0x41')](respondWithResult(_0x5b98fb,0xc9))['catch'](handleError(_0x5b98fb,null));};exports[_0x2ef9('0x4b')]=function(_0x10cf40,_0x2cd1ee){if(_0x10cf40[_0x2ef9('0x4a')]['id']){delete _0x10cf40['body']['id'];}return db[_0x2ef9('0x2e')][_0x2ef9('0x48')]({'where':{'id':_0x10cf40[_0x2ef9('0x4c')]['id']}})[_0x2ef9('0x41')](handleEntityNotFound(_0x2cd1ee,null))[_0x2ef9('0x41')](saveUpdates(_0x10cf40[_0x2ef9('0x4a')],null))[_0x2ef9('0x41')](respondWithResult(_0x2cd1ee,null))[_0x2ef9('0x45')](handleError(_0x2cd1ee,null));};exports['destroy']=function(_0x51520c,_0xe57461){return db['FaxApplication'][_0x2ef9('0x48')]({'where':{'id':_0x51520c[_0x2ef9('0x4c')]['id']}})[_0x2ef9('0x41')](handleEntityNotFound(_0xe57461,null))[_0x2ef9('0x41')](removeEntity(_0xe57461,null))[_0x2ef9('0x45')](handleError(_0xe57461,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 6fbc479..efae8cc 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 _0x649d=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','path','rimraf','./faxApplication.attributes','exports','define'];(function(_0x13cbda,_0x5a00cb){var _0x30cb25=function(_0x1c751f){while(--_0x1c751f){_0x13cbda['push'](_0x13cbda['shift']());}};_0x30cb25(++_0x5a00cb);}(_0x649d,0x1a8));var _0xd649=function(_0x53827c,_0x571297){_0x53827c=_0x53827c-0x0;var _0x35f980=_0x649d[_0x53827c];return _0x35f980;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd649('0x0'));var moment=require(_0xd649('0x1'));var BPromise=require(_0xd649('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd649('0x3'));var rimraf=require(_0xd649('0x4'));var config=require('../../config/environment');var attributes=require(_0xd649('0x5'));module[_0xd649('0x6')]=function(_0x9f6de6,_0x3b463d){return _0x9f6de6[_0xd649('0x7')](_0xd649('0x8'),attributes,{'tableName':_0xd649('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd649('0xa'),'collate':_0xd649('0xb')});}; \ No newline at end of file +var _0x5250=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x49d522,_0x2b324f){var _0x3f88a3=function(_0x459562){while(--_0x459562){_0x49d522['push'](_0x49d522['shift']());}};_0x3f88a3(++_0x2b324f);}(_0x5250,0x7b));var _0x0525=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x5250[_0x15d18f];return _0xd12bf7;};'use strict';var _=require(_0x0525('0x0'));var util=require(_0x0525('0x1'));var logger=require(_0x0525('0x2'))(_0x0525('0x3'));var moment=require(_0x0525('0x4'));var BPromise=require('bluebird');var rp=require(_0x0525('0x5'));var fs=require('fs');var path=require(_0x0525('0x6'));var rimraf=require(_0x0525('0x7'));var config=require(_0x0525('0x8'));var attributes=require('./faxApplication.attributes');module[_0x0525('0x9')]=function(_0x394c0b,_0x35eb7a){return _0x394c0b[_0x0525('0xa')](_0x0525('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0525('0xc'),'collate':_0x0525('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 8b0daba..3fadead 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 _0x04b6=['then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateFaxApplication','raw','options','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3a2451,_0x3c4e0d){var _0x4f6ae8=function(_0x357760){while(--_0x357760){_0x3a2451['push'](_0x3a2451['shift']());}};_0x4f6ae8(++_0x3c4e0d);}(_0x04b6,0x1e0));var _0x604b=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x04b6[_0x49d19d];return _0x4ebef1;};'use strict';var _=require(_0x604b('0x0'));var util=require('util');var moment=require(_0x604b('0x1'));var BPromise=require(_0x604b('0x2'));var rs=require(_0x604b('0x3'));var fs=require('fs');var Redis=require(_0x604b('0x4'));var db=require(_0x604b('0x5'))['db'];var utils=require(_0x604b('0x6'));var logger=require(_0x604b('0x7'))(_0x604b('0x8'));var config=require(_0x604b('0x9'));var jayson=require(_0x604b('0xa'));var client=jayson['client'][_0x604b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1363f5,_0x189d04,_0x5404af){return new BPromise(function(_0x300640,_0x157309){return client[_0x604b('0xc')](_0x1363f5,_0x5404af)[_0x604b('0xd')](function(_0x1248bb){logger[_0x604b('0xe')](_0x604b('0xf'),_0x189d04,_0x604b('0x10'));logger['debug'](_0x604b('0x11'),_0x189d04,_0x604b('0x10'),JSON[_0x604b('0x12')](_0x1248bb));if(_0x1248bb['error']){if(_0x1248bb[_0x604b('0x13')][_0x604b('0x14')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x189d04,_0x1248bb[_0x604b('0x13')][_0x604b('0x15')]);return _0x157309(_0x1248bb[_0x604b('0x13')][_0x604b('0x15')]);}logger[_0x604b('0x13')]('FaxApplication,\x20%s,\x20%s',_0x189d04,_0x1248bb[_0x604b('0x13')][_0x604b('0x15')]);return _0x300640(_0x1248bb[_0x604b('0x13')][_0x604b('0x15')]);}else{logger[_0x604b('0xe')](_0x604b('0xf'),_0x189d04,_0x604b('0x10'));_0x300640(_0x1248bb['result'][_0x604b('0x15')]);}})['catch'](function(_0x19aef4){logger[_0x604b('0x13')]('FaxApplication,\x20%s,\x20%s',_0x189d04,_0x19aef4);_0x157309(_0x19aef4);});});}exports[_0x604b('0x16')]=function(_0x1c03cf){var _0x563afb=this;return new Promise(function(_0x5a149c,_0x507d6d){return db['FaxApplication']['update'](_0x1c03cf['body'],{'raw':_0x1c03cf['options']?_0x1c03cf['options'][_0x604b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c03cf['options']?_0x1c03cf[_0x604b('0x18')]['where']||null:null,'attributes':_0x1c03cf[_0x604b('0x18')]?_0x1c03cf['options'][_0x604b('0x19')]||null:null,'limit':_0x1c03cf[_0x604b('0x18')]?_0x1c03cf[_0x604b('0x18')][_0x604b('0x1a')]||null:null})[_0x604b('0xd')](function(_0x2ae6f8){logger[_0x604b('0xe')](_0x604b('0x16'),_0x1c03cf);logger[_0x604b('0x1b')](_0x604b('0x16'),_0x1c03cf,JSON['stringify'](_0x2ae6f8));_0x5a149c(_0x2ae6f8);})[_0x604b('0x1c')](function(_0x19a5e7){logger['error']('UpdateFaxApplication',_0x19a5e7[_0x604b('0x15')],_0x1c03cf);_0x507d6d(_0x563afb[_0x604b('0x13')](0x1f4,_0x19a5e7['message']));});});}; \ No newline at end of file +var _0x7ca3=['rpc','../../config/environment','jayson/promise','http','request','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','attributes','limit','then','info','stringify','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7ca3,0xa3));var _0x37ca=function(_0x323c7e,_0x3d16ec){_0x323c7e=_0x323c7e-0x0;var _0x2b0f72=_0x7ca3[_0x323c7e];return _0x2b0f72;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x37ca('0x0'));var BPromise=require(_0x37ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37ca('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x37ca('0x3'));var logger=require(_0x37ca('0x4'))(_0x37ca('0x5'));var config=require(_0x37ca('0x6'));var jayson=require(_0x37ca('0x7'));var client=jayson['client'][_0x37ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25d9a8,_0x3611b7,_0x317972){return new BPromise(function(_0x5bcfcf,_0x2b6cca){return client[_0x37ca('0x9')](_0x25d9a8,_0x317972)['then'](function(_0x1404d3){logger['info'](_0x37ca('0xa'),_0x3611b7,_0x37ca('0xb'));logger[_0x37ca('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3611b7,_0x37ca('0xb'),JSON['stringify'](_0x1404d3));if(_0x1404d3['error']){if(_0x1404d3[_0x37ca('0xd')][_0x37ca('0xe')]===0x1f4){logger['error'](_0x37ca('0xa'),_0x3611b7,_0x1404d3[_0x37ca('0xd')][_0x37ca('0xf')]);return _0x2b6cca(_0x1404d3[_0x37ca('0xd')]['message']);}logger[_0x37ca('0xd')](_0x37ca('0xa'),_0x3611b7,_0x1404d3[_0x37ca('0xd')][_0x37ca('0xf')]);return _0x5bcfcf(_0x1404d3[_0x37ca('0xd')][_0x37ca('0xf')]);}else{logger['info'](_0x37ca('0xa'),_0x3611b7,_0x37ca('0xb'));_0x5bcfcf(_0x1404d3[_0x37ca('0x10')][_0x37ca('0xf')]);}})['catch'](function(_0x53a786){logger[_0x37ca('0xd')](_0x37ca('0xa'),_0x3611b7,_0x53a786);_0x2b6cca(_0x53a786);});});}exports[_0x37ca('0x11')]=function(_0x102cd0){var _0x41f65b=this;return new Promise(function(_0x4dd287,_0x10ca94){return db[_0x37ca('0x12')][_0x37ca('0x13')](_0x102cd0['body'],{'raw':_0x102cd0['options']?_0x102cd0[_0x37ca('0x14')][_0x37ca('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x102cd0[_0x37ca('0x14')]?_0x102cd0[_0x37ca('0x14')]['where']||null:null,'attributes':_0x102cd0[_0x37ca('0x14')]?_0x102cd0[_0x37ca('0x14')][_0x37ca('0x16')]||null:null,'limit':_0x102cd0['options']?_0x102cd0[_0x37ca('0x14')][_0x37ca('0x17')]||null:null})[_0x37ca('0x18')](function(_0x51068b){logger[_0x37ca('0x19')](_0x37ca('0x11'),_0x102cd0);logger['debug']('UpdateFaxApplication',_0x102cd0,JSON[_0x37ca('0x1a')](_0x51068b));_0x4dd287(_0x51068b);})[_0x37ca('0x1b')](function(_0x9a237f){logger[_0x37ca('0xd')](_0x37ca('0x11'),_0x9a237f[_0x37ca('0xf')],_0x102cd0);_0x10ca94(_0x41f65b[_0x37ca('0xd')](0x1f4,_0x9a237f[_0x37ca('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 78fd1df..742b274 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 _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x41b02d,_0x162a8a){var _0x48a625=function(_0xf50ca7){while(--_0xf50ca7){_0x41b02d['push'](_0x41b02d['shift']());}};_0x48a625(++_0x162a8a);}(_0x34b7,0x196));var _0x734b=function(_0x501035,_0x3c1742){_0x501035=_0x501035-0x0;var _0x4dd166=_0x34b7[_0x501035];return _0x4dd166;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file +var _0x087b=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x11a544,_0x2c66a0){var _0xf18e28=function(_0x132a14){while(--_0x132a14){_0x11a544['push'](_0x11a544['shift']());}};_0xf18e28(++_0x2c66a0);}(_0x087b,0x11a));var _0xb087=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x087b[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0xd')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0xf')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x10')]);router[_0xb087('0x11')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);module[_0xb087('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2501549..fb6bf75 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 _0x0ee9=['STRING','ENUM','out','sequelize','exports','DATE'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0ee9,0x18f));var _0x90ee=function(_0x23752c,_0x111472){_0x23752c=_0x23752c-0x0;var _0x3f2742=_0x0ee9[_0x23752c];return _0x3f2742;};'use strict';var Sequelize=require(_0x90ee('0x0'));module[_0x90ee('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x90ee('0x2')]},'disposition':{'type':Sequelize[_0x90ee('0x3')]},'secondDisposition':{'type':Sequelize[_0x90ee('0x3')]},'thirdDisposition':{'type':Sequelize[_0x90ee('0x3')]},'note':{'type':Sequelize[_0x90ee('0x3')]},'read1stAt':{'type':Sequelize[_0x90ee('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x90ee('0x4')]('in',_0x90ee('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x90ee('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x90ee('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb4f5=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x34fbf,_0x1f7da3){var _0x1d7897=function(_0x2d2817){while(--_0x2d2817){_0x34fbf['push'](_0x34fbf['shift']());}};_0x1d7897(++_0x1f7da3);}(_0xb4f5,0x68));var _0x5b4f=function(_0x27f9d3,_0x54ee48){_0x27f9d3=_0x27f9d3-0x0;var _0x1d2c10=_0xb4f5[_0x27f9d3];return _0x1d2c10;};'use strict';var Sequelize=require(_0x5b4f('0x0'));module[_0x5b4f('0x1')]={'closed':{'type':Sequelize[_0x5b4f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5b4f('0x3')]},'disposition':{'type':Sequelize[_0x5b4f('0x4')]},'secondDisposition':{'type':Sequelize[_0x5b4f('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5b4f('0x4')]},'read1stAt':{'type':Sequelize[_0x5b4f('0x3')]},'fax':{'type':Sequelize[_0x5b4f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x5b4f('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5b4f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5b4f('0x5')]('in',_0x5b4f('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 79f21c2..725a463 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 _0xbcb0=['omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','sort','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','resolve','log','err','zip-dir','moment','bluebird','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','send','index','map','FaxInteraction','fieldName','key','getOptions','findAll','query','user','catch','model','rawAttributes','keys','attributes','intersection','fields','include','merge','options','create','body','find','params','describe','addMessage','FaxMessage','ids'];(function(_0x211d5a,_0x18f4ea){var _0x5aec43=function(_0x549eb8){while(--_0x549eb8){_0x211d5a['push'](_0x211d5a['shift']());}};_0x5aec43(++_0x18f4ea);}(_0xbcb0,0x1c2));var _0x0bcb=function(_0x24358d,_0x26f937){_0x24358d=_0x24358d-0x0;var _0x4fac87=_0xbcb0[_0x24358d];return _0x4fac87;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0bcb('0x0'));var moment=require(_0x0bcb('0x1'));var BPromise=require(_0x0bcb('0x2'));var util=require('util');var path=require(_0x0bcb('0x3'));var fs=require('fs');var _=require(_0x0bcb('0x4'));var Redis=require('ioredis');var interaction=require(_0x0bcb('0x5'));var qs=require(_0x0bcb('0x6'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x0bcb('0x7'))['db'];config[_0x0bcb('0x8')]=_[_0x0bcb('0x9')](config['redis'],{'host':_0x0bcb('0xa'),'port':0x18eb});var socket=require(_0x0bcb('0xb'))(new Redis(config['redis']));require(_0x0bcb('0xc'))['register'](socket);function respondWithStatusCode(_0x4b493b,_0x35d3b8){_0x35d3b8=_0x35d3b8||0xcc;return function(_0x5ba84c){if(_0x5ba84c){return _0x4b493b[_0x0bcb('0xd')](_0x35d3b8);}return _0x4b493b[_0x0bcb('0xe')](_0x35d3b8)[_0x0bcb('0xf')]();};}function respondWithResult(_0x29453e,_0x51b3fc){_0x51b3fc=_0x51b3fc||0xc8;return function(_0x3f0c6f){if(_0x3f0c6f){return _0x29453e[_0x0bcb('0xe')](_0x51b3fc)[_0x0bcb('0x10')](_0x3f0c6f);}};}function respondWithFilteredResult(_0x5a2c99,_0x94d85d){return function(_0x9c5f5c){if(_0x9c5f5c){var _0x44d38d=typeof _0x94d85d[_0x0bcb('0x11')]===_0x0bcb('0x12')&&typeof _0x94d85d[_0x0bcb('0x13')]===_0x0bcb('0x12');var _0x1f97bb=_0x9c5f5c[_0x0bcb('0x14')];var _0x53f5b2=_0x44d38d?0x0:_0x94d85d['offset'];var _0x58f1e6=_0x44d38d?_0x9c5f5c[_0x0bcb('0x14')]:_0x94d85d[_0x0bcb('0x11')]+_0x94d85d['limit'];var _0x16b6cb;if(_0x58f1e6>=_0x1f97bb){_0x58f1e6=_0x1f97bb;_0x16b6cb=0xc8;}else{_0x16b6cb=0xce;}_0x5a2c99[_0x0bcb('0xe')](_0x16b6cb);return _0x5a2c99[_0x0bcb('0x15')](_0x0bcb('0x16'),_0x53f5b2+'-'+_0x58f1e6+'/'+_0x1f97bb)[_0x0bcb('0x10')](_0x9c5f5c);}return null;};}function saveUpdates(_0x119f5a){return function(_0x94c5ac){if(_0x94c5ac){return _0x94c5ac[_0x0bcb('0x17')](_0x119f5a)[_0x0bcb('0x18')](function(_0x303d80){return _0x303d80;});}return null;};}function removeEntity(_0x59389f){return function(_0x34035e){if(_0x34035e){return _0x34035e[_0x0bcb('0x19')]()[_0x0bcb('0x18')](function(){_0x59389f[_0x0bcb('0xe')](0xcc)[_0x0bcb('0xf')]();});}};}function handleEntityNotFound(_0x1e04a1){return function(_0x215008){if(!_0x215008){_0x1e04a1[_0x0bcb('0xd')](0x194);}return _0x215008;};}function handleError(_0x4dbaa7,_0x4f0277){_0x4f0277=_0x4f0277||0x1f4;return function(_0x2789b6){logger['error'](_0x2789b6['stack']);if(_0x2789b6[_0x0bcb('0x1a')]){delete _0x2789b6[_0x0bcb('0x1a')];}_0x4dbaa7['status'](_0x4f0277)[_0x0bcb('0x1b')](_0x2789b6);};}exports[_0x0bcb('0x1c')]=function(_0x597dab,_0x31c805){var _0x37102e={};var _0x1f1d25=_[_0x0bcb('0x1d')](db[_0x0bcb('0x1e')]['rawAttributes'],function(_0x3ea2ae){return{'name':_0x3ea2ae[_0x0bcb('0x1f')],'type':_0x3ea2ae['type'][_0x0bcb('0x20')]};});_0x37102e=qs[_0x0bcb('0x21')](_0x1f1d25,_0x597dab);return interaction[_0x0bcb('0x22')]('fax',_0x597dab[_0x0bcb('0x23')],_0x597dab[_0x0bcb('0x24')],_0x37102e,_0x1f1d25)[_0x0bcb('0x18')](respondWithFilteredResult(_0x31c805,_0x37102e))[_0x0bcb('0x25')](handleError(_0x31c805,null));};exports['show']=function(_0x5a5d54,_0x40b01d){var _0x4beec4={'raw':![],'where':{'id':_0x5a5d54['params']['id']}},_0x10ac80={};_0x10ac80[_0x0bcb('0x26')]=_['keys'](db[_0x0bcb('0x1e')][_0x0bcb('0x27')]);_0x10ac80[_0x0bcb('0x23')]=_[_0x0bcb('0x28')](_0x5a5d54[_0x0bcb('0x23')]);_0x10ac80['filters']=_['intersection'](_0x10ac80['model'],_0x10ac80[_0x0bcb('0x23')]);_0x4beec4[_0x0bcb('0x29')]=_[_0x0bcb('0x2a')](_0x10ac80[_0x0bcb('0x26')],qs['fields'](_0x5a5d54[_0x0bcb('0x23')][_0x0bcb('0x2b')]));_0x4beec4['attributes']=_0x4beec4[_0x0bcb('0x29')]['length']?_0x4beec4[_0x0bcb('0x29')]:_0x10ac80[_0x0bcb('0x26')];if(_0x5a5d54[_0x0bcb('0x23')]['includeAll']){_0x4beec4[_0x0bcb('0x2c')]=[{'all':!![]}];}_0x4beec4=_[_0x0bcb('0x2d')]({},_0x4beec4,_0x5a5d54[_0x0bcb('0x2e')]);return db[_0x0bcb('0x1e')]['find'](_0x4beec4)[_0x0bcb('0x18')](handleEntityNotFound(_0x40b01d,null))[_0x0bcb('0x18')](respondWithResult(_0x40b01d,null))['catch'](handleError(_0x40b01d,null));};exports[_0x0bcb('0x2f')]=function(_0x42e2d5,_0x280790){return db[_0x0bcb('0x1e')][_0x0bcb('0x2f')](_0x42e2d5['body'],{})[_0x0bcb('0x18')](respondWithResult(_0x280790,0xc9))[_0x0bcb('0x25')](handleError(_0x280790,null));};exports[_0x0bcb('0x17')]=function(_0x13f57b,_0x3d8a47){if(_0x13f57b[_0x0bcb('0x30')]['id']){delete _0x13f57b['body']['id'];}return db[_0x0bcb('0x1e')][_0x0bcb('0x31')]({'where':{'id':_0x13f57b['params']['id']}})['then'](handleEntityNotFound(_0x3d8a47,null))[_0x0bcb('0x18')](saveUpdates(_0x13f57b[_0x0bcb('0x30')],null))['then'](respondWithResult(_0x3d8a47,null))[_0x0bcb('0x25')](handleError(_0x3d8a47,null));};exports[_0x0bcb('0x19')]=function(_0x1ce4df,_0x3365ed){return db[_0x0bcb('0x1e')][_0x0bcb('0x31')]({'where':{'id':_0x1ce4df[_0x0bcb('0x32')]['id']}})['then'](handleEntityNotFound(_0x3365ed,null))['then'](removeEntity(_0x3365ed,null))[_0x0bcb('0x25')](handleError(_0x3365ed,null));};exports[_0x0bcb('0x33')]=function(_0x1e83f6,_0x500f6e){return db[_0x0bcb('0x1e')][_0x0bcb('0x33')]()['then'](respondWithResult(_0x500f6e,null))[_0x0bcb('0x25')](handleError(_0x500f6e,null));};exports[_0x0bcb('0x34')]=function(_0xa6b366,_0x57f8b3){return db[_0x0bcb('0x35')][_0x0bcb('0x31')]({'where':{'id':_0xa6b366[_0x0bcb('0x32')]['id']}})[_0x0bcb('0x18')](handleEntityNotFound(_0x57f8b3,null))[_0x0bcb('0x18')](function(_0x382262){if(_0x382262){return _0x382262[_0x0bcb('0x34')](_0xa6b366[_0x0bcb('0x30')][_0x0bcb('0x36')],_[_0x0bcb('0x37')](_0xa6b366[_0x0bcb('0x30')],[_0x0bcb('0x36'),'id'])||{});}})[_0x0bcb('0x18')](respondWithResult(_0x57f8b3,null))[_0x0bcb('0x25')](handleError(_0x57f8b3,null));};exports[_0x0bcb('0x38')]=function(_0x730a8,_0x5ee01a){var _0x4e9508={'raw':![],'where':{}};var _0x24d94e={};var _0x9e1a64={'count':0x0,'rows':[]};return db[_0x0bcb('0x1e')][_0x0bcb('0x39')]({'where':{'id':_0x730a8[_0x0bcb('0x32')]['id']}})[_0x0bcb('0x18')](handleEntityNotFound(_0x5ee01a,null))['then'](function(_0x129fb3){if(_0x129fb3){_0x24d94e[_0x0bcb('0x26')]=_[_0x0bcb('0x28')](db['FaxMessage']['rawAttributes']);_0x24d94e['query']=_[_0x0bcb('0x28')](_0x730a8[_0x0bcb('0x23')]);_0x24d94e[_0x0bcb('0x3a')]=_['intersection'](_0x24d94e[_0x0bcb('0x26')],_0x24d94e[_0x0bcb('0x23')]);_0x4e9508['attributes']=_['intersection'](_0x24d94e['model'],qs[_0x0bcb('0x2b')](_0x730a8[_0x0bcb('0x23')]['fields']));_0x4e9508[_0x0bcb('0x29')]=_0x4e9508[_0x0bcb('0x29')][_0x0bcb('0x3b')]?_0x4e9508['attributes']:_0x24d94e[_0x0bcb('0x26')];if(!_0x730a8['query'][_0x0bcb('0x3c')](_0x0bcb('0x3d'))){_0x4e9508[_0x0bcb('0x13')]=qs[_0x0bcb('0x13')](_0x730a8[_0x0bcb('0x23')][_0x0bcb('0x13')]);_0x4e9508[_0x0bcb('0x11')]=qs['offset'](_0x730a8[_0x0bcb('0x23')][_0x0bcb('0x11')]);}_0x4e9508['order']=qs[_0x0bcb('0x3e')](_0x730a8[_0x0bcb('0x23')][_0x0bcb('0x3e')]);_0x4e9508['where']=qs[_0x0bcb('0x3a')](_[_0x0bcb('0x3f')](_0x730a8['query'],_0x24d94e['filters']));_0x4e9508[_0x0bcb('0x40')][_0x0bcb('0x41')]=_0x129fb3['id'];if(_0x730a8['query'][_0x0bcb('0x42')]){_0x4e9508[_0x0bcb('0x40')]=_[_0x0bcb('0x2d')](_0x4e9508['where'],{'$or':_[_0x0bcb('0x1d')](_0x4e9508[_0x0bcb('0x29')],function(_0x4d27e9){var _0x5d55de={};_0x5d55de[_0x4d27e9]={'$like':'%'+_0x730a8['query'][_0x0bcb('0x42')]+'%'};return _0x5d55de;})});}if(_0x730a8[_0x0bcb('0x23')][_0x0bcb('0x43')]){var _0x2e36fa=_0x730a8[_0x0bcb('0x23')][_0x0bcb('0x43')][_0x0bcb('0x44')](',');var _0x4e16b3={};_0x4e16b3[_0x2e36fa[0x0]]={'$gte':moment(_0x2e36fa[0x1])[_0x0bcb('0x45')](_0x0bcb('0x46'))};_0x4e9508[_0x0bcb('0x40')]=_[_0x0bcb('0x2d')](_0x4e9508[_0x0bcb('0x40')],_0x4e16b3);}_0x4e9508=_['merge']({},_0x4e9508,_0x730a8[_0x0bcb('0x2e')]);return db[_0x0bcb('0x35')][_0x0bcb('0x14')]({'where':_0x4e9508[_0x0bcb('0x40')]})[_0x0bcb('0x18')](function(_0xc92e75){_0x9e1a64[_0x0bcb('0x14')]=_0xc92e75;if(_0x730a8[_0x0bcb('0x23')][_0x0bcb('0x47')]){_0x4e9508[_0x0bcb('0x2c')]=[{'all':!![]}];}return db['FaxMessage'][_0x0bcb('0x22')](_0x4e9508);})[_0x0bcb('0x18')](function(_0x2dcbac){_0x9e1a64[_0x0bcb('0x48')]=_0x2dcbac;return _0x9e1a64;});}})[_0x0bcb('0x18')](respondWithFilteredResult(_0x5ee01a,_0x4e9508))[_0x0bcb('0x25')](handleError(_0x5ee01a,null));};exports[_0x0bcb('0x49')]=function(_0x1e095f,_0x49a6d3){return db[_0x0bcb('0x1e')]['find']({'where':{'id':_0x1e095f[_0x0bcb('0x32')]['id']}})[_0x0bcb('0x18')](handleEntityNotFound(_0x49a6d3,null))[_0x0bcb('0x18')](function(_0x44050e){if(_0x44050e){return _0x44050e[_0x0bcb('0x4a')](_0x1e095f['body'][_0x0bcb('0x36')],_[_0x0bcb('0x37')](_0x1e095f[_0x0bcb('0x30')],[_0x0bcb('0x36'),'id'])||{})[_0x0bcb('0x4b')](function(){return db['Tag'][_0x0bcb('0x22')]({'attributes':['id',_0x0bcb('0x1a'),_0x0bcb('0x4c')],'where':{'id':_0x1e095f[_0x0bcb('0x30')][_0x0bcb('0x36')]}});})[_0x0bcb('0x18')](function(_0x3a8a91){socket[_0x0bcb('0x4d')](_0x0bcb('0x4e'),{'id':Number(_0x1e095f[_0x0bcb('0x32')]['id']),'tags':_0x3a8a91||[]});return{'id':Number(_0x1e095f[_0x0bcb('0x32')]['id']),'tags':_0x3a8a91||[]};});}})[_0x0bcb('0x18')](respondWithResult(_0x49a6d3,null))[_0x0bcb('0x25')](handleError(_0x49a6d3,null));};exports[_0x0bcb('0x4f')]=function(_0x36595e,_0x24215a){return db['FaxInteraction'][_0x0bcb('0x31')]({'where':{'id':_0x36595e['params']['id']}})[_0x0bcb('0x18')](handleEntityNotFound(_0x24215a,null))[_0x0bcb('0x18')](function(_0xffbc98){if(_0xffbc98){return _0xffbc98[_0x0bcb('0x4f')](_0x36595e[_0x0bcb('0x23')][_0x0bcb('0x36')]);}})[_0x0bcb('0x18')](respondWithStatusCode(_0x24215a,null))[_0x0bcb('0x25')](handleError(_0x24215a,null));};exports[_0x0bcb('0x50')]=function(_0x45e5ba,_0x59f7fe){var _0x1b8bab=moment()[_0x0bcb('0x51')]()[_0x0bcb('0x52')]();var _0xb0601e=path[_0x0bcb('0x53')](config['root'],_0x0bcb('0x54'),'files',_0x0bcb('0x55'));var _0x327014=path[_0x0bcb('0x53')](config[_0x0bcb('0x56')],_0x0bcb('0x54'),_0x0bcb('0x57'),_0x0bcb('0x58'));var _0x20173c=path['join'](_0xb0601e,_0x1b8bab);var _0x251546=util[_0x0bcb('0x45')](_0x0bcb('0x59'),_0x45e5ba['params']['id'],_0x1b8bab);var _0x2811f1=path['join'](_0xb0601e,_0x251546);var _0x3e68cb=[];_0x3e68cb['push']({'model':db[_0x0bcb('0x5a')],'as':_0x0bcb('0x5a'),'raw':!![]});var _0x3e063d=[{'model':db[_0x0bcb('0x35')],'as':_0x0bcb('0x5b'),'attributes':['id',_0x0bcb('0x30'),_0x0bcb('0x5c')],'include':_0x3e68cb}];return db[_0x0bcb('0x1e')]['find']({'where':{'id':_0x45e5ba[_0x0bcb('0x32')]['id']},'include':_0x3e063d})[_0x0bcb('0x18')](handleEntityNotFound(_0x59f7fe,null))[_0x0bcb('0x18')](function(_0x5d61d3){if(_0x5d61d3&&_0x5d61d3['Messages']){var _0x545c15=_0x5d61d3[_0x0bcb('0x5d')]({'plain':!![]});fs[_0x0bcb('0x5e')](_0x20173c);for(var _0x43e1e4=0x0;_0x43e1e4<_0x545c15[_0x0bcb('0x5b')]['length'];_0x43e1e4++){var _0x9fd555=_0x545c15[_0x0bcb('0x5b')][_0x43e1e4][_0x0bcb('0x5a')];if(_0x9fd555){var _0x146da8=path[_0x0bcb('0x53')](_0x327014,_0x9fd555[_0x0bcb('0x5f')]);if(fs[_0x0bcb('0x60')](_0x146da8)){fs['createReadStream'](_0x146da8)[_0x0bcb('0x61')](fs['createWriteStream'](path[_0x0bcb('0x53')](_0x20173c,_0x9fd555['basename'])));}}}return BPromise[_0x0bcb('0x62')]()['then'](function(){return new BPromise(function(_0x46aad6,_0x4565c5){zipdir(_0x20173c,{'saveTo':_0x2811f1},function(_0x59e78c,_0x22d752){if(_0x59e78c)return _0x4565c5(_0x59e78c);return _0x46aad6(_0x22d752);});})['then'](function(){return new BPromise(function(_0x1505f3,_0x338d85){rimraf(_0x20173c,function(_0x40f2cc){if(_0x40f2cc)_0x338d85(_0x40f2cc);return _0x1505f3();});});})[_0x0bcb('0x18')](function(){return _0x59f7fe[_0x0bcb('0x50')](_0x2811f1,_0x251546,function(_0xabff6d){if(_0xabff6d){console[_0x0bcb('0x63')](_0x0bcb('0x64'),_0xabff6d);}else{fs['unlinkSync'](_0x2811f1);}});});});}else{return _0x59f7fe[_0x0bcb('0xd')](0xc8);}})[_0x0bcb('0x25')](handleError(_0x59f7fe,null));}; \ No newline at end of file +var _0x4bad=['faxInteractionTags:save','removeTags','unix','toString','server','files','join','root','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','resolve','download','log','unlinkSync','rimraf','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/environment','localhost','redis','./faxInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','send','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','create','body','find','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','length','hasOwnProperty','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','color'];(function(_0x2944a4,_0x21a845){var _0x46476e=function(_0x16e105){while(--_0x16e105){_0x2944a4['push'](_0x2944a4['shift']());}};_0x46476e(++_0x21a845);}(_0x4bad,0x7a));var _0xd4ba=function(_0x79f7fb,_0xe3713f){_0x79f7fb=_0x79f7fb-0x0;var _0x355f45=_0x4bad[_0x79f7fb];return _0x355f45;};'use strict';var rimraf=require(_0xd4ba('0x0'));var zipdir=require('zip-dir');var moment=require(_0xd4ba('0x1'));var BPromise=require('bluebird');var util=require(_0xd4ba('0x2'));var path=require(_0xd4ba('0x3'));var fs=require('fs');var _=require(_0xd4ba('0x4'));var Redis=require(_0xd4ba('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xd4ba('0x6'));var logger=require('../../config/logger')('api');var config=require(_0xd4ba('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd4ba('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4ba('0x9')]));require(_0xd4ba('0xa'))[_0xd4ba('0xb')](socket);function respondWithStatusCode(_0xec1e5e,_0x3b66fd){_0x3b66fd=_0x3b66fd||0xcc;return function(_0x3dca77){if(_0x3dca77){return _0xec1e5e['sendStatus'](_0x3b66fd);}return _0xec1e5e[_0xd4ba('0xc')](_0x3b66fd)[_0xd4ba('0xd')]();};}function respondWithResult(_0x882ed8,_0x9b67ea){_0x9b67ea=_0x9b67ea||0xc8;return function(_0x3df2ed){if(_0x3df2ed){return _0x882ed8['status'](_0x9b67ea)[_0xd4ba('0xe')](_0x3df2ed);}};}function respondWithFilteredResult(_0x206b86,_0x202755){return function(_0x2a12d4){if(_0x2a12d4){var _0x423bb7=typeof _0x202755[_0xd4ba('0xf')]===_0xd4ba('0x10')&&typeof _0x202755[_0xd4ba('0x11')]===_0xd4ba('0x10');var _0x4e7a6e=_0x2a12d4['count'];var _0x13ffbb=_0x423bb7?0x0:_0x202755[_0xd4ba('0xf')];var _0x36f831=_0x423bb7?_0x2a12d4[_0xd4ba('0x12')]:_0x202755[_0xd4ba('0xf')]+_0x202755['limit'];var _0x468b3c;if(_0x36f831>=_0x4e7a6e){_0x36f831=_0x4e7a6e;_0x468b3c=0xc8;}else{_0x468b3c=0xce;}_0x206b86['status'](_0x468b3c);return _0x206b86[_0xd4ba('0x13')](_0xd4ba('0x14'),_0x13ffbb+'-'+_0x36f831+'/'+_0x4e7a6e)['json'](_0x2a12d4);}return null;};}function saveUpdates(_0x52ad22){return function(_0x39188d){if(_0x39188d){return _0x39188d[_0xd4ba('0x15')](_0x52ad22)[_0xd4ba('0x16')](function(_0x478785){return _0x478785;});}return null;};}function removeEntity(_0x3b08c0){return function(_0x47ee72){if(_0x47ee72){return _0x47ee72['destroy']()[_0xd4ba('0x16')](function(){_0x3b08c0[_0xd4ba('0xc')](0xcc)[_0xd4ba('0xd')]();});}};}function handleEntityNotFound(_0x4f75c5){return function(_0x3cdf78){if(!_0x3cdf78){_0x4f75c5['sendStatus'](0x194);}return _0x3cdf78;};}function handleError(_0x32a6bf,_0x2d4561){_0x2d4561=_0x2d4561||0x1f4;return function(_0x14c674){logger['error'](_0x14c674[_0xd4ba('0x17')]);if(_0x14c674[_0xd4ba('0x18')]){delete _0x14c674[_0xd4ba('0x18')];}_0x32a6bf[_0xd4ba('0xc')](_0x2d4561)[_0xd4ba('0x19')](_0x14c674);};}exports['index']=function(_0x1c4321,_0x5578de){var _0x469ff9={};var _0x4f41cc=_[_0xd4ba('0x1a')](db[_0xd4ba('0x1b')][_0xd4ba('0x1c')],function(_0x1cae38){return{'name':_0x1cae38[_0xd4ba('0x1d')],'type':_0x1cae38[_0xd4ba('0x1e')][_0xd4ba('0x1f')]};});_0x469ff9=qs[_0xd4ba('0x20')](_0x4f41cc,_0x1c4321);return interaction[_0xd4ba('0x21')](_0xd4ba('0x22'),_0x1c4321[_0xd4ba('0x23')],_0x1c4321[_0xd4ba('0x24')],_0x469ff9,_0x4f41cc)[_0xd4ba('0x16')](respondWithFilteredResult(_0x5578de,_0x469ff9))[_0xd4ba('0x25')](handleError(_0x5578de,null));};exports[_0xd4ba('0x26')]=function(_0x3f4c9c,_0xad823a){var _0x3fe647={'raw':![],'where':{'id':_0x3f4c9c[_0xd4ba('0x27')]['id']}},_0x213d4e={};_0x213d4e[_0xd4ba('0x28')]=_['keys'](db['FaxInteraction'][_0xd4ba('0x1c')]);_0x213d4e['query']=_[_0xd4ba('0x29')](_0x3f4c9c[_0xd4ba('0x23')]);_0x213d4e[_0xd4ba('0x2a')]=_[_0xd4ba('0x2b')](_0x213d4e[_0xd4ba('0x28')],_0x213d4e['query']);_0x3fe647[_0xd4ba('0x2c')]=_[_0xd4ba('0x2b')](_0x213d4e['model'],qs[_0xd4ba('0x2d')](_0x3f4c9c['query'][_0xd4ba('0x2d')]));_0x3fe647[_0xd4ba('0x2c')]=_0x3fe647[_0xd4ba('0x2c')]['length']?_0x3fe647['attributes']:_0x213d4e[_0xd4ba('0x28')];if(_0x3f4c9c[_0xd4ba('0x23')][_0xd4ba('0x2e')]){_0x3fe647[_0xd4ba('0x2f')]=[{'all':!![]}];}_0x3fe647=_[_0xd4ba('0x30')]({},_0x3fe647,_0x3f4c9c[_0xd4ba('0x31')]);return db[_0xd4ba('0x1b')]['find'](_0x3fe647)[_0xd4ba('0x16')](handleEntityNotFound(_0xad823a,null))[_0xd4ba('0x16')](respondWithResult(_0xad823a,null))[_0xd4ba('0x25')](handleError(_0xad823a,null));};exports[_0xd4ba('0x32')]=function(_0x178fd4,_0x243d25){return db[_0xd4ba('0x1b')][_0xd4ba('0x32')](_0x178fd4['body'],{})[_0xd4ba('0x16')](respondWithResult(_0x243d25,0xc9))['catch'](handleError(_0x243d25,null));};exports['update']=function(_0x2501b6,_0x2f625c){if(_0x2501b6[_0xd4ba('0x33')]['id']){delete _0x2501b6[_0xd4ba('0x33')]['id'];}return db[_0xd4ba('0x1b')][_0xd4ba('0x34')]({'where':{'id':_0x2501b6[_0xd4ba('0x27')]['id']}})[_0xd4ba('0x16')](handleEntityNotFound(_0x2f625c,null))[_0xd4ba('0x16')](saveUpdates(_0x2501b6[_0xd4ba('0x33')],null))[_0xd4ba('0x16')](respondWithResult(_0x2f625c,null))[_0xd4ba('0x25')](handleError(_0x2f625c,null));};exports[_0xd4ba('0x35')]=function(_0x5e60ec,_0xc81ae){return db[_0xd4ba('0x1b')][_0xd4ba('0x34')]({'where':{'id':_0x5e60ec[_0xd4ba('0x27')]['id']}})['then'](handleEntityNotFound(_0xc81ae,null))[_0xd4ba('0x16')](removeEntity(_0xc81ae,null))[_0xd4ba('0x25')](handleError(_0xc81ae,null));};exports[_0xd4ba('0x36')]=function(_0x4b3aa3,_0xf4b84){return db['FaxInteraction'][_0xd4ba('0x36')]()[_0xd4ba('0x16')](respondWithResult(_0xf4b84,null))['catch'](handleError(_0xf4b84,null));};exports[_0xd4ba('0x37')]=function(_0xf8fb6b,_0xe38631){return db[_0xd4ba('0x38')]['find']({'where':{'id':_0xf8fb6b[_0xd4ba('0x27')]['id']}})[_0xd4ba('0x16')](handleEntityNotFound(_0xe38631,null))[_0xd4ba('0x16')](function(_0xfa874a){if(_0xfa874a){return _0xfa874a['addMessage'](_0xf8fb6b[_0xd4ba('0x33')][_0xd4ba('0x39')],_[_0xd4ba('0x3a')](_0xf8fb6b[_0xd4ba('0x33')],[_0xd4ba('0x39'),'id'])||{});}})['then'](respondWithResult(_0xe38631,null))[_0xd4ba('0x25')](handleError(_0xe38631,null));};exports[_0xd4ba('0x3b')]=function(_0x33f21c,_0x534b80){var _0x4745ca={'raw':![],'where':{}};var _0x29b5bc={};var _0x3e949e={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x33f21c[_0xd4ba('0x27')]['id']}})[_0xd4ba('0x16')](handleEntityNotFound(_0x534b80,null))[_0xd4ba('0x16')](function(_0x40130d){if(_0x40130d){_0x29b5bc[_0xd4ba('0x28')]=_[_0xd4ba('0x29')](db[_0xd4ba('0x38')][_0xd4ba('0x1c')]);_0x29b5bc['query']=_['keys'](_0x33f21c[_0xd4ba('0x23')]);_0x29b5bc[_0xd4ba('0x2a')]=_['intersection'](_0x29b5bc[_0xd4ba('0x28')],_0x29b5bc[_0xd4ba('0x23')]);_0x4745ca[_0xd4ba('0x2c')]=_[_0xd4ba('0x2b')](_0x29b5bc[_0xd4ba('0x28')],qs[_0xd4ba('0x2d')](_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x2d')]));_0x4745ca[_0xd4ba('0x2c')]=_0x4745ca[_0xd4ba('0x2c')][_0xd4ba('0x3c')]?_0x4745ca['attributes']:_0x29b5bc[_0xd4ba('0x28')];if(!_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x3d')]('nolimit')){_0x4745ca[_0xd4ba('0x11')]=qs['limit'](_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x11')]);_0x4745ca['offset']=qs[_0xd4ba('0xf')](_0x33f21c[_0xd4ba('0x23')]['offset']);}_0x4745ca[_0xd4ba('0x3e')]=qs[_0xd4ba('0x3f')](_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x3f')]);_0x4745ca[_0xd4ba('0x40')]=qs['filters'](_[_0xd4ba('0x41')](_0x33f21c[_0xd4ba('0x23')],_0x29b5bc[_0xd4ba('0x2a')]));_0x4745ca['where']['FaxInteractionId']=_0x40130d['id'];if(_0x33f21c['query'][_0xd4ba('0x42')]){_0x4745ca[_0xd4ba('0x40')]=_[_0xd4ba('0x30')](_0x4745ca[_0xd4ba('0x40')],{'$or':_['map'](_0x4745ca[_0xd4ba('0x2c')],function(_0x5f5cec){var _0x1cb53c={};_0x1cb53c[_0x5f5cec]={'$like':'%'+_0x33f21c['query'][_0xd4ba('0x42')]+'%'};return _0x1cb53c;})});}if(_0x33f21c['query'][_0xd4ba('0x43')]){var _0x210c08=_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x43')]['split'](',');var _0x3e9968={};_0x3e9968[_0x210c08[0x0]]={'$gte':moment(_0x210c08[0x1])[_0xd4ba('0x44')](_0xd4ba('0x45'))};_0x4745ca['where']=_['merge'](_0x4745ca[_0xd4ba('0x40')],_0x3e9968);}_0x4745ca=_[_0xd4ba('0x30')]({},_0x4745ca,_0x33f21c[_0xd4ba('0x31')]);return db['FaxMessage'][_0xd4ba('0x12')]({'where':_0x4745ca[_0xd4ba('0x40')]})['then'](function(_0x561567){_0x3e949e[_0xd4ba('0x12')]=_0x561567;if(_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x2e')]){_0x4745ca[_0xd4ba('0x2f')]=[{'all':!![]}];}return db['FaxMessage'][_0xd4ba('0x21')](_0x4745ca);})['then'](function(_0x5843f5){_0x3e949e['rows']=_0x5843f5;return _0x3e949e;});}})['then'](respondWithFilteredResult(_0x534b80,_0x4745ca))[_0xd4ba('0x25')](handleError(_0x534b80,null));};exports['addTags']=function(_0x74c314,_0x4d4a6c){return db[_0xd4ba('0x1b')][_0xd4ba('0x34')]({'where':{'id':_0x74c314[_0xd4ba('0x27')]['id']}})['then'](handleEntityNotFound(_0x4d4a6c,null))[_0xd4ba('0x16')](function(_0x430329){if(_0x430329){return _0x430329[_0xd4ba('0x46')](_0x74c314[_0xd4ba('0x33')][_0xd4ba('0x39')],_[_0xd4ba('0x3a')](_0x74c314[_0xd4ba('0x33')],[_0xd4ba('0x39'),'id'])||{})[_0xd4ba('0x47')](function(){return db[_0xd4ba('0x48')][_0xd4ba('0x21')]({'attributes':['id',_0xd4ba('0x18'),_0xd4ba('0x49')],'where':{'id':_0x74c314[_0xd4ba('0x33')][_0xd4ba('0x39')]}});})[_0xd4ba('0x16')](function(_0x21c9ed){socket['emit'](_0xd4ba('0x4a'),{'id':Number(_0x74c314[_0xd4ba('0x27')]['id']),'tags':_0x21c9ed||[]});return{'id':Number(_0x74c314['params']['id']),'tags':_0x21c9ed||[]};});}})['then'](respondWithResult(_0x4d4a6c,null))[_0xd4ba('0x25')](handleError(_0x4d4a6c,null));};exports[_0xd4ba('0x4b')]=function(_0x1e63ba,_0xb4a3c6){return db[_0xd4ba('0x1b')]['find']({'where':{'id':_0x1e63ba[_0xd4ba('0x27')]['id']}})['then'](handleEntityNotFound(_0xb4a3c6,null))[_0xd4ba('0x16')](function(_0x75d26d){if(_0x75d26d){return _0x75d26d[_0xd4ba('0x4b')](_0x1e63ba[_0xd4ba('0x23')][_0xd4ba('0x39')]);}})[_0xd4ba('0x16')](respondWithStatusCode(_0xb4a3c6,null))[_0xd4ba('0x25')](handleError(_0xb4a3c6,null));};exports['download']=function(_0x51361f,_0x536215){var _0x2721a8=moment()[_0xd4ba('0x4c')]()[_0xd4ba('0x4d')]();var _0x1cfe55=path['join'](config['root'],_0xd4ba('0x4e'),_0xd4ba('0x4f'),'tmp');var _0x143dbc=path[_0xd4ba('0x50')](config[_0xd4ba('0x51')],_0xd4ba('0x4e'),_0xd4ba('0x4f'),_0xd4ba('0x52'));var _0x35bdaf=path[_0xd4ba('0x50')](_0x1cfe55,_0x2721a8);var _0x271198=util[_0xd4ba('0x44')](_0xd4ba('0x53'),_0x51361f['params']['id'],_0x2721a8);var _0x1f6958=path[_0xd4ba('0x50')](_0x1cfe55,_0x271198);var _0x4c755e=[];_0x4c755e[_0xd4ba('0x54')]({'model':db[_0xd4ba('0x55')],'as':'Attachment','raw':!![]});var _0x11816d=[{'model':db[_0xd4ba('0x38')],'as':'Messages','attributes':['id',_0xd4ba('0x33'),_0xd4ba('0x56')],'include':_0x4c755e}];return db['FaxInteraction'][_0xd4ba('0x34')]({'where':{'id':_0x51361f[_0xd4ba('0x27')]['id']},'include':_0x11816d})[_0xd4ba('0x16')](handleEntityNotFound(_0x536215,null))[_0xd4ba('0x16')](function(_0x586ddf){if(_0x586ddf&&_0x586ddf[_0xd4ba('0x57')]){var _0x1ee11c=_0x586ddf[_0xd4ba('0x58')]({'plain':!![]});fs[_0xd4ba('0x59')](_0x35bdaf);for(var _0x11f6ae=0x0;_0x11f6ae<_0x1ee11c['Messages']['length'];_0x11f6ae++){var _0x37cd5c=_0x1ee11c[_0xd4ba('0x57')][_0x11f6ae][_0xd4ba('0x55')];if(_0x37cd5c){var _0x4bb5cc=path[_0xd4ba('0x50')](_0x143dbc,_0x37cd5c[_0xd4ba('0x5a')]);if(fs['existsSync'](_0x4bb5cc)){fs[_0xd4ba('0x5b')](_0x4bb5cc)[_0xd4ba('0x5c')](fs[_0xd4ba('0x5d')](path[_0xd4ba('0x50')](_0x35bdaf,_0x37cd5c[_0xd4ba('0x5a')])));}}}return BPromise[_0xd4ba('0x5e')]()[_0xd4ba('0x16')](function(){return new BPromise(function(_0x56c823,_0x5d6ca3){zipdir(_0x35bdaf,{'saveTo':_0x1f6958},function(_0x14c940,_0x3b8002){if(_0x14c940)return _0x5d6ca3(_0x14c940);return _0x56c823(_0x3b8002);});})[_0xd4ba('0x16')](function(){return new BPromise(function(_0x17ebda,_0x3898c1){rimraf(_0x35bdaf,function(_0x173dd4){if(_0x173dd4)_0x3898c1(_0x173dd4);return _0x17ebda();});});})[_0xd4ba('0x16')](function(){return _0x536215[_0xd4ba('0x5f')](_0x1f6958,_0x271198,function(_0x149d75){if(_0x149d75){console[_0xd4ba('0x60')]('err',_0x149d75);}else{fs[_0xd4ba('0x61')](_0x1f6958);}});});});}else{return _0x536215['sendStatus'](0xc8);}})['catch'](handleError(_0x536215,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index c587a13..d3c2e29 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 _0x0999=['catch','hasOwnProperty','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x0999,0x192));var _0x9099=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x0999[_0x34232c];return _0x4d4f4e;};'use strict';var EventEmitter=require(_0x9099('0x0'));var FaxInteraction=require(_0x9099('0x1'))['db'][_0x9099('0x2')];var FaxMessage=require(_0x9099('0x1'))['db'][_0x9099('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9099('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9099('0x5')};function emitEvent(_0x2e25f3){return function(_0x559c38,_0x42413b,_0x5f5770){_0x559c38['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1d06b2){_0x559c38[_0x9099('0x6')](_0x9099('0x7'),_0x1d06b2[_0x9099('0x8')](function(_0x34d0f5){return{'id':_0x34d0f5['id']};}));return FaxMessage[_0x9099('0x9')]({'where':{'FaxInteractionId':_0x559c38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9099('0xa')](function(_0x54cb1a){_0x559c38[_0x9099('0x6')](_0x9099('0xb'),_0x54cb1a[_0x9099('0xc')]);FaxInteractionEvents[_0x9099('0xd')](_0x2e25f3+':'+_0x559c38['id'],_0x559c38);FaxInteractionEvents[_0x9099('0xd')](_0x2e25f3,_0x559c38);_0x5f5770(null);})[_0x9099('0xe')](_0x5f5770(null));};}for(var e in events){if(events[_0x9099('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xa3c7=['hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','getUsers','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa3c7,0x16a));var _0x7a3c=function(_0x2e6e12,_0x238fc4){_0x2e6e12=_0x2e6e12-0x0;var _0x4bebf6=_0xa3c7[_0x2e6e12];return _0x4bebf6;};'use strict';var EventEmitter=require(_0x7a3c('0x0'));var FaxInteraction=require(_0x7a3c('0x1'))['db'][_0x7a3c('0x2')];var FaxMessage=require(_0x7a3c('0x1'))['db'][_0x7a3c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x7a3c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a3c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x51f797){return function(_0x3744cf,_0x1723e0,_0x110eed){_0x3744cf[_0x7a3c('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5b747f){_0x3744cf['setDataValue'](_0x7a3c('0x7'),_0x5b747f[_0x7a3c('0x8')](function(_0x10ffb0){return{'id':_0x10ffb0['id']};}));return FaxMessage[_0x7a3c('0x9')]({'where':{'FaxInteractionId':_0x3744cf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x14a1b7){_0x3744cf[_0x7a3c('0xa')](_0x7a3c('0xb'),_0x14a1b7[_0x7a3c('0xc')]);FaxInteractionEvents[_0x7a3c('0xd')](_0x51f797+':'+_0x3744cf['id'],_0x3744cf);FaxInteractionEvents['emit'](_0x51f797,_0x3744cf);_0x110eed(null);})[_0x7a3c('0xe')](_0x110eed(null));};}for(var e in events){if(events[_0x7a3c('0xf')](e)){var event=events[e];FaxInteraction[_0x7a3c('0x10')](e,emitEvent(event));}}module[_0x7a3c('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 47a0087..4e2069e 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 _0xe55d=['YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','rimraf','./faxInteraction.attributes','define','fax_interactions','changed','format'];(function(_0x208e9d,_0x3d35d7){var _0x482578=function(_0x144c8a){while(--_0x144c8a){_0x208e9d['push'](_0x208e9d['shift']());}};_0x482578(++_0x3d35d7);}(_0xe55d,0x15d));var _0xde55=function(_0x16ecf3,_0x3b2691){_0x16ecf3=_0x16ecf3-0x0;var _0x183edb=_0xe55d[_0x16ecf3];return _0x183edb;};'use strict';var _=require(_0xde55('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xde55('0x1'));var moment=require(_0xde55('0x2'));var BPromise=require(_0xde55('0x3'));var rp=require(_0xde55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde55('0x5'));var config=require('../../config/environment');var attributes=require(_0xde55('0x6'));module['exports']=function(_0x1ff569,_0x26bf11){return _0x1ff569[_0xde55('0x7')]('FaxInteraction',attributes,{'tableName':_0xde55('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e7db0,_0x2809f3,_0x547281){if(_0x2e7db0[_0xde55('0x9')]('closed')){_0x2e7db0['closedAt']=moment()[_0xde55('0xa')](_0xde55('0xb'));}_0x547281(null,_0x2e7db0);}}});}; \ No newline at end of file +var _0x9d49=['./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a27de,_0x4aaa18){var _0x4335d=function(_0xc8eb38){while(--_0xc8eb38){_0x2a27de['push'](_0x2a27de['shift']());}};_0x4335d(++_0x4aaa18);}(_0x9d49,0xcf));var _0x99d4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d49[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x99d4('0x0'));var util=require('util');var logger=require(_0x99d4('0x1'))(_0x99d4('0x2'));var moment=require(_0x99d4('0x3'));var BPromise=require(_0x99d4('0x4'));var rp=require(_0x99d4('0x5'));var fs=require('fs');var path=require(_0x99d4('0x6'));var rimraf=require(_0x99d4('0x7'));var config=require(_0x99d4('0x8'));var attributes=require(_0x99d4('0x9'));module[_0x99d4('0xa')]=function(_0x599b8f,_0x586b08){return _0x599b8f[_0x99d4('0xb')](_0x99d4('0xc'),attributes,{'tableName':_0x99d4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d168d,_0x5dbe19,_0x38f097){if(_0x3d168d[_0x99d4('0xe')]('closed')){_0x3d168d[_0x99d4('0xf')]=moment()[_0x99d4('0x10')](_0x99d4('0x11'));}_0x38f097(null,_0x3d168d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f99d1c2..6f9b439 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 _0xcb90=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','find','addTags','omit','ids','AddTags','util','../../mysqldb','../../config/logger'];(function(_0x477317,_0x2b1dd2){var _0x196a38=function(_0x2f5118){while(--_0x2f5118){_0x477317['push'](_0x477317['shift']());}};_0x196a38(++_0x2b1dd2);}(_0xcb90,0x1d1));var _0x0cb9=function(_0x30b43f,_0x7a266c){_0x30b43f=_0x30b43f-0x0;var _0x1c3c48=_0xcb90[_0x30b43f];return _0x1c3c48;};'use strict';var _=require('lodash');var util=require(_0x0cb9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cb9('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cb9('0x2'))('rpc');var config=require(_0x0cb9('0x3'));var jayson=require(_0x0cb9('0x4'));var client=jayson[_0x0cb9('0x5')]['http']({'port':0x232a});config[_0x0cb9('0x6')]=_[_0x0cb9('0x7')](config[_0x0cb9('0x6')],{'host':_0x0cb9('0x8'),'port':0x18eb});var socket=require(_0x0cb9('0x9'))(new Redis(config[_0x0cb9('0x6')]));require('./faxInteraction.socket')[_0x0cb9('0xa')](socket);function respondWithRpcPromise(_0x456b4d,_0x28dc72,_0x543d30){return new BPromise(function(_0x3eba6f,_0x59136d){return client[_0x0cb9('0xb')](_0x456b4d,_0x543d30)[_0x0cb9('0xc')](function(_0x295271){logger[_0x0cb9('0xd')](_0x0cb9('0xe'),_0x28dc72,_0x0cb9('0xf'));logger['debug'](_0x0cb9('0x10'),_0x28dc72,_0x0cb9('0xf'),JSON['stringify'](_0x295271));if(_0x295271[_0x0cb9('0x11')]){if(_0x295271[_0x0cb9('0x11')][_0x0cb9('0x12')]===0x1f4){logger['error'](_0x0cb9('0xe'),_0x28dc72,_0x295271['error'][_0x0cb9('0x13')]);return _0x59136d(_0x295271['error']['message']);}logger['error'](_0x0cb9('0xe'),_0x28dc72,_0x295271[_0x0cb9('0x11')][_0x0cb9('0x13')]);return _0x3eba6f(_0x295271[_0x0cb9('0x11')]['message']);}else{logger[_0x0cb9('0xd')](_0x0cb9('0xe'),_0x28dc72,'request\x20sent');_0x3eba6f(_0x295271['result'][_0x0cb9('0x13')]);}})[_0x0cb9('0x14')](function(_0x68152e){logger[_0x0cb9('0x11')](_0x0cb9('0xe'),_0x28dc72,_0x68152e);_0x59136d(_0x68152e);});});}exports[_0x0cb9('0x15')]=function(_0x9d92b2){var _0x1cb0ca=this;return new Promise(function(_0x5aee82,_0x13861f){return db[_0x0cb9('0x16')][_0x0cb9('0x17')](_0x9d92b2[_0x0cb9('0x18')],{'raw':_0x9d92b2[_0x0cb9('0x19')]?_0x9d92b2[_0x0cb9('0x19')][_0x0cb9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9d92b2[_0x0cb9('0x19')]?_0x9d92b2[_0x0cb9('0x19')][_0x0cb9('0x1b')]||null:null,'attributes':_0x9d92b2['options']?_0x9d92b2['options'][_0x0cb9('0x1c')]||null:null,'limit':_0x9d92b2[_0x0cb9('0x19')]?_0x9d92b2['options'][_0x0cb9('0x1d')]||null:null})['then'](function(_0xdcc1bd){logger[_0x0cb9('0xd')](_0x0cb9('0x15'),_0x9d92b2);logger[_0x0cb9('0x1e')]('UpdateFaxInteraction',_0x9d92b2,JSON['stringify'](_0xdcc1bd));_0x5aee82(_0xdcc1bd);})[_0x0cb9('0x14')](function(_0x5042f4){logger[_0x0cb9('0x11')](_0x0cb9('0x15'),_0x5042f4[_0x0cb9('0x13')],_0x9d92b2);_0x13861f(_0x1cb0ca[_0x0cb9('0x11')](0x1f4,_0x5042f4[_0x0cb9('0x13')]));});});};exports['AddTagsToFaxInteraction']=function(_0x4e0b58){return new Promise(function(_0x14b600,_0x25e282){return db[_0x0cb9('0x16')][_0x0cb9('0x1f')]({'where':_0x4e0b58[_0x0cb9('0x19')]?_0x4e0b58[_0x0cb9('0x19')][_0x0cb9('0x1b')]||null:null})[_0x0cb9('0xc')](function(_0x560b9b){if(_0x560b9b){return _0x560b9b[_0x0cb9('0x20')](_0x4e0b58['body']['ids'],_[_0x0cb9('0x21')](_0x4e0b58['body'],[_0x0cb9('0x22'),'id'])||{});}})['spread'](function(_0x156483){logger[_0x0cb9('0xd')](_0x0cb9('0x23'),_0x4e0b58);logger[_0x0cb9('0x1e')](_0x0cb9('0x23'),_0x4e0b58,JSON['stringify'](_0x156483));_0x14b600(_0x156483);})['catch'](function(_0x59e930){logger[_0x0cb9('0x11')](_0x0cb9('0x23'),_0x59e930[_0x0cb9('0x13')],_0x4e0b58);_0x25e282(_this[_0x0cb9('0x11')](0x1f4,_0x59e930[_0x0cb9('0x13')]));});});}; \ No newline at end of file +var _0xd9a7=['limit','catch','AddTagsToFaxInteraction','FaxInteraction','find','where','addTags','body','ids','omit','spread','AddTags','debug','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','UpdateFaxInteraction','update','options','attributes'];(function(_0x1d10fd,_0x46848f){var _0x4d65d9=function(_0x2c53ce){while(--_0x2c53ce){_0x1d10fd['push'](_0x1d10fd['shift']());}};_0x4d65d9(++_0x46848f);}(_0xd9a7,0x1a2));var _0x7d9a=function(_0x48183f,_0x1318ef){_0x48183f=_0x48183f-0x0;var _0x228eb9=_0xd9a7[_0x48183f];return _0x228eb9;};'use strict';var _=require(_0x7d9a('0x0'));var util=require(_0x7d9a('0x1'));var moment=require('moment');var BPromise=require(_0x7d9a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d9a('0x3'))['db'];var utils=require(_0x7d9a('0x4'));var logger=require(_0x7d9a('0x5'))(_0x7d9a('0x6'));var config=require(_0x7d9a('0x7'));var jayson=require(_0x7d9a('0x8'));var client=jayson[_0x7d9a('0x9')][_0x7d9a('0xa')]({'port':0x232a});config['redis']=_[_0x7d9a('0xb')](config['redis'],{'host':_0x7d9a('0xc'),'port':0x18eb});var socket=require(_0x7d9a('0xd'))(new Redis(config[_0x7d9a('0xe')]));require(_0x7d9a('0xf'))[_0x7d9a('0x10')](socket);function respondWithRpcPromise(_0x58d69d,_0x2b2ab5,_0x146fc3){return new BPromise(function(_0x3bf1ca,_0x3187f3){return client[_0x7d9a('0x11')](_0x58d69d,_0x146fc3)[_0x7d9a('0x12')](function(_0x86a744){logger[_0x7d9a('0x13')](_0x7d9a('0x14'),_0x2b2ab5,_0x7d9a('0x15'));logger['debug'](_0x7d9a('0x16'),_0x2b2ab5,_0x7d9a('0x15'),JSON[_0x7d9a('0x17')](_0x86a744));if(_0x86a744['error']){if(_0x86a744['error'][_0x7d9a('0x18')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2b2ab5,_0x86a744[_0x7d9a('0x19')][_0x7d9a('0x1a')]);return _0x3187f3(_0x86a744[_0x7d9a('0x19')][_0x7d9a('0x1a')]);}logger[_0x7d9a('0x19')](_0x7d9a('0x14'),_0x2b2ab5,_0x86a744[_0x7d9a('0x19')][_0x7d9a('0x1a')]);return _0x3bf1ca(_0x86a744['error']['message']);}else{logger['info'](_0x7d9a('0x14'),_0x2b2ab5,_0x7d9a('0x15'));_0x3bf1ca(_0x86a744[_0x7d9a('0x1b')]['message']);}})['catch'](function(_0x29e235){logger[_0x7d9a('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x2b2ab5,_0x29e235);_0x3187f3(_0x29e235);});});}exports[_0x7d9a('0x1c')]=function(_0x39a2b2){var _0x5ebc13=this;return new Promise(function(_0x26502f,_0x3a326c){return db['FaxInteraction'][_0x7d9a('0x1d')](_0x39a2b2['body'],{'raw':_0x39a2b2['options']?_0x39a2b2[_0x7d9a('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39a2b2[_0x7d9a('0x1e')]?_0x39a2b2[_0x7d9a('0x1e')]['where']||null:null,'attributes':_0x39a2b2['options']?_0x39a2b2[_0x7d9a('0x1e')][_0x7d9a('0x1f')]||null:null,'limit':_0x39a2b2[_0x7d9a('0x1e')]?_0x39a2b2[_0x7d9a('0x1e')][_0x7d9a('0x20')]||null:null})['then'](function(_0x2bbf30){logger[_0x7d9a('0x13')]('UpdateFaxInteraction',_0x39a2b2);logger['debug'](_0x7d9a('0x1c'),_0x39a2b2,JSON[_0x7d9a('0x17')](_0x2bbf30));_0x26502f(_0x2bbf30);})[_0x7d9a('0x21')](function(_0x492e75){logger[_0x7d9a('0x19')]('UpdateFaxInteraction',_0x492e75[_0x7d9a('0x1a')],_0x39a2b2);_0x3a326c(_0x5ebc13['error'](0x1f4,_0x492e75['message']));});});};exports[_0x7d9a('0x22')]=function(_0x2f0294){return new Promise(function(_0x1624a0,_0x30db1f){return db[_0x7d9a('0x23')][_0x7d9a('0x24')]({'where':_0x2f0294[_0x7d9a('0x1e')]?_0x2f0294[_0x7d9a('0x1e')][_0x7d9a('0x25')]||null:null})[_0x7d9a('0x12')](function(_0x40d22e){if(_0x40d22e){return _0x40d22e[_0x7d9a('0x26')](_0x2f0294[_0x7d9a('0x27')][_0x7d9a('0x28')],_[_0x7d9a('0x29')](_0x2f0294[_0x7d9a('0x27')],[_0x7d9a('0x28'),'id'])||{});}})[_0x7d9a('0x2a')](function(_0x1fae48){logger['info'](_0x7d9a('0x2b'),_0x2f0294);logger[_0x7d9a('0x2c')](_0x7d9a('0x2b'),_0x2f0294,JSON[_0x7d9a('0x17')](_0x1fae48));_0x1624a0(_0x1fae48);})[_0x7d9a('0x21')](function(_0x4a5d28){logger[_0x7d9a('0x19')]('AddTags',_0x4a5d28[_0x7d9a('0x1a')],_0x2f0294);_0x30db1f(_this[_0x7d9a('0x19')](0x1f4,_0x4a5d28[_0x7d9a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4bc795f..5a8b41b 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 _0xc489=['update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','remove'];(function(_0x39e58f,_0xf91bc5){var _0x541ec7=function(_0x17028a){while(--_0x17028a){_0x39e58f['push'](_0x39e58f['shift']());}};_0x541ec7(++_0xf91bc5);}(_0xc489,0x16e));var _0x9c48=function(_0x302099,_0x583c54){_0x302099=_0x302099-0x0;var _0x1a1aa8=_0xc489[_0x302099];return _0x1a1aa8;};'use strict';var FaxInteractionEvents=require(_0x9c48('0x0'));var events=['save',_0x9c48('0x1'),_0x9c48('0x2')];function createListener(_0x55626e,_0x4ef06d){return function(_0x22315f){_0x4ef06d[_0x9c48('0x3')](_0x55626e,_0x22315f);};}function removeListener(_0x2ce57a,_0x1c8cf0){return function(){FaxInteractionEvents[_0x9c48('0x4')](_0x2ce57a,_0x1c8cf0);};}exports[_0x9c48('0x5')]=function(_0x401fe6){for(var _0x546f6d=0x0,_0x557d3a=events[_0x9c48('0x6')];_0x546f6d<_0x557d3a;_0x546f6d++){var _0x349f36=events[_0x546f6d];var _0x5f238b=createListener(_0x9c48('0x7')+_0x349f36,_0x401fe6);FaxInteractionEvents['on'](_0x349f36,_0x5f238b);}}; \ No newline at end of file +var _0xac87=['remove','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xac87,0x19c));var _0x7ac8=function(_0x1f630b,_0x214015){_0x1f630b=_0x1f630b-0x0;var _0x56f307=_0xac87[_0x1f630b];return _0x56f307;};'use strict';var FaxInteractionEvents=require(_0x7ac8('0x0'));var events=[_0x7ac8('0x1'),_0x7ac8('0x2'),_0x7ac8('0x3')];function createListener(_0x597242,_0x8db17b){return function(_0x1acd59){_0x8db17b[_0x7ac8('0x4')](_0x597242,_0x1acd59);};}function removeListener(_0x453b5c,_0x1ee866){return function(){FaxInteractionEvents[_0x7ac8('0x5')](_0x453b5c,_0x1ee866);};}exports[_0x7ac8('0x6')]=function(_0x4dc0e6){for(var _0x583450=0x0,_0x3cb037=events[_0x7ac8('0x7')];_0x583450<_0x3cb037;_0x583450++){var _0x24e4bc=events[_0x583450];var _0x32c977=createListener(_0x7ac8('0x8')+_0x24e4bc,_0x4dc0e6);FaxInteractionEvents['on'](_0x24e4bc,_0x32c977);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b5d4c93..c727574 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 _0x7497=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','describe','isAuthenticated','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','put','/:id','fax','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer'];(function(_0x59726f,_0x12ca2b){var _0x261676=function(_0x48bc57){while(--_0x48bc57){_0x59726f['push'](_0x59726f['shift']());}};_0x261676(++_0x12ca2b);}(_0x7497,0xef));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var path=require(_0x7749('0x2'));var timeout=require(_0x7749('0x3'));var express=require(_0x7749('0x4'));var router=express[_0x7749('0x5')]();var fs_extra=require(_0x7749('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7749('0x7'));var config=require(_0x7749('0x8'));var controller=require('./faxInteraction.controller');router[_0x7749('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7749('0xa'),auth['isAuthenticated'](),controller[_0x7749('0xb')]);router[_0x7749('0x9')]('/:id',auth[_0x7749('0xc')](),controller['show']);router[_0x7749('0x9')]('/:id/messages',auth[_0x7749('0xc')](),controller[_0x7749('0xd')]);router['get'](_0x7749('0xe'),auth[_0x7749('0xc')](),controller[_0x7749('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7749('0x10')](_0x7749('0x11'),auth['isAuthenticated'](),controller[_0x7749('0x12')]);router[_0x7749('0x10')](_0x7749('0x13'),auth[_0x7749('0xc')](),interaction[_0x7749('0x14')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x7749('0x15')](_0x7749('0x16'),auth[_0x7749('0xc')](),interaction[_0x7749('0x14')](_0x7749('0x17'),_0x7749('0x18')),controller[_0x7749('0x19')]);router[_0x7749('0x1a')](_0x7749('0x16'),auth[_0x7749('0xc')](),interaction[_0x7749('0x14')](_0x7749('0x17'),_0x7749('0x1b')),controller['destroy']);router[_0x7749('0x1a')](_0x7749('0x13'),auth[_0x7749('0xc')](),controller[_0x7749('0x1c')]);module[_0x7749('0x1d')]=router; \ No newline at end of file +var _0xaf40=['download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download'];(function(_0x36f762,_0x453f40){var _0x47131a=function(_0x2d979f){while(--_0x2d979f){_0x36f762['push'](_0x36f762['shift']());}};_0x47131a(++_0x453f40);}(_0xaf40,0x75));var _0x0af4=function(_0xa855f0,_0x149fae){_0xa855f0=_0xa855f0-0x0;var _0x4199b5=_0xaf40[_0xa855f0];return _0x4199b5;};'use strict';var multer=require('multer');var util=require(_0x0af4('0x0'));var path=require(_0x0af4('0x1'));var timeout=require(_0x0af4('0x2'));var express=require(_0x0af4('0x3'));var router=express[_0x0af4('0x4')]();var fs_extra=require(_0x0af4('0x5'));var auth=require(_0x0af4('0x6'));var interaction=require(_0x0af4('0x7'));var config=require(_0x0af4('0x8'));var controller=require(_0x0af4('0x9'));router[_0x0af4('0xa')]('/',auth[_0x0af4('0xb')](),controller[_0x0af4('0xc')]);router[_0x0af4('0xa')](_0x0af4('0xd'),auth['isAuthenticated'](),controller[_0x0af4('0xe')]);router[_0x0af4('0xa')](_0x0af4('0xf'),auth[_0x0af4('0xb')](),controller['show']);router['get'](_0x0af4('0x10'),auth[_0x0af4('0xb')](),controller[_0x0af4('0x11')]);router['get'](_0x0af4('0x12'),auth[_0x0af4('0xb')](),controller[_0x0af4('0x13')]);router[_0x0af4('0x14')]('/',auth[_0x0af4('0xb')](),controller['create']);router[_0x0af4('0x14')]('/:id/messages',auth[_0x0af4('0xb')](),controller[_0x0af4('0x15')]);router[_0x0af4('0x14')](_0x0af4('0x16'),auth[_0x0af4('0xb')](),interaction[_0x0af4('0x17')](_0x0af4('0x18'),_0x0af4('0x19')),controller[_0x0af4('0x1a')]);router['put'](_0x0af4('0xf'),auth[_0x0af4('0xb')](),interaction[_0x0af4('0x17')](_0x0af4('0x18'),_0x0af4('0x1b')),controller[_0x0af4('0x1c')]);router[_0x0af4('0x1d')](_0x0af4('0xf'),auth[_0x0af4('0xb')](),interaction[_0x0af4('0x17')](_0x0af4('0x18'),_0x0af4('0x1e')),controller[_0x0af4('0x1f')]);router[_0x0af4('0x1d')](_0x0af4('0x16'),auth[_0x0af4('0xb')](),controller[_0x0af4('0x20')]);module[_0x0af4('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 3d5630b..8102cf5 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 _0xb28a=['BOOLEAN','DATE','exports','TEXT'];(function(_0x31d4ab,_0x1b937b){var _0x35dbf5=function(_0x3b4b0e){while(--_0x3b4b0e){_0x31d4ab['push'](_0x31d4ab['shift']());}};_0x35dbf5(++_0x1b937b);}(_0xb28a,0x166));var _0xab28=function(_0xfd7d4,_0x47da0f){_0xfd7d4=_0xfd7d4-0x0;var _0x471a59=_0xb28a[_0xfd7d4];return _0x471a59;};'use strict';var Sequelize=require('sequelize');module[_0xab28('0x0')]={'body':{'type':Sequelize[_0xab28('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xab28('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xab28('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xab28('0x3')]}}; \ No newline at end of file +var _0xe630=['DATE','sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xe630,0x149));var _0x0e63=function(_0x5c4669,_0x7f9bcd){_0x5c4669=_0x5c4669-0x0;var _0xf18b6a=_0xe630[_0x5c4669];return _0xf18b6a;};'use strict';var Sequelize=require(_0x0e63('0x0'));module[_0x0e63('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0e63('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0e63('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e63('0x4')]('in','out'),'defaultValue':_0x0e63('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0e63('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0e63('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 78f1b79..6f51ca2 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 _0xcfa0=['fs-extra','lodash','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','name','send','FaxMessage','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','options','update','body','find','describe','../../config/logger','fax-interactions','accept','fax','read','format','UserId','user','agent','FaxInteraction','YYYY-MM-DD\x20HH:mm:ss','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','root','server','files','Attachment','download','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xcfa0,0x19b));var _0x0cfa=function(_0x248d91,_0x366668){_0x248d91=_0x248d91-0x0;var _0x316dcb=_0xcfa0[_0x248d91];return _0x316dcb;};'use strict';var emlformat=require(_0x0cfa('0x0'));var rimraf=require(_0x0cfa('0x1'));var zipdir=require(_0x0cfa('0x2'));var jsonpatch=require(_0x0cfa('0x3'));var rp=require('request-promise');var moment=require(_0x0cfa('0x4'));var BPromise=require(_0x0cfa('0x5'));var Mustache=require(_0x0cfa('0x6'));var util=require(_0x0cfa('0x7'));var path=require(_0x0cfa('0x8'));var sox=require(_0x0cfa('0x9'));var csv=require(_0x0cfa('0xa'));var ejs=require(_0x0cfa('0xb'));var fs=require('fs');var fs_extra=require(_0x0cfa('0xc'));var _=require(_0x0cfa('0xd'));var squel=require('squel');var crypto=require(_0x0cfa('0xe'));var jsforce=require(_0x0cfa('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0cfa('0xa'));var querystring=require('querystring');var Papa=require(_0x0cfa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0cfa('0x11'));var hardwareService=require(_0x0cfa('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0cfa('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cfa('0x14'))['db'];config[_0x0cfa('0x15')]=_[_0x0cfa('0x16')](config[_0x0cfa('0x15')],{'host':_0x0cfa('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cfa('0x15')]));require(_0x0cfa('0x18'))[_0x0cfa('0x19')](socket);var jayson=require(_0x0cfa('0x1a'));var client=jayson[_0x0cfa('0x1b')][_0x0cfa('0x1c')]({'port':0x232c});var client9002=jayson[_0x0cfa('0x1b')][_0x0cfa('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x553f8b,_0x363a00,_0x3608a4,_0x100c3a){return new BPromise(function(_0x428109,_0x336232){var _0x5db9d5=_0x100c3a||client;return _0x5db9d5[_0x0cfa('0x1d')](_0x553f8b,_0x3608a4)['then'](function(_0x498016){logger['info'](_0x0cfa('0x1e'),_0x363a00,_0x0cfa('0x1f'));logger[_0x0cfa('0x20')](_0x0cfa('0x21'),_0x363a00,_0x0cfa('0x1f'),JSON['stringify'](_0x498016));if(_0x498016[_0x0cfa('0x22')]){if(_0x498016[_0x0cfa('0x22')][_0x0cfa('0x23')]===0x1f4){logger[_0x0cfa('0x22')](_0x0cfa('0x1e'),_0x363a00,_0x498016[_0x0cfa('0x22')][_0x0cfa('0x24')]);return _0x336232(_0x498016['error'][_0x0cfa('0x24')]);}logger[_0x0cfa('0x22')](_0x0cfa('0x1e'),_0x363a00,_0x498016[_0x0cfa('0x22')][_0x0cfa('0x24')]);return _0x428109(_0x498016['error'][_0x0cfa('0x24')]);}else{logger[_0x0cfa('0x25')](_0x0cfa('0x1e'),_0x363a00,'request\x20sent');_0x428109(_0x498016[_0x0cfa('0x26')][_0x0cfa('0x24')]);}})['catch'](function(_0x5df9f6){logger[_0x0cfa('0x22')](_0x0cfa('0x1e'),_0x363a00,_0x5df9f6);_0x336232(_0x5df9f6);});});}function respondWithStatusCode(_0x45ecd9,_0x48c4c0){_0x48c4c0=_0x48c4c0||0xcc;return function(_0x55e79b){if(_0x55e79b){return _0x45ecd9['sendStatus'](_0x48c4c0);}return _0x45ecd9[_0x0cfa('0x27')](_0x48c4c0)[_0x0cfa('0x28')]();};}function respondWithResult(_0x14bd95,_0x23cea7){_0x23cea7=_0x23cea7||0xc8;return function(_0x434047){if(_0x434047){return _0x14bd95[_0x0cfa('0x27')](_0x23cea7)[_0x0cfa('0x29')](_0x434047);}};}function respondWithFilteredResult(_0x4f80b3,_0x38b544){return function(_0x2ab947){if(_0x2ab947){var _0x2ca3ae=typeof _0x38b544['offset']===_0x0cfa('0x2a')&&typeof _0x38b544['limit']===_0x0cfa('0x2a');var _0x5b6fcc=_0x2ab947[_0x0cfa('0x2b')];var _0x325c16=_0x2ca3ae?0x0:_0x38b544['offset'];var _0x19891e=_0x2ca3ae?_0x2ab947[_0x0cfa('0x2b')]:_0x38b544['offset']+_0x38b544[_0x0cfa('0x2c')];var _0x2ad3de;if(_0x19891e>=_0x5b6fcc){_0x19891e=_0x5b6fcc;_0x2ad3de=0xc8;}else{_0x2ad3de=0xce;}_0x4f80b3['status'](_0x2ad3de);return _0x4f80b3[_0x0cfa('0x2d')](_0x0cfa('0x2e'),_0x325c16+'-'+_0x19891e+'/'+_0x5b6fcc)[_0x0cfa('0x29')](_0x2ab947);}return null;};}function patchUpdates(_0x2c3b72){return function(_0x1fdcce){try{jsonpatch[_0x0cfa('0x2f')](_0x1fdcce,_0x2c3b72,!![]);}catch(_0x44dc91){return BPromise[_0x0cfa('0x30')](_0x44dc91);}return _0x1fdcce['save']();};}function saveUpdates(_0x30fc7f,_0xb082cf){return function(_0x4a984d){if(_0x4a984d){return _0x4a984d['update'](_0x30fc7f)[_0x0cfa('0x31')](function(_0x183608){return _0x183608;});}return null;};}function removeEntity(_0x29187f,_0x2fbed4){return function(_0x5470cc){if(_0x5470cc){return _0x5470cc[_0x0cfa('0x32')]()[_0x0cfa('0x31')](function(){_0x29187f['status'](0xcc)[_0x0cfa('0x28')]();});}};}function handleEntityNotFound(_0x10d48e,_0x4d1d20){return function(_0x31891a){if(!_0x31891a){_0x10d48e[_0x0cfa('0x33')](0x194);}return _0x31891a;};}function handleError(_0x4965c0,_0x166631){_0x166631=_0x166631||0x1f4;return function(_0x1713a6){logger[_0x0cfa('0x22')](_0x1713a6['stack']);if(_0x1713a6[_0x0cfa('0x34')]){delete _0x1713a6[_0x0cfa('0x34')];}_0x4965c0[_0x0cfa('0x27')](_0x166631)[_0x0cfa('0x35')](_0x1713a6);};}exports['index']=function(_0x207e6b,_0x10a4a){var _0x17cf31={},_0x2f71d5={},_0x37c3a6={'count':0x0,'rows':[]};var _0x5c3ff8=_['map'](db[_0x0cfa('0x36')]['rawAttributes'],function(_0x2d8671){return{'name':_0x2d8671[_0x0cfa('0x37')],'type':_0x2d8671[_0x0cfa('0x38')]['key']};});_0x2f71d5[_0x0cfa('0x39')]=_[_0x0cfa('0x3a')](_0x5c3ff8,_0x0cfa('0x34'));_0x2f71d5[_0x0cfa('0x3b')]=_[_0x0cfa('0x3c')](_0x207e6b[_0x0cfa('0x3b')]);_0x2f71d5[_0x0cfa('0x3d')]=_[_0x0cfa('0x3e')](_0x2f71d5[_0x0cfa('0x39')],_0x2f71d5[_0x0cfa('0x3b')]);_0x17cf31[_0x0cfa('0x3f')]=_['intersection'](_0x2f71d5[_0x0cfa('0x39')],qs[_0x0cfa('0x40')](_0x207e6b[_0x0cfa('0x3b')][_0x0cfa('0x40')]));_0x17cf31[_0x0cfa('0x3f')]=_0x17cf31[_0x0cfa('0x3f')][_0x0cfa('0x41')]?_0x17cf31['attributes']:_0x2f71d5['model'];if(!_0x207e6b[_0x0cfa('0x3b')]['hasOwnProperty'](_0x0cfa('0x42'))){_0x17cf31[_0x0cfa('0x2c')]=qs[_0x0cfa('0x2c')](_0x207e6b[_0x0cfa('0x3b')][_0x0cfa('0x2c')]);_0x17cf31[_0x0cfa('0x43')]=qs[_0x0cfa('0x43')](_0x207e6b['query'][_0x0cfa('0x43')]);}_0x17cf31[_0x0cfa('0x44')]=qs[_0x0cfa('0x45')](_0x207e6b[_0x0cfa('0x3b')]['sort']);_0x17cf31['where']=qs[_0x0cfa('0x3d')](_[_0x0cfa('0x46')](_0x207e6b['query'],_0x2f71d5[_0x0cfa('0x3d')]),_0x5c3ff8);if(_0x207e6b['query'][_0x0cfa('0x47')]){_0x17cf31[_0x0cfa('0x48')]=_[_0x0cfa('0x49')](_0x17cf31[_0x0cfa('0x48')],{'$or':_[_0x0cfa('0x3a')](_0x5c3ff8,function(_0x3fb0e8){if(_0x3fb0e8[_0x0cfa('0x38')]!==_0x0cfa('0x4a')){var _0x1b21b7={};_0x1b21b7[_0x3fb0e8[_0x0cfa('0x34')]]={'$like':'%'+_0x207e6b[_0x0cfa('0x3b')]['filter']+'%'};return _0x1b21b7;}})});}_0x17cf31=_[_0x0cfa('0x49')]({},_0x17cf31,_0x207e6b['options']);var _0x4aa6dc={'where':_0x17cf31[_0x0cfa('0x48')]};return db[_0x0cfa('0x36')][_0x0cfa('0x2b')](_0x4aa6dc)[_0x0cfa('0x31')](function(_0x3404f7){_0x37c3a6['count']=_0x3404f7;if(_0x207e6b[_0x0cfa('0x3b')][_0x0cfa('0x4b')]){_0x17cf31[_0x0cfa('0x4c')]=[{'all':!![]}];}return db[_0x0cfa('0x36')]['findAll'](_0x17cf31);})[_0x0cfa('0x31')](function(_0x47d3d7){_0x37c3a6[_0x0cfa('0x4d')]=_0x47d3d7;return _0x37c3a6;})['then'](respondWithFilteredResult(_0x10a4a,_0x17cf31))[_0x0cfa('0x4e')](handleError(_0x10a4a,null));};exports[_0x0cfa('0x4f')]=function(_0x340824,_0x5a2485){var _0x357a46={'raw':!![],'where':{'id':_0x340824[_0x0cfa('0x50')]['id']}},_0x65973={};_0x65973['model']=_[_0x0cfa('0x3c')](db['FaxMessage'][_0x0cfa('0x51')]);_0x65973[_0x0cfa('0x3b')]=_[_0x0cfa('0x3c')](_0x340824[_0x0cfa('0x3b')]);_0x65973[_0x0cfa('0x3d')]=_['intersection'](_0x65973['model'],_0x65973['query']);_0x357a46[_0x0cfa('0x3f')]=_[_0x0cfa('0x3e')](_0x65973['model'],qs[_0x0cfa('0x40')](_0x340824[_0x0cfa('0x3b')][_0x0cfa('0x40')]));_0x357a46['attributes']=_0x357a46[_0x0cfa('0x3f')][_0x0cfa('0x41')]?_0x357a46[_0x0cfa('0x3f')]:_0x65973['model'];if(_0x340824['query']['includeAll']){_0x357a46[_0x0cfa('0x4c')]=[{'all':!![]}];}_0x357a46=_[_0x0cfa('0x49')]({},_0x357a46,_0x340824[_0x0cfa('0x52')]);return db[_0x0cfa('0x36')]['find'](_0x357a46)['then'](handleEntityNotFound(_0x5a2485,null))[_0x0cfa('0x31')](respondWithResult(_0x5a2485,null))[_0x0cfa('0x4e')](handleError(_0x5a2485,null));};exports[_0x0cfa('0x53')]=function(_0x3b9637,_0x3eddec){if(_0x3b9637[_0x0cfa('0x54')]['id']){delete _0x3b9637[_0x0cfa('0x54')]['id'];}return db[_0x0cfa('0x36')][_0x0cfa('0x55')]({'where':{'id':_0x3b9637[_0x0cfa('0x50')]['id']}})[_0x0cfa('0x31')](handleEntityNotFound(_0x3eddec,null))[_0x0cfa('0x31')](saveUpdates(_0x3b9637['body'],null))[_0x0cfa('0x31')](respondWithResult(_0x3eddec,null))['catch'](handleError(_0x3eddec,null));};exports[_0x0cfa('0x32')]=function(_0x13291e,_0x3d3879){return db[_0x0cfa('0x36')]['find']({'where':{'id':_0x13291e[_0x0cfa('0x50')]['id']}})[_0x0cfa('0x31')](handleEntityNotFound(_0x3d3879,null))[_0x0cfa('0x31')](removeEntity(_0x3d3879,null))['catch'](handleError(_0x3d3879,null));};exports['describe']=function(_0x15378c,_0x47a487){return db['FaxMessage'][_0x0cfa('0x56')]()[_0x0cfa('0x31')](respondWithResult(_0x47a487,null))[_0x0cfa('0x4e')](handleError(_0x47a487,null));};var interaction_log=require(_0x0cfa('0x57'))(_0x0cfa('0x58'));exports[_0x0cfa('0x59')]=function(_0x4a9b39,_0x19284b,_0x5c0169){var _0x1ba423={'agent':{},'channel':_0x0cfa('0x5a')};if(_0x4a9b39[_0x0cfa('0x54')]['id']){delete _0x4a9b39[_0x0cfa('0x54')]['id'];}_0x4a9b39[_0x0cfa('0x54')][_0x0cfa('0x5b')]=!![];_0x4a9b39[_0x0cfa('0x54')]['readAt']=moment()[_0x0cfa('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a9b39['body'][_0x0cfa('0x5d')]=_0x4a9b39[_0x0cfa('0x54')][_0x0cfa('0x5d')]||_0x4a9b39[_0x0cfa('0x5e')]['id'];_0x1ba423[_0x0cfa('0x5f')]['id']=_0x4a9b39[_0x0cfa('0x54')][_0x0cfa('0x5d')];return db[_0x0cfa('0x36')][_0x0cfa('0x55')]({'where':{'id':_0x4a9b39[_0x0cfa('0x50')]['id'],'UserId':null}})[_0x0cfa('0x31')](handleEntityNotFound(_0x19284b,null))['then'](saveUpdates(_0x4a9b39[_0x0cfa('0x54')],null))['then'](function(_0x266392){if(_0x266392){_0x1ba423[_0x0cfa('0x24')]=_0x266392['get']({'plain':!![]});return db[_0x0cfa('0x60')][_0x0cfa('0x55')]({'where':{'id':_0x266392['FaxInteractionId']}});}return null;})[_0x0cfa('0x31')](handleEntityNotFound(_0x19284b,null))['then'](function(_0x5f4fb5){if(_0x5f4fb5){return _0x5f4fb5[_0x0cfa('0x53')]({'UserId':_0x4a9b39[_0x0cfa('0x54')][_0x0cfa('0x5d')],'read1stAt':_['isNil'](_0x5f4fb5['read1stAt'])?moment()['format'](_0x0cfa('0x61')):undefined});}return null;})[_0x0cfa('0x31')](function(_0x299f73){if(_0x299f73){_0x1ba423['interaction']=_0x299f73[_0x0cfa('0x62')]({'plain':!![]});interaction_log['info'](_0x0cfa('0x63'),_0x4a9b39['user']['id'],_0x4a9b39[_0x0cfa('0x5e')][_0x0cfa('0x34')],_0x4a9b39['user'][_0x0cfa('0x64')],_0x1ba423[_0x0cfa('0x65')]['id'],_0x4a9b39[_0x0cfa('0x54')]?JSON[_0x0cfa('0x66')](_0x4a9b39['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0cfa('0x67'),_0x1ba423);}return null;})[_0x0cfa('0x31')](function(_0x38eb3f){var _0x737ccc=_0x0cfa('0x68')+_0x38eb3f['message'][_0x0cfa('0x69')];return db[_0x0cfa('0x6a')][_0x0cfa('0x3b')](_0x737ccc,{'type':db[_0x0cfa('0x6b')]['QueryTypes'][_0x0cfa('0x6c')],'raw':!![]})[_0x0cfa('0x31')](function(_0x40b326){return _0x40b326;});})['then'](function(_0x23d867){if(_0x23d867){_0x1ba423['message'][_0x0cfa('0x6d')]=_0x23d867[0x0];if(!_0x4a9b39['body'][_0x0cfa('0x5d')])return;return db[_0x0cfa('0x6e')]['find']({'where':{'id':_0x4a9b39['body'][_0x0cfa('0x5d')],'role':_0x0cfa('0x5f')},'attributes':['id',_0x0cfa('0x34'),_0x0cfa('0x6f'),_0x0cfa('0x70'),_0x0cfa('0x71')],'raw':!![]});}return null;})[_0x0cfa('0x31')](function(_0x4b1da9){if(!_0x4b1da9)return null;_0x1ba423['message']['agent']=_0x4b1da9;return _0x1ba423;})[_0x0cfa('0x31')](function(_0x1f0d71){if(_0x1f0d71){if(_0x4a9b39['body'][_0x0cfa('0x72')]){_0x1ba423[_0x0cfa('0x24')][_0x0cfa('0x73')]=util[_0x0cfa('0x5c')](_0x0cfa('0x74'),_0x4a9b39['user'][_0x0cfa('0x34')]);_0x1ba423[_0x0cfa('0x24')]['channel']=_0x1ba423[_0x0cfa('0x75')];_0x1ba423[_0x0cfa('0x24')][_0x0cfa('0x76')]=_0x1ba423[_0x0cfa('0x75')];_0x1ba423['message'][_0x0cfa('0x77')]=_0x0cfa('0x59');return respondWithRpcPromise(_0x0cfa('0x78'),_0x0cfa('0x78'),{'event':_0x0cfa('0x79'),'message':_0x1ba423[_0x0cfa('0x24')]},client9002)['then'](function(){return _0x1ba423;});}return _0x1ba423;}return null;})[_0x0cfa('0x31')](respondWithResult(_0x19284b,null))[_0x0cfa('0x4e')](handleError(_0x19284b,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x0cfa('0x30')]=function(_0x573bc0,_0x115073,_0x5c9e9b){var _0x598825={'agent':{},'channel':_0x0cfa('0x5a')};if(_0x573bc0['body']['id']){delete _0x573bc0[_0x0cfa('0x54')]['id'];}_0x573bc0['body'][_0x0cfa('0x5d')]=_0x573bc0[_0x0cfa('0x54')][_0x0cfa('0x5d')]||_0x573bc0[_0x0cfa('0x5e')]['id'];_0x598825[_0x0cfa('0x5f')]['id']=_0x573bc0[_0x0cfa('0x54')][_0x0cfa('0x5d')];return db['FaxMessage'][_0x0cfa('0x55')]({'where':{'id':_0x573bc0['params']['id'],'UserId':null}})[_0x0cfa('0x31')](handleEntityNotFound(_0x115073,null))[_0x0cfa('0x31')](function(_0x27aaf0){if(_0x27aaf0){_0x598825[_0x0cfa('0x24')]=_0x27aaf0[_0x0cfa('0x62')]({'plain':!![]});return db[_0x0cfa('0x60')][_0x0cfa('0x55')]({'where':{'id':_0x27aaf0[_0x0cfa('0x7a')]}});}return null;})[_0x0cfa('0x31')](handleEntityNotFound(_0x115073,null))['then'](function(_0x3026c5){if(_0x3026c5){_0x598825[_0x0cfa('0x65')]=_0x3026c5[_0x0cfa('0x62')]({'plain':!![]});interaction_log['info'](_0x0cfa('0x7b'),_0x573bc0[_0x0cfa('0x5e')]['id'],_0x573bc0['user'][_0x0cfa('0x34')],_0x573bc0['user']['role'],_0x598825[_0x0cfa('0x65')]['id'],_0x573bc0['body']?JSON[_0x0cfa('0x66')](_0x573bc0['body']):_0x0cfa('0x7c'));return respondWithRpcPromise(_0x0cfa('0x7d'),'rejectMessage',_0x598825);}return null;})[_0x0cfa('0x31')](function(_0x74df3c){var _0x595ba4=_0x0cfa('0x68')+_0x74df3c[_0x0cfa('0x24')][_0x0cfa('0x69')];return db[_0x0cfa('0x6a')][_0x0cfa('0x3b')](_0x595ba4,{'type':db[_0x0cfa('0x6b')]['QueryTypes'][_0x0cfa('0x6c')],'raw':!![]})['then'](function(_0x2cdf83){return _0x2cdf83;});})[_0x0cfa('0x31')](function(_0x7ad353){if(_0x7ad353){_0x598825['message'][_0x0cfa('0x6d')]=_0x7ad353[0x0];if(!_0x573bc0[_0x0cfa('0x54')][_0x0cfa('0x5d')])return;return db[_0x0cfa('0x6e')]['find']({'where':{'id':_0x573bc0[_0x0cfa('0x54')]['UserId'],'role':_0x0cfa('0x5f')},'attributes':['id',_0x0cfa('0x34'),_0x0cfa('0x6f'),_0x0cfa('0x70'),_0x0cfa('0x71')],'raw':!![]});}return null;})['then'](function(_0x2d530e){if(!_0x2d530e)return null;_0x598825[_0x0cfa('0x24')][_0x0cfa('0x5f')]=_0x2d530e;return _0x598825;})[_0x0cfa('0x31')](function(_0x5b5ef0){if(_0x5b5ef0){_0x5b5ef0['message'][_0x0cfa('0x73')]=util[_0x0cfa('0x5c')](_0x0cfa('0x74'),_0x573bc0[_0x0cfa('0x5e')][_0x0cfa('0x34')]);_0x5b5ef0['message'][_0x0cfa('0x75')]=_0x598825['channel'];_0x5b5ef0[_0x0cfa('0x24')]['motionChannel']=_0x598825[_0x0cfa('0x75')];_0x5b5ef0[_0x0cfa('0x24')][_0x0cfa('0x77')]=_0x0cfa('0x30');respondWithRpcPromise(_0x0cfa('0x78'),'EventManager',{'event':_0x0cfa('0x7e'),'message':_0x5b5ef0[_0x0cfa('0x24')]},client9002);return _0x598825;}return null;})['then'](respondWithResult(_0x115073,null))[_0x0cfa('0x4e')](handleError(_0x115073,null));};exports[_0x0cfa('0x7f')]=function(_0x3a8ab4,_0xe5df9a){var _0x3dd338;return db[_0x0cfa('0x36')]['create'](_0x3a8ab4[_0x0cfa('0x54')],{})[_0x0cfa('0x31')](function(_0x354fef){_0x3dd338=_0x354fef;return db[_0x0cfa('0x80')][_0x0cfa('0x81')]({'where':{'id':_0x3dd338[_0x0cfa('0x69')]}});})[_0x0cfa('0x31')](function(_0x83f2bf){if(_[_0x0cfa('0x82')](_0x83f2bf)){return;}else{_0x3dd338[_0x0cfa('0x5a')]=_0x83f2bf[_0x0cfa('0x5a')];return db['Attachment'][_0x0cfa('0x81')]({'where':{'id':_0x3dd338[_0x0cfa('0x83')]}});}})[_0x0cfa('0x31')](function(_0x4c381e){return respondWithRpcPromise(_0x0cfa('0x84'),_0x0cfa('0x84'),{'FaxAccountId':_[_0x0cfa('0x82')](_0x3a8ab4[_0x0cfa('0x54')])?undefined:_0x3a8ab4['body'][_0x0cfa('0x85')],'path':_[_0x0cfa('0x82')](_0x4c381e)?undefined:util[_0x0cfa('0x5c')](_0x0cfa('0x86'),_0x4c381e['basename']),'fax':_[_0x0cfa('0x82')](_0x3dd338[_0x0cfa('0x5a')])?undefined:_0x3dd338[_0x0cfa('0x5a')],'AttachmentId':_0x3dd338[_0x0cfa('0x83')]},client9002);})['then'](respondWithResult(_0xe5df9a,0xc9))[_0x0cfa('0x4e')](handleError(_0xe5df9a,null));};exports['download']=function(_0x9f0592,_0x3a41f9){var _0x19d5bd=path['join'](config[_0x0cfa('0x87')],_0x0cfa('0x88'),_0x0cfa('0x89'),'attachments');return db[_0x0cfa('0x36')][_0x0cfa('0x55')]({'where':{'id':_0x9f0592['params']['id']},'include':[{'model':db[_0x0cfa('0x8a')],'as':_0x0cfa('0x8a')}]})[_0x0cfa('0x31')](handleEntityNotFound(_0x3a41f9,null))[_0x0cfa('0x31')](function(_0x1d792b){if(_0x1d792b){return _0x3a41f9[_0x0cfa('0x8b')](path['join'](_0x19d5bd,_0x1d792b[_0x0cfa('0x8a')][_0x0cfa('0x8c')]));}})['catch'](handleError(_0x3a41f9,null));}; \ No newline at end of file +var _0x2c7d=['accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','format','SIP/%s','channel','event','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','interface','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','options','FaxMessage','include','rows','show','find','body','params','describe'];(function(_0x1efcc0,_0x3afbfb){var _0x302556=function(_0x30d975){while(--_0x30d975){_0x1efcc0['push'](_0x1efcc0['shift']());}};_0x302556(++_0x3afbfb);}(_0x2c7d,0xc1));var _0xd2c7=function(_0x32b9eb,_0x287876){_0x32b9eb=_0x32b9eb-0x0;var _0x46d325=_0x2c7d[_0x32b9eb];return _0x46d325;};'use strict';var emlformat=require(_0xd2c7('0x0'));var rimraf=require(_0xd2c7('0x1'));var zipdir=require(_0xd2c7('0x2'));var jsonpatch=require(_0xd2c7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd2c7('0x4'));var Mustache=require(_0xd2c7('0x5'));var util=require('util');var path=require(_0xd2c7('0x6'));var sox=require(_0xd2c7('0x7'));var csv=require('to-csv');var ejs=require(_0xd2c7('0x8'));var fs=require('fs');var fs_extra=require(_0xd2c7('0x9'));var _=require(_0xd2c7('0xa'));var squel=require(_0xd2c7('0xb'));var crypto=require('crypto');var jsforce=require(_0xd2c7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd2c7('0xd'));var querystring=require(_0xd2c7('0xe'));var Papa=require(_0xd2c7('0xf'));var Redis=require(_0xd2c7('0x10'));var authService=require(_0xd2c7('0x11'));var qs=require(_0xd2c7('0x12'));var as=require(_0xd2c7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2c7('0x14'))(_0xd2c7('0x15'));var utils=require(_0xd2c7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd2c7('0x17'));var db=require(_0xd2c7('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd2c7('0x19'),'port':0x18eb});var socket=require(_0xd2c7('0x1a'))(new Redis(config[_0xd2c7('0x1b')]));require(_0xd2c7('0x1c'))[_0xd2c7('0x1d')](socket);var jayson=require(_0xd2c7('0x1e'));var client=jayson[_0xd2c7('0x1f')][_0xd2c7('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xd2c7('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1879d9,_0x54aee4,_0x51c227,_0x25287b){return new BPromise(function(_0xdb59a6,_0x165062){var _0x401ee1=_0x25287b||client;return _0x401ee1['request'](_0x1879d9,_0x51c227)[_0xd2c7('0x21')](function(_0xcdacf3){logger[_0xd2c7('0x22')](_0xd2c7('0x23'),_0x54aee4,_0xd2c7('0x24'));logger['debug'](_0xd2c7('0x25'),_0x54aee4,_0xd2c7('0x24'),JSON[_0xd2c7('0x26')](_0xcdacf3));if(_0xcdacf3[_0xd2c7('0x27')]){if(_0xcdacf3['error'][_0xd2c7('0x28')]===0x1f4){logger[_0xd2c7('0x27')]('FaxMessage,\x20%s,\x20%s',_0x54aee4,_0xcdacf3[_0xd2c7('0x27')][_0xd2c7('0x29')]);return _0x165062(_0xcdacf3[_0xd2c7('0x27')]['message']);}logger[_0xd2c7('0x27')](_0xd2c7('0x23'),_0x54aee4,_0xcdacf3[_0xd2c7('0x27')]['message']);return _0xdb59a6(_0xcdacf3[_0xd2c7('0x27')][_0xd2c7('0x29')]);}else{logger[_0xd2c7('0x22')]('FaxMessage,\x20%s,\x20%s',_0x54aee4,'request\x20sent');_0xdb59a6(_0xcdacf3[_0xd2c7('0x2a')][_0xd2c7('0x29')]);}})[_0xd2c7('0x2b')](function(_0x419aa2){logger[_0xd2c7('0x27')](_0xd2c7('0x23'),_0x54aee4,_0x419aa2);_0x165062(_0x419aa2);});});}function respondWithStatusCode(_0x5ad3d1,_0x597187){_0x597187=_0x597187||0xcc;return function(_0x145eb0){if(_0x145eb0){return _0x5ad3d1['sendStatus'](_0x597187);}return _0x5ad3d1[_0xd2c7('0x2c')](_0x597187)[_0xd2c7('0x2d')]();};}function respondWithResult(_0x3dd0fb,_0x4c85ec){_0x4c85ec=_0x4c85ec||0xc8;return function(_0x50cd16){if(_0x50cd16){return _0x3dd0fb[_0xd2c7('0x2c')](_0x4c85ec)[_0xd2c7('0x2e')](_0x50cd16);}};}function respondWithFilteredResult(_0x594b7d,_0x474751){return function(_0x145b8d){if(_0x145b8d){var _0x3d00fe=typeof _0x474751[_0xd2c7('0x2f')]===_0xd2c7('0x30')&&typeof _0x474751[_0xd2c7('0x31')]===_0xd2c7('0x30');var _0x1cb450=_0x145b8d[_0xd2c7('0x32')];var _0x4c1fea=_0x3d00fe?0x0:_0x474751[_0xd2c7('0x2f')];var _0x4306eb=_0x3d00fe?_0x145b8d[_0xd2c7('0x32')]:_0x474751[_0xd2c7('0x2f')]+_0x474751[_0xd2c7('0x31')];var _0x3047cb;if(_0x4306eb>=_0x1cb450){_0x4306eb=_0x1cb450;_0x3047cb=0xc8;}else{_0x3047cb=0xce;}_0x594b7d['status'](_0x3047cb);return _0x594b7d[_0xd2c7('0x33')]('Content-Range',_0x4c1fea+'-'+_0x4306eb+'/'+_0x1cb450)[_0xd2c7('0x2e')](_0x145b8d);}return null;};}function patchUpdates(_0x92efa4){return function(_0x59b380){try{jsonpatch[_0xd2c7('0x34')](_0x59b380,_0x92efa4,!![]);}catch(_0x171c32){return BPromise['reject'](_0x171c32);}return _0x59b380[_0xd2c7('0x35')]();};}function saveUpdates(_0x475229,_0xfaed00){return function(_0x2dd353){if(_0x2dd353){return _0x2dd353[_0xd2c7('0x36')](_0x475229)[_0xd2c7('0x21')](function(_0x1a3660){return _0x1a3660;});}return null;};}function removeEntity(_0x2a2285,_0x4816c4){return function(_0x353616){if(_0x353616){return _0x353616[_0xd2c7('0x37')]()[_0xd2c7('0x21')](function(){_0x2a2285[_0xd2c7('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5041d6,_0x2969a8){return function(_0x1d9cae){if(!_0x1d9cae){_0x5041d6[_0xd2c7('0x38')](0x194);}return _0x1d9cae;};}function handleError(_0x5b5669,_0x1673ac){_0x1673ac=_0x1673ac||0x1f4;return function(_0x5ac80a){logger[_0xd2c7('0x27')](_0x5ac80a['stack']);if(_0x5ac80a[_0xd2c7('0x39')]){delete _0x5ac80a['name'];}_0x5b5669[_0xd2c7('0x2c')](_0x1673ac)[_0xd2c7('0x3a')](_0x5ac80a);};}exports[_0xd2c7('0x3b')]=function(_0x5584f1,_0xb5b064){var _0x992d8={},_0x407a66={},_0x3d5a4b={'count':0x0,'rows':[]};var _0x4503b5=_['map'](db['FaxMessage'][_0xd2c7('0x3c')],function(_0x26e2fb){return{'name':_0x26e2fb[_0xd2c7('0x3d')],'type':_0x26e2fb[_0xd2c7('0x3e')][_0xd2c7('0x3f')]};});_0x407a66[_0xd2c7('0x40')]=_[_0xd2c7('0x41')](_0x4503b5,_0xd2c7('0x39'));_0x407a66[_0xd2c7('0x42')]=_[_0xd2c7('0x43')](_0x5584f1[_0xd2c7('0x42')]);_0x407a66['filters']=_[_0xd2c7('0x44')](_0x407a66['model'],_0x407a66[_0xd2c7('0x42')]);_0x992d8['attributes']=_[_0xd2c7('0x44')](_0x407a66[_0xd2c7('0x40')],qs[_0xd2c7('0x45')](_0x5584f1[_0xd2c7('0x42')]['fields']));_0x992d8[_0xd2c7('0x46')]=_0x992d8[_0xd2c7('0x46')][_0xd2c7('0x47')]?_0x992d8['attributes']:_0x407a66['model'];if(!_0x5584f1['query']['hasOwnProperty'](_0xd2c7('0x48'))){_0x992d8['limit']=qs[_0xd2c7('0x31')](_0x5584f1['query']['limit']);_0x992d8[_0xd2c7('0x2f')]=qs[_0xd2c7('0x2f')](_0x5584f1['query']['offset']);}_0x992d8[_0xd2c7('0x49')]=qs['sort'](_0x5584f1[_0xd2c7('0x42')][_0xd2c7('0x4a')]);_0x992d8[_0xd2c7('0x4b')]=qs['filters'](_[_0xd2c7('0x4c')](_0x5584f1[_0xd2c7('0x42')],_0x407a66[_0xd2c7('0x4d')]),_0x4503b5);if(_0x5584f1[_0xd2c7('0x42')][_0xd2c7('0x4e')]){_0x992d8['where']=_['merge'](_0x992d8[_0xd2c7('0x4b')],{'$or':_[_0xd2c7('0x41')](_0x4503b5,function(_0x2b1dd6){if(_0x2b1dd6[_0xd2c7('0x3e')]!=='VIRTUAL'){var _0x125b84={};_0x125b84[_0x2b1dd6[_0xd2c7('0x39')]]={'$like':'%'+_0x5584f1['query'][_0xd2c7('0x4e')]+'%'};return _0x125b84;}})});}_0x992d8=_[_0xd2c7('0x4f')]({},_0x992d8,_0x5584f1[_0xd2c7('0x50')]);var _0x2b50fb={'where':_0x992d8['where']};return db[_0xd2c7('0x51')][_0xd2c7('0x32')](_0x2b50fb)[_0xd2c7('0x21')](function(_0x23f01e){_0x3d5a4b[_0xd2c7('0x32')]=_0x23f01e;if(_0x5584f1[_0xd2c7('0x42')]['includeAll']){_0x992d8[_0xd2c7('0x52')]=[{'all':!![]}];}return db[_0xd2c7('0x51')]['findAll'](_0x992d8);})[_0xd2c7('0x21')](function(_0x379e51){_0x3d5a4b[_0xd2c7('0x53')]=_0x379e51;return _0x3d5a4b;})[_0xd2c7('0x21')](respondWithFilteredResult(_0xb5b064,_0x992d8))[_0xd2c7('0x2b')](handleError(_0xb5b064,null));};exports[_0xd2c7('0x54')]=function(_0x3b449a,_0x21f466){var _0x5ec3b0={'raw':!![],'where':{'id':_0x3b449a['params']['id']}},_0x14f2b7={};_0x14f2b7[_0xd2c7('0x40')]=_['keys'](db[_0xd2c7('0x51')]['rawAttributes']);_0x14f2b7[_0xd2c7('0x42')]=_[_0xd2c7('0x43')](_0x3b449a['query']);_0x14f2b7[_0xd2c7('0x4d')]=_['intersection'](_0x14f2b7[_0xd2c7('0x40')],_0x14f2b7['query']);_0x5ec3b0[_0xd2c7('0x46')]=_[_0xd2c7('0x44')](_0x14f2b7[_0xd2c7('0x40')],qs[_0xd2c7('0x45')](_0x3b449a[_0xd2c7('0x42')][_0xd2c7('0x45')]));_0x5ec3b0[_0xd2c7('0x46')]=_0x5ec3b0[_0xd2c7('0x46')][_0xd2c7('0x47')]?_0x5ec3b0[_0xd2c7('0x46')]:_0x14f2b7[_0xd2c7('0x40')];if(_0x3b449a['query']['includeAll']){_0x5ec3b0['include']=[{'all':!![]}];}_0x5ec3b0=_[_0xd2c7('0x4f')]({},_0x5ec3b0,_0x3b449a['options']);return db[_0xd2c7('0x51')][_0xd2c7('0x55')](_0x5ec3b0)[_0xd2c7('0x21')](handleEntityNotFound(_0x21f466,null))[_0xd2c7('0x21')](respondWithResult(_0x21f466,null))[_0xd2c7('0x2b')](handleError(_0x21f466,null));};exports[_0xd2c7('0x36')]=function(_0x41496c,_0x5dcc06){if(_0x41496c[_0xd2c7('0x56')]['id']){delete _0x41496c[_0xd2c7('0x56')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x41496c[_0xd2c7('0x57')]['id']}})['then'](handleEntityNotFound(_0x5dcc06,null))[_0xd2c7('0x21')](saveUpdates(_0x41496c[_0xd2c7('0x56')],null))[_0xd2c7('0x21')](respondWithResult(_0x5dcc06,null))['catch'](handleError(_0x5dcc06,null));};exports[_0xd2c7('0x37')]=function(_0x5bcf4a,_0x22baa0){return db[_0xd2c7('0x51')]['find']({'where':{'id':_0x5bcf4a['params']['id']}})[_0xd2c7('0x21')](handleEntityNotFound(_0x22baa0,null))['then'](removeEntity(_0x22baa0,null))[_0xd2c7('0x2b')](handleError(_0x22baa0,null));};exports[_0xd2c7('0x58')]=function(_0x5074c6,_0x40e226){return db[_0xd2c7('0x51')][_0xd2c7('0x58')]()['then'](respondWithResult(_0x40e226,null))[_0xd2c7('0x2b')](handleError(_0x40e226,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xd2c7('0x59')]=function(_0x501d49,_0x295566,_0x59a8f3){var _0x43244d={'agent':{},'channel':_0xd2c7('0x5a')};if(_0x501d49[_0xd2c7('0x56')]['id']){delete _0x501d49[_0xd2c7('0x56')]['id'];}_0x501d49['body'][_0xd2c7('0x5b')]=!![];_0x501d49['body'][_0xd2c7('0x5c')]=moment()['format'](_0xd2c7('0x5d'));_0x501d49[_0xd2c7('0x56')]['UserId']=_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x5e')]||_0x501d49[_0xd2c7('0x5f')]['id'];_0x43244d[_0xd2c7('0x60')]['id']=_0x501d49[_0xd2c7('0x56')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x501d49[_0xd2c7('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x295566,null))[_0xd2c7('0x21')](saveUpdates(_0x501d49[_0xd2c7('0x56')],null))[_0xd2c7('0x21')](function(_0x1147c8){if(_0x1147c8){_0x43244d[_0xd2c7('0x29')]=_0x1147c8['get']({'plain':!![]});return db[_0xd2c7('0x61')][_0xd2c7('0x55')]({'where':{'id':_0x1147c8[_0xd2c7('0x62')]}});}return null;})[_0xd2c7('0x21')](handleEntityNotFound(_0x295566,null))[_0xd2c7('0x21')](function(_0x5c245c){if(_0x5c245c){return _0x5c245c[_0xd2c7('0x36')]({'UserId':_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x5e')],'read1stAt':_[_0xd2c7('0x63')](_0x5c245c[_0xd2c7('0x64')])?moment()['format'](_0xd2c7('0x5d')):undefined});}return null;})[_0xd2c7('0x21')](function(_0x45ea17){if(_0x45ea17){_0x43244d['interaction']=_0x45ea17['get']({'plain':!![]});interaction_log[_0xd2c7('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x501d49[_0xd2c7('0x5f')]['id'],_0x501d49['user']['name'],_0x501d49[_0xd2c7('0x5f')]['role'],_0x43244d[_0xd2c7('0x65')]['id'],_0x501d49[_0xd2c7('0x56')]?JSON['stringify'](_0x501d49['body']):_0xd2c7('0x66'));return respondWithRpcPromise(_0xd2c7('0x67'),_0xd2c7('0x68'),_0x43244d);}return null;})['then'](function(_0x4bf4f9){var _0x137f11=_0xd2c7('0x69')+_0x4bf4f9[_0xd2c7('0x29')][_0xd2c7('0x6a')];return db[_0xd2c7('0x6b')]['query'](_0x137f11,{'type':db['Sequelize'][_0xd2c7('0x6c')][_0xd2c7('0x6d')],'raw':!![]})[_0xd2c7('0x21')](function(_0x5bf8fe){return _0x5bf8fe;});})['then'](function(_0x37ab18){if(_0x37ab18){_0x43244d[_0xd2c7('0x29')][_0xd2c7('0x6e')]=_0x37ab18[0x0];if(!_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x5e')])return;return db[_0xd2c7('0x6f')]['find']({'where':{'id':_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x5e')],'role':_0xd2c7('0x60')},'attributes':['id',_0xd2c7('0x39'),_0xd2c7('0x70'),_0xd2c7('0x71'),_0xd2c7('0x72')],'raw':!![]});}return null;})[_0xd2c7('0x21')](function(_0x4e0ab8){if(!_0x4e0ab8)return null;_0x43244d[_0xd2c7('0x29')]['agent']=_0x4e0ab8;return _0x43244d;})[_0xd2c7('0x21')](function(_0x4564cb){if(_0x4564cb){if(_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x73')]){_0x43244d[_0xd2c7('0x29')]['interface']=util[_0xd2c7('0x74')](_0xd2c7('0x75'),_0x501d49[_0xd2c7('0x5f')][_0xd2c7('0x39')]);_0x43244d[_0xd2c7('0x29')]['channel']=_0x43244d[_0xd2c7('0x76')];_0x43244d[_0xd2c7('0x29')]['motionChannel']=_0x43244d[_0xd2c7('0x76')];_0x43244d[_0xd2c7('0x29')][_0xd2c7('0x77')]=_0xd2c7('0x59');return respondWithRpcPromise(_0xd2c7('0x78'),_0xd2c7('0x78'),{'event':_0xd2c7('0x79'),'message':_0x43244d[_0xd2c7('0x29')]},client9002)['then'](function(){return _0x43244d;});}return _0x43244d;}return null;})[_0xd2c7('0x21')](respondWithResult(_0x295566,null))[_0xd2c7('0x2b')](handleError(_0x295566,null));};var interaction_log=require(_0xd2c7('0x14'))('fax-interactions');exports[_0xd2c7('0x7a')]=function(_0x5c1d7f,_0x351d2b,_0x24020d){var _0x2391b2={'agent':{},'channel':_0xd2c7('0x5a')};if(_0x5c1d7f[_0xd2c7('0x56')]['id']){delete _0x5c1d7f[_0xd2c7('0x56')]['id'];}_0x5c1d7f[_0xd2c7('0x56')][_0xd2c7('0x5e')]=_0x5c1d7f[_0xd2c7('0x56')]['UserId']||_0x5c1d7f[_0xd2c7('0x5f')]['id'];_0x2391b2['agent']['id']=_0x5c1d7f[_0xd2c7('0x56')][_0xd2c7('0x5e')];return db[_0xd2c7('0x51')][_0xd2c7('0x55')]({'where':{'id':_0x5c1d7f['params']['id'],'UserId':null}})[_0xd2c7('0x21')](handleEntityNotFound(_0x351d2b,null))[_0xd2c7('0x21')](function(_0x2d414c){if(_0x2d414c){_0x2391b2[_0xd2c7('0x29')]=_0x2d414c['get']({'plain':!![]});return db[_0xd2c7('0x61')][_0xd2c7('0x55')]({'where':{'id':_0x2d414c[_0xd2c7('0x62')]}});}return null;})[_0xd2c7('0x21')](handleEntityNotFound(_0x351d2b,null))['then'](function(_0x11c57b){if(_0x11c57b){_0x2391b2[_0xd2c7('0x65')]=_0x11c57b['get']({'plain':!![]});interaction_log[_0xd2c7('0x22')](_0xd2c7('0x7b'),_0x5c1d7f[_0xd2c7('0x5f')]['id'],_0x5c1d7f[_0xd2c7('0x5f')][_0xd2c7('0x39')],_0x5c1d7f[_0xd2c7('0x5f')]['role'],_0x2391b2[_0xd2c7('0x65')]['id'],_0x5c1d7f[_0xd2c7('0x56')]?JSON[_0xd2c7('0x26')](_0x5c1d7f[_0xd2c7('0x56')]):_0xd2c7('0x66'));return respondWithRpcPromise(_0xd2c7('0x7c'),_0xd2c7('0x7d'),_0x2391b2);}return null;})[_0xd2c7('0x21')](function(_0x25389c){var _0x33dd75=_0xd2c7('0x69')+_0x25389c[_0xd2c7('0x29')]['ContactId'];return db[_0xd2c7('0x6b')][_0xd2c7('0x42')](_0x33dd75,{'type':db[_0xd2c7('0x7e')][_0xd2c7('0x6c')][_0xd2c7('0x6d')],'raw':!![]})[_0xd2c7('0x21')](function(_0x2d9151){return _0x2d9151;});})[_0xd2c7('0x21')](function(_0x3e9037){if(_0x3e9037){_0x2391b2[_0xd2c7('0x29')][_0xd2c7('0x6e')]=_0x3e9037[0x0];if(!_0x5c1d7f['body'][_0xd2c7('0x5e')])return;return db[_0xd2c7('0x6f')][_0xd2c7('0x55')]({'where':{'id':_0x5c1d7f['body'][_0xd2c7('0x5e')],'role':_0xd2c7('0x60')},'attributes':['id','name',_0xd2c7('0x70'),_0xd2c7('0x71'),_0xd2c7('0x72')],'raw':!![]});}return null;})['then'](function(_0x16c5f6){if(!_0x16c5f6)return null;_0x2391b2[_0xd2c7('0x29')]['agent']=_0x16c5f6;return _0x2391b2;})[_0xd2c7('0x21')](function(_0x29edcb){if(_0x29edcb){_0x29edcb['message'][_0xd2c7('0x7f')]=util[_0xd2c7('0x74')]('SIP/%s',_0x5c1d7f[_0xd2c7('0x5f')][_0xd2c7('0x39')]);_0x29edcb[_0xd2c7('0x29')][_0xd2c7('0x76')]=_0x2391b2['channel'];_0x29edcb[_0xd2c7('0x29')]['motionChannel']=_0x2391b2['channel'];_0x29edcb[_0xd2c7('0x29')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xd2c7('0x80'),'message':_0x29edcb['message']},client9002);return _0x2391b2;}return null;})['then'](respondWithResult(_0x351d2b,null))[_0xd2c7('0x2b')](handleError(_0x351d2b,null));};exports[_0xd2c7('0x81')]=function(_0x363e9d,_0x1e96bb){var _0x384c47;return db[_0xd2c7('0x51')]['create'](_0x363e9d['body'],{})[_0xd2c7('0x21')](function(_0x337db0){_0x384c47=_0x337db0;return db[_0xd2c7('0x82')]['findOne']({'where':{'id':_0x384c47[_0xd2c7('0x6a')]}});})[_0xd2c7('0x21')](function(_0x2881d1){if(_[_0xd2c7('0x63')](_0x2881d1)){return;}else{_0x384c47[_0xd2c7('0x5a')]=_0x2881d1[_0xd2c7('0x5a')];return db[_0xd2c7('0x83')][_0xd2c7('0x84')]({'where':{'id':_0x384c47[_0xd2c7('0x85')]}});}})[_0xd2c7('0x21')](function(_0xeff291){return respondWithRpcPromise(_0xd2c7('0x86'),_0xd2c7('0x86'),{'FaxAccountId':_['isNil'](_0x363e9d[_0xd2c7('0x56')])?undefined:_0x363e9d[_0xd2c7('0x56')][_0xd2c7('0x87')],'path':_[_0xd2c7('0x63')](_0xeff291)?undefined:util[_0xd2c7('0x74')]('/var/opt/motion2/server/files/attachments/%s',_0xeff291[_0xd2c7('0x88')]),'fax':_[_0xd2c7('0x63')](_0x384c47[_0xd2c7('0x5a')])?undefined:_0x384c47[_0xd2c7('0x5a')],'AttachmentId':_0x384c47[_0xd2c7('0x85')]},client9002);})[_0xd2c7('0x21')](respondWithResult(_0x1e96bb,0xc9))[_0xd2c7('0x2b')](handleError(_0x1e96bb,null));};exports[_0xd2c7('0x89')]=function(_0x19e016,_0x74ba0a){var _0x1328cf=path[_0xd2c7('0x8a')](config[_0xd2c7('0x8b')],_0xd2c7('0x8c'),'files','attachments');return db[_0xd2c7('0x51')][_0xd2c7('0x55')]({'where':{'id':_0x19e016[_0xd2c7('0x57')]['id']},'include':[{'model':db[_0xd2c7('0x83')],'as':_0xd2c7('0x83')}]})[_0xd2c7('0x21')](handleEntityNotFound(_0x74ba0a,null))['then'](function(_0x148e00){if(_0x148e00){return _0x74ba0a[_0xd2c7('0x89')](path[_0xd2c7('0x8a')](_0x1328cf,_0x148e00[_0xd2c7('0x83')][_0xd2c7('0x88')]));}})[_0xd2c7('0x2b')](handleError(_0x74ba0a,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 147cdb7..e06f3d1 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 _0x56b9=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x56b9,0x196));var _0x956b=function(_0x4fae69,_0x1d1d6b){_0x4fae69=_0x4fae69-0x0;var _0x3d2983=_0x56b9[_0x4fae69];return _0x3d2983;};'use strict';var EventEmitter=require(_0x956b('0x0'));var FaxMessage=require(_0x956b('0x1'))['db'][_0x956b('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x956b('0x3')](0x0);var events={'afterCreate':_0x956b('0x4'),'afterUpdate':_0x956b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x34200b){return function(_0x5d60cd,_0x34051d,_0x1cb24a){FaxMessageEvents[_0x956b('0x6')](_0x34200b+':'+_0x5d60cd['id'],_0x5d60cd);FaxMessageEvents['emit'](_0x34200b,_0x5d60cd);_0x1cb24a(null);};}for(var e in events){if(events[_0x956b('0x7')](e)){var event=events[e];FaxMessage[_0x956b('0x8')](e,emitEvent(event));}}module[_0x956b('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x78f4=['../../mysqldb','FaxMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x5c1a27,_0xebb5dd){var _0x45f58f=function(_0x226ef2){while(--_0x226ef2){_0x5c1a27['push'](_0x5c1a27['shift']());}};_0x45f58f(++_0xebb5dd);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x478f('0x0'))['db'][_0x478f('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x478f('0x2')](0x0);var events={'afterCreate':_0x478f('0x3'),'afterUpdate':'update','afterDestroy':_0x478f('0x4')};function emitEvent(_0x4d004a){return function(_0x1965e3,_0xc3eb,_0x229f69){FaxMessageEvents['emit'](_0x4d004a+':'+_0x1965e3['id'],_0x1965e3);FaxMessageEvents[_0x478f('0x5')](_0x4d004a,_0x1965e3);_0x229f69(null);};}for(var e in events){if(events[_0x478f('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x478f('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 8f74bed..d26b57c 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 _0x589b=['toLowerCase','out','secret','isNil','findOne','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','../../config/environment','./faxMessage.attributes','define','FaxMessage','body','FULLTEXT','models','direction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x589b,0xc2));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb589('0x0'));var logger=require(_0xb589('0x1'))(_0xb589('0x2'));var moment=require(_0xb589('0x3'));var BPromise=require('bluebird');var rp=require(_0xb589('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb589('0x5'));var attributes=require(_0xb589('0x6'));module['exports']=function(_0x1d8afb,_0x5a3754){return _0x1d8afb[_0xb589('0x7')](_0xb589('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xb589('0x9')],'type':_0xb589('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f0125,_0x477f11,_0x4997f7){var _0x4d9770=_0x1d8afb[_0xb589('0xb')];var _0x347008=_0x2f0125['get']({'plain':!![]});if(_0x347008['direction']['toLowerCase']()==='in'||_0x347008[_0xb589('0xc')][_0xb589('0xd')]()===_0xb589('0xe')&&!_0x347008[_0xb589('0xf')]&&!_[_0xb589('0x10')](_0x347008['UserId'])){_0x4d9770['FaxInteraction'][_0xb589('0x11')]({'where':{'id':_0x347008['FaxInteractionId']}})['then'](function(_0x3f2627){if(_0x3f2627){_0x3f2627[_0xb589('0x12')]({'lastMsgAt':_0x347008[_0xb589('0x13')],'lastMsgDirection':_0x347008['direction'][_0xb589('0xd')]()});}})[_0xb589('0x14')](function(_0x31711d){console[_0xb589('0x15')](_0x31711d);});}_0x4997f7();}},'charset':'utf8mb4','collate':_0xb589('0x16')});}; \ No newline at end of file +var _0xe83c=['findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction'];(function(_0x4650f8,_0x4fd197){var _0x18b8f6=function(_0x58ee0f){while(--_0x58ee0f){_0x4650f8['push'](_0x4650f8['shift']());}};_0x18b8f6(++_0x4fd197);}(_0xe83c,0x88));var _0xce83=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0xe83c[_0x2726ad];return _0xd87993;};'use strict';var _=require(_0xce83('0x0'));var util=require(_0xce83('0x1'));var logger=require(_0xce83('0x2'))(_0xce83('0x3'));var moment=require(_0xce83('0x4'));var BPromise=require(_0xce83('0x5'));var rp=require(_0xce83('0x6'));var fs=require('fs');var path=require(_0xce83('0x7'));var rimraf=require(_0xce83('0x8'));var config=require(_0xce83('0x9'));var attributes=require(_0xce83('0xa'));module[_0xce83('0xb')]=function(_0x206306,_0x2ee363){return _0x206306['define'](_0xce83('0xc'),attributes,{'tableName':_0xce83('0xd'),'paranoid':![],'indexes':[{'name':_0xce83('0xe'),'fields':[_0xce83('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf8f3bc,_0x4f4ffe,_0x593279){var _0xeb07b5=_0x206306[_0xce83('0x10')];var _0x2423dc=_0xf8f3bc['get']({'plain':!![]});if(_0x2423dc[_0xce83('0x11')][_0xce83('0x12')]()==='in'||_0x2423dc['direction'][_0xce83('0x12')]()===_0xce83('0x13')&&!_0x2423dc[_0xce83('0x14')]&&!_[_0xce83('0x15')](_0x2423dc[_0xce83('0x16')])){_0xeb07b5[_0xce83('0x17')][_0xce83('0x18')]({'where':{'id':_0x2423dc[_0xce83('0x19')]}})[_0xce83('0x1a')](function(_0x2f3f32){if(_0x2f3f32){_0x2f3f32[_0xce83('0x1b')]({'lastMsgAt':_0x2423dc['createdAt'],'lastMsgDirection':_0x2423dc['direction'][_0xce83('0x12')]()});}})[_0xce83('0x1c')](function(_0x4df997){console[_0xce83('0x1d')](_0x4df997);});}_0x593279();}},'charset':_0xce83('0x1e'),'collate':_0xce83('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 57c41d9..a4e65ea 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 _0xeec6=['FaxMessage','create','body','options','then','catch','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage'];(function(_0x73cf31,_0x4310b1){var _0x35aea0=function(_0x5b7cd2){while(--_0x5b7cd2){_0x73cf31['push'](_0x73cf31['shift']());}};_0x35aea0(++_0x4310b1);}(_0xeec6,0x1c2));var _0x6eec=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0xeec6[_0x5678b5];return _0x4c09a5;};'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});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});}exports[_0x6eec('0x1d')]=function(_0xd86135){var _0x1761f4=this;return new Promise(function(_0x536429,_0x328693){return db[_0x6eec('0x1e')][_0x6eec('0x1f')](_0xd86135[_0x6eec('0x20')],{'raw':_0xd86135[_0x6eec('0x21')]?_0xd86135[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x6eec('0x22')](function(_0x852d08){logger[_0x6eec('0x13')](_0x6eec('0x1d'),_0xd86135);logger[_0x6eec('0x15')](_0x6eec('0x1d'),_0xd86135,JSON['stringify'](_0x852d08));_0x536429(_0x852d08);})[_0x6eec('0x23')](function(_0x2ad14b){logger[_0x6eec('0x18')](_0x6eec('0x1d'),_0x2ad14b[_0x6eec('0x1b')],_0xd86135);_0x328693(_0x1761f4[_0x6eec('0x18')](0x1f4,_0x2ad14b[_0x6eec('0x1b')]));});});};exports[_0x6eec('0x24')]=function(_0x316317){var _0x58f95c=this;return new Promise(function(_0x1d750c,_0x44b31c){return db[_0x6eec('0x1e')][_0x6eec('0x25')](_0x316317['body'],{'raw':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316317['options']?_0x316317[_0x6eec('0x21')]['where']||null:null,'attributes':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x26')]||null:null,'limit':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x27')]||null:null})[_0x6eec('0x22')](function(_0x33e4a1){logger[_0x6eec('0x13')](_0x6eec('0x24'),_0x316317);logger['debug'](_0x6eec('0x24'),_0x316317,JSON['stringify'](_0x33e4a1));_0x1d750c(_0x33e4a1);})[_0x6eec('0x23')](function(_0x125bfc){logger[_0x6eec('0x18')]('UpdateFaxMessage',_0x125bfc['message'],_0x316317);_0x44b31c(_0x58f95c['error'](0x1f4,_0x125bfc[_0x6eec('0x1b')]));});});}; \ No newline at end of file +var _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x5431f1,_0x31180d){var _0xb1537e=function(_0x51758f){while(--_0x51758f){_0x5431f1['push'](_0x5431f1['shift']());}};_0xb1537e(++_0x31180d);}(_0xac9d,0x14d));var _0xdac9=function(_0x4566db,_0x5da9a1){_0x4566db=_0x4566db-0x0;var _0x3167e6=_0xac9d[_0x4566db];return _0x3167e6;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2af7cfd..b301884 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 _0x10a3=['./faxMessage.events','save','remove','update','emit','removeListener','register','length','faxMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10a3,0x117));var _0x310a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x10a3[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require(_0x310a('0x0'));var events=[_0x310a('0x1'),_0x310a('0x2'),_0x310a('0x3')];function createListener(_0x5ad56e,_0x41ac16){return function(_0xfa0064){_0x41ac16[_0x310a('0x4')](_0x5ad56e,_0xfa0064);};}function removeListener(_0x3935f9,_0x33560d){return function(){FaxMessageEvents[_0x310a('0x5')](_0x3935f9,_0x33560d);};}exports[_0x310a('0x6')]=function(_0x1cda1f){for(var _0x1bdce4=0x0,_0x4fb14b=events[_0x310a('0x7')];_0x1bdce4<_0x4fb14b;_0x1bdce4++){var _0x2958a3=events[_0x1bdce4];var _0x87b1fa=createListener(_0x310a('0x8')+_0x2958a3,_0x1cda1f);FaxMessageEvents['on'](_0x2958a3,_0x87b1fa);}}; \ No newline at end of file +var _0x3876=['removeListener','./faxMessage.events','save','update'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3876,0x13d));var _0x6387=function(_0x1e6dc6,_0x216de4){_0x1e6dc6=_0x1e6dc6-0x0;var _0x54d1c9=_0x3876[_0x1e6dc6];return _0x54d1c9;};'use strict';var FaxMessageEvents=require(_0x6387('0x0'));var events=[_0x6387('0x1'),'remove',_0x6387('0x2')];function createListener(_0x4c93d5,_0x204917){return function(_0xaf02fa){_0x204917['emit'](_0x4c93d5,_0xaf02fa);};}function removeListener(_0x25a241,_0x43c56d){return function(){FaxMessageEvents[_0x6387('0x3')](_0x25a241,_0x43c56d);};}exports['register']=function(_0x251e93){for(var _0x5dd99f=0x0,_0x5f1f20=events['length'];_0x5dd99f<_0x5f1f20;_0x5dd99f++){var _0x49e631=events[_0x5dd99f];var _0x273f70=createListener('faxMessage:'+_0x49e631,_0x251e93);FaxMessageEvents['on'](_0x49e631,_0x273f70);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 92a22c4..4679c56 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 _0xee5b=['update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id'];(function(_0x5978e,_0x706ac9){var _0x204c2d=function(_0x30f224){while(--_0x30f224){_0x5978e['push'](_0x5978e['shift']());}};_0x204c2d(++_0x706ac9);}(_0xee5b,0x1f4));var _0xbee5=function(_0x84afb2,_0x3d7566){_0x84afb2=_0x84afb2-0x0;var _0x6979aa=_0xee5b[_0x84afb2];return _0x6979aa;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),interaction[_0xbee5('0xe')](_0xbee5('0xf'),_0xbee5('0x10')),controller[_0xbee5('0x11')]);router[_0xbee5('0x12')](_0xbee5('0x13'),auth['isAuthenticated'](),controller[_0xbee5('0x14')]);router['put'](_0xbee5('0x15'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x16')]);router['put']('/:id/reject',auth[_0xbee5('0x8')](),controller['reject']);router[_0xbee5('0x17')]('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0x18')]);module[_0xbee5('0x19')]=router; \ No newline at end of file +var _0xbee3=['update','/:id/accept','accept','/:id/reject','reject','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','fax','create','put'];(function(_0x359433,_0x2398b0){var _0x2db8ab=function(_0xefac8f){while(--_0xefac8f){_0x359433['push'](_0x359433['shift']());}};_0x2db8ab(++_0x2398b0);}(_0xbee3,0xd5));var _0x3bee=function(_0x2bd8fe,_0x4aeef7){_0x2bd8fe=_0x2bd8fe-0x0;var _0x2979e6=_0xbee3[_0x2bd8fe];return _0x2979e6;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3bee('0x3'));var interaction=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var controller=require('./faxMessage.controller');router[_0x3bee('0x6')]('/',auth[_0x3bee('0x7')](),controller['index']);router[_0x3bee('0x6')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x9')]);router[_0x3bee('0x6')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller['show']);router[_0x3bee('0x6')](_0x3bee('0xb'),auth[_0x3bee('0x7')](),controller[_0x3bee('0xc')]);router[_0x3bee('0xd')]('/',auth[_0x3bee('0x7')](),interaction['tracked'](_0x3bee('0xe'),'faxmessage:create'),controller[_0x3bee('0xf')]);router[_0x3bee('0x10')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x11')]);router[_0x3bee('0x10')](_0x3bee('0x12'),auth['isAuthenticated'](),controller[_0x3bee('0x13')]);router[_0x3bee('0x10')](_0x3bee('0x14'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x15')]);router['delete']('/:id',auth[_0x3bee('0x7')](),controller['destroy']);module[_0x3bee('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index acf4ad9..a78a9de 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 _0x7e15=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0x7e15,0x144));var _0x57e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7e15[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x57e1('0x0'));module[_0x57e1('0x1')]={'name':{'type':Sequelize[_0x57e1('0x2')],'unique':_0x57e1('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x57e1('0x2')]},'timeout':{'type':Sequelize[_0x57e1('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x57e1('0x5')](_0x57e1('0x6'),_0x57e1('0x7'),_0x57e1('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x57e1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5b51=['roundrobin','INTEGER','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x5b51,0xa2));var _0x15b5=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x5b51[_0x1d7300];return _0x46ee98;};'use strict';var Sequelize=require(_0x15b5('0x0'));module[_0x15b5('0x1')]={'name':{'type':Sequelize[_0x15b5('0x2')],'unique':_0x15b5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x15b5('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x15b5('0x4')](_0x15b5('0x5'),'beepall',_0x15b5('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x15b5('0x7')],'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 be68d94..b214cad 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 _0x2be9=['findAndCountAll','UserId','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','merge','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','removeTeams','addAgents','omit','removeAgents','userFaxQueue:remove','getAgents','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','FaxQueues','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserFaxQueue','FaxQueueId','findAll'];(function(_0x5d23ee,_0x562aab){var _0x396cf3=function(_0x14385a){while(--_0x14385a){_0x5d23ee['push'](_0x5d23ee['shift']());}};_0x396cf3(++_0x562aab);}(_0x2be9,0xbf));var _0x92be=function(_0x50b651,_0x2ce0c5){_0x50b651=_0x50b651-0x0;var _0x1ec2b0=_0x2be9[_0x50b651];return _0x1ec2b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x92be('0x1'));var moment=require(_0x92be('0x2'));var BPromise=require(_0x92be('0x3'));var Mustache=require(_0x92be('0x4'));var util=require(_0x92be('0x5'));var path=require(_0x92be('0x6'));var sox=require(_0x92be('0x7'));var csv=require(_0x92be('0x8'));var ejs=require(_0x92be('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92be('0xa'));var squel=require(_0x92be('0xb'));var crypto=require(_0x92be('0xc'));var jsforce=require(_0x92be('0xd'));var deskjs=require(_0x92be('0xe'));var toCsv=require(_0x92be('0x8'));var querystring=require('querystring');var Papa=require(_0x92be('0xf'));var Redis=require(_0x92be('0x10'));var authService=require(_0x92be('0x11'));var qs=require(_0x92be('0x12'));var as=require(_0x92be('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x92be('0x14'));var utils=require(_0x92be('0x15'));var config=require(_0x92be('0x16'));var licenseUtil=require(_0x92be('0x17'));var db=require(_0x92be('0x18'))['db'];config['redis']=_[_0x92be('0x19')](config[_0x92be('0x1a')],{'host':_0x92be('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92be('0x1a')]));require('./faxQueue.socket')[_0x92be('0x1c')](socket);function respondWithStatusCode(_0x118226,_0x39de6a){_0x39de6a=_0x39de6a||0xcc;return function(_0xea3981){if(_0xea3981){return _0x118226[_0x92be('0x1d')](_0x39de6a);}return _0x118226[_0x92be('0x1e')](_0x39de6a)['end']();};}function respondWithResult(_0xa6a97,_0x58a13f){_0x58a13f=_0x58a13f||0xc8;return function(_0x52d123){if(_0x52d123){return _0xa6a97['status'](_0x58a13f)[_0x92be('0x1f')](_0x52d123);}};}function respondWithFilteredResult(_0x4070c5,_0x4031a9){return function(_0x32e258){if(_0x32e258){var _0x24c9de=typeof _0x4031a9[_0x92be('0x20')]===_0x92be('0x21')&&typeof _0x4031a9['limit']==='undefined';var _0x4bed16=_0x32e258[_0x92be('0x22')];var _0x5c927a=_0x24c9de?0x0:_0x4031a9[_0x92be('0x20')];var _0x1d1e7b=_0x24c9de?_0x32e258[_0x92be('0x22')]:_0x4031a9['offset']+_0x4031a9[_0x92be('0x23')];var _0xf01267;if(_0x1d1e7b>=_0x4bed16){_0x1d1e7b=_0x4bed16;_0xf01267=0xc8;}else{_0xf01267=0xce;}_0x4070c5[_0x92be('0x1e')](_0xf01267);return _0x4070c5['set'](_0x92be('0x24'),_0x5c927a+'-'+_0x1d1e7b+'/'+_0x4bed16)[_0x92be('0x1f')](_0x32e258);}return null;};}function patchUpdates(_0x2225aa){return function(_0x51335c){try{jsonpatch[_0x92be('0x25')](_0x51335c,_0x2225aa,!![]);}catch(_0x4d36c3){return BPromise['reject'](_0x4d36c3);}return _0x51335c[_0x92be('0x26')]();};}function saveUpdates(_0x2ba83c,_0x572d84){return function(_0xac8816){if(_0xac8816){return _0xac8816[_0x92be('0x27')](_0x2ba83c)[_0x92be('0x28')](function(_0x25f48d){return _0x25f48d;});}return null;};}function removeEntity(_0x4870eb,_0x4716b0){return function(_0x47ab3e){if(_0x47ab3e){return _0x47ab3e[_0x92be('0x29')]()[_0x92be('0x28')](function(){var _0xd5ffd1=_0x47ab3e[_0x92be('0x2a')]({'plain':!![]});var _0x13b722=_0x92be('0x2b');return db['UserProfileResource'][_0x92be('0x29')]({'where':{'type':_0x13b722,'resourceId':_0xd5ffd1['id']}})[_0x92be('0x28')](function(){return _0x47ab3e;});})['then'](function(){_0x4870eb['status'](0xcc)[_0x92be('0x2c')]();});}};}function handleEntityNotFound(_0xe3b15a,_0x2f8567){return function(_0x3e271e){if(!_0x3e271e){_0xe3b15a[_0x92be('0x1d')](0x194);}return _0x3e271e;};}function handleError(_0x381fa4,_0x75e884){_0x75e884=_0x75e884||0x1f4;return function(_0x24b527){logger[_0x92be('0x2d')](_0x24b527[_0x92be('0x2e')]);if(_0x24b527['name']){delete _0x24b527[_0x92be('0x2f')];}_0x381fa4[_0x92be('0x1e')](_0x75e884)[_0x92be('0x30')](_0x24b527);};}exports[_0x92be('0x31')]=function(_0x362db0,_0x502316){var _0x19d7c3={},_0x466bb5={},_0x3fcec3={'count':0x0,'rows':[]};var _0x56dce5=_[_0x92be('0x32')](db[_0x92be('0x33')][_0x92be('0x34')],function(_0x46f6ca){return{'name':_0x46f6ca[_0x92be('0x35')],'type':_0x46f6ca[_0x92be('0x36')]['key']};});_0x466bb5[_0x92be('0x37')]=_[_0x92be('0x32')](_0x56dce5,'name');_0x466bb5[_0x92be('0x38')]=_[_0x92be('0x39')](_0x362db0['query']);_0x466bb5['filters']=_[_0x92be('0x3a')](_0x466bb5['model'],_0x466bb5[_0x92be('0x38')]);_0x19d7c3[_0x92be('0x3b')]=_['intersection'](_0x466bb5['model'],qs[_0x92be('0x3c')](_0x362db0[_0x92be('0x38')][_0x92be('0x3c')]));_0x19d7c3['attributes']=_0x19d7c3[_0x92be('0x3b')]['length']?_0x19d7c3[_0x92be('0x3b')]:_0x466bb5['model'];if(!_0x362db0[_0x92be('0x38')][_0x92be('0x3d')](_0x92be('0x3e'))){_0x19d7c3[_0x92be('0x23')]=qs['limit'](_0x362db0[_0x92be('0x38')]['limit']);_0x19d7c3[_0x92be('0x20')]=qs[_0x92be('0x20')](_0x362db0['query']['offset']);}_0x19d7c3[_0x92be('0x3f')]=qs[_0x92be('0x40')](_0x362db0[_0x92be('0x38')][_0x92be('0x40')]);_0x19d7c3[_0x92be('0x41')]=qs[_0x92be('0x42')](_[_0x92be('0x43')](_0x362db0['query'],_0x466bb5[_0x92be('0x42')]),_0x56dce5);if(_0x362db0[_0x92be('0x38')][_0x92be('0x44')]){_0x19d7c3[_0x92be('0x41')]=_['merge'](_0x19d7c3[_0x92be('0x41')],{'$or':_[_0x92be('0x32')](_0x56dce5,function(_0x528cf1){if(_0x528cf1['type']!==_0x92be('0x45')){var _0x3fd01c={};_0x3fd01c[_0x528cf1[_0x92be('0x2f')]]={'$like':'%'+_0x362db0[_0x92be('0x38')]['filter']+'%'};return _0x3fd01c;}})});}_0x19d7c3=_['merge']({},_0x19d7c3,_0x362db0[_0x92be('0x46')]);var _0x2b4b82={'where':_0x19d7c3[_0x92be('0x41')]};return db['FaxQueue']['count'](_0x2b4b82)[_0x92be('0x28')](function(_0x2971f5){_0x3fcec3['count']=_0x2971f5;if(_0x362db0[_0x92be('0x38')][_0x92be('0x47')]){_0x19d7c3[_0x92be('0x48')]=[{'all':!![]}];}return db[_0x92be('0x33')]['findAll'](_0x19d7c3);})[_0x92be('0x28')](function(_0x3bd42c){_0x3fcec3[_0x92be('0x49')]=_0x3bd42c;return _0x3fcec3;})['then'](respondWithFilteredResult(_0x502316,_0x19d7c3))[_0x92be('0x4a')](handleError(_0x502316,null));};exports[_0x92be('0x4b')]=function(_0x3baa6a,_0x1f8169){var _0x31bdf0={'raw':!![],'where':{'id':_0x3baa6a[_0x92be('0x4c')]['id']}},_0x523f4a={};_0x523f4a[_0x92be('0x37')]=_['keys'](db[_0x92be('0x33')]['rawAttributes']);_0x523f4a[_0x92be('0x38')]=_[_0x92be('0x39')](_0x3baa6a[_0x92be('0x38')]);_0x523f4a['filters']=_['intersection'](_0x523f4a[_0x92be('0x37')],_0x523f4a[_0x92be('0x38')]);_0x31bdf0[_0x92be('0x3b')]=_[_0x92be('0x3a')](_0x523f4a[_0x92be('0x37')],qs[_0x92be('0x3c')](_0x3baa6a[_0x92be('0x38')][_0x92be('0x3c')]));_0x31bdf0[_0x92be('0x3b')]=_0x31bdf0[_0x92be('0x3b')][_0x92be('0x4d')]?_0x31bdf0['attributes']:_0x523f4a[_0x92be('0x37')];if(_0x3baa6a[_0x92be('0x38')][_0x92be('0x47')]){_0x31bdf0['include']=[{'all':!![]}];}_0x31bdf0=_['merge']({},_0x31bdf0,_0x3baa6a['options']);return db[_0x92be('0x33')][_0x92be('0x4e')](_0x31bdf0)[_0x92be('0x28')](handleEntityNotFound(_0x1f8169,null))[_0x92be('0x28')](respondWithResult(_0x1f8169,null))['catch'](handleError(_0x1f8169,null));};exports['create']=function(_0x19e44d,_0x2539e9){return db[_0x92be('0x33')][_0x92be('0x4f')](_0x19e44d['body'],{})[_0x92be('0x28')](function(_0x2493bb){var _0x5eae55=_0x19e44d['user'][_0x92be('0x2a')]({'plain':!![]});if(!_0x5eae55)throw new Error(_0x92be('0x50'));if(_0x5eae55[_0x92be('0x51')]===_0x92be('0x52')){var _0x15fc92=_0x2493bb[_0x92be('0x2a')]({'plain':!![]});var _0x19fc22='FaxQueues';return db[_0x92be('0x53')][_0x92be('0x4e')]({'where':{'name':_0x19fc22,'userProfileId':_0x5eae55[_0x92be('0x54')]},'raw':!![]})[_0x92be('0x28')](function(_0x457500){if(_0x457500&&_0x457500['autoAssociation']===0x0){return db[_0x92be('0x55')]['create']({'name':_0x15fc92['name'],'resourceId':_0x15fc92['id'],'type':_0x457500[_0x92be('0x2f')],'sectionId':_0x457500['id']},{})[_0x92be('0x28')](function(){return _0x2493bb;});}else{return _0x2493bb;}})[_0x92be('0x4a')](function(_0x5b654f){logger[_0x92be('0x2d')](_0x92be('0x56'),_0x5b654f);throw _0x5b654f;});}return _0x2493bb;})[_0x92be('0x28')](respondWithResult(_0x2539e9,0xc9))[_0x92be('0x4a')](handleError(_0x2539e9,null));};exports[_0x92be('0x27')]=function(_0x4e2f80,_0x4bbcee){if(_0x4e2f80['body']['id']){delete _0x4e2f80[_0x92be('0x57')]['id'];}return db[_0x92be('0x33')][_0x92be('0x4e')]({'where':{'id':_0x4e2f80[_0x92be('0x4c')]['id']}})[_0x92be('0x28')](handleEntityNotFound(_0x4bbcee,null))[_0x92be('0x28')](saveUpdates(_0x4e2f80[_0x92be('0x57')],null))['then'](respondWithResult(_0x4bbcee,null))[_0x92be('0x4a')](handleError(_0x4bbcee,null));};exports['destroy']=function(_0x41fc85,_0x571d92){return db['FaxQueue'][_0x92be('0x4e')]({'where':{'id':_0x41fc85['params']['id']}})[_0x92be('0x28')](handleEntityNotFound(_0x571d92,null))[_0x92be('0x28')](removeEntity(_0x571d92,null))[_0x92be('0x4a')](handleError(_0x571d92,null));};exports[_0x92be('0x58')]=function(_0x2e0561,_0x2ccaa9){return db[_0x92be('0x33')][_0x92be('0x58')]()[_0x92be('0x28')](respondWithResult(_0x2ccaa9,null))['catch'](handleError(_0x2ccaa9,null));};exports['getMembers']=function(_0x37c0e8,_0x17f2ab,_0x1aa2bf){var _0x4b40f3={'raw':!![],'where':{}},_0x21df2c={},_0x176929;return db[_0x92be('0x33')][_0x92be('0x59')]({'where':{'id':_0x37c0e8['params']['id']}})[_0x92be('0x28')](handleEntityNotFound(_0x17f2ab,null))[_0x92be('0x28')](function(_0x2ddd65){if(_0x2ddd65){_0x176929=_0x2ddd65[_0x92be('0x2a')]({'plain':!![]});_0x21df2c[_0x92be('0x37')]=_['keys'](db[_0x92be('0x5a')][_0x92be('0x34')]);_0x21df2c[_0x92be('0x38')]=_[_0x92be('0x39')](_0x37c0e8[_0x92be('0x38')]);_0x21df2c[_0x92be('0x42')]=_[_0x92be('0x3a')](_0x21df2c[_0x92be('0x37')],_0x21df2c[_0x92be('0x38')]);_0x4b40f3[_0x92be('0x3b')]=_['intersection'](_0x21df2c[_0x92be('0x37')],qs[_0x92be('0x3c')](_0x37c0e8[_0x92be('0x38')][_0x92be('0x3c')]));_0x4b40f3[_0x92be('0x3b')]=_0x4b40f3[_0x92be('0x3b')][_0x92be('0x4d')]?_0x4b40f3[_0x92be('0x3b')]:_0x21df2c[_0x92be('0x37')];if(!_0x37c0e8['query'][_0x92be('0x3d')](_0x92be('0x3e'))){_0x4b40f3['limit']=qs['limit'](_0x37c0e8[_0x92be('0x38')][_0x92be('0x23')]);_0x4b40f3[_0x92be('0x20')]=qs[_0x92be('0x20')](_0x37c0e8[_0x92be('0x38')][_0x92be('0x20')]);}_0x4b40f3[_0x92be('0x3f')]=qs[_0x92be('0x40')](_0x37c0e8['query'][_0x92be('0x40')]);_0x4b40f3[_0x92be('0x41')]=qs[_0x92be('0x42')](_['pick'](_0x37c0e8[_0x92be('0x38')],_0x21df2c[_0x92be('0x42')]));_0x4b40f3[_0x92be('0x41')][_0x92be('0x5b')]=_0x2ddd65['id'];if(_0x37c0e8[_0x92be('0x38')][_0x92be('0x44')]){_0x4b40f3[_0x92be('0x41')]=_['merge'](_0x4b40f3['where'],{'$or':_[_0x92be('0x32')](_0x4b40f3[_0x92be('0x3b')],function(_0x541f46){var _0x50fe23={};_0x50fe23[_0x541f46]={'$like':'%'+_0x37c0e8[_0x92be('0x38')][_0x92be('0x44')]+'%'};return _0x50fe23;})});}_0x4b40f3=_['merge']({},_0x4b40f3,_0x37c0e8['options']);return db[_0x92be('0x5a')][_0x92be('0x5c')](_0x4b40f3);}})[_0x92be('0x28')](function(_0x22eec5){if(_0x22eec5){return db['User'][_0x92be('0x5d')]({'where':{'id':_[_0x92be('0x32')](_0x22eec5,_0x92be('0x5e')),'role':'agent'},'attributes':['id',_0x92be('0x2f'),_0x92be('0x5f'),_0x92be('0x60'),'createdAt']});}})['then'](function(_0x7361bf){if(_0x7361bf){return{'count':_0x7361bf[_0x92be('0x22')],'rows':_[_0x92be('0x32')](_0x7361bf[_0x92be('0x49')],function(_0x9d77d9){return{'membername':_0x9d77d9[_0x92be('0x2f')],'UserId':_0x9d77d9['id'],'queue_name':_0x176929['name'],'FaxQueueId':_0x176929['id'],'interface':util[_0x92be('0x61')](_0x92be('0x62'),_0x92be('0x63'),_0x9d77d9[_0x92be('0x2f')]),'penalty':0x0,'paused':_0x9d77d9[_0x92be('0x5f')],'createdAt':_0x9d77d9[_0x92be('0x64')],'updatedAt':_0x9d77d9[_0x92be('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x92be('0x28')](respondWithFilteredResult(_0x17f2ab,_0x4b40f3))[_0x92be('0x4a')](handleError(_0x17f2ab,null));};exports[_0x92be('0x65')]=function(_0x232ab9,_0x36627b,_0x3e261d){var _0x1da5b2={};var _0x222c9c={};var _0xa7c31e;var _0x14febd;return db[_0x92be('0x33')]['findOne']({'where':{'id':_0x232ab9[_0x92be('0x4c')]['id']}})[_0x92be('0x28')](handleEntityNotFound(_0x36627b,null))[_0x92be('0x28')](function(_0xeee393){if(_0xeee393){_0xa7c31e=_0xeee393;_0x222c9c[_0x92be('0x37')]=_[_0x92be('0x39')](db[_0x92be('0x66')][_0x92be('0x34')]);_0x222c9c[_0x92be('0x38')]=_[_0x92be('0x39')](_0x232ab9['query']);_0x222c9c[_0x92be('0x42')]=_['intersection'](_0x222c9c['model'],_0x222c9c[_0x92be('0x38')]);_0x1da5b2[_0x92be('0x3b')]=_[_0x92be('0x3a')](_0x222c9c[_0x92be('0x37')],qs[_0x92be('0x3c')](_0x232ab9[_0x92be('0x38')][_0x92be('0x3c')]));_0x1da5b2[_0x92be('0x3b')]=_0x1da5b2['attributes']['length']?_0x1da5b2[_0x92be('0x3b')]:_0x222c9c[_0x92be('0x37')];_0x1da5b2[_0x92be('0x3f')]=qs[_0x92be('0x40')](_0x232ab9[_0x92be('0x38')][_0x92be('0x40')]);_0x1da5b2[_0x92be('0x41')]=qs[_0x92be('0x42')](_['pick'](_0x232ab9['query'],_0x222c9c[_0x92be('0x42')]));if(_0x232ab9[_0x92be('0x38')][_0x92be('0x44')]){_0x1da5b2[_0x92be('0x41')]=_[_0x92be('0x67')](_0x1da5b2[_0x92be('0x41')],{'$or':_[_0x92be('0x32')](_0x1da5b2[_0x92be('0x3b')],function(_0x149c53){var _0x5b1b46={};_0x5b1b46[_0x149c53]={'$like':'%'+_0x232ab9[_0x92be('0x38')][_0x92be('0x44')]+'%'};return _0x5b1b46;})});}_0x1da5b2=_['merge']({},_0x1da5b2,_0x232ab9['options']);return _0xa7c31e[_0x92be('0x65')](_0x1da5b2);}})[_0x92be('0x28')](function(_0x2e2489){if(_0x2e2489){_0x14febd=_0x2e2489[_0x92be('0x4d')];if(!_0x232ab9[_0x92be('0x38')][_0x92be('0x3d')](_0x92be('0x3e'))){_0x1da5b2['limit']=qs[_0x92be('0x23')](_0x232ab9[_0x92be('0x38')][_0x92be('0x23')]);_0x1da5b2['offset']=qs[_0x92be('0x20')](_0x232ab9[_0x92be('0x38')]['offset']);}return _0xa7c31e[_0x92be('0x65')](_0x1da5b2);}})[_0x92be('0x28')](function(_0x1de8d5){if(_0x1de8d5){return _0x1de8d5?{'count':_0x14febd,'rows':_0x1de8d5}:null;}})[_0x92be('0x28')](respondWithResult(_0x36627b,null))[_0x92be('0x4a')](handleError(_0x36627b,null));};exports[_0x92be('0x68')]=function(_0x4a325f,_0x58f43b,_0x18c76b){var _0x1fe623=_0x4a325f[_0x92be('0x57')][_0x92be('0x69')];return db[_0x92be('0x66')][_0x92be('0x5c')]({'where':{'id':_0x1fe623},'attributes':['id'],'include':[{'model':db[_0x92be('0x6a')],'as':_0x92be('0x6b'),'attributes':['id',_0x92be('0x2f'),_0x92be('0x6c'),_0x92be('0x6d'),_0x92be('0x6e')],'raw':!![]}]})[_0x92be('0x28')](function(_0x3de554){if(_0x3de554){var _0x47b9dc=_[_0x92be('0x6f')](_0x3de554,function(_0x1f7e21){var _0x13fdbf=_0x1f7e21[_0x92be('0x2a')]({'plain':!![]});return _0x13fdbf['Agents'];});return db[_0x92be('0x33')][_0x92be('0x4e')]({'where':{'id':_0x4a325f['params']['id']}})[_0x92be('0x28')](function(_0x4b5ba9){return db['sequelize']['transaction'](function(_0x2c7337){return _0x4b5ba9['addTeams'](_0x1fe623,{'transaction':_0x2c7337})['then'](function(){return BPromise[_0x92be('0x70')](_0x47b9dc,function(_0x284114){return db['UserFaxQueue'][_0x92be('0x71')]({'where':{'UserId':_0x284114['id'],'FaxQueueId':_0x4a325f[_0x92be('0x4c')]['id']},'transaction':_0x2c7337});});})[_0x92be('0x28')](function(){_0x47b9dc[_0x92be('0x72')](function(_0x5a27b1){socket[_0x92be('0x73')](_0x92be('0x74'),{'UserId':_0x5a27b1['id'],'FaxQueueId':_0x4b5ba9['id']});});});});});}})[_0x92be('0x28')](respondWithStatusCode(_0x58f43b,null))['catch'](handleError(_0x58f43b,null));};exports['removeTeams']=function(_0x2326ad,_0x2bb53c,_0x59cfa1){return db[_0x92be('0x66')][_0x92be('0x5c')]({'where':{'id':_0x2326ad[_0x92be('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x92be('0x6a')],'as':_0x92be('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x92be('0x28')](handleEntityNotFound(_0x2bb53c,null))[_0x92be('0x28')](function(_0xaa3f6d){var _0x3b06ab=_[_0x92be('0x32')](_0xaa3f6d,'id');var _0x1f60e4=[];var _0x1deec8=[];var _0x1f53e5=squel['select']();_0x1f53e5[_0x92be('0x75')](_0x92be('0x76'))[_0x92be('0x77')](_0x92be('0x78'),'tq')['join'](_0x92be('0x79'),'ut',_0x92be('0x7a'))[_0x92be('0x41')](_0x92be('0x7b'),_0x2326ad[_0x92be('0x4c')]['id']);for(var _0x1b6b11=0x0;_0x1b6b11<_0xaa3f6d[_0x92be('0x4d')];_0x1b6b11+=0x1){let _0x14849f=_0xaa3f6d[_0x1b6b11];for(var _0x4c9d0b=0x0;_0x4c9d0b<_0x14849f[_0x92be('0x6b')][_0x92be('0x4d')];_0x4c9d0b+=0x1){let _0x4de0f9=_0x14849f[_0x92be('0x6b')][_0x4c9d0b];var _0x247143=_0x1f53e5[_0x92be('0x7c')]();_0x247143['where'](_0x92be('0x7d'),_0x4de0f9['id']);_0x1deec8['push'](db[_0x92be('0x7e')][_0x92be('0x38')](_0x247143['toString'](),{'type':db[_0x92be('0x7e')][_0x92be('0x7f')][_0x92be('0x80')]})[_0x92be('0x28')](function(_0x895187){if(_0x895187['length']===0x1){return _0x4de0f9['id'];}else{var _0x1cf1cf=_['every'](_[_0x92be('0x32')](_0x895187,_0x92be('0x81')),function(_0x43240b){return _[_0x92be('0x82')](_0x3b06ab,_0x43240b);});if(_0x1cf1cf){return _0x4de0f9['id'];}}}));}}return BPromise[_0x92be('0x83')](_0x1deec8)[_0x92be('0x28')](function(_0x454712){_0x1f60e4=_(_0x1f60e4)[_0x92be('0x84')](_0x454712)[_0x92be('0x85')]()[_0x92be('0x86')]();return db['FaxQueue'][_0x92be('0x4e')]({'where':{'id':_0x2326ad[_0x92be('0x4c')]['id']}})['then'](function(_0x4d0793){return db['sequelize'][_0x92be('0x87')](function(_0x556823){return _0x4d0793[_0x92be('0x88')](_0x2326ad[_0x92be('0x38')]['ids'],{'transaction':_0x556823})[_0x92be('0x28')](function(){if(!_['isEmpty'](_0x1f60e4)){return _0x4d0793['removeAgents'](_0x1f60e4,{'transaction':_0x556823});}})['then'](function(){_0x1f60e4[_0x92be('0x72')](function(_0x50a03b){socket[_0x92be('0x73')]('userFaxQueue:remove',{'UserId':_0x50a03b,'FaxQueueId':_0x4d0793['id']});});});});});});})[_0x92be('0x28')](respondWithStatusCode(_0x2bb53c,null))['catch'](handleError(_0x2bb53c,null));};exports[_0x92be('0x89')]=function(_0x14e213,_0x32a541,_0x389753){return db[_0x92be('0x33')][_0x92be('0x4e')]({'where':{'id':_0x14e213[_0x92be('0x4c')]['id']}})[_0x92be('0x28')](handleEntityNotFound(_0x32a541,null))[_0x92be('0x28')](function(_0x589f2a){if(_0x589f2a){return _0x589f2a[_0x92be('0x89')](_0x14e213['body'][_0x92be('0x69')],_[_0x92be('0x8a')](_0x14e213[_0x92be('0x57')],[_0x92be('0x69'),'id'])||{})['spread'](function(_0x1b3bdc){for(var _0x3d1553=0x0;_0x3d1553<_0x14e213['body']['ids'][_0x92be('0x4d')];_0x3d1553+=0x1){socket[_0x92be('0x73')](_0x92be('0x74'),{'UserId':Number(_0x14e213[_0x92be('0x57')][_0x92be('0x69')][_0x3d1553]),'FaxQueueId':Number(_0x14e213[_0x92be('0x4c')]['id'])});}return _0x1b3bdc;});}})[_0x92be('0x28')](respondWithResult(_0x32a541,null))[_0x92be('0x4a')](handleError(_0x32a541,null));};exports[_0x92be('0x8b')]=function(_0x1f5586,_0x1c3d44,_0x213f61){return db[_0x92be('0x33')][_0x92be('0x4e')]({'where':{'id':_0x1f5586[_0x92be('0x4c')]['id']}})[_0x92be('0x28')](handleEntityNotFound(_0x1c3d44,null))['then'](function(_0x2c6f47){if(_0x2c6f47){return _0x2c6f47[_0x92be('0x8b')](_0x1f5586[_0x92be('0x38')]['ids'])[_0x92be('0x28')](function(){if(_['isArray'](_0x1f5586['query'][_0x92be('0x69')])){for(var _0x372973=0x0;_0x372973<_0x1f5586[_0x92be('0x38')][_0x92be('0x69')][_0x92be('0x4d')];_0x372973+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x1f5586[_0x92be('0x38')][_0x92be('0x69')][_0x372973]),'FaxQueueId':Number(_0x1f5586[_0x92be('0x4c')]['id'])});}}else{socket['emit'](_0x92be('0x8c'),{'UserId':Number(_0x1f5586[_0x92be('0x38')][_0x92be('0x69')]),'FaxQueueId':Number(_0x1f5586[_0x92be('0x4c')]['id'])});}});}})[_0x92be('0x28')](respondWithStatusCode(_0x1c3d44,null))[_0x92be('0x4a')](handleError(_0x1c3d44,null));};exports[_0x92be('0x8d')]=function(_0x4d1d48,_0x57ea49,_0xf74999){var _0x3a8637={};var _0x43551f={};var _0x3dd3ee;var _0x2822cf;return db[_0x92be('0x33')]['findOne']({'where':{'id':_0x4d1d48[_0x92be('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57ea49,null))[_0x92be('0x28')](function(_0x43161b){if(_0x43161b){_0x3dd3ee=_0x43161b;_0x43551f[_0x92be('0x37')]=_['keys'](db['User'][_0x92be('0x34')]);_0x43551f[_0x92be('0x38')]=_[_0x92be('0x39')](_0x4d1d48['query']);_0x43551f[_0x92be('0x42')]=_[_0x92be('0x3a')](_0x43551f[_0x92be('0x37')],_0x43551f[_0x92be('0x38')]);_0x3a8637[_0x92be('0x3b')]=_[_0x92be('0x3a')](_0x43551f[_0x92be('0x37')],qs[_0x92be('0x3c')](_0x4d1d48[_0x92be('0x38')][_0x92be('0x3c')]));_0x3a8637['attributes']=_0x3a8637['attributes'][_0x92be('0x4d')]?_0x3a8637[_0x92be('0x3b')]:_0x43551f[_0x92be('0x37')];_0x3a8637[_0x92be('0x3f')]=qs[_0x92be('0x40')](_0x4d1d48[_0x92be('0x38')][_0x92be('0x40')]);_0x3a8637['where']=qs[_0x92be('0x42')](_[_0x92be('0x43')](_0x4d1d48[_0x92be('0x38')],_0x43551f['filters']));if(_0x4d1d48[_0x92be('0x38')]['filter']){_0x3a8637[_0x92be('0x41')]=_[_0x92be('0x67')](_0x3a8637[_0x92be('0x41')],{'$or':_['map'](_0x3a8637[_0x92be('0x3b')],function(_0x39822d){var _0xceae08={};_0xceae08[_0x39822d]={'$like':'%'+_0x4d1d48[_0x92be('0x38')][_0x92be('0x44')]+'%'};return _0xceae08;})});}_0x3a8637=_[_0x92be('0x67')]({},_0x3a8637,_0x4d1d48[_0x92be('0x46')]);return _0x3dd3ee[_0x92be('0x8d')](_0x3a8637);}})['then'](function(_0x53ff07){if(_0x53ff07){_0x2822cf=_0x53ff07[_0x92be('0x4d')];if(!_0x4d1d48[_0x92be('0x38')][_0x92be('0x3d')]('nolimit')){_0x3a8637[_0x92be('0x23')]=qs[_0x92be('0x23')](_0x4d1d48['query']['limit']);_0x3a8637[_0x92be('0x20')]=qs[_0x92be('0x20')](_0x4d1d48[_0x92be('0x38')][_0x92be('0x20')]);}return _0x3dd3ee[_0x92be('0x8d')](_0x3a8637);}})[_0x92be('0x28')](function(_0x4a5cc1){if(_0x4a5cc1){return _0x4a5cc1?{'count':_0x2822cf,'rows':_0x4a5cc1}:null;}})[_0x92be('0x28')](respondWithResult(_0x57ea49,null))['catch'](handleError(_0x57ea49,null));}; \ No newline at end of file +var _0x8a2d=['tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','FaxQueue','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','pick','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select'];(function(_0x8f8a5d,_0x5e5eba){var _0x5f5609=function(_0x3503dc){while(--_0x3503dc){_0x8f8a5d['push'](_0x8f8a5d['shift']());}};_0x5f5609(++_0x5e5eba);}(_0x8a2d,0xaa));var _0xd8a2=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x8a2d[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require(_0xd8a2('0x0'));var rimraf=require(_0xd8a2('0x1'));var zipdir=require(_0xd8a2('0x2'));var jsonpatch=require(_0xd8a2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd8a2('0x4'));var Mustache=require(_0xd8a2('0x5'));var util=require('util');var path=require(_0xd8a2('0x6'));var sox=require(_0xd8a2('0x7'));var csv=require(_0xd8a2('0x8'));var ejs=require(_0xd8a2('0x9'));var fs=require('fs');var fs_extra=require(_0xd8a2('0xa'));var _=require(_0xd8a2('0xb'));var squel=require(_0xd8a2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd8a2('0x8'));var querystring=require('querystring');var Papa=require(_0xd8a2('0xd'));var Redis=require(_0xd8a2('0xe'));var authService=require(_0xd8a2('0xf'));var qs=require(_0xd8a2('0x10'));var as=require(_0xd8a2('0x11'));var hardwareService=require(_0xd8a2('0x12'));var logger=require(_0xd8a2('0x13'))(_0xd8a2('0x14'));var utils=require(_0xd8a2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd8a2('0x16'));var db=require(_0xd8a2('0x17'))['db'];config['redis']=_[_0xd8a2('0x18')](config[_0xd8a2('0x19')],{'host':_0xd8a2('0x1a'),'port':0x18eb});var socket=require(_0xd8a2('0x1b'))(new Redis(config[_0xd8a2('0x19')]));require(_0xd8a2('0x1c'))['register'](socket);function respondWithStatusCode(_0x61a78d,_0x19a4ee){_0x19a4ee=_0x19a4ee||0xcc;return function(_0x25902d){if(_0x25902d){return _0x61a78d[_0xd8a2('0x1d')](_0x19a4ee);}return _0x61a78d[_0xd8a2('0x1e')](_0x19a4ee)['end']();};}function respondWithResult(_0xc9607c,_0x27fd01){_0x27fd01=_0x27fd01||0xc8;return function(_0x32608f){if(_0x32608f){return _0xc9607c['status'](_0x27fd01)[_0xd8a2('0x1f')](_0x32608f);}};}function respondWithFilteredResult(_0x3ed595,_0x30caa4){return function(_0x529c2b){if(_0x529c2b){var _0x2c384f=typeof _0x30caa4[_0xd8a2('0x20')]===_0xd8a2('0x21')&&typeof _0x30caa4[_0xd8a2('0x22')]===_0xd8a2('0x21');var _0x240337=_0x529c2b[_0xd8a2('0x23')];var _0x50a8ec=_0x2c384f?0x0:_0x30caa4[_0xd8a2('0x20')];var _0x4a7f23=_0x2c384f?_0x529c2b['count']:_0x30caa4['offset']+_0x30caa4[_0xd8a2('0x22')];var _0x5b010f;if(_0x4a7f23>=_0x240337){_0x4a7f23=_0x240337;_0x5b010f=0xc8;}else{_0x5b010f=0xce;}_0x3ed595['status'](_0x5b010f);return _0x3ed595['set']('Content-Range',_0x50a8ec+'-'+_0x4a7f23+'/'+_0x240337)[_0xd8a2('0x1f')](_0x529c2b);}return null;};}function patchUpdates(_0x5b991e){return function(_0x5a4579){try{jsonpatch[_0xd8a2('0x24')](_0x5a4579,_0x5b991e,!![]);}catch(_0x251aad){return BPromise[_0xd8a2('0x25')](_0x251aad);}return _0x5a4579['save']();};}function saveUpdates(_0x1bd80d,_0x153204){return function(_0x25ad0d){if(_0x25ad0d){return _0x25ad0d[_0xd8a2('0x26')](_0x1bd80d)[_0xd8a2('0x27')](function(_0x528ca3){return _0x528ca3;});}return null;};}function removeEntity(_0x47975a,_0x5e87c9){return function(_0x9ec0a7){if(_0x9ec0a7){return _0x9ec0a7[_0xd8a2('0x28')]()[_0xd8a2('0x27')](function(){var _0xb98dad=_0x9ec0a7[_0xd8a2('0x29')]({'plain':!![]});var _0x5c20a8='FaxQueues';return db[_0xd8a2('0x2a')]['destroy']({'where':{'type':_0x5c20a8,'resourceId':_0xb98dad['id']}})['then'](function(){return _0x9ec0a7;});})[_0xd8a2('0x27')](function(){_0x47975a['status'](0xcc)[_0xd8a2('0x2b')]();});}};}function handleEntityNotFound(_0x11f0eb,_0x146a70){return function(_0x437d47){if(!_0x437d47){_0x11f0eb[_0xd8a2('0x1d')](0x194);}return _0x437d47;};}function handleError(_0xa16dd2,_0x5acc44){_0x5acc44=_0x5acc44||0x1f4;return function(_0x1f4f31){logger[_0xd8a2('0x2c')](_0x1f4f31[_0xd8a2('0x2d')]);if(_0x1f4f31[_0xd8a2('0x2e')]){delete _0x1f4f31['name'];}_0xa16dd2[_0xd8a2('0x1e')](_0x5acc44)[_0xd8a2('0x2f')](_0x1f4f31);};}exports[_0xd8a2('0x30')]=function(_0x4b0715,_0x448099){var _0xcb3b87={},_0x5d99f5={},_0x1a17b7={'count':0x0,'rows':[]};var _0x3bf3d6=_[_0xd8a2('0x31')](db[_0xd8a2('0x32')]['rawAttributes'],function(_0x5ec1b0){return{'name':_0x5ec1b0[_0xd8a2('0x33')],'type':_0x5ec1b0['type'][_0xd8a2('0x34')]};});_0x5d99f5[_0xd8a2('0x35')]=_[_0xd8a2('0x31')](_0x3bf3d6,_0xd8a2('0x2e'));_0x5d99f5[_0xd8a2('0x36')]=_[_0xd8a2('0x37')](_0x4b0715['query']);_0x5d99f5['filters']=_[_0xd8a2('0x38')](_0x5d99f5[_0xd8a2('0x35')],_0x5d99f5['query']);_0xcb3b87[_0xd8a2('0x39')]=_[_0xd8a2('0x38')](_0x5d99f5['model'],qs[_0xd8a2('0x3a')](_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x3a')]));_0xcb3b87['attributes']=_0xcb3b87['attributes'][_0xd8a2('0x3b')]?_0xcb3b87[_0xd8a2('0x39')]:_0x5d99f5[_0xd8a2('0x35')];if(!_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x3c')](_0xd8a2('0x3d'))){_0xcb3b87['limit']=qs[_0xd8a2('0x22')](_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x22')]);_0xcb3b87[_0xd8a2('0x20')]=qs[_0xd8a2('0x20')](_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x20')]);}_0xcb3b87[_0xd8a2('0x3e')]=qs[_0xd8a2('0x3f')](_0x4b0715[_0xd8a2('0x36')]['sort']);_0xcb3b87[_0xd8a2('0x40')]=qs[_0xd8a2('0x41')](_['pick'](_0x4b0715['query'],_0x5d99f5[_0xd8a2('0x41')]),_0x3bf3d6);if(_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x42')]){_0xcb3b87[_0xd8a2('0x40')]=_[_0xd8a2('0x43')](_0xcb3b87[_0xd8a2('0x40')],{'$or':_[_0xd8a2('0x31')](_0x3bf3d6,function(_0x3cbf18){if(_0x3cbf18[_0xd8a2('0x44')]!==_0xd8a2('0x45')){var _0x3f131d={};_0x3f131d[_0x3cbf18[_0xd8a2('0x2e')]]={'$like':'%'+_0x4b0715['query'][_0xd8a2('0x42')]+'%'};return _0x3f131d;}})});}_0xcb3b87=_[_0xd8a2('0x43')]({},_0xcb3b87,_0x4b0715[_0xd8a2('0x46')]);var _0x4fc60a={'where':_0xcb3b87[_0xd8a2('0x40')]};return db[_0xd8a2('0x32')][_0xd8a2('0x23')](_0x4fc60a)[_0xd8a2('0x27')](function(_0x4c832f){_0x1a17b7[_0xd8a2('0x23')]=_0x4c832f;if(_0x4b0715['query'][_0xd8a2('0x47')]){_0xcb3b87['include']=[{'all':!![]}];}return db[_0xd8a2('0x32')][_0xd8a2('0x48')](_0xcb3b87);})[_0xd8a2('0x27')](function(_0x5cdcd4){_0x1a17b7[_0xd8a2('0x49')]=_0x5cdcd4;return _0x1a17b7;})[_0xd8a2('0x27')](respondWithFilteredResult(_0x448099,_0xcb3b87))[_0xd8a2('0x4a')](handleError(_0x448099,null));};exports[_0xd8a2('0x4b')]=function(_0x1bf630,_0x14f729){var _0x223cc2={'raw':!![],'where':{'id':_0x1bf630[_0xd8a2('0x4c')]['id']}},_0x7f3b41={};_0x7f3b41['model']=_['keys'](db[_0xd8a2('0x32')][_0xd8a2('0x4d')]);_0x7f3b41[_0xd8a2('0x36')]=_['keys'](_0x1bf630[_0xd8a2('0x36')]);_0x7f3b41[_0xd8a2('0x41')]=_[_0xd8a2('0x38')](_0x7f3b41[_0xd8a2('0x35')],_0x7f3b41[_0xd8a2('0x36')]);_0x223cc2['attributes']=_[_0xd8a2('0x38')](_0x7f3b41[_0xd8a2('0x35')],qs[_0xd8a2('0x3a')](_0x1bf630[_0xd8a2('0x36')][_0xd8a2('0x3a')]));_0x223cc2[_0xd8a2('0x39')]=_0x223cc2[_0xd8a2('0x39')]['length']?_0x223cc2[_0xd8a2('0x39')]:_0x7f3b41[_0xd8a2('0x35')];if(_0x1bf630['query'][_0xd8a2('0x47')]){_0x223cc2['include']=[{'all':!![]}];}_0x223cc2=_['merge']({},_0x223cc2,_0x1bf630[_0xd8a2('0x46')]);return db['FaxQueue'][_0xd8a2('0x4e')](_0x223cc2)[_0xd8a2('0x27')](handleEntityNotFound(_0x14f729,null))[_0xd8a2('0x27')](respondWithResult(_0x14f729,null))[_0xd8a2('0x4a')](handleError(_0x14f729,null));};exports[_0xd8a2('0x4f')]=function(_0x2e5a32,_0x4161ac){return db['FaxQueue'][_0xd8a2('0x4f')](_0x2e5a32[_0xd8a2('0x50')],{})[_0xd8a2('0x27')](function(_0x2668a4){var _0x56f49b=_0x2e5a32[_0xd8a2('0x51')][_0xd8a2('0x29')]({'plain':!![]});if(!_0x56f49b)throw new Error(_0xd8a2('0x52'));if(_0x56f49b[_0xd8a2('0x53')]===_0xd8a2('0x51')){var _0x1abf60=_0x2668a4['get']({'plain':!![]});var _0x593ad0=_0xd8a2('0x54');return db[_0xd8a2('0x55')]['find']({'where':{'name':_0x593ad0,'userProfileId':_0x56f49b[_0xd8a2('0x56')]},'raw':!![]})[_0xd8a2('0x27')](function(_0x4710d2){if(_0x4710d2&&_0x4710d2[_0xd8a2('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x1abf60[_0xd8a2('0x2e')],'resourceId':_0x1abf60['id'],'type':_0x4710d2['name'],'sectionId':_0x4710d2['id']},{})[_0xd8a2('0x27')](function(){return _0x2668a4;});}else{return _0x2668a4;}})[_0xd8a2('0x4a')](function(_0x3aedba){logger['error'](_0xd8a2('0x58'),_0x3aedba);throw _0x3aedba;});}return _0x2668a4;})[_0xd8a2('0x27')](respondWithResult(_0x4161ac,0xc9))[_0xd8a2('0x4a')](handleError(_0x4161ac,null));};exports['update']=function(_0x36266d,_0x455f6c){if(_0x36266d[_0xd8a2('0x50')]['id']){delete _0x36266d[_0xd8a2('0x50')]['id'];}return db[_0xd8a2('0x32')][_0xd8a2('0x4e')]({'where':{'id':_0x36266d['params']['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x455f6c,null))['then'](saveUpdates(_0x36266d[_0xd8a2('0x50')],null))[_0xd8a2('0x27')](respondWithResult(_0x455f6c,null))[_0xd8a2('0x4a')](handleError(_0x455f6c,null));};exports['destroy']=function(_0x40a606,_0x57467f){return db[_0xd8a2('0x32')][_0xd8a2('0x4e')]({'where':{'id':_0x40a606[_0xd8a2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57467f,null))[_0xd8a2('0x27')](removeEntity(_0x57467f,null))['catch'](handleError(_0x57467f,null));};exports[_0xd8a2('0x59')]=function(_0x67b78b,_0x17d496){return db['FaxQueue'][_0xd8a2('0x59')]()[_0xd8a2('0x27')](respondWithResult(_0x17d496,null))[_0xd8a2('0x4a')](handleError(_0x17d496,null));};exports[_0xd8a2('0x5a')]=function(_0x3e105d,_0x1b0e3e,_0x1ca873){var _0x378b59={'raw':!![],'where':{}},_0x3995e1={},_0x3cd07d;return db[_0xd8a2('0x32')]['findOne']({'where':{'id':_0x3e105d[_0xd8a2('0x4c')]['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x1b0e3e,null))['then'](function(_0x2b9341){if(_0x2b9341){_0x3cd07d=_0x2b9341[_0xd8a2('0x29')]({'plain':!![]});_0x3995e1[_0xd8a2('0x35')]=_['keys'](db[_0xd8a2('0x5b')][_0xd8a2('0x4d')]);_0x3995e1[_0xd8a2('0x36')]=_[_0xd8a2('0x37')](_0x3e105d[_0xd8a2('0x36')]);_0x3995e1[_0xd8a2('0x41')]=_[_0xd8a2('0x38')](_0x3995e1[_0xd8a2('0x35')],_0x3995e1[_0xd8a2('0x36')]);_0x378b59['attributes']=_[_0xd8a2('0x38')](_0x3995e1[_0xd8a2('0x35')],qs[_0xd8a2('0x3a')](_0x3e105d[_0xd8a2('0x36')][_0xd8a2('0x3a')]));_0x378b59[_0xd8a2('0x39')]=_0x378b59[_0xd8a2('0x39')][_0xd8a2('0x3b')]?_0x378b59[_0xd8a2('0x39')]:_0x3995e1[_0xd8a2('0x35')];if(!_0x3e105d[_0xd8a2('0x36')][_0xd8a2('0x3c')]('nolimit')){_0x378b59[_0xd8a2('0x22')]=qs[_0xd8a2('0x22')](_0x3e105d[_0xd8a2('0x36')]['limit']);_0x378b59[_0xd8a2('0x20')]=qs[_0xd8a2('0x20')](_0x3e105d[_0xd8a2('0x36')][_0xd8a2('0x20')]);}_0x378b59[_0xd8a2('0x3e')]=qs['sort'](_0x3e105d['query'][_0xd8a2('0x3f')]);_0x378b59['where']=qs[_0xd8a2('0x41')](_[_0xd8a2('0x5c')](_0x3e105d[_0xd8a2('0x36')],_0x3995e1[_0xd8a2('0x41')]));_0x378b59[_0xd8a2('0x40')][_0xd8a2('0x5d')]=_0x2b9341['id'];if(_0x3e105d[_0xd8a2('0x36')][_0xd8a2('0x42')]){_0x378b59[_0xd8a2('0x40')]=_['merge'](_0x378b59[_0xd8a2('0x40')],{'$or':_['map'](_0x378b59[_0xd8a2('0x39')],function(_0x5078c6){var _0x29590b={};_0x29590b[_0x5078c6]={'$like':'%'+_0x3e105d[_0xd8a2('0x36')]['filter']+'%'};return _0x29590b;})});}_0x378b59=_[_0xd8a2('0x43')]({},_0x378b59,_0x3e105d[_0xd8a2('0x46')]);return db['UserFaxQueue']['findAll'](_0x378b59);}})[_0xd8a2('0x27')](function(_0x2cec3e){if(_0x2cec3e){return db[_0xd8a2('0x5e')][_0xd8a2('0x5f')]({'where':{'id':_[_0xd8a2('0x31')](_0x2cec3e,_0xd8a2('0x60')),'role':'agent'},'attributes':['id',_0xd8a2('0x2e'),_0xd8a2('0x61'),_0xd8a2('0x62'),_0xd8a2('0x63')]});}})[_0xd8a2('0x27')](function(_0xc2d0a9){if(_0xc2d0a9){return{'count':_0xc2d0a9[_0xd8a2('0x23')],'rows':_['map'](_0xc2d0a9[_0xd8a2('0x49')],function(_0x74f565){return{'membername':_0x74f565[_0xd8a2('0x2e')],'UserId':_0x74f565['id'],'queue_name':_0x3cd07d[_0xd8a2('0x2e')],'FaxQueueId':_0x3cd07d['id'],'interface':util['format'](_0xd8a2('0x64'),_0xd8a2('0x65'),_0x74f565['name']),'penalty':0x0,'paused':_0x74f565[_0xd8a2('0x61')],'createdAt':_0x74f565[_0xd8a2('0x63')],'updatedAt':_0x74f565[_0xd8a2('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd8a2('0x27')](respondWithFilteredResult(_0x1b0e3e,_0x378b59))[_0xd8a2('0x4a')](handleError(_0x1b0e3e,null));};exports[_0xd8a2('0x66')]=function(_0x2dbdee,_0x34df39,_0x274b8a){var _0x4b2df0={};var _0x4458c6={};var _0x13983b;var _0x2fffdd;return db[_0xd8a2('0x32')][_0xd8a2('0x67')]({'where':{'id':_0x2dbdee['params']['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x34df39,null))['then'](function(_0x22bb9d){if(_0x22bb9d){_0x13983b=_0x22bb9d;_0x4458c6[_0xd8a2('0x35')]=_[_0xd8a2('0x37')](db[_0xd8a2('0x68')][_0xd8a2('0x4d')]);_0x4458c6['query']=_[_0xd8a2('0x37')](_0x2dbdee['query']);_0x4458c6['filters']=_[_0xd8a2('0x38')](_0x4458c6[_0xd8a2('0x35')],_0x4458c6['query']);_0x4b2df0[_0xd8a2('0x39')]=_[_0xd8a2('0x38')](_0x4458c6[_0xd8a2('0x35')],qs[_0xd8a2('0x3a')](_0x2dbdee['query'][_0xd8a2('0x3a')]));_0x4b2df0[_0xd8a2('0x39')]=_0x4b2df0[_0xd8a2('0x39')][_0xd8a2('0x3b')]?_0x4b2df0[_0xd8a2('0x39')]:_0x4458c6[_0xd8a2('0x35')];_0x4b2df0[_0xd8a2('0x3e')]=qs[_0xd8a2('0x3f')](_0x2dbdee[_0xd8a2('0x36')][_0xd8a2('0x3f')]);_0x4b2df0[_0xd8a2('0x40')]=qs[_0xd8a2('0x41')](_[_0xd8a2('0x5c')](_0x2dbdee[_0xd8a2('0x36')],_0x4458c6['filters']));if(_0x2dbdee['query'][_0xd8a2('0x42')]){_0x4b2df0[_0xd8a2('0x40')]=_[_0xd8a2('0x43')](_0x4b2df0['where'],{'$or':_[_0xd8a2('0x31')](_0x4b2df0[_0xd8a2('0x39')],function(_0x4837ec){var _0x4e662a={};_0x4e662a[_0x4837ec]={'$like':'%'+_0x2dbdee[_0xd8a2('0x36')][_0xd8a2('0x42')]+'%'};return _0x4e662a;})});}_0x4b2df0=_[_0xd8a2('0x43')]({},_0x4b2df0,_0x2dbdee[_0xd8a2('0x46')]);return _0x13983b[_0xd8a2('0x66')](_0x4b2df0);}})[_0xd8a2('0x27')](function(_0x47b379){if(_0x47b379){_0x2fffdd=_0x47b379[_0xd8a2('0x3b')];if(!_0x2dbdee['query'][_0xd8a2('0x3c')](_0xd8a2('0x3d'))){_0x4b2df0[_0xd8a2('0x22')]=qs[_0xd8a2('0x22')](_0x2dbdee[_0xd8a2('0x36')]['limit']);_0x4b2df0[_0xd8a2('0x20')]=qs[_0xd8a2('0x20')](_0x2dbdee[_0xd8a2('0x36')][_0xd8a2('0x20')]);}return _0x13983b[_0xd8a2('0x66')](_0x4b2df0);}})[_0xd8a2('0x27')](function(_0x1e167d){if(_0x1e167d){return _0x1e167d?{'count':_0x2fffdd,'rows':_0x1e167d}:null;}})[_0xd8a2('0x27')](respondWithResult(_0x34df39,null))[_0xd8a2('0x4a')](handleError(_0x34df39,null));};exports[_0xd8a2('0x69')]=function(_0x9eb7ed,_0xd1ae6c,_0x4e7634){var _0x336b60=_0x9eb7ed['body'][_0xd8a2('0x6a')];return db['Team'][_0xd8a2('0x48')]({'where':{'id':_0x336b60},'attributes':['id'],'include':[{'model':db[_0xd8a2('0x5e')],'as':_0xd8a2('0x6b'),'attributes':['id',_0xd8a2('0x2e'),_0xd8a2('0x6c'),_0xd8a2('0x6d'),_0xd8a2('0x6e')],'raw':!![]}]})[_0xd8a2('0x27')](function(_0x2926b3){if(_0x2926b3){var _0x37e0b7=_[_0xd8a2('0x6f')](_0x2926b3,function(_0x107b77){var _0x2dcd4c=_0x107b77[_0xd8a2('0x29')]({'plain':!![]});return _0x2dcd4c[_0xd8a2('0x6b')];});return db['FaxQueue']['find']({'where':{'id':_0x9eb7ed[_0xd8a2('0x4c')]['id']}})[_0xd8a2('0x27')](function(_0x1e24ea){return db[_0xd8a2('0x70')][_0xd8a2('0x71')](function(_0x171909){return _0x1e24ea[_0xd8a2('0x69')](_0x336b60,{'transaction':_0x171909})[_0xd8a2('0x27')](function(){return BPromise[_0xd8a2('0x72')](_0x37e0b7,function(_0x16fda6){return db[_0xd8a2('0x5b')][_0xd8a2('0x73')]({'where':{'UserId':_0x16fda6['id'],'FaxQueueId':_0x9eb7ed[_0xd8a2('0x4c')]['id']},'transaction':_0x171909});});})[_0xd8a2('0x27')](function(){_0x37e0b7[_0xd8a2('0x74')](function(_0x1eab78){socket[_0xd8a2('0x75')](_0xd8a2('0x76'),{'UserId':_0x1eab78['id'],'FaxQueueId':_0x1e24ea['id']});});});});});}})[_0xd8a2('0x27')](respondWithStatusCode(_0xd1ae6c,null))[_0xd8a2('0x4a')](handleError(_0xd1ae6c,null));};exports['removeTeams']=function(_0x5ec354,_0x19f4f2,_0x395f50){return db['Team'][_0xd8a2('0x48')]({'where':{'id':_0x5ec354[_0xd8a2('0x36')][_0xd8a2('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd8a2('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd8a2('0x27')](handleEntityNotFound(_0x19f4f2,null))[_0xd8a2('0x27')](function(_0x46fd6c){var _0x14e91e=_['map'](_0x46fd6c,'id');var _0x9db56e=[];var _0xa655b=[];var _0x238bb3=squel[_0xd8a2('0x77')]();_0x238bb3['field'](_0xd8a2('0x78'))['from'](_0xd8a2('0x79'),'tq')[_0xd8a2('0x7a')](_0xd8a2('0x7b'),'ut',_0xd8a2('0x7c'))['where']('FaxQueueId\x20=\x20?',_0x5ec354[_0xd8a2('0x4c')]['id']);for(var _0x6bafc4=0x0;_0x6bafc4<_0x46fd6c[_0xd8a2('0x3b')];_0x6bafc4+=0x1){let _0x173065=_0x46fd6c[_0x6bafc4];for(var _0x301d2e=0x0;_0x301d2e<_0x173065[_0xd8a2('0x6b')]['length'];_0x301d2e+=0x1){let _0x138700=_0x173065[_0xd8a2('0x6b')][_0x301d2e];var _0x3e661f=_0x238bb3[_0xd8a2('0x7d')]();_0x3e661f[_0xd8a2('0x40')](_0xd8a2('0x7e'),_0x138700['id']);_0xa655b[_0xd8a2('0x7f')](db[_0xd8a2('0x70')]['query'](_0x3e661f[_0xd8a2('0x80')](),{'type':db['sequelize'][_0xd8a2('0x81')][_0xd8a2('0x82')]})[_0xd8a2('0x27')](function(_0x15d4de){if(_0x15d4de[_0xd8a2('0x3b')]===0x1){return _0x138700['id'];}else{var _0x4d0b15=_[_0xd8a2('0x83')](_[_0xd8a2('0x31')](_0x15d4de,_0xd8a2('0x84')),function(_0x3dfa65){return _[_0xd8a2('0x85')](_0x14e91e,_0x3dfa65);});if(_0x4d0b15){return _0x138700['id'];}}}));}}return BPromise[_0xd8a2('0x86')](_0xa655b)[_0xd8a2('0x27')](function(_0x9c9581){_0x9db56e=_(_0x9db56e)[_0xd8a2('0x87')](_0x9c9581)[_0xd8a2('0x88')]()[_0xd8a2('0x89')]();return db[_0xd8a2('0x32')][_0xd8a2('0x4e')]({'where':{'id':_0x5ec354['params']['id']}})[_0xd8a2('0x27')](function(_0x4f23c0){return db[_0xd8a2('0x70')]['transaction'](function(_0x43f6bc){return _0x4f23c0['removeTeams'](_0x5ec354[_0xd8a2('0x36')][_0xd8a2('0x6a')],{'transaction':_0x43f6bc})[_0xd8a2('0x27')](function(){if(!_[_0xd8a2('0x8a')](_0x9db56e)){return _0x4f23c0[_0xd8a2('0x8b')](_0x9db56e,{'transaction':_0x43f6bc});}})[_0xd8a2('0x27')](function(){_0x9db56e['forEach'](function(_0x329183){socket['emit']('userFaxQueue:remove',{'UserId':_0x329183,'FaxQueueId':_0x4f23c0['id']});});});});});});})['then'](respondWithStatusCode(_0x19f4f2,null))['catch'](handleError(_0x19f4f2,null));};exports['addAgents']=function(_0x2623f9,_0x1020c7,_0x25c132){return db[_0xd8a2('0x32')][_0xd8a2('0x4e')]({'where':{'id':_0x2623f9[_0xd8a2('0x4c')]['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x1020c7,null))[_0xd8a2('0x27')](function(_0x56ea16){if(_0x56ea16){return _0x56ea16[_0xd8a2('0x8c')](_0x2623f9[_0xd8a2('0x50')]['ids'],_[_0xd8a2('0x8d')](_0x2623f9[_0xd8a2('0x50')],[_0xd8a2('0x6a'),'id'])||{})['spread'](function(_0x5da61e){for(var _0x504eef=0x0;_0x504eef<_0x2623f9['body'][_0xd8a2('0x6a')][_0xd8a2('0x3b')];_0x504eef+=0x1){socket['emit'](_0xd8a2('0x76'),{'UserId':Number(_0x2623f9[_0xd8a2('0x50')]['ids'][_0x504eef]),'FaxQueueId':Number(_0x2623f9[_0xd8a2('0x4c')]['id'])});}return _0x5da61e;});}})['then'](respondWithResult(_0x1020c7,null))['catch'](handleError(_0x1020c7,null));};exports['removeAgents']=function(_0x18d394,_0x46d605,_0x9b3528){return db['FaxQueue'][_0xd8a2('0x4e')]({'where':{'id':_0x18d394['params']['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x46d605,null))[_0xd8a2('0x27')](function(_0xe84a12){if(_0xe84a12){return _0xe84a12[_0xd8a2('0x8b')](_0x18d394[_0xd8a2('0x36')][_0xd8a2('0x6a')])[_0xd8a2('0x27')](function(){if(_[_0xd8a2('0x8e')](_0x18d394[_0xd8a2('0x36')][_0xd8a2('0x6a')])){for(var _0x3db6e7=0x0;_0x3db6e7<_0x18d394[_0xd8a2('0x36')][_0xd8a2('0x6a')][_0xd8a2('0x3b')];_0x3db6e7+=0x1){socket[_0xd8a2('0x75')](_0xd8a2('0x8f'),{'UserId':Number(_0x18d394[_0xd8a2('0x36')][_0xd8a2('0x6a')][_0x3db6e7]),'FaxQueueId':Number(_0x18d394[_0xd8a2('0x4c')]['id'])});}}else{socket[_0xd8a2('0x75')]('userFaxQueue:remove',{'UserId':Number(_0x18d394[_0xd8a2('0x36')]['ids']),'FaxQueueId':Number(_0x18d394['params']['id'])});}});}})[_0xd8a2('0x27')](respondWithStatusCode(_0x46d605,null))[_0xd8a2('0x4a')](handleError(_0x46d605,null));};exports[_0xd8a2('0x90')]=function(_0x45336e,_0x56da6a,_0x5397d2){var _0x50b9ba={};var _0x410259={};var _0x442bf1;var _0x2516b5;return db[_0xd8a2('0x32')][_0xd8a2('0x67')]({'where':{'id':_0x45336e['params']['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x56da6a,null))['then'](function(_0x567c6f){if(_0x567c6f){_0x442bf1=_0x567c6f;_0x410259[_0xd8a2('0x35')]=_[_0xd8a2('0x37')](db['User'][_0xd8a2('0x4d')]);_0x410259[_0xd8a2('0x36')]=_[_0xd8a2('0x37')](_0x45336e[_0xd8a2('0x36')]);_0x410259[_0xd8a2('0x41')]=_[_0xd8a2('0x38')](_0x410259[_0xd8a2('0x35')],_0x410259[_0xd8a2('0x36')]);_0x50b9ba[_0xd8a2('0x39')]=_[_0xd8a2('0x38')](_0x410259[_0xd8a2('0x35')],qs[_0xd8a2('0x3a')](_0x45336e['query'][_0xd8a2('0x3a')]));_0x50b9ba['attributes']=_0x50b9ba[_0xd8a2('0x39')][_0xd8a2('0x3b')]?_0x50b9ba[_0xd8a2('0x39')]:_0x410259[_0xd8a2('0x35')];_0x50b9ba[_0xd8a2('0x3e')]=qs[_0xd8a2('0x3f')](_0x45336e['query'][_0xd8a2('0x3f')]);_0x50b9ba['where']=qs[_0xd8a2('0x41')](_[_0xd8a2('0x5c')](_0x45336e[_0xd8a2('0x36')],_0x410259[_0xd8a2('0x41')]));if(_0x45336e[_0xd8a2('0x36')]['filter']){_0x50b9ba['where']=_[_0xd8a2('0x43')](_0x50b9ba[_0xd8a2('0x40')],{'$or':_[_0xd8a2('0x31')](_0x50b9ba[_0xd8a2('0x39')],function(_0x58f27c){var _0x1b306b={};_0x1b306b[_0x58f27c]={'$like':'%'+_0x45336e['query'][_0xd8a2('0x42')]+'%'};return _0x1b306b;})});}_0x50b9ba=_[_0xd8a2('0x43')]({},_0x50b9ba,_0x45336e[_0xd8a2('0x46')]);return _0x442bf1[_0xd8a2('0x90')](_0x50b9ba);}})[_0xd8a2('0x27')](function(_0x546b37){if(_0x546b37){_0x2516b5=_0x546b37['length'];if(!_0x45336e[_0xd8a2('0x36')][_0xd8a2('0x3c')](_0xd8a2('0x3d'))){_0x50b9ba[_0xd8a2('0x22')]=qs[_0xd8a2('0x22')](_0x45336e[_0xd8a2('0x36')][_0xd8a2('0x22')]);_0x50b9ba[_0xd8a2('0x20')]=qs[_0xd8a2('0x20')](_0x45336e[_0xd8a2('0x36')][_0xd8a2('0x20')]);}return _0x442bf1[_0xd8a2('0x90')](_0x50b9ba);}})[_0xd8a2('0x27')](function(_0x504b88){if(_0x504b88){return _0x504b88?{'count':_0x2516b5,'rows':_0x504b88}:null;}})[_0xd8a2('0x27')](respondWithResult(_0x56da6a,null))[_0xd8a2('0x4a')](handleError(_0x56da6a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 66ca0f8..0c53b4f 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 _0x1108=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0xef5c9f,_0x155ab7){var _0x4a7ed3=function(_0x232908){while(--_0x232908){_0xef5c9f['push'](_0xef5c9f['shift']());}};_0x4a7ed3(++_0x155ab7);}(_0x1108,0x10a));var _0x8110=function(_0x5ece84,_0xc06c9f){_0x5ece84=_0x5ece84-0x0;var _0x2a12c4=_0x1108[_0x5ece84];return _0x2a12c4;};'use strict';var EventEmitter=require(_0x8110('0x0'));var FaxQueue=require(_0x8110('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8110('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8110('0x3'),'afterDestroy':_0x8110('0x4')};function emitEvent(_0x34bc24){return function(_0x5a7fec,_0x2709d3,_0x4f4311){FaxQueueEvents['emit'](_0x34bc24+':'+_0x5a7fec['id'],_0x5a7fec);FaxQueueEvents[_0x8110('0x5')](_0x34bc24,_0x5a7fec);_0x4f4311(null);};}for(var e in events){if(events[_0x8110('0x6')](e)){var event=events[e];FaxQueue[_0x8110('0x7')](e,emitEvent(event));}}module[_0x8110('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xb6e4=['hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb6e4,0x11a));var _0x4b6e=function(_0x1a0ad9,_0x5a820d){_0x1a0ad9=_0x1a0ad9-0x0;var _0x285395=_0xb6e4[_0x1a0ad9];return _0x285395;};'use strict';var EventEmitter=require(_0x4b6e('0x0'));var FaxQueue=require(_0x4b6e('0x1'))['db'][_0x4b6e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4b6e('0x3')](0x0);var events={'afterCreate':_0x4b6e('0x4'),'afterUpdate':_0x4b6e('0x5'),'afterDestroy':_0x4b6e('0x6')};function emitEvent(_0x501653){return function(_0x1cf836,_0x392ad7,_0x34a068){FaxQueueEvents[_0x4b6e('0x7')](_0x501653+':'+_0x1cf836['id'],_0x1cf836);FaxQueueEvents[_0x4b6e('0x7')](_0x501653,_0x1cf836);_0x34a068(null);};}for(var e in events){if(events[_0x4b6e('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x4b6e('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4220538..efabe38 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 _0x88e7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxQueue','fax_queues','lodash','util','api','moment'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x88e7,0xbf));var _0x788e=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x88e7[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x788e('0x0'));var util=require(_0x788e('0x1'));var logger=require('../../config/logger')(_0x788e('0x2'));var moment=require(_0x788e('0x3'));var BPromise=require(_0x788e('0x4'));var rp=require(_0x788e('0x5'));var fs=require('fs');var path=require(_0x788e('0x6'));var rimraf=require(_0x788e('0x7'));var config=require(_0x788e('0x8'));var attributes=require('./faxQueue.attributes');module[_0x788e('0x9')]=function(_0x479e4b,_0x3d6ae2){return _0x479e4b[_0x788e('0xa')](_0x788e('0xb'),attributes,{'tableName':_0x788e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70b3=['./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4249d6,_0x788291){var _0x201616=function(_0x471df1){while(--_0x471df1){_0x4249d6['push'](_0x4249d6['shift']());}};_0x201616(++_0x788291);}(_0x70b3,0x1a8));var _0x370b=function(_0x447685,_0x1defd0){_0x447685=_0x447685-0x0;var _0x2222f4=_0x70b3[_0x447685];return _0x2222f4;};'use strict';var _=require(_0x370b('0x0'));var util=require(_0x370b('0x1'));var logger=require(_0x370b('0x2'))(_0x370b('0x3'));var moment=require('moment');var BPromise=require(_0x370b('0x4'));var rp=require(_0x370b('0x5'));var fs=require('fs');var path=require(_0x370b('0x6'));var rimraf=require(_0x370b('0x7'));var config=require('../../config/environment');var attributes=require(_0x370b('0x8'));module[_0x370b('0x9')]=function(_0x234734,_0xc3102f){return _0x234734['define'](_0x370b('0xa'),attributes,{'tableName':_0x370b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index a49b14a..75fab57 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 _0xfc1f=['GetFaxQueue','ShowFaxQueue','FaxQueue','where','lodash','moment','bluebird','randomstring','rpc','../../config/environment','client','http','defaults','socket.io-emitter','redis','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','include','model','map','attributes'];(function(_0xce0e8f,_0x2baa85){var _0x21e9d6=function(_0x41412e){while(--_0x41412e){_0xce0e8f['push'](_0xce0e8f['shift']());}};_0x21e9d6(++_0x2baa85);}(_0xfc1f,0x1be));var _0xffc1=function(_0x272130,_0x766a1c){_0x272130=_0x272130-0x0;var _0x1c6100=_0xfc1f[_0x272130];return _0x1c6100;};'use strict';var _=require(_0xffc1('0x0'));var util=require('util');var moment=require(_0xffc1('0x1'));var BPromise=require(_0xffc1('0x2'));var rs=require(_0xffc1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xffc1('0x4'));var config=require(_0xffc1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xffc1('0x6')][_0xffc1('0x7')]({'port':0x232a});config['redis']=_[_0xffc1('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xffc1('0x9'))(new Redis(config[_0xffc1('0xa')]));require('./faxQueue.socket')[_0xffc1('0xb')](socket);function respondWithRpcPromise(_0x33e0f9,_0x3aae77,_0x40ff4f){return new BPromise(function(_0x5cacbd,_0x36868d){return client[_0xffc1('0xc')](_0x33e0f9,_0x40ff4f)[_0xffc1('0xd')](function(_0x3abe72){logger[_0xffc1('0xe')](_0xffc1('0xf'),_0x3aae77,_0xffc1('0x10'));logger[_0xffc1('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3aae77,_0xffc1('0x10'),JSON[_0xffc1('0x12')](_0x3abe72));if(_0x3abe72[_0xffc1('0x13')]){if(_0x3abe72[_0xffc1('0x13')][_0xffc1('0x14')]===0x1f4){logger[_0xffc1('0x13')](_0xffc1('0xf'),_0x3aae77,_0x3abe72['error'][_0xffc1('0x15')]);return _0x36868d(_0x3abe72[_0xffc1('0x13')][_0xffc1('0x15')]);}logger[_0xffc1('0x13')](_0xffc1('0xf'),_0x3aae77,_0x3abe72[_0xffc1('0x13')][_0xffc1('0x15')]);return _0x5cacbd(_0x3abe72[_0xffc1('0x13')][_0xffc1('0x15')]);}else{logger[_0xffc1('0xe')](_0xffc1('0xf'),_0x3aae77,_0xffc1('0x10'));_0x5cacbd(_0x3abe72[_0xffc1('0x16')][_0xffc1('0x15')]);}})[_0xffc1('0x17')](function(_0x598e8a){logger[_0xffc1('0x13')](_0xffc1('0xf'),_0x3aae77,_0x598e8a);_0x36868d(_0x598e8a);});});}exports['GetFaxQueue']=function(_0x11a677){var _0x1b284e=this;return new Promise(function(_0x3bff94,_0x28b69e){return db['FaxQueue']['findAll']({'raw':_0x11a677[_0xffc1('0x18')]?_0x11a677['options'][_0xffc1('0x19')]===undefined?!![]:![]:!![],'where':_0x11a677[_0xffc1('0x18')]?_0x11a677[_0xffc1('0x18')]['where']||null:null,'attributes':_0x11a677[_0xffc1('0x18')]?_0x11a677['options']['attributes']||null:null,'limit':_0x11a677['options']?_0x11a677[_0xffc1('0x18')]['limit']||null:null,'include':_0x11a677[_0xffc1('0x18')]?_0x11a677['options'][_0xffc1('0x1a')]?_['map'](_0x11a677['options'][_0xffc1('0x1a')],function(_0x51b0c2){return{'model':db[_0x51b0c2[_0xffc1('0x1b')]],'as':_0x51b0c2['as'],'attributes':_0x51b0c2['attributes'],'include':_0x51b0c2[_0xffc1('0x1a')]?_[_0xffc1('0x1c')](_0x51b0c2[_0xffc1('0x1a')],function(_0x10c436){return{'model':db[_0x10c436[_0xffc1('0x1b')]],'as':_0x10c436['as'],'attributes':_0x10c436['attributes'],'include':_0x10c436[_0xffc1('0x1a')]?_[_0xffc1('0x1c')](_0x10c436[_0xffc1('0x1a')],function(_0x354251){return{'model':db[_0x354251['model']],'as':_0x354251['as'],'attributes':_0x354251[_0xffc1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xffc1('0xd')](function(_0xcd8cbb){logger[_0xffc1('0xe')](_0xffc1('0x1e'),_0x11a677);logger[_0xffc1('0x11')](_0xffc1('0x1e'),_0x11a677,JSON[_0xffc1('0x12')](_0xcd8cbb));_0x3bff94(_0xcd8cbb);})[_0xffc1('0x17')](function(_0x396922){logger[_0xffc1('0x13')]('GetFaxQueue',_0x396922[_0xffc1('0x15')],_0x11a677);_0x28b69e(_0x1b284e['error'](0x1f4,_0x396922[_0xffc1('0x15')]));});});};exports[_0xffc1('0x1f')]=function(_0x112190){var _0x4fb3bf=this;return new Promise(function(_0x162799,_0x1af8b1){return db[_0xffc1('0x20')]['find']({'raw':_0x112190[_0xffc1('0x18')]?_0x112190[_0xffc1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x112190[_0xffc1('0x18')]?_0x112190[_0xffc1('0x18')][_0xffc1('0x21')]||null:null,'attributes':_0x112190[_0xffc1('0x18')]?_0x112190['options']['attributes']||null:null,'include':_0x112190[_0xffc1('0x18')]?_0x112190[_0xffc1('0x18')][_0xffc1('0x1a')]?_['map'](_0x112190[_0xffc1('0x18')][_0xffc1('0x1a')],function(_0x24a91e){return{'model':db[_0x24a91e[_0xffc1('0x1b')]],'as':_0x24a91e['as'],'attributes':_0x24a91e[_0xffc1('0x1d')],'include':_0x24a91e[_0xffc1('0x1a')]?_['map'](_0x24a91e[_0xffc1('0x1a')],function(_0x6e5c1){return{'model':db[_0x6e5c1[_0xffc1('0x1b')]],'as':_0x6e5c1['as'],'attributes':_0x6e5c1['attributes'],'include':_0x6e5c1['include']?_[_0xffc1('0x1c')](_0x6e5c1[_0xffc1('0x1a')],function(_0x40206a){return{'model':db[_0x40206a[_0xffc1('0x1b')]],'as':_0x40206a['as'],'attributes':_0x40206a[_0xffc1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdaa197){logger[_0xffc1('0xe')](_0xffc1('0x1f'),_0x112190);logger[_0xffc1('0x11')](_0xffc1('0x1f'),_0x112190,JSON['stringify'](_0xdaa197));_0x162799(_0xdaa197);})[_0xffc1('0x17')](function(_0x474699){logger[_0xffc1('0x13')]('ShowFaxQueue',_0x474699['message'],_0x112190);_0x1af8b1(_0x4fb3bf[_0xffc1('0x13')](0x1f4,_0x474699['message']));});});}; \ No newline at end of file +var _0x2b56=['message','result','GetFaxQueue','options','raw','where','attributes','include','map','model','catch','ShowFaxQueue','FaxQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','defaults','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','FaxQueue,\x20%s,\x20%s'];(function(_0x41f745,_0x4b5c4a){var _0x2cbbcb=function(_0x4d5c74){while(--_0x4d5c74){_0x41f745['push'](_0x41f745['shift']());}};_0x2cbbcb(++_0x4b5c4a);}(_0x2b56,0x180));var _0x62b5=function(_0x18e335,_0x283f27){_0x18e335=_0x18e335-0x0;var _0x1556b4=_0x2b56[_0x18e335];return _0x1556b4;};'use strict';var _=require('lodash');var util=require(_0x62b5('0x0'));var moment=require(_0x62b5('0x1'));var BPromise=require(_0x62b5('0x2'));var rs=require(_0x62b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62b5('0x4'))['db'];var utils=require(_0x62b5('0x5'));var logger=require('../../config/logger')(_0x62b5('0x6'));var config=require(_0x62b5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x62b5('0x8')]({'port':0x232a});config['redis']=_[_0x62b5('0x9')](config[_0x62b5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x62b5('0xb'))(new Redis(config[_0x62b5('0xa')]));require(_0x62b5('0xc'))[_0x62b5('0xd')](socket);function respondWithRpcPromise(_0x3c3612,_0x1497ed,_0x2c9b43){return new BPromise(function(_0x3f5006,_0x5af6bd){return client[_0x62b5('0xe')](_0x3c3612,_0x2c9b43)[_0x62b5('0xf')](function(_0x1e0e8a){logger[_0x62b5('0x10')]('FaxQueue,\x20%s,\x20%s',_0x1497ed,'request\x20sent');logger[_0x62b5('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1497ed,_0x62b5('0x12'),JSON[_0x62b5('0x13')](_0x1e0e8a));if(_0x1e0e8a['error']){if(_0x1e0e8a[_0x62b5('0x14')][_0x62b5('0x15')]===0x1f4){logger['error'](_0x62b5('0x16'),_0x1497ed,_0x1e0e8a[_0x62b5('0x14')]['message']);return _0x5af6bd(_0x1e0e8a[_0x62b5('0x14')][_0x62b5('0x17')]);}logger[_0x62b5('0x14')](_0x62b5('0x16'),_0x1497ed,_0x1e0e8a[_0x62b5('0x14')][_0x62b5('0x17')]);return _0x3f5006(_0x1e0e8a[_0x62b5('0x14')][_0x62b5('0x17')]);}else{logger[_0x62b5('0x10')]('FaxQueue,\x20%s,\x20%s',_0x1497ed,_0x62b5('0x12'));_0x3f5006(_0x1e0e8a[_0x62b5('0x18')][_0x62b5('0x17')]);}})['catch'](function(_0x4055ee){logger['error'](_0x62b5('0x16'),_0x1497ed,_0x4055ee);_0x5af6bd(_0x4055ee);});});}exports[_0x62b5('0x19')]=function(_0x4bbdcf){var _0x416b4e=this;return new Promise(function(_0x5e31e2,_0x2ff294){return db['FaxQueue']['findAll']({'raw':_0x4bbdcf[_0x62b5('0x1a')]?_0x4bbdcf[_0x62b5('0x1a')][_0x62b5('0x1b')]===undefined?!![]:![]:!![],'where':_0x4bbdcf[_0x62b5('0x1a')]?_0x4bbdcf['options'][_0x62b5('0x1c')]||null:null,'attributes':_0x4bbdcf[_0x62b5('0x1a')]?_0x4bbdcf['options'][_0x62b5('0x1d')]||null:null,'limit':_0x4bbdcf['options']?_0x4bbdcf[_0x62b5('0x1a')]['limit']||null:null,'include':_0x4bbdcf[_0x62b5('0x1a')]?_0x4bbdcf[_0x62b5('0x1a')][_0x62b5('0x1e')]?_[_0x62b5('0x1f')](_0x4bbdcf[_0x62b5('0x1a')][_0x62b5('0x1e')],function(_0x491219){return{'model':db[_0x491219[_0x62b5('0x20')]],'as':_0x491219['as'],'attributes':_0x491219['attributes'],'include':_0x491219[_0x62b5('0x1e')]?_[_0x62b5('0x1f')](_0x491219[_0x62b5('0x1e')],function(_0x5b3ea3){return{'model':db[_0x5b3ea3[_0x62b5('0x20')]],'as':_0x5b3ea3['as'],'attributes':_0x5b3ea3['attributes'],'include':_0x5b3ea3[_0x62b5('0x1e')]?_[_0x62b5('0x1f')](_0x5b3ea3[_0x62b5('0x1e')],function(_0x2832e9){return{'model':db[_0x2832e9[_0x62b5('0x20')]],'as':_0x2832e9['as'],'attributes':_0x2832e9[_0x62b5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x62b5('0xf')](function(_0x357677){logger[_0x62b5('0x10')](_0x62b5('0x19'),_0x4bbdcf);logger[_0x62b5('0x11')]('GetFaxQueue',_0x4bbdcf,JSON[_0x62b5('0x13')](_0x357677));_0x5e31e2(_0x357677);})[_0x62b5('0x21')](function(_0x3de351){logger[_0x62b5('0x14')](_0x62b5('0x19'),_0x3de351[_0x62b5('0x17')],_0x4bbdcf);_0x2ff294(_0x416b4e[_0x62b5('0x14')](0x1f4,_0x3de351[_0x62b5('0x17')]));});});};exports[_0x62b5('0x22')]=function(_0x2ba27a){var _0x1c8f95=this;return new Promise(function(_0x6ca665,_0x10f3d2){return db[_0x62b5('0x23')][_0x62b5('0x24')]({'raw':_0x2ba27a['options']?_0x2ba27a[_0x62b5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ba27a[_0x62b5('0x1a')]?_0x2ba27a['options'][_0x62b5('0x1c')]||null:null,'attributes':_0x2ba27a['options']?_0x2ba27a[_0x62b5('0x1a')][_0x62b5('0x1d')]||null:null,'include':_0x2ba27a[_0x62b5('0x1a')]?_0x2ba27a[_0x62b5('0x1a')]['include']?_[_0x62b5('0x1f')](_0x2ba27a[_0x62b5('0x1a')][_0x62b5('0x1e')],function(_0x404696){return{'model':db[_0x404696[_0x62b5('0x20')]],'as':_0x404696['as'],'attributes':_0x404696['attributes'],'include':_0x404696[_0x62b5('0x1e')]?_[_0x62b5('0x1f')](_0x404696[_0x62b5('0x1e')],function(_0x3db9d9){return{'model':db[_0x3db9d9[_0x62b5('0x20')]],'as':_0x3db9d9['as'],'attributes':_0x3db9d9[_0x62b5('0x1d')],'include':_0x3db9d9['include']?_[_0x62b5('0x1f')](_0x3db9d9[_0x62b5('0x1e')],function(_0x4ac049){return{'model':db[_0x4ac049[_0x62b5('0x20')]],'as':_0x4ac049['as'],'attributes':_0x4ac049[_0x62b5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20c9f6){logger[_0x62b5('0x10')]('ShowFaxQueue',_0x2ba27a);logger[_0x62b5('0x11')](_0x62b5('0x22'),_0x2ba27a,JSON[_0x62b5('0x13')](_0x20c9f6));_0x6ca665(_0x20c9f6);})[_0x62b5('0x21')](function(_0x4f11ae){logger[_0x62b5('0x14')](_0x62b5('0x22'),_0x4f11ae[_0x62b5('0x17')],_0x2ba27a);_0x10f3d2(_0x1c8f95['error'](0x1f4,_0x4f11ae['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7f6f31d..2cde891 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 _0x9eba=['removeListener','register','faxQueue:','./faxQueue.events','save','update','emit'];(function(_0x32ff3b,_0x287faa){var _0x2bc632=function(_0x545853){while(--_0x545853){_0x32ff3b['push'](_0x32ff3b['shift']());}};_0x2bc632(++_0x287faa);}(_0x9eba,0x106));var _0xa9eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9eba[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0xa9eb('0x0'));var events=[_0xa9eb('0x1'),'remove',_0xa9eb('0x2')];function createListener(_0x182cc0,_0x2eba1f){return function(_0x23d6cc){_0x2eba1f[_0xa9eb('0x3')](_0x182cc0,_0x23d6cc);};}function removeListener(_0x4aeedd,_0x132571){return function(){FaxQueueEvents[_0xa9eb('0x4')](_0x4aeedd,_0x132571);};}exports[_0xa9eb('0x5')]=function(_0x7a76ce){for(var _0x2e7050=0x0,_0x80ee39=events['length'];_0x2e7050<_0x80ee39;_0x2e7050++){var _0x92f41=events[_0x2e7050];var _0x164ae8=createListener(_0xa9eb('0x6')+_0x92f41,_0x7a76ce);FaxQueueEvents['on'](_0x92f41,_0x164ae8);}}; \ No newline at end of file +var _0x06da=['register','length','faxQueue:','remove','removeListener'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x06da,0x8f));var _0xa06d=function(_0xcafdb4,_0x302640){_0xcafdb4=_0xcafdb4-0x0;var _0x5d2775=_0x06da[_0xcafdb4];return _0x5d2775;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0xa06d('0x0'),'update'];function createListener(_0x1cdeaa,_0x5d8389){return function(_0xb26efc){_0x5d8389['emit'](_0x1cdeaa,_0xb26efc);};}function removeListener(_0x2b6fdd,_0x5a4590){return function(){FaxQueueEvents[_0xa06d('0x1')](_0x2b6fdd,_0x5a4590);};}exports[_0xa06d('0x2')]=function(_0x3c7035){for(var _0x5d4266=0x0,_0x3abe3f=events[_0xa06d('0x3')];_0x5d4266<_0x3abe3f;_0x5d4266++){var _0x21f2d4=events[_0x5d4266];var _0x25d5cb=createListener(_0xa06d('0x4')+_0x21f2d4,_0x3c7035);FaxQueueEvents['on'](_0x21f2d4,_0x25d5cb);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 645d336..ef7843d 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 _0x444e=['addAgents','put','update','delete','destroy','/:id/users','removeAgents','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getAgents','post'];(function(_0x3f7c6e,_0x454e70){var _0x252041=function(_0x10208c){while(--_0x10208c){_0x3f7c6e['push'](_0x3f7c6e['shift']());}};_0x252041(++_0x454e70);}(_0x444e,0xe8));var _0xe444=function(_0x4ebf98,_0x506ac4){_0x4ebf98=_0x4ebf98-0x0;var _0x180691=_0x444e[_0x4ebf98];return _0x180691;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var fs_extra=require(_0xe444('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var controller=require(_0xe444('0x6'));router[_0xe444('0x7')]('/',auth[_0xe444('0x8')](),controller[_0xe444('0x9')]);router['get'](_0xe444('0xa'),auth['isAuthenticated'](),controller[_0xe444('0xb')]);router['get'](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0xd')]);router['get']('/:id/members',auth[_0xe444('0x8')](),controller[_0xe444('0xe')]);router['get'](_0xe444('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0xe444('0x7')]('/:id/users',auth[_0xe444('0x8')](),controller[_0xe444('0x10')]);router['post']('/',auth[_0xe444('0x8')](),controller['create']);router['post'](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['addTeams']);router[_0xe444('0x11')]('/:id/users',auth[_0xe444('0x8')](),controller[_0xe444('0x12')]);router[_0xe444('0x13')](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0x14')]);router[_0xe444('0x15')](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0x16')]);router[_0xe444('0x15')](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['removeTeams']);router[_0xe444('0x15')](_0xe444('0x17'),auth[_0xe444('0x8')](),controller[_0xe444('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe2bc=['/:id/users','update','destroy','delete','removeTeams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xe2bc[_0x1cb18a];return _0x22442e;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var fs_extra=require(_0xce2b('0x4'));var auth=require(_0xce2b('0x5'));var interaction=require(_0xce2b('0x6'));var config=require('../../config/environment');var controller=require(_0xce2b('0x7'));router[_0xce2b('0x8')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xa')]);router[_0xce2b('0x8')]('/describe',auth[_0xce2b('0x9')](),controller[_0xce2b('0xb')]);router['get'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xd')]);router[_0xce2b('0x8')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xf')]);router[_0xce2b('0x8')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['getTeams']);router[_0xce2b('0x8')]('/:id/users',auth[_0xce2b('0x9')](),controller[_0xce2b('0x11')]);router[_0xce2b('0x12')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0x13')]);router[_0xce2b('0x12')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['addTeams']);router[_0xce2b('0x12')](_0xce2b('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x15')]);router['delete']('/:id',auth[_0xce2b('0x9')](),controller[_0xce2b('0x16')]);router[_0xce2b('0x17')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x18')]);router[_0xce2b('0x17')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 2bec386..f9ae699 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 _0xac4b=['moment','sequelize','exports','DATE','STRING'];(function(_0x2f1d2f,_0x527d85){var _0x2874cf=function(_0x3203df){while(--_0x3203df){_0x2f1d2f['push'](_0x2f1d2f['shift']());}};_0x2874cf(++_0x527d85);}(_0xac4b,0xb4));var _0xbac4=function(_0x5032c2,_0x159065){_0x5032c2=_0x5032c2-0x0;var _0x28a563=_0xac4b[_0x5032c2];return _0x28a563;};'use strict';var moment=require(_0xbac4('0x0'));var Sequelize=require(_0xbac4('0x1'));module[_0xbac4('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbac4('0x3')]},'leaveAt':{'type':Sequelize[_0xbac4('0x3')]},'acceptAt':{'type':Sequelize[_0xbac4('0x3')]},'exitAt':{'type':Sequelize[_0xbac4('0x3')]},'reason':{'type':Sequelize[_0xbac4('0x4')]}}; \ No newline at end of file +var _0x6704=['moment','sequelize','exports','STRING','DATE'];(function(_0x1b8b7f,_0x432d21){var _0x185697=function(_0x506600){while(--_0x506600){_0x1b8b7f['push'](_0x1b8b7f['shift']());}};_0x185697(++_0x432d21);}(_0x6704,0x127));var _0x4670=function(_0x400955,_0xd0898a){_0x400955=_0x400955-0x0;var _0x2466af=_0x6704[_0x400955];return _0x2466af;};'use strict';var moment=require(_0x4670('0x0'));var Sequelize=require(_0x4670('0x1'));module[_0x4670('0x2')]={'uniqueid':{'type':Sequelize[_0x4670('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4670('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4670('0x4')]},'acceptAt':{'type':Sequelize[_0x4670('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4670('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index db17dcb..7dfa07a 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 _0x13c0=['sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','then','destroy','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1e78bc,_0x31007a){var _0x2ab75b=function(_0x369400){while(--_0x369400){_0x1e78bc['push'](_0x1e78bc['shift']());}};_0x2ab75b(++_0x31007a);}(_0x13c0,0x79));var _0x013c=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x13c0[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x013c('0x0'));var rimraf=require(_0x013c('0x1'));var zipdir=require(_0x013c('0x2'));var jsonpatch=require(_0x013c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x013c('0x4'));var util=require(_0x013c('0x5'));var path=require(_0x013c('0x6'));var sox=require(_0x013c('0x7'));var csv=require(_0x013c('0x8'));var ejs=require(_0x013c('0x9'));var fs=require('fs');var fs_extra=require(_0x013c('0xa'));var _=require(_0x013c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x013c('0xc'));var toCsv=require(_0x013c('0x8'));var querystring=require('querystring');var Papa=require(_0x013c('0xd'));var Redis=require(_0x013c('0xe'));var authService=require(_0x013c('0xf'));var qs=require(_0x013c('0x10'));var as=require(_0x013c('0x11'));var hardwareService=require(_0x013c('0x12'));var logger=require(_0x013c('0x13'))(_0x013c('0x14'));var utils=require(_0x013c('0x15'));var config=require(_0x013c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xce456f,_0x4631c5){_0x4631c5=_0x4631c5||0xcc;return function(_0x1ee348){if(_0x1ee348){return _0xce456f[_0x013c('0x17')](_0x4631c5);}return _0xce456f['status'](_0x4631c5)[_0x013c('0x18')]();};}function respondWithResult(_0x2313de,_0xcfe81a){_0xcfe81a=_0xcfe81a||0xc8;return function(_0x17b085){if(_0x17b085){return _0x2313de[_0x013c('0x19')](_0xcfe81a)['json'](_0x17b085);}};}function respondWithFilteredResult(_0x307f34,_0x1c2e11){return function(_0x84244){if(_0x84244){var _0x92c3ca=typeof _0x1c2e11[_0x013c('0x1a')]===_0x013c('0x1b')&&typeof _0x1c2e11[_0x013c('0x1c')]===_0x013c('0x1b');var _0x246f11=_0x84244[_0x013c('0x1d')];var _0x34d59f=_0x92c3ca?0x0:_0x1c2e11[_0x013c('0x1a')];var _0x25eb26=_0x92c3ca?_0x84244['count']:_0x1c2e11['offset']+_0x1c2e11[_0x013c('0x1c')];var _0x153b0a;if(_0x25eb26>=_0x246f11){_0x25eb26=_0x246f11;_0x153b0a=0xc8;}else{_0x153b0a=0xce;}_0x307f34['status'](_0x153b0a);return _0x307f34[_0x013c('0x1e')](_0x013c('0x1f'),_0x34d59f+'-'+_0x25eb26+'/'+_0x246f11)[_0x013c('0x20')](_0x84244);}return null;};}function patchUpdates(_0x38bac2){return function(_0xb87452){try{jsonpatch['apply'](_0xb87452,_0x38bac2,!![]);}catch(_0xb039bc){return BPromise[_0x013c('0x21')](_0xb039bc);}return _0xb87452['save']();};}function saveUpdates(_0x1df9d2,_0x82f9f1){return function(_0x53fbbd){if(_0x53fbbd){return _0x53fbbd['update'](_0x1df9d2)[_0x013c('0x22')](function(_0x1996e6){return _0x1996e6;});}return null;};}function removeEntity(_0x2509f4,_0x447c0b){return function(_0x20aff2){if(_0x20aff2){return _0x20aff2[_0x013c('0x23')]()[_0x013c('0x22')](function(){_0x2509f4[_0x013c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x468fe7,_0x187fd4){return function(_0x1952d0){if(!_0x1952d0){_0x468fe7[_0x013c('0x17')](0x194);}return _0x1952d0;};}function handleError(_0x2c7a76,_0x3cd072){_0x3cd072=_0x3cd072||0x1f4;return function(_0x584ddf){logger[_0x013c('0x24')](_0x584ddf[_0x013c('0x25')]);if(_0x584ddf[_0x013c('0x26')]){delete _0x584ddf['name'];}_0x2c7a76[_0x013c('0x19')](_0x3cd072)['send'](_0x584ddf);};}exports[_0x013c('0x27')]=function(_0x455b88,_0x5534ee){var _0x353cb7={},_0x32da8c={},_0x16cdad={'count':0x0,'rows':[]};var _0x43dc43=_[_0x013c('0x28')](db[_0x013c('0x29')][_0x013c('0x2a')],function(_0x1f0aab){return{'name':_0x1f0aab[_0x013c('0x2b')],'type':_0x1f0aab[_0x013c('0x2c')]['key']};});_0x32da8c[_0x013c('0x2d')]=_[_0x013c('0x28')](_0x43dc43,_0x013c('0x26'));_0x32da8c[_0x013c('0x2e')]=_[_0x013c('0x2f')](_0x455b88['query']);_0x32da8c[_0x013c('0x30')]=_[_0x013c('0x31')](_0x32da8c[_0x013c('0x2d')],_0x32da8c[_0x013c('0x2e')]);_0x353cb7['attributes']=_['intersection'](_0x32da8c['model'],qs[_0x013c('0x32')](_0x455b88[_0x013c('0x2e')][_0x013c('0x32')]));_0x353cb7[_0x013c('0x33')]=_0x353cb7[_0x013c('0x33')][_0x013c('0x34')]?_0x353cb7[_0x013c('0x33')]:_0x32da8c[_0x013c('0x2d')];if(!_0x455b88[_0x013c('0x2e')][_0x013c('0x35')](_0x013c('0x36'))){_0x353cb7[_0x013c('0x1c')]=qs['limit'](_0x455b88['query'][_0x013c('0x1c')]);_0x353cb7[_0x013c('0x1a')]=qs[_0x013c('0x1a')](_0x455b88[_0x013c('0x2e')]['offset']);}_0x353cb7[_0x013c('0x37')]=qs[_0x013c('0x38')](_0x455b88[_0x013c('0x2e')][_0x013c('0x38')]);_0x353cb7['where']=qs[_0x013c('0x30')](_[_0x013c('0x39')](_0x455b88['query'],_0x32da8c[_0x013c('0x30')]),_0x43dc43);if(_0x455b88['query'][_0x013c('0x3a')]){_0x353cb7[_0x013c('0x3b')]=_[_0x013c('0x3c')](_0x353cb7[_0x013c('0x3b')],{'$or':_['map'](_0x43dc43,function(_0x3f2fda){if(_0x3f2fda[_0x013c('0x2c')]!==_0x013c('0x3d')){var _0x2f6044={};_0x2f6044[_0x3f2fda[_0x013c('0x26')]]={'$like':'%'+_0x455b88[_0x013c('0x2e')][_0x013c('0x3a')]+'%'};return _0x2f6044;}})});}_0x353cb7=_[_0x013c('0x3c')]({},_0x353cb7,_0x455b88[_0x013c('0x3e')]);var _0x4bd189={'where':_0x353cb7[_0x013c('0x3b')]};return db[_0x013c('0x29')]['count'](_0x4bd189)[_0x013c('0x22')](function(_0x1cf2e5){_0x16cdad['count']=_0x1cf2e5;if(_0x455b88[_0x013c('0x2e')][_0x013c('0x3f')]){_0x353cb7[_0x013c('0x40')]=[{'all':!![]}];}return db[_0x013c('0x29')][_0x013c('0x41')](_0x353cb7);})['then'](function(_0x3d0ffd){_0x16cdad['rows']=_0x3d0ffd;return _0x16cdad;})['then'](respondWithFilteredResult(_0x5534ee,_0x353cb7))['catch'](handleError(_0x5534ee,null));};exports['show']=function(_0xc25f45,_0x3d7790){var _0x370a0b={'raw':!![],'where':{'id':_0xc25f45[_0x013c('0x42')]['id']}},_0x49db0c={};_0x49db0c[_0x013c('0x2d')]=_[_0x013c('0x2f')](db[_0x013c('0x29')][_0x013c('0x2a')]);_0x49db0c['query']=_[_0x013c('0x2f')](_0xc25f45[_0x013c('0x2e')]);_0x49db0c['filters']=_['intersection'](_0x49db0c['model'],_0x49db0c['query']);_0x370a0b[_0x013c('0x33')]=_[_0x013c('0x31')](_0x49db0c['model'],qs[_0x013c('0x32')](_0xc25f45[_0x013c('0x2e')]['fields']));_0x370a0b[_0x013c('0x33')]=_0x370a0b[_0x013c('0x33')][_0x013c('0x34')]?_0x370a0b[_0x013c('0x33')]:_0x49db0c[_0x013c('0x2d')];if(_0xc25f45[_0x013c('0x2e')][_0x013c('0x3f')]){_0x370a0b[_0x013c('0x40')]=[{'all':!![]}];}_0x370a0b=_['merge']({},_0x370a0b,_0xc25f45[_0x013c('0x3e')]);return db['FaxQueueReport'][_0x013c('0x43')](_0x370a0b)['then'](handleEntityNotFound(_0x3d7790,null))['then'](respondWithResult(_0x3d7790,null))[_0x013c('0x44')](handleError(_0x3d7790,null));};exports['create']=function(_0x21cc50,_0x35f81){return db[_0x013c('0x29')][_0x013c('0x45')](_0x21cc50['body'],{})['then'](respondWithResult(_0x35f81,0xc9))['catch'](handleError(_0x35f81,null));};exports['update']=function(_0x7f4350,_0x5daeda){if(_0x7f4350[_0x013c('0x46')]['id']){delete _0x7f4350[_0x013c('0x46')]['id'];}return db[_0x013c('0x29')][_0x013c('0x43')]({'where':{'id':_0x7f4350[_0x013c('0x42')]['id']}})[_0x013c('0x22')](handleEntityNotFound(_0x5daeda,null))[_0x013c('0x22')](saveUpdates(_0x7f4350[_0x013c('0x46')],null))[_0x013c('0x22')](respondWithResult(_0x5daeda,null))['catch'](handleError(_0x5daeda,null));};exports[_0x013c('0x23')]=function(_0x5163d8,_0x4ebad8){return db[_0x013c('0x29')]['find']({'where':{'id':_0x5163d8['params']['id']}})[_0x013c('0x22')](handleEntityNotFound(_0x4ebad8,null))[_0x013c('0x22')](removeEntity(_0x4ebad8,null))['catch'](handleError(_0x4ebad8,null));};exports[_0x013c('0x47')]=function(_0x369e6a,_0x33bbe8){return db['FaxQueueReport'][_0x013c('0x47')]()[_0x013c('0x22')](respondWithResult(_0x33bbe8,null))[_0x013c('0x44')](handleError(_0x33bbe8,null));}; \ No newline at end of file +var _0xd4bd=['limit','count','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x4bda95,_0x9ccebb){_0x4bda95=_0x4bda95-0x0;var _0x37490e=_0xd4bd[_0x4bda95];return _0x37490e;};'use strict';var emlformat=require(_0xdd4b('0x0'));var rimraf=require(_0xdd4b('0x1'));var zipdir=require(_0xdd4b('0x2'));var jsonpatch=require(_0xdd4b('0x3'));var rp=require(_0xdd4b('0x4'));var moment=require('moment');var BPromise=require(_0xdd4b('0x5'));var Mustache=require(_0xdd4b('0x6'));var util=require(_0xdd4b('0x7'));var path=require(_0xdd4b('0x8'));var sox=require(_0xdd4b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd4b('0xa'));var _=require('lodash');var squel=require(_0xdd4b('0xb'));var crypto=require(_0xdd4b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd4b('0xd'));var querystring=require(_0xdd4b('0xe'));var Papa=require('papaparse');var Redis=require(_0xdd4b('0xf'));var authService=require(_0xdd4b('0x10'));var qs=require(_0xdd4b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd4b('0x12'));var logger=require(_0xdd4b('0x13'))(_0xdd4b('0x14'));var utils=require(_0xdd4b('0x15'));var config=require(_0xdd4b('0x16'));var licenseUtil=require(_0xdd4b('0x17'));var db=require(_0xdd4b('0x18'))['db'];function respondWithStatusCode(_0x115e70,_0x594339){_0x594339=_0x594339||0xcc;return function(_0x2a88ab){if(_0x2a88ab){return _0x115e70['sendStatus'](_0x594339);}return _0x115e70[_0xdd4b('0x19')](_0x594339)[_0xdd4b('0x1a')]();};}function respondWithResult(_0x2dc062,_0x5dc694){_0x5dc694=_0x5dc694||0xc8;return function(_0x327f9e){if(_0x327f9e){return _0x2dc062[_0xdd4b('0x19')](_0x5dc694)['json'](_0x327f9e);}};}function respondWithFilteredResult(_0x5ccc78,_0x3a7f2a){return function(_0x368842){if(_0x368842){var _0x39f053=typeof _0x3a7f2a[_0xdd4b('0x1b')]===_0xdd4b('0x1c')&&typeof _0x3a7f2a[_0xdd4b('0x1d')]===_0xdd4b('0x1c');var _0x5817fa=_0x368842[_0xdd4b('0x1e')];var _0x423e39=_0x39f053?0x0:_0x3a7f2a[_0xdd4b('0x1b')];var _0x5331d7=_0x39f053?_0x368842[_0xdd4b('0x1e')]:_0x3a7f2a['offset']+_0x3a7f2a['limit'];var _0x3b0232;if(_0x5331d7>=_0x5817fa){_0x5331d7=_0x5817fa;_0x3b0232=0xc8;}else{_0x3b0232=0xce;}_0x5ccc78[_0xdd4b('0x19')](_0x3b0232);return _0x5ccc78['set'](_0xdd4b('0x1f'),_0x423e39+'-'+_0x5331d7+'/'+_0x5817fa)[_0xdd4b('0x20')](_0x368842);}return null;};}function patchUpdates(_0xf6eb51){return function(_0x1fbbe7){try{jsonpatch[_0xdd4b('0x21')](_0x1fbbe7,_0xf6eb51,!![]);}catch(_0x5a19ca){return BPromise[_0xdd4b('0x22')](_0x5a19ca);}return _0x1fbbe7['save']();};}function saveUpdates(_0x48e75e,_0x2325fe){return function(_0x26c32b){if(_0x26c32b){return _0x26c32b[_0xdd4b('0x23')](_0x48e75e)['then'](function(_0xa66301){return _0xa66301;});}return null;};}function removeEntity(_0x1ba012,_0x1b55b5){return function(_0x333a3f){if(_0x333a3f){return _0x333a3f[_0xdd4b('0x24')]()[_0xdd4b('0x25')](function(){_0x1ba012['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4800de,_0xd6bfcb){return function(_0x304f46){if(!_0x304f46){_0x4800de['sendStatus'](0x194);}return _0x304f46;};}function handleError(_0x4d9896,_0x2d4f73){_0x2d4f73=_0x2d4f73||0x1f4;return function(_0x24fa06){logger[_0xdd4b('0x26')](_0x24fa06[_0xdd4b('0x27')]);if(_0x24fa06[_0xdd4b('0x28')]){delete _0x24fa06['name'];}_0x4d9896[_0xdd4b('0x19')](_0x2d4f73)[_0xdd4b('0x29')](_0x24fa06);};}exports[_0xdd4b('0x2a')]=function(_0x1f70b3,_0x32489f){var _0x14a40f={},_0x4de481={},_0x420597={'count':0x0,'rows':[]};var _0x3c841a=_[_0xdd4b('0x2b')](db[_0xdd4b('0x2c')][_0xdd4b('0x2d')],function(_0x132646){return{'name':_0x132646[_0xdd4b('0x2e')],'type':_0x132646[_0xdd4b('0x2f')][_0xdd4b('0x30')]};});_0x4de481[_0xdd4b('0x31')]=_[_0xdd4b('0x2b')](_0x3c841a,_0xdd4b('0x28'));_0x4de481[_0xdd4b('0x32')]=_[_0xdd4b('0x33')](_0x1f70b3[_0xdd4b('0x32')]);_0x4de481[_0xdd4b('0x34')]=_['intersection'](_0x4de481['model'],_0x4de481[_0xdd4b('0x32')]);_0x14a40f[_0xdd4b('0x35')]=_[_0xdd4b('0x36')](_0x4de481['model'],qs[_0xdd4b('0x37')](_0x1f70b3[_0xdd4b('0x32')]['fields']));_0x14a40f['attributes']=_0x14a40f[_0xdd4b('0x35')]['length']?_0x14a40f[_0xdd4b('0x35')]:_0x4de481['model'];if(!_0x1f70b3['query'][_0xdd4b('0x38')](_0xdd4b('0x39'))){_0x14a40f['limit']=qs[_0xdd4b('0x1d')](_0x1f70b3[_0xdd4b('0x32')][_0xdd4b('0x1d')]);_0x14a40f[_0xdd4b('0x1b')]=qs[_0xdd4b('0x1b')](_0x1f70b3[_0xdd4b('0x32')][_0xdd4b('0x1b')]);}_0x14a40f[_0xdd4b('0x3a')]=qs[_0xdd4b('0x3b')](_0x1f70b3[_0xdd4b('0x32')][_0xdd4b('0x3b')]);_0x14a40f[_0xdd4b('0x3c')]=qs[_0xdd4b('0x34')](_[_0xdd4b('0x3d')](_0x1f70b3[_0xdd4b('0x32')],_0x4de481['filters']),_0x3c841a);if(_0x1f70b3[_0xdd4b('0x32')][_0xdd4b('0x3e')]){_0x14a40f[_0xdd4b('0x3c')]=_[_0xdd4b('0x3f')](_0x14a40f[_0xdd4b('0x3c')],{'$or':_[_0xdd4b('0x2b')](_0x3c841a,function(_0x3af2d8){if(_0x3af2d8[_0xdd4b('0x2f')]!==_0xdd4b('0x40')){var _0x1bc914={};_0x1bc914[_0x3af2d8[_0xdd4b('0x28')]]={'$like':'%'+_0x1f70b3['query'][_0xdd4b('0x3e')]+'%'};return _0x1bc914;}})});}_0x14a40f=_[_0xdd4b('0x3f')]({},_0x14a40f,_0x1f70b3[_0xdd4b('0x41')]);var _0x566669={'where':_0x14a40f[_0xdd4b('0x3c')]};return db[_0xdd4b('0x2c')][_0xdd4b('0x1e')](_0x566669)[_0xdd4b('0x25')](function(_0x88002d){_0x420597[_0xdd4b('0x1e')]=_0x88002d;if(_0x1f70b3['query'][_0xdd4b('0x42')]){_0x14a40f[_0xdd4b('0x43')]=[{'all':!![]}];}return db[_0xdd4b('0x2c')]['findAll'](_0x14a40f);})[_0xdd4b('0x25')](function(_0x255e2b){_0x420597[_0xdd4b('0x44')]=_0x255e2b;return _0x420597;})[_0xdd4b('0x25')](respondWithFilteredResult(_0x32489f,_0x14a40f))[_0xdd4b('0x45')](handleError(_0x32489f,null));};exports['show']=function(_0x293878,_0x44bf64){var _0x53d98a={'raw':!![],'where':{'id':_0x293878['params']['id']}},_0x333bed={};_0x333bed[_0xdd4b('0x31')]=_['keys'](db['FaxQueueReport'][_0xdd4b('0x2d')]);_0x333bed[_0xdd4b('0x32')]=_[_0xdd4b('0x33')](_0x293878[_0xdd4b('0x32')]);_0x333bed['filters']=_[_0xdd4b('0x36')](_0x333bed[_0xdd4b('0x31')],_0x333bed[_0xdd4b('0x32')]);_0x53d98a[_0xdd4b('0x35')]=_[_0xdd4b('0x36')](_0x333bed[_0xdd4b('0x31')],qs[_0xdd4b('0x37')](_0x293878['query']['fields']));_0x53d98a[_0xdd4b('0x35')]=_0x53d98a['attributes'][_0xdd4b('0x46')]?_0x53d98a[_0xdd4b('0x35')]:_0x333bed[_0xdd4b('0x31')];if(_0x293878[_0xdd4b('0x32')][_0xdd4b('0x42')]){_0x53d98a['include']=[{'all':!![]}];}_0x53d98a=_[_0xdd4b('0x3f')]({},_0x53d98a,_0x293878[_0xdd4b('0x41')]);return db[_0xdd4b('0x2c')][_0xdd4b('0x47')](_0x53d98a)['then'](handleEntityNotFound(_0x44bf64,null))[_0xdd4b('0x25')](respondWithResult(_0x44bf64,null))[_0xdd4b('0x45')](handleError(_0x44bf64,null));};exports[_0xdd4b('0x48')]=function(_0x59edf7,_0x401152){return db[_0xdd4b('0x2c')]['create'](_0x59edf7[_0xdd4b('0x49')],{})['then'](respondWithResult(_0x401152,0xc9))[_0xdd4b('0x45')](handleError(_0x401152,null));};exports[_0xdd4b('0x23')]=function(_0xffa891,_0x3121ee){if(_0xffa891[_0xdd4b('0x49')]['id']){delete _0xffa891[_0xdd4b('0x49')]['id'];}return db[_0xdd4b('0x2c')][_0xdd4b('0x47')]({'where':{'id':_0xffa891[_0xdd4b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3121ee,null))[_0xdd4b('0x25')](saveUpdates(_0xffa891[_0xdd4b('0x49')],null))[_0xdd4b('0x25')](respondWithResult(_0x3121ee,null))['catch'](handleError(_0x3121ee,null));};exports[_0xdd4b('0x24')]=function(_0xd1bde8,_0x539f05){return db[_0xdd4b('0x2c')][_0xdd4b('0x47')]({'where':{'id':_0xd1bde8[_0xdd4b('0x4a')]['id']}})[_0xdd4b('0x25')](handleEntityNotFound(_0x539f05,null))[_0xdd4b('0x25')](removeEntity(_0x539f05,null))[_0xdd4b('0x45')](handleError(_0x539f05,null));};exports[_0xdd4b('0x4b')]=function(_0x43e6ca,_0xda3cc4){return db[_0xdd4b('0x2c')]['describe']()[_0xdd4b('0x25')](respondWithResult(_0xda3cc4,null))['catch'](handleError(_0xda3cc4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3b0dbd9..319bcb6 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x2e788b,_0x44a596){var _0xd0cac5=function(_0x54fa4c){while(--_0x54fa4c){_0x2e788b['push'](_0x2e788b['shift']());}};_0xd0cac5(++_0x44a596);}(_0x1261,0x144));var _0x1126=function(_0xed01eb,_0x275edb){_0xed01eb=_0xed01eb-0x0;var _0x25b9de=_0x1261[_0xed01eb];return _0x25b9de;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x360d8e,_0x18e770){var _0x3ad3fa=function(_0x4023be){while(--_0x4023be){_0x360d8e['push'](_0x360d8e['shift']());}};_0x3ad3fa(++_0x18e770);}(_0x53ec,0x192));var _0xc53e=function(_0x2aae2d,_0x257260){_0x2aae2d=_0x2aae2d-0x0;var _0x420302=_0x53ec[_0x2aae2d];return _0x420302;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index a6e3d29..fa347e6 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 _0x0c43=['jayson/promise','client','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','UpdateFaxQueueReport','update','raw','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x146d43,_0x527a1e){var _0xd5e858=function(_0x4adfde){while(--_0x4adfde){_0x146d43['push'](_0x146d43['shift']());}};_0xd5e858(++_0x527a1e);}(_0x0c43,0x118));var _0x30c4=function(_0x14e798,_0x34721b){_0x14e798=_0x14e798-0x0;var _0x41551a=_0x0c43[_0x14e798];return _0x41551a;};'use strict';var _=require(_0x30c4('0x0'));var util=require('util');var moment=require(_0x30c4('0x1'));var BPromise=require(_0x30c4('0x2'));var rs=require(_0x30c4('0x3'));var fs=require('fs');var Redis=require(_0x30c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x30c4('0x5'))(_0x30c4('0x6'));var config=require(_0x30c4('0x7'));var jayson=require(_0x30c4('0x8'));var client=jayson[_0x30c4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1107d2,_0x47117a,_0x1424ac){return new BPromise(function(_0x5881ed,_0xa582e1){return client[_0x30c4('0xa')](_0x1107d2,_0x1424ac)[_0x30c4('0xb')](function(_0xcd388f){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x47117a,'request\x20sent');logger[_0x30c4('0xc')](_0x30c4('0xd'),_0x47117a,_0x30c4('0xe'),JSON[_0x30c4('0xf')](_0xcd388f));if(_0xcd388f[_0x30c4('0x10')]){if(_0xcd388f['error'][_0x30c4('0x11')]===0x1f4){logger[_0x30c4('0x10')](_0x30c4('0x12'),_0x47117a,_0xcd388f[_0x30c4('0x10')][_0x30c4('0x13')]);return _0xa582e1(_0xcd388f[_0x30c4('0x10')]['message']);}logger[_0x30c4('0x10')](_0x30c4('0x12'),_0x47117a,_0xcd388f[_0x30c4('0x10')][_0x30c4('0x13')]);return _0x5881ed(_0xcd388f[_0x30c4('0x10')][_0x30c4('0x13')]);}else{logger[_0x30c4('0x14')](_0x30c4('0x12'),_0x47117a,'request\x20sent');_0x5881ed(_0xcd388f[_0x30c4('0x15')][_0x30c4('0x13')]);}})[_0x30c4('0x16')](function(_0x45c405){logger[_0x30c4('0x10')](_0x30c4('0x12'),_0x47117a,_0x45c405);_0xa582e1(_0x45c405);});});}exports[_0x30c4('0x17')]=function(_0x52876e){var _0x183262=this;return new Promise(function(_0x5603ea,_0x5f5086){return db[_0x30c4('0x18')]['create'](_0x52876e[_0x30c4('0x19')],{'raw':_0x52876e['options']?_0x52876e[_0x30c4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x30c4('0xb')](function(_0x4bcc3c){logger['info'](_0x30c4('0x17'),_0x52876e);logger[_0x30c4('0xc')](_0x30c4('0x17'),_0x52876e,JSON['stringify'](_0x4bcc3c));_0x5603ea(_0x4bcc3c);})[_0x30c4('0x16')](function(_0x421c19){logger[_0x30c4('0x10')]('CreateFaxQueueReport',_0x421c19[_0x30c4('0x13')],_0x52876e);_0x5f5086(_0x183262[_0x30c4('0x10')](0x1f4,_0x421c19[_0x30c4('0x13')]));});});};exports[_0x30c4('0x1b')]=function(_0x24c9d2){var _0xf88cb6=this;return new Promise(function(_0x4dd116,_0x19cbaf){return db['FaxQueueReport'][_0x30c4('0x1c')](_0x24c9d2['body'],{'raw':_0x24c9d2[_0x30c4('0x1a')]?_0x24c9d2[_0x30c4('0x1a')][_0x30c4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24c9d2[_0x30c4('0x1a')]?_0x24c9d2[_0x30c4('0x1a')][_0x30c4('0x1e')]||null:null,'attributes':_0x24c9d2['options']?_0x24c9d2[_0x30c4('0x1a')]['attributes']||null:null,'limit':_0x24c9d2['options']?_0x24c9d2[_0x30c4('0x1a')][_0x30c4('0x1f')]||null:null})[_0x30c4('0xb')](function(_0x3b33c4){logger[_0x30c4('0x14')]('UpdateFaxQueueReport',_0x24c9d2);logger[_0x30c4('0xc')](_0x30c4('0x1b'),_0x24c9d2,JSON[_0x30c4('0xf')](_0x3b33c4));_0x4dd116(_0x3b33c4);})[_0x30c4('0x16')](function(_0x308cbc){logger[_0x30c4('0x10')](_0x30c4('0x1b'),_0x308cbc[_0x30c4('0x13')],_0x24c9d2);_0x19cbaf(_0xf88cb6[_0x30c4('0x10')](0x1f4,_0x308cbc[_0x30c4('0x13')]));});});}; \ No newline at end of file +var _0x952c=['error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a0643,_0x5270db){var _0x5718c7=function(_0xf68a5e){while(--_0xf68a5e){_0x2a0643['push'](_0x2a0643['shift']());}};_0x5718c7(++_0x5270db);}(_0x952c,0xfe));var _0xc952=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0x952c[_0x420f2a];return _0x28f802;};'use strict';var _=require(_0xc952('0x0'));var util=require(_0xc952('0x1'));var moment=require(_0xc952('0x2'));var BPromise=require(_0xc952('0x3'));var rs=require(_0xc952('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc952('0x5'))['db'];var utils=require(_0xc952('0x6'));var logger=require(_0xc952('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc952('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26ce98,_0x4706f3,_0x52f386){return new BPromise(function(_0x4c3a53,_0xb5d96d){return client[_0xc952('0x9')](_0x26ce98,_0x52f386)[_0xc952('0xa')](function(_0x52dcc3){logger[_0xc952('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4706f3,_0xc952('0xc'));logger[_0xc952('0xd')](_0xc952('0xe'),_0x4706f3,_0xc952('0xc'),JSON[_0xc952('0xf')](_0x52dcc3));if(_0x52dcc3[_0xc952('0x10')]){if(_0x52dcc3[_0xc952('0x10')][_0xc952('0x11')]===0x1f4){logger['error'](_0xc952('0x12'),_0x4706f3,_0x52dcc3[_0xc952('0x10')][_0xc952('0x13')]);return _0xb5d96d(_0x52dcc3[_0xc952('0x10')]['message']);}logger[_0xc952('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x4706f3,_0x52dcc3[_0xc952('0x10')]['message']);return _0x4c3a53(_0x52dcc3[_0xc952('0x10')][_0xc952('0x13')]);}else{logger['info'](_0xc952('0x12'),_0x4706f3,'request\x20sent');_0x4c3a53(_0x52dcc3[_0xc952('0x14')]['message']);}})[_0xc952('0x15')](function(_0xc87fc8){logger[_0xc952('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x4706f3,_0xc87fc8);_0xb5d96d(_0xc87fc8);});});}exports[_0xc952('0x16')]=function(_0x294a6c){var _0x29a5eb=this;return new Promise(function(_0x328f84,_0x343947){return db[_0xc952('0x17')]['create'](_0x294a6c['body'],{'raw':_0x294a6c[_0xc952('0x18')]?_0x294a6c['options'][_0xc952('0x19')]===undefined?!![]:![]:!![]})[_0xc952('0xa')](function(_0x36b2da){logger[_0xc952('0xb')](_0xc952('0x16'),_0x294a6c);logger['debug'](_0xc952('0x16'),_0x294a6c,JSON['stringify'](_0x36b2da));_0x328f84(_0x36b2da);})['catch'](function(_0x5e14f){logger[_0xc952('0x10')](_0xc952('0x16'),_0x5e14f[_0xc952('0x13')],_0x294a6c);_0x343947(_0x29a5eb[_0xc952('0x10')](0x1f4,_0x5e14f[_0xc952('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x32d37f){var _0x39ecc1=this;return new Promise(function(_0x48e35a,_0x2076a1){return db[_0xc952('0x17')]['update'](_0x32d37f['body'],{'raw':_0x32d37f[_0xc952('0x18')]?_0x32d37f[_0xc952('0x18')][_0xc952('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32d37f['options']?_0x32d37f[_0xc952('0x18')][_0xc952('0x1a')]||null:null,'attributes':_0x32d37f[_0xc952('0x18')]?_0x32d37f[_0xc952('0x18')][_0xc952('0x1b')]||null:null,'limit':_0x32d37f[_0xc952('0x18')]?_0x32d37f[_0xc952('0x18')][_0xc952('0x1c')]||null:null})[_0xc952('0xa')](function(_0xafd37d){logger['info'](_0xc952('0x1d'),_0x32d37f);logger[_0xc952('0xd')]('UpdateFaxQueueReport',_0x32d37f,JSON[_0xc952('0xf')](_0xafd37d));_0x48e35a(_0xafd37d);})[_0xc952('0x15')](function(_0x523b5f){logger[_0xc952('0x10')](_0xc952('0x1d'),_0x523b5f[_0xc952('0x13')],_0x32d37f);_0x2076a1(_0x39ecc1[_0xc952('0x10')](0x1f4,_0x523b5f[_0xc952('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4d0ec70..2ccf8cd 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 _0x485e=['fs-extra','../../components/auth/service','./faxQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x43b21d,_0x5d5677){var _0x1de400=function(_0x405b75){while(--_0x405b75){_0x43b21d['push'](_0x43b21d['shift']());}};_0x1de400(++_0x5d5677);}(_0x485e,0x1f4));var _0xe485=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0x485e[_0x39ea42];return _0x33f5b7;};'use strict';var multer=require(_0xe485('0x0'));var util=require(_0xe485('0x1'));var path=require(_0xe485('0x2'));var timeout=require(_0xe485('0x3'));var express=require(_0xe485('0x4'));var router=express[_0xe485('0x5')]();var fs_extra=require(_0xe485('0x6'));var auth=require(_0xe485('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe485('0x8'));router[_0xe485('0x9')]('/',auth['isAuthenticated'](),controller[_0xe485('0xa')]);router[_0xe485('0x9')](_0xe485('0xb'),auth[_0xe485('0xc')](),controller['describe']);router['get'](_0xe485('0xd'),auth[_0xe485('0xc')](),controller[_0xe485('0xe')]);router[_0xe485('0xf')]('/',auth[_0xe485('0xc')](),controller[_0xe485('0x10')]);router[_0xe485('0x11')](_0xe485('0xd'),auth[_0xe485('0xc')](),controller[_0xe485('0x12')]);router[_0xe485('0x13')]('/:id',auth[_0xe485('0xc')](),controller[_0xe485('0x14')]);module[_0xe485('0x15')]=router; \ No newline at end of file +var _0x319b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x4dec61,_0x387467){var _0x12cf79=function(_0x186ef4){while(--_0x186ef4){_0x4dec61['push'](_0x4dec61['shift']());}};_0x12cf79(++_0x387467);}(_0x319b,0xce));var _0xb319=function(_0x482149,_0x5645f9){_0x482149=_0x482149-0x0;var _0x120fd2=_0x319b[_0x482149];return _0x120fd2;};'use strict';var multer=require(_0xb319('0x0'));var util=require('util');var path=require(_0xb319('0x1'));var timeout=require(_0xb319('0x2'));var express=require(_0xb319('0x3'));var router=express[_0xb319('0x4')]();var fs_extra=require(_0xb319('0x5'));var auth=require(_0xb319('0x6'));var interaction=require(_0xb319('0x7'));var config=require(_0xb319('0x8'));var controller=require(_0xb319('0x9'));router[_0xb319('0xa')]('/',auth[_0xb319('0xb')](),controller[_0xb319('0xc')]);router['get'](_0xb319('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xb319('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb319('0xe')]);router[_0xb319('0xf')]('/',auth[_0xb319('0xb')](),controller[_0xb319('0x10')]);router[_0xb319('0x11')](_0xb319('0x12'),auth[_0xb319('0xb')](),controller[_0xb319('0x13')]);router[_0xb319('0x14')](_0xb319('0x12'),auth[_0xb319('0xb')](),controller[_0xb319('0x15')]);module[_0xb319('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 88a5f3d..910c9af 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x35cec5,_0x3c6718){_0x35cec5=_0x35cec5-0x0;var _0x53fabd=_0xb43b[_0x35cec5];return _0x53fabd;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x11de96,_0x3b172b){var _0x26d213=function(_0x178662){while(--_0x178662){_0x11de96['push'](_0x11de96['shift']());}};_0x26d213(++_0x3b172b);}(_0x34e8,0x12c));var _0x834e=function(_0x17a17f,_0x14c6c8){_0x17a17f=_0x17a17f-0x0;var _0x41d3ee=_0x34e8[_0x17a17f];return _0x41d3ee;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 483a895..81cc7f6 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 _0x9d8c=['json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','end','name','send','FaxTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x2a33ab,_0x146f98){var _0x9f9b02=function(_0x55dc8c){while(--_0x55dc8c){_0x2a33ab['push'](_0x2a33ab['shift']());}};_0x9f9b02(++_0x146f98);}(_0x9d8c,0x197));var _0xc9d8=function(_0x57b86e,_0x2680b5){_0x57b86e=_0x57b86e-0x0;var _0x546790=_0x9d8c[_0x57b86e];return _0x546790;};'use strict';var emlformat=require(_0xc9d8('0x0'));var rimraf=require(_0xc9d8('0x1'));var zipdir=require(_0xc9d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9d8('0x3'));var moment=require('moment');var BPromise=require(_0xc9d8('0x4'));var Mustache=require(_0xc9d8('0x5'));var util=require(_0xc9d8('0x6'));var path=require(_0xc9d8('0x7'));var sox=require(_0xc9d8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9d8('0x9'));var _=require(_0xc9d8('0xa'));var squel=require(_0xc9d8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc9d8('0xc'));var toCsv=require(_0xc9d8('0xd'));var querystring=require(_0xc9d8('0xe'));var Papa=require('papaparse');var Redis=require(_0xc9d8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc9d8('0x10'));var as=require(_0xc9d8('0x11'));var hardwareService=require(_0xc9d8('0x12'));var logger=require('../../config/logger')(_0xc9d8('0x13'));var utils=require(_0xc9d8('0x14'));var config=require(_0xc9d8('0x15'));var licenseUtil=require(_0xc9d8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12a376,_0x277652){_0x277652=_0x277652||0xcc;return function(_0xb0e8f3){if(_0xb0e8f3){return _0x12a376[_0xc9d8('0x17')](_0x277652);}return _0x12a376['status'](_0x277652)['end']();};}function respondWithResult(_0x55d9a7,_0x5332c6){_0x5332c6=_0x5332c6||0xc8;return function(_0x235a22){if(_0x235a22){return _0x55d9a7[_0xc9d8('0x18')](_0x5332c6)[_0xc9d8('0x19')](_0x235a22);}};}function respondWithFilteredResult(_0x5d09ee,_0x4535c8){return function(_0x589d23){if(_0x589d23){var _0x3c457=typeof _0x4535c8[_0xc9d8('0x1a')]==='undefined'&&typeof _0x4535c8[_0xc9d8('0x1b')]===_0xc9d8('0x1c');var _0x182216=_0x589d23[_0xc9d8('0x1d')];var _0x25d220=_0x3c457?0x0:_0x4535c8[_0xc9d8('0x1a')];var _0x16df98=_0x3c457?_0x589d23[_0xc9d8('0x1d')]:_0x4535c8[_0xc9d8('0x1a')]+_0x4535c8['limit'];var _0x34ce16;if(_0x16df98>=_0x182216){_0x16df98=_0x182216;_0x34ce16=0xc8;}else{_0x34ce16=0xce;}_0x5d09ee['status'](_0x34ce16);return _0x5d09ee['set'](_0xc9d8('0x1e'),_0x25d220+'-'+_0x16df98+'/'+_0x182216)[_0xc9d8('0x19')](_0x589d23);}return null;};}function patchUpdates(_0x317d8e){return function(_0x46738b){try{jsonpatch[_0xc9d8('0x1f')](_0x46738b,_0x317d8e,!![]);}catch(_0x3ca765){return BPromise[_0xc9d8('0x20')](_0x3ca765);}return _0x46738b['save']();};}function saveUpdates(_0xaf814a,_0x225a60){return function(_0x39641d){if(_0x39641d){return _0x39641d[_0xc9d8('0x21')](_0xaf814a)[_0xc9d8('0x22')](function(_0x3bd81f){return _0x3bd81f;});}return null;};}function removeEntity(_0x499526,_0x2cbb96){return function(_0x26703c){if(_0x26703c){return _0x26703c['destroy']()[_0xc9d8('0x22')](function(){_0x499526[_0xc9d8('0x18')](0xcc)[_0xc9d8('0x23')]();});}};}function handleEntityNotFound(_0x5bf82d,_0x3368d0){return function(_0x7a1bc3){if(!_0x7a1bc3){_0x5bf82d[_0xc9d8('0x17')](0x194);}return _0x7a1bc3;};}function handleError(_0x4dd9bb,_0x2be5cd){_0x2be5cd=_0x2be5cd||0x1f4;return function(_0x41008f){logger['error'](_0x41008f['stack']);if(_0x41008f[_0xc9d8('0x24')]){delete _0x41008f[_0xc9d8('0x24')];}_0x4dd9bb[_0xc9d8('0x18')](_0x2be5cd)[_0xc9d8('0x25')](_0x41008f);};}exports['index']=function(_0x4bf538,_0x31961b){var _0x1f9718={},_0x51b61b={},_0x1c9b98={'count':0x0,'rows':[]};var _0xbe40ac=_['map'](db[_0xc9d8('0x26')][_0xc9d8('0x27')],function(_0x60aeec){return{'name':_0x60aeec['fieldName'],'type':_0x60aeec[_0xc9d8('0x28')]['key']};});_0x51b61b[_0xc9d8('0x29')]=_['map'](_0xbe40ac,_0xc9d8('0x24'));_0x51b61b[_0xc9d8('0x2a')]=_[_0xc9d8('0x2b')](_0x4bf538[_0xc9d8('0x2a')]);_0x51b61b[_0xc9d8('0x2c')]=_[_0xc9d8('0x2d')](_0x51b61b[_0xc9d8('0x29')],_0x51b61b[_0xc9d8('0x2a')]);_0x1f9718[_0xc9d8('0x2e')]=_[_0xc9d8('0x2d')](_0x51b61b[_0xc9d8('0x29')],qs[_0xc9d8('0x2f')](_0x4bf538[_0xc9d8('0x2a')]['fields']));_0x1f9718['attributes']=_0x1f9718[_0xc9d8('0x2e')][_0xc9d8('0x30')]?_0x1f9718['attributes']:_0x51b61b[_0xc9d8('0x29')];if(!_0x4bf538[_0xc9d8('0x2a')][_0xc9d8('0x31')](_0xc9d8('0x32'))){_0x1f9718[_0xc9d8('0x1b')]=qs['limit'](_0x4bf538[_0xc9d8('0x2a')][_0xc9d8('0x1b')]);_0x1f9718[_0xc9d8('0x1a')]=qs[_0xc9d8('0x1a')](_0x4bf538[_0xc9d8('0x2a')][_0xc9d8('0x1a')]);}_0x1f9718[_0xc9d8('0x33')]=qs[_0xc9d8('0x34')](_0x4bf538[_0xc9d8('0x2a')]['sort']);_0x1f9718['where']=qs[_0xc9d8('0x2c')](_[_0xc9d8('0x35')](_0x4bf538[_0xc9d8('0x2a')],_0x51b61b[_0xc9d8('0x2c')]),_0xbe40ac);if(_0x4bf538[_0xc9d8('0x2a')][_0xc9d8('0x36')]){_0x1f9718[_0xc9d8('0x37')]=_[_0xc9d8('0x38')](_0x1f9718[_0xc9d8('0x37')],{'$or':_[_0xc9d8('0x39')](_0xbe40ac,function(_0x1e8c77){if(_0x1e8c77[_0xc9d8('0x28')]!==_0xc9d8('0x3a')){var _0x54b6f2={};_0x54b6f2[_0x1e8c77[_0xc9d8('0x24')]]={'$like':'%'+_0x4bf538[_0xc9d8('0x2a')][_0xc9d8('0x36')]+'%'};return _0x54b6f2;}})});}_0x1f9718=_[_0xc9d8('0x38')]({},_0x1f9718,_0x4bf538[_0xc9d8('0x3b')]);var _0x2944b9={'where':_0x1f9718['where']};return db[_0xc9d8('0x26')][_0xc9d8('0x1d')](_0x2944b9)[_0xc9d8('0x22')](function(_0x32b2ec){_0x1c9b98[_0xc9d8('0x1d')]=_0x32b2ec;if(_0x4bf538['query'][_0xc9d8('0x3c')]){_0x1f9718['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xc9d8('0x3d')](_0x1f9718);})[_0xc9d8('0x22')](function(_0x43b078){_0x1c9b98[_0xc9d8('0x3e')]=_0x43b078;return _0x1c9b98;})['then'](respondWithFilteredResult(_0x31961b,_0x1f9718))[_0xc9d8('0x3f')](handleError(_0x31961b,null));};exports[_0xc9d8('0x40')]=function(_0x4a7dbd,_0x1f326a){var _0x32c7f6={'raw':!![],'where':{'id':_0x4a7dbd[_0xc9d8('0x41')]['id']}},_0x18e51a={};_0x18e51a['model']=_[_0xc9d8('0x2b')](db[_0xc9d8('0x26')]['rawAttributes']);_0x18e51a['query']=_[_0xc9d8('0x2b')](_0x4a7dbd[_0xc9d8('0x2a')]);_0x18e51a[_0xc9d8('0x2c')]=_['intersection'](_0x18e51a[_0xc9d8('0x29')],_0x18e51a[_0xc9d8('0x2a')]);_0x32c7f6[_0xc9d8('0x2e')]=_[_0xc9d8('0x2d')](_0x18e51a['model'],qs[_0xc9d8('0x2f')](_0x4a7dbd[_0xc9d8('0x2a')]['fields']));_0x32c7f6[_0xc9d8('0x2e')]=_0x32c7f6[_0xc9d8('0x2e')][_0xc9d8('0x30')]?_0x32c7f6[_0xc9d8('0x2e')]:_0x18e51a[_0xc9d8('0x29')];if(_0x4a7dbd[_0xc9d8('0x2a')][_0xc9d8('0x3c')]){_0x32c7f6[_0xc9d8('0x42')]=[{'all':!![]}];}_0x32c7f6=_[_0xc9d8('0x38')]({},_0x32c7f6,_0x4a7dbd[_0xc9d8('0x3b')]);return db[_0xc9d8('0x26')][_0xc9d8('0x43')](_0x32c7f6)[_0xc9d8('0x22')](handleEntityNotFound(_0x1f326a,null))[_0xc9d8('0x22')](respondWithResult(_0x1f326a,null))[_0xc9d8('0x3f')](handleError(_0x1f326a,null));};exports[_0xc9d8('0x44')]=function(_0x4c947d,_0x415b68){return db[_0xc9d8('0x26')][_0xc9d8('0x44')](_0x4c947d[_0xc9d8('0x45')],{})[_0xc9d8('0x22')](respondWithResult(_0x415b68,0xc9))[_0xc9d8('0x3f')](handleError(_0x415b68,null));};exports['update']=function(_0x9547a6,_0x3d462b){if(_0x9547a6[_0xc9d8('0x45')]['id']){delete _0x9547a6['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x9547a6[_0xc9d8('0x41')]['id']}})[_0xc9d8('0x22')](handleEntityNotFound(_0x3d462b,null))[_0xc9d8('0x22')](saveUpdates(_0x9547a6[_0xc9d8('0x45')],null))[_0xc9d8('0x22')](respondWithResult(_0x3d462b,null))[_0xc9d8('0x3f')](handleError(_0x3d462b,null));};exports[_0xc9d8('0x46')]=function(_0x4e85b9,_0x384d25){return db[_0xc9d8('0x26')][_0xc9d8('0x43')]({'where':{'id':_0x4e85b9['params']['id']}})[_0xc9d8('0x22')](handleEntityNotFound(_0x384d25,null))[_0xc9d8('0x22')](removeEntity(_0x384d25,null))[_0xc9d8('0x3f')](handleError(_0x384d25,null));};exports[_0xc9d8('0x47')]=function(_0x30f711,_0x4e9db6){return db['FaxTransferReport'][_0xc9d8('0x47')]()[_0xc9d8('0x22')](respondWithResult(_0x4e9db6,null))[_0xc9d8('0x3f')](handleError(_0x4e9db6,null));}; \ No newline at end of file +var _0x99ae=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','destroy','then','error','stack','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','name','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','create','body','find','describe','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x34c8ab,_0x3d5269){var _0x4b9470=function(_0x3301e8){while(--_0x3301e8){_0x34c8ab['push'](_0x34c8ab['shift']());}};_0x4b9470(++_0x3d5269);}(_0x99ae,0x15c));var _0xe99a=function(_0x2c2988,_0x2bac3e){_0x2c2988=_0x2c2988-0x0;var _0x328eb4=_0x99ae[_0x2c2988];return _0x328eb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe99a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe99a('0x1'));var rp=require(_0xe99a('0x2'));var moment=require('moment');var BPromise=require(_0xe99a('0x3'));var Mustache=require('mustache');var util=require(_0xe99a('0x4'));var path=require(_0xe99a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe99a('0x6'));var fs=require('fs');var fs_extra=require(_0xe99a('0x7'));var _=require(_0xe99a('0x8'));var squel=require(_0xe99a('0x9'));var crypto=require('crypto');var jsforce=require(_0xe99a('0xa'));var deskjs=require(_0xe99a('0xb'));var toCsv=require(_0xe99a('0xc'));var querystring=require(_0xe99a('0xd'));var Papa=require(_0xe99a('0xe'));var Redis=require(_0xe99a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe99a('0x10'));var hardwareService=require(_0xe99a('0x11'));var logger=require(_0xe99a('0x12'))(_0xe99a('0x13'));var utils=require(_0xe99a('0x14'));var config=require(_0xe99a('0x15'));var licenseUtil=require(_0xe99a('0x16'));var db=require(_0xe99a('0x17'))['db'];function respondWithStatusCode(_0x6948,_0x1a8219){_0x1a8219=_0x1a8219||0xcc;return function(_0x5256f2){if(_0x5256f2){return _0x6948[_0xe99a('0x18')](_0x1a8219);}return _0x6948[_0xe99a('0x19')](_0x1a8219)[_0xe99a('0x1a')]();};}function respondWithResult(_0x4626b5,_0x53ae01){_0x53ae01=_0x53ae01||0xc8;return function(_0xbb6047){if(_0xbb6047){return _0x4626b5[_0xe99a('0x19')](_0x53ae01)[_0xe99a('0x1b')](_0xbb6047);}};}function respondWithFilteredResult(_0xc3bc63,_0x2b4bf5){return function(_0x132681){if(_0x132681){var _0xc9f817=typeof _0x2b4bf5['offset']==='undefined'&&typeof _0x2b4bf5[_0xe99a('0x1c')]===_0xe99a('0x1d');var _0x3ebf0b=_0x132681[_0xe99a('0x1e')];var _0x3ed264=_0xc9f817?0x0:_0x2b4bf5[_0xe99a('0x1f')];var _0x5e5c0f=_0xc9f817?_0x132681[_0xe99a('0x1e')]:_0x2b4bf5[_0xe99a('0x1f')]+_0x2b4bf5[_0xe99a('0x1c')];var _0x58292f;if(_0x5e5c0f>=_0x3ebf0b){_0x5e5c0f=_0x3ebf0b;_0x58292f=0xc8;}else{_0x58292f=0xce;}_0xc3bc63[_0xe99a('0x19')](_0x58292f);return _0xc3bc63['set'](_0xe99a('0x20'),_0x3ed264+'-'+_0x5e5c0f+'/'+_0x3ebf0b)[_0xe99a('0x1b')](_0x132681);}return null;};}function patchUpdates(_0x1d5ad4){return function(_0x439616){try{jsonpatch[_0xe99a('0x21')](_0x439616,_0x1d5ad4,!![]);}catch(_0x3217c5){return BPromise['reject'](_0x3217c5);}return _0x439616[_0xe99a('0x22')]();};}function saveUpdates(_0x489f2b,_0x52e273){return function(_0x5d3115){if(_0x5d3115){return _0x5d3115[_0xe99a('0x23')](_0x489f2b)['then'](function(_0x4d347c){return _0x4d347c;});}return null;};}function removeEntity(_0xbecd6a,_0x357f39){return function(_0x5743d0){if(_0x5743d0){return _0x5743d0[_0xe99a('0x24')]()[_0xe99a('0x25')](function(){_0xbecd6a[_0xe99a('0x19')](0xcc)[_0xe99a('0x1a')]();});}};}function handleEntityNotFound(_0xbc852f,_0x3a52de){return function(_0x134214){if(!_0x134214){_0xbc852f[_0xe99a('0x18')](0x194);}return _0x134214;};}function handleError(_0x14026a,_0x520549){_0x520549=_0x520549||0x1f4;return function(_0x187f19){logger[_0xe99a('0x26')](_0x187f19[_0xe99a('0x27')]);if(_0x187f19['name']){delete _0x187f19['name'];}_0x14026a[_0xe99a('0x19')](_0x520549)['send'](_0x187f19);};}exports[_0xe99a('0x28')]=function(_0x4ad359,_0x4b33f8){var _0x19a645={},_0x51ec41={},_0x33b253={'count':0x0,'rows':[]};var _0x403083=_['map'](db[_0xe99a('0x29')][_0xe99a('0x2a')],function(_0x35d80d){return{'name':_0x35d80d[_0xe99a('0x2b')],'type':_0x35d80d[_0xe99a('0x2c')][_0xe99a('0x2d')]};});_0x51ec41[_0xe99a('0x2e')]=_[_0xe99a('0x2f')](_0x403083,'name');_0x51ec41[_0xe99a('0x30')]=_[_0xe99a('0x31')](_0x4ad359['query']);_0x51ec41[_0xe99a('0x32')]=_[_0xe99a('0x33')](_0x51ec41[_0xe99a('0x2e')],_0x51ec41[_0xe99a('0x30')]);_0x19a645[_0xe99a('0x34')]=_[_0xe99a('0x33')](_0x51ec41['model'],qs[_0xe99a('0x35')](_0x4ad359[_0xe99a('0x30')]['fields']));_0x19a645[_0xe99a('0x34')]=_0x19a645['attributes']['length']?_0x19a645[_0xe99a('0x34')]:_0x51ec41[_0xe99a('0x2e')];if(!_0x4ad359[_0xe99a('0x30')][_0xe99a('0x36')](_0xe99a('0x37'))){_0x19a645[_0xe99a('0x1c')]=qs[_0xe99a('0x1c')](_0x4ad359[_0xe99a('0x30')][_0xe99a('0x1c')]);_0x19a645[_0xe99a('0x1f')]=qs['offset'](_0x4ad359[_0xe99a('0x30')][_0xe99a('0x1f')]);}_0x19a645['order']=qs[_0xe99a('0x38')](_0x4ad359['query']['sort']);_0x19a645[_0xe99a('0x39')]=qs[_0xe99a('0x32')](_['pick'](_0x4ad359['query'],_0x51ec41[_0xe99a('0x32')]),_0x403083);if(_0x4ad359[_0xe99a('0x30')]['filter']){_0x19a645[_0xe99a('0x39')]=_['merge'](_0x19a645[_0xe99a('0x39')],{'$or':_[_0xe99a('0x2f')](_0x403083,function(_0x21fadd){if(_0x21fadd[_0xe99a('0x2c')]!==_0xe99a('0x3a')){var _0x40cb12={};_0x40cb12[_0x21fadd[_0xe99a('0x3b')]]={'$like':'%'+_0x4ad359[_0xe99a('0x30')][_0xe99a('0x3c')]+'%'};return _0x40cb12;}})});}_0x19a645=_[_0xe99a('0x3d')]({},_0x19a645,_0x4ad359[_0xe99a('0x3e')]);var _0x4ca23b={'where':_0x19a645['where']};return db[_0xe99a('0x29')][_0xe99a('0x1e')](_0x4ca23b)[_0xe99a('0x25')](function(_0x2de0e9){_0x33b253['count']=_0x2de0e9;if(_0x4ad359[_0xe99a('0x30')][_0xe99a('0x3f')]){_0x19a645[_0xe99a('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xe99a('0x41')](_0x19a645);})[_0xe99a('0x25')](function(_0x22b6a0){_0x33b253[_0xe99a('0x42')]=_0x22b6a0;return _0x33b253;})[_0xe99a('0x25')](respondWithFilteredResult(_0x4b33f8,_0x19a645))[_0xe99a('0x43')](handleError(_0x4b33f8,null));};exports['show']=function(_0x19587f,_0x4ce7ba){var _0x145715={'raw':!![],'where':{'id':_0x19587f[_0xe99a('0x44')]['id']}},_0x3cec06={};_0x3cec06[_0xe99a('0x2e')]=_[_0xe99a('0x31')](db[_0xe99a('0x29')][_0xe99a('0x2a')]);_0x3cec06[_0xe99a('0x30')]=_['keys'](_0x19587f[_0xe99a('0x30')]);_0x3cec06['filters']=_['intersection'](_0x3cec06['model'],_0x3cec06[_0xe99a('0x30')]);_0x145715[_0xe99a('0x34')]=_['intersection'](_0x3cec06[_0xe99a('0x2e')],qs['fields'](_0x19587f[_0xe99a('0x30')][_0xe99a('0x35')]));_0x145715[_0xe99a('0x34')]=_0x145715[_0xe99a('0x34')][_0xe99a('0x45')]?_0x145715[_0xe99a('0x34')]:_0x3cec06[_0xe99a('0x2e')];if(_0x19587f[_0xe99a('0x30')][_0xe99a('0x3f')]){_0x145715[_0xe99a('0x40')]=[{'all':!![]}];}_0x145715=_[_0xe99a('0x3d')]({},_0x145715,_0x19587f[_0xe99a('0x3e')]);return db[_0xe99a('0x29')]['find'](_0x145715)[_0xe99a('0x25')](handleEntityNotFound(_0x4ce7ba,null))[_0xe99a('0x25')](respondWithResult(_0x4ce7ba,null))[_0xe99a('0x43')](handleError(_0x4ce7ba,null));};exports[_0xe99a('0x46')]=function(_0x5326f0,_0x5e27c6){return db[_0xe99a('0x29')][_0xe99a('0x46')](_0x5326f0[_0xe99a('0x47')],{})[_0xe99a('0x25')](respondWithResult(_0x5e27c6,0xc9))[_0xe99a('0x43')](handleError(_0x5e27c6,null));};exports[_0xe99a('0x23')]=function(_0xb1c83d,_0x2ebd0d){if(_0xb1c83d[_0xe99a('0x47')]['id']){delete _0xb1c83d[_0xe99a('0x47')]['id'];}return db[_0xe99a('0x29')][_0xe99a('0x48')]({'where':{'id':_0xb1c83d[_0xe99a('0x44')]['id']}})[_0xe99a('0x25')](handleEntityNotFound(_0x2ebd0d,null))['then'](saveUpdates(_0xb1c83d[_0xe99a('0x47')],null))[_0xe99a('0x25')](respondWithResult(_0x2ebd0d,null))['catch'](handleError(_0x2ebd0d,null));};exports[_0xe99a('0x24')]=function(_0x3c030e,_0x5c65a5){return db[_0xe99a('0x29')][_0xe99a('0x48')]({'where':{'id':_0x3c030e[_0xe99a('0x44')]['id']}})[_0xe99a('0x25')](handleEntityNotFound(_0x5c65a5,null))[_0xe99a('0x25')](removeEntity(_0x5c65a5,null))[_0xe99a('0x43')](handleError(_0x5c65a5,null));};exports[_0xe99a('0x49')]=function(_0x350de1,_0xfc86ba){return db[_0xe99a('0x29')]['describe']()[_0xe99a('0x25')](respondWithResult(_0xfc86ba,null))[_0xe99a('0x43')](handleError(_0xfc86ba,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 51d9235..b004d0b 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 _0x33d2=['moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x31b6d2,_0x55084d){var _0x123d9f=function(_0x1056ca){while(--_0x1056ca){_0x31b6d2['push'](_0x31b6d2['shift']());}};_0x123d9f(++_0x55084d);}(_0x33d2,0x7f));var _0x233d=function(_0x53955c,_0x1400fd){_0x53955c=_0x53955c-0x0;var _0x591b50=_0x33d2[_0x53955c];return _0x591b50;};'use strict';var _=require(_0x233d('0x0'));var util=require(_0x233d('0x1'));var logger=require(_0x233d('0x2'))('api');var moment=require(_0x233d('0x3'));var BPromise=require(_0x233d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x233d('0x5'));var rimraf=require(_0x233d('0x6'));var config=require(_0x233d('0x7'));var attributes=require(_0x233d('0x8'));module[_0x233d('0x9')]=function(_0x3f311b,_0x15ba43){return _0x3f311b[_0x233d('0xa')]('FaxTransferReport',attributes,{'tableName':_0x233d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x233d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc357=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','bluebird'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xc357,0x8b));var _0x7c35=function(_0x1fec74,_0x111e2b){_0x1fec74=_0x1fec74-0x0;var _0x54bf57=_0xc357[_0x1fec74];return _0x54bf57;};'use strict';var _=require('lodash');var util=require(_0x7c35('0x0'));var logger=require(_0x7c35('0x1'))(_0x7c35('0x2'));var moment=require('moment');var BPromise=require(_0x7c35('0x3'));var rp=require(_0x7c35('0x4'));var fs=require('fs');var path=require(_0x7c35('0x5'));var rimraf=require(_0x7c35('0x6'));var config=require(_0x7c35('0x7'));var attributes=require(_0x7c35('0x8'));module['exports']=function(_0x2b1f35,_0x146120){return _0x2b1f35[_0x7c35('0x9')](_0x7c35('0xa'),attributes,{'tableName':_0x7c35('0xb'),'paranoid':![],'indexes':[{'name':_0x7c35('0xc'),'fields':[_0x7c35('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 50b3116..2e1d0c6 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 _0x6415=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5a70a2,_0xf1e7f9){var _0x1c88fd=function(_0x2b36f3){while(--_0x2b36f3){_0x5a70a2['push'](_0x5a70a2['shift']());}};_0x1c88fd(++_0xf1e7f9);}(_0x6415,0x16f));var _0x5641=function(_0x3c9ee2,_0x4f1ba9){_0x3c9ee2=_0x3c9ee2-0x0;var _0x30143b=_0x6415[_0x3c9ee2];return _0x30143b;};'use strict';var _=require(_0x5641('0x0'));var util=require(_0x5641('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5641('0x2'));var fs=require('fs');var Redis=require(_0x5641('0x3'));var db=require(_0x5641('0x4'))['db'];var utils=require(_0x5641('0x5'));var logger=require(_0x5641('0x6'))(_0x5641('0x7'));var config=require('../../config/environment');var jayson=require(_0x5641('0x8'));var client=jayson[_0x5641('0x9')][_0x5641('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x269f10,_0xf3487e,_0x414d71){return new BPromise(function(_0x51497f,_0x5a4d77){return client[_0x5641('0xb')](_0x269f10,_0x414d71)[_0x5641('0xc')](function(_0x37a3e0){logger[_0x5641('0xd')](_0x5641('0xe'),_0xf3487e,_0x5641('0xf'));logger[_0x5641('0x10')](_0x5641('0x11'),_0xf3487e,_0x5641('0xf'),JSON[_0x5641('0x12')](_0x37a3e0));if(_0x37a3e0[_0x5641('0x13')]){if(_0x37a3e0[_0x5641('0x13')][_0x5641('0x14')]===0x1f4){logger[_0x5641('0x13')](_0x5641('0xe'),_0xf3487e,_0x37a3e0[_0x5641('0x13')]['message']);return _0x5a4d77(_0x37a3e0[_0x5641('0x13')][_0x5641('0x15')]);}logger[_0x5641('0x13')](_0x5641('0xe'),_0xf3487e,_0x37a3e0[_0x5641('0x13')][_0x5641('0x15')]);return _0x51497f(_0x37a3e0['error'][_0x5641('0x15')]);}else{logger['info'](_0x5641('0xe'),_0xf3487e,_0x5641('0xf'));_0x51497f(_0x37a3e0[_0x5641('0x16')][_0x5641('0x15')]);}})[_0x5641('0x17')](function(_0x44ae70){logger[_0x5641('0x13')](_0x5641('0xe'),_0xf3487e,_0x44ae70);_0x5a4d77(_0x44ae70);});});} \ No newline at end of file +var _0x56ae=['error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56ae,0x88));var _0xe56a=function(_0x19b6a7,_0x45b396){_0x19b6a7=_0x19b6a7-0x0;var _0x26603e=_0x56ae[_0x19b6a7];return _0x26603e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe56a('0x0'));var rs=require(_0xe56a('0x1'));var fs=require('fs');var Redis=require(_0xe56a('0x2'));var db=require(_0xe56a('0x3'))['db'];var utils=require(_0xe56a('0x4'));var logger=require(_0xe56a('0x5'))(_0xe56a('0x6'));var config=require(_0xe56a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe56a('0x8')][_0xe56a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x205d8b,_0x1c7d3c,_0x511a0e){return new BPromise(function(_0x3d8181,_0x59b74f){return client[_0xe56a('0xa')](_0x205d8b,_0x511a0e)[_0xe56a('0xb')](function(_0x4438f4){logger[_0xe56a('0xc')](_0xe56a('0xd'),_0x1c7d3c,'request\x20sent');logger[_0xe56a('0xe')](_0xe56a('0xf'),_0x1c7d3c,_0xe56a('0x10'),JSON[_0xe56a('0x11')](_0x4438f4));if(_0x4438f4[_0xe56a('0x12')]){if(_0x4438f4[_0xe56a('0x12')][_0xe56a('0x13')]===0x1f4){logger['error'](_0xe56a('0xd'),_0x1c7d3c,_0x4438f4[_0xe56a('0x12')]['message']);return _0x59b74f(_0x4438f4[_0xe56a('0x12')][_0xe56a('0x14')]);}logger[_0xe56a('0x12')](_0xe56a('0xd'),_0x1c7d3c,_0x4438f4['error'][_0xe56a('0x14')]);return _0x3d8181(_0x4438f4[_0xe56a('0x12')][_0xe56a('0x14')]);}else{logger[_0xe56a('0xc')](_0xe56a('0xd'),_0x1c7d3c,'request\x20sent');_0x3d8181(_0x4438f4[_0xe56a('0x15')]['message']);}})['catch'](function(_0xf7c66f){logger[_0xe56a('0x12')](_0xe56a('0xd'),_0x1c7d3c,_0xf7c66f);_0x59b74f(_0xf7c66f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 30b4d9e..8b09e8b 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 _0xdfee=['get','/describe','show','post','put','/:id','update','destroy','util','path','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index'];(function(_0x1f0ded,_0x404ba6){var _0xc14076=function(_0x45d4e2){while(--_0x45d4e2){_0x1f0ded['push'](_0x1f0ded['shift']());}};_0xc14076(++_0x404ba6);}(_0xdfee,0x90));var _0xedfe=function(_0x47d7bf,_0x71a222){_0x47d7bf=_0x47d7bf-0x0;var _0x162124=_0xdfee[_0x47d7bf];return _0x162124;};'use strict';var multer=require('multer');var util=require(_0xedfe('0x0'));var path=require(_0xedfe('0x1'));var timeout=require('connect-timeout');var express=require(_0xedfe('0x2'));var router=express[_0xedfe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xedfe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xedfe('0x5'));var controller=require(_0xedfe('0x6'));router['get']('/',auth[_0xedfe('0x7')](),controller[_0xedfe('0x8')]);router[_0xedfe('0x9')](_0xedfe('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xedfe('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xedfe('0xb')]);router[_0xedfe('0xc')]('/',auth[_0xedfe('0x7')](),controller['create']);router[_0xedfe('0xd')](_0xedfe('0xe'),auth[_0xedfe('0x7')](),controller[_0xedfe('0xf')]);router['delete'](_0xedfe('0xe'),auth[_0xedfe('0x7')](),controller[_0xedfe('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6f1a=['./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x541974,_0x20b88f){var _0x1c269b=function(_0x285306){while(--_0x285306){_0x541974['push'](_0x541974['shift']());}};_0x1c269b(++_0x20b88f);}(_0x6f1a,0x98));var _0xa6f1=function(_0x111ce3,_0x5e12aa){_0x111ce3=_0x111ce3-0x0;var _0xd0c223=_0x6f1a[_0x111ce3];return _0xd0c223;};'use strict';var multer=require(_0xa6f1('0x0'));var util=require('util');var path=require(_0xa6f1('0x1'));var timeout=require(_0xa6f1('0x2'));var express=require(_0xa6f1('0x3'));var router=express[_0xa6f1('0x4')]();var fs_extra=require(_0xa6f1('0x5'));var auth=require(_0xa6f1('0x6'));var interaction=require(_0xa6f1('0x7'));var config=require(_0xa6f1('0x8'));var controller=require(_0xa6f1('0x9'));router[_0xa6f1('0xa')]('/',auth[_0xa6f1('0xb')](),controller[_0xa6f1('0xc')]);router[_0xa6f1('0xa')](_0xa6f1('0xd'),auth['isAuthenticated'](),controller[_0xa6f1('0xe')]);router['get'](_0xa6f1('0xf'),auth[_0xa6f1('0xb')](),controller[_0xa6f1('0x10')]);router[_0xa6f1('0x11')]('/',auth[_0xa6f1('0xb')](),controller[_0xa6f1('0x12')]);router[_0xa6f1('0x13')](_0xa6f1('0xf'),auth[_0xa6f1('0xb')](),controller[_0xa6f1('0x14')]);router[_0xa6f1('0x15')](_0xa6f1('0xf'),auth[_0xa6f1('0xb')](),controller[_0xa6f1('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index ed81803..c617acd 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 _0x54af=['get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x54af,0xd3));var _0xf54a=function(_0x5259ec,_0x342d4c){_0x5259ec=_0x5259ec-0x0;var _0x1658c7=_0x54af[_0x5259ec];return _0x1658c7;};'use strict';var multer=require(_0xf54a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf54a('0x1'));var express=require(_0xf54a('0x2'));var router=express[_0xf54a('0x3')]();var fs_extra=require(_0xf54a('0x4'));var auth=require(_0xf54a('0x5'));var interaction=require(_0xf54a('0x6'));var config=require(_0xf54a('0x7'));var controller=require(_0xf54a('0x8'));router[_0xf54a('0x9')]('/',auth[_0xf54a('0xa')](),controller['index']);router[_0xf54a('0x9')](_0xf54a('0xb'),auth['isAuthenticated'](),controller[_0xf54a('0xc')]);router[_0xf54a('0x9')](_0xf54a('0xd'),auth[_0xf54a('0xa')](),controller[_0xf54a('0xe')]);router[_0xf54a('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf54a('0xf')]);router[_0xf54a('0x10')]('/',auth[_0xf54a('0xa')](),controller['create']);router['post'](_0xf54a('0xd'),auth['isAuthenticated'](),controller[_0xf54a('0x11')]);router[_0xf54a('0x12')](_0xf54a('0xb'),auth[_0xf54a('0xa')](),controller['update']);router[_0xf54a('0x13')](_0xf54a('0xb'),auth[_0xf54a('0xa')](),controller[_0xf54a('0x14')]);module[_0xf54a('0x15')]=router; \ No newline at end of file +var _0xcd88=['put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x588267,_0x270ffc){var _0x546b0d=function(_0x2127e1){while(--_0x2127e1){_0x588267['push'](_0x588267['shift']());}};_0x546b0d(++_0x270ffc);}(_0xcd88,0x16c));var _0x8cd8=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0xcd88[_0x16db8b];return _0x5ba017;};'use strict';var multer=require(_0x8cd8('0x0'));var util=require(_0x8cd8('0x1'));var path=require('path');var timeout=require(_0x8cd8('0x2'));var express=require(_0x8cd8('0x3'));var router=express[_0x8cd8('0x4')]();var fs_extra=require(_0x8cd8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8cd8('0x6'));var config=require(_0x8cd8('0x7'));var controller=require(_0x8cd8('0x8'));router[_0x8cd8('0x9')]('/',auth[_0x8cd8('0xa')](),controller['index']);router[_0x8cd8('0x9')](_0x8cd8('0xb'),auth['isAuthenticated'](),controller[_0x8cd8('0xc')]);router[_0x8cd8('0x9')](_0x8cd8('0xd'),auth[_0x8cd8('0xa')](),controller[_0x8cd8('0xe')]);router[_0x8cd8('0x9')](_0x8cd8('0xf'),auth[_0x8cd8('0xa')](),controller[_0x8cd8('0x10')]);router[_0x8cd8('0x11')]('/',auth[_0x8cd8('0xa')](),controller[_0x8cd8('0x12')]);router[_0x8cd8('0x11')](_0x8cd8('0xd'),auth[_0x8cd8('0xa')](),controller[_0x8cd8('0x13')]);router[_0x8cd8('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8cd8('0x15')]);router[_0x8cd8('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8cd8('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 45880db..4a3f18f 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 _0x0d14=['basic','integrationTab','sequelize','STRING','ENUM'];(function(_0x4f5b2f,_0x3401bc){var _0x5afa5d=function(_0xd9d2bd){while(--_0xd9d2bd){_0x4f5b2f['push'](_0x4f5b2f['shift']());}};_0x5afa5d(++_0x3401bc);}(_0x0d14,0x106));var _0x40d1=function(_0x206b5c,_0x4cdeb6){_0x206b5c=_0x206b5c-0x0;var _0x574a9a=_0x0d14[_0x206b5c];return _0x574a9a;};'use strict';var Sequelize=require(_0x40d1('0x0'));module['exports']={'name':{'type':Sequelize[_0x40d1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x40d1('0x1')]},'authType':{'type':Sequelize[_0x40d1('0x2')]('basic'),'defaultValue':_0x40d1('0x3')},'password':{'type':Sequelize[_0x40d1('0x1')]},'consumerKey':{'type':Sequelize[_0x40d1('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x40d1('0x1')]},'serverUrl':{'type':Sequelize[_0x40d1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x40d1('0x2')](_0x40d1('0x4'),'newTab'),'defaultValue':_0x40d1('0x4')}}; \ No newline at end of file +var _0x762a=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x4dbb11,_0x322354){var _0x1d7e84=function(_0x493d16){while(--_0x493d16){_0x4dbb11['push'](_0x4dbb11['shift']());}};_0x1d7e84(++_0x322354);}(_0x762a,0xd4));var _0xa762=function(_0x369d7a,_0xb33fd9){_0x369d7a=_0x369d7a-0x0;var _0x189cc3=_0x762a[_0x369d7a];return _0x189cc3;};'use strict';var Sequelize=require(_0xa762('0x0'));module[_0xa762('0x1')]={'name':{'type':Sequelize[_0xa762('0x2')]},'description':{'type':Sequelize[_0xa762('0x2')]},'username':{'type':Sequelize[_0xa762('0x2')]},'remoteUri':{'type':Sequelize[_0xa762('0x2')]},'authType':{'type':Sequelize[_0xa762('0x3')](_0xa762('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xa762('0x2')]},'consumerKey':{'type':Sequelize[_0xa762('0x2')]},'consumerSecret':{'type':Sequelize[_0xa762('0x2')]},'token':{'type':Sequelize[_0xa762('0x2')]},'tokenSecret':{'type':Sequelize[_0xa762('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa762('0x3')](_0xa762('0x5'),_0xa762('0x6')),'defaultValue':_0xa762('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index fd11f23..b21f070 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 _0x55bf=['querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','length','find','create','body','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','lastIndexOf','application/json','basic','Authorization','format','%s:%s','password','toString','base64','concat','_embedded','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x55bf,0x132));var _0xf55b=function(_0x45c150,_0x367855){_0x45c150=_0x45c150-0x0;var _0x27ed99=_0x55bf[_0x45c150];return _0x27ed99;};'use strict';var emlformat=require(_0xf55b('0x0'));var rimraf=require(_0xf55b('0x1'));var zipdir=require(_0xf55b('0x2'));var jsonpatch=require(_0xf55b('0x3'));var rp=require(_0xf55b('0x4'));var moment=require(_0xf55b('0x5'));var BPromise=require(_0xf55b('0x6'));var Mustache=require(_0xf55b('0x7'));var util=require('util');var path=require(_0xf55b('0x8'));var sox=require(_0xf55b('0x9'));var csv=require(_0xf55b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf55b('0xb'));var _=require(_0xf55b('0xc'));var squel=require('squel');var crypto=require(_0xf55b('0xd'));var jsforce=require(_0xf55b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf55b('0xa'));var querystring=require(_0xf55b('0xf'));var Papa=require(_0xf55b('0x10'));var Redis=require(_0xf55b('0x11'));var authService=require(_0xf55b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf55b('0x13'))('api');var utils=require(_0xf55b('0x14'));var config=require(_0xf55b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf55b('0x16'));function respondWithStatusCode(_0x20eb8f,_0x3bdd46){_0x3bdd46=_0x3bdd46||0xcc;return function(_0x3f8eae){if(_0x3f8eae){return _0x20eb8f[_0xf55b('0x17')](_0x3bdd46);}return _0x20eb8f[_0xf55b('0x18')](_0x3bdd46)['end']();};}function respondWithResult(_0x2acfb1,_0x2a8164){_0x2a8164=_0x2a8164||0xc8;return function(_0x532937){if(_0x532937){return _0x2acfb1['status'](_0x2a8164)[_0xf55b('0x19')](_0x532937);}};}function respondWithFilteredResult(_0x41eb38,_0x6d9452){return function(_0x292934){if(_0x292934){var _0x40098c=typeof _0x6d9452[_0xf55b('0x1a')]===_0xf55b('0x1b')&&typeof _0x6d9452[_0xf55b('0x1c')]===_0xf55b('0x1b');var _0x2e314e=_0x292934[_0xf55b('0x1d')];var _0x2119f3=_0x40098c?0x0:_0x6d9452[_0xf55b('0x1a')];var _0x30182d=_0x40098c?_0x292934[_0xf55b('0x1d')]:_0x6d9452[_0xf55b('0x1a')]+_0x6d9452['limit'];var _0x436f72;if(_0x30182d>=_0x2e314e){_0x30182d=_0x2e314e;_0x436f72=0xc8;}else{_0x436f72=0xce;}_0x41eb38['status'](_0x436f72);return _0x41eb38['set'](_0xf55b('0x1e'),_0x2119f3+'-'+_0x30182d+'/'+_0x2e314e)[_0xf55b('0x19')](_0x292934);}return null;};}function patchUpdates(_0x523542){return function(_0x26f584){try{jsonpatch[_0xf55b('0x1f')](_0x26f584,_0x523542,!![]);}catch(_0x5d2f83){return BPromise[_0xf55b('0x20')](_0x5d2f83);}return _0x26f584[_0xf55b('0x21')]();};}function saveUpdates(_0x27641d,_0x374aa2){return function(_0x4efbad){if(_0x4efbad){return _0x4efbad[_0xf55b('0x22')](_0x27641d)[_0xf55b('0x23')](function(_0x147a6c){return _0x147a6c;});}return null;};}function removeEntity(_0x182a11,_0x10e322){return function(_0x2a5548){if(_0x2a5548){return _0x2a5548[_0xf55b('0x24')]()[_0xf55b('0x23')](function(){_0x182a11[_0xf55b('0x18')](0xcc)[_0xf55b('0x25')]();});}};}function handleEntityNotFound(_0x4a33b4,_0x204d52){return function(_0x1a6843){if(!_0x1a6843){_0x4a33b4[_0xf55b('0x17')](0x194);}return _0x1a6843;};}function handleError(_0x316b98,_0x36ffdc){_0x36ffdc=_0x36ffdc||0x1f4;return function(_0x20725e){logger[_0xf55b('0x26')](_0x20725e[_0xf55b('0x27')]);if(_0x20725e[_0xf55b('0x28')]){delete _0x20725e['name'];}_0x316b98[_0xf55b('0x18')](_0x36ffdc)[_0xf55b('0x29')](_0x20725e);};}exports[_0xf55b('0x2a')]=function(_0x3b8e9a,_0x15316b){var _0xc357be={},_0x4642a3={},_0x347241={'count':0x0,'rows':[]};var _0x4288ef=_['map'](db[_0xf55b('0x2b')][_0xf55b('0x2c')],function(_0x12d4f4){return{'name':_0x12d4f4[_0xf55b('0x2d')],'type':_0x12d4f4[_0xf55b('0x2e')][_0xf55b('0x2f')]};});_0x4642a3[_0xf55b('0x30')]=_[_0xf55b('0x31')](_0x4288ef,_0xf55b('0x28'));_0x4642a3[_0xf55b('0x32')]=_[_0xf55b('0x33')](_0x3b8e9a[_0xf55b('0x32')]);_0x4642a3[_0xf55b('0x34')]=_[_0xf55b('0x35')](_0x4642a3[_0xf55b('0x30')],_0x4642a3[_0xf55b('0x32')]);_0xc357be[_0xf55b('0x36')]=_[_0xf55b('0x35')](_0x4642a3[_0xf55b('0x30')],qs[_0xf55b('0x37')](_0x3b8e9a[_0xf55b('0x32')][_0xf55b('0x37')]));_0xc357be[_0xf55b('0x36')]=_0xc357be[_0xf55b('0x36')]['length']?_0xc357be['attributes']:_0x4642a3['model'];if(!_0x3b8e9a[_0xf55b('0x32')][_0xf55b('0x38')](_0xf55b('0x39'))){_0xc357be[_0xf55b('0x1c')]=qs[_0xf55b('0x1c')](_0x3b8e9a['query'][_0xf55b('0x1c')]);_0xc357be[_0xf55b('0x1a')]=qs['offset'](_0x3b8e9a['query']['offset']);}_0xc357be[_0xf55b('0x3a')]=qs[_0xf55b('0x3b')](_0x3b8e9a['query']['sort']);_0xc357be['where']=qs[_0xf55b('0x34')](_[_0xf55b('0x3c')](_0x3b8e9a[_0xf55b('0x32')],_0x4642a3[_0xf55b('0x34')]),_0x4288ef);if(_0x3b8e9a[_0xf55b('0x32')][_0xf55b('0x3d')]){_0xc357be['where']=_[_0xf55b('0x3e')](_0xc357be['where'],{'$or':_['map'](_0x4288ef,function(_0x3012f1){if(_0x3012f1[_0xf55b('0x2e')]!==_0xf55b('0x3f')){var _0x5ff0c1={};_0x5ff0c1[_0x3012f1[_0xf55b('0x28')]]={'$like':'%'+_0x3b8e9a[_0xf55b('0x32')]['filter']+'%'};return _0x5ff0c1;}})});}_0xc357be=_[_0xf55b('0x3e')]({},_0xc357be,_0x3b8e9a[_0xf55b('0x40')]);var _0x3f6ae7={'where':_0xc357be[_0xf55b('0x41')]};return db[_0xf55b('0x2b')][_0xf55b('0x1d')](_0x3f6ae7)['then'](function(_0x453168){_0x347241[_0xf55b('0x1d')]=_0x453168;if(_0x3b8e9a[_0xf55b('0x32')][_0xf55b('0x42')]){_0xc357be[_0xf55b('0x43')]=[{'all':!![]}];}return db['DeskAccount'][_0xf55b('0x44')](_0xc357be);})[_0xf55b('0x23')](function(_0x2c877c){_0x347241[_0xf55b('0x45')]=_0x2c877c;return _0x347241;})[_0xf55b('0x23')](respondWithFilteredResult(_0x15316b,_0xc357be))[_0xf55b('0x46')](handleError(_0x15316b,null));};exports['show']=function(_0x462782,_0x50a1e0){var _0x4bdb7d={'raw':![],'where':{'id':_0x462782[_0xf55b('0x47')]['id']}},_0x17c0a8={};_0x17c0a8['model']=_[_0xf55b('0x33')](db[_0xf55b('0x2b')]['rawAttributes']);_0x17c0a8['query']=_['keys'](_0x462782['query']);_0x17c0a8[_0xf55b('0x34')]=_[_0xf55b('0x35')](_0x17c0a8[_0xf55b('0x30')],_0x17c0a8[_0xf55b('0x32')]);_0x4bdb7d['attributes']=_[_0xf55b('0x35')](_0x17c0a8['model'],qs['fields'](_0x462782[_0xf55b('0x32')][_0xf55b('0x37')]));_0x4bdb7d['attributes']=_0x4bdb7d[_0xf55b('0x36')][_0xf55b('0x48')]?_0x4bdb7d['attributes']:_0x17c0a8['model'];if(_0x462782[_0xf55b('0x32')][_0xf55b('0x42')]){_0x4bdb7d[_0xf55b('0x43')]=[{'all':!![]}];}_0x4bdb7d=_[_0xf55b('0x3e')]({},_0x4bdb7d,_0x462782[_0xf55b('0x40')]);return db[_0xf55b('0x2b')][_0xf55b('0x49')](_0x4bdb7d)[_0xf55b('0x23')](handleEntityNotFound(_0x50a1e0,null))['then'](respondWithResult(_0x50a1e0,null))[_0xf55b('0x46')](handleError(_0x50a1e0,null));};exports[_0xf55b('0x4a')]=function(_0x3f0e33,_0x4ab816){return db[_0xf55b('0x2b')][_0xf55b('0x4a')](_0x3f0e33['body'],{})['then'](respondWithResult(_0x4ab816,0xc9))[_0xf55b('0x46')](handleError(_0x4ab816,null));};exports[_0xf55b('0x22')]=function(_0x36f677,_0x557a8e){if(_0x36f677[_0xf55b('0x4b')]['id']){delete _0x36f677[_0xf55b('0x4b')]['id'];}return db['DeskAccount'][_0xf55b('0x49')]({'where':{'id':_0x36f677[_0xf55b('0x47')]['id']}})[_0xf55b('0x23')](handleEntityNotFound(_0x557a8e,null))[_0xf55b('0x23')](saveUpdates(_0x36f677[_0xf55b('0x4b')],null))[_0xf55b('0x23')](respondWithResult(_0x557a8e,null))['catch'](handleError(_0x557a8e,null));};exports['destroy']=function(_0x4439e9,_0xf393a9){return db[_0xf55b('0x2b')][_0xf55b('0x49')]({'where':{'id':_0x4439e9[_0xf55b('0x47')]['id']}})[_0xf55b('0x23')](handleEntityNotFound(_0xf393a9,null))['then'](removeEntity(_0xf393a9,null))[_0xf55b('0x46')](handleError(_0xf393a9,null));};exports['getConfigurations']=function(_0x515898,_0x1c7ad0,_0x8d7457){var _0x102e79={};var _0x462627={};var _0x704d55;var _0x56ab8f;return db[_0xf55b('0x2b')][_0xf55b('0x4c')]({'where':{'id':_0x515898[_0xf55b('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c7ad0,null))['then'](function(_0x474cc0){if(_0x474cc0){_0x704d55=_0x474cc0;_0x462627[_0xf55b('0x30')]=_['keys'](db[_0xf55b('0x4d')][_0xf55b('0x2c')]);_0x462627[_0xf55b('0x32')]=_['keys'](_0x515898[_0xf55b('0x32')]);_0x462627['filters']=_[_0xf55b('0x35')](_0x462627[_0xf55b('0x30')],_0x462627[_0xf55b('0x32')]);_0x102e79[_0xf55b('0x36')]=_[_0xf55b('0x35')](_0x462627[_0xf55b('0x30')],qs['fields'](_0x515898['query'][_0xf55b('0x37')]));_0x102e79[_0xf55b('0x36')]=_0x102e79[_0xf55b('0x36')][_0xf55b('0x48')]?_0x102e79[_0xf55b('0x36')]:_0x462627['model'];_0x102e79[_0xf55b('0x3a')]=qs['sort'](_0x515898[_0xf55b('0x32')][_0xf55b('0x3b')]);_0x102e79[_0xf55b('0x41')]=qs[_0xf55b('0x34')](_[_0xf55b('0x3c')](_0x515898[_0xf55b('0x32')],_0x462627[_0xf55b('0x34')]));if(_0x515898[_0xf55b('0x32')][_0xf55b('0x3d')]){_0x102e79['where']=_[_0xf55b('0x3e')](_0x102e79[_0xf55b('0x41')],{'$or':_[_0xf55b('0x31')](_0x102e79[_0xf55b('0x36')],function(_0xf6793a){var _0x409e0c={};_0x409e0c[_0xf6793a]={'$like':'%'+_0x515898['query'][_0xf55b('0x3d')]+'%'};return _0x409e0c;})});}_0x102e79=_[_0xf55b('0x3e')]({},_0x102e79,_0x515898[_0xf55b('0x40')]);return _0x704d55['getConfigurations'](_0x102e79);}})[_0xf55b('0x23')](function(_0x3f5402){if(_0x3f5402){_0x56ab8f=_0x3f5402[_0xf55b('0x48')];if(!_0x515898[_0xf55b('0x32')]['hasOwnProperty'](_0xf55b('0x39'))){_0x102e79[_0xf55b('0x1c')]=qs[_0xf55b('0x1c')](_0x515898['query'][_0xf55b('0x1c')]);_0x102e79[_0xf55b('0x1a')]=qs['offset'](_0x515898[_0xf55b('0x32')][_0xf55b('0x1a')]);}return _0x704d55['getConfigurations'](_0x102e79);}})['then'](function(_0x5a7e31){if(_0x5a7e31){return _0x5a7e31?{'count':_0x56ab8f,'rows':_0x5a7e31}:null;}})[_0xf55b('0x23')](respondWithResult(_0x1c7ad0,null))[_0xf55b('0x46')](handleError(_0x1c7ad0,null));};exports[_0xf55b('0x4e')]=function(_0x2f32c9,_0x3da0b2,_0x451e5e){if(_0x2f32c9[_0xf55b('0x4b')]['id']){delete _0x2f32c9['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x2f32c9[_0xf55b('0x47')]['id']}})[_0xf55b('0x23')](handleEntityNotFound(_0x3da0b2,null))[_0xf55b('0x23')](function(_0x5166a2){if(_0x5166a2){_0x2f32c9[_0xf55b('0x4b')]['AccountId']=_0x5166a2['id'];_0x2f32c9[_0xf55b('0x4b')][_0xf55b('0x4f')]=integrations[_0xf55b('0x50')](_0x2f32c9['body']['channel'],_0x2f32c9[_0xf55b('0x4b')][_0xf55b('0x2e')]);_0x2f32c9[_0xf55b('0x4b')][_0xf55b('0x51')]=integrations['getDescriptions'](_0x2f32c9[_0xf55b('0x4b')]['channel'],_0x2f32c9[_0xf55b('0x4b')][_0xf55b('0x2e')]);return db[_0xf55b('0x4d')]['create'](_0x2f32c9['body'],{'include':[{'model':db[_0xf55b('0x52')],'as':_0xf55b('0x4f')},{'model':db['DeskField'],'as':_0xf55b('0x51')}]});}return null;})[_0xf55b('0x23')](respondWithResult(_0x3da0b2,null))['catch'](handleError(_0x3da0b2,null));};exports[_0xf55b('0x53')]=function(_0x3eeead,_0x429548,_0x58f4b1){var _0x18d8ee=[{'name':_0xf55b('0x54'),'label':_0xf55b('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2efa5e='';return db[_0xf55b('0x2b')]['findOne']({'where':{'id':_0x3eeead[_0xf55b('0x47')]['id']},'attributes':['id',_0xf55b('0x55'),_0xf55b('0x56'),_0xf55b('0x57'),'password',_0xf55b('0x58'),_0xf55b('0x59'),'token','tokenSecret']})[_0xf55b('0x23')](handleEntityNotFound(_0x429548,null))[_0xf55b('0x23')](function(_0x41c2c1){if(_0x41c2c1){_0x2efa5e=_0x41c2c1[_0xf55b('0x55')];var _0x4538f2=_0x2efa5e['slice'](-0x1);if(_0x4538f2==='/'){_0x2efa5e=_0x2efa5e['substring'](0x0,_0x2efa5e[_0xf55b('0x5a')](_0x4538f2));}var _0x1e258c={'method':'GET','uri':util['format']('%s/custom_fields',_0x2efa5e),'headers':{'Content-Type':'application/json','Accept':_0xf55b('0x5b')},'json':!![]};if(_0x41c2c1['authType']===_0xf55b('0x5c')){_0x1e258c['headers'][_0xf55b('0x5d')]=util[_0xf55b('0x5e')]('Basic\x20%s',new Buffer(util[_0xf55b('0x5e')](_0xf55b('0x5f'),_0x41c2c1['username'],_0x41c2c1[_0xf55b('0x60')]))[_0xf55b('0x61')](_0xf55b('0x62')));}return rp(_0x1e258c)[_0xf55b('0x23')](function(_0x9629d5){return _0x18d8ee[_0xf55b('0x63')](_[_0xf55b('0x31')](_0x9629d5[_0xf55b('0x64')]['entries'],function(_0x1d9fdb){return{'id':_0x1d9fdb[_0xf55b('0x28')],'name':_0x1d9fdb[_0xf55b('0x28')],'type':_0x1d9fdb['type'],'active':_0x1d9fdb[_0xf55b('0x65')],'label':_0x1d9fdb[_0xf55b('0x66')],'custom':!![]};}));});}})['then'](function(_0x3fde12){return{'count':_0x3fde12['length'],'rows':_0x3fde12};})[_0xf55b('0x23')](respondWithResult(_0x429548,null))[_0xf55b('0x46')](function(_0x4acebb){var _0x5519ec=_0x3eeead[_0xf55b('0x32')][_0xf55b('0x67')]?0x1f4:_0x4acebb['statusCode']||0x1f4;logger['error'](_0xf55b('0x68'),'getFields',_0x5519ec,JSON[_0xf55b('0x69')](_0x4acebb));delete _0x4acebb[_0xf55b('0x28')];if(_0x5519ec===0x191){_0x5519ec=0x190;}_0x429548[_0xf55b('0x18')](_0x5519ec)[_0xf55b('0x29')](_0x3eeead[_0xf55b('0x32')][_0xf55b('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x4acebb[_0xf55b('0x6a')]}:_0x4acebb);});}; \ No newline at end of file +var _0x1c71=['Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','params','length','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','label','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test'];(function(_0x43c7cd,_0x2a81d4){var _0x215814=function(_0x261a14){while(--_0x261a14){_0x43c7cd['push'](_0x43c7cd['shift']());}};_0x215814(++_0x2a81d4);}(_0x1c71,0xe6));var _0x11c7=function(_0x5c22f8,_0x211987){_0x5c22f8=_0x5c22f8-0x0;var _0x1b0833=_0x1c71[_0x5c22f8];return _0x1b0833;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11c7('0x0'));var jsonpatch=require(_0x11c7('0x1'));var rp=require(_0x11c7('0x2'));var moment=require(_0x11c7('0x3'));var BPromise=require(_0x11c7('0x4'));var Mustache=require(_0x11c7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x11c7('0x6'));var csv=require(_0x11c7('0x7'));var ejs=require(_0x11c7('0x8'));var fs=require('fs');var fs_extra=require(_0x11c7('0x9'));var _=require(_0x11c7('0xa'));var squel=require('squel');var crypto=require(_0x11c7('0xb'));var jsforce=require(_0x11c7('0xc'));var deskjs=require(_0x11c7('0xd'));var toCsv=require(_0x11c7('0x7'));var querystring=require('querystring');var Papa=require(_0x11c7('0xe'));var Redis=require(_0x11c7('0xf'));var authService=require(_0x11c7('0x10'));var qs=require(_0x11c7('0x11'));var as=require(_0x11c7('0x12'));var hardwareService=require(_0x11c7('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x11c7('0x14'));var licenseUtil=require(_0x11c7('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x11c7('0x16'));function respondWithStatusCode(_0x1fa1cb,_0x3e4222){_0x3e4222=_0x3e4222||0xcc;return function(_0x35fbc1){if(_0x35fbc1){return _0x1fa1cb['sendStatus'](_0x3e4222);}return _0x1fa1cb[_0x11c7('0x17')](_0x3e4222)[_0x11c7('0x18')]();};}function respondWithResult(_0x316d8f,_0x1260cb){_0x1260cb=_0x1260cb||0xc8;return function(_0x46f0a0){if(_0x46f0a0){return _0x316d8f['status'](_0x1260cb)[_0x11c7('0x19')](_0x46f0a0);}};}function respondWithFilteredResult(_0x29a0f,_0x3ab14d){return function(_0x1d0f90){if(_0x1d0f90){var _0x33f05e=typeof _0x3ab14d[_0x11c7('0x1a')]===_0x11c7('0x1b')&&typeof _0x3ab14d[_0x11c7('0x1c')]===_0x11c7('0x1b');var _0x19b101=_0x1d0f90['count'];var _0x5ed65a=_0x33f05e?0x0:_0x3ab14d[_0x11c7('0x1a')];var _0x137f72=_0x33f05e?_0x1d0f90[_0x11c7('0x1d')]:_0x3ab14d[_0x11c7('0x1a')]+_0x3ab14d[_0x11c7('0x1c')];var _0x4cc089;if(_0x137f72>=_0x19b101){_0x137f72=_0x19b101;_0x4cc089=0xc8;}else{_0x4cc089=0xce;}_0x29a0f['status'](_0x4cc089);return _0x29a0f['set'](_0x11c7('0x1e'),_0x5ed65a+'-'+_0x137f72+'/'+_0x19b101)[_0x11c7('0x19')](_0x1d0f90);}return null;};}function patchUpdates(_0x3e2b68){return function(_0x1e979b){try{jsonpatch[_0x11c7('0x1f')](_0x1e979b,_0x3e2b68,!![]);}catch(_0x5d0a38){return BPromise['reject'](_0x5d0a38);}return _0x1e979b['save']();};}function saveUpdates(_0x563148,_0x2af522){return function(_0xde5069){if(_0xde5069){return _0xde5069[_0x11c7('0x20')](_0x563148)[_0x11c7('0x21')](function(_0xa84cd9){return _0xa84cd9;});}return null;};}function removeEntity(_0x5ecf76,_0x2c8e52){return function(_0x12724d){if(_0x12724d){return _0x12724d[_0x11c7('0x22')]()[_0x11c7('0x21')](function(){_0x5ecf76[_0x11c7('0x17')](0xcc)[_0x11c7('0x18')]();});}};}function handleEntityNotFound(_0x16a0a7,_0x329e46){return function(_0x6141fc){if(!_0x6141fc){_0x16a0a7[_0x11c7('0x23')](0x194);}return _0x6141fc;};}function handleError(_0x460370,_0x4f786e){_0x4f786e=_0x4f786e||0x1f4;return function(_0x4e4f3e){logger['error'](_0x4e4f3e['stack']);if(_0x4e4f3e[_0x11c7('0x24')]){delete _0x4e4f3e[_0x11c7('0x24')];}_0x460370[_0x11c7('0x17')](_0x4f786e)[_0x11c7('0x25')](_0x4e4f3e);};}exports[_0x11c7('0x26')]=function(_0x5d7fbe,_0xd33bd5){var _0x4963d7={},_0x8999e={},_0x4ee2e8={'count':0x0,'rows':[]};var _0x216409=_[_0x11c7('0x27')](db['DeskAccount'][_0x11c7('0x28')],function(_0x53a3be){return{'name':_0x53a3be[_0x11c7('0x29')],'type':_0x53a3be[_0x11c7('0x2a')][_0x11c7('0x2b')]};});_0x8999e[_0x11c7('0x2c')]=_[_0x11c7('0x27')](_0x216409,_0x11c7('0x24'));_0x8999e['query']=_[_0x11c7('0x2d')](_0x5d7fbe['query']);_0x8999e[_0x11c7('0x2e')]=_[_0x11c7('0x2f')](_0x8999e[_0x11c7('0x2c')],_0x8999e[_0x11c7('0x30')]);_0x4963d7['attributes']=_[_0x11c7('0x2f')](_0x8999e[_0x11c7('0x2c')],qs[_0x11c7('0x31')](_0x5d7fbe[_0x11c7('0x30')]['fields']));_0x4963d7['attributes']=_0x4963d7[_0x11c7('0x32')]['length']?_0x4963d7[_0x11c7('0x32')]:_0x8999e['model'];if(!_0x5d7fbe['query'][_0x11c7('0x33')](_0x11c7('0x34'))){_0x4963d7[_0x11c7('0x1c')]=qs[_0x11c7('0x1c')](_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x1c')]);_0x4963d7[_0x11c7('0x1a')]=qs['offset'](_0x5d7fbe['query'][_0x11c7('0x1a')]);}_0x4963d7[_0x11c7('0x35')]=qs[_0x11c7('0x36')](_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x36')]);_0x4963d7[_0x11c7('0x37')]=qs[_0x11c7('0x2e')](_[_0x11c7('0x38')](_0x5d7fbe['query'],_0x8999e[_0x11c7('0x2e')]),_0x216409);if(_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x39')]){_0x4963d7[_0x11c7('0x37')]=_[_0x11c7('0x3a')](_0x4963d7['where'],{'$or':_[_0x11c7('0x27')](_0x216409,function(_0x59ca1f){if(_0x59ca1f[_0x11c7('0x2a')]!==_0x11c7('0x3b')){var _0x514a47={};_0x514a47[_0x59ca1f['name']]={'$like':'%'+_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x39')]+'%'};return _0x514a47;}})});}_0x4963d7=_[_0x11c7('0x3a')]({},_0x4963d7,_0x5d7fbe[_0x11c7('0x3c')]);var _0x4ab8a9={'where':_0x4963d7[_0x11c7('0x37')]};return db[_0x11c7('0x3d')]['count'](_0x4ab8a9)[_0x11c7('0x21')](function(_0x10a7d8){_0x4ee2e8[_0x11c7('0x1d')]=_0x10a7d8;if(_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x3e')]){_0x4963d7[_0x11c7('0x3f')]=[{'all':!![]}];}return db[_0x11c7('0x3d')][_0x11c7('0x40')](_0x4963d7);})[_0x11c7('0x21')](function(_0x4d830c){_0x4ee2e8['rows']=_0x4d830c;return _0x4ee2e8;})[_0x11c7('0x21')](respondWithFilteredResult(_0xd33bd5,_0x4963d7))['catch'](handleError(_0xd33bd5,null));};exports['show']=function(_0x171d3c,_0x186a03){var _0x37a256={'raw':![],'where':{'id':_0x171d3c[_0x11c7('0x41')]['id']}},_0x525249={};_0x525249[_0x11c7('0x2c')]=_[_0x11c7('0x2d')](db['DeskAccount'][_0x11c7('0x28')]);_0x525249['query']=_[_0x11c7('0x2d')](_0x171d3c['query']);_0x525249[_0x11c7('0x2e')]=_[_0x11c7('0x2f')](_0x525249[_0x11c7('0x2c')],_0x525249['query']);_0x37a256[_0x11c7('0x32')]=_[_0x11c7('0x2f')](_0x525249[_0x11c7('0x2c')],qs[_0x11c7('0x31')](_0x171d3c[_0x11c7('0x30')]['fields']));_0x37a256[_0x11c7('0x32')]=_0x37a256[_0x11c7('0x32')][_0x11c7('0x42')]?_0x37a256[_0x11c7('0x32')]:_0x525249[_0x11c7('0x2c')];if(_0x171d3c[_0x11c7('0x30')][_0x11c7('0x3e')]){_0x37a256[_0x11c7('0x3f')]=[{'all':!![]}];}_0x37a256=_[_0x11c7('0x3a')]({},_0x37a256,_0x171d3c['options']);return db[_0x11c7('0x3d')][_0x11c7('0x43')](_0x37a256)[_0x11c7('0x21')](handleEntityNotFound(_0x186a03,null))[_0x11c7('0x21')](respondWithResult(_0x186a03,null))[_0x11c7('0x44')](handleError(_0x186a03,null));};exports[_0x11c7('0x45')]=function(_0x10719f,_0x4c2a91){return db[_0x11c7('0x3d')][_0x11c7('0x45')](_0x10719f[_0x11c7('0x46')],{})[_0x11c7('0x21')](respondWithResult(_0x4c2a91,0xc9))[_0x11c7('0x44')](handleError(_0x4c2a91,null));};exports[_0x11c7('0x20')]=function(_0x19fae3,_0xa90aff){if(_0x19fae3[_0x11c7('0x46')]['id']){delete _0x19fae3[_0x11c7('0x46')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x19fae3[_0x11c7('0x41')]['id']}})[_0x11c7('0x21')](handleEntityNotFound(_0xa90aff,null))[_0x11c7('0x21')](saveUpdates(_0x19fae3['body'],null))[_0x11c7('0x21')](respondWithResult(_0xa90aff,null))[_0x11c7('0x44')](handleError(_0xa90aff,null));};exports[_0x11c7('0x22')]=function(_0x42ea45,_0x596981){return db[_0x11c7('0x3d')][_0x11c7('0x43')]({'where':{'id':_0x42ea45['params']['id']}})['then'](handleEntityNotFound(_0x596981,null))[_0x11c7('0x21')](removeEntity(_0x596981,null))[_0x11c7('0x44')](handleError(_0x596981,null));};exports[_0x11c7('0x47')]=function(_0x3c791c,_0x21a63a,_0x23614c){var _0x23f7e7={};var _0x315655={};var _0x487892;var _0x41b220;return db[_0x11c7('0x3d')][_0x11c7('0x48')]({'where':{'id':_0x3c791c[_0x11c7('0x41')]['id']}})[_0x11c7('0x21')](handleEntityNotFound(_0x21a63a,null))[_0x11c7('0x21')](function(_0x2cc642){if(_0x2cc642){_0x487892=_0x2cc642;_0x315655['model']=_[_0x11c7('0x2d')](db[_0x11c7('0x49')]['rawAttributes']);_0x315655[_0x11c7('0x30')]=_[_0x11c7('0x2d')](_0x3c791c[_0x11c7('0x30')]);_0x315655['filters']=_[_0x11c7('0x2f')](_0x315655[_0x11c7('0x2c')],_0x315655['query']);_0x23f7e7['attributes']=_[_0x11c7('0x2f')](_0x315655[_0x11c7('0x2c')],qs[_0x11c7('0x31')](_0x3c791c['query']['fields']));_0x23f7e7[_0x11c7('0x32')]=_0x23f7e7[_0x11c7('0x32')][_0x11c7('0x42')]?_0x23f7e7['attributes']:_0x315655['model'];_0x23f7e7['order']=qs['sort'](_0x3c791c[_0x11c7('0x30')][_0x11c7('0x36')]);_0x23f7e7[_0x11c7('0x37')]=qs[_0x11c7('0x2e')](_[_0x11c7('0x38')](_0x3c791c[_0x11c7('0x30')],_0x315655['filters']));if(_0x3c791c[_0x11c7('0x30')]['filter']){_0x23f7e7[_0x11c7('0x37')]=_[_0x11c7('0x3a')](_0x23f7e7['where'],{'$or':_['map'](_0x23f7e7['attributes'],function(_0x412bfd){var _0x35c718={};_0x35c718[_0x412bfd]={'$like':'%'+_0x3c791c[_0x11c7('0x30')][_0x11c7('0x39')]+'%'};return _0x35c718;})});}_0x23f7e7=_[_0x11c7('0x3a')]({},_0x23f7e7,_0x3c791c[_0x11c7('0x3c')]);return _0x487892[_0x11c7('0x47')](_0x23f7e7);}})[_0x11c7('0x21')](function(_0x66c522){if(_0x66c522){_0x41b220=_0x66c522[_0x11c7('0x42')];if(!_0x3c791c[_0x11c7('0x30')][_0x11c7('0x33')](_0x11c7('0x34'))){_0x23f7e7['limit']=qs[_0x11c7('0x1c')](_0x3c791c[_0x11c7('0x30')][_0x11c7('0x1c')]);_0x23f7e7[_0x11c7('0x1a')]=qs[_0x11c7('0x1a')](_0x3c791c['query']['offset']);}return _0x487892[_0x11c7('0x47')](_0x23f7e7);}})[_0x11c7('0x21')](function(_0x426c70){if(_0x426c70){return _0x426c70?{'count':_0x41b220,'rows':_0x426c70}:null;}})[_0x11c7('0x21')](respondWithResult(_0x21a63a,null))['catch'](handleError(_0x21a63a,null));};exports[_0x11c7('0x4a')]=function(_0x148055,_0xc6ffb8,_0x5f3930){if(_0x148055[_0x11c7('0x46')]['id']){delete _0x148055[_0x11c7('0x46')]['id'];}return db[_0x11c7('0x3d')]['findOne']({'where':{'id':_0x148055[_0x11c7('0x41')]['id']}})['then'](handleEntityNotFound(_0xc6ffb8,null))[_0x11c7('0x21')](function(_0x169208){if(_0x169208){_0x148055[_0x11c7('0x46')]['AccountId']=_0x169208['id'];_0x148055['body'][_0x11c7('0x4b')]=integrations[_0x11c7('0x4c')](_0x148055[_0x11c7('0x46')][_0x11c7('0x4d')],_0x148055[_0x11c7('0x46')][_0x11c7('0x2a')]);_0x148055[_0x11c7('0x46')]['Descriptions']=integrations[_0x11c7('0x4e')](_0x148055[_0x11c7('0x46')][_0x11c7('0x4d')],_0x148055[_0x11c7('0x46')][_0x11c7('0x2a')]);return db[_0x11c7('0x49')][_0x11c7('0x45')](_0x148055['body'],{'include':[{'model':db['DeskField'],'as':_0x11c7('0x4b')},{'model':db[_0x11c7('0x4f')],'as':_0x11c7('0x50')}]});}return null;})[_0x11c7('0x21')](respondWithResult(_0xc6ffb8,null))['catch'](handleError(_0xc6ffb8,null));};exports['getFields']=function(_0x27bb69,_0x38de54,_0x487f36){var _0x1c94f5=[{'name':_0x11c7('0x51'),'label':_0x11c7('0x51'),'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 _0x4d2e17='';return db[_0x11c7('0x3d')][_0x11c7('0x48')]({'where':{'id':_0x27bb69[_0x11c7('0x41')]['id']},'attributes':['id',_0x11c7('0x52'),_0x11c7('0x53'),_0x11c7('0x54'),_0x11c7('0x55'),_0x11c7('0x56'),_0x11c7('0x57'),_0x11c7('0x58'),_0x11c7('0x59')]})[_0x11c7('0x21')](handleEntityNotFound(_0x38de54,null))[_0x11c7('0x21')](function(_0x4abf9a){if(_0x4abf9a){_0x4d2e17=_0x4abf9a['remoteUri'];var _0x49a7d4=_0x4d2e17[_0x11c7('0x5a')](-0x1);if(_0x49a7d4==='/'){_0x4d2e17=_0x4d2e17[_0x11c7('0x5b')](0x0,_0x4d2e17[_0x11c7('0x5c')](_0x49a7d4));}var _0x36fdef={'method':_0x11c7('0x5d'),'uri':util[_0x11c7('0x5e')](_0x11c7('0x5f'),_0x4d2e17),'headers':{'Content-Type':'application/json','Accept':_0x11c7('0x60')},'json':!![]};if(_0x4abf9a['authType']===_0x11c7('0x61')){_0x36fdef[_0x11c7('0x62')]['Authorization']=util[_0x11c7('0x5e')](_0x11c7('0x63'),new Buffer(util['format'](_0x11c7('0x64'),_0x4abf9a[_0x11c7('0x54')],_0x4abf9a[_0x11c7('0x55')]))[_0x11c7('0x65')](_0x11c7('0x66')));}return rp(_0x36fdef)[_0x11c7('0x21')](function(_0x38ed5b){return _0x1c94f5[_0x11c7('0x67')](_['map'](_0x38ed5b[_0x11c7('0x68')][_0x11c7('0x69')],function(_0x1d210d){return{'id':_0x1d210d['name'],'name':_0x1d210d[_0x11c7('0x24')],'type':_0x1d210d[_0x11c7('0x2a')],'active':_0x1d210d['active'],'label':_0x1d210d[_0x11c7('0x6a')],'custom':!![]};}));});}})['then'](function(_0x2f82aa){return{'count':_0x2f82aa[_0x11c7('0x42')],'rows':_0x2f82aa};})[_0x11c7('0x21')](respondWithResult(_0x38de54,null))[_0x11c7('0x44')](function(_0x418d3f){var _0x366a54=_0x27bb69[_0x11c7('0x30')]['test']?0x1f4:_0x418d3f['statusCode']||0x1f4;logger[_0x11c7('0x6b')](_0x11c7('0x6c'),_0x11c7('0x6d'),_0x366a54,JSON[_0x11c7('0x6e')](_0x418d3f));delete _0x418d3f[_0x11c7('0x24')];if(_0x366a54===0x191){_0x366a54=0x190;}_0x38de54['status'](_0x366a54)[_0x11c7('0x25')](_0x27bb69[_0x11c7('0x30')][_0x11c7('0x6f')]?{'message':_0x11c7('0x70'),'statusCode':_0x418d3f[_0x11c7('0x71')]}:_0x418d3f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 4b4c6ec..69a4fa2 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 _0xcc8d=['define','DeskAccount','int_desk_accounts','lodash','util','moment','bluebird','path','../../config/environment','./intDeskAccount.attributes','exports'];(function(_0x44a4f4,_0x308fe4){var _0x4ba86f=function(_0x3aa230){while(--_0x3aa230){_0x44a4f4['push'](_0x44a4f4['shift']());}};_0x4ba86f(++_0x308fe4);}(_0xcc8d,0x1bb));var _0xdcc8=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0xcc8d[_0x4cd846];return _0x2f2a7d;};'use strict';var _=require(_0xdcc8('0x0'));var util=require(_0xdcc8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdcc8('0x2'));var BPromise=require(_0xdcc8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcc8('0x4'));var rimraf=require('rimraf');var config=require(_0xdcc8('0x5'));var attributes=require(_0xdcc8('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xdcc8('0x7')]=function(_0x4f0ebc,_0x18ce6e){return _0x4f0ebc[_0xdcc8('0x8')](_0xdcc8('0x9'),attributes,{'tableName':_0xdcc8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fb0=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x29524a,_0x29aab3){var _0x22d793=function(_0x4d4a05){while(--_0x4d4a05){_0x29524a['push'](_0x29524a['shift']());}};_0x22d793(++_0x29aab3);}(_0x3fb0,0x1c8));var _0x03fb=function(_0x2d3796,_0x38125a){_0x2d3796=_0x2d3796-0x0;var _0x26ecb5=_0x3fb0[_0x2d3796];return _0x26ecb5;};'use strict';var _=require(_0x03fb('0x0'));var util=require(_0x03fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x03fb('0x2'));var BPromise=require(_0x03fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03fb('0x4'));var rimraf=require(_0x03fb('0x5'));var config=require(_0x03fb('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x03fb('0x7'));module[_0x03fb('0x8')]=function(_0x33e711,_0x33c0c6){return _0x33e711[_0x03fb('0x9')](_0x03fb('0xa'),attributes,{'tableName':_0x03fb('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 02b9961..fd2bea7 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 _0x3ca4=['find','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','GetDeskAccount','findAll','options','where','attributes','limit','include','map','model','catch','ShowDeskAccount','DeskAccount'];(function(_0x10eeca,_0x430d68){var _0x55a3b7=function(_0x318a6a){while(--_0x318a6a){_0x10eeca['push'](_0x10eeca['shift']());}};_0x55a3b7(++_0x430d68);}(_0x3ca4,0x158));var _0x43ca=function(_0x1d37d5,_0x3ce72d){_0x1d37d5=_0x1d37d5-0x0;var _0x5df580=_0x3ca4[_0x1d37d5];return _0x5df580;};'use strict';var _=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x43ca('0x2'));var fs=require('fs');var Redis=require(_0x43ca('0x3'));var db=require(_0x43ca('0x4'))['db'];var utils=require(_0x43ca('0x5'));var logger=require(_0x43ca('0x6'))(_0x43ca('0x7'));var config=require(_0x43ca('0x8'));var jayson=require(_0x43ca('0x9'));var client=jayson[_0x43ca('0xa')][_0x43ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49465b,_0xe19e54,_0x7dd017){return new BPromise(function(_0x1a2f53,_0x56962f){return client[_0x43ca('0xc')](_0x49465b,_0x7dd017)[_0x43ca('0xd')](function(_0x2bfb36){logger[_0x43ca('0xe')]('DeskAccount,\x20%s,\x20%s',_0xe19e54,'request\x20sent');logger[_0x43ca('0xf')](_0x43ca('0x10'),_0xe19e54,_0x43ca('0x11'),JSON[_0x43ca('0x12')](_0x2bfb36));if(_0x2bfb36[_0x43ca('0x13')]){if(_0x2bfb36[_0x43ca('0x13')][_0x43ca('0x14')]===0x1f4){logger[_0x43ca('0x13')]('DeskAccount,\x20%s,\x20%s',_0xe19e54,_0x2bfb36[_0x43ca('0x13')][_0x43ca('0x15')]);return _0x56962f(_0x2bfb36[_0x43ca('0x13')][_0x43ca('0x15')]);}logger[_0x43ca('0x13')](_0x43ca('0x16'),_0xe19e54,_0x2bfb36[_0x43ca('0x13')][_0x43ca('0x15')]);return _0x1a2f53(_0x2bfb36[_0x43ca('0x13')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0xe19e54,_0x43ca('0x11'));_0x1a2f53(_0x2bfb36[_0x43ca('0x17')][_0x43ca('0x15')]);}})['catch'](function(_0x9be0a){logger[_0x43ca('0x13')](_0x43ca('0x16'),_0xe19e54,_0x9be0a);_0x56962f(_0x9be0a);});});}exports[_0x43ca('0x18')]=function(_0xf0bc9e){var _0x1f2178=this;return new Promise(function(_0x4a66a4,_0x25c9be){return db['DeskAccount'][_0x43ca('0x19')]({'raw':_0xf0bc9e[_0x43ca('0x1a')]?_0xf0bc9e[_0x43ca('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xf0bc9e[_0x43ca('0x1a')]?_0xf0bc9e[_0x43ca('0x1a')][_0x43ca('0x1b')]||null:null,'attributes':_0xf0bc9e[_0x43ca('0x1a')]?_0xf0bc9e[_0x43ca('0x1a')][_0x43ca('0x1c')]||null:null,'limit':_0xf0bc9e[_0x43ca('0x1a')]?_0xf0bc9e[_0x43ca('0x1a')][_0x43ca('0x1d')]||null:null,'include':_0xf0bc9e[_0x43ca('0x1a')]?_0xf0bc9e[_0x43ca('0x1a')][_0x43ca('0x1e')]?_[_0x43ca('0x1f')](_0xf0bc9e[_0x43ca('0x1a')][_0x43ca('0x1e')],function(_0x265291){return{'model':db[_0x265291[_0x43ca('0x20')]],'as':_0x265291['as'],'attributes':_0x265291[_0x43ca('0x1c')],'include':_0x265291[_0x43ca('0x1e')]?_[_0x43ca('0x1f')](_0x265291[_0x43ca('0x1e')],function(_0x5d58dc){return{'model':db[_0x5d58dc['model']],'as':_0x5d58dc['as'],'attributes':_0x5d58dc[_0x43ca('0x1c')],'include':_0x5d58dc[_0x43ca('0x1e')]?_[_0x43ca('0x1f')](_0x5d58dc['include'],function(_0x518bb3){return{'model':db[_0x518bb3[_0x43ca('0x20')]],'as':_0x518bb3['as'],'attributes':_0x518bb3[_0x43ca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x43ca('0xd')](function(_0x132c24){logger[_0x43ca('0xe')]('GetDeskAccount',_0xf0bc9e);logger[_0x43ca('0xf')]('GetDeskAccount',_0xf0bc9e,JSON[_0x43ca('0x12')](_0x132c24));_0x4a66a4(_0x132c24);})[_0x43ca('0x21')](function(_0x1d3526){logger[_0x43ca('0x13')](_0x43ca('0x18'),_0x1d3526[_0x43ca('0x15')],_0xf0bc9e);_0x25c9be(_0x1f2178[_0x43ca('0x13')](0x1f4,_0x1d3526['message']));});});};exports[_0x43ca('0x22')]=function(_0x503e11){var _0x641b21=this;return new Promise(function(_0x22763d,_0x5da8f9){return db[_0x43ca('0x23')][_0x43ca('0x24')]({'raw':_0x503e11['options']?_0x503e11[_0x43ca('0x1a')][_0x43ca('0x25')]===undefined?!![]:![]:!![],'where':_0x503e11['options']?_0x503e11[_0x43ca('0x1a')]['where']||null:null,'attributes':_0x503e11[_0x43ca('0x1a')]?_0x503e11[_0x43ca('0x1a')][_0x43ca('0x1c')]||null:null,'include':_0x503e11[_0x43ca('0x1a')]?_0x503e11[_0x43ca('0x1a')]['include']?_['map'](_0x503e11[_0x43ca('0x1a')][_0x43ca('0x1e')],function(_0xed05fc){return{'model':db[_0xed05fc[_0x43ca('0x20')]],'as':_0xed05fc['as'],'attributes':_0xed05fc[_0x43ca('0x1c')],'include':_0xed05fc[_0x43ca('0x1e')]?_[_0x43ca('0x1f')](_0xed05fc[_0x43ca('0x1e')],function(_0x532e30){return{'model':db[_0x532e30[_0x43ca('0x20')]],'as':_0x532e30['as'],'attributes':_0x532e30[_0x43ca('0x1c')],'include':_0x532e30[_0x43ca('0x1e')]?_['map'](_0x532e30['include'],function(_0x45ffe0){return{'model':db[_0x45ffe0['model']],'as':_0x45ffe0['as'],'attributes':_0x45ffe0[_0x43ca('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x43ca('0xd')](function(_0x2c7b3f){logger[_0x43ca('0xe')](_0x43ca('0x22'),_0x503e11);logger['debug'](_0x43ca('0x22'),_0x503e11,JSON[_0x43ca('0x12')](_0x2c7b3f));_0x22763d(_0x2c7b3f);})[_0x43ca('0x21')](function(_0x42ff47){logger[_0x43ca('0x13')](_0x43ca('0x22'),_0x42ff47[_0x43ca('0x15')],_0x503e11);_0x5da8f9(_0x641b21[_0x43ca('0x13')](0x1f4,_0x42ff47[_0x43ca('0x15')]));});});}; \ No newline at end of file +var _0x698f=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','stringify','find','raw','ShowDeskAccount','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x567ec0,_0x676a8e){var _0x109c75=function(_0x3087d5){while(--_0x3087d5){_0x567ec0['push'](_0x567ec0['shift']());}};_0x109c75(++_0x676a8e);}(_0x698f,0xd3));var _0xf698=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x698f[_0x13b392];return _0x39db24;};'use strict';var _=require('lodash');var util=require(_0xf698('0x0'));var moment=require(_0xf698('0x1'));var BPromise=require(_0xf698('0x2'));var rs=require(_0xf698('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf698('0x4'))['db'];var utils=require(_0xf698('0x5'));var logger=require('../../config/logger')(_0xf698('0x6'));var config=require(_0xf698('0x7'));var jayson=require(_0xf698('0x8'));var client=jayson[_0xf698('0x9')][_0xf698('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x86d430,_0x258ba1,_0x139ff8){return new BPromise(function(_0x5587a0,_0x435031){return client[_0xf698('0xb')](_0x86d430,_0x139ff8)[_0xf698('0xc')](function(_0x370080){logger[_0xf698('0xd')](_0xf698('0xe'),_0x258ba1,_0xf698('0xf'));logger[_0xf698('0x10')](_0xf698('0x11'),_0x258ba1,_0xf698('0xf'),JSON['stringify'](_0x370080));if(_0x370080[_0xf698('0x12')]){if(_0x370080[_0xf698('0x12')][_0xf698('0x13')]===0x1f4){logger[_0xf698('0x12')](_0xf698('0xe'),_0x258ba1,_0x370080['error'][_0xf698('0x14')]);return _0x435031(_0x370080[_0xf698('0x12')][_0xf698('0x14')]);}logger['error'](_0xf698('0xe'),_0x258ba1,_0x370080['error'][_0xf698('0x14')]);return _0x5587a0(_0x370080[_0xf698('0x12')][_0xf698('0x14')]);}else{logger[_0xf698('0xd')](_0xf698('0xe'),_0x258ba1,'request\x20sent');_0x5587a0(_0x370080['result'][_0xf698('0x14')]);}})[_0xf698('0x15')](function(_0x9dba58){logger[_0xf698('0x12')](_0xf698('0xe'),_0x258ba1,_0x9dba58);_0x435031(_0x9dba58);});});}exports[_0xf698('0x16')]=function(_0x36ad36){var _0x1b4fa0=this;return new Promise(function(_0x5ed26a,_0x174b52){return db[_0xf698('0x17')][_0xf698('0x18')]({'raw':_0x36ad36[_0xf698('0x19')]?_0x36ad36[_0xf698('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x36ad36[_0xf698('0x19')]?_0x36ad36[_0xf698('0x19')][_0xf698('0x1a')]||null:null,'attributes':_0x36ad36[_0xf698('0x19')]?_0x36ad36['options'][_0xf698('0x1b')]||null:null,'limit':_0x36ad36[_0xf698('0x19')]?_0x36ad36['options'][_0xf698('0x1c')]||null:null,'include':_0x36ad36['options']?_0x36ad36[_0xf698('0x19')][_0xf698('0x1d')]?_[_0xf698('0x1e')](_0x36ad36[_0xf698('0x19')][_0xf698('0x1d')],function(_0x30c6fc){return{'model':db[_0x30c6fc[_0xf698('0x1f')]],'as':_0x30c6fc['as'],'attributes':_0x30c6fc[_0xf698('0x1b')],'include':_0x30c6fc['include']?_[_0xf698('0x1e')](_0x30c6fc[_0xf698('0x1d')],function(_0x274d8e){return{'model':db[_0x274d8e['model']],'as':_0x274d8e['as'],'attributes':_0x274d8e[_0xf698('0x1b')],'include':_0x274d8e[_0xf698('0x1d')]?_['map'](_0x274d8e[_0xf698('0x1d')],function(_0xa175f6){return{'model':db[_0xa175f6[_0xf698('0x1f')]],'as':_0xa175f6['as'],'attributes':_0xa175f6[_0xf698('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf698('0xc')](function(_0x4e8f39){logger[_0xf698('0xd')](_0xf698('0x16'),_0x36ad36);logger[_0xf698('0x10')](_0xf698('0x16'),_0x36ad36,JSON[_0xf698('0x20')](_0x4e8f39));_0x5ed26a(_0x4e8f39);})['catch'](function(_0x5b755d){logger[_0xf698('0x12')](_0xf698('0x16'),_0x5b755d[_0xf698('0x14')],_0x36ad36);_0x174b52(_0x1b4fa0['error'](0x1f4,_0x5b755d['message']));});});};exports['ShowDeskAccount']=function(_0xc22bd4){var _0x40b1d3=this;return new Promise(function(_0x4f572c,_0x3ad494){return db['DeskAccount'][_0xf698('0x21')]({'raw':_0xc22bd4['options']?_0xc22bd4['options'][_0xf698('0x22')]===undefined?!![]:![]:!![],'where':_0xc22bd4['options']?_0xc22bd4['options'][_0xf698('0x1a')]||null:null,'attributes':_0xc22bd4[_0xf698('0x19')]?_0xc22bd4[_0xf698('0x19')][_0xf698('0x1b')]||null:null,'include':_0xc22bd4['options']?_0xc22bd4['options']['include']?_['map'](_0xc22bd4[_0xf698('0x19')]['include'],function(_0x2e152e){return{'model':db[_0x2e152e[_0xf698('0x1f')]],'as':_0x2e152e['as'],'attributes':_0x2e152e[_0xf698('0x1b')],'include':_0x2e152e[_0xf698('0x1d')]?_[_0xf698('0x1e')](_0x2e152e[_0xf698('0x1d')],function(_0x945df0){return{'model':db[_0x945df0[_0xf698('0x1f')]],'as':_0x945df0['as'],'attributes':_0x945df0[_0xf698('0x1b')],'include':_0x945df0[_0xf698('0x1d')]?_[_0xf698('0x1e')](_0x945df0['include'],function(_0x1facd3){return{'model':db[_0x1facd3[_0xf698('0x1f')]],'as':_0x1facd3['as'],'attributes':_0x1facd3[_0xf698('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf698('0xc')](function(_0xdbadc7){logger[_0xf698('0xd')](_0xf698('0x23'),_0xc22bd4);logger[_0xf698('0x10')]('ShowDeskAccount',_0xc22bd4,JSON['stringify'](_0xdbadc7));_0x4f572c(_0xdbadc7);})[_0xf698('0x15')](function(_0x434606){logger[_0xf698('0x12')](_0xf698('0x23'),_0x434606[_0xf698('0x14')],_0xc22bd4);_0x3ad494(_0x40b1d3[_0xf698('0x12')](0x1f4,_0x434606[_0xf698('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c67f6e0..68b1bc9 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x2a5cac,_0x148d3f){var _0x6394b1=function(_0x498c24){while(--_0x498c24){_0x2a5cac['push'](_0x2a5cac['shift']());}};_0x6394b1(++_0x148d3f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _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(_0x1ccf4d,_0x22a5d6){var _0x76cdda=function(_0x5a1281){while(--_0x5a1281){_0x1ccf4d['push'](_0x1ccf4d['shift']());}};_0x76cdda(++_0x22a5d6);}(_0x008c,0x188));var _0xc008=function(_0xb02766,_0xa37d90){_0xb02766=_0xb02766-0x0;var _0x560e6c=_0x008c[_0xb02766];return _0x560e6c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index b72b731..c207817 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 _0x2944=['sequelize','STRING'];(function(_0x51097c,_0x4f0ebc){var _0x528321=function(_0x561b2d){while(--_0x561b2d){_0x51097c['push'](_0x51097c['shift']());}};_0x528321(++_0x4f0ebc);}(_0x2944,0x1f0));var _0x4294=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x2944[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x4294('0x0'));module['exports']={'name':{'type':Sequelize[_0x4294('0x1')]},'description':{'type':Sequelize[_0x4294('0x1')]}}; \ No newline at end of file +var _0x6567=['STRING','sequelize'];(function(_0x1354c9,_0x475347){var _0x116916=function(_0x24051b){while(--_0x24051b){_0x1354c9['push'](_0x1354c9['shift']());}};_0x116916(++_0x475347);}(_0x6567,0x17d));var _0x7656=function(_0x5eb71a,_0x5e0ad4){_0x5eb71a=_0x5eb71a-0x0;var _0x34abdd=_0x6567[_0x5eb71a];return _0x34abdd;};'use strict';var Sequelize=require(_0x7656('0x0'));module['exports']={'name':{'type':Sequelize[_0x7656('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 102d4e1..fc14f20 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 _0x117f=['length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields'];(function(_0x2da80e,_0x2391be){var _0x242118=function(_0x34b5b4){while(--_0x34b5b4){_0x2da80e['push'](_0x2da80e['shift']());}};_0x242118(++_0x2391be);}(_0x117f,0x16a));var _0xf117=function(_0x268de5,_0x2a4b73){_0x268de5=_0x268de5-0x0;var _0xc5fb51=_0x117f[_0x268de5];return _0xc5fb51;};'use strict';var emlformat=require(_0xf117('0x0'));var rimraf=require(_0xf117('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf117('0x2'));var rp=require(_0xf117('0x3'));var moment=require(_0xf117('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf117('0x5'));var util=require(_0xf117('0x6'));var path=require(_0xf117('0x7'));var sox=require(_0xf117('0x8'));var csv=require(_0xf117('0x9'));var ejs=require(_0xf117('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf117('0xb'));var squel=require('squel');var crypto=require(_0xf117('0xc'));var jsforce=require(_0xf117('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf117('0xe'));var Papa=require(_0xf117('0xf'));var Redis=require(_0xf117('0x10'));var authService=require(_0xf117('0x11'));var qs=require(_0xf117('0x12'));var as=require(_0xf117('0x13'));var hardwareService=require(_0xf117('0x14'));var logger=require(_0xf117('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf117('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27d05a,_0x2baefb){_0x2baefb=_0x2baefb||0xcc;return function(_0x1fb3a0){if(_0x1fb3a0){return _0x27d05a[_0xf117('0x17')](_0x2baefb);}return _0x27d05a[_0xf117('0x18')](_0x2baefb)[_0xf117('0x19')]();};}function respondWithResult(_0x304ae9,_0x537de5){_0x537de5=_0x537de5||0xc8;return function(_0x18dc7d){if(_0x18dc7d){return _0x304ae9[_0xf117('0x18')](_0x537de5)[_0xf117('0x1a')](_0x18dc7d);}};}function respondWithFilteredResult(_0x407b19,_0x54a2e8){return function(_0x4170d7){if(_0x4170d7){var _0x2aec43=typeof _0x54a2e8[_0xf117('0x1b')]===_0xf117('0x1c')&&typeof _0x54a2e8[_0xf117('0x1d')]===_0xf117('0x1c');var _0x4acfba=_0x4170d7[_0xf117('0x1e')];var _0x47848d=_0x2aec43?0x0:_0x54a2e8[_0xf117('0x1b')];var _0x3a01e3=_0x2aec43?_0x4170d7['count']:_0x54a2e8[_0xf117('0x1b')]+_0x54a2e8[_0xf117('0x1d')];var _0x34eb09;if(_0x3a01e3>=_0x4acfba){_0x3a01e3=_0x4acfba;_0x34eb09=0xc8;}else{_0x34eb09=0xce;}_0x407b19[_0xf117('0x18')](_0x34eb09);return _0x407b19[_0xf117('0x1f')](_0xf117('0x20'),_0x47848d+'-'+_0x3a01e3+'/'+_0x4acfba)[_0xf117('0x1a')](_0x4170d7);}return null;};}function patchUpdates(_0x58dfe2){return function(_0x4e9183){try{jsonpatch[_0xf117('0x21')](_0x4e9183,_0x58dfe2,!![]);}catch(_0x57c31d){return BPromise[_0xf117('0x22')](_0x57c31d);}return _0x4e9183['save']();};}function saveUpdates(_0x5c6106,_0x3cae84){return function(_0x199fea){if(_0x199fea){return _0x199fea[_0xf117('0x23')](_0x5c6106)[_0xf117('0x24')](function(_0x119c1e){return _0x119c1e;});}return null;};}function removeEntity(_0x4bfd91,_0x83b169){return function(_0x3c1c3e){if(_0x3c1c3e){return _0x3c1c3e[_0xf117('0x25')]()['then'](function(){_0x4bfd91[_0xf117('0x18')](0xcc)[_0xf117('0x19')]();});}};}function handleEntityNotFound(_0x288014,_0x55475c){return function(_0x24fcc9){if(!_0x24fcc9){_0x288014[_0xf117('0x17')](0x194);}return _0x24fcc9;};}function handleError(_0x20e1fc,_0x91e04c){_0x91e04c=_0x91e04c||0x1f4;return function(_0x5424a7){logger['error'](_0x5424a7['stack']);if(_0x5424a7['name']){delete _0x5424a7[_0xf117('0x26')];}_0x20e1fc['status'](_0x91e04c)[_0xf117('0x27')](_0x5424a7);};}exports[_0xf117('0x28')]=function(_0x3a4d4e,_0x2b4774){var _0x290044={},_0x51033c={},_0x4098f9={'count':0x0,'rows':[]};var _0x208626=_[_0xf117('0x29')](db[_0xf117('0x2a')][_0xf117('0x2b')],function(_0x3c5ccf){return{'name':_0x3c5ccf[_0xf117('0x2c')],'type':_0x3c5ccf[_0xf117('0x2d')][_0xf117('0x2e')]};});_0x51033c[_0xf117('0x2f')]=_[_0xf117('0x29')](_0x208626,_0xf117('0x26'));_0x51033c[_0xf117('0x30')]=_[_0xf117('0x31')](_0x3a4d4e[_0xf117('0x30')]);_0x51033c['filters']=_['intersection'](_0x51033c[_0xf117('0x2f')],_0x51033c[_0xf117('0x30')]);_0x290044[_0xf117('0x32')]=_[_0xf117('0x33')](_0x51033c[_0xf117('0x2f')],qs[_0xf117('0x34')](_0x3a4d4e['query'][_0xf117('0x34')]));_0x290044[_0xf117('0x32')]=_0x290044[_0xf117('0x32')][_0xf117('0x35')]?_0x290044[_0xf117('0x32')]:_0x51033c[_0xf117('0x2f')];if(!_0x3a4d4e[_0xf117('0x30')][_0xf117('0x36')](_0xf117('0x37'))){_0x290044[_0xf117('0x1d')]=qs[_0xf117('0x1d')](_0x3a4d4e[_0xf117('0x30')][_0xf117('0x1d')]);_0x290044[_0xf117('0x1b')]=qs['offset'](_0x3a4d4e[_0xf117('0x30')][_0xf117('0x1b')]);}_0x290044[_0xf117('0x38')]=qs['sort'](_0x3a4d4e['query'][_0xf117('0x39')]);_0x290044[_0xf117('0x3a')]=qs[_0xf117('0x3b')](_['pick'](_0x3a4d4e['query'],_0x51033c['filters']),_0x208626);if(_0x3a4d4e[_0xf117('0x30')][_0xf117('0x3c')]){_0x290044[_0xf117('0x3a')]=_['merge'](_0x290044['where'],{'$or':_[_0xf117('0x29')](_0x208626,function(_0x1dd699){if(_0x1dd699[_0xf117('0x2d')]!==_0xf117('0x3d')){var _0x157c80={};_0x157c80[_0x1dd699['name']]={'$like':'%'+_0x3a4d4e[_0xf117('0x30')][_0xf117('0x3c')]+'%'};return _0x157c80;}})});}_0x290044=_[_0xf117('0x3e')]({},_0x290044,_0x3a4d4e[_0xf117('0x3f')]);var _0x14ab4a={'where':_0x290044[_0xf117('0x3a')]};return db[_0xf117('0x2a')]['count'](_0x14ab4a)['then'](function(_0x4e86e1){_0x4098f9[_0xf117('0x1e')]=_0x4e86e1;if(_0x3a4d4e[_0xf117('0x30')][_0xf117('0x40')]){_0x290044[_0xf117('0x41')]=[{'all':!![]}];}return db[_0xf117('0x2a')][_0xf117('0x42')](_0x290044);})[_0xf117('0x24')](function(_0x2809fb){_0x4098f9[_0xf117('0x43')]=_0x2809fb;return _0x4098f9;})[_0xf117('0x24')](respondWithFilteredResult(_0x2b4774,_0x290044))['catch'](handleError(_0x2b4774,null));};exports[_0xf117('0x44')]=function(_0x10be3d,_0xfdfeb9){var _0x5a28f9={'raw':![],'where':{'id':_0x10be3d[_0xf117('0x45')]['id']}},_0x4f46b9={};_0x4f46b9[_0xf117('0x2f')]=_[_0xf117('0x31')](db[_0xf117('0x2a')][_0xf117('0x2b')]);_0x4f46b9[_0xf117('0x30')]=_[_0xf117('0x31')](_0x10be3d[_0xf117('0x30')]);_0x4f46b9['filters']=_[_0xf117('0x33')](_0x4f46b9[_0xf117('0x2f')],_0x4f46b9[_0xf117('0x30')]);_0x5a28f9[_0xf117('0x32')]=_[_0xf117('0x33')](_0x4f46b9[_0xf117('0x2f')],qs[_0xf117('0x34')](_0x10be3d['query'][_0xf117('0x34')]));_0x5a28f9['attributes']=_0x5a28f9[_0xf117('0x32')]['length']?_0x5a28f9[_0xf117('0x32')]:_0x4f46b9[_0xf117('0x2f')];if(_0x10be3d['query'][_0xf117('0x40')]){_0x5a28f9['include']=[{'all':!![]}];}_0x5a28f9=_[_0xf117('0x3e')]({},_0x5a28f9,_0x10be3d[_0xf117('0x3f')]);return db[_0xf117('0x2a')][_0xf117('0x46')](_0x5a28f9)[_0xf117('0x24')](handleEntityNotFound(_0xfdfeb9,null))['then'](respondWithResult(_0xfdfeb9,null))[_0xf117('0x47')](handleError(_0xfdfeb9,null));};exports[_0xf117('0x48')]=function(_0xe0c864,_0x533853){return db[_0xf117('0x2a')][_0xf117('0x48')](_0xe0c864[_0xf117('0x49')],{})[_0xf117('0x24')](respondWithResult(_0x533853,0xc9))[_0xf117('0x47')](handleError(_0x533853,null));};exports[_0xf117('0x23')]=function(_0x5b78d2,_0x52edfc){if(_0x5b78d2[_0xf117('0x49')]['id']){delete _0x5b78d2['body']['id'];}return db[_0xf117('0x2a')][_0xf117('0x46')]({'where':{'id':_0x5b78d2[_0xf117('0x45')]['id']}})[_0xf117('0x24')](handleEntityNotFound(_0x52edfc,null))[_0xf117('0x24')](saveUpdates(_0x5b78d2[_0xf117('0x49')],null))[_0xf117('0x24')](respondWithResult(_0x52edfc,null))[_0xf117('0x47')](handleError(_0x52edfc,null));};exports['destroy']=function(_0xe8fa3f,_0x5dd597){return db['DeskConfiguration'][_0xf117('0x46')]({'where':{'id':_0xe8fa3f['params']['id']}})[_0xf117('0x24')](handleEntityNotFound(_0x5dd597,null))[_0xf117('0x24')](removeEntity(_0x5dd597,null))[_0xf117('0x47')](handleError(_0x5dd597,null));};exports[_0xf117('0x4a')]=function(_0xe455f9,_0x43eeaa,_0x2b8eca){var _0x499324={};var _0x5e4904={};var _0x5efae3;var _0x201f02;return db[_0xf117('0x2a')][_0xf117('0x4b')]({'where':{'id':_0xe455f9['params']['id']}})[_0xf117('0x24')](handleEntityNotFound(_0x43eeaa,null))[_0xf117('0x24')](function(_0xc14f3c){if(_0xc14f3c){_0x5efae3=_0xc14f3c;_0x5e4904[_0xf117('0x2f')]=_['keys'](db[_0xf117('0x4c')]['rawAttributes']);_0x5e4904[_0xf117('0x30')]=_[_0xf117('0x31')](_0xe455f9['query']);_0x5e4904[_0xf117('0x3b')]=_[_0xf117('0x33')](_0x5e4904[_0xf117('0x2f')],_0x5e4904['query']);_0x499324[_0xf117('0x32')]=_[_0xf117('0x33')](_0x5e4904[_0xf117('0x2f')],qs[_0xf117('0x34')](_0xe455f9[_0xf117('0x30')]['fields']));_0x499324['attributes']=_0x499324[_0xf117('0x32')]['length']?_0x499324[_0xf117('0x32')]:_0x5e4904[_0xf117('0x2f')];_0x499324[_0xf117('0x38')]=qs[_0xf117('0x39')](_0xe455f9[_0xf117('0x30')][_0xf117('0x39')]);_0x499324[_0xf117('0x3a')]=qs[_0xf117('0x3b')](_['pick'](_0xe455f9['query'],_0x5e4904[_0xf117('0x3b')]));if(_0xe455f9[_0xf117('0x30')][_0xf117('0x3c')]){_0x499324['where']=_['merge'](_0x499324[_0xf117('0x3a')],{'$or':_[_0xf117('0x29')](_0x499324[_0xf117('0x32')],function(_0x1d0c19){var _0x478a89={};_0x478a89[_0x1d0c19]={'$like':'%'+_0xe455f9[_0xf117('0x30')][_0xf117('0x3c')]+'%'};return _0x478a89;})});}_0x499324=_['merge']({},_0x499324,_0xe455f9[_0xf117('0x3f')]);return _0x5efae3[_0xf117('0x4a')](_0x499324);}})[_0xf117('0x24')](function(_0x1c3675){if(_0x1c3675){_0x201f02=_0x1c3675['length'];if(!_0xe455f9[_0xf117('0x30')][_0xf117('0x36')](_0xf117('0x37'))){_0x499324[_0xf117('0x1d')]=qs[_0xf117('0x1d')](_0xe455f9[_0xf117('0x30')][_0xf117('0x1d')]);_0x499324[_0xf117('0x1b')]=qs[_0xf117('0x1b')](_0xe455f9[_0xf117('0x30')][_0xf117('0x1b')]);}return _0x5efae3[_0xf117('0x4a')](_0x499324);}})[_0xf117('0x24')](function(_0x172514){if(_0x172514){return _0x172514?{'count':_0x201f02,'rows':_0x172514}:null;}})[_0xf117('0x24')](respondWithResult(_0x43eeaa,null))[_0xf117('0x47')](handleError(_0x43eeaa,null));};exports['getSubjects']=function(_0x19d67f,_0x52ee62,_0x37c64d){var _0x13fe43={};var _0x1ac1cb={};var _0x1bf048;var _0x477856;return db[_0xf117('0x2a')]['findOne']({'where':{'id':_0x19d67f[_0xf117('0x45')]['id']}})[_0xf117('0x24')](handleEntityNotFound(_0x52ee62,null))[_0xf117('0x24')](function(_0x12ea30){if(_0x12ea30){_0x1bf048=_0x12ea30;_0x1ac1cb['model']=_['keys'](db[_0xf117('0x4c')][_0xf117('0x2b')]);_0x1ac1cb[_0xf117('0x30')]=_[_0xf117('0x31')](_0x19d67f['query']);_0x1ac1cb[_0xf117('0x3b')]=_[_0xf117('0x33')](_0x1ac1cb['model'],_0x1ac1cb[_0xf117('0x30')]);_0x13fe43[_0xf117('0x32')]=_[_0xf117('0x33')](_0x1ac1cb[_0xf117('0x2f')],qs[_0xf117('0x34')](_0x19d67f[_0xf117('0x30')][_0xf117('0x34')]));_0x13fe43[_0xf117('0x32')]=_0x13fe43[_0xf117('0x32')][_0xf117('0x35')]?_0x13fe43[_0xf117('0x32')]:_0x1ac1cb[_0xf117('0x2f')];_0x13fe43[_0xf117('0x38')]=qs[_0xf117('0x39')](_0x19d67f['query'][_0xf117('0x39')]);_0x13fe43[_0xf117('0x3a')]=qs['filters'](_[_0xf117('0x4d')](_0x19d67f['query'],_0x1ac1cb['filters']));if(_0x19d67f[_0xf117('0x30')][_0xf117('0x3c')]){_0x13fe43[_0xf117('0x3a')]=_[_0xf117('0x3e')](_0x13fe43['where'],{'$or':_['map'](_0x13fe43[_0xf117('0x32')],function(_0x2febcd){var _0x29e8ed={};_0x29e8ed[_0x2febcd]={'$like':'%'+_0x19d67f[_0xf117('0x30')][_0xf117('0x3c')]+'%'};return _0x29e8ed;})});}_0x13fe43=_[_0xf117('0x3e')]({},_0x13fe43,_0x19d67f[_0xf117('0x3f')]);return _0x1bf048[_0xf117('0x4e')](_0x13fe43);}})[_0xf117('0x24')](function(_0x3c6c51){if(_0x3c6c51){_0x477856=_0x3c6c51[_0xf117('0x35')];if(!_0x19d67f[_0xf117('0x30')]['hasOwnProperty'](_0xf117('0x37'))){_0x13fe43[_0xf117('0x1d')]=qs[_0xf117('0x1d')](_0x19d67f[_0xf117('0x30')][_0xf117('0x1d')]);_0x13fe43[_0xf117('0x1b')]=qs[_0xf117('0x1b')](_0x19d67f[_0xf117('0x30')][_0xf117('0x1b')]);}return _0x1bf048[_0xf117('0x4e')](_0x13fe43);}})[_0xf117('0x24')](function(_0x33884e){if(_0x33884e){return _0x33884e?{'count':_0x477856,'rows':_0x33884e}:null;}})[_0xf117('0x24')](respondWithResult(_0x52ee62,null))['catch'](handleError(_0x52ee62,null));};exports['getDescriptions']=function(_0x572f95,_0x11e03b,_0xc3b60c){var _0x2d17d7={};var _0x45ad2f={};var _0x47b930;var _0x29b815;return db['DeskConfiguration'][_0xf117('0x4b')]({'where':{'id':_0x572f95[_0xf117('0x45')]['id']}})['then'](handleEntityNotFound(_0x11e03b,null))[_0xf117('0x24')](function(_0x26ef1e){if(_0x26ef1e){_0x47b930=_0x26ef1e;_0x45ad2f['model']=_['keys'](db[_0xf117('0x4c')][_0xf117('0x2b')]);_0x45ad2f['query']=_[_0xf117('0x31')](_0x572f95[_0xf117('0x30')]);_0x45ad2f[_0xf117('0x3b')]=_[_0xf117('0x33')](_0x45ad2f[_0xf117('0x2f')],_0x45ad2f[_0xf117('0x30')]);_0x2d17d7[_0xf117('0x32')]=_[_0xf117('0x33')](_0x45ad2f[_0xf117('0x2f')],qs[_0xf117('0x34')](_0x572f95[_0xf117('0x30')][_0xf117('0x34')]));_0x2d17d7[_0xf117('0x32')]=_0x2d17d7[_0xf117('0x32')][_0xf117('0x35')]?_0x2d17d7[_0xf117('0x32')]:_0x45ad2f[_0xf117('0x2f')];_0x2d17d7[_0xf117('0x38')]=qs[_0xf117('0x39')](_0x572f95[_0xf117('0x30')]['sort']);_0x2d17d7[_0xf117('0x3a')]=qs['filters'](_['pick'](_0x572f95[_0xf117('0x30')],_0x45ad2f[_0xf117('0x3b')]));if(_0x572f95[_0xf117('0x30')][_0xf117('0x3c')]){_0x2d17d7[_0xf117('0x3a')]=_[_0xf117('0x3e')](_0x2d17d7[_0xf117('0x3a')],{'$or':_[_0xf117('0x29')](_0x2d17d7[_0xf117('0x32')],function(_0x5b18a1){var _0x27e8ca={};_0x27e8ca[_0x5b18a1]={'$like':'%'+_0x572f95['query'][_0xf117('0x3c')]+'%'};return _0x27e8ca;})});}_0x2d17d7=_[_0xf117('0x3e')]({},_0x2d17d7,_0x572f95[_0xf117('0x3f')]);return _0x47b930[_0xf117('0x4f')](_0x2d17d7);}})[_0xf117('0x24')](function(_0x22af51){if(_0x22af51){_0x29b815=_0x22af51[_0xf117('0x35')];if(!_0x572f95[_0xf117('0x30')][_0xf117('0x36')]('nolimit')){_0x2d17d7[_0xf117('0x1d')]=qs['limit'](_0x572f95[_0xf117('0x30')][_0xf117('0x1d')]);_0x2d17d7['offset']=qs['offset'](_0x572f95[_0xf117('0x30')]['offset']);}return _0x47b930[_0xf117('0x4f')](_0x2d17d7);}})['then'](function(_0x5e24cc){if(_0x5e24cc){return _0x5e24cc?{'count':_0x29b815,'rows':_0x5e24cc}:null;}})[_0xf117('0x24')](respondWithResult(_0x11e03b,null))[_0xf117('0x47')](handleError(_0x11e03b,null));};exports['getTags']=function(_0x5e1307,_0x1728fd,_0x1d6038){var _0x224b78={};var _0x39396a={};var _0x34da45;var _0x10d22b;return db[_0xf117('0x2a')][_0xf117('0x4b')]({'where':{'id':_0x5e1307[_0xf117('0x45')]['id']}})[_0xf117('0x24')](handleEntityNotFound(_0x1728fd,null))[_0xf117('0x24')](function(_0x3fcd24){if(_0x3fcd24){_0x34da45=_0x3fcd24;_0x39396a[_0xf117('0x2f')]=_[_0xf117('0x31')](db[_0xf117('0x50')][_0xf117('0x2b')]);_0x39396a[_0xf117('0x30')]=_[_0xf117('0x31')](_0x5e1307['query']);_0x39396a[_0xf117('0x3b')]=_[_0xf117('0x33')](_0x39396a[_0xf117('0x2f')],_0x39396a[_0xf117('0x30')]);_0x224b78[_0xf117('0x32')]=_[_0xf117('0x33')](_0x39396a['model'],qs[_0xf117('0x34')](_0x5e1307[_0xf117('0x30')][_0xf117('0x34')]));_0x224b78[_0xf117('0x32')]=_0x224b78[_0xf117('0x32')][_0xf117('0x35')]?_0x224b78['attributes']:_0x39396a[_0xf117('0x2f')];_0x224b78[_0xf117('0x38')]=qs[_0xf117('0x39')](_0x5e1307[_0xf117('0x30')][_0xf117('0x39')]);_0x224b78[_0xf117('0x3a')]=qs[_0xf117('0x3b')](_[_0xf117('0x4d')](_0x5e1307[_0xf117('0x30')],_0x39396a[_0xf117('0x3b')]));if(_0x5e1307['query'][_0xf117('0x3c')]){_0x224b78[_0xf117('0x3a')]=_[_0xf117('0x3e')](_0x224b78[_0xf117('0x3a')],{'$or':_[_0xf117('0x29')](_0x224b78['attributes'],function(_0x773231){var _0x6ac4e1={};_0x6ac4e1[_0x773231]={'$like':'%'+_0x5e1307[_0xf117('0x30')][_0xf117('0x3c')]+'%'};return _0x6ac4e1;})});}_0x224b78=_[_0xf117('0x3e')]({},_0x224b78,_0x5e1307[_0xf117('0x3f')]);return _0x34da45['getTags'](_0x224b78);}})[_0xf117('0x24')](function(_0x26b915){if(_0x26b915){_0x10d22b=_0x26b915[_0xf117('0x35')];if(!_0x5e1307['query']['hasOwnProperty'](_0xf117('0x37'))){_0x224b78[_0xf117('0x1d')]=qs['limit'](_0x5e1307[_0xf117('0x30')][_0xf117('0x1d')]);_0x224b78[_0xf117('0x1b')]=qs[_0xf117('0x1b')](_0x5e1307[_0xf117('0x30')][_0xf117('0x1b')]);}return _0x34da45['getTags'](_0x224b78);}})[_0xf117('0x24')](function(_0x5dbc9c){if(_0x5dbc9c){return _0x5dbc9c?{'count':_0x10d22b,'rows':_0x5dbc9c}:null;}})['then'](respondWithResult(_0x1728fd,null))[_0xf117('0x47')](handleError(_0x1728fd,null));};exports[_0xf117('0x51')]=function(_0x196472,_0x5281a8,_0x1b2d57){if(_0x196472[_0xf117('0x49')]['id']){delete _0x196472[_0xf117('0x49')]['id'];}return db['DeskConfiguration'][_0xf117('0x4b')]({'where':{'id':_0x196472['params']['id']}})[_0xf117('0x24')](handleEntityNotFound(_0x5281a8,null))['then'](function(_0x202f9f){if(_0x202f9f){return _0x202f9f[_0xf117('0x51')](_0x196472[_0xf117('0x49')][_0xf117('0x52')]||[]);}return null;})[_0xf117('0x24')](respondWithResult(_0x5281a8,null))[_0xf117('0x47')](handleError(_0x5281a8,null));}; \ No newline at end of file +var _0x8bd9=['DeskConfiguration','fieldName','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','getFields','findOne','DeskField','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8bd9,0x80));var _0x98bd=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x8bd9[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require(_0x98bd('0x0'));var rimraf=require(_0x98bd('0x1'));var zipdir=require(_0x98bd('0x2'));var jsonpatch=require(_0x98bd('0x3'));var rp=require(_0x98bd('0x4'));var moment=require('moment');var BPromise=require(_0x98bd('0x5'));var Mustache=require(_0x98bd('0x6'));var util=require(_0x98bd('0x7'));var path=require('path');var sox=require(_0x98bd('0x8'));var csv=require(_0x98bd('0x9'));var ejs=require(_0x98bd('0xa'));var fs=require('fs');var fs_extra=require(_0x98bd('0xb'));var _=require(_0x98bd('0xc'));var squel=require('squel');var crypto=require(_0x98bd('0xd'));var jsforce=require(_0x98bd('0xe'));var deskjs=require(_0x98bd('0xf'));var toCsv=require(_0x98bd('0x9'));var querystring=require(_0x98bd('0x10'));var Papa=require('papaparse');var Redis=require(_0x98bd('0x11'));var authService=require(_0x98bd('0x12'));var qs=require(_0x98bd('0x13'));var as=require(_0x98bd('0x14'));var hardwareService=require(_0x98bd('0x15'));var logger=require(_0x98bd('0x16'))(_0x98bd('0x17'));var utils=require(_0x98bd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x98bd('0x19'));var db=require(_0x98bd('0x1a'))['db'];function respondWithStatusCode(_0x1567c1,_0xecd29){_0xecd29=_0xecd29||0xcc;return function(_0x5d4cf0){if(_0x5d4cf0){return _0x1567c1[_0x98bd('0x1b')](_0xecd29);}return _0x1567c1['status'](_0xecd29)['end']();};}function respondWithResult(_0x1f9ce1,_0x322426){_0x322426=_0x322426||0xc8;return function(_0x47a39a){if(_0x47a39a){return _0x1f9ce1[_0x98bd('0x1c')](_0x322426)[_0x98bd('0x1d')](_0x47a39a);}};}function respondWithFilteredResult(_0x321ff1,_0x58ef4f){return function(_0xa5211f){if(_0xa5211f){var _0x1ac30f=typeof _0x58ef4f[_0x98bd('0x1e')]===_0x98bd('0x1f')&&typeof _0x58ef4f['limit']===_0x98bd('0x1f');var _0x431b73=_0xa5211f['count'];var _0x45d32a=_0x1ac30f?0x0:_0x58ef4f['offset'];var _0x40d233=_0x1ac30f?_0xa5211f[_0x98bd('0x20')]:_0x58ef4f[_0x98bd('0x1e')]+_0x58ef4f[_0x98bd('0x21')];var _0x520289;if(_0x40d233>=_0x431b73){_0x40d233=_0x431b73;_0x520289=0xc8;}else{_0x520289=0xce;}_0x321ff1[_0x98bd('0x1c')](_0x520289);return _0x321ff1[_0x98bd('0x22')](_0x98bd('0x23'),_0x45d32a+'-'+_0x40d233+'/'+_0x431b73)['json'](_0xa5211f);}return null;};}function patchUpdates(_0x3556e1){return function(_0x5d19cb){try{jsonpatch[_0x98bd('0x24')](_0x5d19cb,_0x3556e1,!![]);}catch(_0x494c7e){return BPromise[_0x98bd('0x25')](_0x494c7e);}return _0x5d19cb[_0x98bd('0x26')]();};}function saveUpdates(_0x1e4352,_0x6ba6b7){return function(_0x331c49){if(_0x331c49){return _0x331c49[_0x98bd('0x27')](_0x1e4352)[_0x98bd('0x28')](function(_0x4d80eb){return _0x4d80eb;});}return null;};}function removeEntity(_0x1ab5f0,_0x299837){return function(_0x36381d){if(_0x36381d){return _0x36381d[_0x98bd('0x29')]()[_0x98bd('0x28')](function(){_0x1ab5f0[_0x98bd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171453,_0x564e9c){return function(_0x24359e){if(!_0x24359e){_0x171453[_0x98bd('0x1b')](0x194);}return _0x24359e;};}function handleError(_0x1a68d0,_0xc17ae5){_0xc17ae5=_0xc17ae5||0x1f4;return function(_0x499aed){logger[_0x98bd('0x2a')](_0x499aed[_0x98bd('0x2b')]);if(_0x499aed['name']){delete _0x499aed[_0x98bd('0x2c')];}_0x1a68d0[_0x98bd('0x1c')](_0xc17ae5)['send'](_0x499aed);};}exports[_0x98bd('0x2d')]=function(_0xb63dc8,_0x3c68c7){var _0x259c53={},_0x6786a2={},_0x51b91d={'count':0x0,'rows':[]};var _0x26f3ae=_['map'](db[_0x98bd('0x2e')]['rawAttributes'],function(_0x1fceda){return{'name':_0x1fceda[_0x98bd('0x2f')],'type':_0x1fceda['type'][_0x98bd('0x30')]};});_0x6786a2[_0x98bd('0x31')]=_[_0x98bd('0x32')](_0x26f3ae,_0x98bd('0x2c'));_0x6786a2[_0x98bd('0x33')]=_[_0x98bd('0x34')](_0xb63dc8[_0x98bd('0x33')]);_0x6786a2[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x6786a2[_0x98bd('0x31')],_0x6786a2['query']);_0x259c53['attributes']=_[_0x98bd('0x36')](_0x6786a2[_0x98bd('0x31')],qs[_0x98bd('0x37')](_0xb63dc8['query'][_0x98bd('0x37')]));_0x259c53['attributes']=_0x259c53['attributes'][_0x98bd('0x38')]?_0x259c53[_0x98bd('0x39')]:_0x6786a2[_0x98bd('0x31')];if(!_0xb63dc8['query'][_0x98bd('0x3a')](_0x98bd('0x3b'))){_0x259c53[_0x98bd('0x21')]=qs['limit'](_0xb63dc8[_0x98bd('0x33')]['limit']);_0x259c53[_0x98bd('0x1e')]=qs[_0x98bd('0x1e')](_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x1e')]);}_0x259c53['order']=qs[_0x98bd('0x3c')](_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x3c')]);_0x259c53['where']=qs[_0x98bd('0x35')](_[_0x98bd('0x3d')](_0xb63dc8[_0x98bd('0x33')],_0x6786a2[_0x98bd('0x35')]),_0x26f3ae);if(_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x3e')]){_0x259c53[_0x98bd('0x3f')]=_[_0x98bd('0x40')](_0x259c53[_0x98bd('0x3f')],{'$or':_[_0x98bd('0x32')](_0x26f3ae,function(_0xa512a2){if(_0xa512a2[_0x98bd('0x41')]!=='VIRTUAL'){var _0x2eac90={};_0x2eac90[_0xa512a2[_0x98bd('0x2c')]]={'$like':'%'+_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x3e')]+'%'};return _0x2eac90;}})});}_0x259c53=_[_0x98bd('0x40')]({},_0x259c53,_0xb63dc8[_0x98bd('0x42')]);var _0x47f45b={'where':_0x259c53['where']};return db['DeskConfiguration']['count'](_0x47f45b)[_0x98bd('0x28')](function(_0x5ac9d5){_0x51b91d[_0x98bd('0x20')]=_0x5ac9d5;if(_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x43')]){_0x259c53[_0x98bd('0x44')]=[{'all':!![]}];}return db[_0x98bd('0x2e')][_0x98bd('0x45')](_0x259c53);})[_0x98bd('0x28')](function(_0x1e954d){_0x51b91d[_0x98bd('0x46')]=_0x1e954d;return _0x51b91d;})[_0x98bd('0x28')](respondWithFilteredResult(_0x3c68c7,_0x259c53))[_0x98bd('0x47')](handleError(_0x3c68c7,null));};exports['show']=function(_0x2be1bd,_0x509425){var _0x164a3f={'raw':![],'where':{'id':_0x2be1bd['params']['id']}},_0x38bb63={};_0x38bb63[_0x98bd('0x31')]=_['keys'](db[_0x98bd('0x2e')][_0x98bd('0x48')]);_0x38bb63['query']=_[_0x98bd('0x34')](_0x2be1bd[_0x98bd('0x33')]);_0x38bb63[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x38bb63[_0x98bd('0x31')],_0x38bb63['query']);_0x164a3f['attributes']=_[_0x98bd('0x36')](_0x38bb63[_0x98bd('0x31')],qs[_0x98bd('0x37')](_0x2be1bd[_0x98bd('0x33')]['fields']));_0x164a3f[_0x98bd('0x39')]=_0x164a3f[_0x98bd('0x39')]['length']?_0x164a3f['attributes']:_0x38bb63[_0x98bd('0x31')];if(_0x2be1bd[_0x98bd('0x33')]['includeAll']){_0x164a3f[_0x98bd('0x44')]=[{'all':!![]}];}_0x164a3f=_[_0x98bd('0x40')]({},_0x164a3f,_0x2be1bd[_0x98bd('0x42')]);return db[_0x98bd('0x2e')][_0x98bd('0x49')](_0x164a3f)['then'](handleEntityNotFound(_0x509425,null))[_0x98bd('0x28')](respondWithResult(_0x509425,null))[_0x98bd('0x47')](handleError(_0x509425,null));};exports[_0x98bd('0x4a')]=function(_0x120c52,_0x29821a){return db['DeskConfiguration'][_0x98bd('0x4a')](_0x120c52[_0x98bd('0x4b')],{})[_0x98bd('0x28')](respondWithResult(_0x29821a,0xc9))[_0x98bd('0x47')](handleError(_0x29821a,null));};exports[_0x98bd('0x27')]=function(_0x1c6e92,_0x1fc684){if(_0x1c6e92[_0x98bd('0x4b')]['id']){delete _0x1c6e92[_0x98bd('0x4b')]['id'];}return db[_0x98bd('0x2e')][_0x98bd('0x49')]({'where':{'id':_0x1c6e92[_0x98bd('0x4c')]['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x1fc684,null))[_0x98bd('0x28')](saveUpdates(_0x1c6e92[_0x98bd('0x4b')],null))[_0x98bd('0x28')](respondWithResult(_0x1fc684,null))[_0x98bd('0x47')](handleError(_0x1fc684,null));};exports['destroy']=function(_0x1b6c84,_0x2a90f4){return db[_0x98bd('0x2e')][_0x98bd('0x49')]({'where':{'id':_0x1b6c84['params']['id']}})['then'](handleEntityNotFound(_0x2a90f4,null))['then'](removeEntity(_0x2a90f4,null))['catch'](handleError(_0x2a90f4,null));};exports[_0x98bd('0x4d')]=function(_0xaeafc7,_0x669a59,_0x435972){var _0x3ae542={};var _0x595ed8={};var _0x5d7aea;var _0x1658eb;return db[_0x98bd('0x2e')][_0x98bd('0x4e')]({'where':{'id':_0xaeafc7[_0x98bd('0x4c')]['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x669a59,null))[_0x98bd('0x28')](function(_0x190b64){if(_0x190b64){_0x5d7aea=_0x190b64;_0x595ed8[_0x98bd('0x31')]=_[_0x98bd('0x34')](db[_0x98bd('0x4f')]['rawAttributes']);_0x595ed8['query']=_[_0x98bd('0x34')](_0xaeafc7[_0x98bd('0x33')]);_0x595ed8[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x595ed8[_0x98bd('0x31')],_0x595ed8[_0x98bd('0x33')]);_0x3ae542[_0x98bd('0x39')]=_[_0x98bd('0x36')](_0x595ed8[_0x98bd('0x31')],qs[_0x98bd('0x37')](_0xaeafc7[_0x98bd('0x33')][_0x98bd('0x37')]));_0x3ae542[_0x98bd('0x39')]=_0x3ae542[_0x98bd('0x39')]['length']?_0x3ae542[_0x98bd('0x39')]:_0x595ed8[_0x98bd('0x31')];_0x3ae542['order']=qs[_0x98bd('0x3c')](_0xaeafc7['query'][_0x98bd('0x3c')]);_0x3ae542['where']=qs[_0x98bd('0x35')](_['pick'](_0xaeafc7[_0x98bd('0x33')],_0x595ed8['filters']));if(_0xaeafc7[_0x98bd('0x33')]['filter']){_0x3ae542[_0x98bd('0x3f')]=_['merge'](_0x3ae542[_0x98bd('0x3f')],{'$or':_['map'](_0x3ae542[_0x98bd('0x39')],function(_0x555877){var _0x466b1e={};_0x466b1e[_0x555877]={'$like':'%'+_0xaeafc7[_0x98bd('0x33')][_0x98bd('0x3e')]+'%'};return _0x466b1e;})});}_0x3ae542=_[_0x98bd('0x40')]({},_0x3ae542,_0xaeafc7['options']);return _0x5d7aea[_0x98bd('0x4d')](_0x3ae542);}})[_0x98bd('0x28')](function(_0x3a0b90){if(_0x3a0b90){_0x1658eb=_0x3a0b90['length'];if(!_0xaeafc7[_0x98bd('0x33')][_0x98bd('0x3a')](_0x98bd('0x3b'))){_0x3ae542[_0x98bd('0x21')]=qs['limit'](_0xaeafc7['query'][_0x98bd('0x21')]);_0x3ae542[_0x98bd('0x1e')]=qs[_0x98bd('0x1e')](_0xaeafc7[_0x98bd('0x33')][_0x98bd('0x1e')]);}return _0x5d7aea[_0x98bd('0x4d')](_0x3ae542);}})[_0x98bd('0x28')](function(_0x1ffed4){if(_0x1ffed4){return _0x1ffed4?{'count':_0x1658eb,'rows':_0x1ffed4}:null;}})['then'](respondWithResult(_0x669a59,null))['catch'](handleError(_0x669a59,null));};exports[_0x98bd('0x50')]=function(_0xc79f44,_0x416ccd,_0x41017e){var _0x5c1421={};var _0x58f527={};var _0x5d9187;var _0x18e395;return db['DeskConfiguration']['findOne']({'where':{'id':_0xc79f44[_0x98bd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x416ccd,null))[_0x98bd('0x28')](function(_0x4187c6){if(_0x4187c6){_0x5d9187=_0x4187c6;_0x58f527[_0x98bd('0x31')]=_[_0x98bd('0x34')](db['DeskField'][_0x98bd('0x48')]);_0x58f527[_0x98bd('0x33')]=_[_0x98bd('0x34')](_0xc79f44[_0x98bd('0x33')]);_0x58f527[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x58f527['model'],_0x58f527[_0x98bd('0x33')]);_0x5c1421['attributes']=_[_0x98bd('0x36')](_0x58f527['model'],qs[_0x98bd('0x37')](_0xc79f44['query'][_0x98bd('0x37')]));_0x5c1421[_0x98bd('0x39')]=_0x5c1421['attributes'][_0x98bd('0x38')]?_0x5c1421['attributes']:_0x58f527[_0x98bd('0x31')];_0x5c1421[_0x98bd('0x51')]=qs[_0x98bd('0x3c')](_0xc79f44[_0x98bd('0x33')][_0x98bd('0x3c')]);_0x5c1421[_0x98bd('0x3f')]=qs['filters'](_[_0x98bd('0x3d')](_0xc79f44[_0x98bd('0x33')],_0x58f527[_0x98bd('0x35')]));if(_0xc79f44['query'][_0x98bd('0x3e')]){_0x5c1421[_0x98bd('0x3f')]=_[_0x98bd('0x40')](_0x5c1421[_0x98bd('0x3f')],{'$or':_['map'](_0x5c1421[_0x98bd('0x39')],function(_0x153278){var _0x4791ce={};_0x4791ce[_0x153278]={'$like':'%'+_0xc79f44[_0x98bd('0x33')][_0x98bd('0x3e')]+'%'};return _0x4791ce;})});}_0x5c1421=_['merge']({},_0x5c1421,_0xc79f44[_0x98bd('0x42')]);return _0x5d9187[_0x98bd('0x50')](_0x5c1421);}})['then'](function(_0x3f9ff1){if(_0x3f9ff1){_0x18e395=_0x3f9ff1[_0x98bd('0x38')];if(!_0xc79f44[_0x98bd('0x33')]['hasOwnProperty'](_0x98bd('0x3b'))){_0x5c1421[_0x98bd('0x21')]=qs['limit'](_0xc79f44[_0x98bd('0x33')][_0x98bd('0x21')]);_0x5c1421[_0x98bd('0x1e')]=qs[_0x98bd('0x1e')](_0xc79f44[_0x98bd('0x33')][_0x98bd('0x1e')]);}return _0x5d9187[_0x98bd('0x50')](_0x5c1421);}})[_0x98bd('0x28')](function(_0x224258){if(_0x224258){return _0x224258?{'count':_0x18e395,'rows':_0x224258}:null;}})['then'](respondWithResult(_0x416ccd,null))['catch'](handleError(_0x416ccd,null));};exports[_0x98bd('0x52')]=function(_0x4092b2,_0x15b205,_0x39514c){var _0x7d12d={};var _0x67aff5={};var _0x32846f;var _0x356e2a;return db[_0x98bd('0x2e')][_0x98bd('0x4e')]({'where':{'id':_0x4092b2[_0x98bd('0x4c')]['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x15b205,null))['then'](function(_0x14f43){if(_0x14f43){_0x32846f=_0x14f43;_0x67aff5[_0x98bd('0x31')]=_['keys'](db['DeskField'][_0x98bd('0x48')]);_0x67aff5[_0x98bd('0x33')]=_[_0x98bd('0x34')](_0x4092b2[_0x98bd('0x33')]);_0x67aff5[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x67aff5[_0x98bd('0x31')],_0x67aff5[_0x98bd('0x33')]);_0x7d12d['attributes']=_[_0x98bd('0x36')](_0x67aff5['model'],qs['fields'](_0x4092b2[_0x98bd('0x33')][_0x98bd('0x37')]));_0x7d12d['attributes']=_0x7d12d[_0x98bd('0x39')]['length']?_0x7d12d[_0x98bd('0x39')]:_0x67aff5['model'];_0x7d12d[_0x98bd('0x51')]=qs['sort'](_0x4092b2[_0x98bd('0x33')]['sort']);_0x7d12d[_0x98bd('0x3f')]=qs[_0x98bd('0x35')](_['pick'](_0x4092b2[_0x98bd('0x33')],_0x67aff5['filters']));if(_0x4092b2['query'][_0x98bd('0x3e')]){_0x7d12d['where']=_[_0x98bd('0x40')](_0x7d12d[_0x98bd('0x3f')],{'$or':_[_0x98bd('0x32')](_0x7d12d[_0x98bd('0x39')],function(_0x2921d1){var _0x39523d={};_0x39523d[_0x2921d1]={'$like':'%'+_0x4092b2['query']['filter']+'%'};return _0x39523d;})});}_0x7d12d=_[_0x98bd('0x40')]({},_0x7d12d,_0x4092b2[_0x98bd('0x42')]);return _0x32846f[_0x98bd('0x52')](_0x7d12d);}})[_0x98bd('0x28')](function(_0x3ec4be){if(_0x3ec4be){_0x356e2a=_0x3ec4be[_0x98bd('0x38')];if(!_0x4092b2[_0x98bd('0x33')]['hasOwnProperty'](_0x98bd('0x3b'))){_0x7d12d['limit']=qs[_0x98bd('0x21')](_0x4092b2['query'][_0x98bd('0x21')]);_0x7d12d[_0x98bd('0x1e')]=qs[_0x98bd('0x1e')](_0x4092b2[_0x98bd('0x33')][_0x98bd('0x1e')]);}return _0x32846f['getDescriptions'](_0x7d12d);}})[_0x98bd('0x28')](function(_0x552573){if(_0x552573){return _0x552573?{'count':_0x356e2a,'rows':_0x552573}:null;}})[_0x98bd('0x28')](respondWithResult(_0x15b205,null))['catch'](handleError(_0x15b205,null));};exports[_0x98bd('0x53')]=function(_0x242ce0,_0x23ea29,_0x234c1e){var _0x303ebd={};var _0x52b645={};var _0xb62b99;var _0x28cdfe;return db['DeskConfiguration'][_0x98bd('0x4e')]({'where':{'id':_0x242ce0['params']['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x23ea29,null))[_0x98bd('0x28')](function(_0x4c28cf){if(_0x4c28cf){_0xb62b99=_0x4c28cf;_0x52b645[_0x98bd('0x31')]=_[_0x98bd('0x34')](db[_0x98bd('0x54')][_0x98bd('0x48')]);_0x52b645[_0x98bd('0x33')]=_[_0x98bd('0x34')](_0x242ce0[_0x98bd('0x33')]);_0x52b645['filters']=_[_0x98bd('0x36')](_0x52b645[_0x98bd('0x31')],_0x52b645['query']);_0x303ebd[_0x98bd('0x39')]=_[_0x98bd('0x36')](_0x52b645['model'],qs[_0x98bd('0x37')](_0x242ce0[_0x98bd('0x33')][_0x98bd('0x37')]));_0x303ebd[_0x98bd('0x39')]=_0x303ebd[_0x98bd('0x39')][_0x98bd('0x38')]?_0x303ebd[_0x98bd('0x39')]:_0x52b645['model'];_0x303ebd['order']=qs[_0x98bd('0x3c')](_0x242ce0['query'][_0x98bd('0x3c')]);_0x303ebd[_0x98bd('0x3f')]=qs[_0x98bd('0x35')](_[_0x98bd('0x3d')](_0x242ce0[_0x98bd('0x33')],_0x52b645[_0x98bd('0x35')]));if(_0x242ce0[_0x98bd('0x33')][_0x98bd('0x3e')]){_0x303ebd['where']=_[_0x98bd('0x40')](_0x303ebd['where'],{'$or':_[_0x98bd('0x32')](_0x303ebd[_0x98bd('0x39')],function(_0xd5340d){var _0x4e18f={};_0x4e18f[_0xd5340d]={'$like':'%'+_0x242ce0[_0x98bd('0x33')][_0x98bd('0x3e')]+'%'};return _0x4e18f;})});}_0x303ebd=_[_0x98bd('0x40')]({},_0x303ebd,_0x242ce0[_0x98bd('0x42')]);return _0xb62b99[_0x98bd('0x53')](_0x303ebd);}})[_0x98bd('0x28')](function(_0x198a0c){if(_0x198a0c){_0x28cdfe=_0x198a0c[_0x98bd('0x38')];if(!_0x242ce0['query'][_0x98bd('0x3a')](_0x98bd('0x3b'))){_0x303ebd[_0x98bd('0x21')]=qs[_0x98bd('0x21')](_0x242ce0[_0x98bd('0x33')]['limit']);_0x303ebd[_0x98bd('0x1e')]=qs['offset'](_0x242ce0['query'][_0x98bd('0x1e')]);}return _0xb62b99['getTags'](_0x303ebd);}})[_0x98bd('0x28')](function(_0x204a8c){if(_0x204a8c){return _0x204a8c?{'count':_0x28cdfe,'rows':_0x204a8c}:null;}})['then'](respondWithResult(_0x23ea29,null))[_0x98bd('0x47')](handleError(_0x23ea29,null));};exports['setTags']=function(_0x5cf42c,_0x56fb20,_0x84e73b){if(_0x5cf42c['body']['id']){delete _0x5cf42c[_0x98bd('0x4b')]['id'];}return db['DeskConfiguration'][_0x98bd('0x4e')]({'where':{'id':_0x5cf42c[_0x98bd('0x4c')]['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x56fb20,null))[_0x98bd('0x28')](function(_0x3a4dae){if(_0x3a4dae){return _0x3a4dae[_0x98bd('0x55')](_0x5cf42c[_0x98bd('0x4b')][_0x98bd('0x56')]||[]);}return null;})[_0x98bd('0x28')](respondWithResult(_0x56fb20,null))['catch'](handleError(_0x56fb20,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 525101f..3ed16e8 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 _0xbb62=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x401de7,_0x2333fc){var _0x5b491c=function(_0x1966b8){while(--_0x1966b8){_0x401de7['push'](_0x401de7['shift']());}};_0x5b491c(++_0x2333fc);}(_0xbb62,0x1ec));var _0x2bb6=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xbb62[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require(_0x2bb6('0x0'));var util=require(_0x2bb6('0x1'));var logger=require(_0x2bb6('0x2'))(_0x2bb6('0x3'));var moment=require(_0x2bb6('0x4'));var BPromise=require(_0x2bb6('0x5'));var rp=require(_0x2bb6('0x6'));var fs=require('fs');var path=require(_0x2bb6('0x7'));var rimraf=require(_0x2bb6('0x8'));var config=require(_0x2bb6('0x9'));var attributes=require(_0x2bb6('0xa'));module[_0x2bb6('0xb')]=function(_0xbc55bb,_0x19a539){return _0xbc55bb[_0x2bb6('0xc')](_0x2bb6('0xd'),attributes,{'tableName':_0x2bb6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a11=['api','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x58d092,_0x36a559){var _0xe2d411=function(_0x3b3c34){while(--_0x3b3c34){_0x58d092['push'](_0x58d092['shift']());}};_0xe2d411(++_0x36a559);}(_0x8a11,0x196));var _0x18a1=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x8a11[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x18a1('0x0'));var util=require(_0x18a1('0x1'));var logger=require('../../config/logger')(_0x18a1('0x2'));var moment=require('moment');var BPromise=require(_0x18a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18a1('0x4'));var rimraf=require(_0x18a1('0x5'));var config=require(_0x18a1('0x6'));var attributes=require(_0x18a1('0x7'));module[_0x18a1('0x8')]=function(_0x24f96a,_0x277164){return _0x24f96a[_0x18a1('0x9')](_0x18a1('0xa'),attributes,{'tableName':_0x18a1('0xb'),'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 866059b..d71e203 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 _0xdc15=['../../mysqldb','../../config/environment','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x13876a,_0x5110a5){var _0x585bea=function(_0x296bc7){while(--_0x296bc7){_0x13876a['push'](_0x13876a['shift']());}};_0x585bea(++_0x5110a5);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0xdc15[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0x5dc1('0x0'));var util=require('util');var moment=require(_0x5dc1('0x1'));var BPromise=require(_0x5dc1('0x2'));var rs=require(_0x5dc1('0x3'));var fs=require('fs');var Redis=require(_0x5dc1('0x4'));var db=require(_0x5dc1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5dc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5dc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ec95f,_0x22d677,_0x12abf9){return new BPromise(function(_0x1c90f6,_0x3e96c1){return client[_0x5dc1('0x8')](_0x2ec95f,_0x12abf9)[_0x5dc1('0x9')](function(_0x1f1293){logger[_0x5dc1('0xa')](_0x5dc1('0xb'),_0x22d677,'request\x20sent');logger['debug'](_0x5dc1('0xc'),_0x22d677,_0x5dc1('0xd'),JSON['stringify'](_0x1f1293));if(_0x1f1293[_0x5dc1('0xe')]){if(_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0xf')]===0x1f4){logger[_0x5dc1('0xe')](_0x5dc1('0xb'),_0x22d677,_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0x10')]);return _0x3e96c1(_0x1f1293['error'][_0x5dc1('0x10')]);}logger[_0x5dc1('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x22d677,_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0x10')]);return _0x1c90f6(_0x1f1293['error'][_0x5dc1('0x10')]);}else{logger[_0x5dc1('0xa')](_0x5dc1('0xb'),_0x22d677,'request\x20sent');_0x1c90f6(_0x1f1293[_0x5dc1('0x11')]['message']);}})['catch'](function(_0x17506b){logger[_0x5dc1('0xe')](_0x5dc1('0xb'),_0x22d677,_0x17506b);_0x3e96c1(_0x17506b);});});} \ No newline at end of file +var _0xc132=['client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5bfa8b,_0x25ade1){var _0x43a9c2=function(_0x4e6783){while(--_0x4e6783){_0x5bfa8b['push'](_0x5bfa8b['shift']());}};_0x43a9c2(++_0x25ade1);}(_0xc132,0x11e));var _0x2c13=function(_0x39d6ca,_0x400091){_0x39d6ca=_0x39d6ca-0x0;var _0x59ef7a=_0xc132[_0x39d6ca];return _0x59ef7a;};'use strict';var _=require(_0x2c13('0x0'));var util=require(_0x2c13('0x1'));var moment=require(_0x2c13('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c13('0x3'));var db=require(_0x2c13('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c13('0x5'))('rpc');var config=require(_0x2c13('0x6'));var jayson=require(_0x2c13('0x7'));var client=jayson[_0x2c13('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41581e,_0x3bc603,_0x591296){return new BPromise(function(_0x4d98aa,_0x25cc6c){return client[_0x2c13('0x9')](_0x41581e,_0x591296)[_0x2c13('0xa')](function(_0x3c2a5a){logger[_0x2c13('0xb')](_0x2c13('0xc'),_0x3bc603,_0x2c13('0xd'));logger[_0x2c13('0xe')](_0x2c13('0xf'),_0x3bc603,'request\x20sent',JSON['stringify'](_0x3c2a5a));if(_0x3c2a5a[_0x2c13('0x10')]){if(_0x3c2a5a[_0x2c13('0x10')][_0x2c13('0x11')]===0x1f4){logger[_0x2c13('0x10')](_0x2c13('0xc'),_0x3bc603,_0x3c2a5a[_0x2c13('0x10')]['message']);return _0x25cc6c(_0x3c2a5a[_0x2c13('0x10')]['message']);}logger[_0x2c13('0x10')](_0x2c13('0xc'),_0x3bc603,_0x3c2a5a[_0x2c13('0x10')]['message']);return _0x4d98aa(_0x3c2a5a[_0x2c13('0x10')][_0x2c13('0x12')]);}else{logger['info'](_0x2c13('0xc'),_0x3bc603,_0x2c13('0xd'));_0x4d98aa(_0x3c2a5a[_0x2c13('0x13')][_0x2c13('0x12')]);}})[_0x2c13('0x14')](function(_0x44c9af){logger[_0x2c13('0x10')](_0x2c13('0xc'),_0x3bc603,_0x44c9af);_0x25cc6c(_0x44c9af);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index fee2d0a..3e769dc 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 _0xebd0=['/:id','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xebd0,0x149));var _0x0ebd=function(_0x3a5e29,_0x168841){_0x3a5e29=_0x3a5e29-0x0;var _0x5a3cf1=_0xebd0[_0x3a5e29];return _0x5a3cf1;};'use strict';var multer=require(_0x0ebd('0x0'));var util=require(_0x0ebd('0x1'));var path=require(_0x0ebd('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ebd('0x3'));var router=express[_0x0ebd('0x4')]();var fs_extra=require(_0x0ebd('0x5'));var auth=require(_0x0ebd('0x6'));var interaction=require(_0x0ebd('0x7'));var config=require(_0x0ebd('0x8'));var controller=require('./intDeskField.controller');router[_0x0ebd('0x9')]('/',auth[_0x0ebd('0xa')](),controller['index']);router[_0x0ebd('0x9')](_0x0ebd('0xb'),auth[_0x0ebd('0xa')](),controller['show']);router['post']('/',auth[_0x0ebd('0xa')](),controller[_0x0ebd('0xc')]);router['put'](_0x0ebd('0xb'),auth[_0x0ebd('0xa')](),controller[_0x0ebd('0xd')]);router[_0x0ebd('0xe')](_0x0ebd('0xb'),auth[_0x0ebd('0xa')](),controller[_0x0ebd('0xf')]);module[_0x0ebd('0x10')]=router; \ No newline at end of file +var _0xc60c=['update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc60c,0x109));var _0xcc60=function(_0x4d5cac,_0x5bf7bd){_0x4d5cac=_0x4d5cac-0x0;var _0x513307=_0xc60c[_0x4d5cac];return _0x513307;};'use strict';var multer=require(_0xcc60('0x0'));var util=require('util');var path=require(_0xcc60('0x1'));var timeout=require(_0xcc60('0x2'));var express=require(_0xcc60('0x3'));var router=express[_0xcc60('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcc60('0x5'));var interaction=require(_0xcc60('0x6'));var config=require('../../config/environment');var controller=require(_0xcc60('0x7'));router[_0xcc60('0x8')]('/',auth[_0xcc60('0x9')](),controller[_0xcc60('0xa')]);router['get']('/:id',auth[_0xcc60('0x9')](),controller[_0xcc60('0xb')]);router[_0xcc60('0xc')]('/',auth[_0xcc60('0x9')](),controller[_0xcc60('0xd')]);router[_0xcc60('0xe')]('/:id',auth[_0xcc60('0x9')](),controller[_0xcc60('0xf')]);router[_0xcc60('0x10')](_0xcc60('0x11'),auth[_0xcc60('0x9')](),controller[_0xcc60('0x12')]);module[_0xcc60('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 12bfcb8..d4bbfb6 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 _0x7ffa=['STRING','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x7ffa,0x152));var _0xa7ff=function(_0x28a683,_0x383626){_0x28a683=_0x28a683-0x0;var _0x33ad40=_0x7ffa[_0x28a683];return _0x33ad40;};'use strict';var Sequelize=require(_0xa7ff('0x0'));module[_0xa7ff('0x1')]={'type':{'type':Sequelize[_0xa7ff('0x2')]('string','variable',_0xa7ff('0x3'),_0xa7ff('0x4'),'picklist'),'defaultValue':_0xa7ff('0x5')},'content':{'type':Sequelize[_0xa7ff('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa7ff('0x2')](_0xa7ff('0x5'),'variable',_0xa7ff('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa7ff('0x6')]},'nameField':{'type':Sequelize[_0xa7ff('0x6')]},'customField':{'type':Sequelize[_0xa7ff('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa7ff('0x6')]}}; \ No newline at end of file +var _0xa54d=['sequelize','exports','string','customVariable','keyValue','picklist','variable','STRING','BOOLEAN'];(function(_0x4f87d6,_0x49c366){var _0x4ccb54=function(_0x16cb67){while(--_0x16cb67){_0x4f87d6['push'](_0x4f87d6['shift']());}};_0x4ccb54(++_0x49c366);}(_0xa54d,0xfc));var _0xda54=function(_0x5390b3,_0x3648d8){_0x5390b3=_0x5390b3-0x0;var _0x3f04cb=_0xa54d[_0x5390b3];return _0x3f04cb;};'use strict';var Sequelize=require(_0xda54('0x0'));module[_0xda54('0x1')]={'type':{'type':Sequelize['ENUM'](_0xda54('0x2'),'variable',_0xda54('0x3'),_0xda54('0x4'),_0xda54('0x5')),'defaultValue':_0xda54('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xda54('0x6'),_0xda54('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xda54('0x7')]},'nameField':{'type':Sequelize[_0xda54('0x7')]},'customField':{'type':Sequelize[_0xda54('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xda54('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 166438f..707a20c 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 _0x9a3d=['intersection','fields','attributes','length','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskField','fieldName','model','keys','query','filters'];(function(_0xa3777e,_0x10d51a){var _0x48d91e=function(_0x37a77a){while(--_0x37a77a){_0xa3777e['push'](_0xa3777e['shift']());}};_0x48d91e(++_0x10d51a);}(_0x9a3d,0x14e));var _0xd9a3=function(_0x563407,_0x386966){_0x563407=_0x563407-0x0;var _0x11884=_0x9a3d[_0x563407];return _0x11884;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd9a3('0x0'));var zipdir=require(_0xd9a3('0x1'));var jsonpatch=require(_0xd9a3('0x2'));var rp=require(_0xd9a3('0x3'));var moment=require(_0xd9a3('0x4'));var BPromise=require(_0xd9a3('0x5'));var Mustache=require('mustache');var util=require(_0xd9a3('0x6'));var path=require(_0xd9a3('0x7'));var sox=require(_0xd9a3('0x8'));var csv=require(_0xd9a3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9a3('0xa'));var _=require(_0xd9a3('0xb'));var squel=require(_0xd9a3('0xc'));var crypto=require(_0xd9a3('0xd'));var jsforce=require(_0xd9a3('0xe'));var deskjs=require(_0xd9a3('0xf'));var toCsv=require(_0xd9a3('0x9'));var querystring=require(_0xd9a3('0x10'));var Papa=require('papaparse');var Redis=require(_0xd9a3('0x11'));var authService=require(_0xd9a3('0x12'));var qs=require(_0xd9a3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9a3('0x14'));var logger=require(_0xd9a3('0x15'))('api');var utils=require(_0xd9a3('0x16'));var config=require(_0xd9a3('0x17'));var licenseUtil=require(_0xd9a3('0x18'));var db=require(_0xd9a3('0x19'))['db'];function respondWithStatusCode(_0x3af3d2,_0x2b8230){_0x2b8230=_0x2b8230||0xcc;return function(_0x334a67){if(_0x334a67){return _0x3af3d2[_0xd9a3('0x1a')](_0x2b8230);}return _0x3af3d2['status'](_0x2b8230)[_0xd9a3('0x1b')]();};}function respondWithResult(_0x26605e,_0x1b1850){_0x1b1850=_0x1b1850||0xc8;return function(_0xce0c5c){if(_0xce0c5c){return _0x26605e[_0xd9a3('0x1c')](_0x1b1850)[_0xd9a3('0x1d')](_0xce0c5c);}};}function respondWithFilteredResult(_0x246aaf,_0x521ebe){return function(_0x2f497a){if(_0x2f497a){var _0x5107ee=typeof _0x521ebe['offset']===_0xd9a3('0x1e')&&typeof _0x521ebe['limit']==='undefined';var _0xbdeb3e=_0x2f497a[_0xd9a3('0x1f')];var _0x545dd2=_0x5107ee?0x0:_0x521ebe['offset'];var _0x56b6de=_0x5107ee?_0x2f497a['count']:_0x521ebe['offset']+_0x521ebe[_0xd9a3('0x20')];var _0x5bee91;if(_0x56b6de>=_0xbdeb3e){_0x56b6de=_0xbdeb3e;_0x5bee91=0xc8;}else{_0x5bee91=0xce;}_0x246aaf[_0xd9a3('0x1c')](_0x5bee91);return _0x246aaf[_0xd9a3('0x21')]('Content-Range',_0x545dd2+'-'+_0x56b6de+'/'+_0xbdeb3e)[_0xd9a3('0x1d')](_0x2f497a);}return null;};}function patchUpdates(_0x12674f){return function(_0x7160d8){try{jsonpatch[_0xd9a3('0x22')](_0x7160d8,_0x12674f,!![]);}catch(_0x2c2611){return BPromise[_0xd9a3('0x23')](_0x2c2611);}return _0x7160d8[_0xd9a3('0x24')]();};}function saveUpdates(_0x59fee8,_0x1ba585){return function(_0x445a4c){if(_0x445a4c){return _0x445a4c[_0xd9a3('0x25')](_0x59fee8)[_0xd9a3('0x26')](function(_0x60818e){return _0x60818e;});}return null;};}function removeEntity(_0x3d562a,_0x51c6d8){return function(_0x520ae4){if(_0x520ae4){return _0x520ae4[_0xd9a3('0x27')]()[_0xd9a3('0x26')](function(){_0x3d562a[_0xd9a3('0x1c')](0xcc)[_0xd9a3('0x1b')]();});}};}function handleEntityNotFound(_0x41baff,_0xd8c161){return function(_0x3b16f3){if(!_0x3b16f3){_0x41baff['sendStatus'](0x194);}return _0x3b16f3;};}function handleError(_0x10250a,_0x31ebd5){_0x31ebd5=_0x31ebd5||0x1f4;return function(_0x1eb769){logger['error'](_0x1eb769[_0xd9a3('0x28')]);if(_0x1eb769['name']){delete _0x1eb769[_0xd9a3('0x29')];}_0x10250a[_0xd9a3('0x1c')](_0x31ebd5)[_0xd9a3('0x2a')](_0x1eb769);};}exports[_0xd9a3('0x2b')]=function(_0x12f0e6,_0x374222){var _0x1e9500={},_0x3c99f8={},_0x4f3867={'count':0x0,'rows':[]};var _0x2103eb=_[_0xd9a3('0x2c')](db[_0xd9a3('0x2d')]['rawAttributes'],function(_0x1f564d){return{'name':_0x1f564d[_0xd9a3('0x2e')],'type':_0x1f564d['type']['key']};});_0x3c99f8[_0xd9a3('0x2f')]=_[_0xd9a3('0x2c')](_0x2103eb,_0xd9a3('0x29'));_0x3c99f8['query']=_[_0xd9a3('0x30')](_0x12f0e6[_0xd9a3('0x31')]);_0x3c99f8[_0xd9a3('0x32')]=_[_0xd9a3('0x33')](_0x3c99f8[_0xd9a3('0x2f')],_0x3c99f8[_0xd9a3('0x31')]);_0x1e9500['attributes']=_[_0xd9a3('0x33')](_0x3c99f8[_0xd9a3('0x2f')],qs[_0xd9a3('0x34')](_0x12f0e6[_0xd9a3('0x31')][_0xd9a3('0x34')]));_0x1e9500[_0xd9a3('0x35')]=_0x1e9500['attributes'][_0xd9a3('0x36')]?_0x1e9500[_0xd9a3('0x35')]:_0x3c99f8['model'];if(!_0x12f0e6['query']['hasOwnProperty'](_0xd9a3('0x37'))){_0x1e9500[_0xd9a3('0x20')]=qs['limit'](_0x12f0e6['query']['limit']);_0x1e9500[_0xd9a3('0x38')]=qs[_0xd9a3('0x38')](_0x12f0e6['query'][_0xd9a3('0x38')]);}_0x1e9500[_0xd9a3('0x39')]=qs[_0xd9a3('0x3a')](_0x12f0e6[_0xd9a3('0x31')][_0xd9a3('0x3a')]);_0x1e9500[_0xd9a3('0x3b')]=qs[_0xd9a3('0x32')](_[_0xd9a3('0x3c')](_0x12f0e6[_0xd9a3('0x31')],_0x3c99f8['filters']),_0x2103eb);if(_0x12f0e6[_0xd9a3('0x31')][_0xd9a3('0x3d')]){_0x1e9500[_0xd9a3('0x3b')]=_[_0xd9a3('0x3e')](_0x1e9500[_0xd9a3('0x3b')],{'$or':_[_0xd9a3('0x2c')](_0x2103eb,function(_0x280b72){if(_0x280b72[_0xd9a3('0x3f')]!==_0xd9a3('0x40')){var _0xe0a174={};_0xe0a174[_0x280b72['name']]={'$like':'%'+_0x12f0e6['query'][_0xd9a3('0x3d')]+'%'};return _0xe0a174;}})});}_0x1e9500=_[_0xd9a3('0x3e')]({},_0x1e9500,_0x12f0e6[_0xd9a3('0x41')]);var _0x4cab7f={'where':_0x1e9500['where']};return db[_0xd9a3('0x2d')][_0xd9a3('0x1f')](_0x4cab7f)[_0xd9a3('0x26')](function(_0x9e14ad){_0x4f3867['count']=_0x9e14ad;if(_0x12f0e6['query'][_0xd9a3('0x42')]){_0x1e9500[_0xd9a3('0x43')]=[{'all':!![]}];}return db[_0xd9a3('0x2d')][_0xd9a3('0x44')](_0x1e9500);})[_0xd9a3('0x26')](function(_0x246f5e){_0x4f3867[_0xd9a3('0x45')]=_0x246f5e;return _0x4f3867;})[_0xd9a3('0x26')](respondWithFilteredResult(_0x374222,_0x1e9500))['catch'](handleError(_0x374222,null));};exports[_0xd9a3('0x46')]=function(_0x16330d,_0x459421){var _0x113a6b={'raw':!![],'where':{'id':_0x16330d[_0xd9a3('0x47')]['id']}},_0x506050={};_0x506050[_0xd9a3('0x2f')]=_[_0xd9a3('0x30')](db[_0xd9a3('0x2d')][_0xd9a3('0x48')]);_0x506050[_0xd9a3('0x31')]=_[_0xd9a3('0x30')](_0x16330d[_0xd9a3('0x31')]);_0x506050[_0xd9a3('0x32')]=_[_0xd9a3('0x33')](_0x506050[_0xd9a3('0x2f')],_0x506050[_0xd9a3('0x31')]);_0x113a6b[_0xd9a3('0x35')]=_[_0xd9a3('0x33')](_0x506050[_0xd9a3('0x2f')],qs[_0xd9a3('0x34')](_0x16330d['query'][_0xd9a3('0x34')]));_0x113a6b[_0xd9a3('0x35')]=_0x113a6b[_0xd9a3('0x35')]['length']?_0x113a6b[_0xd9a3('0x35')]:_0x506050[_0xd9a3('0x2f')];if(_0x16330d[_0xd9a3('0x31')][_0xd9a3('0x42')]){_0x113a6b[_0xd9a3('0x43')]=[{'all':!![]}];}_0x113a6b=_[_0xd9a3('0x3e')]({},_0x113a6b,_0x16330d[_0xd9a3('0x41')]);return db['DeskField']['find'](_0x113a6b)[_0xd9a3('0x26')](handleEntityNotFound(_0x459421,null))[_0xd9a3('0x26')](respondWithResult(_0x459421,null))[_0xd9a3('0x49')](handleError(_0x459421,null));};exports[_0xd9a3('0x4a')]=function(_0x292aeb,_0x20b5fd){return db[_0xd9a3('0x2d')][_0xd9a3('0x4a')](_0x292aeb[_0xd9a3('0x4b')],{})[_0xd9a3('0x26')](respondWithResult(_0x20b5fd,0xc9))['catch'](handleError(_0x20b5fd,null));};exports['update']=function(_0x250e34,_0x9d069c){if(_0x250e34[_0xd9a3('0x4b')]['id']){delete _0x250e34[_0xd9a3('0x4b')]['id'];}return db[_0xd9a3('0x2d')][_0xd9a3('0x4c')]({'where':{'id':_0x250e34['params']['id']}})[_0xd9a3('0x26')](handleEntityNotFound(_0x9d069c,null))[_0xd9a3('0x26')](saveUpdates(_0x250e34[_0xd9a3('0x4b')],null))['then'](respondWithResult(_0x9d069c,null))['catch'](handleError(_0x9d069c,null));};exports[_0xd9a3('0x27')]=function(_0x380ddb,_0x56f43d){return db[_0xd9a3('0x2d')]['find']({'where':{'id':_0x380ddb[_0xd9a3('0x47')]['id']}})['then'](handleEntityNotFound(_0x56f43d,null))[_0xd9a3('0x26')](removeEntity(_0x56f43d,null))[_0xd9a3('0x49')](handleError(_0x56f43d,null));}; \ No newline at end of file +var _0x9b97=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','DeskField','includeAll','include','findAll','rows','rawAttributes','keys','intersection','length','find','catch','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9b97,0x11e));var _0x79b9=function(_0x5cc8bc,_0x522d27){_0x5cc8bc=_0x5cc8bc-0x0;var _0x180720=_0x9b97[_0x5cc8bc];return _0x180720;};'use strict';var emlformat=require(_0x79b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79b9('0x1'));var jsonpatch=require(_0x79b9('0x2'));var rp=require(_0x79b9('0x3'));var moment=require(_0x79b9('0x4'));var BPromise=require(_0x79b9('0x5'));var Mustache=require(_0x79b9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x79b9('0x7'));var csv=require(_0x79b9('0x8'));var ejs=require(_0x79b9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x79b9('0xa'));var squel=require(_0x79b9('0xb'));var crypto=require('crypto');var jsforce=require(_0x79b9('0xc'));var deskjs=require(_0x79b9('0xd'));var toCsv=require(_0x79b9('0x8'));var querystring=require(_0x79b9('0xe'));var Papa=require(_0x79b9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x79b9('0x10'));var as=require(_0x79b9('0x11'));var hardwareService=require(_0x79b9('0x12'));var logger=require(_0x79b9('0x13'))(_0x79b9('0x14'));var utils=require(_0x79b9('0x15'));var config=require(_0x79b9('0x16'));var licenseUtil=require(_0x79b9('0x17'));var db=require(_0x79b9('0x18'))['db'];function respondWithStatusCode(_0xc0f6ae,_0x3f0a9e){_0x3f0a9e=_0x3f0a9e||0xcc;return function(_0x51682c){if(_0x51682c){return _0xc0f6ae[_0x79b9('0x19')](_0x3f0a9e);}return _0xc0f6ae[_0x79b9('0x1a')](_0x3f0a9e)['end']();};}function respondWithResult(_0x548f65,_0x4f90fe){_0x4f90fe=_0x4f90fe||0xc8;return function(_0x2e175d){if(_0x2e175d){return _0x548f65[_0x79b9('0x1a')](_0x4f90fe)[_0x79b9('0x1b')](_0x2e175d);}};}function respondWithFilteredResult(_0xbf8150,_0x398977){return function(_0x4fad8e){if(_0x4fad8e){var _0x4e465a=typeof _0x398977[_0x79b9('0x1c')]===_0x79b9('0x1d')&&typeof _0x398977[_0x79b9('0x1e')]===_0x79b9('0x1d');var _0x5917ab=_0x4fad8e[_0x79b9('0x1f')];var _0x621505=_0x4e465a?0x0:_0x398977['offset'];var _0x54dc9d=_0x4e465a?_0x4fad8e[_0x79b9('0x1f')]:_0x398977['offset']+_0x398977['limit'];var _0x5e1572;if(_0x54dc9d>=_0x5917ab){_0x54dc9d=_0x5917ab;_0x5e1572=0xc8;}else{_0x5e1572=0xce;}_0xbf8150[_0x79b9('0x1a')](_0x5e1572);return _0xbf8150[_0x79b9('0x20')]('Content-Range',_0x621505+'-'+_0x54dc9d+'/'+_0x5917ab)[_0x79b9('0x1b')](_0x4fad8e);}return null;};}function patchUpdates(_0x26f60c){return function(_0x2de174){try{jsonpatch[_0x79b9('0x21')](_0x2de174,_0x26f60c,!![]);}catch(_0x58b88c){return BPromise[_0x79b9('0x22')](_0x58b88c);}return _0x2de174[_0x79b9('0x23')]();};}function saveUpdates(_0x16cb83,_0x25006f){return function(_0x2dcf13){if(_0x2dcf13){return _0x2dcf13[_0x79b9('0x24')](_0x16cb83)[_0x79b9('0x25')](function(_0x50d357){return _0x50d357;});}return null;};}function removeEntity(_0xdd133f,_0x2399fa){return function(_0x495971){if(_0x495971){return _0x495971['destroy']()[_0x79b9('0x25')](function(){_0xdd133f[_0x79b9('0x1a')](0xcc)[_0x79b9('0x26')]();});}};}function handleEntityNotFound(_0x59ae09,_0x2ee1e4){return function(_0x3fd9d2){if(!_0x3fd9d2){_0x59ae09[_0x79b9('0x19')](0x194);}return _0x3fd9d2;};}function handleError(_0xa213d3,_0x400677){_0x400677=_0x400677||0x1f4;return function(_0x186764){logger[_0x79b9('0x27')](_0x186764[_0x79b9('0x28')]);if(_0x186764[_0x79b9('0x29')]){delete _0x186764[_0x79b9('0x29')];}_0xa213d3[_0x79b9('0x1a')](_0x400677)[_0x79b9('0x2a')](_0x186764);};}exports[_0x79b9('0x2b')]=function(_0x1bfadb,_0x322d7e){var _0x8f0513={},_0x12d87e={},_0x1d307f={'count':0x0,'rows':[]};var _0x531e7f=_[_0x79b9('0x2c')](db['DeskField']['rawAttributes'],function(_0x4edc64){return{'name':_0x4edc64[_0x79b9('0x2d')],'type':_0x4edc64[_0x79b9('0x2e')][_0x79b9('0x2f')]};});_0x12d87e[_0x79b9('0x30')]=_['map'](_0x531e7f,'name');_0x12d87e[_0x79b9('0x31')]=_['keys'](_0x1bfadb['query']);_0x12d87e[_0x79b9('0x32')]=_['intersection'](_0x12d87e[_0x79b9('0x30')],_0x12d87e[_0x79b9('0x31')]);_0x8f0513['attributes']=_['intersection'](_0x12d87e[_0x79b9('0x30')],qs[_0x79b9('0x33')](_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x33')]));_0x8f0513[_0x79b9('0x34')]=_0x8f0513['attributes']['length']?_0x8f0513['attributes']:_0x12d87e[_0x79b9('0x30')];if(!_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x35')](_0x79b9('0x36'))){_0x8f0513[_0x79b9('0x1e')]=qs[_0x79b9('0x1e')](_0x1bfadb[_0x79b9('0x31')]['limit']);_0x8f0513[_0x79b9('0x1c')]=qs['offset'](_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x1c')]);}_0x8f0513[_0x79b9('0x37')]=qs['sort'](_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x38')]);_0x8f0513[_0x79b9('0x39')]=qs[_0x79b9('0x32')](_['pick'](_0x1bfadb['query'],_0x12d87e[_0x79b9('0x32')]),_0x531e7f);if(_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x3a')]){_0x8f0513[_0x79b9('0x39')]=_['merge'](_0x8f0513[_0x79b9('0x39')],{'$or':_['map'](_0x531e7f,function(_0x5e71f2){if(_0x5e71f2[_0x79b9('0x2e')]!==_0x79b9('0x3b')){var _0x4d5187={};_0x4d5187[_0x5e71f2[_0x79b9('0x29')]]={'$like':'%'+_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x3a')]+'%'};return _0x4d5187;}})});}_0x8f0513=_[_0x79b9('0x3c')]({},_0x8f0513,_0x1bfadb[_0x79b9('0x3d')]);var _0x5bc1de={'where':_0x8f0513[_0x79b9('0x39')]};return db[_0x79b9('0x3e')]['count'](_0x5bc1de)['then'](function(_0x2eab0d){_0x1d307f[_0x79b9('0x1f')]=_0x2eab0d;if(_0x1bfadb['query'][_0x79b9('0x3f')]){_0x8f0513[_0x79b9('0x40')]=[{'all':!![]}];}return db[_0x79b9('0x3e')][_0x79b9('0x41')](_0x8f0513);})[_0x79b9('0x25')](function(_0xbabbce){_0x1d307f[_0x79b9('0x42')]=_0xbabbce;return _0x1d307f;})[_0x79b9('0x25')](respondWithFilteredResult(_0x322d7e,_0x8f0513))['catch'](handleError(_0x322d7e,null));};exports['show']=function(_0x53563c,_0xe21f32){var _0x1125ec={'raw':!![],'where':{'id':_0x53563c['params']['id']}},_0x17f05f={};_0x17f05f['model']=_['keys'](db['DeskField'][_0x79b9('0x43')]);_0x17f05f[_0x79b9('0x31')]=_[_0x79b9('0x44')](_0x53563c[_0x79b9('0x31')]);_0x17f05f[_0x79b9('0x32')]=_['intersection'](_0x17f05f[_0x79b9('0x30')],_0x17f05f[_0x79b9('0x31')]);_0x1125ec[_0x79b9('0x34')]=_[_0x79b9('0x45')](_0x17f05f[_0x79b9('0x30')],qs[_0x79b9('0x33')](_0x53563c[_0x79b9('0x31')][_0x79b9('0x33')]));_0x1125ec[_0x79b9('0x34')]=_0x1125ec[_0x79b9('0x34')][_0x79b9('0x46')]?_0x1125ec[_0x79b9('0x34')]:_0x17f05f[_0x79b9('0x30')];if(_0x53563c[_0x79b9('0x31')][_0x79b9('0x3f')]){_0x1125ec[_0x79b9('0x40')]=[{'all':!![]}];}_0x1125ec=_[_0x79b9('0x3c')]({},_0x1125ec,_0x53563c[_0x79b9('0x3d')]);return db[_0x79b9('0x3e')][_0x79b9('0x47')](_0x1125ec)[_0x79b9('0x25')](handleEntityNotFound(_0xe21f32,null))[_0x79b9('0x25')](respondWithResult(_0xe21f32,null))[_0x79b9('0x48')](handleError(_0xe21f32,null));};exports[_0x79b9('0x49')]=function(_0x3f972e,_0xca2ca8){return db[_0x79b9('0x3e')]['create'](_0x3f972e[_0x79b9('0x4a')],{})[_0x79b9('0x25')](respondWithResult(_0xca2ca8,0xc9))['catch'](handleError(_0xca2ca8,null));};exports[_0x79b9('0x24')]=function(_0x5bc93f,_0x151cb0){if(_0x5bc93f['body']['id']){delete _0x5bc93f[_0x79b9('0x4a')]['id'];}return db[_0x79b9('0x3e')]['find']({'where':{'id':_0x5bc93f[_0x79b9('0x4b')]['id']}})[_0x79b9('0x25')](handleEntityNotFound(_0x151cb0,null))[_0x79b9('0x25')](saveUpdates(_0x5bc93f[_0x79b9('0x4a')],null))['then'](respondWithResult(_0x151cb0,null))[_0x79b9('0x48')](handleError(_0x151cb0,null));};exports[_0x79b9('0x4c')]=function(_0x1b8d57,_0x3fdde0){return db[_0x79b9('0x3e')][_0x79b9('0x47')]({'where':{'id':_0x1b8d57[_0x79b9('0x4b')]['id']}})[_0x79b9('0x25')](handleEntityNotFound(_0x3fdde0,null))['then'](removeEntity(_0x3fdde0,null))[_0x79b9('0x48')](handleError(_0x3fdde0,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d848a6c..950e66e 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 _0x5c5e=['moment','bluebird','path','../../config/environment','define','DeskField','idField','FieldId','lodash','util','../../config/logger'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x5c5e,0xd9));var _0xe5c5=function(_0x52c2a3,_0x26405a){_0x52c2a3=_0x52c2a3-0x0;var _0x3314c5=_0x5c5e[_0x52c2a3];return _0x3314c5;};'use strict';var _=require(_0xe5c5('0x0'));var util=require(_0xe5c5('0x1'));var logger=require(_0xe5c5('0x2'))('api');var moment=require(_0xe5c5('0x3'));var BPromise=require(_0xe5c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5c5('0x5'));var rimraf=require('rimraf');var config=require(_0xe5c5('0x6'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0xb5755e,_0x4cb046){return _0xb5755e[_0xe5c5('0x7')](_0xe5c5('0x8'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xe5c5('0x9'),_0xe5c5('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf785=['request-promise','path','../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields','desk_unique_index','FieldId','util','moment'];(function(_0x36919b,_0x233833){var _0x4c687e=function(_0x2ec77b){while(--_0x2ec77b){_0x36919b['push'](_0x36919b['shift']());}};_0x4c687e(++_0x233833);}(_0xf785,0x170));var _0x5f78=function(_0x71043e,_0x4e0888){_0x71043e=_0x71043e-0x0;var _0x5223bf=_0xf785[_0x71043e];return _0x5223bf;};'use strict';var _=require('lodash');var util=require(_0x5f78('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5f78('0x1'));var BPromise=require('bluebird');var rp=require(_0x5f78('0x2'));var fs=require('fs');var path=require(_0x5f78('0x3'));var rimraf=require('rimraf');var config=require(_0x5f78('0x4'));var attributes=require(_0x5f78('0x5'));module['exports']=function(_0x5d24a3,_0x4a1043){return _0x5d24a3['define'](_0x5f78('0x6'),attributes,{'tableName':_0x5f78('0x7'),'paranoid':![],'indexes':[{'name':_0x5f78('0x8'),'fields':['idField',_0x5f78('0x9')],'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 6e3e175..ff667de 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 _0xbc30=['../../config/utils','../../config/logger','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4f103e,_0x284aaf){var _0x474b4d=function(_0x1448ae){while(--_0x1448ae){_0x4f103e['push'](_0x4f103e['shift']());}};_0x474b4d(++_0x284aaf);}(_0xbc30,0x19d));var _0x0bc3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xbc30[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x0bc3('0x0'));var util=require('util');var moment=require(_0x0bc3('0x1'));var BPromise=require(_0x0bc3('0x2'));var rs=require(_0x0bc3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0bc3('0x4'))['db'];var utils=require(_0x0bc3('0x5'));var logger=require(_0x0bc3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0bc3('0x7'));var client=jayson[_0x0bc3('0x8')][_0x0bc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e3d36,_0x21a34b,_0x20972f){return new BPromise(function(_0x673f43,_0x14aa95){return client['request'](_0x4e3d36,_0x20972f)['then'](function(_0x45d295){logger[_0x0bc3('0xa')](_0x0bc3('0xb'),_0x21a34b,_0x0bc3('0xc'));logger[_0x0bc3('0xd')](_0x0bc3('0xe'),_0x21a34b,_0x0bc3('0xc'),JSON['stringify'](_0x45d295));if(_0x45d295[_0x0bc3('0xf')]){if(_0x45d295[_0x0bc3('0xf')][_0x0bc3('0x10')]===0x1f4){logger[_0x0bc3('0xf')](_0x0bc3('0xb'),_0x21a34b,_0x45d295[_0x0bc3('0xf')][_0x0bc3('0x11')]);return _0x14aa95(_0x45d295[_0x0bc3('0xf')][_0x0bc3('0x11')]);}logger[_0x0bc3('0xf')](_0x0bc3('0xb'),_0x21a34b,_0x45d295['error'][_0x0bc3('0x11')]);return _0x673f43(_0x45d295['error']['message']);}else{logger[_0x0bc3('0xa')](_0x0bc3('0xb'),_0x21a34b,_0x0bc3('0xc'));_0x673f43(_0x45d295[_0x0bc3('0x12')][_0x0bc3('0x11')]);}})['catch'](function(_0x198b9b){logger[_0x0bc3('0xf')]('DeskField,\x20%s,\x20%s',_0x21a34b,_0x198b9b);_0x14aa95(_0x198b9b);});});} \ No newline at end of file +var _0x3ed2=['catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x42b611,_0x256f69){var _0x53f6c8=function(_0x3f1a9b){while(--_0x3f1a9b){_0x42b611['push'](_0x42b611['shift']());}};_0x53f6c8(++_0x256f69);}(_0x3ed2,0xa1));var _0x23ed=function(_0x5ba736,_0x3470bb){_0x5ba736=_0x5ba736-0x0;var _0xa338e4=_0x3ed2[_0x5ba736];return _0xa338e4;};'use strict';var _=require('lodash');var util=require(_0x23ed('0x0'));var moment=require(_0x23ed('0x1'));var BPromise=require(_0x23ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23ed('0x3'))['db'];var utils=require(_0x23ed('0x4'));var logger=require('../../config/logger')(_0x23ed('0x5'));var config=require(_0x23ed('0x6'));var jayson=require(_0x23ed('0x7'));var client=jayson[_0x23ed('0x8')][_0x23ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x396628,_0x3ba15f,_0x2e5456){return new BPromise(function(_0x1854fe,_0x59af48){return client['request'](_0x396628,_0x2e5456)[_0x23ed('0xa')](function(_0x2ff427){logger[_0x23ed('0xb')](_0x23ed('0xc'),_0x3ba15f,'request\x20sent');logger[_0x23ed('0xd')](_0x23ed('0xe'),_0x3ba15f,_0x23ed('0xf'),JSON['stringify'](_0x2ff427));if(_0x2ff427[_0x23ed('0x10')]){if(_0x2ff427['error'][_0x23ed('0x11')]===0x1f4){logger[_0x23ed('0x10')]('DeskField,\x20%s,\x20%s',_0x3ba15f,_0x2ff427[_0x23ed('0x10')][_0x23ed('0x12')]);return _0x59af48(_0x2ff427[_0x23ed('0x10')][_0x23ed('0x12')]);}logger[_0x23ed('0x10')](_0x23ed('0xc'),_0x3ba15f,_0x2ff427[_0x23ed('0x10')][_0x23ed('0x12')]);return _0x1854fe(_0x2ff427['error'][_0x23ed('0x12')]);}else{logger[_0x23ed('0xb')]('DeskField,\x20%s,\x20%s',_0x3ba15f,_0x23ed('0xf'));_0x1854fe(_0x2ff427['result'][_0x23ed('0x12')]);}})[_0x23ed('0x13')](function(_0x1f1bb7){logger[_0x23ed('0x10')](_0x23ed('0xc'),_0x3ba15f,_0x1f1bb7);_0x59af48(_0x1f1bb7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 67a9a97..689f08a 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 _0x1b84=['/:id/configurations','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getConfigurations','getFields','create','post'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x1b84,0xc2));var _0x41b8=function(_0x258bd8,_0x3cf0b1){_0x258bd8=_0x258bd8-0x0;var _0x2f43a4=_0x1b84[_0x258bd8];return _0x2f43a4;};'use strict';var multer=require(_0x41b8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x41b8('0x1'));var express=require(_0x41b8('0x2'));var router=express[_0x41b8('0x3')]();var fs_extra=require(_0x41b8('0x4'));var auth=require(_0x41b8('0x5'));var interaction=require(_0x41b8('0x6'));var config=require(_0x41b8('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x41b8('0x8')]('/',auth[_0x41b8('0x9')](),controller['index']);router[_0x41b8('0x8')](_0x41b8('0xa'),auth[_0x41b8('0x9')](),controller[_0x41b8('0xb')]);router[_0x41b8('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x41b8('0xc')]);router[_0x41b8('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x41b8('0xd')]);router['post']('/',auth[_0x41b8('0x9')](),controller[_0x41b8('0xe')]);router[_0x41b8('0xf')](_0x41b8('0x10'),auth[_0x41b8('0x9')](),controller['addConfiguration']);router[_0x41b8('0x11')](_0x41b8('0xa'),auth[_0x41b8('0x9')](),controller[_0x41b8('0x12')]);router['delete'](_0x41b8('0xa'),auth[_0x41b8('0x9')](),controller[_0x41b8('0x13')]);module[_0x41b8('0x14')]=router; \ No newline at end of file +var _0xfae2=['index','/:id','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x794312,_0xace952){var _0x82928a=function(_0x5a5649){while(--_0x5a5649){_0x794312['push'](_0x794312['shift']());}};_0x82928a(++_0xace952);}(_0xfae2,0x1af));var _0x2fae=function(_0x7f677f,_0x5f2c1c){_0x7f677f=_0x7f677f-0x0;var _0x5acea1=_0xfae2[_0x7f677f];return _0x5acea1;};'use strict';var multer=require(_0x2fae('0x0'));var util=require('util');var path=require(_0x2fae('0x1'));var timeout=require(_0x2fae('0x2'));var express=require(_0x2fae('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2fae('0x4'));var interaction=require(_0x2fae('0x5'));var config=require(_0x2fae('0x6'));var controller=require(_0x2fae('0x7'));router[_0x2fae('0x8')]('/',auth[_0x2fae('0x9')](),controller[_0x2fae('0xa')]);router[_0x2fae('0x8')](_0x2fae('0xb'),auth[_0x2fae('0x9')](),controller[_0x2fae('0xc')]);router[_0x2fae('0x8')]('/:id/configurations',auth[_0x2fae('0x9')](),controller['getConfigurations']);router[_0x2fae('0x8')](_0x2fae('0xd'),auth[_0x2fae('0x9')](),controller[_0x2fae('0xe')]);router[_0x2fae('0xf')]('/',auth[_0x2fae('0x9')](),controller['create']);router['post'](_0x2fae('0x10'),auth[_0x2fae('0x9')](),controller[_0x2fae('0x11')]);router[_0x2fae('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2fae('0x13')]);router[_0x2fae('0x14')](_0x2fae('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1fcc970..19c1d17 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 _0x7e02=['BOOLEAN','sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7e02,0x71));var _0x27e0=function(_0x4e96a4,_0x207e09){_0x4e96a4=_0x4e96a4-0x0;var _0x1beafa=_0x7e02[_0x4e96a4];return _0x1beafa;};'use strict';var Sequelize=require(_0x27e0('0x0'));module[_0x27e0('0x1')]={'name':{'type':Sequelize[_0x27e0('0x2')]},'username':{'type':Sequelize[_0x27e0('0x2')]},'password':{'type':Sequelize[_0x27e0('0x2')]},'remoteUri':{'type':Sequelize[_0x27e0('0x2')]},'tenantId':{'type':Sequelize[_0x27e0('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x27e0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x27e0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6379=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x6379,0x84));var _0x9637=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x6379[_0x60286b];return _0x5dff69;};'use strict';var Sequelize=require(_0x9637('0x0'));module[_0x9637('0x1')]={'name':{'type':Sequelize[_0x9637('0x2')]},'username':{'type':Sequelize[_0x9637('0x2')]},'password':{'type':Sequelize[_0x9637('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x9637('0x2')]},'clientId':{'type':Sequelize[_0x9637('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9637('0x2')]},'modernAuthentication':{'type':Sequelize[_0x9637('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 2c63e9b..eebcf42 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 _0x42d5=['$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','OptionSet','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','undefined','offset','count','set','Content-Range','update','then','destroy','end','error','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','find','create','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','Subjects','slice','substring','lastIndexOf','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','customerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','productidname','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','remoteUri','tenantId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','clientId','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','stack','send','test','Wrong\x20credentials',')/Attributes('];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x42d5,0xc9));var _0x542d=function(_0xcfa260,_0x2659f9){_0xcfa260=_0xcfa260-0x0;var _0x1fb0e9=_0x42d5[_0xcfa260];return _0x1fb0e9;};'use strict';var rp=require(_0x542d('0x0'));var util=require(_0x542d('0x1'));var _=require(_0x542d('0x2'));var qs=require(_0x542d('0x3'));var logger=require(_0x542d('0x4'))(_0x542d('0x5'));var db=require(_0x542d('0x6'))['db'];var integrations=require(_0x542d('0x7'));function respondWithResult(_0x2a7009,_0x154a33){_0x154a33=_0x154a33||0xc8;return function(_0x4145ac){if(_0x4145ac){return _0x2a7009[_0x542d('0x8')](_0x154a33)['json'](_0x4145ac);}};}function respondWithFilteredResult(_0x4c37f9,_0x22d24f){return function(_0x3b99af){if(_0x3b99af){var _0x21ec94=typeof _0x22d24f['offset']===_0x542d('0x9')&&typeof _0x22d24f['limit']===_0x542d('0x9');var _0x324067=_0x3b99af['count'];var _0x126d44=_0x21ec94?0x0:_0x22d24f[_0x542d('0xa')];var _0x2678d4=_0x21ec94?_0x3b99af[_0x542d('0xb')]:_0x22d24f[_0x542d('0xa')]+_0x22d24f['limit'];var _0x4e652c;if(_0x2678d4>=_0x324067){_0x2678d4=_0x324067;_0x4e652c=0xc8;}else{_0x4e652c=0xce;}_0x4c37f9[_0x542d('0x8')](_0x4e652c);return _0x4c37f9[_0x542d('0xc')](_0x542d('0xd'),_0x126d44+'-'+_0x2678d4+'/'+_0x324067)['json'](_0x3b99af);}return null;};}function saveUpdates(_0x58b8a7){return function(_0x57cb59){if(_0x57cb59){return _0x57cb59[_0x542d('0xe')](_0x58b8a7)[_0x542d('0xf')](function(_0x469f06){return _0x469f06;});}return null;};}function removeEntity(_0x2e1183){return function(_0x463371){if(_0x463371){return _0x463371[_0x542d('0x10')]()[_0x542d('0xf')](function(){_0x2e1183['status'](0xcc)[_0x542d('0x11')]();});}};}function handleEntityNotFound(_0x188dfc){return function(_0x5c4d9e){if(!_0x5c4d9e){_0x188dfc['sendStatus'](0x194);}return _0x5c4d9e;};}function handleError(_0x521e6d,_0x46e2fc){_0x46e2fc=_0x46e2fc||0x1f4;return function(_0x47e0ca){logger[_0x542d('0x12')](_0x47e0ca['stack']);if(_0x47e0ca['name']){delete _0x47e0ca[_0x542d('0x13')];}_0x521e6d[_0x542d('0x8')](_0x46e2fc)['send'](_0x47e0ca);};}exports[_0x542d('0x14')]=function(_0x1e3d56,_0x2b5a20){var _0x3fc42a={},_0x54b80e={},_0x5757ec={'count':0x0,'rows':[]};var _0x431ca8=_[_0x542d('0x15')](db[_0x542d('0x16')][_0x542d('0x17')],function(_0x3f512b){return{'name':_0x3f512b[_0x542d('0x18')],'type':_0x3f512b[_0x542d('0x19')]['key']};});_0x54b80e['model']=_[_0x542d('0x15')](_0x431ca8,'name');_0x54b80e[_0x542d('0x1a')]=_['keys'](_0x1e3d56[_0x542d('0x1a')]);_0x54b80e[_0x542d('0x1b')]=_[_0x542d('0x1c')](_0x54b80e[_0x542d('0x1d')],_0x54b80e[_0x542d('0x1a')]);_0x3fc42a['attributes']=_['intersection'](_0x54b80e[_0x542d('0x1d')],qs[_0x542d('0x1e')](_0x1e3d56['query'][_0x542d('0x1e')]));_0x3fc42a[_0x542d('0x1f')]=_0x3fc42a[_0x542d('0x1f')][_0x542d('0x20')]?_0x3fc42a[_0x542d('0x1f')]:_0x54b80e[_0x542d('0x1d')];if(!_0x1e3d56[_0x542d('0x1a')][_0x542d('0x21')]('nolimit')){_0x3fc42a['limit']=qs[_0x542d('0x22')](_0x1e3d56[_0x542d('0x1a')]['limit']);_0x3fc42a[_0x542d('0xa')]=qs[_0x542d('0xa')](_0x1e3d56['query'][_0x542d('0xa')]);}_0x3fc42a[_0x542d('0x23')]=qs[_0x542d('0x24')](_0x1e3d56[_0x542d('0x1a')][_0x542d('0x24')]);_0x3fc42a[_0x542d('0x25')]=qs[_0x542d('0x1b')](_[_0x542d('0x26')](_0x1e3d56['query'],_0x54b80e['filters']),_0x431ca8);if(_0x1e3d56[_0x542d('0x1a')]['filter']){_0x3fc42a['where']=_[_0x542d('0x27')](_0x3fc42a[_0x542d('0x25')],{'$or':_[_0x542d('0x15')](_0x431ca8,function(_0x369bdb){if(_0x369bdb[_0x542d('0x19')]!==_0x542d('0x28')){var _0x5a775c={};_0x5a775c[_0x369bdb[_0x542d('0x13')]]={'$like':'%'+_0x1e3d56[_0x542d('0x1a')][_0x542d('0x29')]+'%'};return _0x5a775c;}})});}_0x3fc42a=_[_0x542d('0x27')]({},_0x3fc42a,_0x1e3d56[_0x542d('0x2a')]);var _0x48a8d3={'where':_0x3fc42a['where']};return db['Dynamics365Account'][_0x542d('0xb')](_0x48a8d3)[_0x542d('0xf')](function(_0x8c9aad){_0x5757ec[_0x542d('0xb')]=_0x8c9aad;if(_0x1e3d56['query']['includeAll']){_0x3fc42a['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x542d('0x2b')](_0x3fc42a);})['then'](function(_0x5e544c){_0x5757ec[_0x542d('0x2c')]=_0x5e544c;return _0x5757ec;})[_0x542d('0xf')](respondWithFilteredResult(_0x2b5a20,_0x3fc42a))[_0x542d('0x2d')](handleError(_0x2b5a20,null));};exports['show']=function(_0x2c1801,_0x41d040){var _0x4dfc7d={'raw':![],'where':{'id':_0x2c1801[_0x542d('0x2e')]['id']}},_0x5c15a1={};_0x5c15a1[_0x542d('0x1d')]=_[_0x542d('0x2f')](db[_0x542d('0x16')][_0x542d('0x17')]);_0x5c15a1[_0x542d('0x1a')]=_[_0x542d('0x2f')](_0x2c1801[_0x542d('0x1a')]);_0x5c15a1[_0x542d('0x1b')]=_[_0x542d('0x1c')](_0x5c15a1[_0x542d('0x1d')],_0x5c15a1[_0x542d('0x1a')]);_0x4dfc7d[_0x542d('0x1f')]=_[_0x542d('0x1c')](_0x5c15a1[_0x542d('0x1d')],qs['fields'](_0x2c1801['query'][_0x542d('0x1e')]));_0x4dfc7d[_0x542d('0x1f')]=_0x4dfc7d[_0x542d('0x1f')]['length']?_0x4dfc7d[_0x542d('0x1f')]:_0x5c15a1['model'];if(_0x2c1801['query'][_0x542d('0x30')]){_0x4dfc7d['include']=[{'all':!![]}];}_0x4dfc7d=_[_0x542d('0x27')]({},_0x4dfc7d,_0x2c1801[_0x542d('0x2a')]);return db[_0x542d('0x16')][_0x542d('0x31')](_0x4dfc7d)['then'](handleEntityNotFound(_0x41d040,null))[_0x542d('0xf')](respondWithResult(_0x41d040,null))[_0x542d('0x2d')](handleError(_0x41d040,null));};exports['create']=function(_0x401bbd,_0x2c36e4){return db['Dynamics365Account'][_0x542d('0x32')](_0x401bbd[_0x542d('0x33')],{})[_0x542d('0xf')](respondWithResult(_0x2c36e4,0xc9))[_0x542d('0x2d')](handleError(_0x2c36e4,null));};exports[_0x542d('0xe')]=function(_0x510a1b,_0x1b3460){if(_0x510a1b['body']['id']){delete _0x510a1b[_0x542d('0x33')]['id'];}return db[_0x542d('0x16')][_0x542d('0x31')]({'where':{'id':_0x510a1b[_0x542d('0x2e')]['id']}})[_0x542d('0xf')](handleEntityNotFound(_0x1b3460,null))['then'](saveUpdates(_0x510a1b['body'],null))['then'](respondWithResult(_0x1b3460,null))['catch'](handleError(_0x1b3460,null));};exports[_0x542d('0x10')]=function(_0x15bd7c,_0x5397c6){return db[_0x542d('0x16')][_0x542d('0x31')]({'where':{'id':_0x15bd7c[_0x542d('0x2e')]['id']}})[_0x542d('0xf')](handleEntityNotFound(_0x5397c6,null))[_0x542d('0xf')](removeEntity(_0x5397c6,null))[_0x542d('0x2d')](handleError(_0x5397c6,null));};exports[_0x542d('0x34')]=function(_0x4965db,_0x579c16){var _0x6a2843={};var _0x467e94={};var _0x16c780;var _0x43aaae;return db['Dynamics365Account'][_0x542d('0x35')]({'where':{'id':_0x4965db[_0x542d('0x2e')]['id']}})[_0x542d('0xf')](handleEntityNotFound(_0x579c16,null))[_0x542d('0xf')](function(_0xc93abf){if(_0xc93abf){_0x16c780=_0xc93abf;_0x467e94[_0x542d('0x1d')]=_[_0x542d('0x2f')](db['Dynamics365Configuration'][_0x542d('0x17')]);_0x467e94[_0x542d('0x1a')]=_[_0x542d('0x2f')](_0x4965db[_0x542d('0x1a')]);_0x467e94['filters']=_[_0x542d('0x1c')](_0x467e94[_0x542d('0x1d')],_0x467e94[_0x542d('0x1a')]);_0x6a2843[_0x542d('0x1f')]=_[_0x542d('0x1c')](_0x467e94[_0x542d('0x1d')],qs[_0x542d('0x1e')](_0x4965db[_0x542d('0x1a')][_0x542d('0x1e')]));_0x6a2843[_0x542d('0x1f')]=_0x6a2843[_0x542d('0x1f')]['length']?_0x6a2843[_0x542d('0x1f')]:_0x467e94[_0x542d('0x1d')];_0x6a2843['order']=qs['sort'](_0x4965db['query'][_0x542d('0x24')]);_0x6a2843['where']=qs['filters'](_[_0x542d('0x26')](_0x4965db[_0x542d('0x1a')],_0x467e94[_0x542d('0x1b')]));if(_0x4965db['query'][_0x542d('0x29')]){_0x6a2843[_0x542d('0x25')]=_['merge'](_0x6a2843[_0x542d('0x25')],{'$or':_['map'](_0x6a2843['attributes'],function(_0x1aeb8c){var _0x39a21e={};_0x39a21e[_0x1aeb8c]={'$like':'%'+_0x4965db[_0x542d('0x1a')][_0x542d('0x29')]+'%'};return _0x39a21e;})});}_0x6a2843=_[_0x542d('0x27')]({},_0x6a2843,_0x4965db[_0x542d('0x2a')]);return _0x16c780['getConfigurations'](_0x6a2843);}})['then'](function(_0x18a645){if(_0x18a645){_0x43aaae=_0x18a645['length'];if(!_0x4965db[_0x542d('0x1a')]['hasOwnProperty'](_0x542d('0x36'))){_0x6a2843[_0x542d('0x22')]=qs[_0x542d('0x22')](_0x4965db[_0x542d('0x1a')][_0x542d('0x22')]);_0x6a2843[_0x542d('0xa')]=qs[_0x542d('0xa')](_0x4965db[_0x542d('0x1a')][_0x542d('0xa')]);}return _0x16c780[_0x542d('0x34')](_0x6a2843);}})['then'](function(_0x2ca615){if(_0x2ca615){return _0x2ca615?{'count':_0x43aaae,'rows':_0x2ca615}:null;}})[_0x542d('0xf')](respondWithResult(_0x579c16,null))[_0x542d('0x2d')](handleError(_0x579c16,null));};exports[_0x542d('0x37')]=function(_0x1aa220,_0x12ee27){if(_0x1aa220[_0x542d('0x33')]['id']){delete _0x1aa220[_0x542d('0x33')]['id'];}return db[_0x542d('0x16')][_0x542d('0x35')]({'where':{'id':_0x1aa220['params']['id']}})[_0x542d('0xf')](handleEntityNotFound(_0x12ee27,null))['then'](function(_0x12b35f){if(_0x12b35f){_0x1aa220[_0x542d('0x33')][_0x542d('0x38')]=_0x12b35f['id'];_0x1aa220[_0x542d('0x33')]['Subjects']=integrations[_0x542d('0x39')](_0x1aa220[_0x542d('0x33')][_0x542d('0x3a')],_0x1aa220[_0x542d('0x33')][_0x542d('0x19')]);_0x1aa220[_0x542d('0x33')][_0x542d('0x3b')]=integrations[_0x542d('0x3c')](_0x1aa220[_0x542d('0x33')]['channel'],_0x1aa220['body'][_0x542d('0x19')]);return db[_0x542d('0x3d')][_0x542d('0x32')](_0x1aa220[_0x542d('0x33')],{'include':[{'model':db[_0x542d('0x3e')],'as':_0x542d('0x3f')},{'model':db[_0x542d('0x3e')],'as':_0x542d('0x3b')}]});}return null;})[_0x542d('0xf')](respondWithResult(_0x12ee27,null))['catch'](handleError(_0x12ee27,null));};function sanitizeRemoteUri(_0x1f399f){var _0x1aefdb=_0x1f399f[_0x542d('0x40')](-0x1);if(_0x1aefdb==='/')return _0x1f399f[_0x542d('0x41')](0x0,_0x1f399f[_0x542d('0x42')](_0x1aefdb));return _0x1f399f;}function getWebApiUrl(_0x5c41a3){return util['format'](_0x542d('0x43'),_0x5c41a3);}exports['getFields']=function(_0x3ecdbf,_0x39c476){var _0x4c37ae=_0x3ecdbf[_0x542d('0x1a')][_0x542d('0x44')];var _0x2cd327=_0x4c37ae===_0x542d('0x45')?_0x542d('0x46'):_0x542d('0x47');var _0x47641d='';var _0x3d2348='';var _0x4fb4b0='';var _0x4c852c='';var _0x4850ca='';var _0x36e403='';var _0x599051='';var _0x5b5356='';var _0x20dd4b=[_0x542d('0x48'),'description',_0x542d('0x49'),'ownerid',_0x542d('0x4a'),'subject',_0x542d('0x4b'),'regardingobjectid',_0x542d('0x4c'),_0x542d('0x4d')];var _0x2ee86a=[_0x542d('0x4e'),_0x542d('0x4f'),_0x542d('0x50'),_0x542d('0x51'),_0x542d('0x52'),_0x542d('0x53'),'contractdetailidname',_0x542d('0x54'),'createdbyexternalpartyname',_0x542d('0x55'),_0x542d('0x56'),_0x542d('0x57'),_0x542d('0x58'),_0x542d('0x59'),'createdonbehalfbyyominame',_0x542d('0x5a'),_0x542d('0x5b'),_0x542d('0x5c'),_0x542d('0x5d'),_0x542d('0x5e'),_0x542d('0x5f'),_0x542d('0x60'),_0x542d('0x61'),'exchangerate','firstresponsebykpiidname',_0x542d('0x62'),_0x542d('0x63'),_0x542d('0x64'),_0x542d('0x65'),_0x542d('0x66'),_0x542d('0x67'),_0x542d('0x68'),_0x542d('0x69'),_0x542d('0x6a'),'modifiedbyyominame',_0x542d('0x6b'),_0x542d('0x6c'),'modifiedonbehalfbyyominame',_0x542d('0x6d'),_0x542d('0x6e'),_0x542d('0x6f'),'onholdtime',_0x542d('0x70'),_0x542d('0x71'),'owneridtype',_0x542d('0x72'),'parentcaseidname',_0x542d('0x73'),_0x542d('0x74'),'prioritycodename',_0x542d('0x75'),'productserialnumber','resolveby',_0x542d('0x76'),_0x542d('0x77'),'responsiblecontactidname',_0x542d('0x78'),_0x542d('0x79'),'slainvokedidname',_0x542d('0x7a'),_0x542d('0x7b'),_0x542d('0x7c'),_0x542d('0x7d'),_0x542d('0x7e'),_0x542d('0x7f'),_0x542d('0x80'),_0x542d('0x81'),_0x542d('0x82'),_0x542d('0x83'),_0x542d('0x84')];var _0x3ca4c2=_0x20dd4b['concat'](_0x2ee86a);return db['Dynamics365Account'][_0x542d('0x35')]({'where':{'id':_0x3ecdbf[_0x542d('0x2e')]['id']},'attributes':['id',_0x542d('0x85'),'password',_0x542d('0x86'),_0x542d('0x87'),'clientId','clientSecret',_0x542d('0x88')],'include':[{'model':db[_0x542d('0x89')],'as':_0x542d('0x89'),'attributes':['id',_0x542d('0x8a'),_0x542d('0x8b')]}]})[_0x542d('0xf')](handleEntityNotFound(_0x39c476,null))[_0x542d('0xf')](function(_0x20906d){if(_0x20906d){if(_0x20906d['modernAuthentication']){_0x20906d[_0x542d('0x8c')]=_0x20906d[_0x542d('0x89')][_0x542d('0x8a')];_0x5b5356=sanitizeRemoteUri(_0x20906d[_0x542d('0x89')][_0x542d('0x8b')]);_0x599051=getWebApiUrl(_0x5b5356);return _0x20906d;}_0x5b5356=sanitizeRemoteUri(_0x20906d[_0x542d('0x86')]);_0x599051=getWebApiUrl(_0x5b5356);var _0x4cce5d={'method':_0x542d('0x8d'),'uri':_0x542d('0x8e')+_0x20906d[_0x542d('0x87')]+'/oauth2/token','form':{'client_id':_0x20906d[_0x542d('0x8f')],'resource':_0x5b5356,'username':_0x20906d[_0x542d('0x85')],'password':_0x20906d[_0x542d('0x90')],'grant_type':_0x542d('0x90'),'client_secret':_0x20906d[_0x542d('0x91')]},'json':!![]};return rp(_0x4cce5d);}})['then'](function(_0x523e36){_0x36e403=_0x523e36[_0x542d('0x8c')];var _0x562945={'method':_0x542d('0x92'),'uri':encodeURI(_0x599051+_0x542d('0x93')+_0x2cd327+'\x27'),'headers':{'Authorization':_0x542d('0x94')+_0x36e403,'If-None-Match':null,'OData-Version':_0x542d('0x95')},'json':!![]};return rp(_0x562945);})[_0x542d('0xf')](function(_0x4ed03f){var _0x34ae2d=_0x4ed03f[_0x542d('0x96')][0x0];var _0x1d9af5=_0x34ae2d[_0x542d('0x97')];var _0x144d7e={'method':_0x542d('0x92'),'uri':_0x599051+_0x542d('0x98')+_0x1d9af5+_0x542d('0x99'),'headers':{'Authorization':_0x542d('0x94')+_0x36e403,'If-None-Match':null,'OData-Version':_0x542d('0x95')},'json':!![]};return rp(_0x144d7e);})[_0x542d('0xf')](function(_0x312b07){_0x47641d=_0x312b07;_0x3d2348=_0x47641d['Attributes'];_0x3d2348=_[_0x542d('0x9a')](_0x3d2348,function(_0x4388b7){return!_0x3ca4c2['includes'](_0x4388b7[_0x542d('0x9b')]);});var _0x2059e2=[];var _0x2847f7=[];_0x3d2348[_0x542d('0x9c')](function(_0x4b0334){if(_0x4b0334[_0x542d('0x9d')]){var _0x19028a=_0x4b0334[_0x542d('0x9d')][_0x542d('0x41')](_0x4b0334[_0x542d('0x9d')][_0x542d('0x42')]('.')+0x1);if(_0x19028a===_0x542d('0x9e')){_0x2059e2[_0x542d('0x9f')](getSelectList(_0x599051,_0x4c37ae,_0x2847f7,_0x47641d[_0x542d('0x97')],_0x4b0334[_0x542d('0x97')],_0x36e403));}}});return Promise[_0x542d('0xa0')](_0x2059e2);})[_0x542d('0xf')](function(_0xc21ed6){_0x4fb4b0=_0xc21ed6[0x0];var _0x18e7cd=[];var _0x1ca66c=[];_0x3d2348[_0x542d('0x9c')](function(_0x31478d){if(!_['isNil'](_0x31478d['@odata.type'])){var _0x11fcfc=_0x31478d[_0x542d('0x9d')][_0x542d('0x41')](_0x31478d[_0x542d('0x9d')][_0x542d('0x42')]('.')+0x1);if(_0x11fcfc==='BooleanAttributeMetadata'){_0x18e7cd['push'](getBooleanList(_0x599051,_0x4c37ae,_0x1ca66c,_0x47641d[_0x542d('0x97')],_0x31478d[_0x542d('0x97')],_0x36e403));}}});return Promise[_0x542d('0xa0')](_0x18e7cd);})[_0x542d('0xf')](function(_0x3e0794){_0x4c852c=_0x3e0794[0x0];var _0x8cda02=[];var _0xa0498a=[];_0x3d2348[_0x542d('0x9c')](function(_0x4af40c){if(_0x4af40c[_0x542d('0x9d')]){var _0x302bc0=_0x4af40c['@odata.type']['substring'](_0x4af40c[_0x542d('0x9d')][_0x542d('0x42')]('.')+0x1);if(_0x302bc0===_0x542d('0xa1')||_0x302bc0===_0x542d('0xa2')||_0x302bc0===_0x542d('0xa3')||_0x302bc0===_0x542d('0xa4')||_0x302bc0==='MemoAttributeMetadata'||_0x302bc0==='DateTimeAttributeMetadata'||_0x302bc0===_0x542d('0xa5')||_0x302bc0==='EntityNameAttributeMetadata'||_0x302bc0===_0x542d('0xa6')||_0x302bc0===_0x542d('0xa7')){_0x8cda02[_0x542d('0x9f')](getInputList(_0x599051,_0x4c37ae,_0x302bc0,_0xa0498a,_0x47641d['MetadataId'],_0x4af40c[_0x542d('0x97')],_0x36e403));}}});return Promise['all'](_0x8cda02);})[_0x542d('0xf')](function(_0x559e31){_0x4850ca=_0x559e31[0x0];var _0x2319b3=_0x4fb4b0['concat'](_0x4c852c)[_0x542d('0xa8')](_0x4850ca);var _0x1aea68={'count':_0x2319b3[_0x542d('0x20')],'rows':_0x2319b3};return _0x1aea68;})[_0x542d('0xf')](respondWithResult(_0x39c476,null))['catch'](function(_0x4294cc){var _0x3918e5=_0x3ecdbf[_0x542d('0x1a')]['test']?0x1f4:_0x4294cc[_0x542d('0xa9')]||0x1f4;logger[_0x542d('0x12')](_0x4294cc[_0x542d('0xaa')]);delete _0x4294cc[_0x542d('0x13')];if(_0x3918e5===0x191){_0x3918e5=0x190;}_0x39c476[_0x542d('0x8')](_0x3918e5)[_0x542d('0xab')](_0x3ecdbf[_0x542d('0x1a')][_0x542d('0xac')]?{'message':_0x542d('0xad'),'statusCode':_0x4294cc[_0x542d('0xa9')]}:_0x4294cc);});};function getSelectList(_0x9f79e,_0x4891fd,_0xe3a5fa,_0x6b04d4,_0x24dbfa,_0x2c84fd){var _0x7239c0={'method':_0x542d('0x92'),'uri':_0x9f79e+_0x542d('0x98')+_0x6b04d4+_0x542d('0xae')+_0x24dbfa+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x542d('0xaf'),'headers':{'Authorization':_0x542d('0x94')+_0x2c84fd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x7239c0)['then'](function(_0x4cfbe5){var _0x1043b5=[];var _0x16d7ce=_0x4cfbe5['OptionSet'][_0x542d('0xb0')];_0x16d7ce[_0x542d('0x9c')](function(_0x585e8f){_0x1043b5[_0x542d('0x9f')]({'name':_0x585e8f[_0x542d('0xb1')][_0x542d('0xb2')][_0x542d('0xb1')],'value':String(_0x585e8f[_0x542d('0xb3')])});});var _0x1379d7={'id':_0x4891fd+'_'+_0x4cfbe5[_0x542d('0x9b')],'name':_0x4cfbe5['DisplayName'][_0x542d('0xb2')][_0x542d('0xb1')],'custom':![],'options':_0x1043b5};_0xe3a5fa['push'](_0x1379d7);return _0xe3a5fa;});}function getBooleanList(_0x172c15,_0x8f8090,_0xbcbafa,_0x4b7cfc,_0x4e4ea7,_0x2352be){var _0x2f6cfc={'method':_0x542d('0x92'),'uri':_0x172c15+_0x542d('0x98')+_0x4b7cfc+_0x542d('0xae')+_0x4e4ea7+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x542d('0x94')+_0x2352be,'If-None-Match':null,'OData-Version':_0x542d('0x95')},'json':!![]};return rp(_0x2f6cfc)[_0x542d('0xf')](function(_0x2fcb9d){var _0x40355e=[];_0x40355e[_0x542d('0x9f')]({'name':_0x2fcb9d[_0x542d('0xb4')][_0x542d('0xb5')][_0x542d('0xb1')][_0x542d('0xb2')][_0x542d('0xb1')],'value':_0x542d('0xb6')},{'name':_0x2fcb9d['OptionSet'][_0x542d('0xb7')][_0x542d('0xb1')][_0x542d('0xb2')][_0x542d('0xb1')],'value':_0x542d('0xb8')});var _0x3bdb8d={'id':_0x8f8090+'_'+_0x2fcb9d[_0x542d('0x9b')],'name':_0x2fcb9d[_0x542d('0xb9')][_0x542d('0xb2')]['Label'],'custom':![],'options':_0x40355e};_0xbcbafa[_0x542d('0x9f')](_0x3bdb8d);return _0xbcbafa;});}function getInputList(_0x5a452d,_0x564d4d,_0x14340e,_0x2690f1,_0xac616,_0x1dd719,_0x2a1a5d){var _0x93ee0={'method':_0x542d('0x92'),'uri':_0x5a452d+_0x542d('0x98')+_0xac616+_0x542d('0xae')+_0x1dd719+_0x542d('0xba')+_0x14340e+_0x542d('0xbb'),'headers':{'Authorization':'Bearer\x20'+_0x2a1a5d,'If-None-Match':null,'OData-Version':_0x542d('0x95')},'json':!![]};return rp(_0x93ee0)['then'](function(_0x1e8aad){var _0x27ff62={'id':_0x564d4d+'_'+_0x1e8aad[_0x542d('0x9b')],'name':_0x1e8aad['DisplayName'][_0x542d('0xb2')]?_0x1e8aad['DisplayName'][_0x542d('0xb2')][_0x542d('0xb1')]:_0x1e8aad[_0x542d('0x9b')],'custom':![],'options':[]};_0x2690f1[_0x542d('0x9f')](_0x27ff62);return _0x2690f1;});} \ No newline at end of file +var _0x4d00=['PhoneCall','title','description','customerid','caseorigincode','subject','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','data7','access_token','CloudProvider','data5','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','forEach','@odata.type','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','stack',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','count','offset','set','Content-Range','json','update','destroy','then','end','sendStatus','error','name','send','index','map','Dynamics365Account','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filters','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','findOne','merge','filter','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','Descriptions','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x4d00,0x7c));var _0x04d0=function(_0x2fc236,_0x43f894){_0x2fc236=_0x2fc236-0x0;var _0x50a4f1=_0x4d00[_0x2fc236];return _0x50a4f1;};'use strict';var rp=require(_0x04d0('0x0'));var util=require(_0x04d0('0x1'));var _=require('lodash');var qs=require(_0x04d0('0x2'));var logger=require(_0x04d0('0x3'))(_0x04d0('0x4'));var db=require(_0x04d0('0x5'))['db'];var integrations=require(_0x04d0('0x6'));function respondWithResult(_0x3307ff,_0xe00684){_0xe00684=_0xe00684||0xc8;return function(_0x45919d){if(_0x45919d){return _0x3307ff[_0x04d0('0x7')](_0xe00684)['json'](_0x45919d);}};}function respondWithFilteredResult(_0x11608c,_0x1b652a){return function(_0x2cf9d5){if(_0x2cf9d5){var _0xbc896=typeof _0x1b652a['offset']===_0x04d0('0x8')&&typeof _0x1b652a[_0x04d0('0x9')]==='undefined';var _0x50cf8c=_0x2cf9d5[_0x04d0('0xa')];var _0x8c686a=_0xbc896?0x0:_0x1b652a['offset'];var _0x14cba7=_0xbc896?_0x2cf9d5[_0x04d0('0xa')]:_0x1b652a[_0x04d0('0xb')]+_0x1b652a[_0x04d0('0x9')];var _0x5886eb;if(_0x14cba7>=_0x50cf8c){_0x14cba7=_0x50cf8c;_0x5886eb=0xc8;}else{_0x5886eb=0xce;}_0x11608c[_0x04d0('0x7')](_0x5886eb);return _0x11608c[_0x04d0('0xc')](_0x04d0('0xd'),_0x8c686a+'-'+_0x14cba7+'/'+_0x50cf8c)[_0x04d0('0xe')](_0x2cf9d5);}return null;};}function saveUpdates(_0x201497){return function(_0x511ec4){if(_0x511ec4){return _0x511ec4[_0x04d0('0xf')](_0x201497)['then'](function(_0x35a3c8){return _0x35a3c8;});}return null;};}function removeEntity(_0x1c43b2){return function(_0x5a0788){if(_0x5a0788){return _0x5a0788[_0x04d0('0x10')]()[_0x04d0('0x11')](function(){_0x1c43b2[_0x04d0('0x7')](0xcc)[_0x04d0('0x12')]();});}};}function handleEntityNotFound(_0x151efa){return function(_0x1e98b8){if(!_0x1e98b8){_0x151efa[_0x04d0('0x13')](0x194);}return _0x1e98b8;};}function handleError(_0xcd3bf3,_0xb414b3){_0xb414b3=_0xb414b3||0x1f4;return function(_0xb3c53e){logger[_0x04d0('0x14')](_0xb3c53e['stack']);if(_0xb3c53e[_0x04d0('0x15')]){delete _0xb3c53e[_0x04d0('0x15')];}_0xcd3bf3[_0x04d0('0x7')](_0xb414b3)[_0x04d0('0x16')](_0xb3c53e);};}exports[_0x04d0('0x17')]=function(_0x376913,_0x427629){var _0x2aeaf1={},_0x3eec02={},_0x4adbe0={'count':0x0,'rows':[]};var _0x35397b=_[_0x04d0('0x18')](db[_0x04d0('0x19')]['rawAttributes'],function(_0x2fbcb6){return{'name':_0x2fbcb6['fieldName'],'type':_0x2fbcb6[_0x04d0('0x1a')]['key']};});_0x3eec02[_0x04d0('0x1b')]=_['map'](_0x35397b,_0x04d0('0x15'));_0x3eec02[_0x04d0('0x1c')]=_[_0x04d0('0x1d')](_0x376913[_0x04d0('0x1c')]);_0x3eec02['filters']=_[_0x04d0('0x1e')](_0x3eec02[_0x04d0('0x1b')],_0x3eec02[_0x04d0('0x1c')]);_0x2aeaf1[_0x04d0('0x1f')]=_[_0x04d0('0x1e')](_0x3eec02['model'],qs[_0x04d0('0x20')](_0x376913[_0x04d0('0x1c')][_0x04d0('0x20')]));_0x2aeaf1[_0x04d0('0x1f')]=_0x2aeaf1[_0x04d0('0x1f')][_0x04d0('0x21')]?_0x2aeaf1[_0x04d0('0x1f')]:_0x3eec02[_0x04d0('0x1b')];if(!_0x376913[_0x04d0('0x1c')][_0x04d0('0x22')]('nolimit')){_0x2aeaf1[_0x04d0('0x9')]=qs['limit'](_0x376913[_0x04d0('0x1c')][_0x04d0('0x9')]);_0x2aeaf1[_0x04d0('0xb')]=qs[_0x04d0('0xb')](_0x376913['query'][_0x04d0('0xb')]);}_0x2aeaf1[_0x04d0('0x23')]=qs['sort'](_0x376913['query']['sort']);_0x2aeaf1[_0x04d0('0x24')]=qs['filters'](_[_0x04d0('0x25')](_0x376913[_0x04d0('0x1c')],_0x3eec02[_0x04d0('0x26')]),_0x35397b);if(_0x376913['query']['filter']){_0x2aeaf1[_0x04d0('0x24')]=_['merge'](_0x2aeaf1['where'],{'$or':_[_0x04d0('0x18')](_0x35397b,function(_0x446b66){if(_0x446b66['type']!==_0x04d0('0x27')){var _0x4acf8f={};_0x4acf8f[_0x446b66[_0x04d0('0x15')]]={'$like':'%'+_0x376913[_0x04d0('0x1c')]['filter']+'%'};return _0x4acf8f;}})});}_0x2aeaf1=_['merge']({},_0x2aeaf1,_0x376913[_0x04d0('0x28')]);var _0x3b8080={'where':_0x2aeaf1['where']};return db[_0x04d0('0x19')][_0x04d0('0xa')](_0x3b8080)[_0x04d0('0x11')](function(_0x167f7d){_0x4adbe0[_0x04d0('0xa')]=_0x167f7d;if(_0x376913[_0x04d0('0x1c')][_0x04d0('0x29')]){_0x2aeaf1[_0x04d0('0x2a')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x04d0('0x2b')](_0x2aeaf1);})[_0x04d0('0x11')](function(_0x204c02){_0x4adbe0[_0x04d0('0x2c')]=_0x204c02;return _0x4adbe0;})[_0x04d0('0x11')](respondWithFilteredResult(_0x427629,_0x2aeaf1))[_0x04d0('0x2d')](handleError(_0x427629,null));};exports[_0x04d0('0x2e')]=function(_0x28bffb,_0x27e986){var _0xfddadc={'raw':![],'where':{'id':_0x28bffb['params']['id']}},_0x1a6459={};_0x1a6459[_0x04d0('0x1b')]=_[_0x04d0('0x1d')](db[_0x04d0('0x19')]['rawAttributes']);_0x1a6459[_0x04d0('0x1c')]=_[_0x04d0('0x1d')](_0x28bffb['query']);_0x1a6459[_0x04d0('0x26')]=_[_0x04d0('0x1e')](_0x1a6459[_0x04d0('0x1b')],_0x1a6459[_0x04d0('0x1c')]);_0xfddadc['attributes']=_['intersection'](_0x1a6459['model'],qs[_0x04d0('0x20')](_0x28bffb['query'][_0x04d0('0x20')]));_0xfddadc[_0x04d0('0x1f')]=_0xfddadc[_0x04d0('0x1f')]['length']?_0xfddadc[_0x04d0('0x1f')]:_0x1a6459[_0x04d0('0x1b')];if(_0x28bffb['query'][_0x04d0('0x29')]){_0xfddadc['include']=[{'all':!![]}];}_0xfddadc=_['merge']({},_0xfddadc,_0x28bffb[_0x04d0('0x28')]);return db['Dynamics365Account'][_0x04d0('0x2f')](_0xfddadc)[_0x04d0('0x11')](handleEntityNotFound(_0x27e986,null))[_0x04d0('0x11')](respondWithResult(_0x27e986,null))[_0x04d0('0x2d')](handleError(_0x27e986,null));};exports[_0x04d0('0x30')]=function(_0x6fb1e8,_0x5d5e3c){return db[_0x04d0('0x19')][_0x04d0('0x30')](_0x6fb1e8[_0x04d0('0x31')],{})[_0x04d0('0x11')](respondWithResult(_0x5d5e3c,0xc9))[_0x04d0('0x2d')](handleError(_0x5d5e3c,null));};exports[_0x04d0('0xf')]=function(_0x15ea84,_0x3f6911){if(_0x15ea84['body']['id']){delete _0x15ea84[_0x04d0('0x31')]['id'];}return db[_0x04d0('0x19')][_0x04d0('0x2f')]({'where':{'id':_0x15ea84['params']['id']}})[_0x04d0('0x11')](handleEntityNotFound(_0x3f6911,null))[_0x04d0('0x11')](saveUpdates(_0x15ea84[_0x04d0('0x31')],null))[_0x04d0('0x11')](respondWithResult(_0x3f6911,null))[_0x04d0('0x2d')](handleError(_0x3f6911,null));};exports[_0x04d0('0x10')]=function(_0x427d97,_0x2ac2dd){return db[_0x04d0('0x19')][_0x04d0('0x2f')]({'where':{'id':_0x427d97[_0x04d0('0x32')]['id']}})['then'](handleEntityNotFound(_0x2ac2dd,null))[_0x04d0('0x11')](removeEntity(_0x2ac2dd,null))[_0x04d0('0x2d')](handleError(_0x2ac2dd,null));};exports['getConfigurations']=function(_0x116fef,_0x30e77e){var _0x43afc7={};var _0x282c53={};var _0x54c62f;var _0x103647;return db[_0x04d0('0x19')][_0x04d0('0x33')]({'where':{'id':_0x116fef[_0x04d0('0x32')]['id']}})[_0x04d0('0x11')](handleEntityNotFound(_0x30e77e,null))[_0x04d0('0x11')](function(_0x535e05){if(_0x535e05){_0x54c62f=_0x535e05;_0x282c53[_0x04d0('0x1b')]=_[_0x04d0('0x1d')](db['Dynamics365Configuration']['rawAttributes']);_0x282c53['query']=_['keys'](_0x116fef[_0x04d0('0x1c')]);_0x282c53[_0x04d0('0x26')]=_[_0x04d0('0x1e')](_0x282c53[_0x04d0('0x1b')],_0x282c53[_0x04d0('0x1c')]);_0x43afc7['attributes']=_[_0x04d0('0x1e')](_0x282c53[_0x04d0('0x1b')],qs['fields'](_0x116fef[_0x04d0('0x1c')][_0x04d0('0x20')]));_0x43afc7[_0x04d0('0x1f')]=_0x43afc7[_0x04d0('0x1f')][_0x04d0('0x21')]?_0x43afc7[_0x04d0('0x1f')]:_0x282c53[_0x04d0('0x1b')];_0x43afc7[_0x04d0('0x23')]=qs['sort'](_0x116fef['query']['sort']);_0x43afc7[_0x04d0('0x24')]=qs[_0x04d0('0x26')](_[_0x04d0('0x25')](_0x116fef[_0x04d0('0x1c')],_0x282c53['filters']));if(_0x116fef[_0x04d0('0x1c')]['filter']){_0x43afc7[_0x04d0('0x24')]=_[_0x04d0('0x34')](_0x43afc7[_0x04d0('0x24')],{'$or':_[_0x04d0('0x18')](_0x43afc7[_0x04d0('0x1f')],function(_0x7d55b1){var _0x3e8c11={};_0x3e8c11[_0x7d55b1]={'$like':'%'+_0x116fef[_0x04d0('0x1c')][_0x04d0('0x35')]+'%'};return _0x3e8c11;})});}_0x43afc7=_[_0x04d0('0x34')]({},_0x43afc7,_0x116fef[_0x04d0('0x28')]);return _0x54c62f['getConfigurations'](_0x43afc7);}})[_0x04d0('0x11')](function(_0x5e2200){if(_0x5e2200){_0x103647=_0x5e2200['length'];if(!_0x116fef[_0x04d0('0x1c')][_0x04d0('0x22')](_0x04d0('0x36'))){_0x43afc7[_0x04d0('0x9')]=qs[_0x04d0('0x9')](_0x116fef[_0x04d0('0x1c')][_0x04d0('0x9')]);_0x43afc7[_0x04d0('0xb')]=qs[_0x04d0('0xb')](_0x116fef[_0x04d0('0x1c')][_0x04d0('0xb')]);}return _0x54c62f[_0x04d0('0x37')](_0x43afc7);}})[_0x04d0('0x11')](function(_0x3f602b){if(_0x3f602b){return _0x3f602b?{'count':_0x103647,'rows':_0x3f602b}:null;}})[_0x04d0('0x11')](respondWithResult(_0x30e77e,null))['catch'](handleError(_0x30e77e,null));};exports[_0x04d0('0x38')]=function(_0x33c0bb,_0x45c39d){if(_0x33c0bb[_0x04d0('0x31')]['id']){delete _0x33c0bb['body']['id'];}return db[_0x04d0('0x19')][_0x04d0('0x33')]({'where':{'id':_0x33c0bb[_0x04d0('0x32')]['id']}})[_0x04d0('0x11')](handleEntityNotFound(_0x45c39d,null))['then'](function(_0x3c6b1f){if(_0x3c6b1f){_0x33c0bb['body'][_0x04d0('0x39')]=_0x3c6b1f['id'];_0x33c0bb[_0x04d0('0x31')][_0x04d0('0x3a')]=integrations[_0x04d0('0x3b')](_0x33c0bb['body'][_0x04d0('0x3c')],_0x33c0bb[_0x04d0('0x31')][_0x04d0('0x1a')]);_0x33c0bb['body']['Descriptions']=integrations[_0x04d0('0x3d')](_0x33c0bb[_0x04d0('0x31')]['channel'],_0x33c0bb[_0x04d0('0x31')][_0x04d0('0x1a')]);return db[_0x04d0('0x3e')][_0x04d0('0x30')](_0x33c0bb[_0x04d0('0x31')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x04d0('0x3f')],'as':_0x04d0('0x40')}]});}return null;})[_0x04d0('0x11')](respondWithResult(_0x45c39d,null))['catch'](handleError(_0x45c39d,null));};function sanitizeRemoteUri(_0x4f060e){var _0x410857=_0x4f060e['slice'](-0x1);if(_0x410857==='/')return _0x4f060e[_0x04d0('0x41')](0x0,_0x4f060e[_0x04d0('0x42')](_0x410857));return _0x4f060e;}function getWebApiUrl(_0x128512){return util['format'](_0x04d0('0x43'),_0x128512);}exports[_0x04d0('0x44')]=function(_0x34d2bf,_0x6765f9){var _0x355f16=_0x34d2bf[_0x04d0('0x1c')][_0x04d0('0x45')];var _0x356ba8=_0x355f16===_0x04d0('0x46')?'Incident':_0x04d0('0x47');var _0x4925a8='';var _0x1bba2b='';var _0x333cb5='';var _0x1a33ba='';var _0x495cd5='';var _0x2e5711='';var _0x2ba6f8='';var _0x3aa748='';var _0x117a18=[_0x04d0('0x48'),_0x04d0('0x49'),_0x04d0('0x4a'),'ownerid',_0x04d0('0x4b'),_0x04d0('0x4c'),'phonenumber','regardingobjectid','directioncode',_0x04d0('0x4d')];var _0x2e98a8=[_0x04d0('0x4e'),_0x04d0('0x4f'),_0x04d0('0x50'),_0x04d0('0x51'),_0x04d0('0x52'),_0x04d0('0x53'),_0x04d0('0x54'),_0x04d0('0x55'),_0x04d0('0x56'),_0x04d0('0x57'),_0x04d0('0x58'),'createdbyyominame',_0x04d0('0x59'),_0x04d0('0x5a'),'createdonbehalfbyyominame',_0x04d0('0x5b'),_0x04d0('0x5c'),_0x04d0('0x5d'),'emailaddress',_0x04d0('0x5e'),_0x04d0('0x5f'),_0x04d0('0x60'),_0x04d0('0x61'),_0x04d0('0x62'),_0x04d0('0x63'),_0x04d0('0x64'),_0x04d0('0x65'),_0x04d0('0x66'),'kbarticleidname',_0x04d0('0x67'),'masteridname',_0x04d0('0x68'),_0x04d0('0x69'),_0x04d0('0x6a'),_0x04d0('0x6b'),_0x04d0('0x6c'),_0x04d0('0x6d'),_0x04d0('0x6e'),_0x04d0('0x6f'),_0x04d0('0x70'),_0x04d0('0x71'),_0x04d0('0x72'),_0x04d0('0x73'),_0x04d0('0x74'),'owneridtype',_0x04d0('0x75'),_0x04d0('0x76'),_0x04d0('0x77'),_0x04d0('0x78'),_0x04d0('0x79'),_0x04d0('0x7a'),_0x04d0('0x7b'),_0x04d0('0x7c'),_0x04d0('0x7d'),_0x04d0('0x7e'),_0x04d0('0x7f'),'responsiblecontactidyominame',_0x04d0('0x80'),_0x04d0('0x81'),_0x04d0('0x82'),_0x04d0('0x83'),_0x04d0('0x84'),_0x04d0('0x85'),_0x04d0('0x86'),_0x04d0('0x87'),'timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0x04d0('0x88')];var _0xbcf3e6=_0x117a18[_0x04d0('0x89')](_0x2e98a8);return db[_0x04d0('0x19')][_0x04d0('0x33')]({'where':{'id':_0x34d2bf[_0x04d0('0x32')]['id']},'attributes':['id',_0x04d0('0x8a'),_0x04d0('0x8b'),'remoteUri',_0x04d0('0x8c'),_0x04d0('0x8d'),_0x04d0('0x8e'),_0x04d0('0x8f')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id','data5',_0x04d0('0x90')]}]})[_0x04d0('0x11')](handleEntityNotFound(_0x6765f9,null))[_0x04d0('0x11')](function(_0x3b905f){if(_0x3b905f){if(_0x3b905f[_0x04d0('0x8f')]){_0x3b905f[_0x04d0('0x91')]=_0x3b905f[_0x04d0('0x92')][_0x04d0('0x93')];_0x3aa748=sanitizeRemoteUri(_0x3b905f[_0x04d0('0x92')][_0x04d0('0x90')]);_0x2ba6f8=getWebApiUrl(_0x3aa748);return _0x3b905f;}_0x3aa748=sanitizeRemoteUri(_0x3b905f[_0x04d0('0x94')]);_0x2ba6f8=getWebApiUrl(_0x3aa748);var _0x31fec3={'method':_0x04d0('0x95'),'uri':_0x04d0('0x96')+_0x3b905f['tenantId']+_0x04d0('0x97'),'form':{'client_id':_0x3b905f['clientId'],'resource':_0x3aa748,'username':_0x3b905f[_0x04d0('0x8a')],'password':_0x3b905f[_0x04d0('0x8b')],'grant_type':_0x04d0('0x8b'),'client_secret':_0x3b905f['clientSecret']},'json':!![]};return rp(_0x31fec3);}})[_0x04d0('0x11')](function(_0xa2dea6){_0x2e5711=_0xa2dea6[_0x04d0('0x91')];var _0x5a83fd={'method':_0x04d0('0x98'),'uri':encodeURI(_0x2ba6f8+_0x04d0('0x99')+_0x356ba8+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2e5711,'If-None-Match':null,'OData-Version':_0x04d0('0x9a')},'json':!![]};return rp(_0x5a83fd);})[_0x04d0('0x11')](function(_0x4d3881){var _0x244317=_0x4d3881[_0x04d0('0x9b')][0x0];var _0x4154e7=_0x244317[_0x04d0('0x9c')];var _0x3264c9={'method':_0x04d0('0x98'),'uri':_0x2ba6f8+_0x04d0('0x9d')+_0x4154e7+_0x04d0('0x9e'),'headers':{'Authorization':_0x04d0('0x9f')+_0x2e5711,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3264c9);})['then'](function(_0x363de2){_0x4925a8=_0x363de2;_0x1bba2b=_0x4925a8['Attributes'];_0x1bba2b=_[_0x04d0('0xa0')](_0x1bba2b,function(_0x134f9e){return!_0xbcf3e6[_0x04d0('0xa1')](_0x134f9e[_0x04d0('0xa2')]);});var _0x1b2b59=[];var _0x51e56f=[];_0x1bba2b[_0x04d0('0xa3')](function(_0x461190){if(_0x461190[_0x04d0('0xa4')]){var _0x47a02e=_0x461190['@odata.type'][_0x04d0('0x41')](_0x461190[_0x04d0('0xa4')][_0x04d0('0x42')]('.')+0x1);if(_0x47a02e==='PicklistAttributeMetadata'){_0x1b2b59[_0x04d0('0xa5')](getSelectList(_0x2ba6f8,_0x355f16,_0x51e56f,_0x4925a8['MetadataId'],_0x461190[_0x04d0('0x9c')],_0x2e5711));}}});return Promise[_0x04d0('0xa6')](_0x1b2b59);})[_0x04d0('0x11')](function(_0x4a2eb5){_0x333cb5=_0x4a2eb5[0x0];var _0x11a6b7=[];var _0xf6bb6d=[];_0x1bba2b['forEach'](function(_0x55a04a){if(!_['isNil'](_0x55a04a[_0x04d0('0xa4')])){var _0x577267=_0x55a04a[_0x04d0('0xa4')][_0x04d0('0x41')](_0x55a04a['@odata.type']['lastIndexOf']('.')+0x1);if(_0x577267===_0x04d0('0xa7')){_0x11a6b7[_0x04d0('0xa5')](getBooleanList(_0x2ba6f8,_0x355f16,_0xf6bb6d,_0x4925a8[_0x04d0('0x9c')],_0x55a04a[_0x04d0('0x9c')],_0x2e5711));}}});return Promise[_0x04d0('0xa6')](_0x11a6b7);})[_0x04d0('0x11')](function(_0x44f01e){_0x1a33ba=_0x44f01e[0x0];var _0x3e674f=[];var _0x126b38=[];_0x1bba2b['forEach'](function(_0x27e126){if(_0x27e126[_0x04d0('0xa4')]){var _0x669c75=_0x27e126['@odata.type'][_0x04d0('0x41')](_0x27e126[_0x04d0('0xa4')][_0x04d0('0x42')]('.')+0x1);if(_0x669c75===_0x04d0('0xa8')||_0x669c75===_0x04d0('0xa9')||_0x669c75===_0x04d0('0xaa')||_0x669c75===_0x04d0('0xab')||_0x669c75===_0x04d0('0xac')||_0x669c75===_0x04d0('0xad')||_0x669c75===_0x04d0('0xae')||_0x669c75==='EntityNameAttributeMetadata'||_0x669c75===_0x04d0('0xaf')||_0x669c75===_0x04d0('0xb0')){_0x3e674f[_0x04d0('0xa5')](getInputList(_0x2ba6f8,_0x355f16,_0x669c75,_0x126b38,_0x4925a8[_0x04d0('0x9c')],_0x27e126[_0x04d0('0x9c')],_0x2e5711));}}});return Promise['all'](_0x3e674f);})[_0x04d0('0x11')](function(_0x1d998e){_0x495cd5=_0x1d998e[0x0];var _0x548819=_0x333cb5[_0x04d0('0x89')](_0x1a33ba)['concat'](_0x495cd5);var _0x6e4b3b={'count':_0x548819[_0x04d0('0x21')],'rows':_0x548819};return _0x6e4b3b;})[_0x04d0('0x11')](respondWithResult(_0x6765f9,null))[_0x04d0('0x2d')](function(_0x1ccd6b){var _0x1b8cf6=_0x34d2bf[_0x04d0('0x1c')]['test']?0x1f4:_0x1ccd6b[_0x04d0('0xb1')]||0x1f4;logger[_0x04d0('0x14')](_0x1ccd6b[_0x04d0('0xb2')]);delete _0x1ccd6b['name'];if(_0x1b8cf6===0x191){_0x1b8cf6=0x190;}_0x6765f9['status'](_0x1b8cf6)[_0x04d0('0x16')](_0x34d2bf[_0x04d0('0x1c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1ccd6b['statusCode']}:_0x1ccd6b);});};function getSelectList(_0x199dc1,_0x35f7a4,_0x353abe,_0x2b9c31,_0x4f2bec,_0x3dd12d){var _0xb60be={'method':_0x04d0('0x98'),'uri':_0x199dc1+_0x04d0('0x9d')+_0x2b9c31+_0x04d0('0xb3')+_0x4f2bec+_0x04d0('0xb4')+_0x04d0('0xb5'),'headers':{'Authorization':_0x04d0('0x9f')+_0x3dd12d,'If-None-Match':null,'OData-Version':_0x04d0('0x9a')},'json':!![]};return rp(_0xb60be)[_0x04d0('0x11')](function(_0x562c26){var _0x30b490=[];var _0x5b4dd9=_0x562c26[_0x04d0('0xb6')][_0x04d0('0xb7')];_0x5b4dd9['forEach'](function(_0xcfc851){_0x30b490[_0x04d0('0xa5')]({'name':_0xcfc851[_0x04d0('0xb8')][_0x04d0('0xb9')][_0x04d0('0xb8')],'value':String(_0xcfc851[_0x04d0('0xba')])});});var _0x5debbd={'id':_0x35f7a4+'_'+_0x562c26['LogicalName'],'name':_0x562c26['DisplayName'][_0x04d0('0xb9')][_0x04d0('0xb8')],'custom':![],'options':_0x30b490};_0x353abe[_0x04d0('0xa5')](_0x5debbd);return _0x353abe;});}function getBooleanList(_0x2187a9,_0x3e198c,_0x28a590,_0x2125dd,_0x4d5ea0,_0x2e6039){var _0xaabd5e={'method':_0x04d0('0x98'),'uri':_0x2187a9+'EntityDefinitions('+_0x2125dd+_0x04d0('0xb3')+_0x4d5ea0+_0x04d0('0xbb'),'headers':{'Authorization':'Bearer\x20'+_0x2e6039,'If-None-Match':null,'OData-Version':_0x04d0('0x9a')},'json':!![]};return rp(_0xaabd5e)[_0x04d0('0x11')](function(_0x5bb366){var _0x1d1bc1=[];_0x1d1bc1[_0x04d0('0xa5')]({'name':_0x5bb366['OptionSet'][_0x04d0('0xbc')][_0x04d0('0xb8')][_0x04d0('0xb9')][_0x04d0('0xb8')],'value':_0x04d0('0xbd')},{'name':_0x5bb366[_0x04d0('0xb6')][_0x04d0('0xbe')][_0x04d0('0xb8')][_0x04d0('0xb9')][_0x04d0('0xb8')],'value':_0x04d0('0xbf')});var _0x450731={'id':_0x3e198c+'_'+_0x5bb366[_0x04d0('0xa2')],'name':_0x5bb366[_0x04d0('0xc0')][_0x04d0('0xb9')][_0x04d0('0xb8')],'custom':![],'options':_0x1d1bc1};_0x28a590[_0x04d0('0xa5')](_0x450731);return _0x28a590;});}function getInputList(_0x188f11,_0x17c3d2,_0x104d3e,_0x15ebc9,_0x4825c8,_0x12becc,_0x5c3dec){var _0x10a3c4={'method':_0x04d0('0x98'),'uri':_0x188f11+_0x04d0('0x9d')+_0x4825c8+_0x04d0('0xb3')+_0x12becc+_0x04d0('0xc1')+_0x104d3e+_0x04d0('0xc2'),'headers':{'Authorization':'Bearer\x20'+_0x5c3dec,'If-None-Match':null,'OData-Version':_0x04d0('0x9a')},'json':!![]};return rp(_0x10a3c4)[_0x04d0('0x11')](function(_0x47ca2b){var _0x259eec={'id':_0x17c3d2+'_'+_0x47ca2b[_0x04d0('0xa2')],'name':_0x47ca2b[_0x04d0('0xc0')]['UserLocalizedLabel']?_0x47ca2b[_0x04d0('0xc0')]['UserLocalizedLabel'][_0x04d0('0xb8')]:_0x47ca2b[_0x04d0('0xa2')],'custom':![],'options':[]};_0x15ebc9['push'](_0x259eec);return _0x15ebc9;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 4f7cef1..00beb70 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1a05d0,_0x328120){var _0x48192a=function(_0x380396){while(--_0x380396){_0x1a05d0['push'](_0x1a05d0['shift']());}};_0x48192a(++_0x328120);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./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 +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x43987f,_0x22335c){var _0x536b31=function(_0x5e2071){while(--_0x5e2071){_0x43987f['push'](_0x43987f['shift']());}};_0x536b31(++_0x22335c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xcb91[_0x587ba2];return _0x50ec73;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index facc5d2..8edacf7 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 _0x58ad=['http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','then','GetDynamics365Account','debug','ShowDynamics365Account','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2c23e9,_0x1b7597){var _0x3a84ec=function(_0x94d22f){while(--_0x94d22f){_0x2c23e9['push'](_0x2c23e9['shift']());}};_0x3a84ec(++_0x1b7597);}(_0x58ad,0x139));var _0xd58a=function(_0x378cd4,_0x4e9050){_0x378cd4=_0x378cd4-0x0;var _0x42bcde=_0x58ad[_0x378cd4];return _0x42bcde;};'use strict';var _=require('lodash');var util=require(_0xd58a('0x0'));var moment=require(_0xd58a('0x1'));var BPromise=require('bluebird');var rs=require(_0xd58a('0x2'));var fs=require('fs');var Redis=require(_0xd58a('0x3'));var db=require(_0xd58a('0x4'))['db'];var utils=require(_0xd58a('0x5'));var logger=require(_0xd58a('0x6'))(_0xd58a('0x7'));var config=require(_0xd58a('0x8'));var jayson=require(_0xd58a('0x9'));var client=jayson[_0xd58a('0xa')][_0xd58a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3501f7,_0x2ec99a,_0x361ea7){return new BPromise(function(_0x5f4908,_0x89f155){return client[_0xd58a('0xc')](_0x3501f7,_0x361ea7)['then'](function(_0x36be15){logger[_0xd58a('0xd')](_0xd58a('0xe'),_0x2ec99a,_0xd58a('0xf'));logger['debug'](_0xd58a('0x10'),_0x2ec99a,_0xd58a('0xf'),JSON[_0xd58a('0x11')](_0x36be15));if(_0x36be15[_0xd58a('0x12')]){if(_0x36be15[_0xd58a('0x12')][_0xd58a('0x13')]===0x1f4){logger[_0xd58a('0x12')](_0xd58a('0xe'),_0x2ec99a,_0x36be15[_0xd58a('0x12')][_0xd58a('0x14')]);return _0x89f155(_0x36be15[_0xd58a('0x12')][_0xd58a('0x14')]);}logger[_0xd58a('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x2ec99a,_0x36be15[_0xd58a('0x12')][_0xd58a('0x14')]);return _0x5f4908(_0x36be15['error'][_0xd58a('0x14')]);}else{logger[_0xd58a('0xd')](_0xd58a('0xe'),_0x2ec99a,_0xd58a('0xf'));_0x5f4908(_0x36be15[_0xd58a('0x15')]['message']);}})[_0xd58a('0x16')](function(_0x2ba9d0){logger[_0xd58a('0x12')](_0xd58a('0xe'),_0x2ec99a,_0x2ba9d0);_0x89f155(_0x2ba9d0);});});}exports['GetDynamics365Account']=function(_0x5373d2){var _0x40e624=this;return new Promise(function(_0xf4bc89,_0x1eb3fa){return db[_0xd58a('0x17')]['findAll']({'raw':_0x5373d2[_0xd58a('0x18')]?_0x5373d2['options'][_0xd58a('0x19')]===undefined?!![]:![]:!![],'where':_0x5373d2[_0xd58a('0x18')]?_0x5373d2['options'][_0xd58a('0x1a')]||null:null,'attributes':_0x5373d2[_0xd58a('0x18')]?_0x5373d2['options'][_0xd58a('0x1b')]||null:null,'limit':_0x5373d2[_0xd58a('0x18')]?_0x5373d2['options'][_0xd58a('0x1c')]||null:null,'include':_0x5373d2[_0xd58a('0x18')]?_0x5373d2['options'][_0xd58a('0x1d')]?_[_0xd58a('0x1e')](_0x5373d2['options']['include'],function(_0x2a48eb){return{'model':db[_0x2a48eb[_0xd58a('0x1f')]],'as':_0x2a48eb['as'],'attributes':_0x2a48eb[_0xd58a('0x1b')],'include':_0x2a48eb[_0xd58a('0x1d')]?_[_0xd58a('0x1e')](_0x2a48eb[_0xd58a('0x1d')],function(_0x519eea){return{'model':db[_0x519eea[_0xd58a('0x1f')]],'as':_0x519eea['as'],'attributes':_0x519eea['attributes'],'include':_0x519eea['include']?_[_0xd58a('0x1e')](_0x519eea[_0xd58a('0x1d')],function(_0xa024ce){return{'model':db[_0xa024ce[_0xd58a('0x1f')]],'as':_0xa024ce['as'],'attributes':_0xa024ce[_0xd58a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd58a('0x20')](function(_0x3c91ab){logger[_0xd58a('0xd')](_0xd58a('0x21'),_0x5373d2);logger[_0xd58a('0x22')](_0xd58a('0x21'),_0x5373d2,JSON[_0xd58a('0x11')](_0x3c91ab));_0xf4bc89(_0x3c91ab);})[_0xd58a('0x16')](function(_0x71b596){logger[_0xd58a('0x12')](_0xd58a('0x21'),_0x71b596[_0xd58a('0x14')],_0x5373d2);_0x1eb3fa(_0x40e624[_0xd58a('0x12')](0x1f4,_0x71b596[_0xd58a('0x14')]));});});};exports[_0xd58a('0x23')]=function(_0x3516b1){var _0x5aef6b=this;return new Promise(function(_0x29045e,_0xe4e6bb){return db[_0xd58a('0x17')]['find']({'raw':_0x3516b1[_0xd58a('0x18')]?_0x3516b1[_0xd58a('0x18')][_0xd58a('0x19')]===undefined?!![]:![]:!![],'where':_0x3516b1[_0xd58a('0x18')]?_0x3516b1[_0xd58a('0x18')][_0xd58a('0x1a')]||null:null,'attributes':_0x3516b1[_0xd58a('0x18')]?_0x3516b1[_0xd58a('0x18')][_0xd58a('0x1b')]||null:null,'include':_0x3516b1[_0xd58a('0x18')]?_0x3516b1[_0xd58a('0x18')][_0xd58a('0x1d')]?_[_0xd58a('0x1e')](_0x3516b1[_0xd58a('0x18')][_0xd58a('0x1d')],function(_0x38799a){return{'model':db[_0x38799a['model']],'as':_0x38799a['as'],'attributes':_0x38799a['attributes'],'include':_0x38799a[_0xd58a('0x1d')]?_[_0xd58a('0x1e')](_0x38799a[_0xd58a('0x1d')],function(_0x4462a7){return{'model':db[_0x4462a7[_0xd58a('0x1f')]],'as':_0x4462a7['as'],'attributes':_0x4462a7[_0xd58a('0x1b')],'include':_0x4462a7[_0xd58a('0x1d')]?_[_0xd58a('0x1e')](_0x4462a7[_0xd58a('0x1d')],function(_0x4925b0){return{'model':db[_0x4925b0[_0xd58a('0x1f')]],'as':_0x4925b0['as'],'attributes':_0x4925b0[_0xd58a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd58a('0x20')](function(_0x5f3b7a){logger[_0xd58a('0xd')](_0xd58a('0x23'),_0x3516b1);logger[_0xd58a('0x22')]('ShowDynamics365Account',_0x3516b1,JSON[_0xd58a('0x11')](_0x5f3b7a));_0x29045e(_0x5f3b7a);})[_0xd58a('0x16')](function(_0x152e60){logger[_0xd58a('0x12')](_0xd58a('0x23'),_0x152e60[_0xd58a('0x14')],_0x3516b1);_0xe4e6bb(_0x5aef6b[_0xd58a('0x12')](0x1f4,_0x152e60[_0xd58a('0x14')]));});});}; \ No newline at end of file +var _0x38ed=['client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','options','attributes','map','include','model','ShowDynamics365Account','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x2ceba7,_0x451ce4){var _0x5348eb=function(_0x3596fc){while(--_0x3596fc){_0x2ceba7['push'](_0x2ceba7['shift']());}};_0x5348eb(++_0x451ce4);}(_0x38ed,0x118));var _0xd38e=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x38ed[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xd38e('0x0'));var util=require('util');var moment=require(_0xd38e('0x1'));var BPromise=require(_0xd38e('0x2'));var rs=require(_0xd38e('0x3'));var fs=require('fs');var Redis=require(_0xd38e('0x4'));var db=require(_0xd38e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd38e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd38e('0x7'));var client=jayson[_0xd38e('0x8')][_0xd38e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x187594,_0xf6638f,_0x436c9b){return new BPromise(function(_0x5d12ac,_0x4b8bc){return client[_0xd38e('0xa')](_0x187594,_0x436c9b)[_0xd38e('0xb')](function(_0x1ee253){logger[_0xd38e('0xc')](_0xd38e('0xd'),_0xf6638f,_0xd38e('0xe'));logger[_0xd38e('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xf6638f,_0xd38e('0xe'),JSON[_0xd38e('0x10')](_0x1ee253));if(_0x1ee253[_0xd38e('0x11')]){if(_0x1ee253[_0xd38e('0x11')][_0xd38e('0x12')]===0x1f4){logger['error'](_0xd38e('0xd'),_0xf6638f,_0x1ee253[_0xd38e('0x11')][_0xd38e('0x13')]);return _0x4b8bc(_0x1ee253[_0xd38e('0x11')][_0xd38e('0x13')]);}logger[_0xd38e('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0xf6638f,_0x1ee253[_0xd38e('0x11')][_0xd38e('0x13')]);return _0x5d12ac(_0x1ee253[_0xd38e('0x11')][_0xd38e('0x13')]);}else{logger[_0xd38e('0xc')](_0xd38e('0xd'),_0xf6638f,_0xd38e('0xe'));_0x5d12ac(_0x1ee253[_0xd38e('0x14')][_0xd38e('0x13')]);}})[_0xd38e('0x15')](function(_0x361d95){logger['error'](_0xd38e('0xd'),_0xf6638f,_0x361d95);_0x4b8bc(_0x361d95);});});}exports[_0xd38e('0x16')]=function(_0x323cdf){var _0x5efc4e=this;return new Promise(function(_0x58bf15,_0x373c08){return db['Dynamics365Account'][_0xd38e('0x17')]({'raw':_0x323cdf[_0xd38e('0x18')]?_0x323cdf[_0xd38e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x323cdf[_0xd38e('0x18')]?_0x323cdf[_0xd38e('0x18')]['where']||null:null,'attributes':_0x323cdf[_0xd38e('0x18')]?_0x323cdf['options'][_0xd38e('0x19')]||null:null,'limit':_0x323cdf[_0xd38e('0x18')]?_0x323cdf['options']['limit']||null:null,'include':_0x323cdf[_0xd38e('0x18')]?_0x323cdf[_0xd38e('0x18')]['include']?_[_0xd38e('0x1a')](_0x323cdf[_0xd38e('0x18')][_0xd38e('0x1b')],function(_0x69d10){return{'model':db[_0x69d10['model']],'as':_0x69d10['as'],'attributes':_0x69d10['attributes'],'include':_0x69d10[_0xd38e('0x1b')]?_['map'](_0x69d10[_0xd38e('0x1b')],function(_0x5f8eae){return{'model':db[_0x5f8eae[_0xd38e('0x1c')]],'as':_0x5f8eae['as'],'attributes':_0x5f8eae[_0xd38e('0x19')],'include':_0x5f8eae[_0xd38e('0x1b')]?_[_0xd38e('0x1a')](_0x5f8eae[_0xd38e('0x1b')],function(_0x3f3e1f){return{'model':db[_0x3f3e1f[_0xd38e('0x1c')]],'as':_0x3f3e1f['as'],'attributes':_0x3f3e1f[_0xd38e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41449e){logger[_0xd38e('0xc')]('GetDynamics365Account',_0x323cdf);logger['debug'](_0xd38e('0x16'),_0x323cdf,JSON[_0xd38e('0x10')](_0x41449e));_0x58bf15(_0x41449e);})[_0xd38e('0x15')](function(_0xf7dcc9){logger[_0xd38e('0x11')](_0xd38e('0x16'),_0xf7dcc9[_0xd38e('0x13')],_0x323cdf);_0x373c08(_0x5efc4e[_0xd38e('0x11')](0x1f4,_0xf7dcc9[_0xd38e('0x13')]));});});};exports[_0xd38e('0x1d')]=function(_0x911444){var _0x50ba28=this;return new Promise(function(_0x39cf09,_0x30feb2){return db['Dynamics365Account'][_0xd38e('0x1e')]({'raw':_0x911444[_0xd38e('0x18')]?_0x911444[_0xd38e('0x18')][_0xd38e('0x1f')]===undefined?!![]:![]:!![],'where':_0x911444[_0xd38e('0x18')]?_0x911444[_0xd38e('0x18')]['where']||null:null,'attributes':_0x911444[_0xd38e('0x18')]?_0x911444['options'][_0xd38e('0x19')]||null:null,'include':_0x911444[_0xd38e('0x18')]?_0x911444[_0xd38e('0x18')]['include']?_['map'](_0x911444['options'][_0xd38e('0x1b')],function(_0x1f66f6){return{'model':db[_0x1f66f6[_0xd38e('0x1c')]],'as':_0x1f66f6['as'],'attributes':_0x1f66f6[_0xd38e('0x19')],'include':_0x1f66f6[_0xd38e('0x1b')]?_[_0xd38e('0x1a')](_0x1f66f6[_0xd38e('0x1b')],function(_0x30888e){return{'model':db[_0x30888e[_0xd38e('0x1c')]],'as':_0x30888e['as'],'attributes':_0x30888e[_0xd38e('0x19')],'include':_0x30888e['include']?_[_0xd38e('0x1a')](_0x30888e[_0xd38e('0x1b')],function(_0x457daa){return{'model':db[_0x457daa[_0xd38e('0x1c')]],'as':_0x457daa['as'],'attributes':_0x457daa[_0xd38e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd38e('0xb')](function(_0x423dd9){logger[_0xd38e('0xc')](_0xd38e('0x1d'),_0x911444);logger[_0xd38e('0xf')](_0xd38e('0x1d'),_0x911444,JSON[_0xd38e('0x10')](_0x423dd9));_0x39cf09(_0x423dd9);})[_0xd38e('0x15')](function(_0xaee9fc){logger[_0xd38e('0x11')](_0xd38e('0x1d'),_0xaee9fc[_0xd38e('0x13')],_0x911444);_0x30feb2(_0x50ba28[_0xd38e('0x11')](0x1f4,_0xaee9fc[_0xd38e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 80f3094..15a7ebe 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 _0xf894=['getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0xf894,0xfd));var _0x4f89=function(_0x14c0b5,_0x24a525){_0x14c0b5=_0x14c0b5-0x0;var _0x357923=_0xf894[_0x14c0b5];return _0x357923;};'use strict';var multer=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var path=require(_0x4f89('0x2'));var timeout=require(_0x4f89('0x3'));var express=require(_0x4f89('0x4'));var router=express[_0x4f89('0x5')]();var fs_extra=require(_0x4f89('0x6'));var auth=require(_0x4f89('0x7'));var interaction=require(_0x4f89('0x8'));var config=require(_0x4f89('0x9'));var controller=require(_0x4f89('0xa'));router[_0x4f89('0xb')]('/',auth[_0x4f89('0xc')](),controller[_0x4f89('0xd')]);router[_0x4f89('0xb')](_0x4f89('0xe'),auth[_0x4f89('0xc')](),controller[_0x4f89('0xf')]);router['get'](_0x4f89('0x10'),auth[_0x4f89('0xc')](),controller[_0x4f89('0x11')]);router[_0x4f89('0xb')](_0x4f89('0x12'),auth[_0x4f89('0xc')](),controller[_0x4f89('0x13')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x4f89('0x14')]);router[_0x4f89('0x15')]('/',auth['isAuthenticated'](),controller[_0x4f89('0x16')]);router[_0x4f89('0x17')](_0x4f89('0xe'),auth[_0x4f89('0xc')](),controller[_0x4f89('0x18')]);router[_0x4f89('0x19')](_0x4f89('0xe'),auth[_0x4f89('0xc')](),controller[_0x4f89('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xa3c3=['./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3c3,0xcc));var _0x3a3c=function(_0x532dec,_0x325cc7){_0x532dec=_0x532dec-0x0;var _0x3a491a=_0xa3c3[_0x532dec];return _0x3a491a;};'use strict';var multer=require(_0x3a3c('0x0'));var util=require('util');var path=require(_0x3a3c('0x1'));var timeout=require('connect-timeout');var express=require(_0x3a3c('0x2'));var router=express['Router']();var fs_extra=require(_0x3a3c('0x3'));var auth=require(_0x3a3c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3a3c('0x5'));var controller=require(_0x3a3c('0x6'));router[_0x3a3c('0x7')]('/',auth[_0x3a3c('0x8')](),controller['index']);router['get'](_0x3a3c('0x9'),auth[_0x3a3c('0x8')](),controller[_0x3a3c('0xa')]);router[_0x3a3c('0x7')](_0x3a3c('0xb'),auth['isAuthenticated'](),controller[_0x3a3c('0xc')]);router[_0x3a3c('0x7')](_0x3a3c('0xd'),auth[_0x3a3c('0x8')](),controller['getSubjects']);router[_0x3a3c('0x7')](_0x3a3c('0xe'),auth[_0x3a3c('0x8')](),controller[_0x3a3c('0xf')]);router['post']('/',auth[_0x3a3c('0x8')](),controller[_0x3a3c('0x10')]);router[_0x3a3c('0x11')](_0x3a3c('0x9'),auth[_0x3a3c('0x8')](),controller[_0x3a3c('0x12')]);router[_0x3a3c('0x13')](_0x3a3c('0x9'),auth[_0x3a3c('0x8')](),controller[_0x3a3c('0x14')]);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 6703f4c..b5799f2 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 _0x6ac0=['incident','phonecall','nothing','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x576501,_0x1b7bdd){var _0x50358f=function(_0x521020){while(--_0x521020){_0x576501['push'](_0x576501['shift']());}};_0x50358f(++_0x1b7bdd);}(_0x6ac0,0x94));var _0x06ac=function(_0x28d332,_0x1d5219){_0x28d332=_0x28d332-0x0;var _0x333dd3=_0x6ac0[_0x28d332];return _0x333dd3;};'use strict';var Sequelize=require(_0x06ac('0x0'));module[_0x06ac('0x1')]={'name':{'type':Sequelize[_0x06ac('0x2')]},'description':{'type':Sequelize[_0x06ac('0x2')]},'ticketType':{'type':Sequelize[_0x06ac('0x3')](_0x06ac('0x4'),_0x06ac('0x5')),'defaultValue':_0x06ac('0x4')},'moduleCreate':{'type':Sequelize[_0x06ac('0x3')]('contact',_0x06ac('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x06ac('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x06ac('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb2f6=['contact','nothing','BOOLEAN','exports','STRING','ENUM','incident'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0xb2f6,0xb9));var _0x6b2f=function(_0x149fc0,_0x133113){_0x149fc0=_0x149fc0-0x0;var _0x63a2a2=_0xb2f6[_0x149fc0];return _0x63a2a2;};'use strict';var Sequelize=require('sequelize');module[_0x6b2f('0x0')]={'name':{'type':Sequelize[_0x6b2f('0x1')]},'description':{'type':Sequelize[_0x6b2f('0x1')]},'ticketType':{'type':Sequelize[_0x6b2f('0x2')]('incident','phonecall'),'defaultValue':_0x6b2f('0x3')},'moduleCreate':{'type':Sequelize[_0x6b2f('0x2')](_0x6b2f('0x4'),_0x6b2f('0x5')),'defaultValue':_0x6b2f('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x6b2f('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x6b2f('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e4f2703..24545de 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 _0x2ca3=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','reject','save','then','end','sendStatus','stack','name','send','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','destroy','getFields','map','getSubjects','findOne','Dynamics365Field','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x25ed81,_0x4fd82f){var _0x321e46=function(_0x3f35f9){while(--_0x3f35f9){_0x25ed81['push'](_0x25ed81['shift']());}};_0x321e46(++_0x4fd82f);}(_0x2ca3,0x136));var _0x32ca=function(_0x10cc44,_0x38cc4b){_0x10cc44=_0x10cc44-0x0;var _0x4607fd=_0x2ca3[_0x10cc44];return _0x4607fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32ca('0x0'));var zipdir=require(_0x32ca('0x1'));var jsonpatch=require(_0x32ca('0x2'));var rp=require(_0x32ca('0x3'));var moment=require(_0x32ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x32ca('0x5'));var util=require(_0x32ca('0x6'));var path=require(_0x32ca('0x7'));var sox=require(_0x32ca('0x8'));var csv=require(_0x32ca('0x9'));var ejs=require(_0x32ca('0xa'));var fs=require('fs');var fs_extra=require(_0x32ca('0xb'));var _=require(_0x32ca('0xc'));var squel=require(_0x32ca('0xd'));var crypto=require(_0x32ca('0xe'));var jsforce=require(_0x32ca('0xf'));var deskjs=require(_0x32ca('0x10'));var toCsv=require(_0x32ca('0x9'));var querystring=require(_0x32ca('0x11'));var Papa=require(_0x32ca('0x12'));var Redis=require(_0x32ca('0x13'));var authService=require(_0x32ca('0x14'));var qs=require(_0x32ca('0x15'));var as=require(_0x32ca('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x32ca('0x17'))(_0x32ca('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x32ca('0x19'));var db=require(_0x32ca('0x1a'))['db'];function respondWithStatusCode(_0x15682f,_0x190598){_0x190598=_0x190598||0xcc;return function(_0xf4deae){if(_0xf4deae){return _0x15682f['sendStatus'](_0x190598);}return _0x15682f[_0x32ca('0x1b')](_0x190598)['end']();};}function respondWithResult(_0xccbab3,_0x18f1c1){_0x18f1c1=_0x18f1c1||0xc8;return function(_0x78a85b){if(_0x78a85b){return _0xccbab3[_0x32ca('0x1b')](_0x18f1c1)[_0x32ca('0x1c')](_0x78a85b);}};}function respondWithFilteredResult(_0x16a2dc,_0xd842e9){return function(_0x5ad758){if(_0x5ad758){var _0xf8cbb1=typeof _0xd842e9['offset']===_0x32ca('0x1d')&&typeof _0xd842e9[_0x32ca('0x1e')]===_0x32ca('0x1d');var _0x2fae7f=_0x5ad758[_0x32ca('0x1f')];var _0x567c97=_0xf8cbb1?0x0:_0xd842e9[_0x32ca('0x20')];var _0xcaac1b=_0xf8cbb1?_0x5ad758['count']:_0xd842e9['offset']+_0xd842e9[_0x32ca('0x1e')];var _0x469427;if(_0xcaac1b>=_0x2fae7f){_0xcaac1b=_0x2fae7f;_0x469427=0xc8;}else{_0x469427=0xce;}_0x16a2dc['status'](_0x469427);return _0x16a2dc[_0x32ca('0x21')]('Content-Range',_0x567c97+'-'+_0xcaac1b+'/'+_0x2fae7f)[_0x32ca('0x1c')](_0x5ad758);}return null;};}function patchUpdates(_0x206d63){return function(_0x3c1c6d){try{jsonpatch['apply'](_0x3c1c6d,_0x206d63,!![]);}catch(_0x5bd843){return BPromise[_0x32ca('0x22')](_0x5bd843);}return _0x3c1c6d[_0x32ca('0x23')]();};}function saveUpdates(_0x1073fe,_0x5a1b0f){return function(_0x3fbe5f){if(_0x3fbe5f){return _0x3fbe5f['update'](_0x1073fe)['then'](function(_0x264e53){return _0x264e53;});}return null;};}function removeEntity(_0x230b04,_0xb1e6fe){return function(_0x14b94f){if(_0x14b94f){return _0x14b94f['destroy']()[_0x32ca('0x24')](function(){_0x230b04['status'](0xcc)[_0x32ca('0x25')]();});}};}function handleEntityNotFound(_0x28b1cf,_0x307610){return function(_0x1fb136){if(!_0x1fb136){_0x28b1cf[_0x32ca('0x26')](0x194);}return _0x1fb136;};}function handleError(_0x52be12,_0x53c6a8){_0x53c6a8=_0x53c6a8||0x1f4;return function(_0x57e6be){logger['error'](_0x57e6be[_0x32ca('0x27')]);if(_0x57e6be[_0x32ca('0x28')]){delete _0x57e6be[_0x32ca('0x28')];}_0x52be12[_0x32ca('0x1b')](_0x53c6a8)[_0x32ca('0x29')](_0x57e6be);};}exports['index']=function(_0x4060b9,_0x45feb1){var _0x35b535={},_0x325172={},_0x1f7796={'count':0x0,'rows':[]};var _0x50cbed=_['map'](db[_0x32ca('0x2a')][_0x32ca('0x2b')],function(_0x47ab86){return{'name':_0x47ab86[_0x32ca('0x2c')],'type':_0x47ab86[_0x32ca('0x2d')][_0x32ca('0x2e')]};});_0x325172[_0x32ca('0x2f')]=_['map'](_0x50cbed,'name');_0x325172['query']=_[_0x32ca('0x30')](_0x4060b9['query']);_0x325172[_0x32ca('0x31')]=_[_0x32ca('0x32')](_0x325172[_0x32ca('0x2f')],_0x325172[_0x32ca('0x33')]);_0x35b535[_0x32ca('0x34')]=_[_0x32ca('0x32')](_0x325172['model'],qs[_0x32ca('0x35')](_0x4060b9[_0x32ca('0x33')][_0x32ca('0x35')]));_0x35b535[_0x32ca('0x34')]=_0x35b535[_0x32ca('0x34')]['length']?_0x35b535['attributes']:_0x325172['model'];if(!_0x4060b9[_0x32ca('0x33')][_0x32ca('0x36')](_0x32ca('0x37'))){_0x35b535[_0x32ca('0x1e')]=qs[_0x32ca('0x1e')](_0x4060b9[_0x32ca('0x33')][_0x32ca('0x1e')]);_0x35b535[_0x32ca('0x20')]=qs[_0x32ca('0x20')](_0x4060b9[_0x32ca('0x33')][_0x32ca('0x20')]);}_0x35b535[_0x32ca('0x38')]=qs[_0x32ca('0x39')](_0x4060b9[_0x32ca('0x33')][_0x32ca('0x39')]);_0x35b535[_0x32ca('0x3a')]=qs[_0x32ca('0x31')](_[_0x32ca('0x3b')](_0x4060b9[_0x32ca('0x33')],_0x325172[_0x32ca('0x31')]),_0x50cbed);if(_0x4060b9[_0x32ca('0x33')][_0x32ca('0x3c')]){_0x35b535[_0x32ca('0x3a')]=_[_0x32ca('0x3d')](_0x35b535[_0x32ca('0x3a')],{'$or':_['map'](_0x50cbed,function(_0x1686e8){if(_0x1686e8[_0x32ca('0x2d')]!=='VIRTUAL'){var _0x34e714={};_0x34e714[_0x1686e8[_0x32ca('0x28')]]={'$like':'%'+_0x4060b9[_0x32ca('0x33')][_0x32ca('0x3c')]+'%'};return _0x34e714;}})});}_0x35b535=_[_0x32ca('0x3d')]({},_0x35b535,_0x4060b9['options']);var _0x592890={'where':_0x35b535[_0x32ca('0x3a')]};return db[_0x32ca('0x2a')][_0x32ca('0x1f')](_0x592890)['then'](function(_0x5848ad){_0x1f7796[_0x32ca('0x1f')]=_0x5848ad;if(_0x4060b9[_0x32ca('0x33')][_0x32ca('0x3e')]){_0x35b535[_0x32ca('0x3f')]=[{'all':!![]}];}return db[_0x32ca('0x2a')][_0x32ca('0x40')](_0x35b535);})[_0x32ca('0x24')](function(_0x5c7de6){_0x1f7796[_0x32ca('0x41')]=_0x5c7de6;return _0x1f7796;})['then'](respondWithFilteredResult(_0x45feb1,_0x35b535))[_0x32ca('0x42')](handleError(_0x45feb1,null));};exports['show']=function(_0x246bb7,_0x39751d){var _0x2c52fd={'raw':![],'where':{'id':_0x246bb7[_0x32ca('0x43')]['id']}},_0x191bac={};_0x191bac[_0x32ca('0x2f')]=_[_0x32ca('0x30')](db[_0x32ca('0x2a')][_0x32ca('0x2b')]);_0x191bac[_0x32ca('0x33')]=_[_0x32ca('0x30')](_0x246bb7[_0x32ca('0x33')]);_0x191bac['filters']=_[_0x32ca('0x32')](_0x191bac[_0x32ca('0x2f')],_0x191bac[_0x32ca('0x33')]);_0x2c52fd[_0x32ca('0x34')]=_['intersection'](_0x191bac[_0x32ca('0x2f')],qs[_0x32ca('0x35')](_0x246bb7[_0x32ca('0x33')][_0x32ca('0x35')]));_0x2c52fd['attributes']=_0x2c52fd[_0x32ca('0x34')][_0x32ca('0x44')]?_0x2c52fd[_0x32ca('0x34')]:_0x191bac[_0x32ca('0x2f')];if(_0x246bb7[_0x32ca('0x33')][_0x32ca('0x3e')]){_0x2c52fd[_0x32ca('0x3f')]=[{'all':!![]}];}_0x2c52fd=_[_0x32ca('0x3d')]({},_0x2c52fd,_0x246bb7[_0x32ca('0x45')]);return db[_0x32ca('0x2a')][_0x32ca('0x46')](_0x2c52fd)[_0x32ca('0x24')](handleEntityNotFound(_0x39751d,null))[_0x32ca('0x24')](respondWithResult(_0x39751d,null))[_0x32ca('0x42')](handleError(_0x39751d,null));};exports['create']=function(_0x1298c8,_0x9f8daf){return db[_0x32ca('0x2a')][_0x32ca('0x47')](_0x1298c8[_0x32ca('0x48')],{})[_0x32ca('0x24')](respondWithResult(_0x9f8daf,0xc9))[_0x32ca('0x42')](handleError(_0x9f8daf,null));};exports['update']=function(_0x27cb3c,_0x4fa297){if(_0x27cb3c[_0x32ca('0x48')]['id']){delete _0x27cb3c[_0x32ca('0x48')]['id'];}return db['Dynamics365Configuration'][_0x32ca('0x46')]({'where':{'id':_0x27cb3c['params']['id']}})[_0x32ca('0x24')](handleEntityNotFound(_0x4fa297,null))[_0x32ca('0x24')](saveUpdates(_0x27cb3c['body'],null))['then'](respondWithResult(_0x4fa297,null))[_0x32ca('0x42')](handleError(_0x4fa297,null));};exports[_0x32ca('0x49')]=function(_0x26c65a,_0x5536dc){return db[_0x32ca('0x2a')][_0x32ca('0x46')]({'where':{'id':_0x26c65a['params']['id']}})[_0x32ca('0x24')](handleEntityNotFound(_0x5536dc,null))[_0x32ca('0x24')](removeEntity(_0x5536dc,null))[_0x32ca('0x42')](handleError(_0x5536dc,null));};exports[_0x32ca('0x4a')]=function(_0x426d46,_0xc2d580,_0x2a5cde){var _0x2b8ab6={};var _0x1f2d48={};var _0xb50379;var _0xa2d493;return db[_0x32ca('0x2a')]['findOne']({'where':{'id':_0x426d46['params']['id']}})[_0x32ca('0x24')](handleEntityNotFound(_0xc2d580,null))[_0x32ca('0x24')](function(_0x5bfbc3){if(_0x5bfbc3){_0xb50379=_0x5bfbc3;_0x1f2d48['model']=_[_0x32ca('0x30')](db['Dynamics365Field'][_0x32ca('0x2b')]);_0x1f2d48[_0x32ca('0x33')]=_['keys'](_0x426d46[_0x32ca('0x33')]);_0x1f2d48[_0x32ca('0x31')]=_[_0x32ca('0x32')](_0x1f2d48[_0x32ca('0x2f')],_0x1f2d48[_0x32ca('0x33')]);_0x2b8ab6[_0x32ca('0x34')]=_[_0x32ca('0x32')](_0x1f2d48[_0x32ca('0x2f')],qs['fields'](_0x426d46[_0x32ca('0x33')][_0x32ca('0x35')]));_0x2b8ab6['attributes']=_0x2b8ab6[_0x32ca('0x34')][_0x32ca('0x44')]?_0x2b8ab6['attributes']:_0x1f2d48[_0x32ca('0x2f')];_0x2b8ab6['order']=qs[_0x32ca('0x39')](_0x426d46['query']['sort']);_0x2b8ab6[_0x32ca('0x3a')]=qs[_0x32ca('0x31')](_['pick'](_0x426d46[_0x32ca('0x33')],_0x1f2d48[_0x32ca('0x31')]));if(_0x426d46['query'][_0x32ca('0x3c')]){_0x2b8ab6[_0x32ca('0x3a')]=_[_0x32ca('0x3d')](_0x2b8ab6[_0x32ca('0x3a')],{'$or':_[_0x32ca('0x4b')](_0x2b8ab6[_0x32ca('0x34')],function(_0xb27580){var _0xd9db7f={};_0xd9db7f[_0xb27580]={'$like':'%'+_0x426d46['query']['filter']+'%'};return _0xd9db7f;})});}_0x2b8ab6=_[_0x32ca('0x3d')]({},_0x2b8ab6,_0x426d46[_0x32ca('0x45')]);return _0xb50379['getFields'](_0x2b8ab6);}})[_0x32ca('0x24')](function(_0x427aca){if(_0x427aca){_0xa2d493=_0x427aca[_0x32ca('0x44')];if(!_0x426d46['query']['hasOwnProperty'](_0x32ca('0x37'))){_0x2b8ab6[_0x32ca('0x1e')]=qs[_0x32ca('0x1e')](_0x426d46[_0x32ca('0x33')][_0x32ca('0x1e')]);_0x2b8ab6[_0x32ca('0x20')]=qs['offset'](_0x426d46[_0x32ca('0x33')][_0x32ca('0x20')]);}return _0xb50379[_0x32ca('0x4a')](_0x2b8ab6);}})['then'](function(_0x13beca){if(_0x13beca){return _0x13beca?{'count':_0xa2d493,'rows':_0x13beca}:null;}})[_0x32ca('0x24')](respondWithResult(_0xc2d580,null))[_0x32ca('0x42')](handleError(_0xc2d580,null));};exports[_0x32ca('0x4c')]=function(_0x3c96cb,_0x47d354,_0x381f1f){var _0x269fa3={};var _0x1a0fdb={};var _0x533c05;var _0x5a384f;return db[_0x32ca('0x2a')][_0x32ca('0x4d')]({'where':{'id':_0x3c96cb['params']['id']}})['then'](handleEntityNotFound(_0x47d354,null))[_0x32ca('0x24')](function(_0x45e1d1){if(_0x45e1d1){_0x533c05=_0x45e1d1;_0x1a0fdb[_0x32ca('0x2f')]=_[_0x32ca('0x30')](db[_0x32ca('0x4e')][_0x32ca('0x2b')]);_0x1a0fdb[_0x32ca('0x33')]=_[_0x32ca('0x30')](_0x3c96cb[_0x32ca('0x33')]);_0x1a0fdb[_0x32ca('0x31')]=_['intersection'](_0x1a0fdb['model'],_0x1a0fdb[_0x32ca('0x33')]);_0x269fa3[_0x32ca('0x34')]=_[_0x32ca('0x32')](_0x1a0fdb[_0x32ca('0x2f')],qs[_0x32ca('0x35')](_0x3c96cb[_0x32ca('0x33')]['fields']));_0x269fa3[_0x32ca('0x34')]=_0x269fa3[_0x32ca('0x34')]['length']?_0x269fa3[_0x32ca('0x34')]:_0x1a0fdb['model'];_0x269fa3[_0x32ca('0x38')]=qs[_0x32ca('0x39')](_0x3c96cb[_0x32ca('0x33')][_0x32ca('0x39')]);_0x269fa3[_0x32ca('0x3a')]=qs['filters'](_[_0x32ca('0x3b')](_0x3c96cb[_0x32ca('0x33')],_0x1a0fdb['filters']));if(_0x3c96cb[_0x32ca('0x33')][_0x32ca('0x3c')]){_0x269fa3[_0x32ca('0x3a')]=_[_0x32ca('0x3d')](_0x269fa3['where'],{'$or':_[_0x32ca('0x4b')](_0x269fa3[_0x32ca('0x34')],function(_0x2b0fa8){var _0x5cba9e={};_0x5cba9e[_0x2b0fa8]={'$like':'%'+_0x3c96cb[_0x32ca('0x33')][_0x32ca('0x3c')]+'%'};return _0x5cba9e;})});}_0x269fa3=_[_0x32ca('0x3d')]({},_0x269fa3,_0x3c96cb[_0x32ca('0x45')]);return _0x533c05[_0x32ca('0x4c')](_0x269fa3);}})['then'](function(_0x33e8e3){if(_0x33e8e3){_0x5a384f=_0x33e8e3[_0x32ca('0x44')];if(!_0x3c96cb[_0x32ca('0x33')][_0x32ca('0x36')](_0x32ca('0x37'))){_0x269fa3['limit']=qs[_0x32ca('0x1e')](_0x3c96cb[_0x32ca('0x33')][_0x32ca('0x1e')]);_0x269fa3['offset']=qs[_0x32ca('0x20')](_0x3c96cb[_0x32ca('0x33')][_0x32ca('0x20')]);}return _0x533c05[_0x32ca('0x4c')](_0x269fa3);}})['then'](function(_0xfd1ef1){if(_0xfd1ef1){return _0xfd1ef1?{'count':_0x5a384f,'rows':_0xfd1ef1}:null;}})['then'](respondWithResult(_0x47d354,null))[_0x32ca('0x42')](handleError(_0x47d354,null));};exports[_0x32ca('0x4f')]=function(_0xa053af,_0x448118,_0x39e30d){var _0x1457d2={};var _0x3a7103={};var _0x10a9dc;var _0x21f86c;return db[_0x32ca('0x2a')][_0x32ca('0x4d')]({'where':{'id':_0xa053af['params']['id']}})[_0x32ca('0x24')](handleEntityNotFound(_0x448118,null))[_0x32ca('0x24')](function(_0xd9620e){if(_0xd9620e){_0x10a9dc=_0xd9620e;_0x3a7103[_0x32ca('0x2f')]=_[_0x32ca('0x30')](db['Dynamics365Field'][_0x32ca('0x2b')]);_0x3a7103[_0x32ca('0x33')]=_['keys'](_0xa053af[_0x32ca('0x33')]);_0x3a7103[_0x32ca('0x31')]=_[_0x32ca('0x32')](_0x3a7103['model'],_0x3a7103[_0x32ca('0x33')]);_0x1457d2['attributes']=_['intersection'](_0x3a7103[_0x32ca('0x2f')],qs['fields'](_0xa053af[_0x32ca('0x33')][_0x32ca('0x35')]));_0x1457d2[_0x32ca('0x34')]=_0x1457d2[_0x32ca('0x34')][_0x32ca('0x44')]?_0x1457d2[_0x32ca('0x34')]:_0x3a7103['model'];_0x1457d2['order']=qs[_0x32ca('0x39')](_0xa053af[_0x32ca('0x33')]['sort']);_0x1457d2[_0x32ca('0x3a')]=qs['filters'](_[_0x32ca('0x3b')](_0xa053af[_0x32ca('0x33')],_0x3a7103[_0x32ca('0x31')]));if(_0xa053af[_0x32ca('0x33')]['filter']){_0x1457d2[_0x32ca('0x3a')]=_['merge'](_0x1457d2[_0x32ca('0x3a')],{'$or':_[_0x32ca('0x4b')](_0x1457d2['attributes'],function(_0x4a5b50){var _0x1b9fb2={};_0x1b9fb2[_0x4a5b50]={'$like':'%'+_0xa053af[_0x32ca('0x33')][_0x32ca('0x3c')]+'%'};return _0x1b9fb2;})});}_0x1457d2=_[_0x32ca('0x3d')]({},_0x1457d2,_0xa053af[_0x32ca('0x45')]);return _0x10a9dc[_0x32ca('0x4f')](_0x1457d2);}})['then'](function(_0x1b221e){if(_0x1b221e){_0x21f86c=_0x1b221e[_0x32ca('0x44')];if(!_0xa053af[_0x32ca('0x33')][_0x32ca('0x36')](_0x32ca('0x37'))){_0x1457d2[_0x32ca('0x1e')]=qs[_0x32ca('0x1e')](_0xa053af['query']['limit']);_0x1457d2[_0x32ca('0x20')]=qs[_0x32ca('0x20')](_0xa053af[_0x32ca('0x33')][_0x32ca('0x20')]);}return _0x10a9dc['getDescriptions'](_0x1457d2);}})[_0x32ca('0x24')](function(_0x355ff2){if(_0x355ff2){return _0x355ff2?{'count':_0x21f86c,'rows':_0x355ff2}:null;}})[_0x32ca('0x24')](respondWithResult(_0x448118,null))[_0x32ca('0x42')](handleError(_0x448118,null));}; \ No newline at end of file +var _0xa1aa=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','rows','show','keys','fields','include','find','catch','create','body','params','getFields','findOne','rawAttributes','order','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x1ba9bd,_0x3299e8){var _0x19aae2=function(_0x1ebe8f){while(--_0x1ebe8f){_0x1ba9bd['push'](_0x1ba9bd['shift']());}};_0x19aae2(++_0x3299e8);}(_0xa1aa,0x1d5));var _0xaa1a=function(_0x4906b1,_0x3e502b){_0x4906b1=_0x4906b1-0x0;var _0x16488a=_0xa1aa[_0x4906b1];return _0x16488a;};'use strict';var emlformat=require(_0xaa1a('0x0'));var rimraf=require(_0xaa1a('0x1'));var zipdir=require(_0xaa1a('0x2'));var jsonpatch=require(_0xaa1a('0x3'));var rp=require(_0xaa1a('0x4'));var moment=require(_0xaa1a('0x5'));var BPromise=require(_0xaa1a('0x6'));var Mustache=require(_0xaa1a('0x7'));var util=require('util');var path=require(_0xaa1a('0x8'));var sox=require(_0xaa1a('0x9'));var csv=require(_0xaa1a('0xa'));var ejs=require(_0xaa1a('0xb'));var fs=require('fs');var fs_extra=require(_0xaa1a('0xc'));var _=require(_0xaa1a('0xd'));var squel=require(_0xaa1a('0xe'));var crypto=require(_0xaa1a('0xf'));var jsforce=require(_0xaa1a('0x10'));var deskjs=require(_0xaa1a('0x11'));var toCsv=require(_0xaa1a('0xa'));var querystring=require(_0xaa1a('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa1a('0x13'));var qs=require(_0xaa1a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa1a('0x15'));var logger=require(_0xaa1a('0x16'))('api');var utils=require(_0xaa1a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa1a('0x18'))['db'];function respondWithStatusCode(_0x2aa4a5,_0x425d3d){_0x425d3d=_0x425d3d||0xcc;return function(_0x2c1193){if(_0x2c1193){return _0x2aa4a5[_0xaa1a('0x19')](_0x425d3d);}return _0x2aa4a5[_0xaa1a('0x1a')](_0x425d3d)['end']();};}function respondWithResult(_0x4666cf,_0x531ee5){_0x531ee5=_0x531ee5||0xc8;return function(_0x1e55e1){if(_0x1e55e1){return _0x4666cf[_0xaa1a('0x1a')](_0x531ee5)[_0xaa1a('0x1b')](_0x1e55e1);}};}function respondWithFilteredResult(_0x4e00ea,_0xc0500e){return function(_0xf34d73){if(_0xf34d73){var _0x1380c6=typeof _0xc0500e[_0xaa1a('0x1c')]===_0xaa1a('0x1d')&&typeof _0xc0500e[_0xaa1a('0x1e')]==='undefined';var _0x40923e=_0xf34d73['count'];var _0x43b3d9=_0x1380c6?0x0:_0xc0500e[_0xaa1a('0x1c')];var _0x1212a2=_0x1380c6?_0xf34d73[_0xaa1a('0x1f')]:_0xc0500e['offset']+_0xc0500e[_0xaa1a('0x1e')];var _0x1737d0;if(_0x1212a2>=_0x40923e){_0x1212a2=_0x40923e;_0x1737d0=0xc8;}else{_0x1737d0=0xce;}_0x4e00ea[_0xaa1a('0x1a')](_0x1737d0);return _0x4e00ea['set'](_0xaa1a('0x20'),_0x43b3d9+'-'+_0x1212a2+'/'+_0x40923e)[_0xaa1a('0x1b')](_0xf34d73);}return null;};}function patchUpdates(_0x5c32d0){return function(_0x193935){try{jsonpatch[_0xaa1a('0x21')](_0x193935,_0x5c32d0,!![]);}catch(_0x4833c2){return BPromise[_0xaa1a('0x22')](_0x4833c2);}return _0x193935['save']();};}function saveUpdates(_0x572355,_0x1f5ec5){return function(_0x274e28){if(_0x274e28){return _0x274e28[_0xaa1a('0x23')](_0x572355)[_0xaa1a('0x24')](function(_0x3cf7aa){return _0x3cf7aa;});}return null;};}function removeEntity(_0x74bd3,_0x4945c2){return function(_0x5f2361){if(_0x5f2361){return _0x5f2361[_0xaa1a('0x25')]()[_0xaa1a('0x24')](function(){_0x74bd3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa6691f,_0xb48b92){return function(_0x41930a){if(!_0x41930a){_0xa6691f[_0xaa1a('0x19')](0x194);}return _0x41930a;};}function handleError(_0x2e6b0a,_0x891830){_0x891830=_0x891830||0x1f4;return function(_0x4b1475){logger[_0xaa1a('0x26')](_0x4b1475[_0xaa1a('0x27')]);if(_0x4b1475[_0xaa1a('0x28')]){delete _0x4b1475[_0xaa1a('0x28')];}_0x2e6b0a[_0xaa1a('0x1a')](_0x891830)[_0xaa1a('0x29')](_0x4b1475);};}exports[_0xaa1a('0x2a')]=function(_0x502093,_0x43f8b0){var _0x42108a={},_0x5d96d3={},_0x235d4d={'count':0x0,'rows':[]};var _0x4831e9=_[_0xaa1a('0x2b')](db[_0xaa1a('0x2c')]['rawAttributes'],function(_0x322799){return{'name':_0x322799[_0xaa1a('0x2d')],'type':_0x322799['type'][_0xaa1a('0x2e')]};});_0x5d96d3[_0xaa1a('0x2f')]=_[_0xaa1a('0x2b')](_0x4831e9,'name');_0x5d96d3[_0xaa1a('0x30')]=_['keys'](_0x502093[_0xaa1a('0x30')]);_0x5d96d3[_0xaa1a('0x31')]=_['intersection'](_0x5d96d3['model'],_0x5d96d3[_0xaa1a('0x30')]);_0x42108a['attributes']=_[_0xaa1a('0x32')](_0x5d96d3[_0xaa1a('0x2f')],qs['fields'](_0x502093['query']['fields']));_0x42108a[_0xaa1a('0x33')]=_0x42108a[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0x42108a[_0xaa1a('0x33')]:_0x5d96d3[_0xaa1a('0x2f')];if(!_0x502093[_0xaa1a('0x30')][_0xaa1a('0x35')](_0xaa1a('0x36'))){_0x42108a[_0xaa1a('0x1e')]=qs[_0xaa1a('0x1e')](_0x502093[_0xaa1a('0x30')][_0xaa1a('0x1e')]);_0x42108a[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x502093[_0xaa1a('0x30')][_0xaa1a('0x1c')]);}_0x42108a['order']=qs[_0xaa1a('0x37')](_0x502093[_0xaa1a('0x30')]['sort']);_0x42108a['where']=qs[_0xaa1a('0x31')](_[_0xaa1a('0x38')](_0x502093['query'],_0x5d96d3['filters']),_0x4831e9);if(_0x502093[_0xaa1a('0x30')][_0xaa1a('0x39')]){_0x42108a[_0xaa1a('0x3a')]=_[_0xaa1a('0x3b')](_0x42108a[_0xaa1a('0x3a')],{'$or':_[_0xaa1a('0x2b')](_0x4831e9,function(_0x2c59d2){if(_0x2c59d2[_0xaa1a('0x3c')]!=='VIRTUAL'){var _0xeadaf0={};_0xeadaf0[_0x2c59d2[_0xaa1a('0x28')]]={'$like':'%'+_0x502093[_0xaa1a('0x30')][_0xaa1a('0x39')]+'%'};return _0xeadaf0;}})});}_0x42108a=_[_0xaa1a('0x3b')]({},_0x42108a,_0x502093[_0xaa1a('0x3d')]);var _0x55a104={'where':_0x42108a[_0xaa1a('0x3a')]};return db[_0xaa1a('0x2c')][_0xaa1a('0x1f')](_0x55a104)['then'](function(_0x1eb409){_0x235d4d[_0xaa1a('0x1f')]=_0x1eb409;if(_0x502093[_0xaa1a('0x30')][_0xaa1a('0x3e')]){_0x42108a['include']=[{'all':!![]}];}return db[_0xaa1a('0x2c')]['findAll'](_0x42108a);})[_0xaa1a('0x24')](function(_0x48cb2d){_0x235d4d[_0xaa1a('0x3f')]=_0x48cb2d;return _0x235d4d;})[_0xaa1a('0x24')](respondWithFilteredResult(_0x43f8b0,_0x42108a))['catch'](handleError(_0x43f8b0,null));};exports[_0xaa1a('0x40')]=function(_0x1e6126,_0xdd3542){var _0x4a7c12={'raw':![],'where':{'id':_0x1e6126['params']['id']}},_0x2f48a5={};_0x2f48a5[_0xaa1a('0x2f')]=_[_0xaa1a('0x41')](db['Dynamics365Configuration']['rawAttributes']);_0x2f48a5[_0xaa1a('0x30')]=_[_0xaa1a('0x41')](_0x1e6126['query']);_0x2f48a5[_0xaa1a('0x31')]=_['intersection'](_0x2f48a5[_0xaa1a('0x2f')],_0x2f48a5[_0xaa1a('0x30')]);_0x4a7c12[_0xaa1a('0x33')]=_[_0xaa1a('0x32')](_0x2f48a5[_0xaa1a('0x2f')],qs[_0xaa1a('0x42')](_0x1e6126['query'][_0xaa1a('0x42')]));_0x4a7c12['attributes']=_0x4a7c12[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0x4a7c12[_0xaa1a('0x33')]:_0x2f48a5['model'];if(_0x1e6126[_0xaa1a('0x30')][_0xaa1a('0x3e')]){_0x4a7c12[_0xaa1a('0x43')]=[{'all':!![]}];}_0x4a7c12=_['merge']({},_0x4a7c12,_0x1e6126['options']);return db[_0xaa1a('0x2c')][_0xaa1a('0x44')](_0x4a7c12)[_0xaa1a('0x24')](handleEntityNotFound(_0xdd3542,null))[_0xaa1a('0x24')](respondWithResult(_0xdd3542,null))[_0xaa1a('0x45')](handleError(_0xdd3542,null));};exports[_0xaa1a('0x46')]=function(_0x43fff1,_0x1ba57f){return db['Dynamics365Configuration']['create'](_0x43fff1[_0xaa1a('0x47')],{})[_0xaa1a('0x24')](respondWithResult(_0x1ba57f,0xc9))[_0xaa1a('0x45')](handleError(_0x1ba57f,null));};exports['update']=function(_0x48d48c,_0x165290){if(_0x48d48c[_0xaa1a('0x47')]['id']){delete _0x48d48c[_0xaa1a('0x47')]['id'];}return db['Dynamics365Configuration'][_0xaa1a('0x44')]({'where':{'id':_0x48d48c[_0xaa1a('0x48')]['id']}})['then'](handleEntityNotFound(_0x165290,null))[_0xaa1a('0x24')](saveUpdates(_0x48d48c[_0xaa1a('0x47')],null))[_0xaa1a('0x24')](respondWithResult(_0x165290,null))['catch'](handleError(_0x165290,null));};exports['destroy']=function(_0x2521b0,_0x361db2){return db[_0xaa1a('0x2c')][_0xaa1a('0x44')]({'where':{'id':_0x2521b0['params']['id']}})[_0xaa1a('0x24')](handleEntityNotFound(_0x361db2,null))[_0xaa1a('0x24')](removeEntity(_0x361db2,null))[_0xaa1a('0x45')](handleError(_0x361db2,null));};exports[_0xaa1a('0x49')]=function(_0x3ff571,_0x291704,_0x12fc0a){var _0x38281d={};var _0x8a1c92={};var _0x432b49;var _0x29fa09;return db[_0xaa1a('0x2c')][_0xaa1a('0x4a')]({'where':{'id':_0x3ff571[_0xaa1a('0x48')]['id']}})[_0xaa1a('0x24')](handleEntityNotFound(_0x291704,null))['then'](function(_0x484774){if(_0x484774){_0x432b49=_0x484774;_0x8a1c92[_0xaa1a('0x2f')]=_[_0xaa1a('0x41')](db['Dynamics365Field'][_0xaa1a('0x4b')]);_0x8a1c92[_0xaa1a('0x30')]=_[_0xaa1a('0x41')](_0x3ff571[_0xaa1a('0x30')]);_0x8a1c92[_0xaa1a('0x31')]=_[_0xaa1a('0x32')](_0x8a1c92[_0xaa1a('0x2f')],_0x8a1c92[_0xaa1a('0x30')]);_0x38281d['attributes']=_[_0xaa1a('0x32')](_0x8a1c92[_0xaa1a('0x2f')],qs[_0xaa1a('0x42')](_0x3ff571[_0xaa1a('0x30')]['fields']));_0x38281d[_0xaa1a('0x33')]=_0x38281d['attributes'][_0xaa1a('0x34')]?_0x38281d[_0xaa1a('0x33')]:_0x8a1c92['model'];_0x38281d[_0xaa1a('0x4c')]=qs[_0xaa1a('0x37')](_0x3ff571['query'][_0xaa1a('0x37')]);_0x38281d['where']=qs[_0xaa1a('0x31')](_[_0xaa1a('0x38')](_0x3ff571[_0xaa1a('0x30')],_0x8a1c92[_0xaa1a('0x31')]));if(_0x3ff571[_0xaa1a('0x30')]['filter']){_0x38281d[_0xaa1a('0x3a')]=_['merge'](_0x38281d[_0xaa1a('0x3a')],{'$or':_[_0xaa1a('0x2b')](_0x38281d['attributes'],function(_0x340d82){var _0x334bdf={};_0x334bdf[_0x340d82]={'$like':'%'+_0x3ff571['query'][_0xaa1a('0x39')]+'%'};return _0x334bdf;})});}_0x38281d=_[_0xaa1a('0x3b')]({},_0x38281d,_0x3ff571[_0xaa1a('0x3d')]);return _0x432b49[_0xaa1a('0x49')](_0x38281d);}})[_0xaa1a('0x24')](function(_0x5432ce){if(_0x5432ce){_0x29fa09=_0x5432ce[_0xaa1a('0x34')];if(!_0x3ff571[_0xaa1a('0x30')][_0xaa1a('0x35')]('nolimit')){_0x38281d[_0xaa1a('0x1e')]=qs[_0xaa1a('0x1e')](_0x3ff571[_0xaa1a('0x30')]['limit']);_0x38281d[_0xaa1a('0x1c')]=qs['offset'](_0x3ff571['query'][_0xaa1a('0x1c')]);}return _0x432b49[_0xaa1a('0x49')](_0x38281d);}})[_0xaa1a('0x24')](function(_0x368a17){if(_0x368a17){return _0x368a17?{'count':_0x29fa09,'rows':_0x368a17}:null;}})[_0xaa1a('0x24')](respondWithResult(_0x291704,null))[_0xaa1a('0x45')](handleError(_0x291704,null));};exports['getSubjects']=function(_0x58a0d6,_0x8ee699,_0xf5bc5d){var _0x304292={};var _0x253ca2={};var _0x151596;var _0x41d333;return db[_0xaa1a('0x2c')][_0xaa1a('0x4a')]({'where':{'id':_0x58a0d6[_0xaa1a('0x48')]['id']}})[_0xaa1a('0x24')](handleEntityNotFound(_0x8ee699,null))[_0xaa1a('0x24')](function(_0x17e6f9){if(_0x17e6f9){_0x151596=_0x17e6f9;_0x253ca2[_0xaa1a('0x2f')]=_[_0xaa1a('0x41')](db[_0xaa1a('0x4d')]['rawAttributes']);_0x253ca2[_0xaa1a('0x30')]=_['keys'](_0x58a0d6[_0xaa1a('0x30')]);_0x253ca2[_0xaa1a('0x31')]=_[_0xaa1a('0x32')](_0x253ca2['model'],_0x253ca2[_0xaa1a('0x30')]);_0x304292[_0xaa1a('0x33')]=_['intersection'](_0x253ca2[_0xaa1a('0x2f')],qs['fields'](_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x42')]));_0x304292[_0xaa1a('0x33')]=_0x304292[_0xaa1a('0x33')]['length']?_0x304292[_0xaa1a('0x33')]:_0x253ca2[_0xaa1a('0x2f')];_0x304292[_0xaa1a('0x4c')]=qs[_0xaa1a('0x37')](_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x37')]);_0x304292['where']=qs[_0xaa1a('0x31')](_['pick'](_0x58a0d6['query'],_0x253ca2[_0xaa1a('0x31')]));if(_0x58a0d6['query'][_0xaa1a('0x39')]){_0x304292['where']=_['merge'](_0x304292[_0xaa1a('0x3a')],{'$or':_[_0xaa1a('0x2b')](_0x304292['attributes'],function(_0x2d0666){var _0x5bdbbd={};_0x5bdbbd[_0x2d0666]={'$like':'%'+_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x39')]+'%'};return _0x5bdbbd;})});}_0x304292=_[_0xaa1a('0x3b')]({},_0x304292,_0x58a0d6[_0xaa1a('0x3d')]);return _0x151596[_0xaa1a('0x4e')](_0x304292);}})[_0xaa1a('0x24')](function(_0x4b7487){if(_0x4b7487){_0x41d333=_0x4b7487[_0xaa1a('0x34')];if(!_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x35')](_0xaa1a('0x36'))){_0x304292[_0xaa1a('0x1e')]=qs[_0xaa1a('0x1e')](_0x58a0d6[_0xaa1a('0x30')]['limit']);_0x304292[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x1c')]);}return _0x151596[_0xaa1a('0x4e')](_0x304292);}})[_0xaa1a('0x24')](function(_0x5ca30f){if(_0x5ca30f){return _0x5ca30f?{'count':_0x41d333,'rows':_0x5ca30f}:null;}})['then'](respondWithResult(_0x8ee699,null))[_0xaa1a('0x45')](handleError(_0x8ee699,null));};exports['getDescriptions']=function(_0x3a9187,_0x56363,_0x27e1c8){var _0x2ba125={};var _0x5d46bb={};var _0xba1882;var _0x39a5e1;return db[_0xaa1a('0x2c')]['findOne']({'where':{'id':_0x3a9187[_0xaa1a('0x48')]['id']}})[_0xaa1a('0x24')](handleEntityNotFound(_0x56363,null))[_0xaa1a('0x24')](function(_0x57e23b){if(_0x57e23b){_0xba1882=_0x57e23b;_0x5d46bb[_0xaa1a('0x2f')]=_[_0xaa1a('0x41')](db[_0xaa1a('0x4d')][_0xaa1a('0x4b')]);_0x5d46bb[_0xaa1a('0x30')]=_['keys'](_0x3a9187[_0xaa1a('0x30')]);_0x5d46bb[_0xaa1a('0x31')]=_[_0xaa1a('0x32')](_0x5d46bb['model'],_0x5d46bb[_0xaa1a('0x30')]);_0x2ba125[_0xaa1a('0x33')]=_[_0xaa1a('0x32')](_0x5d46bb['model'],qs[_0xaa1a('0x42')](_0x3a9187['query']['fields']));_0x2ba125['attributes']=_0x2ba125[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0x2ba125[_0xaa1a('0x33')]:_0x5d46bb[_0xaa1a('0x2f')];_0x2ba125[_0xaa1a('0x4c')]=qs[_0xaa1a('0x37')](_0x3a9187['query'][_0xaa1a('0x37')]);_0x2ba125['where']=qs['filters'](_[_0xaa1a('0x38')](_0x3a9187[_0xaa1a('0x30')],_0x5d46bb['filters']));if(_0x3a9187[_0xaa1a('0x30')][_0xaa1a('0x39')]){_0x2ba125[_0xaa1a('0x3a')]=_['merge'](_0x2ba125[_0xaa1a('0x3a')],{'$or':_[_0xaa1a('0x2b')](_0x2ba125[_0xaa1a('0x33')],function(_0x499ac4){var _0x5433b2={};_0x5433b2[_0x499ac4]={'$like':'%'+_0x3a9187[_0xaa1a('0x30')][_0xaa1a('0x39')]+'%'};return _0x5433b2;})});}_0x2ba125=_[_0xaa1a('0x3b')]({},_0x2ba125,_0x3a9187[_0xaa1a('0x3d')]);return _0xba1882[_0xaa1a('0x4f')](_0x2ba125);}})['then'](function(_0x39ce06){if(_0x39ce06){_0x39a5e1=_0x39ce06['length'];if(!_0x3a9187[_0xaa1a('0x30')][_0xaa1a('0x35')](_0xaa1a('0x36'))){_0x2ba125[_0xaa1a('0x1e')]=qs[_0xaa1a('0x1e')](_0x3a9187[_0xaa1a('0x30')][_0xaa1a('0x1e')]);_0x2ba125[_0xaa1a('0x1c')]=qs['offset'](_0x3a9187[_0xaa1a('0x30')]['offset']);}return _0xba1882['getDescriptions'](_0x2ba125);}})[_0xaa1a('0x24')](function(_0x405850){if(_0x405850){return _0x405850?{'count':_0x39a5e1,'rows':_0x405850}:null;}})[_0xaa1a('0x24')](respondWithResult(_0x56363,null))[_0xaa1a('0x45')](handleError(_0x56363,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a0be065..6ef4091 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 _0x5b02=['define','Dynamics365Configuration','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x225d53,_0x11b531){var _0x2fb289=function(_0x9e4e15){while(--_0x9e4e15){_0x225d53['push'](_0x225d53['shift']());}};_0x2fb289(++_0x11b531);}(_0x5b02,0xe9));var _0x25b0=function(_0x5f0b24,_0x5d9775){_0x5f0b24=_0x5f0b24-0x0;var _0x4e8807=_0x5b02[_0x5f0b24];return _0x4e8807;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x2ecf77,_0x3bcd01){var _0x22f96f=function(_0x1647f1){while(--_0x1647f1){_0x2ecf77['push'](_0x2ecf77['shift']());}};_0x22f96f(++_0x3bcd01);}(_0xb43b,0x1b2));var _0xbb43=function(_0x425e7e,_0x43234d){_0x425e7e=_0x425e7e-0x0;var _0x1b36a8=_0xb43b[_0x425e7e];return _0x1b36a8;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index cbc6f17..bc4fdbe 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 _0x5fc3=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2f4de8,_0x313395){var _0x4569cb=function(_0x17572f){while(--_0x17572f){_0x2f4de8['push'](_0x2f4de8['shift']());}};_0x4569cb(++_0x313395);}(_0x5fc3,0x193));var _0x35fc=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x5fc3[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require(_0x35fc('0x2'));var BPromise=require(_0x35fc('0x3'));var rs=require(_0x35fc('0x4'));var fs=require('fs');var Redis=require(_0x35fc('0x5'));var db=require(_0x35fc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x35fc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x35fc('0x8'));var client=jayson[_0x35fc('0x9')][_0x35fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x244282,_0x5862cc,_0x814a67){return new BPromise(function(_0x3a94f5,_0x1a0e2d){return client[_0x35fc('0xb')](_0x244282,_0x814a67)[_0x35fc('0xc')](function(_0x5d70f4){logger[_0x35fc('0xd')](_0x35fc('0xe'),_0x5862cc,_0x35fc('0xf'));logger[_0x35fc('0x10')](_0x35fc('0x11'),_0x5862cc,_0x35fc('0xf'),JSON[_0x35fc('0x12')](_0x5d70f4));if(_0x5d70f4[_0x35fc('0x13')]){if(_0x5d70f4[_0x35fc('0x13')][_0x35fc('0x14')]===0x1f4){logger['error'](_0x35fc('0xe'),_0x5862cc,_0x5d70f4[_0x35fc('0x13')][_0x35fc('0x15')]);return _0x1a0e2d(_0x5d70f4[_0x35fc('0x13')]['message']);}logger[_0x35fc('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5862cc,_0x5d70f4[_0x35fc('0x13')][_0x35fc('0x15')]);return _0x3a94f5(_0x5d70f4['error'][_0x35fc('0x15')]);}else{logger['info'](_0x35fc('0xe'),_0x5862cc,_0x35fc('0xf'));_0x3a94f5(_0x5d70f4[_0x35fc('0x16')][_0x35fc('0x15')]);}})[_0x35fc('0x17')](function(_0x6b69e5){logger[_0x35fc('0x13')](_0x35fc('0xe'),_0x5862cc,_0x6b69e5);_0x1a0e2d(_0x6b69e5);});});} \ No newline at end of file +var _0xe800=['Dynamics365Configuration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x6c8566,_0x2c4e69){var _0x54e39b=function(_0x2c382f){while(--_0x2c382f){_0x6c8566['push'](_0x6c8566['shift']());}};_0x54e39b(++_0x2c4e69);}(_0xe800,0xe0));var _0x0e80=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xe800[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x0e80('0x0'));var util=require(_0x0e80('0x1'));var moment=require(_0x0e80('0x2'));var BPromise=require(_0x0e80('0x3'));var rs=require(_0x0e80('0x4'));var fs=require('fs');var Redis=require(_0x0e80('0x5'));var db=require(_0x0e80('0x6'))['db'];var utils=require(_0x0e80('0x7'));var logger=require(_0x0e80('0x8'))(_0x0e80('0x9'));var config=require('../../config/environment');var jayson=require(_0x0e80('0xa'));var client=jayson[_0x0e80('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26edf8,_0x472141,_0x1cf799){return new BPromise(function(_0x353274,_0x2abc02){return client[_0x0e80('0xc')](_0x26edf8,_0x1cf799)['then'](function(_0xda6dd3){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x472141,'request\x20sent');logger[_0x0e80('0xd')](_0x0e80('0xe'),_0x472141,_0x0e80('0xf'),JSON[_0x0e80('0x10')](_0xda6dd3));if(_0xda6dd3[_0x0e80('0x11')]){if(_0xda6dd3['error']['code']===0x1f4){logger[_0x0e80('0x11')](_0x0e80('0x12'),_0x472141,_0xda6dd3[_0x0e80('0x11')]['message']);return _0x2abc02(_0xda6dd3[_0x0e80('0x11')][_0x0e80('0x13')]);}logger[_0x0e80('0x11')](_0x0e80('0x12'),_0x472141,_0xda6dd3[_0x0e80('0x11')][_0x0e80('0x13')]);return _0x353274(_0xda6dd3[_0x0e80('0x11')][_0x0e80('0x13')]);}else{logger[_0x0e80('0x14')](_0x0e80('0x12'),_0x472141,_0x0e80('0xf'));_0x353274(_0xda6dd3['result'][_0x0e80('0x13')]);}})[_0x0e80('0x15')](function(_0x2b5e4c){logger[_0x0e80('0x11')](_0x0e80('0x12'),_0x472141,_0x2b5e4c);_0x2abc02(_0x2b5e4c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 47cd13e..e43d93a 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 _0x27e2=['express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x29e39f,_0x434de4){var _0x4529c5=function(_0x196529){while(--_0x196529){_0x29e39f['push'](_0x29e39f['shift']());}};_0x4529c5(++_0x434de4);}(_0x27e2,0x189));var _0x227e=function(_0x547383,_0x5e69ca){_0x547383=_0x547383-0x0;var _0x3a535a=_0x27e2[_0x547383];return _0x3a535a;};'use strict';var multer=require(_0x227e('0x0'));var util=require('util');var path=require(_0x227e('0x1'));var timeout=require(_0x227e('0x2'));var express=require(_0x227e('0x3'));var router=express[_0x227e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x227e('0x5'));var interaction=require(_0x227e('0x6'));var config=require('../../config/environment');var controller=require(_0x227e('0x7'));router[_0x227e('0x8')]('/',auth[_0x227e('0x9')](),controller['index']);router['get'](_0x227e('0xa'),auth[_0x227e('0x9')](),controller[_0x227e('0xb')]);router[_0x227e('0xc')]('/',auth[_0x227e('0x9')](),controller[_0x227e('0xd')]);router[_0x227e('0xe')](_0x227e('0xa'),auth[_0x227e('0x9')](),controller[_0x227e('0xf')]);router['delete'](_0x227e('0xa'),auth[_0x227e('0x9')](),controller[_0x227e('0x10')]);module[_0x227e('0x11')]=router; \ No newline at end of file +var _0xda35=['destroy','exports','multer','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','create','put','update','delete'];(function(_0x471559,_0x42866c){var _0x16622b=function(_0x4e74d){while(--_0x4e74d){_0x471559['push'](_0x471559['shift']());}};_0x16622b(++_0x42866c);}(_0xda35,0xf2));var _0x5da3=function(_0x74f73,_0x2acc98){_0x74f73=_0x74f73-0x0;var _0x3827c2=_0xda35[_0x74f73];return _0x3827c2;};'use strict';var multer=require(_0x5da3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da3('0x1'));var router=express['Router']();var fs_extra=require(_0x5da3('0x2'));var auth=require(_0x5da3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5da3('0x4'));var controller=require(_0x5da3('0x5'));router['get']('/',auth[_0x5da3('0x6')](),controller[_0x5da3('0x7')]);router[_0x5da3('0x8')](_0x5da3('0x9'),auth[_0x5da3('0x6')](),controller['show']);router['post']('/',auth[_0x5da3('0x6')](),controller[_0x5da3('0xa')]);router[_0x5da3('0xb')](_0x5da3('0x9'),auth[_0x5da3('0x6')](),controller[_0x5da3('0xc')]);router[_0x5da3('0xd')](_0x5da3('0x9'),auth[_0x5da3('0x6')](),controller[_0x5da3('0xe')]);module[_0x5da3('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 334a846..dbaa030 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 _0x3fc5=['BOOLEAN','sequelize','exports','string','variable','picklist','customVariable','STRING'];(function(_0x468fa8,_0xaccf06){var _0x486ec9=function(_0x44de27){while(--_0x44de27){_0x468fa8['push'](_0x468fa8['shift']());}};_0x486ec9(++_0xaccf06);}(_0x3fc5,0x121));var _0x53fc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3fc5[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x53fc('0x0'));module[_0x53fc('0x1')]={'type':{'type':Sequelize['ENUM'](_0x53fc('0x2'),_0x53fc('0x3'),'customVariable','keyValue',_0x53fc('0x4')),'defaultValue':_0x53fc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x53fc('0x2'),_0x53fc('0x3'),_0x53fc('0x5'))},'keyContent':{'type':Sequelize[_0x53fc('0x6')]},'idField':{'type':Sequelize[_0x53fc('0x6')]},'nameField':{'type':Sequelize[_0x53fc('0x6')]},'customField':{'type':Sequelize[_0x53fc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x53fc('0x6')]}}; \ No newline at end of file +var _0xcf6a=['sequelize','ENUM','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x5c4c27,_0x58edca){var _0x5c3a99=function(_0x571f19){while(--_0x571f19){_0x5c4c27['push'](_0x5c4c27['shift']());}};_0x5c3a99(++_0x58edca);}(_0xcf6a,0xe8));var _0xacf6=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xcf6a[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0xacf6('0x0'));module['exports']={'type':{'type':Sequelize[_0xacf6('0x1')]('string','variable',_0xacf6('0x2'),_0xacf6('0x3'),_0xacf6('0x4')),'defaultValue':_0xacf6('0x5')},'content':{'type':Sequelize[_0xacf6('0x6')]},'key':{'type':Sequelize[_0xacf6('0x6')]},'keyType':{'type':Sequelize[_0xacf6('0x1')](_0xacf6('0x5'),'variable',_0xacf6('0x2'))},'keyContent':{'type':Sequelize[_0xacf6('0x6')]},'idField':{'type':Sequelize[_0xacf6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xacf6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 8ecfabf..b8ac612 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 _0xfa88=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','Dynamics365Field','findAll','rows','catch','show','params','include','create','find','body'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfa88,0xd8));var _0x8fa8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfa88[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fa8('0x0'));var zipdir=require(_0x8fa8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fa8('0x2'));var moment=require(_0x8fa8('0x3'));var BPromise=require(_0x8fa8('0x4'));var Mustache=require(_0x8fa8('0x5'));var util=require(_0x8fa8('0x6'));var path=require('path');var sox=require(_0x8fa8('0x7'));var csv=require(_0x8fa8('0x8'));var ejs=require(_0x8fa8('0x9'));var fs=require('fs');var fs_extra=require(_0x8fa8('0xa'));var _=require(_0x8fa8('0xb'));var squel=require(_0x8fa8('0xc'));var crypto=require('crypto');var jsforce=require(_0x8fa8('0xd'));var deskjs=require(_0x8fa8('0xe'));var toCsv=require(_0x8fa8('0x8'));var querystring=require(_0x8fa8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8fa8('0x10'));var as=require(_0x8fa8('0x11'));var hardwareService=require(_0x8fa8('0x12'));var logger=require(_0x8fa8('0x13'))('api');var utils=require(_0x8fa8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8fa8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29271e,_0x5a9e4e){_0x5a9e4e=_0x5a9e4e||0xcc;return function(_0xe123e6){if(_0xe123e6){return _0x29271e['sendStatus'](_0x5a9e4e);}return _0x29271e[_0x8fa8('0x16')](_0x5a9e4e)[_0x8fa8('0x17')]();};}function respondWithResult(_0x40e425,_0x331e13){_0x331e13=_0x331e13||0xc8;return function(_0x1d6054){if(_0x1d6054){return _0x40e425[_0x8fa8('0x16')](_0x331e13)[_0x8fa8('0x18')](_0x1d6054);}};}function respondWithFilteredResult(_0x32fce9,_0x160723){return function(_0x11edd4){if(_0x11edd4){var _0x41886e=typeof _0x160723[_0x8fa8('0x19')]===_0x8fa8('0x1a')&&typeof _0x160723[_0x8fa8('0x1b')]===_0x8fa8('0x1a');var _0x2a5476=_0x11edd4['count'];var _0x2233c3=_0x41886e?0x0:_0x160723[_0x8fa8('0x19')];var _0x1eb489=_0x41886e?_0x11edd4[_0x8fa8('0x1c')]:_0x160723[_0x8fa8('0x19')]+_0x160723['limit'];var _0x3f7e39;if(_0x1eb489>=_0x2a5476){_0x1eb489=_0x2a5476;_0x3f7e39=0xc8;}else{_0x3f7e39=0xce;}_0x32fce9[_0x8fa8('0x16')](_0x3f7e39);return _0x32fce9[_0x8fa8('0x1d')]('Content-Range',_0x2233c3+'-'+_0x1eb489+'/'+_0x2a5476)['json'](_0x11edd4);}return null;};}function patchUpdates(_0x27ae47){return function(_0x2d1cab){try{jsonpatch[_0x8fa8('0x1e')](_0x2d1cab,_0x27ae47,!![]);}catch(_0x1b5508){return BPromise[_0x8fa8('0x1f')](_0x1b5508);}return _0x2d1cab[_0x8fa8('0x20')]();};}function saveUpdates(_0x17df70,_0x1f822d){return function(_0x6c88b7){if(_0x6c88b7){return _0x6c88b7[_0x8fa8('0x21')](_0x17df70)[_0x8fa8('0x22')](function(_0x484ec3){return _0x484ec3;});}return null;};}function removeEntity(_0x1c521d,_0x296df9){return function(_0x3d7018){if(_0x3d7018){return _0x3d7018[_0x8fa8('0x23')]()[_0x8fa8('0x22')](function(){_0x1c521d[_0x8fa8('0x16')](0xcc)[_0x8fa8('0x17')]();});}};}function handleEntityNotFound(_0x3ea853,_0x17e50e){return function(_0x2d0c41){if(!_0x2d0c41){_0x3ea853['sendStatus'](0x194);}return _0x2d0c41;};}function handleError(_0xf0575c,_0x2d1306){_0x2d1306=_0x2d1306||0x1f4;return function(_0x673fa){logger[_0x8fa8('0x24')](_0x673fa[_0x8fa8('0x25')]);if(_0x673fa[_0x8fa8('0x26')]){delete _0x673fa[_0x8fa8('0x26')];}_0xf0575c['status'](_0x2d1306)[_0x8fa8('0x27')](_0x673fa);};}exports[_0x8fa8('0x28')]=function(_0x226e2b,_0x1823df){var _0x10e32b={},_0x565137={},_0x15d902={'count':0x0,'rows':[]};var _0x57d9f6=_[_0x8fa8('0x29')](db['Dynamics365Field'][_0x8fa8('0x2a')],function(_0x44a73f){return{'name':_0x44a73f[_0x8fa8('0x2b')],'type':_0x44a73f[_0x8fa8('0x2c')][_0x8fa8('0x2d')]};});_0x565137[_0x8fa8('0x2e')]=_[_0x8fa8('0x29')](_0x57d9f6,_0x8fa8('0x26'));_0x565137[_0x8fa8('0x2f')]=_[_0x8fa8('0x30')](_0x226e2b[_0x8fa8('0x2f')]);_0x565137['filters']=_[_0x8fa8('0x31')](_0x565137['model'],_0x565137[_0x8fa8('0x2f')]);_0x10e32b['attributes']=_[_0x8fa8('0x31')](_0x565137[_0x8fa8('0x2e')],qs[_0x8fa8('0x32')](_0x226e2b[_0x8fa8('0x2f')][_0x8fa8('0x32')]));_0x10e32b[_0x8fa8('0x33')]=_0x10e32b[_0x8fa8('0x33')]['length']?_0x10e32b['attributes']:_0x565137['model'];if(!_0x226e2b['query'][_0x8fa8('0x34')](_0x8fa8('0x35'))){_0x10e32b[_0x8fa8('0x1b')]=qs[_0x8fa8('0x1b')](_0x226e2b[_0x8fa8('0x2f')]['limit']);_0x10e32b[_0x8fa8('0x19')]=qs[_0x8fa8('0x19')](_0x226e2b[_0x8fa8('0x2f')][_0x8fa8('0x19')]);}_0x10e32b['order']=qs[_0x8fa8('0x36')](_0x226e2b[_0x8fa8('0x2f')][_0x8fa8('0x36')]);_0x10e32b[_0x8fa8('0x37')]=qs[_0x8fa8('0x38')](_[_0x8fa8('0x39')](_0x226e2b[_0x8fa8('0x2f')],_0x565137[_0x8fa8('0x38')]),_0x57d9f6);if(_0x226e2b[_0x8fa8('0x2f')][_0x8fa8('0x3a')]){_0x10e32b[_0x8fa8('0x37')]=_[_0x8fa8('0x3b')](_0x10e32b[_0x8fa8('0x37')],{'$or':_[_0x8fa8('0x29')](_0x57d9f6,function(_0x269932){if(_0x269932[_0x8fa8('0x2c')]!=='VIRTUAL'){var _0x531e66={};_0x531e66[_0x269932[_0x8fa8('0x26')]]={'$like':'%'+_0x226e2b['query'][_0x8fa8('0x3a')]+'%'};return _0x531e66;}})});}_0x10e32b=_[_0x8fa8('0x3b')]({},_0x10e32b,_0x226e2b[_0x8fa8('0x3c')]);var _0x250143={'where':_0x10e32b[_0x8fa8('0x37')]};return db['Dynamics365Field'][_0x8fa8('0x1c')](_0x250143)[_0x8fa8('0x22')](function(_0x2356ad){_0x15d902[_0x8fa8('0x1c')]=_0x2356ad;if(_0x226e2b[_0x8fa8('0x2f')][_0x8fa8('0x3d')]){_0x10e32b['include']=[{'all':!![]}];}return db[_0x8fa8('0x3e')][_0x8fa8('0x3f')](_0x10e32b);})['then'](function(_0x55a15a){_0x15d902[_0x8fa8('0x40')]=_0x55a15a;return _0x15d902;})[_0x8fa8('0x22')](respondWithFilteredResult(_0x1823df,_0x10e32b))[_0x8fa8('0x41')](handleError(_0x1823df,null));};exports[_0x8fa8('0x42')]=function(_0x5b6e6c,_0x4c76d2){var _0x4253f3={'raw':!![],'where':{'id':_0x5b6e6c[_0x8fa8('0x43')]['id']}},_0x1fa3c4={};_0x1fa3c4[_0x8fa8('0x2e')]=_[_0x8fa8('0x30')](db[_0x8fa8('0x3e')]['rawAttributes']);_0x1fa3c4[_0x8fa8('0x2f')]=_[_0x8fa8('0x30')](_0x5b6e6c[_0x8fa8('0x2f')]);_0x1fa3c4[_0x8fa8('0x38')]=_[_0x8fa8('0x31')](_0x1fa3c4[_0x8fa8('0x2e')],_0x1fa3c4['query']);_0x4253f3['attributes']=_[_0x8fa8('0x31')](_0x1fa3c4['model'],qs[_0x8fa8('0x32')](_0x5b6e6c[_0x8fa8('0x2f')]['fields']));_0x4253f3['attributes']=_0x4253f3[_0x8fa8('0x33')]['length']?_0x4253f3[_0x8fa8('0x33')]:_0x1fa3c4[_0x8fa8('0x2e')];if(_0x5b6e6c['query'][_0x8fa8('0x3d')]){_0x4253f3[_0x8fa8('0x44')]=[{'all':!![]}];}_0x4253f3=_[_0x8fa8('0x3b')]({},_0x4253f3,_0x5b6e6c[_0x8fa8('0x3c')]);return db['Dynamics365Field']['find'](_0x4253f3)[_0x8fa8('0x22')](handleEntityNotFound(_0x4c76d2,null))[_0x8fa8('0x22')](respondWithResult(_0x4c76d2,null))[_0x8fa8('0x41')](handleError(_0x4c76d2,null));};exports['create']=function(_0x20fe43,_0x1230f8){return db[_0x8fa8('0x3e')][_0x8fa8('0x45')](_0x20fe43['body'],{})[_0x8fa8('0x22')](respondWithResult(_0x1230f8,0xc9))[_0x8fa8('0x41')](handleError(_0x1230f8,null));};exports[_0x8fa8('0x21')]=function(_0x4868ee,_0x2c7ea2){if(_0x4868ee['body']['id']){delete _0x4868ee['body']['id'];}return db[_0x8fa8('0x3e')][_0x8fa8('0x46')]({'where':{'id':_0x4868ee[_0x8fa8('0x43')]['id']}})[_0x8fa8('0x22')](handleEntityNotFound(_0x2c7ea2,null))[_0x8fa8('0x22')](saveUpdates(_0x4868ee[_0x8fa8('0x47')],null))[_0x8fa8('0x22')](respondWithResult(_0x2c7ea2,null))['catch'](handleError(_0x2c7ea2,null));};exports['destroy']=function(_0xceb605,_0x5eb3bd){return db[_0x8fa8('0x3e')][_0x8fa8('0x46')]({'where':{'id':_0xceb605[_0x8fa8('0x43')]['id']}})[_0x8fa8('0x22')](handleEntityNotFound(_0x5eb3bd,null))[_0x8fa8('0x22')](removeEntity(_0x5eb3bd,null))[_0x8fa8('0x41')](handleError(_0x5eb3bd,null));}; \ No newline at end of file +var _0x8773=['create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch'];(function(_0x5e0926,_0x5f5ca7){var _0x2ffe9e=function(_0x4f23c2){while(--_0x4f23c2){_0x5e0926['push'](_0x5e0926['shift']());}};_0x2ffe9e(++_0x5f5ca7);}(_0x8773,0x12c));var _0x3877=function(_0x3e6679,_0xf6529b){_0x3e6679=_0x3e6679-0x0;var _0x155619=_0x8773[_0x3e6679];return _0x155619;};'use strict';var emlformat=require(_0x3877('0x0'));var rimraf=require(_0x3877('0x1'));var zipdir=require(_0x3877('0x2'));var jsonpatch=require(_0x3877('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3877('0x4'));var Mustache=require('mustache');var util=require(_0x3877('0x5'));var path=require('path');var sox=require(_0x3877('0x6'));var csv=require(_0x3877('0x7'));var ejs=require(_0x3877('0x8'));var fs=require('fs');var fs_extra=require(_0x3877('0x9'));var _=require(_0x3877('0xa'));var squel=require(_0x3877('0xb'));var crypto=require('crypto');var jsforce=require(_0x3877('0xc'));var deskjs=require(_0x3877('0xd'));var toCsv=require(_0x3877('0x7'));var querystring=require(_0x3877('0xe'));var Papa=require(_0x3877('0xf'));var Redis=require(_0x3877('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3877('0x11'));var hardwareService=require(_0x3877('0x12'));var logger=require(_0x3877('0x13'))('api');var utils=require(_0x3877('0x14'));var config=require(_0x3877('0x15'));var licenseUtil=require(_0x3877('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9d64c5,_0x522cfa){_0x522cfa=_0x522cfa||0xcc;return function(_0x14ef4c){if(_0x14ef4c){return _0x9d64c5[_0x3877('0x17')](_0x522cfa);}return _0x9d64c5[_0x3877('0x18')](_0x522cfa)['end']();};}function respondWithResult(_0x2f5fff,_0x1cc845){_0x1cc845=_0x1cc845||0xc8;return function(_0x541e6b){if(_0x541e6b){return _0x2f5fff['status'](_0x1cc845)[_0x3877('0x19')](_0x541e6b);}};}function respondWithFilteredResult(_0x1bd99e,_0x3c10a9){return function(_0xc604cb){if(_0xc604cb){var _0xf5c50e=typeof _0x3c10a9['offset']===_0x3877('0x1a')&&typeof _0x3c10a9[_0x3877('0x1b')]==='undefined';var _0x577225=_0xc604cb[_0x3877('0x1c')];var _0xb6fb99=_0xf5c50e?0x0:_0x3c10a9[_0x3877('0x1d')];var _0xe86ad=_0xf5c50e?_0xc604cb[_0x3877('0x1c')]:_0x3c10a9['offset']+_0x3c10a9[_0x3877('0x1b')];var _0x5a0ae3;if(_0xe86ad>=_0x577225){_0xe86ad=_0x577225;_0x5a0ae3=0xc8;}else{_0x5a0ae3=0xce;}_0x1bd99e[_0x3877('0x18')](_0x5a0ae3);return _0x1bd99e['set'](_0x3877('0x1e'),_0xb6fb99+'-'+_0xe86ad+'/'+_0x577225)[_0x3877('0x19')](_0xc604cb);}return null;};}function patchUpdates(_0x39eebe){return function(_0x3d2598){try{jsonpatch[_0x3877('0x1f')](_0x3d2598,_0x39eebe,!![]);}catch(_0x532aeb){return BPromise[_0x3877('0x20')](_0x532aeb);}return _0x3d2598[_0x3877('0x21')]();};}function saveUpdates(_0x1c6aa1,_0x2e3f73){return function(_0x208357){if(_0x208357){return _0x208357['update'](_0x1c6aa1)[_0x3877('0x22')](function(_0x312921){return _0x312921;});}return null;};}function removeEntity(_0x13cfb0,_0x14076b){return function(_0x12a682){if(_0x12a682){return _0x12a682['destroy']()[_0x3877('0x22')](function(){_0x13cfb0[_0x3877('0x18')](0xcc)[_0x3877('0x23')]();});}};}function handleEntityNotFound(_0x55656c,_0xfd70f8){return function(_0x3f80e8){if(!_0x3f80e8){_0x55656c[_0x3877('0x17')](0x194);}return _0x3f80e8;};}function handleError(_0xb15eb5,_0x3076bc){_0x3076bc=_0x3076bc||0x1f4;return function(_0x2b89c5){logger[_0x3877('0x24')](_0x2b89c5[_0x3877('0x25')]);if(_0x2b89c5['name']){delete _0x2b89c5[_0x3877('0x26')];}_0xb15eb5['status'](_0x3076bc)[_0x3877('0x27')](_0x2b89c5);};}exports[_0x3877('0x28')]=function(_0x396320,_0x9cc44b){var _0x53ffdd={},_0x13b79f={},_0x345b39={'count':0x0,'rows':[]};var _0x56f2a8=_[_0x3877('0x29')](db[_0x3877('0x2a')][_0x3877('0x2b')],function(_0x13b774){return{'name':_0x13b774[_0x3877('0x2c')],'type':_0x13b774[_0x3877('0x2d')][_0x3877('0x2e')]};});_0x13b79f[_0x3877('0x2f')]=_[_0x3877('0x29')](_0x56f2a8,_0x3877('0x26'));_0x13b79f[_0x3877('0x30')]=_[_0x3877('0x31')](_0x396320['query']);_0x13b79f[_0x3877('0x32')]=_[_0x3877('0x33')](_0x13b79f[_0x3877('0x2f')],_0x13b79f['query']);_0x53ffdd[_0x3877('0x34')]=_[_0x3877('0x33')](_0x13b79f[_0x3877('0x2f')],qs['fields'](_0x396320[_0x3877('0x30')][_0x3877('0x35')]));_0x53ffdd[_0x3877('0x34')]=_0x53ffdd[_0x3877('0x34')][_0x3877('0x36')]?_0x53ffdd['attributes']:_0x13b79f['model'];if(!_0x396320[_0x3877('0x30')][_0x3877('0x37')](_0x3877('0x38'))){_0x53ffdd[_0x3877('0x1b')]=qs['limit'](_0x396320[_0x3877('0x30')][_0x3877('0x1b')]);_0x53ffdd[_0x3877('0x1d')]=qs[_0x3877('0x1d')](_0x396320[_0x3877('0x30')]['offset']);}_0x53ffdd[_0x3877('0x39')]=qs['sort'](_0x396320[_0x3877('0x30')]['sort']);_0x53ffdd['where']=qs['filters'](_['pick'](_0x396320[_0x3877('0x30')],_0x13b79f[_0x3877('0x32')]),_0x56f2a8);if(_0x396320[_0x3877('0x30')][_0x3877('0x3a')]){_0x53ffdd[_0x3877('0x3b')]=_[_0x3877('0x3c')](_0x53ffdd[_0x3877('0x3b')],{'$or':_['map'](_0x56f2a8,function(_0x3f6ec5){if(_0x3f6ec5[_0x3877('0x2d')]!==_0x3877('0x3d')){var _0x5a2b31={};_0x5a2b31[_0x3f6ec5[_0x3877('0x26')]]={'$like':'%'+_0x396320[_0x3877('0x30')][_0x3877('0x3a')]+'%'};return _0x5a2b31;}})});}_0x53ffdd=_[_0x3877('0x3c')]({},_0x53ffdd,_0x396320[_0x3877('0x3e')]);var _0x2cf8af={'where':_0x53ffdd[_0x3877('0x3b')]};return db[_0x3877('0x2a')][_0x3877('0x1c')](_0x2cf8af)[_0x3877('0x22')](function(_0xe3957a){_0x345b39[_0x3877('0x1c')]=_0xe3957a;if(_0x396320['query'][_0x3877('0x3f')]){_0x53ffdd[_0x3877('0x40')]=[{'all':!![]}];}return db[_0x3877('0x2a')][_0x3877('0x41')](_0x53ffdd);})[_0x3877('0x22')](function(_0x306601){_0x345b39['rows']=_0x306601;return _0x345b39;})[_0x3877('0x22')](respondWithFilteredResult(_0x9cc44b,_0x53ffdd))['catch'](handleError(_0x9cc44b,null));};exports[_0x3877('0x42')]=function(_0x4640d1,_0x3f3962){var _0x598809={'raw':!![],'where':{'id':_0x4640d1[_0x3877('0x43')]['id']}},_0x7433ec={};_0x7433ec[_0x3877('0x2f')]=_[_0x3877('0x31')](db[_0x3877('0x2a')][_0x3877('0x2b')]);_0x7433ec[_0x3877('0x30')]=_[_0x3877('0x31')](_0x4640d1['query']);_0x7433ec[_0x3877('0x32')]=_[_0x3877('0x33')](_0x7433ec[_0x3877('0x2f')],_0x7433ec[_0x3877('0x30')]);_0x598809[_0x3877('0x34')]=_[_0x3877('0x33')](_0x7433ec[_0x3877('0x2f')],qs['fields'](_0x4640d1['query'][_0x3877('0x35')]));_0x598809['attributes']=_0x598809[_0x3877('0x34')][_0x3877('0x36')]?_0x598809[_0x3877('0x34')]:_0x7433ec[_0x3877('0x2f')];if(_0x4640d1[_0x3877('0x30')][_0x3877('0x3f')]){_0x598809['include']=[{'all':!![]}];}_0x598809=_[_0x3877('0x3c')]({},_0x598809,_0x4640d1[_0x3877('0x3e')]);return db[_0x3877('0x2a')][_0x3877('0x44')](_0x598809)[_0x3877('0x22')](handleEntityNotFound(_0x3f3962,null))['then'](respondWithResult(_0x3f3962,null))[_0x3877('0x45')](handleError(_0x3f3962,null));};exports[_0x3877('0x46')]=function(_0x2ed693,_0x92bea0){return db['Dynamics365Field'][_0x3877('0x46')](_0x2ed693[_0x3877('0x47')],{})[_0x3877('0x22')](respondWithResult(_0x92bea0,0xc9))[_0x3877('0x45')](handleError(_0x92bea0,null));};exports[_0x3877('0x48')]=function(_0x18fa3b,_0x26b5b2){if(_0x18fa3b['body']['id']){delete _0x18fa3b['body']['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x18fa3b['params']['id']}})[_0x3877('0x22')](handleEntityNotFound(_0x26b5b2,null))[_0x3877('0x22')](saveUpdates(_0x18fa3b[_0x3877('0x47')],null))[_0x3877('0x22')](respondWithResult(_0x26b5b2,null))['catch'](handleError(_0x26b5b2,null));};exports[_0x3877('0x49')]=function(_0x412b78,_0x30197f){return db[_0x3877('0x2a')]['find']({'where':{'id':_0x412b78[_0x3877('0x43')]['id']}})['then'](handleEntityNotFound(_0x30197f,null))[_0x3877('0x22')](removeEntity(_0x30197f,null))[_0x3877('0x45')](handleError(_0x30197f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index e6fe507..9f7ee36 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 _0x2c76=['path','rimraf','../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0x2c76,0x1f1));var _0x62c7=function(_0x30471c,_0x4b5e23){_0x30471c=_0x30471c-0x0;var _0x56f02a=_0x2c76[_0x30471c];return _0x56f02a;};'use strict';var _=require(_0x62c7('0x0'));var util=require(_0x62c7('0x1'));var logger=require(_0x62c7('0x2'))(_0x62c7('0x3'));var moment=require(_0x62c7('0x4'));var BPromise=require(_0x62c7('0x5'));var rp=require(_0x62c7('0x6'));var fs=require('fs');var path=require(_0x62c7('0x7'));var rimraf=require(_0x62c7('0x8'));var config=require(_0x62c7('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0x62c7('0xa')]=function(_0x3ea740,_0x3670c6){return _0x3ea740[_0x62c7('0xb')]('Dynamics365Field',attributes,{'tableName':_0x62c7('0xc'),'paranoid':![],'indexes':[{'name':_0x62c7('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b1f=['util','../../config/logger','moment','path','../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x317725,_0x1bd734){var _0x1e08cb=function(_0x42d51c){while(--_0x42d51c){_0x317725['push'](_0x317725['shift']());}};_0x1e08cb(++_0x1bd734);}(_0x5b1f,0xd7));var _0xf5b1=function(_0x5444b3,_0xb3fa08){_0x5444b3=_0x5444b3-0x0;var _0x495258=_0x5b1f[_0x5444b3];return _0x495258;};'use strict';var _=require(_0xf5b1('0x0'));var util=require(_0xf5b1('0x1'));var logger=require(_0xf5b1('0x2'))('api');var moment=require(_0xf5b1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5b1('0x4'));var rimraf=require('rimraf');var config=require(_0xf5b1('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0xf5b1('0x6')]=function(_0x416725,_0x2b6a85){return _0x416725[_0xf5b1('0x7')]('Dynamics365Field',attributes,{'tableName':_0xf5b1('0x8'),'paranoid':![],'indexes':[{'name':_0xf5b1('0x9'),'fields':[_0xf5b1('0xa'),_0xf5b1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 8c964f9..15b153a 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 _0x07f4=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x07f4,0xaf));var _0x407f=function(_0x48636f,_0x2c7650){_0x48636f=_0x48636f-0x0;var _0x7cecb4=_0x07f4[_0x48636f];return _0x7cecb4;};'use strict';var _=require(_0x407f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x407f('0x1'));var rs=require(_0x407f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x407f('0x3'))['db'];var utils=require(_0x407f('0x4'));var logger=require(_0x407f('0x5'))('rpc');var config=require(_0x407f('0x6'));var jayson=require(_0x407f('0x7'));var client=jayson[_0x407f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e7af1,_0x545ab5,_0x5a642a){return new BPromise(function(_0x4e9b54,_0x51c02d){return client[_0x407f('0x9')](_0x4e7af1,_0x5a642a)[_0x407f('0xa')](function(_0x2c069a){logger[_0x407f('0xb')](_0x407f('0xc'),_0x545ab5,_0x407f('0xd'));logger['debug'](_0x407f('0xe'),_0x545ab5,_0x407f('0xd'),JSON[_0x407f('0xf')](_0x2c069a));if(_0x2c069a[_0x407f('0x10')]){if(_0x2c069a['error'][_0x407f('0x11')]===0x1f4){logger[_0x407f('0x10')](_0x407f('0xc'),_0x545ab5,_0x2c069a['error'][_0x407f('0x12')]);return _0x51c02d(_0x2c069a['error'][_0x407f('0x12')]);}logger[_0x407f('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x545ab5,_0x2c069a[_0x407f('0x10')][_0x407f('0x12')]);return _0x4e9b54(_0x2c069a[_0x407f('0x10')]['message']);}else{logger[_0x407f('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x545ab5,'request\x20sent');_0x4e9b54(_0x2c069a[_0x407f('0x13')][_0x407f('0x12')]);}})[_0x407f('0x14')](function(_0x5a5d2d){logger['error'](_0x407f('0xc'),_0x545ab5,_0x5a5d2d);_0x51c02d(_0x5a5d2d);});});} \ No newline at end of file +var _0xfcff=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x41012a,_0x8410ed){var _0x2019a7=function(_0x2557ec){while(--_0x2557ec){_0x41012a['push'](_0x41012a['shift']());}};_0x2019a7(++_0x8410ed);}(_0xfcff,0x15d));var _0xffcf=function(_0x53f56f,_0x25aacc){_0x53f56f=_0x53f56f-0x0;var _0x2d01de=_0xfcff[_0x53f56f];return _0x2d01de;};'use strict';var _=require(_0xffcf('0x0'));var util=require('util');var moment=require(_0xffcf('0x1'));var BPromise=require(_0xffcf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffcf('0x3'));var db=require(_0xffcf('0x4'))['db'];var utils=require(_0xffcf('0x5'));var logger=require(_0xffcf('0x6'))('rpc');var config=require(_0xffcf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xffcf('0x8')][_0xffcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21aea6,_0x25d873,_0x54388e){return new BPromise(function(_0x107e6c,_0x3d1dbe){return client[_0xffcf('0xa')](_0x21aea6,_0x54388e)[_0xffcf('0xb')](function(_0x4f70fc){logger[_0xffcf('0xc')](_0xffcf('0xd'),_0x25d873,_0xffcf('0xe'));logger[_0xffcf('0xf')](_0xffcf('0x10'),_0x25d873,_0xffcf('0xe'),JSON['stringify'](_0x4f70fc));if(_0x4f70fc[_0xffcf('0x11')]){if(_0x4f70fc[_0xffcf('0x11')][_0xffcf('0x12')]===0x1f4){logger[_0xffcf('0x11')](_0xffcf('0xd'),_0x25d873,_0x4f70fc[_0xffcf('0x11')][_0xffcf('0x13')]);return _0x3d1dbe(_0x4f70fc[_0xffcf('0x11')][_0xffcf('0x13')]);}logger[_0xffcf('0x11')](_0xffcf('0xd'),_0x25d873,_0x4f70fc[_0xffcf('0x11')][_0xffcf('0x13')]);return _0x107e6c(_0x4f70fc[_0xffcf('0x11')]['message']);}else{logger[_0xffcf('0xc')](_0xffcf('0xd'),_0x25d873,_0xffcf('0xe'));_0x107e6c(_0x4f70fc[_0xffcf('0x14')][_0xffcf('0x13')]);}})['catch'](function(_0x28ed96){logger['error'](_0xffcf('0xd'),_0x25d873,_0x28ed96);_0x3d1dbe(_0x28ed96);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 3a47510..4f01f15 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 _0x449e=['fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x41747d,_0x258c40){var _0x1c8d85=function(_0x289406){while(--_0x289406){_0x41747d['push'](_0x41747d['shift']());}};_0x1c8d85(++_0x258c40);}(_0x449e,0x177));var _0xe449=function(_0x1186b7,_0x42f09e){_0x1186b7=_0x1186b7-0x0;var _0x1964d7=_0x449e[_0x1186b7];return _0x1964d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe449('0x0'));var timeout=require(_0xe449('0x1'));var express=require(_0xe449('0x2'));var router=express['Router']();var fs_extra=require(_0xe449('0x3'));var auth=require(_0xe449('0x4'));var interaction=require(_0xe449('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xe449('0x6')]('/',auth['isAuthenticated'](),controller[_0xe449('0x7')]);router['get'](_0xe449('0x8'),auth[_0xe449('0x9')](),controller[_0xe449('0xa')]);router[_0xe449('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xe449('0x6')](_0xe449('0xb'),auth[_0xe449('0x9')](),controller[_0xe449('0xc')]);router[_0xe449('0xd')]('/',auth['isAuthenticated'](),controller[_0xe449('0xe')]);router[_0xe449('0xd')](_0xe449('0xf'),auth[_0xe449('0x9')](),controller['addConfiguration']);router[_0xe449('0x10')](_0xe449('0x8'),auth[_0xe449('0x9')](),controller[_0xe449('0x11')]);router[_0xe449('0x12')](_0xe449('0x8'),auth[_0xe449('0x9')](),controller[_0xe449('0x13')]);module[_0xe449('0x14')]=router; \ No newline at end of file +var _0xf178=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf178,0xd8));var _0x8f17=function(_0x10b4f2,_0x2d4ec8){_0x10b4f2=_0x10b4f2-0x0;var _0x1d9640=_0xf178[_0x10b4f2];return _0x1d9640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f17('0x0'));var timeout=require(_0x8f17('0x1'));var express=require('express');var router=express[_0x8f17('0x2')]();var fs_extra=require(_0x8f17('0x3'));var auth=require(_0x8f17('0x4'));var interaction=require(_0x8f17('0x5'));var config=require(_0x8f17('0x6'));var controller=require(_0x8f17('0x7'));router[_0x8f17('0x8')]('/',auth[_0x8f17('0x9')](),controller['index']);router[_0x8f17('0x8')](_0x8f17('0xa'),auth[_0x8f17('0x9')](),controller[_0x8f17('0xb')]);router[_0x8f17('0x8')](_0x8f17('0xc'),auth[_0x8f17('0x9')](),controller['getConfigurations']);router[_0x8f17('0x8')]('/:id/fields',auth[_0x8f17('0x9')](),controller[_0x8f17('0xd')]);router['post']('/',auth[_0x8f17('0x9')](),controller[_0x8f17('0xe')]);router[_0x8f17('0xf')](_0x8f17('0xc'),auth[_0x8f17('0x9')](),controller[_0x8f17('0x10')]);router[_0x8f17('0x11')](_0x8f17('0xa'),auth[_0x8f17('0x9')](),controller[_0x8f17('0x12')]);router[_0x8f17('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8f17('0x14')]);module[_0x8f17('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7755f4b..d2c7203 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 _0xb78e=['username','remoteUri','sequelize','exports','STRING'];(function(_0x22b70f,_0x4c853f){var _0x100985=function(_0x18628e){while(--_0x18628e){_0x22b70f['push'](_0x22b70f['shift']());}};_0x100985(++_0x4c853f);}(_0xb78e,0x1c9));var _0xeb78=function(_0x3259a2,_0x174b02){_0x3259a2=_0x3259a2-0x0;var _0x314467=_0xb78e[_0x3259a2];return _0x314467;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb78('0x2')]},'username':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x3')},'apiKey':{'type':Sequelize[_0xeb78('0x2')]},'remoteUri':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x4')},'serverUrl':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0x4e9aa6,_0x5bba38){var _0x3c0488=function(_0x373436){while(--_0x373436){_0x4e9aa6['push'](_0x4e9aa6['shift']());}};_0x3c0488(++_0x5bba38);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index adb2507..a181ee4 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 _0xd110=['Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','options','find','create','body','params','getConfigurations','FreshdeskConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields'];(function(_0x1bf011,_0x5e23ca){var _0x47b501=function(_0x35c3e8){while(--_0x35c3e8){_0x1bf011['push'](_0x1bf011['shift']());}};_0x47b501(++_0x5e23ca);}(_0xd110,0x1e8));var _0x0d11=function(_0x5eed39,_0x9d548){_0x5eed39=_0x5eed39-0x0;var _0x2a5526=_0xd110[_0x5eed39];return _0x2a5526;};'use strict';var emlformat=require(_0x0d11('0x0'));var rimraf=require(_0x0d11('0x1'));var zipdir=require(_0x0d11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d11('0x3'));var moment=require(_0x0d11('0x4'));var BPromise=require(_0x0d11('0x5'));var Mustache=require(_0x0d11('0x6'));var util=require(_0x0d11('0x7'));var path=require(_0x0d11('0x8'));var sox=require(_0x0d11('0x9'));var csv=require(_0x0d11('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d11('0xb'));var _=require('lodash');var squel=require(_0x0d11('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0d11('0xd'));var toCsv=require(_0x0d11('0xa'));var querystring=require(_0x0d11('0xe'));var Papa=require('papaparse');var Redis=require(_0x0d11('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0d11('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d11('0x11'));var logger=require(_0x0d11('0x12'))(_0x0d11('0x13'));var utils=require(_0x0d11('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0d11('0x15'));var db=require(_0x0d11('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x19f883,_0x2330ed){_0x2330ed=_0x2330ed||0xcc;return function(_0x29e0cc){if(_0x29e0cc){return _0x19f883['sendStatus'](_0x2330ed);}return _0x19f883[_0x0d11('0x17')](_0x2330ed)[_0x0d11('0x18')]();};}function respondWithResult(_0x5bea18,_0x119ce7){_0x119ce7=_0x119ce7||0xc8;return function(_0x3c88e6){if(_0x3c88e6){return _0x5bea18[_0x0d11('0x17')](_0x119ce7)[_0x0d11('0x19')](_0x3c88e6);}};}function respondWithFilteredResult(_0x2bc04b,_0x5b85a7){return function(_0x5a0de9){if(_0x5a0de9){var _0x280d81=typeof _0x5b85a7['offset']===_0x0d11('0x1a')&&typeof _0x5b85a7[_0x0d11('0x1b')]==='undefined';var _0x2556ac=_0x5a0de9['count'];var _0x2e4c05=_0x280d81?0x0:_0x5b85a7[_0x0d11('0x1c')];var _0x5e3bd3=_0x280d81?_0x5a0de9['count']:_0x5b85a7[_0x0d11('0x1c')]+_0x5b85a7[_0x0d11('0x1b')];var _0x362c14;if(_0x5e3bd3>=_0x2556ac){_0x5e3bd3=_0x2556ac;_0x362c14=0xc8;}else{_0x362c14=0xce;}_0x2bc04b[_0x0d11('0x17')](_0x362c14);return _0x2bc04b[_0x0d11('0x1d')](_0x0d11('0x1e'),_0x2e4c05+'-'+_0x5e3bd3+'/'+_0x2556ac)['json'](_0x5a0de9);}return null;};}function patchUpdates(_0x467448){return function(_0x170e45){try{jsonpatch[_0x0d11('0x1f')](_0x170e45,_0x467448,!![]);}catch(_0x32d33f){return BPromise[_0x0d11('0x20')](_0x32d33f);}return _0x170e45['save']();};}function saveUpdates(_0x38955b,_0x52e60f){return function(_0x1d94e0){if(_0x1d94e0){return _0x1d94e0[_0x0d11('0x21')](_0x38955b)[_0x0d11('0x22')](function(_0x480a4f){return _0x480a4f;});}return null;};}function removeEntity(_0x304f7f,_0xc4c278){return function(_0x4a6839){if(_0x4a6839){return _0x4a6839[_0x0d11('0x23')]()['then'](function(){_0x304f7f[_0x0d11('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52cb79,_0x1dba11){return function(_0xb83c45){if(!_0xb83c45){_0x52cb79[_0x0d11('0x24')](0x194);}return _0xb83c45;};}function handleError(_0x2138a0,_0x7be5a3){_0x7be5a3=_0x7be5a3||0x1f4;return function(_0x4cd228){logger[_0x0d11('0x25')](_0x4cd228['stack']);if(_0x4cd228[_0x0d11('0x26')]){delete _0x4cd228['name'];}_0x2138a0[_0x0d11('0x17')](_0x7be5a3)[_0x0d11('0x27')](_0x4cd228);};}exports[_0x0d11('0x28')]=function(_0x103c75,_0x206dd2){var _0x17a668={},_0x144e93={},_0x38f51d={'count':0x0,'rows':[]};var _0x25abc5=_[_0x0d11('0x29')](db[_0x0d11('0x2a')][_0x0d11('0x2b')],function(_0x47909c){return{'name':_0x47909c[_0x0d11('0x2c')],'type':_0x47909c[_0x0d11('0x2d')]['key']};});_0x144e93[_0x0d11('0x2e')]=_[_0x0d11('0x29')](_0x25abc5,_0x0d11('0x26'));_0x144e93[_0x0d11('0x2f')]=_[_0x0d11('0x30')](_0x103c75[_0x0d11('0x2f')]);_0x144e93[_0x0d11('0x31')]=_[_0x0d11('0x32')](_0x144e93[_0x0d11('0x2e')],_0x144e93[_0x0d11('0x2f')]);_0x17a668[_0x0d11('0x33')]=_['intersection'](_0x144e93[_0x0d11('0x2e')],qs[_0x0d11('0x34')](_0x103c75[_0x0d11('0x2f')][_0x0d11('0x34')]));_0x17a668[_0x0d11('0x33')]=_0x17a668[_0x0d11('0x33')][_0x0d11('0x35')]?_0x17a668[_0x0d11('0x33')]:_0x144e93[_0x0d11('0x2e')];if(!_0x103c75[_0x0d11('0x2f')][_0x0d11('0x36')]('nolimit')){_0x17a668['limit']=qs[_0x0d11('0x1b')](_0x103c75[_0x0d11('0x2f')][_0x0d11('0x1b')]);_0x17a668[_0x0d11('0x1c')]=qs['offset'](_0x103c75[_0x0d11('0x2f')][_0x0d11('0x1c')]);}_0x17a668['order']=qs[_0x0d11('0x37')](_0x103c75[_0x0d11('0x2f')][_0x0d11('0x37')]);_0x17a668[_0x0d11('0x38')]=qs[_0x0d11('0x31')](_[_0x0d11('0x39')](_0x103c75[_0x0d11('0x2f')],_0x144e93[_0x0d11('0x31')]),_0x25abc5);if(_0x103c75[_0x0d11('0x2f')][_0x0d11('0x3a')]){_0x17a668[_0x0d11('0x38')]=_[_0x0d11('0x3b')](_0x17a668[_0x0d11('0x38')],{'$or':_[_0x0d11('0x29')](_0x25abc5,function(_0x30da16){if(_0x30da16['type']!==_0x0d11('0x3c')){var _0x581bfc={};_0x581bfc[_0x30da16[_0x0d11('0x26')]]={'$like':'%'+_0x103c75[_0x0d11('0x2f')][_0x0d11('0x3a')]+'%'};return _0x581bfc;}})});}_0x17a668=_[_0x0d11('0x3b')]({},_0x17a668,_0x103c75['options']);var _0x1d5433={'where':_0x17a668[_0x0d11('0x38')]};return db[_0x0d11('0x2a')][_0x0d11('0x3d')](_0x1d5433)['then'](function(_0x37c937){_0x38f51d['count']=_0x37c937;if(_0x103c75[_0x0d11('0x2f')][_0x0d11('0x3e')]){_0x17a668[_0x0d11('0x3f')]=[{'all':!![]}];}return db[_0x0d11('0x2a')]['findAll'](_0x17a668);})[_0x0d11('0x22')](function(_0x241924){_0x38f51d[_0x0d11('0x40')]=_0x241924;return _0x38f51d;})['then'](respondWithFilteredResult(_0x206dd2,_0x17a668))[_0x0d11('0x41')](handleError(_0x206dd2,null));};exports[_0x0d11('0x42')]=function(_0x37bfc4,_0xe95462){var _0x420d4a={'raw':![],'where':{'id':_0x37bfc4['params']['id']}},_0x2d55b3={};_0x2d55b3[_0x0d11('0x2e')]=_[_0x0d11('0x30')](db[_0x0d11('0x2a')][_0x0d11('0x2b')]);_0x2d55b3[_0x0d11('0x2f')]=_[_0x0d11('0x30')](_0x37bfc4[_0x0d11('0x2f')]);_0x2d55b3[_0x0d11('0x31')]=_[_0x0d11('0x32')](_0x2d55b3[_0x0d11('0x2e')],_0x2d55b3[_0x0d11('0x2f')]);_0x420d4a['attributes']=_[_0x0d11('0x32')](_0x2d55b3['model'],qs['fields'](_0x37bfc4[_0x0d11('0x2f')]['fields']));_0x420d4a['attributes']=_0x420d4a[_0x0d11('0x33')][_0x0d11('0x35')]?_0x420d4a[_0x0d11('0x33')]:_0x2d55b3[_0x0d11('0x2e')];if(_0x37bfc4['query'][_0x0d11('0x3e')]){_0x420d4a['include']=[{'all':!![]}];}_0x420d4a=_['merge']({},_0x420d4a,_0x37bfc4[_0x0d11('0x43')]);return db[_0x0d11('0x2a')][_0x0d11('0x44')](_0x420d4a)[_0x0d11('0x22')](handleEntityNotFound(_0xe95462,null))[_0x0d11('0x22')](respondWithResult(_0xe95462,null))['catch'](handleError(_0xe95462,null));};exports[_0x0d11('0x45')]=function(_0x43e69d,_0x4aa73a){return db['FreshdeskAccount']['create'](_0x43e69d['body'],{})[_0x0d11('0x22')](respondWithResult(_0x4aa73a,0xc9))[_0x0d11('0x41')](handleError(_0x4aa73a,null));};exports[_0x0d11('0x21')]=function(_0x4dd063,_0x494403){if(_0x4dd063[_0x0d11('0x46')]['id']){delete _0x4dd063[_0x0d11('0x46')]['id'];}return db[_0x0d11('0x2a')][_0x0d11('0x44')]({'where':{'id':_0x4dd063[_0x0d11('0x47')]['id']}})['then'](handleEntityNotFound(_0x494403,null))[_0x0d11('0x22')](saveUpdates(_0x4dd063[_0x0d11('0x46')],null))[_0x0d11('0x22')](respondWithResult(_0x494403,null))[_0x0d11('0x41')](handleError(_0x494403,null));};exports[_0x0d11('0x23')]=function(_0x371564,_0x37916a){return db[_0x0d11('0x2a')][_0x0d11('0x44')]({'where':{'id':_0x371564[_0x0d11('0x47')]['id']}})[_0x0d11('0x22')](handleEntityNotFound(_0x37916a,null))[_0x0d11('0x22')](removeEntity(_0x37916a,null))[_0x0d11('0x41')](handleError(_0x37916a,null));};exports[_0x0d11('0x48')]=function(_0x371e93,_0x2bc859,_0x3a59d9){var _0x1f07f1={};var _0x17f3a0={};var _0x2927a0;var _0x5b28ce;return db[_0x0d11('0x2a')]['findOne']({'where':{'id':_0x371e93[_0x0d11('0x47')]['id']}})['then'](handleEntityNotFound(_0x2bc859,null))['then'](function(_0x1406a2){if(_0x1406a2){_0x2927a0=_0x1406a2;_0x17f3a0[_0x0d11('0x2e')]=_[_0x0d11('0x30')](db[_0x0d11('0x49')][_0x0d11('0x2b')]);_0x17f3a0[_0x0d11('0x2f')]=_[_0x0d11('0x30')](_0x371e93[_0x0d11('0x2f')]);_0x17f3a0['filters']=_['intersection'](_0x17f3a0['model'],_0x17f3a0[_0x0d11('0x2f')]);_0x1f07f1[_0x0d11('0x33')]=_[_0x0d11('0x32')](_0x17f3a0[_0x0d11('0x2e')],qs[_0x0d11('0x34')](_0x371e93[_0x0d11('0x2f')][_0x0d11('0x34')]));_0x1f07f1['attributes']=_0x1f07f1[_0x0d11('0x33')][_0x0d11('0x35')]?_0x1f07f1[_0x0d11('0x33')]:_0x17f3a0['model'];_0x1f07f1['order']=qs[_0x0d11('0x37')](_0x371e93['query'][_0x0d11('0x37')]);_0x1f07f1[_0x0d11('0x38')]=qs[_0x0d11('0x31')](_[_0x0d11('0x39')](_0x371e93[_0x0d11('0x2f')],_0x17f3a0[_0x0d11('0x31')]));if(_0x371e93[_0x0d11('0x2f')][_0x0d11('0x3a')]){_0x1f07f1[_0x0d11('0x38')]=_[_0x0d11('0x3b')](_0x1f07f1[_0x0d11('0x38')],{'$or':_[_0x0d11('0x29')](_0x1f07f1[_0x0d11('0x33')],function(_0x1d5c84){var _0x142437={};_0x142437[_0x1d5c84]={'$like':'%'+_0x371e93[_0x0d11('0x2f')][_0x0d11('0x3a')]+'%'};return _0x142437;})});}_0x1f07f1=_[_0x0d11('0x3b')]({},_0x1f07f1,_0x371e93[_0x0d11('0x43')]);return _0x2927a0[_0x0d11('0x48')](_0x1f07f1);}})[_0x0d11('0x22')](function(_0x312745){if(_0x312745){_0x5b28ce=_0x312745[_0x0d11('0x35')];if(!_0x371e93[_0x0d11('0x2f')][_0x0d11('0x36')](_0x0d11('0x4a'))){_0x1f07f1[_0x0d11('0x1b')]=qs['limit'](_0x371e93[_0x0d11('0x2f')]['limit']);_0x1f07f1[_0x0d11('0x1c')]=qs[_0x0d11('0x1c')](_0x371e93[_0x0d11('0x2f')][_0x0d11('0x1c')]);}return _0x2927a0[_0x0d11('0x48')](_0x1f07f1);}})['then'](function(_0x17f47b){if(_0x17f47b){return _0x17f47b?{'count':_0x5b28ce,'rows':_0x17f47b}:null;}})[_0x0d11('0x22')](respondWithResult(_0x2bc859,null))[_0x0d11('0x41')](handleError(_0x2bc859,null));};exports[_0x0d11('0x4b')]=function(_0x237224,_0x32d692,_0x2a6b03){if(_0x237224[_0x0d11('0x46')]['id']){delete _0x237224[_0x0d11('0x46')]['id'];}return db['FreshdeskAccount'][_0x0d11('0x4c')]({'where':{'id':_0x237224[_0x0d11('0x47')]['id']}})[_0x0d11('0x22')](handleEntityNotFound(_0x32d692,null))[_0x0d11('0x22')](function(_0x130278){if(_0x130278){_0x237224[_0x0d11('0x46')][_0x0d11('0x4d')]=_0x130278['id'];_0x237224[_0x0d11('0x46')][_0x0d11('0x4e')]=integrations[_0x0d11('0x4f')](_0x237224[_0x0d11('0x46')][_0x0d11('0x50')],_0x237224[_0x0d11('0x46')][_0x0d11('0x2d')]);_0x237224[_0x0d11('0x46')]['Descriptions']=integrations[_0x0d11('0x51')](_0x237224[_0x0d11('0x46')][_0x0d11('0x50')],_0x237224['body']['type']);return db['FreshdeskConfiguration'][_0x0d11('0x45')](_0x237224[_0x0d11('0x46')],{'include':[{'model':db['FreshdeskField'],'as':_0x0d11('0x4e')},{'model':db['FreshdeskField'],'as':_0x0d11('0x52')}]});}return null;})[_0x0d11('0x22')](respondWithResult(_0x32d692,null))[_0x0d11('0x41')](handleError(_0x32d692,null));};exports[_0x0d11('0x53')]=function(_0x20c1fd,_0x42b607,_0x2c1405){var _0xae4f5e='';return db[_0x0d11('0x2a')][_0x0d11('0x4c')]({'where':{'id':_0x20c1fd[_0x0d11('0x47')]['id']},'attributes':['id',_0x0d11('0x54'),_0x0d11('0x55')]})['then'](handleEntityNotFound(_0x42b607,null))[_0x0d11('0x22')](function(_0x80bf7f){if(_0x80bf7f){_0xae4f5e=_0x80bf7f[_0x0d11('0x54')];var _0x64443b=_0xae4f5e[_0x0d11('0x56')](-0x1);if(_0x64443b==='/'){_0xae4f5e=_0xae4f5e[_0x0d11('0x57')](0x0,_0xae4f5e[_0x0d11('0x58')](_0x64443b));}return rp({'method':'GET','uri':util[_0x0d11('0x59')](_0x0d11('0x5a'),_0xae4f5e,_0x0d11('0x5b')),'headers':{'Authorization':util[_0x0d11('0x59')](_0x0d11('0x5c'),new Buffer(util['format'](_0x0d11('0x5d'),_0x80bf7f['apiKey']))[_0x0d11('0x5e')](_0x0d11('0x5f')))},'json':!![]});}})['then'](function(_0x2b2f61){if(_0x2b2f61){var _0x835fed=[_0x0d11('0x60'),_0x0d11('0x61'),_0x0d11('0x62'),_0x0d11('0x63'),'status',_0x0d11('0x64'),_0x0d11('0x65'),_0x0d11('0x66'),_0x0d11('0x67'),'group',_0x0d11('0x68')];_[_0x0d11('0x69')](_0x2b2f61,function(_0x3c5f72){return _0x835fed[_0x0d11('0x6a')](_0x3c5f72[_0x0d11('0x26')])||!_0x3c5f72[_0x0d11('0x6b')]&&_0x3c5f72[_0x0d11('0x2d')]!==_0x0d11('0x6c')&&_0x3c5f72[_0x0d11('0x2d')]!==_0x0d11('0x6d');});return{'count':_0x2b2f61[_0x0d11('0x35')],'rows':_[_0x0d11('0x29')](_0x2b2f61,function(_0x38e17d){return{'id':_0x38e17d[_0x0d11('0x26')],'name':_0x38e17d[_0x0d11('0x6e')],'custom':!_0x38e17d[_0x0d11('0x6b')],'options':_0x38e17d[_0x0d11('0x6f')]?_[_0x0d11('0x29')](_0x38e17d[_0x0d11('0x6f')],function(_0x5e18a8){return{'name':_[_0x0d11('0x70')](_0x5e18a8),'value':_0x5e18a8};}):[]};})};}})[_0x0d11('0x22')](respondWithResult(_0x42b607,null))[_0x0d11('0x41')](function(_0xfb2187){var _0x3f3edc=_0x20c1fd['query'][_0x0d11('0x71')]?0x1f4:_0xfb2187[_0x0d11('0x72')]||0x1f4;logger[_0x0d11('0x25')](_0x0d11('0x73'),_0x0d11('0x53'),_0x3f3edc,JSON['stringify'](_0xfb2187));delete _0xfb2187[_0x0d11('0x26')];if(_0x3f3edc===0x191){_0x3f3edc=0x190;}_0x42b607[_0x0d11('0x17')](_0x3f3edc)[_0x0d11('0x27')](_0x20c1fd[_0x0d11('0x2f')][_0x0d11('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0xfb2187[_0x0d11('0x72')]}:_0xfb2187);});}; \ No newline at end of file +var _0xe28e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','destroy','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','FreshdeskAccount','includeAll','include','findAll','catch','params','fields','options','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','includes','default','custom_text','label','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe28e,0x1ba));var _0xee28=function(_0x26992e,_0x34653d){_0x26992e=_0x26992e-0x0;var _0x586da5=_0xe28e[_0x26992e];return _0x586da5;};'use strict';var emlformat=require(_0xee28('0x0'));var rimraf=require(_0xee28('0x1'));var zipdir=require(_0xee28('0x2'));var jsonpatch=require(_0xee28('0x3'));var rp=require(_0xee28('0x4'));var moment=require(_0xee28('0x5'));var BPromise=require(_0xee28('0x6'));var Mustache=require(_0xee28('0x7'));var util=require(_0xee28('0x8'));var path=require(_0xee28('0x9'));var sox=require(_0xee28('0xa'));var csv=require(_0xee28('0xb'));var ejs=require(_0xee28('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee28('0xd'));var squel=require(_0xee28('0xe'));var crypto=require(_0xee28('0xf'));var jsforce=require(_0xee28('0x10'));var deskjs=require(_0xee28('0x11'));var toCsv=require(_0xee28('0xb'));var querystring=require(_0xee28('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee28('0x13'));var as=require(_0xee28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee28('0x15'))(_0xee28('0x16'));var utils=require('../../config/utils');var config=require(_0xee28('0x17'));var licenseUtil=require(_0xee28('0x18'));var db=require(_0xee28('0x19'))['db'];var integrations=require(_0xee28('0x1a'));function respondWithStatusCode(_0x267031,_0x46e784){_0x46e784=_0x46e784||0xcc;return function(_0x236de4){if(_0x236de4){return _0x267031['sendStatus'](_0x46e784);}return _0x267031[_0xee28('0x1b')](_0x46e784)[_0xee28('0x1c')]();};}function respondWithResult(_0x555b9c,_0x331b7c){_0x331b7c=_0x331b7c||0xc8;return function(_0x2ae3e0){if(_0x2ae3e0){return _0x555b9c['status'](_0x331b7c)[_0xee28('0x1d')](_0x2ae3e0);}};}function respondWithFilteredResult(_0x17c99a,_0x3d3a5c){return function(_0x343358){if(_0x343358){var _0x1ff99e=typeof _0x3d3a5c[_0xee28('0x1e')]==='undefined'&&typeof _0x3d3a5c[_0xee28('0x1f')]==='undefined';var _0x37e429=_0x343358[_0xee28('0x20')];var _0x5afd11=_0x1ff99e?0x0:_0x3d3a5c[_0xee28('0x1e')];var _0x49be69=_0x1ff99e?_0x343358[_0xee28('0x20')]:_0x3d3a5c['offset']+_0x3d3a5c[_0xee28('0x1f')];var _0x577332;if(_0x49be69>=_0x37e429){_0x49be69=_0x37e429;_0x577332=0xc8;}else{_0x577332=0xce;}_0x17c99a[_0xee28('0x1b')](_0x577332);return _0x17c99a['set'](_0xee28('0x21'),_0x5afd11+'-'+_0x49be69+'/'+_0x37e429)[_0xee28('0x1d')](_0x343358);}return null;};}function patchUpdates(_0x96f5db){return function(_0x3674c7){try{jsonpatch[_0xee28('0x22')](_0x3674c7,_0x96f5db,!![]);}catch(_0x1280f5){return BPromise[_0xee28('0x23')](_0x1280f5);}return _0x3674c7['save']();};}function saveUpdates(_0x342798,_0x44d7ff){return function(_0x3198d0){if(_0x3198d0){return _0x3198d0['update'](_0x342798)['then'](function(_0x17d8e4){return _0x17d8e4;});}return null;};}function removeEntity(_0x4a524d,_0x1519ae){return function(_0x29360e){if(_0x29360e){return _0x29360e[_0xee28('0x24')]()[_0xee28('0x25')](function(){_0x4a524d[_0xee28('0x1b')](0xcc)[_0xee28('0x1c')]();});}};}function handleEntityNotFound(_0x2a7c95,_0x733ca8){return function(_0x281c8a){if(!_0x281c8a){_0x2a7c95['sendStatus'](0x194);}return _0x281c8a;};}function handleError(_0x2c847b,_0x5b1b1e){_0x5b1b1e=_0x5b1b1e||0x1f4;return function(_0x51a87e){logger['error'](_0x51a87e['stack']);if(_0x51a87e['name']){delete _0x51a87e[_0xee28('0x26')];}_0x2c847b[_0xee28('0x1b')](_0x5b1b1e)[_0xee28('0x27')](_0x51a87e);};}exports[_0xee28('0x28')]=function(_0x346201,_0x417840){var _0xbafd67={},_0x4fcc8f={},_0x84e0ba={'count':0x0,'rows':[]};var _0x7390dc=_[_0xee28('0x29')](db['FreshdeskAccount'][_0xee28('0x2a')],function(_0x2890ad){return{'name':_0x2890ad[_0xee28('0x2b')],'type':_0x2890ad[_0xee28('0x2c')][_0xee28('0x2d')]};});_0x4fcc8f[_0xee28('0x2e')]=_[_0xee28('0x29')](_0x7390dc,'name');_0x4fcc8f[_0xee28('0x2f')]=_[_0xee28('0x30')](_0x346201['query']);_0x4fcc8f[_0xee28('0x31')]=_[_0xee28('0x32')](_0x4fcc8f[_0xee28('0x2e')],_0x4fcc8f[_0xee28('0x2f')]);_0xbafd67[_0xee28('0x33')]=_[_0xee28('0x32')](_0x4fcc8f[_0xee28('0x2e')],qs['fields'](_0x346201['query']['fields']));_0xbafd67[_0xee28('0x33')]=_0xbafd67[_0xee28('0x33')][_0xee28('0x34')]?_0xbafd67[_0xee28('0x33')]:_0x4fcc8f[_0xee28('0x2e')];if(!_0x346201[_0xee28('0x2f')]['hasOwnProperty'](_0xee28('0x35'))){_0xbafd67[_0xee28('0x1f')]=qs['limit'](_0x346201['query'][_0xee28('0x1f')]);_0xbafd67[_0xee28('0x1e')]=qs['offset'](_0x346201['query'][_0xee28('0x1e')]);}_0xbafd67[_0xee28('0x36')]=qs['sort'](_0x346201[_0xee28('0x2f')][_0xee28('0x37')]);_0xbafd67[_0xee28('0x38')]=qs[_0xee28('0x31')](_[_0xee28('0x39')](_0x346201[_0xee28('0x2f')],_0x4fcc8f[_0xee28('0x31')]),_0x7390dc);if(_0x346201[_0xee28('0x2f')][_0xee28('0x3a')]){_0xbafd67[_0xee28('0x38')]=_[_0xee28('0x3b')](_0xbafd67[_0xee28('0x38')],{'$or':_['map'](_0x7390dc,function(_0x191d7d){if(_0x191d7d['type']!=='VIRTUAL'){var _0x265ae5={};_0x265ae5[_0x191d7d['name']]={'$like':'%'+_0x346201[_0xee28('0x2f')]['filter']+'%'};return _0x265ae5;}})});}_0xbafd67=_[_0xee28('0x3b')]({},_0xbafd67,_0x346201['options']);var _0x1faf46={'where':_0xbafd67[_0xee28('0x38')]};return db[_0xee28('0x3c')][_0xee28('0x20')](_0x1faf46)['then'](function(_0x1cf211){_0x84e0ba['count']=_0x1cf211;if(_0x346201[_0xee28('0x2f')][_0xee28('0x3d')]){_0xbafd67[_0xee28('0x3e')]=[{'all':!![]}];}return db[_0xee28('0x3c')][_0xee28('0x3f')](_0xbafd67);})[_0xee28('0x25')](function(_0x216ca7){_0x84e0ba['rows']=_0x216ca7;return _0x84e0ba;})['then'](respondWithFilteredResult(_0x417840,_0xbafd67))[_0xee28('0x40')](handleError(_0x417840,null));};exports['show']=function(_0x52b666,_0x4064cf){var _0x14bd8d={'raw':![],'where':{'id':_0x52b666[_0xee28('0x41')]['id']}},_0x4ffb08={};_0x4ffb08[_0xee28('0x2e')]=_[_0xee28('0x30')](db[_0xee28('0x3c')][_0xee28('0x2a')]);_0x4ffb08[_0xee28('0x2f')]=_[_0xee28('0x30')](_0x52b666['query']);_0x4ffb08[_0xee28('0x31')]=_[_0xee28('0x32')](_0x4ffb08[_0xee28('0x2e')],_0x4ffb08[_0xee28('0x2f')]);_0x14bd8d[_0xee28('0x33')]=_['intersection'](_0x4ffb08[_0xee28('0x2e')],qs[_0xee28('0x42')](_0x52b666['query'][_0xee28('0x42')]));_0x14bd8d[_0xee28('0x33')]=_0x14bd8d[_0xee28('0x33')][_0xee28('0x34')]?_0x14bd8d[_0xee28('0x33')]:_0x4ffb08[_0xee28('0x2e')];if(_0x52b666['query'][_0xee28('0x3d')]){_0x14bd8d['include']=[{'all':!![]}];}_0x14bd8d=_['merge']({},_0x14bd8d,_0x52b666[_0xee28('0x43')]);return db[_0xee28('0x3c')]['find'](_0x14bd8d)[_0xee28('0x25')](handleEntityNotFound(_0x4064cf,null))[_0xee28('0x25')](respondWithResult(_0x4064cf,null))[_0xee28('0x40')](handleError(_0x4064cf,null));};exports['create']=function(_0x57e57e,_0x18c96c){return db[_0xee28('0x3c')][_0xee28('0x44')](_0x57e57e[_0xee28('0x45')],{})[_0xee28('0x25')](respondWithResult(_0x18c96c,0xc9))[_0xee28('0x40')](handleError(_0x18c96c,null));};exports[_0xee28('0x46')]=function(_0x2b5f36,_0x3e31c3){if(_0x2b5f36[_0xee28('0x45')]['id']){delete _0x2b5f36['body']['id'];}return db[_0xee28('0x3c')]['find']({'where':{'id':_0x2b5f36[_0xee28('0x41')]['id']}})[_0xee28('0x25')](handleEntityNotFound(_0x3e31c3,null))[_0xee28('0x25')](saveUpdates(_0x2b5f36[_0xee28('0x45')],null))[_0xee28('0x25')](respondWithResult(_0x3e31c3,null))['catch'](handleError(_0x3e31c3,null));};exports['destroy']=function(_0x5ca018,_0x1b15a4){return db['FreshdeskAccount']['find']({'where':{'id':_0x5ca018[_0xee28('0x41')]['id']}})['then'](handleEntityNotFound(_0x1b15a4,null))[_0xee28('0x25')](removeEntity(_0x1b15a4,null))[_0xee28('0x40')](handleError(_0x1b15a4,null));};exports[_0xee28('0x47')]=function(_0x3a4e74,_0x398120,_0x34a89e){var _0x326c85={};var _0xc1bdba={};var _0x44402a;var _0x10d393;return db['FreshdeskAccount'][_0xee28('0x48')]({'where':{'id':_0x3a4e74[_0xee28('0x41')]['id']}})[_0xee28('0x25')](handleEntityNotFound(_0x398120,null))['then'](function(_0x5b9ced){if(_0x5b9ced){_0x44402a=_0x5b9ced;_0xc1bdba['model']=_['keys'](db[_0xee28('0x49')][_0xee28('0x2a')]);_0xc1bdba[_0xee28('0x2f')]=_['keys'](_0x3a4e74[_0xee28('0x2f')]);_0xc1bdba[_0xee28('0x31')]=_[_0xee28('0x32')](_0xc1bdba[_0xee28('0x2e')],_0xc1bdba[_0xee28('0x2f')]);_0x326c85['attributes']=_[_0xee28('0x32')](_0xc1bdba[_0xee28('0x2e')],qs[_0xee28('0x42')](_0x3a4e74['query'][_0xee28('0x42')]));_0x326c85[_0xee28('0x33')]=_0x326c85[_0xee28('0x33')][_0xee28('0x34')]?_0x326c85[_0xee28('0x33')]:_0xc1bdba[_0xee28('0x2e')];_0x326c85[_0xee28('0x36')]=qs['sort'](_0x3a4e74[_0xee28('0x2f')]['sort']);_0x326c85['where']=qs['filters'](_[_0xee28('0x39')](_0x3a4e74[_0xee28('0x2f')],_0xc1bdba[_0xee28('0x31')]));if(_0x3a4e74[_0xee28('0x2f')][_0xee28('0x3a')]){_0x326c85[_0xee28('0x38')]=_[_0xee28('0x3b')](_0x326c85[_0xee28('0x38')],{'$or':_['map'](_0x326c85[_0xee28('0x33')],function(_0x386e24){var _0x32c06f={};_0x32c06f[_0x386e24]={'$like':'%'+_0x3a4e74[_0xee28('0x2f')][_0xee28('0x3a')]+'%'};return _0x32c06f;})});}_0x326c85=_[_0xee28('0x3b')]({},_0x326c85,_0x3a4e74[_0xee28('0x43')]);return _0x44402a['getConfigurations'](_0x326c85);}})[_0xee28('0x25')](function(_0x4fbb16){if(_0x4fbb16){_0x10d393=_0x4fbb16[_0xee28('0x34')];if(!_0x3a4e74[_0xee28('0x2f')]['hasOwnProperty'](_0xee28('0x35'))){_0x326c85[_0xee28('0x1f')]=qs[_0xee28('0x1f')](_0x3a4e74[_0xee28('0x2f')]['limit']);_0x326c85[_0xee28('0x1e')]=qs[_0xee28('0x1e')](_0x3a4e74[_0xee28('0x2f')][_0xee28('0x1e')]);}return _0x44402a[_0xee28('0x47')](_0x326c85);}})[_0xee28('0x25')](function(_0xf3416b){if(_0xf3416b){return _0xf3416b?{'count':_0x10d393,'rows':_0xf3416b}:null;}})['then'](respondWithResult(_0x398120,null))[_0xee28('0x40')](handleError(_0x398120,null));};exports['addConfiguration']=function(_0x1aa19f,_0x152331,_0x48ad2b){if(_0x1aa19f['body']['id']){delete _0x1aa19f[_0xee28('0x45')]['id'];}return db['FreshdeskAccount'][_0xee28('0x48')]({'where':{'id':_0x1aa19f[_0xee28('0x41')]['id']}})[_0xee28('0x25')](handleEntityNotFound(_0x152331,null))[_0xee28('0x25')](function(_0x6e5bab){if(_0x6e5bab){_0x1aa19f[_0xee28('0x45')][_0xee28('0x4a')]=_0x6e5bab['id'];_0x1aa19f['body'][_0xee28('0x4b')]=integrations[_0xee28('0x4c')](_0x1aa19f[_0xee28('0x45')]['channel'],_0x1aa19f[_0xee28('0x45')][_0xee28('0x2c')]);_0x1aa19f[_0xee28('0x45')][_0xee28('0x4d')]=integrations[_0xee28('0x4e')](_0x1aa19f[_0xee28('0x45')]['channel'],_0x1aa19f[_0xee28('0x45')][_0xee28('0x2c')]);return db[_0xee28('0x49')][_0xee28('0x44')](_0x1aa19f[_0xee28('0x45')],{'include':[{'model':db[_0xee28('0x4f')],'as':'Subjects'},{'model':db[_0xee28('0x4f')],'as':_0xee28('0x4d')}]});}return null;})['then'](respondWithResult(_0x152331,null))['catch'](handleError(_0x152331,null));};exports['getFields']=function(_0x57f6d6,_0x149959,_0x56949a){var _0x24bc85='';return db[_0xee28('0x3c')][_0xee28('0x48')]({'where':{'id':_0x57f6d6['params']['id']},'attributes':['id',_0xee28('0x50'),_0xee28('0x51')]})[_0xee28('0x25')](handleEntityNotFound(_0x149959,null))[_0xee28('0x25')](function(_0x52f4e4){if(_0x52f4e4){_0x24bc85=_0x52f4e4[_0xee28('0x50')];var _0x4cb851=_0x24bc85[_0xee28('0x52')](-0x1);if(_0x4cb851==='/'){_0x24bc85=_0x24bc85[_0xee28('0x53')](0x0,_0x24bc85[_0xee28('0x54')](_0x4cb851));}return rp({'method':'GET','uri':util[_0xee28('0x55')](_0xee28('0x56'),_0x24bc85,_0xee28('0x57')),'headers':{'Authorization':util[_0xee28('0x55')]('Basic\x20%s',new Buffer(util[_0xee28('0x55')]('%s:X',_0x52f4e4[_0xee28('0x51')]))[_0xee28('0x58')](_0xee28('0x59')))},'json':!![]});}})[_0xee28('0x25')](function(_0x4d643b){if(_0x4d643b){var _0x182ad0=[_0xee28('0x5a'),_0xee28('0x5b'),'agent',_0xee28('0x5c'),'status',_0xee28('0x5d'),_0xee28('0x5e'),_0xee28('0x5f'),_0xee28('0x60'),_0xee28('0x5e'),_0xee28('0x61')];_['remove'](_0x4d643b,function(_0x4e0260){return _0x182ad0[_0xee28('0x62')](_0x4e0260[_0xee28('0x26')])||!_0x4e0260[_0xee28('0x63')]&&_0x4e0260[_0xee28('0x2c')]!==_0xee28('0x64')&&_0x4e0260[_0xee28('0x2c')]!=='custom_dropdown';});return{'count':_0x4d643b[_0xee28('0x34')],'rows':_[_0xee28('0x29')](_0x4d643b,function(_0x14cae0){return{'id':_0x14cae0[_0xee28('0x26')],'name':_0x14cae0[_0xee28('0x65')],'custom':!_0x14cae0[_0xee28('0x63')],'options':_0x14cae0[_0xee28('0x66')]?_[_0xee28('0x29')](_0x14cae0[_0xee28('0x66')],function(_0x2a6984){return{'name':_[_0xee28('0x67')](_0x2a6984),'value':_0x2a6984};}):[]};})};}})[_0xee28('0x25')](respondWithResult(_0x149959,null))[_0xee28('0x40')](function(_0x441ac1){var _0x46998f=_0x57f6d6[_0xee28('0x2f')][_0xee28('0x68')]?0x1f4:_0x441ac1['statusCode']||0x1f4;logger[_0xee28('0x69')](_0xee28('0x6a'),_0xee28('0x6b'),_0x46998f,JSON[_0xee28('0x6c')](_0x441ac1));delete _0x441ac1[_0xee28('0x26')];if(_0x46998f===0x191){_0x46998f=0x190;}_0x149959[_0xee28('0x1b')](_0x46998f)['send'](_0x57f6d6[_0xee28('0x2f')]['test']?{'message':_0xee28('0x6d'),'statusCode':_0x441ac1[_0xee28('0x6e')]}:_0x441ac1);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 994912f..817a431 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 _0xab90=['request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment'];(function(_0x28da4d,_0x3acb9f){var _0xefeea3=function(_0x36c022){while(--_0x36c022){_0x28da4d['push'](_0x28da4d['shift']());}};_0xefeea3(++_0x3acb9f);}(_0xab90,0x64));var _0x0ab9=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xab90[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x0ab9('0x0'));var util=require(_0x0ab9('0x1'));var logger=require(_0x0ab9('0x2'))('api');var moment=require(_0x0ab9('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ab9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ab9('0x5'));var config=require(_0x0ab9('0x6'));var attributes=require(_0x0ab9('0x7'));var integrations=require(_0x0ab9('0x8'));module[_0x0ab9('0x9')]=function(_0xd3d1d6,_0x184bfa){return _0xd3d1d6[_0x0ab9('0xa')](_0x0ab9('0xb'),attributes,{'tableName':_0x0ab9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78d8=['lodash','util','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0xad38ee,_0x3ec70b){var _0x126ffb=function(_0x587353){while(--_0x587353){_0xad38ee['push'](_0xad38ee['shift']());}};_0x126ffb(++_0x3ec70b);}(_0x78d8,0x198));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x878d('0x0'));var util=require(_0x878d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x878d('0x2'));var fs=require('fs');var path=require(_0x878d('0x3'));var rimraf=require(_0x878d('0x4'));var config=require(_0x878d('0x5'));var attributes=require(_0x878d('0x6'));var integrations=require(_0x878d('0x7'));module[_0x878d('0x8')]=function(_0x3ec514,_0x21dc64){return _0x3ec514[_0x878d('0x9')](_0x878d('0xa'),attributes,{'tableName':_0x878d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index fad5f09..23e4589 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 _0x79ea=['FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','limit','include','map','model','attributes','ShowFreshdeskAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x79ea,0x107));var _0xa79e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x79ea[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xa79e('0x0'));var util=require(_0xa79e('0x1'));var moment=require(_0xa79e('0x2'));var BPromise=require('bluebird');var rs=require(_0xa79e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa79e('0x4'))['db'];var utils=require(_0xa79e('0x5'));var logger=require(_0xa79e('0x6'))('rpc');var config=require(_0xa79e('0x7'));var jayson=require(_0xa79e('0x8'));var client=jayson[_0xa79e('0x9')][_0xa79e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cfaec,_0xc24c2e,_0x5d08f7){return new BPromise(function(_0x6da002,_0x38ffa0){return client[_0xa79e('0xb')](_0x4cfaec,_0x5d08f7)[_0xa79e('0xc')](function(_0x5d8446){logger[_0xa79e('0xd')](_0xa79e('0xe'),_0xc24c2e,_0xa79e('0xf'));logger[_0xa79e('0x10')](_0xa79e('0x11'),_0xc24c2e,_0xa79e('0xf'),JSON[_0xa79e('0x12')](_0x5d8446));if(_0x5d8446[_0xa79e('0x13')]){if(_0x5d8446[_0xa79e('0x13')]['code']===0x1f4){logger[_0xa79e('0x13')](_0xa79e('0xe'),_0xc24c2e,_0x5d8446[_0xa79e('0x13')]['message']);return _0x38ffa0(_0x5d8446['error'][_0xa79e('0x14')]);}logger[_0xa79e('0x13')](_0xa79e('0xe'),_0xc24c2e,_0x5d8446[_0xa79e('0x13')][_0xa79e('0x14')]);return _0x6da002(_0x5d8446[_0xa79e('0x13')][_0xa79e('0x14')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xc24c2e,_0xa79e('0xf'));_0x6da002(_0x5d8446[_0xa79e('0x15')]['message']);}})[_0xa79e('0x16')](function(_0x23f6f1){logger[_0xa79e('0x13')](_0xa79e('0xe'),_0xc24c2e,_0x23f6f1);_0x38ffa0(_0x23f6f1);});});}exports[_0xa79e('0x17')]=function(_0x1c3174){var _0x1c5866=this;return new Promise(function(_0x5a2651,_0x525a9f){return db[_0xa79e('0x18')]['findAll']({'raw':_0x1c3174[_0xa79e('0x19')]?_0x1c3174[_0xa79e('0x19')][_0xa79e('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c3174[_0xa79e('0x19')]?_0x1c3174[_0xa79e('0x19')][_0xa79e('0x1b')]||null:null,'attributes':_0x1c3174[_0xa79e('0x19')]?_0x1c3174[_0xa79e('0x19')]['attributes']||null:null,'limit':_0x1c3174[_0xa79e('0x19')]?_0x1c3174['options'][_0xa79e('0x1c')]||null:null,'include':_0x1c3174[_0xa79e('0x19')]?_0x1c3174['options'][_0xa79e('0x1d')]?_[_0xa79e('0x1e')](_0x1c3174[_0xa79e('0x19')][_0xa79e('0x1d')],function(_0x4e55ee){return{'model':db[_0x4e55ee[_0xa79e('0x1f')]],'as':_0x4e55ee['as'],'attributes':_0x4e55ee[_0xa79e('0x20')],'include':_0x4e55ee['include']?_[_0xa79e('0x1e')](_0x4e55ee['include'],function(_0x31c0fd){return{'model':db[_0x31c0fd[_0xa79e('0x1f')]],'as':_0x31c0fd['as'],'attributes':_0x31c0fd[_0xa79e('0x20')],'include':_0x31c0fd[_0xa79e('0x1d')]?_[_0xa79e('0x1e')](_0x31c0fd['include'],function(_0x1f9e77){return{'model':db[_0x1f9e77['model']],'as':_0x1f9e77['as'],'attributes':_0x1f9e77[_0xa79e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa79e('0xc')](function(_0x27647c){logger[_0xa79e('0xd')](_0xa79e('0x17'),_0x1c3174);logger['debug']('GetFreshdeskAccount',_0x1c3174,JSON[_0xa79e('0x12')](_0x27647c));_0x5a2651(_0x27647c);})[_0xa79e('0x16')](function(_0x11ef4f){logger[_0xa79e('0x13')](_0xa79e('0x17'),_0x11ef4f[_0xa79e('0x14')],_0x1c3174);_0x525a9f(_0x1c5866[_0xa79e('0x13')](0x1f4,_0x11ef4f[_0xa79e('0x14')]));});});};exports[_0xa79e('0x21')]=function(_0x4e10d8){var _0x418135=this;return new Promise(function(_0x36a30c,_0x44aad3){return db['FreshdeskAccount'][_0xa79e('0x22')]({'raw':_0x4e10d8[_0xa79e('0x19')]?_0x4e10d8[_0xa79e('0x19')][_0xa79e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e10d8[_0xa79e('0x19')]?_0x4e10d8[_0xa79e('0x19')][_0xa79e('0x1b')]||null:null,'attributes':_0x4e10d8[_0xa79e('0x19')]?_0x4e10d8[_0xa79e('0x19')][_0xa79e('0x20')]||null:null,'include':_0x4e10d8[_0xa79e('0x19')]?_0x4e10d8[_0xa79e('0x19')][_0xa79e('0x1d')]?_[_0xa79e('0x1e')](_0x4e10d8['options']['include'],function(_0x49b664){return{'model':db[_0x49b664[_0xa79e('0x1f')]],'as':_0x49b664['as'],'attributes':_0x49b664[_0xa79e('0x20')],'include':_0x49b664[_0xa79e('0x1d')]?_[_0xa79e('0x1e')](_0x49b664['include'],function(_0x29e1f3){return{'model':db[_0x29e1f3['model']],'as':_0x29e1f3['as'],'attributes':_0x29e1f3[_0xa79e('0x20')],'include':_0x29e1f3[_0xa79e('0x1d')]?_[_0xa79e('0x1e')](_0x29e1f3[_0xa79e('0x1d')],function(_0xccd887){return{'model':db[_0xccd887['model']],'as':_0xccd887['as'],'attributes':_0xccd887['attributes']};}):[]};}):[]};}):[]:[]})[_0xa79e('0xc')](function(_0xa4fccb){logger[_0xa79e('0xd')](_0xa79e('0x21'),_0x4e10d8);logger['debug'](_0xa79e('0x21'),_0x4e10d8,JSON[_0xa79e('0x12')](_0xa4fccb));_0x36a30c(_0xa4fccb);})[_0xa79e('0x16')](function(_0x252c34){logger['error'](_0xa79e('0x21'),_0x252c34[_0xa79e('0x14')],_0x4e10d8);_0x44aad3(_0x418135[_0xa79e('0x13')](0x1f4,_0x252c34[_0xa79e('0x14')]));});});}; \ No newline at end of file +var _0xbd76=['include','model','attributes','map','info','ShowFreshdeskAccount','find','where','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','limit'];(function(_0x3ab424,_0x1c24f2){var _0x596ab1=function(_0x37e745){while(--_0x37e745){_0x3ab424['push'](_0x3ab424['shift']());}};_0x596ab1(++_0x1c24f2);}(_0xbd76,0x105));var _0x6bd7=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xbd76[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x6bd7('0x0'));var util=require(_0x6bd7('0x1'));var moment=require(_0x6bd7('0x2'));var BPromise=require(_0x6bd7('0x3'));var rs=require(_0x6bd7('0x4'));var fs=require('fs');var Redis=require(_0x6bd7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6bd7('0x6'))('rpc');var config=require(_0x6bd7('0x7'));var jayson=require(_0x6bd7('0x8'));var client=jayson[_0x6bd7('0x9')][_0x6bd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d2c4b,_0xc0ec14,_0x24e98b){return new BPromise(function(_0xe61423,_0x51c14e){return client[_0x6bd7('0xb')](_0x3d2c4b,_0x24e98b)[_0x6bd7('0xc')](function(_0x4a1254){logger['info'](_0x6bd7('0xd'),_0xc0ec14,_0x6bd7('0xe'));logger[_0x6bd7('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xc0ec14,_0x6bd7('0xe'),JSON['stringify'](_0x4a1254));if(_0x4a1254['error']){if(_0x4a1254['error'][_0x6bd7('0x10')]===0x1f4){logger[_0x6bd7('0x11')](_0x6bd7('0xd'),_0xc0ec14,_0x4a1254['error'][_0x6bd7('0x12')]);return _0x51c14e(_0x4a1254[_0x6bd7('0x11')][_0x6bd7('0x12')]);}logger[_0x6bd7('0x11')](_0x6bd7('0xd'),_0xc0ec14,_0x4a1254[_0x6bd7('0x11')][_0x6bd7('0x12')]);return _0xe61423(_0x4a1254[_0x6bd7('0x11')][_0x6bd7('0x12')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xc0ec14,'request\x20sent');_0xe61423(_0x4a1254[_0x6bd7('0x13')][_0x6bd7('0x12')]);}})[_0x6bd7('0x14')](function(_0x5acf5c){logger[_0x6bd7('0x11')](_0x6bd7('0xd'),_0xc0ec14,_0x5acf5c);_0x51c14e(_0x5acf5c);});});}exports[_0x6bd7('0x15')]=function(_0x1fd79f){var _0x2c3056=this;return new Promise(function(_0x321cfa,_0x43edf6){return db[_0x6bd7('0x16')][_0x6bd7('0x17')]({'raw':_0x1fd79f['options']?_0x1fd79f[_0x6bd7('0x18')][_0x6bd7('0x19')]===undefined?!![]:![]:!![],'where':_0x1fd79f[_0x6bd7('0x18')]?_0x1fd79f['options']['where']||null:null,'attributes':_0x1fd79f['options']?_0x1fd79f['options']['attributes']||null:null,'limit':_0x1fd79f['options']?_0x1fd79f['options'][_0x6bd7('0x1a')]||null:null,'include':_0x1fd79f[_0x6bd7('0x18')]?_0x1fd79f[_0x6bd7('0x18')][_0x6bd7('0x1b')]?_['map'](_0x1fd79f[_0x6bd7('0x18')]['include'],function(_0x267bcb){return{'model':db[_0x267bcb[_0x6bd7('0x1c')]],'as':_0x267bcb['as'],'attributes':_0x267bcb[_0x6bd7('0x1d')],'include':_0x267bcb[_0x6bd7('0x1b')]?_[_0x6bd7('0x1e')](_0x267bcb['include'],function(_0x2cb6f3){return{'model':db[_0x2cb6f3['model']],'as':_0x2cb6f3['as'],'attributes':_0x2cb6f3[_0x6bd7('0x1d')],'include':_0x2cb6f3[_0x6bd7('0x1b')]?_[_0x6bd7('0x1e')](_0x2cb6f3[_0x6bd7('0x1b')],function(_0x1853cc){return{'model':db[_0x1853cc[_0x6bd7('0x1c')]],'as':_0x1853cc['as'],'attributes':_0x1853cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x6bd7('0xc')](function(_0x147c4b){logger[_0x6bd7('0x1f')]('GetFreshdeskAccount',_0x1fd79f);logger['debug']('GetFreshdeskAccount',_0x1fd79f,JSON['stringify'](_0x147c4b));_0x321cfa(_0x147c4b);})[_0x6bd7('0x14')](function(_0x288f51){logger[_0x6bd7('0x11')](_0x6bd7('0x15'),_0x288f51['message'],_0x1fd79f);_0x43edf6(_0x2c3056[_0x6bd7('0x11')](0x1f4,_0x288f51[_0x6bd7('0x12')]));});});};exports[_0x6bd7('0x20')]=function(_0x566050){var _0x13f35d=this;return new Promise(function(_0x22be17,_0xa7ea71){return db[_0x6bd7('0x16')][_0x6bd7('0x21')]({'raw':_0x566050['options']?_0x566050[_0x6bd7('0x18')][_0x6bd7('0x19')]===undefined?!![]:![]:!![],'where':_0x566050[_0x6bd7('0x18')]?_0x566050[_0x6bd7('0x18')][_0x6bd7('0x22')]||null:null,'attributes':_0x566050[_0x6bd7('0x18')]?_0x566050[_0x6bd7('0x18')]['attributes']||null:null,'include':_0x566050[_0x6bd7('0x18')]?_0x566050[_0x6bd7('0x18')]['include']?_[_0x6bd7('0x1e')](_0x566050[_0x6bd7('0x18')][_0x6bd7('0x1b')],function(_0x5a3050){return{'model':db[_0x5a3050['model']],'as':_0x5a3050['as'],'attributes':_0x5a3050[_0x6bd7('0x1d')],'include':_0x5a3050['include']?_[_0x6bd7('0x1e')](_0x5a3050[_0x6bd7('0x1b')],function(_0x88008f){return{'model':db[_0x88008f[_0x6bd7('0x1c')]],'as':_0x88008f['as'],'attributes':_0x88008f[_0x6bd7('0x1d')],'include':_0x88008f[_0x6bd7('0x1b')]?_[_0x6bd7('0x1e')](_0x88008f['include'],function(_0x3ffe3c){return{'model':db[_0x3ffe3c[_0x6bd7('0x1c')]],'as':_0x3ffe3c['as'],'attributes':_0x3ffe3c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb171f3){logger[_0x6bd7('0x1f')](_0x6bd7('0x20'),_0x566050);logger[_0x6bd7('0xf')]('ShowFreshdeskAccount',_0x566050,JSON[_0x6bd7('0x23')](_0xb171f3));_0x22be17(_0xb171f3);})[_0x6bd7('0x14')](function(_0x219970){logger[_0x6bd7('0x11')]('ShowFreshdeskAccount',_0x219970[_0x6bd7('0x12')],_0x566050);_0xa7ea71(_0x13f35d[_0x6bd7('0x11')](0x1f4,_0x219970[_0x6bd7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index cf3fde6..46fdd86 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 _0xca37=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','/:id/tags','setTags','put','delete','destroy'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0xca37,0xc8));var _0x7ca3=function(_0x5697bf,_0x21f090){_0x5697bf=_0x5697bf-0x0;var _0x77db32=_0xca37[_0x5697bf];return _0x77db32;};'use strict';var multer=require('multer');var util=require(_0x7ca3('0x0'));var path=require(_0x7ca3('0x1'));var timeout=require(_0x7ca3('0x2'));var express=require(_0x7ca3('0x3'));var router=express[_0x7ca3('0x4')]();var fs_extra=require(_0x7ca3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7ca3('0x6'));var config=require(_0x7ca3('0x7'));var controller=require(_0x7ca3('0x8'));router[_0x7ca3('0x9')]('/',auth[_0x7ca3('0xa')](),controller[_0x7ca3('0xb')]);router[_0x7ca3('0x9')](_0x7ca3('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7ca3('0xd'),auth[_0x7ca3('0xa')](),controller['getFields']);router[_0x7ca3('0x9')](_0x7ca3('0xe'),auth['isAuthenticated'](),controller[_0x7ca3('0xf')]);router[_0x7ca3('0x9')]('/:id/descriptions',auth[_0x7ca3('0xa')](),controller[_0x7ca3('0x10')]);router[_0x7ca3('0x9')]('/:id/tags',auth[_0x7ca3('0xa')](),controller[_0x7ca3('0x11')]);router[_0x7ca3('0x12')]('/',auth['isAuthenticated'](),controller[_0x7ca3('0x13')]);router['post'](_0x7ca3('0x14'),auth['isAuthenticated'](),controller[_0x7ca3('0x15')]);router[_0x7ca3('0x16')](_0x7ca3('0xc'),auth[_0x7ca3('0xa')](),controller['update']);router[_0x7ca3('0x17')](_0x7ca3('0xc'),auth[_0x7ca3('0xa')](),controller[_0x7ca3('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1d6c=['index','get','isAuthenticated','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller'];(function(_0x3a57b0,_0x23145a){var _0x2b8f3e=function(_0x1c721a){while(--_0x1c721a){_0x3a57b0['push'](_0x3a57b0['shift']());}};_0x2b8f3e(++_0x23145a);}(_0x1d6c,0x171));var _0xc1d6=function(_0x2b9825,_0x2548db){_0x2b9825=_0x2b9825-0x0;var _0x5bb660=_0x1d6c[_0x2b9825];return _0x5bb660;};'use strict';var multer=require(_0xc1d6('0x0'));var util=require(_0xc1d6('0x1'));var path=require(_0xc1d6('0x2'));var timeout=require(_0xc1d6('0x3'));var express=require('express');var router=express[_0xc1d6('0x4')]();var fs_extra=require(_0xc1d6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc1d6('0x6'));var config=require(_0xc1d6('0x7'));var controller=require(_0xc1d6('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1d6('0x9')]);router[_0xc1d6('0xa')]('/:id',auth[_0xc1d6('0xb')](),controller[_0xc1d6('0xc')]);router[_0xc1d6('0xa')](_0xc1d6('0xd'),auth[_0xc1d6('0xb')](),controller[_0xc1d6('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc1d6('0xa')](_0xc1d6('0xf'),auth[_0xc1d6('0xb')](),controller[_0xc1d6('0x10')]);router[_0xc1d6('0xa')](_0xc1d6('0x11'),auth['isAuthenticated'](),controller[_0xc1d6('0x12')]);router[_0xc1d6('0x13')]('/',auth[_0xc1d6('0xb')](),controller['create']);router[_0xc1d6('0x13')](_0xc1d6('0x11'),auth['isAuthenticated'](),controller[_0xc1d6('0x14')]);router[_0xc1d6('0x15')]('/:id',auth[_0xc1d6('0xb')](),controller[_0xc1d6('0x16')]);router[_0xc1d6('0x17')](_0xc1d6('0x18'),auth[_0xc1d6('0xb')](),controller[_0xc1d6('0x19')]);module[_0xc1d6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index aa51e65..6f69c26 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 _0xeaf8=['exports','STRING','sequelize'];(function(_0x1f644c,_0x23e365){var _0xe41c58=function(_0x3217bc){while(--_0x3217bc){_0x1f644c['push'](_0x1f644c['shift']());}};_0xe41c58(++_0x23e365);}(_0xeaf8,0x1cd));var _0x8eaf=function(_0x1f6c5f,_0x59e489){_0x1f6c5f=_0x1f6c5f-0x0;var _0x2e0412=_0xeaf8[_0x1f6c5f];return _0x2e0412;};'use strict';var Sequelize=require(_0x8eaf('0x0'));module[_0x8eaf('0x1')]={'name':{'type':Sequelize[_0x8eaf('0x2')]},'description':{'type':Sequelize[_0x8eaf('0x2')]}}; \ No newline at end of file +var _0xfab2=['STRING','sequelize','exports'];(function(_0x2797c8,_0xf891f){var _0x41feca=function(_0x42febc){while(--_0x42febc){_0x2797c8['push'](_0x2797c8['shift']());}};_0x41feca(++_0xf891f);}(_0xfab2,0x1b1));var _0x2fab=function(_0x40017d,_0x47cf4c){_0x40017d=_0x40017d-0x0;var _0xcc8097=_0xfab2[_0x40017d];return _0xcc8097;};'use strict';var Sequelize=require(_0x2fab('0x0'));module[_0x2fab('0x1')]={'name':{'type':Sequelize[_0x2fab('0x2')]},'description':{'type':Sequelize[_0x2fab('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 12c2875..e83d5e8 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 _0x5f65=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','length','create','body','catch','find','getFields','findOne','FreshdeskField','filter','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','key'];(function(_0x1bf245,_0x3f9a86){var _0x5c9733=function(_0x4a0122){while(--_0x4a0122){_0x1bf245['push'](_0x1bf245['shift']());}};_0x5c9733(++_0x3f9a86);}(_0x5f65,0x15f));var _0x55f6=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x5f65[_0x9cfe28];return _0x54a1d0;};'use strict';var emlformat=require(_0x55f6('0x0'));var rimraf=require(_0x55f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55f6('0x2'));var rp=require(_0x55f6('0x3'));var moment=require(_0x55f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x55f6('0x5'));var util=require('util');var path=require(_0x55f6('0x6'));var sox=require(_0x55f6('0x7'));var csv=require(_0x55f6('0x8'));var ejs=require(_0x55f6('0x9'));var fs=require('fs');var fs_extra=require(_0x55f6('0xa'));var _=require(_0x55f6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x55f6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x55f6('0x8'));var querystring=require(_0x55f6('0xd'));var Papa=require(_0x55f6('0xe'));var Redis=require(_0x55f6('0xf'));var authService=require(_0x55f6('0x10'));var qs=require(_0x55f6('0x11'));var as=require(_0x55f6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x55f6('0x13'));var utils=require(_0x55f6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x55f6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34462c,_0x3a0c0a){_0x3a0c0a=_0x3a0c0a||0xcc;return function(_0x2a7877){if(_0x2a7877){return _0x34462c[_0x55f6('0x16')](_0x3a0c0a);}return _0x34462c[_0x55f6('0x17')](_0x3a0c0a)[_0x55f6('0x18')]();};}function respondWithResult(_0x150341,_0x147a99){_0x147a99=_0x147a99||0xc8;return function(_0x1e394e){if(_0x1e394e){return _0x150341['status'](_0x147a99)['json'](_0x1e394e);}};}function respondWithFilteredResult(_0xc33cb7,_0x3a6e47){return function(_0x408a2c){if(_0x408a2c){var _0x4d021f=typeof _0x3a6e47['offset']==='undefined'&&typeof _0x3a6e47[_0x55f6('0x19')]===_0x55f6('0x1a');var _0x2a98aa=_0x408a2c[_0x55f6('0x1b')];var _0x5e6aac=_0x4d021f?0x0:_0x3a6e47[_0x55f6('0x1c')];var _0x13754b=_0x4d021f?_0x408a2c[_0x55f6('0x1b')]:_0x3a6e47[_0x55f6('0x1c')]+_0x3a6e47['limit'];var _0x535283;if(_0x13754b>=_0x2a98aa){_0x13754b=_0x2a98aa;_0x535283=0xc8;}else{_0x535283=0xce;}_0xc33cb7[_0x55f6('0x17')](_0x535283);return _0xc33cb7['set'](_0x55f6('0x1d'),_0x5e6aac+'-'+_0x13754b+'/'+_0x2a98aa)['json'](_0x408a2c);}return null;};}function patchUpdates(_0x2ed7a4){return function(_0x5c11fb){try{jsonpatch[_0x55f6('0x1e')](_0x5c11fb,_0x2ed7a4,!![]);}catch(_0x1aa60d){return BPromise['reject'](_0x1aa60d);}return _0x5c11fb['save']();};}function saveUpdates(_0x24ca31,_0x580285){return function(_0x2ab473){if(_0x2ab473){return _0x2ab473[_0x55f6('0x1f')](_0x24ca31)[_0x55f6('0x20')](function(_0x155822){return _0x155822;});}return null;};}function removeEntity(_0x441a02,_0x41b69e){return function(_0x1c8989){if(_0x1c8989){return _0x1c8989[_0x55f6('0x21')]()[_0x55f6('0x20')](function(){_0x441a02[_0x55f6('0x17')](0xcc)[_0x55f6('0x18')]();});}};}function handleEntityNotFound(_0x386417,_0x1ca3e4){return function(_0x5497ee){if(!_0x5497ee){_0x386417['sendStatus'](0x194);}return _0x5497ee;};}function handleError(_0x36b18a,_0x30e04a){_0x30e04a=_0x30e04a||0x1f4;return function(_0x5ce87a){logger[_0x55f6('0x22')](_0x5ce87a[_0x55f6('0x23')]);if(_0x5ce87a[_0x55f6('0x24')]){delete _0x5ce87a[_0x55f6('0x24')];}_0x36b18a[_0x55f6('0x17')](_0x30e04a)[_0x55f6('0x25')](_0x5ce87a);};}exports[_0x55f6('0x26')]=function(_0x5b9201,_0x133c01){var _0x1d4274={},_0x406e0b={},_0xe921b7={'count':0x0,'rows':[]};var _0x363f2e=_[_0x55f6('0x27')](db[_0x55f6('0x28')]['rawAttributes'],function(_0x11fd25){return{'name':_0x11fd25[_0x55f6('0x29')],'type':_0x11fd25[_0x55f6('0x2a')][_0x55f6('0x2b')]};});_0x406e0b[_0x55f6('0x2c')]=_[_0x55f6('0x27')](_0x363f2e,_0x55f6('0x24'));_0x406e0b[_0x55f6('0x2d')]=_[_0x55f6('0x2e')](_0x5b9201[_0x55f6('0x2d')]);_0x406e0b[_0x55f6('0x2f')]=_[_0x55f6('0x30')](_0x406e0b['model'],_0x406e0b['query']);_0x1d4274[_0x55f6('0x31')]=_[_0x55f6('0x30')](_0x406e0b[_0x55f6('0x2c')],qs[_0x55f6('0x32')](_0x5b9201[_0x55f6('0x2d')][_0x55f6('0x32')]));_0x1d4274['attributes']=_0x1d4274[_0x55f6('0x31')]['length']?_0x1d4274[_0x55f6('0x31')]:_0x406e0b[_0x55f6('0x2c')];if(!_0x5b9201[_0x55f6('0x2d')][_0x55f6('0x33')](_0x55f6('0x34'))){_0x1d4274['limit']=qs[_0x55f6('0x19')](_0x5b9201['query'][_0x55f6('0x19')]);_0x1d4274['offset']=qs['offset'](_0x5b9201[_0x55f6('0x2d')][_0x55f6('0x1c')]);}_0x1d4274[_0x55f6('0x35')]=qs[_0x55f6('0x36')](_0x5b9201[_0x55f6('0x2d')][_0x55f6('0x36')]);_0x1d4274['where']=qs[_0x55f6('0x2f')](_[_0x55f6('0x37')](_0x5b9201[_0x55f6('0x2d')],_0x406e0b[_0x55f6('0x2f')]),_0x363f2e);if(_0x5b9201['query']['filter']){_0x1d4274[_0x55f6('0x38')]=_[_0x55f6('0x39')](_0x1d4274[_0x55f6('0x38')],{'$or':_[_0x55f6('0x27')](_0x363f2e,function(_0x1221de){if(_0x1221de[_0x55f6('0x2a')]!==_0x55f6('0x3a')){var _0x14828e={};_0x14828e[_0x1221de[_0x55f6('0x24')]]={'$like':'%'+_0x5b9201[_0x55f6('0x2d')]['filter']+'%'};return _0x14828e;}})});}_0x1d4274=_[_0x55f6('0x39')]({},_0x1d4274,_0x5b9201[_0x55f6('0x3b')]);var _0xda3f70={'where':_0x1d4274[_0x55f6('0x38')]};return db[_0x55f6('0x28')][_0x55f6('0x1b')](_0xda3f70)[_0x55f6('0x20')](function(_0x3e4c3d){_0xe921b7['count']=_0x3e4c3d;if(_0x5b9201[_0x55f6('0x2d')]['includeAll']){_0x1d4274[_0x55f6('0x3c')]=[{'all':!![]}];}return db[_0x55f6('0x28')][_0x55f6('0x3d')](_0x1d4274);})[_0x55f6('0x20')](function(_0xd3bc5a){_0xe921b7[_0x55f6('0x3e')]=_0xd3bc5a;return _0xe921b7;})[_0x55f6('0x20')](respondWithFilteredResult(_0x133c01,_0x1d4274))['catch'](handleError(_0x133c01,null));};exports['show']=function(_0x4f13ef,_0x2214ef){var _0x4c982c={'raw':![],'where':{'id':_0x4f13ef[_0x55f6('0x3f')]['id']}},_0x458320={};_0x458320[_0x55f6('0x2c')]=_[_0x55f6('0x2e')](db[_0x55f6('0x28')][_0x55f6('0x40')]);_0x458320[_0x55f6('0x2d')]=_[_0x55f6('0x2e')](_0x4f13ef[_0x55f6('0x2d')]);_0x458320['filters']=_[_0x55f6('0x30')](_0x458320[_0x55f6('0x2c')],_0x458320[_0x55f6('0x2d')]);_0x4c982c['attributes']=_[_0x55f6('0x30')](_0x458320[_0x55f6('0x2c')],qs[_0x55f6('0x32')](_0x4f13ef[_0x55f6('0x2d')][_0x55f6('0x32')]));_0x4c982c[_0x55f6('0x31')]=_0x4c982c['attributes'][_0x55f6('0x41')]?_0x4c982c[_0x55f6('0x31')]:_0x458320['model'];if(_0x4f13ef[_0x55f6('0x2d')]['includeAll']){_0x4c982c[_0x55f6('0x3c')]=[{'all':!![]}];}_0x4c982c=_[_0x55f6('0x39')]({},_0x4c982c,_0x4f13ef[_0x55f6('0x3b')]);return db['FreshdeskConfiguration']['find'](_0x4c982c)[_0x55f6('0x20')](handleEntityNotFound(_0x2214ef,null))[_0x55f6('0x20')](respondWithResult(_0x2214ef,null))['catch'](handleError(_0x2214ef,null));};exports['create']=function(_0xdeee53,_0x2e5c0c){return db[_0x55f6('0x28')][_0x55f6('0x42')](_0xdeee53[_0x55f6('0x43')],{})['then'](respondWithResult(_0x2e5c0c,0xc9))[_0x55f6('0x44')](handleError(_0x2e5c0c,null));};exports[_0x55f6('0x1f')]=function(_0x33b9cb,_0x13fc5b){if(_0x33b9cb[_0x55f6('0x43')]['id']){delete _0x33b9cb[_0x55f6('0x43')]['id'];}return db['FreshdeskConfiguration'][_0x55f6('0x45')]({'where':{'id':_0x33b9cb[_0x55f6('0x3f')]['id']}})[_0x55f6('0x20')](handleEntityNotFound(_0x13fc5b,null))[_0x55f6('0x20')](saveUpdates(_0x33b9cb['body'],null))['then'](respondWithResult(_0x13fc5b,null))['catch'](handleError(_0x13fc5b,null));};exports['destroy']=function(_0x1ddce3,_0x41cc80){return db[_0x55f6('0x28')]['find']({'where':{'id':_0x1ddce3['params']['id']}})[_0x55f6('0x20')](handleEntityNotFound(_0x41cc80,null))[_0x55f6('0x20')](removeEntity(_0x41cc80,null))[_0x55f6('0x44')](handleError(_0x41cc80,null));};exports[_0x55f6('0x46')]=function(_0x12637b,_0x103e5e,_0x1855b2){var _0x2d01ce={};var _0x5a3e30={};var _0x645574;var _0x80dc6d;return db[_0x55f6('0x28')][_0x55f6('0x47')]({'where':{'id':_0x12637b[_0x55f6('0x3f')]['id']}})[_0x55f6('0x20')](handleEntityNotFound(_0x103e5e,null))[_0x55f6('0x20')](function(_0x561251){if(_0x561251){_0x645574=_0x561251;_0x5a3e30[_0x55f6('0x2c')]=_[_0x55f6('0x2e')](db[_0x55f6('0x48')][_0x55f6('0x40')]);_0x5a3e30[_0x55f6('0x2d')]=_[_0x55f6('0x2e')](_0x12637b[_0x55f6('0x2d')]);_0x5a3e30[_0x55f6('0x2f')]=_[_0x55f6('0x30')](_0x5a3e30['model'],_0x5a3e30[_0x55f6('0x2d')]);_0x2d01ce[_0x55f6('0x31')]=_[_0x55f6('0x30')](_0x5a3e30['model'],qs[_0x55f6('0x32')](_0x12637b[_0x55f6('0x2d')][_0x55f6('0x32')]));_0x2d01ce[_0x55f6('0x31')]=_0x2d01ce[_0x55f6('0x31')][_0x55f6('0x41')]?_0x2d01ce[_0x55f6('0x31')]:_0x5a3e30['model'];_0x2d01ce['order']=qs['sort'](_0x12637b[_0x55f6('0x2d')][_0x55f6('0x36')]);_0x2d01ce[_0x55f6('0x38')]=qs['filters'](_[_0x55f6('0x37')](_0x12637b[_0x55f6('0x2d')],_0x5a3e30['filters']));if(_0x12637b[_0x55f6('0x2d')][_0x55f6('0x49')]){_0x2d01ce[_0x55f6('0x38')]=_['merge'](_0x2d01ce[_0x55f6('0x38')],{'$or':_['map'](_0x2d01ce['attributes'],function(_0x176bd5){var _0x2bc66d={};_0x2bc66d[_0x176bd5]={'$like':'%'+_0x12637b['query'][_0x55f6('0x49')]+'%'};return _0x2bc66d;})});}_0x2d01ce=_[_0x55f6('0x39')]({},_0x2d01ce,_0x12637b['options']);return _0x645574[_0x55f6('0x46')](_0x2d01ce);}})[_0x55f6('0x20')](function(_0x41b646){if(_0x41b646){_0x80dc6d=_0x41b646[_0x55f6('0x41')];if(!_0x12637b[_0x55f6('0x2d')]['hasOwnProperty']('nolimit')){_0x2d01ce['limit']=qs[_0x55f6('0x19')](_0x12637b[_0x55f6('0x2d')]['limit']);_0x2d01ce['offset']=qs['offset'](_0x12637b[_0x55f6('0x2d')]['offset']);}return _0x645574[_0x55f6('0x46')](_0x2d01ce);}})['then'](function(_0x1e6b49){if(_0x1e6b49){return _0x1e6b49?{'count':_0x80dc6d,'rows':_0x1e6b49}:null;}})[_0x55f6('0x20')](respondWithResult(_0x103e5e,null))['catch'](handleError(_0x103e5e,null));};exports[_0x55f6('0x4a')]=function(_0x7eadb1,_0x4d66bf,_0x1554d6){var _0x598b8c={};var _0x28bcf1={};var _0x59bf9d;var _0x2471b4;return db[_0x55f6('0x28')][_0x55f6('0x47')]({'where':{'id':_0x7eadb1['params']['id']}})['then'](handleEntityNotFound(_0x4d66bf,null))[_0x55f6('0x20')](function(_0x337d89){if(_0x337d89){_0x59bf9d=_0x337d89;_0x28bcf1['model']=_['keys'](db[_0x55f6('0x48')][_0x55f6('0x40')]);_0x28bcf1['query']=_[_0x55f6('0x2e')](_0x7eadb1['query']);_0x28bcf1[_0x55f6('0x2f')]=_[_0x55f6('0x30')](_0x28bcf1['model'],_0x28bcf1[_0x55f6('0x2d')]);_0x598b8c[_0x55f6('0x31')]=_['intersection'](_0x28bcf1[_0x55f6('0x2c')],qs[_0x55f6('0x32')](_0x7eadb1[_0x55f6('0x2d')][_0x55f6('0x32')]));_0x598b8c['attributes']=_0x598b8c[_0x55f6('0x31')][_0x55f6('0x41')]?_0x598b8c[_0x55f6('0x31')]:_0x28bcf1[_0x55f6('0x2c')];_0x598b8c[_0x55f6('0x35')]=qs[_0x55f6('0x36')](_0x7eadb1['query']['sort']);_0x598b8c[_0x55f6('0x38')]=qs[_0x55f6('0x2f')](_[_0x55f6('0x37')](_0x7eadb1[_0x55f6('0x2d')],_0x28bcf1['filters']));if(_0x7eadb1['query'][_0x55f6('0x49')]){_0x598b8c['where']=_[_0x55f6('0x39')](_0x598b8c['where'],{'$or':_[_0x55f6('0x27')](_0x598b8c['attributes'],function(_0x461da4){var _0x45da8f={};_0x45da8f[_0x461da4]={'$like':'%'+_0x7eadb1[_0x55f6('0x2d')]['filter']+'%'};return _0x45da8f;})});}_0x598b8c=_[_0x55f6('0x39')]({},_0x598b8c,_0x7eadb1['options']);return _0x59bf9d[_0x55f6('0x4a')](_0x598b8c);}})[_0x55f6('0x20')](function(_0x47a9c8){if(_0x47a9c8){_0x2471b4=_0x47a9c8['length'];if(!_0x7eadb1['query'][_0x55f6('0x33')]('nolimit')){_0x598b8c[_0x55f6('0x19')]=qs['limit'](_0x7eadb1[_0x55f6('0x2d')][_0x55f6('0x19')]);_0x598b8c['offset']=qs[_0x55f6('0x1c')](_0x7eadb1[_0x55f6('0x2d')][_0x55f6('0x1c')]);}return _0x59bf9d[_0x55f6('0x4a')](_0x598b8c);}})['then'](function(_0x7050f3){if(_0x7050f3){return _0x7050f3?{'count':_0x2471b4,'rows':_0x7050f3}:null;}})['then'](respondWithResult(_0x4d66bf,null))['catch'](handleError(_0x4d66bf,null));};exports['getDescriptions']=function(_0x4de649,_0x2e65ae,_0x428db6){var _0xce1407={};var _0x55e00b={};var _0x4316a1;var _0x30970d;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4de649[_0x55f6('0x3f')]['id']}})[_0x55f6('0x20')](handleEntityNotFound(_0x2e65ae,null))['then'](function(_0x294b34){if(_0x294b34){_0x4316a1=_0x294b34;_0x55e00b[_0x55f6('0x2c')]=_[_0x55f6('0x2e')](db[_0x55f6('0x48')][_0x55f6('0x40')]);_0x55e00b['query']=_[_0x55f6('0x2e')](_0x4de649[_0x55f6('0x2d')]);_0x55e00b[_0x55f6('0x2f')]=_[_0x55f6('0x30')](_0x55e00b[_0x55f6('0x2c')],_0x55e00b[_0x55f6('0x2d')]);_0xce1407[_0x55f6('0x31')]=_[_0x55f6('0x30')](_0x55e00b['model'],qs[_0x55f6('0x32')](_0x4de649[_0x55f6('0x2d')][_0x55f6('0x32')]));_0xce1407['attributes']=_0xce1407['attributes'][_0x55f6('0x41')]?_0xce1407[_0x55f6('0x31')]:_0x55e00b[_0x55f6('0x2c')];_0xce1407['order']=qs[_0x55f6('0x36')](_0x4de649[_0x55f6('0x2d')]['sort']);_0xce1407[_0x55f6('0x38')]=qs[_0x55f6('0x2f')](_[_0x55f6('0x37')](_0x4de649['query'],_0x55e00b[_0x55f6('0x2f')]));if(_0x4de649[_0x55f6('0x2d')]['filter']){_0xce1407[_0x55f6('0x38')]=_['merge'](_0xce1407[_0x55f6('0x38')],{'$or':_[_0x55f6('0x27')](_0xce1407['attributes'],function(_0x48c5c4){var _0x2f106d={};_0x2f106d[_0x48c5c4]={'$like':'%'+_0x4de649[_0x55f6('0x2d')][_0x55f6('0x49')]+'%'};return _0x2f106d;})});}_0xce1407=_['merge']({},_0xce1407,_0x4de649[_0x55f6('0x3b')]);return _0x4316a1[_0x55f6('0x4b')](_0xce1407);}})[_0x55f6('0x20')](function(_0xcd8cd9){if(_0xcd8cd9){_0x30970d=_0xcd8cd9['length'];if(!_0x4de649[_0x55f6('0x2d')][_0x55f6('0x33')]('nolimit')){_0xce1407[_0x55f6('0x19')]=qs['limit'](_0x4de649[_0x55f6('0x2d')][_0x55f6('0x19')]);_0xce1407[_0x55f6('0x1c')]=qs[_0x55f6('0x1c')](_0x4de649[_0x55f6('0x2d')]['offset']);}return _0x4316a1[_0x55f6('0x4b')](_0xce1407);}})[_0x55f6('0x20')](function(_0x4c1d75){if(_0x4c1d75){return _0x4c1d75?{'count':_0x30970d,'rows':_0x4c1d75}:null;}})[_0x55f6('0x20')](respondWithResult(_0x2e65ae,null))[_0x55f6('0x44')](handleError(_0x2e65ae,null));};exports[_0x55f6('0x4c')]=function(_0x5bef88,_0x18d116,_0x1d3e94){var _0x2b305d={};var _0x256134={};var _0x2fff9d;var _0x1f75eb;return db[_0x55f6('0x28')]['findOne']({'where':{'id':_0x5bef88[_0x55f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x18d116,null))['then'](function(_0x5d6ce7){if(_0x5d6ce7){_0x2fff9d=_0x5d6ce7;_0x256134['model']=_[_0x55f6('0x2e')](db[_0x55f6('0x4d')][_0x55f6('0x40')]);_0x256134['query']=_[_0x55f6('0x2e')](_0x5bef88[_0x55f6('0x2d')]);_0x256134[_0x55f6('0x2f')]=_['intersection'](_0x256134[_0x55f6('0x2c')],_0x256134[_0x55f6('0x2d')]);_0x2b305d[_0x55f6('0x31')]=_[_0x55f6('0x30')](_0x256134[_0x55f6('0x2c')],qs[_0x55f6('0x32')](_0x5bef88['query'][_0x55f6('0x32')]));_0x2b305d[_0x55f6('0x31')]=_0x2b305d[_0x55f6('0x31')][_0x55f6('0x41')]?_0x2b305d[_0x55f6('0x31')]:_0x256134[_0x55f6('0x2c')];_0x2b305d[_0x55f6('0x35')]=qs[_0x55f6('0x36')](_0x5bef88[_0x55f6('0x2d')][_0x55f6('0x36')]);_0x2b305d[_0x55f6('0x38')]=qs['filters'](_[_0x55f6('0x37')](_0x5bef88[_0x55f6('0x2d')],_0x256134[_0x55f6('0x2f')]));if(_0x5bef88['query']['filter']){_0x2b305d[_0x55f6('0x38')]=_['merge'](_0x2b305d['where'],{'$or':_[_0x55f6('0x27')](_0x2b305d[_0x55f6('0x31')],function(_0x11e2bb){var _0x1f483e={};_0x1f483e[_0x11e2bb]={'$like':'%'+_0x5bef88['query']['filter']+'%'};return _0x1f483e;})});}_0x2b305d=_[_0x55f6('0x39')]({},_0x2b305d,_0x5bef88['options']);return _0x2fff9d[_0x55f6('0x4c')](_0x2b305d);}})['then'](function(_0x5dbdff){if(_0x5dbdff){_0x1f75eb=_0x5dbdff[_0x55f6('0x41')];if(!_0x5bef88[_0x55f6('0x2d')][_0x55f6('0x33')]('nolimit')){_0x2b305d[_0x55f6('0x19')]=qs[_0x55f6('0x19')](_0x5bef88['query'][_0x55f6('0x19')]);_0x2b305d[_0x55f6('0x1c')]=qs['offset'](_0x5bef88[_0x55f6('0x2d')][_0x55f6('0x1c')]);}return _0x2fff9d['getTags'](_0x2b305d);}})[_0x55f6('0x20')](function(_0x24edcb){if(_0x24edcb){return _0x24edcb?{'count':_0x1f75eb,'rows':_0x24edcb}:null;}})[_0x55f6('0x20')](respondWithResult(_0x18d116,null))[_0x55f6('0x44')](handleError(_0x18d116,null));};exports[_0x55f6('0x4e')]=function(_0x396d95,_0x2dc834,_0x3d46e1){if(_0x396d95['body']['id']){delete _0x396d95['body']['id'];}return db[_0x55f6('0x28')][_0x55f6('0x47')]({'where':{'id':_0x396d95[_0x55f6('0x3f')]['id']}})[_0x55f6('0x20')](handleEntityNotFound(_0x2dc834,null))[_0x55f6('0x20')](function(_0x1e7998){if(_0x1e7998){return _0x1e7998[_0x55f6('0x4e')](_0x396d95[_0x55f6('0x43')]['ids']||[]);}return null;})[_0x55f6('0x20')](respondWithResult(_0x2dc834,null))[_0x55f6('0x44')](handleError(_0x2dc834,null));}; \ No newline at end of file +var _0x66e6=['path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','index','FreshdeskConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','catch','params','find','create','body','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x1362bd,_0x26bb29){var _0x43b4f9=function(_0x2749fa){while(--_0x2749fa){_0x1362bd['push'](_0x1362bd['shift']());}};_0x43b4f9(++_0x26bb29);}(_0x66e6,0x19d));var _0x666e=function(_0x200d40,_0x279108){_0x200d40=_0x200d40-0x0;var _0x35c664=_0x66e6[_0x200d40];return _0x35c664;};'use strict';var emlformat=require(_0x666e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x666e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x666e('0x2'));var moment=require(_0x666e('0x3'));var BPromise=require(_0x666e('0x4'));var Mustache=require(_0x666e('0x5'));var util=require(_0x666e('0x6'));var path=require(_0x666e('0x7'));var sox=require('sox');var csv=require(_0x666e('0x8'));var ejs=require(_0x666e('0x9'));var fs=require('fs');var fs_extra=require(_0x666e('0xa'));var _=require(_0x666e('0xb'));var squel=require(_0x666e('0xc'));var crypto=require(_0x666e('0xd'));var jsforce=require(_0x666e('0xe'));var deskjs=require(_0x666e('0xf'));var toCsv=require(_0x666e('0x8'));var querystring=require(_0x666e('0x10'));var Papa=require(_0x666e('0x11'));var Redis=require('ioredis');var authService=require(_0x666e('0x12'));var qs=require(_0x666e('0x13'));var as=require(_0x666e('0x14'));var hardwareService=require(_0x666e('0x15'));var logger=require(_0x666e('0x16'))('api');var utils=require(_0x666e('0x17'));var config=require(_0x666e('0x18'));var licenseUtil=require(_0x666e('0x19'));var db=require(_0x666e('0x1a'))['db'];function respondWithStatusCode(_0x189855,_0x5127f2){_0x5127f2=_0x5127f2||0xcc;return function(_0x44f2e0){if(_0x44f2e0){return _0x189855[_0x666e('0x1b')](_0x5127f2);}return _0x189855[_0x666e('0x1c')](_0x5127f2)[_0x666e('0x1d')]();};}function respondWithResult(_0x3905ee,_0x31b646){_0x31b646=_0x31b646||0xc8;return function(_0x1bc0a8){if(_0x1bc0a8){return _0x3905ee[_0x666e('0x1c')](_0x31b646)[_0x666e('0x1e')](_0x1bc0a8);}};}function respondWithFilteredResult(_0x5355c0,_0x4507a5){return function(_0x13cb23){if(_0x13cb23){var _0x11f7cf=typeof _0x4507a5[_0x666e('0x1f')]===_0x666e('0x20')&&typeof _0x4507a5[_0x666e('0x21')]===_0x666e('0x20');var _0x318cf4=_0x13cb23[_0x666e('0x22')];var _0x16e456=_0x11f7cf?0x0:_0x4507a5['offset'];var _0x229d0f=_0x11f7cf?_0x13cb23['count']:_0x4507a5[_0x666e('0x1f')]+_0x4507a5[_0x666e('0x21')];var _0x1db102;if(_0x229d0f>=_0x318cf4){_0x229d0f=_0x318cf4;_0x1db102=0xc8;}else{_0x1db102=0xce;}_0x5355c0[_0x666e('0x1c')](_0x1db102);return _0x5355c0[_0x666e('0x23')]('Content-Range',_0x16e456+'-'+_0x229d0f+'/'+_0x318cf4)['json'](_0x13cb23);}return null;};}function patchUpdates(_0xd4a063){return function(_0x4006af){try{jsonpatch['apply'](_0x4006af,_0xd4a063,!![]);}catch(_0x12db6f){return BPromise[_0x666e('0x24')](_0x12db6f);}return _0x4006af[_0x666e('0x25')]();};}function saveUpdates(_0x5369b9,_0x5193f2){return function(_0x5bc82d){if(_0x5bc82d){return _0x5bc82d[_0x666e('0x26')](_0x5369b9)[_0x666e('0x27')](function(_0xb7197f){return _0xb7197f;});}return null;};}function removeEntity(_0x1ccab6,_0x966855){return function(_0x40d6ad){if(_0x40d6ad){return _0x40d6ad['destroy']()[_0x666e('0x27')](function(){_0x1ccab6[_0x666e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fa200,_0x1221fe){return function(_0x1fd8a4){if(!_0x1fd8a4){_0x1fa200[_0x666e('0x1b')](0x194);}return _0x1fd8a4;};}function handleError(_0x54b092,_0x2a1225){_0x2a1225=_0x2a1225||0x1f4;return function(_0x391989){logger[_0x666e('0x28')](_0x391989[_0x666e('0x29')]);if(_0x391989['name']){delete _0x391989[_0x666e('0x2a')];}_0x54b092['status'](_0x2a1225)['send'](_0x391989);};}exports[_0x666e('0x2b')]=function(_0x4abd08,_0x33c2ca){var _0x16be36={},_0x1370b3={},_0x3f87df={'count':0x0,'rows':[]};var _0x21be1d=_['map'](db[_0x666e('0x2c')][_0x666e('0x2d')],function(_0xf548aa){return{'name':_0xf548aa['fieldName'],'type':_0xf548aa[_0x666e('0x2e')][_0x666e('0x2f')]};});_0x1370b3[_0x666e('0x30')]=_['map'](_0x21be1d,'name');_0x1370b3['query']=_[_0x666e('0x31')](_0x4abd08[_0x666e('0x32')]);_0x1370b3[_0x666e('0x33')]=_[_0x666e('0x34')](_0x1370b3[_0x666e('0x30')],_0x1370b3[_0x666e('0x32')]);_0x16be36['attributes']=_[_0x666e('0x34')](_0x1370b3[_0x666e('0x30')],qs['fields'](_0x4abd08[_0x666e('0x32')][_0x666e('0x35')]));_0x16be36['attributes']=_0x16be36[_0x666e('0x36')][_0x666e('0x37')]?_0x16be36['attributes']:_0x1370b3[_0x666e('0x30')];if(!_0x4abd08['query'][_0x666e('0x38')](_0x666e('0x39'))){_0x16be36['limit']=qs[_0x666e('0x21')](_0x4abd08['query'][_0x666e('0x21')]);_0x16be36[_0x666e('0x1f')]=qs[_0x666e('0x1f')](_0x4abd08['query'][_0x666e('0x1f')]);}_0x16be36[_0x666e('0x3a')]=qs['sort'](_0x4abd08[_0x666e('0x32')][_0x666e('0x3b')]);_0x16be36[_0x666e('0x3c')]=qs[_0x666e('0x33')](_[_0x666e('0x3d')](_0x4abd08['query'],_0x1370b3[_0x666e('0x33')]),_0x21be1d);if(_0x4abd08[_0x666e('0x32')][_0x666e('0x3e')]){_0x16be36[_0x666e('0x3c')]=_[_0x666e('0x3f')](_0x16be36[_0x666e('0x3c')],{'$or':_[_0x666e('0x40')](_0x21be1d,function(_0x5b6981){if(_0x5b6981[_0x666e('0x2e')]!==_0x666e('0x41')){var _0xb7ed9e={};_0xb7ed9e[_0x5b6981[_0x666e('0x2a')]]={'$like':'%'+_0x4abd08[_0x666e('0x32')][_0x666e('0x3e')]+'%'};return _0xb7ed9e;}})});}_0x16be36=_[_0x666e('0x3f')]({},_0x16be36,_0x4abd08[_0x666e('0x42')]);var _0x3a237b={'where':_0x16be36['where']};return db['FreshdeskConfiguration'][_0x666e('0x22')](_0x3a237b)['then'](function(_0x4a0844){_0x3f87df[_0x666e('0x22')]=_0x4a0844;if(_0x4abd08['query'][_0x666e('0x43')]){_0x16be36[_0x666e('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x16be36);})[_0x666e('0x27')](function(_0x2d525f){_0x3f87df['rows']=_0x2d525f;return _0x3f87df;})[_0x666e('0x27')](respondWithFilteredResult(_0x33c2ca,_0x16be36))[_0x666e('0x45')](handleError(_0x33c2ca,null));};exports['show']=function(_0x1c0eee,_0x203fcf){var _0x11b399={'raw':![],'where':{'id':_0x1c0eee[_0x666e('0x46')]['id']}},_0x1fb318={};_0x1fb318[_0x666e('0x30')]=_[_0x666e('0x31')](db[_0x666e('0x2c')]['rawAttributes']);_0x1fb318[_0x666e('0x32')]=_[_0x666e('0x31')](_0x1c0eee[_0x666e('0x32')]);_0x1fb318[_0x666e('0x33')]=_['intersection'](_0x1fb318['model'],_0x1fb318[_0x666e('0x32')]);_0x11b399[_0x666e('0x36')]=_['intersection'](_0x1fb318[_0x666e('0x30')],qs[_0x666e('0x35')](_0x1c0eee[_0x666e('0x32')][_0x666e('0x35')]));_0x11b399[_0x666e('0x36')]=_0x11b399[_0x666e('0x36')]['length']?_0x11b399['attributes']:_0x1fb318[_0x666e('0x30')];if(_0x1c0eee[_0x666e('0x32')][_0x666e('0x43')]){_0x11b399[_0x666e('0x44')]=[{'all':!![]}];}_0x11b399=_[_0x666e('0x3f')]({},_0x11b399,_0x1c0eee[_0x666e('0x42')]);return db[_0x666e('0x2c')][_0x666e('0x47')](_0x11b399)[_0x666e('0x27')](handleEntityNotFound(_0x203fcf,null))['then'](respondWithResult(_0x203fcf,null))['catch'](handleError(_0x203fcf,null));};exports[_0x666e('0x48')]=function(_0x24d000,_0x153898){return db[_0x666e('0x2c')][_0x666e('0x48')](_0x24d000['body'],{})[_0x666e('0x27')](respondWithResult(_0x153898,0xc9))['catch'](handleError(_0x153898,null));};exports[_0x666e('0x26')]=function(_0x27df4e,_0x396e3a){if(_0x27df4e['body']['id']){delete _0x27df4e[_0x666e('0x49')]['id'];}return db[_0x666e('0x2c')][_0x666e('0x47')]({'where':{'id':_0x27df4e[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x396e3a,null))['then'](saveUpdates(_0x27df4e[_0x666e('0x49')],null))[_0x666e('0x27')](respondWithResult(_0x396e3a,null))[_0x666e('0x45')](handleError(_0x396e3a,null));};exports[_0x666e('0x4a')]=function(_0x40a4e6,_0x55b113){return db[_0x666e('0x2c')][_0x666e('0x47')]({'where':{'id':_0x40a4e6[_0x666e('0x46')]['id']}})['then'](handleEntityNotFound(_0x55b113,null))[_0x666e('0x27')](removeEntity(_0x55b113,null))[_0x666e('0x45')](handleError(_0x55b113,null));};exports[_0x666e('0x4b')]=function(_0x2ed65d,_0x1b3a5a,_0x8a8c6c){var _0x211f16={};var _0x4d49cd={};var _0xd8a9b0;var _0x34d75e;return db[_0x666e('0x2c')][_0x666e('0x4c')]({'where':{'id':_0x2ed65d[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x1b3a5a,null))[_0x666e('0x27')](function(_0x65090e){if(_0x65090e){_0xd8a9b0=_0x65090e;_0x4d49cd[_0x666e('0x30')]=_[_0x666e('0x31')](db[_0x666e('0x4d')][_0x666e('0x2d')]);_0x4d49cd['query']=_[_0x666e('0x31')](_0x2ed65d['query']);_0x4d49cd[_0x666e('0x33')]=_[_0x666e('0x34')](_0x4d49cd[_0x666e('0x30')],_0x4d49cd[_0x666e('0x32')]);_0x211f16[_0x666e('0x36')]=_[_0x666e('0x34')](_0x4d49cd[_0x666e('0x30')],qs[_0x666e('0x35')](_0x2ed65d[_0x666e('0x32')]['fields']));_0x211f16[_0x666e('0x36')]=_0x211f16['attributes'][_0x666e('0x37')]?_0x211f16['attributes']:_0x4d49cd[_0x666e('0x30')];_0x211f16[_0x666e('0x3a')]=qs[_0x666e('0x3b')](_0x2ed65d[_0x666e('0x32')]['sort']);_0x211f16['where']=qs['filters'](_[_0x666e('0x3d')](_0x2ed65d[_0x666e('0x32')],_0x4d49cd[_0x666e('0x33')]));if(_0x2ed65d[_0x666e('0x32')][_0x666e('0x3e')]){_0x211f16[_0x666e('0x3c')]=_[_0x666e('0x3f')](_0x211f16['where'],{'$or':_[_0x666e('0x40')](_0x211f16[_0x666e('0x36')],function(_0x5a702a){var _0x32483b={};_0x32483b[_0x5a702a]={'$like':'%'+_0x2ed65d['query']['filter']+'%'};return _0x32483b;})});}_0x211f16=_[_0x666e('0x3f')]({},_0x211f16,_0x2ed65d[_0x666e('0x42')]);return _0xd8a9b0[_0x666e('0x4b')](_0x211f16);}})[_0x666e('0x27')](function(_0x51330d){if(_0x51330d){_0x34d75e=_0x51330d[_0x666e('0x37')];if(!_0x2ed65d[_0x666e('0x32')][_0x666e('0x38')](_0x666e('0x39'))){_0x211f16[_0x666e('0x21')]=qs[_0x666e('0x21')](_0x2ed65d[_0x666e('0x32')][_0x666e('0x21')]);_0x211f16[_0x666e('0x1f')]=qs[_0x666e('0x1f')](_0x2ed65d['query']['offset']);}return _0xd8a9b0[_0x666e('0x4b')](_0x211f16);}})['then'](function(_0x446f65){if(_0x446f65){return _0x446f65?{'count':_0x34d75e,'rows':_0x446f65}:null;}})[_0x666e('0x27')](respondWithResult(_0x1b3a5a,null))[_0x666e('0x45')](handleError(_0x1b3a5a,null));};exports[_0x666e('0x4e')]=function(_0x4b326a,_0x2b0417,_0x39c90d){var _0x16313d={};var _0xc9c399={};var _0x100c3e;var _0x2b86e0;return db[_0x666e('0x2c')][_0x666e('0x4c')]({'where':{'id':_0x4b326a[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x2b0417,null))[_0x666e('0x27')](function(_0xadffec){if(_0xadffec){_0x100c3e=_0xadffec;_0xc9c399[_0x666e('0x30')]=_[_0x666e('0x31')](db[_0x666e('0x4d')][_0x666e('0x2d')]);_0xc9c399[_0x666e('0x32')]=_[_0x666e('0x31')](_0x4b326a[_0x666e('0x32')]);_0xc9c399[_0x666e('0x33')]=_[_0x666e('0x34')](_0xc9c399['model'],_0xc9c399[_0x666e('0x32')]);_0x16313d[_0x666e('0x36')]=_[_0x666e('0x34')](_0xc9c399[_0x666e('0x30')],qs[_0x666e('0x35')](_0x4b326a['query'][_0x666e('0x35')]));_0x16313d['attributes']=_0x16313d[_0x666e('0x36')][_0x666e('0x37')]?_0x16313d[_0x666e('0x36')]:_0xc9c399['model'];_0x16313d[_0x666e('0x3a')]=qs['sort'](_0x4b326a['query']['sort']);_0x16313d['where']=qs[_0x666e('0x33')](_[_0x666e('0x3d')](_0x4b326a[_0x666e('0x32')],_0xc9c399[_0x666e('0x33')]));if(_0x4b326a['query'][_0x666e('0x3e')]){_0x16313d[_0x666e('0x3c')]=_['merge'](_0x16313d[_0x666e('0x3c')],{'$or':_[_0x666e('0x40')](_0x16313d[_0x666e('0x36')],function(_0x336560){var _0x436794={};_0x436794[_0x336560]={'$like':'%'+_0x4b326a[_0x666e('0x32')][_0x666e('0x3e')]+'%'};return _0x436794;})});}_0x16313d=_['merge']({},_0x16313d,_0x4b326a[_0x666e('0x42')]);return _0x100c3e['getSubjects'](_0x16313d);}})[_0x666e('0x27')](function(_0x5824e5){if(_0x5824e5){_0x2b86e0=_0x5824e5['length'];if(!_0x4b326a['query'][_0x666e('0x38')](_0x666e('0x39'))){_0x16313d['limit']=qs[_0x666e('0x21')](_0x4b326a[_0x666e('0x32')][_0x666e('0x21')]);_0x16313d[_0x666e('0x1f')]=qs[_0x666e('0x1f')](_0x4b326a['query']['offset']);}return _0x100c3e[_0x666e('0x4e')](_0x16313d);}})['then'](function(_0xd703b8){if(_0xd703b8){return _0xd703b8?{'count':_0x2b86e0,'rows':_0xd703b8}:null;}})[_0x666e('0x27')](respondWithResult(_0x2b0417,null))[_0x666e('0x45')](handleError(_0x2b0417,null));};exports['getDescriptions']=function(_0x181c27,_0x55ed52,_0x499995){var _0x332f99={};var _0x33d731={};var _0x52f71e;var _0x2c0184;return db[_0x666e('0x2c')][_0x666e('0x4c')]({'where':{'id':_0x181c27['params']['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x55ed52,null))[_0x666e('0x27')](function(_0x417a73){if(_0x417a73){_0x52f71e=_0x417a73;_0x33d731['model']=_[_0x666e('0x31')](db[_0x666e('0x4d')][_0x666e('0x2d')]);_0x33d731['query']=_['keys'](_0x181c27[_0x666e('0x32')]);_0x33d731['filters']=_[_0x666e('0x34')](_0x33d731[_0x666e('0x30')],_0x33d731[_0x666e('0x32')]);_0x332f99['attributes']=_[_0x666e('0x34')](_0x33d731[_0x666e('0x30')],qs[_0x666e('0x35')](_0x181c27[_0x666e('0x32')][_0x666e('0x35')]));_0x332f99[_0x666e('0x36')]=_0x332f99['attributes'][_0x666e('0x37')]?_0x332f99['attributes']:_0x33d731[_0x666e('0x30')];_0x332f99['order']=qs['sort'](_0x181c27[_0x666e('0x32')]['sort']);_0x332f99[_0x666e('0x3c')]=qs[_0x666e('0x33')](_[_0x666e('0x3d')](_0x181c27[_0x666e('0x32')],_0x33d731[_0x666e('0x33')]));if(_0x181c27[_0x666e('0x32')][_0x666e('0x3e')]){_0x332f99['where']=_['merge'](_0x332f99['where'],{'$or':_[_0x666e('0x40')](_0x332f99[_0x666e('0x36')],function(_0x4a9cd8){var _0x4ba537={};_0x4ba537[_0x4a9cd8]={'$like':'%'+_0x181c27['query'][_0x666e('0x3e')]+'%'};return _0x4ba537;})});}_0x332f99=_['merge']({},_0x332f99,_0x181c27[_0x666e('0x42')]);return _0x52f71e[_0x666e('0x4f')](_0x332f99);}})['then'](function(_0x3bdc0d){if(_0x3bdc0d){_0x2c0184=_0x3bdc0d['length'];if(!_0x181c27[_0x666e('0x32')][_0x666e('0x38')](_0x666e('0x39'))){_0x332f99[_0x666e('0x21')]=qs['limit'](_0x181c27[_0x666e('0x32')][_0x666e('0x21')]);_0x332f99[_0x666e('0x1f')]=qs[_0x666e('0x1f')](_0x181c27[_0x666e('0x32')][_0x666e('0x1f')]);}return _0x52f71e[_0x666e('0x4f')](_0x332f99);}})[_0x666e('0x27')](function(_0x1ee658){if(_0x1ee658){return _0x1ee658?{'count':_0x2c0184,'rows':_0x1ee658}:null;}})[_0x666e('0x27')](respondWithResult(_0x55ed52,null))[_0x666e('0x45')](handleError(_0x55ed52,null));};exports[_0x666e('0x50')]=function(_0x58de28,_0x3bea9e,_0x33e7db){var _0x157e7f={};var _0x19540={};var _0x56a925;var _0x167fcd;return db['FreshdeskConfiguration'][_0x666e('0x4c')]({'where':{'id':_0x58de28[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x3bea9e,null))[_0x666e('0x27')](function(_0x15dea3){if(_0x15dea3){_0x56a925=_0x15dea3;_0x19540[_0x666e('0x30')]=_[_0x666e('0x31')](db[_0x666e('0x51')]['rawAttributes']);_0x19540[_0x666e('0x32')]=_[_0x666e('0x31')](_0x58de28[_0x666e('0x32')]);_0x19540[_0x666e('0x33')]=_[_0x666e('0x34')](_0x19540[_0x666e('0x30')],_0x19540[_0x666e('0x32')]);_0x157e7f[_0x666e('0x36')]=_[_0x666e('0x34')](_0x19540['model'],qs[_0x666e('0x35')](_0x58de28[_0x666e('0x32')][_0x666e('0x35')]));_0x157e7f[_0x666e('0x36')]=_0x157e7f['attributes'][_0x666e('0x37')]?_0x157e7f['attributes']:_0x19540[_0x666e('0x30')];_0x157e7f[_0x666e('0x3a')]=qs[_0x666e('0x3b')](_0x58de28['query'][_0x666e('0x3b')]);_0x157e7f[_0x666e('0x3c')]=qs['filters'](_[_0x666e('0x3d')](_0x58de28[_0x666e('0x32')],_0x19540[_0x666e('0x33')]));if(_0x58de28[_0x666e('0x32')][_0x666e('0x3e')]){_0x157e7f[_0x666e('0x3c')]=_[_0x666e('0x3f')](_0x157e7f[_0x666e('0x3c')],{'$or':_[_0x666e('0x40')](_0x157e7f[_0x666e('0x36')],function(_0x3bcd34){var _0x33703d={};_0x33703d[_0x3bcd34]={'$like':'%'+_0x58de28['query']['filter']+'%'};return _0x33703d;})});}_0x157e7f=_[_0x666e('0x3f')]({},_0x157e7f,_0x58de28[_0x666e('0x42')]);return _0x56a925[_0x666e('0x50')](_0x157e7f);}})[_0x666e('0x27')](function(_0xa93f75){if(_0xa93f75){_0x167fcd=_0xa93f75[_0x666e('0x37')];if(!_0x58de28[_0x666e('0x32')][_0x666e('0x38')](_0x666e('0x39'))){_0x157e7f['limit']=qs[_0x666e('0x21')](_0x58de28[_0x666e('0x32')]['limit']);_0x157e7f[_0x666e('0x1f')]=qs['offset'](_0x58de28['query'][_0x666e('0x1f')]);}return _0x56a925['getTags'](_0x157e7f);}})['then'](function(_0x1e7a57){if(_0x1e7a57){return _0x1e7a57?{'count':_0x167fcd,'rows':_0x1e7a57}:null;}})['then'](respondWithResult(_0x3bea9e,null))[_0x666e('0x45')](handleError(_0x3bea9e,null));};exports[_0x666e('0x52')]=function(_0x515292,_0x51faa4,_0x2e579e){if(_0x515292[_0x666e('0x49')]['id']){delete _0x515292[_0x666e('0x49')]['id'];}return db[_0x666e('0x2c')][_0x666e('0x4c')]({'where':{'id':_0x515292[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x51faa4,null))[_0x666e('0x27')](function(_0x70fb68){if(_0x70fb68){return _0x70fb68[_0x666e('0x52')](_0x515292[_0x666e('0x49')][_0x666e('0x53')]||[]);}return null;})['then'](respondWithResult(_0x51faa4,null))['catch'](handleError(_0x51faa4,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a0360e1..cc8140e 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 _0xe2e4=['FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0xe2e4,0x16d));var _0x4e2e=function(_0x5f415d,_0x39b258){_0x5f415d=_0x5f415d-0x0;var _0x3ac7a6=_0xe2e4[_0x5f415d];return _0x3ac7a6;};'use strict';var _=require(_0x4e2e('0x0'));var util=require(_0x4e2e('0x1'));var logger=require(_0x4e2e('0x2'))(_0x4e2e('0x3'));var moment=require(_0x4e2e('0x4'));var BPromise=require(_0x4e2e('0x5'));var rp=require(_0x4e2e('0x6'));var fs=require('fs');var path=require(_0x4e2e('0x7'));var rimraf=require(_0x4e2e('0x8'));var config=require(_0x4e2e('0x9'));var attributes=require(_0x4e2e('0xa'));module[_0x4e2e('0xb')]=function(_0x59f974,_0x505eda){return _0x59f974[_0x4e2e('0xc')](_0x4e2e('0xd'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fe4=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8fe4,0x175));var _0x48fe=function(_0x4292c7,_0x4dad8b){_0x4292c7=_0x4292c7-0x0;var _0x409d04=_0x8fe4[_0x4292c7];return _0x409d04;};'use strict';var _=require(_0x48fe('0x0'));var util=require(_0x48fe('0x1'));var logger=require(_0x48fe('0x2'))(_0x48fe('0x3'));var moment=require(_0x48fe('0x4'));var BPromise=require(_0x48fe('0x5'));var rp=require(_0x48fe('0x6'));var fs=require('fs');var path=require(_0x48fe('0x7'));var rimraf=require('rimraf');var config=require(_0x48fe('0x8'));var attributes=require(_0x48fe('0x9'));module[_0x48fe('0xa')]=function(_0x3eeb02,_0x22eb5e){return _0x3eeb02[_0x48fe('0xb')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','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 1f603e9..8eccbb7 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 _0x1570=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xd51b98,_0xbd1f5){var _0x548ce8=function(_0x437b2a){while(--_0x437b2a){_0xd51b98['push'](_0xd51b98['shift']());}};_0x548ce8(++_0xbd1f5);}(_0x1570,0x1d0));var _0x0157=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x1570[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x0157('0x0'));var util=require('util');var moment=require(_0x0157('0x1'));var BPromise=require(_0x0157('0x2'));var rs=require(_0x0157('0x3'));var fs=require('fs');var Redis=require(_0x0157('0x4'));var db=require(_0x0157('0x5'))['db'];var utils=require(_0x0157('0x6'));var logger=require('../../config/logger')(_0x0157('0x7'));var config=require(_0x0157('0x8'));var jayson=require(_0x0157('0x9'));var client=jayson[_0x0157('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a72ad,_0x3870ab,_0x34a82a){return new BPromise(function(_0x1801b8,_0x496678){return client['request'](_0x3a72ad,_0x34a82a)[_0x0157('0xb')](function(_0x346e49){logger[_0x0157('0xc')](_0x0157('0xd'),_0x3870ab,_0x0157('0xe'));logger['debug'](_0x0157('0xf'),_0x3870ab,_0x0157('0xe'),JSON[_0x0157('0x10')](_0x346e49));if(_0x346e49['error']){if(_0x346e49[_0x0157('0x11')][_0x0157('0x12')]===0x1f4){logger[_0x0157('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3870ab,_0x346e49['error'][_0x0157('0x13')]);return _0x496678(_0x346e49[_0x0157('0x11')][_0x0157('0x13')]);}logger['error'](_0x0157('0xd'),_0x3870ab,_0x346e49[_0x0157('0x11')][_0x0157('0x13')]);return _0x1801b8(_0x346e49[_0x0157('0x11')][_0x0157('0x13')]);}else{logger['info'](_0x0157('0xd'),_0x3870ab,_0x0157('0xe'));_0x1801b8(_0x346e49[_0x0157('0x14')][_0x0157('0x13')]);}})['catch'](function(_0x5731bb){logger[_0x0157('0x11')](_0x0157('0xd'),_0x3870ab,_0x5731bb);_0x496678(_0x5731bb);});});} \ No newline at end of file +var _0xfb2a=['request','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x38dc89,_0x4844f1){var _0x2a069c=function(_0x345e0b){while(--_0x345e0b){_0x38dc89['push'](_0x38dc89['shift']());}};_0x2a069c(++_0x4844f1);}(_0xfb2a,0x1c3));var _0xafb2=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xfb2a[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xafb2('0x0'));var util=require('util');var moment=require(_0xafb2('0x1'));var BPromise=require(_0xafb2('0x2'));var rs=require(_0xafb2('0x3'));var fs=require('fs');var Redis=require(_0xafb2('0x4'));var db=require(_0xafb2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xafb2('0x6'))(_0xafb2('0x7'));var config=require(_0xafb2('0x8'));var jayson=require(_0xafb2('0x9'));var client=jayson['client'][_0xafb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b7cf7,_0xa47065,_0x1468c9){return new BPromise(function(_0xc48557,_0x1fd167){return client[_0xafb2('0xb')](_0x4b7cf7,_0x1468c9)['then'](function(_0x4b2a93){logger['info'](_0xafb2('0xc'),_0xa47065,'request\x20sent');logger[_0xafb2('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xa47065,_0xafb2('0xe'),JSON['stringify'](_0x4b2a93));if(_0x4b2a93[_0xafb2('0xf')]){if(_0x4b2a93[_0xafb2('0xf')][_0xafb2('0x10')]===0x1f4){logger[_0xafb2('0xf')](_0xafb2('0xc'),_0xa47065,_0x4b2a93[_0xafb2('0xf')][_0xafb2('0x11')]);return _0x1fd167(_0x4b2a93[_0xafb2('0xf')]['message']);}logger[_0xafb2('0xf')](_0xafb2('0xc'),_0xa47065,_0x4b2a93[_0xafb2('0xf')]['message']);return _0xc48557(_0x4b2a93[_0xafb2('0xf')]['message']);}else{logger[_0xafb2('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xa47065,_0xafb2('0xe'));_0xc48557(_0x4b2a93[_0xafb2('0x13')][_0xafb2('0x11')]);}})[_0xafb2('0x14')](function(_0x56780c){logger['error'](_0xafb2('0xc'),_0xa47065,_0x56780c);_0x1fd167(_0x56780c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9d363e3..c0bfc10 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 _0xeccf=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xeccf,0x6c));var _0xfecc=function(_0x1dc05d,_0x53c88d){_0x1dc05d=_0x1dc05d-0x0;var _0x3f95bd=_0xeccf[_0x1dc05d];return _0x3f95bd;};'use strict';var multer=require(_0xfecc('0x0'));var util=require('util');var path=require(_0xfecc('0x1'));var timeout=require('connect-timeout');var express=require(_0xfecc('0x2'));var router=express[_0xfecc('0x3')]();var fs_extra=require(_0xfecc('0x4'));var auth=require(_0xfecc('0x5'));var interaction=require(_0xfecc('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xfecc('0x7')]('/',auth[_0xfecc('0x8')](),controller[_0xfecc('0x9')]);router[_0xfecc('0x7')](_0xfecc('0xa'),auth[_0xfecc('0x8')](),controller['show']);router[_0xfecc('0xb')]('/',auth[_0xfecc('0x8')](),controller[_0xfecc('0xc')]);router[_0xfecc('0xd')](_0xfecc('0xa'),auth[_0xfecc('0x8')](),controller[_0xfecc('0xe')]);router[_0xfecc('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xfecc('0x10')]);module[_0xfecc('0x11')]=router; \ No newline at end of file +var _0xd1cf=['/:id','show','post','create','put','multer','util','path','connect-timeout','express','Router','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0xd1cf,0x140));var _0xfd1c=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0xd1cf[_0x3f59b1];return _0x11d2e8;};'use strict';var multer=require(_0xfd1c('0x0'));var util=require(_0xfd1c('0x1'));var path=require(_0xfd1c('0x2'));var timeout=require(_0xfd1c('0x3'));var express=require(_0xfd1c('0x4'));var router=express[_0xfd1c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd1c('0x6'));var controller=require(_0xfd1c('0x7'));router[_0xfd1c('0x8')]('/',auth[_0xfd1c('0x9')](),controller['index']);router[_0xfd1c('0x8')](_0xfd1c('0xa'),auth[_0xfd1c('0x9')](),controller[_0xfd1c('0xb')]);router[_0xfd1c('0xc')]('/',auth['isAuthenticated'](),controller[_0xfd1c('0xd')]);router[_0xfd1c('0xe')](_0xfd1c('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7b4df94..0781607 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 _0x371c=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x4794a0,_0x462129){var _0x21ccbe=function(_0x6d6a63){while(--_0x6d6a63){_0x4794a0['push'](_0x4794a0['shift']());}};_0x21ccbe(++_0x462129);}(_0x371c,0x1ba));var _0xc371=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x371c[_0x342700];return _0x53406f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xc371('0x0')](_0xc371('0x1'),_0xc371('0x2'),_0xc371('0x3'),_0xc371('0x4'),'picklist'),'defaultValue':_0xc371('0x1')},'content':{'type':Sequelize[_0xc371('0x5')]},'key':{'type':Sequelize[_0xc371('0x5')]},'keyType':{'type':Sequelize[_0xc371('0x0')](_0xc371('0x1'),'variable',_0xc371('0x3'))},'keyContent':{'type':Sequelize[_0xc371('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc371('0x5')]},'customField':{'type':Sequelize[_0xc371('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc371('0x5')]}}; \ No newline at end of file +var _0x5a1c=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x15a34f,_0x1378ba){var _0x2e7b6b=function(_0x1fbfa2){while(--_0x1fbfa2){_0x15a34f['push'](_0x15a34f['shift']());}};_0x2e7b6b(++_0x1378ba);}(_0x5a1c,0xb7));var _0xc5a1=function(_0x2ee497,_0x56cc42){_0x2ee497=_0x2ee497-0x0;var _0x26ff38=_0x5a1c[_0x2ee497];return _0x26ff38;};'use strict';var Sequelize=require(_0xc5a1('0x0'));module[_0xc5a1('0x1')]={'type':{'type':Sequelize[_0xc5a1('0x2')](_0xc5a1('0x3'),_0xc5a1('0x4'),_0xc5a1('0x5'),'keyValue',_0xc5a1('0x6')),'defaultValue':_0xc5a1('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc5a1('0x7')]},'keyType':{'type':Sequelize[_0xc5a1('0x2')](_0xc5a1('0x3'),_0xc5a1('0x4'),_0xc5a1('0x5'))},'keyContent':{'type':Sequelize[_0xc5a1('0x7')]},'idField':{'type':Sequelize[_0xc5a1('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc5a1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 00dc78c..510ede5 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 _0x1752=['name','send','index','map','type','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FreshdeskField','includeAll','findAll','catch','show','params','fields','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','error','stack'];(function(_0x494da0,_0x141b30){var _0x41ef47=function(_0x668f20){while(--_0x668f20){_0x494da0['push'](_0x494da0['shift']());}};_0x41ef47(++_0x141b30);}(_0x1752,0xa5));var _0x2175=function(_0x67633d,_0x555a5c){_0x67633d=_0x67633d-0x0;var _0x46dbad=_0x1752[_0x67633d];return _0x46dbad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2175('0x0'));var zipdir=require(_0x2175('0x1'));var jsonpatch=require(_0x2175('0x2'));var rp=require(_0x2175('0x3'));var moment=require(_0x2175('0x4'));var BPromise=require(_0x2175('0x5'));var Mustache=require('mustache');var util=require(_0x2175('0x6'));var path=require(_0x2175('0x7'));var sox=require(_0x2175('0x8'));var csv=require(_0x2175('0x9'));var ejs=require(_0x2175('0xa'));var fs=require('fs');var fs_extra=require(_0x2175('0xb'));var _=require(_0x2175('0xc'));var squel=require(_0x2175('0xd'));var crypto=require(_0x2175('0xe'));var jsforce=require(_0x2175('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2175('0x9'));var querystring=require(_0x2175('0x10'));var Papa=require(_0x2175('0x11'));var Redis=require(_0x2175('0x12'));var authService=require(_0x2175('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2175('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2175('0x15'))['db'];function respondWithStatusCode(_0x5bc446,_0x43be3c){_0x43be3c=_0x43be3c||0xcc;return function(_0x393c02){if(_0x393c02){return _0x5bc446['sendStatus'](_0x43be3c);}return _0x5bc446[_0x2175('0x16')](_0x43be3c)[_0x2175('0x17')]();};}function respondWithResult(_0x45df73,_0x3bc01f){_0x3bc01f=_0x3bc01f||0xc8;return function(_0x21d4cd){if(_0x21d4cd){return _0x45df73[_0x2175('0x16')](_0x3bc01f)[_0x2175('0x18')](_0x21d4cd);}};}function respondWithFilteredResult(_0x413688,_0x5d84db){return function(_0x55b798){if(_0x55b798){var _0x371b42=typeof _0x5d84db[_0x2175('0x19')]===_0x2175('0x1a')&&typeof _0x5d84db['limit']==='undefined';var _0x588b0b=_0x55b798[_0x2175('0x1b')];var _0x377586=_0x371b42?0x0:_0x5d84db['offset'];var _0x53576c=_0x371b42?_0x55b798[_0x2175('0x1b')]:_0x5d84db[_0x2175('0x19')]+_0x5d84db[_0x2175('0x1c')];var _0x51628d;if(_0x53576c>=_0x588b0b){_0x53576c=_0x588b0b;_0x51628d=0xc8;}else{_0x51628d=0xce;}_0x413688[_0x2175('0x16')](_0x51628d);return _0x413688['set'](_0x2175('0x1d'),_0x377586+'-'+_0x53576c+'/'+_0x588b0b)['json'](_0x55b798);}return null;};}function patchUpdates(_0x37818a){return function(_0x4ec36c){try{jsonpatch['apply'](_0x4ec36c,_0x37818a,!![]);}catch(_0x5344af){return BPromise[_0x2175('0x1e')](_0x5344af);}return _0x4ec36c['save']();};}function saveUpdates(_0x28c4b8,_0x46ea57){return function(_0x2dd77b){if(_0x2dd77b){return _0x2dd77b[_0x2175('0x1f')](_0x28c4b8)[_0x2175('0x20')](function(_0x12d150){return _0x12d150;});}return null;};}function removeEntity(_0x5ac63e,_0x49d4b9){return function(_0x3d849e){if(_0x3d849e){return _0x3d849e[_0x2175('0x21')]()[_0x2175('0x20')](function(){_0x5ac63e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c6374,_0xe252f0){return function(_0x2204cd){if(!_0x2204cd){_0x9c6374['sendStatus'](0x194);}return _0x2204cd;};}function handleError(_0x224fa3,_0x4d2120){_0x4d2120=_0x4d2120||0x1f4;return function(_0x5e696c){logger[_0x2175('0x22')](_0x5e696c[_0x2175('0x23')]);if(_0x5e696c[_0x2175('0x24')]){delete _0x5e696c[_0x2175('0x24')];}_0x224fa3[_0x2175('0x16')](_0x4d2120)[_0x2175('0x25')](_0x5e696c);};}exports[_0x2175('0x26')]=function(_0x40d8c8,_0x1b807b){var _0x1c721d={},_0x7b6edb={},_0x56dcf9={'count':0x0,'rows':[]};var _0x20fccf=_[_0x2175('0x27')](db['FreshdeskField']['rawAttributes'],function(_0x3d64ac){return{'name':_0x3d64ac['fieldName'],'type':_0x3d64ac[_0x2175('0x28')]['key']};});_0x7b6edb['model']=_['map'](_0x20fccf,_0x2175('0x24'));_0x7b6edb[_0x2175('0x29')]=_[_0x2175('0x2a')](_0x40d8c8[_0x2175('0x29')]);_0x7b6edb['filters']=_[_0x2175('0x2b')](_0x7b6edb[_0x2175('0x2c')],_0x7b6edb['query']);_0x1c721d[_0x2175('0x2d')]=_[_0x2175('0x2b')](_0x7b6edb['model'],qs['fields'](_0x40d8c8['query']['fields']));_0x1c721d[_0x2175('0x2d')]=_0x1c721d[_0x2175('0x2d')][_0x2175('0x2e')]?_0x1c721d[_0x2175('0x2d')]:_0x7b6edb[_0x2175('0x2c')];if(!_0x40d8c8[_0x2175('0x29')][_0x2175('0x2f')](_0x2175('0x30'))){_0x1c721d['limit']=qs['limit'](_0x40d8c8['query']['limit']);_0x1c721d['offset']=qs[_0x2175('0x19')](_0x40d8c8[_0x2175('0x29')]['offset']);}_0x1c721d[_0x2175('0x31')]=qs[_0x2175('0x32')](_0x40d8c8[_0x2175('0x29')][_0x2175('0x32')]);_0x1c721d[_0x2175('0x33')]=qs[_0x2175('0x34')](_['pick'](_0x40d8c8[_0x2175('0x29')],_0x7b6edb[_0x2175('0x34')]),_0x20fccf);if(_0x40d8c8[_0x2175('0x29')][_0x2175('0x35')]){_0x1c721d[_0x2175('0x33')]=_[_0x2175('0x36')](_0x1c721d[_0x2175('0x33')],{'$or':_[_0x2175('0x27')](_0x20fccf,function(_0x38c212){if(_0x38c212[_0x2175('0x28')]!==_0x2175('0x37')){var _0x4be65c={};_0x4be65c[_0x38c212[_0x2175('0x24')]]={'$like':'%'+_0x40d8c8[_0x2175('0x29')][_0x2175('0x35')]+'%'};return _0x4be65c;}})});}_0x1c721d=_['merge']({},_0x1c721d,_0x40d8c8['options']);var _0x932bb6={'where':_0x1c721d['where']};return db[_0x2175('0x38')][_0x2175('0x1b')](_0x932bb6)[_0x2175('0x20')](function(_0x4989df){_0x56dcf9['count']=_0x4989df;if(_0x40d8c8[_0x2175('0x29')][_0x2175('0x39')]){_0x1c721d['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x2175('0x3a')](_0x1c721d);})[_0x2175('0x20')](function(_0x61784d){_0x56dcf9['rows']=_0x61784d;return _0x56dcf9;})[_0x2175('0x20')](respondWithFilteredResult(_0x1b807b,_0x1c721d))[_0x2175('0x3b')](handleError(_0x1b807b,null));};exports[_0x2175('0x3c')]=function(_0x5a6679,_0x49cf7d){var _0x459cee={'raw':!![],'where':{'id':_0x5a6679[_0x2175('0x3d')]['id']}},_0x47f60d={};_0x47f60d[_0x2175('0x2c')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x47f60d[_0x2175('0x29')]=_['keys'](_0x5a6679['query']);_0x47f60d[_0x2175('0x34')]=_['intersection'](_0x47f60d[_0x2175('0x2c')],_0x47f60d[_0x2175('0x29')]);_0x459cee[_0x2175('0x2d')]=_[_0x2175('0x2b')](_0x47f60d[_0x2175('0x2c')],qs[_0x2175('0x3e')](_0x5a6679['query'][_0x2175('0x3e')]));_0x459cee[_0x2175('0x2d')]=_0x459cee[_0x2175('0x2d')][_0x2175('0x2e')]?_0x459cee[_0x2175('0x2d')]:_0x47f60d[_0x2175('0x2c')];if(_0x5a6679['query'][_0x2175('0x39')]){_0x459cee[_0x2175('0x3f')]=[{'all':!![]}];}_0x459cee=_[_0x2175('0x36')]({},_0x459cee,_0x5a6679['options']);return db[_0x2175('0x38')]['find'](_0x459cee)['then'](handleEntityNotFound(_0x49cf7d,null))[_0x2175('0x20')](respondWithResult(_0x49cf7d,null))[_0x2175('0x3b')](handleError(_0x49cf7d,null));};exports[_0x2175('0x40')]=function(_0x5ee4aa,_0x32d6eb){return db[_0x2175('0x38')][_0x2175('0x40')](_0x5ee4aa[_0x2175('0x41')],{})[_0x2175('0x20')](respondWithResult(_0x32d6eb,0xc9))['catch'](handleError(_0x32d6eb,null));};exports['update']=function(_0xdb0a97,_0xeaabe3){if(_0xdb0a97[_0x2175('0x41')]['id']){delete _0xdb0a97[_0x2175('0x41')]['id'];}return db[_0x2175('0x38')]['find']({'where':{'id':_0xdb0a97[_0x2175('0x3d')]['id']}})[_0x2175('0x20')](handleEntityNotFound(_0xeaabe3,null))[_0x2175('0x20')](saveUpdates(_0xdb0a97['body'],null))['then'](respondWithResult(_0xeaabe3,null))[_0x2175('0x3b')](handleError(_0xeaabe3,null));};exports['destroy']=function(_0x5af419,_0x5bab81){return db['FreshdeskField'][_0x2175('0x42')]({'where':{'id':_0x5af419[_0x2175('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5bab81,null))['then'](removeEntity(_0x5bab81,null))['catch'](handleError(_0x5bab81,null));}; \ No newline at end of file +var _0x5b02=['length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','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','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','name','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys'];(function(_0x3fed1c,_0x4b1ca8){var _0x1b6393=function(_0x118484){while(--_0x118484){_0x3fed1c['push'](_0x3fed1c['shift']());}};_0x1b6393(++_0x4b1ca8);}(_0x5b02,0xe9));var _0x25b0=function(_0x488f0a,_0x54ac16){_0x488f0a=_0x488f0a-0x0;var _0x32bfa8=_0x5b02[_0x488f0a];return _0x32bfa8;};'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'];function respondWithStatusCode(_0x1d3178,_0x184452){_0x184452=_0x184452||0xcc;return function(_0x26a34f){if(_0x26a34f){return _0x1d3178[_0x25b0('0x19')](_0x184452);}return _0x1d3178[_0x25b0('0x1a')](_0x184452)[_0x25b0('0x1b')]();};}function respondWithResult(_0x42cc07,_0x293203){_0x293203=_0x293203||0xc8;return function(_0x211658){if(_0x211658){return _0x42cc07[_0x25b0('0x1a')](_0x293203)[_0x25b0('0x1c')](_0x211658);}};}function respondWithFilteredResult(_0x40071c,_0x5ac18d){return function(_0x51542b){if(_0x51542b){var _0xfe1ea6=typeof _0x5ac18d['offset']===_0x25b0('0x1d')&&typeof _0x5ac18d[_0x25b0('0x1e')]===_0x25b0('0x1d');var _0x3267b9=_0x51542b['count'];var _0x1d850f=_0xfe1ea6?0x0:_0x5ac18d[_0x25b0('0x1f')];var _0x20762e=_0xfe1ea6?_0x51542b[_0x25b0('0x20')]:_0x5ac18d[_0x25b0('0x1f')]+_0x5ac18d[_0x25b0('0x1e')];var _0x54f458;if(_0x20762e>=_0x3267b9){_0x20762e=_0x3267b9;_0x54f458=0xc8;}else{_0x54f458=0xce;}_0x40071c[_0x25b0('0x1a')](_0x54f458);return _0x40071c[_0x25b0('0x21')](_0x25b0('0x22'),_0x1d850f+'-'+_0x20762e+'/'+_0x3267b9)[_0x25b0('0x1c')](_0x51542b);}return null;};}function patchUpdates(_0x1dc691){return function(_0xea4162){try{jsonpatch[_0x25b0('0x23')](_0xea4162,_0x1dc691,!![]);}catch(_0x19599b){return BPromise[_0x25b0('0x24')](_0x19599b);}return _0xea4162[_0x25b0('0x25')]();};}function saveUpdates(_0x2b2eda,_0x3ce1da){return function(_0x5cb746){if(_0x5cb746){return _0x5cb746[_0x25b0('0x26')](_0x2b2eda)[_0x25b0('0x27')](function(_0x517ec5){return _0x517ec5;});}return null;};}function removeEntity(_0x2d7c17,_0x2023d8){return function(_0x3546f0){if(_0x3546f0){return _0x3546f0['destroy']()['then'](function(){_0x2d7c17['status'](0xcc)[_0x25b0('0x1b')]();});}};}function handleEntityNotFound(_0x433085,_0x99bd3a){return function(_0x24f847){if(!_0x24f847){_0x433085[_0x25b0('0x19')](0x194);}return _0x24f847;};}function handleError(_0x23b396,_0x40268a){_0x40268a=_0x40268a||0x1f4;return function(_0x75ce7a){logger[_0x25b0('0x28')](_0x75ce7a['stack']);if(_0x75ce7a[_0x25b0('0x29')]){delete _0x75ce7a[_0x25b0('0x29')];}_0x23b396['status'](_0x40268a)['send'](_0x75ce7a);};}exports['index']=function(_0x1a6212,_0x3f0a54){var _0x251fad={},_0x105129={},_0x214377={'count':0x0,'rows':[]};var _0x3285ae=_[_0x25b0('0x2a')](db[_0x25b0('0x2b')][_0x25b0('0x2c')],function(_0x285a2b){return{'name':_0x285a2b[_0x25b0('0x2d')],'type':_0x285a2b[_0x25b0('0x2e')][_0x25b0('0x2f')]};});_0x105129['model']=_['map'](_0x3285ae,_0x25b0('0x29'));_0x105129['query']=_['keys'](_0x1a6212[_0x25b0('0x30')]);_0x105129[_0x25b0('0x31')]=_[_0x25b0('0x32')](_0x105129[_0x25b0('0x33')],_0x105129[_0x25b0('0x30')]);_0x251fad['attributes']=_[_0x25b0('0x32')](_0x105129[_0x25b0('0x33')],qs['fields'](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x34')]));_0x251fad['attributes']=_0x251fad[_0x25b0('0x35')]['length']?_0x251fad[_0x25b0('0x35')]:_0x105129[_0x25b0('0x33')];if(!_0x1a6212[_0x25b0('0x30')][_0x25b0('0x36')](_0x25b0('0x37'))){_0x251fad[_0x25b0('0x1e')]=qs[_0x25b0('0x1e')](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x1e')]);_0x251fad['offset']=qs[_0x25b0('0x1f')](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x1f')]);}_0x251fad[_0x25b0('0x38')]=qs[_0x25b0('0x39')](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x39')]);_0x251fad[_0x25b0('0x3a')]=qs[_0x25b0('0x31')](_[_0x25b0('0x3b')](_0x1a6212['query'],_0x105129[_0x25b0('0x31')]),_0x3285ae);if(_0x1a6212[_0x25b0('0x30')][_0x25b0('0x3c')]){_0x251fad['where']=_[_0x25b0('0x3d')](_0x251fad[_0x25b0('0x3a')],{'$or':_[_0x25b0('0x2a')](_0x3285ae,function(_0x43e140){if(_0x43e140[_0x25b0('0x2e')]!==_0x25b0('0x3e')){var _0x28f1cd={};_0x28f1cd[_0x43e140[_0x25b0('0x29')]]={'$like':'%'+_0x1a6212['query']['filter']+'%'};return _0x28f1cd;}})});}_0x251fad=_[_0x25b0('0x3d')]({},_0x251fad,_0x1a6212[_0x25b0('0x3f')]);var _0x3f4ae0={'where':_0x251fad['where']};return db[_0x25b0('0x2b')]['count'](_0x3f4ae0)[_0x25b0('0x27')](function(_0x39617a){_0x214377[_0x25b0('0x20')]=_0x39617a;if(_0x1a6212[_0x25b0('0x30')][_0x25b0('0x40')]){_0x251fad['include']=[{'all':!![]}];}return db[_0x25b0('0x2b')][_0x25b0('0x41')](_0x251fad);})[_0x25b0('0x27')](function(_0x376d8a){_0x214377[_0x25b0('0x42')]=_0x376d8a;return _0x214377;})['then'](respondWithFilteredResult(_0x3f0a54,_0x251fad))[_0x25b0('0x43')](handleError(_0x3f0a54,null));};exports[_0x25b0('0x44')]=function(_0x3d1262,_0x44c400){var _0x35fc00={'raw':!![],'where':{'id':_0x3d1262[_0x25b0('0x45')]['id']}},_0x1adf8d={};_0x1adf8d[_0x25b0('0x33')]=_[_0x25b0('0x46')](db[_0x25b0('0x2b')][_0x25b0('0x2c')]);_0x1adf8d['query']=_[_0x25b0('0x46')](_0x3d1262['query']);_0x1adf8d[_0x25b0('0x31')]=_[_0x25b0('0x32')](_0x1adf8d[_0x25b0('0x33')],_0x1adf8d[_0x25b0('0x30')]);_0x35fc00['attributes']=_[_0x25b0('0x32')](_0x1adf8d[_0x25b0('0x33')],qs[_0x25b0('0x34')](_0x3d1262['query'][_0x25b0('0x34')]));_0x35fc00[_0x25b0('0x35')]=_0x35fc00[_0x25b0('0x35')][_0x25b0('0x47')]?_0x35fc00[_0x25b0('0x35')]:_0x1adf8d[_0x25b0('0x33')];if(_0x3d1262[_0x25b0('0x30')]['includeAll']){_0x35fc00[_0x25b0('0x48')]=[{'all':!![]}];}_0x35fc00=_[_0x25b0('0x3d')]({},_0x35fc00,_0x3d1262[_0x25b0('0x3f')]);return db['FreshdeskField'][_0x25b0('0x49')](_0x35fc00)[_0x25b0('0x27')](handleEntityNotFound(_0x44c400,null))[_0x25b0('0x27')](respondWithResult(_0x44c400,null))[_0x25b0('0x43')](handleError(_0x44c400,null));};exports[_0x25b0('0x4a')]=function(_0x568d83,_0x1e8a8d){return db[_0x25b0('0x2b')][_0x25b0('0x4a')](_0x568d83['body'],{})[_0x25b0('0x27')](respondWithResult(_0x1e8a8d,0xc9))[_0x25b0('0x43')](handleError(_0x1e8a8d,null));};exports[_0x25b0('0x26')]=function(_0x1d6d55,_0x29165e){if(_0x1d6d55[_0x25b0('0x4b')]['id']){delete _0x1d6d55['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x1d6d55[_0x25b0('0x45')]['id']}})['then'](handleEntityNotFound(_0x29165e,null))['then'](saveUpdates(_0x1d6d55[_0x25b0('0x4b')],null))['then'](respondWithResult(_0x29165e,null))[_0x25b0('0x43')](handleError(_0x29165e,null));};exports['destroy']=function(_0x4fc22d,_0x394e52){return db[_0x25b0('0x2b')][_0x25b0('0x49')]({'where':{'id':_0x4fc22d[_0x25b0('0x45')]['id']}})[_0x25b0('0x27')](handleEntityNotFound(_0x394e52,null))[_0x25b0('0x27')](removeEntity(_0x394e52,null))[_0x25b0('0x43')](handleError(_0x394e52,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0f486fc..da513af 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 _0xc3d8=['rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2881e2,_0x341293){var _0x5c1e1f=function(_0x10ba61){while(--_0x10ba61){_0x2881e2['push'](_0x2881e2['shift']());}};_0x5c1e1f(++_0x341293);}(_0xc3d8,0x70));var _0x8c3d=function(_0x275c0f,_0xe3bbd4){_0x275c0f=_0x275c0f-0x0;var _0x131134=_0xc3d8[_0x275c0f];return _0x131134;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8c3d('0x0'))(_0x8c3d('0x1'));var moment=require('moment');var BPromise=require(_0x8c3d('0x2'));var rp=require(_0x8c3d('0x3'));var fs=require('fs');var path=require(_0x8c3d('0x4'));var rimraf=require(_0x8c3d('0x5'));var config=require(_0x8c3d('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x8c3d('0x7')]=function(_0x277cb9,_0xf4fa30){return _0x277cb9[_0x8c3d('0x8')](_0x8c3d('0x9'),attributes,{'tableName':_0x8c3d('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x8c3d('0xb'),_0x8c3d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c53=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0xc125ac,_0x446552){var _0x4daccf=function(_0x1ed278){while(--_0x1ed278){_0xc125ac['push'](_0xc125ac['shift']());}};_0x4daccf(++_0x446552);}(_0x7c53,0xbb));var _0x37c5=function(_0x2524fd,_0x3f2151){_0x2524fd=_0x2524fd-0x0;var _0x77ec95=_0x7c53[_0x2524fd];return _0x77ec95;};'use strict';var _=require(_0x37c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x37c5('0x1'));var BPromise=require(_0x37c5('0x2'));var rp=require(_0x37c5('0x3'));var fs=require('fs');var path=require(_0x37c5('0x4'));var rimraf=require(_0x37c5('0x5'));var config=require(_0x37c5('0x6'));var attributes=require(_0x37c5('0x7'));module['exports']=function(_0x186929,_0x9ce684){return _0x186929[_0x37c5('0x8')](_0x37c5('0x9'),attributes,{'tableName':_0x37c5('0xa'),'paranoid':![],'indexes':[{'name':_0x37c5('0xb'),'fields':[_0x37c5('0xc'),_0x37c5('0xd')],'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 f81b163..ed016b6 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 _0x8c63=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa46278,_0x3e128b){var _0x369c26=function(_0x2d7710){while(--_0x2d7710){_0xa46278['push'](_0xa46278['shift']());}};_0x369c26(++_0x3e128b);}(_0x8c63,0xb9));var _0x38c6=function(_0x39e566,_0x1007c9){_0x39e566=_0x39e566-0x0;var _0x172214=_0x8c63[_0x39e566];return _0x172214;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38c6('0x0'));var BPromise=require(_0x38c6('0x1'));var rs=require(_0x38c6('0x2'));var fs=require('fs');var Redis=require(_0x38c6('0x3'));var db=require(_0x38c6('0x4'))['db'];var utils=require(_0x38c6('0x5'));var logger=require(_0x38c6('0x6'))(_0x38c6('0x7'));var config=require(_0x38c6('0x8'));var jayson=require(_0x38c6('0x9'));var client=jayson[_0x38c6('0xa')][_0x38c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2374a8,_0x5e41e9,_0x31dd1b){return new BPromise(function(_0x5ce733,_0x26ada8){return client[_0x38c6('0xc')](_0x2374a8,_0x31dd1b)[_0x38c6('0xd')](function(_0x2c8987){logger[_0x38c6('0xe')](_0x38c6('0xf'),_0x5e41e9,_0x38c6('0x10'));logger['debug'](_0x38c6('0x11'),_0x5e41e9,_0x38c6('0x10'),JSON[_0x38c6('0x12')](_0x2c8987));if(_0x2c8987[_0x38c6('0x13')]){if(_0x2c8987[_0x38c6('0x13')][_0x38c6('0x14')]===0x1f4){logger['error'](_0x38c6('0xf'),_0x5e41e9,_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);return _0x26ada8(_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);}logger[_0x38c6('0x13')](_0x38c6('0xf'),_0x5e41e9,_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);return _0x5ce733(_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);}else{logger[_0x38c6('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x5e41e9,_0x38c6('0x10'));_0x5ce733(_0x2c8987['result'][_0x38c6('0x15')]);}})[_0x38c6('0x16')](function(_0x515beb){logger[_0x38c6('0x13')](_0x38c6('0xf'),_0x5e41e9,_0x515beb);_0x26ada8(_0x515beb);});});} \ No newline at end of file +var _0x2930=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','randomstring','../../mysqldb'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x2930,0x9e));var _0x0293=function(_0x21268e,_0x55faa4){_0x21268e=_0x21268e-0x0;var _0x125d40=_0x2930[_0x21268e];return _0x125d40;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0293('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0293('0x1'))['db'];var utils=require(_0x0293('0x2'));var logger=require(_0x0293('0x3'))(_0x0293('0x4'));var config=require(_0x0293('0x5'));var jayson=require(_0x0293('0x6'));var client=jayson[_0x0293('0x7')][_0x0293('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x340473,_0x4dd6e3,_0x448df7){return new BPromise(function(_0x50333e,_0x195493){return client[_0x0293('0x9')](_0x340473,_0x448df7)[_0x0293('0xa')](function(_0x22513b){logger[_0x0293('0xb')](_0x0293('0xc'),_0x4dd6e3,'request\x20sent');logger[_0x0293('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4dd6e3,_0x0293('0xe'),JSON[_0x0293('0xf')](_0x22513b));if(_0x22513b[_0x0293('0x10')]){if(_0x22513b['error']['code']===0x1f4){logger[_0x0293('0x10')](_0x0293('0xc'),_0x4dd6e3,_0x22513b['error'][_0x0293('0x11')]);return _0x195493(_0x22513b[_0x0293('0x10')]['message']);}logger[_0x0293('0x10')](_0x0293('0xc'),_0x4dd6e3,_0x22513b[_0x0293('0x10')][_0x0293('0x11')]);return _0x50333e(_0x22513b[_0x0293('0x10')][_0x0293('0x11')]);}else{logger[_0x0293('0xb')](_0x0293('0xc'),_0x4dd6e3,'request\x20sent');_0x50333e(_0x22513b[_0x0293('0x12')][_0x0293('0x11')]);}})[_0x0293('0x13')](function(_0x234bc4){logger[_0x0293('0x10')](_0x0293('0xc'),_0x4dd6e3,_0x234bc4);_0x195493(_0x234bc4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 849fec8..fad7bfb 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 _0xae60=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x51733,_0x87aab7){var _0x1baebd=function(_0x29fde6){while(--_0x29fde6){_0x51733['push'](_0x51733['shift']());}};_0x1baebd(++_0x87aab7);}(_0xae60,0x1c7));var _0x0ae6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xae60[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var fs_extra=require(_0x0ae6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x0ae6('0x8')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xa')]);router[_0x0ae6('0x8')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0x8')]('/:id/configurations',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xd')]);router[_0x0ae6('0x8')](_0x0ae6('0xe'),auth['isAuthenticated'](),controller[_0x0ae6('0xf')]);router[_0x0ae6('0x10')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x11')]);router[_0x0ae6('0x10')](_0x0ae6('0x12'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x13')]);router[_0x0ae6('0x14')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x15')]);router[_0x0ae6('0x16')](_0x0ae6('0xb'),auth['isAuthenticated'](),controller[_0x0ae6('0x17')]);module[_0x0ae6('0x18')]=router; \ No newline at end of file +var _0x6b20=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete'];(function(_0x507597,_0x412525){var _0x110a0f=function(_0x57935a){while(--_0x57935a){_0x507597['push'](_0x507597['shift']());}};_0x110a0f(++_0x412525);}(_0x6b20,0xd1));var _0x06b2=function(_0x3ca6ba,_0x2a49f2){_0x3ca6ba=_0x3ca6ba-0x0;var _0x211b3a=_0x6b20[_0x3ca6ba];return _0x211b3a;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var fs_extra=require(_0x06b2('0x4'));var auth=require(_0x06b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06b2('0x6'));var controller=require(_0x06b2('0x7'));router[_0x06b2('0x8')]('/',auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0x8')](_0x06b2('0xb'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0x8')](_0x06b2('0xd'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);router['get'](_0x06b2('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x06b2('0x10')]('/',auth[_0x06b2('0x9')](),controller['create']);router[_0x06b2('0x10')](_0x06b2('0xd'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x11')]);router[_0x06b2('0x12')](_0x06b2('0xb'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x13')]);router[_0x06b2('0x14')](_0x06b2('0xb'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x15')]);module[_0x06b2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 967f57f..2748bf6 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 _0x0598=['exports','STRING','sequelize'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0x0598,0x92));var _0x8059=function(_0x3efdb9,_0x598b5e){_0x3efdb9=_0x3efdb9-0x0;var _0x4465cf=_0x0598[_0x3efdb9];return _0x4465cf;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8059('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x8059('0x2')]},'remoteUri':{'type':Sequelize[_0x8059('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x50c7e5,_0x380f0f){var _0x108f56=function(_0x1959cf){while(--_0x1959cf){_0x50c7e5['push'](_0x50c7e5['shift']());}};_0x108f56(++_0x380f0f);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x95fd97,_0x13b945){_0x95fd97=_0x95fd97-0x0;var _0x2eabcb=_0xdd4f[_0x95fd97];return _0x2eabcb;};'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 56c9ecf..2023bd3 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 _0x1152=['slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','stringify','test','Wrong\x20credentials','statusCode','eml-format','request-promise','moment','util','path','sox','to-csv','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','show','includeAll','find','create','body','params','destroy','findOne','FreshsalesConfiguration','order','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','FreshsalesField','Descriptions','getFields','username','remoteUri'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1152,0xdc));var _0x2115=function(_0x10b2d5,_0x5a7743){_0x10b2d5=_0x10b2d5-0x0;var _0x14b8d1=_0x1152[_0x10b2d5];return _0x14b8d1;};'use strict';var emlformat=require(_0x2115('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2115('0x1'));var moment=require(_0x2115('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2115('0x3'));var path=require(_0x2115('0x4'));var sox=require(_0x2115('0x5'));var csv=require(_0x2115('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2115('0x7'));var _=require(_0x2115('0x8'));var squel=require('squel');var crypto=require(_0x2115('0x9'));var jsforce=require(_0x2115('0xa'));var deskjs=require(_0x2115('0xb'));var toCsv=require(_0x2115('0x6'));var querystring=require(_0x2115('0xc'));var Papa=require(_0x2115('0xd'));var Redis=require(_0x2115('0xe'));var authService=require(_0x2115('0xf'));var qs=require(_0x2115('0x10'));var as=require(_0x2115('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2115('0x12'))(_0x2115('0x13'));var utils=require(_0x2115('0x14'));var config=require(_0x2115('0x15'));var licenseUtil=require(_0x2115('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2115('0x17'));function respondWithStatusCode(_0x25e477,_0x3def03){_0x3def03=_0x3def03||0xcc;return function(_0x33aeb2){if(_0x33aeb2){return _0x25e477[_0x2115('0x18')](_0x3def03);}return _0x25e477[_0x2115('0x19')](_0x3def03)[_0x2115('0x1a')]();};}function respondWithResult(_0x4e7e8e,_0x53a5b4){_0x53a5b4=_0x53a5b4||0xc8;return function(_0x435f95){if(_0x435f95){return _0x4e7e8e['status'](_0x53a5b4)[_0x2115('0x1b')](_0x435f95);}};}function respondWithFilteredResult(_0x5c70c2,_0x2a3e1b){return function(_0x1621db){if(_0x1621db){var _0x3aa8cb=typeof _0x2a3e1b['offset']==='undefined'&&typeof _0x2a3e1b['limit']===_0x2115('0x1c');var _0x2f255a=_0x1621db[_0x2115('0x1d')];var _0x443370=_0x3aa8cb?0x0:_0x2a3e1b[_0x2115('0x1e')];var _0x709ecb=_0x3aa8cb?_0x1621db['count']:_0x2a3e1b['offset']+_0x2a3e1b[_0x2115('0x1f')];var _0x5ef498;if(_0x709ecb>=_0x2f255a){_0x709ecb=_0x2f255a;_0x5ef498=0xc8;}else{_0x5ef498=0xce;}_0x5c70c2['status'](_0x5ef498);return _0x5c70c2[_0x2115('0x20')](_0x2115('0x21'),_0x443370+'-'+_0x709ecb+'/'+_0x2f255a)['json'](_0x1621db);}return null;};}function patchUpdates(_0x576681){return function(_0x496acf){try{jsonpatch[_0x2115('0x22')](_0x496acf,_0x576681,!![]);}catch(_0x542976){return BPromise[_0x2115('0x23')](_0x542976);}return _0x496acf['save']();};}function saveUpdates(_0x317362,_0x398d43){return function(_0x2e8c73){if(_0x2e8c73){return _0x2e8c73[_0x2115('0x24')](_0x317362)[_0x2115('0x25')](function(_0x1280de){return _0x1280de;});}return null;};}function removeEntity(_0x1a94f9,_0x4790d4){return function(_0x2ff89d){if(_0x2ff89d){return _0x2ff89d['destroy']()['then'](function(){_0x1a94f9['status'](0xcc)[_0x2115('0x1a')]();});}};}function handleEntityNotFound(_0xa7ea1,_0x8e375c){return function(_0x1761c0){if(!_0x1761c0){_0xa7ea1[_0x2115('0x18')](0x194);}return _0x1761c0;};}function handleError(_0x3b01eb,_0x329188){_0x329188=_0x329188||0x1f4;return function(_0x5c437e){logger[_0x2115('0x26')](_0x5c437e[_0x2115('0x27')]);if(_0x5c437e[_0x2115('0x28')]){delete _0x5c437e['name'];}_0x3b01eb['status'](_0x329188)[_0x2115('0x29')](_0x5c437e);};}exports[_0x2115('0x2a')]=function(_0xd14e5b,_0x38efc4){var _0x10e5e0={},_0x3be5c7={},_0x50db06={'count':0x0,'rows':[]};var _0x269a7f=_[_0x2115('0x2b')](db[_0x2115('0x2c')][_0x2115('0x2d')],function(_0x26936e){return{'name':_0x26936e[_0x2115('0x2e')],'type':_0x26936e[_0x2115('0x2f')]['key']};});_0x3be5c7[_0x2115('0x30')]=_[_0x2115('0x2b')](_0x269a7f,_0x2115('0x28'));_0x3be5c7[_0x2115('0x31')]=_[_0x2115('0x32')](_0xd14e5b[_0x2115('0x31')]);_0x3be5c7[_0x2115('0x33')]=_['intersection'](_0x3be5c7[_0x2115('0x30')],_0x3be5c7[_0x2115('0x31')]);_0x10e5e0[_0x2115('0x34')]=_[_0x2115('0x35')](_0x3be5c7[_0x2115('0x30')],qs[_0x2115('0x36')](_0xd14e5b[_0x2115('0x31')]['fields']));_0x10e5e0[_0x2115('0x34')]=_0x10e5e0[_0x2115('0x34')][_0x2115('0x37')]?_0x10e5e0[_0x2115('0x34')]:_0x3be5c7[_0x2115('0x30')];if(!_0xd14e5b['query']['hasOwnProperty'](_0x2115('0x38'))){_0x10e5e0['limit']=qs[_0x2115('0x1f')](_0xd14e5b['query']['limit']);_0x10e5e0[_0x2115('0x1e')]=qs[_0x2115('0x1e')](_0xd14e5b[_0x2115('0x31')][_0x2115('0x1e')]);}_0x10e5e0['order']=qs[_0x2115('0x39')](_0xd14e5b[_0x2115('0x31')][_0x2115('0x39')]);_0x10e5e0[_0x2115('0x3a')]=qs[_0x2115('0x33')](_[_0x2115('0x3b')](_0xd14e5b['query'],_0x3be5c7['filters']),_0x269a7f);if(_0xd14e5b[_0x2115('0x31')][_0x2115('0x3c')]){_0x10e5e0[_0x2115('0x3a')]=_[_0x2115('0x3d')](_0x10e5e0['where'],{'$or':_[_0x2115('0x2b')](_0x269a7f,function(_0x7991ab){if(_0x7991ab['type']!=='VIRTUAL'){var _0x16b49d={};_0x16b49d[_0x7991ab[_0x2115('0x28')]]={'$like':'%'+_0xd14e5b[_0x2115('0x31')]['filter']+'%'};return _0x16b49d;}})});}_0x10e5e0=_[_0x2115('0x3d')]({},_0x10e5e0,_0xd14e5b[_0x2115('0x3e')]);var _0x5f09bc={'where':_0x10e5e0[_0x2115('0x3a')]};return db[_0x2115('0x2c')]['count'](_0x5f09bc)['then'](function(_0x2115bf){_0x50db06[_0x2115('0x1d')]=_0x2115bf;if(_0xd14e5b[_0x2115('0x31')]['includeAll']){_0x10e5e0[_0x2115('0x3f')]=[{'all':!![]}];}return db[_0x2115('0x2c')][_0x2115('0x40')](_0x10e5e0);})[_0x2115('0x25')](function(_0x136bcd){_0x50db06['rows']=_0x136bcd;return _0x50db06;})['then'](respondWithFilteredResult(_0x38efc4,_0x10e5e0))[_0x2115('0x41')](handleError(_0x38efc4,null));};exports[_0x2115('0x42')]=function(_0x340bb7,_0x4b22af){var _0x6cf14d={'raw':![],'where':{'id':_0x340bb7['params']['id']}},_0x420f55={};_0x420f55[_0x2115('0x30')]=_['keys'](db['FreshsalesAccount'][_0x2115('0x2d')]);_0x420f55[_0x2115('0x31')]=_[_0x2115('0x32')](_0x340bb7['query']);_0x420f55[_0x2115('0x33')]=_[_0x2115('0x35')](_0x420f55[_0x2115('0x30')],_0x420f55[_0x2115('0x31')]);_0x6cf14d['attributes']=_[_0x2115('0x35')](_0x420f55[_0x2115('0x30')],qs[_0x2115('0x36')](_0x340bb7[_0x2115('0x31')][_0x2115('0x36')]));_0x6cf14d[_0x2115('0x34')]=_0x6cf14d[_0x2115('0x34')][_0x2115('0x37')]?_0x6cf14d['attributes']:_0x420f55[_0x2115('0x30')];if(_0x340bb7[_0x2115('0x31')][_0x2115('0x43')]){_0x6cf14d[_0x2115('0x3f')]=[{'all':!![]}];}_0x6cf14d=_[_0x2115('0x3d')]({},_0x6cf14d,_0x340bb7[_0x2115('0x3e')]);return db['FreshsalesAccount'][_0x2115('0x44')](_0x6cf14d)[_0x2115('0x25')](handleEntityNotFound(_0x4b22af,null))['then'](respondWithResult(_0x4b22af,null))[_0x2115('0x41')](handleError(_0x4b22af,null));};exports[_0x2115('0x45')]=function(_0x431a09,_0x121273){return db[_0x2115('0x2c')][_0x2115('0x45')](_0x431a09['body'],{})[_0x2115('0x25')](respondWithResult(_0x121273,0xc9))[_0x2115('0x41')](handleError(_0x121273,null));};exports[_0x2115('0x24')]=function(_0x44e136,_0x5a3f6a){if(_0x44e136[_0x2115('0x46')]['id']){delete _0x44e136['body']['id'];}return db[_0x2115('0x2c')][_0x2115('0x44')]({'where':{'id':_0x44e136[_0x2115('0x47')]['id']}})[_0x2115('0x25')](handleEntityNotFound(_0x5a3f6a,null))['then'](saveUpdates(_0x44e136['body'],null))[_0x2115('0x25')](respondWithResult(_0x5a3f6a,null))[_0x2115('0x41')](handleError(_0x5a3f6a,null));};exports[_0x2115('0x48')]=function(_0x38cfa1,_0x24035c){return db[_0x2115('0x2c')][_0x2115('0x44')]({'where':{'id':_0x38cfa1[_0x2115('0x47')]['id']}})[_0x2115('0x25')](handleEntityNotFound(_0x24035c,null))['then'](removeEntity(_0x24035c,null))[_0x2115('0x41')](handleError(_0x24035c,null));};exports['getConfigurations']=function(_0x13ded3,_0x4c59fd,_0x384f95){var _0x2466ab={};var _0x1db9c7={};var _0x3b6397;var _0xdaa640;return db['FreshsalesAccount'][_0x2115('0x49')]({'where':{'id':_0x13ded3[_0x2115('0x47')]['id']}})[_0x2115('0x25')](handleEntityNotFound(_0x4c59fd,null))['then'](function(_0x2601a9){if(_0x2601a9){_0x3b6397=_0x2601a9;_0x1db9c7[_0x2115('0x30')]=_['keys'](db[_0x2115('0x4a')][_0x2115('0x2d')]);_0x1db9c7[_0x2115('0x31')]=_[_0x2115('0x32')](_0x13ded3['query']);_0x1db9c7['filters']=_[_0x2115('0x35')](_0x1db9c7[_0x2115('0x30')],_0x1db9c7[_0x2115('0x31')]);_0x2466ab[_0x2115('0x34')]=_[_0x2115('0x35')](_0x1db9c7[_0x2115('0x30')],qs[_0x2115('0x36')](_0x13ded3['query'][_0x2115('0x36')]));_0x2466ab[_0x2115('0x34')]=_0x2466ab[_0x2115('0x34')]['length']?_0x2466ab[_0x2115('0x34')]:_0x1db9c7[_0x2115('0x30')];_0x2466ab[_0x2115('0x4b')]=qs['sort'](_0x13ded3['query'][_0x2115('0x39')]);_0x2466ab[_0x2115('0x3a')]=qs[_0x2115('0x33')](_[_0x2115('0x3b')](_0x13ded3[_0x2115('0x31')],_0x1db9c7[_0x2115('0x33')]));if(_0x13ded3[_0x2115('0x31')][_0x2115('0x3c')]){_0x2466ab[_0x2115('0x3a')]=_[_0x2115('0x3d')](_0x2466ab['where'],{'$or':_[_0x2115('0x2b')](_0x2466ab[_0x2115('0x34')],function(_0x321c80){var _0x47074e={};_0x47074e[_0x321c80]={'$like':'%'+_0x13ded3[_0x2115('0x31')][_0x2115('0x3c')]+'%'};return _0x47074e;})});}_0x2466ab=_[_0x2115('0x3d')]({},_0x2466ab,_0x13ded3[_0x2115('0x3e')]);return _0x3b6397[_0x2115('0x4c')](_0x2466ab);}})['then'](function(_0x2953f0){if(_0x2953f0){_0xdaa640=_0x2953f0[_0x2115('0x37')];if(!_0x13ded3[_0x2115('0x31')][_0x2115('0x4d')]('nolimit')){_0x2466ab[_0x2115('0x1f')]=qs[_0x2115('0x1f')](_0x13ded3[_0x2115('0x31')]['limit']);_0x2466ab[_0x2115('0x1e')]=qs[_0x2115('0x1e')](_0x13ded3['query'][_0x2115('0x1e')]);}return _0x3b6397[_0x2115('0x4c')](_0x2466ab);}})['then'](function(_0x5ac4ee){if(_0x5ac4ee){return _0x5ac4ee?{'count':_0xdaa640,'rows':_0x5ac4ee}:null;}})[_0x2115('0x25')](respondWithResult(_0x4c59fd,null))[_0x2115('0x41')](handleError(_0x4c59fd,null));};exports[_0x2115('0x4e')]=function(_0x41a21b,_0x79af8e,_0x48205a){if(_0x41a21b[_0x2115('0x46')]['id']){delete _0x41a21b[_0x2115('0x46')]['id'];}return db[_0x2115('0x2c')][_0x2115('0x49')]({'where':{'id':_0x41a21b[_0x2115('0x47')]['id']}})[_0x2115('0x25')](handleEntityNotFound(_0x79af8e,null))[_0x2115('0x25')](function(_0xd59c15){if(_0xd59c15){_0x41a21b[_0x2115('0x46')][_0x2115('0x4f')]=_0xd59c15['id'];_0x41a21b[_0x2115('0x46')][_0x2115('0x50')]=integrations[_0x2115('0x51')](_0x41a21b[_0x2115('0x46')]['channel'],_0x41a21b[_0x2115('0x46')][_0x2115('0x2f')]);_0x41a21b['body']['Descriptions']=integrations[_0x2115('0x52')](_0x41a21b[_0x2115('0x46')][_0x2115('0x53')],_0x41a21b[_0x2115('0x46')][_0x2115('0x2f')]);return db['FreshsalesConfiguration'][_0x2115('0x45')](_0x41a21b[_0x2115('0x46')],{'include':[{'model':db['FreshsalesField'],'as':_0x2115('0x50')},{'model':db[_0x2115('0x54')],'as':_0x2115('0x55')}]});}return null;})[_0x2115('0x25')](respondWithResult(_0x79af8e,null))['catch'](handleError(_0x79af8e,null));};exports[_0x2115('0x56')]=function(_0x54cc86,_0xd328d2,_0xa832b6){var _0x271275='';var _0x1dd7db='';return db[_0x2115('0x2c')][_0x2115('0x49')]({'where':{'id':_0x54cc86[_0x2115('0x47')]['id']},'attributes':['id',_0x2115('0x57'),_0x2115('0x58'),'apiKey']})['then'](handleEntityNotFound(_0xd328d2,null))['then'](function(_0x150ede){if(_0x150ede){_0x1dd7db=_0x150ede['username'];_0x271275=_0x150ede[_0x2115('0x58')];var _0x594753=_0x150ede['remoteUri'][_0x2115('0x59')](-0x1);if(_0x594753==='/'){_0x271275=_0x271275[_0x2115('0x5a')](0x0,_0x271275[_0x2115('0x5b')](_0x594753));}return rp({'method':_0x2115('0x5c'),'uri':util[_0x2115('0x5d')]('%s%s',_0x271275,_0x2115('0x5e')),'headers':{'Authorization':_0x2115('0x5f')+_0x150ede['apiKey']},'json':!![]});}})[_0x2115('0x25')](function(_0x4edc7b){if(_0x4edc7b){var _0x1b6f71=_0x4edc7b[_0x2115('0x60')];var _0x481999=![];var _0x5ca466=null;for(_0x5ca466=0x0;_0x5ca466<_0x1b6f71['length'];_0x5ca466++){if(_0x1b6f71[_0x5ca466][_0x2115('0x61')]===_0x1dd7db){_0x481999=!![];}}if(_0x481999){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2115('0x62')});}}})[_0x2115('0x25')](respondWithResult(_0xd328d2,null))[_0x2115('0x41')](function(_0x51966c){var _0x98ccf7=_0x54cc86[_0x2115('0x31')]['test']?0x1f4:_0x51966c['statusCode']||0x1f4;logger[_0x2115('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x2115('0x56'),_0x98ccf7,JSON[_0x2115('0x63')](_0x51966c));delete _0x51966c[_0x2115('0x28')];if(_0x98ccf7===0x191){_0x98ccf7=0x190;}_0xd328d2[_0x2115('0x19')](_0x98ccf7)[_0x2115('0x29')](_0x54cc86['query'][_0x2115('0x64')]?{'message':_0x2115('0x65'),'statusCode':_0x51966c[_0x2115('0x66')]}:_0x51966c);});}; \ No newline at end of file +var _0xf145=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','getConfigurations','findOne','FreshsalesConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2b02f9,_0x17359d){var _0x452117=function(_0x58726f){while(--_0x58726f){_0x2b02f9['push'](_0x2b02f9['shift']());}};_0x452117(++_0x17359d);}(_0xf145,0x17e));var _0x5f14=function(_0x4beb42,_0x3066df){_0x4beb42=_0x4beb42-0x0;var _0x198c48=_0xf145[_0x4beb42];return _0x198c48;};'use strict';var emlformat=require(_0x5f14('0x0'));var rimraf=require(_0x5f14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f14('0x2'));var rp=require(_0x5f14('0x3'));var moment=require('moment');var BPromise=require(_0x5f14('0x4'));var Mustache=require(_0x5f14('0x5'));var util=require('util');var path=require(_0x5f14('0x6'));var sox=require(_0x5f14('0x7'));var csv=require(_0x5f14('0x8'));var ejs=require(_0x5f14('0x9'));var fs=require('fs');var fs_extra=require(_0x5f14('0xa'));var _=require(_0x5f14('0xb'));var squel=require('squel');var crypto=require(_0x5f14('0xc'));var jsforce=require(_0x5f14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5f14('0x8'));var querystring=require(_0x5f14('0xe'));var Papa=require('papaparse');var Redis=require(_0x5f14('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5f14('0x10'));var as=require(_0x5f14('0x11'));var hardwareService=require(_0x5f14('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5f14('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5f14('0x14'));var db=require(_0x5f14('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x50a693,_0xd23139){_0xd23139=_0xd23139||0xcc;return function(_0x9c68d6){if(_0x9c68d6){return _0x50a693[_0x5f14('0x16')](_0xd23139);}return _0x50a693[_0x5f14('0x17')](_0xd23139)[_0x5f14('0x18')]();};}function respondWithResult(_0x2ce15f,_0x54d173){_0x54d173=_0x54d173||0xc8;return function(_0x24dc2c){if(_0x24dc2c){return _0x2ce15f[_0x5f14('0x17')](_0x54d173)['json'](_0x24dc2c);}};}function respondWithFilteredResult(_0x2d4c4e,_0x3b5c03){return function(_0x58729f){if(_0x58729f){var _0x2659c1=typeof _0x3b5c03[_0x5f14('0x19')]===_0x5f14('0x1a')&&typeof _0x3b5c03[_0x5f14('0x1b')]===_0x5f14('0x1a');var _0x2fb3a4=_0x58729f[_0x5f14('0x1c')];var _0x54b468=_0x2659c1?0x0:_0x3b5c03[_0x5f14('0x19')];var _0x384a28=_0x2659c1?_0x58729f[_0x5f14('0x1c')]:_0x3b5c03[_0x5f14('0x19')]+_0x3b5c03[_0x5f14('0x1b')];var _0x250830;if(_0x384a28>=_0x2fb3a4){_0x384a28=_0x2fb3a4;_0x250830=0xc8;}else{_0x250830=0xce;}_0x2d4c4e[_0x5f14('0x17')](_0x250830);return _0x2d4c4e[_0x5f14('0x1d')](_0x5f14('0x1e'),_0x54b468+'-'+_0x384a28+'/'+_0x2fb3a4)[_0x5f14('0x1f')](_0x58729f);}return null;};}function patchUpdates(_0x8cafef){return function(_0x498cad){try{jsonpatch[_0x5f14('0x20')](_0x498cad,_0x8cafef,!![]);}catch(_0x453628){return BPromise['reject'](_0x453628);}return _0x498cad[_0x5f14('0x21')]();};}function saveUpdates(_0x3b33fa,_0x3fba06){return function(_0x10f152){if(_0x10f152){return _0x10f152['update'](_0x3b33fa)[_0x5f14('0x22')](function(_0x49d482){return _0x49d482;});}return null;};}function removeEntity(_0x119dd8,_0x217b6d){return function(_0x3268bc){if(_0x3268bc){return _0x3268bc[_0x5f14('0x23')]()['then'](function(){_0x119dd8[_0x5f14('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a03e2,_0x397c5a){return function(_0x1d7ab2){if(!_0x1d7ab2){_0x3a03e2[_0x5f14('0x16')](0x194);}return _0x1d7ab2;};}function handleError(_0x482cfa,_0x3691fc){_0x3691fc=_0x3691fc||0x1f4;return function(_0x1736ec){logger['error'](_0x1736ec[_0x5f14('0x24')]);if(_0x1736ec[_0x5f14('0x25')]){delete _0x1736ec['name'];}_0x482cfa[_0x5f14('0x17')](_0x3691fc)[_0x5f14('0x26')](_0x1736ec);};}exports[_0x5f14('0x27')]=function(_0x5be194,_0x482daf){var _0x53d920={},_0x2d08ad={},_0x2b1a2a={'count':0x0,'rows':[]};var _0x2671df=_['map'](db['FreshsalesAccount'][_0x5f14('0x28')],function(_0x2957c5){return{'name':_0x2957c5['fieldName'],'type':_0x2957c5[_0x5f14('0x29')][_0x5f14('0x2a')]};});_0x2d08ad[_0x5f14('0x2b')]=_[_0x5f14('0x2c')](_0x2671df,_0x5f14('0x25'));_0x2d08ad['query']=_[_0x5f14('0x2d')](_0x5be194[_0x5f14('0x2e')]);_0x2d08ad[_0x5f14('0x2f')]=_[_0x5f14('0x30')](_0x2d08ad[_0x5f14('0x2b')],_0x2d08ad[_0x5f14('0x2e')]);_0x53d920['attributes']=_['intersection'](_0x2d08ad[_0x5f14('0x2b')],qs[_0x5f14('0x31')](_0x5be194[_0x5f14('0x2e')][_0x5f14('0x31')]));_0x53d920[_0x5f14('0x32')]=_0x53d920[_0x5f14('0x32')][_0x5f14('0x33')]?_0x53d920['attributes']:_0x2d08ad[_0x5f14('0x2b')];if(!_0x5be194[_0x5f14('0x2e')][_0x5f14('0x34')](_0x5f14('0x35'))){_0x53d920[_0x5f14('0x1b')]=qs[_0x5f14('0x1b')](_0x5be194[_0x5f14('0x2e')][_0x5f14('0x1b')]);_0x53d920[_0x5f14('0x19')]=qs[_0x5f14('0x19')](_0x5be194[_0x5f14('0x2e')][_0x5f14('0x19')]);}_0x53d920[_0x5f14('0x36')]=qs[_0x5f14('0x37')](_0x5be194[_0x5f14('0x2e')][_0x5f14('0x37')]);_0x53d920[_0x5f14('0x38')]=qs['filters'](_[_0x5f14('0x39')](_0x5be194[_0x5f14('0x2e')],_0x2d08ad['filters']),_0x2671df);if(_0x5be194[_0x5f14('0x2e')][_0x5f14('0x3a')]){_0x53d920[_0x5f14('0x38')]=_[_0x5f14('0x3b')](_0x53d920[_0x5f14('0x38')],{'$or':_['map'](_0x2671df,function(_0x4fef52){if(_0x4fef52[_0x5f14('0x29')]!==_0x5f14('0x3c')){var _0x5593f2={};_0x5593f2[_0x4fef52[_0x5f14('0x25')]]={'$like':'%'+_0x5be194[_0x5f14('0x2e')][_0x5f14('0x3a')]+'%'};return _0x5593f2;}})});}_0x53d920=_[_0x5f14('0x3b')]({},_0x53d920,_0x5be194[_0x5f14('0x3d')]);var _0x22109a={'where':_0x53d920[_0x5f14('0x38')]};return db[_0x5f14('0x3e')][_0x5f14('0x1c')](_0x22109a)[_0x5f14('0x22')](function(_0xe766a2){_0x2b1a2a[_0x5f14('0x1c')]=_0xe766a2;if(_0x5be194[_0x5f14('0x2e')][_0x5f14('0x3f')]){_0x53d920[_0x5f14('0x40')]=[{'all':!![]}];}return db[_0x5f14('0x3e')][_0x5f14('0x41')](_0x53d920);})[_0x5f14('0x22')](function(_0x22d8ce){_0x2b1a2a[_0x5f14('0x42')]=_0x22d8ce;return _0x2b1a2a;})['then'](respondWithFilteredResult(_0x482daf,_0x53d920))[_0x5f14('0x43')](handleError(_0x482daf,null));};exports[_0x5f14('0x44')]=function(_0x887827,_0x54a942){var _0x260f39={'raw':![],'where':{'id':_0x887827[_0x5f14('0x45')]['id']}},_0x21db78={};_0x21db78[_0x5f14('0x2b')]=_[_0x5f14('0x2d')](db[_0x5f14('0x3e')][_0x5f14('0x28')]);_0x21db78['query']=_[_0x5f14('0x2d')](_0x887827[_0x5f14('0x2e')]);_0x21db78[_0x5f14('0x2f')]=_[_0x5f14('0x30')](_0x21db78[_0x5f14('0x2b')],_0x21db78[_0x5f14('0x2e')]);_0x260f39[_0x5f14('0x32')]=_[_0x5f14('0x30')](_0x21db78[_0x5f14('0x2b')],qs[_0x5f14('0x31')](_0x887827['query'][_0x5f14('0x31')]));_0x260f39[_0x5f14('0x32')]=_0x260f39[_0x5f14('0x32')]['length']?_0x260f39[_0x5f14('0x32')]:_0x21db78['model'];if(_0x887827[_0x5f14('0x2e')][_0x5f14('0x3f')]){_0x260f39[_0x5f14('0x40')]=[{'all':!![]}];}_0x260f39=_[_0x5f14('0x3b')]({},_0x260f39,_0x887827['options']);return db['FreshsalesAccount']['find'](_0x260f39)[_0x5f14('0x22')](handleEntityNotFound(_0x54a942,null))[_0x5f14('0x22')](respondWithResult(_0x54a942,null))[_0x5f14('0x43')](handleError(_0x54a942,null));};exports['create']=function(_0x3352cd,_0x48ad3f){return db[_0x5f14('0x3e')][_0x5f14('0x46')](_0x3352cd[_0x5f14('0x47')],{})[_0x5f14('0x22')](respondWithResult(_0x48ad3f,0xc9))[_0x5f14('0x43')](handleError(_0x48ad3f,null));};exports[_0x5f14('0x48')]=function(_0xfe3c86,_0x3cec2c){if(_0xfe3c86['body']['id']){delete _0xfe3c86['body']['id'];}return db[_0x5f14('0x3e')][_0x5f14('0x49')]({'where':{'id':_0xfe3c86[_0x5f14('0x45')]['id']}})[_0x5f14('0x22')](handleEntityNotFound(_0x3cec2c,null))['then'](saveUpdates(_0xfe3c86[_0x5f14('0x47')],null))[_0x5f14('0x22')](respondWithResult(_0x3cec2c,null))[_0x5f14('0x43')](handleError(_0x3cec2c,null));};exports[_0x5f14('0x23')]=function(_0x3b21bd,_0x161032){return db['FreshsalesAccount'][_0x5f14('0x49')]({'where':{'id':_0x3b21bd[_0x5f14('0x45')]['id']}})['then'](handleEntityNotFound(_0x161032,null))[_0x5f14('0x22')](removeEntity(_0x161032,null))[_0x5f14('0x43')](handleError(_0x161032,null));};exports[_0x5f14('0x4a')]=function(_0x43ebab,_0x7fbe79,_0x43ea44){var _0x5adc5f={};var _0xee072f={};var _0x5c4606;var _0x5d59f4;return db[_0x5f14('0x3e')][_0x5f14('0x4b')]({'where':{'id':_0x43ebab['params']['id']}})[_0x5f14('0x22')](handleEntityNotFound(_0x7fbe79,null))[_0x5f14('0x22')](function(_0x539b93){if(_0x539b93){_0x5c4606=_0x539b93;_0xee072f[_0x5f14('0x2b')]=_[_0x5f14('0x2d')](db[_0x5f14('0x4c')][_0x5f14('0x28')]);_0xee072f[_0x5f14('0x2e')]=_[_0x5f14('0x2d')](_0x43ebab['query']);_0xee072f['filters']=_[_0x5f14('0x30')](_0xee072f[_0x5f14('0x2b')],_0xee072f[_0x5f14('0x2e')]);_0x5adc5f['attributes']=_[_0x5f14('0x30')](_0xee072f['model'],qs[_0x5f14('0x31')](_0x43ebab[_0x5f14('0x2e')][_0x5f14('0x31')]));_0x5adc5f[_0x5f14('0x32')]=_0x5adc5f['attributes'][_0x5f14('0x33')]?_0x5adc5f[_0x5f14('0x32')]:_0xee072f['model'];_0x5adc5f[_0x5f14('0x36')]=qs[_0x5f14('0x37')](_0x43ebab[_0x5f14('0x2e')][_0x5f14('0x37')]);_0x5adc5f[_0x5f14('0x38')]=qs['filters'](_[_0x5f14('0x39')](_0x43ebab[_0x5f14('0x2e')],_0xee072f[_0x5f14('0x2f')]));if(_0x43ebab[_0x5f14('0x2e')][_0x5f14('0x3a')]){_0x5adc5f[_0x5f14('0x38')]=_[_0x5f14('0x3b')](_0x5adc5f[_0x5f14('0x38')],{'$or':_[_0x5f14('0x2c')](_0x5adc5f[_0x5f14('0x32')],function(_0x1ced6f){var _0x1a6ea4={};_0x1a6ea4[_0x1ced6f]={'$like':'%'+_0x43ebab[_0x5f14('0x2e')][_0x5f14('0x3a')]+'%'};return _0x1a6ea4;})});}_0x5adc5f=_[_0x5f14('0x3b')]({},_0x5adc5f,_0x43ebab['options']);return _0x5c4606[_0x5f14('0x4a')](_0x5adc5f);}})['then'](function(_0xeaf8f6){if(_0xeaf8f6){_0x5d59f4=_0xeaf8f6['length'];if(!_0x43ebab['query'][_0x5f14('0x34')](_0x5f14('0x35'))){_0x5adc5f[_0x5f14('0x1b')]=qs['limit'](_0x43ebab[_0x5f14('0x2e')]['limit']);_0x5adc5f[_0x5f14('0x19')]=qs['offset'](_0x43ebab[_0x5f14('0x2e')]['offset']);}return _0x5c4606[_0x5f14('0x4a')](_0x5adc5f);}})['then'](function(_0x1447db){if(_0x1447db){return _0x1447db?{'count':_0x5d59f4,'rows':_0x1447db}:null;}})[_0x5f14('0x22')](respondWithResult(_0x7fbe79,null))[_0x5f14('0x43')](handleError(_0x7fbe79,null));};exports['addConfiguration']=function(_0x3397ab,_0x25e813,_0x1494b6){if(_0x3397ab['body']['id']){delete _0x3397ab[_0x5f14('0x47')]['id'];}return db[_0x5f14('0x3e')][_0x5f14('0x4b')]({'where':{'id':_0x3397ab[_0x5f14('0x45')]['id']}})['then'](handleEntityNotFound(_0x25e813,null))[_0x5f14('0x22')](function(_0x425f35){if(_0x425f35){_0x3397ab[_0x5f14('0x47')][_0x5f14('0x4d')]=_0x425f35['id'];_0x3397ab[_0x5f14('0x47')]['Subjects']=integrations[_0x5f14('0x4e')](_0x3397ab['body']['channel'],_0x3397ab[_0x5f14('0x47')][_0x5f14('0x29')]);_0x3397ab['body'][_0x5f14('0x4f')]=integrations[_0x5f14('0x50')](_0x3397ab['body'][_0x5f14('0x51')],_0x3397ab[_0x5f14('0x47')][_0x5f14('0x29')]);return db['FreshsalesConfiguration'][_0x5f14('0x46')](_0x3397ab['body'],{'include':[{'model':db[_0x5f14('0x52')],'as':_0x5f14('0x53')},{'model':db[_0x5f14('0x52')],'as':_0x5f14('0x4f')}]});}return null;})[_0x5f14('0x22')](respondWithResult(_0x25e813,null))['catch'](handleError(_0x25e813,null));};exports[_0x5f14('0x54')]=function(_0x36f898,_0x3e1e4f,_0x44d943){var _0x59d454='';var _0x123339='';return db[_0x5f14('0x3e')][_0x5f14('0x4b')]({'where':{'id':_0x36f898[_0x5f14('0x45')]['id']},'attributes':['id','username',_0x5f14('0x55'),_0x5f14('0x56')]})[_0x5f14('0x22')](handleEntityNotFound(_0x3e1e4f,null))[_0x5f14('0x22')](function(_0x335a5f){if(_0x335a5f){_0x123339=_0x335a5f['username'];_0x59d454=_0x335a5f['remoteUri'];var _0x5a75a1=_0x335a5f[_0x5f14('0x55')][_0x5f14('0x57')](-0x1);if(_0x5a75a1==='/'){_0x59d454=_0x59d454[_0x5f14('0x58')](0x0,_0x59d454[_0x5f14('0x59')](_0x5a75a1));}return rp({'method':_0x5f14('0x5a'),'uri':util[_0x5f14('0x5b')](_0x5f14('0x5c'),_0x59d454,_0x5f14('0x5d')),'headers':{'Authorization':_0x5f14('0x5e')+_0x335a5f[_0x5f14('0x56')]},'json':!![]});}})[_0x5f14('0x22')](function(_0x519787){if(_0x519787){var _0x4fcdea=_0x519787['users'];var _0x4edce5=![];var _0x16fbe0=null;for(_0x16fbe0=0x0;_0x16fbe0<_0x4fcdea[_0x5f14('0x33')];_0x16fbe0++){if(_0x4fcdea[_0x16fbe0]['email']===_0x123339){_0x4edce5=!![];}}if(_0x4edce5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5f14('0x5f')});}}})[_0x5f14('0x22')](respondWithResult(_0x3e1e4f,null))['catch'](function(_0x4c4970){var _0x39b2c4=_0x36f898[_0x5f14('0x2e')][_0x5f14('0x60')]?0x1f4:_0x4c4970[_0x5f14('0x61')]||0x1f4;logger['error'](_0x5f14('0x62'),'getFields',_0x39b2c4,JSON[_0x5f14('0x63')](_0x4c4970));delete _0x4c4970[_0x5f14('0x25')];if(_0x39b2c4===0x191){_0x39b2c4=0x190;}_0x3e1e4f[_0x5f14('0x17')](_0x39b2c4)[_0x5f14('0x26')](_0x36f898[_0x5f14('0x2e')][_0x5f14('0x60')]?{'message':_0x5f14('0x64'),'statusCode':_0x4c4970[_0x5f14('0x61')]}:_0x4c4970);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index d85f55c..251b39d 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 _0xc2c7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','int_freshsales_accounts'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xc2c7,0x134));var _0x7c2c=function(_0x36c76c,_0x1ac6fc){_0x36c76c=_0x36c76c-0x0;var _0xc59b4b=_0xc2c7[_0x36c76c];return _0xc59b4b;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var logger=require(_0x7c2c('0x1'))(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require(_0x7c2c('0x6'));var rimraf=require(_0x7c2c('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x7c2c('0x8'));module[_0x7c2c('0x9')]=function(_0x23c038,_0x54f027){return _0x23c038['define']('FreshsalesAccount',attributes,{'tableName':_0x7c2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x430c=['define','FreshsalesAccount','int_freshsales_accounts','lodash','api','moment','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x5ec726,_0x202923){var _0x17312a=function(_0x33afbe){while(--_0x33afbe){_0x5ec726['push'](_0x5ec726['shift']());}};_0x17312a(++_0x202923);}(_0x430c,0x1a1));var _0xc430=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0x430c[_0x6c0123];return _0x5a87d2;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));var integrations=require(_0xc430('0x5'));module['exports']=function(_0x42aa9c,_0x4de44f){return _0x42aa9c[_0xc430('0x6')](_0xc430('0x7'),attributes,{'tableName':_0xc430('0x8'),'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 6da6b7a..af8e2a5 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 _0x2ef3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','include','model','map','attributes','ShowFreshsalesAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x46b831,_0x4713a1){var _0x310835=function(_0x9924da){while(--_0x9924da){_0x46b831['push'](_0x46b831['shift']());}};_0x310835(++_0x4713a1);}(_0x2ef3,0xba));var _0x32ef=function(_0x228580,_0xb0c97a){_0x228580=_0x228580-0x0;var _0x50d170=_0x2ef3[_0x228580];return _0x50d170;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['findAll']({'raw':_0x1a9476[_0x32ef('0x17')]?_0x1a9476[_0x32ef('0x17')][_0x32ef('0x18')]===undefined?!![]:![]:!![],'where':_0x1a9476[_0x32ef('0x17')]?_0x1a9476[_0x32ef('0x17')][_0x32ef('0x19')]||null:null,'attributes':_0x1a9476['options']?_0x1a9476[_0x32ef('0x17')]['attributes']||null:null,'limit':_0x1a9476[_0x32ef('0x17')]?_0x1a9476[_0x32ef('0x17')]['limit']||null:null,'include':_0x1a9476[_0x32ef('0x17')]?_0x1a9476[_0x32ef('0x17')][_0x32ef('0x1a')]?_['map'](_0x1a9476['options'][_0x32ef('0x1a')],function(_0xb30fab){return{'model':db[_0xb30fab[_0x32ef('0x1b')]],'as':_0xb30fab['as'],'attributes':_0xb30fab['attributes'],'include':_0xb30fab['include']?_[_0x32ef('0x1c')](_0xb30fab['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1b')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1d')],'include':_0x51a412[_0x32ef('0x1a')]?_[_0x32ef('0x1c')](_0x51a412[_0x32ef('0x1a')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1b')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xb')](function(_0x2f52d7){logger[_0x32ef('0xc')](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x2f52d7));_0x57863c(_0x2f52d7);})['catch'](function(_0x12de1a){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x12de1a[_0x32ef('0x13')],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x12de1a[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1e')]=function(_0x31dbc3){var _0x2ac686=this;return new Promise(function(_0x1b668a,_0x1a6ed2){return db[_0x32ef('0x16')]['find']({'raw':_0x31dbc3[_0x32ef('0x17')]?_0x31dbc3['options'][_0x32ef('0x18')]===undefined?!![]:![]:!![],'where':_0x31dbc3[_0x32ef('0x17')]?_0x31dbc3['options'][_0x32ef('0x19')]||null:null,'attributes':_0x31dbc3[_0x32ef('0x17')]?_0x31dbc3[_0x32ef('0x17')][_0x32ef('0x1d')]||null:null,'include':_0x31dbc3[_0x32ef('0x17')]?_0x31dbc3['options']['include']?_[_0x32ef('0x1c')](_0x31dbc3['options'][_0x32ef('0x1a')],function(_0x15b873){return{'model':db[_0x15b873[_0x32ef('0x1b')]],'as':_0x15b873['as'],'attributes':_0x15b873[_0x32ef('0x1d')],'include':_0x15b873[_0x32ef('0x1a')]?_[_0x32ef('0x1c')](_0x15b873['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1d')],'include':_0x482d3a[_0x32ef('0x1a')]?_[_0x32ef('0x1c')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1b')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xb')](function(_0x480348){logger['info'](_0x32ef('0x1e'),_0x31dbc3);logger[_0x32ef('0x1f')](_0x32ef('0x1e'),_0x31dbc3,JSON[_0x32ef('0x10')](_0x480348));_0x1b668a(_0x480348);})[_0x32ef('0x14')](function(_0x211c79){logger[_0x32ef('0x11')](_0x32ef('0x1e'),_0x211c79[_0x32ef('0x13')],_0x31dbc3);_0x1a6ed2(_0x2ac686['error'](0x1f4,_0x211c79[_0x32ef('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','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','FreshsalesAccount','options','raw','limit','include','map','model','attributes','then','GetFreshsalesAccount','ShowFreshsalesAccount','find'];(function(_0x10f596,_0x30776f){var _0x169e83=function(_0x3747ba){while(--_0x3747ba){_0x10f596['push'](_0x10f596['shift']());}};_0x169e83(++_0x30776f);}(_0x9582,0x95));var _0x2958=function(_0x11404f,_0x3ccd42){_0x11404f=_0x11404f-0x0;var _0x4ff0a7=_0x9582[_0x11404f];return _0x4ff0a7;};'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')]('FreshsalesAccount,\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')]('FreshsalesAccount,\x20%s,\x20%s',_0xa385ec,_0x429d42);_0x5ec1b3(_0x429d42);});});}exports['GetFreshsalesAccount']=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']('GetFreshsalesAccount',_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['FreshsalesAccount'][_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')]('ShowFreshsalesAccount',_0x584179,JSON[_0x2958('0x12')](_0xc4a303));_0x222b83(_0xc4a303);})[_0x2958('0x24')](function(_0x281817){logger[_0x2958('0x13')]('ShowFreshsalesAccount',_0x281817[_0x2958('0x15')],_0x584179);_0x2c73e9(_0x2d9472[_0x2958('0x13')](0x1f4,_0x281817[_0x2958('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index d1bfe83..c14f427 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 _0x32f0=['getDescriptions','getFields','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects','/:id/descriptions'];(function(_0x2b5a3c,_0x2f12e7){var _0x569d51=function(_0x366300){while(--_0x366300){_0x2b5a3c['push'](_0x2b5a3c['shift']());}};_0x569d51(++_0x2f12e7);}(_0x32f0,0x128));var _0x032f=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x32f0[_0x1fd675];return _0x16b554;};'use strict';var multer=require('multer');var util=require(_0x032f('0x0'));var path=require('path');var timeout=require(_0x032f('0x1'));var express=require(_0x032f('0x2'));var router=express[_0x032f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x032f('0x4'));var config=require(_0x032f('0x5'));var controller=require(_0x032f('0x6'));router[_0x032f('0x7')]('/',auth[_0x032f('0x8')](),controller['index']);router[_0x032f('0x7')]('/:id',auth[_0x032f('0x8')](),controller[_0x032f('0x9')]);router['get'](_0x032f('0xa'),auth[_0x032f('0x8')](),controller['getSubjects']);router[_0x032f('0x7')](_0x032f('0xb'),auth['isAuthenticated'](),controller[_0x032f('0xc')]);router[_0x032f('0x7')]('/:id/fields',auth[_0x032f('0x8')](),controller[_0x032f('0xd')]);router[_0x032f('0xe')]('/',auth[_0x032f('0x8')](),controller[_0x032f('0xf')]);router[_0x032f('0x10')](_0x032f('0x11'),auth[_0x032f('0x8')](),controller[_0x032f('0x12')]);router[_0x032f('0x13')](_0x032f('0x11'),auth[_0x032f('0x8')](),controller[_0x032f('0x14')]);module[_0x032f('0x15')]=router; \ No newline at end of file +var _0x11d2=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy'];(function(_0xd05552,_0xc3f3d4){var _0x2567df=function(_0x3e8c28){while(--_0x3e8c28){_0xd05552['push'](_0xd05552['shift']());}};_0x2567df(++_0xc3f3d4);}(_0x11d2,0x1b6));var _0x211d=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x11d2[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0x211d('0x0'));var util=require('util');var path=require(_0x211d('0x1'));var timeout=require('connect-timeout');var express=require(_0x211d('0x2'));var router=express[_0x211d('0x3')]();var fs_extra=require(_0x211d('0x4'));var auth=require(_0x211d('0x5'));var interaction=require(_0x211d('0x6'));var config=require('../../config/environment');var controller=require(_0x211d('0x7'));router['get']('/',auth[_0x211d('0x8')](),controller[_0x211d('0x9')]);router[_0x211d('0xa')](_0x211d('0xb'),auth[_0x211d('0x8')](),controller[_0x211d('0xc')]);router[_0x211d('0xa')](_0x211d('0xd'),auth[_0x211d('0x8')](),controller[_0x211d('0xe')]);router['get'](_0x211d('0xf'),auth[_0x211d('0x8')](),controller[_0x211d('0x10')]);router[_0x211d('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x211d('0x11')]('/',auth[_0x211d('0x8')](),controller[_0x211d('0x12')]);router[_0x211d('0x13')](_0x211d('0xb'),auth[_0x211d('0x8')](),controller[_0x211d('0x14')]);router['delete'](_0x211d('0xb'),auth[_0x211d('0x8')](),controller[_0x211d('0x15')]);module[_0x211d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 09338b4..2e5322c 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 _0x8003=['exports','STRING'];(function(_0x9fdd0c,_0x59b230){var _0x224beb=function(_0x4a606e){while(--_0x4a606e){_0x9fdd0c['push'](_0x9fdd0c['shift']());}};_0x224beb(++_0x59b230);}(_0x8003,0x1e2));var _0x3800=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x8003[_0x2c0dc0];return _0x4c0990;};'use strict';var Sequelize=require('sequelize');module[_0x3800('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3800('0x1')]}}; \ No newline at end of file +var _0xef38=['sequelize','exports','STRING'];(function(_0x39fc7a,_0x3a3ac3){var _0x1277c5=function(_0x2fa08d){while(--_0x2fa08d){_0x39fc7a['push'](_0x39fc7a['shift']());}};_0x1277c5(++_0x3a3ac3);}(_0xef38,0x1d7));var _0x8ef3=function(_0x17cef1,_0x2ec1a2){_0x17cef1=_0x17cef1-0x0;var _0xd67b10=_0xef38[_0x17cef1];return _0xd67b10;};'use strict';var Sequelize=require(_0x8ef3('0x0'));module[_0x8ef3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8ef3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 80a1b29..8c0464d 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 _0x895c=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4b9877,_0x3b174b){var _0x57fc8f=function(_0x1a9b24){while(--_0x1a9b24){_0x4b9877['push'](_0x4b9877['shift']());}};_0x57fc8f(++_0x3b174b);}(_0x895c,0x173));var _0xc895=function(_0xae7883,_0xabf9c8){_0xae7883=_0xae7883-0x0;var _0xd55326=_0x895c[_0xae7883];return _0xd55326;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc895('0x0'));var zipdir=require(_0xc895('0x1'));var jsonpatch=require(_0xc895('0x2'));var rp=require(_0xc895('0x3'));var moment=require('moment');var BPromise=require(_0xc895('0x4'));var Mustache=require(_0xc895('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc895('0x6'));var csv=require(_0xc895('0x7'));var ejs=require(_0xc895('0x8'));var fs=require('fs');var fs_extra=require(_0xc895('0x9'));var _=require(_0xc895('0xa'));var squel=require('squel');var crypto=require(_0xc895('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc895('0xc'));var toCsv=require(_0xc895('0x7'));var querystring=require(_0xc895('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc895('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc895('0xf'));var logger=require(_0xc895('0x10'))(_0xc895('0x11'));var utils=require(_0xc895('0x12'));var config=require(_0xc895('0x13'));var licenseUtil=require(_0xc895('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2797,_0x452e00){_0x452e00=_0x452e00||0xcc;return function(_0x26b9ed){if(_0x26b9ed){return _0x4f2797[_0xc895('0x15')](_0x452e00);}return _0x4f2797[_0xc895('0x16')](_0x452e00)[_0xc895('0x17')]();};}function respondWithResult(_0x4d4fea,_0x4219d5){_0x4219d5=_0x4219d5||0xc8;return function(_0xc626ee){if(_0xc626ee){return _0x4d4fea[_0xc895('0x16')](_0x4219d5)[_0xc895('0x18')](_0xc626ee);}};}function respondWithFilteredResult(_0x4a7ca3,_0x3272c1){return function(_0x34b804){if(_0x34b804){var _0x3933b8=typeof _0x3272c1[_0xc895('0x19')]===_0xc895('0x1a')&&typeof _0x3272c1[_0xc895('0x1b')]===_0xc895('0x1a');var _0x5d77db=_0x34b804[_0xc895('0x1c')];var _0x18a547=_0x3933b8?0x0:_0x3272c1[_0xc895('0x19')];var _0x3234dd=_0x3933b8?_0x34b804[_0xc895('0x1c')]:_0x3272c1[_0xc895('0x19')]+_0x3272c1[_0xc895('0x1b')];var _0x586c6a;if(_0x3234dd>=_0x5d77db){_0x3234dd=_0x5d77db;_0x586c6a=0xc8;}else{_0x586c6a=0xce;}_0x4a7ca3[_0xc895('0x16')](_0x586c6a);return _0x4a7ca3[_0xc895('0x1d')]('Content-Range',_0x18a547+'-'+_0x3234dd+'/'+_0x5d77db)[_0xc895('0x18')](_0x34b804);}return null;};}function patchUpdates(_0x1dba01){return function(_0x159b08){try{jsonpatch[_0xc895('0x1e')](_0x159b08,_0x1dba01,!![]);}catch(_0x5b613b){return BPromise[_0xc895('0x1f')](_0x5b613b);}return _0x159b08['save']();};}function saveUpdates(_0x2e86f8,_0x250533){return function(_0x14cb6d){if(_0x14cb6d){return _0x14cb6d[_0xc895('0x20')](_0x2e86f8)[_0xc895('0x21')](function(_0xec82f0){return _0xec82f0;});}return null;};}function removeEntity(_0x48bd50,_0x4c7a95){return function(_0x56fc97){if(_0x56fc97){return _0x56fc97[_0xc895('0x22')]()[_0xc895('0x21')](function(){_0x48bd50[_0xc895('0x16')](0xcc)[_0xc895('0x17')]();});}};}function handleEntityNotFound(_0x4a05f3,_0x2cadaf){return function(_0x4d6af7){if(!_0x4d6af7){_0x4a05f3['sendStatus'](0x194);}return _0x4d6af7;};}function handleError(_0x3d3863,_0x2a8700){_0x2a8700=_0x2a8700||0x1f4;return function(_0x52fdba){logger[_0xc895('0x23')](_0x52fdba[_0xc895('0x24')]);if(_0x52fdba['name']){delete _0x52fdba[_0xc895('0x25')];}_0x3d3863[_0xc895('0x16')](_0x2a8700)[_0xc895('0x26')](_0x52fdba);};}exports[_0xc895('0x27')]=function(_0x1554ac,_0x414b9a){var _0x49e0f1={},_0x4c1911={},_0x6f74d8={'count':0x0,'rows':[]};var _0x3db7f3=_[_0xc895('0x28')](db[_0xc895('0x29')][_0xc895('0x2a')],function(_0x18ecbc){return{'name':_0x18ecbc[_0xc895('0x2b')],'type':_0x18ecbc['type'][_0xc895('0x2c')]};});_0x4c1911[_0xc895('0x2d')]=_['map'](_0x3db7f3,_0xc895('0x25'));_0x4c1911['query']=_[_0xc895('0x2e')](_0x1554ac[_0xc895('0x2f')]);_0x4c1911[_0xc895('0x30')]=_[_0xc895('0x31')](_0x4c1911[_0xc895('0x2d')],_0x4c1911[_0xc895('0x2f')]);_0x49e0f1[_0xc895('0x32')]=_[_0xc895('0x31')](_0x4c1911['model'],qs[_0xc895('0x33')](_0x1554ac[_0xc895('0x2f')][_0xc895('0x33')]));_0x49e0f1[_0xc895('0x32')]=_0x49e0f1['attributes'][_0xc895('0x34')]?_0x49e0f1['attributes']:_0x4c1911[_0xc895('0x2d')];if(!_0x1554ac[_0xc895('0x2f')][_0xc895('0x35')](_0xc895('0x36'))){_0x49e0f1[_0xc895('0x1b')]=qs[_0xc895('0x1b')](_0x1554ac[_0xc895('0x2f')][_0xc895('0x1b')]);_0x49e0f1[_0xc895('0x19')]=qs[_0xc895('0x19')](_0x1554ac[_0xc895('0x2f')]['offset']);}_0x49e0f1[_0xc895('0x37')]=qs['sort'](_0x1554ac[_0xc895('0x2f')][_0xc895('0x38')]);_0x49e0f1[_0xc895('0x39')]=qs[_0xc895('0x30')](_['pick'](_0x1554ac['query'],_0x4c1911['filters']),_0x3db7f3);if(_0x1554ac['query'][_0xc895('0x3a')]){_0x49e0f1['where']=_[_0xc895('0x3b')](_0x49e0f1[_0xc895('0x39')],{'$or':_[_0xc895('0x28')](_0x3db7f3,function(_0x14dd7f){if(_0x14dd7f[_0xc895('0x3c')]!=='VIRTUAL'){var _0x310dc5={};_0x310dc5[_0x14dd7f[_0xc895('0x25')]]={'$like':'%'+_0x1554ac[_0xc895('0x2f')][_0xc895('0x3a')]+'%'};return _0x310dc5;}})});}_0x49e0f1=_[_0xc895('0x3b')]({},_0x49e0f1,_0x1554ac[_0xc895('0x3d')]);var _0x51ad5c={'where':_0x49e0f1[_0xc895('0x39')]};return db[_0xc895('0x29')][_0xc895('0x1c')](_0x51ad5c)[_0xc895('0x21')](function(_0x121ee3){_0x6f74d8[_0xc895('0x1c')]=_0x121ee3;if(_0x1554ac[_0xc895('0x2f')][_0xc895('0x3e')]){_0x49e0f1[_0xc895('0x3f')]=[{'all':!![]}];}return db[_0xc895('0x29')][_0xc895('0x40')](_0x49e0f1);})[_0xc895('0x21')](function(_0x57124d){_0x6f74d8[_0xc895('0x41')]=_0x57124d;return _0x6f74d8;})[_0xc895('0x21')](respondWithFilteredResult(_0x414b9a,_0x49e0f1))[_0xc895('0x42')](handleError(_0x414b9a,null));};exports[_0xc895('0x43')]=function(_0x2998a5,_0x55512f){var _0x3dfcda={'raw':![],'where':{'id':_0x2998a5[_0xc895('0x44')]['id']}},_0x547c0a={};_0x547c0a[_0xc895('0x2d')]=_[_0xc895('0x2e')](db[_0xc895('0x29')][_0xc895('0x2a')]);_0x547c0a['query']=_[_0xc895('0x2e')](_0x2998a5[_0xc895('0x2f')]);_0x547c0a[_0xc895('0x30')]=_[_0xc895('0x31')](_0x547c0a['model'],_0x547c0a[_0xc895('0x2f')]);_0x3dfcda['attributes']=_[_0xc895('0x31')](_0x547c0a[_0xc895('0x2d')],qs[_0xc895('0x33')](_0x2998a5[_0xc895('0x2f')]['fields']));_0x3dfcda[_0xc895('0x32')]=_0x3dfcda[_0xc895('0x32')][_0xc895('0x34')]?_0x3dfcda[_0xc895('0x32')]:_0x547c0a['model'];if(_0x2998a5['query']['includeAll']){_0x3dfcda['include']=[{'all':!![]}];}_0x3dfcda=_['merge']({},_0x3dfcda,_0x2998a5[_0xc895('0x3d')]);return db[_0xc895('0x29')][_0xc895('0x45')](_0x3dfcda)['then'](handleEntityNotFound(_0x55512f,null))[_0xc895('0x21')](respondWithResult(_0x55512f,null))[_0xc895('0x42')](handleError(_0x55512f,null));};exports[_0xc895('0x46')]=function(_0x450bb9,_0x113544){return db[_0xc895('0x29')][_0xc895('0x46')](_0x450bb9['body'],{})['then'](respondWithResult(_0x113544,0xc9))['catch'](handleError(_0x113544,null));};exports[_0xc895('0x20')]=function(_0x469b83,_0x4f1215){if(_0x469b83[_0xc895('0x47')]['id']){delete _0x469b83[_0xc895('0x47')]['id'];}return db[_0xc895('0x29')][_0xc895('0x45')]({'where':{'id':_0x469b83['params']['id']}})[_0xc895('0x21')](handleEntityNotFound(_0x4f1215,null))[_0xc895('0x21')](saveUpdates(_0x469b83['body'],null))[_0xc895('0x21')](respondWithResult(_0x4f1215,null))[_0xc895('0x42')](handleError(_0x4f1215,null));};exports[_0xc895('0x22')]=function(_0xf0ba33,_0x3d9849){return db['FreshsalesConfiguration'][_0xc895('0x45')]({'where':{'id':_0xf0ba33[_0xc895('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d9849,null))['then'](removeEntity(_0x3d9849,null))['catch'](handleError(_0x3d9849,null));};exports[_0xc895('0x48')]=function(_0x43c994,_0x47ee74,_0x22cf69){var _0x49f8ad={};var _0x54b920={};var _0x169cf3;var _0x50600b;return db[_0xc895('0x29')][_0xc895('0x49')]({'where':{'id':_0x43c994['params']['id']}})[_0xc895('0x21')](handleEntityNotFound(_0x47ee74,null))[_0xc895('0x21')](function(_0x1554d6){if(_0x1554d6){_0x169cf3=_0x1554d6;_0x54b920[_0xc895('0x2d')]=_[_0xc895('0x2e')](db[_0xc895('0x4a')]['rawAttributes']);_0x54b920['query']=_[_0xc895('0x2e')](_0x43c994[_0xc895('0x2f')]);_0x54b920[_0xc895('0x30')]=_[_0xc895('0x31')](_0x54b920[_0xc895('0x2d')],_0x54b920[_0xc895('0x2f')]);_0x49f8ad[_0xc895('0x32')]=_[_0xc895('0x31')](_0x54b920[_0xc895('0x2d')],qs[_0xc895('0x33')](_0x43c994['query']['fields']));_0x49f8ad[_0xc895('0x32')]=_0x49f8ad[_0xc895('0x32')]['length']?_0x49f8ad[_0xc895('0x32')]:_0x54b920[_0xc895('0x2d')];_0x49f8ad[_0xc895('0x37')]=qs['sort'](_0x43c994['query']['sort']);_0x49f8ad[_0xc895('0x39')]=qs[_0xc895('0x30')](_['pick'](_0x43c994[_0xc895('0x2f')],_0x54b920[_0xc895('0x30')]));if(_0x43c994[_0xc895('0x2f')][_0xc895('0x3a')]){_0x49f8ad[_0xc895('0x39')]=_[_0xc895('0x3b')](_0x49f8ad[_0xc895('0x39')],{'$or':_[_0xc895('0x28')](_0x49f8ad[_0xc895('0x32')],function(_0x25295b){var _0xc317f5={};_0xc317f5[_0x25295b]={'$like':'%'+_0x43c994[_0xc895('0x2f')][_0xc895('0x3a')]+'%'};return _0xc317f5;})});}_0x49f8ad=_[_0xc895('0x3b')]({},_0x49f8ad,_0x43c994[_0xc895('0x3d')]);return _0x169cf3[_0xc895('0x48')](_0x49f8ad);}})[_0xc895('0x21')](function(_0x5b28aa){if(_0x5b28aa){_0x50600b=_0x5b28aa[_0xc895('0x34')];if(!_0x43c994[_0xc895('0x2f')]['hasOwnProperty']('nolimit')){_0x49f8ad['limit']=qs[_0xc895('0x1b')](_0x43c994[_0xc895('0x2f')][_0xc895('0x1b')]);_0x49f8ad['offset']=qs['offset'](_0x43c994[_0xc895('0x2f')][_0xc895('0x19')]);}return _0x169cf3[_0xc895('0x48')](_0x49f8ad);}})[_0xc895('0x21')](function(_0x972fdb){if(_0x972fdb){return _0x972fdb?{'count':_0x50600b,'rows':_0x972fdb}:null;}})[_0xc895('0x21')](respondWithResult(_0x47ee74,null))[_0xc895('0x42')](handleError(_0x47ee74,null));};exports['getDescriptions']=function(_0x2c2d73,_0x4515cc,_0x39a2df){var _0x36ca76={};var _0x575f27={};var _0x12a9e4;var _0x3b090a;return db[_0xc895('0x29')]['findOne']({'where':{'id':_0x2c2d73['params']['id']}})[_0xc895('0x21')](handleEntityNotFound(_0x4515cc,null))[_0xc895('0x21')](function(_0x3d5ba0){if(_0x3d5ba0){_0x12a9e4=_0x3d5ba0;_0x575f27[_0xc895('0x2d')]=_[_0xc895('0x2e')](db[_0xc895('0x4a')][_0xc895('0x2a')]);_0x575f27['query']=_[_0xc895('0x2e')](_0x2c2d73[_0xc895('0x2f')]);_0x575f27[_0xc895('0x30')]=_['intersection'](_0x575f27[_0xc895('0x2d')],_0x575f27[_0xc895('0x2f')]);_0x36ca76[_0xc895('0x32')]=_[_0xc895('0x31')](_0x575f27['model'],qs[_0xc895('0x33')](_0x2c2d73[_0xc895('0x2f')][_0xc895('0x33')]));_0x36ca76[_0xc895('0x32')]=_0x36ca76[_0xc895('0x32')][_0xc895('0x34')]?_0x36ca76['attributes']:_0x575f27[_0xc895('0x2d')];_0x36ca76['order']=qs['sort'](_0x2c2d73[_0xc895('0x2f')][_0xc895('0x38')]);_0x36ca76['where']=qs[_0xc895('0x30')](_[_0xc895('0x4b')](_0x2c2d73['query'],_0x575f27[_0xc895('0x30')]));if(_0x2c2d73[_0xc895('0x2f')][_0xc895('0x3a')]){_0x36ca76[_0xc895('0x39')]=_[_0xc895('0x3b')](_0x36ca76[_0xc895('0x39')],{'$or':_['map'](_0x36ca76[_0xc895('0x32')],function(_0x36a41f){var _0x3eba7c={};_0x3eba7c[_0x36a41f]={'$like':'%'+_0x2c2d73['query']['filter']+'%'};return _0x3eba7c;})});}_0x36ca76=_[_0xc895('0x3b')]({},_0x36ca76,_0x2c2d73[_0xc895('0x3d')]);return _0x12a9e4['getDescriptions'](_0x36ca76);}})[_0xc895('0x21')](function(_0x350ad9){if(_0x350ad9){_0x3b090a=_0x350ad9[_0xc895('0x34')];if(!_0x2c2d73[_0xc895('0x2f')][_0xc895('0x35')]('nolimit')){_0x36ca76[_0xc895('0x1b')]=qs['limit'](_0x2c2d73['query'][_0xc895('0x1b')]);_0x36ca76[_0xc895('0x19')]=qs[_0xc895('0x19')](_0x2c2d73['query'][_0xc895('0x19')]);}return _0x12a9e4[_0xc895('0x4c')](_0x36ca76);}})[_0xc895('0x21')](function(_0x12221a){if(_0x12221a){return _0x12221a?{'count':_0x3b090a,'rows':_0x12221a}:null;}})[_0xc895('0x21')](respondWithResult(_0x4515cc,null))['catch'](handleError(_0x4515cc,null));};exports[_0xc895('0x4d')]=function(_0x3540f5,_0x1a3d69,_0x9ca11){var _0x2b122a={};var _0x1d883d={};var _0x40d78e;var _0x2a7a79;return db[_0xc895('0x29')][_0xc895('0x49')]({'where':{'id':_0x3540f5[_0xc895('0x44')]['id']}})[_0xc895('0x21')](handleEntityNotFound(_0x1a3d69,null))[_0xc895('0x21')](function(_0x7e6d6a){if(_0x7e6d6a){_0x40d78e=_0x7e6d6a;_0x1d883d[_0xc895('0x2d')]=_[_0xc895('0x2e')](db[_0xc895('0x4a')][_0xc895('0x2a')]);_0x1d883d[_0xc895('0x2f')]=_[_0xc895('0x2e')](_0x3540f5['query']);_0x1d883d[_0xc895('0x30')]=_[_0xc895('0x31')](_0x1d883d[_0xc895('0x2d')],_0x1d883d[_0xc895('0x2f')]);_0x2b122a['attributes']=_[_0xc895('0x31')](_0x1d883d[_0xc895('0x2d')],qs['fields'](_0x3540f5[_0xc895('0x2f')]['fields']));_0x2b122a['attributes']=_0x2b122a['attributes'][_0xc895('0x34')]?_0x2b122a['attributes']:_0x1d883d[_0xc895('0x2d')];_0x2b122a[_0xc895('0x37')]=qs[_0xc895('0x38')](_0x3540f5[_0xc895('0x2f')][_0xc895('0x38')]);_0x2b122a[_0xc895('0x39')]=qs[_0xc895('0x30')](_[_0xc895('0x4b')](_0x3540f5[_0xc895('0x2f')],_0x1d883d[_0xc895('0x30')]));if(_0x3540f5[_0xc895('0x2f')][_0xc895('0x3a')]){_0x2b122a[_0xc895('0x39')]=_[_0xc895('0x3b')](_0x2b122a['where'],{'$or':_[_0xc895('0x28')](_0x2b122a['attributes'],function(_0x22dded){var _0x491c7b={};_0x491c7b[_0x22dded]={'$like':'%'+_0x3540f5[_0xc895('0x2f')][_0xc895('0x3a')]+'%'};return _0x491c7b;})});}_0x2b122a=_[_0xc895('0x3b')]({},_0x2b122a,_0x3540f5['options']);return _0x40d78e['getFields'](_0x2b122a);}})[_0xc895('0x21')](function(_0x301709){if(_0x301709){_0x2a7a79=_0x301709[_0xc895('0x34')];if(!_0x3540f5['query'][_0xc895('0x35')](_0xc895('0x36'))){_0x2b122a['limit']=qs['limit'](_0x3540f5[_0xc895('0x2f')][_0xc895('0x1b')]);_0x2b122a[_0xc895('0x19')]=qs[_0xc895('0x19')](_0x3540f5[_0xc895('0x2f')][_0xc895('0x19')]);}return _0x40d78e[_0xc895('0x4d')](_0x2b122a);}})['then'](function(_0x26f9b4){if(_0x26f9b4){return _0x26f9b4?{'count':_0x2a7a79,'rows':_0x26f9b4}:null;}})[_0xc895('0x21')](respondWithResult(_0x1a3d69,null))[_0xc895('0x42')](handleError(_0x1a3d69,null));}; \ No newline at end of file +var _0x7651=['length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','getFields','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields'];(function(_0x3b392c,_0x72f9ff){var _0x486928=function(_0x25b372){while(--_0x25b372){_0x3b392c['push'](_0x3b392c['shift']());}};_0x486928(++_0x72f9ff);}(_0x7651,0x6c));var _0x1765=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7651[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1765('0x0'));var rimraf=require(_0x1765('0x1'));var zipdir=require(_0x1765('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1765('0x3'));var BPromise=require(_0x1765('0x4'));var Mustache=require(_0x1765('0x5'));var util=require(_0x1765('0x6'));var path=require(_0x1765('0x7'));var sox=require(_0x1765('0x8'));var csv=require(_0x1765('0x9'));var ejs=require(_0x1765('0xa'));var fs=require('fs');var fs_extra=require(_0x1765('0xb'));var _=require(_0x1765('0xc'));var squel=require(_0x1765('0xd'));var crypto=require(_0x1765('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1765('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1765('0x10'));var Papa=require(_0x1765('0x11'));var Redis=require('ioredis');var authService=require(_0x1765('0x12'));var qs=require(_0x1765('0x13'));var as=require(_0x1765('0x14'));var hardwareService=require(_0x1765('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1765('0x16'));var config=require(_0x1765('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1765('0x18'))['db'];function respondWithStatusCode(_0x23d93d,_0x3b6c3a){_0x3b6c3a=_0x3b6c3a||0xcc;return function(_0x1e5d74){if(_0x1e5d74){return _0x23d93d['sendStatus'](_0x3b6c3a);}return _0x23d93d[_0x1765('0x19')](_0x3b6c3a)['end']();};}function respondWithResult(_0x35652f,_0x439194){_0x439194=_0x439194||0xc8;return function(_0x2be0ae){if(_0x2be0ae){return _0x35652f[_0x1765('0x19')](_0x439194)[_0x1765('0x1a')](_0x2be0ae);}};}function respondWithFilteredResult(_0x2213ec,_0x5fb7e2){return function(_0x43c82f){if(_0x43c82f){var _0x1e48ef=typeof _0x5fb7e2[_0x1765('0x1b')]===_0x1765('0x1c')&&typeof _0x5fb7e2[_0x1765('0x1d')]===_0x1765('0x1c');var _0x4583cf=_0x43c82f['count'];var _0xdf0e44=_0x1e48ef?0x0:_0x5fb7e2[_0x1765('0x1b')];var _0x1892b5=_0x1e48ef?_0x43c82f[_0x1765('0x1e')]:_0x5fb7e2[_0x1765('0x1b')]+_0x5fb7e2[_0x1765('0x1d')];var _0x33971b;if(_0x1892b5>=_0x4583cf){_0x1892b5=_0x4583cf;_0x33971b=0xc8;}else{_0x33971b=0xce;}_0x2213ec[_0x1765('0x19')](_0x33971b);return _0x2213ec[_0x1765('0x1f')](_0x1765('0x20'),_0xdf0e44+'-'+_0x1892b5+'/'+_0x4583cf)[_0x1765('0x1a')](_0x43c82f);}return null;};}function patchUpdates(_0x50b08d){return function(_0x1ce006){try{jsonpatch[_0x1765('0x21')](_0x1ce006,_0x50b08d,!![]);}catch(_0x148e0a){return BPromise[_0x1765('0x22')](_0x148e0a);}return _0x1ce006[_0x1765('0x23')]();};}function saveUpdates(_0x2b4a99,_0x5be216){return function(_0x138216){if(_0x138216){return _0x138216[_0x1765('0x24')](_0x2b4a99)['then'](function(_0x562af0){return _0x562af0;});}return null;};}function removeEntity(_0x4a0bb4,_0x4e4c2a){return function(_0x3b40c3){if(_0x3b40c3){return _0x3b40c3[_0x1765('0x25')]()[_0x1765('0x26')](function(){_0x4a0bb4[_0x1765('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x293003,_0x6ad7ab){return function(_0x1b3fda){if(!_0x1b3fda){_0x293003[_0x1765('0x27')](0x194);}return _0x1b3fda;};}function handleError(_0x579994,_0x2762f3){_0x2762f3=_0x2762f3||0x1f4;return function(_0x2936f){logger[_0x1765('0x28')](_0x2936f[_0x1765('0x29')]);if(_0x2936f[_0x1765('0x2a')]){delete _0x2936f['name'];}_0x579994[_0x1765('0x19')](_0x2762f3)[_0x1765('0x2b')](_0x2936f);};}exports[_0x1765('0x2c')]=function(_0x109468,_0x1c395e){var _0x3b0a62={},_0x65137c={},_0x3e3882={'count':0x0,'rows':[]};var _0x311da4=_[_0x1765('0x2d')](db[_0x1765('0x2e')][_0x1765('0x2f')],function(_0x589522){return{'name':_0x589522['fieldName'],'type':_0x589522[_0x1765('0x30')]['key']};});_0x65137c['model']=_[_0x1765('0x2d')](_0x311da4,_0x1765('0x2a'));_0x65137c[_0x1765('0x31')]=_[_0x1765('0x32')](_0x109468['query']);_0x65137c[_0x1765('0x33')]=_[_0x1765('0x34')](_0x65137c[_0x1765('0x35')],_0x65137c[_0x1765('0x31')]);_0x3b0a62[_0x1765('0x36')]=_['intersection'](_0x65137c[_0x1765('0x35')],qs[_0x1765('0x37')](_0x109468[_0x1765('0x31')]['fields']));_0x3b0a62[_0x1765('0x36')]=_0x3b0a62[_0x1765('0x36')][_0x1765('0x38')]?_0x3b0a62[_0x1765('0x36')]:_0x65137c[_0x1765('0x35')];if(!_0x109468[_0x1765('0x31')][_0x1765('0x39')]('nolimit')){_0x3b0a62['limit']=qs[_0x1765('0x1d')](_0x109468['query']['limit']);_0x3b0a62[_0x1765('0x1b')]=qs[_0x1765('0x1b')](_0x109468[_0x1765('0x31')][_0x1765('0x1b')]);}_0x3b0a62[_0x1765('0x3a')]=qs[_0x1765('0x3b')](_0x109468[_0x1765('0x31')][_0x1765('0x3b')]);_0x3b0a62['where']=qs[_0x1765('0x33')](_[_0x1765('0x3c')](_0x109468[_0x1765('0x31')],_0x65137c[_0x1765('0x33')]),_0x311da4);if(_0x109468[_0x1765('0x31')][_0x1765('0x3d')]){_0x3b0a62[_0x1765('0x3e')]=_['merge'](_0x3b0a62[_0x1765('0x3e')],{'$or':_['map'](_0x311da4,function(_0xf11f2c){if(_0xf11f2c['type']!==_0x1765('0x3f')){var _0x496504={};_0x496504[_0xf11f2c['name']]={'$like':'%'+_0x109468[_0x1765('0x31')][_0x1765('0x3d')]+'%'};return _0x496504;}})});}_0x3b0a62=_[_0x1765('0x40')]({},_0x3b0a62,_0x109468[_0x1765('0x41')]);var _0x1e521a={'where':_0x3b0a62[_0x1765('0x3e')]};return db['FreshsalesConfiguration'][_0x1765('0x1e')](_0x1e521a)[_0x1765('0x26')](function(_0x284a87){_0x3e3882[_0x1765('0x1e')]=_0x284a87;if(_0x109468[_0x1765('0x31')][_0x1765('0x42')]){_0x3b0a62[_0x1765('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x1765('0x44')](_0x3b0a62);})[_0x1765('0x26')](function(_0x479045){_0x3e3882[_0x1765('0x45')]=_0x479045;return _0x3e3882;})['then'](respondWithFilteredResult(_0x1c395e,_0x3b0a62))[_0x1765('0x46')](handleError(_0x1c395e,null));};exports[_0x1765('0x47')]=function(_0x18f0df,_0x465836){var _0x5cf0d2={'raw':![],'where':{'id':_0x18f0df['params']['id']}},_0x3bd4c0={};_0x3bd4c0['model']=_[_0x1765('0x32')](db[_0x1765('0x2e')][_0x1765('0x2f')]);_0x3bd4c0['query']=_[_0x1765('0x32')](_0x18f0df[_0x1765('0x31')]);_0x3bd4c0['filters']=_[_0x1765('0x34')](_0x3bd4c0[_0x1765('0x35')],_0x3bd4c0[_0x1765('0x31')]);_0x5cf0d2['attributes']=_[_0x1765('0x34')](_0x3bd4c0[_0x1765('0x35')],qs['fields'](_0x18f0df[_0x1765('0x31')][_0x1765('0x37')]));_0x5cf0d2['attributes']=_0x5cf0d2[_0x1765('0x36')][_0x1765('0x38')]?_0x5cf0d2['attributes']:_0x3bd4c0['model'];if(_0x18f0df[_0x1765('0x31')][_0x1765('0x42')]){_0x5cf0d2[_0x1765('0x43')]=[{'all':!![]}];}_0x5cf0d2=_[_0x1765('0x40')]({},_0x5cf0d2,_0x18f0df[_0x1765('0x41')]);return db['FreshsalesConfiguration'][_0x1765('0x48')](_0x5cf0d2)[_0x1765('0x26')](handleEntityNotFound(_0x465836,null))['then'](respondWithResult(_0x465836,null))[_0x1765('0x46')](handleError(_0x465836,null));};exports[_0x1765('0x49')]=function(_0x46ea5d,_0x4efae2){return db[_0x1765('0x2e')][_0x1765('0x49')](_0x46ea5d[_0x1765('0x4a')],{})[_0x1765('0x26')](respondWithResult(_0x4efae2,0xc9))['catch'](handleError(_0x4efae2,null));};exports[_0x1765('0x24')]=function(_0x5a7c99,_0x1d36c3){if(_0x5a7c99[_0x1765('0x4a')]['id']){delete _0x5a7c99[_0x1765('0x4a')]['id'];}return db['FreshsalesConfiguration'][_0x1765('0x48')]({'where':{'id':_0x5a7c99['params']['id']}})['then'](handleEntityNotFound(_0x1d36c3,null))[_0x1765('0x26')](saveUpdates(_0x5a7c99['body'],null))[_0x1765('0x26')](respondWithResult(_0x1d36c3,null))['catch'](handleError(_0x1d36c3,null));};exports['destroy']=function(_0x2b9e32,_0x395113){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2b9e32[_0x1765('0x4b')]['id']}})[_0x1765('0x26')](handleEntityNotFound(_0x395113,null))[_0x1765('0x26')](removeEntity(_0x395113,null))[_0x1765('0x46')](handleError(_0x395113,null));};exports[_0x1765('0x4c')]=function(_0x377423,_0x5218fa,_0x523ebb){var _0x32a08a={};var _0x2b2d9a={};var _0x1fc32b;var _0x586ab8;return db[_0x1765('0x2e')][_0x1765('0x4d')]({'where':{'id':_0x377423['params']['id']}})[_0x1765('0x26')](handleEntityNotFound(_0x5218fa,null))['then'](function(_0x55c7a7){if(_0x55c7a7){_0x1fc32b=_0x55c7a7;_0x2b2d9a['model']=_[_0x1765('0x32')](db[_0x1765('0x4e')][_0x1765('0x2f')]);_0x2b2d9a['query']=_['keys'](_0x377423[_0x1765('0x31')]);_0x2b2d9a[_0x1765('0x33')]=_[_0x1765('0x34')](_0x2b2d9a[_0x1765('0x35')],_0x2b2d9a[_0x1765('0x31')]);_0x32a08a[_0x1765('0x36')]=_['intersection'](_0x2b2d9a['model'],qs[_0x1765('0x37')](_0x377423[_0x1765('0x31')][_0x1765('0x37')]));_0x32a08a[_0x1765('0x36')]=_0x32a08a[_0x1765('0x36')][_0x1765('0x38')]?_0x32a08a[_0x1765('0x36')]:_0x2b2d9a[_0x1765('0x35')];_0x32a08a[_0x1765('0x3a')]=qs[_0x1765('0x3b')](_0x377423[_0x1765('0x31')][_0x1765('0x3b')]);_0x32a08a[_0x1765('0x3e')]=qs[_0x1765('0x33')](_[_0x1765('0x3c')](_0x377423['query'],_0x2b2d9a['filters']));if(_0x377423[_0x1765('0x31')][_0x1765('0x3d')]){_0x32a08a[_0x1765('0x3e')]=_[_0x1765('0x40')](_0x32a08a[_0x1765('0x3e')],{'$or':_[_0x1765('0x2d')](_0x32a08a['attributes'],function(_0x525429){var _0x4482c9={};_0x4482c9[_0x525429]={'$like':'%'+_0x377423[_0x1765('0x31')][_0x1765('0x3d')]+'%'};return _0x4482c9;})});}_0x32a08a=_['merge']({},_0x32a08a,_0x377423['options']);return _0x1fc32b[_0x1765('0x4c')](_0x32a08a);}})['then'](function(_0xf4dad4){if(_0xf4dad4){_0x586ab8=_0xf4dad4[_0x1765('0x38')];if(!_0x377423['query']['hasOwnProperty'](_0x1765('0x4f'))){_0x32a08a[_0x1765('0x1d')]=qs[_0x1765('0x1d')](_0x377423[_0x1765('0x31')][_0x1765('0x1d')]);_0x32a08a[_0x1765('0x1b')]=qs[_0x1765('0x1b')](_0x377423[_0x1765('0x31')][_0x1765('0x1b')]);}return _0x1fc32b[_0x1765('0x4c')](_0x32a08a);}})['then'](function(_0x5b92b3){if(_0x5b92b3){return _0x5b92b3?{'count':_0x586ab8,'rows':_0x5b92b3}:null;}})[_0x1765('0x26')](respondWithResult(_0x5218fa,null))[_0x1765('0x46')](handleError(_0x5218fa,null));};exports['getDescriptions']=function(_0x2fbf15,_0x44187a,_0x391408){var _0x4c994e={};var _0x1e38d7={};var _0x464000;var _0x423b0e;return db['FreshsalesConfiguration'][_0x1765('0x4d')]({'where':{'id':_0x2fbf15[_0x1765('0x4b')]['id']}})['then'](handleEntityNotFound(_0x44187a,null))['then'](function(_0x1c69fe){if(_0x1c69fe){_0x464000=_0x1c69fe;_0x1e38d7['model']=_[_0x1765('0x32')](db[_0x1765('0x4e')][_0x1765('0x2f')]);_0x1e38d7[_0x1765('0x31')]=_[_0x1765('0x32')](_0x2fbf15['query']);_0x1e38d7[_0x1765('0x33')]=_[_0x1765('0x34')](_0x1e38d7[_0x1765('0x35')],_0x1e38d7[_0x1765('0x31')]);_0x4c994e[_0x1765('0x36')]=_[_0x1765('0x34')](_0x1e38d7[_0x1765('0x35')],qs[_0x1765('0x37')](_0x2fbf15['query']['fields']));_0x4c994e[_0x1765('0x36')]=_0x4c994e[_0x1765('0x36')][_0x1765('0x38')]?_0x4c994e[_0x1765('0x36')]:_0x1e38d7[_0x1765('0x35')];_0x4c994e[_0x1765('0x3a')]=qs[_0x1765('0x3b')](_0x2fbf15[_0x1765('0x31')][_0x1765('0x3b')]);_0x4c994e[_0x1765('0x3e')]=qs[_0x1765('0x33')](_[_0x1765('0x3c')](_0x2fbf15[_0x1765('0x31')],_0x1e38d7[_0x1765('0x33')]));if(_0x2fbf15[_0x1765('0x31')][_0x1765('0x3d')]){_0x4c994e[_0x1765('0x3e')]=_[_0x1765('0x40')](_0x4c994e['where'],{'$or':_[_0x1765('0x2d')](_0x4c994e['attributes'],function(_0x8e5154){var _0x323894={};_0x323894[_0x8e5154]={'$like':'%'+_0x2fbf15[_0x1765('0x31')]['filter']+'%'};return _0x323894;})});}_0x4c994e=_['merge']({},_0x4c994e,_0x2fbf15['options']);return _0x464000['getDescriptions'](_0x4c994e);}})['then'](function(_0x241468){if(_0x241468){_0x423b0e=_0x241468[_0x1765('0x38')];if(!_0x2fbf15[_0x1765('0x31')][_0x1765('0x39')]('nolimit')){_0x4c994e['limit']=qs[_0x1765('0x1d')](_0x2fbf15[_0x1765('0x31')]['limit']);_0x4c994e[_0x1765('0x1b')]=qs[_0x1765('0x1b')](_0x2fbf15[_0x1765('0x31')][_0x1765('0x1b')]);}return _0x464000[_0x1765('0x50')](_0x4c994e);}})['then'](function(_0x333db3){if(_0x333db3){return _0x333db3?{'count':_0x423b0e,'rows':_0x333db3}:null;}})['then'](respondWithResult(_0x44187a,null))[_0x1765('0x46')](handleError(_0x44187a,null));};exports[_0x1765('0x51')]=function(_0x42a402,_0x4b243c,_0x4c7c12){var _0x5cf060={};var _0x2c2ad6={};var _0x26269f;var _0x324c45;return db[_0x1765('0x2e')]['findOne']({'where':{'id':_0x42a402[_0x1765('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b243c,null))[_0x1765('0x26')](function(_0x493749){if(_0x493749){_0x26269f=_0x493749;_0x2c2ad6[_0x1765('0x35')]=_[_0x1765('0x32')](db['FreshsalesField'][_0x1765('0x2f')]);_0x2c2ad6['query']=_['keys'](_0x42a402['query']);_0x2c2ad6[_0x1765('0x33')]=_[_0x1765('0x34')](_0x2c2ad6[_0x1765('0x35')],_0x2c2ad6['query']);_0x5cf060[_0x1765('0x36')]=_[_0x1765('0x34')](_0x2c2ad6['model'],qs[_0x1765('0x37')](_0x42a402['query'][_0x1765('0x37')]));_0x5cf060[_0x1765('0x36')]=_0x5cf060[_0x1765('0x36')][_0x1765('0x38')]?_0x5cf060[_0x1765('0x36')]:_0x2c2ad6['model'];_0x5cf060['order']=qs[_0x1765('0x3b')](_0x42a402[_0x1765('0x31')][_0x1765('0x3b')]);_0x5cf060['where']=qs[_0x1765('0x33')](_[_0x1765('0x3c')](_0x42a402[_0x1765('0x31')],_0x2c2ad6[_0x1765('0x33')]));if(_0x42a402[_0x1765('0x31')][_0x1765('0x3d')]){_0x5cf060[_0x1765('0x3e')]=_[_0x1765('0x40')](_0x5cf060[_0x1765('0x3e')],{'$or':_[_0x1765('0x2d')](_0x5cf060[_0x1765('0x36')],function(_0x53bc33){var _0x1c089c={};_0x1c089c[_0x53bc33]={'$like':'%'+_0x42a402[_0x1765('0x31')][_0x1765('0x3d')]+'%'};return _0x1c089c;})});}_0x5cf060=_[_0x1765('0x40')]({},_0x5cf060,_0x42a402[_0x1765('0x41')]);return _0x26269f[_0x1765('0x51')](_0x5cf060);}})['then'](function(_0x1fa3b7){if(_0x1fa3b7){_0x324c45=_0x1fa3b7[_0x1765('0x38')];if(!_0x42a402['query'][_0x1765('0x39')](_0x1765('0x4f'))){_0x5cf060[_0x1765('0x1d')]=qs['limit'](_0x42a402['query'][_0x1765('0x1d')]);_0x5cf060[_0x1765('0x1b')]=qs['offset'](_0x42a402[_0x1765('0x31')][_0x1765('0x1b')]);}return _0x26269f['getFields'](_0x5cf060);}})['then'](function(_0x3fa022){if(_0x3fa022){return _0x3fa022?{'count':_0x324c45,'rows':_0x3fa022}:null;}})[_0x1765('0x26')](respondWithResult(_0x4b243c,null))[_0x1765('0x46')](handleError(_0x4b243c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 3d42849..40e9c46 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 _0x6cd5=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3a2125,_0x319659){var _0x52eb47=function(_0x5970f1){while(--_0x5970f1){_0x3a2125['push'](_0x3a2125['shift']());}};_0x52eb47(++_0x319659);}(_0x6cd5,0x15a));var _0x56cd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6cd5[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x56cd('0x0'));var util=require(_0x56cd('0x1'));var logger=require(_0x56cd('0x2'))(_0x56cd('0x3'));var moment=require(_0x56cd('0x4'));var BPromise=require(_0x56cd('0x5'));var rp=require(_0x56cd('0x6'));var fs=require('fs');var path=require(_0x56cd('0x7'));var rimraf=require(_0x56cd('0x8'));var config=require(_0x56cd('0x9'));var attributes=require(_0x56cd('0xa'));module[_0x56cd('0xb')]=function(_0x173389,_0xece93e){return _0x173389['define']('FreshsalesConfiguration',attributes,{'tableName':_0x56cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x610f=['./intFreshsalesConfiguration.attributes','bluebird','request-promise','../../config/environment'];(function(_0x1502b0,_0x323f9b){var _0x274f05=function(_0x3e3afa){while(--_0x3e3afa){_0x1502b0['push'](_0x1502b0['shift']());}};_0x274f05(++_0x323f9b);}(_0x610f,0xa5));var _0xf610=function(_0x22ad0c,_0x56e8a1){_0x22ad0c=_0x22ad0c-0x0;var _0x3787a9=_0x610f[_0x22ad0c];return _0x3787a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf610('0x0'));var rp=require(_0xf610('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf610('0x2'));var attributes=require(_0xf610('0x3'));module['exports']=function(_0x44cec7,_0x2524bb){return _0x44cec7['define']('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index d4e86f0..0982ecd 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 _0xef4a=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xef4a,0x1d0));var _0xaef4=function(_0x4f14cb,_0x3e514b){_0x4f14cb=_0x4f14cb-0x0;var _0x1766a5=_0xef4a[_0x4f14cb];return _0x1766a5;};'use strict';var _=require(_0xaef4('0x0'));var util=require('util');var moment=require(_0xaef4('0x1'));var BPromise=require(_0xaef4('0x2'));var rs=require(_0xaef4('0x3'));var fs=require('fs');var Redis=require(_0xaef4('0x4'));var db=require(_0xaef4('0x5'))['db'];var utils=require(_0xaef4('0x6'));var logger=require('../../config/logger')(_0xaef4('0x7'));var config=require(_0xaef4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaef4('0x9')][_0xaef4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20e3ee,_0x6c6bcc,_0x16ebd7){return new BPromise(function(_0x48efea,_0x1cabd6){return client[_0xaef4('0xb')](_0x20e3ee,_0x16ebd7)[_0xaef4('0xc')](function(_0x47c65b){logger['info'](_0xaef4('0xd'),_0x6c6bcc,'request\x20sent');logger[_0xaef4('0xe')](_0xaef4('0xf'),_0x6c6bcc,_0xaef4('0x10'),JSON[_0xaef4('0x11')](_0x47c65b));if(_0x47c65b[_0xaef4('0x12')]){if(_0x47c65b[_0xaef4('0x12')][_0xaef4('0x13')]===0x1f4){logger[_0xaef4('0x12')](_0xaef4('0xd'),_0x6c6bcc,_0x47c65b[_0xaef4('0x12')][_0xaef4('0x14')]);return _0x1cabd6(_0x47c65b[_0xaef4('0x12')][_0xaef4('0x14')]);}logger[_0xaef4('0x12')](_0xaef4('0xd'),_0x6c6bcc,_0x47c65b[_0xaef4('0x12')]['message']);return _0x48efea(_0x47c65b[_0xaef4('0x12')][_0xaef4('0x14')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x6c6bcc,_0xaef4('0x10'));_0x48efea(_0x47c65b['result'][_0xaef4('0x14')]);}})[_0xaef4('0x15')](function(_0x872296){logger[_0xaef4('0x12')](_0xaef4('0xd'),_0x6c6bcc,_0x872296);_0x1cabd6(_0x872296);});});} \ No newline at end of file +var _0x640a=['FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b7708,_0x243af9){var _0x3a13c0=function(_0x2d3cd7){while(--_0x2d3cd7){_0x3b7708['push'](_0x3b7708['shift']());}};_0x3a13c0(++_0x243af9);}(_0x640a,0xcd));var _0xa640=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x640a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xa640('0x0'));var util=require(_0xa640('0x1'));var moment=require(_0xa640('0x2'));var BPromise=require(_0xa640('0x3'));var rs=require(_0xa640('0x4'));var fs=require('fs');var Redis=require(_0xa640('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa640('0x6'));var logger=require(_0xa640('0x7'))(_0xa640('0x8'));var config=require(_0xa640('0x9'));var jayson=require(_0xa640('0xa'));var client=jayson[_0xa640('0xb')][_0xa640('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f6d7a,_0x8dc2ae,_0x395f29){return new BPromise(function(_0x2255d3,_0x3c2d46){return client[_0xa640('0xd')](_0x4f6d7a,_0x395f29)['then'](function(_0x3051c8){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x8dc2ae,_0xa640('0xe'));logger[_0xa640('0xf')](_0xa640('0x10'),_0x8dc2ae,_0xa640('0xe'),JSON[_0xa640('0x11')](_0x3051c8));if(_0x3051c8[_0xa640('0x12')]){if(_0x3051c8[_0xa640('0x12')][_0xa640('0x13')]===0x1f4){logger[_0xa640('0x12')](_0xa640('0x14'),_0x8dc2ae,_0x3051c8[_0xa640('0x12')][_0xa640('0x15')]);return _0x3c2d46(_0x3051c8[_0xa640('0x12')]['message']);}logger[_0xa640('0x12')](_0xa640('0x14'),_0x8dc2ae,_0x3051c8[_0xa640('0x12')][_0xa640('0x15')]);return _0x2255d3(_0x3051c8[_0xa640('0x12')][_0xa640('0x15')]);}else{logger[_0xa640('0x16')](_0xa640('0x14'),_0x8dc2ae,'request\x20sent');_0x2255d3(_0x3051c8[_0xa640('0x17')][_0xa640('0x15')]);}})[_0xa640('0x18')](function(_0x33b8dd){logger[_0xa640('0x12')](_0xa640('0x14'),_0x8dc2ae,_0x33b8dd);_0x3c2d46(_0x33b8dd);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8dce7e8..4560f5e 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 _0x5645=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x5645,0x19e));var _0x5564=function(_0x471fbd,_0x450a53){_0x471fbd=_0x471fbd-0x0;var _0xd10e82=_0x5645[_0x471fbd];return _0xd10e82;};'use strict';var multer=require(_0x5564('0x0'));var util=require(_0x5564('0x1'));var path=require(_0x5564('0x2'));var timeout=require(_0x5564('0x3'));var express=require(_0x5564('0x4'));var router=express['Router']();var fs_extra=require(_0x5564('0x5'));var auth=require(_0x5564('0x6'));var interaction=require(_0x5564('0x7'));var config=require(_0x5564('0x8'));var controller=require(_0x5564('0x9'));router[_0x5564('0xa')]('/',auth[_0x5564('0xb')](),controller[_0x5564('0xc')]);router[_0x5564('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5564('0xd')]);router[_0x5564('0xe')]('/',auth[_0x5564('0xb')](),controller[_0x5564('0xf')]);router[_0x5564('0x10')]('/:id',auth[_0x5564('0xb')](),controller[_0x5564('0x11')]);router['delete'](_0x5564('0x12'),auth[_0x5564('0xb')](),controller[_0x5564('0x13')]);module[_0x5564('0x14')]=router; \ No newline at end of file +var _0xa75b=['/:id','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x5dea35,_0x892157){var _0x54f2ea=function(_0x6072eb){while(--_0x6072eb){_0x5dea35['push'](_0x5dea35['shift']());}};_0x54f2ea(++_0x892157);}(_0xa75b,0x170));var _0xba75=function(_0x2760ef,_0x4e889d){_0x2760ef=_0x2760ef-0x0;var _0xe84387=_0xa75b[_0x2760ef];return _0xe84387;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xba75('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xba75('0xe')]('/:id',auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')](_0xba75('0xc'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);module[_0xba75('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index eb08bad..459b961 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 _0x0225=['exports','ENUM','customVariable','keyValue','picklist','STRING','string','variable'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x0225,0x140));var _0x5022=function(_0x2c5df9,_0x2811cb){_0x2c5df9=_0x2c5df9-0x0;var _0x39d1d0=_0x0225[_0x2c5df9];return _0x39d1d0;};'use strict';var Sequelize=require('sequelize');module[_0x5022('0x0')]={'type':{'type':Sequelize[_0x5022('0x1')]('string','variable',_0x5022('0x2'),_0x5022('0x3'),_0x5022('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5022('0x5')]},'key':{'type':Sequelize[_0x5022('0x5')]},'keyType':{'type':Sequelize[_0x5022('0x1')](_0x5022('0x6'),_0x5022('0x7'),_0x5022('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5022('0x5')]}}; \ No newline at end of file +var _0xc15b=['sequelize','exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x3ddc7b,_0xdcd659){var _0x8a4b3e=function(_0x3f5e8d){while(--_0x3f5e8d){_0x3ddc7b['push'](_0x3ddc7b['shift']());}};_0x8a4b3e(++_0xdcd659);}(_0xc15b,0x1b8));var _0xbc15=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xc15b[_0x52684f];return _0x4a55f0;};'use strict';var Sequelize=require(_0xbc15('0x0'));module[_0xbc15('0x1')]={'type':{'type':Sequelize[_0xbc15('0x2')](_0xbc15('0x3'),_0xbc15('0x4'),_0xbc15('0x5'),'keyValue','picklist'),'defaultValue':_0xbc15('0x3')},'content':{'type':Sequelize[_0xbc15('0x6')]},'key':{'type':Sequelize[_0xbc15('0x6')]},'keyType':{'type':Sequelize[_0xbc15('0x2')]('string','variable',_0xbc15('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbc15('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbc15('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbc15('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 08d05cb..b722d5b 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 _0xd463=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','Content-Range','apply','update','then','destroy','end','error','stack','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util'];(function(_0x311ede,_0x2a31c8){var _0x1cb63c=function(_0x175dca){while(--_0x175dca){_0x311ede['push'](_0x311ede['shift']());}};_0x1cb63c(++_0x2a31c8);}(_0xd463,0xc6));var _0x3d46=function(_0x3e7b07,_0x19364a){_0x3e7b07=_0x3e7b07-0x0;var _0x33c396=_0xd463[_0x3e7b07];return _0x33c396;};'use strict';var emlformat=require(_0x3d46('0x0'));var rimraf=require(_0x3d46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d46('0x2'));var rp=require('request-promise');var moment=require(_0x3d46('0x3'));var BPromise=require(_0x3d46('0x4'));var Mustache=require('mustache');var util=require(_0x3d46('0x5'));var path=require(_0x3d46('0x6'));var sox=require(_0x3d46('0x7'));var csv=require(_0x3d46('0x8'));var ejs=require(_0x3d46('0x9'));var fs=require('fs');var fs_extra=require(_0x3d46('0xa'));var _=require(_0x3d46('0xb'));var squel=require(_0x3d46('0xc'));var crypto=require(_0x3d46('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3d46('0xe'));var toCsv=require(_0x3d46('0x8'));var querystring=require(_0x3d46('0xf'));var Papa=require(_0x3d46('0x10'));var Redis=require(_0x3d46('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3d46('0x12'));var as=require(_0x3d46('0x13'));var hardwareService=require(_0x3d46('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3d46('0x15'));var config=require(_0x3d46('0x16'));var licenseUtil=require(_0x3d46('0x17'));var db=require(_0x3d46('0x18'))['db'];function respondWithStatusCode(_0x421639,_0x701687){_0x701687=_0x701687||0xcc;return function(_0x4021d1){if(_0x4021d1){return _0x421639['sendStatus'](_0x701687);}return _0x421639['status'](_0x701687)['end']();};}function respondWithResult(_0xfb2550,_0x2bf2c8){_0x2bf2c8=_0x2bf2c8||0xc8;return function(_0xfc1d1a){if(_0xfc1d1a){return _0xfb2550[_0x3d46('0x19')](_0x2bf2c8)[_0x3d46('0x1a')](_0xfc1d1a);}};}function respondWithFilteredResult(_0x406cf1,_0x51021e){return function(_0x5ea546){if(_0x5ea546){var _0x371f7c=typeof _0x51021e[_0x3d46('0x1b')]==='undefined'&&typeof _0x51021e[_0x3d46('0x1c')]==='undefined';var _0x3115ab=_0x5ea546[_0x3d46('0x1d')];var _0xdaecd7=_0x371f7c?0x0:_0x51021e[_0x3d46('0x1b')];var _0x1edb49=_0x371f7c?_0x5ea546[_0x3d46('0x1d')]:_0x51021e['offset']+_0x51021e[_0x3d46('0x1c')];var _0x259624;if(_0x1edb49>=_0x3115ab){_0x1edb49=_0x3115ab;_0x259624=0xc8;}else{_0x259624=0xce;}_0x406cf1[_0x3d46('0x19')](_0x259624);return _0x406cf1['set'](_0x3d46('0x1e'),_0xdaecd7+'-'+_0x1edb49+'/'+_0x3115ab)[_0x3d46('0x1a')](_0x5ea546);}return null;};}function patchUpdates(_0x1a1328){return function(_0x262389){try{jsonpatch[_0x3d46('0x1f')](_0x262389,_0x1a1328,!![]);}catch(_0x4524b8){return BPromise['reject'](_0x4524b8);}return _0x262389['save']();};}function saveUpdates(_0x216b62,_0x48e9b1){return function(_0x274de8){if(_0x274de8){return _0x274de8[_0x3d46('0x20')](_0x216b62)[_0x3d46('0x21')](function(_0x57b8d8){return _0x57b8d8;});}return null;};}function removeEntity(_0x29e60d,_0x2dbd6b){return function(_0x474055){if(_0x474055){return _0x474055[_0x3d46('0x22')]()['then'](function(){_0x29e60d['status'](0xcc)[_0x3d46('0x23')]();});}};}function handleEntityNotFound(_0x152c00,_0x4431c5){return function(_0x1c69d7){if(!_0x1c69d7){_0x152c00['sendStatus'](0x194);}return _0x1c69d7;};}function handleError(_0x53bafd,_0x394cca){_0x394cca=_0x394cca||0x1f4;return function(_0x3e7d35){logger[_0x3d46('0x24')](_0x3e7d35[_0x3d46('0x25')]);if(_0x3e7d35['name']){delete _0x3e7d35['name'];}_0x53bafd[_0x3d46('0x19')](_0x394cca)['send'](_0x3e7d35);};}exports['index']=function(_0x4f302b,_0x466499){var _0x202158={},_0x20c64b={},_0x543603={'count':0x0,'rows':[]};var _0x36af7e=_[_0x3d46('0x26')](db[_0x3d46('0x27')][_0x3d46('0x28')],function(_0x3ee49d){return{'name':_0x3ee49d['fieldName'],'type':_0x3ee49d[_0x3d46('0x29')][_0x3d46('0x2a')]};});_0x20c64b[_0x3d46('0x2b')]=_[_0x3d46('0x26')](_0x36af7e,'name');_0x20c64b[_0x3d46('0x2c')]=_[_0x3d46('0x2d')](_0x4f302b[_0x3d46('0x2c')]);_0x20c64b[_0x3d46('0x2e')]=_[_0x3d46('0x2f')](_0x20c64b[_0x3d46('0x2b')],_0x20c64b[_0x3d46('0x2c')]);_0x202158['attributes']=_[_0x3d46('0x2f')](_0x20c64b[_0x3d46('0x2b')],qs[_0x3d46('0x30')](_0x4f302b[_0x3d46('0x2c')][_0x3d46('0x30')]));_0x202158[_0x3d46('0x31')]=_0x202158[_0x3d46('0x31')]['length']?_0x202158['attributes']:_0x20c64b[_0x3d46('0x2b')];if(!_0x4f302b['query']['hasOwnProperty'](_0x3d46('0x32'))){_0x202158[_0x3d46('0x1c')]=qs[_0x3d46('0x1c')](_0x4f302b['query']['limit']);_0x202158[_0x3d46('0x1b')]=qs['offset'](_0x4f302b['query'][_0x3d46('0x1b')]);}_0x202158['order']=qs[_0x3d46('0x33')](_0x4f302b[_0x3d46('0x2c')][_0x3d46('0x33')]);_0x202158['where']=qs[_0x3d46('0x2e')](_[_0x3d46('0x34')](_0x4f302b[_0x3d46('0x2c')],_0x20c64b[_0x3d46('0x2e')]),_0x36af7e);if(_0x4f302b[_0x3d46('0x2c')]['filter']){_0x202158[_0x3d46('0x35')]=_[_0x3d46('0x36')](_0x202158[_0x3d46('0x35')],{'$or':_['map'](_0x36af7e,function(_0x2f62cf){if(_0x2f62cf[_0x3d46('0x29')]!==_0x3d46('0x37')){var _0x3cc209={};_0x3cc209[_0x2f62cf['name']]={'$like':'%'+_0x4f302b[_0x3d46('0x2c')][_0x3d46('0x38')]+'%'};return _0x3cc209;}})});}_0x202158=_[_0x3d46('0x36')]({},_0x202158,_0x4f302b[_0x3d46('0x39')]);var _0x31dfcc={'where':_0x202158[_0x3d46('0x35')]};return db[_0x3d46('0x27')]['count'](_0x31dfcc)[_0x3d46('0x21')](function(_0x6e352){_0x543603[_0x3d46('0x1d')]=_0x6e352;if(_0x4f302b[_0x3d46('0x2c')]['includeAll']){_0x202158[_0x3d46('0x3a')]=[{'all':!![]}];}return db[_0x3d46('0x27')][_0x3d46('0x3b')](_0x202158);})['then'](function(_0x15a022){_0x543603['rows']=_0x15a022;return _0x543603;})[_0x3d46('0x21')](respondWithFilteredResult(_0x466499,_0x202158))[_0x3d46('0x3c')](handleError(_0x466499,null));};exports[_0x3d46('0x3d')]=function(_0x2b6303,_0x4a8cfc){var _0x459636={'raw':!![],'where':{'id':_0x2b6303[_0x3d46('0x3e')]['id']}},_0x704129={};_0x704129[_0x3d46('0x2b')]=_[_0x3d46('0x2d')](db['FreshsalesField'][_0x3d46('0x28')]);_0x704129[_0x3d46('0x2c')]=_[_0x3d46('0x2d')](_0x2b6303['query']);_0x704129[_0x3d46('0x2e')]=_[_0x3d46('0x2f')](_0x704129['model'],_0x704129[_0x3d46('0x2c')]);_0x459636[_0x3d46('0x31')]=_[_0x3d46('0x2f')](_0x704129[_0x3d46('0x2b')],qs['fields'](_0x2b6303['query']['fields']));_0x459636[_0x3d46('0x31')]=_0x459636[_0x3d46('0x31')][_0x3d46('0x3f')]?_0x459636[_0x3d46('0x31')]:_0x704129['model'];if(_0x2b6303[_0x3d46('0x2c')][_0x3d46('0x40')]){_0x459636['include']=[{'all':!![]}];}_0x459636=_[_0x3d46('0x36')]({},_0x459636,_0x2b6303['options']);return db['FreshsalesField'][_0x3d46('0x41')](_0x459636)[_0x3d46('0x21')](handleEntityNotFound(_0x4a8cfc,null))[_0x3d46('0x21')](respondWithResult(_0x4a8cfc,null))[_0x3d46('0x3c')](handleError(_0x4a8cfc,null));};exports['create']=function(_0x11d745,_0x1ab9f4){return db['FreshsalesField'][_0x3d46('0x42')](_0x11d745[_0x3d46('0x43')],{})[_0x3d46('0x21')](respondWithResult(_0x1ab9f4,0xc9))[_0x3d46('0x3c')](handleError(_0x1ab9f4,null));};exports[_0x3d46('0x20')]=function(_0x5e1fef,_0xf835ed){if(_0x5e1fef[_0x3d46('0x43')]['id']){delete _0x5e1fef[_0x3d46('0x43')]['id'];}return db[_0x3d46('0x27')][_0x3d46('0x41')]({'where':{'id':_0x5e1fef[_0x3d46('0x3e')]['id']}})[_0x3d46('0x21')](handleEntityNotFound(_0xf835ed,null))['then'](saveUpdates(_0x5e1fef[_0x3d46('0x43')],null))['then'](respondWithResult(_0xf835ed,null))[_0x3d46('0x3c')](handleError(_0xf835ed,null));};exports[_0x3d46('0x22')]=function(_0x28ffad,_0x179750){return db[_0x3d46('0x27')][_0x3d46('0x41')]({'where':{'id':_0x28ffad[_0x3d46('0x3e')]['id']}})['then'](handleEntityNotFound(_0x179750,null))[_0x3d46('0x21')](removeEntity(_0x179750,null))['catch'](handleError(_0x179750,null));}; \ No newline at end of file +var _0xc046=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','FreshsalesField','fieldName','type','key','keys','query','filters','attributes','intersection','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','fields','length','catch','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x5c1769,_0x1e1b10){var _0x5997c3=function(_0xd33813){while(--_0xd33813){_0x5c1769['push'](_0x5c1769['shift']());}};_0x5997c3(++_0x1e1b10);}(_0xc046,0xd1));var _0x6c04=function(_0x13535e,_0x590ff9){_0x13535e=_0x13535e-0x0;var _0x410ddc=_0xc046[_0x13535e];return _0x410ddc;};'use strict';var emlformat=require(_0x6c04('0x0'));var rimraf=require(_0x6c04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6c04('0x2'));var moment=require(_0x6c04('0x3'));var BPromise=require(_0x6c04('0x4'));var Mustache=require(_0x6c04('0x5'));var util=require(_0x6c04('0x6'));var path=require(_0x6c04('0x7'));var sox=require(_0x6c04('0x8'));var csv=require('to-csv');var ejs=require(_0x6c04('0x9'));var fs=require('fs');var fs_extra=require(_0x6c04('0xa'));var _=require(_0x6c04('0xb'));var squel=require(_0x6c04('0xc'));var crypto=require(_0x6c04('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6c04('0xe'));var toCsv=require(_0x6c04('0xf'));var querystring=require(_0x6c04('0x10'));var Papa=require(_0x6c04('0x11'));var Redis=require(_0x6c04('0x12'));var authService=require(_0x6c04('0x13'));var qs=require(_0x6c04('0x14'));var as=require(_0x6c04('0x15'));var hardwareService=require(_0x6c04('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6c04('0x17'))['db'];function respondWithStatusCode(_0x5a24ab,_0x517def){_0x517def=_0x517def||0xcc;return function(_0x226714){if(_0x226714){return _0x5a24ab[_0x6c04('0x18')](_0x517def);}return _0x5a24ab[_0x6c04('0x19')](_0x517def)[_0x6c04('0x1a')]();};}function respondWithResult(_0x56456a,_0x47be74){_0x47be74=_0x47be74||0xc8;return function(_0x292c13){if(_0x292c13){return _0x56456a[_0x6c04('0x19')](_0x47be74)['json'](_0x292c13);}};}function respondWithFilteredResult(_0x42790f,_0x46003a){return function(_0x222010){if(_0x222010){var _0x366444=typeof _0x46003a['offset']===_0x6c04('0x1b')&&typeof _0x46003a[_0x6c04('0x1c')]===_0x6c04('0x1b');var _0x4ba8a6=_0x222010[_0x6c04('0x1d')];var _0x2d065c=_0x366444?0x0:_0x46003a[_0x6c04('0x1e')];var _0xefb5dc=_0x366444?_0x222010[_0x6c04('0x1d')]:_0x46003a[_0x6c04('0x1e')]+_0x46003a[_0x6c04('0x1c')];var _0x124786;if(_0xefb5dc>=_0x4ba8a6){_0xefb5dc=_0x4ba8a6;_0x124786=0xc8;}else{_0x124786=0xce;}_0x42790f[_0x6c04('0x19')](_0x124786);return _0x42790f[_0x6c04('0x1f')]('Content-Range',_0x2d065c+'-'+_0xefb5dc+'/'+_0x4ba8a6)[_0x6c04('0x20')](_0x222010);}return null;};}function patchUpdates(_0x344240){return function(_0xcd201c){try{jsonpatch[_0x6c04('0x21')](_0xcd201c,_0x344240,!![]);}catch(_0x53f588){return BPromise[_0x6c04('0x22')](_0x53f588);}return _0xcd201c[_0x6c04('0x23')]();};}function saveUpdates(_0x1568e6,_0x3be096){return function(_0x14c0b8){if(_0x14c0b8){return _0x14c0b8['update'](_0x1568e6)[_0x6c04('0x24')](function(_0x240962){return _0x240962;});}return null;};}function removeEntity(_0x19b626,_0x2bdea8){return function(_0x470b23){if(_0x470b23){return _0x470b23[_0x6c04('0x25')]()[_0x6c04('0x24')](function(){_0x19b626[_0x6c04('0x19')](0xcc)[_0x6c04('0x1a')]();});}};}function handleEntityNotFound(_0x3168fb,_0xf24ff9){return function(_0xf4d037){if(!_0xf4d037){_0x3168fb[_0x6c04('0x18')](0x194);}return _0xf4d037;};}function handleError(_0x356bfd,_0x7ef048){_0x7ef048=_0x7ef048||0x1f4;return function(_0x2fa165){logger[_0x6c04('0x26')](_0x2fa165[_0x6c04('0x27')]);if(_0x2fa165['name']){delete _0x2fa165[_0x6c04('0x28')];}_0x356bfd[_0x6c04('0x19')](_0x7ef048)['send'](_0x2fa165);};}exports[_0x6c04('0x29')]=function(_0x2aef4e,_0x51363f){var _0x282521={},_0x320a54={},_0x4120c5={'count':0x0,'rows':[]};var _0x1e6efc=_[_0x6c04('0x2a')](db[_0x6c04('0x2b')]['rawAttributes'],function(_0x3af126){return{'name':_0x3af126[_0x6c04('0x2c')],'type':_0x3af126[_0x6c04('0x2d')][_0x6c04('0x2e')]};});_0x320a54['model']=_[_0x6c04('0x2a')](_0x1e6efc,_0x6c04('0x28'));_0x320a54['query']=_[_0x6c04('0x2f')](_0x2aef4e[_0x6c04('0x30')]);_0x320a54[_0x6c04('0x31')]=_['intersection'](_0x320a54['model'],_0x320a54[_0x6c04('0x30')]);_0x282521[_0x6c04('0x32')]=_[_0x6c04('0x33')](_0x320a54['model'],qs['fields'](_0x2aef4e[_0x6c04('0x30')]['fields']));_0x282521[_0x6c04('0x32')]=_0x282521[_0x6c04('0x32')]['length']?_0x282521[_0x6c04('0x32')]:_0x320a54[_0x6c04('0x34')];if(!_0x2aef4e[_0x6c04('0x30')][_0x6c04('0x35')](_0x6c04('0x36'))){_0x282521['limit']=qs[_0x6c04('0x1c')](_0x2aef4e[_0x6c04('0x30')]['limit']);_0x282521[_0x6c04('0x1e')]=qs['offset'](_0x2aef4e[_0x6c04('0x30')]['offset']);}_0x282521['order']=qs[_0x6c04('0x37')](_0x2aef4e[_0x6c04('0x30')][_0x6c04('0x37')]);_0x282521[_0x6c04('0x38')]=qs['filters'](_[_0x6c04('0x39')](_0x2aef4e[_0x6c04('0x30')],_0x320a54[_0x6c04('0x31')]),_0x1e6efc);if(_0x2aef4e['query'][_0x6c04('0x3a')]){_0x282521['where']=_[_0x6c04('0x3b')](_0x282521[_0x6c04('0x38')],{'$or':_[_0x6c04('0x2a')](_0x1e6efc,function(_0x170f98){if(_0x170f98[_0x6c04('0x2d')]!==_0x6c04('0x3c')){var _0x2f7e43={};_0x2f7e43[_0x170f98[_0x6c04('0x28')]]={'$like':'%'+_0x2aef4e[_0x6c04('0x30')]['filter']+'%'};return _0x2f7e43;}})});}_0x282521=_[_0x6c04('0x3b')]({},_0x282521,_0x2aef4e[_0x6c04('0x3d')]);var _0x3c7822={'where':_0x282521[_0x6c04('0x38')]};return db[_0x6c04('0x2b')][_0x6c04('0x1d')](_0x3c7822)[_0x6c04('0x24')](function(_0x5b0a43){_0x4120c5[_0x6c04('0x1d')]=_0x5b0a43;if(_0x2aef4e[_0x6c04('0x30')][_0x6c04('0x3e')]){_0x282521[_0x6c04('0x3f')]=[{'all':!![]}];}return db[_0x6c04('0x2b')][_0x6c04('0x40')](_0x282521);})[_0x6c04('0x24')](function(_0x1b98db){_0x4120c5[_0x6c04('0x41')]=_0x1b98db;return _0x4120c5;})[_0x6c04('0x24')](respondWithFilteredResult(_0x51363f,_0x282521))['catch'](handleError(_0x51363f,null));};exports['show']=function(_0x39f5dd,_0x587161){var _0x1227ca={'raw':!![],'where':{'id':_0x39f5dd[_0x6c04('0x42')]['id']}},_0xf9c647={};_0xf9c647[_0x6c04('0x34')]=_[_0x6c04('0x2f')](db[_0x6c04('0x2b')][_0x6c04('0x43')]);_0xf9c647['query']=_[_0x6c04('0x2f')](_0x39f5dd[_0x6c04('0x30')]);_0xf9c647[_0x6c04('0x31')]=_[_0x6c04('0x33')](_0xf9c647[_0x6c04('0x34')],_0xf9c647[_0x6c04('0x30')]);_0x1227ca[_0x6c04('0x32')]=_[_0x6c04('0x33')](_0xf9c647[_0x6c04('0x34')],qs[_0x6c04('0x44')](_0x39f5dd[_0x6c04('0x30')][_0x6c04('0x44')]));_0x1227ca[_0x6c04('0x32')]=_0x1227ca['attributes'][_0x6c04('0x45')]?_0x1227ca[_0x6c04('0x32')]:_0xf9c647[_0x6c04('0x34')];if(_0x39f5dd[_0x6c04('0x30')][_0x6c04('0x3e')]){_0x1227ca[_0x6c04('0x3f')]=[{'all':!![]}];}_0x1227ca=_['merge']({},_0x1227ca,_0x39f5dd['options']);return db[_0x6c04('0x2b')]['find'](_0x1227ca)[_0x6c04('0x24')](handleEntityNotFound(_0x587161,null))[_0x6c04('0x24')](respondWithResult(_0x587161,null))[_0x6c04('0x46')](handleError(_0x587161,null));};exports['create']=function(_0xfad6a0,_0x5d2cef){return db['FreshsalesField'][_0x6c04('0x47')](_0xfad6a0[_0x6c04('0x48')],{})[_0x6c04('0x24')](respondWithResult(_0x5d2cef,0xc9))[_0x6c04('0x46')](handleError(_0x5d2cef,null));};exports['update']=function(_0x583ccc,_0x58bd84){if(_0x583ccc[_0x6c04('0x48')]['id']){delete _0x583ccc[_0x6c04('0x48')]['id'];}return db[_0x6c04('0x2b')][_0x6c04('0x49')]({'where':{'id':_0x583ccc['params']['id']}})['then'](handleEntityNotFound(_0x58bd84,null))[_0x6c04('0x24')](saveUpdates(_0x583ccc[_0x6c04('0x48')],null))[_0x6c04('0x24')](respondWithResult(_0x58bd84,null))[_0x6c04('0x46')](handleError(_0x58bd84,null));};exports['destroy']=function(_0x138088,_0x4233f7){return db[_0x6c04('0x2b')][_0x6c04('0x49')]({'where':{'id':_0x138088['params']['id']}})[_0x6c04('0x24')](handleEntityNotFound(_0x4233f7,null))[_0x6c04('0x24')](removeEntity(_0x4233f7,null))['catch'](handleError(_0x4233f7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f378d65..9008179 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 _0xa467=['path','rimraf','exports','define','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x382d04,_0x39b007){var _0x56911a=function(_0x58388d){while(--_0x58388d){_0x382d04['push'](_0x382d04['shift']());}};_0x56911a(++_0x39b007);}(_0xa467,0x143));var _0x7a46=function(_0x3d8098,_0x44f0ca){_0x3d8098=_0x3d8098-0x0;var _0x20dff6=_0xa467[_0x3d8098];return _0x20dff6;};'use strict';var _=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var logger=require(_0x7a46('0x2'))(_0x7a46('0x3'));var moment=require(_0x7a46('0x4'));var BPromise=require(_0x7a46('0x5'));var rp=require(_0x7a46('0x6'));var fs=require('fs');var path=require(_0x7a46('0x7'));var rimraf=require(_0x7a46('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x7a46('0x9')]=function(_0x1940e6,_0x3bfa2c){return _0x1940e6[_0x7a46('0xa')](_0x7a46('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x7a46('0xc'),'fields':[_0x7a46('0xd'),_0x7a46('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe51=['idField','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xbe51,0x1e2));var _0x1be5=function(_0x32293f,_0x6ac095){_0x32293f=_0x32293f-0x0;var _0x3e0d02=_0xbe51[_0x32293f];return _0x3e0d02;};'use strict';var _=require(_0x1be5('0x0'));var util=require(_0x1be5('0x1'));var logger=require('../../config/logger')(_0x1be5('0x2'));var moment=require('moment');var BPromise=require(_0x1be5('0x3'));var rp=require(_0x1be5('0x4'));var fs=require('fs');var path=require(_0x1be5('0x5'));var rimraf=require(_0x1be5('0x6'));var config=require(_0x1be5('0x7'));var attributes=require(_0x1be5('0x8'));module[_0x1be5('0x9')]=function(_0x372836,_0x288927){return _0x372836[_0x1be5('0xa')](_0x1be5('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x1be5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index f96ea8c..8692576 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 _0xbd51=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x29e8fc,_0x193c52){_0x29e8fc=_0x29e8fc-0x0;var _0x9d8d9e=_0xbd51[_0x29e8fc];return _0x9d8d9e;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x2fe5bd,_0x771691){var _0x1127f6=function(_0x2b5ecc){while(--_0x2b5ecc){_0x2fe5bd['push'](_0x2fe5bd['shift']());}};_0x1127f6(++_0x771691);}(_0xabce,0x103));var _0xeabc=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xabce[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('FreshsalesField,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f9b130f..b2bd1b3 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(_0x241d15,_0x17d204){var _0x2b30f9=function(_0x2ad29a){while(--_0x2ad29a){_0x241d15['push'](_0x241d15['shift']());}};_0x2b30f9(++_0x17d204);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x278854,_0x1adff0){var _0x1024b9=function(_0x52e275){while(--_0x52e275){_0x278854['push'](_0x278854['shift']());}};_0x1024b9(++_0x1adff0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8f629bf..3468b20 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 _0x9648=['integrationTab','newTab','sequelize','STRING','username','ENUM'];(function(_0x323d17,_0x214e2d){var _0x25c3db=function(_0xd808dd){while(--_0xd808dd){_0x323d17['push'](_0x323d17['shift']());}};_0x25c3db(++_0x214e2d);}(_0x9648,0xa4));var _0x8964=function(_0x1454f6,_0x2b33db){_0x1454f6=_0x1454f6-0x0;var _0x255bcf=_0x9648[_0x1454f6];return _0x255bcf;};'use strict';var Sequelize=require(_0x8964('0x0'));module['exports']={'name':{'type':Sequelize[_0x8964('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8964('0x1')],'unique':_0x8964('0x2')},'remoteUri':{'type':Sequelize[_0x8964('0x1')]},'password':{'type':Sequelize[_0x8964('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x8964('0x1')]},'securityToken':{'type':Sequelize[_0x8964('0x1')]},'serverUrl':{'type':Sequelize[_0x8964('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8964('0x3')](_0x8964('0x4'),_0x8964('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xc17b=['sequelize','exports','STRING','username','integrationTab','newTab'];(function(_0x5405d5,_0x55d1fe){var _0xa67e1e=function(_0x221206){while(--_0x221206){_0x5405d5['push'](_0x5405d5['shift']());}};_0xa67e1e(++_0x55d1fe);}(_0xc17b,0xa2));var _0xbc17=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc17b[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0xbc17('0x0'));module[_0xbc17('0x1')]={'name':{'type':Sequelize[_0xbc17('0x2')]},'description':{'type':Sequelize[_0xbc17('0x2')]},'username':{'type':Sequelize[_0xbc17('0x2')],'unique':_0xbc17('0x3')},'remoteUri':{'type':Sequelize[_0xbc17('0x2')]},'password':{'type':Sequelize[_0xbc17('0x2')]},'clientId':{'type':Sequelize[_0xbc17('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xbc17('0x2')]},'serverUrl':{'type':Sequelize[_0xbc17('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbc17('0x4'),_0xbc17('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9e9e8a1..d5dff98 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 _0xe185=['sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','create','update','body','find','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','Task','clientId','username','password','securityToken','remoteUri','slice','Connection','clientSecret','login','concat','ticketType','sobject','IsRecurrence','Description','picklist','boolean','email','textarea','phone','remove','label','custom','picklistValues','True','true','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','request-promise','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration'];(function(_0x216ac9,_0x506dff){var _0x34de4b=function(_0x2d1aab){while(--_0x2d1aab){_0x216ac9['push'](_0x216ac9['shift']());}};_0x34de4b(++_0x506dff);}(_0xe185,0xd2));var _0x5e18=function(_0x27696e,_0x1bdf97){_0x27696e=_0x27696e-0x0;var _0xb063b5=_0xe185[_0x27696e];return _0xb063b5;};'use strict';var emlformat=require(_0x5e18('0x0'));var rimraf=require(_0x5e18('0x1'));var zipdir=require(_0x5e18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e18('0x3'));var moment=require(_0x5e18('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5e18('0x5'));var util=require(_0x5e18('0x6'));var path=require(_0x5e18('0x7'));var sox=require(_0x5e18('0x8'));var csv=require(_0x5e18('0x9'));var ejs=require(_0x5e18('0xa'));var fs=require('fs');var fs_extra=require(_0x5e18('0xb'));var _=require(_0x5e18('0xc'));var squel=require('squel');var crypto=require(_0x5e18('0xd'));var jsforce=require(_0x5e18('0xe'));var deskjs=require(_0x5e18('0xf'));var toCsv=require(_0x5e18('0x9'));var querystring=require(_0x5e18('0x10'));var Papa=require(_0x5e18('0x11'));var Redis=require(_0x5e18('0x12'));var authService=require(_0x5e18('0x13'));var qs=require(_0x5e18('0x14'));var as=require(_0x5e18('0x15'));var hardwareService=require(_0x5e18('0x16'));var logger=require(_0x5e18('0x17'))(_0x5e18('0x18'));var utils=require(_0x5e18('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5e18('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5e18('0x1b'));function respondWithStatusCode(_0x5f075c,_0x2eb181){_0x2eb181=_0x2eb181||0xcc;return function(_0x224c24){if(_0x224c24){return _0x5f075c[_0x5e18('0x1c')](_0x2eb181);}return _0x5f075c[_0x5e18('0x1d')](_0x2eb181)[_0x5e18('0x1e')]();};}function respondWithResult(_0x5daae2,_0x316259){_0x316259=_0x316259||0xc8;return function(_0x36b5c2){if(_0x36b5c2){return _0x5daae2[_0x5e18('0x1d')](_0x316259)[_0x5e18('0x1f')](_0x36b5c2);}};}function respondWithFilteredResult(_0x54a41e,_0x5a01b2){return function(_0x5e3022){if(_0x5e3022){var _0x3e0e5d=typeof _0x5a01b2[_0x5e18('0x20')]==='undefined'&&typeof _0x5a01b2[_0x5e18('0x21')]===_0x5e18('0x22');var _0x328a4d=_0x5e3022[_0x5e18('0x23')];var _0x15c575=_0x3e0e5d?0x0:_0x5a01b2['offset'];var _0x1b31b8=_0x3e0e5d?_0x5e3022[_0x5e18('0x23')]:_0x5a01b2[_0x5e18('0x20')]+_0x5a01b2['limit'];var _0x4992ea;if(_0x1b31b8>=_0x328a4d){_0x1b31b8=_0x328a4d;_0x4992ea=0xc8;}else{_0x4992ea=0xce;}_0x54a41e[_0x5e18('0x1d')](_0x4992ea);return _0x54a41e[_0x5e18('0x24')]('Content-Range',_0x15c575+'-'+_0x1b31b8+'/'+_0x328a4d)[_0x5e18('0x1f')](_0x5e3022);}return null;};}function patchUpdates(_0x1806ae){return function(_0x23f320){try{jsonpatch[_0x5e18('0x25')](_0x23f320,_0x1806ae,!![]);}catch(_0x58b263){return BPromise[_0x5e18('0x26')](_0x58b263);}return _0x23f320[_0x5e18('0x27')]();};}function saveUpdates(_0xb5000e,_0x3b057c){return function(_0x359258){if(_0x359258){return _0x359258['update'](_0xb5000e)[_0x5e18('0x28')](function(_0xe50a7c){return _0xe50a7c;});}return null;};}function removeEntity(_0x37e757,_0x11118f){return function(_0x52a70a){if(_0x52a70a){return _0x52a70a[_0x5e18('0x29')]()[_0x5e18('0x28')](function(){_0x37e757[_0x5e18('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10e87f,_0x8f3394){return function(_0x5d1e09){if(!_0x5d1e09){_0x10e87f['sendStatus'](0x194);}return _0x5d1e09;};}function handleError(_0x10884d,_0x429bcd){_0x429bcd=_0x429bcd||0x1f4;return function(_0x555295){logger['error'](_0x555295[_0x5e18('0x2a')]);if(_0x555295[_0x5e18('0x2b')]){delete _0x555295[_0x5e18('0x2b')];}_0x10884d[_0x5e18('0x1d')](_0x429bcd)[_0x5e18('0x2c')](_0x555295);};}exports[_0x5e18('0x2d')]=function(_0x497099,_0x21da34){var _0x230f3f={},_0x39bfe0={},_0x11385e={'count':0x0,'rows':[]};var _0x328689=_[_0x5e18('0x2e')](db[_0x5e18('0x2f')][_0x5e18('0x30')],function(_0x5af32f){return{'name':_0x5af32f[_0x5e18('0x31')],'type':_0x5af32f[_0x5e18('0x32')][_0x5e18('0x33')]};});_0x39bfe0[_0x5e18('0x34')]=_[_0x5e18('0x2e')](_0x328689,_0x5e18('0x2b'));_0x39bfe0['query']=_[_0x5e18('0x35')](_0x497099[_0x5e18('0x36')]);_0x39bfe0[_0x5e18('0x37')]=_[_0x5e18('0x38')](_0x39bfe0[_0x5e18('0x34')],_0x39bfe0[_0x5e18('0x36')]);_0x230f3f[_0x5e18('0x39')]=_[_0x5e18('0x38')](_0x39bfe0['model'],qs[_0x5e18('0x3a')](_0x497099[_0x5e18('0x36')][_0x5e18('0x3a')]));_0x230f3f['attributes']=_0x230f3f['attributes'][_0x5e18('0x3b')]?_0x230f3f[_0x5e18('0x39')]:_0x39bfe0[_0x5e18('0x34')];if(!_0x497099[_0x5e18('0x36')][_0x5e18('0x3c')](_0x5e18('0x3d'))){_0x230f3f['limit']=qs[_0x5e18('0x21')](_0x497099[_0x5e18('0x36')][_0x5e18('0x21')]);_0x230f3f[_0x5e18('0x20')]=qs[_0x5e18('0x20')](_0x497099[_0x5e18('0x36')][_0x5e18('0x20')]);}_0x230f3f[_0x5e18('0x3e')]=qs['sort'](_0x497099['query'][_0x5e18('0x3f')]);_0x230f3f[_0x5e18('0x40')]=qs[_0x5e18('0x37')](_[_0x5e18('0x41')](_0x497099[_0x5e18('0x36')],_0x39bfe0[_0x5e18('0x37')]),_0x328689);if(_0x497099[_0x5e18('0x36')]['filter']){_0x230f3f[_0x5e18('0x40')]=_[_0x5e18('0x42')](_0x230f3f[_0x5e18('0x40')],{'$or':_[_0x5e18('0x2e')](_0x328689,function(_0x238678){if(_0x238678['type']!==_0x5e18('0x43')){var _0x2d9efc={};_0x2d9efc[_0x238678[_0x5e18('0x2b')]]={'$like':'%'+_0x497099[_0x5e18('0x36')][_0x5e18('0x44')]+'%'};return _0x2d9efc;}})});}_0x230f3f=_['merge']({},_0x230f3f,_0x497099[_0x5e18('0x45')]);var _0x3d85df={'where':_0x230f3f[_0x5e18('0x40')]};return db[_0x5e18('0x2f')][_0x5e18('0x23')](_0x3d85df)['then'](function(_0x562b62){_0x11385e[_0x5e18('0x23')]=_0x562b62;if(_0x497099[_0x5e18('0x36')][_0x5e18('0x46')]){_0x230f3f[_0x5e18('0x47')]=[{'all':!![]}];}return db[_0x5e18('0x2f')][_0x5e18('0x48')](_0x230f3f);})[_0x5e18('0x28')](function(_0x1c0301){_0x11385e['rows']=_0x1c0301;return _0x11385e;})[_0x5e18('0x28')](respondWithFilteredResult(_0x21da34,_0x230f3f))[_0x5e18('0x49')](handleError(_0x21da34,null));};exports['show']=function(_0x40363c,_0x1d19b3){var _0x4d9485={'raw':![],'where':{'id':_0x40363c[_0x5e18('0x4a')]['id']}},_0x5ea536={};_0x5ea536[_0x5e18('0x34')]=_[_0x5e18('0x35')](db[_0x5e18('0x2f')][_0x5e18('0x30')]);_0x5ea536[_0x5e18('0x36')]=_[_0x5e18('0x35')](_0x40363c[_0x5e18('0x36')]);_0x5ea536[_0x5e18('0x37')]=_['intersection'](_0x5ea536[_0x5e18('0x34')],_0x5ea536['query']);_0x4d9485['attributes']=_['intersection'](_0x5ea536['model'],qs[_0x5e18('0x3a')](_0x40363c[_0x5e18('0x36')]['fields']));_0x4d9485[_0x5e18('0x39')]=_0x4d9485['attributes'][_0x5e18('0x3b')]?_0x4d9485[_0x5e18('0x39')]:_0x5ea536[_0x5e18('0x34')];if(_0x40363c[_0x5e18('0x36')][_0x5e18('0x46')]){_0x4d9485['include']=[{'all':!![]}];}_0x4d9485=_[_0x5e18('0x42')]({},_0x4d9485,_0x40363c[_0x5e18('0x45')]);return db[_0x5e18('0x2f')]['find'](_0x4d9485)[_0x5e18('0x28')](handleEntityNotFound(_0x1d19b3,null))[_0x5e18('0x28')](respondWithResult(_0x1d19b3,null))[_0x5e18('0x49')](handleError(_0x1d19b3,null));};exports[_0x5e18('0x4b')]=function(_0x3754bb,_0x29555f){return db['SalesforceAccount'][_0x5e18('0x4b')](_0x3754bb['body'],{})[_0x5e18('0x28')](respondWithResult(_0x29555f,0xc9))[_0x5e18('0x49')](handleError(_0x29555f,null));};exports[_0x5e18('0x4c')]=function(_0xb6463c,_0x30f721){if(_0xb6463c[_0x5e18('0x4d')]['id']){delete _0xb6463c[_0x5e18('0x4d')]['id'];}return db[_0x5e18('0x2f')][_0x5e18('0x4e')]({'where':{'id':_0xb6463c[_0x5e18('0x4a')]['id']}})[_0x5e18('0x28')](handleEntityNotFound(_0x30f721,null))[_0x5e18('0x28')](saveUpdates(_0xb6463c[_0x5e18('0x4d')],null))[_0x5e18('0x28')](respondWithResult(_0x30f721,null))['catch'](handleError(_0x30f721,null));};exports['destroy']=function(_0x76eadc,_0x2b3da0){return db[_0x5e18('0x2f')][_0x5e18('0x4e')]({'where':{'id':_0x76eadc[_0x5e18('0x4a')]['id']}})[_0x5e18('0x28')](handleEntityNotFound(_0x2b3da0,null))[_0x5e18('0x28')](removeEntity(_0x2b3da0,null))[_0x5e18('0x49')](handleError(_0x2b3da0,null));};exports[_0x5e18('0x4f')]=function(_0x22c5b8,_0x5b8bbf,_0x4b585b){var _0x996358={};var _0x2c3908={};var _0x2ad064;var _0x40ae83;return db[_0x5e18('0x2f')]['findOne']({'where':{'id':_0x22c5b8[_0x5e18('0x4a')]['id']}})[_0x5e18('0x28')](handleEntityNotFound(_0x5b8bbf,null))['then'](function(_0x42cb90){if(_0x42cb90){_0x2ad064=_0x42cb90;_0x2c3908[_0x5e18('0x34')]=_[_0x5e18('0x35')](db['SalesforceConfiguration']['rawAttributes']);_0x2c3908[_0x5e18('0x36')]=_[_0x5e18('0x35')](_0x22c5b8['query']);_0x2c3908['filters']=_[_0x5e18('0x38')](_0x2c3908[_0x5e18('0x34')],_0x2c3908['query']);_0x996358[_0x5e18('0x39')]=_['intersection'](_0x2c3908[_0x5e18('0x34')],qs[_0x5e18('0x3a')](_0x22c5b8[_0x5e18('0x36')][_0x5e18('0x3a')]));_0x996358[_0x5e18('0x39')]=_0x996358[_0x5e18('0x39')][_0x5e18('0x3b')]?_0x996358[_0x5e18('0x39')]:_0x2c3908['model'];_0x996358[_0x5e18('0x3e')]=qs[_0x5e18('0x3f')](_0x22c5b8[_0x5e18('0x36')][_0x5e18('0x3f')]);_0x996358['where']=qs[_0x5e18('0x37')](_['pick'](_0x22c5b8[_0x5e18('0x36')],_0x2c3908[_0x5e18('0x37')]));if(_0x22c5b8[_0x5e18('0x36')][_0x5e18('0x44')]){_0x996358[_0x5e18('0x40')]=_['merge'](_0x996358['where'],{'$or':_['map'](_0x996358[_0x5e18('0x39')],function(_0x36cd57){var _0x21385={};_0x21385[_0x36cd57]={'$like':'%'+_0x22c5b8[_0x5e18('0x36')][_0x5e18('0x44')]+'%'};return _0x21385;})});}_0x996358=_[_0x5e18('0x42')]({},_0x996358,_0x22c5b8[_0x5e18('0x45')]);return _0x2ad064[_0x5e18('0x4f')](_0x996358);}})[_0x5e18('0x28')](function(_0x2e9a7a){if(_0x2e9a7a){_0x40ae83=_0x2e9a7a[_0x5e18('0x3b')];if(!_0x22c5b8[_0x5e18('0x36')]['hasOwnProperty']('nolimit')){_0x996358[_0x5e18('0x21')]=qs[_0x5e18('0x21')](_0x22c5b8['query'][_0x5e18('0x21')]);_0x996358[_0x5e18('0x20')]=qs['offset'](_0x22c5b8[_0x5e18('0x36')]['offset']);}return _0x2ad064[_0x5e18('0x4f')](_0x996358);}})[_0x5e18('0x28')](function(_0x121078){if(_0x121078){return _0x121078?{'count':_0x40ae83,'rows':_0x121078}:null;}})['then'](respondWithResult(_0x5b8bbf,null))[_0x5e18('0x49')](handleError(_0x5b8bbf,null));};exports[_0x5e18('0x50')]=function(_0x59ab7c,_0x379a8d,_0x49f066){if(_0x59ab7c[_0x5e18('0x4d')]['id']){delete _0x59ab7c[_0x5e18('0x4d')]['id'];}return db['SalesforceAccount'][_0x5e18('0x51')]({'where':{'id':_0x59ab7c[_0x5e18('0x4a')]['id']}})[_0x5e18('0x28')](handleEntityNotFound(_0x379a8d,null))['then'](function(_0x373b29){if(_0x373b29){_0x59ab7c[_0x5e18('0x4d')][_0x5e18('0x52')]=_0x373b29['id'];_0x59ab7c[_0x5e18('0x4d')][_0x5e18('0x53')]=integrations[_0x5e18('0x54')](_0x59ab7c['body'][_0x5e18('0x55')],_0x59ab7c[_0x5e18('0x4d')][_0x5e18('0x32')]);_0x59ab7c[_0x5e18('0x4d')][_0x5e18('0x56')]=integrations['getDescriptions'](_0x59ab7c['body'][_0x5e18('0x55')],_0x59ab7c[_0x5e18('0x4d')][_0x5e18('0x32')]);return db[_0x5e18('0x57')][_0x5e18('0x4b')](_0x59ab7c[_0x5e18('0x4d')],{'include':[{'model':db[_0x5e18('0x58')],'as':'Subjects'},{'model':db[_0x5e18('0x58')],'as':'Descriptions'}]});}return null;})[_0x5e18('0x28')](respondWithResult(_0x379a8d,null))['catch'](handleError(_0x379a8d,null));};exports['getFields']=function(_0x3e289f,_0x2b3934,_0x559e3b){var _0x1c7071;var _0x24771c='';var _0x2a40a9=_0x5e18('0x59');return db[_0x5e18('0x2f')][_0x5e18('0x51')]({'where':{'id':_0x3e289f[_0x5e18('0x4a')]['id']},'attributes':['id','remoteUri',_0x5e18('0x5a'),'clientSecret',_0x5e18('0x5b'),_0x5e18('0x5c'),_0x5e18('0x5d')]})[_0x5e18('0x28')](handleEntityNotFound(_0x2b3934,null))[_0x5e18('0x28')](function(_0x5a977a){if(_0x5a977a){_0x24771c=_0x5a977a[_0x5e18('0x5e')];var _0x11ebaf=_0x24771c[_0x5e18('0x5f')](-0x1);if(_0x11ebaf==='/'){_0x24771c=_0x24771c['substring'](0x0,_0x24771c['lastIndexOf'](_0x11ebaf));}_0x1c7071=new jsforce[(_0x5e18('0x60'))]({'oauth2':{'loginUrl':_0x24771c,'clientId':_0x5a977a['clientId'],'clientSecret':_0x5a977a[_0x5e18('0x61')]}});return _0x1c7071[_0x5e18('0x62')](_0x5a977a[_0x5e18('0x5b')],_0x5a977a[_0x5e18('0x5c')][_0x5e18('0x63')](_0x5a977a['securityToken']));}})[_0x5e18('0x28')](function(_0x2ff64c){if(_0x2ff64c){if(!_['isNil'](_0x3e289f['query'][_0x5e18('0x64')])){_0x2a40a9=_0x3e289f[_0x5e18('0x36')]['ticketType'];}return _0x1c7071[_0x5e18('0x65')](_0x2a40a9)['describe']();}})[_0x5e18('0x28')](function(_0x32bfcb){var _0x5df4d1=['OwnerId','ActivityDate','IsReminderSet',_0x5e18('0x66'),'Subject',_0x5e18('0x67')];var _0x127903=['string','int',_0x5e18('0x68'),_0x5e18('0x69'),_0x5e18('0x6a'),_0x5e18('0x6b'),_0x5e18('0x6c')];if(_0x32bfcb){_[_0x5e18('0x6d')](_0x32bfcb['fields'],function(_0x124504){return _0x5df4d1['includes'](_0x124504[_0x5e18('0x2b')])||!_0x127903['includes'](_0x124504[_0x5e18('0x32')]);});return{'count':_0x32bfcb['fields'][_0x5e18('0x3b')],'rows':_[_0x5e18('0x2e')](_0x32bfcb[_0x5e18('0x3a')],function(_0x16b695){return{'id':_0x16b695[_0x5e18('0x2b')],'name':_0x16b695[_0x5e18('0x6e')],'custom':_0x16b695[_0x5e18('0x6f')],'options':_0x16b695['picklistValues'][_0x5e18('0x3b')]>0x0?_['map'](_0x16b695[_0x5e18('0x70')],function(_0x12ad43){return{'name':_0x12ad43[_0x5e18('0x6e')],'value':_0x12ad43['value']};}):_0x16b695[_0x5e18('0x32')]==_0x5e18('0x69')?[{'name':_0x5e18('0x71'),'value':_0x5e18('0x72')},{'name':'False','value':'false'}]:[]};})};}})[_0x5e18('0x28')](respondWithResult(_0x2b3934,null))[_0x5e18('0x49')](function(_0x1c0017){var _0x1f331e=_0x3e289f[_0x5e18('0x36')]['test']?0x1f4:_0x1c0017[_0x5e18('0x73')]||0x1f4;logger['error'](_0x5e18('0x74'),_0x5e18('0x75'),_0x1f331e,JSON[_0x5e18('0x76')](_0x1c0017));delete _0x1c0017[_0x5e18('0x2b')];if(_0x1f331e===0x191){_0x1f331e=0x190;}_0x2b3934[_0x5e18('0x1d')](_0x1f331e)['send'](_0x3e289f[_0x5e18('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1c0017['statusCode']}:_0x1c0017);});}; \ No newline at end of file +var _0x89b8=['False','false','test','statusCode','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','SalesforceAccount','includeAll','include','findAll','then','show','params','find','catch','create','body','destroy','findOne','SalesforceConfiguration','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','slice','login','username','password','concat','securityToken','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','true'];(function(_0x4b4100,_0x1b7591){var _0x31487a=function(_0x1da4fe){while(--_0x1da4fe){_0x4b4100['push'](_0x4b4100['shift']());}};_0x31487a(++_0x1b7591);}(_0x89b8,0x17a));var _0x889b=function(_0x46cb65,_0x21a706){_0x46cb65=_0x46cb65-0x0;var _0x1246c3=_0x89b8[_0x46cb65];return _0x1246c3;};'use strict';var emlformat=require(_0x889b('0x0'));var rimraf=require(_0x889b('0x1'));var zipdir=require(_0x889b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x889b('0x3'));var BPromise=require(_0x889b('0x4'));var Mustache=require('mustache');var util=require(_0x889b('0x5'));var path=require(_0x889b('0x6'));var sox=require(_0x889b('0x7'));var csv=require(_0x889b('0x8'));var ejs=require(_0x889b('0x9'));var fs=require('fs');var fs_extra=require(_0x889b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x889b('0xb'));var jsforce=require(_0x889b('0xc'));var deskjs=require(_0x889b('0xd'));var toCsv=require(_0x889b('0x8'));var querystring=require('querystring');var Papa=require(_0x889b('0xe'));var Redis=require('ioredis');var authService=require(_0x889b('0xf'));var qs=require(_0x889b('0x10'));var as=require(_0x889b('0x11'));var hardwareService=require(_0x889b('0x12'));var logger=require(_0x889b('0x13'))(_0x889b('0x14'));var utils=require(_0x889b('0x15'));var config=require(_0x889b('0x16'));var licenseUtil=require(_0x889b('0x17'));var db=require(_0x889b('0x18'))['db'];var integrations=require(_0x889b('0x19'));function respondWithStatusCode(_0x14eeb0,_0x11b872){_0x11b872=_0x11b872||0xcc;return function(_0x44d960){if(_0x44d960){return _0x14eeb0['sendStatus'](_0x11b872);}return _0x14eeb0[_0x889b('0x1a')](_0x11b872)[_0x889b('0x1b')]();};}function respondWithResult(_0x30f6cf,_0x17f829){_0x17f829=_0x17f829||0xc8;return function(_0x543743){if(_0x543743){return _0x30f6cf[_0x889b('0x1a')](_0x17f829)[_0x889b('0x1c')](_0x543743);}};}function respondWithFilteredResult(_0x1c8c18,_0x1b6602){return function(_0x45686e){if(_0x45686e){var _0x44b426=typeof _0x1b6602[_0x889b('0x1d')]===_0x889b('0x1e')&&typeof _0x1b6602['limit']===_0x889b('0x1e');var _0x1c5fc2=_0x45686e[_0x889b('0x1f')];var _0x2a7579=_0x44b426?0x0:_0x1b6602['offset'];var _0x4763c7=_0x44b426?_0x45686e[_0x889b('0x1f')]:_0x1b6602[_0x889b('0x1d')]+_0x1b6602['limit'];var _0x3cd89e;if(_0x4763c7>=_0x1c5fc2){_0x4763c7=_0x1c5fc2;_0x3cd89e=0xc8;}else{_0x3cd89e=0xce;}_0x1c8c18[_0x889b('0x1a')](_0x3cd89e);return _0x1c8c18[_0x889b('0x20')](_0x889b('0x21'),_0x2a7579+'-'+_0x4763c7+'/'+_0x1c5fc2)[_0x889b('0x1c')](_0x45686e);}return null;};}function patchUpdates(_0x12633c){return function(_0x5464f6){try{jsonpatch[_0x889b('0x22')](_0x5464f6,_0x12633c,!![]);}catch(_0x45b519){return BPromise[_0x889b('0x23')](_0x45b519);}return _0x5464f6['save']();};}function saveUpdates(_0x1e6d7d,_0x2509ea){return function(_0x564d9d){if(_0x564d9d){return _0x564d9d[_0x889b('0x24')](_0x1e6d7d)['then'](function(_0x3eb4a3){return _0x3eb4a3;});}return null;};}function removeEntity(_0x17d272,_0x158c9c){return function(_0x347e2b){if(_0x347e2b){return _0x347e2b['destroy']()['then'](function(){_0x17d272['status'](0xcc)[_0x889b('0x1b')]();});}};}function handleEntityNotFound(_0x5e7923,_0x42ba2b){return function(_0x4cf285){if(!_0x4cf285){_0x5e7923[_0x889b('0x25')](0x194);}return _0x4cf285;};}function handleError(_0x5b2312,_0xd171d4){_0xd171d4=_0xd171d4||0x1f4;return function(_0x342ce8){logger[_0x889b('0x26')](_0x342ce8[_0x889b('0x27')]);if(_0x342ce8[_0x889b('0x28')]){delete _0x342ce8[_0x889b('0x28')];}_0x5b2312[_0x889b('0x1a')](_0xd171d4)['send'](_0x342ce8);};}exports[_0x889b('0x29')]=function(_0x351a3b,_0x297743){var _0x5ef0e0={},_0xec78e4={},_0x307dfb={'count':0x0,'rows':[]};var _0x5260d3=_[_0x889b('0x2a')](db['SalesforceAccount'][_0x889b('0x2b')],function(_0x4b3363){return{'name':_0x4b3363[_0x889b('0x2c')],'type':_0x4b3363[_0x889b('0x2d')]['key']};});_0xec78e4['model']=_['map'](_0x5260d3,'name');_0xec78e4[_0x889b('0x2e')]=_[_0x889b('0x2f')](_0x351a3b[_0x889b('0x2e')]);_0xec78e4[_0x889b('0x30')]=_[_0x889b('0x31')](_0xec78e4[_0x889b('0x32')],_0xec78e4[_0x889b('0x2e')]);_0x5ef0e0[_0x889b('0x33')]=_[_0x889b('0x31')](_0xec78e4[_0x889b('0x32')],qs['fields'](_0x351a3b[_0x889b('0x2e')][_0x889b('0x34')]));_0x5ef0e0['attributes']=_0x5ef0e0['attributes'][_0x889b('0x35')]?_0x5ef0e0[_0x889b('0x33')]:_0xec78e4[_0x889b('0x32')];if(!_0x351a3b['query'][_0x889b('0x36')]('nolimit')){_0x5ef0e0[_0x889b('0x37')]=qs['limit'](_0x351a3b['query'][_0x889b('0x37')]);_0x5ef0e0[_0x889b('0x1d')]=qs[_0x889b('0x1d')](_0x351a3b['query'][_0x889b('0x1d')]);}_0x5ef0e0[_0x889b('0x38')]=qs[_0x889b('0x39')](_0x351a3b[_0x889b('0x2e')][_0x889b('0x39')]);_0x5ef0e0[_0x889b('0x3a')]=qs[_0x889b('0x30')](_[_0x889b('0x3b')](_0x351a3b[_0x889b('0x2e')],_0xec78e4[_0x889b('0x30')]),_0x5260d3);if(_0x351a3b[_0x889b('0x2e')][_0x889b('0x3c')]){_0x5ef0e0[_0x889b('0x3a')]=_['merge'](_0x5ef0e0['where'],{'$or':_[_0x889b('0x2a')](_0x5260d3,function(_0x1a61b5){if(_0x1a61b5[_0x889b('0x2d')]!==_0x889b('0x3d')){var _0x272201={};_0x272201[_0x1a61b5['name']]={'$like':'%'+_0x351a3b[_0x889b('0x2e')][_0x889b('0x3c')]+'%'};return _0x272201;}})});}_0x5ef0e0=_[_0x889b('0x3e')]({},_0x5ef0e0,_0x351a3b[_0x889b('0x3f')]);var _0x485e0e={'where':_0x5ef0e0[_0x889b('0x3a')]};return db[_0x889b('0x40')]['count'](_0x485e0e)['then'](function(_0xaa9785){_0x307dfb['count']=_0xaa9785;if(_0x351a3b['query'][_0x889b('0x41')]){_0x5ef0e0[_0x889b('0x42')]=[{'all':!![]}];}return db[_0x889b('0x40')][_0x889b('0x43')](_0x5ef0e0);})[_0x889b('0x44')](function(_0x4cf39d){_0x307dfb['rows']=_0x4cf39d;return _0x307dfb;})[_0x889b('0x44')](respondWithFilteredResult(_0x297743,_0x5ef0e0))['catch'](handleError(_0x297743,null));};exports[_0x889b('0x45')]=function(_0x262a87,_0xf98f3d){var _0x24bbf2={'raw':![],'where':{'id':_0x262a87[_0x889b('0x46')]['id']}},_0x5ba8c9={};_0x5ba8c9[_0x889b('0x32')]=_[_0x889b('0x2f')](db[_0x889b('0x40')][_0x889b('0x2b')]);_0x5ba8c9[_0x889b('0x2e')]=_[_0x889b('0x2f')](_0x262a87[_0x889b('0x2e')]);_0x5ba8c9[_0x889b('0x30')]=_['intersection'](_0x5ba8c9[_0x889b('0x32')],_0x5ba8c9['query']);_0x24bbf2[_0x889b('0x33')]=_['intersection'](_0x5ba8c9['model'],qs[_0x889b('0x34')](_0x262a87[_0x889b('0x2e')][_0x889b('0x34')]));_0x24bbf2[_0x889b('0x33')]=_0x24bbf2['attributes'][_0x889b('0x35')]?_0x24bbf2['attributes']:_0x5ba8c9[_0x889b('0x32')];if(_0x262a87[_0x889b('0x2e')][_0x889b('0x41')]){_0x24bbf2['include']=[{'all':!![]}];}_0x24bbf2=_[_0x889b('0x3e')]({},_0x24bbf2,_0x262a87[_0x889b('0x3f')]);return db[_0x889b('0x40')][_0x889b('0x47')](_0x24bbf2)[_0x889b('0x44')](handleEntityNotFound(_0xf98f3d,null))[_0x889b('0x44')](respondWithResult(_0xf98f3d,null))[_0x889b('0x48')](handleError(_0xf98f3d,null));};exports[_0x889b('0x49')]=function(_0x43c837,_0x49d60c){return db['SalesforceAccount'][_0x889b('0x49')](_0x43c837[_0x889b('0x4a')],{})['then'](respondWithResult(_0x49d60c,0xc9))['catch'](handleError(_0x49d60c,null));};exports[_0x889b('0x24')]=function(_0x275178,_0x197c1d){if(_0x275178[_0x889b('0x4a')]['id']){delete _0x275178[_0x889b('0x4a')]['id'];}return db[_0x889b('0x40')][_0x889b('0x47')]({'where':{'id':_0x275178[_0x889b('0x46')]['id']}})['then'](handleEntityNotFound(_0x197c1d,null))[_0x889b('0x44')](saveUpdates(_0x275178[_0x889b('0x4a')],null))[_0x889b('0x44')](respondWithResult(_0x197c1d,null))[_0x889b('0x48')](handleError(_0x197c1d,null));};exports[_0x889b('0x4b')]=function(_0x29b44d,_0x556c22){return db[_0x889b('0x40')][_0x889b('0x47')]({'where':{'id':_0x29b44d[_0x889b('0x46')]['id']}})[_0x889b('0x44')](handleEntityNotFound(_0x556c22,null))[_0x889b('0x44')](removeEntity(_0x556c22,null))[_0x889b('0x48')](handleError(_0x556c22,null));};exports['getConfigurations']=function(_0x468c03,_0x3cdf8b,_0x1ed66e){var _0x116c86={};var _0x1fa3c9={};var _0xafb166;var _0x18393e;return db[_0x889b('0x40')][_0x889b('0x4c')]({'where':{'id':_0x468c03[_0x889b('0x46')]['id']}})[_0x889b('0x44')](handleEntityNotFound(_0x3cdf8b,null))['then'](function(_0x191f4d){if(_0x191f4d){_0xafb166=_0x191f4d;_0x1fa3c9[_0x889b('0x32')]=_[_0x889b('0x2f')](db[_0x889b('0x4d')]['rawAttributes']);_0x1fa3c9[_0x889b('0x2e')]=_[_0x889b('0x2f')](_0x468c03[_0x889b('0x2e')]);_0x1fa3c9[_0x889b('0x30')]=_[_0x889b('0x31')](_0x1fa3c9['model'],_0x1fa3c9['query']);_0x116c86[_0x889b('0x33')]=_[_0x889b('0x31')](_0x1fa3c9['model'],qs['fields'](_0x468c03[_0x889b('0x2e')]['fields']));_0x116c86[_0x889b('0x33')]=_0x116c86[_0x889b('0x33')]['length']?_0x116c86[_0x889b('0x33')]:_0x1fa3c9[_0x889b('0x32')];_0x116c86[_0x889b('0x38')]=qs['sort'](_0x468c03[_0x889b('0x2e')]['sort']);_0x116c86[_0x889b('0x3a')]=qs['filters'](_[_0x889b('0x3b')](_0x468c03[_0x889b('0x2e')],_0x1fa3c9[_0x889b('0x30')]));if(_0x468c03['query'][_0x889b('0x3c')]){_0x116c86[_0x889b('0x3a')]=_['merge'](_0x116c86[_0x889b('0x3a')],{'$or':_[_0x889b('0x2a')](_0x116c86[_0x889b('0x33')],function(_0x598c88){var _0x3e0073={};_0x3e0073[_0x598c88]={'$like':'%'+_0x468c03['query'][_0x889b('0x3c')]+'%'};return _0x3e0073;})});}_0x116c86=_[_0x889b('0x3e')]({},_0x116c86,_0x468c03[_0x889b('0x3f')]);return _0xafb166['getConfigurations'](_0x116c86);}})['then'](function(_0x499cb1){if(_0x499cb1){_0x18393e=_0x499cb1['length'];if(!_0x468c03[_0x889b('0x2e')][_0x889b('0x36')](_0x889b('0x4e'))){_0x116c86[_0x889b('0x37')]=qs[_0x889b('0x37')](_0x468c03[_0x889b('0x2e')]['limit']);_0x116c86[_0x889b('0x1d')]=qs[_0x889b('0x1d')](_0x468c03[_0x889b('0x2e')][_0x889b('0x1d')]);}return _0xafb166[_0x889b('0x4f')](_0x116c86);}})[_0x889b('0x44')](function(_0x10e735){if(_0x10e735){return _0x10e735?{'count':_0x18393e,'rows':_0x10e735}:null;}})[_0x889b('0x44')](respondWithResult(_0x3cdf8b,null))['catch'](handleError(_0x3cdf8b,null));};exports[_0x889b('0x50')]=function(_0x2f2bcc,_0x2e5bee,_0x1b7b9c){if(_0x2f2bcc[_0x889b('0x4a')]['id']){delete _0x2f2bcc[_0x889b('0x4a')]['id'];}return db[_0x889b('0x40')][_0x889b('0x4c')]({'where':{'id':_0x2f2bcc[_0x889b('0x46')]['id']}})[_0x889b('0x44')](handleEntityNotFound(_0x2e5bee,null))[_0x889b('0x44')](function(_0xcba81b){if(_0xcba81b){_0x2f2bcc['body']['AccountId']=_0xcba81b['id'];_0x2f2bcc[_0x889b('0x4a')][_0x889b('0x51')]=integrations[_0x889b('0x52')](_0x2f2bcc[_0x889b('0x4a')]['channel'],_0x2f2bcc[_0x889b('0x4a')][_0x889b('0x2d')]);_0x2f2bcc[_0x889b('0x4a')][_0x889b('0x53')]=integrations[_0x889b('0x54')](_0x2f2bcc[_0x889b('0x4a')][_0x889b('0x55')],_0x2f2bcc[_0x889b('0x4a')]['type']);return db[_0x889b('0x4d')][_0x889b('0x49')](_0x2f2bcc[_0x889b('0x4a')],{'include':[{'model':db[_0x889b('0x56')],'as':'Subjects'},{'model':db[_0x889b('0x56')],'as':_0x889b('0x53')}]});}return null;})[_0x889b('0x44')](respondWithResult(_0x2e5bee,null))[_0x889b('0x48')](handleError(_0x2e5bee,null));};exports[_0x889b('0x57')]=function(_0x2379d6,_0x4ee253,_0x4a2119){var _0x24e663;var _0x5a91db='';var _0x54f485=_0x889b('0x58');return db[_0x889b('0x40')][_0x889b('0x4c')]({'where':{'id':_0x2379d6[_0x889b('0x46')]['id']},'attributes':['id',_0x889b('0x59'),_0x889b('0x5a'),_0x889b('0x5b'),'username','password','securityToken']})['then'](handleEntityNotFound(_0x4ee253,null))[_0x889b('0x44')](function(_0x3404bc){if(_0x3404bc){_0x5a91db=_0x3404bc[_0x889b('0x59')];var _0x235b91=_0x5a91db[_0x889b('0x5c')](-0x1);if(_0x235b91==='/'){_0x5a91db=_0x5a91db['substring'](0x0,_0x5a91db['lastIndexOf'](_0x235b91));}_0x24e663=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5a91db,'clientId':_0x3404bc[_0x889b('0x5a')],'clientSecret':_0x3404bc[_0x889b('0x5b')]}});return _0x24e663[_0x889b('0x5d')](_0x3404bc[_0x889b('0x5e')],_0x3404bc[_0x889b('0x5f')][_0x889b('0x60')](_0x3404bc[_0x889b('0x61')]));}})['then'](function(_0x18b805){if(_0x18b805){if(!_[_0x889b('0x62')](_0x2379d6['query'][_0x889b('0x63')])){_0x54f485=_0x2379d6[_0x889b('0x2e')][_0x889b('0x63')];}return _0x24e663['sobject'](_0x54f485)[_0x889b('0x64')]();}})[_0x889b('0x44')](function(_0x26d146){var _0x473eb9=[_0x889b('0x65'),_0x889b('0x66'),_0x889b('0x67'),'IsRecurrence',_0x889b('0x68'),'Description'];var _0x5b0be4=[_0x889b('0x69'),_0x889b('0x6a'),'picklist',_0x889b('0x6b'),_0x889b('0x6c'),_0x889b('0x6d'),_0x889b('0x6e')];if(_0x26d146){_[_0x889b('0x6f')](_0x26d146[_0x889b('0x34')],function(_0x19fdeb){return _0x473eb9['includes'](_0x19fdeb['name'])||!_0x5b0be4[_0x889b('0x70')](_0x19fdeb[_0x889b('0x2d')]);});return{'count':_0x26d146['fields']['length'],'rows':_[_0x889b('0x2a')](_0x26d146['fields'],function(_0x3cba2e){return{'id':_0x3cba2e[_0x889b('0x28')],'name':_0x3cba2e[_0x889b('0x71')],'custom':_0x3cba2e['custom'],'options':_0x3cba2e[_0x889b('0x72')][_0x889b('0x35')]>0x0?_[_0x889b('0x2a')](_0x3cba2e[_0x889b('0x72')],function(_0xe73f77){return{'name':_0xe73f77['label'],'value':_0xe73f77[_0x889b('0x73')]};}):_0x3cba2e[_0x889b('0x2d')]==_0x889b('0x6b')?[{'name':_0x889b('0x74'),'value':_0x889b('0x75')},{'name':_0x889b('0x76'),'value':_0x889b('0x77')}]:[]};})};}})[_0x889b('0x44')](respondWithResult(_0x4ee253,null))['catch'](function(_0x26fb22){var _0x19871d=_0x2379d6[_0x889b('0x2e')][_0x889b('0x78')]?0x1f4:_0x26fb22[_0x889b('0x79')]||0x1f4;logger[_0x889b('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x889b('0x57'),_0x19871d,JSON['stringify'](_0x26fb22));delete _0x26fb22[_0x889b('0x28')];if(_0x19871d===0x191){_0x19871d=0x190;}_0x4ee253[_0x889b('0x1a')](_0x19871d)[_0x889b('0x7a')](_0x2379d6[_0x889b('0x2e')]['test']?{'message':_0x889b('0x7b'),'statusCode':_0x26fb22[_0x889b('0x79')]}:_0x26fb22);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7dcac23..6eaafa7 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 _0x44af=['SalesforceAccount','int_salesforce_accounts','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x2614d1,_0x500038){var _0x8f1d0b=function(_0x1e48e9){while(--_0x1e48e9){_0x2614d1['push'](_0x2614d1['shift']());}};_0x8f1d0b(++_0x500038);}(_0x44af,0xc5));var _0xf44a=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0x44af[_0x252328];return _0xaa85b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf44a('0x0'))(_0xf44a('0x1'));var moment=require(_0xf44a('0x2'));var BPromise=require(_0xf44a('0x3'));var rp=require(_0xf44a('0x4'));var fs=require('fs');var path=require(_0xf44a('0x5'));var rimraf=require('rimraf');var config=require(_0xf44a('0x6'));var attributes=require(_0xf44a('0x7'));var integrations=require(_0xf44a('0x8'));module[_0xf44a('0x9')]=function(_0x544388,_0x38c550){return _0x544388[_0xf44a('0xa')](_0xf44a('0xb'),attributes,{'tableName':_0xf44a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0de=['exports','SalesforceAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xb0de,0xec));var _0xeb0d=function(_0x1fdf9a,_0x417b48){_0x1fdf9a=_0x1fdf9a-0x0;var _0x442f8f=_0xb0de[_0x1fdf9a];return _0x442f8f;};'use strict';var _=require(_0xeb0d('0x0'));var util=require(_0xeb0d('0x1'));var logger=require(_0xeb0d('0x2'))(_0xeb0d('0x3'));var moment=require(_0xeb0d('0x4'));var BPromise=require('bluebird');var rp=require(_0xeb0d('0x5'));var fs=require('fs');var path=require(_0xeb0d('0x6'));var rimraf=require(_0xeb0d('0x7'));var config=require(_0xeb0d('0x8'));var attributes=require(_0xeb0d('0x9'));var integrations=require(_0xeb0d('0xa'));module[_0xeb0d('0xb')]=function(_0x53c055,_0x3d5bb7){return _0x53c055['define'](_0xeb0d('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index cd5a36c..993092b 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 _0x1b03=['SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','debug'];(function(_0xb093,_0x5403c4){var _0x516bac=function(_0x4564cb){while(--_0x4564cb){_0xb093['push'](_0xb093['shift']());}};_0x516bac(++_0x5403c4);}(_0x1b03,0x191));var _0x31b0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x1b03[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x31b0('0x0'));var util=require(_0x31b0('0x1'));var moment=require(_0x31b0('0x2'));var BPromise=require(_0x31b0('0x3'));var rs=require(_0x31b0('0x4'));var fs=require('fs');var Redis=require(_0x31b0('0x5'));var db=require(_0x31b0('0x6'))['db'];var utils=require(_0x31b0('0x7'));var logger=require(_0x31b0('0x8'))(_0x31b0('0x9'));var config=require(_0x31b0('0xa'));var jayson=require(_0x31b0('0xb'));var client=jayson[_0x31b0('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257e68,_0x4a05d6,_0x1c2689){return new BPromise(function(_0x57c4e7,_0x37f30a){return client[_0x31b0('0xd')](_0x257e68,_0x1c2689)[_0x31b0('0xe')](function(_0x5c1be2){logger['info'](_0x31b0('0xf'),_0x4a05d6,'request\x20sent');logger[_0x31b0('0x10')](_0x31b0('0x11'),_0x4a05d6,_0x31b0('0x12'),JSON[_0x31b0('0x13')](_0x5c1be2));if(_0x5c1be2[_0x31b0('0x14')]){if(_0x5c1be2[_0x31b0('0x14')][_0x31b0('0x15')]===0x1f4){logger[_0x31b0('0x14')](_0x31b0('0xf'),_0x4a05d6,_0x5c1be2[_0x31b0('0x14')][_0x31b0('0x16')]);return _0x37f30a(_0x5c1be2[_0x31b0('0x14')][_0x31b0('0x16')]);}logger['error'](_0x31b0('0xf'),_0x4a05d6,_0x5c1be2['error'][_0x31b0('0x16')]);return _0x57c4e7(_0x5c1be2['error'][_0x31b0('0x16')]);}else{logger[_0x31b0('0x17')](_0x31b0('0xf'),_0x4a05d6,_0x31b0('0x12'));_0x57c4e7(_0x5c1be2[_0x31b0('0x18')][_0x31b0('0x16')]);}})[_0x31b0('0x19')](function(_0x421d80){logger[_0x31b0('0x14')](_0x31b0('0xf'),_0x4a05d6,_0x421d80);_0x37f30a(_0x421d80);});});}exports[_0x31b0('0x1a')]=function(_0x1e2814){var _0x47ad16=this;return new Promise(function(_0x1f20fc,_0x14edcd){return db[_0x31b0('0x1b')][_0x31b0('0x1c')]({'raw':_0x1e2814['options']?_0x1e2814[_0x31b0('0x1d')][_0x31b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e2814[_0x31b0('0x1d')]?_0x1e2814[_0x31b0('0x1d')][_0x31b0('0x1f')]||null:null,'attributes':_0x1e2814[_0x31b0('0x1d')]?_0x1e2814['options'][_0x31b0('0x20')]||null:null,'limit':_0x1e2814[_0x31b0('0x1d')]?_0x1e2814[_0x31b0('0x1d')][_0x31b0('0x21')]||null:null,'include':_0x1e2814[_0x31b0('0x1d')]?_0x1e2814[_0x31b0('0x1d')]['include']?_[_0x31b0('0x22')](_0x1e2814[_0x31b0('0x1d')][_0x31b0('0x23')],function(_0x5a6c2d){return{'model':db[_0x5a6c2d['model']],'as':_0x5a6c2d['as'],'attributes':_0x5a6c2d[_0x31b0('0x20')],'include':_0x5a6c2d[_0x31b0('0x23')]?_['map'](_0x5a6c2d[_0x31b0('0x23')],function(_0x5b915e){return{'model':db[_0x5b915e[_0x31b0('0x24')]],'as':_0x5b915e['as'],'attributes':_0x5b915e[_0x31b0('0x20')],'include':_0x5b915e[_0x31b0('0x23')]?_[_0x31b0('0x22')](_0x5b915e['include'],function(_0x3c5340){return{'model':db[_0x3c5340[_0x31b0('0x24')]],'as':_0x3c5340['as'],'attributes':_0x3c5340[_0x31b0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x31b0('0xe')](function(_0x1c210e){logger['info'](_0x31b0('0x1a'),_0x1e2814);logger[_0x31b0('0x10')]('GetSalesforceAccount',_0x1e2814,JSON['stringify'](_0x1c210e));_0x1f20fc(_0x1c210e);})[_0x31b0('0x19')](function(_0x530681){logger[_0x31b0('0x14')](_0x31b0('0x1a'),_0x530681['message'],_0x1e2814);_0x14edcd(_0x47ad16[_0x31b0('0x14')](0x1f4,_0x530681[_0x31b0('0x16')]));});});};exports[_0x31b0('0x25')]=function(_0x124f80){var _0x191aac=this;return new Promise(function(_0x2f384a,_0x2496cc){return db['SalesforceAccount']['find']({'raw':_0x124f80['options']?_0x124f80[_0x31b0('0x1d')][_0x31b0('0x1e')]===undefined?!![]:![]:!![],'where':_0x124f80[_0x31b0('0x1d')]?_0x124f80['options']['where']||null:null,'attributes':_0x124f80[_0x31b0('0x1d')]?_0x124f80[_0x31b0('0x1d')][_0x31b0('0x20')]||null:null,'include':_0x124f80[_0x31b0('0x1d')]?_0x124f80[_0x31b0('0x1d')][_0x31b0('0x23')]?_[_0x31b0('0x22')](_0x124f80[_0x31b0('0x1d')][_0x31b0('0x23')],function(_0x307e0f){return{'model':db[_0x307e0f[_0x31b0('0x24')]],'as':_0x307e0f['as'],'attributes':_0x307e0f['attributes'],'include':_0x307e0f[_0x31b0('0x23')]?_['map'](_0x307e0f['include'],function(_0x20865a){return{'model':db[_0x20865a[_0x31b0('0x24')]],'as':_0x20865a['as'],'attributes':_0x20865a[_0x31b0('0x20')],'include':_0x20865a[_0x31b0('0x23')]?_[_0x31b0('0x22')](_0x20865a[_0x31b0('0x23')],function(_0x3f2f70){return{'model':db[_0x3f2f70['model']],'as':_0x3f2f70['as'],'attributes':_0x3f2f70[_0x31b0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x31b0('0xe')](function(_0x164697){logger[_0x31b0('0x17')](_0x31b0('0x25'),_0x124f80);logger['debug'](_0x31b0('0x25'),_0x124f80,JSON[_0x31b0('0x13')](_0x164697));_0x2f384a(_0x164697);})[_0x31b0('0x19')](function(_0xe373ec){logger[_0x31b0('0x14')](_0x31b0('0x25'),_0xe373ec[_0x31b0('0x16')],_0x124f80);_0x2496cc(_0x191aac[_0x31b0('0x14')](0x1f4,_0xe373ec[_0x31b0('0x16')]));});});}; \ No newline at end of file +var _0xed83=['SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSalesforceAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetSalesforceAccount'];(function(_0x4cddfe,_0x55362c){var _0x544786=function(_0x203695){while(--_0x203695){_0x4cddfe['push'](_0x4cddfe['shift']());}};_0x544786(++_0x55362c);}(_0xed83,0x160));var _0x3ed8=function(_0x1e31fa,_0x2dea6b){_0x1e31fa=_0x1e31fa-0x0;var _0x1b9c65=_0xed83[_0x1e31fa];return _0x1b9c65;};'use strict';var _=require('lodash');var util=require(_0x3ed8('0x0'));var moment=require(_0x3ed8('0x1'));var BPromise=require(_0x3ed8('0x2'));var rs=require(_0x3ed8('0x3'));var fs=require('fs');var Redis=require(_0x3ed8('0x4'));var db=require(_0x3ed8('0x5'))['db'];var utils=require(_0x3ed8('0x6'));var logger=require(_0x3ed8('0x7'))(_0x3ed8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3ed8('0x9')][_0x3ed8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4edef1,_0xbb7d25,_0xf91a57){return new BPromise(function(_0x40f21c,_0x3b87d9){return client['request'](_0x4edef1,_0xf91a57)['then'](function(_0x3939a9){logger['info'](_0x3ed8('0xb'),_0xbb7d25,'request\x20sent');logger[_0x3ed8('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xbb7d25,_0x3ed8('0xd'),JSON[_0x3ed8('0xe')](_0x3939a9));if(_0x3939a9[_0x3ed8('0xf')]){if(_0x3939a9['error'][_0x3ed8('0x10')]===0x1f4){logger[_0x3ed8('0xf')](_0x3ed8('0xb'),_0xbb7d25,_0x3939a9[_0x3ed8('0xf')]['message']);return _0x3b87d9(_0x3939a9[_0x3ed8('0xf')]['message']);}logger[_0x3ed8('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0xbb7d25,_0x3939a9['error'][_0x3ed8('0x11')]);return _0x40f21c(_0x3939a9[_0x3ed8('0xf')][_0x3ed8('0x11')]);}else{logger[_0x3ed8('0x12')](_0x3ed8('0xb'),_0xbb7d25,_0x3ed8('0xd'));_0x40f21c(_0x3939a9[_0x3ed8('0x13')][_0x3ed8('0x11')]);}})[_0x3ed8('0x14')](function(_0x4c6608){logger[_0x3ed8('0xf')](_0x3ed8('0xb'),_0xbb7d25,_0x4c6608);_0x3b87d9(_0x4c6608);});});}exports[_0x3ed8('0x15')]=function(_0x281b2f){var _0x3474ef=this;return new Promise(function(_0x42556f,_0x1e78ab){return db[_0x3ed8('0x16')][_0x3ed8('0x17')]({'raw':_0x281b2f['options']?_0x281b2f[_0x3ed8('0x18')][_0x3ed8('0x19')]===undefined?!![]:![]:!![],'where':_0x281b2f[_0x3ed8('0x18')]?_0x281b2f['options'][_0x3ed8('0x1a')]||null:null,'attributes':_0x281b2f[_0x3ed8('0x18')]?_0x281b2f['options'][_0x3ed8('0x1b')]||null:null,'limit':_0x281b2f[_0x3ed8('0x18')]?_0x281b2f[_0x3ed8('0x18')][_0x3ed8('0x1c')]||null:null,'include':_0x281b2f[_0x3ed8('0x18')]?_0x281b2f['options'][_0x3ed8('0x1d')]?_[_0x3ed8('0x1e')](_0x281b2f[_0x3ed8('0x18')]['include'],function(_0x4f7bbd){return{'model':db[_0x4f7bbd[_0x3ed8('0x1f')]],'as':_0x4f7bbd['as'],'attributes':_0x4f7bbd[_0x3ed8('0x1b')],'include':_0x4f7bbd['include']?_[_0x3ed8('0x1e')](_0x4f7bbd['include'],function(_0x8f1aaa){return{'model':db[_0x8f1aaa[_0x3ed8('0x1f')]],'as':_0x8f1aaa['as'],'attributes':_0x8f1aaa['attributes'],'include':_0x8f1aaa['include']?_[_0x3ed8('0x1e')](_0x8f1aaa['include'],function(_0x22e306){return{'model':db[_0x22e306[_0x3ed8('0x1f')]],'as':_0x22e306['as'],'attributes':_0x22e306[_0x3ed8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ed8('0x20')](function(_0x2b0a6f){logger[_0x3ed8('0x12')]('GetSalesforceAccount',_0x281b2f);logger[_0x3ed8('0xc')](_0x3ed8('0x15'),_0x281b2f,JSON[_0x3ed8('0xe')](_0x2b0a6f));_0x42556f(_0x2b0a6f);})[_0x3ed8('0x14')](function(_0x56bb68){logger[_0x3ed8('0xf')]('GetSalesforceAccount',_0x56bb68['message'],_0x281b2f);_0x1e78ab(_0x3474ef[_0x3ed8('0xf')](0x1f4,_0x56bb68[_0x3ed8('0x11')]));});});};exports[_0x3ed8('0x21')]=function(_0x1e1a26){var _0x27f6f2=this;return new Promise(function(_0x3ce8b5,_0x27a80b){return db[_0x3ed8('0x16')]['find']({'raw':_0x1e1a26['options']?_0x1e1a26[_0x3ed8('0x18')][_0x3ed8('0x19')]===undefined?!![]:![]:!![],'where':_0x1e1a26[_0x3ed8('0x18')]?_0x1e1a26['options'][_0x3ed8('0x1a')]||null:null,'attributes':_0x1e1a26['options']?_0x1e1a26[_0x3ed8('0x18')][_0x3ed8('0x1b')]||null:null,'include':_0x1e1a26['options']?_0x1e1a26[_0x3ed8('0x18')]['include']?_[_0x3ed8('0x1e')](_0x1e1a26[_0x3ed8('0x18')][_0x3ed8('0x1d')],function(_0x151843){return{'model':db[_0x151843[_0x3ed8('0x1f')]],'as':_0x151843['as'],'attributes':_0x151843['attributes'],'include':_0x151843['include']?_[_0x3ed8('0x1e')](_0x151843['include'],function(_0x488c53){return{'model':db[_0x488c53['model']],'as':_0x488c53['as'],'attributes':_0x488c53[_0x3ed8('0x1b')],'include':_0x488c53['include']?_['map'](_0x488c53['include'],function(_0x3b7bae){return{'model':db[_0x3b7bae[_0x3ed8('0x1f')]],'as':_0x3b7bae['as'],'attributes':_0x3b7bae[_0x3ed8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ed8('0x20')](function(_0x4a89bf){logger['info'](_0x3ed8('0x21'),_0x1e1a26);logger[_0x3ed8('0xc')]('ShowSalesforceAccount',_0x1e1a26,JSON['stringify'](_0x4a89bf));_0x3ce8b5(_0x4a89bf);})[_0x3ed8('0x14')](function(_0x1982f9){logger[_0x3ed8('0xf')](_0x3ed8('0x21'),_0x1982f9[_0x3ed8('0x11')],_0x1e1a26);_0x27a80b(_0x27f6f2[_0x3ed8('0xf')](0x1f4,_0x1982f9[_0x3ed8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 57561a1..5f100d5 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 _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(_0x1fd841,_0x5b6a0b){var _0x1462d0=function(_0x54a212){while(--_0x54a212){_0x1fd841['push'](_0x1fd841['shift']());}};_0x1462d0(++_0x5b6a0b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'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 +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x1f2d1e,_0x277fee){var _0x510f3d=function(_0x346c5c){while(--_0x346c5c){_0x1f2d1e['push'](_0x1f2d1e['shift']());}};_0x510f3d(++_0x277fee);}(_0x2ef3,0xba));var _0x32ef=function(_0x18e65c,_0x2ac0a5){_0x18e65c=_0x18e65c-0x0;var _0x1adaa1=_0x2ef3[_0x18e65c];return _0x1adaa1;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 62c2209..d656b93 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 _0x98a1=['sequelize','STRING','Task','ENUM','contact_lead','lead','account_contact_lead','account','nothing','contact'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x98a1,0x10e));var _0x198a=function(_0x3c9157,_0x3e6f77){_0x3c9157=_0x3c9157-0x0;var _0x5a1a4c=_0x98a1[_0x3c9157];return _0x5a1a4c;};'use strict';var Sequelize=require(_0x198a('0x0'));module['exports']={'name':{'type':Sequelize[_0x198a('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x198a('0x2'),'Case'),'defaultValue':_0x198a('0x2')},'moduleSearch':{'type':Sequelize[_0x198a('0x3')](_0x198a('0x4'),'contact',_0x198a('0x5'),_0x198a('0x6'),_0x198a('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x198a('0x8'),_0x198a('0x9'),_0x198a('0x5'),_0x198a('0x7')),'defaultValue':_0x198a('0x5')},'leadId':{'type':Sequelize[_0x198a('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x198a('0x1')]}}; \ No newline at end of file +var _0x7be0=['account','contact_lead','contact','lead','sequelize','STRING','ENUM','Task','account_contact_lead'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7be0,0x8b));var _0x07be=function(_0x12d718,_0x5176e5){_0x12d718=_0x12d718-0x0;var _0x21d8cb=_0x7be0[_0x12d718];return _0x21d8cb;};'use strict';var Sequelize=require(_0x07be('0x0'));module['exports']={'name':{'type':Sequelize[_0x07be('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x07be('0x2')](_0x07be('0x3'),'Case'),'defaultValue':_0x07be('0x3')},'moduleSearch':{'type':Sequelize[_0x07be('0x2')]('contact_lead','contact','lead',_0x07be('0x4'),_0x07be('0x5')),'defaultValue':_0x07be('0x6')},'moduleCreate':{'type':Sequelize[_0x07be('0x2')]('nothing',_0x07be('0x7'),_0x07be('0x8'),_0x07be('0x5')),'defaultValue':_0x07be('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x07be('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x07be('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 9abeb9a..727ed11 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 _0xb5ec=['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/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','stack','name','index','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','SalesforceConfiguration','findAll','rows','catch','show','find','body','params','getFields','findOne','keys','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra'];(function(_0x3daad5,_0x452977){var _0x1ee037=function(_0x5671aa){while(--_0x5671aa){_0x3daad5['push'](_0x3daad5['shift']());}};_0x1ee037(++_0x452977);}(_0xb5ec,0x97));var _0xcb5e=function(_0x5ae468,_0x1941c0){_0x5ae468=_0x5ae468-0x0;var _0x5d94d2=_0xb5ec[_0x5ae468];return _0x5d94d2;};'use strict';var emlformat=require(_0xcb5e('0x0'));var rimraf=require(_0xcb5e('0x1'));var zipdir=require(_0xcb5e('0x2'));var jsonpatch=require(_0xcb5e('0x3'));var rp=require('request-promise');var moment=require(_0xcb5e('0x4'));var BPromise=require(_0xcb5e('0x5'));var Mustache=require(_0xcb5e('0x6'));var util=require('util');var path=require(_0xcb5e('0x7'));var sox=require('sox');var csv=require(_0xcb5e('0x8'));var ejs=require(_0xcb5e('0x9'));var fs=require('fs');var fs_extra=require(_0xcb5e('0xa'));var _=require(_0xcb5e('0xb'));var squel=require(_0xcb5e('0xc'));var crypto=require(_0xcb5e('0xd'));var jsforce=require(_0xcb5e('0xe'));var deskjs=require(_0xcb5e('0xf'));var toCsv=require(_0xcb5e('0x8'));var querystring=require(_0xcb5e('0x10'));var Papa=require('papaparse');var Redis=require(_0xcb5e('0x11'));var authService=require(_0xcb5e('0x12'));var qs=require(_0xcb5e('0x13'));var as=require(_0xcb5e('0x14'));var hardwareService=require(_0xcb5e('0x15'));var logger=require(_0xcb5e('0x16'))(_0xcb5e('0x17'));var utils=require(_0xcb5e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcb5e('0x19'));var db=require(_0xcb5e('0x1a'))['db'];function respondWithStatusCode(_0x3ce932,_0x23cd63){_0x23cd63=_0x23cd63||0xcc;return function(_0x820e89){if(_0x820e89){return _0x3ce932[_0xcb5e('0x1b')](_0x23cd63);}return _0x3ce932['status'](_0x23cd63)[_0xcb5e('0x1c')]();};}function respondWithResult(_0x2063e8,_0x522b1b){_0x522b1b=_0x522b1b||0xc8;return function(_0x598a2b){if(_0x598a2b){return _0x2063e8[_0xcb5e('0x1d')](_0x522b1b)[_0xcb5e('0x1e')](_0x598a2b);}};}function respondWithFilteredResult(_0x18002f,_0x369c0e){return function(_0xf8d2d9){if(_0xf8d2d9){var _0x4277b2=typeof _0x369c0e[_0xcb5e('0x1f')]===_0xcb5e('0x20')&&typeof _0x369c0e[_0xcb5e('0x21')]===_0xcb5e('0x20');var _0x4f74ba=_0xf8d2d9[_0xcb5e('0x22')];var _0x5047d9=_0x4277b2?0x0:_0x369c0e['offset'];var _0x22ed81=_0x4277b2?_0xf8d2d9[_0xcb5e('0x22')]:_0x369c0e['offset']+_0x369c0e[_0xcb5e('0x21')];var _0x1e6a89;if(_0x22ed81>=_0x4f74ba){_0x22ed81=_0x4f74ba;_0x1e6a89=0xc8;}else{_0x1e6a89=0xce;}_0x18002f[_0xcb5e('0x1d')](_0x1e6a89);return _0x18002f[_0xcb5e('0x23')](_0xcb5e('0x24'),_0x5047d9+'-'+_0x22ed81+'/'+_0x4f74ba)[_0xcb5e('0x1e')](_0xf8d2d9);}return null;};}function patchUpdates(_0x434596){return function(_0x28d988){try{jsonpatch['apply'](_0x28d988,_0x434596,!![]);}catch(_0x4b2388){return BPromise['reject'](_0x4b2388);}return _0x28d988[_0xcb5e('0x25')]();};}function saveUpdates(_0x279fff,_0x1f85e5){return function(_0x247fc7){if(_0x247fc7){return _0x247fc7[_0xcb5e('0x26')](_0x279fff)['then'](function(_0x2f8a73){return _0x2f8a73;});}return null;};}function removeEntity(_0x10f4b2,_0x126416){return function(_0x22275f){if(_0x22275f){return _0x22275f[_0xcb5e('0x27')]()[_0xcb5e('0x28')](function(){_0x10f4b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2de030,_0x2447c5){return function(_0x13f69b){if(!_0x13f69b){_0x2de030[_0xcb5e('0x1b')](0x194);}return _0x13f69b;};}function handleError(_0x201a18,_0x29d35b){_0x29d35b=_0x29d35b||0x1f4;return function(_0x9eeaa9){logger['error'](_0x9eeaa9[_0xcb5e('0x29')]);if(_0x9eeaa9['name']){delete _0x9eeaa9[_0xcb5e('0x2a')];}_0x201a18[_0xcb5e('0x1d')](_0x29d35b)['send'](_0x9eeaa9);};}exports[_0xcb5e('0x2b')]=function(_0x150313,_0x335ae3){var _0x2c28ff={},_0x26135a={},_0x10b9e1={'count':0x0,'rows':[]};var _0x3defc7=_['map'](db['SalesforceConfiguration'][_0xcb5e('0x2c')],function(_0x2f21e5){return{'name':_0x2f21e5[_0xcb5e('0x2d')],'type':_0x2f21e5['type'][_0xcb5e('0x2e')]};});_0x26135a['model']=_['map'](_0x3defc7,_0xcb5e('0x2a'));_0x26135a['query']=_['keys'](_0x150313[_0xcb5e('0x2f')]);_0x26135a[_0xcb5e('0x30')]=_[_0xcb5e('0x31')](_0x26135a[_0xcb5e('0x32')],_0x26135a[_0xcb5e('0x2f')]);_0x2c28ff['attributes']=_[_0xcb5e('0x31')](_0x26135a['model'],qs[_0xcb5e('0x33')](_0x150313[_0xcb5e('0x2f')]['fields']));_0x2c28ff[_0xcb5e('0x34')]=_0x2c28ff['attributes'][_0xcb5e('0x35')]?_0x2c28ff[_0xcb5e('0x34')]:_0x26135a[_0xcb5e('0x32')];if(!_0x150313[_0xcb5e('0x2f')][_0xcb5e('0x36')](_0xcb5e('0x37'))){_0x2c28ff[_0xcb5e('0x21')]=qs[_0xcb5e('0x21')](_0x150313[_0xcb5e('0x2f')][_0xcb5e('0x21')]);_0x2c28ff[_0xcb5e('0x1f')]=qs[_0xcb5e('0x1f')](_0x150313[_0xcb5e('0x2f')][_0xcb5e('0x1f')]);}_0x2c28ff[_0xcb5e('0x38')]=qs[_0xcb5e('0x39')](_0x150313[_0xcb5e('0x2f')][_0xcb5e('0x39')]);_0x2c28ff[_0xcb5e('0x3a')]=qs['filters'](_[_0xcb5e('0x3b')](_0x150313[_0xcb5e('0x2f')],_0x26135a[_0xcb5e('0x30')]),_0x3defc7);if(_0x150313[_0xcb5e('0x2f')][_0xcb5e('0x3c')]){_0x2c28ff[_0xcb5e('0x3a')]=_[_0xcb5e('0x3d')](_0x2c28ff[_0xcb5e('0x3a')],{'$or':_[_0xcb5e('0x3e')](_0x3defc7,function(_0x435f62){if(_0x435f62[_0xcb5e('0x3f')]!==_0xcb5e('0x40')){var _0x2a62d8={};_0x2a62d8[_0x435f62[_0xcb5e('0x2a')]]={'$like':'%'+_0x150313[_0xcb5e('0x2f')]['filter']+'%'};return _0x2a62d8;}})});}_0x2c28ff=_[_0xcb5e('0x3d')]({},_0x2c28ff,_0x150313[_0xcb5e('0x41')]);var _0x3eaa71={'where':_0x2c28ff[_0xcb5e('0x3a')]};return db['SalesforceConfiguration'][_0xcb5e('0x22')](_0x3eaa71)['then'](function(_0x502a8a){_0x10b9e1[_0xcb5e('0x22')]=_0x502a8a;if(_0x150313['query'][_0xcb5e('0x42')]){_0x2c28ff['include']=[{'all':!![]}];}return db[_0xcb5e('0x43')][_0xcb5e('0x44')](_0x2c28ff);})[_0xcb5e('0x28')](function(_0x2f54e){_0x10b9e1[_0xcb5e('0x45')]=_0x2f54e;return _0x10b9e1;})[_0xcb5e('0x28')](respondWithFilteredResult(_0x335ae3,_0x2c28ff))[_0xcb5e('0x46')](handleError(_0x335ae3,null));};exports[_0xcb5e('0x47')]=function(_0x50a50f,_0x21009f){var _0x29e6a4={'raw':![],'where':{'id':_0x50a50f['params']['id']}},_0xa6663b={};_0xa6663b['model']=_['keys'](db[_0xcb5e('0x43')][_0xcb5e('0x2c')]);_0xa6663b[_0xcb5e('0x2f')]=_['keys'](_0x50a50f[_0xcb5e('0x2f')]);_0xa6663b['filters']=_[_0xcb5e('0x31')](_0xa6663b[_0xcb5e('0x32')],_0xa6663b['query']);_0x29e6a4[_0xcb5e('0x34')]=_[_0xcb5e('0x31')](_0xa6663b[_0xcb5e('0x32')],qs[_0xcb5e('0x33')](_0x50a50f[_0xcb5e('0x2f')]['fields']));_0x29e6a4[_0xcb5e('0x34')]=_0x29e6a4['attributes'][_0xcb5e('0x35')]?_0x29e6a4[_0xcb5e('0x34')]:_0xa6663b['model'];if(_0x50a50f[_0xcb5e('0x2f')][_0xcb5e('0x42')]){_0x29e6a4['include']=[{'all':!![]}];}_0x29e6a4=_['merge']({},_0x29e6a4,_0x50a50f[_0xcb5e('0x41')]);return db[_0xcb5e('0x43')][_0xcb5e('0x48')](_0x29e6a4)['then'](handleEntityNotFound(_0x21009f,null))['then'](respondWithResult(_0x21009f,null))[_0xcb5e('0x46')](handleError(_0x21009f,null));};exports['create']=function(_0x538d7e,_0x1c045b){return db[_0xcb5e('0x43')]['create'](_0x538d7e['body'],{})[_0xcb5e('0x28')](respondWithResult(_0x1c045b,0xc9))[_0xcb5e('0x46')](handleError(_0x1c045b,null));};exports[_0xcb5e('0x26')]=function(_0x20c473,_0x4f9389){if(_0x20c473[_0xcb5e('0x49')]['id']){delete _0x20c473[_0xcb5e('0x49')]['id'];}return db[_0xcb5e('0x43')]['find']({'where':{'id':_0x20c473[_0xcb5e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f9389,null))[_0xcb5e('0x28')](saveUpdates(_0x20c473['body'],null))['then'](respondWithResult(_0x4f9389,null))[_0xcb5e('0x46')](handleError(_0x4f9389,null));};exports[_0xcb5e('0x27')]=function(_0x34a9c3,_0x265913){return db[_0xcb5e('0x43')][_0xcb5e('0x48')]({'where':{'id':_0x34a9c3['params']['id']}})[_0xcb5e('0x28')](handleEntityNotFound(_0x265913,null))[_0xcb5e('0x28')](removeEntity(_0x265913,null))['catch'](handleError(_0x265913,null));};exports[_0xcb5e('0x4b')]=function(_0xaa354f,_0x124f9f,_0x1adcd9){var _0x3ce945={};var _0x2a41fc={};var _0xefd644;var _0x1dce68;return db['SalesforceConfiguration'][_0xcb5e('0x4c')]({'where':{'id':_0xaa354f[_0xcb5e('0x4a')]['id']}})[_0xcb5e('0x28')](handleEntityNotFound(_0x124f9f,null))[_0xcb5e('0x28')](function(_0x248428){if(_0x248428){_0xefd644=_0x248428;_0x2a41fc[_0xcb5e('0x32')]=_[_0xcb5e('0x4d')](db[_0xcb5e('0x4e')][_0xcb5e('0x2c')]);_0x2a41fc[_0xcb5e('0x2f')]=_[_0xcb5e('0x4d')](_0xaa354f[_0xcb5e('0x2f')]);_0x2a41fc[_0xcb5e('0x30')]=_['intersection'](_0x2a41fc[_0xcb5e('0x32')],_0x2a41fc[_0xcb5e('0x2f')]);_0x3ce945[_0xcb5e('0x34')]=_[_0xcb5e('0x31')](_0x2a41fc[_0xcb5e('0x32')],qs[_0xcb5e('0x33')](_0xaa354f[_0xcb5e('0x2f')][_0xcb5e('0x33')]));_0x3ce945[_0xcb5e('0x34')]=_0x3ce945[_0xcb5e('0x34')][_0xcb5e('0x35')]?_0x3ce945[_0xcb5e('0x34')]:_0x2a41fc[_0xcb5e('0x32')];_0x3ce945[_0xcb5e('0x38')]=qs['sort'](_0xaa354f['query']['sort']);_0x3ce945[_0xcb5e('0x3a')]=qs['filters'](_[_0xcb5e('0x3b')](_0xaa354f[_0xcb5e('0x2f')],_0x2a41fc[_0xcb5e('0x30')]));if(_0xaa354f[_0xcb5e('0x2f')][_0xcb5e('0x3c')]){_0x3ce945[_0xcb5e('0x3a')]=_['merge'](_0x3ce945['where'],{'$or':_[_0xcb5e('0x3e')](_0x3ce945['attributes'],function(_0x36bee4){var _0x5e8b91={};_0x5e8b91[_0x36bee4]={'$like':'%'+_0xaa354f['query'][_0xcb5e('0x3c')]+'%'};return _0x5e8b91;})});}_0x3ce945=_[_0xcb5e('0x3d')]({},_0x3ce945,_0xaa354f[_0xcb5e('0x41')]);return _0xefd644[_0xcb5e('0x4b')](_0x3ce945);}})['then'](function(_0x5653ad){if(_0x5653ad){_0x1dce68=_0x5653ad[_0xcb5e('0x35')];if(!_0xaa354f['query'][_0xcb5e('0x36')]('nolimit')){_0x3ce945[_0xcb5e('0x21')]=qs['limit'](_0xaa354f[_0xcb5e('0x2f')][_0xcb5e('0x21')]);_0x3ce945[_0xcb5e('0x1f')]=qs[_0xcb5e('0x1f')](_0xaa354f['query'][_0xcb5e('0x1f')]);}return _0xefd644[_0xcb5e('0x4b')](_0x3ce945);}})[_0xcb5e('0x28')](function(_0xbe09a8){if(_0xbe09a8){return _0xbe09a8?{'count':_0x1dce68,'rows':_0xbe09a8}:null;}})['then'](respondWithResult(_0x124f9f,null))[_0xcb5e('0x46')](handleError(_0x124f9f,null));};exports[_0xcb5e('0x4f')]=function(_0x253a57,_0x115aab,_0x21be6f){var _0x137d63={};var _0x482308={};var _0x3a503b;var _0x44a363;return db[_0xcb5e('0x43')][_0xcb5e('0x4c')]({'where':{'id':_0x253a57[_0xcb5e('0x4a')]['id']}})[_0xcb5e('0x28')](handleEntityNotFound(_0x115aab,null))['then'](function(_0x239d9b){if(_0x239d9b){_0x3a503b=_0x239d9b;_0x482308['model']=_[_0xcb5e('0x4d')](db['SalesforceField'][_0xcb5e('0x2c')]);_0x482308[_0xcb5e('0x2f')]=_[_0xcb5e('0x4d')](_0x253a57[_0xcb5e('0x2f')]);_0x482308['filters']=_[_0xcb5e('0x31')](_0x482308[_0xcb5e('0x32')],_0x482308[_0xcb5e('0x2f')]);_0x137d63[_0xcb5e('0x34')]=_[_0xcb5e('0x31')](_0x482308[_0xcb5e('0x32')],qs['fields'](_0x253a57[_0xcb5e('0x2f')][_0xcb5e('0x33')]));_0x137d63[_0xcb5e('0x34')]=_0x137d63[_0xcb5e('0x34')]['length']?_0x137d63[_0xcb5e('0x34')]:_0x482308[_0xcb5e('0x32')];_0x137d63[_0xcb5e('0x38')]=qs[_0xcb5e('0x39')](_0x253a57[_0xcb5e('0x2f')]['sort']);_0x137d63[_0xcb5e('0x3a')]=qs[_0xcb5e('0x30')](_[_0xcb5e('0x3b')](_0x253a57[_0xcb5e('0x2f')],_0x482308[_0xcb5e('0x30')]));if(_0x253a57[_0xcb5e('0x2f')][_0xcb5e('0x3c')]){_0x137d63['where']=_[_0xcb5e('0x3d')](_0x137d63[_0xcb5e('0x3a')],{'$or':_[_0xcb5e('0x3e')](_0x137d63[_0xcb5e('0x34')],function(_0x2a8a87){var _0x2379c7={};_0x2379c7[_0x2a8a87]={'$like':'%'+_0x253a57[_0xcb5e('0x2f')][_0xcb5e('0x3c')]+'%'};return _0x2379c7;})});}_0x137d63=_[_0xcb5e('0x3d')]({},_0x137d63,_0x253a57[_0xcb5e('0x41')]);return _0x3a503b[_0xcb5e('0x4f')](_0x137d63);}})['then'](function(_0x351706){if(_0x351706){_0x44a363=_0x351706[_0xcb5e('0x35')];if(!_0x253a57[_0xcb5e('0x2f')][_0xcb5e('0x36')](_0xcb5e('0x37'))){_0x137d63[_0xcb5e('0x21')]=qs['limit'](_0x253a57[_0xcb5e('0x2f')][_0xcb5e('0x21')]);_0x137d63['offset']=qs['offset'](_0x253a57[_0xcb5e('0x2f')]['offset']);}return _0x3a503b[_0xcb5e('0x4f')](_0x137d63);}})[_0xcb5e('0x28')](function(_0x277a7d){if(_0x277a7d){return _0x277a7d?{'count':_0x44a363,'rows':_0x277a7d}:null;}})[_0xcb5e('0x28')](respondWithResult(_0x115aab,null))[_0xcb5e('0x46')](handleError(_0x115aab,null));};exports[_0xcb5e('0x50')]=function(_0x36cc12,_0x2b8730,_0x1fc331){var _0x189e9b={};var _0x5dffa0={};var _0x24a194;var _0x54ae7f;return db[_0xcb5e('0x43')][_0xcb5e('0x4c')]({'where':{'id':_0x36cc12[_0xcb5e('0x4a')]['id']}})[_0xcb5e('0x28')](handleEntityNotFound(_0x2b8730,null))['then'](function(_0x2de696){if(_0x2de696){_0x24a194=_0x2de696;_0x5dffa0['model']=_[_0xcb5e('0x4d')](db[_0xcb5e('0x4e')][_0xcb5e('0x2c')]);_0x5dffa0[_0xcb5e('0x2f')]=_[_0xcb5e('0x4d')](_0x36cc12['query']);_0x5dffa0['filters']=_['intersection'](_0x5dffa0[_0xcb5e('0x32')],_0x5dffa0[_0xcb5e('0x2f')]);_0x189e9b['attributes']=_[_0xcb5e('0x31')](_0x5dffa0[_0xcb5e('0x32')],qs[_0xcb5e('0x33')](_0x36cc12[_0xcb5e('0x2f')]['fields']));_0x189e9b[_0xcb5e('0x34')]=_0x189e9b['attributes'][_0xcb5e('0x35')]?_0x189e9b[_0xcb5e('0x34')]:_0x5dffa0[_0xcb5e('0x32')];_0x189e9b[_0xcb5e('0x38')]=qs[_0xcb5e('0x39')](_0x36cc12[_0xcb5e('0x2f')][_0xcb5e('0x39')]);_0x189e9b['where']=qs[_0xcb5e('0x30')](_[_0xcb5e('0x3b')](_0x36cc12[_0xcb5e('0x2f')],_0x5dffa0[_0xcb5e('0x30')]));if(_0x36cc12[_0xcb5e('0x2f')][_0xcb5e('0x3c')]){_0x189e9b[_0xcb5e('0x3a')]=_[_0xcb5e('0x3d')](_0x189e9b['where'],{'$or':_[_0xcb5e('0x3e')](_0x189e9b['attributes'],function(_0x5329ed){var _0x22b3d4={};_0x22b3d4[_0x5329ed]={'$like':'%'+_0x36cc12[_0xcb5e('0x2f')][_0xcb5e('0x3c')]+'%'};return _0x22b3d4;})});}_0x189e9b=_[_0xcb5e('0x3d')]({},_0x189e9b,_0x36cc12[_0xcb5e('0x41')]);return _0x24a194[_0xcb5e('0x50')](_0x189e9b);}})[_0xcb5e('0x28')](function(_0x21e800){if(_0x21e800){_0x54ae7f=_0x21e800[_0xcb5e('0x35')];if(!_0x36cc12[_0xcb5e('0x2f')]['hasOwnProperty'](_0xcb5e('0x37'))){_0x189e9b[_0xcb5e('0x21')]=qs['limit'](_0x36cc12[_0xcb5e('0x2f')][_0xcb5e('0x21')]);_0x189e9b[_0xcb5e('0x1f')]=qs[_0xcb5e('0x1f')](_0x36cc12[_0xcb5e('0x2f')][_0xcb5e('0x1f')]);}return _0x24a194[_0xcb5e('0x50')](_0x189e9b);}})['then'](function(_0x1a3081){if(_0x1a3081){return _0x1a3081?{'count':_0x54ae7f,'rows':_0x1a3081}:null;}})[_0xcb5e('0x28')](respondWithResult(_0x2b8730,null))[_0xcb5e('0x46')](handleError(_0x2b8730,null));}; \ No newline at end of file +var _0xa220=['pick','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','SalesforceConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','body','getFields','SalesforceField'];(function(_0x1e9cd3,_0x14dbe1){var _0x4c4dfe=function(_0x463cd9){while(--_0x463cd9){_0x1e9cd3['push'](_0x1e9cd3['shift']());}};_0x4c4dfe(++_0x14dbe1);}(_0xa220,0x100));var _0x0a22=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa220[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x0a22('0x0'));var rimraf=require(_0x0a22('0x1'));var zipdir=require(_0x0a22('0x2'));var jsonpatch=require(_0x0a22('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a22('0x4'));var Mustache=require(_0x0a22('0x5'));var util=require(_0x0a22('0x6'));var path=require(_0x0a22('0x7'));var sox=require(_0x0a22('0x8'));var csv=require('to-csv');var ejs=require(_0x0a22('0x9'));var fs=require('fs');var fs_extra=require(_0x0a22('0xa'));var _=require(_0x0a22('0xb'));var squel=require(_0x0a22('0xc'));var crypto=require(_0x0a22('0xd'));var jsforce=require(_0x0a22('0xe'));var deskjs=require(_0x0a22('0xf'));var toCsv=require(_0x0a22('0x10'));var querystring=require(_0x0a22('0x11'));var Papa=require(_0x0a22('0x12'));var Redis=require('ioredis');var authService=require(_0x0a22('0x13'));var qs=require(_0x0a22('0x14'));var as=require(_0x0a22('0x15'));var hardwareService=require(_0x0a22('0x16'));var logger=require(_0x0a22('0x17'))(_0x0a22('0x18'));var utils=require(_0x0a22('0x19'));var config=require(_0x0a22('0x1a'));var licenseUtil=require(_0x0a22('0x1b'));var db=require(_0x0a22('0x1c'))['db'];function respondWithStatusCode(_0xd96f4c,_0x4988a3){_0x4988a3=_0x4988a3||0xcc;return function(_0x577c22){if(_0x577c22){return _0xd96f4c[_0x0a22('0x1d')](_0x4988a3);}return _0xd96f4c[_0x0a22('0x1e')](_0x4988a3)[_0x0a22('0x1f')]();};}function respondWithResult(_0x18bc17,_0x363355){_0x363355=_0x363355||0xc8;return function(_0xc7e1ae){if(_0xc7e1ae){return _0x18bc17[_0x0a22('0x1e')](_0x363355)[_0x0a22('0x20')](_0xc7e1ae);}};}function respondWithFilteredResult(_0x4750bb,_0x17f501){return function(_0x38c40b){if(_0x38c40b){var _0x20b587=typeof _0x17f501[_0x0a22('0x21')]==='undefined'&&typeof _0x17f501[_0x0a22('0x22')]===_0x0a22('0x23');var _0x3f6139=_0x38c40b[_0x0a22('0x24')];var _0x32707b=_0x20b587?0x0:_0x17f501['offset'];var _0x15ddcc=_0x20b587?_0x38c40b[_0x0a22('0x24')]:_0x17f501[_0x0a22('0x21')]+_0x17f501[_0x0a22('0x22')];var _0x29bd8b;if(_0x15ddcc>=_0x3f6139){_0x15ddcc=_0x3f6139;_0x29bd8b=0xc8;}else{_0x29bd8b=0xce;}_0x4750bb[_0x0a22('0x1e')](_0x29bd8b);return _0x4750bb[_0x0a22('0x25')](_0x0a22('0x26'),_0x32707b+'-'+_0x15ddcc+'/'+_0x3f6139)[_0x0a22('0x20')](_0x38c40b);}return null;};}function patchUpdates(_0x1f27ca){return function(_0x22c05a){try{jsonpatch[_0x0a22('0x27')](_0x22c05a,_0x1f27ca,!![]);}catch(_0x8ab9a7){return BPromise[_0x0a22('0x28')](_0x8ab9a7);}return _0x22c05a['save']();};}function saveUpdates(_0x1fc60b,_0x1ad190){return function(_0x28d693){if(_0x28d693){return _0x28d693[_0x0a22('0x29')](_0x1fc60b)[_0x0a22('0x2a')](function(_0xf24df){return _0xf24df;});}return null;};}function removeEntity(_0x13acea,_0x584c99){return function(_0x2c9861){if(_0x2c9861){return _0x2c9861[_0x0a22('0x2b')]()[_0x0a22('0x2a')](function(){_0x13acea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b39a5,_0x33cfda){return function(_0x2c906a){if(!_0x2c906a){_0x1b39a5[_0x0a22('0x1d')](0x194);}return _0x2c906a;};}function handleError(_0x3de2b5,_0x1798ec){_0x1798ec=_0x1798ec||0x1f4;return function(_0x4e6209){logger[_0x0a22('0x2c')](_0x4e6209['stack']);if(_0x4e6209[_0x0a22('0x2d')]){delete _0x4e6209[_0x0a22('0x2d')];}_0x3de2b5['status'](_0x1798ec)[_0x0a22('0x2e')](_0x4e6209);};}exports[_0x0a22('0x2f')]=function(_0x3f71e8,_0x3ebd1e){var _0x4d74bf={},_0x477475={},_0x163853={'count':0x0,'rows':[]};var _0x4194bb=_[_0x0a22('0x30')](db[_0x0a22('0x31')]['rawAttributes'],function(_0xf3435b){return{'name':_0xf3435b['fieldName'],'type':_0xf3435b[_0x0a22('0x32')][_0x0a22('0x33')]};});_0x477475[_0x0a22('0x34')]=_[_0x0a22('0x30')](_0x4194bb,_0x0a22('0x2d'));_0x477475[_0x0a22('0x35')]=_[_0x0a22('0x36')](_0x3f71e8['query']);_0x477475[_0x0a22('0x37')]=_[_0x0a22('0x38')](_0x477475[_0x0a22('0x34')],_0x477475[_0x0a22('0x35')]);_0x4d74bf[_0x0a22('0x39')]=_[_0x0a22('0x38')](_0x477475[_0x0a22('0x34')],qs[_0x0a22('0x3a')](_0x3f71e8[_0x0a22('0x35')]['fields']));_0x4d74bf['attributes']=_0x4d74bf[_0x0a22('0x39')][_0x0a22('0x3b')]?_0x4d74bf[_0x0a22('0x39')]:_0x477475[_0x0a22('0x34')];if(!_0x3f71e8[_0x0a22('0x35')][_0x0a22('0x3c')](_0x0a22('0x3d'))){_0x4d74bf[_0x0a22('0x22')]=qs[_0x0a22('0x22')](_0x3f71e8[_0x0a22('0x35')]['limit']);_0x4d74bf[_0x0a22('0x21')]=qs[_0x0a22('0x21')](_0x3f71e8['query'][_0x0a22('0x21')]);}_0x4d74bf[_0x0a22('0x3e')]=qs[_0x0a22('0x3f')](_0x3f71e8['query']['sort']);_0x4d74bf[_0x0a22('0x40')]=qs[_0x0a22('0x37')](_['pick'](_0x3f71e8['query'],_0x477475[_0x0a22('0x37')]),_0x4194bb);if(_0x3f71e8[_0x0a22('0x35')][_0x0a22('0x41')]){_0x4d74bf[_0x0a22('0x40')]=_[_0x0a22('0x42')](_0x4d74bf[_0x0a22('0x40')],{'$or':_[_0x0a22('0x30')](_0x4194bb,function(_0xa51b1b){if(_0xa51b1b[_0x0a22('0x32')]!==_0x0a22('0x43')){var _0x3889a9={};_0x3889a9[_0xa51b1b['name']]={'$like':'%'+_0x3f71e8['query']['filter']+'%'};return _0x3889a9;}})});}_0x4d74bf=_['merge']({},_0x4d74bf,_0x3f71e8[_0x0a22('0x44')]);var _0x26adc0={'where':_0x4d74bf[_0x0a22('0x40')]};return db['SalesforceConfiguration']['count'](_0x26adc0)['then'](function(_0x2213cd){_0x163853[_0x0a22('0x24')]=_0x2213cd;if(_0x3f71e8[_0x0a22('0x35')][_0x0a22('0x45')]){_0x4d74bf[_0x0a22('0x46')]=[{'all':!![]}];}return db[_0x0a22('0x31')][_0x0a22('0x47')](_0x4d74bf);})[_0x0a22('0x2a')](function(_0x32a6b2){_0x163853[_0x0a22('0x48')]=_0x32a6b2;return _0x163853;})[_0x0a22('0x2a')](respondWithFilteredResult(_0x3ebd1e,_0x4d74bf))[_0x0a22('0x49')](handleError(_0x3ebd1e,null));};exports['show']=function(_0x50d150,_0x18d33a){var _0x57f6c2={'raw':![],'where':{'id':_0x50d150[_0x0a22('0x4a')]['id']}},_0x28bfe7={};_0x28bfe7['model']=_[_0x0a22('0x36')](db['SalesforceConfiguration'][_0x0a22('0x4b')]);_0x28bfe7[_0x0a22('0x35')]=_[_0x0a22('0x36')](_0x50d150['query']);_0x28bfe7[_0x0a22('0x37')]=_[_0x0a22('0x38')](_0x28bfe7['model'],_0x28bfe7[_0x0a22('0x35')]);_0x57f6c2[_0x0a22('0x39')]=_[_0x0a22('0x38')](_0x28bfe7[_0x0a22('0x34')],qs[_0x0a22('0x3a')](_0x50d150[_0x0a22('0x35')][_0x0a22('0x3a')]));_0x57f6c2[_0x0a22('0x39')]=_0x57f6c2[_0x0a22('0x39')][_0x0a22('0x3b')]?_0x57f6c2[_0x0a22('0x39')]:_0x28bfe7[_0x0a22('0x34')];if(_0x50d150['query']['includeAll']){_0x57f6c2[_0x0a22('0x46')]=[{'all':!![]}];}_0x57f6c2=_[_0x0a22('0x42')]({},_0x57f6c2,_0x50d150[_0x0a22('0x44')]);return db[_0x0a22('0x31')][_0x0a22('0x4c')](_0x57f6c2)[_0x0a22('0x2a')](handleEntityNotFound(_0x18d33a,null))[_0x0a22('0x2a')](respondWithResult(_0x18d33a,null))[_0x0a22('0x49')](handleError(_0x18d33a,null));};exports['create']=function(_0x2bad49,_0x211195){return db[_0x0a22('0x31')]['create'](_0x2bad49[_0x0a22('0x4d')],{})[_0x0a22('0x2a')](respondWithResult(_0x211195,0xc9))[_0x0a22('0x49')](handleError(_0x211195,null));};exports[_0x0a22('0x29')]=function(_0x51d6a6,_0x118d7c){if(_0x51d6a6['body']['id']){delete _0x51d6a6['body']['id'];}return db[_0x0a22('0x31')]['find']({'where':{'id':_0x51d6a6['params']['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x118d7c,null))[_0x0a22('0x2a')](saveUpdates(_0x51d6a6['body'],null))[_0x0a22('0x2a')](respondWithResult(_0x118d7c,null))[_0x0a22('0x49')](handleError(_0x118d7c,null));};exports[_0x0a22('0x2b')]=function(_0x5b6703,_0x177360){return db['SalesforceConfiguration'][_0x0a22('0x4c')]({'where':{'id':_0x5b6703[_0x0a22('0x4a')]['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x177360,null))[_0x0a22('0x2a')](removeEntity(_0x177360,null))['catch'](handleError(_0x177360,null));};exports[_0x0a22('0x4e')]=function(_0x403004,_0x275651,_0x9bb741){var _0x23188b={};var _0x6e8ce9={};var _0xb74c50;var _0xf3a00c;return db[_0x0a22('0x31')]['findOne']({'where':{'id':_0x403004[_0x0a22('0x4a')]['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x275651,null))[_0x0a22('0x2a')](function(_0x3149a7){if(_0x3149a7){_0xb74c50=_0x3149a7;_0x6e8ce9[_0x0a22('0x34')]=_[_0x0a22('0x36')](db[_0x0a22('0x4f')][_0x0a22('0x4b')]);_0x6e8ce9[_0x0a22('0x35')]=_[_0x0a22('0x36')](_0x403004[_0x0a22('0x35')]);_0x6e8ce9['filters']=_[_0x0a22('0x38')](_0x6e8ce9[_0x0a22('0x34')],_0x6e8ce9[_0x0a22('0x35')]);_0x23188b[_0x0a22('0x39')]=_[_0x0a22('0x38')](_0x6e8ce9['model'],qs[_0x0a22('0x3a')](_0x403004[_0x0a22('0x35')][_0x0a22('0x3a')]));_0x23188b[_0x0a22('0x39')]=_0x23188b[_0x0a22('0x39')]['length']?_0x23188b[_0x0a22('0x39')]:_0x6e8ce9[_0x0a22('0x34')];_0x23188b['order']=qs[_0x0a22('0x3f')](_0x403004['query'][_0x0a22('0x3f')]);_0x23188b[_0x0a22('0x40')]=qs['filters'](_[_0x0a22('0x50')](_0x403004[_0x0a22('0x35')],_0x6e8ce9[_0x0a22('0x37')]));if(_0x403004[_0x0a22('0x35')][_0x0a22('0x41')]){_0x23188b['where']=_['merge'](_0x23188b[_0x0a22('0x40')],{'$or':_[_0x0a22('0x30')](_0x23188b[_0x0a22('0x39')],function(_0x1e7343){var _0x15372b={};_0x15372b[_0x1e7343]={'$like':'%'+_0x403004['query'][_0x0a22('0x41')]+'%'};return _0x15372b;})});}_0x23188b=_['merge']({},_0x23188b,_0x403004[_0x0a22('0x44')]);return _0xb74c50[_0x0a22('0x4e')](_0x23188b);}})[_0x0a22('0x2a')](function(_0x117b41){if(_0x117b41){_0xf3a00c=_0x117b41[_0x0a22('0x3b')];if(!_0x403004[_0x0a22('0x35')]['hasOwnProperty']('nolimit')){_0x23188b[_0x0a22('0x22')]=qs[_0x0a22('0x22')](_0x403004[_0x0a22('0x35')][_0x0a22('0x22')]);_0x23188b[_0x0a22('0x21')]=qs[_0x0a22('0x21')](_0x403004[_0x0a22('0x35')][_0x0a22('0x21')]);}return _0xb74c50[_0x0a22('0x4e')](_0x23188b);}})[_0x0a22('0x2a')](function(_0xde594a){if(_0xde594a){return _0xde594a?{'count':_0xf3a00c,'rows':_0xde594a}:null;}})['then'](respondWithResult(_0x275651,null))[_0x0a22('0x49')](handleError(_0x275651,null));};exports['getSubjects']=function(_0x162731,_0x28e715,_0x538327){var _0x55b0b4={};var _0x194155={};var _0x5ce55e;var _0x297bdf;return db['SalesforceConfiguration'][_0x0a22('0x51')]({'where':{'id':_0x162731[_0x0a22('0x4a')]['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x28e715,null))['then'](function(_0x6cdde9){if(_0x6cdde9){_0x5ce55e=_0x6cdde9;_0x194155[_0x0a22('0x34')]=_[_0x0a22('0x36')](db['SalesforceField'][_0x0a22('0x4b')]);_0x194155['query']=_['keys'](_0x162731[_0x0a22('0x35')]);_0x194155[_0x0a22('0x37')]=_[_0x0a22('0x38')](_0x194155[_0x0a22('0x34')],_0x194155['query']);_0x55b0b4['attributes']=_[_0x0a22('0x38')](_0x194155['model'],qs['fields'](_0x162731[_0x0a22('0x35')][_0x0a22('0x3a')]));_0x55b0b4['attributes']=_0x55b0b4[_0x0a22('0x39')][_0x0a22('0x3b')]?_0x55b0b4['attributes']:_0x194155[_0x0a22('0x34')];_0x55b0b4[_0x0a22('0x3e')]=qs[_0x0a22('0x3f')](_0x162731[_0x0a22('0x35')][_0x0a22('0x3f')]);_0x55b0b4['where']=qs['filters'](_[_0x0a22('0x50')](_0x162731[_0x0a22('0x35')],_0x194155['filters']));if(_0x162731[_0x0a22('0x35')][_0x0a22('0x41')]){_0x55b0b4[_0x0a22('0x40')]=_[_0x0a22('0x42')](_0x55b0b4[_0x0a22('0x40')],{'$or':_[_0x0a22('0x30')](_0x55b0b4[_0x0a22('0x39')],function(_0x185a69){var _0xf6cf6e={};_0xf6cf6e[_0x185a69]={'$like':'%'+_0x162731[_0x0a22('0x35')][_0x0a22('0x41')]+'%'};return _0xf6cf6e;})});}_0x55b0b4=_[_0x0a22('0x42')]({},_0x55b0b4,_0x162731['options']);return _0x5ce55e[_0x0a22('0x52')](_0x55b0b4);}})[_0x0a22('0x2a')](function(_0x19172f){if(_0x19172f){_0x297bdf=_0x19172f[_0x0a22('0x3b')];if(!_0x162731[_0x0a22('0x35')][_0x0a22('0x3c')]('nolimit')){_0x55b0b4[_0x0a22('0x22')]=qs[_0x0a22('0x22')](_0x162731[_0x0a22('0x35')][_0x0a22('0x22')]);_0x55b0b4['offset']=qs[_0x0a22('0x21')](_0x162731[_0x0a22('0x35')][_0x0a22('0x21')]);}return _0x5ce55e['getSubjects'](_0x55b0b4);}})[_0x0a22('0x2a')](function(_0x4f7b67){if(_0x4f7b67){return _0x4f7b67?{'count':_0x297bdf,'rows':_0x4f7b67}:null;}})[_0x0a22('0x2a')](respondWithResult(_0x28e715,null))['catch'](handleError(_0x28e715,null));};exports['getDescriptions']=function(_0x2a5f24,_0x37c9f6,_0x40cb47){var _0x2a0d00={};var _0x571178={};var _0x250b96;var _0x520f89;return db[_0x0a22('0x31')][_0x0a22('0x51')]({'where':{'id':_0x2a5f24['params']['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x37c9f6,null))['then'](function(_0x123b87){if(_0x123b87){_0x250b96=_0x123b87;_0x571178[_0x0a22('0x34')]=_[_0x0a22('0x36')](db['SalesforceField'][_0x0a22('0x4b')]);_0x571178[_0x0a22('0x35')]=_['keys'](_0x2a5f24[_0x0a22('0x35')]);_0x571178[_0x0a22('0x37')]=_['intersection'](_0x571178[_0x0a22('0x34')],_0x571178[_0x0a22('0x35')]);_0x2a0d00[_0x0a22('0x39')]=_[_0x0a22('0x38')](_0x571178[_0x0a22('0x34')],qs['fields'](_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x3a')]));_0x2a0d00[_0x0a22('0x39')]=_0x2a0d00[_0x0a22('0x39')][_0x0a22('0x3b')]?_0x2a0d00[_0x0a22('0x39')]:_0x571178[_0x0a22('0x34')];_0x2a0d00[_0x0a22('0x3e')]=qs[_0x0a22('0x3f')](_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x3f')]);_0x2a0d00[_0x0a22('0x40')]=qs[_0x0a22('0x37')](_[_0x0a22('0x50')](_0x2a5f24[_0x0a22('0x35')],_0x571178[_0x0a22('0x37')]));if(_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x41')]){_0x2a0d00[_0x0a22('0x40')]=_['merge'](_0x2a0d00[_0x0a22('0x40')],{'$or':_[_0x0a22('0x30')](_0x2a0d00[_0x0a22('0x39')],function(_0x487d8f){var _0x237925={};_0x237925[_0x487d8f]={'$like':'%'+_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x41')]+'%'};return _0x237925;})});}_0x2a0d00=_[_0x0a22('0x42')]({},_0x2a0d00,_0x2a5f24[_0x0a22('0x44')]);return _0x250b96[_0x0a22('0x53')](_0x2a0d00);}})[_0x0a22('0x2a')](function(_0x377116){if(_0x377116){_0x520f89=_0x377116['length'];if(!_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x3c')](_0x0a22('0x3d'))){_0x2a0d00[_0x0a22('0x22')]=qs['limit'](_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x22')]);_0x2a0d00['offset']=qs['offset'](_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x21')]);}return _0x250b96['getDescriptions'](_0x2a0d00);}})['then'](function(_0x16235e){if(_0x16235e){return _0x16235e?{'count':_0x520f89,'rows':_0x16235e}:null;}})[_0x0a22('0x2a')](respondWithResult(_0x37c9f6,null))[_0x0a22('0x49')](handleError(_0x37c9f6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4bdefc7..48abfcc 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 _0x163c=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x196736,_0x1d49b9){var _0x59432a=function(_0x385a1c){while(--_0x385a1c){_0x196736['push'](_0x196736['shift']());}};_0x59432a(++_0x1d49b9);}(_0x163c,0x109));var _0xc163=function(_0x2e8a88,_0x4adf5f){_0x2e8a88=_0x2e8a88-0x0;var _0x2529c9=_0x163c[_0x2e8a88];return _0x2529c9;};'use strict';var _=require(_0xc163('0x0'));var util=require(_0xc163('0x1'));var logger=require(_0xc163('0x2'))(_0xc163('0x3'));var moment=require(_0xc163('0x4'));var BPromise=require(_0xc163('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc163('0x6'));var config=require(_0xc163('0x7'));var attributes=require(_0xc163('0x8'));module[_0xc163('0x9')]=function(_0x291507,_0x5ecb99){return _0x291507['define'](_0xc163('0xa'),attributes,{'tableName':_0xc163('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc137=['../../config/logger','moment','bluebird','request-promise','path','./intSalesforceConfiguration.attributes','define','int_salesforce_configurations','lodash','util'];(function(_0x5ce075,_0x20b649){var _0x595e7d=function(_0x4384dc){while(--_0x4384dc){_0x5ce075['push'](_0x5ce075['shift']());}};_0x595e7d(++_0x20b649);}(_0xc137,0x166));var _0x7c13=function(_0x5dcb0a,_0x1d4ba1){_0x5dcb0a=_0x5dcb0a-0x0;var _0x5a1e53=_0xc137[_0x5dcb0a];return _0x5a1e53;};'use strict';var _=require(_0x7c13('0x0'));var util=require(_0x7c13('0x1'));var logger=require(_0x7c13('0x2'))('api');var moment=require(_0x7c13('0x3'));var BPromise=require(_0x7c13('0x4'));var rp=require(_0x7c13('0x5'));var fs=require('fs');var path=require(_0x7c13('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7c13('0x7'));module['exports']=function(_0x3380aa,_0x52505f){return _0x3380aa[_0x7c13('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x7c13('0x9'),'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 236dafa..33155e0 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 _0x7f51=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x4cbff8,_0xe5bce2){var _0x4342be=function(_0x3b60b3){while(--_0x3b60b3){_0x4cbff8['push'](_0x4cbff8['shift']());}};_0x4342be(++_0xe5bce2);}(_0x7f51,0x6a));var _0x17f5=function(_0x161fe2,_0x59e9f6){_0x161fe2=_0x161fe2-0x0;var _0x2a20a8=_0x7f51[_0x161fe2];return _0x2a20a8;};'use strict';var _=require(_0x17f5('0x0'));var util=require(_0x17f5('0x1'));var moment=require(_0x17f5('0x2'));var BPromise=require(_0x17f5('0x3'));var rs=require(_0x17f5('0x4'));var fs=require('fs');var Redis=require(_0x17f5('0x5'));var db=require(_0x17f5('0x6'))['db'];var utils=require(_0x17f5('0x7'));var logger=require('../../config/logger')(_0x17f5('0x8'));var config=require('../../config/environment');var jayson=require(_0x17f5('0x9'));var client=jayson['client'][_0x17f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53d024,_0x38a410,_0x359e61){return new BPromise(function(_0x5e7684,_0x5a9719){return client[_0x17f5('0xb')](_0x53d024,_0x359e61)['then'](function(_0x2bfb5d){logger[_0x17f5('0xc')](_0x17f5('0xd'),_0x38a410,'request\x20sent');logger[_0x17f5('0xe')](_0x17f5('0xf'),_0x38a410,'request\x20sent',JSON[_0x17f5('0x10')](_0x2bfb5d));if(_0x2bfb5d[_0x17f5('0x11')]){if(_0x2bfb5d[_0x17f5('0x11')]['code']===0x1f4){logger[_0x17f5('0x11')](_0x17f5('0xd'),_0x38a410,_0x2bfb5d[_0x17f5('0x11')][_0x17f5('0x12')]);return _0x5a9719(_0x2bfb5d['error'][_0x17f5('0x12')]);}logger[_0x17f5('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x38a410,_0x2bfb5d['error']['message']);return _0x5e7684(_0x2bfb5d['error'][_0x17f5('0x12')]);}else{logger[_0x17f5('0xc')](_0x17f5('0xd'),_0x38a410,_0x17f5('0x13'));_0x5e7684(_0x2bfb5d[_0x17f5('0x14')][_0x17f5('0x12')]);}})[_0x17f5('0x15')](function(_0x4f7f0b){logger[_0x17f5('0x11')](_0x17f5('0xd'),_0x38a410,_0x4f7f0b);_0x5a9719(_0x4f7f0b);});});} \ No newline at end of file +var _0x447d=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info'];(function(_0x5ae227,_0x459b0c){var _0xa4a479=function(_0x3bf9d6){while(--_0x3bf9d6){_0x5ae227['push'](_0x5ae227['shift']());}};_0xa4a479(++_0x459b0c);}(_0x447d,0x96));var _0xd447=function(_0x29a73e,_0x2cb43e){_0x29a73e=_0x29a73e-0x0;var _0x14c50e=_0x447d[_0x29a73e];return _0x14c50e;};'use strict';var _=require(_0xd447('0x0'));var util=require(_0xd447('0x1'));var moment=require('moment');var BPromise=require(_0xd447('0x2'));var rs=require(_0xd447('0x3'));var fs=require('fs');var Redis=require(_0xd447('0x4'));var db=require(_0xd447('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd447('0x6'))(_0xd447('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd447('0x8')][_0xd447('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb69f70,_0x1b53ef,_0x4d1c7b){return new BPromise(function(_0x3502b7,_0x127a27){return client[_0xd447('0xa')](_0xb69f70,_0x4d1c7b)['then'](function(_0x2ad6fe){logger[_0xd447('0xb')](_0xd447('0xc'),_0x1b53ef,_0xd447('0xd'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1b53ef,'request\x20sent',JSON[_0xd447('0xe')](_0x2ad6fe));if(_0x2ad6fe['error']){if(_0x2ad6fe[_0xd447('0xf')]['code']===0x1f4){logger[_0xd447('0xf')](_0xd447('0xc'),_0x1b53ef,_0x2ad6fe[_0xd447('0xf')][_0xd447('0x10')]);return _0x127a27(_0x2ad6fe['error']['message']);}logger[_0xd447('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1b53ef,_0x2ad6fe[_0xd447('0xf')][_0xd447('0x10')]);return _0x3502b7(_0x2ad6fe[_0xd447('0xf')][_0xd447('0x10')]);}else{logger[_0xd447('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1b53ef,_0xd447('0xd'));_0x3502b7(_0x2ad6fe[_0xd447('0x11')][_0xd447('0x10')]);}})['catch'](function(_0x1f87a7){logger[_0xd447('0xf')](_0xd447('0xc'),_0x1b53ef,_0x1f87a7);_0x127a27(_0x1f87a7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8030edd..62ee00a 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 _0x0ad5=['/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','index','get'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0x0ad5,0x184));var _0x50ad=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0ad5[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x50ad('0x0'));var path=require(_0x50ad('0x1'));var timeout=require(_0x50ad('0x2'));var express=require(_0x50ad('0x3'));var router=express[_0x50ad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x50ad('0x5'));var interaction=require(_0x50ad('0x6'));var config=require('../../config/environment');var controller=require(_0x50ad('0x7'));router['get']('/',auth[_0x50ad('0x8')](),controller[_0x50ad('0x9')]);router[_0x50ad('0xa')](_0x50ad('0xb'),auth[_0x50ad('0x8')](),controller[_0x50ad('0xc')]);router[_0x50ad('0xd')]('/',auth[_0x50ad('0x8')](),controller[_0x50ad('0xe')]);router[_0x50ad('0xf')](_0x50ad('0xb'),auth[_0x50ad('0x8')](),controller[_0x50ad('0x10')]);router[_0x50ad('0x11')]('/:id',auth[_0x50ad('0x8')](),controller[_0x50ad('0x12')]);module['exports']=router; \ No newline at end of file +var _0xca42=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x464461,_0x2f7d85){var _0x5c595a=function(_0x2059a6){while(--_0x2059a6){_0x464461['push'](_0x464461['shift']());}};_0x5c595a(++_0x2f7d85);}(_0xca42,0xe8));var _0x2ca4=function(_0x23d179,_0x2b5be0){_0x23d179=_0x23d179-0x0;var _0x27124d=_0xca42[_0x23d179];return _0x27124d;};'use strict';var multer=require('multer');var util=require(_0x2ca4('0x0'));var path=require(_0x2ca4('0x1'));var timeout=require(_0x2ca4('0x2'));var express=require('express');var router=express[_0x2ca4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2ca4('0x4'));var interaction=require(_0x2ca4('0x5'));var config=require(_0x2ca4('0x6'));var controller=require(_0x2ca4('0x7'));router[_0x2ca4('0x8')]('/',auth[_0x2ca4('0x9')](),controller['index']);router[_0x2ca4('0x8')](_0x2ca4('0xa'),auth[_0x2ca4('0x9')](),controller[_0x2ca4('0xb')]);router[_0x2ca4('0xc')]('/',auth['isAuthenticated'](),controller[_0x2ca4('0xd')]);router[_0x2ca4('0xe')](_0x2ca4('0xa'),auth[_0x2ca4('0x9')](),controller[_0x2ca4('0xf')]);router[_0x2ca4('0x10')](_0x2ca4('0xa'),auth[_0x2ca4('0x9')](),controller[_0x2ca4('0x11')]);module[_0x2ca4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 3bbb45a..a93adfa 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 _0x560a=['customVariable','keyValue','picklist','string','STRING','ENUM','sequelize','exports','variable'];(function(_0x4f54ac,_0x51930e){var _0x26f0d5=function(_0x2672d3){while(--_0x2672d3){_0x4f54ac['push'](_0x4f54ac['shift']());}};_0x26f0d5(++_0x51930e);}(_0x560a,0xe7));var _0xa560=function(_0x33d427,_0x47c8c2){_0x33d427=_0x33d427-0x0;var _0x383dbd=_0x560a[_0x33d427];return _0x383dbd;};'use strict';var Sequelize=require(_0xa560('0x0'));module[_0xa560('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xa560('0x2'),_0xa560('0x3'),_0xa560('0x4'),_0xa560('0x5')),'defaultValue':_0xa560('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa560('0x7')]},'keyType':{'type':Sequelize[_0xa560('0x8')](_0xa560('0x6'),_0xa560('0x2'),_0xa560('0x3'))},'keyContent':{'type':Sequelize[_0xa560('0x7')]},'idField':{'type':Sequelize[_0xa560('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x720f=['string','variable','keyValue','picklist','STRING','customVariable','ENUM'];(function(_0x43b6db,_0x5eab00){var _0x4b845b=function(_0xf0e926){while(--_0xf0e926){_0x43b6db['push'](_0x43b6db['shift']());}};_0x4b845b(++_0x5eab00);}(_0x720f,0x179));var _0xf720=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x720f[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf720('0x0')](_0xf720('0x1'),_0xf720('0x2'),'customVariable',_0xf720('0x3'),_0xf720('0x4')),'defaultValue':_0xf720('0x1')},'content':{'type':Sequelize[_0xf720('0x5')]},'key':{'type':Sequelize[_0xf720('0x5')]},'keyType':{'type':Sequelize[_0xf720('0x0')]('string',_0xf720('0x2'),_0xf720('0x6'))},'keyContent':{'type':Sequelize[_0xf720('0x5')]},'idField':{'type':Sequelize[_0xf720('0x5')]},'variableName':{'type':Sequelize[_0xf720('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 5ed564e..0c99ae0 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 _0x2790=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','SalesforceField','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','catch','params','includeAll','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3f7f41,_0x3b3d55){var _0x1c90ce=function(_0x398343){while(--_0x398343){_0x3f7f41['push'](_0x3f7f41['shift']());}};_0x1c90ce(++_0x3b3d55);}(_0x2790,0x8d));var _0x0279=function(_0x12f5f7,_0xa58b52){_0x12f5f7=_0x12f5f7-0x0;var _0x345c1b=_0x2790[_0x12f5f7];return _0x345c1b;};'use strict';var emlformat=require(_0x0279('0x0'));var rimraf=require(_0x0279('0x1'));var zipdir=require(_0x0279('0x2'));var jsonpatch=require(_0x0279('0x3'));var rp=require(_0x0279('0x4'));var moment=require(_0x0279('0x5'));var BPromise=require(_0x0279('0x6'));var Mustache=require(_0x0279('0x7'));var util=require(_0x0279('0x8'));var path=require(_0x0279('0x9'));var sox=require(_0x0279('0xa'));var csv=require(_0x0279('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0279('0xc'));var squel=require(_0x0279('0xd'));var crypto=require('crypto');var jsforce=require(_0x0279('0xe'));var deskjs=require(_0x0279('0xf'));var toCsv=require(_0x0279('0xb'));var querystring=require(_0x0279('0x10'));var Papa=require('papaparse');var Redis=require(_0x0279('0x11'));var authService=require(_0x0279('0x12'));var qs=require(_0x0279('0x13'));var as=require(_0x0279('0x14'));var hardwareService=require(_0x0279('0x15'));var logger=require(_0x0279('0x16'))(_0x0279('0x17'));var utils=require(_0x0279('0x18'));var config=require(_0x0279('0x19'));var licenseUtil=require(_0x0279('0x1a'));var db=require(_0x0279('0x1b'))['db'];function respondWithStatusCode(_0x395c00,_0x119d77){_0x119d77=_0x119d77||0xcc;return function(_0x25a4df){if(_0x25a4df){return _0x395c00[_0x0279('0x1c')](_0x119d77);}return _0x395c00[_0x0279('0x1d')](_0x119d77)[_0x0279('0x1e')]();};}function respondWithResult(_0x3c06c7,_0x66904c){_0x66904c=_0x66904c||0xc8;return function(_0x2e350c){if(_0x2e350c){return _0x3c06c7['status'](_0x66904c)[_0x0279('0x1f')](_0x2e350c);}};}function respondWithFilteredResult(_0x13e0c4,_0x31931d){return function(_0x5aed86){if(_0x5aed86){var _0xec9dd6=typeof _0x31931d[_0x0279('0x20')]===_0x0279('0x21')&&typeof _0x31931d['limit']==='undefined';var _0x48ea89=_0x5aed86[_0x0279('0x22')];var _0x459e92=_0xec9dd6?0x0:_0x31931d[_0x0279('0x20')];var _0x2041f1=_0xec9dd6?_0x5aed86[_0x0279('0x22')]:_0x31931d[_0x0279('0x20')]+_0x31931d[_0x0279('0x23')];var _0xc004e2;if(_0x2041f1>=_0x48ea89){_0x2041f1=_0x48ea89;_0xc004e2=0xc8;}else{_0xc004e2=0xce;}_0x13e0c4[_0x0279('0x1d')](_0xc004e2);return _0x13e0c4['set'](_0x0279('0x24'),_0x459e92+'-'+_0x2041f1+'/'+_0x48ea89)['json'](_0x5aed86);}return null;};}function patchUpdates(_0x510fdf){return function(_0x3fcbc4){try{jsonpatch[_0x0279('0x25')](_0x3fcbc4,_0x510fdf,!![]);}catch(_0x4dd70b){return BPromise[_0x0279('0x26')](_0x4dd70b);}return _0x3fcbc4['save']();};}function saveUpdates(_0x4efbd7,_0x14ef78){return function(_0xa48019){if(_0xa48019){return _0xa48019[_0x0279('0x27')](_0x4efbd7)[_0x0279('0x28')](function(_0x4b8f66){return _0x4b8f66;});}return null;};}function removeEntity(_0xe031,_0x1fdad3){return function(_0xb790f8){if(_0xb790f8){return _0xb790f8[_0x0279('0x29')]()[_0x0279('0x28')](function(){_0xe031[_0x0279('0x1d')](0xcc)[_0x0279('0x1e')]();});}};}function handleEntityNotFound(_0x577fba,_0x2024ea){return function(_0x2e1029){if(!_0x2e1029){_0x577fba[_0x0279('0x1c')](0x194);}return _0x2e1029;};}function handleError(_0x5d1f90,_0x1078e8){_0x1078e8=_0x1078e8||0x1f4;return function(_0x2147d8){logger[_0x0279('0x2a')](_0x2147d8[_0x0279('0x2b')]);if(_0x2147d8['name']){delete _0x2147d8[_0x0279('0x2c')];}_0x5d1f90['status'](_0x1078e8)['send'](_0x2147d8);};}exports['index']=function(_0x1d410d,_0x3a3c09){var _0x3a2ba4={},_0x1a0171={},_0x5ee38b={'count':0x0,'rows':[]};var _0x2da5a0=_['map'](db[_0x0279('0x2d')][_0x0279('0x2e')],function(_0x1820e8){return{'name':_0x1820e8[_0x0279('0x2f')],'type':_0x1820e8[_0x0279('0x30')][_0x0279('0x31')]};});_0x1a0171[_0x0279('0x32')]=_[_0x0279('0x33')](_0x2da5a0,_0x0279('0x2c'));_0x1a0171['query']=_[_0x0279('0x34')](_0x1d410d[_0x0279('0x35')]);_0x1a0171['filters']=_[_0x0279('0x36')](_0x1a0171[_0x0279('0x32')],_0x1a0171[_0x0279('0x35')]);_0x3a2ba4['attributes']=_[_0x0279('0x36')](_0x1a0171['model'],qs[_0x0279('0x37')](_0x1d410d[_0x0279('0x35')][_0x0279('0x37')]));_0x3a2ba4[_0x0279('0x38')]=_0x3a2ba4[_0x0279('0x38')][_0x0279('0x39')]?_0x3a2ba4[_0x0279('0x38')]:_0x1a0171[_0x0279('0x32')];if(!_0x1d410d[_0x0279('0x35')][_0x0279('0x3a')]('nolimit')){_0x3a2ba4[_0x0279('0x23')]=qs[_0x0279('0x23')](_0x1d410d[_0x0279('0x35')][_0x0279('0x23')]);_0x3a2ba4[_0x0279('0x20')]=qs[_0x0279('0x20')](_0x1d410d[_0x0279('0x35')]['offset']);}_0x3a2ba4['order']=qs[_0x0279('0x3b')](_0x1d410d['query'][_0x0279('0x3b')]);_0x3a2ba4[_0x0279('0x3c')]=qs[_0x0279('0x3d')](_[_0x0279('0x3e')](_0x1d410d[_0x0279('0x35')],_0x1a0171[_0x0279('0x3d')]),_0x2da5a0);if(_0x1d410d[_0x0279('0x35')]['filter']){_0x3a2ba4[_0x0279('0x3c')]=_[_0x0279('0x3f')](_0x3a2ba4[_0x0279('0x3c')],{'$or':_[_0x0279('0x33')](_0x2da5a0,function(_0x2ddbc9){if(_0x2ddbc9['type']!==_0x0279('0x40')){var _0x4ec917={};_0x4ec917[_0x2ddbc9[_0x0279('0x2c')]]={'$like':'%'+_0x1d410d[_0x0279('0x35')][_0x0279('0x41')]+'%'};return _0x4ec917;}})});}_0x3a2ba4=_[_0x0279('0x3f')]({},_0x3a2ba4,_0x1d410d[_0x0279('0x42')]);var _0x279e84={'where':_0x3a2ba4[_0x0279('0x3c')]};return db[_0x0279('0x2d')][_0x0279('0x22')](_0x279e84)[_0x0279('0x28')](function(_0x45d9a8){_0x5ee38b['count']=_0x45d9a8;if(_0x1d410d['query']['includeAll']){_0x3a2ba4[_0x0279('0x43')]=[{'all':!![]}];}return db[_0x0279('0x2d')]['findAll'](_0x3a2ba4);})[_0x0279('0x28')](function(_0x2be40d){_0x5ee38b['rows']=_0x2be40d;return _0x5ee38b;})[_0x0279('0x28')](respondWithFilteredResult(_0x3a3c09,_0x3a2ba4))[_0x0279('0x44')](handleError(_0x3a3c09,null));};exports['show']=function(_0x192bdf,_0x1d702d){var _0x3203b8={'raw':!![],'where':{'id':_0x192bdf[_0x0279('0x45')]['id']}},_0x276fe9={};_0x276fe9[_0x0279('0x32')]=_[_0x0279('0x34')](db[_0x0279('0x2d')][_0x0279('0x2e')]);_0x276fe9[_0x0279('0x35')]=_[_0x0279('0x34')](_0x192bdf[_0x0279('0x35')]);_0x276fe9['filters']=_[_0x0279('0x36')](_0x276fe9[_0x0279('0x32')],_0x276fe9[_0x0279('0x35')]);_0x3203b8[_0x0279('0x38')]=_['intersection'](_0x276fe9[_0x0279('0x32')],qs[_0x0279('0x37')](_0x192bdf[_0x0279('0x35')][_0x0279('0x37')]));_0x3203b8[_0x0279('0x38')]=_0x3203b8['attributes'][_0x0279('0x39')]?_0x3203b8[_0x0279('0x38')]:_0x276fe9[_0x0279('0x32')];if(_0x192bdf[_0x0279('0x35')][_0x0279('0x46')]){_0x3203b8['include']=[{'all':!![]}];}_0x3203b8=_['merge']({},_0x3203b8,_0x192bdf['options']);return db[_0x0279('0x2d')]['find'](_0x3203b8)['then'](handleEntityNotFound(_0x1d702d,null))[_0x0279('0x28')](respondWithResult(_0x1d702d,null))['catch'](handleError(_0x1d702d,null));};exports['create']=function(_0x1bf657,_0x45c28d){return db[_0x0279('0x2d')]['create'](_0x1bf657[_0x0279('0x47')],{})[_0x0279('0x28')](respondWithResult(_0x45c28d,0xc9))['catch'](handleError(_0x45c28d,null));};exports[_0x0279('0x27')]=function(_0x2c6a17,_0x2c5a48){if(_0x2c6a17[_0x0279('0x47')]['id']){delete _0x2c6a17[_0x0279('0x47')]['id'];}return db[_0x0279('0x2d')][_0x0279('0x48')]({'where':{'id':_0x2c6a17['params']['id']}})[_0x0279('0x28')](handleEntityNotFound(_0x2c5a48,null))[_0x0279('0x28')](saveUpdates(_0x2c6a17[_0x0279('0x47')],null))['then'](respondWithResult(_0x2c5a48,null))['catch'](handleError(_0x2c5a48,null));};exports[_0x0279('0x29')]=function(_0xf7bf8c,_0x59b47f){return db['SalesforceField'][_0x0279('0x48')]({'where':{'id':_0xf7bf8c[_0x0279('0x45')]['id']}})[_0x0279('0x28')](handleEntityNotFound(_0x59b47f,null))[_0x0279('0x28')](removeEntity(_0x59b47f,null))[_0x0279('0x44')](handleError(_0x59b47f,null));}; \ No newline at end of file +var _0xc76a=['reject','then','destroy','error','stack','name','send','SalesforceField','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','keys','rawAttributes','create','body','update','find','params','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','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','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0xc76a,0x6e));var _0xac76=function(_0x307cdd,_0x51463a){_0x307cdd=_0x307cdd-0x0;var _0x4477dc=_0xc76a[_0x307cdd];return _0x4477dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac76('0x0'));var zipdir=require(_0xac76('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac76('0x2'));var moment=require(_0xac76('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac76('0x4'));var util=require(_0xac76('0x5'));var path=require(_0xac76('0x6'));var sox=require(_0xac76('0x7'));var csv=require('to-csv');var ejs=require(_0xac76('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac76('0x9'));var squel=require(_0xac76('0xa'));var crypto=require('crypto');var jsforce=require(_0xac76('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xac76('0xc'));var querystring=require(_0xac76('0xd'));var Papa=require(_0xac76('0xe'));var Redis=require('ioredis');var authService=require(_0xac76('0xf'));var qs=require(_0xac76('0x10'));var as=require(_0xac76('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac76('0x12'))(_0xac76('0x13'));var utils=require('../../config/utils');var config=require(_0xac76('0x14'));var licenseUtil=require(_0xac76('0x15'));var db=require(_0xac76('0x16'))['db'];function respondWithStatusCode(_0x511263,_0x31d107){_0x31d107=_0x31d107||0xcc;return function(_0xc774e3){if(_0xc774e3){return _0x511263[_0xac76('0x17')](_0x31d107);}return _0x511263['status'](_0x31d107)[_0xac76('0x18')]();};}function respondWithResult(_0x268a1f,_0x180042){_0x180042=_0x180042||0xc8;return function(_0x178079){if(_0x178079){return _0x268a1f[_0xac76('0x19')](_0x180042)[_0xac76('0x1a')](_0x178079);}};}function respondWithFilteredResult(_0x5b335e,_0x2b0a79){return function(_0x4bf4ac){if(_0x4bf4ac){var _0x385737=typeof _0x2b0a79[_0xac76('0x1b')]==='undefined'&&typeof _0x2b0a79[_0xac76('0x1c')]===_0xac76('0x1d');var _0x3431f2=_0x4bf4ac[_0xac76('0x1e')];var _0x4b9627=_0x385737?0x0:_0x2b0a79[_0xac76('0x1b')];var _0x258f5a=_0x385737?_0x4bf4ac[_0xac76('0x1e')]:_0x2b0a79[_0xac76('0x1b')]+_0x2b0a79['limit'];var _0x3d7456;if(_0x258f5a>=_0x3431f2){_0x258f5a=_0x3431f2;_0x3d7456=0xc8;}else{_0x3d7456=0xce;}_0x5b335e[_0xac76('0x19')](_0x3d7456);return _0x5b335e[_0xac76('0x1f')](_0xac76('0x20'),_0x4b9627+'-'+_0x258f5a+'/'+_0x3431f2)['json'](_0x4bf4ac);}return null;};}function patchUpdates(_0x5e1c66){return function(_0x588974){try{jsonpatch[_0xac76('0x21')](_0x588974,_0x5e1c66,!![]);}catch(_0x172ba7){return BPromise[_0xac76('0x22')](_0x172ba7);}return _0x588974['save']();};}function saveUpdates(_0x44a7a0,_0x2ec106){return function(_0xd6cf7d){if(_0xd6cf7d){return _0xd6cf7d['update'](_0x44a7a0)[_0xac76('0x23')](function(_0x4416cb){return _0x4416cb;});}return null;};}function removeEntity(_0x25ab19,_0x439054){return function(_0x5adf2b){if(_0x5adf2b){return _0x5adf2b[_0xac76('0x24')]()[_0xac76('0x23')](function(){_0x25ab19['status'](0xcc)[_0xac76('0x18')]();});}};}function handleEntityNotFound(_0x2781b8,_0x4d2099){return function(_0x2972bd){if(!_0x2972bd){_0x2781b8[_0xac76('0x17')](0x194);}return _0x2972bd;};}function handleError(_0x11b5c1,_0x2da0d2){_0x2da0d2=_0x2da0d2||0x1f4;return function(_0x521405){logger[_0xac76('0x25')](_0x521405[_0xac76('0x26')]);if(_0x521405[_0xac76('0x27')]){delete _0x521405[_0xac76('0x27')];}_0x11b5c1[_0xac76('0x19')](_0x2da0d2)[_0xac76('0x28')](_0x521405);};}exports['index']=function(_0x505b50,_0x5bb01e){var _0x304ce7={},_0x1dd4a2={},_0x44005b={'count':0x0,'rows':[]};var _0xb7c2f7=_['map'](db[_0xac76('0x29')]['rawAttributes'],function(_0x1ea127){return{'name':_0x1ea127[_0xac76('0x2a')],'type':_0x1ea127[_0xac76('0x2b')]['key']};});_0x1dd4a2['model']=_[_0xac76('0x2c')](_0xb7c2f7,_0xac76('0x27'));_0x1dd4a2[_0xac76('0x2d')]=_['keys'](_0x505b50['query']);_0x1dd4a2[_0xac76('0x2e')]=_[_0xac76('0x2f')](_0x1dd4a2[_0xac76('0x30')],_0x1dd4a2[_0xac76('0x2d')]);_0x304ce7['attributes']=_[_0xac76('0x2f')](_0x1dd4a2[_0xac76('0x30')],qs['fields'](_0x505b50[_0xac76('0x2d')][_0xac76('0x31')]));_0x304ce7[_0xac76('0x32')]=_0x304ce7[_0xac76('0x32')][_0xac76('0x33')]?_0x304ce7['attributes']:_0x1dd4a2[_0xac76('0x30')];if(!_0x505b50[_0xac76('0x2d')][_0xac76('0x34')](_0xac76('0x35'))){_0x304ce7['limit']=qs[_0xac76('0x1c')](_0x505b50[_0xac76('0x2d')][_0xac76('0x1c')]);_0x304ce7[_0xac76('0x1b')]=qs[_0xac76('0x1b')](_0x505b50[_0xac76('0x2d')][_0xac76('0x1b')]);}_0x304ce7[_0xac76('0x36')]=qs['sort'](_0x505b50[_0xac76('0x2d')]['sort']);_0x304ce7['where']=qs[_0xac76('0x2e')](_[_0xac76('0x37')](_0x505b50['query'],_0x1dd4a2['filters']),_0xb7c2f7);if(_0x505b50[_0xac76('0x2d')]['filter']){_0x304ce7[_0xac76('0x38')]=_[_0xac76('0x39')](_0x304ce7[_0xac76('0x38')],{'$or':_[_0xac76('0x2c')](_0xb7c2f7,function(_0x3be25f){if(_0x3be25f[_0xac76('0x2b')]!==_0xac76('0x3a')){var _0x5db31d={};_0x5db31d[_0x3be25f['name']]={'$like':'%'+_0x505b50[_0xac76('0x2d')][_0xac76('0x3b')]+'%'};return _0x5db31d;}})});}_0x304ce7=_[_0xac76('0x39')]({},_0x304ce7,_0x505b50[_0xac76('0x3c')]);var _0x494da8={'where':_0x304ce7[_0xac76('0x38')]};return db['SalesforceField'][_0xac76('0x1e')](_0x494da8)[_0xac76('0x23')](function(_0x52741e){_0x44005b[_0xac76('0x1e')]=_0x52741e;if(_0x505b50['query'][_0xac76('0x3d')]){_0x304ce7[_0xac76('0x3e')]=[{'all':!![]}];}return db[_0xac76('0x29')]['findAll'](_0x304ce7);})[_0xac76('0x23')](function(_0x4c8df1){_0x44005b['rows']=_0x4c8df1;return _0x44005b;})[_0xac76('0x23')](respondWithFilteredResult(_0x5bb01e,_0x304ce7))[_0xac76('0x3f')](handleError(_0x5bb01e,null));};exports[_0xac76('0x40')]=function(_0x28d3fb,_0x4f3f69){var _0x44c7f0={'raw':!![],'where':{'id':_0x28d3fb['params']['id']}},_0x3290bd={};_0x3290bd[_0xac76('0x30')]=_[_0xac76('0x41')](db['SalesforceField'][_0xac76('0x42')]);_0x3290bd[_0xac76('0x2d')]=_[_0xac76('0x41')](_0x28d3fb[_0xac76('0x2d')]);_0x3290bd[_0xac76('0x2e')]=_[_0xac76('0x2f')](_0x3290bd[_0xac76('0x30')],_0x3290bd[_0xac76('0x2d')]);_0x44c7f0[_0xac76('0x32')]=_[_0xac76('0x2f')](_0x3290bd[_0xac76('0x30')],qs[_0xac76('0x31')](_0x28d3fb['query'][_0xac76('0x31')]));_0x44c7f0[_0xac76('0x32')]=_0x44c7f0['attributes'][_0xac76('0x33')]?_0x44c7f0[_0xac76('0x32')]:_0x3290bd[_0xac76('0x30')];if(_0x28d3fb[_0xac76('0x2d')][_0xac76('0x3d')]){_0x44c7f0['include']=[{'all':!![]}];}_0x44c7f0=_[_0xac76('0x39')]({},_0x44c7f0,_0x28d3fb[_0xac76('0x3c')]);return db['SalesforceField']['find'](_0x44c7f0)[_0xac76('0x23')](handleEntityNotFound(_0x4f3f69,null))[_0xac76('0x23')](respondWithResult(_0x4f3f69,null))[_0xac76('0x3f')](handleError(_0x4f3f69,null));};exports[_0xac76('0x43')]=function(_0x5e728b,_0x12679f){return db[_0xac76('0x29')]['create'](_0x5e728b[_0xac76('0x44')],{})[_0xac76('0x23')](respondWithResult(_0x12679f,0xc9))['catch'](handleError(_0x12679f,null));};exports[_0xac76('0x45')]=function(_0xb29d19,_0x4806bf){if(_0xb29d19[_0xac76('0x44')]['id']){delete _0xb29d19['body']['id'];}return db['SalesforceField'][_0xac76('0x46')]({'where':{'id':_0xb29d19[_0xac76('0x47')]['id']}})[_0xac76('0x23')](handleEntityNotFound(_0x4806bf,null))[_0xac76('0x23')](saveUpdates(_0xb29d19['body'],null))[_0xac76('0x23')](respondWithResult(_0x4806bf,null))[_0xac76('0x3f')](handleError(_0x4806bf,null));};exports[_0xac76('0x24')]=function(_0x44b1cd,_0x4371f7){return db[_0xac76('0x29')][_0xac76('0x46')]({'where':{'id':_0x44b1cd[_0xac76('0x47')]['id']}})['then'](handleEntityNotFound(_0x4371f7,null))['then'](removeEntity(_0x4371f7,null))[_0xac76('0x3f')](handleError(_0x4371f7,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0082dbf..4c2b4f7 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 _0x4d39=['../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2d667c,_0x17ab73){var _0x4fbcc6=function(_0x203943){while(--_0x203943){_0x2d667c['push'](_0x2d667c['shift']());}};_0x4fbcc6(++_0x17ab73);}(_0x4d39,0xb8));var _0x94d3=function(_0x108bc6,_0x584d4d){_0x108bc6=_0x108bc6-0x0;var _0x299ddf=_0x4d39[_0x108bc6];return _0x299ddf;};'use strict';var _=require(_0x94d3('0x0'));var util=require(_0x94d3('0x1'));var logger=require(_0x94d3('0x2'))(_0x94d3('0x3'));var moment=require('moment');var BPromise=require(_0x94d3('0x4'));var rp=require(_0x94d3('0x5'));var fs=require('fs');var path=require(_0x94d3('0x6'));var rimraf=require(_0x94d3('0x7'));var config=require(_0x94d3('0x8'));var attributes=require(_0x94d3('0x9'));module[_0x94d3('0xa')]=function(_0x389109,_0x2a9079){return _0x389109['define'](_0x94d3('0xb'),attributes,{'tableName':_0x94d3('0xc'),'paranoid':![],'indexes':[{'name':_0x94d3('0xd'),'fields':[_0x94d3('0xe'),_0x94d3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0866=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','FieldId','lodash'];(function(_0x4dd9c2,_0x1066b4){var _0x5048a2=function(_0x237598){while(--_0x237598){_0x4dd9c2['push'](_0x4dd9c2['shift']());}};_0x5048a2(++_0x1066b4);}(_0x0866,0x8f));var _0x6086=function(_0x482303,_0x3c4bd1){_0x482303=_0x482303-0x0;var _0x28ed7c=_0x0866[_0x482303];return _0x28ed7c;};'use strict';var _=require(_0x6086('0x0'));var util=require(_0x6086('0x1'));var logger=require(_0x6086('0x2'))(_0x6086('0x3'));var moment=require('moment');var BPromise=require(_0x6086('0x4'));var rp=require(_0x6086('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6086('0x6'));var config=require(_0x6086('0x7'));var attributes=require(_0x6086('0x8'));module['exports']=function(_0x17d810,_0x28d552){return _0x17d810['define'](_0x6086('0x9'),attributes,{'tableName':_0x6086('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x6086('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 17f58f6..f06090e 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 _0xb958=['SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5af048,_0x4afc3b){var _0x278664=function(_0x1e1692){while(--_0x1e1692){_0x5af048['push'](_0x5af048['shift']());}};_0x278664(++_0x4afc3b);}(_0xb958,0x1aa));var _0x8b95=function(_0x37fcda,_0x2f5aa1){_0x37fcda=_0x37fcda-0x0;var _0xf5ed91=_0xb958[_0x37fcda];return _0xf5ed91;};'use strict';var _=require(_0x8b95('0x0'));var util=require(_0x8b95('0x1'));var moment=require(_0x8b95('0x2'));var BPromise=require(_0x8b95('0x3'));var rs=require(_0x8b95('0x4'));var fs=require('fs');var Redis=require(_0x8b95('0x5'));var db=require(_0x8b95('0x6'))['db'];var utils=require(_0x8b95('0x7'));var logger=require(_0x8b95('0x8'))('rpc');var config=require(_0x8b95('0x9'));var jayson=require(_0x8b95('0xa'));var client=jayson[_0x8b95('0xb')][_0x8b95('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cb90c,_0x7e6cca,_0x46fc2d){return new BPromise(function(_0x5c2322,_0xbcee29){return client[_0x8b95('0xd')](_0x5cb90c,_0x46fc2d)[_0x8b95('0xe')](function(_0x584ad5){logger[_0x8b95('0xf')](_0x8b95('0x10'),_0x7e6cca,'request\x20sent');logger[_0x8b95('0x11')](_0x8b95('0x12'),_0x7e6cca,_0x8b95('0x13'),JSON[_0x8b95('0x14')](_0x584ad5));if(_0x584ad5[_0x8b95('0x15')]){if(_0x584ad5['error'][_0x8b95('0x16')]===0x1f4){logger[_0x8b95('0x15')](_0x8b95('0x10'),_0x7e6cca,_0x584ad5['error'][_0x8b95('0x17')]);return _0xbcee29(_0x584ad5[_0x8b95('0x15')][_0x8b95('0x17')]);}logger[_0x8b95('0x15')](_0x8b95('0x10'),_0x7e6cca,_0x584ad5[_0x8b95('0x15')]['message']);return _0x5c2322(_0x584ad5[_0x8b95('0x15')][_0x8b95('0x17')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x7e6cca,'request\x20sent');_0x5c2322(_0x584ad5[_0x8b95('0x18')]['message']);}})[_0x8b95('0x19')](function(_0x23da98){logger[_0x8b95('0x15')]('SalesforceField,\x20%s,\x20%s',_0x7e6cca,_0x23da98);_0xbcee29(_0x23da98);});});} \ No newline at end of file +var _0xa32e=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../config/logger','rpc'];(function(_0x1270c6,_0x920f24){var _0x4910df=function(_0x2e32b4){while(--_0x2e32b4){_0x1270c6['push'](_0x1270c6['shift']());}};_0x4910df(++_0x920f24);}(_0xa32e,0x1b2));var _0xea32=function(_0x3a6077,_0x3270d8){_0x3a6077=_0x3a6077-0x0;var _0x40b429=_0xa32e[_0x3a6077];return _0x40b429;};'use strict';var _=require(_0xea32('0x0'));var util=require(_0xea32('0x1'));var moment=require(_0xea32('0x2'));var BPromise=require(_0xea32('0x3'));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(_0xea32('0x4'))(_0xea32('0x5'));var config=require(_0xea32('0x6'));var jayson=require(_0xea32('0x7'));var client=jayson[_0xea32('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11d4b1,_0x1fe732,_0x6cee32){return new BPromise(function(_0x359c15,_0x3d8d38){return client[_0xea32('0x9')](_0x11d4b1,_0x6cee32)[_0xea32('0xa')](function(_0x198196){logger[_0xea32('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1fe732,_0xea32('0xc'));logger[_0xea32('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1fe732,_0xea32('0xc'),JSON[_0xea32('0xe')](_0x198196));if(_0x198196[_0xea32('0xf')]){if(_0x198196[_0xea32('0xf')]['code']===0x1f4){logger[_0xea32('0xf')](_0xea32('0x10'),_0x1fe732,_0x198196[_0xea32('0xf')][_0xea32('0x11')]);return _0x3d8d38(_0x198196[_0xea32('0xf')][_0xea32('0x11')]);}logger[_0xea32('0xf')]('SalesforceField,\x20%s,\x20%s',_0x1fe732,_0x198196[_0xea32('0xf')][_0xea32('0x11')]);return _0x359c15(_0x198196[_0xea32('0xf')][_0xea32('0x11')]);}else{logger[_0xea32('0xb')](_0xea32('0x10'),_0x1fe732,_0xea32('0xc'));_0x359c15(_0x198196[_0xea32('0x12')]['message']);}})[_0xea32('0x13')](function(_0x97466){logger[_0xea32('0xf')](_0xea32('0x10'),_0x1fe732,_0x97466);_0x3d8d38(_0x97466);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f0fda36..f9a66b2 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 _0x11dd=['post','addConfiguration','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x38accc,_0x2f419f){var _0x485e11=function(_0x2c3777){while(--_0x2c3777){_0x38accc['push'](_0x38accc['shift']());}};_0x485e11(++_0x2f419f);}(_0x11dd,0xe1));var _0xd11d=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x11dd[_0x37a79c];return _0x561d89;};'use strict';var multer=require(_0xd11d('0x0'));var util=require('util');var path=require(_0xd11d('0x1'));var timeout=require(_0xd11d('0x2'));var express=require(_0xd11d('0x3'));var router=express[_0xd11d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd11d('0x5'));var interaction=require(_0xd11d('0x6'));var config=require(_0xd11d('0x7'));var controller=require(_0xd11d('0x8'));router[_0xd11d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd11d('0xa'),auth[_0xd11d('0xb')](),controller[_0xd11d('0xc')]);router[_0xd11d('0x9')](_0xd11d('0xd'),auth[_0xd11d('0xb')](),controller[_0xd11d('0xe')]);router[_0xd11d('0x9')](_0xd11d('0xf'),auth[_0xd11d('0xb')](),controller[_0xd11d('0x10')]);router[_0xd11d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd11d('0x11')](_0xd11d('0xd'),auth[_0xd11d('0xb')](),controller[_0xd11d('0x12')]);router[_0xd11d('0x13')](_0xd11d('0xa'),auth[_0xd11d('0xb')](),controller['update']);router[_0xd11d('0x14')](_0xd11d('0xa'),auth[_0xd11d('0xb')](),controller[_0xd11d('0x15')]);module['exports']=router; \ No newline at end of file +var _0x151a=['../../components/auth/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x151a,0x12f));var _0xa151=function(_0x4d8f6f,_0x559720){_0x4d8f6f=_0x4d8f6f-0x0;var _0x441c71=_0x151a[_0x4d8f6f];return _0x441c71;};'use strict';var multer=require(_0xa151('0x0'));var util=require(_0xa151('0x1'));var path=require(_0xa151('0x2'));var timeout=require(_0xa151('0x3'));var express=require('express');var router=express[_0xa151('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa151('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa151('0x6'));var controller=require(_0xa151('0x7'));router['get']('/',auth[_0xa151('0x8')](),controller['index']);router[_0xa151('0x9')](_0xa151('0xa'),auth[_0xa151('0x8')](),controller[_0xa151('0xb')]);router[_0xa151('0x9')]('/:id/configurations',auth[_0xa151('0x8')](),controller[_0xa151('0xc')]);router[_0xa151('0x9')](_0xa151('0xd'),auth[_0xa151('0x8')](),controller[_0xa151('0xe')]);router[_0xa151('0xf')]('/',auth[_0xa151('0x8')](),controller[_0xa151('0x10')]);router[_0xa151('0xf')]('/:id/configurations',auth[_0xa151('0x8')](),controller[_0xa151('0x11')]);router[_0xa151('0x12')]('/:id',auth[_0xa151('0x8')](),controller['update']);router[_0xa151('0x13')](_0xa151('0xa'),auth[_0xa151('0x8')](),controller[_0xa151('0x14')]);module[_0xa151('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d588bbf..b35c9ef 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 _0xd526=['STRING','username','remoteUri','sequelize','exports'];(function(_0x1ef10f,_0x7c60e0){var _0x27700f=function(_0x50842f){while(--_0x50842f){_0x1ef10f['push'](_0x1ef10f['shift']());}};_0x27700f(++_0x7c60e0);}(_0xd526,0xc1));var _0x6d52=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd526[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x6d52('0x0'));module[_0x6d52('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d52('0x2')]},'username':{'type':Sequelize[_0x6d52('0x2')],'unique':_0x6d52('0x3')},'password':{'type':Sequelize[_0x6d52('0x2')]},'email':{'type':Sequelize[_0x6d52('0x2')]},'remoteUri':{'type':Sequelize[_0x6d52('0x2')],'unique':_0x6d52('0x4')},'serverUrl':{'type':Sequelize[_0x6d52('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb610=['STRING','username','remoteUri','sequelize','exports'];(function(_0x11f075,_0x36efc6){var _0x64bb64=function(_0x17627c){while(--_0x17627c){_0x11f075['push'](_0x11f075['shift']());}};_0x64bb64(++_0x36efc6);}(_0xb610,0x9e));var _0x0b61=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb610[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x0b61('0x0'));module[_0x0b61('0x1')]={'name':{'type':Sequelize[_0x0b61('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0b61('0x3')},'password':{'type':Sequelize[_0x0b61('0x2')]},'email':{'type':Sequelize[_0x0b61('0x2')]},'remoteUri':{'type':Sequelize[_0x0b61('0x2')],'unique':_0x0b61('0x4')},'serverUrl':{'type':Sequelize[_0x0b61('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1fee4c7..4e6abc0 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 _0xb068=['knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','calendar_stc','closed_at','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','category','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/table/','username','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','stack','test','Wrong\x20credentials','statusCode','boolean','True','False','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','fields','includeAll','options','find','create','body','findOne','ServicenowConfiguration','sort','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xb068,0x1c8));var _0x8b06=function(_0x408e9a,_0x2b8004){_0x408e9a=_0x408e9a-0x0;var _0x4512d4=_0xb068[_0x408e9a];return _0x4512d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b06('0x0'));var zipdir=require(_0x8b06('0x1'));var jsonpatch=require(_0x8b06('0x2'));var rp=require('request-promise');var moment=require(_0x8b06('0x3'));var BPromise=require(_0x8b06('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8b06('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8b06('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b06('0x7'));var squel=require(_0x8b06('0x8'));var crypto=require(_0x8b06('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8b06('0xa'));var toCsv=require(_0x8b06('0xb'));var querystring=require(_0x8b06('0xc'));var Papa=require(_0x8b06('0xd'));var Redis=require(_0x8b06('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8b06('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b06('0x10'));var logger=require('../../config/logger')(_0x8b06('0x11'));var utils=require('../../config/utils');var config=require(_0x8b06('0x12'));var licenseUtil=require(_0x8b06('0x13'));var db=require(_0x8b06('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1605f0,_0x61e68){_0x61e68=_0x61e68||0xcc;return function(_0x8ab2ee){if(_0x8ab2ee){return _0x1605f0[_0x8b06('0x15')](_0x61e68);}return _0x1605f0[_0x8b06('0x16')](_0x61e68)[_0x8b06('0x17')]();};}function respondWithResult(_0x13bdbb,_0x17f12c){_0x17f12c=_0x17f12c||0xc8;return function(_0x532331){if(_0x532331){return _0x13bdbb[_0x8b06('0x16')](_0x17f12c)[_0x8b06('0x18')](_0x532331);}};}function respondWithFilteredResult(_0x24cfe5,_0x5d34e7){return function(_0x5b67a8){if(_0x5b67a8){var _0x1154ee=typeof _0x5d34e7[_0x8b06('0x19')]===_0x8b06('0x1a')&&typeof _0x5d34e7['limit']===_0x8b06('0x1a');var _0x5b18b9=_0x5b67a8['count'];var _0x12c131=_0x1154ee?0x0:_0x5d34e7[_0x8b06('0x19')];var _0x3781a6=_0x1154ee?_0x5b67a8[_0x8b06('0x1b')]:_0x5d34e7['offset']+_0x5d34e7['limit'];var _0x138ecf;if(_0x3781a6>=_0x5b18b9){_0x3781a6=_0x5b18b9;_0x138ecf=0xc8;}else{_0x138ecf=0xce;}_0x24cfe5['status'](_0x138ecf);return _0x24cfe5[_0x8b06('0x1c')](_0x8b06('0x1d'),_0x12c131+'-'+_0x3781a6+'/'+_0x5b18b9)[_0x8b06('0x18')](_0x5b67a8);}return null;};}function patchUpdates(_0x54a6b4){return function(_0x38c6e1){try{jsonpatch[_0x8b06('0x1e')](_0x38c6e1,_0x54a6b4,!![]);}catch(_0x1d8af3){return BPromise[_0x8b06('0x1f')](_0x1d8af3);}return _0x38c6e1['save']();};}function saveUpdates(_0x2ff684,_0x198695){return function(_0x3b8cbc){if(_0x3b8cbc){return _0x3b8cbc[_0x8b06('0x20')](_0x2ff684)[_0x8b06('0x21')](function(_0x4b5185){return _0x4b5185;});}return null;};}function removeEntity(_0x4a2053,_0x4fafb6){return function(_0x4ec229){if(_0x4ec229){return _0x4ec229[_0x8b06('0x22')]()[_0x8b06('0x21')](function(){_0x4a2053[_0x8b06('0x16')](0xcc)[_0x8b06('0x17')]();});}};}function handleEntityNotFound(_0x5a3002,_0x3eae93){return function(_0x182945){if(!_0x182945){_0x5a3002[_0x8b06('0x15')](0x194);}return _0x182945;};}function handleError(_0x58e4db,_0x519835){_0x519835=_0x519835||0x1f4;return function(_0x302fdd){logger[_0x8b06('0x23')](_0x302fdd['stack']);if(_0x302fdd[_0x8b06('0x24')]){delete _0x302fdd['name'];}_0x58e4db[_0x8b06('0x16')](_0x519835)['send'](_0x302fdd);};}exports[_0x8b06('0x25')]=function(_0xd064fa,_0x1a72e1){var _0x277fb7={},_0xa40238={},_0x40023c={'count':0x0,'rows':[]};var _0x224e4d=_[_0x8b06('0x26')](db[_0x8b06('0x27')][_0x8b06('0x28')],function(_0xcb4790){return{'name':_0xcb4790[_0x8b06('0x29')],'type':_0xcb4790[_0x8b06('0x2a')]['key']};});_0xa40238[_0x8b06('0x2b')]=_[_0x8b06('0x26')](_0x224e4d,_0x8b06('0x24'));_0xa40238[_0x8b06('0x2c')]=_[_0x8b06('0x2d')](_0xd064fa['query']);_0xa40238[_0x8b06('0x2e')]=_[_0x8b06('0x2f')](_0xa40238[_0x8b06('0x2b')],_0xa40238[_0x8b06('0x2c')]);_0x277fb7[_0x8b06('0x30')]=_[_0x8b06('0x2f')](_0xa40238[_0x8b06('0x2b')],qs['fields'](_0xd064fa[_0x8b06('0x2c')]['fields']));_0x277fb7[_0x8b06('0x30')]=_0x277fb7[_0x8b06('0x30')][_0x8b06('0x31')]?_0x277fb7[_0x8b06('0x30')]:_0xa40238[_0x8b06('0x2b')];if(!_0xd064fa['query']['hasOwnProperty'](_0x8b06('0x32'))){_0x277fb7[_0x8b06('0x33')]=qs[_0x8b06('0x33')](_0xd064fa[_0x8b06('0x2c')][_0x8b06('0x33')]);_0x277fb7[_0x8b06('0x19')]=qs[_0x8b06('0x19')](_0xd064fa['query']['offset']);}_0x277fb7[_0x8b06('0x34')]=qs['sort'](_0xd064fa[_0x8b06('0x2c')]['sort']);_0x277fb7[_0x8b06('0x35')]=qs[_0x8b06('0x2e')](_[_0x8b06('0x36')](_0xd064fa[_0x8b06('0x2c')],_0xa40238['filters']),_0x224e4d);if(_0xd064fa[_0x8b06('0x2c')][_0x8b06('0x37')]){_0x277fb7[_0x8b06('0x35')]=_[_0x8b06('0x38')](_0x277fb7[_0x8b06('0x35')],{'$or':_[_0x8b06('0x26')](_0x224e4d,function(_0x32739d){if(_0x32739d['type']!==_0x8b06('0x39')){var _0x24e782={};_0x24e782[_0x32739d[_0x8b06('0x24')]]={'$like':'%'+_0xd064fa[_0x8b06('0x2c')][_0x8b06('0x37')]+'%'};return _0x24e782;}})});}_0x277fb7=_[_0x8b06('0x38')]({},_0x277fb7,_0xd064fa['options']);var _0x523481={'where':_0x277fb7[_0x8b06('0x35')]};return db[_0x8b06('0x27')]['count'](_0x523481)[_0x8b06('0x21')](function(_0x433c2e){_0x40023c[_0x8b06('0x1b')]=_0x433c2e;if(_0xd064fa[_0x8b06('0x2c')]['includeAll']){_0x277fb7[_0x8b06('0x3a')]=[{'all':!![]}];}return db[_0x8b06('0x27')][_0x8b06('0x3b')](_0x277fb7);})[_0x8b06('0x21')](function(_0x551842){_0x40023c[_0x8b06('0x3c')]=_0x551842;return _0x40023c;})['then'](respondWithFilteredResult(_0x1a72e1,_0x277fb7))[_0x8b06('0x3d')](handleError(_0x1a72e1,null));};exports[_0x8b06('0x3e')]=function(_0x1558a0,_0x41df1d){var _0x27c3da={'raw':![],'where':{'id':_0x1558a0[_0x8b06('0x3f')]['id']}},_0x261698={};_0x261698['model']=_['keys'](db[_0x8b06('0x27')][_0x8b06('0x28')]);_0x261698[_0x8b06('0x2c')]=_['keys'](_0x1558a0[_0x8b06('0x2c')]);_0x261698[_0x8b06('0x2e')]=_[_0x8b06('0x2f')](_0x261698[_0x8b06('0x2b')],_0x261698[_0x8b06('0x2c')]);_0x27c3da[_0x8b06('0x30')]=_[_0x8b06('0x2f')](_0x261698[_0x8b06('0x2b')],qs[_0x8b06('0x40')](_0x1558a0['query']['fields']));_0x27c3da['attributes']=_0x27c3da[_0x8b06('0x30')][_0x8b06('0x31')]?_0x27c3da[_0x8b06('0x30')]:_0x261698['model'];if(_0x1558a0['query'][_0x8b06('0x41')]){_0x27c3da[_0x8b06('0x3a')]=[{'all':!![]}];}_0x27c3da=_[_0x8b06('0x38')]({},_0x27c3da,_0x1558a0[_0x8b06('0x42')]);return db[_0x8b06('0x27')][_0x8b06('0x43')](_0x27c3da)['then'](handleEntityNotFound(_0x41df1d,null))[_0x8b06('0x21')](respondWithResult(_0x41df1d,null))[_0x8b06('0x3d')](handleError(_0x41df1d,null));};exports['create']=function(_0x1f6896,_0x10b465){return db['ServicenowAccount'][_0x8b06('0x44')](_0x1f6896[_0x8b06('0x45')],{})[_0x8b06('0x21')](respondWithResult(_0x10b465,0xc9))['catch'](handleError(_0x10b465,null));};exports[_0x8b06('0x20')]=function(_0x3dd71d,_0x454391){if(_0x3dd71d[_0x8b06('0x45')]['id']){delete _0x3dd71d[_0x8b06('0x45')]['id'];}return db['ServicenowAccount'][_0x8b06('0x43')]({'where':{'id':_0x3dd71d[_0x8b06('0x3f')]['id']}})[_0x8b06('0x21')](handleEntityNotFound(_0x454391,null))[_0x8b06('0x21')](saveUpdates(_0x3dd71d['body'],null))['then'](respondWithResult(_0x454391,null))[_0x8b06('0x3d')](handleError(_0x454391,null));};exports[_0x8b06('0x22')]=function(_0x1a55d3,_0x2116c7){return db[_0x8b06('0x27')][_0x8b06('0x43')]({'where':{'id':_0x1a55d3[_0x8b06('0x3f')]['id']}})[_0x8b06('0x21')](handleEntityNotFound(_0x2116c7,null))['then'](removeEntity(_0x2116c7,null))[_0x8b06('0x3d')](handleError(_0x2116c7,null));};exports['getConfigurations']=function(_0x54575d,_0x1571bb,_0x3a093b){var _0x54d60c={};var _0x3d2de6={};var _0x4086f4;var _0x21a188;return db[_0x8b06('0x27')][_0x8b06('0x46')]({'where':{'id':_0x54575d['params']['id']}})[_0x8b06('0x21')](handleEntityNotFound(_0x1571bb,null))['then'](function(_0x3ec9ec){if(_0x3ec9ec){_0x4086f4=_0x3ec9ec;_0x3d2de6[_0x8b06('0x2b')]=_[_0x8b06('0x2d')](db[_0x8b06('0x47')][_0x8b06('0x28')]);_0x3d2de6['query']=_['keys'](_0x54575d['query']);_0x3d2de6[_0x8b06('0x2e')]=_['intersection'](_0x3d2de6['model'],_0x3d2de6[_0x8b06('0x2c')]);_0x54d60c['attributes']=_[_0x8b06('0x2f')](_0x3d2de6[_0x8b06('0x2b')],qs[_0x8b06('0x40')](_0x54575d[_0x8b06('0x2c')]['fields']));_0x54d60c['attributes']=_0x54d60c[_0x8b06('0x30')][_0x8b06('0x31')]?_0x54d60c[_0x8b06('0x30')]:_0x3d2de6[_0x8b06('0x2b')];_0x54d60c[_0x8b06('0x34')]=qs[_0x8b06('0x48')](_0x54575d[_0x8b06('0x2c')][_0x8b06('0x48')]);_0x54d60c[_0x8b06('0x35')]=qs[_0x8b06('0x2e')](_[_0x8b06('0x36')](_0x54575d[_0x8b06('0x2c')],_0x3d2de6[_0x8b06('0x2e')]));if(_0x54575d[_0x8b06('0x2c')][_0x8b06('0x37')]){_0x54d60c['where']=_[_0x8b06('0x38')](_0x54d60c[_0x8b06('0x35')],{'$or':_[_0x8b06('0x26')](_0x54d60c['attributes'],function(_0x4b43d9){var _0xc16005={};_0xc16005[_0x4b43d9]={'$like':'%'+_0x54575d[_0x8b06('0x2c')][_0x8b06('0x37')]+'%'};return _0xc16005;})});}_0x54d60c=_[_0x8b06('0x38')]({},_0x54d60c,_0x54575d['options']);return _0x4086f4[_0x8b06('0x49')](_0x54d60c);}})[_0x8b06('0x21')](function(_0x1dc739){if(_0x1dc739){_0x21a188=_0x1dc739[_0x8b06('0x31')];if(!_0x54575d[_0x8b06('0x2c')][_0x8b06('0x4a')]('nolimit')){_0x54d60c[_0x8b06('0x33')]=qs[_0x8b06('0x33')](_0x54575d[_0x8b06('0x2c')][_0x8b06('0x33')]);_0x54d60c['offset']=qs['offset'](_0x54575d['query'][_0x8b06('0x19')]);}return _0x4086f4[_0x8b06('0x49')](_0x54d60c);}})['then'](function(_0x4815d5){if(_0x4815d5){return _0x4815d5?{'count':_0x21a188,'rows':_0x4815d5}:null;}})[_0x8b06('0x21')](respondWithResult(_0x1571bb,null))['catch'](handleError(_0x1571bb,null));};exports[_0x8b06('0x4b')]=function(_0x3d2571,_0x3e6009,_0x563ee6){if(_0x3d2571[_0x8b06('0x45')]['id']){delete _0x3d2571[_0x8b06('0x45')]['id'];}return db[_0x8b06('0x27')][_0x8b06('0x46')]({'where':{'id':_0x3d2571[_0x8b06('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3e6009,null))[_0x8b06('0x21')](function(_0x39b600){if(_0x39b600){_0x3d2571['body'][_0x8b06('0x4c')]=_0x39b600['id'];_0x3d2571[_0x8b06('0x45')][_0x8b06('0x4d')]=integrations['getSubjects'](_0x3d2571[_0x8b06('0x45')]['channel'],_0x3d2571[_0x8b06('0x45')][_0x8b06('0x2a')]);_0x3d2571['body'][_0x8b06('0x4e')]=integrations[_0x8b06('0x4f')](_0x3d2571[_0x8b06('0x45')]['channel'],_0x3d2571[_0x8b06('0x45')][_0x8b06('0x2a')]);return db['ServicenowConfiguration']['create'](_0x3d2571[_0x8b06('0x45')],{'include':[{'model':db[_0x8b06('0x50')],'as':'Subjects'},{'model':db[_0x8b06('0x50')],'as':_0x8b06('0x4e')}]});}return null;})[_0x8b06('0x21')](respondWithResult(_0x3e6009,null))[_0x8b06('0x3d')](handleError(_0x3e6009,null));};exports[_0x8b06('0x51')]=function(_0x373142,_0x206f5c,_0x19f30f){var _0x15a9de=[_0x8b06('0x52'),_0x8b06('0x53'),_0x8b06('0x54'),_0x8b06('0x55'),_0x8b06('0x56'),_0x8b06('0x57'),_0x8b06('0x58'),_0x8b06('0x59'),'category'];var _0x5108e4=[_0x8b06('0x5a'),'made_sla',_0x8b06('0x5b'),_0x8b06('0x5c'),_0x8b06('0x5d'),_0x8b06('0x5e'),'child_incidents',_0x8b06('0x53'),_0x8b06('0x5f'),'number',_0x8b06('0x60'),_0x8b06('0x61'),_0x8b06('0x62'),_0x8b06('0x63'),_0x8b06('0x64'),_0x8b06('0x65'),'state','sys_created_by','knowledge',_0x8b06('0x34'),_0x8b06('0x66'),_0x8b06('0x67'),'cmdb_ci','delivery_plan',_0x8b06('0x68'),_0x8b06('0x69'),'work_notes_list',_0x8b06('0x6a'),_0x8b06('0x6b'),_0x8b06('0x6c'),_0x8b06('0x6d'),_0x8b06('0x6e'),'expected_start',_0x8b06('0x6f'),_0x8b06('0x70'),'group_list',_0x8b06('0x71'),_0x8b06('0x72'),'resolved_at',_0x8b06('0x73'),_0x8b06('0x74'),_0x8b06('0x55'),_0x8b06('0x75'),_0x8b06('0x76'),'close_code','correlation_display',_0x8b06('0x77'),'work_start',_0x8b06('0x78'),_0x8b06('0x79'),_0x8b06('0x7a'),_0x8b06('0x7b'),'calendar_duration',_0x8b06('0x57'),_0x8b06('0x7c'),_0x8b06('0x7d'),_0x8b06('0x7e'),_0x8b06('0x7f'),'parent_incident',_0x8b06('0x80'),_0x8b06('0x81'),_0x8b06('0x82'),'incident_state',_0x8b06('0x83'),_0x8b06('0x84'),_0x8b06('0x85'),_0x8b06('0x86'),'activity_due','assigned_to',_0x8b06('0x59'),_0x8b06('0x87'),_0x8b06('0x88'),_0x8b06('0x89'),'comments_and_work_notes',_0x8b06('0x8a'),_0x8b06('0x8b'),_0x8b06('0x8c'),_0x8b06('0x8d'),_0x8b06('0x8e'),'upon_approval',_0x8b06('0x8f'),_0x8b06('0x90'),_0x8b06('0x91')];var _0xdf26a0='';var _0xf13dce='';var _0x203779=[];var _0x4efc00='';var _0x4527b0='';var _0x2d4fb7=[];var _0x37f36d='';var _0x3c5be5='';var _0x36deb8={};var _0x2d8c7e='';return db[_0x8b06('0x27')][_0x8b06('0x46')]({'where':{'id':_0x373142['params']['id']},'attributes':['id','username',_0x8b06('0x92'),_0x8b06('0x93'),_0x8b06('0x94'),_0x8b06('0x95')]})[_0x8b06('0x21')](handleEntityNotFound(_0x206f5c,null))[_0x8b06('0x21')](function(_0x55e956){if(_0x55e956){_0x2d8c7e=_0x55e956['remoteUri'];var _0x13cac3=_0x2d8c7e[_0x8b06('0x96')](-0x1);if(_0x13cac3==='/'){_0x2d8c7e=_0x2d8c7e[_0x8b06('0x97')](0x0,_0x2d8c7e['lastIndexOf'](_0x13cac3));}_0x3c5be5=util[_0x8b06('0x98')]('%s/api/now/doc/table/schema/',_0x2d8c7e);_0x37f36d=util[_0x8b06('0x98')](_0x8b06('0x99'),_0x2d8c7e);_0x36deb8={'user':_0x55e956[_0x8b06('0x9a')],'pass':_0x55e956[_0x8b06('0x92')]};var _0x24e7ee={'method':'GET','uri':_0x3c5be5+_0x8b06('0x9b'),'auth':_0x36deb8,'json':!![]};return rp(_0x24e7ee);}})['then'](function(_0x5a41d8){if(_0x5a41d8[_0x8b06('0x9c')]['length']>0x0){_0xdf26a0=_0x5a41d8['result'];}console['log'](_0x8b06('0x9d'),_0xdf26a0);_0x2d4fb7=[];_0xf13dce=Object[_0x8b06('0x9e')]([],_0xdf26a0);_[_0x8b06('0x9f')](_0xf13dce,function(_0x3e7047){return!_0x15a9de[_0x8b06('0xa0')](_0x3e7047['name']);});_0xf13dce[_0x8b06('0xa1')](function(_0x142be6){var _0x5e1ecd=createFieldObject(_0x37f36d,_0x36deb8,_0x142be6[_0x8b06('0xa2')],_0x142be6[_0x8b06('0x24')],_0x142be6[_0x8b06('0xa3')],![]);_0x2d4fb7[_0x8b06('0xa4')](_0x5e1ecd);});return Promise['all'](_0x2d4fb7);})[_0x8b06('0x21')](function(_0x313ff7){_0x203779=_0x313ff7;_0x4efc00=Object[_0x8b06('0x9e')]([],_0xdf26a0);console[_0x8b06('0xa5')](_0x8b06('0xa6'),_0xdf26a0);_['remove'](_0x4efc00,function(_0x5f5883){return _0x5108e4['includes'](_0x5f5883[_0x8b06('0x24')]);});console['log'](_0x8b06('0xa7'),_0x4efc00);_0x2d4fb7=[];_0x4efc00[_0x8b06('0xa1')](function(_0x34a5ad){var _0x2f0c3c=createFieldObject(_0x37f36d,_0x36deb8,_0x34a5ad[_0x8b06('0xa2')],_0x34a5ad[_0x8b06('0x24')],_0x34a5ad[_0x8b06('0xa3')],!![]);_0x2d4fb7[_0x8b06('0xa4')](_0x2f0c3c);});return Promise[_0x8b06('0xa8')](_0x2d4fb7);})[_0x8b06('0x21')](function(_0x3ff2fc){_0x4527b0=_0x3ff2fc;var _0xb50af=_0x203779[_0x8b06('0xa9')](_0x4527b0);return{'count':_0xb50af[_0x8b06('0x31')],'rows':_0xb50af};})['then'](respondWithResult(_0x206f5c,null))[_0x8b06('0x3d')](function(_0x5f51e3){console[_0x8b06('0xa5')](_0x8b06('0xaa')+_0x5f51e3);var _0xc3fb43=_0x373142[_0x8b06('0x2c')]['test']?0x1f4:_0x5f51e3['statusCode']||0x1f4;logger[_0x8b06('0x23')](_0x5f51e3[_0x8b06('0xab')]);delete _0x5f51e3[_0x8b06('0x24')];if(_0xc3fb43===0x191){_0xc3fb43=0x190;}_0x206f5c[_0x8b06('0x16')](_0xc3fb43)['send'](_0x373142[_0x8b06('0x2c')][_0x8b06('0xac')]?{'message':_0x8b06('0xad'),'statusCode':_0x5f51e3[_0x8b06('0xae')]}:_0x5f51e3);});};function createFieldObject(_0x2556b6,_0x55f3dc,_0x4e2a21,_0x12156,_0xf555fe,_0x2f65d4){return new Promise(function(_0x351656,_0x2d44ae){var _0x57a6b7={'id':_0x12156,'name':_0xf555fe,'custom':_0x2f65d4};if(_0x4e2a21===_0x8b06('0xaf')){_0x57a6b7[_0x8b06('0x42')]=[{'name':_0x8b06('0xb0'),'value':'true'},{'name':_0x8b06('0xb1'),'value':'false'}];_0x351656(_0x57a6b7);}else{var _0x2c647d={'method':'GET','uri':_0x2556b6+_0x8b06('0xb2')+_0x12156,'auth':_0x55f3dc,'json':!![]};return rp(_0x2c647d)[_0x8b06('0x21')](function(_0x2d79c3){var _0x120bd7=[];if(_0x2d79c3['result'][_0x8b06('0x31')]>0x0){_0x2d79c3['result'][_0x8b06('0xa1')](function(_0x34c8e8){if(_0x34c8e8[_0x8b06('0xb3')]==='false'){var _0x14f415={'name':_0x34c8e8['label'],'value':_0x34c8e8['value']};_0x120bd7['push'](_0x14f415);}});}_0x57a6b7[_0x8b06('0x42')]=_0x120bd7;if(_0x57a6b7['options'][_0x8b06('0x31')]>0x0){_0x351656(_0x57a6b7);}else{if(_0x2f65d4==![]){_0x351656();}else{_0x351656(_0x57a6b7);}}});}});} \ No newline at end of file +var _0xd0f9=['hasOwnProperty','nolimit','order','where','pick','filter','merge','options','findAll','catch','show','params','includeAll','include','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','sort','addConfiguration','AccountId','getSubjects','channel','ServicenowField','Subjects','Descriptions','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','knowledge','calendar_stc','delivery_plan','business_service','time_worked','expected_start','business_duration','resolved_at','caller_id','approval_set','work_notes','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','comments','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','correlation_id','username','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','result','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','assign','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','ServicenowAccount','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length'];(function(_0x3b2ffd,_0x39702e){var _0x2b84bc=function(_0x25e081){while(--_0x25e081){_0x3b2ffd['push'](_0x3b2ffd['shift']());}};_0x2b84bc(++_0x39702e);}(_0xd0f9,0x76));var _0x9d0f=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xd0f9[_0x1b70e3];return _0x1452ab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d0f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d0f('0x1'));var moment=require(_0x9d0f('0x2'));var BPromise=require(_0x9d0f('0x3'));var Mustache=require(_0x9d0f('0x4'));var util=require(_0x9d0f('0x5'));var path=require('path');var sox=require(_0x9d0f('0x6'));var csv=require(_0x9d0f('0x7'));var ejs=require(_0x9d0f('0x8'));var fs=require('fs');var fs_extra=require(_0x9d0f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9d0f('0xa'));var jsforce=require(_0x9d0f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9d0f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9d0f('0xc'));var qs=require(_0x9d0f('0xd'));var as=require(_0x9d0f('0xe'));var hardwareService=require(_0x9d0f('0xf'));var logger=require(_0x9d0f('0x10'))('api');var utils=require(_0x9d0f('0x11'));var config=require(_0x9d0f('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x9d0f('0x13'));function respondWithStatusCode(_0x59625,_0x18fefa){_0x18fefa=_0x18fefa||0xcc;return function(_0x1872b1){if(_0x1872b1){return _0x59625[_0x9d0f('0x14')](_0x18fefa);}return _0x59625[_0x9d0f('0x15')](_0x18fefa)['end']();};}function respondWithResult(_0x19ea4c,_0x364a24){_0x364a24=_0x364a24||0xc8;return function(_0x6b102a){if(_0x6b102a){return _0x19ea4c[_0x9d0f('0x15')](_0x364a24)['json'](_0x6b102a);}};}function respondWithFilteredResult(_0x2c3a7e,_0x1bc3d3){return function(_0x2a7d26){if(_0x2a7d26){var _0x53f36a=typeof _0x1bc3d3['offset']===_0x9d0f('0x16')&&typeof _0x1bc3d3[_0x9d0f('0x17')]==='undefined';var _0x14a88a=_0x2a7d26[_0x9d0f('0x18')];var _0x362a48=_0x53f36a?0x0:_0x1bc3d3[_0x9d0f('0x19')];var _0x4aaa50=_0x53f36a?_0x2a7d26[_0x9d0f('0x18')]:_0x1bc3d3[_0x9d0f('0x19')]+_0x1bc3d3[_0x9d0f('0x17')];var _0x397342;if(_0x4aaa50>=_0x14a88a){_0x4aaa50=_0x14a88a;_0x397342=0xc8;}else{_0x397342=0xce;}_0x2c3a7e[_0x9d0f('0x15')](_0x397342);return _0x2c3a7e['set'](_0x9d0f('0x1a'),_0x362a48+'-'+_0x4aaa50+'/'+_0x14a88a)['json'](_0x2a7d26);}return null;};}function patchUpdates(_0x4a72c1){return function(_0x1e7b1b){try{jsonpatch[_0x9d0f('0x1b')](_0x1e7b1b,_0x4a72c1,!![]);}catch(_0x447ade){return BPromise[_0x9d0f('0x1c')](_0x447ade);}return _0x1e7b1b[_0x9d0f('0x1d')]();};}function saveUpdates(_0x10f269,_0x1bf750){return function(_0x4f97f5){if(_0x4f97f5){return _0x4f97f5[_0x9d0f('0x1e')](_0x10f269)[_0x9d0f('0x1f')](function(_0x5ae514){return _0x5ae514;});}return null;};}function removeEntity(_0x1bf34c,_0x39e426){return function(_0x54f1ea){if(_0x54f1ea){return _0x54f1ea['destroy']()[_0x9d0f('0x1f')](function(){_0x1bf34c[_0x9d0f('0x15')](0xcc)[_0x9d0f('0x20')]();});}};}function handleEntityNotFound(_0x428515,_0x1632ed){return function(_0x2c8c24){if(!_0x2c8c24){_0x428515[_0x9d0f('0x14')](0x194);}return _0x2c8c24;};}function handleError(_0x4848e0,_0xbc3af7){_0xbc3af7=_0xbc3af7||0x1f4;return function(_0x324ee7){logger[_0x9d0f('0x21')](_0x324ee7[_0x9d0f('0x22')]);if(_0x324ee7[_0x9d0f('0x23')]){delete _0x324ee7[_0x9d0f('0x23')];}_0x4848e0[_0x9d0f('0x15')](_0xbc3af7)[_0x9d0f('0x24')](_0x324ee7);};}exports['index']=function(_0x5a8427,_0x259bf3){var _0x29ff6c={},_0x54c69d={},_0x3e5105={'count':0x0,'rows':[]};var _0x3c44d4=_[_0x9d0f('0x25')](db[_0x9d0f('0x26')][_0x9d0f('0x27')],function(_0x1ea7af){return{'name':_0x1ea7af['fieldName'],'type':_0x1ea7af[_0x9d0f('0x28')][_0x9d0f('0x29')]};});_0x54c69d['model']=_[_0x9d0f('0x25')](_0x3c44d4,_0x9d0f('0x23'));_0x54c69d['query']=_[_0x9d0f('0x2a')](_0x5a8427['query']);_0x54c69d[_0x9d0f('0x2b')]=_[_0x9d0f('0x2c')](_0x54c69d[_0x9d0f('0x2d')],_0x54c69d[_0x9d0f('0x2e')]);_0x29ff6c[_0x9d0f('0x2f')]=_[_0x9d0f('0x2c')](_0x54c69d[_0x9d0f('0x2d')],qs[_0x9d0f('0x30')](_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x30')]));_0x29ff6c[_0x9d0f('0x2f')]=_0x29ff6c[_0x9d0f('0x2f')][_0x9d0f('0x31')]?_0x29ff6c[_0x9d0f('0x2f')]:_0x54c69d[_0x9d0f('0x2d')];if(!_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x32')](_0x9d0f('0x33'))){_0x29ff6c['limit']=qs[_0x9d0f('0x17')](_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x17')]);_0x29ff6c[_0x9d0f('0x19')]=qs['offset'](_0x5a8427['query'][_0x9d0f('0x19')]);}_0x29ff6c[_0x9d0f('0x34')]=qs['sort'](_0x5a8427[_0x9d0f('0x2e')]['sort']);_0x29ff6c[_0x9d0f('0x35')]=qs[_0x9d0f('0x2b')](_[_0x9d0f('0x36')](_0x5a8427[_0x9d0f('0x2e')],_0x54c69d[_0x9d0f('0x2b')]),_0x3c44d4);if(_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x37')]){_0x29ff6c['where']=_[_0x9d0f('0x38')](_0x29ff6c[_0x9d0f('0x35')],{'$or':_[_0x9d0f('0x25')](_0x3c44d4,function(_0x246a40){if(_0x246a40[_0x9d0f('0x28')]!=='VIRTUAL'){var _0x571395={};_0x571395[_0x246a40[_0x9d0f('0x23')]]={'$like':'%'+_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x37')]+'%'};return _0x571395;}})});}_0x29ff6c=_['merge']({},_0x29ff6c,_0x5a8427[_0x9d0f('0x39')]);var _0x3045be={'where':_0x29ff6c['where']};return db[_0x9d0f('0x26')][_0x9d0f('0x18')](_0x3045be)['then'](function(_0x38044d){_0x3e5105[_0x9d0f('0x18')]=_0x38044d;if(_0x5a8427[_0x9d0f('0x2e')]['includeAll']){_0x29ff6c['include']=[{'all':!![]}];}return db[_0x9d0f('0x26')][_0x9d0f('0x3a')](_0x29ff6c);})['then'](function(_0x3e780f){_0x3e5105['rows']=_0x3e780f;return _0x3e5105;})[_0x9d0f('0x1f')](respondWithFilteredResult(_0x259bf3,_0x29ff6c))[_0x9d0f('0x3b')](handleError(_0x259bf3,null));};exports[_0x9d0f('0x3c')]=function(_0x5cae01,_0xbd1691){var _0x32946b={'raw':![],'where':{'id':_0x5cae01[_0x9d0f('0x3d')]['id']}},_0x21c869={};_0x21c869[_0x9d0f('0x2d')]=_[_0x9d0f('0x2a')](db[_0x9d0f('0x26')][_0x9d0f('0x27')]);_0x21c869[_0x9d0f('0x2e')]=_[_0x9d0f('0x2a')](_0x5cae01[_0x9d0f('0x2e')]);_0x21c869['filters']=_['intersection'](_0x21c869['model'],_0x21c869[_0x9d0f('0x2e')]);_0x32946b['attributes']=_[_0x9d0f('0x2c')](_0x21c869[_0x9d0f('0x2d')],qs[_0x9d0f('0x30')](_0x5cae01[_0x9d0f('0x2e')][_0x9d0f('0x30')]));_0x32946b[_0x9d0f('0x2f')]=_0x32946b[_0x9d0f('0x2f')][_0x9d0f('0x31')]?_0x32946b[_0x9d0f('0x2f')]:_0x21c869[_0x9d0f('0x2d')];if(_0x5cae01['query'][_0x9d0f('0x3e')]){_0x32946b[_0x9d0f('0x3f')]=[{'all':!![]}];}_0x32946b=_[_0x9d0f('0x38')]({},_0x32946b,_0x5cae01['options']);return db['ServicenowAccount'][_0x9d0f('0x40')](_0x32946b)['then'](handleEntityNotFound(_0xbd1691,null))[_0x9d0f('0x1f')](respondWithResult(_0xbd1691,null))['catch'](handleError(_0xbd1691,null));};exports[_0x9d0f('0x41')]=function(_0x52bb83,_0x2fbe87){return db[_0x9d0f('0x26')][_0x9d0f('0x41')](_0x52bb83['body'],{})[_0x9d0f('0x1f')](respondWithResult(_0x2fbe87,0xc9))[_0x9d0f('0x3b')](handleError(_0x2fbe87,null));};exports[_0x9d0f('0x1e')]=function(_0x103272,_0x59f56c){if(_0x103272['body']['id']){delete _0x103272[_0x9d0f('0x42')]['id'];}return db['ServicenowAccount'][_0x9d0f('0x40')]({'where':{'id':_0x103272[_0x9d0f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x59f56c,null))[_0x9d0f('0x1f')](saveUpdates(_0x103272[_0x9d0f('0x42')],null))[_0x9d0f('0x1f')](respondWithResult(_0x59f56c,null))[_0x9d0f('0x3b')](handleError(_0x59f56c,null));};exports[_0x9d0f('0x43')]=function(_0x157b93,_0x5eb836){return db[_0x9d0f('0x26')][_0x9d0f('0x40')]({'where':{'id':_0x157b93[_0x9d0f('0x3d')]['id']}})[_0x9d0f('0x1f')](handleEntityNotFound(_0x5eb836,null))[_0x9d0f('0x1f')](removeEntity(_0x5eb836,null))[_0x9d0f('0x3b')](handleError(_0x5eb836,null));};exports[_0x9d0f('0x44')]=function(_0x3a69b1,_0xe6a5b3,_0x358c4a){var _0x2b1486={};var _0x2d2471={};var _0x56a4af;var _0x49931d;return db['ServicenowAccount'][_0x9d0f('0x45')]({'where':{'id':_0x3a69b1['params']['id']}})['then'](handleEntityNotFound(_0xe6a5b3,null))[_0x9d0f('0x1f')](function(_0x5d7956){if(_0x5d7956){_0x56a4af=_0x5d7956;_0x2d2471['model']=_[_0x9d0f('0x2a')](db[_0x9d0f('0x46')][_0x9d0f('0x27')]);_0x2d2471['query']=_[_0x9d0f('0x2a')](_0x3a69b1[_0x9d0f('0x2e')]);_0x2d2471['filters']=_[_0x9d0f('0x2c')](_0x2d2471[_0x9d0f('0x2d')],_0x2d2471[_0x9d0f('0x2e')]);_0x2b1486[_0x9d0f('0x2f')]=_[_0x9d0f('0x2c')](_0x2d2471[_0x9d0f('0x2d')],qs[_0x9d0f('0x30')](_0x3a69b1['query']['fields']));_0x2b1486[_0x9d0f('0x2f')]=_0x2b1486[_0x9d0f('0x2f')][_0x9d0f('0x31')]?_0x2b1486[_0x9d0f('0x2f')]:_0x2d2471['model'];_0x2b1486[_0x9d0f('0x34')]=qs[_0x9d0f('0x47')](_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x47')]);_0x2b1486[_0x9d0f('0x35')]=qs[_0x9d0f('0x2b')](_[_0x9d0f('0x36')](_0x3a69b1['query'],_0x2d2471[_0x9d0f('0x2b')]));if(_0x3a69b1['query'][_0x9d0f('0x37')]){_0x2b1486[_0x9d0f('0x35')]=_[_0x9d0f('0x38')](_0x2b1486[_0x9d0f('0x35')],{'$or':_[_0x9d0f('0x25')](_0x2b1486['attributes'],function(_0x53925a){var _0x368576={};_0x368576[_0x53925a]={'$like':'%'+_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x37')]+'%'};return _0x368576;})});}_0x2b1486=_[_0x9d0f('0x38')]({},_0x2b1486,_0x3a69b1[_0x9d0f('0x39')]);return _0x56a4af[_0x9d0f('0x44')](_0x2b1486);}})[_0x9d0f('0x1f')](function(_0xd636ac){if(_0xd636ac){_0x49931d=_0xd636ac[_0x9d0f('0x31')];if(!_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x32')]('nolimit')){_0x2b1486[_0x9d0f('0x17')]=qs['limit'](_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x17')]);_0x2b1486[_0x9d0f('0x19')]=qs[_0x9d0f('0x19')](_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x19')]);}return _0x56a4af[_0x9d0f('0x44')](_0x2b1486);}})['then'](function(_0xcff771){if(_0xcff771){return _0xcff771?{'count':_0x49931d,'rows':_0xcff771}:null;}})[_0x9d0f('0x1f')](respondWithResult(_0xe6a5b3,null))['catch'](handleError(_0xe6a5b3,null));};exports[_0x9d0f('0x48')]=function(_0x521649,_0x1dd9b6,_0x10cf70){if(_0x521649[_0x9d0f('0x42')]['id']){delete _0x521649[_0x9d0f('0x42')]['id'];}return db[_0x9d0f('0x26')][_0x9d0f('0x45')]({'where':{'id':_0x521649[_0x9d0f('0x3d')]['id']}})[_0x9d0f('0x1f')](handleEntityNotFound(_0x1dd9b6,null))[_0x9d0f('0x1f')](function(_0x41c51a){if(_0x41c51a){_0x521649[_0x9d0f('0x42')][_0x9d0f('0x49')]=_0x41c51a['id'];_0x521649[_0x9d0f('0x42')]['Subjects']=integrations[_0x9d0f('0x4a')](_0x521649['body'][_0x9d0f('0x4b')],_0x521649['body'][_0x9d0f('0x28')]);_0x521649[_0x9d0f('0x42')]['Descriptions']=integrations['getDescriptions'](_0x521649[_0x9d0f('0x42')][_0x9d0f('0x4b')],_0x521649['body'][_0x9d0f('0x28')]);return db['ServicenowConfiguration']['create'](_0x521649['body'],{'include':[{'model':db[_0x9d0f('0x4c')],'as':_0x9d0f('0x4d')},{'model':db['ServicenowField'],'as':_0x9d0f('0x4e')}]});}return null;})['then'](respondWithResult(_0x1dd9b6,null))[_0x9d0f('0x3b')](handleError(_0x1dd9b6,null));};exports[_0x9d0f('0x4f')]=function(_0x28d7dc,_0x5c55ce,_0x418bdb){var _0x721ea4=[_0x9d0f('0x50'),_0x9d0f('0x51'),'knowledge',_0x9d0f('0x52'),_0x9d0f('0x53'),_0x9d0f('0x54'),_0x9d0f('0x55'),_0x9d0f('0x56'),_0x9d0f('0x57')];var _0x1944cf=[_0x9d0f('0x58'),'made_sla',_0x9d0f('0x59'),'watch_list',_0x9d0f('0x5a'),_0x9d0f('0x5b'),_0x9d0f('0x5c'),_0x9d0f('0x51'),_0x9d0f('0x5d'),_0x9d0f('0x5e'),'resolved_by',_0x9d0f('0x5f'),_0x9d0f('0x60'),_0x9d0f('0x61'),'sys_created_on',_0x9d0f('0x62'),_0x9d0f('0x63'),_0x9d0f('0x64'),_0x9d0f('0x65'),'order',_0x9d0f('0x66'),'closed_at','cmdb_ci',_0x9d0f('0x67'),'impact','active','work_notes_list',_0x9d0f('0x68'),'priority','sys_domain_path','rfc',_0x9d0f('0x69'),_0x9d0f('0x6a'),'opened_at',_0x9d0f('0x6b'),'group_list','work_end','reopened_time',_0x9d0f('0x6c'),_0x9d0f('0x6d'),_0x9d0f('0x6e'),_0x9d0f('0x52'),_0x9d0f('0x6f'),'short_description',_0x9d0f('0x53'),'correlation_display',_0x9d0f('0x70'),_0x9d0f('0x71'),_0x9d0f('0x72'),'business_stc',_0x9d0f('0x73'),_0x9d0f('0x74'),_0x9d0f('0x75'),'notify',_0x9d0f('0x76'),_0x9d0f('0x77'),'closed_by',_0x9d0f('0x78'),_0x9d0f('0x79'),_0x9d0f('0x7a'),_0x9d0f('0x7b'),_0x9d0f('0x7c'),'incident_state',_0x9d0f('0x7d'),_0x9d0f('0x7e'),'company',_0x9d0f('0x7f'),_0x9d0f('0x80'),'assigned_to',_0x9d0f('0x56'),_0x9d0f('0x81'),'sla_due','approval',_0x9d0f('0x82'),_0x9d0f('0x83'),'sys_mod_count',_0x9d0f('0x84'),_0x9d0f('0x85'),_0x9d0f('0x86'),'upon_approval',_0x9d0f('0x87'),'location',_0x9d0f('0x57')];var _0x419b1d='';var _0x251c73='';var _0x4b525d=[];var _0x356a47='';var _0xbb7922='';var _0x5f2cd2=[];var _0x489476='';var _0x16c470='';var _0x2e4be5={};var _0x17214f='';return db[_0x9d0f('0x26')][_0x9d0f('0x45')]({'where':{'id':_0x28d7dc[_0x9d0f('0x3d')]['id']},'attributes':['id',_0x9d0f('0x88'),'password','email','remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x5c55ce,null))['then'](function(_0x107e07){if(_0x107e07){_0x17214f=_0x107e07[_0x9d0f('0x89')];var _0x10efd4=_0x17214f[_0x9d0f('0x8a')](-0x1);if(_0x10efd4==='/'){_0x17214f=_0x17214f['substring'](0x0,_0x17214f[_0x9d0f('0x8b')](_0x10efd4));}_0x16c470=util[_0x9d0f('0x8c')](_0x9d0f('0x8d'),_0x17214f);_0x489476=util[_0x9d0f('0x8c')](_0x9d0f('0x8e'),_0x17214f);_0x2e4be5={'user':_0x107e07[_0x9d0f('0x88')],'pass':_0x107e07[_0x9d0f('0x8f')]};var _0x1c793d={'method':_0x9d0f('0x90'),'uri':_0x16c470+'incident?sysparm_display_value=all','auth':_0x2e4be5,'json':!![]};return rp(_0x1c793d);}})[_0x9d0f('0x1f')](function(_0x391669){if(_0x391669[_0x9d0f('0x91')]['length']>0x0){_0x419b1d=_0x391669[_0x9d0f('0x91')];}console['log'](_0x9d0f('0x92'),_0x419b1d);_0x5f2cd2=[];_0x251c73=Object['assign']([],_0x419b1d);_[_0x9d0f('0x93')](_0x251c73,function(_0x4ce444){return!_0x721ea4[_0x9d0f('0x94')](_0x4ce444[_0x9d0f('0x23')]);});_0x251c73[_0x9d0f('0x95')](function(_0x22f57d){var _0x36e33d=createFieldObject(_0x489476,_0x2e4be5,_0x22f57d[_0x9d0f('0x96')],_0x22f57d['name'],_0x22f57d[_0x9d0f('0x97')],![]);_0x5f2cd2['push'](_0x36e33d);});return Promise[_0x9d0f('0x98')](_0x5f2cd2);})[_0x9d0f('0x1f')](function(_0x339716){_0x4b525d=_0x339716;_0x356a47=Object[_0x9d0f('0x99')]([],_0x419b1d);console[_0x9d0f('0x9a')]('TCL:\x20_object',_0x419b1d);_[_0x9d0f('0x93')](_0x356a47,function(_0x59d937){return _0x1944cf[_0x9d0f('0x94')](_0x59d937[_0x9d0f('0x23')]);});console[_0x9d0f('0x9a')](_0x9d0f('0x9b'),_0x356a47);_0x5f2cd2=[];_0x356a47['forEach'](function(_0x3cd8d9){var _0x1d5945=createFieldObject(_0x489476,_0x2e4be5,_0x3cd8d9[_0x9d0f('0x96')],_0x3cd8d9[_0x9d0f('0x23')],_0x3cd8d9[_0x9d0f('0x97')],!![]);_0x5f2cd2['push'](_0x1d5945);});return Promise[_0x9d0f('0x98')](_0x5f2cd2);})[_0x9d0f('0x1f')](function(_0x597c3d){_0xbb7922=_0x597c3d;var _0x7b2910=_0x4b525d['concat'](_0xbb7922);return{'count':_0x7b2910[_0x9d0f('0x31')],'rows':_0x7b2910};})[_0x9d0f('0x1f')](respondWithResult(_0x5c55ce,null))[_0x9d0f('0x3b')](function(_0xc8f428){console[_0x9d0f('0x9a')](_0x9d0f('0x9c')+_0xc8f428);var _0x1ec409=_0x28d7dc[_0x9d0f('0x2e')]['test']?0x1f4:_0xc8f428[_0x9d0f('0x9d')]||0x1f4;logger[_0x9d0f('0x21')](_0xc8f428[_0x9d0f('0x22')]);delete _0xc8f428[_0x9d0f('0x23')];if(_0x1ec409===0x191){_0x1ec409=0x190;}_0x5c55ce[_0x9d0f('0x15')](_0x1ec409)[_0x9d0f('0x24')](_0x28d7dc[_0x9d0f('0x2e')][_0x9d0f('0x9e')]?{'message':_0x9d0f('0x9f'),'statusCode':_0xc8f428[_0x9d0f('0x9d')]}:_0xc8f428);});};function createFieldObject(_0x1fdecf,_0x27f498,_0x4a6eab,_0x9aa5a9,_0x333383,_0x6602bf){return new Promise(function(_0x36e321,_0x5b4f0f){var _0x29773f={'id':_0x9aa5a9,'name':_0x333383,'custom':_0x6602bf};if(_0x4a6eab==='boolean'){_0x29773f[_0x9d0f('0x39')]=[{'name':_0x9d0f('0xa0'),'value':_0x9d0f('0xa1')},{'name':_0x9d0f('0xa2'),'value':_0x9d0f('0xa3')}];_0x36e321(_0x29773f);}else{var _0x46d8a9={'method':'GET','uri':_0x1fdecf+_0x9d0f('0xa4')+_0x9aa5a9,'auth':_0x27f498,'json':!![]};return rp(_0x46d8a9)['then'](function(_0x44756d){var _0x23884c=[];if(_0x44756d['result'][_0x9d0f('0x31')]>0x0){_0x44756d[_0x9d0f('0x91')][_0x9d0f('0x95')](function(_0x4b7343){if(_0x4b7343[_0x9d0f('0xa5')]===_0x9d0f('0xa3')){var _0x268f33={'name':_0x4b7343[_0x9d0f('0x97')],'value':_0x4b7343[_0x9d0f('0xa6')]};_0x23884c[_0x9d0f('0xa7')](_0x268f33);}});}_0x29773f[_0x9d0f('0x39')]=_0x23884c;if(_0x29773f[_0x9d0f('0x39')][_0x9d0f('0x31')]>0x0){_0x36e321(_0x29773f);}else{if(_0x6602bf==![]){_0x36e321();}else{_0x36e321(_0x29773f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8af184a..da30d29 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 _0xee14=['ServicenowAccount','int_servicenow_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define'];(function(_0x42b282,_0x44d8af){var _0x14e6c4=function(_0x52cde8){while(--_0x52cde8){_0x42b282['push'](_0x42b282['shift']());}};_0x14e6c4(++_0x44d8af);}(_0xee14,0x13a));var _0x4ee1=function(_0x1238b3,_0x4591d8){_0x1238b3=_0x1238b3-0x0;var _0x9352bb=_0xee14[_0x1238b3];return _0x9352bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x4ee1('0x9')]=function(_0x573700,_0x327c18){return _0x573700[_0x4ee1('0xa')](_0x4ee1('0xb'),attributes,{'tableName':_0x4ee1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x10968f,_0xa9c0b2){var _0x3b5f97=function(_0x35b75c){while(--_0x35b75c){_0x10968f['push'](_0x10968f['shift']());}};_0x3b5f97(++_0xa9c0b2);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x473be3,_0x2c7c04){_0x473be3=_0x473be3-0x0;var _0x44603e=_0xdbf5[_0x473be3];return _0x44603e;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','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 236514e..7e9223c 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 _0x1c99=['raw','attributes','limit','include','map','model','then','debug','GetServicenowAccount','ShowServicenowAccount','find','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ServicenowAccount','findAll','options'];(function(_0x204446,_0xd2e760){var _0x1e1339=function(_0x46ea70){while(--_0x46ea70){_0x204446['push'](_0x204446['shift']());}};_0x1e1339(++_0xd2e760);}(_0x1c99,0x19f));var _0x91c9=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x1c99[_0x15b399];return _0x199f2d;};'use strict';var _=require(_0x91c9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x91c9('0x1'));var rs=require(_0x91c9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91c9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x91c9('0x4'))(_0x91c9('0x5'));var config=require('../../config/environment');var jayson=require(_0x91c9('0x6'));var client=jayson[_0x91c9('0x7')][_0x91c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40479b,_0x54dc4c,_0x304f5e){return new BPromise(function(_0x39d280,_0x35fb74){return client['request'](_0x40479b,_0x304f5e)['then'](function(_0x52b6b7){logger[_0x91c9('0x9')](_0x91c9('0xa'),_0x54dc4c,_0x91c9('0xb'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x54dc4c,'request\x20sent',JSON['stringify'](_0x52b6b7));if(_0x52b6b7[_0x91c9('0xc')]){if(_0x52b6b7[_0x91c9('0xc')][_0x91c9('0xd')]===0x1f4){logger[_0x91c9('0xc')](_0x91c9('0xa'),_0x54dc4c,_0x52b6b7[_0x91c9('0xc')][_0x91c9('0xe')]);return _0x35fb74(_0x52b6b7[_0x91c9('0xc')]['message']);}logger[_0x91c9('0xc')](_0x91c9('0xa'),_0x54dc4c,_0x52b6b7[_0x91c9('0xc')][_0x91c9('0xe')]);return _0x39d280(_0x52b6b7[_0x91c9('0xc')][_0x91c9('0xe')]);}else{logger[_0x91c9('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x54dc4c,_0x91c9('0xb'));_0x39d280(_0x52b6b7['result'][_0x91c9('0xe')]);}})[_0x91c9('0xf')](function(_0x528067){logger[_0x91c9('0xc')](_0x91c9('0xa'),_0x54dc4c,_0x528067);_0x35fb74(_0x528067);});});}exports['GetServicenowAccount']=function(_0x49d9e8){var _0x1afbf5=this;return new Promise(function(_0x4993d0,_0x40dd89){return db[_0x91c9('0x10')][_0x91c9('0x11')]({'raw':_0x49d9e8[_0x91c9('0x12')]?_0x49d9e8[_0x91c9('0x12')][_0x91c9('0x13')]===undefined?!![]:![]:!![],'where':_0x49d9e8[_0x91c9('0x12')]?_0x49d9e8[_0x91c9('0x12')]['where']||null:null,'attributes':_0x49d9e8[_0x91c9('0x12')]?_0x49d9e8['options'][_0x91c9('0x14')]||null:null,'limit':_0x49d9e8[_0x91c9('0x12')]?_0x49d9e8[_0x91c9('0x12')][_0x91c9('0x15')]||null:null,'include':_0x49d9e8[_0x91c9('0x12')]?_0x49d9e8[_0x91c9('0x12')][_0x91c9('0x16')]?_[_0x91c9('0x17')](_0x49d9e8[_0x91c9('0x12')][_0x91c9('0x16')],function(_0x1084ca){return{'model':db[_0x1084ca[_0x91c9('0x18')]],'as':_0x1084ca['as'],'attributes':_0x1084ca[_0x91c9('0x14')],'include':_0x1084ca[_0x91c9('0x16')]?_[_0x91c9('0x17')](_0x1084ca['include'],function(_0x181cbe){return{'model':db[_0x181cbe[_0x91c9('0x18')]],'as':_0x181cbe['as'],'attributes':_0x181cbe['attributes'],'include':_0x181cbe[_0x91c9('0x16')]?_[_0x91c9('0x17')](_0x181cbe['include'],function(_0xd96d51){return{'model':db[_0xd96d51[_0x91c9('0x18')]],'as':_0xd96d51['as'],'attributes':_0xd96d51['attributes']};}):[]};}):[]};}):[]:[]})[_0x91c9('0x19')](function(_0x4858ff){logger['info']('GetServicenowAccount',_0x49d9e8);logger[_0x91c9('0x1a')](_0x91c9('0x1b'),_0x49d9e8,JSON['stringify'](_0x4858ff));_0x4993d0(_0x4858ff);})[_0x91c9('0xf')](function(_0x580db0){logger[_0x91c9('0xc')]('GetServicenowAccount',_0x580db0['message'],_0x49d9e8);_0x40dd89(_0x1afbf5[_0x91c9('0xc')](0x1f4,_0x580db0[_0x91c9('0xe')]));});});};exports[_0x91c9('0x1c')]=function(_0x57a4f1){var _0x14295f=this;return new Promise(function(_0x2714fa,_0x1d1bfe){return db[_0x91c9('0x10')][_0x91c9('0x1d')]({'raw':_0x57a4f1['options']?_0x57a4f1[_0x91c9('0x12')][_0x91c9('0x13')]===undefined?!![]:![]:!![],'where':_0x57a4f1[_0x91c9('0x12')]?_0x57a4f1['options']['where']||null:null,'attributes':_0x57a4f1[_0x91c9('0x12')]?_0x57a4f1[_0x91c9('0x12')][_0x91c9('0x14')]||null:null,'include':_0x57a4f1[_0x91c9('0x12')]?_0x57a4f1['options'][_0x91c9('0x16')]?_[_0x91c9('0x17')](_0x57a4f1[_0x91c9('0x12')][_0x91c9('0x16')],function(_0x2c5c9d){return{'model':db[_0x2c5c9d['model']],'as':_0x2c5c9d['as'],'attributes':_0x2c5c9d[_0x91c9('0x14')],'include':_0x2c5c9d['include']?_['map'](_0x2c5c9d['include'],function(_0x3c24a2){return{'model':db[_0x3c24a2[_0x91c9('0x18')]],'as':_0x3c24a2['as'],'attributes':_0x3c24a2['attributes'],'include':_0x3c24a2['include']?_[_0x91c9('0x17')](_0x3c24a2[_0x91c9('0x16')],function(_0x53b1a1){return{'model':db[_0x53b1a1['model']],'as':_0x53b1a1['as'],'attributes':_0x53b1a1[_0x91c9('0x14')]};}):[]};}):[]};}):[]:[]})[_0x91c9('0x19')](function(_0x1ac20c){logger[_0x91c9('0x9')]('ShowServicenowAccount',_0x57a4f1);logger['debug']('ShowServicenowAccount',_0x57a4f1,JSON[_0x91c9('0x1e')](_0x1ac20c));_0x2714fa(_0x1ac20c);})[_0x91c9('0xf')](function(_0x53f7b1){logger[_0x91c9('0xc')](_0x91c9('0x1c'),_0x53f7b1[_0x91c9('0xe')],_0x57a4f1);_0x1d1bfe(_0x14295f['error'](0x1f4,_0x53f7b1[_0x91c9('0xe')]));});});}; \ No newline at end of file +var _0x183b=['catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','limit','include','model','attributes','map','ShowServicenowAccount','find','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x2bafde,_0x39326c){var _0x5733dc=function(_0x3aa9a6){while(--_0x3aa9a6){_0x2bafde['push'](_0x2bafde['shift']());}};_0x5733dc(++_0x39326c);}(_0x183b,0xda));var _0xb183=function(_0x7c20f7,_0x119eab){_0x7c20f7=_0x7c20f7-0x0;var _0x26113b=_0x183b[_0x7c20f7];return _0x26113b;};'use strict';var _=require(_0xb183('0x0'));var util=require('util');var moment=require(_0xb183('0x1'));var BPromise=require('bluebird');var rs=require(_0xb183('0x2'));var fs=require('fs');var Redis=require(_0xb183('0x3'));var db=require(_0xb183('0x4'))['db'];var utils=require(_0xb183('0x5'));var logger=require(_0xb183('0x6'))('rpc');var config=require(_0xb183('0x7'));var jayson=require(_0xb183('0x8'));var client=jayson[_0xb183('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1520f1,_0x29ae11,_0x40cd8a){return new BPromise(function(_0x3605be,_0xd32442){return client[_0xb183('0xa')](_0x1520f1,_0x40cd8a)[_0xb183('0xb')](function(_0x14a79b){logger[_0xb183('0xc')](_0xb183('0xd'),_0x29ae11,_0xb183('0xe'));logger['debug'](_0xb183('0xf'),_0x29ae11,'request\x20sent',JSON['stringify'](_0x14a79b));if(_0x14a79b['error']){if(_0x14a79b['error'][_0xb183('0x10')]===0x1f4){logger[_0xb183('0x11')](_0xb183('0xd'),_0x29ae11,_0x14a79b[_0xb183('0x11')][_0xb183('0x12')]);return _0xd32442(_0x14a79b[_0xb183('0x11')]['message']);}logger['error'](_0xb183('0xd'),_0x29ae11,_0x14a79b[_0xb183('0x11')][_0xb183('0x12')]);return _0x3605be(_0x14a79b[_0xb183('0x11')][_0xb183('0x12')]);}else{logger[_0xb183('0xc')](_0xb183('0xd'),_0x29ae11,_0xb183('0xe'));_0x3605be(_0x14a79b[_0xb183('0x13')]['message']);}})[_0xb183('0x14')](function(_0x4c0421){logger['error'](_0xb183('0xd'),_0x29ae11,_0x4c0421);_0xd32442(_0x4c0421);});});}exports[_0xb183('0x15')]=function(_0x8b03be){var _0x9fce32=this;return new Promise(function(_0x4b2d88,_0x36254b){return db[_0xb183('0x16')][_0xb183('0x17')]({'raw':_0x8b03be[_0xb183('0x18')]?_0x8b03be[_0xb183('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x8b03be[_0xb183('0x18')]?_0x8b03be[_0xb183('0x18')][_0xb183('0x19')]||null:null,'attributes':_0x8b03be['options']?_0x8b03be['options']['attributes']||null:null,'limit':_0x8b03be[_0xb183('0x18')]?_0x8b03be['options'][_0xb183('0x1a')]||null:null,'include':_0x8b03be[_0xb183('0x18')]?_0x8b03be[_0xb183('0x18')][_0xb183('0x1b')]?_['map'](_0x8b03be[_0xb183('0x18')]['include'],function(_0x494dc8){return{'model':db[_0x494dc8[_0xb183('0x1c')]],'as':_0x494dc8['as'],'attributes':_0x494dc8[_0xb183('0x1d')],'include':_0x494dc8[_0xb183('0x1b')]?_['map'](_0x494dc8[_0xb183('0x1b')],function(_0xc72848){return{'model':db[_0xc72848[_0xb183('0x1c')]],'as':_0xc72848['as'],'attributes':_0xc72848[_0xb183('0x1d')],'include':_0xc72848[_0xb183('0x1b')]?_[_0xb183('0x1e')](_0xc72848['include'],function(_0x3437c2){return{'model':db[_0x3437c2[_0xb183('0x1c')]],'as':_0x3437c2['as'],'attributes':_0x3437c2[_0xb183('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb183('0xb')](function(_0x5212a2){logger[_0xb183('0xc')](_0xb183('0x15'),_0x8b03be);logger['debug'](_0xb183('0x15'),_0x8b03be,JSON['stringify'](_0x5212a2));_0x4b2d88(_0x5212a2);})[_0xb183('0x14')](function(_0x107dd3){logger[_0xb183('0x11')](_0xb183('0x15'),_0x107dd3[_0xb183('0x12')],_0x8b03be);_0x36254b(_0x9fce32[_0xb183('0x11')](0x1f4,_0x107dd3['message']));});});};exports[_0xb183('0x1f')]=function(_0x1a0fa4){var _0x202c29=this;return new Promise(function(_0x4ade6e,_0x5b04ae){return db['ServicenowAccount'][_0xb183('0x20')]({'raw':_0x1a0fa4[_0xb183('0x18')]?_0x1a0fa4[_0xb183('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1a0fa4['options']?_0x1a0fa4[_0xb183('0x18')][_0xb183('0x19')]||null:null,'attributes':_0x1a0fa4[_0xb183('0x18')]?_0x1a0fa4[_0xb183('0x18')][_0xb183('0x1d')]||null:null,'include':_0x1a0fa4['options']?_0x1a0fa4['options'][_0xb183('0x1b')]?_[_0xb183('0x1e')](_0x1a0fa4[_0xb183('0x18')][_0xb183('0x1b')],function(_0xd49a41){return{'model':db[_0xd49a41[_0xb183('0x1c')]],'as':_0xd49a41['as'],'attributes':_0xd49a41[_0xb183('0x1d')],'include':_0xd49a41[_0xb183('0x1b')]?_['map'](_0xd49a41[_0xb183('0x1b')],function(_0x3056f2){return{'model':db[_0x3056f2[_0xb183('0x1c')]],'as':_0x3056f2['as'],'attributes':_0x3056f2[_0xb183('0x1d')],'include':_0x3056f2[_0xb183('0x1b')]?_[_0xb183('0x1e')](_0x3056f2[_0xb183('0x1b')],function(_0x2e51c7){return{'model':db[_0x2e51c7[_0xb183('0x1c')]],'as':_0x2e51c7['as'],'attributes':_0x2e51c7[_0xb183('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb183('0xb')](function(_0x44cec7){logger['info']('ShowServicenowAccount',_0x1a0fa4);logger[_0xb183('0x21')](_0xb183('0x1f'),_0x1a0fa4,JSON['stringify'](_0x44cec7));_0x4ade6e(_0x44cec7);})[_0xb183('0x14')](function(_0x7328ae){logger[_0xb183('0x11')]('ShowServicenowAccount',_0x7328ae[_0xb183('0x12')],_0x1a0fa4);_0x5b04ae(_0x202c29[_0xb183('0x11')](0x1f4,_0x7328ae['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 36d215b..adf9ac4 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 _0x1916=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','path','express','Router'];(function(_0x26659f,_0x32f426){var _0x42667f=function(_0xdc0b71){while(--_0xdc0b71){_0x26659f['push'](_0x26659f['shift']());}};_0x42667f(++_0x32f426);}(_0x1916,0x9d));var _0x6191=function(_0x1746b4,_0x2bd96e){_0x1746b4=_0x1746b4-0x0;var _0x5b7409=_0x1916[_0x1746b4];return _0x5b7409;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6191('0x0'));var timeout=require('connect-timeout');var express=require(_0x6191('0x1'));var router=express[_0x6191('0x2')]();var fs_extra=require(_0x6191('0x3'));var auth=require(_0x6191('0x4'));var interaction=require(_0x6191('0x5'));var config=require(_0x6191('0x6'));var controller=require(_0x6191('0x7'));router[_0x6191('0x8')]('/',auth['isAuthenticated'](),controller[_0x6191('0x9')]);router['get'](_0x6191('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6191('0x8')]('/:id/fields',auth[_0x6191('0xb')](),controller['getFields']);router[_0x6191('0x8')](_0x6191('0xc'),auth[_0x6191('0xb')](),controller[_0x6191('0xd')]);router[_0x6191('0x8')](_0x6191('0xe'),auth[_0x6191('0xb')](),controller[_0x6191('0xf')]);router[_0x6191('0x10')]('/',auth[_0x6191('0xb')](),controller[_0x6191('0x11')]);router['put'](_0x6191('0xa'),auth[_0x6191('0xb')](),controller[_0x6191('0x12')]);router['delete'](_0x6191('0xa'),auth[_0x6191('0xb')](),controller[_0x6191('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe8ce=['put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xe8ce,0x18b));var _0xee8c=function(_0x502de0,_0x98868e){_0x502de0=_0x502de0-0x0;var _0x3b9539=_0xe8ce[_0x502de0];return _0x3b9539;};'use strict';var multer=require(_0xee8c('0x0'));var util=require('util');var path=require(_0xee8c('0x1'));var timeout=require(_0xee8c('0x2'));var express=require(_0xee8c('0x3'));var router=express[_0xee8c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xee8c('0x5'));var interaction=require(_0xee8c('0x6'));var config=require('../../config/environment');var controller=require(_0xee8c('0x7'));router[_0xee8c('0x8')]('/',auth[_0xee8c('0x9')](),controller[_0xee8c('0xa')]);router[_0xee8c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xee8c('0xb')]);router[_0xee8c('0x8')](_0xee8c('0xc'),auth[_0xee8c('0x9')](),controller[_0xee8c('0xd')]);router[_0xee8c('0x8')](_0xee8c('0xe'),auth[_0xee8c('0x9')](),controller['getSubjects']);router[_0xee8c('0x8')](_0xee8c('0xf'),auth[_0xee8c('0x9')](),controller[_0xee8c('0x10')]);router[_0xee8c('0x11')]('/',auth[_0xee8c('0x9')](),controller[_0xee8c('0x12')]);router[_0xee8c('0x13')](_0xee8c('0x14'),auth[_0xee8c('0x9')](),controller['update']);router['delete'](_0xee8c('0x14'),auth[_0xee8c('0x9')](),controller[_0xee8c('0x15')]);module[_0xee8c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 8eec731..4260b97 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 _0xce99=['exports','STRING'];(function(_0x49524a,_0x4d5439){var _0x12a7b8=function(_0x290b0d){while(--_0x290b0d){_0x49524a['push'](_0x49524a['shift']());}};_0x12a7b8(++_0x4d5439);}(_0xce99,0x134));var _0x9ce9=function(_0xd28890,_0x249d9f){_0xd28890=_0xd28890-0x0;var _0x2a9284=_0xce99[_0xd28890];return _0x2a9284;};'use strict';var Sequelize=require('sequelize');module[_0x9ce9('0x0')]={'name':{'type':Sequelize[_0x9ce9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa686=['STRING','sequelize','exports'];(function(_0x342013,_0x1c6ecf){var _0x2f4423=function(_0x1f2bb5){while(--_0x1f2bb5){_0x342013['push'](_0x342013['shift']());}};_0x2f4423(++_0x1c6ecf);}(_0xa686,0xe8));var _0x6a68=function(_0x1035ec,_0x5bb464){_0x1035ec=_0x1035ec-0x0;var _0x3d87e0=_0xa686[_0x1035ec];return _0x3d87e0;};'use strict';var Sequelize=require(_0x6a68('0x0'));module[_0x6a68('0x1')]={'name':{'type':Sequelize[_0x6a68('0x2')]},'description':{'type':Sequelize[_0x6a68('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 96e8a77..d092e42 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 _0xd56e=['create','body','destroy','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch'];(function(_0xf5e914,_0x1d561a){var _0x5b6f18=function(_0x11daea){while(--_0x11daea){_0xf5e914['push'](_0xf5e914['shift']());}};_0x5b6f18(++_0x1d561a);}(_0xd56e,0x1e8));var _0xed56=function(_0x287f9b,_0x557885){_0x287f9b=_0x287f9b-0x0;var _0x5248bb=_0xd56e[_0x287f9b];return _0x5248bb;};'use strict';var emlformat=require(_0xed56('0x0'));var rimraf=require(_0xed56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed56('0x2'));var rp=require('request-promise');var moment=require(_0xed56('0x3'));var BPromise=require(_0xed56('0x4'));var Mustache=require(_0xed56('0x5'));var util=require(_0xed56('0x6'));var path=require(_0xed56('0x7'));var sox=require(_0xed56('0x8'));var csv=require('to-csv');var ejs=require(_0xed56('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed56('0xa'));var squel=require(_0xed56('0xb'));var crypto=require(_0xed56('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xed56('0xd'));var toCsv=require(_0xed56('0xe'));var querystring=require('querystring');var Papa=require(_0xed56('0xf'));var Redis=require(_0xed56('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xed56('0x11'));var as=require(_0xed56('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed56('0x13'))('api');var utils=require(_0xed56('0x14'));var config=require(_0xed56('0x15'));var licenseUtil=require(_0xed56('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa4ef19,_0x2f8956){_0x2f8956=_0x2f8956||0xcc;return function(_0x3d36d2){if(_0x3d36d2){return _0xa4ef19[_0xed56('0x17')](_0x2f8956);}return _0xa4ef19[_0xed56('0x18')](_0x2f8956)[_0xed56('0x19')]();};}function respondWithResult(_0x552869,_0x277e15){_0x277e15=_0x277e15||0xc8;return function(_0x892c18){if(_0x892c18){return _0x552869[_0xed56('0x18')](_0x277e15)[_0xed56('0x1a')](_0x892c18);}};}function respondWithFilteredResult(_0x3bba43,_0x3165d5){return function(_0x4b8adb){if(_0x4b8adb){var _0x114dbf=typeof _0x3165d5[_0xed56('0x1b')]==='undefined'&&typeof _0x3165d5[_0xed56('0x1c')]===_0xed56('0x1d');var _0x353f22=_0x4b8adb[_0xed56('0x1e')];var _0x55dbb1=_0x114dbf?0x0:_0x3165d5[_0xed56('0x1b')];var _0x5adbb9=_0x114dbf?_0x4b8adb[_0xed56('0x1e')]:_0x3165d5[_0xed56('0x1b')]+_0x3165d5['limit'];var _0x1990d4;if(_0x5adbb9>=_0x353f22){_0x5adbb9=_0x353f22;_0x1990d4=0xc8;}else{_0x1990d4=0xce;}_0x3bba43['status'](_0x1990d4);return _0x3bba43[_0xed56('0x1f')](_0xed56('0x20'),_0x55dbb1+'-'+_0x5adbb9+'/'+_0x353f22)['json'](_0x4b8adb);}return null;};}function patchUpdates(_0x47d077){return function(_0x27de70){try{jsonpatch[_0xed56('0x21')](_0x27de70,_0x47d077,!![]);}catch(_0x35a09a){return BPromise[_0xed56('0x22')](_0x35a09a);}return _0x27de70['save']();};}function saveUpdates(_0x2ce97d,_0x8bf6){return function(_0x4364bd){if(_0x4364bd){return _0x4364bd[_0xed56('0x23')](_0x2ce97d)[_0xed56('0x24')](function(_0x274c08){return _0x274c08;});}return null;};}function removeEntity(_0x171ce4,_0x5781a6){return function(_0x2cb455){if(_0x2cb455){return _0x2cb455['destroy']()[_0xed56('0x24')](function(){_0x171ce4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x127836,_0xda2629){return function(_0x173ad6){if(!_0x173ad6){_0x127836[_0xed56('0x17')](0x194);}return _0x173ad6;};}function handleError(_0x3e3ec9,_0x20624a){_0x20624a=_0x20624a||0x1f4;return function(_0x2e5898){logger[_0xed56('0x25')](_0x2e5898[_0xed56('0x26')]);if(_0x2e5898[_0xed56('0x27')]){delete _0x2e5898[_0xed56('0x27')];}_0x3e3ec9[_0xed56('0x18')](_0x20624a)[_0xed56('0x28')](_0x2e5898);};}exports['index']=function(_0x594123,_0x25fa1f){var _0x27a158={},_0x4cdb60={},_0xa6e469={'count':0x0,'rows':[]};var _0x23718e=_[_0xed56('0x29')](db[_0xed56('0x2a')][_0xed56('0x2b')],function(_0x2602c7){return{'name':_0x2602c7['fieldName'],'type':_0x2602c7[_0xed56('0x2c')][_0xed56('0x2d')]};});_0x4cdb60[_0xed56('0x2e')]=_[_0xed56('0x29')](_0x23718e,_0xed56('0x27'));_0x4cdb60[_0xed56('0x2f')]=_['keys'](_0x594123[_0xed56('0x2f')]);_0x4cdb60[_0xed56('0x30')]=_[_0xed56('0x31')](_0x4cdb60['model'],_0x4cdb60[_0xed56('0x2f')]);_0x27a158[_0xed56('0x32')]=_[_0xed56('0x31')](_0x4cdb60[_0xed56('0x2e')],qs[_0xed56('0x33')](_0x594123['query']['fields']));_0x27a158[_0xed56('0x32')]=_0x27a158[_0xed56('0x32')][_0xed56('0x34')]?_0x27a158['attributes']:_0x4cdb60[_0xed56('0x2e')];if(!_0x594123['query'][_0xed56('0x35')](_0xed56('0x36'))){_0x27a158[_0xed56('0x1c')]=qs[_0xed56('0x1c')](_0x594123[_0xed56('0x2f')][_0xed56('0x1c')]);_0x27a158[_0xed56('0x1b')]=qs[_0xed56('0x1b')](_0x594123[_0xed56('0x2f')][_0xed56('0x1b')]);}_0x27a158[_0xed56('0x37')]=qs[_0xed56('0x38')](_0x594123['query'][_0xed56('0x38')]);_0x27a158['where']=qs[_0xed56('0x30')](_[_0xed56('0x39')](_0x594123['query'],_0x4cdb60['filters']),_0x23718e);if(_0x594123[_0xed56('0x2f')][_0xed56('0x3a')]){_0x27a158[_0xed56('0x3b')]=_[_0xed56('0x3c')](_0x27a158['where'],{'$or':_[_0xed56('0x29')](_0x23718e,function(_0xb29fc7){if(_0xb29fc7['type']!==_0xed56('0x3d')){var _0x17e90b={};_0x17e90b[_0xb29fc7['name']]={'$like':'%'+_0x594123['query'][_0xed56('0x3a')]+'%'};return _0x17e90b;}})});}_0x27a158=_[_0xed56('0x3c')]({},_0x27a158,_0x594123[_0xed56('0x3e')]);var _0x1040b5={'where':_0x27a158[_0xed56('0x3b')]};return db['ServicenowConfiguration'][_0xed56('0x1e')](_0x1040b5)[_0xed56('0x24')](function(_0xe96b38){_0xa6e469['count']=_0xe96b38;if(_0x594123[_0xed56('0x2f')][_0xed56('0x3f')]){_0x27a158[_0xed56('0x40')]=[{'all':!![]}];}return db[_0xed56('0x2a')][_0xed56('0x41')](_0x27a158);})[_0xed56('0x24')](function(_0x49e754){_0xa6e469[_0xed56('0x42')]=_0x49e754;return _0xa6e469;})[_0xed56('0x24')](respondWithFilteredResult(_0x25fa1f,_0x27a158))['catch'](handleError(_0x25fa1f,null));};exports[_0xed56('0x43')]=function(_0x2b2aad,_0x105f77){var _0x1a0995={'raw':![],'where':{'id':_0x2b2aad[_0xed56('0x44')]['id']}},_0x3f8395={};_0x3f8395[_0xed56('0x2e')]=_[_0xed56('0x45')](db[_0xed56('0x2a')][_0xed56('0x2b')]);_0x3f8395['query']=_['keys'](_0x2b2aad[_0xed56('0x2f')]);_0x3f8395[_0xed56('0x30')]=_['intersection'](_0x3f8395[_0xed56('0x2e')],_0x3f8395[_0xed56('0x2f')]);_0x1a0995[_0xed56('0x32')]=_[_0xed56('0x31')](_0x3f8395[_0xed56('0x2e')],qs[_0xed56('0x33')](_0x2b2aad[_0xed56('0x2f')]['fields']));_0x1a0995[_0xed56('0x32')]=_0x1a0995[_0xed56('0x32')][_0xed56('0x34')]?_0x1a0995[_0xed56('0x32')]:_0x3f8395[_0xed56('0x2e')];if(_0x2b2aad[_0xed56('0x2f')]['includeAll']){_0x1a0995[_0xed56('0x40')]=[{'all':!![]}];}_0x1a0995=_[_0xed56('0x3c')]({},_0x1a0995,_0x2b2aad[_0xed56('0x3e')]);return db['ServicenowConfiguration'][_0xed56('0x46')](_0x1a0995)['then'](handleEntityNotFound(_0x105f77,null))[_0xed56('0x24')](respondWithResult(_0x105f77,null))[_0xed56('0x47')](handleError(_0x105f77,null));};exports[_0xed56('0x48')]=function(_0x53f961,_0x26e76c){return db['ServicenowConfiguration'][_0xed56('0x48')](_0x53f961[_0xed56('0x49')],{})[_0xed56('0x24')](respondWithResult(_0x26e76c,0xc9))[_0xed56('0x47')](handleError(_0x26e76c,null));};exports['update']=function(_0x76f6d2,_0x22743f){if(_0x76f6d2[_0xed56('0x49')]['id']){delete _0x76f6d2[_0xed56('0x49')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x76f6d2[_0xed56('0x44')]['id']}})[_0xed56('0x24')](handleEntityNotFound(_0x22743f,null))['then'](saveUpdates(_0x76f6d2[_0xed56('0x49')],null))[_0xed56('0x24')](respondWithResult(_0x22743f,null))[_0xed56('0x47')](handleError(_0x22743f,null));};exports[_0xed56('0x4a')]=function(_0x55dc98,_0x1e7381){return db[_0xed56('0x2a')]['find']({'where':{'id':_0x55dc98[_0xed56('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e7381,null))[_0xed56('0x24')](removeEntity(_0x1e7381,null))[_0xed56('0x47')](handleError(_0x1e7381,null));};exports[_0xed56('0x4b')]=function(_0x9f8e36,_0x4cffc1,_0x541b51){var _0x12e06c={};var _0x49d366={};var _0x4282e5;var _0x30a7cf;return db[_0xed56('0x2a')][_0xed56('0x4c')]({'where':{'id':_0x9f8e36['params']['id']}})[_0xed56('0x24')](handleEntityNotFound(_0x4cffc1,null))[_0xed56('0x24')](function(_0x2ec784){if(_0x2ec784){_0x4282e5=_0x2ec784;_0x49d366[_0xed56('0x2e')]=_[_0xed56('0x45')](db[_0xed56('0x4d')]['rawAttributes']);_0x49d366[_0xed56('0x2f')]=_[_0xed56('0x45')](_0x9f8e36['query']);_0x49d366[_0xed56('0x30')]=_[_0xed56('0x31')](_0x49d366['model'],_0x49d366['query']);_0x12e06c['attributes']=_[_0xed56('0x31')](_0x49d366[_0xed56('0x2e')],qs[_0xed56('0x33')](_0x9f8e36[_0xed56('0x2f')]['fields']));_0x12e06c[_0xed56('0x32')]=_0x12e06c['attributes'][_0xed56('0x34')]?_0x12e06c[_0xed56('0x32')]:_0x49d366['model'];_0x12e06c[_0xed56('0x37')]=qs[_0xed56('0x38')](_0x9f8e36['query'][_0xed56('0x38')]);_0x12e06c[_0xed56('0x3b')]=qs['filters'](_[_0xed56('0x39')](_0x9f8e36[_0xed56('0x2f')],_0x49d366[_0xed56('0x30')]));if(_0x9f8e36[_0xed56('0x2f')][_0xed56('0x3a')]){_0x12e06c[_0xed56('0x3b')]=_[_0xed56('0x3c')](_0x12e06c['where'],{'$or':_[_0xed56('0x29')](_0x12e06c[_0xed56('0x32')],function(_0x2aa1fa){var _0x32da40={};_0x32da40[_0x2aa1fa]={'$like':'%'+_0x9f8e36[_0xed56('0x2f')][_0xed56('0x3a')]+'%'};return _0x32da40;})});}_0x12e06c=_['merge']({},_0x12e06c,_0x9f8e36[_0xed56('0x3e')]);return _0x4282e5[_0xed56('0x4b')](_0x12e06c);}})['then'](function(_0x16aec2){if(_0x16aec2){_0x30a7cf=_0x16aec2['length'];if(!_0x9f8e36[_0xed56('0x2f')]['hasOwnProperty']('nolimit')){_0x12e06c['limit']=qs[_0xed56('0x1c')](_0x9f8e36[_0xed56('0x2f')][_0xed56('0x1c')]);_0x12e06c[_0xed56('0x1b')]=qs[_0xed56('0x1b')](_0x9f8e36['query'][_0xed56('0x1b')]);}return _0x4282e5[_0xed56('0x4b')](_0x12e06c);}})[_0xed56('0x24')](function(_0x4ef34f){if(_0x4ef34f){return _0x4ef34f?{'count':_0x30a7cf,'rows':_0x4ef34f}:null;}})[_0xed56('0x24')](respondWithResult(_0x4cffc1,null))[_0xed56('0x47')](handleError(_0x4cffc1,null));};exports[_0xed56('0x4e')]=function(_0x49e1e5,_0x300b1e,_0x23ba6f){var _0x31cf15={};var _0x54f4cc={};var _0xb43e5f;var _0x5b4236;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x49e1e5[_0xed56('0x44')]['id']}})['then'](handleEntityNotFound(_0x300b1e,null))[_0xed56('0x24')](function(_0x26391b){if(_0x26391b){_0xb43e5f=_0x26391b;_0x54f4cc['model']=_[_0xed56('0x45')](db[_0xed56('0x4d')][_0xed56('0x2b')]);_0x54f4cc[_0xed56('0x2f')]=_['keys'](_0x49e1e5[_0xed56('0x2f')]);_0x54f4cc['filters']=_['intersection'](_0x54f4cc['model'],_0x54f4cc[_0xed56('0x2f')]);_0x31cf15[_0xed56('0x32')]=_[_0xed56('0x31')](_0x54f4cc[_0xed56('0x2e')],qs['fields'](_0x49e1e5['query'][_0xed56('0x33')]));_0x31cf15[_0xed56('0x32')]=_0x31cf15[_0xed56('0x32')][_0xed56('0x34')]?_0x31cf15['attributes']:_0x54f4cc[_0xed56('0x2e')];_0x31cf15[_0xed56('0x37')]=qs[_0xed56('0x38')](_0x49e1e5['query']['sort']);_0x31cf15[_0xed56('0x3b')]=qs[_0xed56('0x30')](_[_0xed56('0x39')](_0x49e1e5[_0xed56('0x2f')],_0x54f4cc[_0xed56('0x30')]));if(_0x49e1e5['query'][_0xed56('0x3a')]){_0x31cf15[_0xed56('0x3b')]=_[_0xed56('0x3c')](_0x31cf15[_0xed56('0x3b')],{'$or':_[_0xed56('0x29')](_0x31cf15[_0xed56('0x32')],function(_0x2ee472){var _0x55ea2b={};_0x55ea2b[_0x2ee472]={'$like':'%'+_0x49e1e5[_0xed56('0x2f')]['filter']+'%'};return _0x55ea2b;})});}_0x31cf15=_[_0xed56('0x3c')]({},_0x31cf15,_0x49e1e5['options']);return _0xb43e5f['getSubjects'](_0x31cf15);}})[_0xed56('0x24')](function(_0x3d97e6){if(_0x3d97e6){_0x5b4236=_0x3d97e6[_0xed56('0x34')];if(!_0x49e1e5[_0xed56('0x2f')]['hasOwnProperty'](_0xed56('0x36'))){_0x31cf15[_0xed56('0x1c')]=qs['limit'](_0x49e1e5[_0xed56('0x2f')][_0xed56('0x1c')]);_0x31cf15[_0xed56('0x1b')]=qs[_0xed56('0x1b')](_0x49e1e5['query'][_0xed56('0x1b')]);}return _0xb43e5f[_0xed56('0x4e')](_0x31cf15);}})['then'](function(_0x487119){if(_0x487119){return _0x487119?{'count':_0x5b4236,'rows':_0x487119}:null;}})[_0xed56('0x24')](respondWithResult(_0x300b1e,null))[_0xed56('0x47')](handleError(_0x300b1e,null));};exports[_0xed56('0x4f')]=function(_0x56c2d1,_0x3112d6,_0x1a9da6){var _0x23fa58={};var _0x370f82={};var _0x116d2d;var _0x487fa8;return db[_0xed56('0x2a')]['findOne']({'where':{'id':_0x56c2d1[_0xed56('0x44')]['id']}})['then'](handleEntityNotFound(_0x3112d6,null))[_0xed56('0x24')](function(_0x2d74ff){if(_0x2d74ff){_0x116d2d=_0x2d74ff;_0x370f82[_0xed56('0x2e')]=_['keys'](db[_0xed56('0x4d')][_0xed56('0x2b')]);_0x370f82[_0xed56('0x2f')]=_[_0xed56('0x45')](_0x56c2d1['query']);_0x370f82[_0xed56('0x30')]=_[_0xed56('0x31')](_0x370f82[_0xed56('0x2e')],_0x370f82[_0xed56('0x2f')]);_0x23fa58['attributes']=_[_0xed56('0x31')](_0x370f82[_0xed56('0x2e')],qs[_0xed56('0x33')](_0x56c2d1[_0xed56('0x2f')][_0xed56('0x33')]));_0x23fa58[_0xed56('0x32')]=_0x23fa58[_0xed56('0x32')][_0xed56('0x34')]?_0x23fa58['attributes']:_0x370f82['model'];_0x23fa58[_0xed56('0x37')]=qs[_0xed56('0x38')](_0x56c2d1[_0xed56('0x2f')][_0xed56('0x38')]);_0x23fa58[_0xed56('0x3b')]=qs[_0xed56('0x30')](_[_0xed56('0x39')](_0x56c2d1[_0xed56('0x2f')],_0x370f82[_0xed56('0x30')]));if(_0x56c2d1[_0xed56('0x2f')][_0xed56('0x3a')]){_0x23fa58[_0xed56('0x3b')]=_[_0xed56('0x3c')](_0x23fa58['where'],{'$or':_['map'](_0x23fa58[_0xed56('0x32')],function(_0x520049){var _0x48782d={};_0x48782d[_0x520049]={'$like':'%'+_0x56c2d1[_0xed56('0x2f')]['filter']+'%'};return _0x48782d;})});}_0x23fa58=_[_0xed56('0x3c')]({},_0x23fa58,_0x56c2d1[_0xed56('0x3e')]);return _0x116d2d['getDescriptions'](_0x23fa58);}})[_0xed56('0x24')](function(_0x1b03b4){if(_0x1b03b4){_0x487fa8=_0x1b03b4[_0xed56('0x34')];if(!_0x56c2d1[_0xed56('0x2f')]['hasOwnProperty']('nolimit')){_0x23fa58['limit']=qs[_0xed56('0x1c')](_0x56c2d1[_0xed56('0x2f')][_0xed56('0x1c')]);_0x23fa58[_0xed56('0x1b')]=qs[_0xed56('0x1b')](_0x56c2d1[_0xed56('0x2f')][_0xed56('0x1b')]);}return _0x116d2d[_0xed56('0x4f')](_0x23fa58);}})[_0xed56('0x24')](function(_0xa5acdc){if(_0xa5acdc){return _0xa5acdc?{'count':_0x487fa8,'rows':_0xa5acdc}:null;}})[_0xed56('0x24')](respondWithResult(_0x3112d6,null))[_0xed56('0x47')](handleError(_0x3112d6,null));}; \ No newline at end of file +var _0x9c34=['findAll','rows','show','params','catch','create','body','find','findOne','ServicenowField','getFields','nolimit','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','then','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x9c34,0x1ee));var _0x49c3=function(_0x2635be,_0x28a5eb){_0x2635be=_0x2635be-0x0;var _0x454c66=_0x9c34[_0x2635be];return _0x454c66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49c3('0x1'));var rp=require(_0x49c3('0x2'));var moment=require(_0x49c3('0x3'));var BPromise=require(_0x49c3('0x4'));var Mustache=require(_0x49c3('0x5'));var util=require(_0x49c3('0x6'));var path=require(_0x49c3('0x7'));var sox=require(_0x49c3('0x8'));var csv=require(_0x49c3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49c3('0xa'));var _=require('lodash');var squel=require(_0x49c3('0xb'));var crypto=require(_0x49c3('0xc'));var jsforce=require(_0x49c3('0xd'));var deskjs=require(_0x49c3('0xe'));var toCsv=require(_0x49c3('0x9'));var querystring=require('querystring');var Papa=require(_0x49c3('0xf'));var Redis=require('ioredis');var authService=require(_0x49c3('0x10'));var qs=require(_0x49c3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49c3('0x12'));var logger=require(_0x49c3('0x13'))(_0x49c3('0x14'));var utils=require(_0x49c3('0x15'));var config=require(_0x49c3('0x16'));var licenseUtil=require(_0x49c3('0x17'));var db=require(_0x49c3('0x18'))['db'];function respondWithStatusCode(_0x2fc6ae,_0x2ab0bb){_0x2ab0bb=_0x2ab0bb||0xcc;return function(_0x3618fa){if(_0x3618fa){return _0x2fc6ae[_0x49c3('0x19')](_0x2ab0bb);}return _0x2fc6ae[_0x49c3('0x1a')](_0x2ab0bb)[_0x49c3('0x1b')]();};}function respondWithResult(_0x26b992,_0x411e84){_0x411e84=_0x411e84||0xc8;return function(_0x40e45c){if(_0x40e45c){return _0x26b992[_0x49c3('0x1a')](_0x411e84)[_0x49c3('0x1c')](_0x40e45c);}};}function respondWithFilteredResult(_0x39711b,_0x5bbaa4){return function(_0x7766a6){if(_0x7766a6){var _0x5e1697=typeof _0x5bbaa4[_0x49c3('0x1d')]===_0x49c3('0x1e')&&typeof _0x5bbaa4['limit']===_0x49c3('0x1e');var _0x5358f3=_0x7766a6['count'];var _0x4dbafd=_0x5e1697?0x0:_0x5bbaa4[_0x49c3('0x1d')];var _0x1d806b=_0x5e1697?_0x7766a6['count']:_0x5bbaa4[_0x49c3('0x1d')]+_0x5bbaa4[_0x49c3('0x1f')];var _0x22afbe;if(_0x1d806b>=_0x5358f3){_0x1d806b=_0x5358f3;_0x22afbe=0xc8;}else{_0x22afbe=0xce;}_0x39711b['status'](_0x22afbe);return _0x39711b[_0x49c3('0x20')]('Content-Range',_0x4dbafd+'-'+_0x1d806b+'/'+_0x5358f3)[_0x49c3('0x1c')](_0x7766a6);}return null;};}function patchUpdates(_0x7747af){return function(_0x3cc033){try{jsonpatch[_0x49c3('0x21')](_0x3cc033,_0x7747af,!![]);}catch(_0x2d12a2){return BPromise[_0x49c3('0x22')](_0x2d12a2);}return _0x3cc033['save']();};}function saveUpdates(_0x250ba9,_0xe65dc){return function(_0x3a756e){if(_0x3a756e){return _0x3a756e[_0x49c3('0x23')](_0x250ba9)[_0x49c3('0x24')](function(_0x1130ec){return _0x1130ec;});}return null;};}function removeEntity(_0x44c3ed,_0x354024){return function(_0x5a99f0){if(_0x5a99f0){return _0x5a99f0['destroy']()['then'](function(){_0x44c3ed[_0x49c3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b2dc2,_0x4b93aa){return function(_0x192363){if(!_0x192363){_0x4b2dc2[_0x49c3('0x19')](0x194);}return _0x192363;};}function handleError(_0x3d5188,_0x4a5bdf){_0x4a5bdf=_0x4a5bdf||0x1f4;return function(_0x26a6df){logger[_0x49c3('0x25')](_0x26a6df[_0x49c3('0x26')]);if(_0x26a6df[_0x49c3('0x27')]){delete _0x26a6df[_0x49c3('0x27')];}_0x3d5188[_0x49c3('0x1a')](_0x4a5bdf)['send'](_0x26a6df);};}exports[_0x49c3('0x28')]=function(_0x4c6082,_0x7ddc09){var _0x187358={},_0x2b24b0={},_0x5f030a={'count':0x0,'rows':[]};var _0x274ae8=_[_0x49c3('0x29')](db[_0x49c3('0x2a')][_0x49c3('0x2b')],function(_0x52b76e){return{'name':_0x52b76e[_0x49c3('0x2c')],'type':_0x52b76e[_0x49c3('0x2d')]['key']};});_0x2b24b0[_0x49c3('0x2e')]=_[_0x49c3('0x29')](_0x274ae8,_0x49c3('0x27'));_0x2b24b0[_0x49c3('0x2f')]=_[_0x49c3('0x30')](_0x4c6082[_0x49c3('0x2f')]);_0x2b24b0[_0x49c3('0x31')]=_[_0x49c3('0x32')](_0x2b24b0[_0x49c3('0x2e')],_0x2b24b0[_0x49c3('0x2f')]);_0x187358[_0x49c3('0x33')]=_[_0x49c3('0x32')](_0x2b24b0['model'],qs[_0x49c3('0x34')](_0x4c6082['query'][_0x49c3('0x34')]));_0x187358[_0x49c3('0x33')]=_0x187358[_0x49c3('0x33')][_0x49c3('0x35')]?_0x187358[_0x49c3('0x33')]:_0x2b24b0['model'];if(!_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x36')]('nolimit')){_0x187358[_0x49c3('0x1f')]=qs[_0x49c3('0x1f')](_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x1f')]);_0x187358[_0x49c3('0x1d')]=qs['offset'](_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x1d')]);}_0x187358[_0x49c3('0x37')]=qs[_0x49c3('0x38')](_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x38')]);_0x187358['where']=qs[_0x49c3('0x31')](_[_0x49c3('0x39')](_0x4c6082['query'],_0x2b24b0[_0x49c3('0x31')]),_0x274ae8);if(_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x3a')]){_0x187358[_0x49c3('0x3b')]=_[_0x49c3('0x3c')](_0x187358[_0x49c3('0x3b')],{'$or':_[_0x49c3('0x29')](_0x274ae8,function(_0x68a7f0){if(_0x68a7f0[_0x49c3('0x2d')]!==_0x49c3('0x3d')){var _0x42fdb4={};_0x42fdb4[_0x68a7f0[_0x49c3('0x27')]]={'$like':'%'+_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x3a')]+'%'};return _0x42fdb4;}})});}_0x187358=_[_0x49c3('0x3c')]({},_0x187358,_0x4c6082[_0x49c3('0x3e')]);var _0x55bf39={'where':_0x187358[_0x49c3('0x3b')]};return db[_0x49c3('0x2a')]['count'](_0x55bf39)[_0x49c3('0x24')](function(_0x4fb7c8){_0x5f030a[_0x49c3('0x3f')]=_0x4fb7c8;if(_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x40')]){_0x187358[_0x49c3('0x41')]=[{'all':!![]}];}return db[_0x49c3('0x2a')][_0x49c3('0x42')](_0x187358);})[_0x49c3('0x24')](function(_0xd5c2ba){_0x5f030a[_0x49c3('0x43')]=_0xd5c2ba;return _0x5f030a;})['then'](respondWithFilteredResult(_0x7ddc09,_0x187358))['catch'](handleError(_0x7ddc09,null));};exports[_0x49c3('0x44')]=function(_0x3ab780,_0x2f377b){var _0x962013={'raw':![],'where':{'id':_0x3ab780[_0x49c3('0x45')]['id']}},_0x40da0f={};_0x40da0f[_0x49c3('0x2e')]=_[_0x49c3('0x30')](db['ServicenowConfiguration'][_0x49c3('0x2b')]);_0x40da0f[_0x49c3('0x2f')]=_[_0x49c3('0x30')](_0x3ab780[_0x49c3('0x2f')]);_0x40da0f[_0x49c3('0x31')]=_[_0x49c3('0x32')](_0x40da0f[_0x49c3('0x2e')],_0x40da0f[_0x49c3('0x2f')]);_0x962013[_0x49c3('0x33')]=_[_0x49c3('0x32')](_0x40da0f[_0x49c3('0x2e')],qs['fields'](_0x3ab780[_0x49c3('0x2f')]['fields']));_0x962013['attributes']=_0x962013[_0x49c3('0x33')][_0x49c3('0x35')]?_0x962013[_0x49c3('0x33')]:_0x40da0f[_0x49c3('0x2e')];if(_0x3ab780[_0x49c3('0x2f')][_0x49c3('0x40')]){_0x962013[_0x49c3('0x41')]=[{'all':!![]}];}_0x962013=_[_0x49c3('0x3c')]({},_0x962013,_0x3ab780['options']);return db[_0x49c3('0x2a')]['find'](_0x962013)[_0x49c3('0x24')](handleEntityNotFound(_0x2f377b,null))[_0x49c3('0x24')](respondWithResult(_0x2f377b,null))[_0x49c3('0x46')](handleError(_0x2f377b,null));};exports[_0x49c3('0x47')]=function(_0x1e3f55,_0x29a691){return db[_0x49c3('0x2a')][_0x49c3('0x47')](_0x1e3f55['body'],{})[_0x49c3('0x24')](respondWithResult(_0x29a691,0xc9))[_0x49c3('0x46')](handleError(_0x29a691,null));};exports[_0x49c3('0x23')]=function(_0x5bf6d0,_0xae2331){if(_0x5bf6d0[_0x49c3('0x48')]['id']){delete _0x5bf6d0[_0x49c3('0x48')]['id'];}return db['ServicenowConfiguration'][_0x49c3('0x49')]({'where':{'id':_0x5bf6d0[_0x49c3('0x45')]['id']}})[_0x49c3('0x24')](handleEntityNotFound(_0xae2331,null))[_0x49c3('0x24')](saveUpdates(_0x5bf6d0[_0x49c3('0x48')],null))[_0x49c3('0x24')](respondWithResult(_0xae2331,null))[_0x49c3('0x46')](handleError(_0xae2331,null));};exports['destroy']=function(_0x3b77c3,_0x5cb9dd){return db[_0x49c3('0x2a')][_0x49c3('0x49')]({'where':{'id':_0x3b77c3['params']['id']}})['then'](handleEntityNotFound(_0x5cb9dd,null))[_0x49c3('0x24')](removeEntity(_0x5cb9dd,null))[_0x49c3('0x46')](handleError(_0x5cb9dd,null));};exports['getFields']=function(_0x2c8668,_0x222626,_0x3cb14c){var _0x9d3ad7={};var _0x4c1899={};var _0x5699f5;var _0x1502b4;return db[_0x49c3('0x2a')][_0x49c3('0x4a')]({'where':{'id':_0x2c8668[_0x49c3('0x45')]['id']}})[_0x49c3('0x24')](handleEntityNotFound(_0x222626,null))[_0x49c3('0x24')](function(_0x3de151){if(_0x3de151){_0x5699f5=_0x3de151;_0x4c1899[_0x49c3('0x2e')]=_[_0x49c3('0x30')](db[_0x49c3('0x4b')]['rawAttributes']);_0x4c1899[_0x49c3('0x2f')]=_[_0x49c3('0x30')](_0x2c8668[_0x49c3('0x2f')]);_0x4c1899['filters']=_[_0x49c3('0x32')](_0x4c1899[_0x49c3('0x2e')],_0x4c1899[_0x49c3('0x2f')]);_0x9d3ad7[_0x49c3('0x33')]=_[_0x49c3('0x32')](_0x4c1899['model'],qs[_0x49c3('0x34')](_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x34')]));_0x9d3ad7['attributes']=_0x9d3ad7[_0x49c3('0x33')][_0x49c3('0x35')]?_0x9d3ad7[_0x49c3('0x33')]:_0x4c1899[_0x49c3('0x2e')];_0x9d3ad7[_0x49c3('0x37')]=qs[_0x49c3('0x38')](_0x2c8668[_0x49c3('0x2f')]['sort']);_0x9d3ad7[_0x49c3('0x3b')]=qs[_0x49c3('0x31')](_[_0x49c3('0x39')](_0x2c8668[_0x49c3('0x2f')],_0x4c1899[_0x49c3('0x31')]));if(_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x3a')]){_0x9d3ad7['where']=_[_0x49c3('0x3c')](_0x9d3ad7[_0x49c3('0x3b')],{'$or':_[_0x49c3('0x29')](_0x9d3ad7['attributes'],function(_0x7764f6){var _0xed8b5d={};_0xed8b5d[_0x7764f6]={'$like':'%'+_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x3a')]+'%'};return _0xed8b5d;})});}_0x9d3ad7=_[_0x49c3('0x3c')]({},_0x9d3ad7,_0x2c8668[_0x49c3('0x3e')]);return _0x5699f5[_0x49c3('0x4c')](_0x9d3ad7);}})[_0x49c3('0x24')](function(_0x4566b1){if(_0x4566b1){_0x1502b4=_0x4566b1[_0x49c3('0x35')];if(!_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x36')](_0x49c3('0x4d'))){_0x9d3ad7[_0x49c3('0x1f')]=qs[_0x49c3('0x1f')](_0x2c8668[_0x49c3('0x2f')]['limit']);_0x9d3ad7[_0x49c3('0x1d')]=qs[_0x49c3('0x1d')](_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x1d')]);}return _0x5699f5['getFields'](_0x9d3ad7);}})['then'](function(_0x3d6e50){if(_0x3d6e50){return _0x3d6e50?{'count':_0x1502b4,'rows':_0x3d6e50}:null;}})[_0x49c3('0x24')](respondWithResult(_0x222626,null))[_0x49c3('0x46')](handleError(_0x222626,null));};exports[_0x49c3('0x4e')]=function(_0x48310c,_0x4bac78,_0x967419){var _0x2a3043={};var _0xb46861={};var _0x512329;var _0x104a58;return db['ServicenowConfiguration'][_0x49c3('0x4a')]({'where':{'id':_0x48310c[_0x49c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bac78,null))[_0x49c3('0x24')](function(_0x19db33){if(_0x19db33){_0x512329=_0x19db33;_0xb46861[_0x49c3('0x2e')]=_['keys'](db[_0x49c3('0x4b')][_0x49c3('0x2b')]);_0xb46861['query']=_[_0x49c3('0x30')](_0x48310c[_0x49c3('0x2f')]);_0xb46861[_0x49c3('0x31')]=_[_0x49c3('0x32')](_0xb46861[_0x49c3('0x2e')],_0xb46861[_0x49c3('0x2f')]);_0x2a3043[_0x49c3('0x33')]=_[_0x49c3('0x32')](_0xb46861[_0x49c3('0x2e')],qs['fields'](_0x48310c[_0x49c3('0x2f')][_0x49c3('0x34')]));_0x2a3043[_0x49c3('0x33')]=_0x2a3043[_0x49c3('0x33')][_0x49c3('0x35')]?_0x2a3043['attributes']:_0xb46861['model'];_0x2a3043[_0x49c3('0x37')]=qs[_0x49c3('0x38')](_0x48310c[_0x49c3('0x2f')][_0x49c3('0x38')]);_0x2a3043[_0x49c3('0x3b')]=qs[_0x49c3('0x31')](_[_0x49c3('0x39')](_0x48310c[_0x49c3('0x2f')],_0xb46861[_0x49c3('0x31')]));if(_0x48310c['query']['filter']){_0x2a3043[_0x49c3('0x3b')]=_[_0x49c3('0x3c')](_0x2a3043[_0x49c3('0x3b')],{'$or':_[_0x49c3('0x29')](_0x2a3043[_0x49c3('0x33')],function(_0x5ad009){var _0x27c9e9={};_0x27c9e9[_0x5ad009]={'$like':'%'+_0x48310c['query'][_0x49c3('0x3a')]+'%'};return _0x27c9e9;})});}_0x2a3043=_[_0x49c3('0x3c')]({},_0x2a3043,_0x48310c[_0x49c3('0x3e')]);return _0x512329[_0x49c3('0x4e')](_0x2a3043);}})[_0x49c3('0x24')](function(_0xa6dad3){if(_0xa6dad3){_0x104a58=_0xa6dad3[_0x49c3('0x35')];if(!_0x48310c['query']['hasOwnProperty'](_0x49c3('0x4d'))){_0x2a3043[_0x49c3('0x1f')]=qs[_0x49c3('0x1f')](_0x48310c[_0x49c3('0x2f')][_0x49c3('0x1f')]);_0x2a3043[_0x49c3('0x1d')]=qs[_0x49c3('0x1d')](_0x48310c[_0x49c3('0x2f')][_0x49c3('0x1d')]);}return _0x512329[_0x49c3('0x4e')](_0x2a3043);}})['then'](function(_0xb7b449){if(_0xb7b449){return _0xb7b449?{'count':_0x104a58,'rows':_0xb7b449}:null;}})[_0x49c3('0x24')](respondWithResult(_0x4bac78,null))['catch'](handleError(_0x4bac78,null));};exports[_0x49c3('0x4f')]=function(_0x3dd068,_0x4454fa,_0x3f4624){var _0x4198d4={};var _0x5cec92={};var _0x1c3f34;var _0x47872f;return db[_0x49c3('0x2a')][_0x49c3('0x4a')]({'where':{'id':_0x3dd068['params']['id']}})['then'](handleEntityNotFound(_0x4454fa,null))['then'](function(_0x42c334){if(_0x42c334){_0x1c3f34=_0x42c334;_0x5cec92[_0x49c3('0x2e')]=_[_0x49c3('0x30')](db[_0x49c3('0x4b')][_0x49c3('0x2b')]);_0x5cec92[_0x49c3('0x2f')]=_[_0x49c3('0x30')](_0x3dd068[_0x49c3('0x2f')]);_0x5cec92['filters']=_['intersection'](_0x5cec92['model'],_0x5cec92[_0x49c3('0x2f')]);_0x4198d4['attributes']=_[_0x49c3('0x32')](_0x5cec92['model'],qs[_0x49c3('0x34')](_0x3dd068['query'][_0x49c3('0x34')]));_0x4198d4['attributes']=_0x4198d4['attributes'][_0x49c3('0x35')]?_0x4198d4[_0x49c3('0x33')]:_0x5cec92[_0x49c3('0x2e')];_0x4198d4['order']=qs['sort'](_0x3dd068[_0x49c3('0x2f')]['sort']);_0x4198d4['where']=qs[_0x49c3('0x31')](_['pick'](_0x3dd068[_0x49c3('0x2f')],_0x5cec92[_0x49c3('0x31')]));if(_0x3dd068[_0x49c3('0x2f')][_0x49c3('0x3a')]){_0x4198d4['where']=_[_0x49c3('0x3c')](_0x4198d4[_0x49c3('0x3b')],{'$or':_[_0x49c3('0x29')](_0x4198d4[_0x49c3('0x33')],function(_0x5a6cb0){var _0x43a049={};_0x43a049[_0x5a6cb0]={'$like':'%'+_0x3dd068[_0x49c3('0x2f')]['filter']+'%'};return _0x43a049;})});}_0x4198d4=_[_0x49c3('0x3c')]({},_0x4198d4,_0x3dd068[_0x49c3('0x3e')]);return _0x1c3f34[_0x49c3('0x4f')](_0x4198d4);}})[_0x49c3('0x24')](function(_0x572a1e){if(_0x572a1e){_0x47872f=_0x572a1e[_0x49c3('0x35')];if(!_0x3dd068[_0x49c3('0x2f')][_0x49c3('0x36')]('nolimit')){_0x4198d4[_0x49c3('0x1f')]=qs['limit'](_0x3dd068[_0x49c3('0x2f')][_0x49c3('0x1f')]);_0x4198d4[_0x49c3('0x1d')]=qs[_0x49c3('0x1d')](_0x3dd068[_0x49c3('0x2f')][_0x49c3('0x1d')]);}return _0x1c3f34[_0x49c3('0x4f')](_0x4198d4);}})['then'](function(_0x40fa07){if(_0x40fa07){return _0x40fa07?{'count':_0x47872f,'rows':_0x40fa07}:null;}})[_0x49c3('0x24')](respondWithResult(_0x4454fa,null))[_0x49c3('0x46')](handleError(_0x4454fa,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 46035c8..31780d7 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 _0x505d=['./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2dfd4b,_0x5704b5){var _0x407930=function(_0x47c9c9){while(--_0x47c9c9){_0x2dfd4b['push'](_0x2dfd4b['shift']());}};_0x407930(++_0x5704b5);}(_0x505d,0x93));var _0xd505=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x505d[_0x11ca63];return _0x41f1f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd505('0x0'))(_0xd505('0x1'));var moment=require(_0xd505('0x2'));var BPromise=require(_0xd505('0x3'));var rp=require(_0xd505('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd505('0x5'));var config=require(_0xd505('0x6'));var attributes=require(_0xd505('0x7'));module[_0xd505('0x8')]=function(_0x4ab634,_0x3a2863){return _0x4ab634['define'](_0xd505('0x9'),attributes,{'tableName':_0xd505('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34bd=['../../config/environment','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x34bd,0x1d2));var _0xd34b=function(_0x3f7982,_0x24c737){_0x3f7982=_0x3f7982-0x0;var _0x4e6a0d=_0x34bd[_0x3f7982];return _0x4e6a0d;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd34b('0x1'));var moment=require(_0xd34b('0x2'));var BPromise=require(_0xd34b('0x3'));var rp=require(_0xd34b('0x4'));var fs=require('fs');var path=require(_0xd34b('0x5'));var rimraf=require(_0xd34b('0x6'));var config=require(_0xd34b('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xd34b('0x8')]=function(_0x5d161e,_0x4e6e94){return _0x5d161e['define'](_0xd34b('0x9'),attributes,{'tableName':_0xd34b('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 125d4bb..21d5d6c 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 _0xe83e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1ee767,_0x252b8d){var _0x2b09b5=function(_0x1e1840){while(--_0x1e1840){_0x1ee767['push'](_0x1ee767['shift']());}};_0x2b09b5(++_0x252b8d);}(_0xe83e,0x7a));var _0xee83=function(_0x368bd6,_0x42dbc9){_0x368bd6=_0x368bd6-0x0;var _0x315e87=_0xe83e[_0x368bd6];return _0x315e87;};'use strict';var _=require(_0xee83('0x0'));var util=require(_0xee83('0x1'));var moment=require(_0xee83('0x2'));var BPromise=require(_0xee83('0x3'));var rs=require(_0xee83('0x4'));var fs=require('fs');var Redis=require(_0xee83('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xee83('0x6'))(_0xee83('0x7'));var config=require(_0xee83('0x8'));var jayson=require(_0xee83('0x9'));var client=jayson[_0xee83('0xa')][_0xee83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12f57c,_0x4aeb37,_0x133ae6){return new BPromise(function(_0x223bdc,_0x4098f3){return client[_0xee83('0xc')](_0x12f57c,_0x133ae6)[_0xee83('0xd')](function(_0x48857c){logger[_0xee83('0xe')](_0xee83('0xf'),_0x4aeb37,_0xee83('0x10'));logger[_0xee83('0x11')](_0xee83('0x12'),_0x4aeb37,_0xee83('0x10'),JSON[_0xee83('0x13')](_0x48857c));if(_0x48857c[_0xee83('0x14')]){if(_0x48857c[_0xee83('0x14')]['code']===0x1f4){logger['error'](_0xee83('0xf'),_0x4aeb37,_0x48857c[_0xee83('0x14')][_0xee83('0x15')]);return _0x4098f3(_0x48857c[_0xee83('0x14')][_0xee83('0x15')]);}logger[_0xee83('0x14')](_0xee83('0xf'),_0x4aeb37,_0x48857c[_0xee83('0x14')]['message']);return _0x223bdc(_0x48857c['error'][_0xee83('0x15')]);}else{logger[_0xee83('0xe')](_0xee83('0xf'),_0x4aeb37,_0xee83('0x10'));_0x223bdc(_0x48857c[_0xee83('0x16')][_0xee83('0x15')]);}})[_0xee83('0x17')](function(_0x2443dd){logger[_0xee83('0x14')](_0xee83('0xf'),_0x4aeb37,_0x2443dd);_0x4098f3(_0x2443dd);});});} \ No newline at end of file +var _0x89d6=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x48b724,_0x5a8e26){var _0x4d38b3=function(_0xef820f){while(--_0xef820f){_0x48b724['push'](_0x48b724['shift']());}};_0x4d38b3(++_0x5a8e26);}(_0x89d6,0x119));var _0x689d=function(_0x1791d9,_0x438e56){_0x1791d9=_0x1791d9-0x0;var _0x1905d0=_0x89d6[_0x1791d9];return _0x1905d0;};'use strict';var _=require(_0x689d('0x0'));var util=require(_0x689d('0x1'));var moment=require(_0x689d('0x2'));var BPromise=require(_0x689d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x689d('0x4'));var db=require(_0x689d('0x5'))['db'];var utils=require(_0x689d('0x6'));var logger=require('../../config/logger')(_0x689d('0x7'));var config=require(_0x689d('0x8'));var jayson=require(_0x689d('0x9'));var client=jayson[_0x689d('0xa')][_0x689d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x255067,_0x5beecb,_0x1ff5b5){return new BPromise(function(_0x25bda4,_0xaa8c77){return client['request'](_0x255067,_0x1ff5b5)['then'](function(_0x34d080){logger[_0x689d('0xc')](_0x689d('0xd'),_0x5beecb,_0x689d('0xe'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5beecb,_0x689d('0xe'),JSON[_0x689d('0xf')](_0x34d080));if(_0x34d080[_0x689d('0x10')]){if(_0x34d080[_0x689d('0x10')]['code']===0x1f4){logger[_0x689d('0x10')](_0x689d('0xd'),_0x5beecb,_0x34d080['error'][_0x689d('0x11')]);return _0xaa8c77(_0x34d080[_0x689d('0x10')][_0x689d('0x11')]);}logger[_0x689d('0x10')](_0x689d('0xd'),_0x5beecb,_0x34d080['error'][_0x689d('0x11')]);return _0x25bda4(_0x34d080[_0x689d('0x10')]['message']);}else{logger['info'](_0x689d('0xd'),_0x5beecb,_0x689d('0xe'));_0x25bda4(_0x34d080[_0x689d('0x12')][_0x689d('0x11')]);}})[_0x689d('0x13')](function(_0x561301){logger[_0x689d('0x10')](_0x689d('0xd'),_0x5beecb,_0x561301);_0xaa8c77(_0x561301);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index fb878a8..db4b8b4 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 _0x546c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x546c,0x1c7));var _0xc546=function(_0x5085c6,_0x331a5a){_0x5085c6=_0x5085c6-0x0;var _0x572ec7=_0x546c[_0x5085c6];return _0x572ec7;};'use strict';var multer=require('multer');var util=require(_0xc546('0x0'));var path=require(_0xc546('0x1'));var timeout=require(_0xc546('0x2'));var express=require(_0xc546('0x3'));var router=express[_0xc546('0x4')]();var fs_extra=require(_0xc546('0x5'));var auth=require(_0xc546('0x6'));var interaction=require(_0xc546('0x7'));var config=require(_0xc546('0x8'));var controller=require(_0xc546('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc546('0xa')]);router['get'](_0xc546('0xb'),auth[_0xc546('0xc')](),controller[_0xc546('0xd')]);router[_0xc546('0xe')]('/',auth[_0xc546('0xc')](),controller['create']);router[_0xc546('0xf')]('/:id',auth[_0xc546('0xc')](),controller[_0xc546('0x10')]);router[_0xc546('0x11')](_0xc546('0xb'),auth[_0xc546('0xc')](),controller[_0xc546('0x12')]);module[_0xc546('0x13')]=router; \ No newline at end of file +var _0x0630=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x60fb77,_0x207152){var _0x29bba5=function(_0x23516a){while(--_0x23516a){_0x60fb77['push'](_0x60fb77['shift']());}};_0x29bba5(++_0x207152);}(_0x0630,0x139));var _0x0063=function(_0x3fbaa9,_0x785b01){_0x3fbaa9=_0x3fbaa9-0x0;var _0x16461e=_0x0630[_0x3fbaa9];return _0x16461e;};'use strict';var multer=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var path=require(_0x0063('0x2'));var timeout=require(_0x0063('0x3'));var express=require(_0x0063('0x4'));var router=express[_0x0063('0x5')]();var fs_extra=require(_0x0063('0x6'));var auth=require(_0x0063('0x7'));var interaction=require(_0x0063('0x8'));var config=require(_0x0063('0x9'));var controller=require(_0x0063('0xa'));router['get']('/',auth[_0x0063('0xb')](),controller[_0x0063('0xc')]);router[_0x0063('0xd')](_0x0063('0xe'),auth[_0x0063('0xb')](),controller[_0x0063('0xf')]);router[_0x0063('0x10')]('/',auth[_0x0063('0xb')](),controller['create']);router[_0x0063('0x11')](_0x0063('0xe'),auth[_0x0063('0xb')](),controller[_0x0063('0x12')]);router['delete'](_0x0063('0xe'),auth[_0x0063('0xb')](),controller[_0x0063('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 77c5d6d..08b13af 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 _0xe591=['sequelize','exports','ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN'];(function(_0x48e52d,_0x27b477){var _0x870b49=function(_0x32fdd3){while(--_0x32fdd3){_0x48e52d['push'](_0x48e52d['shift']());}};_0x870b49(++_0x27b477);}(_0xe591,0xcf));var _0x1e59=function(_0x458f02,_0x2afa3d){_0x458f02=_0x458f02-0x0;var _0x34abd3=_0xe591[_0x458f02];return _0x34abd3;};'use strict';var Sequelize=require(_0x1e59('0x0'));module[_0x1e59('0x1')]={'type':{'type':Sequelize[_0x1e59('0x2')]('string',_0x1e59('0x3'),_0x1e59('0x4'),'keyValue',_0x1e59('0x5')),'defaultValue':_0x1e59('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1e59('0x7')]},'keyType':{'type':Sequelize[_0x1e59('0x2')](_0x1e59('0x6'),_0x1e59('0x3'),_0x1e59('0x4'))},'keyContent':{'type':Sequelize[_0x1e59('0x7')]},'idField':{'type':Sequelize[_0x1e59('0x7')]},'nameField':{'type':Sequelize[_0x1e59('0x7')]},'customField':{'type':Sequelize[_0x1e59('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb0cb=['ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x31eba9,_0x4f0761){var _0x5a9d5a=function(_0x11db32){while(--_0x11db32){_0x31eba9['push'](_0x31eba9['shift']());}};_0x5a9d5a(++_0x4f0761);}(_0xb0cb,0x1c9));var _0xbb0c=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb0cb[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0xbb0c('0x0'));module[_0xbb0c('0x1')]={'type':{'type':Sequelize[_0xbb0c('0x2')](_0xbb0c('0x3'),_0xbb0c('0x4'),'customVariable',_0xbb0c('0x5'),_0xbb0c('0x6')),'defaultValue':_0xbb0c('0x3')},'content':{'type':Sequelize[_0xbb0c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbb0c('0x2')]('string',_0xbb0c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xbb0c('0x7')]},'idField':{'type':Sequelize[_0xbb0c('0x7')]},'nameField':{'type':Sequelize[_0xbb0c('0x7')]},'customField':{'type':Sequelize[_0xbb0c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb0c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0ba2480..d05e20c 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 _0x0062=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','ServicenowField','findAll','show','params','includeAll','create','body','find','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0x0062,0x11e));var _0x2006=function(_0x57928b,_0x29a111){_0x57928b=_0x57928b-0x0;var _0x49aad6=_0x0062[_0x57928b];return _0x49aad6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2006('0x0'));var jsonpatch=require(_0x2006('0x1'));var rp=require(_0x2006('0x2'));var moment=require(_0x2006('0x3'));var BPromise=require(_0x2006('0x4'));var Mustache=require(_0x2006('0x5'));var util=require('util');var path=require(_0x2006('0x6'));var sox=require(_0x2006('0x7'));var csv=require('to-csv');var ejs=require(_0x2006('0x8'));var fs=require('fs');var fs_extra=require(_0x2006('0x9'));var _=require(_0x2006('0xa'));var squel=require('squel');var crypto=require(_0x2006('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2006('0xc'));var toCsv=require(_0x2006('0xd'));var querystring=require(_0x2006('0xe'));var Papa=require('papaparse');var Redis=require(_0x2006('0xf'));var authService=require(_0x2006('0x10'));var qs=require(_0x2006('0x11'));var as=require(_0x2006('0x12'));var hardwareService=require(_0x2006('0x13'));var logger=require(_0x2006('0x14'))(_0x2006('0x15'));var utils=require(_0x2006('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2006('0x17'));var db=require(_0x2006('0x18'))['db'];function respondWithStatusCode(_0x3e86fd,_0xb5939){_0xb5939=_0xb5939||0xcc;return function(_0x5440fa){if(_0x5440fa){return _0x3e86fd[_0x2006('0x19')](_0xb5939);}return _0x3e86fd[_0x2006('0x1a')](_0xb5939)['end']();};}function respondWithResult(_0x4bac89,_0x120d13){_0x120d13=_0x120d13||0xc8;return function(_0x30d35b){if(_0x30d35b){return _0x4bac89[_0x2006('0x1a')](_0x120d13)[_0x2006('0x1b')](_0x30d35b);}};}function respondWithFilteredResult(_0x37de55,_0x36f604){return function(_0x3c65b6){if(_0x3c65b6){var _0x459543=typeof _0x36f604[_0x2006('0x1c')]===_0x2006('0x1d')&&typeof _0x36f604[_0x2006('0x1e')]==='undefined';var _0x166311=_0x3c65b6['count'];var _0x12ec5=_0x459543?0x0:_0x36f604['offset'];var _0x571268=_0x459543?_0x3c65b6[_0x2006('0x1f')]:_0x36f604[_0x2006('0x1c')]+_0x36f604[_0x2006('0x1e')];var _0x585fcb;if(_0x571268>=_0x166311){_0x571268=_0x166311;_0x585fcb=0xc8;}else{_0x585fcb=0xce;}_0x37de55[_0x2006('0x1a')](_0x585fcb);return _0x37de55['set'](_0x2006('0x20'),_0x12ec5+'-'+_0x571268+'/'+_0x166311)[_0x2006('0x1b')](_0x3c65b6);}return null;};}function patchUpdates(_0x433062){return function(_0x1822d4){try{jsonpatch[_0x2006('0x21')](_0x1822d4,_0x433062,!![]);}catch(_0x4d8365){return BPromise['reject'](_0x4d8365);}return _0x1822d4[_0x2006('0x22')]();};}function saveUpdates(_0x4c9d7e,_0x53b062){return function(_0x1ece64){if(_0x1ece64){return _0x1ece64[_0x2006('0x23')](_0x4c9d7e)['then'](function(_0x3e88cc){return _0x3e88cc;});}return null;};}function removeEntity(_0x967a2f,_0x42f5f3){return function(_0x36438a){if(_0x36438a){return _0x36438a[_0x2006('0x24')]()[_0x2006('0x25')](function(){_0x967a2f[_0x2006('0x1a')](0xcc)[_0x2006('0x26')]();});}};}function handleEntityNotFound(_0x2b30ad,_0x6b4980){return function(_0x3e1ab5){if(!_0x3e1ab5){_0x2b30ad['sendStatus'](0x194);}return _0x3e1ab5;};}function handleError(_0x34837c,_0x4a6fb0){_0x4a6fb0=_0x4a6fb0||0x1f4;return function(_0x23055b){logger['error'](_0x23055b[_0x2006('0x27')]);if(_0x23055b[_0x2006('0x28')]){delete _0x23055b[_0x2006('0x28')];}_0x34837c[_0x2006('0x1a')](_0x4a6fb0)[_0x2006('0x29')](_0x23055b);};}exports[_0x2006('0x2a')]=function(_0x196680,_0x346104){var _0x56cf06={},_0x29cc69={},_0x514fbf={'count':0x0,'rows':[]};var _0x3dcb37=_[_0x2006('0x2b')](db['ServicenowField'][_0x2006('0x2c')],function(_0xe62bd0){return{'name':_0xe62bd0[_0x2006('0x2d')],'type':_0xe62bd0['type'][_0x2006('0x2e')]};});_0x29cc69[_0x2006('0x2f')]=_[_0x2006('0x2b')](_0x3dcb37,_0x2006('0x28'));_0x29cc69[_0x2006('0x30')]=_[_0x2006('0x31')](_0x196680[_0x2006('0x30')]);_0x29cc69[_0x2006('0x32')]=_['intersection'](_0x29cc69[_0x2006('0x2f')],_0x29cc69['query']);_0x56cf06[_0x2006('0x33')]=_[_0x2006('0x34')](_0x29cc69['model'],qs[_0x2006('0x35')](_0x196680[_0x2006('0x30')][_0x2006('0x35')]));_0x56cf06[_0x2006('0x33')]=_0x56cf06[_0x2006('0x33')][_0x2006('0x36')]?_0x56cf06[_0x2006('0x33')]:_0x29cc69['model'];if(!_0x196680[_0x2006('0x30')][_0x2006('0x37')](_0x2006('0x38'))){_0x56cf06['limit']=qs[_0x2006('0x1e')](_0x196680[_0x2006('0x30')][_0x2006('0x1e')]);_0x56cf06[_0x2006('0x1c')]=qs[_0x2006('0x1c')](_0x196680[_0x2006('0x30')][_0x2006('0x1c')]);}_0x56cf06[_0x2006('0x39')]=qs[_0x2006('0x3a')](_0x196680[_0x2006('0x30')]['sort']);_0x56cf06[_0x2006('0x3b')]=qs[_0x2006('0x32')](_['pick'](_0x196680[_0x2006('0x30')],_0x29cc69['filters']),_0x3dcb37);if(_0x196680[_0x2006('0x30')][_0x2006('0x3c')]){_0x56cf06[_0x2006('0x3b')]=_['merge'](_0x56cf06[_0x2006('0x3b')],{'$or':_['map'](_0x3dcb37,function(_0x1a74b4){if(_0x1a74b4[_0x2006('0x3d')]!==_0x2006('0x3e')){var _0x1c9a96={};_0x1c9a96[_0x1a74b4[_0x2006('0x28')]]={'$like':'%'+_0x196680[_0x2006('0x30')]['filter']+'%'};return _0x1c9a96;}})});}_0x56cf06=_[_0x2006('0x3f')]({},_0x56cf06,_0x196680[_0x2006('0x40')]);var _0x107cf5={'where':_0x56cf06['where']};return db['ServicenowField'][_0x2006('0x1f')](_0x107cf5)[_0x2006('0x25')](function(_0x1b7ef7){_0x514fbf[_0x2006('0x1f')]=_0x1b7ef7;if(_0x196680[_0x2006('0x30')]['includeAll']){_0x56cf06[_0x2006('0x41')]=[{'all':!![]}];}return db[_0x2006('0x42')][_0x2006('0x43')](_0x56cf06);})[_0x2006('0x25')](function(_0x5d63a6){_0x514fbf['rows']=_0x5d63a6;return _0x514fbf;})[_0x2006('0x25')](respondWithFilteredResult(_0x346104,_0x56cf06))['catch'](handleError(_0x346104,null));};exports[_0x2006('0x44')]=function(_0x3328c6,_0x10f652){var _0x512927={'raw':!![],'where':{'id':_0x3328c6[_0x2006('0x45')]['id']}},_0x5d9e7d={};_0x5d9e7d[_0x2006('0x2f')]=_['keys'](db[_0x2006('0x42')][_0x2006('0x2c')]);_0x5d9e7d[_0x2006('0x30')]=_[_0x2006('0x31')](_0x3328c6[_0x2006('0x30')]);_0x5d9e7d[_0x2006('0x32')]=_[_0x2006('0x34')](_0x5d9e7d[_0x2006('0x2f')],_0x5d9e7d[_0x2006('0x30')]);_0x512927[_0x2006('0x33')]=_['intersection'](_0x5d9e7d['model'],qs[_0x2006('0x35')](_0x3328c6[_0x2006('0x30')][_0x2006('0x35')]));_0x512927['attributes']=_0x512927[_0x2006('0x33')]['length']?_0x512927[_0x2006('0x33')]:_0x5d9e7d[_0x2006('0x2f')];if(_0x3328c6[_0x2006('0x30')][_0x2006('0x46')]){_0x512927[_0x2006('0x41')]=[{'all':!![]}];}_0x512927=_[_0x2006('0x3f')]({},_0x512927,_0x3328c6[_0x2006('0x40')]);return db['ServicenowField']['find'](_0x512927)[_0x2006('0x25')](handleEntityNotFound(_0x10f652,null))[_0x2006('0x25')](respondWithResult(_0x10f652,null))['catch'](handleError(_0x10f652,null));};exports[_0x2006('0x47')]=function(_0x951053,_0x9e36be){return db[_0x2006('0x42')][_0x2006('0x47')](_0x951053[_0x2006('0x48')],{})[_0x2006('0x25')](respondWithResult(_0x9e36be,0xc9))['catch'](handleError(_0x9e36be,null));};exports['update']=function(_0x3ec380,_0x3b2a4d){if(_0x3ec380[_0x2006('0x48')]['id']){delete _0x3ec380[_0x2006('0x48')]['id'];}return db['ServicenowField'][_0x2006('0x49')]({'where':{'id':_0x3ec380[_0x2006('0x45')]['id']}})[_0x2006('0x25')](handleEntityNotFound(_0x3b2a4d,null))['then'](saveUpdates(_0x3ec380[_0x2006('0x48')],null))[_0x2006('0x25')](respondWithResult(_0x3b2a4d,null))[_0x2006('0x4a')](handleError(_0x3b2a4d,null));};exports[_0x2006('0x24')]=function(_0x5f1891,_0x3527ff){return db[_0x2006('0x42')][_0x2006('0x49')]({'where':{'id':_0x5f1891[_0x2006('0x45')]['id']}})['then'](handleEntityNotFound(_0x3527ff,null))[_0x2006('0x25')](removeEntity(_0x3527ff,null))[_0x2006('0x4a')](handleError(_0x3527ff,null));}; \ No newline at end of file +var _0xd83f=['util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','end','name','send','index','ServicenowField','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','length','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1b290e,_0x29facf){var _0x3ecda0=function(_0x482154){while(--_0x482154){_0x1b290e['push'](_0x1b290e['shift']());}};_0x3ecda0(++_0x29facf);}(_0xd83f,0x1dc));var _0xfd83=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd83f[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xfd83('0x0'));var rimraf=require(_0xfd83('0x1'));var zipdir=require(_0xfd83('0x2'));var jsonpatch=require(_0xfd83('0x3'));var rp=require('request-promise');var moment=require(_0xfd83('0x4'));var BPromise=require(_0xfd83('0x5'));var Mustache=require(_0xfd83('0x6'));var util=require(_0xfd83('0x7'));var path=require(_0xfd83('0x8'));var sox=require(_0xfd83('0x9'));var csv=require(_0xfd83('0xa'));var ejs=require(_0xfd83('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfd83('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd83('0xd'));var toCsv=require(_0xfd83('0xa'));var querystring=require(_0xfd83('0xe'));var Papa=require(_0xfd83('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfd83('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd83('0x11'));var logger=require(_0xfd83('0x12'))('api');var utils=require(_0xfd83('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfd83('0x14'));var db=require(_0xfd83('0x15'))['db'];function respondWithStatusCode(_0x3b3194,_0x230577){_0x230577=_0x230577||0xcc;return function(_0x43ecbd){if(_0x43ecbd){return _0x3b3194[_0xfd83('0x16')](_0x230577);}return _0x3b3194[_0xfd83('0x17')](_0x230577)['end']();};}function respondWithResult(_0x271acb,_0x2a75e1){_0x2a75e1=_0x2a75e1||0xc8;return function(_0x29e232){if(_0x29e232){return _0x271acb['status'](_0x2a75e1)[_0xfd83('0x18')](_0x29e232);}};}function respondWithFilteredResult(_0x1e4d4b,_0x219ac9){return function(_0xab984d){if(_0xab984d){var _0x2c8425=typeof _0x219ac9[_0xfd83('0x19')]===_0xfd83('0x1a')&&typeof _0x219ac9[_0xfd83('0x1b')]==='undefined';var _0x2142b9=_0xab984d[_0xfd83('0x1c')];var _0x4bbf4f=_0x2c8425?0x0:_0x219ac9[_0xfd83('0x19')];var _0x269ae7=_0x2c8425?_0xab984d[_0xfd83('0x1c')]:_0x219ac9[_0xfd83('0x19')]+_0x219ac9['limit'];var _0x1a008e;if(_0x269ae7>=_0x2142b9){_0x269ae7=_0x2142b9;_0x1a008e=0xc8;}else{_0x1a008e=0xce;}_0x1e4d4b[_0xfd83('0x17')](_0x1a008e);return _0x1e4d4b[_0xfd83('0x1d')](_0xfd83('0x1e'),_0x4bbf4f+'-'+_0x269ae7+'/'+_0x2142b9)['json'](_0xab984d);}return null;};}function patchUpdates(_0x31fb16){return function(_0x506389){try{jsonpatch[_0xfd83('0x1f')](_0x506389,_0x31fb16,!![]);}catch(_0x416870){return BPromise['reject'](_0x416870);}return _0x506389['save']();};}function saveUpdates(_0x958b4,_0x3535fc){return function(_0xccb780){if(_0xccb780){return _0xccb780[_0xfd83('0x20')](_0x958b4)[_0xfd83('0x21')](function(_0x58facb){return _0x58facb;});}return null;};}function removeEntity(_0x36151f,_0x5513e2){return function(_0x4f34c7){if(_0x4f34c7){return _0x4f34c7['destroy']()['then'](function(){_0x36151f[_0xfd83('0x17')](0xcc)[_0xfd83('0x22')]();});}};}function handleEntityNotFound(_0x47b87d,_0x2a3f59){return function(_0x210479){if(!_0x210479){_0x47b87d['sendStatus'](0x194);}return _0x210479;};}function handleError(_0xe38b6c,_0x4701f2){_0x4701f2=_0x4701f2||0x1f4;return function(_0x5d37bd){logger['error'](_0x5d37bd['stack']);if(_0x5d37bd[_0xfd83('0x23')]){delete _0x5d37bd[_0xfd83('0x23')];}_0xe38b6c[_0xfd83('0x17')](_0x4701f2)[_0xfd83('0x24')](_0x5d37bd);};}exports[_0xfd83('0x25')]=function(_0x4329f7,_0x3ef094){var _0xedd795={},_0xefb1a1={},_0x42b5ea={'count':0x0,'rows':[]};var _0x2a8bfc=_['map'](db[_0xfd83('0x26')][_0xfd83('0x27')],function(_0x3c4ad9){return{'name':_0x3c4ad9['fieldName'],'type':_0x3c4ad9[_0xfd83('0x28')]['key']};});_0xefb1a1[_0xfd83('0x29')]=_['map'](_0x2a8bfc,_0xfd83('0x23'));_0xefb1a1[_0xfd83('0x2a')]=_['keys'](_0x4329f7[_0xfd83('0x2a')]);_0xefb1a1[_0xfd83('0x2b')]=_['intersection'](_0xefb1a1['model'],_0xefb1a1[_0xfd83('0x2a')]);_0xedd795[_0xfd83('0x2c')]=_[_0xfd83('0x2d')](_0xefb1a1[_0xfd83('0x29')],qs['fields'](_0x4329f7['query'][_0xfd83('0x2e')]));_0xedd795[_0xfd83('0x2c')]=_0xedd795[_0xfd83('0x2c')]['length']?_0xedd795['attributes']:_0xefb1a1['model'];if(!_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x2f')](_0xfd83('0x30'))){_0xedd795[_0xfd83('0x1b')]=qs[_0xfd83('0x1b')](_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x1b')]);_0xedd795[_0xfd83('0x19')]=qs[_0xfd83('0x19')](_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x19')]);}_0xedd795['order']=qs['sort'](_0x4329f7['query'][_0xfd83('0x31')]);_0xedd795[_0xfd83('0x32')]=qs[_0xfd83('0x2b')](_['pick'](_0x4329f7[_0xfd83('0x2a')],_0xefb1a1[_0xfd83('0x2b')]),_0x2a8bfc);if(_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x33')]){_0xedd795[_0xfd83('0x32')]=_['merge'](_0xedd795[_0xfd83('0x32')],{'$or':_[_0xfd83('0x34')](_0x2a8bfc,function(_0x413178){if(_0x413178[_0xfd83('0x28')]!==_0xfd83('0x35')){var _0x484fa2={};_0x484fa2[_0x413178['name']]={'$like':'%'+_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x33')]+'%'};return _0x484fa2;}})});}_0xedd795=_[_0xfd83('0x36')]({},_0xedd795,_0x4329f7[_0xfd83('0x37')]);var _0xced076={'where':_0xedd795['where']};return db[_0xfd83('0x26')][_0xfd83('0x1c')](_0xced076)['then'](function(_0x4c3acf){_0x42b5ea[_0xfd83('0x1c')]=_0x4c3acf;if(_0x4329f7[_0xfd83('0x2a')]['includeAll']){_0xedd795[_0xfd83('0x38')]=[{'all':!![]}];}return db[_0xfd83('0x26')][_0xfd83('0x39')](_0xedd795);})['then'](function(_0x1ec54f){_0x42b5ea[_0xfd83('0x3a')]=_0x1ec54f;return _0x42b5ea;})['then'](respondWithFilteredResult(_0x3ef094,_0xedd795))[_0xfd83('0x3b')](handleError(_0x3ef094,null));};exports[_0xfd83('0x3c')]=function(_0x5d587f,_0x4dfff8){var _0x101599={'raw':!![],'where':{'id':_0x5d587f[_0xfd83('0x3d')]['id']}},_0xadfb53={};_0xadfb53[_0xfd83('0x29')]=_[_0xfd83('0x3e')](db[_0xfd83('0x26')][_0xfd83('0x27')]);_0xadfb53['query']=_[_0xfd83('0x3e')](_0x5d587f['query']);_0xadfb53[_0xfd83('0x2b')]=_[_0xfd83('0x2d')](_0xadfb53[_0xfd83('0x29')],_0xadfb53[_0xfd83('0x2a')]);_0x101599[_0xfd83('0x2c')]=_[_0xfd83('0x2d')](_0xadfb53[_0xfd83('0x29')],qs[_0xfd83('0x2e')](_0x5d587f[_0xfd83('0x2a')]['fields']));_0x101599[_0xfd83('0x2c')]=_0x101599['attributes'][_0xfd83('0x3f')]?_0x101599[_0xfd83('0x2c')]:_0xadfb53['model'];if(_0x5d587f[_0xfd83('0x2a')][_0xfd83('0x40')]){_0x101599[_0xfd83('0x38')]=[{'all':!![]}];}_0x101599=_[_0xfd83('0x36')]({},_0x101599,_0x5d587f['options']);return db[_0xfd83('0x26')]['find'](_0x101599)['then'](handleEntityNotFound(_0x4dfff8,null))[_0xfd83('0x21')](respondWithResult(_0x4dfff8,null))[_0xfd83('0x3b')](handleError(_0x4dfff8,null));};exports[_0xfd83('0x41')]=function(_0x3996cf,_0xd7cbf1){return db[_0xfd83('0x26')][_0xfd83('0x41')](_0x3996cf[_0xfd83('0x42')],{})[_0xfd83('0x21')](respondWithResult(_0xd7cbf1,0xc9))[_0xfd83('0x3b')](handleError(_0xd7cbf1,null));};exports[_0xfd83('0x20')]=function(_0xdfbc61,_0x5c9a76){if(_0xdfbc61[_0xfd83('0x42')]['id']){delete _0xdfbc61[_0xfd83('0x42')]['id'];}return db[_0xfd83('0x26')][_0xfd83('0x43')]({'where':{'id':_0xdfbc61[_0xfd83('0x3d')]['id']}})[_0xfd83('0x21')](handleEntityNotFound(_0x5c9a76,null))[_0xfd83('0x21')](saveUpdates(_0xdfbc61[_0xfd83('0x42')],null))[_0xfd83('0x21')](respondWithResult(_0x5c9a76,null))[_0xfd83('0x3b')](handleError(_0x5c9a76,null));};exports[_0xfd83('0x44')]=function(_0x23106e,_0x5bdba8){return db[_0xfd83('0x26')]['find']({'where':{'id':_0x23106e['params']['id']}})[_0xfd83('0x21')](handleEntityNotFound(_0x5bdba8,null))[_0xfd83('0x21')](removeEntity(_0x5bdba8,null))['catch'](handleError(_0x5bdba8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index ef0046b..e6b0a3f 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 _0x48a3=['util','api','moment','request-promise','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','FieldId','lodash'];(function(_0xa82688,_0x3d82f0){var _0x5c1582=function(_0x3214e2){while(--_0x3214e2){_0xa82688['push'](_0xa82688['shift']());}};_0x5c1582(++_0x3d82f0);}(_0x48a3,0x1c6));var _0x348a=function(_0x16697e,_0x112bf8){_0x16697e=_0x16697e-0x0;var _0x218ede=_0x48a3[_0x16697e];return _0x218ede;};'use strict';var _=require(_0x348a('0x0'));var util=require(_0x348a('0x1'));var logger=require('../../config/logger')(_0x348a('0x2'));var moment=require(_0x348a('0x3'));var BPromise=require('bluebird');var rp=require(_0x348a('0x4'));var fs=require('fs');var path=require(_0x348a('0x5'));var rimraf=require(_0x348a('0x6'));var config=require('../../config/environment');var attributes=require(_0x348a('0x7'));module[_0x348a('0x8')]=function(_0x5c2830,_0x588603){return _0x5c2830[_0x348a('0x9')](_0x348a('0xa'),attributes,{'tableName':_0x348a('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x348a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd0f=['../../config/environment','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xf94a4a,_0x188ead){var _0x32e95b=function(_0x565992){while(--_0x565992){_0xf94a4a['push'](_0xf94a4a['shift']());}};_0x32e95b(++_0x188ead);}(_0xfd0f,0x70));var _0xffd0=function(_0x1b6a93,_0x1d4e2c){_0x1b6a93=_0x1b6a93-0x0;var _0x94a741=_0xfd0f[_0x1b6a93];return _0x94a741;};'use strict';var _=require(_0xffd0('0x0'));var util=require('util');var logger=require(_0xffd0('0x1'))(_0xffd0('0x2'));var moment=require(_0xffd0('0x3'));var BPromise=require(_0xffd0('0x4'));var rp=require(_0xffd0('0x5'));var fs=require('fs');var path=require(_0xffd0('0x6'));var rimraf=require(_0xffd0('0x7'));var config=require(_0xffd0('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xffd0('0x9')]=function(_0x13358,_0x18ecb7){return _0x13358[_0xffd0('0xa')]('ServicenowField',attributes,{'tableName':_0xffd0('0xb'),'paranoid':![],'indexes':[{'name':_0xffd0('0xc'),'fields':[_0xffd0('0xd'),_0xffd0('0xe')],'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 6738324..bad1d1e 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 _0x9bde=['code','message','ServicenowField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1e9412,_0xb4aa22){var _0x320797=function(_0x5d0759){while(--_0x5d0759){_0x1e9412['push'](_0x1e9412['shift']());}};_0x320797(++_0xb4aa22);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5253aa,_0x3d6557){_0x5253aa=_0x5253aa-0x0;var _0x42b6bd=_0x9bde[_0x5253aa];return _0x42b6bd;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('ServicenowField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1b0fc5,_0x3902a2){var _0x46eed2=function(_0x2157f3){while(--_0x2157f3){_0x1b0fc5['push'](_0x1b0fc5['shift']());}};_0x46eed2(++_0x3902a2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0667cb2..9f371f8 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x30c182,_0x298cb8){var _0x472c29=function(_0x18146d){while(--_0x18146d){_0x30c182['push'](_0x30c182['shift']());}};_0x472c29(++_0x298cb8);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x377582,_0x599a1f){var _0x5a2a1c=function(_0x55fd7e){while(--_0x55fd7e){_0x377582['push'](_0x377582['shift']());}};_0x5a2a1c(++_0x599a1f);}(_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 c9eadad..1592f3d 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(_0x3aceee,_0x4290a8){var _0x486bcb=function(_0x187d06){while(--_0x187d06){_0x3aceee['push'](_0x3aceee['shift']());}};_0x486bcb(++_0x4290a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x53124e,_0x4a974b){var _0x469238=function(_0x338631){while(--_0x338631){_0x53124e['push'](_0x53124e['shift']());}};_0x469238(++_0x4a974b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 8e47fcb..c842e3b 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 _0x32e4=['getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','JSON','Calls','module_fields','remove','includes','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','end','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','SugarcrmAccount','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','getConfigurations','findOne','SugarcrmConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x32e4,0x99));var _0x432e=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x32e4[_0x3cb6dc];return _0x47ec89;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x432e('0x0'));var jsonpatch=require(_0x432e('0x1'));var rp=require(_0x432e('0x2'));var moment=require(_0x432e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x432e('0x4'));var util=require(_0x432e('0x5'));var path=require(_0x432e('0x6'));var sox=require(_0x432e('0x7'));var csv=require(_0x432e('0x8'));var ejs=require(_0x432e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x432e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x432e('0xb'));var deskjs=require(_0x432e('0xc'));var toCsv=require(_0x432e('0x8'));var querystring=require(_0x432e('0xd'));var Papa=require(_0x432e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x432e('0xf'));var as=require(_0x432e('0x10'));var hardwareService=require(_0x432e('0x11'));var logger=require(_0x432e('0x12'))(_0x432e('0x13'));var utils=require(_0x432e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x432e('0x15'));var db=require(_0x432e('0x16'))['db'];var integrations=require(_0x432e('0x17'));function respondWithStatusCode(_0x3d3d54,_0x23f5f6){_0x23f5f6=_0x23f5f6||0xcc;return function(_0x3470a7){if(_0x3470a7){return _0x3d3d54[_0x432e('0x18')](_0x23f5f6);}return _0x3d3d54['status'](_0x23f5f6)['end']();};}function respondWithResult(_0x21d3e4,_0x1e32ab){_0x1e32ab=_0x1e32ab||0xc8;return function(_0x119d7f){if(_0x119d7f){return _0x21d3e4[_0x432e('0x19')](_0x1e32ab)[_0x432e('0x1a')](_0x119d7f);}};}function respondWithFilteredResult(_0x9b7006,_0x1a25dc){return function(_0x44b144){if(_0x44b144){var _0xdc058c=typeof _0x1a25dc[_0x432e('0x1b')]==='undefined'&&typeof _0x1a25dc['limit']===_0x432e('0x1c');var _0x2c1d95=_0x44b144[_0x432e('0x1d')];var _0x6f0c7a=_0xdc058c?0x0:_0x1a25dc[_0x432e('0x1b')];var _0x1a9ca9=_0xdc058c?_0x44b144['count']:_0x1a25dc[_0x432e('0x1b')]+_0x1a25dc['limit'];var _0x45dcff;if(_0x1a9ca9>=_0x2c1d95){_0x1a9ca9=_0x2c1d95;_0x45dcff=0xc8;}else{_0x45dcff=0xce;}_0x9b7006[_0x432e('0x19')](_0x45dcff);return _0x9b7006[_0x432e('0x1e')](_0x432e('0x1f'),_0x6f0c7a+'-'+_0x1a9ca9+'/'+_0x2c1d95)[_0x432e('0x1a')](_0x44b144);}return null;};}function patchUpdates(_0xb59e09){return function(_0x2c14d1){try{jsonpatch['apply'](_0x2c14d1,_0xb59e09,!![]);}catch(_0xd07833){return BPromise[_0x432e('0x20')](_0xd07833);}return _0x2c14d1[_0x432e('0x21')]();};}function saveUpdates(_0x1789ed,_0xab64e7){return function(_0x2e0198){if(_0x2e0198){return _0x2e0198['update'](_0x1789ed)[_0x432e('0x22')](function(_0x1513fb){return _0x1513fb;});}return null;};}function removeEntity(_0x59c865,_0x57d3ef){return function(_0x28de4c){if(_0x28de4c){return _0x28de4c[_0x432e('0x23')]()[_0x432e('0x22')](function(){_0x59c865[_0x432e('0x19')](0xcc)[_0x432e('0x24')]();});}};}function handleEntityNotFound(_0x48e0bb,_0x41f3cb){return function(_0x48a2ea){if(!_0x48a2ea){_0x48e0bb[_0x432e('0x18')](0x194);}return _0x48a2ea;};}function handleError(_0x117024,_0x3893b0){_0x3893b0=_0x3893b0||0x1f4;return function(_0x454d0e){logger['error'](_0x454d0e[_0x432e('0x25')]);if(_0x454d0e[_0x432e('0x26')]){delete _0x454d0e[_0x432e('0x26')];}_0x117024[_0x432e('0x19')](_0x3893b0)[_0x432e('0x27')](_0x454d0e);};}exports[_0x432e('0x28')]=function(_0xcb8020,_0x5e6d10){var _0x464859={},_0x4d017c={},_0x17f9e9={'count':0x0,'rows':[]};var _0x5662d0=_[_0x432e('0x29')](db['SugarcrmAccount']['rawAttributes'],function(_0x3af4b4){return{'name':_0x3af4b4['fieldName'],'type':_0x3af4b4[_0x432e('0x2a')][_0x432e('0x2b')]};});_0x4d017c[_0x432e('0x2c')]=_['map'](_0x5662d0,_0x432e('0x26'));_0x4d017c[_0x432e('0x2d')]=_['keys'](_0xcb8020[_0x432e('0x2d')]);_0x4d017c[_0x432e('0x2e')]=_[_0x432e('0x2f')](_0x4d017c['model'],_0x4d017c[_0x432e('0x2d')]);_0x464859[_0x432e('0x30')]=_[_0x432e('0x2f')](_0x4d017c[_0x432e('0x2c')],qs[_0x432e('0x31')](_0xcb8020[_0x432e('0x2d')][_0x432e('0x31')]));_0x464859[_0x432e('0x30')]=_0x464859['attributes'][_0x432e('0x32')]?_0x464859['attributes']:_0x4d017c['model'];if(!_0xcb8020[_0x432e('0x2d')][_0x432e('0x33')]('nolimit')){_0x464859[_0x432e('0x34')]=qs[_0x432e('0x34')](_0xcb8020[_0x432e('0x2d')][_0x432e('0x34')]);_0x464859[_0x432e('0x1b')]=qs[_0x432e('0x1b')](_0xcb8020[_0x432e('0x2d')]['offset']);}_0x464859[_0x432e('0x35')]=qs[_0x432e('0x36')](_0xcb8020['query'][_0x432e('0x36')]);_0x464859[_0x432e('0x37')]=qs[_0x432e('0x2e')](_['pick'](_0xcb8020[_0x432e('0x2d')],_0x4d017c[_0x432e('0x2e')]),_0x5662d0);if(_0xcb8020[_0x432e('0x2d')][_0x432e('0x38')]){_0x464859[_0x432e('0x37')]=_[_0x432e('0x39')](_0x464859[_0x432e('0x37')],{'$or':_[_0x432e('0x29')](_0x5662d0,function(_0x4c9c35){if(_0x4c9c35[_0x432e('0x2a')]!==_0x432e('0x3a')){var _0x360c4f={};_0x360c4f[_0x4c9c35[_0x432e('0x26')]]={'$like':'%'+_0xcb8020[_0x432e('0x2d')][_0x432e('0x38')]+'%'};return _0x360c4f;}})});}_0x464859=_[_0x432e('0x39')]({},_0x464859,_0xcb8020[_0x432e('0x3b')]);var _0x4149dd={'where':_0x464859['where']};return db[_0x432e('0x3c')][_0x432e('0x1d')](_0x4149dd)[_0x432e('0x22')](function(_0x548229){_0x17f9e9[_0x432e('0x1d')]=_0x548229;if(_0xcb8020[_0x432e('0x2d')]['includeAll']){_0x464859[_0x432e('0x3d')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x432e('0x3e')](_0x464859);})['then'](function(_0x4a75dc){_0x17f9e9[_0x432e('0x3f')]=_0x4a75dc;return _0x17f9e9;})[_0x432e('0x22')](respondWithFilteredResult(_0x5e6d10,_0x464859))[_0x432e('0x40')](handleError(_0x5e6d10,null));};exports[_0x432e('0x41')]=function(_0x39f4b9,_0x2ecb8e){var _0x16e86d={'raw':![],'where':{'id':_0x39f4b9[_0x432e('0x42')]['id']}},_0x298918={};_0x298918[_0x432e('0x2c')]=_[_0x432e('0x43')](db[_0x432e('0x3c')][_0x432e('0x44')]);_0x298918['query']=_[_0x432e('0x43')](_0x39f4b9[_0x432e('0x2d')]);_0x298918['filters']=_[_0x432e('0x2f')](_0x298918[_0x432e('0x2c')],_0x298918['query']);_0x16e86d[_0x432e('0x30')]=_[_0x432e('0x2f')](_0x298918[_0x432e('0x2c')],qs[_0x432e('0x31')](_0x39f4b9[_0x432e('0x2d')]['fields']));_0x16e86d['attributes']=_0x16e86d[_0x432e('0x30')][_0x432e('0x32')]?_0x16e86d['attributes']:_0x298918[_0x432e('0x2c')];if(_0x39f4b9[_0x432e('0x2d')]['includeAll']){_0x16e86d[_0x432e('0x3d')]=[{'all':!![]}];}_0x16e86d=_[_0x432e('0x39')]({},_0x16e86d,_0x39f4b9[_0x432e('0x3b')]);return db[_0x432e('0x3c')]['find'](_0x16e86d)[_0x432e('0x22')](handleEntityNotFound(_0x2ecb8e,null))[_0x432e('0x22')](respondWithResult(_0x2ecb8e,null))['catch'](handleError(_0x2ecb8e,null));};exports[_0x432e('0x45')]=function(_0x4fcfa6,_0x1f98b8){return db[_0x432e('0x3c')][_0x432e('0x45')](_0x4fcfa6[_0x432e('0x46')],{})[_0x432e('0x22')](respondWithResult(_0x1f98b8,0xc9))[_0x432e('0x40')](handleError(_0x1f98b8,null));};exports['update']=function(_0x311d67,_0x48199a){if(_0x311d67[_0x432e('0x46')]['id']){delete _0x311d67[_0x432e('0x46')]['id'];}return db[_0x432e('0x3c')]['find']({'where':{'id':_0x311d67[_0x432e('0x42')]['id']}})[_0x432e('0x22')](handleEntityNotFound(_0x48199a,null))[_0x432e('0x22')](saveUpdates(_0x311d67[_0x432e('0x46')],null))['then'](respondWithResult(_0x48199a,null))[_0x432e('0x40')](handleError(_0x48199a,null));};exports[_0x432e('0x23')]=function(_0x34a491,_0x5c765d){return db[_0x432e('0x3c')]['find']({'where':{'id':_0x34a491[_0x432e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c765d,null))['then'](removeEntity(_0x5c765d,null))[_0x432e('0x40')](handleError(_0x5c765d,null));};exports[_0x432e('0x47')]=function(_0xf6b758,_0x107f11,_0x125804){var _0x25d2f5={};var _0x2672d6={};var _0x45d12e;var _0x39c00e;return db[_0x432e('0x3c')][_0x432e('0x48')]({'where':{'id':_0xf6b758[_0x432e('0x42')]['id']}})[_0x432e('0x22')](handleEntityNotFound(_0x107f11,null))['then'](function(_0x3b56a7){if(_0x3b56a7){_0x45d12e=_0x3b56a7;_0x2672d6['model']=_[_0x432e('0x43')](db[_0x432e('0x49')]['rawAttributes']);_0x2672d6[_0x432e('0x2d')]=_[_0x432e('0x43')](_0xf6b758[_0x432e('0x2d')]);_0x2672d6[_0x432e('0x2e')]=_[_0x432e('0x2f')](_0x2672d6[_0x432e('0x2c')],_0x2672d6['query']);_0x25d2f5['attributes']=_[_0x432e('0x2f')](_0x2672d6[_0x432e('0x2c')],qs['fields'](_0xf6b758[_0x432e('0x2d')][_0x432e('0x31')]));_0x25d2f5['attributes']=_0x25d2f5[_0x432e('0x30')]['length']?_0x25d2f5['attributes']:_0x2672d6['model'];_0x25d2f5[_0x432e('0x35')]=qs['sort'](_0xf6b758[_0x432e('0x2d')]['sort']);_0x25d2f5[_0x432e('0x37')]=qs[_0x432e('0x2e')](_[_0x432e('0x4a')](_0xf6b758[_0x432e('0x2d')],_0x2672d6[_0x432e('0x2e')]));if(_0xf6b758[_0x432e('0x2d')]['filter']){_0x25d2f5[_0x432e('0x37')]=_['merge'](_0x25d2f5['where'],{'$or':_['map'](_0x25d2f5[_0x432e('0x30')],function(_0x2e2e9e){var _0x233ea2={};_0x233ea2[_0x2e2e9e]={'$like':'%'+_0xf6b758[_0x432e('0x2d')][_0x432e('0x38')]+'%'};return _0x233ea2;})});}_0x25d2f5=_[_0x432e('0x39')]({},_0x25d2f5,_0xf6b758[_0x432e('0x3b')]);return _0x45d12e['getConfigurations'](_0x25d2f5);}})[_0x432e('0x22')](function(_0xdf7973){if(_0xdf7973){_0x39c00e=_0xdf7973['length'];if(!_0xf6b758[_0x432e('0x2d')][_0x432e('0x33')](_0x432e('0x4b'))){_0x25d2f5['limit']=qs[_0x432e('0x34')](_0xf6b758[_0x432e('0x2d')][_0x432e('0x34')]);_0x25d2f5[_0x432e('0x1b')]=qs[_0x432e('0x1b')](_0xf6b758[_0x432e('0x2d')][_0x432e('0x1b')]);}return _0x45d12e[_0x432e('0x47')](_0x25d2f5);}})[_0x432e('0x22')](function(_0x565016){if(_0x565016){return _0x565016?{'count':_0x39c00e,'rows':_0x565016}:null;}})['then'](respondWithResult(_0x107f11,null))['catch'](handleError(_0x107f11,null));};exports[_0x432e('0x4c')]=function(_0x4152b0,_0x1c9c5b,_0x3cdec4){if(_0x4152b0[_0x432e('0x46')]['id']){delete _0x4152b0[_0x432e('0x46')]['id'];}return db[_0x432e('0x3c')][_0x432e('0x48')]({'where':{'id':_0x4152b0[_0x432e('0x42')]['id']}})[_0x432e('0x22')](handleEntityNotFound(_0x1c9c5b,null))['then'](function(_0x11688b){if(_0x11688b){_0x4152b0[_0x432e('0x46')][_0x432e('0x4d')]=_0x11688b['id'];_0x4152b0['body'][_0x432e('0x4e')]=integrations[_0x432e('0x4f')](_0x4152b0[_0x432e('0x46')][_0x432e('0x50')],_0x4152b0['body'][_0x432e('0x2a')]);_0x4152b0[_0x432e('0x46')][_0x432e('0x51')]=integrations['getDescriptions'](_0x4152b0[_0x432e('0x46')][_0x432e('0x50')],_0x4152b0['body'][_0x432e('0x2a')]);return db[_0x432e('0x49')][_0x432e('0x45')](_0x4152b0[_0x432e('0x46')],{'include':[{'model':db[_0x432e('0x52')],'as':_0x432e('0x4e')},{'model':db['SugarcrmField'],'as':_0x432e('0x51')}]});}return null;})[_0x432e('0x22')](respondWithResult(_0x1c9c5b,null))[_0x432e('0x40')](handleError(_0x1c9c5b,null));};exports[_0x432e('0x53')]=function(_0x448f87,_0xddd28f,_0x474de7){var _0x3fb56b='';var _0x6ca30a=['id',_0x432e('0x26'),_0x432e('0x54'),_0x432e('0x55'),_0x432e('0x56'),'date_start',_0x432e('0x57'),_0x432e('0x58'),_0x432e('0x59'),'parent_type',_0x432e('0x5a'),_0x432e('0x5b')];return db['SugarcrmAccount'][_0x432e('0x48')]({'where':{'id':_0x448f87['params']['id']},'attributes':['id',_0x432e('0x5c'),_0x432e('0x5d'),_0x432e('0x5e')]})[_0x432e('0x22')](handleEntityNotFound(_0xddd28f,null))[_0x432e('0x22')](function(_0x4d1f04){if(_0x4d1f04){_0x3fb56b=_0x4d1f04['remoteUri'];var _0x1c7aa6=_0x3fb56b[_0x432e('0x5f')](-0x1);if(_0x1c7aa6==='/'){_0x3fb56b=_0x3fb56b[_0x432e('0x60')](0x0,_0x3fb56b[_0x432e('0x61')](_0x1c7aa6));}return rp({'method':_0x432e('0x62'),'uri':util[_0x432e('0x63')](_0x432e('0x64'),_0x3fb56b,_0x432e('0x65')),'json':!![],'form':{'method':_0x432e('0x66'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x432e('0x67')]({'user_auth':{'user_name':_0x4d1f04[_0x432e('0x5c')],'password':_0x4d1f04[_0x432e('0x5d')],'encryption':_0x432e('0x68')},'application':_0x432e('0x69')})}});}})[_0x432e('0x22')](function(_0x594ce6){if(_0x594ce6&&_0x594ce6['name']!=='Invalid\x20Login'&&_0x594ce6[_0x432e('0x26')]!==_0x432e('0x6a')){return rp({'method':_0x432e('0x62'),'uri':util[_0x432e('0x63')](_0x432e('0x64'),_0x3fb56b,_0x432e('0x65')),'json':!![],'form':{'method':_0x432e('0x6b'),'input_type':_0x432e('0x6c'),'response_type':_0x432e('0x6c'),'rest_data':JSON[_0x432e('0x67')]({'session':_0x594ce6['id'],'module_name':_0x432e('0x6d')})}})[_0x432e('0x22')](function(_0x4f1c56){if(_0x4f1c56){var _0x11ec0b=_['values'](_0x4f1c56[_0x432e('0x6e')]);_[_0x432e('0x6f')](_0x11ec0b,function(_0x23e280){return _0x6ca30a[_0x432e('0x70')](_0x23e280[_0x432e('0x26')]);});return{'count':_0x11ec0b[_0x432e('0x32')],'rows':_[_0x432e('0x29')](_0x11ec0b,function(_0x49df6c){return{'id':_0x49df6c[_0x432e('0x26')],'name':_0x49df6c['label'],'custom':_['endsWith'](_0x49df6c[_0x432e('0x26')],'_c')?!![]:![],'options':_0x49df6c[_0x432e('0x3b')]?_[_0x432e('0x29')](_['values'](_0x49df6c[_0x432e('0x3b')]),function(_0x33204f){return{'name':_0x33204f[_0x432e('0x71')],'value':_0x33204f[_0x432e('0x26')]};}):[]};})};}})['then'](respondWithResult(_0xddd28f,null))['catch'](function(_0x17658c){var _0x4258b5=_0x448f87[_0x432e('0x2d')][_0x432e('0x72')]?0x1f4:_0x17658c[_0x432e('0x73')]||0x1f4;logger['error'](_0x432e('0x74'),'getFields',_0x4258b5,JSON[_0x432e('0x67')](_0x17658c));delete _0x17658c['name'];if(_0x4258b5===0x191){_0x4258b5=0x190;}_0xddd28f[_0x432e('0x19')](_0x4258b5)[_0x432e('0x27')](_0x448f87[_0x432e('0x2d')][_0x432e('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x17658c[_0x432e('0x73')]}:_0x17658c);});}else{var _0x54af2e=0x1f4;_0xddd28f[_0x432e('0x19')](_0x54af2e)[_0x432e('0x27')]({'message':_0x432e('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x98be=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','show','params','keys','find','catch','body','destroy','findOne','SugarcrmConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','SugarcrmField','getFields','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','%s%s','/service/v4_1/rest.php','get_module_fields','values','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x98be,0x1e5));var _0xe98b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x98be[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xe98b('0x0'));var rimraf=require(_0xe98b('0x1'));var zipdir=require(_0xe98b('0x2'));var jsonpatch=require(_0xe98b('0x3'));var rp=require('request-promise');var moment=require(_0xe98b('0x4'));var BPromise=require(_0xe98b('0x5'));var Mustache=require(_0xe98b('0x6'));var util=require(_0xe98b('0x7'));var path=require(_0xe98b('0x8'));var sox=require(_0xe98b('0x9'));var csv=require(_0xe98b('0xa'));var ejs=require(_0xe98b('0xb'));var fs=require('fs');var fs_extra=require(_0xe98b('0xc'));var _=require(_0xe98b('0xd'));var squel=require(_0xe98b('0xe'));var crypto=require(_0xe98b('0xf'));var jsforce=require(_0xe98b('0x10'));var deskjs=require(_0xe98b('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe98b('0x12'));var Papa=require('papaparse');var Redis=require(_0xe98b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe98b('0x14'));var as=require(_0xe98b('0x15'));var hardwareService=require(_0xe98b('0x16'));var logger=require('../../config/logger')(_0xe98b('0x17'));var utils=require(_0xe98b('0x18'));var config=require(_0xe98b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xe98b('0x1a'));function respondWithStatusCode(_0x3aac08,_0x12dcd0){_0x12dcd0=_0x12dcd0||0xcc;return function(_0x6c4061){if(_0x6c4061){return _0x3aac08[_0xe98b('0x1b')](_0x12dcd0);}return _0x3aac08['status'](_0x12dcd0)[_0xe98b('0x1c')]();};}function respondWithResult(_0xe187b5,_0x379433){_0x379433=_0x379433||0xc8;return function(_0x3632b3){if(_0x3632b3){return _0xe187b5['status'](_0x379433)[_0xe98b('0x1d')](_0x3632b3);}};}function respondWithFilteredResult(_0x36ba2b,_0x269af6){return function(_0x2bd843){if(_0x2bd843){var _0x1738d4=typeof _0x269af6[_0xe98b('0x1e')]===_0xe98b('0x1f')&&typeof _0x269af6[_0xe98b('0x20')]===_0xe98b('0x1f');var _0x34f622=_0x2bd843[_0xe98b('0x21')];var _0x4ab90f=_0x1738d4?0x0:_0x269af6[_0xe98b('0x1e')];var _0x1cb009=_0x1738d4?_0x2bd843[_0xe98b('0x21')]:_0x269af6[_0xe98b('0x1e')]+_0x269af6[_0xe98b('0x20')];var _0xb16fb1;if(_0x1cb009>=_0x34f622){_0x1cb009=_0x34f622;_0xb16fb1=0xc8;}else{_0xb16fb1=0xce;}_0x36ba2b[_0xe98b('0x22')](_0xb16fb1);return _0x36ba2b[_0xe98b('0x23')]('Content-Range',_0x4ab90f+'-'+_0x1cb009+'/'+_0x34f622)[_0xe98b('0x1d')](_0x2bd843);}return null;};}function patchUpdates(_0x329111){return function(_0x519279){try{jsonpatch[_0xe98b('0x24')](_0x519279,_0x329111,!![]);}catch(_0x51a982){return BPromise[_0xe98b('0x25')](_0x51a982);}return _0x519279['save']();};}function saveUpdates(_0x3f9efa,_0x3d3a68){return function(_0x1f518d){if(_0x1f518d){return _0x1f518d['update'](_0x3f9efa)[_0xe98b('0x26')](function(_0x516723){return _0x516723;});}return null;};}function removeEntity(_0x16e058,_0x379418){return function(_0x321cf0){if(_0x321cf0){return _0x321cf0['destroy']()[_0xe98b('0x26')](function(){_0x16e058[_0xe98b('0x22')](0xcc)[_0xe98b('0x1c')]();});}};}function handleEntityNotFound(_0x2d2c64,_0x337c74){return function(_0x1caf47){if(!_0x1caf47){_0x2d2c64[_0xe98b('0x1b')](0x194);}return _0x1caf47;};}function handleError(_0x196b77,_0x486d66){_0x486d66=_0x486d66||0x1f4;return function(_0x195cc6){logger[_0xe98b('0x27')](_0x195cc6[_0xe98b('0x28')]);if(_0x195cc6[_0xe98b('0x29')]){delete _0x195cc6['name'];}_0x196b77[_0xe98b('0x22')](_0x486d66)[_0xe98b('0x2a')](_0x195cc6);};}exports['index']=function(_0x5cd5ad,_0x26f24c){var _0x21f4bb={},_0x5aa895={},_0x3ce846={'count':0x0,'rows':[]};var _0x3e4a23=_[_0xe98b('0x2b')](db['SugarcrmAccount'][_0xe98b('0x2c')],function(_0x3a2d57){return{'name':_0x3a2d57[_0xe98b('0x2d')],'type':_0x3a2d57[_0xe98b('0x2e')][_0xe98b('0x2f')]};});_0x5aa895[_0xe98b('0x30')]=_[_0xe98b('0x2b')](_0x3e4a23,_0xe98b('0x29'));_0x5aa895['query']=_['keys'](_0x5cd5ad[_0xe98b('0x31')]);_0x5aa895['filters']=_[_0xe98b('0x32')](_0x5aa895[_0xe98b('0x30')],_0x5aa895[_0xe98b('0x31')]);_0x21f4bb[_0xe98b('0x33')]=_['intersection'](_0x5aa895[_0xe98b('0x30')],qs[_0xe98b('0x34')](_0x5cd5ad['query'][_0xe98b('0x34')]));_0x21f4bb[_0xe98b('0x33')]=_0x21f4bb[_0xe98b('0x33')][_0xe98b('0x35')]?_0x21f4bb[_0xe98b('0x33')]:_0x5aa895['model'];if(!_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x36')](_0xe98b('0x37'))){_0x21f4bb[_0xe98b('0x20')]=qs[_0xe98b('0x20')](_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x20')]);_0x21f4bb[_0xe98b('0x1e')]=qs[_0xe98b('0x1e')](_0x5cd5ad['query']['offset']);}_0x21f4bb['order']=qs[_0xe98b('0x38')](_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x38')]);_0x21f4bb[_0xe98b('0x39')]=qs[_0xe98b('0x3a')](_[_0xe98b('0x3b')](_0x5cd5ad[_0xe98b('0x31')],_0x5aa895['filters']),_0x3e4a23);if(_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x3c')]){_0x21f4bb[_0xe98b('0x39')]=_[_0xe98b('0x3d')](_0x21f4bb['where'],{'$or':_[_0xe98b('0x2b')](_0x3e4a23,function(_0x455d7d){if(_0x455d7d[_0xe98b('0x2e')]!==_0xe98b('0x3e')){var _0x55d387={};_0x55d387[_0x455d7d[_0xe98b('0x29')]]={'$like':'%'+_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x3c')]+'%'};return _0x55d387;}})});}_0x21f4bb=_[_0xe98b('0x3d')]({},_0x21f4bb,_0x5cd5ad[_0xe98b('0x3f')]);var _0x346e74={'where':_0x21f4bb[_0xe98b('0x39')]};return db[_0xe98b('0x40')][_0xe98b('0x21')](_0x346e74)[_0xe98b('0x26')](function(_0x50f87d){_0x3ce846[_0xe98b('0x21')]=_0x50f87d;if(_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x41')]){_0x21f4bb[_0xe98b('0x42')]=[{'all':!![]}];}return db[_0xe98b('0x40')][_0xe98b('0x43')](_0x21f4bb);})[_0xe98b('0x26')](function(_0x5ae0e1){_0x3ce846[_0xe98b('0x44')]=_0x5ae0e1;return _0x3ce846;})['then'](respondWithFilteredResult(_0x26f24c,_0x21f4bb))['catch'](handleError(_0x26f24c,null));};exports[_0xe98b('0x45')]=function(_0x495d8c,_0x346599){var _0x43a2a9={'raw':![],'where':{'id':_0x495d8c[_0xe98b('0x46')]['id']}},_0x3ddfea={};_0x3ddfea[_0xe98b('0x30')]=_[_0xe98b('0x47')](db['SugarcrmAccount'][_0xe98b('0x2c')]);_0x3ddfea['query']=_[_0xe98b('0x47')](_0x495d8c[_0xe98b('0x31')]);_0x3ddfea['filters']=_[_0xe98b('0x32')](_0x3ddfea[_0xe98b('0x30')],_0x3ddfea[_0xe98b('0x31')]);_0x43a2a9[_0xe98b('0x33')]=_[_0xe98b('0x32')](_0x3ddfea[_0xe98b('0x30')],qs[_0xe98b('0x34')](_0x495d8c[_0xe98b('0x31')][_0xe98b('0x34')]));_0x43a2a9['attributes']=_0x43a2a9['attributes'][_0xe98b('0x35')]?_0x43a2a9[_0xe98b('0x33')]:_0x3ddfea[_0xe98b('0x30')];if(_0x495d8c[_0xe98b('0x31')][_0xe98b('0x41')]){_0x43a2a9[_0xe98b('0x42')]=[{'all':!![]}];}_0x43a2a9=_['merge']({},_0x43a2a9,_0x495d8c[_0xe98b('0x3f')]);return db[_0xe98b('0x40')][_0xe98b('0x48')](_0x43a2a9)[_0xe98b('0x26')](handleEntityNotFound(_0x346599,null))[_0xe98b('0x26')](respondWithResult(_0x346599,null))[_0xe98b('0x49')](handleError(_0x346599,null));};exports['create']=function(_0x42d506,_0x3b5def){return db[_0xe98b('0x40')]['create'](_0x42d506[_0xe98b('0x4a')],{})['then'](respondWithResult(_0x3b5def,0xc9))[_0xe98b('0x49')](handleError(_0x3b5def,null));};exports['update']=function(_0x55180e,_0x3dcd8e){if(_0x55180e[_0xe98b('0x4a')]['id']){delete _0x55180e[_0xe98b('0x4a')]['id'];}return db[_0xe98b('0x40')]['find']({'where':{'id':_0x55180e[_0xe98b('0x46')]['id']}})[_0xe98b('0x26')](handleEntityNotFound(_0x3dcd8e,null))[_0xe98b('0x26')](saveUpdates(_0x55180e[_0xe98b('0x4a')],null))['then'](respondWithResult(_0x3dcd8e,null))[_0xe98b('0x49')](handleError(_0x3dcd8e,null));};exports[_0xe98b('0x4b')]=function(_0x1c0619,_0x1b0e1c){return db['SugarcrmAccount'][_0xe98b('0x48')]({'where':{'id':_0x1c0619[_0xe98b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b0e1c,null))[_0xe98b('0x26')](removeEntity(_0x1b0e1c,null))['catch'](handleError(_0x1b0e1c,null));};exports['getConfigurations']=function(_0x16a1fc,_0x562b1c,_0x2568af){var _0x504d0c={};var _0xc07a75={};var _0x9e3bd2;var _0xeee222;return db[_0xe98b('0x40')][_0xe98b('0x4c')]({'where':{'id':_0x16a1fc[_0xe98b('0x46')]['id']}})[_0xe98b('0x26')](handleEntityNotFound(_0x562b1c,null))[_0xe98b('0x26')](function(_0x402163){if(_0x402163){_0x9e3bd2=_0x402163;_0xc07a75['model']=_[_0xe98b('0x47')](db[_0xe98b('0x4d')][_0xe98b('0x2c')]);_0xc07a75[_0xe98b('0x31')]=_[_0xe98b('0x47')](_0x16a1fc[_0xe98b('0x31')]);_0xc07a75[_0xe98b('0x3a')]=_[_0xe98b('0x32')](_0xc07a75[_0xe98b('0x30')],_0xc07a75[_0xe98b('0x31')]);_0x504d0c['attributes']=_['intersection'](_0xc07a75['model'],qs[_0xe98b('0x34')](_0x16a1fc[_0xe98b('0x31')][_0xe98b('0x34')]));_0x504d0c[_0xe98b('0x33')]=_0x504d0c[_0xe98b('0x33')][_0xe98b('0x35')]?_0x504d0c[_0xe98b('0x33')]:_0xc07a75[_0xe98b('0x30')];_0x504d0c[_0xe98b('0x4e')]=qs[_0xe98b('0x38')](_0x16a1fc[_0xe98b('0x31')]['sort']);_0x504d0c['where']=qs[_0xe98b('0x3a')](_[_0xe98b('0x3b')](_0x16a1fc[_0xe98b('0x31')],_0xc07a75[_0xe98b('0x3a')]));if(_0x16a1fc['query'][_0xe98b('0x3c')]){_0x504d0c['where']=_['merge'](_0x504d0c[_0xe98b('0x39')],{'$or':_[_0xe98b('0x2b')](_0x504d0c['attributes'],function(_0x455acd){var _0x4646cc={};_0x4646cc[_0x455acd]={'$like':'%'+_0x16a1fc[_0xe98b('0x31')][_0xe98b('0x3c')]+'%'};return _0x4646cc;})});}_0x504d0c=_['merge']({},_0x504d0c,_0x16a1fc['options']);return _0x9e3bd2['getConfigurations'](_0x504d0c);}})[_0xe98b('0x26')](function(_0x143df6){if(_0x143df6){_0xeee222=_0x143df6[_0xe98b('0x35')];if(!_0x16a1fc[_0xe98b('0x31')]['hasOwnProperty'](_0xe98b('0x37'))){_0x504d0c[_0xe98b('0x20')]=qs[_0xe98b('0x20')](_0x16a1fc[_0xe98b('0x31')][_0xe98b('0x20')]);_0x504d0c['offset']=qs[_0xe98b('0x1e')](_0x16a1fc[_0xe98b('0x31')][_0xe98b('0x1e')]);}return _0x9e3bd2[_0xe98b('0x4f')](_0x504d0c);}})[_0xe98b('0x26')](function(_0x366ac5){if(_0x366ac5){return _0x366ac5?{'count':_0xeee222,'rows':_0x366ac5}:null;}})[_0xe98b('0x26')](respondWithResult(_0x562b1c,null))[_0xe98b('0x49')](handleError(_0x562b1c,null));};exports[_0xe98b('0x50')]=function(_0x1e14ad,_0x36f66e,_0x196419){if(_0x1e14ad[_0xe98b('0x4a')]['id']){delete _0x1e14ad['body']['id'];}return db[_0xe98b('0x40')][_0xe98b('0x4c')]({'where':{'id':_0x1e14ad['params']['id']}})[_0xe98b('0x26')](handleEntityNotFound(_0x36f66e,null))[_0xe98b('0x26')](function(_0x15b8f8){if(_0x15b8f8){_0x1e14ad[_0xe98b('0x4a')][_0xe98b('0x51')]=_0x15b8f8['id'];_0x1e14ad[_0xe98b('0x4a')][_0xe98b('0x52')]=integrations[_0xe98b('0x53')](_0x1e14ad[_0xe98b('0x4a')][_0xe98b('0x54')],_0x1e14ad[_0xe98b('0x4a')][_0xe98b('0x2e')]);_0x1e14ad['body'][_0xe98b('0x55')]=integrations['getDescriptions'](_0x1e14ad['body']['channel'],_0x1e14ad['body'][_0xe98b('0x2e')]);return db[_0xe98b('0x4d')][_0xe98b('0x56')](_0x1e14ad[_0xe98b('0x4a')],{'include':[{'model':db[_0xe98b('0x57')],'as':_0xe98b('0x52')},{'model':db[_0xe98b('0x57')],'as':_0xe98b('0x55')}]});}return null;})['then'](respondWithResult(_0x36f66e,null))[_0xe98b('0x49')](handleError(_0x36f66e,null));};exports[_0xe98b('0x58')]=function(_0x3c52d0,_0x3d6793,_0x13b35f){var _0x11a712='';var _0x141c1b=['id',_0xe98b('0x29'),'assigned_user_id','created_by',_0xe98b('0x59'),_0xe98b('0x5a'),_0xe98b('0x5b'),_0xe98b('0x5c'),'parent_id',_0xe98b('0x5d'),_0xe98b('0x5e'),_0xe98b('0x5f')];return db[_0xe98b('0x40')][_0xe98b('0x4c')]({'where':{'id':_0x3c52d0[_0xe98b('0x46')]['id']},'attributes':['id','username',_0xe98b('0x60'),_0xe98b('0x61')]})[_0xe98b('0x26')](handleEntityNotFound(_0x3d6793,null))[_0xe98b('0x26')](function(_0x1d0055){if(_0x1d0055){_0x11a712=_0x1d0055[_0xe98b('0x61')];var _0x41e73c=_0x11a712[_0xe98b('0x62')](-0x1);if(_0x41e73c==='/'){_0x11a712=_0x11a712[_0xe98b('0x63')](0x0,_0x11a712[_0xe98b('0x64')](_0x41e73c));}return rp({'method':_0xe98b('0x65'),'uri':util['format']('%s%s',_0x11a712,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xe98b('0x66'),'input_type':_0xe98b('0x67'),'response_type':'JSON','rest_data':JSON[_0xe98b('0x68')]({'user_auth':{'user_name':_0x1d0055[_0xe98b('0x69')],'password':_0x1d0055[_0xe98b('0x60')],'encryption':_0xe98b('0x6a')},'application':_0xe98b('0x6b')})}});}})['then'](function(_0x3fffe4){if(_0x3fffe4&&_0x3fffe4[_0xe98b('0x29')]!==_0xe98b('0x6c')&&_0x3fffe4['name']!==_0xe98b('0x6d')){return rp({'method':_0xe98b('0x65'),'uri':util[_0xe98b('0x6e')](_0xe98b('0x6f'),_0x11a712,_0xe98b('0x70')),'json':!![],'form':{'method':_0xe98b('0x71'),'input_type':'JSON','response_type':_0xe98b('0x67'),'rest_data':JSON['stringify']({'session':_0x3fffe4['id'],'module_name':'Calls'})}})[_0xe98b('0x26')](function(_0x1e538b){if(_0x1e538b){var _0x57bd7e=_[_0xe98b('0x72')](_0x1e538b['module_fields']);_[_0xe98b('0x73')](_0x57bd7e,function(_0x34da74){return _0x141c1b[_0xe98b('0x74')](_0x34da74[_0xe98b('0x29')]);});return{'count':_0x57bd7e[_0xe98b('0x35')],'rows':_[_0xe98b('0x2b')](_0x57bd7e,function(_0x34702c){return{'id':_0x34702c['name'],'name':_0x34702c[_0xe98b('0x75')],'custom':_[_0xe98b('0x76')](_0x34702c[_0xe98b('0x29')],'_c')?!![]:![],'options':_0x34702c[_0xe98b('0x3f')]?_[_0xe98b('0x2b')](_[_0xe98b('0x72')](_0x34702c[_0xe98b('0x3f')]),function(_0x125f7b){return{'name':_0x125f7b[_0xe98b('0x77')],'value':_0x125f7b['name']};}):[]};})};}})[_0xe98b('0x26')](respondWithResult(_0x3d6793,null))[_0xe98b('0x49')](function(_0x2e14bd){var _0x4fdbe0=_0x3c52d0['query'][_0xe98b('0x78')]?0x1f4:_0x2e14bd[_0xe98b('0x79')]||0x1f4;logger[_0xe98b('0x27')](_0xe98b('0x7a'),'getFields',_0x4fdbe0,JSON[_0xe98b('0x68')](_0x2e14bd));delete _0x2e14bd[_0xe98b('0x29')];if(_0x4fdbe0===0x191){_0x4fdbe0=0x190;}_0x3d6793['status'](_0x4fdbe0)[_0xe98b('0x2a')](_0x3c52d0[_0xe98b('0x31')][_0xe98b('0x78')]?{'message':_0xe98b('0x7b'),'statusCode':_0x2e14bd[_0xe98b('0x79')]}:_0x2e14bd);});}else{var _0x1f1092=0x1f4;_0x3d6793[_0xe98b('0x22')](_0x1f1092)[_0xe98b('0x2a')]({'message':_0xe98b('0x7b'),'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 81d2e85..0489d35 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 _0x4b1b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x2dc428,_0x5e8480){var _0x409e12=function(_0x5692e8){while(--_0x5692e8){_0x2dc428['push'](_0x2dc428['shift']());}};_0x409e12(++_0x5e8480);}(_0x4b1b,0x17f));var _0xb4b1=function(_0x384e54,_0x1410c6){_0x384e54=_0x384e54-0x0;var _0x31ee92=_0x4b1b[_0x384e54];return _0x31ee92;};'use strict';var _=require(_0xb4b1('0x0'));var util=require(_0xb4b1('0x1'));var logger=require(_0xb4b1('0x2'))(_0xb4b1('0x3'));var moment=require(_0xb4b1('0x4'));var BPromise=require(_0xb4b1('0x5'));var rp=require(_0xb4b1('0x6'));var fs=require('fs');var path=require(_0xb4b1('0x7'));var rimraf=require(_0xb4b1('0x8'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2b28b4,_0x7d6283){return _0x2b28b4[_0xb4b1('0x9')](_0xb4b1('0xa'),attributes,{'tableName':_0xb4b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06f7=['./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x06f7,0xd7));var _0x706f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x06f7[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x706f('0x0'));var util=require(_0x706f('0x1'));var logger=require(_0x706f('0x2'))(_0x706f('0x3'));var moment=require(_0x706f('0x4'));var BPromise=require(_0x706f('0x5'));var rp=require(_0x706f('0x6'));var fs=require('fs');var path=require(_0x706f('0x7'));var rimraf=require('rimraf');var config=require(_0x706f('0x8'));var attributes=require(_0x706f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x706f('0xa')]=function(_0x3f8f3e,_0x30a043){return _0x3f8f3e[_0x706f('0xb')](_0x706f('0xc'),attributes,{'tableName':_0x706f('0xd'),'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 018f75f..0ee5db4 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 _0x6c65=['request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xa2ffdf,_0x442b4d){var _0x22cf0d=function(_0x648946){while(--_0x648946){_0xa2ffdf['push'](_0xa2ffdf['shift']());}};_0x22cf0d(++_0x442b4d);}(_0x6c65,0x141));var _0x56c6=function(_0x82f586,_0x382c19){_0x82f586=_0x82f586-0x0;var _0x591ec8=_0x6c65[_0x82f586];return _0x591ec8;};'use strict';var _=require('lodash');var util=require(_0x56c6('0x0'));var moment=require(_0x56c6('0x1'));var BPromise=require(_0x56c6('0x2'));var rs=require(_0x56c6('0x3'));var fs=require('fs');var Redis=require(_0x56c6('0x4'));var db=require(_0x56c6('0x5'))['db'];var utils=require(_0x56c6('0x6'));var logger=require('../../config/logger')(_0x56c6('0x7'));var config=require(_0x56c6('0x8'));var jayson=require(_0x56c6('0x9'));var client=jayson[_0x56c6('0xa')][_0x56c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48c1ec,_0x416a54,_0xb93346){return new BPromise(function(_0x28528b,_0x23aa02){return client[_0x56c6('0xc')](_0x48c1ec,_0xb93346)[_0x56c6('0xd')](function(_0x5ba829){logger[_0x56c6('0xe')](_0x56c6('0xf'),_0x416a54,_0x56c6('0x10'));logger['debug'](_0x56c6('0x11'),_0x416a54,_0x56c6('0x10'),JSON[_0x56c6('0x12')](_0x5ba829));if(_0x5ba829[_0x56c6('0x13')]){if(_0x5ba829[_0x56c6('0x13')]['code']===0x1f4){logger[_0x56c6('0x13')](_0x56c6('0xf'),_0x416a54,_0x5ba829[_0x56c6('0x13')][_0x56c6('0x14')]);return _0x23aa02(_0x5ba829[_0x56c6('0x13')][_0x56c6('0x14')]);}logger[_0x56c6('0x13')](_0x56c6('0xf'),_0x416a54,_0x5ba829['error']['message']);return _0x28528b(_0x5ba829[_0x56c6('0x13')]['message']);}else{logger[_0x56c6('0xe')](_0x56c6('0xf'),_0x416a54,_0x56c6('0x10'));_0x28528b(_0x5ba829[_0x56c6('0x15')][_0x56c6('0x14')]);}})[_0x56c6('0x16')](function(_0x5e4522){logger[_0x56c6('0x13')](_0x56c6('0xf'),_0x416a54,_0x5e4522);_0x23aa02(_0x5e4522);});});}exports[_0x56c6('0x17')]=function(_0x5587ff){var _0xe734d=this;return new Promise(function(_0x6737eb,_0x65e143){return db[_0x56c6('0x18')][_0x56c6('0x19')]({'raw':_0x5587ff[_0x56c6('0x1a')]?_0x5587ff['options'][_0x56c6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5587ff[_0x56c6('0x1a')]?_0x5587ff['options'][_0x56c6('0x1c')]||null:null,'attributes':_0x5587ff[_0x56c6('0x1a')]?_0x5587ff[_0x56c6('0x1a')][_0x56c6('0x1d')]||null:null,'limit':_0x5587ff[_0x56c6('0x1a')]?_0x5587ff[_0x56c6('0x1a')][_0x56c6('0x1e')]||null:null,'include':_0x5587ff['options']?_0x5587ff[_0x56c6('0x1a')]['include']?_['map'](_0x5587ff['options'][_0x56c6('0x1f')],function(_0x24e17e){return{'model':db[_0x24e17e[_0x56c6('0x20')]],'as':_0x24e17e['as'],'attributes':_0x24e17e[_0x56c6('0x1d')],'include':_0x24e17e[_0x56c6('0x1f')]?_[_0x56c6('0x21')](_0x24e17e[_0x56c6('0x1f')],function(_0x37d1cf){return{'model':db[_0x37d1cf[_0x56c6('0x20')]],'as':_0x37d1cf['as'],'attributes':_0x37d1cf[_0x56c6('0x1d')],'include':_0x37d1cf[_0x56c6('0x1f')]?_[_0x56c6('0x21')](_0x37d1cf['include'],function(_0x4abcbc){return{'model':db[_0x4abcbc[_0x56c6('0x20')]],'as':_0x4abcbc['as'],'attributes':_0x4abcbc[_0x56c6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56c6('0xd')](function(_0x1b1ca5){logger[_0x56c6('0xe')](_0x56c6('0x17'),_0x5587ff);logger[_0x56c6('0x22')](_0x56c6('0x17'),_0x5587ff,JSON['stringify'](_0x1b1ca5));_0x6737eb(_0x1b1ca5);})[_0x56c6('0x16')](function(_0x318e4f){logger[_0x56c6('0x13')]('GetSugarcrmAccount',_0x318e4f[_0x56c6('0x14')],_0x5587ff);_0x65e143(_0xe734d[_0x56c6('0x13')](0x1f4,_0x318e4f['message']));});});};exports[_0x56c6('0x23')]=function(_0x1ed58e){var _0x4edfcd=this;return new Promise(function(_0x57c3ec,_0x224526){return db[_0x56c6('0x18')][_0x56c6('0x24')]({'raw':_0x1ed58e[_0x56c6('0x1a')]?_0x1ed58e['options'][_0x56c6('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ed58e[_0x56c6('0x1a')]?_0x1ed58e[_0x56c6('0x1a')][_0x56c6('0x1c')]||null:null,'attributes':_0x1ed58e[_0x56c6('0x1a')]?_0x1ed58e[_0x56c6('0x1a')]['attributes']||null:null,'include':_0x1ed58e[_0x56c6('0x1a')]?_0x1ed58e[_0x56c6('0x1a')][_0x56c6('0x1f')]?_['map'](_0x1ed58e[_0x56c6('0x1a')]['include'],function(_0x3c5ff7){return{'model':db[_0x3c5ff7[_0x56c6('0x20')]],'as':_0x3c5ff7['as'],'attributes':_0x3c5ff7[_0x56c6('0x1d')],'include':_0x3c5ff7[_0x56c6('0x1f')]?_[_0x56c6('0x21')](_0x3c5ff7[_0x56c6('0x1f')],function(_0x4b19ae){return{'model':db[_0x4b19ae[_0x56c6('0x20')]],'as':_0x4b19ae['as'],'attributes':_0x4b19ae['attributes'],'include':_0x4b19ae[_0x56c6('0x1f')]?_[_0x56c6('0x21')](_0x4b19ae[_0x56c6('0x1f')],function(_0x53314a){return{'model':db[_0x53314a[_0x56c6('0x20')]],'as':_0x53314a['as'],'attributes':_0x53314a['attributes']};}):[]};}):[]};}):[]:[]})[_0x56c6('0xd')](function(_0x2a4e16){logger[_0x56c6('0xe')]('ShowSugarcrmAccount',_0x1ed58e);logger[_0x56c6('0x22')](_0x56c6('0x23'),_0x1ed58e,JSON[_0x56c6('0x12')](_0x2a4e16));_0x57c3ec(_0x2a4e16);})[_0x56c6('0x16')](function(_0x432389){logger[_0x56c6('0x13')](_0x56c6('0x23'),_0x432389[_0x56c6('0x14')],_0x1ed58e);_0x224526(_0x4edfcd[_0x56c6('0x13')](0x1f4,_0x432389[_0x56c6('0x14')]));});});}; \ No newline at end of file +var _0xe6f1=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowSugarcrmAccount'];(function(_0x7db4da,_0x1b384d){var _0x4a5198=function(_0x56680f){while(--_0x56680f){_0x7db4da['push'](_0x7db4da['shift']());}};_0x4a5198(++_0x1b384d);}(_0xe6f1,0x1d4));var _0x1e6f=function(_0x3d7f78,_0x17e4d0){_0x3d7f78=_0x3d7f78-0x0;var _0x3bf252=_0xe6f1[_0x3d7f78];return _0x3bf252;};'use strict';var _=require('lodash');var util=require(_0x1e6f('0x0'));var moment=require(_0x1e6f('0x1'));var BPromise=require(_0x1e6f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e6f('0x3'));var db=require(_0x1e6f('0x4'))['db'];var utils=require(_0x1e6f('0x5'));var logger=require(_0x1e6f('0x6'))(_0x1e6f('0x7'));var config=require(_0x1e6f('0x8'));var jayson=require(_0x1e6f('0x9'));var client=jayson[_0x1e6f('0xa')][_0x1e6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d7922,_0x435d17,_0x563c4b){return new BPromise(function(_0x460ec3,_0x2eb7e9){return client[_0x1e6f('0xc')](_0x4d7922,_0x563c4b)[_0x1e6f('0xd')](function(_0x34537e){logger['info'](_0x1e6f('0xe'),_0x435d17,'request\x20sent');logger['debug'](_0x1e6f('0xf'),_0x435d17,_0x1e6f('0x10'),JSON[_0x1e6f('0x11')](_0x34537e));if(_0x34537e[_0x1e6f('0x12')]){if(_0x34537e[_0x1e6f('0x12')][_0x1e6f('0x13')]===0x1f4){logger[_0x1e6f('0x12')](_0x1e6f('0xe'),_0x435d17,_0x34537e[_0x1e6f('0x12')][_0x1e6f('0x14')]);return _0x2eb7e9(_0x34537e[_0x1e6f('0x12')]['message']);}logger['error'](_0x1e6f('0xe'),_0x435d17,_0x34537e[_0x1e6f('0x12')][_0x1e6f('0x14')]);return _0x460ec3(_0x34537e[_0x1e6f('0x12')][_0x1e6f('0x14')]);}else{logger[_0x1e6f('0x15')](_0x1e6f('0xe'),_0x435d17,_0x1e6f('0x10'));_0x460ec3(_0x34537e['result'][_0x1e6f('0x14')]);}})[_0x1e6f('0x16')](function(_0x1ad7d5){logger['error'](_0x1e6f('0xe'),_0x435d17,_0x1ad7d5);_0x2eb7e9(_0x1ad7d5);});});}exports[_0x1e6f('0x17')]=function(_0x2cb441){var _0x141651=this;return new Promise(function(_0x5a75c3,_0x4fb94a){return db[_0x1e6f('0x18')][_0x1e6f('0x19')]({'raw':_0x2cb441[_0x1e6f('0x1a')]?_0x2cb441[_0x1e6f('0x1a')][_0x1e6f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2cb441[_0x1e6f('0x1a')]?_0x2cb441['options'][_0x1e6f('0x1c')]||null:null,'attributes':_0x2cb441['options']?_0x2cb441[_0x1e6f('0x1a')]['attributes']||null:null,'limit':_0x2cb441['options']?_0x2cb441[_0x1e6f('0x1a')][_0x1e6f('0x1d')]||null:null,'include':_0x2cb441['options']?_0x2cb441[_0x1e6f('0x1a')][_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x2cb441[_0x1e6f('0x1a')][_0x1e6f('0x1e')],function(_0x528a6c){return{'model':db[_0x528a6c[_0x1e6f('0x20')]],'as':_0x528a6c['as'],'attributes':_0x528a6c[_0x1e6f('0x21')],'include':_0x528a6c[_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x528a6c[_0x1e6f('0x1e')],function(_0x41717d){return{'model':db[_0x41717d['model']],'as':_0x41717d['as'],'attributes':_0x41717d['attributes'],'include':_0x41717d[_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x41717d['include'],function(_0x220aae){return{'model':db[_0x220aae[_0x1e6f('0x20')]],'as':_0x220aae['as'],'attributes':_0x220aae['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x154e71){logger['info'](_0x1e6f('0x17'),_0x2cb441);logger['debug'](_0x1e6f('0x17'),_0x2cb441,JSON[_0x1e6f('0x11')](_0x154e71));_0x5a75c3(_0x154e71);})[_0x1e6f('0x16')](function(_0x1117e4){logger[_0x1e6f('0x12')](_0x1e6f('0x17'),_0x1117e4['message'],_0x2cb441);_0x4fb94a(_0x141651[_0x1e6f('0x12')](0x1f4,_0x1117e4['message']));});});};exports['ShowSugarcrmAccount']=function(_0x3fdf0e){var _0x58b4b0=this;return new Promise(function(_0x2ae8e8,_0x239ced){return db[_0x1e6f('0x18')][_0x1e6f('0x22')]({'raw':_0x3fdf0e[_0x1e6f('0x1a')]?_0x3fdf0e['options'][_0x1e6f('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fdf0e['options']?_0x3fdf0e[_0x1e6f('0x1a')][_0x1e6f('0x1c')]||null:null,'attributes':_0x3fdf0e[_0x1e6f('0x1a')]?_0x3fdf0e[_0x1e6f('0x1a')]['attributes']||null:null,'include':_0x3fdf0e[_0x1e6f('0x1a')]?_0x3fdf0e['options'][_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x3fdf0e[_0x1e6f('0x1a')]['include'],function(_0x44149d){return{'model':db[_0x44149d[_0x1e6f('0x20')]],'as':_0x44149d['as'],'attributes':_0x44149d[_0x1e6f('0x21')],'include':_0x44149d[_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x44149d['include'],function(_0x47d75b){return{'model':db[_0x47d75b['model']],'as':_0x47d75b['as'],'attributes':_0x47d75b['attributes'],'include':_0x47d75b[_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x47d75b[_0x1e6f('0x1e')],function(_0x792a4e){return{'model':db[_0x792a4e[_0x1e6f('0x20')]],'as':_0x792a4e['as'],'attributes':_0x792a4e[_0x1e6f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1e6f('0xd')](function(_0x502c70){logger['info'](_0x1e6f('0x23'),_0x3fdf0e);logger['debug'](_0x1e6f('0x23'),_0x3fdf0e,JSON['stringify'](_0x502c70));_0x2ae8e8(_0x502c70);})[_0x1e6f('0x16')](function(_0x152b3d){logger['error']('ShowSugarcrmAccount',_0x152b3d[_0x1e6f('0x14')],_0x3fdf0e);_0x239ced(_0x58b4b0[_0x1e6f('0x12')](0x1f4,_0x152b3d[_0x1e6f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b4ed995..4bd7d7e 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 _0x2cc3=['getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','delete','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id/fields','/:id/subjects'];(function(_0x476914,_0x3e1d98){var _0x19e6f7=function(_0x16a2a8){while(--_0x16a2a8){_0x476914['push'](_0x476914['shift']());}};_0x19e6f7(++_0x3e1d98);}(_0x2cc3,0x1e3));var _0x32cc=function(_0x167f46,_0xb9b7df){_0x167f46=_0x167f46-0x0;var _0x15c3c6=_0x2cc3[_0x167f46];return _0x15c3c6;};'use strict';var multer=require('multer');var util=require(_0x32cc('0x0'));var path=require('path');var timeout=require(_0x32cc('0x1'));var express=require('express');var router=express[_0x32cc('0x2')]();var fs_extra=require(_0x32cc('0x3'));var auth=require(_0x32cc('0x4'));var interaction=require(_0x32cc('0x5'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x32cc('0x6')]('/',auth[_0x32cc('0x7')](),controller['index']);router['get']('/:id',auth[_0x32cc('0x7')](),controller['show']);router[_0x32cc('0x6')](_0x32cc('0x8'),auth[_0x32cc('0x7')](),controller['getFields']);router['get'](_0x32cc('0x9'),auth['isAuthenticated'](),controller[_0x32cc('0xa')]);router[_0x32cc('0x6')](_0x32cc('0xb'),auth[_0x32cc('0x7')](),controller[_0x32cc('0xc')]);router['post']('/',auth[_0x32cc('0x7')](),controller[_0x32cc('0xd')]);router[_0x32cc('0xe')](_0x32cc('0xf'),auth[_0x32cc('0x7')](),controller['update']);router[_0x32cc('0x10')](_0x32cc('0xf'),auth[_0x32cc('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe5eb=['isAuthenticated','index','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get'];(function(_0x33055f,_0x24cf57){var _0x8dae2e=function(_0x253a94){while(--_0x253a94){_0x33055f['push'](_0x33055f['shift']());}};_0x8dae2e(++_0x24cf57);}(_0xe5eb,0x19b));var _0xbe5e=function(_0x33dc51,_0x1d6b24){_0x33dc51=_0x33dc51-0x0;var _0x5bbd34=_0xe5eb[_0x33dc51];return _0x5bbd34;};'use strict';var multer=require(_0xbe5e('0x0'));var util=require(_0xbe5e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe5e('0x2'));var router=express[_0xbe5e('0x3')]();var fs_extra=require(_0xbe5e('0x4'));var auth=require(_0xbe5e('0x5'));var interaction=require(_0xbe5e('0x6'));var config=require('../../config/environment');var controller=require(_0xbe5e('0x7'));router[_0xbe5e('0x8')]('/',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xa')]);router[_0xbe5e('0x8')]('/:id',auth[_0xbe5e('0x9')](),controller['show']);router[_0xbe5e('0x8')]('/:id/fields',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xb')]);router[_0xbe5e('0x8')](_0xbe5e('0xc'),auth['isAuthenticated'](),controller[_0xbe5e('0xd')]);router[_0xbe5e('0x8')]('/:id/descriptions',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xe')]);router[_0xbe5e('0xf')]('/',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0x10')]);router[_0xbe5e('0x11')](_0xbe5e('0x12'),auth['isAuthenticated'](),controller[_0xbe5e('0x13')]);router[_0xbe5e('0x14')](_0xbe5e('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 9609074..eaf214d 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 _0x380d=['STRING','sequelize','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x380d,0xa6));var _0xd380=function(_0x44ba85,_0x478695){_0x44ba85=_0x44ba85-0x0;var _0x32545d=_0x380d[_0x44ba85];return _0x32545d;};'use strict';var Sequelize=require(_0xd380('0x0'));module[_0xd380('0x1')]={'name':{'type':Sequelize[_0xd380('0x2')]},'description':{'type':Sequelize[_0xd380('0x2')]}}; \ No newline at end of file +var _0xa7df=['exports','STRING'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xa7df,0xf0));var _0xfa7d=function(_0x1b030d,_0x33bdf4){_0x1b030d=_0x1b030d-0x0;var _0x1be548=_0xa7df[_0x1b030d];return _0x1be548;};'use strict';var Sequelize=require('sequelize');module[_0xfa7d('0x0')]={'name':{'type':Sequelize[_0xfa7d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 88e6342..45ee20c 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 _0x34a8=['VIRTUAL','filter','options','includeAll','include','SugarcrmConfiguration','findAll','rows','catch','show','params','model','merge','find','create','body','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick'];(function(_0x1ac6f0,_0x40e0c3){var _0x3d6404=function(_0x38facc){while(--_0x38facc){_0x1ac6f0['push'](_0x1ac6f0['shift']());}};_0x3d6404(++_0x40e0c3);}(_0x34a8,0xb8));var _0x834a=function(_0x1b5a2a,_0x2a0575){_0x1b5a2a=_0x1b5a2a-0x0;var _0x1f000a=_0x34a8[_0x1b5a2a];return _0x1f000a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x834a('0x0'));var rp=require(_0x834a('0x1'));var moment=require(_0x834a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x834a('0x3'));var util=require(_0x834a('0x4'));var path=require(_0x834a('0x5'));var sox=require(_0x834a('0x6'));var csv=require(_0x834a('0x7'));var ejs=require(_0x834a('0x8'));var fs=require('fs');var fs_extra=require(_0x834a('0x9'));var _=require('lodash');var squel=require(_0x834a('0xa'));var crypto=require(_0x834a('0xb'));var jsforce=require(_0x834a('0xc'));var deskjs=require(_0x834a('0xd'));var toCsv=require(_0x834a('0x7'));var querystring=require(_0x834a('0xe'));var Papa=require(_0x834a('0xf'));var Redis=require(_0x834a('0x10'));var authService=require(_0x834a('0x11'));var qs=require(_0x834a('0x12'));var as=require(_0x834a('0x13'));var hardwareService=require(_0x834a('0x14'));var logger=require(_0x834a('0x15'))(_0x834a('0x16'));var utils=require('../../config/utils');var config=require(_0x834a('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec0ac,_0x3035b1){_0x3035b1=_0x3035b1||0xcc;return function(_0x6d1a47){if(_0x6d1a47){return _0x3ec0ac[_0x834a('0x18')](_0x3035b1);}return _0x3ec0ac[_0x834a('0x19')](_0x3035b1)[_0x834a('0x1a')]();};}function respondWithResult(_0x4d6892,_0x585a6d){_0x585a6d=_0x585a6d||0xc8;return function(_0x1a063c){if(_0x1a063c){return _0x4d6892[_0x834a('0x19')](_0x585a6d)[_0x834a('0x1b')](_0x1a063c);}};}function respondWithFilteredResult(_0x3d30c3,_0xceda07){return function(_0x20eddb){if(_0x20eddb){var _0x1dfd4b=typeof _0xceda07['offset']===_0x834a('0x1c')&&typeof _0xceda07['limit']===_0x834a('0x1c');var _0x555e94=_0x20eddb[_0x834a('0x1d')];var _0xa5c6a3=_0x1dfd4b?0x0:_0xceda07[_0x834a('0x1e')];var _0x32b7c1=_0x1dfd4b?_0x20eddb['count']:_0xceda07['offset']+_0xceda07[_0x834a('0x1f')];var _0x42013d;if(_0x32b7c1>=_0x555e94){_0x32b7c1=_0x555e94;_0x42013d=0xc8;}else{_0x42013d=0xce;}_0x3d30c3[_0x834a('0x19')](_0x42013d);return _0x3d30c3[_0x834a('0x20')]('Content-Range',_0xa5c6a3+'-'+_0x32b7c1+'/'+_0x555e94)[_0x834a('0x1b')](_0x20eddb);}return null;};}function patchUpdates(_0x25ad3c){return function(_0x2cb319){try{jsonpatch[_0x834a('0x21')](_0x2cb319,_0x25ad3c,!![]);}catch(_0x396bb3){return BPromise[_0x834a('0x22')](_0x396bb3);}return _0x2cb319['save']();};}function saveUpdates(_0x12a3bb,_0x4b26ba){return function(_0x2c9a3c){if(_0x2c9a3c){return _0x2c9a3c[_0x834a('0x23')](_0x12a3bb)['then'](function(_0x4b5c4d){return _0x4b5c4d;});}return null;};}function removeEntity(_0x4103a7,_0x4d8ed4){return function(_0x22ed20){if(_0x22ed20){return _0x22ed20[_0x834a('0x24')]()[_0x834a('0x25')](function(){_0x4103a7[_0x834a('0x19')](0xcc)[_0x834a('0x1a')]();});}};}function handleEntityNotFound(_0x5476df,_0x38c86d){return function(_0x5ea562){if(!_0x5ea562){_0x5476df[_0x834a('0x18')](0x194);}return _0x5ea562;};}function handleError(_0x59430e,_0x532371){_0x532371=_0x532371||0x1f4;return function(_0x1672bb){logger[_0x834a('0x26')](_0x1672bb[_0x834a('0x27')]);if(_0x1672bb['name']){delete _0x1672bb[_0x834a('0x28')];}_0x59430e[_0x834a('0x19')](_0x532371)[_0x834a('0x29')](_0x1672bb);};}exports[_0x834a('0x2a')]=function(_0x3aeb89,_0xb39114){var _0x5b2415={},_0x5017cd={},_0x4e4c6d={'count':0x0,'rows':[]};var _0x785677=_['map'](db['SugarcrmConfiguration'][_0x834a('0x2b')],function(_0x346131){return{'name':_0x346131[_0x834a('0x2c')],'type':_0x346131[_0x834a('0x2d')]['key']};});_0x5017cd['model']=_[_0x834a('0x2e')](_0x785677,_0x834a('0x28'));_0x5017cd[_0x834a('0x2f')]=_[_0x834a('0x30')](_0x3aeb89[_0x834a('0x2f')]);_0x5017cd[_0x834a('0x31')]=_['intersection'](_0x5017cd['model'],_0x5017cd[_0x834a('0x2f')]);_0x5b2415[_0x834a('0x32')]=_[_0x834a('0x33')](_0x5017cd['model'],qs[_0x834a('0x34')](_0x3aeb89[_0x834a('0x2f')][_0x834a('0x34')]));_0x5b2415[_0x834a('0x32')]=_0x5b2415[_0x834a('0x32')][_0x834a('0x35')]?_0x5b2415[_0x834a('0x32')]:_0x5017cd['model'];if(!_0x3aeb89[_0x834a('0x2f')]['hasOwnProperty'](_0x834a('0x36'))){_0x5b2415[_0x834a('0x1f')]=qs['limit'](_0x3aeb89['query'][_0x834a('0x1f')]);_0x5b2415[_0x834a('0x1e')]=qs['offset'](_0x3aeb89[_0x834a('0x2f')]['offset']);}_0x5b2415[_0x834a('0x37')]=qs[_0x834a('0x38')](_0x3aeb89[_0x834a('0x2f')]['sort']);_0x5b2415[_0x834a('0x39')]=qs[_0x834a('0x31')](_[_0x834a('0x3a')](_0x3aeb89[_0x834a('0x2f')],_0x5017cd[_0x834a('0x31')]),_0x785677);if(_0x3aeb89[_0x834a('0x2f')]['filter']){_0x5b2415['where']=_['merge'](_0x5b2415[_0x834a('0x39')],{'$or':_['map'](_0x785677,function(_0x1fbc82){if(_0x1fbc82[_0x834a('0x2d')]!==_0x834a('0x3b')){var _0x26dbde={};_0x26dbde[_0x1fbc82[_0x834a('0x28')]]={'$like':'%'+_0x3aeb89[_0x834a('0x2f')][_0x834a('0x3c')]+'%'};return _0x26dbde;}})});}_0x5b2415=_['merge']({},_0x5b2415,_0x3aeb89[_0x834a('0x3d')]);var _0x35e25c={'where':_0x5b2415[_0x834a('0x39')]};return db['SugarcrmConfiguration'][_0x834a('0x1d')](_0x35e25c)['then'](function(_0x4229ce){_0x4e4c6d[_0x834a('0x1d')]=_0x4229ce;if(_0x3aeb89[_0x834a('0x2f')][_0x834a('0x3e')]){_0x5b2415[_0x834a('0x3f')]=[{'all':!![]}];}return db[_0x834a('0x40')][_0x834a('0x41')](_0x5b2415);})[_0x834a('0x25')](function(_0x76942b){_0x4e4c6d[_0x834a('0x42')]=_0x76942b;return _0x4e4c6d;})['then'](respondWithFilteredResult(_0xb39114,_0x5b2415))[_0x834a('0x43')](handleError(_0xb39114,null));};exports[_0x834a('0x44')]=function(_0x1700be,_0x360d13){var _0x232ad4={'raw':![],'where':{'id':_0x1700be[_0x834a('0x45')]['id']}},_0x2ec348={};_0x2ec348['model']=_[_0x834a('0x30')](db[_0x834a('0x40')][_0x834a('0x2b')]);_0x2ec348[_0x834a('0x2f')]=_['keys'](_0x1700be[_0x834a('0x2f')]);_0x2ec348['filters']=_[_0x834a('0x33')](_0x2ec348[_0x834a('0x46')],_0x2ec348[_0x834a('0x2f')]);_0x232ad4['attributes']=_[_0x834a('0x33')](_0x2ec348[_0x834a('0x46')],qs[_0x834a('0x34')](_0x1700be[_0x834a('0x2f')][_0x834a('0x34')]));_0x232ad4[_0x834a('0x32')]=_0x232ad4['attributes'][_0x834a('0x35')]?_0x232ad4[_0x834a('0x32')]:_0x2ec348['model'];if(_0x1700be[_0x834a('0x2f')][_0x834a('0x3e')]){_0x232ad4[_0x834a('0x3f')]=[{'all':!![]}];}_0x232ad4=_[_0x834a('0x47')]({},_0x232ad4,_0x1700be[_0x834a('0x3d')]);return db[_0x834a('0x40')][_0x834a('0x48')](_0x232ad4)[_0x834a('0x25')](handleEntityNotFound(_0x360d13,null))[_0x834a('0x25')](respondWithResult(_0x360d13,null))[_0x834a('0x43')](handleError(_0x360d13,null));};exports[_0x834a('0x49')]=function(_0x4d605f,_0x5a9a36){return db[_0x834a('0x40')]['create'](_0x4d605f[_0x834a('0x4a')],{})[_0x834a('0x25')](respondWithResult(_0x5a9a36,0xc9))[_0x834a('0x43')](handleError(_0x5a9a36,null));};exports[_0x834a('0x23')]=function(_0x34c2bd,_0x42aed5){if(_0x34c2bd[_0x834a('0x4a')]['id']){delete _0x34c2bd['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x34c2bd[_0x834a('0x45')]['id']}})[_0x834a('0x25')](handleEntityNotFound(_0x42aed5,null))['then'](saveUpdates(_0x34c2bd[_0x834a('0x4a')],null))[_0x834a('0x25')](respondWithResult(_0x42aed5,null))[_0x834a('0x43')](handleError(_0x42aed5,null));};exports[_0x834a('0x24')]=function(_0x4b33d3,_0x3f4324){return db[_0x834a('0x40')]['find']({'where':{'id':_0x4b33d3[_0x834a('0x45')]['id']}})[_0x834a('0x25')](handleEntityNotFound(_0x3f4324,null))[_0x834a('0x25')](removeEntity(_0x3f4324,null))[_0x834a('0x43')](handleError(_0x3f4324,null));};exports[_0x834a('0x4b')]=function(_0x3c71dc,_0x2bd391,_0x322abc){var _0x3ee529={};var _0x5e2281={};var _0x38fa6e;var _0x1697d6;return db[_0x834a('0x40')][_0x834a('0x4c')]({'where':{'id':_0x3c71dc[_0x834a('0x45')]['id']}})[_0x834a('0x25')](handleEntityNotFound(_0x2bd391,null))[_0x834a('0x25')](function(_0x492c7a){if(_0x492c7a){_0x38fa6e=_0x492c7a;_0x5e2281['model']=_[_0x834a('0x30')](db[_0x834a('0x4d')][_0x834a('0x2b')]);_0x5e2281[_0x834a('0x2f')]=_[_0x834a('0x30')](_0x3c71dc[_0x834a('0x2f')]);_0x5e2281['filters']=_[_0x834a('0x33')](_0x5e2281[_0x834a('0x46')],_0x5e2281[_0x834a('0x2f')]);_0x3ee529[_0x834a('0x32')]=_[_0x834a('0x33')](_0x5e2281[_0x834a('0x46')],qs[_0x834a('0x34')](_0x3c71dc[_0x834a('0x2f')]['fields']));_0x3ee529[_0x834a('0x32')]=_0x3ee529[_0x834a('0x32')][_0x834a('0x35')]?_0x3ee529[_0x834a('0x32')]:_0x5e2281[_0x834a('0x46')];_0x3ee529[_0x834a('0x37')]=qs['sort'](_0x3c71dc[_0x834a('0x2f')]['sort']);_0x3ee529['where']=qs[_0x834a('0x31')](_[_0x834a('0x3a')](_0x3c71dc[_0x834a('0x2f')],_0x5e2281[_0x834a('0x31')]));if(_0x3c71dc[_0x834a('0x2f')][_0x834a('0x3c')]){_0x3ee529['where']=_[_0x834a('0x47')](_0x3ee529['where'],{'$or':_['map'](_0x3ee529[_0x834a('0x32')],function(_0x3d0248){var _0x1e27d2={};_0x1e27d2[_0x3d0248]={'$like':'%'+_0x3c71dc['query']['filter']+'%'};return _0x1e27d2;})});}_0x3ee529=_[_0x834a('0x47')]({},_0x3ee529,_0x3c71dc[_0x834a('0x3d')]);return _0x38fa6e['getFields'](_0x3ee529);}})[_0x834a('0x25')](function(_0x5dc0c0){if(_0x5dc0c0){_0x1697d6=_0x5dc0c0['length'];if(!_0x3c71dc[_0x834a('0x2f')][_0x834a('0x4e')](_0x834a('0x36'))){_0x3ee529['limit']=qs[_0x834a('0x1f')](_0x3c71dc['query'][_0x834a('0x1f')]);_0x3ee529[_0x834a('0x1e')]=qs[_0x834a('0x1e')](_0x3c71dc[_0x834a('0x2f')][_0x834a('0x1e')]);}return _0x38fa6e['getFields'](_0x3ee529);}})[_0x834a('0x25')](function(_0x2e30ee){if(_0x2e30ee){return _0x2e30ee?{'count':_0x1697d6,'rows':_0x2e30ee}:null;}})[_0x834a('0x25')](respondWithResult(_0x2bd391,null))[_0x834a('0x43')](handleError(_0x2bd391,null));};exports[_0x834a('0x4f')]=function(_0x6dc8bb,_0x5274f1,_0x50d96d){var _0x5e9454={};var _0x151453={};var _0xa897f4;var _0x3dc56d;return db['SugarcrmConfiguration'][_0x834a('0x4c')]({'where':{'id':_0x6dc8bb[_0x834a('0x45')]['id']}})[_0x834a('0x25')](handleEntityNotFound(_0x5274f1,null))[_0x834a('0x25')](function(_0x23883e){if(_0x23883e){_0xa897f4=_0x23883e;_0x151453[_0x834a('0x46')]=_[_0x834a('0x30')](db[_0x834a('0x4d')]['rawAttributes']);_0x151453[_0x834a('0x2f')]=_[_0x834a('0x30')](_0x6dc8bb[_0x834a('0x2f')]);_0x151453[_0x834a('0x31')]=_['intersection'](_0x151453[_0x834a('0x46')],_0x151453['query']);_0x5e9454['attributes']=_[_0x834a('0x33')](_0x151453['model'],qs[_0x834a('0x34')](_0x6dc8bb[_0x834a('0x2f')][_0x834a('0x34')]));_0x5e9454['attributes']=_0x5e9454[_0x834a('0x32')][_0x834a('0x35')]?_0x5e9454[_0x834a('0x32')]:_0x151453['model'];_0x5e9454[_0x834a('0x37')]=qs[_0x834a('0x38')](_0x6dc8bb['query'][_0x834a('0x38')]);_0x5e9454[_0x834a('0x39')]=qs[_0x834a('0x31')](_[_0x834a('0x3a')](_0x6dc8bb[_0x834a('0x2f')],_0x151453[_0x834a('0x31')]));if(_0x6dc8bb[_0x834a('0x2f')][_0x834a('0x3c')]){_0x5e9454[_0x834a('0x39')]=_[_0x834a('0x47')](_0x5e9454[_0x834a('0x39')],{'$or':_['map'](_0x5e9454['attributes'],function(_0x180da0){var _0x4a60b2={};_0x4a60b2[_0x180da0]={'$like':'%'+_0x6dc8bb[_0x834a('0x2f')][_0x834a('0x3c')]+'%'};return _0x4a60b2;})});}_0x5e9454=_[_0x834a('0x47')]({},_0x5e9454,_0x6dc8bb[_0x834a('0x3d')]);return _0xa897f4[_0x834a('0x4f')](_0x5e9454);}})['then'](function(_0x4d2e0e){if(_0x4d2e0e){_0x3dc56d=_0x4d2e0e['length'];if(!_0x6dc8bb[_0x834a('0x2f')][_0x834a('0x4e')]('nolimit')){_0x5e9454[_0x834a('0x1f')]=qs[_0x834a('0x1f')](_0x6dc8bb[_0x834a('0x2f')][_0x834a('0x1f')]);_0x5e9454['offset']=qs[_0x834a('0x1e')](_0x6dc8bb[_0x834a('0x2f')][_0x834a('0x1e')]);}return _0xa897f4[_0x834a('0x4f')](_0x5e9454);}})[_0x834a('0x25')](function(_0xe0e329){if(_0xe0e329){return _0xe0e329?{'count':_0x3dc56d,'rows':_0xe0e329}:null;}})[_0x834a('0x25')](respondWithResult(_0x5274f1,null))[_0x834a('0x43')](handleError(_0x5274f1,null));};exports[_0x834a('0x50')]=function(_0x226797,_0x1ec365,_0x394501){var _0x3fe158={};var _0x56b466={};var _0x44d303;var _0x536d5a;return db['SugarcrmConfiguration'][_0x834a('0x4c')]({'where':{'id':_0x226797[_0x834a('0x45')]['id']}})[_0x834a('0x25')](handleEntityNotFound(_0x1ec365,null))['then'](function(_0x42d80f){if(_0x42d80f){_0x44d303=_0x42d80f;_0x56b466[_0x834a('0x46')]=_[_0x834a('0x30')](db[_0x834a('0x4d')][_0x834a('0x2b')]);_0x56b466[_0x834a('0x2f')]=_[_0x834a('0x30')](_0x226797[_0x834a('0x2f')]);_0x56b466[_0x834a('0x31')]=_[_0x834a('0x33')](_0x56b466[_0x834a('0x46')],_0x56b466[_0x834a('0x2f')]);_0x3fe158[_0x834a('0x32')]=_[_0x834a('0x33')](_0x56b466[_0x834a('0x46')],qs[_0x834a('0x34')](_0x226797[_0x834a('0x2f')][_0x834a('0x34')]));_0x3fe158[_0x834a('0x32')]=_0x3fe158['attributes']['length']?_0x3fe158['attributes']:_0x56b466[_0x834a('0x46')];_0x3fe158[_0x834a('0x37')]=qs[_0x834a('0x38')](_0x226797[_0x834a('0x2f')][_0x834a('0x38')]);_0x3fe158['where']=qs[_0x834a('0x31')](_[_0x834a('0x3a')](_0x226797['query'],_0x56b466[_0x834a('0x31')]));if(_0x226797[_0x834a('0x2f')][_0x834a('0x3c')]){_0x3fe158[_0x834a('0x39')]=_['merge'](_0x3fe158[_0x834a('0x39')],{'$or':_['map'](_0x3fe158['attributes'],function(_0x42c227){var _0x5f24d9={};_0x5f24d9[_0x42c227]={'$like':'%'+_0x226797[_0x834a('0x2f')][_0x834a('0x3c')]+'%'};return _0x5f24d9;})});}_0x3fe158=_['merge']({},_0x3fe158,_0x226797[_0x834a('0x3d')]);return _0x44d303[_0x834a('0x50')](_0x3fe158);}})[_0x834a('0x25')](function(_0x65a5a2){if(_0x65a5a2){_0x536d5a=_0x65a5a2[_0x834a('0x35')];if(!_0x226797['query']['hasOwnProperty']('nolimit')){_0x3fe158[_0x834a('0x1f')]=qs['limit'](_0x226797[_0x834a('0x2f')][_0x834a('0x1f')]);_0x3fe158[_0x834a('0x1e')]=qs['offset'](_0x226797['query'][_0x834a('0x1e')]);}return _0x44d303[_0x834a('0x50')](_0x3fe158);}})[_0x834a('0x25')](function(_0x3ae4a6){if(_0x3ae4a6){return _0x3ae4a6?{'count':_0x536d5a,'rows':_0x3ae4a6}:null;}})[_0x834a('0x25')](respondWithResult(_0x1ec365,null))['catch'](handleError(_0x1ec365,null));}; \ No newline at end of file +var _0x42be=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','SugarcrmConfiguration','rawAttributes','fieldName','key','map','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','fields','find','create','body','catch','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x590678,_0x35aa33){var _0xfd7bca=function(_0x2ae17a){while(--_0x2ae17a){_0x590678['push'](_0x590678['shift']());}};_0xfd7bca(++_0x35aa33);}(_0x42be,0xe5));var _0xe42b=function(_0x20c865,_0x8f8ec2){_0x20c865=_0x20c865-0x0;var _0x3369b4=_0x42be[_0x20c865];return _0x3369b4;};'use strict';var emlformat=require(_0xe42b('0x0'));var rimraf=require(_0xe42b('0x1'));var zipdir=require(_0xe42b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe42b('0x3'));var moment=require(_0xe42b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe42b('0x5'));var util=require('util');var path=require(_0xe42b('0x6'));var sox=require(_0xe42b('0x7'));var csv=require(_0xe42b('0x8'));var ejs=require(_0xe42b('0x9'));var fs=require('fs');var fs_extra=require(_0xe42b('0xa'));var _=require(_0xe42b('0xb'));var squel=require(_0xe42b('0xc'));var crypto=require(_0xe42b('0xd'));var jsforce=require(_0xe42b('0xe'));var deskjs=require(_0xe42b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe42b('0x10'));var Papa=require('papaparse');var Redis=require(_0xe42b('0x11'));var authService=require(_0xe42b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe42b('0x13'));var hardwareService=require(_0xe42b('0x14'));var logger=require(_0xe42b('0x15'))('api');var utils=require(_0xe42b('0x16'));var config=require(_0xe42b('0x17'));var licenseUtil=require(_0xe42b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c165a,_0x4a6909){_0x4a6909=_0x4a6909||0xcc;return function(_0x3a9d64){if(_0x3a9d64){return _0x3c165a['sendStatus'](_0x4a6909);}return _0x3c165a[_0xe42b('0x19')](_0x4a6909)[_0xe42b('0x1a')]();};}function respondWithResult(_0x297b26,_0xa788a){_0xa788a=_0xa788a||0xc8;return function(_0x308664){if(_0x308664){return _0x297b26[_0xe42b('0x19')](_0xa788a)[_0xe42b('0x1b')](_0x308664);}};}function respondWithFilteredResult(_0xba51df,_0x388397){return function(_0x1d6271){if(_0x1d6271){var _0x5122c7=typeof _0x388397[_0xe42b('0x1c')]===_0xe42b('0x1d')&&typeof _0x388397[_0xe42b('0x1e')]===_0xe42b('0x1d');var _0x405fe6=_0x1d6271[_0xe42b('0x1f')];var _0x287736=_0x5122c7?0x0:_0x388397['offset'];var _0x5d2272=_0x5122c7?_0x1d6271['count']:_0x388397[_0xe42b('0x1c')]+_0x388397[_0xe42b('0x1e')];var _0xd17ae3;if(_0x5d2272>=_0x405fe6){_0x5d2272=_0x405fe6;_0xd17ae3=0xc8;}else{_0xd17ae3=0xce;}_0xba51df[_0xe42b('0x19')](_0xd17ae3);return _0xba51df[_0xe42b('0x20')](_0xe42b('0x21'),_0x287736+'-'+_0x5d2272+'/'+_0x405fe6)[_0xe42b('0x1b')](_0x1d6271);}return null;};}function patchUpdates(_0x4cabd9){return function(_0x2aa399){try{jsonpatch[_0xe42b('0x22')](_0x2aa399,_0x4cabd9,!![]);}catch(_0x4f0c5b){return BPromise[_0xe42b('0x23')](_0x4f0c5b);}return _0x2aa399['save']();};}function saveUpdates(_0x3515f0,_0x19ecc1){return function(_0x1687c4){if(_0x1687c4){return _0x1687c4[_0xe42b('0x24')](_0x3515f0)[_0xe42b('0x25')](function(_0x2953cf){return _0x2953cf;});}return null;};}function removeEntity(_0x344dc3,_0x14ea23){return function(_0x42663e){if(_0x42663e){return _0x42663e[_0xe42b('0x26')]()['then'](function(){_0x344dc3[_0xe42b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x588f35,_0x148dbe){return function(_0x9ff601){if(!_0x9ff601){_0x588f35[_0xe42b('0x27')](0x194);}return _0x9ff601;};}function handleError(_0x5d7831,_0x130861){_0x130861=_0x130861||0x1f4;return function(_0x224e44){logger[_0xe42b('0x28')](_0x224e44[_0xe42b('0x29')]);if(_0x224e44[_0xe42b('0x2a')]){delete _0x224e44[_0xe42b('0x2a')];}_0x5d7831['status'](_0x130861)[_0xe42b('0x2b')](_0x224e44);};}exports['index']=function(_0x120bc1,_0x495877){var _0x5dc867={},_0x15b359={},_0x560b95={'count':0x0,'rows':[]};var _0x59e82c=_['map'](db[_0xe42b('0x2c')][_0xe42b('0x2d')],function(_0x196b94){return{'name':_0x196b94[_0xe42b('0x2e')],'type':_0x196b94['type'][_0xe42b('0x2f')]};});_0x15b359['model']=_[_0xe42b('0x30')](_0x59e82c,_0xe42b('0x2a'));_0x15b359[_0xe42b('0x31')]=_['keys'](_0x120bc1[_0xe42b('0x31')]);_0x15b359['filters']=_[_0xe42b('0x32')](_0x15b359[_0xe42b('0x33')],_0x15b359[_0xe42b('0x31')]);_0x5dc867['attributes']=_[_0xe42b('0x32')](_0x15b359[_0xe42b('0x33')],qs['fields'](_0x120bc1[_0xe42b('0x31')]['fields']));_0x5dc867[_0xe42b('0x34')]=_0x5dc867[_0xe42b('0x34')][_0xe42b('0x35')]?_0x5dc867[_0xe42b('0x34')]:_0x15b359[_0xe42b('0x33')];if(!_0x120bc1[_0xe42b('0x31')][_0xe42b('0x36')](_0xe42b('0x37'))){_0x5dc867['limit']=qs[_0xe42b('0x1e')](_0x120bc1[_0xe42b('0x31')][_0xe42b('0x1e')]);_0x5dc867[_0xe42b('0x1c')]=qs['offset'](_0x120bc1['query']['offset']);}_0x5dc867[_0xe42b('0x38')]=qs[_0xe42b('0x39')](_0x120bc1[_0xe42b('0x31')][_0xe42b('0x39')]);_0x5dc867[_0xe42b('0x3a')]=qs[_0xe42b('0x3b')](_[_0xe42b('0x3c')](_0x120bc1['query'],_0x15b359[_0xe42b('0x3b')]),_0x59e82c);if(_0x120bc1[_0xe42b('0x31')][_0xe42b('0x3d')]){_0x5dc867[_0xe42b('0x3a')]=_[_0xe42b('0x3e')](_0x5dc867[_0xe42b('0x3a')],{'$or':_['map'](_0x59e82c,function(_0x15f179){if(_0x15f179[_0xe42b('0x3f')]!==_0xe42b('0x40')){var _0xbeafd5={};_0xbeafd5[_0x15f179[_0xe42b('0x2a')]]={'$like':'%'+_0x120bc1['query']['filter']+'%'};return _0xbeafd5;}})});}_0x5dc867=_['merge']({},_0x5dc867,_0x120bc1[_0xe42b('0x41')]);var _0x23cf18={'where':_0x5dc867[_0xe42b('0x3a')]};return db[_0xe42b('0x2c')][_0xe42b('0x1f')](_0x23cf18)[_0xe42b('0x25')](function(_0x30d393){_0x560b95['count']=_0x30d393;if(_0x120bc1[_0xe42b('0x31')][_0xe42b('0x42')]){_0x5dc867[_0xe42b('0x43')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x5dc867);})[_0xe42b('0x25')](function(_0x5f98cb){_0x560b95[_0xe42b('0x44')]=_0x5f98cb;return _0x560b95;})[_0xe42b('0x25')](respondWithFilteredResult(_0x495877,_0x5dc867))['catch'](handleError(_0x495877,null));};exports[_0xe42b('0x45')]=function(_0x2f4b23,_0x138d78){var _0x83c9df={'raw':![],'where':{'id':_0x2f4b23[_0xe42b('0x46')]['id']}},_0x410862={};_0x410862[_0xe42b('0x33')]=_[_0xe42b('0x47')](db[_0xe42b('0x2c')][_0xe42b('0x2d')]);_0x410862[_0xe42b('0x31')]=_[_0xe42b('0x47')](_0x2f4b23[_0xe42b('0x31')]);_0x410862[_0xe42b('0x3b')]=_['intersection'](_0x410862[_0xe42b('0x33')],_0x410862[_0xe42b('0x31')]);_0x83c9df[_0xe42b('0x34')]=_['intersection'](_0x410862[_0xe42b('0x33')],qs[_0xe42b('0x48')](_0x2f4b23[_0xe42b('0x31')][_0xe42b('0x48')]));_0x83c9df[_0xe42b('0x34')]=_0x83c9df[_0xe42b('0x34')][_0xe42b('0x35')]?_0x83c9df[_0xe42b('0x34')]:_0x410862[_0xe42b('0x33')];if(_0x2f4b23[_0xe42b('0x31')]['includeAll']){_0x83c9df['include']=[{'all':!![]}];}_0x83c9df=_[_0xe42b('0x3e')]({},_0x83c9df,_0x2f4b23[_0xe42b('0x41')]);return db['SugarcrmConfiguration'][_0xe42b('0x49')](_0x83c9df)[_0xe42b('0x25')](handleEntityNotFound(_0x138d78,null))[_0xe42b('0x25')](respondWithResult(_0x138d78,null))['catch'](handleError(_0x138d78,null));};exports[_0xe42b('0x4a')]=function(_0x3ff3f3,_0x43f862){return db[_0xe42b('0x2c')][_0xe42b('0x4a')](_0x3ff3f3[_0xe42b('0x4b')],{})['then'](respondWithResult(_0x43f862,0xc9))[_0xe42b('0x4c')](handleError(_0x43f862,null));};exports[_0xe42b('0x24')]=function(_0x54517f,_0x1355ec){if(_0x54517f[_0xe42b('0x4b')]['id']){delete _0x54517f[_0xe42b('0x4b')]['id'];}return db[_0xe42b('0x2c')][_0xe42b('0x49')]({'where':{'id':_0x54517f[_0xe42b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1355ec,null))[_0xe42b('0x25')](saveUpdates(_0x54517f['body'],null))[_0xe42b('0x25')](respondWithResult(_0x1355ec,null))[_0xe42b('0x4c')](handleError(_0x1355ec,null));};exports[_0xe42b('0x26')]=function(_0x354242,_0xa3c7f3){return db[_0xe42b('0x2c')][_0xe42b('0x49')]({'where':{'id':_0x354242[_0xe42b('0x46')]['id']}})['then'](handleEntityNotFound(_0xa3c7f3,null))[_0xe42b('0x25')](removeEntity(_0xa3c7f3,null))['catch'](handleError(_0xa3c7f3,null));};exports[_0xe42b('0x4d')]=function(_0x1b7734,_0xf8bb97,_0x28e350){var _0x203d9c={};var _0x150bc2={};var _0x419734;var _0x392a3b;return db[_0xe42b('0x2c')][_0xe42b('0x4e')]({'where':{'id':_0x1b7734[_0xe42b('0x46')]['id']}})[_0xe42b('0x25')](handleEntityNotFound(_0xf8bb97,null))['then'](function(_0x647f4e){if(_0x647f4e){_0x419734=_0x647f4e;_0x150bc2['model']=_[_0xe42b('0x47')](db[_0xe42b('0x4f')][_0xe42b('0x2d')]);_0x150bc2[_0xe42b('0x31')]=_['keys'](_0x1b7734[_0xe42b('0x31')]);_0x150bc2[_0xe42b('0x3b')]=_['intersection'](_0x150bc2[_0xe42b('0x33')],_0x150bc2[_0xe42b('0x31')]);_0x203d9c['attributes']=_['intersection'](_0x150bc2[_0xe42b('0x33')],qs['fields'](_0x1b7734[_0xe42b('0x31')]['fields']));_0x203d9c[_0xe42b('0x34')]=_0x203d9c['attributes'][_0xe42b('0x35')]?_0x203d9c[_0xe42b('0x34')]:_0x150bc2[_0xe42b('0x33')];_0x203d9c[_0xe42b('0x38')]=qs[_0xe42b('0x39')](_0x1b7734[_0xe42b('0x31')]['sort']);_0x203d9c[_0xe42b('0x3a')]=qs[_0xe42b('0x3b')](_['pick'](_0x1b7734[_0xe42b('0x31')],_0x150bc2[_0xe42b('0x3b')]));if(_0x1b7734[_0xe42b('0x31')][_0xe42b('0x3d')]){_0x203d9c['where']=_[_0xe42b('0x3e')](_0x203d9c[_0xe42b('0x3a')],{'$or':_[_0xe42b('0x30')](_0x203d9c[_0xe42b('0x34')],function(_0x59a845){var _0x5d3eb7={};_0x5d3eb7[_0x59a845]={'$like':'%'+_0x1b7734['query'][_0xe42b('0x3d')]+'%'};return _0x5d3eb7;})});}_0x203d9c=_[_0xe42b('0x3e')]({},_0x203d9c,_0x1b7734[_0xe42b('0x41')]);return _0x419734[_0xe42b('0x4d')](_0x203d9c);}})['then'](function(_0x1ece7f){if(_0x1ece7f){_0x392a3b=_0x1ece7f[_0xe42b('0x35')];if(!_0x1b7734['query']['hasOwnProperty']('nolimit')){_0x203d9c[_0xe42b('0x1e')]=qs[_0xe42b('0x1e')](_0x1b7734['query'][_0xe42b('0x1e')]);_0x203d9c[_0xe42b('0x1c')]=qs[_0xe42b('0x1c')](_0x1b7734[_0xe42b('0x31')]['offset']);}return _0x419734[_0xe42b('0x4d')](_0x203d9c);}})[_0xe42b('0x25')](function(_0x3f3cca){if(_0x3f3cca){return _0x3f3cca?{'count':_0x392a3b,'rows':_0x3f3cca}:null;}})[_0xe42b('0x25')](respondWithResult(_0xf8bb97,null))[_0xe42b('0x4c')](handleError(_0xf8bb97,null));};exports['getSubjects']=function(_0x3ad922,_0x17fd41,_0xccd029){var _0x2c5eee={};var _0x22ab84={};var _0x1af563;var _0x4894a3;return db[_0xe42b('0x2c')][_0xe42b('0x4e')]({'where':{'id':_0x3ad922[_0xe42b('0x46')]['id']}})[_0xe42b('0x25')](handleEntityNotFound(_0x17fd41,null))[_0xe42b('0x25')](function(_0x321897){if(_0x321897){_0x1af563=_0x321897;_0x22ab84[_0xe42b('0x33')]=_[_0xe42b('0x47')](db[_0xe42b('0x4f')]['rawAttributes']);_0x22ab84['query']=_[_0xe42b('0x47')](_0x3ad922[_0xe42b('0x31')]);_0x22ab84[_0xe42b('0x3b')]=_[_0xe42b('0x32')](_0x22ab84[_0xe42b('0x33')],_0x22ab84['query']);_0x2c5eee[_0xe42b('0x34')]=_[_0xe42b('0x32')](_0x22ab84[_0xe42b('0x33')],qs[_0xe42b('0x48')](_0x3ad922[_0xe42b('0x31')][_0xe42b('0x48')]));_0x2c5eee[_0xe42b('0x34')]=_0x2c5eee[_0xe42b('0x34')]['length']?_0x2c5eee['attributes']:_0x22ab84['model'];_0x2c5eee['order']=qs['sort'](_0x3ad922['query'][_0xe42b('0x39')]);_0x2c5eee['where']=qs[_0xe42b('0x3b')](_[_0xe42b('0x3c')](_0x3ad922[_0xe42b('0x31')],_0x22ab84['filters']));if(_0x3ad922[_0xe42b('0x31')][_0xe42b('0x3d')]){_0x2c5eee['where']=_['merge'](_0x2c5eee[_0xe42b('0x3a')],{'$or':_['map'](_0x2c5eee[_0xe42b('0x34')],function(_0x3ed7f6){var _0x312fcb={};_0x312fcb[_0x3ed7f6]={'$like':'%'+_0x3ad922[_0xe42b('0x31')][_0xe42b('0x3d')]+'%'};return _0x312fcb;})});}_0x2c5eee=_[_0xe42b('0x3e')]({},_0x2c5eee,_0x3ad922[_0xe42b('0x41')]);return _0x1af563[_0xe42b('0x50')](_0x2c5eee);}})['then'](function(_0x3b0537){if(_0x3b0537){_0x4894a3=_0x3b0537['length'];if(!_0x3ad922['query'][_0xe42b('0x36')](_0xe42b('0x37'))){_0x2c5eee[_0xe42b('0x1e')]=qs[_0xe42b('0x1e')](_0x3ad922[_0xe42b('0x31')]['limit']);_0x2c5eee[_0xe42b('0x1c')]=qs[_0xe42b('0x1c')](_0x3ad922['query'][_0xe42b('0x1c')]);}return _0x1af563['getSubjects'](_0x2c5eee);}})[_0xe42b('0x25')](function(_0x21473b){if(_0x21473b){return _0x21473b?{'count':_0x4894a3,'rows':_0x21473b}:null;}})[_0xe42b('0x25')](respondWithResult(_0x17fd41,null))[_0xe42b('0x4c')](handleError(_0x17fd41,null));};exports[_0xe42b('0x51')]=function(_0x5668c2,_0x3a192b,_0x4c7297){var _0x1bb9a3={};var _0x3ad34={};var _0x1c7468;var _0x2ae725;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x5668c2['params']['id']}})[_0xe42b('0x25')](handleEntityNotFound(_0x3a192b,null))[_0xe42b('0x25')](function(_0x423c36){if(_0x423c36){_0x1c7468=_0x423c36;_0x3ad34[_0xe42b('0x33')]=_[_0xe42b('0x47')](db[_0xe42b('0x4f')]['rawAttributes']);_0x3ad34[_0xe42b('0x31')]=_[_0xe42b('0x47')](_0x5668c2[_0xe42b('0x31')]);_0x3ad34[_0xe42b('0x3b')]=_[_0xe42b('0x32')](_0x3ad34[_0xe42b('0x33')],_0x3ad34[_0xe42b('0x31')]);_0x1bb9a3[_0xe42b('0x34')]=_[_0xe42b('0x32')](_0x3ad34[_0xe42b('0x33')],qs[_0xe42b('0x48')](_0x5668c2[_0xe42b('0x31')]['fields']));_0x1bb9a3[_0xe42b('0x34')]=_0x1bb9a3[_0xe42b('0x34')][_0xe42b('0x35')]?_0x1bb9a3[_0xe42b('0x34')]:_0x3ad34['model'];_0x1bb9a3[_0xe42b('0x38')]=qs[_0xe42b('0x39')](_0x5668c2[_0xe42b('0x31')]['sort']);_0x1bb9a3[_0xe42b('0x3a')]=qs[_0xe42b('0x3b')](_['pick'](_0x5668c2[_0xe42b('0x31')],_0x3ad34[_0xe42b('0x3b')]));if(_0x5668c2[_0xe42b('0x31')][_0xe42b('0x3d')]){_0x1bb9a3[_0xe42b('0x3a')]=_[_0xe42b('0x3e')](_0x1bb9a3[_0xe42b('0x3a')],{'$or':_[_0xe42b('0x30')](_0x1bb9a3['attributes'],function(_0x450979){var _0x2dd0a7={};_0x2dd0a7[_0x450979]={'$like':'%'+_0x5668c2['query'][_0xe42b('0x3d')]+'%'};return _0x2dd0a7;})});}_0x1bb9a3=_['merge']({},_0x1bb9a3,_0x5668c2[_0xe42b('0x41')]);return _0x1c7468[_0xe42b('0x51')](_0x1bb9a3);}})[_0xe42b('0x25')](function(_0x14bcb8){if(_0x14bcb8){_0x2ae725=_0x14bcb8[_0xe42b('0x35')];if(!_0x5668c2[_0xe42b('0x31')][_0xe42b('0x36')](_0xe42b('0x37'))){_0x1bb9a3['limit']=qs[_0xe42b('0x1e')](_0x5668c2[_0xe42b('0x31')]['limit']);_0x1bb9a3[_0xe42b('0x1c')]=qs['offset'](_0x5668c2['query'][_0xe42b('0x1c')]);}return _0x1c7468[_0xe42b('0x51')](_0x1bb9a3);}})[_0xe42b('0x25')](function(_0x4e265d){if(_0x4e265d){return _0x4e265d?{'count':_0x2ae725,'rows':_0x4e265d}:null;}})['then'](respondWithResult(_0x3a192b,null))['catch'](handleError(_0x3a192b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f7cf305..6cac422 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 _0x7c54=['lodash','util','../../config/logger','api','moment','request-promise','path','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x15991c,_0x4aa1df){var _0x5f4184=function(_0xe31e2f){while(--_0xe31e2f){_0x15991c['push'](_0x15991c['shift']());}};_0x5f4184(++_0x4aa1df);}(_0x7c54,0x186));var _0x47c5=function(_0xfad1a7,_0x2e3b8d){_0xfad1a7=_0xfad1a7-0x0;var _0x571012=_0x7c54[_0xfad1a7];return _0x571012;};'use strict';var _=require(_0x47c5('0x0'));var util=require(_0x47c5('0x1'));var logger=require(_0x47c5('0x2'))(_0x47c5('0x3'));var moment=require(_0x47c5('0x4'));var BPromise=require('bluebird');var rp=require(_0x47c5('0x5'));var fs=require('fs');var path=require(_0x47c5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x47c5('0x7'));module[_0x47c5('0x8')]=function(_0xd4593,_0x45c57c){return _0xd4593[_0x47c5('0x9')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16dc=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x505655,_0x2b888f){var _0x46d890=function(_0x3a3b0d){while(--_0x3a3b0d){_0x505655['push'](_0x505655['shift']());}};_0x46d890(++_0x2b888f);}(_0x16dc,0x178));var _0xc16d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16dc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc16d('0x0'));var util=require('util');var logger=require(_0xc16d('0x1'))(_0xc16d('0x2'));var moment=require(_0xc16d('0x3'));var BPromise=require(_0xc16d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc16d('0x5'));var rimraf=require(_0xc16d('0x6'));var config=require(_0xc16d('0x7'));var attributes=require(_0xc16d('0x8'));module[_0xc16d('0x9')]=function(_0x528e4f,_0x1e99bd){return _0x528e4f[_0xc16d('0xa')](_0xc16d('0xb'),attributes,{'tableName':_0xc16d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index f6c7e35..d37b17e 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 _0xad3d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xad3d,0x133));var _0xdad3=function(_0x3dd6c9,_0xd7e5bb){_0x3dd6c9=_0x3dd6c9-0x0;var _0x369ebc=_0xad3d[_0x3dd6c9];return _0x369ebc;};'use strict';var _=require('lodash');var util=require(_0xdad3('0x0'));var moment=require('moment');var BPromise=require(_0xdad3('0x1'));var rs=require(_0xdad3('0x2'));var fs=require('fs');var Redis=require(_0xdad3('0x3'));var db=require(_0xdad3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdad3('0x5'))(_0xdad3('0x6'));var config=require(_0xdad3('0x7'));var jayson=require(_0xdad3('0x8'));var client=jayson[_0xdad3('0x9')][_0xdad3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47756d,_0x274077,_0x45bddd){return new BPromise(function(_0x2a8c92,_0x3290b6){return client[_0xdad3('0xb')](_0x47756d,_0x45bddd)['then'](function(_0x4c6703){logger[_0xdad3('0xc')](_0xdad3('0xd'),_0x274077,'request\x20sent');logger[_0xdad3('0xe')](_0xdad3('0xf'),_0x274077,_0xdad3('0x10'),JSON[_0xdad3('0x11')](_0x4c6703));if(_0x4c6703[_0xdad3('0x12')]){if(_0x4c6703['error']['code']===0x1f4){logger[_0xdad3('0x12')](_0xdad3('0xd'),_0x274077,_0x4c6703[_0xdad3('0x12')][_0xdad3('0x13')]);return _0x3290b6(_0x4c6703[_0xdad3('0x12')][_0xdad3('0x13')]);}logger[_0xdad3('0x12')](_0xdad3('0xd'),_0x274077,_0x4c6703[_0xdad3('0x12')][_0xdad3('0x13')]);return _0x2a8c92(_0x4c6703[_0xdad3('0x12')]['message']);}else{logger[_0xdad3('0xc')](_0xdad3('0xd'),_0x274077,_0xdad3('0x10'));_0x2a8c92(_0x4c6703[_0xdad3('0x14')]['message']);}})[_0xdad3('0x15')](function(_0x10e99e){logger['error'](_0xdad3('0xd'),_0x274077,_0x10e99e);_0x3290b6(_0x10e99e);});});} \ No newline at end of file +var _0x6a19=['request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xf32cec,_0x20bfb0){var _0x5904b8=function(_0x453954){while(--_0x453954){_0xf32cec['push'](_0xf32cec['shift']());}};_0x5904b8(++_0x20bfb0);}(_0x6a19,0xe2));var _0x96a1=function(_0x14f8f0,_0x5e2d51){_0x14f8f0=_0x14f8f0-0x0;var _0x5a1286=_0x6a19[_0x14f8f0];return _0x5a1286;};'use strict';var _=require(_0x96a1('0x0'));var util=require('util');var moment=require(_0x96a1('0x1'));var BPromise=require(_0x96a1('0x2'));var rs=require(_0x96a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96a1('0x4'))['db'];var utils=require(_0x96a1('0x5'));var logger=require(_0x96a1('0x6'))('rpc');var config=require(_0x96a1('0x7'));var jayson=require(_0x96a1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282724,_0x48c500,_0x326fa2){return new BPromise(function(_0x3677af,_0x486ffa){return client[_0x96a1('0x9')](_0x282724,_0x326fa2)['then'](function(_0x5e2cbc){logger[_0x96a1('0xa')](_0x96a1('0xb'),_0x48c500,'request\x20sent');logger[_0x96a1('0xc')](_0x96a1('0xd'),_0x48c500,_0x96a1('0xe'),JSON[_0x96a1('0xf')](_0x5e2cbc));if(_0x5e2cbc[_0x96a1('0x10')]){if(_0x5e2cbc[_0x96a1('0x10')][_0x96a1('0x11')]===0x1f4){logger['error'](_0x96a1('0xb'),_0x48c500,_0x5e2cbc[_0x96a1('0x10')][_0x96a1('0x12')]);return _0x486ffa(_0x5e2cbc[_0x96a1('0x10')]['message']);}logger[_0x96a1('0x10')](_0x96a1('0xb'),_0x48c500,_0x5e2cbc['error']['message']);return _0x3677af(_0x5e2cbc[_0x96a1('0x10')]['message']);}else{logger['info'](_0x96a1('0xb'),_0x48c500,'request\x20sent');_0x3677af(_0x5e2cbc[_0x96a1('0x13')][_0x96a1('0x12')]);}})['catch'](function(_0x16480e){logger[_0x96a1('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x48c500,_0x16480e);_0x486ffa(_0x16480e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 904c54a..90642e2 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 _0x1f70=['get','index','/:id','isAuthenticated','post','create','update','delete','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x2bcda0,_0x2e4ead){var _0x44a707=function(_0x2d1e4e){while(--_0x2d1e4e){_0x2bcda0['push'](_0x2bcda0['shift']());}};_0x44a707(++_0x2e4ead);}(_0x1f70,0x68));var _0x01f7=function(_0x5ab2f9,_0x21568b){_0x5ab2f9=_0x5ab2f9-0x0;var _0x9f7eb6=_0x1f70[_0x5ab2f9];return _0x9f7eb6;};'use strict';var multer=require('multer');var util=require(_0x01f7('0x0'));var path=require(_0x01f7('0x1'));var timeout=require(_0x01f7('0x2'));var express=require('express');var router=express[_0x01f7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x01f7('0x4'));var interaction=require(_0x01f7('0x5'));var config=require(_0x01f7('0x6'));var controller=require(_0x01f7('0x7'));router[_0x01f7('0x8')]('/',auth['isAuthenticated'](),controller[_0x01f7('0x9')]);router['get'](_0x01f7('0xa'),auth[_0x01f7('0xb')](),controller['show']);router[_0x01f7('0xc')]('/',auth[_0x01f7('0xb')](),controller[_0x01f7('0xd')]);router['put'](_0x01f7('0xa'),auth[_0x01f7('0xb')](),controller[_0x01f7('0xe')]);router[_0x01f7('0xf')](_0x01f7('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa0c0=['put','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','/:id','show','post'];(function(_0x81ab09,_0x385732){var _0x1400fa=function(_0x13c2ac){while(--_0x13c2ac){_0x81ab09['push'](_0x81ab09['shift']());}};_0x1400fa(++_0x385732);}(_0xa0c0,0x144));var _0x0a0c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa0c0[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x0a0c('0x0'));var util=require('util');var path=require(_0x0a0c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a0c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0a0c('0x3'));var interaction=require(_0x0a0c('0x4'));var config=require(_0x0a0c('0x5'));var controller=require(_0x0a0c('0x6'));router['get']('/',auth[_0x0a0c('0x7')](),controller['index']);router[_0x0a0c('0x8')](_0x0a0c('0x9'),auth[_0x0a0c('0x7')](),controller[_0x0a0c('0xa')]);router[_0x0a0c('0xb')]('/',auth[_0x0a0c('0x7')](),controller['create']);router[_0x0a0c('0xc')](_0x0a0c('0x9'),auth[_0x0a0c('0x7')](),controller['update']);router['delete'](_0x0a0c('0x9'),auth[_0x0a0c('0x7')](),controller['destroy']);module[_0x0a0c('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 679b07e..49c7868 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 _0x80d9=['exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x1c5722,_0x23303d){var _0x1fdbdc=function(_0x193df3){while(--_0x193df3){_0x1c5722['push'](_0x1c5722['shift']());}};_0x1fdbdc(++_0x23303d);}(_0x80d9,0x181));var _0x980d=function(_0x42bb91,_0x41c7f2){_0x42bb91=_0x42bb91-0x0;var _0x5d02f4=_0x80d9[_0x42bb91];return _0x5d02f4;};'use strict';var Sequelize=require('sequelize');module[_0x980d('0x0')]={'type':{'type':Sequelize[_0x980d('0x1')](_0x980d('0x2'),_0x980d('0x3'),_0x980d('0x4'),'keyValue',_0x980d('0x5')),'defaultValue':_0x980d('0x2')},'content':{'type':Sequelize[_0x980d('0x6')]},'key':{'type':Sequelize[_0x980d('0x6')]},'keyType':{'type':Sequelize[_0x980d('0x1')](_0x980d('0x2'),_0x980d('0x3'),_0x980d('0x4'))},'keyContent':{'type':Sequelize[_0x980d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x980d('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x980d('0x6')]}}; \ No newline at end of file +var _0xea2f=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x183150,_0x5b5e51){var _0x203c5e=function(_0x17415d){while(--_0x17415d){_0x183150['push'](_0x183150['shift']());}};_0x203c5e(++_0x5b5e51);}(_0xea2f,0x1dc));var _0xfea2=function(_0x48b242,_0x75b6d6){_0x48b242=_0x48b242-0x0;var _0x4b1bac=_0xea2f[_0x48b242];return _0x4b1bac;};'use strict';var Sequelize=require(_0xfea2('0x0'));module[_0xfea2('0x1')]={'type':{'type':Sequelize[_0xfea2('0x2')](_0xfea2('0x3'),_0xfea2('0x4'),'customVariable',_0xfea2('0x5'),_0xfea2('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfea2('0x7')]},'keyType':{'type':Sequelize[_0xfea2('0x2')](_0xfea2('0x3'),_0xfea2('0x4'),_0xfea2('0x8'))},'keyContent':{'type':Sequelize[_0xfea2('0x7')]},'idField':{'type':Sequelize[_0xfea2('0x7')]},'nameField':{'type':Sequelize[_0xfea2('0x7')]},'customField':{'type':Sequelize[_0xfea2('0x9')],'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 d730753..cd584f2 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 _0xb77a=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','SugarcrmField','rawAttributes','fieldName','model','map','filters','intersection','query','attributes','hasOwnProperty','order','sort','where','pick','merge','type','filter','include','findAll','show','params','keys','fields','length','includeAll','options','find','catch','create','body','eml-format','rimraf','zip-dir','bluebird','util'];(function(_0x49c2e3,_0x1655b8){var _0x3dad00=function(_0x377dcf){while(--_0x377dcf){_0x49c2e3['push'](_0x49c2e3['shift']());}};_0x3dad00(++_0x1655b8);}(_0xb77a,0x8b));var _0xab77=function(_0x480463,_0x816078){_0x480463=_0x480463-0x0;var _0x3d6934=_0xb77a[_0x480463];return _0x3d6934;};'use strict';var emlformat=require(_0xab77('0x0'));var rimraf=require(_0xab77('0x1'));var zipdir=require(_0xab77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab77('0x3'));var Mustache=require('mustache');var util=require(_0xab77('0x4'));var path=require(_0xab77('0x5'));var sox=require(_0xab77('0x6'));var csv=require(_0xab77('0x7'));var ejs=require(_0xab77('0x8'));var fs=require('fs');var fs_extra=require(_0xab77('0x9'));var _=require(_0xab77('0xa'));var squel=require('squel');var crypto=require(_0xab77('0xb'));var jsforce=require(_0xab77('0xc'));var deskjs=require(_0xab77('0xd'));var toCsv=require(_0xab77('0x7'));var querystring=require('querystring');var Papa=require(_0xab77('0xe'));var Redis=require(_0xab77('0xf'));var authService=require(_0xab77('0x10'));var qs=require(_0xab77('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab77('0x12'));var logger=require(_0xab77('0x13'))(_0xab77('0x14'));var utils=require(_0xab77('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xab77('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fa1a6,_0x20e993){_0x20e993=_0x20e993||0xcc;return function(_0x394330){if(_0x394330){return _0x3fa1a6[_0xab77('0x17')](_0x20e993);}return _0x3fa1a6[_0xab77('0x18')](_0x20e993)[_0xab77('0x19')]();};}function respondWithResult(_0x1350b2,_0xf5f6b1){_0xf5f6b1=_0xf5f6b1||0xc8;return function(_0x3ac04d){if(_0x3ac04d){return _0x1350b2[_0xab77('0x18')](_0xf5f6b1)['json'](_0x3ac04d);}};}function respondWithFilteredResult(_0x1c41e2,_0x29fc40){return function(_0x396784){if(_0x396784){var _0xf10ca8=typeof _0x29fc40[_0xab77('0x1a')]===_0xab77('0x1b')&&typeof _0x29fc40['limit']===_0xab77('0x1b');var _0x190ec6=_0x396784[_0xab77('0x1c')];var _0x55dfe7=_0xf10ca8?0x0:_0x29fc40[_0xab77('0x1a')];var _0x2ba2be=_0xf10ca8?_0x396784[_0xab77('0x1c')]:_0x29fc40[_0xab77('0x1a')]+_0x29fc40[_0xab77('0x1d')];var _0x56e09e;if(_0x2ba2be>=_0x190ec6){_0x2ba2be=_0x190ec6;_0x56e09e=0xc8;}else{_0x56e09e=0xce;}_0x1c41e2[_0xab77('0x18')](_0x56e09e);return _0x1c41e2[_0xab77('0x1e')](_0xab77('0x1f'),_0x55dfe7+'-'+_0x2ba2be+'/'+_0x190ec6)[_0xab77('0x20')](_0x396784);}return null;};}function patchUpdates(_0x3ed9e8){return function(_0x3817da){try{jsonpatch['apply'](_0x3817da,_0x3ed9e8,!![]);}catch(_0xa40620){return BPromise[_0xab77('0x21')](_0xa40620);}return _0x3817da[_0xab77('0x22')]();};}function saveUpdates(_0x403bc1,_0x4b07a6){return function(_0x2c118e){if(_0x2c118e){return _0x2c118e[_0xab77('0x23')](_0x403bc1)[_0xab77('0x24')](function(_0x45757e){return _0x45757e;});}return null;};}function removeEntity(_0xf54c33,_0x565503){return function(_0x4da91c){if(_0x4da91c){return _0x4da91c[_0xab77('0x25')]()[_0xab77('0x24')](function(){_0xf54c33[_0xab77('0x18')](0xcc)[_0xab77('0x19')]();});}};}function handleEntityNotFound(_0x5f4824,_0x54adb7){return function(_0x4bbc7d){if(!_0x4bbc7d){_0x5f4824['sendStatus'](0x194);}return _0x4bbc7d;};}function handleError(_0x497e2f,_0xbc76ba){_0xbc76ba=_0xbc76ba||0x1f4;return function(_0x332735){logger[_0xab77('0x26')](_0x332735[_0xab77('0x27')]);if(_0x332735[_0xab77('0x28')]){delete _0x332735['name'];}_0x497e2f[_0xab77('0x18')](_0xbc76ba)[_0xab77('0x29')](_0x332735);};}exports['index']=function(_0x231c57,_0x178b70){var _0x1971dd={},_0x57e651={},_0xdfc1fb={'count':0x0,'rows':[]};var _0x330135=_['map'](db[_0xab77('0x2a')][_0xab77('0x2b')],function(_0x3b5624){return{'name':_0x3b5624[_0xab77('0x2c')],'type':_0x3b5624['type']['key']};});_0x57e651[_0xab77('0x2d')]=_[_0xab77('0x2e')](_0x330135,_0xab77('0x28'));_0x57e651['query']=_['keys'](_0x231c57['query']);_0x57e651[_0xab77('0x2f')]=_[_0xab77('0x30')](_0x57e651['model'],_0x57e651[_0xab77('0x31')]);_0x1971dd[_0xab77('0x32')]=_['intersection'](_0x57e651[_0xab77('0x2d')],qs['fields'](_0x231c57['query']['fields']));_0x1971dd[_0xab77('0x32')]=_0x1971dd[_0xab77('0x32')]['length']?_0x1971dd[_0xab77('0x32')]:_0x57e651[_0xab77('0x2d')];if(!_0x231c57[_0xab77('0x31')][_0xab77('0x33')]('nolimit')){_0x1971dd[_0xab77('0x1d')]=qs['limit'](_0x231c57['query'][_0xab77('0x1d')]);_0x1971dd['offset']=qs[_0xab77('0x1a')](_0x231c57[_0xab77('0x31')][_0xab77('0x1a')]);}_0x1971dd[_0xab77('0x34')]=qs['sort'](_0x231c57['query'][_0xab77('0x35')]);_0x1971dd[_0xab77('0x36')]=qs[_0xab77('0x2f')](_[_0xab77('0x37')](_0x231c57[_0xab77('0x31')],_0x57e651[_0xab77('0x2f')]),_0x330135);if(_0x231c57[_0xab77('0x31')]['filter']){_0x1971dd[_0xab77('0x36')]=_[_0xab77('0x38')](_0x1971dd['where'],{'$or':_[_0xab77('0x2e')](_0x330135,function(_0x16f097){if(_0x16f097[_0xab77('0x39')]!=='VIRTUAL'){var _0x5036b6={};_0x5036b6[_0x16f097[_0xab77('0x28')]]={'$like':'%'+_0x231c57[_0xab77('0x31')][_0xab77('0x3a')]+'%'};return _0x5036b6;}})});}_0x1971dd=_[_0xab77('0x38')]({},_0x1971dd,_0x231c57['options']);var _0x206b63={'where':_0x1971dd[_0xab77('0x36')]};return db[_0xab77('0x2a')][_0xab77('0x1c')](_0x206b63)[_0xab77('0x24')](function(_0x4a5b44){_0xdfc1fb[_0xab77('0x1c')]=_0x4a5b44;if(_0x231c57[_0xab77('0x31')]['includeAll']){_0x1971dd[_0xab77('0x3b')]=[{'all':!![]}];}return db[_0xab77('0x2a')][_0xab77('0x3c')](_0x1971dd);})[_0xab77('0x24')](function(_0x4151b8){_0xdfc1fb['rows']=_0x4151b8;return _0xdfc1fb;})['then'](respondWithFilteredResult(_0x178b70,_0x1971dd))['catch'](handleError(_0x178b70,null));};exports[_0xab77('0x3d')]=function(_0xa9728,_0x394721){var _0x33f29d={'raw':!![],'where':{'id':_0xa9728[_0xab77('0x3e')]['id']}},_0x39fef9={};_0x39fef9['model']=_[_0xab77('0x3f')](db[_0xab77('0x2a')][_0xab77('0x2b')]);_0x39fef9[_0xab77('0x31')]=_[_0xab77('0x3f')](_0xa9728[_0xab77('0x31')]);_0x39fef9[_0xab77('0x2f')]=_[_0xab77('0x30')](_0x39fef9['model'],_0x39fef9['query']);_0x33f29d[_0xab77('0x32')]=_[_0xab77('0x30')](_0x39fef9[_0xab77('0x2d')],qs[_0xab77('0x40')](_0xa9728['query']['fields']));_0x33f29d[_0xab77('0x32')]=_0x33f29d[_0xab77('0x32')][_0xab77('0x41')]?_0x33f29d['attributes']:_0x39fef9['model'];if(_0xa9728[_0xab77('0x31')][_0xab77('0x42')]){_0x33f29d[_0xab77('0x3b')]=[{'all':!![]}];}_0x33f29d=_[_0xab77('0x38')]({},_0x33f29d,_0xa9728[_0xab77('0x43')]);return db[_0xab77('0x2a')][_0xab77('0x44')](_0x33f29d)['then'](handleEntityNotFound(_0x394721,null))[_0xab77('0x24')](respondWithResult(_0x394721,null))[_0xab77('0x45')](handleError(_0x394721,null));};exports['create']=function(_0xd529f0,_0x5c6a33){return db[_0xab77('0x2a')][_0xab77('0x46')](_0xd529f0['body'],{})[_0xab77('0x24')](respondWithResult(_0x5c6a33,0xc9))[_0xab77('0x45')](handleError(_0x5c6a33,null));};exports[_0xab77('0x23')]=function(_0xf2e5b9,_0x2115ca){if(_0xf2e5b9[_0xab77('0x47')]['id']){delete _0xf2e5b9['body']['id'];}return db[_0xab77('0x2a')][_0xab77('0x44')]({'where':{'id':_0xf2e5b9['params']['id']}})[_0xab77('0x24')](handleEntityNotFound(_0x2115ca,null))[_0xab77('0x24')](saveUpdates(_0xf2e5b9[_0xab77('0x47')],null))[_0xab77('0x24')](respondWithResult(_0x2115ca,null))[_0xab77('0x45')](handleError(_0x2115ca,null));};exports[_0xab77('0x25')]=function(_0x2aac91,_0x272f2d){return db[_0xab77('0x2a')][_0xab77('0x44')]({'where':{'id':_0x2aac91[_0xab77('0x3e')]['id']}})[_0xab77('0x24')](handleEntityNotFound(_0x272f2d,null))['then'](removeEntity(_0x272f2d,null))[_0xab77('0x45')](handleError(_0x272f2d,null));}; \ No newline at end of file +var _0x13f8=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','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','../../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','limit','undefined','count','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','key','model'];(function(_0x4320a7,_0x239a92){var _0x3700bf=function(_0x2c3db0){while(--_0x2c3db0){_0x4320a7['push'](_0x4320a7['shift']());}};_0x3700bf(++_0x239a92);}(_0x13f8,0x10b));var _0x813f=function(_0x4bdfc6,_0x4c2991){_0x4bdfc6=_0x4bdfc6-0x0;var _0x5091d0=_0x13f8[_0x4bdfc6];return _0x5091d0;};'use strict';var emlformat=require(_0x813f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x813f('0x1'));var jsonpatch=require(_0x813f('0x2'));var rp=require(_0x813f('0x3'));var moment=require(_0x813f('0x4'));var BPromise=require(_0x813f('0x5'));var Mustache=require(_0x813f('0x6'));var util=require(_0x813f('0x7'));var path=require(_0x813f('0x8'));var sox=require(_0x813f('0x9'));var csv=require(_0x813f('0xa'));var ejs=require(_0x813f('0xb'));var fs=require('fs');var fs_extra=require(_0x813f('0xc'));var _=require(_0x813f('0xd'));var squel=require(_0x813f('0xe'));var crypto=require(_0x813f('0xf'));var jsforce=require(_0x813f('0x10'));var deskjs=require(_0x813f('0x11'));var toCsv=require(_0x813f('0xa'));var querystring=require(_0x813f('0x12'));var Papa=require(_0x813f('0x13'));var Redis=require('ioredis');var authService=require(_0x813f('0x14'));var qs=require(_0x813f('0x15'));var as=require(_0x813f('0x16'));var hardwareService=require(_0x813f('0x17'));var logger=require(_0x813f('0x18'))('api');var utils=require(_0x813f('0x19'));var config=require(_0x813f('0x1a'));var licenseUtil=require(_0x813f('0x1b'));var db=require(_0x813f('0x1c'))['db'];function respondWithStatusCode(_0x27120d,_0x41a934){_0x41a934=_0x41a934||0xcc;return function(_0x5335f3){if(_0x5335f3){return _0x27120d[_0x813f('0x1d')](_0x41a934);}return _0x27120d[_0x813f('0x1e')](_0x41a934)['end']();};}function respondWithResult(_0x327e6f,_0xb3eff2){_0xb3eff2=_0xb3eff2||0xc8;return function(_0x5614be){if(_0x5614be){return _0x327e6f['status'](_0xb3eff2)[_0x813f('0x1f')](_0x5614be);}};}function respondWithFilteredResult(_0x24a9dc,_0x329670){return function(_0x5294f6){if(_0x5294f6){var _0x35683b=typeof _0x329670[_0x813f('0x20')]==='undefined'&&typeof _0x329670[_0x813f('0x21')]===_0x813f('0x22');var _0x33937f=_0x5294f6[_0x813f('0x23')];var _0x57a2d5=_0x35683b?0x0:_0x329670['offset'];var _0x28294e=_0x35683b?_0x5294f6['count']:_0x329670[_0x813f('0x20')]+_0x329670[_0x813f('0x21')];var _0x17fef7;if(_0x28294e>=_0x33937f){_0x28294e=_0x33937f;_0x17fef7=0xc8;}else{_0x17fef7=0xce;}_0x24a9dc[_0x813f('0x1e')](_0x17fef7);return _0x24a9dc['set'](_0x813f('0x24'),_0x57a2d5+'-'+_0x28294e+'/'+_0x33937f)[_0x813f('0x1f')](_0x5294f6);}return null;};}function patchUpdates(_0xa55518){return function(_0x464c91){try{jsonpatch['apply'](_0x464c91,_0xa55518,!![]);}catch(_0x3ffd90){return BPromise[_0x813f('0x25')](_0x3ffd90);}return _0x464c91[_0x813f('0x26')]();};}function saveUpdates(_0xc7ea8f,_0xc1b08b){return function(_0x1f5c28){if(_0x1f5c28){return _0x1f5c28[_0x813f('0x27')](_0xc7ea8f)[_0x813f('0x28')](function(_0x2639d7){return _0x2639d7;});}return null;};}function removeEntity(_0x7a2e51,_0x495436){return function(_0x21bf46){if(_0x21bf46){return _0x21bf46[_0x813f('0x29')]()[_0x813f('0x28')](function(){_0x7a2e51['status'](0xcc)[_0x813f('0x2a')]();});}};}function handleEntityNotFound(_0x23a338,_0x4c554b){return function(_0x43315a){if(!_0x43315a){_0x23a338[_0x813f('0x1d')](0x194);}return _0x43315a;};}function handleError(_0x531463,_0x3ab314){_0x3ab314=_0x3ab314||0x1f4;return function(_0x72f011){logger[_0x813f('0x2b')](_0x72f011[_0x813f('0x2c')]);if(_0x72f011[_0x813f('0x2d')]){delete _0x72f011[_0x813f('0x2d')];}_0x531463[_0x813f('0x1e')](_0x3ab314)['send'](_0x72f011);};}exports[_0x813f('0x2e')]=function(_0xbc159b,_0xc02cc1){var _0x4e470f={},_0x5dbf33={},_0x3a1858={'count':0x0,'rows':[]};var _0x2021ea=_['map'](db[_0x813f('0x2f')][_0x813f('0x30')],function(_0x4c4e2f){return{'name':_0x4c4e2f[_0x813f('0x31')],'type':_0x4c4e2f[_0x813f('0x32')][_0x813f('0x33')]};});_0x5dbf33[_0x813f('0x34')]=_['map'](_0x2021ea,'name');_0x5dbf33[_0x813f('0x35')]=_[_0x813f('0x36')](_0xbc159b[_0x813f('0x35')]);_0x5dbf33[_0x813f('0x37')]=_[_0x813f('0x38')](_0x5dbf33[_0x813f('0x34')],_0x5dbf33['query']);_0x4e470f[_0x813f('0x39')]=_[_0x813f('0x38')](_0x5dbf33[_0x813f('0x34')],qs[_0x813f('0x3a')](_0xbc159b[_0x813f('0x35')][_0x813f('0x3a')]));_0x4e470f[_0x813f('0x39')]=_0x4e470f[_0x813f('0x39')]['length']?_0x4e470f['attributes']:_0x5dbf33['model'];if(!_0xbc159b['query'][_0x813f('0x3b')](_0x813f('0x3c'))){_0x4e470f[_0x813f('0x21')]=qs['limit'](_0xbc159b[_0x813f('0x35')][_0x813f('0x21')]);_0x4e470f[_0x813f('0x20')]=qs[_0x813f('0x20')](_0xbc159b[_0x813f('0x35')]['offset']);}_0x4e470f[_0x813f('0x3d')]=qs[_0x813f('0x3e')](_0xbc159b[_0x813f('0x35')][_0x813f('0x3e')]);_0x4e470f[_0x813f('0x3f')]=qs[_0x813f('0x37')](_[_0x813f('0x40')](_0xbc159b[_0x813f('0x35')],_0x5dbf33[_0x813f('0x37')]),_0x2021ea);if(_0xbc159b[_0x813f('0x35')][_0x813f('0x41')]){_0x4e470f[_0x813f('0x3f')]=_[_0x813f('0x42')](_0x4e470f[_0x813f('0x3f')],{'$or':_[_0x813f('0x43')](_0x2021ea,function(_0x5032f4){if(_0x5032f4['type']!==_0x813f('0x44')){var _0x1a922d={};_0x1a922d[_0x5032f4[_0x813f('0x2d')]]={'$like':'%'+_0xbc159b[_0x813f('0x35')]['filter']+'%'};return _0x1a922d;}})});}_0x4e470f=_[_0x813f('0x42')]({},_0x4e470f,_0xbc159b['options']);var _0x3d5e9c={'where':_0x4e470f[_0x813f('0x3f')]};return db[_0x813f('0x2f')][_0x813f('0x23')](_0x3d5e9c)[_0x813f('0x28')](function(_0x3e3a0a){_0x3a1858['count']=_0x3e3a0a;if(_0xbc159b['query'][_0x813f('0x45')]){_0x4e470f[_0x813f('0x46')]=[{'all':!![]}];}return db[_0x813f('0x2f')][_0x813f('0x47')](_0x4e470f);})[_0x813f('0x28')](function(_0x4ff876){_0x3a1858[_0x813f('0x48')]=_0x4ff876;return _0x3a1858;})[_0x813f('0x28')](respondWithFilteredResult(_0xc02cc1,_0x4e470f))['catch'](handleError(_0xc02cc1,null));};exports[_0x813f('0x49')]=function(_0x30e409,_0x387ab6){var _0x4ecc4c={'raw':!![],'where':{'id':_0x30e409[_0x813f('0x4a')]['id']}},_0x3c711d={};_0x3c711d[_0x813f('0x34')]=_[_0x813f('0x36')](db[_0x813f('0x2f')][_0x813f('0x30')]);_0x3c711d[_0x813f('0x35')]=_[_0x813f('0x36')](_0x30e409['query']);_0x3c711d[_0x813f('0x37')]=_[_0x813f('0x38')](_0x3c711d[_0x813f('0x34')],_0x3c711d[_0x813f('0x35')]);_0x4ecc4c[_0x813f('0x39')]=_[_0x813f('0x38')](_0x3c711d[_0x813f('0x34')],qs[_0x813f('0x3a')](_0x30e409['query'][_0x813f('0x3a')]));_0x4ecc4c[_0x813f('0x39')]=_0x4ecc4c[_0x813f('0x39')][_0x813f('0x4b')]?_0x4ecc4c[_0x813f('0x39')]:_0x3c711d[_0x813f('0x34')];if(_0x30e409[_0x813f('0x35')][_0x813f('0x45')]){_0x4ecc4c['include']=[{'all':!![]}];}_0x4ecc4c=_[_0x813f('0x42')]({},_0x4ecc4c,_0x30e409['options']);return db[_0x813f('0x2f')][_0x813f('0x4c')](_0x4ecc4c)['then'](handleEntityNotFound(_0x387ab6,null))['then'](respondWithResult(_0x387ab6,null))[_0x813f('0x4d')](handleError(_0x387ab6,null));};exports[_0x813f('0x4e')]=function(_0x1d5f23,_0x5cc871){return db[_0x813f('0x2f')][_0x813f('0x4e')](_0x1d5f23['body'],{})[_0x813f('0x28')](respondWithResult(_0x5cc871,0xc9))[_0x813f('0x4d')](handleError(_0x5cc871,null));};exports[_0x813f('0x27')]=function(_0x146771,_0x24db70){if(_0x146771['body']['id']){delete _0x146771[_0x813f('0x4f')]['id'];}return db[_0x813f('0x2f')][_0x813f('0x4c')]({'where':{'id':_0x146771['params']['id']}})[_0x813f('0x28')](handleEntityNotFound(_0x24db70,null))['then'](saveUpdates(_0x146771[_0x813f('0x4f')],null))['then'](respondWithResult(_0x24db70,null))[_0x813f('0x4d')](handleError(_0x24db70,null));};exports[_0x813f('0x29')]=function(_0x1a125e,_0x5e6079){return db[_0x813f('0x2f')][_0x813f('0x4c')]({'where':{'id':_0x1a125e[_0x813f('0x4a')]['id']}})[_0x813f('0x28')](handleEntityNotFound(_0x5e6079,null))[_0x813f('0x28')](removeEntity(_0x5e6079,null))[_0x813f('0x4d')](handleError(_0x5e6079,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index aa446c6..4684ae1 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 _0x494b=['SugarcrmField','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','define'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x494b,0x1a8));var _0xb494=function(_0x4a25e3,_0xffc2aa){_0x4a25e3=_0x4a25e3-0x0;var _0xc2ac02=_0x494b[_0x4a25e3];return _0xc2ac02;};'use strict';var _=require('lodash');var util=require(_0xb494('0x0'));var logger=require(_0xb494('0x1'))(_0xb494('0x2'));var moment=require(_0xb494('0x3'));var BPromise=require(_0xb494('0x4'));var rp=require(_0xb494('0x5'));var fs=require('fs');var path=require(_0xb494('0x6'));var rimraf=require(_0xb494('0x7'));var config=require('../../config/environment');var attributes=require(_0xb494('0x8'));module['exports']=function(_0x2688ac,_0x54d78a){return _0x2688ac[_0xb494('0x9')](_0xb494('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xb494('0xb'),'fields':[_0xb494('0xc'),_0xb494('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc67=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField'];(function(_0x39edf1,_0x3616a9){var _0x348891=function(_0x2fd7d9){while(--_0x2fd7d9){_0x39edf1['push'](_0x39edf1['shift']());}};_0x348891(++_0x3616a9);}(_0xcc67,0xb8));var _0x7cc6=function(_0x4269b2,_0x579a41){_0x4269b2=_0x4269b2-0x0;var _0x4ee071=_0xcc67[_0x4269b2];return _0x4ee071;};'use strict';var _=require(_0x7cc6('0x0'));var util=require(_0x7cc6('0x1'));var logger=require(_0x7cc6('0x2'))('api');var moment=require(_0x7cc6('0x3'));var BPromise=require(_0x7cc6('0x4'));var rp=require(_0x7cc6('0x5'));var fs=require('fs');var path=require(_0x7cc6('0x6'));var rimraf=require(_0x7cc6('0x7'));var config=require(_0x7cc6('0x8'));var attributes=require(_0x7cc6('0x9'));module[_0x7cc6('0xa')]=function(_0x4e4c78,_0x5cb86e){return _0x4e4c78['define'](_0x7cc6('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x7cc6('0xc'),_0x7cc6('0xd')],'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 32b5ed6..55ac444 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 _0xec35=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0xec35,0xd6));var _0x5ec3=function(_0x396352,_0x21ff37){_0x396352=_0x396352-0x0;var _0x317d07=_0xec35[_0x396352];return _0x317d07;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5ec3('0x0'));var rs=require(_0x5ec3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ec3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ec3('0x3'))('rpc');var config=require(_0x5ec3('0x4'));var jayson=require(_0x5ec3('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2376e7,_0x56658e,_0x59fe80){return new BPromise(function(_0x283b97,_0x262a2c){return client['request'](_0x2376e7,_0x59fe80)[_0x5ec3('0x6')](function(_0x2a768f){logger[_0x5ec3('0x7')](_0x5ec3('0x8'),_0x56658e,_0x5ec3('0x9'));logger[_0x5ec3('0xa')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x56658e,'request\x20sent',JSON[_0x5ec3('0xb')](_0x2a768f));if(_0x2a768f[_0x5ec3('0xc')]){if(_0x2a768f['error'][_0x5ec3('0xd')]===0x1f4){logger[_0x5ec3('0xc')](_0x5ec3('0x8'),_0x56658e,_0x2a768f[_0x5ec3('0xc')][_0x5ec3('0xe')]);return _0x262a2c(_0x2a768f[_0x5ec3('0xc')][_0x5ec3('0xe')]);}logger[_0x5ec3('0xc')](_0x5ec3('0x8'),_0x56658e,_0x2a768f[_0x5ec3('0xc')]['message']);return _0x283b97(_0x2a768f[_0x5ec3('0xc')][_0x5ec3('0xe')]);}else{logger[_0x5ec3('0x7')](_0x5ec3('0x8'),_0x56658e,_0x5ec3('0x9'));_0x283b97(_0x2a768f[_0x5ec3('0xf')][_0x5ec3('0xe')]);}})[_0x5ec3('0x10')](function(_0x183abe){logger['error'](_0x5ec3('0x8'),_0x56658e,_0x183abe);_0x262a2c(_0x183abe);});});} \ No newline at end of file +var _0x82b2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','util'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0x82b2,0x1cb));var _0x282b=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x82b2[_0x7d62cb];return _0x3a6266;};'use strict';var _=require('lodash');var util=require(_0x282b('0x0'));var moment=require(_0x282b('0x1'));var BPromise=require(_0x282b('0x2'));var rs=require(_0x282b('0x3'));var fs=require('fs');var Redis=require(_0x282b('0x4'));var db=require(_0x282b('0x5'))['db'];var utils=require(_0x282b('0x6'));var logger=require(_0x282b('0x7'))(_0x282b('0x8'));var config=require(_0x282b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x282b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7de2bc,_0x113d24,_0x1d8b4e){return new BPromise(function(_0x236f2a,_0x477eb4){return client['request'](_0x7de2bc,_0x1d8b4e)[_0x282b('0xb')](function(_0xd54323){logger[_0x282b('0xc')](_0x282b('0xd'),_0x113d24,_0x282b('0xe'));logger[_0x282b('0xf')](_0x282b('0x10'),_0x113d24,_0x282b('0xe'),JSON['stringify'](_0xd54323));if(_0xd54323[_0x282b('0x11')]){if(_0xd54323[_0x282b('0x11')]['code']===0x1f4){logger[_0x282b('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x113d24,_0xd54323[_0x282b('0x11')][_0x282b('0x12')]);return _0x477eb4(_0xd54323[_0x282b('0x11')]['message']);}logger[_0x282b('0x11')](_0x282b('0xd'),_0x113d24,_0xd54323[_0x282b('0x11')][_0x282b('0x12')]);return _0x236f2a(_0xd54323['error'][_0x282b('0x12')]);}else{logger[_0x282b('0xc')](_0x282b('0xd'),_0x113d24,_0x282b('0xe'));_0x236f2a(_0xd54323['result'][_0x282b('0x12')]);}})[_0x282b('0x13')](function(_0x3c99a0){logger[_0x282b('0x11')](_0x282b('0xd'),_0x113d24,_0x3c99a0);_0x477eb4(_0x3c99a0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6c05fc5..2f3be7b 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 _0x2a8d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','post','/:id/configurations','addConfiguration','put','update','delete','destroy'];(function(_0x3f23c0,_0x25c0b6){var _0x35b74d=function(_0x2b13fa){while(--_0x2b13fa){_0x3f23c0['push'](_0x3f23c0['shift']());}};_0x35b74d(++_0x25c0b6);}(_0x2a8d,0x11e));var _0xd2a8=function(_0x2a6d45,_0x3c9321){_0x2a6d45=_0x2a6d45-0x0;var _0x295253=_0x2a8d[_0x2a6d45];return _0x295253;};'use strict';var multer=require(_0xd2a8('0x0'));var util=require(_0xd2a8('0x1'));var path=require(_0xd2a8('0x2'));var timeout=require(_0xd2a8('0x3'));var express=require(_0xd2a8('0x4'));var router=express[_0xd2a8('0x5')]();var fs_extra=require(_0xd2a8('0x6'));var auth=require(_0xd2a8('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2a8('0x8'));router[_0xd2a8('0x9')]('/',auth[_0xd2a8('0xa')](),controller[_0xd2a8('0xb')]);router[_0xd2a8('0x9')](_0xd2a8('0xc'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0xd')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd2a8('0x9')](_0xd2a8('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xd2a8('0xf')]('/',auth[_0xd2a8('0xa')](),controller['create']);router[_0xd2a8('0xf')](_0xd2a8('0x10'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x11')]);router[_0xd2a8('0x12')](_0xd2a8('0xc'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x13')]);router[_0xd2a8('0x14')]('/:id',auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5c37=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','exports'];(function(_0x364548,_0x327659){var _0x289ef2=function(_0x47800a){while(--_0x47800a){_0x364548['push'](_0x364548['shift']());}};_0x289ef2(++_0x327659);}(_0x5c37,0x11e));var _0x75c3=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x5c37[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x75c3('0x0'));var util=require(_0x75c3('0x1'));var path=require(_0x75c3('0x2'));var timeout=require(_0x75c3('0x3'));var express=require(_0x75c3('0x4'));var router=express[_0x75c3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x75c3('0x6'));var interaction=require(_0x75c3('0x7'));var config=require(_0x75c3('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x75c3('0x9')]('/',auth[_0x75c3('0xa')](),controller[_0x75c3('0xb')]);router[_0x75c3('0x9')]('/:id',auth[_0x75c3('0xa')](),controller['show']);router['get'](_0x75c3('0xc'),auth[_0x75c3('0xa')](),controller['getConfigurations']);router[_0x75c3('0x9')](_0x75c3('0xd'),auth[_0x75c3('0xa')](),controller[_0x75c3('0xe')]);router[_0x75c3('0xf')]('/',auth[_0x75c3('0xa')](),controller['create']);router['post'](_0x75c3('0xc'),auth[_0x75c3('0xa')](),controller[_0x75c3('0x10')]);router[_0x75c3('0x11')](_0x75c3('0x12'),auth['isAuthenticated'](),controller[_0x75c3('0x13')]);router[_0x75c3('0x14')](_0x75c3('0x12'),auth[_0x75c3('0xa')](),controller['destroy']);module[_0x75c3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2ad0207..b199104 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 _0x13e4=['sequelize','exports','STRING'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x13e4,0xe1));var _0x413e=function(_0x3c328e,_0x133167){_0x3c328e=_0x3c328e-0x0;var _0x46b037=_0x13e4[_0x3c328e];return _0x46b037;};'use strict';var Sequelize=require(_0x413e('0x0'));module[_0x413e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x413e('0x2')]},'username':{'type':Sequelize[_0x413e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x413e('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x413e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x413e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x413e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6ce0=['exports','STRING'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x6ce0,0x9e));var _0x06ce=function(_0x290201,_0x279632){_0x290201=_0x290201-0x0;var _0x3d5c08=_0x6ce0[_0x290201];return _0x3d5c08;};'use strict';var Sequelize=require('sequelize');module[_0x06ce('0x0')]={'name':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x06ce('0x1')]},'username':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 4e51e7b..dfeb4df 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 _0xfb29=['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','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VtigerAccount','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','include','findAll','show','params','length','includeAll','options','catch','create','body','update','find','getConfigurations','VtigerConfiguration','rawAttributes','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','%s/webservice.php','GET','success','POST','login','token','describe','result','sessionName','reference','owner','remove','includes','editable','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x37ae76,_0x5b10ec){var _0x588821=function(_0x1a6b39){while(--_0x1a6b39){_0x37ae76['push'](_0x37ae76['shift']());}};_0x588821(++_0x5b10ec);}(_0xfb29,0x163));var _0x9fb2=function(_0x310433,_0x5b718f){_0x310433=_0x310433-0x0;var _0xf4d994=_0xfb29[_0x310433];return _0xf4d994;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9fb2('0x0'));var jsonpatch=require(_0x9fb2('0x1'));var rp=require(_0x9fb2('0x2'));var moment=require(_0x9fb2('0x3'));var BPromise=require(_0x9fb2('0x4'));var Mustache=require('mustache');var util=require(_0x9fb2('0x5'));var path=require(_0x9fb2('0x6'));var sox=require(_0x9fb2('0x7'));var csv=require(_0x9fb2('0x8'));var ejs=require(_0x9fb2('0x9'));var fs=require('fs');var fs_extra=require(_0x9fb2('0xa'));var _=require('lodash');var squel=require(_0x9fb2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9fb2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9fb2('0xd'));var Papa=require(_0x9fb2('0xe'));var Redis=require(_0x9fb2('0xf'));var authService=require(_0x9fb2('0x10'));var qs=require(_0x9fb2('0x11'));var as=require(_0x9fb2('0x12'));var hardwareService=require(_0x9fb2('0x13'));var logger=require(_0x9fb2('0x14'))('api');var utils=require(_0x9fb2('0x15'));var config=require(_0x9fb2('0x16'));var licenseUtil=require(_0x9fb2('0x17'));var db=require(_0x9fb2('0x18'))['db'];var integrations=require(_0x9fb2('0x19'));function respondWithStatusCode(_0x3de5b7,_0x2ce62c){_0x2ce62c=_0x2ce62c||0xcc;return function(_0xcdf72b){if(_0xcdf72b){return _0x3de5b7[_0x9fb2('0x1a')](_0x2ce62c);}return _0x3de5b7['status'](_0x2ce62c)['end']();};}function respondWithResult(_0x282b89,_0x534378){_0x534378=_0x534378||0xc8;return function(_0x5a41de){if(_0x5a41de){return _0x282b89['status'](_0x534378)[_0x9fb2('0x1b')](_0x5a41de);}};}function respondWithFilteredResult(_0x1a4bf6,_0x208bab){return function(_0x4ff929){if(_0x4ff929){var _0x2adb91=typeof _0x208bab[_0x9fb2('0x1c')]===_0x9fb2('0x1d')&&typeof _0x208bab[_0x9fb2('0x1e')]==='undefined';var _0x106f61=_0x4ff929[_0x9fb2('0x1f')];var _0x1fca49=_0x2adb91?0x0:_0x208bab[_0x9fb2('0x1c')];var _0x1f38b6=_0x2adb91?_0x4ff929[_0x9fb2('0x1f')]:_0x208bab[_0x9fb2('0x1c')]+_0x208bab[_0x9fb2('0x1e')];var _0x1369ad;if(_0x1f38b6>=_0x106f61){_0x1f38b6=_0x106f61;_0x1369ad=0xc8;}else{_0x1369ad=0xce;}_0x1a4bf6[_0x9fb2('0x20')](_0x1369ad);return _0x1a4bf6[_0x9fb2('0x21')](_0x9fb2('0x22'),_0x1fca49+'-'+_0x1f38b6+'/'+_0x106f61)[_0x9fb2('0x1b')](_0x4ff929);}return null;};}function patchUpdates(_0x40ed31){return function(_0x3dbc4e){try{jsonpatch[_0x9fb2('0x23')](_0x3dbc4e,_0x40ed31,!![]);}catch(_0x248869){return BPromise['reject'](_0x248869);}return _0x3dbc4e[_0x9fb2('0x24')]();};}function saveUpdates(_0x1b11ce,_0x300ef0){return function(_0x45f8b2){if(_0x45f8b2){return _0x45f8b2['update'](_0x1b11ce)[_0x9fb2('0x25')](function(_0x3073ed){return _0x3073ed;});}return null;};}function removeEntity(_0x4520dc,_0x5ac785){return function(_0x395fb0){if(_0x395fb0){return _0x395fb0[_0x9fb2('0x26')]()[_0x9fb2('0x25')](function(){_0x4520dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a72ed,_0x5440aa){return function(_0x4f1f4a){if(!_0x4f1f4a){_0x1a72ed[_0x9fb2('0x1a')](0x194);}return _0x4f1f4a;};}function handleError(_0x4b6dd5,_0x58f883){_0x58f883=_0x58f883||0x1f4;return function(_0xaaabb1){logger[_0x9fb2('0x27')](_0xaaabb1[_0x9fb2('0x28')]);if(_0xaaabb1['name']){delete _0xaaabb1[_0x9fb2('0x29')];}_0x4b6dd5['status'](_0x58f883)[_0x9fb2('0x2a')](_0xaaabb1);};}exports[_0x9fb2('0x2b')]=function(_0x283752,_0x4e4865){var _0x3e2ce0={},_0x5ea0ff={},_0x531570={'count':0x0,'rows':[]};var _0x56f5e4=_[_0x9fb2('0x2c')](db[_0x9fb2('0x2d')]['rawAttributes'],function(_0x11202f){return{'name':_0x11202f['fieldName'],'type':_0x11202f[_0x9fb2('0x2e')][_0x9fb2('0x2f')]};});_0x5ea0ff[_0x9fb2('0x30')]=_[_0x9fb2('0x2c')](_0x56f5e4,'name');_0x5ea0ff[_0x9fb2('0x31')]=_[_0x9fb2('0x32')](_0x283752['query']);_0x5ea0ff['filters']=_[_0x9fb2('0x33')](_0x5ea0ff[_0x9fb2('0x30')],_0x5ea0ff['query']);_0x3e2ce0['attributes']=_[_0x9fb2('0x33')](_0x5ea0ff['model'],qs[_0x9fb2('0x34')](_0x283752[_0x9fb2('0x31')]['fields']));_0x3e2ce0[_0x9fb2('0x35')]=_0x3e2ce0[_0x9fb2('0x35')]['length']?_0x3e2ce0['attributes']:_0x5ea0ff[_0x9fb2('0x30')];if(!_0x283752[_0x9fb2('0x31')][_0x9fb2('0x36')](_0x9fb2('0x37'))){_0x3e2ce0[_0x9fb2('0x1e')]=qs[_0x9fb2('0x1e')](_0x283752[_0x9fb2('0x31')][_0x9fb2('0x1e')]);_0x3e2ce0[_0x9fb2('0x1c')]=qs[_0x9fb2('0x1c')](_0x283752[_0x9fb2('0x31')][_0x9fb2('0x1c')]);}_0x3e2ce0[_0x9fb2('0x38')]=qs[_0x9fb2('0x39')](_0x283752[_0x9fb2('0x31')][_0x9fb2('0x39')]);_0x3e2ce0[_0x9fb2('0x3a')]=qs[_0x9fb2('0x3b')](_['pick'](_0x283752[_0x9fb2('0x31')],_0x5ea0ff['filters']),_0x56f5e4);if(_0x283752['query'][_0x9fb2('0x3c')]){_0x3e2ce0[_0x9fb2('0x3a')]=_[_0x9fb2('0x3d')](_0x3e2ce0['where'],{'$or':_[_0x9fb2('0x2c')](_0x56f5e4,function(_0x5785a9){if(_0x5785a9[_0x9fb2('0x2e')]!=='VIRTUAL'){var _0x9fb710={};_0x9fb710[_0x5785a9['name']]={'$like':'%'+_0x283752['query'][_0x9fb2('0x3c')]+'%'};return _0x9fb710;}})});}_0x3e2ce0=_[_0x9fb2('0x3d')]({},_0x3e2ce0,_0x283752['options']);var _0x2d56ca={'where':_0x3e2ce0[_0x9fb2('0x3a')]};return db[_0x9fb2('0x2d')]['count'](_0x2d56ca)[_0x9fb2('0x25')](function(_0x372c56){_0x531570[_0x9fb2('0x1f')]=_0x372c56;if(_0x283752[_0x9fb2('0x31')]['includeAll']){_0x3e2ce0[_0x9fb2('0x3e')]=[{'all':!![]}];}return db[_0x9fb2('0x2d')][_0x9fb2('0x3f')](_0x3e2ce0);})['then'](function(_0x30d02f){_0x531570['rows']=_0x30d02f;return _0x531570;})[_0x9fb2('0x25')](respondWithFilteredResult(_0x4e4865,_0x3e2ce0))['catch'](handleError(_0x4e4865,null));};exports[_0x9fb2('0x40')]=function(_0x56c146,_0x27d9e6){var _0x41a933={'raw':![],'where':{'id':_0x56c146[_0x9fb2('0x41')]['id']}},_0x28e2d4={};_0x28e2d4[_0x9fb2('0x30')]=_['keys'](db[_0x9fb2('0x2d')]['rawAttributes']);_0x28e2d4[_0x9fb2('0x31')]=_['keys'](_0x56c146['query']);_0x28e2d4[_0x9fb2('0x3b')]=_[_0x9fb2('0x33')](_0x28e2d4[_0x9fb2('0x30')],_0x28e2d4[_0x9fb2('0x31')]);_0x41a933[_0x9fb2('0x35')]=_[_0x9fb2('0x33')](_0x28e2d4[_0x9fb2('0x30')],qs[_0x9fb2('0x34')](_0x56c146[_0x9fb2('0x31')][_0x9fb2('0x34')]));_0x41a933[_0x9fb2('0x35')]=_0x41a933[_0x9fb2('0x35')][_0x9fb2('0x42')]?_0x41a933['attributes']:_0x28e2d4[_0x9fb2('0x30')];if(_0x56c146['query'][_0x9fb2('0x43')]){_0x41a933['include']=[{'all':!![]}];}_0x41a933=_['merge']({},_0x41a933,_0x56c146[_0x9fb2('0x44')]);return db[_0x9fb2('0x2d')]['find'](_0x41a933)['then'](handleEntityNotFound(_0x27d9e6,null))[_0x9fb2('0x25')](respondWithResult(_0x27d9e6,null))[_0x9fb2('0x45')](handleError(_0x27d9e6,null));};exports['create']=function(_0x168001,_0x415d22){return db['VtigerAccount'][_0x9fb2('0x46')](_0x168001[_0x9fb2('0x47')],{})['then'](respondWithResult(_0x415d22,0xc9))['catch'](handleError(_0x415d22,null));};exports[_0x9fb2('0x48')]=function(_0x5f4611,_0x5cd6d3){if(_0x5f4611[_0x9fb2('0x47')]['id']){delete _0x5f4611['body']['id'];}return db[_0x9fb2('0x2d')][_0x9fb2('0x49')]({'where':{'id':_0x5f4611[_0x9fb2('0x41')]['id']}})[_0x9fb2('0x25')](handleEntityNotFound(_0x5cd6d3,null))[_0x9fb2('0x25')](saveUpdates(_0x5f4611[_0x9fb2('0x47')],null))[_0x9fb2('0x25')](respondWithResult(_0x5cd6d3,null))['catch'](handleError(_0x5cd6d3,null));};exports[_0x9fb2('0x26')]=function(_0x1e6cb1,_0x1df449){return db[_0x9fb2('0x2d')][_0x9fb2('0x49')]({'where':{'id':_0x1e6cb1[_0x9fb2('0x41')]['id']}})[_0x9fb2('0x25')](handleEntityNotFound(_0x1df449,null))[_0x9fb2('0x25')](removeEntity(_0x1df449,null))[_0x9fb2('0x45')](handleError(_0x1df449,null));};exports[_0x9fb2('0x4a')]=function(_0x3b0634,_0x1c4d6c,_0x1dbfee){var _0x40ccef={};var _0x2487ef={};var _0x3e0b21;var _0x1a94a4;return db[_0x9fb2('0x2d')]['findOne']({'where':{'id':_0x3b0634[_0x9fb2('0x41')]['id']}})[_0x9fb2('0x25')](handleEntityNotFound(_0x1c4d6c,null))['then'](function(_0x4fd715){if(_0x4fd715){_0x3e0b21=_0x4fd715;_0x2487ef[_0x9fb2('0x30')]=_[_0x9fb2('0x32')](db[_0x9fb2('0x4b')][_0x9fb2('0x4c')]);_0x2487ef[_0x9fb2('0x31')]=_[_0x9fb2('0x32')](_0x3b0634['query']);_0x2487ef[_0x9fb2('0x3b')]=_[_0x9fb2('0x33')](_0x2487ef[_0x9fb2('0x30')],_0x2487ef['query']);_0x40ccef[_0x9fb2('0x35')]=_[_0x9fb2('0x33')](_0x2487ef[_0x9fb2('0x30')],qs[_0x9fb2('0x34')](_0x3b0634[_0x9fb2('0x31')][_0x9fb2('0x34')]));_0x40ccef[_0x9fb2('0x35')]=_0x40ccef[_0x9fb2('0x35')][_0x9fb2('0x42')]?_0x40ccef['attributes']:_0x2487ef['model'];_0x40ccef[_0x9fb2('0x38')]=qs['sort'](_0x3b0634[_0x9fb2('0x31')][_0x9fb2('0x39')]);_0x40ccef['where']=qs[_0x9fb2('0x3b')](_['pick'](_0x3b0634[_0x9fb2('0x31')],_0x2487ef[_0x9fb2('0x3b')]));if(_0x3b0634[_0x9fb2('0x31')][_0x9fb2('0x3c')]){_0x40ccef[_0x9fb2('0x3a')]=_[_0x9fb2('0x3d')](_0x40ccef[_0x9fb2('0x3a')],{'$or':_[_0x9fb2('0x2c')](_0x40ccef[_0x9fb2('0x35')],function(_0x40916e){var _0x137617={};_0x137617[_0x40916e]={'$like':'%'+_0x3b0634[_0x9fb2('0x31')]['filter']+'%'};return _0x137617;})});}_0x40ccef=_[_0x9fb2('0x3d')]({},_0x40ccef,_0x3b0634[_0x9fb2('0x44')]);return _0x3e0b21[_0x9fb2('0x4a')](_0x40ccef);}})['then'](function(_0x9016c9){if(_0x9016c9){_0x1a94a4=_0x9016c9[_0x9fb2('0x42')];if(!_0x3b0634[_0x9fb2('0x31')][_0x9fb2('0x36')](_0x9fb2('0x37'))){_0x40ccef['limit']=qs['limit'](_0x3b0634[_0x9fb2('0x31')][_0x9fb2('0x1e')]);_0x40ccef[_0x9fb2('0x1c')]=qs[_0x9fb2('0x1c')](_0x3b0634[_0x9fb2('0x31')]['offset']);}return _0x3e0b21[_0x9fb2('0x4a')](_0x40ccef);}})[_0x9fb2('0x25')](function(_0x74664a){if(_0x74664a){return _0x74664a?{'count':_0x1a94a4,'rows':_0x74664a}:null;}})[_0x9fb2('0x25')](respondWithResult(_0x1c4d6c,null))[_0x9fb2('0x45')](handleError(_0x1c4d6c,null));};exports[_0x9fb2('0x4d')]=function(_0x23622a,_0x5a47cc,_0x44d084){if(_0x23622a[_0x9fb2('0x47')]['id']){delete _0x23622a[_0x9fb2('0x47')]['id'];}return db[_0x9fb2('0x2d')][_0x9fb2('0x4e')]({'where':{'id':_0x23622a['params']['id']}})[_0x9fb2('0x25')](handleEntityNotFound(_0x5a47cc,null))[_0x9fb2('0x25')](function(_0x5d5fb8){if(_0x5d5fb8){_0x23622a['body'][_0x9fb2('0x4f')]=_0x5d5fb8['id'];_0x23622a[_0x9fb2('0x47')][_0x9fb2('0x50')]=integrations[_0x9fb2('0x51')](_0x23622a[_0x9fb2('0x47')]['channel'],_0x23622a[_0x9fb2('0x47')][_0x9fb2('0x2e')]);_0x23622a[_0x9fb2('0x47')][_0x9fb2('0x52')]=integrations[_0x9fb2('0x53')](_0x23622a[_0x9fb2('0x47')][_0x9fb2('0x54')],_0x23622a[_0x9fb2('0x47')][_0x9fb2('0x2e')]);return db[_0x9fb2('0x4b')][_0x9fb2('0x46')](_0x23622a['body'],{'include':[{'model':db[_0x9fb2('0x55')],'as':_0x9fb2('0x50')},{'model':db['VtigerField'],'as':_0x9fb2('0x52')}]});}return null;})['then'](respondWithResult(_0x5a47cc,null))[_0x9fb2('0x45')](handleError(_0x5a47cc,null));};var md5=require(_0x9fb2('0x56'));exports[_0x9fb2('0x57')]=function(_0x17a2a9,_0x5218e4,_0x46a18c){var _0x45a93b=null;var _0x4c6806=null;var _0x52cad3=null;var _0x1829a2=null;var _0x13fa69='';return db[_0x9fb2('0x2d')][_0x9fb2('0x4e')]({'where':{'id':_0x17a2a9[_0x9fb2('0x41')]['id']},'attributes':['id','name',_0x9fb2('0x58'),_0x9fb2('0x59'),'moduleName',_0x9fb2('0x5a'),_0x9fb2('0x5b'),'accessKey']})[_0x9fb2('0x25')](handleEntityNotFound(_0x5218e4,null))[_0x9fb2('0x25')](function(_0x155fc1){if(_0x155fc1){_0x45a93b=_0x155fc1['username'];_0x4c6806=_0x155fc1[_0x9fb2('0x5c')];_0x52cad3=_0x155fc1[_0x9fb2('0x5d')];_0x13fa69=_0x155fc1['remoteUri'];var _0x36b181=_0x13fa69[_0x9fb2('0x5e')](-0x1);if(_0x36b181==='/'){_0x13fa69=_0x13fa69[_0x9fb2('0x5f')](0x0,_0x13fa69[_0x9fb2('0x60')](_0x36b181));}_0x1829a2=util['format'](_0x9fb2('0x61'),_0x13fa69);var _0x1aced6={'method':_0x9fb2('0x62'),'uri':_0x1829a2,'qs':{'operation':'getchallenge','username':_0x155fc1[_0x9fb2('0x58')]},'json':!![]};return rp(_0x1aced6);}})['then'](function(_0x3e9e83){if(_0x3e9e83[_0x9fb2('0x63')]){var _0x4025b1={'method':_0x9fb2('0x64'),'uri':_0x1829a2,'form':{'operation':_0x9fb2('0x65'),'username':_0x45a93b,'accessKey':md5(_0x3e9e83['result'][_0x9fb2('0x66')]+_0x4c6806)},'json':!![]};return rp(_0x4025b1);}})['then'](function(_0x2fbbd8){if(_0x2fbbd8['success']){var _0x3f9083={'method':'GET','uri':_0x1829a2,'qs':{'operation':_0x9fb2('0x67'),'username':_0x45a93b,'sessionName':_0x2fbbd8[_0x9fb2('0x68')][_0x9fb2('0x69')],'elementType':_0x52cad3},'json':!![]};return rp(_0x3f9083);}})[_0x9fb2('0x25')](function(_0x3769d0){if(_0x3769d0['success']){var _0xd7ec5a=['autogenerated',_0x9fb2('0x6a'),_0x9fb2('0x6b')];_[_0x9fb2('0x6c')](_0x3769d0[_0x9fb2('0x68')][_0x9fb2('0x34')],function(_0x17d639){return _0xd7ec5a[_0x9fb2('0x6d')](_0x17d639[_0x9fb2('0x2e')][_0x9fb2('0x29')]);});_['remove'](_0x3769d0[_0x9fb2('0x68')]['fields'],function(_0x36e5df){return _0x36e5df[_0x9fb2('0x6e')]===_0x9fb2('0x6f');});return{'count':_0x3769d0[_0x9fb2('0x68')][_0x9fb2('0x34')][_0x9fb2('0x42')],'rows':_[_0x9fb2('0x2c')](_0x3769d0['result'][_0x9fb2('0x34')],function(_0x1d7733){return{'id':_0x1d7733[_0x9fb2('0x29')],'name':_0x1d7733[_0x9fb2('0x70')],'custom':_['startsWith'](_0x1d7733['name'],_0x9fb2('0x71'))?!![]:![],'options':_0x1d7733[_0x9fb2('0x2e')][_0x9fb2('0x29')]==='picklist'&&_0x1d7733[_0x9fb2('0x2e')][_0x9fb2('0x72')][_0x9fb2('0x42')]>0x0?_[_0x9fb2('0x2c')](_0x1d7733[_0x9fb2('0x2e')][_0x9fb2('0x72')],function(_0x16c460){return{'name':_0x16c460[_0x9fb2('0x70')],'value':_0x16c460[_0x9fb2('0x73')]};}):[]};})};}})[_0x9fb2('0x25')](respondWithResult(_0x5218e4,null))[_0x9fb2('0x45')](function(_0x5d4f13){console[_0x9fb2('0x74')](_0x9fb2('0x75')+_0x5d4f13);var _0x25e5ec=_0x17a2a9['query'][_0x9fb2('0x76')]?0x1f4:_0x5d4f13[_0x9fb2('0x77')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x9fb2('0x57'),_0x25e5ec,JSON[_0x9fb2('0x78')](_0x5d4f13));delete _0x5d4f13[_0x9fb2('0x29')];if(_0x25e5ec===0x191){_0x25e5ec=0x190;}_0x5218e4[_0x9fb2('0x20')](_0x25e5ec)['send'](_0x17a2a9['query']['test']?{'message':_0x9fb2('0x79'),'statusCode':_0x5d4f13[_0x9fb2('0x77')]}:_0x5d4f13);});}; \ No newline at end of file +var _0x27be=['squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','end','error','name','index','VtigerAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','find','create','body','update','findOne','VtigerConfiguration','options','getConfigurations','addConfiguration','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','login','result','token','success','GET','describe','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x495962,_0x1f2ba0){var _0x46d881=function(_0x6e7377){while(--_0x6e7377){_0x495962['push'](_0x495962['shift']());}};_0x46d881(++_0x1f2ba0);}(_0x27be,0x161));var _0xe27b=function(_0x122415,_0xb08425){_0x122415=_0x122415-0x0;var _0x3ac79d=_0x27be[_0x122415];return _0x3ac79d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe27b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe27b('0x1'));var rp=require(_0xe27b('0x2'));var moment=require(_0xe27b('0x3'));var BPromise=require(_0xe27b('0x4'));var Mustache=require(_0xe27b('0x5'));var util=require(_0xe27b('0x6'));var path=require(_0xe27b('0x7'));var sox=require(_0xe27b('0x8'));var csv=require('to-csv');var ejs=require(_0xe27b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe27b('0xa'));var crypto=require(_0xe27b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe27b('0xc'));var toCsv=require(_0xe27b('0xd'));var querystring=require(_0xe27b('0xe'));var Papa=require('papaparse');var Redis=require(_0xe27b('0xf'));var authService=require(_0xe27b('0x10'));var qs=require(_0xe27b('0x11'));var as=require(_0xe27b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe27b('0x13'))(_0xe27b('0x14'));var utils=require(_0xe27b('0x15'));var config=require(_0xe27b('0x16'));var licenseUtil=require(_0xe27b('0x17'));var db=require(_0xe27b('0x18'))['db'];var integrations=require(_0xe27b('0x19'));function respondWithStatusCode(_0x3d7ade,_0x40b45c){_0x40b45c=_0x40b45c||0xcc;return function(_0x2fe05c){if(_0x2fe05c){return _0x3d7ade[_0xe27b('0x1a')](_0x40b45c);}return _0x3d7ade[_0xe27b('0x1b')](_0x40b45c)['end']();};}function respondWithResult(_0x202543,_0x2a31eb){_0x2a31eb=_0x2a31eb||0xc8;return function(_0x42eb9e){if(_0x42eb9e){return _0x202543[_0xe27b('0x1b')](_0x2a31eb)[_0xe27b('0x1c')](_0x42eb9e);}};}function respondWithFilteredResult(_0x419f87,_0xf56542){return function(_0x583d89){if(_0x583d89){var _0x437409=typeof _0xf56542[_0xe27b('0x1d')]===_0xe27b('0x1e')&&typeof _0xf56542['limit']===_0xe27b('0x1e');var _0x4627d2=_0x583d89[_0xe27b('0x1f')];var _0x192419=_0x437409?0x0:_0xf56542[_0xe27b('0x1d')];var _0xdc9257=_0x437409?_0x583d89[_0xe27b('0x1f')]:_0xf56542[_0xe27b('0x1d')]+_0xf56542[_0xe27b('0x20')];var _0x39b2a9;if(_0xdc9257>=_0x4627d2){_0xdc9257=_0x4627d2;_0x39b2a9=0xc8;}else{_0x39b2a9=0xce;}_0x419f87['status'](_0x39b2a9);return _0x419f87[_0xe27b('0x21')](_0xe27b('0x22'),_0x192419+'-'+_0xdc9257+'/'+_0x4627d2)['json'](_0x583d89);}return null;};}function patchUpdates(_0x44b53e){return function(_0x384524){try{jsonpatch[_0xe27b('0x23')](_0x384524,_0x44b53e,!![]);}catch(_0x357da5){return BPromise['reject'](_0x357da5);}return _0x384524[_0xe27b('0x24')]();};}function saveUpdates(_0x55abcf,_0x44c9fd){return function(_0x2351b8){if(_0x2351b8){return _0x2351b8['update'](_0x55abcf)['then'](function(_0x10187f){return _0x10187f;});}return null;};}function removeEntity(_0x6b3b53,_0x4b87b1){return function(_0x30258d){if(_0x30258d){return _0x30258d[_0xe27b('0x25')]()[_0xe27b('0x26')](function(){_0x6b3b53[_0xe27b('0x1b')](0xcc)[_0xe27b('0x27')]();});}};}function handleEntityNotFound(_0x573c70,_0x441009){return function(_0x4db4ff){if(!_0x4db4ff){_0x573c70[_0xe27b('0x1a')](0x194);}return _0x4db4ff;};}function handleError(_0x657203,_0x1630fc){_0x1630fc=_0x1630fc||0x1f4;return function(_0x13fdf2){logger[_0xe27b('0x28')](_0x13fdf2['stack']);if(_0x13fdf2[_0xe27b('0x29')]){delete _0x13fdf2[_0xe27b('0x29')];}_0x657203['status'](_0x1630fc)['send'](_0x13fdf2);};}exports[_0xe27b('0x2a')]=function(_0x4205ea,_0x2ea28c){var _0x42f323={},_0x53093d={},_0x28e6d2={'count':0x0,'rows':[]};var _0x3f32b6=_['map'](db[_0xe27b('0x2b')][_0xe27b('0x2c')],function(_0x12f0f3){return{'name':_0x12f0f3[_0xe27b('0x2d')],'type':_0x12f0f3[_0xe27b('0x2e')][_0xe27b('0x2f')]};});_0x53093d[_0xe27b('0x30')]=_[_0xe27b('0x31')](_0x3f32b6,_0xe27b('0x29'));_0x53093d[_0xe27b('0x32')]=_[_0xe27b('0x33')](_0x4205ea[_0xe27b('0x32')]);_0x53093d[_0xe27b('0x34')]=_[_0xe27b('0x35')](_0x53093d['model'],_0x53093d[_0xe27b('0x32')]);_0x42f323[_0xe27b('0x36')]=_[_0xe27b('0x35')](_0x53093d[_0xe27b('0x30')],qs['fields'](_0x4205ea[_0xe27b('0x32')][_0xe27b('0x37')]));_0x42f323['attributes']=_0x42f323[_0xe27b('0x36')][_0xe27b('0x38')]?_0x42f323['attributes']:_0x53093d[_0xe27b('0x30')];if(!_0x4205ea[_0xe27b('0x32')][_0xe27b('0x39')](_0xe27b('0x3a'))){_0x42f323['limit']=qs[_0xe27b('0x20')](_0x4205ea[_0xe27b('0x32')][_0xe27b('0x20')]);_0x42f323['offset']=qs['offset'](_0x4205ea['query']['offset']);}_0x42f323['order']=qs[_0xe27b('0x3b')](_0x4205ea[_0xe27b('0x32')][_0xe27b('0x3b')]);_0x42f323[_0xe27b('0x3c')]=qs[_0xe27b('0x34')](_[_0xe27b('0x3d')](_0x4205ea[_0xe27b('0x32')],_0x53093d['filters']),_0x3f32b6);if(_0x4205ea[_0xe27b('0x32')][_0xe27b('0x3e')]){_0x42f323[_0xe27b('0x3c')]=_[_0xe27b('0x3f')](_0x42f323['where'],{'$or':_[_0xe27b('0x31')](_0x3f32b6,function(_0x57f17d){if(_0x57f17d[_0xe27b('0x2e')]!=='VIRTUAL'){var _0x4f5fa5={};_0x4f5fa5[_0x57f17d[_0xe27b('0x29')]]={'$like':'%'+_0x4205ea[_0xe27b('0x32')]['filter']+'%'};return _0x4f5fa5;}})});}_0x42f323=_[_0xe27b('0x3f')]({},_0x42f323,_0x4205ea['options']);var _0x3bc3e7={'where':_0x42f323[_0xe27b('0x3c')]};return db[_0xe27b('0x2b')][_0xe27b('0x1f')](_0x3bc3e7)[_0xe27b('0x26')](function(_0x4117a6){_0x28e6d2['count']=_0x4117a6;if(_0x4205ea[_0xe27b('0x32')][_0xe27b('0x40')]){_0x42f323[_0xe27b('0x41')]=[{'all':!![]}];}return db[_0xe27b('0x2b')]['findAll'](_0x42f323);})['then'](function(_0x9150af){_0x28e6d2[_0xe27b('0x42')]=_0x9150af;return _0x28e6d2;})['then'](respondWithFilteredResult(_0x2ea28c,_0x42f323))[_0xe27b('0x43')](handleError(_0x2ea28c,null));};exports[_0xe27b('0x44')]=function(_0x3dc134,_0x22af41){var _0x4326f9={'raw':![],'where':{'id':_0x3dc134[_0xe27b('0x45')]['id']}},_0x4f3478={};_0x4f3478[_0xe27b('0x30')]=_[_0xe27b('0x33')](db['VtigerAccount'][_0xe27b('0x2c')]);_0x4f3478[_0xe27b('0x32')]=_[_0xe27b('0x33')](_0x3dc134[_0xe27b('0x32')]);_0x4f3478['filters']=_[_0xe27b('0x35')](_0x4f3478[_0xe27b('0x30')],_0x4f3478['query']);_0x4326f9[_0xe27b('0x36')]=_[_0xe27b('0x35')](_0x4f3478['model'],qs[_0xe27b('0x37')](_0x3dc134['query'][_0xe27b('0x37')]));_0x4326f9[_0xe27b('0x36')]=_0x4326f9[_0xe27b('0x36')][_0xe27b('0x38')]?_0x4326f9[_0xe27b('0x36')]:_0x4f3478[_0xe27b('0x30')];if(_0x3dc134[_0xe27b('0x32')][_0xe27b('0x40')]){_0x4326f9['include']=[{'all':!![]}];}_0x4326f9=_[_0xe27b('0x3f')]({},_0x4326f9,_0x3dc134['options']);return db[_0xe27b('0x2b')][_0xe27b('0x46')](_0x4326f9)[_0xe27b('0x26')](handleEntityNotFound(_0x22af41,null))[_0xe27b('0x26')](respondWithResult(_0x22af41,null))[_0xe27b('0x43')](handleError(_0x22af41,null));};exports[_0xe27b('0x47')]=function(_0x43c5e0,_0x309206){return db['VtigerAccount'][_0xe27b('0x47')](_0x43c5e0[_0xe27b('0x48')],{})[_0xe27b('0x26')](respondWithResult(_0x309206,0xc9))['catch'](handleError(_0x309206,null));};exports[_0xe27b('0x49')]=function(_0x4583b1,_0x152920){if(_0x4583b1['body']['id']){delete _0x4583b1[_0xe27b('0x48')]['id'];}return db[_0xe27b('0x2b')][_0xe27b('0x46')]({'where':{'id':_0x4583b1['params']['id']}})['then'](handleEntityNotFound(_0x152920,null))[_0xe27b('0x26')](saveUpdates(_0x4583b1['body'],null))['then'](respondWithResult(_0x152920,null))['catch'](handleError(_0x152920,null));};exports[_0xe27b('0x25')]=function(_0x3fdc77,_0x524be9){return db[_0xe27b('0x2b')]['find']({'where':{'id':_0x3fdc77[_0xe27b('0x45')]['id']}})['then'](handleEntityNotFound(_0x524be9,null))[_0xe27b('0x26')](removeEntity(_0x524be9,null))['catch'](handleError(_0x524be9,null));};exports['getConfigurations']=function(_0x5c4fb2,_0x1ec609,_0x522b61){var _0x30106a={};var _0x32a076={};var _0x2912d1;var _0x8836ba;return db['VtigerAccount'][_0xe27b('0x4a')]({'where':{'id':_0x5c4fb2[_0xe27b('0x45')]['id']}})[_0xe27b('0x26')](handleEntityNotFound(_0x1ec609,null))['then'](function(_0x436e7a){if(_0x436e7a){_0x2912d1=_0x436e7a;_0x32a076[_0xe27b('0x30')]=_[_0xe27b('0x33')](db[_0xe27b('0x4b')][_0xe27b('0x2c')]);_0x32a076[_0xe27b('0x32')]=_['keys'](_0x5c4fb2['query']);_0x32a076['filters']=_['intersection'](_0x32a076[_0xe27b('0x30')],_0x32a076[_0xe27b('0x32')]);_0x30106a[_0xe27b('0x36')]=_['intersection'](_0x32a076[_0xe27b('0x30')],qs[_0xe27b('0x37')](_0x5c4fb2[_0xe27b('0x32')][_0xe27b('0x37')]));_0x30106a['attributes']=_0x30106a[_0xe27b('0x36')][_0xe27b('0x38')]?_0x30106a['attributes']:_0x32a076[_0xe27b('0x30')];_0x30106a['order']=qs[_0xe27b('0x3b')](_0x5c4fb2[_0xe27b('0x32')][_0xe27b('0x3b')]);_0x30106a[_0xe27b('0x3c')]=qs[_0xe27b('0x34')](_['pick'](_0x5c4fb2[_0xe27b('0x32')],_0x32a076[_0xe27b('0x34')]));if(_0x5c4fb2[_0xe27b('0x32')][_0xe27b('0x3e')]){_0x30106a['where']=_[_0xe27b('0x3f')](_0x30106a['where'],{'$or':_['map'](_0x30106a[_0xe27b('0x36')],function(_0x34364d){var _0x22dff2={};_0x22dff2[_0x34364d]={'$like':'%'+_0x5c4fb2[_0xe27b('0x32')][_0xe27b('0x3e')]+'%'};return _0x22dff2;})});}_0x30106a=_['merge']({},_0x30106a,_0x5c4fb2[_0xe27b('0x4c')]);return _0x2912d1['getConfigurations'](_0x30106a);}})['then'](function(_0x4dc488){if(_0x4dc488){_0x8836ba=_0x4dc488['length'];if(!_0x5c4fb2[_0xe27b('0x32')]['hasOwnProperty'](_0xe27b('0x3a'))){_0x30106a['limit']=qs[_0xe27b('0x20')](_0x5c4fb2['query'][_0xe27b('0x20')]);_0x30106a[_0xe27b('0x1d')]=qs[_0xe27b('0x1d')](_0x5c4fb2[_0xe27b('0x32')]['offset']);}return _0x2912d1[_0xe27b('0x4d')](_0x30106a);}})['then'](function(_0x4dda7f){if(_0x4dda7f){return _0x4dda7f?{'count':_0x8836ba,'rows':_0x4dda7f}:null;}})[_0xe27b('0x26')](respondWithResult(_0x1ec609,null))[_0xe27b('0x43')](handleError(_0x1ec609,null));};exports[_0xe27b('0x4e')]=function(_0x366e4c,_0x5ca9bc,_0xe00231){if(_0x366e4c[_0xe27b('0x48')]['id']){delete _0x366e4c[_0xe27b('0x48')]['id'];}return db[_0xe27b('0x2b')][_0xe27b('0x4a')]({'where':{'id':_0x366e4c[_0xe27b('0x45')]['id']}})[_0xe27b('0x26')](handleEntityNotFound(_0x5ca9bc,null))['then'](function(_0x14c23d){if(_0x14c23d){_0x366e4c['body']['AccountId']=_0x14c23d['id'];_0x366e4c['body']['Subjects']=integrations['getSubjects'](_0x366e4c[_0xe27b('0x48')][_0xe27b('0x4f')],_0x366e4c[_0xe27b('0x48')]['type']);_0x366e4c['body'][_0xe27b('0x50')]=integrations[_0xe27b('0x51')](_0x366e4c['body'][_0xe27b('0x4f')],_0x366e4c[_0xe27b('0x48')][_0xe27b('0x2e')]);return db[_0xe27b('0x4b')]['create'](_0x366e4c['body'],{'include':[{'model':db[_0xe27b('0x52')],'as':'Subjects'},{'model':db[_0xe27b('0x52')],'as':'Descriptions'}]});}return null;})[_0xe27b('0x26')](respondWithResult(_0x5ca9bc,null))[_0xe27b('0x43')](handleError(_0x5ca9bc,null));};var md5=require(_0xe27b('0x53'));exports[_0xe27b('0x54')]=function(_0x126c6f,_0x4fcbe1,_0x4538d5){var _0x5cf3b7=null;var _0x1cd850=null;var _0x184fd3=null;var _0x5e8dfa=null;var _0x6fd129='';return db[_0xe27b('0x2b')][_0xe27b('0x4a')]({'where':{'id':_0x126c6f[_0xe27b('0x45')]['id']},'attributes':['id','name',_0xe27b('0x55'),_0xe27b('0x56'),'moduleName',_0xe27b('0x57'),_0xe27b('0x58'),_0xe27b('0x59')]})['then'](handleEntityNotFound(_0x4fcbe1,null))[_0xe27b('0x26')](function(_0x8757ee){if(_0x8757ee){_0x5cf3b7=_0x8757ee['username'];_0x1cd850=_0x8757ee[_0xe27b('0x59')];_0x184fd3=_0x8757ee['moduleName'];_0x6fd129=_0x8757ee['remoteUri'];var _0x2b0f15=_0x6fd129['slice'](-0x1);if(_0x2b0f15==='/'){_0x6fd129=_0x6fd129[_0xe27b('0x5a')](0x0,_0x6fd129[_0xe27b('0x5b')](_0x2b0f15));}_0x5e8dfa=util[_0xe27b('0x5c')](_0xe27b('0x5d'),_0x6fd129);var _0x3c5996={'method':'GET','uri':_0x5e8dfa,'qs':{'operation':_0xe27b('0x5e'),'username':_0x8757ee[_0xe27b('0x55')]},'json':!![]};return rp(_0x3c5996);}})['then'](function(_0x18eaa1){if(_0x18eaa1['success']){var _0x4d1674={'method':_0xe27b('0x5f'),'uri':_0x5e8dfa,'form':{'operation':_0xe27b('0x60'),'username':_0x5cf3b7,'accessKey':md5(_0x18eaa1[_0xe27b('0x61')][_0xe27b('0x62')]+_0x1cd850)},'json':!![]};return rp(_0x4d1674);}})[_0xe27b('0x26')](function(_0x1312ad){if(_0x1312ad[_0xe27b('0x63')]){var _0x512b28={'method':_0xe27b('0x64'),'uri':_0x5e8dfa,'qs':{'operation':_0xe27b('0x65'),'username':_0x5cf3b7,'sessionName':_0x1312ad['result'][_0xe27b('0x66')],'elementType':_0x184fd3},'json':!![]};return rp(_0x512b28);}})['then'](function(_0x31e3c3){if(_0x31e3c3['success']){var _0x2eab27=[_0xe27b('0x67'),_0xe27b('0x68'),_0xe27b('0x69')];_[_0xe27b('0x6a')](_0x31e3c3['result'][_0xe27b('0x37')],function(_0x354851){return _0x2eab27['includes'](_0x354851[_0xe27b('0x2e')][_0xe27b('0x29')]);});_[_0xe27b('0x6a')](_0x31e3c3[_0xe27b('0x61')]['fields'],function(_0x1e7138){return _0x1e7138[_0xe27b('0x6b')]===_0xe27b('0x6c');});return{'count':_0x31e3c3[_0xe27b('0x61')][_0xe27b('0x37')][_0xe27b('0x38')],'rows':_[_0xe27b('0x31')](_0x31e3c3['result'][_0xe27b('0x37')],function(_0x25b26d){return{'id':_0x25b26d[_0xe27b('0x29')],'name':_0x25b26d[_0xe27b('0x6d')],'custom':_[_0xe27b('0x6e')](_0x25b26d[_0xe27b('0x29')],_0xe27b('0x6f'))?!![]:![],'options':_0x25b26d[_0xe27b('0x2e')][_0xe27b('0x29')]===_0xe27b('0x70')&&_0x25b26d[_0xe27b('0x2e')][_0xe27b('0x71')][_0xe27b('0x38')]>0x0?_[_0xe27b('0x31')](_0x25b26d[_0xe27b('0x2e')][_0xe27b('0x71')],function(_0x2c6696){return{'name':_0x2c6696[_0xe27b('0x6d')],'value':_0x2c6696['value']};}):[]};})};}})['then'](respondWithResult(_0x4fcbe1,null))[_0xe27b('0x43')](function(_0xb63329){console[_0xe27b('0x72')](_0xe27b('0x73')+_0xb63329);var _0x58d59b=_0x126c6f[_0xe27b('0x32')][_0xe27b('0x74')]?0x1f4:_0xb63329[_0xe27b('0x75')]||0x1f4;logger[_0xe27b('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xe27b('0x54'),_0x58d59b,JSON[_0xe27b('0x76')](_0xb63329));delete _0xb63329['name'];if(_0x58d59b===0x191){_0x58d59b=0x190;}_0x4fcbe1['status'](_0x58d59b)[_0xe27b('0x77')](_0x126c6f[_0xe27b('0x32')][_0xe27b('0x74')]?{'message':_0xe27b('0x78'),'statusCode':_0xb63329[_0xe27b('0x75')]}:_0xb63329);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 9e3d653..8ac95c3 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 _0x4796=['../../config/environment','../../components/integrations/configuration','exports','define','lodash','util','moment','request-promise','path'];(function(_0x31bf9f,_0x5393d7){var _0x13867c=function(_0x1f9c4d){while(--_0x1f9c4d){_0x31bf9f['push'](_0x31bf9f['shift']());}};_0x13867c(++_0x5393d7);}(_0x4796,0x70));var _0x6479=function(_0x4f05ee,_0x762ea8){_0x4f05ee=_0x4f05ee-0x0;var _0x33bd77=_0x4796[_0x4f05ee];return _0x33bd77;};'use strict';var _=require(_0x6479('0x0'));var util=require(_0x6479('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6479('0x2'));var BPromise=require('bluebird');var rp=require(_0x6479('0x3'));var fs=require('fs');var path=require(_0x6479('0x4'));var rimraf=require('rimraf');var config=require(_0x6479('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x6479('0x6'));module[_0x6479('0x7')]=function(_0x61e0fc,_0x1b7b93){return _0x61e0fc[_0x6479('0x8')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e9a=['../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes'];(function(_0x5272ce,_0x47346f){var _0x501f98=function(_0x2e2ed4){while(--_0x2e2ed4){_0x5272ce['push'](_0x5272ce['shift']());}};_0x501f98(++_0x47346f);}(_0x9e9a,0xfc));var _0xa9e9=function(_0x44d3d7,_0x1c6356){_0x44d3d7=_0x44d3d7-0x0;var _0x1886c0=_0x9e9a[_0x44d3d7];return _0x1886c0;};'use strict';var _=require(_0xa9e9('0x0'));var util=require('util');var logger=require(_0xa9e9('0x1'))('api');var moment=require(_0xa9e9('0x2'));var BPromise=require(_0xa9e9('0x3'));var rp=require(_0xa9e9('0x4'));var fs=require('fs');var path=require(_0xa9e9('0x5'));var rimraf=require('rimraf');var config=require(_0xa9e9('0x6'));var attributes=require(_0xa9e9('0x7'));var integrations=require(_0xa9e9('0x8'));module[_0xa9e9('0x9')]=function(_0x1e156b,_0x323e68){return _0x1e156b[_0xa9e9('0xa')](_0xa9e9('0xb'),attributes,{'tableName':_0xa9e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 1b4d005..b0c12c5 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea28=['code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','ShowVtigerAccount','find','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4a423e,_0x59ba7b){var _0x4ad91f=function(_0x55e261){while(--_0x55e261){_0x4a423e['push'](_0x4a423e['shift']());}};_0x4ad91f(++_0x59ba7b);}(_0xea28,0x13a));var _0x8ea2=function(_0x26fc9e,_0x139a19){_0x26fc9e=_0x26fc9e-0x0;var _0x2b83b9=_0xea28[_0x26fc9e];return _0x2b83b9;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});}exports[_0x8ea2('0x17')]=function(_0x1b64cf){var _0x174ef2=this;return new Promise(function(_0x467045,_0x2a0329){return db[_0x8ea2('0x18')][_0x8ea2('0x19')]({'raw':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf[_0x8ea2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1b64cf['options']?_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1b')]||null:null,'attributes':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf['options'][_0x8ea2('0x1c')]||null:null,'limit':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf['options'][_0x8ea2('0x1d')]||null:null,'include':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1e')]?_[_0x8ea2('0x1f')](_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1e')],function(_0x1e4cc9){return{'model':db[_0x1e4cc9[_0x8ea2('0x20')]],'as':_0x1e4cc9['as'],'attributes':_0x1e4cc9['attributes'],'include':_0x1e4cc9[_0x8ea2('0x1e')]?_['map'](_0x1e4cc9[_0x8ea2('0x1e')],function(_0x42bec8){return{'model':db[_0x42bec8[_0x8ea2('0x20')]],'as':_0x42bec8['as'],'attributes':_0x42bec8['attributes'],'include':_0x42bec8['include']?_[_0x8ea2('0x1f')](_0x42bec8['include'],function(_0x200a49){return{'model':db[_0x200a49['model']],'as':_0x200a49['as'],'attributes':_0x200a49[_0x8ea2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8ea2('0xd')](function(_0x21c526){logger[_0x8ea2('0xe')]('GetVtigerAccount',_0x1b64cf);logger['debug'](_0x8ea2('0x17'),_0x1b64cf,JSON['stringify'](_0x21c526));_0x467045(_0x21c526);})[_0x8ea2('0x16')](function(_0x287078){logger[_0x8ea2('0x12')](_0x8ea2('0x17'),_0x287078[_0x8ea2('0x14')],_0x1b64cf);_0x2a0329(_0x174ef2[_0x8ea2('0x12')](0x1f4,_0x287078[_0x8ea2('0x14')]));});});};exports[_0x8ea2('0x21')]=function(_0x19e868){var _0x9c5fac=this;return new Promise(function(_0x56d914,_0x5b7ff9){return db[_0x8ea2('0x18')][_0x8ea2('0x22')]({'raw':_0x19e868['options']?_0x19e868['options'][_0x8ea2('0x23')]===undefined?!![]:![]:!![],'where':_0x19e868['options']?_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1b')]||null:null,'attributes':_0x19e868['options']?_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1c')]||null:null,'include':_0x19e868[_0x8ea2('0x1a')]?_0x19e868['options']['include']?_['map'](_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1e')],function(_0x3fc785){return{'model':db[_0x3fc785['model']],'as':_0x3fc785['as'],'attributes':_0x3fc785[_0x8ea2('0x1c')],'include':_0x3fc785[_0x8ea2('0x1e')]?_[_0x8ea2('0x1f')](_0x3fc785[_0x8ea2('0x1e')],function(_0x253031){return{'model':db[_0x253031[_0x8ea2('0x20')]],'as':_0x253031['as'],'attributes':_0x253031[_0x8ea2('0x1c')],'include':_0x253031[_0x8ea2('0x1e')]?_['map'](_0x253031[_0x8ea2('0x1e')],function(_0x29e3f5){return{'model':db[_0x29e3f5[_0x8ea2('0x20')]],'as':_0x29e3f5['as'],'attributes':_0x29e3f5[_0x8ea2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a1f14){logger['info'](_0x8ea2('0x21'),_0x19e868);logger[_0x8ea2('0x24')](_0x8ea2('0x21'),_0x19e868,JSON[_0x8ea2('0x11')](_0x2a1f14));_0x56d914(_0x2a1f14);})['catch'](function(_0x2bed24){logger['error']('ShowVtigerAccount',_0x2bed24[_0x8ea2('0x14')],_0x19e868);_0x5b7ff9(_0x9c5fac['error'](0x1f4,_0x2bed24[_0x8ea2('0x14')]));});});}; \ No newline at end of file +var _0xf45e=['options','raw','where','attributes','limit','include','model','map','VtigerAccount','find','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','findAll'];(function(_0x39f1da,_0x497301){var _0x2d5907=function(_0x59f3ec){while(--_0x59f3ec){_0x39f1da['push'](_0x39f1da['shift']());}};_0x2d5907(++_0x497301);}(_0xf45e,0x115));var _0xef45=function(_0x9ad312,_0x13a508){_0x9ad312=_0x9ad312-0x0;var _0x2d236b=_0xf45e[_0x9ad312];return _0x2d236b;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['VtigerAccount'][_0xef45('0x1a')]({'raw':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1c')]===undefined?!![]:![]:!![],'where':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x219778['options']?_0x219778[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'limit':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1f')]||null:null,'include':_0x219778['options']?_0x219778[_0xef45('0x1b')]['include']?_['map'](_0x219778[_0xef45('0x1b')][_0xef45('0x20')],function(_0xbb859b){return{'model':db[_0xbb859b[_0xef45('0x21')]],'as':_0xbb859b['as'],'attributes':_0xbb859b[_0xef45('0x1e')],'include':_0xbb859b[_0xef45('0x20')]?_[_0xef45('0x22')](_0xbb859b['include'],function(_0x208b35){return{'model':db[_0x208b35['model']],'as':_0x208b35['as'],'attributes':_0x208b35[_0xef45('0x1e')],'include':_0x208b35[_0xef45('0x20')]?_['map'](_0x208b35[_0xef45('0x20')],function(_0x2c356d){return{'model':db[_0x2c356d['model']],'as':_0x2c356d['as'],'attributes':_0x2c356d[_0xef45('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550e18){logger['info']('GetVtigerAccount',_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x550e18));_0x258785(_0x550e18);})[_0xef45('0x18')](function(_0x5782d0){logger[_0xef45('0x13')]('GetVtigerAccount',_0x5782d0[_0xef45('0x16')],_0x219778);_0x4ca902(_0x3ba1f4['error'](0x1f4,_0x5782d0[_0xef45('0x16')]));});});};exports['ShowVtigerAccount']=function(_0x575734){var _0x14ce5a=this;return new Promise(function(_0x3e45de,_0x390a7a){return db[_0xef45('0x23')][_0xef45('0x24')]({'raw':_0x575734['options']?_0x575734['options']['raw']===undefined?!![]:![]:!![],'where':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'include':_0x575734[_0xef45('0x1b')]?_0x575734['options']['include']?_[_0xef45('0x22')](_0x575734['options'][_0xef45('0x20')],function(_0x5116b0){return{'model':db[_0x5116b0[_0xef45('0x21')]],'as':_0x5116b0['as'],'attributes':_0x5116b0[_0xef45('0x1e')],'include':_0x5116b0[_0xef45('0x20')]?_[_0xef45('0x22')](_0x5116b0[_0xef45('0x20')],function(_0x5b7d73){return{'model':db[_0x5b7d73[_0xef45('0x21')]],'as':_0x5b7d73['as'],'attributes':_0x5b7d73[_0xef45('0x1e')],'include':_0x5b7d73[_0xef45('0x20')]?_['map'](_0x5b7d73['include'],function(_0x787387){return{'model':db[_0x787387[_0xef45('0x21')]],'as':_0x787387['as'],'attributes':_0x787387['attributes']};}):[]};}):[]};}):[]:[]})[_0xef45('0xd')](function(_0x501eb3){logger['info'](_0xef45('0x25'),_0x575734);logger[_0xef45('0x10')](_0xef45('0x25'),_0x575734,JSON['stringify'](_0x501eb3));_0x3e45de(_0x501eb3);})[_0xef45('0x18')](function(_0x3a1bcc){logger[_0xef45('0x13')](_0xef45('0x25'),_0x3a1bcc['message'],_0x575734);_0x390a7a(_0x14ce5a['error'](0x1f4,_0x3a1bcc[_0xef45('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index f3029a9..595e539 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 _0x586a=['./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56869a,_0x41030e){var _0x300326=function(_0x19cdad){while(--_0x19cdad){_0x56869a['push'](_0x56869a['shift']());}};_0x300326(++_0x41030e);}(_0x586a,0xe2));var _0xa586=function(_0x138c09,_0xabf92f){_0x138c09=_0x138c09-0x0;var _0x1eba57=_0x586a[_0x138c09];return _0x1eba57;};'use strict';var multer=require(_0xa586('0x0'));var util=require(_0xa586('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa586('0x2'));var router=express[_0xa586('0x3')]();var fs_extra=require(_0xa586('0x4'));var auth=require(_0xa586('0x5'));var interaction=require(_0xa586('0x6'));var config=require(_0xa586('0x7'));var controller=require(_0xa586('0x8'));router[_0xa586('0x9')]('/',auth[_0xa586('0xa')](),controller[_0xa586('0xb')]);router[_0xa586('0x9')](_0xa586('0xc'),auth['isAuthenticated'](),controller[_0xa586('0xd')]);router['get']('/:id/fields',auth[_0xa586('0xa')](),controller[_0xa586('0xe')]);router[_0xa586('0x9')](_0xa586('0xf'),auth[_0xa586('0xa')](),controller[_0xa586('0x10')]);router['get'](_0xa586('0x11'),auth[_0xa586('0xa')](),controller[_0xa586('0x12')]);router[_0xa586('0x13')]('/',auth[_0xa586('0xa')](),controller[_0xa586('0x14')]);router[_0xa586('0x15')](_0xa586('0xc'),auth[_0xa586('0xa')](),controller[_0xa586('0x16')]);router[_0xa586('0x17')]('/:id',auth[_0xa586('0xa')](),controller[_0xa586('0x18')]);module[_0xa586('0x19')]=router; \ No newline at end of file +var _0x3562=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','util','path','express','Router'];(function(_0x16528d,_0x3089e0){var _0x1fd73e=function(_0x1dca68){while(--_0x1dca68){_0x16528d['push'](_0x16528d['shift']());}};_0x1fd73e(++_0x3089e0);}(_0x3562,0x178));var _0x2356=function(_0x2ce286,_0x4104e4){_0x2ce286=_0x2ce286-0x0;var _0x4c471f=_0x3562[_0x2ce286];return _0x4c471f;};'use strict';var multer=require('multer');var util=require(_0x2356('0x0'));var path=require(_0x2356('0x1'));var timeout=require('connect-timeout');var express=require(_0x2356('0x2'));var router=express[_0x2356('0x3')]();var fs_extra=require(_0x2356('0x4'));var auth=require(_0x2356('0x5'));var interaction=require(_0x2356('0x6'));var config=require(_0x2356('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0x2356('0x8')]('/',auth[_0x2356('0x9')](),controller['index']);router['get']('/:id',auth[_0x2356('0x9')](),controller['show']);router['get'](_0x2356('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x2356('0x8')](_0x2356('0xb'),auth[_0x2356('0x9')](),controller[_0x2356('0xc')]);router[_0x2356('0x8')](_0x2356('0xd'),auth[_0x2356('0x9')](),controller[_0x2356('0xe')]);router[_0x2356('0xf')]('/',auth[_0x2356('0x9')](),controller['create']);router[_0x2356('0x10')](_0x2356('0x11'),auth[_0x2356('0x9')](),controller[_0x2356('0x12')]);router['delete'](_0x2356('0x11'),auth[_0x2356('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 7e7c406..55f738f 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 _0x1c41=['STRING','exports'];(function(_0x4ba057,_0xb4157){var _0x56ade0=function(_0xf2cad1){while(--_0xf2cad1){_0x4ba057['push'](_0x4ba057['shift']());}};_0x56ade0(++_0xb4157);}(_0x1c41,0xa5));var _0x11c4=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x1c41[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require('sequelize');module[_0x11c4('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x11c4('0x1')]}}; \ No newline at end of file +var _0x6f86=['sequelize','exports','STRING'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0x6f86,0x141));var _0x66f8=function(_0x1f736e,_0x23a84d){_0x1f736e=_0x1f736e-0x0;var _0x5760f1=_0x6f86[_0x1f736e];return _0x5760f1;};'use strict';var Sequelize=require(_0x66f8('0x0'));module[_0x66f8('0x1')]={'name':{'type':Sequelize[_0x66f8('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 587b04f..ed1550e 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 _0xe3e5=['name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','length','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','intersection','fields','options','find','create','body','destroy','getFields','findOne','order','hasOwnProperty','nolimit','getSubjects','VtigerField','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','stack'];(function(_0x3ff271,_0x33d4f7){var _0x2a3a7e=function(_0xf986eb){while(--_0xf986eb){_0x3ff271['push'](_0x3ff271['shift']());}};_0x2a3a7e(++_0x33d4f7);}(_0xe3e5,0x77));var _0x5e3e=function(_0x410dc5,_0x537871){_0x410dc5=_0x410dc5-0x0;var _0x659202=_0xe3e5[_0x410dc5];return _0x659202;};'use strict';var emlformat=require(_0x5e3e('0x0'));var rimraf=require(_0x5e3e('0x1'));var zipdir=require(_0x5e3e('0x2'));var jsonpatch=require(_0x5e3e('0x3'));var rp=require(_0x5e3e('0x4'));var moment=require(_0x5e3e('0x5'));var BPromise=require(_0x5e3e('0x6'));var Mustache=require(_0x5e3e('0x7'));var util=require(_0x5e3e('0x8'));var path=require(_0x5e3e('0x9'));var sox=require(_0x5e3e('0xa'));var csv=require(_0x5e3e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e3e('0xc'));var jsforce=require(_0x5e3e('0xd'));var deskjs=require(_0x5e3e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5e3e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e3e('0x10'));var hardwareService=require(_0x5e3e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5e3e('0x12'));var config=require(_0x5e3e('0x13'));var licenseUtil=require(_0x5e3e('0x14'));var db=require(_0x5e3e('0x15'))['db'];function respondWithStatusCode(_0x47cde6,_0x5b3a99){_0x5b3a99=_0x5b3a99||0xcc;return function(_0x5cbe49){if(_0x5cbe49){return _0x47cde6[_0x5e3e('0x16')](_0x5b3a99);}return _0x47cde6[_0x5e3e('0x17')](_0x5b3a99)['end']();};}function respondWithResult(_0x2b7f5,_0x59a931){_0x59a931=_0x59a931||0xc8;return function(_0x360954){if(_0x360954){return _0x2b7f5['status'](_0x59a931)[_0x5e3e('0x18')](_0x360954);}};}function respondWithFilteredResult(_0x1cdaff,_0x2f04f3){return function(_0x5d44a8){if(_0x5d44a8){var _0x306641=typeof _0x2f04f3[_0x5e3e('0x19')]===_0x5e3e('0x1a')&&typeof _0x2f04f3['limit']===_0x5e3e('0x1a');var _0x378f9c=_0x5d44a8[_0x5e3e('0x1b')];var _0x14ac67=_0x306641?0x0:_0x2f04f3[_0x5e3e('0x19')];var _0x12cf69=_0x306641?_0x5d44a8[_0x5e3e('0x1b')]:_0x2f04f3['offset']+_0x2f04f3[_0x5e3e('0x1c')];var _0x285857;if(_0x12cf69>=_0x378f9c){_0x12cf69=_0x378f9c;_0x285857=0xc8;}else{_0x285857=0xce;}_0x1cdaff[_0x5e3e('0x17')](_0x285857);return _0x1cdaff[_0x5e3e('0x1d')]('Content-Range',_0x14ac67+'-'+_0x12cf69+'/'+_0x378f9c)['json'](_0x5d44a8);}return null;};}function patchUpdates(_0x171251){return function(_0x2e7d50){try{jsonpatch[_0x5e3e('0x1e')](_0x2e7d50,_0x171251,!![]);}catch(_0x28690a){return BPromise[_0x5e3e('0x1f')](_0x28690a);}return _0x2e7d50[_0x5e3e('0x20')]();};}function saveUpdates(_0x347106,_0x2e88e6){return function(_0x4327e4){if(_0x4327e4){return _0x4327e4[_0x5e3e('0x21')](_0x347106)[_0x5e3e('0x22')](function(_0x5ec43f){return _0x5ec43f;});}return null;};}function removeEntity(_0x4433a4,_0x1ecde4){return function(_0x1256f7){if(_0x1256f7){return _0x1256f7['destroy']()[_0x5e3e('0x22')](function(){_0x4433a4['status'](0xcc)[_0x5e3e('0x23')]();});}};}function handleEntityNotFound(_0x250930,_0x3f4f0c){return function(_0x3633a8){if(!_0x3633a8){_0x250930[_0x5e3e('0x16')](0x194);}return _0x3633a8;};}function handleError(_0x48633c,_0x39c0d7){_0x39c0d7=_0x39c0d7||0x1f4;return function(_0x3d9b64){logger['error'](_0x3d9b64[_0x5e3e('0x24')]);if(_0x3d9b64[_0x5e3e('0x25')]){delete _0x3d9b64[_0x5e3e('0x25')];}_0x48633c[_0x5e3e('0x17')](_0x39c0d7)[_0x5e3e('0x26')](_0x3d9b64);};}exports['index']=function(_0x1f3b25,_0x416a00){var _0x46f262={},_0x5b0937={},_0x5a92a8={'count':0x0,'rows':[]};var _0x4286c3=_[_0x5e3e('0x27')](db[_0x5e3e('0x28')][_0x5e3e('0x29')],function(_0xb785d1){return{'name':_0xb785d1[_0x5e3e('0x2a')],'type':_0xb785d1[_0x5e3e('0x2b')][_0x5e3e('0x2c')]};});_0x5b0937[_0x5e3e('0x2d')]=_[_0x5e3e('0x27')](_0x4286c3,_0x5e3e('0x25'));_0x5b0937[_0x5e3e('0x2e')]=_['keys'](_0x1f3b25[_0x5e3e('0x2e')]);_0x5b0937[_0x5e3e('0x2f')]=_['intersection'](_0x5b0937['model'],_0x5b0937[_0x5e3e('0x2e')]);_0x46f262[_0x5e3e('0x30')]=_['intersection'](_0x5b0937['model'],qs['fields'](_0x1f3b25['query']['fields']));_0x46f262[_0x5e3e('0x30')]=_0x46f262[_0x5e3e('0x30')][_0x5e3e('0x31')]?_0x46f262[_0x5e3e('0x30')]:_0x5b0937[_0x5e3e('0x2d')];if(!_0x1f3b25['query']['hasOwnProperty']('nolimit')){_0x46f262[_0x5e3e('0x1c')]=qs[_0x5e3e('0x1c')](_0x1f3b25['query'][_0x5e3e('0x1c')]);_0x46f262[_0x5e3e('0x19')]=qs[_0x5e3e('0x19')](_0x1f3b25[_0x5e3e('0x2e')][_0x5e3e('0x19')]);}_0x46f262['order']=qs[_0x5e3e('0x32')](_0x1f3b25[_0x5e3e('0x2e')][_0x5e3e('0x32')]);_0x46f262[_0x5e3e('0x33')]=qs[_0x5e3e('0x2f')](_['pick'](_0x1f3b25[_0x5e3e('0x2e')],_0x5b0937[_0x5e3e('0x2f')]),_0x4286c3);if(_0x1f3b25['query'][_0x5e3e('0x34')]){_0x46f262['where']=_[_0x5e3e('0x35')](_0x46f262[_0x5e3e('0x33')],{'$or':_[_0x5e3e('0x27')](_0x4286c3,function(_0x2729ce){if(_0x2729ce['type']!==_0x5e3e('0x36')){var _0x3ad055={};_0x3ad055[_0x2729ce[_0x5e3e('0x25')]]={'$like':'%'+_0x1f3b25[_0x5e3e('0x2e')][_0x5e3e('0x34')]+'%'};return _0x3ad055;}})});}_0x46f262=_[_0x5e3e('0x35')]({},_0x46f262,_0x1f3b25['options']);var _0x386c72={'where':_0x46f262[_0x5e3e('0x33')]};return db[_0x5e3e('0x28')][_0x5e3e('0x1b')](_0x386c72)['then'](function(_0x290abf){_0x5a92a8[_0x5e3e('0x1b')]=_0x290abf;if(_0x1f3b25[_0x5e3e('0x2e')][_0x5e3e('0x37')]){_0x46f262[_0x5e3e('0x38')]=[{'all':!![]}];}return db[_0x5e3e('0x28')][_0x5e3e('0x39')](_0x46f262);})[_0x5e3e('0x22')](function(_0x537ece){_0x5a92a8['rows']=_0x537ece;return _0x5a92a8;})[_0x5e3e('0x22')](respondWithFilteredResult(_0x416a00,_0x46f262))[_0x5e3e('0x3a')](handleError(_0x416a00,null));};exports[_0x5e3e('0x3b')]=function(_0x4c89c7,_0x4b5e80){var _0x3ee570={'raw':![],'where':{'id':_0x4c89c7[_0x5e3e('0x3c')]['id']}},_0x17dc73={};_0x17dc73[_0x5e3e('0x2d')]=_[_0x5e3e('0x3d')](db[_0x5e3e('0x28')][_0x5e3e('0x29')]);_0x17dc73[_0x5e3e('0x2e')]=_[_0x5e3e('0x3d')](_0x4c89c7[_0x5e3e('0x2e')]);_0x17dc73[_0x5e3e('0x2f')]=_['intersection'](_0x17dc73[_0x5e3e('0x2d')],_0x17dc73[_0x5e3e('0x2e')]);_0x3ee570[_0x5e3e('0x30')]=_[_0x5e3e('0x3e')](_0x17dc73[_0x5e3e('0x2d')],qs[_0x5e3e('0x3f')](_0x4c89c7['query'][_0x5e3e('0x3f')]));_0x3ee570[_0x5e3e('0x30')]=_0x3ee570['attributes'][_0x5e3e('0x31')]?_0x3ee570[_0x5e3e('0x30')]:_0x17dc73[_0x5e3e('0x2d')];if(_0x4c89c7[_0x5e3e('0x2e')][_0x5e3e('0x37')]){_0x3ee570[_0x5e3e('0x38')]=[{'all':!![]}];}_0x3ee570=_['merge']({},_0x3ee570,_0x4c89c7[_0x5e3e('0x40')]);return db[_0x5e3e('0x28')][_0x5e3e('0x41')](_0x3ee570)['then'](handleEntityNotFound(_0x4b5e80,null))[_0x5e3e('0x22')](respondWithResult(_0x4b5e80,null))[_0x5e3e('0x3a')](handleError(_0x4b5e80,null));};exports['create']=function(_0x3cdfd4,_0x23f521){return db['VtigerConfiguration'][_0x5e3e('0x42')](_0x3cdfd4['body'],{})[_0x5e3e('0x22')](respondWithResult(_0x23f521,0xc9))[_0x5e3e('0x3a')](handleError(_0x23f521,null));};exports[_0x5e3e('0x21')]=function(_0x532142,_0x3b67e2){if(_0x532142['body']['id']){delete _0x532142[_0x5e3e('0x43')]['id'];}return db[_0x5e3e('0x28')]['find']({'where':{'id':_0x532142['params']['id']}})[_0x5e3e('0x22')](handleEntityNotFound(_0x3b67e2,null))[_0x5e3e('0x22')](saveUpdates(_0x532142['body'],null))['then'](respondWithResult(_0x3b67e2,null))[_0x5e3e('0x3a')](handleError(_0x3b67e2,null));};exports[_0x5e3e('0x44')]=function(_0x1772ed,_0x22a2b0){return db[_0x5e3e('0x28')][_0x5e3e('0x41')]({'where':{'id':_0x1772ed[_0x5e3e('0x3c')]['id']}})[_0x5e3e('0x22')](handleEntityNotFound(_0x22a2b0,null))[_0x5e3e('0x22')](removeEntity(_0x22a2b0,null))[_0x5e3e('0x3a')](handleError(_0x22a2b0,null));};exports[_0x5e3e('0x45')]=function(_0x22d262,_0x106048,_0x2a43ed){var _0x17fca2={};var _0x192907={};var _0x4c4c1c;var _0x468006;return db[_0x5e3e('0x28')][_0x5e3e('0x46')]({'where':{'id':_0x22d262[_0x5e3e('0x3c')]['id']}})[_0x5e3e('0x22')](handleEntityNotFound(_0x106048,null))['then'](function(_0x346017){if(_0x346017){_0x4c4c1c=_0x346017;_0x192907[_0x5e3e('0x2d')]=_[_0x5e3e('0x3d')](db['VtigerField'][_0x5e3e('0x29')]);_0x192907[_0x5e3e('0x2e')]=_['keys'](_0x22d262[_0x5e3e('0x2e')]);_0x192907[_0x5e3e('0x2f')]=_[_0x5e3e('0x3e')](_0x192907[_0x5e3e('0x2d')],_0x192907[_0x5e3e('0x2e')]);_0x17fca2[_0x5e3e('0x30')]=_[_0x5e3e('0x3e')](_0x192907[_0x5e3e('0x2d')],qs[_0x5e3e('0x3f')](_0x22d262[_0x5e3e('0x2e')][_0x5e3e('0x3f')]));_0x17fca2[_0x5e3e('0x30')]=_0x17fca2[_0x5e3e('0x30')][_0x5e3e('0x31')]?_0x17fca2[_0x5e3e('0x30')]:_0x192907[_0x5e3e('0x2d')];_0x17fca2[_0x5e3e('0x47')]=qs[_0x5e3e('0x32')](_0x22d262[_0x5e3e('0x2e')]['sort']);_0x17fca2[_0x5e3e('0x33')]=qs[_0x5e3e('0x2f')](_['pick'](_0x22d262[_0x5e3e('0x2e')],_0x192907[_0x5e3e('0x2f')]));if(_0x22d262[_0x5e3e('0x2e')]['filter']){_0x17fca2[_0x5e3e('0x33')]=_[_0x5e3e('0x35')](_0x17fca2[_0x5e3e('0x33')],{'$or':_['map'](_0x17fca2[_0x5e3e('0x30')],function(_0x55a4ae){var _0x443fbc={};_0x443fbc[_0x55a4ae]={'$like':'%'+_0x22d262[_0x5e3e('0x2e')][_0x5e3e('0x34')]+'%'};return _0x443fbc;})});}_0x17fca2=_['merge']({},_0x17fca2,_0x22d262[_0x5e3e('0x40')]);return _0x4c4c1c[_0x5e3e('0x45')](_0x17fca2);}})[_0x5e3e('0x22')](function(_0x308090){if(_0x308090){_0x468006=_0x308090[_0x5e3e('0x31')];if(!_0x22d262['query'][_0x5e3e('0x48')](_0x5e3e('0x49'))){_0x17fca2[_0x5e3e('0x1c')]=qs[_0x5e3e('0x1c')](_0x22d262[_0x5e3e('0x2e')][_0x5e3e('0x1c')]);_0x17fca2['offset']=qs[_0x5e3e('0x19')](_0x22d262['query']['offset']);}return _0x4c4c1c['getFields'](_0x17fca2);}})[_0x5e3e('0x22')](function(_0x1a30da){if(_0x1a30da){return _0x1a30da?{'count':_0x468006,'rows':_0x1a30da}:null;}})[_0x5e3e('0x22')](respondWithResult(_0x106048,null))['catch'](handleError(_0x106048,null));};exports[_0x5e3e('0x4a')]=function(_0x1ecfca,_0x46ab66,_0x51ab23){var _0x2c46dd={};var _0x2a8115={};var _0x4448c6;var _0x324044;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1ecfca[_0x5e3e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x46ab66,null))['then'](function(_0x427491){if(_0x427491){_0x4448c6=_0x427491;_0x2a8115[_0x5e3e('0x2d')]=_[_0x5e3e('0x3d')](db[_0x5e3e('0x4b')]['rawAttributes']);_0x2a8115[_0x5e3e('0x2e')]=_[_0x5e3e('0x3d')](_0x1ecfca[_0x5e3e('0x2e')]);_0x2a8115[_0x5e3e('0x2f')]=_[_0x5e3e('0x3e')](_0x2a8115[_0x5e3e('0x2d')],_0x2a8115[_0x5e3e('0x2e')]);_0x2c46dd[_0x5e3e('0x30')]=_[_0x5e3e('0x3e')](_0x2a8115[_0x5e3e('0x2d')],qs[_0x5e3e('0x3f')](_0x1ecfca[_0x5e3e('0x2e')][_0x5e3e('0x3f')]));_0x2c46dd[_0x5e3e('0x30')]=_0x2c46dd['attributes'][_0x5e3e('0x31')]?_0x2c46dd[_0x5e3e('0x30')]:_0x2a8115[_0x5e3e('0x2d')];_0x2c46dd['order']=qs[_0x5e3e('0x32')](_0x1ecfca['query'][_0x5e3e('0x32')]);_0x2c46dd['where']=qs[_0x5e3e('0x2f')](_[_0x5e3e('0x4c')](_0x1ecfca['query'],_0x2a8115[_0x5e3e('0x2f')]));if(_0x1ecfca[_0x5e3e('0x2e')]['filter']){_0x2c46dd['where']=_[_0x5e3e('0x35')](_0x2c46dd['where'],{'$or':_['map'](_0x2c46dd[_0x5e3e('0x30')],function(_0x4656a2){var _0x5dfdc3={};_0x5dfdc3[_0x4656a2]={'$like':'%'+_0x1ecfca[_0x5e3e('0x2e')]['filter']+'%'};return _0x5dfdc3;})});}_0x2c46dd=_['merge']({},_0x2c46dd,_0x1ecfca[_0x5e3e('0x40')]);return _0x4448c6[_0x5e3e('0x4a')](_0x2c46dd);}})['then'](function(_0x492ccb){if(_0x492ccb){_0x324044=_0x492ccb[_0x5e3e('0x31')];if(!_0x1ecfca['query'][_0x5e3e('0x48')](_0x5e3e('0x49'))){_0x2c46dd[_0x5e3e('0x1c')]=qs[_0x5e3e('0x1c')](_0x1ecfca[_0x5e3e('0x2e')][_0x5e3e('0x1c')]);_0x2c46dd['offset']=qs[_0x5e3e('0x19')](_0x1ecfca[_0x5e3e('0x2e')][_0x5e3e('0x19')]);}return _0x4448c6[_0x5e3e('0x4a')](_0x2c46dd);}})[_0x5e3e('0x22')](function(_0x3dd2c9){if(_0x3dd2c9){return _0x3dd2c9?{'count':_0x324044,'rows':_0x3dd2c9}:null;}})[_0x5e3e('0x22')](respondWithResult(_0x46ab66,null))[_0x5e3e('0x3a')](handleError(_0x46ab66,null));};exports['getDescriptions']=function(_0x1ee6a5,_0x4e104e,_0x41e3f7){var _0x445a56={};var _0x551831={};var _0x1ff8dd;var _0x1cfe21;return db[_0x5e3e('0x28')][_0x5e3e('0x46')]({'where':{'id':_0x1ee6a5[_0x5e3e('0x3c')]['id']}})[_0x5e3e('0x22')](handleEntityNotFound(_0x4e104e,null))[_0x5e3e('0x22')](function(_0x1e0c96){if(_0x1e0c96){_0x1ff8dd=_0x1e0c96;_0x551831[_0x5e3e('0x2d')]=_['keys'](db[_0x5e3e('0x4b')][_0x5e3e('0x29')]);_0x551831['query']=_[_0x5e3e('0x3d')](_0x1ee6a5['query']);_0x551831[_0x5e3e('0x2f')]=_[_0x5e3e('0x3e')](_0x551831[_0x5e3e('0x2d')],_0x551831['query']);_0x445a56[_0x5e3e('0x30')]=_[_0x5e3e('0x3e')](_0x551831[_0x5e3e('0x2d')],qs[_0x5e3e('0x3f')](_0x1ee6a5[_0x5e3e('0x2e')][_0x5e3e('0x3f')]));_0x445a56[_0x5e3e('0x30')]=_0x445a56[_0x5e3e('0x30')][_0x5e3e('0x31')]?_0x445a56[_0x5e3e('0x30')]:_0x551831[_0x5e3e('0x2d')];_0x445a56[_0x5e3e('0x47')]=qs[_0x5e3e('0x32')](_0x1ee6a5[_0x5e3e('0x2e')][_0x5e3e('0x32')]);_0x445a56[_0x5e3e('0x33')]=qs['filters'](_['pick'](_0x1ee6a5[_0x5e3e('0x2e')],_0x551831['filters']));if(_0x1ee6a5[_0x5e3e('0x2e')][_0x5e3e('0x34')]){_0x445a56[_0x5e3e('0x33')]=_[_0x5e3e('0x35')](_0x445a56[_0x5e3e('0x33')],{'$or':_[_0x5e3e('0x27')](_0x445a56[_0x5e3e('0x30')],function(_0x3490d2){var _0x50391d={};_0x50391d[_0x3490d2]={'$like':'%'+_0x1ee6a5[_0x5e3e('0x2e')][_0x5e3e('0x34')]+'%'};return _0x50391d;})});}_0x445a56=_[_0x5e3e('0x35')]({},_0x445a56,_0x1ee6a5[_0x5e3e('0x40')]);return _0x1ff8dd[_0x5e3e('0x4d')](_0x445a56);}})[_0x5e3e('0x22')](function(_0x5b36d0){if(_0x5b36d0){_0x1cfe21=_0x5b36d0['length'];if(!_0x1ee6a5[_0x5e3e('0x2e')][_0x5e3e('0x48')](_0x5e3e('0x49'))){_0x445a56[_0x5e3e('0x1c')]=qs['limit'](_0x1ee6a5['query'][_0x5e3e('0x1c')]);_0x445a56[_0x5e3e('0x19')]=qs[_0x5e3e('0x19')](_0x1ee6a5[_0x5e3e('0x2e')][_0x5e3e('0x19')]);}return _0x1ff8dd[_0x5e3e('0x4d')](_0x445a56);}})[_0x5e3e('0x22')](function(_0x5554fb){if(_0x5554fb){return _0x5554fb?{'count':_0x1cfe21,'rows':_0x5554fb}:null;}})[_0x5e3e('0x22')](respondWithResult(_0x4e104e,null))[_0x5e3e('0x3a')](handleError(_0x4e104e,null));}; \ No newline at end of file +var _0x436b=['bluebird','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','catch','create','body','find','getFields','findOne','nolimit','getSubjects','VtigerField','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3ab7fe,_0xaaa25){var _0x51c2a8=function(_0x3029a2){while(--_0x3029a2){_0x3ab7fe['push'](_0x3ab7fe['shift']());}};_0x51c2a8(++_0xaaa25);}(_0x436b,0x9a));var _0xb436=function(_0x24bb57,_0x4b43f4){_0x24bb57=_0x24bb57-0x0;var _0x329956=_0x436b[_0x24bb57];return _0x329956;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb436('0x0'));var zipdir=require(_0xb436('0x1'));var jsonpatch=require(_0xb436('0x2'));var rp=require(_0xb436('0x3'));var moment=require('moment');var BPromise=require(_0xb436('0x4'));var Mustache=require('mustache');var util=require(_0xb436('0x5'));var path=require(_0xb436('0x6'));var sox=require(_0xb436('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb436('0x8'));var squel=require(_0xb436('0x9'));var crypto=require(_0xb436('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb436('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb436('0xc'));var Papa=require(_0xb436('0xd'));var Redis=require(_0xb436('0xe'));var authService=require(_0xb436('0xf'));var qs=require(_0xb436('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb436('0x11'));var logger=require(_0xb436('0x12'))(_0xb436('0x13'));var utils=require(_0xb436('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb436('0x15'))['db'];function respondWithStatusCode(_0xca2e18,_0x3a373f){_0x3a373f=_0x3a373f||0xcc;return function(_0x5e2131){if(_0x5e2131){return _0xca2e18[_0xb436('0x16')](_0x3a373f);}return _0xca2e18[_0xb436('0x17')](_0x3a373f)[_0xb436('0x18')]();};}function respondWithResult(_0x2c1b56,_0x5d0654){_0x5d0654=_0x5d0654||0xc8;return function(_0x28dcf3){if(_0x28dcf3){return _0x2c1b56[_0xb436('0x17')](_0x5d0654)['json'](_0x28dcf3);}};}function respondWithFilteredResult(_0x14d5f2,_0x3a0b52){return function(_0x6ef7e0){if(_0x6ef7e0){var _0x32591e=typeof _0x3a0b52[_0xb436('0x19')]===_0xb436('0x1a')&&typeof _0x3a0b52[_0xb436('0x1b')]===_0xb436('0x1a');var _0x1d1e00=_0x6ef7e0[_0xb436('0x1c')];var _0xe5239a=_0x32591e?0x0:_0x3a0b52['offset'];var _0xbcbad0=_0x32591e?_0x6ef7e0[_0xb436('0x1c')]:_0x3a0b52['offset']+_0x3a0b52[_0xb436('0x1b')];var _0x4282ec;if(_0xbcbad0>=_0x1d1e00){_0xbcbad0=_0x1d1e00;_0x4282ec=0xc8;}else{_0x4282ec=0xce;}_0x14d5f2['status'](_0x4282ec);return _0x14d5f2[_0xb436('0x1d')](_0xb436('0x1e'),_0xe5239a+'-'+_0xbcbad0+'/'+_0x1d1e00)[_0xb436('0x1f')](_0x6ef7e0);}return null;};}function patchUpdates(_0x30fe5f){return function(_0x6e6a78){try{jsonpatch['apply'](_0x6e6a78,_0x30fe5f,!![]);}catch(_0x48c6a4){return BPromise[_0xb436('0x20')](_0x48c6a4);}return _0x6e6a78[_0xb436('0x21')]();};}function saveUpdates(_0x399a96,_0x58f407){return function(_0x2f97ea){if(_0x2f97ea){return _0x2f97ea[_0xb436('0x22')](_0x399a96)[_0xb436('0x23')](function(_0x5c9b5a){return _0x5c9b5a;});}return null;};}function removeEntity(_0x514c95,_0x1ece28){return function(_0x154a7f){if(_0x154a7f){return _0x154a7f[_0xb436('0x24')]()[_0xb436('0x23')](function(){_0x514c95[_0xb436('0x17')](0xcc)[_0xb436('0x18')]();});}};}function handleEntityNotFound(_0x4b8769,_0x4ee687){return function(_0x3a9cd7){if(!_0x3a9cd7){_0x4b8769[_0xb436('0x16')](0x194);}return _0x3a9cd7;};}function handleError(_0x4ee723,_0x92ab8e){_0x92ab8e=_0x92ab8e||0x1f4;return function(_0x2f41e0){logger[_0xb436('0x25')](_0x2f41e0['stack']);if(_0x2f41e0[_0xb436('0x26')]){delete _0x2f41e0[_0xb436('0x26')];}_0x4ee723['status'](_0x92ab8e)[_0xb436('0x27')](_0x2f41e0);};}exports[_0xb436('0x28')]=function(_0x1de4d3,_0xea6b9d){var _0x48b409={},_0x115783={},_0x17ec73={'count':0x0,'rows':[]};var _0x35ddc8=_[_0xb436('0x29')](db[_0xb436('0x2a')][_0xb436('0x2b')],function(_0x2c11a6){return{'name':_0x2c11a6[_0xb436('0x2c')],'type':_0x2c11a6[_0xb436('0x2d')][_0xb436('0x2e')]};});_0x115783[_0xb436('0x2f')]=_[_0xb436('0x29')](_0x35ddc8,_0xb436('0x26'));_0x115783['query']=_[_0xb436('0x30')](_0x1de4d3[_0xb436('0x31')]);_0x115783[_0xb436('0x32')]=_['intersection'](_0x115783[_0xb436('0x2f')],_0x115783['query']);_0x48b409[_0xb436('0x33')]=_[_0xb436('0x34')](_0x115783[_0xb436('0x2f')],qs[_0xb436('0x35')](_0x1de4d3[_0xb436('0x31')][_0xb436('0x35')]));_0x48b409[_0xb436('0x33')]=_0x48b409[_0xb436('0x33')][_0xb436('0x36')]?_0x48b409['attributes']:_0x115783[_0xb436('0x2f')];if(!_0x1de4d3[_0xb436('0x31')][_0xb436('0x37')]('nolimit')){_0x48b409[_0xb436('0x1b')]=qs[_0xb436('0x1b')](_0x1de4d3['query']['limit']);_0x48b409[_0xb436('0x19')]=qs[_0xb436('0x19')](_0x1de4d3[_0xb436('0x31')][_0xb436('0x19')]);}_0x48b409[_0xb436('0x38')]=qs[_0xb436('0x39')](_0x1de4d3[_0xb436('0x31')][_0xb436('0x39')]);_0x48b409[_0xb436('0x3a')]=qs[_0xb436('0x32')](_['pick'](_0x1de4d3[_0xb436('0x31')],_0x115783[_0xb436('0x32')]),_0x35ddc8);if(_0x1de4d3[_0xb436('0x31')]['filter']){_0x48b409['where']=_[_0xb436('0x3b')](_0x48b409['where'],{'$or':_[_0xb436('0x29')](_0x35ddc8,function(_0x399d77){if(_0x399d77[_0xb436('0x2d')]!==_0xb436('0x3c')){var _0x407495={};_0x407495[_0x399d77[_0xb436('0x26')]]={'$like':'%'+_0x1de4d3['query'][_0xb436('0x3d')]+'%'};return _0x407495;}})});}_0x48b409=_[_0xb436('0x3b')]({},_0x48b409,_0x1de4d3[_0xb436('0x3e')]);var _0x4ea2d5={'where':_0x48b409[_0xb436('0x3a')]};return db[_0xb436('0x2a')]['count'](_0x4ea2d5)[_0xb436('0x23')](function(_0x56a111){_0x17ec73[_0xb436('0x1c')]=_0x56a111;if(_0x1de4d3[_0xb436('0x31')]['includeAll']){_0x48b409[_0xb436('0x3f')]=[{'all':!![]}];}return db[_0xb436('0x2a')][_0xb436('0x40')](_0x48b409);})['then'](function(_0x5f2575){_0x17ec73[_0xb436('0x41')]=_0x5f2575;return _0x17ec73;})[_0xb436('0x23')](respondWithFilteredResult(_0xea6b9d,_0x48b409))['catch'](handleError(_0xea6b9d,null));};exports[_0xb436('0x42')]=function(_0x2b55d8,_0x250591){var _0x3236d2={'raw':![],'where':{'id':_0x2b55d8[_0xb436('0x43')]['id']}},_0x721a2b={};_0x721a2b['model']=_[_0xb436('0x30')](db['VtigerConfiguration']['rawAttributes']);_0x721a2b[_0xb436('0x31')]=_[_0xb436('0x30')](_0x2b55d8['query']);_0x721a2b['filters']=_['intersection'](_0x721a2b[_0xb436('0x2f')],_0x721a2b['query']);_0x3236d2[_0xb436('0x33')]=_[_0xb436('0x34')](_0x721a2b[_0xb436('0x2f')],qs['fields'](_0x2b55d8[_0xb436('0x31')][_0xb436('0x35')]));_0x3236d2[_0xb436('0x33')]=_0x3236d2['attributes'][_0xb436('0x36')]?_0x3236d2[_0xb436('0x33')]:_0x721a2b[_0xb436('0x2f')];if(_0x2b55d8[_0xb436('0x31')]['includeAll']){_0x3236d2[_0xb436('0x3f')]=[{'all':!![]}];}_0x3236d2=_[_0xb436('0x3b')]({},_0x3236d2,_0x2b55d8[_0xb436('0x3e')]);return db[_0xb436('0x2a')]['find'](_0x3236d2)[_0xb436('0x23')](handleEntityNotFound(_0x250591,null))[_0xb436('0x23')](respondWithResult(_0x250591,null))[_0xb436('0x44')](handleError(_0x250591,null));};exports[_0xb436('0x45')]=function(_0x63e9ab,_0x25001c){return db[_0xb436('0x2a')][_0xb436('0x45')](_0x63e9ab[_0xb436('0x46')],{})[_0xb436('0x23')](respondWithResult(_0x25001c,0xc9))['catch'](handleError(_0x25001c,null));};exports[_0xb436('0x22')]=function(_0x58ec02,_0x3f5abf){if(_0x58ec02[_0xb436('0x46')]['id']){delete _0x58ec02[_0xb436('0x46')]['id'];}return db[_0xb436('0x2a')][_0xb436('0x47')]({'where':{'id':_0x58ec02[_0xb436('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f5abf,null))[_0xb436('0x23')](saveUpdates(_0x58ec02[_0xb436('0x46')],null))[_0xb436('0x23')](respondWithResult(_0x3f5abf,null))[_0xb436('0x44')](handleError(_0x3f5abf,null));};exports[_0xb436('0x24')]=function(_0x55c0f2,_0x386fc9){return db[_0xb436('0x2a')]['find']({'where':{'id':_0x55c0f2['params']['id']}})[_0xb436('0x23')](handleEntityNotFound(_0x386fc9,null))[_0xb436('0x23')](removeEntity(_0x386fc9,null))[_0xb436('0x44')](handleError(_0x386fc9,null));};exports[_0xb436('0x48')]=function(_0x3912ae,_0x3902ac,_0x234886){var _0x51d2c5={};var _0x1cd369={};var _0x2878cf;var _0x29ba5d;return db[_0xb436('0x2a')][_0xb436('0x49')]({'where':{'id':_0x3912ae['params']['id']}})[_0xb436('0x23')](handleEntityNotFound(_0x3902ac,null))[_0xb436('0x23')](function(_0x24820b){if(_0x24820b){_0x2878cf=_0x24820b;_0x1cd369[_0xb436('0x2f')]=_[_0xb436('0x30')](db['VtigerField'][_0xb436('0x2b')]);_0x1cd369[_0xb436('0x31')]=_[_0xb436('0x30')](_0x3912ae[_0xb436('0x31')]);_0x1cd369[_0xb436('0x32')]=_[_0xb436('0x34')](_0x1cd369[_0xb436('0x2f')],_0x1cd369[_0xb436('0x31')]);_0x51d2c5[_0xb436('0x33')]=_[_0xb436('0x34')](_0x1cd369[_0xb436('0x2f')],qs[_0xb436('0x35')](_0x3912ae[_0xb436('0x31')][_0xb436('0x35')]));_0x51d2c5['attributes']=_0x51d2c5[_0xb436('0x33')][_0xb436('0x36')]?_0x51d2c5['attributes']:_0x1cd369[_0xb436('0x2f')];_0x51d2c5[_0xb436('0x38')]=qs[_0xb436('0x39')](_0x3912ae['query']['sort']);_0x51d2c5[_0xb436('0x3a')]=qs['filters'](_['pick'](_0x3912ae[_0xb436('0x31')],_0x1cd369[_0xb436('0x32')]));if(_0x3912ae[_0xb436('0x31')][_0xb436('0x3d')]){_0x51d2c5[_0xb436('0x3a')]=_['merge'](_0x51d2c5[_0xb436('0x3a')],{'$or':_[_0xb436('0x29')](_0x51d2c5[_0xb436('0x33')],function(_0x10bbe0){var _0x5e2185={};_0x5e2185[_0x10bbe0]={'$like':'%'+_0x3912ae[_0xb436('0x31')][_0xb436('0x3d')]+'%'};return _0x5e2185;})});}_0x51d2c5=_[_0xb436('0x3b')]({},_0x51d2c5,_0x3912ae['options']);return _0x2878cf[_0xb436('0x48')](_0x51d2c5);}})[_0xb436('0x23')](function(_0x3348da){if(_0x3348da){_0x29ba5d=_0x3348da['length'];if(!_0x3912ae[_0xb436('0x31')][_0xb436('0x37')](_0xb436('0x4a'))){_0x51d2c5[_0xb436('0x1b')]=qs[_0xb436('0x1b')](_0x3912ae['query']['limit']);_0x51d2c5[_0xb436('0x19')]=qs[_0xb436('0x19')](_0x3912ae[_0xb436('0x31')]['offset']);}return _0x2878cf['getFields'](_0x51d2c5);}})[_0xb436('0x23')](function(_0x2646df){if(_0x2646df){return _0x2646df?{'count':_0x29ba5d,'rows':_0x2646df}:null;}})[_0xb436('0x23')](respondWithResult(_0x3902ac,null))[_0xb436('0x44')](handleError(_0x3902ac,null));};exports[_0xb436('0x4b')]=function(_0x5602aa,_0x5d5088,_0x3e71ae){var _0x2a8722={};var _0x297349={};var _0x195429;var _0x521440;return db[_0xb436('0x2a')][_0xb436('0x49')]({'where':{'id':_0x5602aa[_0xb436('0x43')]['id']}})[_0xb436('0x23')](handleEntityNotFound(_0x5d5088,null))[_0xb436('0x23')](function(_0x42ef70){if(_0x42ef70){_0x195429=_0x42ef70;_0x297349[_0xb436('0x2f')]=_[_0xb436('0x30')](db[_0xb436('0x4c')][_0xb436('0x2b')]);_0x297349['query']=_[_0xb436('0x30')](_0x5602aa[_0xb436('0x31')]);_0x297349[_0xb436('0x32')]=_[_0xb436('0x34')](_0x297349[_0xb436('0x2f')],_0x297349[_0xb436('0x31')]);_0x2a8722[_0xb436('0x33')]=_['intersection'](_0x297349[_0xb436('0x2f')],qs['fields'](_0x5602aa[_0xb436('0x31')][_0xb436('0x35')]));_0x2a8722[_0xb436('0x33')]=_0x2a8722[_0xb436('0x33')]['length']?_0x2a8722[_0xb436('0x33')]:_0x297349[_0xb436('0x2f')];_0x2a8722[_0xb436('0x38')]=qs['sort'](_0x5602aa['query'][_0xb436('0x39')]);_0x2a8722[_0xb436('0x3a')]=qs['filters'](_[_0xb436('0x4d')](_0x5602aa[_0xb436('0x31')],_0x297349[_0xb436('0x32')]));if(_0x5602aa[_0xb436('0x31')][_0xb436('0x3d')]){_0x2a8722['where']=_[_0xb436('0x3b')](_0x2a8722[_0xb436('0x3a')],{'$or':_[_0xb436('0x29')](_0x2a8722[_0xb436('0x33')],function(_0x3e7c83){var _0x27ddce={};_0x27ddce[_0x3e7c83]={'$like':'%'+_0x5602aa['query'][_0xb436('0x3d')]+'%'};return _0x27ddce;})});}_0x2a8722=_[_0xb436('0x3b')]({},_0x2a8722,_0x5602aa[_0xb436('0x3e')]);return _0x195429['getSubjects'](_0x2a8722);}})[_0xb436('0x23')](function(_0x1ef9fa){if(_0x1ef9fa){_0x521440=_0x1ef9fa[_0xb436('0x36')];if(!_0x5602aa[_0xb436('0x31')][_0xb436('0x37')]('nolimit')){_0x2a8722[_0xb436('0x1b')]=qs[_0xb436('0x1b')](_0x5602aa[_0xb436('0x31')][_0xb436('0x1b')]);_0x2a8722[_0xb436('0x19')]=qs[_0xb436('0x19')](_0x5602aa[_0xb436('0x31')][_0xb436('0x19')]);}return _0x195429['getSubjects'](_0x2a8722);}})['then'](function(_0x1c6365){if(_0x1c6365){return _0x1c6365?{'count':_0x521440,'rows':_0x1c6365}:null;}})[_0xb436('0x23')](respondWithResult(_0x5d5088,null))[_0xb436('0x44')](handleError(_0x5d5088,null));};exports[_0xb436('0x4e')]=function(_0x344fc7,_0x1c3288,_0x26605f){var _0x3734f4={};var _0x5adee8={};var _0x1eddd7;var _0x4b2f79;return db['VtigerConfiguration'][_0xb436('0x49')]({'where':{'id':_0x344fc7['params']['id']}})[_0xb436('0x23')](handleEntityNotFound(_0x1c3288,null))[_0xb436('0x23')](function(_0x51638e){if(_0x51638e){_0x1eddd7=_0x51638e;_0x5adee8['model']=_[_0xb436('0x30')](db[_0xb436('0x4c')][_0xb436('0x2b')]);_0x5adee8[_0xb436('0x31')]=_[_0xb436('0x30')](_0x344fc7[_0xb436('0x31')]);_0x5adee8[_0xb436('0x32')]=_['intersection'](_0x5adee8[_0xb436('0x2f')],_0x5adee8[_0xb436('0x31')]);_0x3734f4[_0xb436('0x33')]=_[_0xb436('0x34')](_0x5adee8[_0xb436('0x2f')],qs[_0xb436('0x35')](_0x344fc7[_0xb436('0x31')][_0xb436('0x35')]));_0x3734f4['attributes']=_0x3734f4['attributes'][_0xb436('0x36')]?_0x3734f4[_0xb436('0x33')]:_0x5adee8['model'];_0x3734f4['order']=qs[_0xb436('0x39')](_0x344fc7[_0xb436('0x31')][_0xb436('0x39')]);_0x3734f4[_0xb436('0x3a')]=qs[_0xb436('0x32')](_[_0xb436('0x4d')](_0x344fc7['query'],_0x5adee8[_0xb436('0x32')]));if(_0x344fc7['query'][_0xb436('0x3d')]){_0x3734f4[_0xb436('0x3a')]=_[_0xb436('0x3b')](_0x3734f4[_0xb436('0x3a')],{'$or':_[_0xb436('0x29')](_0x3734f4[_0xb436('0x33')],function(_0x7021ac){var _0x4eeb39={};_0x4eeb39[_0x7021ac]={'$like':'%'+_0x344fc7[_0xb436('0x31')][_0xb436('0x3d')]+'%'};return _0x4eeb39;})});}_0x3734f4=_[_0xb436('0x3b')]({},_0x3734f4,_0x344fc7['options']);return _0x1eddd7[_0xb436('0x4e')](_0x3734f4);}})['then'](function(_0x2f3766){if(_0x2f3766){_0x4b2f79=_0x2f3766[_0xb436('0x36')];if(!_0x344fc7[_0xb436('0x31')]['hasOwnProperty']('nolimit')){_0x3734f4[_0xb436('0x1b')]=qs[_0xb436('0x1b')](_0x344fc7[_0xb436('0x31')][_0xb436('0x1b')]);_0x3734f4['offset']=qs[_0xb436('0x19')](_0x344fc7[_0xb436('0x31')]['offset']);}return _0x1eddd7[_0xb436('0x4e')](_0x3734f4);}})[_0xb436('0x23')](function(_0x1cf790){if(_0x1cf790){return _0x1cf790?{'count':_0x4b2f79,'rows':_0x1cf790}:null;}})[_0xb436('0x23')](respondWithResult(_0x1c3288,null))['catch'](handleError(_0x1c3288,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 270f180..f44550c 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 _0x157f=['define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','bluebird','path','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x157f,0x163));var _0xf157=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x157f[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xf157('0x0'));var logger=require(_0xf157('0x1'))(_0xf157('0x2'));var moment=require('moment');var BPromise=require(_0xf157('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf157('0x4'));var rimraf=require('rimraf');var config=require(_0xf157('0x5'));var attributes=require(_0xf157('0x6'));module[_0xf157('0x7')]=function(_0x3eb915,_0x5485fb){return _0x3eb915[_0xf157('0x8')](_0xf157('0x9'),attributes,{'tableName':_0xf157('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05f7=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0xcf7127,_0x29f98a){var _0x2c9c55=function(_0x1c7fa6){while(--_0x1c7fa6){_0xcf7127['push'](_0xcf7127['shift']());}};_0x2c9c55(++_0x29f98a);}(_0x05f7,0x158));var _0x705f=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x05f7[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x705f('0x0'));var util=require('util');var logger=require(_0x705f('0x1'))(_0x705f('0x2'));var moment=require(_0x705f('0x3'));var BPromise=require('bluebird');var rp=require(_0x705f('0x4'));var fs=require('fs');var path=require(_0x705f('0x5'));var rimraf=require('rimraf');var config=require(_0x705f('0x6'));var attributes=require(_0x705f('0x7'));module[_0x705f('0x8')]=function(_0x627bb5,_0x4b924b){return _0x627bb5[_0x705f('0x9')]('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 37bebc3..4a8a9db 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 _0x0ed3=['bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0x0ed3,0xf4));var _0x30ed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ed3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x30ed('0x0'));var util=require(_0x30ed('0x1'));var moment=require(_0x30ed('0x2'));var BPromise=require(_0x30ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30ed('0x4'));var db=require(_0x30ed('0x5'))['db'];var utils=require(_0x30ed('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x30ed('0x7'));var client=jayson[_0x30ed('0x8')][_0x30ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a64a4,_0x407ae8,_0x4b2555){return new BPromise(function(_0x5c5d1b,_0x4b8309){return client['request'](_0x1a64a4,_0x4b2555)[_0x30ed('0xa')](function(_0x5e6fba){logger['info'](_0x30ed('0xb'),_0x407ae8,_0x30ed('0xc'));logger['debug'](_0x30ed('0xd'),_0x407ae8,_0x30ed('0xc'),JSON[_0x30ed('0xe')](_0x5e6fba));if(_0x5e6fba[_0x30ed('0xf')]){if(_0x5e6fba[_0x30ed('0xf')]['code']===0x1f4){logger['error'](_0x30ed('0xb'),_0x407ae8,_0x5e6fba['error'][_0x30ed('0x10')]);return _0x4b8309(_0x5e6fba[_0x30ed('0xf')]['message']);}logger[_0x30ed('0xf')](_0x30ed('0xb'),_0x407ae8,_0x5e6fba[_0x30ed('0xf')]['message']);return _0x5c5d1b(_0x5e6fba[_0x30ed('0xf')][_0x30ed('0x10')]);}else{logger[_0x30ed('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x407ae8,_0x30ed('0xc'));_0x5c5d1b(_0x5e6fba['result'][_0x30ed('0x10')]);}})[_0x30ed('0x12')](function(_0x128da9){logger['error'](_0x30ed('0xb'),_0x407ae8,_0x128da9);_0x4b8309(_0x128da9);});});} \ No newline at end of file +var _0x1e05=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x1e05,0xb4));var _0x51e0=function(_0x1dd034,_0x5f5a76){_0x1dd034=_0x1dd034-0x0;var _0x4ecb48=_0x1e05[_0x1dd034];return _0x4ecb48;};'use strict';var _=require(_0x51e0('0x0'));var util=require(_0x51e0('0x1'));var moment=require(_0x51e0('0x2'));var BPromise=require(_0x51e0('0x3'));var rs=require(_0x51e0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51e0('0x5'))['db'];var utils=require(_0x51e0('0x6'));var logger=require('../../config/logger')(_0x51e0('0x7'));var config=require(_0x51e0('0x8'));var jayson=require(_0x51e0('0x9'));var client=jayson[_0x51e0('0xa')][_0x51e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5014b3,_0x828b64,_0x3331f0){return new BPromise(function(_0x59fa58,_0x2e1cb8){return client[_0x51e0('0xc')](_0x5014b3,_0x3331f0)[_0x51e0('0xd')](function(_0x30e4d2){logger[_0x51e0('0xe')](_0x51e0('0xf'),_0x828b64,_0x51e0('0x10'));logger[_0x51e0('0x11')](_0x51e0('0x12'),_0x828b64,_0x51e0('0x10'),JSON[_0x51e0('0x13')](_0x30e4d2));if(_0x30e4d2[_0x51e0('0x14')]){if(_0x30e4d2[_0x51e0('0x14')][_0x51e0('0x15')]===0x1f4){logger[_0x51e0('0x14')](_0x51e0('0xf'),_0x828b64,_0x30e4d2[_0x51e0('0x14')][_0x51e0('0x16')]);return _0x2e1cb8(_0x30e4d2[_0x51e0('0x14')][_0x51e0('0x16')]);}logger[_0x51e0('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x828b64,_0x30e4d2[_0x51e0('0x14')]['message']);return _0x59fa58(_0x30e4d2[_0x51e0('0x14')][_0x51e0('0x16')]);}else{logger['info'](_0x51e0('0xf'),_0x828b64,_0x51e0('0x10'));_0x59fa58(_0x30e4d2['result'][_0x51e0('0x16')]);}})[_0x51e0('0x17')](function(_0x96619b){logger[_0x51e0('0x14')](_0x51e0('0xf'),_0x828b64,_0x96619b);_0x2e1cb8(_0x96619b);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index a6261a9..ba64094 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 _0xd576=['./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x1a8c0c,_0x18ee77){var _0x2d46b6=function(_0xd79726){while(--_0xd79726){_0x1a8c0c['push'](_0x1a8c0c['shift']());}};_0x2d46b6(++_0x18ee77);}(_0xd576,0x15d));var _0x6d57=function(_0xe74f67,_0xc6b862){_0xe74f67=_0xe74f67-0x0;var _0x2362aa=_0xd576[_0xe74f67];return _0x2362aa;};'use strict';var multer=require(_0x6d57('0x0'));var util=require(_0x6d57('0x1'));var path=require(_0x6d57('0x2'));var timeout=require(_0x6d57('0x3'));var express=require(_0x6d57('0x4'));var router=express[_0x6d57('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d57('0x6'));var config=require(_0x6d57('0x7'));var controller=require(_0x6d57('0x8'));router[_0x6d57('0x9')]('/',auth[_0x6d57('0xa')](),controller[_0x6d57('0xb')]);router[_0x6d57('0x9')](_0x6d57('0xc'),auth[_0x6d57('0xa')](),controller[_0x6d57('0xd')]);router['post']('/',auth[_0x6d57('0xa')](),controller[_0x6d57('0xe')]);router['put'](_0x6d57('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6d57('0xf')](_0x6d57('0xc'),auth[_0x6d57('0xa')](),controller['destroy']);module[_0x6d57('0x10')]=router; \ No newline at end of file +var _0x473e=['isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x473e,0xe0));var _0xe473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x473e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe473('0x0'));var util=require(_0xe473('0x1'));var path=require(_0xe473('0x2'));var timeout=require(_0xe473('0x3'));var express=require(_0xe473('0x4'));var router=express[_0xe473('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe473('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe473('0x7'));var controller=require(_0xe473('0x8'));router[_0xe473('0x9')]('/',auth[_0xe473('0xa')](),controller['index']);router['get'](_0xe473('0xb'),auth[_0xe473('0xa')](),controller['show']);router[_0xe473('0xc')]('/',auth[_0xe473('0xa')](),controller[_0xe473('0xd')]);router['put'](_0xe473('0xb'),auth[_0xe473('0xa')](),controller[_0xe473('0xe')]);router[_0xe473('0xf')](_0xe473('0xb'),auth[_0xe473('0xa')](),controller[_0xe473('0x10')]);module[_0xe473('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4b70c2e..c16a81c 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 _0xeb83=['keyValue','picklist','STRING','customVariable','ENUM','string','variable'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xeb83,0x13f));var _0x3eb8=function(_0x435cc0,_0x2e33f6){_0x435cc0=_0x435cc0-0x0;var _0x2c6436=_0xeb83[_0x435cc0];return _0x2c6436;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3eb8('0x0')](_0x3eb8('0x1'),_0x3eb8('0x2'),'customVariable',_0x3eb8('0x3'),_0x3eb8('0x4')),'defaultValue':_0x3eb8('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3eb8('0x5')]},'keyType':{'type':Sequelize[_0x3eb8('0x0')](_0x3eb8('0x1'),'variable',_0x3eb8('0x6'))},'keyContent':{'type':Sequelize[_0x3eb8('0x5')]},'idField':{'type':Sequelize[_0x3eb8('0x5')]},'nameField':{'type':Sequelize[_0x3eb8('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2541=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x2541,0x1e0));var _0x1254=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2541[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1254('0x0'));module[_0x1254('0x1')]={'type':{'type':Sequelize[_0x1254('0x2')](_0x1254('0x3'),_0x1254('0x4'),_0x1254('0x5'),'keyValue',_0x1254('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1254('0x7')]},'key':{'type':Sequelize[_0x1254('0x7')]},'keyType':{'type':Sequelize[_0x1254('0x2')](_0x1254('0x3'),_0x1254('0x4'),_0x1254('0x5'))},'keyContent':{'type':Sequelize[_0x1254('0x7')]},'idField':{'type':Sequelize[_0x1254('0x7')]},'nameField':{'type':Sequelize[_0x1254('0x7')]},'customField':{'type':Sequelize[_0x1254('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1254('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f54c960..7926aed 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 _0x13d2=['VtigerField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','rawAttributes','length','includeAll','options','find','create','body','params','eml-format','rimraf','request-promise','bluebird','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map'];(function(_0x34c212,_0x193e10){var _0x364c89=function(_0x5dc05b){while(--_0x5dc05b){_0x34c212['push'](_0x34c212['shift']());}};_0x364c89(++_0x193e10);}(_0x13d2,0x66));var _0x213d=function(_0x55b99c,_0x5104a1){_0x55b99c=_0x55b99c-0x0;var _0xedf637=_0x13d2[_0x55b99c];return _0xedf637;};'use strict';var emlformat=require(_0x213d('0x0'));var rimraf=require(_0x213d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x213d('0x2'));var moment=require('moment');var BPromise=require(_0x213d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x213d('0x4'));var sox=require(_0x213d('0x5'));var csv=require(_0x213d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x213d('0x7'));var squel=require('squel');var crypto=require(_0x213d('0x8'));var jsforce=require(_0x213d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x213d('0x6'));var querystring=require('querystring');var Papa=require(_0x213d('0xa'));var Redis=require(_0x213d('0xb'));var authService=require(_0x213d('0xc'));var qs=require(_0x213d('0xd'));var as=require(_0x213d('0xe'));var hardwareService=require(_0x213d('0xf'));var logger=require(_0x213d('0x10'))(_0x213d('0x11'));var utils=require(_0x213d('0x12'));var config=require(_0x213d('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44e5a3,_0x18d3a6){_0x18d3a6=_0x18d3a6||0xcc;return function(_0x278cb1){if(_0x278cb1){return _0x44e5a3['sendStatus'](_0x18d3a6);}return _0x44e5a3[_0x213d('0x14')](_0x18d3a6)[_0x213d('0x15')]();};}function respondWithResult(_0x8d9059,_0x328edd){_0x328edd=_0x328edd||0xc8;return function(_0x12e84e){if(_0x12e84e){return _0x8d9059['status'](_0x328edd)['json'](_0x12e84e);}};}function respondWithFilteredResult(_0x37e0a9,_0x54fabd){return function(_0x4fd081){if(_0x4fd081){var _0x25bde5=typeof _0x54fabd[_0x213d('0x16')]===_0x213d('0x17')&&typeof _0x54fabd['limit']==='undefined';var _0x228a5d=_0x4fd081[_0x213d('0x18')];var _0x44ff92=_0x25bde5?0x0:_0x54fabd[_0x213d('0x16')];var _0x3c74ad=_0x25bde5?_0x4fd081['count']:_0x54fabd['offset']+_0x54fabd[_0x213d('0x19')];var _0x310be9;if(_0x3c74ad>=_0x228a5d){_0x3c74ad=_0x228a5d;_0x310be9=0xc8;}else{_0x310be9=0xce;}_0x37e0a9[_0x213d('0x14')](_0x310be9);return _0x37e0a9[_0x213d('0x1a')](_0x213d('0x1b'),_0x44ff92+'-'+_0x3c74ad+'/'+_0x228a5d)[_0x213d('0x1c')](_0x4fd081);}return null;};}function patchUpdates(_0x17db09){return function(_0x5d176e){try{jsonpatch[_0x213d('0x1d')](_0x5d176e,_0x17db09,!![]);}catch(_0xec9ce9){return BPromise[_0x213d('0x1e')](_0xec9ce9);}return _0x5d176e[_0x213d('0x1f')]();};}function saveUpdates(_0x5a59e6,_0x3c78af){return function(_0x3a5607){if(_0x3a5607){return _0x3a5607[_0x213d('0x20')](_0x5a59e6)[_0x213d('0x21')](function(_0x1e11e1){return _0x1e11e1;});}return null;};}function removeEntity(_0x31e41e,_0x2120d6){return function(_0x29e198){if(_0x29e198){return _0x29e198[_0x213d('0x22')]()[_0x213d('0x21')](function(){_0x31e41e[_0x213d('0x14')](0xcc)[_0x213d('0x15')]();});}};}function handleEntityNotFound(_0x41ddd7,_0x18e32d){return function(_0x34699b){if(!_0x34699b){_0x41ddd7[_0x213d('0x23')](0x194);}return _0x34699b;};}function handleError(_0x15e5cf,_0x46e1ca){_0x46e1ca=_0x46e1ca||0x1f4;return function(_0x2ca70b){logger['error'](_0x2ca70b['stack']);if(_0x2ca70b[_0x213d('0x24')]){delete _0x2ca70b[_0x213d('0x24')];}_0x15e5cf['status'](_0x46e1ca)[_0x213d('0x25')](_0x2ca70b);};}exports[_0x213d('0x26')]=function(_0xcee169,_0xb077bd){var _0x444053={},_0x52ef6f={},_0x5a9b35={'count':0x0,'rows':[]};var _0x33ead2=_[_0x213d('0x27')](db[_0x213d('0x28')]['rawAttributes'],function(_0x37a9bc){return{'name':_0x37a9bc[_0x213d('0x29')],'type':_0x37a9bc[_0x213d('0x2a')]['key']};});_0x52ef6f[_0x213d('0x2b')]=_[_0x213d('0x27')](_0x33ead2,_0x213d('0x24'));_0x52ef6f[_0x213d('0x2c')]=_[_0x213d('0x2d')](_0xcee169['query']);_0x52ef6f[_0x213d('0x2e')]=_[_0x213d('0x2f')](_0x52ef6f['model'],_0x52ef6f['query']);_0x444053[_0x213d('0x30')]=_[_0x213d('0x2f')](_0x52ef6f['model'],qs['fields'](_0xcee169[_0x213d('0x2c')][_0x213d('0x31')]));_0x444053[_0x213d('0x30')]=_0x444053[_0x213d('0x30')]['length']?_0x444053['attributes']:_0x52ef6f[_0x213d('0x2b')];if(!_0xcee169[_0x213d('0x2c')][_0x213d('0x32')](_0x213d('0x33'))){_0x444053[_0x213d('0x19')]=qs[_0x213d('0x19')](_0xcee169[_0x213d('0x2c')]['limit']);_0x444053[_0x213d('0x16')]=qs[_0x213d('0x16')](_0xcee169[_0x213d('0x2c')][_0x213d('0x16')]);}_0x444053[_0x213d('0x34')]=qs[_0x213d('0x35')](_0xcee169[_0x213d('0x2c')]['sort']);_0x444053[_0x213d('0x36')]=qs[_0x213d('0x2e')](_[_0x213d('0x37')](_0xcee169[_0x213d('0x2c')],_0x52ef6f[_0x213d('0x2e')]),_0x33ead2);if(_0xcee169[_0x213d('0x2c')][_0x213d('0x38')]){_0x444053[_0x213d('0x36')]=_['merge'](_0x444053[_0x213d('0x36')],{'$or':_['map'](_0x33ead2,function(_0x41e90d){if(_0x41e90d[_0x213d('0x2a')]!==_0x213d('0x39')){var _0x2af52a={};_0x2af52a[_0x41e90d['name']]={'$like':'%'+_0xcee169[_0x213d('0x2c')][_0x213d('0x38')]+'%'};return _0x2af52a;}})});}_0x444053=_[_0x213d('0x3a')]({},_0x444053,_0xcee169['options']);var _0x4d353d={'where':_0x444053[_0x213d('0x36')]};return db[_0x213d('0x28')][_0x213d('0x18')](_0x4d353d)[_0x213d('0x21')](function(_0x4d5569){_0x5a9b35[_0x213d('0x18')]=_0x4d5569;if(_0xcee169[_0x213d('0x2c')]['includeAll']){_0x444053[_0x213d('0x3b')]=[{'all':!![]}];}return db[_0x213d('0x28')][_0x213d('0x3c')](_0x444053);})[_0x213d('0x21')](function(_0x18175c){_0x5a9b35[_0x213d('0x3d')]=_0x18175c;return _0x5a9b35;})['then'](respondWithFilteredResult(_0xb077bd,_0x444053))[_0x213d('0x3e')](handleError(_0xb077bd,null));};exports['show']=function(_0x141943,_0x2354f0){var _0x2cc568={'raw':!![],'where':{'id':_0x141943['params']['id']}},_0x45b300={};_0x45b300[_0x213d('0x2b')]=_[_0x213d('0x2d')](db[_0x213d('0x28')][_0x213d('0x3f')]);_0x45b300[_0x213d('0x2c')]=_[_0x213d('0x2d')](_0x141943[_0x213d('0x2c')]);_0x45b300[_0x213d('0x2e')]=_[_0x213d('0x2f')](_0x45b300[_0x213d('0x2b')],_0x45b300[_0x213d('0x2c')]);_0x2cc568['attributes']=_['intersection'](_0x45b300[_0x213d('0x2b')],qs[_0x213d('0x31')](_0x141943[_0x213d('0x2c')]['fields']));_0x2cc568[_0x213d('0x30')]=_0x2cc568[_0x213d('0x30')][_0x213d('0x40')]?_0x2cc568[_0x213d('0x30')]:_0x45b300['model'];if(_0x141943[_0x213d('0x2c')][_0x213d('0x41')]){_0x2cc568['include']=[{'all':!![]}];}_0x2cc568=_[_0x213d('0x3a')]({},_0x2cc568,_0x141943[_0x213d('0x42')]);return db[_0x213d('0x28')][_0x213d('0x43')](_0x2cc568)[_0x213d('0x21')](handleEntityNotFound(_0x2354f0,null))[_0x213d('0x21')](respondWithResult(_0x2354f0,null))[_0x213d('0x3e')](handleError(_0x2354f0,null));};exports[_0x213d('0x44')]=function(_0x2c04d4,_0x4149bd){return db['VtigerField'][_0x213d('0x44')](_0x2c04d4[_0x213d('0x45')],{})[_0x213d('0x21')](respondWithResult(_0x4149bd,0xc9))[_0x213d('0x3e')](handleError(_0x4149bd,null));};exports['update']=function(_0x2e5d6a,_0x4a95ea){if(_0x2e5d6a['body']['id']){delete _0x2e5d6a[_0x213d('0x45')]['id'];}return db['VtigerField'][_0x213d('0x43')]({'where':{'id':_0x2e5d6a[_0x213d('0x46')]['id']}})[_0x213d('0x21')](handleEntityNotFound(_0x4a95ea,null))[_0x213d('0x21')](saveUpdates(_0x2e5d6a[_0x213d('0x45')],null))[_0x213d('0x21')](respondWithResult(_0x4a95ea,null))['catch'](handleError(_0x4a95ea,null));};exports[_0x213d('0x22')]=function(_0x116acb,_0x4acdbc){return db['VtigerField'][_0x213d('0x43')]({'where':{'id':_0x116acb[_0x213d('0x46')]['id']}})[_0x213d('0x21')](handleEntityNotFound(_0x4acdbc,null))[_0x213d('0x21')](removeEntity(_0x4acdbc,null))['catch'](handleError(_0x4acdbc,null));}; \ No newline at end of file +var _0x4ed7=['index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x368a21,_0x3f60cb){var _0x4007d5=function(_0x1647f2){while(--_0x1647f2){_0x368a21['push'](_0x368a21['shift']());}};_0x4007d5(++_0x3f60cb);}(_0x4ed7,0x19d));var _0x74ed=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x4ed7[_0x2cd1fb];return _0x48fd2b;};'use strict';var emlformat=require(_0x74ed('0x0'));var rimraf=require(_0x74ed('0x1'));var zipdir=require(_0x74ed('0x2'));var jsonpatch=require(_0x74ed('0x3'));var rp=require(_0x74ed('0x4'));var moment=require(_0x74ed('0x5'));var BPromise=require(_0x74ed('0x6'));var Mustache=require('mustache');var util=require(_0x74ed('0x7'));var path=require(_0x74ed('0x8'));var sox=require(_0x74ed('0x9'));var csv=require(_0x74ed('0xa'));var ejs=require(_0x74ed('0xb'));var fs=require('fs');var fs_extra=require(_0x74ed('0xc'));var _=require('lodash');var squel=require(_0x74ed('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x74ed('0xe'));var toCsv=require(_0x74ed('0xa'));var querystring=require(_0x74ed('0xf'));var Papa=require('papaparse');var Redis=require(_0x74ed('0x10'));var authService=require(_0x74ed('0x11'));var qs=require(_0x74ed('0x12'));var as=require(_0x74ed('0x13'));var hardwareService=require(_0x74ed('0x14'));var logger=require('../../config/logger')(_0x74ed('0x15'));var utils=require('../../config/utils');var config=require(_0x74ed('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x74ed('0x17'))['db'];function respondWithStatusCode(_0x268f08,_0x3aaddb){_0x3aaddb=_0x3aaddb||0xcc;return function(_0x100935){if(_0x100935){return _0x268f08['sendStatus'](_0x3aaddb);}return _0x268f08[_0x74ed('0x18')](_0x3aaddb)[_0x74ed('0x19')]();};}function respondWithResult(_0x3b39e3,_0x5dbe9f){_0x5dbe9f=_0x5dbe9f||0xc8;return function(_0x14de29){if(_0x14de29){return _0x3b39e3[_0x74ed('0x18')](_0x5dbe9f)['json'](_0x14de29);}};}function respondWithFilteredResult(_0x527137,_0x484dac){return function(_0x30a3f7){if(_0x30a3f7){var _0x442494=typeof _0x484dac[_0x74ed('0x1a')]===_0x74ed('0x1b')&&typeof _0x484dac[_0x74ed('0x1c')]===_0x74ed('0x1b');var _0x49e18a=_0x30a3f7[_0x74ed('0x1d')];var _0x5f8587=_0x442494?0x0:_0x484dac[_0x74ed('0x1a')];var _0x50cf52=_0x442494?_0x30a3f7['count']:_0x484dac[_0x74ed('0x1a')]+_0x484dac[_0x74ed('0x1c')];var _0x1e6ce3;if(_0x50cf52>=_0x49e18a){_0x50cf52=_0x49e18a;_0x1e6ce3=0xc8;}else{_0x1e6ce3=0xce;}_0x527137[_0x74ed('0x18')](_0x1e6ce3);return _0x527137[_0x74ed('0x1e')](_0x74ed('0x1f'),_0x5f8587+'-'+_0x50cf52+'/'+_0x49e18a)['json'](_0x30a3f7);}return null;};}function patchUpdates(_0x24b589){return function(_0x50d09d){try{jsonpatch[_0x74ed('0x20')](_0x50d09d,_0x24b589,!![]);}catch(_0x5661fb){return BPromise[_0x74ed('0x21')](_0x5661fb);}return _0x50d09d[_0x74ed('0x22')]();};}function saveUpdates(_0x338612,_0x5aee2d){return function(_0x397295){if(_0x397295){return _0x397295[_0x74ed('0x23')](_0x338612)[_0x74ed('0x24')](function(_0xb5eab8){return _0xb5eab8;});}return null;};}function removeEntity(_0x55fb6a,_0x16ee17){return function(_0x86e7d){if(_0x86e7d){return _0x86e7d[_0x74ed('0x25')]()['then'](function(){_0x55fb6a['status'](0xcc)[_0x74ed('0x19')]();});}};}function handleEntityNotFound(_0x463f3b,_0x3afd1b){return function(_0x2eb294){if(!_0x2eb294){_0x463f3b[_0x74ed('0x26')](0x194);}return _0x2eb294;};}function handleError(_0x37ac27,_0xee5425){_0xee5425=_0xee5425||0x1f4;return function(_0x25b9b9){logger[_0x74ed('0x27')](_0x25b9b9[_0x74ed('0x28')]);if(_0x25b9b9[_0x74ed('0x29')]){delete _0x25b9b9[_0x74ed('0x29')];}_0x37ac27[_0x74ed('0x18')](_0xee5425)[_0x74ed('0x2a')](_0x25b9b9);};}exports[_0x74ed('0x2b')]=function(_0x51018b,_0xfbc666){var _0x1d1559={},_0x1782cc={},_0x2e08c1={'count':0x0,'rows':[]};var _0x3d36e1=_[_0x74ed('0x2c')](db[_0x74ed('0x2d')][_0x74ed('0x2e')],function(_0x716cf7){return{'name':_0x716cf7[_0x74ed('0x2f')],'type':_0x716cf7[_0x74ed('0x30')][_0x74ed('0x31')]};});_0x1782cc[_0x74ed('0x32')]=_[_0x74ed('0x2c')](_0x3d36e1,_0x74ed('0x29'));_0x1782cc[_0x74ed('0x33')]=_[_0x74ed('0x34')](_0x51018b[_0x74ed('0x33')]);_0x1782cc[_0x74ed('0x35')]=_['intersection'](_0x1782cc[_0x74ed('0x32')],_0x1782cc[_0x74ed('0x33')]);_0x1d1559['attributes']=_[_0x74ed('0x36')](_0x1782cc['model'],qs['fields'](_0x51018b[_0x74ed('0x33')][_0x74ed('0x37')]));_0x1d1559[_0x74ed('0x38')]=_0x1d1559['attributes'][_0x74ed('0x39')]?_0x1d1559['attributes']:_0x1782cc[_0x74ed('0x32')];if(!_0x51018b['query']['hasOwnProperty'](_0x74ed('0x3a'))){_0x1d1559['limit']=qs[_0x74ed('0x1c')](_0x51018b['query'][_0x74ed('0x1c')]);_0x1d1559[_0x74ed('0x1a')]=qs[_0x74ed('0x1a')](_0x51018b[_0x74ed('0x33')][_0x74ed('0x1a')]);}_0x1d1559[_0x74ed('0x3b')]=qs[_0x74ed('0x3c')](_0x51018b[_0x74ed('0x33')][_0x74ed('0x3c')]);_0x1d1559[_0x74ed('0x3d')]=qs[_0x74ed('0x35')](_[_0x74ed('0x3e')](_0x51018b[_0x74ed('0x33')],_0x1782cc[_0x74ed('0x35')]),_0x3d36e1);if(_0x51018b[_0x74ed('0x33')][_0x74ed('0x3f')]){_0x1d1559[_0x74ed('0x3d')]=_[_0x74ed('0x40')](_0x1d1559[_0x74ed('0x3d')],{'$or':_[_0x74ed('0x2c')](_0x3d36e1,function(_0x594c24){if(_0x594c24[_0x74ed('0x30')]!=='VIRTUAL'){var _0x4d7147={};_0x4d7147[_0x594c24['name']]={'$like':'%'+_0x51018b[_0x74ed('0x33')][_0x74ed('0x3f')]+'%'};return _0x4d7147;}})});}_0x1d1559=_[_0x74ed('0x40')]({},_0x1d1559,_0x51018b[_0x74ed('0x41')]);var _0x51998a={'where':_0x1d1559[_0x74ed('0x3d')]};return db[_0x74ed('0x2d')]['count'](_0x51998a)[_0x74ed('0x24')](function(_0x9a9e17){_0x2e08c1[_0x74ed('0x1d')]=_0x9a9e17;if(_0x51018b[_0x74ed('0x33')][_0x74ed('0x42')]){_0x1d1559[_0x74ed('0x43')]=[{'all':!![]}];}return db[_0x74ed('0x2d')][_0x74ed('0x44')](_0x1d1559);})[_0x74ed('0x24')](function(_0x4f5893){_0x2e08c1[_0x74ed('0x45')]=_0x4f5893;return _0x2e08c1;})[_0x74ed('0x24')](respondWithFilteredResult(_0xfbc666,_0x1d1559))[_0x74ed('0x46')](handleError(_0xfbc666,null));};exports[_0x74ed('0x47')]=function(_0x3827fb,_0x3e42d6){var _0x9d3d0c={'raw':!![],'where':{'id':_0x3827fb['params']['id']}},_0x875658={};_0x875658['model']=_[_0x74ed('0x34')](db[_0x74ed('0x2d')][_0x74ed('0x2e')]);_0x875658['query']=_[_0x74ed('0x34')](_0x3827fb[_0x74ed('0x33')]);_0x875658[_0x74ed('0x35')]=_[_0x74ed('0x36')](_0x875658[_0x74ed('0x32')],_0x875658[_0x74ed('0x33')]);_0x9d3d0c[_0x74ed('0x38')]=_[_0x74ed('0x36')](_0x875658['model'],qs['fields'](_0x3827fb['query']['fields']));_0x9d3d0c[_0x74ed('0x38')]=_0x9d3d0c[_0x74ed('0x38')]['length']?_0x9d3d0c['attributes']:_0x875658[_0x74ed('0x32')];if(_0x3827fb[_0x74ed('0x33')]['includeAll']){_0x9d3d0c[_0x74ed('0x43')]=[{'all':!![]}];}_0x9d3d0c=_[_0x74ed('0x40')]({},_0x9d3d0c,_0x3827fb[_0x74ed('0x41')]);return db['VtigerField'][_0x74ed('0x48')](_0x9d3d0c)['then'](handleEntityNotFound(_0x3e42d6,null))[_0x74ed('0x24')](respondWithResult(_0x3e42d6,null))[_0x74ed('0x46')](handleError(_0x3e42d6,null));};exports[_0x74ed('0x49')]=function(_0xd2602e,_0xff8e41){return db[_0x74ed('0x2d')]['create'](_0xd2602e[_0x74ed('0x4a')],{})[_0x74ed('0x24')](respondWithResult(_0xff8e41,0xc9))[_0x74ed('0x46')](handleError(_0xff8e41,null));};exports[_0x74ed('0x23')]=function(_0x2c454d,_0x358089){if(_0x2c454d[_0x74ed('0x4a')]['id']){delete _0x2c454d[_0x74ed('0x4a')]['id'];}return db[_0x74ed('0x2d')]['find']({'where':{'id':_0x2c454d[_0x74ed('0x4b')]['id']}})['then'](handleEntityNotFound(_0x358089,null))[_0x74ed('0x24')](saveUpdates(_0x2c454d['body'],null))[_0x74ed('0x24')](respondWithResult(_0x358089,null))[_0x74ed('0x46')](handleError(_0x358089,null));};exports[_0x74ed('0x25')]=function(_0x37a92b,_0x519ae9){return db[_0x74ed('0x2d')]['find']({'where':{'id':_0x37a92b['params']['id']}})[_0x74ed('0x24')](handleEntityNotFound(_0x519ae9,null))[_0x74ed('0x24')](removeEntity(_0x519ae9,null))[_0x74ed('0x46')](handleError(_0x519ae9,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index eadfbb2..7df4806 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 _0xadec=['api','bluebird','request-promise','rimraf','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','util','../../config/logger'];(function(_0x4db4f9,_0x1d3281){var _0x4709d3=function(_0x25176f){while(--_0x25176f){_0x4db4f9['push'](_0x4db4f9['shift']());}};_0x4709d3(++_0x1d3281);}(_0xadec,0x14e));var _0xcade=function(_0x12fe83,_0x11801f){_0x12fe83=_0x12fe83-0x0;var _0x55437e=_0xadec[_0x12fe83];return _0x55437e;};'use strict';var _=require('lodash');var util=require(_0xcade('0x0'));var logger=require(_0xcade('0x1'))(_0xcade('0x2'));var moment=require('moment');var BPromise=require(_0xcade('0x3'));var rp=require(_0xcade('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcade('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0xcade('0x6')]=function(_0x41bd38,_0x42c39a){return _0x41bd38[_0xcade('0x7')](_0xcade('0x8'),attributes,{'tableName':_0xcade('0x9'),'paranoid':![],'indexes':[{'name':_0xcade('0xa'),'fields':[_0xcade('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c33=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x389637,_0x121e2c){var _0x29f8ae=function(_0x3d2bc0){while(--_0x3d2bc0){_0x389637['push'](_0x389637['shift']());}};_0x29f8ae(++_0x121e2c);}(_0x1c33,0x81));var _0x31c3=function(_0x171920,_0x4c0ff0){_0x171920=_0x171920-0x0;var _0x4c9042=_0x1c33[_0x171920];return _0x4c9042;};'use strict';var _=require(_0x31c3('0x0'));var util=require(_0x31c3('0x1'));var logger=require(_0x31c3('0x2'))(_0x31c3('0x3'));var moment=require(_0x31c3('0x4'));var BPromise=require(_0x31c3('0x5'));var rp=require(_0x31c3('0x6'));var fs=require('fs');var path=require(_0x31c3('0x7'));var rimraf=require(_0x31c3('0x8'));var config=require(_0x31c3('0x9'));var attributes=require('./intVtigerField.attributes');module[_0x31c3('0xa')]=function(_0x2cff2e,_0xbf02cb){return _0x2cff2e[_0x31c3('0xb')](_0x31c3('0xc'),attributes,{'tableName':_0x31c3('0xd'),'paranoid':![],'indexes':[{'name':_0x31c3('0xe'),'fields':[_0x31c3('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 605b52c..d1976a6 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 _0x3dfa=['then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VtigerField,\x20%s,\x20%s','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x1c9d86,_0x25d647){var _0x26254b=function(_0x578c8c){while(--_0x578c8c){_0x1c9d86['push'](_0x1c9d86['shift']());}};_0x26254b(++_0x25d647);}(_0x3dfa,0x114));var _0xa3df=function(_0x6300b9,_0x505f70){_0x6300b9=_0x6300b9-0x0;var _0x43658f=_0x3dfa[_0x6300b9];return _0x43658f;};'use strict';var _=require(_0xa3df('0x0'));var util=require(_0xa3df('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa3df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3df('0x3'))['db'];var utils=require(_0xa3df('0x4'));var logger=require(_0xa3df('0x5'))(_0xa3df('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3df('0x7')][_0xa3df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b1622,_0x1b9ae5,_0x2575c8){return new BPromise(function(_0x281781,_0x556f86){return client[_0xa3df('0x9')](_0x1b1622,_0x2575c8)[_0xa3df('0xa')](function(_0x2a02a2){logger[_0xa3df('0xb')]('VtigerField,\x20%s,\x20%s',_0x1b9ae5,_0xa3df('0xc'));logger[_0xa3df('0xd')](_0xa3df('0xe'),_0x1b9ae5,_0xa3df('0xc'),JSON[_0xa3df('0xf')](_0x2a02a2));if(_0x2a02a2[_0xa3df('0x10')]){if(_0x2a02a2['error'][_0xa3df('0x11')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x1b9ae5,_0x2a02a2['error'][_0xa3df('0x12')]);return _0x556f86(_0x2a02a2[_0xa3df('0x10')][_0xa3df('0x12')]);}logger[_0xa3df('0x10')]('VtigerField,\x20%s,\x20%s',_0x1b9ae5,_0x2a02a2[_0xa3df('0x10')]['message']);return _0x281781(_0x2a02a2[_0xa3df('0x10')][_0xa3df('0x12')]);}else{logger[_0xa3df('0xb')]('VtigerField,\x20%s,\x20%s',_0x1b9ae5,'request\x20sent');_0x281781(_0x2a02a2[_0xa3df('0x13')]['message']);}})[_0xa3df('0x14')](function(_0x83baee){logger[_0xa3df('0x10')](_0xa3df('0x15'),_0x1b9ae5,_0x83baee);_0x556f86(_0x83baee);});});} \ No newline at end of file +var _0x3efa=['request\x20sent','debug','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x3f9ebc,_0x3ec902){var _0x36858e=function(_0x40d20e){while(--_0x40d20e){_0x3f9ebc['push'](_0x3f9ebc['shift']());}};_0x36858e(++_0x3ec902);}(_0x3efa,0xab));var _0xa3ef=function(_0x94756f,_0x2a3c19){_0x94756f=_0x94756f-0x0;var _0x1e90f7=_0x3efa[_0x94756f];return _0x1e90f7;};'use strict';var _=require(_0xa3ef('0x0'));var util=require(_0xa3ef('0x1'));var moment=require('moment');var BPromise=require(_0xa3ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3ef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3ef('0x4'))('rpc');var config=require(_0xa3ef('0x5'));var jayson=require(_0xa3ef('0x6'));var client=jayson[_0xa3ef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x835471,_0x1bf644,_0x491eb8){return new BPromise(function(_0x2509ab,_0x15a8b0){return client['request'](_0x835471,_0x491eb8)[_0xa3ef('0x8')](function(_0x1cdcc4){logger['info']('VtigerField,\x20%s,\x20%s',_0x1bf644,_0xa3ef('0x9'));logger[_0xa3ef('0xa')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1bf644,_0xa3ef('0x9'),JSON[_0xa3ef('0xb')](_0x1cdcc4));if(_0x1cdcc4[_0xa3ef('0xc')]){if(_0x1cdcc4['error'][_0xa3ef('0xd')]===0x1f4){logger[_0xa3ef('0xc')](_0xa3ef('0xe'),_0x1bf644,_0x1cdcc4[_0xa3ef('0xc')][_0xa3ef('0xf')]);return _0x15a8b0(_0x1cdcc4[_0xa3ef('0xc')][_0xa3ef('0xf')]);}logger[_0xa3ef('0xc')](_0xa3ef('0xe'),_0x1bf644,_0x1cdcc4[_0xa3ef('0xc')][_0xa3ef('0xf')]);return _0x2509ab(_0x1cdcc4[_0xa3ef('0xc')][_0xa3ef('0xf')]);}else{logger[_0xa3ef('0x10')](_0xa3ef('0xe'),_0x1bf644,_0xa3ef('0x9'));_0x2509ab(_0x1cdcc4[_0xa3ef('0x11')]['message']);}})['catch'](function(_0x1efb7b){logger[_0xa3ef('0xc')]('VtigerField,\x20%s,\x20%s',_0x1bf644,_0x1efb7b);_0x15a8b0(_0x1efb7b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index fb54dae..6f31745 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 _0x9aed=['get','/:id','show','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','path','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0x9aed,0x9c));var _0xd9ae=function(_0x2b0989,_0x5422a9){_0x2b0989=_0x2b0989-0x0;var _0x133450=_0x9aed[_0x2b0989];return _0x133450;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd9ae('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd9ae('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd9ae('0x2'));var config=require(_0xd9ae('0x3'));var controller=require(_0xd9ae('0x4'));router['get']('/',auth[_0xd9ae('0x5')](),controller['index']);router[_0xd9ae('0x6')](_0xd9ae('0x7'),auth[_0xd9ae('0x5')](),controller[_0xd9ae('0x8')]);router[_0xd9ae('0x6')]('/:id/configurations',auth[_0xd9ae('0x5')](),controller[_0xd9ae('0x9')]);router[_0xd9ae('0x6')](_0xd9ae('0xa'),auth[_0xd9ae('0x5')](),controller['getFields']);router[_0xd9ae('0xb')]('/',auth[_0xd9ae('0x5')](),controller[_0xd9ae('0xc')]);router[_0xd9ae('0xb')]('/:id/configurations',auth[_0xd9ae('0x5')](),controller[_0xd9ae('0xd')]);router[_0xd9ae('0xe')]('/:id',auth[_0xd9ae('0x5')](),controller[_0xd9ae('0xf')]);router[_0xd9ae('0x10')]('/:id',auth[_0xd9ae('0x5')](),controller['destroy']);module[_0xd9ae('0x11')]=router; \ No newline at end of file +var _0x9552=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e42ae,_0x199bcc){var _0x1fde53=function(_0x1f23df){while(--_0x1f23df){_0x3e42ae['push'](_0x3e42ae['shift']());}};_0x1fde53(++_0x199bcc);}(_0x9552,0xea));var _0x2955=function(_0x53518a,_0x1311df){_0x53518a=_0x53518a-0x0;var _0x18c5f0=_0x9552[_0x53518a];return _0x18c5f0;};'use strict';var multer=require(_0x2955('0x0'));var util=require(_0x2955('0x1'));var path=require(_0x2955('0x2'));var timeout=require('connect-timeout');var express=require(_0x2955('0x3'));var router=express[_0x2955('0x4')]();var fs_extra=require(_0x2955('0x5'));var auth=require(_0x2955('0x6'));var interaction=require(_0x2955('0x7'));var config=require(_0x2955('0x8'));var controller=require(_0x2955('0x9'));router[_0x2955('0xa')]('/',auth[_0x2955('0xb')](),controller['index']);router[_0x2955('0xa')](_0x2955('0xc'),auth[_0x2955('0xb')](),controller[_0x2955('0xd')]);router['get'](_0x2955('0xe'),auth[_0x2955('0xb')](),controller[_0x2955('0xf')]);router[_0x2955('0xa')]('/:id/fields',auth[_0x2955('0xb')](),controller['getFields']);router[_0x2955('0x10')]('/',auth[_0x2955('0xb')](),controller['create']);router[_0x2955('0x10')]('/:id/configurations',auth[_0x2955('0xb')](),controller[_0x2955('0x11')]);router[_0x2955('0x12')](_0x2955('0xc'),auth[_0x2955('0xb')](),controller['update']);router[_0x2955('0x13')](_0x2955('0xc'),auth['isAuthenticated'](),controller[_0x2955('0x14')]);module[_0x2955('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 3ecd554..ec58474 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 _0x8b52=['ENUM','password','token','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x165690,_0x2aab72){var _0x9eea67=function(_0x1f3346){while(--_0x1f3346){_0x165690['push'](_0x165690['shift']());}};_0x9eea67(++_0x2aab72);}(_0x8b52,0x151));var _0x28b5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8b52[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x28b5('0x0'));module[_0x28b5('0x1')]={'name':{'type':Sequelize[_0x28b5('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x28b5('0x2')],'unique':_0x28b5('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x28b5('0x2')]},'remoteUri':{'type':Sequelize[_0x28b5('0x2')],'unique':_0x28b5('0x4')},'authType':{'type':Sequelize[_0x28b5('0x5')](_0x28b5('0x6'),_0x28b5('0x7')),'defaultValue':_0x28b5('0x6')},'serverUrl':{'type':Sequelize[_0x28b5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x28b5('0x5')]('integrationTab',_0x28b5('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xe1d3=['integrationTab','sequelize','exports','STRING','remoteUri','token','password','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe1d3,0x159));var _0x3e1d=function(_0x41b804,_0x4c36df){_0x41b804=_0x41b804-0x0;var _0xe4fcc4=_0xe1d3[_0x41b804];return _0xe4fcc4;};'use strict';var Sequelize=require(_0x3e1d('0x0'));module[_0x3e1d('0x1')]={'name':{'type':Sequelize[_0x3e1d('0x2')]},'description':{'type':Sequelize[_0x3e1d('0x2')]},'username':{'type':Sequelize[_0x3e1d('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x3e1d('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3e1d('0x2')],'unique':_0x3e1d('0x3')},'authType':{'type':Sequelize['ENUM']('password',_0x3e1d('0x4')),'defaultValue':_0x3e1d('0x5')},'serverUrl':{'type':Sequelize[_0x3e1d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3e1d('0x6')](_0x3e1d('0x7'),'newTab'),'defaultValue':_0x3e1d('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 15ae4b5..2a5b66c 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 _0x57f8=['fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','username','password','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','Basic\x20%s','headers','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','includes','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','end','error','name','send','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x57f8,0x198));var _0x857f=function(_0x3bea4,_0x56a1a5){_0x3bea4=_0x3bea4-0x0;var _0xf8e956=_0x57f8[_0x3bea4];return _0xf8e956;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e1eda,_0x2d5e26){_0x2d5e26=_0x2d5e26||0xcc;return function(_0x373333){if(_0x373333){return _0x2e1eda[_0x857f('0x1b')](_0x2d5e26);}return _0x2e1eda[_0x857f('0x1c')](_0x2d5e26)['end']();};}function respondWithResult(_0x4bc590,_0x3b09d9){_0x3b09d9=_0x3b09d9||0xc8;return function(_0x5f27b2){if(_0x5f27b2){return _0x4bc590[_0x857f('0x1c')](_0x3b09d9)['json'](_0x5f27b2);}};}function respondWithFilteredResult(_0x1d47bf,_0x134a4f){return function(_0x5c3a69){if(_0x5c3a69){var _0x27e8f1=typeof _0x134a4f[_0x857f('0x1d')]===_0x857f('0x1e')&&typeof _0x134a4f[_0x857f('0x1f')]===_0x857f('0x1e');var _0x38a3c2=_0x5c3a69[_0x857f('0x20')];var _0x429e23=_0x27e8f1?0x0:_0x134a4f[_0x857f('0x1d')];var _0x38a242=_0x27e8f1?_0x5c3a69[_0x857f('0x20')]:_0x134a4f['offset']+_0x134a4f[_0x857f('0x1f')];var _0x1e8fd4;if(_0x38a242>=_0x38a3c2){_0x38a242=_0x38a3c2;_0x1e8fd4=0xc8;}else{_0x1e8fd4=0xce;}_0x1d47bf['status'](_0x1e8fd4);return _0x1d47bf[_0x857f('0x21')](_0x857f('0x22'),_0x429e23+'-'+_0x38a242+'/'+_0x38a3c2)[_0x857f('0x23')](_0x5c3a69);}return null;};}function patchUpdates(_0x484035){return function(_0x57fa8b){try{jsonpatch[_0x857f('0x24')](_0x57fa8b,_0x484035,!![]);}catch(_0x8f278){return BPromise[_0x857f('0x25')](_0x8f278);}return _0x57fa8b['save']();};}function saveUpdates(_0x118237,_0x17a98e){return function(_0xdf8ac3){if(_0xdf8ac3){return _0xdf8ac3['update'](_0x118237)[_0x857f('0x26')](function(_0x14a8ce){return _0x14a8ce;});}return null;};}function removeEntity(_0x50bfb7,_0x3bc543){return function(_0x1a651f){if(_0x1a651f){return _0x1a651f[_0x857f('0x27')]()[_0x857f('0x26')](function(){_0x50bfb7[_0x857f('0x1c')](0xcc)[_0x857f('0x28')]();});}};}function handleEntityNotFound(_0x233a68,_0x2a89ba){return function(_0x181a9e){if(!_0x181a9e){_0x233a68[_0x857f('0x1b')](0x194);}return _0x181a9e;};}function handleError(_0x72f0aa,_0x4782ab){_0x4782ab=_0x4782ab||0x1f4;return function(_0x250731){logger[_0x857f('0x29')](_0x250731['stack']);if(_0x250731[_0x857f('0x2a')]){delete _0x250731[_0x857f('0x2a')];}_0x72f0aa[_0x857f('0x1c')](_0x4782ab)[_0x857f('0x2b')](_0x250731);};}exports['index']=function(_0x40c306,_0x57ceaa){var _0x1b405a={},_0x234048={},_0x45a37f={'count':0x0,'rows':[]};var _0x2ab814=_[_0x857f('0x2c')](db[_0x857f('0x2d')][_0x857f('0x2e')],function(_0xe79241){return{'name':_0xe79241[_0x857f('0x2f')],'type':_0xe79241[_0x857f('0x30')][_0x857f('0x31')]};});_0x234048[_0x857f('0x32')]=_[_0x857f('0x2c')](_0x2ab814,'name');_0x234048[_0x857f('0x33')]=_[_0x857f('0x34')](_0x40c306['query']);_0x234048[_0x857f('0x35')]=_[_0x857f('0x36')](_0x234048['model'],_0x234048[_0x857f('0x33')]);_0x1b405a[_0x857f('0x37')]=_['intersection'](_0x234048[_0x857f('0x32')],qs[_0x857f('0x38')](_0x40c306[_0x857f('0x33')][_0x857f('0x38')]));_0x1b405a['attributes']=_0x1b405a['attributes'][_0x857f('0x39')]?_0x1b405a[_0x857f('0x37')]:_0x234048['model'];if(!_0x40c306[_0x857f('0x33')]['hasOwnProperty'](_0x857f('0x3a'))){_0x1b405a[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x40c306[_0x857f('0x33')][_0x857f('0x1f')]);_0x1b405a['offset']=qs['offset'](_0x40c306[_0x857f('0x33')]['offset']);}_0x1b405a[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x40c306[_0x857f('0x33')]['sort']);_0x1b405a[_0x857f('0x3d')]=qs[_0x857f('0x35')](_[_0x857f('0x3e')](_0x40c306[_0x857f('0x33')],_0x234048[_0x857f('0x35')]),_0x2ab814);if(_0x40c306[_0x857f('0x33')][_0x857f('0x3f')]){_0x1b405a['where']=_[_0x857f('0x40')](_0x1b405a[_0x857f('0x3d')],{'$or':_[_0x857f('0x2c')](_0x2ab814,function(_0x28ffe4){if(_0x28ffe4[_0x857f('0x30')]!==_0x857f('0x41')){var _0x447f28={};_0x447f28[_0x28ffe4['name']]={'$like':'%'+_0x40c306[_0x857f('0x33')][_0x857f('0x3f')]+'%'};return _0x447f28;}})});}_0x1b405a=_[_0x857f('0x40')]({},_0x1b405a,_0x40c306[_0x857f('0x42')]);var _0x196c95={'where':_0x1b405a[_0x857f('0x3d')]};return db['ZendeskAccount'][_0x857f('0x20')](_0x196c95)[_0x857f('0x26')](function(_0x167e9d){_0x45a37f[_0x857f('0x20')]=_0x167e9d;if(_0x40c306[_0x857f('0x33')][_0x857f('0x43')]){_0x1b405a[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2d')]['findAll'](_0x1b405a);})[_0x857f('0x26')](function(_0x223095){_0x45a37f[_0x857f('0x45')]=_0x223095;return _0x45a37f;})[_0x857f('0x26')](respondWithFilteredResult(_0x57ceaa,_0x1b405a))[_0x857f('0x46')](handleError(_0x57ceaa,null));};exports[_0x857f('0x47')]=function(_0x374b9f,_0x42d922){var _0xb4d7c2={'raw':![],'where':{'id':_0x374b9f[_0x857f('0x48')]['id']}},_0x3e2079={};_0x3e2079[_0x857f('0x32')]=_[_0x857f('0x34')](db[_0x857f('0x2d')]['rawAttributes']);_0x3e2079[_0x857f('0x33')]=_['keys'](_0x374b9f[_0x857f('0x33')]);_0x3e2079[_0x857f('0x35')]=_[_0x857f('0x36')](_0x3e2079[_0x857f('0x32')],_0x3e2079[_0x857f('0x33')]);_0xb4d7c2[_0x857f('0x37')]=_[_0x857f('0x36')](_0x3e2079[_0x857f('0x32')],qs[_0x857f('0x38')](_0x374b9f[_0x857f('0x33')][_0x857f('0x38')]));_0xb4d7c2['attributes']=_0xb4d7c2['attributes'][_0x857f('0x39')]?_0xb4d7c2['attributes']:_0x3e2079[_0x857f('0x32')];if(_0x374b9f['query'][_0x857f('0x43')]){_0xb4d7c2[_0x857f('0x44')]=[{'all':!![]}];}_0xb4d7c2=_[_0x857f('0x40')]({},_0xb4d7c2,_0x374b9f[_0x857f('0x42')]);return db[_0x857f('0x2d')][_0x857f('0x49')](_0xb4d7c2)[_0x857f('0x26')](handleEntityNotFound(_0x42d922,null))[_0x857f('0x26')](respondWithResult(_0x42d922,null))['catch'](handleError(_0x42d922,null));};exports[_0x857f('0x4a')]=function(_0x3b431d,_0x3806d4){return db[_0x857f('0x2d')]['create'](_0x3b431d[_0x857f('0x4b')],{})[_0x857f('0x26')](respondWithResult(_0x3806d4,0xc9))[_0x857f('0x46')](handleError(_0x3806d4,null));};exports[_0x857f('0x4c')]=function(_0x67563,_0x53baae){if(_0x67563[_0x857f('0x4b')]['id']){delete _0x67563[_0x857f('0x4b')]['id'];}return db['ZendeskAccount'][_0x857f('0x49')]({'where':{'id':_0x67563[_0x857f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53baae,null))[_0x857f('0x26')](saveUpdates(_0x67563['body'],null))[_0x857f('0x26')](respondWithResult(_0x53baae,null))[_0x857f('0x46')](handleError(_0x53baae,null));};exports[_0x857f('0x27')]=function(_0x2008d5,_0x58bf27){return db[_0x857f('0x2d')][_0x857f('0x49')]({'where':{'id':_0x2008d5[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x58bf27,null))[_0x857f('0x26')](removeEntity(_0x58bf27,null))['catch'](handleError(_0x58bf27,null));};exports[_0x857f('0x4d')]=function(_0x13ef75,_0x9d8273,_0x2670e6){var _0x3e24a5={};var _0x9edee5={};var _0x12712a;var _0x59164a;return db[_0x857f('0x2d')][_0x857f('0x4e')]({'where':{'id':_0x13ef75[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x9d8273,null))[_0x857f('0x26')](function(_0x153e4e){if(_0x153e4e){_0x12712a=_0x153e4e;_0x9edee5['model']=_[_0x857f('0x34')](db[_0x857f('0x4f')][_0x857f('0x2e')]);_0x9edee5[_0x857f('0x33')]=_[_0x857f('0x34')](_0x13ef75[_0x857f('0x33')]);_0x9edee5[_0x857f('0x35')]=_[_0x857f('0x36')](_0x9edee5['model'],_0x9edee5['query']);_0x3e24a5[_0x857f('0x37')]=_[_0x857f('0x36')](_0x9edee5[_0x857f('0x32')],qs[_0x857f('0x38')](_0x13ef75[_0x857f('0x33')][_0x857f('0x38')]));_0x3e24a5['attributes']=_0x3e24a5[_0x857f('0x37')][_0x857f('0x39')]?_0x3e24a5['attributes']:_0x9edee5[_0x857f('0x32')];_0x3e24a5['order']=qs[_0x857f('0x3c')](_0x13ef75[_0x857f('0x33')]['sort']);_0x3e24a5[_0x857f('0x3d')]=qs[_0x857f('0x35')](_[_0x857f('0x3e')](_0x13ef75[_0x857f('0x33')],_0x9edee5[_0x857f('0x35')]));if(_0x13ef75[_0x857f('0x33')][_0x857f('0x3f')]){_0x3e24a5[_0x857f('0x3d')]=_['merge'](_0x3e24a5[_0x857f('0x3d')],{'$or':_[_0x857f('0x2c')](_0x3e24a5[_0x857f('0x37')],function(_0x7cc7f7){var _0x3c612f={};_0x3c612f[_0x7cc7f7]={'$like':'%'+_0x13ef75[_0x857f('0x33')][_0x857f('0x3f')]+'%'};return _0x3c612f;})});}_0x3e24a5=_[_0x857f('0x40')]({},_0x3e24a5,_0x13ef75[_0x857f('0x42')]);return _0x12712a[_0x857f('0x4d')](_0x3e24a5);}})[_0x857f('0x26')](function(_0x5631fb){if(_0x5631fb){_0x59164a=_0x5631fb[_0x857f('0x39')];if(!_0x13ef75[_0x857f('0x33')][_0x857f('0x50')](_0x857f('0x3a'))){_0x3e24a5['limit']=qs[_0x857f('0x1f')](_0x13ef75['query'][_0x857f('0x1f')]);_0x3e24a5[_0x857f('0x1d')]=qs[_0x857f('0x1d')](_0x13ef75[_0x857f('0x33')]['offset']);}return _0x12712a['getConfigurations'](_0x3e24a5);}})[_0x857f('0x26')](function(_0x3ee981){if(_0x3ee981){return _0x3ee981?{'count':_0x59164a,'rows':_0x3ee981}:null;}})[_0x857f('0x26')](respondWithResult(_0x9d8273,null))['catch'](handleError(_0x9d8273,null));};exports[_0x857f('0x51')]=function(_0x5e42bc,_0x5b505,_0x1d6c1c){if(_0x5e42bc[_0x857f('0x4b')]['id']){delete _0x5e42bc['body']['id'];}return db['ZendeskAccount'][_0x857f('0x4e')]({'where':{'id':_0x5e42bc[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x5b505,null))[_0x857f('0x26')](function(_0x41f9d8){if(_0x41f9d8){_0x5e42bc[_0x857f('0x4b')][_0x857f('0x52')]=_0x41f9d8['id'];_0x5e42bc[_0x857f('0x4b')]['Subjects']=integrations['getSubjects'](_0x5e42bc[_0x857f('0x4b')][_0x857f('0x53')],_0x5e42bc[_0x857f('0x4b')][_0x857f('0x30')]);_0x5e42bc[_0x857f('0x4b')][_0x857f('0x54')]=integrations['getDescriptions'](_0x5e42bc[_0x857f('0x4b')][_0x857f('0x53')],_0x5e42bc[_0x857f('0x4b')][_0x857f('0x30')]);return db[_0x857f('0x4f')][_0x857f('0x4a')](_0x5e42bc[_0x857f('0x4b')],{'include':[{'model':db[_0x857f('0x55')],'as':_0x857f('0x56')},{'model':db[_0x857f('0x55')],'as':'Descriptions'}]});}return null;})[_0x857f('0x26')](respondWithResult(_0x5b505,null))['catch'](handleError(_0x5b505,null));};exports['getFields']=function(_0x35cd3e,_0x48e588,_0x5e5fd9){var _0x2e2cf3='';return db['ZendeskAccount'][_0x857f('0x4e')]({'where':{'id':_0x35cd3e['params']['id']},'attributes':['id',_0x857f('0x57'),_0x857f('0x58'),_0x857f('0x59'),_0x857f('0x5a'),'remoteUri']})[_0x857f('0x26')](handleEntityNotFound(_0x48e588,null))[_0x857f('0x26')](function(_0x3100aa){if(_0x3100aa){_0x2e2cf3=_0x3100aa[_0x857f('0x5b')];var _0x387aaa=_0x2e2cf3[_0x857f('0x5c')](-0x1);if(_0x387aaa==='/'){_0x2e2cf3=_0x2e2cf3[_0x857f('0x5d')](0x0,_0x2e2cf3['lastIndexOf'](_0x387aaa));}var _0x54e75d={'method':_0x857f('0x5e'),'uri':util[_0x857f('0x5f')](_0x857f('0x60'),_0x2e2cf3,_0x857f('0x61')),'json':!![]};switch(_0x3100aa[_0x857f('0x5a')]){case _0x857f('0x58'):_0x54e75d['headers']={'Authorization':util[_0x857f('0x5f')](_0x857f('0x62'),new Buffer(util[_0x857f('0x5f')]('%s:%s',_0x3100aa['username'],_0x3100aa[_0x857f('0x58')]))['toString']('base64'))};break;case _0x857f('0x59'):_0x54e75d[_0x857f('0x63')]={'Authorization':util['format'](_0x857f('0x62'),new Buffer(util[_0x857f('0x5f')]('%s/token:%s',_0x3100aa[_0x857f('0x57')],_0x3100aa[_0x857f('0x59')]))[_0x857f('0x64')](_0x857f('0x65')))};break;default:throw new db[(_0x857f('0x66'))][(_0x857f('0x67'))](_0x857f('0x68'));}return rp(_0x54e75d);}})[_0x857f('0x26')](function(_0x415fd3){if(_0x415fd3){var _0x465857=[_0x857f('0x69'),_0x857f('0x6a'),'group','assignee'];_['remove'](_0x415fd3[_0x857f('0x61')],function(_0x310b18){return _0x465857[_0x857f('0x6b')](_0x310b18[_0x857f('0x30')]);});return{'count':_0x415fd3[_0x857f('0x61')][_0x857f('0x39')],'rows':_[_0x857f('0x2c')](_0x415fd3['ticket_fields'],function(_0x40077e){return{'id':_0x40077e['id'],'name':_0x40077e['position']>0x7?_0x40077e[_0x857f('0x6c')]:_0x40077e['type'],'custom':_0x40077e['position']>0x7?!![]:![],'options':_0x40077e[_0x857f('0x6d')]?_0x40077e['system_field_options']:_0x40077e[_0x857f('0x6e')]?_0x40077e[_0x857f('0x6e')]:[]};})};}})[_0x857f('0x26')](respondWithResult(_0x48e588,null))['catch'](function(_0x45be3d){var _0x19456f=_0x35cd3e[_0x857f('0x33')][_0x857f('0x6f')]?0x1f4:_0x45be3d[_0x857f('0x70')]||0x1f4;logger[_0x857f('0x29')](_0x857f('0x71'),_0x857f('0x72'),_0x19456f,JSON[_0x857f('0x73')](_0x45be3d));delete _0x45be3d['name'];if(_0x19456f===0x191){_0x19456f=0x190;}_0x48e588[_0x857f('0x1c')](_0x19456f)[_0x857f('0x2b')](_0x35cd3e[_0x857f('0x33')][_0x857f('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x45be3d[_0x857f('0x70')]}:_0x45be3d);});}; \ No newline at end of file +var _0xefda=['getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','stringify','send','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','channel','type','Descriptions'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0xefda,0x96));var _0xaefd=function(_0x5ffbe5,_0xe6e990){_0x5ffbe5=_0x5ffbe5-0x0;var _0x494d0f=_0xefda[_0x5ffbe5];return _0x494d0f;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];var integrations=require(_0xaefd('0x18'));function respondWithStatusCode(_0x2a310c,_0x4b2b5c){_0x4b2b5c=_0x4b2b5c||0xcc;return function(_0x3172d3){if(_0x3172d3){return _0x2a310c['sendStatus'](_0x4b2b5c);}return _0x2a310c[_0xaefd('0x19')](_0x4b2b5c)[_0xaefd('0x1a')]();};}function respondWithResult(_0x9dfdf6,_0x43b82a){_0x43b82a=_0x43b82a||0xc8;return function(_0x4ec92a){if(_0x4ec92a){return _0x9dfdf6[_0xaefd('0x19')](_0x43b82a)[_0xaefd('0x1b')](_0x4ec92a);}};}function respondWithFilteredResult(_0x41f345,_0x411701){return function(_0x10ee28){if(_0x10ee28){var _0x32f75e=typeof _0x411701[_0xaefd('0x1c')]===_0xaefd('0x1d')&&typeof _0x411701['limit']===_0xaefd('0x1d');var _0x109604=_0x10ee28[_0xaefd('0x1e')];var _0x1737a1=_0x32f75e?0x0:_0x411701[_0xaefd('0x1c')];var _0x244956=_0x32f75e?_0x10ee28['count']:_0x411701[_0xaefd('0x1c')]+_0x411701[_0xaefd('0x1f')];var _0x24f131;if(_0x244956>=_0x109604){_0x244956=_0x109604;_0x24f131=0xc8;}else{_0x24f131=0xce;}_0x41f345[_0xaefd('0x19')](_0x24f131);return _0x41f345[_0xaefd('0x20')](_0xaefd('0x21'),_0x1737a1+'-'+_0x244956+'/'+_0x109604)['json'](_0x10ee28);}return null;};}function patchUpdates(_0x463d48){return function(_0x18e71c){try{jsonpatch[_0xaefd('0x22')](_0x18e71c,_0x463d48,!![]);}catch(_0x3d9823){return BPromise[_0xaefd('0x23')](_0x3d9823);}return _0x18e71c['save']();};}function saveUpdates(_0x479486,_0x5b9967){return function(_0x21680a){if(_0x21680a){return _0x21680a[_0xaefd('0x24')](_0x479486)[_0xaefd('0x25')](function(_0x5a44ed){return _0x5a44ed;});}return null;};}function removeEntity(_0x23060f,_0x4cd9b2){return function(_0x3deec8){if(_0x3deec8){return _0x3deec8[_0xaefd('0x26')]()[_0xaefd('0x25')](function(){_0x23060f['status'](0xcc)[_0xaefd('0x1a')]();});}};}function handleEntityNotFound(_0x3ffc9c,_0x18e720){return function(_0x14cc9d){if(!_0x14cc9d){_0x3ffc9c[_0xaefd('0x27')](0x194);}return _0x14cc9d;};}function handleError(_0x5a170c,_0x2fe27e){_0x2fe27e=_0x2fe27e||0x1f4;return function(_0x58c008){logger[_0xaefd('0x28')](_0x58c008[_0xaefd('0x29')]);if(_0x58c008['name']){delete _0x58c008[_0xaefd('0x2a')];}_0x5a170c[_0xaefd('0x19')](_0x2fe27e)['send'](_0x58c008);};}exports[_0xaefd('0x2b')]=function(_0x114ec0,_0x36b6b7){var _0x4c0898={},_0x45f0e8={},_0x5c573b={'count':0x0,'rows':[]};var _0x109e19=_['map'](db['ZendeskAccount'][_0xaefd('0x2c')],function(_0x1b470c){return{'name':_0x1b470c['fieldName'],'type':_0x1b470c['type']['key']};});_0x45f0e8[_0xaefd('0x2d')]=_[_0xaefd('0x2e')](_0x109e19,'name');_0x45f0e8['query']=_[_0xaefd('0x2f')](_0x114ec0[_0xaefd('0x30')]);_0x45f0e8[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x45f0e8['model'],_0x45f0e8[_0xaefd('0x30')]);_0x4c0898[_0xaefd('0x33')]=_[_0xaefd('0x32')](_0x45f0e8[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x34')]));_0x4c0898[_0xaefd('0x33')]=_0x4c0898[_0xaefd('0x33')][_0xaefd('0x35')]?_0x4c0898[_0xaefd('0x33')]:_0x45f0e8[_0xaefd('0x2d')];if(!_0x114ec0[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4c0898[_0xaefd('0x1f')]=qs['limit'](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4c0898[_0xaefd('0x1c')]=qs['offset'](_0x114ec0[_0xaefd('0x30')]['offset']);}_0x4c0898[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x39')]);_0x4c0898[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x114ec0[_0xaefd('0x30')],_0x45f0e8[_0xaefd('0x31')]),_0x109e19);if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4c0898[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4c0898[_0xaefd('0x3a')],{'$or':_['map'](_0x109e19,function(_0x1cfd6d){if(_0x1cfd6d['type']!==_0xaefd('0x3e')){var _0x6562={};_0x6562[_0x1cfd6d[_0xaefd('0x2a')]]={'$like':'%'+_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x6562;}})});}_0x4c0898=_[_0xaefd('0x3d')]({},_0x4c0898,_0x114ec0[_0xaefd('0x3f')]);var _0x145e9e={'where':_0x4c0898[_0xaefd('0x3a')]};return db[_0xaefd('0x40')]['count'](_0x145e9e)[_0xaefd('0x25')](function(_0x3296ac){_0x5c573b['count']=_0x3296ac;if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x41')]){_0x4c0898[_0xaefd('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x4c0898);})[_0xaefd('0x25')](function(_0x3d0abf){_0x5c573b[_0xaefd('0x43')]=_0x3d0abf;return _0x5c573b;})[_0xaefd('0x25')](respondWithFilteredResult(_0x36b6b7,_0x4c0898))[_0xaefd('0x44')](handleError(_0x36b6b7,null));};exports[_0xaefd('0x45')]=function(_0x2e17b5,_0x2e98aa){var _0x48a7af={'raw':![],'where':{'id':_0x2e17b5[_0xaefd('0x46')]['id']}},_0x26587e={};_0x26587e[_0xaefd('0x2d')]=_[_0xaefd('0x2f')](db[_0xaefd('0x40')][_0xaefd('0x2c')]);_0x26587e[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x2e17b5['query']);_0x26587e['filters']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],_0x26587e['query']);_0x48a7af['attributes']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x34')]));_0x48a7af[_0xaefd('0x33')]=_0x48a7af[_0xaefd('0x33')][_0xaefd('0x35')]?_0x48a7af[_0xaefd('0x33')]:_0x26587e['model'];if(_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x41')]){_0x48a7af[_0xaefd('0x42')]=[{'all':!![]}];}_0x48a7af=_[_0xaefd('0x3d')]({},_0x48a7af,_0x2e17b5[_0xaefd('0x3f')]);return db[_0xaefd('0x40')][_0xaefd('0x47')](_0x48a7af)['then'](handleEntityNotFound(_0x2e98aa,null))[_0xaefd('0x25')](respondWithResult(_0x2e98aa,null))['catch'](handleError(_0x2e98aa,null));};exports[_0xaefd('0x48')]=function(_0x374845,_0x16c664){return db[_0xaefd('0x40')]['create'](_0x374845['body'],{})[_0xaefd('0x25')](respondWithResult(_0x16c664,0xc9))[_0xaefd('0x44')](handleError(_0x16c664,null));};exports[_0xaefd('0x24')]=function(_0x4eeb56,_0x2a836a){if(_0x4eeb56[_0xaefd('0x49')]['id']){delete _0x4eeb56['body']['id'];}return db[_0xaefd('0x40')][_0xaefd('0x47')]({'where':{'id':_0x4eeb56[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x2a836a,null))[_0xaefd('0x25')](saveUpdates(_0x4eeb56[_0xaefd('0x49')],null))[_0xaefd('0x25')](respondWithResult(_0x2a836a,null))[_0xaefd('0x44')](handleError(_0x2a836a,null));};exports['destroy']=function(_0x567ceb,_0x1406b8){return db[_0xaefd('0x40')]['find']({'where':{'id':_0x567ceb[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1406b8,null))[_0xaefd('0x25')](removeEntity(_0x1406b8,null))[_0xaefd('0x44')](handleError(_0x1406b8,null));};exports[_0xaefd('0x4a')]=function(_0x69185e,_0x27fd3f,_0xf727cd){var _0x4b709a={};var _0x56e180={};var _0x1fd0b0;var _0x338823;return db['ZendeskAccount'][_0xaefd('0x4b')]({'where':{'id':_0x69185e[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x27fd3f,null))[_0xaefd('0x25')](function(_0x4a883b){if(_0x4a883b){_0x1fd0b0=_0x4a883b;_0x56e180['model']=_[_0xaefd('0x2f')](db[_0xaefd('0x4c')][_0xaefd('0x2c')]);_0x56e180[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x69185e['query']);_0x56e180[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x56e180['model'],_0x56e180[_0xaefd('0x30')]);_0x4b709a[_0xaefd('0x33')]=_['intersection'](_0x56e180[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x69185e[_0xaefd('0x30')]['fields']));_0x4b709a[_0xaefd('0x33')]=_0x4b709a[_0xaefd('0x33')]['length']?_0x4b709a[_0xaefd('0x33')]:_0x56e180[_0xaefd('0x2d')];_0x4b709a[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x69185e['query']['sort']);_0x4b709a[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x69185e[_0xaefd('0x30')],_0x56e180[_0xaefd('0x31')]));if(_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4b709a[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4b709a[_0xaefd('0x3a')],{'$or':_['map'](_0x4b709a['attributes'],function(_0x324eb4){var _0x431c1a={};_0x431c1a[_0x324eb4]={'$like':'%'+_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x431c1a;})});}_0x4b709a=_['merge']({},_0x4b709a,_0x69185e[_0xaefd('0x3f')]);return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x1ad04e){if(_0x1ad04e){_0x338823=_0x1ad04e[_0xaefd('0x35')];if(!_0x69185e[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4b709a['limit']=qs[_0xaefd('0x1f')](_0x69185e[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4b709a[_0xaefd('0x1c')]=qs['offset'](_0x69185e[_0xaefd('0x30')]['offset']);}return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x516913){if(_0x516913){return _0x516913?{'count':_0x338823,'rows':_0x516913}:null;}})['then'](respondWithResult(_0x27fd3f,null))[_0xaefd('0x44')](handleError(_0x27fd3f,null));};exports['addConfiguration']=function(_0x5e0068,_0x4e75bc,_0xe2397c){if(_0x5e0068[_0xaefd('0x49')]['id']){delete _0x5e0068[_0xaefd('0x49')]['id'];}return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x5e0068[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e75bc,null))['then'](function(_0x4f8e16){if(_0x4f8e16){_0x5e0068['body'][_0xaefd('0x4d')]=_0x4f8e16['id'];_0x5e0068['body'][_0xaefd('0x4e')]=integrations['getSubjects'](_0x5e0068[_0xaefd('0x49')][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);_0x5e0068[_0xaefd('0x49')][_0xaefd('0x51')]=integrations[_0xaefd('0x52')](_0x5e0068['body'][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);return db[_0xaefd('0x4c')]['create'](_0x5e0068[_0xaefd('0x49')],{'include':[{'model':db['ZendeskField'],'as':_0xaefd('0x4e')},{'model':db[_0xaefd('0x53')],'as':_0xaefd('0x51')}]});}return null;})[_0xaefd('0x25')](respondWithResult(_0x4e75bc,null))[_0xaefd('0x44')](handleError(_0x4e75bc,null));};exports[_0xaefd('0x54')]=function(_0x57776e,_0x1a6195,_0x3b39db){var _0x4a9fa5='';return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x57776e['params']['id']},'attributes':['id',_0xaefd('0x55'),_0xaefd('0x56'),_0xaefd('0x57'),_0xaefd('0x58'),_0xaefd('0x59')]})[_0xaefd('0x25')](handleEntityNotFound(_0x1a6195,null))[_0xaefd('0x25')](function(_0x6f99b0){if(_0x6f99b0){_0x4a9fa5=_0x6f99b0[_0xaefd('0x59')];var _0x1ec9be=_0x4a9fa5[_0xaefd('0x5a')](-0x1);if(_0x1ec9be==='/'){_0x4a9fa5=_0x4a9fa5[_0xaefd('0x5b')](0x0,_0x4a9fa5[_0xaefd('0x5c')](_0x1ec9be));}var _0x43338b={'method':_0xaefd('0x5d'),'uri':util[_0xaefd('0x5e')](_0xaefd('0x5f'),_0x4a9fa5,'ticket_fields'),'json':!![]};switch(_0x6f99b0[_0xaefd('0x58')]){case _0xaefd('0x56'):_0x43338b[_0xaefd('0x60')]={'Authorization':util['format'](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')](_0xaefd('0x62'),_0x6f99b0[_0xaefd('0x55')],_0x6f99b0['password']))[_0xaefd('0x63')]('base64'))};break;case _0xaefd('0x57'):_0x43338b['headers']={'Authorization':util[_0xaefd('0x5e')](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')]('%s/token:%s',_0x6f99b0['username'],_0x6f99b0[_0xaefd('0x57')]))[_0xaefd('0x63')](_0xaefd('0x64')))};break;default:throw new db[(_0xaefd('0x65'))][(_0xaefd('0x66'))](_0xaefd('0x67'));}return rp(_0x43338b);}})['then'](function(_0x499d7d){if(_0x499d7d){var _0x58c97c=['subject','description',_0xaefd('0x68'),_0xaefd('0x69')];_[_0xaefd('0x6a')](_0x499d7d[_0xaefd('0x6b')],function(_0x5ae635){return _0x58c97c[_0xaefd('0x6c')](_0x5ae635[_0xaefd('0x50')]);});return{'count':_0x499d7d['ticket_fields'][_0xaefd('0x35')],'rows':_['map'](_0x499d7d[_0xaefd('0x6b')],function(_0x51b6f1){return{'id':_0x51b6f1['id'],'name':_0x51b6f1[_0xaefd('0x6d')]>0x7?_0x51b6f1['title']:_0x51b6f1[_0xaefd('0x50')],'custom':_0x51b6f1['position']>0x7?!![]:![],'options':_0x51b6f1[_0xaefd('0x6e')]?_0x51b6f1[_0xaefd('0x6e')]:_0x51b6f1['custom_field_options']?_0x51b6f1[_0xaefd('0x6f')]:[]};})};}})[_0xaefd('0x25')](respondWithResult(_0x1a6195,null))[_0xaefd('0x44')](function(_0x564c89){var _0x42c55c=_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?0x1f4:_0x564c89[_0xaefd('0x71')]||0x1f4;logger[_0xaefd('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xaefd('0x54'),_0x42c55c,JSON[_0xaefd('0x72')](_0x564c89));delete _0x564c89['name'];if(_0x42c55c===0x191){_0x42c55c=0x190;}_0x1a6195[_0xaefd('0x19')](_0x42c55c)[_0xaefd('0x73')](_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x564c89[_0xaefd('0x71')]}:_0x564c89);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 6b70826..61c2416 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 _0x8630=['exports','int_zendesk_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0xc06a96,_0x28ea82){var _0x280487=function(_0x117497){while(--_0x117497){_0xc06a96['push'](_0xc06a96['shift']());}};_0x280487(++_0x28ea82);}(_0x8630,0xb6));var _0x0863=function(_0x559b31,_0x34d0a4){_0x559b31=_0x559b31-0x0;var _0x487d27=_0x8630[_0x559b31];return _0x487d27;};'use strict';var _=require(_0x0863('0x0'));var util=require(_0x0863('0x1'));var logger=require(_0x0863('0x2'))(_0x0863('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0863('0x4'));var fs=require('fs');var path=require(_0x0863('0x5'));var rimraf=require(_0x0863('0x6'));var config=require(_0x0863('0x7'));var attributes=require(_0x0863('0x8'));var integrations=require(_0x0863('0x9'));module[_0x0863('0xa')]=function(_0x2845dc,_0x58fe0a){return _0x2845dc['define']('ZendeskAccount',attributes,{'tableName':_0x0863('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x428f=['../../config/environment','../../components/integrations/configuration','exports','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x428f,0x143));var _0xf428=function(_0x38ceb5,_0x4a2585){_0x38ceb5=_0x38ceb5-0x0;var _0x276de6=_0x428f[_0x38ceb5];return _0x276de6;};'use strict';var _=require(_0xf428('0x0'));var util=require(_0xf428('0x1'));var logger=require('../../config/logger')(_0xf428('0x2'));var moment=require('moment');var BPromise=require(_0xf428('0x3'));var rp=require(_0xf428('0x4'));var fs=require('fs');var path=require(_0xf428('0x5'));var rimraf=require(_0xf428('0x6'));var config=require(_0xf428('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xf428('0x8'));module[_0xf428('0x9')]=function(_0x1b20da,_0xd06b07){return _0x1b20da['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index f93377e..7940e51 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 _0xc3cd=['info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetZendeskAccount','ZendeskAccount','options','raw','where','limit','include','map','attributes','model','then','stringify','catch','ShowZendeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x457bfc,_0x6292dd){var _0x294c16=function(_0x13a7df){while(--_0x13a7df){_0x457bfc['push'](_0x457bfc['shift']());}};_0x294c16(++_0x6292dd);}(_0xc3cd,0x1c7));var _0xdc3c=function(_0x4a0a4c,_0x74a4f9){_0x4a0a4c=_0x4a0a4c-0x0;var _0x1a945c=_0xc3cd[_0x4a0a4c];return _0x1a945c;};'use strict';var _=require('lodash');var util=require(_0xdc3c('0x0'));var moment=require(_0xdc3c('0x1'));var BPromise=require(_0xdc3c('0x2'));var rs=require(_0xdc3c('0x3'));var fs=require('fs');var Redis=require(_0xdc3c('0x4'));var db=require(_0xdc3c('0x5'))['db'];var utils=require(_0xdc3c('0x6'));var logger=require('../../config/logger')(_0xdc3c('0x7'));var config=require(_0xdc3c('0x8'));var jayson=require(_0xdc3c('0x9'));var client=jayson[_0xdc3c('0xa')][_0xdc3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59d4a1,_0x53c157,_0x3e0a04){return new BPromise(function(_0x2d1a89,_0x102836){return client[_0xdc3c('0xc')](_0x59d4a1,_0x3e0a04)['then'](function(_0x12f86a){logger[_0xdc3c('0xd')](_0xdc3c('0xe'),_0x53c157,_0xdc3c('0xf'));logger[_0xdc3c('0x10')](_0xdc3c('0x11'),_0x53c157,_0xdc3c('0xf'),JSON['stringify'](_0x12f86a));if(_0x12f86a[_0xdc3c('0x12')]){if(_0x12f86a[_0xdc3c('0x12')][_0xdc3c('0x13')]===0x1f4){logger[_0xdc3c('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x53c157,_0x12f86a[_0xdc3c('0x12')][_0xdc3c('0x14')]);return _0x102836(_0x12f86a[_0xdc3c('0x12')][_0xdc3c('0x14')]);}logger[_0xdc3c('0x12')](_0xdc3c('0xe'),_0x53c157,_0x12f86a['error'][_0xdc3c('0x14')]);return _0x2d1a89(_0x12f86a[_0xdc3c('0x12')][_0xdc3c('0x14')]);}else{logger[_0xdc3c('0xd')](_0xdc3c('0xe'),_0x53c157,_0xdc3c('0xf'));_0x2d1a89(_0x12f86a[_0xdc3c('0x15')]['message']);}})['catch'](function(_0x572111){logger[_0xdc3c('0x12')](_0xdc3c('0xe'),_0x53c157,_0x572111);_0x102836(_0x572111);});});}exports[_0xdc3c('0x16')]=function(_0x45074f){var _0x53f008=this;return new Promise(function(_0x1dd1aa,_0x4235e3){return db[_0xdc3c('0x17')]['findAll']({'raw':_0x45074f[_0xdc3c('0x18')]?_0x45074f[_0xdc3c('0x18')][_0xdc3c('0x19')]===undefined?!![]:![]:!![],'where':_0x45074f[_0xdc3c('0x18')]?_0x45074f['options'][_0xdc3c('0x1a')]||null:null,'attributes':_0x45074f[_0xdc3c('0x18')]?_0x45074f['options']['attributes']||null:null,'limit':_0x45074f[_0xdc3c('0x18')]?_0x45074f[_0xdc3c('0x18')][_0xdc3c('0x1b')]||null:null,'include':_0x45074f[_0xdc3c('0x18')]?_0x45074f['options'][_0xdc3c('0x1c')]?_[_0xdc3c('0x1d')](_0x45074f['options'][_0xdc3c('0x1c')],function(_0x9522d3){return{'model':db[_0x9522d3['model']],'as':_0x9522d3['as'],'attributes':_0x9522d3[_0xdc3c('0x1e')],'include':_0x9522d3[_0xdc3c('0x1c')]?_[_0xdc3c('0x1d')](_0x9522d3['include'],function(_0x4cf8b7){return{'model':db[_0x4cf8b7[_0xdc3c('0x1f')]],'as':_0x4cf8b7['as'],'attributes':_0x4cf8b7['attributes'],'include':_0x4cf8b7[_0xdc3c('0x1c')]?_['map'](_0x4cf8b7[_0xdc3c('0x1c')],function(_0xcccbf6){return{'model':db[_0xcccbf6['model']],'as':_0xcccbf6['as'],'attributes':_0xcccbf6['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc3c('0x20')](function(_0x43b3e3){logger[_0xdc3c('0xd')](_0xdc3c('0x16'),_0x45074f);logger[_0xdc3c('0x10')](_0xdc3c('0x16'),_0x45074f,JSON[_0xdc3c('0x21')](_0x43b3e3));_0x1dd1aa(_0x43b3e3);})[_0xdc3c('0x22')](function(_0x49a229){logger[_0xdc3c('0x12')](_0xdc3c('0x16'),_0x49a229[_0xdc3c('0x14')],_0x45074f);_0x4235e3(_0x53f008['error'](0x1f4,_0x49a229[_0xdc3c('0x14')]));});});};exports[_0xdc3c('0x23')]=function(_0x65db40){var _0x31870a=this;return new Promise(function(_0x2786f9,_0x4ac0e5){return db[_0xdc3c('0x17')]['find']({'raw':_0x65db40[_0xdc3c('0x18')]?_0x65db40['options'][_0xdc3c('0x19')]===undefined?!![]:![]:!![],'where':_0x65db40[_0xdc3c('0x18')]?_0x65db40[_0xdc3c('0x18')][_0xdc3c('0x1a')]||null:null,'attributes':_0x65db40[_0xdc3c('0x18')]?_0x65db40[_0xdc3c('0x18')][_0xdc3c('0x1e')]||null:null,'include':_0x65db40[_0xdc3c('0x18')]?_0x65db40[_0xdc3c('0x18')][_0xdc3c('0x1c')]?_[_0xdc3c('0x1d')](_0x65db40['options'][_0xdc3c('0x1c')],function(_0x2d5df2){return{'model':db[_0x2d5df2['model']],'as':_0x2d5df2['as'],'attributes':_0x2d5df2['attributes'],'include':_0x2d5df2[_0xdc3c('0x1c')]?_[_0xdc3c('0x1d')](_0x2d5df2[_0xdc3c('0x1c')],function(_0x31a931){return{'model':db[_0x31a931[_0xdc3c('0x1f')]],'as':_0x31a931['as'],'attributes':_0x31a931[_0xdc3c('0x1e')],'include':_0x31a931[_0xdc3c('0x1c')]?_[_0xdc3c('0x1d')](_0x31a931[_0xdc3c('0x1c')],function(_0x21fb31){return{'model':db[_0x21fb31[_0xdc3c('0x1f')]],'as':_0x21fb31['as'],'attributes':_0x21fb31['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc3c('0x20')](function(_0x1ed142){logger['info']('ShowZendeskAccount',_0x65db40);logger['debug'](_0xdc3c('0x23'),_0x65db40,JSON['stringify'](_0x1ed142));_0x2786f9(_0x1ed142);})['catch'](function(_0x29a8b3){logger[_0xdc3c('0x12')]('ShowZendeskAccount',_0x29a8b3['message'],_0x65db40);_0x4ac0e5(_0x31870a[_0xdc3c('0x12')](0x1f4,_0x29a8b3[_0xdc3c('0x14')]));});});}; \ No newline at end of file +var _0x0ac1=['stringify','error','code','message','info','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','include','map','model','ZendeskAccount','find','ShowZendeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x493761,_0x427606){var _0x169ead=function(_0x76ac51){while(--_0x76ac51){_0x493761['push'](_0x493761['shift']());}};_0x169ead(++_0x427606);}(_0x0ac1,0x167));var _0x10ac=function(_0x4f33b8,_0x1285fc){_0x4f33b8=_0x4f33b8-0x0;var _0x101a99=_0x0ac1[_0x4f33b8];return _0x101a99;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x10ac('0x0'));var BPromise=require(_0x10ac('0x1'));var rs=require(_0x10ac('0x2'));var fs=require('fs');var Redis=require(_0x10ac('0x3'));var db=require(_0x10ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x10ac('0x5'));var config=require(_0x10ac('0x6'));var jayson=require(_0x10ac('0x7'));var client=jayson[_0x10ac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ced67,_0x412bfa,_0x1a2f01){return new BPromise(function(_0x296642,_0x2943ec){return client[_0x10ac('0x9')](_0x1ced67,_0x1a2f01)[_0x10ac('0xa')](function(_0x5a8a97){logger['info'](_0x10ac('0xb'),_0x412bfa,_0x10ac('0xc'));logger[_0x10ac('0xd')](_0x10ac('0xe'),_0x412bfa,'request\x20sent',JSON[_0x10ac('0xf')](_0x5a8a97));if(_0x5a8a97[_0x10ac('0x10')]){if(_0x5a8a97['error'][_0x10ac('0x11')]===0x1f4){logger[_0x10ac('0x10')](_0x10ac('0xb'),_0x412bfa,_0x5a8a97[_0x10ac('0x10')][_0x10ac('0x12')]);return _0x2943ec(_0x5a8a97['error'][_0x10ac('0x12')]);}logger[_0x10ac('0x10')](_0x10ac('0xb'),_0x412bfa,_0x5a8a97[_0x10ac('0x10')][_0x10ac('0x12')]);return _0x296642(_0x5a8a97[_0x10ac('0x10')][_0x10ac('0x12')]);}else{logger[_0x10ac('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x412bfa,_0x10ac('0xc'));_0x296642(_0x5a8a97[_0x10ac('0x14')][_0x10ac('0x12')]);}})[_0x10ac('0x15')](function(_0x1ccf2b){logger['error'](_0x10ac('0xb'),_0x412bfa,_0x1ccf2b);_0x2943ec(_0x1ccf2b);});});}exports[_0x10ac('0x16')]=function(_0x23c083){var _0x434c09=this;return new Promise(function(_0x278a7b,_0x2b24ad){return db['ZendeskAccount'][_0x10ac('0x17')]({'raw':_0x23c083[_0x10ac('0x18')]?_0x23c083['options'][_0x10ac('0x19')]===undefined?!![]:![]:!![],'where':_0x23c083[_0x10ac('0x18')]?_0x23c083[_0x10ac('0x18')][_0x10ac('0x1a')]||null:null,'attributes':_0x23c083[_0x10ac('0x18')]?_0x23c083['options'][_0x10ac('0x1b')]||null:null,'limit':_0x23c083['options']?_0x23c083[_0x10ac('0x18')]['limit']||null:null,'include':_0x23c083['options']?_0x23c083[_0x10ac('0x18')][_0x10ac('0x1c')]?_[_0x10ac('0x1d')](_0x23c083[_0x10ac('0x18')][_0x10ac('0x1c')],function(_0x260f09){return{'model':db[_0x260f09[_0x10ac('0x1e')]],'as':_0x260f09['as'],'attributes':_0x260f09[_0x10ac('0x1b')],'include':_0x260f09[_0x10ac('0x1c')]?_[_0x10ac('0x1d')](_0x260f09[_0x10ac('0x1c')],function(_0x2ed4ce){return{'model':db[_0x2ed4ce[_0x10ac('0x1e')]],'as':_0x2ed4ce['as'],'attributes':_0x2ed4ce['attributes'],'include':_0x2ed4ce[_0x10ac('0x1c')]?_['map'](_0x2ed4ce['include'],function(_0x3c2302){return{'model':db[_0x3c2302[_0x10ac('0x1e')]],'as':_0x3c2302['as'],'attributes':_0x3c2302[_0x10ac('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x10ac('0xa')](function(_0x3fe685){logger[_0x10ac('0x13')](_0x10ac('0x16'),_0x23c083);logger[_0x10ac('0xd')](_0x10ac('0x16'),_0x23c083,JSON[_0x10ac('0xf')](_0x3fe685));_0x278a7b(_0x3fe685);})[_0x10ac('0x15')](function(_0x31cebf){logger[_0x10ac('0x10')](_0x10ac('0x16'),_0x31cebf[_0x10ac('0x12')],_0x23c083);_0x2b24ad(_0x434c09['error'](0x1f4,_0x31cebf[_0x10ac('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x66cd2b){var _0x186318=this;return new Promise(function(_0x15332d,_0x138453){return db[_0x10ac('0x1f')][_0x10ac('0x20')]({'raw':_0x66cd2b[_0x10ac('0x18')]?_0x66cd2b[_0x10ac('0x18')][_0x10ac('0x19')]===undefined?!![]:![]:!![],'where':_0x66cd2b['options']?_0x66cd2b['options'][_0x10ac('0x1a')]||null:null,'attributes':_0x66cd2b['options']?_0x66cd2b[_0x10ac('0x18')][_0x10ac('0x1b')]||null:null,'include':_0x66cd2b['options']?_0x66cd2b[_0x10ac('0x18')][_0x10ac('0x1c')]?_['map'](_0x66cd2b[_0x10ac('0x18')]['include'],function(_0x3ee983){return{'model':db[_0x3ee983['model']],'as':_0x3ee983['as'],'attributes':_0x3ee983['attributes'],'include':_0x3ee983[_0x10ac('0x1c')]?_[_0x10ac('0x1d')](_0x3ee983[_0x10ac('0x1c')],function(_0x4c036b){return{'model':db[_0x4c036b['model']],'as':_0x4c036b['as'],'attributes':_0x4c036b['attributes'],'include':_0x4c036b['include']?_[_0x10ac('0x1d')](_0x4c036b[_0x10ac('0x1c')],function(_0x1c073f){return{'model':db[_0x1c073f['model']],'as':_0x1c073f['as'],'attributes':_0x1c073f[_0x10ac('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x10ac('0xa')](function(_0x39ccd3){logger[_0x10ac('0x13')](_0x10ac('0x21'),_0x66cd2b);logger[_0x10ac('0xd')]('ShowZendeskAccount',_0x66cd2b,JSON[_0x10ac('0xf')](_0x39ccd3));_0x15332d(_0x39ccd3);})[_0x10ac('0x15')](function(_0x4718cc){logger['error'](_0x10ac('0x21'),_0x4718cc[_0x10ac('0x12')],_0x66cd2b);_0x138453(_0x186318[_0x10ac('0x10')](0x1f4,_0x4718cc[_0x10ac('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 3f77396..2e9400d 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3d2580,_0x5bcf59){_0x3d2580=_0x3d2580-0x0;var _0x1bed34=_0xbdb7[_0x3d2580];return _0x1bed34;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5ed099,_0x304e8a){var _0x46e1d7=function(_0x2b57f1){while(--_0x2b57f1){_0x5ed099['push'](_0x5ed099['shift']());}};_0x46e1d7(++_0x304e8a);}(_0xac4a,0x13f));var _0xaac4=function(_0x5a2ee2,_0x2dcc19){_0x5a2ee2=_0x5a2ee2-0x0;var _0xf2fcb7=_0xac4a[_0x5a2ee2];return _0xf2fcb7;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 84aab86..68d8271 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 _0x2811=['sequelize','exports','STRING'];(function(_0x135b81,_0x39db4b){var _0x5d8a8e=function(_0x3a7614){while(--_0x3a7614){_0x135b81['push'](_0x135b81['shift']());}};_0x5d8a8e(++_0x39db4b);}(_0x2811,0x120));var _0x1281=function(_0x27a709,_0x1adf5e){_0x27a709=_0x27a709-0x0;var _0x45918b=_0x2811[_0x27a709];return _0x45918b;};'use strict';var Sequelize=require(_0x1281('0x0'));module[_0x1281('0x1')]={'name':{'type':Sequelize[_0x1281('0x2')]},'description':{'type':Sequelize[_0x1281('0x2')]}}; \ No newline at end of file +var _0xa20d=['exports','STRING','sequelize'];(function(_0x4f3d00,_0x188abc){var _0x484889=function(_0x13eb9c){while(--_0x13eb9c){_0x4f3d00['push'](_0x4f3d00['shift']());}};_0x484889(++_0x188abc);}(_0xa20d,0xb3));var _0xda20=function(_0x3d3c75,_0x36f20d){_0x3d3c75=_0x3d3c75-0x0;var _0x1f3063=_0xa20d[_0x3d3c75];return _0x1f3063;};'use strict';var Sequelize=require(_0xda20('0x0'));module[_0xda20('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xda20('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4663d68..91a5f3f 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 _0x91a0=['keys','options','catch','create','body','update','find','getFields','findOne','ZendeskField','order','sort','getSubjects','getDescriptions','pick','Tag','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','where','filter','merge','includeAll','findAll','rows','show','params'];(function(_0x1602db,_0x3f9684){var _0x3d7dc5=function(_0x539f8d){while(--_0x539f8d){_0x1602db['push'](_0x1602db['shift']());}};_0x3d7dc5(++_0x3f9684);}(_0x91a0,0x173));var _0x091a=function(_0x12fcbd,_0x884804){_0x12fcbd=_0x12fcbd-0x0;var _0x28ec2a=_0x91a0[_0x12fcbd];return _0x28ec2a;};'use strict';var emlformat=require(_0x091a('0x0'));var rimraf=require(_0x091a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x091a('0x2'));var moment=require(_0x091a('0x3'));var BPromise=require(_0x091a('0x4'));var Mustache=require(_0x091a('0x5'));var util=require(_0x091a('0x6'));var path=require(_0x091a('0x7'));var sox=require(_0x091a('0x8'));var csv=require(_0x091a('0x9'));var ejs=require(_0x091a('0xa'));var fs=require('fs');var fs_extra=require(_0x091a('0xb'));var _=require('lodash');var squel=require(_0x091a('0xc'));var crypto=require(_0x091a('0xd'));var jsforce=require(_0x091a('0xe'));var deskjs=require(_0x091a('0xf'));var toCsv=require(_0x091a('0x9'));var querystring=require(_0x091a('0x10'));var Papa=require(_0x091a('0x11'));var Redis=require(_0x091a('0x12'));var authService=require(_0x091a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x091a('0x14'));var hardwareService=require(_0x091a('0x15'));var logger=require(_0x091a('0x16'))(_0x091a('0x17'));var utils=require(_0x091a('0x18'));var config=require(_0x091a('0x19'));var licenseUtil=require(_0x091a('0x1a'));var db=require(_0x091a('0x1b'))['db'];function respondWithStatusCode(_0x1478b9,_0x1a0699){_0x1a0699=_0x1a0699||0xcc;return function(_0x47b4da){if(_0x47b4da){return _0x1478b9[_0x091a('0x1c')](_0x1a0699);}return _0x1478b9[_0x091a('0x1d')](_0x1a0699)['end']();};}function respondWithResult(_0x29e4f3,_0x47ebb7){_0x47ebb7=_0x47ebb7||0xc8;return function(_0x1aae77){if(_0x1aae77){return _0x29e4f3[_0x091a('0x1d')](_0x47ebb7)[_0x091a('0x1e')](_0x1aae77);}};}function respondWithFilteredResult(_0x20cbb4,_0x379dc1){return function(_0x10ebfc){if(_0x10ebfc){var _0x5660fd=typeof _0x379dc1[_0x091a('0x1f')]===_0x091a('0x20')&&typeof _0x379dc1[_0x091a('0x21')]===_0x091a('0x20');var _0x10bfa8=_0x10ebfc[_0x091a('0x22')];var _0x2eb354=_0x5660fd?0x0:_0x379dc1[_0x091a('0x1f')];var _0x229e17=_0x5660fd?_0x10ebfc[_0x091a('0x22')]:_0x379dc1[_0x091a('0x1f')]+_0x379dc1[_0x091a('0x21')];var _0x3f3497;if(_0x229e17>=_0x10bfa8){_0x229e17=_0x10bfa8;_0x3f3497=0xc8;}else{_0x3f3497=0xce;}_0x20cbb4[_0x091a('0x1d')](_0x3f3497);return _0x20cbb4[_0x091a('0x23')](_0x091a('0x24'),_0x2eb354+'-'+_0x229e17+'/'+_0x10bfa8)['json'](_0x10ebfc);}return null;};}function patchUpdates(_0x339c18){return function(_0x4b2f09){try{jsonpatch[_0x091a('0x25')](_0x4b2f09,_0x339c18,!![]);}catch(_0x4f2c68){return BPromise[_0x091a('0x26')](_0x4f2c68);}return _0x4b2f09[_0x091a('0x27')]();};}function saveUpdates(_0x7eb9cd,_0x33f03c){return function(_0x184181){if(_0x184181){return _0x184181['update'](_0x7eb9cd)[_0x091a('0x28')](function(_0x540c48){return _0x540c48;});}return null;};}function removeEntity(_0x8a20e2,_0x309dee){return function(_0x4fadd4){if(_0x4fadd4){return _0x4fadd4[_0x091a('0x29')]()[_0x091a('0x28')](function(){_0x8a20e2[_0x091a('0x1d')](0xcc)[_0x091a('0x2a')]();});}};}function handleEntityNotFound(_0x5954a8,_0x1d1125){return function(_0x200b69){if(!_0x200b69){_0x5954a8[_0x091a('0x1c')](0x194);}return _0x200b69;};}function handleError(_0x4b75d1,_0x2d7e5d){_0x2d7e5d=_0x2d7e5d||0x1f4;return function(_0x13a5b5){logger['error'](_0x13a5b5[_0x091a('0x2b')]);if(_0x13a5b5[_0x091a('0x2c')]){delete _0x13a5b5['name'];}_0x4b75d1[_0x091a('0x1d')](_0x2d7e5d)['send'](_0x13a5b5);};}exports[_0x091a('0x2d')]=function(_0x366be5,_0x361db1){var _0x4c4948={},_0x531774={},_0x10a9be={'count':0x0,'rows':[]};var _0x593862=_[_0x091a('0x2e')](db[_0x091a('0x2f')][_0x091a('0x30')],function(_0x4ea1d7){return{'name':_0x4ea1d7[_0x091a('0x31')],'type':_0x4ea1d7[_0x091a('0x32')][_0x091a('0x33')]};});_0x531774['model']=_['map'](_0x593862,_0x091a('0x2c'));_0x531774[_0x091a('0x34')]=_['keys'](_0x366be5['query']);_0x531774[_0x091a('0x35')]=_[_0x091a('0x36')](_0x531774['model'],_0x531774[_0x091a('0x34')]);_0x4c4948[_0x091a('0x37')]=_[_0x091a('0x36')](_0x531774[_0x091a('0x38')],qs[_0x091a('0x39')](_0x366be5[_0x091a('0x34')]['fields']));_0x4c4948[_0x091a('0x37')]=_0x4c4948['attributes'][_0x091a('0x3a')]?_0x4c4948['attributes']:_0x531774[_0x091a('0x38')];if(!_0x366be5[_0x091a('0x34')][_0x091a('0x3b')](_0x091a('0x3c'))){_0x4c4948[_0x091a('0x21')]=qs['limit'](_0x366be5[_0x091a('0x34')]['limit']);_0x4c4948[_0x091a('0x1f')]=qs[_0x091a('0x1f')](_0x366be5[_0x091a('0x34')][_0x091a('0x1f')]);}_0x4c4948['order']=qs['sort'](_0x366be5['query']['sort']);_0x4c4948[_0x091a('0x3d')]=qs[_0x091a('0x35')](_['pick'](_0x366be5[_0x091a('0x34')],_0x531774[_0x091a('0x35')]),_0x593862);if(_0x366be5[_0x091a('0x34')][_0x091a('0x3e')]){_0x4c4948[_0x091a('0x3d')]=_[_0x091a('0x3f')](_0x4c4948[_0x091a('0x3d')],{'$or':_['map'](_0x593862,function(_0x4e3064){if(_0x4e3064[_0x091a('0x32')]!=='VIRTUAL'){var _0x3cbb08={};_0x3cbb08[_0x4e3064[_0x091a('0x2c')]]={'$like':'%'+_0x366be5[_0x091a('0x34')][_0x091a('0x3e')]+'%'};return _0x3cbb08;}})});}_0x4c4948=_[_0x091a('0x3f')]({},_0x4c4948,_0x366be5['options']);var _0x4eba8a={'where':_0x4c4948['where']};return db['ZendeskConfiguration']['count'](_0x4eba8a)['then'](function(_0x8ab879){_0x10a9be[_0x091a('0x22')]=_0x8ab879;if(_0x366be5[_0x091a('0x34')][_0x091a('0x40')]){_0x4c4948['include']=[{'all':!![]}];}return db[_0x091a('0x2f')][_0x091a('0x41')](_0x4c4948);})[_0x091a('0x28')](function(_0x4c42c0){_0x10a9be[_0x091a('0x42')]=_0x4c42c0;return _0x10a9be;})[_0x091a('0x28')](respondWithFilteredResult(_0x361db1,_0x4c4948))['catch'](handleError(_0x361db1,null));};exports[_0x091a('0x43')]=function(_0x1655cf,_0x431be7){var _0x31f1b8={'raw':![],'where':{'id':_0x1655cf[_0x091a('0x44')]['id']}},_0x3447cf={};_0x3447cf[_0x091a('0x38')]=_[_0x091a('0x45')](db[_0x091a('0x2f')][_0x091a('0x30')]);_0x3447cf[_0x091a('0x34')]=_['keys'](_0x1655cf['query']);_0x3447cf[_0x091a('0x35')]=_[_0x091a('0x36')](_0x3447cf[_0x091a('0x38')],_0x3447cf[_0x091a('0x34')]);_0x31f1b8[_0x091a('0x37')]=_[_0x091a('0x36')](_0x3447cf[_0x091a('0x38')],qs[_0x091a('0x39')](_0x1655cf[_0x091a('0x34')][_0x091a('0x39')]));_0x31f1b8[_0x091a('0x37')]=_0x31f1b8[_0x091a('0x37')]['length']?_0x31f1b8['attributes']:_0x3447cf[_0x091a('0x38')];if(_0x1655cf[_0x091a('0x34')][_0x091a('0x40')]){_0x31f1b8['include']=[{'all':!![]}];}_0x31f1b8=_[_0x091a('0x3f')]({},_0x31f1b8,_0x1655cf[_0x091a('0x46')]);return db[_0x091a('0x2f')]['find'](_0x31f1b8)[_0x091a('0x28')](handleEntityNotFound(_0x431be7,null))['then'](respondWithResult(_0x431be7,null))[_0x091a('0x47')](handleError(_0x431be7,null));};exports[_0x091a('0x48')]=function(_0x55e2ee,_0x5b6cbd){return db['ZendeskConfiguration'][_0x091a('0x48')](_0x55e2ee[_0x091a('0x49')],{})[_0x091a('0x28')](respondWithResult(_0x5b6cbd,0xc9))['catch'](handleError(_0x5b6cbd,null));};exports[_0x091a('0x4a')]=function(_0xce0c0a,_0x59167a){if(_0xce0c0a[_0x091a('0x49')]['id']){delete _0xce0c0a[_0x091a('0x49')]['id'];}return db[_0x091a('0x2f')][_0x091a('0x4b')]({'where':{'id':_0xce0c0a[_0x091a('0x44')]['id']}})[_0x091a('0x28')](handleEntityNotFound(_0x59167a,null))[_0x091a('0x28')](saveUpdates(_0xce0c0a[_0x091a('0x49')],null))[_0x091a('0x28')](respondWithResult(_0x59167a,null))[_0x091a('0x47')](handleError(_0x59167a,null));};exports[_0x091a('0x29')]=function(_0x4e1dfc,_0x5c8798){return db['ZendeskConfiguration'][_0x091a('0x4b')]({'where':{'id':_0x4e1dfc[_0x091a('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c8798,null))[_0x091a('0x28')](removeEntity(_0x5c8798,null))[_0x091a('0x47')](handleError(_0x5c8798,null));};exports[_0x091a('0x4c')]=function(_0x276611,_0x503cfc,_0x59d975){var _0x27f100={};var _0x15c771={};var _0x3800d5;var _0x1a29e2;return db[_0x091a('0x2f')][_0x091a('0x4d')]({'where':{'id':_0x276611[_0x091a('0x44')]['id']}})[_0x091a('0x28')](handleEntityNotFound(_0x503cfc,null))[_0x091a('0x28')](function(_0x14aae6){if(_0x14aae6){_0x3800d5=_0x14aae6;_0x15c771[_0x091a('0x38')]=_[_0x091a('0x45')](db[_0x091a('0x4e')]['rawAttributes']);_0x15c771[_0x091a('0x34')]=_[_0x091a('0x45')](_0x276611[_0x091a('0x34')]);_0x15c771[_0x091a('0x35')]=_['intersection'](_0x15c771['model'],_0x15c771[_0x091a('0x34')]);_0x27f100[_0x091a('0x37')]=_[_0x091a('0x36')](_0x15c771[_0x091a('0x38')],qs[_0x091a('0x39')](_0x276611[_0x091a('0x34')]['fields']));_0x27f100[_0x091a('0x37')]=_0x27f100[_0x091a('0x37')][_0x091a('0x3a')]?_0x27f100[_0x091a('0x37')]:_0x15c771[_0x091a('0x38')];_0x27f100[_0x091a('0x4f')]=qs['sort'](_0x276611['query'][_0x091a('0x50')]);_0x27f100[_0x091a('0x3d')]=qs[_0x091a('0x35')](_['pick'](_0x276611[_0x091a('0x34')],_0x15c771[_0x091a('0x35')]));if(_0x276611[_0x091a('0x34')][_0x091a('0x3e')]){_0x27f100[_0x091a('0x3d')]=_[_0x091a('0x3f')](_0x27f100[_0x091a('0x3d')],{'$or':_[_0x091a('0x2e')](_0x27f100[_0x091a('0x37')],function(_0xba9194){var _0x511936={};_0x511936[_0xba9194]={'$like':'%'+_0x276611[_0x091a('0x34')][_0x091a('0x3e')]+'%'};return _0x511936;})});}_0x27f100=_[_0x091a('0x3f')]({},_0x27f100,_0x276611[_0x091a('0x46')]);return _0x3800d5[_0x091a('0x4c')](_0x27f100);}})[_0x091a('0x28')](function(_0x747ab6){if(_0x747ab6){_0x1a29e2=_0x747ab6[_0x091a('0x3a')];if(!_0x276611['query'][_0x091a('0x3b')]('nolimit')){_0x27f100[_0x091a('0x21')]=qs[_0x091a('0x21')](_0x276611['query']['limit']);_0x27f100[_0x091a('0x1f')]=qs['offset'](_0x276611[_0x091a('0x34')][_0x091a('0x1f')]);}return _0x3800d5['getFields'](_0x27f100);}})['then'](function(_0x2c8440){if(_0x2c8440){return _0x2c8440?{'count':_0x1a29e2,'rows':_0x2c8440}:null;}})[_0x091a('0x28')](respondWithResult(_0x503cfc,null))[_0x091a('0x47')](handleError(_0x503cfc,null));};exports[_0x091a('0x51')]=function(_0x4ce90a,_0x16c1e7,_0xa1ca73){var _0x4a9334={};var _0x17457b={};var _0x194847;var _0x1152c7;return db[_0x091a('0x2f')][_0x091a('0x4d')]({'where':{'id':_0x4ce90a[_0x091a('0x44')]['id']}})[_0x091a('0x28')](handleEntityNotFound(_0x16c1e7,null))[_0x091a('0x28')](function(_0x4ff66c){if(_0x4ff66c){_0x194847=_0x4ff66c;_0x17457b[_0x091a('0x38')]=_[_0x091a('0x45')](db['ZendeskField'][_0x091a('0x30')]);_0x17457b[_0x091a('0x34')]=_[_0x091a('0x45')](_0x4ce90a['query']);_0x17457b['filters']=_['intersection'](_0x17457b['model'],_0x17457b['query']);_0x4a9334['attributes']=_[_0x091a('0x36')](_0x17457b[_0x091a('0x38')],qs[_0x091a('0x39')](_0x4ce90a[_0x091a('0x34')]['fields']));_0x4a9334['attributes']=_0x4a9334[_0x091a('0x37')][_0x091a('0x3a')]?_0x4a9334[_0x091a('0x37')]:_0x17457b[_0x091a('0x38')];_0x4a9334[_0x091a('0x4f')]=qs[_0x091a('0x50')](_0x4ce90a['query'][_0x091a('0x50')]);_0x4a9334[_0x091a('0x3d')]=qs[_0x091a('0x35')](_['pick'](_0x4ce90a['query'],_0x17457b[_0x091a('0x35')]));if(_0x4ce90a['query']['filter']){_0x4a9334[_0x091a('0x3d')]=_[_0x091a('0x3f')](_0x4a9334['where'],{'$or':_['map'](_0x4a9334[_0x091a('0x37')],function(_0x56eb26){var _0x10a2e4={};_0x10a2e4[_0x56eb26]={'$like':'%'+_0x4ce90a[_0x091a('0x34')]['filter']+'%'};return _0x10a2e4;})});}_0x4a9334=_['merge']({},_0x4a9334,_0x4ce90a[_0x091a('0x46')]);return _0x194847[_0x091a('0x51')](_0x4a9334);}})[_0x091a('0x28')](function(_0x3d3d26){if(_0x3d3d26){_0x1152c7=_0x3d3d26[_0x091a('0x3a')];if(!_0x4ce90a[_0x091a('0x34')][_0x091a('0x3b')](_0x091a('0x3c'))){_0x4a9334['limit']=qs['limit'](_0x4ce90a['query'][_0x091a('0x21')]);_0x4a9334[_0x091a('0x1f')]=qs['offset'](_0x4ce90a[_0x091a('0x34')]['offset']);}return _0x194847['getSubjects'](_0x4a9334);}})[_0x091a('0x28')](function(_0x1fcb78){if(_0x1fcb78){return _0x1fcb78?{'count':_0x1152c7,'rows':_0x1fcb78}:null;}})[_0x091a('0x28')](respondWithResult(_0x16c1e7,null))[_0x091a('0x47')](handleError(_0x16c1e7,null));};exports[_0x091a('0x52')]=function(_0x29bddb,_0x178e06,_0x3f5b9b){var _0x4105a9={};var _0x40c3cc={};var _0x326c9b;var _0x396246;return db['ZendeskConfiguration'][_0x091a('0x4d')]({'where':{'id':_0x29bddb[_0x091a('0x44')]['id']}})['then'](handleEntityNotFound(_0x178e06,null))[_0x091a('0x28')](function(_0x1b13f8){if(_0x1b13f8){_0x326c9b=_0x1b13f8;_0x40c3cc[_0x091a('0x38')]=_[_0x091a('0x45')](db[_0x091a('0x4e')]['rawAttributes']);_0x40c3cc[_0x091a('0x34')]=_[_0x091a('0x45')](_0x29bddb[_0x091a('0x34')]);_0x40c3cc[_0x091a('0x35')]=_['intersection'](_0x40c3cc[_0x091a('0x38')],_0x40c3cc['query']);_0x4105a9['attributes']=_[_0x091a('0x36')](_0x40c3cc[_0x091a('0x38')],qs[_0x091a('0x39')](_0x29bddb[_0x091a('0x34')][_0x091a('0x39')]));_0x4105a9['attributes']=_0x4105a9['attributes'][_0x091a('0x3a')]?_0x4105a9[_0x091a('0x37')]:_0x40c3cc[_0x091a('0x38')];_0x4105a9[_0x091a('0x4f')]=qs[_0x091a('0x50')](_0x29bddb['query'][_0x091a('0x50')]);_0x4105a9['where']=qs['filters'](_[_0x091a('0x53')](_0x29bddb[_0x091a('0x34')],_0x40c3cc[_0x091a('0x35')]));if(_0x29bddb['query'][_0x091a('0x3e')]){_0x4105a9[_0x091a('0x3d')]=_['merge'](_0x4105a9[_0x091a('0x3d')],{'$or':_[_0x091a('0x2e')](_0x4105a9['attributes'],function(_0xc5c01c){var _0x2d3137={};_0x2d3137[_0xc5c01c]={'$like':'%'+_0x29bddb['query'][_0x091a('0x3e')]+'%'};return _0x2d3137;})});}_0x4105a9=_[_0x091a('0x3f')]({},_0x4105a9,_0x29bddb[_0x091a('0x46')]);return _0x326c9b[_0x091a('0x52')](_0x4105a9);}})[_0x091a('0x28')](function(_0x322df5){if(_0x322df5){_0x396246=_0x322df5['length'];if(!_0x29bddb[_0x091a('0x34')]['hasOwnProperty'](_0x091a('0x3c'))){_0x4105a9[_0x091a('0x21')]=qs['limit'](_0x29bddb['query'][_0x091a('0x21')]);_0x4105a9[_0x091a('0x1f')]=qs[_0x091a('0x1f')](_0x29bddb['query'][_0x091a('0x1f')]);}return _0x326c9b['getDescriptions'](_0x4105a9);}})[_0x091a('0x28')](function(_0x31f408){if(_0x31f408){return _0x31f408?{'count':_0x396246,'rows':_0x31f408}:null;}})[_0x091a('0x28')](respondWithResult(_0x178e06,null))[_0x091a('0x47')](handleError(_0x178e06,null));};exports['getTags']=function(_0x45dbff,_0x3ff5a1,_0x2bb8b9){var _0x38f186={};var _0x43b30b={};var _0x4a77e3;var _0x4f22a0;return db[_0x091a('0x2f')][_0x091a('0x4d')]({'where':{'id':_0x45dbff[_0x091a('0x44')]['id']}})[_0x091a('0x28')](handleEntityNotFound(_0x3ff5a1,null))['then'](function(_0x56e958){if(_0x56e958){_0x4a77e3=_0x56e958;_0x43b30b[_0x091a('0x38')]=_[_0x091a('0x45')](db[_0x091a('0x54')][_0x091a('0x30')]);_0x43b30b[_0x091a('0x34')]=_[_0x091a('0x45')](_0x45dbff[_0x091a('0x34')]);_0x43b30b[_0x091a('0x35')]=_['intersection'](_0x43b30b[_0x091a('0x38')],_0x43b30b[_0x091a('0x34')]);_0x38f186[_0x091a('0x37')]=_[_0x091a('0x36')](_0x43b30b['model'],qs[_0x091a('0x39')](_0x45dbff[_0x091a('0x34')][_0x091a('0x39')]));_0x38f186[_0x091a('0x37')]=_0x38f186[_0x091a('0x37')][_0x091a('0x3a')]?_0x38f186['attributes']:_0x43b30b[_0x091a('0x38')];_0x38f186[_0x091a('0x4f')]=qs['sort'](_0x45dbff[_0x091a('0x34')][_0x091a('0x50')]);_0x38f186[_0x091a('0x3d')]=qs[_0x091a('0x35')](_[_0x091a('0x53')](_0x45dbff['query'],_0x43b30b['filters']));if(_0x45dbff[_0x091a('0x34')]['filter']){_0x38f186[_0x091a('0x3d')]=_[_0x091a('0x3f')](_0x38f186['where'],{'$or':_[_0x091a('0x2e')](_0x38f186[_0x091a('0x37')],function(_0x58228d){var _0x54a913={};_0x54a913[_0x58228d]={'$like':'%'+_0x45dbff[_0x091a('0x34')][_0x091a('0x3e')]+'%'};return _0x54a913;})});}_0x38f186=_['merge']({},_0x38f186,_0x45dbff[_0x091a('0x46')]);return _0x4a77e3[_0x091a('0x55')](_0x38f186);}})[_0x091a('0x28')](function(_0x6c7462){if(_0x6c7462){_0x4f22a0=_0x6c7462[_0x091a('0x3a')];if(!_0x45dbff['query']['hasOwnProperty'](_0x091a('0x3c'))){_0x38f186[_0x091a('0x21')]=qs[_0x091a('0x21')](_0x45dbff[_0x091a('0x34')]['limit']);_0x38f186['offset']=qs[_0x091a('0x1f')](_0x45dbff['query'][_0x091a('0x1f')]);}return _0x4a77e3['getTags'](_0x38f186);}})['then'](function(_0xe199b0){if(_0xe199b0){return _0xe199b0?{'count':_0x4f22a0,'rows':_0xe199b0}:null;}})[_0x091a('0x28')](respondWithResult(_0x3ff5a1,null))[_0x091a('0x47')](handleError(_0x3ff5a1,null));};exports['setTags']=function(_0x2eb310,_0x18d237,_0x17a9b3){if(_0x2eb310['body']['id']){delete _0x2eb310[_0x091a('0x49')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2eb310[_0x091a('0x44')]['id']}})['then'](handleEntityNotFound(_0x18d237,null))[_0x091a('0x28')](function(_0x218b2b){if(_0x218b2b){return _0x218b2b[_0x091a('0x56')](_0x2eb310[_0x091a('0x49')][_0x091a('0x57')]||[]);}return null;})['then'](respondWithResult(_0x18d237,null))[_0x091a('0x47')](handleError(_0x18d237,null));}; \ No newline at end of file +var _0x1b51=['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','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','getSubjects','ZendeskField','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x1b51,0xa0));var _0x11b5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1b51[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x11b5('0x0'));var rimraf=require(_0x11b5('0x1'));var zipdir=require(_0x11b5('0x2'));var jsonpatch=require(_0x11b5('0x3'));var rp=require(_0x11b5('0x4'));var moment=require(_0x11b5('0x5'));var BPromise=require(_0x11b5('0x6'));var Mustache=require(_0x11b5('0x7'));var util=require(_0x11b5('0x8'));var path=require(_0x11b5('0x9'));var sox=require(_0x11b5('0xa'));var csv=require(_0x11b5('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11b5('0xc'));var _=require(_0x11b5('0xd'));var squel=require(_0x11b5('0xe'));var crypto=require(_0x11b5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x11b5('0x10'));var toCsv=require(_0x11b5('0xb'));var querystring=require('querystring');var Papa=require(_0x11b5('0x11'));var Redis=require(_0x11b5('0x12'));var authService=require(_0x11b5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x11b5('0x14'));var hardwareService=require(_0x11b5('0x15'));var logger=require(_0x11b5('0x16'))('api');var utils=require(_0x11b5('0x17'));var config=require(_0x11b5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x11b5('0x19'))['db'];function respondWithStatusCode(_0x4a7339,_0x2bd553){_0x2bd553=_0x2bd553||0xcc;return function(_0x236054){if(_0x236054){return _0x4a7339[_0x11b5('0x1a')](_0x2bd553);}return _0x4a7339['status'](_0x2bd553)[_0x11b5('0x1b')]();};}function respondWithResult(_0x143000,_0x2f4895){_0x2f4895=_0x2f4895||0xc8;return function(_0x27b386){if(_0x27b386){return _0x143000['status'](_0x2f4895)[_0x11b5('0x1c')](_0x27b386);}};}function respondWithFilteredResult(_0x29ad3f,_0x3f00be){return function(_0x3e5785){if(_0x3e5785){var _0x3e0ce6=typeof _0x3f00be[_0x11b5('0x1d')]===_0x11b5('0x1e')&&typeof _0x3f00be[_0x11b5('0x1f')]==='undefined';var _0x95bab1=_0x3e5785['count'];var _0x17353b=_0x3e0ce6?0x0:_0x3f00be[_0x11b5('0x1d')];var _0x4a8de6=_0x3e0ce6?_0x3e5785[_0x11b5('0x20')]:_0x3f00be[_0x11b5('0x1d')]+_0x3f00be[_0x11b5('0x1f')];var _0x4e9187;if(_0x4a8de6>=_0x95bab1){_0x4a8de6=_0x95bab1;_0x4e9187=0xc8;}else{_0x4e9187=0xce;}_0x29ad3f[_0x11b5('0x21')](_0x4e9187);return _0x29ad3f[_0x11b5('0x22')](_0x11b5('0x23'),_0x17353b+'-'+_0x4a8de6+'/'+_0x95bab1)[_0x11b5('0x1c')](_0x3e5785);}return null;};}function patchUpdates(_0x959bcd){return function(_0x4f1ec9){try{jsonpatch[_0x11b5('0x24')](_0x4f1ec9,_0x959bcd,!![]);}catch(_0x2d82fb){return BPromise[_0x11b5('0x25')](_0x2d82fb);}return _0x4f1ec9[_0x11b5('0x26')]();};}function saveUpdates(_0x420beb,_0x34812b){return function(_0x3b9ccd){if(_0x3b9ccd){return _0x3b9ccd[_0x11b5('0x27')](_0x420beb)[_0x11b5('0x28')](function(_0x3a42dc){return _0x3a42dc;});}return null;};}function removeEntity(_0x53dd32,_0x1b642b){return function(_0x756ca8){if(_0x756ca8){return _0x756ca8[_0x11b5('0x29')]()[_0x11b5('0x28')](function(){_0x53dd32[_0x11b5('0x21')](0xcc)[_0x11b5('0x1b')]();});}};}function handleEntityNotFound(_0x1d7061,_0x597c0){return function(_0x440f1d){if(!_0x440f1d){_0x1d7061[_0x11b5('0x1a')](0x194);}return _0x440f1d;};}function handleError(_0x4e9168,_0x1743fc){_0x1743fc=_0x1743fc||0x1f4;return function(_0x39f325){logger['error'](_0x39f325[_0x11b5('0x2a')]);if(_0x39f325[_0x11b5('0x2b')]){delete _0x39f325['name'];}_0x4e9168['status'](_0x1743fc)[_0x11b5('0x2c')](_0x39f325);};}exports[_0x11b5('0x2d')]=function(_0x2a4854,_0x4a9860){var _0x2b24fa={},_0x610408={},_0x48682d={'count':0x0,'rows':[]};var _0x2f9a20=_['map'](db[_0x11b5('0x2e')]['rawAttributes'],function(_0x59b21d){return{'name':_0x59b21d[_0x11b5('0x2f')],'type':_0x59b21d[_0x11b5('0x30')][_0x11b5('0x31')]};});_0x610408[_0x11b5('0x32')]=_[_0x11b5('0x33')](_0x2f9a20,_0x11b5('0x2b'));_0x610408['query']=_[_0x11b5('0x34')](_0x2a4854[_0x11b5('0x35')]);_0x610408[_0x11b5('0x36')]=_[_0x11b5('0x37')](_0x610408[_0x11b5('0x32')],_0x610408[_0x11b5('0x35')]);_0x2b24fa[_0x11b5('0x38')]=_[_0x11b5('0x37')](_0x610408[_0x11b5('0x32')],qs[_0x11b5('0x39')](_0x2a4854['query'][_0x11b5('0x39')]));_0x2b24fa[_0x11b5('0x38')]=_0x2b24fa[_0x11b5('0x38')][_0x11b5('0x3a')]?_0x2b24fa[_0x11b5('0x38')]:_0x610408[_0x11b5('0x32')];if(!_0x2a4854[_0x11b5('0x35')][_0x11b5('0x3b')](_0x11b5('0x3c'))){_0x2b24fa[_0x11b5('0x1f')]=qs['limit'](_0x2a4854[_0x11b5('0x35')][_0x11b5('0x1f')]);_0x2b24fa[_0x11b5('0x1d')]=qs[_0x11b5('0x1d')](_0x2a4854[_0x11b5('0x35')][_0x11b5('0x1d')]);}_0x2b24fa[_0x11b5('0x3d')]=qs[_0x11b5('0x3e')](_0x2a4854['query'][_0x11b5('0x3e')]);_0x2b24fa[_0x11b5('0x3f')]=qs[_0x11b5('0x36')](_[_0x11b5('0x40')](_0x2a4854[_0x11b5('0x35')],_0x610408[_0x11b5('0x36')]),_0x2f9a20);if(_0x2a4854['query'][_0x11b5('0x41')]){_0x2b24fa[_0x11b5('0x3f')]=_[_0x11b5('0x42')](_0x2b24fa[_0x11b5('0x3f')],{'$or':_['map'](_0x2f9a20,function(_0x1be66d){if(_0x1be66d['type']!==_0x11b5('0x43')){var _0x4acc71={};_0x4acc71[_0x1be66d[_0x11b5('0x2b')]]={'$like':'%'+_0x2a4854[_0x11b5('0x35')][_0x11b5('0x41')]+'%'};return _0x4acc71;}})});}_0x2b24fa=_['merge']({},_0x2b24fa,_0x2a4854[_0x11b5('0x44')]);var _0x326913={'where':_0x2b24fa[_0x11b5('0x3f')]};return db[_0x11b5('0x2e')][_0x11b5('0x20')](_0x326913)[_0x11b5('0x28')](function(_0x94d521){_0x48682d['count']=_0x94d521;if(_0x2a4854[_0x11b5('0x35')][_0x11b5('0x45')]){_0x2b24fa[_0x11b5('0x46')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x2b24fa);})[_0x11b5('0x28')](function(_0x25c757){_0x48682d[_0x11b5('0x47')]=_0x25c757;return _0x48682d;})['then'](respondWithFilteredResult(_0x4a9860,_0x2b24fa))[_0x11b5('0x48')](handleError(_0x4a9860,null));};exports[_0x11b5('0x49')]=function(_0x2ac213,_0x5efccc){var _0xd61f9a={'raw':![],'where':{'id':_0x2ac213[_0x11b5('0x4a')]['id']}},_0x44efeb={};_0x44efeb[_0x11b5('0x32')]=_['keys'](db[_0x11b5('0x2e')][_0x11b5('0x4b')]);_0x44efeb[_0x11b5('0x35')]=_['keys'](_0x2ac213[_0x11b5('0x35')]);_0x44efeb['filters']=_[_0x11b5('0x37')](_0x44efeb['model'],_0x44efeb['query']);_0xd61f9a[_0x11b5('0x38')]=_[_0x11b5('0x37')](_0x44efeb[_0x11b5('0x32')],qs[_0x11b5('0x39')](_0x2ac213[_0x11b5('0x35')][_0x11b5('0x39')]));_0xd61f9a[_0x11b5('0x38')]=_0xd61f9a[_0x11b5('0x38')]['length']?_0xd61f9a['attributes']:_0x44efeb[_0x11b5('0x32')];if(_0x2ac213[_0x11b5('0x35')][_0x11b5('0x45')]){_0xd61f9a[_0x11b5('0x46')]=[{'all':!![]}];}_0xd61f9a=_[_0x11b5('0x42')]({},_0xd61f9a,_0x2ac213[_0x11b5('0x44')]);return db['ZendeskConfiguration'][_0x11b5('0x4c')](_0xd61f9a)[_0x11b5('0x28')](handleEntityNotFound(_0x5efccc,null))[_0x11b5('0x28')](respondWithResult(_0x5efccc,null))['catch'](handleError(_0x5efccc,null));};exports['create']=function(_0x488f47,_0x383e24){return db[_0x11b5('0x2e')][_0x11b5('0x4d')](_0x488f47[_0x11b5('0x4e')],{})['then'](respondWithResult(_0x383e24,0xc9))[_0x11b5('0x48')](handleError(_0x383e24,null));};exports[_0x11b5('0x27')]=function(_0xe81418,_0x13d5e7){if(_0xe81418['body']['id']){delete _0xe81418[_0x11b5('0x4e')]['id'];}return db[_0x11b5('0x2e')]['find']({'where':{'id':_0xe81418[_0x11b5('0x4a')]['id']}})[_0x11b5('0x28')](handleEntityNotFound(_0x13d5e7,null))[_0x11b5('0x28')](saveUpdates(_0xe81418[_0x11b5('0x4e')],null))['then'](respondWithResult(_0x13d5e7,null))[_0x11b5('0x48')](handleError(_0x13d5e7,null));};exports['destroy']=function(_0x5aa607,_0x3c16ce){return db[_0x11b5('0x2e')][_0x11b5('0x4c')]({'where':{'id':_0x5aa607[_0x11b5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c16ce,null))[_0x11b5('0x28')](removeEntity(_0x3c16ce,null))[_0x11b5('0x48')](handleError(_0x3c16ce,null));};exports[_0x11b5('0x4f')]=function(_0x5507ea,_0x4ac5fa,_0x3b8aa8){var _0x1836e3={};var _0x30ab56={};var _0x76f42c;var _0x4f5dca;return db[_0x11b5('0x2e')][_0x11b5('0x50')]({'where':{'id':_0x5507ea[_0x11b5('0x4a')]['id']}})[_0x11b5('0x28')](handleEntityNotFound(_0x4ac5fa,null))[_0x11b5('0x28')](function(_0x66afc7){if(_0x66afc7){_0x76f42c=_0x66afc7;_0x30ab56['model']=_['keys'](db['ZendeskField'][_0x11b5('0x4b')]);_0x30ab56['query']=_[_0x11b5('0x34')](_0x5507ea[_0x11b5('0x35')]);_0x30ab56[_0x11b5('0x36')]=_['intersection'](_0x30ab56['model'],_0x30ab56[_0x11b5('0x35')]);_0x1836e3['attributes']=_['intersection'](_0x30ab56['model'],qs['fields'](_0x5507ea[_0x11b5('0x35')][_0x11b5('0x39')]));_0x1836e3[_0x11b5('0x38')]=_0x1836e3[_0x11b5('0x38')][_0x11b5('0x3a')]?_0x1836e3['attributes']:_0x30ab56['model'];_0x1836e3['order']=qs[_0x11b5('0x3e')](_0x5507ea[_0x11b5('0x35')][_0x11b5('0x3e')]);_0x1836e3[_0x11b5('0x3f')]=qs[_0x11b5('0x36')](_[_0x11b5('0x40')](_0x5507ea['query'],_0x30ab56[_0x11b5('0x36')]));if(_0x5507ea['query'][_0x11b5('0x41')]){_0x1836e3['where']=_[_0x11b5('0x42')](_0x1836e3[_0x11b5('0x3f')],{'$or':_[_0x11b5('0x33')](_0x1836e3['attributes'],function(_0x17b89d){var _0x4e06b9={};_0x4e06b9[_0x17b89d]={'$like':'%'+_0x5507ea[_0x11b5('0x35')][_0x11b5('0x41')]+'%'};return _0x4e06b9;})});}_0x1836e3=_[_0x11b5('0x42')]({},_0x1836e3,_0x5507ea['options']);return _0x76f42c[_0x11b5('0x4f')](_0x1836e3);}})[_0x11b5('0x28')](function(_0x4382ba){if(_0x4382ba){_0x4f5dca=_0x4382ba['length'];if(!_0x5507ea[_0x11b5('0x35')][_0x11b5('0x3b')]('nolimit')){_0x1836e3[_0x11b5('0x1f')]=qs[_0x11b5('0x1f')](_0x5507ea[_0x11b5('0x35')]['limit']);_0x1836e3[_0x11b5('0x1d')]=qs[_0x11b5('0x1d')](_0x5507ea[_0x11b5('0x35')]['offset']);}return _0x76f42c[_0x11b5('0x4f')](_0x1836e3);}})['then'](function(_0x597d82){if(_0x597d82){return _0x597d82?{'count':_0x4f5dca,'rows':_0x597d82}:null;}})[_0x11b5('0x28')](respondWithResult(_0x4ac5fa,null))[_0x11b5('0x48')](handleError(_0x4ac5fa,null));};exports[_0x11b5('0x51')]=function(_0x3f39c0,_0x2965ee,_0x1bc4de){var _0xc980e8={};var _0xdc592d={};var _0x37f81e;var _0x29bc40;return db[_0x11b5('0x2e')][_0x11b5('0x50')]({'where':{'id':_0x3f39c0[_0x11b5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2965ee,null))[_0x11b5('0x28')](function(_0x5e23f5){if(_0x5e23f5){_0x37f81e=_0x5e23f5;_0xdc592d['model']=_[_0x11b5('0x34')](db[_0x11b5('0x52')][_0x11b5('0x4b')]);_0xdc592d[_0x11b5('0x35')]=_['keys'](_0x3f39c0[_0x11b5('0x35')]);_0xdc592d['filters']=_[_0x11b5('0x37')](_0xdc592d[_0x11b5('0x32')],_0xdc592d[_0x11b5('0x35')]);_0xc980e8[_0x11b5('0x38')]=_[_0x11b5('0x37')](_0xdc592d['model'],qs[_0x11b5('0x39')](_0x3f39c0['query'][_0x11b5('0x39')]));_0xc980e8[_0x11b5('0x38')]=_0xc980e8[_0x11b5('0x38')][_0x11b5('0x3a')]?_0xc980e8[_0x11b5('0x38')]:_0xdc592d['model'];_0xc980e8[_0x11b5('0x3d')]=qs[_0x11b5('0x3e')](_0x3f39c0[_0x11b5('0x35')][_0x11b5('0x3e')]);_0xc980e8[_0x11b5('0x3f')]=qs[_0x11b5('0x36')](_[_0x11b5('0x40')](_0x3f39c0['query'],_0xdc592d[_0x11b5('0x36')]));if(_0x3f39c0[_0x11b5('0x35')][_0x11b5('0x41')]){_0xc980e8['where']=_['merge'](_0xc980e8['where'],{'$or':_[_0x11b5('0x33')](_0xc980e8[_0x11b5('0x38')],function(_0x3a6eb7){var _0x1022d5={};_0x1022d5[_0x3a6eb7]={'$like':'%'+_0x3f39c0['query'][_0x11b5('0x41')]+'%'};return _0x1022d5;})});}_0xc980e8=_[_0x11b5('0x42')]({},_0xc980e8,_0x3f39c0['options']);return _0x37f81e[_0x11b5('0x51')](_0xc980e8);}})[_0x11b5('0x28')](function(_0x6ddf0e){if(_0x6ddf0e){_0x29bc40=_0x6ddf0e['length'];if(!_0x3f39c0[_0x11b5('0x35')]['hasOwnProperty']('nolimit')){_0xc980e8['limit']=qs[_0x11b5('0x1f')](_0x3f39c0[_0x11b5('0x35')][_0x11b5('0x1f')]);_0xc980e8[_0x11b5('0x1d')]=qs[_0x11b5('0x1d')](_0x3f39c0[_0x11b5('0x35')]['offset']);}return _0x37f81e[_0x11b5('0x51')](_0xc980e8);}})['then'](function(_0x43f949){if(_0x43f949){return _0x43f949?{'count':_0x29bc40,'rows':_0x43f949}:null;}})[_0x11b5('0x28')](respondWithResult(_0x2965ee,null))['catch'](handleError(_0x2965ee,null));};exports['getDescriptions']=function(_0x16143b,_0x1e09c6,_0x20bd86){var _0x18e76e={};var _0x199169={};var _0x4f0708;var _0x4b7c30;return db[_0x11b5('0x2e')]['findOne']({'where':{'id':_0x16143b[_0x11b5('0x4a')]['id']}})[_0x11b5('0x28')](handleEntityNotFound(_0x1e09c6,null))[_0x11b5('0x28')](function(_0xb41c86){if(_0xb41c86){_0x4f0708=_0xb41c86;_0x199169[_0x11b5('0x32')]=_[_0x11b5('0x34')](db[_0x11b5('0x52')][_0x11b5('0x4b')]);_0x199169[_0x11b5('0x35')]=_[_0x11b5('0x34')](_0x16143b[_0x11b5('0x35')]);_0x199169['filters']=_[_0x11b5('0x37')](_0x199169[_0x11b5('0x32')],_0x199169[_0x11b5('0x35')]);_0x18e76e[_0x11b5('0x38')]=_['intersection'](_0x199169[_0x11b5('0x32')],qs['fields'](_0x16143b[_0x11b5('0x35')][_0x11b5('0x39')]));_0x18e76e[_0x11b5('0x38')]=_0x18e76e[_0x11b5('0x38')][_0x11b5('0x3a')]?_0x18e76e['attributes']:_0x199169[_0x11b5('0x32')];_0x18e76e['order']=qs[_0x11b5('0x3e')](_0x16143b[_0x11b5('0x35')][_0x11b5('0x3e')]);_0x18e76e[_0x11b5('0x3f')]=qs[_0x11b5('0x36')](_[_0x11b5('0x40')](_0x16143b[_0x11b5('0x35')],_0x199169[_0x11b5('0x36')]));if(_0x16143b[_0x11b5('0x35')][_0x11b5('0x41')]){_0x18e76e['where']=_[_0x11b5('0x42')](_0x18e76e[_0x11b5('0x3f')],{'$or':_[_0x11b5('0x33')](_0x18e76e[_0x11b5('0x38')],function(_0x538e59){var _0x3bb48b={};_0x3bb48b[_0x538e59]={'$like':'%'+_0x16143b['query'][_0x11b5('0x41')]+'%'};return _0x3bb48b;})});}_0x18e76e=_[_0x11b5('0x42')]({},_0x18e76e,_0x16143b[_0x11b5('0x44')]);return _0x4f0708['getDescriptions'](_0x18e76e);}})[_0x11b5('0x28')](function(_0x161784){if(_0x161784){_0x4b7c30=_0x161784['length'];if(!_0x16143b[_0x11b5('0x35')][_0x11b5('0x3b')](_0x11b5('0x3c'))){_0x18e76e[_0x11b5('0x1f')]=qs[_0x11b5('0x1f')](_0x16143b[_0x11b5('0x35')]['limit']);_0x18e76e['offset']=qs[_0x11b5('0x1d')](_0x16143b['query'][_0x11b5('0x1d')]);}return _0x4f0708['getDescriptions'](_0x18e76e);}})['then'](function(_0x2a5628){if(_0x2a5628){return _0x2a5628?{'count':_0x4b7c30,'rows':_0x2a5628}:null;}})[_0x11b5('0x28')](respondWithResult(_0x1e09c6,null))[_0x11b5('0x48')](handleError(_0x1e09c6,null));};exports[_0x11b5('0x53')]=function(_0xbf26e6,_0x3e8406,_0x5093e4){var _0x2c4c95={};var _0x17db2b={};var _0x5f2e5a;var _0x5dff6c;return db[_0x11b5('0x2e')][_0x11b5('0x50')]({'where':{'id':_0xbf26e6['params']['id']}})[_0x11b5('0x28')](handleEntityNotFound(_0x3e8406,null))[_0x11b5('0x28')](function(_0x3ef648){if(_0x3ef648){_0x5f2e5a=_0x3ef648;_0x17db2b[_0x11b5('0x32')]=_['keys'](db[_0x11b5('0x54')][_0x11b5('0x4b')]);_0x17db2b[_0x11b5('0x35')]=_[_0x11b5('0x34')](_0xbf26e6[_0x11b5('0x35')]);_0x17db2b[_0x11b5('0x36')]=_[_0x11b5('0x37')](_0x17db2b[_0x11b5('0x32')],_0x17db2b['query']);_0x2c4c95[_0x11b5('0x38')]=_['intersection'](_0x17db2b['model'],qs[_0x11b5('0x39')](_0xbf26e6[_0x11b5('0x35')][_0x11b5('0x39')]));_0x2c4c95['attributes']=_0x2c4c95[_0x11b5('0x38')][_0x11b5('0x3a')]?_0x2c4c95[_0x11b5('0x38')]:_0x17db2b[_0x11b5('0x32')];_0x2c4c95['order']=qs[_0x11b5('0x3e')](_0xbf26e6[_0x11b5('0x35')][_0x11b5('0x3e')]);_0x2c4c95['where']=qs['filters'](_[_0x11b5('0x40')](_0xbf26e6['query'],_0x17db2b[_0x11b5('0x36')]));if(_0xbf26e6[_0x11b5('0x35')][_0x11b5('0x41')]){_0x2c4c95[_0x11b5('0x3f')]=_['merge'](_0x2c4c95[_0x11b5('0x3f')],{'$or':_[_0x11b5('0x33')](_0x2c4c95['attributes'],function(_0x4451bd){var _0x3405fb={};_0x3405fb[_0x4451bd]={'$like':'%'+_0xbf26e6[_0x11b5('0x35')]['filter']+'%'};return _0x3405fb;})});}_0x2c4c95=_['merge']({},_0x2c4c95,_0xbf26e6[_0x11b5('0x44')]);return _0x5f2e5a[_0x11b5('0x53')](_0x2c4c95);}})[_0x11b5('0x28')](function(_0xb41a25){if(_0xb41a25){_0x5dff6c=_0xb41a25['length'];if(!_0xbf26e6[_0x11b5('0x35')]['hasOwnProperty']('nolimit')){_0x2c4c95[_0x11b5('0x1f')]=qs[_0x11b5('0x1f')](_0xbf26e6['query'][_0x11b5('0x1f')]);_0x2c4c95['offset']=qs['offset'](_0xbf26e6[_0x11b5('0x35')][_0x11b5('0x1d')]);}return _0x5f2e5a[_0x11b5('0x53')](_0x2c4c95);}})[_0x11b5('0x28')](function(_0x1eb53b){if(_0x1eb53b){return _0x1eb53b?{'count':_0x5dff6c,'rows':_0x1eb53b}:null;}})[_0x11b5('0x28')](respondWithResult(_0x3e8406,null))[_0x11b5('0x48')](handleError(_0x3e8406,null));};exports[_0x11b5('0x55')]=function(_0x209aec,_0x52058c,_0xd97514){if(_0x209aec[_0x11b5('0x4e')]['id']){delete _0x209aec[_0x11b5('0x4e')]['id'];}return db[_0x11b5('0x2e')][_0x11b5('0x50')]({'where':{'id':_0x209aec['params']['id']}})['then'](handleEntityNotFound(_0x52058c,null))[_0x11b5('0x28')](function(_0x23738e){if(_0x23738e){return _0x23738e['setTags'](_0x209aec[_0x11b5('0x4e')]['ids']||[]);}return null;})[_0x11b5('0x28')](respondWithResult(_0x52058c,null))[_0x11b5('0x48')](handleError(_0x52058c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index f8f12bd..81aecb5 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 _0x282b=['moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0xe6d063,_0x47ae75){var _0x15d836=function(_0x469a5d){while(--_0x469a5d){_0xe6d063['push'](_0xe6d063['shift']());}};_0x15d836(++_0x47ae75);}(_0x282b,0xec));var _0xb282=function(_0x1761f5,_0x75bdff){_0x1761f5=_0x1761f5-0x0;var _0x4c3c43=_0x282b[_0x1761f5];return _0x4c3c43;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var logger=require(_0xb282('0x2'))(_0xb282('0x3'));var moment=require(_0xb282('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb282('0x5'));var rimraf=require('rimraf');var config=require(_0xb282('0x6'));var attributes=require(_0xb282('0x7'));module[_0xb282('0x8')]=function(_0x1dd19b,_0x3cad41){return _0x1dd19b[_0xb282('0x9')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb3b=['moment','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0x386199,_0x42c3d7){var _0x4416de=function(_0x41514d){while(--_0x41514d){_0x386199['push'](_0x386199['shift']());}};_0x4416de(++_0x42c3d7);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x2d3a4d,_0x47561e){_0x2d3a4d=_0x2d3a4d-0x0;var _0x3a94a3=_0xeb3b[_0x2d3a4d];return _0x3a94a3;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var logger=require(_0xbeb3('0x2'))(_0xbeb3('0x3'));var moment=require(_0xbeb3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeb3('0x5'));var rimraf=require('rimraf');var config=require(_0xbeb3('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xbeb3('0x7')]=function(_0x5ae6f9,_0x8d8cce){return _0x5ae6f9[_0xbeb3('0x8')](_0xbeb3('0x9'),attributes,{'tableName':_0xbeb3('0xa'),'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 fab4fc6..58cca0f 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 _0x61e8=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4dce1f,_0x15c866){var _0x54e416=function(_0x1051c1){while(--_0x1051c1){_0x4dce1f['push'](_0x4dce1f['shift']());}};_0x54e416(++_0x15c866);}(_0x61e8,0x198));var _0x861e=function(_0x47e110,_0x5560e8){_0x47e110=_0x47e110-0x0;var _0x5b14f1=_0x61e8[_0x47e110];return _0x5b14f1;};'use strict';var _=require(_0x861e('0x0'));var util=require(_0x861e('0x1'));var moment=require(_0x861e('0x2'));var BPromise=require(_0x861e('0x3'));var rs=require(_0x861e('0x4'));var fs=require('fs');var Redis=require(_0x861e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x861e('0x6'));var logger=require('../../config/logger')(_0x861e('0x7'));var config=require(_0x861e('0x8'));var jayson=require(_0x861e('0x9'));var client=jayson[_0x861e('0xa')][_0x861e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44a0a0,_0x3a5a21,_0x13921f){return new BPromise(function(_0x193c83,_0x56a57c){return client[_0x861e('0xc')](_0x44a0a0,_0x13921f)[_0x861e('0xd')](function(_0xdf703f){logger[_0x861e('0xe')](_0x861e('0xf'),_0x3a5a21,_0x861e('0x10'));logger[_0x861e('0x11')](_0x861e('0x12'),_0x3a5a21,_0x861e('0x10'),JSON['stringify'](_0xdf703f));if(_0xdf703f['error']){if(_0xdf703f[_0x861e('0x13')][_0x861e('0x14')]===0x1f4){logger[_0x861e('0x13')](_0x861e('0xf'),_0x3a5a21,_0xdf703f[_0x861e('0x13')][_0x861e('0x15')]);return _0x56a57c(_0xdf703f['error'][_0x861e('0x15')]);}logger[_0x861e('0x13')](_0x861e('0xf'),_0x3a5a21,_0xdf703f[_0x861e('0x13')][_0x861e('0x15')]);return _0x193c83(_0xdf703f[_0x861e('0x13')][_0x861e('0x15')]);}else{logger[_0x861e('0xe')](_0x861e('0xf'),_0x3a5a21,'request\x20sent');_0x193c83(_0xdf703f['result'][_0x861e('0x15')]);}})[_0x861e('0x16')](function(_0x3a833c){logger[_0x861e('0x13')](_0x861e('0xf'),_0x3a5a21,_0x3a833c);_0x56a57c(_0x3a833c);});});} \ No newline at end of file +var _0x043c=['rpc','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x360488,_0x25cd23){var _0x436645=function(_0x2e8e64){while(--_0x2e8e64){_0x360488['push'](_0x360488['shift']());}};_0x436645(++_0x25cd23);}(_0x043c,0xf2));var _0xc043=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x043c[_0xfc0976];return _0x23579f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc043('0x0'));var rs=require(_0xc043('0x1'));var fs=require('fs');var Redis=require(_0xc043('0x2'));var db=require(_0xc043('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc043('0x4'))(_0xc043('0x5'));var config=require('../../config/environment');var jayson=require(_0xc043('0x6'));var client=jayson['client'][_0xc043('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f1063,_0x2e5311,_0xd3cccf){return new BPromise(function(_0x3836da,_0x5ced0d){return client[_0xc043('0x8')](_0x1f1063,_0xd3cccf)[_0xc043('0x9')](function(_0x33ce80){logger[_0xc043('0xa')](_0xc043('0xb'),_0x2e5311,'request\x20sent');logger[_0xc043('0xc')](_0xc043('0xd'),_0x2e5311,'request\x20sent',JSON[_0xc043('0xe')](_0x33ce80));if(_0x33ce80[_0xc043('0xf')]){if(_0x33ce80[_0xc043('0xf')][_0xc043('0x10')]===0x1f4){logger[_0xc043('0xf')](_0xc043('0xb'),_0x2e5311,_0x33ce80[_0xc043('0xf')][_0xc043('0x11')]);return _0x5ced0d(_0x33ce80['error'][_0xc043('0x11')]);}logger[_0xc043('0xf')](_0xc043('0xb'),_0x2e5311,_0x33ce80[_0xc043('0xf')][_0xc043('0x11')]);return _0x3836da(_0x33ce80[_0xc043('0xf')]['message']);}else{logger['info'](_0xc043('0xb'),_0x2e5311,'request\x20sent');_0x3836da(_0x33ce80['result']['message']);}})[_0xc043('0x12')](function(_0x52f863){logger['error'](_0xc043('0xb'),_0x2e5311,_0x52f863);_0x5ced0d(_0x52f863);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 4e1d8ae..1814b2b 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 _0x5e3c=['get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5e3c,0x170));var _0xc5e3=function(_0x5d5b6d,_0x42d8cd){_0x5d5b6d=_0x5d5b6d-0x0;var _0x30bdcc=_0x5e3c[_0x5d5b6d];return _0x30bdcc;};'use strict';var multer=require(_0xc5e3('0x0'));var util=require(_0xc5e3('0x1'));var path=require('path');var timeout=require(_0xc5e3('0x2'));var express=require(_0xc5e3('0x3'));var router=express[_0xc5e3('0x4')]();var fs_extra=require(_0xc5e3('0x5'));var auth=require(_0xc5e3('0x6'));var interaction=require(_0xc5e3('0x7'));var config=require(_0xc5e3('0x8'));var controller=require(_0xc5e3('0x9'));router[_0xc5e3('0xa')]('/',auth['isAuthenticated'](),controller[_0xc5e3('0xb')]);router[_0xc5e3('0xa')](_0xc5e3('0xc'),auth[_0xc5e3('0xd')](),controller[_0xc5e3('0xe')]);router[_0xc5e3('0xf')]('/',auth[_0xc5e3('0xd')](),controller[_0xc5e3('0x10')]);router[_0xc5e3('0x11')](_0xc5e3('0xc'),auth[_0xc5e3('0xd')](),controller['update']);router[_0xc5e3('0x12')](_0xc5e3('0xc'),auth[_0xc5e3('0xd')](),controller[_0xc5e3('0x13')]);module[_0xc5e3('0x14')]=router; \ No newline at end of file +var _0x34f1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x5901db,_0x10b4af){var _0x508d64=function(_0x3d5694){while(--_0x3d5694){_0x5901db['push'](_0x5901db['shift']());}};_0x508d64(++_0x10b4af);}(_0x34f1,0x139));var _0x134f=function(_0x1c89a3,_0x7867f3){_0x1c89a3=_0x1c89a3-0x0;var _0x50140a=_0x34f1[_0x1c89a3];return _0x50140a;};'use strict';var multer=require(_0x134f('0x0'));var util=require('util');var path=require(_0x134f('0x1'));var timeout=require('connect-timeout');var express=require(_0x134f('0x2'));var router=express[_0x134f('0x3')]();var fs_extra=require(_0x134f('0x4'));var auth=require(_0x134f('0x5'));var interaction=require(_0x134f('0x6'));var config=require(_0x134f('0x7'));var controller=require(_0x134f('0x8'));router[_0x134f('0x9')]('/',auth[_0x134f('0xa')](),controller[_0x134f('0xb')]);router['get'](_0x134f('0xc'),auth[_0x134f('0xa')](),controller[_0x134f('0xd')]);router[_0x134f('0xe')]('/',auth[_0x134f('0xa')](),controller[_0x134f('0xf')]);router[_0x134f('0x10')](_0x134f('0xc'),auth['isAuthenticated'](),controller[_0x134f('0x11')]);router[_0x134f('0x12')](_0x134f('0xc'),auth[_0x134f('0xa')](),controller[_0x134f('0x13')]);module[_0x134f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6ff288e..9b2f689 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 _0xe060=['keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x274a0e,_0x4c0713){var _0x50f593=function(_0x36aa5f){while(--_0x36aa5f){_0x274a0e['push'](_0x274a0e['shift']());}};_0x50f593(++_0x4c0713);}(_0xe060,0x199));var _0x0e06=function(_0x495feb,_0x528207){_0x495feb=_0x495feb-0x0;var _0x149947=_0xe060[_0x495feb];return _0x149947;};'use strict';var Sequelize=require(_0x0e06('0x0'));module[_0x0e06('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0e06('0x2'),_0x0e06('0x3'),_0x0e06('0x4'),_0x0e06('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x0e06('0x6')]},'key':{'type':Sequelize[_0x0e06('0x6')]},'keyType':{'type':Sequelize[_0x0e06('0x7')](_0x0e06('0x2'),'variable',_0x0e06('0x4'))},'keyContent':{'type':Sequelize[_0x0e06('0x6')]},'idField':{'type':Sequelize[_0x0e06('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0e06('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e06('0x6')]}}; \ No newline at end of file +var _0x5e2f=['exports','ENUM','customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5e2f,0x182));var _0xf5e2=function(_0x5e101c,_0x22b01f){_0x5e101c=_0x5e101c-0x0;var _0x456d97=_0x5e2f[_0x5e101c];return _0x456d97;};'use strict';var Sequelize=require(_0xf5e2('0x0'));module[_0xf5e2('0x1')]={'type':{'type':Sequelize[_0xf5e2('0x2')]('string','variable',_0xf5e2('0x3'),_0xf5e2('0x4'),_0xf5e2('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf5e2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf5e2('0x2')](_0xf5e2('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf5e2('0x6')]},'customField':{'type':Sequelize[_0xf5e2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf5e2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index dbfa615..497d9c2 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 _0x2bdb=['json','offset','limit','undefined','count','set','save','then','destroy','end','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','update','body','find','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x2bdb,0x105));var _0xb2bd=function(_0x4a2016,_0x42c337){_0x4a2016=_0x4a2016-0x0;var _0x386ffa=_0x2bdb[_0x4a2016];return _0x386ffa;};'use strict';var emlformat=require(_0xb2bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2bd('0x2'));var moment=require(_0xb2bd('0x3'));var BPromise=require(_0xb2bd('0x4'));var Mustache=require('mustache');var util=require(_0xb2bd('0x5'));var path=require(_0xb2bd('0x6'));var sox=require(_0xb2bd('0x7'));var csv=require(_0xb2bd('0x8'));var ejs=require(_0xb2bd('0x9'));var fs=require('fs');var fs_extra=require(_0xb2bd('0xa'));var _=require(_0xb2bd('0xb'));var squel=require('squel');var crypto=require(_0xb2bd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb2bd('0xd'));var toCsv=require(_0xb2bd('0x8'));var querystring=require(_0xb2bd('0xe'));var Papa=require(_0xb2bd('0xf'));var Redis=require(_0xb2bd('0x10'));var authService=require(_0xb2bd('0x11'));var qs=require(_0xb2bd('0x12'));var as=require(_0xb2bd('0x13'));var hardwareService=require(_0xb2bd('0x14'));var logger=require('../../config/logger')(_0xb2bd('0x15'));var utils=require(_0xb2bd('0x16'));var config=require(_0xb2bd('0x17'));var licenseUtil=require(_0xb2bd('0x18'));var db=require(_0xb2bd('0x19'))['db'];function respondWithStatusCode(_0x35f174,_0x6d2212){_0x6d2212=_0x6d2212||0xcc;return function(_0x452cd6){if(_0x452cd6){return _0x35f174['sendStatus'](_0x6d2212);}return _0x35f174[_0xb2bd('0x1a')](_0x6d2212)['end']();};}function respondWithResult(_0x2da8e6,_0x2adda1){_0x2adda1=_0x2adda1||0xc8;return function(_0x17e238){if(_0x17e238){return _0x2da8e6[_0xb2bd('0x1a')](_0x2adda1)[_0xb2bd('0x1b')](_0x17e238);}};}function respondWithFilteredResult(_0x47d679,_0x23c440){return function(_0x315ecc){if(_0x315ecc){var _0x2091d2=typeof _0x23c440[_0xb2bd('0x1c')]==='undefined'&&typeof _0x23c440[_0xb2bd('0x1d')]===_0xb2bd('0x1e');var _0x5b632d=_0x315ecc[_0xb2bd('0x1f')];var _0x380089=_0x2091d2?0x0:_0x23c440[_0xb2bd('0x1c')];var _0x315815=_0x2091d2?_0x315ecc['count']:_0x23c440[_0xb2bd('0x1c')]+_0x23c440[_0xb2bd('0x1d')];var _0x58b3b9;if(_0x315815>=_0x5b632d){_0x315815=_0x5b632d;_0x58b3b9=0xc8;}else{_0x58b3b9=0xce;}_0x47d679[_0xb2bd('0x1a')](_0x58b3b9);return _0x47d679[_0xb2bd('0x20')]('Content-Range',_0x380089+'-'+_0x315815+'/'+_0x5b632d)['json'](_0x315ecc);}return null;};}function patchUpdates(_0x51c595){return function(_0x31a69f){try{jsonpatch['apply'](_0x31a69f,_0x51c595,!![]);}catch(_0x33dfdc){return BPromise['reject'](_0x33dfdc);}return _0x31a69f[_0xb2bd('0x21')]();};}function saveUpdates(_0x25b331,_0x505c35){return function(_0x246f71){if(_0x246f71){return _0x246f71['update'](_0x25b331)[_0xb2bd('0x22')](function(_0x24e202){return _0x24e202;});}return null;};}function removeEntity(_0x2d281c,_0x7517de){return function(_0x5665ae){if(_0x5665ae){return _0x5665ae[_0xb2bd('0x23')]()[_0xb2bd('0x22')](function(){_0x2d281c[_0xb2bd('0x1a')](0xcc)[_0xb2bd('0x24')]();});}};}function handleEntityNotFound(_0x42109f,_0x284da5){return function(_0x5fd563){if(!_0x5fd563){_0x42109f['sendStatus'](0x194);}return _0x5fd563;};}function handleError(_0x2d0bf3,_0x18859a){_0x18859a=_0x18859a||0x1f4;return function(_0xdba731){logger[_0xb2bd('0x25')](_0xdba731[_0xb2bd('0x26')]);if(_0xdba731[_0xb2bd('0x27')]){delete _0xdba731[_0xb2bd('0x27')];}_0x2d0bf3['status'](_0x18859a)[_0xb2bd('0x28')](_0xdba731);};}exports['index']=function(_0x3917e5,_0x5a7a7c){var _0xbfae89={},_0x41ba8f={},_0x65211d={'count':0x0,'rows':[]};var _0x5628c3=_[_0xb2bd('0x29')](db[_0xb2bd('0x2a')][_0xb2bd('0x2b')],function(_0x4633e1){return{'name':_0x4633e1[_0xb2bd('0x2c')],'type':_0x4633e1[_0xb2bd('0x2d')]['key']};});_0x41ba8f['model']=_[_0xb2bd('0x29')](_0x5628c3,'name');_0x41ba8f[_0xb2bd('0x2e')]=_[_0xb2bd('0x2f')](_0x3917e5[_0xb2bd('0x2e')]);_0x41ba8f['filters']=_[_0xb2bd('0x30')](_0x41ba8f[_0xb2bd('0x31')],_0x41ba8f[_0xb2bd('0x2e')]);_0xbfae89[_0xb2bd('0x32')]=_[_0xb2bd('0x30')](_0x41ba8f[_0xb2bd('0x31')],qs[_0xb2bd('0x33')](_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x33')]));_0xbfae89[_0xb2bd('0x32')]=_0xbfae89['attributes'][_0xb2bd('0x34')]?_0xbfae89[_0xb2bd('0x32')]:_0x41ba8f[_0xb2bd('0x31')];if(!_0x3917e5[_0xb2bd('0x2e')]['hasOwnProperty'](_0xb2bd('0x35'))){_0xbfae89[_0xb2bd('0x1d')]=qs[_0xb2bd('0x1d')](_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x1d')]);_0xbfae89['offset']=qs['offset'](_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x1c')]);}_0xbfae89[_0xb2bd('0x36')]=qs[_0xb2bd('0x37')](_0x3917e5[_0xb2bd('0x2e')]['sort']);_0xbfae89[_0xb2bd('0x38')]=qs[_0xb2bd('0x39')](_[_0xb2bd('0x3a')](_0x3917e5[_0xb2bd('0x2e')],_0x41ba8f[_0xb2bd('0x39')]),_0x5628c3);if(_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x3b')]){_0xbfae89[_0xb2bd('0x38')]=_[_0xb2bd('0x3c')](_0xbfae89[_0xb2bd('0x38')],{'$or':_[_0xb2bd('0x29')](_0x5628c3,function(_0x6ac71c){if(_0x6ac71c[_0xb2bd('0x2d')]!=='VIRTUAL'){var _0x7bc3b8={};_0x7bc3b8[_0x6ac71c[_0xb2bd('0x27')]]={'$like':'%'+_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x3b')]+'%'};return _0x7bc3b8;}})});}_0xbfae89=_[_0xb2bd('0x3c')]({},_0xbfae89,_0x3917e5[_0xb2bd('0x3d')]);var _0x342296={'where':_0xbfae89[_0xb2bd('0x38')]};return db['ZendeskField']['count'](_0x342296)[_0xb2bd('0x22')](function(_0x13c541){_0x65211d['count']=_0x13c541;if(_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x3e')]){_0xbfae89[_0xb2bd('0x3f')]=[{'all':!![]}];}return db[_0xb2bd('0x2a')]['findAll'](_0xbfae89);})[_0xb2bd('0x22')](function(_0x1a5a4f){_0x65211d[_0xb2bd('0x40')]=_0x1a5a4f;return _0x65211d;})['then'](respondWithFilteredResult(_0x5a7a7c,_0xbfae89))[_0xb2bd('0x41')](handleError(_0x5a7a7c,null));};exports[_0xb2bd('0x42')]=function(_0x514e37,_0xbbfd15){var _0x5c316f={'raw':!![],'where':{'id':_0x514e37[_0xb2bd('0x43')]['id']}},_0x285599={};_0x285599['model']=_[_0xb2bd('0x2f')](db[_0xb2bd('0x2a')][_0xb2bd('0x2b')]);_0x285599[_0xb2bd('0x2e')]=_[_0xb2bd('0x2f')](_0x514e37['query']);_0x285599[_0xb2bd('0x39')]=_[_0xb2bd('0x30')](_0x285599[_0xb2bd('0x31')],_0x285599[_0xb2bd('0x2e')]);_0x5c316f[_0xb2bd('0x32')]=_[_0xb2bd('0x30')](_0x285599[_0xb2bd('0x31')],qs[_0xb2bd('0x33')](_0x514e37[_0xb2bd('0x2e')][_0xb2bd('0x33')]));_0x5c316f['attributes']=_0x5c316f[_0xb2bd('0x32')][_0xb2bd('0x34')]?_0x5c316f[_0xb2bd('0x32')]:_0x285599[_0xb2bd('0x31')];if(_0x514e37[_0xb2bd('0x2e')]['includeAll']){_0x5c316f[_0xb2bd('0x3f')]=[{'all':!![]}];}_0x5c316f=_[_0xb2bd('0x3c')]({},_0x5c316f,_0x514e37['options']);return db[_0xb2bd('0x2a')]['find'](_0x5c316f)[_0xb2bd('0x22')](handleEntityNotFound(_0xbbfd15,null))[_0xb2bd('0x22')](respondWithResult(_0xbbfd15,null))[_0xb2bd('0x41')](handleError(_0xbbfd15,null));};exports[_0xb2bd('0x44')]=function(_0x3d4b20,_0x4a35f4){return db[_0xb2bd('0x2a')][_0xb2bd('0x44')](_0x3d4b20['body'],{})[_0xb2bd('0x22')](respondWithResult(_0x4a35f4,0xc9))['catch'](handleError(_0x4a35f4,null));};exports[_0xb2bd('0x45')]=function(_0x4021cb,_0x311ab8){if(_0x4021cb[_0xb2bd('0x46')]['id']){delete _0x4021cb[_0xb2bd('0x46')]['id'];}return db[_0xb2bd('0x2a')][_0xb2bd('0x47')]({'where':{'id':_0x4021cb[_0xb2bd('0x43')]['id']}})[_0xb2bd('0x22')](handleEntityNotFound(_0x311ab8,null))[_0xb2bd('0x22')](saveUpdates(_0x4021cb[_0xb2bd('0x46')],null))[_0xb2bd('0x22')](respondWithResult(_0x311ab8,null))[_0xb2bd('0x41')](handleError(_0x311ab8,null));};exports[_0xb2bd('0x23')]=function(_0x448f29,_0x5037d4){return db['ZendeskField'][_0xb2bd('0x47')]({'where':{'id':_0x448f29['params']['id']}})[_0xb2bd('0x22')](handleEntityNotFound(_0x5037d4,null))['then'](removeEntity(_0x5037d4,null))[_0xb2bd('0x41')](handleError(_0x5037d4,null));}; \ No newline at end of file +var _0x4e8b=['map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index'];(function(_0x2d8cb3,_0x1b86f8){var _0x25536c=function(_0x43f577){while(--_0x43f577){_0x2d8cb3['push'](_0x2d8cb3['shift']());}};_0x25536c(++_0x1b86f8);}(_0x4e8b,0xb8));var _0xb4e8=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x4e8b[_0x3b90ab];return _0x206e92;};'use strict';var emlformat=require(_0xb4e8('0x0'));var rimraf=require(_0xb4e8('0x1'));var zipdir=require(_0xb4e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4e8('0x3'));var moment=require('moment');var BPromise=require(_0xb4e8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb4e8('0x5'));var sox=require(_0xb4e8('0x6'));var csv=require(_0xb4e8('0x7'));var ejs=require(_0xb4e8('0x8'));var fs=require('fs');var fs_extra=require(_0xb4e8('0x9'));var _=require(_0xb4e8('0xa'));var squel=require(_0xb4e8('0xb'));var crypto=require(_0xb4e8('0xc'));var jsforce=require(_0xb4e8('0xd'));var deskjs=require(_0xb4e8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb4e8('0xf'));var Papa=require(_0xb4e8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb4e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4e8('0x12'));var logger=require(_0xb4e8('0x13'))('api');var utils=require(_0xb4e8('0x14'));var config=require(_0xb4e8('0x15'));var licenseUtil=require(_0xb4e8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ab1e7,_0x4cd78c){_0x4cd78c=_0x4cd78c||0xcc;return function(_0x484524){if(_0x484524){return _0x5ab1e7[_0xb4e8('0x17')](_0x4cd78c);}return _0x5ab1e7[_0xb4e8('0x18')](_0x4cd78c)[_0xb4e8('0x19')]();};}function respondWithResult(_0x241851,_0x33b367){_0x33b367=_0x33b367||0xc8;return function(_0x24efa5){if(_0x24efa5){return _0x241851[_0xb4e8('0x18')](_0x33b367)[_0xb4e8('0x1a')](_0x24efa5);}};}function respondWithFilteredResult(_0x40d858,_0x1d7c6b){return function(_0x40ec74){if(_0x40ec74){var _0x5beb86=typeof _0x1d7c6b['offset']==='undefined'&&typeof _0x1d7c6b['limit']===_0xb4e8('0x1b');var _0x163906=_0x40ec74['count'];var _0x29fa1e=_0x5beb86?0x0:_0x1d7c6b['offset'];var _0x1ed68d=_0x5beb86?_0x40ec74[_0xb4e8('0x1c')]:_0x1d7c6b[_0xb4e8('0x1d')]+_0x1d7c6b[_0xb4e8('0x1e')];var _0x54fc6f;if(_0x1ed68d>=_0x163906){_0x1ed68d=_0x163906;_0x54fc6f=0xc8;}else{_0x54fc6f=0xce;}_0x40d858[_0xb4e8('0x18')](_0x54fc6f);return _0x40d858[_0xb4e8('0x1f')](_0xb4e8('0x20'),_0x29fa1e+'-'+_0x1ed68d+'/'+_0x163906)['json'](_0x40ec74);}return null;};}function patchUpdates(_0x471a1f){return function(_0x308401){try{jsonpatch[_0xb4e8('0x21')](_0x308401,_0x471a1f,!![]);}catch(_0x55517e){return BPromise[_0xb4e8('0x22')](_0x55517e);}return _0x308401['save']();};}function saveUpdates(_0x4aa464,_0x3d5ec5){return function(_0x2019b2){if(_0x2019b2){return _0x2019b2[_0xb4e8('0x23')](_0x4aa464)['then'](function(_0x42f81d){return _0x42f81d;});}return null;};}function removeEntity(_0x154011,_0x30340c){return function(_0x19e8fa){if(_0x19e8fa){return _0x19e8fa[_0xb4e8('0x24')]()['then'](function(){_0x154011['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7bf6,_0x5f4136){return function(_0x28c274){if(!_0x28c274){_0x1f7bf6['sendStatus'](0x194);}return _0x28c274;};}function handleError(_0x3778b7,_0x3791dc){_0x3791dc=_0x3791dc||0x1f4;return function(_0x4d0c48){logger['error'](_0x4d0c48[_0xb4e8('0x25')]);if(_0x4d0c48['name']){delete _0x4d0c48[_0xb4e8('0x26')];}_0x3778b7[_0xb4e8('0x18')](_0x3791dc)[_0xb4e8('0x27')](_0x4d0c48);};}exports[_0xb4e8('0x28')]=function(_0x15f225,_0x634a01){var _0x1b8e80={},_0x3ad969={},_0x505567={'count':0x0,'rows':[]};var _0x4ecc62=_[_0xb4e8('0x29')](db[_0xb4e8('0x2a')][_0xb4e8('0x2b')],function(_0x4c9d88){return{'name':_0x4c9d88[_0xb4e8('0x2c')],'type':_0x4c9d88[_0xb4e8('0x2d')][_0xb4e8('0x2e')]};});_0x3ad969[_0xb4e8('0x2f')]=_[_0xb4e8('0x29')](_0x4ecc62,_0xb4e8('0x26'));_0x3ad969[_0xb4e8('0x30')]=_[_0xb4e8('0x31')](_0x15f225['query']);_0x3ad969[_0xb4e8('0x32')]=_[_0xb4e8('0x33')](_0x3ad969[_0xb4e8('0x2f')],_0x3ad969[_0xb4e8('0x30')]);_0x1b8e80[_0xb4e8('0x34')]=_[_0xb4e8('0x33')](_0x3ad969['model'],qs['fields'](_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x35')]));_0x1b8e80[_0xb4e8('0x34')]=_0x1b8e80[_0xb4e8('0x34')]['length']?_0x1b8e80['attributes']:_0x3ad969[_0xb4e8('0x2f')];if(!_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x36')](_0xb4e8('0x37'))){_0x1b8e80['limit']=qs[_0xb4e8('0x1e')](_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x1e')]);_0x1b8e80[_0xb4e8('0x1d')]=qs['offset'](_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x1d')]);}_0x1b8e80[_0xb4e8('0x38')]=qs['sort'](_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x39')]);_0x1b8e80[_0xb4e8('0x3a')]=qs[_0xb4e8('0x32')](_[_0xb4e8('0x3b')](_0x15f225['query'],_0x3ad969[_0xb4e8('0x32')]),_0x4ecc62);if(_0x15f225['query'][_0xb4e8('0x3c')]){_0x1b8e80[_0xb4e8('0x3a')]=_[_0xb4e8('0x3d')](_0x1b8e80[_0xb4e8('0x3a')],{'$or':_['map'](_0x4ecc62,function(_0x5d351d){if(_0x5d351d[_0xb4e8('0x2d')]!==_0xb4e8('0x3e')){var _0x5a5215={};_0x5a5215[_0x5d351d[_0xb4e8('0x26')]]={'$like':'%'+_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x3c')]+'%'};return _0x5a5215;}})});}_0x1b8e80=_[_0xb4e8('0x3d')]({},_0x1b8e80,_0x15f225['options']);var _0x1ce5dc={'where':_0x1b8e80[_0xb4e8('0x3a')]};return db[_0xb4e8('0x2a')][_0xb4e8('0x1c')](_0x1ce5dc)[_0xb4e8('0x3f')](function(_0x2b2cec){_0x505567['count']=_0x2b2cec;if(_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x40')]){_0x1b8e80['include']=[{'all':!![]}];}return db[_0xb4e8('0x2a')][_0xb4e8('0x41')](_0x1b8e80);})[_0xb4e8('0x3f')](function(_0x107ebb){_0x505567[_0xb4e8('0x42')]=_0x107ebb;return _0x505567;})['then'](respondWithFilteredResult(_0x634a01,_0x1b8e80))[_0xb4e8('0x43')](handleError(_0x634a01,null));};exports[_0xb4e8('0x44')]=function(_0x38fef8,_0x2b965f){var _0x529ae0={'raw':!![],'where':{'id':_0x38fef8[_0xb4e8('0x45')]['id']}},_0x465ca5={};_0x465ca5[_0xb4e8('0x2f')]=_['keys'](db[_0xb4e8('0x2a')][_0xb4e8('0x2b')]);_0x465ca5[_0xb4e8('0x30')]=_['keys'](_0x38fef8['query']);_0x465ca5[_0xb4e8('0x32')]=_[_0xb4e8('0x33')](_0x465ca5['model'],_0x465ca5[_0xb4e8('0x30')]);_0x529ae0[_0xb4e8('0x34')]=_['intersection'](_0x465ca5[_0xb4e8('0x2f')],qs[_0xb4e8('0x35')](_0x38fef8[_0xb4e8('0x30')]['fields']));_0x529ae0['attributes']=_0x529ae0['attributes'][_0xb4e8('0x46')]?_0x529ae0[_0xb4e8('0x34')]:_0x465ca5['model'];if(_0x38fef8[_0xb4e8('0x30')]['includeAll']){_0x529ae0['include']=[{'all':!![]}];}_0x529ae0=_['merge']({},_0x529ae0,_0x38fef8[_0xb4e8('0x47')]);return db['ZendeskField'][_0xb4e8('0x48')](_0x529ae0)['then'](handleEntityNotFound(_0x2b965f,null))['then'](respondWithResult(_0x2b965f,null))[_0xb4e8('0x43')](handleError(_0x2b965f,null));};exports['create']=function(_0x1a5bd6,_0x411348){return db[_0xb4e8('0x2a')][_0xb4e8('0x49')](_0x1a5bd6[_0xb4e8('0x4a')],{})[_0xb4e8('0x3f')](respondWithResult(_0x411348,0xc9))[_0xb4e8('0x43')](handleError(_0x411348,null));};exports['update']=function(_0x2bf323,_0x7ff42b){if(_0x2bf323[_0xb4e8('0x4a')]['id']){delete _0x2bf323[_0xb4e8('0x4a')]['id'];}return db['ZendeskField'][_0xb4e8('0x48')]({'where':{'id':_0x2bf323[_0xb4e8('0x45')]['id']}})[_0xb4e8('0x3f')](handleEntityNotFound(_0x7ff42b,null))[_0xb4e8('0x3f')](saveUpdates(_0x2bf323[_0xb4e8('0x4a')],null))[_0xb4e8('0x3f')](respondWithResult(_0x7ff42b,null))[_0xb4e8('0x43')](handleError(_0x7ff42b,null));};exports[_0xb4e8('0x24')]=function(_0x229c2d,_0x2d6290){return db[_0xb4e8('0x2a')][_0xb4e8('0x48')]({'where':{'id':_0x229c2d[_0xb4e8('0x45')]['id']}})[_0xb4e8('0x3f')](handleEntityNotFound(_0x2d6290,null))['then'](removeEntity(_0x2d6290,null))[_0xb4e8('0x43')](handleError(_0x2d6290,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index aa0247e..d703b48 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 _0xfbc1=['int_zendesk_fields','zendesk_unique_index','idField','lodash','util','api','moment','request-promise','../../config/environment','./intZendeskField.attributes','exports','ZendeskField'];(function(_0xfc088a,_0x18a3a3){var _0xf7c13b=function(_0x1f5c8e){while(--_0x1f5c8e){_0xfc088a['push'](_0xfc088a['shift']());}};_0xf7c13b(++_0x18a3a3);}(_0xfbc1,0x18f));var _0x1fbc=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xfbc1[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0x1fbc('0x0'));var util=require(_0x1fbc('0x1'));var logger=require('../../config/logger')(_0x1fbc('0x2'));var moment=require(_0x1fbc('0x3'));var BPromise=require('bluebird');var rp=require(_0x1fbc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1fbc('0x5'));var attributes=require(_0x1fbc('0x6'));module[_0x1fbc('0x7')]=function(_0x227221,_0x42803c){return _0x227221['define'](_0x1fbc('0x8'),attributes,{'tableName':_0x1fbc('0x9'),'paranoid':![],'indexes':[{'name':_0x1fbc('0xa'),'fields':[_0x1fbc('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8c7=['request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','lodash','util','../../config/logger','api','moment'];(function(_0x11183c,_0x3c6d41){var _0x365319=function(_0x3c2d08){while(--_0x3c2d08){_0x11183c['push'](_0x11183c['shift']());}};_0x365319(++_0x3c6d41);}(_0xa8c7,0x1e9));var _0x7a8c=function(_0x3afe14,_0xd30ca7){_0x3afe14=_0x3afe14-0x0;var _0x18bb93=_0xa8c7[_0x3afe14];return _0x18bb93;};'use strict';var _=require(_0x7a8c('0x0'));var util=require(_0x7a8c('0x1'));var logger=require(_0x7a8c('0x2'))(_0x7a8c('0x3'));var moment=require(_0x7a8c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a8c('0x5'));var fs=require('fs');var path=require(_0x7a8c('0x6'));var rimraf=require(_0x7a8c('0x7'));var config=require(_0x7a8c('0x8'));var attributes=require(_0x7a8c('0x9'));module[_0x7a8c('0xa')]=function(_0x45cac1,_0x364129){return _0x45cac1[_0x7a8c('0xb')](_0x7a8c('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index ad2080f..bdbf421 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 _0x3bab=['../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x142734,_0x263682){var _0x3e3d89=function(_0x4b758d){while(--_0x4b758d){_0x142734['push'](_0x142734['shift']());}};_0x3e3d89(++_0x263682);}(_0x3bab,0xb8));var _0xb3ba=function(_0x412b2d,_0x2f86d6){_0x412b2d=_0x412b2d-0x0;var _0x477fd2=_0x3bab[_0x412b2d];return _0x477fd2;};'use strict';var _=require(_0xb3ba('0x0'));var util=require(_0xb3ba('0x1'));var moment=require(_0xb3ba('0x2'));var BPromise=require(_0xb3ba('0x3'));var rs=require(_0xb3ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb3ba('0x5'));var logger=require(_0xb3ba('0x6'))(_0xb3ba('0x7'));var config=require(_0xb3ba('0x8'));var jayson=require(_0xb3ba('0x9'));var client=jayson[_0xb3ba('0xa')][_0xb3ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53b0ee,_0x13e8f3,_0x599dd7){return new BPromise(function(_0x5d83f9,_0x2c82d3){return client[_0xb3ba('0xc')](_0x53b0ee,_0x599dd7)[_0xb3ba('0xd')](function(_0x4b121c){logger['info'](_0xb3ba('0xe'),_0x13e8f3,_0xb3ba('0xf'));logger[_0xb3ba('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x13e8f3,_0xb3ba('0xf'),JSON[_0xb3ba('0x11')](_0x4b121c));if(_0x4b121c[_0xb3ba('0x12')]){if(_0x4b121c[_0xb3ba('0x12')][_0xb3ba('0x13')]===0x1f4){logger[_0xb3ba('0x12')](_0xb3ba('0xe'),_0x13e8f3,_0x4b121c['error'][_0xb3ba('0x14')]);return _0x2c82d3(_0x4b121c[_0xb3ba('0x12')][_0xb3ba('0x14')]);}logger['error'](_0xb3ba('0xe'),_0x13e8f3,_0x4b121c[_0xb3ba('0x12')][_0xb3ba('0x14')]);return _0x5d83f9(_0x4b121c[_0xb3ba('0x12')][_0xb3ba('0x14')]);}else{logger[_0xb3ba('0x15')]('ZendeskField,\x20%s,\x20%s',_0x13e8f3,_0xb3ba('0xf'));_0x5d83f9(_0x4b121c[_0xb3ba('0x16')]['message']);}})[_0xb3ba('0x17')](function(_0x238f1f){logger[_0xb3ba('0x12')]('ZendeskField,\x20%s,\x20%s',_0x13e8f3,_0x238f1f);_0x2c82d3(_0x238f1f);});});} \ No newline at end of file +var _0x7334=['info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7334,0x135));var _0x4733=function(_0x43d097,_0x104d6a){_0x43d097=_0x43d097-0x0;var _0x5c0a2d=_0x7334[_0x43d097];return _0x5c0a2d;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require(_0x4733('0x3'));var rs=require(_0x4733('0x4'));var fs=require('fs');var Redis=require(_0x4733('0x5'));var db=require(_0x4733('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4733('0x7'))(_0x4733('0x8'));var config=require(_0x4733('0x9'));var jayson=require(_0x4733('0xa'));var client=jayson['client'][_0x4733('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48a0b2,_0xca0086,_0x4017d3){return new BPromise(function(_0x4f2fa6,_0x50109d){return client['request'](_0x48a0b2,_0x4017d3)[_0x4733('0xc')](function(_0x33f144){logger[_0x4733('0xd')](_0x4733('0xe'),_0xca0086,_0x4733('0xf'));logger[_0x4733('0x10')](_0x4733('0x11'),_0xca0086,_0x4733('0xf'),JSON['stringify'](_0x33f144));if(_0x33f144[_0x4733('0x12')]){if(_0x33f144['error'][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0xca0086,_0x33f144[_0x4733('0x12')][_0x4733('0x14')]);return _0x50109d(_0x33f144[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('ZendeskField,\x20%s,\x20%s',_0xca0086,_0x33f144[_0x4733('0x12')]['message']);return _0x4f2fa6(_0x33f144[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0xca0086,_0x4733('0xf'));_0x4f2fa6(_0x33f144[_0x4733('0x15')][_0x4733('0x14')]);}})[_0x4733('0x16')](function(_0xc3a582){logger['error'](_0x4733('0xe'),_0xca0086,_0xc3a582);_0x50109d(_0xc3a582);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 00cbfcb..6b85c0f 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 _0xc0e7=['getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','addConfiguration','put','/:id','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoAccount.controller','get','index','show','/:id/configurations'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0xc0e7,0x1d9));var _0x7c0e=function(_0x38507f,_0x18fe01){_0x38507f=_0x38507f-0x0;var _0x558fa9=_0xc0e7[_0x38507f];return _0x558fa9;};'use strict';var multer=require(_0x7c0e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7c0e('0x1'));var express=require(_0x7c0e('0x2'));var router=express[_0x7c0e('0x3')]();var fs_extra=require(_0x7c0e('0x4'));var auth=require(_0x7c0e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7c0e('0x6'));router[_0x7c0e('0x7')]('/',auth['isAuthenticated'](),controller[_0x7c0e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7c0e('0x9')]);router[_0x7c0e('0x7')](_0x7c0e('0xa'),auth['isAuthenticated'](),controller[_0x7c0e('0xb')]);router['get'](_0x7c0e('0xc'),auth[_0x7c0e('0xd')](),controller[_0x7c0e('0xe')]);router[_0x7c0e('0xf')]('/',auth[_0x7c0e('0xd')](),controller[_0x7c0e('0x10')]);router['post'](_0x7c0e('0xa'),auth[_0x7c0e('0xd')](),controller[_0x7c0e('0x11')]);router[_0x7c0e('0x12')](_0x7c0e('0x13'),auth[_0x7c0e('0xd')](),controller[_0x7c0e('0x14')]);router['delete'](_0x7c0e('0x13'),auth[_0x7c0e('0xd')](),controller['destroy']);module[_0x7c0e('0x15')]=router; \ No newline at end of file +var _0x5ae4=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x305b4c,_0x20f176){var _0x301bee=function(_0x1c8987){while(--_0x1c8987){_0x305b4c['push'](_0x305b4c['shift']());}};_0x301bee(++_0x20f176);}(_0x5ae4,0x72));var _0x45ae=function(_0x150747,_0x6e849b){_0x150747=_0x150747-0x0;var _0x654974=_0x5ae4[_0x150747];return _0x654974;};'use strict';var multer=require('multer');var util=require(_0x45ae('0x0'));var path=require(_0x45ae('0x1'));var timeout=require(_0x45ae('0x2'));var express=require('express');var router=express[_0x45ae('0x3')]();var fs_extra=require(_0x45ae('0x4'));var auth=require(_0x45ae('0x5'));var interaction=require(_0x45ae('0x6'));var config=require(_0x45ae('0x7'));var controller=require(_0x45ae('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x45ae('0x9')]);router['get'](_0x45ae('0xa'),auth[_0x45ae('0xb')](),controller[_0x45ae('0xc')]);router[_0x45ae('0xd')](_0x45ae('0xe'),auth[_0x45ae('0xb')](),controller[_0x45ae('0xf')]);router['get']('/:id/fields',auth[_0x45ae('0xb')](),controller[_0x45ae('0x10')]);router['post']('/',auth[_0x45ae('0xb')](),controller[_0x45ae('0x11')]);router[_0x45ae('0x12')]('/:id/configurations',auth[_0x45ae('0xb')](),controller[_0x45ae('0x13')]);router[_0x45ae('0x14')](_0x45ae('0xa'),auth[_0x45ae('0xb')](),controller[_0x45ae('0x15')]);router[_0x45ae('0x16')]('/:id',auth[_0x45ae('0xb')](),controller[_0x45ae('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 9b524ce..43a7409 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 _0xa75b=['sequelize','STRING'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xa75b,0x170));var _0xba75=function(_0x500d9e,_0x4e2810){_0x500d9e=_0x500d9e-0x0;var _0x18401f=_0xa75b[_0x500d9e];return _0x18401f;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba75('0x1')]},'host':{'type':Sequelize[_0xba75('0x1')]},'zone':{'type':Sequelize[_0xba75('0x1')]},'clientId':{'type':Sequelize[_0xba75('0x1')]},'clientSecret':{'type':Sequelize[_0xba75('0x1')]},'serverUrl':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xba75('0x1')]},'refreshToken':{'type':Sequelize[_0xba75('0x1')]}}; \ No newline at end of file +var _0x99e9=['exports','STRING'];(function(_0x597040,_0x9eb682){var _0x13df75=function(_0xec2ed){while(--_0xec2ed){_0x597040['push'](_0x597040['shift']());}};_0x13df75(++_0x9eb682);}(_0x99e9,0xb4));var _0x999e=function(_0x5427c8,_0x18f384){_0x5427c8=_0x5427c8-0x0;var _0x33a129=_0x99e9[_0x5427c8];return _0x33a129;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9d7b7ed..9607a5e 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 _0x956b=['send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','ZohoAccount','includeAll','findAll','catch','show','params','include','find','create','body','getConfigurations','ZohoConfiguration','filter','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','error','name'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x956b,0xe2));var _0xb956=function(_0xa804c,_0x21a85b){_0xa804c=_0xa804c-0x0;var _0x158afd=_0x956b[_0xa804c];return _0x158afd;};'use strict';var emlformat=require(_0xb956('0x0'));var rimraf=require(_0xb956('0x1'));var zipdir=require(_0xb956('0x2'));var jsonpatch=require(_0xb956('0x3'));var rp=require(_0xb956('0x4'));var moment=require(_0xb956('0x5'));var BPromise=require(_0xb956('0x6'));var Mustache=require('mustache');var util=require(_0xb956('0x7'));var path=require(_0xb956('0x8'));var sox=require('sox');var csv=require(_0xb956('0x9'));var ejs=require(_0xb956('0xa'));var fs=require('fs');var fs_extra=require(_0xb956('0xb'));var _=require(_0xb956('0xc'));var squel=require(_0xb956('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb956('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb956('0xf'));var Redis=require('ioredis');var authService=require(_0xb956('0x10'));var qs=require(_0xb956('0x11'));var as=require(_0xb956('0x12'));var hardwareService=require(_0xb956('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb956('0x14'));var config=require(_0xb956('0x15'));var licenseUtil=require(_0xb956('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb956('0x17'));function respondWithStatusCode(_0x1c19f1,_0x29012c){_0x29012c=_0x29012c||0xcc;return function(_0x5bda7e){if(_0x5bda7e){return _0x1c19f1[_0xb956('0x18')](_0x29012c);}return _0x1c19f1[_0xb956('0x19')](_0x29012c)['end']();};}function respondWithResult(_0x15d3be,_0x3bc8ac){_0x3bc8ac=_0x3bc8ac||0xc8;return function(_0x55b48e){if(_0x55b48e){return _0x15d3be[_0xb956('0x19')](_0x3bc8ac)[_0xb956('0x1a')](_0x55b48e);}};}function respondWithFilteredResult(_0x17fc87,_0x337670){return function(_0x4d9172){if(_0x4d9172){var _0x4e8576=typeof _0x337670[_0xb956('0x1b')]===_0xb956('0x1c')&&typeof _0x337670['limit']===_0xb956('0x1c');var _0x4a82f8=_0x4d9172[_0xb956('0x1d')];var _0x1c823c=_0x4e8576?0x0:_0x337670[_0xb956('0x1b')];var _0x546385=_0x4e8576?_0x4d9172[_0xb956('0x1d')]:_0x337670['offset']+_0x337670[_0xb956('0x1e')];var _0x2ee9f5;if(_0x546385>=_0x4a82f8){_0x546385=_0x4a82f8;_0x2ee9f5=0xc8;}else{_0x2ee9f5=0xce;}_0x17fc87[_0xb956('0x19')](_0x2ee9f5);return _0x17fc87[_0xb956('0x1f')]('Content-Range',_0x1c823c+'-'+_0x546385+'/'+_0x4a82f8)[_0xb956('0x1a')](_0x4d9172);}return null;};}function patchUpdates(_0x7bc50d){return function(_0x581384){try{jsonpatch[_0xb956('0x20')](_0x581384,_0x7bc50d,!![]);}catch(_0x318c2c){return BPromise[_0xb956('0x21')](_0x318c2c);}return _0x581384[_0xb956('0x22')]();};}function saveUpdates(_0x2db251,_0x1e9563){return function(_0x49ba40){if(_0x49ba40){return _0x49ba40[_0xb956('0x23')](_0x2db251)[_0xb956('0x24')](function(_0x348485){return _0x348485;});}return null;};}function removeEntity(_0x3614a7,_0x356501){return function(_0x38e860){if(_0x38e860){return _0x38e860['destroy']()[_0xb956('0x24')](function(){_0x3614a7[_0xb956('0x19')](0xcc)[_0xb956('0x25')]();});}};}function handleEntityNotFound(_0x449dba,_0x3eaa54){return function(_0x3b0783){if(!_0x3b0783){_0x449dba['sendStatus'](0x194);}return _0x3b0783;};}function handleError(_0x438f09,_0xaf5c89){_0xaf5c89=_0xaf5c89||0x1f4;return function(_0x1202b3){logger[_0xb956('0x26')](_0x1202b3['stack']);if(_0x1202b3[_0xb956('0x27')]){delete _0x1202b3[_0xb956('0x27')];}_0x438f09[_0xb956('0x19')](_0xaf5c89)[_0xb956('0x28')](_0x1202b3);};}exports[_0xb956('0x29')]=function(_0x367329,_0x3d387b){var _0x1be6e9={},_0x1cb50f={},_0x296c8f={'count':0x0,'rows':[]};var _0x395ab1=_['map'](db['ZohoAccount'][_0xb956('0x2a')],function(_0x306382){return{'name':_0x306382[_0xb956('0x2b')],'type':_0x306382['type'][_0xb956('0x2c')]};});_0x1cb50f[_0xb956('0x2d')]=_[_0xb956('0x2e')](_0x395ab1,_0xb956('0x27'));_0x1cb50f[_0xb956('0x2f')]=_[_0xb956('0x30')](_0x367329[_0xb956('0x2f')]);_0x1cb50f[_0xb956('0x31')]=_[_0xb956('0x32')](_0x1cb50f[_0xb956('0x2d')],_0x1cb50f[_0xb956('0x2f')]);_0x1be6e9['attributes']=_[_0xb956('0x32')](_0x1cb50f[_0xb956('0x2d')],qs[_0xb956('0x33')](_0x367329[_0xb956('0x2f')][_0xb956('0x33')]));_0x1be6e9[_0xb956('0x34')]=_0x1be6e9[_0xb956('0x34')][_0xb956('0x35')]?_0x1be6e9[_0xb956('0x34')]:_0x1cb50f['model'];if(!_0x367329['query'][_0xb956('0x36')](_0xb956('0x37'))){_0x1be6e9['limit']=qs[_0xb956('0x1e')](_0x367329[_0xb956('0x2f')][_0xb956('0x1e')]);_0x1be6e9['offset']=qs[_0xb956('0x1b')](_0x367329['query']['offset']);}_0x1be6e9[_0xb956('0x38')]=qs[_0xb956('0x39')](_0x367329[_0xb956('0x2f')][_0xb956('0x39')]);_0x1be6e9[_0xb956('0x3a')]=qs[_0xb956('0x31')](_[_0xb956('0x3b')](_0x367329[_0xb956('0x2f')],_0x1cb50f['filters']),_0x395ab1);if(_0x367329[_0xb956('0x2f')]['filter']){_0x1be6e9['where']=_['merge'](_0x1be6e9[_0xb956('0x3a')],{'$or':_[_0xb956('0x2e')](_0x395ab1,function(_0x44835f){if(_0x44835f[_0xb956('0x3c')]!==_0xb956('0x3d')){var _0x2613cd={};_0x2613cd[_0x44835f[_0xb956('0x27')]]={'$like':'%'+_0x367329[_0xb956('0x2f')]['filter']+'%'};return _0x2613cd;}})});}_0x1be6e9=_[_0xb956('0x3e')]({},_0x1be6e9,_0x367329[_0xb956('0x3f')]);var _0x4a5143={'where':_0x1be6e9[_0xb956('0x3a')]};return db[_0xb956('0x40')][_0xb956('0x1d')](_0x4a5143)[_0xb956('0x24')](function(_0x55b32f){_0x296c8f[_0xb956('0x1d')]=_0x55b32f;if(_0x367329['query'][_0xb956('0x41')]){_0x1be6e9['include']=[{'all':!![]}];}return db[_0xb956('0x40')][_0xb956('0x42')](_0x1be6e9);})['then'](function(_0x4af00d){_0x296c8f['rows']=_0x4af00d;return _0x296c8f;})[_0xb956('0x24')](respondWithFilteredResult(_0x3d387b,_0x1be6e9))[_0xb956('0x43')](handleError(_0x3d387b,null));};exports[_0xb956('0x44')]=function(_0x729d86,_0x9fb157){var _0xc00121={'raw':![],'where':{'id':_0x729d86[_0xb956('0x45')]['id']}},_0x3cf2e8={};_0x3cf2e8[_0xb956('0x2d')]=_[_0xb956('0x30')](db[_0xb956('0x40')][_0xb956('0x2a')]);_0x3cf2e8[_0xb956('0x2f')]=_[_0xb956('0x30')](_0x729d86[_0xb956('0x2f')]);_0x3cf2e8[_0xb956('0x31')]=_[_0xb956('0x32')](_0x3cf2e8[_0xb956('0x2d')],_0x3cf2e8[_0xb956('0x2f')]);_0xc00121[_0xb956('0x34')]=_[_0xb956('0x32')](_0x3cf2e8['model'],qs[_0xb956('0x33')](_0x729d86[_0xb956('0x2f')][_0xb956('0x33')]));_0xc00121[_0xb956('0x34')]=_0xc00121[_0xb956('0x34')][_0xb956('0x35')]?_0xc00121['attributes']:_0x3cf2e8[_0xb956('0x2d')];if(_0x729d86['query'][_0xb956('0x41')]){_0xc00121[_0xb956('0x46')]=[{'all':!![]}];}_0xc00121=_[_0xb956('0x3e')]({},_0xc00121,_0x729d86[_0xb956('0x3f')]);return db['ZohoAccount'][_0xb956('0x47')](_0xc00121)[_0xb956('0x24')](handleEntityNotFound(_0x9fb157,null))[_0xb956('0x24')](respondWithResult(_0x9fb157,null))['catch'](handleError(_0x9fb157,null));};exports[_0xb956('0x48')]=function(_0x3641e0,_0x39097b){return db[_0xb956('0x40')][_0xb956('0x48')](_0x3641e0[_0xb956('0x49')],{})[_0xb956('0x24')](respondWithResult(_0x39097b,0xc9))[_0xb956('0x43')](handleError(_0x39097b,null));};exports[_0xb956('0x23')]=function(_0x17be38,_0x3e72ed){if(_0x17be38[_0xb956('0x49')]['id']){delete _0x17be38[_0xb956('0x49')]['id'];}return db[_0xb956('0x40')][_0xb956('0x47')]({'where':{'id':_0x17be38['params']['id']}})[_0xb956('0x24')](handleEntityNotFound(_0x3e72ed,null))['then'](saveUpdates(_0x17be38[_0xb956('0x49')],null))[_0xb956('0x24')](respondWithResult(_0x3e72ed,null))['catch'](handleError(_0x3e72ed,null));};exports['destroy']=function(_0x210e86,_0x370a6d){return db[_0xb956('0x40')][_0xb956('0x47')]({'where':{'id':_0x210e86[_0xb956('0x45')]['id']}})[_0xb956('0x24')](handleEntityNotFound(_0x370a6d,null))[_0xb956('0x24')](removeEntity(_0x370a6d,null))[_0xb956('0x43')](handleError(_0x370a6d,null));};exports[_0xb956('0x4a')]=function(_0x5ceaf5,_0x4ebf7d,_0x121a3e){var _0xb8a287={};var _0x423d27={};var _0x5f43c7;var _0x1cfbde;return db[_0xb956('0x40')]['findOne']({'where':{'id':_0x5ceaf5[_0xb956('0x45')]['id']}})[_0xb956('0x24')](handleEntityNotFound(_0x4ebf7d,null))['then'](function(_0x57d36){if(_0x57d36){_0x5f43c7=_0x57d36;_0x423d27[_0xb956('0x2d')]=_[_0xb956('0x30')](db[_0xb956('0x4b')][_0xb956('0x2a')]);_0x423d27[_0xb956('0x2f')]=_['keys'](_0x5ceaf5['query']);_0x423d27[_0xb956('0x31')]=_[_0xb956('0x32')](_0x423d27[_0xb956('0x2d')],_0x423d27[_0xb956('0x2f')]);_0xb8a287[_0xb956('0x34')]=_[_0xb956('0x32')](_0x423d27['model'],qs[_0xb956('0x33')](_0x5ceaf5[_0xb956('0x2f')][_0xb956('0x33')]));_0xb8a287[_0xb956('0x34')]=_0xb8a287['attributes'][_0xb956('0x35')]?_0xb8a287[_0xb956('0x34')]:_0x423d27[_0xb956('0x2d')];_0xb8a287[_0xb956('0x38')]=qs['sort'](_0x5ceaf5[_0xb956('0x2f')]['sort']);_0xb8a287[_0xb956('0x3a')]=qs[_0xb956('0x31')](_[_0xb956('0x3b')](_0x5ceaf5[_0xb956('0x2f')],_0x423d27[_0xb956('0x31')]));if(_0x5ceaf5[_0xb956('0x2f')][_0xb956('0x4c')]){_0xb8a287['where']=_[_0xb956('0x3e')](_0xb8a287[_0xb956('0x3a')],{'$or':_['map'](_0xb8a287[_0xb956('0x34')],function(_0x53e620){var _0xf77656={};_0xf77656[_0x53e620]={'$like':'%'+_0x5ceaf5[_0xb956('0x2f')][_0xb956('0x4c')]+'%'};return _0xf77656;})});}_0xb8a287=_[_0xb956('0x3e')]({},_0xb8a287,_0x5ceaf5[_0xb956('0x3f')]);return _0x5f43c7['getConfigurations'](_0xb8a287);}})[_0xb956('0x24')](function(_0x2082ec){if(_0x2082ec){_0x1cfbde=_0x2082ec[_0xb956('0x35')];if(!_0x5ceaf5[_0xb956('0x2f')][_0xb956('0x36')](_0xb956('0x37'))){_0xb8a287['limit']=qs[_0xb956('0x1e')](_0x5ceaf5[_0xb956('0x2f')][_0xb956('0x1e')]);_0xb8a287[_0xb956('0x1b')]=qs['offset'](_0x5ceaf5[_0xb956('0x2f')][_0xb956('0x1b')]);}return _0x5f43c7[_0xb956('0x4a')](_0xb8a287);}})[_0xb956('0x24')](function(_0x56a049){if(_0x56a049){return _0x56a049?{'count':_0x1cfbde,'rows':_0x56a049}:null;}})[_0xb956('0x24')](respondWithResult(_0x4ebf7d,null))[_0xb956('0x43')](handleError(_0x4ebf7d,null));};exports[_0xb956('0x4d')]=function(_0x25c7cd,_0x10f300,_0x196595){if(_0x25c7cd[_0xb956('0x49')]['id']){delete _0x25c7cd[_0xb956('0x49')]['id'];}return db[_0xb956('0x40')][_0xb956('0x4e')]({'where':{'id':_0x25c7cd[_0xb956('0x45')]['id']}})[_0xb956('0x24')](handleEntityNotFound(_0x10f300,null))[_0xb956('0x24')](function(_0x210ef7){if(_0x210ef7){_0x25c7cd[_0xb956('0x49')][_0xb956('0x4f')]=_0x210ef7['id'];_0x25c7cd[_0xb956('0x49')][_0xb956('0x50')]=integrations[_0xb956('0x51')](_0x25c7cd[_0xb956('0x49')][_0xb956('0x52')],_0x25c7cd[_0xb956('0x49')][_0xb956('0x3c')]);_0x25c7cd[_0xb956('0x49')][_0xb956('0x53')]=integrations['getDescriptions'](_0x25c7cd[_0xb956('0x49')][_0xb956('0x52')],_0x25c7cd[_0xb956('0x49')][_0xb956('0x3c')]);return db[_0xb956('0x4b')]['create'](_0x25c7cd[_0xb956('0x49')],{'include':[{'model':db[_0xb956('0x54')],'as':_0xb956('0x50')},{'model':db[_0xb956('0x54')],'as':_0xb956('0x53')}]});}return null;})[_0xb956('0x24')](respondWithResult(_0x10f300,null))[_0xb956('0x43')](handleError(_0x10f300,null));};function getAccessToken(_0x21b38e){return new Promise(function(_0x4de571,_0x271ec1){var _0xda0714;switch(_0x21b38e[_0xb956('0x55')]){case'US':_0xda0714=_0xb956('0x56');break;case'AU':_0xda0714=_0xb956('0x57');break;case'EU':_0xda0714=_0xb956('0x58');break;case'IN':_0xda0714=_0xb956('0x59');break;case'CN':_0xda0714=_0xb956('0x5a');break;default:_0xda0714=_0xb956('0x58');break;}var _0x192a18={'method':_0xb956('0x5b'),'uri':_0xda0714+_0xb956('0x5c'),'qs':{'refresh_token':_0x21b38e[_0xb956('0x5d')],'client_id':_0x21b38e['clientId'],'client_secret':_0x21b38e[_0xb956('0x5e')],'grant_type':_0xb956('0x5f')},'json':!![]};return rp(_0x192a18)[_0xb956('0x24')](function(_0x3cf2d0){if(_0x3cf2d0['access_token']){_0x4de571(_0x3cf2d0[_0xb956('0x60')]);}else{_0x271ec1(_0xb956('0x61'));}})[_0xb956('0x43')](function(_0x1f6c27){_0x271ec1(_0x1f6c27);});});}exports[_0xb956('0x62')]=function(_0xd26287,_0x59d8b4,_0x3508b0){var _0x4c8313,_0x45cfba,_0x4c0750,_0x3f18be,_0x3aa68c;return db[_0xb956('0x40')][_0xb956('0x4e')]({'where':{'id':_0xd26287[_0xb956('0x45')]['id']},'attributes':['id',_0xb956('0x63'),_0xb956('0x55'),_0xb956('0x64'),_0xb956('0x5e'),_0xb956('0x65'),_0xb956('0x66'),_0xb956('0x5d')]})['then'](handleEntityNotFound(_0x59d8b4,null))[_0xb956('0x24')](function(_0x521b79){_0x3aa68c=_0x521b79;_0x4c8313=_0x3aa68c[_0xb956('0x63')];_0x45cfba=_0x4c8313===_0xb956('0x67')?'eu':_0xb956('0x68');_0x4c0750=_0x3aa68c[_0xb956('0x65')];var _0x1c5989=_0x4c0750[_0xb956('0x69')](-0x1);if(_0x1c5989==='/'||_0x1c5989==='\x5c'||_0x1c5989===':'){_0x4c0750=_0x4c0750[_0xb956('0x6a')](0x0,_0x4c0750['lastIndexOf'](_0x1c5989));}if(!_0x3aa68c[_0xb956('0x5d')]){throw new Error(_0xb956('0x6b'));}return getAccessToken(_0x3aa68c);})[_0xb956('0x24')](function(_0x207775){if(_0x207775){return rp({'method':'GET','uri':util[_0xb956('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x45cfba),'qs':{'module':_0xb956('0x6d')},'headers':{'Authorization':_0xb956('0x6e')+_0x207775},'json':!![]});}})[_0xb956('0x24')](function(_0x59b63a){if(_0x59b63a){if(_0x59b63a['response']&&_0x59b63a[_0xb956('0x6f')][_0xb956('0x26')]){throw new Error(_0x59b63a[_0xb956('0x6f')][_0xb956('0x26')]['message']);}var _0x3ff8bb=[];var _0xba80a9=[];var _0x1516ce=['Owner',_0xb956('0x70'),_0xb956('0x71'),_0xb956('0x72'),_0xb956('0x73'),_0xb956('0x74'),_0xb956('0x75'),_0xb956('0x76')];_0xba80a9=_[_0xb956('0x77')](_0x59b63a[_0xb956('0x33')],function(_0x39080a){return _0x1516ce[_0xb956('0x78')](_0x39080a[_0xb956('0x79')]);});for(var _0x350c69=0x0;_0x350c69<_0xba80a9['length'];_0x350c69++){if(_0xba80a9[_0x350c69][_0xb956('0x7a')]===![]){_0x3ff8bb[_0xb956('0x7b')]({'id':_0xba80a9[_0x350c69]['id'],'name':_0xba80a9[_0x350c69][_0xb956('0x7c')],'custom':_0xba80a9[_0x350c69][_0xb956('0x7d')],'options':_0xba80a9[_0x350c69][_0xb956('0x7e')]===_0xb956('0x7f')&&_0xba80a9[_0x350c69][_0xb956('0x80')][_0xb956('0x35')]>-0x1?_[_0xb956('0x2e')](_0xba80a9[_0x350c69][_0xb956('0x80')],function(_0x2b1945){return{'name':_0x2b1945,'value':_0x2b1945};}):[]});}}return{'count':_0x3ff8bb['length'],'rows':_0x3ff8bb};}else{return{'count':0x0,'rows':[]};}})[_0xb956('0x24')](respondWithResult(_0x59d8b4,null))['catch'](function(_0x423d2d){var _0x73099e=_0xd26287[_0xb956('0x2f')][_0xb956('0x81')]?0x1f4:_0x423d2d[_0xb956('0x82')]||0x1f4;logger[_0xb956('0x26')](_0xb956('0x83'),_0xb956('0x62'),_0x73099e,JSON[_0xb956('0x84')](_0x423d2d));delete _0x423d2d[_0xb956('0x27')];if(_0x73099e===0x191){_0x73099e=0x190;}_0x59d8b4[_0xb956('0x19')](_0x73099e)['send'](_0xd26287[_0xb956('0x2f')][_0xb956('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x423d2d[_0xb956('0x82')]}:_0x423d2d);});}; \ No newline at end of file +var _0xc38f=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','ZohoAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZohoConfiguration','order','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','zoho.eu','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','Call_Result','Call_Start_Time','includes','api_name','push','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment'];(function(_0x2cd247,_0x60b603){var _0x4d8386=function(_0x23ec56){while(--_0x23ec56){_0x2cd247['push'](_0x2cd247['shift']());}};_0x4d8386(++_0x60b603);}(_0xc38f,0xfc));var _0xfc38=function(_0x35d408,_0x5c30ce){_0x35d408=_0x35d408-0x0;var _0x12a981=_0xc38f[_0x35d408];return _0x12a981;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc38('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc38('0x1'));var rp=require(_0xfc38('0x2'));var moment=require(_0xfc38('0x3'));var BPromise=require(_0xfc38('0x4'));var Mustache=require(_0xfc38('0x5'));var util=require(_0xfc38('0x6'));var path=require(_0xfc38('0x7'));var sox=require(_0xfc38('0x8'));var csv=require(_0xfc38('0x9'));var ejs=require(_0xfc38('0xa'));var fs=require('fs');var fs_extra=require(_0xfc38('0xb'));var _=require('lodash');var squel=require(_0xfc38('0xc'));var crypto=require(_0xfc38('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfc38('0xe'));var toCsv=require(_0xfc38('0x9'));var querystring=require(_0xfc38('0xf'));var Papa=require('papaparse');var Redis=require(_0xfc38('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc38('0x11'));var hardwareService=require(_0xfc38('0x12'));var logger=require('../../config/logger')(_0xfc38('0x13'));var utils=require(_0xfc38('0x14'));var config=require(_0xfc38('0x15'));var licenseUtil=require(_0xfc38('0x16'));var db=require(_0xfc38('0x17'))['db'];var integrations=require(_0xfc38('0x18'));function respondWithStatusCode(_0x5848c4,_0x5660b2){_0x5660b2=_0x5660b2||0xcc;return function(_0x225bf7){if(_0x225bf7){return _0x5848c4[_0xfc38('0x19')](_0x5660b2);}return _0x5848c4[_0xfc38('0x1a')](_0x5660b2)['end']();};}function respondWithResult(_0x5b292b,_0x15de58){_0x15de58=_0x15de58||0xc8;return function(_0x1b12f7){if(_0x1b12f7){return _0x5b292b[_0xfc38('0x1a')](_0x15de58)[_0xfc38('0x1b')](_0x1b12f7);}};}function respondWithFilteredResult(_0x1b86a,_0xf4640c){return function(_0xbc070f){if(_0xbc070f){var _0x10fee9=typeof _0xf4640c[_0xfc38('0x1c')]===_0xfc38('0x1d')&&typeof _0xf4640c['limit']==='undefined';var _0xa3679a=_0xbc070f[_0xfc38('0x1e')];var _0x5dab57=_0x10fee9?0x0:_0xf4640c[_0xfc38('0x1c')];var _0x375b76=_0x10fee9?_0xbc070f['count']:_0xf4640c[_0xfc38('0x1c')]+_0xf4640c[_0xfc38('0x1f')];var _0xdd2ef;if(_0x375b76>=_0xa3679a){_0x375b76=_0xa3679a;_0xdd2ef=0xc8;}else{_0xdd2ef=0xce;}_0x1b86a['status'](_0xdd2ef);return _0x1b86a[_0xfc38('0x20')](_0xfc38('0x21'),_0x5dab57+'-'+_0x375b76+'/'+_0xa3679a)['json'](_0xbc070f);}return null;};}function patchUpdates(_0x1ef529){return function(_0x4c43ab){try{jsonpatch[_0xfc38('0x22')](_0x4c43ab,_0x1ef529,!![]);}catch(_0x3d617e){return BPromise[_0xfc38('0x23')](_0x3d617e);}return _0x4c43ab['save']();};}function saveUpdates(_0x1e990d,_0x3ec585){return function(_0x1a6814){if(_0x1a6814){return _0x1a6814[_0xfc38('0x24')](_0x1e990d)[_0xfc38('0x25')](function(_0x24ab2c){return _0x24ab2c;});}return null;};}function removeEntity(_0x10b5f6,_0x5d980f){return function(_0x2b97b7){if(_0x2b97b7){return _0x2b97b7[_0xfc38('0x26')]()[_0xfc38('0x25')](function(){_0x10b5f6[_0xfc38('0x1a')](0xcc)[_0xfc38('0x27')]();});}};}function handleEntityNotFound(_0x1e5a27,_0x4322e4){return function(_0x585299){if(!_0x585299){_0x1e5a27[_0xfc38('0x19')](0x194);}return _0x585299;};}function handleError(_0x4df872,_0x1c1ab1){_0x1c1ab1=_0x1c1ab1||0x1f4;return function(_0x59a354){logger[_0xfc38('0x28')](_0x59a354['stack']);if(_0x59a354[_0xfc38('0x29')]){delete _0x59a354[_0xfc38('0x29')];}_0x4df872[_0xfc38('0x1a')](_0x1c1ab1)['send'](_0x59a354);};}exports[_0xfc38('0x2a')]=function(_0x245cec,_0x29229b){var _0xc61913={},_0x2567d4={},_0xe2e9c2={'count':0x0,'rows':[]};var _0x44642d=_[_0xfc38('0x2b')](db[_0xfc38('0x2c')][_0xfc38('0x2d')],function(_0x935ade){return{'name':_0x935ade[_0xfc38('0x2e')],'type':_0x935ade['type'][_0xfc38('0x2f')]};});_0x2567d4['model']=_['map'](_0x44642d,_0xfc38('0x29'));_0x2567d4[_0xfc38('0x30')]=_[_0xfc38('0x31')](_0x245cec[_0xfc38('0x30')]);_0x2567d4[_0xfc38('0x32')]=_[_0xfc38('0x33')](_0x2567d4[_0xfc38('0x34')],_0x2567d4[_0xfc38('0x30')]);_0xc61913[_0xfc38('0x35')]=_[_0xfc38('0x33')](_0x2567d4[_0xfc38('0x34')],qs[_0xfc38('0x36')](_0x245cec[_0xfc38('0x30')][_0xfc38('0x36')]));_0xc61913[_0xfc38('0x35')]=_0xc61913[_0xfc38('0x35')][_0xfc38('0x37')]?_0xc61913['attributes']:_0x2567d4['model'];if(!_0x245cec[_0xfc38('0x30')][_0xfc38('0x38')](_0xfc38('0x39'))){_0xc61913[_0xfc38('0x1f')]=qs[_0xfc38('0x1f')](_0x245cec[_0xfc38('0x30')][_0xfc38('0x1f')]);_0xc61913['offset']=qs[_0xfc38('0x1c')](_0x245cec['query'][_0xfc38('0x1c')]);}_0xc61913['order']=qs[_0xfc38('0x3a')](_0x245cec['query'][_0xfc38('0x3a')]);_0xc61913[_0xfc38('0x3b')]=qs[_0xfc38('0x32')](_[_0xfc38('0x3c')](_0x245cec[_0xfc38('0x30')],_0x2567d4[_0xfc38('0x32')]),_0x44642d);if(_0x245cec[_0xfc38('0x30')][_0xfc38('0x3d')]){_0xc61913[_0xfc38('0x3b')]=_[_0xfc38('0x3e')](_0xc61913[_0xfc38('0x3b')],{'$or':_['map'](_0x44642d,function(_0x35685c){if(_0x35685c[_0xfc38('0x3f')]!=='VIRTUAL'){var _0x594507={};_0x594507[_0x35685c['name']]={'$like':'%'+_0x245cec[_0xfc38('0x30')][_0xfc38('0x3d')]+'%'};return _0x594507;}})});}_0xc61913=_[_0xfc38('0x3e')]({},_0xc61913,_0x245cec[_0xfc38('0x40')]);var _0x14e2ca={'where':_0xc61913[_0xfc38('0x3b')]};return db[_0xfc38('0x2c')]['count'](_0x14e2ca)[_0xfc38('0x25')](function(_0x5a6597){_0xe2e9c2[_0xfc38('0x1e')]=_0x5a6597;if(_0x245cec[_0xfc38('0x30')][_0xfc38('0x41')]){_0xc61913[_0xfc38('0x42')]=[{'all':!![]}];}return db[_0xfc38('0x2c')][_0xfc38('0x43')](_0xc61913);})[_0xfc38('0x25')](function(_0xc2f45e){_0xe2e9c2[_0xfc38('0x44')]=_0xc2f45e;return _0xe2e9c2;})[_0xfc38('0x25')](respondWithFilteredResult(_0x29229b,_0xc61913))[_0xfc38('0x45')](handleError(_0x29229b,null));};exports[_0xfc38('0x46')]=function(_0xd403e2,_0x15d686){var _0x49beaf={'raw':![],'where':{'id':_0xd403e2[_0xfc38('0x47')]['id']}},_0x578b48={};_0x578b48[_0xfc38('0x34')]=_[_0xfc38('0x31')](db[_0xfc38('0x2c')][_0xfc38('0x2d')]);_0x578b48['query']=_['keys'](_0xd403e2[_0xfc38('0x30')]);_0x578b48[_0xfc38('0x32')]=_[_0xfc38('0x33')](_0x578b48[_0xfc38('0x34')],_0x578b48['query']);_0x49beaf[_0xfc38('0x35')]=_[_0xfc38('0x33')](_0x578b48[_0xfc38('0x34')],qs['fields'](_0xd403e2['query'][_0xfc38('0x36')]));_0x49beaf[_0xfc38('0x35')]=_0x49beaf[_0xfc38('0x35')][_0xfc38('0x37')]?_0x49beaf['attributes']:_0x578b48[_0xfc38('0x34')];if(_0xd403e2[_0xfc38('0x30')][_0xfc38('0x41')]){_0x49beaf[_0xfc38('0x42')]=[{'all':!![]}];}_0x49beaf=_[_0xfc38('0x3e')]({},_0x49beaf,_0xd403e2['options']);return db[_0xfc38('0x2c')][_0xfc38('0x48')](_0x49beaf)[_0xfc38('0x25')](handleEntityNotFound(_0x15d686,null))[_0xfc38('0x25')](respondWithResult(_0x15d686,null))[_0xfc38('0x45')](handleError(_0x15d686,null));};exports[_0xfc38('0x49')]=function(_0x3faf64,_0x21093a){return db[_0xfc38('0x2c')][_0xfc38('0x49')](_0x3faf64[_0xfc38('0x4a')],{})[_0xfc38('0x25')](respondWithResult(_0x21093a,0xc9))[_0xfc38('0x45')](handleError(_0x21093a,null));};exports[_0xfc38('0x24')]=function(_0x3ce1dc,_0x596e31){if(_0x3ce1dc[_0xfc38('0x4a')]['id']){delete _0x3ce1dc[_0xfc38('0x4a')]['id'];}return db[_0xfc38('0x2c')][_0xfc38('0x48')]({'where':{'id':_0x3ce1dc[_0xfc38('0x47')]['id']}})[_0xfc38('0x25')](handleEntityNotFound(_0x596e31,null))[_0xfc38('0x25')](saveUpdates(_0x3ce1dc[_0xfc38('0x4a')],null))[_0xfc38('0x25')](respondWithResult(_0x596e31,null))[_0xfc38('0x45')](handleError(_0x596e31,null));};exports[_0xfc38('0x26')]=function(_0x15813a,_0xd674d2){return db[_0xfc38('0x2c')]['find']({'where':{'id':_0x15813a[_0xfc38('0x47')]['id']}})[_0xfc38('0x25')](handleEntityNotFound(_0xd674d2,null))[_0xfc38('0x25')](removeEntity(_0xd674d2,null))[_0xfc38('0x45')](handleError(_0xd674d2,null));};exports['getConfigurations']=function(_0x4baa95,_0x29dff8,_0x193cf5){var _0x53afb6={};var _0x4a89de={};var _0x2f15b8;var _0x37007e;return db[_0xfc38('0x2c')][_0xfc38('0x4b')]({'where':{'id':_0x4baa95['params']['id']}})[_0xfc38('0x25')](handleEntityNotFound(_0x29dff8,null))[_0xfc38('0x25')](function(_0x460dea){if(_0x460dea){_0x2f15b8=_0x460dea;_0x4a89de[_0xfc38('0x34')]=_[_0xfc38('0x31')](db[_0xfc38('0x4c')][_0xfc38('0x2d')]);_0x4a89de[_0xfc38('0x30')]=_[_0xfc38('0x31')](_0x4baa95[_0xfc38('0x30')]);_0x4a89de[_0xfc38('0x32')]=_[_0xfc38('0x33')](_0x4a89de[_0xfc38('0x34')],_0x4a89de['query']);_0x53afb6['attributes']=_[_0xfc38('0x33')](_0x4a89de['model'],qs['fields'](_0x4baa95[_0xfc38('0x30')]['fields']));_0x53afb6[_0xfc38('0x35')]=_0x53afb6[_0xfc38('0x35')][_0xfc38('0x37')]?_0x53afb6[_0xfc38('0x35')]:_0x4a89de[_0xfc38('0x34')];_0x53afb6[_0xfc38('0x4d')]=qs[_0xfc38('0x3a')](_0x4baa95['query'][_0xfc38('0x3a')]);_0x53afb6[_0xfc38('0x3b')]=qs[_0xfc38('0x32')](_['pick'](_0x4baa95[_0xfc38('0x30')],_0x4a89de[_0xfc38('0x32')]));if(_0x4baa95[_0xfc38('0x30')][_0xfc38('0x3d')]){_0x53afb6[_0xfc38('0x3b')]=_[_0xfc38('0x3e')](_0x53afb6['where'],{'$or':_['map'](_0x53afb6[_0xfc38('0x35')],function(_0x42dedf){var _0x562f57={};_0x562f57[_0x42dedf]={'$like':'%'+_0x4baa95[_0xfc38('0x30')]['filter']+'%'};return _0x562f57;})});}_0x53afb6=_['merge']({},_0x53afb6,_0x4baa95[_0xfc38('0x40')]);return _0x2f15b8[_0xfc38('0x4e')](_0x53afb6);}})[_0xfc38('0x25')](function(_0x2d436c){if(_0x2d436c){_0x37007e=_0x2d436c['length'];if(!_0x4baa95[_0xfc38('0x30')]['hasOwnProperty'](_0xfc38('0x39'))){_0x53afb6[_0xfc38('0x1f')]=qs[_0xfc38('0x1f')](_0x4baa95[_0xfc38('0x30')][_0xfc38('0x1f')]);_0x53afb6[_0xfc38('0x1c')]=qs[_0xfc38('0x1c')](_0x4baa95[_0xfc38('0x30')][_0xfc38('0x1c')]);}return _0x2f15b8['getConfigurations'](_0x53afb6);}})[_0xfc38('0x25')](function(_0x2fc2e2){if(_0x2fc2e2){return _0x2fc2e2?{'count':_0x37007e,'rows':_0x2fc2e2}:null;}})[_0xfc38('0x25')](respondWithResult(_0x29dff8,null))[_0xfc38('0x45')](handleError(_0x29dff8,null));};exports[_0xfc38('0x4f')]=function(_0x554517,_0x3e5fd4,_0x25245e){if(_0x554517['body']['id']){delete _0x554517[_0xfc38('0x4a')]['id'];}return db[_0xfc38('0x2c')][_0xfc38('0x4b')]({'where':{'id':_0x554517[_0xfc38('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e5fd4,null))[_0xfc38('0x25')](function(_0x1788d6){if(_0x1788d6){_0x554517[_0xfc38('0x4a')][_0xfc38('0x50')]=_0x1788d6['id'];_0x554517[_0xfc38('0x4a')]['Subjects']=integrations[_0xfc38('0x51')](_0x554517[_0xfc38('0x4a')][_0xfc38('0x52')],_0x554517['body'][_0xfc38('0x3f')]);_0x554517[_0xfc38('0x4a')][_0xfc38('0x53')]=integrations[_0xfc38('0x54')](_0x554517['body'][_0xfc38('0x52')],_0x554517[_0xfc38('0x4a')]['type']);return db[_0xfc38('0x4c')][_0xfc38('0x49')](_0x554517[_0xfc38('0x4a')],{'include':[{'model':db[_0xfc38('0x55')],'as':_0xfc38('0x56')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xfc38('0x25')](respondWithResult(_0x3e5fd4,null))[_0xfc38('0x45')](handleError(_0x3e5fd4,null));};function getAccessToken(_0x210605){return new Promise(function(_0x5bc91b,_0x5957d9){var _0x437229;switch(_0x210605[_0xfc38('0x57')]){case'US':_0x437229=_0xfc38('0x58');break;case'AU':_0x437229=_0xfc38('0x59');break;case'EU':_0x437229='https://accounts.zoho.eu';break;case'IN':_0x437229=_0xfc38('0x5a');break;case'CN':_0x437229=_0xfc38('0x5b');break;default:_0x437229='https://accounts.zoho.eu';break;}var _0x260c34={'method':_0xfc38('0x5c'),'uri':_0x437229+_0xfc38('0x5d'),'qs':{'refresh_token':_0x210605[_0xfc38('0x5e')],'client_id':_0x210605[_0xfc38('0x5f')],'client_secret':_0x210605[_0xfc38('0x60')],'grant_type':_0xfc38('0x61')},'json':!![]};return rp(_0x260c34)['then'](function(_0x5c1cd0){if(_0x5c1cd0['access_token']){_0x5bc91b(_0x5c1cd0[_0xfc38('0x62')]);}else{_0x5957d9('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xfc38('0x45')](function(_0x1665a3){_0x5957d9(_0x1665a3);});});}exports[_0xfc38('0x63')]=function(_0x2994c1,_0x3650e9,_0x114dd4){var _0x424a3f,_0x3089bc,_0x4be672,_0x4ae4b7,_0x420e80;return db[_0xfc38('0x2c')][_0xfc38('0x4b')]({'where':{'id':_0x2994c1[_0xfc38('0x47')]['id']},'attributes':['id',_0xfc38('0x64'),_0xfc38('0x57'),_0xfc38('0x5f'),_0xfc38('0x60'),_0xfc38('0x65'),'code',_0xfc38('0x5e')]})[_0xfc38('0x25')](handleEntityNotFound(_0x3650e9,null))[_0xfc38('0x25')](function(_0x241111){_0x420e80=_0x241111;_0x424a3f=_0x420e80['host'];_0x3089bc=_0x424a3f===_0xfc38('0x66')?'eu':'com';_0x4be672=_0x420e80[_0xfc38('0x65')];var _0x1f0eb8=_0x4be672['slice'](-0x1);if(_0x1f0eb8==='/'||_0x1f0eb8==='\x5c'||_0x1f0eb8===':'){_0x4be672=_0x4be672[_0xfc38('0x67')](0x0,_0x4be672['lastIndexOf'](_0x1f0eb8));}if(!_0x420e80[_0xfc38('0x5e')]){throw new Error(_0xfc38('0x68'));}return getAccessToken(_0x420e80);})[_0xfc38('0x25')](function(_0x461e50){if(_0x461e50){return rp({'method':_0xfc38('0x69'),'uri':util[_0xfc38('0x6a')](_0xfc38('0x6b'),_0x3089bc),'qs':{'module':_0xfc38('0x6c')},'headers':{'Authorization':_0xfc38('0x6d')+_0x461e50},'json':!![]});}})[_0xfc38('0x25')](function(_0x4dd5b2){if(_0x4dd5b2){if(_0x4dd5b2[_0xfc38('0x6e')]&&_0x4dd5b2['response'][_0xfc38('0x28')]){throw new Error(_0x4dd5b2[_0xfc38('0x6e')][_0xfc38('0x28')][_0xfc38('0x6f')]);}var _0x298b8c=[];var _0x41784f=[];var _0x4b0f07=['Owner',_0xfc38('0x70'),_0xfc38('0x71'),'WhoId','Call_Duration',_0xfc38('0x72'),_0xfc38('0x73'),'Call_Type'];_0x41784f=_['remove'](_0x4dd5b2['fields'],function(_0x1d7877){return _0x4b0f07[_0xfc38('0x74')](_0x1d7877[_0xfc38('0x75')]);});for(var _0x59d1b0=0x0;_0x59d1b0<_0x41784f[_0xfc38('0x37')];_0x59d1b0++){if(_0x41784f[_0x59d1b0]['system_mandatory']===![]){_0x298b8c[_0xfc38('0x76')]({'id':_0x41784f[_0x59d1b0]['id'],'name':_0x41784f[_0x59d1b0][_0xfc38('0x77')],'custom':_0x41784f[_0x59d1b0]['custom_field'],'options':_0x41784f[_0x59d1b0][_0xfc38('0x78')]==='picklist'&&_0x41784f[_0x59d1b0][_0xfc38('0x79')]['length']>-0x1?_[_0xfc38('0x2b')](_0x41784f[_0x59d1b0]['pick_list_values'],function(_0x964046){return{'name':_0x964046,'value':_0x964046};}):[]});}}return{'count':_0x298b8c['length'],'rows':_0x298b8c};}else{return{'count':0x0,'rows':[]};}})[_0xfc38('0x25')](respondWithResult(_0x3650e9,null))['catch'](function(_0xa6fbd2){var _0x3c5979=_0x2994c1[_0xfc38('0x30')][_0xfc38('0x7a')]?0x1f4:_0xa6fbd2[_0xfc38('0x7b')]||0x1f4;logger[_0xfc38('0x28')](_0xfc38('0x7c'),'getFields',_0x3c5979,JSON[_0xfc38('0x7d')](_0xa6fbd2));delete _0xa6fbd2[_0xfc38('0x29')];if(_0x3c5979===0x191){_0x3c5979=0x190;}_0x3650e9[_0xfc38('0x1a')](_0x3c5979)[_0xfc38('0x7e')](_0x2994c1[_0xfc38('0x30')]['test']?{'message':_0xfc38('0x7f'),'statusCode':_0xa6fbd2[_0xfc38('0x7b')]}:_0xa6fbd2);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index aa2c427..d452578 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 _0xa82d=['ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','refresh_token','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','serverUrl','application/x-www-form-urlencoded','then','parse','refreshToken','info','format'];(function(_0x4a8312,_0x1dd2e5){var _0x3fd016=function(_0x27cff0){while(--_0x27cff0){_0x4a8312['push'](_0x4a8312['shift']());}};_0x3fd016(++_0x1dd2e5);}(_0xa82d,0xde));var _0xda82=function(_0x5c6b47,_0x42d63a){_0x5c6b47=_0x5c6b47-0x0;var _0x47e5ff=_0xa82d[_0x5c6b47];return _0x47e5ff;};'use strict';var _=require(_0xda82('0x0'));var util=require(_0xda82('0x1'));var logger=require(_0xda82('0x2'))(_0xda82('0x3'));var moment=require(_0xda82('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xda82('0x5'));var rimraf=require(_0xda82('0x6'));var config=require(_0xda82('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xda82('0x8')]=function(_0x489f39,_0x25d495){return _0x489f39[_0xda82('0x9')](_0xda82('0xa'),attributes,{'tableName':_0xda82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x436991,_0x4d2bca,_0x2323ca){if(_0x436991[_0xda82('0xc')](_0xda82('0xd'))||_0x436991[_0xda82('0xc')]('serverUrl')||_0x436991[_0xda82('0xc')](_0xda82('0xe'))||_0x436991[_0xda82('0xc')](_0xda82('0xf'))||_0x436991[_0xda82('0xc')](_0xda82('0x10'))||_0x436991['changed'](_0xda82('0x11'))){var _0xfc0f8f,_0x72c95f;_0xfc0f8f=_0x436991['serverUrl'];var _0x2f5617=_0xfc0f8f[_0xda82('0x12')](-0x1);if(_0x2f5617==='/'||_0x2f5617==='\x5c'||_0x2f5617===':'){_0xfc0f8f=_0xfc0f8f[_0xda82('0x13')](0x0,_0xfc0f8f[_0xda82('0x14')](_0x2f5617));}switch(_0x436991[_0xda82('0xd')]){case'US':_0x72c95f=_0xda82('0x15');break;case'AU':_0x72c95f=_0xda82('0x16');break;case'IN':_0x72c95f=_0xda82('0x17');break;case'CN':_0x72c95f=_0xda82('0x18');break;default:_0x72c95f=_0xda82('0x19');break;}var _0x1b32b9={'method':_0xda82('0x1a'),'uri':_0x72c95f+_0xda82('0x1b'),'form':{'grant_type':_0xda82('0x1c'),'client_id':_0x436991[_0xda82('0xe')],'client_secret':_0x436991[_0xda82('0xf')],'redirect_uri':_0x436991[_0xda82('0x1d')],'code':_0x436991[_0xda82('0x10')]},'headers':{'Content-Type':_0xda82('0x1e')}};return rp(_0x1b32b9)[_0xda82('0x1f')](function(_0x4689f0){var _0x27444e=JSON[_0xda82('0x20')](_0x4689f0);if(_0x27444e['refresh_token']){_0x436991[_0xda82('0x21')]=_0x27444e['refresh_token'];logger[_0xda82('0x22')](util[_0xda82('0x23')](_0xda82('0x24'),_0x436991[_0xda82('0x25')],_0x436991['id']));}else{logger['error'](util[_0xda82('0x23')](_0xda82('0x26'),_0x436991[_0xda82('0x25')],_0x436991['id']),util[_0xda82('0x27')](_0x27444e,{'showHidden':![],'depth':null}));}return _0x2323ca(null,_0x4d2bca);})[_0xda82('0x28')](function(_0x5e9ca1){logger[_0xda82('0x29')](util[_0xda82('0x23')](_0xda82('0x26'),_0x436991['name'],_0x436991['id']),util[_0xda82('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x2323ca(_0x5e9ca1);});}else{return _0x2323ca(null,_0x4d2bca);}},'beforeUpdate':function(_0x71ed60,_0x5823d1,_0x32b7db){if(_0x71ed60[_0xda82('0xc')]('zone')||_0x71ed60[_0xda82('0xc')](_0xda82('0x1d'))||_0x71ed60[_0xda82('0xc')](_0xda82('0xe'))||_0x71ed60['changed'](_0xda82('0xf'))||_0x71ed60[_0xda82('0xc')](_0xda82('0x10'))||_0x71ed60[_0xda82('0xc')]('host')){var _0xfa4d23,_0x16c863;_0xfa4d23=_0x71ed60[_0xda82('0x1d')];var _0x224d72=_0xfa4d23[_0xda82('0x12')](-0x1);if(_0x224d72==='/'||_0x224d72==='\x5c'||_0x224d72===':'){_0xfa4d23=_0xfa4d23[_0xda82('0x13')](0x0,_0xfa4d23['lastIndexOf'](_0x224d72));}switch(_0x71ed60[_0xda82('0xd')]){case'US':_0x16c863=_0xda82('0x15');break;case'AU':_0x16c863=_0xda82('0x16');break;case'IN':_0x16c863=_0xda82('0x17');break;case'CN':_0x16c863='https://accounts.zoho.com.cn';break;default:_0x16c863=_0xda82('0x19');break;}var _0x229285={'method':_0xda82('0x1a'),'uri':_0x16c863+'/oauth/v2/token','form':{'grant_type':_0xda82('0x1c'),'client_id':_0x71ed60[_0xda82('0xe')],'client_secret':_0x71ed60['clientSecret'],'redirect_uri':_0x71ed60[_0xda82('0x1d')],'code':_0x71ed60[_0xda82('0x10')]},'headers':{'Content-Type':_0xda82('0x1e')}};return rp(_0x229285)['then'](function(_0x6adf82){var _0x227be8=JSON[_0xda82('0x20')](_0x6adf82);if(_0x227be8[_0xda82('0x2a')]){_0x71ed60[_0xda82('0x21')]=_0x227be8[_0xda82('0x2a')];logger[_0xda82('0x22')](util[_0xda82('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x71ed60['name'],_0x71ed60['id']));}else{logger[_0xda82('0x29')](util['format'](_0xda82('0x26'),_0x71ed60[_0xda82('0x25')],_0x71ed60['id']),util['inspect'](_0x227be8,{'showHidden':![],'depth':null}));}return _0x32b7db(null,_0x5823d1);})[_0xda82('0x28')](function(_0x484afb){logger[_0xda82('0x29')](util[_0xda82('0x23')](_0xda82('0x26'),_0x71ed60[_0xda82('0x25')],_0x71ed60['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x32b7db(_0x484afb);});}else{return _0x32b7db(null,_0x5823d1);}}}});}; \ No newline at end of file +var _0xc364=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','clientSecret','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','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','catch','format','inspect','https://accounts.zoho.com','https://accounts.zoho.com.au','/oauth/v2/token','then','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.in'];(function(_0x3fdddb,_0x244a31){var _0x1bd806=function(_0x20443a){while(--_0x20443a){_0x3fdddb['push'](_0x3fdddb['shift']());}};_0x1bd806(++_0x244a31);}(_0xc364,0xbc));var _0x4c36=function(_0x44be9a,_0x5ce1a6){_0x44be9a=_0x44be9a-0x0;var _0x3dbb78=_0xc364[_0x44be9a];return _0x3dbb78;};'use strict';var _=require(_0x4c36('0x0'));var util=require('util');var logger=require(_0x4c36('0x1'))(_0x4c36('0x2'));var moment=require(_0x4c36('0x3'));var BPromise=require(_0x4c36('0x4'));var rp=require(_0x4c36('0x5'));var fs=require('fs');var path=require(_0x4c36('0x6'));var rimraf=require(_0x4c36('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c36('0x8'));var integrations=require(_0x4c36('0x9'));module['exports']=function(_0x267153,_0x560f3f){return _0x267153[_0x4c36('0xa')](_0x4c36('0xb'),attributes,{'tableName':_0x4c36('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x418a10,_0x8f914b,_0x35090b){if(_0x418a10[_0x4c36('0xd')](_0x4c36('0xe'))||_0x418a10[_0x4c36('0xd')]('serverUrl')||_0x418a10['changed'](_0x4c36('0xf'))||_0x418a10['changed']('clientSecret')||_0x418a10[_0x4c36('0xd')](_0x4c36('0x10'))||_0x418a10[_0x4c36('0xd')]('host')){var _0x41d03e,_0x589999;_0x41d03e=_0x418a10[_0x4c36('0x11')];var _0x10b541=_0x41d03e[_0x4c36('0x12')](-0x1);if(_0x10b541==='/'||_0x10b541==='\x5c'||_0x10b541===':'){_0x41d03e=_0x41d03e[_0x4c36('0x13')](0x0,_0x41d03e[_0x4c36('0x14')](_0x10b541));}switch(_0x418a10[_0x4c36('0xe')]){case'US':_0x589999='https://accounts.zoho.com';break;case'AU':_0x589999='https://accounts.zoho.com.au';break;case'IN':_0x589999=_0x4c36('0x15');break;case'CN':_0x589999=_0x4c36('0x16');break;default:_0x589999=_0x4c36('0x17');break;}var _0x5bcb44={'method':_0x4c36('0x18'),'uri':_0x589999+'/oauth/v2/token','form':{'grant_type':_0x4c36('0x19'),'client_id':_0x418a10[_0x4c36('0xf')],'client_secret':_0x418a10[_0x4c36('0x1a')],'redirect_uri':_0x418a10[_0x4c36('0x11')],'code':_0x418a10[_0x4c36('0x10')]},'headers':{'Content-Type':_0x4c36('0x1b')}};return rp(_0x5bcb44)['then'](function(_0x40c5aa){var _0x2d25e5=JSON[_0x4c36('0x1c')](_0x40c5aa);if(_0x2d25e5[_0x4c36('0x1d')]){_0x418a10[_0x4c36('0x1e')]=_0x2d25e5[_0x4c36('0x1d')];logger[_0x4c36('0x1f')](util['format'](_0x4c36('0x20'),_0x418a10['name'],_0x418a10['id']));}else{logger['error'](util['format'](_0x4c36('0x21'),_0x418a10[_0x4c36('0x22')],_0x418a10['id']),util['inspect'](_0x2d25e5,{'showHidden':![],'depth':null}));}return _0x35090b(null,_0x8f914b);})[_0x4c36('0x23')](function(_0x48927f){logger['error'](util[_0x4c36('0x24')](_0x4c36('0x21'),_0x418a10[_0x4c36('0x22')],_0x418a10['id']),util[_0x4c36('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x35090b(_0x48927f);});}else{return _0x35090b(null,_0x8f914b);}},'beforeUpdate':function(_0x50ed0b,_0x45d94e,_0xf4c88d){if(_0x50ed0b['changed']('zone')||_0x50ed0b[_0x4c36('0xd')]('serverUrl')||_0x50ed0b[_0x4c36('0xd')](_0x4c36('0xf'))||_0x50ed0b[_0x4c36('0xd')]('clientSecret')||_0x50ed0b[_0x4c36('0xd')]('code')||_0x50ed0b[_0x4c36('0xd')]('host')){var _0xc75595,_0x173e60;_0xc75595=_0x50ed0b[_0x4c36('0x11')];var _0x49261e=_0xc75595['slice'](-0x1);if(_0x49261e==='/'||_0x49261e==='\x5c'||_0x49261e===':'){_0xc75595=_0xc75595['substring'](0x0,_0xc75595['lastIndexOf'](_0x49261e));}switch(_0x50ed0b['zone']){case'US':_0x173e60=_0x4c36('0x26');break;case'AU':_0x173e60=_0x4c36('0x27');break;case'IN':_0x173e60=_0x4c36('0x15');break;case'CN':_0x173e60=_0x4c36('0x16');break;default:_0x173e60=_0x4c36('0x17');break;}var _0x56fb50={'method':_0x4c36('0x18'),'uri':_0x173e60+_0x4c36('0x28'),'form':{'grant_type':_0x4c36('0x19'),'client_id':_0x50ed0b[_0x4c36('0xf')],'client_secret':_0x50ed0b[_0x4c36('0x1a')],'redirect_uri':_0x50ed0b[_0x4c36('0x11')],'code':_0x50ed0b['code']},'headers':{'Content-Type':_0x4c36('0x1b')}};return rp(_0x56fb50)[_0x4c36('0x29')](function(_0x4f1347){var _0x3db4ae=JSON[_0x4c36('0x1c')](_0x4f1347);if(_0x3db4ae['refresh_token']){_0x50ed0b[_0x4c36('0x1e')]=_0x3db4ae['refresh_token'];logger['info'](util[_0x4c36('0x24')](_0x4c36('0x20'),_0x50ed0b[_0x4c36('0x22')],_0x50ed0b['id']));}else{logger['error'](util[_0x4c36('0x24')](_0x4c36('0x21'),_0x50ed0b[_0x4c36('0x22')],_0x50ed0b['id']),util[_0x4c36('0x25')](_0x3db4ae,{'showHidden':![],'depth':null}));}return _0xf4c88d(null,_0x45d94e);})[_0x4c36('0x23')](function(_0x76c2d1){logger['error'](util['format'](_0x4c36('0x21'),_0x50ed0b[_0x4c36('0x22')],_0x50ed0b['id']),util[_0x4c36('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0xf4c88d(_0x76c2d1);});}else{return _0xf4c88d(null,_0x45d94e);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3ab2a7a..8b12fb8 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 _0xa76e=['info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','options','raw','attributes','limit','include','map','model','ShowZohoAccount','find','where','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x4373c4,_0x126d71){var _0x26fbac=function(_0x465d74){while(--_0x465d74){_0x4373c4['push'](_0x4373c4['shift']());}};_0x26fbac(++_0x126d71);}(_0xa76e,0xfe));var _0xea76=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0xa76e[_0x5c6299];return _0x23b564;};'use strict';var _=require('lodash');var util=require(_0xea76('0x0'));var moment=require(_0xea76('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea76('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xea76('0x3'));var logger=require(_0xea76('0x4'))(_0xea76('0x5'));var config=require('../../config/environment');var jayson=require(_0xea76('0x6'));var client=jayson['client'][_0xea76('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ee974,_0x45ac1b,_0x1735ff){return new BPromise(function(_0x5eb746,_0x55aae7){return client[_0xea76('0x8')](_0x4ee974,_0x1735ff)[_0xea76('0x9')](function(_0x1c6723){logger[_0xea76('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x45ac1b,_0xea76('0xb'));logger[_0xea76('0xc')](_0xea76('0xd'),_0x45ac1b,'request\x20sent',JSON[_0xea76('0xe')](_0x1c6723));if(_0x1c6723[_0xea76('0xf')]){if(_0x1c6723[_0xea76('0xf')][_0xea76('0x10')]===0x1f4){logger[_0xea76('0xf')](_0xea76('0x11'),_0x45ac1b,_0x1c6723[_0xea76('0xf')][_0xea76('0x12')]);return _0x55aae7(_0x1c6723[_0xea76('0xf')][_0xea76('0x12')]);}logger[_0xea76('0xf')](_0xea76('0x11'),_0x45ac1b,_0x1c6723[_0xea76('0xf')][_0xea76('0x12')]);return _0x5eb746(_0x1c6723[_0xea76('0xf')]['message']);}else{logger[_0xea76('0xa')](_0xea76('0x11'),_0x45ac1b,_0xea76('0xb'));_0x5eb746(_0x1c6723[_0xea76('0x13')][_0xea76('0x12')]);}})[_0xea76('0x14')](function(_0x3b47fa){logger[_0xea76('0xf')](_0xea76('0x11'),_0x45ac1b,_0x3b47fa);_0x55aae7(_0x3b47fa);});});}exports[_0xea76('0x15')]=function(_0x210e27){var _0x1efdfa=this;return new Promise(function(_0x5ecdd1,_0x49bc4a){return db[_0xea76('0x16')]['findAll']({'raw':_0x210e27[_0xea76('0x17')]?_0x210e27[_0xea76('0x17')][_0xea76('0x18')]===undefined?!![]:![]:!![],'where':_0x210e27['options']?_0x210e27['options']['where']||null:null,'attributes':_0x210e27[_0xea76('0x17')]?_0x210e27[_0xea76('0x17')][_0xea76('0x19')]||null:null,'limit':_0x210e27[_0xea76('0x17')]?_0x210e27['options'][_0xea76('0x1a')]||null:null,'include':_0x210e27['options']?_0x210e27[_0xea76('0x17')][_0xea76('0x1b')]?_[_0xea76('0x1c')](_0x210e27[_0xea76('0x17')][_0xea76('0x1b')],function(_0x337a78){return{'model':db[_0x337a78[_0xea76('0x1d')]],'as':_0x337a78['as'],'attributes':_0x337a78[_0xea76('0x19')],'include':_0x337a78[_0xea76('0x1b')]?_[_0xea76('0x1c')](_0x337a78[_0xea76('0x1b')],function(_0x1729a2){return{'model':db[_0x1729a2[_0xea76('0x1d')]],'as':_0x1729a2['as'],'attributes':_0x1729a2[_0xea76('0x19')],'include':_0x1729a2[_0xea76('0x1b')]?_[_0xea76('0x1c')](_0x1729a2['include'],function(_0x163dc7){return{'model':db[_0x163dc7['model']],'as':_0x163dc7['as'],'attributes':_0x163dc7['attributes']};}):[]};}):[]};}):[]:[]})[_0xea76('0x9')](function(_0x8a66ac){logger[_0xea76('0xa')](_0xea76('0x15'),_0x210e27);logger[_0xea76('0xc')](_0xea76('0x15'),_0x210e27,JSON[_0xea76('0xe')](_0x8a66ac));_0x5ecdd1(_0x8a66ac);})['catch'](function(_0x5c7960){logger[_0xea76('0xf')](_0xea76('0x15'),_0x5c7960[_0xea76('0x12')],_0x210e27);_0x49bc4a(_0x1efdfa[_0xea76('0xf')](0x1f4,_0x5c7960[_0xea76('0x12')]));});});};exports[_0xea76('0x1e')]=function(_0x12c18f){var _0xbbef85=this;return new Promise(function(_0x203447,_0x2dccd7){return db[_0xea76('0x16')][_0xea76('0x1f')]({'raw':_0x12c18f[_0xea76('0x17')]?_0x12c18f[_0xea76('0x17')][_0xea76('0x18')]===undefined?!![]:![]:!![],'where':_0x12c18f['options']?_0x12c18f[_0xea76('0x17')][_0xea76('0x20')]||null:null,'attributes':_0x12c18f[_0xea76('0x17')]?_0x12c18f['options'][_0xea76('0x19')]||null:null,'include':_0x12c18f[_0xea76('0x17')]?_0x12c18f[_0xea76('0x17')][_0xea76('0x1b')]?_['map'](_0x12c18f[_0xea76('0x17')]['include'],function(_0x5aab4f){return{'model':db[_0x5aab4f[_0xea76('0x1d')]],'as':_0x5aab4f['as'],'attributes':_0x5aab4f['attributes'],'include':_0x5aab4f['include']?_[_0xea76('0x1c')](_0x5aab4f[_0xea76('0x1b')],function(_0x424bbb){return{'model':db[_0x424bbb[_0xea76('0x1d')]],'as':_0x424bbb['as'],'attributes':_0x424bbb[_0xea76('0x19')],'include':_0x424bbb['include']?_[_0xea76('0x1c')](_0x424bbb['include'],function(_0xd9e306){return{'model':db[_0xd9e306[_0xea76('0x1d')]],'as':_0xd9e306['as'],'attributes':_0xd9e306[_0xea76('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x112f1d){logger['info']('ShowZohoAccount',_0x12c18f);logger[_0xea76('0xc')](_0xea76('0x1e'),_0x12c18f,JSON[_0xea76('0xe')](_0x112f1d));_0x203447(_0x112f1d);})[_0xea76('0x14')](function(_0x125322){logger[_0xea76('0xf')](_0xea76('0x1e'),_0x125322[_0xea76('0x12')],_0x12c18f);_0x2dccd7(_0xbbef85[_0xea76('0xf')](0x1f4,_0x125322[_0xea76('0x12')]));});});}; \ No newline at end of file +var _0xdf55=['ZohoAccount,\x20%s,\x20%s','message','info','result','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowZohoAccount','ZohoAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xdf55,0x83));var _0x5df5=function(_0x57120e,_0x427d2d){_0x57120e=_0x57120e-0x0;var _0x1539f5=_0xdf55[_0x57120e];return _0x1539f5;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['ZohoAccount'][_0x5df5('0x17')]({'raw':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'attributes':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1c')]||null:null,'include':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2['options'][_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x5ca542){return{'model':db[_0x5ca542[_0x5df5('0x1f')]],'as':_0x5ca542['as'],'attributes':_0x5ca542[_0x5df5('0x1b')],'include':_0x5ca542[_0x5df5('0x1d')]?_['map'](_0x5ca542['include'],function(_0x532923){return{'model':db[_0x532923[_0x5df5('0x1f')]],'as':_0x532923['as'],'attributes':_0x532923[_0x5df5('0x1b')],'include':_0x532923[_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0x532923[_0x5df5('0x1d')],function(_0x1fd83c){return{'model':db[_0x1fd83c[_0x5df5('0x1f')]],'as':_0x1fd83c['as'],'attributes':_0x1fd83c[_0x5df5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bb61){logger['info'](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x20')]('GetZohoAccount',_0xb7e1c2,JSON[_0x5df5('0x21')](_0x18bb61));_0x215d59(_0x18bb61);})['catch'](function(_0xd2b213){logger['error'](_0x5df5('0x16'),_0xd2b213['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0xd2b213['message']));});});};exports[_0x5df5('0x22')]=function(_0x47bebb){var _0x4784ca=this;return new Promise(function(_0x485484,_0xf445de){return db[_0x5df5('0x23')][_0x5df5('0x24')]({'raw':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0x47bebb[_0x5df5('0x18')]?_0x47bebb['options']['where']||null:null,'attributes':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'include':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')]?_['map'](_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x2f1001){return{'model':db[_0x2f1001[_0x5df5('0x1f')]],'as':_0x2f1001['as'],'attributes':_0x2f1001['attributes'],'include':_0x2f1001[_0x5df5('0x1d')]?_['map'](_0x2f1001[_0x5df5('0x1d')],function(_0x394676){return{'model':db[_0x394676['model']],'as':_0x394676['as'],'attributes':_0x394676[_0x5df5('0x1b')],'include':_0x394676['include']?_[_0x5df5('0x1e')](_0x394676[_0x5df5('0x1d')],function(_0x4697c2){return{'model':db[_0x4697c2[_0x5df5('0x1f')]],'as':_0x4697c2['as'],'attributes':_0x4697c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5df5('0xc')](function(_0x2e7e64){logger[_0x5df5('0x13')](_0x5df5('0x22'),_0x47bebb);logger['debug'](_0x5df5('0x22'),_0x47bebb,JSON[_0x5df5('0x21')](_0x2e7e64));_0x485484(_0x2e7e64);})[_0x5df5('0x15')](function(_0x18b597){logger[_0x5df5('0xf')](_0x5df5('0x22'),_0x18b597[_0x5df5('0x12')],_0x47bebb);_0xf445de(_0x4784ca['error'](0x1f4,_0x18b597[_0x5df5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ce85e96..875e02a 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 _0x104c=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x1b0a9d,_0x45a72a){var _0x719225=function(_0x5038d9){while(--_0x5038d9){_0x1b0a9d['push'](_0x1b0a9d['shift']());}};_0x719225(++_0x45a72a);}(_0x104c,0x137));var _0xc104=function(_0x3b6aaf,_0x4aef36){_0x3b6aaf=_0x3b6aaf-0x0;var _0x295fa9=_0x104c[_0x3b6aaf];return _0x295fa9;};'use strict';var multer=require(_0xc104('0x0'));var util=require(_0xc104('0x1'));var path=require(_0xc104('0x2'));var timeout=require('connect-timeout');var express=require(_0xc104('0x3'));var router=express[_0xc104('0x4')]();var fs_extra=require(_0xc104('0x5'));var auth=require(_0xc104('0x6'));var interaction=require(_0xc104('0x7'));var config=require(_0xc104('0x8'));var controller=require(_0xc104('0x9'));router[_0xc104('0xa')]('/',auth[_0xc104('0xb')](),controller[_0xc104('0xc')]);router[_0xc104('0xa')](_0xc104('0xd'),auth[_0xc104('0xb')](),controller[_0xc104('0xe')]);router[_0xc104('0xa')](_0xc104('0xf'),auth[_0xc104('0xb')](),controller['getFields']);router[_0xc104('0xa')](_0xc104('0x10'),auth[_0xc104('0xb')](),controller[_0xc104('0x11')]);router[_0xc104('0xa')](_0xc104('0x12'),auth[_0xc104('0xb')](),controller['getDescriptions']);router[_0xc104('0x13')]('/',auth[_0xc104('0xb')](),controller[_0xc104('0x14')]);router[_0xc104('0x15')](_0xc104('0xd'),auth['isAuthenticated'](),controller[_0xc104('0x16')]);router['delete'](_0xc104('0xd'),auth[_0xc104('0xb')](),controller[_0xc104('0x17')]);module[_0xc104('0x18')]=router; \ No newline at end of file +var _0x8d5a=['isAuthenticated','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x164ef0,_0x3e2f09){var _0x3415e=function(_0x45bc93){while(--_0x45bc93){_0x164ef0['push'](_0x164ef0['shift']());}};_0x3415e(++_0x3e2f09);}(_0x8d5a,0x1d8));var _0xa8d5=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x8d5a[_0x1b7368];return _0x25d54c;};'use strict';var multer=require(_0xa8d5('0x0'));var util=require(_0xa8d5('0x1'));var path=require(_0xa8d5('0x2'));var timeout=require('connect-timeout');var express=require(_0xa8d5('0x3'));var router=express[_0xa8d5('0x4')]();var fs_extra=require(_0xa8d5('0x5'));var auth=require(_0xa8d5('0x6'));var interaction=require(_0xa8d5('0x7'));var config=require(_0xa8d5('0x8'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa8d5('0x9')](_0xa8d5('0xa'),auth[_0xa8d5('0xb')](),controller['show']);router[_0xa8d5('0x9')](_0xa8d5('0xc'),auth[_0xa8d5('0xb')](),controller[_0xa8d5('0xd')]);router[_0xa8d5('0x9')]('/:id/subjects',auth[_0xa8d5('0xb')](),controller['getSubjects']);router[_0xa8d5('0x9')](_0xa8d5('0xe'),auth['isAuthenticated'](),controller[_0xa8d5('0xf')]);router[_0xa8d5('0x10')]('/',auth[_0xa8d5('0xb')](),controller['create']);router[_0xa8d5('0x11')](_0xa8d5('0xa'),auth[_0xa8d5('0xb')](),controller[_0xa8d5('0x12')]);router['delete'](_0xa8d5('0xa'),auth['isAuthenticated'](),controller[_0xa8d5('0x13')]);module[_0xa8d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2ab2044..36ddeb1 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 _0xcef3=['sequelize','exports','contact','nothing','lead','ENUM','contact_lead','STRING'];(function(_0x454876,_0x580571){var _0x1084e6=function(_0x31af3a){while(--_0x31af3a){_0x454876['push'](_0x454876['shift']());}};_0x1084e6(++_0x580571);}(_0xcef3,0x88));var _0x3cef=function(_0x4bb93d,_0x1cda9a){_0x4bb93d=_0x4bb93d-0x0;var _0x106b4f=_0xcef3[_0x4bb93d];return _0x106b4f;};'use strict';var Sequelize=require(_0x3cef('0x0'));module[_0x3cef('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x3cef('0x2'),_0x3cef('0x3')),'defaultValue':_0x3cef('0x4')},'moduleSearch':{'type':Sequelize[_0x3cef('0x5')](_0x3cef('0x6'),_0x3cef('0x2'),'lead'),'defaultValue':_0x3cef('0x6')},'description':{'type':Sequelize[_0x3cef('0x7')]}}; \ No newline at end of file +var _0x77aa=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0xbcdc22,_0x1e50f7){var _0x358688=function(_0x41c020){while(--_0x41c020){_0xbcdc22['push'](_0xbcdc22['shift']());}};_0x358688(++_0x1e50f7);}(_0x77aa,0x126));var _0xa77a=function(_0xdf81fe,_0x7944e7){_0xdf81fe=_0xdf81fe-0x0;var _0x4145ce=_0x77aa[_0xdf81fe];return _0x4145ce;};'use strict';var Sequelize=require(_0xa77a('0x0'));module[_0xa77a('0x1')]={'name':{'type':Sequelize[_0xa77a('0x2')]},'moduleCreate':{'type':Sequelize[_0xa77a('0x3')](_0xa77a('0x4'),_0xa77a('0x5'),_0xa77a('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa77a('0x3')](_0xa77a('0x7'),'contact','lead'),'defaultValue':_0xa77a('0x7')},'description':{'type':Sequelize[_0xa77a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9ce2950..392fabd 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 _0xca15=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ZohoConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x449e8c,_0x4c7b1e){var _0x10cc7f=function(_0x23f503){while(--_0x23f503){_0x449e8c['push'](_0x449e8c['shift']());}};_0x10cc7f(++_0x4c7b1e);}(_0xca15,0xc6));var _0x5ca1=function(_0x550151,_0x49d953){_0x550151=_0x550151-0x0;var _0x1ba3cb=_0xca15[_0x550151];return _0x1ba3cb;};'use strict';var emlformat=require(_0x5ca1('0x0'));var rimraf=require(_0x5ca1('0x1'));var zipdir=require(_0x5ca1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ca1('0x3'));var BPromise=require(_0x5ca1('0x4'));var Mustache=require(_0x5ca1('0x5'));var util=require(_0x5ca1('0x6'));var path=require(_0x5ca1('0x7'));var sox=require(_0x5ca1('0x8'));var csv=require(_0x5ca1('0x9'));var ejs=require(_0x5ca1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5ca1('0xb'));var crypto=require(_0x5ca1('0xc'));var jsforce=require(_0x5ca1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5ca1('0x9'));var querystring=require(_0x5ca1('0xe'));var Papa=require(_0x5ca1('0xf'));var Redis=require(_0x5ca1('0x10'));var authService=require(_0x5ca1('0x11'));var qs=require(_0x5ca1('0x12'));var as=require(_0x5ca1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ca1('0x14'))(_0x5ca1('0x15'));var utils=require(_0x5ca1('0x16'));var config=require(_0x5ca1('0x17'));var licenseUtil=require(_0x5ca1('0x18'));var db=require(_0x5ca1('0x19'))['db'];function respondWithStatusCode(_0x1a6481,_0xaf4d7b){_0xaf4d7b=_0xaf4d7b||0xcc;return function(_0x59d2a9){if(_0x59d2a9){return _0x1a6481[_0x5ca1('0x1a')](_0xaf4d7b);}return _0x1a6481[_0x5ca1('0x1b')](_0xaf4d7b)[_0x5ca1('0x1c')]();};}function respondWithResult(_0x20b26f,_0x40c264){_0x40c264=_0x40c264||0xc8;return function(_0x120078){if(_0x120078){return _0x20b26f[_0x5ca1('0x1b')](_0x40c264)[_0x5ca1('0x1d')](_0x120078);}};}function respondWithFilteredResult(_0x5947d8,_0x49b408){return function(_0xc7b987){if(_0xc7b987){var _0x1bd93c=typeof _0x49b408[_0x5ca1('0x1e')]===_0x5ca1('0x1f')&&typeof _0x49b408[_0x5ca1('0x20')]===_0x5ca1('0x1f');var _0x35acf4=_0xc7b987[_0x5ca1('0x21')];var _0x1bcbe5=_0x1bd93c?0x0:_0x49b408[_0x5ca1('0x1e')];var _0x1771aa=_0x1bd93c?_0xc7b987['count']:_0x49b408[_0x5ca1('0x1e')]+_0x49b408[_0x5ca1('0x20')];var _0x4ed89a;if(_0x1771aa>=_0x35acf4){_0x1771aa=_0x35acf4;_0x4ed89a=0xc8;}else{_0x4ed89a=0xce;}_0x5947d8[_0x5ca1('0x1b')](_0x4ed89a);return _0x5947d8[_0x5ca1('0x22')](_0x5ca1('0x23'),_0x1bcbe5+'-'+_0x1771aa+'/'+_0x35acf4)[_0x5ca1('0x1d')](_0xc7b987);}return null;};}function patchUpdates(_0x3bdea8){return function(_0x2f26df){try{jsonpatch[_0x5ca1('0x24')](_0x2f26df,_0x3bdea8,!![]);}catch(_0x5658a7){return BPromise[_0x5ca1('0x25')](_0x5658a7);}return _0x2f26df[_0x5ca1('0x26')]();};}function saveUpdates(_0x49c7aa,_0x392785){return function(_0x2fcdbe){if(_0x2fcdbe){return _0x2fcdbe['update'](_0x49c7aa)[_0x5ca1('0x27')](function(_0x3cdc0b){return _0x3cdc0b;});}return null;};}function removeEntity(_0x5bcf12,_0x35d906){return function(_0x18a94e){if(_0x18a94e){return _0x18a94e[_0x5ca1('0x28')]()[_0x5ca1('0x27')](function(){_0x5bcf12[_0x5ca1('0x1b')](0xcc)[_0x5ca1('0x1c')]();});}};}function handleEntityNotFound(_0x1f48e1,_0xcb64a0){return function(_0x3e9140){if(!_0x3e9140){_0x1f48e1[_0x5ca1('0x1a')](0x194);}return _0x3e9140;};}function handleError(_0x312829,_0x1101d8){_0x1101d8=_0x1101d8||0x1f4;return function(_0x2fd325){logger[_0x5ca1('0x29')](_0x2fd325[_0x5ca1('0x2a')]);if(_0x2fd325['name']){delete _0x2fd325[_0x5ca1('0x2b')];}_0x312829['status'](_0x1101d8)[_0x5ca1('0x2c')](_0x2fd325);};}exports[_0x5ca1('0x2d')]=function(_0x5cf241,_0x3ba5ae){var _0x566f27={},_0x289d78={},_0x11d988={'count':0x0,'rows':[]};var _0x3cc8f0=_[_0x5ca1('0x2e')](db['ZohoConfiguration']['rawAttributes'],function(_0x357386){return{'name':_0x357386[_0x5ca1('0x2f')],'type':_0x357386[_0x5ca1('0x30')][_0x5ca1('0x31')]};});_0x289d78[_0x5ca1('0x32')]=_[_0x5ca1('0x2e')](_0x3cc8f0,_0x5ca1('0x2b'));_0x289d78[_0x5ca1('0x33')]=_[_0x5ca1('0x34')](_0x5cf241[_0x5ca1('0x33')]);_0x289d78['filters']=_[_0x5ca1('0x35')](_0x289d78[_0x5ca1('0x32')],_0x289d78[_0x5ca1('0x33')]);_0x566f27[_0x5ca1('0x36')]=_['intersection'](_0x289d78[_0x5ca1('0x32')],qs[_0x5ca1('0x37')](_0x5cf241[_0x5ca1('0x33')]['fields']));_0x566f27[_0x5ca1('0x36')]=_0x566f27[_0x5ca1('0x36')][_0x5ca1('0x38')]?_0x566f27[_0x5ca1('0x36')]:_0x289d78['model'];if(!_0x5cf241[_0x5ca1('0x33')][_0x5ca1('0x39')](_0x5ca1('0x3a'))){_0x566f27[_0x5ca1('0x20')]=qs['limit'](_0x5cf241[_0x5ca1('0x33')][_0x5ca1('0x20')]);_0x566f27[_0x5ca1('0x1e')]=qs[_0x5ca1('0x1e')](_0x5cf241[_0x5ca1('0x33')][_0x5ca1('0x1e')]);}_0x566f27[_0x5ca1('0x3b')]=qs[_0x5ca1('0x3c')](_0x5cf241[_0x5ca1('0x33')]['sort']);_0x566f27[_0x5ca1('0x3d')]=qs[_0x5ca1('0x3e')](_[_0x5ca1('0x3f')](_0x5cf241[_0x5ca1('0x33')],_0x289d78[_0x5ca1('0x3e')]),_0x3cc8f0);if(_0x5cf241[_0x5ca1('0x33')][_0x5ca1('0x40')]){_0x566f27[_0x5ca1('0x3d')]=_['merge'](_0x566f27[_0x5ca1('0x3d')],{'$or':_['map'](_0x3cc8f0,function(_0x57da79){if(_0x57da79[_0x5ca1('0x30')]!==_0x5ca1('0x41')){var _0x56882e={};_0x56882e[_0x57da79[_0x5ca1('0x2b')]]={'$like':'%'+_0x5cf241[_0x5ca1('0x33')][_0x5ca1('0x40')]+'%'};return _0x56882e;}})});}_0x566f27=_[_0x5ca1('0x42')]({},_0x566f27,_0x5cf241[_0x5ca1('0x43')]);var _0x4cc665={'where':_0x566f27[_0x5ca1('0x3d')]};return db[_0x5ca1('0x44')][_0x5ca1('0x21')](_0x4cc665)[_0x5ca1('0x27')](function(_0x4637e4){_0x11d988[_0x5ca1('0x21')]=_0x4637e4;if(_0x5cf241[_0x5ca1('0x33')][_0x5ca1('0x45')]){_0x566f27[_0x5ca1('0x46')]=[{'all':!![]}];}return db[_0x5ca1('0x44')][_0x5ca1('0x47')](_0x566f27);})[_0x5ca1('0x27')](function(_0x399561){_0x11d988[_0x5ca1('0x48')]=_0x399561;return _0x11d988;})[_0x5ca1('0x27')](respondWithFilteredResult(_0x3ba5ae,_0x566f27))[_0x5ca1('0x49')](handleError(_0x3ba5ae,null));};exports[_0x5ca1('0x4a')]=function(_0x553e1b,_0x23056e){var _0x11a263={'raw':![],'where':{'id':_0x553e1b[_0x5ca1('0x4b')]['id']}},_0x105e5e={};_0x105e5e['model']=_['keys'](db[_0x5ca1('0x44')][_0x5ca1('0x4c')]);_0x105e5e[_0x5ca1('0x33')]=_[_0x5ca1('0x34')](_0x553e1b[_0x5ca1('0x33')]);_0x105e5e[_0x5ca1('0x3e')]=_[_0x5ca1('0x35')](_0x105e5e[_0x5ca1('0x32')],_0x105e5e['query']);_0x11a263[_0x5ca1('0x36')]=_[_0x5ca1('0x35')](_0x105e5e[_0x5ca1('0x32')],qs[_0x5ca1('0x37')](_0x553e1b[_0x5ca1('0x33')][_0x5ca1('0x37')]));_0x11a263[_0x5ca1('0x36')]=_0x11a263[_0x5ca1('0x36')][_0x5ca1('0x38')]?_0x11a263['attributes']:_0x105e5e['model'];if(_0x553e1b[_0x5ca1('0x33')][_0x5ca1('0x45')]){_0x11a263[_0x5ca1('0x46')]=[{'all':!![]}];}_0x11a263=_[_0x5ca1('0x42')]({},_0x11a263,_0x553e1b['options']);return db[_0x5ca1('0x44')][_0x5ca1('0x4d')](_0x11a263)[_0x5ca1('0x27')](handleEntityNotFound(_0x23056e,null))['then'](respondWithResult(_0x23056e,null))[_0x5ca1('0x49')](handleError(_0x23056e,null));};exports[_0x5ca1('0x4e')]=function(_0x57a14e,_0x525ee8){return db[_0x5ca1('0x44')][_0x5ca1('0x4e')](_0x57a14e[_0x5ca1('0x4f')],{})['then'](respondWithResult(_0x525ee8,0xc9))[_0x5ca1('0x49')](handleError(_0x525ee8,null));};exports['update']=function(_0x409b92,_0x14a6c9){if(_0x409b92[_0x5ca1('0x4f')]['id']){delete _0x409b92['body']['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x409b92[_0x5ca1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14a6c9,null))[_0x5ca1('0x27')](saveUpdates(_0x409b92[_0x5ca1('0x4f')],null))['then'](respondWithResult(_0x14a6c9,null))['catch'](handleError(_0x14a6c9,null));};exports['destroy']=function(_0x319d51,_0x1c45e5){return db[_0x5ca1('0x44')][_0x5ca1('0x4d')]({'where':{'id':_0x319d51[_0x5ca1('0x4b')]['id']}})[_0x5ca1('0x27')](handleEntityNotFound(_0x1c45e5,null))[_0x5ca1('0x27')](removeEntity(_0x1c45e5,null))['catch'](handleError(_0x1c45e5,null));};exports[_0x5ca1('0x50')]=function(_0x203dae,_0x158973,_0x53ae1f){var _0x2487c5={};var _0x6bfb6a={};var _0xe6d08d;var _0x5c27f2;return db[_0x5ca1('0x44')][_0x5ca1('0x51')]({'where':{'id':_0x203dae[_0x5ca1('0x4b')]['id']}})[_0x5ca1('0x27')](handleEntityNotFound(_0x158973,null))[_0x5ca1('0x27')](function(_0x32fbac){if(_0x32fbac){_0xe6d08d=_0x32fbac;_0x6bfb6a[_0x5ca1('0x32')]=_[_0x5ca1('0x34')](db[_0x5ca1('0x52')][_0x5ca1('0x4c')]);_0x6bfb6a[_0x5ca1('0x33')]=_['keys'](_0x203dae['query']);_0x6bfb6a[_0x5ca1('0x3e')]=_['intersection'](_0x6bfb6a['model'],_0x6bfb6a[_0x5ca1('0x33')]);_0x2487c5['attributes']=_[_0x5ca1('0x35')](_0x6bfb6a['model'],qs[_0x5ca1('0x37')](_0x203dae[_0x5ca1('0x33')]['fields']));_0x2487c5[_0x5ca1('0x36')]=_0x2487c5[_0x5ca1('0x36')][_0x5ca1('0x38')]?_0x2487c5[_0x5ca1('0x36')]:_0x6bfb6a[_0x5ca1('0x32')];_0x2487c5[_0x5ca1('0x3b')]=qs['sort'](_0x203dae[_0x5ca1('0x33')][_0x5ca1('0x3c')]);_0x2487c5[_0x5ca1('0x3d')]=qs[_0x5ca1('0x3e')](_[_0x5ca1('0x3f')](_0x203dae[_0x5ca1('0x33')],_0x6bfb6a[_0x5ca1('0x3e')]));if(_0x203dae[_0x5ca1('0x33')][_0x5ca1('0x40')]){_0x2487c5[_0x5ca1('0x3d')]=_[_0x5ca1('0x42')](_0x2487c5['where'],{'$or':_['map'](_0x2487c5[_0x5ca1('0x36')],function(_0x4ea55f){var _0x4bbfb0={};_0x4bbfb0[_0x4ea55f]={'$like':'%'+_0x203dae[_0x5ca1('0x33')][_0x5ca1('0x40')]+'%'};return _0x4bbfb0;})});}_0x2487c5=_['merge']({},_0x2487c5,_0x203dae[_0x5ca1('0x43')]);return _0xe6d08d[_0x5ca1('0x50')](_0x2487c5);}})['then'](function(_0x501961){if(_0x501961){_0x5c27f2=_0x501961[_0x5ca1('0x38')];if(!_0x203dae['query'][_0x5ca1('0x39')](_0x5ca1('0x3a'))){_0x2487c5[_0x5ca1('0x20')]=qs[_0x5ca1('0x20')](_0x203dae[_0x5ca1('0x33')]['limit']);_0x2487c5[_0x5ca1('0x1e')]=qs[_0x5ca1('0x1e')](_0x203dae[_0x5ca1('0x33')][_0x5ca1('0x1e')]);}return _0xe6d08d[_0x5ca1('0x50')](_0x2487c5);}})['then'](function(_0x1efdd0){if(_0x1efdd0){return _0x1efdd0?{'count':_0x5c27f2,'rows':_0x1efdd0}:null;}})['then'](respondWithResult(_0x158973,null))[_0x5ca1('0x49')](handleError(_0x158973,null));};exports[_0x5ca1('0x53')]=function(_0x493891,_0xdef7f7,_0x51b090){var _0x1e653a={};var _0x2f812c={};var _0x5591bd;var _0x2624eb;return db[_0x5ca1('0x44')]['findOne']({'where':{'id':_0x493891[_0x5ca1('0x4b')]['id']}})['then'](handleEntityNotFound(_0xdef7f7,null))[_0x5ca1('0x27')](function(_0x31da6d){if(_0x31da6d){_0x5591bd=_0x31da6d;_0x2f812c[_0x5ca1('0x32')]=_[_0x5ca1('0x34')](db['ZohoField']['rawAttributes']);_0x2f812c['query']=_['keys'](_0x493891[_0x5ca1('0x33')]);_0x2f812c[_0x5ca1('0x3e')]=_['intersection'](_0x2f812c['model'],_0x2f812c[_0x5ca1('0x33')]);_0x1e653a[_0x5ca1('0x36')]=_[_0x5ca1('0x35')](_0x2f812c['model'],qs['fields'](_0x493891['query'][_0x5ca1('0x37')]));_0x1e653a[_0x5ca1('0x36')]=_0x1e653a[_0x5ca1('0x36')][_0x5ca1('0x38')]?_0x1e653a[_0x5ca1('0x36')]:_0x2f812c['model'];_0x1e653a[_0x5ca1('0x3b')]=qs['sort'](_0x493891[_0x5ca1('0x33')][_0x5ca1('0x3c')]);_0x1e653a[_0x5ca1('0x3d')]=qs[_0x5ca1('0x3e')](_[_0x5ca1('0x3f')](_0x493891['query'],_0x2f812c[_0x5ca1('0x3e')]));if(_0x493891['query']['filter']){_0x1e653a['where']=_[_0x5ca1('0x42')](_0x1e653a[_0x5ca1('0x3d')],{'$or':_[_0x5ca1('0x2e')](_0x1e653a[_0x5ca1('0x36')],function(_0x5835cf){var _0x29b0d8={};_0x29b0d8[_0x5835cf]={'$like':'%'+_0x493891[_0x5ca1('0x33')][_0x5ca1('0x40')]+'%'};return _0x29b0d8;})});}_0x1e653a=_[_0x5ca1('0x42')]({},_0x1e653a,_0x493891['options']);return _0x5591bd['getSubjects'](_0x1e653a);}})[_0x5ca1('0x27')](function(_0x1a2df1){if(_0x1a2df1){_0x2624eb=_0x1a2df1[_0x5ca1('0x38')];if(!_0x493891[_0x5ca1('0x33')][_0x5ca1('0x39')](_0x5ca1('0x3a'))){_0x1e653a[_0x5ca1('0x20')]=qs[_0x5ca1('0x20')](_0x493891[_0x5ca1('0x33')][_0x5ca1('0x20')]);_0x1e653a[_0x5ca1('0x1e')]=qs[_0x5ca1('0x1e')](_0x493891[_0x5ca1('0x33')][_0x5ca1('0x1e')]);}return _0x5591bd[_0x5ca1('0x53')](_0x1e653a);}})['then'](function(_0x1e6c6a){if(_0x1e6c6a){return _0x1e6c6a?{'count':_0x2624eb,'rows':_0x1e6c6a}:null;}})[_0x5ca1('0x27')](respondWithResult(_0xdef7f7,null))[_0x5ca1('0x49')](handleError(_0xdef7f7,null));};exports[_0x5ca1('0x54')]=function(_0xb5d826,_0x3169f8,_0x4541f3){var _0x2380b9={};var _0x2e3b37={};var _0x85a4ae;var _0x3c982a;return db[_0x5ca1('0x44')][_0x5ca1('0x51')]({'where':{'id':_0xb5d826[_0x5ca1('0x4b')]['id']}})[_0x5ca1('0x27')](handleEntityNotFound(_0x3169f8,null))[_0x5ca1('0x27')](function(_0x276933){if(_0x276933){_0x85a4ae=_0x276933;_0x2e3b37[_0x5ca1('0x32')]=_[_0x5ca1('0x34')](db[_0x5ca1('0x52')]['rawAttributes']);_0x2e3b37[_0x5ca1('0x33')]=_[_0x5ca1('0x34')](_0xb5d826[_0x5ca1('0x33')]);_0x2e3b37[_0x5ca1('0x3e')]=_[_0x5ca1('0x35')](_0x2e3b37['model'],_0x2e3b37[_0x5ca1('0x33')]);_0x2380b9[_0x5ca1('0x36')]=_[_0x5ca1('0x35')](_0x2e3b37[_0x5ca1('0x32')],qs['fields'](_0xb5d826['query'][_0x5ca1('0x37')]));_0x2380b9[_0x5ca1('0x36')]=_0x2380b9['attributes']['length']?_0x2380b9['attributes']:_0x2e3b37['model'];_0x2380b9[_0x5ca1('0x3b')]=qs[_0x5ca1('0x3c')](_0xb5d826[_0x5ca1('0x33')][_0x5ca1('0x3c')]);_0x2380b9[_0x5ca1('0x3d')]=qs[_0x5ca1('0x3e')](_[_0x5ca1('0x3f')](_0xb5d826['query'],_0x2e3b37[_0x5ca1('0x3e')]));if(_0xb5d826[_0x5ca1('0x33')][_0x5ca1('0x40')]){_0x2380b9['where']=_['merge'](_0x2380b9[_0x5ca1('0x3d')],{'$or':_[_0x5ca1('0x2e')](_0x2380b9[_0x5ca1('0x36')],function(_0x21de84){var _0x1a3762={};_0x1a3762[_0x21de84]={'$like':'%'+_0xb5d826[_0x5ca1('0x33')]['filter']+'%'};return _0x1a3762;})});}_0x2380b9=_['merge']({},_0x2380b9,_0xb5d826[_0x5ca1('0x43')]);return _0x85a4ae[_0x5ca1('0x54')](_0x2380b9);}})[_0x5ca1('0x27')](function(_0x155d5a){if(_0x155d5a){_0x3c982a=_0x155d5a[_0x5ca1('0x38')];if(!_0xb5d826['query']['hasOwnProperty'](_0x5ca1('0x3a'))){_0x2380b9[_0x5ca1('0x20')]=qs[_0x5ca1('0x20')](_0xb5d826[_0x5ca1('0x33')]['limit']);_0x2380b9['offset']=qs[_0x5ca1('0x1e')](_0xb5d826[_0x5ca1('0x33')][_0x5ca1('0x1e')]);}return _0x85a4ae[_0x5ca1('0x54')](_0x2380b9);}})[_0x5ca1('0x27')](function(_0x21c2dd){if(_0x21c2dd){return _0x21c2dd?{'count':_0x3c982a,'rows':_0x21c2dd}:null;}})[_0x5ca1('0x27')](respondWithResult(_0x3169f8,null))['catch'](handleError(_0x3169f8,null));}; \ No newline at end of file +var _0xdcd6=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','update','getFields','findOne','getSubjects','ZohoField','getDescriptions','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','status','end','offset','undefined','count','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xdcd6,0x114));var _0x6dcd=function(_0x1e0c0e,_0x5ccb80){_0x1e0c0e=_0x1e0c0e-0x0;var _0x53fecc=_0xdcd6[_0x1e0c0e];return _0x53fecc;};'use strict';var emlformat=require(_0x6dcd('0x0'));var rimraf=require(_0x6dcd('0x1'));var zipdir=require(_0x6dcd('0x2'));var jsonpatch=require(_0x6dcd('0x3'));var rp=require(_0x6dcd('0x4'));var moment=require(_0x6dcd('0x5'));var BPromise=require(_0x6dcd('0x6'));var Mustache=require(_0x6dcd('0x7'));var util=require(_0x6dcd('0x8'));var path=require(_0x6dcd('0x9'));var sox=require(_0x6dcd('0xa'));var csv=require(_0x6dcd('0xb'));var ejs=require(_0x6dcd('0xc'));var fs=require('fs');var fs_extra=require(_0x6dcd('0xd'));var _=require(_0x6dcd('0xe'));var squel=require(_0x6dcd('0xf'));var crypto=require(_0x6dcd('0x10'));var jsforce=require(_0x6dcd('0x11'));var deskjs=require(_0x6dcd('0x12'));var toCsv=require('to-csv');var querystring=require(_0x6dcd('0x13'));var Papa=require(_0x6dcd('0x14'));var Redis=require(_0x6dcd('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x6dcd('0x16'));var as=require(_0x6dcd('0x17'));var hardwareService=require(_0x6dcd('0x18'));var logger=require(_0x6dcd('0x19'))(_0x6dcd('0x1a'));var utils=require(_0x6dcd('0x1b'));var config=require(_0x6dcd('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x110d70,_0x2a3b4a){_0x2a3b4a=_0x2a3b4a||0xcc;return function(_0x285689){if(_0x285689){return _0x110d70['sendStatus'](_0x2a3b4a);}return _0x110d70[_0x6dcd('0x1d')](_0x2a3b4a)[_0x6dcd('0x1e')]();};}function respondWithResult(_0x4197b2,_0xf88d15){_0xf88d15=_0xf88d15||0xc8;return function(_0x1bfe61){if(_0x1bfe61){return _0x4197b2[_0x6dcd('0x1d')](_0xf88d15)['json'](_0x1bfe61);}};}function respondWithFilteredResult(_0x3b194b,_0x5a6b70){return function(_0x3553c3){if(_0x3553c3){var _0x17660f=typeof _0x5a6b70[_0x6dcd('0x1f')]===_0x6dcd('0x20')&&typeof _0x5a6b70['limit']===_0x6dcd('0x20');var _0x5255c5=_0x3553c3[_0x6dcd('0x21')];var _0x3ead39=_0x17660f?0x0:_0x5a6b70[_0x6dcd('0x1f')];var _0x32439d=_0x17660f?_0x3553c3[_0x6dcd('0x21')]:_0x5a6b70[_0x6dcd('0x1f')]+_0x5a6b70['limit'];var _0x411ee8;if(_0x32439d>=_0x5255c5){_0x32439d=_0x5255c5;_0x411ee8=0xc8;}else{_0x411ee8=0xce;}_0x3b194b[_0x6dcd('0x1d')](_0x411ee8);return _0x3b194b[_0x6dcd('0x22')](_0x6dcd('0x23'),_0x3ead39+'-'+_0x32439d+'/'+_0x5255c5)['json'](_0x3553c3);}return null;};}function patchUpdates(_0x408d62){return function(_0x186224){try{jsonpatch[_0x6dcd('0x24')](_0x186224,_0x408d62,!![]);}catch(_0x4296d8){return BPromise[_0x6dcd('0x25')](_0x4296d8);}return _0x186224['save']();};}function saveUpdates(_0x1dab72,_0x2a6ed4){return function(_0x103b10){if(_0x103b10){return _0x103b10['update'](_0x1dab72)[_0x6dcd('0x26')](function(_0x2a384d){return _0x2a384d;});}return null;};}function removeEntity(_0x1d5281,_0x2670e1){return function(_0x42f7df){if(_0x42f7df){return _0x42f7df['destroy']()[_0x6dcd('0x26')](function(){_0x1d5281[_0x6dcd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3a55,_0x48c7e7){return function(_0x25e8b7){if(!_0x25e8b7){_0x5d3a55[_0x6dcd('0x27')](0x194);}return _0x25e8b7;};}function handleError(_0x1e5acd,_0x360740){_0x360740=_0x360740||0x1f4;return function(_0x1dabaa){logger[_0x6dcd('0x28')](_0x1dabaa[_0x6dcd('0x29')]);if(_0x1dabaa[_0x6dcd('0x2a')]){delete _0x1dabaa[_0x6dcd('0x2a')];}_0x1e5acd[_0x6dcd('0x1d')](_0x360740)[_0x6dcd('0x2b')](_0x1dabaa);};}exports[_0x6dcd('0x2c')]=function(_0x9579a7,_0x56625a){var _0x5839f9={},_0x87a314={},_0x79f8a4={'count':0x0,'rows':[]};var _0x50eb12=_[_0x6dcd('0x2d')](db[_0x6dcd('0x2e')][_0x6dcd('0x2f')],function(_0xdbacff){return{'name':_0xdbacff['fieldName'],'type':_0xdbacff[_0x6dcd('0x30')][_0x6dcd('0x31')]};});_0x87a314[_0x6dcd('0x32')]=_[_0x6dcd('0x2d')](_0x50eb12,_0x6dcd('0x2a'));_0x87a314[_0x6dcd('0x33')]=_[_0x6dcd('0x34')](_0x9579a7[_0x6dcd('0x33')]);_0x87a314[_0x6dcd('0x35')]=_[_0x6dcd('0x36')](_0x87a314[_0x6dcd('0x32')],_0x87a314['query']);_0x5839f9[_0x6dcd('0x37')]=_[_0x6dcd('0x36')](_0x87a314[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x9579a7[_0x6dcd('0x33')]['fields']));_0x5839f9['attributes']=_0x5839f9[_0x6dcd('0x37')][_0x6dcd('0x39')]?_0x5839f9[_0x6dcd('0x37')]:_0x87a314[_0x6dcd('0x32')];if(!_0x9579a7[_0x6dcd('0x33')][_0x6dcd('0x3a')](_0x6dcd('0x3b'))){_0x5839f9[_0x6dcd('0x3c')]=qs['limit'](_0x9579a7[_0x6dcd('0x33')]['limit']);_0x5839f9['offset']=qs[_0x6dcd('0x1f')](_0x9579a7[_0x6dcd('0x33')][_0x6dcd('0x1f')]);}_0x5839f9[_0x6dcd('0x3d')]=qs[_0x6dcd('0x3e')](_0x9579a7[_0x6dcd('0x33')][_0x6dcd('0x3e')]);_0x5839f9[_0x6dcd('0x3f')]=qs['filters'](_[_0x6dcd('0x40')](_0x9579a7[_0x6dcd('0x33')],_0x87a314[_0x6dcd('0x35')]),_0x50eb12);if(_0x9579a7[_0x6dcd('0x33')][_0x6dcd('0x41')]){_0x5839f9['where']=_[_0x6dcd('0x42')](_0x5839f9[_0x6dcd('0x3f')],{'$or':_[_0x6dcd('0x2d')](_0x50eb12,function(_0x50322a){if(_0x50322a[_0x6dcd('0x30')]!=='VIRTUAL'){var _0x9a3eec={};_0x9a3eec[_0x50322a[_0x6dcd('0x2a')]]={'$like':'%'+_0x9579a7['query'][_0x6dcd('0x41')]+'%'};return _0x9a3eec;}})});}_0x5839f9=_[_0x6dcd('0x42')]({},_0x5839f9,_0x9579a7['options']);var _0x2e2d95={'where':_0x5839f9['where']};return db[_0x6dcd('0x2e')][_0x6dcd('0x21')](_0x2e2d95)[_0x6dcd('0x26')](function(_0x2abb32){_0x79f8a4['count']=_0x2abb32;if(_0x9579a7['query']['includeAll']){_0x5839f9[_0x6dcd('0x43')]=[{'all':!![]}];}return db[_0x6dcd('0x2e')][_0x6dcd('0x44')](_0x5839f9);})[_0x6dcd('0x26')](function(_0x229335){_0x79f8a4[_0x6dcd('0x45')]=_0x229335;return _0x79f8a4;})[_0x6dcd('0x26')](respondWithFilteredResult(_0x56625a,_0x5839f9))[_0x6dcd('0x46')](handleError(_0x56625a,null));};exports['show']=function(_0x37927c,_0x4ff25f){var _0x46c310={'raw':![],'where':{'id':_0x37927c[_0x6dcd('0x47')]['id']}},_0x1e6028={};_0x1e6028['model']=_[_0x6dcd('0x34')](db[_0x6dcd('0x2e')][_0x6dcd('0x2f')]);_0x1e6028[_0x6dcd('0x33')]=_[_0x6dcd('0x34')](_0x37927c[_0x6dcd('0x33')]);_0x1e6028[_0x6dcd('0x35')]=_['intersection'](_0x1e6028['model'],_0x1e6028[_0x6dcd('0x33')]);_0x46c310[_0x6dcd('0x37')]=_['intersection'](_0x1e6028[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x37927c[_0x6dcd('0x33')][_0x6dcd('0x38')]));_0x46c310[_0x6dcd('0x37')]=_0x46c310[_0x6dcd('0x37')][_0x6dcd('0x39')]?_0x46c310[_0x6dcd('0x37')]:_0x1e6028['model'];if(_0x37927c[_0x6dcd('0x33')][_0x6dcd('0x48')]){_0x46c310[_0x6dcd('0x43')]=[{'all':!![]}];}_0x46c310=_[_0x6dcd('0x42')]({},_0x46c310,_0x37927c[_0x6dcd('0x49')]);return db['ZohoConfiguration'][_0x6dcd('0x4a')](_0x46c310)['then'](handleEntityNotFound(_0x4ff25f,null))[_0x6dcd('0x26')](respondWithResult(_0x4ff25f,null))['catch'](handleError(_0x4ff25f,null));};exports[_0x6dcd('0x4b')]=function(_0x255cfc,_0x5dfa8d){return db[_0x6dcd('0x2e')][_0x6dcd('0x4b')](_0x255cfc[_0x6dcd('0x4c')],{})['then'](respondWithResult(_0x5dfa8d,0xc9))[_0x6dcd('0x46')](handleError(_0x5dfa8d,null));};exports[_0x6dcd('0x4d')]=function(_0x15d149,_0x1b6ace){if(_0x15d149['body']['id']){delete _0x15d149[_0x6dcd('0x4c')]['id'];}return db['ZohoConfiguration'][_0x6dcd('0x4a')]({'where':{'id':_0x15d149[_0x6dcd('0x47')]['id']}})[_0x6dcd('0x26')](handleEntityNotFound(_0x1b6ace,null))[_0x6dcd('0x26')](saveUpdates(_0x15d149[_0x6dcd('0x4c')],null))['then'](respondWithResult(_0x1b6ace,null))[_0x6dcd('0x46')](handleError(_0x1b6ace,null));};exports['destroy']=function(_0x4a2bf7,_0x4a63f7){return db[_0x6dcd('0x2e')][_0x6dcd('0x4a')]({'where':{'id':_0x4a2bf7['params']['id']}})['then'](handleEntityNotFound(_0x4a63f7,null))[_0x6dcd('0x26')](removeEntity(_0x4a63f7,null))[_0x6dcd('0x46')](handleError(_0x4a63f7,null));};exports[_0x6dcd('0x4e')]=function(_0x5ac012,_0xa6ad2,_0x3b0899){var _0x3426cf={};var _0x527ed8={};var _0x27b2e0;var _0x5658e0;return db[_0x6dcd('0x2e')][_0x6dcd('0x4f')]({'where':{'id':_0x5ac012[_0x6dcd('0x47')]['id']}})[_0x6dcd('0x26')](handleEntityNotFound(_0xa6ad2,null))[_0x6dcd('0x26')](function(_0x349c3f){if(_0x349c3f){_0x27b2e0=_0x349c3f;_0x527ed8[_0x6dcd('0x32')]=_[_0x6dcd('0x34')](db['ZohoField'][_0x6dcd('0x2f')]);_0x527ed8[_0x6dcd('0x33')]=_[_0x6dcd('0x34')](_0x5ac012[_0x6dcd('0x33')]);_0x527ed8[_0x6dcd('0x35')]=_[_0x6dcd('0x36')](_0x527ed8[_0x6dcd('0x32')],_0x527ed8[_0x6dcd('0x33')]);_0x3426cf['attributes']=_[_0x6dcd('0x36')](_0x527ed8[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x5ac012['query'][_0x6dcd('0x38')]));_0x3426cf['attributes']=_0x3426cf[_0x6dcd('0x37')][_0x6dcd('0x39')]?_0x3426cf[_0x6dcd('0x37')]:_0x527ed8[_0x6dcd('0x32')];_0x3426cf[_0x6dcd('0x3d')]=qs[_0x6dcd('0x3e')](_0x5ac012[_0x6dcd('0x33')][_0x6dcd('0x3e')]);_0x3426cf['where']=qs[_0x6dcd('0x35')](_[_0x6dcd('0x40')](_0x5ac012['query'],_0x527ed8[_0x6dcd('0x35')]));if(_0x5ac012['query'][_0x6dcd('0x41')]){_0x3426cf[_0x6dcd('0x3f')]=_['merge'](_0x3426cf[_0x6dcd('0x3f')],{'$or':_[_0x6dcd('0x2d')](_0x3426cf[_0x6dcd('0x37')],function(_0x1d3091){var _0x1e5dda={};_0x1e5dda[_0x1d3091]={'$like':'%'+_0x5ac012['query'][_0x6dcd('0x41')]+'%'};return _0x1e5dda;})});}_0x3426cf=_['merge']({},_0x3426cf,_0x5ac012['options']);return _0x27b2e0[_0x6dcd('0x4e')](_0x3426cf);}})['then'](function(_0x11713a){if(_0x11713a){_0x5658e0=_0x11713a['length'];if(!_0x5ac012[_0x6dcd('0x33')][_0x6dcd('0x3a')](_0x6dcd('0x3b'))){_0x3426cf[_0x6dcd('0x3c')]=qs[_0x6dcd('0x3c')](_0x5ac012['query'][_0x6dcd('0x3c')]);_0x3426cf[_0x6dcd('0x1f')]=qs[_0x6dcd('0x1f')](_0x5ac012[_0x6dcd('0x33')][_0x6dcd('0x1f')]);}return _0x27b2e0[_0x6dcd('0x4e')](_0x3426cf);}})[_0x6dcd('0x26')](function(_0x232901){if(_0x232901){return _0x232901?{'count':_0x5658e0,'rows':_0x232901}:null;}})[_0x6dcd('0x26')](respondWithResult(_0xa6ad2,null))[_0x6dcd('0x46')](handleError(_0xa6ad2,null));};exports[_0x6dcd('0x50')]=function(_0x357bc0,_0x215e7a,_0x44261c){var _0x569057={};var _0x56270b={};var _0x300713;var _0x56c42b;return db['ZohoConfiguration'][_0x6dcd('0x4f')]({'where':{'id':_0x357bc0[_0x6dcd('0x47')]['id']}})[_0x6dcd('0x26')](handleEntityNotFound(_0x215e7a,null))[_0x6dcd('0x26')](function(_0x21f476){if(_0x21f476){_0x300713=_0x21f476;_0x56270b['model']=_[_0x6dcd('0x34')](db[_0x6dcd('0x51')][_0x6dcd('0x2f')]);_0x56270b['query']=_[_0x6dcd('0x34')](_0x357bc0[_0x6dcd('0x33')]);_0x56270b['filters']=_[_0x6dcd('0x36')](_0x56270b[_0x6dcd('0x32')],_0x56270b['query']);_0x569057['attributes']=_[_0x6dcd('0x36')](_0x56270b[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x357bc0[_0x6dcd('0x33')][_0x6dcd('0x38')]));_0x569057[_0x6dcd('0x37')]=_0x569057['attributes']['length']?_0x569057['attributes']:_0x56270b[_0x6dcd('0x32')];_0x569057[_0x6dcd('0x3d')]=qs[_0x6dcd('0x3e')](_0x357bc0['query'][_0x6dcd('0x3e')]);_0x569057['where']=qs[_0x6dcd('0x35')](_[_0x6dcd('0x40')](_0x357bc0[_0x6dcd('0x33')],_0x56270b[_0x6dcd('0x35')]));if(_0x357bc0[_0x6dcd('0x33')][_0x6dcd('0x41')]){_0x569057['where']=_[_0x6dcd('0x42')](_0x569057[_0x6dcd('0x3f')],{'$or':_[_0x6dcd('0x2d')](_0x569057[_0x6dcd('0x37')],function(_0x48afe7){var _0x5cabb2={};_0x5cabb2[_0x48afe7]={'$like':'%'+_0x357bc0['query']['filter']+'%'};return _0x5cabb2;})});}_0x569057=_[_0x6dcd('0x42')]({},_0x569057,_0x357bc0[_0x6dcd('0x49')]);return _0x300713[_0x6dcd('0x50')](_0x569057);}})[_0x6dcd('0x26')](function(_0x49c3dd){if(_0x49c3dd){_0x56c42b=_0x49c3dd['length'];if(!_0x357bc0[_0x6dcd('0x33')][_0x6dcd('0x3a')](_0x6dcd('0x3b'))){_0x569057[_0x6dcd('0x3c')]=qs[_0x6dcd('0x3c')](_0x357bc0[_0x6dcd('0x33')]['limit']);_0x569057[_0x6dcd('0x1f')]=qs[_0x6dcd('0x1f')](_0x357bc0[_0x6dcd('0x33')]['offset']);}return _0x300713[_0x6dcd('0x50')](_0x569057);}})[_0x6dcd('0x26')](function(_0x5849e6){if(_0x5849e6){return _0x5849e6?{'count':_0x56c42b,'rows':_0x5849e6}:null;}})[_0x6dcd('0x26')](respondWithResult(_0x215e7a,null))[_0x6dcd('0x46')](handleError(_0x215e7a,null));};exports['getDescriptions']=function(_0x1d300a,_0x4d81aa,_0x14e195){var _0x2ba0b9={};var _0x12f8c5={};var _0x5086e2;var _0x5acbde;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x1d300a[_0x6dcd('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d81aa,null))['then'](function(_0x4fb82e){if(_0x4fb82e){_0x5086e2=_0x4fb82e;_0x12f8c5['model']=_['keys'](db[_0x6dcd('0x51')][_0x6dcd('0x2f')]);_0x12f8c5[_0x6dcd('0x33')]=_[_0x6dcd('0x34')](_0x1d300a[_0x6dcd('0x33')]);_0x12f8c5[_0x6dcd('0x35')]=_[_0x6dcd('0x36')](_0x12f8c5['model'],_0x12f8c5[_0x6dcd('0x33')]);_0x2ba0b9[_0x6dcd('0x37')]=_[_0x6dcd('0x36')](_0x12f8c5[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x1d300a['query'][_0x6dcd('0x38')]));_0x2ba0b9[_0x6dcd('0x37')]=_0x2ba0b9['attributes'][_0x6dcd('0x39')]?_0x2ba0b9[_0x6dcd('0x37')]:_0x12f8c5[_0x6dcd('0x32')];_0x2ba0b9[_0x6dcd('0x3d')]=qs[_0x6dcd('0x3e')](_0x1d300a[_0x6dcd('0x33')][_0x6dcd('0x3e')]);_0x2ba0b9['where']=qs[_0x6dcd('0x35')](_['pick'](_0x1d300a[_0x6dcd('0x33')],_0x12f8c5['filters']));if(_0x1d300a[_0x6dcd('0x33')]['filter']){_0x2ba0b9[_0x6dcd('0x3f')]=_[_0x6dcd('0x42')](_0x2ba0b9['where'],{'$or':_[_0x6dcd('0x2d')](_0x2ba0b9[_0x6dcd('0x37')],function(_0x4d981c){var _0x1ed96c={};_0x1ed96c[_0x4d981c]={'$like':'%'+_0x1d300a[_0x6dcd('0x33')][_0x6dcd('0x41')]+'%'};return _0x1ed96c;})});}_0x2ba0b9=_[_0x6dcd('0x42')]({},_0x2ba0b9,_0x1d300a[_0x6dcd('0x49')]);return _0x5086e2[_0x6dcd('0x52')](_0x2ba0b9);}})[_0x6dcd('0x26')](function(_0x5af063){if(_0x5af063){_0x5acbde=_0x5af063['length'];if(!_0x1d300a[_0x6dcd('0x33')]['hasOwnProperty'](_0x6dcd('0x3b'))){_0x2ba0b9[_0x6dcd('0x3c')]=qs[_0x6dcd('0x3c')](_0x1d300a[_0x6dcd('0x33')][_0x6dcd('0x3c')]);_0x2ba0b9['offset']=qs[_0x6dcd('0x1f')](_0x1d300a[_0x6dcd('0x33')][_0x6dcd('0x1f')]);}return _0x5086e2[_0x6dcd('0x52')](_0x2ba0b9);}})[_0x6dcd('0x26')](function(_0x2b89b0){if(_0x2b89b0){return _0x2b89b0?{'count':_0x5acbde,'rows':_0x2b89b0}:null;}})['then'](respondWithResult(_0x4d81aa,null))[_0x6dcd('0x46')](handleError(_0x4d81aa,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 0e74537..21d2220 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 _0x5ca9=['bluebird','request-promise','../../config/environment','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x5ca9,0x7f));var _0x95ca=function(_0x260517,_0x37649c){_0x260517=_0x260517-0x0;var _0x406d27=_0x5ca9[_0x260517];return _0x406d27;};'use strict';var _=require(_0x95ca('0x0'));var util=require(_0x95ca('0x1'));var logger=require(_0x95ca('0x2'))(_0x95ca('0x3'));var moment=require(_0x95ca('0x4'));var BPromise=require(_0x95ca('0x5'));var rp=require(_0x95ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x95ca('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x95ca('0x8')]=function(_0x4d3c76,_0x2fdcca){return _0x4d3c76[_0x95ca('0x9')]('ZohoConfiguration',attributes,{'tableName':_0x95ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad34=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x33e402,_0x670be3){var _0x56f8a0=function(_0x55fcce){while(--_0x55fcce){_0x33e402['push'](_0x33e402['shift']());}};_0x56f8a0(++_0x670be3);}(_0xad34,0xb7));var _0x4ad3=function(_0x1550a9,_0x3a2d5e){_0x1550a9=_0x1550a9-0x0;var _0x5261e1=_0xad34[_0x1550a9];return _0x5261e1;};'use strict';var _=require(_0x4ad3('0x0'));var util=require(_0x4ad3('0x1'));var logger=require(_0x4ad3('0x2'))(_0x4ad3('0x3'));var moment=require(_0x4ad3('0x4'));var BPromise=require(_0x4ad3('0x5'));var rp=require(_0x4ad3('0x6'));var fs=require('fs');var path=require(_0x4ad3('0x7'));var rimraf=require(_0x4ad3('0x8'));var config=require(_0x4ad3('0x9'));var attributes=require(_0x4ad3('0xa'));module[_0x4ad3('0xb')]=function(_0x35481a,_0x1f57e6){return _0x35481a[_0x4ad3('0xc')](_0x4ad3('0xd'),attributes,{'tableName':_0x4ad3('0xe'),'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 6341d0a..747cfed 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 _0xe2b7=['then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x3a05ef,_0x24e452){var _0x1ab302=function(_0x3b919d){while(--_0x3b919d){_0x3a05ef['push'](_0x3a05ef['shift']());}};_0x1ab302(++_0x24e452);}(_0xe2b7,0x90));var _0x7e2b=function(_0x2b1400,_0x2ad092){_0x2b1400=_0x2b1400-0x0;var _0x4e2c20=_0xe2b7[_0x2b1400];return _0x4e2c20;};'use strict';var _=require(_0x7e2b('0x0'));var util=require('util');var moment=require(_0x7e2b('0x1'));var BPromise=require('bluebird');var rs=require(_0x7e2b('0x2'));var fs=require('fs');var Redis=require(_0x7e2b('0x3'));var db=require(_0x7e2b('0x4'))['db'];var utils=require(_0x7e2b('0x5'));var logger=require(_0x7e2b('0x6'))(_0x7e2b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e2b('0x8')][_0x7e2b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x460512,_0x16c700,_0x4dfcaf){return new BPromise(function(_0x3a8bae,_0x6961a7){return client['request'](_0x460512,_0x4dfcaf)[_0x7e2b('0xa')](function(_0x25b720){logger['info'](_0x7e2b('0xb'),_0x16c700,'request\x20sent');logger[_0x7e2b('0xc')](_0x7e2b('0xd'),_0x16c700,'request\x20sent',JSON[_0x7e2b('0xe')](_0x25b720));if(_0x25b720[_0x7e2b('0xf')]){if(_0x25b720[_0x7e2b('0xf')][_0x7e2b('0x10')]===0x1f4){logger[_0x7e2b('0xf')](_0x7e2b('0xb'),_0x16c700,_0x25b720['error'][_0x7e2b('0x11')]);return _0x6961a7(_0x25b720[_0x7e2b('0xf')][_0x7e2b('0x11')]);}logger[_0x7e2b('0xf')](_0x7e2b('0xb'),_0x16c700,_0x25b720[_0x7e2b('0xf')][_0x7e2b('0x11')]);return _0x3a8bae(_0x25b720[_0x7e2b('0xf')]['message']);}else{logger[_0x7e2b('0x12')](_0x7e2b('0xb'),_0x16c700,_0x7e2b('0x13'));_0x3a8bae(_0x25b720[_0x7e2b('0x14')][_0x7e2b('0x11')]);}})[_0x7e2b('0x15')](function(_0x3e69f9){logger[_0x7e2b('0xf')](_0x7e2b('0xb'),_0x16c700,_0x3e69f9);_0x6961a7(_0x3e69f9);});});} \ No newline at end of file +var _0xcac3=['info','request\x20sent','error','message','ZohoConfiguration,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x14a34a,_0x424129){var _0x4d921e=function(_0x1982be){while(--_0x1982be){_0x14a34a['push'](_0x14a34a['shift']());}};_0x4d921e(++_0x424129);}(_0xcac3,0xaf));var _0x3cac=function(_0x3960a3,_0x5e59b8){_0x3960a3=_0x3960a3-0x0;var _0x2e103b=_0xcac3[_0x3960a3];return _0x2e103b;};'use strict';var _=require(_0x3cac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3cac('0x1'));var rs=require(_0x3cac('0x2'));var fs=require('fs');var Redis=require(_0x3cac('0x3'));var db=require(_0x3cac('0x4'))['db'];var utils=require(_0x3cac('0x5'));var logger=require(_0x3cac('0x6'))(_0x3cac('0x7'));var config=require(_0x3cac('0x8'));var jayson=require(_0x3cac('0x9'));var client=jayson[_0x3cac('0xa')][_0x3cac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x182e67,_0x468238,_0x2ed12f){return new BPromise(function(_0x2d92f2,_0x522154){return client[_0x3cac('0xc')](_0x182e67,_0x2ed12f)[_0x3cac('0xd')](function(_0x5a913b){logger[_0x3cac('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x468238,_0x3cac('0xf'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x468238,_0x3cac('0xf'),JSON['stringify'](_0x5a913b));if(_0x5a913b['error']){if(_0x5a913b[_0x3cac('0x10')]['code']===0x1f4){logger[_0x3cac('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x468238,_0x5a913b[_0x3cac('0x10')][_0x3cac('0x11')]);return _0x522154(_0x5a913b[_0x3cac('0x10')][_0x3cac('0x11')]);}logger['error'](_0x3cac('0x12'),_0x468238,_0x5a913b[_0x3cac('0x10')][_0x3cac('0x11')]);return _0x2d92f2(_0x5a913b[_0x3cac('0x10')][_0x3cac('0x11')]);}else{logger[_0x3cac('0xe')](_0x3cac('0x12'),_0x468238,_0x3cac('0xf'));_0x2d92f2(_0x5a913b[_0x3cac('0x13')][_0x3cac('0x11')]);}})[_0x3cac('0x14')](function(_0x1a7d7f){logger[_0x3cac('0x10')](_0x3cac('0x12'),_0x468238,_0x1a7d7f);_0x522154(_0x1a7d7f);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 7a10836..36e383f 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 _0xb910=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','show','post','isAuthenticated','put','update','delete','/:id','destroy','exports'];(function(_0x363d84,_0x1f7d1e){var _0xf8648a=function(_0x40ead0){while(--_0x40ead0){_0x363d84['push'](_0x363d84['shift']());}};_0xf8648a(++_0x1f7d1e);}(_0xb910,0x130));var _0x0b91=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb910[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x0b91('0x0'));var util=require(_0x0b91('0x1'));var path=require(_0x0b91('0x2'));var timeout=require(_0x0b91('0x3'));var express=require('express');var router=express[_0x0b91('0x4')]();var fs_extra=require(_0x0b91('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0b91('0x6'));var config=require(_0x0b91('0x7'));var controller=require(_0x0b91('0x8'));router[_0x0b91('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0b91('0xa')]);router[_0x0b91('0xb')]('/',auth[_0x0b91('0xc')](),controller['create']);router[_0x0b91('0xd')]('/:id',auth[_0x0b91('0xc')](),controller[_0x0b91('0xe')]);router[_0x0b91('0xf')](_0x0b91('0x10'),auth[_0x0b91('0xc')](),controller[_0x0b91('0x11')]);module[_0x0b91('0x12')]=router; \ No newline at end of file +var _0x5c23=['delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','update'];(function(_0x1b6158,_0x1b7c2f){var _0x5c6338=function(_0x3672bb){while(--_0x3672bb){_0x1b6158['push'](_0x1b6158['shift']());}};_0x5c6338(++_0x1b7c2f);}(_0x5c23,0x178));var _0x35c2=function(_0x300b39,_0x2479fa){_0x300b39=_0x300b39-0x0;var _0x59eda5=_0x5c23[_0x300b39];return _0x59eda5;};'use strict';var multer=require(_0x35c2('0x0'));var util=require(_0x35c2('0x1'));var path=require(_0x35c2('0x2'));var timeout=require(_0x35c2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x35c2('0x4'));var auth=require(_0x35c2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x35c2('0x6'));var controller=require(_0x35c2('0x7'));router[_0x35c2('0x8')]('/',auth[_0x35c2('0x9')](),controller[_0x35c2('0xa')]);router[_0x35c2('0x8')](_0x35c2('0xb'),auth['isAuthenticated'](),controller[_0x35c2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x35c2('0xd')]);router['put'](_0x35c2('0xb'),auth[_0x35c2('0x9')](),controller[_0x35c2('0xe')]);router[_0x35c2('0xf')]('/:id',auth[_0x35c2('0x9')](),controller[_0x35c2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c068a44..180937f 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 _0x3749=['variable','customVariable','sequelize','exports','ENUM','keyValue','STRING','string'];(function(_0x2675da,_0x5a250e){var _0x5e6153=function(_0xf93114){while(--_0xf93114){_0x2675da['push'](_0x2675da['shift']());}};_0x5e6153(++_0x5a250e);}(_0x3749,0x15a));var _0x9374=function(_0x1a9f27,_0x1f8a6f){_0x1a9f27=_0x1a9f27-0x0;var _0x142e50=_0x3749[_0x1a9f27];return _0x142e50;};'use strict';var Sequelize=require(_0x9374('0x0'));module[_0x9374('0x1')]={'type':{'type':Sequelize[_0x9374('0x2')]('string','variable','customVariable',_0x9374('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x9374('0x4')]},'key':{'type':Sequelize[_0x9374('0x4')]},'keyType':{'type':Sequelize[_0x9374('0x2')](_0x9374('0x5'),_0x9374('0x6'),_0x9374('0x7'))},'keyContent':{'type':Sequelize[_0x9374('0x4')]},'idField':{'type':Sequelize[_0x9374('0x4')]},'nameField':{'type':Sequelize[_0x9374('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9374('0x4')]}}; \ No newline at end of file +var _0x583e=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0xfc4cc1,_0x3aad8){var _0x4b73eb=function(_0x296fc3){while(--_0x296fc3){_0xfc4cc1['push'](_0xfc4cc1['shift']());}};_0x4b73eb(++_0x3aad8);}(_0x583e,0x132));var _0xe583=function(_0x5d494a,_0x5cf774){_0x5d494a=_0x5d494a-0x0;var _0x418723=_0x583e[_0x5d494a];return _0x418723;};'use strict';var Sequelize=require(_0xe583('0x0'));module[_0xe583('0x1')]={'type':{'type':Sequelize[_0xe583('0x2')](_0xe583('0x3'),'variable',_0xe583('0x4'),_0xe583('0x5'),_0xe583('0x6')),'defaultValue':_0xe583('0x3')},'content':{'type':Sequelize[_0xe583('0x7')]},'key':{'type':Sequelize[_0xe583('0x7')]},'keyType':{'type':Sequelize[_0xe583('0x2')](_0xe583('0x3'),_0xe583('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe583('0x7')]},'nameField':{'type':Sequelize[_0xe583('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe583('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index d08462e..0fce204 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 _0x6799=['catch','show','params','length','options','create','body','find','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','send','map','ZohoField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x3d064a,_0x12cf18){var _0x5b2a83=function(_0x241866){while(--_0x241866){_0x3d064a['push'](_0x3d064a['shift']());}};_0x5b2a83(++_0x12cf18);}(_0x6799,0x91));var _0x9679=function(_0x5af3d0,_0x2e9ff9){_0x5af3d0=_0x5af3d0-0x0;var _0x2a5cb8=_0x6799[_0x5af3d0];return _0x2a5cb8;};'use strict';var emlformat=require(_0x9679('0x0'));var rimraf=require(_0x9679('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9679('0x2'));var rp=require('request-promise');var moment=require(_0x9679('0x3'));var BPromise=require(_0x9679('0x4'));var Mustache=require(_0x9679('0x5'));var util=require(_0x9679('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9679('0x7'));var ejs=require(_0x9679('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9679('0x9'));var squel=require(_0x9679('0xa'));var crypto=require('crypto');var jsforce=require(_0x9679('0xb'));var deskjs=require(_0x9679('0xc'));var toCsv=require(_0x9679('0x7'));var querystring=require(_0x9679('0xd'));var Papa=require('papaparse');var Redis=require(_0x9679('0xe'));var authService=require(_0x9679('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9679('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9679('0x11'));var db=require(_0x9679('0x12'))['db'];function respondWithStatusCode(_0x9724fe,_0x379bd4){_0x379bd4=_0x379bd4||0xcc;return function(_0x502036){if(_0x502036){return _0x9724fe['sendStatus'](_0x379bd4);}return _0x9724fe[_0x9679('0x13')](_0x379bd4)[_0x9679('0x14')]();};}function respondWithResult(_0x5c99a7,_0x313878){_0x313878=_0x313878||0xc8;return function(_0x4841a9){if(_0x4841a9){return _0x5c99a7['status'](_0x313878)['json'](_0x4841a9);}};}function respondWithFilteredResult(_0x357269,_0x38ecfe){return function(_0x1adac8){if(_0x1adac8){var _0xb91487=typeof _0x38ecfe['offset']===_0x9679('0x15')&&typeof _0x38ecfe[_0x9679('0x16')]===_0x9679('0x15');var _0x202183=_0x1adac8[_0x9679('0x17')];var _0x285098=_0xb91487?0x0:_0x38ecfe[_0x9679('0x18')];var _0x371b46=_0xb91487?_0x1adac8[_0x9679('0x17')]:_0x38ecfe['offset']+_0x38ecfe[_0x9679('0x16')];var _0x15056a;if(_0x371b46>=_0x202183){_0x371b46=_0x202183;_0x15056a=0xc8;}else{_0x15056a=0xce;}_0x357269[_0x9679('0x13')](_0x15056a);return _0x357269[_0x9679('0x19')](_0x9679('0x1a'),_0x285098+'-'+_0x371b46+'/'+_0x202183)[_0x9679('0x1b')](_0x1adac8);}return null;};}function patchUpdates(_0x1d6927){return function(_0x1e1d05){try{jsonpatch[_0x9679('0x1c')](_0x1e1d05,_0x1d6927,!![]);}catch(_0x4c7d00){return BPromise['reject'](_0x4c7d00);}return _0x1e1d05[_0x9679('0x1d')]();};}function saveUpdates(_0x111fb3,_0x569a56){return function(_0x1d9176){if(_0x1d9176){return _0x1d9176[_0x9679('0x1e')](_0x111fb3)[_0x9679('0x1f')](function(_0x3cb96d){return _0x3cb96d;});}return null;};}function removeEntity(_0x5049f9,_0x1e3dc1){return function(_0x26be85){if(_0x26be85){return _0x26be85['destroy']()[_0x9679('0x1f')](function(){_0x5049f9['status'](0xcc)[_0x9679('0x14')]();});}};}function handleEntityNotFound(_0x4a9427,_0xba0473){return function(_0x248f72){if(!_0x248f72){_0x4a9427[_0x9679('0x20')](0x194);}return _0x248f72;};}function handleError(_0x3be629,_0x2b19fa){_0x2b19fa=_0x2b19fa||0x1f4;return function(_0x2b427d){logger[_0x9679('0x21')](_0x2b427d[_0x9679('0x22')]);if(_0x2b427d[_0x9679('0x23')]){delete _0x2b427d[_0x9679('0x23')];}_0x3be629[_0x9679('0x13')](_0x2b19fa)[_0x9679('0x24')](_0x2b427d);};}exports['index']=function(_0x58762e,_0x57831e){var _0x55717c={},_0x2f823e={},_0x1baf91={'count':0x0,'rows':[]};var _0x30899e=_[_0x9679('0x25')](db[_0x9679('0x26')]['rawAttributes'],function(_0xa1b99a){return{'name':_0xa1b99a[_0x9679('0x27')],'type':_0xa1b99a['type'][_0x9679('0x28')]};});_0x2f823e[_0x9679('0x29')]=_['map'](_0x30899e,'name');_0x2f823e[_0x9679('0x2a')]=_[_0x9679('0x2b')](_0x58762e['query']);_0x2f823e[_0x9679('0x2c')]=_[_0x9679('0x2d')](_0x2f823e[_0x9679('0x29')],_0x2f823e['query']);_0x55717c[_0x9679('0x2e')]=_[_0x9679('0x2d')](_0x2f823e['model'],qs[_0x9679('0x2f')](_0x58762e[_0x9679('0x2a')][_0x9679('0x2f')]));_0x55717c[_0x9679('0x2e')]=_0x55717c[_0x9679('0x2e')]['length']?_0x55717c['attributes']:_0x2f823e['model'];if(!_0x58762e[_0x9679('0x2a')][_0x9679('0x30')](_0x9679('0x31'))){_0x55717c[_0x9679('0x16')]=qs[_0x9679('0x16')](_0x58762e[_0x9679('0x2a')]['limit']);_0x55717c[_0x9679('0x18')]=qs[_0x9679('0x18')](_0x58762e['query'][_0x9679('0x18')]);}_0x55717c[_0x9679('0x32')]=qs[_0x9679('0x33')](_0x58762e[_0x9679('0x2a')][_0x9679('0x33')]);_0x55717c[_0x9679('0x34')]=qs[_0x9679('0x2c')](_[_0x9679('0x35')](_0x58762e[_0x9679('0x2a')],_0x2f823e[_0x9679('0x2c')]),_0x30899e);if(_0x58762e[_0x9679('0x2a')][_0x9679('0x36')]){_0x55717c[_0x9679('0x34')]=_[_0x9679('0x37')](_0x55717c[_0x9679('0x34')],{'$or':_[_0x9679('0x25')](_0x30899e,function(_0x31c20c){if(_0x31c20c['type']!==_0x9679('0x38')){var _0xb01b50={};_0xb01b50[_0x31c20c[_0x9679('0x23')]]={'$like':'%'+_0x58762e[_0x9679('0x2a')]['filter']+'%'};return _0xb01b50;}})});}_0x55717c=_[_0x9679('0x37')]({},_0x55717c,_0x58762e['options']);var _0x5db741={'where':_0x55717c[_0x9679('0x34')]};return db[_0x9679('0x26')]['count'](_0x5db741)[_0x9679('0x1f')](function(_0x510edd){_0x1baf91[_0x9679('0x17')]=_0x510edd;if(_0x58762e[_0x9679('0x2a')][_0x9679('0x39')]){_0x55717c[_0x9679('0x3a')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x55717c);})[_0x9679('0x1f')](function(_0x2942fd){_0x1baf91['rows']=_0x2942fd;return _0x1baf91;})['then'](respondWithFilteredResult(_0x57831e,_0x55717c))[_0x9679('0x3b')](handleError(_0x57831e,null));};exports[_0x9679('0x3c')]=function(_0x33412c,_0x316b38){var _0x16a453={'raw':!![],'where':{'id':_0x33412c[_0x9679('0x3d')]['id']}},_0x411cb2={};_0x411cb2[_0x9679('0x29')]=_[_0x9679('0x2b')](db[_0x9679('0x26')]['rawAttributes']);_0x411cb2[_0x9679('0x2a')]=_['keys'](_0x33412c[_0x9679('0x2a')]);_0x411cb2['filters']=_[_0x9679('0x2d')](_0x411cb2[_0x9679('0x29')],_0x411cb2[_0x9679('0x2a')]);_0x16a453[_0x9679('0x2e')]=_[_0x9679('0x2d')](_0x411cb2[_0x9679('0x29')],qs[_0x9679('0x2f')](_0x33412c[_0x9679('0x2a')]['fields']));_0x16a453[_0x9679('0x2e')]=_0x16a453['attributes'][_0x9679('0x3e')]?_0x16a453['attributes']:_0x411cb2[_0x9679('0x29')];if(_0x33412c[_0x9679('0x2a')][_0x9679('0x39')]){_0x16a453[_0x9679('0x3a')]=[{'all':!![]}];}_0x16a453=_['merge']({},_0x16a453,_0x33412c[_0x9679('0x3f')]);return db[_0x9679('0x26')]['find'](_0x16a453)[_0x9679('0x1f')](handleEntityNotFound(_0x316b38,null))[_0x9679('0x1f')](respondWithResult(_0x316b38,null))[_0x9679('0x3b')](handleError(_0x316b38,null));};exports['create']=function(_0x353b5a,_0x4cfb90){return db[_0x9679('0x26')][_0x9679('0x40')](_0x353b5a[_0x9679('0x41')],{})['then'](respondWithResult(_0x4cfb90,0xc9))[_0x9679('0x3b')](handleError(_0x4cfb90,null));};exports[_0x9679('0x1e')]=function(_0x19787a,_0x2539bb){if(_0x19787a[_0x9679('0x41')]['id']){delete _0x19787a['body']['id'];}return db['ZohoField'][_0x9679('0x42')]({'where':{'id':_0x19787a['params']['id']}})['then'](handleEntityNotFound(_0x2539bb,null))[_0x9679('0x1f')](saveUpdates(_0x19787a[_0x9679('0x41')],null))[_0x9679('0x1f')](respondWithResult(_0x2539bb,null))[_0x9679('0x3b')](handleError(_0x2539bb,null));};exports[_0x9679('0x43')]=function(_0xd4ebc0,_0x2d6eef){return db[_0x9679('0x26')][_0x9679('0x42')]({'where':{'id':_0xd4ebc0[_0x9679('0x3d')]['id']}})[_0x9679('0x1f')](handleEntityNotFound(_0x2d6eef,null))[_0x9679('0x1f')](removeEntity(_0x2d6eef,null))[_0x9679('0x3b')](handleError(_0x2d6eef,null));}; \ No newline at end of file +var _0x1a54=['json','offset','undefined','count','limit','set','Content-Range','reject','save','update','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','ZohoField','then','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x1a54,0x1d6));var _0x41a5=function(_0x28dd23,_0xd92e21){_0x28dd23=_0x28dd23-0x0;var _0x5c9817=_0x1a54[_0x28dd23];return _0x5c9817;};'use strict';var emlformat=require(_0x41a5('0x0'));var rimraf=require(_0x41a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41a5('0x2'));var rp=require('request-promise');var moment=require(_0x41a5('0x3'));var BPromise=require(_0x41a5('0x4'));var Mustache=require('mustache');var util=require(_0x41a5('0x5'));var path=require(_0x41a5('0x6'));var sox=require(_0x41a5('0x7'));var csv=require(_0x41a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41a5('0x9'));var _=require(_0x41a5('0xa'));var squel=require(_0x41a5('0xb'));var crypto=require(_0x41a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x41a5('0xd'));var toCsv=require(_0x41a5('0x8'));var querystring=require(_0x41a5('0xe'));var Papa=require(_0x41a5('0xf'));var Redis=require(_0x41a5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x41a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x41a5('0x12'))(_0x41a5('0x13'));var utils=require(_0x41a5('0x14'));var config=require(_0x41a5('0x15'));var licenseUtil=require(_0x41a5('0x16'));var db=require(_0x41a5('0x17'))['db'];function respondWithStatusCode(_0x200716,_0x178032){_0x178032=_0x178032||0xcc;return function(_0x32df7b){if(_0x32df7b){return _0x200716[_0x41a5('0x18')](_0x178032);}return _0x200716[_0x41a5('0x19')](_0x178032)[_0x41a5('0x1a')]();};}function respondWithResult(_0xd3e709,_0xb27f16){_0xb27f16=_0xb27f16||0xc8;return function(_0x32e2be){if(_0x32e2be){return _0xd3e709[_0x41a5('0x19')](_0xb27f16)[_0x41a5('0x1b')](_0x32e2be);}};}function respondWithFilteredResult(_0x421528,_0x17ce41){return function(_0x279472){if(_0x279472){var _0x3cdb1a=typeof _0x17ce41[_0x41a5('0x1c')]==='undefined'&&typeof _0x17ce41['limit']===_0x41a5('0x1d');var _0x133148=_0x279472[_0x41a5('0x1e')];var _0x468139=_0x3cdb1a?0x0:_0x17ce41['offset'];var _0x175a79=_0x3cdb1a?_0x279472[_0x41a5('0x1e')]:_0x17ce41[_0x41a5('0x1c')]+_0x17ce41[_0x41a5('0x1f')];var _0x17c44b;if(_0x175a79>=_0x133148){_0x175a79=_0x133148;_0x17c44b=0xc8;}else{_0x17c44b=0xce;}_0x421528[_0x41a5('0x19')](_0x17c44b);return _0x421528[_0x41a5('0x20')](_0x41a5('0x21'),_0x468139+'-'+_0x175a79+'/'+_0x133148)[_0x41a5('0x1b')](_0x279472);}return null;};}function patchUpdates(_0x459d6c){return function(_0x5849b9){try{jsonpatch['apply'](_0x5849b9,_0x459d6c,!![]);}catch(_0x290cbf){return BPromise[_0x41a5('0x22')](_0x290cbf);}return _0x5849b9[_0x41a5('0x23')]();};}function saveUpdates(_0x4dc31,_0x32fa62){return function(_0x15eb82){if(_0x15eb82){return _0x15eb82[_0x41a5('0x24')](_0x4dc31)['then'](function(_0x94506f){return _0x94506f;});}return null;};}function removeEntity(_0x56e301,_0x57bbf5){return function(_0x1cade7){if(_0x1cade7){return _0x1cade7['destroy']()['then'](function(){_0x56e301[_0x41a5('0x19')](0xcc)[_0x41a5('0x1a')]();});}};}function handleEntityNotFound(_0x19ddd5,_0xaa1db0){return function(_0x80172d){if(!_0x80172d){_0x19ddd5[_0x41a5('0x18')](0x194);}return _0x80172d;};}function handleError(_0x2c8667,_0x56b6ce){_0x56b6ce=_0x56b6ce||0x1f4;return function(_0x4852a1){logger['error'](_0x4852a1['stack']);if(_0x4852a1[_0x41a5('0x25')]){delete _0x4852a1[_0x41a5('0x25')];}_0x2c8667['status'](_0x56b6ce)['send'](_0x4852a1);};}exports[_0x41a5('0x26')]=function(_0x5cb33a,_0x5568a2){var _0x128d1e={},_0x1c5e5e={},_0x38c592={'count':0x0,'rows':[]};var _0x308005=_[_0x41a5('0x27')](db['ZohoField'][_0x41a5('0x28')],function(_0x159c49){return{'name':_0x159c49[_0x41a5('0x29')],'type':_0x159c49[_0x41a5('0x2a')][_0x41a5('0x2b')]};});_0x1c5e5e[_0x41a5('0x2c')]=_[_0x41a5('0x27')](_0x308005,_0x41a5('0x25'));_0x1c5e5e[_0x41a5('0x2d')]=_['keys'](_0x5cb33a[_0x41a5('0x2d')]);_0x1c5e5e[_0x41a5('0x2e')]=_[_0x41a5('0x2f')](_0x1c5e5e['model'],_0x1c5e5e[_0x41a5('0x2d')]);_0x128d1e[_0x41a5('0x30')]=_['intersection'](_0x1c5e5e[_0x41a5('0x2c')],qs['fields'](_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x31')]));_0x128d1e[_0x41a5('0x30')]=_0x128d1e[_0x41a5('0x30')][_0x41a5('0x32')]?_0x128d1e[_0x41a5('0x30')]:_0x1c5e5e[_0x41a5('0x2c')];if(!_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x33')](_0x41a5('0x34'))){_0x128d1e[_0x41a5('0x1f')]=qs[_0x41a5('0x1f')](_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x1f')]);_0x128d1e['offset']=qs[_0x41a5('0x1c')](_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x1c')]);}_0x128d1e[_0x41a5('0x35')]=qs[_0x41a5('0x36')](_0x5cb33a['query']['sort']);_0x128d1e['where']=qs[_0x41a5('0x2e')](_['pick'](_0x5cb33a[_0x41a5('0x2d')],_0x1c5e5e[_0x41a5('0x2e')]),_0x308005);if(_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x37')]){_0x128d1e[_0x41a5('0x38')]=_[_0x41a5('0x39')](_0x128d1e[_0x41a5('0x38')],{'$or':_[_0x41a5('0x27')](_0x308005,function(_0x6280bf){if(_0x6280bf[_0x41a5('0x2a')]!=='VIRTUAL'){var _0x4cbe09={};_0x4cbe09[_0x6280bf[_0x41a5('0x25')]]={'$like':'%'+_0x5cb33a[_0x41a5('0x2d')]['filter']+'%'};return _0x4cbe09;}})});}_0x128d1e=_[_0x41a5('0x39')]({},_0x128d1e,_0x5cb33a['options']);var _0x296fd7={'where':_0x128d1e[_0x41a5('0x38')]};return db[_0x41a5('0x3a')]['count'](_0x296fd7)[_0x41a5('0x3b')](function(_0x51d4cc){_0x38c592[_0x41a5('0x1e')]=_0x51d4cc;if(_0x5cb33a['query']['includeAll']){_0x128d1e['include']=[{'all':!![]}];}return db['ZohoField'][_0x41a5('0x3c')](_0x128d1e);})['then'](function(_0x57e5c3){_0x38c592[_0x41a5('0x3d')]=_0x57e5c3;return _0x38c592;})[_0x41a5('0x3b')](respondWithFilteredResult(_0x5568a2,_0x128d1e))[_0x41a5('0x3e')](handleError(_0x5568a2,null));};exports[_0x41a5('0x3f')]=function(_0x1c6381,_0x1e8229){var _0x3a9030={'raw':!![],'where':{'id':_0x1c6381[_0x41a5('0x40')]['id']}},_0x25b5c0={};_0x25b5c0[_0x41a5('0x2c')]=_[_0x41a5('0x41')](db['ZohoField']['rawAttributes']);_0x25b5c0['query']=_[_0x41a5('0x41')](_0x1c6381[_0x41a5('0x2d')]);_0x25b5c0[_0x41a5('0x2e')]=_[_0x41a5('0x2f')](_0x25b5c0[_0x41a5('0x2c')],_0x25b5c0[_0x41a5('0x2d')]);_0x3a9030[_0x41a5('0x30')]=_['intersection'](_0x25b5c0['model'],qs[_0x41a5('0x31')](_0x1c6381[_0x41a5('0x2d')][_0x41a5('0x31')]));_0x3a9030[_0x41a5('0x30')]=_0x3a9030[_0x41a5('0x30')][_0x41a5('0x32')]?_0x3a9030[_0x41a5('0x30')]:_0x25b5c0[_0x41a5('0x2c')];if(_0x1c6381[_0x41a5('0x2d')]['includeAll']){_0x3a9030[_0x41a5('0x42')]=[{'all':!![]}];}_0x3a9030=_['merge']({},_0x3a9030,_0x1c6381['options']);return db[_0x41a5('0x3a')][_0x41a5('0x43')](_0x3a9030)['then'](handleEntityNotFound(_0x1e8229,null))[_0x41a5('0x3b')](respondWithResult(_0x1e8229,null))[_0x41a5('0x3e')](handleError(_0x1e8229,null));};exports[_0x41a5('0x44')]=function(_0x53098f,_0x49d8fb){return db[_0x41a5('0x3a')][_0x41a5('0x44')](_0x53098f[_0x41a5('0x45')],{})[_0x41a5('0x3b')](respondWithResult(_0x49d8fb,0xc9))[_0x41a5('0x3e')](handleError(_0x49d8fb,null));};exports['update']=function(_0xe5ad8d,_0x4b9d94){if(_0xe5ad8d[_0x41a5('0x45')]['id']){delete _0xe5ad8d[_0x41a5('0x45')]['id'];}return db[_0x41a5('0x3a')][_0x41a5('0x43')]({'where':{'id':_0xe5ad8d['params']['id']}})[_0x41a5('0x3b')](handleEntityNotFound(_0x4b9d94,null))['then'](saveUpdates(_0xe5ad8d['body'],null))['then'](respondWithResult(_0x4b9d94,null))[_0x41a5('0x3e')](handleError(_0x4b9d94,null));};exports[_0x41a5('0x46')]=function(_0x3602cd,_0x1ff53b){return db[_0x41a5('0x3a')]['find']({'where':{'id':_0x3602cd[_0x41a5('0x40')]['id']}})[_0x41a5('0x3b')](handleEntityNotFound(_0x1ff53b,null))[_0x41a5('0x3b')](removeEntity(_0x1ff53b,null))[_0x41a5('0x3e')](handleError(_0x1ff53b,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d03bdfd..6d2b46d 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 _0x82c4=['moment','bluebird','request-promise','rimraf','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x4f656f,_0x4721cd){var _0x4aa9f0=function(_0x1e974f){while(--_0x1e974f){_0x4f656f['push'](_0x4f656f['shift']());}};_0x4aa9f0(++_0x4721cd);}(_0x82c4,0x1ca));var _0x482c=function(_0x4ffbb0,_0x5b28ea){_0x4ffbb0=_0x4ffbb0-0x0;var _0xd29dd8=_0x82c4[_0x4ffbb0];return _0xd29dd8;};'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'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0424=['define','ZohoField','int_zoho_fields','FieldId','../../config/logger','api','moment','bluebird','path','./intZohoField.attributes','exports'];(function(_0x380f1f,_0x6f489b){var _0x4c53c6=function(_0x1d996d){while(--_0x1d996d){_0x380f1f['push'](_0x380f1f['shift']());}};_0x4c53c6(++_0x6f489b);}(_0x0424,0x159));var _0x4042=function(_0x1bda09,_0x1d8be5){_0x1bda09=_0x1bda09-0x0;var _0x17be2d=_0x0424[_0x1bda09];return _0x17be2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x4042('0xa')],'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 a500b0e..f0b1c17 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 _0x05ac=['debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x459da2,_0x3f93e6){var _0x7f0e46=function(_0x5755cc){while(--_0x5755cc){_0x459da2['push'](_0x459da2['shift']());}};_0x7f0e46(++_0x3f93e6);}(_0x05ac,0x1a5));var _0xc05a=function(_0x41f174,_0x5f4123){_0x41f174=_0x41f174-0x0;var _0x23803f=_0x05ac[_0x41f174];return _0x23803f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc05a('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc05a('0x1'))(_0xc05a('0x2'));var config=require(_0xc05a('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xc05a('0x4')][_0xc05a('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x363ca5,_0xf6223b,_0x5ec052){return new BPromise(function(_0x5c36a0,_0x41e4a4){return client[_0xc05a('0x6')](_0x363ca5,_0x5ec052)[_0xc05a('0x7')](function(_0x2a5860){logger[_0xc05a('0x8')](_0xc05a('0x9'),_0xf6223b,_0xc05a('0xa'));logger[_0xc05a('0xb')](_0xc05a('0xc'),_0xf6223b,'request\x20sent',JSON[_0xc05a('0xd')](_0x2a5860));if(_0x2a5860[_0xc05a('0xe')]){if(_0x2a5860[_0xc05a('0xe')][_0xc05a('0xf')]===0x1f4){logger[_0xc05a('0xe')](_0xc05a('0x9'),_0xf6223b,_0x2a5860['error'][_0xc05a('0x10')]);return _0x41e4a4(_0x2a5860[_0xc05a('0xe')][_0xc05a('0x10')]);}logger[_0xc05a('0xe')](_0xc05a('0x9'),_0xf6223b,_0x2a5860[_0xc05a('0xe')][_0xc05a('0x10')]);return _0x5c36a0(_0x2a5860[_0xc05a('0xe')]['message']);}else{logger['info'](_0xc05a('0x9'),_0xf6223b,_0xc05a('0xa'));_0x5c36a0(_0x2a5860['result'][_0xc05a('0x10')]);}})[_0xc05a('0x11')](function(_0x15e1fc){logger['error'](_0xc05a('0x9'),_0xf6223b,_0x15e1fc);_0x41e4a4(_0x15e1fc);});});} \ No newline at end of file +var _0xb0c9=['http','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','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4474c2,_0x59cf02){var _0x435fbb=function(_0x3c86eb){while(--_0x3c86eb){_0x4474c2['push'](_0x4474c2['shift']());}};_0x435fbb(++_0x59cf02);}(_0xb0c9,0x1d5));var _0x9b0c=function(_0x5011f5,_0x92181b){_0x5011f5=_0x5011f5-0x0;var _0x2b0e3f=_0xb0c9[_0x5011f5];return _0x2b0e3f;};'use strict';var _=require(_0x9b0c('0x0'));var util=require(_0x9b0c('0x1'));var moment=require(_0x9b0c('0x2'));var BPromise=require(_0x9b0c('0x3'));var rs=require(_0x9b0c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b0c('0x5'))['db'];var utils=require(_0x9b0c('0x6'));var logger=require('../../config/logger')(_0x9b0c('0x7'));var config=require(_0x9b0c('0x8'));var jayson=require(_0x9b0c('0x9'));var client=jayson[_0x9b0c('0xa')][_0x9b0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c8d9c,_0x149ade,_0x1d67ce){return new BPromise(function(_0x4fdedc,_0x5a8ff2){return client['request'](_0x5c8d9c,_0x1d67ce)[_0x9b0c('0xc')](function(_0x4fb160){logger[_0x9b0c('0xd')](_0x9b0c('0xe'),_0x149ade,_0x9b0c('0xf'));logger[_0x9b0c('0x10')](_0x9b0c('0x11'),_0x149ade,'request\x20sent',JSON[_0x9b0c('0x12')](_0x4fb160));if(_0x4fb160[_0x9b0c('0x13')]){if(_0x4fb160[_0x9b0c('0x13')][_0x9b0c('0x14')]===0x1f4){logger[_0x9b0c('0x13')](_0x9b0c('0xe'),_0x149ade,_0x4fb160[_0x9b0c('0x13')][_0x9b0c('0x15')]);return _0x5a8ff2(_0x4fb160['error'][_0x9b0c('0x15')]);}logger[_0x9b0c('0x13')](_0x9b0c('0xe'),_0x149ade,_0x4fb160[_0x9b0c('0x13')]['message']);return _0x4fdedc(_0x4fb160['error'][_0x9b0c('0x15')]);}else{logger[_0x9b0c('0xd')]('ZohoField,\x20%s,\x20%s',_0x149ade,_0x9b0c('0xf'));_0x4fdedc(_0x4fb160[_0x9b0c('0x16')][_0x9b0c('0x15')]);}})[_0x9b0c('0x17')](function(_0x39c60c){logger[_0x9b0c('0x13')]('ZohoField,\x20%s,\x20%s',_0x149ade,_0x39c60c);_0x5a8ff2(_0x39c60c);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index ec41212..624da05 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(_0x15d66d,_0x99094c){var _0x3e9020=function(_0x42986b){while(--_0x42986b){_0x15d66d['push'](_0x15d66d['shift']());}};_0x3e9020(++_0x99094c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x3dbfea,_0x32c32b){var _0x2a837b=function(_0x37a5e1){while(--_0x37a5e1){_0x3dbfea['push'](_0x3dbfea['shift']());}};_0x2a837b(++_0x32c32b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index f5f29b9..367cb9a 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 _0x81d5=['INTEGER','BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','app.js'];(function(_0x64a51,_0x1c61b7){var _0x1eba45=function(_0x230cf8){while(--_0x230cf8){_0x64a51['push'](_0x64a51['shift']());}};_0x1eba45(++_0x1c61b7);}(_0x81d5,0x1ab));var _0x581d=function(_0xf2b9b9,_0x468bf4){_0xf2b9b9=_0xf2b9b9-0x0;var _0x13779d=_0x81d5[_0xf2b9b9];return _0x13779d;};'use strict';var Sequelize=require(_0x581d('0x0'));module[_0x581d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x581d('0x2')},'version':{'type':Sequelize[_0x581d('0x3')],'allowNull':![],'unique':_0x581d('0x2')},'main':{'type':Sequelize[_0x581d('0x3')],'defaultValue':_0x581d('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x581d('0x3')]},'size':{'type':Sequelize[_0x581d('0x5')]},'active':{'type':Sequelize[_0x581d('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x581d('0x3')]},'state':{'type':Sequelize[_0x581d('0x3')],'unique':_0x581d('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x581d('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x4ce5=['STRING','unique_name_and_version','app.js','state','sequelize'];(function(_0x2c5885,_0x23f458){var _0x43c2d4=function(_0x5d1110){while(--_0x5d1110){_0x2c5885['push'](_0x2c5885['shift']());}};_0x43c2d4(++_0x23f458);}(_0x4ce5,0x1b2));var _0x54ce=function(_0x4ecfe7,_0x1e2a9b){_0x4ecfe7=_0x4ecfe7-0x0;var _0x5b958b=_0x4ce5[_0x4ecfe7];return _0x5b958b;};'use strict';var Sequelize=require(_0x54ce('0x0'));module['exports']={'name':{'type':Sequelize[_0x54ce('0x1')],'allowNull':![],'unique':_0x54ce('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x54ce('0x1')],'defaultValue':_0x54ce('0x3')},'filename':{'type':Sequelize[_0x54ce('0x1')]},'path':{'type':Sequelize[_0x54ce('0x1')]},'type':{'type':Sequelize[_0x54ce('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x54ce('0x1')]},'logo':{'type':Sequelize[_0x54ce('0x1')]},'state':{'type':Sequelize[_0x54ce('0x1')],'unique':_0x54ce('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x54ce('0x1')]},'remoteUri':{'type':Sequelize[_0x54ce('0x1')]},'link':{'type':Sequelize[_0x54ce('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5910b7d..ba3a3d1 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 _0xfcf0=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','keys','query','filters'];(function(_0x3940e9,_0x867363){var _0x1e5081=function(_0x1a7407){while(--_0x1a7407){_0x3940e9['push'](_0x3940e9['shift']());}};_0x1e5081(++_0x867363);}(_0xfcf0,0x138));var _0x0fcf=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0xfcf0[_0x406e46];return _0x4a3742;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));}; \ No newline at end of file +var _0x71ab=['query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','Integration','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key'];(function(_0x9105f4,_0x3bf6f7){var _0x57a818=function(_0x1c5cf4){while(--_0x1c5cf4){_0x9105f4['push'](_0x9105f4['shift']());}};_0x57a818(++_0x3bf6f7);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['Integration']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['Integration']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['Integration'][_0xb71a('0x47')](_0x1f29b7[_0xb71a('0x48')],{})[_0xb71a('0x24')](respondWithResult(_0x365bed,0xc9))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports['update']=function(_0x48fbde,_0x23b4c0){if(_0x48fbde[_0xb71a('0x48')]['id']){delete _0x48fbde[_0xb71a('0x48')]['id'];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'id':_0x48fbde[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x23b4c0,null))[_0xb71a('0x24')](saveUpdates(_0x48fbde[_0xb71a('0x48')],null))[_0xb71a('0x24')](respondWithResult(_0x23b4c0,null))['catch'](handleError(_0x23b4c0,null));};exports[_0xb71a('0x25')]=function(_0x2ce711,_0x500196){return db[_0xb71a('0x3f')]['find']({'where':{'id':_0x2ce711[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x500196,null))[_0xb71a('0x24')](removeEntity(_0x500196,null))[_0xb71a('0x42')](handleError(_0x500196,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f8dbf8c..a2e3fec 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 _0x6d7b=['path','rimraf','./integration.attributes','exports','define','Integration','lodash','util','../../config/logger','api','request-promise'];(function(_0x57a53b,_0x11494e){var _0x29e81c=function(_0x24c522){while(--_0x24c522){_0x57a53b['push'](_0x57a53b['shift']());}};_0x29e81c(++_0x11494e);}(_0x6d7b,0xc1));var _0xb6d7=function(_0x4b33ff,_0x34193c){_0x4b33ff=_0x4b33ff-0x0;var _0x24c2f7=_0x6d7b[_0x4b33ff];return _0x24c2f7;};'use strict';var _=require(_0xb6d7('0x0'));var util=require(_0xb6d7('0x1'));var logger=require(_0xb6d7('0x2'))(_0xb6d7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb6d7('0x4'));var fs=require('fs');var path=require(_0xb6d7('0x5'));var rimraf=require(_0xb6d7('0x6'));var config=require('../../config/environment');var attributes=require(_0xb6d7('0x7'));module[_0xb6d7('0x8')]=function(_0xc5e9ba,_0x4a75a1){return _0xc5e9ba[_0xb6d7('0x9')](_0xb6d7('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1241=['integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x1241,0x1ef));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1124('0x0'));var util=require('util');var logger=require(_0x1124('0x1'))(_0x1124('0x2'));var moment=require(_0x1124('0x3'));var BPromise=require(_0x1124('0x4'));var rp=require(_0x1124('0x5'));var fs=require('fs');var path=require(_0x1124('0x6'));var rimraf=require(_0x1124('0x7'));var config=require(_0x1124('0x8'));var attributes=require(_0x1124('0x9'));module[_0x1124('0xa')]=function(_0x58edde,_0x2f34fe){return _0x58edde[_0x1124('0xb')]('Integration',attributes,{'tableName':_0x1124('0xc'),'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 737bbe9..bbabddc 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0xf1e5da,_0x3ecd47){var _0x331120=function(_0x30894f){while(--_0x30894f){_0xf1e5da['push'](_0xf1e5da['shift']());}};_0x331120(++_0x3ecd47);}(_0x1a85,0x178));var _0x51a8=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x1a85[_0x2a8c21];return _0x5f3061;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x5f3ea5,_0x16d76d){var _0x3bbc1f=function(_0x2c9be3){while(--_0x2c9be3){_0x5f3ea5['push'](_0x5f3ea5['shift']());}};_0x3bbc1f(++_0x16d76d);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6301868..7802cc6 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 _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2db2da,_0x36aba0){var _0x9d5c25=function(_0x321577){while(--_0x321577){_0x2db2da['push'](_0x2db2da['shift']());}};_0x9d5c25(++_0x36aba0);}(_0xef0f,0x168));var _0xfef0=function(_0x35ef49,_0x39ff7e){_0x35ef49=_0x35ef49-0x0;var _0x33b503=_0xef0f[_0x35ef49];return _0x33b503;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x568039,_0x570f8e){var _0x1595fc=function(_0x50ac8f){while(--_0x50ac8f){_0x568039['push'](_0x568039['shift']());}};_0x1595fc(++_0x570f8e);}(_0xadb5,0xad));var _0x5adb=function(_0x2c8ce2,_0x1f744d){_0x2c8ce2=_0x2c8ce2-0x0;var _0x3a44bc=_0xadb5[_0x2c8ce2];return _0x3a44bc;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./integrationReport.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 56f0d8e..0297f9c 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 _0x67be=['BOOLEAN','TEXT','exports','STRING','INTEGER','DATE'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x67be,0x80));var _0xe67b=function(_0x9b790,_0x14e089){_0x9b790=_0x9b790-0x0;var _0x1c6789=_0x67be[_0x9b790];return _0x1c6789;};'use strict';var Sequelize=require('sequelize');module[_0xe67b('0x0')]={'integration':{'type':Sequelize[_0xe67b('0x1')]},'eventChannel':{'type':Sequelize[_0xe67b('0x1')]},'exitStatus':{'type':Sequelize[_0xe67b('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xe67b('0x2')]},'contacts':{'type':Sequelize[_0xe67b('0x1')]},'uniqueid':{'type':Sequelize[_0xe67b('0x1')]},'calleridnum':{'type':Sequelize[_0xe67b('0x1')]},'calleridname':{'type':Sequelize[_0xe67b('0x1')]},'queue':{'type':Sequelize[_0xe67b('0x1')]},'interface':{'type':Sequelize[_0xe67b('0x1')]},'membername':{'type':Sequelize[_0xe67b('0x1')]},'agentcalledAt':{'type':Sequelize[_0xe67b('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe67b('0x3')]},'holdtime':{'type':Sequelize[_0xe67b('0x2')]},'agentcomplete':{'type':Sequelize[_0xe67b('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe67b('0x3')]},'talktime':{'type':Sequelize[_0xe67b('0x2')]},'agentacw':{'type':Sequelize[_0xe67b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe67b('0x2')]},'reason':{'type':Sequelize[_0xe67b('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xe67b('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe67b('0x3')]},'agentdump':{'type':Sequelize[_0xe67b('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe67b('0x3')]},'lastevent':{'type':Sequelize[_0xe67b('0x1')]},'channel':{'type':Sequelize[_0xe67b('0x1')]},'channelstate':{'type':Sequelize[_0xe67b('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xe67b('0x1')]},'connectedlinename':{'type':Sequelize[_0xe67b('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe67b('0x1')]},'context':{'type':Sequelize[_0xe67b('0x1')]},'exten':{'type':Sequelize[_0xe67b('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xe67b('0x1')]},'destchannelstate':{'type':Sequelize[_0xe67b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe67b('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe67b('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe67b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe67b('0x1')]},'destlanguage':{'type':Sequelize[_0xe67b('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xe67b('0x1')]},'messageId':{'type':Sequelize[_0xe67b('0x1')]},'inReplyTo':{'type':Sequelize[_0xe67b('0x1')]},'subject':{'type':Sequelize[_0xe67b('0x1')]},'from':{'type':Sequelize[_0xe67b('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xe67b('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xe67b('0x5')]},'text':{'type':Sequelize[_0xe67b('0x5')]},'status':{'type':Sequelize['ENUM']('SENT','SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize[_0xe67b('0x1')]},'app':{'type':Sequelize[_0xe67b('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xe67b('0x2')]}}; \ No newline at end of file +var _0x8c99=['BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x556e6f,_0x4dd56a){var _0x252902=function(_0x41817f){while(--_0x41817f){_0x556e6f['push'](_0x556e6f['shift']());}};_0x252902(++_0x4dd56a);}(_0x8c99,0x1a8));var _0x98c9=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x8c99[_0x7feb90];return _0x3c5b33;};'use strict';var Sequelize=require(_0x98c9('0x0'));module[_0x98c9('0x1')]={'integration':{'type':Sequelize[_0x98c9('0x2')]},'eventChannel':{'type':Sequelize[_0x98c9('0x2')]},'exitStatus':{'type':Sequelize[_0x98c9('0x2')]},'ticketId':{'type':Sequelize[_0x98c9('0x2')]},'integrationId':{'type':Sequelize[_0x98c9('0x3')]},'contacts':{'type':Sequelize[_0x98c9('0x2')]},'uniqueid':{'type':Sequelize[_0x98c9('0x2')]},'calleridnum':{'type':Sequelize[_0x98c9('0x2')]},'calleridname':{'type':Sequelize[_0x98c9('0x2')]},'queue':{'type':Sequelize[_0x98c9('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x98c9('0x2')]},'agentcalledAt':{'type':Sequelize[_0x98c9('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x98c9('0x4')]},'talktime':{'type':Sequelize[_0x98c9('0x3')]},'agentacw':{'type':Sequelize[_0x98c9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x98c9('0x3')]},'reason':{'type':Sequelize[_0x98c9('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x98c9('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x98c9('0x4')]},'agentdump':{'type':Sequelize[_0x98c9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x98c9('0x4')]},'lastevent':{'type':Sequelize[_0x98c9('0x2')]},'channel':{'type':Sequelize[_0x98c9('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x98c9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x98c9('0x2')]},'connectedlinename':{'type':Sequelize[_0x98c9('0x2')]},'language':{'type':Sequelize[_0x98c9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x98c9('0x2')]},'exten':{'type':Sequelize[_0x98c9('0x2')]},'priority':{'type':Sequelize[_0x98c9('0x2')]},'destchannel':{'type':Sequelize[_0x98c9('0x2')]},'destchannelstate':{'type':Sequelize[_0x98c9('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x98c9('0x2')]},'destcalleridname':{'type':Sequelize[_0x98c9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x98c9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x98c9('0x2')]},'destlanguage':{'type':Sequelize[_0x98c9('0x2')]},'destaccountcode':{'type':Sequelize[_0x98c9('0x2')]},'destcontext':{'type':Sequelize[_0x98c9('0x2')]},'destexten':{'type':Sequelize[_0x98c9('0x2')]},'destpriority':{'type':Sequelize[_0x98c9('0x2')]},'destuniqueid':{'type':Sequelize[_0x98c9('0x2')]},'messageId':{'type':Sequelize[_0x98c9('0x2')]},'inReplyTo':{'type':Sequelize[_0x98c9('0x2')]},'subject':{'type':Sequelize[_0x98c9('0x2')]},'from':{'type':Sequelize[_0x98c9('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x98c9('0x2')]},'attachment':{'type':Sequelize[_0x98c9('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x98c9('0x6')]},'status':{'type':Sequelize['ENUM'](_0x98c9('0x7'),_0x98c9('0x8'),_0x98c9('0x9'),_0x98c9('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x98c9('0x2')]},'appdata':{'type':Sequelize[_0x98c9('0x2')]},'projectId':{'type':Sequelize[_0x98c9('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f4c5241..3f51a0a 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 _0x3f89=['describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','key','keys','query','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','IntegrationReport','findAll','rows','catch','params','intersection','fields','find','create','body'];(function(_0xa5e746,_0x36767d){var _0x207ea6=function(_0x485cf3){while(--_0x485cf3){_0xa5e746['push'](_0xa5e746['shift']());}};_0x207ea6(++_0x36767d);}(_0x3f89,0x97));var _0x93f8=function(_0x165f34,_0xd8983b){_0x165f34=_0x165f34-0x0;var _0x1fc514=_0x3f89[_0x165f34];return _0x1fc514;};'use strict';var emlformat=require(_0x93f8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x93f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93f8('0x2'));var moment=require(_0x93f8('0x3'));var BPromise=require(_0x93f8('0x4'));var Mustache=require(_0x93f8('0x5'));var util=require(_0x93f8('0x6'));var path=require(_0x93f8('0x7'));var sox=require(_0x93f8('0x8'));var csv=require('to-csv');var ejs=require(_0x93f8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93f8('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x93f8('0xb'));var deskjs=require(_0x93f8('0xc'));var toCsv=require(_0x93f8('0xd'));var querystring=require(_0x93f8('0xe'));var Papa=require(_0x93f8('0xf'));var Redis=require(_0x93f8('0x10'));var authService=require(_0x93f8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x93f8('0x12'));var hardwareService=require(_0x93f8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x93f8('0x14'));var config=require(_0x93f8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x93f8('0x16'))['db'];function respondWithStatusCode(_0x41d16e,_0x2d42c6){_0x2d42c6=_0x2d42c6||0xcc;return function(_0x143540){if(_0x143540){return _0x41d16e[_0x93f8('0x17')](_0x2d42c6);}return _0x41d16e[_0x93f8('0x18')](_0x2d42c6)[_0x93f8('0x19')]();};}function respondWithResult(_0x20f793,_0x5ab4b5){_0x5ab4b5=_0x5ab4b5||0xc8;return function(_0x5c078c){if(_0x5c078c){return _0x20f793[_0x93f8('0x18')](_0x5ab4b5)[_0x93f8('0x1a')](_0x5c078c);}};}function respondWithFilteredResult(_0x1e250e,_0x44a2e6){return function(_0x4df79d){if(_0x4df79d){var _0x4de717=typeof _0x44a2e6[_0x93f8('0x1b')]===_0x93f8('0x1c')&&typeof _0x44a2e6[_0x93f8('0x1d')]==='undefined';var _0x3542df=_0x4df79d[_0x93f8('0x1e')];var _0x82097d=_0x4de717?0x0:_0x44a2e6['offset'];var _0xc83424=_0x4de717?_0x4df79d['count']:_0x44a2e6[_0x93f8('0x1b')]+_0x44a2e6[_0x93f8('0x1d')];var _0x246b58;if(_0xc83424>=_0x3542df){_0xc83424=_0x3542df;_0x246b58=0xc8;}else{_0x246b58=0xce;}_0x1e250e[_0x93f8('0x18')](_0x246b58);return _0x1e250e[_0x93f8('0x1f')](_0x93f8('0x20'),_0x82097d+'-'+_0xc83424+'/'+_0x3542df)[_0x93f8('0x1a')](_0x4df79d);}return null;};}function patchUpdates(_0x5aa4c1){return function(_0x211fed){try{jsonpatch[_0x93f8('0x21')](_0x211fed,_0x5aa4c1,!![]);}catch(_0x3cb10a){return BPromise[_0x93f8('0x22')](_0x3cb10a);}return _0x211fed[_0x93f8('0x23')]();};}function saveUpdates(_0x3ed6a3,_0x5be926){return function(_0x335728){if(_0x335728){return _0x335728[_0x93f8('0x24')](_0x3ed6a3)[_0x93f8('0x25')](function(_0x1d1e2e){return _0x1d1e2e;});}return null;};}function removeEntity(_0x4c888e,_0x20ed68){return function(_0x433a23){if(_0x433a23){return _0x433a23[_0x93f8('0x26')]()[_0x93f8('0x25')](function(){_0x4c888e[_0x93f8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6eb7fe,_0x12ecbd){return function(_0x925479){if(!_0x925479){_0x6eb7fe[_0x93f8('0x17')](0x194);}return _0x925479;};}function handleError(_0x48115e,_0x1f7417){_0x1f7417=_0x1f7417||0x1f4;return function(_0x4503db){logger[_0x93f8('0x27')](_0x4503db['stack']);if(_0x4503db[_0x93f8('0x28')]){delete _0x4503db[_0x93f8('0x28')];}_0x48115e[_0x93f8('0x18')](_0x1f7417)[_0x93f8('0x29')](_0x4503db);};}exports['index']=function(_0x5b654e,_0x38633c){var _0x134e97={},_0x4b3766={},_0x5f48ef={'count':0x0,'rows':[]};var _0x594339=_[_0x93f8('0x2a')](db['IntegrationReport'][_0x93f8('0x2b')],function(_0x4335cc){return{'name':_0x4335cc[_0x93f8('0x2c')],'type':_0x4335cc['type'][_0x93f8('0x2d')]};});_0x4b3766['model']=_[_0x93f8('0x2a')](_0x594339,_0x93f8('0x28'));_0x4b3766['query']=_[_0x93f8('0x2e')](_0x5b654e[_0x93f8('0x2f')]);_0x4b3766[_0x93f8('0x30')]=_['intersection'](_0x4b3766[_0x93f8('0x31')],_0x4b3766['query']);_0x134e97[_0x93f8('0x32')]=_['intersection'](_0x4b3766[_0x93f8('0x31')],qs['fields'](_0x5b654e[_0x93f8('0x2f')]['fields']));_0x134e97[_0x93f8('0x32')]=_0x134e97[_0x93f8('0x32')][_0x93f8('0x33')]?_0x134e97[_0x93f8('0x32')]:_0x4b3766[_0x93f8('0x31')];if(!_0x5b654e['query'][_0x93f8('0x34')](_0x93f8('0x35'))){_0x134e97[_0x93f8('0x1d')]=qs[_0x93f8('0x1d')](_0x5b654e[_0x93f8('0x2f')][_0x93f8('0x1d')]);_0x134e97[_0x93f8('0x1b')]=qs[_0x93f8('0x1b')](_0x5b654e[_0x93f8('0x2f')][_0x93f8('0x1b')]);}_0x134e97[_0x93f8('0x36')]=qs[_0x93f8('0x37')](_0x5b654e[_0x93f8('0x2f')][_0x93f8('0x37')]);_0x134e97[_0x93f8('0x38')]=qs['filters'](_[_0x93f8('0x39')](_0x5b654e[_0x93f8('0x2f')],_0x4b3766[_0x93f8('0x30')]),_0x594339);if(_0x5b654e[_0x93f8('0x2f')][_0x93f8('0x3a')]){_0x134e97[_0x93f8('0x38')]=_[_0x93f8('0x3b')](_0x134e97['where'],{'$or':_[_0x93f8('0x2a')](_0x594339,function(_0xf98b95){if(_0xf98b95[_0x93f8('0x3c')]!==_0x93f8('0x3d')){var _0x4df35c={};_0x4df35c[_0xf98b95[_0x93f8('0x28')]]={'$like':'%'+_0x5b654e[_0x93f8('0x2f')][_0x93f8('0x3a')]+'%'};return _0x4df35c;}})});}_0x134e97=_[_0x93f8('0x3b')]({},_0x134e97,_0x5b654e['options']);var _0xc603b3={'where':_0x134e97[_0x93f8('0x38')]};return db['IntegrationReport'][_0x93f8('0x1e')](_0xc603b3)[_0x93f8('0x25')](function(_0x5a490b){_0x5f48ef[_0x93f8('0x1e')]=_0x5a490b;if(_0x5b654e['query'][_0x93f8('0x3e')]){_0x134e97[_0x93f8('0x3f')]=[{'all':!![]}];}return db[_0x93f8('0x40')][_0x93f8('0x41')](_0x134e97);})[_0x93f8('0x25')](function(_0x26b66d){_0x5f48ef[_0x93f8('0x42')]=_0x26b66d;return _0x5f48ef;})[_0x93f8('0x25')](respondWithFilteredResult(_0x38633c,_0x134e97))[_0x93f8('0x43')](handleError(_0x38633c,null));};exports['show']=function(_0x15d083,_0x479bad){var _0x27018c={'raw':![],'where':{'id':_0x15d083[_0x93f8('0x44')]['id']}},_0x87ffc4={};_0x87ffc4['model']=_[_0x93f8('0x2e')](db[_0x93f8('0x40')][_0x93f8('0x2b')]);_0x87ffc4['query']=_[_0x93f8('0x2e')](_0x15d083[_0x93f8('0x2f')]);_0x87ffc4[_0x93f8('0x30')]=_[_0x93f8('0x45')](_0x87ffc4[_0x93f8('0x31')],_0x87ffc4[_0x93f8('0x2f')]);_0x27018c[_0x93f8('0x32')]=_[_0x93f8('0x45')](_0x87ffc4[_0x93f8('0x31')],qs[_0x93f8('0x46')](_0x15d083[_0x93f8('0x2f')][_0x93f8('0x46')]));_0x27018c[_0x93f8('0x32')]=_0x27018c[_0x93f8('0x32')][_0x93f8('0x33')]?_0x27018c['attributes']:_0x87ffc4['model'];if(_0x15d083['query'][_0x93f8('0x3e')]){_0x27018c['include']=[{'all':!![]}];}_0x27018c=_[_0x93f8('0x3b')]({},_0x27018c,_0x15d083['options']);return db[_0x93f8('0x40')][_0x93f8('0x47')](_0x27018c)['then'](handleEntityNotFound(_0x479bad,null))[_0x93f8('0x25')](respondWithResult(_0x479bad,null))[_0x93f8('0x43')](handleError(_0x479bad,null));};exports[_0x93f8('0x48')]=function(_0x55fcb4,_0x16d57e){return db[_0x93f8('0x40')][_0x93f8('0x48')](_0x55fcb4[_0x93f8('0x49')],{})['then'](respondWithResult(_0x16d57e,0xc9))['catch'](handleError(_0x16d57e,null));};exports['update']=function(_0x38f083,_0x20bce7){if(_0x38f083['body']['id']){delete _0x38f083[_0x93f8('0x49')]['id'];}return db[_0x93f8('0x40')][_0x93f8('0x47')]({'where':{'id':_0x38f083[_0x93f8('0x44')]['id']}})[_0x93f8('0x25')](handleEntityNotFound(_0x20bce7,null))['then'](saveUpdates(_0x38f083[_0x93f8('0x49')],null))[_0x93f8('0x25')](respondWithResult(_0x20bce7,null))[_0x93f8('0x43')](handleError(_0x20bce7,null));};exports[_0x93f8('0x26')]=function(_0x60d059,_0x169f12){return db[_0x93f8('0x40')]['find']({'where':{'id':_0x60d059['params']['id']}})['then'](handleEntityNotFound(_0x169f12,null))[_0x93f8('0x25')](removeEntity(_0x169f12,null))[_0x93f8('0x43')](handleError(_0x169f12,null));};exports[_0x93f8('0x4a')]=function(_0x487c31,_0x5ef274){return db[_0x93f8('0x40')]['describe']()[_0x93f8('0x25')](respondWithResult(_0x5ef274,null))[_0x93f8('0x43')](handleError(_0x5ef274,null));}; \ No newline at end of file +var _0xaec5=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','fields','create','body','find','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xaec5,0x1b3));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5aec('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5aec('0x1'));var rp=require(_0x5aec('0x2'));var moment=require(_0x5aec('0x3'));var BPromise=require(_0x5aec('0x4'));var Mustache=require(_0x5aec('0x5'));var util=require(_0x5aec('0x6'));var path=require(_0x5aec('0x7'));var sox=require(_0x5aec('0x8'));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(_0x5aec('0x9'));var crypto=require(_0x5aec('0xa'));var jsforce=require(_0x5aec('0xb'));var deskjs=require(_0x5aec('0xc'));var toCsv=require(_0x5aec('0xd'));var querystring=require(_0x5aec('0xe'));var Papa=require(_0x5aec('0xf'));var Redis=require(_0x5aec('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5aec('0x11'));var as=require(_0x5aec('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5aec('0x13'))(_0x5aec('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5aec('0x15'));var db=require(_0x5aec('0x16'))['db'];function respondWithStatusCode(_0x19b7db,_0x1bd510){_0x1bd510=_0x1bd510||0xcc;return function(_0x29985d){if(_0x29985d){return _0x19b7db[_0x5aec('0x17')](_0x1bd510);}return _0x19b7db[_0x5aec('0x18')](_0x1bd510)['end']();};}function respondWithResult(_0x5dc061,_0x765fd5){_0x765fd5=_0x765fd5||0xc8;return function(_0x29a352){if(_0x29a352){return _0x5dc061[_0x5aec('0x18')](_0x765fd5)[_0x5aec('0x19')](_0x29a352);}};}function respondWithFilteredResult(_0x3f72ab,_0x31bac7){return function(_0x18bd30){if(_0x18bd30){var _0x3e2401=typeof _0x31bac7[_0x5aec('0x1a')]===_0x5aec('0x1b')&&typeof _0x31bac7[_0x5aec('0x1c')]===_0x5aec('0x1b');var _0x2cd02f=_0x18bd30[_0x5aec('0x1d')];var _0x201aa1=_0x3e2401?0x0:_0x31bac7['offset'];var _0x2a27e5=_0x3e2401?_0x18bd30['count']:_0x31bac7['offset']+_0x31bac7[_0x5aec('0x1c')];var _0x3632f8;if(_0x2a27e5>=_0x2cd02f){_0x2a27e5=_0x2cd02f;_0x3632f8=0xc8;}else{_0x3632f8=0xce;}_0x3f72ab[_0x5aec('0x18')](_0x3632f8);return _0x3f72ab[_0x5aec('0x1e')](_0x5aec('0x1f'),_0x201aa1+'-'+_0x2a27e5+'/'+_0x2cd02f)[_0x5aec('0x19')](_0x18bd30);}return null;};}function patchUpdates(_0x44283f){return function(_0x4c9939){try{jsonpatch[_0x5aec('0x20')](_0x4c9939,_0x44283f,!![]);}catch(_0x21d3b1){return BPromise[_0x5aec('0x21')](_0x21d3b1);}return _0x4c9939[_0x5aec('0x22')]();};}function saveUpdates(_0x363ae4,_0x15d31a){return function(_0x25e240){if(_0x25e240){return _0x25e240[_0x5aec('0x23')](_0x363ae4)[_0x5aec('0x24')](function(_0x19cc07){return _0x19cc07;});}return null;};}function removeEntity(_0x1f57c7,_0x5c1a8a){return function(_0x4d64b5){if(_0x4d64b5){return _0x4d64b5[_0x5aec('0x25')]()[_0x5aec('0x24')](function(){_0x1f57c7[_0x5aec('0x18')](0xcc)[_0x5aec('0x26')]();});}};}function handleEntityNotFound(_0x2c77d0,_0x46a732){return function(_0x4f1fb8){if(!_0x4f1fb8){_0x2c77d0[_0x5aec('0x17')](0x194);}return _0x4f1fb8;};}function handleError(_0x233685,_0x344986){_0x344986=_0x344986||0x1f4;return function(_0x3500d5){logger[_0x5aec('0x27')](_0x3500d5['stack']);if(_0x3500d5[_0x5aec('0x28')]){delete _0x3500d5[_0x5aec('0x28')];}_0x233685[_0x5aec('0x18')](_0x344986)[_0x5aec('0x29')](_0x3500d5);};}exports[_0x5aec('0x2a')]=function(_0x2be5ca,_0x8829f3){var _0x54ddf6={},_0x447669={},_0x30c00d={'count':0x0,'rows':[]};var _0x1ad552=_[_0x5aec('0x2b')](db[_0x5aec('0x2c')][_0x5aec('0x2d')],function(_0x4731a7){return{'name':_0x4731a7[_0x5aec('0x2e')],'type':_0x4731a7[_0x5aec('0x2f')][_0x5aec('0x30')]};});_0x447669[_0x5aec('0x31')]=_[_0x5aec('0x2b')](_0x1ad552,'name');_0x447669[_0x5aec('0x32')]=_[_0x5aec('0x33')](_0x2be5ca['query']);_0x447669[_0x5aec('0x34')]=_['intersection'](_0x447669['model'],_0x447669[_0x5aec('0x32')]);_0x54ddf6[_0x5aec('0x35')]=_[_0x5aec('0x36')](_0x447669[_0x5aec('0x31')],qs['fields'](_0x2be5ca[_0x5aec('0x32')]['fields']));_0x54ddf6['attributes']=_0x54ddf6[_0x5aec('0x35')][_0x5aec('0x37')]?_0x54ddf6[_0x5aec('0x35')]:_0x447669[_0x5aec('0x31')];if(!_0x2be5ca[_0x5aec('0x32')][_0x5aec('0x38')]('nolimit')){_0x54ddf6[_0x5aec('0x1c')]=qs[_0x5aec('0x1c')](_0x2be5ca[_0x5aec('0x32')]['limit']);_0x54ddf6[_0x5aec('0x1a')]=qs[_0x5aec('0x1a')](_0x2be5ca[_0x5aec('0x32')][_0x5aec('0x1a')]);}_0x54ddf6[_0x5aec('0x39')]=qs[_0x5aec('0x3a')](_0x2be5ca[_0x5aec('0x32')][_0x5aec('0x3a')]);_0x54ddf6[_0x5aec('0x3b')]=qs['filters'](_['pick'](_0x2be5ca['query'],_0x447669[_0x5aec('0x34')]),_0x1ad552);if(_0x2be5ca[_0x5aec('0x32')]['filter']){_0x54ddf6[_0x5aec('0x3b')]=_[_0x5aec('0x3c')](_0x54ddf6[_0x5aec('0x3b')],{'$or':_[_0x5aec('0x2b')](_0x1ad552,function(_0x1acac8){if(_0x1acac8[_0x5aec('0x2f')]!=='VIRTUAL'){var _0x34a483={};_0x34a483[_0x1acac8[_0x5aec('0x28')]]={'$like':'%'+_0x2be5ca['query'][_0x5aec('0x3d')]+'%'};return _0x34a483;}})});}_0x54ddf6=_[_0x5aec('0x3c')]({},_0x54ddf6,_0x2be5ca[_0x5aec('0x3e')]);var _0x3869b6={'where':_0x54ddf6['where']};return db[_0x5aec('0x2c')][_0x5aec('0x1d')](_0x3869b6)[_0x5aec('0x24')](function(_0x110990){_0x30c00d[_0x5aec('0x1d')]=_0x110990;if(_0x2be5ca[_0x5aec('0x32')][_0x5aec('0x3f')]){_0x54ddf6[_0x5aec('0x40')]=[{'all':!![]}];}return db[_0x5aec('0x2c')][_0x5aec('0x41')](_0x54ddf6);})[_0x5aec('0x24')](function(_0x4a1bd0){_0x30c00d[_0x5aec('0x42')]=_0x4a1bd0;return _0x30c00d;})[_0x5aec('0x24')](respondWithFilteredResult(_0x8829f3,_0x54ddf6))[_0x5aec('0x43')](handleError(_0x8829f3,null));};exports['show']=function(_0x467708,_0x3352e1){var _0xba9910={'raw':![],'where':{'id':_0x467708['params']['id']}},_0x34fa20={};_0x34fa20[_0x5aec('0x31')]=_[_0x5aec('0x33')](db[_0x5aec('0x2c')][_0x5aec('0x2d')]);_0x34fa20['query']=_[_0x5aec('0x33')](_0x467708[_0x5aec('0x32')]);_0x34fa20['filters']=_['intersection'](_0x34fa20[_0x5aec('0x31')],_0x34fa20[_0x5aec('0x32')]);_0xba9910[_0x5aec('0x35')]=_[_0x5aec('0x36')](_0x34fa20['model'],qs['fields'](_0x467708['query'][_0x5aec('0x44')]));_0xba9910[_0x5aec('0x35')]=_0xba9910[_0x5aec('0x35')][_0x5aec('0x37')]?_0xba9910[_0x5aec('0x35')]:_0x34fa20[_0x5aec('0x31')];if(_0x467708[_0x5aec('0x32')][_0x5aec('0x3f')]){_0xba9910['include']=[{'all':!![]}];}_0xba9910=_['merge']({},_0xba9910,_0x467708['options']);return db[_0x5aec('0x2c')]['find'](_0xba9910)['then'](handleEntityNotFound(_0x3352e1,null))[_0x5aec('0x24')](respondWithResult(_0x3352e1,null))[_0x5aec('0x43')](handleError(_0x3352e1,null));};exports[_0x5aec('0x45')]=function(_0x56e069,_0x5af35e){return db[_0x5aec('0x2c')]['create'](_0x56e069['body'],{})[_0x5aec('0x24')](respondWithResult(_0x5af35e,0xc9))[_0x5aec('0x43')](handleError(_0x5af35e,null));};exports[_0x5aec('0x23')]=function(_0x1b21f8,_0x2e1cc7){if(_0x1b21f8[_0x5aec('0x46')]['id']){delete _0x1b21f8[_0x5aec('0x46')]['id'];}return db['IntegrationReport'][_0x5aec('0x47')]({'where':{'id':_0x1b21f8[_0x5aec('0x48')]['id']}})[_0x5aec('0x24')](handleEntityNotFound(_0x2e1cc7,null))[_0x5aec('0x24')](saveUpdates(_0x1b21f8[_0x5aec('0x46')],null))[_0x5aec('0x24')](respondWithResult(_0x2e1cc7,null))[_0x5aec('0x43')](handleError(_0x2e1cc7,null));};exports[_0x5aec('0x25')]=function(_0x7c8bab,_0x1272af){return db[_0x5aec('0x2c')]['find']({'where':{'id':_0x7c8bab[_0x5aec('0x48')]['id']}})[_0x5aec('0x24')](handleEntityNotFound(_0x1272af,null))[_0x5aec('0x24')](removeEntity(_0x1272af,null))['catch'](handleError(_0x1272af,null));};exports[_0x5aec('0x49')]=function(_0x356fad,_0x1e07c3){return db['IntegrationReport'][_0x5aec('0x49')]()[_0x5aec('0x24')](respondWithResult(_0x1e07c3,null))[_0x5aec('0x43')](handleError(_0x1e07c3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index a1b42d7..495e28f 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 _0xc02f=['exports','report_integration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes'];(function(_0x1ee1cd,_0x588d14){var _0x4b433c=function(_0x1f8ffa){while(--_0x1f8ffa){_0x1ee1cd['push'](_0x1ee1cd['shift']());}};_0x4b433c(++_0x588d14);}(_0xc02f,0x18e));var _0xfc02=function(_0x41c1e8,_0x453db3){_0x41c1e8=_0x41c1e8-0x0;var _0x1f85e3=_0xc02f[_0x41c1e8];return _0x1f85e3;};'use strict';var _=require(_0xfc02('0x0'));var util=require(_0xfc02('0x1'));var logger=require(_0xfc02('0x2'))('api');var moment=require(_0xfc02('0x3'));var BPromise=require(_0xfc02('0x4'));var rp=require(_0xfc02('0x5'));var fs=require('fs');var path=require(_0xfc02('0x6'));var rimraf=require('rimraf');var config=require(_0xfc02('0x7'));var attributes=require(_0xfc02('0x8'));module[_0xfc02('0x9')]=function(_0x1d5a2a,_0xad411a){return _0x1d5a2a['define']('IntegrationReport',attributes,{'tableName':_0xfc02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a8c=['exports','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x191f28,_0x29f917){var _0x3f421a=function(_0xf52828){while(--_0xf52828){_0x191f28['push'](_0x191f28['shift']());}};_0x3f421a(++_0x29f917);}(_0x4a8c,0x147));var _0xc4a8=function(_0x273315,_0x273ae2){_0x273315=_0x273315-0x0;var _0x534691=_0x4a8c[_0x273315];return _0x534691;};'use strict';var _=require(_0xc4a8('0x0'));var util=require(_0xc4a8('0x1'));var logger=require(_0xc4a8('0x2'))(_0xc4a8('0x3'));var moment=require(_0xc4a8('0x4'));var BPromise=require(_0xc4a8('0x5'));var rp=require(_0xc4a8('0x6'));var fs=require('fs');var path=require(_0xc4a8('0x7'));var rimraf=require(_0xc4a8('0x8'));var config=require(_0xc4a8('0x9'));var attributes=require(_0xc4a8('0xa'));module[_0xc4a8('0xb')]=function(_0x561234,_0x57b332){return _0x561234['define']('IntegrationReport',attributes,{'tableName':_0xc4a8('0xc'),'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 e77c1a4..576ecd2 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 _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\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(_0x3d0de,_0x114bb5){var _0x2c5813=function(_0x40fe75){while(--_0x40fe75){_0x3d0de['push'](_0x3d0de['shift']());}};_0x2c5813(++_0x114bb5);}(_0x1261,0x144));var _0x1126=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0x1261[_0x3f3bad];return _0x4f0801;};'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')]('IntegrationReport,\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 _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x38752b,_0x5e9b2c){var _0x2c0bac=function(_0xd573d2){while(--_0xd573d2){_0x38752b['push'](_0x38752b['shift']());}};_0x2c0bac(++_0x5e9b2c);}(_0x2542,0x169));var _0x2254=function(_0x30bef8,_0x420ad8){_0x30bef8=_0x30bef8-0x0;var _0x17454d=_0x2542[_0x30bef8];return _0x17454d;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index afe3d2a..1fd1ce1 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 _0xb5ec=['addIntervals','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','create','addInterval'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb5ec,0x97));var _0xcb5e=function(_0x37798d,_0x411d70){_0x37798d=_0x37798d-0x0;var _0x2f5aae=_0xb5ec[_0x37798d];return _0x2f5aae;};'use strict';var multer=require(_0xcb5e('0x0'));var util=require(_0xcb5e('0x1'));var path=require(_0xcb5e('0x2'));var timeout=require(_0xcb5e('0x3'));var express=require('express');var router=express[_0xcb5e('0x4')]();var fs_extra=require(_0xcb5e('0x5'));var auth=require(_0xcb5e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb5e('0x7'));var controller=require('./interval.controller');router[_0xcb5e('0x8')]('/',auth[_0xcb5e('0x9')](),controller[_0xcb5e('0xa')]);router[_0xcb5e('0x8')](_0xcb5e('0xb'),auth[_0xcb5e('0x9')](),controller[_0xcb5e('0xc')]);router[_0xcb5e('0x8')](_0xcb5e('0xd'),auth[_0xcb5e('0x9')](),controller['getIntervals']);router[_0xcb5e('0xe')]('/',auth[_0xcb5e('0x9')](),controller[_0xcb5e('0xf')]);router[_0xcb5e('0xe')](_0xcb5e('0xd'),auth[_0xcb5e('0x9')](),controller[_0xcb5e('0x10')]);router[_0xcb5e('0xe')]('/:id/sub_intervals/create_many',auth[_0xcb5e('0x9')](),controller[_0xcb5e('0x11')]);router[_0xcb5e('0x12')](_0xcb5e('0xb'),auth[_0xcb5e('0x9')](),controller[_0xcb5e('0x13')]);router['delete'](_0xcb5e('0xb'),auth[_0xcb5e('0x9')](),controller['destroy']);module[_0xcb5e('0x14')]=router; \ No newline at end of file +var _0x102b=['create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','getIntervals'];(function(_0x26b3f9,_0x2be7c8){var _0x1293d1=function(_0x3a462f){while(--_0x3a462f){_0x26b3f9['push'](_0x26b3f9['shift']());}};_0x1293d1(++_0x2be7c8);}(_0x102b,0x1be));var _0xb102=function(_0x3d26cc,_0x298156){_0x3d26cc=_0x3d26cc-0x0;var _0x758c4e=_0x102b[_0x3d26cc];return _0x758c4e;};'use strict';var multer=require('multer');var util=require(_0xb102('0x0'));var path=require('path');var timeout=require(_0xb102('0x1'));var express=require(_0xb102('0x2'));var router=express[_0xb102('0x3')]();var fs_extra=require(_0xb102('0x4'));var auth=require(_0xb102('0x5'));var interaction=require(_0xb102('0x6'));var config=require(_0xb102('0x7'));var controller=require(_0xb102('0x8'));router['get']('/',auth[_0xb102('0x9')](),controller[_0xb102('0xa')]);router[_0xb102('0xb')](_0xb102('0xc'),auth[_0xb102('0x9')](),controller['show']);router[_0xb102('0xb')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xb102('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb102('0xe')]);router[_0xb102('0xf')]('/:id/sub_intervals',auth[_0xb102('0x9')](),controller[_0xb102('0x10')]);router[_0xb102('0xf')](_0xb102('0x11'),auth[_0xb102('0x9')](),controller[_0xb102('0x12')]);router[_0xb102('0x13')]('/:id',auth[_0xb102('0x9')](),controller['update']);router[_0xb102('0x14')](_0xb102('0xc'),auth['isAuthenticated'](),controller[_0xb102('0x15')]);module[_0xb102('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3416633..2ae904f 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 _0xb2d9=['sequelize','exports','STRING'];(function(_0x564f89,_0x4846c8){var _0x5053cd=function(_0x43dcd2){while(--_0x43dcd2){_0x564f89['push'](_0x564f89['shift']());}};_0x5053cd(++_0x4846c8);}(_0xb2d9,0x16e));var _0x9b2d=function(_0x154da7,_0x155e5d){_0x154da7=_0x154da7-0x0;var _0x3c9dbf=_0xb2d9[_0x154da7];return _0x3c9dbf;};'use strict';var Sequelize=require(_0x9b2d('0x0'));module[_0x9b2d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9b2d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4e43=['exports','STRING','sequelize'];(function(_0x438dab,_0x13bfc4){var _0x43ae2c=function(_0x4b9fb3){while(--_0x4b9fb3){_0x438dab['push'](_0x438dab['shift']());}};_0x43ae2c(++_0x13bfc4);}(_0x4e43,0x140));var _0x34e4=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x4e43[_0x3acee8];return _0x5046cc;};'use strict';var Sequelize=require(_0x34e4('0x0'));module[_0x34e4('0x1')]={'name':{'type':Sequelize[_0x34e4('0x2')]},'description':{'type':Sequelize[_0x34e4('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index fe1b625..f6046f5 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 _0xe603=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','name','index','map','Interval','fieldName','type','key','model','query','keys'];(function(_0x28f0b9,_0x3c3242){var _0x5d7796=function(_0x73cb41){while(--_0x73cb41){_0x28f0b9['push'](_0x28f0b9['shift']());}};_0x5d7796(++_0x3c3242);}(_0xe603,0x19e));var _0x3e60=function(_0x1871e0,_0x31e930){_0x1871e0=_0x1871e0-0x0;var _0x3d1795=_0xe603[_0x1871e0];return _0x3d1795;};'use strict';var emlformat=require(_0x3e60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e60('0x1'));var jsonpatch=require(_0x3e60('0x2'));var rp=require('request-promise');var moment=require(_0x3e60('0x3'));var BPromise=require(_0x3e60('0x4'));var Mustache=require(_0x3e60('0x5'));var util=require(_0x3e60('0x6'));var path=require(_0x3e60('0x7'));var sox=require(_0x3e60('0x8'));var csv=require(_0x3e60('0x9'));var ejs=require(_0x3e60('0xa'));var fs=require('fs');var fs_extra=require(_0x3e60('0xb'));var _=require(_0x3e60('0xc'));var squel=require(_0x3e60('0xd'));var crypto=require(_0x3e60('0xe'));var jsforce=require(_0x3e60('0xf'));var deskjs=require(_0x3e60('0x10'));var toCsv=require(_0x3e60('0x9'));var querystring=require(_0x3e60('0x11'));var Papa=require('papaparse');var Redis=require(_0x3e60('0x12'));var authService=require(_0x3e60('0x13'));var qs=require(_0x3e60('0x14'));var as=require(_0x3e60('0x15'));var hardwareService=require(_0x3e60('0x16'));var logger=require(_0x3e60('0x17'))(_0x3e60('0x18'));var utils=require('../../config/utils');var config=require(_0x3e60('0x19'));var licenseUtil=require(_0x3e60('0x1a'));var db=require('../../mysqldb')['db'];var extensions=require(_0x3e60('0x1b'));function respondWithStatusCode(_0x8904de,_0x41afeb){_0x41afeb=_0x41afeb||0xcc;return function(_0x4ad680){if(_0x4ad680){return _0x8904de[_0x3e60('0x1c')](_0x41afeb);}return _0x8904de[_0x3e60('0x1d')](_0x41afeb)[_0x3e60('0x1e')]();};}function respondWithResult(_0x578672,_0x332efd){_0x332efd=_0x332efd||0xc8;return function(_0x3f56b3){if(_0x3f56b3){return _0x578672[_0x3e60('0x1d')](_0x332efd)[_0x3e60('0x1f')](_0x3f56b3);}};}function respondWithFilteredResult(_0x21cf26,_0x133bd5){return function(_0x59a34d){if(_0x59a34d){var _0x4fb279=typeof _0x133bd5[_0x3e60('0x20')]===_0x3e60('0x21')&&typeof _0x133bd5[_0x3e60('0x22')]===_0x3e60('0x21');var _0x30dd55=_0x59a34d['count'];var _0xdc6840=_0x4fb279?0x0:_0x133bd5[_0x3e60('0x20')];var _0x302814=_0x4fb279?_0x59a34d[_0x3e60('0x23')]:_0x133bd5['offset']+_0x133bd5[_0x3e60('0x22')];var _0x4f763e;if(_0x302814>=_0x30dd55){_0x302814=_0x30dd55;_0x4f763e=0xc8;}else{_0x4f763e=0xce;}_0x21cf26[_0x3e60('0x1d')](_0x4f763e);return _0x21cf26['set'](_0x3e60('0x24'),_0xdc6840+'-'+_0x302814+'/'+_0x30dd55)[_0x3e60('0x1f')](_0x59a34d);}return null;};}function patchUpdates(_0x506c12){return function(_0x2a9c46){try{jsonpatch[_0x3e60('0x25')](_0x2a9c46,_0x506c12,!![]);}catch(_0x210f50){return BPromise[_0x3e60('0x26')](_0x210f50);}return _0x2a9c46[_0x3e60('0x27')]();};}function saveUpdates(_0x1903ea,_0x214c6d){return function(_0x1f5371){if(_0x1f5371){return _0x1f5371[_0x3e60('0x28')](_0x1903ea)[_0x3e60('0x29')](function(_0x1c34a0){return _0x1c34a0;});}return null;};}function removeEntity(_0x43aa37,_0x29014e){return function(_0x574eff){if(_0x574eff){return _0x574eff[_0x3e60('0x2a')]()[_0x3e60('0x29')](function(){var _0x2a2d25=_0x574eff[_0x3e60('0x2b')]({'plain':!![]});var _0xb734b1=_0x3e60('0x2c');return db[_0x3e60('0x2d')][_0x3e60('0x2a')]({'where':{'type':_0xb734b1,'resourceId':_0x2a2d25['id']}})['then'](function(){return _0x574eff;});})[_0x3e60('0x29')](function(){_0x43aa37[_0x3e60('0x1d')](0xcc)[_0x3e60('0x1e')]();});}};}function handleEntityNotFound(_0x4cc67a,_0x16eb2c){return function(_0x2b5e09){if(!_0x2b5e09){_0x4cc67a[_0x3e60('0x1c')](0x194);}return _0x2b5e09;};}function handleError(_0x1044fe,_0x343cac){_0x343cac=_0x343cac||0x1f4;return function(_0x53acd5){logger['error'](_0x53acd5['stack']);if(_0x53acd5[_0x3e60('0x2e')]){delete _0x53acd5[_0x3e60('0x2e')];}_0x1044fe[_0x3e60('0x1d')](_0x343cac)['send'](_0x53acd5);};}exports[_0x3e60('0x2f')]=function(_0x48b8b3,_0x30e8bf){var _0x3b3686={},_0x1c92d4={},_0x46d817={'count':0x0,'rows':[]};var _0x2c4eda=_[_0x3e60('0x30')](db[_0x3e60('0x31')]['rawAttributes'],function(_0x431691){return{'name':_0x431691[_0x3e60('0x32')],'type':_0x431691[_0x3e60('0x33')][_0x3e60('0x34')]};});_0x1c92d4[_0x3e60('0x35')]=_[_0x3e60('0x30')](_0x2c4eda,'name');_0x1c92d4[_0x3e60('0x36')]=_[_0x3e60('0x37')](_0x48b8b3[_0x3e60('0x36')]);_0x1c92d4['filters']=_['intersection'](_0x1c92d4['model'],_0x1c92d4['query']);_0x3b3686[_0x3e60('0x38')]=_['intersection'](_0x1c92d4[_0x3e60('0x35')],qs[_0x3e60('0x39')](_0x48b8b3['query']['fields']));_0x3b3686[_0x3e60('0x38')]=_0x3b3686['attributes'][_0x3e60('0x3a')]?_0x3b3686[_0x3e60('0x38')]:_0x1c92d4[_0x3e60('0x35')];if(!_0x48b8b3['query'][_0x3e60('0x3b')](_0x3e60('0x3c'))){_0x3b3686[_0x3e60('0x22')]=qs[_0x3e60('0x22')](_0x48b8b3['query'][_0x3e60('0x22')]);_0x3b3686['offset']=qs[_0x3e60('0x20')](_0x48b8b3[_0x3e60('0x36')][_0x3e60('0x20')]);}_0x3b3686['order']=qs[_0x3e60('0x3d')](_0x48b8b3[_0x3e60('0x36')]['sort']);_0x3b3686[_0x3e60('0x3e')]=qs[_0x3e60('0x3f')](_[_0x3e60('0x40')](_0x48b8b3['query'],_0x1c92d4['filters']),_0x2c4eda);if(_0x48b8b3[_0x3e60('0x36')][_0x3e60('0x41')]){_0x3b3686[_0x3e60('0x3e')]=_['merge'](_0x3b3686[_0x3e60('0x3e')],{'$or':_[_0x3e60('0x30')](_0x2c4eda,function(_0xc27439){if(_0xc27439[_0x3e60('0x33')]!==_0x3e60('0x42')){var _0x17f44d={};_0x17f44d[_0xc27439[_0x3e60('0x2e')]]={'$like':'%'+_0x48b8b3[_0x3e60('0x36')][_0x3e60('0x41')]+'%'};return _0x17f44d;}})});}_0x3b3686=_[_0x3e60('0x43')]({},_0x3b3686,_0x48b8b3['options']);var _0x2371aa={'where':_0x3b3686[_0x3e60('0x3e')]};return db[_0x3e60('0x31')][_0x3e60('0x23')](_0x2371aa)['then'](function(_0x2c25db){_0x46d817[_0x3e60('0x23')]=_0x2c25db;if(_0x48b8b3[_0x3e60('0x36')][_0x3e60('0x44')]){_0x3b3686[_0x3e60('0x45')]=[{'all':!![]}];}return db[_0x3e60('0x31')][_0x3e60('0x46')](_0x3b3686);})['then'](function(_0x3ab2cb){_0x46d817['rows']=_0x3ab2cb;return _0x46d817;})[_0x3e60('0x29')](respondWithFilteredResult(_0x30e8bf,_0x3b3686))[_0x3e60('0x47')](handleError(_0x30e8bf,null));};exports[_0x3e60('0x48')]=function(_0x4f6412,_0xf7a936){var _0x42530d={'raw':!![],'where':{'id':_0x4f6412[_0x3e60('0x49')]['id']}},_0x3b20f6={};_0x3b20f6[_0x3e60('0x35')]=_[_0x3e60('0x37')](db[_0x3e60('0x31')][_0x3e60('0x4a')]);_0x3b20f6[_0x3e60('0x36')]=_[_0x3e60('0x37')](_0x4f6412[_0x3e60('0x36')]);_0x3b20f6[_0x3e60('0x3f')]=_['intersection'](_0x3b20f6[_0x3e60('0x35')],_0x3b20f6[_0x3e60('0x36')]);_0x42530d['attributes']=_[_0x3e60('0x4b')](_0x3b20f6[_0x3e60('0x35')],qs[_0x3e60('0x39')](_0x4f6412[_0x3e60('0x36')]['fields']));_0x42530d[_0x3e60('0x38')]=_0x42530d['attributes']['length']?_0x42530d[_0x3e60('0x38')]:_0x3b20f6[_0x3e60('0x35')];if(_0x4f6412[_0x3e60('0x36')]['includeAll']){_0x42530d[_0x3e60('0x45')]=[{'all':!![]}];}_0x42530d=_['merge']({},_0x42530d,_0x4f6412[_0x3e60('0x4c')]);return db['Interval'][_0x3e60('0x4d')](_0x42530d)[_0x3e60('0x29')](handleEntityNotFound(_0xf7a936,null))[_0x3e60('0x29')](respondWithResult(_0xf7a936,null))['catch'](handleError(_0xf7a936,null));};exports[_0x3e60('0x4e')]=function(_0x132de7,_0x3507bb){return db[_0x3e60('0x31')][_0x3e60('0x4e')](_0x132de7[_0x3e60('0x4f')],{})['then'](function(_0x41ee3c){var _0x306e29=_0x132de7['user'][_0x3e60('0x2b')]({'plain':!![]});if(!_0x306e29)throw new Error(_0x3e60('0x50'));if(_0x306e29[_0x3e60('0x51')]==='user'){var _0x1d131a=_0x41ee3c['get']({'plain':!![]});var _0x3771d4=_0x3e60('0x2c');return db['UserProfileSection'][_0x3e60('0x4d')]({'where':{'name':_0x3771d4,'userProfileId':_0x306e29[_0x3e60('0x52')]},'raw':!![]})[_0x3e60('0x29')](function(_0x3df2e5){if(_0x3df2e5&&_0x3df2e5['autoAssociation']===0x0){return db[_0x3e60('0x2d')][_0x3e60('0x4e')]({'name':_0x1d131a[_0x3e60('0x2e')],'resourceId':_0x1d131a['id'],'type':_0x3df2e5[_0x3e60('0x2e')],'sectionId':_0x3df2e5['id']},{})['then'](function(){return _0x41ee3c;});}else{return _0x41ee3c;}})[_0x3e60('0x47')](function(_0x528f74){logger[_0x3e60('0x53')](_0x3e60('0x54'),_0x528f74);throw _0x528f74;});}return _0x41ee3c;})[_0x3e60('0x29')](respondWithResult(_0x3507bb,0xc9))[_0x3e60('0x47')](handleError(_0x3507bb,null));};exports[_0x3e60('0x28')]=function(_0xb19a99,_0x3b84b6){if(_0xb19a99[_0x3e60('0x4f')]['id']){delete _0xb19a99[_0x3e60('0x4f')]['id'];}return db[_0x3e60('0x31')][_0x3e60('0x4d')]({'where':{'id':_0xb19a99[_0x3e60('0x49')]['id']}})[_0x3e60('0x29')](handleEntityNotFound(_0x3b84b6,null))[_0x3e60('0x29')](saveUpdates(_0xb19a99[_0x3e60('0x4f')],null))[_0x3e60('0x29')](respondWithResult(_0x3b84b6,null))[_0x3e60('0x47')](handleError(_0x3b84b6,null));};exports[_0x3e60('0x2a')]=function(_0x41f624,_0x241836){return db[_0x3e60('0x31')][_0x3e60('0x4d')]({'where':{'id':_0x41f624[_0x3e60('0x49')]['id']}})['then'](handleEntityNotFound(_0x241836,null))['then'](removeEntity(_0x241836,null))[_0x3e60('0x47')](handleError(_0x241836,null));};exports[_0x3e60('0x55')]=function(_0x121266,_0x38aa22,_0x536d7d){if(_0x121266[_0x3e60('0x4f')]['id']){delete _0x121266[_0x3e60('0x4f')]['id'];}return db[_0x3e60('0x31')][_0x3e60('0x4d')]({'where':{'id':_0x121266[_0x3e60('0x49')]['id']}})[_0x3e60('0x29')](handleEntityNotFound(_0x38aa22,null))[_0x3e60('0x29')](function(_0x34f97a){if(_0x34f97a){_0x121266[_0x3e60('0x4f')][_0x3e60('0x56')]=_0x34f97a['id'];return db[_0x3e60('0x31')][_0x3e60('0x4e')](_0x121266[_0x3e60('0x4f')]);}})[_0x3e60('0x29')](respondWithResult(_0x38aa22,null))[_0x3e60('0x47')](handleError(_0x38aa22,null));};exports[_0x3e60('0x57')]=function(_0x5cddb8,_0x245d88,_0x37d3f0){var _0x23f00d={};var _0x4da339={};var _0x14da8d;var _0x2a5dd8;return db['Interval'][_0x3e60('0x58')]({'where':{'id':_0x5cddb8[_0x3e60('0x49')]['id']}})[_0x3e60('0x29')](handleEntityNotFound(_0x245d88,null))[_0x3e60('0x29')](function(_0x2da8e0){if(_0x2da8e0){_0x14da8d=_0x2da8e0;_0x4da339[_0x3e60('0x35')]=_[_0x3e60('0x37')](db[_0x3e60('0x31')][_0x3e60('0x4a')]);_0x4da339[_0x3e60('0x36')]=_[_0x3e60('0x37')](_0x5cddb8[_0x3e60('0x36')]);_0x4da339[_0x3e60('0x3f')]=_[_0x3e60('0x4b')](_0x4da339['model'],_0x4da339[_0x3e60('0x36')]);_0x23f00d[_0x3e60('0x38')]=_['intersection'](_0x4da339[_0x3e60('0x35')],qs[_0x3e60('0x39')](_0x5cddb8['query'][_0x3e60('0x39')]));_0x23f00d[_0x3e60('0x38')]=_0x23f00d[_0x3e60('0x38')][_0x3e60('0x3a')]?_0x23f00d[_0x3e60('0x38')]:_0x4da339[_0x3e60('0x35')];_0x23f00d[_0x3e60('0x59')]=qs[_0x3e60('0x3d')](_0x5cddb8[_0x3e60('0x36')][_0x3e60('0x3d')]);_0x23f00d[_0x3e60('0x3e')]=qs[_0x3e60('0x3f')](_[_0x3e60('0x40')](_0x5cddb8['query'],_0x4da339[_0x3e60('0x3f')]));if(_0x5cddb8[_0x3e60('0x36')]['filter']){_0x23f00d['where']=_[_0x3e60('0x43')](_0x23f00d[_0x3e60('0x3e')],{'$or':_[_0x3e60('0x30')](_0x23f00d[_0x3e60('0x38')],function(_0x2cd1c8){var _0x37018c={};_0x37018c[_0x2cd1c8]={'$like':'%'+_0x5cddb8[_0x3e60('0x36')][_0x3e60('0x41')]+'%'};return _0x37018c;})});}_0x23f00d=_[_0x3e60('0x43')]({},_0x23f00d,_0x5cddb8[_0x3e60('0x4c')]);return _0x14da8d['getIntervals'](_0x23f00d);}})[_0x3e60('0x29')](function(_0x2d92a9){if(_0x2d92a9){_0x2a5dd8=_0x2d92a9['length'];if(!_0x5cddb8[_0x3e60('0x36')][_0x3e60('0x3b')](_0x3e60('0x3c'))){_0x23f00d['limit']=qs[_0x3e60('0x22')](_0x5cddb8[_0x3e60('0x36')][_0x3e60('0x22')]);_0x23f00d[_0x3e60('0x20')]=qs[_0x3e60('0x20')](_0x5cddb8[_0x3e60('0x36')][_0x3e60('0x20')]);}return _0x14da8d[_0x3e60('0x57')](_0x23f00d);}})[_0x3e60('0x29')](function(_0x9f4b82){if(_0x9f4b82){return _0x9f4b82?{'count':_0x2a5dd8,'rows':_0x9f4b82}:null;}})[_0x3e60('0x29')](respondWithResult(_0x245d88,null))[_0x3e60('0x47')](handleError(_0x245d88,null));};exports[_0x3e60('0x5a')]=function(_0x4fdca2,_0x2e68b1,_0x597356){return db[_0x3e60('0x31')][_0x3e60('0x58')]({'where':{'id':_0x4fdca2[_0x3e60('0x49')]['id']}})[_0x3e60('0x29')](handleEntityNotFound(_0x2e68b1,null))[_0x3e60('0x29')](function(_0x28dd22){if(_0x28dd22){return db[_0x3e60('0x5b')][_0x3e60('0x5c')](function(_0x30ccc4){return db[_0x3e60('0x31')][_0x3e60('0x2a')]({'where':{'IntervalId':_0x4fdca2[_0x3e60('0x49')]['id']},'transaction':_0x30ccc4})[_0x3e60('0x29')](function(_0x56f29d){var _0x87e2a5=_[_0x3e60('0x30')](_0x4fdca2[_0x3e60('0x4f')],function(_0x32171f){delete _0x32171f['id'];_0x32171f[_0x3e60('0x56')]=_0x4fdca2['params']['id'];return _0x32171f;});return db[_0x3e60('0x31')][_0x3e60('0x5d')](_0x87e2a5,{'transaction':_0x30ccc4});});})[_0x3e60('0x29')](function(){return db[_0x3e60('0x31')][_0x3e60('0x46')]({'where':{'IntervalId':_0x4fdca2[_0x3e60('0x49')]['id']}});});}})[_0x3e60('0x29')](respondWithResult(_0x2e68b1,null))[_0x3e60('0x47')](handleError(_0x2e68b1,null));}; \ No newline at end of file +var _0x944b=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','Intervals','UserProfileResource','destroy','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find'];(function(_0x559a11,_0x18f39f){var _0xb8d692=function(_0x584700){while(--_0x584700){_0x559a11['push'](_0x559a11['shift']());}};_0xb8d692(++_0x18f39f);}(_0x944b,0x1a0));var _0xb944=function(_0x21750a,_0x35ee25){_0x21750a=_0x21750a-0x0;var _0x3c391f=_0x944b[_0x21750a];return _0x3c391f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb944('0x0'));var jsonpatch=require(_0xb944('0x1'));var rp=require('request-promise');var moment=require(_0xb944('0x2'));var BPromise=require(_0xb944('0x3'));var Mustache=require(_0xb944('0x4'));var util=require(_0xb944('0x5'));var path=require(_0xb944('0x6'));var sox=require(_0xb944('0x7'));var csv=require(_0xb944('0x8'));var ejs=require(_0xb944('0x9'));var fs=require('fs');var fs_extra=require(_0xb944('0xa'));var _=require('lodash');var squel=require(_0xb944('0xb'));var crypto=require(_0xb944('0xc'));var jsforce=require(_0xb944('0xd'));var deskjs=require(_0xb944('0xe'));var toCsv=require(_0xb944('0x8'));var querystring=require('querystring');var Papa=require(_0xb944('0xf'));var Redis=require(_0xb944('0x10'));var authService=require(_0xb944('0x11'));var qs=require(_0xb944('0x12'));var as=require(_0xb944('0x13'));var hardwareService=require(_0xb944('0x14'));var logger=require(_0xb944('0x15'))(_0xb944('0x16'));var utils=require(_0xb944('0x17'));var config=require(_0xb944('0x18'));var licenseUtil=require(_0xb944('0x19'));var db=require(_0xb944('0x1a'))['db'];var extensions=require(_0xb944('0x1b'));function respondWithStatusCode(_0x177b72,_0x513e2e){_0x513e2e=_0x513e2e||0xcc;return function(_0xb8d97f){if(_0xb8d97f){return _0x177b72[_0xb944('0x1c')](_0x513e2e);}return _0x177b72['status'](_0x513e2e)[_0xb944('0x1d')]();};}function respondWithResult(_0x2db243,_0x518684){_0x518684=_0x518684||0xc8;return function(_0x2e10ce){if(_0x2e10ce){return _0x2db243[_0xb944('0x1e')](_0x518684)[_0xb944('0x1f')](_0x2e10ce);}};}function respondWithFilteredResult(_0x11012c,_0x23f4ee){return function(_0x526517){if(_0x526517){var _0x3cf76c=typeof _0x23f4ee[_0xb944('0x20')]===_0xb944('0x21')&&typeof _0x23f4ee[_0xb944('0x22')]===_0xb944('0x21');var _0x452311=_0x526517[_0xb944('0x23')];var _0x6a9cd6=_0x3cf76c?0x0:_0x23f4ee[_0xb944('0x20')];var _0x18da8f=_0x3cf76c?_0x526517['count']:_0x23f4ee['offset']+_0x23f4ee[_0xb944('0x22')];var _0x2661de;if(_0x18da8f>=_0x452311){_0x18da8f=_0x452311;_0x2661de=0xc8;}else{_0x2661de=0xce;}_0x11012c['status'](_0x2661de);return _0x11012c[_0xb944('0x24')](_0xb944('0x25'),_0x6a9cd6+'-'+_0x18da8f+'/'+_0x452311)['json'](_0x526517);}return null;};}function patchUpdates(_0x15b21a){return function(_0x1c2af0){try{jsonpatch[_0xb944('0x26')](_0x1c2af0,_0x15b21a,!![]);}catch(_0x5277a6){return BPromise[_0xb944('0x27')](_0x5277a6);}return _0x1c2af0[_0xb944('0x28')]();};}function saveUpdates(_0x4e3811,_0x4f0019){return function(_0x2c334a){if(_0x2c334a){return _0x2c334a['update'](_0x4e3811)[_0xb944('0x29')](function(_0x3b8fce){return _0x3b8fce;});}return null;};}function removeEntity(_0x215673,_0x1efcb9){return function(_0x6f2b6b){if(_0x6f2b6b){return _0x6f2b6b['destroy']()[_0xb944('0x29')](function(){var _0x442548=_0x6f2b6b['get']({'plain':!![]});var _0x229474=_0xb944('0x2a');return db[_0xb944('0x2b')][_0xb944('0x2c')]({'where':{'type':_0x229474,'resourceId':_0x442548['id']}})[_0xb944('0x29')](function(){return _0x6f2b6b;});})[_0xb944('0x29')](function(){_0x215673[_0xb944('0x1e')](0xcc)[_0xb944('0x1d')]();});}};}function handleEntityNotFound(_0x57c0b7,_0x5e5bff){return function(_0x1d46a4){if(!_0x1d46a4){_0x57c0b7[_0xb944('0x1c')](0x194);}return _0x1d46a4;};}function handleError(_0x275fec,_0x544c08){_0x544c08=_0x544c08||0x1f4;return function(_0x4f124f){logger[_0xb944('0x2d')](_0x4f124f[_0xb944('0x2e')]);if(_0x4f124f[_0xb944('0x2f')]){delete _0x4f124f[_0xb944('0x2f')];}_0x275fec[_0xb944('0x1e')](_0x544c08)['send'](_0x4f124f);};}exports[_0xb944('0x30')]=function(_0xa3745f,_0x8ea8bd){var _0x52ed76={},_0x193444={},_0x16baea={'count':0x0,'rows':[]};var _0x1ea5c8=_[_0xb944('0x31')](db[_0xb944('0x32')][_0xb944('0x33')],function(_0x345869){return{'name':_0x345869[_0xb944('0x34')],'type':_0x345869[_0xb944('0x35')][_0xb944('0x36')]};});_0x193444[_0xb944('0x37')]=_[_0xb944('0x31')](_0x1ea5c8,'name');_0x193444[_0xb944('0x38')]=_[_0xb944('0x39')](_0xa3745f[_0xb944('0x38')]);_0x193444['filters']=_['intersection'](_0x193444[_0xb944('0x37')],_0x193444[_0xb944('0x38')]);_0x52ed76[_0xb944('0x3a')]=_[_0xb944('0x3b')](_0x193444['model'],qs['fields'](_0xa3745f[_0xb944('0x38')][_0xb944('0x3c')]));_0x52ed76[_0xb944('0x3a')]=_0x52ed76[_0xb944('0x3a')][_0xb944('0x3d')]?_0x52ed76['attributes']:_0x193444[_0xb944('0x37')];if(!_0xa3745f['query'][_0xb944('0x3e')]('nolimit')){_0x52ed76[_0xb944('0x22')]=qs[_0xb944('0x22')](_0xa3745f[_0xb944('0x38')][_0xb944('0x22')]);_0x52ed76[_0xb944('0x20')]=qs[_0xb944('0x20')](_0xa3745f[_0xb944('0x38')]['offset']);}_0x52ed76[_0xb944('0x3f')]=qs[_0xb944('0x40')](_0xa3745f[_0xb944('0x38')][_0xb944('0x40')]);_0x52ed76[_0xb944('0x41')]=qs[_0xb944('0x42')](_[_0xb944('0x43')](_0xa3745f[_0xb944('0x38')],_0x193444[_0xb944('0x42')]),_0x1ea5c8);if(_0xa3745f[_0xb944('0x38')][_0xb944('0x44')]){_0x52ed76[_0xb944('0x41')]=_[_0xb944('0x45')](_0x52ed76[_0xb944('0x41')],{'$or':_[_0xb944('0x31')](_0x1ea5c8,function(_0x1720a0){if(_0x1720a0['type']!==_0xb944('0x46')){var _0x505be0={};_0x505be0[_0x1720a0[_0xb944('0x2f')]]={'$like':'%'+_0xa3745f[_0xb944('0x38')][_0xb944('0x44')]+'%'};return _0x505be0;}})});}_0x52ed76=_[_0xb944('0x45')]({},_0x52ed76,_0xa3745f[_0xb944('0x47')]);var _0x3809ee={'where':_0x52ed76['where']};return db[_0xb944('0x32')][_0xb944('0x23')](_0x3809ee)[_0xb944('0x29')](function(_0x1f258a){_0x16baea[_0xb944('0x23')]=_0x1f258a;if(_0xa3745f[_0xb944('0x38')][_0xb944('0x48')]){_0x52ed76[_0xb944('0x49')]=[{'all':!![]}];}return db[_0xb944('0x32')][_0xb944('0x4a')](_0x52ed76);})[_0xb944('0x29')](function(_0x4a4863){_0x16baea['rows']=_0x4a4863;return _0x16baea;})['then'](respondWithFilteredResult(_0x8ea8bd,_0x52ed76))[_0xb944('0x4b')](handleError(_0x8ea8bd,null));};exports[_0xb944('0x4c')]=function(_0x546eff,_0x5d001d){var _0x1e50f5={'raw':!![],'where':{'id':_0x546eff[_0xb944('0x4d')]['id']}},_0x30715f={};_0x30715f[_0xb944('0x37')]=_['keys'](db[_0xb944('0x32')]['rawAttributes']);_0x30715f[_0xb944('0x38')]=_['keys'](_0x546eff[_0xb944('0x38')]);_0x30715f[_0xb944('0x42')]=_[_0xb944('0x3b')](_0x30715f[_0xb944('0x37')],_0x30715f[_0xb944('0x38')]);_0x1e50f5[_0xb944('0x3a')]=_['intersection'](_0x30715f['model'],qs[_0xb944('0x3c')](_0x546eff[_0xb944('0x38')]['fields']));_0x1e50f5[_0xb944('0x3a')]=_0x1e50f5['attributes'][_0xb944('0x3d')]?_0x1e50f5[_0xb944('0x3a')]:_0x30715f['model'];if(_0x546eff[_0xb944('0x38')][_0xb944('0x48')]){_0x1e50f5[_0xb944('0x49')]=[{'all':!![]}];}_0x1e50f5=_[_0xb944('0x45')]({},_0x1e50f5,_0x546eff[_0xb944('0x47')]);return db['Interval'][_0xb944('0x4e')](_0x1e50f5)[_0xb944('0x29')](handleEntityNotFound(_0x5d001d,null))[_0xb944('0x29')](respondWithResult(_0x5d001d,null))[_0xb944('0x4b')](handleError(_0x5d001d,null));};exports[_0xb944('0x4f')]=function(_0x4cfc7c,_0xa4b911){return db[_0xb944('0x32')]['create'](_0x4cfc7c[_0xb944('0x50')],{})[_0xb944('0x29')](function(_0x313c1f){var _0x9ad63a=_0x4cfc7c[_0xb944('0x51')][_0xb944('0x52')]({'plain':!![]});if(!_0x9ad63a)throw new Error(_0xb944('0x53'));if(_0x9ad63a[_0xb944('0x54')]==='user'){var _0x5cfd64=_0x313c1f[_0xb944('0x52')]({'plain':!![]});var _0x4bc715=_0xb944('0x2a');return db[_0xb944('0x55')]['find']({'where':{'name':_0x4bc715,'userProfileId':_0x9ad63a[_0xb944('0x56')]},'raw':!![]})[_0xb944('0x29')](function(_0x54f60b){if(_0x54f60b&&_0x54f60b[_0xb944('0x57')]===0x0){return db[_0xb944('0x2b')][_0xb944('0x4f')]({'name':_0x5cfd64['name'],'resourceId':_0x5cfd64['id'],'type':_0x54f60b[_0xb944('0x2f')],'sectionId':_0x54f60b['id']},{})['then'](function(){return _0x313c1f;});}else{return _0x313c1f;}})['catch'](function(_0x3bb7dd){logger[_0xb944('0x2d')](_0xb944('0x58'),_0x3bb7dd);throw _0x3bb7dd;});}return _0x313c1f;})[_0xb944('0x29')](respondWithResult(_0xa4b911,0xc9))['catch'](handleError(_0xa4b911,null));};exports[_0xb944('0x59')]=function(_0x179f43,_0xf60503){if(_0x179f43[_0xb944('0x50')]['id']){delete _0x179f43[_0xb944('0x50')]['id'];}return db['Interval'][_0xb944('0x4e')]({'where':{'id':_0x179f43[_0xb944('0x4d')]['id']}})[_0xb944('0x29')](handleEntityNotFound(_0xf60503,null))[_0xb944('0x29')](saveUpdates(_0x179f43['body'],null))[_0xb944('0x29')](respondWithResult(_0xf60503,null))[_0xb944('0x4b')](handleError(_0xf60503,null));};exports[_0xb944('0x2c')]=function(_0x1bb0be,_0x39bc08){return db[_0xb944('0x32')][_0xb944('0x4e')]({'where':{'id':_0x1bb0be[_0xb944('0x4d')]['id']}})['then'](handleEntityNotFound(_0x39bc08,null))[_0xb944('0x29')](removeEntity(_0x39bc08,null))[_0xb944('0x4b')](handleError(_0x39bc08,null));};exports[_0xb944('0x5a')]=function(_0x3405e6,_0x445c6d,_0x5c1bba){if(_0x3405e6[_0xb944('0x50')]['id']){delete _0x3405e6['body']['id'];}return db[_0xb944('0x32')][_0xb944('0x4e')]({'where':{'id':_0x3405e6[_0xb944('0x4d')]['id']}})[_0xb944('0x29')](handleEntityNotFound(_0x445c6d,null))[_0xb944('0x29')](function(_0x5bfdf2){if(_0x5bfdf2){_0x3405e6[_0xb944('0x50')][_0xb944('0x5b')]=_0x5bfdf2['id'];return db[_0xb944('0x32')][_0xb944('0x4f')](_0x3405e6['body']);}})[_0xb944('0x29')](respondWithResult(_0x445c6d,null))['catch'](handleError(_0x445c6d,null));};exports[_0xb944('0x5c')]=function(_0x2014a9,_0x125f2f,_0x116b5e){var _0x1384e2={};var _0x11c9bc={};var _0x29b276;var _0x3927bb;return db[_0xb944('0x32')][_0xb944('0x5d')]({'where':{'id':_0x2014a9[_0xb944('0x4d')]['id']}})[_0xb944('0x29')](handleEntityNotFound(_0x125f2f,null))[_0xb944('0x29')](function(_0x3fb3a3){if(_0x3fb3a3){_0x29b276=_0x3fb3a3;_0x11c9bc[_0xb944('0x37')]=_[_0xb944('0x39')](db['Interval']['rawAttributes']);_0x11c9bc[_0xb944('0x38')]=_[_0xb944('0x39')](_0x2014a9[_0xb944('0x38')]);_0x11c9bc[_0xb944('0x42')]=_[_0xb944('0x3b')](_0x11c9bc['model'],_0x11c9bc[_0xb944('0x38')]);_0x1384e2[_0xb944('0x3a')]=_[_0xb944('0x3b')](_0x11c9bc['model'],qs[_0xb944('0x3c')](_0x2014a9[_0xb944('0x38')]['fields']));_0x1384e2[_0xb944('0x3a')]=_0x1384e2['attributes'][_0xb944('0x3d')]?_0x1384e2[_0xb944('0x3a')]:_0x11c9bc[_0xb944('0x37')];_0x1384e2['order']=qs[_0xb944('0x40')](_0x2014a9[_0xb944('0x38')][_0xb944('0x40')]);_0x1384e2[_0xb944('0x41')]=qs['filters'](_['pick'](_0x2014a9[_0xb944('0x38')],_0x11c9bc[_0xb944('0x42')]));if(_0x2014a9[_0xb944('0x38')][_0xb944('0x44')]){_0x1384e2[_0xb944('0x41')]=_[_0xb944('0x45')](_0x1384e2['where'],{'$or':_[_0xb944('0x31')](_0x1384e2[_0xb944('0x3a')],function(_0xa7b8dd){var _0x412f07={};_0x412f07[_0xa7b8dd]={'$like':'%'+_0x2014a9[_0xb944('0x38')][_0xb944('0x44')]+'%'};return _0x412f07;})});}_0x1384e2=_[_0xb944('0x45')]({},_0x1384e2,_0x2014a9[_0xb944('0x47')]);return _0x29b276[_0xb944('0x5c')](_0x1384e2);}})[_0xb944('0x29')](function(_0x10d830){if(_0x10d830){_0x3927bb=_0x10d830[_0xb944('0x3d')];if(!_0x2014a9[_0xb944('0x38')][_0xb944('0x3e')](_0xb944('0x5e'))){_0x1384e2[_0xb944('0x22')]=qs['limit'](_0x2014a9[_0xb944('0x38')][_0xb944('0x22')]);_0x1384e2['offset']=qs['offset'](_0x2014a9['query'][_0xb944('0x20')]);}return _0x29b276['getIntervals'](_0x1384e2);}})[_0xb944('0x29')](function(_0x2f5e89){if(_0x2f5e89){return _0x2f5e89?{'count':_0x3927bb,'rows':_0x2f5e89}:null;}})[_0xb944('0x29')](respondWithResult(_0x125f2f,null))[_0xb944('0x4b')](handleError(_0x125f2f,null));};exports[_0xb944('0x5f')]=function(_0x104df6,_0xaea98b,_0x37a5e5){return db[_0xb944('0x32')][_0xb944('0x5d')]({'where':{'id':_0x104df6[_0xb944('0x4d')]['id']}})[_0xb944('0x29')](handleEntityNotFound(_0xaea98b,null))[_0xb944('0x29')](function(_0x14b7ed){if(_0x14b7ed){return db[_0xb944('0x60')][_0xb944('0x61')](function(_0x18bc87){return db[_0xb944('0x32')][_0xb944('0x2c')]({'where':{'IntervalId':_0x104df6['params']['id']},'transaction':_0x18bc87})['then'](function(_0x7b05f2){var _0x17fdb7=_['map'](_0x104df6[_0xb944('0x50')],function(_0x32b5b7){delete _0x32b5b7['id'];_0x32b5b7[_0xb944('0x5b')]=_0x104df6[_0xb944('0x4d')]['id'];return _0x32b5b7;});return db[_0xb944('0x32')][_0xb944('0x62')](_0x17fdb7,{'transaction':_0x18bc87});});})[_0xb944('0x29')](function(){return db[_0xb944('0x32')][_0xb944('0x4a')]({'where':{'IntervalId':_0x104df6[_0xb944('0x4d')]['id']}});});}})['then'](respondWithResult(_0xaea98b,null))['catch'](handleError(_0xaea98b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 16ddf8f..211b69f 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 _0xc401=['path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','api','moment','bluebird'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xc401,0x1ea));var _0x1c40=function(_0x312e3b,_0x3afd66){_0x312e3b=_0x312e3b-0x0;var _0x28a470=_0xc401[_0x312e3b];return _0x28a470;};'use strict';var _=require(_0x1c40('0x0'));var util=require(_0x1c40('0x1'));var logger=require('../../config/logger')(_0x1c40('0x2'));var moment=require(_0x1c40('0x3'));var BPromise=require(_0x1c40('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c40('0x5'));var rimraf=require(_0x1c40('0x6'));var config=require(_0x1c40('0x7'));var attributes=require(_0x1c40('0x8'));var extensions=require(_0x1c40('0x9'));module[_0x1c40('0xa')]=function(_0x1c0267,_0x5eaff7){return _0x1c0267[_0x1c40('0xb')](_0x1c40('0xc'),attributes,{'tableName':_0x1c40('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x536040,_0x34cf6c){extensions[_0x1c40('0xe')](_0x1c0267,_0x536040);},'afterBulkCreate':function(_0x35de7f,_0x2b7dac,_0x54adb2){_0x54adb2();extensions[_0x1c40('0xe')](_0x1c0267,_0x35de7f[0x0]);},'afterUpdate':function(_0xb770bb,_0x1b63f3){extensions[_0x1c40('0xe')](_0x1c0267,_0xb770bb);},'afterDestroy':function(_0x1c76cb,_0xc732b5){extensions[_0x1c40('0xe')](_0x1c0267,_0x1c76cb);}}});}; \ No newline at end of file +var _0x0505=['./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0xa81926,_0x38e368){var _0x8177ef=function(_0x2b3726){while(--_0x2b3726){_0xa81926['push'](_0xa81926['shift']());}};_0x8177ef(++_0x38e368);}(_0x0505,0xe7));var _0x5050=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0505[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5050('0x0'));var util=require('util');var logger=require(_0x5050('0x1'))(_0x5050('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5050('0x3'));var fs=require('fs');var path=require(_0x5050('0x4'));var rimraf=require(_0x5050('0x5'));var config=require(_0x5050('0x6'));var attributes=require(_0x5050('0x7'));var extensions=require(_0x5050('0x8'));module[_0x5050('0x9')]=function(_0x10023c,_0x23c986){return _0x10023c[_0x5050('0xa')](_0x5050('0xb'),attributes,{'tableName':_0x5050('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e63f6,_0x758511){extensions['rewrite'](_0x10023c,_0x3e63f6);},'afterBulkCreate':function(_0x175c2d,_0x5d755b,_0x496341){_0x496341();extensions['rewrite'](_0x10023c,_0x175c2d[0x0]);},'afterUpdate':function(_0xa931e4,_0x247d1f){extensions[_0x5050('0xd')](_0x10023c,_0xa931e4);},'afterDestroy':function(_0x4ae051,_0x295c73){extensions[_0x5050('0xd')](_0x10023c,_0x4ae051);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 4f31408..1bae978 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(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 0af17c6..5221f17 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x4bc027,_0x433587){var _0x227241=function(_0x33ccc8){while(--_0x33ccc8){_0x4bc027['push'](_0x4bc027['shift']());}};_0x227241(++_0x433587);}(_0xadb5,0xad));var _0x5adb=function(_0x25c00a,_0x238dfd){_0x25c00a=_0x25c00a-0x0;var _0x5e452c=_0xadb5[_0x25c00a];return _0x5e452c;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index c704aaf..c563805 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 _0xcafe=['email','customfield_11501','oldToken','newToken','customfield_11503','customfield_11504','reason','customfield_10102','/rest/api/2/issue','toString','request','setEncoding','utf8','data','end','status','json','parse','error','api.jira','write','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xcafe,0x9d));var _0xecaf=function(_0xc02aa5,_0x1c36bc){_0xc02aa5=_0xc02aa5-0x0;var _0x31f6a2=_0xcafe[_0xc02aa5];return _0x31f6a2;};'use strict';var BPromise=require(_0xecaf('0x0'));var https=require(_0xecaf('0x1'));var logger=require(_0xecaf('0x2'))(_0xecaf('0x3'));var USERNAME=_0xecaf('0x4');var PASSWORD=_0xecaf('0x5');function openIssue(_0x317e9d,_0x2be93e){var _0x244f84={'fields':{'project':{'key':_0x317e9d['key']||_0xecaf('0x6')},'summary':(_0x317e9d[_0xecaf('0x7')]||'Report')+_0xecaf('0x8')+_0x317e9d['ip'],'description':_0x317e9d[_0xecaf('0x9')]||JSON[_0xecaf('0xa')](_0x317e9d),'issuetype':{'name':_0x317e9d[_0xecaf('0xb')]||_0xecaf('0xc')}}};_0x244f84[_0xecaf('0xd')][_0xecaf('0xe')]=_0x317e9d[_0xecaf('0xf')];_0x244f84[_0xecaf('0xd')][_0xecaf('0x10')]=_0x317e9d[_0xecaf('0x11')];_0x244f84[_0xecaf('0xd')]['customfield_11502']=_0x317e9d[_0xecaf('0x12')];_0x244f84[_0xecaf('0xd')][_0xecaf('0x13')]=_0x317e9d['name'];_0x244f84[_0xecaf('0xd')][_0xecaf('0x14')]=_0x317e9d[_0xecaf('0x15')];_0x244f84[_0xecaf('0xd')][_0xecaf('0x16')]=_0x317e9d['ip'];var _0x3a087f={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xecaf('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xecaf('0x18')]('base64')}};var _0x361cb1=JSON['stringify'](_0x244f84);var _0x1900f2=https[_0xecaf('0x19')](_0x3a087f,function(_0x1d755){_0x1d755[_0xecaf('0x1a')](_0xecaf('0x1b'));var _0x403844='';_0x1d755['on'](_0xecaf('0x1c'),function(_0x127905){_0x403844+=_0x127905;});_0x1d755['on'](_0xecaf('0x1d'),function(){if(_0x2be93e){return _0x2be93e[_0xecaf('0x1e')](_0x1d755['statusCode'])[_0xecaf('0x1f')](JSON[_0xecaf('0x20')](_0x403844));}});});_0x1900f2['on'](_0xecaf('0x21'),function(_0x5e9b4e){if(_0x2be93e){return _0x2be93e[_0xecaf('0x1e')](0x1f4)[_0xecaf('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xecaf('0x22')}]});}});_0x1900f2[_0xecaf('0x23')](_0x361cb1);_0x1900f2['end']();}exports[_0xecaf('0x24')]=openIssue;exports['send']=function(_0x30fb13,_0x73fee4){_0x30fb13['body']['ip']=_0x30fb13[_0xecaf('0x25')][_0xecaf('0x26')]||_0x30fb13[_0xecaf('0x27')][_0xecaf('0x28')]||_0x30fb13['socket'][_0xecaf('0x28')]||_0x30fb13[_0xecaf('0x27')][_0xecaf('0x29')]['remoteAddress'];return openIssue(_0x30fb13[_0xecaf('0x2a')],_0x73fee4);}; \ No newline at end of file +var _0xd09c=['data','end','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','https','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','setEncoding','utf8'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd09c,0x16f));var _0xcd09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd09c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var https=require(_0xcd09('0x0'));var logger=require('../../config/logger')(_0xcd09('0x1'));var USERNAME=_0xcd09('0x2');var PASSWORD=_0xcd09('0x3');function openIssue(_0x5066b5,_0x336681){var _0x39bb17={'fields':{'project':{'key':_0x5066b5[_0xcd09('0x4')]||_0xcd09('0x5')},'summary':(_0x5066b5['summary']||_0xcd09('0x6'))+_0xcd09('0x7')+_0x5066b5['ip'],'description':_0x5066b5['description']||JSON[_0xcd09('0x8')](_0x5066b5),'issuetype':{'name':_0x5066b5['issuetype']||_0xcd09('0x9')}}};_0x39bb17[_0xcd09('0xa')][_0xcd09('0xb')]=_0x5066b5[_0xcd09('0xc')];_0x39bb17[_0xcd09('0xa')][_0xcd09('0xd')]=_0x5066b5[_0xcd09('0xe')];_0x39bb17[_0xcd09('0xa')][_0xcd09('0xf')]=_0x5066b5[_0xcd09('0x10')];_0x39bb17[_0xcd09('0xa')][_0xcd09('0x11')]=_0x5066b5['name'];_0x39bb17[_0xcd09('0xa')][_0xcd09('0x12')]=_0x5066b5[_0xcd09('0x13')];_0x39bb17[_0xcd09('0xa')][_0xcd09('0x14')]=_0x5066b5['ip'];var _0x5381a2={'host':_0xcd09('0x15'),'port':0x1bb,'path':_0xcd09('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xcd09('0x17'),'Authorization':_0xcd09('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xcd09('0x19')](_0xcd09('0x1a'))}};var _0x5bf858=JSON['stringify'](_0x39bb17);var _0x9ec693=https['request'](_0x5381a2,function(_0x1977d2){_0x1977d2[_0xcd09('0x1b')](_0xcd09('0x1c'));var _0x90f080='';_0x1977d2['on'](_0xcd09('0x1d'),function(_0x29976f){_0x90f080+=_0x29976f;});_0x1977d2['on'](_0xcd09('0x1e'),function(){if(_0x336681){return _0x336681[_0xcd09('0x1f')](_0x1977d2[_0xcd09('0x20')])['json'](JSON[_0xcd09('0x21')](_0x90f080));}});});_0x9ec693['on']('error',function(_0x5dea77){if(_0x336681){return _0x336681['status'](0x1f4)[_0xcd09('0x22')]({'errors':[{'message':_0xcd09('0x23'),'type':'api.jira'}]});}});_0x9ec693[_0xcd09('0x24')](_0x5bf858);_0x9ec693['end']();}exports[_0xcd09('0x25')]=openIssue;exports[_0xcd09('0x26')]=function(_0x103f6d,_0x221f27){_0x103f6d[_0xcd09('0x27')]['ip']=_0x103f6d[_0xcd09('0x28')][_0xcd09('0x29')]||_0x103f6d[_0xcd09('0x2a')][_0xcd09('0x2b')]||_0x103f6d['socket'][_0xcd09('0x2b')]||_0x103f6d['connection']['socket']['remoteAddress'];return openIssue(_0x103f6d[_0xcd09('0x27')],_0x221f27);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b38bd76..b49e325 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 _0x6c76=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c76,0x184));var _0x66c7=function(_0x479461,_0x148d02){_0x479461=_0x479461-0x0;var _0x3c6585=_0x6c76[_0x479461];return _0x3c6585;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0xc')]('/',auth[_0x66c7('0x8')](),controller[_0x66c7('0xd')]);router['put'](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0xe')]);router[_0x66c7('0xf')](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x8ef611,_0x439e6c){var _0x54a581=function(_0xcda69f){while(--_0xcda69f){_0x8ef611['push'](_0x8ef611['shift']());}};_0x54a581(++_0x439e6c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xcb91[_0x1bc0ae];return _0x501104;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 708c7f9..5b5558b 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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x271188,_0x5a01cd){_0x271188=_0x271188-0x0;var _0xf4b453=_0x7a54[_0x271188];return _0xf4b453;};'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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x7b9af0,_0x4936e7){_0x7b9af0=_0x7b9af0-0x0;var _0x497e1e=_0x7a54[_0x7b9af0];return _0x497e1e;};'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 29aeba3..cb63f7c 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 _0x9f02=['count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','catch','show','params','body','find','describe','eml-format','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','undefined'];(function(_0x54a49a,_0x4fab2e){var _0x1e8db8=function(_0x41b1f1){while(--_0x41b1f1){_0x54a49a['push'](_0x54a49a['shift']());}};_0x1e8db8(++_0x4fab2e);}(_0x9f02,0x68));var _0x29f0=function(_0x5d677b,_0x3d2a51){_0x5d677b=_0x5d677b-0x0;var _0x2816b4=_0x9f02[_0x5d677b];return _0x2816b4;};'use strict';var emlformat=require(_0x29f0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x29f0('0x1'));var moment=require(_0x29f0('0x2'));var BPromise=require(_0x29f0('0x3'));var Mustache=require(_0x29f0('0x4'));var util=require(_0x29f0('0x5'));var path=require('path');var sox=require(_0x29f0('0x6'));var csv=require('to-csv');var ejs=require(_0x29f0('0x7'));var fs=require('fs');var fs_extra=require(_0x29f0('0x8'));var _=require(_0x29f0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29f0('0xa'));var toCsv=require('to-csv');var querystring=require(_0x29f0('0xb'));var Papa=require(_0x29f0('0xc'));var Redis=require(_0x29f0('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29f0('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x29f0('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x29f0('0x10'))['db'];function respondWithStatusCode(_0x4faa1a,_0xdc7a5d){_0xdc7a5d=_0xdc7a5d||0xcc;return function(_0x3fe285){if(_0x3fe285){return _0x4faa1a[_0x29f0('0x11')](_0xdc7a5d);}return _0x4faa1a[_0x29f0('0x12')](_0xdc7a5d)['end']();};}function respondWithResult(_0x4071f6,_0x2db422){_0x2db422=_0x2db422||0xc8;return function(_0x5ee106){if(_0x5ee106){return _0x4071f6[_0x29f0('0x12')](_0x2db422)['json'](_0x5ee106);}};}function respondWithFilteredResult(_0x31bc0f,_0x495bc8){return function(_0x3d45ae){if(_0x3d45ae){var _0x37e3ab=typeof _0x495bc8['offset']==='undefined'&&typeof _0x495bc8['limit']===_0x29f0('0x13');var _0x3817ee=_0x3d45ae[_0x29f0('0x14')];var _0x528f6f=_0x37e3ab?0x0:_0x495bc8[_0x29f0('0x15')];var _0x3416c1=_0x37e3ab?_0x3d45ae[_0x29f0('0x14')]:_0x495bc8[_0x29f0('0x15')]+_0x495bc8[_0x29f0('0x16')];var _0x5a8b67;if(_0x3416c1>=_0x3817ee){_0x3416c1=_0x3817ee;_0x5a8b67=0xc8;}else{_0x5a8b67=0xce;}_0x31bc0f[_0x29f0('0x12')](_0x5a8b67);return _0x31bc0f[_0x29f0('0x17')](_0x29f0('0x18'),_0x528f6f+'-'+_0x3416c1+'/'+_0x3817ee)['json'](_0x3d45ae);}return null;};}function patchUpdates(_0x2fd36b){return function(_0x4f2fa1){try{jsonpatch[_0x29f0('0x19')](_0x4f2fa1,_0x2fd36b,!![]);}catch(_0x2cb73f){return BPromise[_0x29f0('0x1a')](_0x2cb73f);}return _0x4f2fa1['save']();};}function saveUpdates(_0x419e12,_0x45a7ae){return function(_0x23e691){if(_0x23e691){return _0x23e691[_0x29f0('0x1b')](_0x419e12)[_0x29f0('0x1c')](function(_0x5ef0c7){return _0x5ef0c7;});}return null;};}function removeEntity(_0x3c0e47,_0x3a726a){return function(_0x35c663){if(_0x35c663){return _0x35c663[_0x29f0('0x1d')]()[_0x29f0('0x1c')](function(){_0x3c0e47[_0x29f0('0x12')](0xcc)[_0x29f0('0x1e')]();});}};}function handleEntityNotFound(_0x3ee1ab,_0x12ccdd){return function(_0x2012c3){if(!_0x2012c3){_0x3ee1ab[_0x29f0('0x11')](0x194);}return _0x2012c3;};}function handleError(_0x51043d,_0x1c8d74){_0x1c8d74=_0x1c8d74||0x1f4;return function(_0x4e2153){logger['error'](_0x4e2153['stack']);if(_0x4e2153[_0x29f0('0x1f')]){delete _0x4e2153[_0x29f0('0x1f')];}_0x51043d['status'](_0x1c8d74)[_0x29f0('0x20')](_0x4e2153);};}exports[_0x29f0('0x21')]=function(_0x115996,_0x4fcd9b){var _0x56f7ec={},_0x1ac3ff={},_0x3dc23b={'count':0x0,'rows':[]};var _0x4187d7=_[_0x29f0('0x22')](db[_0x29f0('0x23')]['rawAttributes'],function(_0x2927e7){return{'name':_0x2927e7[_0x29f0('0x24')],'type':_0x2927e7[_0x29f0('0x25')][_0x29f0('0x26')]};});_0x1ac3ff[_0x29f0('0x27')]=_[_0x29f0('0x22')](_0x4187d7,_0x29f0('0x1f'));_0x1ac3ff['query']=_[_0x29f0('0x28')](_0x115996[_0x29f0('0x29')]);_0x1ac3ff['filters']=_[_0x29f0('0x2a')](_0x1ac3ff[_0x29f0('0x27')],_0x1ac3ff['query']);_0x56f7ec['attributes']=_[_0x29f0('0x2a')](_0x1ac3ff['model'],qs[_0x29f0('0x2b')](_0x115996['query'][_0x29f0('0x2b')]));_0x56f7ec[_0x29f0('0x2c')]=_0x56f7ec['attributes'][_0x29f0('0x2d')]?_0x56f7ec['attributes']:_0x1ac3ff[_0x29f0('0x27')];if(!_0x115996[_0x29f0('0x29')][_0x29f0('0x2e')](_0x29f0('0x2f'))){_0x56f7ec['limit']=qs[_0x29f0('0x16')](_0x115996['query'][_0x29f0('0x16')]);_0x56f7ec[_0x29f0('0x15')]=qs[_0x29f0('0x15')](_0x115996[_0x29f0('0x29')][_0x29f0('0x15')]);}_0x56f7ec[_0x29f0('0x30')]=qs[_0x29f0('0x31')](_0x115996['query'][_0x29f0('0x31')]);_0x56f7ec[_0x29f0('0x32')]=qs[_0x29f0('0x33')](_['pick'](_0x115996[_0x29f0('0x29')],_0x1ac3ff[_0x29f0('0x33')]),_0x4187d7);if(_0x115996['query'][_0x29f0('0x34')]){_0x56f7ec[_0x29f0('0x32')]=_[_0x29f0('0x35')](_0x56f7ec[_0x29f0('0x32')],{'$or':_['map'](_0x4187d7,function(_0x343b54){if(_0x343b54[_0x29f0('0x25')]!=='VIRTUAL'){var _0x51101d={};_0x51101d[_0x343b54[_0x29f0('0x1f')]]={'$like':'%'+_0x115996[_0x29f0('0x29')][_0x29f0('0x34')]+'%'};return _0x51101d;}})});}_0x56f7ec=_[_0x29f0('0x35')]({},_0x56f7ec,_0x115996[_0x29f0('0x36')]);var _0x348d39={'where':_0x56f7ec[_0x29f0('0x32')]};return db[_0x29f0('0x23')][_0x29f0('0x14')](_0x348d39)[_0x29f0('0x1c')](function(_0x4a975a){_0x3dc23b['count']=_0x4a975a;if(_0x115996[_0x29f0('0x29')][_0x29f0('0x37')]){_0x56f7ec['include']=[{'all':!![]}];}return db[_0x29f0('0x23')]['findAll'](_0x56f7ec);})[_0x29f0('0x1c')](function(_0x582784){_0x3dc23b['rows']=_0x582784;return _0x3dc23b;})[_0x29f0('0x1c')](respondWithFilteredResult(_0x4fcd9b,_0x56f7ec))[_0x29f0('0x38')](handleError(_0x4fcd9b,null));};exports[_0x29f0('0x39')]=function(_0x42caa5,_0x53837e){var _0x15bd61={'raw':!![],'where':{'id':_0x42caa5[_0x29f0('0x3a')]['id']}},_0x243784={};_0x243784[_0x29f0('0x27')]=_['keys'](db[_0x29f0('0x23')]['rawAttributes']);_0x243784[_0x29f0('0x29')]=_[_0x29f0('0x28')](_0x42caa5[_0x29f0('0x29')]);_0x243784['filters']=_[_0x29f0('0x2a')](_0x243784[_0x29f0('0x27')],_0x243784['query']);_0x15bd61[_0x29f0('0x2c')]=_[_0x29f0('0x2a')](_0x243784[_0x29f0('0x27')],qs[_0x29f0('0x2b')](_0x42caa5[_0x29f0('0x29')][_0x29f0('0x2b')]));_0x15bd61[_0x29f0('0x2c')]=_0x15bd61[_0x29f0('0x2c')][_0x29f0('0x2d')]?_0x15bd61[_0x29f0('0x2c')]:_0x243784[_0x29f0('0x27')];if(_0x42caa5[_0x29f0('0x29')][_0x29f0('0x37')]){_0x15bd61['include']=[{'all':!![]}];}_0x15bd61=_[_0x29f0('0x35')]({},_0x15bd61,_0x42caa5[_0x29f0('0x36')]);return db[_0x29f0('0x23')]['find'](_0x15bd61)['then'](handleEntityNotFound(_0x53837e,null))[_0x29f0('0x1c')](respondWithResult(_0x53837e,null))[_0x29f0('0x38')](handleError(_0x53837e,null));};exports['create']=function(_0x1f8d49,_0x3191f6){return db['JscriptyAnswerReport']['create'](_0x1f8d49[_0x29f0('0x3b')],{})['then'](respondWithResult(_0x3191f6,0xc9))['catch'](handleError(_0x3191f6,null));};exports[_0x29f0('0x1b')]=function(_0x1f4a53,_0x1c7fd1){if(_0x1f4a53['body']['id']){delete _0x1f4a53[_0x29f0('0x3b')]['id'];}return db[_0x29f0('0x23')][_0x29f0('0x3c')]({'where':{'id':_0x1f4a53[_0x29f0('0x3a')]['id']}})[_0x29f0('0x1c')](handleEntityNotFound(_0x1c7fd1,null))[_0x29f0('0x1c')](saveUpdates(_0x1f4a53[_0x29f0('0x3b')],null))['then'](respondWithResult(_0x1c7fd1,null))[_0x29f0('0x38')](handleError(_0x1c7fd1,null));};exports[_0x29f0('0x1d')]=function(_0xbb0557,_0x2c746e){return db[_0x29f0('0x23')]['find']({'where':{'id':_0xbb0557['params']['id']}})[_0x29f0('0x1c')](handleEntityNotFound(_0x2c746e,null))[_0x29f0('0x1c')](removeEntity(_0x2c746e,null))[_0x29f0('0x38')](handleError(_0x2c746e,null));};exports[_0x29f0('0x3d')]=function(_0x48354c,_0x1ccecb){return db['JscriptyAnswerReport'][_0x29f0('0x3d')]()['then'](respondWithResult(_0x1ccecb,null))['catch'](handleError(_0x1ccecb,null));}; \ No newline at end of file +var _0x2caf=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName'];(function(_0x5c5d59,_0x2bd27b){var _0x49717f=function(_0x159bbd){while(--_0x159bbd){_0x5c5d59['push'](_0x5c5d59['shift']());}};_0x49717f(++_0x2bd27b);}(_0x2caf,0x6a));var _0xf2ca=function(_0x150d10,_0x242363){_0x150d10=_0x150d10-0x0;var _0x15e15a=_0x2caf[_0x150d10];return _0x15e15a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf2ca('0x0'));var rp=require('request-promise');var moment=require(_0xf2ca('0x1'));var BPromise=require(_0xf2ca('0x2'));var Mustache=require(_0xf2ca('0x3'));var util=require(_0xf2ca('0x4'));var path=require(_0xf2ca('0x5'));var sox=require(_0xf2ca('0x6'));var csv=require(_0xf2ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2ca('0x8'));var _=require(_0xf2ca('0x9'));var squel=require(_0xf2ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf2ca('0xb'));var toCsv=require(_0xf2ca('0x7'));var querystring=require(_0xf2ca('0xc'));var Papa=require(_0xf2ca('0xd'));var Redis=require(_0xf2ca('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf2ca('0xf'));var as=require(_0xf2ca('0x10'));var hardwareService=require(_0xf2ca('0x11'));var logger=require(_0xf2ca('0x12'))(_0xf2ca('0x13'));var utils=require(_0xf2ca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf2ca('0x15'));var db=require(_0xf2ca('0x16'))['db'];function respondWithStatusCode(_0x54a3cb,_0x88529f){_0x88529f=_0x88529f||0xcc;return function(_0x383112){if(_0x383112){return _0x54a3cb['sendStatus'](_0x88529f);}return _0x54a3cb['status'](_0x88529f)[_0xf2ca('0x17')]();};}function respondWithResult(_0x52a278,_0x284484){_0x284484=_0x284484||0xc8;return function(_0x3123fe){if(_0x3123fe){return _0x52a278[_0xf2ca('0x18')](_0x284484)[_0xf2ca('0x19')](_0x3123fe);}};}function respondWithFilteredResult(_0x410997,_0x2057a2){return function(_0x2ddfac){if(_0x2ddfac){var _0x5aec64=typeof _0x2057a2[_0xf2ca('0x1a')]==='undefined'&&typeof _0x2057a2[_0xf2ca('0x1b')]==='undefined';var _0x235e79=_0x2ddfac[_0xf2ca('0x1c')];var _0x59ea3c=_0x5aec64?0x0:_0x2057a2[_0xf2ca('0x1a')];var _0x160230=_0x5aec64?_0x2ddfac[_0xf2ca('0x1c')]:_0x2057a2[_0xf2ca('0x1a')]+_0x2057a2[_0xf2ca('0x1b')];var _0x1ca233;if(_0x160230>=_0x235e79){_0x160230=_0x235e79;_0x1ca233=0xc8;}else{_0x1ca233=0xce;}_0x410997[_0xf2ca('0x18')](_0x1ca233);return _0x410997[_0xf2ca('0x1d')](_0xf2ca('0x1e'),_0x59ea3c+'-'+_0x160230+'/'+_0x235e79)[_0xf2ca('0x19')](_0x2ddfac);}return null;};}function patchUpdates(_0xea662){return function(_0x55dc6a){try{jsonpatch[_0xf2ca('0x1f')](_0x55dc6a,_0xea662,!![]);}catch(_0x45a028){return BPromise[_0xf2ca('0x20')](_0x45a028);}return _0x55dc6a[_0xf2ca('0x21')]();};}function saveUpdates(_0x41cb71,_0x386c58){return function(_0x1bbd60){if(_0x1bbd60){return _0x1bbd60[_0xf2ca('0x22')](_0x41cb71)['then'](function(_0x14791b){return _0x14791b;});}return null;};}function removeEntity(_0x1767f7,_0x56ebed){return function(_0x1c032c){if(_0x1c032c){return _0x1c032c[_0xf2ca('0x23')]()[_0xf2ca('0x24')](function(){_0x1767f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbfcb0b,_0x1b3c01){return function(_0x214fa9){if(!_0x214fa9){_0xbfcb0b[_0xf2ca('0x25')](0x194);}return _0x214fa9;};}function handleError(_0x1255ba,_0x427a17){_0x427a17=_0x427a17||0x1f4;return function(_0x339e10){logger[_0xf2ca('0x26')](_0x339e10['stack']);if(_0x339e10[_0xf2ca('0x27')]){delete _0x339e10[_0xf2ca('0x27')];}_0x1255ba[_0xf2ca('0x18')](_0x427a17)[_0xf2ca('0x28')](_0x339e10);};}exports[_0xf2ca('0x29')]=function(_0x41fc04,_0x17707e){var _0xb0ae21={},_0x1b44fb={},_0x20a523={'count':0x0,'rows':[]};var _0xf92250=_[_0xf2ca('0x2a')](db[_0xf2ca('0x2b')][_0xf2ca('0x2c')],function(_0x2b0649){return{'name':_0x2b0649[_0xf2ca('0x2d')],'type':_0x2b0649[_0xf2ca('0x2e')][_0xf2ca('0x2f')]};});_0x1b44fb[_0xf2ca('0x30')]=_['map'](_0xf92250,_0xf2ca('0x27'));_0x1b44fb[_0xf2ca('0x31')]=_[_0xf2ca('0x32')](_0x41fc04[_0xf2ca('0x31')]);_0x1b44fb[_0xf2ca('0x33')]=_[_0xf2ca('0x34')](_0x1b44fb[_0xf2ca('0x30')],_0x1b44fb[_0xf2ca('0x31')]);_0xb0ae21[_0xf2ca('0x35')]=_['intersection'](_0x1b44fb[_0xf2ca('0x30')],qs[_0xf2ca('0x36')](_0x41fc04[_0xf2ca('0x31')]['fields']));_0xb0ae21[_0xf2ca('0x35')]=_0xb0ae21['attributes'][_0xf2ca('0x37')]?_0xb0ae21[_0xf2ca('0x35')]:_0x1b44fb[_0xf2ca('0x30')];if(!_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x38')]('nolimit')){_0xb0ae21['limit']=qs[_0xf2ca('0x1b')](_0x41fc04['query'][_0xf2ca('0x1b')]);_0xb0ae21[_0xf2ca('0x1a')]=qs[_0xf2ca('0x1a')](_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x1a')]);}_0xb0ae21[_0xf2ca('0x39')]=qs[_0xf2ca('0x3a')](_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3a')]);_0xb0ae21[_0xf2ca('0x3b')]=qs[_0xf2ca('0x33')](_[_0xf2ca('0x3c')](_0x41fc04[_0xf2ca('0x31')],_0x1b44fb[_0xf2ca('0x33')]),_0xf92250);if(_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3d')]){_0xb0ae21['where']=_[_0xf2ca('0x3e')](_0xb0ae21[_0xf2ca('0x3b')],{'$or':_[_0xf2ca('0x2a')](_0xf92250,function(_0x148570){if(_0x148570['type']!==_0xf2ca('0x3f')){var _0x4b0e0e={};_0x4b0e0e[_0x148570[_0xf2ca('0x27')]]={'$like':'%'+_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3d')]+'%'};return _0x4b0e0e;}})});}_0xb0ae21=_[_0xf2ca('0x3e')]({},_0xb0ae21,_0x41fc04[_0xf2ca('0x40')]);var _0x4fbaec={'where':_0xb0ae21[_0xf2ca('0x3b')]};return db[_0xf2ca('0x2b')]['count'](_0x4fbaec)[_0xf2ca('0x24')](function(_0x29ebce){_0x20a523[_0xf2ca('0x1c')]=_0x29ebce;if(_0x41fc04['query'][_0xf2ca('0x41')]){_0xb0ae21['include']=[{'all':!![]}];}return db[_0xf2ca('0x2b')][_0xf2ca('0x42')](_0xb0ae21);})[_0xf2ca('0x24')](function(_0x43b2c2){_0x20a523[_0xf2ca('0x43')]=_0x43b2c2;return _0x20a523;})[_0xf2ca('0x24')](respondWithFilteredResult(_0x17707e,_0xb0ae21))[_0xf2ca('0x44')](handleError(_0x17707e,null));};exports[_0xf2ca('0x45')]=function(_0x43b3c7,_0x128535){var _0x17de81={'raw':!![],'where':{'id':_0x43b3c7[_0xf2ca('0x46')]['id']}},_0x3360d9={};_0x3360d9[_0xf2ca('0x30')]=_[_0xf2ca('0x32')](db['JscriptyAnswerReport'][_0xf2ca('0x2c')]);_0x3360d9[_0xf2ca('0x31')]=_[_0xf2ca('0x32')](_0x43b3c7[_0xf2ca('0x31')]);_0x3360d9[_0xf2ca('0x33')]=_[_0xf2ca('0x34')](_0x3360d9[_0xf2ca('0x30')],_0x3360d9[_0xf2ca('0x31')]);_0x17de81[_0xf2ca('0x35')]=_[_0xf2ca('0x34')](_0x3360d9[_0xf2ca('0x30')],qs[_0xf2ca('0x36')](_0x43b3c7[_0xf2ca('0x31')]['fields']));_0x17de81['attributes']=_0x17de81[_0xf2ca('0x35')][_0xf2ca('0x37')]?_0x17de81['attributes']:_0x3360d9[_0xf2ca('0x30')];if(_0x43b3c7['query'][_0xf2ca('0x41')]){_0x17de81[_0xf2ca('0x47')]=[{'all':!![]}];}_0x17de81=_[_0xf2ca('0x3e')]({},_0x17de81,_0x43b3c7['options']);return db[_0xf2ca('0x2b')][_0xf2ca('0x48')](_0x17de81)['then'](handleEntityNotFound(_0x128535,null))[_0xf2ca('0x24')](respondWithResult(_0x128535,null))[_0xf2ca('0x44')](handleError(_0x128535,null));};exports[_0xf2ca('0x49')]=function(_0x3e92cf,_0x4a6439){return db[_0xf2ca('0x2b')][_0xf2ca('0x49')](_0x3e92cf[_0xf2ca('0x4a')],{})['then'](respondWithResult(_0x4a6439,0xc9))['catch'](handleError(_0x4a6439,null));};exports[_0xf2ca('0x22')]=function(_0x2f7596,_0x1a65c6){if(_0x2f7596[_0xf2ca('0x4a')]['id']){delete _0x2f7596[_0xf2ca('0x4a')]['id'];}return db[_0xf2ca('0x2b')]['find']({'where':{'id':_0x2f7596['params']['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x1a65c6,null))[_0xf2ca('0x24')](saveUpdates(_0x2f7596['body'],null))[_0xf2ca('0x24')](respondWithResult(_0x1a65c6,null))['catch'](handleError(_0x1a65c6,null));};exports[_0xf2ca('0x23')]=function(_0x59bbb8,_0x26a483){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x59bbb8[_0xf2ca('0x46')]['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x26a483,null))['then'](removeEntity(_0x26a483,null))[_0xf2ca('0x44')](handleError(_0x26a483,null));};exports[_0xf2ca('0x4b')]=function(_0x2eb8d5,_0x14850c){return db[_0xf2ca('0x2b')][_0xf2ca('0x4b')]()['then'](respondWithResult(_0x14850c,null))[_0xf2ca('0x44')](handleError(_0x14850c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e1f026d..dfa0ff3 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 _0xb8d8=['report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x1b6871,_0x57f017){var _0x390b7=function(_0x5427e0){while(--_0x5427e0){_0x1b6871['push'](_0x1b6871['shift']());}};_0x390b7(++_0x57f017);}(_0xb8d8,0x199));var _0x8b8d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb8d8[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x8b8d('0x0'));var util=require(_0x8b8d('0x1'));var logger=require(_0x8b8d('0x2'))('api');var moment=require(_0x8b8d('0x3'));var BPromise=require(_0x8b8d('0x4'));var rp=require(_0x8b8d('0x5'));var fs=require('fs');var path=require(_0x8b8d('0x6'));var rimraf=require(_0x8b8d('0x7'));var config=require(_0x8b8d('0x8'));var attributes=require(_0x8b8d('0x9'));module[_0x8b8d('0xa')]=function(_0x25f5d4,_0x3830ce){return _0x25f5d4['define']('JscriptyAnswerReport',attributes,{'tableName':_0x8b8d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f19=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','util'];(function(_0x42e5f4,_0x227c39){var _0xe8c411=function(_0x22748d){while(--_0x22748d){_0x42e5f4['push'](_0x42e5f4['shift']());}};_0xe8c411(++_0x227c39);}(_0x4f19,0x1af));var _0x94f1=function(_0x4c6e4a,_0x100f5f){_0x4c6e4a=_0x4c6e4a-0x0;var _0x3a9ea9=_0x4f19[_0x4c6e4a];return _0x3a9ea9;};'use strict';var _=require('lodash');var util=require(_0x94f1('0x0'));var logger=require(_0x94f1('0x1'))(_0x94f1('0x2'));var moment=require(_0x94f1('0x3'));var BPromise=require(_0x94f1('0x4'));var rp=require(_0x94f1('0x5'));var fs=require('fs');var path=require(_0x94f1('0x6'));var rimraf=require(_0x94f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x94f1('0x8'));module['exports']=function(_0x13f515,_0x1a05ca){return _0x13f515[_0x94f1('0x9')](_0x94f1('0xa'),attributes,{'tableName':_0x94f1('0xb'),'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 4909117..bb49756 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 _0x021a=['message','result','moment','randomstring','../../mysqldb','../../config/environment','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x31aa84,_0x3bcc8b){var _0x2d9e3e=function(_0x4783da){while(--_0x4783da){_0x31aa84['push'](_0x31aa84['shift']());}};_0x2d9e3e(++_0x3bcc8b);}(_0x021a,0x1b2));var _0xa021=function(_0x1fb9d2,_0x57a208){_0x1fb9d2=_0x1fb9d2-0x0;var _0x4a8916=_0x021a[_0x1fb9d2];return _0x4a8916;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa021('0x0'));var BPromise=require('bluebird');var rs=require(_0xa021('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa021('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa021('0x3'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa021('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x1ed1e5,_0x18fe1c,_0x45a6dd){return new BPromise(function(_0x787b19,_0x26c1be){return client[_0xa021('0x5')](_0x1ed1e5,_0x45a6dd)['then'](function(_0x1e25d6){logger[_0xa021('0x6')](_0xa021('0x7'),_0x18fe1c,_0xa021('0x8'));logger[_0xa021('0x9')](_0xa021('0xa'),_0x18fe1c,_0xa021('0x8'),JSON[_0xa021('0xb')](_0x1e25d6));if(_0x1e25d6[_0xa021('0xc')]){if(_0x1e25d6[_0xa021('0xc')][_0xa021('0xd')]===0x1f4){logger[_0xa021('0xc')](_0xa021('0x7'),_0x18fe1c,_0x1e25d6['error'][_0xa021('0xe')]);return _0x26c1be(_0x1e25d6[_0xa021('0xc')][_0xa021('0xe')]);}logger[_0xa021('0xc')](_0xa021('0x7'),_0x18fe1c,_0x1e25d6['error'][_0xa021('0xe')]);return _0x787b19(_0x1e25d6[_0xa021('0xc')]['message']);}else{logger[_0xa021('0x6')](_0xa021('0x7'),_0x18fe1c,'request\x20sent');_0x787b19(_0x1e25d6[_0xa021('0xf')][_0xa021('0xe')]);}})['catch'](function(_0x10ed47){logger[_0xa021('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x18fe1c,_0x10ed47);_0x26c1be(_0x10ed47);});});} \ No newline at end of file +var _0x2005=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x580238,_0x2adec2){var _0x3d5608=function(_0x281c35){while(--_0x281c35){_0x580238['push'](_0x580238['shift']());}};_0x3d5608(++_0x2adec2);}(_0x2005,0xfb));var _0x5200=function(_0x437e8a,_0x44dfba){_0x437e8a=_0x437e8a-0x0;var _0x5e9910=_0x2005[_0x437e8a];return _0x5e9910;};'use strict';var _=require('lodash');var util=require(_0x5200('0x0'));var moment=require(_0x5200('0x1'));var BPromise=require('bluebird');var rs=require(_0x5200('0x2'));var fs=require('fs');var Redis=require(_0x5200('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5200('0x4'));var logger=require(_0x5200('0x5'))('rpc');var config=require(_0x5200('0x6'));var jayson=require(_0x5200('0x7'));var client=jayson[_0x5200('0x8')][_0x5200('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a69d6,_0x572edb,_0x1932de){return new BPromise(function(_0x4ff5c2,_0x26990d){return client[_0x5200('0xa')](_0x4a69d6,_0x1932de)[_0x5200('0xb')](function(_0x44bd34){logger[_0x5200('0xc')](_0x5200('0xd'),_0x572edb,_0x5200('0xe'));logger[_0x5200('0xf')](_0x5200('0x10'),_0x572edb,'request\x20sent',JSON[_0x5200('0x11')](_0x44bd34));if(_0x44bd34['error']){if(_0x44bd34['error'][_0x5200('0x12')]===0x1f4){logger['error'](_0x5200('0xd'),_0x572edb,_0x44bd34[_0x5200('0x13')][_0x5200('0x14')]);return _0x26990d(_0x44bd34[_0x5200('0x13')][_0x5200('0x14')]);}logger['error'](_0x5200('0xd'),_0x572edb,_0x44bd34[_0x5200('0x13')][_0x5200('0x14')]);return _0x4ff5c2(_0x44bd34[_0x5200('0x13')][_0x5200('0x14')]);}else{logger[_0x5200('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x572edb,_0x5200('0xe'));_0x4ff5c2(_0x44bd34['result'][_0x5200('0x14')]);}})[_0x5200('0x15')](function(_0x3e6629){logger['error'](_0x5200('0xd'),_0x572edb,_0x3e6629);_0x26990d(_0x3e6629);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d260b1b..729a236 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 _0xcd71=['/:id/summary','30s','getSummary','create','post','clone','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','show','/:id/sessions','getSessions','isAuthenticated','getAnswers'];(function(_0x570b19,_0xe4cb1f){var _0x44c8ce=function(_0x2a93e8){while(--_0x2a93e8){_0x570b19['push'](_0x570b19['shift']());}};_0x44c8ce(++_0xe4cb1f);}(_0xcd71,0x168));var _0x1cd7=function(_0x5aa1e2,_0x2b5adb){_0x5aa1e2=_0x5aa1e2-0x0;var _0x399098=_0xcd71[_0x5aa1e2];return _0x399098;};'use strict';var multer=require(_0x1cd7('0x0'));var util=require(_0x1cd7('0x1'));var path=require(_0x1cd7('0x2'));var timeout=require(_0x1cd7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1cd7('0x4'));var interaction=require(_0x1cd7('0x5'));var config=require(_0x1cd7('0x6'));var controller=require(_0x1cd7('0x7'));router[_0x1cd7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1cd7('0x8')](_0x1cd7('0x9'),auth['isAuthenticated'](),controller[_0x1cd7('0xa')]);router[_0x1cd7('0x8')](_0x1cd7('0xb'),auth['isAuthenticated'](),controller[_0x1cd7('0xc')]);router[_0x1cd7('0x8')]('/:id/answers',auth[_0x1cd7('0xd')](),controller[_0x1cd7('0xe')]);router[_0x1cd7('0x8')](_0x1cd7('0xf'),auth['isAuthenticated'](),timeout(_0x1cd7('0x10')),controller[_0x1cd7('0x11')]);router['post']('/',auth[_0x1cd7('0xd')](),controller[_0x1cd7('0x12')]);router[_0x1cd7('0x13')]('/:id/clone',auth[_0x1cd7('0xd')](),controller[_0x1cd7('0x14')]);router[_0x1cd7('0x15')]('/:id',auth[_0x1cd7('0xd')](),controller[_0x1cd7('0x16')]);router['delete']('/:id',auth[_0x1cd7('0xd')](),controller[_0x1cd7('0x17')]);module[_0x1cd7('0x18')]=router; \ No newline at end of file +var _0x520c=['getAnswers','get','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers'];(function(_0x2425b3,_0x32ca53){var _0x2b9ebd=function(_0x526217){while(--_0x526217){_0x2425b3['push'](_0x2425b3['shift']());}};_0x2b9ebd(++_0x32ca53);}(_0x520c,0x9e));var _0xc520=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x520c[_0x58a4ac];return _0x545810;};'use strict';var multer=require(_0xc520('0x0'));var util=require(_0xc520('0x1'));var path=require(_0xc520('0x2'));var timeout=require(_0xc520('0x3'));var express=require('express');var router=express[_0xc520('0x4')]();var fs_extra=require(_0xc520('0x5'));var auth=require(_0xc520('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc520('0x7'));var controller=require(_0xc520('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc520('0x9')]);router['get'](_0xc520('0xa'),auth[_0xc520('0xb')](),controller[_0xc520('0xc')]);router['get'](_0xc520('0xd'),auth[_0xc520('0xb')](),controller[_0xc520('0xe')]);router['get'](_0xc520('0xf'),auth[_0xc520('0xb')](),controller[_0xc520('0x10')]);router[_0xc520('0x11')](_0xc520('0x12'),auth[_0xc520('0xb')](),timeout(_0xc520('0x13')),controller['getSummary']);router[_0xc520('0x14')]('/',auth['isAuthenticated'](),controller[_0xc520('0x15')]);router[_0xc520('0x14')](_0xc520('0x16'),auth[_0xc520('0xb')](),controller[_0xc520('0x17')]);router[_0xc520('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xc520('0x19')]);router[_0xc520('0x1a')]('/:id',auth[_0xc520('0xb')](),controller[_0xc520('0x1b')]);module[_0xc520('0x1c')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c44c877..8c00ad3 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 _0x6eca=['description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x57fae6,_0x4a28ed){var _0x50e6b2=function(_0xa3d92){while(--_0xa3d92){_0x57fae6['push'](_0x57fae6['shift']());}};_0x50e6b2(++_0x4a28ed);}(_0x6eca,0xb2));var _0xa6ec=function(_0x1bd4a5,_0x7e771e){_0x1bd4a5=_0x1bd4a5-0x0;var _0x2741a9=_0x6eca[_0x1bd4a5];return _0x2741a9;};'use strict';var Sequelize=require(_0xa6ec('0x0'));var _=require('lodash');var util=require(_0xa6ec('0x1'));module[_0xa6ec('0x2')]={'name':{'type':Sequelize[_0xa6ec('0x3')],'unique':_0xa6ec('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa6ec('0x5')](_0xa6ec('0x6')),'set':function(_0x509de5){if(_['isObjectLike'](_0x509de5)){this[_0xa6ec('0x7')](_0xa6ec('0x8'),JSON[_0xa6ec('0x9')](_0x509de5));}else if(_[_0xa6ec('0xa')](_0x509de5)){this[_0xa6ec('0x7')](_0xa6ec('0x8'),_0x509de5);}else{this['setDataValue'](_0xa6ec('0x8'),util[_0xa6ec('0xb')](_0xa6ec('0xc'),this[_0xa6ec('0xd')](_0xa6ec('0x4'))||'',this[_0xa6ec('0xd')](_0xa6ec('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa6ec('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7c12=['name','description','BOOLEAN','sequelize','lodash','util','STRING','long','stringify','isString','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x2355dc,_0x4e56c6){var _0x92e239=function(_0x7d6872){while(--_0x7d6872){_0x2355dc['push'](_0x2355dc['shift']());}};_0x92e239(++_0x4e56c6);}(_0x7c12,0x8a));var _0x27c1=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0x7c12[_0x2e76a7];return _0x454cde;};'use strict';var Sequelize=require(_0x27c1('0x0'));var _=require(_0x27c1('0x1'));var util=require(_0x27c1('0x2'));module['exports']={'name':{'type':Sequelize[_0x27c1('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x27c1('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x27c1('0x4')),'set':function(_0x5e2be7){if(_['isObjectLike'](_0x5e2be7)){this['setDataValue']('formData',JSON[_0x27c1('0x5')](_0x5e2be7));}else if(_[_0x27c1('0x6')](_0x5e2be7)){this[_0x27c1('0x7')](_0x27c1('0x8'),_0x5e2be7);}else{this[_0x27c1('0x7')]('formData',util[_0x27c1('0x9')](_0x27c1('0xa'),this[_0x27c1('0xb')](_0x27c1('0xc'))||'',this[_0x27c1('0xb')](_0x27c1('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x27c1('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x27c1('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e1f6113..7b039ec 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 _0xa0a3=['JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','isEmpty','now','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getSessions','JscriptySessionReport','nolimit','order','ProjectId','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime'];(function(_0x3325f3,_0x1a7c46){var _0x5af307=function(_0x338bbe){while(--_0x338bbe){_0x3325f3['push'](_0x3325f3['shift']());}};_0x5af307(++_0x1a7c46);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x5e977f,_0x4b32bf){_0x5e977f=_0x5e977f-0x0;var _0x5c11dd=_0xa0a3[_0x5e977f];return _0x5c11dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a0a('0x0'));var zipdir=require(_0x3a0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a0a('0x2'));var moment=require(_0x3a0a('0x3'));var BPromise=require(_0x3a0a('0x4'));var Mustache=require(_0x3a0a('0x5'));var util=require(_0x3a0a('0x6'));var path=require(_0x3a0a('0x7'));var sox=require(_0x3a0a('0x8'));var csv=require(_0x3a0a('0x9'));var ejs=require(_0x3a0a('0xa'));var fs=require('fs');var fs_extra=require(_0x3a0a('0xb'));var _=require(_0x3a0a('0xc'));var squel=require(_0x3a0a('0xd'));var crypto=require(_0x3a0a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3a0a('0x9'));var querystring=require(_0x3a0a('0xf'));var Papa=require(_0x3a0a('0x10'));var Redis=require(_0x3a0a('0x11'));var authService=require(_0x3a0a('0x12'));var qs=require(_0x3a0a('0x13'));var as=require(_0x3a0a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3a0a('0x15'));var utils=require(_0x3a0a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3a0a('0x17'))['db'];function respondWithStatusCode(_0x1db53c,_0x52cb58){_0x52cb58=_0x52cb58||0xcc;return function(_0x2243d2){if(_0x2243d2){return _0x1db53c[_0x3a0a('0x18')](_0x52cb58);}return _0x1db53c[_0x3a0a('0x19')](_0x52cb58)[_0x3a0a('0x1a')]();};}function respondWithResult(_0x977120,_0x303dc7){_0x303dc7=_0x303dc7||0xc8;return function(_0x350d58){if(_0x350d58){return _0x977120[_0x3a0a('0x19')](_0x303dc7)[_0x3a0a('0x1b')](_0x350d58);}};}function respondWithFilteredResult(_0x21e0f7,_0x11eeee){return function(_0x22a60e){if(_0x22a60e){var _0x52f629=typeof _0x11eeee[_0x3a0a('0x1c')]==='undefined'&&typeof _0x11eeee[_0x3a0a('0x1d')]==='undefined';var _0x2f5e77=_0x22a60e[_0x3a0a('0x1e')];var _0x36582f=_0x52f629?0x0:_0x11eeee['offset'];var _0x104679=_0x52f629?_0x22a60e[_0x3a0a('0x1e')]:_0x11eeee['offset']+_0x11eeee[_0x3a0a('0x1d')];var _0x26f7bb;if(_0x104679>=_0x2f5e77){_0x104679=_0x2f5e77;_0x26f7bb=0xc8;}else{_0x26f7bb=0xce;}_0x21e0f7[_0x3a0a('0x19')](_0x26f7bb);return _0x21e0f7[_0x3a0a('0x1f')](_0x3a0a('0x20'),_0x36582f+'-'+_0x104679+'/'+_0x2f5e77)[_0x3a0a('0x1b')](_0x22a60e);}return null;};}function patchUpdates(_0x3e99f9){return function(_0x231541){try{jsonpatch[_0x3a0a('0x21')](_0x231541,_0x3e99f9,!![]);}catch(_0x430509){return BPromise['reject'](_0x430509);}return _0x231541['save']();};}function saveUpdates(_0x483039,_0x33560b){return function(_0x6681b2){if(_0x6681b2){return _0x6681b2[_0x3a0a('0x22')](_0x483039)[_0x3a0a('0x23')](function(_0x1468a9){return _0x1468a9;});}return null;};}function removeEntity(_0x49d60d,_0x280022){return function(_0x1d2eac){if(_0x1d2eac){return _0x1d2eac[_0x3a0a('0x24')]()['then'](function(){var _0x3a5955=_0x1d2eac[_0x3a0a('0x25')]({'plain':!![]});var _0x496348='Projects';return db[_0x3a0a('0x26')][_0x3a0a('0x24')]({'where':{'type':_0x496348,'resourceId':_0x3a5955['id']}})[_0x3a0a('0x23')](function(){return _0x1d2eac;});})['then'](function(){_0x49d60d[_0x3a0a('0x19')](0xcc)[_0x3a0a('0x1a')]();});}};}function handleEntityNotFound(_0x130ca6,_0x188027){return function(_0x122e65){if(!_0x122e65){_0x130ca6['sendStatus'](0x194);}return _0x122e65;};}function handleError(_0x4a5481,_0x453040){_0x453040=_0x453040||0x1f4;return function(_0x3d01d8){logger['error'](_0x3d01d8['stack']);if(_0x3d01d8[_0x3a0a('0x27')]){delete _0x3d01d8[_0x3a0a('0x27')];}_0x4a5481[_0x3a0a('0x19')](_0x453040)[_0x3a0a('0x28')](_0x3d01d8);};}exports['index']=function(_0x5d7760,_0x38aaa0){var _0x23dd57={},_0x177181={},_0x4c99f9={'count':0x0,'rows':[]};var _0x1418b6=_[_0x3a0a('0x29')](db[_0x3a0a('0x2a')][_0x3a0a('0x2b')],function(_0x10b09f){return{'name':_0x10b09f[_0x3a0a('0x2c')],'type':_0x10b09f[_0x3a0a('0x2d')][_0x3a0a('0x2e')]};});_0x177181[_0x3a0a('0x2f')]=_['map'](_0x1418b6,_0x3a0a('0x27'));_0x177181[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x5d7760[_0x3a0a('0x30')]);_0x177181[_0x3a0a('0x32')]=_['intersection'](_0x177181[_0x3a0a('0x2f')],_0x177181[_0x3a0a('0x30')]);_0x23dd57[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x177181[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x5d7760['query'][_0x3a0a('0x35')]));_0x23dd57[_0x3a0a('0x33')]=_0x23dd57[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x23dd57[_0x3a0a('0x33')]:_0x177181[_0x3a0a('0x2f')];if(!_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x37')]('nolimit')){_0x23dd57[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x23dd57[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}_0x23dd57['order']=qs[_0x3a0a('0x38')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x23dd57[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x5d7760[_0x3a0a('0x30')],_0x177181[_0x3a0a('0x32')]),_0x1418b6);if(_0x5d7760[_0x3a0a('0x30')]['filter']){_0x23dd57[_0x3a0a('0x39')]=_['merge'](_0x23dd57[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x1418b6,function(_0x17b5b3){if(_0x17b5b3[_0x3a0a('0x2d')]!=='VIRTUAL'){var _0x425c95={};_0x425c95[_0x17b5b3['name']]={'$like':'%'+_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x425c95;}})});}_0x23dd57=_[_0x3a0a('0x3c')]({},_0x23dd57,_0x5d7760[_0x3a0a('0x3d')]);var _0x4d32f8={'where':_0x23dd57[_0x3a0a('0x39')]};return db['JscriptyProject']['count'](_0x4d32f8)[_0x3a0a('0x23')](function(_0x4f9b60){_0x4c99f9['count']=_0x4f9b60;if(_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x23dd57['include']=[{'all':!![]}];}return db[_0x3a0a('0x2a')][_0x3a0a('0x3f')](_0x23dd57);})[_0x3a0a('0x23')](function(_0xd16d0){_0x4c99f9[_0x3a0a('0x40')]=_0xd16d0;return _0x4c99f9;})['then'](respondWithFilteredResult(_0x38aaa0,_0x23dd57))[_0x3a0a('0x41')](handleError(_0x38aaa0,null));};exports[_0x3a0a('0x42')]=function(_0x2b4a6b,_0x34ea81){var _0x45e170={'raw':![],'where':{'id':_0x2b4a6b[_0x3a0a('0x43')]['id']}},_0x34e633={};_0x34e633[_0x3a0a('0x2f')]=_['keys'](db['JscriptyProject'][_0x3a0a('0x2b')]);_0x34e633[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x2b4a6b['query']);_0x34e633[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x34e633[_0x3a0a('0x2f')],_0x34e633[_0x3a0a('0x30')]);_0x45e170['attributes']=_[_0x3a0a('0x34')](_0x34e633['model'],qs[_0x3a0a('0x35')](_0x2b4a6b['query'][_0x3a0a('0x35')]));_0x45e170['attributes']=_0x45e170[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x45e170['attributes']:_0x34e633['model'];if(_0x2b4a6b[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x45e170[_0x3a0a('0x44')]=[{'all':!![]}];}_0x45e170=_[_0x3a0a('0x3c')]({},_0x45e170,_0x2b4a6b[_0x3a0a('0x3d')]);return db[_0x3a0a('0x2a')]['find'](_0x45e170)['then'](handleEntityNotFound(_0x34ea81,null))[_0x3a0a('0x23')](respondWithResult(_0x34ea81,null))[_0x3a0a('0x41')](handleError(_0x34ea81,null));};exports['create']=function(_0x48aa92,_0x1ef695){return db['JscriptyProject'][_0x3a0a('0x45')](_0x48aa92[_0x3a0a('0x46')],{})[_0x3a0a('0x23')](function(_0x34677a){var _0x385f83=_0x48aa92[_0x3a0a('0x47')]['get']({'plain':!![]});if(!_0x385f83)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x385f83[_0x3a0a('0x48')]===_0x3a0a('0x47')){var _0x201dca=_0x34677a[_0x3a0a('0x25')]({'plain':!![]});var _0x26f46c='Projects';return db[_0x3a0a('0x49')][_0x3a0a('0x4a')]({'where':{'name':_0x26f46c,'userProfileId':_0x385f83['userProfileId']},'raw':!![]})['then'](function(_0x37d62d){if(_0x37d62d&&_0x37d62d[_0x3a0a('0x4b')]===0x0){return db[_0x3a0a('0x26')][_0x3a0a('0x45')]({'name':_0x201dca[_0x3a0a('0x27')],'resourceId':_0x201dca['id'],'type':_0x37d62d[_0x3a0a('0x27')],'sectionId':_0x37d62d['id']},{})[_0x3a0a('0x23')](function(){return _0x34677a;});}else{return _0x34677a;}})['catch'](function(_0x2905b7){logger[_0x3a0a('0x4c')](_0x3a0a('0x4d'),_0x2905b7);throw _0x2905b7;});}return _0x34677a;})[_0x3a0a('0x23')](respondWithResult(_0x1ef695,0xc9))[_0x3a0a('0x41')](handleError(_0x1ef695,null));};exports[_0x3a0a('0x4e')]=function(_0x93e846,_0x2ebdec){var _0x2cc478={'where':{'id':_0x93e846[_0x3a0a('0x43')]['id']}},_0x3fe96a={};_0x3fe96a[_0x3a0a('0x2f')]=_[_0x3a0a('0x31')](db['JscriptyProject'][_0x3a0a('0x2b')]);_0x2cc478[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x3fe96a['model'],qs['fields'](_0x93e846[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x2cc478[_0x3a0a('0x33')]=_0x2cc478['attributes']['length']?_0x2cc478[_0x3a0a('0x33')]:_0x3fe96a[_0x3a0a('0x2f')];if(_0x93e846[_0x3a0a('0x30')]['includeAll']){_0x2cc478[_0x3a0a('0x44')]=[{'all':!![]}];}_0x2cc478=_[_0x3a0a('0x3c')]({},_0x2cc478,_0x93e846[_0x3a0a('0x3d')]);return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')](_0x2cc478)['then'](handleEntityNotFound(_0x2ebdec,null))[_0x3a0a('0x23')](function(_0x5d3081){if(_0x5d3081){var _0x40df97=_0x5d3081[_0x3a0a('0x25')]({'plain':!![]});_0x40df97=qs[_0x3a0a('0x4f')](_0x40df97,['id',_0x3a0a('0x50'),'updatedAt']);_0x93e846[_0x3a0a('0x46')]=_['omit'](_0x93e846[_0x3a0a('0x46')],['id',_0x3a0a('0x50'),_0x3a0a('0x51')]);return db[_0x3a0a('0x2a')][_0x3a0a('0x45')](_[_0x3a0a('0x3c')](_0x40df97,_0x93e846[_0x3a0a('0x46')]),{'include':_0x93e846[_0x3a0a('0x30')][_0x3a0a('0x3e')]?[{'all':!![]}]:undefined})[_0x3a0a('0x23')](function(_0x25a7c8){var _0x8e7485=_0x93e846[_0x3a0a('0x47')][_0x3a0a('0x25')]({'plain':!![]});if(!_0x8e7485)throw new Error(_0x3a0a('0x52'));if(_0x8e7485[_0x3a0a('0x48')]===_0x3a0a('0x47')){var _0x3c8166=_0x25a7c8[_0x3a0a('0x25')]({'plain':!![]});var _0x182ba6='Projects';return db[_0x3a0a('0x49')][_0x3a0a('0x4a')]({'where':{'name':_0x182ba6,'userProfileId':_0x8e7485[_0x3a0a('0x53')]},'raw':!![]})[_0x3a0a('0x23')](function(_0x2c807a){if(_0x2c807a&&_0x2c807a[_0x3a0a('0x4b')]===0x0){return db[_0x3a0a('0x26')][_0x3a0a('0x45')]({'name':_0x3c8166[_0x3a0a('0x27')],'resourceId':_0x3c8166['id'],'type':_0x2c807a[_0x3a0a('0x27')],'sectionId':_0x2c807a['id']},{})[_0x3a0a('0x23')](function(){return _0x25a7c8;});}else{return _0x25a7c8;}})[_0x3a0a('0x41')](function(_0x1a3227){logger[_0x3a0a('0x4c')](_0x3a0a('0x4d'),_0x1a3227);throw _0x1a3227;});}return _0x25a7c8;});}})['then'](respondWithResult(_0x2ebdec,0xc9))['catch'](handleError(_0x2ebdec,null));};exports['update']=function(_0x21b82c,_0x4ba52b){if(_0x21b82c[_0x3a0a('0x46')]['id']){delete _0x21b82c['body']['id'];}return db[_0x3a0a('0x2a')]['find']({'where':{'id':_0x21b82c[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x4ba52b,null))['then'](saveUpdates(_0x21b82c[_0x3a0a('0x46')],null))['then'](respondWithResult(_0x4ba52b,null))[_0x3a0a('0x41')](handleError(_0x4ba52b,null));};exports[_0x3a0a('0x24')]=function(_0x2474ff,_0x2b0507){return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x2474ff['params']['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x2b0507,null))[_0x3a0a('0x23')](removeEntity(_0x2b0507,null))[_0x3a0a('0x41')](handleError(_0x2b0507,null));};exports[_0x3a0a('0x54')]=function(_0x476e45,_0x34f09a,_0x23836c){var _0x5404a9={'raw':!![],'where':{}};var _0x53f68e={};var _0x183e88={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')]['findOne']({'where':{'id':_0x476e45[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x34f09a,null))['then'](function(_0x535379){if(_0x535379){_0x53f68e['model']=_[_0x3a0a('0x31')](db[_0x3a0a('0x55')]['rawAttributes']);_0x53f68e[_0x3a0a('0x30')]=_['keys'](_0x476e45[_0x3a0a('0x30')]);_0x53f68e[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x53f68e[_0x3a0a('0x2f')],_0x53f68e[_0x3a0a('0x30')]);_0x5404a9[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x53f68e[_0x3a0a('0x2f')],qs['fields'](_0x476e45['query']['fields']));_0x5404a9[_0x3a0a('0x33')]=_0x5404a9[_0x3a0a('0x33')]['length']?_0x5404a9[_0x3a0a('0x33')]:_0x53f68e[_0x3a0a('0x2f')];if(!_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x5404a9['limit']=qs[_0x3a0a('0x1d')](_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x5404a9[_0x3a0a('0x1c')]=qs['offset'](_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}_0x5404a9[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x476e45['query'][_0x3a0a('0x38')]);_0x5404a9[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x476e45[_0x3a0a('0x30')],_0x53f68e['filters']));_0x5404a9[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x535379['id'];if(_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x5404a9[_0x3a0a('0x39')]=_['merge'](_0x5404a9[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x5404a9['attributes'],function(_0x3872a3){var _0x27187b={};_0x27187b[_0x3872a3]={'$like':'%'+_0x476e45[_0x3a0a('0x30')]['filter']+'%'};return _0x27187b;})});}_0x5404a9=_[_0x3a0a('0x3c')]({},_0x5404a9,_0x476e45[_0x3a0a('0x3d')]);return db['JscriptySessionReport'][_0x3a0a('0x1e')]({'where':_0x5404a9[_0x3a0a('0x39')]})['then'](function(_0x226331){_0x183e88[_0x3a0a('0x1e')]=_0x226331;if(_0x476e45[_0x3a0a('0x30')]['includeAll']){_0x5404a9['include']=[{'all':!![]}];}return db[_0x3a0a('0x55')][_0x3a0a('0x3f')](_0x5404a9);})[_0x3a0a('0x23')](function(_0xfa7c6a){_0x183e88[_0x3a0a('0x40')]=_0xfa7c6a;return _0x183e88;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x34f09a,_0x5404a9))[_0x3a0a('0x41')](handleError(_0x34f09a,null));};exports['getAnswers']=function(_0x37521a,_0x27315d,_0x426ae5){var _0x4a9744={'raw':!![],'where':{}};var _0x26b9a2={};var _0x489e7f={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')][_0x3a0a('0x59')]({'where':{'id':_0x37521a[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x27315d,null))['then'](function(_0x479733){if(_0x479733){_0x26b9a2['model']=_['keys'](db['JscriptyAnswerReport'][_0x3a0a('0x2b')]);_0x26b9a2[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x37521a[_0x3a0a('0x30')]);_0x26b9a2[_0x3a0a('0x32')]=_['intersection'](_0x26b9a2[_0x3a0a('0x2f')],_0x26b9a2[_0x3a0a('0x30')]);_0x4a9744[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x26b9a2[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x4a9744[_0x3a0a('0x33')]=_0x4a9744[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x4a9744[_0x3a0a('0x33')]:_0x26b9a2[_0x3a0a('0x2f')];if(!_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x4a9744[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x37521a['query'][_0x3a0a('0x1d')]);_0x4a9744['offset']=qs[_0x3a0a('0x1c')](_0x37521a[_0x3a0a('0x30')]['offset']);}_0x4a9744[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x4a9744[_0x3a0a('0x39')]=qs['filters'](_[_0x3a0a('0x3a')](_0x37521a[_0x3a0a('0x30')],_0x26b9a2[_0x3a0a('0x32')]));_0x4a9744[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x479733['id'];if(_0x37521a['query'][_0x3a0a('0x3b')]){_0x4a9744['where']=_[_0x3a0a('0x3c')](_0x4a9744[_0x3a0a('0x39')],{'$or':_['map'](_0x4a9744[_0x3a0a('0x33')],function(_0x5beab5){var _0x46f2d0={};_0x46f2d0[_0x5beab5]={'$like':'%'+_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x46f2d0;})});}_0x4a9744=_[_0x3a0a('0x3c')]({},_0x4a9744,_0x37521a[_0x3a0a('0x3d')]);return db[_0x3a0a('0x5a')][_0x3a0a('0x1e')]({'where':_0x4a9744[_0x3a0a('0x39')]})[_0x3a0a('0x23')](function(_0x55f6af){_0x489e7f[_0x3a0a('0x1e')]=_0x55f6af;if(_0x37521a[_0x3a0a('0x30')]['includeAll']){_0x4a9744['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3a0a('0x3f')](_0x4a9744);})['then'](function(_0x2f1415){_0x489e7f['rows']=_0x2f1415;return _0x489e7f;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x27315d,_0x4a9744))['catch'](handleError(_0x27315d,null));};function char(_0x3d6b41){return _0x3a0a('0x5b')===typeof _0x3d6b41?String[_0x3a0a('0x5c')][_0x3a0a('0x21')](null,arguments):_0x3d6b41;}function needsEncapsulation(_0x2f6c41){return!!_0x2f6c41&&(_0x2f6c41[_0x3a0a('0x5d')]()[_0x3a0a('0x5e')](char(0xd))>=0x0||_0x2f6c41[_0x3a0a('0x5d')]()[_0x3a0a('0x5e')](char(0xa))>=0x0||_0x2f6c41[_0x3a0a('0x5d')]()['indexOf'](char(0x2c))>=0x0||_0x2f6c41[_0x3a0a('0x5d')]()[_0x3a0a('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x3e94ec){var _0xc9fecd=char(0x22),_0x5b0819='\x5c'+char(0x22),_0x4955a=_0x3e94ec['toString']()[_0x3a0a('0x5f')](new RegExp(_0xc9fecd,'g'),_0x5b0819);return _0xc9fecd+_0x4955a+_0xc9fecd;}exports[_0x3a0a('0x60')]=function(_0x53cf90,_0x213cd6,_0x31cf8e){var _0x52ad38,_0x4155d3;var _0x483930={'where':{'ProjectId':_0x53cf90[_0x3a0a('0x43')]['id']}};if(_0x53cf90[_0x3a0a('0x30')]['startTime']){_0x483930[_0x3a0a('0x39')][_0x3a0a('0x61')]=JSON[_0x3a0a('0x62')](_0x53cf90['query'][_0x3a0a('0x63')]);}return db[_0x3a0a('0x55')][_0x3a0a('0x3f')](_0x483930)['then'](handleEntityNotFound(_0x213cd6,null))[_0x3a0a('0x23')](function(_0x2309ba){if(_0x2309ba){_0x52ad38=_0x2309ba;return db[_0x3a0a('0x64')][_0x3a0a('0x3f')]({'where':{'SessionId':{'$in':_[_0x3a0a('0x29')](_0x52ad38,'id')},'ProjectId':_0x53cf90[_0x3a0a('0x43')]['id']},'order':_0x3a0a('0x65')});}})[_0x3a0a('0x23')](handleEntityNotFound(_0x213cd6,null))['then'](function(_0x579656){if(_0x579656){_0x4155d3=_0x579656;var _0x2deef6={};for(var _0x68d787=0x0,_0x932f9=_0x4155d3[_0x3a0a('0x36')];_0x68d787<_0x932f9;_0x68d787++){if(!_0x2deef6[_0x3a0a('0x37')](_0x4155d3[_0x68d787][_0x3a0a('0x66')])){_0x2deef6[_0x4155d3[_0x68d787][_0x3a0a('0x66')]]=needsEncapsulation(_0x4155d3[_0x68d787][_0x3a0a('0x67')])?encapsulate(_0x4155d3[_0x68d787][_0x3a0a('0x67')]):_0x4155d3[_0x68d787][_0x3a0a('0x67')];}}var _0x7da6a0=[],_0x2bc924={};for(var _0x31ae21=0x0,_0x2475d4=_0x52ad38[_0x3a0a('0x36')];_0x31ae21<_0x2475d4;_0x31ae21++){_0x2bc924={'ProjectId':_0x53cf90[_0x3a0a('0x43')]['id'],'SessionId':_0x52ad38[_0x31ae21]['id'],'StartTime':moment(_0x52ad38[_0x31ae21][_0x3a0a('0x61')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x2bdd7a=0x0,_0x440093=_0x4155d3['length'];_0x2bdd7a<_0x440093;_0x2bdd7a++){if(_0x4155d3[_0x2bdd7a][_0x3a0a('0x68')]==_0x52ad38[_0x31ae21]['id']&&_0x2deef6[_0x3a0a('0x37')](_0x4155d3[_0x2bdd7a][_0x3a0a('0x66')])){_0x2bc924[_0x2deef6[_0x4155d3[_0x2bdd7a]['questionId']]]=_0x4155d3[_0x2bdd7a][_0x3a0a('0x69')];}}for(var _0x1bd9c6 in _0x2deef6){if(!_0x2bc924[_0x3a0a('0x37')](_0x2deef6[_0x1bd9c6])){_0x2bc924[_0x2deef6[_0x1bd9c6]]=null;}}_0x7da6a0['push'](_0x2bc924);}return _0x7da6a0;}})[_0x3a0a('0x23')](function(_0x4a2b06){if(!_[_0x3a0a('0x6a')](_0x4a2b06)){var _0x48d7a5=toCsv(_0x4a2b06);var _0x349832=Date[_0x3a0a('0x6b')]();fs['writeFileSync'](util[_0x3a0a('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x53cf90[_0x3a0a('0x43')]['id'],_0x349832),_0x48d7a5);_0x213cd6[_0x3a0a('0x6d')](_0x3a0a('0x6e'),_0x3a0a('0x6f')+util[_0x3a0a('0x6c')](_0x3a0a('0x70'),_0x53cf90[_0x3a0a('0x43')]['id'],_0x349832));_0x213cd6[_0x3a0a('0x6d')](_0x3a0a('0x71'),_0x3a0a('0x72'));return _0x213cd6['download'](util[_0x3a0a('0x6c')](_0x3a0a('0x73'),_0x53cf90[_0x3a0a('0x43')]['id'],_0x349832));}else{return _0x213cd6['sendStatus'](0xcc);}})[_0x3a0a('0x41')](handleError(_0x213cd6,null));}; \ No newline at end of file +var _0x56c8=['order','sort','where','pick','filter','merge','VIRTUAL','rows','show','params','keys','includeAll','include','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Projects','UserProfileResource','error','name','JscriptyProject','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x5ca99f,_0x5c9d05){var _0x2df281=function(_0x2fc456){while(--_0x2fc456){_0x5ca99f['push'](_0x5ca99f['shift']());}};_0x2df281(++_0x5c9d05);}(_0x56c8,0x12f));var _0x856c=function(_0x7e2da0,_0x7f32fc){_0x7e2da0=_0x7e2da0-0x0;var _0x1b472e=_0x56c8[_0x7e2da0];return _0x1b472e;};'use strict';var emlformat=require(_0x856c('0x0'));var rimraf=require(_0x856c('0x1'));var zipdir=require(_0x856c('0x2'));var jsonpatch=require(_0x856c('0x3'));var rp=require('request-promise');var moment=require(_0x856c('0x4'));var BPromise=require(_0x856c('0x5'));var Mustache=require(_0x856c('0x6'));var util=require(_0x856c('0x7'));var path=require(_0x856c('0x8'));var sox=require('sox');var csv=require(_0x856c('0x9'));var ejs=require(_0x856c('0xa'));var fs=require('fs');var fs_extra=require(_0x856c('0xb'));var _=require(_0x856c('0xc'));var squel=require(_0x856c('0xd'));var crypto=require(_0x856c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x856c('0x9'));var querystring=require(_0x856c('0xf'));var Papa=require(_0x856c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x856c('0x11'));var hardwareService=require(_0x856c('0x12'));var logger=require(_0x856c('0x13'))('api');var utils=require(_0x856c('0x14'));var config=require(_0x856c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x856c('0x16'))['db'];function respondWithStatusCode(_0x117c1a,_0x326656){_0x326656=_0x326656||0xcc;return function(_0x28c3d4){if(_0x28c3d4){return _0x117c1a[_0x856c('0x17')](_0x326656);}return _0x117c1a[_0x856c('0x18')](_0x326656)[_0x856c('0x19')]();};}function respondWithResult(_0xc4d331,_0x5e493f){_0x5e493f=_0x5e493f||0xc8;return function(_0x45213f){if(_0x45213f){return _0xc4d331['status'](_0x5e493f)[_0x856c('0x1a')](_0x45213f);}};}function respondWithFilteredResult(_0x44cf83,_0x1c372f){return function(_0x20021d){if(_0x20021d){var _0x6856e5=typeof _0x1c372f[_0x856c('0x1b')]===_0x856c('0x1c')&&typeof _0x1c372f[_0x856c('0x1d')]===_0x856c('0x1c');var _0x1dd26e=_0x20021d[_0x856c('0x1e')];var _0xf24755=_0x6856e5?0x0:_0x1c372f[_0x856c('0x1b')];var _0x417cd3=_0x6856e5?_0x20021d[_0x856c('0x1e')]:_0x1c372f[_0x856c('0x1b')]+_0x1c372f[_0x856c('0x1d')];var _0x4183ab;if(_0x417cd3>=_0x1dd26e){_0x417cd3=_0x1dd26e;_0x4183ab=0xc8;}else{_0x4183ab=0xce;}_0x44cf83[_0x856c('0x18')](_0x4183ab);return _0x44cf83[_0x856c('0x1f')](_0x856c('0x20'),_0xf24755+'-'+_0x417cd3+'/'+_0x1dd26e)[_0x856c('0x1a')](_0x20021d);}return null;};}function patchUpdates(_0x4c42e0){return function(_0x51ce3a){try{jsonpatch[_0x856c('0x21')](_0x51ce3a,_0x4c42e0,!![]);}catch(_0x277518){return BPromise[_0x856c('0x22')](_0x277518);}return _0x51ce3a['save']();};}function saveUpdates(_0x120bc2,_0x4be642){return function(_0x202357){if(_0x202357){return _0x202357[_0x856c('0x23')](_0x120bc2)[_0x856c('0x24')](function(_0x5c5a3e){return _0x5c5a3e;});}return null;};}function removeEntity(_0x443292,_0x3220f9){return function(_0x3984a7){if(_0x3984a7){return _0x3984a7[_0x856c('0x25')]()[_0x856c('0x24')](function(){var _0x3b2f35=_0x3984a7['get']({'plain':!![]});var _0x3a048d=_0x856c('0x26');return db[_0x856c('0x27')]['destroy']({'where':{'type':_0x3a048d,'resourceId':_0x3b2f35['id']}})[_0x856c('0x24')](function(){return _0x3984a7;});})['then'](function(){_0x443292[_0x856c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d38d4,_0x23f53d){return function(_0x4a8107){if(!_0x4a8107){_0x3d38d4[_0x856c('0x17')](0x194);}return _0x4a8107;};}function handleError(_0x514d6c,_0x1a0a48){_0x1a0a48=_0x1a0a48||0x1f4;return function(_0x384f5f){logger[_0x856c('0x28')](_0x384f5f['stack']);if(_0x384f5f[_0x856c('0x29')]){delete _0x384f5f[_0x856c('0x29')];}_0x514d6c[_0x856c('0x18')](_0x1a0a48)['send'](_0x384f5f);};}exports['index']=function(_0x3eaced,_0x2a809d){var _0x21a868={},_0x25cbab={},_0x39ab90={'count':0x0,'rows':[]};var _0x2e1e91=_['map'](db[_0x856c('0x2a')][_0x856c('0x2b')],function(_0x1dc382){return{'name':_0x1dc382[_0x856c('0x2c')],'type':_0x1dc382[_0x856c('0x2d')][_0x856c('0x2e')]};});_0x25cbab['model']=_[_0x856c('0x2f')](_0x2e1e91,_0x856c('0x29'));_0x25cbab[_0x856c('0x30')]=_['keys'](_0x3eaced[_0x856c('0x30')]);_0x25cbab[_0x856c('0x31')]=_['intersection'](_0x25cbab[_0x856c('0x32')],_0x25cbab[_0x856c('0x30')]);_0x21a868[_0x856c('0x33')]=_[_0x856c('0x34')](_0x25cbab[_0x856c('0x32')],qs['fields'](_0x3eaced[_0x856c('0x30')][_0x856c('0x35')]));_0x21a868[_0x856c('0x33')]=_0x21a868[_0x856c('0x33')][_0x856c('0x36')]?_0x21a868[_0x856c('0x33')]:_0x25cbab[_0x856c('0x32')];if(!_0x3eaced[_0x856c('0x30')][_0x856c('0x37')](_0x856c('0x38'))){_0x21a868[_0x856c('0x1d')]=qs[_0x856c('0x1d')](_0x3eaced['query']['limit']);_0x21a868[_0x856c('0x1b')]=qs['offset'](_0x3eaced[_0x856c('0x30')][_0x856c('0x1b')]);}_0x21a868[_0x856c('0x39')]=qs[_0x856c('0x3a')](_0x3eaced[_0x856c('0x30')]['sort']);_0x21a868[_0x856c('0x3b')]=qs[_0x856c('0x31')](_[_0x856c('0x3c')](_0x3eaced[_0x856c('0x30')],_0x25cbab[_0x856c('0x31')]),_0x2e1e91);if(_0x3eaced['query'][_0x856c('0x3d')]){_0x21a868[_0x856c('0x3b')]=_[_0x856c('0x3e')](_0x21a868[_0x856c('0x3b')],{'$or':_[_0x856c('0x2f')](_0x2e1e91,function(_0x54460e){if(_0x54460e['type']!==_0x856c('0x3f')){var _0x1a235f={};_0x1a235f[_0x54460e[_0x856c('0x29')]]={'$like':'%'+_0x3eaced['query'][_0x856c('0x3d')]+'%'};return _0x1a235f;}})});}_0x21a868=_[_0x856c('0x3e')]({},_0x21a868,_0x3eaced['options']);var _0x5be7c2={'where':_0x21a868[_0x856c('0x3b')]};return db[_0x856c('0x2a')][_0x856c('0x1e')](_0x5be7c2)[_0x856c('0x24')](function(_0x1fe404){_0x39ab90[_0x856c('0x1e')]=_0x1fe404;if(_0x3eaced[_0x856c('0x30')]['includeAll']){_0x21a868['include']=[{'all':!![]}];}return db[_0x856c('0x2a')]['findAll'](_0x21a868);})[_0x856c('0x24')](function(_0x29234d){_0x39ab90[_0x856c('0x40')]=_0x29234d;return _0x39ab90;})[_0x856c('0x24')](respondWithFilteredResult(_0x2a809d,_0x21a868))['catch'](handleError(_0x2a809d,null));};exports[_0x856c('0x41')]=function(_0x3af263,_0x4424c4){var _0x35380e={'raw':![],'where':{'id':_0x3af263[_0x856c('0x42')]['id']}},_0xef88f2={};_0xef88f2[_0x856c('0x32')]=_[_0x856c('0x43')](db['JscriptyProject'][_0x856c('0x2b')]);_0xef88f2[_0x856c('0x30')]=_[_0x856c('0x43')](_0x3af263['query']);_0xef88f2[_0x856c('0x31')]=_[_0x856c('0x34')](_0xef88f2[_0x856c('0x32')],_0xef88f2['query']);_0x35380e[_0x856c('0x33')]=_[_0x856c('0x34')](_0xef88f2['model'],qs[_0x856c('0x35')](_0x3af263[_0x856c('0x30')][_0x856c('0x35')]));_0x35380e[_0x856c('0x33')]=_0x35380e[_0x856c('0x33')][_0x856c('0x36')]?_0x35380e[_0x856c('0x33')]:_0xef88f2[_0x856c('0x32')];if(_0x3af263[_0x856c('0x30')][_0x856c('0x44')]){_0x35380e[_0x856c('0x45')]=[{'all':!![]}];}_0x35380e=_[_0x856c('0x3e')]({},_0x35380e,_0x3af263[_0x856c('0x46')]);return db['JscriptyProject'][_0x856c('0x47')](_0x35380e)[_0x856c('0x24')](handleEntityNotFound(_0x4424c4,null))[_0x856c('0x24')](respondWithResult(_0x4424c4,null))[_0x856c('0x48')](handleError(_0x4424c4,null));};exports[_0x856c('0x49')]=function(_0x24d009,_0x4d51de){return db[_0x856c('0x2a')][_0x856c('0x49')](_0x24d009[_0x856c('0x4a')],{})[_0x856c('0x24')](function(_0x54399f){var _0x29fd01=_0x24d009['user'][_0x856c('0x4b')]({'plain':!![]});if(!_0x29fd01)throw new Error(_0x856c('0x4c'));if(_0x29fd01['role']==='user'){var _0x30fa12=_0x54399f['get']({'plain':!![]});var _0x5b0d61=_0x856c('0x26');return db[_0x856c('0x4d')][_0x856c('0x47')]({'where':{'name':_0x5b0d61,'userProfileId':_0x29fd01[_0x856c('0x4e')]},'raw':!![]})[_0x856c('0x24')](function(_0x44201f){if(_0x44201f&&_0x44201f[_0x856c('0x4f')]===0x0){return db[_0x856c('0x27')][_0x856c('0x49')]({'name':_0x30fa12[_0x856c('0x29')],'resourceId':_0x30fa12['id'],'type':_0x44201f['name'],'sectionId':_0x44201f['id']},{})[_0x856c('0x24')](function(){return _0x54399f;});}else{return _0x54399f;}})[_0x856c('0x48')](function(_0x4b1955){logger[_0x856c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b1955);throw _0x4b1955;});}return _0x54399f;})[_0x856c('0x24')](respondWithResult(_0x4d51de,0xc9))['catch'](handleError(_0x4d51de,null));};exports[_0x856c('0x50')]=function(_0x40016c,_0x41ebce){var _0x36d7f8={'where':{'id':_0x40016c[_0x856c('0x42')]['id']}},_0xb4e351={};_0xb4e351['model']=_[_0x856c('0x43')](db[_0x856c('0x2a')][_0x856c('0x2b')]);_0x36d7f8[_0x856c('0x33')]=_[_0x856c('0x34')](_0xb4e351[_0x856c('0x32')],qs[_0x856c('0x35')](_0x40016c[_0x856c('0x30')][_0x856c('0x35')]));_0x36d7f8[_0x856c('0x33')]=_0x36d7f8[_0x856c('0x33')][_0x856c('0x36')]?_0x36d7f8[_0x856c('0x33')]:_0xb4e351['model'];if(_0x40016c[_0x856c('0x30')]['includeAll']){_0x36d7f8[_0x856c('0x45')]=[{'all':!![]}];}_0x36d7f8=_[_0x856c('0x3e')]({},_0x36d7f8,_0x40016c[_0x856c('0x46')]);return db['JscriptyProject'][_0x856c('0x47')](_0x36d7f8)['then'](handleEntityNotFound(_0x41ebce,null))['then'](function(_0x55bd3c){if(_0x55bd3c){var _0x2c57e9=_0x55bd3c[_0x856c('0x4b')]({'plain':!![]});_0x2c57e9=qs['omit'](_0x2c57e9,['id',_0x856c('0x51'),_0x856c('0x52')]);_0x40016c[_0x856c('0x4a')]=_[_0x856c('0x53')](_0x40016c[_0x856c('0x4a')],['id',_0x856c('0x51'),'updatedAt']);return db[_0x856c('0x2a')][_0x856c('0x49')](_[_0x856c('0x3e')](_0x2c57e9,_0x40016c[_0x856c('0x4a')]),{'include':_0x40016c[_0x856c('0x30')][_0x856c('0x44')]?[{'all':!![]}]:undefined})[_0x856c('0x24')](function(_0x5023a8){var _0x38f8b1=_0x40016c['user'][_0x856c('0x4b')]({'plain':!![]});if(!_0x38f8b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38f8b1[_0x856c('0x54')]===_0x856c('0x55')){var _0x5a96da=_0x5023a8[_0x856c('0x4b')]({'plain':!![]});var _0x33b699=_0x856c('0x26');return db[_0x856c('0x4d')][_0x856c('0x47')]({'where':{'name':_0x33b699,'userProfileId':_0x38f8b1[_0x856c('0x4e')]},'raw':!![]})[_0x856c('0x24')](function(_0x2f11a9){if(_0x2f11a9&&_0x2f11a9['autoAssociation']===0x0){return db[_0x856c('0x27')][_0x856c('0x49')]({'name':_0x5a96da[_0x856c('0x29')],'resourceId':_0x5a96da['id'],'type':_0x2f11a9[_0x856c('0x29')],'sectionId':_0x2f11a9['id']},{})['then'](function(){return _0x5023a8;});}else{return _0x5023a8;}})[_0x856c('0x48')](function(_0x58c600){logger[_0x856c('0x28')](_0x856c('0x56'),_0x58c600);throw _0x58c600;});}return _0x5023a8;});}})[_0x856c('0x24')](respondWithResult(_0x41ebce,0xc9))['catch'](handleError(_0x41ebce,null));};exports[_0x856c('0x23')]=function(_0x262f18,_0x31ee81){if(_0x262f18[_0x856c('0x4a')]['id']){delete _0x262f18[_0x856c('0x4a')]['id'];}return db[_0x856c('0x2a')][_0x856c('0x47')]({'where':{'id':_0x262f18[_0x856c('0x42')]['id']}})[_0x856c('0x24')](handleEntityNotFound(_0x31ee81,null))[_0x856c('0x24')](saveUpdates(_0x262f18[_0x856c('0x4a')],null))[_0x856c('0x24')](respondWithResult(_0x31ee81,null))['catch'](handleError(_0x31ee81,null));};exports[_0x856c('0x25')]=function(_0x161fcf,_0x12fe47){return db[_0x856c('0x2a')][_0x856c('0x47')]({'where':{'id':_0x161fcf[_0x856c('0x42')]['id']}})['then'](handleEntityNotFound(_0x12fe47,null))[_0x856c('0x24')](removeEntity(_0x12fe47,null))[_0x856c('0x48')](handleError(_0x12fe47,null));};exports[_0x856c('0x57')]=function(_0x3bf8f9,_0x40eacb,_0x1b5231){var _0x3dbbf3={'raw':!![],'where':{}};var _0x55646e={};var _0x562424={'count':0x0,'rows':[]};return db[_0x856c('0x2a')][_0x856c('0x58')]({'where':{'id':_0x3bf8f9[_0x856c('0x42')]['id']}})[_0x856c('0x24')](handleEntityNotFound(_0x40eacb,null))[_0x856c('0x24')](function(_0x4104c0){if(_0x4104c0){_0x55646e['model']=_['keys'](db[_0x856c('0x59')][_0x856c('0x2b')]);_0x55646e['query']=_[_0x856c('0x43')](_0x3bf8f9[_0x856c('0x30')]);_0x55646e[_0x856c('0x31')]=_[_0x856c('0x34')](_0x55646e[_0x856c('0x32')],_0x55646e[_0x856c('0x30')]);_0x3dbbf3[_0x856c('0x33')]=_[_0x856c('0x34')](_0x55646e[_0x856c('0x32')],qs['fields'](_0x3bf8f9[_0x856c('0x30')]['fields']));_0x3dbbf3[_0x856c('0x33')]=_0x3dbbf3[_0x856c('0x33')][_0x856c('0x36')]?_0x3dbbf3[_0x856c('0x33')]:_0x55646e[_0x856c('0x32')];if(!_0x3bf8f9['query'][_0x856c('0x37')]('nolimit')){_0x3dbbf3['limit']=qs[_0x856c('0x1d')](_0x3bf8f9[_0x856c('0x30')]['limit']);_0x3dbbf3[_0x856c('0x1b')]=qs[_0x856c('0x1b')](_0x3bf8f9['query'][_0x856c('0x1b')]);}_0x3dbbf3[_0x856c('0x39')]=qs[_0x856c('0x3a')](_0x3bf8f9[_0x856c('0x30')][_0x856c('0x3a')]);_0x3dbbf3['where']=qs['filters'](_[_0x856c('0x3c')](_0x3bf8f9['query'],_0x55646e[_0x856c('0x31')]));_0x3dbbf3[_0x856c('0x3b')][_0x856c('0x5a')]=_0x4104c0['id'];if(_0x3bf8f9['query'][_0x856c('0x3d')]){_0x3dbbf3[_0x856c('0x3b')]=_[_0x856c('0x3e')](_0x3dbbf3[_0x856c('0x3b')],{'$or':_[_0x856c('0x2f')](_0x3dbbf3[_0x856c('0x33')],function(_0x10e328){var _0x557016={};_0x557016[_0x10e328]={'$like':'%'+_0x3bf8f9[_0x856c('0x30')][_0x856c('0x3d')]+'%'};return _0x557016;})});}_0x3dbbf3=_[_0x856c('0x3e')]({},_0x3dbbf3,_0x3bf8f9[_0x856c('0x46')]);return db[_0x856c('0x59')]['count']({'where':_0x3dbbf3[_0x856c('0x3b')]})[_0x856c('0x24')](function(_0x2e66b9){_0x562424[_0x856c('0x1e')]=_0x2e66b9;if(_0x3bf8f9[_0x856c('0x30')]['includeAll']){_0x3dbbf3[_0x856c('0x45')]=[{'all':!![]}];}return db[_0x856c('0x59')][_0x856c('0x5b')](_0x3dbbf3);})[_0x856c('0x24')](function(_0x1695ef){_0x562424[_0x856c('0x40')]=_0x1695ef;return _0x562424;});}})[_0x856c('0x24')](respondWithFilteredResult(_0x40eacb,_0x3dbbf3))[_0x856c('0x48')](handleError(_0x40eacb,null));};exports[_0x856c('0x5c')]=function(_0x4c2c9e,_0x199cca,_0x3734b8){var _0x481b69={'raw':!![],'where':{}};var _0x1f4171={};var _0x2c771b={'count':0x0,'rows':[]};return db[_0x856c('0x2a')][_0x856c('0x58')]({'where':{'id':_0x4c2c9e['params']['id']}})['then'](handleEntityNotFound(_0x199cca,null))[_0x856c('0x24')](function(_0x57b0d7){if(_0x57b0d7){_0x1f4171[_0x856c('0x32')]=_[_0x856c('0x43')](db[_0x856c('0x5d')][_0x856c('0x2b')]);_0x1f4171['query']=_[_0x856c('0x43')](_0x4c2c9e[_0x856c('0x30')]);_0x1f4171[_0x856c('0x31')]=_[_0x856c('0x34')](_0x1f4171[_0x856c('0x32')],_0x1f4171[_0x856c('0x30')]);_0x481b69[_0x856c('0x33')]=_[_0x856c('0x34')](_0x1f4171[_0x856c('0x32')],qs[_0x856c('0x35')](_0x4c2c9e[_0x856c('0x30')][_0x856c('0x35')]));_0x481b69[_0x856c('0x33')]=_0x481b69[_0x856c('0x33')]['length']?_0x481b69['attributes']:_0x1f4171[_0x856c('0x32')];if(!_0x4c2c9e['query']['hasOwnProperty'](_0x856c('0x38'))){_0x481b69[_0x856c('0x1d')]=qs[_0x856c('0x1d')](_0x4c2c9e[_0x856c('0x30')][_0x856c('0x1d')]);_0x481b69[_0x856c('0x1b')]=qs[_0x856c('0x1b')](_0x4c2c9e[_0x856c('0x30')][_0x856c('0x1b')]);}_0x481b69[_0x856c('0x39')]=qs['sort'](_0x4c2c9e[_0x856c('0x30')][_0x856c('0x3a')]);_0x481b69[_0x856c('0x3b')]=qs[_0x856c('0x31')](_[_0x856c('0x3c')](_0x4c2c9e[_0x856c('0x30')],_0x1f4171['filters']));_0x481b69[_0x856c('0x3b')][_0x856c('0x5a')]=_0x57b0d7['id'];if(_0x4c2c9e[_0x856c('0x30')]['filter']){_0x481b69[_0x856c('0x3b')]=_['merge'](_0x481b69[_0x856c('0x3b')],{'$or':_[_0x856c('0x2f')](_0x481b69[_0x856c('0x33')],function(_0x5a6702){var _0xe8d36b={};_0xe8d36b[_0x5a6702]={'$like':'%'+_0x4c2c9e[_0x856c('0x30')][_0x856c('0x3d')]+'%'};return _0xe8d36b;})});}_0x481b69=_[_0x856c('0x3e')]({},_0x481b69,_0x4c2c9e[_0x856c('0x46')]);return db['JscriptyAnswerReport'][_0x856c('0x1e')]({'where':_0x481b69[_0x856c('0x3b')]})[_0x856c('0x24')](function(_0x5e6220){_0x2c771b['count']=_0x5e6220;if(_0x4c2c9e[_0x856c('0x30')][_0x856c('0x44')]){_0x481b69['include']=[{'all':!![]}];}return db[_0x856c('0x5d')]['findAll'](_0x481b69);})[_0x856c('0x24')](function(_0x17019d){_0x2c771b['rows']=_0x17019d;return _0x2c771b;});}})['then'](respondWithFilteredResult(_0x199cca,_0x481b69))[_0x856c('0x48')](handleError(_0x199cca,null));};function char(_0x473348){return _0x856c('0x5e')===typeof _0x473348?String[_0x856c('0x5f')][_0x856c('0x21')](null,arguments):_0x473348;}function needsEncapsulation(_0x39a270){return!!_0x39a270&&(_0x39a270[_0x856c('0x60')]()['indexOf'](char(0xd))>=0x0||_0x39a270[_0x856c('0x60')]()[_0x856c('0x61')](char(0xa))>=0x0||_0x39a270[_0x856c('0x60')]()[_0x856c('0x61')](char(0x2c))>=0x0||_0x39a270[_0x856c('0x60')]()[_0x856c('0x61')](char(0x22))>=0x0);}function encapsulate(_0x3ea9ed){var _0x3c0064=char(0x22),_0x42ded0='\x5c'+char(0x22),_0x1075ec=_0x3ea9ed[_0x856c('0x60')]()[_0x856c('0x62')](new RegExp(_0x3c0064,'g'),_0x42ded0);return _0x3c0064+_0x1075ec+_0x3c0064;}exports[_0x856c('0x63')]=function(_0x5f5cdd,_0x30ebf0,_0x4d48fa){var _0x288c25,_0x69500d;var _0x1a7e36={'where':{'ProjectId':_0x5f5cdd[_0x856c('0x42')]['id']}};if(_0x5f5cdd['query']['startTime']){_0x1a7e36[_0x856c('0x3b')][_0x856c('0x64')]=JSON[_0x856c('0x65')](_0x5f5cdd[_0x856c('0x30')][_0x856c('0x66')]);}return db['JscriptySessionReport'][_0x856c('0x5b')](_0x1a7e36)[_0x856c('0x24')](handleEntityNotFound(_0x30ebf0,null))[_0x856c('0x24')](function(_0x3ea25a){if(_0x3ea25a){_0x288c25=_0x3ea25a;return db[_0x856c('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x856c('0x2f')](_0x288c25,'id')},'ProjectId':_0x5f5cdd[_0x856c('0x42')]['id']},'order':'-createdAt'});}})[_0x856c('0x24')](handleEntityNotFound(_0x30ebf0,null))['then'](function(_0x1676f2){if(_0x1676f2){_0x69500d=_0x1676f2;var _0x35003a={};for(var _0x1ebf9c=0x0,_0x4b5284=_0x69500d[_0x856c('0x36')];_0x1ebf9c<_0x4b5284;_0x1ebf9c++){if(!_0x35003a[_0x856c('0x37')](_0x69500d[_0x1ebf9c][_0x856c('0x68')])){_0x35003a[_0x69500d[_0x1ebf9c][_0x856c('0x68')]]=needsEncapsulation(_0x69500d[_0x1ebf9c][_0x856c('0x69')])?encapsulate(_0x69500d[_0x1ebf9c][_0x856c('0x69')]):_0x69500d[_0x1ebf9c][_0x856c('0x69')];}}var _0x31bf62=[],_0x36d40e={};for(var _0x1ea340=0x0,_0x558ffc=_0x288c25[_0x856c('0x36')];_0x1ea340<_0x558ffc;_0x1ea340++){_0x36d40e={'ProjectId':_0x5f5cdd['params']['id'],'SessionId':_0x288c25[_0x1ea340]['id'],'StartTime':moment(_0x288c25[_0x1ea340][_0x856c('0x64')])[_0x856c('0x6a')](_0x856c('0x6b'))};for(var _0x28800c=0x0,_0xd895f4=_0x69500d[_0x856c('0x36')];_0x28800c<_0xd895f4;_0x28800c++){if(_0x69500d[_0x28800c][_0x856c('0x6c')]==_0x288c25[_0x1ea340]['id']&&_0x35003a[_0x856c('0x37')](_0x69500d[_0x28800c][_0x856c('0x68')])){_0x36d40e[_0x35003a[_0x69500d[_0x28800c][_0x856c('0x68')]]]=_0x69500d[_0x28800c][_0x856c('0x6d')];}}for(var _0x3bc1fb in _0x35003a){if(!_0x36d40e['hasOwnProperty'](_0x35003a[_0x3bc1fb])){_0x36d40e[_0x35003a[_0x3bc1fb]]=null;}}_0x31bf62['push'](_0x36d40e);}return _0x31bf62;}})[_0x856c('0x24')](function(_0x457b68){if(!_[_0x856c('0x6e')](_0x457b68)){var _0x5b6a4e=toCsv(_0x457b68);var _0x2669ac=Date[_0x856c('0x6f')]();fs[_0x856c('0x70')](util[_0x856c('0x6a')](_0x856c('0x71'),_0x5f5cdd[_0x856c('0x42')]['id'],_0x2669ac),_0x5b6a4e);_0x30ebf0[_0x856c('0x72')](_0x856c('0x73'),_0x856c('0x74')+util[_0x856c('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x5f5cdd[_0x856c('0x42')]['id'],_0x2669ac));_0x30ebf0[_0x856c('0x72')](_0x856c('0x75'),_0x856c('0x76'));return _0x30ebf0[_0x856c('0x77')](util[_0x856c('0x6a')](_0x856c('0x71'),_0x5f5cdd['params']['id'],_0x2669ac));}else{return _0x30ebf0[_0x856c('0x17')](0xcc);}})[_0x856c('0x48')](handleError(_0x30ebf0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index cdd69e4..4fd37cc 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 _0x0c29=['define','JscriptyProject','jscripty_projects','../../config/logger','moment','bluebird','request-promise','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x336092,_0x22c0e1){var _0x57c708=function(_0x2cd18b){while(--_0x2cd18b){_0x336092['push'](_0x336092['shift']());}};_0x57c708(++_0x22c0e1);}(_0x0c29,0xb7));var _0x90c2=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x0c29[_0x151381];return _0x2afab6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x90c2('0x0'))('api');var moment=require(_0x90c2('0x1'));var BPromise=require(_0x90c2('0x2'));var rp=require(_0x90c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x90c2('0x4'));var attributes=require(_0x90c2('0x5'));module[_0x90c2('0x6')]=function(_0x1aa5a4,_0xfbe17b){return _0x1aa5a4[_0x90c2('0x7')](_0x90c2('0x8'),attributes,{'tableName':_0x90c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cc=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3fabe9,_0x17d2ab){var _0x2c3399=function(_0x568a71){while(--_0x568a71){_0x3fabe9['push'](_0x3fabe9['shift']());}};_0x2c3399(++_0x17d2ab);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x20dd9b,_0x3c0fb8){_0x20dd9b=_0x20dd9b-0x0;var _0x2de3b0=_0xf3cc[_0x20dd9b];return _0x2de3b0;};'use strict';var _=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var logger=require(_0xcf3c('0x2'))(_0xcf3c('0x3'));var moment=require('moment');var BPromise=require(_0xcf3c('0x4'));var rp=require(_0xcf3c('0x5'));var fs=require('fs');var path=require(_0xcf3c('0x6'));var rimraf=require('rimraf');var config=require(_0xcf3c('0x7'));var attributes=require(_0xcf3c('0x8'));module['exports']=function(_0x41f804,_0x2b5cae){return _0x41f804[_0xcf3c('0x9')](_0xcf3c('0xa'),attributes,{'tableName':_0xcf3c('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 271469f..a2dd1f5 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x560f7d,_0x144cdb){var _0x5a2e36=function(_0x1f72cd){while(--_0x1f72cd){_0x560f7d['push'](_0x560f7d['shift']());}};_0x5a2e36(++_0x144cdb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2548d8,_0x80995b){var _0x1fe7c1=function(_0x4d5793){while(--_0x4d5793){_0x2548d8['push'](_0x2548d8['shift']());}};_0x1fe7c1(++_0x80995b);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 5749337..11839b1 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 _0xb1f1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','delete','destroy','exports','path','express','Router'];(function(_0x5afe55,_0x5c6c81){var _0x2708bb=function(_0x6bf8af){while(--_0x6bf8af){_0x5afe55['push'](_0x5afe55['shift']());}};_0x2708bb(++_0x5c6c81);}(_0xb1f1,0x153));var _0x1b1f=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xb1f1[_0x33032e];return _0x13316b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b1f('0x0'));var timeout=require('connect-timeout');var express=require(_0x1b1f('0x1'));var router=express[_0x1b1f('0x2')]();var fs_extra=require(_0x1b1f('0x3'));var auth=require(_0x1b1f('0x4'));var interaction=require(_0x1b1f('0x5'));var config=require('../../config/environment');var controller=require(_0x1b1f('0x6'));router[_0x1b1f('0x7')]('/',auth[_0x1b1f('0x8')](),controller[_0x1b1f('0x9')]);router[_0x1b1f('0x7')](_0x1b1f('0xa'),auth['isAuthenticated'](),controller[_0x1b1f('0xb')]);router['get'](_0x1b1f('0xc'),auth[_0x1b1f('0x8')](),controller[_0x1b1f('0xd')]);router['post']('/',auth[_0x1b1f('0x8')](),controller['create']);router['put']('/:id',auth[_0x1b1f('0x8')](),controller[_0x1b1f('0xe')]);router[_0x1b1f('0xf')](_0x1b1f('0xc'),auth[_0x1b1f('0x8')](),controller[_0x1b1f('0x10')]);module[_0x1b1f('0x11')]=router; \ No newline at end of file +var _0x2cfc=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x2cfc,0x114));var _0xc2cf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2cfc[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0xc2cf('0x0'));var path=require(_0xc2cf('0x1'));var timeout=require(_0xc2cf('0x2'));var express=require(_0xc2cf('0x3'));var router=express[_0xc2cf('0x4')]();var fs_extra=require(_0xc2cf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc2cf('0x6'));var controller=require(_0xc2cf('0x7'));router[_0xc2cf('0x8')]('/',auth[_0xc2cf('0x9')](),controller[_0xc2cf('0xa')]);router[_0xc2cf('0x8')](_0xc2cf('0xb'),auth[_0xc2cf('0x9')](),controller[_0xc2cf('0xc')]);router[_0xc2cf('0x8')](_0xc2cf('0xd'),auth['isAuthenticated'](),controller[_0xc2cf('0xe')]);router[_0xc2cf('0xf')]('/',auth[_0xc2cf('0x9')](),controller[_0xc2cf('0x10')]);router[_0xc2cf('0x11')](_0xc2cf('0xd'),auth['isAuthenticated'](),controller[_0xc2cf('0x12')]);router[_0xc2cf('0x13')](_0xc2cf('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc2cf('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 1381492..f65562d 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x8850f,_0x30d619){_0x8850f=_0x8850f-0x0;var _0x52c5cc=_0x7a54[_0x8850f];return _0x52c5cc;};'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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x31f46c,_0x840164){_0x31f46c=_0x31f46c-0x0;var _0x3e7390=_0x7a54[_0x31f46c];return _0x3e7390;};'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 a2937f6..b0ca270 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 _0x9a02=['length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params'];(function(_0x4d528c,_0x6f82fa){var _0x344a78=function(_0x31ef72){while(--_0x31ef72){_0x4d528c['push'](_0x4d528c['shift']());}};_0x344a78(++_0x6f82fa);}(_0x9a02,0x139));var _0x29a0=function(_0x1b851d,_0x24ed05){_0x1b851d=_0x1b851d-0x0;var _0x3e4a39=_0x9a02[_0x1b851d];return _0x3e4a39;};'use strict';var emlformat=require(_0x29a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29a0('0x1'));var jsonpatch=require(_0x29a0('0x2'));var rp=require(_0x29a0('0x3'));var moment=require(_0x29a0('0x4'));var BPromise=require(_0x29a0('0x5'));var Mustache=require(_0x29a0('0x6'));var util=require(_0x29a0('0x7'));var path=require(_0x29a0('0x8'));var sox=require(_0x29a0('0x9'));var csv=require(_0x29a0('0xa'));var ejs=require(_0x29a0('0xb'));var fs=require('fs');var fs_extra=require(_0x29a0('0xc'));var _=require(_0x29a0('0xd'));var squel=require(_0x29a0('0xe'));var crypto=require(_0x29a0('0xf'));var jsforce=require(_0x29a0('0x10'));var deskjs=require(_0x29a0('0x11'));var toCsv=require(_0x29a0('0xa'));var querystring=require(_0x29a0('0x12'));var Papa=require('papaparse');var Redis=require(_0x29a0('0x13'));var authService=require(_0x29a0('0x14'));var qs=require(_0x29a0('0x15'));var as=require(_0x29a0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x29a0('0x17'));var utils=require(_0x29a0('0x18'));var config=require(_0x29a0('0x19'));var licenseUtil=require(_0x29a0('0x1a'));var db=require(_0x29a0('0x1b'))['db'];function respondWithStatusCode(_0x301592,_0x2263e3){_0x2263e3=_0x2263e3||0xcc;return function(_0x4dd727){if(_0x4dd727){return _0x301592[_0x29a0('0x1c')](_0x2263e3);}return _0x301592[_0x29a0('0x1d')](_0x2263e3)[_0x29a0('0x1e')]();};}function respondWithResult(_0x31cecd,_0x1888ad){_0x1888ad=_0x1888ad||0xc8;return function(_0x442b84){if(_0x442b84){return _0x31cecd['status'](_0x1888ad)['json'](_0x442b84);}};}function respondWithFilteredResult(_0x4d7cba,_0x29c5f8){return function(_0x135a1a){if(_0x135a1a){var _0x1a8a9c=typeof _0x29c5f8[_0x29a0('0x1f')]===_0x29a0('0x20')&&typeof _0x29c5f8[_0x29a0('0x21')]===_0x29a0('0x20');var _0x4a063c=_0x135a1a['count'];var _0x11c8d7=_0x1a8a9c?0x0:_0x29c5f8[_0x29a0('0x1f')];var _0x447e74=_0x1a8a9c?_0x135a1a[_0x29a0('0x22')]:_0x29c5f8['offset']+_0x29c5f8['limit'];var _0x3f95ea;if(_0x447e74>=_0x4a063c){_0x447e74=_0x4a063c;_0x3f95ea=0xc8;}else{_0x3f95ea=0xce;}_0x4d7cba[_0x29a0('0x1d')](_0x3f95ea);return _0x4d7cba[_0x29a0('0x23')](_0x29a0('0x24'),_0x11c8d7+'-'+_0x447e74+'/'+_0x4a063c)[_0x29a0('0x25')](_0x135a1a);}return null;};}function patchUpdates(_0x3b11b8){return function(_0x4b6af){try{jsonpatch[_0x29a0('0x26')](_0x4b6af,_0x3b11b8,!![]);}catch(_0x2b8d79){return BPromise['reject'](_0x2b8d79);}return _0x4b6af[_0x29a0('0x27')]();};}function saveUpdates(_0x321b2b,_0x13c40b){return function(_0x1b6084){if(_0x1b6084){return _0x1b6084['update'](_0x321b2b)[_0x29a0('0x28')](function(_0x12606f){return _0x12606f;});}return null;};}function removeEntity(_0x431f3e,_0x6ea2b0){return function(_0x2d3c38){if(_0x2d3c38){return _0x2d3c38[_0x29a0('0x29')]()[_0x29a0('0x28')](function(){_0x431f3e[_0x29a0('0x1d')](0xcc)[_0x29a0('0x1e')]();});}};}function handleEntityNotFound(_0x582d6b,_0x3368a1){return function(_0x38d1e9){if(!_0x38d1e9){_0x582d6b[_0x29a0('0x1c')](0x194);}return _0x38d1e9;};}function handleError(_0x33ffbf,_0x2903c8){_0x2903c8=_0x2903c8||0x1f4;return function(_0x1565bf){logger[_0x29a0('0x2a')](_0x1565bf['stack']);if(_0x1565bf[_0x29a0('0x2b')]){delete _0x1565bf['name'];}_0x33ffbf[_0x29a0('0x1d')](_0x2903c8)[_0x29a0('0x2c')](_0x1565bf);};}exports[_0x29a0('0x2d')]=function(_0x15ec39,_0x347357){var _0x1c029c={},_0x5698b6={},_0x55503e={'count':0x0,'rows':[]};var _0x3d5a0a=_['map'](db[_0x29a0('0x2e')][_0x29a0('0x2f')],function(_0xc295be){return{'name':_0xc295be[_0x29a0('0x30')],'type':_0xc295be[_0x29a0('0x31')][_0x29a0('0x32')]};});_0x5698b6[_0x29a0('0x33')]=_[_0x29a0('0x34')](_0x3d5a0a,_0x29a0('0x2b'));_0x5698b6[_0x29a0('0x35')]=_[_0x29a0('0x36')](_0x15ec39[_0x29a0('0x35')]);_0x5698b6[_0x29a0('0x37')]=_[_0x29a0('0x38')](_0x5698b6[_0x29a0('0x33')],_0x5698b6[_0x29a0('0x35')]);_0x1c029c[_0x29a0('0x39')]=_[_0x29a0('0x38')](_0x5698b6[_0x29a0('0x33')],qs[_0x29a0('0x3a')](_0x15ec39[_0x29a0('0x35')][_0x29a0('0x3a')]));_0x1c029c[_0x29a0('0x39')]=_0x1c029c[_0x29a0('0x39')]['length']?_0x1c029c[_0x29a0('0x39')]:_0x5698b6[_0x29a0('0x33')];if(!_0x15ec39[_0x29a0('0x35')][_0x29a0('0x3b')]('nolimit')){_0x1c029c[_0x29a0('0x21')]=qs[_0x29a0('0x21')](_0x15ec39[_0x29a0('0x35')][_0x29a0('0x21')]);_0x1c029c['offset']=qs[_0x29a0('0x1f')](_0x15ec39[_0x29a0('0x35')][_0x29a0('0x1f')]);}_0x1c029c['order']=qs[_0x29a0('0x3c')](_0x15ec39[_0x29a0('0x35')][_0x29a0('0x3c')]);_0x1c029c[_0x29a0('0x3d')]=qs[_0x29a0('0x37')](_[_0x29a0('0x3e')](_0x15ec39['query'],_0x5698b6[_0x29a0('0x37')]),_0x3d5a0a);if(_0x15ec39[_0x29a0('0x35')][_0x29a0('0x3f')]){_0x1c029c['where']=_[_0x29a0('0x40')](_0x1c029c[_0x29a0('0x3d')],{'$or':_[_0x29a0('0x34')](_0x3d5a0a,function(_0x446322){if(_0x446322[_0x29a0('0x31')]!==_0x29a0('0x41')){var _0x2ce339={};_0x2ce339[_0x446322[_0x29a0('0x2b')]]={'$like':'%'+_0x15ec39[_0x29a0('0x35')]['filter']+'%'};return _0x2ce339;}})});}_0x1c029c=_[_0x29a0('0x40')]({},_0x1c029c,_0x15ec39[_0x29a0('0x42')]);var _0x11984f={'where':_0x1c029c[_0x29a0('0x3d')]};return db[_0x29a0('0x2e')][_0x29a0('0x22')](_0x11984f)['then'](function(_0x44c881){_0x55503e[_0x29a0('0x22')]=_0x44c881;if(_0x15ec39['query']['includeAll']){_0x1c029c[_0x29a0('0x43')]=[{'all':!![]}];}return db[_0x29a0('0x2e')]['findAll'](_0x1c029c);})[_0x29a0('0x28')](function(_0x37779a){_0x55503e[_0x29a0('0x44')]=_0x37779a;return _0x55503e;})[_0x29a0('0x28')](respondWithFilteredResult(_0x347357,_0x1c029c))[_0x29a0('0x45')](handleError(_0x347357,null));};exports[_0x29a0('0x46')]=function(_0x27fec5,_0x4df18f){var _0x32e546={'raw':!![],'where':{'id':_0x27fec5[_0x29a0('0x47')]['id']}},_0x218e47={};_0x218e47[_0x29a0('0x33')]=_[_0x29a0('0x36')](db[_0x29a0('0x2e')]['rawAttributes']);_0x218e47[_0x29a0('0x35')]=_[_0x29a0('0x36')](_0x27fec5['query']);_0x218e47[_0x29a0('0x37')]=_[_0x29a0('0x38')](_0x218e47[_0x29a0('0x33')],_0x218e47['query']);_0x32e546[_0x29a0('0x39')]=_[_0x29a0('0x38')](_0x218e47['model'],qs[_0x29a0('0x3a')](_0x27fec5[_0x29a0('0x35')][_0x29a0('0x3a')]));_0x32e546['attributes']=_0x32e546['attributes'][_0x29a0('0x48')]?_0x32e546[_0x29a0('0x39')]:_0x218e47['model'];if(_0x27fec5[_0x29a0('0x35')]['includeAll']){_0x32e546['include']=[{'all':!![]}];}_0x32e546=_[_0x29a0('0x40')]({},_0x32e546,_0x27fec5[_0x29a0('0x42')]);return db[_0x29a0('0x2e')][_0x29a0('0x49')](_0x32e546)['then'](handleEntityNotFound(_0x4df18f,null))[_0x29a0('0x28')](respondWithResult(_0x4df18f,null))[_0x29a0('0x45')](handleError(_0x4df18f,null));};exports[_0x29a0('0x4a')]=function(_0x1378cb,_0x4c28db){return db[_0x29a0('0x2e')][_0x29a0('0x4a')](_0x1378cb[_0x29a0('0x4b')],{})[_0x29a0('0x28')](respondWithResult(_0x4c28db,0xc9))[_0x29a0('0x45')](handleError(_0x4c28db,null));};exports['update']=function(_0x1d4bb0,_0x4f2eb0){if(_0x1d4bb0[_0x29a0('0x4b')]['id']){delete _0x1d4bb0['body']['id'];}return db[_0x29a0('0x2e')][_0x29a0('0x49')]({'where':{'id':_0x1d4bb0['params']['id']}})[_0x29a0('0x28')](handleEntityNotFound(_0x4f2eb0,null))[_0x29a0('0x28')](saveUpdates(_0x1d4bb0[_0x29a0('0x4b')],null))['then'](respondWithResult(_0x4f2eb0,null))[_0x29a0('0x45')](handleError(_0x4f2eb0,null));};exports[_0x29a0('0x29')]=function(_0x595f8b,_0x10ba47){return db[_0x29a0('0x2e')][_0x29a0('0x49')]({'where':{'id':_0x595f8b[_0x29a0('0x47')]['id']}})['then'](handleEntityNotFound(_0x10ba47,null))[_0x29a0('0x28')](removeEntity(_0x10ba47,null))[_0x29a0('0x45')](handleError(_0x10ba47,null));};exports['describe']=function(_0x307976,_0x5bfeb2){return db[_0x29a0('0x2e')][_0x29a0('0x4c')]()[_0x29a0('0x28')](respondWithResult(_0x5bfeb2,null))['catch'](handleError(_0x5bfeb2,null));}; \ No newline at end of file +var _0xf209=['destroy','name','send','index','map','JscriptyQuestionReport','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','params','fields','include','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','save','update','then'];(function(_0x92a987,_0x4415b6){var _0x331f4c=function(_0x223e9d){while(--_0x223e9d){_0x92a987['push'](_0x92a987['shift']());}};_0x331f4c(++_0x4415b6);}(_0xf209,0xa7));var _0x9f20=function(_0x3b3750,_0x28f3b8){_0x3b3750=_0x3b3750-0x0;var _0x1b9e8b=_0xf209[_0x3b3750];return _0x1b9e8b;};'use strict';var emlformat=require(_0x9f20('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f20('0x1'));var rp=require(_0x9f20('0x2'));var moment=require(_0x9f20('0x3'));var BPromise=require(_0x9f20('0x4'));var Mustache=require('mustache');var util=require(_0x9f20('0x5'));var path=require('path');var sox=require(_0x9f20('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f20('0x7'));var _=require(_0x9f20('0x8'));var squel=require(_0x9f20('0x9'));var crypto=require(_0x9f20('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9f20('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9f20('0xc'));var Papa=require('papaparse');var Redis=require(_0x9f20('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9f20('0xe'));var as=require(_0x9f20('0xf'));var hardwareService=require(_0x9f20('0x10'));var logger=require(_0x9f20('0x11'))(_0x9f20('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9f20('0x13'));var db=require(_0x9f20('0x14'))['db'];function respondWithStatusCode(_0x819e4e,_0x38139a){_0x38139a=_0x38139a||0xcc;return function(_0x19bc16){if(_0x19bc16){return _0x819e4e[_0x9f20('0x15')](_0x38139a);}return _0x819e4e['status'](_0x38139a)[_0x9f20('0x16')]();};}function respondWithResult(_0x4ef4fb,_0x3c0df8){_0x3c0df8=_0x3c0df8||0xc8;return function(_0x2106f2){if(_0x2106f2){return _0x4ef4fb[_0x9f20('0x17')](_0x3c0df8)[_0x9f20('0x18')](_0x2106f2);}};}function respondWithFilteredResult(_0x509b6d,_0x1883cc){return function(_0x28ae95){if(_0x28ae95){var _0x3581fe=typeof _0x1883cc[_0x9f20('0x19')]===_0x9f20('0x1a')&&typeof _0x1883cc['limit']===_0x9f20('0x1a');var _0x5ff65a=_0x28ae95['count'];var _0x2bc0c0=_0x3581fe?0x0:_0x1883cc[_0x9f20('0x19')];var _0x4f9465=_0x3581fe?_0x28ae95[_0x9f20('0x1b')]:_0x1883cc[_0x9f20('0x19')]+_0x1883cc[_0x9f20('0x1c')];var _0x4353a0;if(_0x4f9465>=_0x5ff65a){_0x4f9465=_0x5ff65a;_0x4353a0=0xc8;}else{_0x4353a0=0xce;}_0x509b6d[_0x9f20('0x17')](_0x4353a0);return _0x509b6d[_0x9f20('0x1d')]('Content-Range',_0x2bc0c0+'-'+_0x4f9465+'/'+_0x5ff65a)[_0x9f20('0x18')](_0x28ae95);}return null;};}function patchUpdates(_0x43f623){return function(_0x234f1f){try{jsonpatch[_0x9f20('0x1e')](_0x234f1f,_0x43f623,!![]);}catch(_0x5909f3){return BPromise['reject'](_0x5909f3);}return _0x234f1f[_0x9f20('0x1f')]();};}function saveUpdates(_0x381bd2,_0x523625){return function(_0x183b4a){if(_0x183b4a){return _0x183b4a[_0x9f20('0x20')](_0x381bd2)[_0x9f20('0x21')](function(_0x22181a){return _0x22181a;});}return null;};}function removeEntity(_0x131c3b,_0x4fa5f1){return function(_0x54b2a3){if(_0x54b2a3){return _0x54b2a3[_0x9f20('0x22')]()[_0x9f20('0x21')](function(){_0x131c3b['status'](0xcc)[_0x9f20('0x16')]();});}};}function handleEntityNotFound(_0x2badf8,_0x3269f9){return function(_0x2cb683){if(!_0x2cb683){_0x2badf8[_0x9f20('0x15')](0x194);}return _0x2cb683;};}function handleError(_0x4d4941,_0x213120){_0x213120=_0x213120||0x1f4;return function(_0xc3ba4){logger['error'](_0xc3ba4['stack']);if(_0xc3ba4[_0x9f20('0x23')]){delete _0xc3ba4[_0x9f20('0x23')];}_0x4d4941[_0x9f20('0x17')](_0x213120)[_0x9f20('0x24')](_0xc3ba4);};}exports[_0x9f20('0x25')]=function(_0x162279,_0x158ab6){var _0x4bff52={},_0x3ecf4b={},_0x117c01={'count':0x0,'rows':[]};var _0x87a9e2=_[_0x9f20('0x26')](db[_0x9f20('0x27')]['rawAttributes'],function(_0x48d8cb){return{'name':_0x48d8cb[_0x9f20('0x28')],'type':_0x48d8cb[_0x9f20('0x29')]['key']};});_0x3ecf4b['model']=_['map'](_0x87a9e2,_0x9f20('0x23'));_0x3ecf4b[_0x9f20('0x2a')]=_[_0x9f20('0x2b')](_0x162279[_0x9f20('0x2a')]);_0x3ecf4b[_0x9f20('0x2c')]=_[_0x9f20('0x2d')](_0x3ecf4b[_0x9f20('0x2e')],_0x3ecf4b[_0x9f20('0x2a')]);_0x4bff52[_0x9f20('0x2f')]=_[_0x9f20('0x2d')](_0x3ecf4b[_0x9f20('0x2e')],qs['fields'](_0x162279[_0x9f20('0x2a')]['fields']));_0x4bff52[_0x9f20('0x2f')]=_0x4bff52['attributes'][_0x9f20('0x30')]?_0x4bff52[_0x9f20('0x2f')]:_0x3ecf4b['model'];if(!_0x162279[_0x9f20('0x2a')][_0x9f20('0x31')]('nolimit')){_0x4bff52[_0x9f20('0x1c')]=qs[_0x9f20('0x1c')](_0x162279[_0x9f20('0x2a')]['limit']);_0x4bff52[_0x9f20('0x19')]=qs[_0x9f20('0x19')](_0x162279['query'][_0x9f20('0x19')]);}_0x4bff52['order']=qs['sort'](_0x162279[_0x9f20('0x2a')][_0x9f20('0x32')]);_0x4bff52['where']=qs[_0x9f20('0x2c')](_[_0x9f20('0x33')](_0x162279[_0x9f20('0x2a')],_0x3ecf4b[_0x9f20('0x2c')]),_0x87a9e2);if(_0x162279[_0x9f20('0x2a')][_0x9f20('0x34')]){_0x4bff52[_0x9f20('0x35')]=_[_0x9f20('0x36')](_0x4bff52['where'],{'$or':_['map'](_0x87a9e2,function(_0x3ccf16){if(_0x3ccf16[_0x9f20('0x29')]!==_0x9f20('0x37')){var _0x5257e6={};_0x5257e6[_0x3ccf16[_0x9f20('0x23')]]={'$like':'%'+_0x162279[_0x9f20('0x2a')][_0x9f20('0x34')]+'%'};return _0x5257e6;}})});}_0x4bff52=_[_0x9f20('0x36')]({},_0x4bff52,_0x162279[_0x9f20('0x38')]);var _0x43062d={'where':_0x4bff52[_0x9f20('0x35')]};return db[_0x9f20('0x27')][_0x9f20('0x1b')](_0x43062d)[_0x9f20('0x21')](function(_0x4e389e){_0x117c01[_0x9f20('0x1b')]=_0x4e389e;if(_0x162279[_0x9f20('0x2a')][_0x9f20('0x39')]){_0x4bff52['include']=[{'all':!![]}];}return db[_0x9f20('0x27')][_0x9f20('0x3a')](_0x4bff52);})['then'](function(_0x4e479a){_0x117c01['rows']=_0x4e479a;return _0x117c01;})[_0x9f20('0x21')](respondWithFilteredResult(_0x158ab6,_0x4bff52))[_0x9f20('0x3b')](handleError(_0x158ab6,null));};exports['show']=function(_0x3271c3,_0x15e238){var _0x3bf8dd={'raw':!![],'where':{'id':_0x3271c3[_0x9f20('0x3c')]['id']}},_0x11ec65={};_0x11ec65[_0x9f20('0x2e')]=_[_0x9f20('0x2b')](db[_0x9f20('0x27')]['rawAttributes']);_0x11ec65['query']=_[_0x9f20('0x2b')](_0x3271c3[_0x9f20('0x2a')]);_0x11ec65['filters']=_['intersection'](_0x11ec65['model'],_0x11ec65[_0x9f20('0x2a')]);_0x3bf8dd[_0x9f20('0x2f')]=_['intersection'](_0x11ec65[_0x9f20('0x2e')],qs[_0x9f20('0x3d')](_0x3271c3['query']['fields']));_0x3bf8dd[_0x9f20('0x2f')]=_0x3bf8dd[_0x9f20('0x2f')][_0x9f20('0x30')]?_0x3bf8dd[_0x9f20('0x2f')]:_0x11ec65[_0x9f20('0x2e')];if(_0x3271c3[_0x9f20('0x2a')]['includeAll']){_0x3bf8dd[_0x9f20('0x3e')]=[{'all':!![]}];}_0x3bf8dd=_[_0x9f20('0x36')]({},_0x3bf8dd,_0x3271c3['options']);return db[_0x9f20('0x27')]['find'](_0x3bf8dd)['then'](handleEntityNotFound(_0x15e238,null))[_0x9f20('0x21')](respondWithResult(_0x15e238,null))['catch'](handleError(_0x15e238,null));};exports[_0x9f20('0x3f')]=function(_0x4e45a2,_0x3d6702){return db[_0x9f20('0x27')]['create'](_0x4e45a2[_0x9f20('0x40')],{})[_0x9f20('0x21')](respondWithResult(_0x3d6702,0xc9))[_0x9f20('0x3b')](handleError(_0x3d6702,null));};exports[_0x9f20('0x20')]=function(_0x3220a2,_0x38babf){if(_0x3220a2[_0x9f20('0x40')]['id']){delete _0x3220a2[_0x9f20('0x40')]['id'];}return db[_0x9f20('0x27')][_0x9f20('0x41')]({'where':{'id':_0x3220a2['params']['id']}})[_0x9f20('0x21')](handleEntityNotFound(_0x38babf,null))[_0x9f20('0x21')](saveUpdates(_0x3220a2['body'],null))[_0x9f20('0x21')](respondWithResult(_0x38babf,null))[_0x9f20('0x3b')](handleError(_0x38babf,null));};exports[_0x9f20('0x22')]=function(_0x156625,_0x3ae684){return db['JscriptyQuestionReport'][_0x9f20('0x41')]({'where':{'id':_0x156625[_0x9f20('0x3c')]['id']}})[_0x9f20('0x21')](handleEntityNotFound(_0x3ae684,null))[_0x9f20('0x21')](removeEntity(_0x3ae684,null))[_0x9f20('0x3b')](handleError(_0x3ae684,null));};exports['describe']=function(_0x4de213,_0x5c96a5){return db['JscriptyQuestionReport'][_0x9f20('0x42')]()[_0x9f20('0x21')](respondWithResult(_0x5c96a5,null))[_0x9f20('0x3b')](handleError(_0x5c96a5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d3011ca..0e9cbc4 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 _0x1576=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x1576,0x19e));var _0x6157=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x1576[_0x2ff238];return _0x204a56;};'use strict';var _=require(_0x6157('0x0'));var util=require(_0x6157('0x1'));var logger=require(_0x6157('0x2'))(_0x6157('0x3'));var moment=require(_0x6157('0x4'));var BPromise=require('bluebird');var rp=require(_0x6157('0x5'));var fs=require('fs');var path=require(_0x6157('0x6'));var rimraf=require(_0x6157('0x7'));var config=require(_0x6157('0x8'));var attributes=require(_0x6157('0x9'));module['exports']=function(_0x57338b,_0x49ca3f){return _0x57338b[_0x6157('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x6157('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a8b=['path','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','api','bluebird'];(function(_0x4b47a4,_0x29547f){var _0x2012ef=function(_0x28b326){while(--_0x28b326){_0x4b47a4['push'](_0x4b47a4['shift']());}};_0x2012ef(++_0x29547f);}(_0x9a8b,0x7d));var _0xb9a8=function(_0x2248ed,_0x518879){_0x2248ed=_0x2248ed-0x0;var _0x4198f5=_0x9a8b[_0x2248ed];return _0x4198f5;};'use strict';var _=require(_0xb9a8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb9a8('0x1'));var moment=require('moment');var BPromise=require(_0xb9a8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9a8('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb9a8('0x4'));module[_0xb9a8('0x5')]=function(_0x59f20d,_0xfae384){return _0x59f20d['define'](_0xb9a8('0x6'),attributes,{'tableName':_0xb9a8('0x7'),'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 d1faf05..05d55a2 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 _0x6423=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x46a635,_0x3cf6f0){var _0xff72f1=function(_0x3ac57b){while(--_0x3ac57b){_0x46a635['push'](_0x46a635['shift']());}};_0xff72f1(++_0x3cf6f0);}(_0x6423,0x19f));var _0x3642=function(_0x2eb3a3,_0x4040bf){_0x2eb3a3=_0x2eb3a3-0x0;var _0x475ba7=_0x6423[_0x2eb3a3];return _0x475ba7;};'use strict';var _=require(_0x3642('0x0'));var util=require(_0x3642('0x1'));var moment=require(_0x3642('0x2'));var BPromise=require(_0x3642('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3642('0x4'));var db=require(_0x3642('0x5'))['db'];var utils=require(_0x3642('0x6'));var logger=require(_0x3642('0x7'))(_0x3642('0x8'));var config=require(_0x3642('0x9'));var jayson=require(_0x3642('0xa'));var client=jayson[_0x3642('0xb')][_0x3642('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x482851,_0x6bd98e,_0x28b1df){return new BPromise(function(_0x38bf5a,_0x8a8483){return client[_0x3642('0xd')](_0x482851,_0x28b1df)[_0x3642('0xe')](function(_0x2132ee){logger[_0x3642('0xf')](_0x3642('0x10'),_0x6bd98e,_0x3642('0x11'));logger[_0x3642('0x12')](_0x3642('0x13'),_0x6bd98e,_0x3642('0x11'),JSON[_0x3642('0x14')](_0x2132ee));if(_0x2132ee[_0x3642('0x15')]){if(_0x2132ee[_0x3642('0x15')][_0x3642('0x16')]===0x1f4){logger[_0x3642('0x15')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x6bd98e,_0x2132ee[_0x3642('0x15')]['message']);return _0x8a8483(_0x2132ee[_0x3642('0x15')]['message']);}logger[_0x3642('0x15')](_0x3642('0x10'),_0x6bd98e,_0x2132ee[_0x3642('0x15')][_0x3642('0x17')]);return _0x38bf5a(_0x2132ee[_0x3642('0x15')][_0x3642('0x17')]);}else{logger[_0x3642('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x6bd98e,_0x3642('0x11'));_0x38bf5a(_0x2132ee[_0x3642('0x18')][_0x3642('0x17')]);}})[_0x3642('0x19')](function(_0x3d8cca){logger[_0x3642('0x15')](_0x3642('0x10'),_0x6bd98e,_0x3d8cca);_0x8a8483(_0x3d8cca);});});} \ No newline at end of file +var _0x7af9=['request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x49857a,_0x3f99d3){var _0x1df6c7=function(_0x556a60){while(--_0x556a60){_0x49857a['push'](_0x49857a['shift']());}};_0x1df6c7(++_0x3f99d3);}(_0x7af9,0x1e3));var _0x97af=function(_0x5a5104,_0x448fca){_0x5a5104=_0x5a5104-0x0;var _0x47ba61=_0x7af9[_0x5a5104];return _0x47ba61;};'use strict';var _=require(_0x97af('0x0'));var util=require(_0x97af('0x1'));var moment=require(_0x97af('0x2'));var BPromise=require(_0x97af('0x3'));var rs=require(_0x97af('0x4'));var fs=require('fs');var Redis=require(_0x97af('0x5'));var db=require(_0x97af('0x6'))['db'];var utils=require(_0x97af('0x7'));var logger=require(_0x97af('0x8'))(_0x97af('0x9'));var config=require(_0x97af('0xa'));var jayson=require(_0x97af('0xb'));var client=jayson[_0x97af('0xc')][_0x97af('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x260e50,_0x3123c8,_0x3ad145){return new BPromise(function(_0x4698f3,_0x55eb51){return client[_0x97af('0xe')](_0x260e50,_0x3ad145)[_0x97af('0xf')](function(_0x264389){logger['info'](_0x97af('0x10'),_0x3123c8,_0x97af('0x11'));logger['debug'](_0x97af('0x12'),_0x3123c8,_0x97af('0x11'),JSON[_0x97af('0x13')](_0x264389));if(_0x264389[_0x97af('0x14')]){if(_0x264389[_0x97af('0x14')][_0x97af('0x15')]===0x1f4){logger[_0x97af('0x14')](_0x97af('0x10'),_0x3123c8,_0x264389[_0x97af('0x14')]['message']);return _0x55eb51(_0x264389[_0x97af('0x14')][_0x97af('0x16')]);}logger[_0x97af('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3123c8,_0x264389['error'][_0x97af('0x16')]);return _0x4698f3(_0x264389['error']['message']);}else{logger['info'](_0x97af('0x10'),_0x3123c8,'request\x20sent');_0x4698f3(_0x264389[_0x97af('0x17')][_0x97af('0x16')]);}})[_0x97af('0x18')](function(_0x4d76d8){logger['error'](_0x97af('0x10'),_0x3123c8,_0x4d76d8);_0x55eb51(_0x4d76d8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 5127ffe..2f45eb2 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 _0x9846=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','post','create','put','delete'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0x9846,0x120));var _0x6984=function(_0x158a19,_0x3c9b98){_0x158a19=_0x158a19-0x0;var _0x211080=_0x9846[_0x158a19];return _0x211080;};'use strict';var multer=require(_0x6984('0x0'));var util=require(_0x6984('0x1'));var path=require(_0x6984('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6984('0x3')]();var fs_extra=require(_0x6984('0x4'));var auth=require(_0x6984('0x5'));var interaction=require(_0x6984('0x6'));var config=require(_0x6984('0x7'));var controller=require(_0x6984('0x8'));router[_0x6984('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6984('0x9')](_0x6984('0xa'),auth[_0x6984('0xb')](),controller[_0x6984('0xc')]);router['get'](_0x6984('0xd'),auth[_0x6984('0xb')](),controller[_0x6984('0xe')]);router['get'](_0x6984('0xf'),auth[_0x6984('0xb')](),controller['getQuestions']);router[_0x6984('0x10')]('/',auth['isAuthenticated'](),controller[_0x6984('0x11')]);router[_0x6984('0x12')](_0x6984('0xd'),auth[_0x6984('0xb')](),controller['update']);router[_0x6984('0x13')]('/:id',auth[_0x6984('0xb')](),controller[_0x6984('0x14')]);module[_0x6984('0x15')]=router; \ No newline at end of file +var _0x0209=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/questions','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x7dbe94,_0x5a80a0){var _0xa43a01=function(_0x1505cf){while(--_0x1505cf){_0x7dbe94['push'](_0x7dbe94['shift']());}};_0xa43a01(++_0x5a80a0);}(_0x0209,0x126));var _0x9020=function(_0x2513a1,_0x1ffb95){_0x2513a1=_0x2513a1-0x0;var _0x36e5e7=_0x0209[_0x2513a1];return _0x36e5e7;};'use strict';var multer=require(_0x9020('0x0'));var util=require(_0x9020('0x1'));var path=require(_0x9020('0x2'));var timeout=require(_0x9020('0x3'));var express=require(_0x9020('0x4'));var router=express[_0x9020('0x5')]();var fs_extra=require(_0x9020('0x6'));var auth=require(_0x9020('0x7'));var interaction=require(_0x9020('0x8'));var config=require(_0x9020('0x9'));var controller=require(_0x9020('0xa'));router['get']('/',auth[_0x9020('0xb')](),controller[_0x9020('0xc')]);router[_0x9020('0xd')](_0x9020('0xe'),auth[_0x9020('0xb')](),controller[_0x9020('0xf')]);router[_0x9020('0xd')](_0x9020('0x10'),auth['isAuthenticated'](),controller[_0x9020('0x11')]);router[_0x9020('0xd')](_0x9020('0x12'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth[_0x9020('0xb')](),controller[_0x9020('0x13')]);router[_0x9020('0x14')](_0x9020('0x10'),auth[_0x9020('0xb')](),controller[_0x9020('0x15')]);router['delete'](_0x9020('0x10'),auth[_0x9020('0xb')](),controller['destroy']);module[_0x9020('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 0e6434e..fbf7a4a 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 _0x4549=['STRING','moment','sequelize','exports','DATE','starttime','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4549,0x14e));var _0x9454=function(_0x184259,_0x23d6bf){_0x184259=_0x184259-0x0;var _0x1c0227=_0x4549[_0x184259];return _0x1c0227;};'use strict';var moment=require(_0x9454('0x0'));var Sequelize=require(_0x9454('0x1'));module[_0x9454('0x2')]={'starttime':{'type':Sequelize[_0x9454('0x3')],'set':function(_0x3b5709){this['setDataValue'](_0x9454('0x4'),_0x3b5709);this[_0x9454('0x5')](_0x9454('0x6'),moment()['format'](_0x9454('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x9454('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9454('0x8')]},'calleridname':{'type':Sequelize[_0x9454('0x8')]},'calleridnum':{'type':Sequelize[_0x9454('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x51d1=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x575cfb,_0x14344a){var _0x5d9759=function(_0x22715a){while(--_0x22715a){_0x575cfb['push'](_0x575cfb['shift']());}};_0x5d9759(++_0x14344a);}(_0x51d1,0x1d6));var _0x151d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x51d1[_0xa1e3e3];return _0xc980e9;};'use strict';var moment=require(_0x151d('0x0'));var Sequelize=require(_0x151d('0x1'));module[_0x151d('0x2')]={'starttime':{'type':Sequelize[_0x151d('0x3')],'set':function(_0x3e3bb0){this[_0x151d('0x4')](_0x151d('0x5'),_0x3e3bb0);this[_0x151d('0x4')](_0x151d('0x6'),moment()[_0x151d('0x7')](_0x151d('0x8')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x151d('0x9')]},'projectname':{'type':Sequelize[_0x151d('0x9')]},'queue':{'type':Sequelize[_0x151d('0x9')]},'uniqueid':{'type':Sequelize[_0x151d('0x9')]},'calleridname':{'type':Sequelize[_0x151d('0x9')]},'calleridnum':{'type':Sequelize[_0x151d('0x9')]},'completed':{'type':Sequelize[_0x151d('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 38be1ed..55c9602 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 _0x863b=['fast-json-patch','moment','bluebird','util','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','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','catch','show','params','JscriptySessionReport','keys','length','merge','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','rows','rimraf','zip-dir'];(function(_0x5504fc,_0x2e161c){var _0xbad34c=function(_0x1f62de){while(--_0x1f62de){_0x5504fc['push'](_0x5504fc['shift']());}};_0xbad34c(++_0x2e161c);}(_0x863b,0x184));var _0xb863=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x863b[_0x11946c];return _0x383935;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb863('0x0'));var zipdir=require(_0xb863('0x1'));var jsonpatch=require(_0xb863('0x2'));var rp=require('request-promise');var moment=require(_0xb863('0x3'));var BPromise=require(_0xb863('0x4'));var Mustache=require('mustache');var util=require(_0xb863('0x5'));var path=require(_0xb863('0x6'));var sox=require(_0xb863('0x7'));var csv=require(_0xb863('0x8'));var ejs=require(_0xb863('0x9'));var fs=require('fs');var fs_extra=require(_0xb863('0xa'));var _=require(_0xb863('0xb'));var squel=require(_0xb863('0xc'));var crypto=require(_0xb863('0xd'));var jsforce=require(_0xb863('0xe'));var deskjs=require(_0xb863('0xf'));var toCsv=require(_0xb863('0x8'));var querystring=require(_0xb863('0x10'));var Papa=require(_0xb863('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb863('0x12'));var as=require(_0xb863('0x13'));var hardwareService=require(_0xb863('0x14'));var logger=require(_0xb863('0x15'))('api');var utils=require(_0xb863('0x16'));var config=require(_0xb863('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d4f94,_0x52d601){_0x52d601=_0x52d601||0xcc;return function(_0x4f19ea){if(_0x4f19ea){return _0x4d4f94[_0xb863('0x18')](_0x52d601);}return _0x4d4f94[_0xb863('0x19')](_0x52d601)[_0xb863('0x1a')]();};}function respondWithResult(_0x4a8423,_0x5b89af){_0x5b89af=_0x5b89af||0xc8;return function(_0x5b8255){if(_0x5b8255){return _0x4a8423[_0xb863('0x19')](_0x5b89af)[_0xb863('0x1b')](_0x5b8255);}};}function respondWithFilteredResult(_0xe16bb9,_0xfd3b44){return function(_0x166c77){if(_0x166c77){var _0xba331d=typeof _0xfd3b44[_0xb863('0x1c')]===_0xb863('0x1d')&&typeof _0xfd3b44[_0xb863('0x1e')]===_0xb863('0x1d');var _0x1622bd=_0x166c77[_0xb863('0x1f')];var _0xfbeb60=_0xba331d?0x0:_0xfd3b44[_0xb863('0x1c')];var _0x1e860d=_0xba331d?_0x166c77['count']:_0xfd3b44[_0xb863('0x1c')]+_0xfd3b44[_0xb863('0x1e')];var _0x1db236;if(_0x1e860d>=_0x1622bd){_0x1e860d=_0x1622bd;_0x1db236=0xc8;}else{_0x1db236=0xce;}_0xe16bb9[_0xb863('0x19')](_0x1db236);return _0xe16bb9[_0xb863('0x20')]('Content-Range',_0xfbeb60+'-'+_0x1e860d+'/'+_0x1622bd)[_0xb863('0x1b')](_0x166c77);}return null;};}function patchUpdates(_0x1566bb){return function(_0x40d493){try{jsonpatch[_0xb863('0x21')](_0x40d493,_0x1566bb,!![]);}catch(_0x268b67){return BPromise[_0xb863('0x22')](_0x268b67);}return _0x40d493['save']();};}function saveUpdates(_0x2603dc,_0x175c5e){return function(_0x128247){if(_0x128247){return _0x128247[_0xb863('0x23')](_0x2603dc)['then'](function(_0x56dafa){return _0x56dafa;});}return null;};}function removeEntity(_0x3c3ec3,_0x4e1822){return function(_0x5abcea){if(_0x5abcea){return _0x5abcea[_0xb863('0x24')]()[_0xb863('0x25')](function(){_0x3c3ec3[_0xb863('0x19')](0xcc)[_0xb863('0x1a')]();});}};}function handleEntityNotFound(_0xf5bbcb,_0x47dbbe){return function(_0x5d0134){if(!_0x5d0134){_0xf5bbcb[_0xb863('0x18')](0x194);}return _0x5d0134;};}function handleError(_0x3d8265,_0xe7561b){_0xe7561b=_0xe7561b||0x1f4;return function(_0x46c1e1){logger[_0xb863('0x26')](_0x46c1e1[_0xb863('0x27')]);if(_0x46c1e1[_0xb863('0x28')]){delete _0x46c1e1['name'];}_0x3d8265['status'](_0xe7561b)[_0xb863('0x29')](_0x46c1e1);};}exports[_0xb863('0x2a')]=function(_0x201e3d,_0x172079){var _0x31eda1={},_0x4cd1a2={},_0xb17283={'count':0x0,'rows':[]};var _0x2f2ef5=_[_0xb863('0x2b')](db['JscriptySessionReport'][_0xb863('0x2c')],function(_0x5ddca3){return{'name':_0x5ddca3['fieldName'],'type':_0x5ddca3['type'][_0xb863('0x2d')]};});_0x4cd1a2[_0xb863('0x2e')]=_[_0xb863('0x2b')](_0x2f2ef5,_0xb863('0x28'));_0x4cd1a2[_0xb863('0x2f')]=_['keys'](_0x201e3d[_0xb863('0x2f')]);_0x4cd1a2['filters']=_[_0xb863('0x30')](_0x4cd1a2[_0xb863('0x2e')],_0x4cd1a2[_0xb863('0x2f')]);_0x31eda1[_0xb863('0x31')]=_[_0xb863('0x30')](_0x4cd1a2[_0xb863('0x2e')],qs[_0xb863('0x32')](_0x201e3d[_0xb863('0x2f')][_0xb863('0x32')]));_0x31eda1[_0xb863('0x31')]=_0x31eda1['attributes']['length']?_0x31eda1[_0xb863('0x31')]:_0x4cd1a2[_0xb863('0x2e')];if(!_0x201e3d['query'][_0xb863('0x33')](_0xb863('0x34'))){_0x31eda1[_0xb863('0x1e')]=qs['limit'](_0x201e3d['query'][_0xb863('0x1e')]);_0x31eda1[_0xb863('0x1c')]=qs[_0xb863('0x1c')](_0x201e3d['query']['offset']);}_0x31eda1[_0xb863('0x35')]=qs['sort'](_0x201e3d[_0xb863('0x2f')][_0xb863('0x36')]);_0x31eda1[_0xb863('0x37')]=qs[_0xb863('0x38')](_[_0xb863('0x39')](_0x201e3d[_0xb863('0x2f')],_0x4cd1a2['filters']),_0x2f2ef5);if(_0x201e3d[_0xb863('0x2f')]['filter']){_0x31eda1[_0xb863('0x37')]=_['merge'](_0x31eda1['where'],{'$or':_[_0xb863('0x2b')](_0x2f2ef5,function(_0x6e1c1d){if(_0x6e1c1d['type']!=='VIRTUAL'){var _0x1729e9={};_0x1729e9[_0x6e1c1d[_0xb863('0x28')]]={'$like':'%'+_0x201e3d[_0xb863('0x2f')][_0xb863('0x3a')]+'%'};return _0x1729e9;}})});}_0x31eda1=_['merge']({},_0x31eda1,_0x201e3d[_0xb863('0x3b')]);var _0x16d7b5={'where':_0x31eda1[_0xb863('0x37')]};return db['JscriptySessionReport'][_0xb863('0x1f')](_0x16d7b5)['then'](function(_0x25ee77){_0xb17283[_0xb863('0x1f')]=_0x25ee77;if(_0x201e3d[_0xb863('0x2f')][_0xb863('0x3c')]){_0x31eda1[_0xb863('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xb863('0x3e')](_0x31eda1);})[_0xb863('0x25')](function(_0xec8c84){_0xb17283['rows']=_0xec8c84;return _0xb17283;})[_0xb863('0x25')](respondWithFilteredResult(_0x172079,_0x31eda1))[_0xb863('0x3f')](handleError(_0x172079,null));};exports[_0xb863('0x40')]=function(_0x3e7b44,_0xb22d39){var _0xae62b9={'raw':!![],'where':{'id':_0x3e7b44[_0xb863('0x41')]['id']}},_0x561e01={};_0x561e01[_0xb863('0x2e')]=_['keys'](db[_0xb863('0x42')][_0xb863('0x2c')]);_0x561e01[_0xb863('0x2f')]=_[_0xb863('0x43')](_0x3e7b44[_0xb863('0x2f')]);_0x561e01[_0xb863('0x38')]=_[_0xb863('0x30')](_0x561e01[_0xb863('0x2e')],_0x561e01[_0xb863('0x2f')]);_0xae62b9['attributes']=_['intersection'](_0x561e01[_0xb863('0x2e')],qs[_0xb863('0x32')](_0x3e7b44['query'][_0xb863('0x32')]));_0xae62b9['attributes']=_0xae62b9[_0xb863('0x31')][_0xb863('0x44')]?_0xae62b9[_0xb863('0x31')]:_0x561e01['model'];if(_0x3e7b44[_0xb863('0x2f')][_0xb863('0x3c')]){_0xae62b9[_0xb863('0x3d')]=[{'all':!![]}];}_0xae62b9=_[_0xb863('0x45')]({},_0xae62b9,_0x3e7b44[_0xb863('0x3b')]);return db[_0xb863('0x42')][_0xb863('0x46')](_0xae62b9)[_0xb863('0x25')](handleEntityNotFound(_0xb22d39,null))[_0xb863('0x25')](respondWithResult(_0xb22d39,null))[_0xb863('0x3f')](handleError(_0xb22d39,null));};exports[_0xb863('0x47')]=function(_0x540cf9,_0xc619fd){return db[_0xb863('0x42')][_0xb863('0x47')](_0x540cf9[_0xb863('0x48')],{})['then'](respondWithResult(_0xc619fd,0xc9))[_0xb863('0x3f')](handleError(_0xc619fd,null));};exports[_0xb863('0x23')]=function(_0xca0d62,_0x104172){if(_0xca0d62[_0xb863('0x48')]['id']){delete _0xca0d62[_0xb863('0x48')]['id'];}return db[_0xb863('0x42')][_0xb863('0x46')]({'where':{'id':_0xca0d62[_0xb863('0x41')]['id']}})[_0xb863('0x25')](handleEntityNotFound(_0x104172,null))[_0xb863('0x25')](saveUpdates(_0xca0d62[_0xb863('0x48')],null))['then'](respondWithResult(_0x104172,null))[_0xb863('0x3f')](handleError(_0x104172,null));};exports['destroy']=function(_0x4332af,_0x496bb5){return db[_0xb863('0x42')][_0xb863('0x46')]({'where':{'id':_0x4332af[_0xb863('0x41')]['id']}})[_0xb863('0x25')](handleEntityNotFound(_0x496bb5,null))['then'](removeEntity(_0x496bb5,null))['catch'](handleError(_0x496bb5,null));};exports[_0xb863('0x49')]=function(_0x108138,_0xbda0cf){return db[_0xb863('0x42')][_0xb863('0x49')]()[_0xb863('0x25')](respondWithResult(_0xbda0cf,null))[_0xb863('0x3f')](handleError(_0xbda0cf,null));};exports[_0xb863('0x4a')]=function(_0x3419bb,_0x42d581,_0x1c7f89){var _0xcd5cf9={'raw':!![],'where':{}};var _0x29e86f={};var _0x401f29={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xb863('0x4b')]({'where':{'id':_0x3419bb[_0xb863('0x41')]['id']}})[_0xb863('0x25')](handleEntityNotFound(_0x42d581,null))[_0xb863('0x25')](function(_0x18d6fc){if(_0x18d6fc){_0x29e86f[_0xb863('0x2e')]=_[_0xb863('0x43')](db[_0xb863('0x4c')][_0xb863('0x2c')]);_0x29e86f[_0xb863('0x2f')]=_[_0xb863('0x43')](_0x3419bb[_0xb863('0x2f')]);_0x29e86f[_0xb863('0x38')]=_[_0xb863('0x30')](_0x29e86f[_0xb863('0x2e')],_0x29e86f[_0xb863('0x2f')]);_0xcd5cf9['attributes']=_[_0xb863('0x30')](_0x29e86f[_0xb863('0x2e')],qs[_0xb863('0x32')](_0x3419bb[_0xb863('0x2f')][_0xb863('0x32')]));_0xcd5cf9['attributes']=_0xcd5cf9[_0xb863('0x31')]['length']?_0xcd5cf9[_0xb863('0x31')]:_0x29e86f[_0xb863('0x2e')];if(!_0x3419bb[_0xb863('0x2f')][_0xb863('0x33')](_0xb863('0x34'))){_0xcd5cf9[_0xb863('0x1e')]=qs['limit'](_0x3419bb[_0xb863('0x2f')][_0xb863('0x1e')]);_0xcd5cf9[_0xb863('0x1c')]=qs[_0xb863('0x1c')](_0x3419bb['query'][_0xb863('0x1c')]);}_0xcd5cf9[_0xb863('0x35')]=qs['sort'](_0x3419bb[_0xb863('0x2f')][_0xb863('0x36')]);_0xcd5cf9['where']=qs[_0xb863('0x38')](_[_0xb863('0x39')](_0x3419bb[_0xb863('0x2f')],_0x29e86f[_0xb863('0x38')]));_0xcd5cf9[_0xb863('0x37')]['SessionId']=_0x18d6fc['id'];if(_0x3419bb[_0xb863('0x2f')][_0xb863('0x3a')]){_0xcd5cf9['where']=_[_0xb863('0x45')](_0xcd5cf9[_0xb863('0x37')],{'$or':_[_0xb863('0x2b')](_0xcd5cf9[_0xb863('0x31')],function(_0x404e05){var _0x5a9f4a={};_0x5a9f4a[_0x404e05]={'$like':'%'+_0x3419bb[_0xb863('0x2f')][_0xb863('0x3a')]+'%'};return _0x5a9f4a;})});}_0xcd5cf9=_[_0xb863('0x45')]({},_0xcd5cf9,_0x3419bb[_0xb863('0x3b')]);return db['JscriptyQuestionReport'][_0xb863('0x1f')]({'where':_0xcd5cf9['where']})['then'](function(_0x5ad144){_0x401f29[_0xb863('0x1f')]=_0x5ad144;if(_0x3419bb['query'][_0xb863('0x3c')]){_0xcd5cf9[_0xb863('0x3d')]=[{'all':!![]}];}return db[_0xb863('0x4c')]['findAll'](_0xcd5cf9);})[_0xb863('0x25')](function(_0x210647){_0x401f29[_0xb863('0x4d')]=_0x210647;return _0x401f29;});}})[_0xb863('0x25')](respondWithFilteredResult(_0x42d581,_0xcd5cf9))[_0xb863('0x3f')](handleError(_0x42d581,null));}; \ No newline at end of file +var _0x7e6e=['fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','includeAll','eml-format','rimraf','zip-dir'];(function(_0x12803e,_0x56c117){var _0x4e87f8=function(_0x1da364){while(--_0x1da364){_0x12803e['push'](_0x12803e['shift']());}};_0x4e87f8(++_0x56c117);}(_0x7e6e,0xea));var _0xe7e6=function(_0x435b46,_0x152bc1){_0x435b46=_0x435b46-0x0;var _0x42972c=_0x7e6e[_0x435b46];return _0x42972c;};'use strict';var emlformat=require(_0xe7e6('0x0'));var rimraf=require(_0xe7e6('0x1'));var zipdir=require(_0xe7e6('0x2'));var jsonpatch=require(_0xe7e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe7e6('0x4'));var Mustache=require(_0xe7e6('0x5'));var util=require(_0xe7e6('0x6'));var path=require(_0xe7e6('0x7'));var sox=require(_0xe7e6('0x8'));var csv=require('to-csv');var ejs=require(_0xe7e6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe7e6('0xa'));var crypto=require(_0xe7e6('0xb'));var jsforce=require(_0xe7e6('0xc'));var deskjs=require(_0xe7e6('0xd'));var toCsv=require(_0xe7e6('0xe'));var querystring=require(_0xe7e6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe7e6('0x10'));var hardwareService=require(_0xe7e6('0x11'));var logger=require(_0xe7e6('0x12'))(_0xe7e6('0x13'));var utils=require(_0xe7e6('0x14'));var config=require(_0xe7e6('0x15'));var licenseUtil=require(_0xe7e6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26ef2f,_0x46a955){_0x46a955=_0x46a955||0xcc;return function(_0x45b2e0){if(_0x45b2e0){return _0x26ef2f[_0xe7e6('0x17')](_0x46a955);}return _0x26ef2f[_0xe7e6('0x18')](_0x46a955)[_0xe7e6('0x19')]();};}function respondWithResult(_0x4ce0dd,_0xdbee6d){_0xdbee6d=_0xdbee6d||0xc8;return function(_0x55c82c){if(_0x55c82c){return _0x4ce0dd[_0xe7e6('0x18')](_0xdbee6d)[_0xe7e6('0x1a')](_0x55c82c);}};}function respondWithFilteredResult(_0x5c095a,_0x251085){return function(_0x3d3619){if(_0x3d3619){var _0x521db1=typeof _0x251085[_0xe7e6('0x1b')]==='undefined'&&typeof _0x251085[_0xe7e6('0x1c')]===_0xe7e6('0x1d');var _0x29d517=_0x3d3619[_0xe7e6('0x1e')];var _0x576b7d=_0x521db1?0x0:_0x251085[_0xe7e6('0x1b')];var _0x20a766=_0x521db1?_0x3d3619[_0xe7e6('0x1e')]:_0x251085['offset']+_0x251085['limit'];var _0x5ef49b;if(_0x20a766>=_0x29d517){_0x20a766=_0x29d517;_0x5ef49b=0xc8;}else{_0x5ef49b=0xce;}_0x5c095a[_0xe7e6('0x18')](_0x5ef49b);return _0x5c095a[_0xe7e6('0x1f')](_0xe7e6('0x20'),_0x576b7d+'-'+_0x20a766+'/'+_0x29d517)[_0xe7e6('0x1a')](_0x3d3619);}return null;};}function patchUpdates(_0x403565){return function(_0xc30736){try{jsonpatch['apply'](_0xc30736,_0x403565,!![]);}catch(_0x488014){return BPromise[_0xe7e6('0x21')](_0x488014);}return _0xc30736[_0xe7e6('0x22')]();};}function saveUpdates(_0x195636,_0x27a6ca){return function(_0x476030){if(_0x476030){return _0x476030['update'](_0x195636)[_0xe7e6('0x23')](function(_0x4fb06a){return _0x4fb06a;});}return null;};}function removeEntity(_0x4b564d,_0x4625c3){return function(_0x528451){if(_0x528451){return _0x528451['destroy']()['then'](function(){_0x4b564d[_0xe7e6('0x18')](0xcc)[_0xe7e6('0x19')]();});}};}function handleEntityNotFound(_0x34379c,_0x346148){return function(_0x4c49a3){if(!_0x4c49a3){_0x34379c[_0xe7e6('0x17')](0x194);}return _0x4c49a3;};}function handleError(_0x516c36,_0x2d17f4){_0x2d17f4=_0x2d17f4||0x1f4;return function(_0x3c6fb7){logger[_0xe7e6('0x24')](_0x3c6fb7[_0xe7e6('0x25')]);if(_0x3c6fb7['name']){delete _0x3c6fb7[_0xe7e6('0x26')];}_0x516c36[_0xe7e6('0x18')](_0x2d17f4)[_0xe7e6('0x27')](_0x3c6fb7);};}exports[_0xe7e6('0x28')]=function(_0x2a5023,_0x32015c){var _0x1c4005={},_0x3a4e8c={},_0x2eb8bb={'count':0x0,'rows':[]};var _0x18bbb4=_[_0xe7e6('0x29')](db[_0xe7e6('0x2a')][_0xe7e6('0x2b')],function(_0x20383e){return{'name':_0x20383e['fieldName'],'type':_0x20383e[_0xe7e6('0x2c')]['key']};});_0x3a4e8c[_0xe7e6('0x2d')]=_[_0xe7e6('0x29')](_0x18bbb4,_0xe7e6('0x26'));_0x3a4e8c[_0xe7e6('0x2e')]=_['keys'](_0x2a5023['query']);_0x3a4e8c[_0xe7e6('0x2f')]=_['intersection'](_0x3a4e8c[_0xe7e6('0x2d')],_0x3a4e8c['query']);_0x1c4005['attributes']=_[_0xe7e6('0x30')](_0x3a4e8c[_0xe7e6('0x2d')],qs[_0xe7e6('0x31')](_0x2a5023[_0xe7e6('0x2e')]['fields']));_0x1c4005[_0xe7e6('0x32')]=_0x1c4005[_0xe7e6('0x32')][_0xe7e6('0x33')]?_0x1c4005[_0xe7e6('0x32')]:_0x3a4e8c['model'];if(!_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x34')](_0xe7e6('0x35'))){_0x1c4005[_0xe7e6('0x1c')]=qs['limit'](_0x2a5023['query'][_0xe7e6('0x1c')]);_0x1c4005[_0xe7e6('0x1b')]=qs['offset'](_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x1b')]);}_0x1c4005[_0xe7e6('0x36')]=qs[_0xe7e6('0x37')](_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x37')]);_0x1c4005[_0xe7e6('0x38')]=qs[_0xe7e6('0x2f')](_['pick'](_0x2a5023[_0xe7e6('0x2e')],_0x3a4e8c[_0xe7e6('0x2f')]),_0x18bbb4);if(_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x39')]){_0x1c4005['where']=_[_0xe7e6('0x3a')](_0x1c4005[_0xe7e6('0x38')],{'$or':_['map'](_0x18bbb4,function(_0x486d02){if(_0x486d02['type']!==_0xe7e6('0x3b')){var _0x58d053={};_0x58d053[_0x486d02[_0xe7e6('0x26')]]={'$like':'%'+_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x39')]+'%'};return _0x58d053;}})});}_0x1c4005=_[_0xe7e6('0x3a')]({},_0x1c4005,_0x2a5023[_0xe7e6('0x3c')]);var _0x3cb747={'where':_0x1c4005[_0xe7e6('0x38')]};return db[_0xe7e6('0x2a')][_0xe7e6('0x1e')](_0x3cb747)[_0xe7e6('0x23')](function(_0x4a2aea){_0x2eb8bb[_0xe7e6('0x1e')]=_0x4a2aea;if(_0x2a5023[_0xe7e6('0x2e')]['includeAll']){_0x1c4005[_0xe7e6('0x3d')]=[{'all':!![]}];}return db[_0xe7e6('0x2a')][_0xe7e6('0x3e')](_0x1c4005);})['then'](function(_0x323ca8){_0x2eb8bb[_0xe7e6('0x3f')]=_0x323ca8;return _0x2eb8bb;})[_0xe7e6('0x23')](respondWithFilteredResult(_0x32015c,_0x1c4005))[_0xe7e6('0x40')](handleError(_0x32015c,null));};exports[_0xe7e6('0x41')]=function(_0x5923e5,_0x530502){var _0x47364b={'raw':!![],'where':{'id':_0x5923e5[_0xe7e6('0x42')]['id']}},_0x2bb6a6={};_0x2bb6a6[_0xe7e6('0x2d')]=_['keys'](db[_0xe7e6('0x2a')][_0xe7e6('0x2b')]);_0x2bb6a6[_0xe7e6('0x2e')]=_[_0xe7e6('0x43')](_0x5923e5[_0xe7e6('0x2e')]);_0x2bb6a6[_0xe7e6('0x2f')]=_[_0xe7e6('0x30')](_0x2bb6a6[_0xe7e6('0x2d')],_0x2bb6a6['query']);_0x47364b[_0xe7e6('0x32')]=_[_0xe7e6('0x30')](_0x2bb6a6[_0xe7e6('0x2d')],qs[_0xe7e6('0x31')](_0x5923e5[_0xe7e6('0x2e')][_0xe7e6('0x31')]));_0x47364b['attributes']=_0x47364b[_0xe7e6('0x32')][_0xe7e6('0x33')]?_0x47364b[_0xe7e6('0x32')]:_0x2bb6a6[_0xe7e6('0x2d')];if(_0x5923e5[_0xe7e6('0x2e')]['includeAll']){_0x47364b[_0xe7e6('0x3d')]=[{'all':!![]}];}_0x47364b=_[_0xe7e6('0x3a')]({},_0x47364b,_0x5923e5[_0xe7e6('0x3c')]);return db[_0xe7e6('0x2a')][_0xe7e6('0x44')](_0x47364b)['then'](handleEntityNotFound(_0x530502,null))[_0xe7e6('0x23')](respondWithResult(_0x530502,null))[_0xe7e6('0x40')](handleError(_0x530502,null));};exports['create']=function(_0x251174,_0x3319d5){return db['JscriptySessionReport'][_0xe7e6('0x45')](_0x251174['body'],{})['then'](respondWithResult(_0x3319d5,0xc9))[_0xe7e6('0x40')](handleError(_0x3319d5,null));};exports['update']=function(_0x5194c6,_0x8aeb5d){if(_0x5194c6[_0xe7e6('0x46')]['id']){delete _0x5194c6[_0xe7e6('0x46')]['id'];}return db[_0xe7e6('0x2a')][_0xe7e6('0x44')]({'where':{'id':_0x5194c6['params']['id']}})[_0xe7e6('0x23')](handleEntityNotFound(_0x8aeb5d,null))['then'](saveUpdates(_0x5194c6[_0xe7e6('0x46')],null))['then'](respondWithResult(_0x8aeb5d,null))[_0xe7e6('0x40')](handleError(_0x8aeb5d,null));};exports[_0xe7e6('0x47')]=function(_0x349c52,_0x4be6a0){return db[_0xe7e6('0x2a')][_0xe7e6('0x44')]({'where':{'id':_0x349c52[_0xe7e6('0x42')]['id']}})['then'](handleEntityNotFound(_0x4be6a0,null))['then'](removeEntity(_0x4be6a0,null))[_0xe7e6('0x40')](handleError(_0x4be6a0,null));};exports[_0xe7e6('0x48')]=function(_0x4a0d50,_0x31471a){return db[_0xe7e6('0x2a')][_0xe7e6('0x48')]()[_0xe7e6('0x23')](respondWithResult(_0x31471a,null))['catch'](handleError(_0x31471a,null));};exports[_0xe7e6('0x49')]=function(_0x479825,_0x1b7942,_0x277b20){var _0x1a708a={'raw':!![],'where':{}};var _0x538bf9={};var _0x4f259e={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xe7e6('0x4a')]({'where':{'id':_0x479825[_0xe7e6('0x42')]['id']}})[_0xe7e6('0x23')](handleEntityNotFound(_0x1b7942,null))[_0xe7e6('0x23')](function(_0x169671){if(_0x169671){_0x538bf9[_0xe7e6('0x2d')]=_[_0xe7e6('0x43')](db[_0xe7e6('0x4b')][_0xe7e6('0x2b')]);_0x538bf9['query']=_[_0xe7e6('0x43')](_0x479825['query']);_0x538bf9[_0xe7e6('0x2f')]=_[_0xe7e6('0x30')](_0x538bf9[_0xe7e6('0x2d')],_0x538bf9[_0xe7e6('0x2e')]);_0x1a708a[_0xe7e6('0x32')]=_[_0xe7e6('0x30')](_0x538bf9[_0xe7e6('0x2d')],qs[_0xe7e6('0x31')](_0x479825['query'][_0xe7e6('0x31')]));_0x1a708a[_0xe7e6('0x32')]=_0x1a708a[_0xe7e6('0x32')][_0xe7e6('0x33')]?_0x1a708a[_0xe7e6('0x32')]:_0x538bf9[_0xe7e6('0x2d')];if(!_0x479825[_0xe7e6('0x2e')]['hasOwnProperty'](_0xe7e6('0x35'))){_0x1a708a['limit']=qs['limit'](_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x1c')]);_0x1a708a[_0xe7e6('0x1b')]=qs[_0xe7e6('0x1b')](_0x479825[_0xe7e6('0x2e')]['offset']);}_0x1a708a[_0xe7e6('0x36')]=qs[_0xe7e6('0x37')](_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x37')]);_0x1a708a[_0xe7e6('0x38')]=qs['filters'](_[_0xe7e6('0x4c')](_0x479825[_0xe7e6('0x2e')],_0x538bf9['filters']));_0x1a708a[_0xe7e6('0x38')][_0xe7e6('0x4d')]=_0x169671['id'];if(_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x39')]){_0x1a708a[_0xe7e6('0x38')]=_['merge'](_0x1a708a[_0xe7e6('0x38')],{'$or':_[_0xe7e6('0x29')](_0x1a708a[_0xe7e6('0x32')],function(_0x43c8c0){var _0x4f5298={};_0x4f5298[_0x43c8c0]={'$like':'%'+_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x39')]+'%'};return _0x4f5298;})});}_0x1a708a=_[_0xe7e6('0x3a')]({},_0x1a708a,_0x479825[_0xe7e6('0x3c')]);return db[_0xe7e6('0x4b')][_0xe7e6('0x1e')]({'where':_0x1a708a[_0xe7e6('0x38')]})['then'](function(_0x5ac3e9){_0x4f259e[_0xe7e6('0x1e')]=_0x5ac3e9;if(_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x4e')]){_0x1a708a['include']=[{'all':!![]}];}return db[_0xe7e6('0x4b')]['findAll'](_0x1a708a);})['then'](function(_0x3b738b){_0x4f259e['rows']=_0x3b738b;return _0x4f259e;});}})[_0xe7e6('0x23')](respondWithFilteredResult(_0x1b7942,_0x1a708a))[_0xe7e6('0x40')](handleError(_0x1b7942,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 03b1963..7db8826 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 _0x687b=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x193685,_0x2802b5){var _0x159aaa=function(_0x3789cb){while(--_0x3789cb){_0x193685['push'](_0x193685['shift']());}};_0x159aaa(++_0x2802b5);}(_0x687b,0x14a));var _0xb687=function(_0x1c9863,_0xe952b2){_0x1c9863=_0x1c9863-0x0;var _0x104660=_0x687b[_0x1c9863];return _0x104660;};'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':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25fa=['path','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x28ddfc,_0x3ea2c8){var _0x51b0d2=function(_0x5ae9db){while(--_0x5ae9db){_0x28ddfc['push'](_0x28ddfc['shift']());}};_0x51b0d2(++_0x3ea2c8);}(_0x25fa,0x109));var _0xa25f=function(_0x2cb485,_0x5629a6){_0x2cb485=_0x2cb485-0x0;var _0x413c00=_0x25fa[_0x2cb485];return _0x413c00;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var moment=require('moment');var BPromise=require(_0xa25f('0x3'));var rp=require(_0xa25f('0x4'));var fs=require('fs');var path=require(_0xa25f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa25f('0x6'));module['exports']=function(_0x2ea9ea,_0x3ab530){return _0x2ea9ea[_0xa25f('0x7')](_0xa25f('0x8'),attributes,{'tableName':_0xa25f('0x9'),'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 9ec7ace..b1df9be 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 _0x0a6b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','randomstring'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x4d9c72,_0x44de9e){_0x4d9c72=_0x4d9c72-0x0;var _0x3be3b9=_0x0a6b[_0x4d9c72];return _0x3be3b9;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('JscriptySessionReport,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});} \ No newline at end of file +var _0x1883=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1352b3,_0x2e6cff){var _0x3b7bbe=function(_0x195c5d){while(--_0x195c5d){_0x1352b3['push'](_0x1352b3['shift']());}};_0x3b7bbe(++_0x2e6cff);}(_0x1883,0xab));var _0x3188=function(_0x4b4e03,_0xa6b616){_0x4b4e03=_0x4b4e03-0x0;var _0xd9f749=_0x1883[_0x4b4e03];return _0xd9f749;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 4db38cf..27d5942 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 _0xd3f2=['get','index','put','isAuthenticated','/download_log_file','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x486487,_0x5462a0){var _0x366014=function(_0x2e0158){while(--_0x2e0158){_0x486487['push'](_0x486487['shift']());}};_0x366014(++_0x5462a0);}(_0xd3f2,0x102));var _0x2d3f=function(_0x11a05f,_0x38a6af){_0x11a05f=_0x11a05f-0x0;var _0xdfea63=_0xd3f2[_0x11a05f];return _0xdfea63;};'use strict';var multer=require(_0x2d3f('0x0'));var util=require(_0x2d3f('0x1'));var path=require(_0x2d3f('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d3f('0x3'));var router=express['Router']();var fs_extra=require(_0x2d3f('0x4'));var auth=require(_0x2d3f('0x5'));var interaction=require(_0x2d3f('0x6'));var config=require(_0x2d3f('0x7'));var controller=require('./license.controller');router[_0x2d3f('0x8')]('/',controller[_0x2d3f('0x9')]);router[_0x2d3f('0xa')]('/:id',auth[_0x2d3f('0xb')](),controller['update']);router[_0x2d3f('0x8')](_0x2d3f('0xc'),auth[_0x2d3f('0xb')](),controller['downloadLogFile']);module[_0x2d3f('0xd')]=router; \ No newline at end of file +var _0x5f13=['../../config/environment','get','index','put','isAuthenticated','update','/download_log_file','downloadLogFile','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3de36b,_0x2d5f4a){var _0x22b951=function(_0x38143b){while(--_0x38143b){_0x3de36b['push'](_0x3de36b['shift']());}};_0x22b951(++_0x2d5f4a);}(_0x5f13,0xc8));var _0x35f1=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x5f13[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x35f1('0x0'));var util=require(_0x35f1('0x1'));var path=require('path');var timeout=require(_0x35f1('0x2'));var express=require(_0x35f1('0x3'));var router=express[_0x35f1('0x4')]();var fs_extra=require(_0x35f1('0x5'));var auth=require(_0x35f1('0x6'));var interaction=require(_0x35f1('0x7'));var config=require(_0x35f1('0x8'));var controller=require('./license.controller');router[_0x35f1('0x9')]('/',controller[_0x35f1('0xa')]);router[_0x35f1('0xb')]('/:id',auth[_0x35f1('0xc')](),controller[_0x35f1('0xd')]);router[_0x35f1('0x9')](_0x35f1('0xe'),auth[_0x35f1('0xc')](),controller[_0x35f1('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index e284aa8..6c971b0 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 _0x3d66=['INTEGER','sequelize','STRING'];(function(_0xec9b1,_0x5c8c6c){var _0x5eda85=function(_0x297ce8){while(--_0x297ce8){_0xec9b1['push'](_0xec9b1['shift']());}};_0x5eda85(++_0x5c8c6c);}(_0x3d66,0x6a));var _0x63d6=function(_0xa45c87,_0x783585){_0xa45c87=_0xa45c87-0x0;var _0x28579f=_0x3d66[_0xa45c87];return _0x28579f;};'use strict';var Sequelize=require(_0x63d6('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x63d6('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x63d6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7867=['exports','TEXT','INTEGER','sequelize'];(function(_0x493057,_0x44d38b){var _0x3c8f43=function(_0x54d91a){while(--_0x54d91a){_0x493057['push'](_0x493057['shift']());}};_0x3c8f43(++_0x44d38b);}(_0x7867,0x1af));var _0x7786=function(_0x327583,_0x13cdee){_0x327583=_0x327583-0x0;var _0xd12a24=_0x7867[_0x327583];return _0xd12a24;};'use strict';var Sequelize=require(_0x7786('0x0'));module[_0x7786('0x1')]={'license':{'type':Sequelize[_0x7786('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x7786('0x3')],'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 e374207..ce90e94 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 _0x3923=['reject','destroy','error','stack','name','send','index','model','License','rawAttributes','keys','query','filters','attributes','intersection','fields','length','merge','options','getLicense','catch','body','find','params','then','get','demo','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply'];(function(_0x757c14,_0x23b0f4){var _0x57596a=function(_0x1b9507){while(--_0x1b9507){_0x757c14['push'](_0x757c14['shift']());}};_0x57596a(++_0x23b0f4);}(_0x3923,0x107));var _0x3392=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3923[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x3392('0x0'));var rimraf=require(_0x3392('0x1'));var zipdir=require(_0x3392('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3392('0x3'));var moment=require('moment');var BPromise=require(_0x3392('0x4'));var Mustache=require(_0x3392('0x5'));var util=require(_0x3392('0x6'));var path=require(_0x3392('0x7'));var sox=require(_0x3392('0x8'));var csv=require(_0x3392('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3392('0xa'));var squel=require(_0x3392('0xb'));var crypto=require(_0x3392('0xc'));var jsforce=require(_0x3392('0xd'));var deskjs=require(_0x3392('0xe'));var toCsv=require(_0x3392('0x9'));var querystring=require(_0x3392('0xf'));var Papa=require(_0x3392('0x10'));var Redis=require(_0x3392('0x11'));var authService=require(_0x3392('0x12'));var qs=require(_0x3392('0x13'));var as=require(_0x3392('0x14'));var hardwareService=require(_0x3392('0x15'));var logger=require(_0x3392('0x16'))(_0x3392('0x17'));var utils=require(_0x3392('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3392('0x19'));var db=require(_0x3392('0x1a'))['db'];function respondWithStatusCode(_0x2ea4b4,_0x3d95d7){_0x3d95d7=_0x3d95d7||0xcc;return function(_0x5d4664){if(_0x5d4664){return _0x2ea4b4[_0x3392('0x1b')](_0x3d95d7);}return _0x2ea4b4['status'](_0x3d95d7)[_0x3392('0x1c')]();};}function respondWithResult(_0x25c2c7,_0x7177bb){_0x7177bb=_0x7177bb||0xc8;return function(_0x5a61c0){if(_0x5a61c0){return _0x25c2c7[_0x3392('0x1d')](_0x7177bb)[_0x3392('0x1e')](_0x5a61c0);}};}function respondWithFilteredResult(_0x32aa77,_0x2a81ff){return function(_0x331aed){if(_0x331aed){var _0x55895a=typeof _0x2a81ff[_0x3392('0x1f')]==='undefined'&&typeof _0x2a81ff[_0x3392('0x20')]===_0x3392('0x21');var _0x1beeaa=_0x331aed[_0x3392('0x22')];var _0x2a358f=_0x55895a?0x0:_0x2a81ff[_0x3392('0x1f')];var _0x13bcb3=_0x55895a?_0x331aed[_0x3392('0x22')]:_0x2a81ff['offset']+_0x2a81ff[_0x3392('0x20')];var _0x50183b;if(_0x13bcb3>=_0x1beeaa){_0x13bcb3=_0x1beeaa;_0x50183b=0xc8;}else{_0x50183b=0xce;}_0x32aa77[_0x3392('0x1d')](_0x50183b);return _0x32aa77['set'](_0x3392('0x23'),_0x2a358f+'-'+_0x13bcb3+'/'+_0x1beeaa)[_0x3392('0x1e')](_0x331aed);}return null;};}function patchUpdates(_0x5cab65){return function(_0x42e13a){try{jsonpatch[_0x3392('0x24')](_0x42e13a,_0x5cab65,!![]);}catch(_0x25a97c){return BPromise[_0x3392('0x25')](_0x25a97c);}return _0x42e13a['save']();};}function saveUpdates(_0x2e6237,_0x4fb939){return function(_0x2be69c){if(_0x2be69c){return _0x2be69c['update'](_0x2e6237)['then'](function(_0x465045){return _0x465045;});}return null;};}function removeEntity(_0x6e920,_0x1aed68){return function(_0x3435b8){if(_0x3435b8){return _0x3435b8[_0x3392('0x26')]()['then'](function(){_0x6e920['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e0ac9,_0xe0eaa8){return function(_0x387137){if(!_0x387137){_0x1e0ac9[_0x3392('0x1b')](0x194);}return _0x387137;};}function handleError(_0x385b03,_0x3a3160){_0x3a3160=_0x3a3160||0x1f4;return function(_0x3eda49){logger[_0x3392('0x27')](_0x3eda49[_0x3392('0x28')]);if(_0x3eda49['name']){delete _0x3eda49[_0x3392('0x29')];}_0x385b03[_0x3392('0x1d')](_0x3a3160)[_0x3392('0x2a')](_0x3eda49);};}var utilLicense=require('../../config/license/util');exports[_0x3392('0x2b')]=function(_0x23aedb,_0x205d20){var _0x12a234={'raw':!![],'where':{'id':0x1}},_0x2a2bd8={};_0x2a2bd8[_0x3392('0x2c')]=_['keys'](db[_0x3392('0x2d')][_0x3392('0x2e')]);_0x2a2bd8['query']=_[_0x3392('0x2f')](_0x23aedb[_0x3392('0x30')]);_0x2a2bd8[_0x3392('0x31')]=_['intersection'](_0x2a2bd8[_0x3392('0x2c')],_0x2a2bd8[_0x3392('0x30')]);_0x12a234[_0x3392('0x32')]=_[_0x3392('0x33')](_0x2a2bd8['model'],qs[_0x3392('0x34')](_0x23aedb[_0x3392('0x30')][_0x3392('0x34')]));_0x12a234[_0x3392('0x32')]=_0x12a234['attributes'][_0x3392('0x35')]?_0x12a234[_0x3392('0x32')]:_0x2a2bd8[_0x3392('0x2c')];_0x12a234=_[_0x3392('0x36')]({},_0x12a234,_0x23aedb[_0x3392('0x37')]);return utilLicense[_0x3392('0x38')](_0x12a234)['then'](respondWithResult(_0x205d20,null))[_0x3392('0x39')](handleError(_0x205d20,null));};exports['update']=function(_0x275b81,_0x3576e0){if(_0x275b81[_0x3392('0x3a')]['id']){delete _0x275b81[_0x3392('0x3a')]['id'];}return db['License'][_0x3392('0x3b')]({'where':{'id':_0x275b81[_0x3392('0x3c')]['id']}})[_0x3392('0x3d')](handleEntityNotFound(_0x3576e0,null))[_0x3392('0x3d')](function(_0x29745d){var _0x1e2c29=_0x29745d[_0x3392('0x3e')]({'plain':!![]});return utilLicense['checkLicense'](_0x1e2c29,_0x275b81[_0x3392('0x3a')]['key']);})[_0x3392('0x3d')](function(_0x1926eb){if(!_0x1926eb[_0x3392('0x3f')]){return saveUpdates(_0x275b81[_0x3392('0x3a')],null);}return _0x1926eb;})[_0x3392('0x3d')](respondWithResult(_0x3576e0,null))[_0x3392('0x39')](handleError(_0x3576e0,null));};exports[_0x3392('0x40')]=function(_0x553d9d,_0x1f5e6d){var _0x46cdfb=_0x3392('0x41');var _0x5605ca=path[_0x3392('0x42')](_0x3392('0x43'),_0x3392('0x44'),_0x3392('0x45'),_0x46cdfb);_0x1f5e6d['setHeader'](_0x3392('0x46'),_0x3392('0x47')+_0x46cdfb);_0x1f5e6d[_0x3392('0x48')](_0x3392('0x49'),'text/plain');_0x1f5e6d[_0x3392('0x4a')](_0x5605ca);}; \ No newline at end of file +var _0xa547=['path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','sendStatus','error','name','send','index','model','keys','License','query','filters','intersection','fields','attributes','length','merge','options','getLicense','body','find','get','checkLicense','key','catch','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa547,0x152));var _0x7a54=function(_0x4723c9,_0x45640e){_0x4723c9=_0x4723c9-0x0;var _0x470544=_0xa547[_0x4723c9];return _0x470544;};'use strict';var emlformat=require(_0x7a54('0x0'));var rimraf=require(_0x7a54('0x1'));var zipdir=require(_0x7a54('0x2'));var jsonpatch=require(_0x7a54('0x3'));var rp=require('request-promise');var moment=require(_0x7a54('0x4'));var BPromise=require(_0x7a54('0x5'));var Mustache=require(_0x7a54('0x6'));var util=require('util');var path=require(_0x7a54('0x7'));var sox=require(_0x7a54('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a54('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7a54('0xa'));var jsforce=require(_0x7a54('0xb'));var deskjs=require(_0x7a54('0xc'));var toCsv=require(_0x7a54('0xd'));var querystring=require(_0x7a54('0xe'));var Papa=require(_0x7a54('0xf'));var Redis=require(_0x7a54('0x10'));var authService=require(_0x7a54('0x11'));var qs=require(_0x7a54('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a54('0x13'));var logger=require(_0x7a54('0x14'))(_0x7a54('0x15'));var utils=require(_0x7a54('0x16'));var config=require(_0x7a54('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a54('0x18'))['db'];function respondWithStatusCode(_0x36ba5b,_0x53bccd){_0x53bccd=_0x53bccd||0xcc;return function(_0x3a4d2b){if(_0x3a4d2b){return _0x36ba5b['sendStatus'](_0x53bccd);}return _0x36ba5b['status'](_0x53bccd)[_0x7a54('0x19')]();};}function respondWithResult(_0x1264be,_0x502b66){_0x502b66=_0x502b66||0xc8;return function(_0x256886){if(_0x256886){return _0x1264be[_0x7a54('0x1a')](_0x502b66)[_0x7a54('0x1b')](_0x256886);}};}function respondWithFilteredResult(_0x28e173,_0x59cd73){return function(_0x433ee3){if(_0x433ee3){var _0x350b22=typeof _0x59cd73['offset']===_0x7a54('0x1c')&&typeof _0x59cd73[_0x7a54('0x1d')]===_0x7a54('0x1c');var _0x197608=_0x433ee3[_0x7a54('0x1e')];var _0x24c064=_0x350b22?0x0:_0x59cd73[_0x7a54('0x1f')];var _0x590916=_0x350b22?_0x433ee3[_0x7a54('0x1e')]:_0x59cd73[_0x7a54('0x1f')]+_0x59cd73['limit'];var _0x5ec558;if(_0x590916>=_0x197608){_0x590916=_0x197608;_0x5ec558=0xc8;}else{_0x5ec558=0xce;}_0x28e173['status'](_0x5ec558);return _0x28e173[_0x7a54('0x20')](_0x7a54('0x21'),_0x24c064+'-'+_0x590916+'/'+_0x197608)[_0x7a54('0x1b')](_0x433ee3);}return null;};}function patchUpdates(_0x37f21f){return function(_0x14de39){try{jsonpatch[_0x7a54('0x22')](_0x14de39,_0x37f21f,!![]);}catch(_0x1eba9c){return BPromise['reject'](_0x1eba9c);}return _0x14de39['save']();};}function saveUpdates(_0x3f1c32,_0x3a2f77){return function(_0x41284c){if(_0x41284c){return _0x41284c[_0x7a54('0x23')](_0x3f1c32)[_0x7a54('0x24')](function(_0x316b85){return _0x316b85;});}return null;};}function removeEntity(_0x561a2f,_0x50c490){return function(_0x1d8987){if(_0x1d8987){return _0x1d8987['destroy']()[_0x7a54('0x24')](function(){_0x561a2f[_0x7a54('0x1a')](0xcc)[_0x7a54('0x19')]();});}};}function handleEntityNotFound(_0x2ab1f5,_0x451cd5){return function(_0x10f6be){if(!_0x10f6be){_0x2ab1f5[_0x7a54('0x25')](0x194);}return _0x10f6be;};}function handleError(_0x32e7c3,_0x327608){_0x327608=_0x327608||0x1f4;return function(_0x13a139){logger[_0x7a54('0x26')](_0x13a139['stack']);if(_0x13a139[_0x7a54('0x27')]){delete _0x13a139[_0x7a54('0x27')];}_0x32e7c3[_0x7a54('0x1a')](_0x327608)[_0x7a54('0x28')](_0x13a139);};}var utilLicense=require('../../config/license/util');exports[_0x7a54('0x29')]=function(_0x14fa55,_0x2bd114){var _0x267279={'raw':!![],'where':{'id':0x1}},_0x542efd={};_0x542efd[_0x7a54('0x2a')]=_[_0x7a54('0x2b')](db[_0x7a54('0x2c')]['rawAttributes']);_0x542efd['query']=_[_0x7a54('0x2b')](_0x14fa55[_0x7a54('0x2d')]);_0x542efd[_0x7a54('0x2e')]=_[_0x7a54('0x2f')](_0x542efd['model'],_0x542efd[_0x7a54('0x2d')]);_0x267279['attributes']=_['intersection'](_0x542efd[_0x7a54('0x2a')],qs[_0x7a54('0x30')](_0x14fa55['query'][_0x7a54('0x30')]));_0x267279[_0x7a54('0x31')]=_0x267279[_0x7a54('0x31')][_0x7a54('0x32')]?_0x267279[_0x7a54('0x31')]:_0x542efd[_0x7a54('0x2a')];_0x267279=_[_0x7a54('0x33')]({},_0x267279,_0x14fa55[_0x7a54('0x34')]);return utilLicense[_0x7a54('0x35')](_0x267279)[_0x7a54('0x24')](respondWithResult(_0x2bd114,null))['catch'](handleError(_0x2bd114,null));};exports[_0x7a54('0x23')]=function(_0xb65a99,_0x30137d){if(_0xb65a99[_0x7a54('0x36')]['id']){delete _0xb65a99[_0x7a54('0x36')]['id'];}return db[_0x7a54('0x2c')][_0x7a54('0x37')]({'where':{'id':_0xb65a99['params']['id']}})[_0x7a54('0x24')](handleEntityNotFound(_0x30137d,null))[_0x7a54('0x24')](function(_0x49972f){var _0x2250ab=_0x49972f[_0x7a54('0x38')]({'plain':!![]});return utilLicense[_0x7a54('0x39')](_0x2250ab,_0xb65a99[_0x7a54('0x36')][_0x7a54('0x3a')]);})['then'](function(_0x1b5c89){if(!_0x1b5c89['demo']){return saveUpdates(_0xb65a99[_0x7a54('0x36')],null);}return _0x1b5c89;})[_0x7a54('0x24')](respondWithResult(_0x30137d,null))[_0x7a54('0x3b')](handleError(_0x30137d,null));};exports[_0x7a54('0x3c')]=function(_0x841e21,_0x1be4de){var _0x2cd190='license-info.log';var _0x379183=path[_0x7a54('0x3d')](_0x7a54('0x3e'),_0x7a54('0x3f'),_0x7a54('0x40'),_0x2cd190);_0x1be4de[_0x7a54('0x41')](_0x7a54('0x42'),_0x7a54('0x43')+_0x2cd190);_0x1be4de['set']('Content-Type',_0x7a54('0x44'));_0x1be4de['download'](_0x379183);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 19a3149..546428b 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 _0xe14a=['rimraf','exports','define','License','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x344179,_0xb1c8a7){var _0x38fb32=function(_0x601710){while(--_0x601710){_0x344179['push'](_0x344179['shift']());}};_0x38fb32(++_0xb1c8a7);}(_0xe14a,0x1c7));var _0xae14=function(_0x13563d,_0x40cfd1){_0x13563d=_0x13563d-0x0;var _0x2ced93=_0xe14a[_0x13563d];return _0x2ced93;};'use strict';var _=require(_0xae14('0x0'));var util=require(_0xae14('0x1'));var logger=require(_0xae14('0x2'))(_0xae14('0x3'));var moment=require(_0xae14('0x4'));var BPromise=require(_0xae14('0x5'));var rp=require(_0xae14('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae14('0x7'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0xae14('0x8')]=function(_0x482a47,_0x47571f){return _0x482a47[_0xae14('0x9')](_0xae14('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9656=['bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','License','util','../../config/logger','api','moment'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0x9656,0x125));var _0x6965=function(_0x46c62c,_0x47602b){_0x46c62c=_0x46c62c-0x0;var _0x550977=_0x9656[_0x46c62c];return _0x550977;};'use strict';var _=require('lodash');var util=require(_0x6965('0x0'));var logger=require(_0x6965('0x1'))(_0x6965('0x2'));var moment=require(_0x6965('0x3'));var BPromise=require(_0x6965('0x4'));var rp=require(_0x6965('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6965('0x6'));var config=require(_0x6965('0x7'));var attributes=require(_0x6965('0x8'));module[_0x6965('0x9')]=function(_0x112642,_0x8d315a){return _0x112642['define'](_0x6965('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index d15ef99..5608525 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 _0x6919=['License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then'];(function(_0x309eb5,_0x36c7cf){var _0x1fa11e=function(_0x3e1106){while(--_0x3e1106){_0x309eb5['push'](_0x309eb5['shift']());}};_0x1fa11e(++_0x36c7cf);}(_0x6919,0x199));var _0x9691=function(_0x19688b,_0x5cae76){_0x19688b=_0x19688b-0x0;var _0x196944=_0x6919[_0x19688b];return _0x196944;};'use strict';var _=require('lodash');var util=require(_0x9691('0x0'));var moment=require(_0x9691('0x1'));var BPromise=require(_0x9691('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9691('0x3'));var db=require(_0x9691('0x4'))['db'];var utils=require(_0x9691('0x5'));var logger=require(_0x9691('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9691('0x7'));var client=jayson[_0x9691('0x8')][_0x9691('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e724c,_0x45848b,_0xecbf17){return new BPromise(function(_0x1f568d,_0x220712){return client['request'](_0x5e724c,_0xecbf17)[_0x9691('0xa')](function(_0x3dbc16){logger['info'](_0x9691('0xb'),_0x45848b,_0x9691('0xc'));logger[_0x9691('0xd')](_0x9691('0xe'),_0x45848b,_0x9691('0xc'),JSON[_0x9691('0xf')](_0x3dbc16));if(_0x3dbc16['error']){if(_0x3dbc16[_0x9691('0x10')][_0x9691('0x11')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x45848b,_0x3dbc16[_0x9691('0x10')][_0x9691('0x12')]);return _0x220712(_0x3dbc16['error'][_0x9691('0x12')]);}logger['error']('License,\x20%s,\x20%s',_0x45848b,_0x3dbc16[_0x9691('0x10')][_0x9691('0x12')]);return _0x1f568d(_0x3dbc16[_0x9691('0x10')][_0x9691('0x12')]);}else{logger['info']('License,\x20%s,\x20%s',_0x45848b,_0x9691('0xc'));_0x1f568d(_0x3dbc16[_0x9691('0x13')][_0x9691('0x12')]);}})[_0x9691('0x14')](function(_0x1e83b6){logger[_0x9691('0x10')](_0x9691('0xb'),_0x45848b,_0x1e83b6);_0x220712(_0x1e83b6);});});} \ No newline at end of file +var _0x3e91=['stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s'];(function(_0x19ce38,_0x5c9cb8){var _0x27e1b6=function(_0xc0dfa){while(--_0xc0dfa){_0x19ce38['push'](_0x19ce38['shift']());}};_0x27e1b6(++_0x5c9cb8);}(_0x3e91,0xc7));var _0x13e9=function(_0x31210e,_0x1785ff){_0x31210e=_0x31210e-0x0;var _0x2167db=_0x3e91[_0x31210e];return _0x2167db;};'use strict';var _=require(_0x13e9('0x0'));var util=require(_0x13e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x13e9('0x2'));var fs=require('fs');var Redis=require(_0x13e9('0x3'));var db=require(_0x13e9('0x4'))['db'];var utils=require(_0x13e9('0x5'));var logger=require(_0x13e9('0x6'))(_0x13e9('0x7'));var config=require(_0x13e9('0x8'));var jayson=require(_0x13e9('0x9'));var client=jayson[_0x13e9('0xa')][_0x13e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x986cf7,_0x4a8222,_0x36bab7){return new BPromise(function(_0x1eadd6,_0x18e9c9){return client[_0x13e9('0xc')](_0x986cf7,_0x36bab7)[_0x13e9('0xd')](function(_0x511abe){logger['info'](_0x13e9('0xe'),_0x4a8222,_0x13e9('0xf'));logger['debug'](_0x13e9('0x10'),_0x4a8222,_0x13e9('0xf'),JSON[_0x13e9('0x11')](_0x511abe));if(_0x511abe[_0x13e9('0x12')]){if(_0x511abe[_0x13e9('0x12')][_0x13e9('0x13')]===0x1f4){logger[_0x13e9('0x12')](_0x13e9('0xe'),_0x4a8222,_0x511abe[_0x13e9('0x12')]['message']);return _0x18e9c9(_0x511abe['error']['message']);}logger[_0x13e9('0x12')](_0x13e9('0xe'),_0x4a8222,_0x511abe[_0x13e9('0x12')][_0x13e9('0x14')]);return _0x1eadd6(_0x511abe[_0x13e9('0x12')][_0x13e9('0x14')]);}else{logger[_0x13e9('0x15')]('License,\x20%s,\x20%s',_0x4a8222,'request\x20sent');_0x1eadd6(_0x511abe[_0x13e9('0x16')][_0x13e9('0x14')]);}})[_0x13e9('0x17')](function(_0x445149){logger[_0x13e9('0x12')](_0x13e9('0xe'),_0x4a8222,_0x445149);_0x18e9c9(_0x445149);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 3327213..d843ac1 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 _0xb30f=['get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addSmtp','addInteraction','/:id/applications','send','put','/:id','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller'];(function(_0x2b33c4,_0xc0d12){var _0x4c8039=function(_0x4d9da5){while(--_0x4d9da5){_0x2b33c4['push'](_0x2b33c4['shift']());}};_0x4c8039(++_0xc0d12);}(_0xb30f,0x7f));var _0xfb30=function(_0xea87b0,_0x3a26a9){_0xea87b0=_0xea87b0-0x0;var _0x52bced=_0xb30f[_0xea87b0];return _0x52bced;};'use strict';var multer=require(_0xfb30('0x0'));var util=require(_0xfb30('0x1'));var path=require(_0xfb30('0x2'));var timeout=require(_0xfb30('0x3'));var express=require(_0xfb30('0x4'));var router=express[_0xfb30('0x5')]();var fs_extra=require(_0xfb30('0x6'));var auth=require(_0xfb30('0x7'));var interaction=require(_0xfb30('0x8'));var config=require(_0xfb30('0x9'));var controller=require(_0xfb30('0xa'));router[_0xfb30('0xb')]('/',auth[_0xfb30('0xc')](),controller[_0xfb30('0xd')]);router['get'](_0xfb30('0xe'),auth['isAuthenticated'](),controller[_0xfb30('0xf')]);router[_0xfb30('0xb')]('/:id',auth[_0xfb30('0xc')](),controller[_0xfb30('0x10')]);router[_0xfb30('0xb')](_0xfb30('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xfb30('0xb')](_0xfb30('0x12'),auth[_0xfb30('0xc')](),controller['getAnswers']);router['get'](_0xfb30('0x13'),auth[_0xfb30('0xc')](),controller['getImap']);router['get'](_0xfb30('0x14'),auth[_0xfb30('0xc')](),controller[_0xfb30('0x15')]);router[_0xfb30('0xb')](_0xfb30('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xfb30('0xb')]('/:id/applications',auth[_0xfb30('0xc')](),controller[_0xfb30('0x17')]);router[_0xfb30('0xb')](_0xfb30('0x18'),auth['isAuthenticated'](),controller[_0xfb30('0x19')]);router[_0xfb30('0xb')](_0xfb30('0x1a'),auth[_0xfb30('0xc')](),controller[_0xfb30('0x1b')]);router[_0xfb30('0xb')](_0xfb30('0x1c'),auth['isAuthenticated'](),controller[_0xfb30('0x1d')]);router[_0xfb30('0x1e')]('/:id/dispositions',auth[_0xfb30('0xc')](),controller[_0xfb30('0x1f')]);router[_0xfb30('0x1e')]('/:id/canned_answers',auth[_0xfb30('0xc')](),controller[_0xfb30('0x20')]);router[_0xfb30('0x1e')]('/',auth['isAuthenticated'](),controller[_0xfb30('0x21')]);router[_0xfb30('0x1e')]('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router['post'](_0xfb30('0x14'),auth[_0xfb30('0xc')](),controller[_0xfb30('0x22')]);router['post'](_0xfb30('0x16'),auth['isAuthenticated'](),controller[_0xfb30('0x23')]);router['post'](_0xfb30('0x24'),auth['isAuthenticated'](),controller['addApplications']);router[_0xfb30('0x1e')]('/:id/send',auth['isAuthenticated'](),controller[_0xfb30('0x25')]);router['post']('/:id/users',auth[_0xfb30('0xc')](),controller['addAgents']);router[_0xfb30('0x26')](_0xfb30('0x27'),auth[_0xfb30('0xc')](),controller[_0xfb30('0x28')]);router[_0xfb30('0x29')](_0xfb30('0x11'),auth[_0xfb30('0xc')](),controller[_0xfb30('0x2a')]);router[_0xfb30('0x29')](_0xfb30('0x12'),auth['isAuthenticated'](),controller[_0xfb30('0x2b')]);router['delete'](_0xfb30('0x13'),auth[_0xfb30('0xc')](),controller['removeImap']);router['delete'](_0xfb30('0x14'),auth['isAuthenticated'](),controller[_0xfb30('0x2c')]);router[_0xfb30('0x29')](_0xfb30('0x27'),auth[_0xfb30('0xc')](),controller[_0xfb30('0x2d')]);router[_0xfb30('0x29')](_0xfb30('0x1c'),auth[_0xfb30('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xdef4=['getMessages','/:id/verify','verifySmtp','getAgents','/:id/canned_answers','addAnswer','post','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','put','update','removeDispositions','delete','removeSmtp','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications'];(function(_0x36c14e,_0x262ade){var _0xb27b23=function(_0xe7ef0b){while(--_0xe7ef0b){_0x36c14e['push'](_0x36c14e['shift']());}};_0xb27b23(++_0x262ade);}(_0xdef4,0x1c7));var _0x4def=function(_0x37dc21,_0x2bae86){_0x37dc21=_0x37dc21-0x0;var _0x34dc9e=_0xdef4[_0x37dc21];return _0x34dc9e;};'use strict';var multer=require(_0x4def('0x0'));var util=require('util');var path=require(_0x4def('0x1'));var timeout=require(_0x4def('0x2'));var express=require('express');var router=express[_0x4def('0x3')]();var fs_extra=require(_0x4def('0x4'));var auth=require(_0x4def('0x5'));var interaction=require(_0x4def('0x6'));var config=require(_0x4def('0x7'));var controller=require(_0x4def('0x8'));router[_0x4def('0x9')]('/',auth[_0x4def('0xa')](),controller[_0x4def('0xb')]);router[_0x4def('0x9')](_0x4def('0xc'),auth[_0x4def('0xa')](),controller[_0x4def('0xd')]);router[_0x4def('0x9')](_0x4def('0xe'),auth[_0x4def('0xa')](),controller[_0x4def('0xf')]);router[_0x4def('0x9')](_0x4def('0x10'),auth[_0x4def('0xa')](),controller[_0x4def('0x11')]);router[_0x4def('0x9')]('/:id/canned_answers',auth[_0x4def('0xa')](),controller[_0x4def('0x12')]);router['get']('/:id/in_servers',auth[_0x4def('0xa')](),controller[_0x4def('0x13')]);router[_0x4def('0x9')](_0x4def('0x14'),auth['isAuthenticated'](),controller[_0x4def('0x15')]);router[_0x4def('0x9')](_0x4def('0x16'),auth['isAuthenticated'](),controller[_0x4def('0x17')]);router[_0x4def('0x9')](_0x4def('0x18'),auth['isAuthenticated'](),controller['getApplications']);router['get']('/:id/messages',auth[_0x4def('0xa')](),controller[_0x4def('0x19')]);router[_0x4def('0x9')](_0x4def('0x1a'),auth[_0x4def('0xa')](),controller[_0x4def('0x1b')]);router[_0x4def('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x4def('0x1c')]);router['post'](_0x4def('0x10'),auth[_0x4def('0xa')](),controller['addDisposition']);router['post'](_0x4def('0x1d'),auth[_0x4def('0xa')](),controller[_0x4def('0x1e')]);router[_0x4def('0x1f')]('/',auth[_0x4def('0xa')](),controller[_0x4def('0x20')]);router['post'](_0x4def('0x21'),auth[_0x4def('0xa')](),controller[_0x4def('0x22')]);router['post'](_0x4def('0x14'),auth[_0x4def('0xa')](),controller[_0x4def('0x23')]);router[_0x4def('0x1f')](_0x4def('0x16'),auth[_0x4def('0xa')](),controller[_0x4def('0x24')]);router[_0x4def('0x1f')](_0x4def('0x18'),auth[_0x4def('0xa')](),controller[_0x4def('0x25')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x4def('0x26')]);router[_0x4def('0x1f')](_0x4def('0x27'),auth[_0x4def('0xa')](),controller[_0x4def('0x28')]);router[_0x4def('0x29')](_0x4def('0xe'),auth[_0x4def('0xa')](),controller[_0x4def('0x2a')]);router['delete'](_0x4def('0x10'),auth[_0x4def('0xa')](),controller[_0x4def('0x2b')]);router['delete'](_0x4def('0x1d'),auth[_0x4def('0xa')](),controller['removeAnswers']);router[_0x4def('0x2c')](_0x4def('0x21'),auth[_0x4def('0xa')](),controller['removeImap']);router['delete'](_0x4def('0x14'),auth[_0x4def('0xa')](),controller[_0x4def('0x2d')]);router[_0x4def('0x2c')](_0x4def('0xe'),auth[_0x4def('0xa')](),controller['destroy']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x4def('0x2e')]);module[_0x4def('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index e66300c..905b08c 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 _0x76d8=['BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','TEXT'];(function(_0x44e69e,_0x256b3d){var _0x59db3b=function(_0x3ccaef){while(--_0x3ccaef){_0x44e69e['push'](_0x44e69e['shift']());}};_0x59db3b(++_0x256b3d);}(_0x76d8,0xe6));var _0x876d=function(_0x21fc81,_0x19c0af){_0x21fc81=_0x21fc81-0x0;var _0x57f889=_0x76d8[_0x21fc81];return _0x57f889;};'use strict';var Sequelize=require(_0x876d('0x0'));module[_0x876d('0x1')]={'description':{'type':Sequelize[_0x876d('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x876d('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x876d('0x3')]},'markAsUnread':{'type':Sequelize[_0x876d('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x876d('0x5')},'fontSize':{'type':Sequelize[_0x876d('0x6')](0x2)[_0x876d('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x876d('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x876d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x876d('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x876d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x876d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x876d('0x4')],'defaultValue':![],'comment':_0x876d('0x9'),'set':function(_0x8a685f){if(!_0x8a685f)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x876d('0xa')](_0x876d('0xb'),_0x8a685f);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x876d('0xc'),_0x876d('0xd'),_0x876d('0xe')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return'custom';return this[_0x876d('0xf')](_0x876d('0x10'));},'set':function(_0x1b7f61){if(_0x1b7f61===_0x876d('0x11'))_0x1b7f61=null;return this['setDataValue'](_0x876d('0x10'),_0x1b7f61);}}}; \ No newline at end of file +var _0xd24b=['getDataValue','setDataValue','exports','STRING','TEXT','BOOLEAN','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','ENUM','gmail','provider','custom'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd24b,0x102));var _0xbd24=function(_0x349b6b,_0x595aa7){_0x349b6b=_0x349b6b-0x0;var _0x4b7e57=_0xd24b[_0x349b6b];return _0x4b7e57;};'use strict';var Sequelize=require('sequelize');module[_0xbd24('0x0')]={'description':{'type':Sequelize[_0xbd24('0x1')]},'name':{'type':Sequelize[_0xbd24('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xbd24('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xbd24('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xbd24('0x2')]},'markAsUnread':{'type':Sequelize[_0xbd24('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xbd24('0x4')](0x2)[_0xbd24('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xbd24('0x2')],'defaultValue':function(){return _0xbd24('0x6');}},'notificationSound':{'type':Sequelize[_0xbd24('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbd24('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd24('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbd24('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xbd24('0x3')],'defaultValue':![],'comment':_0xbd24('0x8'),'set':function(_0x2aadc6){if(!_0x2aadc6)this['setDataValue'](_0xbd24('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x2aadc6);}},'provider':{'type':Sequelize[_0xbd24('0xa')](_0xbd24('0xb'),'hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xbd24('0xc')))return _0xbd24('0xd');return this[_0xbd24('0xe')](_0xbd24('0xc'));},'set':function(_0x4cd705){if(_0x4cd705===_0xbd24('0xd'))_0x4cd705=null;return this[_0xbd24('0xf')]('provider',_0x4cd705);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index bded7f6..34c2f36 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 _0x7b31=['json','offset','undefined','count','limit','Content-Range','update','get','MailAccounts','destroy','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','Unknown\x20email\x20service\x20provider','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','user','Imap','Smtp','index','MailServerIn','mandatoryDispositionPause','map','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','MailAccount','includeAll','include','findAll','rows','show','params','MailServerOut','rawAttributes','find','body','provider','custom','Pause','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','getDispositions','options','ids','addAnswer','CannedAnswer','findOne','removeAnswers','create','email','ListId','isNil','active','description','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','transaction','sequelize','Transaction','MailApplication','findAndCountAll','stack','finally','getApplications','nolimit','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','CloudProvider','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','getAgents','User','bluebird','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','MailAccount,\x20%s,\x20%s','catch','sendStatus','status','end'];(function(_0x485905,_0x32c6e2){var _0x4479fc=function(_0x545c06){while(--_0x545c06){_0x485905['push'](_0x485905['shift']());}};_0x4479fc(++_0x32c6e2);}(_0x7b31,0x161));var _0x17b3=function(_0x18b5bb,_0x268fb9){_0x18b5bb=_0x18b5bb-0x0;var _0x5aef1e=_0x7b31[_0x18b5bb];return _0x5aef1e;};'use strict';var moment=require('moment');var BPromise=require(_0x17b3('0x0'));var util=require(_0x17b3('0x1'));var path=require(_0x17b3('0x2'));var _=require('lodash');var juice=require(_0x17b3('0x3'));var Redis=require(_0x17b3('0x4'));var qs=require(_0x17b3('0x5'));var logger=require(_0x17b3('0x6'))(_0x17b3('0x7'));var config=require(_0x17b3('0x8'));var db=require(_0x17b3('0x9'))['db'];config['redis']=_[_0x17b3('0xa')](config[_0x17b3('0xb')],{'host':_0x17b3('0xc'),'port':0x18eb});var socket=require(_0x17b3('0xd'))(new Redis(config[_0x17b3('0xb')]));require(_0x17b3('0xe'))['register'](socket);var jayson=require(_0x17b3('0xf'));var client=jayson[_0x17b3('0x10')][_0x17b3('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x11eff1,_0x4ad94a,_0x3ff5ee,_0x22676e){return new BPromise(function(_0x58b42a,_0x9bf611){var _0x32c5b4=_0x22676e||client;return _0x32c5b4['request'](_0x11eff1,_0x3ff5ee)[_0x17b3('0x12')](function(_0x3a89c9){logger[_0x17b3('0x13')]('MailAccount,\x20%s,\x20%s',_0x4ad94a,_0x17b3('0x14'));logger[_0x17b3('0x15')](_0x17b3('0x16'),_0x4ad94a,_0x17b3('0x14'),JSON['stringify'](_0x3a89c9));if(_0x3a89c9[_0x17b3('0x17')]){if(_0x3a89c9['error'][_0x17b3('0x18')]===0x1f4){logger[_0x17b3('0x17')]('MailAccount,\x20%s,\x20%s',_0x4ad94a,_0x3a89c9[_0x17b3('0x17')][_0x17b3('0x19')]);return _0x9bf611(_0x3a89c9[_0x17b3('0x17')][_0x17b3('0x19')]);}logger[_0x17b3('0x17')]('MailAccount,\x20%s,\x20%s',_0x4ad94a,_0x3a89c9[_0x17b3('0x17')][_0x17b3('0x19')]);return _0x58b42a(_0x3a89c9['error'][_0x17b3('0x19')]);}else{logger[_0x17b3('0x13')](_0x17b3('0x1a'),_0x4ad94a,_0x17b3('0x14'));_0x58b42a(_0x3a89c9['result'][_0x17b3('0x19')]);}})[_0x17b3('0x1b')](function(_0x14395c){logger['error'](_0x17b3('0x1a'),_0x4ad94a,_0x14395c);_0x9bf611(_0x14395c);});});}function respondWithStatusCode(_0x5df58e,_0x4c1577){_0x4c1577=_0x4c1577||0xcc;return function(_0x3d717f){if(_0x3d717f){return _0x5df58e[_0x17b3('0x1c')](_0x4c1577);}return _0x5df58e[_0x17b3('0x1d')](_0x4c1577)[_0x17b3('0x1e')]();};}function respondWithResult(_0x2ec36f,_0x433c99){_0x433c99=_0x433c99||0xc8;return function(_0x19fa0d){if(_0x19fa0d){return _0x2ec36f[_0x17b3('0x1d')](_0x433c99)[_0x17b3('0x1f')](_0x19fa0d);}};}function respondWithFilteredResult(_0x55f90e,_0x1a000f){return function(_0x3e16c1){if(_0x3e16c1){var _0xdf5eef=typeof _0x1a000f[_0x17b3('0x20')]==='undefined'&&typeof _0x1a000f['limit']===_0x17b3('0x21');var _0x95855f=_0x3e16c1[_0x17b3('0x22')];var _0x45ad50=_0xdf5eef?0x0:_0x1a000f[_0x17b3('0x20')];var _0xfe5fdd=_0xdf5eef?_0x3e16c1[_0x17b3('0x22')]:_0x1a000f['offset']+_0x1a000f[_0x17b3('0x23')];var _0x482c76;if(_0xfe5fdd>=_0x95855f){_0xfe5fdd=_0x95855f;_0x482c76=0xc8;}else{_0x482c76=0xce;}_0x55f90e['status'](_0x482c76);return _0x55f90e['set'](_0x17b3('0x24'),_0x45ad50+'-'+_0xfe5fdd+'/'+_0x95855f)[_0x17b3('0x1f')](_0x3e16c1);}return null;};}function saveUpdates(_0x44afa9){return function(_0x863f90){if(_0x863f90){return _0x863f90[_0x17b3('0x25')](_0x44afa9)[_0x17b3('0x12')](function(_0x3c12ac){return _0x3c12ac;});}return null;};}function removeEntity(_0x4c2840){return function(_0xf04011){if(_0xf04011){return _0xf04011['destroy']()['then'](function(){var _0x7f2a52=_0xf04011[_0x17b3('0x26')]({'plain':!![]});var _0x481a5c=_0x17b3('0x27');return db['UserProfileResource'][_0x17b3('0x28')]({'where':{'type':_0x481a5c,'resourceId':_0x7f2a52['id']}})[_0x17b3('0x12')](function(){return _0xf04011;});})[_0x17b3('0x12')](function(){_0x4c2840[_0x17b3('0x1d')](0xcc)[_0x17b3('0x1e')]();});}};}function handleEntityNotFound(_0x335e9f){return function(_0xbfe4e3){if(!_0xbfe4e3){_0x335e9f[_0x17b3('0x1c')](0x194);}return _0xbfe4e3;};}function handleError(_0x43c1d6,_0x324bbc){_0x324bbc=_0x324bbc||0x1f4;return function(_0x4b976f){logger[_0x17b3('0x17')](_0x4b976f['stack']);if(_0x4b976f[_0x17b3('0x29')]){delete _0x4b976f[_0x17b3('0x29')];}_0x43c1d6[_0x17b3('0x1d')](_0x324bbc)[_0x17b3('0x2a')](_0x4b976f);};}function getImapHost(_0x265007){switch(_0x265007){case'gmail':return _0x17b3('0x2b');case _0x17b3('0x2c'):return _0x17b3('0x2d');case _0x17b3('0x2e'):return _0x17b3('0x2f');case _0x17b3('0x30'):return _0x17b3('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x265007);}function getSmtpHost(_0x38a88c){switch(_0x38a88c){case'gmail':return _0x17b3('0x32');case _0x17b3('0x2c'):return _0x17b3('0x33');case _0x17b3('0x2e'):return _0x17b3('0x34');case _0x17b3('0x30'):return'smtp.office365.com';}throw new Error(_0x17b3('0x35'),_0x38a88c);}function getAuthenticationOptions(_0x53c5f8,_0x3b00b2){var _0x47c80e={};var _0x3dbb92={};if(_0x53c5f8){_0x47c80e['user']=_0x3dbb92['user']=_0x3b00b2[_0x17b3('0x36')];_0x47c80e[_0x17b3('0x37')]=_0x3dbb92[_0x17b3('0x38')]=_0x3b00b2[_0x17b3('0x37')];if(_0x3b00b2[_0x17b3('0x39')]){_0x47c80e['modernAuthentication']=_0x3dbb92['modernAuthentication']=!![];_0x47c80e[_0x17b3('0x3a')]=_0x3dbb92[_0x17b3('0x3a')]=_0x3b00b2[_0x17b3('0x3a')];_0x47c80e[_0x17b3('0x37')]=_0x3dbb92['pass']=null;}else{_0x47c80e[_0x17b3('0x3a')]=_0x3dbb92[_0x17b3('0x3a')]=null;}_0x47c80e[_0x17b3('0x3b')]=getImapHost(_0x53c5f8);_0x47c80e[_0x17b3('0x3c')]=0x3e1;_0x3dbb92[_0x17b3('0x3b')]=getSmtpHost(_0x53c5f8);_0x3dbb92['port']=0x24b;_0x3dbb92[_0x17b3('0x3d')]=![];_0x47c80e[_0x17b3('0x3e')]=_0x3dbb92[_0x17b3('0x3e')]=null;}else{if(_0x3b00b2[_0x17b3('0x3f')]){_0x47c80e['user']=_0x3dbb92['user']=_0x3b00b2[_0x17b3('0x36')];_0x47c80e['password']=_0x3dbb92[_0x17b3('0x38')]=_0x3b00b2[_0x17b3('0x37')];}else{_0x47c80e['authentication']=_0x3dbb92[_0x17b3('0x3f')]=![];_0x47c80e[_0x17b3('0x40')]=_0x3dbb92[_0x17b3('0x40')]=null;_0x47c80e['password']=_0x3dbb92[_0x17b3('0x38')]=null;}_0x47c80e['host']=_0x3b00b2[_0x17b3('0x41')][_0x17b3('0x3b')];_0x47c80e[_0x17b3('0x3c')]=_0x3b00b2['Imap'][_0x17b3('0x3c')];_0x3dbb92[_0x17b3('0x3b')]=_0x3b00b2[_0x17b3('0x42')][_0x17b3('0x3b')];_0x3dbb92[_0x17b3('0x3c')]=_0x3b00b2[_0x17b3('0x42')][_0x17b3('0x3c')];}return{'Imap':_0x47c80e,'Smtp':_0x3dbb92};}exports[_0x17b3('0x43')]=function(_0x1170a9,_0x125eb5){var _0x277679={'include':[{'model':db[_0x17b3('0x44')],'as':_0x17b3('0x41')},{'model':db['MailServerOut'],'as':_0x17b3('0x42')},{'model':db['Pause'],'as':_0x17b3('0x45')}]},_0x2be806={},_0x28040d={'count':0x0,'rows':[]};var _0x427a13=_[_0x17b3('0x46')](db['MailAccount']['rawAttributes'],function(_0x191e75){return{'name':_0x191e75[_0x17b3('0x47')],'type':_0x191e75[_0x17b3('0x48')][_0x17b3('0x49')]};});_0x2be806['model']=_[_0x17b3('0x46')](_0x427a13,_0x17b3('0x29'));_0x2be806[_0x17b3('0x4a')]=_[_0x17b3('0x4b')](_0x1170a9[_0x17b3('0x4a')]);_0x2be806['filters']=_[_0x17b3('0x4c')](_0x2be806['model'],_0x2be806[_0x17b3('0x4a')]);_0x277679[_0x17b3('0x4d')]=_[_0x17b3('0x4c')](_0x2be806[_0x17b3('0x4e')],qs[_0x17b3('0x4f')](_0x1170a9[_0x17b3('0x4a')][_0x17b3('0x4f')]));_0x277679['attributes']=_0x277679[_0x17b3('0x4d')][_0x17b3('0x50')]?_0x277679[_0x17b3('0x4d')]:_0x2be806[_0x17b3('0x4e')];if(!_0x1170a9[_0x17b3('0x4a')][_0x17b3('0x51')]('nolimit')){_0x277679['limit']=qs[_0x17b3('0x23')](_0x1170a9[_0x17b3('0x4a')][_0x17b3('0x23')]);_0x277679[_0x17b3('0x20')]=qs[_0x17b3('0x20')](_0x1170a9[_0x17b3('0x4a')][_0x17b3('0x20')]);}_0x277679[_0x17b3('0x52')]=qs[_0x17b3('0x53')](_0x1170a9[_0x17b3('0x4a')][_0x17b3('0x53')]);_0x277679[_0x17b3('0x54')]=qs[_0x17b3('0x55')](_[_0x17b3('0x56')](_0x1170a9[_0x17b3('0x4a')],_0x2be806['filters']),_0x427a13);if(_0x1170a9['query'][_0x17b3('0x57')]){_0x277679[_0x17b3('0x54')]=_[_0x17b3('0x58')](_0x277679['where'],{'$or':_['map'](_0x427a13,function(_0x3f6fd9){if(_0x3f6fd9[_0x17b3('0x48')]!==_0x17b3('0x59')){var _0x24aae0={};_0x24aae0[_0x3f6fd9['name']]={'$like':'%'+_0x1170a9['query'][_0x17b3('0x57')]+'%'};return _0x24aae0;}})});}_0x277679=_[_0x17b3('0x58')]({},_0x277679,_0x1170a9['options']);var _0x9fbb47={'where':_0x277679[_0x17b3('0x54')]};return db[_0x17b3('0x5a')][_0x17b3('0x22')](_0x9fbb47)['then'](function(_0xfd666){_0x28040d['count']=_0xfd666;if(_0x1170a9['query'][_0x17b3('0x5b')]){_0x277679[_0x17b3('0x5c')]=[{'all':!![]}];}return db['MailAccount'][_0x17b3('0x5d')](_0x277679);})[_0x17b3('0x12')](function(_0x445abb){_0x28040d[_0x17b3('0x5e')]=_0x445abb;return _0x28040d;})[_0x17b3('0x12')](respondWithFilteredResult(_0x125eb5,_0x277679))[_0x17b3('0x1b')](handleError(_0x125eb5,null));};exports[_0x17b3('0x5f')]=function(_0x4862b2,_0x438125){var _0x1e24c5={'raw':![],'where':{'id':_0x4862b2[_0x17b3('0x60')]['id']},'include':[{'model':db[_0x17b3('0x44')],'as':_0x17b3('0x41')},{'model':db[_0x17b3('0x61')],'as':_0x17b3('0x42')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x469471={};_0x469471['model']=_[_0x17b3('0x4b')](db[_0x17b3('0x5a')][_0x17b3('0x62')]);_0x469471[_0x17b3('0x4a')]=_[_0x17b3('0x4b')](_0x4862b2[_0x17b3('0x4a')]);_0x469471[_0x17b3('0x55')]=_[_0x17b3('0x4c')](_0x469471[_0x17b3('0x4e')],_0x469471[_0x17b3('0x4a')]);_0x1e24c5['attributes']=_[_0x17b3('0x4c')](_0x469471[_0x17b3('0x4e')],qs[_0x17b3('0x4f')](_0x4862b2[_0x17b3('0x4a')]['fields']));_0x1e24c5[_0x17b3('0x4d')]=_0x1e24c5[_0x17b3('0x4d')]['length']?_0x1e24c5[_0x17b3('0x4d')]:_0x469471[_0x17b3('0x4e')];if(_0x4862b2[_0x17b3('0x4a')][_0x17b3('0x5b')]){_0x1e24c5[_0x17b3('0x5c')]=[{'all':!![]}];}_0x1e24c5=_[_0x17b3('0x58')]({},_0x1e24c5,_0x4862b2['options']);return db[_0x17b3('0x5a')][_0x17b3('0x63')](_0x1e24c5)[_0x17b3('0x12')](handleEntityNotFound(_0x438125,null))[_0x17b3('0x12')](respondWithResult(_0x438125,null))['catch'](handleError(_0x438125,null));};exports['update']=function(_0x3b049d,_0x1d177a){if(_0x3b049d[_0x17b3('0x64')]['id']){delete _0x3b049d['body']['id'];}var _0x18e98a=_0x3b049d['body'][_0x17b3('0x65')]===_0x17b3('0x66')?null:_0x3b049d[_0x17b3('0x64')]['provider'];var _0x56920c=_0x3b049d['body']['Imap']||{};var _0x388e56=_0x3b049d[_0x17b3('0x64')][_0x17b3('0x42')]||{};if(_0x18e98a){_0x56920c[_0x17b3('0x3b')]=getImapHost(_0x18e98a);_0x56920c['port']=0x3e1;_0x388e56['host']=getSmtpHost(_0x18e98a);_0x388e56[_0x17b3('0x3c')]=0x24b;_0x388e56[_0x17b3('0x3d')]=![];}if(_0x388e56[_0x17b3('0x39')]){_0x388e56[_0x17b3('0x3d')]=![];}else{_0x388e56['CloudProviderId']=null;}if(!_0x56920c[_0x17b3('0x39')])_0x56920c['CloudProviderId']=null;_0x3b049d[_0x17b3('0x64')]['Imap']=_0x56920c;_0x3b049d[_0x17b3('0x64')][_0x17b3('0x42')]=_0x388e56;return db[_0x17b3('0x5a')][_0x17b3('0x63')]({'where':{'id':_0x3b049d['params']['id']},'include':[{'model':db[_0x17b3('0x44')],'as':'Imap'},{'model':db[_0x17b3('0x61')],'as':_0x17b3('0x42')},{'model':db[_0x17b3('0x67')],'as':_0x17b3('0x45')}]})[_0x17b3('0x12')](handleEntityNotFound(_0x1d177a,null))[_0x17b3('0x12')](function(_0x74b1c8){if(!_0x74b1c8)throw new Error(_0x17b3('0x68'));if(_0x74b1c8[_0x17b3('0x3e')])delete _0x3b049d[_0x17b3('0x64')]['Imap'];return _0x74b1c8;})[_0x17b3('0x12')](saveUpdates(_0x3b049d[_0x17b3('0x64')],null))[_0x17b3('0x12')](function(_0x6b974b){if(!_0x3b049d[_0x17b3('0x64')][_0x17b3('0x41')])return _0x6b974b;return db[_0x17b3('0x44')][_0x17b3('0x25')](_0x3b049d['body'][_0x17b3('0x41')],{'where':{'MailAccountId':_0x6b974b['id']}})[_0x17b3('0x12')](function(){return _0x6b974b;});})['then'](function(_0x56ae44){if(!_0x3b049d[_0x17b3('0x64')][_0x17b3('0x42')])return _0x56ae44;return db[_0x17b3('0x61')]['update'](_0x3b049d['body']['Smtp'],{'where':{'MailAccountId':_0x56ae44['id']}})[_0x17b3('0x12')](function(){return _0x56ae44;});})[_0x17b3('0x12')](respondWithResult(_0x1d177a,null))[_0x17b3('0x1b')](handleError(_0x1d177a,null));};exports[_0x17b3('0x69')]=function(_0x97ada1,_0x3d8c17){return db[_0x17b3('0x5a')]['describe']()[_0x17b3('0x12')](respondWithResult(_0x3d8c17,null))[_0x17b3('0x1b')](handleError(_0x3d8c17,null));};exports['addDisposition']=function(_0x2ec74d,_0x2d0da8){if(_0x2ec74d[_0x17b3('0x64')]['id']){delete _0x2ec74d['body']['id'];}return db[_0x17b3('0x5a')][_0x17b3('0x63')]({'where':{'id':_0x2ec74d['params']['id']}})['then'](handleEntityNotFound(_0x2d0da8,null))[_0x17b3('0x12')](function(_0x8ae293){if(_0x8ae293){_0x2ec74d[_0x17b3('0x64')][_0x17b3('0x6a')]=_0x8ae293['id'];return db[_0x17b3('0x6b')]['create'](_0x2ec74d[_0x17b3('0x64')]);}})[_0x17b3('0x12')](respondWithResult(_0x2d0da8,null))[_0x17b3('0x1b')](handleError(_0x2d0da8,null));};exports[_0x17b3('0x6c')]=function(_0x54ee36,_0x2f95d6){var _0x301b40={'raw':![],'where':{}};var _0x1f0890={};var _0x2b284f={'count':0x0,'rows':[]};return db[_0x17b3('0x5a')]['findOne']({'where':{'id':_0x54ee36[_0x17b3('0x60')]['id']}})['then'](handleEntityNotFound(_0x2f95d6,null))[_0x17b3('0x12')](function(_0x5bfe7b){if(_0x5bfe7b){_0x1f0890['model']=_[_0x17b3('0x4b')](db[_0x17b3('0x6b')][_0x17b3('0x62')]);_0x1f0890[_0x17b3('0x4a')]=_['keys'](_0x54ee36[_0x17b3('0x4a')]);_0x1f0890['filters']=_[_0x17b3('0x4c')](_0x1f0890[_0x17b3('0x4e')],_0x1f0890[_0x17b3('0x4a')]);_0x301b40[_0x17b3('0x4d')]=_['intersection'](_0x1f0890[_0x17b3('0x4e')],qs[_0x17b3('0x4f')](_0x54ee36[_0x17b3('0x4a')]['fields']));_0x301b40[_0x17b3('0x4d')]=_0x301b40[_0x17b3('0x4d')][_0x17b3('0x50')]?_0x301b40[_0x17b3('0x4d')]:_0x1f0890[_0x17b3('0x4e')];if(!_0x54ee36[_0x17b3('0x4a')]['hasOwnProperty']('nolimit')){_0x301b40['limit']=qs[_0x17b3('0x23')](_0x54ee36[_0x17b3('0x4a')][_0x17b3('0x23')]);_0x301b40[_0x17b3('0x20')]=qs[_0x17b3('0x20')](_0x54ee36[_0x17b3('0x4a')]['offset']);}_0x301b40[_0x17b3('0x52')]=qs[_0x17b3('0x53')](_0x54ee36[_0x17b3('0x4a')][_0x17b3('0x53')]);_0x301b40[_0x17b3('0x54')]=qs[_0x17b3('0x55')](_[_0x17b3('0x56')](_0x54ee36[_0x17b3('0x4a')],_0x1f0890['filters']));_0x301b40[_0x17b3('0x54')][_0x17b3('0x6a')]=_0x5bfe7b['id'];if(_0x54ee36[_0x17b3('0x4a')][_0x17b3('0x57')]){_0x301b40[_0x17b3('0x54')]=_[_0x17b3('0x58')](_0x301b40['where'],{'$or':_[_0x17b3('0x46')](_0x301b40[_0x17b3('0x4d')],function(_0xeac7dc){var _0x56fd58={};_0x56fd58[_0xeac7dc]={'$like':'%'+_0x54ee36[_0x17b3('0x4a')]['filter']+'%'};return _0x56fd58;})});}_0x301b40=_[_0x17b3('0x58')]({},_0x301b40,_0x54ee36[_0x17b3('0x6d')]);return db[_0x17b3('0x6b')][_0x17b3('0x22')]({'where':_0x301b40[_0x17b3('0x54')]})[_0x17b3('0x12')](function(_0x27b636){_0x2b284f['count']=_0x27b636;if(_0x54ee36[_0x17b3('0x4a')]['includeAll']){_0x301b40[_0x17b3('0x5c')]=[{'all':!![]}];}return db[_0x17b3('0x6b')][_0x17b3('0x5d')](_0x301b40);})[_0x17b3('0x12')](function(_0x3ddee9){_0x2b284f['rows']=_0x3ddee9;return _0x2b284f;});}})['then'](respondWithFilteredResult(_0x2f95d6,_0x301b40))[_0x17b3('0x1b')](handleError(_0x2f95d6,null));};exports['removeDispositions']=function(_0x167574,_0xf26ce8){return db[_0x17b3('0x5a')][_0x17b3('0x63')]({'where':{'id':_0x167574[_0x17b3('0x60')]['id']}})['then'](handleEntityNotFound(_0xf26ce8,null))[_0x17b3('0x12')](function(_0x4cd713){if(_0x4cd713){return _0x4cd713['removeDispositions'](_0x167574[_0x17b3('0x4a')][_0x17b3('0x6e')]);}})['then'](respondWithStatusCode(_0xf26ce8,null))[_0x17b3('0x1b')](handleError(_0xf26ce8,null));};exports[_0x17b3('0x6f')]=function(_0xe1b02c,_0x300544){if(_0xe1b02c[_0x17b3('0x64')]['id']){delete _0xe1b02c[_0x17b3('0x64')]['id'];}return db[_0x17b3('0x5a')][_0x17b3('0x63')]({'where':{'id':_0xe1b02c[_0x17b3('0x60')]['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x300544,null))['then'](function(_0x1fa75c){if(_0x1fa75c){_0xe1b02c[_0x17b3('0x64')][_0x17b3('0x6a')]=_0x1fa75c['id'];return db[_0x17b3('0x70')]['create'](_0xe1b02c[_0x17b3('0x64')]);}})[_0x17b3('0x12')](respondWithResult(_0x300544,null))[_0x17b3('0x1b')](handleError(_0x300544,null));};exports['getAnswers']=function(_0x2f8085,_0x3570ef){var _0x3f4a63={'raw':![],'where':{}};var _0x27b95f={};var _0x5945da={'count':0x0,'rows':[]};return db[_0x17b3('0x5a')][_0x17b3('0x71')]({'where':{'id':_0x2f8085['params']['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x3570ef,null))[_0x17b3('0x12')](function(_0x47166c){if(_0x47166c){_0x27b95f[_0x17b3('0x4e')]=_['keys'](db[_0x17b3('0x70')]['rawAttributes']);_0x27b95f[_0x17b3('0x4a')]=_[_0x17b3('0x4b')](_0x2f8085[_0x17b3('0x4a')]);_0x27b95f[_0x17b3('0x55')]=_[_0x17b3('0x4c')](_0x27b95f[_0x17b3('0x4e')],_0x27b95f[_0x17b3('0x4a')]);_0x3f4a63['attributes']=_[_0x17b3('0x4c')](_0x27b95f['model'],qs['fields'](_0x2f8085[_0x17b3('0x4a')]['fields']));_0x3f4a63[_0x17b3('0x4d')]=_0x3f4a63['attributes'][_0x17b3('0x50')]?_0x3f4a63[_0x17b3('0x4d')]:_0x27b95f[_0x17b3('0x4e')];if(!_0x2f8085['query'][_0x17b3('0x51')]('nolimit')){_0x3f4a63[_0x17b3('0x23')]=qs[_0x17b3('0x23')](_0x2f8085[_0x17b3('0x4a')][_0x17b3('0x23')]);_0x3f4a63['offset']=qs[_0x17b3('0x20')](_0x2f8085[_0x17b3('0x4a')]['offset']);}_0x3f4a63[_0x17b3('0x52')]=qs[_0x17b3('0x53')](_0x2f8085['query'][_0x17b3('0x53')]);_0x3f4a63['where']=qs[_0x17b3('0x55')](_['pick'](_0x2f8085[_0x17b3('0x4a')],_0x27b95f[_0x17b3('0x55')]));_0x3f4a63[_0x17b3('0x54')][_0x17b3('0x6a')]=_0x47166c['id'];if(_0x2f8085[_0x17b3('0x4a')]['filter']){_0x3f4a63['where']=_[_0x17b3('0x58')](_0x3f4a63[_0x17b3('0x54')],{'$or':_[_0x17b3('0x46')](_0x3f4a63[_0x17b3('0x4d')],function(_0x259275){var _0x26f058={};_0x26f058[_0x259275]={'$like':'%'+_0x2f8085[_0x17b3('0x4a')]['filter']+'%'};return _0x26f058;})});}_0x3f4a63=_[_0x17b3('0x58')]({},_0x3f4a63,_0x2f8085[_0x17b3('0x6d')]);return db[_0x17b3('0x70')]['count']({'where':_0x3f4a63[_0x17b3('0x54')]})[_0x17b3('0x12')](function(_0x41b298){_0x5945da['count']=_0x41b298;if(_0x2f8085['query'][_0x17b3('0x5b')]){_0x3f4a63[_0x17b3('0x5c')]=[{'all':!![]}];}return db[_0x17b3('0x70')]['findAll'](_0x3f4a63);})['then'](function(_0x130bed){_0x5945da['rows']=_0x130bed;return _0x5945da;});}})[_0x17b3('0x12')](respondWithFilteredResult(_0x3570ef,_0x3f4a63))['catch'](handleError(_0x3570ef,null));};exports[_0x17b3('0x72')]=function(_0x595124,_0x29985f){return db[_0x17b3('0x5a')][_0x17b3('0x63')]({'where':{'id':_0x595124['params']['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x29985f,null))[_0x17b3('0x12')](function(_0x55b44f){if(_0x55b44f){return _0x55b44f[_0x17b3('0x72')](_0x595124[_0x17b3('0x4a')][_0x17b3('0x6e')]);}})['then'](respondWithStatusCode(_0x29985f,null))[_0x17b3('0x1b')](handleError(_0x29985f,null));};exports[_0x17b3('0x73')]=function(_0x29befc,_0x14291a){var _0x5845cc={'name':_0x29befc[_0x17b3('0x64')][_0x17b3('0x29')],'key':_0x29befc[_0x17b3('0x64')][_0x17b3('0x49')],'provider':_0x29befc[_0x17b3('0x64')][_0x17b3('0x65')]===_0x17b3('0x66')?null:_0x29befc[_0x17b3('0x64')]['provider'],'email':_0x29befc['body'][_0x17b3('0x74')],'ListId':_0x29befc[_0x17b3('0x64')][_0x17b3('0x75')],'active':!_[_0x17b3('0x76')](_0x29befc[_0x17b3('0x64')][_0x17b3('0x77')])?_0x29befc[_0x17b3('0x64')][_0x17b3('0x77')]:!![],'description':_0x29befc[_0x17b3('0x64')][_0x17b3('0x78')]||null};var _0x2a6cf5=getAuthenticationOptions(_0x5845cc[_0x17b3('0x65')],_0x29befc['body']);_0x5845cc[_0x17b3('0x41')]=_0x2a6cf5[_0x17b3('0x41')];_0x5845cc[_0x17b3('0x42')]=_0x2a6cf5[_0x17b3('0x42')];return db[_0x17b3('0x5a')][_0x17b3('0x73')](_0x5845cc,{'include':[{'model':db[_0x17b3('0x61')],'as':_0x17b3('0x42')},{'model':db['MailServerIn'],'as':_0x17b3('0x41')}]})[_0x17b3('0x12')](function(_0x2a1429){var _0x2e6a92=_0x29befc[_0x17b3('0x40')][_0x17b3('0x26')]({'plain':!![]});if(!_0x2e6a92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e6a92[_0x17b3('0x79')]===_0x17b3('0x40')){var _0x4e7822=_0x2a1429[_0x17b3('0x26')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x17b3('0x27'),'userProfileId':_0x2e6a92['userProfileId']},'raw':!![]})['then'](function(_0x4eac0d){if(_0x4eac0d&&_0x4eac0d[_0x17b3('0x7a')]===0x0){return db[_0x17b3('0x7b')][_0x17b3('0x73')]({'name':_0x4e7822[_0x17b3('0x29')],'resourceId':_0x4e7822['id'],'type':_0x4eac0d[_0x17b3('0x29')],'sectionId':_0x4eac0d['id']},{})['then'](function(){return _0x2a1429;});}else{return _0x2a1429;}})['catch'](function(_0x42eb94){logger[_0x17b3('0x17')](_0x17b3('0x7c'),_0x42eb94);throw _0x42eb94;});}return _0x2a1429;})['then'](respondWithResult(_0x14291a,0xc9))[_0x17b3('0x1b')](handleError(_0x14291a,null));};exports[_0x17b3('0x7d')]=function(_0x55ce0,_0x772ed){return db[_0x17b3('0x5a')][_0x17b3('0x71')]({'where':{'id':_0x55ce0[_0x17b3('0x60')]['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x772ed,null))[_0x17b3('0x12')](function(_0x24040e){if(_0x24040e){return _0x24040e[_0x17b3('0x7d')]();}return null;})[_0x17b3('0x12')](respondWithResult(_0x772ed,null))['catch'](handleError(_0x772ed,null));};exports[_0x17b3('0x7e')]=function(_0xe91138,_0x227cc9){if(_0xe91138[_0x17b3('0x64')]['id']){delete _0xe91138[_0x17b3('0x64')]['id'];}return db[_0x17b3('0x5a')][_0x17b3('0x63')]({'where':{'id':_0xe91138['params']['id']}})['then'](handleEntityNotFound(_0x227cc9,null))[_0x17b3('0x12')](function(_0x1a363a){if(_0x1a363a){_0xe91138[_0x17b3('0x64')]['MailAccountId']=_0x1a363a['id'];return db[_0x17b3('0x44')][_0x17b3('0x73')](_0xe91138[_0x17b3('0x64')]);}})[_0x17b3('0x12')](respondWithResult(_0x227cc9,null))[_0x17b3('0x1b')](handleError(_0x227cc9,null));};exports[_0x17b3('0x7f')]=function(_0x2d9473,_0x4fc256){return db[_0x17b3('0x5a')][_0x17b3('0x71')]({'where':{'id':_0x2d9473[_0x17b3('0x60')]['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x4fc256,null))[_0x17b3('0x12')](function(_0x450965){if(_0x450965){return _0x450965[_0x17b3('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x4fc256,null))['catch'](handleError(_0x4fc256,null));};exports[_0x17b3('0x81')]=function(_0x44d10a,_0x2bad9b){return db[_0x17b3('0x5a')][_0x17b3('0x71')]({'where':{'id':_0x44d10a['params']['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x2bad9b,null))['then'](function(_0x1dab25){if(_0x1dab25){return _0x1dab25[_0x17b3('0x81')]();}return null;})['then'](respondWithResult(_0x2bad9b,null))['catch'](handleError(_0x2bad9b,null));};exports[_0x17b3('0x82')]=function(_0x372fd3,_0x225762){if(_0x372fd3[_0x17b3('0x64')]['id']){delete _0x372fd3[_0x17b3('0x64')]['id'];}return db['MailAccount'][_0x17b3('0x63')]({'where':{'id':_0x372fd3[_0x17b3('0x60')]['id']}})['then'](handleEntityNotFound(_0x225762,null))[_0x17b3('0x12')](function(_0x25d95a){if(_0x25d95a){_0x372fd3[_0x17b3('0x64')][_0x17b3('0x6a')]=_0x25d95a['id'];return db['MailServerOut'][_0x17b3('0x73')](_0x372fd3['body']);}})[_0x17b3('0x12')](respondWithResult(_0x225762,null))['catch'](handleError(_0x225762,null));};exports[_0x17b3('0x83')]=function(_0xd20897,_0x4d0489){return db['MailAccount'][_0x17b3('0x71')]({'where':{'id':_0xd20897[_0x17b3('0x60')]['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x4d0489,null))[_0x17b3('0x12')](function(_0xb79f55){if(_0xb79f55){return _0xb79f55[_0x17b3('0x84')](null);}return null;})[_0x17b3('0x12')](respondWithStatusCode(_0x4d0489,null))[_0x17b3('0x1b')](handleError(_0x4d0489,null));};exports[_0x17b3('0x85')]=function(_0x27c080,_0x1ad647){return db[_0x17b3('0x86')][_0x17b3('0x63')]({'where':{'id':_0x27c080['params']['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x1ad647,null))['then'](function(_0x4adee3){if(_0x4adee3){return _0x4adee3[_0x17b3('0x85')](_0x27c080[_0x17b3('0x64')][_0x17b3('0x6e')],_[_0x17b3('0x87')](_0x27c080[_0x17b3('0x64')],[_0x17b3('0x6e'),'id'])||{});}})[_0x17b3('0x12')](respondWithResult(_0x1ad647,null))[_0x17b3('0x1b')](handleError(_0x1ad647,null));};exports[_0x17b3('0x88')]=function(_0x5a938f,_0x4305ab){var _0x5b2f20={'raw':![],'where':{}};var _0x1f95d6={};var _0xef869b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x5a938f['params']['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x4305ab,null))['then'](function(_0xf3e1f9){if(_0xf3e1f9){_0x1f95d6[_0x17b3('0x4e')]=_[_0x17b3('0x4b')](db[_0x17b3('0x86')][_0x17b3('0x62')]);_0x1f95d6[_0x17b3('0x4a')]=_[_0x17b3('0x4b')](_0x5a938f[_0x17b3('0x4a')]);_0x1f95d6[_0x17b3('0x55')]=_[_0x17b3('0x4c')](_0x1f95d6[_0x17b3('0x4e')],_0x1f95d6[_0x17b3('0x4a')]);_0x5b2f20[_0x17b3('0x4d')]=_[_0x17b3('0x4c')](_0x1f95d6['model'],qs[_0x17b3('0x4f')](_0x5a938f['query'][_0x17b3('0x4f')]));_0x5b2f20[_0x17b3('0x4d')]=_0x5b2f20[_0x17b3('0x4d')][_0x17b3('0x50')]?_0x5b2f20[_0x17b3('0x4d')]:_0x1f95d6[_0x17b3('0x4e')];if(!_0x5a938f[_0x17b3('0x4a')][_0x17b3('0x51')]('nolimit')){_0x5b2f20[_0x17b3('0x23')]=qs['limit'](_0x5a938f['query'][_0x17b3('0x23')]);_0x5b2f20['offset']=qs[_0x17b3('0x20')](_0x5a938f['query']['offset']);}_0x5b2f20[_0x17b3('0x52')]=qs[_0x17b3('0x53')](_0x5a938f['query'][_0x17b3('0x53')]);_0x5b2f20['where']=qs[_0x17b3('0x55')](_[_0x17b3('0x56')](_0x5a938f['query'],_0x1f95d6[_0x17b3('0x55')]));_0x5b2f20['where'][_0x17b3('0x6a')]=_0xf3e1f9['id'];if(_0x5a938f[_0x17b3('0x4a')][_0x17b3('0x57')]){_0x5b2f20[_0x17b3('0x54')]=_[_0x17b3('0x58')](_0x5b2f20[_0x17b3('0x54')],{'$or':_['map'](_0x5b2f20[_0x17b3('0x4d')],function(_0x4fee7a){var _0x48b39e={};_0x48b39e[_0x4fee7a]={'$like':'%'+_0x5a938f[_0x17b3('0x4a')]['filter']+'%'};return _0x48b39e;})});}_0x5b2f20=_['merge']({},_0x5b2f20,_0x5a938f[_0x17b3('0x6d')]);return db['MailInteraction'][_0x17b3('0x22')]({'where':_0x5b2f20['where']})['then'](function(_0x36b2b8){_0xef869b[_0x17b3('0x22')]=_0x36b2b8;if(_0x5a938f[_0x17b3('0x4a')]['includeAll']){_0x5b2f20[_0x17b3('0x5c')]=[{'model':db['CmContact'],'as':_0x17b3('0x89'),'required':![]},{'model':db['User'],'as':_0x17b3('0x8a'),'attributes':[_0x17b3('0x29'),_0x17b3('0x8b'),_0x17b3('0x8c')],'required':![]},{'model':db[_0x17b3('0x8d')],'as':_0x17b3('0x8e'),'attributes':['id',_0x17b3('0x29'),_0x17b3('0x8f')],'where':_0x5a938f[_0x17b3('0x4a')][_0x17b3('0x90')]?{'id':_0x5a938f['query'][_0x17b3('0x90')]}:undefined,'required':_0x5a938f[_0x17b3('0x4a')][_0x17b3('0x90')]?!![]:![]}];}return db[_0x17b3('0x86')]['findAll'](_0x5b2f20);})[_0x17b3('0x12')](function(_0x164421){_0xef869b[_0x17b3('0x5e')]=_0x164421;return _0xef869b;});}})[_0x17b3('0x12')](respondWithFilteredResult(_0x4305ab,_0x5b2f20))['catch'](handleError(_0x4305ab,null));};exports['addApplications']=function addApplications(_0x1c6d83,_0xafce04){var _0x21e827=_0x1c6d83[_0x17b3('0x60')]['id'];var _0x438f74=_0x1c6d83[_0x17b3('0x64')];var _0x461ffe=0xc8;var _0x42ed46=null;return db['sequelize'][_0x17b3('0x91')]({'isolationLevel':db[_0x17b3('0x92')][_0x17b3('0x93')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x186980){return db[_0x17b3('0x5a')][_0x17b3('0x71')]({'where':{'id':_0x21e827},'transaction':_0x186980})[_0x17b3('0x12')](function(_0x45d0ab){if(_0x45d0ab){return db['MailApplication'][_0x17b3('0x28')]({'where':{'MailAccountId':_0x21e827},'transaction':_0x186980})['then'](function(){var _0x24b5ae=_[_0x17b3('0x46')](_0x438f74,function(_0x551372){_0x551372['MailAccountId']=_0x21e827;return _0x551372;});return db['MailApplication']['bulkCreate'](_0x24b5ae,{'transaction':_0x186980});});}else{_0x461ffe=0x194;_0x42ed46=[];}});})[_0x17b3('0x12')](function(){if(_0x461ffe!==0x194){return db[_0x17b3('0x94')][_0x17b3('0x95')]({'where':{'MailAccountId':_0x21e827},'order':'priority'})['then'](function(_0x1706cb){_0x42ed46=_0x1706cb;});}})[_0x17b3('0x1b')](function(_0x51f945){_0x461ffe=0x1f4;logger[_0x17b3('0x17')](_0x51f945[_0x17b3('0x96')]);if(_0x51f945[_0x17b3('0x29')]){delete _0x51f945[_0x17b3('0x29')];}_0x42ed46=_0x51f945;})[_0x17b3('0x97')](function(){if(_0x42ed46===null){_0xafce04[_0x17b3('0x1c')](_0x461ffe);}else{if(_0x461ffe===0x1f4){_0xafce04[_0x17b3('0x1d')](_0x461ffe)[_0x17b3('0x2a')](_0x42ed46);}else{_0xafce04['status'](_0x461ffe)[_0x17b3('0x1f')](_0x42ed46);}}});};exports[_0x17b3('0x98')]=function(_0x43c4e1,_0x45617f){var _0x425ea5={};var _0x42151c={};var _0x3b15a2;var _0x434474;return db[_0x17b3('0x5a')][_0x17b3('0x71')]({'where':{'id':_0x43c4e1[_0x17b3('0x60')]['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x45617f,null))['then'](function(_0x584c69){if(_0x584c69){_0x3b15a2=_0x584c69;_0x42151c['model']=_['keys'](db[_0x17b3('0x94')][_0x17b3('0x62')]);_0x42151c[_0x17b3('0x4a')]=_[_0x17b3('0x4b')](_0x43c4e1[_0x17b3('0x4a')]);_0x42151c[_0x17b3('0x55')]=_[_0x17b3('0x4c')](_0x42151c[_0x17b3('0x4e')],_0x42151c[_0x17b3('0x4a')]);_0x425ea5[_0x17b3('0x4d')]=_['intersection'](_0x42151c[_0x17b3('0x4e')],qs[_0x17b3('0x4f')](_0x43c4e1[_0x17b3('0x4a')][_0x17b3('0x4f')]));_0x425ea5[_0x17b3('0x4d')]=_0x425ea5[_0x17b3('0x4d')][_0x17b3('0x50')]?_0x425ea5[_0x17b3('0x4d')]:_0x42151c['model'];_0x425ea5[_0x17b3('0x52')]=qs['sort'](_0x43c4e1[_0x17b3('0x4a')][_0x17b3('0x53')]);_0x425ea5[_0x17b3('0x54')]=qs[_0x17b3('0x55')](_['pick'](_0x43c4e1[_0x17b3('0x4a')],_0x42151c[_0x17b3('0x55')]));if(_0x43c4e1[_0x17b3('0x4a')][_0x17b3('0x57')]){_0x425ea5[_0x17b3('0x54')]=_[_0x17b3('0x58')](_0x425ea5[_0x17b3('0x54')],{'$or':_[_0x17b3('0x46')](_0x425ea5[_0x17b3('0x4d')],function(_0x5358d0){var _0x19107b={};_0x19107b[_0x5358d0]={'$like':'%'+_0x43c4e1['query'][_0x17b3('0x57')]+'%'};return _0x19107b;})});}_0x425ea5=_[_0x17b3('0x58')]({},_0x425ea5,_0x43c4e1[_0x17b3('0x6d')]);return _0x3b15a2[_0x17b3('0x98')](_0x425ea5);}})['then'](function(_0x515274){if(_0x515274){_0x434474=_0x515274[_0x17b3('0x50')];if(!_0x43c4e1[_0x17b3('0x4a')][_0x17b3('0x51')](_0x17b3('0x99'))){_0x425ea5[_0x17b3('0x23')]=qs['limit'](_0x43c4e1[_0x17b3('0x4a')]['limit']);_0x425ea5[_0x17b3('0x20')]=qs[_0x17b3('0x20')](_0x43c4e1[_0x17b3('0x4a')][_0x17b3('0x20')]);}return _0x3b15a2[_0x17b3('0x98')](_0x425ea5);}})[_0x17b3('0x12')](function(_0x34b792){if(_0x34b792){return _0x34b792?{'count':_0x434474,'rows':_0x34b792}:null;}})[_0x17b3('0x12')](respondWithResult(_0x45617f,null))[_0x17b3('0x1b')](handleError(_0x45617f,null));};exports[_0x17b3('0x9a')]=function(_0x2ff2c4,_0x501dbc){var _0x4155b9={'raw':!![],'where':{}};var _0x23a995={};var _0x159d58={'count':0x0,'rows':[]};return db['MailAccount'][_0x17b3('0x71')]({'where':{'id':_0x2ff2c4[_0x17b3('0x60')]['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x501dbc,null))['then'](function(_0x1a92c8){if(_0x1a92c8){_0x23a995[_0x17b3('0x4e')]=_[_0x17b3('0x4b')](db['MailMessage'][_0x17b3('0x62')]);_0x23a995[_0x17b3('0x4a')]=_[_0x17b3('0x4b')](_0x2ff2c4[_0x17b3('0x4a')]);_0x23a995[_0x17b3('0x55')]=_[_0x17b3('0x4c')](_0x23a995[_0x17b3('0x4e')],_0x23a995[_0x17b3('0x4a')]);_0x4155b9[_0x17b3('0x4d')]=_[_0x17b3('0x4c')](_0x23a995[_0x17b3('0x4e')],qs[_0x17b3('0x4f')](_0x2ff2c4[_0x17b3('0x4a')]['fields']));_0x4155b9[_0x17b3('0x4d')]=_0x4155b9['attributes'][_0x17b3('0x50')]?_0x4155b9[_0x17b3('0x4d')]:_0x23a995[_0x17b3('0x4e')];if(!_0x2ff2c4[_0x17b3('0x4a')][_0x17b3('0x51')]('nolimit')){_0x4155b9[_0x17b3('0x23')]=qs[_0x17b3('0x23')](_0x2ff2c4['query']['limit']);_0x4155b9['offset']=qs['offset'](_0x2ff2c4[_0x17b3('0x4a')][_0x17b3('0x20')]);}_0x4155b9[_0x17b3('0x52')]=qs[_0x17b3('0x53')](_0x2ff2c4['query']['sort']);_0x4155b9[_0x17b3('0x54')]=qs['filters'](_[_0x17b3('0x56')](_0x2ff2c4[_0x17b3('0x4a')],_0x23a995[_0x17b3('0x55')]));_0x4155b9['where'][_0x17b3('0x6a')]=_0x1a92c8['id'];if(_0x2ff2c4[_0x17b3('0x4a')][_0x17b3('0x57')]){_0x4155b9['where']=_[_0x17b3('0x58')](_0x4155b9[_0x17b3('0x54')],{'$or':_[_0x17b3('0x46')](_0x4155b9['attributes'],function(_0x265889){var _0x2db374={};_0x2db374[_0x265889]={'$like':'%'+_0x2ff2c4['query'][_0x17b3('0x57')]+'%'};return _0x2db374;})});}if(_0x2ff2c4[_0x17b3('0x4a')][_0x17b3('0x9b')]){var _0x1c49b0=_0x2ff2c4['query'][_0x17b3('0x9b')]['split'](',');var _0x47ae92={};_0x47ae92[_0x1c49b0[0x0]]={'$gte':moment(_0x1c49b0[0x1])[_0x17b3('0x9c')](_0x17b3('0x9d'))};_0x4155b9[_0x17b3('0x54')]=_['merge'](_0x4155b9['where'],_0x47ae92);}_0x4155b9=_[_0x17b3('0x58')]({},_0x4155b9,_0x2ff2c4[_0x17b3('0x6d')]);return db[_0x17b3('0x9e')]['count']({'where':_0x4155b9[_0x17b3('0x54')]})['then'](function(_0x1459ed){_0x159d58[_0x17b3('0x22')]=_0x1459ed;if(_0x2ff2c4[_0x17b3('0x4a')][_0x17b3('0x5b')]){_0x4155b9[_0x17b3('0x5c')]=[{'all':!![]}];}return db[_0x17b3('0x9e')]['findAll'](_0x4155b9);})['then'](function(_0x141a2f){if(_0x2ff2c4[_0x17b3('0x4a')][_0x17b3('0x9f')]===_0x17b3('0xa0')){for(var _0x1ee21a=0x0;_0x1ee21a<_0x141a2f[_0x17b3('0x50')];_0x1ee21a++){_0x141a2f[_0x1ee21a]['body']=juice(_0x141a2f[_0x1ee21a][_0x17b3('0x64')]);}}_0x159d58[_0x17b3('0x5e')]=_0x141a2f;return _0x159d58;});}})[_0x17b3('0x12')](respondWithFilteredResult(_0x501dbc,_0x4155b9))['catch'](handleError(_0x501dbc,null));};exports[_0x17b3('0x2a')]=function(_0x44c4b2,_0x59e7cb){var _0x18a106,_0x3d3b42={},_0xf8e781;if(_0x44c4b2[_0x17b3('0x64')]['to']){_0xf8e781=_0x44c4b2[_0x17b3('0x64')]['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x44c4b2['params']['id']},'include':[{'model':db[_0x17b3('0xa1')],'as':_0x17b3('0xa2'),'include':[{'model':db[_0x17b3('0xa3')],'as':_0x17b3('0xa4'),'where':{'email':_0xf8e781},'limit':0x1,'order':[[_0x17b3('0xa5'),'DESC']]}]},{'model':db[_0x17b3('0x61')],'as':_0x17b3('0x42'),'raw':!![],'include':[{'model':db[_0x17b3('0xa6')],'as':_0x17b3('0xa6'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x59e7cb,null))[_0x17b3('0x12')](function(_0x4ee244){if(!_0x4ee244)return;_0x18a106=_0x4ee244;if(!_0x4ee244[_0x17b3('0x42')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x44c4b2['body'][_0x17b3('0xa7')])){_0x44c4b2[_0x17b3('0x64')]['from']=util[_0x17b3('0x9c')](_0x17b3('0xa8'),_0x4ee244[_0x17b3('0x29')],_0x4ee244[_0x17b3('0x74')]||_0x4ee244[_0x17b3('0x42')][_0x17b3('0x40')]);}if(_0x44c4b2[_0x17b3('0x64')][_0x17b3('0xa9')]&&_0x44c4b2[_0x17b3('0x64')][_0x17b3('0xa9')]['length']){for(var _0x3e8e7c=0x0;_0x3e8e7c<_0x44c4b2[_0x17b3('0x64')][_0x17b3('0xa9')][_0x17b3('0x50')];_0x3e8e7c+=0x1){_0x44c4b2[_0x17b3('0x64')][_0x17b3('0xa9')][_0x3e8e7c]={'filename':_0x44c4b2[_0x17b3('0x64')]['attachments'][_0x3e8e7c][_0x17b3('0x29')],'path':path[_0x17b3('0xaa')](config[_0x17b3('0xab')],'server/files/attachments',_0x44c4b2[_0x17b3('0x64')]['attachments'][_0x3e8e7c][_0x17b3('0xac')])};}}var _0x505487=_0x4ee244[_0x17b3('0xad')]();return respondWithRpcPromise(_0x17b3('0xae'),_0x17b3('0xaf'),{'account':_0x505487,'message':_0x44c4b2[_0x17b3('0x64')]});})[_0x17b3('0x12')](function(_0x5669ca){if(!_0x5669ca)return;_0x3d3b42=_0x5669ca;if(!_0x18a106['List'])throw new Error(_0x17b3('0xb0'));if(_0x18a106[_0x17b3('0xa2')]['Contacts']['length'])return _0x18a106[_0x17b3('0xa2')][_0x17b3('0xa4')][0x0];return db[_0x17b3('0xa3')][_0x17b3('0x73')](_[_0x17b3('0xa')](_0x44c4b2[_0x17b3('0x64')],{'firstName':_0x44c4b2['body']['to'],'email':_0x44c4b2[_0x17b3('0x64')]['to'],'phone':_0x44c4b2[_0x17b3('0x64')]['to'],'ListId':_0x18a106[_0x17b3('0x75')]}));})[_0x17b3('0x12')](function(_0x151b4b){if(!_0x151b4b)return;var _0x357802={'UserId':_0x44c4b2[_0x17b3('0x40')]['id'],'ContactId':_0x151b4b['id'],'MailAccountId':_0x18a106['id'],'inReplyTo':_0x3d3b42[_0x17b3('0xb1')],'to':_0x44c4b2[_0x17b3('0x64')]['from'],'cc':_0x44c4b2['body']['cc'],'subject':_0x44c4b2[_0x17b3('0x64')][_0x17b3('0xb2')],'attach':_0x44c4b2['body'][_0x17b3('0xb3')],'firstMsgDirection':_0x17b3('0xb4'),'lastMsgAt':moment()['format'](_0x17b3('0x9d')),'lastMsgDirection':_0x17b3('0xb4'),'Messages':[_['merge'](_0x44c4b2[_0x17b3('0x64')],{'messageId':_0x3d3b42[_0x17b3('0xb1')],'sentAt':moment()[_0x17b3('0x9c')](_0x17b3('0x9d')),'read':!![],'MailAccountId':_0x18a106['id'],'UserId':_0x44c4b2[_0x17b3('0x40')]['id'],'ContactId':_0x151b4b['id']})]};if(_0x44c4b2[_0x17b3('0x64')]['Interaction']){_0x357802=_['merge'](_0x357802,_0x44c4b2[_0x17b3('0x64')]['Interaction']);}return db['MailInteraction'][_0x17b3('0x73')](_0x357802,{'include':[{'model':db['MailMessage'],'as':_0x17b3('0xb5')}]});})[_0x17b3('0x12')](respondWithResult(_0x59e7cb,null))[_0x17b3('0x1b')](handleError(_0x59e7cb,null));};exports[_0x17b3('0xb6')]=function(_0xe93223,_0x25139f){return db[_0x17b3('0x5a')]['find']({'where':{'id':_0xe93223[_0x17b3('0x60')]['id']},'include':[{'model':db[_0x17b3('0x61')],'as':_0x17b3('0x42'),'raw':!![],'include':[{'model':db[_0x17b3('0xa6')],'as':_0x17b3('0xa6'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x25139f,null))[_0x17b3('0x12')](function(_0x557a4e){if(!_0x557a4e[_0x17b3('0x42')])return;var _0x47e5a2=_0x557a4e['getSmtpOptions']();return respondWithRpcPromise(_0x17b3('0xb7'),_0x17b3('0xb6'),{'account':_0x47e5a2});})['then'](respondWithResult(_0x25139f,null))[_0x17b3('0x1b')](handleError(_0x25139f,null));};exports[_0x17b3('0x28')]=function(_0x4b19db,_0x50bbaf){return db['MailAccount'][_0x17b3('0x63')]({'where':{'id':_0x4b19db['params']['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x50bbaf,null))[_0x17b3('0x12')](function(_0x388980){if(_0x388980&&_0x388980[_0x17b3('0x3e')]){throw new db[(_0x17b3('0xb8'))][(_0x17b3('0xb9'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x388980;})['then'](removeEntity(_0x50bbaf,null))[_0x17b3('0x1b')](handleError(_0x50bbaf,null));};exports[_0x17b3('0xba')]=function(_0x117dbf,_0x8f6f78){return db['MailAccount'][_0x17b3('0x63')]({'where':{'id':_0x117dbf['params']['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x8f6f78,null))[_0x17b3('0x12')](function(_0x567d28){if(_0x567d28){return _0x567d28[_0x17b3('0xba')](_0x117dbf['body'][_0x17b3('0x6e')],_[_0x17b3('0x87')](_0x117dbf[_0x17b3('0x64')],[_0x17b3('0x6e'),'id'])||{})['spread'](function(_0x4b3e6b){for(var _0x2565f4=0x0;_0x2565f4<_0x117dbf[_0x17b3('0x64')]['ids']['length'];_0x2565f4+=0x1){socket[_0x17b3('0xbb')](_0x17b3('0xbc'),{'UserId':Number(_0x117dbf[_0x17b3('0x64')][_0x17b3('0x6e')][_0x2565f4]),'MailAccountId':Number(_0x117dbf[_0x17b3('0x60')]['id'])});}return _0x4b3e6b;});}})[_0x17b3('0x12')](respondWithResult(_0x8f6f78,null))['catch'](handleError(_0x8f6f78,null));};exports[_0x17b3('0xbd')]=function(_0x30c0a9,_0x50b6d7){return db[_0x17b3('0x5a')][_0x17b3('0x63')]({'where':{'id':_0x30c0a9['params']['id']}})['then'](handleEntityNotFound(_0x50b6d7,null))[_0x17b3('0x12')](function(_0x434d94){if(_0x434d94){return _0x434d94[_0x17b3('0xbd')](_0x30c0a9['query']['ids'])[_0x17b3('0x12')](function(){if(_['isArray'](_0x30c0a9['query'][_0x17b3('0x6e')])){for(var _0xbe445e=0x0;_0xbe445e<_0x30c0a9['query'][_0x17b3('0x6e')]['length'];_0xbe445e+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x30c0a9[_0x17b3('0x4a')][_0x17b3('0x6e')][_0xbe445e]),'MailAccountId':Number(_0x30c0a9[_0x17b3('0x60')]['id'])});}}else{socket[_0x17b3('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x30c0a9[_0x17b3('0x4a')]['ids']),'MailAccountId':Number(_0x30c0a9[_0x17b3('0x60')]['id'])});}});}})[_0x17b3('0x12')](respondWithStatusCode(_0x50b6d7,null))[_0x17b3('0x1b')](handleError(_0x50b6d7,null));};exports[_0x17b3('0xbe')]=function(_0x46b43a,_0x1492d0){var _0x494e19={};var _0x5df975={};var _0x409949;var _0x1d56d9;return db['MailAccount']['findOne']({'where':{'id':_0x46b43a[_0x17b3('0x60')]['id']}})[_0x17b3('0x12')](handleEntityNotFound(_0x1492d0,null))[_0x17b3('0x12')](function(_0x444af1){if(_0x444af1){_0x409949=_0x444af1;_0x5df975[_0x17b3('0x4e')]=_[_0x17b3('0x4b')](db[_0x17b3('0xbf')][_0x17b3('0x62')]);_0x5df975[_0x17b3('0x4a')]=_[_0x17b3('0x4b')](_0x46b43a[_0x17b3('0x4a')]);_0x5df975[_0x17b3('0x55')]=_[_0x17b3('0x4c')](_0x5df975['model'],_0x5df975['query']);_0x494e19[_0x17b3('0x4d')]=_['intersection'](_0x5df975[_0x17b3('0x4e')],qs[_0x17b3('0x4f')](_0x46b43a[_0x17b3('0x4a')][_0x17b3('0x4f')]));_0x494e19[_0x17b3('0x4d')]=_0x494e19[_0x17b3('0x4d')][_0x17b3('0x50')]?_0x494e19[_0x17b3('0x4d')]:_0x5df975[_0x17b3('0x4e')];_0x494e19[_0x17b3('0x52')]=qs[_0x17b3('0x53')](_0x46b43a['query'][_0x17b3('0x53')]);_0x494e19[_0x17b3('0x54')]=qs[_0x17b3('0x55')](_['pick'](_0x46b43a[_0x17b3('0x4a')],_0x5df975[_0x17b3('0x55')]));if(_0x46b43a['query'][_0x17b3('0x57')]){_0x494e19[_0x17b3('0x54')]=_[_0x17b3('0x58')](_0x494e19['where'],{'$or':_[_0x17b3('0x46')](_0x494e19[_0x17b3('0x4d')],function(_0x263bf7){var _0x16fd05={};_0x16fd05[_0x263bf7]={'$like':'%'+_0x46b43a[_0x17b3('0x4a')][_0x17b3('0x57')]+'%'};return _0x16fd05;})});}_0x494e19=_['merge']({},_0x494e19,_0x46b43a[_0x17b3('0x6d')]);return _0x409949[_0x17b3('0xbe')](_0x494e19);}})[_0x17b3('0x12')](function(_0x5be79d){if(_0x5be79d){_0x1d56d9=_0x5be79d[_0x17b3('0x50')];if(!_0x46b43a[_0x17b3('0x4a')][_0x17b3('0x51')](_0x17b3('0x99'))){_0x494e19['limit']=qs[_0x17b3('0x23')](_0x46b43a[_0x17b3('0x4a')][_0x17b3('0x23')]);_0x494e19['offset']=qs[_0x17b3('0x20')](_0x46b43a[_0x17b3('0x4a')][_0x17b3('0x20')]);}return _0x409949[_0x17b3('0xbe')](_0x494e19);}})[_0x17b3('0x12')](function(_0x89127b){if(_0x89127b){return _0x89127b?{'count':_0x1d56d9,'rows':_0x89127b}:null;}})['then'](respondWithResult(_0x1492d0,null))[_0x17b3('0x1b')](handleError(_0x1492d0,null));}; \ No newline at end of file +var _0xe132=['set','json','then','destroy','get','MailAccounts','stack','name','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','user','password','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','MailAccount','include','findAll','rows','show','params','MailServerOut','update','body','provider','custom','find','Mail\x20Account\x20not\x20found','describe','MailAccountId','create','getDispositions','findOne','Disposition','order','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Owner','internal','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','User','moment','bluebird','util','path','lodash','juice','ioredis','api','../../config/environment','redis','defaults','localhost','register','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0xe132,0x167));var _0x2e13=function(_0x3ed741,_0x7aa5b){_0x3ed741=_0x3ed741-0x0;var _0x1144ab=_0xe132[_0x3ed741];return _0x1144ab;};'use strict';var moment=require(_0x2e13('0x0'));var BPromise=require(_0x2e13('0x1'));var util=require(_0x2e13('0x2'));var path=require(_0x2e13('0x3'));var _=require(_0x2e13('0x4'));var juice=require(_0x2e13('0x5'));var Redis=require(_0x2e13('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x2e13('0x7'));var config=require(_0x2e13('0x8'));var db=require('../../mysqldb')['db'];config[_0x2e13('0x9')]=_[_0x2e13('0xa')](config[_0x2e13('0x9')],{'host':_0x2e13('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e13('0x9')]));require('./mailAccount.socket')[_0x2e13('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2e13('0xd')][_0x2e13('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x26bf56,_0x5dd0d5,_0x386159,_0x3c8bc9){return new BPromise(function(_0x54596b,_0x1bd8cb){var _0x4f422f=_0x3c8bc9||client;return _0x4f422f[_0x2e13('0xf')](_0x26bf56,_0x386159)['then'](function(_0x318452){logger[_0x2e13('0x10')](_0x2e13('0x11'),_0x5dd0d5,_0x2e13('0x12'));logger[_0x2e13('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5dd0d5,_0x2e13('0x12'),JSON[_0x2e13('0x14')](_0x318452));if(_0x318452['error']){if(_0x318452[_0x2e13('0x15')][_0x2e13('0x16')]===0x1f4){logger['error'](_0x2e13('0x11'),_0x5dd0d5,_0x318452[_0x2e13('0x15')][_0x2e13('0x17')]);return _0x1bd8cb(_0x318452['error'][_0x2e13('0x17')]);}logger[_0x2e13('0x15')](_0x2e13('0x11'),_0x5dd0d5,_0x318452[_0x2e13('0x15')][_0x2e13('0x17')]);return _0x54596b(_0x318452[_0x2e13('0x15')]['message']);}else{logger[_0x2e13('0x10')](_0x2e13('0x11'),_0x5dd0d5,'request\x20sent');_0x54596b(_0x318452[_0x2e13('0x18')][_0x2e13('0x17')]);}})[_0x2e13('0x19')](function(_0x300192){logger[_0x2e13('0x15')](_0x2e13('0x11'),_0x5dd0d5,_0x300192);_0x1bd8cb(_0x300192);});});}function respondWithStatusCode(_0x38adbf,_0xe53f0d){_0xe53f0d=_0xe53f0d||0xcc;return function(_0xebbdfe){if(_0xebbdfe){return _0x38adbf[_0x2e13('0x1a')](_0xe53f0d);}return _0x38adbf[_0x2e13('0x1b')](_0xe53f0d)[_0x2e13('0x1c')]();};}function respondWithResult(_0x3c4482,_0x130b20){_0x130b20=_0x130b20||0xc8;return function(_0x3a2596){if(_0x3a2596){return _0x3c4482[_0x2e13('0x1b')](_0x130b20)['json'](_0x3a2596);}};}function respondWithFilteredResult(_0x4264c6,_0x5f5448){return function(_0x34e1ce){if(_0x34e1ce){var _0x213241=typeof _0x5f5448[_0x2e13('0x1d')]===_0x2e13('0x1e')&&typeof _0x5f5448['limit']==='undefined';var _0x5eac5b=_0x34e1ce[_0x2e13('0x1f')];var _0xa297df=_0x213241?0x0:_0x5f5448['offset'];var _0x2f0697=_0x213241?_0x34e1ce[_0x2e13('0x1f')]:_0x5f5448['offset']+_0x5f5448[_0x2e13('0x20')];var _0x247ee2;if(_0x2f0697>=_0x5eac5b){_0x2f0697=_0x5eac5b;_0x247ee2=0xc8;}else{_0x247ee2=0xce;}_0x4264c6[_0x2e13('0x1b')](_0x247ee2);return _0x4264c6[_0x2e13('0x21')]('Content-Range',_0xa297df+'-'+_0x2f0697+'/'+_0x5eac5b)[_0x2e13('0x22')](_0x34e1ce);}return null;};}function saveUpdates(_0x1f3d32){return function(_0x1ea08f){if(_0x1ea08f){return _0x1ea08f['update'](_0x1f3d32)[_0x2e13('0x23')](function(_0x42c0d3){return _0x42c0d3;});}return null;};}function removeEntity(_0x29e1ac){return function(_0x2022c3){if(_0x2022c3){return _0x2022c3[_0x2e13('0x24')]()[_0x2e13('0x23')](function(){var _0x3234bd=_0x2022c3[_0x2e13('0x25')]({'plain':!![]});var _0x5cb17c=_0x2e13('0x26');return db['UserProfileResource'][_0x2e13('0x24')]({'where':{'type':_0x5cb17c,'resourceId':_0x3234bd['id']}})[_0x2e13('0x23')](function(){return _0x2022c3;});})[_0x2e13('0x23')](function(){_0x29e1ac[_0x2e13('0x1b')](0xcc)[_0x2e13('0x1c')]();});}};}function handleEntityNotFound(_0x3846d8){return function(_0x1dc54e){if(!_0x1dc54e){_0x3846d8[_0x2e13('0x1a')](0x194);}return _0x1dc54e;};}function handleError(_0x2ba016,_0x5e6ac1){_0x5e6ac1=_0x5e6ac1||0x1f4;return function(_0x1e80cf){logger[_0x2e13('0x15')](_0x1e80cf[_0x2e13('0x27')]);if(_0x1e80cf[_0x2e13('0x28')]){delete _0x1e80cf[_0x2e13('0x28')];}_0x2ba016['status'](_0x5e6ac1)['send'](_0x1e80cf);};}function getImapHost(_0x5ecbf1){switch(_0x5ecbf1){case _0x2e13('0x29'):return _0x2e13('0x2a');case _0x2e13('0x2b'):return'imap.mail.yahoo.com';case _0x2e13('0x2c'):return _0x2e13('0x2d');case _0x2e13('0x2e'):return _0x2e13('0x2f');}throw new Error(_0x2e13('0x30'),_0x5ecbf1);}function getSmtpHost(_0x4a9125){switch(_0x4a9125){case'gmail':return _0x2e13('0x31');case'yahoo':return _0x2e13('0x32');case _0x2e13('0x2c'):return _0x2e13('0x33');case _0x2e13('0x2e'):return _0x2e13('0x34');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4a9125);}function getAuthenticationOptions(_0x3b2b24,_0x185b9c){var _0x52f261={};var _0x7129d0={};if(_0x3b2b24){_0x52f261['user']=_0x7129d0['user']=_0x185b9c['username'];_0x52f261['password']=_0x7129d0[_0x2e13('0x35')]=_0x185b9c['password'];if(_0x185b9c[_0x2e13('0x36')]){_0x52f261['modernAuthentication']=_0x7129d0[_0x2e13('0x36')]=!![];_0x52f261[_0x2e13('0x37')]=_0x7129d0[_0x2e13('0x37')]=_0x185b9c[_0x2e13('0x37')];_0x52f261['password']=_0x7129d0[_0x2e13('0x35')]=null;}else{_0x52f261[_0x2e13('0x37')]=_0x7129d0[_0x2e13('0x37')]=null;}_0x52f261['host']=getImapHost(_0x3b2b24);_0x52f261[_0x2e13('0x38')]=0x3e1;_0x7129d0[_0x2e13('0x39')]=getSmtpHost(_0x3b2b24);_0x7129d0[_0x2e13('0x38')]=0x24b;_0x7129d0[_0x2e13('0x3a')]=![];_0x52f261[_0x2e13('0x3b')]=_0x7129d0[_0x2e13('0x3b')]=null;}else{if(_0x185b9c[_0x2e13('0x3c')]){_0x52f261[_0x2e13('0x3d')]=_0x7129d0[_0x2e13('0x3d')]=_0x185b9c['username'];_0x52f261['password']=_0x7129d0[_0x2e13('0x35')]=_0x185b9c[_0x2e13('0x3e')];}else{_0x52f261[_0x2e13('0x3c')]=_0x7129d0['authentication']=![];_0x52f261['user']=_0x7129d0[_0x2e13('0x3d')]=null;_0x52f261['password']=_0x7129d0['pass']=null;}_0x52f261['host']=_0x185b9c[_0x2e13('0x3f')][_0x2e13('0x39')];_0x52f261['port']=_0x185b9c[_0x2e13('0x3f')][_0x2e13('0x38')];_0x7129d0[_0x2e13('0x39')]=_0x185b9c['Smtp'][_0x2e13('0x39')];_0x7129d0[_0x2e13('0x38')]=_0x185b9c[_0x2e13('0x40')][_0x2e13('0x38')];}return{'Imap':_0x52f261,'Smtp':_0x7129d0};}exports[_0x2e13('0x41')]=function(_0x556e41,_0x1e63a4){var _0x3b1fe4={'include':[{'model':db[_0x2e13('0x42')],'as':_0x2e13('0x3f')},{'model':db['MailServerOut'],'as':_0x2e13('0x40')},{'model':db[_0x2e13('0x43')],'as':_0x2e13('0x44')}]},_0x3a809f={},_0x53eeb6={'count':0x0,'rows':[]};var _0x4052bd=_['map'](db['MailAccount'][_0x2e13('0x45')],function(_0xd2f98a){return{'name':_0xd2f98a['fieldName'],'type':_0xd2f98a['type'][_0x2e13('0x46')]};});_0x3a809f[_0x2e13('0x47')]=_[_0x2e13('0x48')](_0x4052bd,_0x2e13('0x28'));_0x3a809f[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x556e41['query']);_0x3a809f[_0x2e13('0x4b')]=_[_0x2e13('0x4c')](_0x3a809f[_0x2e13('0x47')],_0x3a809f[_0x2e13('0x49')]);_0x3b1fe4[_0x2e13('0x4d')]=_['intersection'](_0x3a809f[_0x2e13('0x47')],qs[_0x2e13('0x4e')](_0x556e41[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x3b1fe4['attributes']=_0x3b1fe4['attributes'][_0x2e13('0x4f')]?_0x3b1fe4[_0x2e13('0x4d')]:_0x3a809f[_0x2e13('0x47')];if(!_0x556e41[_0x2e13('0x49')][_0x2e13('0x50')](_0x2e13('0x51'))){_0x3b1fe4[_0x2e13('0x20')]=qs[_0x2e13('0x20')](_0x556e41[_0x2e13('0x49')][_0x2e13('0x20')]);_0x3b1fe4[_0x2e13('0x1d')]=qs['offset'](_0x556e41[_0x2e13('0x49')][_0x2e13('0x1d')]);}_0x3b1fe4['order']=qs[_0x2e13('0x52')](_0x556e41[_0x2e13('0x49')][_0x2e13('0x52')]);_0x3b1fe4[_0x2e13('0x53')]=qs[_0x2e13('0x4b')](_[_0x2e13('0x54')](_0x556e41[_0x2e13('0x49')],_0x3a809f[_0x2e13('0x4b')]),_0x4052bd);if(_0x556e41[_0x2e13('0x49')]['filter']){_0x3b1fe4[_0x2e13('0x53')]=_['merge'](_0x3b1fe4[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0x4052bd,function(_0x444b73){if(_0x444b73[_0x2e13('0x55')]!==_0x2e13('0x56')){var _0x2919f6={};_0x2919f6[_0x444b73['name']]={'$like':'%'+_0x556e41[_0x2e13('0x49')][_0x2e13('0x57')]+'%'};return _0x2919f6;}})});}_0x3b1fe4=_[_0x2e13('0x58')]({},_0x3b1fe4,_0x556e41[_0x2e13('0x59')]);var _0x50215b={'where':_0x3b1fe4[_0x2e13('0x53')]};return db[_0x2e13('0x5a')][_0x2e13('0x1f')](_0x50215b)[_0x2e13('0x23')](function(_0x28ab3d){_0x53eeb6['count']=_0x28ab3d;if(_0x556e41[_0x2e13('0x49')]['includeAll']){_0x3b1fe4[_0x2e13('0x5b')]=[{'all':!![]}];}return db[_0x2e13('0x5a')][_0x2e13('0x5c')](_0x3b1fe4);})[_0x2e13('0x23')](function(_0x4c5266){_0x53eeb6[_0x2e13('0x5d')]=_0x4c5266;return _0x53eeb6;})[_0x2e13('0x23')](respondWithFilteredResult(_0x1e63a4,_0x3b1fe4))[_0x2e13('0x19')](handleError(_0x1e63a4,null));};exports[_0x2e13('0x5e')]=function(_0x2cf8fe,_0x1121ec){var _0x23e141={'raw':![],'where':{'id':_0x2cf8fe[_0x2e13('0x5f')]['id']},'include':[{'model':db[_0x2e13('0x42')],'as':_0x2e13('0x3f')},{'model':db[_0x2e13('0x60')],'as':'Smtp'},{'model':db[_0x2e13('0x43')],'as':_0x2e13('0x44')}]},_0x4bdb79={};_0x4bdb79[_0x2e13('0x47')]=_['keys'](db['MailAccount'][_0x2e13('0x45')]);_0x4bdb79[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x2cf8fe[_0x2e13('0x49')]);_0x4bdb79[_0x2e13('0x4b')]=_['intersection'](_0x4bdb79[_0x2e13('0x47')],_0x4bdb79['query']);_0x23e141[_0x2e13('0x4d')]=_['intersection'](_0x4bdb79['model'],qs['fields'](_0x2cf8fe['query'][_0x2e13('0x4e')]));_0x23e141[_0x2e13('0x4d')]=_0x23e141['attributes'][_0x2e13('0x4f')]?_0x23e141[_0x2e13('0x4d')]:_0x4bdb79[_0x2e13('0x47')];if(_0x2cf8fe['query']['includeAll']){_0x23e141[_0x2e13('0x5b')]=[{'all':!![]}];}_0x23e141=_[_0x2e13('0x58')]({},_0x23e141,_0x2cf8fe['options']);return db[_0x2e13('0x5a')]['find'](_0x23e141)[_0x2e13('0x23')](handleEntityNotFound(_0x1121ec,null))[_0x2e13('0x23')](respondWithResult(_0x1121ec,null))['catch'](handleError(_0x1121ec,null));};exports[_0x2e13('0x61')]=function(_0x36d68a,_0x31e4fb){if(_0x36d68a['body']['id']){delete _0x36d68a[_0x2e13('0x62')]['id'];}var _0xad873=_0x36d68a['body'][_0x2e13('0x63')]===_0x2e13('0x64')?null:_0x36d68a[_0x2e13('0x62')][_0x2e13('0x63')];var _0x20ecda=_0x36d68a[_0x2e13('0x62')]['Imap']||{};var _0x5d18b9=_0x36d68a[_0x2e13('0x62')][_0x2e13('0x40')]||{};if(_0xad873){_0x20ecda[_0x2e13('0x39')]=getImapHost(_0xad873);_0x20ecda['port']=0x3e1;_0x5d18b9[_0x2e13('0x39')]=getSmtpHost(_0xad873);_0x5d18b9[_0x2e13('0x38')]=0x24b;_0x5d18b9[_0x2e13('0x3a')]=![];}if(_0x5d18b9[_0x2e13('0x36')]){_0x5d18b9[_0x2e13('0x3a')]=![];}else{_0x5d18b9[_0x2e13('0x37')]=null;}if(!_0x20ecda[_0x2e13('0x36')])_0x20ecda[_0x2e13('0x37')]=null;_0x36d68a[_0x2e13('0x62')][_0x2e13('0x3f')]=_0x20ecda;_0x36d68a['body'][_0x2e13('0x40')]=_0x5d18b9;return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x36d68a[_0x2e13('0x5f')]['id']},'include':[{'model':db[_0x2e13('0x42')],'as':_0x2e13('0x3f')},{'model':db[_0x2e13('0x60')],'as':_0x2e13('0x40')},{'model':db[_0x2e13('0x43')],'as':'mandatoryDispositionPause'}]})[_0x2e13('0x23')](handleEntityNotFound(_0x31e4fb,null))[_0x2e13('0x23')](function(_0x383913){if(!_0x383913)throw new Error(_0x2e13('0x66'));if(_0x383913[_0x2e13('0x3b')])delete _0x36d68a[_0x2e13('0x62')][_0x2e13('0x3f')];return _0x383913;})['then'](saveUpdates(_0x36d68a[_0x2e13('0x62')],null))[_0x2e13('0x23')](function(_0x2f280b){if(!_0x36d68a[_0x2e13('0x62')][_0x2e13('0x3f')])return _0x2f280b;return db[_0x2e13('0x42')][_0x2e13('0x61')](_0x36d68a[_0x2e13('0x62')][_0x2e13('0x3f')],{'where':{'MailAccountId':_0x2f280b['id']}})[_0x2e13('0x23')](function(){return _0x2f280b;});})['then'](function(_0xbf4eb){if(!_0x36d68a[_0x2e13('0x62')]['Smtp'])return _0xbf4eb;return db[_0x2e13('0x60')]['update'](_0x36d68a[_0x2e13('0x62')][_0x2e13('0x40')],{'where':{'MailAccountId':_0xbf4eb['id']}})[_0x2e13('0x23')](function(){return _0xbf4eb;});})[_0x2e13('0x23')](respondWithResult(_0x31e4fb,null))[_0x2e13('0x19')](handleError(_0x31e4fb,null));};exports[_0x2e13('0x67')]=function(_0x17522b,_0x4d73c3){return db['MailAccount']['describe']()[_0x2e13('0x23')](respondWithResult(_0x4d73c3,null))[_0x2e13('0x19')](handleError(_0x4d73c3,null));};exports['addDisposition']=function(_0x1f9c68,_0x32e2cd){if(_0x1f9c68[_0x2e13('0x62')]['id']){delete _0x1f9c68[_0x2e13('0x62')]['id'];}return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x1f9c68['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x32e2cd,null))[_0x2e13('0x23')](function(_0x126dcc){if(_0x126dcc){_0x1f9c68[_0x2e13('0x62')][_0x2e13('0x68')]=_0x126dcc['id'];return db['Disposition'][_0x2e13('0x69')](_0x1f9c68[_0x2e13('0x62')]);}})[_0x2e13('0x23')](respondWithResult(_0x32e2cd,null))['catch'](handleError(_0x32e2cd,null));};exports[_0x2e13('0x6a')]=function(_0x3c421e,_0x3c3014){var _0x32a5b4={'raw':![],'where':{}};var _0x45500c={};var _0x99ea1d={'count':0x0,'rows':[]};return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x3c421e['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x3c3014,null))[_0x2e13('0x23')](function(_0x1c24c2){if(_0x1c24c2){_0x45500c[_0x2e13('0x47')]=_[_0x2e13('0x4a')](db[_0x2e13('0x6c')]['rawAttributes']);_0x45500c[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x3c421e[_0x2e13('0x49')]);_0x45500c[_0x2e13('0x4b')]=_[_0x2e13('0x4c')](_0x45500c['model'],_0x45500c['query']);_0x32a5b4[_0x2e13('0x4d')]=_[_0x2e13('0x4c')](_0x45500c[_0x2e13('0x47')],qs['fields'](_0x3c421e[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x32a5b4[_0x2e13('0x4d')]=_0x32a5b4[_0x2e13('0x4d')][_0x2e13('0x4f')]?_0x32a5b4[_0x2e13('0x4d')]:_0x45500c[_0x2e13('0x47')];if(!_0x3c421e[_0x2e13('0x49')][_0x2e13('0x50')](_0x2e13('0x51'))){_0x32a5b4['limit']=qs[_0x2e13('0x20')](_0x3c421e['query'][_0x2e13('0x20')]);_0x32a5b4[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x3c421e[_0x2e13('0x49')][_0x2e13('0x1d')]);}_0x32a5b4[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x3c421e[_0x2e13('0x49')][_0x2e13('0x52')]);_0x32a5b4[_0x2e13('0x53')]=qs[_0x2e13('0x4b')](_[_0x2e13('0x54')](_0x3c421e[_0x2e13('0x49')],_0x45500c[_0x2e13('0x4b')]));_0x32a5b4['where'][_0x2e13('0x68')]=_0x1c24c2['id'];if(_0x3c421e[_0x2e13('0x49')][_0x2e13('0x57')]){_0x32a5b4[_0x2e13('0x53')]=_[_0x2e13('0x58')](_0x32a5b4[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0x32a5b4['attributes'],function(_0x192b37){var _0x22e902={};_0x22e902[_0x192b37]={'$like':'%'+_0x3c421e[_0x2e13('0x49')][_0x2e13('0x57')]+'%'};return _0x22e902;})});}_0x32a5b4=_[_0x2e13('0x58')]({},_0x32a5b4,_0x3c421e[_0x2e13('0x59')]);return db['Disposition'][_0x2e13('0x1f')]({'where':_0x32a5b4[_0x2e13('0x53')]})[_0x2e13('0x23')](function(_0x516e47){_0x99ea1d[_0x2e13('0x1f')]=_0x516e47;if(_0x3c421e[_0x2e13('0x49')][_0x2e13('0x6e')]){_0x32a5b4[_0x2e13('0x5b')]=[{'all':!![]}];}return db[_0x2e13('0x6c')][_0x2e13('0x5c')](_0x32a5b4);})['then'](function(_0x4ca74f){_0x99ea1d[_0x2e13('0x5d')]=_0x4ca74f;return _0x99ea1d;});}})[_0x2e13('0x23')](respondWithFilteredResult(_0x3c3014,_0x32a5b4))[_0x2e13('0x19')](handleError(_0x3c3014,null));};exports['removeDispositions']=function(_0x36d6d0,_0x3fd59d){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x36d6d0[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x3fd59d,null))[_0x2e13('0x23')](function(_0x38d4ce){if(_0x38d4ce){return _0x38d4ce[_0x2e13('0x6f')](_0x36d6d0[_0x2e13('0x49')][_0x2e13('0x70')]);}})[_0x2e13('0x23')](respondWithStatusCode(_0x3fd59d,null))[_0x2e13('0x19')](handleError(_0x3fd59d,null));};exports['addAnswer']=function(_0x2db71c,_0x52e2d0){if(_0x2db71c['body']['id']){delete _0x2db71c[_0x2e13('0x62')]['id'];}return db[_0x2e13('0x5a')]['find']({'where':{'id':_0x2db71c[_0x2e13('0x5f')]['id']}})['then'](handleEntityNotFound(_0x52e2d0,null))[_0x2e13('0x23')](function(_0x36a5bc){if(_0x36a5bc){_0x2db71c['body'][_0x2e13('0x68')]=_0x36a5bc['id'];return db[_0x2e13('0x71')][_0x2e13('0x69')](_0x2db71c[_0x2e13('0x62')]);}})['then'](respondWithResult(_0x52e2d0,null))[_0x2e13('0x19')](handleError(_0x52e2d0,null));};exports[_0x2e13('0x72')]=function(_0x225cb3,_0x4474ba){var _0x55cf1d={'raw':![],'where':{}};var _0x3b3f91={};var _0x4c88c3={'count':0x0,'rows':[]};return db['MailAccount'][_0x2e13('0x6b')]({'where':{'id':_0x225cb3['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x4474ba,null))[_0x2e13('0x23')](function(_0x13b5f4){if(_0x13b5f4){_0x3b3f91[_0x2e13('0x47')]=_[_0x2e13('0x4a')](db[_0x2e13('0x71')][_0x2e13('0x45')]);_0x3b3f91['query']=_[_0x2e13('0x4a')](_0x225cb3[_0x2e13('0x49')]);_0x3b3f91['filters']=_[_0x2e13('0x4c')](_0x3b3f91[_0x2e13('0x47')],_0x3b3f91['query']);_0x55cf1d[_0x2e13('0x4d')]=_[_0x2e13('0x4c')](_0x3b3f91[_0x2e13('0x47')],qs[_0x2e13('0x4e')](_0x225cb3[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x55cf1d[_0x2e13('0x4d')]=_0x55cf1d['attributes']['length']?_0x55cf1d[_0x2e13('0x4d')]:_0x3b3f91[_0x2e13('0x47')];if(!_0x225cb3['query'][_0x2e13('0x50')](_0x2e13('0x51'))){_0x55cf1d[_0x2e13('0x20')]=qs['limit'](_0x225cb3[_0x2e13('0x49')][_0x2e13('0x20')]);_0x55cf1d[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x225cb3[_0x2e13('0x49')]['offset']);}_0x55cf1d[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x225cb3[_0x2e13('0x49')][_0x2e13('0x52')]);_0x55cf1d[_0x2e13('0x53')]=qs['filters'](_[_0x2e13('0x54')](_0x225cb3['query'],_0x3b3f91[_0x2e13('0x4b')]));_0x55cf1d[_0x2e13('0x53')]['MailAccountId']=_0x13b5f4['id'];if(_0x225cb3[_0x2e13('0x49')][_0x2e13('0x57')]){_0x55cf1d[_0x2e13('0x53')]=_[_0x2e13('0x58')](_0x55cf1d[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0x55cf1d[_0x2e13('0x4d')],function(_0x42ba79){var _0x25e3c1={};_0x25e3c1[_0x42ba79]={'$like':'%'+_0x225cb3['query']['filter']+'%'};return _0x25e3c1;})});}_0x55cf1d=_[_0x2e13('0x58')]({},_0x55cf1d,_0x225cb3['options']);return db['CannedAnswer']['count']({'where':_0x55cf1d[_0x2e13('0x53')]})[_0x2e13('0x23')](function(_0x29c399){_0x4c88c3['count']=_0x29c399;if(_0x225cb3['query'][_0x2e13('0x6e')]){_0x55cf1d[_0x2e13('0x5b')]=[{'all':!![]}];}return db[_0x2e13('0x71')][_0x2e13('0x5c')](_0x55cf1d);})[_0x2e13('0x23')](function(_0x5109b0){_0x4c88c3['rows']=_0x5109b0;return _0x4c88c3;});}})[_0x2e13('0x23')](respondWithFilteredResult(_0x4474ba,_0x55cf1d))[_0x2e13('0x19')](handleError(_0x4474ba,null));};exports[_0x2e13('0x73')]=function(_0x4b6ed1,_0x268619){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x4b6ed1[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x268619,null))[_0x2e13('0x23')](function(_0x119d94){if(_0x119d94){return _0x119d94[_0x2e13('0x73')](_0x4b6ed1['query'][_0x2e13('0x70')]);}})[_0x2e13('0x23')](respondWithStatusCode(_0x268619,null))[_0x2e13('0x19')](handleError(_0x268619,null));};exports[_0x2e13('0x69')]=function(_0xcb7c65,_0x2d1d20){var _0x37ee27={'name':_0xcb7c65[_0x2e13('0x62')]['name'],'key':_0xcb7c65[_0x2e13('0x62')][_0x2e13('0x46')],'provider':_0xcb7c65['body'][_0x2e13('0x63')]==='custom'?null:_0xcb7c65['body'][_0x2e13('0x63')],'email':_0xcb7c65[_0x2e13('0x62')][_0x2e13('0x74')],'ListId':_0xcb7c65[_0x2e13('0x62')][_0x2e13('0x75')],'active':!_[_0x2e13('0x76')](_0xcb7c65['body'][_0x2e13('0x77')])?_0xcb7c65[_0x2e13('0x62')][_0x2e13('0x77')]:!![],'description':_0xcb7c65[_0x2e13('0x62')]['description']||null};var _0x5c0096=getAuthenticationOptions(_0x37ee27[_0x2e13('0x63')],_0xcb7c65['body']);_0x37ee27[_0x2e13('0x3f')]=_0x5c0096[_0x2e13('0x3f')];_0x37ee27['Smtp']=_0x5c0096['Smtp'];return db[_0x2e13('0x5a')]['create'](_0x37ee27,{'include':[{'model':db[_0x2e13('0x60')],'as':_0x2e13('0x40')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x2e13('0x23')](function(_0x3b1c57){var _0x153557=_0xcb7c65['user'][_0x2e13('0x25')]({'plain':!![]});if(!_0x153557)throw new Error(_0x2e13('0x78'));if(_0x153557[_0x2e13('0x79')]==='user'){var _0x5b7099=_0x3b1c57[_0x2e13('0x25')]({'plain':!![]});return db[_0x2e13('0x7a')]['find']({'where':{'name':_0x2e13('0x26'),'userProfileId':_0x153557[_0x2e13('0x7b')]},'raw':!![]})[_0x2e13('0x23')](function(_0x26a229){if(_0x26a229&&_0x26a229[_0x2e13('0x7c')]===0x0){return db[_0x2e13('0x7d')]['create']({'name':_0x5b7099[_0x2e13('0x28')],'resourceId':_0x5b7099['id'],'type':_0x26a229[_0x2e13('0x28')],'sectionId':_0x26a229['id']},{})[_0x2e13('0x23')](function(){return _0x3b1c57;});}else{return _0x3b1c57;}})['catch'](function(_0x835023){logger[_0x2e13('0x15')](_0x2e13('0x7e'),_0x835023);throw _0x835023;});}return _0x3b1c57;})['then'](respondWithResult(_0x2d1d20,0xc9))['catch'](handleError(_0x2d1d20,null));};exports[_0x2e13('0x7f')]=function(_0x51acc9,_0x2eeb72){return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x51acc9[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x2eeb72,null))[_0x2e13('0x23')](function(_0x25fbff){if(_0x25fbff){return _0x25fbff[_0x2e13('0x7f')]();}return null;})[_0x2e13('0x23')](respondWithResult(_0x2eeb72,null))[_0x2e13('0x19')](handleError(_0x2eeb72,null));};exports[_0x2e13('0x80')]=function(_0x4223ab,_0x39e767){if(_0x4223ab[_0x2e13('0x62')]['id']){delete _0x4223ab['body']['id'];}return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x4223ab['params']['id']}})['then'](handleEntityNotFound(_0x39e767,null))['then'](function(_0x36138){if(_0x36138){_0x4223ab[_0x2e13('0x62')][_0x2e13('0x68')]=_0x36138['id'];return db[_0x2e13('0x42')][_0x2e13('0x69')](_0x4223ab[_0x2e13('0x62')]);}})[_0x2e13('0x23')](respondWithResult(_0x39e767,null))['catch'](handleError(_0x39e767,null));};exports[_0x2e13('0x81')]=function(_0xce8f7c,_0x185d6a){return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0xce8f7c['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x185d6a,null))['then'](function(_0x29aa83){if(_0x29aa83){return _0x29aa83[_0x2e13('0x82')](null);}return null;})[_0x2e13('0x23')](respondWithStatusCode(_0x185d6a,null))[_0x2e13('0x19')](handleError(_0x185d6a,null));};exports[_0x2e13('0x83')]=function(_0x11b464,_0x33c0b7){return db['MailAccount'][_0x2e13('0x6b')]({'where':{'id':_0x11b464[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x33c0b7,null))[_0x2e13('0x23')](function(_0x2a1eb1){if(_0x2a1eb1){return _0x2a1eb1[_0x2e13('0x83')]();}return null;})[_0x2e13('0x23')](respondWithResult(_0x33c0b7,null))['catch'](handleError(_0x33c0b7,null));};exports[_0x2e13('0x84')]=function(_0x29f108,_0x6d9ce6){if(_0x29f108[_0x2e13('0x62')]['id']){delete _0x29f108['body']['id'];}return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x29f108[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x6d9ce6,null))['then'](function(_0x143883){if(_0x143883){_0x29f108['body'][_0x2e13('0x68')]=_0x143883['id'];return db[_0x2e13('0x60')][_0x2e13('0x69')](_0x29f108[_0x2e13('0x62')]);}})['then'](respondWithResult(_0x6d9ce6,null))['catch'](handleError(_0x6d9ce6,null));};exports[_0x2e13('0x85')]=function(_0x266479,_0x4aa92a){return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x266479['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x4aa92a,null))[_0x2e13('0x23')](function(_0x1ddfbc){if(_0x1ddfbc){return _0x1ddfbc[_0x2e13('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x4aa92a,null))[_0x2e13('0x19')](handleError(_0x4aa92a,null));};exports[_0x2e13('0x87')]=function(_0x454660,_0x4d1510){return db[_0x2e13('0x88')][_0x2e13('0x65')]({'where':{'id':_0x454660[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x4d1510,null))[_0x2e13('0x23')](function(_0x6a5c1f){if(_0x6a5c1f){return _0x6a5c1f[_0x2e13('0x87')](_0x454660[_0x2e13('0x62')]['ids'],_[_0x2e13('0x89')](_0x454660[_0x2e13('0x62')],['ids','id'])||{});}})[_0x2e13('0x23')](respondWithResult(_0x4d1510,null))[_0x2e13('0x19')](handleError(_0x4d1510,null));};exports[_0x2e13('0x8a')]=function(_0x3df66f,_0x2bd70d){var _0x44cc79={'raw':![],'where':{}};var _0x1b0c87={};var _0x1dd0a7={'count':0x0,'rows':[]};return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x3df66f[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x2bd70d,null))[_0x2e13('0x23')](function(_0x12ecee){if(_0x12ecee){_0x1b0c87[_0x2e13('0x47')]=_[_0x2e13('0x4a')](db['MailInteraction'][_0x2e13('0x45')]);_0x1b0c87[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x3df66f[_0x2e13('0x49')]);_0x1b0c87['filters']=_[_0x2e13('0x4c')](_0x1b0c87[_0x2e13('0x47')],_0x1b0c87[_0x2e13('0x49')]);_0x44cc79[_0x2e13('0x4d')]=_['intersection'](_0x1b0c87['model'],qs[_0x2e13('0x4e')](_0x3df66f[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x44cc79[_0x2e13('0x4d')]=_0x44cc79['attributes'][_0x2e13('0x4f')]?_0x44cc79[_0x2e13('0x4d')]:_0x1b0c87[_0x2e13('0x47')];if(!_0x3df66f[_0x2e13('0x49')][_0x2e13('0x50')](_0x2e13('0x51'))){_0x44cc79['limit']=qs[_0x2e13('0x20')](_0x3df66f['query'][_0x2e13('0x20')]);_0x44cc79[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x3df66f[_0x2e13('0x49')]['offset']);}_0x44cc79[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x3df66f[_0x2e13('0x49')]['sort']);_0x44cc79['where']=qs['filters'](_[_0x2e13('0x54')](_0x3df66f[_0x2e13('0x49')],_0x1b0c87['filters']));_0x44cc79[_0x2e13('0x53')][_0x2e13('0x68')]=_0x12ecee['id'];if(_0x3df66f['query']['filter']){_0x44cc79[_0x2e13('0x53')]=_[_0x2e13('0x58')](_0x44cc79[_0x2e13('0x53')],{'$or':_['map'](_0x44cc79['attributes'],function(_0x4406d7){var _0x2fa40d={};_0x2fa40d[_0x4406d7]={'$like':'%'+_0x3df66f['query'][_0x2e13('0x57')]+'%'};return _0x2fa40d;})});}_0x44cc79=_[_0x2e13('0x58')]({},_0x44cc79,_0x3df66f[_0x2e13('0x59')]);return db['MailInteraction']['count']({'where':_0x44cc79[_0x2e13('0x53')]})[_0x2e13('0x23')](function(_0x108fac){_0x1dd0a7[_0x2e13('0x1f')]=_0x108fac;if(_0x3df66f[_0x2e13('0x49')][_0x2e13('0x6e')]){_0x44cc79[_0x2e13('0x5b')]=[{'model':db[_0x2e13('0x8b')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x2e13('0x8c'),'attributes':['name','fullname',_0x2e13('0x8d')],'required':![]},{'model':db['Tag'],'as':_0x2e13('0x8e'),'attributes':['id',_0x2e13('0x28'),_0x2e13('0x8f')],'where':_0x3df66f[_0x2e13('0x49')][_0x2e13('0x90')]?{'id':_0x3df66f['query'][_0x2e13('0x90')]}:undefined,'required':_0x3df66f['query']['tag']?!![]:![]}];}return db['MailInteraction'][_0x2e13('0x5c')](_0x44cc79);})[_0x2e13('0x23')](function(_0x5c48bb){_0x1dd0a7[_0x2e13('0x5d')]=_0x5c48bb;return _0x1dd0a7;});}})['then'](respondWithFilteredResult(_0x2bd70d,_0x44cc79))[_0x2e13('0x19')](handleError(_0x2bd70d,null));};exports[_0x2e13('0x91')]=function addApplications(_0xd9c023,_0x1b5c13){var _0x5b7511=_0xd9c023[_0x2e13('0x5f')]['id'];var _0x3a6281=_0xd9c023[_0x2e13('0x62')];var _0x3e3209=0xc8;var _0x2cfa35=null;return db['sequelize'][_0x2e13('0x92')]({'isolationLevel':db[_0x2e13('0x93')][_0x2e13('0x94')][_0x2e13('0x95')][_0x2e13('0x96')]},function(_0x1b9e05){return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x5b7511},'transaction':_0x1b9e05})[_0x2e13('0x23')](function(_0x578f82){if(_0x578f82){return db['MailApplication'][_0x2e13('0x24')]({'where':{'MailAccountId':_0x5b7511},'transaction':_0x1b9e05})[_0x2e13('0x23')](function(){var _0xaf826e=_[_0x2e13('0x48')](_0x3a6281,function(_0x45adb2){_0x45adb2[_0x2e13('0x68')]=_0x5b7511;return _0x45adb2;});return db[_0x2e13('0x97')][_0x2e13('0x98')](_0xaf826e,{'transaction':_0x1b9e05});});}else{_0x3e3209=0x194;_0x2cfa35=[];}});})['then'](function(){if(_0x3e3209!==0x194){return db['MailApplication'][_0x2e13('0x99')]({'where':{'MailAccountId':_0x5b7511},'order':_0x2e13('0x9a')})[_0x2e13('0x23')](function(_0x2dfbc0){_0x2cfa35=_0x2dfbc0;});}})[_0x2e13('0x19')](function(_0xab33f9){_0x3e3209=0x1f4;logger[_0x2e13('0x15')](_0xab33f9['stack']);if(_0xab33f9['name']){delete _0xab33f9[_0x2e13('0x28')];}_0x2cfa35=_0xab33f9;})[_0x2e13('0x9b')](function(){if(_0x2cfa35===null){_0x1b5c13[_0x2e13('0x1a')](_0x3e3209);}else{if(_0x3e3209===0x1f4){_0x1b5c13[_0x2e13('0x1b')](_0x3e3209)[_0x2e13('0x9c')](_0x2cfa35);}else{_0x1b5c13[_0x2e13('0x1b')](_0x3e3209)['json'](_0x2cfa35);}}});};exports[_0x2e13('0x9d')]=function(_0x11296f,_0x510a32){var _0x1a1b1a={};var _0xba8460={};var _0xe7dc52;var _0x170f35;return db[_0x2e13('0x5a')]['findOne']({'where':{'id':_0x11296f[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x510a32,null))[_0x2e13('0x23')](function(_0x48f3ec){if(_0x48f3ec){_0xe7dc52=_0x48f3ec;_0xba8460[_0x2e13('0x47')]=_[_0x2e13('0x4a')](db[_0x2e13('0x97')]['rawAttributes']);_0xba8460[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x11296f[_0x2e13('0x49')]);_0xba8460[_0x2e13('0x4b')]=_[_0x2e13('0x4c')](_0xba8460[_0x2e13('0x47')],_0xba8460[_0x2e13('0x49')]);_0x1a1b1a[_0x2e13('0x4d')]=_[_0x2e13('0x4c')](_0xba8460[_0x2e13('0x47')],qs[_0x2e13('0x4e')](_0x11296f[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x1a1b1a[_0x2e13('0x4d')]=_0x1a1b1a[_0x2e13('0x4d')][_0x2e13('0x4f')]?_0x1a1b1a[_0x2e13('0x4d')]:_0xba8460[_0x2e13('0x47')];_0x1a1b1a[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x11296f[_0x2e13('0x49')][_0x2e13('0x52')]);_0x1a1b1a[_0x2e13('0x53')]=qs['filters'](_['pick'](_0x11296f[_0x2e13('0x49')],_0xba8460['filters']));if(_0x11296f['query'][_0x2e13('0x57')]){_0x1a1b1a[_0x2e13('0x53')]=_['merge'](_0x1a1b1a['where'],{'$or':_[_0x2e13('0x48')](_0x1a1b1a[_0x2e13('0x4d')],function(_0xc2c17f){var _0x218c8c={};_0x218c8c[_0xc2c17f]={'$like':'%'+_0x11296f[_0x2e13('0x49')]['filter']+'%'};return _0x218c8c;})});}_0x1a1b1a=_[_0x2e13('0x58')]({},_0x1a1b1a,_0x11296f['options']);return _0xe7dc52[_0x2e13('0x9d')](_0x1a1b1a);}})[_0x2e13('0x23')](function(_0x52c18d){if(_0x52c18d){_0x170f35=_0x52c18d[_0x2e13('0x4f')];if(!_0x11296f[_0x2e13('0x49')][_0x2e13('0x50')](_0x2e13('0x51'))){_0x1a1b1a['limit']=qs[_0x2e13('0x20')](_0x11296f[_0x2e13('0x49')][_0x2e13('0x20')]);_0x1a1b1a[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x11296f['query']['offset']);}return _0xe7dc52[_0x2e13('0x9d')](_0x1a1b1a);}})['then'](function(_0x374fc7){if(_0x374fc7){return _0x374fc7?{'count':_0x170f35,'rows':_0x374fc7}:null;}})[_0x2e13('0x23')](respondWithResult(_0x510a32,null))['catch'](handleError(_0x510a32,null));};exports[_0x2e13('0x9e')]=function(_0x5bb1e2,_0x567af8){var _0x3dffdb={'raw':!![],'where':{}};var _0x5ee33a={};var _0x3ae822={'count':0x0,'rows':[]};return db['MailAccount'][_0x2e13('0x6b')]({'where':{'id':_0x5bb1e2[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x567af8,null))[_0x2e13('0x23')](function(_0x32ffa2){if(_0x32ffa2){_0x5ee33a['model']=_[_0x2e13('0x4a')](db['MailMessage'][_0x2e13('0x45')]);_0x5ee33a['query']=_[_0x2e13('0x4a')](_0x5bb1e2[_0x2e13('0x49')]);_0x5ee33a['filters']=_[_0x2e13('0x4c')](_0x5ee33a[_0x2e13('0x47')],_0x5ee33a['query']);_0x3dffdb[_0x2e13('0x4d')]=_[_0x2e13('0x4c')](_0x5ee33a[_0x2e13('0x47')],qs[_0x2e13('0x4e')](_0x5bb1e2[_0x2e13('0x49')]['fields']));_0x3dffdb[_0x2e13('0x4d')]=_0x3dffdb[_0x2e13('0x4d')][_0x2e13('0x4f')]?_0x3dffdb[_0x2e13('0x4d')]:_0x5ee33a[_0x2e13('0x47')];if(!_0x5bb1e2[_0x2e13('0x49')][_0x2e13('0x50')]('nolimit')){_0x3dffdb[_0x2e13('0x20')]=qs['limit'](_0x5bb1e2[_0x2e13('0x49')][_0x2e13('0x20')]);_0x3dffdb['offset']=qs[_0x2e13('0x1d')](_0x5bb1e2['query'][_0x2e13('0x1d')]);}_0x3dffdb[_0x2e13('0x6d')]=qs['sort'](_0x5bb1e2['query'][_0x2e13('0x52')]);_0x3dffdb[_0x2e13('0x53')]=qs[_0x2e13('0x4b')](_['pick'](_0x5bb1e2[_0x2e13('0x49')],_0x5ee33a['filters']));_0x3dffdb[_0x2e13('0x53')][_0x2e13('0x68')]=_0x32ffa2['id'];if(_0x5bb1e2['query'][_0x2e13('0x57')]){_0x3dffdb['where']=_[_0x2e13('0x58')](_0x3dffdb[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0x3dffdb[_0x2e13('0x4d')],function(_0x549640){var _0x1fcbe2={};_0x1fcbe2[_0x549640]={'$like':'%'+_0x5bb1e2[_0x2e13('0x49')]['filter']+'%'};return _0x1fcbe2;})});}if(_0x5bb1e2[_0x2e13('0x49')][_0x2e13('0x9f')]){var _0x2e1404=_0x5bb1e2[_0x2e13('0x49')]['$gte'][_0x2e13('0xa0')](',');var _0x3badf5={};_0x3badf5[_0x2e1404[0x0]]={'$gte':moment(_0x2e1404[0x1])[_0x2e13('0xa1')](_0x2e13('0xa2'))};_0x3dffdb[_0x2e13('0x53')]=_['merge'](_0x3dffdb[_0x2e13('0x53')],_0x3badf5);}_0x3dffdb=_[_0x2e13('0x58')]({},_0x3dffdb,_0x5bb1e2[_0x2e13('0x59')]);return db[_0x2e13('0xa3')][_0x2e13('0x1f')]({'where':_0x3dffdb[_0x2e13('0x53')]})[_0x2e13('0x23')](function(_0x186cbb){_0x3ae822[_0x2e13('0x1f')]=_0x186cbb;if(_0x5bb1e2[_0x2e13('0x49')][_0x2e13('0x6e')]){_0x3dffdb[_0x2e13('0x5b')]=[{'all':!![]}];}return db['MailMessage'][_0x2e13('0x5c')](_0x3dffdb);})['then'](function(_0x1b60ec){if(_0x5bb1e2[_0x2e13('0x49')]['inlineCss']===_0x2e13('0xa4')){for(var _0x3ae08a=0x0;_0x3ae08a<_0x1b60ec[_0x2e13('0x4f')];_0x3ae08a++){_0x1b60ec[_0x3ae08a][_0x2e13('0x62')]=juice(_0x1b60ec[_0x3ae08a]['body']);}}_0x3ae822[_0x2e13('0x5d')]=_0x1b60ec;return _0x3ae822;});}})['then'](respondWithFilteredResult(_0x567af8,_0x3dffdb))[_0x2e13('0x19')](handleError(_0x567af8,null));};exports[_0x2e13('0x9c')]=function(_0x5a40f0,_0x144338){var _0x3b5a1d,_0x9aee4={},_0x419ad4;if(_0x5a40f0[_0x2e13('0x62')]['to']){_0x419ad4=_0x5a40f0['body']['to'][_0x2e13('0xa0')](',')[0x0];}return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x5a40f0[_0x2e13('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x2e13('0xa5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x419ad4},'limit':0x1,'order':[[_0x2e13('0xa6'),_0x2e13('0xa7')]]}]},{'model':db[_0x2e13('0x60')],'as':_0x2e13('0x40'),'raw':!![],'include':[{'model':db[_0x2e13('0xa8')],'as':_0x2e13('0xa8'),'raw':!![]}]}]})[_0x2e13('0x23')](handleEntityNotFound(_0x144338,null))['then'](function(_0x4794cf){if(!_0x4794cf)return;_0x3b5a1d=_0x4794cf;if(!_0x4794cf['Smtp'])throw new Error(_0x2e13('0xa9'));if(_[_0x2e13('0x76')](_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xaa')])){_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xaa')]=util['format']('%s\x20<%s>',_0x4794cf[_0x2e13('0x28')],_0x4794cf[_0x2e13('0x74')]||_0x4794cf[_0x2e13('0x40')][_0x2e13('0x3d')]);}if(_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xab')]&&_0x5a40f0['body'][_0x2e13('0xab')][_0x2e13('0x4f')]){for(var _0x18310f=0x0;_0x18310f<_0x5a40f0['body'][_0x2e13('0xab')]['length'];_0x18310f+=0x1){_0x5a40f0['body'][_0x2e13('0xab')][_0x18310f]={'filename':_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xab')][_0x18310f][_0x2e13('0x28')],'path':path[_0x2e13('0xac')](config[_0x2e13('0xad')],_0x2e13('0xae'),_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xab')][_0x18310f][_0x2e13('0xaf')])};}}var _0x4d4454=_0x4794cf[_0x2e13('0xb0')]();return respondWithRpcPromise(_0x2e13('0xb1'),'sendMail',{'account':_0x4d4454,'message':_0x5a40f0[_0x2e13('0x62')]});})['then'](function(_0xe742e5){if(!_0xe742e5)return;_0x9aee4=_0xe742e5;if(!_0x3b5a1d[_0x2e13('0xa5')])throw new Error('List\x20not\x20found');if(_0x3b5a1d[_0x2e13('0xa5')][_0x2e13('0xb2')][_0x2e13('0x4f')])return _0x3b5a1d[_0x2e13('0xa5')]['Contacts'][0x0];return db[_0x2e13('0x8b')]['create'](_[_0x2e13('0xa')](_0x5a40f0['body'],{'firstName':_0x5a40f0[_0x2e13('0x62')]['to'],'email':_0x5a40f0['body']['to'],'phone':_0x5a40f0[_0x2e13('0x62')]['to'],'ListId':_0x3b5a1d[_0x2e13('0x75')]}));})['then'](function(_0x37fee3){if(!_0x37fee3)return;var _0x274eb1={'UserId':_0x5a40f0[_0x2e13('0x3d')]['id'],'ContactId':_0x37fee3['id'],'MailAccountId':_0x3b5a1d['id'],'inReplyTo':_0x9aee4[_0x2e13('0xb3')],'to':_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xaa')],'cc':_0x5a40f0[_0x2e13('0x62')]['cc'],'subject':_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xb4')],'attach':_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xb5')],'firstMsgDirection':_0x2e13('0xb6'),'lastMsgAt':moment()[_0x2e13('0xa1')](_0x2e13('0xa2')),'lastMsgDirection':_0x2e13('0xb6'),'Messages':[_[_0x2e13('0x58')](_0x5a40f0[_0x2e13('0x62')],{'messageId':_0x9aee4['messageId'],'sentAt':moment()[_0x2e13('0xa1')](_0x2e13('0xa2')),'read':!![],'MailAccountId':_0x3b5a1d['id'],'UserId':_0x5a40f0[_0x2e13('0x3d')]['id'],'ContactId':_0x37fee3['id']})]};if(_0x5a40f0['body'][_0x2e13('0xb7')]){_0x274eb1=_[_0x2e13('0x58')](_0x274eb1,_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xb7')]);}return db[_0x2e13('0x88')][_0x2e13('0x69')](_0x274eb1,{'include':[{'model':db['MailMessage'],'as':_0x2e13('0xb8')}]});})[_0x2e13('0x23')](respondWithResult(_0x144338,null))[_0x2e13('0x19')](handleError(_0x144338,null));};exports[_0x2e13('0xb9')]=function(_0x47be9b,_0x4f4db4){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x47be9b[_0x2e13('0x5f')]['id']},'include':[{'model':db[_0x2e13('0x60')],'as':_0x2e13('0x40'),'raw':!![],'include':[{'model':db[_0x2e13('0xa8')],'as':_0x2e13('0xa8'),'raw':!![]}]}]})[_0x2e13('0x23')](handleEntityNotFound(_0x4f4db4,null))[_0x2e13('0x23')](function(_0x584daf){if(!_0x584daf[_0x2e13('0x40')])return;var _0x10136a=_0x584daf['getSmtpOptions']();return respondWithRpcPromise(_0x2e13('0xba'),_0x2e13('0xb9'),{'account':_0x10136a});})[_0x2e13('0x23')](respondWithResult(_0x4f4db4,null))[_0x2e13('0x19')](handleError(_0x4f4db4,null));};exports[_0x2e13('0x24')]=function(_0x3f1aec,_0x49d8bb){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x3f1aec['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x49d8bb,null))[_0x2e13('0x23')](function(_0x1433ad){if(_0x1433ad&&_0x1433ad[_0x2e13('0x3b')]){throw new db[(_0x2e13('0xbb'))][(_0x2e13('0xbc'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1433ad;})['then'](removeEntity(_0x49d8bb,null))[_0x2e13('0x19')](handleError(_0x49d8bb,null));};exports['addAgents']=function(_0x80cc25,_0x536c61){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x80cc25[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x536c61,null))[_0x2e13('0x23')](function(_0x27cadd){if(_0x27cadd){return _0x27cadd[_0x2e13('0xbd')](_0x80cc25[_0x2e13('0x62')][_0x2e13('0x70')],_[_0x2e13('0x89')](_0x80cc25[_0x2e13('0x62')],[_0x2e13('0x70'),'id'])||{})[_0x2e13('0xbe')](function(_0x106761){for(var _0x305adc=0x0;_0x305adc<_0x80cc25[_0x2e13('0x62')][_0x2e13('0x70')]['length'];_0x305adc+=0x1){socket[_0x2e13('0xbf')]('userMailAccount:save',{'UserId':Number(_0x80cc25[_0x2e13('0x62')][_0x2e13('0x70')][_0x305adc]),'MailAccountId':Number(_0x80cc25[_0x2e13('0x5f')]['id'])});}return _0x106761;});}})[_0x2e13('0x23')](respondWithResult(_0x536c61,null))[_0x2e13('0x19')](handleError(_0x536c61,null));};exports['removeAgents']=function(_0x24a13f,_0x7bf4e6){return db[_0x2e13('0x5a')]['find']({'where':{'id':_0x24a13f[_0x2e13('0x5f')]['id']}})['then'](handleEntityNotFound(_0x7bf4e6,null))[_0x2e13('0x23')](function(_0x2fab51){if(_0x2fab51){return _0x2fab51[_0x2e13('0xc0')](_0x24a13f[_0x2e13('0x49')][_0x2e13('0x70')])['then'](function(){if(_[_0x2e13('0xc1')](_0x24a13f[_0x2e13('0x49')][_0x2e13('0x70')])){for(var _0xdfbb75=0x0;_0xdfbb75<_0x24a13f['query'][_0x2e13('0x70')]['length'];_0xdfbb75+=0x1){socket[_0x2e13('0xbf')](_0x2e13('0xc2'),{'UserId':Number(_0x24a13f[_0x2e13('0x49')][_0x2e13('0x70')][_0xdfbb75]),'MailAccountId':Number(_0x24a13f[_0x2e13('0x5f')]['id'])});}}else{socket[_0x2e13('0xbf')](_0x2e13('0xc2'),{'UserId':Number(_0x24a13f[_0x2e13('0x49')][_0x2e13('0x70')]),'MailAccountId':Number(_0x24a13f[_0x2e13('0x5f')]['id'])});}});}})[_0x2e13('0x23')](respondWithStatusCode(_0x7bf4e6,null))['catch'](handleError(_0x7bf4e6,null));};exports['getAgents']=function(_0x111ecd,_0x5694ba){var _0xfdf287={};var _0x54f099={};var _0x1d4eb0;var _0x3c4a2b;return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x111ecd['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x5694ba,null))[_0x2e13('0x23')](function(_0x19bb7c){if(_0x19bb7c){_0x1d4eb0=_0x19bb7c;_0x54f099['model']=_[_0x2e13('0x4a')](db[_0x2e13('0xc3')][_0x2e13('0x45')]);_0x54f099['query']=_[_0x2e13('0x4a')](_0x111ecd[_0x2e13('0x49')]);_0x54f099[_0x2e13('0x4b')]=_[_0x2e13('0x4c')](_0x54f099[_0x2e13('0x47')],_0x54f099['query']);_0xfdf287[_0x2e13('0x4d')]=_['intersection'](_0x54f099[_0x2e13('0x47')],qs['fields'](_0x111ecd[_0x2e13('0x49')]['fields']));_0xfdf287[_0x2e13('0x4d')]=_0xfdf287[_0x2e13('0x4d')]['length']?_0xfdf287[_0x2e13('0x4d')]:_0x54f099['model'];_0xfdf287[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x111ecd[_0x2e13('0x49')][_0x2e13('0x52')]);_0xfdf287[_0x2e13('0x53')]=qs[_0x2e13('0x4b')](_[_0x2e13('0x54')](_0x111ecd[_0x2e13('0x49')],_0x54f099['filters']));if(_0x111ecd[_0x2e13('0x49')]['filter']){_0xfdf287[_0x2e13('0x53')]=_[_0x2e13('0x58')](_0xfdf287[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0xfdf287[_0x2e13('0x4d')],function(_0xd00cc){var _0x57a625={};_0x57a625[_0xd00cc]={'$like':'%'+_0x111ecd[_0x2e13('0x49')][_0x2e13('0x57')]+'%'};return _0x57a625;})});}_0xfdf287=_[_0x2e13('0x58')]({},_0xfdf287,_0x111ecd['options']);return _0x1d4eb0['getAgents'](_0xfdf287);}})[_0x2e13('0x23')](function(_0xafd8e1){if(_0xafd8e1){_0x3c4a2b=_0xafd8e1[_0x2e13('0x4f')];if(!_0x111ecd[_0x2e13('0x49')][_0x2e13('0x50')]('nolimit')){_0xfdf287[_0x2e13('0x20')]=qs[_0x2e13('0x20')](_0x111ecd['query'][_0x2e13('0x20')]);_0xfdf287[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x111ecd[_0x2e13('0x49')]['offset']);}return _0x1d4eb0['getAgents'](_0xfdf287);}})['then'](function(_0x14bd82){if(_0x14bd82){return _0x14bd82?{'count':_0x3c4a2b,'rows':_0x14bd82}:null;}})[_0x2e13('0x23')](respondWithResult(_0x5694ba,null))['catch'](handleError(_0x5694ba,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 56caf01..4f622e6 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 _0x6c14=['../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3a7f63,_0x2d59c5){var _0xff1a38=function(_0x1f02cd){while(--_0x1f02cd){_0x3a7f63['push'](_0x3a7f63['shift']());}};_0xff1a38(++_0x2d59c5);}(_0x6c14,0xd1));var _0x46c1=function(_0x3f9b23,_0x785ca6){_0x3f9b23=_0x3f9b23-0x0;var _0x55dc12=_0x6c14[_0x3f9b23];return _0x55dc12;};'use strict';var EventEmitter=require(_0x46c1('0x0'));var MailAccount=require(_0x46c1('0x1'))['db'][_0x46c1('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x46c1('0x3')](0x0);var events={'afterCreate':_0x46c1('0x4'),'afterUpdate':'update','afterDestroy':_0x46c1('0x5')};function emitEvent(_0x1aa112){return function(_0x311234,_0x5b4a69,_0x2a884e){MailAccountEvents[_0x46c1('0x6')](_0x1aa112+':'+_0x311234['id'],_0x311234);MailAccountEvents[_0x46c1('0x6')](_0x1aa112,_0x311234);_0x2a884e(null);};}for(var e in events){if(events[_0x46c1('0x7')](e)){var event=events[e];MailAccount[_0x46c1('0x8')](e,emitEvent(event));}}module[_0x46c1('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xa647=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x42dc81,_0x2a960a){var _0x5349a4=function(_0xb566e1){while(--_0xb566e1){_0x42dc81['push'](_0x42dc81['shift']());}};_0x5349a4(++_0x2a960a);}(_0xa647,0x81));var _0x7a64=function(_0xa2320e,_0x4b5dc1){_0xa2320e=_0xa2320e-0x0;var _0x25f019=_0xa647[_0xa2320e];return _0x25f019;};'use strict';var EventEmitter=require(_0x7a64('0x0'));var MailAccount=require(_0x7a64('0x1'))['db'][_0x7a64('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7a64('0x3')](0x0);var events={'afterCreate':_0x7a64('0x4'),'afterUpdate':_0x7a64('0x5'),'afterDestroy':_0x7a64('0x6')};function emitEvent(_0x30b8b7){return function(_0x1c7a04,_0x2e1029,_0x46b8b0){MailAccountEvents[_0x7a64('0x7')](_0x30b8b7+':'+_0x1c7a04['id'],_0x1c7a04);MailAccountEvents['emit'](_0x30b8b7,_0x1c7a04);_0x46b8b0(null);};}for(var e in events){if(events[_0x7a64('0x8')](e)){var event=events[e];MailAccount[_0x7a64('0x9')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 14968a4..a6f39ed 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 _0x8892=['host','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','./mailAccount.attributes','exports','define','MailAccount','provider','custom'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x8892,0xf9));var _0x2889=function(_0x284af1,_0x36829c){_0x284af1=_0x284af1-0x0;var _0x5daa4c=_0x8892[_0x284af1];return _0x5daa4c;};'use strict';var attributes=require(_0x2889('0x0'));module[_0x2889('0x1')]=function(_0xd62aee){return _0xd62aee[_0x2889('0x2')](_0x2889('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x39ab44=this;var _0x108809={'id':_0x39ab44['id'],'tls':{'rejectUnauthorized':![]}};if(_0x39ab44[_0x2889('0x4')]!==_0x2889('0x5')){_0x108809['service']=_0x39ab44[_0x2889('0x4')];}else{_0x108809[_0x2889('0x6')]=_0x39ab44[_0x2889('0x7')][_0x2889('0x6')];_0x108809[_0x2889('0x8')]=_0x39ab44[_0x2889('0x7')]['port'];_0x108809[_0x2889('0x9')]=_0x39ab44[_0x2889('0x7')]['secure'];}if(_0x39ab44[_0x2889('0x7')][_0x2889('0xa')]){if(_0x39ab44[_0x2889('0x7')][_0x2889('0xb')]){if(!_0x39ab44[_0x2889('0x7')]['CloudProvider'])throw new Error(_0x2889('0xc'));_0x108809['auth']={'type':_0x2889('0xd'),'user':_0x39ab44[_0x2889('0x7')][_0x2889('0xe')],'accessToken':_0x39ab44['Smtp']['CloudProvider'][_0x2889('0xf')]};}else{_0x108809[_0x2889('0x10')]={'user':_0x39ab44[_0x2889('0x7')][_0x2889('0xe')],'pass':_0x39ab44['Smtp']['pass']};}}return _0x108809;}}});}; \ No newline at end of file +var _0x3c82=['host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','service'];(function(_0x62c0c2,_0x1fa155){var _0x4ffe7a=function(_0x3bee66){while(--_0x3bee66){_0x62c0c2['push'](_0x62c0c2['shift']());}};_0x4ffe7a(++_0x1fa155);}(_0x3c82,0x175));var _0x23c8=function(_0x321ce2,_0x5354ff){_0x321ce2=_0x321ce2-0x0;var _0x4dff12=_0x3c82[_0x321ce2];return _0x4dff12;};'use strict';var attributes=require(_0x23c8('0x0'));module[_0x23c8('0x1')]=function(_0x405909){return _0x405909[_0x23c8('0x2')](_0x23c8('0x3'),attributes,{'tableName':_0x23c8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x20dba7=this;var _0x316727={'id':_0x20dba7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x20dba7[_0x23c8('0x5')]!=='custom'){_0x316727[_0x23c8('0x6')]=_0x20dba7[_0x23c8('0x5')];}else{_0x316727[_0x23c8('0x7')]=_0x20dba7['Smtp']['host'];_0x316727[_0x23c8('0x8')]=_0x20dba7[_0x23c8('0x9')][_0x23c8('0x8')];_0x316727[_0x23c8('0xa')]=_0x20dba7[_0x23c8('0x9')][_0x23c8('0xa')];}if(_0x20dba7[_0x23c8('0x9')][_0x23c8('0xb')]){if(_0x20dba7[_0x23c8('0x9')][_0x23c8('0xc')]){if(!_0x20dba7[_0x23c8('0x9')][_0x23c8('0xd')])throw new Error(_0x23c8('0xe'));_0x316727['auth']={'type':_0x23c8('0xf'),'user':_0x20dba7[_0x23c8('0x9')][_0x23c8('0x10')],'accessToken':_0x20dba7['Smtp']['CloudProvider'][_0x23c8('0x11')]};}else{_0x316727[_0x23c8('0x12')]={'user':_0x20dba7[_0x23c8('0x9')][_0x23c8('0x10')],'pass':_0x20dba7['Smtp'][_0x23c8('0x13')]};}}return _0x316727;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 41a39fb..3c046c5 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 _0xc2c7=['defaults','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','raw','options','where','attributes','include','map','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','updatedAt','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','account','CmList','List','DESC','MailApplication','Smtp','CloudProvider','get','omit','Applications','applications','orderBy','asc','autoclose','push','close','Contacts','length','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','Attachment','Attachments','User','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x5693a8,_0x28ed77){var _0x34162c=function(_0x344aed){while(--_0x344aed){_0x5693a8['push'](_0x5693a8['shift']());}};_0x34162c(++_0x28ed77);}(_0xc2c7,0x134));var _0x7c2c=function(_0x417e5f,_0x404120){_0x417e5f=_0x417e5f-0x0;var _0x3a02f9=_0xc2c7[_0x417e5f];return _0x3a02f9;};'use strict';var _=require('lodash');var moment=require(_0x7c2c('0x0'));var BPromise=require(_0x7c2c('0x1'));var rs=require(_0x7c2c('0x2'));var Redis=require(_0x7c2c('0x3'));var db=require(_0x7c2c('0x4'))['db'];var logger=require(_0x7c2c('0x5'))(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c2c('0x8')]({'port':0x232c});config[_0x7c2c('0x9')]=_[_0x7c2c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c2c('0x9')]));require(_0x7c2c('0xb'))[_0x7c2c('0xc')](socket);function respondWithRpcPromise(_0x3b780b,_0x279cff,_0x57b107){return new BPromise(function(_0x3093d2,_0x307bec){return client[_0x7c2c('0xd')](_0x3b780b,_0x57b107)[_0x7c2c('0xe')](function(_0x2587ec){logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x279cff,_0x7c2c('0x11'));logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x279cff,_0x7c2c('0x11'),JSON[_0x7c2c('0x14')](_0x2587ec));if(_0x2587ec[_0x7c2c('0x15')]){if(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x16')]===0x1f4){logger[_0x7c2c('0x15')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x2587ec['error'][_0x7c2c('0x17')]);return _0x307bec(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x17')]);}logger['error'](_0x7c2c('0x10'),_0x279cff,_0x2587ec[_0x7c2c('0x15')]['message']);return _0x3093d2(_0x2587ec[_0x7c2c('0x15')]['message']);}else{logger[_0x7c2c('0xf')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x7c2c('0x11'));_0x3093d2(_0x2587ec[_0x7c2c('0x18')][_0x7c2c('0x17')]);}})[_0x7c2c('0x19')](function(_0x17df4a){logger[_0x7c2c('0x15')](_0x7c2c('0x10'),_0x279cff,_0x17df4a);_0x307bec(_0x17df4a);});});}exports[_0x7c2c('0x1a')]=function(_0x2d356e){var _0x39c5f3=this;return new Promise(function(_0x40eaef,_0x2381b4){return db['MailAccount'][_0x7c2c('0x1b')]({'raw':_0x2d356e['options']?_0x2d356e['options'][_0x7c2c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1e')]||null:null,'attributes':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'limit':_0x2d356e['options']?_0x2d356e[_0x7c2c('0x1d')]['limit']||null:null,'include':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x2d356e[_0x7c2c('0x1d')]['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x22')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1f')],'include':_0x4d6ec7[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x4d6ec7[_0x7c2c('0x20')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x22')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes'],'include':_0xa8e145[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0xa8e145[_0x7c2c('0x20')],function(_0x22d03f){return{'model':db[_0x22d03f[_0x7c2c('0x22')]],'as':_0x22d03f['as'],'attributes':_0x22d03f[_0x7c2c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0x26f472){logger[_0x7c2c('0xf')]('GetMailAccount',_0x2d356e);logger[_0x7c2c('0x12')](_0x7c2c('0x1a'),_0x2d356e,JSON[_0x7c2c('0x14')](_0x26f472));_0x40eaef(_0x26f472);})[_0x7c2c('0x19')](function(_0x53ad23){logger[_0x7c2c('0x15')](_0x7c2c('0x1a'),_0x53ad23[_0x7c2c('0x17')],_0x2d356e);_0x2381b4(_0x39c5f3[_0x7c2c('0x15')](0x1f4,_0x53ad23[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x23')]=function(_0x463ef7){var _0x57af44=this;return new Promise(function(_0x1969f4,_0x1acf75){return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'raw':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['raw']===undefined?!![]:![]:!![],'where':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['where']||null:null,'attributes':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'include':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x20')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x22')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1f')],'include':_0x204968[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x204968[_0x7c2c('0x20')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x22')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1f')],'include':_0x3230a1['include']?_['map'](_0x3230a1[_0x7c2c('0x20')],function(_0x4acc5d){return{'model':db[_0x4acc5d['model']],'as':_0x4acc5d['as'],'attributes':_0x4acc5d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0xc77f11){if(_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x26')]===!![])_0xc77f11[_0x7c2c('0x27')](_0x7c2c('0x28'),_0xc77f11[_0x7c2c('0x29')]());logger[_0x7c2c('0xf')](_0x7c2c('0x23'),_0x463ef7);logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x463ef7,JSON['stringify'](_0xc77f11));_0x1969f4(_0xc77f11);})['catch'](function(_0x3920b6){logger[_0x7c2c('0x15')](_0x7c2c('0x23'),_0x3920b6[_0x7c2c('0x17')],_0x463ef7);_0x1acf75(_0x57af44['error'](0x1f4,_0x3920b6[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x2a')]=function(_0x93e2a8){var _0x45fddf=this;return new Promise(function(_0x18e288,_0x8b0dc9){var _0x12c9cd={'body':_0x93e2a8[_0x7c2c('0x2b')],'channel':_0x7c2c('0x2c')};var _0x4e1f79=_[_0x7c2c('0x2d')](_['keys'](db[_0x7c2c('0x2e')][_0x7c2c('0x2f')]),['createdAt',_0x7c2c('0x30'),'CompanyId',_0x7c2c('0x31')]);var _0x33b2be=![];if(_0x93e2a8[_0x7c2c('0x2b')]['id']){delete _0x93e2a8[_0x7c2c('0x2b')]['id'];}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')]['from'])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x32')));}if(_[_0x7c2c('0x33')](_0x93e2a8[_0x7c2c('0x2b')]['body'])||_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x2b')]===''){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x34')));}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}if(!_[_0x7c2c('0x36')](_0x4e1f79,_0x93e2a8[_0x7c2c('0x2b')]['mapKey'])){return _0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}var _0x51e3b7={};_0x51e3b7[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'where':{'id':_0x93e2a8[_0x7c2c('0x38')]['id']},'include':[{'model':db[_0x7c2c('0x39')],'as':_0x7c2c('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x51e3b7,'limit':0x1,'order':[[_0x7c2c('0x30'),_0x7c2c('0x3b')]]}]},{'model':db[_0x7c2c('0x3c')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x7c2c('0x3d'),'include':[{'model':db[_0x7c2c('0x3e')],'as':_0x7c2c('0x3e')}]}]})[_0x7c2c('0xe')](function(_0x5f3de8){if(_0x5f3de8&&_0x5f3de8['List']){var _0x587667=_0x5f3de8[_0x7c2c('0x3f')]({'plain':!![]});_0x12c9cd[_0x7c2c('0x38')]=_[_0x7c2c('0x40')](_0x587667,[_0x7c2c('0x41'),_0x7c2c('0x3a')]);_0x12c9cd['account'][_0x7c2c('0x28')]=_0x5f3de8[_0x7c2c('0x29')]();_0x12c9cd['applications']=_0x587667[_0x7c2c('0x41')];_0x12c9cd['list']=_0x587667[_0x7c2c('0x3a')];_0x12c9cd[_0x7c2c('0x42')]=_[_0x7c2c('0x43')](_0x12c9cd['applications'],['priority'],[_0x7c2c('0x44')]);if(_0x12c9cd['account']&&_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x45')]){_0x12c9cd['applications'][_0x7c2c('0x46')]({'id':0x0,'priority':_0x12c9cd[_0x7c2c('0x42')]['length']+0x1,'app':_0x7c2c('0x47'),'appdata':_0x7c2c('0x45'),'interval':'*,*,*,*'});}if(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x41')]){delete _0x12c9cd[_0x7c2c('0x38')]['Applications'];}if(_0x12c9cd[_0x7c2c('0x38')]['List']){delete _0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x3a')];}if(_0x587667['List'][_0x7c2c('0x48')][_0x7c2c('0x49')]){return _0x587667[_0x7c2c('0x3a')][_0x7c2c('0x48')][0x0];}var _0x481b9e=_[_0x7c2c('0xa')](_0x93e2a8[_0x7c2c('0x2b')],{'firstName':_0x93e2a8['body'][_0x7c2c('0x37')],'ListId':_0x587667['ListId']});_0x481b9e[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x2e')]['create'](_0x481b9e);}else{throw new Error(_0x7c2c('0x4a'));}})[_0x7c2c('0xe')](function(_0x4c4661){_0x12c9cd['contact']=_0x4c4661;if(_0x4c4661){if(!_0x93e2a8['body'][_0x7c2c('0x17')]['messageId']){_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x4b')]=rs[_0x7c2c('0x4c')]()+'\x20'+_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x37')];}var _0x1ee34d={'ContactId':_0x4c4661['id'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'inReplyTo':_0x93e2a8[_0x7c2c('0x2b')]['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8[_0x7c2c('0x2b')]['message']['attach'],'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x7c2c('0x25')]({'where':{'closed':![],'MailAccountId':_0x93e2a8['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x7c2c('0x50'),'attributes':[_0x7c2c('0x4b')],'where':{'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x51')]}}]})[_0x7c2c('0xe')](function(_0x2d4459){if(_0x2d4459){return[_0x2d4459,![]];}return db[_0x7c2c('0x52')][_0x7c2c('0x53')](_0x1ee34d)[_0x7c2c('0xe')](function(_0xd01d59){return[_0xd01d59,!![]];});});}else{throw new Error(_0x7c2c('0x54'));}})[_0x7c2c('0x55')](function(_0x3d44f8,_0x559005){if(_0x3d44f8){_0x33b2be=_0x559005;if(!_0x559005){return _0x3d44f8[_0x7c2c('0x56')]({'inReplyTo':_0x93e2a8['body']['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['subject'],'attach':_0x3d44f8[_0x7c2c('0x57')]?_0x3d44f8[_0x7c2c('0x57')]:_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x57')],'substatus':null,'substatusAt':moment()[_0x7c2c('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'});}else{return _0x3d44f8;}}})['then'](function(_0x39d319){_0x12c9cd[_0x7c2c('0x58')]=_0x39d319['get']({'plain':!![]});_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x59')]=_0x33b2be;return db['MailMessage']['create']({'body':_0x93e2a8[_0x7c2c('0x2b')]['body'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'MailInteractionId':_0x39d319['id'],'direction':'in','ContactId':_0x12c9cd['contact']['id'],'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['messageId'],'from':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x37')],'to':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['to'],'cc':_0x93e2a8['body'][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x57')],'Attachments':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5a')],'originTo':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5b')],'originCc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5c')],'bcc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5d')],'ChatWebsiteId':_0x93e2a8['body']['message'][_0x7c2c('0x5e')]||null,'originChannel':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['originChannel']||_0x7c2c('0x5f'),'ChatOfflineMessageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x7c2c('0x60')],'as':_0x7c2c('0x61')}]});})[_0x7c2c('0xe')](function(_0x8f8b42){_0x12c9cd['message']=_0x8f8b42;if(_0x12c9cd[_0x7c2c('0x58')]['UserId']){return db[_0x7c2c('0x62')]['find']({'attributes':['id',_0x7c2c('0x63')],'where':{'id':_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x64')]}})[_0x7c2c('0xe')](function(_0x43eb9d){if(_0x43eb9d){_0x12c9cd[_0x7c2c('0x42')][_0x7c2c('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x43eb9d[_0x7c2c('0x63')]+','+(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x66')]||0xa),'interval':_0x7c2c('0x67')});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);})['then'](function(_0x2d75b8){_0x18e288(_0x2d75b8);})[_0x7c2c('0x19')](function(_0x2391a7){_0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,_0x2391a7[_0x7c2c('0x17')]));});});}; \ No newline at end of file +var _0x1a85=['getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','Contacts','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','Contact\x20not\x20found','update','attach','interaction','get','created','attachments','originCc','bcc','ChatWebsiteId','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','startRouting','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailAccount','findAll','options','where','attributes','map','include','model','GetMailAccount','ShowMailAccount','find','raw'];(function(_0x215e71,_0x317b13){var _0x3d8aae=function(_0x2573aa){while(--_0x2573aa){_0x215e71['push'](_0x215e71['shift']());}};_0x3d8aae(++_0x317b13);}(_0x1a85,0x178));var _0x51a8=function(_0x722103,_0x5732f3){_0x722103=_0x722103-0x0;var _0x3e2435=_0x1a85[_0x722103];return _0x3e2435;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x51a8('0x0'));var rs=require(_0x51a8('0x1'));var Redis=require(_0x51a8('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x51a8('0x3'));var config=require(_0x51a8('0x4'));var jayson=require(_0x51a8('0x5'));var client=jayson['client'][_0x51a8('0x6')]({'port':0x232c});config['redis']=_[_0x51a8('0x7')](config['redis'],{'host':_0x51a8('0x8'),'port':0x18eb});var socket=require(_0x51a8('0x9'))(new Redis(config['redis']));require(_0x51a8('0xa'))['register'](socket);function respondWithRpcPromise(_0x56e1b4,_0x39e06a,_0x2f276b){return new BPromise(function(_0x1a476d,_0x45a3f4){return client[_0x51a8('0xb')](_0x56e1b4,_0x2f276b)[_0x51a8('0xc')](function(_0x3f93c7){logger[_0x51a8('0xd')](_0x51a8('0xe'),_0x39e06a,_0x51a8('0xf'));logger[_0x51a8('0x10')](_0x51a8('0x11'),_0x39e06a,_0x51a8('0xf'),JSON[_0x51a8('0x12')](_0x3f93c7));if(_0x3f93c7[_0x51a8('0x13')]){if(_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x14')]===0x1f4){logger['error'](_0x51a8('0xe'),_0x39e06a,_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x15')]);return _0x45a3f4(_0x3f93c7['error'][_0x51a8('0x15')]);}logger['error'](_0x51a8('0xe'),_0x39e06a,_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x15')]);return _0x1a476d(_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x15')]);}else{logger[_0x51a8('0xd')](_0x51a8('0xe'),_0x39e06a,'request\x20sent');_0x1a476d(_0x3f93c7[_0x51a8('0x16')][_0x51a8('0x15')]);}})[_0x51a8('0x17')](function(_0x23539e){logger[_0x51a8('0x13')](_0x51a8('0xe'),_0x39e06a,_0x23539e);_0x45a3f4(_0x23539e);});});}exports['GetMailAccount']=function(_0x1df8c2){var _0x3b7e7e=this;return new Promise(function(_0x2217ce,_0x2f2681){return db[_0x51a8('0x18')][_0x51a8('0x19')]({'raw':_0x1df8c2[_0x51a8('0x1a')]?_0x1df8c2[_0x51a8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1df8c2[_0x51a8('0x1a')]?_0x1df8c2['options'][_0x51a8('0x1b')]||null:null,'attributes':_0x1df8c2[_0x51a8('0x1a')]?_0x1df8c2[_0x51a8('0x1a')][_0x51a8('0x1c')]||null:null,'limit':_0x1df8c2['options']?_0x1df8c2[_0x51a8('0x1a')]['limit']||null:null,'include':_0x1df8c2['options']?_0x1df8c2[_0x51a8('0x1a')]['include']?_[_0x51a8('0x1d')](_0x1df8c2[_0x51a8('0x1a')][_0x51a8('0x1e')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1f')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1f')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')],'include':_0x273ce2[_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x273ce2[_0x51a8('0x1e')],function(_0x1a886f){return{'model':db[_0x1a886f[_0x51a8('0x1f')]],'as':_0x1a886f['as'],'attributes':_0x1a886f[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0xc')](function(_0x20c6b5){logger[_0x51a8('0xd')]('GetMailAccount',_0x1df8c2);logger[_0x51a8('0x10')]('GetMailAccount',_0x1df8c2,JSON[_0x51a8('0x12')](_0x20c6b5));_0x2217ce(_0x20c6b5);})[_0x51a8('0x17')](function(_0x143f46){logger[_0x51a8('0x13')](_0x51a8('0x20'),_0x143f46['message'],_0x1df8c2);_0x2f2681(_0x3b7e7e[_0x51a8('0x13')](0x1f4,_0x143f46['message']));});});};exports[_0x51a8('0x21')]=function(_0x24b39a){var _0x253a59=this;return new Promise(function(_0x4b19c8,_0x2080a1){return db['MailAccount'][_0x51a8('0x22')]({'raw':_0x24b39a[_0x51a8('0x1a')]?_0x24b39a[_0x51a8('0x1a')][_0x51a8('0x23')]===undefined?!![]:![]:!![],'where':_0x24b39a[_0x51a8('0x1a')]?_0x24b39a['options'][_0x51a8('0x1b')]||null:null,'attributes':_0x24b39a['options']?_0x24b39a[_0x51a8('0x1a')][_0x51a8('0x1c')]||null:null,'include':_0x24b39a[_0x51a8('0x1a')]?_0x24b39a['options'][_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x24b39a[_0x51a8('0x1a')][_0x51a8('0x1e')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1d')](_0x41c020[_0x51a8('0x1e')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1f')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes'],'include':_0x4ec1db[_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x4ec1db[_0x51a8('0x1e')],function(_0x1eef9d){return{'model':db[_0x1eef9d[_0x51a8('0x1f')]],'as':_0x1eef9d['as'],'attributes':_0x1eef9d[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e5566){if(_0x24b39a[_0x51a8('0x1a')]['smtp']===!![])_0x4e5566['setDataValue']('smtpOptions',_0x4e5566[_0x51a8('0x24')]());logger[_0x51a8('0xd')](_0x51a8('0x21'),_0x24b39a);logger['debug'](_0x51a8('0x21'),_0x24b39a,JSON[_0x51a8('0x12')](_0x4e5566));_0x4b19c8(_0x4e5566);})[_0x51a8('0x17')](function(_0x310ad2){logger['error'](_0x51a8('0x21'),_0x310ad2[_0x51a8('0x15')],_0x24b39a);_0x2080a1(_0x253a59[_0x51a8('0x13')](0x1f4,_0x310ad2['message']));});});};exports[_0x51a8('0x25')]=function(_0x51d7bd){var _0x2032c0=this;return new Promise(function(_0x1e637a,_0x2a98bd){var _0x37d50b={'body':_0x51d7bd['body'],'channel':_0x51a8('0x26')};var _0x3da2cf=_[_0x51a8('0x27')](_[_0x51a8('0x28')](db[_0x51a8('0x29')][_0x51a8('0x2a')]),[_0x51a8('0x2b'),_0x51a8('0x2c'),_0x51a8('0x2d'),'ListId']);var _0x22e6e6=![];if(_0x51d7bd[_0x51a8('0x2e')]['id']){delete _0x51d7bd['body']['id'];}if(_['isNil'](_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2f')])){return _0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,_0x51a8('0x30')));}if(_[_0x51a8('0x31')](_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2e')])||_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2e')]===''){return _0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x51a8('0x31')](_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x32')])){return _0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,_0x51a8('0x33')+_0x3da2cf));}if(!_[_0x51a8('0x34')](_0x3da2cf,_0x51d7bd['body'][_0x51a8('0x32')])){return _0x2a98bd(_0x2032c0['error'](0x1f4,_0x51a8('0x35')+_0x3da2cf));}var _0x3a33f3={};_0x3a33f3[_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x32')]]=_0x51d7bd[_0x51a8('0x2e')]['from'];return db['MailAccount'][_0x51a8('0x22')]({'where':{'id':_0x51d7bd[_0x51a8('0x36')]['id']},'include':[{'model':db[_0x51a8('0x37')],'as':_0x51a8('0x38'),'include':[{'model':db[_0x51a8('0x29')],'as':'Contacts','where':_0x3a33f3,'limit':0x1,'order':[['updatedAt',_0x51a8('0x39')]]}]},{'model':db[_0x51a8('0x3a')],'as':_0x51a8('0x3b')},{'model':db[_0x51a8('0x3c')],'as':_0x51a8('0x3d'),'include':[{'model':db[_0x51a8('0x3e')],'as':_0x51a8('0x3e')}]}]})[_0x51a8('0xc')](function(_0x301578){if(_0x301578&&_0x301578['List']){var _0x5cb2cf=_0x301578['get']({'plain':!![]});_0x37d50b[_0x51a8('0x36')]=_[_0x51a8('0x3f')](_0x5cb2cf,[_0x51a8('0x3b'),'List']);_0x37d50b[_0x51a8('0x36')][_0x51a8('0x40')]=_0x301578['getSmtpOptions']();_0x37d50b[_0x51a8('0x41')]=_0x5cb2cf['Applications'];_0x37d50b['list']=_0x5cb2cf[_0x51a8('0x38')];_0x37d50b[_0x51a8('0x41')]=_[_0x51a8('0x42')](_0x37d50b['applications'],['priority'],[_0x51a8('0x43')]);if(_0x37d50b['account']&&_0x37d50b[_0x51a8('0x36')][_0x51a8('0x44')]){_0x37d50b[_0x51a8('0x41')][_0x51a8('0x45')]({'id':0x0,'priority':_0x37d50b[_0x51a8('0x41')][_0x51a8('0x46')]+0x1,'app':_0x51a8('0x47'),'appdata':_0x51a8('0x44'),'interval':_0x51a8('0x48')});}if(_0x37d50b['account'][_0x51a8('0x3b')]){delete _0x37d50b[_0x51a8('0x36')][_0x51a8('0x3b')];}if(_0x37d50b[_0x51a8('0x36')]['List']){delete _0x37d50b[_0x51a8('0x36')]['List'];}if(_0x5cb2cf[_0x51a8('0x38')][_0x51a8('0x49')]['length']){return _0x5cb2cf['List'][_0x51a8('0x49')][0x0];}var _0x16f124=_[_0x51a8('0x7')](_0x51d7bd[_0x51a8('0x2e')],{'firstName':_0x51d7bd[_0x51a8('0x2e')]['from'],'ListId':_0x5cb2cf[_0x51a8('0x4a')]});_0x16f124[_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x32')]]=_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2f')];return db['CmContact'][_0x51a8('0x4b')](_0x16f124);}else{throw new Error(_0x51a8('0x4c'));}})[_0x51a8('0xc')](function(_0x3e43cc){_0x37d50b[_0x51a8('0x4d')]=_0x3e43cc;if(_0x3e43cc){if(!_0x51d7bd[_0x51a8('0x2e')]['message']['messageId']){_0x51d7bd['body']['message'][_0x51a8('0x4e')]=rs[_0x51a8('0x4f')]()+'\x20'+_0x51d7bd['body'][_0x51a8('0x15')]['from'];}var _0x41cc00={'ContactId':_0x3e43cc['id'],'MailAccountId':_0x51d7bd['account']['id'],'inReplyTo':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['messageId'],'to':_0x51d7bd['body']['message'][_0x51a8('0x2f')],'cc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['cc'],'subject':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x50')],'attach':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['attach'],'lastMsgAt':moment()[_0x51a8('0x51')](_0x51a8('0x52')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x51a8('0x22')]({'where':{'closed':![],'MailAccountId':_0x51d7bd[_0x51a8('0x36')]['id']},'include':[{'model':db[_0x51a8('0x53')],'as':_0x51a8('0x54'),'attributes':[_0x51a8('0x4e')],'where':{'messageId':_0x51d7bd[_0x51a8('0x2e')]['message']['inReplyTo']}}]})[_0x51a8('0xc')](function(_0x53f25e){if(_0x53f25e){return[_0x53f25e,![]];}return db['MailInteraction']['create'](_0x41cc00)['then'](function(_0x483a5a){return[_0x483a5a,!![]];});});}else{throw new Error(_0x51a8('0x55'));}})['spread'](function(_0x1477af,_0x4772cd){if(_0x1477af){_0x22e6e6=_0x4772cd;if(!_0x4772cd){return _0x1477af[_0x51a8('0x56')]({'inReplyTo':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x4e')],'to':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x2f')],'cc':_0x51d7bd[_0x51a8('0x2e')]['message']['cc'],'subject':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x50')],'attach':_0x1477af['attach']?_0x1477af['attach']:_0x51d7bd['body'][_0x51a8('0x15')][_0x51a8('0x57')],'substatus':null,'substatusAt':moment()[_0x51a8('0x51')](_0x51a8('0x52')),'lastMsgAt':moment()[_0x51a8('0x51')](_0x51a8('0x52')),'lastMsgDirection':'in'});}else{return _0x1477af;}}})[_0x51a8('0xc')](function(_0x418445){_0x37d50b[_0x51a8('0x58')]=_0x418445[_0x51a8('0x59')]({'plain':!![]});_0x37d50b[_0x51a8('0x58')][_0x51a8('0x5a')]=_0x22e6e6;return db[_0x51a8('0x53')]['create']({'body':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2e')],'MailAccountId':_0x51d7bd['account']['id'],'MailInteractionId':_0x418445['id'],'direction':'in','ContactId':_0x37d50b[_0x51a8('0x4d')]['id'],'messageId':_0x51d7bd['body']['message']['messageId'],'from':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x2f')],'to':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['to'],'cc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['cc'],'subject':_0x51d7bd['body']['message']['subject'],'attach':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x57')],'Attachments':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5b')],'originTo':_0x51d7bd['body'][_0x51a8('0x15')]['originTo'],'originCc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5c')],'bcc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5d')],'ChatWebsiteId':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5e')]||null,'originChannel':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['originChannel']||'Email','ChatOfflineMessageId':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5f')]||null},{'include':[{'model':db[_0x51a8('0x60')],'as':'Attachments'}]});})[_0x51a8('0xc')](function(_0x4d418a){_0x37d50b[_0x51a8('0x15')]=_0x4d418a;if(_0x37d50b[_0x51a8('0x58')][_0x51a8('0x61')]){return db[_0x51a8('0x62')][_0x51a8('0x22')]({'attributes':['id',_0x51a8('0x63')],'where':{'id':_0x37d50b[_0x51a8('0x58')][_0x51a8('0x61')]}})[_0x51a8('0xc')](function(_0x53fc80){if(_0x53fc80){_0x37d50b[_0x51a8('0x41')][_0x51a8('0x64')]({'id':0x0,'priority':0x0,'app':_0x51a8('0x65'),'appdata':_0x53fc80[_0x51a8('0x63')]+','+(_0x37d50b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x51a8('0x48')});}return respondWithRpcPromise('Start','startRouting',_0x37d50b);});}return respondWithRpcPromise('Start',_0x51a8('0x66'),_0x37d50b);})['then'](function(_0x5c7aca){_0x1e637a(_0x5c7aca);})[_0x51a8('0x17')](function(_0x23f82a){_0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,_0x23f82a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f8e000e..b63ba72 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 _0x3bf3=['save','remove','update','emit','register','mailAccount:'];(function(_0x1c31a9,_0x35c105){var _0x14187a=function(_0x481c81){while(--_0x481c81){_0x1c31a9['push'](_0x1c31a9['shift']());}};_0x14187a(++_0x35c105);}(_0x3bf3,0x168));var _0x33bf=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x3bf3[_0xdd2bfa];return _0x55397e;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x33bf('0x0'),_0x33bf('0x1'),_0x33bf('0x2')];function createListener(_0x50281,_0x279da7){return function(_0x2702f7){_0x279da7[_0x33bf('0x3')](_0x50281,_0x2702f7);};}function removeListener(_0x105ef2,_0x10502b){return function(){MailAccountEvents['removeListener'](_0x105ef2,_0x10502b);};}exports[_0x33bf('0x4')]=function(_0x5e456e){for(var _0x278bcc=0x0,_0x1d4fc4=events['length'];_0x278bcc<_0x1d4fc4;_0x278bcc++){var _0x54d2e5=events[_0x278bcc];var _0x86a69f=createListener(_0x33bf('0x5')+_0x54d2e5,_0x5e456e);MailAccountEvents['on'](_0x54d2e5,_0x86a69f);}}; \ No newline at end of file +var _0x9089=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x19f270,_0x8d9162){var _0x4a6130=function(_0x41d1a8){while(--_0x41d1a8){_0x19f270['push'](_0x19f270['shift']());}};_0x4a6130(++_0x8d9162);}(_0x9089,0xf6));var _0x9908=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x9089[_0x22bdd3];return _0x44d9d9;};'use strict';var MailAccountEvents=require(_0x9908('0x0'));var events=[_0x9908('0x1'),'remove',_0x9908('0x2')];function createListener(_0x5f0406,_0x4cbe52){return function(_0x11a266){_0x4cbe52[_0x9908('0x3')](_0x5f0406,_0x11a266);};}function removeListener(_0x13d80a,_0xfb5138){return function(){MailAccountEvents[_0x9908('0x4')](_0x13d80a,_0xfb5138);};}exports[_0x9908('0x5')]=function(_0x4a139c){for(var _0x36c8b4=0x0,_0x2bd694=events[_0x9908('0x6')];_0x36c8b4<_0x2bd694;_0x36c8b4++){var _0x523fae=events[_0x36c8b4];var _0x491630=createListener(_0x9908('0x7')+_0x523fae,_0x4a139c);MailAccountEvents['on'](_0x523fae,_0x491630);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5a9fb42..5480751 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 _0xbcd3=['connect-timeout','express','Router','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','path'];(function(_0x4e3a6f,_0x10ac32){var _0x14c3e1=function(_0x35b7ed){while(--_0x35b7ed){_0x4e3a6f['push'](_0x4e3a6f['shift']());}};_0x14c3e1(++_0x10ac32);}(_0xbcd3,0x1d2));var _0x3bcd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbcd3[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x3bcd('0x0'));var util=require('util');var path=require(_0x3bcd('0x1'));var timeout=require(_0x3bcd('0x2'));var express=require(_0x3bcd('0x3'));var router=express[_0x3bcd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0x3bcd('0x5'),auth[_0x3bcd('0x6')](),controller[_0x3bcd('0x7')]);router[_0x3bcd('0x8')]('/:id',auth[_0x3bcd('0x6')](),controller['update']);router[_0x3bcd('0x9')](_0x3bcd('0x5'),auth['isAuthenticated'](),controller[_0x3bcd('0xa')]);module[_0x3bcd('0xb')]=router; \ No newline at end of file +var _0x7fdf=['multer','util','path','connect-timeout','express','Router','fs-extra','./mailApplication.controller','get','/:id','isAuthenticated','show','put','destroy','exports'];(function(_0x3a8cee,_0x2a3454){var _0x2ef4e3=function(_0x51798f){while(--_0x51798f){_0x3a8cee['push'](_0x3a8cee['shift']());}};_0x2ef4e3(++_0x2a3454);}(_0x7fdf,0x10e));var _0xf7fd=function(_0x54deb9,_0x53e74b){_0x54deb9=_0x54deb9-0x0;var _0x5da9aa=_0x7fdf[_0x54deb9];return _0x5da9aa;};'use strict';var multer=require(_0xf7fd('0x0'));var util=require(_0xf7fd('0x1'));var path=require(_0xf7fd('0x2'));var timeout=require(_0xf7fd('0x3'));var express=require(_0xf7fd('0x4'));var router=express[_0xf7fd('0x5')]();var fs_extra=require(_0xf7fd('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf7fd('0x7'));router[_0xf7fd('0x8')](_0xf7fd('0x9'),auth[_0xf7fd('0xa')](),controller[_0xf7fd('0xb')]);router[_0xf7fd('0xc')](_0xf7fd('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf7fd('0x9'),auth[_0xf7fd('0xa')](),controller[_0xf7fd('0xd')]);module[_0xf7fd('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 67eaa72..934fd5c 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 _0x7f8d=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0xcf098d,_0x1b9e69){var _0x99daff=function(_0x3aedcc){while(--_0x3aedcc){_0xcf098d['push'](_0xcf098d['shift']());}};_0x99daff(++_0x1b9e69);}(_0x7f8d,0x17d));var _0xd7f8=function(_0x162c52,_0x5d77fb){_0x162c52=_0x162c52-0x0;var _0x16c3b8=_0x7f8d[_0x162c52];return _0x16c3b8;};'use strict';var Sequelize=require(_0xd7f8('0x0'));module[_0xd7f8('0x1')]={'priority':{'type':Sequelize[_0xd7f8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd7f8('0x3')],'allowNull':![],'defaultValue':_0xd7f8('0x4')},'appdata':{'type':Sequelize[_0xd7f8('0x5')]()},'description':{'type':Sequelize[_0xd7f8('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x18c8=['STRING','sequelize','exports','INTEGER'];(function(_0xe684c3,_0x454e64){var _0x3c14dd=function(_0x5da48b){while(--_0x5da48b){_0xe684c3['push'](_0xe684c3['shift']());}};_0x3c14dd(++_0x454e64);}(_0x18c8,0x129));var _0x818c=function(_0x372ab6,_0x1b9e57){_0x372ab6=_0x372ab6-0x0;var _0x14b88f=_0x18c8[_0x372ab6];return _0x14b88f;};'use strict';var Sequelize=require(_0x818c('0x0'));module[_0x818c('0x1')]={'priority':{'type':Sequelize[_0x818c('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x818c('0x3')]},'interval':{'type':Sequelize[_0x818c('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5bd4b3d..f0cba96 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x46a0cb,_0x30a26a){var _0x4729a1=function(_0x269531){while(--_0x269531){_0x46a0cb['push'](_0x46a0cb['shift']());}};_0x4729a1(++_0x30a26a);}(_0xda3f,0xec));var _0xfda3=function(_0x1ced83,_0x58d6ed){_0x1ced83=_0x1ced83-0x0;var _0x44393b=_0xda3f[_0x1ced83];return _0x44393b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x3af21a,_0x41400d){var _0x31334b=function(_0x53b37a){while(--_0x53b37a){_0x3af21a['push'](_0x3af21a['shift']());}};_0x31334b(++_0x41400d);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 20d874e..707d4de 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 _0xabb3=['bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x4f5f4f,_0x165370){var _0x18fd34=function(_0x55a8b3){while(--_0x55a8b3){_0x4f5f4f['push'](_0x4f5f4f['shift']());}};_0x18fd34(++_0x165370);}(_0xabb3,0xb0));var _0x3abb=function(_0x585b87,_0x2e59e2){_0x585b87=_0x585b87-0x0;var _0x4c3107=_0xabb3[_0x585b87];return _0x4c3107;};'use strict';var _=require(_0x3abb('0x0'));var util=require(_0x3abb('0x1'));var logger=require(_0x3abb('0x2'))(_0x3abb('0x3'));var moment=require('moment');var BPromise=require(_0x3abb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3abb('0x5'));var rimraf=require(_0x3abb('0x6'));var config=require(_0x3abb('0x7'));var attributes=require(_0x3abb('0x8'));module[_0x3abb('0x9')]=function(_0x43b418,_0x2bf6c9){return _0x43b418[_0x3abb('0xa')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3abb('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1832=['path','rimraf','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x42ad3e,_0x3d9d3d){var _0x49a20e=function(_0x5324b6){while(--_0x5324b6){_0x42ad3e['push'](_0x42ad3e['shift']());}};_0x49a20e(++_0x3d9d3d);}(_0x1832,0x125));var _0x2183=function(_0x3c64e3,_0xa3c98){_0x3c64e3=_0x3c64e3-0x0;var _0x3e7e20=_0x1832[_0x3c64e3];return _0x3e7e20;};'use strict';var _=require(_0x2183('0x0'));var util=require(_0x2183('0x1'));var logger=require(_0x2183('0x2'))(_0x2183('0x3'));var moment=require(_0x2183('0x4'));var BPromise=require(_0x2183('0x5'));var rp=require(_0x2183('0x6'));var fs=require('fs');var path=require(_0x2183('0x7'));var rimraf=require(_0x2183('0x8'));var config=require('../../config/environment');var attributes=require(_0x2183('0x9'));module['exports']=function(_0x3fe72a,_0x26ca38){return _0x3fe72a[_0x2183('0xa')](_0x2183('0xb'),attributes,{'tableName':_0x2183('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2183('0xd'),'collate':_0x2183('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 24b0c5c..764c3b8 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 _0xa88b=['body','options','raw','attributes','limit','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','update'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0xa88b,0x133));var _0xba88=function(_0x246115,_0x398123){_0x246115=_0x246115-0x0;var _0x385878=_0xa88b[_0x246115];return _0x385878;};'use strict';var _=require(_0xba88('0x0'));var util=require(_0xba88('0x1'));var moment=require(_0xba88('0x2'));var BPromise=require(_0xba88('0x3'));var rs=require(_0xba88('0x4'));var fs=require('fs');var Redis=require(_0xba88('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xba88('0x6'));var logger=require('../../config/logger')(_0xba88('0x7'));var config=require(_0xba88('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xba88('0x9')][_0xba88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11304d,_0x4dd928,_0x3a8f00){return new BPromise(function(_0x2d86de,_0x1aeedc){return client['request'](_0x11304d,_0x3a8f00)['then'](function(_0x4208c2){logger[_0xba88('0xb')]('MailApplication,\x20%s,\x20%s',_0x4dd928,_0xba88('0xc'));logger[_0xba88('0xd')](_0xba88('0xe'),_0x4dd928,_0xba88('0xc'),JSON['stringify'](_0x4208c2));if(_0x4208c2[_0xba88('0xf')]){if(_0x4208c2['error'][_0xba88('0x10')]===0x1f4){logger[_0xba88('0xf')](_0xba88('0x11'),_0x4dd928,_0x4208c2[_0xba88('0xf')][_0xba88('0x12')]);return _0x1aeedc(_0x4208c2['error'][_0xba88('0x12')]);}logger['error'](_0xba88('0x11'),_0x4dd928,_0x4208c2['error'][_0xba88('0x12')]);return _0x2d86de(_0x4208c2['error'][_0xba88('0x12')]);}else{logger[_0xba88('0xb')](_0xba88('0x11'),_0x4dd928,_0xba88('0xc'));_0x2d86de(_0x4208c2[_0xba88('0x13')][_0xba88('0x12')]);}})[_0xba88('0x14')](function(_0x23305a){logger['error']('MailApplication,\x20%s,\x20%s',_0x4dd928,_0x23305a);_0x1aeedc(_0x23305a);});});}exports[_0xba88('0x15')]=function(_0x37377b){var _0x4dd8e1=this;return new Promise(function(_0x1611c4,_0x333ce2){return db['MailApplication'][_0xba88('0x16')](_0x37377b[_0xba88('0x17')],{'raw':_0x37377b[_0xba88('0x18')]?_0x37377b[_0xba88('0x18')][_0xba88('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37377b[_0xba88('0x18')]?_0x37377b[_0xba88('0x18')]['where']||null:null,'attributes':_0x37377b[_0xba88('0x18')]?_0x37377b[_0xba88('0x18')][_0xba88('0x1a')]||null:null,'limit':_0x37377b[_0xba88('0x18')]?_0x37377b['options'][_0xba88('0x1b')]||null:null})[_0xba88('0x1c')](function(_0x2a1146){logger[_0xba88('0xb')](_0xba88('0x15'),_0x37377b);logger[_0xba88('0xd')]('UpdateMailApplication',_0x37377b,JSON[_0xba88('0x1d')](_0x2a1146));_0x1611c4(_0x2a1146);})[_0xba88('0x14')](function(_0x57ca50){logger[_0xba88('0xf')]('UpdateMailApplication',_0x57ca50['message'],_0x37377b);_0x333ce2(_0x4dd8e1['error'](0x1f4,_0x57ca50['message']));});});}; \ No newline at end of file +var _0x91f6=['request\x20sent','debug','error','message','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','info','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','MailApplication,\x20%s,\x20%s'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x91f6,0x1ae));var _0x691f=function(_0x251e03,_0x33ab0a){_0x251e03=_0x251e03-0x0;var _0x32683e=_0x91f6[_0x251e03];return _0x32683e;};'use strict';var _=require(_0x691f('0x0'));var util=require(_0x691f('0x1'));var moment=require(_0x691f('0x2'));var BPromise=require(_0x691f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x691f('0x4'));var db=require(_0x691f('0x5'))['db'];var utils=require(_0x691f('0x6'));var logger=require('../../config/logger')(_0x691f('0x7'));var config=require(_0x691f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x691f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9bfc9d,_0x12f8aa,_0x597dbb){return new BPromise(function(_0x1e85fe,_0x188379){return client['request'](_0x9bfc9d,_0x597dbb)[_0x691f('0xa')](function(_0x5f27eb){logger['info'](_0x691f('0xb'),_0x12f8aa,_0x691f('0xc'));logger[_0x691f('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x12f8aa,_0x691f('0xc'),JSON['stringify'](_0x5f27eb));if(_0x5f27eb[_0x691f('0xe')]){if(_0x5f27eb[_0x691f('0xe')]['code']===0x1f4){logger[_0x691f('0xe')](_0x691f('0xb'),_0x12f8aa,_0x5f27eb['error'][_0x691f('0xf')]);return _0x188379(_0x5f27eb['error'][_0x691f('0xf')]);}logger[_0x691f('0xe')](_0x691f('0xb'),_0x12f8aa,_0x5f27eb['error'][_0x691f('0xf')]);return _0x1e85fe(_0x5f27eb[_0x691f('0xe')][_0x691f('0xf')]);}else{logger['info'](_0x691f('0xb'),_0x12f8aa,'request\x20sent');_0x1e85fe(_0x5f27eb['result'][_0x691f('0xf')]);}})['catch'](function(_0x3b9242){logger['error']('MailApplication,\x20%s,\x20%s',_0x12f8aa,_0x3b9242);_0x188379(_0x3b9242);});});}exports[_0x691f('0x10')]=function(_0x392119){var _0x7abbbf=this;return new Promise(function(_0x1c9183,_0x35d648){return db[_0x691f('0x11')]['update'](_0x392119[_0x691f('0x12')],{'raw':_0x392119[_0x691f('0x13')]?_0x392119[_0x691f('0x13')][_0x691f('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x392119[_0x691f('0x13')]?_0x392119['options'][_0x691f('0x15')]||null:null,'attributes':_0x392119[_0x691f('0x13')]?_0x392119[_0x691f('0x13')][_0x691f('0x16')]||null:null,'limit':_0x392119[_0x691f('0x13')]?_0x392119[_0x691f('0x13')][_0x691f('0x17')]||null:null})[_0x691f('0xa')](function(_0x483051){logger[_0x691f('0x18')]('UpdateMailApplication',_0x392119);logger['debug'](_0x691f('0x10'),_0x392119,JSON[_0x691f('0x19')](_0x483051));_0x1c9183(_0x483051);})['catch'](function(_0x38d028){logger[_0x691f('0xe')](_0x691f('0x10'),_0x38d028[_0x691f('0xf')],_0x392119);_0x35d648(_0x7abbbf['error'](0x1f4,_0x38d028[_0x691f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 662735d..850c39c 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 _0xda73=['index','get','/describe','describe','/:id/messages','/:id/download','create','post','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','destroy','delete','removeTags','exports','express','../../components/interaction/service','isAuthenticated'];(function(_0x491f41,_0x4f2d53){var _0x48bc1f=function(_0x344b2f){while(--_0x344b2f){_0x491f41['push'](_0x491f41['shift']());}};_0x48bc1f(++_0x4f2d53);}(_0xda73,0x105));var _0x3da7=function(_0x18f583,_0x4b8c0d){_0x18f583=_0x18f583-0x0;var _0x3da7d2=_0xda73[_0x18f583];return _0x3da7d2;};'use strict';var express=require(_0x3da7('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3da7('0x1'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x3da7('0x2')](),controller[_0x3da7('0x3')]);router[_0x3da7('0x4')](_0x3da7('0x5'),auth[_0x3da7('0x2')](),controller[_0x3da7('0x6')]);router[_0x3da7('0x4')]('/:id',auth[_0x3da7('0x2')](),controller['show']);router[_0x3da7('0x4')](_0x3da7('0x7'),auth['isAuthenticated'](),controller['getMessages']);router[_0x3da7('0x4')](_0x3da7('0x8'),auth[_0x3da7('0x2')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x3da7('0x9')]);router[_0x3da7('0xa')](_0x3da7('0x7'),auth['isAuthenticated'](),controller['addMessage']);router[_0x3da7('0xa')](_0x3da7('0xb'),auth[_0x3da7('0x2')](),interaction[_0x3da7('0xc')](_0x3da7('0xd'),_0x3da7('0xe')),controller[_0x3da7('0xf')]);router[_0x3da7('0x10')](_0x3da7('0x11'),auth[_0x3da7('0x2')](),interaction[_0x3da7('0xc')](_0x3da7('0xd'),'mailinteraction:update'),controller['update']);router['delete'](_0x3da7('0x11'),auth[_0x3da7('0x2')](),interaction[_0x3da7('0xc')]('mail','mailinteraction:destroy'),controller[_0x3da7('0x12')]);router[_0x3da7('0x13')]('/:id/tags',auth[_0x3da7('0x2')](),controller[_0x3da7('0x14')]);module[_0x3da7('0x15')]=router; \ No newline at end of file +var _0x53ce=['exports','express','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','destroy','delete','removeTags'];(function(_0x500c3d,_0x17e169){var _0x418e4b=function(_0x1f5aa0){while(--_0x1f5aa0){_0x500c3d['push'](_0x500c3d['shift']());}};_0x418e4b(++_0x17e169);}(_0x53ce,0x139));var _0xe53c=function(_0x2efbc1,_0x3f9bc1){_0x2efbc1=_0x2efbc1-0x0;var _0x569b09=_0x53ce[_0x2efbc1];return _0x569b09;};'use strict';var express=require(_0xe53c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe53c('0x1'));var controller=require('./mailInteraction.controller');router[_0xe53c('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe53c('0x2')](_0xe53c('0x3'),auth[_0xe53c('0x4')](),controller[_0xe53c('0x5')]);router['get'](_0xe53c('0x6'),auth[_0xe53c('0x4')](),controller[_0xe53c('0x7')]);router[_0xe53c('0x2')](_0xe53c('0x8'),auth[_0xe53c('0x4')](),controller[_0xe53c('0x9')]);router['get'](_0xe53c('0xa'),auth[_0xe53c('0x4')](),controller[_0xe53c('0xb')]);router['post']('/',auth[_0xe53c('0x4')](),controller[_0xe53c('0xc')]);router[_0xe53c('0xd')](_0xe53c('0x8'),auth[_0xe53c('0x4')](),controller[_0xe53c('0xe')]);router[_0xe53c('0xd')](_0xe53c('0xf'),auth[_0xe53c('0x4')](),interaction[_0xe53c('0x10')](_0xe53c('0x11'),'mailinteraction:addtags'),controller[_0xe53c('0x12')]);router[_0xe53c('0x13')](_0xe53c('0x6'),auth[_0xe53c('0x4')](),interaction[_0xe53c('0x10')](_0xe53c('0x11'),_0xe53c('0x14')),controller[_0xe53c('0x15')]);router['delete']('/:id',auth[_0xe53c('0x4')](),interaction[_0xe53c('0x10')]('mail','mailinteraction:destroy'),controller[_0xe53c('0x16')]);router[_0xe53c('0x17')](_0xe53c('0xf'),auth[_0xe53c('0x4')](),controller[_0xe53c('0x18')]);module[_0xe53c('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 51f2737..d0355d7 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 _0x9992=['iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','sequelize'];(function(_0x21b2c2,_0x487ac9){var _0x2c9d67=function(_0x201d7c){while(--_0x201d7c){_0x21b2c2['push'](_0x21b2c2['shift']());}};_0x2c9d67(++_0x487ac9);}(_0x9992,0x135));var _0x2999=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x9992[_0x349148];return _0x2f2b0f;};'use strict';var Sequelize=require(_0x2999('0x0'));var iconv=require(_0x2999('0x1'));module[_0x2999('0x2')]={'closed':{'type':Sequelize[_0x2999('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2999('0x4')]},'secondDisposition':{'type':Sequelize[_0x2999('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2999('0x4')]},'note':{'type':Sequelize[_0x2999('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2999('0x5')](_0x2999('0x6'))},'subject':{'type':Sequelize[_0x2999('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2999('0x7')]},'substatus':{'type':Sequelize[_0x2999('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x2999('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x2999('0x8')]('in',_0x2999('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2999('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2999('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1377=['iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','sequelize'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x1377,0x15d));var _0x7137=function(_0x4c1b18,_0x24f802){_0x4c1b18=_0x4c1b18-0x0;var _0x5d7566=_0x1377[_0x4c1b18];return _0x5d7566;};'use strict';var Sequelize=require(_0x7137('0x0'));var iconv=require(_0x7137('0x1'));module[_0x7137('0x2')]={'closed':{'type':Sequelize[_0x7137('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7137('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7137('0x5')]},'inReplyTo':{'type':Sequelize[_0x7137('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x7137('0x6'))},'subject':{'type':Sequelize[_0x7137('0x7')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7137('0x4')]},'substatus':{'type':Sequelize[_0x7137('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7137('0x8')]('in',_0x7137('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7137('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7137('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7137('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 fd5913d..f2e5518 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 _0xb1b6=['rawAttributes','filters','attributes','intersection','fields','length','merge','options','find','create','body','addMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','pick','MailInteractionId','map','filter','$gte','split','format','count','includeAll','findAll','inlineCss','true','addTags','setTags','spread','emit','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachments','MailMessage','Messages','from','bcc','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','headers','Bcc','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','set','update','destroy','sendStatus','error','stack','name','send','MailInteraction','fieldName','type','key','getOptions','mail','query','user','then','catch','show','params','model','keys'];(function(_0x1c5c48,_0x4176f6){var _0x5b32af=function(_0x5452f4){while(--_0x5452f4){_0x1c5c48['push'](_0x1c5c48['shift']());}};_0x5b32af(++_0x4176f6);}(_0xb1b6,0x18a));var _0x6b1b=function(_0x391e47,_0x2e1373){_0x391e47=_0x391e47-0x0;var _0x5bc280=_0xb1b6[_0x391e47];return _0x5bc280;};'use strict';var emlformat=require(_0x6b1b('0x0'));var rimraf=require(_0x6b1b('0x1'));var zipdir=require(_0x6b1b('0x2'));var moment=require('moment');var BPromise=require(_0x6b1b('0x3'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x6b1b('0x4'));var juice=require(_0x6b1b('0x5'));var Redis=require(_0x6b1b('0x6'));var interaction=require(_0x6b1b('0x7'));var qs=require(_0x6b1b('0x8'));var logger=require('../../config/logger')(_0x6b1b('0x9'));var config=require('../../config/environment');var db=require(_0x6b1b('0xa'))['db'];var htmlEntities=require(_0x6b1b('0xb'));config['redis']=_[_0x6b1b('0xc')](config[_0x6b1b('0xd')],{'host':_0x6b1b('0xe'),'port':0x18eb});var socket=require(_0x6b1b('0xf'))(new Redis(config[_0x6b1b('0xd')]));require(_0x6b1b('0x10'))[_0x6b1b('0x11')](socket);function respondWithStatusCode(_0x2d452c,_0x380df6){_0x380df6=_0x380df6||0xcc;return function(_0x34000c){if(_0x34000c){return _0x2d452c['sendStatus'](_0x380df6);}return _0x2d452c[_0x6b1b('0x12')](_0x380df6)[_0x6b1b('0x13')]();};}function respondWithResult(_0x56ad72,_0x3da5f3){_0x3da5f3=_0x3da5f3||0xc8;return function(_0x49be0f){if(_0x49be0f){return _0x56ad72['status'](_0x3da5f3)[_0x6b1b('0x14')](_0x49be0f);}};}function respondWithFilteredResult(_0x521db1,_0x9338a3){return function(_0x3bd608){if(_0x3bd608){var _0x4a12f7=typeof _0x9338a3[_0x6b1b('0x15')]===_0x6b1b('0x16')&&typeof _0x9338a3[_0x6b1b('0x17')]===_0x6b1b('0x16');var _0x40897a=_0x3bd608['count'];var _0x3e2b11=_0x4a12f7?0x0:_0x9338a3[_0x6b1b('0x15')];var _0x26b697=_0x4a12f7?_0x3bd608['count']:_0x9338a3[_0x6b1b('0x15')]+_0x9338a3[_0x6b1b('0x17')];var _0x1d3173;if(_0x26b697>=_0x40897a){_0x26b697=_0x40897a;_0x1d3173=0xc8;}else{_0x1d3173=0xce;}_0x521db1['status'](_0x1d3173);return _0x521db1[_0x6b1b('0x18')]('Content-Range',_0x3e2b11+'-'+_0x26b697+'/'+_0x40897a)[_0x6b1b('0x14')](_0x3bd608);}return null;};}function saveUpdates(_0x51a24b){return function(_0x4eeef9){if(_0x4eeef9){return _0x4eeef9[_0x6b1b('0x19')](_0x51a24b)['then'](function(_0x4e0f4d){return _0x4e0f4d;});}return null;};}function removeEntity(_0x4831aa){return function(_0x161b0a){if(_0x161b0a){return _0x161b0a[_0x6b1b('0x1a')]()['then'](function(){_0x4831aa['status'](0xcc)[_0x6b1b('0x13')]();});}};}function handleEntityNotFound(_0x3c3b63){return function(_0x3a44ab){if(!_0x3a44ab){_0x3c3b63[_0x6b1b('0x1b')](0x194);}return _0x3a44ab;};}function handleError(_0x856aa6,_0x3203a2){_0x3203a2=_0x3203a2||0x1f4;return function(_0x116845){logger[_0x6b1b('0x1c')](_0x116845[_0x6b1b('0x1d')]);if(_0x116845[_0x6b1b('0x1e')]){delete _0x116845[_0x6b1b('0x1e')];}_0x856aa6['status'](_0x3203a2)[_0x6b1b('0x1f')](_0x116845);};}exports['index']=function(_0x456039,_0x1de2fd){var _0x158b48={};var _0x4a6b44=_['map'](db[_0x6b1b('0x20')]['rawAttributes'],function(_0x2c8db6){return{'name':_0x2c8db6[_0x6b1b('0x21')],'type':_0x2c8db6[_0x6b1b('0x22')][_0x6b1b('0x23')]};});_0x158b48=qs[_0x6b1b('0x24')](_0x4a6b44,_0x456039);return interaction['findAll'](_0x6b1b('0x25'),_0x456039[_0x6b1b('0x26')],_0x456039[_0x6b1b('0x27')],_0x158b48,_0x4a6b44)[_0x6b1b('0x28')](respondWithFilteredResult(_0x1de2fd,_0x158b48))[_0x6b1b('0x29')](handleError(_0x1de2fd,null));};exports[_0x6b1b('0x2a')]=function(_0x16373b,_0x31496f){var _0x17ef82={'raw':![],'where':{'id':_0x16373b[_0x6b1b('0x2b')]['id']}},_0x404fd4={};_0x404fd4[_0x6b1b('0x2c')]=_[_0x6b1b('0x2d')](db['MailInteraction'][_0x6b1b('0x2e')]);_0x404fd4[_0x6b1b('0x26')]=_[_0x6b1b('0x2d')](_0x16373b[_0x6b1b('0x26')]);_0x404fd4[_0x6b1b('0x2f')]=_['intersection'](_0x404fd4[_0x6b1b('0x2c')],_0x404fd4[_0x6b1b('0x26')]);_0x17ef82[_0x6b1b('0x30')]=_[_0x6b1b('0x31')](_0x404fd4[_0x6b1b('0x2c')],qs[_0x6b1b('0x32')](_0x16373b[_0x6b1b('0x26')][_0x6b1b('0x32')]));_0x17ef82[_0x6b1b('0x30')]=_0x17ef82[_0x6b1b('0x30')][_0x6b1b('0x33')]?_0x17ef82['attributes']:_0x404fd4[_0x6b1b('0x2c')];if(_0x16373b['query']['includeAll']){_0x17ef82['include']=[{'all':!![]}];}_0x17ef82=_[_0x6b1b('0x34')]({},_0x17ef82,_0x16373b[_0x6b1b('0x35')]);return db['MailInteraction'][_0x6b1b('0x36')](_0x17ef82)[_0x6b1b('0x28')](handleEntityNotFound(_0x31496f,null))['then'](respondWithResult(_0x31496f,null))[_0x6b1b('0x29')](handleError(_0x31496f,null));};exports[_0x6b1b('0x37')]=function(_0x844435,_0x3cbc5a){return db[_0x6b1b('0x20')][_0x6b1b('0x37')](_0x844435[_0x6b1b('0x38')],{})[_0x6b1b('0x28')](respondWithResult(_0x3cbc5a,0xc9))[_0x6b1b('0x29')](handleError(_0x3cbc5a,null));};exports['update']=function(_0x3fcb10,_0x3ce1d2){if(_0x3fcb10[_0x6b1b('0x38')]['id']){delete _0x3fcb10[_0x6b1b('0x38')]['id'];}return db[_0x6b1b('0x20')]['find']({'where':{'id':_0x3fcb10[_0x6b1b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3ce1d2,null))['then'](saveUpdates(_0x3fcb10[_0x6b1b('0x38')],null))[_0x6b1b('0x28')](respondWithResult(_0x3ce1d2,null))[_0x6b1b('0x29')](handleError(_0x3ce1d2,null));};exports[_0x6b1b('0x1a')]=function(_0x11d2a9,_0x262aa3){return db[_0x6b1b('0x20')][_0x6b1b('0x36')]({'where':{'id':_0x11d2a9[_0x6b1b('0x2b')]['id']}})[_0x6b1b('0x28')](handleEntityNotFound(_0x262aa3,null))[_0x6b1b('0x28')](removeEntity(_0x262aa3,null))['catch'](handleError(_0x262aa3,null));};exports['describe']=function(_0x2f1380,_0x3bbde3){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x3bbde3,null))[_0x6b1b('0x29')](handleError(_0x3bbde3,null));};exports[_0x6b1b('0x39')]=function(_0x290613,_0x6d9e78){return db['MailMessage'][_0x6b1b('0x36')]({'where':{'id':_0x290613[_0x6b1b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x6d9e78,null))[_0x6b1b('0x28')](function(_0x5daf26){if(_0x5daf26){return _0x5daf26[_0x6b1b('0x39')](_0x290613[_0x6b1b('0x38')][_0x6b1b('0x3a')],_[_0x6b1b('0x3b')](_0x290613['body'],[_0x6b1b('0x3a'),'id'])||{});}})[_0x6b1b('0x28')](respondWithResult(_0x6d9e78,null))[_0x6b1b('0x29')](handleError(_0x6d9e78,null));};exports[_0x6b1b('0x3c')]=function(_0x4132a1,_0x413d50){var _0x4037a6={'raw':![],'where':{}};var _0xc75906={};var _0x449db7={'count':0x0,'rows':[]};return db[_0x6b1b('0x20')][_0x6b1b('0x3d')]({'where':{'id':_0x4132a1[_0x6b1b('0x2b')]['id']}})[_0x6b1b('0x28')](handleEntityNotFound(_0x413d50,null))[_0x6b1b('0x28')](function(_0x12da18){if(_0x12da18){_0xc75906[_0x6b1b('0x2c')]=_['keys'](db['MailMessage']['rawAttributes']);_0xc75906[_0x6b1b('0x26')]=_[_0x6b1b('0x2d')](_0x4132a1[_0x6b1b('0x26')]);_0xc75906[_0x6b1b('0x2f')]=_[_0x6b1b('0x31')](_0xc75906[_0x6b1b('0x2c')],_0xc75906[_0x6b1b('0x26')]);_0x4037a6[_0x6b1b('0x30')]=_[_0x6b1b('0x31')](_0xc75906[_0x6b1b('0x2c')],qs[_0x6b1b('0x32')](_0x4132a1[_0x6b1b('0x26')]['fields']));_0x4037a6[_0x6b1b('0x30')]=_0x4037a6['attributes'][_0x6b1b('0x33')]?_0x4037a6[_0x6b1b('0x30')]:_0xc75906[_0x6b1b('0x2c')];if(!_0x4132a1[_0x6b1b('0x26')]['hasOwnProperty'](_0x6b1b('0x3e'))){_0x4037a6[_0x6b1b('0x17')]=qs[_0x6b1b('0x17')](_0x4132a1[_0x6b1b('0x26')][_0x6b1b('0x17')]);_0x4037a6[_0x6b1b('0x15')]=qs[_0x6b1b('0x15')](_0x4132a1[_0x6b1b('0x26')][_0x6b1b('0x15')]);}_0x4037a6[_0x6b1b('0x3f')]=qs[_0x6b1b('0x40')](_0x4132a1[_0x6b1b('0x26')]['sort']);_0x4037a6[_0x6b1b('0x41')]=qs[_0x6b1b('0x2f')](_[_0x6b1b('0x42')](_0x4132a1[_0x6b1b('0x26')],_0xc75906[_0x6b1b('0x2f')]));_0x4037a6[_0x6b1b('0x41')][_0x6b1b('0x43')]=_0x12da18['id'];if(_0x4132a1['query']['filter']){_0x4037a6[_0x6b1b('0x41')]=_['merge'](_0x4037a6[_0x6b1b('0x41')],{'$or':_[_0x6b1b('0x44')](_0x4037a6[_0x6b1b('0x30')],function(_0x4bb3f0){var _0xf69616={};_0xf69616[_0x4bb3f0]={'$like':'%'+_0x4132a1[_0x6b1b('0x26')][_0x6b1b('0x45')]+'%'};return _0xf69616;})});}if(_0x4132a1[_0x6b1b('0x26')][_0x6b1b('0x46')]){var _0xfa119f=_0x4132a1[_0x6b1b('0x26')]['$gte'][_0x6b1b('0x47')](',');var _0x3afe3d={};_0x3afe3d[_0xfa119f[0x0]]={'$gte':moment(_0xfa119f[0x1])[_0x6b1b('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4037a6[_0x6b1b('0x41')]=_[_0x6b1b('0x34')](_0x4037a6['where'],_0x3afe3d);}_0x4037a6=_[_0x6b1b('0x34')]({},_0x4037a6,_0x4132a1['options']);return db['MailMessage']['count']({'where':_0x4037a6['where']})[_0x6b1b('0x28')](function(_0x1d9b0c){_0x449db7[_0x6b1b('0x49')]=_0x1d9b0c;if(_0x4132a1[_0x6b1b('0x26')][_0x6b1b('0x4a')]){_0x4037a6['include']=[{'all':!![]}];}return db['MailMessage'][_0x6b1b('0x4b')](_0x4037a6);})[_0x6b1b('0x28')](function(_0x166667){if(_0x4132a1['query'][_0x6b1b('0x4c')]===_0x6b1b('0x4d')){for(var _0x288d01=0x0;_0x288d01<_0x166667[_0x6b1b('0x33')];_0x288d01++){_0x166667[_0x288d01][_0x6b1b('0x38')]=juice(_0x166667[_0x288d01][_0x6b1b('0x38')]);}}_0x449db7['rows']=_0x166667;return _0x449db7;});}})[_0x6b1b('0x28')](respondWithFilteredResult(_0x413d50,_0x4037a6))[_0x6b1b('0x29')](handleError(_0x413d50,null));};exports[_0x6b1b('0x4e')]=function(_0x2b0cc7,_0x273837){return db[_0x6b1b('0x20')][_0x6b1b('0x36')]({'where':{'id':_0x2b0cc7['params']['id']}})[_0x6b1b('0x28')](handleEntityNotFound(_0x273837,null))[_0x6b1b('0x28')](function(_0xb9996c){if(_0xb9996c){return _0xb9996c[_0x6b1b('0x4f')](_0x2b0cc7['body']['ids'],_[_0x6b1b('0x3b')](_0x2b0cc7[_0x6b1b('0x38')],[_0x6b1b('0x3a'),'id'])||{})[_0x6b1b('0x50')](function(){return db['Tag'][_0x6b1b('0x4b')]({'attributes':['id',_0x6b1b('0x1e'),'color'],'where':{'id':_0x2b0cc7[_0x6b1b('0x38')][_0x6b1b('0x3a')]}});})[_0x6b1b('0x28')](function(_0x3e832f){socket[_0x6b1b('0x51')]('mailInteractionTags:save',{'id':Number(_0x2b0cc7[_0x6b1b('0x2b')]['id']),'tags':_0x3e832f||[]});return{'id':Number(_0x2b0cc7['params']['id']),'tags':_0x3e832f||[]};});}})[_0x6b1b('0x28')](respondWithResult(_0x273837,null))[_0x6b1b('0x29')](handleError(_0x273837,null));};exports[_0x6b1b('0x52')]=function(_0x43e4e0,_0x22f897){return db[_0x6b1b('0x20')][_0x6b1b('0x36')]({'where':{'id':_0x43e4e0['params']['id']}})[_0x6b1b('0x28')](handleEntityNotFound(_0x22f897,null))[_0x6b1b('0x28')](function(_0x5c4677){if(_0x5c4677){return _0x5c4677[_0x6b1b('0x52')](_0x43e4e0['query'][_0x6b1b('0x3a')]);}})[_0x6b1b('0x28')](respondWithStatusCode(_0x22f897,null))[_0x6b1b('0x29')](handleError(_0x22f897,null));};exports[_0x6b1b('0x53')]=function(_0x522852,_0x435442){var _0x4617df=moment()[_0x6b1b('0x54')]()[_0x6b1b('0x55')]();var _0x53c0c8=path[_0x6b1b('0x56')](config[_0x6b1b('0x57')],'server',_0x6b1b('0x58'),_0x6b1b('0x59'));var _0x13fa42=path[_0x6b1b('0x56')](config[_0x6b1b('0x57')],_0x6b1b('0x5a'),_0x6b1b('0x58'),_0x6b1b('0x5b'));var _0x1f1506=path['join'](_0x53c0c8,_0x4617df);var _0x380d7d=util[_0x6b1b('0x48')](_0x6b1b('0x5c'),_0x522852[_0x6b1b('0x2b')]['id'],_0x4617df);var _0xa2be65=path[_0x6b1b('0x56')](_0x53c0c8,_0x380d7d);var _0x135642=[];if(_0x522852[_0x6b1b('0x26')]['attachments']){_0x135642['push']({'model':db['Attachment'],'as':_0x6b1b('0x5d'),'raw':!![]});}var _0x52e2ba=[{'model':db[_0x6b1b('0x5e')],'as':_0x6b1b('0x5f'),'attributes':['id','body',_0x6b1b('0x60'),'to','cc',_0x6b1b('0x61'),'subject',_0x6b1b('0x62')],'where':{'secret':![]},'order':qs[_0x6b1b('0x40')]('id'),'include':_0x135642}];return db[_0x6b1b('0x20')][_0x6b1b('0x36')]({'where':{'id':_0x522852[_0x6b1b('0x2b')]['id']},'include':_0x52e2ba})[_0x6b1b('0x28')](handleEntityNotFound(_0x435442,null))[_0x6b1b('0x28')](function(_0x406dc3){if(_0x406dc3&&_0x406dc3[_0x6b1b('0x5f')]){var _0x21444c=_0x406dc3[_0x6b1b('0x63')]({'plain':!![]});fs[_0x6b1b('0x64')](_0x1f1506);return BPromise[_0x6b1b('0x65')](_0x21444c[_0x6b1b('0x5f')],function(_0x4bd038,_0x5ea79a){var _0x27e439={'from':_0x4bd038[_0x6b1b('0x60')],'to':_0x4bd038['to']||_0x6b1b('0x66'),'subject':_0x4bd038['subject'],'html':htmlEntities[_0x6b1b('0x67')](_0x4bd038[_0x6b1b('0x38')]),'headers':{'Date':moment(_0x4bd038[_0x6b1b('0x62')])[_0x6b1b('0x48')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4bd038['cc']){_0x27e439[_0x6b1b('0x68')]['Cc']=_0x4bd038['cc'];}if(_0x4bd038[_0x6b1b('0x61')]){_0x27e439[_0x6b1b('0x68')][_0x6b1b('0x69')]=_0x4bd038[_0x6b1b('0x61')];}return new BPromise(function(_0x3161ba,_0x59f58b){if(_0x4bd038[_0x6b1b('0x5d')]){for(var _0x3d115c=0x0;_0x3d115c<_0x4bd038[_0x6b1b('0x5d')][_0x6b1b('0x33')];_0x3d115c++){var _0x4a70b3=_0x4bd038['Attachments'][_0x3d115c];var _0x32b2bf=path[_0x6b1b('0x56')](_0x13fa42,_0x4a70b3['basename']);if(fs['existsSync'](_0x32b2bf)){_0x27e439[_0x6b1b('0x5b')]['push']({'name':_0x4a70b3[_0x6b1b('0x1e')],'contentType':_0x4a70b3['type'],'data':fs[_0x6b1b('0x6a')](_0x32b2bf)});}}}emlformat[_0x6b1b('0x6b')](_0x27e439,function(_0x55049c,_0x4b2aba){if(_0x55049c)return _0x59f58b(_0x55049c);fs['writeFileSync'](path['join'](_0x1f1506,util[_0x6b1b('0x48')](_0x6b1b('0x6c'),_0x5ea79a)),_0x4b2aba);return _0x3161ba(_0x4b2aba);});});})[_0x6b1b('0x28')](function(){return new BPromise(function(_0x56b7a3,_0x5a12d8){zipdir(_0x1f1506,{'saveTo':_0xa2be65},function(_0x6d48de,_0x161ad6){if(_0x6d48de)return _0x5a12d8(_0x6d48de);return _0x56b7a3(_0x161ad6);});})[_0x6b1b('0x28')](function(){return new BPromise(function(_0x25dd15,_0x299db2){rimraf(_0x1f1506,function(_0x16f74d){if(_0x16f74d)_0x299db2(_0x16f74d);return _0x25dd15();});});})[_0x6b1b('0x28')](function(){return _0x435442[_0x6b1b('0x53')](_0xa2be65,_0x380d7d,function(_0x524f6d){if(!_0x524f6d)fs[_0x6b1b('0x6d')](_0xa2be65);});});});}else{return _0x435442[_0x6b1b('0x1b')](0xc8);}})[_0x6b1b('0x29')](handleError(_0x435442,null));}; \ No newline at end of file +var _0xffdc=['headers','Bcc','Attachments','basename','existsSync','build','writeFileSync','message%d.eml','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','update','then','end','error','stack','name','send','index','map','MailInteraction','rawAttributes','type','findAll','mail','query','user','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','catch','create','body','destroy','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','$gte','split','options','inlineCss','rows','setTags','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','server','format','transcript-%d-%s.zip','attachments','push','Attachment','from','bcc','subject','createdAt','get','mkdirSync','each','Messages','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ'];(function(_0x456429,_0x424e77){var _0x1ab1e1=function(_0xa19de6){while(--_0xa19de6){_0x456429['push'](_0x456429['shift']());}};_0x1ab1e1(++_0x424e77);}(_0xffdc,0xf2));var _0xcffd=function(_0x3b4691,_0x297c4d){_0x3b4691=_0x3b4691-0x0;var _0x5d4691=_0xffdc[_0x3b4691];return _0x5d4691;};'use strict';var emlformat=require(_0xcffd('0x0'));var rimraf=require(_0xcffd('0x1'));var zipdir=require('zip-dir');var moment=require(_0xcffd('0x2'));var BPromise=require(_0xcffd('0x3'));var util=require(_0xcffd('0x4'));var path=require(_0xcffd('0x5'));var fs=require('fs');var _=require(_0xcffd('0x6'));var juice=require(_0xcffd('0x7'));var Redis=require(_0xcffd('0x8'));var interaction=require(_0xcffd('0x9'));var qs=require(_0xcffd('0xa'));var logger=require(_0xcffd('0xb'))(_0xcffd('0xc'));var config=require(_0xcffd('0xd'));var db=require(_0xcffd('0xe'))['db'];var htmlEntities=require(_0xcffd('0xf'));config[_0xcffd('0x10')]=_[_0xcffd('0x11')](config[_0xcffd('0x10')],{'host':_0xcffd('0x12'),'port':0x18eb});var socket=require(_0xcffd('0x13'))(new Redis(config[_0xcffd('0x10')]));require(_0xcffd('0x14'))[_0xcffd('0x15')](socket);function respondWithStatusCode(_0x6869c9,_0x299ba3){_0x299ba3=_0x299ba3||0xcc;return function(_0x3aeea7){if(_0x3aeea7){return _0x6869c9[_0xcffd('0x16')](_0x299ba3);}return _0x6869c9[_0xcffd('0x17')](_0x299ba3)['end']();};}function respondWithResult(_0xc40145,_0x232c2a){_0x232c2a=_0x232c2a||0xc8;return function(_0x16b542){if(_0x16b542){return _0xc40145[_0xcffd('0x17')](_0x232c2a)['json'](_0x16b542);}};}function respondWithFilteredResult(_0x1e9144,_0x3038f4){return function(_0xfcedc9){if(_0xfcedc9){var _0x396971=typeof _0x3038f4[_0xcffd('0x18')]===_0xcffd('0x19')&&typeof _0x3038f4['limit']===_0xcffd('0x19');var _0x4648b6=_0xfcedc9[_0xcffd('0x1a')];var _0x533c4d=_0x396971?0x0:_0x3038f4['offset'];var _0x21cd46=_0x396971?_0xfcedc9[_0xcffd('0x1a')]:_0x3038f4[_0xcffd('0x18')]+_0x3038f4[_0xcffd('0x1b')];var _0x1ba2dc;if(_0x21cd46>=_0x4648b6){_0x21cd46=_0x4648b6;_0x1ba2dc=0xc8;}else{_0x1ba2dc=0xce;}_0x1e9144[_0xcffd('0x17')](_0x1ba2dc);return _0x1e9144[_0xcffd('0x1c')](_0xcffd('0x1d'),_0x533c4d+'-'+_0x21cd46+'/'+_0x4648b6)['json'](_0xfcedc9);}return null;};}function saveUpdates(_0x4d406a){return function(_0xed911){if(_0xed911){return _0xed911[_0xcffd('0x1e')](_0x4d406a)[_0xcffd('0x1f')](function(_0x3323c5){return _0x3323c5;});}return null;};}function removeEntity(_0x4652ce){return function(_0x275ec7){if(_0x275ec7){return _0x275ec7['destroy']()[_0xcffd('0x1f')](function(){_0x4652ce[_0xcffd('0x17')](0xcc)[_0xcffd('0x20')]();});}};}function handleEntityNotFound(_0x48af39){return function(_0x58f5c9){if(!_0x58f5c9){_0x48af39[_0xcffd('0x16')](0x194);}return _0x58f5c9;};}function handleError(_0x239f3,_0x186836){_0x186836=_0x186836||0x1f4;return function(_0x49aafe){logger[_0xcffd('0x21')](_0x49aafe[_0xcffd('0x22')]);if(_0x49aafe['name']){delete _0x49aafe[_0xcffd('0x23')];}_0x239f3['status'](_0x186836)[_0xcffd('0x24')](_0x49aafe);};}exports[_0xcffd('0x25')]=function(_0x458735,_0x3bd986){var _0x28e474={};var _0x1c476e=_[_0xcffd('0x26')](db[_0xcffd('0x27')][_0xcffd('0x28')],function(_0x5eaea3){return{'name':_0x5eaea3['fieldName'],'type':_0x5eaea3[_0xcffd('0x29')]['key']};});_0x28e474=qs['getOptions'](_0x1c476e,_0x458735);return interaction[_0xcffd('0x2a')](_0xcffd('0x2b'),_0x458735[_0xcffd('0x2c')],_0x458735[_0xcffd('0x2d')],_0x28e474,_0x1c476e)[_0xcffd('0x1f')](respondWithFilteredResult(_0x3bd986,_0x28e474))['catch'](handleError(_0x3bd986,null));};exports[_0xcffd('0x2e')]=function(_0x349bb3,_0x5199bd){var _0x45ce4d={'raw':![],'where':{'id':_0x349bb3[_0xcffd('0x2f')]['id']}},_0x1799cd={};_0x1799cd[_0xcffd('0x30')]=_['keys'](db[_0xcffd('0x27')]['rawAttributes']);_0x1799cd[_0xcffd('0x2c')]=_[_0xcffd('0x31')](_0x349bb3[_0xcffd('0x2c')]);_0x1799cd[_0xcffd('0x32')]=_[_0xcffd('0x33')](_0x1799cd[_0xcffd('0x30')],_0x1799cd[_0xcffd('0x2c')]);_0x45ce4d['attributes']=_[_0xcffd('0x33')](_0x1799cd[_0xcffd('0x30')],qs[_0xcffd('0x34')](_0x349bb3['query']['fields']));_0x45ce4d[_0xcffd('0x35')]=_0x45ce4d[_0xcffd('0x35')][_0xcffd('0x36')]?_0x45ce4d[_0xcffd('0x35')]:_0x1799cd[_0xcffd('0x30')];if(_0x349bb3[_0xcffd('0x2c')][_0xcffd('0x37')]){_0x45ce4d[_0xcffd('0x38')]=[{'all':!![]}];}_0x45ce4d=_[_0xcffd('0x39')]({},_0x45ce4d,_0x349bb3['options']);return db['MailInteraction'][_0xcffd('0x3a')](_0x45ce4d)[_0xcffd('0x1f')](handleEntityNotFound(_0x5199bd,null))[_0xcffd('0x1f')](respondWithResult(_0x5199bd,null))[_0xcffd('0x3b')](handleError(_0x5199bd,null));};exports[_0xcffd('0x3c')]=function(_0x3b15c2,_0x302902){return db[_0xcffd('0x27')][_0xcffd('0x3c')](_0x3b15c2[_0xcffd('0x3d')],{})[_0xcffd('0x1f')](respondWithResult(_0x302902,0xc9))[_0xcffd('0x3b')](handleError(_0x302902,null));};exports['update']=function(_0xce38f9,_0x283dc5){if(_0xce38f9[_0xcffd('0x3d')]['id']){delete _0xce38f9[_0xcffd('0x3d')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0xce38f9[_0xcffd('0x2f')]['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0x283dc5,null))[_0xcffd('0x1f')](saveUpdates(_0xce38f9[_0xcffd('0x3d')],null))[_0xcffd('0x1f')](respondWithResult(_0x283dc5,null))['catch'](handleError(_0x283dc5,null));};exports[_0xcffd('0x3e')]=function(_0x4a46b2,_0x38b479){return db['MailInteraction'][_0xcffd('0x3a')]({'where':{'id':_0x4a46b2[_0xcffd('0x2f')]['id']}})['then'](handleEntityNotFound(_0x38b479,null))[_0xcffd('0x1f')](removeEntity(_0x38b479,null))[_0xcffd('0x3b')](handleError(_0x38b479,null));};exports['describe']=function(_0x13b44b,_0x2fd9a2){return db[_0xcffd('0x27')]['describe']()[_0xcffd('0x1f')](respondWithResult(_0x2fd9a2,null))[_0xcffd('0x3b')](handleError(_0x2fd9a2,null));};exports[_0xcffd('0x3f')]=function(_0x2b42e5,_0x48ab00){return db[_0xcffd('0x40')][_0xcffd('0x3a')]({'where':{'id':_0x2b42e5['params']['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0x48ab00,null))[_0xcffd('0x1f')](function(_0x32fc7b){if(_0x32fc7b){return _0x32fc7b[_0xcffd('0x3f')](_0x2b42e5[_0xcffd('0x3d')][_0xcffd('0x41')],_[_0xcffd('0x42')](_0x2b42e5[_0xcffd('0x3d')],[_0xcffd('0x41'),'id'])||{});}})[_0xcffd('0x1f')](respondWithResult(_0x48ab00,null))[_0xcffd('0x3b')](handleError(_0x48ab00,null));};exports[_0xcffd('0x43')]=function(_0x14a952,_0x131881){var _0x4a8ae4={'raw':![],'where':{}};var _0x2277f5={};var _0x17ce3d={'count':0x0,'rows':[]};return db['MailInteraction'][_0xcffd('0x44')]({'where':{'id':_0x14a952[_0xcffd('0x2f')]['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0x131881,null))[_0xcffd('0x1f')](function(_0x1b1365){if(_0x1b1365){_0x2277f5[_0xcffd('0x30')]=_[_0xcffd('0x31')](db[_0xcffd('0x40')][_0xcffd('0x28')]);_0x2277f5[_0xcffd('0x2c')]=_[_0xcffd('0x31')](_0x14a952['query']);_0x2277f5[_0xcffd('0x32')]=_[_0xcffd('0x33')](_0x2277f5[_0xcffd('0x30')],_0x2277f5['query']);_0x4a8ae4['attributes']=_[_0xcffd('0x33')](_0x2277f5[_0xcffd('0x30')],qs[_0xcffd('0x34')](_0x14a952[_0xcffd('0x2c')][_0xcffd('0x34')]));_0x4a8ae4[_0xcffd('0x35')]=_0x4a8ae4[_0xcffd('0x35')][_0xcffd('0x36')]?_0x4a8ae4['attributes']:_0x2277f5[_0xcffd('0x30')];if(!_0x14a952['query'][_0xcffd('0x45')](_0xcffd('0x46'))){_0x4a8ae4['limit']=qs[_0xcffd('0x1b')](_0x14a952['query']['limit']);_0x4a8ae4['offset']=qs['offset'](_0x14a952[_0xcffd('0x2c')][_0xcffd('0x18')]);}_0x4a8ae4[_0xcffd('0x47')]=qs[_0xcffd('0x48')](_0x14a952['query']['sort']);_0x4a8ae4[_0xcffd('0x49')]=qs['filters'](_['pick'](_0x14a952[_0xcffd('0x2c')],_0x2277f5['filters']));_0x4a8ae4['where'][_0xcffd('0x4a')]=_0x1b1365['id'];if(_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4b')]){_0x4a8ae4[_0xcffd('0x49')]=_['merge'](_0x4a8ae4['where'],{'$or':_['map'](_0x4a8ae4[_0xcffd('0x35')],function(_0x2cc6c3){var _0x47a931={};_0x47a931[_0x2cc6c3]={'$like':'%'+_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4b')]+'%'};return _0x47a931;})});}if(_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4c')]){var _0x2d2a60=_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4c')][_0xcffd('0x4d')](',');var _0x53c66e={};_0x53c66e[_0x2d2a60[0x0]]={'$gte':moment(_0x2d2a60[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4a8ae4[_0xcffd('0x49')]=_['merge'](_0x4a8ae4[_0xcffd('0x49')],_0x53c66e);}_0x4a8ae4=_['merge']({},_0x4a8ae4,_0x14a952[_0xcffd('0x4e')]);return db['MailMessage']['count']({'where':_0x4a8ae4[_0xcffd('0x49')]})[_0xcffd('0x1f')](function(_0x5cfd9b){_0x17ce3d[_0xcffd('0x1a')]=_0x5cfd9b;if(_0x14a952[_0xcffd('0x2c')]['includeAll']){_0x4a8ae4[_0xcffd('0x38')]=[{'all':!![]}];}return db[_0xcffd('0x40')][_0xcffd('0x2a')](_0x4a8ae4);})[_0xcffd('0x1f')](function(_0x59b7d3){if(_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4f')]==='true'){for(var _0x577b91=0x0;_0x577b91<_0x59b7d3[_0xcffd('0x36')];_0x577b91++){_0x59b7d3[_0x577b91]['body']=juice(_0x59b7d3[_0x577b91][_0xcffd('0x3d')]);}}_0x17ce3d[_0xcffd('0x50')]=_0x59b7d3;return _0x17ce3d;});}})[_0xcffd('0x1f')](respondWithFilteredResult(_0x131881,_0x4a8ae4))[_0xcffd('0x3b')](handleError(_0x131881,null));};exports['addTags']=function(_0x468a70,_0x5b9210){return db['MailInteraction'][_0xcffd('0x3a')]({'where':{'id':_0x468a70[_0xcffd('0x2f')]['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0x5b9210,null))[_0xcffd('0x1f')](function(_0x431c15){if(_0x431c15){return _0x431c15[_0xcffd('0x51')](_0x468a70[_0xcffd('0x3d')][_0xcffd('0x41')],_['omit'](_0x468a70[_0xcffd('0x3d')],[_0xcffd('0x41'),'id'])||{})['spread'](function(){return db[_0xcffd('0x52')][_0xcffd('0x2a')]({'attributes':['id',_0xcffd('0x23'),'color'],'where':{'id':_0x468a70[_0xcffd('0x3d')][_0xcffd('0x41')]}});})['then'](function(_0x5d573a){socket[_0xcffd('0x53')](_0xcffd('0x54'),{'id':Number(_0x468a70[_0xcffd('0x2f')]['id']),'tags':_0x5d573a||[]});return{'id':Number(_0x468a70[_0xcffd('0x2f')]['id']),'tags':_0x5d573a||[]};});}})[_0xcffd('0x1f')](respondWithResult(_0x5b9210,null))['catch'](handleError(_0x5b9210,null));};exports[_0xcffd('0x55')]=function(_0x34b4be,_0xba121c){return db[_0xcffd('0x27')]['find']({'where':{'id':_0x34b4be[_0xcffd('0x2f')]['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0xba121c,null))[_0xcffd('0x1f')](function(_0x4368fb){if(_0x4368fb){return _0x4368fb[_0xcffd('0x55')](_0x34b4be[_0xcffd('0x2c')][_0xcffd('0x41')]);}})[_0xcffd('0x1f')](respondWithStatusCode(_0xba121c,null))[_0xcffd('0x3b')](handleError(_0xba121c,null));};exports[_0xcffd('0x56')]=function(_0x443a7d,_0x2a5c77){var _0x394e7b=moment()[_0xcffd('0x57')]()[_0xcffd('0x58')]();var _0x513d7e=path[_0xcffd('0x59')](config[_0xcffd('0x5a')],'server',_0xcffd('0x5b'),'tmp');var _0x490374=path[_0xcffd('0x59')](config['root'],_0xcffd('0x5c'),_0xcffd('0x5b'),'attachments');var _0xba8af4=path[_0xcffd('0x59')](_0x513d7e,_0x394e7b);var _0xc474ac=util[_0xcffd('0x5d')](_0xcffd('0x5e'),_0x443a7d['params']['id'],_0x394e7b);var _0x3eda9c=path[_0xcffd('0x59')](_0x513d7e,_0xc474ac);var _0x4aafee=[];if(_0x443a7d[_0xcffd('0x2c')][_0xcffd('0x5f')]){_0x4aafee[_0xcffd('0x60')]({'model':db[_0xcffd('0x61')],'as':'Attachments','raw':!![]});}var _0x2d1ae5=[{'model':db[_0xcffd('0x40')],'as':'Messages','attributes':['id',_0xcffd('0x3d'),_0xcffd('0x62'),'to','cc',_0xcffd('0x63'),_0xcffd('0x64'),_0xcffd('0x65')],'where':{'secret':![]},'order':qs[_0xcffd('0x48')]('id'),'include':_0x4aafee}];return db[_0xcffd('0x27')]['find']({'where':{'id':_0x443a7d[_0xcffd('0x2f')]['id']},'include':_0x2d1ae5})[_0xcffd('0x1f')](handleEntityNotFound(_0x2a5c77,null))[_0xcffd('0x1f')](function(_0x48774d){if(_0x48774d&&_0x48774d['Messages']){var _0xcb2913=_0x48774d[_0xcffd('0x66')]({'plain':!![]});fs[_0xcffd('0x67')](_0xba8af4);return BPromise[_0xcffd('0x68')](_0xcb2913[_0xcffd('0x69')],function(_0x53bae0,_0x255cb1){var _0x41676b={'from':_0x53bae0['from'],'to':_0x53bae0['to']||_0xcffd('0x6a'),'subject':_0x53bae0[_0xcffd('0x64')],'html':htmlEntities[_0xcffd('0x6b')](_0x53bae0[_0xcffd('0x3d')]),'headers':{'Date':moment(_0x53bae0[_0xcffd('0x65')])[_0xcffd('0x5d')](_0xcffd('0x6c'))},'attachments':[]};if(_0x53bae0['cc']){_0x41676b['headers']['Cc']=_0x53bae0['cc'];}if(_0x53bae0['bcc']){_0x41676b[_0xcffd('0x6d')][_0xcffd('0x6e')]=_0x53bae0[_0xcffd('0x63')];}return new BPromise(function(_0x248e5b,_0x4e20b1){if(_0x53bae0[_0xcffd('0x6f')]){for(var _0x12f197=0x0;_0x12f197<_0x53bae0[_0xcffd('0x6f')][_0xcffd('0x36')];_0x12f197++){var _0x447a47=_0x53bae0[_0xcffd('0x6f')][_0x12f197];var _0x51d378=path['join'](_0x490374,_0x447a47[_0xcffd('0x70')]);if(fs[_0xcffd('0x71')](_0x51d378)){_0x41676b[_0xcffd('0x5f')]['push']({'name':_0x447a47[_0xcffd('0x23')],'contentType':_0x447a47[_0xcffd('0x29')],'data':fs['readFileSync'](_0x51d378)});}}}emlformat[_0xcffd('0x72')](_0x41676b,function(_0x9d6794,_0x83970f){if(_0x9d6794)return _0x4e20b1(_0x9d6794);fs[_0xcffd('0x73')](path[_0xcffd('0x59')](_0xba8af4,util[_0xcffd('0x5d')](_0xcffd('0x74'),_0x255cb1)),_0x83970f);return _0x248e5b(_0x83970f);});});})[_0xcffd('0x1f')](function(){return new BPromise(function(_0x117865,_0x40acfc){zipdir(_0xba8af4,{'saveTo':_0x3eda9c},function(_0x3cb65d,_0xd8f236){if(_0x3cb65d)return _0x40acfc(_0x3cb65d);return _0x117865(_0xd8f236);});})['then'](function(){return new BPromise(function(_0x313666,_0x2c882f){rimraf(_0xba8af4,function(_0x2b590b){if(_0x2b590b)_0x2c882f(_0x2b590b);return _0x313666();});});})['then'](function(){return _0x2a5c77['download'](_0x3eda9c,_0xc474ac,function(_0x1fe907){if(!_0x1fe907)fs['unlinkSync'](_0x3eda9c);});});});}else{return _0x2a5c77[_0xcffd('0x16')](0xc8);}})[_0xcffd('0x3b')](handleError(_0x2a5c77,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 4b9a90b..a30727e 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 _0xbe95=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','getUsers','then','setDataValue','map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x34c9b3,_0x347a5c){var _0x36ff0e=function(_0x272bc1){while(--_0x272bc1){_0x34c9b3['push'](_0x34c9b3['shift']());}};_0x36ff0e(++_0x347a5c);}(_0xbe95,0x10d));var _0x5be9=function(_0x35f634,_0x3ad2e7){_0x35f634=_0x35f634-0x0;var _0x38fb4e=_0xbe95[_0x35f634];return _0x38fb4e;};'use strict';var EventEmitter=require(_0x5be9('0x0'));var MailInteraction=require(_0x5be9('0x1'))['db'][_0x5be9('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x5be9('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5be9('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b0301){return function(_0x198cc8,_0x27d1c9,_0x4ae284){_0x198cc8[_0x5be9('0x5')]({'attributes':['id'],'raw':!![]})[_0x5be9('0x6')](function(_0x4ff3fb){_0x198cc8[_0x5be9('0x7')]('Users',_0x4ff3fb[_0x5be9('0x8')](function(_0x58223c){return{'id':_0x58223c['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x198cc8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5be9('0x6')](function(_0x56bf79){_0x198cc8['setDataValue'](_0x5be9('0x9'),_0x56bf79['length']);MailInteractionEvents['emit'](_0x1b0301+':'+_0x198cc8['id'],_0x198cc8);MailInteractionEvents[_0x5be9('0xa')](_0x1b0301,_0x198cc8);_0x4ae284(null);})[_0x5be9('0xb')](_0x4ae284(null));};}for(var e in events){if(events[_0x5be9('0xc')](e)){var event=events[e];MailInteraction[_0x5be9('0xd')](e,emitEvent(event));}}module[_0x5be9('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xfc63=['then','unreadMessages','length','catch','hasOwnProperty','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','setDataValue','Users','map','findAll'];(function(_0x4adb8a,_0x3d76de){var _0x13804c=function(_0x1886f7){while(--_0x1886f7){_0x4adb8a['push'](_0x4adb8a['shift']());}};_0x13804c(++_0x3d76de);}(_0xfc63,0x185));var _0x3fc6=function(_0x146a0b,_0x3e2164){_0x146a0b=_0x146a0b-0x0;var _0x2196b6=_0xfc63[_0x146a0b];return _0x2196b6;};'use strict';var EventEmitter=require(_0x3fc6('0x0'));var MailInteraction=require(_0x3fc6('0x1'))['db'][_0x3fc6('0x2')];var MailMessage=require(_0x3fc6('0x1'))['db'][_0x3fc6('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3fc6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fc6('0x5'),'afterDestroy':_0x3fc6('0x6')};function emitEvent(_0x2fdd6f){return function(_0x562df4,_0x4def29,_0x309b94){_0x562df4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2ff8a9){_0x562df4[_0x3fc6('0x7')](_0x3fc6('0x8'),_0x2ff8a9[_0x3fc6('0x9')](function(_0x456bd){return{'id':_0x456bd['id']};}));return MailMessage[_0x3fc6('0xa')]({'where':{'MailInteractionId':_0x562df4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3fc6('0xb')](function(_0x256d1e){_0x562df4[_0x3fc6('0x7')](_0x3fc6('0xc'),_0x256d1e[_0x3fc6('0xd')]);MailInteractionEvents['emit'](_0x2fdd6f+':'+_0x562df4['id'],_0x562df4);MailInteractionEvents['emit'](_0x2fdd6f,_0x562df4);_0x309b94(null);})[_0x3fc6('0xe')](_0x309b94(null));};}for(var e in events){if(events[_0x3fc6('0xf')](e)){var event=events[e];MailInteraction['hook'](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 34704a4..0045c43 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 _0x263b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch'];(function(_0x36784d,_0x59fd7a){var _0x40257a=function(_0x15d859){while(--_0x15d859){_0x36784d['push'](_0x36784d['shift']());}};_0x40257a(++_0x59fd7a);}(_0x263b,0x74));var _0xb263=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x263b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb263('0x0'));var util=require(_0xb263('0x1'));var logger=require(_0xb263('0x2'))(_0xb263('0x3'));var moment=require(_0xb263('0x4'));var BPromise=require(_0xb263('0x5'));var rp=require(_0xb263('0x6'));var fs=require('fs');var path=require(_0xb263('0x7'));var rimraf=require(_0xb263('0x8'));var config=require(_0xb263('0x9'));var attributes=require(_0xb263('0xa'));module['exports']=function(_0x446edc,_0x472b92){return _0x446edc[_0xb263('0xb')]('MailInteraction',attributes,{'tableName':_0xb263('0xc'),'paranoid':![],'indexes':[{'name':_0xb263('0xd'),'fields':[_0xb263('0xe'),'to'],'type':_0xb263('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x351ad2,_0x42a8b5,_0x41cb5a){if(_0x351ad2[_0xb263('0x10')]){_0x351ad2[_0xb263('0x11')]=moment()[_0xb263('0x12')](_0xb263('0x13'));}if(_0x351ad2[_0xb263('0x14')]){_0x351ad2[_0xb263('0x15')]=moment()['format'](_0xb263('0x13'));}_0x41cb5a(null,_0x42a8b5);},'beforeUpdate':function(_0x3c4e99,_0xfd1a88,_0x332a04){if(_0x3c4e99[_0xb263('0x16')](_0xb263('0x10'))){_0x3c4e99[_0xb263('0x11')]=_0x3c4e99[_0xb263('0x10')]?moment()['format'](_0xb263('0x13')):null;}if(_0x3c4e99['changed'](_0xb263('0x14'))){_0x3c4e99[_0xb263('0x15')]=moment()[_0xb263('0x12')](_0xb263('0x13'));_0x3c4e99[_0xb263('0x10')]=null;_0x3c4e99[_0xb263('0x11')]=null;}_0x332a04(null,_0x3c4e99);},'afterUpdate':function(_0x37dc2e,_0x2b7c44,_0x287acb){var _0x30f8fe=_0x446edc[_0xb263('0x17')];var _0x3d2271=_0x37dc2e[_0xb263('0x18')]({'plain':!![]});if(_0x3d2271[_0xb263('0x14')]){return _0x30f8fe[_0xb263('0x19')][_0xb263('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x3d2271['id']}})[_0xb263('0x1b')](function(){_0x287acb();})[_0xb263('0x1c')](function(_0x8a6d97){_0x287acb(_0x8a6d97);});}else{_0x287acb();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x56ea=['api','moment','bluebird','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x31e4c1,_0x383bd2){var _0x537607=function(_0x54600e){while(--_0x54600e){_0x31e4c1['push'](_0x31e4c1['shift']());}};_0x537607(++_0x383bd2);}(_0x56ea,0x1da));var _0xa56e=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0x56ea[_0x26a906];return _0x495575;};'use strict';var _=require(_0xa56e('0x0'));var util=require(_0xa56e('0x1'));var logger=require('../../config/logger')(_0xa56e('0x2'));var moment=require(_0xa56e('0x3'));var BPromise=require(_0xa56e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa56e('0x5'));var attributes=require('./mailInteraction.attributes');module[_0xa56e('0x6')]=function(_0x3d54d8,_0x25b48e){return _0x3d54d8[_0xa56e('0x7')](_0xa56e('0x8'),attributes,{'tableName':_0xa56e('0x9'),'paranoid':![],'indexes':[{'name':_0xa56e('0xa'),'fields':[_0xa56e('0xb'),'to'],'type':_0xa56e('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5cd663,_0x37cc7e,_0x321991){if(_0x5cd663[_0xa56e('0xd')]){_0x5cd663[_0xa56e('0xe')]=moment()[_0xa56e('0xf')](_0xa56e('0x10'));}if(_0x5cd663[_0xa56e('0x11')]){_0x5cd663['closedAt']=moment()[_0xa56e('0xf')](_0xa56e('0x10'));}_0x321991(null,_0x37cc7e);},'beforeUpdate':function(_0x5e9984,_0x5c2c5a,_0x447196){if(_0x5e9984[_0xa56e('0x12')](_0xa56e('0xd'))){_0x5e9984[_0xa56e('0xe')]=_0x5e9984[_0xa56e('0xd')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x5e9984[_0xa56e('0x12')](_0xa56e('0x11'))){_0x5e9984[_0xa56e('0x13')]=moment()[_0xa56e('0xf')](_0xa56e('0x10'));_0x5e9984[_0xa56e('0xd')]=null;_0x5e9984['substatusAt']=null;}_0x447196(null,_0x5e9984);},'afterUpdate':function(_0x4dc7c4,_0x29bc5f,_0x2561a9){var _0x570f51=_0x3d54d8[_0xa56e('0x14')];var _0xfd88ea=_0x4dc7c4[_0xa56e('0x15')]({'plain':!![]});if(_0xfd88ea[_0xa56e('0x11')]){return _0x570f51[_0xa56e('0x16')][_0xa56e('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0xfd88ea['id']}})[_0xa56e('0x18')](function(){_0x2561a9();})[_0xa56e('0x19')](function(_0x228093){_0x2561a9(_0x228093);});}else{_0x2561a9();}}},'charset':_0xa56e('0x1a'),'collate':_0xa56e('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index e8fdb74..f5b2a09 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 _0x0852=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./mailInteraction.socket','request','then','info'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0852,0x108));var _0x2085=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x0852[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x2085('0x0'));var util=require('util');var moment=require(_0x2085('0x1'));var BPromise=require(_0x2085('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2085('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2085('0x4'));var logger=require(_0x2085('0x5'))(_0x2085('0x6'));var config=require('../../config/environment');var jayson=require(_0x2085('0x7'));var client=jayson['client'][_0x2085('0x8')]({'port':0x232a});config[_0x2085('0x9')]=_[_0x2085('0xa')](config[_0x2085('0x9')],{'host':_0x2085('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2085('0x9')]));require(_0x2085('0xc'))['register'](socket);function respondWithRpcPromise(_0x11c676,_0x202b56,_0x24ba6a){return new BPromise(function(_0xe39911,_0x26d187){return client[_0x2085('0xd')](_0x11c676,_0x24ba6a)[_0x2085('0xe')](function(_0x939848){logger[_0x2085('0xf')]('MailInteraction,\x20%s,\x20%s',_0x202b56,'request\x20sent');logger[_0x2085('0x10')](_0x2085('0x11'),_0x202b56,'request\x20sent',JSON[_0x2085('0x12')](_0x939848));if(_0x939848[_0x2085('0x13')]){if(_0x939848[_0x2085('0x13')][_0x2085('0x14')]===0x1f4){logger[_0x2085('0x13')](_0x2085('0x15'),_0x202b56,_0x939848[_0x2085('0x13')][_0x2085('0x16')]);return _0x26d187(_0x939848[_0x2085('0x13')][_0x2085('0x16')]);}logger[_0x2085('0x13')](_0x2085('0x15'),_0x202b56,_0x939848[_0x2085('0x13')][_0x2085('0x16')]);return _0xe39911(_0x939848['error'][_0x2085('0x16')]);}else{logger[_0x2085('0xf')]('MailInteraction,\x20%s,\x20%s',_0x202b56,_0x2085('0x17'));_0xe39911(_0x939848[_0x2085('0x18')][_0x2085('0x16')]);}})[_0x2085('0x19')](function(_0x287976){logger[_0x2085('0x13')](_0x2085('0x15'),_0x202b56,_0x287976);_0x26d187(_0x287976);});});}exports['UpdateMailInteraction']=function(_0x3f585c){var _0x4faa53=this;return new Promise(function(_0x1fad14,_0x3f8544){return db[_0x2085('0x1a')][_0x2085('0x1b')](_0x3f585c[_0x2085('0x1c')],{'raw':_0x3f585c[_0x2085('0x1d')]?_0x3f585c[_0x2085('0x1d')][_0x2085('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f585c[_0x2085('0x1d')]?_0x3f585c['options'][_0x2085('0x1f')]||null:null,'attributes':_0x3f585c['options']?_0x3f585c[_0x2085('0x1d')][_0x2085('0x20')]||null:null,'limit':_0x3f585c['options']?_0x3f585c['options'][_0x2085('0x21')]||null:null})[_0x2085('0xe')](function(_0x37d84d){logger[_0x2085('0xf')]('UpdateMailInteraction',_0x3f585c);logger[_0x2085('0x10')](_0x2085('0x22'),_0x3f585c,JSON[_0x2085('0x12')](_0x37d84d));_0x1fad14(_0x37d84d);})[_0x2085('0x19')](function(_0x2cdee1){logger[_0x2085('0x13')](_0x2085('0x22'),_0x2cdee1[_0x2085('0x16')],_0x3f585c);_0x3f8544(_0x4faa53[_0x2085('0x13')](0x1f4,_0x2cdee1['message']));});});};exports['AddTagsToMailInteraction']=function(_0x4224a6){return new Promise(function(_0x2d18f3,_0x18aadd){return db[_0x2085('0x1a')][_0x2085('0x23')]({'where':_0x4224a6['options']?_0x4224a6[_0x2085('0x1d')]['where']||null:null})['then'](function(_0x2f4467){if(_0x2f4467){return _0x2f4467[_0x2085('0x24')](_0x4224a6['body'][_0x2085('0x25')],_['omit'](_0x4224a6[_0x2085('0x1c')],[_0x2085('0x25'),'id'])||{});}})[_0x2085('0x26')](function(_0x545592){logger['info']('AddTags',_0x4224a6);logger[_0x2085('0x10')](_0x2085('0x27'),_0x4224a6,JSON[_0x2085('0x12')](_0x545592));_0x2d18f3(_0x545592);})[_0x2085('0x19')](function(_0xeb8d19){logger[_0x2085('0x13')](_0x2085('0x27'),_0xeb8d19[_0x2085('0x16')],_0x4224a6);_0x18aadd(_this[_0x2085('0x13')](0x1f4,_0xeb8d19['message']));});});}; \ No newline at end of file +var _0x792a=['attributes','limit','then','UpdateMailInteraction','catch','AddTagsToMailInteraction','find','where','addTags','ids','spread','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailInteraction','update','body','options'];(function(_0x50e4ac,_0x37ba99){var _0x5ae695=function(_0x131708){while(--_0x131708){_0x50e4ac['push'](_0x50e4ac['shift']());}};_0x5ae695(++_0x37ba99);}(_0x792a,0xe8));var _0xa792=function(_0x124acf,_0x112d18){_0x124acf=_0x124acf-0x0;var _0x251e0b=_0x792a[_0x124acf];return _0x251e0b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa792('0x0'));var BPromise=require(_0xa792('0x1'));var rs=require(_0xa792('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa792('0x3'))['db'];var utils=require(_0xa792('0x4'));var logger=require(_0xa792('0x5'))(_0xa792('0x6'));var config=require(_0xa792('0x7'));var jayson=require(_0xa792('0x8'));var client=jayson[_0xa792('0x9')][_0xa792('0xa')]({'port':0x232a});config[_0xa792('0xb')]=_[_0xa792('0xc')](config['redis'],{'host':_0xa792('0xd'),'port':0x18eb});var socket=require(_0xa792('0xe'))(new Redis(config[_0xa792('0xb')]));require(_0xa792('0xf'))[_0xa792('0x10')](socket);function respondWithRpcPromise(_0x3f321d,_0x5d815b,_0x37a66e){return new BPromise(function(_0xb81214,_0x207e97){return client[_0xa792('0x11')](_0x3f321d,_0x37a66e)['then'](function(_0x541d3b){logger[_0xa792('0x12')](_0xa792('0x13'),_0x5d815b,'request\x20sent');logger[_0xa792('0x14')](_0xa792('0x15'),_0x5d815b,_0xa792('0x16'),JSON[_0xa792('0x17')](_0x541d3b));if(_0x541d3b[_0xa792('0x18')]){if(_0x541d3b[_0xa792('0x18')][_0xa792('0x19')]===0x1f4){logger[_0xa792('0x18')]('MailInteraction,\x20%s,\x20%s',_0x5d815b,_0x541d3b[_0xa792('0x18')][_0xa792('0x1a')]);return _0x207e97(_0x541d3b[_0xa792('0x18')][_0xa792('0x1a')]);}logger[_0xa792('0x18')](_0xa792('0x13'),_0x5d815b,_0x541d3b[_0xa792('0x18')][_0xa792('0x1a')]);return _0xb81214(_0x541d3b['error'][_0xa792('0x1a')]);}else{logger[_0xa792('0x12')]('MailInteraction,\x20%s,\x20%s',_0x5d815b,'request\x20sent');_0xb81214(_0x541d3b[_0xa792('0x1b')][_0xa792('0x1a')]);}})['catch'](function(_0x12370d){logger['error']('MailInteraction,\x20%s,\x20%s',_0x5d815b,_0x12370d);_0x207e97(_0x12370d);});});}exports['UpdateMailInteraction']=function(_0x16a32b){var _0x5c8510=this;return new Promise(function(_0x3a44ba,_0x2223c6){return db[_0xa792('0x1c')][_0xa792('0x1d')](_0x16a32b[_0xa792('0x1e')],{'raw':_0x16a32b['options']?_0x16a32b[_0xa792('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16a32b[_0xa792('0x1f')]?_0x16a32b[_0xa792('0x1f')]['where']||null:null,'attributes':_0x16a32b['options']?_0x16a32b[_0xa792('0x1f')][_0xa792('0x20')]||null:null,'limit':_0x16a32b[_0xa792('0x1f')]?_0x16a32b[_0xa792('0x1f')][_0xa792('0x21')]||null:null})[_0xa792('0x22')](function(_0x480bab){logger[_0xa792('0x12')](_0xa792('0x23'),_0x16a32b);logger[_0xa792('0x14')](_0xa792('0x23'),_0x16a32b,JSON['stringify'](_0x480bab));_0x3a44ba(_0x480bab);})[_0xa792('0x24')](function(_0x4bc06c){logger[_0xa792('0x18')]('UpdateMailInteraction',_0x4bc06c[_0xa792('0x1a')],_0x16a32b);_0x2223c6(_0x5c8510[_0xa792('0x18')](0x1f4,_0x4bc06c[_0xa792('0x1a')]));});});};exports[_0xa792('0x25')]=function(_0x2db814){return new Promise(function(_0x754d10,_0x42884c){return db['MailInteraction'][_0xa792('0x26')]({'where':_0x2db814['options']?_0x2db814[_0xa792('0x1f')][_0xa792('0x27')]||null:null})[_0xa792('0x22')](function(_0x6d761e){if(_0x6d761e){return _0x6d761e[_0xa792('0x28')](_0x2db814[_0xa792('0x1e')][_0xa792('0x29')],_['omit'](_0x2db814[_0xa792('0x1e')],[_0xa792('0x29'),'id'])||{});}})[_0xa792('0x2a')](function(_0x51f9c3){logger[_0xa792('0x12')]('AddTags',_0x2db814);logger[_0xa792('0x14')](_0xa792('0x2b'),_0x2db814,JSON[_0xa792('0x17')](_0x51f9c3));_0x754d10(_0x51f9c3);})[_0xa792('0x24')](function(_0x14d948){logger[_0xa792('0x18')](_0xa792('0x2b'),_0x14d948[_0xa792('0x1a')],_0x2db814);_0x42884c(_this[_0xa792('0x18')](0x1f4,_0x14d948[_0xa792('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 92078ed..a93d781 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 _0x5adb=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5adb,0x1d6));var _0xb5ad=function(_0x40f355,_0x27fac0){_0x40f355=_0x40f355-0x0;var _0x1ebb62=_0x5adb[_0x40f355];return _0x1ebb62;};'use strict';var MailInteractionEvents=require(_0xb5ad('0x0'));var events=['save',_0xb5ad('0x1'),_0xb5ad('0x2')];function createListener(_0x4e5d83,_0x25b8ba){return function(_0x55a394){_0x25b8ba[_0xb5ad('0x3')](_0x4e5d83,_0x55a394);};}function removeListener(_0x37869e,_0x280dae){return function(){MailInteractionEvents[_0xb5ad('0x4')](_0x37869e,_0x280dae);};}exports[_0xb5ad('0x5')]=function(_0x410155){for(var _0x17c4ee=0x0,_0x3ef641=events[_0xb5ad('0x6')];_0x17c4ee<_0x3ef641;_0x17c4ee++){var _0x74a3c1=events[_0x17c4ee];var _0x28a5f6=createListener(_0xb5ad('0x7')+_0x74a3c1,_0x410155);MailInteractionEvents['on'](_0x74a3c1,_0x28a5f6);}}; \ No newline at end of file +var _0x176e=['emit','length','mailInteraction:','./mailInteraction.events','remove','update'];(function(_0x23d832,_0xdf291a){var _0x35c717=function(_0x3bff36){while(--_0x3bff36){_0x23d832['push'](_0x23d832['shift']());}};_0x35c717(++_0xdf291a);}(_0x176e,0xb7));var _0xe176=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x176e[_0x160c73];return _0xd9302;};'use strict';var MailInteractionEvents=require(_0xe176('0x0'));var events=['save',_0xe176('0x1'),_0xe176('0x2')];function createListener(_0x5113f4,_0x133264){return function(_0x16d8e7){_0x133264[_0xe176('0x3')](_0x5113f4,_0x16d8e7);};}function removeListener(_0x43fc6e,_0x52215d){return function(){MailInteractionEvents['removeListener'](_0x43fc6e,_0x52215d);};}exports['register']=function(_0x383e60){for(var _0x5b19db=0x0,_0x349629=events[_0xe176('0x4')];_0x5b19db<_0x349629;_0x5b19db++){var _0x25f113=events[_0x5b19db];var _0x57b1c1=createListener(_0xe176('0x5')+_0x25f113,_0x383e60);MailInteractionEvents['on'](_0x25f113,_0x57b1c1);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 38284eb..cd955d1 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 _0xac7f=['reject','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','/:id','/:id/download','post','tracked','mail','mailmessage:create','put','update','/:id/accept'];(function(_0x541528,_0x332d15){var _0x1fcbce=function(_0x37bdb9){while(--_0x37bdb9){_0x541528['push'](_0x541528['shift']());}};_0x1fcbce(++_0x332d15);}(_0xac7f,0x1e2));var _0xfac7=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xac7f[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0xfac7('0x0'));var util=require('util');var path=require(_0xfac7('0x1'));var timeout=require(_0xfac7('0x2'));var express=require(_0xfac7('0x3'));var router=express['Router']();var fs_extra=require(_0xfac7('0x4'));var auth=require(_0xfac7('0x5'));var interaction=require(_0xfac7('0x6'));var config=require(_0xfac7('0x7'));var controller=require(_0xfac7('0x8'));router[_0xfac7('0x9')]('/',auth['isAuthenticated'](),controller[_0xfac7('0xa')]);router['get'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller['describe']);router[_0xfac7('0x9')](_0xfac7('0xd'),auth[_0xfac7('0xc')](),controller['show']);router[_0xfac7('0x9')](_0xfac7('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xfac7('0xf')]('/',auth[_0xfac7('0xc')](),interaction[_0xfac7('0x10')](_0xfac7('0x11'),_0xfac7('0x12')),controller['create']);router[_0xfac7('0x13')](_0xfac7('0xd'),auth[_0xfac7('0xc')](),controller[_0xfac7('0x14')]);router[_0xfac7('0x13')](_0xfac7('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xfac7('0x13')]('/:id/reject',auth[_0xfac7('0xc')](),controller[_0xfac7('0x16')]);router['delete'](_0xfac7('0xd'),auth[_0xfac7('0xc')](),controller['destroy']);module[_0xfac7('0x17')]=router; \ No newline at end of file +var _0xf45e=['get','isAuthenticated','index','/describe','describe','/:id','show','download','post','tracked','mail','create','put','update','/:id/reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller'];(function(_0x1f08b6,_0x5f9107){var _0x3a9cbf=function(_0x53ae26){while(--_0x53ae26){_0x1f08b6['push'](_0x1f08b6['shift']());}};_0x3a9cbf(++_0x5f9107);}(_0xf45e,0x115));var _0xef45=function(_0x31c879,_0x30ee98){_0x31c879=_0x31c879-0x0;var _0xbfba3d=_0xf45e[_0x31c879];return _0xbfba3d;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var fs_extra=require(_0xef45('0x4'));var auth=require(_0xef45('0x5'));var interaction=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var controller=require(_0xef45('0x8'));router[_0xef45('0x9')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0x9')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0x9')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);router[_0xef45('0x9')]('/:id/download',auth[_0xef45('0xa')](),controller[_0xef45('0x10')]);router[_0xef45('0x11')]('/',auth[_0xef45('0xa')](),interaction[_0xef45('0x12')](_0xef45('0x13'),'mailmessage:create'),controller[_0xef45('0x14')]);router[_0xef45('0x15')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0x16')]);router['put']('/:id/accept',auth[_0xef45('0xa')](),controller['accept']);router[_0xef45('0x15')](_0xef45('0x17'),auth[_0xef45('0xa')](),controller['reject']);router['delete'](_0xef45('0xe'),auth['isAuthenticated'](),controller[_0xef45('0x18')]);module[_0xef45('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index a12c00f..69887cf 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 _0xc4ef=['exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash'];(function(_0x4ab2b1,_0x31940e){var _0x50b9bc=function(_0x1f7bbc){while(--_0x1f7bbc){_0x4ab2b1['push'](_0x4ab2b1['shift']());}};_0x50b9bc(++_0x31940e);}(_0xc4ef,0x186));var _0xfc4e=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0xc4ef[_0x5ad0d7];return _0xd83bd;};'use strict';var Sequelize=require(_0xfc4e('0x0'));var _=require(_0xfc4e('0x1'));module[_0xfc4e('0x2')]={'body':{'type':Sequelize[_0xfc4e('0x3')](_0xfc4e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xfc4e('0x5'))},'read':{'type':Sequelize[_0xfc4e('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfc4e('0x7')]('in',_0xfc4e('0x8')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xfc4e('0x9')](0x1fe)},'from':{'type':Sequelize[_0xfc4e('0x9')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0xfc4e('0x3')](_0xfc4e('0x4'))},'bcc':{'type':Sequelize[_0xfc4e('0x3')](_0xfc4e('0x4'))},'subject':{'type':Sequelize[_0xfc4e('0x3')]},'sentAt':{'type':Sequelize[_0xfc4e('0xa')]},'attach':{'type':Sequelize[_0xfc4e('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfc4e('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xfc4e('0x3')]('long')},'originCc':{'type':Sequelize['TEXT'](_0xfc4e('0x4'))},'originChannel':{'type':Sequelize[_0xfc4e('0x7')](_0xfc4e('0xc'),_0xfc4e('0xd')),'defaultValue':_0xfc4e('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x6b57=['lodash','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','Email','sequelize'];(function(_0x1661bd,_0x119281){var _0x293c2f=function(_0x5b7f16){while(--_0x5b7f16){_0x1661bd['push'](_0x1661bd['shift']());}};_0x293c2f(++_0x119281);}(_0x6b57,0x17b));var _0x76b5=function(_0x543533,_0x5f2eee){_0x543533=_0x543533-0x0;var _0x295b79=_0x6b57[_0x543533];return _0x295b79;};'use strict';var Sequelize=require(_0x76b5('0x0'));var _=require(_0x76b5('0x1'));module['exports']={'body':{'type':Sequelize[_0x76b5('0x2')](_0x76b5('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x76b5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x76b5('0x5')]('in','out'),'defaultValue':_0x76b5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x76b5('0x7')](0x1fe)},'from':{'type':Sequelize[_0x76b5('0x7')]},'to':{'type':Sequelize[_0x76b5('0x2')](_0x76b5('0x3'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x76b5('0x2')]},'sentAt':{'type':Sequelize[_0x76b5('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x76b5('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x76b5('0x8')]},'originTo':{'type':Sequelize[_0x76b5('0x2')](_0x76b5('0x3'))},'originCc':{'type':Sequelize[_0x76b5('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x76b5('0x9'),'Chat'),'defaultValue':_0x76b5('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 9148f91..24ac8bf 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 _0xffe3=['socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','json','offset','undefined','count','limit','Content-Range','update','destroy','stack','name','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','filter','includeAll','findAll','rows','show','params','length','include','options','find','body','describe','create','out','secret','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','reject','RejectMessage','rejectMessage','ContactId','fromString','download','toString','server','tmp','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','readFileSync','build','unlinkSync','moment','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis'];(function(_0x4a74e8,_0xb3cafa){var _0xba9564=function(_0x280eab){while(--_0x280eab){_0x4a74e8['push'](_0x4a74e8['shift']());}};_0xba9564(++_0xb3cafa);}(_0xffe3,0x1ab));var _0x3ffe=function(_0x151b08,_0x259eea){_0x151b08=_0x151b08-0x0;var _0x1562b4=_0xffe3[_0x151b08];return _0x1562b4;};'use strict';var emlformat=require('eml-format');var moment=require(_0x3ffe('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x3ffe('0x1'));var fs=require('fs');var _=require(_0x3ffe('0x2'));var Redis=require('ioredis');var htmlToText=require(_0x3ffe('0x3'));var qs=require(_0x3ffe('0x4'));var logger=require('../../config/logger')('api');var interaction_log=require(_0x3ffe('0x5'))(_0x3ffe('0x6'));var config=require(_0x3ffe('0x7'));var db=require(_0x3ffe('0x8'))['db'];config['redis']=_[_0x3ffe('0x9')](config[_0x3ffe('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ffe('0xb'))(new Redis(config[_0x3ffe('0xa')]));var htmlEntities=require(_0x3ffe('0xc'));require(_0x3ffe('0xd'))['register'](socket);var jayson=require(_0x3ffe('0xe'));var client=jayson[_0x3ffe('0xf')][_0x3ffe('0x10')]({'port':0x232c});var client9003=jayson[_0x3ffe('0xf')]['http']({'port':0x232b});var client9002=jayson[_0x3ffe('0xf')][_0x3ffe('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x2df04f,_0x4163e1,_0x20cc5b,_0x498264){return new BPromise(function(_0x38169b,_0x1fdbcc){var _0xf592b3=_0x498264||client;return _0xf592b3[_0x3ffe('0x11')](_0x2df04f,_0x20cc5b)[_0x3ffe('0x12')](function(_0x7b08f7){logger[_0x3ffe('0x13')](_0x3ffe('0x14'),_0x4163e1,'request\x20sent');logger['debug'](_0x3ffe('0x15'),_0x4163e1,_0x3ffe('0x16'),JSON['stringify'](_0x7b08f7));if(_0x7b08f7[_0x3ffe('0x17')]){if(_0x7b08f7[_0x3ffe('0x17')][_0x3ffe('0x18')]===0x1f4){logger[_0x3ffe('0x17')]('MailMessage,\x20%s,\x20%s',_0x4163e1,_0x7b08f7[_0x3ffe('0x17')][_0x3ffe('0x19')]);return _0x1fdbcc(_0x7b08f7[_0x3ffe('0x17')][_0x3ffe('0x19')]);}logger[_0x3ffe('0x17')](_0x3ffe('0x14'),_0x4163e1,_0x7b08f7['error'][_0x3ffe('0x19')]);return _0x38169b(_0x7b08f7[_0x3ffe('0x17')]['message']);}else{logger['info'](_0x3ffe('0x14'),_0x4163e1,_0x3ffe('0x16'));_0x38169b(_0x7b08f7[_0x3ffe('0x1a')][_0x3ffe('0x19')]);}})[_0x3ffe('0x1b')](function(_0x1e6958){logger[_0x3ffe('0x17')](_0x3ffe('0x14'),_0x4163e1,_0x1e6958);_0x1fdbcc(_0x1e6958);});});}function respondWithResult(_0x39d523,_0x555f01){_0x555f01=_0x555f01||0xc8;return function(_0x28dcef){if(_0x28dcef){return _0x39d523[_0x3ffe('0x1c')](_0x555f01)[_0x3ffe('0x1d')](_0x28dcef);}};}function respondWithFilteredResult(_0x3d5ca2,_0x15101e){return function(_0x30d569){if(_0x30d569){var _0x1622df=typeof _0x15101e[_0x3ffe('0x1e')]===_0x3ffe('0x1f')&&typeof _0x15101e['limit']==='undefined';var _0x18850d=_0x30d569['count'];var _0x3b0c11=_0x1622df?0x0:_0x15101e[_0x3ffe('0x1e')];var _0x4ccbb5=_0x1622df?_0x30d569[_0x3ffe('0x20')]:_0x15101e[_0x3ffe('0x1e')]+_0x15101e[_0x3ffe('0x21')];var _0x2f7967;if(_0x4ccbb5>=_0x18850d){_0x4ccbb5=_0x18850d;_0x2f7967=0xc8;}else{_0x2f7967=0xce;}_0x3d5ca2[_0x3ffe('0x1c')](_0x2f7967);return _0x3d5ca2['set'](_0x3ffe('0x22'),_0x3b0c11+'-'+_0x4ccbb5+'/'+_0x18850d)[_0x3ffe('0x1d')](_0x30d569);}return null;};}function saveUpdates(_0x4a076f){return function(_0x2e924b){if(_0x2e924b){return _0x2e924b[_0x3ffe('0x23')](_0x4a076f)['then'](function(_0x24da4b){return _0x24da4b;});}return null;};}function removeEntity(_0x4e97aa){return function(_0x3a60c1){if(_0x3a60c1){return _0x3a60c1[_0x3ffe('0x24')]()[_0x3ffe('0x12')](function(){_0x4e97aa[_0x3ffe('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4046ac){return function(_0xc916c3){if(!_0xc916c3){_0x4046ac['sendStatus'](0x194);}return _0xc916c3;};}function handleError(_0x334935,_0x33a6b1){_0x33a6b1=_0x33a6b1||0x1f4;return function(_0x5b736c){logger[_0x3ffe('0x17')](_0x5b736c[_0x3ffe('0x25')]);if(_0x5b736c[_0x3ffe('0x26')]){delete _0x5b736c[_0x3ffe('0x26')];}_0x334935[_0x3ffe('0x1c')](_0x33a6b1)['send'](_0x5b736c);};}exports['index']=function(_0x57bd35,_0x91263b){var _0x1d04f5={},_0x33ac3a={},_0x3195a1={'count':0x0,'rows':[]};var _0x482f5a=_[_0x3ffe('0x27')](db[_0x3ffe('0x28')][_0x3ffe('0x29')],function(_0x4cc468){return{'name':_0x4cc468[_0x3ffe('0x2a')],'type':_0x4cc468[_0x3ffe('0x2b')]['key']};});_0x33ac3a[_0x3ffe('0x2c')]=_[_0x3ffe('0x27')](_0x482f5a,_0x3ffe('0x26'));_0x33ac3a[_0x3ffe('0x2d')]=_[_0x3ffe('0x2e')](_0x57bd35[_0x3ffe('0x2d')]);_0x33ac3a[_0x3ffe('0x2f')]=_[_0x3ffe('0x30')](_0x33ac3a[_0x3ffe('0x2c')],_0x33ac3a[_0x3ffe('0x2d')]);_0x1d04f5[_0x3ffe('0x31')]=_['intersection'](_0x33ac3a[_0x3ffe('0x2c')],qs[_0x3ffe('0x32')](_0x57bd35[_0x3ffe('0x2d')][_0x3ffe('0x32')]));_0x1d04f5['attributes']=_0x1d04f5[_0x3ffe('0x31')]['length']?_0x1d04f5[_0x3ffe('0x31')]:_0x33ac3a[_0x3ffe('0x2c')];if(!_0x57bd35[_0x3ffe('0x2d')][_0x3ffe('0x33')](_0x3ffe('0x34'))){_0x1d04f5[_0x3ffe('0x21')]=qs[_0x3ffe('0x21')](_0x57bd35[_0x3ffe('0x2d')][_0x3ffe('0x21')]);_0x1d04f5['offset']=qs[_0x3ffe('0x1e')](_0x57bd35['query'][_0x3ffe('0x1e')]);}_0x1d04f5[_0x3ffe('0x35')]=qs[_0x3ffe('0x36')](_0x57bd35[_0x3ffe('0x2d')][_0x3ffe('0x36')]);_0x1d04f5['where']=qs['filters'](_[_0x3ffe('0x37')](_0x57bd35[_0x3ffe('0x2d')],_0x33ac3a[_0x3ffe('0x2f')]),_0x482f5a);if(_0x57bd35[_0x3ffe('0x2d')]['filter']){_0x1d04f5[_0x3ffe('0x38')]=_['merge'](_0x1d04f5[_0x3ffe('0x38')],{'$or':_['map'](_0x482f5a,function(_0x26b583){if(_0x26b583['type']!=='VIRTUAL'){var _0x2d3c55={};_0x2d3c55[_0x26b583[_0x3ffe('0x26')]]={'$like':'%'+_0x57bd35[_0x3ffe('0x2d')][_0x3ffe('0x39')]+'%'};return _0x2d3c55;}})});}_0x1d04f5=_['merge']({},_0x1d04f5,_0x57bd35['options']);var _0x3c03e6={'where':_0x1d04f5[_0x3ffe('0x38')]};return db[_0x3ffe('0x28')][_0x3ffe('0x20')](_0x3c03e6)[_0x3ffe('0x12')](function(_0x20a75f){_0x3195a1['count']=_0x20a75f;if(_0x57bd35[_0x3ffe('0x2d')][_0x3ffe('0x3a')]){_0x1d04f5['include']=[{'all':!![]}];}return db[_0x3ffe('0x28')][_0x3ffe('0x3b')](_0x1d04f5);})[_0x3ffe('0x12')](function(_0x3e0880){_0x3195a1[_0x3ffe('0x3c')]=_0x3e0880;return _0x3195a1;})[_0x3ffe('0x12')](respondWithFilteredResult(_0x91263b,_0x1d04f5))['catch'](handleError(_0x91263b,null));};exports[_0x3ffe('0x3d')]=function(_0x3ec69f,_0x4b818d){var _0x8f70d={'raw':!![],'where':{'id':_0x3ec69f[_0x3ffe('0x3e')]['id']}},_0x30bfbe={};_0x30bfbe[_0x3ffe('0x2c')]=_['keys'](db[_0x3ffe('0x28')][_0x3ffe('0x29')]);_0x30bfbe[_0x3ffe('0x2d')]=_[_0x3ffe('0x2e')](_0x3ec69f[_0x3ffe('0x2d')]);_0x30bfbe['filters']=_[_0x3ffe('0x30')](_0x30bfbe['model'],_0x30bfbe[_0x3ffe('0x2d')]);_0x8f70d[_0x3ffe('0x31')]=_[_0x3ffe('0x30')](_0x30bfbe[_0x3ffe('0x2c')],qs[_0x3ffe('0x32')](_0x3ec69f[_0x3ffe('0x2d')][_0x3ffe('0x32')]));_0x8f70d[_0x3ffe('0x31')]=_0x8f70d[_0x3ffe('0x31')][_0x3ffe('0x3f')]?_0x8f70d['attributes']:_0x30bfbe[_0x3ffe('0x2c')];if(_0x3ec69f[_0x3ffe('0x2d')][_0x3ffe('0x3a')]){_0x8f70d[_0x3ffe('0x40')]=[{'all':!![]}];}_0x8f70d=_['merge']({},_0x8f70d,_0x3ec69f[_0x3ffe('0x41')]);return db['MailMessage'][_0x3ffe('0x42')](_0x8f70d)[_0x3ffe('0x12')](handleEntityNotFound(_0x4b818d,null))[_0x3ffe('0x12')](respondWithResult(_0x4b818d,null))[_0x3ffe('0x1b')](handleError(_0x4b818d,null));};exports[_0x3ffe('0x23')]=function(_0x2ff10a,_0x352186){if(_0x2ff10a[_0x3ffe('0x43')]['id']){delete _0x2ff10a[_0x3ffe('0x43')]['id'];}return db[_0x3ffe('0x28')]['find']({'where':{'id':_0x2ff10a[_0x3ffe('0x3e')]['id']}})[_0x3ffe('0x12')](handleEntityNotFound(_0x352186,null))[_0x3ffe('0x12')](saveUpdates(_0x2ff10a[_0x3ffe('0x43')],null))[_0x3ffe('0x12')](respondWithResult(_0x352186,null))[_0x3ffe('0x1b')](handleError(_0x352186,null));};exports['destroy']=function(_0x4aedcb,_0x213cb1){return db['MailMessage']['find']({'where':{'id':_0x4aedcb['params']['id']}})[_0x3ffe('0x12')](handleEntityNotFound(_0x213cb1,null))[_0x3ffe('0x12')](removeEntity(_0x213cb1,null))[_0x3ffe('0x1b')](handleError(_0x213cb1,null));};exports[_0x3ffe('0x44')]=function(_0x22f0f3,_0x1d4d72){return db[_0x3ffe('0x28')][_0x3ffe('0x44')]()['then'](respondWithResult(_0x1d4d72,null))[_0x3ffe('0x1b')](handleError(_0x1d4d72,null));};exports[_0x3ffe('0x45')]=function(_0x2bab3e,_0x8e4c98){return db[_0x3ffe('0x28')]['create'](_0x2bab3e['body'])['then'](function(_0x2bfed7){if(_0x2bfed7){if(_0x2bfed7['direction']===_0x3ffe('0x46')&&!_0x2bfed7[_0x3ffe('0x47')]){var _0x1187e5,_0x4a3cee,_0x1203ff;if(_0x2bab3e['body']['to']){_0x4a3cee=_0x2bab3e[_0x3ffe('0x43')]['to']['split'](',')[0x0];}return db[_0x3ffe('0x48')]['findOne']({'where':{'id':_0x2bfed7[_0x3ffe('0x49')]},'include':[{'model':db[_0x3ffe('0x4a')],'as':_0x3ffe('0x4b'),'include':[{'model':db[_0x3ffe('0x4c')],'as':_0x3ffe('0x4d'),'where':{'email':_0x4a3cee},'limit':0x1,'order':[[_0x3ffe('0x4e'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x3ffe('0x4f'),'raw':!![],'include':[{'model':db[_0x3ffe('0x50')],'as':_0x3ffe('0x50'),'raw':!![]}]}]})[_0x3ffe('0x12')](function(_0x11f043){_0x1187e5=_0x11f043;if(!_0x1187e5||!_0x1187e5[_0x3ffe('0x4f')])return;var _0x70a319=_0x1187e5[_0x3ffe('0x51')]();if(_0x2bab3e['body'][_0x3ffe('0x52')]&&_0x2bab3e['body'][_0x3ffe('0x52')][_0x3ffe('0x3f')]){for(var _0x4bb6f9=0x0;_0x4bb6f9<_0x2bab3e[_0x3ffe('0x43')]['attachments'][_0x3ffe('0x3f')];_0x4bb6f9+=0x1){_0x2bab3e[_0x3ffe('0x43')][_0x3ffe('0x52')][_0x4bb6f9]={'filename':_0x2bab3e[_0x3ffe('0x43')][_0x3ffe('0x52')][_0x4bb6f9][_0x3ffe('0x26')],'path':path[_0x3ffe('0x53')](config[_0x3ffe('0x54')],_0x3ffe('0x55'),_0x2bab3e[_0x3ffe('0x43')]['attachments'][_0x4bb6f9][_0x3ffe('0x56')])};}}_0x1203ff={'account':_0x70a319,'message':_0x2bab3e[_0x3ffe('0x43')]};return;})[_0x3ffe('0x12')](function(){if(_0x1187e5[_0x3ffe('0x4b')]){if(_0x1187e5[_0x3ffe('0x4b')]['Contacts']['length']){return _0x1187e5[_0x3ffe('0x4b')][_0x3ffe('0x4d')][0x0];}else{return db['CmContact']['create'](_[_0x3ffe('0x9')](_0x2bab3e[_0x3ffe('0x43')],{'firstName':_0x2bab3e[_0x3ffe('0x43')]['to'],'email':_0x2bab3e[_0x3ffe('0x43')]['to'],'phone':_0x2bab3e[_0x3ffe('0x43')]['to'],'ListId':_0x1187e5['ListId']}));}}else{throw new Error(_0x3ffe('0x57'));}})[_0x3ffe('0x12')](function(){if(_0x1203ff){return respondWithRpcPromise(_0x3ffe('0x58'),_0x3ffe('0x59'),_0x1203ff,client9003)['then'](function(_0x4d1e05){return _0x2bfed7['update']({'read':!![],'messageId':_0x4d1e05[_0x3ffe('0x5a')],'sentAt':moment()[_0x3ffe('0x5b')](_0x3ffe('0x5c'))});})['catch'](function(_0x4cddb2){logger[_0x3ffe('0x17')]('%s',JSON[_0x3ffe('0x5d')](_0x4cddb2));return _0x2bfed7;});}return _0x2bfed7;});}return _0x2bfed7;}})[_0x3ffe('0x12')](respondWithResult(_0x8e4c98,0xc9))[_0x3ffe('0x1b')](handleError(_0x8e4c98,null));};exports[_0x3ffe('0x5e')]=function(_0x34d326,_0x48405b){var _0x37e28c={'agent':{},'channel':'mail'};if(_0x34d326['body']['id']){delete _0x34d326['body']['id'];}_0x34d326[_0x3ffe('0x43')]['read']=!![];_0x34d326['body']['readAt']=moment()[_0x3ffe('0x5b')](_0x3ffe('0x5c'));_0x34d326['body'][_0x3ffe('0x5f')]=_0x34d326['body'][_0x3ffe('0x5f')]||_0x34d326['user']['id'];_0x37e28c['agent']['id']=_0x34d326[_0x3ffe('0x43')]['UserId'];return db[_0x3ffe('0x28')][_0x3ffe('0x42')]({'where':{'id':_0x34d326[_0x3ffe('0x3e')]['id'],'UserId':null}})[_0x3ffe('0x12')](handleEntityNotFound(_0x48405b,null))[_0x3ffe('0x12')](saveUpdates(_0x34d326[_0x3ffe('0x43')],null))[_0x3ffe('0x12')](function(_0x12250c){if(_0x12250c){_0x37e28c[_0x3ffe('0x19')]=_0x12250c[_0x3ffe('0x60')]({'plain':!![]});return db[_0x3ffe('0x61')][_0x3ffe('0x42')]({'where':{'id':_0x12250c[_0x3ffe('0x62')]}});}return null;})[_0x3ffe('0x12')](handleEntityNotFound(_0x48405b,null))['then'](function(_0x9846e3){if(_0x9846e3){return _0x9846e3[_0x3ffe('0x23')]({'UserId':_0x34d326[_0x3ffe('0x43')][_0x3ffe('0x5f')],'read1stAt':_['isNil'](_0x9846e3[_0x3ffe('0x63')])?moment()['format'](_0x3ffe('0x5c')):undefined});}return null;})['then'](function(_0x4a1fda){if(_0x4a1fda){_0x37e28c[_0x3ffe('0x64')]=_0x4a1fda[_0x3ffe('0x60')]({'plain':!![]});interaction_log[_0x3ffe('0x13')](_0x3ffe('0x65'),_0x34d326[_0x3ffe('0x66')]['id'],_0x34d326[_0x3ffe('0x66')][_0x3ffe('0x26')],_0x34d326[_0x3ffe('0x66')][_0x3ffe('0x67')],_0x37e28c[_0x3ffe('0x64')]['id'],_0x34d326[_0x3ffe('0x43')]?JSON['stringify'](_0x34d326[_0x3ffe('0x43')]):_0x3ffe('0x68'));return respondWithRpcPromise(_0x3ffe('0x69'),_0x3ffe('0x6a'),_0x37e28c);}return null;})[_0x3ffe('0x12')](function(_0x5086af){var _0xc89bbb=_0x3ffe('0x6b')+_0x5086af['message']['ContactId'];return db[_0x3ffe('0x6c')][_0x3ffe('0x2d')](_0xc89bbb,{'type':db[_0x3ffe('0x6d')][_0x3ffe('0x6e')]['SELECT'],'raw':!![]})[_0x3ffe('0x12')](function(_0x5ee8a6){return _0x5ee8a6;});})[_0x3ffe('0x12')](function(_0x12acf7){if(_0x12acf7){_0x37e28c[_0x3ffe('0x19')][_0x3ffe('0x6f')]=_0x12acf7[0x0];if(!_0x34d326[_0x3ffe('0x43')][_0x3ffe('0x5f')])return;return db[_0x3ffe('0x70')][_0x3ffe('0x42')]({'where':{'id':_0x34d326[_0x3ffe('0x43')][_0x3ffe('0x5f')],'role':_0x3ffe('0x71')},'attributes':['id',_0x3ffe('0x26'),_0x3ffe('0x72'),_0x3ffe('0x73'),_0x3ffe('0x74')],'raw':!![]});}return null;})[_0x3ffe('0x12')](function(_0x3010df){if(!_0x3010df)return null;_0x37e28c[_0x3ffe('0x19')]['agent']=_0x3010df;return _0x37e28c;})[_0x3ffe('0x12')](function(_0x2fcfef){if(_0x2fcfef){if(_0x34d326[_0x3ffe('0x43')][_0x3ffe('0x75')]){_0x37e28c[_0x3ffe('0x19')][_0x3ffe('0x76')]=util['format'](_0x3ffe('0x77'),_0x34d326[_0x3ffe('0x66')][_0x3ffe('0x26')]);_0x37e28c[_0x3ffe('0x19')]['channel']=_0x37e28c['channel'];_0x37e28c[_0x3ffe('0x19')]['motionChannel']=_0x37e28c[_0x3ffe('0x78')];_0x37e28c[_0x3ffe('0x19')][_0x3ffe('0x79')]=_0x3ffe('0x5e');_0x37e28c[_0x3ffe('0x19')]['body']=htmlToText['fromString'](_0x37e28c[_0x3ffe('0x19')][_0x3ffe('0x43')]);return respondWithRpcPromise(_0x3ffe('0x7a'),_0x3ffe('0x7a'),{'event':'acceptmessage','message':_0x37e28c[_0x3ffe('0x19')]},client9002)['then'](function(){return _0x37e28c;});}return _0x37e28c;}return null;})[_0x3ffe('0x12')](respondWithResult(_0x48405b,null))[_0x3ffe('0x1b')](handleError(_0x48405b,null));};exports[_0x3ffe('0x7b')]=function(_0x235ea6,_0x5b61fb){var _0x3613bf={'agent':{},'channel':'mail'};if(_0x235ea6['body']['id']){delete _0x235ea6[_0x3ffe('0x43')]['id'];}_0x235ea6['body']['UserId']=_0x235ea6[_0x3ffe('0x43')][_0x3ffe('0x5f')]||_0x235ea6['user']['id'];_0x3613bf[_0x3ffe('0x71')]['id']=_0x235ea6[_0x3ffe('0x43')][_0x3ffe('0x5f')];return db[_0x3ffe('0x28')][_0x3ffe('0x42')]({'where':{'id':_0x235ea6[_0x3ffe('0x3e')]['id'],'UserId':null}})[_0x3ffe('0x12')](handleEntityNotFound(_0x5b61fb,null))[_0x3ffe('0x12')](function(_0x3bb9d9){if(_0x3bb9d9){_0x3613bf[_0x3ffe('0x19')]=_0x3bb9d9['get']({'plain':!![]});return db[_0x3ffe('0x61')][_0x3ffe('0x42')]({'where':{'id':_0x3bb9d9[_0x3ffe('0x62')]}});}return null;})[_0x3ffe('0x12')](handleEntityNotFound(_0x5b61fb,null))[_0x3ffe('0x12')](function(_0x5d33fa){if(_0x5d33fa){_0x3613bf[_0x3ffe('0x64')]=_0x5d33fa[_0x3ffe('0x60')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x235ea6[_0x3ffe('0x66')]['id'],_0x235ea6[_0x3ffe('0x66')][_0x3ffe('0x26')],_0x235ea6[_0x3ffe('0x66')][_0x3ffe('0x67')],_0x3613bf[_0x3ffe('0x64')]['id'],_0x235ea6[_0x3ffe('0x43')]?JSON[_0x3ffe('0x5d')](_0x235ea6[_0x3ffe('0x43')]):_0x3ffe('0x68'));return respondWithRpcPromise(_0x3ffe('0x7c'),_0x3ffe('0x7d'),_0x3613bf);}return null;})[_0x3ffe('0x12')](function(_0x12d936){var _0x4ba718=_0x3ffe('0x6b')+_0x12d936[_0x3ffe('0x19')][_0x3ffe('0x7e')];return db['sequelize'][_0x3ffe('0x2d')](_0x4ba718,{'type':db[_0x3ffe('0x6d')][_0x3ffe('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0xf72df1){return _0xf72df1;});})['then'](function(_0x5bdd97){if(_0x5bdd97){_0x3613bf[_0x3ffe('0x19')]['contact']=_0x5bdd97[0x0];if(!_0x235ea6[_0x3ffe('0x43')]['UserId'])return;return db[_0x3ffe('0x70')][_0x3ffe('0x42')]({'where':{'id':_0x235ea6[_0x3ffe('0x43')][_0x3ffe('0x5f')],'role':_0x3ffe('0x71')},'attributes':['id',_0x3ffe('0x26'),_0x3ffe('0x72'),'email','internal'],'raw':!![]});}return null;})[_0x3ffe('0x12')](function(_0x16432b){if(!_0x16432b)return null;_0x3613bf[_0x3ffe('0x19')][_0x3ffe('0x71')]=_0x16432b;return _0x3613bf;})['then'](function(_0x1a3635){if(_0x1a3635){_0x1a3635[_0x3ffe('0x19')][_0x3ffe('0x76')]=util[_0x3ffe('0x5b')](_0x3ffe('0x77'),_0x235ea6[_0x3ffe('0x66')][_0x3ffe('0x26')]);_0x1a3635[_0x3ffe('0x19')][_0x3ffe('0x78')]=_0x3613bf['channel'];_0x1a3635[_0x3ffe('0x19')]['motionChannel']=_0x3613bf[_0x3ffe('0x78')];_0x1a3635[_0x3ffe('0x19')][_0x3ffe('0x79')]=_0x3ffe('0x7b');_0x1a3635[_0x3ffe('0x19')]['body']=htmlToText[_0x3ffe('0x7f')](_0x3613bf[_0x3ffe('0x19')][_0x3ffe('0x43')]);respondWithRpcPromise(_0x3ffe('0x7a'),_0x3ffe('0x7a'),{'event':'rejectmessage','message':_0x1a3635['message']},client9002);return _0x3613bf;}return null;})[_0x3ffe('0x12')](respondWithResult(_0x5b61fb,null))[_0x3ffe('0x1b')](handleError(_0x5b61fb,null));};exports[_0x3ffe('0x80')]=function(_0x51e14b,_0x1d623f){var _0x3280ba=moment()['unix']()[_0x3ffe('0x81')]();var _0x5e4a01=path[_0x3ffe('0x53')](config[_0x3ffe('0x54')],_0x3ffe('0x82'),'files',_0x3ffe('0x83'));var _0x4f8fe7=path[_0x3ffe('0x53')](config[_0x3ffe('0x54')],_0x3ffe('0x82'),_0x3ffe('0x84'),_0x3ffe('0x52'));var _0x55a665=util[_0x3ffe('0x5b')](_0x3ffe('0x85'),_0x3280ba);return db[_0x3ffe('0x28')][_0x3ffe('0x42')]({'where':{'id':_0x51e14b[_0x3ffe('0x3e')]['id']},'attributes':['id',_0x3ffe('0x43'),_0x3ffe('0x86'),'to','cc',_0x3ffe('0x87'),_0x3ffe('0x88'),_0x3ffe('0x89')],'include':_0x51e14b[_0x3ffe('0x2d')]['attachments']?[{'model':db[_0x3ffe('0x8a')],'as':_0x3ffe('0x8b')}]:undefined})[_0x3ffe('0x12')](handleEntityNotFound(_0x1d623f,null))[_0x3ffe('0x12')](function(_0x3e4969){if(_0x3e4969){var _0xf12df5=_0x3e4969;var _0x483bf8={'from':_0xf12df5[_0x3ffe('0x86')],'to':_0xf12df5['to'],'subject':_0xf12df5['subject'],'html':htmlEntities[_0x3ffe('0x8c')](_0xf12df5['body']),'headers':{'Date':moment(_0xf12df5[_0x3ffe('0x89')])[_0x3ffe('0x5b')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3e4969['cc']){_0x483bf8[_0x3ffe('0x8d')]['Cc']=_0x3e4969['cc'];}if(_0x3e4969[_0x3ffe('0x87')]){_0x483bf8[_0x3ffe('0x8d')][_0x3ffe('0x8e')]=_0x3e4969['bcc'];}return new BPromise(function(_0x3ed438,_0x32acf2){if(_0x3e4969[_0x3ffe('0x8b')]){for(var _0x189ff9=0x0;_0x189ff9<_0x3e4969[_0x3ffe('0x8b')][_0x3ffe('0x3f')];_0x189ff9++){var _0x4c4a58=_0x3e4969[_0x3ffe('0x8b')][_0x189ff9];var _0x4eacba=path[_0x3ffe('0x53')](_0x4f8fe7,_0x4c4a58['basename']);if(fs['existsSync'](_0x4eacba)){_0x483bf8[_0x3ffe('0x52')]['push']({'name':_0x4c4a58[_0x3ffe('0x26')],'contentType':_0x4c4a58['type'],'data':fs[_0x3ffe('0x8f')](_0x4eacba)});}}}emlformat[_0x3ffe('0x90')](_0x483bf8,function(_0x3c6a84,_0x57773b){if(_0x3c6a84)return _0x32acf2(_0x3c6a84);fs['writeFileSync'](path[_0x3ffe('0x53')](_0x5e4a01,_0x55a665),_0x57773b);return _0x3ed438(_0x57773b);});});}})[_0x3ffe('0x12')](function(_0x346bf1){if(_0x346bf1){return _0x1d623f[_0x3ffe('0x80')](path[_0x3ffe('0x53')](_0x5e4a01,_0x55a665),_0x55a665,function(_0x4570d9){if(!_0x4570d9)fs[_0x3ffe('0x91')](path[_0x3ffe('0x53')](_0x5e4a01,_0x55a665));});}})['catch'](handleError(_0x1d623f,null));}; \ No newline at end of file +var _0xc4fe=['update','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','attachments','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','format','mail','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','internal','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','unlinkSync','eml-format','moment','bluebird','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','name','map','MailMessage','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','filters','includeAll','find'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xc4fe,0x19a));var _0xec4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xec4f('0x0'));var moment=require(_0xec4f('0x1'));var BPromise=require(_0xec4f('0x2'));var util=require('util');var path=require(_0xec4f('0x3'));var fs=require('fs');var _=require(_0xec4f('0x4'));var Redis=require('ioredis');var htmlToText=require(_0xec4f('0x5'));var qs=require(_0xec4f('0x6'));var logger=require(_0xec4f('0x7'))(_0xec4f('0x8'));var interaction_log=require('../../config/logger')(_0xec4f('0x9'));var config=require(_0xec4f('0xa'));var db=require(_0xec4f('0xb'))['db'];config['redis']=_[_0xec4f('0xc')](config[_0xec4f('0xd')],{'host':_0xec4f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0xec4f('0xf'));require(_0xec4f('0x10'))[_0xec4f('0x11')](socket);var jayson=require(_0xec4f('0x12'));var client=jayson[_0xec4f('0x13')][_0xec4f('0x14')]({'port':0x232c});var client9003=jayson[_0xec4f('0x13')][_0xec4f('0x14')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c7999,_0x40a15c,_0x2ad179,_0xff18d2){return new BPromise(function(_0x2f2bf4,_0x4b1b1b){var _0x33bfa0=_0xff18d2||client;return _0x33bfa0['request'](_0x4c7999,_0x2ad179)[_0xec4f('0x15')](function(_0x886886){logger[_0xec4f('0x16')](_0xec4f('0x17'),_0x40a15c,_0xec4f('0x18'));logger[_0xec4f('0x19')](_0xec4f('0x1a'),_0x40a15c,_0xec4f('0x18'),JSON[_0xec4f('0x1b')](_0x886886));if(_0x886886[_0xec4f('0x1c')]){if(_0x886886[_0xec4f('0x1c')][_0xec4f('0x1d')]===0x1f4){logger[_0xec4f('0x1c')]('MailMessage,\x20%s,\x20%s',_0x40a15c,_0x886886[_0xec4f('0x1c')][_0xec4f('0x1e')]);return _0x4b1b1b(_0x886886['error']['message']);}logger[_0xec4f('0x1c')](_0xec4f('0x17'),_0x40a15c,_0x886886[_0xec4f('0x1c')][_0xec4f('0x1e')]);return _0x2f2bf4(_0x886886['error'][_0xec4f('0x1e')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x40a15c,'request\x20sent');_0x2f2bf4(_0x886886[_0xec4f('0x1f')][_0xec4f('0x1e')]);}})[_0xec4f('0x20')](function(_0x169f03){logger[_0xec4f('0x1c')](_0xec4f('0x17'),_0x40a15c,_0x169f03);_0x4b1b1b(_0x169f03);});});}function respondWithResult(_0x15d2d9,_0x43a2a9){_0x43a2a9=_0x43a2a9||0xc8;return function(_0x309ceb){if(_0x309ceb){return _0x15d2d9[_0xec4f('0x21')](_0x43a2a9)[_0xec4f('0x22')](_0x309ceb);}};}function respondWithFilteredResult(_0xd048f5,_0x19085f){return function(_0x14b023){if(_0x14b023){var _0x25886f=typeof _0x19085f[_0xec4f('0x23')]===_0xec4f('0x24')&&typeof _0x19085f[_0xec4f('0x25')]===_0xec4f('0x24');var _0x442906=_0x14b023[_0xec4f('0x26')];var _0x32bbbd=_0x25886f?0x0:_0x19085f[_0xec4f('0x23')];var _0xd74b4d=_0x25886f?_0x14b023[_0xec4f('0x26')]:_0x19085f[_0xec4f('0x23')]+_0x19085f[_0xec4f('0x25')];var _0x1c94ef;if(_0xd74b4d>=_0x442906){_0xd74b4d=_0x442906;_0x1c94ef=0xc8;}else{_0x1c94ef=0xce;}_0xd048f5[_0xec4f('0x21')](_0x1c94ef);return _0xd048f5[_0xec4f('0x27')](_0xec4f('0x28'),_0x32bbbd+'-'+_0xd74b4d+'/'+_0x442906)['json'](_0x14b023);}return null;};}function saveUpdates(_0x216037){return function(_0x1ace77){if(_0x1ace77){return _0x1ace77['update'](_0x216037)[_0xec4f('0x15')](function(_0x165806){return _0x165806;});}return null;};}function removeEntity(_0x2536c3){return function(_0x34e314){if(_0x34e314){return _0x34e314[_0xec4f('0x29')]()[_0xec4f('0x15')](function(){_0x2536c3[_0xec4f('0x21')](0xcc)[_0xec4f('0x2a')]();});}};}function handleEntityNotFound(_0x827db7){return function(_0x296426){if(!_0x296426){_0x827db7[_0xec4f('0x2b')](0x194);}return _0x296426;};}function handleError(_0xb779b0,_0x1e7216){_0x1e7216=_0x1e7216||0x1f4;return function(_0x5c3974){logger[_0xec4f('0x1c')](_0x5c3974['stack']);if(_0x5c3974[_0xec4f('0x2c')]){delete _0x5c3974['name'];}_0xb779b0[_0xec4f('0x21')](_0x1e7216)['send'](_0x5c3974);};}exports['index']=function(_0x17b11e,_0x3f9404){var _0x1981b1={},_0x49bdfd={},_0x5d3816={'count':0x0,'rows':[]};var _0x5cc9c4=_[_0xec4f('0x2d')](db[_0xec4f('0x2e')][_0xec4f('0x2f')],function(_0x1c7aab){return{'name':_0x1c7aab[_0xec4f('0x30')],'type':_0x1c7aab[_0xec4f('0x31')][_0xec4f('0x32')]};});_0x49bdfd['model']=_[_0xec4f('0x2d')](_0x5cc9c4,_0xec4f('0x2c'));_0x49bdfd['query']=_[_0xec4f('0x33')](_0x17b11e['query']);_0x49bdfd['filters']=_[_0xec4f('0x34')](_0x49bdfd[_0xec4f('0x35')],_0x49bdfd[_0xec4f('0x36')]);_0x1981b1[_0xec4f('0x37')]=_[_0xec4f('0x34')](_0x49bdfd['model'],qs[_0xec4f('0x38')](_0x17b11e[_0xec4f('0x36')]['fields']));_0x1981b1[_0xec4f('0x37')]=_0x1981b1['attributes'][_0xec4f('0x39')]?_0x1981b1[_0xec4f('0x37')]:_0x49bdfd[_0xec4f('0x35')];if(!_0x17b11e[_0xec4f('0x36')]['hasOwnProperty'](_0xec4f('0x3a'))){_0x1981b1[_0xec4f('0x25')]=qs[_0xec4f('0x25')](_0x17b11e[_0xec4f('0x36')][_0xec4f('0x25')]);_0x1981b1[_0xec4f('0x23')]=qs['offset'](_0x17b11e[_0xec4f('0x36')][_0xec4f('0x23')]);}_0x1981b1[_0xec4f('0x3b')]=qs[_0xec4f('0x3c')](_0x17b11e['query'][_0xec4f('0x3c')]);_0x1981b1[_0xec4f('0x3d')]=qs['filters'](_[_0xec4f('0x3e')](_0x17b11e['query'],_0x49bdfd['filters']),_0x5cc9c4);if(_0x17b11e[_0xec4f('0x36')][_0xec4f('0x3f')]){_0x1981b1[_0xec4f('0x3d')]=_['merge'](_0x1981b1[_0xec4f('0x3d')],{'$or':_[_0xec4f('0x2d')](_0x5cc9c4,function(_0x10fe39){if(_0x10fe39['type']!=='VIRTUAL'){var _0x3125ad={};_0x3125ad[_0x10fe39[_0xec4f('0x2c')]]={'$like':'%'+_0x17b11e[_0xec4f('0x36')][_0xec4f('0x3f')]+'%'};return _0x3125ad;}})});}_0x1981b1=_[_0xec4f('0x40')]({},_0x1981b1,_0x17b11e['options']);var _0x90c519={'where':_0x1981b1['where']};return db[_0xec4f('0x2e')][_0xec4f('0x26')](_0x90c519)[_0xec4f('0x15')](function(_0x39acfb){_0x5d3816[_0xec4f('0x26')]=_0x39acfb;if(_0x17b11e[_0xec4f('0x36')]['includeAll']){_0x1981b1[_0xec4f('0x41')]=[{'all':!![]}];}return db[_0xec4f('0x2e')][_0xec4f('0x42')](_0x1981b1);})[_0xec4f('0x15')](function(_0x1261ff){_0x5d3816[_0xec4f('0x43')]=_0x1261ff;return _0x5d3816;})[_0xec4f('0x15')](respondWithFilteredResult(_0x3f9404,_0x1981b1))[_0xec4f('0x20')](handleError(_0x3f9404,null));};exports[_0xec4f('0x44')]=function(_0x39d5ae,_0x48dd04){var _0xfd9372={'raw':!![],'where':{'id':_0x39d5ae[_0xec4f('0x45')]['id']}},_0x239d75={};_0x239d75['model']=_[_0xec4f('0x33')](db[_0xec4f('0x2e')][_0xec4f('0x2f')]);_0x239d75['query']=_['keys'](_0x39d5ae[_0xec4f('0x36')]);_0x239d75[_0xec4f('0x46')]=_[_0xec4f('0x34')](_0x239d75[_0xec4f('0x35')],_0x239d75[_0xec4f('0x36')]);_0xfd9372[_0xec4f('0x37')]=_[_0xec4f('0x34')](_0x239d75[_0xec4f('0x35')],qs[_0xec4f('0x38')](_0x39d5ae[_0xec4f('0x36')][_0xec4f('0x38')]));_0xfd9372[_0xec4f('0x37')]=_0xfd9372[_0xec4f('0x37')]['length']?_0xfd9372[_0xec4f('0x37')]:_0x239d75[_0xec4f('0x35')];if(_0x39d5ae[_0xec4f('0x36')][_0xec4f('0x47')]){_0xfd9372[_0xec4f('0x41')]=[{'all':!![]}];}_0xfd9372=_[_0xec4f('0x40')]({},_0xfd9372,_0x39d5ae['options']);return db['MailMessage'][_0xec4f('0x48')](_0xfd9372)[_0xec4f('0x15')](handleEntityNotFound(_0x48dd04,null))[_0xec4f('0x15')](respondWithResult(_0x48dd04,null))[_0xec4f('0x20')](handleError(_0x48dd04,null));};exports[_0xec4f('0x49')]=function(_0x5ca7dd,_0x3a5c93){if(_0x5ca7dd['body']['id']){delete _0x5ca7dd[_0xec4f('0x4a')]['id'];}return db[_0xec4f('0x2e')][_0xec4f('0x48')]({'where':{'id':_0x5ca7dd[_0xec4f('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a5c93,null))['then'](saveUpdates(_0x5ca7dd['body'],null))[_0xec4f('0x15')](respondWithResult(_0x3a5c93,null))[_0xec4f('0x20')](handleError(_0x3a5c93,null));};exports[_0xec4f('0x29')]=function(_0x12e792,_0x3faad0){return db['MailMessage'][_0xec4f('0x48')]({'where':{'id':_0x12e792['params']['id']}})[_0xec4f('0x15')](handleEntityNotFound(_0x3faad0,null))[_0xec4f('0x15')](removeEntity(_0x3faad0,null))['catch'](handleError(_0x3faad0,null));};exports['describe']=function(_0x30e9a5,_0x3f57ab){return db['MailMessage'][_0xec4f('0x4b')]()[_0xec4f('0x15')](respondWithResult(_0x3f57ab,null))[_0xec4f('0x20')](handleError(_0x3f57ab,null));};exports[_0xec4f('0x4c')]=function(_0x578106,_0x14c948){return db[_0xec4f('0x2e')][_0xec4f('0x4c')](_0x578106[_0xec4f('0x4a')])[_0xec4f('0x15')](function(_0x57a002){if(_0x57a002){if(_0x57a002[_0xec4f('0x4d')]===_0xec4f('0x4e')&&!_0x57a002[_0xec4f('0x4f')]){var _0x44e41c,_0x1d2650,_0x4af05b;if(_0x578106[_0xec4f('0x4a')]['to']){_0x1d2650=_0x578106[_0xec4f('0x4a')]['to'][_0xec4f('0x50')](',')[0x0];}return db[_0xec4f('0x51')][_0xec4f('0x52')]({'where':{'id':_0x57a002[_0xec4f('0x53')]},'include':[{'model':db[_0xec4f('0x54')],'as':_0xec4f('0x55'),'include':[{'model':db[_0xec4f('0x56')],'as':'Contacts','where':{'email':_0x1d2650},'limit':0x1,'order':[['updatedAt',_0xec4f('0x57')]]}]},{'model':db[_0xec4f('0x58')],'as':_0xec4f('0x59'),'raw':!![],'include':[{'model':db[_0xec4f('0x5a')],'as':_0xec4f('0x5a'),'raw':!![]}]}]})[_0xec4f('0x15')](function(_0x19e23b){_0x44e41c=_0x19e23b;if(!_0x44e41c||!_0x44e41c['Smtp'])return;var _0x5e8ec4=_0x44e41c['getSmtpOptions']();if(_0x578106[_0xec4f('0x4a')][_0xec4f('0x5b')]&&_0x578106[_0xec4f('0x4a')][_0xec4f('0x5b')][_0xec4f('0x39')]){for(var _0x14c2af=0x0;_0x14c2af<_0x578106[_0xec4f('0x4a')][_0xec4f('0x5b')][_0xec4f('0x39')];_0x14c2af+=0x1){_0x578106[_0xec4f('0x4a')][_0xec4f('0x5b')][_0x14c2af]={'filename':_0x578106[_0xec4f('0x4a')]['attachments'][_0x14c2af]['name'],'path':path['join'](config[_0xec4f('0x5c')],_0xec4f('0x5d'),_0x578106[_0xec4f('0x4a')]['attachments'][_0x14c2af][_0xec4f('0x5e')])};}}_0x4af05b={'account':_0x5e8ec4,'message':_0x578106['body']};return;})['then'](function(){if(_0x44e41c['List']){if(_0x44e41c[_0xec4f('0x55')][_0xec4f('0x5f')][_0xec4f('0x39')]){return _0x44e41c['List']['Contacts'][0x0];}else{return db[_0xec4f('0x56')]['create'](_[_0xec4f('0xc')](_0x578106[_0xec4f('0x4a')],{'firstName':_0x578106['body']['to'],'email':_0x578106[_0xec4f('0x4a')]['to'],'phone':_0x578106[_0xec4f('0x4a')]['to'],'ListId':_0x44e41c[_0xec4f('0x60')]}));}}else{throw new Error(_0xec4f('0x61'));}})[_0xec4f('0x15')](function(){if(_0x4af05b){return respondWithRpcPromise(_0xec4f('0x62'),_0xec4f('0x63'),_0x4af05b,client9003)['then'](function(_0x26b3c4){return _0x57a002['update']({'read':!![],'messageId':_0x26b3c4['messageId'],'sentAt':moment()[_0xec4f('0x64')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xec4f('0x20')](function(_0x3ff99){logger[_0xec4f('0x1c')]('%s',JSON[_0xec4f('0x1b')](_0x3ff99));return _0x57a002;});}return _0x57a002;});}return _0x57a002;}})[_0xec4f('0x15')](respondWithResult(_0x14c948,0xc9))[_0xec4f('0x20')](handleError(_0x14c948,null));};exports['accept']=function(_0x555bb2,_0x563ed4){var _0x3e3274={'agent':{},'channel':_0xec4f('0x65')};if(_0x555bb2['body']['id']){delete _0x555bb2['body']['id'];}_0x555bb2[_0xec4f('0x4a')][_0xec4f('0x66')]=!![];_0x555bb2[_0xec4f('0x4a')]['readAt']=moment()[_0xec4f('0x64')](_0xec4f('0x67'));_0x555bb2[_0xec4f('0x4a')][_0xec4f('0x68')]=_0x555bb2[_0xec4f('0x4a')][_0xec4f('0x68')]||_0x555bb2[_0xec4f('0x69')]['id'];_0x3e3274['agent']['id']=_0x555bb2[_0xec4f('0x4a')]['UserId'];return db[_0xec4f('0x2e')][_0xec4f('0x48')]({'where':{'id':_0x555bb2[_0xec4f('0x45')]['id'],'UserId':null}})[_0xec4f('0x15')](handleEntityNotFound(_0x563ed4,null))[_0xec4f('0x15')](saveUpdates(_0x555bb2[_0xec4f('0x4a')],null))[_0xec4f('0x15')](function(_0x36b460){if(_0x36b460){_0x3e3274['message']=_0x36b460[_0xec4f('0x6a')]({'plain':!![]});return db[_0xec4f('0x6b')][_0xec4f('0x48')]({'where':{'id':_0x36b460[_0xec4f('0x6c')]}});}return null;})[_0xec4f('0x15')](handleEntityNotFound(_0x563ed4,null))[_0xec4f('0x15')](function(_0x5f47e5){if(_0x5f47e5){return _0x5f47e5[_0xec4f('0x49')]({'UserId':_0x555bb2['body'][_0xec4f('0x68')],'read1stAt':_[_0xec4f('0x6d')](_0x5f47e5[_0xec4f('0x6e')])?moment()[_0xec4f('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x182c4c){if(_0x182c4c){_0x3e3274[_0xec4f('0x6f')]=_0x182c4c['get']({'plain':!![]});interaction_log[_0xec4f('0x16')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x555bb2[_0xec4f('0x69')]['id'],_0x555bb2[_0xec4f('0x69')][_0xec4f('0x2c')],_0x555bb2[_0xec4f('0x69')]['role'],_0x3e3274['interaction']['id'],_0x555bb2[_0xec4f('0x4a')]?JSON[_0xec4f('0x1b')](_0x555bb2[_0xec4f('0x4a')]):_0xec4f('0x70'));return respondWithRpcPromise('AcceptMessage',_0xec4f('0x71'),_0x3e3274);}return null;})[_0xec4f('0x15')](function(_0x4f7923){var _0x3b80d0=_0xec4f('0x72')+_0x4f7923[_0xec4f('0x1e')]['ContactId'];return db['sequelize'][_0xec4f('0x36')](_0x3b80d0,{'type':db[_0xec4f('0x73')][_0xec4f('0x74')][_0xec4f('0x75')],'raw':!![]})[_0xec4f('0x15')](function(_0x50d3f5){return _0x50d3f5;});})['then'](function(_0xbed707){if(_0xbed707){_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x76')]=_0xbed707[0x0];if(!_0x555bb2[_0xec4f('0x4a')][_0xec4f('0x68')])return;return db[_0xec4f('0x77')][_0xec4f('0x48')]({'where':{'id':_0x555bb2[_0xec4f('0x4a')]['UserId'],'role':_0xec4f('0x78')},'attributes':['id',_0xec4f('0x2c'),_0xec4f('0x79'),_0xec4f('0x7a'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1da1ed){if(!_0x1da1ed)return null;_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x78')]=_0x1da1ed;return _0x3e3274;})[_0xec4f('0x15')](function(_0x5a5053){if(_0x5a5053){if(_0x555bb2['body'][_0xec4f('0x7b')]){_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x7c')]=util['format'](_0xec4f('0x7d'),_0x555bb2['user']['name']);_0x3e3274['message'][_0xec4f('0x7e')]=_0x3e3274[_0xec4f('0x7e')];_0x3e3274['message'][_0xec4f('0x7f')]=_0x3e3274[_0xec4f('0x7e')];_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x80')]='accept';_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x4a')]=htmlToText[_0xec4f('0x81')](_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x4a')]);return respondWithRpcPromise(_0xec4f('0x82'),_0xec4f('0x82'),{'event':_0xec4f('0x83'),'message':_0x3e3274['message']},client9002)[_0xec4f('0x15')](function(){return _0x3e3274;});}return _0x3e3274;}return null;})['then'](respondWithResult(_0x563ed4,null))[_0xec4f('0x20')](handleError(_0x563ed4,null));};exports[_0xec4f('0x84')]=function(_0x444026,_0x2f3c3b){var _0x5f0045={'agent':{},'channel':_0xec4f('0x65')};if(_0x444026[_0xec4f('0x4a')]['id']){delete _0x444026[_0xec4f('0x4a')]['id'];}_0x444026['body'][_0xec4f('0x68')]=_0x444026['body'][_0xec4f('0x68')]||_0x444026[_0xec4f('0x69')]['id'];_0x5f0045[_0xec4f('0x78')]['id']=_0x444026[_0xec4f('0x4a')][_0xec4f('0x68')];return db[_0xec4f('0x2e')][_0xec4f('0x48')]({'where':{'id':_0x444026[_0xec4f('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2f3c3b,null))[_0xec4f('0x15')](function(_0x49578){if(_0x49578){_0x5f0045[_0xec4f('0x1e')]=_0x49578['get']({'plain':!![]});return db['MailInteraction'][_0xec4f('0x48')]({'where':{'id':_0x49578[_0xec4f('0x6c')]}});}return null;})[_0xec4f('0x15')](handleEntityNotFound(_0x2f3c3b,null))['then'](function(_0x4445e5){if(_0x4445e5){_0x5f0045['interaction']=_0x4445e5[_0xec4f('0x6a')]({'plain':!![]});interaction_log[_0xec4f('0x16')](_0xec4f('0x85'),_0x444026['user']['id'],_0x444026[_0xec4f('0x69')][_0xec4f('0x2c')],_0x444026[_0xec4f('0x69')][_0xec4f('0x86')],_0x5f0045[_0xec4f('0x6f')]['id'],_0x444026['body']?JSON[_0xec4f('0x1b')](_0x444026[_0xec4f('0x4a')]):'null');return respondWithRpcPromise(_0xec4f('0x87'),'rejectMessage',_0x5f0045);}return null;})[_0xec4f('0x15')](function(_0x1e11c0){var _0x5786f3=_0xec4f('0x72')+_0x1e11c0[_0xec4f('0x1e')][_0xec4f('0x88')];return db['sequelize'][_0xec4f('0x36')](_0x5786f3,{'type':db[_0xec4f('0x73')][_0xec4f('0x74')][_0xec4f('0x75')],'raw':!![]})[_0xec4f('0x15')](function(_0x8c2fce){return _0x8c2fce;});})[_0xec4f('0x15')](function(_0x2d4d6b){if(_0x2d4d6b){_0x5f0045[_0xec4f('0x1e')][_0xec4f('0x76')]=_0x2d4d6b[0x0];if(!_0x444026[_0xec4f('0x4a')][_0xec4f('0x68')])return;return db[_0xec4f('0x77')]['find']({'where':{'id':_0x444026[_0xec4f('0x4a')]['UserId'],'role':_0xec4f('0x78')},'attributes':['id',_0xec4f('0x2c'),'fullname','email',_0xec4f('0x89')],'raw':!![]});}return null;})['then'](function(_0x41afb9){if(!_0x41afb9)return null;_0x5f0045[_0xec4f('0x1e')][_0xec4f('0x78')]=_0x41afb9;return _0x5f0045;})[_0xec4f('0x15')](function(_0x26029e){if(_0x26029e){_0x26029e['message']['interface']=util[_0xec4f('0x64')](_0xec4f('0x7d'),_0x444026['user']['name']);_0x26029e[_0xec4f('0x1e')][_0xec4f('0x7e')]=_0x5f0045[_0xec4f('0x7e')];_0x26029e['message'][_0xec4f('0x7f')]=_0x5f0045[_0xec4f('0x7e')];_0x26029e['message']['event']=_0xec4f('0x84');_0x26029e[_0xec4f('0x1e')][_0xec4f('0x4a')]=htmlToText[_0xec4f('0x81')](_0x5f0045['message'][_0xec4f('0x4a')]);respondWithRpcPromise(_0xec4f('0x82'),'EventManager',{'event':_0xec4f('0x8a'),'message':_0x26029e[_0xec4f('0x1e')]},client9002);return _0x5f0045;}return null;})[_0xec4f('0x15')](respondWithResult(_0x2f3c3b,null))[_0xec4f('0x20')](handleError(_0x2f3c3b,null));};exports[_0xec4f('0x8b')]=function(_0x44512e,_0x55dab7){var _0x6f1169=moment()[_0xec4f('0x8c')]()[_0xec4f('0x8d')]();var _0xbfdacd=path[_0xec4f('0x8e')](config[_0xec4f('0x5c')],_0xec4f('0x8f'),_0xec4f('0x90'),_0xec4f('0x91'));var _0x110416=path[_0xec4f('0x8e')](config['root'],_0xec4f('0x8f'),_0xec4f('0x90'),_0xec4f('0x5b'));var _0x395221=util['format'](_0xec4f('0x92'),_0x6f1169);return db[_0xec4f('0x2e')][_0xec4f('0x48')]({'where':{'id':_0x44512e['params']['id']},'attributes':['id',_0xec4f('0x4a'),_0xec4f('0x93'),'to','cc',_0xec4f('0x94'),_0xec4f('0x95'),_0xec4f('0x96')],'include':_0x44512e[_0xec4f('0x36')][_0xec4f('0x5b')]?[{'model':db[_0xec4f('0x97')],'as':_0xec4f('0x98')}]:undefined})['then'](handleEntityNotFound(_0x55dab7,null))[_0xec4f('0x15')](function(_0x5bd6a4){if(_0x5bd6a4){var _0x79ee12=_0x5bd6a4;var _0x6a289b={'from':_0x79ee12[_0xec4f('0x93')],'to':_0x79ee12['to'],'subject':_0x79ee12[_0xec4f('0x95')],'html':htmlEntities['decode'](_0x79ee12[_0xec4f('0x4a')]),'headers':{'Date':moment(_0x79ee12[_0xec4f('0x96')])[_0xec4f('0x64')](_0xec4f('0x99'))},'attachments':[]};if(_0x5bd6a4['cc']){_0x6a289b['headers']['Cc']=_0x5bd6a4['cc'];}if(_0x5bd6a4[_0xec4f('0x94')]){_0x6a289b[_0xec4f('0x9a')][_0xec4f('0x9b')]=_0x5bd6a4['bcc'];}return new BPromise(function(_0x288fe1,_0x1cccde){if(_0x5bd6a4[_0xec4f('0x98')]){for(var _0x4863ba=0x0;_0x4863ba<_0x5bd6a4[_0xec4f('0x98')][_0xec4f('0x39')];_0x4863ba++){var _0x27fc87=_0x5bd6a4[_0xec4f('0x98')][_0x4863ba];var _0x227318=path[_0xec4f('0x8e')](_0x110416,_0x27fc87['basename']);if(fs[_0xec4f('0x9c')](_0x227318)){_0x6a289b['attachments'][_0xec4f('0x9d')]({'name':_0x27fc87[_0xec4f('0x2c')],'contentType':_0x27fc87[_0xec4f('0x31')],'data':fs[_0xec4f('0x9e')](_0x227318)});}}}emlformat[_0xec4f('0x9f')](_0x6a289b,function(_0x5cf50a,_0x4fb7e8){if(_0x5cf50a)return _0x1cccde(_0x5cf50a);fs['writeFileSync'](path['join'](_0xbfdacd,_0x395221),_0x4fb7e8);return _0x288fe1(_0x4fb7e8);});});}})['then'](function(_0x25d6e8){if(_0x25d6e8){return _0x55dab7[_0xec4f('0x8b')](path['join'](_0xbfdacd,_0x395221),_0x395221,function(_0x4f3161){if(!_0x4f3161)fs[_0xec4f('0xa0')](path[_0xec4f('0x8e')](_0xbfdacd,_0x395221));});}})['catch'](handleError(_0x55dab7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index df51e00..fced165 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 _0xa353=['update','emit','hook','events','../../mysqldb','save'];(function(_0x422d8a,_0x1d5e72){var _0x27dd24=function(_0x7a9075){while(--_0x7a9075){_0x422d8a['push'](_0x422d8a['shift']());}};_0x27dd24(++_0x1d5e72);}(_0xa353,0x1a1));var _0x3a35=function(_0x12d3f1,_0x489cd5){_0x12d3f1=_0x12d3f1-0x0;var _0x2f1991=_0xa353[_0x12d3f1];return _0x2f1991;};'use strict';var EventEmitter=require(_0x3a35('0x0'));var MailMessage=require(_0x3a35('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3a35('0x2'),'afterUpdate':_0x3a35('0x3'),'afterDestroy':'remove'};function emitEvent(_0x562e24){return function(_0x23c087,_0x11548e,_0x69c3ab){MailMessageEvents[_0x3a35('0x4')](_0x562e24+':'+_0x23c087['id'],_0x23c087);MailMessageEvents[_0x3a35('0x4')](_0x562e24,_0x23c087);_0x69c3ab(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x3a35('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xdf38=['MailMessage','setMaxListeners','save','remove','emit','events','../../mysqldb'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xdf38,0x1b7));var _0x8df3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xdf38[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0x8df3('0x0'));var MailMessage=require(_0x8df3('0x1'))['db'][_0x8df3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8df3('0x3')](0x0);var events={'afterCreate':_0x8df3('0x4'),'afterUpdate':'update','afterDestroy':_0x8df3('0x5')};function emitEvent(_0x3dc8b7){return function(_0x596708,_0x32b67f,_0x13e90b){MailMessageEvents[_0x8df3('0x6')](_0x3dc8b7+':'+_0x596708['id'],_0x596708);MailMessageEvents[_0x8df3('0x6')](_0x3dc8b7,_0x596708);_0x13e90b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index a34d890..954584c 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 _0x0317=['../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','html-to-text','path'];(function(_0x23e9bb,_0x4160fe){var _0x39d313=function(_0x3f68af){while(--_0x3f68af){_0x23e9bb['push'](_0x23e9bb['shift']());}};_0x39d313(++_0x4160fe);}(_0x0317,0x1c7));var _0x7031=function(_0x306268,_0x50005e){_0x306268=_0x306268-0x0;var _0x5065c1=_0x0317[_0x306268];return _0x5065c1;};'use strict';var _=require('lodash');var util=require(_0x7031('0x0'));var logger=require(_0x7031('0x1'))(_0x7031('0x2'));var moment=require(_0x7031('0x3'));var BPromise=require(_0x7031('0x4'));var rp=require('request-promise');var htmlToText=require(_0x7031('0x5'));var fs=require('fs');var path=require(_0x7031('0x6'));var rimraf=require('rimraf');var config=require(_0x7031('0x7'));var attributes=require('./mailMessage.attributes');module[_0x7031('0x8')]=function(_0x57bb48,_0x57fd57){return _0x57bb48[_0x7031('0x9')](_0x7031('0xa'),attributes,{'tableName':_0x7031('0xb'),'paranoid':![],'indexes':[{'name':_0x7031('0xc'),'fields':[_0x7031('0xc')]},{'name':_0x7031('0xd'),'fields':[_0x7031('0xe'),_0x7031('0xf')],'type':_0x7031('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x472a22,_0x3f018e,_0x219392){if(_0x472a22['body']){_0x472a22[_0x7031('0xe')]=htmlToText[_0x7031('0x11')](_0x472a22['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x219392(null,_0x3f018e);},'afterCreate':function(_0x176a10,_0x59e847,_0xfa2b55){var _0x97657d=_0x57bb48[_0x7031('0x12')];var _0x5ccbb8=_0x176a10[_0x7031('0x13')]({'plain':!![]});if(_0x5ccbb8[_0x7031('0x14')][_0x7031('0x15')]()==='in'||_0x5ccbb8[_0x7031('0x14')][_0x7031('0x15')]()===_0x7031('0x16')&&!_0x5ccbb8[_0x7031('0x17')]&&!_['isNil'](_0x5ccbb8[_0x7031('0x18')])){_0x97657d[_0x7031('0x19')][_0x7031('0x1a')]({'where':{'id':_0x5ccbb8['MailInteractionId']}})[_0x7031('0x1b')](function(_0x5048ea){if(_0x5048ea){_0x5048ea[_0x7031('0x1c')]({'lastMsgAt':_0x5ccbb8[_0x7031('0x1d')],'lastMsgDirection':_0x5ccbb8[_0x7031('0x14')]['toLowerCase']()});}})[_0x7031('0x1e')](function(_0x29a327){console[_0x7031('0x1f')](_0x29a327);});}_0xfa2b55();}},'charset':'utf8mb4','collate':_0x7031('0x20')});}; \ No newline at end of file +var _0xa0d4=['direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','html-to-text','path','rimraf','exports','define','mail_messages','fti_mail_messages','plainBody','subject','body','fromString','get'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa0d4,0x85));var _0x4a0d=function(_0x36a17c,_0x1c2dbc){_0x36a17c=_0x36a17c-0x0;var _0x55e639=_0xa0d4[_0x36a17c];return _0x55e639;};'use strict';var _=require(_0x4a0d('0x0'));var util=require(_0x4a0d('0x1'));var logger=require(_0x4a0d('0x2'))('api');var moment=require(_0x4a0d('0x3'));var BPromise=require(_0x4a0d('0x4'));var rp=require('request-promise');var htmlToText=require(_0x4a0d('0x5'));var fs=require('fs');var path=require(_0x4a0d('0x6'));var rimraf=require(_0x4a0d('0x7'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x4a0d('0x8')]=function(_0x5bbbc9,_0x59a9bb){return _0x5bbbc9[_0x4a0d('0x9')]('MailMessage',attributes,{'tableName':_0x4a0d('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x4a0d('0xb'),'fields':[_0x4a0d('0xc'),_0x4a0d('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c2025,_0x2f2df1,_0x293474){if(_0x2c2025[_0x4a0d('0xe')]){_0x2c2025[_0x4a0d('0xc')]=htmlToText[_0x4a0d('0xf')](_0x2c2025['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x293474(null,_0x2f2df1);},'afterCreate':function(_0x412d54,_0x4b25d6,_0x127166){var _0x2be79e=_0x5bbbc9['models'];var _0x4672be=_0x412d54[_0x4a0d('0x10')]({'plain':!![]});if(_0x4672be[_0x4a0d('0x11')][_0x4a0d('0x12')]()==='in'||_0x4672be[_0x4a0d('0x11')][_0x4a0d('0x12')]()===_0x4a0d('0x13')&&!_0x4672be[_0x4a0d('0x14')]&&!_[_0x4a0d('0x15')](_0x4672be[_0x4a0d('0x16')])){_0x2be79e[_0x4a0d('0x17')][_0x4a0d('0x18')]({'where':{'id':_0x4672be[_0x4a0d('0x19')]}})['then'](function(_0x2ec5e2){if(_0x2ec5e2){_0x2ec5e2['update']({'lastMsgAt':_0x4672be['createdAt'],'lastMsgDirection':_0x4672be[_0x4a0d('0x11')][_0x4a0d('0x12')]()});}})[_0x4a0d('0x1a')](function(_0x200ed8){console[_0x4a0d('0x1b')](_0x200ed8);});}_0x127166();}},'charset':_0x4a0d('0x1c'),'collate':_0x4a0d('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 151c958..5c5d619 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 _0x0598=['CreateMailMessage','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','MailMessage','create','body','raw'];(function(_0x4fa916,_0x3ec36a){var _0x576439=function(_0x5692e0){while(--_0x5692e0){_0x4fa916['push'](_0x4fa916['shift']());}};_0x576439(++_0x3ec36a);}(_0x0598,0x92));var _0x8059=function(_0x21051b,_0x560e51){_0x21051b=_0x21051b-0x0;var _0x3f2a45=_0x0598[_0x21051b];return _0x3f2a45;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});config['redis']=_[_0x8059('0x7')](config[_0x8059('0x8')],{'host':_0x8059('0x9'),'port':0x18eb});var socket=require(_0x8059('0xa'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x8059('0xb')](socket);function respondWithRpcPromise(_0x1bf5fd,_0x336f85,_0x5097d6){return new BPromise(function(_0x283b63,_0x52a60d){return client['request'](_0x1bf5fd,_0x5097d6)[_0x8059('0xc')](function(_0x4109a9){logger['info']('MailMessage,\x20%s,\x20%s',_0x336f85,'request\x20sent');logger[_0x8059('0xd')](_0x8059('0xe'),_0x336f85,_0x8059('0xf'),JSON[_0x8059('0x10')](_0x4109a9));if(_0x4109a9[_0x8059('0x11')]){if(_0x4109a9['error'][_0x8059('0x12')]===0x1f4){logger['error'](_0x8059('0x13'),_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x52a60d(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x283b63(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}else{logger[_0x8059('0x15')](_0x8059('0x13'),_0x336f85,'request\x20sent');_0x283b63(_0x4109a9[_0x8059('0x16')][_0x8059('0x14')]);}})[_0x8059('0x17')](function(_0x1c4566){logger['error'](_0x8059('0x13'),_0x336f85,_0x1c4566);_0x52a60d(_0x1c4566);});});}exports['CreateMailMessage']=function(_0x113f42){var _0x493825=this;return new Promise(function(_0x1857c1,_0x56d794){return db[_0x8059('0x18')][_0x8059('0x19')](_0x113f42[_0x8059('0x1a')],{'raw':_0x113f42['options']?_0x113f42['options'][_0x8059('0x1b')]===undefined?!![]:![]:!![]})[_0x8059('0xc')](function(_0x32aeda){logger[_0x8059('0x15')]('CreateMailMessage',_0x113f42);logger[_0x8059('0xd')](_0x8059('0x1c'),_0x113f42,JSON[_0x8059('0x10')](_0x32aeda));_0x1857c1(_0x32aeda);})['catch'](function(_0xe9a72d){logger[_0x8059('0x11')](_0x8059('0x1c'),_0xe9a72d[_0x8059('0x14')],_0x113f42);_0x56d794(_0x493825['error'](0x1f4,_0xe9a72d[_0x8059('0x14')]));});});}; \ No newline at end of file +var _0x0abf=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x593467,_0x14e615){var _0x67a71b=function(_0x32799e){while(--_0x32799e){_0x593467['push'](_0x593467['shift']());}};_0x67a71b(++_0x14e615);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});config[_0xf0ab('0xa')]=_['defaults'](config[_0xf0ab('0xa')],{'host':_0xf0ab('0xb'),'port':0x18eb});var socket=require(_0xf0ab('0xc'))(new Redis(config[_0xf0ab('0xa')]));require('./mailMessage.socket')[_0xf0ab('0xd')](socket);function respondWithRpcPromise(_0x4688d8,_0x1e7887,_0x4ab8e7){return new BPromise(function(_0x5d25a0,_0x30042c){return client['request'](_0x4688d8,_0x4ab8e7)[_0xf0ab('0xe')](function(_0x10a5a2){logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));logger[_0xf0ab('0x12')](_0xf0ab('0x13'),_0x1e7887,'request\x20sent',JSON[_0xf0ab('0x14')](_0x10a5a2));if(_0x10a5a2[_0xf0ab('0x15')]){if(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x16')]===0x1f4){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x30042c(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);}logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x5d25a0(_0x10a5a2[_0xf0ab('0x15')]['message']);}else{logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));_0x5d25a0(_0x10a5a2[_0xf0ab('0x18')][_0xf0ab('0x17')]);}})[_0xf0ab('0x19')](function(_0x3a0edf){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x3a0edf);_0x30042c(_0x3a0edf);});});}exports[_0xf0ab('0x1a')]=function(_0x715579){var _0xdfcfb2=this;return new Promise(function(_0xf43bc4,_0x22a205){return db[_0xf0ab('0x1b')][_0xf0ab('0x1c')](_0x715579['body'],{'raw':_0x715579[_0xf0ab('0x1d')]?_0x715579[_0xf0ab('0x1d')][_0xf0ab('0x1e')]===undefined?!![]:![]:!![]})[_0xf0ab('0xe')](function(_0x3bf6a1){logger[_0xf0ab('0xf')](_0xf0ab('0x1a'),_0x715579);logger[_0xf0ab('0x12')](_0xf0ab('0x1a'),_0x715579,JSON[_0xf0ab('0x14')](_0x3bf6a1));_0xf43bc4(_0x3bf6a1);})[_0xf0ab('0x19')](function(_0x5645b2){logger['error']('CreateMailMessage',_0x5645b2[_0xf0ab('0x17')],_0x715579);_0x22a205(_0xdfcfb2['error'](0x1f4,_0x5645b2[_0xf0ab('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index cc8f9e0..038baa4 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 _0x945c=['length','mailMessage:','./mailMessage.events','save','update','register'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x945c,0x9e));var _0xc945=function(_0x1e0fbc,_0x23a9b4){_0x1e0fbc=_0x1e0fbc-0x0;var _0x7e15f=_0x945c[_0x1e0fbc];return _0x7e15f;};'use strict';var MailMessageEvents=require(_0xc945('0x0'));var events=[_0xc945('0x1'),'remove',_0xc945('0x2')];function createListener(_0x5167d9,_0x3369bd){return function(_0x3725c6){_0x3369bd['emit'](_0x5167d9,_0x3725c6);};}function removeListener(_0x55af92,_0x5a3758){return function(){MailMessageEvents['removeListener'](_0x55af92,_0x5a3758);};}exports[_0xc945('0x3')]=function(_0x4cd6c8){for(var _0x1a531e=0x0,_0x3df59f=events[_0xc945('0x4')];_0x1a531e<_0x3df59f;_0x1a531e++){var _0x505bfc=events[_0x1a531e];var _0x5ab635=createListener(_0xc945('0x5')+_0x505bfc,_0x4cd6c8);MailMessageEvents['on'](_0x505bfc,_0x5ab635);}}; \ No newline at end of file +var _0x13e9=['remove','update','removeListener','register','length','./mailMessage.events','save'];(function(_0x1428a5,_0x509abe){var _0x4b847a=function(_0x26132a){while(--_0x26132a){_0x1428a5['push'](_0x1428a5['shift']());}};_0x4b847a(++_0x509abe);}(_0x13e9,0xf3));var _0x913e=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x13e9[_0x334841];return _0x5beb4b;};'use strict';var MailMessageEvents=require(_0x913e('0x0'));var events=[_0x913e('0x1'),_0x913e('0x2'),_0x913e('0x3')];function createListener(_0x46bbbc,_0x657f2f){return function(_0x54a5dd){_0x657f2f['emit'](_0x46bbbc,_0x54a5dd);};}function removeListener(_0x3e7549,_0x19f4b2){return function(){MailMessageEvents[_0x913e('0x4')](_0x3e7549,_0x19f4b2);};}exports[_0x913e('0x5')]=function(_0x4535f9){for(var _0xaaeb06=0x0,_0xe659c1=events[_0x913e('0x6')];_0xaaeb06<_0xe659c1;_0xaaeb06++){var _0x29f2cf=events[_0xaaeb06];var _0x19ea3e=createListener('mailMessage:'+_0x29f2cf,_0x4535f9);MailMessageEvents['on'](_0x29f2cf,_0x19ea3e);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b741dc9..da97724 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 _0xd65e=['/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','removeTeams','delete','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x16bf78,_0x1e99d9){var _0x5a7a4b=function(_0x16b206){while(--_0x16b206){_0x16bf78['push'](_0x16bf78['shift']());}};_0x5a7a4b(++_0x1e99d9);}(_0xd65e,0x1ed));var _0xed65=function(_0x9ce402,_0x419d11){_0x9ce402=_0x9ce402-0x0;var _0x44416f=_0xd65e[_0x9ce402];return _0x44416f;};'use strict';var multer=require('multer');var util=require(_0xed65('0x0'));var path=require(_0xed65('0x1'));var timeout=require('connect-timeout');var express=require(_0xed65('0x2'));var router=express[_0xed65('0x3')]();var fs_extra=require(_0xed65('0x4'));var auth=require(_0xed65('0x5'));var interaction=require(_0xed65('0x6'));var config=require(_0xed65('0x7'));var controller=require(_0xed65('0x8'));router[_0xed65('0x9')]('/',auth[_0xed65('0xa')](),controller[_0xed65('0xb')]);router[_0xed65('0x9')](_0xed65('0xc'),auth[_0xed65('0xa')](),controller[_0xed65('0xd')]);router['get'](_0xed65('0xe'),auth['isAuthenticated'](),controller[_0xed65('0xf')]);router[_0xed65('0x9')](_0xed65('0x10'),auth['isAuthenticated'](),controller['getMembers']);router[_0xed65('0x9')](_0xed65('0x11'),auth[_0xed65('0xa')](),controller[_0xed65('0x12')]);router[_0xed65('0x9')](_0xed65('0x13'),auth[_0xed65('0xa')](),controller[_0xed65('0x14')]);router[_0xed65('0x15')]('/',auth[_0xed65('0xa')](),controller['create']);router['post'](_0xed65('0x11'),auth[_0xed65('0xa')](),controller[_0xed65('0x16')]);router[_0xed65('0x15')](_0xed65('0x13'),auth[_0xed65('0xa')](),controller[_0xed65('0x17')]);router[_0xed65('0x18')](_0xed65('0xe'),auth[_0xed65('0xa')](),controller[_0xed65('0x19')]);router['delete'](_0xed65('0xe'),auth[_0xed65('0xa')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xed65('0xa')](),controller[_0xed65('0x1a')]);router[_0xed65('0x1b')](_0xed65('0x13'),auth[_0xed65('0xa')](),controller[_0xed65('0x1c')]);module[_0xed65('0x1d')]=router; \ No newline at end of file +var _0x1198=['index','/describe','show','getMembers','getTeams','/:id/users','post','create','/:id/teams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x115581,_0x4e6fc6){var _0x1acaa4=function(_0x3b2788){while(--_0x3b2788){_0x115581['push'](_0x115581['shift']());}};_0x1acaa4(++_0x4e6fc6);}(_0x1198,0x148));var _0x8119=function(_0x51fc35,_0x34bb18){_0x51fc35=_0x51fc35-0x0;var _0x370154=_0x1198[_0x51fc35];return _0x370154;};'use strict';var multer=require(_0x8119('0x0'));var util=require(_0x8119('0x1'));var path=require(_0x8119('0x2'));var timeout=require(_0x8119('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8119('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8119('0x5'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0x8119('0x6')]('/',auth[_0x8119('0x7')](),controller[_0x8119('0x8')]);router[_0x8119('0x6')](_0x8119('0x9'),auth[_0x8119('0x7')](),controller['describe']);router[_0x8119('0x6')]('/:id',auth[_0x8119('0x7')](),controller[_0x8119('0xa')]);router[_0x8119('0x6')]('/:id/members',auth[_0x8119('0x7')](),controller[_0x8119('0xb')]);router[_0x8119('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8119('0xc')]);router[_0x8119('0x6')](_0x8119('0xd'),auth[_0x8119('0x7')](),controller['getAgents']);router[_0x8119('0xe')]('/',auth[_0x8119('0x7')](),controller[_0x8119('0xf')]);router['post'](_0x8119('0x10'),auth[_0x8119('0x7')](),controller['addTeams']);router[_0x8119('0xe')](_0x8119('0xd'),auth[_0x8119('0x7')](),controller[_0x8119('0x11')]);router[_0x8119('0x12')]('/:id',auth[_0x8119('0x7')](),controller['update']);router[_0x8119('0x13')]('/:id',auth[_0x8119('0x7')](),controller[_0x8119('0x14')]);router[_0x8119('0x13')](_0x8119('0x10'),auth[_0x8119('0x7')](),controller[_0x8119('0x15')]);router['delete'](_0x8119('0xd'),auth['isAuthenticated'](),controller[_0x8119('0x16')]);module[_0x8119('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 06a2af5..5f84b8d 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 _0xc8d0=['beepall','roundrobin','name','INTEGER','ENUM','rrmemory'];(function(_0x46cd97,_0x1d7f12){var _0x4eeb8a=function(_0x46d6bf){while(--_0x46d6bf){_0x46cd97['push'](_0x46cd97['shift']());}};_0x4eeb8a(++_0x1d7f12);}(_0xc8d0,0xe0));var _0x0c8d=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xc8d0[_0x1b70e3];return _0x1452ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0c8d('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0c8d('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0c8d('0x2')](_0x0c8d('0x3'),_0x0c8d('0x4'),_0x0c8d('0x5'))}}; \ No newline at end of file +var _0x3517=['INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3517,0x13b));var _0x7351=function(_0x5c40fb,_0x3ae75b){_0x5c40fb=_0x5c40fb-0x0;var _0x46266d=_0x3517[_0x5c40fb];return _0x46266d;};'use strict';var Sequelize=require(_0x7351('0x0'));module[_0x7351('0x1')]={'name':{'type':Sequelize[_0x7351('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7351('0x2')]},'timeout':{'type':Sequelize[_0x7351('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7351('0x4'),_0x7351('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 8553643..9e5aafe 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 _0xa81e=['flatMap','sequelize','transaction','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','includes','all','union','compact','value','removeAgents','forEach','addAgents','spread','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','get','MailQueues','destroy','then','error','send','index','map','MailQueue','fieldName','key','model','name','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','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','update','describe','getMembers','UserMailQueue','MailQueueId','options','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xa81e,0x13c));var _0xea81=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xa81e[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0xea81('0x0'));var rimraf=require(_0xea81('0x1'));var zipdir=require(_0xea81('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea81('0x3'));var moment=require(_0xea81('0x4'));var BPromise=require(_0xea81('0x5'));var Mustache=require(_0xea81('0x6'));var util=require(_0xea81('0x7'));var path=require(_0xea81('0x8'));var sox=require(_0xea81('0x9'));var csv=require(_0xea81('0xa'));var ejs=require(_0xea81('0xb'));var fs=require('fs');var fs_extra=require(_0xea81('0xc'));var _=require('lodash');var squel=require(_0xea81('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xea81('0xe'));var toCsv=require(_0xea81('0xa'));var querystring=require(_0xea81('0xf'));var Papa=require('papaparse');var Redis=require(_0xea81('0x10'));var authService=require(_0xea81('0x11'));var qs=require(_0xea81('0x12'));var as=require(_0xea81('0x13'));var hardwareService=require(_0xea81('0x14'));var logger=require(_0xea81('0x15'))('api');var utils=require(_0xea81('0x16'));var config=require(_0xea81('0x17'));var licenseUtil=require(_0xea81('0x18'));var db=require('../../mysqldb')['db'];config[_0xea81('0x19')]=_[_0xea81('0x1a')](config[_0xea81('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xea81('0x1b'))(new Redis(config['redis']));require(_0xea81('0x1c'))[_0xea81('0x1d')](socket);function respondWithStatusCode(_0x56c2c0,_0xadd0b9){_0xadd0b9=_0xadd0b9||0xcc;return function(_0x25fb42){if(_0x25fb42){return _0x56c2c0[_0xea81('0x1e')](_0xadd0b9);}return _0x56c2c0['status'](_0xadd0b9)[_0xea81('0x1f')]();};}function respondWithResult(_0x392a25,_0x558b8f){_0x558b8f=_0x558b8f||0xc8;return function(_0x931398){if(_0x931398){return _0x392a25[_0xea81('0x20')](_0x558b8f)[_0xea81('0x21')](_0x931398);}};}function respondWithFilteredResult(_0x1e5b38,_0x31f94f){return function(_0x5d8a34){if(_0x5d8a34){var _0x100655=typeof _0x31f94f[_0xea81('0x22')]===_0xea81('0x23')&&typeof _0x31f94f[_0xea81('0x24')]==='undefined';var _0x4c5594=_0x5d8a34[_0xea81('0x25')];var _0x23ac51=_0x100655?0x0:_0x31f94f[_0xea81('0x22')];var _0x3946de=_0x100655?_0x5d8a34['count']:_0x31f94f[_0xea81('0x22')]+_0x31f94f[_0xea81('0x24')];var _0xd72ca5;if(_0x3946de>=_0x4c5594){_0x3946de=_0x4c5594;_0xd72ca5=0xc8;}else{_0xd72ca5=0xce;}_0x1e5b38[_0xea81('0x20')](_0xd72ca5);return _0x1e5b38['set']('Content-Range',_0x23ac51+'-'+_0x3946de+'/'+_0x4c5594)[_0xea81('0x21')](_0x5d8a34);}return null;};}function patchUpdates(_0x52b3d5){return function(_0x1c9ba9){try{jsonpatch[_0xea81('0x26')](_0x1c9ba9,_0x52b3d5,!![]);}catch(_0x1a3c61){return BPromise[_0xea81('0x27')](_0x1a3c61);}return _0x1c9ba9[_0xea81('0x28')]();};}function saveUpdates(_0x3d6d9b,_0x1312ef){return function(_0x144f50){if(_0x144f50){return _0x144f50['update'](_0x3d6d9b)['then'](function(_0x1c5015){return _0x1c5015;});}return null;};}function removeEntity(_0x257973,_0x4c0e6){return function(_0x2b1e20){if(_0x2b1e20){return _0x2b1e20['destroy']()['then'](function(){var _0x157293=_0x2b1e20[_0xea81('0x29')]({'plain':!![]});var _0x27e152=_0xea81('0x2a');return db['UserProfileResource'][_0xea81('0x2b')]({'where':{'type':_0x27e152,'resourceId':_0x157293['id']}})[_0xea81('0x2c')](function(){return _0x2b1e20;});})[_0xea81('0x2c')](function(){_0x257973[_0xea81('0x20')](0xcc)[_0xea81('0x1f')]();});}};}function handleEntityNotFound(_0x4219ce,_0x9cb1a3){return function(_0x50ade8){if(!_0x50ade8){_0x4219ce['sendStatus'](0x194);}return _0x50ade8;};}function handleError(_0xdc05ca,_0x4e2f66){_0x4e2f66=_0x4e2f66||0x1f4;return function(_0x3544de){logger[_0xea81('0x2d')](_0x3544de['stack']);if(_0x3544de['name']){delete _0x3544de['name'];}_0xdc05ca[_0xea81('0x20')](_0x4e2f66)[_0xea81('0x2e')](_0x3544de);};}exports[_0xea81('0x2f')]=function(_0x1f6ee7,_0x5c8123){var _0x54ac0e={},_0x1299cb={},_0x183d49={'count':0x0,'rows':[]};var _0x44a111=_[_0xea81('0x30')](db[_0xea81('0x31')]['rawAttributes'],function(_0x3660eb){return{'name':_0x3660eb[_0xea81('0x32')],'type':_0x3660eb['type'][_0xea81('0x33')]};});_0x1299cb[_0xea81('0x34')]=_[_0xea81('0x30')](_0x44a111,_0xea81('0x35'));_0x1299cb[_0xea81('0x36')]=_['keys'](_0x1f6ee7['query']);_0x1299cb[_0xea81('0x37')]=_['intersection'](_0x1299cb[_0xea81('0x34')],_0x1299cb['query']);_0x54ac0e[_0xea81('0x38')]=_[_0xea81('0x39')](_0x1299cb[_0xea81('0x34')],qs['fields'](_0x1f6ee7['query'][_0xea81('0x3a')]));_0x54ac0e[_0xea81('0x38')]=_0x54ac0e['attributes'][_0xea81('0x3b')]?_0x54ac0e[_0xea81('0x38')]:_0x1299cb[_0xea81('0x34')];if(!_0x1f6ee7[_0xea81('0x36')]['hasOwnProperty'](_0xea81('0x3c'))){_0x54ac0e[_0xea81('0x24')]=qs['limit'](_0x1f6ee7['query'][_0xea81('0x24')]);_0x54ac0e['offset']=qs[_0xea81('0x22')](_0x1f6ee7[_0xea81('0x36')][_0xea81('0x22')]);}_0x54ac0e[_0xea81('0x3d')]=qs['sort'](_0x1f6ee7['query'][_0xea81('0x3e')]);_0x54ac0e[_0xea81('0x3f')]=qs[_0xea81('0x37')](_[_0xea81('0x40')](_0x1f6ee7[_0xea81('0x36')],_0x1299cb[_0xea81('0x37')]),_0x44a111);if(_0x1f6ee7[_0xea81('0x36')][_0xea81('0x41')]){_0x54ac0e['where']=_[_0xea81('0x42')](_0x54ac0e[_0xea81('0x3f')],{'$or':_[_0xea81('0x30')](_0x44a111,function(_0x869b7a){if(_0x869b7a[_0xea81('0x43')]!==_0xea81('0x44')){var _0xce2dbe={};_0xce2dbe[_0x869b7a[_0xea81('0x35')]]={'$like':'%'+_0x1f6ee7[_0xea81('0x36')][_0xea81('0x41')]+'%'};return _0xce2dbe;}})});}_0x54ac0e=_['merge']({},_0x54ac0e,_0x1f6ee7['options']);var _0x1ddc71={'where':_0x54ac0e[_0xea81('0x3f')]};return db[_0xea81('0x31')][_0xea81('0x25')](_0x1ddc71)[_0xea81('0x2c')](function(_0x2f0321){_0x183d49['count']=_0x2f0321;if(_0x1f6ee7[_0xea81('0x36')][_0xea81('0x45')]){_0x54ac0e[_0xea81('0x46')]=[{'all':!![]}];}return db[_0xea81('0x31')][_0xea81('0x47')](_0x54ac0e);})[_0xea81('0x2c')](function(_0xaf3f42){_0x183d49[_0xea81('0x48')]=_0xaf3f42;return _0x183d49;})[_0xea81('0x2c')](respondWithFilteredResult(_0x5c8123,_0x54ac0e))[_0xea81('0x49')](handleError(_0x5c8123,null));};exports[_0xea81('0x4a')]=function(_0x2ce06c,_0x332c89){var _0x1eb413={'raw':!![],'where':{'id':_0x2ce06c[_0xea81('0x4b')]['id']}},_0x5bb03b={};_0x5bb03b[_0xea81('0x34')]=_['keys'](db[_0xea81('0x31')][_0xea81('0x4c')]);_0x5bb03b[_0xea81('0x36')]=_[_0xea81('0x4d')](_0x2ce06c['query']);_0x5bb03b[_0xea81('0x37')]=_[_0xea81('0x39')](_0x5bb03b[_0xea81('0x34')],_0x5bb03b[_0xea81('0x36')]);_0x1eb413[_0xea81('0x38')]=_[_0xea81('0x39')](_0x5bb03b[_0xea81('0x34')],qs['fields'](_0x2ce06c['query'][_0xea81('0x3a')]));_0x1eb413[_0xea81('0x38')]=_0x1eb413[_0xea81('0x38')][_0xea81('0x3b')]?_0x1eb413[_0xea81('0x38')]:_0x5bb03b[_0xea81('0x34')];if(_0x2ce06c[_0xea81('0x36')][_0xea81('0x45')]){_0x1eb413[_0xea81('0x46')]=[{'all':!![]}];}_0x1eb413=_[_0xea81('0x42')]({},_0x1eb413,_0x2ce06c['options']);return db[_0xea81('0x31')][_0xea81('0x4e')](_0x1eb413)['then'](handleEntityNotFound(_0x332c89,null))['then'](respondWithResult(_0x332c89,null))['catch'](handleError(_0x332c89,null));};exports[_0xea81('0x4f')]=function(_0x246966,_0x3e913b){return db[_0xea81('0x31')]['create'](_0x246966[_0xea81('0x50')],{})[_0xea81('0x2c')](function(_0x4b482c){var _0x52ab64=_0x246966[_0xea81('0x51')][_0xea81('0x29')]({'plain':!![]});if(!_0x52ab64)throw new Error(_0xea81('0x52'));if(_0x52ab64[_0xea81('0x53')]==='user'){var _0x46c6ad=_0x4b482c['get']({'plain':!![]});var _0x4690e1='MailQueues';return db[_0xea81('0x54')]['find']({'where':{'name':_0x4690e1,'userProfileId':_0x52ab64[_0xea81('0x55')]},'raw':!![]})[_0xea81('0x2c')](function(_0x164596){if(_0x164596&&_0x164596[_0xea81('0x56')]===0x0){return db[_0xea81('0x57')]['create']({'name':_0x46c6ad['name'],'resourceId':_0x46c6ad['id'],'type':_0x164596[_0xea81('0x35')],'sectionId':_0x164596['id']},{})[_0xea81('0x2c')](function(){return _0x4b482c;});}else{return _0x4b482c;}})[_0xea81('0x49')](function(_0x3f6a48){logger[_0xea81('0x2d')](_0xea81('0x58'),_0x3f6a48);throw _0x3f6a48;});}return _0x4b482c;})[_0xea81('0x2c')](respondWithResult(_0x3e913b,0xc9))[_0xea81('0x49')](handleError(_0x3e913b,null));};exports[_0xea81('0x59')]=function(_0x5a6810,_0x1caa83){if(_0x5a6810[_0xea81('0x50')]['id']){delete _0x5a6810[_0xea81('0x50')]['id'];}return db[_0xea81('0x31')][_0xea81('0x4e')]({'where':{'id':_0x5a6810[_0xea81('0x4b')]['id']}})[_0xea81('0x2c')](handleEntityNotFound(_0x1caa83,null))['then'](saveUpdates(_0x5a6810[_0xea81('0x50')],null))[_0xea81('0x2c')](respondWithResult(_0x1caa83,null))[_0xea81('0x49')](handleError(_0x1caa83,null));};exports[_0xea81('0x2b')]=function(_0x741b8b,_0x8f1dfb){return db[_0xea81('0x31')][_0xea81('0x4e')]({'where':{'id':_0x741b8b[_0xea81('0x4b')]['id']}})[_0xea81('0x2c')](handleEntityNotFound(_0x8f1dfb,null))['then'](removeEntity(_0x8f1dfb,null))['catch'](handleError(_0x8f1dfb,null));};exports[_0xea81('0x5a')]=function(_0x20d7f9,_0x1ae0c2){return db[_0xea81('0x31')][_0xea81('0x5a')]()['then'](respondWithResult(_0x1ae0c2,null))[_0xea81('0x49')](handleError(_0x1ae0c2,null));};exports[_0xea81('0x5b')]=function(_0x3d6a17,_0x5e73ed,_0x20d44f){var _0x46d2f5={'raw':!![],'where':{}},_0x440869={},_0x2f34c3;return db['MailQueue']['findOne']({'where':{'id':_0x3d6a17[_0xea81('0x4b')]['id']}})[_0xea81('0x2c')](handleEntityNotFound(_0x5e73ed,null))[_0xea81('0x2c')](function(_0x3a62fe){if(_0x3a62fe){_0x2f34c3=_0x3a62fe['get']({'plain':!![]});_0x440869[_0xea81('0x34')]=_[_0xea81('0x4d')](db[_0xea81('0x5c')][_0xea81('0x4c')]);_0x440869[_0xea81('0x36')]=_[_0xea81('0x4d')](_0x3d6a17[_0xea81('0x36')]);_0x440869['filters']=_[_0xea81('0x39')](_0x440869[_0xea81('0x34')],_0x440869[_0xea81('0x36')]);_0x46d2f5[_0xea81('0x38')]=_['intersection'](_0x440869['model'],qs['fields'](_0x3d6a17[_0xea81('0x36')][_0xea81('0x3a')]));_0x46d2f5[_0xea81('0x38')]=_0x46d2f5['attributes']['length']?_0x46d2f5[_0xea81('0x38')]:_0x440869[_0xea81('0x34')];if(!_0x3d6a17['query']['hasOwnProperty']('nolimit')){_0x46d2f5[_0xea81('0x24')]=qs['limit'](_0x3d6a17[_0xea81('0x36')][_0xea81('0x24')]);_0x46d2f5[_0xea81('0x22')]=qs[_0xea81('0x22')](_0x3d6a17[_0xea81('0x36')][_0xea81('0x22')]);}_0x46d2f5[_0xea81('0x3d')]=qs[_0xea81('0x3e')](_0x3d6a17[_0xea81('0x36')]['sort']);_0x46d2f5[_0xea81('0x3f')]=qs[_0xea81('0x37')](_[_0xea81('0x40')](_0x3d6a17[_0xea81('0x36')],_0x440869[_0xea81('0x37')]));_0x46d2f5[_0xea81('0x3f')][_0xea81('0x5d')]=_0x3a62fe['id'];if(_0x3d6a17[_0xea81('0x36')][_0xea81('0x41')]){_0x46d2f5[_0xea81('0x3f')]=_['merge'](_0x46d2f5['where'],{'$or':_['map'](_0x46d2f5['attributes'],function(_0x319c7f){var _0x4693d6={};_0x4693d6[_0x319c7f]={'$like':'%'+_0x3d6a17[_0xea81('0x36')][_0xea81('0x41')]+'%'};return _0x4693d6;})});}_0x46d2f5=_[_0xea81('0x42')]({},_0x46d2f5,_0x3d6a17[_0xea81('0x5e')]);return db[_0xea81('0x5c')]['findAll'](_0x46d2f5);}})['then'](function(_0x4b3567){if(_0x4b3567){return db[_0xea81('0x5f')][_0xea81('0x60')]({'where':{'id':_[_0xea81('0x30')](_0x4b3567,'UserId'),'role':_0xea81('0x61')},'attributes':['id',_0xea81('0x35'),_0xea81('0x62'),_0xea81('0x63'),_0xea81('0x64')]});}})[_0xea81('0x2c')](function(_0x5df0d5){if(_0x5df0d5){return{'count':_0x5df0d5[_0xea81('0x25')],'rows':_[_0xea81('0x30')](_0x5df0d5[_0xea81('0x48')],function(_0x36b6aa){return{'membername':_0x36b6aa['name'],'UserId':_0x36b6aa['id'],'queue_name':_0x2f34c3[_0xea81('0x35')],'MailQueueId':_0x2f34c3['id'],'interface':util[_0xea81('0x65')](_0xea81('0x66'),_0xea81('0x67'),_0x36b6aa[_0xea81('0x35')]),'penalty':0x0,'paused':_0x36b6aa[_0xea81('0x62')],'createdAt':_0x36b6aa['createdAt'],'updatedAt':_0x36b6aa[_0xea81('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xea81('0x2c')](respondWithFilteredResult(_0x5e73ed,_0x46d2f5))[_0xea81('0x49')](handleError(_0x5e73ed,null));};exports[_0xea81('0x68')]=function(_0x84069d,_0x29a24b,_0x5604e3){var _0x2fab9d={};var _0xf8dbf={};var _0x471051;var _0x26e842;return db[_0xea81('0x31')][_0xea81('0x69')]({'where':{'id':_0x84069d[_0xea81('0x4b')]['id']}})[_0xea81('0x2c')](handleEntityNotFound(_0x29a24b,null))[_0xea81('0x2c')](function(_0x59d6d9){if(_0x59d6d9){_0x471051=_0x59d6d9;_0xf8dbf[_0xea81('0x34')]=_[_0xea81('0x4d')](db[_0xea81('0x6a')][_0xea81('0x4c')]);_0xf8dbf[_0xea81('0x36')]=_[_0xea81('0x4d')](_0x84069d[_0xea81('0x36')]);_0xf8dbf['filters']=_[_0xea81('0x39')](_0xf8dbf[_0xea81('0x34')],_0xf8dbf[_0xea81('0x36')]);_0x2fab9d[_0xea81('0x38')]=_[_0xea81('0x39')](_0xf8dbf[_0xea81('0x34')],qs['fields'](_0x84069d[_0xea81('0x36')][_0xea81('0x3a')]));_0x2fab9d['attributes']=_0x2fab9d[_0xea81('0x38')][_0xea81('0x3b')]?_0x2fab9d[_0xea81('0x38')]:_0xf8dbf['model'];_0x2fab9d['order']=qs[_0xea81('0x3e')](_0x84069d[_0xea81('0x36')][_0xea81('0x3e')]);_0x2fab9d[_0xea81('0x3f')]=qs[_0xea81('0x37')](_['pick'](_0x84069d[_0xea81('0x36')],_0xf8dbf[_0xea81('0x37')]));if(_0x84069d['query'][_0xea81('0x41')]){_0x2fab9d[_0xea81('0x3f')]=_[_0xea81('0x42')](_0x2fab9d[_0xea81('0x3f')],{'$or':_['map'](_0x2fab9d['attributes'],function(_0x4f85e6){var _0x41562b={};_0x41562b[_0x4f85e6]={'$like':'%'+_0x84069d[_0xea81('0x36')]['filter']+'%'};return _0x41562b;})});}_0x2fab9d=_['merge']({},_0x2fab9d,_0x84069d[_0xea81('0x5e')]);return _0x471051['getTeams'](_0x2fab9d);}})[_0xea81('0x2c')](function(_0x1d3e0a){if(_0x1d3e0a){_0x26e842=_0x1d3e0a[_0xea81('0x3b')];if(!_0x84069d[_0xea81('0x36')][_0xea81('0x6b')](_0xea81('0x3c'))){_0x2fab9d['limit']=qs['limit'](_0x84069d['query'][_0xea81('0x24')]);_0x2fab9d[_0xea81('0x22')]=qs[_0xea81('0x22')](_0x84069d[_0xea81('0x36')][_0xea81('0x22')]);}return _0x471051[_0xea81('0x68')](_0x2fab9d);}})[_0xea81('0x2c')](function(_0xab4132){if(_0xab4132){return _0xab4132?{'count':_0x26e842,'rows':_0xab4132}:null;}})['then'](respondWithResult(_0x29a24b,null))['catch'](handleError(_0x29a24b,null));};exports[_0xea81('0x6c')]=function(_0x3bace7,_0x5377e3,_0x8e6a6e){var _0x3836ba=_0x3bace7[_0xea81('0x50')][_0xea81('0x6d')];return db['Team'][_0xea81('0x47')]({'where':{'id':_0x3836ba},'attributes':['id'],'include':[{'model':db[_0xea81('0x5f')],'as':_0xea81('0x6e'),'attributes':['id',_0xea81('0x35'),_0xea81('0x6f'),_0xea81('0x70'),'interface'],'raw':!![]}]})[_0xea81('0x2c')](function(_0x3ed765){if(_0x3ed765){var _0x276084=_[_0xea81('0x71')](_0x3ed765,function(_0x96bc3c){var _0x241e2e=_0x96bc3c[_0xea81('0x29')]({'plain':!![]});return _0x241e2e[_0xea81('0x6e')];});return db[_0xea81('0x31')][_0xea81('0x4e')]({'where':{'id':_0x3bace7[_0xea81('0x4b')]['id']}})[_0xea81('0x2c')](function(_0x390421){return db[_0xea81('0x72')][_0xea81('0x73')](function(_0x5c7d10){return _0x390421[_0xea81('0x6c')](_0x3836ba,{'transaction':_0x5c7d10})[_0xea81('0x2c')](function(){return BPromise['each'](_0x276084,function(_0x4c0f8b){return db['UserMailQueue'][_0xea81('0x74')]({'where':{'UserId':_0x4c0f8b['id'],'MailQueueId':_0x3bace7['params']['id']},'transaction':_0x5c7d10});});})[_0xea81('0x2c')](function(){_0x276084['forEach'](function(_0x1cc0a4){socket[_0xea81('0x75')](_0xea81('0x76'),{'UserId':_0x1cc0a4['id'],'MailQueueId':_0x390421['id']});});});});});}})[_0xea81('0x2c')](respondWithStatusCode(_0x5377e3,null))[_0xea81('0x49')](handleError(_0x5377e3,null));};exports[_0xea81('0x77')]=function(_0x2b29d2,_0x8526db,_0x4067ea){return db['Team'][_0xea81('0x47')]({'where':{'id':_0x2b29d2[_0xea81('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xea81('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xea81('0x2c')](handleEntityNotFound(_0x8526db,null))[_0xea81('0x2c')](function(_0x24d7e4){var _0x17b659=_['map'](_0x24d7e4,'id');var _0x2822b7=[];var _0xffd0fd=[];var _0x18209d=squel[_0xea81('0x78')]();_0x18209d[_0xea81('0x79')]('tq.TeamId')[_0xea81('0x7a')](_0xea81('0x7b'),'tq')[_0xea81('0x7c')](_0xea81('0x7d'),'ut',_0xea81('0x7e'))[_0xea81('0x3f')](_0xea81('0x7f'),_0x2b29d2[_0xea81('0x4b')]['id']);for(var _0x388610=0x0;_0x388610<_0x24d7e4[_0xea81('0x3b')];_0x388610+=0x1){let _0x3010e8=_0x24d7e4[_0x388610];for(var _0x5e2146=0x0;_0x5e2146<_0x3010e8['Agents']['length'];_0x5e2146+=0x1){let _0x29021d=_0x3010e8[_0xea81('0x6e')][_0x5e2146];var _0x246faf=_0x18209d[_0xea81('0x80')]();_0x246faf[_0xea81('0x3f')](_0xea81('0x81'),_0x29021d['id']);_0xffd0fd[_0xea81('0x82')](db[_0xea81('0x72')][_0xea81('0x36')](_0x246faf['toString'](),{'type':db[_0xea81('0x72')][_0xea81('0x83')]['SELECT']})['then'](function(_0x2b168b){if(_0x2b168b['length']===0x1){return _0x29021d['id'];}else{var _0x37b619=_['every'](_[_0xea81('0x30')](_0x2b168b,'TeamId'),function(_0x2c1f2d){return _[_0xea81('0x84')](_0x17b659,_0x2c1f2d);});if(_0x37b619){return _0x29021d['id'];}}}));}}return BPromise[_0xea81('0x85')](_0xffd0fd)['then'](function(_0x2eff0f){_0x2822b7=_(_0x2822b7)[_0xea81('0x86')](_0x2eff0f)[_0xea81('0x87')]()[_0xea81('0x88')]();return db[_0xea81('0x31')][_0xea81('0x4e')]({'where':{'id':_0x2b29d2[_0xea81('0x4b')]['id']}})[_0xea81('0x2c')](function(_0x5725b2){return db['sequelize'][_0xea81('0x73')](function(_0x74e5f0){return _0x5725b2[_0xea81('0x77')](_0x2b29d2[_0xea81('0x36')][_0xea81('0x6d')],{'transaction':_0x74e5f0})[_0xea81('0x2c')](function(){if(!_['isEmpty'](_0x2822b7)){return _0x5725b2[_0xea81('0x89')](_0x2822b7,{'transaction':_0x74e5f0});}})['then'](function(){_0x2822b7[_0xea81('0x8a')](function(_0x3f10ba){socket[_0xea81('0x75')]('userMailQueue:remove',{'UserId':_0x3f10ba,'MailQueueId':_0x5725b2['id']});});});});});});})['then'](respondWithStatusCode(_0x8526db,null))[_0xea81('0x49')](handleError(_0x8526db,null));};exports['addAgents']=function(_0x1014d5,_0x3eb622,_0x292cd5){return db[_0xea81('0x31')][_0xea81('0x4e')]({'where':{'id':_0x1014d5[_0xea81('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3eb622,null))[_0xea81('0x2c')](function(_0x41e5a7){if(_0x41e5a7){return _0x41e5a7[_0xea81('0x8b')](_0x1014d5['body'][_0xea81('0x6d')],_['omit'](_0x1014d5[_0xea81('0x50')],[_0xea81('0x6d'),'id'])||{})[_0xea81('0x8c')](function(_0x4d8bb7){for(var _0x5c8264=0x0;_0x5c8264<_0x1014d5['body']['ids']['length'];_0x5c8264+=0x1){socket[_0xea81('0x75')]('userMailQueue:save',{'UserId':Number(_0x1014d5['body'][_0xea81('0x6d')][_0x5c8264]),'MailQueueId':Number(_0x1014d5[_0xea81('0x4b')]['id'])});}return _0x4d8bb7;});}})[_0xea81('0x2c')](respondWithResult(_0x3eb622,null))[_0xea81('0x49')](handleError(_0x3eb622,null));};exports[_0xea81('0x89')]=function(_0x370c7b,_0x2d8b34,_0x12a347){return db['MailQueue'][_0xea81('0x4e')]({'where':{'id':_0x370c7b[_0xea81('0x4b')]['id']}})[_0xea81('0x2c')](handleEntityNotFound(_0x2d8b34,null))[_0xea81('0x2c')](function(_0x46e755){if(_0x46e755){return _0x46e755[_0xea81('0x89')](_0x370c7b[_0xea81('0x36')][_0xea81('0x6d')])['then'](function(){if(_['isArray'](_0x370c7b['query'][_0xea81('0x6d')])){for(var _0x476de4=0x0;_0x476de4<_0x370c7b[_0xea81('0x36')][_0xea81('0x6d')]['length'];_0x476de4+=0x1){socket[_0xea81('0x75')]('userMailQueue:remove',{'UserId':Number(_0x370c7b[_0xea81('0x36')][_0xea81('0x6d')][_0x476de4]),'MailQueueId':Number(_0x370c7b['params']['id'])});}}else{socket[_0xea81('0x75')](_0xea81('0x8d'),{'UserId':Number(_0x370c7b[_0xea81('0x36')][_0xea81('0x6d')]),'MailQueueId':Number(_0x370c7b[_0xea81('0x4b')]['id'])});}});}})[_0xea81('0x2c')](respondWithStatusCode(_0x2d8b34,null))[_0xea81('0x49')](handleError(_0x2d8b34,null));};exports[_0xea81('0x8e')]=function(_0x4a3a37,_0x59fda0,_0x44a049){var _0x3cae11={};var _0x5aa4fd={};var _0x20b62d;var _0x3c8cf6;return db[_0xea81('0x31')][_0xea81('0x69')]({'where':{'id':_0x4a3a37['params']['id']}})[_0xea81('0x2c')](handleEntityNotFound(_0x59fda0,null))[_0xea81('0x2c')](function(_0x4219df){if(_0x4219df){_0x20b62d=_0x4219df;_0x5aa4fd[_0xea81('0x34')]=_[_0xea81('0x4d')](db[_0xea81('0x5f')]['rawAttributes']);_0x5aa4fd[_0xea81('0x36')]=_[_0xea81('0x4d')](_0x4a3a37[_0xea81('0x36')]);_0x5aa4fd[_0xea81('0x37')]=_[_0xea81('0x39')](_0x5aa4fd[_0xea81('0x34')],_0x5aa4fd['query']);_0x3cae11[_0xea81('0x38')]=_['intersection'](_0x5aa4fd[_0xea81('0x34')],qs[_0xea81('0x3a')](_0x4a3a37[_0xea81('0x36')][_0xea81('0x3a')]));_0x3cae11[_0xea81('0x38')]=_0x3cae11[_0xea81('0x38')][_0xea81('0x3b')]?_0x3cae11[_0xea81('0x38')]:_0x5aa4fd[_0xea81('0x34')];_0x3cae11['order']=qs['sort'](_0x4a3a37[_0xea81('0x36')][_0xea81('0x3e')]);_0x3cae11[_0xea81('0x3f')]=qs[_0xea81('0x37')](_[_0xea81('0x40')](_0x4a3a37[_0xea81('0x36')],_0x5aa4fd[_0xea81('0x37')]));if(_0x4a3a37[_0xea81('0x36')][_0xea81('0x41')]){_0x3cae11[_0xea81('0x3f')]=_['merge'](_0x3cae11['where'],{'$or':_['map'](_0x3cae11[_0xea81('0x38')],function(_0xb5bdf7){var _0x5a469c={};_0x5a469c[_0xb5bdf7]={'$like':'%'+_0x4a3a37['query'][_0xea81('0x41')]+'%'};return _0x5a469c;})});}_0x3cae11=_[_0xea81('0x42')]({},_0x3cae11,_0x4a3a37[_0xea81('0x5e')]);return _0x20b62d[_0xea81('0x8e')](_0x3cae11);}})[_0xea81('0x2c')](function(_0x57d622){if(_0x57d622){_0x3c8cf6=_0x57d622['length'];if(!_0x4a3a37[_0xea81('0x36')][_0xea81('0x6b')](_0xea81('0x3c'))){_0x3cae11['limit']=qs[_0xea81('0x24')](_0x4a3a37[_0xea81('0x36')]['limit']);_0x3cae11['offset']=qs[_0xea81('0x22')](_0x4a3a37[_0xea81('0x36')]['offset']);}return _0x20b62d[_0xea81('0x8e')](_0x3cae11);}})[_0xea81('0x2c')](function(_0x5efb46){if(_0x5efb46){return _0x5efb46?{'count':_0x3c8cf6,'rows':_0x5efb46}:null;}})[_0xea81('0x2c')](respondWithResult(_0x59fda0,null))[_0xea81('0x49')](handleError(_0x59fda0,null));}; \ No newline at end of file +var _0x1be9=['to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','MailQueue','includeAll','catch','show','params','length','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','MailQueues','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserMailQueue','order','MailQueueId','findAll','UserId','mailPause','updatedAt','%s/%s','SIP','Team','getTeams','ids','User','Agents','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0x1be9,0x77));var _0x91be=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1be9[_0x24f31b];return _0x488401;};'use strict';var emlformat=require(_0x91be('0x0'));var rimraf=require(_0x91be('0x1'));var zipdir=require(_0x91be('0x2'));var jsonpatch=require(_0x91be('0x3'));var rp=require('request-promise');var moment=require(_0x91be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91be('0x5'));var util=require(_0x91be('0x6'));var path=require(_0x91be('0x7'));var sox=require(_0x91be('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91be('0x9'));var _=require(_0x91be('0xa'));var squel=require(_0x91be('0xb'));var crypto=require(_0x91be('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x91be('0xd'));var toCsv=require(_0x91be('0xe'));var querystring=require(_0x91be('0xf'));var Papa=require('papaparse');var Redis=require(_0x91be('0x10'));var authService=require(_0x91be('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91be('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x91be('0x13'));var config=require(_0x91be('0x14'));var licenseUtil=require(_0x91be('0x15'));var db=require(_0x91be('0x16'))['db'];config[_0x91be('0x17')]=_[_0x91be('0x18')](config[_0x91be('0x17')],{'host':_0x91be('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91be('0x17')]));require(_0x91be('0x1a'))[_0x91be('0x1b')](socket);function respondWithStatusCode(_0x27186d,_0x36a103){_0x36a103=_0x36a103||0xcc;return function(_0xb7849e){if(_0xb7849e){return _0x27186d[_0x91be('0x1c')](_0x36a103);}return _0x27186d[_0x91be('0x1d')](_0x36a103)[_0x91be('0x1e')]();};}function respondWithResult(_0x2af163,_0x40a37b){_0x40a37b=_0x40a37b||0xc8;return function(_0x55c517){if(_0x55c517){return _0x2af163['status'](_0x40a37b)['json'](_0x55c517);}};}function respondWithFilteredResult(_0x5ec52c,_0x3012c5){return function(_0x3230a2){if(_0x3230a2){var _0x4b47c5=typeof _0x3012c5[_0x91be('0x1f')]===_0x91be('0x20')&&typeof _0x3012c5[_0x91be('0x21')]==='undefined';var _0x16cc8f=_0x3230a2[_0x91be('0x22')];var _0x1a3592=_0x4b47c5?0x0:_0x3012c5[_0x91be('0x1f')];var _0x3f107a=_0x4b47c5?_0x3230a2[_0x91be('0x22')]:_0x3012c5[_0x91be('0x1f')]+_0x3012c5[_0x91be('0x21')];var _0x595c1b;if(_0x3f107a>=_0x16cc8f){_0x3f107a=_0x16cc8f;_0x595c1b=0xc8;}else{_0x595c1b=0xce;}_0x5ec52c[_0x91be('0x1d')](_0x595c1b);return _0x5ec52c[_0x91be('0x23')]('Content-Range',_0x1a3592+'-'+_0x3f107a+'/'+_0x16cc8f)[_0x91be('0x24')](_0x3230a2);}return null;};}function patchUpdates(_0x5a2d07){return function(_0x1fc15a){try{jsonpatch['apply'](_0x1fc15a,_0x5a2d07,!![]);}catch(_0x509d09){return BPromise['reject'](_0x509d09);}return _0x1fc15a[_0x91be('0x25')]();};}function saveUpdates(_0x7dbfd0,_0x1cca98){return function(_0x2b8e7b){if(_0x2b8e7b){return _0x2b8e7b[_0x91be('0x26')](_0x7dbfd0)[_0x91be('0x27')](function(_0x11c2c0){return _0x11c2c0;});}return null;};}function removeEntity(_0x49b4a1,_0x546bd5){return function(_0x531b8d){if(_0x531b8d){return _0x531b8d[_0x91be('0x28')]()[_0x91be('0x27')](function(){var _0x497c29=_0x531b8d['get']({'plain':!![]});var _0x251774='MailQueues';return db[_0x91be('0x29')][_0x91be('0x28')]({'where':{'type':_0x251774,'resourceId':_0x497c29['id']}})[_0x91be('0x27')](function(){return _0x531b8d;});})[_0x91be('0x27')](function(){_0x49b4a1[_0x91be('0x1d')](0xcc)[_0x91be('0x1e')]();});}};}function handleEntityNotFound(_0x44f091,_0x2a3b12){return function(_0x497a46){if(!_0x497a46){_0x44f091['sendStatus'](0x194);}return _0x497a46;};}function handleError(_0x2b806f,_0x5cd768){_0x5cd768=_0x5cd768||0x1f4;return function(_0x4ad7b1){logger[_0x91be('0x2a')](_0x4ad7b1[_0x91be('0x2b')]);if(_0x4ad7b1[_0x91be('0x2c')]){delete _0x4ad7b1[_0x91be('0x2c')];}_0x2b806f[_0x91be('0x1d')](_0x5cd768)[_0x91be('0x2d')](_0x4ad7b1);};}exports[_0x91be('0x2e')]=function(_0x235ae8,_0x3b1677){var _0x57b6f9={},_0x2ffe05={},_0x21ef6f={'count':0x0,'rows':[]};var _0x76ce4d=_[_0x91be('0x2f')](db['MailQueue'][_0x91be('0x30')],function(_0x45f2bc){return{'name':_0x45f2bc[_0x91be('0x31')],'type':_0x45f2bc[_0x91be('0x32')][_0x91be('0x33')]};});_0x2ffe05[_0x91be('0x34')]=_[_0x91be('0x2f')](_0x76ce4d,_0x91be('0x2c'));_0x2ffe05['query']=_[_0x91be('0x35')](_0x235ae8['query']);_0x2ffe05['filters']=_[_0x91be('0x36')](_0x2ffe05['model'],_0x2ffe05[_0x91be('0x37')]);_0x57b6f9[_0x91be('0x38')]=_[_0x91be('0x36')](_0x2ffe05['model'],qs[_0x91be('0x39')](_0x235ae8['query'][_0x91be('0x39')]));_0x57b6f9[_0x91be('0x38')]=_0x57b6f9['attributes']['length']?_0x57b6f9[_0x91be('0x38')]:_0x2ffe05[_0x91be('0x34')];if(!_0x235ae8[_0x91be('0x37')][_0x91be('0x3a')](_0x91be('0x3b'))){_0x57b6f9[_0x91be('0x21')]=qs['limit'](_0x235ae8[_0x91be('0x37')][_0x91be('0x21')]);_0x57b6f9[_0x91be('0x1f')]=qs[_0x91be('0x1f')](_0x235ae8['query'][_0x91be('0x1f')]);}_0x57b6f9['order']=qs[_0x91be('0x3c')](_0x235ae8[_0x91be('0x37')][_0x91be('0x3c')]);_0x57b6f9['where']=qs[_0x91be('0x3d')](_[_0x91be('0x3e')](_0x235ae8[_0x91be('0x37')],_0x2ffe05[_0x91be('0x3d')]),_0x76ce4d);if(_0x235ae8[_0x91be('0x37')][_0x91be('0x3f')]){_0x57b6f9['where']=_[_0x91be('0x40')](_0x57b6f9[_0x91be('0x41')],{'$or':_['map'](_0x76ce4d,function(_0x4af435){if(_0x4af435['type']!==_0x91be('0x42')){var _0x28f825={};_0x28f825[_0x4af435[_0x91be('0x2c')]]={'$like':'%'+_0x235ae8[_0x91be('0x37')][_0x91be('0x3f')]+'%'};return _0x28f825;}})});}_0x57b6f9=_['merge']({},_0x57b6f9,_0x235ae8[_0x91be('0x43')]);var _0x217899={'where':_0x57b6f9[_0x91be('0x41')]};return db[_0x91be('0x44')][_0x91be('0x22')](_0x217899)[_0x91be('0x27')](function(_0x4b8bca){_0x21ef6f[_0x91be('0x22')]=_0x4b8bca;if(_0x235ae8[_0x91be('0x37')][_0x91be('0x45')]){_0x57b6f9['include']=[{'all':!![]}];}return db[_0x91be('0x44')]['findAll'](_0x57b6f9);})[_0x91be('0x27')](function(_0x3d6033){_0x21ef6f['rows']=_0x3d6033;return _0x21ef6f;})[_0x91be('0x27')](respondWithFilteredResult(_0x3b1677,_0x57b6f9))[_0x91be('0x46')](handleError(_0x3b1677,null));};exports[_0x91be('0x47')]=function(_0x2b8f6f,_0x117245){var _0x2cb05b={'raw':!![],'where':{'id':_0x2b8f6f[_0x91be('0x48')]['id']}},_0xb59730={};_0xb59730[_0x91be('0x34')]=_['keys'](db[_0x91be('0x44')][_0x91be('0x30')]);_0xb59730['query']=_[_0x91be('0x35')](_0x2b8f6f[_0x91be('0x37')]);_0xb59730[_0x91be('0x3d')]=_[_0x91be('0x36')](_0xb59730[_0x91be('0x34')],_0xb59730[_0x91be('0x37')]);_0x2cb05b[_0x91be('0x38')]=_[_0x91be('0x36')](_0xb59730[_0x91be('0x34')],qs[_0x91be('0x39')](_0x2b8f6f[_0x91be('0x37')][_0x91be('0x39')]));_0x2cb05b['attributes']=_0x2cb05b[_0x91be('0x38')][_0x91be('0x49')]?_0x2cb05b[_0x91be('0x38')]:_0xb59730[_0x91be('0x34')];if(_0x2b8f6f['query']['includeAll']){_0x2cb05b[_0x91be('0x4a')]=[{'all':!![]}];}_0x2cb05b=_[_0x91be('0x40')]({},_0x2cb05b,_0x2b8f6f['options']);return db[_0x91be('0x44')]['find'](_0x2cb05b)[_0x91be('0x27')](handleEntityNotFound(_0x117245,null))[_0x91be('0x27')](respondWithResult(_0x117245,null))[_0x91be('0x46')](handleError(_0x117245,null));};exports['create']=function(_0x5b0294,_0x4449d8){return db['MailQueue'][_0x91be('0x4b')](_0x5b0294['body'],{})[_0x91be('0x27')](function(_0x1a3517){var _0x156db0=_0x5b0294['user']['get']({'plain':!![]});if(!_0x156db0)throw new Error(_0x91be('0x4c'));if(_0x156db0['role']===_0x91be('0x4d')){var _0x44ac7f=_0x1a3517[_0x91be('0x4e')]({'plain':!![]});var _0x976646=_0x91be('0x4f');return db['UserProfileSection'][_0x91be('0x50')]({'where':{'name':_0x976646,'userProfileId':_0x156db0['userProfileId']},'raw':!![]})[_0x91be('0x27')](function(_0x298f94){if(_0x298f94&&_0x298f94['autoAssociation']===0x0){return db[_0x91be('0x29')]['create']({'name':_0x44ac7f[_0x91be('0x2c')],'resourceId':_0x44ac7f['id'],'type':_0x298f94[_0x91be('0x2c')],'sectionId':_0x298f94['id']},{})['then'](function(){return _0x1a3517;});}else{return _0x1a3517;}})['catch'](function(_0x14317b){logger[_0x91be('0x2a')](_0x91be('0x51'),_0x14317b);throw _0x14317b;});}return _0x1a3517;})['then'](respondWithResult(_0x4449d8,0xc9))['catch'](handleError(_0x4449d8,null));};exports[_0x91be('0x26')]=function(_0x2b37c7,_0x357729){if(_0x2b37c7[_0x91be('0x52')]['id']){delete _0x2b37c7[_0x91be('0x52')]['id'];}return db['MailQueue'][_0x91be('0x50')]({'where':{'id':_0x2b37c7[_0x91be('0x48')]['id']}})[_0x91be('0x27')](handleEntityNotFound(_0x357729,null))[_0x91be('0x27')](saveUpdates(_0x2b37c7[_0x91be('0x52')],null))[_0x91be('0x27')](respondWithResult(_0x357729,null))['catch'](handleError(_0x357729,null));};exports[_0x91be('0x28')]=function(_0x53b92c,_0x22dc91){return db[_0x91be('0x44')][_0x91be('0x50')]({'where':{'id':_0x53b92c[_0x91be('0x48')]['id']}})['then'](handleEntityNotFound(_0x22dc91,null))[_0x91be('0x27')](removeEntity(_0x22dc91,null))[_0x91be('0x46')](handleError(_0x22dc91,null));};exports['describe']=function(_0x46861c,_0x5ae784){return db[_0x91be('0x44')][_0x91be('0x53')]()['then'](respondWithResult(_0x5ae784,null))[_0x91be('0x46')](handleError(_0x5ae784,null));};exports['getMembers']=function(_0xe3de72,_0x590598,_0x11ab34){var _0x1f0bec={'raw':!![],'where':{}},_0xff3328={},_0x14ced5;return db[_0x91be('0x44')][_0x91be('0x54')]({'where':{'id':_0xe3de72[_0x91be('0x48')]['id']}})['then'](handleEntityNotFound(_0x590598,null))['then'](function(_0x3af7db){if(_0x3af7db){_0x14ced5=_0x3af7db[_0x91be('0x4e')]({'plain':!![]});_0xff3328[_0x91be('0x34')]=_[_0x91be('0x35')](db[_0x91be('0x55')][_0x91be('0x30')]);_0xff3328[_0x91be('0x37')]=_[_0x91be('0x35')](_0xe3de72[_0x91be('0x37')]);_0xff3328['filters']=_[_0x91be('0x36')](_0xff3328[_0x91be('0x34')],_0xff3328['query']);_0x1f0bec[_0x91be('0x38')]=_['intersection'](_0xff3328[_0x91be('0x34')],qs['fields'](_0xe3de72[_0x91be('0x37')][_0x91be('0x39')]));_0x1f0bec[_0x91be('0x38')]=_0x1f0bec[_0x91be('0x38')][_0x91be('0x49')]?_0x1f0bec[_0x91be('0x38')]:_0xff3328[_0x91be('0x34')];if(!_0xe3de72['query']['hasOwnProperty'](_0x91be('0x3b'))){_0x1f0bec[_0x91be('0x21')]=qs[_0x91be('0x21')](_0xe3de72[_0x91be('0x37')]['limit']);_0x1f0bec['offset']=qs['offset'](_0xe3de72[_0x91be('0x37')][_0x91be('0x1f')]);}_0x1f0bec[_0x91be('0x56')]=qs[_0x91be('0x3c')](_0xe3de72[_0x91be('0x37')]['sort']);_0x1f0bec[_0x91be('0x41')]=qs[_0x91be('0x3d')](_[_0x91be('0x3e')](_0xe3de72[_0x91be('0x37')],_0xff3328[_0x91be('0x3d')]));_0x1f0bec[_0x91be('0x41')][_0x91be('0x57')]=_0x3af7db['id'];if(_0xe3de72['query'][_0x91be('0x3f')]){_0x1f0bec[_0x91be('0x41')]=_[_0x91be('0x40')](_0x1f0bec[_0x91be('0x41')],{'$or':_[_0x91be('0x2f')](_0x1f0bec[_0x91be('0x38')],function(_0x317d8f){var _0x16a9dd={};_0x16a9dd[_0x317d8f]={'$like':'%'+_0xe3de72[_0x91be('0x37')][_0x91be('0x3f')]+'%'};return _0x16a9dd;})});}_0x1f0bec=_[_0x91be('0x40')]({},_0x1f0bec,_0xe3de72['options']);return db['UserMailQueue'][_0x91be('0x58')](_0x1f0bec);}})['then'](function(_0x2f549d){if(_0x2f549d){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x2f549d,_0x91be('0x59')),'role':'agent'},'attributes':['id','name',_0x91be('0x5a'),_0x91be('0x5b'),'createdAt']});}})[_0x91be('0x27')](function(_0x5f5de7){if(_0x5f5de7){return{'count':_0x5f5de7[_0x91be('0x22')],'rows':_['map'](_0x5f5de7['rows'],function(_0x3dbdc7){return{'membername':_0x3dbdc7[_0x91be('0x2c')],'UserId':_0x3dbdc7['id'],'queue_name':_0x14ced5[_0x91be('0x2c')],'MailQueueId':_0x14ced5['id'],'interface':util['format'](_0x91be('0x5c'),_0x91be('0x5d'),_0x3dbdc7[_0x91be('0x2c')]),'penalty':0x0,'paused':_0x3dbdc7['mailPause'],'createdAt':_0x3dbdc7['createdAt'],'updatedAt':_0x3dbdc7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x590598,_0x1f0bec))['catch'](handleError(_0x590598,null));};exports['getTeams']=function(_0x5300de,_0x4f9feb,_0x1ddf26){var _0x568f22={};var _0x5865ea={};var _0x5c95d5;var _0xf485df;return db[_0x91be('0x44')][_0x91be('0x54')]({'where':{'id':_0x5300de['params']['id']}})[_0x91be('0x27')](handleEntityNotFound(_0x4f9feb,null))[_0x91be('0x27')](function(_0x74bf7c){if(_0x74bf7c){_0x5c95d5=_0x74bf7c;_0x5865ea[_0x91be('0x34')]=_[_0x91be('0x35')](db[_0x91be('0x5e')][_0x91be('0x30')]);_0x5865ea[_0x91be('0x37')]=_[_0x91be('0x35')](_0x5300de[_0x91be('0x37')]);_0x5865ea['filters']=_[_0x91be('0x36')](_0x5865ea[_0x91be('0x34')],_0x5865ea['query']);_0x568f22[_0x91be('0x38')]=_['intersection'](_0x5865ea['model'],qs[_0x91be('0x39')](_0x5300de[_0x91be('0x37')][_0x91be('0x39')]));_0x568f22[_0x91be('0x38')]=_0x568f22[_0x91be('0x38')]['length']?_0x568f22[_0x91be('0x38')]:_0x5865ea[_0x91be('0x34')];_0x568f22[_0x91be('0x56')]=qs[_0x91be('0x3c')](_0x5300de[_0x91be('0x37')]['sort']);_0x568f22[_0x91be('0x41')]=qs[_0x91be('0x3d')](_[_0x91be('0x3e')](_0x5300de['query'],_0x5865ea['filters']));if(_0x5300de[_0x91be('0x37')][_0x91be('0x3f')]){_0x568f22[_0x91be('0x41')]=_[_0x91be('0x40')](_0x568f22[_0x91be('0x41')],{'$or':_['map'](_0x568f22[_0x91be('0x38')],function(_0x3357ef){var _0x593fdc={};_0x593fdc[_0x3357ef]={'$like':'%'+_0x5300de[_0x91be('0x37')]['filter']+'%'};return _0x593fdc;})});}_0x568f22=_[_0x91be('0x40')]({},_0x568f22,_0x5300de[_0x91be('0x43')]);return _0x5c95d5['getTeams'](_0x568f22);}})[_0x91be('0x27')](function(_0x56f7b7){if(_0x56f7b7){_0xf485df=_0x56f7b7['length'];if(!_0x5300de['query'][_0x91be('0x3a')](_0x91be('0x3b'))){_0x568f22[_0x91be('0x21')]=qs[_0x91be('0x21')](_0x5300de[_0x91be('0x37')]['limit']);_0x568f22['offset']=qs[_0x91be('0x1f')](_0x5300de[_0x91be('0x37')][_0x91be('0x1f')]);}return _0x5c95d5[_0x91be('0x5f')](_0x568f22);}})[_0x91be('0x27')](function(_0x2422d0){if(_0x2422d0){return _0x2422d0?{'count':_0xf485df,'rows':_0x2422d0}:null;}})[_0x91be('0x27')](respondWithResult(_0x4f9feb,null))[_0x91be('0x46')](handleError(_0x4f9feb,null));};exports['addTeams']=function(_0x90ba66,_0x556e33,_0x4fe9f0){var _0x3518fd=_0x90ba66[_0x91be('0x52')][_0x91be('0x60')];return db[_0x91be('0x5e')][_0x91be('0x58')]({'where':{'id':_0x3518fd},'attributes':['id'],'include':[{'model':db[_0x91be('0x61')],'as':_0x91be('0x62'),'attributes':['id',_0x91be('0x2c'),'online','voicePause',_0x91be('0x63')],'raw':!![]}]})[_0x91be('0x27')](function(_0x464613){if(_0x464613){var _0x5afda5=_['flatMap'](_0x464613,function(_0x4434d9){var _0x3d90df=_0x4434d9[_0x91be('0x4e')]({'plain':!![]});return _0x3d90df[_0x91be('0x62')];});return db[_0x91be('0x44')]['find']({'where':{'id':_0x90ba66[_0x91be('0x48')]['id']}})[_0x91be('0x27')](function(_0x32b543){return db[_0x91be('0x64')]['transaction'](function(_0x45a464){return _0x32b543[_0x91be('0x65')](_0x3518fd,{'transaction':_0x45a464})['then'](function(){return BPromise[_0x91be('0x66')](_0x5afda5,function(_0x14b8b3){return db[_0x91be('0x55')][_0x91be('0x67')]({'where':{'UserId':_0x14b8b3['id'],'MailQueueId':_0x90ba66[_0x91be('0x48')]['id']},'transaction':_0x45a464});});})[_0x91be('0x27')](function(){_0x5afda5[_0x91be('0x68')](function(_0xf3743c){socket[_0x91be('0x69')](_0x91be('0x6a'),{'UserId':_0xf3743c['id'],'MailQueueId':_0x32b543['id']});});});});});}})[_0x91be('0x27')](respondWithStatusCode(_0x556e33,null))[_0x91be('0x46')](handleError(_0x556e33,null));};exports['removeTeams']=function(_0x75b30c,_0x4be595,_0x1fdde9){return db[_0x91be('0x5e')]['findAll']({'where':{'id':_0x75b30c[_0x91be('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4be595,null))[_0x91be('0x27')](function(_0x5b6c19){var _0x3b3e5b=_[_0x91be('0x2f')](_0x5b6c19,'id');var _0x50cc1e=[];var _0x17f601=[];var _0x2127cb=squel['select']();_0x2127cb[_0x91be('0x6b')](_0x91be('0x6c'))[_0x91be('0x6d')](_0x91be('0x6e'),'tq')[_0x91be('0x6f')](_0x91be('0x70'),'ut',_0x91be('0x71'))[_0x91be('0x41')](_0x91be('0x72'),_0x75b30c['params']['id']);for(var _0x254ca4=0x0;_0x254ca4<_0x5b6c19['length'];_0x254ca4+=0x1){let _0x41c9cf=_0x5b6c19[_0x254ca4];for(var _0x7e39c8=0x0;_0x7e39c8<_0x41c9cf[_0x91be('0x62')][_0x91be('0x49')];_0x7e39c8+=0x1){let _0x2d5f3a=_0x41c9cf[_0x91be('0x62')][_0x7e39c8];var _0x2239c1=_0x2127cb[_0x91be('0x73')]();_0x2239c1[_0x91be('0x41')](_0x91be('0x74'),_0x2d5f3a['id']);_0x17f601['push'](db[_0x91be('0x64')][_0x91be('0x37')](_0x2239c1[_0x91be('0x75')](),{'type':db[_0x91be('0x64')]['QueryTypes'][_0x91be('0x76')]})['then'](function(_0x19df8a){if(_0x19df8a['length']===0x1){return _0x2d5f3a['id'];}else{var _0x2f193a=_[_0x91be('0x77')](_[_0x91be('0x2f')](_0x19df8a,_0x91be('0x78')),function(_0x45eb6c){return _[_0x91be('0x79')](_0x3b3e5b,_0x45eb6c);});if(_0x2f193a){return _0x2d5f3a['id'];}}}));}}return BPromise[_0x91be('0x7a')](_0x17f601)['then'](function(_0x4a346f){_0x50cc1e=_(_0x50cc1e)[_0x91be('0x7b')](_0x4a346f)['compact']()[_0x91be('0x7c')]();return db[_0x91be('0x44')][_0x91be('0x50')]({'where':{'id':_0x75b30c[_0x91be('0x48')]['id']}})['then'](function(_0x319b01){return db['sequelize']['transaction'](function(_0x58ca8a){return _0x319b01['removeTeams'](_0x75b30c[_0x91be('0x37')][_0x91be('0x60')],{'transaction':_0x58ca8a})[_0x91be('0x27')](function(){if(!_[_0x91be('0x7d')](_0x50cc1e)){return _0x319b01[_0x91be('0x7e')](_0x50cc1e,{'transaction':_0x58ca8a});}})[_0x91be('0x27')](function(){_0x50cc1e[_0x91be('0x68')](function(_0xa3bbfa){socket['emit'](_0x91be('0x7f'),{'UserId':_0xa3bbfa,'MailQueueId':_0x319b01['id']});});});});});});})[_0x91be('0x27')](respondWithStatusCode(_0x4be595,null))['catch'](handleError(_0x4be595,null));};exports[_0x91be('0x80')]=function(_0x49d6b4,_0x97d8f6,_0x259970){return db['MailQueue']['find']({'where':{'id':_0x49d6b4[_0x91be('0x48')]['id']}})['then'](handleEntityNotFound(_0x97d8f6,null))['then'](function(_0x1def2b){if(_0x1def2b){return _0x1def2b[_0x91be('0x80')](_0x49d6b4['body'][_0x91be('0x60')],_[_0x91be('0x81')](_0x49d6b4[_0x91be('0x52')],['ids','id'])||{})[_0x91be('0x82')](function(_0x41e907){for(var _0x40834f=0x0;_0x40834f<_0x49d6b4[_0x91be('0x52')][_0x91be('0x60')][_0x91be('0x49')];_0x40834f+=0x1){socket['emit'](_0x91be('0x6a'),{'UserId':Number(_0x49d6b4[_0x91be('0x52')][_0x91be('0x60')][_0x40834f]),'MailQueueId':Number(_0x49d6b4[_0x91be('0x48')]['id'])});}return _0x41e907;});}})[_0x91be('0x27')](respondWithResult(_0x97d8f6,null))[_0x91be('0x46')](handleError(_0x97d8f6,null));};exports[_0x91be('0x7e')]=function(_0x4072be,_0xbac4fb,_0x260a2d){return db[_0x91be('0x44')][_0x91be('0x50')]({'where':{'id':_0x4072be[_0x91be('0x48')]['id']}})[_0x91be('0x27')](handleEntityNotFound(_0xbac4fb,null))[_0x91be('0x27')](function(_0x44dfc3){if(_0x44dfc3){return _0x44dfc3['removeAgents'](_0x4072be['query']['ids'])[_0x91be('0x27')](function(){if(_[_0x91be('0x83')](_0x4072be[_0x91be('0x37')][_0x91be('0x60')])){for(var _0x4a4f79=0x0;_0x4a4f79<_0x4072be[_0x91be('0x37')][_0x91be('0x60')][_0x91be('0x49')];_0x4a4f79+=0x1){socket['emit'](_0x91be('0x7f'),{'UserId':Number(_0x4072be['query']['ids'][_0x4a4f79]),'MailQueueId':Number(_0x4072be[_0x91be('0x48')]['id'])});}}else{socket[_0x91be('0x69')]('userMailQueue:remove',{'UserId':Number(_0x4072be['query']['ids']),'MailQueueId':Number(_0x4072be[_0x91be('0x48')]['id'])});}});}})[_0x91be('0x27')](respondWithStatusCode(_0xbac4fb,null))[_0x91be('0x46')](handleError(_0xbac4fb,null));};exports['getAgents']=function(_0x496834,_0x3daafd,_0x4f05ea){var _0x339123={};var _0x519172={};var _0x3f22b4;var _0x3215ff;return db[_0x91be('0x44')]['findOne']({'where':{'id':_0x496834['params']['id']}})[_0x91be('0x27')](handleEntityNotFound(_0x3daafd,null))[_0x91be('0x27')](function(_0x1162d2){if(_0x1162d2){_0x3f22b4=_0x1162d2;_0x519172[_0x91be('0x34')]=_['keys'](db[_0x91be('0x61')][_0x91be('0x30')]);_0x519172[_0x91be('0x37')]=_[_0x91be('0x35')](_0x496834['query']);_0x519172['filters']=_['intersection'](_0x519172[_0x91be('0x34')],_0x519172[_0x91be('0x37')]);_0x339123[_0x91be('0x38')]=_[_0x91be('0x36')](_0x519172[_0x91be('0x34')],qs['fields'](_0x496834[_0x91be('0x37')]['fields']));_0x339123[_0x91be('0x38')]=_0x339123[_0x91be('0x38')][_0x91be('0x49')]?_0x339123[_0x91be('0x38')]:_0x519172[_0x91be('0x34')];_0x339123['order']=qs[_0x91be('0x3c')](_0x496834[_0x91be('0x37')][_0x91be('0x3c')]);_0x339123[_0x91be('0x41')]=qs['filters'](_[_0x91be('0x3e')](_0x496834[_0x91be('0x37')],_0x519172[_0x91be('0x3d')]));if(_0x496834[_0x91be('0x37')]['filter']){_0x339123[_0x91be('0x41')]=_[_0x91be('0x40')](_0x339123[_0x91be('0x41')],{'$or':_[_0x91be('0x2f')](_0x339123[_0x91be('0x38')],function(_0x1ac563){var _0x2ff8a0={};_0x2ff8a0[_0x1ac563]={'$like':'%'+_0x496834[_0x91be('0x37')][_0x91be('0x3f')]+'%'};return _0x2ff8a0;})});}_0x339123=_[_0x91be('0x40')]({},_0x339123,_0x496834['options']);return _0x3f22b4[_0x91be('0x84')](_0x339123);}})[_0x91be('0x27')](function(_0x5cbc20){if(_0x5cbc20){_0x3215ff=_0x5cbc20['length'];if(!_0x496834[_0x91be('0x37')][_0x91be('0x3a')](_0x91be('0x3b'))){_0x339123[_0x91be('0x21')]=qs[_0x91be('0x21')](_0x496834[_0x91be('0x37')][_0x91be('0x21')]);_0x339123[_0x91be('0x1f')]=qs[_0x91be('0x1f')](_0x496834[_0x91be('0x37')]['offset']);}return _0x3f22b4['getAgents'](_0x339123);}})[_0x91be('0x27')](function(_0x4a9826){if(_0x4a9826){return _0x4a9826?{'count':_0x3215ff,'rows':_0x4a9826}:null;}})[_0x91be('0x27')](respondWithResult(_0x3daafd,null))[_0x91be('0x46')](handleError(_0x3daafd,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f705f4c..690b7d4 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 _0x0ad9=['../../mysqldb','save','update','emit','hasOwnProperty','exports','events'];(function(_0x7fdd52,_0x2f4498){var _0x369401=function(_0x42de5d){while(--_0x42de5d){_0x7fdd52['push'](_0x7fdd52['shift']());}};_0x369401(++_0x2f4498);}(_0x0ad9,0x172));var _0x90ad=function(_0x507ded,_0x470ab9){_0x507ded=_0x507ded-0x0;var _0x55d109=_0x0ad9[_0x507ded];return _0x55d109;};'use strict';var EventEmitter=require(_0x90ad('0x0'));var MailQueue=require(_0x90ad('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x90ad('0x2'),'afterUpdate':_0x90ad('0x3'),'afterDestroy':'remove'};function emitEvent(_0x952c71){return function(_0x2ae734,_0x42034f,_0x2629f1){MailQueueEvents[_0x90ad('0x4')](_0x952c71+':'+_0x2ae734['id'],_0x2ae734);MailQueueEvents[_0x90ad('0x4')](_0x952c71,_0x2ae734);_0x2629f1(null);};}for(var e in events){if(events[_0x90ad('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x90ad('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x8eca=['../../mysqldb','MailQueue','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x4a30fe,_0x123221){var _0x5f01b8=function(_0x39da95){while(--_0x39da95){_0x4a30fe['push'](_0x4a30fe['shift']());}};_0x5f01b8(++_0x123221);}(_0x8eca,0x1af));var _0xa8ec=function(_0x497c47,_0x29ff53){_0x497c47=_0x497c47-0x0;var _0x23baf0=_0x8eca[_0x497c47];return _0x23baf0;};'use strict';var EventEmitter=require(_0xa8ec('0x0'));var MailQueue=require(_0xa8ec('0x1'))['db'][_0xa8ec('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8ec('0x3'),'afterUpdate':_0xa8ec('0x4'),'afterDestroy':_0xa8ec('0x5')};function emitEvent(_0x147052){return function(_0x10e837,_0x361553,_0x573510){MailQueueEvents[_0xa8ec('0x6')](_0x147052+':'+_0x10e837['id'],_0x10e837);MailQueueEvents['emit'](_0x147052,_0x10e837);_0x573510(null);};}for(var e in events){if(events[_0xa8ec('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xa8ec('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index adce271..efc6a61 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 _0xbd60=['rimraf','../../config/environment','define','MailQueue','mail_queues','lodash','../../config/logger','api','moment','path'];(function(_0x58c9b1,_0x1b00b4){var _0x57da21=function(_0x58bbde){while(--_0x58bbde){_0x58c9b1['push'](_0x58c9b1['shift']());}};_0x57da21(++_0x1b00b4);}(_0xbd60,0xa5));var _0x0bd6=function(_0x102287,_0x1c82dc){_0x102287=_0x102287-0x0;var _0x43d29e=_0xbd60[_0x102287];return _0x43d29e;};'use strict';var _=require(_0x0bd6('0x0'));var util=require('util');var logger=require(_0x0bd6('0x1'))(_0x0bd6('0x2'));var moment=require(_0x0bd6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bd6('0x4'));var rimraf=require(_0x0bd6('0x5'));var config=require(_0x0bd6('0x6'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x3a23a7,_0x38e0a5){return _0x3a23a7[_0x0bd6('0x7')](_0x0bd6('0x8'),attributes,{'tableName':_0x0bd6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27e1=['rimraf','./mailQueue.attributes','exports','MailQueue','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3bbf5c,_0x2fa0ad){var _0x36469e=function(_0x3ae259){while(--_0x3ae259){_0x3bbf5c['push'](_0x3bbf5c['shift']());}};_0x36469e(++_0x2fa0ad);}(_0x27e1,0x158));var _0x127e=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x27e1[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x127e('0x0'))(_0x127e('0x1'));var moment=require(_0x127e('0x2'));var BPromise=require(_0x127e('0x3'));var rp=require(_0x127e('0x4'));var fs=require('fs');var path=require(_0x127e('0x5'));var rimraf=require(_0x127e('0x6'));var config=require('../../config/environment');var attributes=require(_0x127e('0x7'));module[_0x127e('0x8')]=function(_0xfc84c1,_0x31fc26){return _0xfc84c1['define'](_0x127e('0x9'),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 c51c350..976c080 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 _0xe62f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','map','model','catch','ShowMailQueue','stringify','lodash','util','moment'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0xe62f,0xc5));var _0xfe62=function(_0x444667,_0x14b3d9){_0x444667=_0x444667-0x0;var _0x1c9714=_0xe62f[_0x444667];return _0x1c9714;};'use strict';var _=require(_0xfe62('0x0'));var util=require(_0xfe62('0x1'));var moment=require(_0xfe62('0x2'));var BPromise=require(_0xfe62('0x3'));var rs=require(_0xfe62('0x4'));var fs=require('fs');var Redis=require(_0xfe62('0x5'));var db=require(_0xfe62('0x6'))['db'];var utils=require(_0xfe62('0x7'));var logger=require(_0xfe62('0x8'))(_0xfe62('0x9'));var config=require('../../config/environment');var jayson=require(_0xfe62('0xa'));var client=jayson['client'][_0xfe62('0xb')]({'port':0x232a});config[_0xfe62('0xc')]=_[_0xfe62('0xd')](config['redis'],{'host':_0xfe62('0xe'),'port':0x18eb});var socket=require(_0xfe62('0xf'))(new Redis(config['redis']));require(_0xfe62('0x10'))['register'](socket);function respondWithRpcPromise(_0x5b4d91,_0x2a5a90,_0x455a81){return new BPromise(function(_0x5bf8b1,_0x4313d6){return client[_0xfe62('0x11')](_0x5b4d91,_0x455a81)[_0xfe62('0x12')](function(_0x2cf1ca){logger[_0xfe62('0x13')](_0xfe62('0x14'),_0x2a5a90,_0xfe62('0x15'));logger[_0xfe62('0x16')](_0xfe62('0x17'),_0x2a5a90,_0xfe62('0x15'),JSON['stringify'](_0x2cf1ca));if(_0x2cf1ca[_0xfe62('0x18')]){if(_0x2cf1ca[_0xfe62('0x18')][_0xfe62('0x19')]===0x1f4){logger['error'](_0xfe62('0x14'),_0x2a5a90,_0x2cf1ca[_0xfe62('0x18')][_0xfe62('0x1a')]);return _0x4313d6(_0x2cf1ca[_0xfe62('0x18')][_0xfe62('0x1a')]);}logger[_0xfe62('0x18')]('MailQueue,\x20%s,\x20%s',_0x2a5a90,_0x2cf1ca[_0xfe62('0x18')]['message']);return _0x5bf8b1(_0x2cf1ca[_0xfe62('0x18')][_0xfe62('0x1a')]);}else{logger['info'](_0xfe62('0x14'),_0x2a5a90,_0xfe62('0x15'));_0x5bf8b1(_0x2cf1ca['result'][_0xfe62('0x1a')]);}})['catch'](function(_0x45e925){logger[_0xfe62('0x18')](_0xfe62('0x14'),_0x2a5a90,_0x45e925);_0x4313d6(_0x45e925);});});}exports[_0xfe62('0x1b')]=function(_0x833073){var _0x31b70c=this;return new Promise(function(_0x5eede0,_0x42eba1){return db[_0xfe62('0x1c')]['findAll']({'raw':_0x833073[_0xfe62('0x1d')]?_0x833073[_0xfe62('0x1d')][_0xfe62('0x1e')]===undefined?!![]:![]:!![],'where':_0x833073[_0xfe62('0x1d')]?_0x833073['options'][_0xfe62('0x1f')]||null:null,'attributes':_0x833073['options']?_0x833073[_0xfe62('0x1d')][_0xfe62('0x20')]||null:null,'limit':_0x833073[_0xfe62('0x1d')]?_0x833073[_0xfe62('0x1d')][_0xfe62('0x21')]||null:null,'include':_0x833073[_0xfe62('0x1d')]?_0x833073[_0xfe62('0x1d')][_0xfe62('0x22')]?_[_0xfe62('0x23')](_0x833073[_0xfe62('0x1d')][_0xfe62('0x22')],function(_0x30f64a){return{'model':db[_0x30f64a[_0xfe62('0x24')]],'as':_0x30f64a['as'],'attributes':_0x30f64a[_0xfe62('0x20')],'include':_0x30f64a['include']?_[_0xfe62('0x23')](_0x30f64a['include'],function(_0x570176){return{'model':db[_0x570176[_0xfe62('0x24')]],'as':_0x570176['as'],'attributes':_0x570176[_0xfe62('0x20')],'include':_0x570176['include']?_['map'](_0x570176[_0xfe62('0x22')],function(_0x3cea64){return{'model':db[_0x3cea64[_0xfe62('0x24')]],'as':_0x3cea64['as'],'attributes':_0x3cea64[_0xfe62('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfe62('0x12')](function(_0x575999){logger[_0xfe62('0x13')]('GetMailQueue',_0x833073);logger[_0xfe62('0x16')](_0xfe62('0x1b'),_0x833073,JSON['stringify'](_0x575999));_0x5eede0(_0x575999);})[_0xfe62('0x25')](function(_0x565077){logger[_0xfe62('0x18')]('GetMailQueue',_0x565077[_0xfe62('0x1a')],_0x833073);_0x42eba1(_0x31b70c['error'](0x1f4,_0x565077['message']));});});};exports[_0xfe62('0x26')]=function(_0x1c17e4){var _0x4f85f1=this;return new Promise(function(_0x202506,_0x4cdaab){return db[_0xfe62('0x1c')]['find']({'raw':_0x1c17e4[_0xfe62('0x1d')]?_0x1c17e4[_0xfe62('0x1d')][_0xfe62('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c17e4['options']?_0x1c17e4['options'][_0xfe62('0x1f')]||null:null,'attributes':_0x1c17e4['options']?_0x1c17e4['options'][_0xfe62('0x20')]||null:null,'include':_0x1c17e4[_0xfe62('0x1d')]?_0x1c17e4[_0xfe62('0x1d')][_0xfe62('0x22')]?_[_0xfe62('0x23')](_0x1c17e4[_0xfe62('0x1d')]['include'],function(_0x5bdb39){return{'model':db[_0x5bdb39[_0xfe62('0x24')]],'as':_0x5bdb39['as'],'attributes':_0x5bdb39[_0xfe62('0x20')],'include':_0x5bdb39['include']?_[_0xfe62('0x23')](_0x5bdb39[_0xfe62('0x22')],function(_0x233426){return{'model':db[_0x233426['model']],'as':_0x233426['as'],'attributes':_0x233426[_0xfe62('0x20')],'include':_0x233426['include']?_['map'](_0x233426['include'],function(_0xe62a9){return{'model':db[_0xe62a9[_0xfe62('0x24')]],'as':_0xe62a9['as'],'attributes':_0xe62a9[_0xfe62('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfe62('0x12')](function(_0x27dd5f){logger[_0xfe62('0x13')]('ShowMailQueue',_0x1c17e4);logger[_0xfe62('0x16')](_0xfe62('0x26'),_0x1c17e4,JSON[_0xfe62('0x27')](_0x27dd5f));_0x202506(_0x27dd5f);})[_0xfe62('0x25')](function(_0x1563fb){logger['error'](_0xfe62('0x26'),_0x1563fb[_0xfe62('0x1a')],_0x1c17e4);_0x4cdaab(_0x4f85f1['error'](0x1f4,_0x1563fb[_0xfe62('0x1a')]));});});}; \ No newline at end of file +var _0x41d2=['code','message','info','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailQueue.socket','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5082f6,_0x4fef6e){var _0x39dfa5=function(_0x50aac6){while(--_0x50aac6){_0x5082f6['push'](_0x5082f6['shift']());}};_0x39dfa5(++_0x4fef6e);}(_0x41d2,0x138));var _0x241d=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x41d2[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x241d('0x0'));var util=require(_0x241d('0x1'));var moment=require(_0x241d('0x2'));var BPromise=require(_0x241d('0x3'));var rs=require(_0x241d('0x4'));var fs=require('fs');var Redis=require(_0x241d('0x5'));var db=require(_0x241d('0x6'))['db'];var utils=require(_0x241d('0x7'));var logger=require(_0x241d('0x8'))(_0x241d('0x9'));var config=require('../../config/environment');var jayson=require(_0x241d('0xa'));var client=jayson[_0x241d('0xb')][_0x241d('0xc')]({'port':0x232a});config['redis']=_[_0x241d('0xd')](config[_0x241d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x241d('0xf'))(new Redis(config[_0x241d('0xe')]));require(_0x241d('0x10'))['register'](socket);function respondWithRpcPromise(_0x3d3da5,_0x37ba17,_0x2e943c){return new BPromise(function(_0xbae080,_0x60d8c9){return client[_0x241d('0x11')](_0x3d3da5,_0x2e943c)['then'](function(_0x16944f){logger['info'](_0x241d('0x12'),_0x37ba17,_0x241d('0x13'));logger[_0x241d('0x14')](_0x241d('0x15'),_0x37ba17,'request\x20sent',JSON[_0x241d('0x16')](_0x16944f));if(_0x16944f['error']){if(_0x16944f[_0x241d('0x17')][_0x241d('0x18')]===0x1f4){logger[_0x241d('0x17')](_0x241d('0x12'),_0x37ba17,_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);return _0x60d8c9(_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);}logger['error'](_0x241d('0x12'),_0x37ba17,_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);return _0xbae080(_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);}else{logger[_0x241d('0x1a')]('MailQueue,\x20%s,\x20%s',_0x37ba17,'request\x20sent');_0xbae080(_0x16944f[_0x241d('0x1b')][_0x241d('0x19')]);}})[_0x241d('0x1c')](function(_0xe34e86){logger[_0x241d('0x17')]('MailQueue,\x20%s,\x20%s',_0x37ba17,_0xe34e86);_0x60d8c9(_0xe34e86);});});}exports[_0x241d('0x1d')]=function(_0x421ce0){var _0x20f8d2=this;return new Promise(function(_0x3a7f50,_0x1e2274){return db['MailQueue'][_0x241d('0x1e')]({'raw':_0x421ce0['options']?_0x421ce0[_0x241d('0x1f')][_0x241d('0x20')]===undefined?!![]:![]:!![],'where':_0x421ce0[_0x241d('0x1f')]?_0x421ce0[_0x241d('0x1f')][_0x241d('0x21')]||null:null,'attributes':_0x421ce0[_0x241d('0x1f')]?_0x421ce0[_0x241d('0x1f')][_0x241d('0x22')]||null:null,'limit':_0x421ce0[_0x241d('0x1f')]?_0x421ce0['options'][_0x241d('0x23')]||null:null,'include':_0x421ce0['options']?_0x421ce0[_0x241d('0x1f')]['include']?_[_0x241d('0x24')](_0x421ce0[_0x241d('0x1f')][_0x241d('0x25')],function(_0x314bd8){return{'model':db[_0x314bd8[_0x241d('0x26')]],'as':_0x314bd8['as'],'attributes':_0x314bd8[_0x241d('0x22')],'include':_0x314bd8[_0x241d('0x25')]?_[_0x241d('0x24')](_0x314bd8['include'],function(_0x3ec710){return{'model':db[_0x3ec710[_0x241d('0x26')]],'as':_0x3ec710['as'],'attributes':_0x3ec710['attributes'],'include':_0x3ec710['include']?_[_0x241d('0x24')](_0x3ec710[_0x241d('0x25')],function(_0x5d93df){return{'model':db[_0x5d93df[_0x241d('0x26')]],'as':_0x5d93df['as'],'attributes':_0x5d93df[_0x241d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x241d('0x27')](function(_0xe721a6){logger[_0x241d('0x1a')]('GetMailQueue',_0x421ce0);logger['debug'](_0x241d('0x1d'),_0x421ce0,JSON[_0x241d('0x16')](_0xe721a6));_0x3a7f50(_0xe721a6);})[_0x241d('0x1c')](function(_0x13180e){logger[_0x241d('0x17')](_0x241d('0x1d'),_0x13180e[_0x241d('0x19')],_0x421ce0);_0x1e2274(_0x20f8d2['error'](0x1f4,_0x13180e[_0x241d('0x19')]));});});};exports[_0x241d('0x28')]=function(_0x3957d4){var _0x1f6126=this;return new Promise(function(_0x5b1312,_0x201002){return db['MailQueue'][_0x241d('0x29')]({'raw':_0x3957d4[_0x241d('0x1f')]?_0x3957d4[_0x241d('0x1f')][_0x241d('0x20')]===undefined?!![]:![]:!![],'where':_0x3957d4[_0x241d('0x1f')]?_0x3957d4[_0x241d('0x1f')][_0x241d('0x21')]||null:null,'attributes':_0x3957d4['options']?_0x3957d4['options'][_0x241d('0x22')]||null:null,'include':_0x3957d4['options']?_0x3957d4[_0x241d('0x1f')]['include']?_[_0x241d('0x24')](_0x3957d4[_0x241d('0x1f')][_0x241d('0x25')],function(_0x57ba0c){return{'model':db[_0x57ba0c['model']],'as':_0x57ba0c['as'],'attributes':_0x57ba0c[_0x241d('0x22')],'include':_0x57ba0c['include']?_['map'](_0x57ba0c['include'],function(_0x5cafd1){return{'model':db[_0x5cafd1[_0x241d('0x26')]],'as':_0x5cafd1['as'],'attributes':_0x5cafd1[_0x241d('0x22')],'include':_0x5cafd1[_0x241d('0x25')]?_[_0x241d('0x24')](_0x5cafd1[_0x241d('0x25')],function(_0x420bcf){return{'model':db[_0x420bcf['model']],'as':_0x420bcf['as'],'attributes':_0x420bcf['attributes']};}):[]};}):[]};}):[]:[]})[_0x241d('0x27')](function(_0x3846fa){logger[_0x241d('0x1a')]('ShowMailQueue',_0x3957d4);logger[_0x241d('0x14')](_0x241d('0x28'),_0x3957d4,JSON[_0x241d('0x16')](_0x3846fa));_0x5b1312(_0x3846fa);})[_0x241d('0x1c')](function(_0x2f6c59){logger[_0x241d('0x17')](_0x241d('0x28'),_0x2f6c59[_0x241d('0x19')],_0x3957d4);_0x201002(_0x1f6126[_0x241d('0x17')](0x1f4,_0x2f6c59['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 57b3c66..0dae9bb 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 _0x57fa=['mailQueue:','./mailQueue.events','save','update','emit','removeListener','register'];(function(_0x3ed1c1,_0x45fe0a){var _0x11797d=function(_0x26bad3){while(--_0x26bad3){_0x3ed1c1['push'](_0x3ed1c1['shift']());}};_0x11797d(++_0x45fe0a);}(_0x57fa,0x127));var _0xa57f=function(_0x335567,_0x455619){_0x335567=_0x335567-0x0;var _0x247037=_0x57fa[_0x335567];return _0x247037;};'use strict';var MailQueueEvents=require(_0xa57f('0x0'));var events=[_0xa57f('0x1'),'remove',_0xa57f('0x2')];function createListener(_0x511b96,_0x63a9f8){return function(_0x1f162e){_0x63a9f8[_0xa57f('0x3')](_0x511b96,_0x1f162e);};}function removeListener(_0x7163e2,_0x21e413){return function(){MailQueueEvents[_0xa57f('0x4')](_0x7163e2,_0x21e413);};}exports[_0xa57f('0x5')]=function(_0x5316bc){for(var _0x4ded33=0x0,_0x3d84e9=events['length'];_0x4ded33<_0x3d84e9;_0x4ded33++){var _0x438665=events[_0x4ded33];var _0x871646=createListener(_0xa57f('0x6')+_0x438665,_0x5316bc);MailQueueEvents['on'](_0x438665,_0x871646);}}; \ No newline at end of file +var _0x22c9=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x451563,_0x1d02c6){var _0x1bff88=function(_0x4bcb4b){while(--_0x4bcb4b){_0x451563['push'](_0x451563['shift']());}};_0x1bff88(++_0x1d02c6);}(_0x22c9,0x8b));var _0x922c=function(_0x3eee78,_0x5acc63){_0x3eee78=_0x3eee78-0x0;var _0x53a5e5=_0x22c9[_0x3eee78];return _0x53a5e5;};'use strict';var MailQueueEvents=require(_0x922c('0x0'));var events=[_0x922c('0x1'),_0x922c('0x2'),_0x922c('0x3')];function createListener(_0x4dd306,_0x57e307){return function(_0x3e8e9e){_0x57e307[_0x922c('0x4')](_0x4dd306,_0x3e8e9e);};}function removeListener(_0x457a22,_0xd8e5d){return function(){MailQueueEvents[_0x922c('0x5')](_0x457a22,_0xd8e5d);};}exports[_0x922c('0x6')]=function(_0x38356a){for(var _0x285dc2=0x0,_0x35451c=events[_0x922c('0x7')];_0x285dc2<_0x35451c;_0x285dc2++){var _0x395fc1=events[_0x285dc2];var _0xe8b783=createListener(_0x922c('0x8')+_0x395fc1,_0x38356a);MailQueueEvents['on'](_0x395fc1,_0xe8b783);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ccdbf01..0ee4cf0 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 _0x2ade=['post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x2ade,0x69));var _0xe2ad=function(_0x23faef,_0x3800f7){_0x23faef=_0x23faef-0x0;var _0x32ebff=_0x2ade[_0x23faef];return _0x32ebff;};'use strict';var multer=require(_0xe2ad('0x0'));var util=require(_0xe2ad('0x1'));var path=require(_0xe2ad('0x2'));var timeout=require(_0xe2ad('0x3'));var express=require(_0xe2ad('0x4'));var router=express[_0xe2ad('0x5')]();var fs_extra=require(_0xe2ad('0x6'));var auth=require(_0xe2ad('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe2ad('0x8'));var controller=require('./mailQueueReport.controller');router[_0xe2ad('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2ad('0xa')]);router['get'](_0xe2ad('0xb'),auth[_0xe2ad('0xc')](),controller[_0xe2ad('0xd')]);router[_0xe2ad('0x9')](_0xe2ad('0xe'),auth[_0xe2ad('0xc')](),controller['show']);router[_0xe2ad('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe2ad('0x10')](_0xe2ad('0xe'),auth['isAuthenticated'](),controller[_0xe2ad('0x11')]);router[_0xe2ad('0x12')](_0xe2ad('0xe'),auth['isAuthenticated'](),controller[_0xe2ad('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb5fb=['index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0xb5fb,0x1ef));var _0xbb5f=function(_0x9c6c1c,_0x21ead9){_0x9c6c1c=_0x9c6c1c-0x0;var _0x594c42=_0xb5fb[_0x9c6c1c];return _0x594c42;};'use strict';var multer=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var path=require('path');var timeout=require(_0xbb5f('0x2'));var express=require(_0xbb5f('0x3'));var router=express[_0xbb5f('0x4')]();var fs_extra=require(_0xbb5f('0x5'));var auth=require(_0xbb5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb5f('0x7'));var controller=require(_0xbb5f('0x8'));router[_0xbb5f('0x9')]('/',auth[_0xbb5f('0xa')](),controller[_0xbb5f('0xb')]);router[_0xbb5f('0x9')](_0xbb5f('0xc'),auth[_0xbb5f('0xa')](),controller[_0xbb5f('0xd')]);router['get'](_0xbb5f('0xe'),auth[_0xbb5f('0xa')](),controller[_0xbb5f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb5f('0x10')]);router[_0xbb5f('0x11')](_0xbb5f('0xe'),auth[_0xbb5f('0xa')](),controller[_0xbb5f('0x12')]);router[_0xbb5f('0x13')]('/:id',auth[_0xbb5f('0xa')](),controller[_0xbb5f('0x14')]);module[_0xbb5f('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 7a03c28..ad9459c 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 _0x0609=['STRING','DATE','sequelize'];(function(_0x33a8e5,_0x928308){var _0x1b76c8=function(_0x132e58){while(--_0x132e58){_0x33a8e5['push'](_0x33a8e5['shift']());}};_0x1b76c8(++_0x928308);}(_0x0609,0x1f1));var _0x9060=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0609[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x9060('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9060('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x9060('0x1')]},'joinAt':{'type':Sequelize[_0x9060('0x2')]},'leaveAt':{'type':Sequelize[_0x9060('0x2')]},'acceptAt':{'type':Sequelize[_0x9060('0x2')]},'exitAt':{'type':Sequelize[_0x9060('0x2')]},'reason':{'type':Sequelize[_0x9060('0x1')]}}; \ No newline at end of file +var _0x5dbc=['moment','sequelize','exports','DATE','STRING'];(function(_0x419cea,_0x48a736){var _0x13a1c9=function(_0x55edfc){while(--_0x55edfc){_0x419cea['push'](_0x419cea['shift']());}};_0x13a1c9(++_0x48a736);}(_0x5dbc,0x181));var _0xc5db=function(_0x17488c,_0x18fe75){_0x17488c=_0x17488c-0x0;var _0x544ea7=_0x5dbc[_0x17488c];return _0x544ea7;};'use strict';var moment=require(_0xc5db('0x0'));var Sequelize=require(_0xc5db('0x1'));module[_0xc5db('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc5db('0x3')]},'leaveAt':{'type':Sequelize[_0xc5db('0x3')]},'acceptAt':{'type':Sequelize[_0xc5db('0x3')]},'exitAt':{'type':Sequelize[_0xc5db('0x3')]},'reason':{'type':Sequelize[_0xc5db('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index d935d1a..0bd9273 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 _0xa456=['where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0xa456,0x142));var _0x6a45=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xa456[_0x173441];return _0x2423a8;};'use strict';var emlformat=require(_0x6a45('0x0'));var rimraf=require(_0x6a45('0x1'));var zipdir=require(_0x6a45('0x2'));var jsonpatch=require(_0x6a45('0x3'));var rp=require('request-promise');var moment=require(_0x6a45('0x4'));var BPromise=require(_0x6a45('0x5'));var Mustache=require(_0x6a45('0x6'));var util=require('util');var path=require(_0x6a45('0x7'));var sox=require(_0x6a45('0x8'));var csv=require(_0x6a45('0x9'));var ejs=require(_0x6a45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a45('0xb'));var squel=require(_0x6a45('0xc'));var crypto=require(_0x6a45('0xd'));var jsforce=require(_0x6a45('0xe'));var deskjs=require(_0x6a45('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a45('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a45('0x11'));var authService=require(_0x6a45('0x12'));var qs=require(_0x6a45('0x13'));var as=require(_0x6a45('0x14'));var hardwareService=require(_0x6a45('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a45('0x16'));var config=require(_0x6a45('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511b92,_0x1aa4b4){_0x1aa4b4=_0x1aa4b4||0xcc;return function(_0x25a8b9){if(_0x25a8b9){return _0x511b92[_0x6a45('0x18')](_0x1aa4b4);}return _0x511b92[_0x6a45('0x19')](_0x1aa4b4)[_0x6a45('0x1a')]();};}function respondWithResult(_0x5a9f29,_0x563c3b){_0x563c3b=_0x563c3b||0xc8;return function(_0x3a5d94){if(_0x3a5d94){return _0x5a9f29[_0x6a45('0x19')](_0x563c3b)['json'](_0x3a5d94);}};}function respondWithFilteredResult(_0x2c20db,_0x171176){return function(_0x3fab82){if(_0x3fab82){var _0x13adc0=typeof _0x171176['offset']==='undefined'&&typeof _0x171176['limit']===_0x6a45('0x1b');var _0x391f81=_0x3fab82[_0x6a45('0x1c')];var _0x52a055=_0x13adc0?0x0:_0x171176[_0x6a45('0x1d')];var _0x102981=_0x13adc0?_0x3fab82[_0x6a45('0x1c')]:_0x171176['offset']+_0x171176['limit'];var _0x573453;if(_0x102981>=_0x391f81){_0x102981=_0x391f81;_0x573453=0xc8;}else{_0x573453=0xce;}_0x2c20db[_0x6a45('0x19')](_0x573453);return _0x2c20db[_0x6a45('0x1e')]('Content-Range',_0x52a055+'-'+_0x102981+'/'+_0x391f81)[_0x6a45('0x1f')](_0x3fab82);}return null;};}function patchUpdates(_0x1be485){return function(_0x4f7000){try{jsonpatch[_0x6a45('0x20')](_0x4f7000,_0x1be485,!![]);}catch(_0xdf10c6){return BPromise[_0x6a45('0x21')](_0xdf10c6);}return _0x4f7000[_0x6a45('0x22')]();};}function saveUpdates(_0x15ad0e,_0x487666){return function(_0x5d990e){if(_0x5d990e){return _0x5d990e[_0x6a45('0x23')](_0x15ad0e)[_0x6a45('0x24')](function(_0x11290c){return _0x11290c;});}return null;};}function removeEntity(_0x22373c,_0x25a380){return function(_0x3ad898){if(_0x3ad898){return _0x3ad898[_0x6a45('0x25')]()[_0x6a45('0x24')](function(){_0x22373c[_0x6a45('0x19')](0xcc)[_0x6a45('0x1a')]();});}};}function handleEntityNotFound(_0x1310d7,_0x46587a){return function(_0x5cd761){if(!_0x5cd761){_0x1310d7[_0x6a45('0x18')](0x194);}return _0x5cd761;};}function handleError(_0x5a0389,_0x1b83fa){_0x1b83fa=_0x1b83fa||0x1f4;return function(_0x25467d){logger[_0x6a45('0x26')](_0x25467d[_0x6a45('0x27')]);if(_0x25467d[_0x6a45('0x28')]){delete _0x25467d['name'];}_0x5a0389[_0x6a45('0x19')](_0x1b83fa)[_0x6a45('0x29')](_0x25467d);};}exports[_0x6a45('0x2a')]=function(_0x1ccff0,_0x8265d9){var _0x227b6f={},_0x3fac9b={},_0x313c13={'count':0x0,'rows':[]};var _0x54286d=_[_0x6a45('0x2b')](db[_0x6a45('0x2c')][_0x6a45('0x2d')],function(_0x201369){return{'name':_0x201369[_0x6a45('0x2e')],'type':_0x201369['type'][_0x6a45('0x2f')]};});_0x3fac9b[_0x6a45('0x30')]=_[_0x6a45('0x2b')](_0x54286d,_0x6a45('0x28'));_0x3fac9b['query']=_['keys'](_0x1ccff0[_0x6a45('0x31')]);_0x3fac9b['filters']=_[_0x6a45('0x32')](_0x3fac9b['model'],_0x3fac9b[_0x6a45('0x31')]);_0x227b6f[_0x6a45('0x33')]=_[_0x6a45('0x32')](_0x3fac9b[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x34')]));_0x227b6f[_0x6a45('0x33')]=_0x227b6f[_0x6a45('0x33')][_0x6a45('0x35')]?_0x227b6f[_0x6a45('0x33')]:_0x3fac9b[_0x6a45('0x30')];if(!_0x1ccff0[_0x6a45('0x31')]['hasOwnProperty'](_0x6a45('0x36'))){_0x227b6f['limit']=qs[_0x6a45('0x37')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x37')]);_0x227b6f[_0x6a45('0x1d')]=qs[_0x6a45('0x1d')](_0x1ccff0[_0x6a45('0x31')]['offset']);}_0x227b6f[_0x6a45('0x38')]=qs[_0x6a45('0x39')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x39')]);_0x227b6f[_0x6a45('0x3a')]=qs[_0x6a45('0x3b')](_['pick'](_0x1ccff0[_0x6a45('0x31')],_0x3fac9b[_0x6a45('0x3b')]),_0x54286d);if(_0x1ccff0['query'][_0x6a45('0x3c')]){_0x227b6f[_0x6a45('0x3a')]=_[_0x6a45('0x3d')](_0x227b6f[_0x6a45('0x3a')],{'$or':_[_0x6a45('0x2b')](_0x54286d,function(_0x50ebe0){if(_0x50ebe0[_0x6a45('0x3e')]!==_0x6a45('0x3f')){var _0x205afd={};_0x205afd[_0x50ebe0[_0x6a45('0x28')]]={'$like':'%'+_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x3c')]+'%'};return _0x205afd;}})});}_0x227b6f=_[_0x6a45('0x3d')]({},_0x227b6f,_0x1ccff0['options']);var _0x1c941a={'where':_0x227b6f['where']};return db[_0x6a45('0x2c')][_0x6a45('0x1c')](_0x1c941a)[_0x6a45('0x24')](function(_0x2715dc){_0x313c13['count']=_0x2715dc;if(_0x1ccff0['query'][_0x6a45('0x40')]){_0x227b6f[_0x6a45('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6a45('0x42')](_0x227b6f);})[_0x6a45('0x24')](function(_0x3bd926){_0x313c13[_0x6a45('0x43')]=_0x3bd926;return _0x313c13;})['then'](respondWithFilteredResult(_0x8265d9,_0x227b6f))['catch'](handleError(_0x8265d9,null));};exports['show']=function(_0x5b9798,_0xe90201){var _0xb5d191={'raw':!![],'where':{'id':_0x5b9798[_0x6a45('0x44')]['id']}},_0x328d9f={};_0x328d9f[_0x6a45('0x30')]=_[_0x6a45('0x45')](db[_0x6a45('0x2c')][_0x6a45('0x2d')]);_0x328d9f['query']=_[_0x6a45('0x45')](_0x5b9798['query']);_0x328d9f['filters']=_[_0x6a45('0x32')](_0x328d9f[_0x6a45('0x30')],_0x328d9f['query']);_0xb5d191[_0x6a45('0x33')]=_['intersection'](_0x328d9f[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x5b9798[_0x6a45('0x31')][_0x6a45('0x34')]));_0xb5d191['attributes']=_0xb5d191[_0x6a45('0x33')][_0x6a45('0x35')]?_0xb5d191[_0x6a45('0x33')]:_0x328d9f[_0x6a45('0x30')];if(_0x5b9798[_0x6a45('0x31')]['includeAll']){_0xb5d191[_0x6a45('0x41')]=[{'all':!![]}];}_0xb5d191=_['merge']({},_0xb5d191,_0x5b9798[_0x6a45('0x46')]);return db[_0x6a45('0x2c')]['find'](_0xb5d191)[_0x6a45('0x24')](handleEntityNotFound(_0xe90201,null))[_0x6a45('0x24')](respondWithResult(_0xe90201,null))[_0x6a45('0x47')](handleError(_0xe90201,null));};exports[_0x6a45('0x48')]=function(_0x524296,_0x34bbb7){return db['MailQueueReport'][_0x6a45('0x48')](_0x524296['body'],{})[_0x6a45('0x24')](respondWithResult(_0x34bbb7,0xc9))[_0x6a45('0x47')](handleError(_0x34bbb7,null));};exports[_0x6a45('0x23')]=function(_0x2bf8d3,_0x5d9f52){if(_0x2bf8d3[_0x6a45('0x49')]['id']){delete _0x2bf8d3[_0x6a45('0x49')]['id'];}return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x2bf8d3[_0x6a45('0x44')]['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x5d9f52,null))[_0x6a45('0x24')](saveUpdates(_0x2bf8d3[_0x6a45('0x49')],null))[_0x6a45('0x24')](respondWithResult(_0x5d9f52,null))[_0x6a45('0x47')](handleError(_0x5d9f52,null));};exports['destroy']=function(_0x3ea4a7,_0x8877c7){return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x3ea4a7['params']['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x8877c7,null))[_0x6a45('0x24')](removeEntity(_0x8877c7,null))[_0x6a45('0x47')](handleError(_0x8877c7,null));};exports['describe']=function(_0x4e7967,_0x5a17b8){return db[_0x6a45('0x2c')][_0x6a45('0x4b')]()[_0x6a45('0x24')](respondWithResult(_0x5a17b8,null))[_0x6a45('0x47')](handleError(_0x5a17b8,null));}; \ No newline at end of file +var _0x4bd3=['reject','save','destroy','then','error','name','send','index','map','MailQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','filters','where','VIRTUAL','filter','options','includeAll','show','params','include','catch','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x1ecff3,_0x292dff){var _0x5ce1bd=function(_0x1774c1){while(--_0x1774c1){_0x1ecff3['push'](_0x1ecff3['shift']());}};_0x5ce1bd(++_0x292dff);}(_0x4bd3,0x174));var _0x34bd=function(_0x5aa8ac,_0x37f6e8){_0x5aa8ac=_0x5aa8ac-0x0;var _0x4b382d=_0x4bd3[_0x5aa8ac];return _0x4b382d;};'use strict';var emlformat=require(_0x34bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34bd('0x1'));var jsonpatch=require(_0x34bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34bd('0x3'));var util=require(_0x34bd('0x4'));var path=require(_0x34bd('0x5'));var sox=require('sox');var csv=require(_0x34bd('0x6'));var ejs=require(_0x34bd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bd('0x8'));var squel=require(_0x34bd('0x9'));var crypto=require('crypto');var jsforce=require(_0x34bd('0xa'));var deskjs=require(_0x34bd('0xb'));var toCsv=require(_0x34bd('0x6'));var querystring=require(_0x34bd('0xc'));var Papa=require(_0x34bd('0xd'));var Redis=require(_0x34bd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x34bd('0xf'));var as=require(_0x34bd('0x10'));var hardwareService=require(_0x34bd('0x11'));var logger=require(_0x34bd('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x34bd('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275d80,_0x1f19b9){_0x1f19b9=_0x1f19b9||0xcc;return function(_0x282af4){if(_0x282af4){return _0x275d80[_0x34bd('0x14')](_0x1f19b9);}return _0x275d80[_0x34bd('0x15')](_0x1f19b9)[_0x34bd('0x16')]();};}function respondWithResult(_0x4134ee,_0x236f6b){_0x236f6b=_0x236f6b||0xc8;return function(_0xf6d2f2){if(_0xf6d2f2){return _0x4134ee['status'](_0x236f6b)[_0x34bd('0x17')](_0xf6d2f2);}};}function respondWithFilteredResult(_0x4d4955,_0x4e3886){return function(_0x6638ed){if(_0x6638ed){var _0x30b3f2=typeof _0x4e3886[_0x34bd('0x18')]===_0x34bd('0x19')&&typeof _0x4e3886[_0x34bd('0x1a')]===_0x34bd('0x19');var _0xd39d72=_0x6638ed[_0x34bd('0x1b')];var _0x3b4bf8=_0x30b3f2?0x0:_0x4e3886[_0x34bd('0x18')];var _0x4b5ebb=_0x30b3f2?_0x6638ed['count']:_0x4e3886[_0x34bd('0x18')]+_0x4e3886[_0x34bd('0x1a')];var _0x265e70;if(_0x4b5ebb>=_0xd39d72){_0x4b5ebb=_0xd39d72;_0x265e70=0xc8;}else{_0x265e70=0xce;}_0x4d4955[_0x34bd('0x15')](_0x265e70);return _0x4d4955[_0x34bd('0x1c')](_0x34bd('0x1d'),_0x3b4bf8+'-'+_0x4b5ebb+'/'+_0xd39d72)[_0x34bd('0x17')](_0x6638ed);}return null;};}function patchUpdates(_0x3d5f76){return function(_0x130bd0){try{jsonpatch['apply'](_0x130bd0,_0x3d5f76,!![]);}catch(_0x15c0d1){return BPromise[_0x34bd('0x1e')](_0x15c0d1);}return _0x130bd0[_0x34bd('0x1f')]();};}function saveUpdates(_0x14254b,_0x463224){return function(_0x5e0c06){if(_0x5e0c06){return _0x5e0c06['update'](_0x14254b)['then'](function(_0x4edf84){return _0x4edf84;});}return null;};}function removeEntity(_0x3dafe8,_0x503a60){return function(_0x10fc4b){if(_0x10fc4b){return _0x10fc4b[_0x34bd('0x20')]()[_0x34bd('0x21')](function(){_0x3dafe8['status'](0xcc)[_0x34bd('0x16')]();});}};}function handleEntityNotFound(_0x14479a,_0x4f0dff){return function(_0x457006){if(!_0x457006){_0x14479a['sendStatus'](0x194);}return _0x457006;};}function handleError(_0x29bda8,_0xb256e8){_0xb256e8=_0xb256e8||0x1f4;return function(_0x264c94){logger[_0x34bd('0x22')](_0x264c94['stack']);if(_0x264c94[_0x34bd('0x23')]){delete _0x264c94[_0x34bd('0x23')];}_0x29bda8['status'](_0xb256e8)[_0x34bd('0x24')](_0x264c94);};}exports[_0x34bd('0x25')]=function(_0x16581f,_0x3f675c){var _0x26b8e7={},_0x4500c8={},_0x177d43={'count':0x0,'rows':[]};var _0x58b431=_[_0x34bd('0x26')](db[_0x34bd('0x27')]['rawAttributes'],function(_0x5d1662){return{'name':_0x5d1662[_0x34bd('0x28')],'type':_0x5d1662[_0x34bd('0x29')][_0x34bd('0x2a')]};});_0x4500c8['model']=_['map'](_0x58b431,_0x34bd('0x23'));_0x4500c8[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x16581f[_0x34bd('0x2b')]);_0x4500c8['filters']=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],_0x4500c8[_0x34bd('0x2b')]);_0x26b8e7[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],qs['fields'](_0x16581f[_0x34bd('0x2b')]['fields']));_0x26b8e7[_0x34bd('0x2f')]=_0x26b8e7[_0x34bd('0x2f')][_0x34bd('0x30')]?_0x26b8e7['attributes']:_0x4500c8[_0x34bd('0x2e')];if(!_0x16581f[_0x34bd('0x2b')]['hasOwnProperty'](_0x34bd('0x31'))){_0x26b8e7[_0x34bd('0x1a')]=qs[_0x34bd('0x1a')](_0x16581f['query'][_0x34bd('0x1a')]);_0x26b8e7[_0x34bd('0x18')]=qs['offset'](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x18')]);}_0x26b8e7[_0x34bd('0x32')]=qs[_0x34bd('0x33')](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x33')]);_0x26b8e7['where']=qs['filters'](_['pick'](_0x16581f[_0x34bd('0x2b')],_0x4500c8[_0x34bd('0x34')]),_0x58b431);if(_0x16581f['query']['filter']){_0x26b8e7[_0x34bd('0x35')]=_['merge'](_0x26b8e7['where'],{'$or':_[_0x34bd('0x26')](_0x58b431,function(_0xb5a456){if(_0xb5a456[_0x34bd('0x29')]!==_0x34bd('0x36')){var _0x2af1af={};_0x2af1af[_0xb5a456['name']]={'$like':'%'+_0x16581f['query'][_0x34bd('0x37')]+'%'};return _0x2af1af;}})});}_0x26b8e7=_['merge']({},_0x26b8e7,_0x16581f[_0x34bd('0x38')]);var _0x2c9b7a={'where':_0x26b8e7[_0x34bd('0x35')]};return db[_0x34bd('0x27')][_0x34bd('0x1b')](_0x2c9b7a)['then'](function(_0x282297){_0x177d43[_0x34bd('0x1b')]=_0x282297;if(_0x16581f[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x26b8e7['include']=[{'all':!![]}];}return db[_0x34bd('0x27')]['findAll'](_0x26b8e7);})[_0x34bd('0x21')](function(_0x560282){_0x177d43['rows']=_0x560282;return _0x177d43;})[_0x34bd('0x21')](respondWithFilteredResult(_0x3f675c,_0x26b8e7))['catch'](handleError(_0x3f675c,null));};exports[_0x34bd('0x3a')]=function(_0x3d3b96,_0x18e9f6){var _0x42a424={'raw':!![],'where':{'id':_0x3d3b96[_0x34bd('0x3b')]['id']}},_0x26d73e={};_0x26d73e[_0x34bd('0x2e')]=_['keys'](db['MailQueueReport']['rawAttributes']);_0x26d73e[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x3d3b96[_0x34bd('0x2b')]);_0x26d73e[_0x34bd('0x34')]=_['intersection'](_0x26d73e[_0x34bd('0x2e')],_0x26d73e[_0x34bd('0x2b')]);_0x42a424[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x26d73e[_0x34bd('0x2e')],qs['fields'](_0x3d3b96[_0x34bd('0x2b')]['fields']));_0x42a424['attributes']=_0x42a424[_0x34bd('0x2f')]['length']?_0x42a424[_0x34bd('0x2f')]:_0x26d73e[_0x34bd('0x2e')];if(_0x3d3b96[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x42a424[_0x34bd('0x3c')]=[{'all':!![]}];}_0x42a424=_['merge']({},_0x42a424,_0x3d3b96['options']);return db[_0x34bd('0x27')]['find'](_0x42a424)[_0x34bd('0x21')](handleEntityNotFound(_0x18e9f6,null))[_0x34bd('0x21')](respondWithResult(_0x18e9f6,null))[_0x34bd('0x3d')](handleError(_0x18e9f6,null));};exports['create']=function(_0x4ad00c,_0x4f96dd){return db['MailQueueReport'][_0x34bd('0x3e')](_0x4ad00c['body'],{})[_0x34bd('0x21')](respondWithResult(_0x4f96dd,0xc9))['catch'](handleError(_0x4f96dd,null));};exports[_0x34bd('0x3f')]=function(_0x1d01d7,_0x1fa341){if(_0x1d01d7[_0x34bd('0x40')]['id']){delete _0x1d01d7[_0x34bd('0x40')]['id'];}return db['MailQueueReport'][_0x34bd('0x41')]({'where':{'id':_0x1d01d7[_0x34bd('0x3b')]['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fa341,null))[_0x34bd('0x21')](saveUpdates(_0x1d01d7[_0x34bd('0x40')],null))['then'](respondWithResult(_0x1fa341,null))[_0x34bd('0x3d')](handleError(_0x1fa341,null));};exports[_0x34bd('0x20')]=function(_0x5bcce5,_0x1fc735){return db[_0x34bd('0x27')]['find']({'where':{'id':_0x5bcce5['params']['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fc735,null))['then'](removeEntity(_0x1fc735,null))['catch'](handleError(_0x1fc735,null));};exports[_0x34bd('0x42')]=function(_0x5df6a5,_0x556ce8){return db['MailQueueReport']['describe']()['then'](respondWithResult(_0x556ce8,null))[_0x34bd('0x3d')](handleError(_0x556ce8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 01448e6..81c3099 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 _0xe254=['exports','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','./mailQueueReport.attributes'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xe254,0xa8));var _0x4e25=function(_0x4030c8,_0x556291){_0x4030c8=_0x4030c8-0x0;var _0x525675=_0xe254[_0x4030c8];return _0x525675;};'use strict';var _=require(_0x4e25('0x0'));var util=require(_0x4e25('0x1'));var logger=require(_0x4e25('0x2'))(_0x4e25('0x3'));var moment=require('moment');var BPromise=require(_0x4e25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e25('0x5'));var rimraf=require(_0x4e25('0x6'));var config=require('../../config/environment');var attributes=require(_0x4e25('0x7'));module[_0x4e25('0x8')]=function(_0xea5a01,_0x34634a){return _0xea5a01['define'](_0x4e25('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x4e25('0xa'),'fields':[_0x4e25('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7aee=['util','../../config/logger','api','moment','bluebird','path','rimraf','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x978971,_0x4ca3cb){var _0x48572f=function(_0x58fdd6){while(--_0x58fdd6){_0x978971['push'](_0x978971['shift']());}};_0x48572f(++_0x4ca3cb);}(_0x7aee,0x9c));var _0xe7ae=function(_0xa9fc1d,_0x2a25db){_0xa9fc1d=_0xa9fc1d-0x0;var _0x45485c=_0x7aee[_0xa9fc1d];return _0x45485c;};'use strict';var _=require('lodash');var util=require(_0xe7ae('0x0'));var logger=require(_0xe7ae('0x1'))(_0xe7ae('0x2'));var moment=require(_0xe7ae('0x3'));var BPromise=require(_0xe7ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7ae('0x5'));var rimraf=require(_0xe7ae('0x6'));var config=require('../../config/environment');var attributes=require(_0xe7ae('0x7'));module[_0xe7ae('0x8')]=function(_0x5a6fda,_0x26badb){return _0x5a6fda['define'](_0xe7ae('0x9'),attributes,{'tableName':_0xe7ae('0xa'),'paranoid':![],'indexes':[{'name':_0xe7ae('0xb'),'fields':[_0xe7ae('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 28d1835..3381c7d 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(_0x4ad231,_0x314a68){var _0x4d76b4=function(_0x2457ee){while(--_0x2457ee){_0x4ad231['push'](_0x4ad231['shift']());}};_0x4d76b4(++_0x314a68);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0xaf52f9,_0x3608bc){var _0xd9e03e=function(_0xaf82d3){while(--_0xaf82d3){_0xaf52f9['push'](_0xaf52f9['shift']());}};_0xd9e03e(++_0x3608bc);}(_0xdb28,0x106));var _0x8db2=function(_0x5f44d1,_0x44abb2){_0x5f44d1=_0x5f44d1-0x0;var _0x1c6e32=_0xdb28[_0x5f44d1];return _0x1c6e32;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f6ad6f2..8dfb936 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5bccbf,_0x547e42){var _0x2158c6=function(_0x40f28a){while(--_0x40f28a){_0x5bccbf['push'](_0x5bccbf['shift']());}};_0x2158c6(++_0x547e42);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xb2602e,_0x1d888c){var _0x2263ca=function(_0x408c50){while(--_0x408c50){_0xb2602e['push'](_0xb2602e['shift']());}};_0x2263ca(++_0x1d888c);}(_0xe706,0xa3));var _0x6e70=function(_0xfaddc9,_0x5c9ad2){_0xfaddc9=_0xfaddc9-0x0;var _0x579846=_0xe706[_0xfaddc9];return _0x579846;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 8b31eca..6f71b5a 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 _0x43c5=['BOOLEAN','INBOX','INTEGER','sequelize','exports','STRING'];(function(_0xcad126,_0xae2538){var _0x2d08a7=function(_0x3054e6){while(--_0x3054e6){_0xcad126['push'](_0xcad126['shift']());}};_0x2d08a7(++_0xae2538);}(_0x43c5,0x19b));var _0x543c=function(_0x4633ce,_0x1de251){_0x4633ce=_0x4633ce-0x0;var _0x364042=_0x43c5[_0x4633ce];return _0x364042;};'use strict';var Sequelize=require(_0x543c('0x0'));module[_0x543c('0x1')]={'description':{'type':Sequelize[_0x543c('0x2')]},'host':{'type':Sequelize[_0x543c('0x2')]},'authentication':{'type':Sequelize[_0x543c('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x543c('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x543c('0x2')],'defaultValue':_0x543c('0x4')},'connTimeout':{'type':Sequelize[_0x543c('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x543c('0x2')]},'modernAuthentication':{'type':Sequelize[_0x543c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x651e=['BOOLEAN','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x651e,0x1c0));var _0xe651=function(_0x280846,_0xdf7f97){_0x280846=_0x280846-0x0;var _0x11caa3=_0x651e[_0x280846];return _0x11caa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xe651('0x0')]},'password':{'type':Sequelize[_0xe651('0x0')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe651('0x1')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe651('0x1')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe651('0x0')]},'modernAuthentication':{'type':Sequelize[_0xe651('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index adb509d..a98926a 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 _0xf7b0=['moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','define','mail_servers_in','lodash','util','../../config/logger','api'];(function(_0x2dc6a5,_0x35180d){var _0x46a3f2=function(_0xc25426){while(--_0xc25426){_0x2dc6a5['push'](_0x2dc6a5['shift']());}};_0x46a3f2(++_0x35180d);}(_0xf7b0,0x140));var _0x0f7b=function(_0x21631f,_0x3717e2){_0x21631f=_0x21631f-0x0;var _0x581bba=_0xf7b0[_0x21631f];return _0x581bba;};'use strict';var _=require(_0x0f7b('0x0'));var util=require(_0x0f7b('0x1'));var logger=require(_0x0f7b('0x2'))(_0x0f7b('0x3'));var moment=require(_0x0f7b('0x4'));var BPromise=require(_0x0f7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f7b('0x6'));var rimraf=require(_0x0f7b('0x7'));var config=require(_0x0f7b('0x8'));var attributes=require(_0x0f7b('0x9'));module['exports']=function(_0x407271,_0xf7125a){return _0x407271[_0x0f7b('0xa')]('MailServerIn',attributes,{'tableName':_0x0f7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a9b=['./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x2ab9c7,_0x3f5ef9){var _0x324c04=function(_0x46888f){while(--_0x46888f){_0x2ab9c7['push'](_0x2ab9c7['shift']());}};_0x324c04(++_0x3f5ef9);}(_0x3a9b,0x68));var _0xb3a9=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x3a9b[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xb3a9('0x0'));var util=require(_0xb3a9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb3a9('0x2'));var BPromise=require(_0xb3a9('0x3'));var rp=require(_0xb3a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3a9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb3a9('0x6'));module[_0xb3a9('0x7')]=function(_0x53f318,_0x17f565){return _0x53f318[_0xb3a9('0x8')]('MailServerIn',attributes,{'tableName':_0xb3a9('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 c772c60..915377f 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 _0x1db3=['findAll','options','where','attributes','limit','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMailServerIn','MailServerIn'];(function(_0x1e7739,_0x4943e9){var _0x3db84b=function(_0x443975){while(--_0x443975){_0x1e7739['push'](_0x1e7739['shift']());}};_0x3db84b(++_0x4943e9);}(_0x1db3,0x1e5));var _0x31db=function(_0x2b3072,_0x57275a){_0x2b3072=_0x2b3072-0x0;var _0xc217e4=_0x1db3[_0x2b3072];return _0xc217e4;};'use strict';var _=require('lodash');var util=require(_0x31db('0x0'));var moment=require(_0x31db('0x1'));var BPromise=require(_0x31db('0x2'));var rs=require(_0x31db('0x3'));var fs=require('fs');var Redis=require(_0x31db('0x4'));var db=require(_0x31db('0x5'))['db'];var utils=require(_0x31db('0x6'));var logger=require(_0x31db('0x7'))(_0x31db('0x8'));var config=require(_0x31db('0x9'));var jayson=require(_0x31db('0xa'));var client=jayson[_0x31db('0xb')][_0x31db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x156381,_0xa4f685,_0x44e204){return new BPromise(function(_0x3a431e,_0x3881c8){return client[_0x31db('0xd')](_0x156381,_0x44e204)['then'](function(_0x19d1a9){logger[_0x31db('0xe')](_0x31db('0xf'),_0xa4f685,_0x31db('0x10'));logger[_0x31db('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0xa4f685,_0x31db('0x10'),JSON[_0x31db('0x12')](_0x19d1a9));if(_0x19d1a9[_0x31db('0x13')]){if(_0x19d1a9['error'][_0x31db('0x14')]===0x1f4){logger[_0x31db('0x13')](_0x31db('0xf'),_0xa4f685,_0x19d1a9[_0x31db('0x13')][_0x31db('0x15')]);return _0x3881c8(_0x19d1a9[_0x31db('0x13')]['message']);}logger['error'](_0x31db('0xf'),_0xa4f685,_0x19d1a9['error'][_0x31db('0x15')]);return _0x3a431e(_0x19d1a9[_0x31db('0x13')][_0x31db('0x15')]);}else{logger[_0x31db('0xe')](_0x31db('0xf'),_0xa4f685,'request\x20sent');_0x3a431e(_0x19d1a9['result']['message']);}})[_0x31db('0x16')](function(_0x22aa89){logger[_0x31db('0x13')](_0x31db('0xf'),_0xa4f685,_0x22aa89);_0x3881c8(_0x22aa89);});});}exports[_0x31db('0x17')]=function(_0x1d3218){var _0x9f2780=this;return new Promise(function(_0x3df86e,_0x2d9dd7){return db[_0x31db('0x18')][_0x31db('0x19')]({'raw':_0x1d3218['options']?_0x1d3218[_0x31db('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1d3218['options']?_0x1d3218[_0x31db('0x1a')][_0x31db('0x1b')]||null:null,'attributes':_0x1d3218[_0x31db('0x1a')]?_0x1d3218[_0x31db('0x1a')][_0x31db('0x1c')]||null:null,'limit':_0x1d3218[_0x31db('0x1a')]?_0x1d3218[_0x31db('0x1a')][_0x31db('0x1d')]||null:null,'include':_0x1d3218[_0x31db('0x1a')]?_0x1d3218[_0x31db('0x1a')][_0x31db('0x1e')]?_[_0x31db('0x1f')](_0x1d3218['options'][_0x31db('0x1e')],function(_0x335cc9){return{'model':db[_0x335cc9[_0x31db('0x20')]],'as':_0x335cc9['as'],'attributes':_0x335cc9['attributes'],'include':_0x335cc9[_0x31db('0x1e')]?_['map'](_0x335cc9['include'],function(_0x2ea3a6){return{'model':db[_0x2ea3a6[_0x31db('0x20')]],'as':_0x2ea3a6['as'],'attributes':_0x2ea3a6['attributes'],'include':_0x2ea3a6['include']?_['map'](_0x2ea3a6[_0x31db('0x1e')],function(_0x48668b){return{'model':db[_0x48668b[_0x31db('0x20')]],'as':_0x48668b['as'],'attributes':_0x48668b[_0x31db('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x31db('0x21')](function(_0x3effc4){logger[_0x31db('0xe')](_0x31db('0x17'),_0x1d3218);logger[_0x31db('0x11')](_0x31db('0x17'),_0x1d3218,JSON[_0x31db('0x12')](_0x3effc4));_0x3df86e(_0x3effc4);})['catch'](function(_0x1a1124){logger[_0x31db('0x13')]('GetMailServerIn',_0x1a1124['message'],_0x1d3218);_0x2d9dd7(_0x9f2780[_0x31db('0x13')](0x1f4,_0x1a1124['message']));});});}; \ No newline at end of file +var _0x13f7=['error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x518bc4,_0x14e1b2){var _0x2aeed7=function(_0x1a4a88){while(--_0x1a4a88){_0x518bc4['push'](_0x518bc4['shift']());}};_0x2aeed7(++_0x14e1b2);}(_0x13f7,0x164));var _0x713f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13f7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x713f('0x0'));var util=require(_0x713f('0x1'));var moment=require(_0x713f('0x2'));var BPromise=require(_0x713f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x713f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x713f('0x5'));var logger=require(_0x713f('0x6'))(_0x713f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x713f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2571f6,_0x57616c,_0x4f7a31){return new BPromise(function(_0x2a47f5,_0x59874f){return client[_0x713f('0x9')](_0x2571f6,_0x4f7a31)[_0x713f('0xa')](function(_0x3f594c){logger[_0x713f('0xb')](_0x713f('0xc'),_0x57616c,'request\x20sent');logger[_0x713f('0xd')](_0x713f('0xe'),_0x57616c,_0x713f('0xf'),JSON['stringify'](_0x3f594c));if(_0x3f594c[_0x713f('0x10')]){if(_0x3f594c[_0x713f('0x10')][_0x713f('0x11')]===0x1f4){logger[_0x713f('0x10')](_0x713f('0xc'),_0x57616c,_0x3f594c[_0x713f('0x10')][_0x713f('0x12')]);return _0x59874f(_0x3f594c[_0x713f('0x10')][_0x713f('0x12')]);}logger[_0x713f('0x10')](_0x713f('0xc'),_0x57616c,_0x3f594c[_0x713f('0x10')][_0x713f('0x12')]);return _0x2a47f5(_0x3f594c[_0x713f('0x10')]['message']);}else{logger[_0x713f('0xb')](_0x713f('0xc'),_0x57616c,'request\x20sent');_0x2a47f5(_0x3f594c[_0x713f('0x13')][_0x713f('0x12')]);}})[_0x713f('0x14')](function(_0x332b29){logger[_0x713f('0x10')](_0x713f('0xc'),_0x57616c,_0x332b29);_0x59874f(_0x332b29);});});}exports[_0x713f('0x15')]=function(_0x5a4501){var _0x55e850=this;return new Promise(function(_0x1f88ba,_0x49792d){return db[_0x713f('0x16')][_0x713f('0x17')]({'raw':_0x5a4501[_0x713f('0x18')]?_0x5a4501[_0x713f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a4501['options']?_0x5a4501[_0x713f('0x18')][_0x713f('0x19')]||null:null,'attributes':_0x5a4501['options']?_0x5a4501['options']['attributes']||null:null,'limit':_0x5a4501[_0x713f('0x18')]?_0x5a4501[_0x713f('0x18')]['limit']||null:null,'include':_0x5a4501[_0x713f('0x18')]?_0x5a4501[_0x713f('0x18')][_0x713f('0x1a')]?_[_0x713f('0x1b')](_0x5a4501[_0x713f('0x18')][_0x713f('0x1a')],function(_0x314e0c){return{'model':db[_0x314e0c[_0x713f('0x1c')]],'as':_0x314e0c['as'],'attributes':_0x314e0c[_0x713f('0x1d')],'include':_0x314e0c[_0x713f('0x1a')]?_[_0x713f('0x1b')](_0x314e0c[_0x713f('0x1a')],function(_0x232b31){return{'model':db[_0x232b31[_0x713f('0x1c')]],'as':_0x232b31['as'],'attributes':_0x232b31[_0x713f('0x1d')],'include':_0x232b31[_0x713f('0x1a')]?_[_0x713f('0x1b')](_0x232b31['include'],function(_0x222bbd){return{'model':db[_0x222bbd[_0x713f('0x1c')]],'as':_0x222bbd['as'],'attributes':_0x222bbd[_0x713f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x713f('0xa')](function(_0x3b4c74){logger[_0x713f('0xb')](_0x713f('0x15'),_0x5a4501);logger['debug'](_0x713f('0x15'),_0x5a4501,JSON[_0x713f('0x1e')](_0x3b4c74));_0x1f88ba(_0x3b4c74);})[_0x713f('0x14')](function(_0x3da68f){logger['error']('GetMailServerIn',_0x3da68f['message'],_0x5a4501);_0x49792d(_0x55e850[_0x713f('0x10')](0x1f4,_0x3da68f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 743295d..4b9f974 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(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x7a54,0x106));var _0x47a5=function(_0x3c3106,_0x13f019){_0x3c3106=_0x3c3106-0x0;var _0x258fcb=_0x7a54[_0x3c3106];return _0x258fcb;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x7a54,0x106));var _0x47a5=function(_0x36cb3b,_0x5b0dfa){_0x36cb3b=_0x36cb3b-0x0;var _0x42030b=_0x7a54[_0x36cb3b];return _0x42030b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 76b6956..30216e5 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 _0x6e6c=['exports','STRING','BOOLEAN','sequelize'];(function(_0x358b1a,_0x3598ed){var _0x421afc=function(_0x50859a){while(--_0x50859a){_0x358b1a['push'](_0x358b1a['shift']());}};_0x421afc(++_0x3598ed);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc6e6('0x2')]},'user':{'type':Sequelize[_0xc6e6('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xefda=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x565e7f,_0x578a80){var _0xddc092=function(_0x1a4150){while(--_0x1a4150){_0x565e7f['push'](_0x565e7f['shift']());}};_0xddc092(++_0x578a80);}(_0xefda,0x96));var _0xaefd=function(_0x61c0b1,_0x4c07f3){_0x61c0b1=_0x61c0b1-0x0;var _0x5f2d2e=_0xefda[_0x61c0b1];return _0x5f2d2e;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xaefd('0x1')]},'user':{'type':Sequelize[_0xaefd('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaefd('0x2')]},'secure':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xaefd('0x1')]},'authentication':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 1dfd5ed..e56e4f6 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 _0x3412=['end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','eml-format','fast-json-patch','moment','util','path','fs-extra','lodash','squel','crypto','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'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x3412,0xb9));var _0x2341=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x3412[_0x10004e];return _0x5af990;};'use strict';var emlformat=require(_0x2341('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2341('0x1'));var rp=require('request-promise');var moment=require(_0x2341('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2341('0x3'));var path=require(_0x2341('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2341('0x5'));var _=require(_0x2341('0x6'));var squel=require(_0x2341('0x7'));var crypto=require(_0x2341('0x8'));var jsforce=require(_0x2341('0x9'));var deskjs=require(_0x2341('0xa'));var toCsv=require(_0x2341('0xb'));var querystring=require(_0x2341('0xc'));var Papa=require(_0x2341('0xd'));var Redis=require(_0x2341('0xe'));var authService=require(_0x2341('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2341('0x10'));var hardwareService=require(_0x2341('0x11'));var logger=require(_0x2341('0x12'))(_0x2341('0x13'));var utils=require('../../config/utils');var config=require(_0x2341('0x14'));var licenseUtil=require(_0x2341('0x15'));var db=require(_0x2341('0x16'))['db'];function respondWithStatusCode(_0x3737d5,_0x4e25f0){_0x4e25f0=_0x4e25f0||0xcc;return function(_0xd24a1c){if(_0xd24a1c){return _0x3737d5[_0x2341('0x17')](_0x4e25f0);}return _0x3737d5[_0x2341('0x18')](_0x4e25f0)[_0x2341('0x19')]();};}function respondWithResult(_0x29867,_0x31782b){_0x31782b=_0x31782b||0xc8;return function(_0x4d9c8c){if(_0x4d9c8c){return _0x29867[_0x2341('0x18')](_0x31782b)['json'](_0x4d9c8c);}};}function respondWithFilteredResult(_0x56f679,_0x12d464){return function(_0x24848a){if(_0x24848a){var _0x118bc1=typeof _0x12d464[_0x2341('0x1a')]===_0x2341('0x1b')&&typeof _0x12d464['limit']===_0x2341('0x1b');var _0x2e463b=_0x24848a[_0x2341('0x1c')];var _0x5784d8=_0x118bc1?0x0:_0x12d464[_0x2341('0x1a')];var _0x3f258a=_0x118bc1?_0x24848a['count']:_0x12d464['offset']+_0x12d464[_0x2341('0x1d')];var _0x2c1b07;if(_0x3f258a>=_0x2e463b){_0x3f258a=_0x2e463b;_0x2c1b07=0xc8;}else{_0x2c1b07=0xce;}_0x56f679[_0x2341('0x18')](_0x2c1b07);return _0x56f679[_0x2341('0x1e')](_0x2341('0x1f'),_0x5784d8+'-'+_0x3f258a+'/'+_0x2e463b)['json'](_0x24848a);}return null;};}function patchUpdates(_0x3d249d){return function(_0x5ad753){try{jsonpatch[_0x2341('0x20')](_0x5ad753,_0x3d249d,!![]);}catch(_0xa92015){return BPromise[_0x2341('0x21')](_0xa92015);}return _0x5ad753[_0x2341('0x22')]();};}function saveUpdates(_0xbe8d08,_0x195cf2){return function(_0x394c6a){if(_0x394c6a){return _0x394c6a['update'](_0xbe8d08)[_0x2341('0x23')](function(_0x2b9bd9){return _0x2b9bd9;});}return null;};}function removeEntity(_0x225f63,_0x1ccc66){return function(_0x2d0ac3){if(_0x2d0ac3){return _0x2d0ac3[_0x2341('0x24')]()[_0x2341('0x23')](function(){_0x225f63[_0x2341('0x18')](0xcc)[_0x2341('0x19')]();});}};}function handleEntityNotFound(_0x4435d9,_0x2fae71){return function(_0x588b8a){if(!_0x588b8a){_0x4435d9[_0x2341('0x17')](0x194);}return _0x588b8a;};}function handleError(_0x5ecd80,_0x1f3db8){_0x1f3db8=_0x1f3db8||0x1f4;return function(_0x5c71b7){logger['error'](_0x5c71b7['stack']);if(_0x5c71b7[_0x2341('0x25')]){delete _0x5c71b7['name'];}_0x5ecd80['status'](_0x1f3db8)['send'](_0x5c71b7);};}exports[_0x2341('0x26')]=function(_0x14778c,_0x232071){var _0x282709={},_0x3c7ee1={},_0x435096={'count':0x0,'rows':[]};var _0x37496f=_[_0x2341('0x27')](db['MailServerOut'][_0x2341('0x28')],function(_0x2d2ebe){return{'name':_0x2d2ebe[_0x2341('0x29')],'type':_0x2d2ebe[_0x2341('0x2a')]['key']};});_0x3c7ee1[_0x2341('0x2b')]=_[_0x2341('0x27')](_0x37496f,_0x2341('0x25'));_0x3c7ee1[_0x2341('0x2c')]=_[_0x2341('0x2d')](_0x14778c[_0x2341('0x2c')]);_0x3c7ee1[_0x2341('0x2e')]=_[_0x2341('0x2f')](_0x3c7ee1[_0x2341('0x2b')],_0x3c7ee1[_0x2341('0x2c')]);_0x282709['attributes']=_['intersection'](_0x3c7ee1[_0x2341('0x2b')],qs[_0x2341('0x30')](_0x14778c[_0x2341('0x2c')]['fields']));_0x282709[_0x2341('0x31')]=_0x282709[_0x2341('0x31')][_0x2341('0x32')]?_0x282709[_0x2341('0x31')]:_0x3c7ee1[_0x2341('0x2b')];if(!_0x14778c[_0x2341('0x2c')][_0x2341('0x33')](_0x2341('0x34'))){_0x282709[_0x2341('0x1d')]=qs[_0x2341('0x1d')](_0x14778c['query']['limit']);_0x282709[_0x2341('0x1a')]=qs[_0x2341('0x1a')](_0x14778c[_0x2341('0x2c')][_0x2341('0x1a')]);}_0x282709[_0x2341('0x35')]=qs['sort'](_0x14778c['query']['sort']);_0x282709[_0x2341('0x36')]=qs[_0x2341('0x2e')](_['pick'](_0x14778c['query'],_0x3c7ee1[_0x2341('0x2e')]),_0x37496f);if(_0x14778c[_0x2341('0x2c')][_0x2341('0x37')]){_0x282709[_0x2341('0x36')]=_[_0x2341('0x38')](_0x282709[_0x2341('0x36')],{'$or':_[_0x2341('0x27')](_0x37496f,function(_0x4e39f9){if(_0x4e39f9[_0x2341('0x2a')]!=='VIRTUAL'){var _0xf41cb3={};_0xf41cb3[_0x4e39f9['name']]={'$like':'%'+_0x14778c[_0x2341('0x2c')][_0x2341('0x37')]+'%'};return _0xf41cb3;}})});}_0x282709=_[_0x2341('0x38')]({},_0x282709,_0x14778c[_0x2341('0x39')]);var _0x4d6c5c={'where':_0x282709[_0x2341('0x36')]};return db[_0x2341('0x3a')][_0x2341('0x1c')](_0x4d6c5c)[_0x2341('0x23')](function(_0x5d87b6){_0x435096['count']=_0x5d87b6;if(_0x14778c[_0x2341('0x2c')][_0x2341('0x3b')]){_0x282709[_0x2341('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0x2341('0x3d')](_0x282709);})[_0x2341('0x23')](function(_0x5aae72){_0x435096[_0x2341('0x3e')]=_0x5aae72;return _0x435096;})[_0x2341('0x23')](respondWithFilteredResult(_0x232071,_0x282709))[_0x2341('0x3f')](handleError(_0x232071,null));};exports[_0x2341('0x40')]=function(_0x13ae86,_0x261d06){var _0x5ed9bf={'raw':!![],'where':{'id':_0x13ae86['params']['id']}},_0x3e639d={};_0x3e639d[_0x2341('0x2b')]=_[_0x2341('0x2d')](db[_0x2341('0x3a')][_0x2341('0x28')]);_0x3e639d['query']=_[_0x2341('0x2d')](_0x13ae86[_0x2341('0x2c')]);_0x3e639d['filters']=_['intersection'](_0x3e639d[_0x2341('0x2b')],_0x3e639d[_0x2341('0x2c')]);_0x5ed9bf[_0x2341('0x31')]=_['intersection'](_0x3e639d[_0x2341('0x2b')],qs[_0x2341('0x30')](_0x13ae86[_0x2341('0x2c')][_0x2341('0x30')]));_0x5ed9bf['attributes']=_0x5ed9bf['attributes'][_0x2341('0x32')]?_0x5ed9bf[_0x2341('0x31')]:_0x3e639d['model'];if(_0x13ae86[_0x2341('0x2c')][_0x2341('0x3b')]){_0x5ed9bf[_0x2341('0x3c')]=[{'all':!![]}];}_0x5ed9bf=_[_0x2341('0x38')]({},_0x5ed9bf,_0x13ae86[_0x2341('0x39')]);return db[_0x2341('0x3a')][_0x2341('0x41')](_0x5ed9bf)['then'](handleEntityNotFound(_0x261d06,null))[_0x2341('0x23')](respondWithResult(_0x261d06,null))[_0x2341('0x3f')](handleError(_0x261d06,null));};exports[_0x2341('0x42')]=function(_0x10a7e1,_0x1c3bf8){return db['MailServerOut']['create'](_0x10a7e1[_0x2341('0x43')],{})[_0x2341('0x23')](respondWithResult(_0x1c3bf8,0xc9))[_0x2341('0x3f')](handleError(_0x1c3bf8,null));};exports[_0x2341('0x44')]=function(_0x3ed13f,_0x5b7a85){if(_0x3ed13f[_0x2341('0x43')]['id']){delete _0x3ed13f[_0x2341('0x43')]['id'];}return db[_0x2341('0x3a')]['find']({'where':{'id':_0x3ed13f[_0x2341('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b7a85,null))[_0x2341('0x23')](saveUpdates(_0x3ed13f[_0x2341('0x43')],null))[_0x2341('0x23')](respondWithResult(_0x5b7a85,null))[_0x2341('0x3f')](handleError(_0x5b7a85,null));};exports[_0x2341('0x24')]=function(_0x111b39,_0x2f89a4){return db['MailServerOut'][_0x2341('0x41')]({'where':{'id':_0x111b39['params']['id']}})[_0x2341('0x23')](handleEntityNotFound(_0x2f89a4,null))['then'](removeEntity(_0x2f89a4,null))[_0x2341('0x3f')](handleError(_0x2f89a4,null));}; \ No newline at end of file +var _0x3587=['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','sendStatus','status','end','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','count','include','rows','catch','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv'];(function(_0x55c5ec,_0x4201a2){var _0x4bd315=function(_0x56b7f4){while(--_0x56b7f4){_0x55c5ec['push'](_0x55c5ec['shift']());}};_0x4bd315(++_0x4201a2);}(_0x3587,0x18f));var _0x7358=function(_0x38abee,_0x31a234){_0x38abee=_0x38abee-0x0;var _0x29a72f=_0x3587[_0x38abee];return _0x29a72f;};'use strict';var emlformat=require(_0x7358('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7358('0x1'));var jsonpatch=require(_0x7358('0x2'));var rp=require(_0x7358('0x3'));var moment=require(_0x7358('0x4'));var BPromise=require(_0x7358('0x5'));var Mustache=require(_0x7358('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7358('0x7'));var csv=require(_0x7358('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7358('0x9'));var squel=require(_0x7358('0xa'));var crypto=require(_0x7358('0xb'));var jsforce=require(_0x7358('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7358('0xd'));var Papa=require(_0x7358('0xe'));var Redis=require(_0x7358('0xf'));var authService=require(_0x7358('0x10'));var qs=require(_0x7358('0x11'));var as=require(_0x7358('0x12'));var hardwareService=require(_0x7358('0x13'));var logger=require(_0x7358('0x14'))(_0x7358('0x15'));var utils=require(_0x7358('0x16'));var config=require(_0x7358('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe81388,_0xba9984){_0xba9984=_0xba9984||0xcc;return function(_0x2d48e8){if(_0x2d48e8){return _0xe81388[_0x7358('0x18')](_0xba9984);}return _0xe81388[_0x7358('0x19')](_0xba9984)[_0x7358('0x1a')]();};}function respondWithResult(_0x3bbf43,_0xdae4b9){_0xdae4b9=_0xdae4b9||0xc8;return function(_0x506667){if(_0x506667){return _0x3bbf43[_0x7358('0x19')](_0xdae4b9)['json'](_0x506667);}};}function respondWithFilteredResult(_0x11a076,_0x5b8463){return function(_0x4ad6a7){if(_0x4ad6a7){var _0x51d5b1=typeof _0x5b8463[_0x7358('0x1b')]==='undefined'&&typeof _0x5b8463[_0x7358('0x1c')]==='undefined';var _0x2d20b3=_0x4ad6a7['count'];var _0xaf6513=_0x51d5b1?0x0:_0x5b8463[_0x7358('0x1b')];var _0x204659=_0x51d5b1?_0x4ad6a7['count']:_0x5b8463[_0x7358('0x1b')]+_0x5b8463[_0x7358('0x1c')];var _0x396c81;if(_0x204659>=_0x2d20b3){_0x204659=_0x2d20b3;_0x396c81=0xc8;}else{_0x396c81=0xce;}_0x11a076[_0x7358('0x19')](_0x396c81);return _0x11a076[_0x7358('0x1d')](_0x7358('0x1e'),_0xaf6513+'-'+_0x204659+'/'+_0x2d20b3)['json'](_0x4ad6a7);}return null;};}function patchUpdates(_0x30042b){return function(_0x340949){try{jsonpatch[_0x7358('0x1f')](_0x340949,_0x30042b,!![]);}catch(_0x52a9b3){return BPromise['reject'](_0x52a9b3);}return _0x340949['save']();};}function saveUpdates(_0x531ac9,_0x27651e){return function(_0x505200){if(_0x505200){return _0x505200[_0x7358('0x20')](_0x531ac9)[_0x7358('0x21')](function(_0x4808f3){return _0x4808f3;});}return null;};}function removeEntity(_0xb7e325,_0x705e9b){return function(_0x3ad173){if(_0x3ad173){return _0x3ad173[_0x7358('0x22')]()[_0x7358('0x21')](function(){_0xb7e325['status'](0xcc)[_0x7358('0x1a')]();});}};}function handleEntityNotFound(_0x5b46fa,_0x467b01){return function(_0x423cd6){if(!_0x423cd6){_0x5b46fa['sendStatus'](0x194);}return _0x423cd6;};}function handleError(_0x4df157,_0xec30e4){_0xec30e4=_0xec30e4||0x1f4;return function(_0xa2bf76){logger[_0x7358('0x23')](_0xa2bf76[_0x7358('0x24')]);if(_0xa2bf76['name']){delete _0xa2bf76[_0x7358('0x25')];}_0x4df157['status'](_0xec30e4)[_0x7358('0x26')](_0xa2bf76);};}exports[_0x7358('0x27')]=function(_0x3859c7,_0x12b5f3){var _0x15a4c6={},_0x3f8873={},_0x3e9295={'count':0x0,'rows':[]};var _0x3191bc=_[_0x7358('0x28')](db[_0x7358('0x29')][_0x7358('0x2a')],function(_0x3f1f74){return{'name':_0x3f1f74[_0x7358('0x2b')],'type':_0x3f1f74['type'][_0x7358('0x2c')]};});_0x3f8873[_0x7358('0x2d')]=_[_0x7358('0x28')](_0x3191bc,_0x7358('0x25'));_0x3f8873[_0x7358('0x2e')]=_[_0x7358('0x2f')](_0x3859c7[_0x7358('0x2e')]);_0x3f8873[_0x7358('0x30')]=_[_0x7358('0x31')](_0x3f8873['model'],_0x3f8873[_0x7358('0x2e')]);_0x15a4c6['attributes']=_['intersection'](_0x3f8873[_0x7358('0x2d')],qs['fields'](_0x3859c7['query'][_0x7358('0x32')]));_0x15a4c6[_0x7358('0x33')]=_0x15a4c6[_0x7358('0x33')][_0x7358('0x34')]?_0x15a4c6['attributes']:_0x3f8873[_0x7358('0x2d')];if(!_0x3859c7[_0x7358('0x2e')]['hasOwnProperty'](_0x7358('0x35'))){_0x15a4c6['limit']=qs[_0x7358('0x1c')](_0x3859c7[_0x7358('0x2e')][_0x7358('0x1c')]);_0x15a4c6['offset']=qs[_0x7358('0x1b')](_0x3859c7[_0x7358('0x2e')][_0x7358('0x1b')]);}_0x15a4c6['order']=qs[_0x7358('0x36')](_0x3859c7[_0x7358('0x2e')][_0x7358('0x36')]);_0x15a4c6[_0x7358('0x37')]=qs['filters'](_[_0x7358('0x38')](_0x3859c7[_0x7358('0x2e')],_0x3f8873[_0x7358('0x30')]),_0x3191bc);if(_0x3859c7[_0x7358('0x2e')][_0x7358('0x39')]){_0x15a4c6[_0x7358('0x37')]=_[_0x7358('0x3a')](_0x15a4c6[_0x7358('0x37')],{'$or':_[_0x7358('0x28')](_0x3191bc,function(_0x3262fb){if(_0x3262fb['type']!=='VIRTUAL'){var _0x2a76d8={};_0x2a76d8[_0x3262fb[_0x7358('0x25')]]={'$like':'%'+_0x3859c7[_0x7358('0x2e')][_0x7358('0x39')]+'%'};return _0x2a76d8;}})});}_0x15a4c6=_['merge']({},_0x15a4c6,_0x3859c7[_0x7358('0x3b')]);var _0x37c0d4={'where':_0x15a4c6[_0x7358('0x37')]};return db[_0x7358('0x29')][_0x7358('0x3c')](_0x37c0d4)['then'](function(_0x554d3f){_0x3e9295[_0x7358('0x3c')]=_0x554d3f;if(_0x3859c7[_0x7358('0x2e')]['includeAll']){_0x15a4c6[_0x7358('0x3d')]=[{'all':!![]}];}return db[_0x7358('0x29')]['findAll'](_0x15a4c6);})['then'](function(_0x280ba7){_0x3e9295[_0x7358('0x3e')]=_0x280ba7;return _0x3e9295;})[_0x7358('0x21')](respondWithFilteredResult(_0x12b5f3,_0x15a4c6))[_0x7358('0x3f')](handleError(_0x12b5f3,null));};exports['show']=function(_0x5172f7,_0x4e21d3){var _0x1d24ab={'raw':!![],'where':{'id':_0x5172f7['params']['id']}},_0x5b57ef={};_0x5b57ef[_0x7358('0x2d')]=_[_0x7358('0x2f')](db[_0x7358('0x29')][_0x7358('0x2a')]);_0x5b57ef[_0x7358('0x2e')]=_[_0x7358('0x2f')](_0x5172f7['query']);_0x5b57ef[_0x7358('0x30')]=_['intersection'](_0x5b57ef[_0x7358('0x2d')],_0x5b57ef[_0x7358('0x2e')]);_0x1d24ab[_0x7358('0x33')]=_[_0x7358('0x31')](_0x5b57ef[_0x7358('0x2d')],qs['fields'](_0x5172f7[_0x7358('0x2e')][_0x7358('0x32')]));_0x1d24ab[_0x7358('0x33')]=_0x1d24ab[_0x7358('0x33')][_0x7358('0x34')]?_0x1d24ab[_0x7358('0x33')]:_0x5b57ef['model'];if(_0x5172f7[_0x7358('0x2e')][_0x7358('0x40')]){_0x1d24ab[_0x7358('0x3d')]=[{'all':!![]}];}_0x1d24ab=_[_0x7358('0x3a')]({},_0x1d24ab,_0x5172f7[_0x7358('0x3b')]);return db['MailServerOut'][_0x7358('0x41')](_0x1d24ab)[_0x7358('0x21')](handleEntityNotFound(_0x4e21d3,null))[_0x7358('0x21')](respondWithResult(_0x4e21d3,null))[_0x7358('0x3f')](handleError(_0x4e21d3,null));};exports[_0x7358('0x42')]=function(_0x41597b,_0x2d532e){return db[_0x7358('0x29')][_0x7358('0x42')](_0x41597b[_0x7358('0x43')],{})['then'](respondWithResult(_0x2d532e,0xc9))[_0x7358('0x3f')](handleError(_0x2d532e,null));};exports[_0x7358('0x20')]=function(_0x3b7f79,_0x1fba35){if(_0x3b7f79[_0x7358('0x43')]['id']){delete _0x3b7f79[_0x7358('0x43')]['id'];}return db[_0x7358('0x29')]['find']({'where':{'id':_0x3b7f79['params']['id']}})['then'](handleEntityNotFound(_0x1fba35,null))['then'](saveUpdates(_0x3b7f79[_0x7358('0x43')],null))['then'](respondWithResult(_0x1fba35,null))[_0x7358('0x3f')](handleError(_0x1fba35,null));};exports[_0x7358('0x22')]=function(_0x4ae1ac,_0x53c5c8){return db[_0x7358('0x29')][_0x7358('0x41')]({'where':{'id':_0x4ae1ac['params']['id']}})[_0x7358('0x21')](handleEntityNotFound(_0x53c5c8,null))['then'](removeEntity(_0x53c5c8,null))['catch'](handleError(_0x53c5c8,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 11c1503..19b5481 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 _0xa095=['exports','define','mail_servers_out','lodash','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x36efde,_0x47fe88){var _0x36a9b8=function(_0x55f796){while(--_0x55f796){_0x36efde['push'](_0x36efde['shift']());}};_0x36a9b8(++_0x47fe88);}(_0xa095,0xfd));var _0x5a09=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xa095[_0x4914e2];return _0x2dcd07;};'use strict';var _=require(_0x5a09('0x0'));var util=require(_0x5a09('0x1'));var logger=require(_0x5a09('0x2'))(_0x5a09('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a09('0x4'));var rimraf=require(_0x5a09('0x5'));var config=require(_0x5a09('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x5a09('0x7')]=function(_0x23586d,_0x4b0e3a){return _0x23586d[_0x5a09('0x8')]('MailServerOut',attributes,{'tableName':_0x5a09('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16f5=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','util','../../config/logger','api','moment'];(function(_0x20dd22,_0x491e7a){var _0x302cf5=function(_0x16b88c){while(--_0x16b88c){_0x20dd22['push'](_0x20dd22['shift']());}};_0x302cf5(++_0x491e7a);}(_0x16f5,0x15c));var _0x516f=function(_0x7bdd91,_0x169181){_0x7bdd91=_0x7bdd91-0x0;var _0x358271=_0x16f5[_0x7bdd91];return _0x358271;};'use strict';var _=require('lodash');var util=require(_0x516f('0x0'));var logger=require(_0x516f('0x1'))(_0x516f('0x2'));var moment=require(_0x516f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x516f('0x4'));var config=require(_0x516f('0x5'));var attributes=require(_0x516f('0x6'));module[_0x516f('0x7')]=function(_0x40e794,_0x22b806){return _0x40e794[_0x516f('0x8')](_0x516f('0x9'),attributes,{'tableName':_0x516f('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 1a6f281..662de92 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x41cd34,_0x32cd0c){var _0x1273e8=function(_0x34f4f6){while(--_0x34f4f6){_0x41cd34['push'](_0x41cd34['shift']());}};_0x1273e8(++_0x32cd0c);}(_0xadb5,0xad));var _0x5adb=function(_0x58d317,_0x14c950){_0x58d317=_0x58d317-0x0;var _0x3e4a25=_0xadb5[_0x58d317];return _0x3e4a25;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x246cbe,_0x19305c){var _0x855b0=function(_0x2c8d0d){while(--_0x2c8d0d){_0x246cbe['push'](_0x246cbe['shift']());}};_0x855b0(++_0x19305c);}(_0xadb5,0xad));var _0x5adb=function(_0x501d40,_0x4156ef){_0x501d40=_0x501d40-0x0;var _0x3dc9ed=_0xadb5[_0x501d40];return _0x3dc9ed;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c0e8073..9966cb3 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 _0x6d77=['../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5d8a70,_0x596898){var _0x23242b=function(_0x3297cd){while(--_0x3297cd){_0x5d8a70['push'](_0x5d8a70['shift']());}};_0x23242b(++_0x596898);}(_0x6d77,0x1e0));var _0x76d7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6d77[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x76d7('0x0'));var util=require('util');var path=require(_0x76d7('0x1'));var timeout=require(_0x76d7('0x2'));var express=require(_0x76d7('0x3'));var router=express['Router']();var fs_extra=require(_0x76d7('0x4'));var auth=require(_0x76d7('0x5'));var interaction=require(_0x76d7('0x6'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x76d7('0x7')]('/',auth['isAuthenticated'](),controller[_0x76d7('0x8')]);router[_0x76d7('0x7')](_0x76d7('0x9'),auth[_0x76d7('0xa')](),controller[_0x76d7('0xb')]);router[_0x76d7('0x7')](_0x76d7('0xc'),auth[_0x76d7('0xa')](),controller[_0x76d7('0xd')]);router[_0x76d7('0xe')]('/',auth[_0x76d7('0xa')](),controller['create']);router[_0x76d7('0xf')](_0x76d7('0xc'),auth[_0x76d7('0xa')](),controller['update']);router['delete']('/:id',auth[_0x76d7('0xa')](),controller[_0x76d7('0x10')]);module[_0x76d7('0x11')]=router; \ No newline at end of file +var _0xc5c2=['/:id','show','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','describe'];(function(_0x569ca0,_0x27c381){var _0x2632f8=function(_0x183fb5){while(--_0x183fb5){_0x569ca0['push'](_0x569ca0['shift']());}};_0x2632f8(++_0x27c381);}(_0xc5c2,0xcc));var _0x2c5c=function(_0x1849ee,_0x525832){_0x1849ee=_0x1849ee-0x0;var _0x70f29=_0xc5c2[_0x1849ee];return _0x70f29;};'use strict';var multer=require(_0x2c5c('0x0'));var util=require('util');var path=require(_0x2c5c('0x1'));var timeout=require(_0x2c5c('0x2'));var express=require(_0x2c5c('0x3'));var router=express[_0x2c5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2c5c('0x5'));var interaction=require(_0x2c5c('0x6'));var config=require('../../config/environment');var controller=require(_0x2c5c('0x7'));router['get']('/',auth[_0x2c5c('0x8')](),controller[_0x2c5c('0x9')]);router[_0x2c5c('0xa')]('/describe',auth[_0x2c5c('0x8')](),controller[_0x2c5c('0xb')]);router['get'](_0x2c5c('0xc'),auth[_0x2c5c('0x8')](),controller[_0x2c5c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2c5c('0xe')]);router[_0x2c5c('0xf')](_0x2c5c('0xc'),auth[_0x2c5c('0x8')](),controller['update']);router[_0x2c5c('0x10')](_0x2c5c('0xc'),auth[_0x2c5c('0x8')](),controller['destroy']);module[_0x2c5c('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0069905..2b3aff5 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 _0x0618=['name','STRING','sequelize','exports'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x0618,0x1c6));var _0x8061=function(_0x44f0a1,_0x457d11){_0x44f0a1=_0x44f0a1-0x0;var _0x4af42e=_0x0618[_0x44f0a1];return _0x4af42e;};'use strict';var Sequelize=require(_0x8061('0x0'));module[_0x8061('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8061('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8061('0x3')]}}; \ No newline at end of file +var _0x1db9=['STRING','name','sequelize','exports'];(function(_0x56756e,_0x478df4){var _0x12cd24=function(_0xd2db9c){while(--_0xd2db9c){_0x56756e['push'](_0x56756e['shift']());}};_0x12cd24(++_0x478df4);}(_0x1db9,0x176));var _0x91db=function(_0x12dd8d,_0xe2cd59){_0x12dd8d=_0x12dd8d-0x0;var _0x545002=_0x1db9[_0x12dd8d];return _0x545002;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'name':{'type':Sequelize[_0x91db('0x2')],'unique':_0x91db('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91db('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 01cc7fd..f4ed121 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 _0x9b91=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','MailSubstatus','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x39a50f,_0x559bd0){var _0x3243d1=function(_0x44ccd6){while(--_0x44ccd6){_0x39a50f['push'](_0x39a50f['shift']());}};_0x3243d1(++_0x559bd0);}(_0x9b91,0xbe));var _0x19b9=function(_0x5d10c2,_0x4b0a49){_0x5d10c2=_0x5d10c2-0x0;var _0x57c7c4=_0x9b91[_0x5d10c2];return _0x57c7c4;};'use strict';var emlformat=require(_0x19b9('0x0'));var rimraf=require(_0x19b9('0x1'));var zipdir=require(_0x19b9('0x2'));var jsonpatch=require(_0x19b9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x19b9('0x4'));var Mustache=require(_0x19b9('0x5'));var util=require('util');var path=require(_0x19b9('0x6'));var sox=require('sox');var csv=require(_0x19b9('0x7'));var ejs=require(_0x19b9('0x8'));var fs=require('fs');var fs_extra=require(_0x19b9('0x9'));var _=require(_0x19b9('0xa'));var squel=require(_0x19b9('0xb'));var crypto=require(_0x19b9('0xc'));var jsforce=require(_0x19b9('0xd'));var deskjs=require(_0x19b9('0xe'));var toCsv=require(_0x19b9('0x7'));var querystring=require(_0x19b9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x19b9('0x10'));var qs=require(_0x19b9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19b9('0x12'));var logger=require(_0x19b9('0x13'))('api');var utils=require(_0x19b9('0x14'));var config=require(_0x19b9('0x15'));var licenseUtil=require(_0x19b9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bad2b,_0x55a967){_0x55a967=_0x55a967||0xcc;return function(_0x26f591){if(_0x26f591){return _0x2bad2b[_0x19b9('0x17')](_0x55a967);}return _0x2bad2b[_0x19b9('0x18')](_0x55a967)[_0x19b9('0x19')]();};}function respondWithResult(_0x110403,_0x1d6957){_0x1d6957=_0x1d6957||0xc8;return function(_0x3a0e07){if(_0x3a0e07){return _0x110403[_0x19b9('0x18')](_0x1d6957)[_0x19b9('0x1a')](_0x3a0e07);}};}function respondWithFilteredResult(_0x251110,_0x49e0e9){return function(_0x17ec82){if(_0x17ec82){var _0x2d86bc=typeof _0x49e0e9[_0x19b9('0x1b')]===_0x19b9('0x1c')&&typeof _0x49e0e9[_0x19b9('0x1d')]===_0x19b9('0x1c');var _0x63c343=_0x17ec82[_0x19b9('0x1e')];var _0x1b4adc=_0x2d86bc?0x0:_0x49e0e9[_0x19b9('0x1b')];var _0x16d41c=_0x2d86bc?_0x17ec82[_0x19b9('0x1e')]:_0x49e0e9[_0x19b9('0x1b')]+_0x49e0e9[_0x19b9('0x1d')];var _0x4b9bb3;if(_0x16d41c>=_0x63c343){_0x16d41c=_0x63c343;_0x4b9bb3=0xc8;}else{_0x4b9bb3=0xce;}_0x251110[_0x19b9('0x18')](_0x4b9bb3);return _0x251110[_0x19b9('0x1f')](_0x19b9('0x20'),_0x1b4adc+'-'+_0x16d41c+'/'+_0x63c343)[_0x19b9('0x1a')](_0x17ec82);}return null;};}function patchUpdates(_0x57d745){return function(_0x45b718){try{jsonpatch[_0x19b9('0x21')](_0x45b718,_0x57d745,!![]);}catch(_0xb34525){return BPromise[_0x19b9('0x22')](_0xb34525);}return _0x45b718[_0x19b9('0x23')]();};}function saveUpdates(_0x58c5a5,_0x2b39e4){return function(_0x36e801){if(_0x36e801){return _0x36e801[_0x19b9('0x24')](_0x58c5a5)[_0x19b9('0x25')](function(_0x5a7381){return _0x5a7381;});}return null;};}function removeEntity(_0x3580ee,_0xb9d56){return function(_0x24e213){if(_0x24e213){return _0x24e213[_0x19b9('0x26')]()[_0x19b9('0x25')](function(){_0x3580ee['status'](0xcc)[_0x19b9('0x19')]();});}};}function handleEntityNotFound(_0x1074e9,_0x42093b){return function(_0x241025){if(!_0x241025){_0x1074e9[_0x19b9('0x17')](0x194);}return _0x241025;};}function handleError(_0x5325b9,_0x397192){_0x397192=_0x397192||0x1f4;return function(_0x4c01b6){logger[_0x19b9('0x27')](_0x4c01b6[_0x19b9('0x28')]);if(_0x4c01b6['name']){delete _0x4c01b6[_0x19b9('0x29')];}_0x5325b9[_0x19b9('0x18')](_0x397192)[_0x19b9('0x2a')](_0x4c01b6);};}exports[_0x19b9('0x2b')]=function(_0x4a904d,_0x8843f2){var _0x526b3f={},_0x368252={},_0x2c63ca={'count':0x0,'rows':[]};var _0x34c809=_[_0x19b9('0x2c')](db['MailSubstatus'][_0x19b9('0x2d')],function(_0x4b2191){return{'name':_0x4b2191[_0x19b9('0x2e')],'type':_0x4b2191[_0x19b9('0x2f')][_0x19b9('0x30')]};});_0x368252[_0x19b9('0x31')]=_['map'](_0x34c809,'name');_0x368252[_0x19b9('0x32')]=_[_0x19b9('0x33')](_0x4a904d[_0x19b9('0x32')]);_0x368252['filters']=_['intersection'](_0x368252[_0x19b9('0x31')],_0x368252[_0x19b9('0x32')]);_0x526b3f[_0x19b9('0x34')]=_[_0x19b9('0x35')](_0x368252[_0x19b9('0x31')],qs[_0x19b9('0x36')](_0x4a904d[_0x19b9('0x32')]['fields']));_0x526b3f[_0x19b9('0x34')]=_0x526b3f[_0x19b9('0x34')][_0x19b9('0x37')]?_0x526b3f[_0x19b9('0x34')]:_0x368252['model'];if(!_0x4a904d[_0x19b9('0x32')]['hasOwnProperty'](_0x19b9('0x38'))){_0x526b3f[_0x19b9('0x1d')]=qs[_0x19b9('0x1d')](_0x4a904d['query'][_0x19b9('0x1d')]);_0x526b3f[_0x19b9('0x1b')]=qs['offset'](_0x4a904d[_0x19b9('0x32')][_0x19b9('0x1b')]);}_0x526b3f['order']=qs[_0x19b9('0x39')](_0x4a904d[_0x19b9('0x32')][_0x19b9('0x39')]);_0x526b3f['where']=qs['filters'](_[_0x19b9('0x3a')](_0x4a904d['query'],_0x368252[_0x19b9('0x3b')]),_0x34c809);if(_0x4a904d[_0x19b9('0x32')][_0x19b9('0x3c')]){_0x526b3f[_0x19b9('0x3d')]=_[_0x19b9('0x3e')](_0x526b3f[_0x19b9('0x3d')],{'$or':_[_0x19b9('0x2c')](_0x34c809,function(_0x20bf71){if(_0x20bf71[_0x19b9('0x2f')]!==_0x19b9('0x3f')){var _0x481408={};_0x481408[_0x20bf71['name']]={'$like':'%'+_0x4a904d[_0x19b9('0x32')][_0x19b9('0x3c')]+'%'};return _0x481408;}})});}_0x526b3f=_['merge']({},_0x526b3f,_0x4a904d[_0x19b9('0x40')]);var _0x204784={'where':_0x526b3f[_0x19b9('0x3d')]};return db['MailSubstatus'][_0x19b9('0x1e')](_0x204784)[_0x19b9('0x25')](function(_0x4ac3e5){_0x2c63ca['count']=_0x4ac3e5;if(_0x4a904d['query'][_0x19b9('0x41')]){_0x526b3f[_0x19b9('0x42')]=[{'all':!![]}];}return db[_0x19b9('0x43')]['findAll'](_0x526b3f);})[_0x19b9('0x25')](function(_0x161804){_0x2c63ca[_0x19b9('0x44')]=_0x161804;return _0x2c63ca;})[_0x19b9('0x25')](respondWithFilteredResult(_0x8843f2,_0x526b3f))[_0x19b9('0x45')](handleError(_0x8843f2,null));};exports[_0x19b9('0x46')]=function(_0x5e6ab9,_0x16d2b0){var _0x466320={'raw':!![],'where':{'id':_0x5e6ab9[_0x19b9('0x47')]['id']}},_0x194e11={};_0x194e11[_0x19b9('0x31')]=_[_0x19b9('0x33')](db[_0x19b9('0x43')][_0x19b9('0x2d')]);_0x194e11[_0x19b9('0x32')]=_[_0x19b9('0x33')](_0x5e6ab9[_0x19b9('0x32')]);_0x194e11[_0x19b9('0x3b')]=_['intersection'](_0x194e11[_0x19b9('0x31')],_0x194e11[_0x19b9('0x32')]);_0x466320[_0x19b9('0x34')]=_[_0x19b9('0x35')](_0x194e11[_0x19b9('0x31')],qs[_0x19b9('0x36')](_0x5e6ab9[_0x19b9('0x32')][_0x19b9('0x36')]));_0x466320[_0x19b9('0x34')]=_0x466320[_0x19b9('0x34')][_0x19b9('0x37')]?_0x466320[_0x19b9('0x34')]:_0x194e11[_0x19b9('0x31')];if(_0x5e6ab9[_0x19b9('0x32')][_0x19b9('0x41')]){_0x466320[_0x19b9('0x42')]=[{'all':!![]}];}_0x466320=_[_0x19b9('0x3e')]({},_0x466320,_0x5e6ab9[_0x19b9('0x40')]);return db[_0x19b9('0x43')][_0x19b9('0x48')](_0x466320)[_0x19b9('0x25')](handleEntityNotFound(_0x16d2b0,null))[_0x19b9('0x25')](respondWithResult(_0x16d2b0,null))[_0x19b9('0x45')](handleError(_0x16d2b0,null));};exports['create']=function(_0x263b72,_0x390ceb){return db[_0x19b9('0x43')]['create'](_0x263b72['body'],{})[_0x19b9('0x25')](respondWithResult(_0x390ceb,0xc9))[_0x19b9('0x45')](handleError(_0x390ceb,null));};exports[_0x19b9('0x24')]=function(_0x21d24d,_0x21f51d){if(_0x21d24d[_0x19b9('0x49')]['id']){delete _0x21d24d[_0x19b9('0x49')]['id'];}return db['MailSubstatus'][_0x19b9('0x48')]({'where':{'id':_0x21d24d[_0x19b9('0x47')]['id']}})[_0x19b9('0x25')](handleEntityNotFound(_0x21f51d,null))[_0x19b9('0x25')](saveUpdates(_0x21d24d['body'],null))[_0x19b9('0x25')](respondWithResult(_0x21f51d,null))[_0x19b9('0x45')](handleError(_0x21f51d,null));};exports[_0x19b9('0x26')]=function(_0x115a8e,_0x5293b4){return db['MailSubstatus'][_0x19b9('0x48')]({'where':{'id':_0x115a8e[_0x19b9('0x47')]['id']}})[_0x19b9('0x25')](handleEntityNotFound(_0x5293b4,null))[_0x19b9('0x25')](removeEntity(_0x5293b4,null))[_0x19b9('0x45')](handleError(_0x5293b4,null));};exports['describe']=function(_0xf4e7d3,_0xbfeec0){return db[_0x19b9('0x43')]['describe']()[_0x19b9('0x25')](respondWithResult(_0xbfeec0,null))[_0x19b9('0x45')](handleError(_0xbfeec0,null));}; \ No newline at end of file +var _0xb8a9=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','keys','find','create','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x57ee31,_0xc815a){var _0x404381=function(_0x59da65){while(--_0x59da65){_0x57ee31['push'](_0x57ee31['shift']());}};_0x404381(++_0xc815a);}(_0xb8a9,0x77));var _0x9b8a=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0xb8a9[_0x1b6311];return _0x25aab6;};'use strict';var emlformat=require(_0x9b8a('0x0'));var rimraf=require(_0x9b8a('0x1'));var zipdir=require(_0x9b8a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b8a('0x3'));var moment=require(_0x9b8a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9b8a('0x5'));var util=require('util');var path=require(_0x9b8a('0x6'));var sox=require(_0x9b8a('0x7'));var csv=require(_0x9b8a('0x8'));var ejs=require(_0x9b8a('0x9'));var fs=require('fs');var fs_extra=require(_0x9b8a('0xa'));var _=require(_0x9b8a('0xb'));var squel=require(_0x9b8a('0xc'));var crypto=require(_0x9b8a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9b8a('0xe'));var toCsv=require(_0x9b8a('0x8'));var querystring=require('querystring');var Papa=require(_0x9b8a('0xf'));var Redis=require('ioredis');var authService=require(_0x9b8a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b8a('0x11'));var logger=require(_0x9b8a('0x12'))(_0x9b8a('0x13'));var utils=require('../../config/utils');var config=require(_0x9b8a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b8a('0x15'))['db'];function respondWithStatusCode(_0x3defc9,_0x34d648){_0x34d648=_0x34d648||0xcc;return function(_0x2c2bf3){if(_0x2c2bf3){return _0x3defc9[_0x9b8a('0x16')](_0x34d648);}return _0x3defc9[_0x9b8a('0x17')](_0x34d648)[_0x9b8a('0x18')]();};}function respondWithResult(_0x48d2d6,_0x3c5452){_0x3c5452=_0x3c5452||0xc8;return function(_0x2a4637){if(_0x2a4637){return _0x48d2d6['status'](_0x3c5452)[_0x9b8a('0x19')](_0x2a4637);}};}function respondWithFilteredResult(_0x39008b,_0x48725a){return function(_0xc4fc7d){if(_0xc4fc7d){var _0x44be33=typeof _0x48725a[_0x9b8a('0x1a')]===_0x9b8a('0x1b')&&typeof _0x48725a[_0x9b8a('0x1c')]===_0x9b8a('0x1b');var _0x318d89=_0xc4fc7d[_0x9b8a('0x1d')];var _0x522a05=_0x44be33?0x0:_0x48725a[_0x9b8a('0x1a')];var _0x5ce01c=_0x44be33?_0xc4fc7d['count']:_0x48725a[_0x9b8a('0x1a')]+_0x48725a[_0x9b8a('0x1c')];var _0x202cf1;if(_0x5ce01c>=_0x318d89){_0x5ce01c=_0x318d89;_0x202cf1=0xc8;}else{_0x202cf1=0xce;}_0x39008b[_0x9b8a('0x17')](_0x202cf1);return _0x39008b['set'](_0x9b8a('0x1e'),_0x522a05+'-'+_0x5ce01c+'/'+_0x318d89)[_0x9b8a('0x19')](_0xc4fc7d);}return null;};}function patchUpdates(_0x297e4c){return function(_0x276614){try{jsonpatch[_0x9b8a('0x1f')](_0x276614,_0x297e4c,!![]);}catch(_0x1d7d87){return BPromise[_0x9b8a('0x20')](_0x1d7d87);}return _0x276614[_0x9b8a('0x21')]();};}function saveUpdates(_0x5e7856,_0x59529e){return function(_0x2adfd4){if(_0x2adfd4){return _0x2adfd4['update'](_0x5e7856)[_0x9b8a('0x22')](function(_0xc3475c){return _0xc3475c;});}return null;};}function removeEntity(_0x352aa3,_0x2d4c9a){return function(_0xbd7f4a){if(_0xbd7f4a){return _0xbd7f4a[_0x9b8a('0x23')]()[_0x9b8a('0x22')](function(){_0x352aa3[_0x9b8a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bef2d,_0x386aff){return function(_0x3ced29){if(!_0x3ced29){_0x3bef2d['sendStatus'](0x194);}return _0x3ced29;};}function handleError(_0x153fc4,_0x2e941e){_0x2e941e=_0x2e941e||0x1f4;return function(_0x5139a9){logger[_0x9b8a('0x24')](_0x5139a9[_0x9b8a('0x25')]);if(_0x5139a9[_0x9b8a('0x26')]){delete _0x5139a9[_0x9b8a('0x26')];}_0x153fc4['status'](_0x2e941e)[_0x9b8a('0x27')](_0x5139a9);};}exports[_0x9b8a('0x28')]=function(_0x3e5ea0,_0xcd84d2){var _0x407286={},_0x2c72e8={},_0x1d4f2b={'count':0x0,'rows':[]};var _0x22037c=_[_0x9b8a('0x29')](db[_0x9b8a('0x2a')][_0x9b8a('0x2b')],function(_0x18a8cf){return{'name':_0x18a8cf[_0x9b8a('0x2c')],'type':_0x18a8cf[_0x9b8a('0x2d')][_0x9b8a('0x2e')]};});_0x2c72e8['model']=_['map'](_0x22037c,_0x9b8a('0x26'));_0x2c72e8[_0x9b8a('0x2f')]=_['keys'](_0x3e5ea0[_0x9b8a('0x2f')]);_0x2c72e8[_0x9b8a('0x30')]=_['intersection'](_0x2c72e8[_0x9b8a('0x31')],_0x2c72e8['query']);_0x407286[_0x9b8a('0x32')]=_[_0x9b8a('0x33')](_0x2c72e8['model'],qs[_0x9b8a('0x34')](_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x34')]));_0x407286[_0x9b8a('0x32')]=_0x407286[_0x9b8a('0x32')]['length']?_0x407286[_0x9b8a('0x32')]:_0x2c72e8[_0x9b8a('0x31')];if(!_0x3e5ea0['query'][_0x9b8a('0x35')]('nolimit')){_0x407286['limit']=qs[_0x9b8a('0x1c')](_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x1c')]);_0x407286[_0x9b8a('0x1a')]=qs[_0x9b8a('0x1a')](_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x1a')]);}_0x407286['order']=qs[_0x9b8a('0x36')](_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x36')]);_0x407286[_0x9b8a('0x37')]=qs[_0x9b8a('0x30')](_[_0x9b8a('0x38')](_0x3e5ea0['query'],_0x2c72e8[_0x9b8a('0x30')]),_0x22037c);if(_0x3e5ea0[_0x9b8a('0x2f')]['filter']){_0x407286[_0x9b8a('0x37')]=_['merge'](_0x407286['where'],{'$or':_[_0x9b8a('0x29')](_0x22037c,function(_0x156c12){if(_0x156c12[_0x9b8a('0x2d')]!==_0x9b8a('0x39')){var _0x265fc6={};_0x265fc6[_0x156c12[_0x9b8a('0x26')]]={'$like':'%'+_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x3a')]+'%'};return _0x265fc6;}})});}_0x407286=_[_0x9b8a('0x3b')]({},_0x407286,_0x3e5ea0[_0x9b8a('0x3c')]);var _0x281f9f={'where':_0x407286[_0x9b8a('0x37')]};return db[_0x9b8a('0x2a')][_0x9b8a('0x1d')](_0x281f9f)['then'](function(_0x2f2ff9){_0x1d4f2b[_0x9b8a('0x1d')]=_0x2f2ff9;if(_0x3e5ea0['query'][_0x9b8a('0x3d')]){_0x407286[_0x9b8a('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x9b8a('0x3f')](_0x407286);})[_0x9b8a('0x22')](function(_0x455f6f){_0x1d4f2b['rows']=_0x455f6f;return _0x1d4f2b;})[_0x9b8a('0x22')](respondWithFilteredResult(_0xcd84d2,_0x407286))[_0x9b8a('0x40')](handleError(_0xcd84d2,null));};exports[_0x9b8a('0x41')]=function(_0x5acb1e,_0xe687c8){var _0xbc71f3={'raw':!![],'where':{'id':_0x5acb1e['params']['id']}},_0xeff6bb={};_0xeff6bb[_0x9b8a('0x31')]=_[_0x9b8a('0x42')](db[_0x9b8a('0x2a')][_0x9b8a('0x2b')]);_0xeff6bb[_0x9b8a('0x2f')]=_[_0x9b8a('0x42')](_0x5acb1e[_0x9b8a('0x2f')]);_0xeff6bb['filters']=_[_0x9b8a('0x33')](_0xeff6bb[_0x9b8a('0x31')],_0xeff6bb['query']);_0xbc71f3['attributes']=_[_0x9b8a('0x33')](_0xeff6bb[_0x9b8a('0x31')],qs[_0x9b8a('0x34')](_0x5acb1e[_0x9b8a('0x2f')][_0x9b8a('0x34')]));_0xbc71f3[_0x9b8a('0x32')]=_0xbc71f3['attributes']['length']?_0xbc71f3[_0x9b8a('0x32')]:_0xeff6bb['model'];if(_0x5acb1e[_0x9b8a('0x2f')][_0x9b8a('0x3d')]){_0xbc71f3[_0x9b8a('0x3e')]=[{'all':!![]}];}_0xbc71f3=_[_0x9b8a('0x3b')]({},_0xbc71f3,_0x5acb1e['options']);return db['MailSubstatus'][_0x9b8a('0x43')](_0xbc71f3)[_0x9b8a('0x22')](handleEntityNotFound(_0xe687c8,null))[_0x9b8a('0x22')](respondWithResult(_0xe687c8,null))[_0x9b8a('0x40')](handleError(_0xe687c8,null));};exports[_0x9b8a('0x44')]=function(_0x53afec,_0x51b5ae){return db[_0x9b8a('0x2a')][_0x9b8a('0x44')](_0x53afec['body'],{})['then'](respondWithResult(_0x51b5ae,0xc9))['catch'](handleError(_0x51b5ae,null));};exports[_0x9b8a('0x45')]=function(_0x25aafe,_0x516b4e){if(_0x25aafe[_0x9b8a('0x46')]['id']){delete _0x25aafe['body']['id'];}return db['MailSubstatus'][_0x9b8a('0x43')]({'where':{'id':_0x25aafe[_0x9b8a('0x47')]['id']}})['then'](handleEntityNotFound(_0x516b4e,null))[_0x9b8a('0x22')](saveUpdates(_0x25aafe['body'],null))[_0x9b8a('0x22')](respondWithResult(_0x516b4e,null))['catch'](handleError(_0x516b4e,null));};exports[_0x9b8a('0x23')]=function(_0x5f4072,_0x1e6109){return db[_0x9b8a('0x2a')]['find']({'where':{'id':_0x5f4072[_0x9b8a('0x47')]['id']}})[_0x9b8a('0x22')](handleEntityNotFound(_0x1e6109,null))[_0x9b8a('0x22')](removeEntity(_0x1e6109,null))[_0x9b8a('0x40')](handleError(_0x1e6109,null));};exports['describe']=function(_0x130795,_0x3f1320){return db[_0x9b8a('0x2a')]['describe']()[_0x9b8a('0x22')](respondWithResult(_0x3f1320,null))['catch'](handleError(_0x3f1320,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 6860cda..445e25c 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 _0x4c8e=['hasOwnProperty','hook','events','MailSubstatus','setMaxListeners','emit'];(function(_0x5e9c85,_0x461674){var _0xcbdcf7=function(_0x2680d9){while(--_0x2680d9){_0x5e9c85['push'](_0x5e9c85['shift']());}};_0xcbdcf7(++_0x461674);}(_0x4c8e,0x140));var _0xe4c8=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0x4c8e[_0x20e7e3];return _0x14b9de;};'use strict';var EventEmitter=require(_0xe4c8('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xe4c8('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe4c8('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x2d2a29){return function(_0x50ba67,_0x41049f,_0x59f3ab){MailSubstatusEvents[_0xe4c8('0x3')](_0x2d2a29+':'+_0x50ba67['id'],_0x50ba67);MailSubstatusEvents['emit'](_0x2d2a29,_0x50ba67);_0x59f3ab(null);};}for(var e in events){if(events[_0xe4c8('0x4')](e)){var event=events[e];MailSubstatus[_0xe4c8('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xc8dd=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0xd46d27,_0x17f557){var _0x188099=function(_0x229c25){while(--_0x229c25){_0xd46d27['push'](_0xd46d27['shift']());}};_0x188099(++_0x17f557);}(_0xc8dd,0x1e3));var _0xdc8d=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0xc8dd[_0xe4d6c6];return _0x3a8935;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xdc8d('0x0'))['db'][_0xdc8d('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xdc8d('0x2')](0x0);var events={'afterUpdate':_0xdc8d('0x3')};function emitEvent(_0x85555f){return function(_0x3133b6,_0x27050b,_0x4a0b2f){MailSubstatusEvents[_0xdc8d('0x4')](_0x85555f+':'+_0x3133b6['id'],_0x3133b6);MailSubstatusEvents['emit'](_0x85555f,_0x3133b6);_0x4a0b2f(null);};}for(var e in events){if(events[_0xdc8d('0x5')](e)){var event=events[e];MailSubstatus[_0xdc8d('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 00ed996..52f67c4 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 _0xcdd9=['MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define'];(function(_0x796994,_0x4875af){var _0x34e23f=function(_0x580c91){while(--_0x580c91){_0x796994['push'](_0x796994['shift']());}};_0x34e23f(++_0x4875af);}(_0xcdd9,0x19c));var _0x9cdd=function(_0x10010f,_0x458f9b){_0x10010f=_0x10010f-0x0;var _0x49ced0=_0xcdd9[_0x10010f];return _0x49ced0;};'use strict';var attributes=require(_0x9cdd('0x0'));module[_0x9cdd('0x1')]=function(_0x2216dc){var _0xc7fc0d=_0x2216dc[_0x9cdd('0x2')];return _0x2216dc[_0x9cdd('0x3')](_0x9cdd('0x4'),attributes,{'tableName':_0x9cdd('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5bef4e,_0x523a6d,_0x4c9b18){return _0xc7fc0d[_0x9cdd('0x6')][_0x9cdd('0x7')]({'value':_0x5bef4e[_0x9cdd('0x8')]},{'where':{'field':_0x9cdd('0x9'),'value':_0x5bef4e[_0x9cdd('0xa')][_0x9cdd('0x8')]}})[_0x9cdd('0xb')](function(){_0x4c9b18();})[_0x9cdd('0xc')](function(_0x1ecdd3){_0x4c9b18(_0x1ecdd3);});}}});}; \ No newline at end of file +var _0x9190=['Condition','update','name','mailSubstatus','./mailSubstatus.attributes','MailSubstatus','mail_substatuses'];(function(_0x34cc27,_0x124f42){var _0xfdbd4f=function(_0xd44b7f){while(--_0xd44b7f){_0x34cc27['push'](_0x34cc27['shift']());}};_0xfdbd4f(++_0x124f42);}(_0x9190,0x11c));var _0x0919=function(_0x195c5f,_0x5eafd8){_0x195c5f=_0x195c5f-0x0;var _0x4b5fc3=_0x9190[_0x195c5f];return _0x4b5fc3;};'use strict';var attributes=require(_0x0919('0x0'));module['exports']=function(_0x5e6946){var _0x5174a6=_0x5e6946['models'];return _0x5e6946['define'](_0x0919('0x1'),attributes,{'tableName':_0x0919('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2464f1,_0xa2af6c,_0x2188ba){return _0x5174a6[_0x0919('0x3')][_0x0919('0x4')]({'value':_0x2464f1[_0x0919('0x5')]},{'where':{'field':_0x0919('0x6'),'value':_0x2464f1['_previousDataValues'][_0x0919('0x5')]}})['then'](function(){_0x2188ba();})['catch'](function(_0x2c16cf){_0x2188ba(_0x2c16cf);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 8af87b6..b63b169 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 _0x4b6b=['result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4b6b,0x1b2));var _0xb4b6=function(_0x5ea905,_0x4c32ec){_0x5ea905=_0x5ea905-0x0;var _0x4a7b41=_0x4b6b[_0x5ea905];return _0x4a7b41;};'use strict';var _=require('lodash');var util=require(_0xb4b6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb4b6('0x1'));var fs=require('fs');var Redis=require(_0xb4b6('0x2'));var db=require(_0xb4b6('0x3'))['db'];var utils=require(_0xb4b6('0x4'));var logger=require('../../config/logger')(_0xb4b6('0x5'));var config=require('../../config/environment');var jayson=require(_0xb4b6('0x6'));var client=jayson[_0xb4b6('0x7')][_0xb4b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c5b7c,_0x3d562b,_0x48b0de){return new BPromise(function(_0x477cb8,_0x6aac6b){return client['request'](_0x4c5b7c,_0x48b0de)[_0xb4b6('0x9')](function(_0x268f40){logger['info'](_0xb4b6('0xa'),_0x3d562b,'request\x20sent');logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x3d562b,_0xb4b6('0xb'),JSON[_0xb4b6('0xc')](_0x268f40));if(_0x268f40['error']){if(_0x268f40[_0xb4b6('0xd')]['code']===0x1f4){logger[_0xb4b6('0xd')](_0xb4b6('0xa'),_0x3d562b,_0x268f40[_0xb4b6('0xd')][_0xb4b6('0xe')]);return _0x6aac6b(_0x268f40['error'][_0xb4b6('0xe')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x3d562b,_0x268f40[_0xb4b6('0xd')][_0xb4b6('0xe')]);return _0x477cb8(_0x268f40[_0xb4b6('0xd')][_0xb4b6('0xe')]);}else{logger[_0xb4b6('0xf')](_0xb4b6('0xa'),_0x3d562b,'request\x20sent');_0x477cb8(_0x268f40[_0xb4b6('0x10')][_0xb4b6('0xe')]);}})[_0xb4b6('0x11')](function(_0x479990){logger[_0xb4b6('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x3d562b,_0x479990);_0x6aac6b(_0x479990);});});} \ No newline at end of file +var _0xb312=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x1a074e,_0x33b8d0){var _0x3c0caf=function(_0xce9a5d){while(--_0xce9a5d){_0x1a074e['push'](_0x1a074e['shift']());}};_0x3c0caf(++_0x33b8d0);}(_0xb312,0x132));var _0x2b31=function(_0xf338ce,_0x1b00c5){_0xf338ce=_0xf338ce-0x0;var _0x29591f=_0xb312[_0xf338ce];return _0x29591f;};'use strict';var _=require(_0x2b31('0x0'));var util=require(_0x2b31('0x1'));var moment=require(_0x2b31('0x2'));var BPromise=require(_0x2b31('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b31('0x4'));var db=require(_0x2b31('0x5'))['db'];var utils=require(_0x2b31('0x6'));var logger=require(_0x2b31('0x7'))(_0x2b31('0x8'));var config=require(_0x2b31('0x9'));var jayson=require(_0x2b31('0xa'));var client=jayson[_0x2b31('0xb')][_0x2b31('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36afe7,_0x5c8c28,_0x8e8d1c){return new BPromise(function(_0x3a58b1,_0x466ea6){return client[_0x2b31('0xd')](_0x36afe7,_0x8e8d1c)['then'](function(_0x456268){logger[_0x2b31('0xe')](_0x2b31('0xf'),_0x5c8c28,'request\x20sent');logger[_0x2b31('0x10')](_0x2b31('0x11'),_0x5c8c28,'request\x20sent',JSON['stringify'](_0x456268));if(_0x456268[_0x2b31('0x12')]){if(_0x456268[_0x2b31('0x12')][_0x2b31('0x13')]===0x1f4){logger[_0x2b31('0x12')](_0x2b31('0xf'),_0x5c8c28,_0x456268['error'][_0x2b31('0x14')]);return _0x466ea6(_0x456268[_0x2b31('0x12')][_0x2b31('0x14')]);}logger[_0x2b31('0x12')](_0x2b31('0xf'),_0x5c8c28,_0x456268[_0x2b31('0x12')][_0x2b31('0x14')]);return _0x3a58b1(_0x456268[_0x2b31('0x12')]['message']);}else{logger['info'](_0x2b31('0xf'),_0x5c8c28,_0x2b31('0x15'));_0x3a58b1(_0x456268[_0x2b31('0x16')][_0x2b31('0x14')]);}})['catch'](function(_0x1208bd){logger['error'](_0x2b31('0xf'),_0x5c8c28,_0x1208bd);_0x466ea6(_0x1208bd);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0111aad..fe974cc 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 _0x459b=['connect-timeout','express','Router','fs-extra','isAuthenticated','get','/describe','describe','post','put','/:id','update','delete','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x459b,0x10d));var _0xb459=function(_0x96db86,_0x4cb91e){_0x96db86=_0x96db86-0x0;var _0x3b223b=_0x459b[_0x96db86];return _0x3b223b;};'use strict';var multer=require(_0xb459('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb459('0x1'));var express=require(_0xb459('0x2'));var router=express[_0xb459('0x3')]();var fs_extra=require(_0xb459('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xb459('0x5')](),controller['index']);router[_0xb459('0x6')](_0xb459('0x7'),auth[_0xb459('0x5')](),controller[_0xb459('0x8')]);router['get']('/:id',auth[_0xb459('0x5')](),controller['show']);router[_0xb459('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb459('0xa')](_0xb459('0xb'),auth['isAuthenticated'](),controller[_0xb459('0xc')]);router[_0xb459('0xd')](_0xb459('0xb'),auth[_0xb459('0x5')](),controller['destroy']);module[_0xb459('0xe')]=router; \ No newline at end of file +var _0x6018=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','isAuthenticated','describe','get','/:id','post'];(function(_0x27e83c,_0xe6fa23){var _0x20464c=function(_0x46b8ce){while(--_0x46b8ce){_0x27e83c['push'](_0x27e83c['shift']());}};_0x20464c(++_0xe6fa23);}(_0x6018,0x18d));var _0x8601=function(_0x1e46cf,_0x3be66f){_0x1e46cf=_0x1e46cf-0x0;var _0x212f5b=_0x6018[_0x1e46cf];return _0x212f5b;};'use strict';var multer=require(_0x8601('0x0'));var util=require(_0x8601('0x1'));var path=require(_0x8601('0x2'));var timeout=require(_0x8601('0x3'));var express=require(_0x8601('0x4'));var router=express[_0x8601('0x5')]();var fs_extra=require(_0x8601('0x6'));var auth=require(_0x8601('0x7'));var interaction=require(_0x8601('0x8'));var config=require(_0x8601('0x9'));var controller=require(_0x8601('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x8601('0xb')]);router['get']('/describe',auth[_0x8601('0xc')](),controller[_0x8601('0xd')]);router[_0x8601('0xe')](_0x8601('0xf'),auth[_0x8601('0xc')](),controller['show']);router[_0x8601('0x10')]('/',auth[_0x8601('0xc')](),controller[_0x8601('0x11')]);router[_0x8601('0x12')](_0x8601('0xf'),auth[_0x8601('0xc')](),controller[_0x8601('0x13')]);router[_0x8601('0x14')](_0x8601('0xf'),auth['isAuthenticated'](),controller[_0x8601('0x15')]);module[_0x8601('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index b6bca32..5f8595b 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xb43b,0x1b2));var _0xbb43=function(_0x53c91b,_0xdd8a5){_0x53c91b=_0x53c91b-0x0;var _0x2ea89d=_0xb43b[_0x53c91b];return _0x2ea89d;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x463d63,_0xa69c74){var _0x5736c5=function(_0x1d80b9){while(--_0x1d80b9){_0x463d63['push'](_0x463d63['shift']());}};_0x5736c5(++_0xa69c74);}(_0xaa88,0x137));var _0x8aa8=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xaa88[_0x499210];return _0x2e153d;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 286b6ee..144c57c 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 _0xe325=['reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','MailTransferReport','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','json','offset','undefined','limit','count','set','apply'];(function(_0x40b040,_0x47a284){var _0x2cffe1=function(_0x2207c1){while(--_0x2207c1){_0x40b040['push'](_0x40b040['shift']());}};_0x2cffe1(++_0x47a284);}(_0xe325,0x110));var _0x5e32=function(_0x211576,_0xcc41af){_0x211576=_0x211576-0x0;var _0x3ce235=_0xe325[_0x211576];return _0x3ce235;};'use strict';var emlformat=require(_0x5e32('0x0'));var rimraf=require(_0x5e32('0x1'));var zipdir=require(_0x5e32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e32('0x3'));var BPromise=require(_0x5e32('0x4'));var Mustache=require(_0x5e32('0x5'));var util=require(_0x5e32('0x6'));var path=require(_0x5e32('0x7'));var sox=require(_0x5e32('0x8'));var csv=require(_0x5e32('0x9'));var ejs=require(_0x5e32('0xa'));var fs=require('fs');var fs_extra=require(_0x5e32('0xb'));var _=require(_0x5e32('0xc'));var squel=require('squel');var crypto=require(_0x5e32('0xd'));var jsforce=require(_0x5e32('0xe'));var deskjs=require(_0x5e32('0xf'));var toCsv=require(_0x5e32('0x9'));var querystring=require('querystring');var Papa=require(_0x5e32('0x10'));var Redis=require(_0x5e32('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5e32('0x12'));var as=require(_0x5e32('0x13'));var hardwareService=require(_0x5e32('0x14'));var logger=require(_0x5e32('0x15'))(_0x5e32('0x16'));var utils=require(_0x5e32('0x17'));var config=require(_0x5e32('0x18'));var licenseUtil=require(_0x5e32('0x19'));var db=require(_0x5e32('0x1a'))['db'];function respondWithStatusCode(_0x5b22dc,_0x1bb764){_0x1bb764=_0x1bb764||0xcc;return function(_0x3eea1f){if(_0x3eea1f){return _0x5b22dc[_0x5e32('0x1b')](_0x1bb764);}return _0x5b22dc[_0x5e32('0x1c')](_0x1bb764)['end']();};}function respondWithResult(_0x7de6f2,_0x14bd9d){_0x14bd9d=_0x14bd9d||0xc8;return function(_0xb355c9){if(_0xb355c9){return _0x7de6f2['status'](_0x14bd9d)[_0x5e32('0x1d')](_0xb355c9);}};}function respondWithFilteredResult(_0x5b4c46,_0x530607){return function(_0x593f70){if(_0x593f70){var _0x345276=typeof _0x530607[_0x5e32('0x1e')]===_0x5e32('0x1f')&&typeof _0x530607[_0x5e32('0x20')]===_0x5e32('0x1f');var _0x1da646=_0x593f70['count'];var _0x384c9a=_0x345276?0x0:_0x530607[_0x5e32('0x1e')];var _0x565b5e=_0x345276?_0x593f70[_0x5e32('0x21')]:_0x530607[_0x5e32('0x1e')]+_0x530607[_0x5e32('0x20')];var _0xd546e2;if(_0x565b5e>=_0x1da646){_0x565b5e=_0x1da646;_0xd546e2=0xc8;}else{_0xd546e2=0xce;}_0x5b4c46[_0x5e32('0x1c')](_0xd546e2);return _0x5b4c46[_0x5e32('0x22')]('Content-Range',_0x384c9a+'-'+_0x565b5e+'/'+_0x1da646)[_0x5e32('0x1d')](_0x593f70);}return null;};}function patchUpdates(_0x1bf7e8){return function(_0x568432){try{jsonpatch[_0x5e32('0x23')](_0x568432,_0x1bf7e8,!![]);}catch(_0x50c118){return BPromise[_0x5e32('0x24')](_0x50c118);}return _0x568432[_0x5e32('0x25')]();};}function saveUpdates(_0xc3f50e,_0x4e67cd){return function(_0x1187a7){if(_0x1187a7){return _0x1187a7[_0x5e32('0x26')](_0xc3f50e)[_0x5e32('0x27')](function(_0xeff5ee){return _0xeff5ee;});}return null;};}function removeEntity(_0x544896,_0x3ea565){return function(_0x5923a8){if(_0x5923a8){return _0x5923a8[_0x5e32('0x28')]()['then'](function(){_0x544896[_0x5e32('0x1c')](0xcc)[_0x5e32('0x29')]();});}};}function handleEntityNotFound(_0xafe68c,_0x45e49b){return function(_0x19f16c){if(!_0x19f16c){_0xafe68c[_0x5e32('0x1b')](0x194);}return _0x19f16c;};}function handleError(_0x23813d,_0x1890cb){_0x1890cb=_0x1890cb||0x1f4;return function(_0x5ae6cf){logger[_0x5e32('0x2a')](_0x5ae6cf[_0x5e32('0x2b')]);if(_0x5ae6cf['name']){delete _0x5ae6cf[_0x5e32('0x2c')];}_0x23813d[_0x5e32('0x1c')](_0x1890cb)['send'](_0x5ae6cf);};}exports[_0x5e32('0x2d')]=function(_0x3c03b2,_0x541399){var _0x1d7d01={},_0x522826={},_0x3f32ac={'count':0x0,'rows':[]};var _0x28e058=_[_0x5e32('0x2e')](db['MailTransferReport'][_0x5e32('0x2f')],function(_0x5880c6){return{'name':_0x5880c6[_0x5e32('0x30')],'type':_0x5880c6[_0x5e32('0x31')]['key']};});_0x522826[_0x5e32('0x32')]=_[_0x5e32('0x2e')](_0x28e058,'name');_0x522826[_0x5e32('0x33')]=_[_0x5e32('0x34')](_0x3c03b2['query']);_0x522826['filters']=_[_0x5e32('0x35')](_0x522826[_0x5e32('0x32')],_0x522826[_0x5e32('0x33')]);_0x1d7d01[_0x5e32('0x36')]=_[_0x5e32('0x35')](_0x522826['model'],qs[_0x5e32('0x37')](_0x3c03b2['query'][_0x5e32('0x37')]));_0x1d7d01[_0x5e32('0x36')]=_0x1d7d01[_0x5e32('0x36')][_0x5e32('0x38')]?_0x1d7d01[_0x5e32('0x36')]:_0x522826[_0x5e32('0x32')];if(!_0x3c03b2[_0x5e32('0x33')][_0x5e32('0x39')](_0x5e32('0x3a'))){_0x1d7d01[_0x5e32('0x20')]=qs[_0x5e32('0x20')](_0x3c03b2[_0x5e32('0x33')][_0x5e32('0x20')]);_0x1d7d01[_0x5e32('0x1e')]=qs[_0x5e32('0x1e')](_0x3c03b2[_0x5e32('0x33')][_0x5e32('0x1e')]);}_0x1d7d01[_0x5e32('0x3b')]=qs['sort'](_0x3c03b2[_0x5e32('0x33')][_0x5e32('0x3c')]);_0x1d7d01[_0x5e32('0x3d')]=qs[_0x5e32('0x3e')](_[_0x5e32('0x3f')](_0x3c03b2[_0x5e32('0x33')],_0x522826['filters']),_0x28e058);if(_0x3c03b2[_0x5e32('0x33')]['filter']){_0x1d7d01[_0x5e32('0x3d')]=_[_0x5e32('0x40')](_0x1d7d01[_0x5e32('0x3d')],{'$or':_[_0x5e32('0x2e')](_0x28e058,function(_0x238e12){if(_0x238e12['type']!==_0x5e32('0x41')){var _0x2d982f={};_0x2d982f[_0x238e12[_0x5e32('0x2c')]]={'$like':'%'+_0x3c03b2[_0x5e32('0x33')]['filter']+'%'};return _0x2d982f;}})});}_0x1d7d01=_['merge']({},_0x1d7d01,_0x3c03b2[_0x5e32('0x42')]);var _0x2d990c={'where':_0x1d7d01[_0x5e32('0x3d')]};return db[_0x5e32('0x43')][_0x5e32('0x21')](_0x2d990c)[_0x5e32('0x27')](function(_0xa9e9d3){_0x3f32ac['count']=_0xa9e9d3;if(_0x3c03b2['query'][_0x5e32('0x44')]){_0x1d7d01[_0x5e32('0x45')]=[{'all':!![]}];}return db[_0x5e32('0x43')]['findAll'](_0x1d7d01);})[_0x5e32('0x27')](function(_0xd731fb){_0x3f32ac[_0x5e32('0x46')]=_0xd731fb;return _0x3f32ac;})['then'](respondWithFilteredResult(_0x541399,_0x1d7d01))[_0x5e32('0x47')](handleError(_0x541399,null));};exports['show']=function(_0x43e6e3,_0x9708b8){var _0x2e7907={'raw':!![],'where':{'id':_0x43e6e3[_0x5e32('0x48')]['id']}},_0x42362e={};_0x42362e[_0x5e32('0x32')]=_['keys'](db[_0x5e32('0x43')]['rawAttributes']);_0x42362e[_0x5e32('0x33')]=_[_0x5e32('0x34')](_0x43e6e3[_0x5e32('0x33')]);_0x42362e[_0x5e32('0x3e')]=_[_0x5e32('0x35')](_0x42362e['model'],_0x42362e[_0x5e32('0x33')]);_0x2e7907[_0x5e32('0x36')]=_[_0x5e32('0x35')](_0x42362e[_0x5e32('0x32')],qs[_0x5e32('0x37')](_0x43e6e3[_0x5e32('0x33')][_0x5e32('0x37')]));_0x2e7907[_0x5e32('0x36')]=_0x2e7907[_0x5e32('0x36')][_0x5e32('0x38')]?_0x2e7907[_0x5e32('0x36')]:_0x42362e['model'];if(_0x43e6e3[_0x5e32('0x33')][_0x5e32('0x44')]){_0x2e7907[_0x5e32('0x45')]=[{'all':!![]}];}_0x2e7907=_[_0x5e32('0x40')]({},_0x2e7907,_0x43e6e3[_0x5e32('0x42')]);return db[_0x5e32('0x43')][_0x5e32('0x49')](_0x2e7907)[_0x5e32('0x27')](handleEntityNotFound(_0x9708b8,null))['then'](respondWithResult(_0x9708b8,null))['catch'](handleError(_0x9708b8,null));};exports[_0x5e32('0x4a')]=function(_0x35476a,_0x305a37){return db['MailTransferReport'][_0x5e32('0x4a')](_0x35476a[_0x5e32('0x4b')],{})[_0x5e32('0x27')](respondWithResult(_0x305a37,0xc9))[_0x5e32('0x47')](handleError(_0x305a37,null));};exports[_0x5e32('0x26')]=function(_0x5cf657,_0xfe4f6){if(_0x5cf657[_0x5e32('0x4b')]['id']){delete _0x5cf657[_0x5e32('0x4b')]['id'];}return db[_0x5e32('0x43')]['find']({'where':{'id':_0x5cf657[_0x5e32('0x48')]['id']}})[_0x5e32('0x27')](handleEntityNotFound(_0xfe4f6,null))[_0x5e32('0x27')](saveUpdates(_0x5cf657[_0x5e32('0x4b')],null))[_0x5e32('0x27')](respondWithResult(_0xfe4f6,null))[_0x5e32('0x47')](handleError(_0xfe4f6,null));};exports[_0x5e32('0x28')]=function(_0xb0de3c,_0x45fdea){return db[_0x5e32('0x43')][_0x5e32('0x49')]({'where':{'id':_0xb0de3c['params']['id']}})[_0x5e32('0x27')](handleEntityNotFound(_0x45fdea,null))[_0x5e32('0x27')](removeEntity(_0x45fdea,null))[_0x5e32('0x47')](handleError(_0x45fdea,null));};exports[_0x5e32('0x4c')]=function(_0x21fdca,_0x3cf4f1){return db[_0x5e32('0x43')][_0x5e32('0x4c')]()[_0x5e32('0x27')](respondWithResult(_0x3cf4f1,null))['catch'](handleError(_0x3cf4f1,null));}; \ No newline at end of file +var _0xd90c=['moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','MailTransferReport','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xd90c,0x1e1));var _0xcd90=function(_0x11c4b6,_0x572fdb){_0x11c4b6=_0x11c4b6-0x0;var _0x2cb405=_0xd90c[_0x11c4b6];return _0x2cb405;};'use strict';var emlformat=require(_0xcd90('0x0'));var rimraf=require(_0xcd90('0x1'));var zipdir=require(_0xcd90('0x2'));var jsonpatch=require(_0xcd90('0x3'));var rp=require(_0xcd90('0x4'));var moment=require(_0xcd90('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcd90('0x6'));var util=require(_0xcd90('0x7'));var path=require(_0xcd90('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd90('0x9'));var fs=require('fs');var fs_extra=require(_0xcd90('0xa'));var _=require(_0xcd90('0xb'));var squel=require(_0xcd90('0xc'));var crypto=require(_0xcd90('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcd90('0xe'));var toCsv=require(_0xcd90('0xf'));var querystring=require('querystring');var Papa=require(_0xcd90('0x10'));var Redis=require(_0xcd90('0x11'));var authService=require(_0xcd90('0x12'));var qs=require(_0xcd90('0x13'));var as=require(_0xcd90('0x14'));var hardwareService=require(_0xcd90('0x15'));var logger=require(_0xcd90('0x16'))(_0xcd90('0x17'));var utils=require(_0xcd90('0x18'));var config=require(_0xcd90('0x19'));var licenseUtil=require(_0xcd90('0x1a'));var db=require(_0xcd90('0x1b'))['db'];function respondWithStatusCode(_0x14561b,_0x16e13f){_0x16e13f=_0x16e13f||0xcc;return function(_0x3cfae4){if(_0x3cfae4){return _0x14561b[_0xcd90('0x1c')](_0x16e13f);}return _0x14561b['status'](_0x16e13f)['end']();};}function respondWithResult(_0x43a741,_0x384704){_0x384704=_0x384704||0xc8;return function(_0x144c51){if(_0x144c51){return _0x43a741[_0xcd90('0x1d')](_0x384704)[_0xcd90('0x1e')](_0x144c51);}};}function respondWithFilteredResult(_0x5df443,_0x334544){return function(_0x5743fa){if(_0x5743fa){var _0x56380a=typeof _0x334544['offset']===_0xcd90('0x1f')&&typeof _0x334544['limit']==='undefined';var _0x4fdbc7=_0x5743fa[_0xcd90('0x20')];var _0x10aaa5=_0x56380a?0x0:_0x334544[_0xcd90('0x21')];var _0x51ca51=_0x56380a?_0x5743fa[_0xcd90('0x20')]:_0x334544[_0xcd90('0x21')]+_0x334544[_0xcd90('0x22')];var _0x240816;if(_0x51ca51>=_0x4fdbc7){_0x51ca51=_0x4fdbc7;_0x240816=0xc8;}else{_0x240816=0xce;}_0x5df443[_0xcd90('0x1d')](_0x240816);return _0x5df443[_0xcd90('0x23')](_0xcd90('0x24'),_0x10aaa5+'-'+_0x51ca51+'/'+_0x4fdbc7)[_0xcd90('0x1e')](_0x5743fa);}return null;};}function patchUpdates(_0x55a4f5){return function(_0x50174b){try{jsonpatch[_0xcd90('0x25')](_0x50174b,_0x55a4f5,!![]);}catch(_0xd0243d){return BPromise[_0xcd90('0x26')](_0xd0243d);}return _0x50174b[_0xcd90('0x27')]();};}function saveUpdates(_0x2d3a7f,_0x39e1ab){return function(_0x21d0fd){if(_0x21d0fd){return _0x21d0fd[_0xcd90('0x28')](_0x2d3a7f)[_0xcd90('0x29')](function(_0x295a87){return _0x295a87;});}return null;};}function removeEntity(_0x2544df,_0x1739a3){return function(_0x5652b1){if(_0x5652b1){return _0x5652b1[_0xcd90('0x2a')]()[_0xcd90('0x29')](function(){_0x2544df['status'](0xcc)[_0xcd90('0x2b')]();});}};}function handleEntityNotFound(_0x114bfe,_0x521bba){return function(_0x5c0f38){if(!_0x5c0f38){_0x114bfe[_0xcd90('0x1c')](0x194);}return _0x5c0f38;};}function handleError(_0x2972b6,_0x1477d3){_0x1477d3=_0x1477d3||0x1f4;return function(_0x39a5a1){logger[_0xcd90('0x2c')](_0x39a5a1[_0xcd90('0x2d')]);if(_0x39a5a1[_0xcd90('0x2e')]){delete _0x39a5a1[_0xcd90('0x2e')];}_0x2972b6['status'](_0x1477d3)[_0xcd90('0x2f')](_0x39a5a1);};}exports[_0xcd90('0x30')]=function(_0xeedad3,_0xbfdbfe){var _0x5d038a={},_0x57d320={},_0x264ab0={'count':0x0,'rows':[]};var _0x1573f8=_['map'](db[_0xcd90('0x31')][_0xcd90('0x32')],function(_0x2982b2){return{'name':_0x2982b2['fieldName'],'type':_0x2982b2[_0xcd90('0x33')][_0xcd90('0x34')]};});_0x57d320[_0xcd90('0x35')]=_[_0xcd90('0x36')](_0x1573f8,_0xcd90('0x2e'));_0x57d320[_0xcd90('0x37')]=_[_0xcd90('0x38')](_0xeedad3[_0xcd90('0x37')]);_0x57d320['filters']=_['intersection'](_0x57d320[_0xcd90('0x35')],_0x57d320[_0xcd90('0x37')]);_0x5d038a[_0xcd90('0x39')]=_[_0xcd90('0x3a')](_0x57d320[_0xcd90('0x35')],qs[_0xcd90('0x3b')](_0xeedad3[_0xcd90('0x37')]['fields']));_0x5d038a[_0xcd90('0x39')]=_0x5d038a[_0xcd90('0x39')][_0xcd90('0x3c')]?_0x5d038a['attributes']:_0x57d320['model'];if(!_0xeedad3['query'][_0xcd90('0x3d')]('nolimit')){_0x5d038a[_0xcd90('0x22')]=qs[_0xcd90('0x22')](_0xeedad3[_0xcd90('0x37')][_0xcd90('0x22')]);_0x5d038a['offset']=qs[_0xcd90('0x21')](_0xeedad3[_0xcd90('0x37')]['offset']);}_0x5d038a[_0xcd90('0x3e')]=qs[_0xcd90('0x3f')](_0xeedad3[_0xcd90('0x37')]['sort']);_0x5d038a[_0xcd90('0x40')]=qs[_0xcd90('0x41')](_[_0xcd90('0x42')](_0xeedad3['query'],_0x57d320[_0xcd90('0x41')]),_0x1573f8);if(_0xeedad3[_0xcd90('0x37')]['filter']){_0x5d038a[_0xcd90('0x40')]=_[_0xcd90('0x43')](_0x5d038a[_0xcd90('0x40')],{'$or':_[_0xcd90('0x36')](_0x1573f8,function(_0x5cf537){if(_0x5cf537[_0xcd90('0x33')]!==_0xcd90('0x44')){var _0x41b063={};_0x41b063[_0x5cf537[_0xcd90('0x2e')]]={'$like':'%'+_0xeedad3[_0xcd90('0x37')]['filter']+'%'};return _0x41b063;}})});}_0x5d038a=_[_0xcd90('0x43')]({},_0x5d038a,_0xeedad3[_0xcd90('0x45')]);var _0x51808a={'where':_0x5d038a[_0xcd90('0x40')]};return db['MailTransferReport'][_0xcd90('0x20')](_0x51808a)[_0xcd90('0x29')](function(_0x4c2a48){_0x264ab0['count']=_0x4c2a48;if(_0xeedad3[_0xcd90('0x37')][_0xcd90('0x46')]){_0x5d038a[_0xcd90('0x47')]=[{'all':!![]}];}return db[_0xcd90('0x31')][_0xcd90('0x48')](_0x5d038a);})[_0xcd90('0x29')](function(_0x598552){_0x264ab0[_0xcd90('0x49')]=_0x598552;return _0x264ab0;})[_0xcd90('0x29')](respondWithFilteredResult(_0xbfdbfe,_0x5d038a))['catch'](handleError(_0xbfdbfe,null));};exports[_0xcd90('0x4a')]=function(_0x52a5c7,_0x5ae021){var _0x125308={'raw':!![],'where':{'id':_0x52a5c7['params']['id']}},_0x439c06={};_0x439c06[_0xcd90('0x35')]=_[_0xcd90('0x38')](db[_0xcd90('0x31')][_0xcd90('0x32')]);_0x439c06[_0xcd90('0x37')]=_['keys'](_0x52a5c7[_0xcd90('0x37')]);_0x439c06['filters']=_[_0xcd90('0x3a')](_0x439c06[_0xcd90('0x35')],_0x439c06[_0xcd90('0x37')]);_0x125308[_0xcd90('0x39')]=_['intersection'](_0x439c06[_0xcd90('0x35')],qs[_0xcd90('0x3b')](_0x52a5c7[_0xcd90('0x37')][_0xcd90('0x3b')]));_0x125308[_0xcd90('0x39')]=_0x125308[_0xcd90('0x39')][_0xcd90('0x3c')]?_0x125308[_0xcd90('0x39')]:_0x439c06[_0xcd90('0x35')];if(_0x52a5c7[_0xcd90('0x37')][_0xcd90('0x46')]){_0x125308[_0xcd90('0x47')]=[{'all':!![]}];}_0x125308=_[_0xcd90('0x43')]({},_0x125308,_0x52a5c7[_0xcd90('0x45')]);return db[_0xcd90('0x31')][_0xcd90('0x4b')](_0x125308)['then'](handleEntityNotFound(_0x5ae021,null))[_0xcd90('0x29')](respondWithResult(_0x5ae021,null))['catch'](handleError(_0x5ae021,null));};exports[_0xcd90('0x4c')]=function(_0x41d124,_0x1b87f8){return db[_0xcd90('0x31')][_0xcd90('0x4c')](_0x41d124[_0xcd90('0x4d')],{})['then'](respondWithResult(_0x1b87f8,0xc9))['catch'](handleError(_0x1b87f8,null));};exports[_0xcd90('0x28')]=function(_0x14cac0,_0x2c287c){if(_0x14cac0[_0xcd90('0x4d')]['id']){delete _0x14cac0['body']['id'];}return db[_0xcd90('0x31')][_0xcd90('0x4b')]({'where':{'id':_0x14cac0['params']['id']}})['then'](handleEntityNotFound(_0x2c287c,null))[_0xcd90('0x29')](saveUpdates(_0x14cac0[_0xcd90('0x4d')],null))['then'](respondWithResult(_0x2c287c,null))[_0xcd90('0x4e')](handleError(_0x2c287c,null));};exports[_0xcd90('0x2a')]=function(_0x482472,_0x4da692){return db[_0xcd90('0x31')][_0xcd90('0x4b')]({'where':{'id':_0x482472[_0xcd90('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4da692,null))['then'](removeEntity(_0x4da692,null))[_0xcd90('0x4e')](handleError(_0x4da692,null));};exports['describe']=function(_0x36b64e,_0x2bec2f){return db[_0xcd90('0x31')][_0xcd90('0x50')]()['then'](respondWithResult(_0x2bec2f,null))[_0xcd90('0x4e')](handleError(_0x2bec2f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 6422c7a..9818188 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 _0xe0c3=['bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var logger=require(_0x3e0c('0x1'))(_0x3e0c('0x2'));var moment=require(_0x3e0c('0x3'));var BPromise=require(_0x3e0c('0x4'));var rp=require(_0x3e0c('0x5'));var fs=require('fs');var path=require(_0x3e0c('0x6'));var rimraf=require(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var attributes=require(_0x3e0c('0x9'));module['exports']=function(_0x530ebf,_0x163adf){return _0x530ebf[_0x3e0c('0xa')](_0x3e0c('0xb'),attributes,{'tableName':_0x3e0c('0xc'),'paranoid':![],'indexes':[{'name':_0x3e0c('0xd'),'fields':[_0x3e0c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c46=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbdd0a3,_0x5aec74){var _0x58f89a=function(_0xa13f71){while(--_0xa13f71){_0xbdd0a3['push'](_0xbdd0a3['shift']());}};_0x58f89a(++_0x5aec74);}(_0x2c46,0x6f));var _0x62c4=function(_0x873500,_0x3f8480){_0x873500=_0x873500-0x0;var _0x5eedcb=_0x2c46[_0x873500];return _0x5eedcb;};'use strict';var _=require('lodash');var util=require(_0x62c4('0x0'));var logger=require(_0x62c4('0x1'))(_0x62c4('0x2'));var moment=require(_0x62c4('0x3'));var BPromise=require(_0x62c4('0x4'));var rp=require(_0x62c4('0x5'));var fs=require('fs');var path=require(_0x62c4('0x6'));var rimraf=require(_0x62c4('0x7'));var config=require(_0x62c4('0x8'));var attributes=require(_0x62c4('0x9'));module[_0x62c4('0xa')]=function(_0x400057,_0x2a719e){return _0x400057[_0x62c4('0xb')](_0x62c4('0xc'),attributes,{'tableName':_0x62c4('0xd'),'paranoid':![],'indexes':[{'name':_0x62c4('0xe'),'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 b7c323e..5239799 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 _0x0c5e=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0c5e,0x1be));var _0xe0c5=function(_0x2ab350,_0x32859f){_0x2ab350=_0x2ab350-0x0;var _0x4acac=_0x0c5e[_0x2ab350];return _0x4acac;};'use strict';var _=require(_0xe0c5('0x0'));var util=require(_0xe0c5('0x1'));var moment=require('moment');var BPromise=require(_0xe0c5('0x2'));var rs=require(_0xe0c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0c5('0x4'))['db'];var utils=require(_0xe0c5('0x5'));var logger=require(_0xe0c5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe0c5('0x7'));var client=jayson['client'][_0xe0c5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2270b3,_0x261e49,_0x19aa86){return new BPromise(function(_0x363cb4,_0x4bd34f){return client[_0xe0c5('0x9')](_0x2270b3,_0x19aa86)['then'](function(_0x989915){logger['info'](_0xe0c5('0xa'),_0x261e49,_0xe0c5('0xb'));logger[_0xe0c5('0xc')](_0xe0c5('0xd'),_0x261e49,'request\x20sent',JSON['stringify'](_0x989915));if(_0x989915[_0xe0c5('0xe')]){if(_0x989915['error'][_0xe0c5('0xf')]===0x1f4){logger['error'](_0xe0c5('0xa'),_0x261e49,_0x989915[_0xe0c5('0xe')]['message']);return _0x4bd34f(_0x989915['error'][_0xe0c5('0x10')]);}logger[_0xe0c5('0xe')](_0xe0c5('0xa'),_0x261e49,_0x989915['error'][_0xe0c5('0x10')]);return _0x363cb4(_0x989915[_0xe0c5('0xe')][_0xe0c5('0x10')]);}else{logger[_0xe0c5('0x11')](_0xe0c5('0xa'),_0x261e49,'request\x20sent');_0x363cb4(_0x989915[_0xe0c5('0x12')][_0xe0c5('0x10')]);}})[_0xe0c5('0x13')](function(_0x18df57){logger[_0xe0c5('0xe')](_0xe0c5('0xa'),_0x261e49,_0x18df57);_0x4bd34f(_0x18df57);});});} \ No newline at end of file +var _0x4815=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4815,0xa9));var _0x5481=function(_0x124ab4,_0x2b3dec){_0x124ab4=_0x124ab4-0x0;var _0x3779b6=_0x4815[_0x124ab4];return _0x3779b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5481('0x0'));var BPromise=require(_0x5481('0x1'));var rs=require(_0x5481('0x2'));var fs=require('fs');var Redis=require(_0x5481('0x3'));var db=require(_0x5481('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5481('0x5'))(_0x5481('0x6'));var config=require('../../config/environment');var jayson=require(_0x5481('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x119e4b,_0x5e4650,_0x20cc30){return new BPromise(function(_0x4648e6,_0x41cd9b){return client[_0x5481('0x8')](_0x119e4b,_0x20cc30)[_0x5481('0x9')](function(_0x101c0b){logger[_0x5481('0xa')](_0x5481('0xb'),_0x5e4650,_0x5481('0xc'));logger['debug'](_0x5481('0xd'),_0x5e4650,_0x5481('0xc'),JSON['stringify'](_0x101c0b));if(_0x101c0b[_0x5481('0xe')]){if(_0x101c0b[_0x5481('0xe')][_0x5481('0xf')]===0x1f4){logger[_0x5481('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x5e4650,_0x101c0b[_0x5481('0xe')][_0x5481('0x10')]);return _0x41cd9b(_0x101c0b['error']['message']);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x5e4650,_0x101c0b['error']['message']);return _0x4648e6(_0x101c0b['error']['message']);}else{logger[_0x5481('0xa')](_0x5481('0xb'),_0x5e4650,_0x5481('0xc'));_0x4648e6(_0x101c0b[_0x5481('0x11')][_0x5481('0x10')]);}})[_0x5481('0x12')](function(_0x44f49e){logger[_0x5481('0xe')](_0x5481('0xb'),_0x5e4650,_0x44f49e);_0x41cd9b(_0x44f49e);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 25b6b8a..0fc7115 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 _0xe969=['./memberReport.controller','isAuthenticated','get','describe','/:id','show','post','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe969,0x1d6));var _0x9e96=function(_0x3c6516,_0x1a0763){_0x3c6516=_0x3c6516-0x0;var _0x35da56=_0xe969[_0x3c6516];return _0x35da56;};'use strict';var multer=require(_0x9e96('0x0'));var util=require('util');var path=require(_0x9e96('0x1'));var timeout=require('connect-timeout');var express=require(_0x9e96('0x2'));var router=express[_0x9e96('0x3')]();var fs_extra=require(_0x9e96('0x4'));var auth=require(_0x9e96('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e96('0x6'));router['get']('/',auth[_0x9e96('0x7')](),controller['index']);router[_0x9e96('0x8')]('/describe',auth[_0x9e96('0x7')](),controller[_0x9e96('0x9')]);router['get'](_0x9e96('0xa'),auth[_0x9e96('0x7')](),controller[_0x9e96('0xb')]);router[_0x9e96('0xc')]('/',auth[_0x9e96('0x7')](),controller['create']);router[_0x9e96('0xd')](_0x9e96('0xa'),auth[_0x9e96('0x7')](),controller[_0x9e96('0xe')]);router[_0x9e96('0xf')](_0x9e96('0xa'),auth[_0x9e96('0x7')](),controller['destroy']);module[_0x9e96('0x10')]=router; \ No newline at end of file +var _0x81fc=['fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','get','describe','/:id','show','post','put','update','exports','multer','util','path','express','Router'];(function(_0x5177f5,_0x509b1f){var _0x712aba=function(_0x4514da){while(--_0x4514da){_0x5177f5['push'](_0x5177f5['shift']());}};_0x712aba(++_0x509b1f);}(_0x81fc,0x1f3));var _0xc81f=function(_0x1bf917,_0x49c9bd){_0x1bf917=_0x1bf917-0x0;var _0x4d80d4=_0x81fc[_0x1bf917];return _0x4d80d4;};'use strict';var multer=require(_0xc81f('0x0'));var util=require(_0xc81f('0x1'));var path=require(_0xc81f('0x2'));var timeout=require('connect-timeout');var express=require(_0xc81f('0x3'));var router=express[_0xc81f('0x4')]();var fs_extra=require(_0xc81f('0x5'));var auth=require(_0xc81f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc81f('0x7'));var controller=require(_0xc81f('0x8'));router['get']('/',auth[_0xc81f('0x9')](),controller['index']);router[_0xc81f('0xa')]('/describe',auth[_0xc81f('0x9')](),controller[_0xc81f('0xb')]);router[_0xc81f('0xa')](_0xc81f('0xc'),auth[_0xc81f('0x9')](),controller[_0xc81f('0xd')]);router[_0xc81f('0xe')]('/',auth[_0xc81f('0x9')](),controller['create']);router[_0xc81f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc81f('0x10')]);router['delete'](_0xc81f('0xc'),auth[_0xc81f('0x9')](),controller['destroy']);module[_0xc81f('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c06154b..d707d68 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 _0x7665=['sequelize','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_0x7665,0xd0));var _0x5766=function(_0x2036ee,_0x394b72){_0x2036ee=_0x2036ee-0x0;var _0x537743=_0x7665[_0x2036ee];return _0x537743;};'use strict';var Sequelize=require(_0x5766('0x0'));var moment=require('moment');module[_0x5766('0x1')]={'channel':{'type':Sequelize[_0x5766('0x2')]},'membername':{'type':Sequelize[_0x5766('0x2')]},'interface':{'type':Sequelize[_0x5766('0x2')]},'type':{'type':Sequelize[_0x5766('0x2')],'defaultValue':_0x5766('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x5766('0x4')]},'enterAt':{'type':Sequelize[_0x5766('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x19ef34){var _0x1f94b7=moment(_0x19ef34);var _0x24db71=moment(this[_0x5766('0x6')](_0x5766('0x7')));var _0x6dec16=_0x1f94b7['diff'](_0x24db71,_0x5766('0x8'));this[_0x5766('0x9')](_0x5766('0xa'),_0x19ef34);this[_0x5766('0x9')](_0x5766('0xb'),_0x6dec16>=0x0?_0x6dec16:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x5766('0xc')},'data2':{'type':Sequelize[_0x5766('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x5766('0xd')},'data4':{'type':Sequelize[_0x5766('0x2')],'comment':_0x5766('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0x5766('0xf')},'role':{'type':Sequelize[_0x5766('0x2')]},'internal':{'type':Sequelize[_0x5766('0x4')]},'uniqueid':{'type':Sequelize[_0x5766('0x2')]}}; \ No newline at end of file +var _0x73ad=['DATE','getDataValue','enterAt','seconds','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x73ad,0xa3));var _0xd73a=function(_0x5b230a,_0x6b9b6f){_0x5b230a=_0x5b230a-0x0;var _0x74827d=_0x73ad[_0x5b230a];return _0x74827d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd73a('0x0'));module[_0xd73a('0x1')]={'channel':{'type':Sequelize[_0xd73a('0x2')]},'membername':{'type':Sequelize[_0xd73a('0x2')]},'interface':{'type':Sequelize[_0xd73a('0x2')]},'type':{'type':Sequelize[_0xd73a('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xd73a('0x3')},'duration':{'type':Sequelize[_0xd73a('0x4')]},'enterAt':{'type':Sequelize[_0xd73a('0x5')]},'exitAt':{'type':Sequelize[_0xd73a('0x5')],'set':function(_0x50bd19){var _0x1c84d4=moment(_0x50bd19);var _0x6bd944=moment(this[_0xd73a('0x6')](_0xd73a('0x7')));var _0x3aad3b=_0x1c84d4['diff'](_0x6bd944,_0xd73a('0x8'));this['setDataValue'](_0xd73a('0x9'),_0x50bd19);this['setDataValue'](_0xd73a('0xa'),_0x3aad3b>=0x0?_0x3aad3b:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xd73a('0xb')},'data2':{'type':Sequelize[_0xd73a('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xd73a('0x2')],'comment':_0xd73a('0xc')},'data4':{'type':Sequelize[_0xd73a('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xd73a('0x2')],'comment':_0xd73a('0xd')},'role':{'type':Sequelize[_0xd73a('0x2')]},'internal':{'type':Sequelize[_0xd73a('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b04d61e..912238c 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x2feb01,_0x366704){var _0x259392=function(_0x247a6a){while(--_0x247a6a){_0x2feb01['push'](_0x2feb01['shift']());}};_0x259392(++_0x366704);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x2d1f46,_0x548bea){var _0x5a6f7d=function(_0x36878d){while(--_0x36878d){_0x2d1f46['push'](_0x2d1f46['shift']());}};_0x5a6f7d(++_0x548bea);}(_0x3e74,0x175));var _0x43e7=function(_0x27d127,_0x51aaac){_0x27d127=_0x27d127-0x0;var _0x26ad6a=_0x3e74[_0x27d127];return _0x26ad6a;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 9a4aeb3..b7cfeb0 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 _0x3714=['path','rimraf','../../config/environment','exports','define','report_member','membername_interface','membername','interface','lodash','util','api','moment','bluebird'];(function(_0x40d078,_0x210a77){var _0x46fc81=function(_0x3673da){while(--_0x3673da){_0x40d078['push'](_0x40d078['shift']());}};_0x46fc81(++_0x210a77);}(_0x3714,0x95));var _0x4371=function(_0x572ddd,_0x415804){_0x572ddd=_0x572ddd-0x0;var _0x1bae27=_0x3714[_0x572ddd];return _0x1bae27;};'use strict';var _=require(_0x4371('0x0'));var util=require(_0x4371('0x1'));var logger=require('../../config/logger')(_0x4371('0x2'));var moment=require(_0x4371('0x3'));var BPromise=require(_0x4371('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4371('0x5'));var rimraf=require(_0x4371('0x6'));var config=require(_0x4371('0x7'));var attributes=require('./memberReport.attributes');module[_0x4371('0x8')]=function(_0x5650a7,_0x349031){return _0x5650a7[_0x4371('0x9')]('MemberReport',attributes,{'tableName':_0x4371('0xa'),'paranoid':![],'indexes':[{'name':_0x4371('0xb'),'fields':[_0x4371('0xc'),_0x4371('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0bc=['moment','request-promise','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','interface','util','api'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xc0bc,0x136));var _0xcc0b=function(_0x5138e8,_0x45665c){_0x5138e8=_0x5138e8-0x0;var _0x504191=_0xc0bc[_0x5138e8];return _0x504191;};'use strict';var _=require('lodash');var util=require(_0xcc0b('0x0'));var logger=require('../../config/logger')(_0xcc0b('0x1'));var moment=require(_0xcc0b('0x2'));var BPromise=require('bluebird');var rp=require(_0xcc0b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc0b('0x4'));var config=require(_0xcc0b('0x5'));var attributes=require(_0xcc0b('0x6'));module['exports']=function(_0x5972bb,_0x4efa37){return _0x5972bb[_0xcc0b('0x7')](_0xcc0b('0x8'),attributes,{'tableName':_0xcc0b('0x9'),'paranoid':![],'indexes':[{'name':_0xcc0b('0xa'),'fields':['membername',_0xcc0b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 879ac85..7d6e998 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 _0x002d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','info','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','moment'];(function(_0xcf2293,_0x217776){var _0x12c606=function(_0x57af26){while(--_0x57af26){_0xcf2293['push'](_0xcf2293['shift']());}};_0x12c606(++_0x217776);}(_0x002d,0xca));var _0xd002=function(_0x2fb3cb,_0x22e8dc){_0x2fb3cb=_0x2fb3cb-0x0;var _0x3ba725=_0x002d[_0x2fb3cb];return _0x3ba725;};'use strict';var _=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var moment=require(_0xd002('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd002('0x3'));var db=require(_0xd002('0x4'))['db'];var utils=require(_0xd002('0x5'));var logger=require(_0xd002('0x6'))(_0xd002('0x7'));var config=require(_0xd002('0x8'));var jayson=require(_0xd002('0x9'));var client=jayson[_0xd002('0xa')][_0xd002('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3711b0,_0x24766e,_0x45d45f){return new BPromise(function(_0x18df0a,_0x166980){return client[_0xd002('0xc')](_0x3711b0,_0x45d45f)[_0xd002('0xd')](function(_0x3bc57b){logger['info']('MemberReport,\x20%s,\x20%s',_0x24766e,_0xd002('0xe'));logger[_0xd002('0xf')](_0xd002('0x10'),_0x24766e,'request\x20sent',JSON[_0xd002('0x11')](_0x3bc57b));if(_0x3bc57b[_0xd002('0x12')]){if(_0x3bc57b[_0xd002('0x12')][_0xd002('0x13')]===0x1f4){logger[_0xd002('0x12')](_0xd002('0x14'),_0x24766e,_0x3bc57b[_0xd002('0x12')][_0xd002('0x15')]);return _0x166980(_0x3bc57b[_0xd002('0x12')][_0xd002('0x15')]);}logger[_0xd002('0x12')](_0xd002('0x14'),_0x24766e,_0x3bc57b[_0xd002('0x12')][_0xd002('0x15')]);return _0x18df0a(_0x3bc57b['error']['message']);}else{logger['info'](_0xd002('0x14'),_0x24766e,'request\x20sent');_0x18df0a(_0x3bc57b[_0xd002('0x16')][_0xd002('0x15')]);}})[_0xd002('0x17')](function(_0x282c43){logger[_0xd002('0x12')](_0xd002('0x14'),_0x24766e,_0x282c43);_0x166980(_0x282c43);});});}exports[_0xd002('0x18')]=function(_0x5e1f31){var _0x83090d=this;return new Promise(function(_0x4708f6,_0x3d1a5f){return db[_0xd002('0x19')][_0xd002('0x1a')]({'raw':_0x5e1f31['options']?_0x5e1f31[_0xd002('0x1b')][_0xd002('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e1f31[_0xd002('0x1b')]?_0x5e1f31[_0xd002('0x1b')][_0xd002('0x1d')]||null:null,'attributes':_0x5e1f31[_0xd002('0x1b')]?_0x5e1f31['options']['attributes']||null:null,'limit':_0x5e1f31[_0xd002('0x1b')]?_0x5e1f31[_0xd002('0x1b')][_0xd002('0x1e')]||null:null,'include':_0x5e1f31[_0xd002('0x1b')]?_0x5e1f31[_0xd002('0x1b')][_0xd002('0x1f')]?_[_0xd002('0x20')](_0x5e1f31[_0xd002('0x1b')][_0xd002('0x1f')],function(_0x15ccfb){return{'model':db[_0x15ccfb[_0xd002('0x21')]],'as':_0x15ccfb['as'],'attributes':_0x15ccfb[_0xd002('0x22')],'include':_0x15ccfb['include']?_[_0xd002('0x20')](_0x15ccfb[_0xd002('0x1f')],function(_0x55e3be){return{'model':db[_0x55e3be[_0xd002('0x21')]],'as':_0x55e3be['as'],'attributes':_0x55e3be[_0xd002('0x22')],'include':_0x55e3be[_0xd002('0x1f')]?_['map'](_0x55e3be[_0xd002('0x1f')],function(_0x4f58fa){return{'model':db[_0x4f58fa['model']],'as':_0x4f58fa['as'],'attributes':_0x4f58fa['attributes']};}):[]};}):[]};}):[]:[]})[_0xd002('0xd')](function(_0x45745c){logger[_0xd002('0x23')](_0xd002('0x18'),_0x5e1f31);logger[_0xd002('0xf')](_0xd002('0x18'),_0x5e1f31,JSON[_0xd002('0x11')](_0x45745c));_0x4708f6(_0x45745c);})[_0xd002('0x17')](function(_0x9999ea){logger[_0xd002('0x12')]('GetMemberReport',_0x9999ea[_0xd002('0x15')],_0x5e1f31);_0x3d1a5f(_0x83090d[_0xd002('0x12')](0x1f4,_0x9999ea[_0xd002('0x15')]));});});};exports[_0xd002('0x24')]=function(_0x4d863e){var _0x2445bb=this;return new Promise(function(_0x568d90,_0x41ebcc){return db['MemberReport'][_0xd002('0x25')](_0x4d863e[_0xd002('0x26')],{'raw':_0x4d863e[_0xd002('0x1b')]?_0x4d863e[_0xd002('0x1b')][_0xd002('0x1c')]===undefined?!![]:![]:!![]})[_0xd002('0xd')](function(_0x160d12){logger[_0xd002('0x23')]('CreateMemberReport',_0x4d863e);logger[_0xd002('0xf')](_0xd002('0x24'),_0x4d863e,JSON[_0xd002('0x11')](_0x160d12));_0x568d90(_0x160d12);})[_0xd002('0x17')](function(_0xfb27b4){logger[_0xd002('0x12')]('CreateMemberReport',_0xfb27b4['message'],_0x4d863e);_0x41ebcc(_0x2445bb['error'](0x1f4,_0xfb27b4[_0xd002('0x15')]));});});};exports['UpdateMemberReport']=function(_0x66504){var _0x115090=this;return new Promise(function(_0x2a85c0,_0x1c324e){return db[_0xd002('0x19')][_0xd002('0x27')](_0x66504[_0xd002('0x26')],{'raw':_0x66504[_0xd002('0x1b')]?_0x66504['options'][_0xd002('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x66504[_0xd002('0x1b')]?_0x66504['options']['where']||null:null,'attributes':_0x66504[_0xd002('0x1b')]?_0x66504[_0xd002('0x1b')][_0xd002('0x22')]||null:null,'limit':_0x66504[_0xd002('0x1b')]?_0x66504['options'][_0xd002('0x1e')]||null:null})['then'](function(_0x16d23d){logger[_0xd002('0x23')](_0xd002('0x28'),_0x66504);logger[_0xd002('0xf')](_0xd002('0x28'),_0x66504,JSON['stringify'](_0x16d23d));_0x2a85c0(_0x16d23d);})[_0xd002('0x17')](function(_0x7a9e84){logger[_0xd002('0x12')](_0xd002('0x28'),_0x7a9e84[_0xd002('0x15')],_0x66504);_0x1c324e(_0x115090[_0xd002('0x12')](0x1f4,_0x7a9e84[_0xd002('0x15')]));});});}; \ No newline at end of file +var _0x0618=['include','map','then','CreateMemberReport','create','body','UpdateMemberReport','update','where','limit','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMemberReport','MemberReport','options','raw','attributes','model'];(function(_0x52c297,_0x5f050a){var _0x1369ac=function(_0x20617f){while(--_0x20617f){_0x52c297['push'](_0x52c297['shift']());}};_0x1369ac(++_0x5f050a);}(_0x0618,0x1c6));var _0x8061=function(_0x5c08aa,_0x415156){_0x5c08aa=_0x5c08aa-0x0;var _0x5f5857=_0x0618[_0x5c08aa];return _0x5f5857;};'use strict';var _=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var moment=require('moment');var BPromise=require(_0x8061('0x2'));var rs=require(_0x8061('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8061('0x4'));var logger=require(_0x8061('0x5'))(_0x8061('0x6'));var config=require(_0x8061('0x7'));var jayson=require(_0x8061('0x8'));var client=jayson[_0x8061('0x9')][_0x8061('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9c161b,_0x2c5e9d,_0x3bb894){return new BPromise(function(_0x7bfd18,_0x483d55){return client[_0x8061('0xb')](_0x9c161b,_0x3bb894)['then'](function(_0x286122){logger[_0x8061('0xc')](_0x8061('0xd'),_0x2c5e9d,_0x8061('0xe'));logger[_0x8061('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x2c5e9d,'request\x20sent',JSON[_0x8061('0x10')](_0x286122));if(_0x286122[_0x8061('0x11')]){if(_0x286122['error']['code']===0x1f4){logger[_0x8061('0x11')](_0x8061('0xd'),_0x2c5e9d,_0x286122[_0x8061('0x11')][_0x8061('0x12')]);return _0x483d55(_0x286122[_0x8061('0x11')][_0x8061('0x12')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x2c5e9d,_0x286122[_0x8061('0x11')][_0x8061('0x12')]);return _0x7bfd18(_0x286122[_0x8061('0x11')][_0x8061('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x2c5e9d,_0x8061('0xe'));_0x7bfd18(_0x286122[_0x8061('0x13')][_0x8061('0x12')]);}})[_0x8061('0x14')](function(_0x127435){logger[_0x8061('0x11')](_0x8061('0xd'),_0x2c5e9d,_0x127435);_0x483d55(_0x127435);});});}exports[_0x8061('0x15')]=function(_0x2b0eab){var _0x4096ba=this;return new Promise(function(_0x14230e,_0x20d231){return db[_0x8061('0x16')]['findAll']({'raw':_0x2b0eab['options']?_0x2b0eab[_0x8061('0x17')][_0x8061('0x18')]===undefined?!![]:![]:!![],'where':_0x2b0eab[_0x8061('0x17')]?_0x2b0eab['options']['where']||null:null,'attributes':_0x2b0eab[_0x8061('0x17')]?_0x2b0eab[_0x8061('0x17')][_0x8061('0x19')]||null:null,'limit':_0x2b0eab[_0x8061('0x17')]?_0x2b0eab['options']['limit']||null:null,'include':_0x2b0eab[_0x8061('0x17')]?_0x2b0eab[_0x8061('0x17')]['include']?_['map'](_0x2b0eab[_0x8061('0x17')]['include'],function(_0x535cc9){return{'model':db[_0x535cc9[_0x8061('0x1a')]],'as':_0x535cc9['as'],'attributes':_0x535cc9[_0x8061('0x19')],'include':_0x535cc9['include']?_['map'](_0x535cc9[_0x8061('0x1b')],function(_0x3f2765){return{'model':db[_0x3f2765['model']],'as':_0x3f2765['as'],'attributes':_0x3f2765[_0x8061('0x19')],'include':_0x3f2765[_0x8061('0x1b')]?_[_0x8061('0x1c')](_0x3f2765[_0x8061('0x1b')],function(_0x5f0822){return{'model':db[_0x5f0822['model']],'as':_0x5f0822['as'],'attributes':_0x5f0822[_0x8061('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8061('0x1d')](function(_0x19f400){logger[_0x8061('0xc')](_0x8061('0x15'),_0x2b0eab);logger['debug']('GetMemberReport',_0x2b0eab,JSON['stringify'](_0x19f400));_0x14230e(_0x19f400);})['catch'](function(_0xfb9138){logger[_0x8061('0x11')](_0x8061('0x15'),_0xfb9138[_0x8061('0x12')],_0x2b0eab);_0x20d231(_0x4096ba[_0x8061('0x11')](0x1f4,_0xfb9138[_0x8061('0x12')]));});});};exports[_0x8061('0x1e')]=function(_0x15ed1d){var _0x42d5a7=this;return new Promise(function(_0x28c274,_0x50ac44){return db['MemberReport'][_0x8061('0x1f')](_0x15ed1d[_0x8061('0x20')],{'raw':_0x15ed1d[_0x8061('0x17')]?_0x15ed1d[_0x8061('0x17')][_0x8061('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x147db0){logger[_0x8061('0xc')]('CreateMemberReport',_0x15ed1d);logger['debug'](_0x8061('0x1e'),_0x15ed1d,JSON[_0x8061('0x10')](_0x147db0));_0x28c274(_0x147db0);})['catch'](function(_0x1637fd){logger[_0x8061('0x11')](_0x8061('0x1e'),_0x1637fd[_0x8061('0x12')],_0x15ed1d);_0x50ac44(_0x42d5a7[_0x8061('0x11')](0x1f4,_0x1637fd[_0x8061('0x12')]));});});};exports[_0x8061('0x21')]=function(_0x1e8f0d){var _0x25f250=this;return new Promise(function(_0x5293da,_0x4467e2){return db[_0x8061('0x16')][_0x8061('0x22')](_0x1e8f0d[_0x8061('0x20')],{'raw':_0x1e8f0d['options']?_0x1e8f0d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e8f0d['options']?_0x1e8f0d['options'][_0x8061('0x23')]||null:null,'attributes':_0x1e8f0d['options']?_0x1e8f0d[_0x8061('0x17')][_0x8061('0x19')]||null:null,'limit':_0x1e8f0d[_0x8061('0x17')]?_0x1e8f0d[_0x8061('0x17')][_0x8061('0x24')]||null:null})['then'](function(_0x2dbb19){logger[_0x8061('0xc')](_0x8061('0x21'),_0x1e8f0d);logger[_0x8061('0xf')](_0x8061('0x21'),_0x1e8f0d,JSON[_0x8061('0x10')](_0x2dbb19));_0x5293da(_0x2dbb19);})[_0x8061('0x14')](function(_0x2479dd){logger[_0x8061('0x11')](_0x8061('0x21'),_0x2479dd[_0x8061('0x12')],_0x1e8f0d);_0x4467e2(_0x25f250[_0x8061('0x11')](0x1f4,_0x2479dd['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e060390..4b10da5 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 _0xea2f=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./migration.controller','get','index','exports','multer'];(function(_0x30b3a6,_0x39f616){var _0x3b23be=function(_0x27b872){while(--_0x27b872){_0x30b3a6['push'](_0x30b3a6['shift']());}};_0x3b23be(++_0x39f616);}(_0xea2f,0x6d));var _0xfea2=function(_0x2a3890,_0x4c556d){_0x2a3890=_0x2a3890-0x0;var _0x2be2a7=_0xea2f[_0x2a3890];return _0x2be2a7;};'use strict';var multer=require(_0xfea2('0x0'));var util=require('util');var path=require(_0xfea2('0x1'));var timeout=require(_0xfea2('0x2'));var express=require('express');var router=express[_0xfea2('0x3')]();var fs_extra=require(_0xfea2('0x4'));var auth=require(_0xfea2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfea2('0x6'));router[_0xfea2('0x7')]('/',controller[_0xfea2('0x8')]);module[_0xfea2('0x9')]=router; \ No newline at end of file +var _0x1e92=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x2cfd0b,_0x12c7b2){var _0x57906e=function(_0x3e2743){while(--_0x3e2743){_0x2cfd0b['push'](_0x2cfd0b['shift']());}};_0x57906e(++_0x12c7b2);}(_0x1e92,0x1df));var _0x21e9=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x1e92[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x21e9('0x0'));var util=require('util');var path=require(_0x21e9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21e9('0x2')]();var fs_extra=require(_0x21e9('0x3'));var auth=require(_0x21e9('0x4'));var interaction=require(_0x21e9('0x5'));var config=require(_0x21e9('0x6'));var controller=require(_0x21e9('0x7'));router[_0x21e9('0x8')]('/',controller[_0x21e9('0x9')]);module[_0x21e9('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 13faac4..2a43648 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 _0x5b7a=['sequelize','version'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x5b7a,0x8c));var _0xa5b7=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x5b7a[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0xa5b7('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xa5b7('0x1')}}; \ No newline at end of file +var _0x0ce1=['STRING','version','sequelize','exports'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x0ce1,0x15a));var _0x10ce=function(_0x137388,_0x225667){_0x137388=_0x137388-0x0;var _0x488841=_0x0ce1[_0x137388];return _0x488841;};'use strict';var Sequelize=require(_0x10ce('0x0'));module[_0x10ce('0x1')]={'version':{'type':Sequelize[_0x10ce('0x2')],'unique':_0x10ce('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index b4d49e2..34b1d56 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 _0xfad1=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Migration','includeAll','include','findAll','rows','eml-format','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','../../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','stack'];(function(_0x36a9ef,_0x4b3cbb){var _0x217ebb=function(_0x169ed2){while(--_0x169ed2){_0x36a9ef['push'](_0x36a9ef['shift']());}};_0x217ebb(++_0x4b3cbb);}(_0xfad1,0xb0));var _0x1fad=function(_0x3716ea,_0x4daf04){_0x3716ea=_0x3716ea-0x0;var _0x490e29=_0xfad1[_0x3716ea];return _0x490e29;};'use strict';var emlformat=require(_0x1fad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fad('0x1'));var jsonpatch=require(_0x1fad('0x2'));var rp=require(_0x1fad('0x3'));var moment=require('moment');var BPromise=require(_0x1fad('0x4'));var Mustache=require(_0x1fad('0x5'));var util=require(_0x1fad('0x6'));var path=require(_0x1fad('0x7'));var sox=require(_0x1fad('0x8'));var csv=require(_0x1fad('0x9'));var ejs=require(_0x1fad('0xa'));var fs=require('fs');var fs_extra=require(_0x1fad('0xb'));var _=require(_0x1fad('0xc'));var squel=require(_0x1fad('0xd'));var crypto=require(_0x1fad('0xe'));var jsforce=require(_0x1fad('0xf'));var deskjs=require(_0x1fad('0x10'));var toCsv=require(_0x1fad('0x9'));var querystring=require(_0x1fad('0x11'));var Papa=require(_0x1fad('0x12'));var Redis=require('ioredis');var authService=require(_0x1fad('0x13'));var qs=require(_0x1fad('0x14'));var as=require(_0x1fad('0x15'));var hardwareService=require(_0x1fad('0x16'));var logger=require(_0x1fad('0x17'))(_0x1fad('0x18'));var utils=require(_0x1fad('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1fad('0x1a'));var db=require(_0x1fad('0x1b'))['db'];function respondWithStatusCode(_0x3493f1,_0x57cfdc){_0x57cfdc=_0x57cfdc||0xcc;return function(_0x2e6d4f){if(_0x2e6d4f){return _0x3493f1['sendStatus'](_0x57cfdc);}return _0x3493f1[_0x1fad('0x1c')](_0x57cfdc)[_0x1fad('0x1d')]();};}function respondWithResult(_0x34c6cd,_0x470eb5){_0x470eb5=_0x470eb5||0xc8;return function(_0x9c182e){if(_0x9c182e){return _0x34c6cd['status'](_0x470eb5)[_0x1fad('0x1e')](_0x9c182e);}};}function respondWithFilteredResult(_0x4ac05d,_0x1074d1){return function(_0x2f37b7){if(_0x2f37b7){var _0x4dee4c=typeof _0x1074d1[_0x1fad('0x1f')]===_0x1fad('0x20')&&typeof _0x1074d1[_0x1fad('0x21')]==='undefined';var _0x539f0a=_0x2f37b7[_0x1fad('0x22')];var _0x2cf9de=_0x4dee4c?0x0:_0x1074d1[_0x1fad('0x1f')];var _0x3811b3=_0x4dee4c?_0x2f37b7['count']:_0x1074d1[_0x1fad('0x1f')]+_0x1074d1[_0x1fad('0x21')];var _0x35fc9e;if(_0x3811b3>=_0x539f0a){_0x3811b3=_0x539f0a;_0x35fc9e=0xc8;}else{_0x35fc9e=0xce;}_0x4ac05d['status'](_0x35fc9e);return _0x4ac05d['set'](_0x1fad('0x23'),_0x2cf9de+'-'+_0x3811b3+'/'+_0x539f0a)[_0x1fad('0x1e')](_0x2f37b7);}return null;};}function patchUpdates(_0xdbf9cf){return function(_0x4cb15b){try{jsonpatch[_0x1fad('0x24')](_0x4cb15b,_0xdbf9cf,!![]);}catch(_0x890db2){return BPromise[_0x1fad('0x25')](_0x890db2);}return _0x4cb15b[_0x1fad('0x26')]();};}function saveUpdates(_0x259743,_0x146daf){return function(_0xc1fb15){if(_0xc1fb15){return _0xc1fb15[_0x1fad('0x27')](_0x259743)[_0x1fad('0x28')](function(_0x14368b){return _0x14368b;});}return null;};}function removeEntity(_0x5af1b3,_0x3d03d6){return function(_0x254eda){if(_0x254eda){return _0x254eda[_0x1fad('0x29')]()['then'](function(){_0x5af1b3['status'](0xcc)[_0x1fad('0x1d')]();});}};}function handleEntityNotFound(_0x2c71ec,_0x33aee1){return function(_0x263f7b){if(!_0x263f7b){_0x2c71ec['sendStatus'](0x194);}return _0x263f7b;};}function handleError(_0x19d9e8,_0x526183){_0x526183=_0x526183||0x1f4;return function(_0x482f85){logger['error'](_0x482f85[_0x1fad('0x2a')]);if(_0x482f85[_0x1fad('0x2b')]){delete _0x482f85[_0x1fad('0x2b')];}_0x19d9e8[_0x1fad('0x1c')](_0x526183)[_0x1fad('0x2c')](_0x482f85);};}exports[_0x1fad('0x2d')]=function(_0x3c8bb4,_0x333f0b){var _0x3f7bf8={},_0x1ea90f={},_0x4fdb67={'count':0x0,'rows':[]};var _0xf08bce=_[_0x1fad('0x2e')](db['Migration'][_0x1fad('0x2f')],function(_0x1a94af){return{'name':_0x1a94af[_0x1fad('0x30')],'type':_0x1a94af[_0x1fad('0x31')][_0x1fad('0x32')]};});_0x1ea90f[_0x1fad('0x33')]=_['map'](_0xf08bce,_0x1fad('0x2b'));_0x1ea90f[_0x1fad('0x34')]=_[_0x1fad('0x35')](_0x3c8bb4[_0x1fad('0x34')]);_0x1ea90f[_0x1fad('0x36')]=_[_0x1fad('0x37')](_0x1ea90f[_0x1fad('0x33')],_0x1ea90f[_0x1fad('0x34')]);_0x3f7bf8[_0x1fad('0x38')]=_['intersection'](_0x1ea90f[_0x1fad('0x33')],qs[_0x1fad('0x39')](_0x3c8bb4[_0x1fad('0x34')][_0x1fad('0x39')]));_0x3f7bf8[_0x1fad('0x38')]=_0x3f7bf8[_0x1fad('0x38')][_0x1fad('0x3a')]?_0x3f7bf8[_0x1fad('0x38')]:_0x1ea90f[_0x1fad('0x33')];if(!_0x3c8bb4[_0x1fad('0x34')][_0x1fad('0x3b')](_0x1fad('0x3c'))){_0x3f7bf8[_0x1fad('0x21')]=qs['limit'](_0x3c8bb4['query'][_0x1fad('0x21')]);_0x3f7bf8[_0x1fad('0x1f')]=qs[_0x1fad('0x1f')](_0x3c8bb4[_0x1fad('0x34')][_0x1fad('0x1f')]);}_0x3f7bf8[_0x1fad('0x3d')]=qs[_0x1fad('0x3e')](_0x3c8bb4['query']['sort']);_0x3f7bf8[_0x1fad('0x3f')]=qs['filters'](_[_0x1fad('0x40')](_0x3c8bb4[_0x1fad('0x34')],_0x1ea90f[_0x1fad('0x36')]),_0xf08bce);if(_0x3c8bb4['query']['filter']){_0x3f7bf8['where']=_['merge'](_0x3f7bf8['where'],{'$or':_['map'](_0xf08bce,function(_0x53368d){if(_0x53368d[_0x1fad('0x31')]!=='VIRTUAL'){var _0x44fac7={};_0x44fac7[_0x53368d[_0x1fad('0x2b')]]={'$like':'%'+_0x3c8bb4[_0x1fad('0x34')][_0x1fad('0x41')]+'%'};return _0x44fac7;}})});}_0x3f7bf8=_[_0x1fad('0x42')]({},_0x3f7bf8,_0x3c8bb4[_0x1fad('0x43')]);var _0x4a35eb={'where':_0x3f7bf8[_0x1fad('0x3f')]};return db[_0x1fad('0x44')][_0x1fad('0x22')](_0x4a35eb)[_0x1fad('0x28')](function(_0x2f7123){_0x4fdb67[_0x1fad('0x22')]=_0x2f7123;if(_0x3c8bb4[_0x1fad('0x34')][_0x1fad('0x45')]){_0x3f7bf8[_0x1fad('0x46')]=[{'all':!![]}];}return db[_0x1fad('0x44')][_0x1fad('0x47')](_0x3f7bf8);})['then'](function(_0x2b94b1){_0x4fdb67[_0x1fad('0x48')]=_0x2b94b1;return _0x4fdb67;})[_0x1fad('0x28')](respondWithFilteredResult(_0x333f0b,_0x3f7bf8))['catch'](handleError(_0x333f0b,null));}; \ No newline at end of file +var _0xbc96=['zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','index','Migration','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','eml-format','rimraf'];(function(_0x53e1c1,_0x61b844){var _0x545702=function(_0x3948b3){while(--_0x3948b3){_0x53e1c1['push'](_0x53e1c1['shift']());}};_0x545702(++_0x61b844);}(_0xbc96,0xca));var _0x6bc9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbc96[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x6bc9('0x0'));var rimraf=require(_0x6bc9('0x1'));var zipdir=require(_0x6bc9('0x2'));var jsonpatch=require(_0x6bc9('0x3'));var rp=require('request-promise');var moment=require(_0x6bc9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6bc9('0x5'));var path=require(_0x6bc9('0x6'));var sox=require(_0x6bc9('0x7'));var csv=require('to-csv');var ejs=require(_0x6bc9('0x8'));var fs=require('fs');var fs_extra=require(_0x6bc9('0x9'));var _=require(_0x6bc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6bc9('0xb'));var deskjs=require(_0x6bc9('0xc'));var toCsv=require(_0x6bc9('0xd'));var querystring=require(_0x6bc9('0xe'));var Papa=require(_0x6bc9('0xf'));var Redis=require(_0x6bc9('0x10'));var authService=require(_0x6bc9('0x11'));var qs=require(_0x6bc9('0x12'));var as=require(_0x6bc9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bc9('0x14'))(_0x6bc9('0x15'));var utils=require(_0x6bc9('0x16'));var config=require(_0x6bc9('0x17'));var licenseUtil=require(_0x6bc9('0x18'));var db=require(_0x6bc9('0x19'))['db'];function respondWithStatusCode(_0x3b3373,_0x550551){_0x550551=_0x550551||0xcc;return function(_0xa5223f){if(_0xa5223f){return _0x3b3373[_0x6bc9('0x1a')](_0x550551);}return _0x3b3373[_0x6bc9('0x1b')](_0x550551)[_0x6bc9('0x1c')]();};}function respondWithResult(_0x9e2b6,_0x5a9327){_0x5a9327=_0x5a9327||0xc8;return function(_0x2105f7){if(_0x2105f7){return _0x9e2b6[_0x6bc9('0x1b')](_0x5a9327)[_0x6bc9('0x1d')](_0x2105f7);}};}function respondWithFilteredResult(_0x4698f0,_0x502dc8){return function(_0x51ad8c){if(_0x51ad8c){var _0x15a3b0=typeof _0x502dc8[_0x6bc9('0x1e')]===_0x6bc9('0x1f')&&typeof _0x502dc8['limit']===_0x6bc9('0x1f');var _0x2d23d6=_0x51ad8c[_0x6bc9('0x20')];var _0x2ca785=_0x15a3b0?0x0:_0x502dc8[_0x6bc9('0x1e')];var _0x9c56e7=_0x15a3b0?_0x51ad8c[_0x6bc9('0x20')]:_0x502dc8['offset']+_0x502dc8['limit'];var _0x32b0b7;if(_0x9c56e7>=_0x2d23d6){_0x9c56e7=_0x2d23d6;_0x32b0b7=0xc8;}else{_0x32b0b7=0xce;}_0x4698f0[_0x6bc9('0x1b')](_0x32b0b7);return _0x4698f0[_0x6bc9('0x21')]('Content-Range',_0x2ca785+'-'+_0x9c56e7+'/'+_0x2d23d6)[_0x6bc9('0x1d')](_0x51ad8c);}return null;};}function patchUpdates(_0x5c5302){return function(_0x297f95){try{jsonpatch[_0x6bc9('0x22')](_0x297f95,_0x5c5302,!![]);}catch(_0x1e97ea){return BPromise[_0x6bc9('0x23')](_0x1e97ea);}return _0x297f95[_0x6bc9('0x24')]();};}function saveUpdates(_0x2189bd,_0x28dbef){return function(_0x31fae5){if(_0x31fae5){return _0x31fae5[_0x6bc9('0x25')](_0x2189bd)[_0x6bc9('0x26')](function(_0x1f7350){return _0x1f7350;});}return null;};}function removeEntity(_0x52e8a1,_0x2492f6){return function(_0x5b6789){if(_0x5b6789){return _0x5b6789[_0x6bc9('0x27')]()[_0x6bc9('0x26')](function(){_0x52e8a1['status'](0xcc)[_0x6bc9('0x1c')]();});}};}function handleEntityNotFound(_0x1956e0,_0x418802){return function(_0x5ad3c5){if(!_0x5ad3c5){_0x1956e0[_0x6bc9('0x1a')](0x194);}return _0x5ad3c5;};}function handleError(_0x1e417a,_0x55a639){_0x55a639=_0x55a639||0x1f4;return function(_0x389b2b){logger['error'](_0x389b2b[_0x6bc9('0x28')]);if(_0x389b2b['name']){delete _0x389b2b[_0x6bc9('0x29')];}_0x1e417a[_0x6bc9('0x1b')](_0x55a639)['send'](_0x389b2b);};}exports[_0x6bc9('0x2a')]=function(_0x4e135b,_0x5193a7){var _0x1f0012={},_0x5c149d={},_0x6d84c5={'count':0x0,'rows':[]};var _0x1d5078=_['map'](db[_0x6bc9('0x2b')][_0x6bc9('0x2c')],function(_0x2a2044){return{'name':_0x2a2044[_0x6bc9('0x2d')],'type':_0x2a2044[_0x6bc9('0x2e')][_0x6bc9('0x2f')]};});_0x5c149d['model']=_['map'](_0x1d5078,_0x6bc9('0x29'));_0x5c149d['query']=_['keys'](_0x4e135b[_0x6bc9('0x30')]);_0x5c149d[_0x6bc9('0x31')]=_[_0x6bc9('0x32')](_0x5c149d['model'],_0x5c149d[_0x6bc9('0x30')]);_0x1f0012[_0x6bc9('0x33')]=_[_0x6bc9('0x32')](_0x5c149d['model'],qs[_0x6bc9('0x34')](_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x34')]));_0x1f0012[_0x6bc9('0x33')]=_0x1f0012[_0x6bc9('0x33')]['length']?_0x1f0012[_0x6bc9('0x33')]:_0x5c149d[_0x6bc9('0x35')];if(!_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x36')](_0x6bc9('0x37'))){_0x1f0012[_0x6bc9('0x38')]=qs[_0x6bc9('0x38')](_0x4e135b['query'][_0x6bc9('0x38')]);_0x1f0012[_0x6bc9('0x1e')]=qs[_0x6bc9('0x1e')](_0x4e135b['query']['offset']);}_0x1f0012[_0x6bc9('0x39')]=qs[_0x6bc9('0x3a')](_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x3a')]);_0x1f0012[_0x6bc9('0x3b')]=qs[_0x6bc9('0x31')](_[_0x6bc9('0x3c')](_0x4e135b['query'],_0x5c149d[_0x6bc9('0x31')]),_0x1d5078);if(_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x3d')]){_0x1f0012[_0x6bc9('0x3b')]=_[_0x6bc9('0x3e')](_0x1f0012[_0x6bc9('0x3b')],{'$or':_['map'](_0x1d5078,function(_0x3b6307){if(_0x3b6307[_0x6bc9('0x2e')]!=='VIRTUAL'){var _0x54f85c={};_0x54f85c[_0x3b6307[_0x6bc9('0x29')]]={'$like':'%'+_0x4e135b[_0x6bc9('0x30')]['filter']+'%'};return _0x54f85c;}})});}_0x1f0012=_['merge']({},_0x1f0012,_0x4e135b[_0x6bc9('0x3f')]);var _0x58efca={'where':_0x1f0012[_0x6bc9('0x3b')]};return db[_0x6bc9('0x2b')][_0x6bc9('0x20')](_0x58efca)['then'](function(_0x417444){_0x6d84c5[_0x6bc9('0x20')]=_0x417444;if(_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x40')]){_0x1f0012['include']=[{'all':!![]}];}return db[_0x6bc9('0x2b')][_0x6bc9('0x41')](_0x1f0012);})[_0x6bc9('0x26')](function(_0xfb6dde){_0x6d84c5[_0x6bc9('0x42')]=_0xfb6dde;return _0x6d84c5;})['then'](respondWithFilteredResult(_0x5193a7,_0x1f0012))[_0x6bc9('0x43')](handleError(_0x5193a7,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 22bee03..764b316 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 _0xc27a=['path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xc27a,0x96));var _0xac27=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0xc27a[_0x2e913b];return _0x173899;};'use strict';var _=require(_0xac27('0x0'));var util=require(_0xac27('0x1'));var logger=require(_0xac27('0x2'))(_0xac27('0x3'));var moment=require(_0xac27('0x4'));var BPromise=require('bluebird');var rp=require(_0xac27('0x5'));var fs=require('fs');var path=require(_0xac27('0x6'));var rimraf=require(_0xac27('0x7'));var config=require(_0xac27('0x8'));var attributes=require(_0xac27('0x9'));module[_0xac27('0xa')]=function(_0x40d1dd,_0x5bfa63){return _0x40d1dd[_0xac27('0xb')]('Migration',attributes,{'tableName':_0xac27('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x031c=['moment','bluebird','path','rimraf','exports','lodash','util','../../config/logger'];(function(_0x3d4ade,_0x1b6ac1){var _0x422fed=function(_0x1bdba5){while(--_0x1bdba5){_0x3d4ade['push'](_0x3d4ade['shift']());}};_0x422fed(++_0x1b6ac1);}(_0x031c,0xcd));var _0xc031=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x031c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc031('0x0'));var util=require(_0xc031('0x1'));var logger=require(_0xc031('0x2'))('api');var moment=require(_0xc031('0x3'));var BPromise=require(_0xc031('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc031('0x5'));var rimraf=require(_0xc031('0x6'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xc031('0x7')]=function(_0x30114a,_0x18ef6f){return _0x30114a['define']('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 5e620d6..8e59057 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 _0xffda=['code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2fbf3d,_0x1b1b8a){var _0x18f0c1=function(_0x4aa677){while(--_0x4aa677){_0x2fbf3d['push'](_0x2fbf3d['shift']());}};_0x18f0c1(++_0x1b1b8a);}(_0xffda,0x73));var _0xaffd=function(_0x39eff1,_0x372d5e){_0x39eff1=_0x39eff1-0x0;var _0x2fdb5a=_0xffda[_0x39eff1];return _0x2fdb5a;};'use strict';var _=require(_0xaffd('0x0'));var util=require(_0xaffd('0x1'));var moment=require(_0xaffd('0x2'));var BPromise=require(_0xaffd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaffd('0x4'));var db=require(_0xaffd('0x5'))['db'];var utils=require(_0xaffd('0x6'));var logger=require('../../config/logger')(_0xaffd('0x7'));var config=require('../../config/environment');var jayson=require(_0xaffd('0x8'));var client=jayson[_0xaffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca99e,_0x39b2e5,_0x12865c){return new BPromise(function(_0x3647e1,_0x514b76){return client[_0xaffd('0xa')](_0x4ca99e,_0x12865c)[_0xaffd('0xb')](function(_0x505908){logger['info'](_0xaffd('0xc'),_0x39b2e5,_0xaffd('0xd'));logger[_0xaffd('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x39b2e5,_0xaffd('0xd'),JSON[_0xaffd('0xf')](_0x505908));if(_0x505908['error']){if(_0x505908[_0xaffd('0x10')][_0xaffd('0x11')]===0x1f4){logger[_0xaffd('0x10')](_0xaffd('0xc'),_0x39b2e5,_0x505908[_0xaffd('0x10')]['message']);return _0x514b76(_0x505908[_0xaffd('0x10')]['message']);}logger['error'](_0xaffd('0xc'),_0x39b2e5,_0x505908[_0xaffd('0x10')][_0xaffd('0x12')]);return _0x3647e1(_0x505908['error'][_0xaffd('0x12')]);}else{logger[_0xaffd('0x13')](_0xaffd('0xc'),_0x39b2e5,_0xaffd('0xd'));_0x3647e1(_0x505908[_0xaffd('0x14')][_0xaffd('0x12')]);}})[_0xaffd('0x15')](function(_0x3ddf0c){logger['error'](_0xaffd('0xc'),_0x39b2e5,_0x3ddf0c);_0x514b76(_0x3ddf0c);});});} \ No newline at end of file +var _0x534d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x359dea,_0x4b17ab){var _0x347148=function(_0x3c7dba){while(--_0x3c7dba){_0x359dea['push'](_0x359dea['shift']());}};_0x347148(++_0x4b17ab);}(_0x534d,0x79));var _0xd534=function(_0x4faeef,_0x189288){_0x4faeef=_0x4faeef-0x0;var _0x50c9c7=_0x534d[_0x4faeef];return _0x50c9c7;};'use strict';var _=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var moment=require(_0xd534('0x2'));var BPromise=require(_0xd534('0x3'));var rs=require(_0xd534('0x4'));var fs=require('fs');var Redis=require(_0xd534('0x5'));var db=require(_0xd534('0x6'))['db'];var utils=require(_0xd534('0x7'));var logger=require(_0xd534('0x8'))(_0xd534('0x9'));var config=require(_0xd534('0xa'));var jayson=require(_0xd534('0xb'));var client=jayson[_0xd534('0xc')][_0xd534('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db778,_0x3c8772,_0x4419ee){return new BPromise(function(_0x1a00af,_0x2be8e1){return client['request'](_0x1db778,_0x4419ee)[_0xd534('0xe')](function(_0x37a2c8){logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,_0xd534('0x11'));logger['debug'](_0xd534('0x12'),_0x3c8772,_0xd534('0x11'),JSON[_0xd534('0x13')](_0x37a2c8));if(_0x37a2c8[_0xd534('0x14')]){if(_0x37a2c8[_0xd534('0x14')][_0xd534('0x15')]===0x1f4){logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8['error']['message']);return _0x2be8e1(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);return _0x1a00af(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}else{logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,'request\x20sent');_0x1a00af(_0x37a2c8['result'][_0xd534('0x16')]);}})[_0xd534('0x17')](function(_0x398435){logger['error']('Migration,\x20%s,\x20%s',_0x3c8772,_0x398435);_0x2be8e1(_0x398435);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index eef6be0..26738cf 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(_0x55beb6,_0x4acb83){var _0x307e84=function(_0x31ca93){while(--_0x31ca93){_0x55beb6['push'](_0x55beb6['shift']());}};_0x307e84(++_0x4acb83);}(_0x804d,0x116));var _0xd804=function(_0x58f8d3,_0x2bae22){_0x58f8d3=_0x58f8d3-0x0;var _0x5ea4b7=_0x804d[_0x58f8d3];return _0x5ea4b7;};'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 _0x27de=['index','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated'];(function(_0x70e30c,_0x243047){var _0x594a9d=function(_0x43a1f6){while(--_0x43a1f6){_0x70e30c['push'](_0x70e30c['shift']());}};_0x594a9d(++_0x243047);}(_0x27de,0x111));var _0xe27d=function(_0x4e518b,_0x3f51e4){_0x4e518b=_0x4e518b-0x0;var _0x257723=_0x27de[_0x4e518b];return _0x257723;};'use strict';var multer=require(_0xe27d('0x0'));var util=require(_0xe27d('0x1'));var path=require(_0xe27d('0x2'));var timeout=require(_0xe27d('0x3'));var express=require(_0xe27d('0x4'));var router=express[_0xe27d('0x5')]();var fs_extra=require(_0xe27d('0x6'));var auth=require(_0xe27d('0x7'));var interaction=require(_0xe27d('0x8'));var config=require('../../config/environment');var controller=require(_0xe27d('0x9'));router[_0xe27d('0xa')]('/',auth[_0xe27d('0xb')](),controller[_0xe27d('0xc')]);router[_0xe27d('0xa')](_0xe27d('0xd'),auth[_0xe27d('0xb')](),controller[_0xe27d('0xe')]);router['post']('/',auth[_0xe27d('0xb')](),controller[_0xe27d('0xf')]);router[_0xe27d('0x10')](_0xe27d('0xd'),auth[_0xe27d('0xb')](),controller[_0xe27d('0x11')]);router[_0xe27d('0x12')]('/:id',auth[_0xe27d('0xb')](),controller['destroy']);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 ec4866a..4d4b872 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 _0xa58d=['externip','STRING','sequelize','exports','ENUM','localnet'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa58d,0x1d6));var _0xda58=function(_0x4b45a1,_0x3c35f9){_0x4b45a1=_0x4b45a1-0x0;var _0x1af025=_0xa58d[_0x4b45a1];return _0x1af025;};'use strict';var Sequelize=require(_0xda58('0x0'));module[_0xda58('0x1')]={'type':{'type':Sequelize[_0xda58('0x2')](_0xda58('0x3'),_0xda58('0x4'),'stun','turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xda58('0x5')]}}; \ No newline at end of file +var _0x1327=['turn','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1327,0x17c));var _0x7132=function(_0x2f715a,_0x515c5c){_0x2f715a=_0x2f715a-0x0;var _0x2aed7b=_0x1327[_0x2f715a];return _0x2aed7b;};'use strict';var Sequelize=require(_0x7132('0x0'));module[_0x7132('0x1')]={'type':{'type':Sequelize[_0x7132('0x2')](_0x7132('0x3'),_0x7132('0x4'),'stun',_0x7132('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7132('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 4e1963c..7c13ee0 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 _0xe3a5=['filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','keys','includeAll','find','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','writeFileSync','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','utf8','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','params','/etc/asterisk/stun_xcally.conf','Reload','toLowerCase','path','lodash','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','Network,\x20%s,\x20%s','message','info','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xe3a5,0xc6));var _0x5e3a=function(_0x4a4fb1,_0x5a6edd){_0x4a4fb1=_0x4a4fb1-0x0;var _0x20161b=_0xe3a5[_0x4a4fb1];return _0x20161b;};'use strict';var util=require('util');var path=require(_0x5e3a('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5e3a('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x5e3a('0x2'))('api');var config=require(_0x5e3a('0x3'));var db=require(_0x5e3a('0x4'))['db'];var jayson=require(_0x5e3a('0x5'));var client=jayson['client'][_0x5e3a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3b0176,_0x1d02f9,_0x20d4d1,_0x464c23){return new Promise(function(_0xff77df,_0x557457){var _0x50f55f=_0x464c23||client;return _0x50f55f[_0x5e3a('0x7')](_0x3b0176,_0x20d4d1)[_0x5e3a('0x8')](function(_0x392af6){logger['info']('Network,\x20%s,\x20%s',_0x1d02f9,_0x5e3a('0x9'));logger[_0x5e3a('0xa')]('Network,\x20%s,\x20%s,\x20%s',_0x1d02f9,_0x5e3a('0x9'),JSON[_0x5e3a('0xb')](_0x392af6));if(_0x392af6[_0x5e3a('0xc')]){if(_0x392af6[_0x5e3a('0xc')]['code']===0x1f4){logger[_0x5e3a('0xc')](_0x5e3a('0xd'),_0x1d02f9,_0x392af6['error'][_0x5e3a('0xe')]);return _0x557457(_0x392af6[_0x5e3a('0xc')][_0x5e3a('0xe')]);}logger[_0x5e3a('0xc')]('Network,\x20%s,\x20%s',_0x1d02f9,_0x392af6[_0x5e3a('0xc')][_0x5e3a('0xe')]);return _0xff77df(_0x392af6[_0x5e3a('0xc')]['message']);}else{logger[_0x5e3a('0xf')]('Network,\x20%s,\x20%s',_0x1d02f9,_0x5e3a('0x9'));_0xff77df(_0x392af6['result'][_0x5e3a('0xe')]);}})[_0x5e3a('0x10')](function(_0x5ef099){logger[_0x5e3a('0xc')]('Network,\x20%s,\x20%s',_0x1d02f9,_0x5ef099);_0x557457(_0x5ef099);});});}function respondWithResult(_0x2deb69,_0x2a4dd2){_0x2a4dd2=_0x2a4dd2||0xc8;return function(_0x5d829b){if(_0x5d829b){return _0x2deb69[_0x5e3a('0x11')](_0x2a4dd2)[_0x5e3a('0x12')](_0x5d829b);}};}function respondWithFilteredResult(_0x582eab,_0x64cf3f){return function(_0x45c4fe){if(_0x45c4fe){var _0x12e8f0=typeof _0x64cf3f[_0x5e3a('0x13')]===_0x5e3a('0x14')&&typeof _0x64cf3f['limit']===_0x5e3a('0x14');var _0x983c23=_0x45c4fe[_0x5e3a('0x15')];var _0x1cd7dd=_0x12e8f0?0x0:_0x64cf3f[_0x5e3a('0x13')];var _0xf8b328=_0x12e8f0?_0x45c4fe[_0x5e3a('0x15')]:_0x64cf3f[_0x5e3a('0x13')]+_0x64cf3f[_0x5e3a('0x16')];var _0x5747d8;if(_0xf8b328>=_0x983c23){_0xf8b328=_0x983c23;_0x5747d8=0xc8;}else{_0x5747d8=0xce;}_0x582eab[_0x5e3a('0x11')](_0x5747d8);return _0x582eab[_0x5e3a('0x17')](_0x5e3a('0x18'),_0x1cd7dd+'-'+_0xf8b328+'/'+_0x983c23)['json'](_0x45c4fe);}return null;};}function saveUpdates(_0x17b653){return function(_0x352bb4){if(_0x352bb4){return _0x352bb4[_0x5e3a('0x19')](_0x17b653)[_0x5e3a('0x8')](function(_0x34a3a5){return _0x34a3a5;});}return null;};}function removeEntity(_0x31f6a){return function(_0x488918){if(_0x488918){return _0x488918[_0x5e3a('0x1a')]()[_0x5e3a('0x8')](function(){_0x31f6a[_0x5e3a('0x11')](0xcc)[_0x5e3a('0x1b')]();});}};}function handleEntityNotFound(_0x5119ce){return function(_0x5ae483){if(!_0x5ae483){_0x5119ce[_0x5e3a('0x1c')](0x194);}return _0x5ae483;};}function handleError(_0x43a5df,_0x441e0b){_0x441e0b=_0x441e0b||0x1f4;return function(_0xf48071){logger['error'](_0xf48071[_0x5e3a('0x1d')]);if(_0xf48071[_0x5e3a('0x1e')]){delete _0xf48071['name'];}_0x43a5df[_0x5e3a('0x11')](_0x441e0b)[_0x5e3a('0x1f')](_0xf48071);};}exports[_0x5e3a('0x20')]=function(_0x34685c,_0x335fff){var _0x32ce9c={},_0x3ef7e9={},_0x5a90cc={'count':0x0,'rows':[]};var _0x57536d=_[_0x5e3a('0x21')](db[_0x5e3a('0x22')][_0x5e3a('0x23')],function(_0x1772d1){return{'name':_0x1772d1[_0x5e3a('0x24')],'type':_0x1772d1[_0x5e3a('0x25')][_0x5e3a('0x26')]};});_0x3ef7e9['model']=_[_0x5e3a('0x21')](_0x57536d,_0x5e3a('0x1e'));_0x3ef7e9[_0x5e3a('0x27')]=_['keys'](_0x34685c[_0x5e3a('0x27')]);_0x3ef7e9['filters']=_[_0x5e3a('0x28')](_0x3ef7e9[_0x5e3a('0x29')],_0x3ef7e9[_0x5e3a('0x27')]);_0x32ce9c[_0x5e3a('0x2a')]=_[_0x5e3a('0x28')](_0x3ef7e9['model'],qs[_0x5e3a('0x2b')](_0x34685c[_0x5e3a('0x27')]['fields']));_0x32ce9c[_0x5e3a('0x2a')]=_0x32ce9c['attributes']['length']?_0x32ce9c['attributes']:_0x3ef7e9[_0x5e3a('0x29')];if(!_0x34685c['query'][_0x5e3a('0x2c')](_0x5e3a('0x2d'))){_0x32ce9c[_0x5e3a('0x16')]=qs['limit'](_0x34685c[_0x5e3a('0x27')][_0x5e3a('0x16')]);_0x32ce9c[_0x5e3a('0x13')]=qs['offset'](_0x34685c[_0x5e3a('0x27')][_0x5e3a('0x13')]);}_0x32ce9c[_0x5e3a('0x2e')]=qs[_0x5e3a('0x2f')](_0x34685c[_0x5e3a('0x27')]['sort']);_0x32ce9c['where']=qs[_0x5e3a('0x30')](_['pick'](_0x34685c[_0x5e3a('0x27')],_0x3ef7e9[_0x5e3a('0x30')]),_0x57536d);if(_0x34685c[_0x5e3a('0x27')][_0x5e3a('0x31')]){_0x32ce9c[_0x5e3a('0x32')]=_[_0x5e3a('0x33')](_0x32ce9c[_0x5e3a('0x32')],{'$or':_[_0x5e3a('0x21')](_0x57536d,function(_0x1f746f){if(_0x1f746f['type']!==_0x5e3a('0x34')){var _0x490011={};_0x490011[_0x1f746f['name']]={'$like':'%'+_0x34685c['query'][_0x5e3a('0x31')]+'%'};return _0x490011;}})});}_0x32ce9c=_[_0x5e3a('0x33')]({},_0x32ce9c,_0x34685c[_0x5e3a('0x35')]);var _0x1e522a={'where':_0x32ce9c[_0x5e3a('0x32')]};return db[_0x5e3a('0x22')]['count'](_0x1e522a)[_0x5e3a('0x8')](function(_0x578ad6){_0x5a90cc[_0x5e3a('0x15')]=_0x578ad6;if(_0x34685c['query']['includeAll']){_0x32ce9c[_0x5e3a('0x36')]=[{'all':!![]}];}return db[_0x5e3a('0x22')][_0x5e3a('0x37')](_0x32ce9c);})[_0x5e3a('0x8')](function(_0x47c3ac){_0x5a90cc[_0x5e3a('0x38')]=_0x47c3ac;return _0x5a90cc;})['then'](respondWithFilteredResult(_0x335fff,_0x32ce9c))[_0x5e3a('0x10')](handleError(_0x335fff,null));};exports['show']=function(_0x1f4b61,_0x165e87){var _0xdd53e2={'raw':!![],'where':{'id':_0x1f4b61['params']['id']}},_0x7d6853={};_0x7d6853['model']=_['keys'](db['Network'][_0x5e3a('0x23')]);_0x7d6853['query']=_[_0x5e3a('0x39')](_0x1f4b61['query']);_0x7d6853[_0x5e3a('0x30')]=_['intersection'](_0x7d6853['model'],_0x7d6853['query']);_0xdd53e2['attributes']=_[_0x5e3a('0x28')](_0x7d6853[_0x5e3a('0x29')],qs[_0x5e3a('0x2b')](_0x1f4b61[_0x5e3a('0x27')][_0x5e3a('0x2b')]));_0xdd53e2['attributes']=_0xdd53e2[_0x5e3a('0x2a')]['length']?_0xdd53e2[_0x5e3a('0x2a')]:_0x7d6853[_0x5e3a('0x29')];if(_0x1f4b61[_0x5e3a('0x27')][_0x5e3a('0x3a')]){_0xdd53e2[_0x5e3a('0x36')]=[{'all':!![]}];}_0xdd53e2=_[_0x5e3a('0x33')]({},_0xdd53e2,_0x1f4b61['options']);return db[_0x5e3a('0x22')][_0x5e3a('0x3b')](_0xdd53e2)['then'](handleEntityNotFound(_0x165e87,null))[_0x5e3a('0x8')](respondWithResult(_0x165e87,null))[_0x5e3a('0x10')](handleError(_0x165e87,null));};exports[_0x5e3a('0x3c')]=function(_0x372b36,_0x4d467b){var _0x360a38;return db[_0x5e3a('0x22')]['create'](_0x372b36[_0x5e3a('0x3d')],{'raw':!![]})[_0x5e3a('0x8')](function(_0x36b060){_0x360a38=_0x36b060;return db[_0x5e3a('0x22')]['findAll']({'where':{'type':_0x372b36['body']['type']},'raw':!![]});})['then'](function(_0x2c6878){if(_0x360a38[_0x5e3a('0x25')]['toUpperCase']()==_0x5e3a('0x3e')){var _0x4a2c61=fs[_0x5e3a('0x3f')](path[_0x5e3a('0x40')](config[_0x5e3a('0x41')],_0x5e3a('0x42')),'utf8');var _0x1b3772=ejs['render'](_0x4a2c61,{'networks':_0x2c6878||[]});fs[_0x5e3a('0x43')]('/etc/asterisk/stun_xcally.conf',_0x1b3772);return respondWithRpcPromise('Reload',_0x5e3a('0x3c'),{'module':_0x5e3a('0x44')});}else if(_0x360a38['type'][_0x5e3a('0x45')]()==_0x5e3a('0x46')){var _0x9587a8=fs[_0x5e3a('0x3f')](path[_0x5e3a('0x40')](config[_0x5e3a('0x41')],_0x5e3a('0x47')),_0x5e3a('0x48'));var _0x2098d6=ejs[_0x5e3a('0x49')](_0x9587a8,{'networks':_0x2c6878||[]});fs['writeFileSync'](_0x5e3a('0x4a'),_0x2098d6);return respondWithRpcPromise('Reload',_0x5e3a('0x3c'),{'module':_0x5e3a('0x44')});}else{var _0x7df294=fs[_0x5e3a('0x3f')](path[_0x5e3a('0x40')](config['root'],_0x5e3a('0x4b')),_0x5e3a('0x48'));var _0x49b573=ejs[_0x5e3a('0x49')](_0x7df294,{'networks':_0x2c6878||[]});fs[_0x5e3a('0x43')](util[_0x5e3a('0x4c')](_0x5e3a('0x4d'),_0x372b36[_0x5e3a('0x3d')][_0x5e3a('0x25')]['toLowerCase']()),_0x49b573);return respondWithRpcPromise('Reload',_0x5e3a('0x3c'),{'module':'chan_sip.so'});}})['then'](function(){return _0x360a38;})[_0x5e3a('0x8')](respondWithResult(_0x4d467b,0xc9))[_0x5e3a('0x10')](handleError(_0x4d467b,null));};exports[_0x5e3a('0x19')]=function(_0x5636e8,_0x18629b){var _0x2a09dd;return db[_0x5e3a('0x22')][_0x5e3a('0x3b')]({'where':{'id':_0x5636e8[_0x5e3a('0x4e')]['id']}})[_0x5e3a('0x8')](handleEntityNotFound(_0x18629b,null))[_0x5e3a('0x8')](saveUpdates(_0x5636e8['body'],null))[_0x5e3a('0x8')](function(_0x496dfe){if(_0x496dfe){_0x2a09dd=_0x496dfe;return db[_0x5e3a('0x22')][_0x5e3a('0x37')]({'where':{'type':_0x2a09dd[_0x5e3a('0x25')]},'raw':!![]});}return null;})[_0x5e3a('0x8')](function(_0x420dee){if(_0x2a09dd[_0x5e3a('0x25')][_0x5e3a('0x45')]()=='STUN'){var _0x5eede1=fs[_0x5e3a('0x3f')](path[_0x5e3a('0x40')](config[_0x5e3a('0x41')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x122f56=ejs[_0x5e3a('0x49')](_0x5eede1,{'networks':_0x420dee||[]});fs[_0x5e3a('0x43')](_0x5e3a('0x4f'),_0x122f56);return respondWithRpcPromise(_0x5e3a('0x50'),_0x5e3a('0x19'),{'module':_0x5e3a('0x44')});}else if(_0x2a09dd[_0x5e3a('0x25')][_0x5e3a('0x45')]()==_0x5e3a('0x46')){var _0x5351f2=fs[_0x5e3a('0x3f')](path[_0x5e3a('0x40')](config['root'],_0x5e3a('0x47')),_0x5e3a('0x48'));var _0xc0cadd=ejs[_0x5e3a('0x49')](_0x5351f2,{'networks':_0x420dee||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xc0cadd);return respondWithRpcPromise(_0x5e3a('0x50'),_0x5e3a('0x19'),{'module':_0x5e3a('0x44')});}else{var _0xa7a9ff=fs[_0x5e3a('0x3f')](path['join'](config[_0x5e3a('0x41')],_0x5e3a('0x4b')),_0x5e3a('0x48'));var _0xba138c=ejs['render'](_0xa7a9ff,{'networks':_0x420dee||[]});fs['writeFileSync'](util[_0x5e3a('0x4c')](_0x5e3a('0x4d'),_0x5636e8[_0x5e3a('0x3d')][_0x5e3a('0x25')][_0x5e3a('0x51')]()),_0xba138c);return respondWithRpcPromise(_0x5e3a('0x50'),_0x5e3a('0x19'),{'module':'chan_sip.so'});}})[_0x5e3a('0x8')](function(_0x2a82e1){if(_0x2a82e1){return _0x2a09dd;}return null;})[_0x5e3a('0x8')](respondWithResult(_0x18629b,null))[_0x5e3a('0x10')](handleError(_0x18629b,null));};exports[_0x5e3a('0x1a')]=function(_0x56b8f6,_0x3e943b){var _0x5385b4;return db[_0x5e3a('0x22')]['find']({'where':{'id':_0x56b8f6[_0x5e3a('0x4e')]['id']}})['then'](function(_0x371f9c){_0x5385b4=_0x371f9c;return _0x371f9c;})[_0x5e3a('0x8')](handleEntityNotFound(_0x3e943b,null))[_0x5e3a('0x8')](removeEntity(_0x3e943b,null))[_0x5e3a('0x8')](function(){if(_0x5385b4){return db[_0x5e3a('0x22')]['findAll']({'where':{'type':_0x5385b4[_0x5e3a('0x25')]},'raw':!![]});}})['then'](function(_0x2e4134){if(_0x5385b4['type'][_0x5e3a('0x45')]()=='STUN'){var _0x2d7bb6=fs[_0x5e3a('0x3f')](path[_0x5e3a('0x40')](config[_0x5e3a('0x41')],_0x5e3a('0x42')),_0x5e3a('0x48'));var _0x388989=ejs[_0x5e3a('0x49')](_0x2d7bb6,{'networks':_0x2e4134||[]});fs[_0x5e3a('0x43')](_0x5e3a('0x4f'),_0x388989);return respondWithRpcPromise(_0x5e3a('0x50'),_0x5e3a('0x1a'),{'module':'res_stun_monitor.so'});}else if(_0x5385b4[_0x5e3a('0x25')][_0x5e3a('0x45')]()=='TURN'){var _0x429f49=fs['readFileSync'](path['join'](config[_0x5e3a('0x41')],_0x5e3a('0x47')),_0x5e3a('0x48'));var _0x294d60=ejs['render'](_0x429f49,{'networks':_0x2e4134||[]});fs[_0x5e3a('0x43')](_0x5e3a('0x4a'),_0x294d60);return respondWithRpcPromise(_0x5e3a('0x50'),'destroy',{'module':_0x5e3a('0x44')});}else{var _0x146610=fs['readFileSync'](path[_0x5e3a('0x40')](config[_0x5e3a('0x41')],'server/files/templates/network.ejs'),_0x5e3a('0x48'));var _0x904968=ejs[_0x5e3a('0x49')](_0x146610,{'networks':_0x2e4134||[]});fs[_0x5e3a('0x43')](util[_0x5e3a('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x5385b4[_0x5e3a('0x25')][_0x5e3a('0x51')]()),_0x904968);return respondWithRpcPromise('Reload',_0x5e3a('0x1a'),{'module':'chan_sip.so'});}})[_0x5e3a('0x10')](handleError(_0x3e943b,null));}; \ No newline at end of file +var _0xbd0f=['index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','VIRTUAL','Network','includeAll','include','findAll','rows','keys','length','find','create','body','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','res_stun_monitor.so','TURN','root','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','chan_sip.so','update','STUN','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','destroy','end','sendStatus','stack','name','send'];(function(_0x4cc017,_0x43eecf){var _0x477041=function(_0x3a1fb7){while(--_0x3a1fb7){_0x4cc017['push'](_0x4cc017['shift']());}};_0x477041(++_0x43eecf);}(_0xbd0f,0x13a));var _0xfbd0=function(_0x16a6e2,_0x5279e3){_0x16a6e2=_0x16a6e2-0x0;var _0x2faa87=_0xbd0f[_0x16a6e2];return _0x2faa87;};'use strict';var util=require(_0xfbd0('0x0'));var path=require(_0xfbd0('0x1'));var ejs=require(_0xfbd0('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0xfbd0('0x3'));var logger=require(_0xfbd0('0x4'))(_0xfbd0('0x5'));var config=require(_0xfbd0('0x6'));var db=require(_0xfbd0('0x7'))['db'];var jayson=require(_0xfbd0('0x8'));var client=jayson[_0xfbd0('0x9')][_0xfbd0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab700,_0x3b14cb,_0x118615,_0x13a330){return new Promise(function(_0x54df2e,_0x555fa3){var _0x5722d3=_0x13a330||client;return _0x5722d3[_0xfbd0('0xb')](_0x1ab700,_0x118615)[_0xfbd0('0xc')](function(_0x1a5e7d){logger[_0xfbd0('0xd')](_0xfbd0('0xe'),_0x3b14cb,_0xfbd0('0xf'));logger[_0xfbd0('0x10')](_0xfbd0('0x11'),_0x3b14cb,_0xfbd0('0xf'),JSON[_0xfbd0('0x12')](_0x1a5e7d));if(_0x1a5e7d[_0xfbd0('0x13')]){if(_0x1a5e7d[_0xfbd0('0x13')][_0xfbd0('0x14')]===0x1f4){logger[_0xfbd0('0x13')]('Network,\x20%s,\x20%s',_0x3b14cb,_0x1a5e7d[_0xfbd0('0x13')][_0xfbd0('0x15')]);return _0x555fa3(_0x1a5e7d['error'][_0xfbd0('0x15')]);}logger['error'](_0xfbd0('0xe'),_0x3b14cb,_0x1a5e7d[_0xfbd0('0x13')][_0xfbd0('0x15')]);return _0x54df2e(_0x1a5e7d[_0xfbd0('0x13')][_0xfbd0('0x15')]);}else{logger['info'](_0xfbd0('0xe'),_0x3b14cb,_0xfbd0('0xf'));_0x54df2e(_0x1a5e7d[_0xfbd0('0x16')]['message']);}})[_0xfbd0('0x17')](function(_0x20497b){logger[_0xfbd0('0x13')](_0xfbd0('0xe'),_0x3b14cb,_0x20497b);_0x555fa3(_0x20497b);});});}function respondWithResult(_0x3538d5,_0x505324){_0x505324=_0x505324||0xc8;return function(_0x13cd7f){if(_0x13cd7f){return _0x3538d5[_0xfbd0('0x18')](_0x505324)[_0xfbd0('0x19')](_0x13cd7f);}};}function respondWithFilteredResult(_0x1f2c7,_0x212194){return function(_0x5c5f92){if(_0x5c5f92){var _0x57d84a=typeof _0x212194[_0xfbd0('0x1a')]==='undefined'&&typeof _0x212194['limit']===_0xfbd0('0x1b');var _0x2eaed0=_0x5c5f92[_0xfbd0('0x1c')];var _0x5c0a55=_0x57d84a?0x0:_0x212194[_0xfbd0('0x1a')];var _0x3b7da4=_0x57d84a?_0x5c5f92['count']:_0x212194[_0xfbd0('0x1a')]+_0x212194[_0xfbd0('0x1d')];var _0x1dbd4f;if(_0x3b7da4>=_0x2eaed0){_0x3b7da4=_0x2eaed0;_0x1dbd4f=0xc8;}else{_0x1dbd4f=0xce;}_0x1f2c7[_0xfbd0('0x18')](_0x1dbd4f);return _0x1f2c7[_0xfbd0('0x1e')](_0xfbd0('0x1f'),_0x5c0a55+'-'+_0x3b7da4+'/'+_0x2eaed0)[_0xfbd0('0x19')](_0x5c5f92);}return null;};}function saveUpdates(_0x457670){return function(_0x312d31){if(_0x312d31){return _0x312d31['update'](_0x457670)[_0xfbd0('0xc')](function(_0x4a26ca){return _0x4a26ca;});}return null;};}function removeEntity(_0x3f89c3){return function(_0x12fdc8){if(_0x12fdc8){return _0x12fdc8[_0xfbd0('0x20')]()[_0xfbd0('0xc')](function(){_0x3f89c3[_0xfbd0('0x18')](0xcc)[_0xfbd0('0x21')]();});}};}function handleEntityNotFound(_0x29aa9f){return function(_0x592975){if(!_0x592975){_0x29aa9f[_0xfbd0('0x22')](0x194);}return _0x592975;};}function handleError(_0x1a3d8,_0x466ce5){_0x466ce5=_0x466ce5||0x1f4;return function(_0x53db44){logger[_0xfbd0('0x13')](_0x53db44[_0xfbd0('0x23')]);if(_0x53db44[_0xfbd0('0x24')]){delete _0x53db44['name'];}_0x1a3d8[_0xfbd0('0x18')](_0x466ce5)[_0xfbd0('0x25')](_0x53db44);};}exports[_0xfbd0('0x26')]=function(_0x30628c,_0x276b5e){var _0x319441={},_0x2dc374={},_0x16a4ce={'count':0x0,'rows':[]};var _0x261d9f=_[_0xfbd0('0x27')](db['Network'][_0xfbd0('0x28')],function(_0x2713fc){return{'name':_0x2713fc[_0xfbd0('0x29')],'type':_0x2713fc[_0xfbd0('0x2a')][_0xfbd0('0x2b')]};});_0x2dc374[_0xfbd0('0x2c')]=_[_0xfbd0('0x27')](_0x261d9f,_0xfbd0('0x24'));_0x2dc374[_0xfbd0('0x2d')]=_['keys'](_0x30628c[_0xfbd0('0x2d')]);_0x2dc374[_0xfbd0('0x2e')]=_[_0xfbd0('0x2f')](_0x2dc374[_0xfbd0('0x2c')],_0x2dc374[_0xfbd0('0x2d')]);_0x319441['attributes']=_['intersection'](_0x2dc374[_0xfbd0('0x2c')],qs[_0xfbd0('0x30')](_0x30628c[_0xfbd0('0x2d')][_0xfbd0('0x30')]));_0x319441['attributes']=_0x319441[_0xfbd0('0x31')]['length']?_0x319441[_0xfbd0('0x31')]:_0x2dc374['model'];if(!_0x30628c['query']['hasOwnProperty']('nolimit')){_0x319441['limit']=qs[_0xfbd0('0x1d')](_0x30628c['query'][_0xfbd0('0x1d')]);_0x319441[_0xfbd0('0x1a')]=qs['offset'](_0x30628c[_0xfbd0('0x2d')]['offset']);}_0x319441[_0xfbd0('0x32')]=qs[_0xfbd0('0x33')](_0x30628c[_0xfbd0('0x2d')][_0xfbd0('0x33')]);_0x319441['where']=qs[_0xfbd0('0x2e')](_[_0xfbd0('0x34')](_0x30628c[_0xfbd0('0x2d')],_0x2dc374[_0xfbd0('0x2e')]),_0x261d9f);if(_0x30628c[_0xfbd0('0x2d')][_0xfbd0('0x35')]){_0x319441[_0xfbd0('0x36')]=_[_0xfbd0('0x37')](_0x319441[_0xfbd0('0x36')],{'$or':_['map'](_0x261d9f,function(_0x1394ab){if(_0x1394ab[_0xfbd0('0x2a')]!==_0xfbd0('0x38')){var _0x372571={};_0x372571[_0x1394ab[_0xfbd0('0x24')]]={'$like':'%'+_0x30628c['query'][_0xfbd0('0x35')]+'%'};return _0x372571;}})});}_0x319441=_[_0xfbd0('0x37')]({},_0x319441,_0x30628c['options']);var _0x3cf912={'where':_0x319441[_0xfbd0('0x36')]};return db[_0xfbd0('0x39')][_0xfbd0('0x1c')](_0x3cf912)[_0xfbd0('0xc')](function(_0x5f562d){_0x16a4ce[_0xfbd0('0x1c')]=_0x5f562d;if(_0x30628c[_0xfbd0('0x2d')][_0xfbd0('0x3a')]){_0x319441[_0xfbd0('0x3b')]=[{'all':!![]}];}return db[_0xfbd0('0x39')][_0xfbd0('0x3c')](_0x319441);})['then'](function(_0x239d51){_0x16a4ce[_0xfbd0('0x3d')]=_0x239d51;return _0x16a4ce;})[_0xfbd0('0xc')](respondWithFilteredResult(_0x276b5e,_0x319441))[_0xfbd0('0x17')](handleError(_0x276b5e,null));};exports['show']=function(_0x1f14ba,_0x347733){var _0x9967e1={'raw':!![],'where':{'id':_0x1f14ba['params']['id']}},_0x3be9b7={};_0x3be9b7[_0xfbd0('0x2c')]=_[_0xfbd0('0x3e')](db[_0xfbd0('0x39')][_0xfbd0('0x28')]);_0x3be9b7[_0xfbd0('0x2d')]=_[_0xfbd0('0x3e')](_0x1f14ba[_0xfbd0('0x2d')]);_0x3be9b7[_0xfbd0('0x2e')]=_[_0xfbd0('0x2f')](_0x3be9b7[_0xfbd0('0x2c')],_0x3be9b7[_0xfbd0('0x2d')]);_0x9967e1['attributes']=_['intersection'](_0x3be9b7[_0xfbd0('0x2c')],qs[_0xfbd0('0x30')](_0x1f14ba[_0xfbd0('0x2d')][_0xfbd0('0x30')]));_0x9967e1['attributes']=_0x9967e1[_0xfbd0('0x31')][_0xfbd0('0x3f')]?_0x9967e1[_0xfbd0('0x31')]:_0x3be9b7['model'];if(_0x1f14ba[_0xfbd0('0x2d')][_0xfbd0('0x3a')]){_0x9967e1[_0xfbd0('0x3b')]=[{'all':!![]}];}_0x9967e1=_['merge']({},_0x9967e1,_0x1f14ba['options']);return db[_0xfbd0('0x39')][_0xfbd0('0x40')](_0x9967e1)[_0xfbd0('0xc')](handleEntityNotFound(_0x347733,null))[_0xfbd0('0xc')](respondWithResult(_0x347733,null))['catch'](handleError(_0x347733,null));};exports[_0xfbd0('0x41')]=function(_0x45dacc,_0x25d3f1){var _0x38d15c;return db[_0xfbd0('0x39')][_0xfbd0('0x41')](_0x45dacc[_0xfbd0('0x42')],{'raw':!![]})[_0xfbd0('0xc')](function(_0x1fc740){_0x38d15c=_0x1fc740;return db[_0xfbd0('0x39')]['findAll']({'where':{'type':_0x45dacc['body'][_0xfbd0('0x2a')]},'raw':!![]});})['then'](function(_0x291ca8){if(_0x38d15c[_0xfbd0('0x2a')][_0xfbd0('0x43')]()=='STUN'){var _0x50a3f7=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config['root'],_0xfbd0('0x46')),_0xfbd0('0x47'));var _0x1c68c3=ejs[_0xfbd0('0x48')](_0x50a3f7,{'networks':_0x291ca8||[]});fs[_0xfbd0('0x49')]('/etc/asterisk/stun_xcally.conf',_0x1c68c3);return respondWithRpcPromise('Reload','create',{'module':_0xfbd0('0x4a')});}else if(_0x38d15c[_0xfbd0('0x2a')][_0xfbd0('0x43')]()==_0xfbd0('0x4b')){var _0x2423dd=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config[_0xfbd0('0x4c')],'server/files/templates/turn_multiple.ejs'),_0xfbd0('0x47'));var _0x98286d=ejs['render'](_0x2423dd,{'networks':_0x291ca8||[]});fs[_0xfbd0('0x49')](_0xfbd0('0x4d'),_0x98286d);return respondWithRpcPromise(_0xfbd0('0x4e'),_0xfbd0('0x41'),{'module':_0xfbd0('0x4a')});}else{var _0xbc8e83=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config['root'],_0xfbd0('0x4f')),_0xfbd0('0x47'));var _0x9c1779=ejs['render'](_0xbc8e83,{'networks':_0x291ca8||[]});fs[_0xfbd0('0x49')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x45dacc[_0xfbd0('0x42')]['type']['toLowerCase']()),_0x9c1779);return respondWithRpcPromise(_0xfbd0('0x4e'),_0xfbd0('0x41'),{'module':_0xfbd0('0x50')});}})['then'](function(){return _0x38d15c;})[_0xfbd0('0xc')](respondWithResult(_0x25d3f1,0xc9))[_0xfbd0('0x17')](handleError(_0x25d3f1,null));};exports[_0xfbd0('0x51')]=function(_0x51d31b,_0x20e567){var _0x367859;return db[_0xfbd0('0x39')][_0xfbd0('0x40')]({'where':{'id':_0x51d31b['params']['id']}})[_0xfbd0('0xc')](handleEntityNotFound(_0x20e567,null))[_0xfbd0('0xc')](saveUpdates(_0x51d31b[_0xfbd0('0x42')],null))[_0xfbd0('0xc')](function(_0x43463d){if(_0x43463d){_0x367859=_0x43463d;return db[_0xfbd0('0x39')][_0xfbd0('0x3c')]({'where':{'type':_0x367859['type']},'raw':!![]});}return null;})[_0xfbd0('0xc')](function(_0x1c1a1b){if(_0x367859[_0xfbd0('0x2a')][_0xfbd0('0x43')]()==_0xfbd0('0x52')){var _0x287566=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config[_0xfbd0('0x4c')],'server/files/templates/stun_multiple.ejs'),_0xfbd0('0x47'));var _0x1fc8df=ejs[_0xfbd0('0x48')](_0x287566,{'networks':_0x1c1a1b||[]});fs[_0xfbd0('0x49')](_0xfbd0('0x53'),_0x1fc8df);return respondWithRpcPromise(_0xfbd0('0x4e'),_0xfbd0('0x51'),{'module':_0xfbd0('0x4a')});}else if(_0x367859['type'][_0xfbd0('0x43')]()==_0xfbd0('0x4b')){var _0x41b5e0=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config[_0xfbd0('0x4c')],_0xfbd0('0x54')),_0xfbd0('0x47'));var _0x3f2b25=ejs[_0xfbd0('0x48')](_0x41b5e0,{'networks':_0x1c1a1b||[]});fs[_0xfbd0('0x49')](_0xfbd0('0x4d'),_0x3f2b25);return respondWithRpcPromise(_0xfbd0('0x4e'),_0xfbd0('0x51'),{'module':_0xfbd0('0x4a')});}else{var _0x332518=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config['root'],_0xfbd0('0x4f')),_0xfbd0('0x47'));var _0x30a0cd=ejs['render'](_0x332518,{'networks':_0x1c1a1b||[]});fs['writeFileSync'](util[_0xfbd0('0x55')](_0xfbd0('0x56'),_0x51d31b['body'][_0xfbd0('0x2a')][_0xfbd0('0x57')]()),_0x30a0cd);return respondWithRpcPromise('Reload',_0xfbd0('0x51'),{'module':_0xfbd0('0x50')});}})['then'](function(_0x776257){if(_0x776257){return _0x367859;}return null;})['then'](respondWithResult(_0x20e567,null))['catch'](handleError(_0x20e567,null));};exports[_0xfbd0('0x20')]=function(_0x1378d1,_0x49020a){var _0x9dbcb2;return db[_0xfbd0('0x39')]['find']({'where':{'id':_0x1378d1['params']['id']}})[_0xfbd0('0xc')](function(_0x16f917){_0x9dbcb2=_0x16f917;return _0x16f917;})[_0xfbd0('0xc')](handleEntityNotFound(_0x49020a,null))[_0xfbd0('0xc')](removeEntity(_0x49020a,null))[_0xfbd0('0xc')](function(){if(_0x9dbcb2){return db['Network'][_0xfbd0('0x3c')]({'where':{'type':_0x9dbcb2[_0xfbd0('0x2a')]},'raw':!![]});}})[_0xfbd0('0xc')](function(_0x297c1a){if(_0x9dbcb2[_0xfbd0('0x2a')][_0xfbd0('0x43')]()=='STUN'){var _0x407e8a=fs['readFileSync'](path[_0xfbd0('0x45')](config[_0xfbd0('0x4c')],_0xfbd0('0x46')),'utf8');var _0x5581a7=ejs[_0xfbd0('0x48')](_0x407e8a,{'networks':_0x297c1a||[]});fs[_0xfbd0('0x49')]('/etc/asterisk/stun_xcally.conf',_0x5581a7);return respondWithRpcPromise(_0xfbd0('0x4e'),'destroy',{'module':_0xfbd0('0x4a')});}else if(_0x9dbcb2[_0xfbd0('0x2a')][_0xfbd0('0x43')]()==_0xfbd0('0x4b')){var _0x505762=fs[_0xfbd0('0x44')](path['join'](config[_0xfbd0('0x4c')],_0xfbd0('0x54')),_0xfbd0('0x47'));var _0x5e1e64=ejs[_0xfbd0('0x48')](_0x505762,{'networks':_0x297c1a||[]});fs[_0xfbd0('0x49')]('/etc/asterisk/turn_xcally.conf',_0x5e1e64);return respondWithRpcPromise('Reload',_0xfbd0('0x20'),{'module':'res_stun_monitor.so'});}else{var _0x316aa6=fs[_0xfbd0('0x44')](path['join'](config[_0xfbd0('0x4c')],_0xfbd0('0x4f')),_0xfbd0('0x47'));var _0x4313e9=ejs['render'](_0x316aa6,{'networks':_0x297c1a||[]});fs[_0xfbd0('0x49')](util['format'](_0xfbd0('0x56'),_0x9dbcb2[_0xfbd0('0x2a')][_0xfbd0('0x57')]()),_0x4313e9);return respondWithRpcPromise('Reload',_0xfbd0('0x20'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x49020a,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 83416d1..6de287e 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 _0x9434=['api','moment','bluebird','path','rimraf','./network.attributes','exports','network','lodash','util','../../config/logger'];(function(_0x4586ff,_0x1873a5){var _0x2211b2=function(_0x1e51de){while(--_0x1e51de){_0x4586ff['push'](_0x4586ff['shift']());}};_0x2211b2(++_0x1873a5);}(_0x9434,0x168));var _0x4943=function(_0x795b66,_0x7a630a){_0x795b66=_0x795b66-0x0;var _0x92b560=_0x9434[_0x795b66];return _0x92b560;};'use strict';var _=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var logger=require(_0x4943('0x2'))(_0x4943('0x3'));var moment=require(_0x4943('0x4'));var BPromise=require(_0x4943('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4943('0x6'));var rimraf=require(_0x4943('0x7'));var config=require('../../config/environment');var attributes=require(_0x4943('0x8'));module[_0x4943('0x9')]=function(_0x4f930e,_0x394d9d){return _0x4f930e['define']('Network',attributes,{'tableName':_0x4943('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1752=['bluebird','request-promise','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','../../config/logger','api','moment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x1752,0xa5));var _0x2175=function(_0x192484,_0x3dd5b8){_0x192484=_0x192484-0x0;var _0x13bbaf=_0x1752[_0x192484];return _0x13bbaf;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var logger=require(_0x2175('0x1'))(_0x2175('0x2'));var moment=require(_0x2175('0x3'));var BPromise=require(_0x2175('0x4'));var rp=require(_0x2175('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2175('0x6'));var config=require(_0x2175('0x7'));var attributes=require(_0x2175('0x8'));module[_0x2175('0x9')]=function(_0x222868,_0x27ff0b){return _0x222868[_0x2175('0xa')](_0x2175('0xb'),attributes,{'tableName':_0x2175('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 8ae6c98..1eb48a8 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0xf41b55,_0x9fcd62){_0xf41b55=_0xf41b55-0x0;var _0x5251bd=_0x7a54[_0xf41b55];return _0x5251bd;};'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(_0x419cdb,_0x3e5687){var _0x1d4fca=function(_0x10bf21){while(--_0x10bf21){_0x419cdb['push'](_0x419cdb['shift']());}};_0x1d4fca(++_0x3e5687);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ac2ed9c..e8bb34a 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 _0x4387=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express'];(function(_0x16d0c5,_0x3a6355){var _0x1f17f7=function(_0x3936dc){while(--_0x3936dc){_0x16d0c5['push'](_0x16d0c5['shift']());}};_0x1f17f7(++_0x3a6355);}(_0x4387,0xf3));var _0x7438=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4387[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7438('0x0'));var timeout=require(_0x7438('0x1'));var express=require(_0x7438('0x2'));var router=express[_0x7438('0x3')]();var fs_extra=require(_0x7438('0x4'));var auth=require(_0x7438('0x5'));var interaction=require(_0x7438('0x6'));var config=require(_0x7438('0x7'));var controller=require(_0x7438('0x8'));router[_0x7438('0x9')]('/',auth[_0x7438('0xa')](),controller[_0x7438('0xb')]);router[_0x7438('0x9')](_0x7438('0xc'),auth[_0x7438('0xa')](),controller[_0x7438('0xd')]);router[_0x7438('0x9')](_0x7438('0xe'),auth[_0x7438('0xa')](),controller[_0x7438('0xf')]);router[_0x7438('0x9')](_0x7438('0x10'),auth[_0x7438('0xa')](),controller[_0x7438('0x11')]);router['get']('/:id/canned_answers',auth[_0x7438('0xa')](),controller['getAnswers']);router[_0x7438('0x9')](_0x7438('0x12'),auth[_0x7438('0xa')](),controller[_0x7438('0x13')]);router[_0x7438('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x7438('0x14')]);router['get'](_0x7438('0x15'),auth[_0x7438('0xa')](),controller[_0x7438('0x16')]);router['post']('/',auth[_0x7438('0xa')](),controller[_0x7438('0x17')]);router[_0x7438('0x18')](_0x7438('0x10'),auth['isAuthenticated'](),controller[_0x7438('0x19')]);router[_0x7438('0x18')](_0x7438('0x1a'),auth[_0x7438('0xa')](),controller[_0x7438('0x1b')]);router[_0x7438('0x18')](_0x7438('0x1c'),controller[_0x7438('0x1d')]);router[_0x7438('0x18')]('/:id/applications',auth[_0x7438('0xa')](),controller[_0x7438('0x1e')]);router[_0x7438('0x18')](_0x7438('0x15'),auth[_0x7438('0xa')](),controller[_0x7438('0x1f')]);router[_0x7438('0x18')](_0x7438('0x20'),auth[_0x7438('0xa')](),controller[_0x7438('0x21')]);router[_0x7438('0x22')]('/:id',auth[_0x7438('0xa')](),controller[_0x7438('0x23')]);router['delete']('/:id',auth[_0x7438('0xa')](),controller[_0x7438('0x24')]);router[_0x7438('0x25')](_0x7438('0x10'),auth['isAuthenticated'](),controller[_0x7438('0x26')]);router[_0x7438('0x25')](_0x7438('0x1a'),auth['isAuthenticated'](),controller[_0x7438('0x27')]);router[_0x7438('0x25')]('/:id/users',auth['isAuthenticated'](),controller[_0x7438('0x28')]);module['exports']=router; \ No newline at end of file +var _0x7e07=['post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents'];(function(_0x227c59,_0x575c83){var _0x35aeac=function(_0x477179){while(--_0x477179){_0x227c59['push'](_0x227c59['shift']());}};_0x35aeac(++_0x575c83);}(_0x7e07,0x151));var _0x77e0=function(_0x5e45e0,_0x3e7ea5){_0x5e45e0=_0x5e45e0-0x0;var _0x2d4bb1=_0x7e07[_0x5e45e0];return _0x2d4bb1;};'use strict';var multer=require(_0x77e0('0x0'));var util=require(_0x77e0('0x1'));var path=require(_0x77e0('0x2'));var timeout=require(_0x77e0('0x3'));var express=require(_0x77e0('0x4'));var router=express[_0x77e0('0x5')]();var fs_extra=require(_0x77e0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x77e0('0x7'));var config=require(_0x77e0('0x8'));var controller=require(_0x77e0('0x9'));router['get']('/',auth[_0x77e0('0xa')](),controller['index']);router[_0x77e0('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x77e0('0xc')]);router[_0x77e0('0xb')](_0x77e0('0xd'),auth[_0x77e0('0xa')](),controller['show']);router[_0x77e0('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x77e0('0xe')]);router[_0x77e0('0xb')](_0x77e0('0xf'),auth['isAuthenticated'](),controller[_0x77e0('0x10')]);router[_0x77e0('0xb')](_0x77e0('0x11'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x12')]);router[_0x77e0('0xb')](_0x77e0('0x13'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x14')]);router[_0x77e0('0xb')](_0x77e0('0x15'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x16')]);router[_0x77e0('0x17')]('/',auth[_0x77e0('0xa')](),controller[_0x77e0('0x18')]);router[_0x77e0('0x17')]('/:id/dispositions',auth[_0x77e0('0xa')](),controller[_0x77e0('0x19')]);router[_0x77e0('0x17')](_0x77e0('0xf'),auth['isAuthenticated'](),controller[_0x77e0('0x1a')]);router[_0x77e0('0x17')](_0x77e0('0x1b'),controller[_0x77e0('0x1c')]);router[_0x77e0('0x17')](_0x77e0('0x11'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x1d')]);router[_0x77e0('0x17')]('/:id/users',auth[_0x77e0('0xa')](),controller['addAgents']);router[_0x77e0('0x17')](_0x77e0('0x1e'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x1f')]);router[_0x77e0('0x20')](_0x77e0('0xd'),auth['isAuthenticated'](),controller[_0x77e0('0x21')]);router[_0x77e0('0x22')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x77e0('0x22')](_0x77e0('0x23'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x24')]);router[_0x77e0('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x77e0('0x25')]);router['delete'](_0x77e0('0x15'),auth['isAuthenticated'](),controller[_0x77e0('0x26')]);module[_0x77e0('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 84cfaa6..3bb1a2f 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 _0x1503=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x34a087,_0x4bd68e){var _0x5c15d7=function(_0x152823){while(--_0x152823){_0x34a087['push'](_0x34a087['shift']());}};_0x5c15d7(++_0x4bd68e);}(_0x1503,0x8d));var _0x3150=function(_0x4b1e6d,_0x30049c){_0x4b1e6d=_0x4b1e6d-0x0;var _0x21ee48=_0x1503[_0x4b1e6d];return _0x21ee48;};'use strict';var Sequelize=require(_0x3150('0x0'));var rs=require(_0x3150('0x1'));module[_0x3150('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x3150('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3150('0x4')]},'token':{'type':Sequelize[_0x3150('0x4')],'defaultValue':function(){return rs[_0x3150('0x5')]();}},'replyUri':{'type':Sequelize[_0x3150('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3150('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3150('0x6')],'defaultValue':function(){return _0x3150('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3150('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3150('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3150('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3150('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3150('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3150('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3150('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x3150('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3150('0xb'),'set':function(_0x5a1d2f){if(!_0x5a1d2f)this[_0x3150('0xc')](_0x3150('0xd'),null);this[_0x3150('0xc')](_0x3150('0xe'),_0x5a1d2f);}}}; \ No newline at end of file +var _0x2a96=['STRING','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x2a96,0x11b));var _0x62a9=function(_0x6e6158,_0x534892){_0x6e6158=_0x6e6158-0x0;var _0x366ca4=_0x2a96[_0x6e6158];return _0x366ca4;};'use strict';var Sequelize=require(_0x62a9('0x0'));var rs=require(_0x62a9('0x1'));module[_0x62a9('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x62a9('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x62a9('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x62a9('0x3')],'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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x62a9('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x62a9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x62a9('0x3')]},'queueTransfer':{'type':Sequelize[_0x62a9('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x62a9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x62a9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x62a9('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x62a9('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x62a9('0x5')],'defaultValue':![],'comment':_0x62a9('0x8'),'set':function(_0x54c8f8){if(!_0x54c8f8)this[_0x62a9('0x9')]('mandatoryDispositionPauseId',null);this[_0x62a9('0x9')](_0x62a9('0xa'),_0x54c8f8);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 017699d..84ba71d 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 _0xe630=['index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','Pause','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','OpenchannelApplication','Applications','List','applications','list','orderBy','priority','asc','account','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','autoclose','close','OpenchannelMessage','AttachmentId','UserId','User','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','stack','json','getApplications','getInteractions','Contact','fullname','internal','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','OpenchannelAccounts','UserProfileResource','name','send'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xe630,0x149));var _0x0e63=function(_0x2cf50a,_0x36d487){_0x2cf50a=_0x2cf50a-0x0;var _0x4dd5ce=_0xe630[_0x2cf50a];return _0x4dd5ce;};'use strict';var emlformat=require(_0x0e63('0x0'));var rimraf=require(_0x0e63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e63('0x2'));var rp=require(_0x0e63('0x3'));var moment=require(_0x0e63('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e63('0x5'));var util=require(_0x0e63('0x6'));var path=require(_0x0e63('0x7'));var sox=require('sox');var csv=require(_0x0e63('0x8'));var ejs=require(_0x0e63('0x9'));var fs=require('fs');var fs_extra=require(_0x0e63('0xa'));var _=require(_0x0e63('0xb'));var squel=require(_0x0e63('0xc'));var crypto=require('crypto');var jsforce=require(_0x0e63('0xd'));var deskjs=require(_0x0e63('0xe'));var toCsv=require(_0x0e63('0x8'));var querystring=require(_0x0e63('0xf'));var Papa=require(_0x0e63('0x10'));var Redis=require(_0x0e63('0x11'));var authService=require(_0x0e63('0x12'));var qs=require(_0x0e63('0x13'));var as=require(_0x0e63('0x14'));var hardwareService=require(_0x0e63('0x15'));var logger=require(_0x0e63('0x16'))('api');var utils=require(_0x0e63('0x17'));var config=require(_0x0e63('0x18'));var licenseUtil=require(_0x0e63('0x19'));var db=require(_0x0e63('0x1a'))['db'];config[_0x0e63('0x1b')]=_[_0x0e63('0x1c')](config[_0x0e63('0x1b')],{'host':_0x0e63('0x1d'),'port':0x18eb});var socket=require(_0x0e63('0x1e'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x0e63('0x1f')](socket);var jayson=require(_0x0e63('0x20'));var client=jayson[_0x0e63('0x21')][_0x0e63('0x22')]({'port':0x232c});var client9002=jayson[_0x0e63('0x21')][_0x0e63('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x47f3e2,_0x5d1f1e,_0x5d8660,_0x503f34){return new BPromise(function(_0x37f6e4,_0x174524){var _0x5c22ad=_0x503f34||client;return _0x5c22ad['request'](_0x47f3e2,_0x5d8660)['then'](function(_0x16107b){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5d1f1e,_0x0e63('0x23'));logger['debug'](_0x0e63('0x24'),_0x5d1f1e,_0x0e63('0x23'),JSON['stringify'](_0x16107b));if(_0x16107b['error']){if(_0x16107b[_0x0e63('0x25')][_0x0e63('0x26')]===0x1f4){logger[_0x0e63('0x25')](_0x0e63('0x27'),_0x5d1f1e,_0x16107b[_0x0e63('0x25')][_0x0e63('0x28')]);return _0x174524(_0x16107b['error'][_0x0e63('0x28')]);}logger[_0x0e63('0x25')](_0x0e63('0x27'),_0x5d1f1e,_0x16107b[_0x0e63('0x25')][_0x0e63('0x28')]);return _0x37f6e4(_0x16107b['error']['message']);}else{logger[_0x0e63('0x29')](_0x0e63('0x27'),_0x5d1f1e,_0x0e63('0x23'));_0x37f6e4(_0x16107b[_0x0e63('0x2a')][_0x0e63('0x28')]);}})['catch'](function(_0x22bdce){logger[_0x0e63('0x25')](_0x0e63('0x27'),_0x5d1f1e,_0x22bdce);_0x174524(_0x22bdce);});});}function respondWithStatusCode(_0xaa0600,_0x2f95bf){_0x2f95bf=_0x2f95bf||0xcc;return function(_0x1dc52c){if(_0x1dc52c){return _0xaa0600[_0x0e63('0x2b')](_0x2f95bf);}return _0xaa0600[_0x0e63('0x2c')](_0x2f95bf)[_0x0e63('0x2d')]();};}function respondWithResult(_0x3b9fb6,_0x46c864){_0x46c864=_0x46c864||0xc8;return function(_0x4f7ac0){if(_0x4f7ac0){return _0x3b9fb6['status'](_0x46c864)['json'](_0x4f7ac0);}};}function respondWithFilteredResult(_0x66a314,_0x3961bd){return function(_0x370dd7){if(_0x370dd7){var _0x188326=typeof _0x3961bd[_0x0e63('0x2e')]===_0x0e63('0x2f')&&typeof _0x3961bd[_0x0e63('0x30')]===_0x0e63('0x2f');var _0x2ef997=_0x370dd7[_0x0e63('0x31')];var _0x1069c7=_0x188326?0x0:_0x3961bd[_0x0e63('0x2e')];var _0x435990=_0x188326?_0x370dd7[_0x0e63('0x31')]:_0x3961bd[_0x0e63('0x2e')]+_0x3961bd[_0x0e63('0x30')];var _0x33953c;if(_0x435990>=_0x2ef997){_0x435990=_0x2ef997;_0x33953c=0xc8;}else{_0x33953c=0xce;}_0x66a314['status'](_0x33953c);return _0x66a314[_0x0e63('0x32')](_0x0e63('0x33'),_0x1069c7+'-'+_0x435990+'/'+_0x2ef997)['json'](_0x370dd7);}return null;};}function patchUpdates(_0x3f0a8a){return function(_0x1a2bb9){try{jsonpatch[_0x0e63('0x34')](_0x1a2bb9,_0x3f0a8a,!![]);}catch(_0xede47b){return BPromise['reject'](_0xede47b);}return _0x1a2bb9[_0x0e63('0x35')]();};}function saveUpdates(_0x28c5f1,_0x445e14){return function(_0x4d1e0b){if(_0x4d1e0b){return _0x4d1e0b[_0x0e63('0x36')](_0x28c5f1)[_0x0e63('0x37')](function(_0x5cff20){return _0x5cff20;});}return null;};}function removeEntity(_0x42c3d2,_0x258bd0){return function(_0x2b620e){if(_0x2b620e){return _0x2b620e[_0x0e63('0x38')]()[_0x0e63('0x37')](function(){var _0x144b40=_0x2b620e['get']({'plain':!![]});var _0x36c466=_0x0e63('0x39');return db[_0x0e63('0x3a')][_0x0e63('0x38')]({'where':{'type':_0x36c466,'resourceId':_0x144b40['id']}})[_0x0e63('0x37')](function(){return _0x2b620e;});})[_0x0e63('0x37')](function(){_0x42c3d2['status'](0xcc)[_0x0e63('0x2d')]();});}};}function handleEntityNotFound(_0x4a8bdb,_0x2741a4){return function(_0x1ae634){if(!_0x1ae634){_0x4a8bdb[_0x0e63('0x2b')](0x194);}return _0x1ae634;};}function handleError(_0x2e8cc6,_0x39e06e){_0x39e06e=_0x39e06e||0x1f4;return function(_0x53d96b){logger['error'](_0x53d96b['stack']);if(_0x53d96b[_0x0e63('0x3b')]){delete _0x53d96b[_0x0e63('0x3b')];}_0x2e8cc6[_0x0e63('0x2c')](_0x39e06e)[_0x0e63('0x3c')](_0x53d96b);};}exports[_0x0e63('0x3d')]=function(_0x4b02aa,_0x51cc1d){var _0x15102e={'include':[{'model':db['Pause'],'as':_0x0e63('0x3e')}]},_0x5eed7e={},_0x26e386={'count':0x0,'rows':[]};var _0x4813df=_['map'](db[_0x0e63('0x3f')][_0x0e63('0x40')],function(_0x41bf5e){return{'name':_0x41bf5e[_0x0e63('0x41')],'type':_0x41bf5e[_0x0e63('0x42')][_0x0e63('0x43')]};});_0x5eed7e[_0x0e63('0x44')]=_[_0x0e63('0x45')](_0x4813df,_0x0e63('0x3b'));_0x5eed7e['query']=_['keys'](_0x4b02aa[_0x0e63('0x46')]);_0x5eed7e['filters']=_[_0x0e63('0x47')](_0x5eed7e[_0x0e63('0x44')],_0x5eed7e[_0x0e63('0x46')]);_0x15102e[_0x0e63('0x48')]=_['intersection'](_0x5eed7e[_0x0e63('0x44')],qs[_0x0e63('0x49')](_0x4b02aa[_0x0e63('0x46')][_0x0e63('0x49')]));_0x15102e[_0x0e63('0x48')]=_0x15102e[_0x0e63('0x48')][_0x0e63('0x4a')]?_0x15102e[_0x0e63('0x48')]:_0x5eed7e[_0x0e63('0x44')];if(!_0x4b02aa[_0x0e63('0x46')]['hasOwnProperty'](_0x0e63('0x4b'))){_0x15102e[_0x0e63('0x30')]=qs[_0x0e63('0x30')](_0x4b02aa[_0x0e63('0x46')]['limit']);_0x15102e[_0x0e63('0x2e')]=qs[_0x0e63('0x2e')](_0x4b02aa[_0x0e63('0x46')]['offset']);}_0x15102e[_0x0e63('0x4c')]=qs[_0x0e63('0x4d')](_0x4b02aa[_0x0e63('0x46')]['sort']);_0x15102e[_0x0e63('0x4e')]=qs[_0x0e63('0x4f')](_[_0x0e63('0x50')](_0x4b02aa[_0x0e63('0x46')],_0x5eed7e['filters']),_0x4813df);if(_0x4b02aa[_0x0e63('0x46')]['filter']){_0x15102e[_0x0e63('0x4e')]=_[_0x0e63('0x51')](_0x15102e[_0x0e63('0x4e')],{'$or':_[_0x0e63('0x45')](_0x4813df,function(_0x121d11){if(_0x121d11[_0x0e63('0x42')]!==_0x0e63('0x52')){var _0x1f36a1={};_0x1f36a1[_0x121d11['name']]={'$like':'%'+_0x4b02aa['query']['filter']+'%'};return _0x1f36a1;}})});}_0x15102e=_[_0x0e63('0x51')]({},_0x15102e,_0x4b02aa[_0x0e63('0x53')]);var _0xe3f5b7={'where':_0x15102e['where']};return db[_0x0e63('0x3f')][_0x0e63('0x31')](_0xe3f5b7)[_0x0e63('0x37')](function(_0x1a4b84){_0x26e386['count']=_0x1a4b84;if(_0x4b02aa['query'][_0x0e63('0x54')]){_0x15102e[_0x0e63('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x0e63('0x56')](_0x15102e);})[_0x0e63('0x37')](function(_0x3f8dca){_0x26e386['rows']=_0x3f8dca;return _0x26e386;})[_0x0e63('0x37')](respondWithFilteredResult(_0x51cc1d,_0x15102e))[_0x0e63('0x57')](handleError(_0x51cc1d,null));};exports[_0x0e63('0x58')]=function(_0x54b482,_0x2c1d61){var _0x36f102={'raw':![],'where':{'id':_0x54b482[_0x0e63('0x59')]['id']},'include':[{'model':db[_0x0e63('0x5a')],'as':_0x0e63('0x3e')}]},_0x452d76={};_0x452d76[_0x0e63('0x44')]=_[_0x0e63('0x5b')](db[_0x0e63('0x3f')][_0x0e63('0x40')]);_0x452d76['query']=_[_0x0e63('0x5b')](_0x54b482[_0x0e63('0x46')]);_0x452d76[_0x0e63('0x4f')]=_[_0x0e63('0x47')](_0x452d76[_0x0e63('0x44')],_0x452d76[_0x0e63('0x46')]);_0x36f102[_0x0e63('0x48')]=_[_0x0e63('0x47')](_0x452d76['model'],qs[_0x0e63('0x49')](_0x54b482[_0x0e63('0x46')][_0x0e63('0x49')]));_0x36f102[_0x0e63('0x48')]=_0x36f102[_0x0e63('0x48')][_0x0e63('0x4a')]?_0x36f102[_0x0e63('0x48')]:_0x452d76[_0x0e63('0x44')];if(_0x54b482[_0x0e63('0x46')][_0x0e63('0x54')]){_0x36f102[_0x0e63('0x55')]=[{'all':!![]}];}_0x36f102=_[_0x0e63('0x51')]({},_0x36f102,_0x54b482[_0x0e63('0x53')]);return db['OpenchannelAccount'][_0x0e63('0x5c')](_0x36f102)[_0x0e63('0x37')](handleEntityNotFound(_0x2c1d61,null))['then'](respondWithResult(_0x2c1d61,null))[_0x0e63('0x57')](handleError(_0x2c1d61,null));};exports[_0x0e63('0x5d')]=function(_0x4e8528,_0x4aa41f){return db[_0x0e63('0x3f')][_0x0e63('0x5d')](_0x4e8528[_0x0e63('0x5e')],{})[_0x0e63('0x37')](function(_0x5fe558){var _0x274e2c=_0x4e8528[_0x0e63('0x5f')][_0x0e63('0x60')]({'plain':!![]});if(!_0x274e2c)throw new Error(_0x0e63('0x61'));if(_0x274e2c[_0x0e63('0x62')]===_0x0e63('0x5f')){var _0xacffbe=_0x5fe558[_0x0e63('0x60')]({'plain':!![]});var _0x453be1=_0x0e63('0x39');return db[_0x0e63('0x63')][_0x0e63('0x5c')]({'where':{'name':_0x453be1,'userProfileId':_0x274e2c[_0x0e63('0x64')]},'raw':!![]})[_0x0e63('0x37')](function(_0x1d3d88){if(_0x1d3d88&&_0x1d3d88[_0x0e63('0x65')]===0x0){return db[_0x0e63('0x3a')][_0x0e63('0x5d')]({'name':_0xacffbe[_0x0e63('0x3b')],'resourceId':_0xacffbe['id'],'type':_0x1d3d88[_0x0e63('0x3b')],'sectionId':_0x1d3d88['id']},{})['then'](function(){return _0x5fe558;});}else{return _0x5fe558;}})[_0x0e63('0x57')](function(_0x50af93){logger[_0x0e63('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50af93);throw _0x50af93;});}return _0x5fe558;})['then'](respondWithResult(_0x4aa41f,0xc9))[_0x0e63('0x57')](handleError(_0x4aa41f,null));};exports[_0x0e63('0x36')]=function(_0x25565d,_0x5596ba){if(_0x25565d[_0x0e63('0x5e')]['id']){delete _0x25565d[_0x0e63('0x5e')]['id'];}return db[_0x0e63('0x3f')]['find']({'where':{'id':_0x25565d[_0x0e63('0x59')]['id']},'include':[{'model':db[_0x0e63('0x5a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5596ba,null))[_0x0e63('0x37')](saveUpdates(_0x25565d['body'],null))[_0x0e63('0x37')](respondWithResult(_0x5596ba,null))['catch'](handleError(_0x5596ba,null));};exports[_0x0e63('0x38')]=function(_0xae1f1c,_0x3f7211){return db[_0x0e63('0x3f')][_0x0e63('0x5c')]({'where':{'id':_0xae1f1c['params']['id']}})[_0x0e63('0x37')](handleEntityNotFound(_0x3f7211,null))[_0x0e63('0x37')](removeEntity(_0x3f7211,null))[_0x0e63('0x57')](handleError(_0x3f7211,null));};exports['describe']=function(_0x34b12a,_0xd31899){return db[_0x0e63('0x3f')][_0x0e63('0x66')]()['then'](respondWithResult(_0xd31899,null))[_0x0e63('0x57')](handleError(_0xd31899,null));};exports[_0x0e63('0x67')]=function(_0x987d07,_0x48bf51,_0x28c5de){if(_0x987d07['body']['id']){delete _0x987d07['body']['id'];}return db[_0x0e63('0x3f')][_0x0e63('0x5c')]({'where':{'id':_0x987d07[_0x0e63('0x59')]['id']}})['then'](handleEntityNotFound(_0x48bf51,null))['then'](function(_0x3204ca){if(_0x3204ca){_0x987d07[_0x0e63('0x5e')][_0x0e63('0x68')]=_0x3204ca['id'];return db[_0x0e63('0x69')][_0x0e63('0x5d')](_0x987d07[_0x0e63('0x5e')]);}})['then'](respondWithResult(_0x48bf51,null))['catch'](handleError(_0x48bf51,null));};exports[_0x0e63('0x6a')]=function(_0x478ec8,_0x36bb8b,_0x4e537e){var _0x4c6a2e={'raw':![],'where':{}};var _0x5ae0c1={};var _0x4b1b77={'count':0x0,'rows':[]};return db[_0x0e63('0x3f')][_0x0e63('0x6b')]({'where':{'id':_0x478ec8[_0x0e63('0x59')]['id']}})[_0x0e63('0x37')](handleEntityNotFound(_0x36bb8b,null))[_0x0e63('0x37')](function(_0x343be1){if(_0x343be1){_0x5ae0c1[_0x0e63('0x44')]=_[_0x0e63('0x5b')](db[_0x0e63('0x69')]['rawAttributes']);_0x5ae0c1[_0x0e63('0x46')]=_[_0x0e63('0x5b')](_0x478ec8[_0x0e63('0x46')]);_0x5ae0c1[_0x0e63('0x4f')]=_[_0x0e63('0x47')](_0x5ae0c1[_0x0e63('0x44')],_0x5ae0c1[_0x0e63('0x46')]);_0x4c6a2e['attributes']=_[_0x0e63('0x47')](_0x5ae0c1[_0x0e63('0x44')],qs[_0x0e63('0x49')](_0x478ec8['query'][_0x0e63('0x49')]));_0x4c6a2e[_0x0e63('0x48')]=_0x4c6a2e['attributes'][_0x0e63('0x4a')]?_0x4c6a2e[_0x0e63('0x48')]:_0x5ae0c1[_0x0e63('0x44')];if(!_0x478ec8[_0x0e63('0x46')]['hasOwnProperty'](_0x0e63('0x4b'))){_0x4c6a2e[_0x0e63('0x30')]=qs['limit'](_0x478ec8[_0x0e63('0x46')][_0x0e63('0x30')]);_0x4c6a2e[_0x0e63('0x2e')]=qs['offset'](_0x478ec8[_0x0e63('0x46')][_0x0e63('0x2e')]);}_0x4c6a2e['order']=qs[_0x0e63('0x4d')](_0x478ec8['query']['sort']);_0x4c6a2e['where']=qs['filters'](_['pick'](_0x478ec8[_0x0e63('0x46')],_0x5ae0c1[_0x0e63('0x4f')]));_0x4c6a2e[_0x0e63('0x4e')][_0x0e63('0x68')]=_0x343be1['id'];if(_0x478ec8[_0x0e63('0x46')][_0x0e63('0x6c')]){_0x4c6a2e['where']=_[_0x0e63('0x51')](_0x4c6a2e['where'],{'$or':_[_0x0e63('0x45')](_0x4c6a2e[_0x0e63('0x48')],function(_0x1ca441){var _0x4957ba={};_0x4957ba[_0x1ca441]={'$like':'%'+_0x478ec8[_0x0e63('0x46')]['filter']+'%'};return _0x4957ba;})});}_0x4c6a2e=_[_0x0e63('0x51')]({},_0x4c6a2e,_0x478ec8[_0x0e63('0x53')]);return db[_0x0e63('0x69')]['count']({'where':_0x4c6a2e[_0x0e63('0x4e')]})['then'](function(_0x5021fa){_0x4b1b77[_0x0e63('0x31')]=_0x5021fa;if(_0x478ec8[_0x0e63('0x46')]['includeAll']){_0x4c6a2e['include']=[{'all':!![]}];}return db[_0x0e63('0x69')][_0x0e63('0x56')](_0x4c6a2e);})[_0x0e63('0x37')](function(_0x5230be){_0x4b1b77[_0x0e63('0x6d')]=_0x5230be;return _0x4b1b77;});}})[_0x0e63('0x37')](respondWithFilteredResult(_0x36bb8b,_0x4c6a2e))[_0x0e63('0x57')](handleError(_0x36bb8b,null));};exports['removeDispositions']=function(_0x825b2b,_0x5b612c,_0x1b70db){return db[_0x0e63('0x3f')][_0x0e63('0x5c')]({'where':{'id':_0x825b2b[_0x0e63('0x59')]['id']}})['then'](handleEntityNotFound(_0x5b612c,null))[_0x0e63('0x37')](function(_0x7b2288){if(_0x7b2288){return _0x7b2288[_0x0e63('0x6e')](_0x825b2b[_0x0e63('0x46')][_0x0e63('0x6f')]);}})[_0x0e63('0x37')](respondWithStatusCode(_0x5b612c,null))['catch'](handleError(_0x5b612c,null));};exports[_0x0e63('0x70')]=function(_0x2ca6a8,_0x5157a9,_0x2470d8){if(_0x2ca6a8['body']['id']){delete _0x2ca6a8[_0x0e63('0x5e')]['id'];}return db[_0x0e63('0x3f')]['find']({'where':{'id':_0x2ca6a8[_0x0e63('0x59')]['id']}})[_0x0e63('0x37')](handleEntityNotFound(_0x5157a9,null))[_0x0e63('0x37')](function(_0x460c97){if(_0x460c97){_0x2ca6a8[_0x0e63('0x5e')][_0x0e63('0x68')]=_0x460c97['id'];return db[_0x0e63('0x71')]['create'](_0x2ca6a8[_0x0e63('0x5e')]);}})[_0x0e63('0x37')](respondWithResult(_0x5157a9,null))[_0x0e63('0x57')](handleError(_0x5157a9,null));};exports[_0x0e63('0x72')]=function(_0x225c91,_0xf2ef08,_0x242d5c){var _0x10c4b2={'raw':![],'where':{}};var _0x5af863={};var _0x168c2f={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x225c91['params']['id']}})[_0x0e63('0x37')](handleEntityNotFound(_0xf2ef08,null))[_0x0e63('0x37')](function(_0x5cde00){if(_0x5cde00){_0x5af863[_0x0e63('0x44')]=_[_0x0e63('0x5b')](db[_0x0e63('0x71')][_0x0e63('0x40')]);_0x5af863['query']=_[_0x0e63('0x5b')](_0x225c91[_0x0e63('0x46')]);_0x5af863['filters']=_[_0x0e63('0x47')](_0x5af863[_0x0e63('0x44')],_0x5af863[_0x0e63('0x46')]);_0x10c4b2[_0x0e63('0x48')]=_[_0x0e63('0x47')](_0x5af863['model'],qs[_0x0e63('0x49')](_0x225c91[_0x0e63('0x46')][_0x0e63('0x49')]));_0x10c4b2[_0x0e63('0x48')]=_0x10c4b2[_0x0e63('0x48')][_0x0e63('0x4a')]?_0x10c4b2[_0x0e63('0x48')]:_0x5af863['model'];if(!_0x225c91['query'][_0x0e63('0x73')](_0x0e63('0x4b'))){_0x10c4b2[_0x0e63('0x30')]=qs[_0x0e63('0x30')](_0x225c91[_0x0e63('0x46')][_0x0e63('0x30')]);_0x10c4b2[_0x0e63('0x2e')]=qs[_0x0e63('0x2e')](_0x225c91[_0x0e63('0x46')][_0x0e63('0x2e')]);}_0x10c4b2[_0x0e63('0x4c')]=qs[_0x0e63('0x4d')](_0x225c91[_0x0e63('0x46')][_0x0e63('0x4d')]);_0x10c4b2['where']=qs['filters'](_[_0x0e63('0x50')](_0x225c91[_0x0e63('0x46')],_0x5af863[_0x0e63('0x4f')]));_0x10c4b2[_0x0e63('0x4e')]['OpenchannelAccountId']=_0x5cde00['id'];if(_0x225c91[_0x0e63('0x46')][_0x0e63('0x6c')]){_0x10c4b2[_0x0e63('0x4e')]=_[_0x0e63('0x51')](_0x10c4b2[_0x0e63('0x4e')],{'$or':_[_0x0e63('0x45')](_0x10c4b2[_0x0e63('0x48')],function(_0x2d3dc9){var _0x415f45={};_0x415f45[_0x2d3dc9]={'$like':'%'+_0x225c91['query'][_0x0e63('0x6c')]+'%'};return _0x415f45;})});}_0x10c4b2=_['merge']({},_0x10c4b2,_0x225c91[_0x0e63('0x53')]);return db[_0x0e63('0x71')][_0x0e63('0x31')]({'where':_0x10c4b2[_0x0e63('0x4e')]})['then'](function(_0x474c5e){_0x168c2f[_0x0e63('0x31')]=_0x474c5e;if(_0x225c91[_0x0e63('0x46')][_0x0e63('0x54')]){_0x10c4b2[_0x0e63('0x55')]=[{'all':!![]}];}return db[_0x0e63('0x71')][_0x0e63('0x56')](_0x10c4b2);})[_0x0e63('0x37')](function(_0x2161bd){_0x168c2f[_0x0e63('0x6d')]=_0x2161bd;return _0x168c2f;});}})['then'](respondWithFilteredResult(_0xf2ef08,_0x10c4b2))['catch'](handleError(_0xf2ef08,null));};exports[_0x0e63('0x74')]=function(_0x36be15,_0x57e765,_0x3659d2){return db[_0x0e63('0x3f')][_0x0e63('0x5c')]({'where':{'id':_0x36be15[_0x0e63('0x59')]['id']}})['then'](handleEntityNotFound(_0x57e765,null))[_0x0e63('0x37')](function(_0x4d9ac0){if(_0x4d9ac0){return _0x4d9ac0[_0x0e63('0x74')](_0x36be15[_0x0e63('0x46')]['ids']);}})[_0x0e63('0x37')](respondWithStatusCode(_0x57e765,null))[_0x0e63('0x57')](handleError(_0x57e765,null));};exports['notify']=function(_0x59fb15,_0x3c1422,_0x25cd12){var _0x10cbb2={'body':_0x59fb15['body'],'channel':_0x0e63('0x75')};var _0x2d0712=[];var _0xd06343=[];var _0x4f1bca={};var _0x1ac27a=![];return db['CmContact'][_0x0e63('0x66')]()[_0x0e63('0x37')](function(_0x50a298){if(!_0x50a298){throw new db[(_0x0e63('0x76'))][(_0x0e63('0x77'))](_0x0e63('0x78'));}_0x2d0712=_['difference'](_['keys'](_0x50a298),['createdAt',_0x0e63('0x79')]);_0xd06343=_[_0x0e63('0x7a')](_[_0x0e63('0x5b')](_0x50a298),[_0x0e63('0x7b'),'updatedAt',_0x0e63('0x7c'),_0x0e63('0x7d')]);if(_0x59fb15[_0x0e63('0x5e')]['id']){delete _0x59fb15[_0x0e63('0x5e')]['id'];}if(_[_0x0e63('0x7e')](_0x59fb15[_0x0e63('0x5e')][_0x0e63('0x7f')])){throw new db[(_0x0e63('0x76'))][(_0x0e63('0x77'))]('from\x20is\x20mandatory');}if(_[_0x0e63('0x7e')](_0x59fb15[_0x0e63('0x5e')]['body'])||_0x59fb15[_0x0e63('0x5e')][_0x0e63('0x5e')]===''){throw new db[(_0x0e63('0x76'))]['ValidationError'](_0x0e63('0x80'));}if(_[_0x0e63('0x7e')](_0x59fb15['body'][_0x0e63('0x81')])){throw new db[(_0x0e63('0x76'))][(_0x0e63('0x77'))](_0x0e63('0x82')+_0xd06343);}if(!_[_0x0e63('0x83')](_0xd06343,_0x59fb15[_0x0e63('0x5e')]['mapKey'])){throw new db[(_0x0e63('0x76'))][(_0x0e63('0x77'))](_0x0e63('0x84')+_0xd06343);}_0x4f1bca[_0x59fb15['body'][_0x0e63('0x81')]]=_0x59fb15[_0x0e63('0x5e')][_0x0e63('0x7f')];})[_0x0e63('0x37')](function(){return db[_0x0e63('0x3f')][_0x0e63('0x5c')]({'where':{'id':_0x59fb15[_0x0e63('0x59')]['id']},'include':[{'model':db[_0x0e63('0x85')],'as':'List','include':[{'model':db[_0x0e63('0x86')],'as':'Contacts','where':_0x4f1bca,'limit':0x1,'order':[[_0x0e63('0x79'),_0x0e63('0x87')]]}]},{'model':db[_0x0e63('0x88')],'as':_0x0e63('0x89')}]});})[_0x0e63('0x37')](handleEntityNotFound(_0x3c1422,null))['then'](function(_0x413b7a){if(_0x413b7a&&_0x413b7a[_0x0e63('0x8a')]){_0x10cbb2['account']=_0x413b7a;_0x10cbb2[_0x0e63('0x8b')]=_0x413b7a[_0x0e63('0x89')];_0x10cbb2[_0x0e63('0x8c')]=_0x413b7a[_0x0e63('0x8a')];_0x10cbb2[_0x0e63('0x8b')]=_[_0x0e63('0x8d')](_0x10cbb2[_0x0e63('0x8b')],[_0x0e63('0x8e')],[_0x0e63('0x8f')]);if(_0x10cbb2[_0x0e63('0x90')]['Applications']){delete _0x10cbb2['account'][_0x0e63('0x89')];}if(_0x10cbb2['account'][_0x0e63('0x8a')]&&_0x10cbb2[_0x0e63('0x90')][_0x0e63('0x8a')]['Contacts'][_0x0e63('0x4a')]){return _0x10cbb2[_0x0e63('0x90')]['List'][_0x0e63('0x91')][0x0];}var _0xf7fadf=_[_0x0e63('0x1c')](_0x59fb15[_0x0e63('0x5e')],{'firstName':_0x59fb15[_0x0e63('0x5e')][_0x0e63('0x7f')],'ListId':_0x413b7a[_0x0e63('0x7d')]});_0xf7fadf[_0x59fb15[_0x0e63('0x5e')][_0x0e63('0x81')]]=_0x59fb15['body'][_0x0e63('0x7f')];return db['CmContact']['create'](_0xf7fadf,{'fields':_0x2d0712,'raw':!![]});}})[_0x0e63('0x37')](handleEntityNotFound(_0x3c1422,null))[_0x0e63('0x37')](function(_0x5f41b9){_0x10cbb2[_0x0e63('0x92')]=_0x5f41b9;if(_0x5f41b9){var _0x58a8c2={'ContactId':_0x5f41b9['id'],'OpenchannelAccountId':_0x59fb15[_0x0e63('0x59')]['id'],'from':(_0x5f41b9['firstName']||'')+'\x20'+(_0x5f41b9[_0x0e63('0x93')]||'')};var _0x3221b1={'OpenchannelAccountId':_0x59fb15[_0x0e63('0x59')]['id'],'closed':![]};if(_0x59fb15['body']['threadId']){_0x3221b1[_0x0e63('0x94')]=_0x59fb15[_0x0e63('0x5e')][_0x0e63('0x94')];return db[_0x0e63('0x95')]['find']({'where':_0x3221b1})[_0x0e63('0x37')](function(_0x36ee74){if(_0x36ee74){return[_0x36ee74,![]];}_0x58a8c2['threadId']=_0x59fb15[_0x0e63('0x5e')][_0x0e63('0x94')];_0x58a8c2[_0x0e63('0x96')]=_0x59fb15[_0x0e63('0x5e')][_0x0e63('0x96')];return db['OpenchannelInteraction'][_0x0e63('0x5d')](_0x58a8c2)[_0x0e63('0x37')](function(_0x43a593){return[_0x43a593,!![]];});});}else{_0x3221b1['threadId']=null;}_0x3221b1[_0x0e63('0x97')]=_0x5f41b9['id'];return db[_0x0e63('0x95')][_0x0e63('0x5c')]({'where':_0x3221b1})[_0x0e63('0x37')](function(_0x2c228d){if(_0x2c228d){return[_0x2c228d,![]];}return db[_0x0e63('0x95')]['create'](_0x58a8c2)[_0x0e63('0x37')](function(_0x513a62){return[_0x513a62,!![]];});});}})[_0x0e63('0x98')](function(_0x425a4d,_0x1435ec){if(_0x425a4d){_0x1ac27a=_0x1435ec;if(!_0x1435ec){var _0x5481e4={'from':(_0x10cbb2[_0x0e63('0x92')]['firstName']||'')+'\x20'+(_0x10cbb2[_0x0e63('0x92')][_0x0e63('0x93')]||'')};if(_0x59fb15[_0x0e63('0x5e')]['threadId']&&_0x59fb15[_0x0e63('0x5e')]['messageId']&&_0x59fb15[_0x0e63('0x5e')]['threadId']!=_0x59fb15['body'][_0x0e63('0x99')]){_0x5481e4[_0x0e63('0x94')]=_0x59fb15[_0x0e63('0x5e')][_0x0e63('0x99')];}return _0x425a4d['update'](_0x5481e4);}else{return _0x425a4d;}}})['then'](function(_0x28668e){_0x10cbb2[_0x0e63('0x9a')]=_0x28668e[_0x0e63('0x60')]({'plain':!![]});_0x10cbb2[_0x0e63('0x9a')]['created']=_0x1ac27a;if(_0x10cbb2['interaction']['created']){if(_0x10cbb2[_0x0e63('0x90')][_0x0e63('0x9b')]){_0x10cbb2[_0x0e63('0x8b')]['push']({'id':0x0,'priority':_0x10cbb2[_0x0e63('0x8b')][_0x0e63('0x4a')]+0x1,'app':_0x0e63('0x9c'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x0e63('0x9d')][_0x0e63('0x5d')]({'body':_0x59fb15[_0x0e63('0x5e')]['body'],'OpenchannelAccountId':_0x59fb15[_0x0e63('0x59')]['id'],'OpenchannelInteractionId':_0x28668e['id'],'direction':'in','ContactId':_0x10cbb2[_0x0e63('0x92')]['id'],'AttachmentId':_0x59fb15['body'][_0x0e63('0x9e')]});})[_0x0e63('0x37')](function(_0x27e711){_0x10cbb2['message']=_0x27e711;if(_0x10cbb2[_0x0e63('0x9a')][_0x0e63('0x9f')]){return db[_0x0e63('0xa0')][_0x0e63('0x5c')]({'attributes':['id','name'],'where':{'id':_0x10cbb2[_0x0e63('0x9a')][_0x0e63('0x9f')]}})[_0x0e63('0x37')](function(_0x5cf54e){if(_0x5cf54e){_0x10cbb2['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x0e63('0xa1'),'appdata':_0x5cf54e[_0x0e63('0x3b')]+','+(_0x10cbb2[_0x0e63('0x90')]['waitForTheAssignedAgent']||0xa),'interval':_0x0e63('0xa2')});_0x10cbb2[_0x0e63('0xa3')]=![];}return respondWithRpcPromise(_0x0e63('0xa4'),_0x0e63('0xa5'),_0x10cbb2);});}return respondWithRpcPromise(_0x0e63('0xa4'),_0x0e63('0xa5'),_0x10cbb2);})[_0x0e63('0x37')](function(_0xd74c9){respondWithRpcPromise(_0x0e63('0xa6'),_0x0e63('0xa6'),{'event':_0x0e63('0xa7'),'message':_0xd74c9},client9002);return _0xd74c9;})[_0x0e63('0x37')](respondWithResult(_0x3c1422,null))[_0x0e63('0x57')](handleError(_0x3c1422,null));};exports[_0x0e63('0xa8')]=function(_0xca6e22,_0x2cd46f){var _0xec58b=_0xca6e22['params']['id'];var _0x49bf6e=_0xca6e22[_0x0e63('0x5e')];var _0x45393e=0xc8;var _0x38384d=null;return db[_0x0e63('0xa9')][_0x0e63('0xaa')]({'isolationLevel':db[_0x0e63('0xa9')]['Transaction'][_0x0e63('0xab')][_0x0e63('0xac')]},function(_0x3593f3){return db['OpenchannelAccount'][_0x0e63('0x6b')]({'where':{'id':_0xec58b},'transaction':_0x3593f3})[_0x0e63('0x37')](function(_0x4520bf){if(_0x4520bf){return db[_0x0e63('0x88')]['destroy']({'where':{'OpenchannelAccountId':_0xec58b},'transaction':_0x3593f3})[_0x0e63('0x37')](function(){var _0x719f5f=_[_0x0e63('0x45')](_0x49bf6e,function(_0x2c5b09){_0x2c5b09[_0x0e63('0x68')]=_0xec58b;return _0x2c5b09;});return db[_0x0e63('0x88')][_0x0e63('0xad')](_0x719f5f,{'transaction':_0x3593f3});});}else{_0x45393e=0x194;_0x38384d=[];}});})['then'](function(){if(_0x45393e!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0xec58b},'order':_0x0e63('0x8e')})[_0x0e63('0x37')](function(_0x2c6a03){_0x38384d=_0x2c6a03;});}})['catch'](function(_0x28396e){_0x45393e=0x1f4;logger[_0x0e63('0x25')](_0x28396e[_0x0e63('0xae')]);if(_0x28396e[_0x0e63('0x3b')]){delete _0x28396e[_0x0e63('0x3b')];}_0x38384d=_0x28396e;})['finally'](function(){if(_0x38384d===null){_0x2cd46f['sendStatus'](_0x45393e);}else{if(_0x45393e===0x1f4){_0x2cd46f[_0x0e63('0x2c')](_0x45393e)[_0x0e63('0x3c')](_0x38384d);}else{_0x2cd46f[_0x0e63('0x2c')](_0x45393e)[_0x0e63('0xaf')](_0x38384d);}}});};exports[_0x0e63('0xb0')]=function(_0x3c354d,_0x5507cc,_0x517af4){var _0x47d320={};var _0x5df613={};var _0x27ea47;var _0x38236;return db[_0x0e63('0x3f')][_0x0e63('0x6b')]({'where':{'id':_0x3c354d[_0x0e63('0x59')]['id']}})[_0x0e63('0x37')](handleEntityNotFound(_0x5507cc,null))[_0x0e63('0x37')](function(_0xb8b3a9){if(_0xb8b3a9){_0x27ea47=_0xb8b3a9;_0x5df613['model']=_[_0x0e63('0x5b')](db[_0x0e63('0x88')][_0x0e63('0x40')]);_0x5df613[_0x0e63('0x46')]=_['keys'](_0x3c354d[_0x0e63('0x46')]);_0x5df613[_0x0e63('0x4f')]=_[_0x0e63('0x47')](_0x5df613[_0x0e63('0x44')],_0x5df613[_0x0e63('0x46')]);_0x47d320[_0x0e63('0x48')]=_[_0x0e63('0x47')](_0x5df613[_0x0e63('0x44')],qs[_0x0e63('0x49')](_0x3c354d['query']['fields']));_0x47d320[_0x0e63('0x48')]=_0x47d320[_0x0e63('0x48')]['length']?_0x47d320[_0x0e63('0x48')]:_0x5df613[_0x0e63('0x44')];_0x47d320[_0x0e63('0x4c')]=qs[_0x0e63('0x4d')](_0x3c354d['query'][_0x0e63('0x4d')]);_0x47d320['where']=qs[_0x0e63('0x4f')](_[_0x0e63('0x50')](_0x3c354d['query'],_0x5df613[_0x0e63('0x4f')]));if(_0x3c354d['query']['filter']){_0x47d320[_0x0e63('0x4e')]=_[_0x0e63('0x51')](_0x47d320['where'],{'$or':_[_0x0e63('0x45')](_0x47d320[_0x0e63('0x48')],function(_0xb6cc19){var _0x5f443c={};_0x5f443c[_0xb6cc19]={'$like':'%'+_0x3c354d[_0x0e63('0x46')][_0x0e63('0x6c')]+'%'};return _0x5f443c;})});}_0x47d320=_['merge']({},_0x47d320,_0x3c354d[_0x0e63('0x53')]);return _0x27ea47[_0x0e63('0xb0')](_0x47d320);}})[_0x0e63('0x37')](function(_0x360c48){if(_0x360c48){_0x38236=_0x360c48[_0x0e63('0x4a')];if(!_0x3c354d['query']['hasOwnProperty'](_0x0e63('0x4b'))){_0x47d320[_0x0e63('0x30')]=qs[_0x0e63('0x30')](_0x3c354d[_0x0e63('0x46')][_0x0e63('0x30')]);_0x47d320[_0x0e63('0x2e')]=qs[_0x0e63('0x2e')](_0x3c354d['query'][_0x0e63('0x2e')]);}return _0x27ea47[_0x0e63('0xb0')](_0x47d320);}})['then'](function(_0x537c8b){if(_0x537c8b){return _0x537c8b?{'count':_0x38236,'rows':_0x537c8b}:null;}})[_0x0e63('0x37')](respondWithResult(_0x5507cc,null))['catch'](handleError(_0x5507cc,null));};exports[_0x0e63('0xb1')]=function(_0x37b3ce,_0x485f31,_0x33068f){var _0x5257d7={'raw':![],'where':{}};var _0x42aade={};var _0x1c8ee1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0e63('0x6b')]({'where':{'id':_0x37b3ce['params']['id']}})[_0x0e63('0x37')](handleEntityNotFound(_0x485f31,null))[_0x0e63('0x37')](function(_0x2a7b79){if(_0x2a7b79){_0x42aade[_0x0e63('0x44')]=_[_0x0e63('0x5b')](db[_0x0e63('0x95')][_0x0e63('0x40')]);_0x42aade[_0x0e63('0x46')]=_['keys'](_0x37b3ce[_0x0e63('0x46')]);_0x42aade['filters']=_['intersection'](_0x42aade[_0x0e63('0x44')],_0x42aade['query']);_0x5257d7[_0x0e63('0x48')]=_['intersection'](_0x42aade[_0x0e63('0x44')],qs[_0x0e63('0x49')](_0x37b3ce[_0x0e63('0x46')][_0x0e63('0x49')]));_0x5257d7[_0x0e63('0x48')]=_0x5257d7['attributes'][_0x0e63('0x4a')]?_0x5257d7[_0x0e63('0x48')]:_0x42aade[_0x0e63('0x44')];if(!_0x37b3ce[_0x0e63('0x46')]['hasOwnProperty'](_0x0e63('0x4b'))){_0x5257d7[_0x0e63('0x30')]=qs[_0x0e63('0x30')](_0x37b3ce[_0x0e63('0x46')][_0x0e63('0x30')]);_0x5257d7[_0x0e63('0x2e')]=qs[_0x0e63('0x2e')](_0x37b3ce[_0x0e63('0x46')][_0x0e63('0x2e')]);}_0x5257d7['order']=qs[_0x0e63('0x4d')](_0x37b3ce['query'][_0x0e63('0x4d')]);_0x5257d7[_0x0e63('0x4e')]=qs[_0x0e63('0x4f')](_[_0x0e63('0x50')](_0x37b3ce['query'],_0x42aade[_0x0e63('0x4f')]));_0x5257d7[_0x0e63('0x4e')]['OpenchannelAccountId']=_0x2a7b79['id'];if(_0x37b3ce[_0x0e63('0x46')]['filter']){_0x5257d7[_0x0e63('0x4e')]=_[_0x0e63('0x51')](_0x5257d7[_0x0e63('0x4e')],{'$or':_[_0x0e63('0x45')](_0x5257d7[_0x0e63('0x48')],function(_0x5f0cda){var _0x415767={};_0x415767[_0x5f0cda]={'$like':'%'+_0x37b3ce['query']['filter']+'%'};return _0x415767;})});}_0x5257d7=_[_0x0e63('0x51')]({},_0x5257d7,_0x37b3ce[_0x0e63('0x53')]);return db['OpenchannelInteraction'][_0x0e63('0x31')]({'where':_0x5257d7[_0x0e63('0x4e')]})[_0x0e63('0x37')](function(_0x30bdea){_0x1c8ee1[_0x0e63('0x31')]=_0x30bdea;if(_0x37b3ce[_0x0e63('0x46')][_0x0e63('0x54')]){_0x5257d7[_0x0e63('0x55')]=[{'model':db['CmContact'],'as':_0x0e63('0xb2'),'required':![]},{'model':db[_0x0e63('0xa0')],'as':'Owner','attributes':[_0x0e63('0x3b'),_0x0e63('0xb3'),_0x0e63('0xb4')],'required':![]},{'model':db['Tag'],'as':_0x0e63('0xb5'),'attributes':['id','name',_0x0e63('0xb6')],'where':_0x37b3ce[_0x0e63('0x46')][_0x0e63('0xb7')]?{'id':_0x37b3ce[_0x0e63('0x46')][_0x0e63('0xb7')]}:undefined,'required':_0x37b3ce[_0x0e63('0x46')][_0x0e63('0xb7')]?!![]:![]}];}return db[_0x0e63('0x95')][_0x0e63('0x56')](_0x5257d7);})['then'](function(_0x2733bc){_0x1c8ee1[_0x0e63('0x6d')]=_0x2733bc;return _0x1c8ee1;});}})[_0x0e63('0x37')](respondWithFilteredResult(_0x485f31,_0x5257d7))[_0x0e63('0x57')](handleError(_0x485f31,null));};exports[_0x0e63('0xb8')]=function(_0x15b25f,_0x4d9d3f,_0x6f4a1e){return db[_0x0e63('0x3f')][_0x0e63('0x5c')]({'where':{'id':_0x15b25f[_0x0e63('0x59')]['id']}})[_0x0e63('0x37')](handleEntityNotFound(_0x4d9d3f,null))[_0x0e63('0x37')](function(_0x669225){if(_0x669225){return _0x669225[_0x0e63('0xb8')](_0x15b25f[_0x0e63('0x5e')][_0x0e63('0x6f')],_['omit'](_0x15b25f['body'],['ids','id'])||{})[_0x0e63('0x98')](function(_0x50378c){for(var _0x1c2d50=0x0;_0x1c2d50<_0x15b25f[_0x0e63('0x5e')][_0x0e63('0x6f')][_0x0e63('0x4a')];_0x1c2d50+=0x1){socket[_0x0e63('0xb9')](_0x0e63('0xba'),{'UserId':Number(_0x15b25f[_0x0e63('0x5e')][_0x0e63('0x6f')][_0x1c2d50]),'OpenchannelAccountId':Number(_0x15b25f[_0x0e63('0x59')]['id'])});}return _0x50378c;});}})['then'](respondWithResult(_0x4d9d3f,null))[_0x0e63('0x57')](handleError(_0x4d9d3f,null));};exports[_0x0e63('0xbb')]=function(_0x337490,_0x513ce8,_0x327047){return db['OpenchannelAccount'][_0x0e63('0x5c')]({'where':{'id':_0x337490[_0x0e63('0x59')]['id']}})['then'](handleEntityNotFound(_0x513ce8,null))[_0x0e63('0x37')](function(_0x14d3c){if(_0x14d3c){return _0x14d3c['removeAgents'](_0x337490['query'][_0x0e63('0x6f')])[_0x0e63('0x37')](function(){if(_[_0x0e63('0xbc')](_0x337490[_0x0e63('0x46')]['ids'])){for(var _0x45b987=0x0;_0x45b987<_0x337490[_0x0e63('0x46')][_0x0e63('0x6f')][_0x0e63('0x4a')];_0x45b987+=0x1){socket[_0x0e63('0xb9')](_0x0e63('0xbd'),{'UserId':Number(_0x337490['query']['ids'][_0x45b987]),'OpenchannelAccountId':Number(_0x337490[_0x0e63('0x59')]['id'])});}}else{socket[_0x0e63('0xb9')](_0x0e63('0xbd'),{'UserId':Number(_0x337490[_0x0e63('0x46')][_0x0e63('0x6f')]),'OpenchannelAccountId':Number(_0x337490[_0x0e63('0x59')]['id'])});}});}})[_0x0e63('0x37')](respondWithStatusCode(_0x513ce8,null))['catch'](handleError(_0x513ce8,null));};exports['getAgents']=function(_0x3d568c,_0x25a96c,_0x29987c){var _0x4ac3c7={};var _0x32d38d={};var _0x40f22e;var _0x20a197;return db['OpenchannelAccount'][_0x0e63('0x6b')]({'where':{'id':_0x3d568c[_0x0e63('0x59')]['id']}})[_0x0e63('0x37')](handleEntityNotFound(_0x25a96c,null))[_0x0e63('0x37')](function(_0x5a23b1){if(_0x5a23b1){_0x40f22e=_0x5a23b1;_0x32d38d[_0x0e63('0x44')]=_[_0x0e63('0x5b')](db[_0x0e63('0xa0')][_0x0e63('0x40')]);_0x32d38d[_0x0e63('0x46')]=_['keys'](_0x3d568c[_0x0e63('0x46')]);_0x32d38d[_0x0e63('0x4f')]=_['intersection'](_0x32d38d[_0x0e63('0x44')],_0x32d38d[_0x0e63('0x46')]);_0x4ac3c7['attributes']=_[_0x0e63('0x47')](_0x32d38d[_0x0e63('0x44')],qs[_0x0e63('0x49')](_0x3d568c[_0x0e63('0x46')][_0x0e63('0x49')]));_0x4ac3c7[_0x0e63('0x48')]=_0x4ac3c7[_0x0e63('0x48')][_0x0e63('0x4a')]?_0x4ac3c7['attributes']:_0x32d38d[_0x0e63('0x44')];_0x4ac3c7['order']=qs[_0x0e63('0x4d')](_0x3d568c[_0x0e63('0x46')]['sort']);_0x4ac3c7[_0x0e63('0x4e')]=qs[_0x0e63('0x4f')](_['pick'](_0x3d568c['query'],_0x32d38d['filters']));if(_0x3d568c[_0x0e63('0x46')][_0x0e63('0x6c')]){_0x4ac3c7[_0x0e63('0x4e')]=_['merge'](_0x4ac3c7[_0x0e63('0x4e')],{'$or':_[_0x0e63('0x45')](_0x4ac3c7['attributes'],function(_0x43ef6d){var _0xa8f256={};_0xa8f256[_0x43ef6d]={'$like':'%'+_0x3d568c[_0x0e63('0x46')][_0x0e63('0x6c')]+'%'};return _0xa8f256;})});}_0x4ac3c7=_[_0x0e63('0x51')]({},_0x4ac3c7,_0x3d568c[_0x0e63('0x53')]);return _0x40f22e['getAgents'](_0x4ac3c7);}})[_0x0e63('0x37')](function(_0x38932c){if(_0x38932c){_0x20a197=_0x38932c[_0x0e63('0x4a')];if(!_0x3d568c[_0x0e63('0x46')][_0x0e63('0x73')](_0x0e63('0x4b'))){_0x4ac3c7[_0x0e63('0x30')]=qs[_0x0e63('0x30')](_0x3d568c[_0x0e63('0x46')][_0x0e63('0x30')]);_0x4ac3c7[_0x0e63('0x2e')]=qs[_0x0e63('0x2e')](_0x3d568c[_0x0e63('0x46')][_0x0e63('0x2e')]);}return _0x40f22e[_0x0e63('0xbe')](_0x4ac3c7);}})[_0x0e63('0x37')](function(_0x1a7196){if(_0x1a7196){return _0x1a7196?{'count':_0x20a197,'rows':_0x1a7196}:null;}})['then'](respondWithResult(_0x25a96c,null))['catch'](handleError(_0x25a96c,null));};exports['send']=function(_0x3d2bf8,_0x3da2d5,_0x1e27d1){var _0x476bb2,_0x2f1089,_0x13813f;if(_['isNil'](_0x3d2bf8[_0x0e63('0x5e')][_0x0e63('0x5e')])||_0x3d2bf8[_0x0e63('0x5e')][_0x0e63('0x5e')]===''){throw new db[(_0x0e63('0x76'))][(_0x0e63('0x77'))](_0x0e63('0x80'));}if(_[_0x0e63('0x7e')](_0x3d2bf8['body']['to'])){}_0x476bb2=_0x3d2bf8[_0x0e63('0x5e')]['to'];return db['OpenchannelAccount'][_0x0e63('0x6b')]({'where':{'id':_0x3d2bf8[_0x0e63('0x59')]['id']}})[_0x0e63('0x37')](handleEntityNotFound(_0x3da2d5,null))[_0x0e63('0x37')](function(_0x3ba234){if(_0x3ba234){return db[_0x0e63('0x3f')][_0x0e63('0x5c')]({'where':{'id':_0x3ba234['id']},'include':[{'model':db['CmList'],'as':_0x0e63('0x8a'),'include':[{'model':db['CmContact'],'as':_0x0e63('0x91'),'where':{[_0x3ba234['mapKey']]:_0x476bb2},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x0e63('0x37')](handleEntityNotFound(_0x3da2d5,null))['then'](function(_0xbc4e3e){if(_0xbc4e3e&&_0xbc4e3e[_0x0e63('0x8a')]){_0x2f1089=_0xbc4e3e[_0x0e63('0x60')]({'plain':!![]});if(_0x2f1089[_0x0e63('0x8a')]&&_0x2f1089[_0x0e63('0x8a')][_0x0e63('0x91')][_0x0e63('0x4a')]){return _0x2f1089['List']['Contacts'][0x0];}return db[_0x0e63('0x86')]['create'](_[_0x0e63('0x1c')](_0x3d2bf8[_0x0e63('0x5e')],{'firstName':_0x476bb2,[_0xbc4e3e[_0x0e63('0x81')]]:_0x476bb2,'phone':_0x476bb2,'ListId':_0x2f1089[_0x0e63('0x7d')]}));}})[_0x0e63('0x37')](handleEntityNotFound(_0x3da2d5,null))[_0x0e63('0x37')](function(_0x560692){if(_0x560692){_0x13813f=_0x560692;return db[_0x0e63('0x95')]['find']({'where':{'ContactId':_0x13813f['id'],'closed':![],'OpenchannelAccountId':_0x2f1089['id']}})[_0x0e63('0x37')](function(_0x1d5992){if(_0x1d5992){return[_0x1d5992,![]];}return db['OpenchannelInteraction'][_0x0e63('0x5d')]({'UserId':_0x3d2bf8[_0x0e63('0x5f')]['id'],'ContactId':_0x13813f['id'],'OpenchannelAccountId':_0x2f1089['id'],'lastMsgDirection':_0x0e63('0xbf'),'firstMsgDirection':_0x0e63('0xbf'),'Messages':[_[_0x0e63('0x51')](_0x3d2bf8[_0x0e63('0x5e')],{'read':![],'body':_0x3d2bf8[_0x0e63('0x5e')][_0x0e63('0x5e')],'OpenchannelAccountId':_0x2f1089['id'],'UserId':_0x3d2bf8[_0x0e63('0x5f')]['id'],'ContactId':_0x13813f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x0e63('0xc0')}]})[_0x0e63('0x37')](function(_0x4f7d14){return[_0x4f7d14,!![]];});});}})[_0x0e63('0x98')](function(_0xd5275a,_0x36f83f){if(_0x36f83f){return _0xd5275a;}return db[_0x0e63('0x9d')]['create'](_[_0x0e63('0x51')](_0x3d2bf8[_0x0e63('0x5e')],{'read':![],'body':_0x3d2bf8[_0x0e63('0x5e')][_0x0e63('0x5e')],'OpenchannelAccountId':_0x2f1089['id'],'OpenchannelInteractionId':_0xd5275a['id'],'UserId':_0x3d2bf8[_0x0e63('0x5f')]['id'],'ContactId':_0x13813f['id']}))[_0x0e63('0x37')](function(_0x32117a){_0xd5275a[_0x0e63('0xc1')][_0x0e63('0xc0')]=[];_0xd5275a[_0x0e63('0xc1')]['Messages'][_0x0e63('0xc2')](_0x32117a[_0x0e63('0xc1')]);return _0xd5275a;});});}})[_0x0e63('0x37')](respondWithResult(_0x3da2d5,null))[_0x0e63('0x57')](handleError(_0x3da2d5,null));}; \ No newline at end of file +var _0xbd60=['../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','destroy','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','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','List','Contacts','DESC','Applications','account','applications','list','orderBy','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','startRouting','Start','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','finally','sendStatus','send','getApplications','getInteractions','Contact','Owner','fullname','Tag','addAgents','ids','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','ListId','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x35d809,_0xd0cdda){var _0x122106=function(_0x30ed8b){while(--_0x30ed8b){_0x35d809['push'](_0x35d809['shift']());}};_0x122106(++_0xd0cdda);}(_0xbd60,0x162));var _0x0bd6=function(_0x5ab602,_0x5bb797){_0x5ab602=_0x5ab602-0x0;var _0x3b7a08=_0xbd60[_0x5ab602];return _0x3b7a08;};'use strict';var emlformat=require(_0x0bd6('0x0'));var rimraf=require(_0x0bd6('0x1'));var zipdir=require(_0x0bd6('0x2'));var jsonpatch=require(_0x0bd6('0x3'));var rp=require(_0x0bd6('0x4'));var moment=require(_0x0bd6('0x5'));var BPromise=require(_0x0bd6('0x6'));var Mustache=require(_0x0bd6('0x7'));var util=require('util');var path=require(_0x0bd6('0x8'));var sox=require(_0x0bd6('0x9'));var csv=require(_0x0bd6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0bd6('0xb'));var _=require(_0x0bd6('0xc'));var squel=require(_0x0bd6('0xd'));var crypto=require(_0x0bd6('0xe'));var jsforce=require(_0x0bd6('0xf'));var deskjs=require(_0x0bd6('0x10'));var toCsv=require(_0x0bd6('0xa'));var querystring=require(_0x0bd6('0x11'));var Papa=require(_0x0bd6('0x12'));var Redis=require('ioredis');var authService=require(_0x0bd6('0x13'));var qs=require(_0x0bd6('0x14'));var as=require(_0x0bd6('0x15'));var hardwareService=require(_0x0bd6('0x16'));var logger=require(_0x0bd6('0x17'))(_0x0bd6('0x18'));var utils=require(_0x0bd6('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0bd6('0x1a')],{'host':_0x0bd6('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd6('0x1a')]));require(_0x0bd6('0x1c'))[_0x0bd6('0x1d')](socket);var jayson=require(_0x0bd6('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x0bd6('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3883da,_0x4d2c18,_0x2f9927,_0x2fe790){return new BPromise(function(_0x2858e4,_0x558c78){var _0x1cd639=_0x2fe790||client;return _0x1cd639['request'](_0x3883da,_0x2f9927)[_0x0bd6('0x20')](function(_0x4f18e7){logger[_0x0bd6('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x4d2c18,_0x0bd6('0x22'));logger['debug'](_0x0bd6('0x23'),_0x4d2c18,_0x0bd6('0x22'),JSON[_0x0bd6('0x24')](_0x4f18e7));if(_0x4f18e7[_0x0bd6('0x25')]){if(_0x4f18e7[_0x0bd6('0x25')]['code']===0x1f4){logger[_0x0bd6('0x25')](_0x0bd6('0x26'),_0x4d2c18,_0x4f18e7['error']['message']);return _0x558c78(_0x4f18e7[_0x0bd6('0x25')][_0x0bd6('0x27')]);}logger[_0x0bd6('0x25')](_0x0bd6('0x26'),_0x4d2c18,_0x4f18e7[_0x0bd6('0x25')][_0x0bd6('0x27')]);return _0x2858e4(_0x4f18e7[_0x0bd6('0x25')][_0x0bd6('0x27')]);}else{logger['info'](_0x0bd6('0x26'),_0x4d2c18,_0x0bd6('0x22'));_0x2858e4(_0x4f18e7[_0x0bd6('0x28')][_0x0bd6('0x27')]);}})['catch'](function(_0x20636d){logger[_0x0bd6('0x25')](_0x0bd6('0x26'),_0x4d2c18,_0x20636d);_0x558c78(_0x20636d);});});}function respondWithStatusCode(_0x2d36ce,_0xbd685){_0xbd685=_0xbd685||0xcc;return function(_0x5e9e6c){if(_0x5e9e6c){return _0x2d36ce['sendStatus'](_0xbd685);}return _0x2d36ce[_0x0bd6('0x29')](_0xbd685)['end']();};}function respondWithResult(_0x53f564,_0x595ba6){_0x595ba6=_0x595ba6||0xc8;return function(_0x51b443){if(_0x51b443){return _0x53f564[_0x0bd6('0x29')](_0x595ba6)['json'](_0x51b443);}};}function respondWithFilteredResult(_0x4ac530,_0x140ee8){return function(_0x172633){if(_0x172633){var _0x13a0bd=typeof _0x140ee8[_0x0bd6('0x2a')]===_0x0bd6('0x2b')&&typeof _0x140ee8[_0x0bd6('0x2c')]===_0x0bd6('0x2b');var _0x352216=_0x172633[_0x0bd6('0x2d')];var _0x779fe7=_0x13a0bd?0x0:_0x140ee8['offset'];var _0x367786=_0x13a0bd?_0x172633[_0x0bd6('0x2d')]:_0x140ee8[_0x0bd6('0x2a')]+_0x140ee8[_0x0bd6('0x2c')];var _0x5f4619;if(_0x367786>=_0x352216){_0x367786=_0x352216;_0x5f4619=0xc8;}else{_0x5f4619=0xce;}_0x4ac530[_0x0bd6('0x29')](_0x5f4619);return _0x4ac530[_0x0bd6('0x2e')](_0x0bd6('0x2f'),_0x779fe7+'-'+_0x367786+'/'+_0x352216)[_0x0bd6('0x30')](_0x172633);}return null;};}function patchUpdates(_0x4643bc){return function(_0x594cfd){try{jsonpatch['apply'](_0x594cfd,_0x4643bc,!![]);}catch(_0x3d1cfc){return BPromise[_0x0bd6('0x31')](_0x3d1cfc);}return _0x594cfd['save']();};}function saveUpdates(_0x12d353,_0x369d82){return function(_0x2cd5a6){if(_0x2cd5a6){return _0x2cd5a6[_0x0bd6('0x32')](_0x12d353)[_0x0bd6('0x20')](function(_0x4473a6){return _0x4473a6;});}return null;};}function removeEntity(_0x32d99c,_0x82e881){return function(_0x1e99f3){if(_0x1e99f3){return _0x1e99f3[_0x0bd6('0x33')]()[_0x0bd6('0x20')](function(){var _0x2f3c83=_0x1e99f3['get']({'plain':!![]});var _0x3fe57a='OpenchannelAccounts';return db[_0x0bd6('0x34')][_0x0bd6('0x33')]({'where':{'type':_0x3fe57a,'resourceId':_0x2f3c83['id']}})[_0x0bd6('0x20')](function(){return _0x1e99f3;});})[_0x0bd6('0x20')](function(){_0x32d99c[_0x0bd6('0x29')](0xcc)[_0x0bd6('0x35')]();});}};}function handleEntityNotFound(_0x1725a9,_0x3a4c65){return function(_0x297ae6){if(!_0x297ae6){_0x1725a9['sendStatus'](0x194);}return _0x297ae6;};}function handleError(_0x221ddd,_0x4fb0bc){_0x4fb0bc=_0x4fb0bc||0x1f4;return function(_0xdf5a01){logger[_0x0bd6('0x25')](_0xdf5a01[_0x0bd6('0x36')]);if(_0xdf5a01[_0x0bd6('0x37')]){delete _0xdf5a01[_0x0bd6('0x37')];}_0x221ddd[_0x0bd6('0x29')](_0x4fb0bc)['send'](_0xdf5a01);};}exports[_0x0bd6('0x38')]=function(_0x229aa9,_0x1413bc){var _0x4ac298={'include':[{'model':db[_0x0bd6('0x39')],'as':_0x0bd6('0x3a')}]},_0x25fa42={},_0x5c3802={'count':0x0,'rows':[]};var _0x4511a5=_[_0x0bd6('0x3b')](db[_0x0bd6('0x3c')][_0x0bd6('0x3d')],function(_0x4c08a8){return{'name':_0x4c08a8[_0x0bd6('0x3e')],'type':_0x4c08a8[_0x0bd6('0x3f')]['key']};});_0x25fa42[_0x0bd6('0x40')]=_['map'](_0x4511a5,'name');_0x25fa42[_0x0bd6('0x41')]=_[_0x0bd6('0x42')](_0x229aa9['query']);_0x25fa42[_0x0bd6('0x43')]=_[_0x0bd6('0x44')](_0x25fa42[_0x0bd6('0x40')],_0x25fa42[_0x0bd6('0x41')]);_0x4ac298[_0x0bd6('0x45')]=_['intersection'](_0x25fa42['model'],qs['fields'](_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x4ac298[_0x0bd6('0x45')]=_0x4ac298[_0x0bd6('0x45')][_0x0bd6('0x47')]?_0x4ac298[_0x0bd6('0x45')]:_0x25fa42[_0x0bd6('0x40')];if(!_0x229aa9[_0x0bd6('0x41')]['hasOwnProperty'](_0x0bd6('0x48'))){_0x4ac298[_0x0bd6('0x2c')]=qs[_0x0bd6('0x2c')](_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0x4ac298[_0x0bd6('0x2a')]=qs[_0x0bd6('0x2a')](_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x2a')]);}_0x4ac298[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x4a')]);_0x4ac298['where']=qs[_0x0bd6('0x43')](_[_0x0bd6('0x4b')](_0x229aa9['query'],_0x25fa42[_0x0bd6('0x43')]),_0x4511a5);if(_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x4c')]){_0x4ac298['where']=_[_0x0bd6('0x4d')](_0x4ac298[_0x0bd6('0x4e')],{'$or':_[_0x0bd6('0x3b')](_0x4511a5,function(_0x25b003){if(_0x25b003[_0x0bd6('0x3f')]!==_0x0bd6('0x4f')){var _0x3828bd={};_0x3828bd[_0x25b003['name']]={'$like':'%'+_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x4c')]+'%'};return _0x3828bd;}})});}_0x4ac298=_[_0x0bd6('0x4d')]({},_0x4ac298,_0x229aa9['options']);var _0x19a033={'where':_0x4ac298[_0x0bd6('0x4e')]};return db[_0x0bd6('0x3c')]['count'](_0x19a033)[_0x0bd6('0x20')](function(_0x1519e5){_0x5c3802['count']=_0x1519e5;if(_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x50')]){_0x4ac298[_0x0bd6('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x0bd6('0x52')](_0x4ac298);})['then'](function(_0x512140){_0x5c3802[_0x0bd6('0x53')]=_0x512140;return _0x5c3802;})['then'](respondWithFilteredResult(_0x1413bc,_0x4ac298))['catch'](handleError(_0x1413bc,null));};exports[_0x0bd6('0x54')]=function(_0x285311,_0xb27c61){var _0x1a969d={'raw':![],'where':{'id':_0x285311[_0x0bd6('0x55')]['id']},'include':[{'model':db[_0x0bd6('0x39')],'as':'mandatoryDispositionPause'}]},_0x3d259b={};_0x3d259b[_0x0bd6('0x40')]=_[_0x0bd6('0x42')](db[_0x0bd6('0x3c')][_0x0bd6('0x3d')]);_0x3d259b[_0x0bd6('0x41')]=_[_0x0bd6('0x42')](_0x285311[_0x0bd6('0x41')]);_0x3d259b['filters']=_['intersection'](_0x3d259b[_0x0bd6('0x40')],_0x3d259b[_0x0bd6('0x41')]);_0x1a969d[_0x0bd6('0x45')]=_['intersection'](_0x3d259b[_0x0bd6('0x40')],qs['fields'](_0x285311[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x1a969d[_0x0bd6('0x45')]=_0x1a969d[_0x0bd6('0x45')]['length']?_0x1a969d[_0x0bd6('0x45')]:_0x3d259b['model'];if(_0x285311[_0x0bd6('0x41')][_0x0bd6('0x50')]){_0x1a969d[_0x0bd6('0x51')]=[{'all':!![]}];}_0x1a969d=_[_0x0bd6('0x4d')]({},_0x1a969d,_0x285311[_0x0bd6('0x56')]);return db[_0x0bd6('0x3c')][_0x0bd6('0x57')](_0x1a969d)[_0x0bd6('0x20')](handleEntityNotFound(_0xb27c61,null))[_0x0bd6('0x20')](respondWithResult(_0xb27c61,null))['catch'](handleError(_0xb27c61,null));};exports['create']=function(_0x56ac99,_0x426306){return db[_0x0bd6('0x3c')][_0x0bd6('0x58')](_0x56ac99[_0x0bd6('0x59')],{})[_0x0bd6('0x20')](function(_0x1d455d){var _0x294aa1=_0x56ac99['user'][_0x0bd6('0x5a')]({'plain':!![]});if(!_0x294aa1)throw new Error(_0x0bd6('0x5b'));if(_0x294aa1['role']===_0x0bd6('0x5c')){var _0x1d86e9=_0x1d455d[_0x0bd6('0x5a')]({'plain':!![]});var _0x2bbb7f=_0x0bd6('0x5d');return db[_0x0bd6('0x5e')][_0x0bd6('0x57')]({'where':{'name':_0x2bbb7f,'userProfileId':_0x294aa1[_0x0bd6('0x5f')]},'raw':!![]})[_0x0bd6('0x20')](function(_0x451368){if(_0x451368&&_0x451368[_0x0bd6('0x60')]===0x0){return db[_0x0bd6('0x34')][_0x0bd6('0x58')]({'name':_0x1d86e9[_0x0bd6('0x37')],'resourceId':_0x1d86e9['id'],'type':_0x451368[_0x0bd6('0x37')],'sectionId':_0x451368['id']},{})[_0x0bd6('0x20')](function(){return _0x1d455d;});}else{return _0x1d455d;}})[_0x0bd6('0x61')](function(_0x36e6d1){logger[_0x0bd6('0x25')](_0x0bd6('0x62'),_0x36e6d1);throw _0x36e6d1;});}return _0x1d455d;})[_0x0bd6('0x20')](respondWithResult(_0x426306,0xc9))[_0x0bd6('0x61')](handleError(_0x426306,null));};exports['update']=function(_0x24597b,_0x798dd1){if(_0x24597b[_0x0bd6('0x59')]['id']){delete _0x24597b[_0x0bd6('0x59')]['id'];}return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x24597b[_0x0bd6('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x0bd6('0x3a')}]})[_0x0bd6('0x20')](handleEntityNotFound(_0x798dd1,null))[_0x0bd6('0x20')](saveUpdates(_0x24597b[_0x0bd6('0x59')],null))[_0x0bd6('0x20')](respondWithResult(_0x798dd1,null))[_0x0bd6('0x61')](handleError(_0x798dd1,null));};exports[_0x0bd6('0x33')]=function(_0x37c5c9,_0x15a25e){return db['OpenchannelAccount']['find']({'where':{'id':_0x37c5c9[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x15a25e,null))[_0x0bd6('0x20')](removeEntity(_0x15a25e,null))['catch'](handleError(_0x15a25e,null));};exports['describe']=function(_0x527d60,_0x2b7494){return db['OpenchannelAccount'][_0x0bd6('0x63')]()[_0x0bd6('0x20')](respondWithResult(_0x2b7494,null))[_0x0bd6('0x61')](handleError(_0x2b7494,null));};exports['addDisposition']=function(_0x528cb5,_0x3f9428,_0x42b08c){if(_0x528cb5[_0x0bd6('0x59')]['id']){delete _0x528cb5[_0x0bd6('0x59')]['id'];}return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x528cb5[_0x0bd6('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f9428,null))[_0x0bd6('0x20')](function(_0x1c7276){if(_0x1c7276){_0x528cb5[_0x0bd6('0x59')][_0x0bd6('0x64')]=_0x1c7276['id'];return db[_0x0bd6('0x65')]['create'](_0x528cb5[_0x0bd6('0x59')]);}})[_0x0bd6('0x20')](respondWithResult(_0x3f9428,null))['catch'](handleError(_0x3f9428,null));};exports['getDispositions']=function(_0x2eb79e,_0x343c8e,_0x1922d5){var _0x10894e={'raw':![],'where':{}};var _0x4702e5={};var _0x330f6f={'count':0x0,'rows':[]};return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0x2eb79e[_0x0bd6('0x55')]['id']}})['then'](handleEntityNotFound(_0x343c8e,null))[_0x0bd6('0x20')](function(_0x26d695){if(_0x26d695){_0x4702e5[_0x0bd6('0x40')]=_[_0x0bd6('0x42')](db['Disposition']['rawAttributes']);_0x4702e5[_0x0bd6('0x41')]=_[_0x0bd6('0x42')](_0x2eb79e['query']);_0x4702e5['filters']=_[_0x0bd6('0x44')](_0x4702e5[_0x0bd6('0x40')],_0x4702e5[_0x0bd6('0x41')]);_0x10894e['attributes']=_[_0x0bd6('0x44')](_0x4702e5['model'],qs[_0x0bd6('0x46')](_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x10894e[_0x0bd6('0x45')]=_0x10894e[_0x0bd6('0x45')]['length']?_0x10894e[_0x0bd6('0x45')]:_0x4702e5['model'];if(!_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x67')]('nolimit')){_0x10894e['limit']=qs[_0x0bd6('0x2c')](_0x2eb79e[_0x0bd6('0x41')]['limit']);_0x10894e[_0x0bd6('0x2a')]=qs[_0x0bd6('0x2a')](_0x2eb79e[_0x0bd6('0x41')]['offset']);}_0x10894e['order']=qs[_0x0bd6('0x4a')](_0x2eb79e[_0x0bd6('0x41')]['sort']);_0x10894e[_0x0bd6('0x4e')]=qs[_0x0bd6('0x43')](_[_0x0bd6('0x4b')](_0x2eb79e['query'],_0x4702e5['filters']));_0x10894e[_0x0bd6('0x4e')][_0x0bd6('0x64')]=_0x26d695['id'];if(_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x4c')]){_0x10894e['where']=_[_0x0bd6('0x4d')](_0x10894e[_0x0bd6('0x4e')],{'$or':_[_0x0bd6('0x3b')](_0x10894e[_0x0bd6('0x45')],function(_0xfab104){var _0x432241={};_0x432241[_0xfab104]={'$like':'%'+_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x4c')]+'%'};return _0x432241;})});}_0x10894e=_[_0x0bd6('0x4d')]({},_0x10894e,_0x2eb79e[_0x0bd6('0x56')]);return db['Disposition'][_0x0bd6('0x2d')]({'where':_0x10894e[_0x0bd6('0x4e')]})[_0x0bd6('0x20')](function(_0xcb55e7){_0x330f6f[_0x0bd6('0x2d')]=_0xcb55e7;if(_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x50')]){_0x10894e[_0x0bd6('0x51')]=[{'all':!![]}];}return db[_0x0bd6('0x65')][_0x0bd6('0x52')](_0x10894e);})[_0x0bd6('0x20')](function(_0xf48bc8){_0x330f6f[_0x0bd6('0x53')]=_0xf48bc8;return _0x330f6f;});}})['then'](respondWithFilteredResult(_0x343c8e,_0x10894e))[_0x0bd6('0x61')](handleError(_0x343c8e,null));};exports[_0x0bd6('0x68')]=function(_0x274396,_0x1a87ca,_0x6e970b){return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x274396['params']['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x1a87ca,null))['then'](function(_0x28db88){if(_0x28db88){return _0x28db88['removeDispositions'](_0x274396[_0x0bd6('0x41')]['ids']);}})[_0x0bd6('0x20')](respondWithStatusCode(_0x1a87ca,null))['catch'](handleError(_0x1a87ca,null));};exports[_0x0bd6('0x69')]=function(_0xb38500,_0x5c0aa6,_0x3cef56){if(_0xb38500['body']['id']){delete _0xb38500['body']['id'];}return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0xb38500['params']['id']}})['then'](handleEntityNotFound(_0x5c0aa6,null))[_0x0bd6('0x20')](function(_0x154f4b){if(_0x154f4b){_0xb38500['body'][_0x0bd6('0x64')]=_0x154f4b['id'];return db[_0x0bd6('0x6a')][_0x0bd6('0x58')](_0xb38500[_0x0bd6('0x59')]);}})[_0x0bd6('0x20')](respondWithResult(_0x5c0aa6,null))['catch'](handleError(_0x5c0aa6,null));};exports[_0x0bd6('0x6b')]=function(_0x21614c,_0x2ef0c0,_0x261ae6){var _0xa5daea={'raw':![],'where':{}};var _0x1203c5={};var _0x3cf242={'count':0x0,'rows':[]};return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0x21614c[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x2ef0c0,null))[_0x0bd6('0x20')](function(_0xc758be){if(_0xc758be){_0x1203c5[_0x0bd6('0x40')]=_[_0x0bd6('0x42')](db[_0x0bd6('0x6a')][_0x0bd6('0x3d')]);_0x1203c5[_0x0bd6('0x41')]=_['keys'](_0x21614c[_0x0bd6('0x41')]);_0x1203c5[_0x0bd6('0x43')]=_['intersection'](_0x1203c5[_0x0bd6('0x40')],_0x1203c5[_0x0bd6('0x41')]);_0xa5daea[_0x0bd6('0x45')]=_[_0x0bd6('0x44')](_0x1203c5[_0x0bd6('0x40')],qs[_0x0bd6('0x46')](_0x21614c[_0x0bd6('0x41')]['fields']));_0xa5daea[_0x0bd6('0x45')]=_0xa5daea[_0x0bd6('0x45')][_0x0bd6('0x47')]?_0xa5daea[_0x0bd6('0x45')]:_0x1203c5['model'];if(!_0x21614c[_0x0bd6('0x41')][_0x0bd6('0x67')](_0x0bd6('0x48'))){_0xa5daea[_0x0bd6('0x2c')]=qs[_0x0bd6('0x2c')](_0x21614c[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0xa5daea[_0x0bd6('0x2a')]=qs['offset'](_0x21614c['query'][_0x0bd6('0x2a')]);}_0xa5daea[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0x21614c[_0x0bd6('0x41')]['sort']);_0xa5daea[_0x0bd6('0x4e')]=qs['filters'](_[_0x0bd6('0x4b')](_0x21614c[_0x0bd6('0x41')],_0x1203c5['filters']));_0xa5daea[_0x0bd6('0x4e')][_0x0bd6('0x64')]=_0xc758be['id'];if(_0x21614c[_0x0bd6('0x41')][_0x0bd6('0x4c')]){_0xa5daea[_0x0bd6('0x4e')]=_[_0x0bd6('0x4d')](_0xa5daea[_0x0bd6('0x4e')],{'$or':_['map'](_0xa5daea[_0x0bd6('0x45')],function(_0x2846c3){var _0x12d0d9={};_0x12d0d9[_0x2846c3]={'$like':'%'+_0x21614c[_0x0bd6('0x41')][_0x0bd6('0x4c')]+'%'};return _0x12d0d9;})});}_0xa5daea=_[_0x0bd6('0x4d')]({},_0xa5daea,_0x21614c[_0x0bd6('0x56')]);return db['CannedAnswer'][_0x0bd6('0x2d')]({'where':_0xa5daea[_0x0bd6('0x4e')]})['then'](function(_0x1eba18){_0x3cf242[_0x0bd6('0x2d')]=_0x1eba18;if(_0x21614c['query'][_0x0bd6('0x50')]){_0xa5daea['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x0bd6('0x52')](_0xa5daea);})[_0x0bd6('0x20')](function(_0x313388){_0x3cf242[_0x0bd6('0x53')]=_0x313388;return _0x3cf242;});}})[_0x0bd6('0x20')](respondWithFilteredResult(_0x2ef0c0,_0xa5daea))[_0x0bd6('0x61')](handleError(_0x2ef0c0,null));};exports[_0x0bd6('0x6c')]=function(_0x2003a3,_0x8eeb82,_0x4e91d2){return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x2003a3[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x8eeb82,null))[_0x0bd6('0x20')](function(_0x13d0cb){if(_0x13d0cb){return _0x13d0cb['removeAnswers'](_0x2003a3[_0x0bd6('0x41')]['ids']);}})[_0x0bd6('0x20')](respondWithStatusCode(_0x8eeb82,null))[_0x0bd6('0x61')](handleError(_0x8eeb82,null));};exports[_0x0bd6('0x6d')]=function(_0x58a502,_0x1ad256,_0x2149dc){var _0x150de3={'body':_0x58a502[_0x0bd6('0x59')],'channel':_0x0bd6('0x6e')};var _0x11b86c=[];var _0x39bbfc=[];var _0x28c6b2={};var _0x5e639a=![];return db[_0x0bd6('0x6f')][_0x0bd6('0x63')]()['then'](function(_0x10190e){if(!_0x10190e){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x72'));}_0x11b86c=_[_0x0bd6('0x73')](_[_0x0bd6('0x42')](_0x10190e),[_0x0bd6('0x74'),'updatedAt']);_0x39bbfc=_[_0x0bd6('0x73')](_['keys'](_0x10190e),[_0x0bd6('0x74'),_0x0bd6('0x75'),_0x0bd6('0x76'),'ListId']);if(_0x58a502[_0x0bd6('0x59')]['id']){delete _0x58a502[_0x0bd6('0x59')]['id'];}if(_[_0x0bd6('0x77')](_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x78')])){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x79'));}if(_[_0x0bd6('0x77')](_0x58a502['body'][_0x0bd6('0x59')])||_0x58a502[_0x0bd6('0x59')]['body']===''){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x7a'));}if(_[_0x0bd6('0x77')](_0x58a502[_0x0bd6('0x59')]['mapKey'])){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x7b')+_0x39bbfc);}if(!_['includes'](_0x39bbfc,_0x58a502['body'][_0x0bd6('0x7c')])){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x7d')+_0x39bbfc);}_0x28c6b2[_0x58a502['body']['mapKey']]=_0x58a502[_0x0bd6('0x59')]['from'];})[_0x0bd6('0x20')](function(){return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x58a502[_0x0bd6('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x0bd6('0x7e'),'include':[{'model':db[_0x0bd6('0x6f')],'as':_0x0bd6('0x7f'),'where':_0x28c6b2,'limit':0x1,'order':[[_0x0bd6('0x75'),_0x0bd6('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x0bd6('0x81')}]});})['then'](handleEntityNotFound(_0x1ad256,null))[_0x0bd6('0x20')](function(_0x207a11){if(_0x207a11&&_0x207a11[_0x0bd6('0x7e')]){_0x150de3[_0x0bd6('0x82')]=_0x207a11;_0x150de3[_0x0bd6('0x83')]=_0x207a11[_0x0bd6('0x81')];_0x150de3[_0x0bd6('0x84')]=_0x207a11['List'];_0x150de3[_0x0bd6('0x83')]=_[_0x0bd6('0x85')](_0x150de3[_0x0bd6('0x83')],['priority'],[_0x0bd6('0x86')]);if(_0x150de3['account']['Applications']){delete _0x150de3[_0x0bd6('0x82')][_0x0bd6('0x81')];}if(_0x150de3['account']['List']&&_0x150de3[_0x0bd6('0x82')]['List'][_0x0bd6('0x7f')]['length']){return _0x150de3[_0x0bd6('0x82')][_0x0bd6('0x7e')]['Contacts'][0x0];}var _0x1ad332=_[_0x0bd6('0x87')](_0x58a502['body'],{'firstName':_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x78')],'ListId':_0x207a11['ListId']});_0x1ad332[_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x7c')]]=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x78')];return db[_0x0bd6('0x6f')][_0x0bd6('0x58')](_0x1ad332,{'fields':_0x11b86c,'raw':!![]});}})[_0x0bd6('0x20')](handleEntityNotFound(_0x1ad256,null))[_0x0bd6('0x20')](function(_0x1fad05){_0x150de3[_0x0bd6('0x88')]=_0x1fad05;if(_0x1fad05){var _0x150d3b={'ContactId':_0x1fad05['id'],'OpenchannelAccountId':_0x58a502[_0x0bd6('0x55')]['id'],'from':(_0x1fad05[_0x0bd6('0x89')]||'')+'\x20'+(_0x1fad05[_0x0bd6('0x8a')]||'')};var _0x28d97d={'OpenchannelAccountId':_0x58a502['params']['id'],'closed':![]};if(_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8b')]){_0x28d97d[_0x0bd6('0x8b')]=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8b')];return db[_0x0bd6('0x8c')][_0x0bd6('0x57')]({'where':_0x28d97d})['then'](function(_0x53ed6c){if(_0x53ed6c){return[_0x53ed6c,![]];}_0x150d3b[_0x0bd6('0x8b')]=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8b')];_0x150d3b[_0x0bd6('0x8d')]=_0x58a502['body'][_0x0bd6('0x8d')];return db[_0x0bd6('0x8c')][_0x0bd6('0x58')](_0x150d3b)['then'](function(_0x35d2ec){return[_0x35d2ec,!![]];});});}else{_0x28d97d[_0x0bd6('0x8b')]=null;}_0x28d97d[_0x0bd6('0x8e')]=_0x1fad05['id'];return db[_0x0bd6('0x8c')][_0x0bd6('0x57')]({'where':_0x28d97d})[_0x0bd6('0x20')](function(_0xef8730){if(_0xef8730){return[_0xef8730,![]];}return db[_0x0bd6('0x8c')][_0x0bd6('0x58')](_0x150d3b)[_0x0bd6('0x20')](function(_0xf9c54d){return[_0xf9c54d,!![]];});});}})['spread'](function(_0x51a40e,_0x19450c){if(_0x51a40e){_0x5e639a=_0x19450c;if(!_0x19450c){var _0x294d7e={'from':(_0x150de3['contact'][_0x0bd6('0x89')]||'')+'\x20'+(_0x150de3['contact']['lastName']||'')};if(_0x58a502[_0x0bd6('0x59')]['threadId']&&_0x58a502[_0x0bd6('0x59')]['messageId']&&_0x58a502['body'][_0x0bd6('0x8b')]!=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8f')]){_0x294d7e[_0x0bd6('0x8b')]=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8f')];}return _0x51a40e[_0x0bd6('0x32')](_0x294d7e);}else{return _0x51a40e;}}})[_0x0bd6('0x20')](function(_0x1e02f0){_0x150de3['interaction']=_0x1e02f0['get']({'plain':!![]});_0x150de3[_0x0bd6('0x90')][_0x0bd6('0x91')]=_0x5e639a;if(_0x150de3[_0x0bd6('0x90')]['created']){if(_0x150de3['account'][_0x0bd6('0x92')]){_0x150de3[_0x0bd6('0x83')][_0x0bd6('0x93')]({'id':0x0,'priority':_0x150de3[_0x0bd6('0x83')][_0x0bd6('0x47')]+0x1,'app':'close','appdata':_0x0bd6('0x94'),'interval':_0x0bd6('0x95')});}}return db[_0x0bd6('0x96')][_0x0bd6('0x58')]({'body':_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x59')],'OpenchannelAccountId':_0x58a502['params']['id'],'OpenchannelInteractionId':_0x1e02f0['id'],'direction':'in','ContactId':_0x150de3[_0x0bd6('0x88')]['id'],'AttachmentId':_0x58a502['body'][_0x0bd6('0x97')]});})[_0x0bd6('0x20')](function(_0x4d3521){_0x150de3[_0x0bd6('0x27')]=_0x4d3521;if(_0x150de3[_0x0bd6('0x90')][_0x0bd6('0x98')]){return db[_0x0bd6('0x99')][_0x0bd6('0x57')]({'attributes':['id',_0x0bd6('0x37')],'where':{'id':_0x150de3['interaction'][_0x0bd6('0x98')]}})[_0x0bd6('0x20')](function(_0x2bdc98){if(_0x2bdc98){_0x150de3[_0x0bd6('0x83')][_0x0bd6('0x9a')]({'id':0x0,'priority':0x0,'app':_0x0bd6('0x9b'),'appdata':_0x2bdc98[_0x0bd6('0x37')]+','+(_0x150de3['account']['waitForTheAssignedAgent']||0xa),'interval':_0x0bd6('0x95')});_0x150de3['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x0bd6('0x9c'),_0x150de3);});}return respondWithRpcPromise(_0x0bd6('0x9d'),_0x0bd6('0x9c'),_0x150de3);})['then'](function(_0x14956c){respondWithRpcPromise('EventManager',_0x0bd6('0x9e'),{'event':_0x0bd6('0x6d'),'message':_0x14956c},client9002);return _0x14956c;})[_0x0bd6('0x20')](respondWithResult(_0x1ad256,null))[_0x0bd6('0x61')](handleError(_0x1ad256,null));};exports[_0x0bd6('0x9f')]=function(_0x205f73,_0x7e40c6){var _0x50451b=_0x205f73[_0x0bd6('0x55')]['id'];var _0x527ea5=_0x205f73[_0x0bd6('0x59')];var _0x44029a=0xc8;var _0x502620=null;return db[_0x0bd6('0xa0')]['transaction']({'isolationLevel':db['sequelize'][_0x0bd6('0xa1')][_0x0bd6('0xa2')][_0x0bd6('0xa3')]},function(_0x458b01){return db[_0x0bd6('0x3c')]['findOne']({'where':{'id':_0x50451b},'transaction':_0x458b01})[_0x0bd6('0x20')](function(_0x32f465){if(_0x32f465){return db['OpenchannelApplication'][_0x0bd6('0x33')]({'where':{'OpenchannelAccountId':_0x50451b},'transaction':_0x458b01})['then'](function(){var _0x42269d=_[_0x0bd6('0x3b')](_0x527ea5,function(_0x446319){_0x446319['OpenchannelAccountId']=_0x50451b;return _0x446319;});return db[_0x0bd6('0xa4')]['bulkCreate'](_0x42269d,{'transaction':_0x458b01});});}else{_0x44029a=0x194;_0x502620=[];}});})[_0x0bd6('0x20')](function(){if(_0x44029a!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x50451b},'order':'priority'})[_0x0bd6('0x20')](function(_0x260572){_0x502620=_0x260572;});}})[_0x0bd6('0x61')](function(_0x3cf2cc){_0x44029a=0x1f4;logger[_0x0bd6('0x25')](_0x3cf2cc[_0x0bd6('0x36')]);if(_0x3cf2cc[_0x0bd6('0x37')]){delete _0x3cf2cc[_0x0bd6('0x37')];}_0x502620=_0x3cf2cc;})[_0x0bd6('0xa5')](function(){if(_0x502620===null){_0x7e40c6[_0x0bd6('0xa6')](_0x44029a);}else{if(_0x44029a===0x1f4){_0x7e40c6[_0x0bd6('0x29')](_0x44029a)[_0x0bd6('0xa7')](_0x502620);}else{_0x7e40c6['status'](_0x44029a)['json'](_0x502620);}}});};exports[_0x0bd6('0xa8')]=function(_0xde701f,_0xf4ea66,_0x366ce1){var _0x3c16ee={};var _0x243b0c={};var _0x565114;var _0x1dc506;return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0xde701f[_0x0bd6('0x55')]['id']}})['then'](handleEntityNotFound(_0xf4ea66,null))['then'](function(_0x4b3e5c){if(_0x4b3e5c){_0x565114=_0x4b3e5c;_0x243b0c[_0x0bd6('0x40')]=_[_0x0bd6('0x42')](db[_0x0bd6('0xa4')][_0x0bd6('0x3d')]);_0x243b0c['query']=_['keys'](_0xde701f[_0x0bd6('0x41')]);_0x243b0c[_0x0bd6('0x43')]=_[_0x0bd6('0x44')](_0x243b0c[_0x0bd6('0x40')],_0x243b0c[_0x0bd6('0x41')]);_0x3c16ee['attributes']=_[_0x0bd6('0x44')](_0x243b0c['model'],qs[_0x0bd6('0x46')](_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x3c16ee[_0x0bd6('0x45')]=_0x3c16ee['attributes'][_0x0bd6('0x47')]?_0x3c16ee[_0x0bd6('0x45')]:_0x243b0c[_0x0bd6('0x40')];_0x3c16ee[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x4a')]);_0x3c16ee['where']=qs[_0x0bd6('0x43')](_['pick'](_0xde701f[_0x0bd6('0x41')],_0x243b0c[_0x0bd6('0x43')]));if(_0xde701f['query'][_0x0bd6('0x4c')]){_0x3c16ee[_0x0bd6('0x4e')]=_[_0x0bd6('0x4d')](_0x3c16ee[_0x0bd6('0x4e')],{'$or':_[_0x0bd6('0x3b')](_0x3c16ee['attributes'],function(_0x140494){var _0x11ec1d={};_0x11ec1d[_0x140494]={'$like':'%'+_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x4c')]+'%'};return _0x11ec1d;})});}_0x3c16ee=_[_0x0bd6('0x4d')]({},_0x3c16ee,_0xde701f['options']);return _0x565114['getApplications'](_0x3c16ee);}})[_0x0bd6('0x20')](function(_0x4da3ac){if(_0x4da3ac){_0x1dc506=_0x4da3ac[_0x0bd6('0x47')];if(!_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x67')](_0x0bd6('0x48'))){_0x3c16ee['limit']=qs[_0x0bd6('0x2c')](_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0x3c16ee[_0x0bd6('0x2a')]=qs[_0x0bd6('0x2a')](_0xde701f[_0x0bd6('0x41')]['offset']);}return _0x565114['getApplications'](_0x3c16ee);}})['then'](function(_0x204236){if(_0x204236){return _0x204236?{'count':_0x1dc506,'rows':_0x204236}:null;}})[_0x0bd6('0x20')](respondWithResult(_0xf4ea66,null))['catch'](handleError(_0xf4ea66,null));};exports[_0x0bd6('0xa9')]=function(_0x34a101,_0x287320,_0x47e5cf){var _0x5ddc15={'raw':![],'where':{}};var _0x365c78={};var _0x52afa2={'count':0x0,'rows':[]};return db[_0x0bd6('0x3c')]['findOne']({'where':{'id':_0x34a101[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x287320,null))['then'](function(_0x1e9e59){if(_0x1e9e59){_0x365c78['model']=_[_0x0bd6('0x42')](db[_0x0bd6('0x8c')][_0x0bd6('0x3d')]);_0x365c78[_0x0bd6('0x41')]=_[_0x0bd6('0x42')](_0x34a101[_0x0bd6('0x41')]);_0x365c78[_0x0bd6('0x43')]=_['intersection'](_0x365c78[_0x0bd6('0x40')],_0x365c78['query']);_0x5ddc15[_0x0bd6('0x45')]=_[_0x0bd6('0x44')](_0x365c78['model'],qs[_0x0bd6('0x46')](_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x5ddc15[_0x0bd6('0x45')]=_0x5ddc15[_0x0bd6('0x45')][_0x0bd6('0x47')]?_0x5ddc15[_0x0bd6('0x45')]:_0x365c78[_0x0bd6('0x40')];if(!_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x67')](_0x0bd6('0x48'))){_0x5ddc15[_0x0bd6('0x2c')]=qs['limit'](_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0x5ddc15[_0x0bd6('0x2a')]=qs[_0x0bd6('0x2a')](_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x2a')]);}_0x5ddc15[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x4a')]);_0x5ddc15['where']=qs[_0x0bd6('0x43')](_[_0x0bd6('0x4b')](_0x34a101[_0x0bd6('0x41')],_0x365c78['filters']));_0x5ddc15[_0x0bd6('0x4e')][_0x0bd6('0x64')]=_0x1e9e59['id'];if(_0x34a101['query']['filter']){_0x5ddc15[_0x0bd6('0x4e')]=_['merge'](_0x5ddc15[_0x0bd6('0x4e')],{'$or':_['map'](_0x5ddc15[_0x0bd6('0x45')],function(_0xfe23ff){var _0x1a6350={};_0x1a6350[_0xfe23ff]={'$like':'%'+_0x34a101['query'][_0x0bd6('0x4c')]+'%'};return _0x1a6350;})});}_0x5ddc15=_[_0x0bd6('0x4d')]({},_0x5ddc15,_0x34a101[_0x0bd6('0x56')]);return db['OpenchannelInteraction'][_0x0bd6('0x2d')]({'where':_0x5ddc15['where']})[_0x0bd6('0x20')](function(_0x291036){_0x52afa2[_0x0bd6('0x2d')]=_0x291036;if(_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x50')]){_0x5ddc15[_0x0bd6('0x51')]=[{'model':db[_0x0bd6('0x6f')],'as':_0x0bd6('0xaa'),'required':![]},{'model':db[_0x0bd6('0x99')],'as':_0x0bd6('0xab'),'attributes':['name',_0x0bd6('0xac'),'internal'],'required':![]},{'model':db[_0x0bd6('0xad')],'as':'Tags','attributes':['id',_0x0bd6('0x37'),'color'],'where':_0x34a101[_0x0bd6('0x41')]['tag']?{'id':_0x34a101[_0x0bd6('0x41')]['tag']}:undefined,'required':_0x34a101[_0x0bd6('0x41')]['tag']?!![]:![]}];}return db[_0x0bd6('0x8c')]['findAll'](_0x5ddc15);})[_0x0bd6('0x20')](function(_0x2c8598){_0x52afa2[_0x0bd6('0x53')]=_0x2c8598;return _0x52afa2;});}})['then'](respondWithFilteredResult(_0x287320,_0x5ddc15))['catch'](handleError(_0x287320,null));};exports['addAgents']=function(_0x2a5a4d,_0x26196a,_0x148a35){return db[_0x0bd6('0x3c')]['find']({'where':{'id':_0x2a5a4d['params']['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x26196a,null))['then'](function(_0x3ec2fa){if(_0x3ec2fa){return _0x3ec2fa[_0x0bd6('0xae')](_0x2a5a4d['body'][_0x0bd6('0xaf')],_[_0x0bd6('0xb0')](_0x2a5a4d['body'],[_0x0bd6('0xaf'),'id'])||{})[_0x0bd6('0xb1')](function(_0xb1610f){for(var _0x3ce75c=0x0;_0x3ce75c<_0x2a5a4d[_0x0bd6('0x59')][_0x0bd6('0xaf')][_0x0bd6('0x47')];_0x3ce75c+=0x1){socket[_0x0bd6('0xb2')](_0x0bd6('0xb3'),{'UserId':Number(_0x2a5a4d[_0x0bd6('0x59')][_0x0bd6('0xaf')][_0x3ce75c]),'OpenchannelAccountId':Number(_0x2a5a4d[_0x0bd6('0x55')]['id'])});}return _0xb1610f;});}})[_0x0bd6('0x20')](respondWithResult(_0x26196a,null))['catch'](handleError(_0x26196a,null));};exports[_0x0bd6('0xb4')]=function(_0x38cd6a,_0x404107,_0x4cda21){return db[_0x0bd6('0x3c')]['find']({'where':{'id':_0x38cd6a[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x404107,null))[_0x0bd6('0x20')](function(_0x2d4184){if(_0x2d4184){return _0x2d4184[_0x0bd6('0xb4')](_0x38cd6a[_0x0bd6('0x41')][_0x0bd6('0xaf')])[_0x0bd6('0x20')](function(){if(_['isArray'](_0x38cd6a[_0x0bd6('0x41')][_0x0bd6('0xaf')])){for(var _0x5a3824=0x0;_0x5a3824<_0x38cd6a[_0x0bd6('0x41')]['ids'][_0x0bd6('0x47')];_0x5a3824+=0x1){socket[_0x0bd6('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x38cd6a[_0x0bd6('0x41')]['ids'][_0x5a3824]),'OpenchannelAccountId':Number(_0x38cd6a['params']['id'])});}}else{socket['emit'](_0x0bd6('0xb5'),{'UserId':Number(_0x38cd6a[_0x0bd6('0x41')][_0x0bd6('0xaf')]),'OpenchannelAccountId':Number(_0x38cd6a[_0x0bd6('0x55')]['id'])});}});}})[_0x0bd6('0x20')](respondWithStatusCode(_0x404107,null))[_0x0bd6('0x61')](handleError(_0x404107,null));};exports[_0x0bd6('0xb6')]=function(_0x59c44c,_0x4c4267,_0x5e5bd3){var _0x12901a={};var _0x4877eb={};var _0x5de937;var _0xf9e492;return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0x59c44c[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x4c4267,null))[_0x0bd6('0x20')](function(_0x361aac){if(_0x361aac){_0x5de937=_0x361aac;_0x4877eb[_0x0bd6('0x40')]=_['keys'](db[_0x0bd6('0x99')][_0x0bd6('0x3d')]);_0x4877eb[_0x0bd6('0x41')]=_['keys'](_0x59c44c[_0x0bd6('0x41')]);_0x4877eb[_0x0bd6('0x43')]=_['intersection'](_0x4877eb[_0x0bd6('0x40')],_0x4877eb[_0x0bd6('0x41')]);_0x12901a[_0x0bd6('0x45')]=_[_0x0bd6('0x44')](_0x4877eb[_0x0bd6('0x40')],qs['fields'](_0x59c44c[_0x0bd6('0x41')]['fields']));_0x12901a['attributes']=_0x12901a[_0x0bd6('0x45')][_0x0bd6('0x47')]?_0x12901a[_0x0bd6('0x45')]:_0x4877eb[_0x0bd6('0x40')];_0x12901a[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0x59c44c['query'][_0x0bd6('0x4a')]);_0x12901a[_0x0bd6('0x4e')]=qs['filters'](_[_0x0bd6('0x4b')](_0x59c44c['query'],_0x4877eb[_0x0bd6('0x43')]));if(_0x59c44c['query'][_0x0bd6('0x4c')]){_0x12901a[_0x0bd6('0x4e')]=_[_0x0bd6('0x4d')](_0x12901a[_0x0bd6('0x4e')],{'$or':_[_0x0bd6('0x3b')](_0x12901a[_0x0bd6('0x45')],function(_0x578367){var _0x1093c4={};_0x1093c4[_0x578367]={'$like':'%'+_0x59c44c[_0x0bd6('0x41')]['filter']+'%'};return _0x1093c4;})});}_0x12901a=_['merge']({},_0x12901a,_0x59c44c[_0x0bd6('0x56')]);return _0x5de937[_0x0bd6('0xb6')](_0x12901a);}})[_0x0bd6('0x20')](function(_0x4ee44f){if(_0x4ee44f){_0xf9e492=_0x4ee44f[_0x0bd6('0x47')];if(!_0x59c44c[_0x0bd6('0x41')]['hasOwnProperty']('nolimit')){_0x12901a[_0x0bd6('0x2c')]=qs['limit'](_0x59c44c[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0x12901a['offset']=qs['offset'](_0x59c44c[_0x0bd6('0x41')][_0x0bd6('0x2a')]);}return _0x5de937[_0x0bd6('0xb6')](_0x12901a);}})[_0x0bd6('0x20')](function(_0x1eeba2){if(_0x1eeba2){return _0x1eeba2?{'count':_0xf9e492,'rows':_0x1eeba2}:null;}})[_0x0bd6('0x20')](respondWithResult(_0x4c4267,null))[_0x0bd6('0x61')](handleError(_0x4c4267,null));};exports[_0x0bd6('0xa7')]=function(_0x32f977,_0x5d23f7,_0xf6fa06){var _0x365dd4,_0x88d332,_0x44d9e4;if(_['isNil'](_0x32f977[_0x0bd6('0x59')]['body'])||_0x32f977['body']['body']===''){throw new db['Sequelize'][(_0x0bd6('0x71'))](_0x0bd6('0x7a'));}if(_[_0x0bd6('0x77')](_0x32f977[_0x0bd6('0x59')]['to'])){}_0x365dd4=_0x32f977[_0x0bd6('0x59')]['to'];return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0x32f977[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x5d23f7,null))['then'](function(_0x1a901d){if(_0x1a901d){return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x1a901d['id']},'include':[{'model':db[_0x0bd6('0xb7')],'as':_0x0bd6('0x7e'),'include':[{'model':db['CmContact'],'as':_0x0bd6('0x7f'),'where':{[_0x1a901d[_0x0bd6('0x7c')]]:_0x365dd4},'limit':0x1,'order':[[_0x0bd6('0x75'),_0x0bd6('0x80')]]}]}]})['then'](handleEntityNotFound(_0x5d23f7,null))[_0x0bd6('0x20')](function(_0x2d9737){if(_0x2d9737&&_0x2d9737[_0x0bd6('0x7e')]){_0x88d332=_0x2d9737[_0x0bd6('0x5a')]({'plain':!![]});if(_0x88d332[_0x0bd6('0x7e')]&&_0x88d332['List'][_0x0bd6('0x7f')][_0x0bd6('0x47')]){return _0x88d332['List'][_0x0bd6('0x7f')][0x0];}return db['CmContact'][_0x0bd6('0x58')](_['defaults'](_0x32f977[_0x0bd6('0x59')],{'firstName':_0x365dd4,[_0x2d9737[_0x0bd6('0x7c')]]:_0x365dd4,'phone':_0x365dd4,'ListId':_0x88d332[_0x0bd6('0xb8')]}));}})[_0x0bd6('0x20')](handleEntityNotFound(_0x5d23f7,null))[_0x0bd6('0x20')](function(_0x251a4b){if(_0x251a4b){_0x44d9e4=_0x251a4b;return db[_0x0bd6('0x8c')][_0x0bd6('0x57')]({'where':{'ContactId':_0x44d9e4['id'],'closed':![],'OpenchannelAccountId':_0x88d332['id']}})['then'](function(_0x1a55c7){if(_0x1a55c7){return[_0x1a55c7,![]];}return db[_0x0bd6('0x8c')][_0x0bd6('0x58')]({'UserId':_0x32f977[_0x0bd6('0x5c')]['id'],'ContactId':_0x44d9e4['id'],'OpenchannelAccountId':_0x88d332['id'],'lastMsgDirection':_0x0bd6('0xb9'),'firstMsgDirection':_0x0bd6('0xb9'),'Messages':[_[_0x0bd6('0x4d')](_0x32f977[_0x0bd6('0x59')],{'read':![],'body':_0x32f977[_0x0bd6('0x59')]['body'],'OpenchannelAccountId':_0x88d332['id'],'UserId':_0x32f977[_0x0bd6('0x5c')]['id'],'ContactId':_0x44d9e4['id']})]},{'include':[{'model':db[_0x0bd6('0x96')],'as':_0x0bd6('0xba')}]})[_0x0bd6('0x20')](function(_0x34a479){return[_0x34a479,!![]];});});}})[_0x0bd6('0xb1')](function(_0x15981c,_0xd9531a){if(_0xd9531a){return _0x15981c;}return db[_0x0bd6('0x96')][_0x0bd6('0x58')](_['merge'](_0x32f977[_0x0bd6('0x59')],{'read':![],'body':_0x32f977[_0x0bd6('0x59')][_0x0bd6('0x59')],'OpenchannelAccountId':_0x88d332['id'],'OpenchannelInteractionId':_0x15981c['id'],'UserId':_0x32f977[_0x0bd6('0x5c')]['id'],'ContactId':_0x44d9e4['id']}))[_0x0bd6('0x20')](function(_0x3762bb){_0x15981c['dataValues'][_0x0bd6('0xba')]=[];_0x15981c[_0x0bd6('0xbb')][_0x0bd6('0xba')][_0x0bd6('0x93')](_0x3762bb['dataValues']);return _0x15981c;});});}})[_0x0bd6('0x20')](respondWithResult(_0x5d23f7,null))[_0x0bd6('0x61')](handleError(_0x5d23f7,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ec6040e..4c6de54 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 _0x702d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x2dbc55,_0x405df5){var _0xeabc2e=function(_0x311e1e){while(--_0x311e1e){_0x2dbc55['push'](_0x2dbc55['shift']());}};_0xeabc2e(++_0x405df5);}(_0x702d,0x147));var _0xd702=function(_0x551eca,_0x38e823){_0x551eca=_0x551eca-0x0;var _0x2e1462=_0x702d[_0x551eca];return _0x2e1462;};'use strict';var EventEmitter=require(_0xd702('0x0'));var OpenchannelAccount=require(_0xd702('0x1'))['db'][_0xd702('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd702('0x3')](0x0);var events={'afterCreate':_0xd702('0x4'),'afterUpdate':'update','afterDestroy':_0xd702('0x5')};function emitEvent(_0xebbd7c){return function(_0x27b260,_0x1c5a32,_0x481ee0){OpenchannelAccountEvents[_0xd702('0x6')](_0xebbd7c+':'+_0x27b260['id'],_0x27b260);OpenchannelAccountEvents['emit'](_0xebbd7c,_0x27b260);_0x481ee0(null);};}for(var e in events){if(events[_0xd702('0x7')](e)){var event=events[e];OpenchannelAccount[_0xd702('0x8')](e,emitEvent(event));}}module[_0xd702('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0x2493e6,_0x34a638){var _0x574d85=function(_0x32a625){while(--_0x32a625){_0x2493e6['push'](_0x2493e6['shift']());}};_0x574d85(++_0x34a638);}(_0xe706,0xa3));var _0x6e70=function(_0x4cad64,_0x13a1d1){_0x4cad64=_0x4cad64-0x0;var _0x1ebb2d=_0xe706[_0x4cad64];return _0x1ebb2d;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4ded5ad..8df9fe6 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(_0x3b45ff,_0x42474f){var _0x433568=function(_0x2db66d){while(--_0x2db66d){_0x3b45ff['push'](_0x3b45ff['shift']());}};_0x433568(++_0x42474f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x43ee6a,_0x12594a){var _0x568c40=function(_0x261e13){while(--_0x261e13){_0x43ee6a['push'](_0x43ee6a['shift']());}};_0x568c40(++_0x12594a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 105a98a..2acd5d3 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 _0x4058=['request','then','debug','code','error','message','OpenchannelAccount,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket'];(function(_0x6541ca,_0x136b06){var _0x34074f=function(_0x2f0623){while(--_0x2f0623){_0x6541ca['push'](_0x6541ca['shift']());}};_0x34074f(++_0x136b06);}(_0x4058,0x129));var _0x8405=function(_0x81f0fc,_0x2c5785){_0x81f0fc=_0x81f0fc-0x0;var _0xd4667d=_0x4058[_0x81f0fc];return _0xd4667d;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});config[_0x8405('0xb')]=_[_0x8405('0xc')](config[_0x8405('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8405('0xd'))(new Redis(config[_0x8405('0xb')]));require(_0x8405('0xe'))['register'](socket);function respondWithRpcPromise(_0x30705f,_0x5e132b,_0x6979fd){return new BPromise(function(_0xb442,_0x50344e){return client[_0x8405('0xf')](_0x30705f,_0x6979fd)[_0x8405('0x10')](function(_0x5b94d5){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,'request\x20sent');logger[_0x8405('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5e132b,'request\x20sent',JSON['stringify'](_0x5b94d5));if(_0x5b94d5['error']){if(_0x5b94d5['error'][_0x8405('0x12')]===0x1f4){logger[_0x8405('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0x50344e(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}logger['error'](_0x8405('0x15'),_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0xb442(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}else{logger[_0x8405('0x16')](_0x8405('0x15'),_0x5e132b,_0x8405('0x17'));_0xb442(_0x5b94d5[_0x8405('0x18')][_0x8405('0x14')]);}})[_0x8405('0x19')](function(_0x21376d){logger[_0x8405('0x13')](_0x8405('0x15'),_0x5e132b,_0x21376d);_0x50344e(_0x21376d);});});} \ No newline at end of file +var _0x7794=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','redis'];(function(_0x413d19,_0x1dd61e){var _0x4f3548=function(_0x296ee8){while(--_0x296ee8){_0x413d19['push'](_0x413d19['shift']());}};_0x4f3548(++_0x1dd61e);}(_0x7794,0x7b));var _0x4779=function(_0x2b02bd,_0x52d304){_0x2b02bd=_0x2b02bd-0x0;var _0x3208b3=_0x7794[_0x2b02bd];return _0x3208b3;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});config[_0x4779('0x8')]=_['defaults'](config[_0x4779('0x8')],{'host':_0x4779('0x9'),'port':0x18eb});var socket=require(_0x4779('0xa'))(new Redis(config[_0x4779('0x8')]));require(_0x4779('0xb'))[_0x4779('0xc')](socket);function respondWithRpcPromise(_0x42e4c0,_0x5e4992,_0x42883e){return new BPromise(function(_0x33ebc7,_0x3a5f2d){return client[_0x4779('0xd')](_0x42e4c0,_0x42883e)[_0x4779('0xe')](function(_0x106081){logger[_0x4779('0xf')](_0x4779('0x10'),_0x5e4992,_0x4779('0x11'));logger[_0x4779('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5e4992,'request\x20sent',JSON['stringify'](_0x106081));if(_0x106081[_0x4779('0x13')]){if(_0x106081[_0x4779('0x13')][_0x4779('0x14')]===0x1f4){logger[_0x4779('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e4992,_0x106081[_0x4779('0x13')][_0x4779('0x15')]);return _0x3a5f2d(_0x106081['error']['message']);}logger[_0x4779('0x13')](_0x4779('0x10'),_0x5e4992,_0x106081[_0x4779('0x13')][_0x4779('0x15')]);return _0x33ebc7(_0x106081['error']['message']);}else{logger[_0x4779('0xf')](_0x4779('0x10'),_0x5e4992,_0x4779('0x11'));_0x33ebc7(_0x106081['result'][_0x4779('0x15')]);}})['catch'](function(_0x2b40f9){logger[_0x4779('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e4992,_0x2b40f9);_0x3a5f2d(_0x2b40f9);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5cdd696..2502264 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 _0x876b=['emit','removeListener','register','openchannelAccount:','remove','update'];(function(_0x574bd5,_0x2ecbec){var _0x59a165=function(_0x2cd3ac){while(--_0x2cd3ac){_0x574bd5['push'](_0x574bd5['shift']());}};_0x59a165(++_0x2ecbec);}(_0x876b,0x1ba));var _0xb876=function(_0x1faf07,_0x461ef7){_0x1faf07=_0x1faf07-0x0;var _0xca25d=_0x876b[_0x1faf07];return _0xca25d;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xb876('0x0'),_0xb876('0x1')];function createListener(_0x5c6895,_0x569fc2){return function(_0x34a150){_0x569fc2[_0xb876('0x2')](_0x5c6895,_0x34a150);};}function removeListener(_0x4e24d3,_0x23429e){return function(){OpenchannelAccountEvents[_0xb876('0x3')](_0x4e24d3,_0x23429e);};}exports[_0xb876('0x4')]=function(_0x5e1da8){for(var _0x275125=0x0,_0x4353cf=events['length'];_0x275125<_0x4353cf;_0x275125++){var _0x309bfd=events[_0x275125];var _0xcbf343=createListener(_0xb876('0x5')+_0x309bfd,_0x5e1da8);OpenchannelAccountEvents['on'](_0x309bfd,_0xcbf343);}}; \ No newline at end of file +var _0x3d9c=['./openchannelAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x234cb1,_0x262065){var _0x5767f7=function(_0xb46d21){while(--_0xb46d21){_0x234cb1['push'](_0x234cb1['shift']());}};_0x5767f7(++_0x262065);}(_0x3d9c,0x134));var _0xc3d9=function(_0x4e063d,_0x582e55){_0x4e063d=_0x4e063d-0x0;var _0x629ef1=_0x3d9c[_0x4e063d];return _0x629ef1;};'use strict';var OpenchannelAccountEvents=require(_0xc3d9('0x0'));var events=['save',_0xc3d9('0x1'),_0xc3d9('0x2')];function createListener(_0x37276,_0x4e5c08){return function(_0x3da630){_0x4e5c08[_0xc3d9('0x3')](_0x37276,_0x3da630);};}function removeListener(_0x2532cf,_0x2a94a2){return function(){OpenchannelAccountEvents[_0xc3d9('0x4')](_0x2532cf,_0x2a94a2);};}exports[_0xc3d9('0x5')]=function(_0x137aaf){for(var _0x492577=0x0,_0x375380=events[_0xc3d9('0x6')];_0x492577<_0x375380;_0x492577++){var _0x4ecff0=events[_0x492577];var _0x3c0a2f=createListener('openchannelAccount:'+_0x4ecff0,_0x137aaf);OpenchannelAccountEvents['on'](_0x4ecff0,_0x3c0a2f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index bbdb264..453454b 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 _0x6beb=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x6beb,0x101));var _0xb6be=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6beb[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xb6be('0x0'));var util=require('util');var path=require(_0xb6be('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb6be('0x2')]();var fs_extra=require(_0xb6be('0x3'));var auth=require(_0xb6be('0x4'));var interaction=require(_0xb6be('0x5'));var config=require(_0xb6be('0x6'));var controller=require(_0xb6be('0x7'));router[_0xb6be('0x8')]('/',auth[_0xb6be('0x9')](),controller[_0xb6be('0xa')]);router[_0xb6be('0x8')](_0xb6be('0xb'),auth['isAuthenticated'](),controller[_0xb6be('0xc')]);router[_0xb6be('0xd')]('/',auth[_0xb6be('0x9')](),controller[_0xb6be('0xe')]);router[_0xb6be('0xf')](_0xb6be('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xb6be('0x10')](_0xb6be('0xb'),auth[_0xb6be('0x9')](),controller[_0xb6be('0x11')]);module[_0xb6be('0x12')]=router; \ No newline at end of file +var _0xf4b7=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy'];(function(_0x5ab598,_0x1bd5d3){var _0x31e12a=function(_0x322efd){while(--_0x322efd){_0x5ab598['push'](_0x5ab598['shift']());}};_0x31e12a(++_0x1bd5d3);}(_0xf4b7,0x1ef));var _0x7f4b=function(_0x37a420,_0x203dba){_0x37a420=_0x37a420-0x0;var _0x22706e=_0xf4b7[_0x37a420];return _0x22706e;};'use strict';var multer=require('multer');var util=require(_0x7f4b('0x0'));var path=require(_0x7f4b('0x1'));var timeout=require(_0x7f4b('0x2'));var express=require(_0x7f4b('0x3'));var router=express[_0x7f4b('0x4')]();var fs_extra=require(_0x7f4b('0x5'));var auth=require(_0x7f4b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f4b('0x7'));router[_0x7f4b('0x8')]('/',auth[_0x7f4b('0x9')](),controller[_0x7f4b('0xa')]);router[_0x7f4b('0x8')]('/:id',auth[_0x7f4b('0x9')](),controller[_0x7f4b('0xb')]);router[_0x7f4b('0xc')]('/',auth[_0x7f4b('0x9')](),controller[_0x7f4b('0xd')]);router[_0x7f4b('0xe')]('/:id',auth[_0x7f4b('0x9')](),controller['update']);router[_0x7f4b('0xf')](_0x7f4b('0x10'),auth[_0x7f4b('0x9')](),controller[_0x7f4b('0x11')]);module[_0x7f4b('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 109b31e..e52d725 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 _0xbdcc=['TEXT','STRING','sequelize','exports','INTEGER','noop'];(function(_0x2f9138,_0x493638){var _0x21e94e=function(_0x384e6d){while(--_0x384e6d){_0x2f9138['push'](_0x2f9138['shift']());}};_0x21e94e(++_0x493638);}(_0xbdcc,0x68));var _0xcbdc=function(_0x399dd1,_0x4719aa){_0x399dd1=_0x399dd1-0x0;var _0x3d88c8=_0xbdcc[_0x399dd1];return _0x3d88c8;};'use strict';var Sequelize=require(_0xcbdc('0x0'));module[_0xcbdc('0x1')]={'priority':{'type':Sequelize[_0xcbdc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcbdc('0x3')},'appdata':{'type':Sequelize[_0xcbdc('0x4')]()},'description':{'type':Sequelize[_0xcbdc('0x5')]},'interval':{'type':Sequelize[_0xcbdc('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe657=['exports','INTEGER','STRING','noop','sequelize'];(function(_0x1de8cc,_0x3e3f90){var _0x6f59fa=function(_0x4e3f5e){while(--_0x4e3f5e){_0x1de8cc['push'](_0x1de8cc['shift']());}};_0x6f59fa(++_0x3e3f90);}(_0xe657,0x1f3));var _0x7e65=function(_0x5a306d,_0x101e07){_0x5a306d=_0x5a306d-0x0;var _0x54dfcf=_0xe657[_0x5a306d];return _0x54dfcf;};'use strict';var Sequelize=require(_0x7e65('0x0'));module[_0x7e65('0x1')]={'priority':{'type':Sequelize[_0x7e65('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7e65('0x3')],'allowNull':![],'defaultValue':_0x7e65('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7e65('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e0f0692..420851c 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 _0xce2e=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','OpenchannelApplication','rows','params','keys','rawAttributes','find','catch','create','body','eml-format','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','save','update','then','destroy','error','name','index'];(function(_0x2a0429,_0x61233b){var _0x227b95=function(_0x5b9fb5){while(--_0x5b9fb5){_0x2a0429['push'](_0x2a0429['shift']());}};_0x227b95(++_0x61233b);}(_0xce2e,0x1db));var _0xece2=function(_0x585dd8,_0x26f3a7){_0x585dd8=_0x585dd8-0x0;var _0x3447e5=_0xce2e[_0x585dd8];return _0x3447e5;};'use strict';var emlformat=require(_0xece2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xece2('0x1'));var moment=require(_0xece2('0x2'));var BPromise=require(_0xece2('0x3'));var Mustache=require('mustache');var util=require(_0xece2('0x4'));var path=require('path');var sox=require(_0xece2('0x5'));var csv=require(_0xece2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xece2('0x7'));var squel=require(_0xece2('0x8'));var crypto=require(_0xece2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xece2('0xa'));var toCsv=require(_0xece2('0x6'));var querystring=require(_0xece2('0xb'));var Papa=require(_0xece2('0xc'));var Redis=require(_0xece2('0xd'));var authService=require(_0xece2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xece2('0xf'));var hardwareService=require(_0xece2('0x10'));var logger=require('../../config/logger')(_0xece2('0x11'));var utils=require('../../config/utils');var config=require(_0xece2('0x12'));var licenseUtil=require(_0xece2('0x13'));var db=require(_0xece2('0x14'))['db'];function respondWithStatusCode(_0x269957,_0x1d372a){_0x1d372a=_0x1d372a||0xcc;return function(_0x31cd91){if(_0x31cd91){return _0x269957[_0xece2('0x15')](_0x1d372a);}return _0x269957[_0xece2('0x16')](_0x1d372a)[_0xece2('0x17')]();};}function respondWithResult(_0xce80f9,_0x4e682a){_0x4e682a=_0x4e682a||0xc8;return function(_0x5a9a21){if(_0x5a9a21){return _0xce80f9[_0xece2('0x16')](_0x4e682a)[_0xece2('0x18')](_0x5a9a21);}};}function respondWithFilteredResult(_0xde3029,_0x46b3e5){return function(_0x505e53){if(_0x505e53){var _0x3df165=typeof _0x46b3e5[_0xece2('0x19')]==='undefined'&&typeof _0x46b3e5[_0xece2('0x1a')]===_0xece2('0x1b');var _0x58c3a1=_0x505e53['count'];var _0x5d62a=_0x3df165?0x0:_0x46b3e5[_0xece2('0x19')];var _0x29059e=_0x3df165?_0x505e53['count']:_0x46b3e5['offset']+_0x46b3e5[_0xece2('0x1a')];var _0xf6f5cd;if(_0x29059e>=_0x58c3a1){_0x29059e=_0x58c3a1;_0xf6f5cd=0xc8;}else{_0xf6f5cd=0xce;}_0xde3029[_0xece2('0x16')](_0xf6f5cd);return _0xde3029[_0xece2('0x1c')](_0xece2('0x1d'),_0x5d62a+'-'+_0x29059e+'/'+_0x58c3a1)['json'](_0x505e53);}return null;};}function patchUpdates(_0x2b877c){return function(_0x21d012){try{jsonpatch['apply'](_0x21d012,_0x2b877c,!![]);}catch(_0x264334){return BPromise['reject'](_0x264334);}return _0x21d012[_0xece2('0x1e')]();};}function saveUpdates(_0x4c0397,_0x4a7a43){return function(_0x2673d3){if(_0x2673d3){return _0x2673d3[_0xece2('0x1f')](_0x4c0397)[_0xece2('0x20')](function(_0x1fa8a1){return _0x1fa8a1;});}return null;};}function removeEntity(_0x43b0a3,_0xa4b07c){return function(_0x14c432){if(_0x14c432){return _0x14c432[_0xece2('0x21')]()[_0xece2('0x20')](function(){_0x43b0a3[_0xece2('0x16')](0xcc)[_0xece2('0x17')]();});}};}function handleEntityNotFound(_0x54533c,_0x59ebca){return function(_0x49dcea){if(!_0x49dcea){_0x54533c['sendStatus'](0x194);}return _0x49dcea;};}function handleError(_0x4ea02d,_0x13b0be){_0x13b0be=_0x13b0be||0x1f4;return function(_0x117e0e){logger[_0xece2('0x22')](_0x117e0e['stack']);if(_0x117e0e[_0xece2('0x23')]){delete _0x117e0e['name'];}_0x4ea02d[_0xece2('0x16')](_0x13b0be)['send'](_0x117e0e);};}exports[_0xece2('0x24')]=function(_0x9ad466,_0x24e7e1){var _0x56bd04={},_0x33f346={},_0x53d117={'count':0x0,'rows':[]};var _0x3147be=_['map'](db['OpenchannelApplication']['rawAttributes'],function(_0x4d1f04){return{'name':_0x4d1f04['fieldName'],'type':_0x4d1f04['type']['key']};});_0x33f346[_0xece2('0x25')]=_['map'](_0x3147be,_0xece2('0x23'));_0x33f346['query']=_['keys'](_0x9ad466[_0xece2('0x26')]);_0x33f346[_0xece2('0x27')]=_[_0xece2('0x28')](_0x33f346['model'],_0x33f346[_0xece2('0x26')]);_0x56bd04['attributes']=_[_0xece2('0x28')](_0x33f346[_0xece2('0x25')],qs[_0xece2('0x29')](_0x9ad466[_0xece2('0x26')][_0xece2('0x29')]));_0x56bd04[_0xece2('0x2a')]=_0x56bd04[_0xece2('0x2a')][_0xece2('0x2b')]?_0x56bd04[_0xece2('0x2a')]:_0x33f346[_0xece2('0x25')];if(!_0x9ad466[_0xece2('0x26')][_0xece2('0x2c')](_0xece2('0x2d'))){_0x56bd04['limit']=qs[_0xece2('0x1a')](_0x9ad466['query']['limit']);_0x56bd04[_0xece2('0x19')]=qs[_0xece2('0x19')](_0x9ad466[_0xece2('0x26')]['offset']);}_0x56bd04[_0xece2('0x2e')]=qs[_0xece2('0x2f')](_0x9ad466[_0xece2('0x26')][_0xece2('0x2f')]);_0x56bd04[_0xece2('0x30')]=qs[_0xece2('0x27')](_[_0xece2('0x31')](_0x9ad466[_0xece2('0x26')],_0x33f346['filters']),_0x3147be);if(_0x9ad466[_0xece2('0x26')][_0xece2('0x32')]){_0x56bd04[_0xece2('0x30')]=_['merge'](_0x56bd04[_0xece2('0x30')],{'$or':_['map'](_0x3147be,function(_0x449bd2){if(_0x449bd2['type']!=='VIRTUAL'){var _0x5130b5={};_0x5130b5[_0x449bd2[_0xece2('0x23')]]={'$like':'%'+_0x9ad466['query'][_0xece2('0x32')]+'%'};return _0x5130b5;}})});}_0x56bd04=_[_0xece2('0x33')]({},_0x56bd04,_0x9ad466[_0xece2('0x34')]);var _0x24c927={'where':_0x56bd04[_0xece2('0x30')]};return db['OpenchannelApplication'][_0xece2('0x35')](_0x24c927)['then'](function(_0x319376){_0x53d117[_0xece2('0x35')]=_0x319376;if(_0x9ad466[_0xece2('0x26')][_0xece2('0x36')]){_0x56bd04['include']=[{'all':!![]}];}return db[_0xece2('0x37')]['findAll'](_0x56bd04);})[_0xece2('0x20')](function(_0x2f73fd){_0x53d117[_0xece2('0x38')]=_0x2f73fd;return _0x53d117;})[_0xece2('0x20')](respondWithFilteredResult(_0x24e7e1,_0x56bd04))['catch'](handleError(_0x24e7e1,null));};exports['show']=function(_0x5cb4fa,_0x5ea517){var _0x4de988={'raw':!![],'where':{'id':_0x5cb4fa[_0xece2('0x39')]['id']}},_0x2dd35e={};_0x2dd35e[_0xece2('0x25')]=_[_0xece2('0x3a')](db['OpenchannelApplication'][_0xece2('0x3b')]);_0x2dd35e[_0xece2('0x26')]=_[_0xece2('0x3a')](_0x5cb4fa[_0xece2('0x26')]);_0x2dd35e['filters']=_[_0xece2('0x28')](_0x2dd35e[_0xece2('0x25')],_0x2dd35e[_0xece2('0x26')]);_0x4de988[_0xece2('0x2a')]=_[_0xece2('0x28')](_0x2dd35e[_0xece2('0x25')],qs[_0xece2('0x29')](_0x5cb4fa[_0xece2('0x26')]['fields']));_0x4de988[_0xece2('0x2a')]=_0x4de988[_0xece2('0x2a')][_0xece2('0x2b')]?_0x4de988[_0xece2('0x2a')]:_0x2dd35e[_0xece2('0x25')];if(_0x5cb4fa[_0xece2('0x26')][_0xece2('0x36')]){_0x4de988['include']=[{'all':!![]}];}_0x4de988=_[_0xece2('0x33')]({},_0x4de988,_0x5cb4fa[_0xece2('0x34')]);return db[_0xece2('0x37')][_0xece2('0x3c')](_0x4de988)[_0xece2('0x20')](handleEntityNotFound(_0x5ea517,null))[_0xece2('0x20')](respondWithResult(_0x5ea517,null))[_0xece2('0x3d')](handleError(_0x5ea517,null));};exports[_0xece2('0x3e')]=function(_0x15f20f,_0x3e97b6){return db[_0xece2('0x37')][_0xece2('0x3e')](_0x15f20f[_0xece2('0x3f')],{})[_0xece2('0x20')](respondWithResult(_0x3e97b6,0xc9))['catch'](handleError(_0x3e97b6,null));};exports[_0xece2('0x1f')]=function(_0x445409,_0x31b60a){if(_0x445409['body']['id']){delete _0x445409['body']['id'];}return db[_0xece2('0x37')][_0xece2('0x3c')]({'where':{'id':_0x445409['params']['id']}})[_0xece2('0x20')](handleEntityNotFound(_0x31b60a,null))[_0xece2('0x20')](saveUpdates(_0x445409['body'],null))['then'](respondWithResult(_0x31b60a,null))[_0xece2('0x3d')](handleError(_0x31b60a,null));};exports['destroy']=function(_0x442941,_0x55fc83){return db[_0xece2('0x37')][_0xece2('0x3c')]({'where':{'id':_0x442941[_0xece2('0x39')]['id']}})['then'](handleEntityNotFound(_0x55fc83,null))[_0xece2('0x20')](removeEntity(_0x55fc83,null))['catch'](handleError(_0x55fc83,null));}; \ No newline at end of file +var _0x4fb9=['key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','findAll','show','params','rawAttributes','include','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../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','apply','reject','save','update','then','destroy','end','error','stack','send','map','OpenchannelApplication'];(function(_0x4a9bf4,_0x278ac7){var _0x14856a=function(_0x5ef98a){while(--_0x5ef98a){_0x4a9bf4['push'](_0x4a9bf4['shift']());}};_0x14856a(++_0x278ac7);}(_0x4fb9,0x69));var _0x94fb=function(_0x2a6130,_0x258d87){_0x2a6130=_0x2a6130-0x0;var _0x1e02b6=_0x4fb9[_0x2a6130];return _0x1e02b6;};'use strict';var emlformat=require(_0x94fb('0x0'));var rimraf=require(_0x94fb('0x1'));var zipdir=require(_0x94fb('0x2'));var jsonpatch=require(_0x94fb('0x3'));var rp=require(_0x94fb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x94fb('0x5'));var util=require(_0x94fb('0x6'));var path=require(_0x94fb('0x7'));var sox=require(_0x94fb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94fb('0x9'));var _=require(_0x94fb('0xa'));var squel=require('squel');var crypto=require(_0x94fb('0xb'));var jsforce=require(_0x94fb('0xc'));var deskjs=require(_0x94fb('0xd'));var toCsv=require(_0x94fb('0xe'));var querystring=require(_0x94fb('0xf'));var Papa=require('papaparse');var Redis=require(_0x94fb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x94fb('0x11'));var hardwareService=require(_0x94fb('0x12'));var logger=require(_0x94fb('0x13'))('api');var utils=require(_0x94fb('0x14'));var config=require(_0x94fb('0x15'));var licenseUtil=require(_0x94fb('0x16'));var db=require(_0x94fb('0x17'))['db'];function respondWithStatusCode(_0x4065aa,_0x2e1e65){_0x2e1e65=_0x2e1e65||0xcc;return function(_0x3f1373){if(_0x3f1373){return _0x4065aa[_0x94fb('0x18')](_0x2e1e65);}return _0x4065aa[_0x94fb('0x19')](_0x2e1e65)['end']();};}function respondWithResult(_0x4b09a0,_0x3728b6){_0x3728b6=_0x3728b6||0xc8;return function(_0x1317ec){if(_0x1317ec){return _0x4b09a0['status'](_0x3728b6)[_0x94fb('0x1a')](_0x1317ec);}};}function respondWithFilteredResult(_0x257818,_0x49fcab){return function(_0x138554){if(_0x138554){var _0x2dfc6f=typeof _0x49fcab[_0x94fb('0x1b')]===_0x94fb('0x1c')&&typeof _0x49fcab[_0x94fb('0x1d')]===_0x94fb('0x1c');var _0x38a977=_0x138554[_0x94fb('0x1e')];var _0x3dc5af=_0x2dfc6f?0x0:_0x49fcab[_0x94fb('0x1b')];var _0x214aef=_0x2dfc6f?_0x138554[_0x94fb('0x1e')]:_0x49fcab['offset']+_0x49fcab['limit'];var _0x37baf4;if(_0x214aef>=_0x38a977){_0x214aef=_0x38a977;_0x37baf4=0xc8;}else{_0x37baf4=0xce;}_0x257818[_0x94fb('0x19')](_0x37baf4);return _0x257818[_0x94fb('0x1f')](_0x94fb('0x20'),_0x3dc5af+'-'+_0x214aef+'/'+_0x38a977)['json'](_0x138554);}return null;};}function patchUpdates(_0x20912f){return function(_0x514860){try{jsonpatch[_0x94fb('0x21')](_0x514860,_0x20912f,!![]);}catch(_0x41f28b){return BPromise[_0x94fb('0x22')](_0x41f28b);}return _0x514860[_0x94fb('0x23')]();};}function saveUpdates(_0x7151ff,_0x561b68){return function(_0x5d198e){if(_0x5d198e){return _0x5d198e[_0x94fb('0x24')](_0x7151ff)[_0x94fb('0x25')](function(_0x4ddc62){return _0x4ddc62;});}return null;};}function removeEntity(_0x5ad0e3,_0xecdc12){return function(_0x5090af){if(_0x5090af){return _0x5090af[_0x94fb('0x26')]()['then'](function(){_0x5ad0e3[_0x94fb('0x19')](0xcc)[_0x94fb('0x27')]();});}};}function handleEntityNotFound(_0x51cd8f,_0x401123){return function(_0x2160a6){if(!_0x2160a6){_0x51cd8f['sendStatus'](0x194);}return _0x2160a6;};}function handleError(_0xe13e2,_0x563592){_0x563592=_0x563592||0x1f4;return function(_0x4feb97){logger[_0x94fb('0x28')](_0x4feb97[_0x94fb('0x29')]);if(_0x4feb97['name']){delete _0x4feb97['name'];}_0xe13e2[_0x94fb('0x19')](_0x563592)[_0x94fb('0x2a')](_0x4feb97);};}exports['index']=function(_0x42812d,_0x38785e){var _0x28d490={},_0x5aecea={},_0x4c12b7={'count':0x0,'rows':[]};var _0x6e49cb=_[_0x94fb('0x2b')](db[_0x94fb('0x2c')]['rawAttributes'],function(_0x11b0c8){return{'name':_0x11b0c8['fieldName'],'type':_0x11b0c8['type'][_0x94fb('0x2d')]};});_0x5aecea[_0x94fb('0x2e')]=_[_0x94fb('0x2b')](_0x6e49cb,_0x94fb('0x2f'));_0x5aecea[_0x94fb('0x30')]=_[_0x94fb('0x31')](_0x42812d[_0x94fb('0x30')]);_0x5aecea[_0x94fb('0x32')]=_[_0x94fb('0x33')](_0x5aecea['model'],_0x5aecea[_0x94fb('0x30')]);_0x28d490[_0x94fb('0x34')]=_[_0x94fb('0x33')](_0x5aecea['model'],qs[_0x94fb('0x35')](_0x42812d[_0x94fb('0x30')][_0x94fb('0x35')]));_0x28d490[_0x94fb('0x34')]=_0x28d490[_0x94fb('0x34')][_0x94fb('0x36')]?_0x28d490[_0x94fb('0x34')]:_0x5aecea[_0x94fb('0x2e')];if(!_0x42812d[_0x94fb('0x30')][_0x94fb('0x37')](_0x94fb('0x38'))){_0x28d490[_0x94fb('0x1d')]=qs[_0x94fb('0x1d')](_0x42812d[_0x94fb('0x30')]['limit']);_0x28d490['offset']=qs[_0x94fb('0x1b')](_0x42812d[_0x94fb('0x30')][_0x94fb('0x1b')]);}_0x28d490[_0x94fb('0x39')]=qs[_0x94fb('0x3a')](_0x42812d[_0x94fb('0x30')]['sort']);_0x28d490['where']=qs[_0x94fb('0x32')](_[_0x94fb('0x3b')](_0x42812d[_0x94fb('0x30')],_0x5aecea[_0x94fb('0x32')]),_0x6e49cb);if(_0x42812d['query'][_0x94fb('0x3c')]){_0x28d490[_0x94fb('0x3d')]=_['merge'](_0x28d490[_0x94fb('0x3d')],{'$or':_[_0x94fb('0x2b')](_0x6e49cb,function(_0x505677){if(_0x505677[_0x94fb('0x3e')]!==_0x94fb('0x3f')){var _0x3fc098={};_0x3fc098[_0x505677[_0x94fb('0x2f')]]={'$like':'%'+_0x42812d[_0x94fb('0x30')][_0x94fb('0x3c')]+'%'};return _0x3fc098;}})});}_0x28d490=_['merge']({},_0x28d490,_0x42812d[_0x94fb('0x40')]);var _0x9fcfc1={'where':_0x28d490[_0x94fb('0x3d')]};return db[_0x94fb('0x2c')][_0x94fb('0x1e')](_0x9fcfc1)[_0x94fb('0x25')](function(_0x2e444a){_0x4c12b7['count']=_0x2e444a;if(_0x42812d[_0x94fb('0x30')]['includeAll']){_0x28d490['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x94fb('0x41')](_0x28d490);})[_0x94fb('0x25')](function(_0x391763){_0x4c12b7['rows']=_0x391763;return _0x4c12b7;})['then'](respondWithFilteredResult(_0x38785e,_0x28d490))['catch'](handleError(_0x38785e,null));};exports[_0x94fb('0x42')]=function(_0x38acd2,_0x164b51){var _0x13de37={'raw':!![],'where':{'id':_0x38acd2[_0x94fb('0x43')]['id']}},_0x2f7124={};_0x2f7124['model']=_[_0x94fb('0x31')](db[_0x94fb('0x2c')][_0x94fb('0x44')]);_0x2f7124[_0x94fb('0x30')]=_[_0x94fb('0x31')](_0x38acd2[_0x94fb('0x30')]);_0x2f7124['filters']=_[_0x94fb('0x33')](_0x2f7124[_0x94fb('0x2e')],_0x2f7124[_0x94fb('0x30')]);_0x13de37[_0x94fb('0x34')]=_['intersection'](_0x2f7124[_0x94fb('0x2e')],qs[_0x94fb('0x35')](_0x38acd2[_0x94fb('0x30')]['fields']));_0x13de37['attributes']=_0x13de37[_0x94fb('0x34')][_0x94fb('0x36')]?_0x13de37[_0x94fb('0x34')]:_0x2f7124[_0x94fb('0x2e')];if(_0x38acd2[_0x94fb('0x30')]['includeAll']){_0x13de37[_0x94fb('0x45')]=[{'all':!![]}];}_0x13de37=_[_0x94fb('0x46')]({},_0x13de37,_0x38acd2[_0x94fb('0x40')]);return db[_0x94fb('0x2c')][_0x94fb('0x47')](_0x13de37)[_0x94fb('0x25')](handleEntityNotFound(_0x164b51,null))[_0x94fb('0x25')](respondWithResult(_0x164b51,null))[_0x94fb('0x48')](handleError(_0x164b51,null));};exports[_0x94fb('0x49')]=function(_0x2fc61b,_0x243773){return db[_0x94fb('0x2c')]['create'](_0x2fc61b[_0x94fb('0x4a')],{})[_0x94fb('0x25')](respondWithResult(_0x243773,0xc9))['catch'](handleError(_0x243773,null));};exports['update']=function(_0x385445,_0x3219ea){if(_0x385445['body']['id']){delete _0x385445[_0x94fb('0x4a')]['id'];}return db[_0x94fb('0x2c')][_0x94fb('0x47')]({'where':{'id':_0x385445[_0x94fb('0x43')]['id']}})[_0x94fb('0x25')](handleEntityNotFound(_0x3219ea,null))[_0x94fb('0x25')](saveUpdates(_0x385445['body'],null))[_0x94fb('0x25')](respondWithResult(_0x3219ea,null))[_0x94fb('0x48')](handleError(_0x3219ea,null));};exports[_0x94fb('0x26')]=function(_0x4b8489,_0xaefd77){return db[_0x94fb('0x2c')][_0x94fb('0x47')]({'where':{'id':_0x4b8489[_0x94fb('0x43')]['id']}})[_0x94fb('0x25')](handleEntityNotFound(_0xaefd77,null))['then'](removeEntity(_0xaefd77,null))['catch'](handleError(_0xaefd77,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1454725..cf96fc7 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 _0xf160=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x35db9d,_0x2ad7d7){var _0x1f6d09=function(_0x3b803b){while(--_0x3b803b){_0x35db9d['push'](_0x35db9d['shift']());}};_0x1f6d09(++_0x2ad7d7);}(_0xf160,0x161));var _0x0f16=function(_0x4dbbc1,_0x5db2ff){_0x4dbbc1=_0x4dbbc1-0x0;var _0x184837=_0xf160[_0x4dbbc1];return _0x184837;};'use strict';var _=require(_0x0f16('0x0'));var util=require(_0x0f16('0x1'));var logger=require(_0x0f16('0x2'))(_0x0f16('0x3'));var moment=require(_0x0f16('0x4'));var BPromise=require(_0x0f16('0x5'));var rp=require(_0x0f16('0x6'));var fs=require('fs');var path=require(_0x0f16('0x7'));var rimraf=require(_0x0f16('0x8'));var config=require(_0x0f16('0x9'));var attributes=require('./openchannelApplication.attributes');module[_0x0f16('0xa')]=function(_0x1aa7e4,_0x38afa5){return _0x1aa7e4[_0x0f16('0xb')](_0x0f16('0xc'),attributes,{'tableName':_0x0f16('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0f16('0xe'),'collate':_0x0f16('0xf')});}; \ No newline at end of file +var _0xee04=['utf8mb4','util','api','moment','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x4eaa9c,_0x3a879a){var _0x46b796=function(_0x41f4bc){while(--_0x41f4bc){_0x4eaa9c['push'](_0x4eaa9c['shift']());}};_0x46b796(++_0x3a879a);}(_0xee04,0x6f));var _0x4ee0=function(_0x3d6532,_0x5ca2aa){_0x3d6532=_0x3d6532-0x0;var _0x3f7adb=_0xee04[_0x3d6532];return _0x3f7adb;};'use strict';var _=require('lodash');var util=require(_0x4ee0('0x0'));var logger=require('../../config/logger')(_0x4ee0('0x1'));var moment=require(_0x4ee0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ee0('0x3'));var rimraf=require(_0x4ee0('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ee0('0x5'));module[_0x4ee0('0x6')]=function(_0x491297,_0x41441c){return _0x491297[_0x4ee0('0x7')](_0x4ee0('0x8'),attributes,{'tableName':_0x4ee0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ee0('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d08228a..acfb5d0 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 _0xda06=['options','raw','where','attributes','limit','UpdateOpenchannelApplication','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','error','code','message','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','result','catch','update','body'];(function(_0x54da3f,_0x3c3eb){var _0x2c9624=function(_0x2d7ade){while(--_0x2d7ade){_0x54da3f['push'](_0x54da3f['shift']());}};_0x2c9624(++_0x3c3eb);}(_0xda06,0x18e));var _0x6da0=function(_0x128d75,_0x7ef83c){_0x128d75=_0x128d75-0x0;var _0x2034e3=_0xda06[_0x128d75];return _0x2034e3;};'use strict';var _=require('lodash');var util=require(_0x6da0('0x0'));var moment=require(_0x6da0('0x1'));var BPromise=require(_0x6da0('0x2'));var rs=require(_0x6da0('0x3'));var fs=require('fs');var Redis=require(_0x6da0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6da0('0x5'))(_0x6da0('0x6'));var config=require(_0x6da0('0x7'));var jayson=require(_0x6da0('0x8'));var client=jayson[_0x6da0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cbf8c,_0x30d74d,_0x5b18eb){return new BPromise(function(_0x208ce2,_0x5e9e40){return client['request'](_0x1cbf8c,_0x5b18eb)[_0x6da0('0xa')](function(_0x1601f1){logger[_0x6da0('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x30d74d,'request\x20sent');logger[_0x6da0('0xc')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x30d74d,'request\x20sent',JSON['stringify'](_0x1601f1));if(_0x1601f1[_0x6da0('0xd')]){if(_0x1601f1[_0x6da0('0xd')][_0x6da0('0xe')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x30d74d,_0x1601f1[_0x6da0('0xd')][_0x6da0('0xf')]);return _0x5e9e40(_0x1601f1['error'][_0x6da0('0xf')]);}logger[_0x6da0('0xd')](_0x6da0('0x10'),_0x30d74d,_0x1601f1[_0x6da0('0xd')]['message']);return _0x208ce2(_0x1601f1[_0x6da0('0xd')]['message']);}else{logger[_0x6da0('0xb')](_0x6da0('0x10'),_0x30d74d,_0x6da0('0x11'));_0x208ce2(_0x1601f1[_0x6da0('0x12')][_0x6da0('0xf')]);}})[_0x6da0('0x13')](function(_0x21e57e){logger[_0x6da0('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x30d74d,_0x21e57e);_0x5e9e40(_0x21e57e);});});}exports['UpdateOpenchannelApplication']=function(_0x504786){var _0x5d560a=this;return new Promise(function(_0x1c0ae0,_0x27f217){return db['OpenchannelApplication'][_0x6da0('0x14')](_0x504786[_0x6da0('0x15')],{'raw':_0x504786[_0x6da0('0x16')]?_0x504786[_0x6da0('0x16')][_0x6da0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x504786[_0x6da0('0x16')]?_0x504786[_0x6da0('0x16')][_0x6da0('0x18')]||null:null,'attributes':_0x504786[_0x6da0('0x16')]?_0x504786['options'][_0x6da0('0x19')]||null:null,'limit':_0x504786[_0x6da0('0x16')]?_0x504786[_0x6da0('0x16')][_0x6da0('0x1a')]||null:null})['then'](function(_0x51e129){logger[_0x6da0('0xb')](_0x6da0('0x1b'),_0x504786);logger[_0x6da0('0xc')](_0x6da0('0x1b'),_0x504786,JSON['stringify'](_0x51e129));_0x1c0ae0(_0x51e129);})[_0x6da0('0x13')](function(_0x53e439){logger[_0x6da0('0xd')](_0x6da0('0x1b'),_0x53e439['message'],_0x504786);_0x27f217(_0x5d560a[_0x6da0('0xd')](0x1f4,_0x53e439[_0x6da0('0xf')]));});});}; \ No newline at end of file +var _0x60d9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where','stringify','util'];(function(_0x5970f3,_0x4b2849){var _0x5b542e=function(_0x5cee49){while(--_0x5cee49){_0x5970f3['push'](_0x5970f3['shift']());}};_0x5b542e(++_0x4b2849);}(_0x60d9,0x178));var _0x960d=function(_0x122d52,_0x5c33fb){_0x122d52=_0x122d52-0x0;var _0x3e4b81=_0x60d9[_0x122d52];return _0x3e4b81;};'use strict';var _=require('lodash');var util=require(_0x960d('0x0'));var moment=require('moment');var BPromise=require(_0x960d('0x1'));var rs=require(_0x960d('0x2'));var fs=require('fs');var Redis=require(_0x960d('0x3'));var db=require(_0x960d('0x4'))['db'];var utils=require(_0x960d('0x5'));var logger=require(_0x960d('0x6'))(_0x960d('0x7'));var config=require(_0x960d('0x8'));var jayson=require(_0x960d('0x9'));var client=jayson[_0x960d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4cfd,_0x3962ec,_0x481c18){return new BPromise(function(_0x1918b2,_0x236dba){return client[_0x960d('0xb')](_0x4d4cfd,_0x481c18)[_0x960d('0xc')](function(_0x55ed27){logger[_0x960d('0xd')](_0x960d('0xe'),_0x3962ec,'request\x20sent');logger[_0x960d('0xf')](_0x960d('0x10'),_0x3962ec,'request\x20sent',JSON['stringify'](_0x55ed27));if(_0x55ed27[_0x960d('0x11')]){if(_0x55ed27[_0x960d('0x11')][_0x960d('0x12')]===0x1f4){logger[_0x960d('0x11')](_0x960d('0xe'),_0x3962ec,_0x55ed27[_0x960d('0x11')]['message']);return _0x236dba(_0x55ed27['error'][_0x960d('0x13')]);}logger[_0x960d('0x11')](_0x960d('0xe'),_0x3962ec,_0x55ed27['error'][_0x960d('0x13')]);return _0x1918b2(_0x55ed27[_0x960d('0x11')][_0x960d('0x13')]);}else{logger[_0x960d('0xd')](_0x960d('0xe'),_0x3962ec,_0x960d('0x14'));_0x1918b2(_0x55ed27[_0x960d('0x15')][_0x960d('0x13')]);}})[_0x960d('0x16')](function(_0x107d1a){logger[_0x960d('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x3962ec,_0x107d1a);_0x236dba(_0x107d1a);});});}exports[_0x960d('0x17')]=function(_0x3dc0dc){var _0x7d2fc2=this;return new Promise(function(_0x571d54,_0x479b2e){return db[_0x960d('0x18')]['update'](_0x3dc0dc['body'],{'raw':_0x3dc0dc[_0x960d('0x19')]?_0x3dc0dc[_0x960d('0x19')][_0x960d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dc0dc[_0x960d('0x19')]?_0x3dc0dc[_0x960d('0x19')][_0x960d('0x1b')]||null:null,'attributes':_0x3dc0dc[_0x960d('0x19')]?_0x3dc0dc[_0x960d('0x19')]['attributes']||null:null,'limit':_0x3dc0dc[_0x960d('0x19')]?_0x3dc0dc[_0x960d('0x19')]['limit']||null:null})['then'](function(_0x32e9a8){logger[_0x960d('0xd')](_0x960d('0x17'),_0x3dc0dc);logger[_0x960d('0xf')](_0x960d('0x17'),_0x3dc0dc,JSON[_0x960d('0x1c')](_0x32e9a8));_0x571d54(_0x32e9a8);})[_0x960d('0x16')](function(_0x4ad174){logger[_0x960d('0x11')]('UpdateOpenchannelApplication',_0x4ad174[_0x960d('0x13')],_0x3dc0dc);_0x479b2e(_0x7d2fc2[_0x960d('0x11')](0x1f4,_0x4ad174[_0x960d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 43263c9..d737964 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 _0x9a3f=['/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','/:id','openchannelinteraction:update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','isAuthenticated','describe'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a3f,0x9a));var _0xf9a3=function(_0x333b9a,_0x14ce97){_0x333b9a=_0x333b9a-0x0;var _0x18670e=_0x9a3f[_0x333b9a];return _0x18670e;};'use strict';var multer=require(_0xf9a3('0x0'));var util=require('util');var path=require(_0xf9a3('0x1'));var timeout=require(_0xf9a3('0x2'));var express=require(_0xf9a3('0x3'));var router=express[_0xf9a3('0x4')]();var fs_extra=require(_0xf9a3('0x5'));var auth=require(_0xf9a3('0x6'));var interaction=require(_0xf9a3('0x7'));var config=require(_0xf9a3('0x8'));var controller=require(_0xf9a3('0x9'));router[_0xf9a3('0xa')]('/',auth['isAuthenticated'](),controller[_0xf9a3('0xb')]);router[_0xf9a3('0xa')]('/describe',auth[_0xf9a3('0xc')](),controller[_0xf9a3('0xd')]);router[_0xf9a3('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf9a3('0xa')](_0xf9a3('0xe'),auth['isAuthenticated'](),controller[_0xf9a3('0xf')]);router[_0xf9a3('0xa')](_0xf9a3('0x10'),auth[_0xf9a3('0xc')](),controller['download']);router[_0xf9a3('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf9a3('0x11')](_0xf9a3('0xe'),auth[_0xf9a3('0xc')](),controller[_0xf9a3('0x12')]);router[_0xf9a3('0x11')](_0xf9a3('0x13'),auth[_0xf9a3('0xc')](),interaction[_0xf9a3('0x14')](_0xf9a3('0x15'),_0xf9a3('0x16')),controller['addTags']);router['put'](_0xf9a3('0x17'),auth['isAuthenticated'](),interaction[_0xf9a3('0x14')](_0xf9a3('0x15'),_0xf9a3('0x18')),controller['update']);router[_0xf9a3('0x19')](_0xf9a3('0x17'),auth[_0xf9a3('0xc')](),interaction[_0xf9a3('0x14')](_0xf9a3('0x15'),'openchannelinteraction:destroy'),controller[_0xf9a3('0x1a')]);router[_0xf9a3('0x19')](_0xf9a3('0x13'),auth[_0xf9a3('0xc')](),controller['removeTags']);module[_0xf9a3('0x1b')]=router; \ No newline at end of file +var _0x8c0e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannelinteraction:addtags','put','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','fs-extra'];(function(_0x2cb0df,_0x3a7d90){var _0x3831e9=function(_0x57f224){while(--_0x57f224){_0x2cb0df['push'](_0x2cb0df['shift']());}};_0x3831e9(++_0x3a7d90);}(_0x8c0e,0x17b));var _0xe8c0=function(_0x504c5f,_0x4c9421){_0x504c5f=_0x504c5f-0x0;var _0x483c8e=_0x8c0e[_0x504c5f];return _0x483c8e;};'use strict';var multer=require('multer');var util=require(_0xe8c0('0x0'));var path=require(_0xe8c0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8c0('0x2'));var router=express[_0xe8c0('0x3')]();var fs_extra=require(_0xe8c0('0x4'));var auth=require(_0xe8c0('0x5'));var interaction=require(_0xe8c0('0x6'));var config=require(_0xe8c0('0x7'));var controller=require(_0xe8c0('0x8'));router[_0xe8c0('0x9')]('/',auth[_0xe8c0('0xa')](),controller['index']);router[_0xe8c0('0x9')]('/describe',auth[_0xe8c0('0xa')](),controller[_0xe8c0('0xb')]);router[_0xe8c0('0x9')](_0xe8c0('0xc'),auth[_0xe8c0('0xa')](),controller[_0xe8c0('0xd')]);router[_0xe8c0('0x9')](_0xe8c0('0xe'),auth[_0xe8c0('0xa')](),controller[_0xe8c0('0xf')]);router['get'](_0xe8c0('0x10'),auth[_0xe8c0('0xa')](),controller[_0xe8c0('0x11')]);router[_0xe8c0('0x12')]('/',auth[_0xe8c0('0xa')](),controller[_0xe8c0('0x13')]);router[_0xe8c0('0x12')](_0xe8c0('0xe'),auth[_0xe8c0('0xa')](),controller[_0xe8c0('0x14')]);router[_0xe8c0('0x12')]('/:id/tags',auth[_0xe8c0('0xa')](),interaction[_0xe8c0('0x15')]('openchannel',_0xe8c0('0x16')),controller['addTags']);router[_0xe8c0('0x17')](_0xe8c0('0xc'),auth['isAuthenticated'](),interaction[_0xe8c0('0x15')](_0xe8c0('0x18'),_0xe8c0('0x19')),controller[_0xe8c0('0x1a')]);router[_0xe8c0('0x1b')](_0xe8c0('0xc'),auth[_0xe8c0('0xa')](),interaction[_0xe8c0('0x15')](_0xe8c0('0x18'),_0xe8c0('0x1c')),controller[_0xe8c0('0x1d')]);router['delete']('/:id/tags',auth[_0xe8c0('0xa')](),controller[_0xe8c0('0x1e')]);module[_0xe8c0('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index fb6104a..3087860 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 _0x9ef8=['DATE','STRING','ENUM','out','BOOLEAN','sequelize','exports'];(function(_0x587eb7,_0x475975){var _0x5b9da7=function(_0x4230c4){while(--_0x4230c4){_0x587eb7['push'](_0x587eb7['shift']());}};_0x5b9da7(++_0x475975);}(_0x9ef8,0x17f));var _0x89ef=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x9ef8[_0x56916d];return _0x2b7f1f;};'use strict';var Sequelize=require(_0x89ef('0x0'));module[_0x89ef('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x89ef('0x2')]},'disposition':{'type':Sequelize[_0x89ef('0x3')]},'secondDisposition':{'type':Sequelize[_0x89ef('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x89ef('0x3')]},'read1stAt':{'type':Sequelize[_0x89ef('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x89ef('0x4')]('in',_0x89ef('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x89ef('0x4')]('in',_0x89ef('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x89ef('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x89ef('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x97d5=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x37f053,_0x4b2ad0){var _0x78f6a0=function(_0x84b926){while(--_0x84b926){_0x37f053['push'](_0x37f053['shift']());}};_0x78f6a0(++_0x4b2ad0);}(_0x97d5,0x199));var _0x597d=function(_0x5c01e9,_0x22128b){_0x5c01e9=_0x5c01e9-0x0;var _0x2062df=_0x97d5[_0x5c01e9];return _0x2062df;};'use strict';var Sequelize=require(_0x597d('0x0'));module[_0x597d('0x1')]={'closed':{'type':Sequelize[_0x597d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x597d('0x3')]},'disposition':{'type':Sequelize[_0x597d('0x4')]},'secondDisposition':{'type':Sequelize[_0x597d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x597d('0x4')]},'read1stAt':{'type':Sequelize[_0x597d('0x3')]},'threadId':{'type':Sequelize[_0x597d('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x597d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x597d('0x5')]('in',_0x597d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x597d('0x5')]('in',_0x597d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x597d('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x597d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 36e9ba8..35e3223 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 _0xc4b0=['error','name','send','index','map','fieldName','type','key','getOptions','findAll','openchannel','query','catch','show','params','keys','OpenchannelInteraction','rawAttributes','filters','intersection','model','fields','attributes','length','options','find','create','body','destroy','describe','addMessage','omit','getMessages','OpenchannelMessage','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','includeAll','include','addTags','setTags','ids','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','files','tmp','join','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','read','Account','mkdirSync','Openchannel','Owner','closed','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','createWriteStream','direction','System','out','secret','value','root','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus'];(function(_0x2520ae,_0x308b9b){var _0x28a6c1=function(_0x54874c){while(--_0x54874c){_0x2520ae['push'](_0x2520ae['shift']());}};_0x28a6c1(++_0x308b9b);}(_0xc4b0,0x15f));var _0x0c4b=function(_0x4c2537,_0x20afdf){_0x4c2537=_0x4c2537-0x0;var _0x94fb5c=_0xc4b0[_0x4c2537];return _0x94fb5c;};'use strict';var rimraf=require(_0x0c4b('0x0'));var zipdir=require(_0x0c4b('0x1'));var moment=require(_0x0c4b('0x2'));var util=require(_0x0c4b('0x3'));var path=require(_0x0c4b('0x4'));var ejs=require(_0x0c4b('0x5'));var fs=require('fs');var _=require(_0x0c4b('0x6'));var Redis=require(_0x0c4b('0x7'));var interaction=require(_0x0c4b('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x0c4b('0x9'));var logger=require(_0x0c4b('0xa'))(_0x0c4b('0xb'));var config=require(_0x0c4b('0xc'));var db=require(_0x0c4b('0xd'))['db'];config[_0x0c4b('0xe')]=_[_0x0c4b('0xf')](config[_0x0c4b('0xe')],{'host':_0x0c4b('0x10'),'port':0x18eb});var socket=require(_0x0c4b('0x11'))(new Redis(config[_0x0c4b('0xe')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3f7119,_0x2644a){_0x2644a=_0x2644a||0xcc;return function(_0x188e81){if(_0x188e81){return _0x3f7119['sendStatus'](_0x2644a);}return _0x3f7119[_0x0c4b('0x12')](_0x2644a)[_0x0c4b('0x13')]();};}function respondWithResult(_0x372722,_0x481e6f){_0x481e6f=_0x481e6f||0xc8;return function(_0xa5a82){if(_0xa5a82){return _0x372722['status'](_0x481e6f)[_0x0c4b('0x14')](_0xa5a82);}};}function respondWithFilteredResult(_0x688c57,_0x17fd7){return function(_0x359b61){if(_0x359b61){var _0x4ffec3=typeof _0x17fd7[_0x0c4b('0x15')]===_0x0c4b('0x16')&&typeof _0x17fd7[_0x0c4b('0x17')]===_0x0c4b('0x16');var _0x4d0108=_0x359b61[_0x0c4b('0x18')];var _0x29ff89=_0x4ffec3?0x0:_0x17fd7[_0x0c4b('0x15')];var _0x4cb510=_0x4ffec3?_0x359b61[_0x0c4b('0x18')]:_0x17fd7[_0x0c4b('0x15')]+_0x17fd7['limit'];var _0x2fcc4c;if(_0x4cb510>=_0x4d0108){_0x4cb510=_0x4d0108;_0x2fcc4c=0xc8;}else{_0x2fcc4c=0xce;}_0x688c57[_0x0c4b('0x12')](_0x2fcc4c);return _0x688c57[_0x0c4b('0x19')](_0x0c4b('0x1a'),_0x29ff89+'-'+_0x4cb510+'/'+_0x4d0108)[_0x0c4b('0x14')](_0x359b61);}return null;};}function saveUpdates(_0x1180c2){return function(_0x298397){if(_0x298397){return _0x298397[_0x0c4b('0x1b')](_0x1180c2)[_0x0c4b('0x1c')](function(_0x1c9937){return _0x1c9937;});}return null;};}function removeEntity(_0x209e0a){return function(_0x4fc070){if(_0x4fc070){return _0x4fc070['destroy']()[_0x0c4b('0x1c')](function(){_0x209e0a[_0x0c4b('0x12')](0xcc)[_0x0c4b('0x13')]();});}};}function handleEntityNotFound(_0x4b0ee6){return function(_0x11215e){if(!_0x11215e){_0x4b0ee6[_0x0c4b('0x1d')](0x194);}return _0x11215e;};}function handleError(_0x2295ed,_0xf5dd3f){_0xf5dd3f=_0xf5dd3f||0x1f4;return function(_0x2dc3b3){logger[_0x0c4b('0x1e')](_0x2dc3b3['stack']);if(_0x2dc3b3[_0x0c4b('0x1f')]){delete _0x2dc3b3['name'];}_0x2295ed[_0x0c4b('0x12')](_0xf5dd3f)[_0x0c4b('0x20')](_0x2dc3b3);};}exports[_0x0c4b('0x21')]=function(_0x4aa5b5,_0x4d952a){var _0x34bd28={};var _0x1c1ec9=_[_0x0c4b('0x22')](db['OpenchannelInteraction']['rawAttributes'],function(_0x272ff7){return{'name':_0x272ff7[_0x0c4b('0x23')],'type':_0x272ff7[_0x0c4b('0x24')][_0x0c4b('0x25')]};});_0x34bd28=qs[_0x0c4b('0x26')](_0x1c1ec9,_0x4aa5b5);return interaction[_0x0c4b('0x27')](_0x0c4b('0x28'),_0x4aa5b5[_0x0c4b('0x29')],_0x4aa5b5['user'],_0x34bd28,_0x1c1ec9)[_0x0c4b('0x1c')](respondWithFilteredResult(_0x4d952a,_0x34bd28))[_0x0c4b('0x2a')](handleError(_0x4d952a,null));};exports[_0x0c4b('0x2b')]=function(_0x4c0373,_0x2d6a7e){var _0x143785={};if(_0x4c0373[_0x0c4b('0x29')]['type']&&_0x4c0373[_0x0c4b('0x29')][_0x0c4b('0x24')]==='from'){_0x143785['from']=_0x4c0373['params']['id'];}else{_0x143785['id']=_0x4c0373[_0x0c4b('0x2c')]['id'];}var _0x5d8177={'raw':![],'where':_0x143785},_0x3ae408={};_0x3ae408['model']=_[_0x0c4b('0x2d')](db[_0x0c4b('0x2e')][_0x0c4b('0x2f')]);_0x3ae408[_0x0c4b('0x29')]=_['keys'](_0x4c0373[_0x0c4b('0x29')]);_0x3ae408[_0x0c4b('0x30')]=_[_0x0c4b('0x31')](_0x3ae408['model'],_0x3ae408[_0x0c4b('0x29')]);_0x5d8177['attributes']=_['intersection'](_0x3ae408[_0x0c4b('0x32')],qs[_0x0c4b('0x33')](_0x4c0373[_0x0c4b('0x29')]['fields']));_0x5d8177[_0x0c4b('0x34')]=_0x5d8177[_0x0c4b('0x34')][_0x0c4b('0x35')]?_0x5d8177[_0x0c4b('0x34')]:_0x3ae408['model'];if(_0x4c0373['query']['includeAll']){_0x5d8177['include']=[{'all':!![]}];}_0x5d8177=_['merge']({},_0x5d8177,_0x4c0373[_0x0c4b('0x36')]);return db['OpenchannelInteraction'][_0x0c4b('0x37')](_0x5d8177)[_0x0c4b('0x1c')](handleEntityNotFound(_0x2d6a7e,null))[_0x0c4b('0x1c')](respondWithResult(_0x2d6a7e,null))[_0x0c4b('0x2a')](handleError(_0x2d6a7e,null));};exports['create']=function(_0x6a2b1,_0x3f0ae9){return db[_0x0c4b('0x2e')][_0x0c4b('0x38')](_0x6a2b1[_0x0c4b('0x39')],{})[_0x0c4b('0x1c')](respondWithResult(_0x3f0ae9,0xc9))[_0x0c4b('0x2a')](handleError(_0x3f0ae9,null));};exports['update']=function(_0x2fd795,_0x128fd4){if(_0x2fd795['body']['id']){delete _0x2fd795[_0x0c4b('0x39')]['id'];}return db['OpenchannelInteraction'][_0x0c4b('0x37')]({'where':{'id':_0x2fd795[_0x0c4b('0x2c')]['id']}})[_0x0c4b('0x1c')](handleEntityNotFound(_0x128fd4,null))[_0x0c4b('0x1c')](saveUpdates(_0x2fd795['body'],null))[_0x0c4b('0x1c')](respondWithResult(_0x128fd4,null))[_0x0c4b('0x2a')](handleError(_0x128fd4,null));};exports[_0x0c4b('0x3a')]=function(_0x5211e1,_0x3212f4){return db[_0x0c4b('0x2e')][_0x0c4b('0x37')]({'where':{'id':_0x5211e1[_0x0c4b('0x2c')]['id']}})[_0x0c4b('0x1c')](handleEntityNotFound(_0x3212f4,null))[_0x0c4b('0x1c')](removeEntity(_0x3212f4,null))[_0x0c4b('0x2a')](handleError(_0x3212f4,null));};exports['describe']=function(_0xfc4e7b,_0x895b06){return db[_0x0c4b('0x2e')][_0x0c4b('0x3b')]()[_0x0c4b('0x1c')](respondWithResult(_0x895b06,null))['catch'](handleError(_0x895b06,null));};exports['addMessage']=function(_0x3efa0a,_0x31bb85){return db['OpenchannelMessage'][_0x0c4b('0x37')]({'where':{'id':_0x3efa0a[_0x0c4b('0x2c')]['id']}})[_0x0c4b('0x1c')](handleEntityNotFound(_0x31bb85,null))[_0x0c4b('0x1c')](function(_0x2d29d7){if(_0x2d29d7){return _0x2d29d7[_0x0c4b('0x3c')](_0x3efa0a['body']['ids'],_[_0x0c4b('0x3d')](_0x3efa0a['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x31bb85,null))['catch'](handleError(_0x31bb85,null));};exports[_0x0c4b('0x3e')]=function(_0x4abf25,_0x296c25){var _0x4183dc={'raw':![],'where':{}};var _0x4dc79b={};var _0xc48648={'count':0x0,'rows':[]};return db[_0x0c4b('0x2e')]['findOne']({'where':{'id':_0x4abf25[_0x0c4b('0x2c')]['id']}})[_0x0c4b('0x1c')](handleEntityNotFound(_0x296c25,null))['then'](function(_0x4c5ded){if(_0x4c5ded){_0x4dc79b[_0x0c4b('0x32')]=_[_0x0c4b('0x2d')](db[_0x0c4b('0x3f')][_0x0c4b('0x2f')]);_0x4dc79b['query']=_[_0x0c4b('0x2d')](_0x4abf25[_0x0c4b('0x29')]);_0x4dc79b[_0x0c4b('0x30')]=_['intersection'](_0x4dc79b[_0x0c4b('0x32')],_0x4dc79b[_0x0c4b('0x29')]);_0x4183dc['attributes']=_[_0x0c4b('0x31')](_0x4dc79b[_0x0c4b('0x32')],qs[_0x0c4b('0x33')](_0x4abf25[_0x0c4b('0x29')][_0x0c4b('0x33')]));_0x4183dc[_0x0c4b('0x34')]=_0x4183dc['attributes'][_0x0c4b('0x35')]?_0x4183dc[_0x0c4b('0x34')]:_0x4dc79b[_0x0c4b('0x32')];if(!_0x4abf25['query']['hasOwnProperty'](_0x0c4b('0x40'))){_0x4183dc[_0x0c4b('0x17')]=qs[_0x0c4b('0x17')](_0x4abf25[_0x0c4b('0x29')][_0x0c4b('0x17')]);_0x4183dc['offset']=qs[_0x0c4b('0x15')](_0x4abf25['query'][_0x0c4b('0x15')]);}_0x4183dc[_0x0c4b('0x41')]=qs['sort'](_0x4abf25[_0x0c4b('0x29')][_0x0c4b('0x42')]);_0x4183dc[_0x0c4b('0x43')]=qs[_0x0c4b('0x30')](_[_0x0c4b('0x44')](_0x4abf25[_0x0c4b('0x29')],_0x4dc79b[_0x0c4b('0x30')]));_0x4183dc[_0x0c4b('0x43')][_0x0c4b('0x45')]=_0x4c5ded['id'];if(_0x4abf25['query']['filter']){_0x4183dc[_0x0c4b('0x43')]=_['merge'](_0x4183dc[_0x0c4b('0x43')],{'$or':_[_0x0c4b('0x22')](_0x4183dc[_0x0c4b('0x34')],function(_0xded229){var _0x2290ae={};_0x2290ae[_0xded229]={'$like':'%'+_0x4abf25[_0x0c4b('0x29')][_0x0c4b('0x46')]+'%'};return _0x2290ae;})});}if(_0x4abf25['query']['$gte']){var _0x236b3e=_0x4abf25[_0x0c4b('0x29')][_0x0c4b('0x47')]['split'](',');var _0x8ce3c0={};_0x8ce3c0[_0x236b3e[0x0]]={'$gte':moment(_0x236b3e[0x1])[_0x0c4b('0x48')](_0x0c4b('0x49'))};_0x4183dc['where']=_[_0x0c4b('0x4a')](_0x4183dc[_0x0c4b('0x43')],_0x8ce3c0);}_0x4183dc=_[_0x0c4b('0x4a')]({},_0x4183dc,_0x4abf25['options']);return db[_0x0c4b('0x3f')][_0x0c4b('0x18')]({'where':_0x4183dc[_0x0c4b('0x43')]})[_0x0c4b('0x1c')](function(_0x513500){_0xc48648[_0x0c4b('0x18')]=_0x513500;if(_0x4abf25[_0x0c4b('0x29')][_0x0c4b('0x4b')]){_0x4183dc[_0x0c4b('0x4c')]=[{'all':!![]}];}return db[_0x0c4b('0x3f')][_0x0c4b('0x27')](_0x4183dc);})[_0x0c4b('0x1c')](function(_0x4c7903){_0xc48648['rows']=_0x4c7903;return _0xc48648;});}})[_0x0c4b('0x1c')](respondWithFilteredResult(_0x296c25,_0x4183dc))[_0x0c4b('0x2a')](handleError(_0x296c25,null));};exports[_0x0c4b('0x4d')]=function(_0x3c2d0e,_0x306c1c){return db[_0x0c4b('0x2e')][_0x0c4b('0x37')]({'where':{'id':_0x3c2d0e[_0x0c4b('0x2c')]['id']}})['then'](handleEntityNotFound(_0x306c1c,null))[_0x0c4b('0x1c')](function(_0x36f23f){if(_0x36f23f){return _0x36f23f[_0x0c4b('0x4e')](_0x3c2d0e[_0x0c4b('0x39')][_0x0c4b('0x4f')],_[_0x0c4b('0x3d')](_0x3c2d0e[_0x0c4b('0x39')],[_0x0c4b('0x4f'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0c4b('0x1f'),_0x0c4b('0x50')],'where':{'id':_0x3c2d0e[_0x0c4b('0x39')]['ids']}});})[_0x0c4b('0x1c')](function(_0x304ca4){socket[_0x0c4b('0x51')](_0x0c4b('0x52'),{'id':Number(_0x3c2d0e['params']['id']),'tags':_0x304ca4||[]});return{'id':Number(_0x3c2d0e['params']['id']),'tags':_0x304ca4||[]};});}})[_0x0c4b('0x1c')](respondWithResult(_0x306c1c,null))[_0x0c4b('0x2a')](handleError(_0x306c1c,null));};exports[_0x0c4b('0x53')]=function(_0x5c4415,_0x52373d){return db[_0x0c4b('0x2e')]['find']({'where':{'id':_0x5c4415[_0x0c4b('0x2c')]['id']}})[_0x0c4b('0x1c')](handleEntityNotFound(_0x52373d,null))[_0x0c4b('0x1c')](function(_0x23e6d5){if(_0x23e6d5){return _0x23e6d5['removeTags'](_0x5c4415['query'][_0x0c4b('0x4f')]);}})[_0x0c4b('0x1c')](respondWithStatusCode(_0x52373d,null))[_0x0c4b('0x2a')](handleError(_0x52373d,null));};exports[_0x0c4b('0x54')]=function(_0x45c0d7,_0x59fd2b){var _0x45b972=moment()[_0x0c4b('0x55')]()[_0x0c4b('0x56')]();var _0x15f76e=path['join'](config['root'],'server',_0x0c4b('0x57'),_0x0c4b('0x58'));var _0x3e72fd=path[_0x0c4b('0x59')](config['root'],_0x0c4b('0x5a'),_0x0c4b('0x57'),_0x0c4b('0x5b'));var _0x249b23=path[_0x0c4b('0x59')](_0x15f76e,_0x45b972);var _0x55738a=util[_0x0c4b('0x48')](_0x0c4b('0x5c'),_0x45c0d7[_0x0c4b('0x2c')]['id'],_0x45b972);var _0x4d9280=path[_0x0c4b('0x59')](_0x15f76e,_0x55738a);var _0x26e040=[];_0x26e040[_0x0c4b('0x5d')]({'model':db[_0x0c4b('0x5e')],'as':_0x0c4b('0x5e'),'attributes':['id',_0x0c4b('0x5f')],'raw':!![]});_0x26e040[_0x0c4b('0x5d')]({'model':db[_0x0c4b('0x60')],'as':_0x0c4b('0x61'),'attributes':['id',_0x0c4b('0x62'),_0x0c4b('0x63')],'raw':!![]});if(_0x45c0d7[_0x0c4b('0x29')][_0x0c4b('0x5b')]){_0x26e040[_0x0c4b('0x5d')]({'model':db[_0x0c4b('0x64')],'as':_0x0c4b('0x64'),'raw':!![]});}var _0x5b3b15=[{'model':db[_0x0c4b('0x3f')],'as':_0x0c4b('0x65'),'attributes':['id',_0x0c4b('0x39'),_0x0c4b('0x66'),'direction','secret',_0x0c4b('0x67')],'include':_0x26e040}];_0x5b3b15['push']({'model':db['OpenchannelAccount'],'as':_0x0c4b('0x68'),'attributes':['id',_0x0c4b('0x1f')]});_0x5b3b15[_0x0c4b('0x5d')]({'model':db[_0x0c4b('0x5e')],'as':'Owner','attributes':['id','fullname']});return db[_0x0c4b('0x2e')][_0x0c4b('0x37')]({'where':{'id':_0x45c0d7['params']['id']},'include':_0x5b3b15})[_0x0c4b('0x1c')](handleEntityNotFound(_0x59fd2b,null))['then'](function(_0x49d2af){if(_0x49d2af){var _0x5dd903=_0x49d2af['get']({'plain':!![]});fs[_0x0c4b('0x69')](_0x249b23);var _0x51f0f1={'channel':_0x0c4b('0x6a'),'account':_0x5dd903[_0x0c4b('0x68')][_0x0c4b('0x1f')],'agent':_0x5dd903[_0x0c4b('0x6b')]?_0x5dd903[_0x0c4b('0x6b')][_0x0c4b('0x5f')]:'N.A.','createdAt':moment(_0x5dd903[_0x0c4b('0x66')])['format'](_0x0c4b('0x49'))[_0x0c4b('0x56')](),'closedAt':_0x5dd903[_0x0c4b('0x6c')]?moment(_0x5dd903[_0x0c4b('0x6d')])[_0x0c4b('0x48')](_0x0c4b('0x49'))[_0x0c4b('0x56')]():'','disposition':_0x5dd903[_0x0c4b('0x6e')],'visibility':_0x5dd903[_0x0c4b('0x6f')]?'Public':_0x0c4b('0x70'),'messages':_(_0x5dd903[_0x0c4b('0x65')])[_0x0c4b('0x46')]({'secret':![]})[_0x0c4b('0x22')](function(_0x13066d){if(_0x13066d['Attachment']){var _0x3f6cba=path['join'](_0x3e72fd,_0x13066d[_0x0c4b('0x64')][_0x0c4b('0x71')]);if(fs[_0x0c4b('0x72')](_0x3f6cba)){fs[_0x0c4b('0x73')](_0x3f6cba)['pipe'](fs[_0x0c4b('0x74')](path[_0x0c4b('0x59')](_0x249b23,_0x13066d[_0x0c4b('0x64')][_0x0c4b('0x71')])));}}return{'date':moment(_0x13066d[_0x0c4b('0x66')])[_0x0c4b('0x48')](_0x0c4b('0x49'))[_0x0c4b('0x56')](),'sender':_0x13066d[_0x0c4b('0x75')]==='out'?_0x13066d['User']?_0x13066d[_0x0c4b('0x5e')][_0x0c4b('0x5f')]:_0x0c4b('0x76'):_0x13066d[_0x0c4b('0x61')][_0x0c4b('0x62')]+(_0x13066d[_0x0c4b('0x61')][_0x0c4b('0x63')]?'\x20'+_0x13066d[_0x0c4b('0x61')]['lastName']:''),'body':_0x13066d[_0x0c4b('0x64')]?_0x13066d[_0x0c4b('0x64')][_0x0c4b('0x71')]:_0x13066d[_0x0c4b('0x39')],'direction':_0x13066d[_0x0c4b('0x75')]===_0x0c4b('0x77')?'A':'C','secret':_0x13066d[_0x0c4b('0x78')],'read':_0x13066d[_0x0c4b('0x67')],'attachment':_0x13066d[_0x0c4b('0x64')]};})[_0x0c4b('0x79')]()};return ejs['renderFile'](path['join'](config[_0x0c4b('0x7a')],_0x0c4b('0x5a'),'views','downloadInteraction.ejs'),{'interaction':_0x51f0f1})[_0x0c4b('0x1c')](function(_0x45f6d8){var _0x4c2419=path[_0x0c4b('0x59')](_0x249b23,_0x0c4b('0x7b')+_0x5dd903['id']+'-'+_0x45b972+_0x0c4b('0x7c'));var _0x259c59={'path':_0x4c2419,'channel':_0x0c4b('0x6a'),'interactionId':_0x5dd903['id']};return pdf[_0x0c4b('0x7d')](_0x45f6d8,_0x259c59);})[_0x0c4b('0x1c')](function(){return new Promise(function(_0x5c35a0,_0x558b42){zipdir(_0x249b23,{'saveTo':_0x4d9280},function(_0x5ba8db,_0x38b5b1){if(_0x5ba8db)return _0x558b42(_0x5ba8db);return _0x5c35a0(_0x38b5b1);});})[_0x0c4b('0x1c')](function(){return new Promise(function(_0x35e686,_0x90ea66){rimraf(_0x249b23,function(_0x1f1566){if(_0x1f1566)_0x90ea66(_0x1f1566);return _0x35e686();});});})[_0x0c4b('0x1c')](function(){return _0x59fd2b[_0x0c4b('0x54')](_0x4d9280,_0x55738a,function(_0x4fc410){if(_0x4fc410){logger[_0x0c4b('0x1e')]('Unable\x20to\x20delete\x20zip\x20file',_0x4fc410);}else{fs[_0x0c4b('0x7e')](_0x4d9280);}});});});}else{return _0x59fd2b[_0x0c4b('0x1d')](0xc8);}})['catch'](handleError(_0x59fd2b,null));}; \ No newline at end of file +var _0xde80=['attributes','length','include','merge','options','create','body','find','params','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','fields','hasOwnProperty','nolimit','where','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','toString','closed','closedAt','Public','basename','existsSync','pipe','createWriteStream','out','Contact','secret','downloadInteraction.ejs','transcript-','.pdf','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','end','status','json','offset','limit','undefined','count','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','getOptions','findAll','query','catch','show','from','model','keys','OpenchannelInteraction','filters','intersection'];(function(_0x36af87,_0x4b484b){var _0x53c140=function(_0x310d25){while(--_0x310d25){_0x36af87['push'](_0x36af87['shift']());}};_0x53c140(++_0x4b484b);}(_0xde80,0x1ba));var _0x0de8=function(_0x1165c3,_0x2e5475){_0x1165c3=_0x1165c3-0x0;var _0x4a3040=_0xde80[_0x1165c3];return _0x4a3040;};'use strict';var rimraf=require(_0x0de8('0x0'));var zipdir=require('zip-dir');var moment=require(_0x0de8('0x1'));var util=require(_0x0de8('0x2'));var path=require(_0x0de8('0x3'));var ejs=require(_0x0de8('0x4'));var fs=require('fs');var _=require(_0x0de8('0x5'));var Redis=require(_0x0de8('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x0de8('0x7'));var pdf=require(_0x0de8('0x8'));var logger=require(_0x0de8('0x9'))(_0x0de8('0xa'));var config=require(_0x0de8('0xb'));var db=require(_0x0de8('0xc'))['db'];config[_0x0de8('0xd')]=_[_0x0de8('0xe')](config[_0x0de8('0xd')],{'host':_0x0de8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0de8('0xd')]));require(_0x0de8('0x10'))['register'](socket);function respondWithStatusCode(_0x4a7aef,_0x16761a){_0x16761a=_0x16761a||0xcc;return function(_0x18d84c){if(_0x18d84c){return _0x4a7aef[_0x0de8('0x11')](_0x16761a);}return _0x4a7aef['status'](_0x16761a)[_0x0de8('0x12')]();};}function respondWithResult(_0x19805b,_0x3a84fb){_0x3a84fb=_0x3a84fb||0xc8;return function(_0x201412){if(_0x201412){return _0x19805b[_0x0de8('0x13')](_0x3a84fb)[_0x0de8('0x14')](_0x201412);}};}function respondWithFilteredResult(_0x3ca386,_0x41d981){return function(_0x4b59ad){if(_0x4b59ad){var _0x3cf420=typeof _0x41d981[_0x0de8('0x15')]==='undefined'&&typeof _0x41d981[_0x0de8('0x16')]===_0x0de8('0x17');var _0x4016a1=_0x4b59ad['count'];var _0x105cf8=_0x3cf420?0x0:_0x41d981[_0x0de8('0x15')];var _0x4f1745=_0x3cf420?_0x4b59ad[_0x0de8('0x18')]:_0x41d981[_0x0de8('0x15')]+_0x41d981[_0x0de8('0x16')];var _0x526a50;if(_0x4f1745>=_0x4016a1){_0x4f1745=_0x4016a1;_0x526a50=0xc8;}else{_0x526a50=0xce;}_0x3ca386[_0x0de8('0x13')](_0x526a50);return _0x3ca386['set']('Content-Range',_0x105cf8+'-'+_0x4f1745+'/'+_0x4016a1)[_0x0de8('0x14')](_0x4b59ad);}return null;};}function saveUpdates(_0xeccb93){return function(_0x5c1939){if(_0x5c1939){return _0x5c1939[_0x0de8('0x19')](_0xeccb93)[_0x0de8('0x1a')](function(_0x252918){return _0x252918;});}return null;};}function removeEntity(_0x24e42e){return function(_0x3a2cda){if(_0x3a2cda){return _0x3a2cda[_0x0de8('0x1b')]()[_0x0de8('0x1a')](function(){_0x24e42e[_0x0de8('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59ceec){return function(_0x46fc7a){if(!_0x46fc7a){_0x59ceec['sendStatus'](0x194);}return _0x46fc7a;};}function handleError(_0x443b9a,_0x372803){_0x372803=_0x372803||0x1f4;return function(_0x551037){logger['error'](_0x551037[_0x0de8('0x1c')]);if(_0x551037[_0x0de8('0x1d')]){delete _0x551037['name'];}_0x443b9a[_0x0de8('0x13')](_0x372803)[_0x0de8('0x1e')](_0x551037);};}exports['index']=function(_0x5c404d,_0x27eceb){var _0x4d8b8c={};var _0x1a3d4b=_['map'](db['OpenchannelInteraction'][_0x0de8('0x1f')],function(_0x573ada){return{'name':_0x573ada[_0x0de8('0x20')],'type':_0x573ada[_0x0de8('0x21')][_0x0de8('0x22')]};});_0x4d8b8c=qs[_0x0de8('0x23')](_0x1a3d4b,_0x5c404d);return interaction[_0x0de8('0x24')]('openchannel',_0x5c404d[_0x0de8('0x25')],_0x5c404d['user'],_0x4d8b8c,_0x1a3d4b)[_0x0de8('0x1a')](respondWithFilteredResult(_0x27eceb,_0x4d8b8c))[_0x0de8('0x26')](handleError(_0x27eceb,null));};exports[_0x0de8('0x27')]=function(_0xf8bbb0,_0x5e812f){var _0x595259={};if(_0xf8bbb0['query'][_0x0de8('0x21')]&&_0xf8bbb0[_0x0de8('0x25')][_0x0de8('0x21')]===_0x0de8('0x28')){_0x595259[_0x0de8('0x28')]=_0xf8bbb0['params']['id'];}else{_0x595259['id']=_0xf8bbb0['params']['id'];}var _0x432cde={'raw':![],'where':_0x595259},_0x2fbe6a={};_0x2fbe6a[_0x0de8('0x29')]=_[_0x0de8('0x2a')](db[_0x0de8('0x2b')][_0x0de8('0x1f')]);_0x2fbe6a[_0x0de8('0x25')]=_[_0x0de8('0x2a')](_0xf8bbb0['query']);_0x2fbe6a[_0x0de8('0x2c')]=_[_0x0de8('0x2d')](_0x2fbe6a[_0x0de8('0x29')],_0x2fbe6a[_0x0de8('0x25')]);_0x432cde[_0x0de8('0x2e')]=_[_0x0de8('0x2d')](_0x2fbe6a[_0x0de8('0x29')],qs['fields'](_0xf8bbb0['query']['fields']));_0x432cde['attributes']=_0x432cde[_0x0de8('0x2e')][_0x0de8('0x2f')]?_0x432cde['attributes']:_0x2fbe6a['model'];if(_0xf8bbb0[_0x0de8('0x25')]['includeAll']){_0x432cde[_0x0de8('0x30')]=[{'all':!![]}];}_0x432cde=_[_0x0de8('0x31')]({},_0x432cde,_0xf8bbb0[_0x0de8('0x32')]);return db[_0x0de8('0x2b')]['find'](_0x432cde)['then'](handleEntityNotFound(_0x5e812f,null))['then'](respondWithResult(_0x5e812f,null))[_0x0de8('0x26')](handleError(_0x5e812f,null));};exports[_0x0de8('0x33')]=function(_0x428b85,_0x3dd80b){return db[_0x0de8('0x2b')]['create'](_0x428b85[_0x0de8('0x34')],{})['then'](respondWithResult(_0x3dd80b,0xc9))[_0x0de8('0x26')](handleError(_0x3dd80b,null));};exports['update']=function(_0x200e05,_0x5daccd){if(_0x200e05[_0x0de8('0x34')]['id']){delete _0x200e05[_0x0de8('0x34')]['id'];}return db['OpenchannelInteraction'][_0x0de8('0x35')]({'where':{'id':_0x200e05[_0x0de8('0x36')]['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x5daccd,null))[_0x0de8('0x1a')](saveUpdates(_0x200e05['body'],null))[_0x0de8('0x1a')](respondWithResult(_0x5daccd,null))[_0x0de8('0x26')](handleError(_0x5daccd,null));};exports[_0x0de8('0x1b')]=function(_0x5e4570,_0x418b70){return db[_0x0de8('0x2b')][_0x0de8('0x35')]({'where':{'id':_0x5e4570[_0x0de8('0x36')]['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x418b70,null))[_0x0de8('0x1a')](removeEntity(_0x418b70,null))[_0x0de8('0x26')](handleError(_0x418b70,null));};exports['describe']=function(_0x3ea27f,_0x1c0797){return db['OpenchannelInteraction'][_0x0de8('0x37')]()['then'](respondWithResult(_0x1c0797,null))['catch'](handleError(_0x1c0797,null));};exports[_0x0de8('0x38')]=function(_0x24dab4,_0x5c3a57){return db[_0x0de8('0x39')][_0x0de8('0x35')]({'where':{'id':_0x24dab4[_0x0de8('0x36')]['id']}})['then'](handleEntityNotFound(_0x5c3a57,null))[_0x0de8('0x1a')](function(_0x146768){if(_0x146768){return _0x146768[_0x0de8('0x38')](_0x24dab4[_0x0de8('0x34')][_0x0de8('0x3a')],_[_0x0de8('0x3b')](_0x24dab4[_0x0de8('0x34')],[_0x0de8('0x3a'),'id'])||{});}})[_0x0de8('0x1a')](respondWithResult(_0x5c3a57,null))[_0x0de8('0x26')](handleError(_0x5c3a57,null));};exports[_0x0de8('0x3c')]=function(_0x268635,_0x15a85b){var _0x4eedb7={'raw':![],'where':{}};var _0x295e75={};var _0x25d222={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x0de8('0x3d')]({'where':{'id':_0x268635[_0x0de8('0x36')]['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x15a85b,null))[_0x0de8('0x1a')](function(_0x43a45e){if(_0x43a45e){_0x295e75[_0x0de8('0x29')]=_[_0x0de8('0x2a')](db[_0x0de8('0x39')][_0x0de8('0x1f')]);_0x295e75[_0x0de8('0x25')]=_[_0x0de8('0x2a')](_0x268635[_0x0de8('0x25')]);_0x295e75['filters']=_[_0x0de8('0x2d')](_0x295e75[_0x0de8('0x29')],_0x295e75['query']);_0x4eedb7[_0x0de8('0x2e')]=_['intersection'](_0x295e75['model'],qs[_0x0de8('0x3e')](_0x268635[_0x0de8('0x25')]['fields']));_0x4eedb7['attributes']=_0x4eedb7[_0x0de8('0x2e')][_0x0de8('0x2f')]?_0x4eedb7[_0x0de8('0x2e')]:_0x295e75[_0x0de8('0x29')];if(!_0x268635[_0x0de8('0x25')][_0x0de8('0x3f')](_0x0de8('0x40'))){_0x4eedb7[_0x0de8('0x16')]=qs[_0x0de8('0x16')](_0x268635['query'][_0x0de8('0x16')]);_0x4eedb7[_0x0de8('0x15')]=qs['offset'](_0x268635[_0x0de8('0x25')][_0x0de8('0x15')]);}_0x4eedb7['order']=qs['sort'](_0x268635[_0x0de8('0x25')]['sort']);_0x4eedb7[_0x0de8('0x41')]=qs[_0x0de8('0x2c')](_['pick'](_0x268635[_0x0de8('0x25')],_0x295e75[_0x0de8('0x2c')]));_0x4eedb7['where']['OpenchannelInteractionId']=_0x43a45e['id'];if(_0x268635[_0x0de8('0x25')][_0x0de8('0x42')]){_0x4eedb7[_0x0de8('0x41')]=_[_0x0de8('0x31')](_0x4eedb7['where'],{'$or':_[_0x0de8('0x43')](_0x4eedb7[_0x0de8('0x2e')],function(_0x4f709a){var _0x1834e4={};_0x1834e4[_0x4f709a]={'$like':'%'+_0x268635[_0x0de8('0x25')]['filter']+'%'};return _0x1834e4;})});}if(_0x268635[_0x0de8('0x25')]['$gte']){var _0x4a3bc7=_0x268635[_0x0de8('0x25')][_0x0de8('0x44')][_0x0de8('0x45')](',');var _0x3508f1={};_0x3508f1[_0x4a3bc7[0x0]]={'$gte':moment(_0x4a3bc7[0x1])['format'](_0x0de8('0x46'))};_0x4eedb7['where']=_[_0x0de8('0x31')](_0x4eedb7[_0x0de8('0x41')],_0x3508f1);}_0x4eedb7=_[_0x0de8('0x31')]({},_0x4eedb7,_0x268635['options']);return db[_0x0de8('0x39')][_0x0de8('0x18')]({'where':_0x4eedb7[_0x0de8('0x41')]})[_0x0de8('0x1a')](function(_0x4a0833){_0x25d222['count']=_0x4a0833;if(_0x268635[_0x0de8('0x25')]['includeAll']){_0x4eedb7[_0x0de8('0x30')]=[{'all':!![]}];}return db[_0x0de8('0x39')]['findAll'](_0x4eedb7);})[_0x0de8('0x1a')](function(_0x475f55){_0x25d222[_0x0de8('0x47')]=_0x475f55;return _0x25d222;});}})[_0x0de8('0x1a')](respondWithFilteredResult(_0x15a85b,_0x4eedb7))[_0x0de8('0x26')](handleError(_0x15a85b,null));};exports[_0x0de8('0x48')]=function(_0x512089,_0x4b4139){return db[_0x0de8('0x2b')][_0x0de8('0x35')]({'where':{'id':_0x512089[_0x0de8('0x36')]['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x4b4139,null))[_0x0de8('0x1a')](function(_0x2ac662){if(_0x2ac662){return _0x2ac662['setTags'](_0x512089[_0x0de8('0x34')][_0x0de8('0x3a')],_[_0x0de8('0x3b')](_0x512089[_0x0de8('0x34')],[_0x0de8('0x3a'),'id'])||{})[_0x0de8('0x49')](function(){return db[_0x0de8('0x4a')]['findAll']({'attributes':['id','name',_0x0de8('0x4b')],'where':{'id':_0x512089[_0x0de8('0x34')][_0x0de8('0x3a')]}});})[_0x0de8('0x1a')](function(_0x7d356f){socket[_0x0de8('0x4c')](_0x0de8('0x4d'),{'id':Number(_0x512089[_0x0de8('0x36')]['id']),'tags':_0x7d356f||[]});return{'id':Number(_0x512089['params']['id']),'tags':_0x7d356f||[]};});}})['then'](respondWithResult(_0x4b4139,null))[_0x0de8('0x26')](handleError(_0x4b4139,null));};exports[_0x0de8('0x4e')]=function(_0x5566ad,_0x3752ea){return db[_0x0de8('0x2b')][_0x0de8('0x35')]({'where':{'id':_0x5566ad['params']['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x3752ea,null))[_0x0de8('0x1a')](function(_0x548ecc){if(_0x548ecc){return _0x548ecc[_0x0de8('0x4e')](_0x5566ad[_0x0de8('0x25')]['ids']);}})['then'](respondWithStatusCode(_0x3752ea,null))[_0x0de8('0x26')](handleError(_0x3752ea,null));};exports[_0x0de8('0x4f')]=function(_0x294650,_0x27c82d){var _0x530cd6=moment()[_0x0de8('0x50')]()['toString']();var _0x3d1e24=path[_0x0de8('0x51')](config[_0x0de8('0x52')],_0x0de8('0x53'),'files',_0x0de8('0x54'));var _0x3ee48e=path[_0x0de8('0x51')](config['root'],_0x0de8('0x53'),_0x0de8('0x55'),_0x0de8('0x56'));var _0x14bfa1=path['join'](_0x3d1e24,_0x530cd6);var _0x3048b7=util[_0x0de8('0x57')](_0x0de8('0x58'),_0x294650[_0x0de8('0x36')]['id'],_0x530cd6);var _0x1f9ded=path[_0x0de8('0x51')](_0x3d1e24,_0x3048b7);var _0x2b15bf=[];_0x2b15bf[_0x0de8('0x59')]({'model':db[_0x0de8('0x5a')],'as':_0x0de8('0x5a'),'attributes':['id',_0x0de8('0x5b')],'raw':!![]});_0x2b15bf['push']({'model':db[_0x0de8('0x5c')],'as':'Contact','attributes':['id',_0x0de8('0x5d'),_0x0de8('0x5e')],'raw':!![]});if(_0x294650[_0x0de8('0x25')][_0x0de8('0x56')]){_0x2b15bf[_0x0de8('0x59')]({'model':db[_0x0de8('0x5f')],'as':_0x0de8('0x5f'),'raw':!![]});}var _0x5a87c4=[{'model':db[_0x0de8('0x39')],'as':_0x0de8('0x60'),'attributes':['id',_0x0de8('0x34'),_0x0de8('0x61'),_0x0de8('0x62'),'secret',_0x0de8('0x63')],'include':_0x2b15bf}];_0x5a87c4[_0x0de8('0x59')]({'model':db[_0x0de8('0x64')],'as':_0x0de8('0x65'),'attributes':['id',_0x0de8('0x1d')]});_0x5a87c4[_0x0de8('0x59')]({'model':db[_0x0de8('0x5a')],'as':_0x0de8('0x66'),'attributes':['id',_0x0de8('0x5b')]});return db[_0x0de8('0x2b')]['find']({'where':{'id':_0x294650[_0x0de8('0x36')]['id']},'include':_0x5a87c4})[_0x0de8('0x1a')](handleEntityNotFound(_0x27c82d,null))['then'](function(_0x16dd78){if(_0x16dd78){var _0x585f98=_0x16dd78[_0x0de8('0x67')]({'plain':!![]});fs['mkdirSync'](_0x14bfa1);var _0x1750d2={'channel':_0x0de8('0x68'),'account':_0x585f98['Account'][_0x0de8('0x1d')],'agent':_0x585f98[_0x0de8('0x66')]?_0x585f98[_0x0de8('0x66')][_0x0de8('0x5b')]:_0x0de8('0x69'),'createdAt':moment(_0x585f98[_0x0de8('0x61')])[_0x0de8('0x57')](_0x0de8('0x46'))[_0x0de8('0x6a')](),'closedAt':_0x585f98[_0x0de8('0x6b')]?moment(_0x585f98[_0x0de8('0x6c')])[_0x0de8('0x57')](_0x0de8('0x46'))[_0x0de8('0x6a')]():'','disposition':_0x585f98['disposition'],'visibility':_0x585f98['threadId']?_0x0de8('0x6d'):'Private','messages':_(_0x585f98[_0x0de8('0x60')])[_0x0de8('0x42')]({'secret':![]})[_0x0de8('0x43')](function(_0x2c3ec2){if(_0x2c3ec2[_0x0de8('0x5f')]){var _0x25210e=path[_0x0de8('0x51')](_0x3ee48e,_0x2c3ec2[_0x0de8('0x5f')][_0x0de8('0x6e')]);if(fs[_0x0de8('0x6f')](_0x25210e)){fs['createReadStream'](_0x25210e)[_0x0de8('0x70')](fs[_0x0de8('0x71')](path[_0x0de8('0x51')](_0x14bfa1,_0x2c3ec2[_0x0de8('0x5f')][_0x0de8('0x6e')])));}}return{'date':moment(_0x2c3ec2[_0x0de8('0x61')])[_0x0de8('0x57')](_0x0de8('0x46'))[_0x0de8('0x6a')](),'sender':_0x2c3ec2['direction']===_0x0de8('0x72')?_0x2c3ec2[_0x0de8('0x5a')]?_0x2c3ec2['User']['fullname']:'System':_0x2c3ec2[_0x0de8('0x73')][_0x0de8('0x5d')]+(_0x2c3ec2['Contact'][_0x0de8('0x5e')]?'\x20'+_0x2c3ec2['Contact'][_0x0de8('0x5e')]:''),'body':_0x2c3ec2[_0x0de8('0x5f')]?_0x2c3ec2[_0x0de8('0x5f')]['basename']:_0x2c3ec2[_0x0de8('0x34')],'direction':_0x2c3ec2[_0x0de8('0x62')]===_0x0de8('0x72')?'A':'C','secret':_0x2c3ec2[_0x0de8('0x74')],'read':_0x2c3ec2[_0x0de8('0x63')],'attachment':_0x2c3ec2[_0x0de8('0x5f')]};})['value']()};return ejs['renderFile'](path['join'](config[_0x0de8('0x52')],'server','views',_0x0de8('0x75')),{'interaction':_0x1750d2})[_0x0de8('0x1a')](function(_0x49dd67){var _0x3d4d0a=path[_0x0de8('0x51')](_0x14bfa1,_0x0de8('0x76')+_0x585f98['id']+'-'+_0x530cd6+_0x0de8('0x77'));var _0x5b8f12={'path':_0x3d4d0a,'channel':_0x0de8('0x68'),'interactionId':_0x585f98['id']};return pdf['createPdfFromHTML'](_0x49dd67,_0x5b8f12);})[_0x0de8('0x1a')](function(){return new Promise(function(_0x574c3b,_0x49a7ea){zipdir(_0x14bfa1,{'saveTo':_0x1f9ded},function(_0x42b2a5,_0x104af0){if(_0x42b2a5)return _0x49a7ea(_0x42b2a5);return _0x574c3b(_0x104af0);});})['then'](function(){return new Promise(function(_0x3cc755,_0x3555b0){rimraf(_0x14bfa1,function(_0x1aefed){if(_0x1aefed)_0x3555b0(_0x1aefed);return _0x3cc755();});});})[_0x0de8('0x1a')](function(){return _0x27c82d['download'](_0x1f9ded,_0x3048b7,function(_0x4da826){if(_0x4da826){logger[_0x0de8('0x78')](_0x0de8('0x79'),_0x4da826);}else{fs['unlinkSync'](_0x1f9ded);}});});});}else{return _0x27c82d[_0x0de8('0x11')](0xc8);}})[_0x0de8('0x26')](handleError(_0x27c82d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0c00de2..e50f9f8 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 _0x8777=['then','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x1276f5,_0x5153e2){var _0x14d765=function(_0x1c943a){while(--_0x1c943a){_0x1276f5['push'](_0x1276f5['shift']());}};_0x14d765(++_0x5153e2);}(_0x8777,0xe9));var _0x7877=function(_0x55d504,_0x539ccd){_0x55d504=_0x55d504-0x0;var _0x38841c=_0x8777[_0x55d504];return _0x38841c;};'use strict';var EventEmitter=require(_0x7877('0x0'));var OpenchannelInteraction=require(_0x7877('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x7877('0x1'))['db'][_0x7877('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7877('0x3')](0x0);var events={'afterCreate':_0x7877('0x4'),'afterUpdate':_0x7877('0x5'),'afterDestroy':_0x7877('0x6')};function emitEvent(_0x49ff78){return function(_0x41d807,_0x240016,_0x4b3931){_0x41d807['getUsers']({'attributes':['id'],'raw':!![]})[_0x7877('0x7')](function(_0x544da4){_0x41d807['setDataValue']('Users',_0x544da4['map'](function(_0x4516da){return{'id':_0x4516da['id']};}));return OpenchannelMessage[_0x7877('0x8')]({'where':{'OpenchannelInteractionId':_0x41d807['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7877('0x7')](function(_0x4f6e55){_0x41d807['setDataValue']('unreadMessages',_0x4f6e55[_0x7877('0x9')]);OpenchannelInteractionEvents[_0x7877('0xa')](_0x49ff78+':'+_0x41d807['id'],_0x41d807);OpenchannelInteractionEvents[_0x7877('0xa')](_0x49ff78,_0x41d807);_0x4b3931(null);})[_0x7877('0xb')](_0x4b3931(null));};}for(var e in events){if(events[_0x7877('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x7877('0xd')](e,emitEvent(event));}}module[_0x7877('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x94fa=['OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','map','findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb'];(function(_0x5a7871,_0x411044){var _0xb0b405=function(_0x57c0ec){while(--_0x57c0ec){_0x5a7871['push'](_0x5a7871['shift']());}};_0xb0b405(++_0x411044);}(_0x94fa,0x148));var _0xa94f=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x94fa[_0xa1e3e3];return _0xc980e9;};'use strict';var EventEmitter=require(_0xa94f('0x0'));var OpenchannelInteraction=require(_0xa94f('0x1'))['db'][_0xa94f('0x2')];var OpenchannelMessage=require(_0xa94f('0x1'))['db'][_0xa94f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa94f('0x4'),'afterUpdate':_0xa94f('0x5'),'afterDestroy':_0xa94f('0x6')};function emitEvent(_0x2da3bf){return function(_0x342c4f,_0x5a3756,_0x344627){_0x342c4f[_0xa94f('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25cea2){_0x342c4f['setDataValue']('Users',_0x25cea2[_0xa94f('0x8')](function(_0x12a8e5){return{'id':_0x12a8e5['id']};}));return OpenchannelMessage[_0xa94f('0x9')]({'where':{'OpenchannelInteractionId':_0x342c4f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x45711c){_0x342c4f['setDataValue'](_0xa94f('0xa'),_0x45711c[_0xa94f('0xb')]);OpenchannelInteractionEvents['emit'](_0x2da3bf+':'+_0x342c4f['id'],_0x342c4f);OpenchannelInteractionEvents[_0xa94f('0xc')](_0x2da3bf,_0x342c4f);_0x344627(null);})['catch'](_0x344627(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xa94f('0xd')](e,emitEvent(event));}}module[_0xa94f('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 89c873c..5cc70da 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 _0x153b=['utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4'];(function(_0x4dee7b,_0x219a0c){var _0x4dca5e=function(_0x16f334){while(--_0x16f334){_0x4dee7b['push'](_0x4dee7b['shift']());}};_0x4dca5e(++_0x219a0c);}(_0x153b,0x84));var _0xb153=function(_0x141e3c,_0x3cdf25){_0x141e3c=_0x141e3c-0x0;var _0x4801fe=_0x153b[_0x141e3c];return _0x4801fe;};'use strict';var _=require('lodash');var util=require(_0xb153('0x0'));var logger=require(_0xb153('0x1'))('api');var moment=require(_0xb153('0x2'));var BPromise=require(_0xb153('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb153('0x4'));var rimraf=require(_0xb153('0x5'));var config=require('../../config/environment');var attributes=require(_0xb153('0x6'));module[_0xb153('0x7')]=function(_0x509ae3,_0x795676){return _0x509ae3[_0xb153('0x8')](_0xb153('0x9'),attributes,{'tableName':_0xb153('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb153('0xb'),'collate':_0xb153('0xc'),'hooks':{'beforeUpdate':function(_0x40f1d2,_0x4cee19,_0xc8cbad){if(_0x40f1d2[_0xb153('0xd')]('closed')){_0x40f1d2[_0xb153('0xe')]=moment()['format'](_0xb153('0xf'));}_0xc8cbad(null,_0x40f1d2);}}});}; \ No newline at end of file +var _0x66ab=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closedAt','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c1c5f,_0x45cc6f){var _0x1e2986=function(_0xd2d69d){while(--_0xd2d69d){_0x4c1c5f['push'](_0x4c1c5f['shift']());}};_0x1e2986(++_0x45cc6f);}(_0x66ab,0x128));var _0xb66a=function(_0x1a349d,_0x4fb310){_0x1a349d=_0x1a349d-0x0;var _0x2445dd=_0x66ab[_0x1a349d];return _0x2445dd;};'use strict';var _=require(_0xb66a('0x0'));var util=require(_0xb66a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb66a('0x2'));var BPromise=require(_0xb66a('0x3'));var rp=require(_0xb66a('0x4'));var fs=require('fs');var path=require(_0xb66a('0x5'));var rimraf=require(_0xb66a('0x6'));var config=require(_0xb66a('0x7'));var attributes=require(_0xb66a('0x8'));module[_0xb66a('0x9')]=function(_0x515fad,_0x3c1712){return _0x515fad[_0xb66a('0xa')](_0xb66a('0xb'),attributes,{'tableName':_0xb66a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb66a('0xd'),'collate':_0xb66a('0xe'),'hooks':{'beforeUpdate':function(_0x4e200b,_0x167a1e,_0x3b646e){if(_0x4e200b['changed']('closed')){_0x4e200b[_0xb66a('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3b646e(null,_0x4e200b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4e08b77..e82c697 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 _0xef0a=['info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','where','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','body','omit','ids','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then'];(function(_0x1e40b1,_0x530792){var _0x166dae=function(_0x578b84){while(--_0x578b84){_0x1e40b1['push'](_0x1e40b1['shift']());}};_0x166dae(++_0x530792);}(_0xef0a,0x1dc));var _0xaef0=function(_0x5d73af,_0x2f2022){_0x5d73af=_0x5d73af-0x0;var _0x2c4bb0=_0xef0a[_0x5d73af];return _0x2c4bb0;};'use strict';var _=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaef0('0x2'));var fs=require('fs');var Redis=require(_0xaef0('0x3'));var db=require(_0xaef0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaef0('0x5'));var config=require(_0xaef0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaef0('0x7')][_0xaef0('0x8')]({'port':0x232a});config[_0xaef0('0x9')]=_[_0xaef0('0xa')](config[_0xaef0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xaef0('0xb'))(new Redis(config[_0xaef0('0x9')]));require(_0xaef0('0xc'))[_0xaef0('0xd')](socket);function respondWithRpcPromise(_0x528dcb,_0x14844d,_0xacca83){return new BPromise(function(_0x24e021,_0x361c3a){return client[_0xaef0('0xe')](_0x528dcb,_0xacca83)[_0xaef0('0xf')](function(_0x408a32){logger[_0xaef0('0x10')](_0xaef0('0x11'),_0x14844d,_0xaef0('0x12'));logger['debug'](_0xaef0('0x13'),_0x14844d,_0xaef0('0x12'),JSON[_0xaef0('0x14')](_0x408a32));if(_0x408a32[_0xaef0('0x15')]){if(_0x408a32[_0xaef0('0x15')][_0xaef0('0x16')]===0x1f4){logger[_0xaef0('0x15')](_0xaef0('0x11'),_0x14844d,_0x408a32[_0xaef0('0x15')][_0xaef0('0x17')]);return _0x361c3a(_0x408a32[_0xaef0('0x15')][_0xaef0('0x17')]);}logger['error'](_0xaef0('0x11'),_0x14844d,_0x408a32[_0xaef0('0x15')]['message']);return _0x24e021(_0x408a32['error'][_0xaef0('0x17')]);}else{logger['info'](_0xaef0('0x11'),_0x14844d,_0xaef0('0x12'));_0x24e021(_0x408a32[_0xaef0('0x18')][_0xaef0('0x17')]);}})[_0xaef0('0x19')](function(_0x49c2c5){logger['error'](_0xaef0('0x11'),_0x14844d,_0x49c2c5);_0x361c3a(_0x49c2c5);});});}exports[_0xaef0('0x1a')]=function(_0x36a54e){var _0x4b87b9=this;return new Promise(function(_0x8be414,_0x38e3f4){return db[_0xaef0('0x1b')][_0xaef0('0x1c')](_0x36a54e['body'],{'raw':_0x36a54e[_0xaef0('0x1d')]?_0x36a54e[_0xaef0('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a54e[_0xaef0('0x1d')]?_0x36a54e[_0xaef0('0x1d')][_0xaef0('0x1e')]||null:null,'attributes':_0x36a54e[_0xaef0('0x1d')]?_0x36a54e['options'][_0xaef0('0x1f')]||null:null,'limit':_0x36a54e[_0xaef0('0x1d')]?_0x36a54e[_0xaef0('0x1d')][_0xaef0('0x20')]||null:null})[_0xaef0('0xf')](function(_0x5c4a1d){logger['info'](_0xaef0('0x1a'),_0x36a54e);logger[_0xaef0('0x21')](_0xaef0('0x1a'),_0x36a54e,JSON[_0xaef0('0x14')](_0x5c4a1d));_0x8be414(_0x5c4a1d);})[_0xaef0('0x19')](function(_0x4dbb19){logger[_0xaef0('0x15')](_0xaef0('0x1a'),_0x4dbb19[_0xaef0('0x17')],_0x36a54e);_0x38e3f4(_0x4b87b9['error'](0x1f4,_0x4dbb19[_0xaef0('0x17')]));});});};exports[_0xaef0('0x22')]=function(_0x31374f){return new Promise(function(_0x40e356,_0x3d8b7f){return db[_0xaef0('0x1b')][_0xaef0('0x23')]({'where':_0x31374f[_0xaef0('0x1d')]?_0x31374f[_0xaef0('0x1d')][_0xaef0('0x1e')]||null:null})[_0xaef0('0xf')](function(_0x32eef8){if(_0x32eef8){return _0x32eef8['addTags'](_0x31374f[_0xaef0('0x24')]['ids'],_[_0xaef0('0x25')](_0x31374f['body'],[_0xaef0('0x26'),'id'])||{});}})[_0xaef0('0x27')](function(_0x4f1589){logger[_0xaef0('0x10')](_0xaef0('0x28'),_0x31374f);logger['debug'](_0xaef0('0x28'),_0x31374f,JSON[_0xaef0('0x14')](_0x4f1589));_0x40e356(_0x4f1589);})[_0xaef0('0x19')](function(_0x40f276){logger[_0xaef0('0x15')]('AddTags',_0x40f276['message'],_0x31374f);_0x3d8b7f(_this[_0xaef0('0x15')](0x1f4,_0x40f276[_0xaef0('0x17')]));});});}; \ No newline at end of file +var _0x445c=['rpc','http','redis','localhost','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','limit','then','stringify','catch','AddTagsToOpenchannelInteraction','where','addTags','ids','omit','body','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x445c,0xb5));var _0xc445=function(_0x1e54ed,_0x5e3116){_0x1e54ed=_0x1e54ed-0x0;var _0x917baa=_0x445c[_0x1e54ed];return _0x917baa;};'use strict';var _=require(_0xc445('0x0'));var util=require(_0xc445('0x1'));var moment=require(_0xc445('0x2'));var BPromise=require(_0xc445('0x3'));var rs=require(_0xc445('0x4'));var fs=require('fs');var Redis=require(_0xc445('0x5'));var db=require(_0xc445('0x6'))['db'];var utils=require(_0xc445('0x7'));var logger=require(_0xc445('0x8'))(_0xc445('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc445('0xa')]({'port':0x232a});config[_0xc445('0xb')]=_['defaults'](config[_0xc445('0xb')],{'host':_0xc445('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc445('0xd'))['register'](socket);function respondWithRpcPromise(_0x236ef2,_0x540b64,_0x5291ae){return new BPromise(function(_0x446df7,_0xcf5af){return client[_0xc445('0xe')](_0x236ef2,_0x5291ae)['then'](function(_0x545136){logger[_0xc445('0xf')](_0xc445('0x10'),_0x540b64,'request\x20sent');logger[_0xc445('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x540b64,_0xc445('0x12'),JSON['stringify'](_0x545136));if(_0x545136['error']){if(_0x545136[_0xc445('0x13')][_0xc445('0x14')]===0x1f4){logger[_0xc445('0x13')](_0xc445('0x10'),_0x540b64,_0x545136[_0xc445('0x13')]['message']);return _0xcf5af(_0x545136[_0xc445('0x13')][_0xc445('0x15')]);}logger['error'](_0xc445('0x10'),_0x540b64,_0x545136[_0xc445('0x13')][_0xc445('0x15')]);return _0x446df7(_0x545136[_0xc445('0x13')]['message']);}else{logger['info'](_0xc445('0x10'),_0x540b64,'request\x20sent');_0x446df7(_0x545136['result'][_0xc445('0x15')]);}})['catch'](function(_0x593920){logger[_0xc445('0x13')](_0xc445('0x10'),_0x540b64,_0x593920);_0xcf5af(_0x593920);});});}exports[_0xc445('0x16')]=function(_0x38defb){var _0x1d45a5=this;return new Promise(function(_0x257dc3,_0x22b25b){return db[_0xc445('0x17')][_0xc445('0x18')](_0x38defb['body'],{'raw':_0x38defb[_0xc445('0x19')]?_0x38defb['options'][_0xc445('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38defb['options']?_0x38defb[_0xc445('0x19')]['where']||null:null,'attributes':_0x38defb[_0xc445('0x19')]?_0x38defb[_0xc445('0x19')]['attributes']||null:null,'limit':_0x38defb[_0xc445('0x19')]?_0x38defb['options'][_0xc445('0x1b')]||null:null})[_0xc445('0x1c')](function(_0x222f68){logger[_0xc445('0xf')](_0xc445('0x16'),_0x38defb);logger['debug'](_0xc445('0x16'),_0x38defb,JSON[_0xc445('0x1d')](_0x222f68));_0x257dc3(_0x222f68);})[_0xc445('0x1e')](function(_0x5b470d){logger[_0xc445('0x13')]('UpdateOpenchannelInteraction',_0x5b470d['message'],_0x38defb);_0x22b25b(_0x1d45a5[_0xc445('0x13')](0x1f4,_0x5b470d['message']));});});};exports[_0xc445('0x1f')]=function(_0x5f53e4){return new Promise(function(_0x3d1063,_0x3de376){return db[_0xc445('0x17')]['find']({'where':_0x5f53e4[_0xc445('0x19')]?_0x5f53e4['options'][_0xc445('0x20')]||null:null})[_0xc445('0x1c')](function(_0x47998f){if(_0x47998f){return _0x47998f[_0xc445('0x21')](_0x5f53e4['body'][_0xc445('0x22')],_[_0xc445('0x23')](_0x5f53e4[_0xc445('0x24')],[_0xc445('0x22'),'id'])||{});}})['spread'](function(_0xea204){logger[_0xc445('0xf')]('AddTags',_0x5f53e4);logger['debug'](_0xc445('0x25'),_0x5f53e4,JSON[_0xc445('0x1d')](_0xea204));_0x3d1063(_0xea204);})[_0xc445('0x1e')](function(_0x55c934){logger[_0xc445('0x13')](_0xc445('0x25'),_0x55c934[_0xc445('0x15')],_0x5f53e4);_0x3de376(_this[_0xc445('0x13')](0x1f4,_0x55c934['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index bbba9ee..3770e90 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 _0xa372=['length','save','remove','emit','removeListener','register'];(function(_0x5485e7,_0x204494){var _0x223d75=function(_0x5056b6){while(--_0x5056b6){_0x5485e7['push'](_0x5485e7['shift']());}};_0x223d75(++_0x204494);}(_0xa372,0xa9));var _0x2a37=function(_0xe5ed4e,_0x4fecfd){_0xe5ed4e=_0xe5ed4e-0x0;var _0x5c5792=_0xa372[_0xe5ed4e];return _0x5c5792;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x2a37('0x0'),_0x2a37('0x1'),'update'];function createListener(_0x3bbac7,_0x9b721a){return function(_0x37bd72){_0x9b721a[_0x2a37('0x2')](_0x3bbac7,_0x37bd72);};}function removeListener(_0x5b8947,_0x49ad8a){return function(){OpenchannelInteractionEvents[_0x2a37('0x3')](_0x5b8947,_0x49ad8a);};}exports[_0x2a37('0x4')]=function(_0x100f39){for(var _0x9ba231=0x0,_0x1ae966=events[_0x2a37('0x5')];_0x9ba231<_0x1ae966;_0x9ba231++){var _0x18700c=events[_0x9ba231];var _0x25f156=createListener('openchannelInteraction:'+_0x18700c,_0x100f39);OpenchannelInteractionEvents['on'](_0x18700c,_0x25f156);}}; \ No newline at end of file +var _0x8ede=['update','emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8ede,0x17d));var _0xe8ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ede[_0x321bb2];return _0x9c12ed;};'use strict';var OpenchannelInteractionEvents=require(_0xe8ed('0x0'));var events=[_0xe8ed('0x1'),_0xe8ed('0x2'),_0xe8ed('0x3')];function createListener(_0x2ce4b0,_0x2b85cd){return function(_0x336da3){_0x2b85cd[_0xe8ed('0x4')](_0x2ce4b0,_0x336da3);};}function removeListener(_0x1ae7fd,_0x3ade32){return function(){OpenchannelInteractionEvents[_0xe8ed('0x5')](_0x1ae7fd,_0x3ade32);};}exports[_0xe8ed('0x6')]=function(_0x3fee99){for(var _0x452c68=0x0,_0x2d4e5b=events['length'];_0x452c68<_0x2d4e5b;_0x452c68++){var _0x360ab1=events[_0x452c68];var _0x193b28=createListener(_0xe8ed('0x7')+_0x360ab1,_0x3fee99);OpenchannelInteractionEvents['on'](_0x360ab1,_0x193b28);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6f3f67f..e9b8c8d 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x195919,_0x177c79){var _0x2aa39d=function(_0x31841c){while(--_0x31841c){_0x195919['push'](_0x195919['shift']());}};_0x2aa39d(++_0x177c79);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1de4b8,_0x529b41){_0x1de4b8=_0x1de4b8-0x0;var _0x557699=_0xcb91[_0x1de4b8];return _0x557699;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x40b54f,_0x6a7bb0){_0x40b54f=_0x40b54f-0x0;var _0x1d34a2=_0x70e0[_0x40b54f];return _0x1d34a2;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index bd6edc3..96de4a4 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 _0x4dd2=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x3648f8,_0xb10f37){var _0x52efcc=function(_0x124c84){while(--_0x124c84){_0x3648f8['push'](_0x3648f8['shift']());}};_0x52efcc(++_0xb10f37);}(_0x4dd2,0xf1));var _0x24dd=function(_0x5266e7,_0x97b16b){_0x5266e7=_0x5266e7-0x0;var _0x5470f1=_0x4dd2[_0x5266e7];return _0x5470f1;};'use strict';var Sequelize=require('sequelize');module[_0x24dd('0x0')]={'body':{'type':Sequelize[_0x24dd('0x1')](_0x24dd('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x24dd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x24dd('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x24dd('0x5')]},'providerName':{'type':Sequelize[_0x24dd('0x6')]},'providerResponse':{'type':Sequelize[_0x24dd('0x1')]}}; \ No newline at end of file +var _0x4c71=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x2df8a5,_0x4927b1){var _0x4d4525=function(_0x9ee3bf){while(--_0x9ee3bf){_0x2df8a5['push'](_0x2df8a5['shift']());}};_0x4d4525(++_0x4927b1);}(_0x4c71,0x12b));var _0x14c7=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4c71[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x14c7('0x0'));module[_0x14c7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x14c7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x14c7('0x4')]('in',_0x14c7('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x14c7('0x6')]},'providerName':{'type':Sequelize[_0x14c7('0x7')]},'providerResponse':{'type':Sequelize[_0x14c7('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 08e3286..e2d0c97 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 _0xe811=['find','create','body','params','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','OpenchannelInteractionId','read1stAt','interaction','get','user','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','reject','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','count','set','save','update','then','destroy','sendStatus','name','send','index','map','OpenchannelMessage','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','rows','fields','include'];(function(_0x2c9efe,_0xc2ab04){var _0x450b94=function(_0x386a9c){while(--_0x386a9c){_0x2c9efe['push'](_0x2c9efe['shift']());}};_0x450b94(++_0xc2ab04);}(_0xe811,0x1a8));var _0x1e81=function(_0xcaea59,_0x25efd2){_0xcaea59=_0xcaea59-0x0;var _0x2c68c5=_0xe811[_0xcaea59];return _0x2c68c5;};'use strict';var emlformat=require(_0x1e81('0x0'));var rimraf=require(_0x1e81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e81('0x2'));var rp=require(_0x1e81('0x3'));var moment=require('moment');var BPromise=require(_0x1e81('0x4'));var Mustache=require('mustache');var util=require(_0x1e81('0x5'));var path=require(_0x1e81('0x6'));var sox=require(_0x1e81('0x7'));var csv=require(_0x1e81('0x8'));var ejs=require(_0x1e81('0x9'));var fs=require('fs');var fs_extra=require(_0x1e81('0xa'));var _=require(_0x1e81('0xb'));var squel=require(_0x1e81('0xc'));var crypto=require(_0x1e81('0xd'));var jsforce=require(_0x1e81('0xe'));var deskjs=require(_0x1e81('0xf'));var toCsv=require(_0x1e81('0x8'));var querystring=require(_0x1e81('0x10'));var Papa=require(_0x1e81('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e81('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e81('0x13'));var logger=require(_0x1e81('0x14'))(_0x1e81('0x15'));var utils=require(_0x1e81('0x16'));var config=require(_0x1e81('0x17'));var licenseUtil=require(_0x1e81('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1e81('0x19')](config[_0x1e81('0x1a')],{'host':_0x1e81('0x1b'),'port':0x18eb});var socket=require(_0x1e81('0x1c'))(new Redis(config[_0x1e81('0x1a')]));require(_0x1e81('0x1d'))['register'](socket);var jayson=require(_0x1e81('0x1e'));var client=jayson['client'][_0x1e81('0x1f')]({'port':0x232c});var client9002=jayson[_0x1e81('0x20')][_0x1e81('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3f8a55,_0x11d4e1,_0x55642c,_0x54edde){return new BPromise(function(_0x1220ff,_0x1bf69c){var _0x38a671=_0x54edde||client;return _0x38a671['request'](_0x3f8a55,_0x55642c)['then'](function(_0x46fcd5){logger[_0x1e81('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x11d4e1,_0x1e81('0x22'));logger[_0x1e81('0x23')](_0x1e81('0x24'),_0x11d4e1,_0x1e81('0x22'),JSON[_0x1e81('0x25')](_0x46fcd5));if(_0x46fcd5[_0x1e81('0x26')]){if(_0x46fcd5[_0x1e81('0x26')][_0x1e81('0x27')]===0x1f4){logger[_0x1e81('0x26')](_0x1e81('0x28'),_0x11d4e1,_0x46fcd5[_0x1e81('0x26')][_0x1e81('0x29')]);return _0x1bf69c(_0x46fcd5[_0x1e81('0x26')]['message']);}logger[_0x1e81('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x11d4e1,_0x46fcd5[_0x1e81('0x26')][_0x1e81('0x29')]);return _0x1220ff(_0x46fcd5['error'][_0x1e81('0x29')]);}else{logger[_0x1e81('0x21')](_0x1e81('0x28'),_0x11d4e1,_0x1e81('0x22'));_0x1220ff(_0x46fcd5[_0x1e81('0x2a')][_0x1e81('0x29')]);}})[_0x1e81('0x2b')](function(_0x8dc95a){logger[_0x1e81('0x26')](_0x1e81('0x28'),_0x11d4e1,_0x8dc95a);_0x1bf69c(_0x8dc95a);});});}function respondWithStatusCode(_0x25bad4,_0x2c2d28){_0x2c2d28=_0x2c2d28||0xcc;return function(_0x51708b){if(_0x51708b){return _0x25bad4['sendStatus'](_0x2c2d28);}return _0x25bad4[_0x1e81('0x2c')](_0x2c2d28)[_0x1e81('0x2d')]();};}function respondWithResult(_0xf0981b,_0x3d7b15){_0x3d7b15=_0x3d7b15||0xc8;return function(_0x14d6b0){if(_0x14d6b0){return _0xf0981b[_0x1e81('0x2c')](_0x3d7b15)[_0x1e81('0x2e')](_0x14d6b0);}};}function respondWithFilteredResult(_0x130804,_0x214f34){return function(_0x322a38){if(_0x322a38){var _0x1cf43f=typeof _0x214f34[_0x1e81('0x2f')]==='undefined'&&typeof _0x214f34['limit']===_0x1e81('0x30');var _0x8ce544=_0x322a38[_0x1e81('0x31')];var _0x18265b=_0x1cf43f?0x0:_0x214f34[_0x1e81('0x2f')];var _0x18cec7=_0x1cf43f?_0x322a38['count']:_0x214f34['offset']+_0x214f34['limit'];var _0x40c535;if(_0x18cec7>=_0x8ce544){_0x18cec7=_0x8ce544;_0x40c535=0xc8;}else{_0x40c535=0xce;}_0x130804['status'](_0x40c535);return _0x130804[_0x1e81('0x32')]('Content-Range',_0x18265b+'-'+_0x18cec7+'/'+_0x8ce544)['json'](_0x322a38);}return null;};}function patchUpdates(_0xebc7c2){return function(_0x4d762f){try{jsonpatch['apply'](_0x4d762f,_0xebc7c2,!![]);}catch(_0x5018fd){return BPromise['reject'](_0x5018fd);}return _0x4d762f[_0x1e81('0x33')]();};}function saveUpdates(_0x414c03,_0x59e566){return function(_0x249d8d){if(_0x249d8d){return _0x249d8d[_0x1e81('0x34')](_0x414c03)[_0x1e81('0x35')](function(_0x11f770){return _0x11f770;});}return null;};}function removeEntity(_0x10fc10,_0x32eca4){return function(_0x46294c){if(_0x46294c){return _0x46294c[_0x1e81('0x36')]()[_0x1e81('0x35')](function(){_0x10fc10[_0x1e81('0x2c')](0xcc)[_0x1e81('0x2d')]();});}};}function handleEntityNotFound(_0x27ab12,_0x4b9543){return function(_0x211e21){if(!_0x211e21){_0x27ab12[_0x1e81('0x37')](0x194);}return _0x211e21;};}function handleError(_0x139748,_0x47cde0){_0x47cde0=_0x47cde0||0x1f4;return function(_0x883da){logger[_0x1e81('0x26')](_0x883da['stack']);if(_0x883da[_0x1e81('0x38')]){delete _0x883da[_0x1e81('0x38')];}_0x139748[_0x1e81('0x2c')](_0x47cde0)[_0x1e81('0x39')](_0x883da);};}exports[_0x1e81('0x3a')]=function(_0x2c41d8,_0x40e88a){var _0x3a9804={},_0x4bb46a={},_0xd2c904={'count':0x0,'rows':[]};var _0x45c887=_[_0x1e81('0x3b')](db[_0x1e81('0x3c')]['rawAttributes'],function(_0x469fa9){return{'name':_0x469fa9['fieldName'],'type':_0x469fa9['type']['key']};});_0x4bb46a[_0x1e81('0x3d')]=_[_0x1e81('0x3b')](_0x45c887,_0x1e81('0x38'));_0x4bb46a['query']=_[_0x1e81('0x3e')](_0x2c41d8[_0x1e81('0x3f')]);_0x4bb46a[_0x1e81('0x40')]=_[_0x1e81('0x41')](_0x4bb46a[_0x1e81('0x3d')],_0x4bb46a[_0x1e81('0x3f')]);_0x3a9804[_0x1e81('0x42')]=_[_0x1e81('0x41')](_0x4bb46a[_0x1e81('0x3d')],qs['fields'](_0x2c41d8[_0x1e81('0x3f')]['fields']));_0x3a9804[_0x1e81('0x42')]=_0x3a9804['attributes'][_0x1e81('0x43')]?_0x3a9804[_0x1e81('0x42')]:_0x4bb46a[_0x1e81('0x3d')];if(!_0x2c41d8[_0x1e81('0x3f')][_0x1e81('0x44')](_0x1e81('0x45'))){_0x3a9804[_0x1e81('0x46')]=qs[_0x1e81('0x46')](_0x2c41d8[_0x1e81('0x3f')][_0x1e81('0x46')]);_0x3a9804['offset']=qs[_0x1e81('0x2f')](_0x2c41d8[_0x1e81('0x3f')][_0x1e81('0x2f')]);}_0x3a9804[_0x1e81('0x47')]=qs['sort'](_0x2c41d8[_0x1e81('0x3f')][_0x1e81('0x48')]);_0x3a9804[_0x1e81('0x49')]=qs[_0x1e81('0x40')](_[_0x1e81('0x4a')](_0x2c41d8['query'],_0x4bb46a[_0x1e81('0x40')]),_0x45c887);if(_0x2c41d8['query'][_0x1e81('0x4b')]){_0x3a9804['where']=_['merge'](_0x3a9804[_0x1e81('0x49')],{'$or':_['map'](_0x45c887,function(_0x541a56){if(_0x541a56[_0x1e81('0x4c')]!=='VIRTUAL'){var _0x300204={};_0x300204[_0x541a56[_0x1e81('0x38')]]={'$like':'%'+_0x2c41d8['query'][_0x1e81('0x4b')]+'%'};return _0x300204;}})});}_0x3a9804=_[_0x1e81('0x4d')]({},_0x3a9804,_0x2c41d8[_0x1e81('0x4e')]);var _0xf3e25b={'where':_0x3a9804['where']};return db['OpenchannelMessage'][_0x1e81('0x31')](_0xf3e25b)[_0x1e81('0x35')](function(_0x52cbb){_0xd2c904[_0x1e81('0x31')]=_0x52cbb;if(_0x2c41d8['query'][_0x1e81('0x4f')]){_0x3a9804['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1e81('0x50')](_0x3a9804);})[_0x1e81('0x35')](function(_0x59f6f0){_0xd2c904[_0x1e81('0x51')]=_0x59f6f0;return _0xd2c904;})['then'](respondWithFilteredResult(_0x40e88a,_0x3a9804))[_0x1e81('0x2b')](handleError(_0x40e88a,null));};exports['show']=function(_0x28ea8a,_0x335840){var _0x283fc4={'raw':!![],'where':{'id':_0x28ea8a['params']['id']}},_0x18c38b={};_0x18c38b[_0x1e81('0x3d')]=_['keys'](db[_0x1e81('0x3c')]['rawAttributes']);_0x18c38b[_0x1e81('0x3f')]=_[_0x1e81('0x3e')](_0x28ea8a[_0x1e81('0x3f')]);_0x18c38b[_0x1e81('0x40')]=_[_0x1e81('0x41')](_0x18c38b[_0x1e81('0x3d')],_0x18c38b['query']);_0x283fc4[_0x1e81('0x42')]=_['intersection'](_0x18c38b[_0x1e81('0x3d')],qs[_0x1e81('0x52')](_0x28ea8a[_0x1e81('0x3f')][_0x1e81('0x52')]));_0x283fc4[_0x1e81('0x42')]=_0x283fc4[_0x1e81('0x42')][_0x1e81('0x43')]?_0x283fc4[_0x1e81('0x42')]:_0x18c38b[_0x1e81('0x3d')];if(_0x28ea8a[_0x1e81('0x3f')][_0x1e81('0x4f')]){_0x283fc4[_0x1e81('0x53')]=[{'all':!![]}];}_0x283fc4=_['merge']({},_0x283fc4,_0x28ea8a[_0x1e81('0x4e')]);return db[_0x1e81('0x3c')][_0x1e81('0x54')](_0x283fc4)['then'](handleEntityNotFound(_0x335840,null))['then'](respondWithResult(_0x335840,null))[_0x1e81('0x2b')](handleError(_0x335840,null));};exports[_0x1e81('0x55')]=function(_0x8b746a,_0x1ba971){return db[_0x1e81('0x3c')][_0x1e81('0x55')](_0x8b746a['body'],{})[_0x1e81('0x35')](respondWithResult(_0x1ba971,0xc9))[_0x1e81('0x2b')](handleError(_0x1ba971,null));};exports['update']=function(_0x1ac5b2,_0x1fe500){if(_0x1ac5b2[_0x1e81('0x56')]['id']){delete _0x1ac5b2[_0x1e81('0x56')]['id'];}return db[_0x1e81('0x3c')][_0x1e81('0x54')]({'where':{'id':_0x1ac5b2[_0x1e81('0x57')]['id']}})[_0x1e81('0x35')](handleEntityNotFound(_0x1fe500,null))[_0x1e81('0x35')](saveUpdates(_0x1ac5b2[_0x1e81('0x56')],null))[_0x1e81('0x35')](respondWithResult(_0x1fe500,null))[_0x1e81('0x2b')](handleError(_0x1fe500,null));};exports[_0x1e81('0x36')]=function(_0x14523e,_0x3523e2){return db[_0x1e81('0x3c')]['find']({'where':{'id':_0x14523e[_0x1e81('0x57')]['id']}})[_0x1e81('0x35')](handleEntityNotFound(_0x3523e2,null))[_0x1e81('0x35')](removeEntity(_0x3523e2,null))[_0x1e81('0x2b')](handleError(_0x3523e2,null));};exports[_0x1e81('0x58')]=function(_0x549e97,_0x1b42ce){return db[_0x1e81('0x3c')][_0x1e81('0x58')]()[_0x1e81('0x35')](respondWithResult(_0x1b42ce,null))['catch'](handleError(_0x1b42ce,null));};var interaction_log=require(_0x1e81('0x14'))('openchannel-interactions');exports[_0x1e81('0x59')]=function(_0x5e4f72,_0x20a2a3,_0x4abf05){var _0x32cae4={'agent':{},'channel':_0x1e81('0x5a')};if(_0x5e4f72[_0x1e81('0x56')]['id']){delete _0x5e4f72['body']['id'];}_0x5e4f72[_0x1e81('0x56')][_0x1e81('0x5b')]=!![];_0x5e4f72[_0x1e81('0x56')][_0x1e81('0x5c')]=moment()[_0x1e81('0x5d')](_0x1e81('0x5e'));_0x5e4f72[_0x1e81('0x56')][_0x1e81('0x5f')]=_0x5e4f72[_0x1e81('0x56')][_0x1e81('0x5f')]||_0x5e4f72['user']['id'];_0x32cae4['agent']['id']=_0x5e4f72[_0x1e81('0x56')][_0x1e81('0x5f')];return db[_0x1e81('0x3c')]['find']({'where':{'id':_0x5e4f72[_0x1e81('0x57')]['id'],'UserId':null}})[_0x1e81('0x35')](handleEntityNotFound(_0x20a2a3,null))[_0x1e81('0x35')](saveUpdates(_0x5e4f72[_0x1e81('0x56')],null))[_0x1e81('0x35')](function(_0x17b618){if(_0x17b618){_0x32cae4['message']=_0x17b618['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x1e81('0x54')]({'where':{'id':_0x17b618[_0x1e81('0x60')]}});}return null;})[_0x1e81('0x35')](handleEntityNotFound(_0x20a2a3,null))[_0x1e81('0x35')](function(_0x42bf6f){if(_0x42bf6f){return _0x42bf6f[_0x1e81('0x34')]({'UserId':_0x5e4f72['body'][_0x1e81('0x5f')],'read1stAt':_['isNil'](_0x42bf6f[_0x1e81('0x61')])?moment()['format'](_0x1e81('0x5e')):undefined});}return null;})['then'](function(_0x13fda5){if(_0x13fda5){_0x32cae4[_0x1e81('0x62')]=_0x13fda5[_0x1e81('0x63')]({'plain':!![]});interaction_log[_0x1e81('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e4f72[_0x1e81('0x64')]['id'],_0x5e4f72[_0x1e81('0x64')][_0x1e81('0x38')],_0x5e4f72['user']['role'],_0x32cae4[_0x1e81('0x62')]['id'],_0x5e4f72[_0x1e81('0x56')]?JSON[_0x1e81('0x25')](_0x5e4f72[_0x1e81('0x56')]):'null');return respondWithRpcPromise(_0x1e81('0x65'),'acceptMessage',_0x32cae4);}return null;})[_0x1e81('0x35')](function(_0x336066){var _0x37a2cd=_0x1e81('0x66')+_0x336066[_0x1e81('0x29')][_0x1e81('0x67')];return db[_0x1e81('0x68')][_0x1e81('0x3f')](_0x37a2cd,{'type':db[_0x1e81('0x69')][_0x1e81('0x6a')][_0x1e81('0x6b')],'raw':!![]})['then'](function(_0x4a6464){return _0x4a6464;});})['then'](function(_0x2d7dcc){if(_0x2d7dcc){_0x32cae4['message'][_0x1e81('0x6c')]=_0x2d7dcc[0x0];if(!_0x5e4f72[_0x1e81('0x56')][_0x1e81('0x5f')])return;return db['User'][_0x1e81('0x54')]({'where':{'id':_0x5e4f72[_0x1e81('0x56')]['UserId'],'role':_0x1e81('0x6d')},'attributes':['id',_0x1e81('0x38'),_0x1e81('0x6e'),_0x1e81('0x6f'),_0x1e81('0x70')],'raw':!![]});}return null;})['then'](function(_0x186303){if(!_0x186303)return null;_0x32cae4[_0x1e81('0x29')]['agent']=_0x186303;return _0x32cae4;})['then'](function(_0x1a43a5){if(_0x1a43a5){if(_0x5e4f72[_0x1e81('0x56')]['manual']){_0x32cae4[_0x1e81('0x29')][_0x1e81('0x71')]=util[_0x1e81('0x5d')](_0x1e81('0x72'),_0x5e4f72[_0x1e81('0x64')][_0x1e81('0x38')]);_0x32cae4[_0x1e81('0x29')][_0x1e81('0x73')]=_0x32cae4['channel'];_0x32cae4['message'][_0x1e81('0x74')]=_0x32cae4[_0x1e81('0x73')];_0x32cae4[_0x1e81('0x29')][_0x1e81('0x75')]=_0x1e81('0x59');return respondWithRpcPromise(_0x1e81('0x76'),_0x1e81('0x76'),{'event':_0x1e81('0x77'),'message':_0x32cae4[_0x1e81('0x29')]},client9002)[_0x1e81('0x35')](function(){return _0x32cae4;});}return _0x32cae4;}return null;})[_0x1e81('0x35')](respondWithResult(_0x20a2a3,null))[_0x1e81('0x2b')](handleError(_0x20a2a3,null));};var interaction_log=require('../../config/logger')(_0x1e81('0x78'));exports['reject']=function(_0x54fae2,_0x3201f4,_0x76cd7f){var _0x34f0dc={'agent':{},'channel':_0x1e81('0x5a')};if(_0x54fae2[_0x1e81('0x56')]['id']){delete _0x54fae2[_0x1e81('0x56')]['id'];}_0x54fae2[_0x1e81('0x56')]['UserId']=_0x54fae2[_0x1e81('0x56')][_0x1e81('0x5f')]||_0x54fae2[_0x1e81('0x64')]['id'];_0x34f0dc[_0x1e81('0x6d')]['id']=_0x54fae2[_0x1e81('0x56')][_0x1e81('0x5f')];return db[_0x1e81('0x3c')]['find']({'where':{'id':_0x54fae2[_0x1e81('0x57')]['id'],'UserId':null}})[_0x1e81('0x35')](handleEntityNotFound(_0x3201f4,null))[_0x1e81('0x35')](function(_0x3db63c){if(_0x3db63c){_0x34f0dc[_0x1e81('0x29')]=_0x3db63c['get']({'plain':!![]});return db[_0x1e81('0x79')][_0x1e81('0x54')]({'where':{'id':_0x3db63c[_0x1e81('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x3201f4,null))[_0x1e81('0x35')](function(_0x751271){if(_0x751271){_0x34f0dc[_0x1e81('0x62')]=_0x751271[_0x1e81('0x63')]({'plain':!![]});interaction_log[_0x1e81('0x21')](_0x1e81('0x7a'),_0x54fae2[_0x1e81('0x64')]['id'],_0x54fae2['user'][_0x1e81('0x38')],_0x54fae2[_0x1e81('0x64')]['role'],_0x34f0dc[_0x1e81('0x62')]['id'],_0x54fae2[_0x1e81('0x56')]?JSON[_0x1e81('0x25')](_0x54fae2[_0x1e81('0x56')]):'null');return respondWithRpcPromise('RejectMessage',_0x1e81('0x7b'),_0x34f0dc);}return null;})[_0x1e81('0x35')](function(_0xded5c8){var _0x2046d6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xded5c8[_0x1e81('0x29')][_0x1e81('0x67')];return db[_0x1e81('0x68')]['query'](_0x2046d6,{'type':db['Sequelize']['QueryTypes'][_0x1e81('0x6b')],'raw':!![]})[_0x1e81('0x35')](function(_0x457f56){return _0x457f56;});})[_0x1e81('0x35')](function(_0x2377be){if(_0x2377be){_0x34f0dc[_0x1e81('0x29')][_0x1e81('0x6c')]=_0x2377be[0x0];if(!_0x54fae2[_0x1e81('0x56')]['UserId'])return;return db[_0x1e81('0x7c')][_0x1e81('0x54')]({'where':{'id':_0x54fae2[_0x1e81('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x1e81('0x38'),'fullname',_0x1e81('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0xd474c7){if(!_0xd474c7)return null;_0x34f0dc[_0x1e81('0x29')]['agent']=_0xd474c7;return _0x34f0dc;})[_0x1e81('0x35')](function(_0x359e28){if(_0x359e28){_0x359e28['message']['interface']=util[_0x1e81('0x5d')](_0x1e81('0x72'),_0x54fae2[_0x1e81('0x64')][_0x1e81('0x38')]);_0x359e28[_0x1e81('0x29')][_0x1e81('0x73')]=_0x34f0dc[_0x1e81('0x73')];_0x359e28[_0x1e81('0x29')][_0x1e81('0x74')]=_0x34f0dc['channel'];_0x359e28[_0x1e81('0x29')][_0x1e81('0x75')]=_0x1e81('0x7d');respondWithRpcPromise(_0x1e81('0x76'),_0x1e81('0x76'),{'event':_0x1e81('0x7e'),'message':_0x359e28[_0x1e81('0x29')]},client9002);return _0x34f0dc;}return null;})[_0x1e81('0x35')](respondWithResult(_0x3201f4,null))[_0x1e81('0x2b')](handleError(_0x3201f4,null));}; \ No newline at end of file +var _0xd663=['then','info','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','end','stack','name','send','index','OpenchannelMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include','find','create','body','destroy','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','update','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','contact','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http'];(function(_0x5ecee0,_0x1729dd){var _0x1f770f=function(_0x439b2f){while(--_0x439b2f){_0x5ecee0['push'](_0x5ecee0['shift']());}};_0x1f770f(++_0x1729dd);}(_0xd663,0xf0));var _0x3d66=function(_0x2e3200,_0x5506c3){_0x2e3200=_0x2e3200-0x0;var _0xa4cc1f=_0xd663[_0x2e3200];return _0xa4cc1f;};'use strict';var emlformat=require(_0x3d66('0x0'));var rimraf=require(_0x3d66('0x1'));var zipdir=require(_0x3d66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d66('0x3'));var moment=require(_0x3d66('0x4'));var BPromise=require(_0x3d66('0x5'));var Mustache=require('mustache');var util=require(_0x3d66('0x6'));var path=require(_0x3d66('0x7'));var sox=require(_0x3d66('0x8'));var csv=require('to-csv');var ejs=require(_0x3d66('0x9'));var fs=require('fs');var fs_extra=require(_0x3d66('0xa'));var _=require(_0x3d66('0xb'));var squel=require(_0x3d66('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d66('0xd'));var deskjs=require(_0x3d66('0xe'));var toCsv=require(_0x3d66('0xf'));var querystring=require(_0x3d66('0x10'));var Papa=require('papaparse');var Redis=require(_0x3d66('0x11'));var authService=require(_0x3d66('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x13'));var hardwareService=require(_0x3d66('0x14'));var logger=require(_0x3d66('0x15'))(_0x3d66('0x16'));var utils=require(_0x3d66('0x17'));var config=require(_0x3d66('0x18'));var licenseUtil=require(_0x3d66('0x19'));var db=require(_0x3d66('0x1a'))['db'];config['redis']=_[_0x3d66('0x1b')](config[_0x3d66('0x1c')],{'host':_0x3d66('0x1d'),'port':0x18eb});var socket=require(_0x3d66('0x1e'))(new Redis(config[_0x3d66('0x1c')]));require(_0x3d66('0x1f'))[_0x3d66('0x20')](socket);var jayson=require(_0x3d66('0x21'));var client=jayson[_0x3d66('0x22')][_0x3d66('0x23')]({'port':0x232c});var client9002=jayson[_0x3d66('0x22')][_0x3d66('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2194d8,_0x5b2396,_0x2a16b8,_0x272ca5){return new BPromise(function(_0x166b15,_0x1e66e3){var _0x47d8eb=_0x272ca5||client;return _0x47d8eb['request'](_0x2194d8,_0x2a16b8)[_0x3d66('0x24')](function(_0x350528){logger[_0x3d66('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x5b2396,'request\x20sent');logger['debug'](_0x3d66('0x26'),_0x5b2396,_0x3d66('0x27'),JSON['stringify'](_0x350528));if(_0x350528[_0x3d66('0x28')]){if(_0x350528[_0x3d66('0x28')][_0x3d66('0x29')]===0x1f4){logger[_0x3d66('0x28')](_0x3d66('0x2a'),_0x5b2396,_0x350528[_0x3d66('0x28')][_0x3d66('0x2b')]);return _0x1e66e3(_0x350528[_0x3d66('0x28')][_0x3d66('0x2b')]);}logger[_0x3d66('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x5b2396,_0x350528[_0x3d66('0x28')][_0x3d66('0x2b')]);return _0x166b15(_0x350528[_0x3d66('0x28')][_0x3d66('0x2b')]);}else{logger[_0x3d66('0x25')](_0x3d66('0x2a'),_0x5b2396,_0x3d66('0x27'));_0x166b15(_0x350528['result']['message']);}})[_0x3d66('0x2c')](function(_0x4ad0cd){logger[_0x3d66('0x28')](_0x3d66('0x2a'),_0x5b2396,_0x4ad0cd);_0x1e66e3(_0x4ad0cd);});});}function respondWithStatusCode(_0x480b3f,_0x449dfe){_0x449dfe=_0x449dfe||0xcc;return function(_0x45ccd8){if(_0x45ccd8){return _0x480b3f[_0x3d66('0x2d')](_0x449dfe);}return _0x480b3f[_0x3d66('0x2e')](_0x449dfe)['end']();};}function respondWithResult(_0x1a8eff,_0x57993f){_0x57993f=_0x57993f||0xc8;return function(_0x37e3bb){if(_0x37e3bb){return _0x1a8eff[_0x3d66('0x2e')](_0x57993f)[_0x3d66('0x2f')](_0x37e3bb);}};}function respondWithFilteredResult(_0x49759c,_0x3d350a){return function(_0x4b67a1){if(_0x4b67a1){var _0x218179=typeof _0x3d350a['offset']===_0x3d66('0x30')&&typeof _0x3d350a[_0x3d66('0x31')]===_0x3d66('0x30');var _0x3dea23=_0x4b67a1['count'];var _0x1b6d73=_0x218179?0x0:_0x3d350a['offset'];var _0x1e389a=_0x218179?_0x4b67a1['count']:_0x3d350a[_0x3d66('0x32')]+_0x3d350a['limit'];var _0x36af84;if(_0x1e389a>=_0x3dea23){_0x1e389a=_0x3dea23;_0x36af84=0xc8;}else{_0x36af84=0xce;}_0x49759c[_0x3d66('0x2e')](_0x36af84);return _0x49759c[_0x3d66('0x33')](_0x3d66('0x34'),_0x1b6d73+'-'+_0x1e389a+'/'+_0x3dea23)['json'](_0x4b67a1);}return null;};}function patchUpdates(_0xe394bb){return function(_0x462942){try{jsonpatch[_0x3d66('0x35')](_0x462942,_0xe394bb,!![]);}catch(_0x1a6f31){return BPromise[_0x3d66('0x36')](_0x1a6f31);}return _0x462942[_0x3d66('0x37')]();};}function saveUpdates(_0x3489d1,_0x10494d){return function(_0x1ce90c){if(_0x1ce90c){return _0x1ce90c['update'](_0x3489d1)['then'](function(_0x4306df){return _0x4306df;});}return null;};}function removeEntity(_0x23fc80,_0x338374){return function(_0x5b700b){if(_0x5b700b){return _0x5b700b['destroy']()[_0x3d66('0x24')](function(){_0x23fc80['status'](0xcc)[_0x3d66('0x38')]();});}};}function handleEntityNotFound(_0x17aa59,_0x29a83b){return function(_0x4a8a50){if(!_0x4a8a50){_0x17aa59[_0x3d66('0x2d')](0x194);}return _0x4a8a50;};}function handleError(_0x198e7b,_0x373e66){_0x373e66=_0x373e66||0x1f4;return function(_0x4d1db5){logger['error'](_0x4d1db5[_0x3d66('0x39')]);if(_0x4d1db5[_0x3d66('0x3a')]){delete _0x4d1db5[_0x3d66('0x3a')];}_0x198e7b['status'](_0x373e66)[_0x3d66('0x3b')](_0x4d1db5);};}exports[_0x3d66('0x3c')]=function(_0x457f3f,_0x19e874){var _0x2bdf3d={},_0x5f4122={},_0x5bca03={'count':0x0,'rows':[]};var _0x3587e3=_['map'](db[_0x3d66('0x3d')][_0x3d66('0x3e')],function(_0x156465){return{'name':_0x156465['fieldName'],'type':_0x156465[_0x3d66('0x3f')][_0x3d66('0x40')]};});_0x5f4122[_0x3d66('0x41')]=_[_0x3d66('0x42')](_0x3587e3,'name');_0x5f4122[_0x3d66('0x43')]=_[_0x3d66('0x44')](_0x457f3f['query']);_0x5f4122[_0x3d66('0x45')]=_[_0x3d66('0x46')](_0x5f4122[_0x3d66('0x41')],_0x5f4122[_0x3d66('0x43')]);_0x2bdf3d[_0x3d66('0x47')]=_[_0x3d66('0x46')](_0x5f4122[_0x3d66('0x41')],qs[_0x3d66('0x48')](_0x457f3f[_0x3d66('0x43')][_0x3d66('0x48')]));_0x2bdf3d[_0x3d66('0x47')]=_0x2bdf3d[_0x3d66('0x47')][_0x3d66('0x49')]?_0x2bdf3d[_0x3d66('0x47')]:_0x5f4122[_0x3d66('0x41')];if(!_0x457f3f[_0x3d66('0x43')][_0x3d66('0x4a')](_0x3d66('0x4b'))){_0x2bdf3d[_0x3d66('0x31')]=qs[_0x3d66('0x31')](_0x457f3f['query'][_0x3d66('0x31')]);_0x2bdf3d['offset']=qs[_0x3d66('0x32')](_0x457f3f['query'][_0x3d66('0x32')]);}_0x2bdf3d['order']=qs[_0x3d66('0x4c')](_0x457f3f[_0x3d66('0x43')][_0x3d66('0x4c')]);_0x2bdf3d['where']=qs['filters'](_[_0x3d66('0x4d')](_0x457f3f[_0x3d66('0x43')],_0x5f4122[_0x3d66('0x45')]),_0x3587e3);if(_0x457f3f[_0x3d66('0x43')][_0x3d66('0x4e')]){_0x2bdf3d['where']=_[_0x3d66('0x4f')](_0x2bdf3d[_0x3d66('0x50')],{'$or':_[_0x3d66('0x42')](_0x3587e3,function(_0x14b104){if(_0x14b104['type']!==_0x3d66('0x51')){var _0x448436={};_0x448436[_0x14b104[_0x3d66('0x3a')]]={'$like':'%'+_0x457f3f[_0x3d66('0x43')]['filter']+'%'};return _0x448436;}})});}_0x2bdf3d=_['merge']({},_0x2bdf3d,_0x457f3f[_0x3d66('0x52')]);var _0x3aa3a1={'where':_0x2bdf3d[_0x3d66('0x50')]};return db[_0x3d66('0x3d')]['count'](_0x3aa3a1)[_0x3d66('0x24')](function(_0x26b490){_0x5bca03[_0x3d66('0x53')]=_0x26b490;if(_0x457f3f[_0x3d66('0x43')][_0x3d66('0x54')]){_0x2bdf3d['include']=[{'all':!![]}];}return db[_0x3d66('0x3d')][_0x3d66('0x55')](_0x2bdf3d);})[_0x3d66('0x24')](function(_0x2a0d91){_0x5bca03[_0x3d66('0x56')]=_0x2a0d91;return _0x5bca03;})[_0x3d66('0x24')](respondWithFilteredResult(_0x19e874,_0x2bdf3d))[_0x3d66('0x2c')](handleError(_0x19e874,null));};exports[_0x3d66('0x57')]=function(_0x24c954,_0x196597){var _0x48c712={'raw':!![],'where':{'id':_0x24c954[_0x3d66('0x58')]['id']}},_0x549f59={};_0x549f59[_0x3d66('0x41')]=_[_0x3d66('0x44')](db['OpenchannelMessage'][_0x3d66('0x3e')]);_0x549f59['query']=_[_0x3d66('0x44')](_0x24c954[_0x3d66('0x43')]);_0x549f59[_0x3d66('0x45')]=_[_0x3d66('0x46')](_0x549f59[_0x3d66('0x41')],_0x549f59[_0x3d66('0x43')]);_0x48c712['attributes']=_['intersection'](_0x549f59[_0x3d66('0x41')],qs[_0x3d66('0x48')](_0x24c954[_0x3d66('0x43')][_0x3d66('0x48')]));_0x48c712[_0x3d66('0x47')]=_0x48c712[_0x3d66('0x47')][_0x3d66('0x49')]?_0x48c712[_0x3d66('0x47')]:_0x549f59[_0x3d66('0x41')];if(_0x24c954[_0x3d66('0x43')][_0x3d66('0x54')]){_0x48c712[_0x3d66('0x59')]=[{'all':!![]}];}_0x48c712=_[_0x3d66('0x4f')]({},_0x48c712,_0x24c954[_0x3d66('0x52')]);return db[_0x3d66('0x3d')][_0x3d66('0x5a')](_0x48c712)[_0x3d66('0x24')](handleEntityNotFound(_0x196597,null))[_0x3d66('0x24')](respondWithResult(_0x196597,null))['catch'](handleError(_0x196597,null));};exports[_0x3d66('0x5b')]=function(_0x53c347,_0x39c42e){return db[_0x3d66('0x3d')]['create'](_0x53c347['body'],{})[_0x3d66('0x24')](respondWithResult(_0x39c42e,0xc9))['catch'](handleError(_0x39c42e,null));};exports['update']=function(_0x56f458,_0x5c4384){if(_0x56f458['body']['id']){delete _0x56f458[_0x3d66('0x5c')]['id'];}return db[_0x3d66('0x3d')][_0x3d66('0x5a')]({'where':{'id':_0x56f458[_0x3d66('0x58')]['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x5c4384,null))[_0x3d66('0x24')](saveUpdates(_0x56f458['body'],null))[_0x3d66('0x24')](respondWithResult(_0x5c4384,null))[_0x3d66('0x2c')](handleError(_0x5c4384,null));};exports[_0x3d66('0x5d')]=function(_0x5f0d88,_0x5e685c){return db[_0x3d66('0x3d')][_0x3d66('0x5a')]({'where':{'id':_0x5f0d88[_0x3d66('0x58')]['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x5e685c,null))[_0x3d66('0x24')](removeEntity(_0x5e685c,null))[_0x3d66('0x2c')](handleError(_0x5e685c,null));};exports[_0x3d66('0x5e')]=function(_0x183b82,_0x1aa55c){return db[_0x3d66('0x3d')][_0x3d66('0x5e')]()[_0x3d66('0x24')](respondWithResult(_0x1aa55c,null))[_0x3d66('0x2c')](handleError(_0x1aa55c,null));};var interaction_log=require(_0x3d66('0x15'))('openchannel-interactions');exports[_0x3d66('0x5f')]=function(_0x2835a6,_0x55404b,_0x523d49){var _0x1c37e0={'agent':{},'channel':_0x3d66('0x60')};if(_0x2835a6['body']['id']){delete _0x2835a6[_0x3d66('0x5c')]['id'];}_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x61')]=!![];_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x62')]=moment()[_0x3d66('0x63')](_0x3d66('0x64'));_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')]=_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')]||_0x2835a6[_0x3d66('0x66')]['id'];_0x1c37e0[_0x3d66('0x67')]['id']=_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')];return db[_0x3d66('0x3d')][_0x3d66('0x5a')]({'where':{'id':_0x2835a6['params']['id'],'UserId':null}})[_0x3d66('0x24')](handleEntityNotFound(_0x55404b,null))[_0x3d66('0x24')](saveUpdates(_0x2835a6[_0x3d66('0x5c')],null))[_0x3d66('0x24')](function(_0xd554c4){if(_0xd554c4){_0x1c37e0['message']=_0xd554c4[_0x3d66('0x68')]({'plain':!![]});return db[_0x3d66('0x69')][_0x3d66('0x5a')]({'where':{'id':_0xd554c4[_0x3d66('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x55404b,null))[_0x3d66('0x24')](function(_0xad48e1){if(_0xad48e1){return _0xad48e1[_0x3d66('0x6b')]({'UserId':_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')],'read1stAt':_[_0x3d66('0x6c')](_0xad48e1[_0x3d66('0x6d')])?moment()[_0x3d66('0x63')](_0x3d66('0x64')):undefined});}return null;})[_0x3d66('0x24')](function(_0x3802e7){if(_0x3802e7){_0x1c37e0[_0x3d66('0x6e')]=_0x3802e7[_0x3d66('0x68')]({'plain':!![]});interaction_log[_0x3d66('0x25')](_0x3d66('0x6f'),_0x2835a6[_0x3d66('0x66')]['id'],_0x2835a6[_0x3d66('0x66')]['name'],_0x2835a6['user'][_0x3d66('0x70')],_0x1c37e0[_0x3d66('0x6e')]['id'],_0x2835a6[_0x3d66('0x5c')]?JSON[_0x3d66('0x71')](_0x2835a6[_0x3d66('0x5c')]):_0x3d66('0x72'));return respondWithRpcPromise('AcceptMessage',_0x3d66('0x73'),_0x1c37e0);}return null;})[_0x3d66('0x24')](function(_0x56f3ac){var _0x49a612=_0x3d66('0x74')+_0x56f3ac[_0x3d66('0x2b')][_0x3d66('0x75')];return db[_0x3d66('0x76')]['query'](_0x49a612,{'type':db[_0x3d66('0x77')][_0x3d66('0x78')]['SELECT'],'raw':!![]})[_0x3d66('0x24')](function(_0x51b68f){return _0x51b68f;});})['then'](function(_0x4e92ae){if(_0x4e92ae){_0x1c37e0[_0x3d66('0x2b')]['contact']=_0x4e92ae[0x0];if(!_0x2835a6[_0x3d66('0x5c')]['UserId'])return;return db[_0x3d66('0x79')]['find']({'where':{'id':_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')],'role':_0x3d66('0x67')},'attributes':['id',_0x3d66('0x3a'),_0x3d66('0x7a'),_0x3d66('0x7b'),_0x3d66('0x7c')],'raw':!![]});}return null;})[_0x3d66('0x24')](function(_0x536110){if(!_0x536110)return null;_0x1c37e0[_0x3d66('0x2b')][_0x3d66('0x67')]=_0x536110;return _0x1c37e0;})[_0x3d66('0x24')](function(_0x2e8bff){if(_0x2e8bff){if(_0x2835a6['body'][_0x3d66('0x7d')]){_0x1c37e0[_0x3d66('0x2b')][_0x3d66('0x7e')]=util[_0x3d66('0x63')]('SIP/%s',_0x2835a6[_0x3d66('0x66')][_0x3d66('0x3a')]);_0x1c37e0[_0x3d66('0x2b')][_0x3d66('0x7f')]=_0x1c37e0[_0x3d66('0x7f')];_0x1c37e0['message'][_0x3d66('0x80')]=_0x1c37e0[_0x3d66('0x7f')];_0x1c37e0[_0x3d66('0x2b')][_0x3d66('0x81')]=_0x3d66('0x5f');return respondWithRpcPromise(_0x3d66('0x82'),_0x3d66('0x82'),{'event':'acceptmessage','message':_0x1c37e0[_0x3d66('0x2b')]},client9002)[_0x3d66('0x24')](function(){return _0x1c37e0;});}return _0x1c37e0;}return null;})[_0x3d66('0x24')](respondWithResult(_0x55404b,null))[_0x3d66('0x2c')](handleError(_0x55404b,null));};var interaction_log=require('../../config/logger')(_0x3d66('0x83'));exports[_0x3d66('0x36')]=function(_0x48e8a7,_0x348e25,_0x223c4d){var _0x5abedc={'agent':{},'channel':_0x3d66('0x60')};if(_0x48e8a7['body']['id']){delete _0x48e8a7[_0x3d66('0x5c')]['id'];}_0x48e8a7['body'][_0x3d66('0x65')]=_0x48e8a7[_0x3d66('0x5c')][_0x3d66('0x65')]||_0x48e8a7['user']['id'];_0x5abedc[_0x3d66('0x67')]['id']=_0x48e8a7[_0x3d66('0x5c')]['UserId'];return db[_0x3d66('0x3d')][_0x3d66('0x5a')]({'where':{'id':_0x48e8a7[_0x3d66('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x348e25,null))[_0x3d66('0x24')](function(_0x3d1ce9){if(_0x3d1ce9){_0x5abedc['message']=_0x3d1ce9[_0x3d66('0x68')]({'plain':!![]});return db[_0x3d66('0x69')]['find']({'where':{'id':_0x3d1ce9[_0x3d66('0x6a')]}});}return null;})[_0x3d66('0x24')](handleEntityNotFound(_0x348e25,null))[_0x3d66('0x24')](function(_0xc52ce3){if(_0xc52ce3){_0x5abedc['interaction']=_0xc52ce3[_0x3d66('0x68')]({'plain':!![]});interaction_log['info'](_0x3d66('0x84'),_0x48e8a7[_0x3d66('0x66')]['id'],_0x48e8a7[_0x3d66('0x66')]['name'],_0x48e8a7[_0x3d66('0x66')][_0x3d66('0x70')],_0x5abedc['interaction']['id'],_0x48e8a7[_0x3d66('0x5c')]?JSON[_0x3d66('0x71')](_0x48e8a7[_0x3d66('0x5c')]):_0x3d66('0x72'));return respondWithRpcPromise('RejectMessage',_0x3d66('0x85'),_0x5abedc);}return null;})['then'](function(_0x3f7f58){var _0x1efba0=_0x3d66('0x74')+_0x3f7f58[_0x3d66('0x2b')]['ContactId'];return db[_0x3d66('0x76')][_0x3d66('0x43')](_0x1efba0,{'type':db[_0x3d66('0x77')][_0x3d66('0x78')][_0x3d66('0x86')],'raw':!![]})[_0x3d66('0x24')](function(_0x52ce50){return _0x52ce50;});})[_0x3d66('0x24')](function(_0x2dd6ca){if(_0x2dd6ca){_0x5abedc[_0x3d66('0x2b')][_0x3d66('0x87')]=_0x2dd6ca[0x0];if(!_0x48e8a7[_0x3d66('0x5c')][_0x3d66('0x65')])return;return db[_0x3d66('0x79')][_0x3d66('0x5a')]({'where':{'id':_0x48e8a7[_0x3d66('0x5c')]['UserId'],'role':'agent'},'attributes':['id',_0x3d66('0x3a'),_0x3d66('0x7a'),_0x3d66('0x7b'),'internal'],'raw':!![]});}return null;})[_0x3d66('0x24')](function(_0x382cc3){if(!_0x382cc3)return null;_0x5abedc[_0x3d66('0x2b')][_0x3d66('0x67')]=_0x382cc3;return _0x5abedc;})[_0x3d66('0x24')](function(_0xb25418){if(_0xb25418){_0xb25418[_0x3d66('0x2b')][_0x3d66('0x7e')]=util[_0x3d66('0x63')](_0x3d66('0x88'),_0x48e8a7['user'][_0x3d66('0x3a')]);_0xb25418['message'][_0x3d66('0x7f')]=_0x5abedc[_0x3d66('0x7f')];_0xb25418[_0x3d66('0x2b')][_0x3d66('0x80')]=_0x5abedc[_0x3d66('0x7f')];_0xb25418['message'][_0x3d66('0x81')]=_0x3d66('0x36');respondWithRpcPromise(_0x3d66('0x82'),'EventManager',{'event':_0x3d66('0x89'),'message':_0xb25418[_0x3d66('0x2b')]},client9002);return _0x5abedc;}return null;})[_0x3d66('0x24')](respondWithResult(_0x348e25,null))['catch'](handleError(_0x348e25,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index cf6c5f0..b5ba092 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 _0xdf5c=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x315bb7,_0x344f3d){var _0x1f8e69=function(_0xf4ffaa){while(--_0xf4ffaa){_0x315bb7['push'](_0x315bb7['shift']());}};_0x1f8e69(++_0x344f3d);}(_0xdf5c,0x1b6));var _0xcdf5=function(_0x2d42dc,_0x483e9a){_0x2d42dc=_0x2d42dc-0x0;var _0x35ef17=_0xdf5c[_0x2d42dc];return _0x35ef17;};'use strict';var EventEmitter=require(_0xcdf5('0x0'));var OpenchannelMessage=require(_0xcdf5('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcdf5('0x2')](0x0);var events={'afterCreate':_0xcdf5('0x3'),'afterUpdate':'update','afterDestroy':_0xcdf5('0x4')};function emitEvent(_0x2dfa35){return function(_0x1e6dda,_0xc4bf1a,_0x504f2c){OpenchannelMessageEvents[_0xcdf5('0x5')](_0x2dfa35+':'+_0x1e6dda['id'],_0x1e6dda);OpenchannelMessageEvents[_0xcdf5('0x5')](_0x2dfa35,_0x1e6dda);_0x504f2c(null);};}for(var e in events){if(events[_0xcdf5('0x6')](e)){var event=events[e];OpenchannelMessage[_0xcdf5('0x7')](e,emitEvent(event));}}module[_0xcdf5('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xc8fd=['../../mysqldb','OpenchannelMessage','save','remove','emit','hook'];(function(_0xe42f,_0x78b996){var _0x29bde2=function(_0x2eeeec){while(--_0x2eeeec){_0xe42f['push'](_0xe42f['shift']());}};_0x29bde2(++_0x78b996);}(_0xc8fd,0x162));var _0xdc8f=function(_0x15847f,_0x3973b5){_0x15847f=_0x15847f-0x0;var _0x414c2f=_0xc8fd[_0x15847f];return _0x414c2f;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xdc8f('0x0'))['db'][_0xdc8f('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc8f('0x2'),'afterUpdate':'update','afterDestroy':_0xdc8f('0x3')};function emitEvent(_0x1cf42a){return function(_0x106091,_0x3117eb,_0x5285ba){OpenchannelMessageEvents[_0xdc8f('0x4')](_0x1cf42a+':'+_0x106091['id'],_0x106091);OpenchannelMessageEvents[_0xdc8f('0x4')](_0x1cf42a,_0x106091);_0x5285ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xdc8f('0x5')](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 a72dfe1..9aa4ca5 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 _0x0fe9=['utf8mb4','utf8mb4_unicode_ci','util','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','body','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally'];(function(_0x5178a0,_0x1c5596){var _0xfe7604=function(_0x170499){while(--_0x170499){_0x5178a0['push'](_0x5178a0['shift']());}};_0xfe7604(++_0x1c5596);}(_0x0fe9,0x95));var _0x90fe=function(_0x4e0fc6,_0x558c82){_0x4e0fc6=_0x4e0fc6-0x0;var _0x2afc49=_0x0fe9[_0x4e0fc6];return _0x2afc49;};'use strict';var _=require('lodash');var util=require(_0x90fe('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x90fe('0x1'));var BPromise=require('bluebird');var rp=require(_0x90fe('0x2'));var fs=require('fs');var path=require(_0x90fe('0x3'));var rimraf=require(_0x90fe('0x4'));var config=require(_0x90fe('0x5'));var attributes=require(_0x90fe('0x6'));module[_0x90fe('0x7')]=function(_0x12c685,_0x53e6df){return _0x12c685[_0x90fe('0x8')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x90fe('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7f830b,_0x4855b3,_0x4525b2){var _0xb8284b=_0x12c685[_0x90fe('0xa')];var _0x1ae402=_0x7f830b[_0x90fe('0xb')]({'plain':!![]});if(_0x1ae402[_0x90fe('0xc')][_0x90fe('0xd')]()==='in'||_0x1ae402[_0x90fe('0xc')][_0x90fe('0xd')]()==='out'&&!_0x1ae402[_0x90fe('0xe')]&&!_[_0x90fe('0xf')](_0x1ae402[_0x90fe('0x10')])){_0xb8284b[_0x90fe('0x11')][_0x90fe('0x12')]({'where':{'id':_0x1ae402[_0x90fe('0x13')]}})[_0x90fe('0x14')](function(_0x3763e8){if(_0x3763e8){_0x3763e8[_0x90fe('0x15')]({'lastMsgAt':_0x1ae402[_0x90fe('0x16')],'lastMsgDirection':_0x1ae402[_0x90fe('0xc')][_0x90fe('0xd')]()});}})[_0x90fe('0x17')](function(_0x523348){console[_0x90fe('0x18')](_0x523348);});}if(_0x1ae402['direction']===_0x90fe('0x19')&&!_0x1ae402[_0x90fe('0xe')]){var _0x3d7d34;_0xb8284b[_0x90fe('0x1a')][_0x90fe('0x1b')]()['then'](function(_0x2be6cb){return _0xb8284b['OpenchannelAccount'][_0x90fe('0x1c')]({'where':{'id':_0x1ae402[_0x90fe('0x1d')]},'include':[{'model':_0xb8284b[_0x90fe('0x11')],'as':_0x90fe('0x1e'),'where':{'id':_0x1ae402['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xb8284b[_0x90fe('0x1a')],'as':_0x90fe('0x1f'),'attributes':_[_0x90fe('0x20')](_0x2be6cb)}]}]});})[_0x90fe('0x14')](function(_0x18cd53){_0x3d7d34=_0x18cd53[_0x90fe('0xb')]({'plain':!![]});if(_0x3d7d34&&_0x3d7d34[_0x90fe('0x21')]){logger[_0x90fe('0x22')](_0x90fe('0x23'),_0x90fe('0x24'),util[_0x90fe('0x25')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x1ae402['id'],_0x3d7d34[_0x90fe('0x21')]));if(_0x3d7d34['Interactions']&&_0x3d7d34[_0x90fe('0x1e')]['length']){_0x1ae402[_0x90fe('0x26')]=_[_0x90fe('0x27')](_0x3d7d34[_0x90fe('0x1e')][0x0],'Contact');_0x1ae402[_0x90fe('0x1f')]=_0x3d7d34[_0x90fe('0x1e')][0x0][_0x90fe('0x1f')];}var _0x4855b3={'method':_0x90fe('0x28'),'uri':encodeURI(_0x3d7d34[_0x90fe('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4855b3[_0x90fe('0x29')]){case _0x90fe('0x2a'):_0x4855b3['qs']=_0x1ae402;break;case _0x90fe('0x28'):_0x4855b3['body']=_0x1ae402;break;}return rp(_0x4855b3)[_0x90fe('0x14')](function(_0x1514e0){logger[_0x90fe('0x22')](_0x90fe('0x23'),'afterCreate',util['format'](_0x90fe('0x2b'),_0x1ae402['id'],_0x3d7d34[_0x90fe('0x21')]));if(_0x1514e0[_0x90fe('0x9')]['threadId']&&_0x1514e0['body'][_0x90fe('0x2c')]!=_0x1ae402[_0x90fe('0x26')][_0x90fe('0x2c')]){return _0xb8284b['OpenchannelInteraction'][_0x90fe('0x15')]({'threadId':_0x1514e0['body']['threadId']},{'where':{'id':_0x1ae402[_0x90fe('0x26')]['id']}});}else{return;}})['then'](function(){return _0x7f830b['update']({'read':!![]});})['catch'](function(_0x16de51){logger[_0x90fe('0x18')](_0x90fe('0x23'),_0x90fe('0x24'),util[_0x90fe('0x2d')](_0x16de51,{'showHidden':![],'depth':null}));_0x4525b2();});}else{_0x4525b2();}})[_0x90fe('0x2e')](function(){_0x4525b2();});}else{_0x4525b2();}}},'charset':_0x90fe('0x2f'),'collate':_0x90fe('0x30')});}; \ No newline at end of file +var _0x88be=['replyUri','Interaction','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','utf8mb4','util','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','models','get','direction','toLowerCase','out','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x1e0a70,_0x9f8a2d){var _0x4635ea=function(_0x5c511f){while(--_0x5c511f){_0x1e0a70['push'](_0x1e0a70['shift']());}};_0x4635ea(++_0x9f8a2d);}(_0x88be,0x1d3));var _0xe88b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x88be[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0xe88b('0x0'));var logger=require(_0xe88b('0x1'))(_0xe88b('0x2'));var moment=require(_0xe88b('0x3'));var BPromise=require(_0xe88b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe88b('0x5'));var attributes=require(_0xe88b('0x6'));module[_0xe88b('0x7')]=function(_0x4c7e83,_0x5e8b47){return _0x4c7e83['define'](_0xe88b('0x8'),attributes,{'tableName':_0xe88b('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xe88b('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x236ba0,_0x2cb82c,_0x3b91cd){var _0x593c2=_0x4c7e83[_0xe88b('0xb')];var _0x1d7117=_0x236ba0[_0xe88b('0xc')]({'plain':!![]});if(_0x1d7117[_0xe88b('0xd')]['toLowerCase']()==='in'||_0x1d7117[_0xe88b('0xd')][_0xe88b('0xe')]()===_0xe88b('0xf')&&!_0x1d7117['secret']&&!_['isNil'](_0x1d7117[_0xe88b('0x10')])){_0x593c2[_0xe88b('0x11')][_0xe88b('0x12')]({'where':{'id':_0x1d7117[_0xe88b('0x13')]}})[_0xe88b('0x14')](function(_0x107b60){if(_0x107b60){_0x107b60[_0xe88b('0x15')]({'lastMsgAt':_0x1d7117[_0xe88b('0x16')],'lastMsgDirection':_0x1d7117['direction'][_0xe88b('0xe')]()});}})[_0xe88b('0x17')](function(_0x3c5db1){console[_0xe88b('0x18')](_0x3c5db1);});}if(_0x1d7117[_0xe88b('0xd')]===_0xe88b('0xf')&&!_0x1d7117[_0xe88b('0x19')]){var _0x2d83a0;_0x593c2[_0xe88b('0x1a')][_0xe88b('0x1b')]()[_0xe88b('0x14')](function(_0x2f410c){return _0x593c2[_0xe88b('0x1c')][_0xe88b('0x1d')]({'where':{'id':_0x1d7117[_0xe88b('0x1e')]},'include':[{'model':_0x593c2[_0xe88b('0x11')],'as':_0xe88b('0x1f'),'where':{'id':_0x1d7117[_0xe88b('0x13')]},'limit':0x1,'include':[{'model':_0x593c2[_0xe88b('0x1a')],'as':_0xe88b('0x20'),'attributes':_[_0xe88b('0x21')](_0x2f410c)}]}]});})[_0xe88b('0x14')](function(_0x20842f){_0x2d83a0=_0x20842f[_0xe88b('0xc')]({'plain':!![]});if(_0x2d83a0&&_0x2d83a0['replyUri']){logger[_0xe88b('0x22')](_0xe88b('0x23'),_0xe88b('0x24'),util[_0xe88b('0x25')](_0xe88b('0x26'),_0x1d7117['id'],_0x2d83a0[_0xe88b('0x27')]));if(_0x2d83a0[_0xe88b('0x1f')]&&_0x2d83a0[_0xe88b('0x1f')]['length']){_0x1d7117[_0xe88b('0x28')]=_['omit'](_0x2d83a0[_0xe88b('0x1f')][0x0],_0xe88b('0x20'));_0x1d7117[_0xe88b('0x20')]=_0x2d83a0[_0xe88b('0x1f')][0x0]['Contact'];}var _0x2cb82c={'method':'POST','uri':encodeURI(_0x2d83a0[_0xe88b('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2cb82c[_0xe88b('0x29')]){case'GET':_0x2cb82c['qs']=_0x1d7117;break;case'POST':_0x2cb82c[_0xe88b('0xa')]=_0x1d7117;break;}return rp(_0x2cb82c)[_0xe88b('0x14')](function(_0x472e94){logger[_0xe88b('0x22')](_0xe88b('0x23'),_0xe88b('0x24'),util[_0xe88b('0x25')](_0xe88b('0x2a'),_0x1d7117['id'],_0x2d83a0['replyUri']));if(_0x472e94[_0xe88b('0xa')][_0xe88b('0x2b')]&&_0x472e94['body'][_0xe88b('0x2b')]!=_0x1d7117[_0xe88b('0x28')][_0xe88b('0x2b')]){return _0x593c2[_0xe88b('0x11')][_0xe88b('0x15')]({'threadId':_0x472e94[_0xe88b('0xa')]['threadId']},{'where':{'id':_0x1d7117['Interaction']['id']}});}else{return;}})[_0xe88b('0x14')](function(){return _0x236ba0[_0xe88b('0x15')]({'read':!![]});})['catch'](function(_0x25d0c2){logger['error'](_0xe88b('0x23'),_0xe88b('0x24'),util['inspect'](_0x25d0c2,{'showHidden':![],'depth':null}));_0x3b91cd();});}else{_0x3b91cd();}})[_0xe88b('0x2c')](function(){_0x3b91cd();});}else{_0x3b91cd();}}},'charset':_0xe88b('0x2d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index e059a11..1854aee 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x56aee6,_0x3064cd){var _0x370785=function(_0x2587ff){while(--_0x2587ff){_0x56aee6['push'](_0x56aee6['shift']());}};_0x370785(++_0x3064cd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d901c,_0x558f63){_0x1d901c=_0x1d901c-0x0;var _0x4cc8a5=_0x5f2f[_0x1d901c];return _0x4cc8a5;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _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(_0x3ffd8d,_0x2eb8d1){var _0x433d2c=function(_0x1fde10){while(--_0x1fde10){_0x3ffd8d['push'](_0x3ffd8d['shift']());}};_0x433d2c(++_0x2eb8d1);}(_0x7a54,0x106));var _0x47a5=function(_0x40b06b,_0x1c3454){_0x40b06b=_0x40b06b-0x0;var _0x12f460=_0x7a54[_0x40b06b];return _0x12f460;};'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 9cb0ec8..82eedd6 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 _0xe14b=['removeListener','register','length','./openchannelMessage.events','save','emit'];(function(_0x426484,_0x1dcee1){var _0x55d1fb=function(_0x3fc187){while(--_0x3fc187){_0x426484['push'](_0x426484['shift']());}};_0x55d1fb(++_0x1dcee1);}(_0xe14b,0x93));var _0xbe14=function(_0x18eaba,_0x237f85){_0x18eaba=_0x18eaba-0x0;var _0x3727c5=_0xe14b[_0x18eaba];return _0x3727c5;};'use strict';var OpenchannelMessageEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){OpenchannelMessageEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('openchannelMessage:'+_0x196fca,_0x1fe204);OpenchannelMessageEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x7e47=['remove','update','register','length','openchannelMessage:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e47,0x19d));var _0x77e4=function(_0x3d0702,_0x472c90){_0x3d0702=_0x3d0702-0x0;var _0x867831=_0x7e47[_0x3d0702];return _0x867831;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x77e4('0x0'),_0x77e4('0x1'),_0x77e4('0x2')];function createListener(_0x279015,_0x1e515e){return function(_0x5efc5b){_0x1e515e['emit'](_0x279015,_0x5efc5b);};}function removeListener(_0x4aa69c,_0x3d61bd){return function(){OpenchannelMessageEvents['removeListener'](_0x4aa69c,_0x3d61bd);};}exports[_0x77e4('0x3')]=function(_0x2f5da1){for(var _0x5dda95=0x0,_0x599cc4=events[_0x77e4('0x4')];_0x5dda95<_0x599cc4;_0x5dda95++){var _0x346f6c=events[_0x5dda95];var _0x1766fe=createListener(_0x77e4('0x5')+_0x346f6c,_0x2f5da1);OpenchannelMessageEvents['on'](_0x346f6c,_0x1766fe);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 217df9a..e7cf4b2 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 _0x3e94=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','index','/describe','isAuthenticated','get','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0xdf6837,_0x440887){var _0x254cfa=function(_0x3bcbc2){while(--_0x3bcbc2){_0xdf6837['push'](_0xdf6837['shift']());}};_0x254cfa(++_0x440887);}(_0x3e94,0x1c0));var _0x43e9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3e94[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var path=require(_0x43e9('0x2'));var timeout=require(_0x43e9('0x3'));var express=require(_0x43e9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e9('0x5'));var interaction=require(_0x43e9('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x43e9('0x7')]);router['get'](_0x43e9('0x8'),auth[_0x43e9('0x9')](),controller['describe']);router[_0x43e9('0xa')](_0x43e9('0xb'),auth[_0x43e9('0x9')](),controller[_0x43e9('0xc')]);router['get']('/:id/members',auth[_0x43e9('0x9')](),controller['getMembers']);router[_0x43e9('0xa')](_0x43e9('0xd'),auth[_0x43e9('0x9')](),controller[_0x43e9('0xe')]);router[_0x43e9('0xa')](_0x43e9('0xf'),auth['isAuthenticated'](),controller[_0x43e9('0x10')]);router[_0x43e9('0x11')]('/',auth[_0x43e9('0x9')](),controller['create']);router[_0x43e9('0x11')](_0x43e9('0xd'),auth[_0x43e9('0x9')](),controller['addTeams']);router['post'](_0x43e9('0xf'),auth['isAuthenticated'](),controller[_0x43e9('0x12')]);router[_0x43e9('0x13')](_0x43e9('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x43e9('0xb'),auth[_0x43e9('0x9')](),controller[_0x43e9('0x14')]);router[_0x43e9('0x15')](_0x43e9('0xd'),auth[_0x43e9('0x9')](),controller[_0x43e9('0x16')]);router[_0x43e9('0x15')]('/:id/users',auth[_0x43e9('0x9')](),controller[_0x43e9('0x17')]);module[_0x43e9('0x18')]=router; \ No newline at end of file +var _0x2e3b=['/:id/teams','post','/:id/users','addAgents','put','/:id','update','destroy','delete','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers'];(function(_0x596615,_0x2fe9c4){var _0xd5b877=function(_0x3e7258){while(--_0x3e7258){_0x596615['push'](_0x596615['shift']());}};_0xd5b877(++_0x2fe9c4);}(_0x2e3b,0x1ba));var _0xb2e3=function(_0x23078c,_0x45658b){_0x23078c=_0x23078c-0x0;var _0x6e95bc=_0x2e3b[_0x23078c];return _0x6e95bc;};'use strict';var multer=require(_0xb2e3('0x0'));var util=require(_0xb2e3('0x1'));var path=require('path');var timeout=require(_0xb2e3('0x2'));var express=require(_0xb2e3('0x3'));var router=express[_0xb2e3('0x4')]();var fs_extra=require(_0xb2e3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb2e3('0x6'));var config=require(_0xb2e3('0x7'));var controller=require(_0xb2e3('0x8'));router[_0xb2e3('0x9')]('/',auth[_0xb2e3('0xa')](),controller[_0xb2e3('0xb')]);router[_0xb2e3('0x9')](_0xb2e3('0xc'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0xd')]);router[_0xb2e3('0x9')]('/:id',auth[_0xb2e3('0xa')](),controller[_0xb2e3('0xe')]);router[_0xb2e3('0x9')](_0xb2e3('0xf'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x10')]);router[_0xb2e3('0x9')](_0xb2e3('0x11'),auth[_0xb2e3('0xa')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xb2e3('0x12')]('/',auth[_0xb2e3('0xa')](),controller['create']);router[_0xb2e3('0x12')](_0xb2e3('0x11'),auth[_0xb2e3('0xa')](),controller['addTeams']);router[_0xb2e3('0x12')](_0xb2e3('0x13'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x14')]);router[_0xb2e3('0x15')](_0xb2e3('0x16'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x17')]);router['delete'](_0xb2e3('0x16'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x18')]);router[_0xb2e3('0x19')](_0xb2e3('0x11'),auth[_0xb2e3('0xa')](),controller['removeTeams']);router[_0xb2e3('0x19')]('/:id/users',auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index fde3d8a..7318626 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 _0x8e00=['roundrobin','sequelize','exports','name','rrmemory','beepall'];(function(_0x1c7de1,_0x194d70){var _0x40fbef=function(_0x552937){while(--_0x552937){_0x1c7de1['push'](_0x1c7de1['shift']());}};_0x40fbef(++_0x194d70);}(_0x8e00,0xa9));var _0x08e0=function(_0x3e8dac,_0x5aa4cb){_0x3e8dac=_0x3e8dac-0x0;var _0x2b8531=_0x8e00[_0x3e8dac];return _0x2b8531;};'use strict';var Sequelize=require(_0x08e0('0x0'));module[_0x08e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x08e0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x08e0('0x3'),_0x08e0('0x4'),_0x08e0('0x5'))}}; \ No newline at end of file +var _0x068e=['sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x41ba54,_0x5ce33e){var _0x4204d3=function(_0x5cc938){while(--_0x5cc938){_0x41ba54['push'](_0x41ba54['shift']());}};_0x4204d3(++_0x5ce33e);}(_0x068e,0x72));var _0xe068=function(_0x2d892d,_0x1a7264){_0x2d892d=_0x2d892d-0x0;var _0x569196=_0x068e[_0x2d892d];return _0x569196;};'use strict';var Sequelize=require(_0xe068('0x0'));module[_0xe068('0x1')]={'name':{'type':Sequelize[_0xe068('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe068('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe068('0x3')](_0xe068('0x4'),_0xe068('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 ab6c541..c0bd2ae 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 _0x20b1=['merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','each','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','get','UserProfileResource','destroy','then','end','stack','name','send','index','map','OpenchannelQueue','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x284240,_0x555b56){var _0x390667=function(_0x409454){while(--_0x409454){_0x284240['push'](_0x284240['shift']());}};_0x390667(++_0x555b56);}(_0x20b1,0x153));var _0x120b=function(_0x3220dd,_0x23f637){_0x3220dd=_0x3220dd-0x0;var _0x16526c=_0x20b1[_0x3220dd];return _0x16526c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x120b('0x0'));var jsonpatch=require(_0x120b('0x1'));var rp=require(_0x120b('0x2'));var moment=require(_0x120b('0x3'));var BPromise=require(_0x120b('0x4'));var Mustache=require(_0x120b('0x5'));var util=require(_0x120b('0x6'));var path=require(_0x120b('0x7'));var sox=require(_0x120b('0x8'));var csv=require(_0x120b('0x9'));var ejs=require(_0x120b('0xa'));var fs=require('fs');var fs_extra=require(_0x120b('0xb'));var _=require(_0x120b('0xc'));var squel=require(_0x120b('0xd'));var crypto=require(_0x120b('0xe'));var jsforce=require(_0x120b('0xf'));var deskjs=require(_0x120b('0x10'));var toCsv=require(_0x120b('0x9'));var querystring=require(_0x120b('0x11'));var Papa=require(_0x120b('0x12'));var Redis=require(_0x120b('0x13'));var authService=require(_0x120b('0x14'));var qs=require(_0x120b('0x15'));var as=require(_0x120b('0x16'));var hardwareService=require(_0x120b('0x17'));var logger=require(_0x120b('0x18'))(_0x120b('0x19'));var utils=require(_0x120b('0x1a'));var config=require(_0x120b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x120b('0x1c')]=_[_0x120b('0x1d')](config[_0x120b('0x1c')],{'host':_0x120b('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x120b('0x1c')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x4b89fe,_0x5704c3){_0x5704c3=_0x5704c3||0xcc;return function(_0x5c3441){if(_0x5c3441){return _0x4b89fe[_0x120b('0x1f')](_0x5704c3);}return _0x4b89fe[_0x120b('0x20')](_0x5704c3)['end']();};}function respondWithResult(_0x395d0f,_0x3b6b12){_0x3b6b12=_0x3b6b12||0xc8;return function(_0x798717){if(_0x798717){return _0x395d0f[_0x120b('0x20')](_0x3b6b12)[_0x120b('0x21')](_0x798717);}};}function respondWithFilteredResult(_0x4f744b,_0x2103f6){return function(_0x270592){if(_0x270592){var _0x1dff24=typeof _0x2103f6['offset']==='undefined'&&typeof _0x2103f6[_0x120b('0x22')]===_0x120b('0x23');var _0x1ea84c=_0x270592[_0x120b('0x24')];var _0xfc389a=_0x1dff24?0x0:_0x2103f6[_0x120b('0x25')];var _0x11824c=_0x1dff24?_0x270592[_0x120b('0x24')]:_0x2103f6[_0x120b('0x25')]+_0x2103f6[_0x120b('0x22')];var _0xcdbd06;if(_0x11824c>=_0x1ea84c){_0x11824c=_0x1ea84c;_0xcdbd06=0xc8;}else{_0xcdbd06=0xce;}_0x4f744b[_0x120b('0x20')](_0xcdbd06);return _0x4f744b[_0x120b('0x26')]('Content-Range',_0xfc389a+'-'+_0x11824c+'/'+_0x1ea84c)['json'](_0x270592);}return null;};}function patchUpdates(_0x2ad370){return function(_0x3e4ac6){try{jsonpatch[_0x120b('0x27')](_0x3e4ac6,_0x2ad370,!![]);}catch(_0x2d855c){return BPromise[_0x120b('0x28')](_0x2d855c);}return _0x3e4ac6[_0x120b('0x29')]();};}function saveUpdates(_0x268ce1,_0x3953e1){return function(_0x90909f){if(_0x90909f){return _0x90909f['update'](_0x268ce1)['then'](function(_0x3d9e20){return _0x3d9e20;});}return null;};}function removeEntity(_0x9b301b,_0x22da80){return function(_0xc25375){if(_0xc25375){return _0xc25375['destroy']()['then'](function(){var _0x334af1=_0xc25375[_0x120b('0x2a')]({'plain':!![]});var _0x58293e='OpenchannelQueues';return db[_0x120b('0x2b')][_0x120b('0x2c')]({'where':{'type':_0x58293e,'resourceId':_0x334af1['id']}})[_0x120b('0x2d')](function(){return _0xc25375;});})[_0x120b('0x2d')](function(){_0x9b301b['status'](0xcc)[_0x120b('0x2e')]();});}};}function handleEntityNotFound(_0x234226,_0x3312db){return function(_0x1c6c3e){if(!_0x1c6c3e){_0x234226[_0x120b('0x1f')](0x194);}return _0x1c6c3e;};}function handleError(_0xaf3e04,_0x53e510){_0x53e510=_0x53e510||0x1f4;return function(_0x2c78d1){logger['error'](_0x2c78d1[_0x120b('0x2f')]);if(_0x2c78d1[_0x120b('0x30')]){delete _0x2c78d1[_0x120b('0x30')];}_0xaf3e04[_0x120b('0x20')](_0x53e510)[_0x120b('0x31')](_0x2c78d1);};}exports[_0x120b('0x32')]=function(_0x5cb701,_0x4fdf89){var _0x39046a={},_0x572772={},_0x591e08={'count':0x0,'rows':[]};var _0x4d3dce=_[_0x120b('0x33')](db[_0x120b('0x34')]['rawAttributes'],function(_0x22bb58){return{'name':_0x22bb58['fieldName'],'type':_0x22bb58[_0x120b('0x35')]['key']};});_0x572772[_0x120b('0x36')]=_[_0x120b('0x33')](_0x4d3dce,'name');_0x572772['query']=_[_0x120b('0x37')](_0x5cb701[_0x120b('0x38')]);_0x572772[_0x120b('0x39')]=_[_0x120b('0x3a')](_0x572772[_0x120b('0x36')],_0x572772[_0x120b('0x38')]);_0x39046a['attributes']=_[_0x120b('0x3a')](_0x572772['model'],qs[_0x120b('0x3b')](_0x5cb701[_0x120b('0x38')][_0x120b('0x3b')]));_0x39046a[_0x120b('0x3c')]=_0x39046a[_0x120b('0x3c')][_0x120b('0x3d')]?_0x39046a[_0x120b('0x3c')]:_0x572772['model'];if(!_0x5cb701[_0x120b('0x38')][_0x120b('0x3e')](_0x120b('0x3f'))){_0x39046a[_0x120b('0x22')]=qs[_0x120b('0x22')](_0x5cb701[_0x120b('0x38')][_0x120b('0x22')]);_0x39046a['offset']=qs[_0x120b('0x25')](_0x5cb701[_0x120b('0x38')]['offset']);}_0x39046a[_0x120b('0x40')]=qs[_0x120b('0x41')](_0x5cb701['query'][_0x120b('0x41')]);_0x39046a[_0x120b('0x42')]=qs['filters'](_[_0x120b('0x43')](_0x5cb701[_0x120b('0x38')],_0x572772[_0x120b('0x39')]),_0x4d3dce);if(_0x5cb701[_0x120b('0x38')][_0x120b('0x44')]){_0x39046a[_0x120b('0x42')]=_[_0x120b('0x45')](_0x39046a['where'],{'$or':_[_0x120b('0x33')](_0x4d3dce,function(_0x2d9440){if(_0x2d9440[_0x120b('0x35')]!==_0x120b('0x46')){var _0x5547c6={};_0x5547c6[_0x2d9440['name']]={'$like':'%'+_0x5cb701['query']['filter']+'%'};return _0x5547c6;}})});}_0x39046a=_['merge']({},_0x39046a,_0x5cb701[_0x120b('0x47')]);var _0x688c3d={'where':_0x39046a[_0x120b('0x42')]};return db['OpenchannelQueue']['count'](_0x688c3d)[_0x120b('0x2d')](function(_0x186bea){_0x591e08['count']=_0x186bea;if(_0x5cb701[_0x120b('0x38')][_0x120b('0x48')]){_0x39046a['include']=[{'all':!![]}];}return db[_0x120b('0x34')][_0x120b('0x49')](_0x39046a);})[_0x120b('0x2d')](function(_0x18d594){_0x591e08[_0x120b('0x4a')]=_0x18d594;return _0x591e08;})[_0x120b('0x2d')](respondWithFilteredResult(_0x4fdf89,_0x39046a))[_0x120b('0x4b')](handleError(_0x4fdf89,null));};exports['show']=function(_0x361366,_0x196ba9){var _0x3d9fa1={'raw':!![],'where':{'id':_0x361366[_0x120b('0x4c')]['id']}},_0x5501fb={};_0x5501fb['model']=_[_0x120b('0x37')](db[_0x120b('0x34')][_0x120b('0x4d')]);_0x5501fb[_0x120b('0x38')]=_['keys'](_0x361366[_0x120b('0x38')]);_0x5501fb[_0x120b('0x39')]=_['intersection'](_0x5501fb['model'],_0x5501fb[_0x120b('0x38')]);_0x3d9fa1['attributes']=_[_0x120b('0x3a')](_0x5501fb['model'],qs[_0x120b('0x3b')](_0x361366[_0x120b('0x38')]['fields']));_0x3d9fa1[_0x120b('0x3c')]=_0x3d9fa1[_0x120b('0x3c')]['length']?_0x3d9fa1[_0x120b('0x3c')]:_0x5501fb['model'];if(_0x361366[_0x120b('0x38')][_0x120b('0x48')]){_0x3d9fa1[_0x120b('0x4e')]=[{'all':!![]}];}_0x3d9fa1=_[_0x120b('0x45')]({},_0x3d9fa1,_0x361366[_0x120b('0x47')]);return db[_0x120b('0x34')][_0x120b('0x4f')](_0x3d9fa1)[_0x120b('0x2d')](handleEntityNotFound(_0x196ba9,null))[_0x120b('0x2d')](respondWithResult(_0x196ba9,null))[_0x120b('0x4b')](handleError(_0x196ba9,null));};exports['create']=function(_0x1637ba,_0x136a3d){return db['OpenchannelQueue'][_0x120b('0x50')](_0x1637ba[_0x120b('0x51')],{})[_0x120b('0x2d')](function(_0x2a67df){var _0x2e161f=_0x1637ba[_0x120b('0x52')][_0x120b('0x2a')]({'plain':!![]});if(!_0x2e161f)throw new Error(_0x120b('0x53'));if(_0x2e161f['role']===_0x120b('0x52')){var _0x199ef2=_0x2a67df['get']({'plain':!![]});var _0x1f2595='OpenchannelQueues';return db[_0x120b('0x54')]['find']({'where':{'name':_0x1f2595,'userProfileId':_0x2e161f[_0x120b('0x55')]},'raw':!![]})['then'](function(_0x20d6da){if(_0x20d6da&&_0x20d6da[_0x120b('0x56')]===0x0){return db[_0x120b('0x2b')][_0x120b('0x50')]({'name':_0x199ef2[_0x120b('0x30')],'resourceId':_0x199ef2['id'],'type':_0x20d6da[_0x120b('0x30')],'sectionId':_0x20d6da['id']},{})[_0x120b('0x2d')](function(){return _0x2a67df;});}else{return _0x2a67df;}})['catch'](function(_0xe0139d){logger['error'](_0x120b('0x57'),_0xe0139d);throw _0xe0139d;});}return _0x2a67df;})[_0x120b('0x2d')](respondWithResult(_0x136a3d,0xc9))['catch'](handleError(_0x136a3d,null));};exports['update']=function(_0x3c615b,_0x587faf){if(_0x3c615b[_0x120b('0x51')]['id']){delete _0x3c615b[_0x120b('0x51')]['id'];}return db[_0x120b('0x34')][_0x120b('0x4f')]({'where':{'id':_0x3c615b['params']['id']}})[_0x120b('0x2d')](handleEntityNotFound(_0x587faf,null))['then'](saveUpdates(_0x3c615b[_0x120b('0x51')],null))[_0x120b('0x2d')](respondWithResult(_0x587faf,null))[_0x120b('0x4b')](handleError(_0x587faf,null));};exports[_0x120b('0x2c')]=function(_0x1cb3a3,_0x182929){return db['OpenchannelQueue'][_0x120b('0x4f')]({'where':{'id':_0x1cb3a3[_0x120b('0x4c')]['id']}})[_0x120b('0x2d')](handleEntityNotFound(_0x182929,null))[_0x120b('0x2d')](removeEntity(_0x182929,null))[_0x120b('0x4b')](handleError(_0x182929,null));};exports[_0x120b('0x58')]=function(_0x23401e,_0x4d2678){return db[_0x120b('0x34')][_0x120b('0x58')]()['then'](respondWithResult(_0x4d2678,null))[_0x120b('0x4b')](handleError(_0x4d2678,null));};exports['getMembers']=function(_0x2f5fc9,_0x4c5ac2,_0xf9b927){var _0x130a4d={'raw':!![],'where':{}},_0x98b182={},_0x44af3f;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2f5fc9[_0x120b('0x4c')]['id']}})[_0x120b('0x2d')](handleEntityNotFound(_0x4c5ac2,null))[_0x120b('0x2d')](function(_0x3af023){if(_0x3af023){_0x44af3f=_0x3af023[_0x120b('0x2a')]({'plain':!![]});_0x98b182['model']=_[_0x120b('0x37')](db['UserOpenchannelQueue']['rawAttributes']);_0x98b182[_0x120b('0x38')]=_[_0x120b('0x37')](_0x2f5fc9[_0x120b('0x38')]);_0x98b182[_0x120b('0x39')]=_[_0x120b('0x3a')](_0x98b182['model'],_0x98b182['query']);_0x130a4d[_0x120b('0x3c')]=_[_0x120b('0x3a')](_0x98b182[_0x120b('0x36')],qs[_0x120b('0x3b')](_0x2f5fc9[_0x120b('0x38')][_0x120b('0x3b')]));_0x130a4d[_0x120b('0x3c')]=_0x130a4d[_0x120b('0x3c')][_0x120b('0x3d')]?_0x130a4d[_0x120b('0x3c')]:_0x98b182[_0x120b('0x36')];if(!_0x2f5fc9['query'][_0x120b('0x3e')](_0x120b('0x3f'))){_0x130a4d['limit']=qs['limit'](_0x2f5fc9[_0x120b('0x38')]['limit']);_0x130a4d['offset']=qs[_0x120b('0x25')](_0x2f5fc9['query'][_0x120b('0x25')]);}_0x130a4d[_0x120b('0x40')]=qs[_0x120b('0x41')](_0x2f5fc9[_0x120b('0x38')][_0x120b('0x41')]);_0x130a4d[_0x120b('0x42')]=qs[_0x120b('0x39')](_[_0x120b('0x43')](_0x2f5fc9[_0x120b('0x38')],_0x98b182[_0x120b('0x39')]));_0x130a4d['where']['OpenchannelQueueId']=_0x3af023['id'];if(_0x2f5fc9[_0x120b('0x38')]['filter']){_0x130a4d[_0x120b('0x42')]=_[_0x120b('0x45')](_0x130a4d[_0x120b('0x42')],{'$or':_[_0x120b('0x33')](_0x130a4d[_0x120b('0x3c')],function(_0x58335){var _0xf8828={};_0xf8828[_0x58335]={'$like':'%'+_0x2f5fc9[_0x120b('0x38')][_0x120b('0x44')]+'%'};return _0xf8828;})});}_0x130a4d=_[_0x120b('0x45')]({},_0x130a4d,_0x2f5fc9[_0x120b('0x47')]);return db[_0x120b('0x59')][_0x120b('0x49')](_0x130a4d);}})[_0x120b('0x2d')](function(_0x147337){if(_0x147337){return db[_0x120b('0x5a')][_0x120b('0x5b')]({'where':{'id':_[_0x120b('0x33')](_0x147337,_0x120b('0x5c')),'role':_0x120b('0x5d')},'attributes':['id',_0x120b('0x30'),_0x120b('0x5e'),_0x120b('0x5f'),_0x120b('0x60')]});}})[_0x120b('0x2d')](function(_0x3e1126){if(_0x3e1126){return{'count':_0x3e1126[_0x120b('0x24')],'rows':_[_0x120b('0x33')](_0x3e1126['rows'],function(_0x4a7f67){return{'membername':_0x4a7f67[_0x120b('0x30')],'UserId':_0x4a7f67['id'],'queue_name':_0x44af3f[_0x120b('0x30')],'OpenchannelQueueId':_0x44af3f['id'],'interface':util['format'](_0x120b('0x61'),_0x120b('0x62'),_0x4a7f67[_0x120b('0x30')]),'penalty':0x0,'paused':_0x4a7f67[_0x120b('0x5e')],'createdAt':_0x4a7f67['createdAt'],'updatedAt':_0x4a7f67[_0x120b('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x120b('0x2d')](respondWithFilteredResult(_0x4c5ac2,_0x130a4d))['catch'](handleError(_0x4c5ac2,null));};exports[_0x120b('0x63')]=function(_0x4352ee,_0x29b2aa,_0x529859){var _0x5b5d38={};var _0x2fb59c={};var _0x7582b8;var _0x2e1595;return db[_0x120b('0x34')][_0x120b('0x64')]({'where':{'id':_0x4352ee[_0x120b('0x4c')]['id']}})[_0x120b('0x2d')](handleEntityNotFound(_0x29b2aa,null))['then'](function(_0x3ee50b){if(_0x3ee50b){_0x7582b8=_0x3ee50b;_0x2fb59c[_0x120b('0x36')]=_[_0x120b('0x37')](db[_0x120b('0x65')]['rawAttributes']);_0x2fb59c['query']=_[_0x120b('0x37')](_0x4352ee[_0x120b('0x38')]);_0x2fb59c[_0x120b('0x39')]=_[_0x120b('0x3a')](_0x2fb59c[_0x120b('0x36')],_0x2fb59c[_0x120b('0x38')]);_0x5b5d38['attributes']=_['intersection'](_0x2fb59c['model'],qs['fields'](_0x4352ee[_0x120b('0x38')][_0x120b('0x3b')]));_0x5b5d38[_0x120b('0x3c')]=_0x5b5d38[_0x120b('0x3c')][_0x120b('0x3d')]?_0x5b5d38[_0x120b('0x3c')]:_0x2fb59c['model'];_0x5b5d38[_0x120b('0x40')]=qs[_0x120b('0x41')](_0x4352ee[_0x120b('0x38')][_0x120b('0x41')]);_0x5b5d38[_0x120b('0x42')]=qs[_0x120b('0x39')](_['pick'](_0x4352ee[_0x120b('0x38')],_0x2fb59c['filters']));if(_0x4352ee['query'][_0x120b('0x44')]){_0x5b5d38[_0x120b('0x42')]=_[_0x120b('0x45')](_0x5b5d38['where'],{'$or':_[_0x120b('0x33')](_0x5b5d38['attributes'],function(_0x4c7c2d){var _0x1b5eb1={};_0x1b5eb1[_0x4c7c2d]={'$like':'%'+_0x4352ee[_0x120b('0x38')][_0x120b('0x44')]+'%'};return _0x1b5eb1;})});}_0x5b5d38=_['merge']({},_0x5b5d38,_0x4352ee['options']);return _0x7582b8['getTeams'](_0x5b5d38);}})['then'](function(_0x1019cb){if(_0x1019cb){_0x2e1595=_0x1019cb['length'];if(!_0x4352ee[_0x120b('0x38')][_0x120b('0x3e')]('nolimit')){_0x5b5d38[_0x120b('0x22')]=qs[_0x120b('0x22')](_0x4352ee[_0x120b('0x38')][_0x120b('0x22')]);_0x5b5d38['offset']=qs['offset'](_0x4352ee['query'][_0x120b('0x25')]);}return _0x7582b8[_0x120b('0x63')](_0x5b5d38);}})[_0x120b('0x2d')](function(_0x16dc89){if(_0x16dc89){return _0x16dc89?{'count':_0x2e1595,'rows':_0x16dc89}:null;}})['then'](respondWithResult(_0x29b2aa,null))['catch'](handleError(_0x29b2aa,null));};exports[_0x120b('0x66')]=function(_0x12a426,_0x48db7b,_0x78b936){var _0x4b6850=_0x12a426['body'][_0x120b('0x67')];return db[_0x120b('0x65')][_0x120b('0x49')]({'where':{'id':_0x4b6850},'attributes':['id'],'include':[{'model':db['User'],'as':_0x120b('0x68'),'attributes':['id',_0x120b('0x30'),'online',_0x120b('0x69'),'interface'],'raw':!![]}]})[_0x120b('0x2d')](function(_0x102c36){if(_0x102c36){var _0x9d585c=_[_0x120b('0x6a')](_0x102c36,function(_0x558a59){var _0x38ed40=_0x558a59['get']({'plain':!![]});return _0x38ed40['Agents'];});return db['OpenchannelQueue'][_0x120b('0x4f')]({'where':{'id':_0x12a426[_0x120b('0x4c')]['id']}})[_0x120b('0x2d')](function(_0x46b592){return db[_0x120b('0x6b')][_0x120b('0x6c')](function(_0x430f94){return _0x46b592['addTeams'](_0x4b6850,{'transaction':_0x430f94})[_0x120b('0x2d')](function(){return BPromise[_0x120b('0x6d')](_0x9d585c,function(_0x25b4f0){return db[_0x120b('0x59')]['findOrCreate']({'where':{'UserId':_0x25b4f0['id'],'OpenchannelQueueId':_0x12a426[_0x120b('0x4c')]['id']},'transaction':_0x430f94});});})[_0x120b('0x2d')](function(){_0x9d585c['forEach'](function(_0x3bfaa5){socket[_0x120b('0x6e')](_0x120b('0x6f'),{'UserId':_0x3bfaa5['id'],'OpenchannelQueueId':_0x46b592['id']});});});});});}})[_0x120b('0x2d')](respondWithStatusCode(_0x48db7b,null))[_0x120b('0x4b')](handleError(_0x48db7b,null));};exports[_0x120b('0x70')]=function(_0x2794e3,_0x42d4ca,_0x2e9f3c){return db[_0x120b('0x65')][_0x120b('0x49')]({'where':{'id':_0x2794e3[_0x120b('0x38')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x120b('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x42d4ca,null))['then'](function(_0x3e8358){var _0x4a035b=_[_0x120b('0x33')](_0x3e8358,'id');var _0x53a72c=[];var _0x56cf0c=[];var _0x590711=squel[_0x120b('0x71')]();_0x590711[_0x120b('0x72')](_0x120b('0x73'))[_0x120b('0x74')]('team_has_openchannel_queues','tq')['join'](_0x120b('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x120b('0x42')](_0x120b('0x76'),_0x2794e3[_0x120b('0x4c')]['id']);for(var _0x422812=0x0;_0x422812<_0x3e8358[_0x120b('0x3d')];_0x422812+=0x1){let _0x49d109=_0x3e8358[_0x422812];for(var _0x8f684c=0x0;_0x8f684c<_0x49d109[_0x120b('0x68')][_0x120b('0x3d')];_0x8f684c+=0x1){let _0x510bf7=_0x49d109[_0x120b('0x68')][_0x8f684c];var _0x378c33=_0x590711['clone']();_0x378c33[_0x120b('0x42')](_0x120b('0x77'),_0x510bf7['id']);_0x56cf0c['push'](db[_0x120b('0x6b')][_0x120b('0x38')](_0x378c33[_0x120b('0x78')](),{'type':db[_0x120b('0x6b')][_0x120b('0x79')][_0x120b('0x7a')]})['then'](function(_0x57db36){if(_0x57db36['length']===0x1){return _0x510bf7['id'];}else{var _0x3e1ac0=_['every'](_['map'](_0x57db36,_0x120b('0x7b')),function(_0x57ae1e){return _[_0x120b('0x7c')](_0x4a035b,_0x57ae1e);});if(_0x3e1ac0){return _0x510bf7['id'];}}}));}}return BPromise[_0x120b('0x7d')](_0x56cf0c)[_0x120b('0x2d')](function(_0x2286a1){_0x53a72c=_(_0x53a72c)[_0x120b('0x7e')](_0x2286a1)[_0x120b('0x7f')]()[_0x120b('0x80')]();return db[_0x120b('0x34')][_0x120b('0x4f')]({'where':{'id':_0x2794e3[_0x120b('0x4c')]['id']}})[_0x120b('0x2d')](function(_0x24a590){return db[_0x120b('0x6b')][_0x120b('0x6c')](function(_0x2cf95c){return _0x24a590[_0x120b('0x70')](_0x2794e3[_0x120b('0x38')]['ids'],{'transaction':_0x2cf95c})[_0x120b('0x2d')](function(){if(!_['isEmpty'](_0x53a72c)){return _0x24a590[_0x120b('0x81')](_0x53a72c,{'transaction':_0x2cf95c});}})[_0x120b('0x2d')](function(){_0x53a72c['forEach'](function(_0x4473c5){socket[_0x120b('0x6e')](_0x120b('0x82'),{'UserId':_0x4473c5,'OpenchannelQueueId':_0x24a590['id']});});});});});});})[_0x120b('0x2d')](respondWithStatusCode(_0x42d4ca,null))[_0x120b('0x4b')](handleError(_0x42d4ca,null));};exports[_0x120b('0x83')]=function(_0x10a8de,_0x2a2bfe,_0x31e2eb){return db[_0x120b('0x34')][_0x120b('0x4f')]({'where':{'id':_0x10a8de[_0x120b('0x4c')]['id']}})[_0x120b('0x2d')](handleEntityNotFound(_0x2a2bfe,null))[_0x120b('0x2d')](function(_0x134fb5){if(_0x134fb5){return _0x134fb5[_0x120b('0x83')](_0x10a8de[_0x120b('0x51')]['ids'],_[_0x120b('0x84')](_0x10a8de[_0x120b('0x51')],['ids','id'])||{})[_0x120b('0x85')](function(_0x4e8295){for(var _0x5f2382=0x0;_0x5f2382<_0x10a8de[_0x120b('0x51')][_0x120b('0x67')]['length'];_0x5f2382+=0x1){socket[_0x120b('0x6e')]('userOpenchannelQueue:save',{'UserId':Number(_0x10a8de['body']['ids'][_0x5f2382]),'OpenchannelQueueId':Number(_0x10a8de['params']['id'])});}return _0x4e8295;});}})[_0x120b('0x2d')](respondWithResult(_0x2a2bfe,null))[_0x120b('0x4b')](handleError(_0x2a2bfe,null));};exports['removeAgents']=function(_0x4852dd,_0x3c3a0a,_0x1bd208){return db['OpenchannelQueue']['find']({'where':{'id':_0x4852dd[_0x120b('0x4c')]['id']}})[_0x120b('0x2d')](handleEntityNotFound(_0x3c3a0a,null))['then'](function(_0x1f06f9){if(_0x1f06f9){return _0x1f06f9['removeAgents'](_0x4852dd[_0x120b('0x38')][_0x120b('0x67')])[_0x120b('0x2d')](function(){if(_[_0x120b('0x86')](_0x4852dd[_0x120b('0x38')]['ids'])){for(var _0x3888b6=0x0;_0x3888b6<_0x4852dd['query']['ids'][_0x120b('0x3d')];_0x3888b6+=0x1){socket[_0x120b('0x6e')](_0x120b('0x82'),{'UserId':Number(_0x4852dd[_0x120b('0x38')]['ids'][_0x3888b6]),'OpenchannelQueueId':Number(_0x4852dd[_0x120b('0x4c')]['id'])});}}else{socket[_0x120b('0x6e')](_0x120b('0x82'),{'UserId':Number(_0x4852dd[_0x120b('0x38')][_0x120b('0x67')]),'OpenchannelQueueId':Number(_0x4852dd[_0x120b('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c3a0a,null))[_0x120b('0x4b')](handleError(_0x3c3a0a,null));};exports[_0x120b('0x87')]=function(_0x44ce23,_0x330ac0,_0x4f15d8){var _0x2564cc={};var _0xa3ab51={};var _0xb2fcb9;var _0x1a520a;return db[_0x120b('0x34')][_0x120b('0x64')]({'where':{'id':_0x44ce23[_0x120b('0x4c')]['id']}})[_0x120b('0x2d')](handleEntityNotFound(_0x330ac0,null))['then'](function(_0x448e86){if(_0x448e86){_0xb2fcb9=_0x448e86;_0xa3ab51[_0x120b('0x36')]=_[_0x120b('0x37')](db['User'][_0x120b('0x4d')]);_0xa3ab51[_0x120b('0x38')]=_[_0x120b('0x37')](_0x44ce23[_0x120b('0x38')]);_0xa3ab51[_0x120b('0x39')]=_[_0x120b('0x3a')](_0xa3ab51[_0x120b('0x36')],_0xa3ab51[_0x120b('0x38')]);_0x2564cc[_0x120b('0x3c')]=_[_0x120b('0x3a')](_0xa3ab51[_0x120b('0x36')],qs[_0x120b('0x3b')](_0x44ce23[_0x120b('0x38')]['fields']));_0x2564cc[_0x120b('0x3c')]=_0x2564cc['attributes'][_0x120b('0x3d')]?_0x2564cc[_0x120b('0x3c')]:_0xa3ab51[_0x120b('0x36')];_0x2564cc['order']=qs[_0x120b('0x41')](_0x44ce23['query'][_0x120b('0x41')]);_0x2564cc['where']=qs[_0x120b('0x39')](_[_0x120b('0x43')](_0x44ce23['query'],_0xa3ab51[_0x120b('0x39')]));if(_0x44ce23[_0x120b('0x38')][_0x120b('0x44')]){_0x2564cc['where']=_[_0x120b('0x45')](_0x2564cc[_0x120b('0x42')],{'$or':_[_0x120b('0x33')](_0x2564cc[_0x120b('0x3c')],function(_0x3b29a9){var _0x56b299={};_0x56b299[_0x3b29a9]={'$like':'%'+_0x44ce23[_0x120b('0x38')][_0x120b('0x44')]+'%'};return _0x56b299;})});}_0x2564cc=_[_0x120b('0x45')]({},_0x2564cc,_0x44ce23[_0x120b('0x47')]);return _0xb2fcb9['getAgents'](_0x2564cc);}})[_0x120b('0x2d')](function(_0x5d6cf6){if(_0x5d6cf6){_0x1a520a=_0x5d6cf6[_0x120b('0x3d')];if(!_0x44ce23['query'][_0x120b('0x3e')](_0x120b('0x3f'))){_0x2564cc[_0x120b('0x22')]=qs[_0x120b('0x22')](_0x44ce23[_0x120b('0x38')][_0x120b('0x22')]);_0x2564cc['offset']=qs[_0x120b('0x25')](_0x44ce23[_0x120b('0x38')][_0x120b('0x25')]);}return _0xb2fcb9['getAgents'](_0x2564cc);}})[_0x120b('0x2d')](function(_0x4a7dfa){if(_0x4a7dfa){return _0x4a7dfa?{'count':_0x1a520a,'rows':_0x4a7dfa}:null;}})[_0x120b('0x2d')](respondWithResult(_0x330ac0,null))[_0x120b('0x4b')](handleError(_0x330ac0,null));}; \ No newline at end of file +var _0xe5a9=['model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','merge','VIRTUAL','filter','options','where','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserOpenchannelQueue','nolimit','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','online','interface','flatMap','Agents','params','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','omit','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','save','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key'];(function(_0x3406c1,_0x8d3121){var _0x3dd6df=function(_0x2ecb00){while(--_0x2ecb00){_0x3406c1['push'](_0x3406c1['shift']());}};_0x3dd6df(++_0x8d3121);}(_0xe5a9,0x16b));var _0x9e5a=function(_0x27097a,_0x1b7f8b){_0x27097a=_0x27097a-0x0;var _0x26378b=_0xe5a9[_0x27097a];return _0x26378b;};'use strict';var emlformat=require(_0x9e5a('0x0'));var rimraf=require(_0x9e5a('0x1'));var zipdir=require(_0x9e5a('0x2'));var jsonpatch=require(_0x9e5a('0x3'));var rp=require(_0x9e5a('0x4'));var moment=require('moment');var BPromise=require(_0x9e5a('0x5'));var Mustache=require('mustache');var util=require(_0x9e5a('0x6'));var path=require(_0x9e5a('0x7'));var sox=require('sox');var csv=require(_0x9e5a('0x8'));var ejs=require(_0x9e5a('0x9'));var fs=require('fs');var fs_extra=require(_0x9e5a('0xa'));var _=require(_0x9e5a('0xb'));var squel=require(_0x9e5a('0xc'));var crypto=require(_0x9e5a('0xd'));var jsforce=require(_0x9e5a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9e5a('0x8'));var querystring=require('querystring');var Papa=require(_0x9e5a('0xf'));var Redis=require(_0x9e5a('0x10'));var authService=require(_0x9e5a('0x11'));var qs=require(_0x9e5a('0x12'));var as=require(_0x9e5a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e5a('0x14'))(_0x9e5a('0x15'));var utils=require(_0x9e5a('0x16'));var config=require(_0x9e5a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e5a('0x18'))['db'];config[_0x9e5a('0x19')]=_['defaults'](config[_0x9e5a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e5a('0x1a'))(new Redis(config[_0x9e5a('0x19')]));require('./openchannelQueue.socket')[_0x9e5a('0x1b')](socket);function respondWithStatusCode(_0x4265a2,_0xb6517){_0xb6517=_0xb6517||0xcc;return function(_0x3fef40){if(_0x3fef40){return _0x4265a2[_0x9e5a('0x1c')](_0xb6517);}return _0x4265a2['status'](_0xb6517)[_0x9e5a('0x1d')]();};}function respondWithResult(_0x308684,_0xe2eadc){_0xe2eadc=_0xe2eadc||0xc8;return function(_0x38c676){if(_0x38c676){return _0x308684[_0x9e5a('0x1e')](_0xe2eadc)[_0x9e5a('0x1f')](_0x38c676);}};}function respondWithFilteredResult(_0xc55663,_0x18535c){return function(_0x2549aa){if(_0x2549aa){var _0x48de03=typeof _0x18535c[_0x9e5a('0x20')]==='undefined'&&typeof _0x18535c[_0x9e5a('0x21')]==='undefined';var _0x3f8972=_0x2549aa[_0x9e5a('0x22')];var _0x4e023f=_0x48de03?0x0:_0x18535c[_0x9e5a('0x20')];var _0x3e8192=_0x48de03?_0x2549aa['count']:_0x18535c[_0x9e5a('0x20')]+_0x18535c['limit'];var _0x29a251;if(_0x3e8192>=_0x3f8972){_0x3e8192=_0x3f8972;_0x29a251=0xc8;}else{_0x29a251=0xce;}_0xc55663[_0x9e5a('0x1e')](_0x29a251);return _0xc55663['set'](_0x9e5a('0x23'),_0x4e023f+'-'+_0x3e8192+'/'+_0x3f8972)['json'](_0x2549aa);}return null;};}function patchUpdates(_0x10d1f1){return function(_0x60df8){try{jsonpatch[_0x9e5a('0x24')](_0x60df8,_0x10d1f1,!![]);}catch(_0x49a348){return BPromise['reject'](_0x49a348);}return _0x60df8[_0x9e5a('0x25')]();};}function saveUpdates(_0x3fcbd0,_0x4f86f1){return function(_0x30505b){if(_0x30505b){return _0x30505b[_0x9e5a('0x26')](_0x3fcbd0)['then'](function(_0x943cc4){return _0x943cc4;});}return null;};}function removeEntity(_0x6710cb,_0x130c4a){return function(_0x46d71a){if(_0x46d71a){return _0x46d71a[_0x9e5a('0x27')]()[_0x9e5a('0x28')](function(){var _0x3c68a1=_0x46d71a[_0x9e5a('0x29')]({'plain':!![]});var _0x460fe4=_0x9e5a('0x2a');return db[_0x9e5a('0x2b')][_0x9e5a('0x27')]({'where':{'type':_0x460fe4,'resourceId':_0x3c68a1['id']}})[_0x9e5a('0x28')](function(){return _0x46d71a;});})[_0x9e5a('0x28')](function(){_0x6710cb[_0x9e5a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfd5f31,_0x381f4f){return function(_0x33fcc6){if(!_0x33fcc6){_0xfd5f31[_0x9e5a('0x1c')](0x194);}return _0x33fcc6;};}function handleError(_0x28dc8f,_0x27eda2){_0x27eda2=_0x27eda2||0x1f4;return function(_0x2e9deb){logger[_0x9e5a('0x2c')](_0x2e9deb[_0x9e5a('0x2d')]);if(_0x2e9deb[_0x9e5a('0x2e')]){delete _0x2e9deb['name'];}_0x28dc8f['status'](_0x27eda2)[_0x9e5a('0x2f')](_0x2e9deb);};}exports['index']=function(_0x376da9,_0x4315b2){var _0xdac539={},_0x25c669={},_0x510bc3={'count':0x0,'rows':[]};var _0x405d2c=_[_0x9e5a('0x30')](db[_0x9e5a('0x31')][_0x9e5a('0x32')],function(_0x1c1096){return{'name':_0x1c1096[_0x9e5a('0x33')],'type':_0x1c1096[_0x9e5a('0x34')][_0x9e5a('0x35')]};});_0x25c669[_0x9e5a('0x36')]=_[_0x9e5a('0x30')](_0x405d2c,_0x9e5a('0x2e'));_0x25c669[_0x9e5a('0x37')]=_[_0x9e5a('0x38')](_0x376da9[_0x9e5a('0x37')]);_0x25c669[_0x9e5a('0x39')]=_[_0x9e5a('0x3a')](_0x25c669['model'],_0x25c669[_0x9e5a('0x37')]);_0xdac539[_0x9e5a('0x3b')]=_['intersection'](_0x25c669[_0x9e5a('0x36')],qs[_0x9e5a('0x3c')](_0x376da9[_0x9e5a('0x37')]['fields']));_0xdac539[_0x9e5a('0x3b')]=_0xdac539[_0x9e5a('0x3b')][_0x9e5a('0x3d')]?_0xdac539[_0x9e5a('0x3b')]:_0x25c669[_0x9e5a('0x36')];if(!_0x376da9['query']['hasOwnProperty']('nolimit')){_0xdac539['limit']=qs[_0x9e5a('0x21')](_0x376da9[_0x9e5a('0x37')][_0x9e5a('0x21')]);_0xdac539[_0x9e5a('0x20')]=qs[_0x9e5a('0x20')](_0x376da9[_0x9e5a('0x37')]['offset']);}_0xdac539[_0x9e5a('0x3e')]=qs[_0x9e5a('0x3f')](_0x376da9[_0x9e5a('0x37')][_0x9e5a('0x3f')]);_0xdac539['where']=qs[_0x9e5a('0x39')](_[_0x9e5a('0x40')](_0x376da9['query'],_0x25c669['filters']),_0x405d2c);if(_0x376da9['query']['filter']){_0xdac539['where']=_[_0x9e5a('0x41')](_0xdac539['where'],{'$or':_['map'](_0x405d2c,function(_0x2c6beb){if(_0x2c6beb['type']!==_0x9e5a('0x42')){var _0x4bf81c={};_0x4bf81c[_0x2c6beb[_0x9e5a('0x2e')]]={'$like':'%'+_0x376da9[_0x9e5a('0x37')][_0x9e5a('0x43')]+'%'};return _0x4bf81c;}})});}_0xdac539=_[_0x9e5a('0x41')]({},_0xdac539,_0x376da9[_0x9e5a('0x44')]);var _0x1aa30f={'where':_0xdac539[_0x9e5a('0x45')]};return db[_0x9e5a('0x31')][_0x9e5a('0x22')](_0x1aa30f)[_0x9e5a('0x28')](function(_0x54ef76){_0x510bc3[_0x9e5a('0x22')]=_0x54ef76;if(_0x376da9[_0x9e5a('0x37')]['includeAll']){_0xdac539[_0x9e5a('0x46')]=[{'all':!![]}];}return db[_0x9e5a('0x31')][_0x9e5a('0x47')](_0xdac539);})[_0x9e5a('0x28')](function(_0x467e7f){_0x510bc3[_0x9e5a('0x48')]=_0x467e7f;return _0x510bc3;})[_0x9e5a('0x28')](respondWithFilteredResult(_0x4315b2,_0xdac539))[_0x9e5a('0x49')](handleError(_0x4315b2,null));};exports[_0x9e5a('0x4a')]=function(_0x53598f,_0x523081){var _0x55b005={'raw':!![],'where':{'id':_0x53598f['params']['id']}},_0x9c9dd0={};_0x9c9dd0[_0x9e5a('0x36')]=_[_0x9e5a('0x38')](db[_0x9e5a('0x31')][_0x9e5a('0x32')]);_0x9c9dd0['query']=_['keys'](_0x53598f[_0x9e5a('0x37')]);_0x9c9dd0[_0x9e5a('0x39')]=_[_0x9e5a('0x3a')](_0x9c9dd0['model'],_0x9c9dd0[_0x9e5a('0x37')]);_0x55b005['attributes']=_[_0x9e5a('0x3a')](_0x9c9dd0[_0x9e5a('0x36')],qs[_0x9e5a('0x3c')](_0x53598f[_0x9e5a('0x37')][_0x9e5a('0x3c')]));_0x55b005['attributes']=_0x55b005[_0x9e5a('0x3b')][_0x9e5a('0x3d')]?_0x55b005['attributes']:_0x9c9dd0[_0x9e5a('0x36')];if(_0x53598f['query'][_0x9e5a('0x4b')]){_0x55b005[_0x9e5a('0x46')]=[{'all':!![]}];}_0x55b005=_[_0x9e5a('0x41')]({},_0x55b005,_0x53598f[_0x9e5a('0x44')]);return db[_0x9e5a('0x31')][_0x9e5a('0x4c')](_0x55b005)[_0x9e5a('0x28')](handleEntityNotFound(_0x523081,null))['then'](respondWithResult(_0x523081,null))[_0x9e5a('0x49')](handleError(_0x523081,null));};exports[_0x9e5a('0x4d')]=function(_0xe5227b,_0x1ddb09){return db[_0x9e5a('0x31')][_0x9e5a('0x4d')](_0xe5227b[_0x9e5a('0x4e')],{})[_0x9e5a('0x28')](function(_0x373250){var _0x328a32=_0xe5227b[_0x9e5a('0x4f')]['get']({'plain':!![]});if(!_0x328a32)throw new Error(_0x9e5a('0x50'));if(_0x328a32['role']===_0x9e5a('0x4f')){var _0x45e3d1=_0x373250[_0x9e5a('0x29')]({'plain':!![]});var _0x3f4997=_0x9e5a('0x2a');return db[_0x9e5a('0x51')][_0x9e5a('0x4c')]({'where':{'name':_0x3f4997,'userProfileId':_0x328a32[_0x9e5a('0x52')]},'raw':!![]})['then'](function(_0x44c155){if(_0x44c155&&_0x44c155[_0x9e5a('0x53')]===0x0){return db[_0x9e5a('0x2b')][_0x9e5a('0x4d')]({'name':_0x45e3d1[_0x9e5a('0x2e')],'resourceId':_0x45e3d1['id'],'type':_0x44c155[_0x9e5a('0x2e')],'sectionId':_0x44c155['id']},{})[_0x9e5a('0x28')](function(){return _0x373250;});}else{return _0x373250;}})['catch'](function(_0x23f306){logger[_0x9e5a('0x2c')](_0x9e5a('0x54'),_0x23f306);throw _0x23f306;});}return _0x373250;})[_0x9e5a('0x28')](respondWithResult(_0x1ddb09,0xc9))[_0x9e5a('0x49')](handleError(_0x1ddb09,null));};exports['update']=function(_0x3fb5f7,_0x4eeeee){if(_0x3fb5f7[_0x9e5a('0x4e')]['id']){delete _0x3fb5f7['body']['id'];}return db[_0x9e5a('0x31')][_0x9e5a('0x4c')]({'where':{'id':_0x3fb5f7['params']['id']}})['then'](handleEntityNotFound(_0x4eeeee,null))[_0x9e5a('0x28')](saveUpdates(_0x3fb5f7['body'],null))[_0x9e5a('0x28')](respondWithResult(_0x4eeeee,null))[_0x9e5a('0x49')](handleError(_0x4eeeee,null));};exports['destroy']=function(_0x136138,_0x487c79){return db['OpenchannelQueue'][_0x9e5a('0x4c')]({'where':{'id':_0x136138['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x487c79,null))[_0x9e5a('0x28')](removeEntity(_0x487c79,null))[_0x9e5a('0x49')](handleError(_0x487c79,null));};exports[_0x9e5a('0x55')]=function(_0x135def,_0x510706){return db['OpenchannelQueue'][_0x9e5a('0x55')]()['then'](respondWithResult(_0x510706,null))['catch'](handleError(_0x510706,null));};exports['getMembers']=function(_0x2a6314,_0x342b8b,_0x1bd11d){var _0x4c102c={'raw':!![],'where':{}},_0x3935fa={},_0x3c0517;return db[_0x9e5a('0x31')]['findOne']({'where':{'id':_0x2a6314['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x342b8b,null))[_0x9e5a('0x28')](function(_0x5b8ab9){if(_0x5b8ab9){_0x3c0517=_0x5b8ab9[_0x9e5a('0x29')]({'plain':!![]});_0x3935fa['model']=_['keys'](db[_0x9e5a('0x56')][_0x9e5a('0x32')]);_0x3935fa['query']=_[_0x9e5a('0x38')](_0x2a6314['query']);_0x3935fa[_0x9e5a('0x39')]=_[_0x9e5a('0x3a')](_0x3935fa[_0x9e5a('0x36')],_0x3935fa[_0x9e5a('0x37')]);_0x4c102c[_0x9e5a('0x3b')]=_['intersection'](_0x3935fa['model'],qs[_0x9e5a('0x3c')](_0x2a6314['query']['fields']));_0x4c102c[_0x9e5a('0x3b')]=_0x4c102c[_0x9e5a('0x3b')][_0x9e5a('0x3d')]?_0x4c102c['attributes']:_0x3935fa['model'];if(!_0x2a6314[_0x9e5a('0x37')]['hasOwnProperty'](_0x9e5a('0x57'))){_0x4c102c[_0x9e5a('0x21')]=qs[_0x9e5a('0x21')](_0x2a6314[_0x9e5a('0x37')][_0x9e5a('0x21')]);_0x4c102c[_0x9e5a('0x20')]=qs[_0x9e5a('0x20')](_0x2a6314[_0x9e5a('0x37')]['offset']);}_0x4c102c[_0x9e5a('0x3e')]=qs[_0x9e5a('0x3f')](_0x2a6314[_0x9e5a('0x37')]['sort']);_0x4c102c[_0x9e5a('0x45')]=qs['filters'](_[_0x9e5a('0x40')](_0x2a6314[_0x9e5a('0x37')],_0x3935fa['filters']));_0x4c102c[_0x9e5a('0x45')]['OpenchannelQueueId']=_0x5b8ab9['id'];if(_0x2a6314['query'][_0x9e5a('0x43')]){_0x4c102c['where']=_['merge'](_0x4c102c[_0x9e5a('0x45')],{'$or':_['map'](_0x4c102c[_0x9e5a('0x3b')],function(_0x40f065){var _0x4eaa62={};_0x4eaa62[_0x40f065]={'$like':'%'+_0x2a6314['query']['filter']+'%'};return _0x4eaa62;})});}_0x4c102c=_[_0x9e5a('0x41')]({},_0x4c102c,_0x2a6314[_0x9e5a('0x44')]);return db[_0x9e5a('0x56')]['findAll'](_0x4c102c);}})[_0x9e5a('0x28')](function(_0x4fcdec){if(_0x4fcdec){return db[_0x9e5a('0x58')][_0x9e5a('0x59')]({'where':{'id':_[_0x9e5a('0x30')](_0x4fcdec,_0x9e5a('0x5a')),'role':_0x9e5a('0x5b')},'attributes':['id',_0x9e5a('0x2e'),'openchannelPause',_0x9e5a('0x5c'),_0x9e5a('0x5d')]});}})[_0x9e5a('0x28')](function(_0xf3c29f){if(_0xf3c29f){return{'count':_0xf3c29f['count'],'rows':_[_0x9e5a('0x30')](_0xf3c29f[_0x9e5a('0x48')],function(_0x6365dd){return{'membername':_0x6365dd[_0x9e5a('0x2e')],'UserId':_0x6365dd['id'],'queue_name':_0x3c0517[_0x9e5a('0x2e')],'OpenchannelQueueId':_0x3c0517['id'],'interface':util[_0x9e5a('0x5e')](_0x9e5a('0x5f'),_0x9e5a('0x60'),_0x6365dd[_0x9e5a('0x2e')]),'penalty':0x0,'paused':_0x6365dd['openchannelPause'],'createdAt':_0x6365dd['createdAt'],'updatedAt':_0x6365dd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9e5a('0x28')](respondWithFilteredResult(_0x342b8b,_0x4c102c))[_0x9e5a('0x49')](handleError(_0x342b8b,null));};exports[_0x9e5a('0x61')]=function(_0x9657d8,_0x1e37ff,_0x4036b7){var _0x84d16c={};var _0x54c5a9={};var _0x3a42f6;var _0x8e10ad;return db[_0x9e5a('0x31')][_0x9e5a('0x62')]({'where':{'id':_0x9657d8['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x1e37ff,null))[_0x9e5a('0x28')](function(_0x32950f){if(_0x32950f){_0x3a42f6=_0x32950f;_0x54c5a9[_0x9e5a('0x36')]=_[_0x9e5a('0x38')](db[_0x9e5a('0x63')][_0x9e5a('0x32')]);_0x54c5a9['query']=_[_0x9e5a('0x38')](_0x9657d8[_0x9e5a('0x37')]);_0x54c5a9[_0x9e5a('0x39')]=_[_0x9e5a('0x3a')](_0x54c5a9[_0x9e5a('0x36')],_0x54c5a9['query']);_0x84d16c[_0x9e5a('0x3b')]=_[_0x9e5a('0x3a')](_0x54c5a9[_0x9e5a('0x36')],qs[_0x9e5a('0x3c')](_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x3c')]));_0x84d16c[_0x9e5a('0x3b')]=_0x84d16c['attributes'][_0x9e5a('0x3d')]?_0x84d16c[_0x9e5a('0x3b')]:_0x54c5a9['model'];_0x84d16c[_0x9e5a('0x3e')]=qs[_0x9e5a('0x3f')](_0x9657d8['query']['sort']);_0x84d16c['where']=qs[_0x9e5a('0x39')](_[_0x9e5a('0x40')](_0x9657d8['query'],_0x54c5a9[_0x9e5a('0x39')]));if(_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x43')]){_0x84d16c[_0x9e5a('0x45')]=_[_0x9e5a('0x41')](_0x84d16c[_0x9e5a('0x45')],{'$or':_[_0x9e5a('0x30')](_0x84d16c[_0x9e5a('0x3b')],function(_0x20359e){var _0x5f2ad0={};_0x5f2ad0[_0x20359e]={'$like':'%'+_0x9657d8['query'][_0x9e5a('0x43')]+'%'};return _0x5f2ad0;})});}_0x84d16c=_[_0x9e5a('0x41')]({},_0x84d16c,_0x9657d8['options']);return _0x3a42f6['getTeams'](_0x84d16c);}})[_0x9e5a('0x28')](function(_0xa49063){if(_0xa49063){_0x8e10ad=_0xa49063[_0x9e5a('0x3d')];if(!_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x64')]('nolimit')){_0x84d16c[_0x9e5a('0x21')]=qs[_0x9e5a('0x21')](_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x21')]);_0x84d16c[_0x9e5a('0x20')]=qs['offset'](_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x20')]);}return _0x3a42f6[_0x9e5a('0x61')](_0x84d16c);}})[_0x9e5a('0x28')](function(_0x5ca8c0){if(_0x5ca8c0){return _0x5ca8c0?{'count':_0x8e10ad,'rows':_0x5ca8c0}:null;}})['then'](respondWithResult(_0x1e37ff,null))[_0x9e5a('0x49')](handleError(_0x1e37ff,null));};exports[_0x9e5a('0x65')]=function(_0x4a2b79,_0x172889,_0x51d69f){var _0x2d3c07=_0x4a2b79[_0x9e5a('0x4e')][_0x9e5a('0x66')];return db[_0x9e5a('0x63')][_0x9e5a('0x47')]({'where':{'id':_0x2d3c07},'attributes':['id'],'include':[{'model':db[_0x9e5a('0x58')],'as':'Agents','attributes':['id',_0x9e5a('0x2e'),_0x9e5a('0x67'),'voicePause',_0x9e5a('0x68')],'raw':!![]}]})[_0x9e5a('0x28')](function(_0xa3bd4a){if(_0xa3bd4a){var _0xc72a92=_[_0x9e5a('0x69')](_0xa3bd4a,function(_0x5b7edf){var _0x43285f=_0x5b7edf[_0x9e5a('0x29')]({'plain':!![]});return _0x43285f[_0x9e5a('0x6a')];});return db[_0x9e5a('0x31')][_0x9e5a('0x4c')]({'where':{'id':_0x4a2b79[_0x9e5a('0x6b')]['id']}})[_0x9e5a('0x28')](function(_0x37809d){return db[_0x9e5a('0x6c')][_0x9e5a('0x6d')](function(_0x10c340){return _0x37809d[_0x9e5a('0x65')](_0x2d3c07,{'transaction':_0x10c340})[_0x9e5a('0x28')](function(){return BPromise[_0x9e5a('0x6e')](_0xc72a92,function(_0x11ec59){return db[_0x9e5a('0x56')][_0x9e5a('0x6f')]({'where':{'UserId':_0x11ec59['id'],'OpenchannelQueueId':_0x4a2b79[_0x9e5a('0x6b')]['id']},'transaction':_0x10c340});});})[_0x9e5a('0x28')](function(){_0xc72a92[_0x9e5a('0x70')](function(_0x145f07){socket[_0x9e5a('0x71')](_0x9e5a('0x72'),{'UserId':_0x145f07['id'],'OpenchannelQueueId':_0x37809d['id']});});});});});}})[_0x9e5a('0x28')](respondWithStatusCode(_0x172889,null))[_0x9e5a('0x49')](handleError(_0x172889,null));};exports[_0x9e5a('0x73')]=function(_0x1e99dc,_0x32e132,_0x56e42a){return db[_0x9e5a('0x63')][_0x9e5a('0x47')]({'where':{'id':_0x1e99dc[_0x9e5a('0x37')][_0x9e5a('0x66')]},'attributes':['id'],'include':[{'model':db[_0x9e5a('0x58')],'as':_0x9e5a('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x9e5a('0x28')](handleEntityNotFound(_0x32e132,null))[_0x9e5a('0x28')](function(_0x53e32d){var _0x1a25d0=_[_0x9e5a('0x30')](_0x53e32d,'id');var _0x1f4821=[];var _0x1f917f=[];var _0x466cb2=squel['select']();_0x466cb2[_0x9e5a('0x74')](_0x9e5a('0x75'))[_0x9e5a('0x76')]('team_has_openchannel_queues','tq')[_0x9e5a('0x77')](_0x9e5a('0x78'),'ut',_0x9e5a('0x79'))[_0x9e5a('0x45')](_0x9e5a('0x7a'),_0x1e99dc[_0x9e5a('0x6b')]['id']);for(var _0x4bb190=0x0;_0x4bb190<_0x53e32d['length'];_0x4bb190+=0x1){let _0x2e0cc5=_0x53e32d[_0x4bb190];for(var _0x295a45=0x0;_0x295a45<_0x2e0cc5[_0x9e5a('0x6a')][_0x9e5a('0x3d')];_0x295a45+=0x1){let _0xd25570=_0x2e0cc5[_0x9e5a('0x6a')][_0x295a45];var _0x56bf07=_0x466cb2['clone']();_0x56bf07[_0x9e5a('0x45')](_0x9e5a('0x7b'),_0xd25570['id']);_0x1f917f[_0x9e5a('0x7c')](db[_0x9e5a('0x6c')]['query'](_0x56bf07['toString'](),{'type':db['sequelize'][_0x9e5a('0x7d')][_0x9e5a('0x7e')]})[_0x9e5a('0x28')](function(_0x2b08a1){if(_0x2b08a1[_0x9e5a('0x3d')]===0x1){return _0xd25570['id'];}else{var _0xf6f4d=_[_0x9e5a('0x7f')](_[_0x9e5a('0x30')](_0x2b08a1,_0x9e5a('0x80')),function(_0x148e5d){return _['includes'](_0x1a25d0,_0x148e5d);});if(_0xf6f4d){return _0xd25570['id'];}}}));}}return BPromise['all'](_0x1f917f)[_0x9e5a('0x28')](function(_0xca9c17){_0x1f4821=_(_0x1f4821)[_0x9e5a('0x81')](_0xca9c17)[_0x9e5a('0x82')]()[_0x9e5a('0x83')]();return db[_0x9e5a('0x31')][_0x9e5a('0x4c')]({'where':{'id':_0x1e99dc[_0x9e5a('0x6b')]['id']}})[_0x9e5a('0x28')](function(_0x3f636a){return db[_0x9e5a('0x6c')][_0x9e5a('0x6d')](function(_0x53ab8d){return _0x3f636a[_0x9e5a('0x73')](_0x1e99dc[_0x9e5a('0x37')][_0x9e5a('0x66')],{'transaction':_0x53ab8d})['then'](function(){if(!_[_0x9e5a('0x84')](_0x1f4821)){return _0x3f636a['removeAgents'](_0x1f4821,{'transaction':_0x53ab8d});}})[_0x9e5a('0x28')](function(){_0x1f4821[_0x9e5a('0x70')](function(_0x4528d6){socket[_0x9e5a('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x4528d6,'OpenchannelQueueId':_0x3f636a['id']});});});});});});})[_0x9e5a('0x28')](respondWithStatusCode(_0x32e132,null))[_0x9e5a('0x49')](handleError(_0x32e132,null));};exports['addAgents']=function(_0x5a9785,_0x5478cf,_0x77a94){return db[_0x9e5a('0x31')]['find']({'where':{'id':_0x5a9785[_0x9e5a('0x6b')]['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x5478cf,null))['then'](function(_0x525437){if(_0x525437){return _0x525437['addAgents'](_0x5a9785['body'][_0x9e5a('0x66')],_[_0x9e5a('0x85')](_0x5a9785['body'],[_0x9e5a('0x66'),'id'])||{})[_0x9e5a('0x86')](function(_0x5ebf1f){for(var _0x1b9411=0x0;_0x1b9411<_0x5a9785[_0x9e5a('0x4e')][_0x9e5a('0x66')]['length'];_0x1b9411+=0x1){socket['emit'](_0x9e5a('0x72'),{'UserId':Number(_0x5a9785[_0x9e5a('0x4e')][_0x9e5a('0x66')][_0x1b9411]),'OpenchannelQueueId':Number(_0x5a9785[_0x9e5a('0x6b')]['id'])});}return _0x5ebf1f;});}})[_0x9e5a('0x28')](respondWithResult(_0x5478cf,null))[_0x9e5a('0x49')](handleError(_0x5478cf,null));};exports[_0x9e5a('0x87')]=function(_0x4f06ae,_0x31da4a,_0x15acd1){return db[_0x9e5a('0x31')][_0x9e5a('0x4c')]({'where':{'id':_0x4f06ae['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x31da4a,null))[_0x9e5a('0x28')](function(_0x2168e5){if(_0x2168e5){return _0x2168e5[_0x9e5a('0x87')](_0x4f06ae[_0x9e5a('0x37')]['ids'])['then'](function(){if(_[_0x9e5a('0x88')](_0x4f06ae[_0x9e5a('0x37')][_0x9e5a('0x66')])){for(var _0xa1769=0x0;_0xa1769<_0x4f06ae[_0x9e5a('0x37')][_0x9e5a('0x66')][_0x9e5a('0x3d')];_0xa1769+=0x1){socket[_0x9e5a('0x71')](_0x9e5a('0x89'),{'UserId':Number(_0x4f06ae[_0x9e5a('0x37')][_0x9e5a('0x66')][_0xa1769]),'OpenchannelQueueId':Number(_0x4f06ae['params']['id'])});}}else{socket[_0x9e5a('0x71')](_0x9e5a('0x89'),{'UserId':Number(_0x4f06ae[_0x9e5a('0x37')][_0x9e5a('0x66')]),'OpenchannelQueueId':Number(_0x4f06ae[_0x9e5a('0x6b')]['id'])});}});}})[_0x9e5a('0x28')](respondWithStatusCode(_0x31da4a,null))['catch'](handleError(_0x31da4a,null));};exports[_0x9e5a('0x8a')]=function(_0x23b564,_0x170089,_0x2012ee){var _0x1e1e86={};var _0x249ef2={};var _0x15fa9f;var _0x4a36ae;return db[_0x9e5a('0x31')][_0x9e5a('0x62')]({'where':{'id':_0x23b564['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x170089,null))[_0x9e5a('0x28')](function(_0x253b4e){if(_0x253b4e){_0x15fa9f=_0x253b4e;_0x249ef2[_0x9e5a('0x36')]=_[_0x9e5a('0x38')](db[_0x9e5a('0x58')]['rawAttributes']);_0x249ef2[_0x9e5a('0x37')]=_[_0x9e5a('0x38')](_0x23b564[_0x9e5a('0x37')]);_0x249ef2['filters']=_[_0x9e5a('0x3a')](_0x249ef2[_0x9e5a('0x36')],_0x249ef2['query']);_0x1e1e86[_0x9e5a('0x3b')]=_[_0x9e5a('0x3a')](_0x249ef2['model'],qs[_0x9e5a('0x3c')](_0x23b564['query']['fields']));_0x1e1e86[_0x9e5a('0x3b')]=_0x1e1e86[_0x9e5a('0x3b')][_0x9e5a('0x3d')]?_0x1e1e86[_0x9e5a('0x3b')]:_0x249ef2[_0x9e5a('0x36')];_0x1e1e86['order']=qs[_0x9e5a('0x3f')](_0x23b564[_0x9e5a('0x37')]['sort']);_0x1e1e86[_0x9e5a('0x45')]=qs[_0x9e5a('0x39')](_[_0x9e5a('0x40')](_0x23b564[_0x9e5a('0x37')],_0x249ef2[_0x9e5a('0x39')]));if(_0x23b564[_0x9e5a('0x37')][_0x9e5a('0x43')]){_0x1e1e86['where']=_[_0x9e5a('0x41')](_0x1e1e86['where'],{'$or':_[_0x9e5a('0x30')](_0x1e1e86['attributes'],function(_0x1f6ef9){var _0x1d7203={};_0x1d7203[_0x1f6ef9]={'$like':'%'+_0x23b564['query']['filter']+'%'};return _0x1d7203;})});}_0x1e1e86=_[_0x9e5a('0x41')]({},_0x1e1e86,_0x23b564[_0x9e5a('0x44')]);return _0x15fa9f[_0x9e5a('0x8a')](_0x1e1e86);}})[_0x9e5a('0x28')](function(_0xb66903){if(_0xb66903){_0x4a36ae=_0xb66903[_0x9e5a('0x3d')];if(!_0x23b564[_0x9e5a('0x37')][_0x9e5a('0x64')]('nolimit')){_0x1e1e86[_0x9e5a('0x21')]=qs[_0x9e5a('0x21')](_0x23b564['query'][_0x9e5a('0x21')]);_0x1e1e86['offset']=qs['offset'](_0x23b564['query'][_0x9e5a('0x20')]);}return _0x15fa9f['getAgents'](_0x1e1e86);}})['then'](function(_0x3f3c9c){if(_0x3f3c9c){return _0x3f3c9c?{'count':_0x4a36ae,'rows':_0x3f3c9c}:null;}})['then'](respondWithResult(_0x170089,null))[_0x9e5a('0x49')](handleError(_0x170089,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index b148328..db95b26 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 _0xe723=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','save'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0xe723,0x16d));var _0x3e72=function(_0x2aae30,_0x4d834d){_0x2aae30=_0x2aae30-0x0;var _0x1ea85b=_0xe723[_0x2aae30];return _0x1ea85b;};'use strict';var EventEmitter=require(_0x3e72('0x0'));var OpenchannelQueue=require(_0x3e72('0x1'))['db'][_0x3e72('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3e72('0x3'),'afterUpdate':_0x3e72('0x4'),'afterDestroy':_0x3e72('0x5')};function emitEvent(_0xec5f5e){return function(_0x2bfe94,_0x4a766d,_0x4e095){OpenchannelQueueEvents[_0x3e72('0x6')](_0xec5f5e+':'+_0x2bfe94['id'],_0x2bfe94);OpenchannelQueueEvents[_0x3e72('0x6')](_0xec5f5e,_0x2bfe94);_0x4e095(null);};}for(var e in events){if(events[_0x3e72('0x7')](e)){var event=events[e];OpenchannelQueue[_0x3e72('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xa4e8=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x35173b,_0x16711b){var _0x51cdf4=function(_0x144c21){while(--_0x144c21){_0x35173b['push'](_0x35173b['shift']());}};_0x51cdf4(++_0x16711b);}(_0xa4e8,0x99));var _0x8a4e=function(_0x5a2ff8,_0x58811d){_0x5a2ff8=_0x5a2ff8-0x0;var _0x55ebf8=_0xa4e8[_0x5a2ff8];return _0x55ebf8;};'use strict';var EventEmitter=require(_0x8a4e('0x0'));var OpenchannelQueue=require(_0x8a4e('0x1'))['db'][_0x8a4e('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8a4e('0x3')](0x0);var events={'afterCreate':_0x8a4e('0x4'),'afterUpdate':'update','afterDestroy':_0x8a4e('0x5')};function emitEvent(_0x29c726){return function(_0x36936f,_0x549088,_0x1883eb){OpenchannelQueueEvents[_0x8a4e('0x6')](_0x29c726+':'+_0x36936f['id'],_0x36936f);OpenchannelQueueEvents[_0x8a4e('0x6')](_0x29c726,_0x36936f);_0x1883eb(null);};}for(var e in events){if(events[_0x8a4e('0x7')](e)){var event=events[e];OpenchannelQueue[_0x8a4e('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 9247855..0d8af9e 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 _0x37f3=['moment','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','../../config/logger','api'];(function(_0x13740b,_0x3473c8){var _0x187311=function(_0x82a295){while(--_0x82a295){_0x13740b['push'](_0x13740b['shift']());}};_0x187311(++_0x3473c8);}(_0x37f3,0x1ec));var _0x337f=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0x37f3[_0x1a37e3];return _0x4db78a;};'use strict';var _=require(_0x337f('0x0'));var util=require('util');var logger=require(_0x337f('0x1'))(_0x337f('0x2'));var moment=require(_0x337f('0x3'));var BPromise=require('bluebird');var rp=require(_0x337f('0x4'));var fs=require('fs');var path=require(_0x337f('0x5'));var rimraf=require(_0x337f('0x6'));var config=require('../../config/environment');var attributes=require(_0x337f('0x7'));module[_0x337f('0x8')]=function(_0xb80046,_0x4a532a){return _0xb80046[_0x337f('0x9')](_0x337f('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d5e=['OpenchannelQueue','openchannel_queues','lodash','util','api','request-promise','path','./openchannelQueue.attributes','exports','define'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x6d5e,0x188));var _0xe6d5=function(_0x5222c1,_0x4ddc30){_0x5222c1=_0x5222c1-0x0;var _0x179ad7=_0x6d5e[_0x5222c1];return _0x179ad7;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var logger=require('../../config/logger')(_0xe6d5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe6d5('0x3'));var fs=require('fs');var path=require(_0xe6d5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe6d5('0x5'));module[_0xe6d5('0x6')]=function(_0x174117,_0x37cf50){return _0x174117[_0xe6d5('0x7')](_0xe6d5('0x8'),attributes,{'tableName':_0xe6d5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 4d674ac..0b58c55 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 _0x7b2e=['where','attributes','limit','include','map','model','find','ShowOpenchannelQueue','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetOpenchannelQueue','OpenchannelQueue','options','raw'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x7b2e,0x1d1));var _0xe7b2=function(_0x263016,_0x2277ef){_0x263016=_0x263016-0x0;var _0x3b1c47=_0x7b2e[_0x263016];return _0x3b1c47;};'use strict';var _=require(_0xe7b2('0x0'));var util=require(_0xe7b2('0x1'));var moment=require(_0xe7b2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7b2('0x3'));var fs=require('fs');var Redis=require(_0xe7b2('0x4'));var db=require(_0xe7b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7b2('0x6'))(_0xe7b2('0x7'));var config=require(_0xe7b2('0x8'));var jayson=require(_0xe7b2('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xe7b2('0xa')]=_['defaults'](config[_0xe7b2('0xa')],{'host':_0xe7b2('0xb'),'port':0x18eb});var socket=require(_0xe7b2('0xc'))(new Redis(config[_0xe7b2('0xa')]));require(_0xe7b2('0xd'))['register'](socket);function respondWithRpcPromise(_0x52b9db,_0x2d12b9,_0x4f4684){return new BPromise(function(_0x4a8c2c,_0x4fbdef){return client[_0xe7b2('0xe')](_0x52b9db,_0x4f4684)[_0xe7b2('0xf')](function(_0x32d638){logger['info'](_0xe7b2('0x10'),_0x2d12b9,'request\x20sent');logger[_0xe7b2('0x11')](_0xe7b2('0x12'),_0x2d12b9,_0xe7b2('0x13'),JSON[_0xe7b2('0x14')](_0x32d638));if(_0x32d638[_0xe7b2('0x15')]){if(_0x32d638[_0xe7b2('0x15')][_0xe7b2('0x16')]===0x1f4){logger[_0xe7b2('0x15')](_0xe7b2('0x10'),_0x2d12b9,_0x32d638[_0xe7b2('0x15')][_0xe7b2('0x17')]);return _0x4fbdef(_0x32d638[_0xe7b2('0x15')]['message']);}logger[_0xe7b2('0x15')](_0xe7b2('0x10'),_0x2d12b9,_0x32d638[_0xe7b2('0x15')]['message']);return _0x4a8c2c(_0x32d638[_0xe7b2('0x15')][_0xe7b2('0x17')]);}else{logger[_0xe7b2('0x18')](_0xe7b2('0x10'),_0x2d12b9,_0xe7b2('0x13'));_0x4a8c2c(_0x32d638['result'][_0xe7b2('0x17')]);}})['catch'](function(_0x1f2a9b){logger[_0xe7b2('0x15')](_0xe7b2('0x10'),_0x2d12b9,_0x1f2a9b);_0x4fbdef(_0x1f2a9b);});});}exports[_0xe7b2('0x19')]=function(_0x3f46b9){var _0x58d866=this;return new Promise(function(_0x5c9329,_0x4812a0){return db[_0xe7b2('0x1a')]['findAll']({'raw':_0x3f46b9[_0xe7b2('0x1b')]?_0x3f46b9[_0xe7b2('0x1b')][_0xe7b2('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f46b9[_0xe7b2('0x1b')]?_0x3f46b9[_0xe7b2('0x1b')][_0xe7b2('0x1d')]||null:null,'attributes':_0x3f46b9['options']?_0x3f46b9[_0xe7b2('0x1b')][_0xe7b2('0x1e')]||null:null,'limit':_0x3f46b9[_0xe7b2('0x1b')]?_0x3f46b9[_0xe7b2('0x1b')][_0xe7b2('0x1f')]||null:null,'include':_0x3f46b9['options']?_0x3f46b9[_0xe7b2('0x1b')][_0xe7b2('0x20')]?_[_0xe7b2('0x21')](_0x3f46b9[_0xe7b2('0x1b')][_0xe7b2('0x20')],function(_0x1f3596){return{'model':db[_0x1f3596[_0xe7b2('0x22')]],'as':_0x1f3596['as'],'attributes':_0x1f3596[_0xe7b2('0x1e')],'include':_0x1f3596[_0xe7b2('0x20')]?_[_0xe7b2('0x21')](_0x1f3596['include'],function(_0x3cebd2){return{'model':db[_0x3cebd2[_0xe7b2('0x22')]],'as':_0x3cebd2['as'],'attributes':_0x3cebd2[_0xe7b2('0x1e')],'include':_0x3cebd2[_0xe7b2('0x20')]?_[_0xe7b2('0x21')](_0x3cebd2['include'],function(_0x1c55c9){return{'model':db[_0x1c55c9[_0xe7b2('0x22')]],'as':_0x1c55c9['as'],'attributes':_0x1c55c9[_0xe7b2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ebfc8){logger[_0xe7b2('0x18')](_0xe7b2('0x19'),_0x3f46b9);logger[_0xe7b2('0x11')](_0xe7b2('0x19'),_0x3f46b9,JSON[_0xe7b2('0x14')](_0x2ebfc8));_0x5c9329(_0x2ebfc8);})['catch'](function(_0x585620){logger[_0xe7b2('0x15')]('GetOpenchannelQueue',_0x585620[_0xe7b2('0x17')],_0x3f46b9);_0x4812a0(_0x58d866[_0xe7b2('0x15')](0x1f4,_0x585620[_0xe7b2('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x5ce0bd){var _0x114d56=this;return new Promise(function(_0x23e43c,_0x1a7984){return db[_0xe7b2('0x1a')][_0xe7b2('0x23')]({'raw':_0x5ce0bd['options']?_0x5ce0bd[_0xe7b2('0x1b')][_0xe7b2('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ce0bd[_0xe7b2('0x1b')]?_0x5ce0bd['options']['where']||null:null,'attributes':_0x5ce0bd['options']?_0x5ce0bd[_0xe7b2('0x1b')]['attributes']||null:null,'include':_0x5ce0bd[_0xe7b2('0x1b')]?_0x5ce0bd[_0xe7b2('0x1b')][_0xe7b2('0x20')]?_[_0xe7b2('0x21')](_0x5ce0bd[_0xe7b2('0x1b')]['include'],function(_0x5fcc51){return{'model':db[_0x5fcc51[_0xe7b2('0x22')]],'as':_0x5fcc51['as'],'attributes':_0x5fcc51['attributes'],'include':_0x5fcc51['include']?_[_0xe7b2('0x21')](_0x5fcc51[_0xe7b2('0x20')],function(_0x2009c1){return{'model':db[_0x2009c1[_0xe7b2('0x22')]],'as':_0x2009c1['as'],'attributes':_0x2009c1[_0xe7b2('0x1e')],'include':_0x2009c1[_0xe7b2('0x20')]?_[_0xe7b2('0x21')](_0x2009c1['include'],function(_0x20da28){return{'model':db[_0x20da28[_0xe7b2('0x22')]],'as':_0x20da28['as'],'attributes':_0x20da28[_0xe7b2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe7b2('0xf')](function(_0x42cd8c){logger[_0xe7b2('0x18')](_0xe7b2('0x24'),_0x5ce0bd);logger[_0xe7b2('0x11')](_0xe7b2('0x24'),_0x5ce0bd,JSON[_0xe7b2('0x14')](_0x42cd8c));_0x23e43c(_0x42cd8c);})[_0xe7b2('0x25')](function(_0x245b3b){logger['error'](_0xe7b2('0x24'),_0x245b3b['message'],_0x5ce0bd);_0x1a7984(_0x114d56[_0xe7b2('0x15')](0x1f4,_0x245b3b[_0xe7b2('0x17')]));});});}; \ No newline at end of file +var _0x1a34=['OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','GetOpenchannelQueue','find','raw','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info'];(function(_0x2b8a3e,_0x50cf95){var _0x465954=function(_0x24346f){while(--_0x24346f){_0x2b8a3e['push'](_0x2b8a3e['shift']());}};_0x465954(++_0x50cf95);}(_0x1a34,0xed));var _0x41a3=function(_0x688be1,_0x30cf06){_0x688be1=_0x688be1-0x0;var _0xec304d=_0x1a34[_0x688be1];return _0xec304d;};'use strict';var _=require(_0x41a3('0x0'));var util=require(_0x41a3('0x1'));var moment=require(_0x41a3('0x2'));var BPromise=require(_0x41a3('0x3'));var rs=require(_0x41a3('0x4'));var fs=require('fs');var Redis=require(_0x41a3('0x5'));var db=require(_0x41a3('0x6'))['db'];var utils=require(_0x41a3('0x7'));var logger=require(_0x41a3('0x8'))('rpc');var config=require(_0x41a3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41a3('0xa')][_0x41a3('0xb')]({'port':0x232a});config[_0x41a3('0xc')]=_[_0x41a3('0xd')](config[_0x41a3('0xc')],{'host':_0x41a3('0xe'),'port':0x18eb});var socket=require(_0x41a3('0xf'))(new Redis(config[_0x41a3('0xc')]));require(_0x41a3('0x10'))[_0x41a3('0x11')](socket);function respondWithRpcPromise(_0x3d4c36,_0x18e26b,_0x4e3985){return new BPromise(function(_0x423897,_0x3f53ba){return client[_0x41a3('0x12')](_0x3d4c36,_0x4e3985)[_0x41a3('0x13')](function(_0x172103){logger[_0x41a3('0x14')](_0x41a3('0x15'),_0x18e26b,'request\x20sent');logger[_0x41a3('0x16')](_0x41a3('0x17'),_0x18e26b,_0x41a3('0x18'),JSON[_0x41a3('0x19')](_0x172103));if(_0x172103['error']){if(_0x172103['error'][_0x41a3('0x1a')]===0x1f4){logger[_0x41a3('0x1b')](_0x41a3('0x15'),_0x18e26b,_0x172103[_0x41a3('0x1b')]['message']);return _0x3f53ba(_0x172103['error'][_0x41a3('0x1c')]);}logger[_0x41a3('0x1b')](_0x41a3('0x15'),_0x18e26b,_0x172103['error'][_0x41a3('0x1c')]);return _0x423897(_0x172103[_0x41a3('0x1b')][_0x41a3('0x1c')]);}else{logger[_0x41a3('0x14')](_0x41a3('0x15'),_0x18e26b,'request\x20sent');_0x423897(_0x172103['result'][_0x41a3('0x1c')]);}})[_0x41a3('0x1d')](function(_0x5f509e){logger[_0x41a3('0x1b')](_0x41a3('0x15'),_0x18e26b,_0x5f509e);_0x3f53ba(_0x5f509e);});});}exports['GetOpenchannelQueue']=function(_0x39e08b){var _0x124d97=this;return new Promise(function(_0x199f3f,_0xb38429){return db[_0x41a3('0x1e')][_0x41a3('0x1f')]({'raw':_0x39e08b['options']?_0x39e08b[_0x41a3('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x39e08b[_0x41a3('0x20')]?_0x39e08b['options'][_0x41a3('0x21')]||null:null,'attributes':_0x39e08b[_0x41a3('0x20')]?_0x39e08b[_0x41a3('0x20')][_0x41a3('0x22')]||null:null,'limit':_0x39e08b[_0x41a3('0x20')]?_0x39e08b[_0x41a3('0x20')][_0x41a3('0x23')]||null:null,'include':_0x39e08b[_0x41a3('0x20')]?_0x39e08b[_0x41a3('0x20')][_0x41a3('0x24')]?_[_0x41a3('0x25')](_0x39e08b[_0x41a3('0x20')]['include'],function(_0x461cdb){return{'model':db[_0x461cdb['model']],'as':_0x461cdb['as'],'attributes':_0x461cdb[_0x41a3('0x22')],'include':_0x461cdb['include']?_['map'](_0x461cdb['include'],function(_0x11b24f){return{'model':db[_0x11b24f['model']],'as':_0x11b24f['as'],'attributes':_0x11b24f['attributes'],'include':_0x11b24f[_0x41a3('0x24')]?_[_0x41a3('0x25')](_0x11b24f[_0x41a3('0x24')],function(_0x185415){return{'model':db[_0x185415[_0x41a3('0x26')]],'as':_0x185415['as'],'attributes':_0x185415[_0x41a3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x41a3('0x13')](function(_0x385a06){logger['info'](_0x41a3('0x27'),_0x39e08b);logger['debug'](_0x41a3('0x27'),_0x39e08b,JSON[_0x41a3('0x19')](_0x385a06));_0x199f3f(_0x385a06);})[_0x41a3('0x1d')](function(_0x2a384f){logger['error'](_0x41a3('0x27'),_0x2a384f[_0x41a3('0x1c')],_0x39e08b);_0xb38429(_0x124d97[_0x41a3('0x1b')](0x1f4,_0x2a384f['message']));});});};exports['ShowOpenchannelQueue']=function(_0x295aa9){var _0x1b0a21=this;return new Promise(function(_0x181152,_0x1c7613){return db[_0x41a3('0x1e')][_0x41a3('0x28')]({'raw':_0x295aa9[_0x41a3('0x20')]?_0x295aa9['options'][_0x41a3('0x29')]===undefined?!![]:![]:!![],'where':_0x295aa9[_0x41a3('0x20')]?_0x295aa9[_0x41a3('0x20')]['where']||null:null,'attributes':_0x295aa9[_0x41a3('0x20')]?_0x295aa9[_0x41a3('0x20')][_0x41a3('0x22')]||null:null,'include':_0x295aa9[_0x41a3('0x20')]?_0x295aa9[_0x41a3('0x20')]['include']?_[_0x41a3('0x25')](_0x295aa9[_0x41a3('0x20')][_0x41a3('0x24')],function(_0x3ab11b){return{'model':db[_0x3ab11b[_0x41a3('0x26')]],'as':_0x3ab11b['as'],'attributes':_0x3ab11b[_0x41a3('0x22')],'include':_0x3ab11b[_0x41a3('0x24')]?_['map'](_0x3ab11b[_0x41a3('0x24')],function(_0x5b0292){return{'model':db[_0x5b0292[_0x41a3('0x26')]],'as':_0x5b0292['as'],'attributes':_0x5b0292['attributes'],'include':_0x5b0292['include']?_['map'](_0x5b0292['include'],function(_0x20f013){return{'model':db[_0x20f013[_0x41a3('0x26')]],'as':_0x20f013['as'],'attributes':_0x20f013[_0x41a3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x41a3('0x13')](function(_0x7837c5){logger[_0x41a3('0x14')](_0x41a3('0x2a'),_0x295aa9);logger[_0x41a3('0x16')](_0x41a3('0x2a'),_0x295aa9,JSON['stringify'](_0x7837c5));_0x181152(_0x7837c5);})[_0x41a3('0x1d')](function(_0x2c65e4){logger[_0x41a3('0x1b')](_0x41a3('0x2a'),_0x2c65e4[_0x41a3('0x1c')],_0x295aa9);_0x1c7613(_0x1b0a21[_0x41a3('0x1b')](0x1f4,_0x2c65e4['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e867f10..84dc2bc 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 _0x97ea=['emit','removeListener','register','length','remove','update'];(function(_0x780d4a,_0x117bee){var _0x397825=function(_0x4c9b09){while(--_0x4c9b09){_0x780d4a['push'](_0x780d4a['shift']());}};_0x397825(++_0x117bee);}(_0x97ea,0x8e));var _0xa97e=function(_0x1e1229,_0x1a58e6){_0x1e1229=_0x1e1229-0x0;var _0x3b615d=_0x97ea[_0x1e1229];return _0x3b615d;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0xa97e('0x0'),_0xa97e('0x1')];function createListener(_0x356f75,_0x13c997){return function(_0x121aa4){_0x13c997[_0xa97e('0x2')](_0x356f75,_0x121aa4);};}function removeListener(_0x26b2de,_0x5ce7dc){return function(){OpenchannelQueueEvents[_0xa97e('0x3')](_0x26b2de,_0x5ce7dc);};}exports[_0xa97e('0x4')]=function(_0xaef7e6){for(var _0x3b97fe=0x0,_0x6fc869=events[_0xa97e('0x5')];_0x3b97fe<_0x6fc869;_0x3b97fe++){var _0x3aaa53=events[_0x3b97fe];var _0x8e20a4=createListener('openchannelQueue:'+_0x3aaa53,_0xaef7e6);OpenchannelQueueEvents['on'](_0x3aaa53,_0x8e20a4);}}; \ No newline at end of file +var _0x1e0d=['update','emit','removeListener','register','length','./openchannelQueue.events','save','remove'];(function(_0x5f1a89,_0x589c9f){var _0x2bd2e9=function(_0x40fb7d){while(--_0x40fb7d){_0x5f1a89['push'](_0x5f1a89['shift']());}};_0x2bd2e9(++_0x589c9f);}(_0x1e0d,0x1bd));var _0xd1e0=function(_0x2e7650,_0x460f5d){_0x2e7650=_0x2e7650-0x0;var _0xee003d=_0x1e0d[_0x2e7650];return _0xee003d;};'use strict';var OpenchannelQueueEvents=require(_0xd1e0('0x0'));var events=[_0xd1e0('0x1'),_0xd1e0('0x2'),_0xd1e0('0x3')];function createListener(_0x1c412c,_0x35665f){return function(_0x4d3718){_0x35665f[_0xd1e0('0x4')](_0x1c412c,_0x4d3718);};}function removeListener(_0x258c2b,_0x351716){return function(){OpenchannelQueueEvents[_0xd1e0('0x5')](_0x258c2b,_0x351716);};}exports[_0xd1e0('0x6')]=function(_0x2660d1){for(var _0x12e7a7=0x0,_0x1de0fe=events[_0xd1e0('0x7')];_0x12e7a7<_0x1de0fe;_0x12e7a7++){var _0x15edfb=events[_0x12e7a7];var _0x313991=createListener('openchannelQueue:'+_0x15edfb,_0x2660d1);OpenchannelQueueEvents['on'](_0x15edfb,_0x313991);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index cd56d64..f0a7d1a 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 _0x5c26=['Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','multer','util','express'];(function(_0x856968,_0x1b13cc){var _0x4383c9=function(_0xa8796c){while(--_0xa8796c){_0x856968['push'](_0x856968['shift']());}};_0x4383c9(++_0x1b13cc);}(_0x5c26,0xb1));var _0x65c2=function(_0x52652c,_0x49dcbf){_0x52652c=_0x52652c-0x0;var _0x5e4d43=_0x5c26[_0x52652c];return _0x5e4d43;};'use strict';var multer=require(_0x65c2('0x0'));var util=require(_0x65c2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x65c2('0x2'));var router=express[_0x65c2('0x3')]();var fs_extra=require(_0x65c2('0x4'));var auth=require(_0x65c2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65c2('0x6'));var controller=require(_0x65c2('0x7'));router[_0x65c2('0x8')]('/',auth[_0x65c2('0x9')](),controller[_0x65c2('0xa')]);router[_0x65c2('0x8')](_0x65c2('0xb'),auth[_0x65c2('0x9')](),controller[_0x65c2('0xc')]);router[_0x65c2('0x8')](_0x65c2('0xd'),auth[_0x65c2('0x9')](),controller[_0x65c2('0xe')]);router[_0x65c2('0xf')]('/',auth[_0x65c2('0x9')](),controller[_0x65c2('0x10')]);router[_0x65c2('0x11')](_0x65c2('0xd'),auth['isAuthenticated'](),controller[_0x65c2('0x12')]);router['delete'](_0x65c2('0xd'),auth[_0x65c2('0x9')](),controller[_0x65c2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0519=['delete','destroy','exports','util','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','/describe','describe','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x0519,0x192));var _0x9051=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x0519[_0x16337a];return _0x422365;};'use strict';var multer=require('multer');var util=require(_0x9051('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9051('0x1'));var router=express['Router']();var fs_extra=require(_0x9051('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x9051('0x3'));var config=require(_0x9051('0x4'));var controller=require(_0x9051('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x9051('0x6')]);router['get'](_0x9051('0x7'),auth['isAuthenticated'](),controller[_0x9051('0x8')]);router['get']('/:id',auth[_0x9051('0x9')](),controller[_0x9051('0xa')]);router[_0x9051('0xb')]('/',auth[_0x9051('0x9')](),controller[_0x9051('0xc')]);router[_0x9051('0xd')](_0x9051('0xe'),auth['isAuthenticated'](),controller[_0x9051('0xf')]);router[_0x9051('0x10')](_0x9051('0xe'),auth[_0x9051('0x9')](),controller[_0x9051('0x11')]);module[_0x9051('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index cbaa378..258c9aa 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 _0xc480=['sequelize','STRING','DATE','moment'];(function(_0x13f4e5,_0x4bba4e){var _0x52caff=function(_0x24360c){while(--_0x24360c){_0x13f4e5['push'](_0x13f4e5['shift']());}};_0x52caff(++_0x4bba4e);}(_0xc480,0xcf));var _0x0c48=function(_0x220e87,_0x1863aa){_0x220e87=_0x220e87-0x0;var _0x5d5a96=_0xc480[_0x220e87];return _0x5d5a96;};'use strict';var moment=require(_0x0c48('0x0'));var Sequelize=require(_0x0c48('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0c48('0x2')]},'joinAt':{'type':Sequelize[_0x0c48('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0c48('0x2')]}}; \ No newline at end of file +var _0x5cae=['STRING','DATE','moment','sequelize','exports'];(function(_0x6337d4,_0xe1bb81){var _0x4f3336=function(_0xba839a){while(--_0xba839a){_0x6337d4['push'](_0x6337d4['shift']());}};_0x4f3336(++_0xe1bb81);}(_0x5cae,0xb1));var _0xe5ca=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x5cae[_0x5a1a51];return _0x47edd7;};'use strict';var moment=require(_0xe5ca('0x0'));var Sequelize=require(_0xe5ca('0x1'));module[_0xe5ca('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe5ca('0x3')]},'joinAt':{'type':Sequelize[_0xe5ca('0x4')]},'leaveAt':{'type':Sequelize[_0xe5ca('0x4')]},'acceptAt':{'type':Sequelize[_0xe5ca('0x4')]},'exitAt':{'type':Sequelize[_0xe5ca('0x4')]},'reason':{'type':Sequelize[_0xe5ca('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f4a47ad..6ea9f07 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 _0x7800=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','filters','filter','where','merge','options','OpenchannelQueueReport','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3bf4d5,_0x366a37){var _0x48fdea=function(_0x665bbe){while(--_0x665bbe){_0x3bf4d5['push'](_0x3bf4d5['shift']());}};_0x48fdea(++_0x366a37);}(_0x7800,0x1ea));var _0x0780=function(_0x372def,_0x49b0f9){_0x372def=_0x372def-0x0;var _0x5b9c36=_0x7800[_0x372def];return _0x5b9c36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0780('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0780('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0780('0x2'));var Mustache=require(_0x0780('0x3'));var util=require(_0x0780('0x4'));var path=require(_0x0780('0x5'));var sox=require(_0x0780('0x6'));var csv=require(_0x0780('0x7'));var ejs=require(_0x0780('0x8'));var fs=require('fs');var fs_extra=require(_0x0780('0x9'));var _=require(_0x0780('0xa'));var squel=require(_0x0780('0xb'));var crypto=require(_0x0780('0xc'));var jsforce=require(_0x0780('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0780('0xe'));var Redis=require(_0x0780('0xf'));var authService=require(_0x0780('0x10'));var qs=require(_0x0780('0x11'));var as=require(_0x0780('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0780('0x13'))(_0x0780('0x14'));var utils=require(_0x0780('0x15'));var config=require(_0x0780('0x16'));var licenseUtil=require(_0x0780('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x272e0c,_0x4bd8ea){_0x4bd8ea=_0x4bd8ea||0xcc;return function(_0x875a92){if(_0x875a92){return _0x272e0c[_0x0780('0x18')](_0x4bd8ea);}return _0x272e0c[_0x0780('0x19')](_0x4bd8ea)['end']();};}function respondWithResult(_0x6d92ce,_0x24b524){_0x24b524=_0x24b524||0xc8;return function(_0x45eb34){if(_0x45eb34){return _0x6d92ce[_0x0780('0x19')](_0x24b524)[_0x0780('0x1a')](_0x45eb34);}};}function respondWithFilteredResult(_0x5460f7,_0x4ea9c4){return function(_0x1bd1ac){if(_0x1bd1ac){var _0x179ba8=typeof _0x4ea9c4[_0x0780('0x1b')]===_0x0780('0x1c')&&typeof _0x4ea9c4[_0x0780('0x1d')]===_0x0780('0x1c');var _0x34887b=_0x1bd1ac[_0x0780('0x1e')];var _0x506e5e=_0x179ba8?0x0:_0x4ea9c4[_0x0780('0x1b')];var _0x124129=_0x179ba8?_0x1bd1ac[_0x0780('0x1e')]:_0x4ea9c4[_0x0780('0x1b')]+_0x4ea9c4[_0x0780('0x1d')];var _0x45ddbc;if(_0x124129>=_0x34887b){_0x124129=_0x34887b;_0x45ddbc=0xc8;}else{_0x45ddbc=0xce;}_0x5460f7[_0x0780('0x19')](_0x45ddbc);return _0x5460f7['set'](_0x0780('0x1f'),_0x506e5e+'-'+_0x124129+'/'+_0x34887b)[_0x0780('0x1a')](_0x1bd1ac);}return null;};}function patchUpdates(_0x5ec7dd){return function(_0x48573a){try{jsonpatch[_0x0780('0x20')](_0x48573a,_0x5ec7dd,!![]);}catch(_0xb767fd){return BPromise[_0x0780('0x21')](_0xb767fd);}return _0x48573a[_0x0780('0x22')]();};}function saveUpdates(_0x3e7730,_0x3227f2){return function(_0x55b954){if(_0x55b954){return _0x55b954[_0x0780('0x23')](_0x3e7730)[_0x0780('0x24')](function(_0xa57b7c){return _0xa57b7c;});}return null;};}function removeEntity(_0x393b59,_0x456a0e){return function(_0x364e74){if(_0x364e74){return _0x364e74['destroy']()[_0x0780('0x24')](function(){_0x393b59[_0x0780('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4543d2,_0x5b787c){return function(_0x1aaffe){if(!_0x1aaffe){_0x4543d2[_0x0780('0x18')](0x194);}return _0x1aaffe;};}function handleError(_0x3bf184,_0x235d17){_0x235d17=_0x235d17||0x1f4;return function(_0x28777a){logger[_0x0780('0x25')](_0x28777a[_0x0780('0x26')]);if(_0x28777a[_0x0780('0x27')]){delete _0x28777a[_0x0780('0x27')];}_0x3bf184[_0x0780('0x19')](_0x235d17)['send'](_0x28777a);};}exports[_0x0780('0x28')]=function(_0x5dd57b,_0x3a88d7){var _0x21cd5d={},_0x55ab89={},_0x267efc={'count':0x0,'rows':[]};var _0x2a33e0=_[_0x0780('0x29')](db['OpenchannelQueueReport'][_0x0780('0x2a')],function(_0x57c31a){return{'name':_0x57c31a[_0x0780('0x2b')],'type':_0x57c31a[_0x0780('0x2c')]['key']};});_0x55ab89[_0x0780('0x2d')]=_[_0x0780('0x29')](_0x2a33e0,_0x0780('0x27'));_0x55ab89['query']=_[_0x0780('0x2e')](_0x5dd57b[_0x0780('0x2f')]);_0x55ab89['filters']=_[_0x0780('0x30')](_0x55ab89[_0x0780('0x2d')],_0x55ab89['query']);_0x21cd5d['attributes']=_[_0x0780('0x30')](_0x55ab89[_0x0780('0x2d')],qs['fields'](_0x5dd57b['query']['fields']));_0x21cd5d[_0x0780('0x31')]=_0x21cd5d[_0x0780('0x31')][_0x0780('0x32')]?_0x21cd5d['attributes']:_0x55ab89[_0x0780('0x2d')];if(!_0x5dd57b[_0x0780('0x2f')][_0x0780('0x33')]('nolimit')){_0x21cd5d[_0x0780('0x1d')]=qs[_0x0780('0x1d')](_0x5dd57b[_0x0780('0x2f')]['limit']);_0x21cd5d['offset']=qs[_0x0780('0x1b')](_0x5dd57b[_0x0780('0x2f')][_0x0780('0x1b')]);}_0x21cd5d[_0x0780('0x34')]=qs[_0x0780('0x35')](_0x5dd57b[_0x0780('0x2f')][_0x0780('0x35')]);_0x21cd5d['where']=qs[_0x0780('0x36')](_['pick'](_0x5dd57b['query'],_0x55ab89['filters']),_0x2a33e0);if(_0x5dd57b['query'][_0x0780('0x37')]){_0x21cd5d[_0x0780('0x38')]=_[_0x0780('0x39')](_0x21cd5d[_0x0780('0x38')],{'$or':_['map'](_0x2a33e0,function(_0x279bcc){if(_0x279bcc[_0x0780('0x2c')]!=='VIRTUAL'){var _0x127044={};_0x127044[_0x279bcc[_0x0780('0x27')]]={'$like':'%'+_0x5dd57b['query'][_0x0780('0x37')]+'%'};return _0x127044;}})});}_0x21cd5d=_[_0x0780('0x39')]({},_0x21cd5d,_0x5dd57b[_0x0780('0x3a')]);var _0x244b11={'where':_0x21cd5d[_0x0780('0x38')]};return db[_0x0780('0x3b')]['count'](_0x244b11)['then'](function(_0x16262d){_0x267efc[_0x0780('0x1e')]=_0x16262d;if(_0x5dd57b[_0x0780('0x2f')][_0x0780('0x3c')]){_0x21cd5d['include']=[{'all':!![]}];}return db[_0x0780('0x3b')][_0x0780('0x3d')](_0x21cd5d);})['then'](function(_0x102b90){_0x267efc[_0x0780('0x3e')]=_0x102b90;return _0x267efc;})[_0x0780('0x24')](respondWithFilteredResult(_0x3a88d7,_0x21cd5d))[_0x0780('0x3f')](handleError(_0x3a88d7,null));};exports[_0x0780('0x40')]=function(_0x4ef853,_0x5d86a0){var _0x4df61f={'raw':!![],'where':{'id':_0x4ef853[_0x0780('0x41')]['id']}},_0x200eb7={};_0x200eb7[_0x0780('0x2d')]=_[_0x0780('0x2e')](db[_0x0780('0x3b')][_0x0780('0x2a')]);_0x200eb7[_0x0780('0x2f')]=_[_0x0780('0x2e')](_0x4ef853[_0x0780('0x2f')]);_0x200eb7[_0x0780('0x36')]=_['intersection'](_0x200eb7[_0x0780('0x2d')],_0x200eb7[_0x0780('0x2f')]);_0x4df61f['attributes']=_['intersection'](_0x200eb7[_0x0780('0x2d')],qs[_0x0780('0x42')](_0x4ef853[_0x0780('0x2f')][_0x0780('0x42')]));_0x4df61f['attributes']=_0x4df61f[_0x0780('0x31')][_0x0780('0x32')]?_0x4df61f[_0x0780('0x31')]:_0x200eb7[_0x0780('0x2d')];if(_0x4ef853[_0x0780('0x2f')][_0x0780('0x3c')]){_0x4df61f[_0x0780('0x43')]=[{'all':!![]}];}_0x4df61f=_[_0x0780('0x39')]({},_0x4df61f,_0x4ef853[_0x0780('0x3a')]);return db[_0x0780('0x3b')][_0x0780('0x44')](_0x4df61f)['then'](handleEntityNotFound(_0x5d86a0,null))[_0x0780('0x24')](respondWithResult(_0x5d86a0,null))[_0x0780('0x3f')](handleError(_0x5d86a0,null));};exports[_0x0780('0x45')]=function(_0x327875,_0x4e4d9b){return db['OpenchannelQueueReport'][_0x0780('0x45')](_0x327875['body'],{})[_0x0780('0x24')](respondWithResult(_0x4e4d9b,0xc9))[_0x0780('0x3f')](handleError(_0x4e4d9b,null));};exports[_0x0780('0x23')]=function(_0x500bf0,_0x33df6e){if(_0x500bf0[_0x0780('0x46')]['id']){delete _0x500bf0[_0x0780('0x46')]['id'];}return db[_0x0780('0x3b')]['find']({'where':{'id':_0x500bf0[_0x0780('0x41')]['id']}})[_0x0780('0x24')](handleEntityNotFound(_0x33df6e,null))[_0x0780('0x24')](saveUpdates(_0x500bf0[_0x0780('0x46')],null))[_0x0780('0x24')](respondWithResult(_0x33df6e,null))['catch'](handleError(_0x33df6e,null));};exports['destroy']=function(_0x24b477,_0xb85e0c){return db[_0x0780('0x3b')][_0x0780('0x44')]({'where':{'id':_0x24b477[_0x0780('0x41')]['id']}})['then'](handleEntityNotFound(_0xb85e0c,null))[_0x0780('0x24')](removeEntity(_0xb85e0c,null))[_0x0780('0x3f')](handleError(_0xb85e0c,null));};exports[_0x0780('0x47')]=function(_0xb1685,_0x5b49eb){return db[_0x0780('0x3b')][_0x0780('0x47')]()[_0x0780('0x24')](respondWithResult(_0x5b49eb,null))[_0x0780('0x3f')](handleError(_0x5b49eb,null));}; \ No newline at end of file +var _0x0041=['send','index','map','OpenchannelQueueReport','rawAttributes','type','key','keys','filters','query','attributes','intersection','fields','length','model','hasOwnProperty','order','sort','where','pick','merge','includeAll','include','findAll','rows','show','options','find','create','body','catch','destroy','params','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name'];(function(_0xd18a0d,_0x4ea531){var _0x19197a=function(_0x3bb78a){while(--_0x3bb78a){_0xd18a0d['push'](_0xd18a0d['shift']());}};_0x19197a(++_0x4ea531);}(_0x0041,0xb8));var _0x1004=function(_0x4e6165,_0x1b1097){_0x4e6165=_0x4e6165-0x0;var _0x4280f8=_0x0041[_0x4e6165];return _0x4280f8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1004('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1004('0x1'));var moment=require(_0x1004('0x2'));var BPromise=require(_0x1004('0x3'));var Mustache=require(_0x1004('0x4'));var util=require(_0x1004('0x5'));var path=require(_0x1004('0x6'));var sox=require(_0x1004('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1004('0x8'));var _=require(_0x1004('0x9'));var squel=require('squel');var crypto=require(_0x1004('0xa'));var jsforce=require(_0x1004('0xb'));var deskjs=require(_0x1004('0xc'));var toCsv=require(_0x1004('0xd'));var querystring=require('querystring');var Papa=require(_0x1004('0xe'));var Redis=require(_0x1004('0xf'));var authService=require(_0x1004('0x10'));var qs=require(_0x1004('0x11'));var as=require(_0x1004('0x12'));var hardwareService=require(_0x1004('0x13'));var logger=require(_0x1004('0x14'))(_0x1004('0x15'));var utils=require(_0x1004('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1004('0x17'));var db=require(_0x1004('0x18'))['db'];function respondWithStatusCode(_0x372c1c,_0x4b337f){_0x4b337f=_0x4b337f||0xcc;return function(_0x3cc1fd){if(_0x3cc1fd){return _0x372c1c[_0x1004('0x19')](_0x4b337f);}return _0x372c1c[_0x1004('0x1a')](_0x4b337f)[_0x1004('0x1b')]();};}function respondWithResult(_0x34b06a,_0x122a56){_0x122a56=_0x122a56||0xc8;return function(_0x26d19e){if(_0x26d19e){return _0x34b06a[_0x1004('0x1a')](_0x122a56)[_0x1004('0x1c')](_0x26d19e);}};}function respondWithFilteredResult(_0x117a3c,_0x51d555){return function(_0x1b6659){if(_0x1b6659){var _0x3dbdb0=typeof _0x51d555[_0x1004('0x1d')]===_0x1004('0x1e')&&typeof _0x51d555['limit']===_0x1004('0x1e');var _0x4c98b5=_0x1b6659[_0x1004('0x1f')];var _0x597886=_0x3dbdb0?0x0:_0x51d555[_0x1004('0x1d')];var _0x328f6e=_0x3dbdb0?_0x1b6659[_0x1004('0x1f')]:_0x51d555['offset']+_0x51d555[_0x1004('0x20')];var _0x460f3;if(_0x328f6e>=_0x4c98b5){_0x328f6e=_0x4c98b5;_0x460f3=0xc8;}else{_0x460f3=0xce;}_0x117a3c[_0x1004('0x1a')](_0x460f3);return _0x117a3c[_0x1004('0x21')]('Content-Range',_0x597886+'-'+_0x328f6e+'/'+_0x4c98b5)[_0x1004('0x1c')](_0x1b6659);}return null;};}function patchUpdates(_0x2c0ca1){return function(_0x56f285){try{jsonpatch[_0x1004('0x22')](_0x56f285,_0x2c0ca1,!![]);}catch(_0x3e409c){return BPromise[_0x1004('0x23')](_0x3e409c);}return _0x56f285[_0x1004('0x24')]();};}function saveUpdates(_0x5b21f4,_0x12760b){return function(_0x47132e){if(_0x47132e){return _0x47132e[_0x1004('0x25')](_0x5b21f4)[_0x1004('0x26')](function(_0x302011){return _0x302011;});}return null;};}function removeEntity(_0x211153,_0x3f11ef){return function(_0x398567){if(_0x398567){return _0x398567['destroy']()[_0x1004('0x26')](function(){_0x211153[_0x1004('0x1a')](0xcc)[_0x1004('0x1b')]();});}};}function handleEntityNotFound(_0x58b58e,_0x17a6b1){return function(_0x194fe0){if(!_0x194fe0){_0x58b58e[_0x1004('0x19')](0x194);}return _0x194fe0;};}function handleError(_0x425617,_0x273809){_0x273809=_0x273809||0x1f4;return function(_0x1ad2b4){logger['error'](_0x1ad2b4[_0x1004('0x27')]);if(_0x1ad2b4[_0x1004('0x28')]){delete _0x1ad2b4[_0x1004('0x28')];}_0x425617[_0x1004('0x1a')](_0x273809)[_0x1004('0x29')](_0x1ad2b4);};}exports[_0x1004('0x2a')]=function(_0x56bdaa,_0x5db758){var _0x3cbd79={},_0x2487fd={},_0x57afbe={'count':0x0,'rows':[]};var _0x4284f6=_[_0x1004('0x2b')](db[_0x1004('0x2c')][_0x1004('0x2d')],function(_0x2bb76a){return{'name':_0x2bb76a['fieldName'],'type':_0x2bb76a[_0x1004('0x2e')][_0x1004('0x2f')]};});_0x2487fd['model']=_['map'](_0x4284f6,_0x1004('0x28'));_0x2487fd['query']=_[_0x1004('0x30')](_0x56bdaa['query']);_0x2487fd[_0x1004('0x31')]=_['intersection'](_0x2487fd['model'],_0x2487fd[_0x1004('0x32')]);_0x3cbd79[_0x1004('0x33')]=_[_0x1004('0x34')](_0x2487fd['model'],qs[_0x1004('0x35')](_0x56bdaa[_0x1004('0x32')][_0x1004('0x35')]));_0x3cbd79[_0x1004('0x33')]=_0x3cbd79[_0x1004('0x33')][_0x1004('0x36')]?_0x3cbd79[_0x1004('0x33')]:_0x2487fd[_0x1004('0x37')];if(!_0x56bdaa['query'][_0x1004('0x38')]('nolimit')){_0x3cbd79['limit']=qs[_0x1004('0x20')](_0x56bdaa[_0x1004('0x32')][_0x1004('0x20')]);_0x3cbd79[_0x1004('0x1d')]=qs[_0x1004('0x1d')](_0x56bdaa['query'][_0x1004('0x1d')]);}_0x3cbd79[_0x1004('0x39')]=qs[_0x1004('0x3a')](_0x56bdaa['query'][_0x1004('0x3a')]);_0x3cbd79[_0x1004('0x3b')]=qs[_0x1004('0x31')](_[_0x1004('0x3c')](_0x56bdaa[_0x1004('0x32')],_0x2487fd[_0x1004('0x31')]),_0x4284f6);if(_0x56bdaa[_0x1004('0x32')]['filter']){_0x3cbd79[_0x1004('0x3b')]=_['merge'](_0x3cbd79[_0x1004('0x3b')],{'$or':_[_0x1004('0x2b')](_0x4284f6,function(_0x309d27){if(_0x309d27[_0x1004('0x2e')]!=='VIRTUAL'){var _0x4bf247={};_0x4bf247[_0x309d27[_0x1004('0x28')]]={'$like':'%'+_0x56bdaa[_0x1004('0x32')]['filter']+'%'};return _0x4bf247;}})});}_0x3cbd79=_[_0x1004('0x3d')]({},_0x3cbd79,_0x56bdaa['options']);var _0x11367f={'where':_0x3cbd79['where']};return db[_0x1004('0x2c')][_0x1004('0x1f')](_0x11367f)[_0x1004('0x26')](function(_0x266d8e){_0x57afbe[_0x1004('0x1f')]=_0x266d8e;if(_0x56bdaa['query'][_0x1004('0x3e')]){_0x3cbd79[_0x1004('0x3f')]=[{'all':!![]}];}return db[_0x1004('0x2c')][_0x1004('0x40')](_0x3cbd79);})[_0x1004('0x26')](function(_0x2d1873){_0x57afbe[_0x1004('0x41')]=_0x2d1873;return _0x57afbe;})[_0x1004('0x26')](respondWithFilteredResult(_0x5db758,_0x3cbd79))['catch'](handleError(_0x5db758,null));};exports[_0x1004('0x42')]=function(_0xae1e3a,_0x2af6ce){var _0x10ea12={'raw':!![],'where':{'id':_0xae1e3a['params']['id']}},_0x20b32f={};_0x20b32f[_0x1004('0x37')]=_[_0x1004('0x30')](db[_0x1004('0x2c')][_0x1004('0x2d')]);_0x20b32f[_0x1004('0x32')]=_[_0x1004('0x30')](_0xae1e3a['query']);_0x20b32f[_0x1004('0x31')]=_[_0x1004('0x34')](_0x20b32f['model'],_0x20b32f[_0x1004('0x32')]);_0x10ea12['attributes']=_[_0x1004('0x34')](_0x20b32f['model'],qs[_0x1004('0x35')](_0xae1e3a[_0x1004('0x32')][_0x1004('0x35')]));_0x10ea12[_0x1004('0x33')]=_0x10ea12['attributes'][_0x1004('0x36')]?_0x10ea12[_0x1004('0x33')]:_0x20b32f[_0x1004('0x37')];if(_0xae1e3a[_0x1004('0x32')][_0x1004('0x3e')]){_0x10ea12[_0x1004('0x3f')]=[{'all':!![]}];}_0x10ea12=_[_0x1004('0x3d')]({},_0x10ea12,_0xae1e3a[_0x1004('0x43')]);return db[_0x1004('0x2c')][_0x1004('0x44')](_0x10ea12)['then'](handleEntityNotFound(_0x2af6ce,null))[_0x1004('0x26')](respondWithResult(_0x2af6ce,null))['catch'](handleError(_0x2af6ce,null));};exports[_0x1004('0x45')]=function(_0x11eb0f,_0x4ef402){return db[_0x1004('0x2c')]['create'](_0x11eb0f[_0x1004('0x46')],{})[_0x1004('0x26')](respondWithResult(_0x4ef402,0xc9))[_0x1004('0x47')](handleError(_0x4ef402,null));};exports['update']=function(_0x39f843,_0x4644d2){if(_0x39f843[_0x1004('0x46')]['id']){delete _0x39f843['body']['id'];}return db[_0x1004('0x2c')]['find']({'where':{'id':_0x39f843['params']['id']}})[_0x1004('0x26')](handleEntityNotFound(_0x4644d2,null))[_0x1004('0x26')](saveUpdates(_0x39f843['body'],null))[_0x1004('0x26')](respondWithResult(_0x4644d2,null))[_0x1004('0x47')](handleError(_0x4644d2,null));};exports[_0x1004('0x48')]=function(_0x4d0b50,_0x22982b){return db[_0x1004('0x2c')][_0x1004('0x44')]({'where':{'id':_0x4d0b50[_0x1004('0x49')]['id']}})[_0x1004('0x26')](handleEntityNotFound(_0x22982b,null))[_0x1004('0x26')](removeEntity(_0x22982b,null))['catch'](handleError(_0x22982b,null));};exports[_0x1004('0x4a')]=function(_0x4e91c0,_0x899b4a){return db[_0x1004('0x2c')][_0x1004('0x4a')]()[_0x1004('0x26')](respondWithResult(_0x899b4a,null))['catch'](handleError(_0x899b4a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index fe85491..fadfddc 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x2ef3,0xba));var _0x32ef=function(_0x424435,_0x47fbf8){_0x424435=_0x424435-0x0;var _0x57831f=_0x2ef3[_0x424435];return _0x57831f;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x1fdb81,_0x583d45){var _0x398d2b=function(_0x2012f3){while(--_0x2012f3){_0x1fdb81['push'](_0x1fdb81['shift']());}};_0x398d2b(++_0x583d45);}(_0x7a54,0x106));var _0x47a5=function(_0x3b4c3d,_0x2ce106){_0x3b4c3d=_0x3b4c3d-0x0;var _0x29a4a4=_0x7a54[_0x3b4c3d];return _0x29a4a4;};'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':'uniqueid','fields':[_0x47a5('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 22c4086..2e97aac 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 _0x0e56=['OpenchannelQueueReport','update','raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','body','options'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x0e56,0xf5));var _0x60e5=function(_0x11280c,_0x4e8f92){_0x11280c=_0x11280c-0x0;var _0x5999ac=_0x0e56[_0x11280c];return _0x5999ac;};'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);});});}exports[_0x60e5('0x18')]=function(_0x12aee7){var _0x3060b6=this;return new Promise(function(_0x51688a,_0x599dc4){return db['OpenchannelQueueReport']['create'](_0x12aee7[_0x60e5('0x19')],{'raw':_0x12aee7[_0x60e5('0x1a')]?_0x12aee7[_0x60e5('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x60e5('0xc')](function(_0x68c78){logger[_0x60e5('0xd')](_0x60e5('0x18'),_0x12aee7);logger[_0x60e5('0x10')](_0x60e5('0x18'),_0x12aee7,JSON[_0x60e5('0x12')](_0x68c78));_0x51688a(_0x68c78);})[_0x60e5('0x17')](function(_0x443665){logger[_0x60e5('0x13')](_0x60e5('0x18'),_0x443665['message'],_0x12aee7);_0x599dc4(_0x3060b6['error'](0x1f4,_0x443665[_0x60e5('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x5a2b4d){var _0x2c692d=this;return new Promise(function(_0x58e43b,_0x200da3){return db[_0x60e5('0x1b')][_0x60e5('0x1c')](_0x5a2b4d[_0x60e5('0x19')],{'raw':_0x5a2b4d[_0x60e5('0x1a')]?_0x5a2b4d['options'][_0x60e5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2b4d['options']?_0x5a2b4d[_0x60e5('0x1a')][_0x60e5('0x1e')]||null:null,'attributes':_0x5a2b4d[_0x60e5('0x1a')]?_0x5a2b4d['options'][_0x60e5('0x1f')]||null:null,'limit':_0x5a2b4d[_0x60e5('0x1a')]?_0x5a2b4d['options'][_0x60e5('0x20')]||null:null})[_0x60e5('0xc')](function(_0x46ebed){logger['info'](_0x60e5('0x21'),_0x5a2b4d);logger[_0x60e5('0x10')](_0x60e5('0x21'),_0x5a2b4d,JSON[_0x60e5('0x12')](_0x46ebed));_0x58e43b(_0x46ebed);})[_0x60e5('0x17')](function(_0x40ce94){logger[_0x60e5('0x13')](_0x60e5('0x21'),_0x40ce94[_0x60e5('0x15')],_0x5a2b4d);_0x200da3(_0x2c692d[_0x60e5('0x13')](0x1f4,_0x40ce94[_0x60e5('0x15')]));});});}; \ No newline at end of file +var _0x14a0=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent'];(function(_0x14ea32,_0x262909){var _0x137bbb=function(_0x4a36ab){while(--_0x4a36ab){_0x14ea32['push'](_0x14ea32['shift']());}};_0x137bbb(++_0x262909);}(_0x14a0,0x8e));var _0x014a=function(_0x3efc9f,_0x259b99){_0x3efc9f=_0x3efc9f-0x0;var _0x42c8c4=_0x14a0[_0x3efc9f];return _0x42c8c4;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x014a('0xa')](function(_0x109a9c){logger[_0x014a('0x12')](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x109a9c));_0x263b07(_0x109a9c);})[_0x014a('0x14')](function(_0x290b86){logger['error'](_0x014a('0x15'),_0x290b86['message'],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x290b86[_0x014a('0x11')]));});});};exports[_0x014a('0x1a')]=function(_0x36d52b){var _0x2b3c10=this;return new Promise(function(_0x113b12,_0x3fec9f){return db[_0x014a('0x16')][_0x014a('0x1b')](_0x36d52b['body'],{'raw':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options'][_0x014a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options']['where']||null:null,'attributes':_0x36d52b[_0x014a('0x19')]?_0x36d52b[_0x014a('0x19')][_0x014a('0x1d')]||null:null,'limit':_0x36d52b['options']?_0x36d52b[_0x014a('0x19')][_0x014a('0x1e')]||null:null})['then'](function(_0x31dc95){logger[_0x014a('0x12')]('UpdateOpenchannelQueueReport',_0x36d52b);logger['debug'](_0x014a('0x1a'),_0x36d52b,JSON[_0x014a('0xd')](_0x31dc95));_0x113b12(_0x31dc95);})[_0x014a('0x14')](function(_0x29fce5){logger['error'](_0x014a('0x1a'),_0x29fce5[_0x014a('0x11')],_0x36d52b);_0x3fec9f(_0x2b3c10[_0x014a('0xe')](0x1f4,_0x29fce5[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 5aac2c9..b82b111 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 _0x78cf=['/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x78cf,0xdc));var _0xf78c=function(_0x367b9e,_0x297344){_0x367b9e=_0x367b9e-0x0;var _0x35da40=_0x78cf[_0x367b9e];return _0x35da40;};'use strict';var multer=require(_0xf78c('0x0'));var util=require(_0xf78c('0x1'));var path=require('path');var timeout=require(_0xf78c('0x2'));var express=require(_0xf78c('0x3'));var router=express[_0xf78c('0x4')]();var fs_extra=require(_0xf78c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf78c('0x6'));var config=require(_0xf78c('0x7'));var controller=require(_0xf78c('0x8'));router[_0xf78c('0x9')]('/',auth['isAuthenticated'](),controller[_0xf78c('0xa')]);router['get'](_0xf78c('0xb'),auth[_0xf78c('0xc')](),controller[_0xf78c('0xd')]);router[_0xf78c('0x9')](_0xf78c('0xe'),auth[_0xf78c('0xc')](),controller['show']);router[_0xf78c('0xf')]('/',auth[_0xf78c('0xc')](),controller[_0xf78c('0x10')]);router[_0xf78c('0x11')](_0xf78c('0xe'),auth[_0xf78c('0xc')](),controller[_0xf78c('0x12')]);router[_0xf78c('0x13')](_0xf78c('0xe'),auth[_0xf78c('0xc')](),controller[_0xf78c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe2c2=['post','create','put','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2fa895,_0x44b2c3){var _0x2df77a=function(_0x149070){while(--_0x149070){_0x2fa895['push'](_0x2fa895['shift']());}};_0x2df77a(++_0x44b2c3);}(_0xe2c2,0x1f2));var _0x2e2c=function(_0x539fd4,_0x5aa50e){_0x539fd4=_0x539fd4-0x0;var _0x47423f=_0xe2c2[_0x539fd4];return _0x47423f;};'use strict';var multer=require(_0x2e2c('0x0'));var util=require(_0x2e2c('0x1'));var path=require(_0x2e2c('0x2'));var timeout=require(_0x2e2c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2e2c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2e2c('0x5'));var controller=require('./openchannelTransferReport.controller');router[_0x2e2c('0x6')]('/',auth[_0x2e2c('0x7')](),controller[_0x2e2c('0x8')]);router[_0x2e2c('0x6')](_0x2e2c('0x9'),auth[_0x2e2c('0x7')](),controller[_0x2e2c('0xa')]);router[_0x2e2c('0x6')](_0x2e2c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2e2c('0xc')]('/',auth[_0x2e2c('0x7')](),controller[_0x2e2c('0xd')]);router[_0x2e2c('0xe')](_0x2e2c('0xb'),auth[_0x2e2c('0x7')](),controller['update']);router[_0x2e2c('0xf')](_0x2e2c('0xb'),auth[_0x2e2c('0x7')](),controller[_0x2e2c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 9163862..559afd3 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0xb43b,0x1b2));var _0xbb43=function(_0x57fa17,_0x31219d){_0x57fa17=_0x57fa17-0x0;var _0x18be1a=_0xb43b[_0x57fa17];return _0x18be1a;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x40dec9,_0x1cc7a7){_0x40dec9=_0x40dec9-0x0;var _0x113613=_0x9bde[_0x40dec9];return _0x113613;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 6266b1f..d18dc78 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 _0x0faf=['util','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','findAll','rows','catch','show','includeAll','include','create','body','find','params','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x2fcc61,_0x1498b8){var _0x3a2e3d=function(_0x26b05f){while(--_0x26b05f){_0x2fcc61['push'](_0x2fcc61['shift']());}};_0x3a2e3d(++_0x1498b8);}(_0x0faf,0x8b));var _0xf0fa=function(_0x170bba,_0x2be92f){_0x170bba=_0x170bba-0x0;var _0xa7c249=_0x0faf[_0x170bba];return _0xa7c249;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0fa('0x0'));var jsonpatch=require(_0xf0fa('0x1'));var rp=require(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0fa('0x4'));var util=require(_0xf0fa('0x5'));var path=require('path');var sox=require(_0xf0fa('0x6'));var csv=require('to-csv');var ejs=require(_0xf0fa('0x7'));var fs=require('fs');var fs_extra=require(_0xf0fa('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf0fa('0x9'));var jsforce=require(_0xf0fa('0xa'));var deskjs=require(_0xf0fa('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf0fa('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf0fa('0xd'));var qs=require(_0xf0fa('0xe'));var as=require(_0xf0fa('0xf'));var hardwareService=require(_0xf0fa('0x10'));var logger=require(_0xf0fa('0x11'))(_0xf0fa('0x12'));var utils=require(_0xf0fa('0x13'));var config=require(_0xf0fa('0x14'));var licenseUtil=require(_0xf0fa('0x15'));var db=require(_0xf0fa('0x16'))['db'];function respondWithStatusCode(_0x561def,_0x20cb85){_0x20cb85=_0x20cb85||0xcc;return function(_0xbc09d5){if(_0xbc09d5){return _0x561def[_0xf0fa('0x17')](_0x20cb85);}return _0x561def[_0xf0fa('0x18')](_0x20cb85)[_0xf0fa('0x19')]();};}function respondWithResult(_0x13dee4,_0x3b35b3){_0x3b35b3=_0x3b35b3||0xc8;return function(_0x18ef44){if(_0x18ef44){return _0x13dee4[_0xf0fa('0x18')](_0x3b35b3)[_0xf0fa('0x1a')](_0x18ef44);}};}function respondWithFilteredResult(_0x164141,_0x2eb7bc){return function(_0x689a39){if(_0x689a39){var _0x500410=typeof _0x2eb7bc[_0xf0fa('0x1b')]==='undefined'&&typeof _0x2eb7bc['limit']==='undefined';var _0x66649b=_0x689a39['count'];var _0x36e122=_0x500410?0x0:_0x2eb7bc[_0xf0fa('0x1b')];var _0x2d5382=_0x500410?_0x689a39[_0xf0fa('0x1c')]:_0x2eb7bc['offset']+_0x2eb7bc['limit'];var _0xc76462;if(_0x2d5382>=_0x66649b){_0x2d5382=_0x66649b;_0xc76462=0xc8;}else{_0xc76462=0xce;}_0x164141['status'](_0xc76462);return _0x164141[_0xf0fa('0x1d')](_0xf0fa('0x1e'),_0x36e122+'-'+_0x2d5382+'/'+_0x66649b)[_0xf0fa('0x1a')](_0x689a39);}return null;};}function patchUpdates(_0x2e0ad2){return function(_0x17d0ad){try{jsonpatch['apply'](_0x17d0ad,_0x2e0ad2,!![]);}catch(_0x570671){return BPromise[_0xf0fa('0x1f')](_0x570671);}return _0x17d0ad['save']();};}function saveUpdates(_0x517541,_0x973547){return function(_0x5b1b87){if(_0x5b1b87){return _0x5b1b87[_0xf0fa('0x20')](_0x517541)[_0xf0fa('0x21')](function(_0x482099){return _0x482099;});}return null;};}function removeEntity(_0x328f0f,_0x3376c1){return function(_0x46658e){if(_0x46658e){return _0x46658e['destroy']()['then'](function(){_0x328f0f[_0xf0fa('0x18')](0xcc)[_0xf0fa('0x19')]();});}};}function handleEntityNotFound(_0x566edb,_0x422ff0){return function(_0xd6e972){if(!_0xd6e972){_0x566edb['sendStatus'](0x194);}return _0xd6e972;};}function handleError(_0x2d09c3,_0x5cf9e5){_0x5cf9e5=_0x5cf9e5||0x1f4;return function(_0x2837da){logger[_0xf0fa('0x22')](_0x2837da[_0xf0fa('0x23')]);if(_0x2837da[_0xf0fa('0x24')]){delete _0x2837da[_0xf0fa('0x24')];}_0x2d09c3[_0xf0fa('0x18')](_0x5cf9e5)[_0xf0fa('0x25')](_0x2837da);};}exports[_0xf0fa('0x26')]=function(_0x4594d8,_0x4a9099){var _0x1e2461={},_0x495d9d={},_0x1b2bd9={'count':0x0,'rows':[]};var _0x54ca68=_[_0xf0fa('0x27')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x2a25b9){return{'name':_0x2a25b9[_0xf0fa('0x28')],'type':_0x2a25b9[_0xf0fa('0x29')]['key']};});_0x495d9d['model']=_[_0xf0fa('0x27')](_0x54ca68,_0xf0fa('0x24'));_0x495d9d[_0xf0fa('0x2a')]=_[_0xf0fa('0x2b')](_0x4594d8['query']);_0x495d9d[_0xf0fa('0x2c')]=_[_0xf0fa('0x2d')](_0x495d9d[_0xf0fa('0x2e')],_0x495d9d[_0xf0fa('0x2a')]);_0x1e2461[_0xf0fa('0x2f')]=_[_0xf0fa('0x2d')](_0x495d9d[_0xf0fa('0x2e')],qs[_0xf0fa('0x30')](_0x4594d8[_0xf0fa('0x2a')][_0xf0fa('0x30')]));_0x1e2461[_0xf0fa('0x2f')]=_0x1e2461[_0xf0fa('0x2f')][_0xf0fa('0x31')]?_0x1e2461[_0xf0fa('0x2f')]:_0x495d9d[_0xf0fa('0x2e')];if(!_0x4594d8[_0xf0fa('0x2a')][_0xf0fa('0x32')](_0xf0fa('0x33'))){_0x1e2461[_0xf0fa('0x34')]=qs['limit'](_0x4594d8['query'][_0xf0fa('0x34')]);_0x1e2461['offset']=qs[_0xf0fa('0x1b')](_0x4594d8[_0xf0fa('0x2a')][_0xf0fa('0x1b')]);}_0x1e2461[_0xf0fa('0x35')]=qs[_0xf0fa('0x36')](_0x4594d8[_0xf0fa('0x2a')][_0xf0fa('0x36')]);_0x1e2461[_0xf0fa('0x37')]=qs[_0xf0fa('0x2c')](_[_0xf0fa('0x38')](_0x4594d8[_0xf0fa('0x2a')],_0x495d9d[_0xf0fa('0x2c')]),_0x54ca68);if(_0x4594d8['query'][_0xf0fa('0x39')]){_0x1e2461[_0xf0fa('0x37')]=_[_0xf0fa('0x3a')](_0x1e2461[_0xf0fa('0x37')],{'$or':_[_0xf0fa('0x27')](_0x54ca68,function(_0x1e0837){if(_0x1e0837[_0xf0fa('0x29')]!==_0xf0fa('0x3b')){var _0x343076={};_0x343076[_0x1e0837[_0xf0fa('0x24')]]={'$like':'%'+_0x4594d8[_0xf0fa('0x2a')][_0xf0fa('0x39')]+'%'};return _0x343076;}})});}_0x1e2461=_['merge']({},_0x1e2461,_0x4594d8[_0xf0fa('0x3c')]);var _0x44fb9a={'where':_0x1e2461['where']};return db[_0xf0fa('0x3d')][_0xf0fa('0x1c')](_0x44fb9a)[_0xf0fa('0x21')](function(_0xb9aeb0){_0x1b2bd9['count']=_0xb9aeb0;if(_0x4594d8[_0xf0fa('0x2a')]['includeAll']){_0x1e2461['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xf0fa('0x3e')](_0x1e2461);})[_0xf0fa('0x21')](function(_0x3190be){_0x1b2bd9[_0xf0fa('0x3f')]=_0x3190be;return _0x1b2bd9;})[_0xf0fa('0x21')](respondWithFilteredResult(_0x4a9099,_0x1e2461))[_0xf0fa('0x40')](handleError(_0x4a9099,null));};exports[_0xf0fa('0x41')]=function(_0x5522b5,_0x25c61f){var _0x29203d={'raw':!![],'where':{'id':_0x5522b5['params']['id']}},_0x1bf118={};_0x1bf118['model']=_[_0xf0fa('0x2b')](db[_0xf0fa('0x3d')]['rawAttributes']);_0x1bf118['query']=_[_0xf0fa('0x2b')](_0x5522b5[_0xf0fa('0x2a')]);_0x1bf118['filters']=_[_0xf0fa('0x2d')](_0x1bf118['model'],_0x1bf118[_0xf0fa('0x2a')]);_0x29203d[_0xf0fa('0x2f')]=_['intersection'](_0x1bf118[_0xf0fa('0x2e')],qs[_0xf0fa('0x30')](_0x5522b5[_0xf0fa('0x2a')][_0xf0fa('0x30')]));_0x29203d[_0xf0fa('0x2f')]=_0x29203d['attributes'][_0xf0fa('0x31')]?_0x29203d[_0xf0fa('0x2f')]:_0x1bf118[_0xf0fa('0x2e')];if(_0x5522b5[_0xf0fa('0x2a')][_0xf0fa('0x42')]){_0x29203d[_0xf0fa('0x43')]=[{'all':!![]}];}_0x29203d=_[_0xf0fa('0x3a')]({},_0x29203d,_0x5522b5[_0xf0fa('0x3c')]);return db[_0xf0fa('0x3d')]['find'](_0x29203d)[_0xf0fa('0x21')](handleEntityNotFound(_0x25c61f,null))[_0xf0fa('0x21')](respondWithResult(_0x25c61f,null))['catch'](handleError(_0x25c61f,null));};exports['create']=function(_0x5989b9,_0x5b53a1){return db[_0xf0fa('0x3d')][_0xf0fa('0x44')](_0x5989b9['body'],{})[_0xf0fa('0x21')](respondWithResult(_0x5b53a1,0xc9))[_0xf0fa('0x40')](handleError(_0x5b53a1,null));};exports[_0xf0fa('0x20')]=function(_0x3e9591,_0x581454){if(_0x3e9591[_0xf0fa('0x45')]['id']){delete _0x3e9591[_0xf0fa('0x45')]['id'];}return db[_0xf0fa('0x3d')][_0xf0fa('0x46')]({'where':{'id':_0x3e9591[_0xf0fa('0x47')]['id']}})[_0xf0fa('0x21')](handleEntityNotFound(_0x581454,null))[_0xf0fa('0x21')](saveUpdates(_0x3e9591[_0xf0fa('0x45')],null))['then'](respondWithResult(_0x581454,null))[_0xf0fa('0x40')](handleError(_0x581454,null));};exports['destroy']=function(_0x253137,_0x47381d){return db[_0xf0fa('0x3d')]['find']({'where':{'id':_0x253137[_0xf0fa('0x47')]['id']}})[_0xf0fa('0x21')](handleEntityNotFound(_0x47381d,null))['then'](removeEntity(_0x47381d,null))[_0xf0fa('0x40')](handleError(_0x47381d,null));};exports['describe']=function(_0x599a73,_0x411b88){return db[_0xf0fa('0x3d')]['describe']()[_0xf0fa('0x21')](respondWithResult(_0x411b88,null))[_0xf0fa('0x40')](handleError(_0x411b88,null));}; \ No newline at end of file +var _0x01fa=['limit','undefined','count','set','apply','reject','save','then','end','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','length','options','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x01fa,0x1b1));var _0xa01f=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x01fa[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0xa01f('0x0'));var rimraf=require(_0xa01f('0x1'));var zipdir=require(_0xa01f('0x2'));var jsonpatch=require(_0xa01f('0x3'));var rp=require(_0xa01f('0x4'));var moment=require('moment');var BPromise=require(_0xa01f('0x5'));var Mustache=require('mustache');var util=require(_0xa01f('0x6'));var path=require(_0xa01f('0x7'));var sox=require(_0xa01f('0x8'));var csv=require('to-csv');var ejs=require(_0xa01f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa01f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa01f('0xb'));var deskjs=require(_0xa01f('0xc'));var toCsv=require(_0xa01f('0xd'));var querystring=require(_0xa01f('0xe'));var Papa=require(_0xa01f('0xf'));var Redis=require('ioredis');var authService=require(_0xa01f('0x10'));var qs=require(_0xa01f('0x11'));var as=require(_0xa01f('0x12'));var hardwareService=require(_0xa01f('0x13'));var logger=require(_0xa01f('0x14'))(_0xa01f('0x15'));var utils=require(_0xa01f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa01f('0x17'));var db=require(_0xa01f('0x18'))['db'];function respondWithStatusCode(_0x292666,_0xaf5572){_0xaf5572=_0xaf5572||0xcc;return function(_0x5d8d52){if(_0x5d8d52){return _0x292666[_0xa01f('0x19')](_0xaf5572);}return _0x292666[_0xa01f('0x1a')](_0xaf5572)['end']();};}function respondWithResult(_0x4911ec,_0x2f5b28){_0x2f5b28=_0x2f5b28||0xc8;return function(_0x351ffd){if(_0x351ffd){return _0x4911ec[_0xa01f('0x1a')](_0x2f5b28)[_0xa01f('0x1b')](_0x351ffd);}};}function respondWithFilteredResult(_0x893f10,_0x2963b5){return function(_0x4d9314){if(_0x4d9314){var _0x4d142f=typeof _0x2963b5[_0xa01f('0x1c')]==='undefined'&&typeof _0x2963b5[_0xa01f('0x1d')]===_0xa01f('0x1e');var _0x3a32c2=_0x4d9314[_0xa01f('0x1f')];var _0xa9acdf=_0x4d142f?0x0:_0x2963b5[_0xa01f('0x1c')];var _0x293998=_0x4d142f?_0x4d9314[_0xa01f('0x1f')]:_0x2963b5[_0xa01f('0x1c')]+_0x2963b5['limit'];var _0x22572a;if(_0x293998>=_0x3a32c2){_0x293998=_0x3a32c2;_0x22572a=0xc8;}else{_0x22572a=0xce;}_0x893f10['status'](_0x22572a);return _0x893f10[_0xa01f('0x20')]('Content-Range',_0xa9acdf+'-'+_0x293998+'/'+_0x3a32c2)[_0xa01f('0x1b')](_0x4d9314);}return null;};}function patchUpdates(_0x172d2f){return function(_0x1b288a){try{jsonpatch[_0xa01f('0x21')](_0x1b288a,_0x172d2f,!![]);}catch(_0x368b46){return BPromise[_0xa01f('0x22')](_0x368b46);}return _0x1b288a[_0xa01f('0x23')]();};}function saveUpdates(_0x29b795,_0x5bbac8){return function(_0x14f85a){if(_0x14f85a){return _0x14f85a['update'](_0x29b795)[_0xa01f('0x24')](function(_0x29b0ca){return _0x29b0ca;});}return null;};}function removeEntity(_0x59d276,_0x4a8fa7){return function(_0x20efdf){if(_0x20efdf){return _0x20efdf['destroy']()[_0xa01f('0x24')](function(){_0x59d276[_0xa01f('0x1a')](0xcc)[_0xa01f('0x25')]();});}};}function handleEntityNotFound(_0x374b72,_0x5a3146){return function(_0x611092){if(!_0x611092){_0x374b72['sendStatus'](0x194);}return _0x611092;};}function handleError(_0xc9b422,_0x56d66a){_0x56d66a=_0x56d66a||0x1f4;return function(_0x3acf26){logger['error'](_0x3acf26[_0xa01f('0x26')]);if(_0x3acf26[_0xa01f('0x27')]){delete _0x3acf26[_0xa01f('0x27')];}_0xc9b422[_0xa01f('0x1a')](_0x56d66a)[_0xa01f('0x28')](_0x3acf26);};}exports[_0xa01f('0x29')]=function(_0x4b55a9,_0x5f544d){var _0x5ed9b3={},_0x319b0a={},_0x460dc6={'count':0x0,'rows':[]};var _0x529d0c=_[_0xa01f('0x2a')](db[_0xa01f('0x2b')][_0xa01f('0x2c')],function(_0x11858e){return{'name':_0x11858e[_0xa01f('0x2d')],'type':_0x11858e[_0xa01f('0x2e')][_0xa01f('0x2f')]};});_0x319b0a[_0xa01f('0x30')]=_[_0xa01f('0x2a')](_0x529d0c,'name');_0x319b0a[_0xa01f('0x31')]=_[_0xa01f('0x32')](_0x4b55a9[_0xa01f('0x31')]);_0x319b0a[_0xa01f('0x33')]=_[_0xa01f('0x34')](_0x319b0a['model'],_0x319b0a['query']);_0x5ed9b3[_0xa01f('0x35')]=_['intersection'](_0x319b0a[_0xa01f('0x30')],qs[_0xa01f('0x36')](_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x36')]));_0x5ed9b3['attributes']=_0x5ed9b3[_0xa01f('0x35')]['length']?_0x5ed9b3[_0xa01f('0x35')]:_0x319b0a['model'];if(!_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x37')](_0xa01f('0x38'))){_0x5ed9b3[_0xa01f('0x1d')]=qs['limit'](_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x1d')]);_0x5ed9b3['offset']=qs[_0xa01f('0x1c')](_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x1c')]);}_0x5ed9b3[_0xa01f('0x39')]=qs[_0xa01f('0x3a')](_0x4b55a9['query'][_0xa01f('0x3a')]);_0x5ed9b3[_0xa01f('0x3b')]=qs[_0xa01f('0x33')](_['pick'](_0x4b55a9[_0xa01f('0x31')],_0x319b0a[_0xa01f('0x33')]),_0x529d0c);if(_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x3c')]){_0x5ed9b3[_0xa01f('0x3b')]=_[_0xa01f('0x3d')](_0x5ed9b3[_0xa01f('0x3b')],{'$or':_['map'](_0x529d0c,function(_0x5cdbd6){if(_0x5cdbd6[_0xa01f('0x2e')]!==_0xa01f('0x3e')){var _0x5e11d1={};_0x5e11d1[_0x5cdbd6['name']]={'$like':'%'+_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x3c')]+'%'};return _0x5e11d1;}})});}_0x5ed9b3=_[_0xa01f('0x3d')]({},_0x5ed9b3,_0x4b55a9['options']);var _0xe42843={'where':_0x5ed9b3[_0xa01f('0x3b')]};return db['OpenchannelTransferReport'][_0xa01f('0x1f')](_0xe42843)[_0xa01f('0x24')](function(_0x3bbd57){_0x460dc6['count']=_0x3bbd57;if(_0x4b55a9['query'][_0xa01f('0x3f')]){_0x5ed9b3[_0xa01f('0x40')]=[{'all':!![]}];}return db[_0xa01f('0x2b')][_0xa01f('0x41')](_0x5ed9b3);})[_0xa01f('0x24')](function(_0x29d83d){_0x460dc6['rows']=_0x29d83d;return _0x460dc6;})[_0xa01f('0x24')](respondWithFilteredResult(_0x5f544d,_0x5ed9b3))['catch'](handleError(_0x5f544d,null));};exports[_0xa01f('0x42')]=function(_0xbeb3b8,_0x14c71e){var _0x539635={'raw':!![],'where':{'id':_0xbeb3b8[_0xa01f('0x43')]['id']}},_0x20a391={};_0x20a391[_0xa01f('0x30')]=_[_0xa01f('0x32')](db[_0xa01f('0x2b')][_0xa01f('0x2c')]);_0x20a391[_0xa01f('0x31')]=_[_0xa01f('0x32')](_0xbeb3b8[_0xa01f('0x31')]);_0x20a391[_0xa01f('0x33')]=_[_0xa01f('0x34')](_0x20a391[_0xa01f('0x30')],_0x20a391['query']);_0x539635['attributes']=_['intersection'](_0x20a391[_0xa01f('0x30')],qs['fields'](_0xbeb3b8['query'][_0xa01f('0x36')]));_0x539635[_0xa01f('0x35')]=_0x539635[_0xa01f('0x35')][_0xa01f('0x44')]?_0x539635['attributes']:_0x20a391['model'];if(_0xbeb3b8['query'][_0xa01f('0x3f')]){_0x539635[_0xa01f('0x40')]=[{'all':!![]}];}_0x539635=_[_0xa01f('0x3d')]({},_0x539635,_0xbeb3b8[_0xa01f('0x45')]);return db['OpenchannelTransferReport'][_0xa01f('0x46')](_0x539635)[_0xa01f('0x24')](handleEntityNotFound(_0x14c71e,null))[_0xa01f('0x24')](respondWithResult(_0x14c71e,null))[_0xa01f('0x47')](handleError(_0x14c71e,null));};exports[_0xa01f('0x48')]=function(_0x32857c,_0x1fa775){return db[_0xa01f('0x2b')][_0xa01f('0x48')](_0x32857c[_0xa01f('0x49')],{})['then'](respondWithResult(_0x1fa775,0xc9))['catch'](handleError(_0x1fa775,null));};exports[_0xa01f('0x4a')]=function(_0x63bfa,_0x269820){if(_0x63bfa[_0xa01f('0x49')]['id']){delete _0x63bfa[_0xa01f('0x49')]['id'];}return db[_0xa01f('0x2b')][_0xa01f('0x46')]({'where':{'id':_0x63bfa[_0xa01f('0x43')]['id']}})[_0xa01f('0x24')](handleEntityNotFound(_0x269820,null))[_0xa01f('0x24')](saveUpdates(_0x63bfa[_0xa01f('0x49')],null))[_0xa01f('0x24')](respondWithResult(_0x269820,null))['catch'](handleError(_0x269820,null));};exports[_0xa01f('0x4b')]=function(_0x59a288,_0x3b117c){return db[_0xa01f('0x2b')][_0xa01f('0x46')]({'where':{'id':_0x59a288[_0xa01f('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b117c,null))[_0xa01f('0x24')](removeEntity(_0x3b117c,null))[_0xa01f('0x47')](handleError(_0x3b117c,null));};exports[_0xa01f('0x4c')]=function(_0x2d92a2,_0x164e5b){return db['OpenchannelTransferReport']['describe']()['then'](respondWithResult(_0x164e5b,null))[_0xa01f('0x47')](handleError(_0x164e5b,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9ced121..4349806 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 _0xc966=['report_openchannel_transfer','uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','OpenchannelTransferReport'];(function(_0x461ddb,_0x1703ce){var _0x45dbfa=function(_0x1c89a9){while(--_0x1c89a9){_0x461ddb['push'](_0x461ddb['shift']());}};_0x45dbfa(++_0x1703ce);}(_0xc966,0x178));var _0x6c96=function(_0x4ccb4d,_0x2b7e8b){_0x4ccb4d=_0x4ccb4d-0x0;var _0x542af8=_0xc966[_0x4ccb4d];return _0x542af8;};'use strict';var _=require('lodash');var util=require(_0x6c96('0x0'));var logger=require('../../config/logger')(_0x6c96('0x1'));var moment=require(_0x6c96('0x2'));var BPromise=require('bluebird');var rp=require(_0x6c96('0x3'));var fs=require('fs');var path=require(_0x6c96('0x4'));var rimraf=require(_0x6c96('0x5'));var config=require(_0x6c96('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6c96('0x7')]=function(_0x427776,_0x1d1e1){return _0x427776['define'](_0x6c96('0x8'),attributes,{'tableName':_0x6c96('0x9'),'paranoid':![],'indexes':[{'name':_0x6c96('0xa'),'fields':[_0x6c96('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39d9=['path','rimraf','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39d9,0x146));var _0x939d=function(_0x3e2b04,_0x1f3d86){_0x3e2b04=_0x3e2b04-0x0;var _0x3cbf96=_0x39d9[_0x3e2b04];return _0x3cbf96;};'use strict';var _=require(_0x939d('0x0'));var util=require(_0x939d('0x1'));var logger=require('../../config/logger')(_0x939d('0x2'));var moment=require('moment');var BPromise=require(_0x939d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x939d('0x4'));var rimraf=require(_0x939d('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x939d('0x6')]=function(_0x5b43d4,_0x1860b1){return _0x5b43d4[_0x939d('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x939d('0x8'),'paranoid':![],'indexes':[{'name':_0x939d('0x9'),'fields':[_0x939d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3d09a07..975a6f6 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 _0x4074=['jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4074,0xf0));var _0x4407=function(_0x516f00,_0x1dd085){_0x516f00=_0x516f00-0x0;var _0x1fe059=_0x4074[_0x516f00];return _0x1fe059;};'use strict';var _=require(_0x4407('0x0'));var util=require(_0x4407('0x1'));var moment=require(_0x4407('0x2'));var BPromise=require('bluebird');var rs=require(_0x4407('0x3'));var fs=require('fs');var Redis=require(_0x4407('0x4'));var db=require(_0x4407('0x5'))['db'];var utils=require(_0x4407('0x6'));var logger=require(_0x4407('0x7'))(_0x4407('0x8'));var config=require(_0x4407('0x9'));var jayson=require(_0x4407('0xa'));var client=jayson[_0x4407('0xb')][_0x4407('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4933cf,_0x988538,_0x5f0699){return new BPromise(function(_0x414f0a,_0x3c1aee){return client[_0x4407('0xd')](_0x4933cf,_0x5f0699)['then'](function(_0x5e70a5){logger['info'](_0x4407('0xe'),_0x988538,_0x4407('0xf'));logger[_0x4407('0x10')](_0x4407('0x11'),_0x988538,_0x4407('0xf'),JSON[_0x4407('0x12')](_0x5e70a5));if(_0x5e70a5[_0x4407('0x13')]){if(_0x5e70a5[_0x4407('0x13')][_0x4407('0x14')]===0x1f4){logger[_0x4407('0x13')](_0x4407('0xe'),_0x988538,_0x5e70a5['error'][_0x4407('0x15')]);return _0x3c1aee(_0x5e70a5[_0x4407('0x13')]['message']);}logger[_0x4407('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x988538,_0x5e70a5[_0x4407('0x13')][_0x4407('0x15')]);return _0x414f0a(_0x5e70a5[_0x4407('0x13')][_0x4407('0x15')]);}else{logger[_0x4407('0x16')](_0x4407('0xe'),_0x988538,_0x4407('0xf'));_0x414f0a(_0x5e70a5[_0x4407('0x17')]['message']);}})[_0x4407('0x18')](function(_0x65b20b){logger[_0x4407('0x13')](_0x4407('0xe'),_0x988538,_0x65b20b);_0x3c1aee(_0x65b20b);});});} \ No newline at end of file +var _0xf1e1=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x172053,_0x379c7e){var _0x893bba=function(_0x4c13d5){while(--_0x4c13d5){_0x172053['push'](_0x172053['shift']());}};_0x893bba(++_0x379c7e);}(_0xf1e1,0x102));var _0x1f1e=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0xf1e1[_0x842858];return _0x46c2a2;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var moment=require(_0x1f1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f1e('0x3'))['db'];var utils=require(_0x1f1e('0x4'));var logger=require(_0x1f1e('0x5'))(_0x1f1e('0x6'));var config=require(_0x1f1e('0x7'));var jayson=require(_0x1f1e('0x8'));var client=jayson[_0x1f1e('0x9')][_0x1f1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db643,_0x38585e,_0x46e32b){return new BPromise(function(_0x3699d2,_0x6ab45b){return client[_0x1f1e('0xb')](_0x1db643,_0x46e32b)['then'](function(_0x44e626){logger[_0x1f1e('0xc')](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));logger[_0x1f1e('0xf')](_0x1f1e('0x10'),_0x38585e,_0x1f1e('0xe'),JSON[_0x1f1e('0x11')](_0x44e626));if(_0x44e626[_0x1f1e('0x12')]){if(_0x44e626['error'][_0x1f1e('0x13')]===0x1f4){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);return _0x6ab45b(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}logger['error'](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')]['message']);return _0x3699d2(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}else{logger['info'](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));_0x3699d2(_0x44e626[_0x1f1e('0x15')][_0x1f1e('0x14')]);}})[_0x1f1e('0x16')](function(_0x3f978f){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x3f978f);_0x6ab45b(_0x3f978f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9c7f003..be4b091 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 _0x3c9c=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id','isAuthenticated','show','post','put','update','delete','exports','util'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x3c9c,0x131));var _0xc3c9=function(_0x3b5233,_0x2fb4c9){_0x3b5233=_0x3b5233-0x0;var _0x39cda9=_0x3c9c[_0x3b5233];return _0x39cda9;};'use strict';var multer=require('multer');var util=require(_0xc3c9('0x0'));var path=require(_0xc3c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xc3c9('0x2'));var router=express[_0xc3c9('0x3')]();var fs_extra=require(_0xc3c9('0x4'));var auth=require(_0xc3c9('0x5'));var interaction=require(_0xc3c9('0x6'));var config=require(_0xc3c9('0x7'));var controller=require(_0xc3c9('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc3c9('0x9')](_0xc3c9('0xa'),auth[_0xc3c9('0xb')](),controller[_0xc3c9('0xc')]);router[_0xc3c9('0xd')]('/',auth[_0xc3c9('0xb')](),controller['create']);router[_0xc3c9('0xe')]('/:id',auth[_0xc3c9('0xb')](),controller[_0xc3c9('0xf')]);router[_0xc3c9('0x10')](_0xc3c9('0xa'),auth[_0xc3c9('0xb')](),controller['destroy']);module[_0xc3c9('0x11')]=router; \ No newline at end of file +var _0x423c=['fs-extra','../../config/environment','./pause.controller','get','isAuthenticated','/:id','create','put','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x423c,0x91));var _0xc423=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x423c[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0xc423('0x0'));var util=require('util');var path=require(_0xc423('0x1'));var timeout=require(_0xc423('0x2'));var express=require(_0xc423('0x3'));var router=express[_0xc423('0x4')]();var fs_extra=require(_0xc423('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc423('0x6'));var controller=require(_0xc423('0x7'));router[_0xc423('0x8')]('/',auth[_0xc423('0x9')](),controller['index']);router[_0xc423('0x8')](_0xc423('0xa'),auth[_0xc423('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc423('0xb')]);router[_0xc423('0xc')]('/:id',auth[_0xc423('0x9')](),controller[_0xc423('0xd')]);router['delete'](_0xc423('0xa'),auth['isAuthenticated'](),controller[_0xc423('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 49db12b..73cdfba 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 _0x7bfe=['name','exports','STRING'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x7bfe,0x1e1));var _0xe7bf=function(_0x141a36,_0x19e9d9){_0x141a36=_0x141a36-0x0;var _0x3d283e=_0x7bfe[_0x141a36];return _0x3d283e;};'use strict';var Sequelize=require('sequelize');module[_0xe7bf('0x0')]={'name':{'type':Sequelize[_0xe7bf('0x1')],'unique':_0xe7bf('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6134=['name','STRING'];(function(_0x9704f1,_0x2bbd22){var _0x39ae13=function(_0x2deba7){while(--_0x2deba7){_0x9704f1['push'](_0x9704f1['shift']());}};_0x39ae13(++_0x2bbd22);}(_0x6134,0x195));var _0x4613=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6134[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4613('0x0')],'unique':_0x4613('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x4613('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 9c87380..fb206a4 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 _0x98bc=['fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','create','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Pause','rawAttributes'];(function(_0x239193,_0x1585ef){var _0x4f51c3=function(_0x8eba2c){while(--_0x8eba2c){_0x239193['push'](_0x239193['shift']());}};_0x4f51c3(++_0x1585ef);}(_0x98bc,0x174));var _0xc98b=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x98bc[_0x1f9f37];return _0x21c080;};'use strict';var emlformat=require(_0xc98b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc98b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc98b('0x2'));var moment=require(_0xc98b('0x3'));var BPromise=require(_0xc98b('0x4'));var Mustache=require('mustache');var util=require(_0xc98b('0x5'));var path=require(_0xc98b('0x6'));var sox=require(_0xc98b('0x7'));var csv=require(_0xc98b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc98b('0x9'));var _=require(_0xc98b('0xa'));var squel=require(_0xc98b('0xb'));var crypto=require(_0xc98b('0xc'));var jsforce=require(_0xc98b('0xd'));var deskjs=require(_0xc98b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc98b('0xf'));var Papa=require('papaparse');var Redis=require(_0xc98b('0x10'));var authService=require(_0xc98b('0x11'));var qs=require(_0xc98b('0x12'));var as=require(_0xc98b('0x13'));var hardwareService=require(_0xc98b('0x14'));var logger=require('../../config/logger')(_0xc98b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc98b('0x16'))['db'];function respondWithStatusCode(_0x11ef4a,_0x4cdb60){_0x4cdb60=_0x4cdb60||0xcc;return function(_0x3f037e){if(_0x3f037e){return _0x11ef4a[_0xc98b('0x17')](_0x4cdb60);}return _0x11ef4a[_0xc98b('0x18')](_0x4cdb60)[_0xc98b('0x19')]();};}function respondWithResult(_0xe22626,_0x2cf624){_0x2cf624=_0x2cf624||0xc8;return function(_0x46a74b){if(_0x46a74b){return _0xe22626[_0xc98b('0x18')](_0x2cf624)[_0xc98b('0x1a')](_0x46a74b);}};}function respondWithFilteredResult(_0xba26de,_0x180d54){return function(_0x35eac9){if(_0x35eac9){var _0x184d74=typeof _0x180d54[_0xc98b('0x1b')]==='undefined'&&typeof _0x180d54[_0xc98b('0x1c')]===_0xc98b('0x1d');var _0x42f767=_0x35eac9[_0xc98b('0x1e')];var _0x226e54=_0x184d74?0x0:_0x180d54['offset'];var _0x5acac6=_0x184d74?_0x35eac9['count']:_0x180d54[_0xc98b('0x1b')]+_0x180d54[_0xc98b('0x1c')];var _0x43fb22;if(_0x5acac6>=_0x42f767){_0x5acac6=_0x42f767;_0x43fb22=0xc8;}else{_0x43fb22=0xce;}_0xba26de[_0xc98b('0x18')](_0x43fb22);return _0xba26de[_0xc98b('0x1f')]('Content-Range',_0x226e54+'-'+_0x5acac6+'/'+_0x42f767)[_0xc98b('0x1a')](_0x35eac9);}return null;};}function patchUpdates(_0x4fca86){return function(_0x184aac){try{jsonpatch[_0xc98b('0x20')](_0x184aac,_0x4fca86,!![]);}catch(_0x1b6101){return BPromise[_0xc98b('0x21')](_0x1b6101);}return _0x184aac[_0xc98b('0x22')]();};}function saveUpdates(_0x25d08f,_0x2217ef){return function(_0x4f0e35){if(_0x4f0e35){return _0x4f0e35[_0xc98b('0x23')](_0x25d08f)[_0xc98b('0x24')](function(_0x2bc897){return _0x2bc897;});}return null;};}function removeEntity(_0x3aee18,_0x55dfda){return function(_0x14b93c){if(_0x14b93c){return _0x14b93c['destroy']()[_0xc98b('0x24')](function(){var _0x150c3e=_0x14b93c[_0xc98b('0x25')]({'plain':!![]});var _0x4147fc='Pauses';return db[_0xc98b('0x26')][_0xc98b('0x27')]({'where':{'type':_0x4147fc,'resourceId':_0x150c3e['id']}})[_0xc98b('0x24')](function(){return _0x14b93c;});})[_0xc98b('0x24')](function(){_0x3aee18[_0xc98b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ef71,_0x30421a){return function(_0x366c10){if(!_0x366c10){_0x12ef71['sendStatus'](0x194);}return _0x366c10;};}function handleError(_0x260030,_0x5b8f0d){_0x5b8f0d=_0x5b8f0d||0x1f4;return function(_0x23c8f2){logger[_0xc98b('0x28')](_0x23c8f2[_0xc98b('0x29')]);if(_0x23c8f2[_0xc98b('0x2a')]){delete _0x23c8f2[_0xc98b('0x2a')];}_0x260030['status'](_0x5b8f0d)[_0xc98b('0x2b')](_0x23c8f2);};}exports[_0xc98b('0x2c')]=function(_0x2df708,_0x55597e){var _0x4446b4={},_0x169df6={},_0x533952={'count':0x0,'rows':[]};var _0x1f86a=_[_0xc98b('0x2d')](db[_0xc98b('0x2e')][_0xc98b('0x2f')],function(_0x526dd8){return{'name':_0x526dd8[_0xc98b('0x30')],'type':_0x526dd8[_0xc98b('0x31')][_0xc98b('0x32')]};});_0x169df6[_0xc98b('0x33')]=_[_0xc98b('0x2d')](_0x1f86a,_0xc98b('0x2a'));_0x169df6['query']=_[_0xc98b('0x34')](_0x2df708['query']);_0x169df6[_0xc98b('0x35')]=_['intersection'](_0x169df6[_0xc98b('0x33')],_0x169df6[_0xc98b('0x36')]);_0x4446b4[_0xc98b('0x37')]=_[_0xc98b('0x38')](_0x169df6[_0xc98b('0x33')],qs[_0xc98b('0x39')](_0x2df708[_0xc98b('0x36')]['fields']));_0x4446b4[_0xc98b('0x37')]=_0x4446b4[_0xc98b('0x37')]['length']?_0x4446b4[_0xc98b('0x37')]:_0x169df6['model'];if(!_0x2df708[_0xc98b('0x36')][_0xc98b('0x3a')](_0xc98b('0x3b'))){_0x4446b4[_0xc98b('0x1c')]=qs[_0xc98b('0x1c')](_0x2df708['query']['limit']);_0x4446b4[_0xc98b('0x1b')]=qs['offset'](_0x2df708[_0xc98b('0x36')][_0xc98b('0x1b')]);}_0x4446b4[_0xc98b('0x3c')]=qs[_0xc98b('0x3d')](_0x2df708['query']['sort']);_0x4446b4['where']=qs[_0xc98b('0x35')](_[_0xc98b('0x3e')](_0x2df708[_0xc98b('0x36')],_0x169df6[_0xc98b('0x35')]),_0x1f86a);if(_0x2df708[_0xc98b('0x36')][_0xc98b('0x3f')]){_0x4446b4[_0xc98b('0x40')]=_[_0xc98b('0x41')](_0x4446b4[_0xc98b('0x40')],{'$or':_[_0xc98b('0x2d')](_0x1f86a,function(_0x372285){if(_0x372285[_0xc98b('0x31')]!==_0xc98b('0x42')){var _0x412fff={};_0x412fff[_0x372285['name']]={'$like':'%'+_0x2df708[_0xc98b('0x36')]['filter']+'%'};return _0x412fff;}})});}_0x4446b4=_['merge']({},_0x4446b4,_0x2df708[_0xc98b('0x43')]);var _0xb9f3d2={'where':_0x4446b4['where']};return db[_0xc98b('0x2e')]['count'](_0xb9f3d2)['then'](function(_0x22ee2a){_0x533952[_0xc98b('0x1e')]=_0x22ee2a;if(_0x2df708['query'][_0xc98b('0x44')]){_0x4446b4[_0xc98b('0x45')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x4446b4);})[_0xc98b('0x24')](function(_0x21dfe7){_0x533952[_0xc98b('0x46')]=_0x21dfe7;return _0x533952;})[_0xc98b('0x24')](respondWithFilteredResult(_0x55597e,_0x4446b4))[_0xc98b('0x47')](handleError(_0x55597e,null));};exports[_0xc98b('0x48')]=function(_0x5db1be,_0x27b6e9){var _0x4197c7={'raw':!![],'where':{'id':_0x5db1be[_0xc98b('0x49')]['id']}},_0x36d12b={};_0x36d12b[_0xc98b('0x33')]=_[_0xc98b('0x34')](db[_0xc98b('0x2e')][_0xc98b('0x2f')]);_0x36d12b[_0xc98b('0x36')]=_[_0xc98b('0x34')](_0x5db1be[_0xc98b('0x36')]);_0x36d12b[_0xc98b('0x35')]=_[_0xc98b('0x38')](_0x36d12b['model'],_0x36d12b[_0xc98b('0x36')]);_0x4197c7[_0xc98b('0x37')]=_['intersection'](_0x36d12b[_0xc98b('0x33')],qs[_0xc98b('0x39')](_0x5db1be[_0xc98b('0x36')][_0xc98b('0x39')]));_0x4197c7[_0xc98b('0x37')]=_0x4197c7[_0xc98b('0x37')]['length']?_0x4197c7['attributes']:_0x36d12b['model'];if(_0x5db1be[_0xc98b('0x36')][_0xc98b('0x44')]){_0x4197c7[_0xc98b('0x45')]=[{'all':!![]}];}_0x4197c7=_[_0xc98b('0x41')]({},_0x4197c7,_0x5db1be[_0xc98b('0x43')]);return db[_0xc98b('0x2e')][_0xc98b('0x4a')](_0x4197c7)[_0xc98b('0x24')](handleEntityNotFound(_0x27b6e9,null))[_0xc98b('0x24')](respondWithResult(_0x27b6e9,null))[_0xc98b('0x47')](handleError(_0x27b6e9,null));};exports['create']=function(_0x1eaa4b,_0x2422ac){return db[_0xc98b('0x2e')]['create'](_0x1eaa4b[_0xc98b('0x4b')],{})[_0xc98b('0x24')](function(_0x7c5f8){var _0x48ab56=_0x1eaa4b[_0xc98b('0x4c')][_0xc98b('0x25')]({'plain':!![]});if(!_0x48ab56)throw new Error(_0xc98b('0x4d'));if(_0x48ab56[_0xc98b('0x4e')]===_0xc98b('0x4c')){var _0x54dfe7=_0x7c5f8[_0xc98b('0x25')]({'plain':!![]});var _0x1d3746=_0xc98b('0x4f');return db[_0xc98b('0x50')]['find']({'where':{'name':_0x1d3746,'userProfileId':_0x48ab56[_0xc98b('0x51')]},'raw':!![]})[_0xc98b('0x24')](function(_0x207996){if(_0x207996&&_0x207996[_0xc98b('0x52')]===0x0){return db[_0xc98b('0x26')][_0xc98b('0x53')]({'name':_0x54dfe7[_0xc98b('0x2a')],'resourceId':_0x54dfe7['id'],'type':_0x207996[_0xc98b('0x2a')],'sectionId':_0x207996['id']},{})[_0xc98b('0x24')](function(){return _0x7c5f8;});}else{return _0x7c5f8;}})[_0xc98b('0x47')](function(_0x3b8fca){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b8fca);throw _0x3b8fca;});}return _0x7c5f8;})[_0xc98b('0x24')](respondWithResult(_0x2422ac,0xc9))[_0xc98b('0x47')](handleError(_0x2422ac,null));};exports[_0xc98b('0x23')]=function(_0x3c1c43,_0x35d60e){if(_0x3c1c43['body']['id']){delete _0x3c1c43[_0xc98b('0x4b')]['id'];}return db[_0xc98b('0x2e')][_0xc98b('0x4a')]({'where':{'id':_0x3c1c43['params']['id']}})[_0xc98b('0x24')](handleEntityNotFound(_0x35d60e,null))[_0xc98b('0x24')](saveUpdates(_0x3c1c43['body'],null))[_0xc98b('0x24')](respondWithResult(_0x35d60e,null))[_0xc98b('0x47')](handleError(_0x35d60e,null));};exports[_0xc98b('0x27')]=function(_0x2b5adc,_0x4420b6){return db[_0xc98b('0x2e')][_0xc98b('0x4a')]({'where':{'id':_0x2b5adc[_0xc98b('0x49')]['id']}})[_0xc98b('0x24')](handleEntityNotFound(_0x4420b6,null))[_0xc98b('0x24')](removeEntity(_0x4420b6,null))[_0xc98b('0x47')](handleError(_0x4420b6,null));}; \ No newline at end of file +var _0xa0ac=['Pauses','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','end','error','stack','name','send','index','Pause','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa0ac,0xac));var _0xca0a=function(_0x55fde2,_0xe9132f){_0x55fde2=_0x55fde2-0x0;var _0x1e7ae7=_0xa0ac[_0x55fde2];return _0x1e7ae7;};'use strict';var emlformat=require(_0xca0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca0a('0x2'));var moment=require(_0xca0a('0x3'));var BPromise=require(_0xca0a('0x4'));var Mustache=require(_0xca0a('0x5'));var util=require(_0xca0a('0x6'));var path=require(_0xca0a('0x7'));var sox=require(_0xca0a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca0a('0x9'));var _=require(_0xca0a('0xa'));var squel=require('squel');var crypto=require(_0xca0a('0xb'));var jsforce=require(_0xca0a('0xc'));var deskjs=require(_0xca0a('0xd'));var toCsv=require(_0xca0a('0xe'));var querystring=require(_0xca0a('0xf'));var Papa=require('papaparse');var Redis=require(_0xca0a('0x10'));var authService=require(_0xca0a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xca0a('0x12'));var hardwareService=require(_0xca0a('0x13'));var logger=require(_0xca0a('0x14'))(_0xca0a('0x15'));var utils=require('../../config/utils');var config=require(_0xca0a('0x16'));var licenseUtil=require(_0xca0a('0x17'));var db=require(_0xca0a('0x18'))['db'];function respondWithStatusCode(_0x58b42d,_0x4537d7){_0x4537d7=_0x4537d7||0xcc;return function(_0x4447ac){if(_0x4447ac){return _0x58b42d['sendStatus'](_0x4537d7);}return _0x58b42d[_0xca0a('0x19')](_0x4537d7)['end']();};}function respondWithResult(_0x2b2135,_0x33eca8){_0x33eca8=_0x33eca8||0xc8;return function(_0x525fe3){if(_0x525fe3){return _0x2b2135[_0xca0a('0x19')](_0x33eca8)[_0xca0a('0x1a')](_0x525fe3);}};}function respondWithFilteredResult(_0x5590fc,_0x26c15e){return function(_0x387576){if(_0x387576){var _0x16c5c4=typeof _0x26c15e[_0xca0a('0x1b')]===_0xca0a('0x1c')&&typeof _0x26c15e[_0xca0a('0x1d')]==='undefined';var _0x4d4b79=_0x387576['count'];var _0x21d0c8=_0x16c5c4?0x0:_0x26c15e['offset'];var _0x663531=_0x16c5c4?_0x387576[_0xca0a('0x1e')]:_0x26c15e[_0xca0a('0x1b')]+_0x26c15e['limit'];var _0x327578;if(_0x663531>=_0x4d4b79){_0x663531=_0x4d4b79;_0x327578=0xc8;}else{_0x327578=0xce;}_0x5590fc[_0xca0a('0x19')](_0x327578);return _0x5590fc[_0xca0a('0x1f')]('Content-Range',_0x21d0c8+'-'+_0x663531+'/'+_0x4d4b79)['json'](_0x387576);}return null;};}function patchUpdates(_0x5af7d4){return function(_0xe688d2){try{jsonpatch[_0xca0a('0x20')](_0xe688d2,_0x5af7d4,!![]);}catch(_0x3978c1){return BPromise['reject'](_0x3978c1);}return _0xe688d2[_0xca0a('0x21')]();};}function saveUpdates(_0x5c45e8,_0x5eeced){return function(_0x521ec3){if(_0x521ec3){return _0x521ec3['update'](_0x5c45e8)[_0xca0a('0x22')](function(_0x257640){return _0x257640;});}return null;};}function removeEntity(_0x54669b,_0x29986d){return function(_0x3bd94b){if(_0x3bd94b){return _0x3bd94b[_0xca0a('0x23')]()[_0xca0a('0x22')](function(){var _0x384ccc=_0x3bd94b['get']({'plain':!![]});var _0x1a5b02='Pauses';return db['UserProfileResource'][_0xca0a('0x23')]({'where':{'type':_0x1a5b02,'resourceId':_0x384ccc['id']}})[_0xca0a('0x22')](function(){return _0x3bd94b;});})[_0xca0a('0x22')](function(){_0x54669b[_0xca0a('0x19')](0xcc)[_0xca0a('0x24')]();});}};}function handleEntityNotFound(_0x4a9273,_0x4c56f9){return function(_0x2bc300){if(!_0x2bc300){_0x4a9273['sendStatus'](0x194);}return _0x2bc300;};}function handleError(_0x18872c,_0x3a2703){_0x3a2703=_0x3a2703||0x1f4;return function(_0x1f537d){logger[_0xca0a('0x25')](_0x1f537d[_0xca0a('0x26')]);if(_0x1f537d[_0xca0a('0x27')]){delete _0x1f537d[_0xca0a('0x27')];}_0x18872c[_0xca0a('0x19')](_0x3a2703)[_0xca0a('0x28')](_0x1f537d);};}exports[_0xca0a('0x29')]=function(_0x57be49,_0x26a1ef){var _0x2c65b9={},_0x425ca9={},_0x516ddc={'count':0x0,'rows':[]};var _0x11c5a6=_['map'](db[_0xca0a('0x2a')][_0xca0a('0x2b')],function(_0x44e606){return{'name':_0x44e606[_0xca0a('0x2c')],'type':_0x44e606['type'][_0xca0a('0x2d')]};});_0x425ca9[_0xca0a('0x2e')]=_['map'](_0x11c5a6,_0xca0a('0x27'));_0x425ca9['query']=_['keys'](_0x57be49[_0xca0a('0x2f')]);_0x425ca9[_0xca0a('0x30')]=_[_0xca0a('0x31')](_0x425ca9[_0xca0a('0x2e')],_0x425ca9['query']);_0x2c65b9[_0xca0a('0x32')]=_[_0xca0a('0x31')](_0x425ca9[_0xca0a('0x2e')],qs[_0xca0a('0x33')](_0x57be49['query']['fields']));_0x2c65b9[_0xca0a('0x32')]=_0x2c65b9[_0xca0a('0x32')][_0xca0a('0x34')]?_0x2c65b9[_0xca0a('0x32')]:_0x425ca9['model'];if(!_0x57be49[_0xca0a('0x2f')]['hasOwnProperty'](_0xca0a('0x35'))){_0x2c65b9[_0xca0a('0x1d')]=qs[_0xca0a('0x1d')](_0x57be49['query'][_0xca0a('0x1d')]);_0x2c65b9['offset']=qs[_0xca0a('0x1b')](_0x57be49[_0xca0a('0x2f')][_0xca0a('0x1b')]);}_0x2c65b9[_0xca0a('0x36')]=qs[_0xca0a('0x37')](_0x57be49['query']['sort']);_0x2c65b9[_0xca0a('0x38')]=qs['filters'](_[_0xca0a('0x39')](_0x57be49[_0xca0a('0x2f')],_0x425ca9[_0xca0a('0x30')]),_0x11c5a6);if(_0x57be49[_0xca0a('0x2f')][_0xca0a('0x3a')]){_0x2c65b9[_0xca0a('0x38')]=_[_0xca0a('0x3b')](_0x2c65b9[_0xca0a('0x38')],{'$or':_['map'](_0x11c5a6,function(_0x1b354a){if(_0x1b354a['type']!==_0xca0a('0x3c')){var _0x3b8eac={};_0x3b8eac[_0x1b354a[_0xca0a('0x27')]]={'$like':'%'+_0x57be49['query']['filter']+'%'};return _0x3b8eac;}})});}_0x2c65b9=_['merge']({},_0x2c65b9,_0x57be49[_0xca0a('0x3d')]);var _0x2243b5={'where':_0x2c65b9[_0xca0a('0x38')]};return db[_0xca0a('0x2a')]['count'](_0x2243b5)[_0xca0a('0x22')](function(_0x14ee69){_0x516ddc[_0xca0a('0x1e')]=_0x14ee69;if(_0x57be49[_0xca0a('0x2f')][_0xca0a('0x3e')]){_0x2c65b9[_0xca0a('0x3f')]=[{'all':!![]}];}return db[_0xca0a('0x2a')][_0xca0a('0x40')](_0x2c65b9);})['then'](function(_0x561c23){_0x516ddc[_0xca0a('0x41')]=_0x561c23;return _0x516ddc;})[_0xca0a('0x22')](respondWithFilteredResult(_0x26a1ef,_0x2c65b9))['catch'](handleError(_0x26a1ef,null));};exports[_0xca0a('0x42')]=function(_0x45b7e3,_0xc345dc){var _0x23c876={'raw':!![],'where':{'id':_0x45b7e3[_0xca0a('0x43')]['id']}},_0x3b736f={};_0x3b736f[_0xca0a('0x2e')]=_[_0xca0a('0x44')](db[_0xca0a('0x2a')][_0xca0a('0x2b')]);_0x3b736f['query']=_['keys'](_0x45b7e3['query']);_0x3b736f[_0xca0a('0x30')]=_[_0xca0a('0x31')](_0x3b736f[_0xca0a('0x2e')],_0x3b736f[_0xca0a('0x2f')]);_0x23c876['attributes']=_[_0xca0a('0x31')](_0x3b736f[_0xca0a('0x2e')],qs['fields'](_0x45b7e3[_0xca0a('0x2f')][_0xca0a('0x33')]));_0x23c876[_0xca0a('0x32')]=_0x23c876[_0xca0a('0x32')][_0xca0a('0x34')]?_0x23c876['attributes']:_0x3b736f[_0xca0a('0x2e')];if(_0x45b7e3['query']['includeAll']){_0x23c876[_0xca0a('0x3f')]=[{'all':!![]}];}_0x23c876=_[_0xca0a('0x3b')]({},_0x23c876,_0x45b7e3[_0xca0a('0x3d')]);return db[_0xca0a('0x2a')]['find'](_0x23c876)[_0xca0a('0x22')](handleEntityNotFound(_0xc345dc,null))['then'](respondWithResult(_0xc345dc,null))[_0xca0a('0x45')](handleError(_0xc345dc,null));};exports[_0xca0a('0x46')]=function(_0x5a35a5,_0x22f5f8){return db[_0xca0a('0x2a')][_0xca0a('0x46')](_0x5a35a5['body'],{})[_0xca0a('0x22')](function(_0xed4673){var _0x17ffc8=_0x5a35a5['user']['get']({'plain':!![]});if(!_0x17ffc8)throw new Error(_0xca0a('0x47'));if(_0x17ffc8[_0xca0a('0x48')]==='user'){var _0x4d651e=_0xed4673[_0xca0a('0x49')]({'plain':!![]});var _0xf3d2f4=_0xca0a('0x4a');return db[_0xca0a('0x4b')][_0xca0a('0x4c')]({'where':{'name':_0xf3d2f4,'userProfileId':_0x17ffc8['userProfileId']},'raw':!![]})[_0xca0a('0x22')](function(_0xd6cd89){if(_0xd6cd89&&_0xd6cd89[_0xca0a('0x4d')]===0x0){return db[_0xca0a('0x4e')][_0xca0a('0x46')]({'name':_0x4d651e['name'],'resourceId':_0x4d651e['id'],'type':_0xd6cd89[_0xca0a('0x27')],'sectionId':_0xd6cd89['id']},{})[_0xca0a('0x22')](function(){return _0xed4673;});}else{return _0xed4673;}})['catch'](function(_0x4a7dc9){logger[_0xca0a('0x25')](_0xca0a('0x4f'),_0x4a7dc9);throw _0x4a7dc9;});}return _0xed4673;})[_0xca0a('0x22')](respondWithResult(_0x22f5f8,0xc9))[_0xca0a('0x45')](handleError(_0x22f5f8,null));};exports[_0xca0a('0x50')]=function(_0x1649b1,_0x7ec12a){if(_0x1649b1['body']['id']){delete _0x1649b1[_0xca0a('0x51')]['id'];}return db[_0xca0a('0x2a')][_0xca0a('0x4c')]({'where':{'id':_0x1649b1['params']['id']}})[_0xca0a('0x22')](handleEntityNotFound(_0x7ec12a,null))[_0xca0a('0x22')](saveUpdates(_0x1649b1['body'],null))[_0xca0a('0x22')](respondWithResult(_0x7ec12a,null))[_0xca0a('0x45')](handleError(_0x7ec12a,null));};exports[_0xca0a('0x23')]=function(_0x170c78,_0x97f0b0){return db[_0xca0a('0x2a')][_0xca0a('0x4c')]({'where':{'id':_0x170c78['params']['id']}})[_0xca0a('0x22')](handleEntityNotFound(_0x97f0b0,null))[_0xca0a('0x22')](removeEntity(_0x97f0b0,null))[_0xca0a('0x45')](handleError(_0x97f0b0,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b1c8ed1..f2b3458 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x1eb874,_0x3e4ce1){var _0x16e059=function(_0x29f412){while(--_0x29f412){_0x1eb874['push'](_0x1eb874['shift']());}};_0x16e059(++_0x3e4ce1);}(_0x326f,0xd1));var _0xf326=function(_0x10f3f2,_0x34056b){_0x10f3f2=_0x10f3f2-0x0;var _0x32cd87=_0x326f[_0x10f3f2];return _0x32cd87;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x16f7df,_0x66d40c){var _0x20020e=function(_0x2ddfc7){while(--_0x2ddfc7){_0x16f7df['push'](_0x16f7df['shift']());}};_0x20020e(++_0x66d40c);}(_0xe14b,0x93));var _0xbe14=function(_0x44c81f,_0xdb5984){_0x44c81f=_0x44c81f-0x0;var _0x1d7083=_0xe14b[_0x44c81f];return _0x1d7083;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 21198a4..b7b20f8 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3a0b18,_0x41443b){var _0x177d94=function(_0x166302){while(--_0x166302){_0x3a0b18['push'](_0x3a0b18['shift']());}};_0x177d94(++_0x41443b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2fe15c,_0x48713a){_0x2fe15c=_0x2fe15c-0x0;var _0x26ec58=_0xb10b[_0x2fe15c];return _0x26ec58;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x1b4da9,_0x21b725){var _0x3b3de9=function(_0x50e802){while(--_0x50e802){_0x1b4da9['push'](_0x1b4da9['shift']());}};_0x3b3de9(++_0x21b725);}(_0xb10b,0x12a));var _0xbb10=function(_0x38e47a,_0xc032eb){_0x38e47a=_0x38e47a-0x0;var _0x1b0649=_0xb10b[_0x38e47a];return _0x1b0649;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 5567a1f..b1a6315 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 _0x4ea3=['%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','root','server/files/plugins','originalname','replace','format'];(function(_0x592787,_0x4547d1){var _0x33e45c=function(_0x51e271){while(--_0x51e271){_0x592787['push'](_0x592787['shift']());}};_0x33e45c(++_0x4547d1);}(_0x4ea3,0x70));var _0x34ea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4ea3[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),controller[_0x34ea('0xb')]);router['get'](_0x34ea('0xc'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['get'](_0x34ea('0xe'),auth[_0x34ea('0x8')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bd8b6,_0x346287,_0x167667){_0x167667(null,path['join'](config[_0x34ea('0xf')],_0x34ea('0x10')));},'filename':function(_0x10135f,_0x233b11,_0x60725f){_0x233b11[_0x34ea('0x11')]=_0x233b11[_0x34ea('0x11')][_0x34ea('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x60725f(null,util[_0x34ea('0x13')](_0x34ea('0x14'),path[_0x34ea('0x15')](_0x233b11['originalname'],path[_0x34ea('0x16')](_0x233b11[_0x34ea('0x11')])),Date[_0x34ea('0x17')](),path[_0x34ea('0x16')](_0x233b11[_0x34ea('0x11')])));}})});router['post']('/',upload[_0x34ea('0x18')](_0x34ea('0x19')),controller[_0x34ea('0x1a')]);router[_0x34ea('0x1b')]('/webhook',controller[_0x34ea('0x1c')]);router[_0x34ea('0x1d')](_0x34ea('0xc'),auth['isAuthenticated'](),controller[_0x34ea('0x1e')]);router[_0x34ea('0x1f')](_0x34ea('0xc'),auth[_0x34ea('0x8')](),controller['delete']);module[_0x34ea('0x20')]=router; \ No newline at end of file +var _0xadb8=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','join','root','server/files/plugins','originalname','%s-%s%s','extname','post','single','file','upload','webhookPost','update','delete','exports'];(function(_0x57ffe6,_0xee95cc){var _0x59698f=function(_0x102e2b){while(--_0x102e2b){_0x57ffe6['push'](_0x57ffe6['shift']());}};_0x59698f(++_0xee95cc);}(_0xadb8,0x1d0));var _0x8adb=function(_0x28e71a,_0x4405bd){_0x28e71a=_0x28e71a-0x0;var _0x268fed=_0xadb8[_0x28e71a];return _0x268fed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8adb('0x0'));var timeout=require('connect-timeout');var express=require(_0x8adb('0x1'));var router=express[_0x8adb('0x2')]();var fs_extra=require(_0x8adb('0x3'));var auth=require(_0x8adb('0x4'));var interaction=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var controller=require(_0x8adb('0x7'));router['get']('/',auth[_0x8adb('0x8')](),controller[_0x8adb('0x9')]);router[_0x8adb('0xa')](_0x8adb('0xb'),controller[_0x8adb('0xc')]);router[_0x8adb('0xa')](_0x8adb('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8adb('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa095e1,_0x628c45,_0x46c6fb){_0x46c6fb(null,path[_0x8adb('0xf')](config[_0x8adb('0x10')],_0x8adb('0x11')));},'filename':function(_0x2a6574,_0x2828f1,_0x2d6b55){_0x2828f1[_0x8adb('0x12')]=_0x2828f1['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d6b55(null,util['format'](_0x8adb('0x13'),path['basename'](_0x2828f1[_0x8adb('0x12')],path[_0x8adb('0x14')](_0x2828f1[_0x8adb('0x12')])),Date['now'](),path[_0x8adb('0x14')](_0x2828f1[_0x8adb('0x12')])));}})});router[_0x8adb('0x15')]('/',upload[_0x8adb('0x16')](_0x8adb('0x17')),controller[_0x8adb('0x18')]);router['post'](_0x8adb('0xb'),controller[_0x8adb('0x19')]);router['put']('/:id',auth[_0x8adb('0x8')](),controller[_0x8adb('0x1a')]);router[_0x8adb('0x1b')](_0x8adb('0xd'),auth[_0x8adb('0x8')](),controller[_0x8adb('0x1b')]);module[_0x8adb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 82141a9..e7a453d 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 _0x1d75=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1d75,0x118));var _0x51d7=function(_0x1fa04f,_0x5a792f){_0x1fa04f=_0x1fa04f-0x0;var _0x2bd31c=_0x1d75[_0x1fa04f];return _0x2bd31c;};'use strict';var Sequelize=require(_0x51d7('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x51d7('0x1')](_0x51d7('0x2'),'script')},'description':{'type':Sequelize[_0x51d7('0x3')]},'version':{'type':Sequelize[_0x51d7('0x3')]},'path':{'type':Sequelize[_0x51d7('0x4')],'comment':_0x51d7('0x5')},'active':{'type':Sequelize[_0x51d7('0x6')],'defaultValue':0x0,'comment':_0x51d7('0x7')},'sidebar':{'type':Sequelize[_0x51d7('0x1')](_0x51d7('0x8'),_0x51d7('0x9'),_0x51d7('0xa'),_0x51d7('0xb')),'defaultValue':_0x51d7('0xa'),'comment':_0x51d7('0xc')},'icon':{'type':Sequelize[_0x51d7('0x4')]},'adminUrl':{'type':Sequelize[_0x51d7('0x4')]},'agentUrl':{'type':Sequelize[_0x51d7('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf20=['script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html'];(function(_0x15feca,_0x24cfb6){var _0x42557a=function(_0xceca4f){while(--_0xceca4f){_0x15feca['push'](_0x15feca['shift']());}};_0x42557a(++_0x24cfb6);}(_0xcf20,0xd8));var _0x0cf2=function(_0x3e9b19,_0x3ea2e1){_0x3e9b19=_0x3e9b19-0x0;var _0x4c3c4e=_0xcf20[_0x3e9b19];return _0x4c3c4e;};'use strict';var Sequelize=require('sequelize');module[_0x0cf2('0x0')]={'name':{'type':Sequelize[_0x0cf2('0x1')]},'type':{'type':Sequelize[_0x0cf2('0x2')](_0x0cf2('0x3'),_0x0cf2('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x0cf2('0x1')],'comment':_0x0cf2('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x0cf2('0x2')](_0x0cf2('0x6'),_0x0cf2('0x7'),_0x0cf2('0x8'),_0x0cf2('0x9')),'defaultValue':_0x0cf2('0x8'),'comment':_0x0cf2('0xa')},'icon':{'type':Sequelize[_0x0cf2('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x0cf2('0x1')]},'scriptName':{'type':Sequelize[_0x0cf2('0x1')]},'scriptPath':{'type':Sequelize[_0x0cf2('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 07dc53a..86a5aba 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 _0xecc3=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','download','join','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','basename','attachments/**/*','existsSync','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','server/files/plugins','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','readdirSync','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','parameters','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','body','role','userProfileId','user','UserProfileSection','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','archiver','ioredis'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xecc3,0x13c));var _0x3ecc=function(_0x511cc6,_0x12f08f){_0x511cc6=_0x511cc6-0x0;var _0x326955=_0xecc3[_0x511cc6];return _0x326955;};'use strict';var emlformat=require(_0x3ecc('0x0'));var rimraf=require(_0x3ecc('0x1'));var zipdir=require(_0x3ecc('0x2'));var jsonpatch=require(_0x3ecc('0x3'));var rp=require(_0x3ecc('0x4'));var moment=require(_0x3ecc('0x5'));var BPromise=require(_0x3ecc('0x6'));var Mustache=require(_0x3ecc('0x7'));var util=require(_0x3ecc('0x8'));var path=require(_0x3ecc('0x9'));var sox=require(_0x3ecc('0xa'));var csv=require(_0x3ecc('0xb'));var ejs=require(_0x3ecc('0xc'));var fs=require('fs');var fs_extra=require(_0x3ecc('0xd'));var _=require(_0x3ecc('0xe'));var squel=require(_0x3ecc('0xf'));var crypto=require(_0x3ecc('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3ecc('0x11'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x3ecc('0x1'));var archiver=require(_0x3ecc('0x12'));var Redis=require(_0x3ecc('0x13'));var authService=require(_0x3ecc('0x14'));var qs=require(_0x3ecc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ecc('0x16'));var logger=require(_0x3ecc('0x17'))(_0x3ecc('0x18'));var utils=require(_0x3ecc('0x19'));var config=require(_0x3ecc('0x1a'));var licenseUtil=require(_0x3ecc('0x1b'));var db=require(_0x3ecc('0x1c'))['db'];config[_0x3ecc('0x1d')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3ecc('0x1e'))(new Redis(config[_0x3ecc('0x1d')]));require(_0x3ecc('0x1f'))[_0x3ecc('0x20')](socket);function respondWithStatusCode(_0x354f7e,_0x5cb784){_0x5cb784=_0x5cb784||0xcc;return function(_0x2525b5){if(_0x2525b5){return _0x354f7e[_0x3ecc('0x21')](_0x5cb784);}return _0x354f7e[_0x3ecc('0x22')](_0x5cb784)[_0x3ecc('0x23')]();};}function respondWithResult(_0x77297f,_0x450023){_0x450023=_0x450023||0xc8;return function(_0x114e96){if(_0x114e96){return _0x77297f['status'](_0x450023)[_0x3ecc('0x24')](_0x114e96);}};}function respondWithFilteredResult(_0x5c6b7b,_0x26c3f0){return function(_0x32d4b4){if(_0x32d4b4){var _0x4d8c9e=typeof _0x26c3f0[_0x3ecc('0x25')]===_0x3ecc('0x26')&&typeof _0x26c3f0['limit']===_0x3ecc('0x26');var _0x9d39c7=_0x32d4b4[_0x3ecc('0x27')];var _0x4afd10=_0x4d8c9e?0x0:_0x26c3f0[_0x3ecc('0x25')];var _0x2f0b1a=_0x4d8c9e?_0x32d4b4['count']:_0x26c3f0[_0x3ecc('0x25')]+_0x26c3f0['limit'];var _0x5edc86;if(_0x2f0b1a>=_0x9d39c7){_0x2f0b1a=_0x9d39c7;_0x5edc86=0xc8;}else{_0x5edc86=0xce;}_0x5c6b7b[_0x3ecc('0x22')](_0x5edc86);return _0x5c6b7b[_0x3ecc('0x28')](_0x3ecc('0x29'),_0x4afd10+'-'+_0x2f0b1a+'/'+_0x9d39c7)['json'](_0x32d4b4);}return null;};}function patchUpdates(_0x2298e9){return function(_0x194675){try{jsonpatch[_0x3ecc('0x2a')](_0x194675,_0x2298e9,!![]);}catch(_0xf52fb9){return BPromise[_0x3ecc('0x2b')](_0xf52fb9);}return _0x194675['save']();};}function saveUpdates(_0x4bba72,_0x81c276){return function(_0x495c02){if(_0x495c02){return _0x495c02[_0x3ecc('0x2c')](_0x4bba72)['then'](function(_0x10ab1b){return _0x10ab1b;});}return null;};}function removeEntity(_0x22e015,_0x16e217){return function(_0x9da96){if(_0x9da96){return _0x9da96[_0x3ecc('0x2d')]()[_0x3ecc('0x2e')](function(){var _0x145f02=_0x9da96[_0x3ecc('0x2f')]({'plain':!![]});var _0x574f71='Plugins';return db[_0x3ecc('0x30')][_0x3ecc('0x2d')]({'where':{'type':_0x574f71,'resourceId':_0x145f02['id']}})[_0x3ecc('0x2e')](function(){return _0x9da96;});})[_0x3ecc('0x2e')](function(){_0x22e015[_0x3ecc('0x22')](0xcc)[_0x3ecc('0x23')]();});}};}function handleEntityNotFound(_0x13de04,_0x4380ef){return function(_0x28b0e5){if(!_0x28b0e5){_0x13de04['sendStatus'](0x194);}return _0x28b0e5;};}function handleError(_0x11f5f2,_0x20951c){_0x20951c=_0x20951c||0x1f4;return function(_0x4b70ac){logger[_0x3ecc('0x31')](_0x4b70ac[_0x3ecc('0x32')]);if(_0x4b70ac['name']){delete _0x4b70ac[_0x3ecc('0x33')];}_0x11f5f2[_0x3ecc('0x22')](_0x20951c)[_0x3ecc('0x34')](_0x4b70ac);};}exports[_0x3ecc('0x35')]=function(_0x63a015,_0x41f54c){var _0x5f4f6d={},_0x204a22={},_0x1a89c4={'count':0x0,'rows':[]};var _0x493fd5=_[_0x3ecc('0x36')](db[_0x3ecc('0x37')][_0x3ecc('0x38')],function(_0x1cc00a){return{'name':_0x1cc00a['fieldName'],'type':_0x1cc00a[_0x3ecc('0x39')]['key']};});_0x204a22[_0x3ecc('0x3a')]=_[_0x3ecc('0x36')](_0x493fd5,_0x3ecc('0x33'));_0x204a22[_0x3ecc('0x3b')]=_[_0x3ecc('0x3c')](_0x63a015['query']);_0x204a22['filters']=_[_0x3ecc('0x3d')](_0x204a22[_0x3ecc('0x3a')],_0x204a22[_0x3ecc('0x3b')]);_0x5f4f6d[_0x3ecc('0x3e')]=_[_0x3ecc('0x3d')](_0x204a22[_0x3ecc('0x3a')],qs[_0x3ecc('0x3f')](_0x63a015[_0x3ecc('0x3b')]['fields']));_0x5f4f6d[_0x3ecc('0x3e')]=_0x5f4f6d[_0x3ecc('0x3e')][_0x3ecc('0x40')]?_0x5f4f6d[_0x3ecc('0x3e')]:_0x204a22['model'];if(!_0x63a015[_0x3ecc('0x3b')]['hasOwnProperty'](_0x3ecc('0x41'))){_0x5f4f6d[_0x3ecc('0x42')]=qs['limit'](_0x63a015['query'][_0x3ecc('0x42')]);_0x5f4f6d[_0x3ecc('0x25')]=qs[_0x3ecc('0x25')](_0x63a015['query']['offset']);}_0x5f4f6d['order']=qs[_0x3ecc('0x43')](_0x63a015[_0x3ecc('0x3b')][_0x3ecc('0x43')]);_0x5f4f6d[_0x3ecc('0x44')]=qs[_0x3ecc('0x45')](_['pick'](_0x63a015[_0x3ecc('0x3b')],_0x204a22['filters']),_0x493fd5);if(_0x63a015['query'][_0x3ecc('0x46')]){_0x5f4f6d[_0x3ecc('0x44')]=_['merge'](_0x5f4f6d['where'],{'$or':_['map'](_0x493fd5,function(_0x12df98){if(_0x12df98[_0x3ecc('0x39')]!==_0x3ecc('0x47')){var _0x2b6d4e={};_0x2b6d4e[_0x12df98['name']]={'$like':'%'+_0x63a015['query'][_0x3ecc('0x46')]+'%'};return _0x2b6d4e;}})});}_0x5f4f6d=_[_0x3ecc('0x48')]({},_0x5f4f6d,_0x63a015[_0x3ecc('0x49')]);var _0x4690fe={'where':_0x5f4f6d['where']};return db[_0x3ecc('0x37')][_0x3ecc('0x27')](_0x4690fe)['then'](function(_0x2309f5){_0x1a89c4[_0x3ecc('0x27')]=_0x2309f5;if(_0x63a015[_0x3ecc('0x3b')]['includeAll']){_0x5f4f6d['include']=[{'all':!![]}];}return db[_0x3ecc('0x37')][_0x3ecc('0x4a')](_0x5f4f6d);})['then'](function(_0x5ac8bd){_0x1a89c4[_0x3ecc('0x4b')]=_0x5ac8bd;return _0x1a89c4;})[_0x3ecc('0x2e')](respondWithFilteredResult(_0x41f54c,_0x5f4f6d))[_0x3ecc('0x4c')](handleError(_0x41f54c,null));};exports[_0x3ecc('0x4d')]=function(_0x124e9a,_0x4a6232){var _0x5710d5={'raw':!![],'where':{'id':_0x124e9a[_0x3ecc('0x4e')]['id']}},_0x23fffe={};_0x23fffe[_0x3ecc('0x3a')]=_[_0x3ecc('0x3c')](db['Plugin'][_0x3ecc('0x38')]);_0x23fffe[_0x3ecc('0x3b')]=_['keys'](_0x124e9a[_0x3ecc('0x3b')]);_0x23fffe['filters']=_[_0x3ecc('0x3d')](_0x23fffe[_0x3ecc('0x3a')],_0x23fffe[_0x3ecc('0x3b')]);_0x5710d5['attributes']=_['intersection'](_0x23fffe[_0x3ecc('0x3a')],qs['fields'](_0x124e9a[_0x3ecc('0x3b')]['fields']));_0x5710d5[_0x3ecc('0x3e')]=_0x5710d5['attributes']['length']?_0x5710d5['attributes']:_0x23fffe[_0x3ecc('0x3a')];if(_0x124e9a['query'][_0x3ecc('0x4f')]){_0x5710d5[_0x3ecc('0x50')]=[{'all':!![]}];}_0x5710d5=_[_0x3ecc('0x48')]({},_0x5710d5,_0x124e9a[_0x3ecc('0x49')]);return db['Plugin'][_0x3ecc('0x51')](_0x5710d5)[_0x3ecc('0x2e')](handleEntityNotFound(_0x4a6232,null))[_0x3ecc('0x2e')](respondWithResult(_0x4a6232,null))['catch'](handleError(_0x4a6232,null));};exports[_0x3ecc('0x52')]=function(_0x11bc81,_0x2cf2a4,_0x2bbf98){return db['Plugin']['find']({'where':{'id':_0x11bc81[_0x3ecc('0x4e')]['id']},'attributes':['name',_0x3ecc('0x9')],'raw':!![]})[_0x3ecc('0x2e')](handleEntityNotFound(_0x2cf2a4,null))[_0x3ecc('0x2e')](function(_0x44b995){if(_0x44b995){var _0x3efde0=path[_0x3ecc('0x53')](config['root'],'server/files/plugins',util['format'](_0x3ecc('0x54'),path['basename'](_0x44b995['path'])));var _0x16f61f=fs[_0x3ecc('0x55')](_0x3efde0);var _0x23f38d=archiver(_0x3ecc('0x56'),{'zlib':{'level':0x9}});_0x23f38d['on'](_0x3ecc('0x57'),function(_0x313a5f){if(_0x313a5f[_0x3ecc('0x58')]===_0x3ecc('0x59')){logger[_0x3ecc('0x31')](_0x313a5f);}else{throw new db[(_0x3ecc('0x5a'))][(_0x3ecc('0x5b'))](_0x3ecc('0x5c'));}});_0x23f38d['on']('error',function(_0xd90126){throw new db['Sequelize'][(_0x3ecc('0x5b'))](_0x3ecc('0x5c'));});_0x23f38d[_0x3ecc('0x5d')](_0x16f61f);_0x23f38d[_0x3ecc('0x5e')](_0x3ecc('0x5f'),{'cwd':path['join'](config[_0x3ecc('0x60')],'server/files/plugins',path[_0x3ecc('0x61')](_0x44b995[_0x3ecc('0x9')])),'ignore':[path[_0x3ecc('0x53')](path[_0x3ecc('0x62')](_0x44b995['path']),'node_modules/**/*'),path[_0x3ecc('0x53')](path[_0x3ecc('0x62')](_0x44b995[_0x3ecc('0x9')]),_0x3ecc('0x63'))],'nodir':!![]})['finalize']();_0x16f61f['on']('close',function(){if(!fs[_0x3ecc('0x64')](_0x3efde0)){throw new db[(_0x3ecc('0x5a'))]['Error']('Plugin\x20not\x20found');}return _0x2cf2a4[_0x3ecc('0x52')](_0x3efde0,util[_0x3ecc('0x65')]('%s.zip',path['basename'](_0x44b995[_0x3ecc('0x9')])),function(_0x48f3a4){if(_0x48f3a4){throw new db[(_0x3ecc('0x5a'))]['Error'](_0x3ecc('0x66'));}fs[_0x3ecc('0x67')](_0x3efde0);logger[_0x3ecc('0x68')](_0x3ecc('0x69'));logger[_0x3ecc('0x68')](_0x3ecc('0x6a'));});});}return null;})[_0x3ecc('0x4c')](handleError(_0x2cf2a4,null));};exports['upload']=function(_0x370b0d,_0x8e0172,_0x30e1d0){var _0x519ed6=path[_0x3ecc('0x62')](_0x370b0d[_0x3ecc('0x6b')]['filename'],path[_0x3ecc('0x6c')](_0x370b0d[_0x3ecc('0x6b')][_0x3ecc('0x6d')]));var _0x5d2f7e=path[_0x3ecc('0x53')](config[_0x3ecc('0x60')],_0x3ecc('0x6e'),_0x370b0d[_0x3ecc('0x6b')][_0x3ecc('0x6d')]);var _0xa24814=path['join'](config['root'],_0x3ecc('0x6e'),_0x519ed6);logger[_0x3ecc('0x68')]('Plugin\x20upload\x20filepath:\x20%s',_0x5d2f7e);logger[_0x3ecc('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0xa24814);try{fs[_0x3ecc('0x6f')](_0x5d2f7e,parseInt(_0x3ecc('0x70'),0x8));extract(_0x5d2f7e,{'dir':_0xa24814},function(_0xb2f7a9){if(_0xb2f7a9){logger[_0x3ecc('0x31')](_0xb2f7a9);handleError(_0xb2f7a9,!![]);};var _0x360f3f=fs['readdirSync'](_0xa24814);if(_0x360f3f[_0x3ecc('0x40')]>0x1){removeReferences(_0x5d2f7e,_0xa24814);logger[_0x3ecc('0x31')](_0x3ecc('0x71'));return _0x30e1d0(new Error(_0x3ecc('0x71')));}var _0x5e9493=fs[_0x3ecc('0x72')](path['join'](_0xa24814,_0x360f3f[0x0]));if(_0x5e9493['isFile']()){removeReferences(_0x5d2f7e,_0xa24814);logger['error'](_0x3ecc('0x71'));return _0x30e1d0(new Error(_0x3ecc('0x71')));}if(_0x5e9493['isDirectory']()){var _0x293dab=fs[_0x3ecc('0x73')](path['join'](_0xa24814,_0x360f3f[0x0]));if(_0x293dab[_0x3ecc('0x40')]===0x0){removeReferences(_0x5d2f7e,_0xa24814);logger[_0x3ecc('0x31')]('Invalid\x20plugin\x20structure');return _0x30e1d0(new Error(_0x3ecc('0x71')));}var _0x5dec07=_0x293dab['some'](function(_0x4e1677){return _0x4e1677===_0x3ecc('0x74');});if(!_0x5dec07){return _0x30e1d0(new Error(_0x3ecc('0x75')));}var _0x4f2fa8=fs[_0x3ecc('0x76')](path[_0x3ecc('0x53')](_0xa24814,_0x360f3f[0x0],_0x3ecc('0x74')));var _0x1914c6=JSON['parse'](_0x4f2fa8);if(_0x3ecc('0x26')==typeof _0x1914c6[_0x3ecc('0x33')]){return _0x30e1d0(new Error(_0x3ecc('0x77')));}if(_0x3ecc('0x26')==typeof _0x1914c6[_0x3ecc('0x39')]){return _0x30e1d0(new Error(_0x3ecc('0x78')));}if('undefined'==typeof _0x1914c6[_0x3ecc('0x79')]){return _0x30e1d0(new Error(_0x3ecc('0x7a')));}if(_0x3ecc('0x26')==typeof _0x1914c6['parameters']){return _0x30e1d0(new Error(_0x3ecc('0x7b')));}if(_0x1914c6[_0x3ecc('0x39')]===_0x3ecc('0x7c')){if(_0x3ecc('0x26')==typeof _0x1914c6['parameters'][_0x3ecc('0x7d')]){return _0x30e1d0(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x3ecc('0x26')==typeof _0x1914c6['parameters'][_0x3ecc('0x7d')]['admin']&&'undefined'==typeof _0x1914c6[_0x3ecc('0x7e')][_0x3ecc('0x7d')][_0x3ecc('0x7f')]){return _0x30e1d0(new Error(_0x3ecc('0x80')));}}else if(_0x1914c6[_0x3ecc('0x39')]===_0x3ecc('0x81')){if(_0x3ecc('0x26')==typeof _0x1914c6[_0x3ecc('0x7e')][_0x3ecc('0x82')]){return _0x30e1d0(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x3ecc('0x26')==typeof _0x1914c6[_0x3ecc('0x7e')][_0x3ecc('0x83')]){return _0x30e1d0(new Error(_0x3ecc('0x84')));}}else{return _0x30e1d0(new Error(_0x3ecc('0x85')));}var _0xd4e8d0=_0x1914c6[_0x3ecc('0x33')];var _0x36434f=_0x1914c6[_0x3ecc('0x86')];var _0x22ff8d=_0x1914c6[_0x3ecc('0x39')];var _0x30ec67=_0x1914c6[_0x3ecc('0x87')]?_0x1914c6[_0x3ecc('0x87')]:_0x3ecc('0x88');var _0x291ede=_0x1914c6['icon']?_0x1914c6['icon']:'icon-apps';var _0x2c1611='';var _0x5c3358='';var _0xf960a2='';var _0x3b271c='';var _0x1fcc8d=_0x1914c6[_0x3ecc('0x79')];if(_0x22ff8d===_0x3ecc('0x7c')){if(_0x3ecc('0x26')!=typeof _0x1914c6['parameters']['views'][_0x3ecc('0x89')]){var _0x178e36=_0x1914c6[_0x3ecc('0x7e')][_0x3ecc('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3ecc('0x8a')](_0x178e36)){_0x2c1611=path[_0x3ecc('0x53')](_0x3ecc('0x8b'),_0x519ed6,_0x360f3f[0x0],_0x178e36);}else{_0x2c1611=_0x178e36;}}else{logger[_0x3ecc('0x68')](_0x3ecc('0x8c'));}if(_0x3ecc('0x26')!=typeof _0x1914c6[_0x3ecc('0x7e')]['views'][_0x3ecc('0x7f')]){var _0x567789=_0x1914c6[_0x3ecc('0x7e')]['views'][_0x3ecc('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x3ecc('0x8a')](_0x567789)){_0x5c3358=path[_0x3ecc('0x53')](_0x3ecc('0x8b'),_0x519ed6,_0x360f3f[0x0],_0x567789);}else{_0x5c3358=_0x567789;}}else{logger[_0x3ecc('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x22ff8d===_0x3ecc('0x81')){_0xf960a2=_0x1914c6[_0x3ecc('0x7e')][_0x3ecc('0x82')];_0x3b271c=_0x1914c6[_0x3ecc('0x7e')][_0x3ecc('0x83')];if('undefined'!=typeof _0x1914c6['parameters'][_0x3ecc('0x7d')]){if(_0x3ecc('0x26')!=typeof _0x1914c6[_0x3ecc('0x7e')][_0x3ecc('0x7d')][_0x3ecc('0x89')]){var _0x178e36=_0x1914c6['parameters'][_0x3ecc('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3ecc('0x8a')](_0x178e36)){_0x2c1611=path[_0x3ecc('0x53')](_0x3ecc('0x8b'),_0x519ed6,_0x360f3f[0x0],_0x178e36);}else{_0x2c1611=_0x178e36;}}if(_0x3ecc('0x26')!=typeof _0x1914c6[_0x3ecc('0x7e')][_0x3ecc('0x7d')][_0x3ecc('0x7f')]){var _0x567789=_0x1914c6[_0x3ecc('0x7e')]['views'][_0x3ecc('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x3ecc('0x8a')](_0x567789)){_0x5c3358=path['join'](_0x3ecc('0x8b'),_0x519ed6,_0x360f3f[0x0],_0x567789);}else{_0x5c3358=_0x567789;}}}}var _0x4042a2={'name':_0xd4e8d0,'description':_0x36434f,'path':path[_0x3ecc('0x53')](_0x519ed6,_0x360f3f[0x0]),'type':_0x22ff8d,'sidebar':_0x30ec67,'icon':_0x291ede,'adminUrl':_0x2c1611,'agentUrl':_0x5c3358,'scriptName':_0xf960a2,'scriptPath':_0x3b271c,'version':_0x1fcc8d};removeReferences(_0x5d2f7e,null);return db['Plugin']['create'](_0x4042a2)[_0x3ecc('0x2e')](function(_0x42765b){var _0x104a25={'role':_0x370b0d[_0x3ecc('0x8d')][_0x3ecc('0x8e')],'userProfileId':_0x370b0d[_0x3ecc('0x8d')][_0x3ecc('0x8f')]};if(!_0x104a25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x104a25['role']===_0x3ecc('0x90')){var _0xff69e6=_0x42765b['get']({'plain':!![]});return db[_0x3ecc('0x91')][_0x3ecc('0x51')]({'where':{'name':_0x3ecc('0x92'),'userProfileId':_0x104a25[_0x3ecc('0x8f')]},'raw':!![]})['then'](function(_0x4f8b39){if(_0x4f8b39&&_0x4f8b39[_0x3ecc('0x93')]===0x0){return db[_0x3ecc('0x30')][_0x3ecc('0x94')]({'name':_0xff69e6[_0x3ecc('0x33')],'resourceId':_0xff69e6['id'],'type':_0x4f8b39[_0x3ecc('0x33')],'sectionId':_0x4f8b39['id']},{})[_0x3ecc('0x2e')](function(){return _0x42765b;});}else{return _0x42765b;}})[_0x3ecc('0x4c')](function(_0x408268){logger[_0x3ecc('0x31')](_0x3ecc('0x95'),_0x408268);throw _0x408268;});}return _0x42765b;})[_0x3ecc('0x2e')](respondWithResult(_0x8e0172,null))['catch'](handleError(_0x8e0172,null));}});}catch(_0x226a45){_0x8e0172[_0x3ecc('0x22')](0x1f4)[_0x3ecc('0x34')](_0x226a45);}};function removeReferences(_0x26b505,_0x102ec1){try{if(_0x26b505){fs[_0x3ecc('0x67')](_0x26b505);logger[_0x3ecc('0x68')](_0x3ecc('0x96'));}if(_0x102ec1){rimraf(_0x102ec1,function(){});logger[_0x3ecc('0x68')](_0x3ecc('0x97'));}}catch(_0x484efe){logger[_0x3ecc('0x31')](_0x484efe);}}exports['update']=function(_0x3d2921,_0x1f33ea,_0x39e3d6){return db[_0x3ecc('0x37')][_0x3ecc('0x51')]({'where':{'id':_0x3d2921[_0x3ecc('0x4e')]['id']}})[_0x3ecc('0x2e')](handleEntityNotFound(_0x1f33ea,null))['then'](saveUpdates(_0x3d2921['body'],null))[_0x3ecc('0x2e')](respondWithResult(_0x1f33ea,null))['catch'](handleError(_0x1f33ea,null));};exports[_0x3ecc('0x98')]=function(_0xdfd01a,_0x404a92,_0x49884b){return db['Plugin'][_0x3ecc('0x51')]({'where':{'id':_0xdfd01a[_0x3ecc('0x4e')]['id']}})[_0x3ecc('0x2e')](function(_0x59dd07){if(_0x59dd07){return _0x59dd07[_0x3ecc('0x2d')]();}})[_0x3ecc('0x2e')](function(_0x1bccaf){rimraf(path[_0x3ecc('0x53')](config[_0x3ecc('0x60')],'server/files/plugins',path[_0x3ecc('0x61')](_0x1bccaf[_0x3ecc('0x9')])),function(){});return _0x1bccaf;})[_0x3ecc('0x2e')](handleEntityNotFound(_0x404a92,null))[_0x3ecc('0x2e')](respondWithStatusCode(_0x404a92,null))[_0x3ecc('0x4c')](handleError(_0x404a92,null));};exports['webhookGet']=function(_0x3edb6a,_0x977d4,_0x5e85c6){return BPromise[_0x3ecc('0x99')]()['then'](function(){if(!_0x3edb6a['query']['path']){throw new Error(_0x3ecc('0x9a'));}if(!_0x3edb6a[_0x3ecc('0x3b')][_0x3ecc('0x9b')]){throw new Error(_0x3ecc('0x9c'));}var _0x1aafb0=_0x3edb6a['query'][_0x3ecc('0x9d')]?_0x3edb6a['query']['hostname']+':'+_0x3edb6a[_0x3ecc('0x3b')][_0x3ecc('0x9b')]:_0x3ecc('0x9e')+_0x3edb6a['query'][_0x3ecc('0x9b')];var _0x5dc6a2=_0x3edb6a[_0x3ecc('0x3b')][_0x3ecc('0x24')]?_0x3edb6a[_0x3ecc('0x3b')][_0x3ecc('0x24')]:!![];var _0x85a60b=_0x3edb6a['query'][_0x3ecc('0x9f')]?_0x3edb6a[_0x3ecc('0x3b')]['encoding']:null;var _0x5811d0={'method':_0x3edb6a[_0x3ecc('0xa0')],'uri':util[_0x3ecc('0x65')](_0x3ecc('0xa1'),_0x1aafb0,_0x3edb6a[_0x3ecc('0x3b')]['path']),'json':_0x5dc6a2,'resolveWithFullResponse':!![],'encoding':_0x85a60b,'qs':_0x3edb6a[_0x3ecc('0x3b')]};if(_0x3edb6a[_0x3ecc('0xa2')]){_0x5811d0[_0x3ecc('0xa2')]=_0x3edb6a[_0x3ecc('0xa2')];if(_0x5811d0[_0x3ecc('0xa2')]['content-length']){delete _0x5811d0['headers'][_0x3ecc('0xa3')];}}if(_0x5811d0[_0x3ecc('0xa2')][_0x3ecc('0xa4')]){delete _0x5811d0[_0x3ecc('0xa2')]['content-type'];}return rp(_0x5811d0);})[_0x3ecc('0x2e')](function(_0x1d8b2c){if(_0x1d8b2c){_0x977d4['set'](_0x1d8b2c[_0x3ecc('0xa2')]);logger[_0x3ecc('0x68')](_0x1d8b2c['body']);if(_[_0x3ecc('0xa5')](_0x3edb6a['query'][_0x3ecc('0x9')],_0x3ecc('0x52'))&&_0x1d8b2c[_0x3ecc('0xa6')]==0x1f4){return _0x977d4[_0x3ecc('0x21')](_0x1d8b2c[_0x3ecc('0xa6')]);}else{return _0x977d4['status'](_0x1d8b2c[_0x3ecc('0xa6')])[_0x3ecc('0x34')](_0x1d8b2c[_0x3ecc('0x8d')]);}}else{return _0x977d4[_0x3ecc('0x21')](0xc8);}})['catch'](handleError(_0x977d4,null));};exports[_0x3ecc('0xa7')]=function(_0x2b3e35,_0x118bc1,_0x13766f){return BPromise[_0x3ecc('0x99')]()[_0x3ecc('0x2e')](function(){if(!_0x2b3e35[_0x3ecc('0x3b')][_0x3ecc('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2b3e35[_0x3ecc('0x3b')][_0x3ecc('0x9b')]){throw new Error(_0x3ecc('0x9c'));}var _0xe061ca=_0x2b3e35[_0x3ecc('0x3b')]['hostname']?_0x2b3e35['query']['hostname']+':'+_0x2b3e35['query'][_0x3ecc('0x9b')]:_0x3ecc('0x9e')+_0x2b3e35[_0x3ecc('0x3b')][_0x3ecc('0x9b')];var _0x14b59d=_0x2b3e35[_0x3ecc('0x3b')]['json']?_0x2b3e35['query']['json']:!![];var _0x481a72=_0x2b3e35[_0x3ecc('0x3b')][_0x3ecc('0x9f')]?_0x2b3e35[_0x3ecc('0x3b')]['encoding']:null;var _0x141fe3={'method':_0x2b3e35['method'],'uri':util[_0x3ecc('0x65')](_0x3ecc('0xa1'),_0xe061ca,_0x2b3e35[_0x3ecc('0x3b')]['path']),'json':_0x14b59d,'resolveWithFullResponse':!![],'encoding':_0x481a72,'body':_0x2b3e35['body']};if(_0x2b3e35['headers']){_0x141fe3[_0x3ecc('0xa2')]=_0x2b3e35[_0x3ecc('0xa2')];if(_0x141fe3['headers']['content-length']){delete _0x141fe3['headers'][_0x3ecc('0xa3')];}}if(_0x141fe3[_0x3ecc('0xa2')]['content-type']){delete _0x141fe3[_0x3ecc('0xa2')][_0x3ecc('0xa4')];}return rp(_0x141fe3);})[_0x3ecc('0x2e')](function(_0x5cd524){if(_0x5cd524){_0x118bc1[_0x3ecc('0x28')](_0x5cd524[_0x3ecc('0xa2')]);logger[_0x3ecc('0x68')](_0x5cd524[_0x3ecc('0x8d')]);return _0x118bc1[_0x3ecc('0x22')](_0x5cd524['statusCode'])[_0x3ecc('0x34')](_0x5cd524['body']);}else{return _0x118bc1[_0x3ecc('0x21')](0xc8);}})[_0x3ecc('0x4c')](handleError(_0x118bc1,null));}; \ No newline at end of file +var _0xf984=['Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./plugin.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','find','catch','download','params','join','format','%s.zip','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','server/files/plugins','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s'];(function(_0x3675d5,_0x36fca3){var _0x15c2b8=function(_0x5937d1){while(--_0x5937d1){_0x3675d5['push'](_0x3675d5['shift']());}};_0x15c2b8(++_0x36fca3);}(_0xf984,0x18b));var _0x4f98=function(_0x45e8e4,_0x56c8c1){_0x45e8e4=_0x45e8e4-0x0;var _0x4fcfb8=_0xf984[_0x45e8e4];return _0x4fcfb8;};'use strict';var emlformat=require(_0x4f98('0x0'));var rimraf=require(_0x4f98('0x1'));var zipdir=require(_0x4f98('0x2'));var jsonpatch=require(_0x4f98('0x3'));var rp=require('request-promise');var moment=require(_0x4f98('0x4'));var BPromise=require(_0x4f98('0x5'));var Mustache=require(_0x4f98('0x6'));var util=require('util');var path=require(_0x4f98('0x7'));var sox=require(_0x4f98('0x8'));var csv=require(_0x4f98('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f98('0xa'));var _=require('lodash');var squel=require(_0x4f98('0xb'));var crypto=require(_0x4f98('0xc'));var jsforce=require(_0x4f98('0xd'));var deskjs=require(_0x4f98('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4f98('0xf'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x4f98('0x10'));var Redis=require(_0x4f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4f98('0x12'));var as=require(_0x4f98('0x13'));var hardwareService=require(_0x4f98('0x14'));var logger=require(_0x4f98('0x15'))(_0x4f98('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f98('0x17'))['db'];config['redis']=_[_0x4f98('0x18')](config['redis'],{'host':_0x4f98('0x19'),'port':0x18eb});var socket=require(_0x4f98('0x1a'))(new Redis(config[_0x4f98('0x1b')]));require(_0x4f98('0x1c'))['register'](socket);function respondWithStatusCode(_0x2f21b8,_0x2e2af3){_0x2e2af3=_0x2e2af3||0xcc;return function(_0x42ad58){if(_0x42ad58){return _0x2f21b8[_0x4f98('0x1d')](_0x2e2af3);}return _0x2f21b8['status'](_0x2e2af3)['end']();};}function respondWithResult(_0x22ff18,_0x326e31){_0x326e31=_0x326e31||0xc8;return function(_0x118177){if(_0x118177){return _0x22ff18[_0x4f98('0x1e')](_0x326e31)[_0x4f98('0x1f')](_0x118177);}};}function respondWithFilteredResult(_0xbd34a8,_0x2ea22b){return function(_0x5ee0b3){if(_0x5ee0b3){var _0x16cc21=typeof _0x2ea22b[_0x4f98('0x20')]===_0x4f98('0x21')&&typeof _0x2ea22b['limit']===_0x4f98('0x21');var _0xe51a18=_0x5ee0b3[_0x4f98('0x22')];var _0x38e65c=_0x16cc21?0x0:_0x2ea22b['offset'];var _0x231b22=_0x16cc21?_0x5ee0b3[_0x4f98('0x22')]:_0x2ea22b['offset']+_0x2ea22b[_0x4f98('0x23')];var _0x5d02eb;if(_0x231b22>=_0xe51a18){_0x231b22=_0xe51a18;_0x5d02eb=0xc8;}else{_0x5d02eb=0xce;}_0xbd34a8[_0x4f98('0x1e')](_0x5d02eb);return _0xbd34a8[_0x4f98('0x24')](_0x4f98('0x25'),_0x38e65c+'-'+_0x231b22+'/'+_0xe51a18)[_0x4f98('0x1f')](_0x5ee0b3);}return null;};}function patchUpdates(_0xeebbfa){return function(_0x4448ea){try{jsonpatch[_0x4f98('0x26')](_0x4448ea,_0xeebbfa,!![]);}catch(_0x4694bd){return BPromise[_0x4f98('0x27')](_0x4694bd);}return _0x4448ea['save']();};}function saveUpdates(_0x53b328,_0x2d1556){return function(_0x77a209){if(_0x77a209){return _0x77a209[_0x4f98('0x28')](_0x53b328)['then'](function(_0x488915){return _0x488915;});}return null;};}function removeEntity(_0x58b09e,_0x23abc7){return function(_0x18b1ec){if(_0x18b1ec){return _0x18b1ec[_0x4f98('0x29')]()[_0x4f98('0x2a')](function(){var _0x5bbd70=_0x18b1ec[_0x4f98('0x2b')]({'plain':!![]});var _0xda3ec4=_0x4f98('0x2c');return db[_0x4f98('0x2d')][_0x4f98('0x29')]({'where':{'type':_0xda3ec4,'resourceId':_0x5bbd70['id']}})[_0x4f98('0x2a')](function(){return _0x18b1ec;});})[_0x4f98('0x2a')](function(){_0x58b09e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bdc7b,_0x4f08f0){return function(_0x41d433){if(!_0x41d433){_0x3bdc7b['sendStatus'](0x194);}return _0x41d433;};}function handleError(_0x4bc831,_0x5a6916){_0x5a6916=_0x5a6916||0x1f4;return function(_0x5ba062){logger[_0x4f98('0x2e')](_0x5ba062[_0x4f98('0x2f')]);if(_0x5ba062[_0x4f98('0x30')]){delete _0x5ba062['name'];}_0x4bc831[_0x4f98('0x1e')](_0x5a6916)[_0x4f98('0x31')](_0x5ba062);};}exports[_0x4f98('0x32')]=function(_0x5050f9,_0x97ff62){var _0xa0e075={},_0x14f79e={},_0x3d3c11={'count':0x0,'rows':[]};var _0x56905b=_[_0x4f98('0x33')](db[_0x4f98('0x34')][_0x4f98('0x35')],function(_0x3838ef){return{'name':_0x3838ef[_0x4f98('0x36')],'type':_0x3838ef[_0x4f98('0x37')][_0x4f98('0x38')]};});_0x14f79e[_0x4f98('0x39')]=_[_0x4f98('0x33')](_0x56905b,_0x4f98('0x30'));_0x14f79e[_0x4f98('0x3a')]=_[_0x4f98('0x3b')](_0x5050f9['query']);_0x14f79e[_0x4f98('0x3c')]=_[_0x4f98('0x3d')](_0x14f79e[_0x4f98('0x39')],_0x14f79e[_0x4f98('0x3a')]);_0xa0e075[_0x4f98('0x3e')]=_[_0x4f98('0x3d')](_0x14f79e[_0x4f98('0x39')],qs[_0x4f98('0x3f')](_0x5050f9[_0x4f98('0x3a')][_0x4f98('0x3f')]));_0xa0e075[_0x4f98('0x3e')]=_0xa0e075[_0x4f98('0x3e')][_0x4f98('0x40')]?_0xa0e075[_0x4f98('0x3e')]:_0x14f79e[_0x4f98('0x39')];if(!_0x5050f9[_0x4f98('0x3a')]['hasOwnProperty'](_0x4f98('0x41'))){_0xa0e075[_0x4f98('0x23')]=qs[_0x4f98('0x23')](_0x5050f9[_0x4f98('0x3a')][_0x4f98('0x23')]);_0xa0e075[_0x4f98('0x20')]=qs['offset'](_0x5050f9[_0x4f98('0x3a')]['offset']);}_0xa0e075[_0x4f98('0x42')]=qs[_0x4f98('0x43')](_0x5050f9['query']['sort']);_0xa0e075[_0x4f98('0x44')]=qs[_0x4f98('0x3c')](_[_0x4f98('0x45')](_0x5050f9[_0x4f98('0x3a')],_0x14f79e[_0x4f98('0x3c')]),_0x56905b);if(_0x5050f9[_0x4f98('0x3a')][_0x4f98('0x46')]){_0xa0e075[_0x4f98('0x44')]=_[_0x4f98('0x47')](_0xa0e075[_0x4f98('0x44')],{'$or':_[_0x4f98('0x33')](_0x56905b,function(_0xe9ce52){if(_0xe9ce52['type']!==_0x4f98('0x48')){var _0x398a64={};_0x398a64[_0xe9ce52['name']]={'$like':'%'+_0x5050f9['query'][_0x4f98('0x46')]+'%'};return _0x398a64;}})});}_0xa0e075=_[_0x4f98('0x47')]({},_0xa0e075,_0x5050f9[_0x4f98('0x49')]);var _0xe19c16={'where':_0xa0e075['where']};return db[_0x4f98('0x34')][_0x4f98('0x22')](_0xe19c16)['then'](function(_0x3170ba){_0x3d3c11[_0x4f98('0x22')]=_0x3170ba;if(_0x5050f9[_0x4f98('0x3a')]['includeAll']){_0xa0e075[_0x4f98('0x4a')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0xa0e075);})[_0x4f98('0x2a')](function(_0x3f0337){_0x3d3c11[_0x4f98('0x4b')]=_0x3f0337;return _0x3d3c11;})[_0x4f98('0x2a')](respondWithFilteredResult(_0x97ff62,_0xa0e075))['catch'](handleError(_0x97ff62,null));};exports[_0x4f98('0x4c')]=function(_0x17b36e,_0x252754){var _0x133043={'raw':!![],'where':{'id':_0x17b36e['params']['id']}},_0x535079={};_0x535079[_0x4f98('0x39')]=_[_0x4f98('0x3b')](db[_0x4f98('0x34')][_0x4f98('0x35')]);_0x535079[_0x4f98('0x3a')]=_[_0x4f98('0x3b')](_0x17b36e[_0x4f98('0x3a')]);_0x535079[_0x4f98('0x3c')]=_[_0x4f98('0x3d')](_0x535079['model'],_0x535079['query']);_0x133043['attributes']=_[_0x4f98('0x3d')](_0x535079['model'],qs[_0x4f98('0x3f')](_0x17b36e[_0x4f98('0x3a')][_0x4f98('0x3f')]));_0x133043[_0x4f98('0x3e')]=_0x133043[_0x4f98('0x3e')][_0x4f98('0x40')]?_0x133043[_0x4f98('0x3e')]:_0x535079[_0x4f98('0x39')];if(_0x17b36e[_0x4f98('0x3a')]['includeAll']){_0x133043['include']=[{'all':!![]}];}_0x133043=_[_0x4f98('0x47')]({},_0x133043,_0x17b36e['options']);return db['Plugin'][_0x4f98('0x4d')](_0x133043)[_0x4f98('0x2a')](handleEntityNotFound(_0x252754,null))['then'](respondWithResult(_0x252754,null))[_0x4f98('0x4e')](handleError(_0x252754,null));};exports[_0x4f98('0x4f')]=function(_0x578925,_0x38411f,_0x196fa2){return db[_0x4f98('0x34')][_0x4f98('0x4d')]({'where':{'id':_0x578925[_0x4f98('0x50')]['id']},'attributes':[_0x4f98('0x30'),_0x4f98('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x38411f,null))['then'](function(_0x40e46e){if(_0x40e46e){var _0x4859d7=path[_0x4f98('0x51')](config['root'],'server/files/plugins',util[_0x4f98('0x52')](_0x4f98('0x53'),path['basename'](_0x40e46e[_0x4f98('0x7')])));var _0x60449d=fs[_0x4f98('0x54')](_0x4859d7);var _0x5464a3=archiver('zip',{'zlib':{'level':0x9}});_0x5464a3['on'](_0x4f98('0x55'),function(_0x58bc0d){if(_0x58bc0d[_0x4f98('0x56')]===_0x4f98('0x57')){logger[_0x4f98('0x2e')](_0x58bc0d);}else{throw new db[(_0x4f98('0x58'))][(_0x4f98('0x59'))](_0x4f98('0x5a'));}});_0x5464a3['on']('error',function(_0x159ed6){throw new db[(_0x4f98('0x58'))]['Error'](_0x4f98('0x5a'));});_0x5464a3[_0x4f98('0x5b')](_0x60449d);_0x5464a3['glob']('**/*',{'cwd':path[_0x4f98('0x51')](config['root'],_0x4f98('0x5c'),path[_0x4f98('0x5d')](_0x40e46e[_0x4f98('0x7')])),'ignore':[path[_0x4f98('0x51')](path[_0x4f98('0x5e')](_0x40e46e[_0x4f98('0x7')]),_0x4f98('0x5f')),path[_0x4f98('0x51')](path[_0x4f98('0x5e')](_0x40e46e[_0x4f98('0x7')]),_0x4f98('0x60'))],'nodir':!![]})[_0x4f98('0x61')]();_0x60449d['on'](_0x4f98('0x62'),function(){if(!fs['existsSync'](_0x4859d7)){throw new db[(_0x4f98('0x58'))]['Error']('Plugin\x20not\x20found');}return _0x38411f['download'](_0x4859d7,util[_0x4f98('0x52')](_0x4f98('0x53'),path['basename'](_0x40e46e['path'])),function(_0xbf3673){if(_0xbf3673){throw new db[(_0x4f98('0x58'))]['Error'](_0x4f98('0x63'));}fs[_0x4f98('0x64')](_0x4859d7);logger[_0x4f98('0x65')](_0x4f98('0x66'));logger[_0x4f98('0x65')]('Temporary\x20file\x20removed');});});}return null;})[_0x4f98('0x4e')](handleError(_0x38411f,null));};exports[_0x4f98('0x67')]=function(_0x1973d9,_0x37d8c9,_0x19b611){var _0x367400=path[_0x4f98('0x5e')](_0x1973d9[_0x4f98('0x68')][_0x4f98('0x69')],path[_0x4f98('0x6a')](_0x1973d9[_0x4f98('0x68')]['filename']));var _0x226b6c=path[_0x4f98('0x51')](config[_0x4f98('0x6b')],'server/files/plugins',_0x1973d9[_0x4f98('0x68')]['filename']);var _0x96a37d=path['join'](config[_0x4f98('0x6b')],_0x4f98('0x5c'),_0x367400);logger[_0x4f98('0x65')](_0x4f98('0x6c'),_0x226b6c);logger[_0x4f98('0x65')](_0x4f98('0x6d'),_0x96a37d);try{fs['chmodSync'](_0x226b6c,parseInt(_0x4f98('0x6e'),0x8));extract(_0x226b6c,{'dir':_0x96a37d},function(_0x67a8a1){if(_0x67a8a1){logger['error'](_0x67a8a1);handleError(_0x67a8a1,!![]);};var _0x6fd5f1=fs[_0x4f98('0x6f')](_0x96a37d);if(_0x6fd5f1[_0x4f98('0x40')]>0x1){removeReferences(_0x226b6c,_0x96a37d);logger[_0x4f98('0x2e')](_0x4f98('0x70'));return _0x19b611(new Error(_0x4f98('0x70')));}var _0x43bfcb=fs[_0x4f98('0x71')](path[_0x4f98('0x51')](_0x96a37d,_0x6fd5f1[0x0]));if(_0x43bfcb['isFile']()){removeReferences(_0x226b6c,_0x96a37d);logger['error'](_0x4f98('0x70'));return _0x19b611(new Error(_0x4f98('0x70')));}if(_0x43bfcb['isDirectory']()){var _0x48c085=fs[_0x4f98('0x6f')](path[_0x4f98('0x51')](_0x96a37d,_0x6fd5f1[0x0]));if(_0x48c085[_0x4f98('0x40')]===0x0){removeReferences(_0x226b6c,_0x96a37d);logger[_0x4f98('0x2e')](_0x4f98('0x70'));return _0x19b611(new Error(_0x4f98('0x70')));}var _0x3ae95d=_0x48c085[_0x4f98('0x72')](function(_0x416e1d){return _0x416e1d===_0x4f98('0x73');});if(!_0x3ae95d){return _0x19b611(new Error(_0x4f98('0x74')));}var _0x3d0b53=fs[_0x4f98('0x75')](path[_0x4f98('0x51')](_0x96a37d,_0x6fd5f1[0x0],_0x4f98('0x73')));var _0x5cccca=JSON['parse'](_0x3d0b53);if(_0x4f98('0x21')==typeof _0x5cccca['name']){return _0x19b611(new Error(_0x4f98('0x76')));}if(_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x37')]){return _0x19b611(new Error(_0x4f98('0x77')));}if(_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x78')]){return _0x19b611(new Error(_0x4f98('0x79')));}if(_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x7a')]){return _0x19b611(new Error(_0x4f98('0x7b')));}if(_0x5cccca[_0x4f98('0x37')]===_0x4f98('0x7c')){if(_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')]){return _0x19b611(new Error(_0x4f98('0x7e')));}if(_0x4f98('0x21')==typeof _0x5cccca['parameters'][_0x4f98('0x7d')][_0x4f98('0x7f')]&&_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')][_0x4f98('0x80')]){return _0x19b611(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5cccca[_0x4f98('0x37')]===_0x4f98('0x81')){if('undefined'==typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x82')]){return _0x19b611(new Error(_0x4f98('0x83')));}if('undefined'==typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x84')]){return _0x19b611(new Error(_0x4f98('0x85')));}}else{return _0x19b611(new Error(_0x4f98('0x86')));}var _0x24bd81=_0x5cccca['name'];var _0x1ec12f=_0x5cccca['description'];var _0xbe7330=_0x5cccca[_0x4f98('0x37')];var _0x1f55cd=_0x5cccca['sidebar']?_0x5cccca[_0x4f98('0x87')]:_0x4f98('0x88');var _0x3d96e1=_0x5cccca[_0x4f98('0x89')]?_0x5cccca[_0x4f98('0x89')]:_0x4f98('0x8a');var _0x42b5c8='';var _0x20eab2='';var _0x47649b='';var _0x305eed='';var _0x2bdd4b=_0x5cccca['version'];if(_0xbe7330===_0x4f98('0x7c')){if('undefined'!=typeof _0x5cccca['parameters']['views'][_0x4f98('0x7f')]){var _0x33cca4=_0x5cccca['parameters']['views'][_0x4f98('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x4f98('0x8b')](_0x33cca4)){_0x42b5c8=path[_0x4f98('0x51')]('plugins',_0x367400,_0x6fd5f1[0x0],_0x33cca4);}else{_0x42b5c8=_0x33cca4;}}else{logger[_0x4f98('0x65')](_0x4f98('0x8c'));}if('undefined'!=typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')]['agent']){var _0x12a8d9=_0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')][_0x4f98('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x4f98('0x8b')](_0x12a8d9)){_0x20eab2=path[_0x4f98('0x51')](_0x4f98('0x8d'),_0x367400,_0x6fd5f1[0x0],_0x12a8d9);}else{_0x20eab2=_0x12a8d9;}}else{logger[_0x4f98('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0xbe7330===_0x4f98('0x81')){_0x47649b=_0x5cccca[_0x4f98('0x7a')][_0x4f98('0x82')];_0x305eed=_0x5cccca['parameters']['scriptPath'];if(_0x4f98('0x21')!=typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')]){if('undefined'!=typeof _0x5cccca[_0x4f98('0x7a')]['views'][_0x4f98('0x7f')]){var _0x33cca4=_0x5cccca[_0x4f98('0x7a')]['views'][_0x4f98('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x33cca4)){_0x42b5c8=path[_0x4f98('0x51')](_0x4f98('0x8d'),_0x367400,_0x6fd5f1[0x0],_0x33cca4);}else{_0x42b5c8=_0x33cca4;}}if(_0x4f98('0x21')!=typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')][_0x4f98('0x80')]){var _0x12a8d9=_0x5cccca['parameters'][_0x4f98('0x7d')][_0x4f98('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x4f98('0x8b')](_0x12a8d9)){_0x20eab2=path[_0x4f98('0x51')](_0x4f98('0x8d'),_0x367400,_0x6fd5f1[0x0],_0x12a8d9);}else{_0x20eab2=_0x12a8d9;}}}}var _0x14d3e3={'name':_0x24bd81,'description':_0x1ec12f,'path':path[_0x4f98('0x51')](_0x367400,_0x6fd5f1[0x0]),'type':_0xbe7330,'sidebar':_0x1f55cd,'icon':_0x3d96e1,'adminUrl':_0x42b5c8,'agentUrl':_0x20eab2,'scriptName':_0x47649b,'scriptPath':_0x305eed,'version':_0x2bdd4b};removeReferences(_0x226b6c,null);return db[_0x4f98('0x34')][_0x4f98('0x8e')](_0x14d3e3)[_0x4f98('0x2a')](function(_0x24be47){var _0x51984c={'role':_0x1973d9['body'][_0x4f98('0x8f')],'userProfileId':_0x1973d9[_0x4f98('0x90')][_0x4f98('0x91')]};if(!_0x51984c)throw new Error(_0x4f98('0x92'));if(_0x51984c[_0x4f98('0x8f')]===_0x4f98('0x93')){var _0x32c13f=_0x24be47[_0x4f98('0x2b')]({'plain':!![]});return db[_0x4f98('0x94')]['find']({'where':{'name':_0x4f98('0x2c'),'userProfileId':_0x51984c[_0x4f98('0x91')]},'raw':!![]})[_0x4f98('0x2a')](function(_0x21a54a){if(_0x21a54a&&_0x21a54a[_0x4f98('0x95')]===0x0){return db[_0x4f98('0x2d')]['create']({'name':_0x32c13f[_0x4f98('0x30')],'resourceId':_0x32c13f['id'],'type':_0x21a54a[_0x4f98('0x30')],'sectionId':_0x21a54a['id']},{})[_0x4f98('0x2a')](function(){return _0x24be47;});}else{return _0x24be47;}})['catch'](function(_0x37abfd){logger[_0x4f98('0x2e')](_0x4f98('0x96'),_0x37abfd);throw _0x37abfd;});}return _0x24be47;})[_0x4f98('0x2a')](respondWithResult(_0x37d8c9,null))[_0x4f98('0x4e')](handleError(_0x37d8c9,null));}});}catch(_0x2e3a6b){_0x37d8c9[_0x4f98('0x1e')](0x1f4)['send'](_0x2e3a6b);}};function removeReferences(_0x15d6b9,_0x1b6047){try{if(_0x15d6b9){fs[_0x4f98('0x64')](_0x15d6b9);logger[_0x4f98('0x65')](_0x4f98('0x97'));}if(_0x1b6047){rimraf(_0x1b6047,function(){});logger[_0x4f98('0x65')](_0x4f98('0x98'));}}catch(_0xd9e341){logger[_0x4f98('0x2e')](_0xd9e341);}}exports['update']=function(_0x527b32,_0x458ef2,_0x52bb45){return db[_0x4f98('0x34')][_0x4f98('0x4d')]({'where':{'id':_0x527b32['params']['id']}})['then'](handleEntityNotFound(_0x458ef2,null))[_0x4f98('0x2a')](saveUpdates(_0x527b32[_0x4f98('0x90')],null))[_0x4f98('0x2a')](respondWithResult(_0x458ef2,null))[_0x4f98('0x4e')](handleError(_0x458ef2,null));};exports[_0x4f98('0x99')]=function(_0x4912fa,_0x11062f,_0x4d9f06){return db[_0x4f98('0x34')]['find']({'where':{'id':_0x4912fa[_0x4f98('0x50')]['id']}})[_0x4f98('0x2a')](function(_0x501012){if(_0x501012){return _0x501012[_0x4f98('0x29')]();}})['then'](function(_0x5bea2f){rimraf(path['join'](config[_0x4f98('0x6b')],'server/files/plugins',path[_0x4f98('0x5d')](_0x5bea2f[_0x4f98('0x7')])),function(){});return _0x5bea2f;})[_0x4f98('0x2a')](handleEntityNotFound(_0x11062f,null))[_0x4f98('0x2a')](respondWithStatusCode(_0x11062f,null))[_0x4f98('0x4e')](handleError(_0x11062f,null));};exports[_0x4f98('0x9a')]=function(_0x1b8e31,_0x245838,_0xbca0a1){return BPromise[_0x4f98('0x9b')]()['then'](function(){if(!_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x7')]){throw new Error(_0x4f98('0x9c'));}if(!_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x53ba1c=_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9e')]?_0x1b8e31[_0x4f98('0x3a')]['hostname']+':'+_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9d')]:'http://localhost:'+_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9d')];var _0x5032fd=_0x1b8e31[_0x4f98('0x3a')]['json']?_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x1f')]:!![];var _0x58d773=_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9f')]?_0x1b8e31[_0x4f98('0x3a')]['encoding']:null;var _0x32b399={'method':_0x1b8e31[_0x4f98('0xa0')],'uri':util['format'](_0x4f98('0xa1'),_0x53ba1c,_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x7')]),'json':_0x5032fd,'resolveWithFullResponse':!![],'encoding':_0x58d773,'qs':_0x1b8e31[_0x4f98('0x3a')]};if(_0x1b8e31['headers']){_0x32b399[_0x4f98('0xa2')]=_0x1b8e31[_0x4f98('0xa2')];if(_0x32b399[_0x4f98('0xa2')][_0x4f98('0xa3')]){delete _0x32b399[_0x4f98('0xa2')][_0x4f98('0xa3')];}}if(_0x32b399[_0x4f98('0xa2')]['content-type']){delete _0x32b399[_0x4f98('0xa2')][_0x4f98('0xa4')];}return rp(_0x32b399);})['then'](function(_0x24dcd9){if(_0x24dcd9){_0x245838['set'](_0x24dcd9[_0x4f98('0xa2')]);logger[_0x4f98('0x65')](_0x24dcd9[_0x4f98('0x90')]);if(_[_0x4f98('0xa5')](_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x7')],_0x4f98('0x4f'))&&_0x24dcd9[_0x4f98('0xa6')]==0x1f4){return _0x245838[_0x4f98('0x1d')](_0x24dcd9[_0x4f98('0xa6')]);}else{return _0x245838[_0x4f98('0x1e')](_0x24dcd9[_0x4f98('0xa6')])['send'](_0x24dcd9[_0x4f98('0x90')]);}}else{return _0x245838[_0x4f98('0x1d')](0xc8);}})[_0x4f98('0x4e')](handleError(_0x245838,null));};exports[_0x4f98('0xa7')]=function(_0x525548,_0x173b2b,_0x166b93){return BPromise[_0x4f98('0x9b')]()['then'](function(){if(!_0x525548['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x525548[_0x4f98('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x54da9c=_0x525548[_0x4f98('0x3a')][_0x4f98('0x9e')]?_0x525548[_0x4f98('0x3a')][_0x4f98('0x9e')]+':'+_0x525548['query'][_0x4f98('0x9d')]:'http://localhost:'+_0x525548[_0x4f98('0x3a')][_0x4f98('0x9d')];var _0x3b3bd7=_0x525548[_0x4f98('0x3a')][_0x4f98('0x1f')]?_0x525548['query']['json']:!![];var _0x1d427d=_0x525548[_0x4f98('0x3a')][_0x4f98('0x9f')]?_0x525548[_0x4f98('0x3a')][_0x4f98('0x9f')]:null;var _0x56400f={'method':_0x525548[_0x4f98('0xa0')],'uri':util[_0x4f98('0x52')](_0x4f98('0xa1'),_0x54da9c,_0x525548['query'][_0x4f98('0x7')]),'json':_0x3b3bd7,'resolveWithFullResponse':!![],'encoding':_0x1d427d,'body':_0x525548[_0x4f98('0x90')]};if(_0x525548[_0x4f98('0xa2')]){_0x56400f[_0x4f98('0xa2')]=_0x525548[_0x4f98('0xa2')];if(_0x56400f[_0x4f98('0xa2')][_0x4f98('0xa3')]){delete _0x56400f['headers'][_0x4f98('0xa3')];}}if(_0x56400f[_0x4f98('0xa2')]['content-type']){delete _0x56400f[_0x4f98('0xa2')][_0x4f98('0xa4')];}return rp(_0x56400f);})['then'](function(_0x210f47){if(_0x210f47){_0x173b2b[_0x4f98('0x24')](_0x210f47['headers']);logger[_0x4f98('0x65')](_0x210f47[_0x4f98('0x90')]);return _0x173b2b['status'](_0x210f47['statusCode'])[_0x4f98('0x31')](_0x210f47[_0x4f98('0x90')]);}else{return _0x173b2b[_0x4f98('0x1d')](0xc8);}})[_0x4f98('0x4e')](handleError(_0x173b2b,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 90e7b37..108d588 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 _0x27a8=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','Plugin'];(function(_0x2e57b0,_0x424049){var _0x34ed3a=function(_0x41824c){while(--_0x41824c){_0x2e57b0['push'](_0x2e57b0['shift']());}};_0x34ed3a(++_0x424049);}(_0x27a8,0x170));var _0x827a=function(_0x50926d,_0x2c6072){_0x50926d=_0x50926d-0x0;var _0x434351=_0x27a8[_0x50926d];return _0x434351;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0x827a('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0x827a('0x1')](0x0);var events={'afterCreate':_0x827a('0x2'),'afterUpdate':_0x827a('0x3'),'afterDestroy':_0x827a('0x4')};function emitEvent(_0x300907){return function(_0x18cf5e,_0x215b35,_0x2b3486){PluginEvents[_0x827a('0x5')](_0x300907+':'+_0x18cf5e['id'],_0x18cf5e);PluginEvents[_0x827a('0x5')](_0x300907,_0x18cf5e);_0x2b3486(null);};}for(var e in events){if(events[_0x827a('0x6')](e)){var event=events[e];Plugin[_0x827a('0x7')](e,emitEvent(event));}}module[_0x827a('0x8')]=PluginEvents; \ No newline at end of file +var _0xbe2c=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x537d1c,_0x4b02e6){var _0x3397cc=function(_0xc32396){while(--_0xc32396){_0x537d1c['push'](_0x537d1c['shift']());}};_0x3397cc(++_0x4b02e6);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x2b2cfc,_0x45a09b){_0x2b2cfc=_0x2b2cfc-0x0;var _0x1a9dba=_0xbe2c[_0x2b2cfc];return _0x1a9dba;};'use strict';var EventEmitter=require(_0xcbe2('0x0'));var Plugin=require(_0xcbe2('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xcbe2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcbe2('0x3'),'afterDestroy':_0xcbe2('0x4')};function emitEvent(_0x107914){return function(_0x42c28d,_0x3f9f67,_0x59afb2){PluginEvents[_0xcbe2('0x5')](_0x107914+':'+_0x42c28d['id'],_0x42c28d);PluginEvents[_0xcbe2('0x5')](_0x107914,_0x42c28d);_0x59afb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xcbe2('0x6')](e,emitEvent(event));}}module[_0xcbe2('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 aba179a..3505d89 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 _0xed2c=['define','Plugin','plugins','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x59d4e,_0x51402e){var _0x371f3a=function(_0x1f1352){while(--_0x1f1352){_0x59d4e['push'](_0x59d4e['shift']());}};_0x371f3a(++_0x51402e);}(_0xed2c,0x19b));var _0xced2=function(_0xc5bb7f,_0x336c16){_0xc5bb7f=_0xc5bb7f-0x0;var _0x5ed8f7=_0xed2c[_0xc5bb7f];return _0x5ed8f7;};'use strict';var _=require(_0xced2('0x0'));var util=require(_0xced2('0x1'));var logger=require(_0xced2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xced2('0x3'));var rp=require(_0xced2('0x4'));var fs=require('fs');var path=require(_0xced2('0x5'));var rimraf=require(_0xced2('0x6'));var config=require(_0xced2('0x7'));var attributes=require(_0xced2('0x8'));module['exports']=function(_0x2137cb,_0x241bc0){return _0x2137cb[_0xced2('0x9')](_0xced2('0xa'),attributes,{'tableName':_0xced2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5719=['exports','define','Plugin','plugins','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x39afca,_0x147c8f){var _0x3febbf=function(_0x2439a2){while(--_0x2439a2){_0x39afca['push'](_0x39afca['shift']());}};_0x3febbf(++_0x147c8f);}(_0x5719,0x101));var _0x9571=function(_0x179634,_0x35406f){_0x179634=_0x179634-0x0;var _0x57245c=_0x5719[_0x179634];return _0x57245c;};'use strict';var _=require('lodash');var util=require(_0x9571('0x0'));var logger=require(_0x9571('0x1'))(_0x9571('0x2'));var moment=require(_0x9571('0x3'));var BPromise=require('bluebird');var rp=require(_0x9571('0x4'));var fs=require('fs');var path=require(_0x9571('0x5'));var rimraf=require('rimraf');var config=require(_0x9571('0x6'));var attributes=require('./plugin.attributes');module[_0x9571('0x7')]=function(_0x20dece,_0x26d9f9){return _0x20dece[_0x9571('0x8')](_0x9571('0x9'),attributes,{'tableName':_0x9571('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 817ea34..4136606 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 _0x61d7=['debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw'];(function(_0x387ea3,_0x21fd7e){var _0x5aa402=function(_0x574cf7){while(--_0x574cf7){_0x387ea3['push'](_0x387ea3['shift']());}};_0x5aa402(++_0x21fd7e);}(_0x61d7,0x119));var _0x761d=function(_0x19bd2e,_0x17f0d9){_0x19bd2e=_0x19bd2e-0x0;var _0x803c05=_0x61d7[_0x19bd2e];return _0x803c05;};'use strict';var _=require(_0x761d('0x0'));var util=require(_0x761d('0x1'));var moment=require(_0x761d('0x2'));var BPromise=require(_0x761d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x761d('0x4'));var db=require(_0x761d('0x5'))['db'];var utils=require(_0x761d('0x6'));var logger=require(_0x761d('0x7'))(_0x761d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x761d('0x9')][_0x761d('0xa')]({'port':0x232a});config[_0x761d('0xb')]=_[_0x761d('0xc')](config[_0x761d('0xb')],{'host':_0x761d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x761d('0xb')]));require(_0x761d('0xe'))[_0x761d('0xf')](socket);function respondWithRpcPromise(_0x3a054b,_0x5d6d83,_0x51bdf0){return new BPromise(function(_0x46a2a2,_0xdece69){return client[_0x761d('0x10')](_0x3a054b,_0x51bdf0)[_0x761d('0x11')](function(_0x4ec2e9){logger[_0x761d('0x12')](_0x761d('0x13'),_0x5d6d83,_0x761d('0x14'));logger['debug'](_0x761d('0x15'),_0x5d6d83,'request\x20sent',JSON[_0x761d('0x16')](_0x4ec2e9));if(_0x4ec2e9[_0x761d('0x17')]){if(_0x4ec2e9[_0x761d('0x17')][_0x761d('0x18')]===0x1f4){logger[_0x761d('0x17')](_0x761d('0x13'),_0x5d6d83,_0x4ec2e9[_0x761d('0x17')]['message']);return _0xdece69(_0x4ec2e9[_0x761d('0x17')][_0x761d('0x19')]);}logger[_0x761d('0x17')](_0x761d('0x13'),_0x5d6d83,_0x4ec2e9['error'][_0x761d('0x19')]);return _0x46a2a2(_0x4ec2e9['error'][_0x761d('0x19')]);}else{logger[_0x761d('0x12')](_0x761d('0x13'),_0x5d6d83,_0x761d('0x14'));_0x46a2a2(_0x4ec2e9[_0x761d('0x1a')][_0x761d('0x19')]);}})[_0x761d('0x1b')](function(_0x5d6abf){logger['error'](_0x761d('0x13'),_0x5d6d83,_0x5d6abf);_0xdece69(_0x5d6abf);});});}exports[_0x761d('0x1c')]=function(_0x8546d1){var _0x52cb1c=this;return new Promise(function(_0x57ca5d,_0x1ba3e8){return db[_0x761d('0x1d')][_0x761d('0x1e')](_0x8546d1[_0x761d('0x1f')],{'raw':_0x8546d1[_0x761d('0x20')]?_0x8546d1['options'][_0x761d('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x4f0c8c){logger[_0x761d('0x12')](_0x761d('0x1c'),_0x8546d1);logger[_0x761d('0x22')](_0x761d('0x1c'),_0x8546d1,JSON[_0x761d('0x16')](_0x4f0c8c));_0x57ca5d(_0x4f0c8c);})[_0x761d('0x1b')](function(_0x1214d7){logger[_0x761d('0x17')](_0x761d('0x1c'),_0x1214d7[_0x761d('0x19')],_0x8546d1);_0x1ba3e8(_0x52cb1c[_0x761d('0x17')](0x1f4,_0x1214d7[_0x761d('0x19')]));});});}; \ No newline at end of file +var _0x4c29=['message','result','catch','CreatePlugin','body','options','util','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x141fe3,_0x1bad00){var _0x25aa10=function(_0x4d2082){while(--_0x4d2082){_0x141fe3['push'](_0x141fe3['shift']());}};_0x25aa10(++_0x1bad00);}(_0x4c29,0x9c));var _0x94c2=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x4c29[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require(_0x94c2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x94c2('0x1'));var logger=require(_0x94c2('0x2'))(_0x94c2('0x3'));var config=require(_0x94c2('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x94c2('0x5')]['http']({'port':0x232a});config[_0x94c2('0x6')]=_[_0x94c2('0x7')](config[_0x94c2('0x6')],{'host':_0x94c2('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94c2('0x6')]));require('./plugin.socket')[_0x94c2('0x9')](socket);function respondWithRpcPromise(_0x47d5a9,_0x10c49e,_0xbcd3fb){return new BPromise(function(_0x44e52d,_0x5574ca){return client[_0x94c2('0xa')](_0x47d5a9,_0xbcd3fb)[_0x94c2('0xb')](function(_0x2545b7){logger[_0x94c2('0xc')](_0x94c2('0xd'),_0x10c49e,_0x94c2('0xe'));logger[_0x94c2('0xf')](_0x94c2('0x10'),_0x10c49e,_0x94c2('0xe'),JSON[_0x94c2('0x11')](_0x2545b7));if(_0x2545b7[_0x94c2('0x12')]){if(_0x2545b7[_0x94c2('0x12')]['code']===0x1f4){logger[_0x94c2('0x12')](_0x94c2('0xd'),_0x10c49e,_0x2545b7[_0x94c2('0x12')][_0x94c2('0x13')]);return _0x5574ca(_0x2545b7[_0x94c2('0x12')][_0x94c2('0x13')]);}logger[_0x94c2('0x12')](_0x94c2('0xd'),_0x10c49e,_0x2545b7[_0x94c2('0x12')][_0x94c2('0x13')]);return _0x44e52d(_0x2545b7['error'][_0x94c2('0x13')]);}else{logger[_0x94c2('0xc')](_0x94c2('0xd'),_0x10c49e,_0x94c2('0xe'));_0x44e52d(_0x2545b7[_0x94c2('0x14')][_0x94c2('0x13')]);}})[_0x94c2('0x15')](function(_0x55bc2d){logger[_0x94c2('0x12')](_0x94c2('0xd'),_0x10c49e,_0x55bc2d);_0x5574ca(_0x55bc2d);});});}exports[_0x94c2('0x16')]=function(_0x4ed30b){var _0x3c1df5=this;return new Promise(function(_0x5793e3,_0x18e8f0){return db['Plugin']['create'](_0x4ed30b[_0x94c2('0x17')],{'raw':_0x4ed30b[_0x94c2('0x18')]?_0x4ed30b['options']['raw']===undefined?!![]:![]:!![]})[_0x94c2('0xb')](function(_0x5124fe){logger[_0x94c2('0xc')](_0x94c2('0x16'),_0x4ed30b);logger[_0x94c2('0xf')]('CreatePlugin',_0x4ed30b,JSON[_0x94c2('0x11')](_0x5124fe));_0x5793e3(_0x5124fe);})[_0x94c2('0x15')](function(_0x239409){logger[_0x94c2('0x12')]('CreatePlugin',_0x239409[_0x94c2('0x13')],_0x4ed30b);_0x18e8f0(_0x3c1df5[_0x94c2('0x12')](0x1f4,_0x239409[_0x94c2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 077bfe1..31c6bfa 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 _0xf3be=['register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x204c0a,_0x3daf68){var _0x5f7498=function(_0x5f2fbc){while(--_0x5f2fbc){_0x204c0a['push'](_0x204c0a['shift']());}};_0x5f7498(++_0x3daf68);}(_0xf3be,0x1ed));var _0xef3b=function(_0xac2026,_0x6428e0){_0xac2026=_0xac2026-0x0;var _0x15e1d2=_0xf3be[_0xac2026];return _0x15e1d2;};'use strict';var PluginEvents=require(_0xef3b('0x0'));var events=[_0xef3b('0x1'),_0xef3b('0x2'),_0xef3b('0x3')];function createListener(_0x2aaab0,_0x5f4f78){return function(_0x4a23a3){_0x5f4f78['emit'](_0x2aaab0,_0x4a23a3);};}function removeListener(_0x5494b5,_0x30adb2){return function(){PluginEvents['removeListener'](_0x5494b5,_0x30adb2);};}exports[_0xef3b('0x4')]=function(_0x5dedb8){for(var _0x53d9cd=0x0,_0x43f06d=events[_0xef3b('0x5')];_0x53d9cd<_0x43f06d;_0x53d9cd++){var _0x1b3abe=events[_0x53d9cd];var _0x382f00=createListener(_0xef3b('0x6')+_0x1b3abe,_0x5dedb8);PluginEvents['on'](_0x1b3abe,_0x382f00);}}; \ No newline at end of file +var _0x656a=['./plugin.events','save','update','emit','removeListener','register','length','plugin:'];(function(_0x289d4f,_0x2ef8f6){var _0x725a3e=function(_0x17fcac){while(--_0x17fcac){_0x289d4f['push'](_0x289d4f['shift']());}};_0x725a3e(++_0x2ef8f6);}(_0x656a,0x128));var _0xa656=function(_0x13ef4f,_0x268dae){_0x13ef4f=_0x13ef4f-0x0;var _0x568fa4=_0x656a[_0x13ef4f];return _0x568fa4;};'use strict';var PluginEvents=require(_0xa656('0x0'));var events=[_0xa656('0x1'),'remove',_0xa656('0x2')];function createListener(_0x1d0ad8,_0x716464){return function(_0x373911){_0x716464[_0xa656('0x3')](_0x1d0ad8,_0x373911);};}function removeListener(_0x13b9b4,_0x2f8a27){return function(){PluginEvents[_0xa656('0x4')](_0x13b9b4,_0x2f8a27);};}exports[_0xa656('0x5')]=function(_0x40db5d){for(var _0xa1da0b=0x0,_0x2f3df2=events[_0xa656('0x6')];_0xa1da0b<_0x2f3df2;_0xa1da0b++){var _0x3193f0=events[_0xa1da0b];var _0x2b2b7d=createListener(_0xa656('0x7')+_0x3193f0,_0x40db5d);PluginEvents['on'](_0x3193f0,_0x2b2b7d);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 0cc87d0..4a8decb 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(_0x4a29f1,_0x23e312){var _0xe71461=function(_0x552bff){while(--_0x552bff){_0x4a29f1['push'](_0x4a29f1['shift']());}};_0xe71461(++_0x23e312);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x52f82e,_0x34509b){var _0x17818c=function(_0x4d94dc){while(--_0x4d94dc){_0x52f82e['push'](_0x52f82e['shift']());}};_0x17818c(++_0x34509b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 57f0802..2f13c31 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 _0xb58b=['Unknown\x20status','destroy','params','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','child_process','exec','sendStatus','status','json','error','stack','name','npm\x20install','info','list','then','reject','motion2','length','describe','catch','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x536691,_0x511fb3){var _0xd37702=function(_0x6ae782){while(--_0x6ae782){_0x536691['push'](_0x536691['shift']());}};_0xd37702(++_0x511fb3);}(_0xb58b,0x1f1));var _0xbb58=function(_0x59124a,_0x9c3ec6){_0x59124a=_0x59124a-0x0;var _0xe72d8c=_0xb58b[_0x59124a];return _0xe72d8c;};'use strict';var _=require('lodash');var pm2=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var path=require('path');var exec=require(_0xbb58('0x3'))[_0xbb58('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x226363,_0x546510){return function(_0x2edb10){if(!_0x2edb10){_0x226363[_0xbb58('0x5')](0x194);;}return _0x2edb10;};}function respondWithResult(_0x33fe85,_0x5cf8b1){_0x5cf8b1=_0x5cf8b1||0xc8;return function(_0x27cbda){if(_0x27cbda){return _0x33fe85[_0xbb58('0x6')](_0x5cf8b1)[_0xbb58('0x7')](_0x27cbda);}return null;};}function handleError(_0x5d7fe8,_0xd94f1){_0xd94f1=_0xd94f1||0x1f4;return function(_0x3e3144){logger[_0xbb58('0x8')](_0x3e3144[_0xbb58('0x9')]);if(_0x3e3144[_0xbb58('0xa')]){delete _0x3e3144[_0xbb58('0xa')];}_0x5d7fe8[_0xbb58('0x6')](_0xd94f1)['send'](_0x3e3144);};}function execChildProcess(){return new BPromise(function(_0x80ab3a,_0x5c3bf7){exec(_0xbb58('0xb'),function(_0x440392,_0x26d8e6,_0x19d185){logger['info'](_0x26d8e6);logger[_0xbb58('0xc')](_0x19d185);if(_0x440392){logger[_0xbb58('0x8')](_0x440392);return _0x5c3bf7(_0x440392);}return _0x80ab3a(_0x26d8e6);});});}exports['index']=function(_0x132511,_0xdc68b9){return pm2[_0xbb58('0xd')]()[_0xbb58('0xe')](function(_0x19ceda){if(_0x19ceda){var _0x58245f=_[_0xbb58('0xf')](_0x19ceda,function(_0x23fd15){return _0x23fd15['name']==='express'||_0x23fd15[_0xbb58('0xa')]===_0xbb58('0x10');});return{'rows':_0x58245f,'count':_0x58245f[_0xbb58('0x11')]};}return null;})['then'](respondWithResult(_0xdc68b9,null))['catch'](handleError(_0xdc68b9,null));};exports['show']=function(_0x55156e,_0x28637b){return pm2[_0xbb58('0x12')](_0x55156e['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x28637b,null))['then'](handleEntityNotFound(_0x28637b,null))[_0xbb58('0x13')](handleError(_0x28637b,null));};exports[_0xbb58('0x14')]=function(_0x3c33d9,_0xb8f982){if(_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')]&&_0x3c33d9[_0xbb58('0x15')]['script']){var _0x84f34=path[_0xbb58('0x16')](__dirname,_0xbb58('0x17'),_0x3c33d9[_0xbb58('0x15')][_0xbb58('0x18')]);var _0x5d4a91=process[_0xbb58('0x19')]();process[_0xbb58('0x1a')](path[_0xbb58('0x1b')](_0x84f34));return execChildProcess()['then'](function(_0x27806d){process['chdir'](_0x5d4a91);return pm2[_0xbb58('0x1c')]({'name':_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')],'script':_0x84f34});})[_0xbb58('0xe')](function(_0x2d111c){pm2[_0xbb58('0x1d')]();return _0x2d111c[0x0];})[_0xbb58('0xe')](respondWithResult(_0xb8f982,0xc9))[_0xbb58('0x13')](handleError(_0xb8f982,null));}else{return _0xb8f982['status'](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x1f')});}};exports[_0xbb58('0x20')]=function(_0x129094,_0x8e9ed9){if(_0x129094[_0xbb58('0x15')]['id']){delete _0x129094[_0xbb58('0x15')]['id'];}var _0x2ce7c3={'online':_0xbb58('0x21'),'stopped':_0xbb58('0x22')};if(_0x2ce7c3[_0xbb58('0x23')](_0x129094[_0xbb58('0x15')][_0xbb58('0x6')])){return pm2[_0x2ce7c3[_0x129094[_0xbb58('0x15')][_0xbb58('0x6')]]](_0x129094['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x8e9ed9,0xc8))[_0xbb58('0x13')](handleError(_0x8e9ed9,null));}else{return _0x8e9ed9[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x24')});}};exports[_0xbb58('0x25')]=function(_0x1ba526,_0x643e0e){if(_0x1ba526[_0xbb58('0x15')]['id']){delete _0x1ba526['body']['id'];}if(_0x1ba526[_0xbb58('0x26')]['id']){return pm2[_0xbb58('0x27')](_0x1ba526[_0xbb58('0x26')]['id'])[_0xbb58('0xe')](function(_0xdbbe7b){pm2[_0xbb58('0x1d')]();return _0xdbbe7b[0x0];})[_0xbb58('0xe')](respondWithResult(_0x643e0e,null))[_0xbb58('0x13')](handleError(_0x643e0e,null));}else{return _0x643e0e[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x28')});}}; \ No newline at end of file +var _0xbec5=['Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','create','body','join','../../files/plugins','script','cwd','dirname','chdir','start','dump','restart','hasOwnProperty','params','destroy'];(function(_0x195d9e,_0x4fc668){var _0x18fde5=function(_0x51898d){while(--_0x51898d){_0x195d9e['push'](_0x195d9e['shift']());}};_0x18fde5(++_0x4fc668);}(_0xbec5,0xe5));var _0x5bec=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xbec5[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0x5bec('0x0'));var pm2=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var path=require(_0x5bec('0x3'));var exec=require(_0x5bec('0x4'))[_0x5bec('0x5')];var BPromise=require(_0x5bec('0x6'));function handleEntityNotFound(_0x4ee982,_0x1f8933){return function(_0x376cdb){if(!_0x376cdb){_0x4ee982[_0x5bec('0x7')](0x194);;}return _0x376cdb;};}function respondWithResult(_0x4aaac6,_0x3ed67a){_0x3ed67a=_0x3ed67a||0xc8;return function(_0x28a427){if(_0x28a427){return _0x4aaac6[_0x5bec('0x8')](_0x3ed67a)[_0x5bec('0x9')](_0x28a427);}return null;};}function handleError(_0x43d96e,_0x302aae){_0x302aae=_0x302aae||0x1f4;return function(_0x6406a1){logger[_0x5bec('0xa')](_0x6406a1['stack']);if(_0x6406a1[_0x5bec('0xb')]){delete _0x6406a1['name'];}_0x43d96e[_0x5bec('0x8')](_0x302aae)[_0x5bec('0xc')](_0x6406a1);};}function execChildProcess(){return new BPromise(function(_0x117162,_0x4a5482){exec(_0x5bec('0xd'),function(_0x18fa47,_0x16226b,_0x57ffc4){logger[_0x5bec('0xe')](_0x16226b);logger[_0x5bec('0xe')](_0x57ffc4);if(_0x18fa47){logger['error'](_0x18fa47);return _0x4a5482(_0x18fa47);}return _0x117162(_0x16226b);});});}exports[_0x5bec('0xf')]=function(_0xaa984d,_0x35393a){return pm2[_0x5bec('0x10')]()[_0x5bec('0x11')](function(_0xcd6d90){if(_0xcd6d90){var _0x24dcd6=_[_0x5bec('0x12')](_0xcd6d90,function(_0x259588){return _0x259588[_0x5bec('0xb')]===_0x5bec('0x13')||_0x259588[_0x5bec('0xb')]===_0x5bec('0x14');});return{'rows':_0x24dcd6,'count':_0x24dcd6['length']};}return null;})['then'](respondWithResult(_0x35393a,null))[_0x5bec('0x15')](handleError(_0x35393a,null));};exports[_0x5bec('0x16')]=function(_0x31ad9c,_0x1771e7){return pm2['describe'](_0x31ad9c['params']['id'])[_0x5bec('0x11')](respondWithResult(_0x1771e7,null))[_0x5bec('0x11')](handleEntityNotFound(_0x1771e7,null))['catch'](handleError(_0x1771e7,null));};exports[_0x5bec('0x17')]=function(_0xa7e223,_0x32a846){if(_0xa7e223[_0x5bec('0x18')]['name']&&_0xa7e223[_0x5bec('0x18')]['script']){var _0x191c0f=path[_0x5bec('0x19')](__dirname,_0x5bec('0x1a'),_0xa7e223[_0x5bec('0x18')][_0x5bec('0x1b')]);var _0x5e154e=process[_0x5bec('0x1c')]();process['chdir'](path[_0x5bec('0x1d')](_0x191c0f));return execChildProcess()[_0x5bec('0x11')](function(_0x5b2636){process[_0x5bec('0x1e')](_0x5e154e);return pm2[_0x5bec('0x1f')]({'name':_0xa7e223['body'][_0x5bec('0xb')],'script':_0x191c0f});})[_0x5bec('0x11')](function(_0x43d460){pm2[_0x5bec('0x20')]();return _0x43d460[0x0];})[_0x5bec('0x11')](respondWithResult(_0x32a846,0xc9))[_0x5bec('0x15')](handleError(_0x32a846,null));}else{return _0x32a846[_0x5bec('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x2961bd,_0x2cdd2f){if(_0x2961bd[_0x5bec('0x18')]['id']){delete _0x2961bd['body']['id'];}var _0x2b3b2c={'online':_0x5bec('0x21'),'stopped':'stop'};if(_0x2b3b2c[_0x5bec('0x22')](_0x2961bd[_0x5bec('0x18')]['status'])){return pm2[_0x2b3b2c[_0x2961bd['body'][_0x5bec('0x8')]]](_0x2961bd[_0x5bec('0x23')]['id'])[_0x5bec('0x11')](respondWithResult(_0x2cdd2f,0xc8))[_0x5bec('0x15')](handleError(_0x2cdd2f,null));}else{return _0x2cdd2f[_0x5bec('0x8')](0x1f4)[_0x5bec('0xc')]({'message':'Unknown\x20status'});}};exports[_0x5bec('0x24')]=function(_0x59b5b6,_0x45863b){if(_0x59b5b6[_0x5bec('0x18')]['id']){delete _0x59b5b6[_0x5bec('0x18')]['id'];}if(_0x59b5b6[_0x5bec('0x23')]['id']){return pm2['delete'](_0x59b5b6[_0x5bec('0x23')]['id'])[_0x5bec('0x11')](function(_0xfc7d41){pm2['dump']();return _0xfc7d41[0x0];})[_0x5bec('0x11')](respondWithResult(_0x45863b,null))['catch'](handleError(_0x45863b,null));}else{return _0x45863b[_0x5bec('0x8')](0x1f4)[_0x5bec('0xc')]({'message':_0x5bec('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index cdc424a..47fe3e4 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 _0x4e35=['./realtime.controller','get','isAuthenticated','getAgents','/queues','exports','express'];(function(_0x170b20,_0x49fc52){var _0xbe0395=function(_0x410eea){while(--_0x410eea){_0x170b20['push'](_0x170b20['shift']());}};_0xbe0395(++_0x49fc52);}(_0x4e35,0xf4));var _0x54e3=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0x4e35[_0x379799];return _0x46e431;};'use strict';var express=require(_0x54e3('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x54e3('0x1'));router[_0x54e3('0x2')]('/agents',auth[_0x54e3('0x3')](),controller[_0x54e3('0x4')]);router[_0x54e3('0x2')](_0x54e3('0x5'),auth['isAuthenticated'](),controller['getQueues']);module[_0x54e3('0x6')]=router; \ No newline at end of file +var _0x8da7=['exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','/queues','getQueues'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x8da7,0xa1));var _0x78da=function(_0x29ad8e,_0x402b17){_0x29ad8e=_0x29ad8e-0x0;var _0x37e6e1=_0x8da7[_0x29ad8e];return _0x37e6e1;};'use strict';var express=require(_0x78da('0x0'));var router=express[_0x78da('0x1')]();var auth=require(_0x78da('0x2'));var controller=require(_0x78da('0x3'));router[_0x78da('0x4')](_0x78da('0x5'),auth[_0x78da('0x6')](),controller['getAgents']);router['get'](_0x78da('0x7'),auth['isAuthenticated'](),controller[_0x78da('0x8')]);module[_0x78da('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 5979414..d556a01 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 _0xafb9=['Status','getQueues','resolve','Queue','fieldName','type','QueueCampaigns','util','lodash','jayson/promise','../../components/realtime/agents','../../config/utils','../../config/logger','api','../../mysqldb','client','http','limit','offset','count','status','json','error','stack','name','send','voice','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','agents','loggedInDb','busy','find','merge','pick','queue','length','some','connectedlinenum','internal','toString','getMembers','UserId','voiceStatus','online','findAll','QueueId','getChannels','includes','toLowerCase','getAgents','globalQueueFilter','query','pauseTypeFilter','pause','*pause','channel','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','order','getRealtimeAgents','rows','map','User','rawAttributes','key','role','agent','getOptions','raw','sequelize','forEach','where','user','Agents','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','getAgentStatus','Pause'];(function(_0xa7909c,_0x99066d){var _0x34153e=function(_0x558322){while(--_0x558322){_0xa7909c['push'](_0xa7909c['shift']());}};_0x34153e(++_0x99066d);}(_0xafb9,0x7d));var _0x9afb=function(_0x2924b8,_0x228080){_0x2924b8=_0x2924b8-0x0;var _0x574eb4=_0xafb9[_0x2924b8];return _0x574eb4;};'use strict';var util=require(_0x9afb('0x0'));var _=require(_0x9afb('0x1'));var jayson=require(_0x9afb('0x2'));var rta=require(_0x9afb('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0x9afb('0x4'));var logger=require(_0x9afb('0x5'))(_0x9afb('0x6'));var db=require(_0x9afb('0x7'))['db'];var amiClient=jayson[_0x9afb('0x8')][_0x9afb('0x9')]({'port':0x232a});var routingClient=jayson[_0x9afb('0x8')][_0x9afb('0x9')]({'port':0x232c});function respondWithFilteredResult(_0x38ee83,_0x1a396e){return function(_0x153d95){if(_0x153d95){var _0x53e045=typeof _0x1a396e['offset']==='undefined'&&typeof _0x1a396e[_0x9afb('0xa')]==='undefined';var _0xfaf3a1=_0x153d95['count'];var _0x3bffd8=_0x53e045?0x0:_0x1a396e[_0x9afb('0xb')];var _0x2dc9d2=_0x53e045?_0x153d95[_0x9afb('0xc')]:_0x1a396e[_0x9afb('0xb')]+_0x1a396e['limit'];var _0x2c0aca;if(_0x2dc9d2>=_0xfaf3a1){_0x2dc9d2=_0xfaf3a1;_0x2c0aca=0xc8;}else{_0x2c0aca=0xce;}_0x38ee83[_0x9afb('0xd')](_0x2c0aca);return _0x38ee83['set']('Content-Range',_0x3bffd8+'-'+_0x2dc9d2+'/'+_0xfaf3a1)[_0x9afb('0xe')](_0x153d95);}return null;};}function handleError(_0x3463ef,_0x35f8b5){_0x35f8b5=_0x35f8b5||0x1f4;return function(_0x3c14dd){logger[_0x9afb('0xf')](_0x3c14dd[_0x9afb('0x10')]);if(_0x3c14dd[_0x9afb('0x11')]){delete _0x3c14dd[_0x9afb('0x11')];}_0x3463ef['status'](_0x35f8b5)[_0x9afb('0x12')](_0x3c14dd);};}function getRealtimeQueues(_0x4d58ac,_0x180b66){return new Promise(function(_0x30c485,_0x19f26a){var _0x1ab05d=_0x180b66===_0x9afb('0x13')?amiClient:routingClient;return _0x1ab05d[_0x9afb('0x14')](_[_0x9afb('0x15')](_0x180b66)+_0x9afb('0x16'),_0x4d58ac)[_0x9afb('0x17')](function(_0x3cb6e1){if(_0x3cb6e1[_0x9afb('0xf')])throw new Error(util[_0x9afb('0x18')](_0x9afb('0x19'),_0x180b66));return _0x30c485(_0x3cb6e1[_0x9afb('0x1a')]);})[_0x9afb('0x1b')](function(_0x14ec2a){_0x19f26a(_0x14ec2a);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x15c69a,_0x56b8e3){return amiClient[_0x9afb('0x14')](_0x9afb('0x1c'),{})['then'](function(_0x22a859){if(_0x22a859[_0x9afb('0xf')])throw new Error(_0x9afb('0x1d'));return _0x15c69a(_0x22a859[_0x9afb('0x1a')]);})[_0x9afb('0x1b')](function(_0x1ec2df){_0x56b8e3(_0x1ec2df);});});}function initializeQueues(_0x523bcb,_0x544032,_0x2f11b0,_0x21d471){var _0x3ff032=[_0x9afb('0x1e'),'available',_0x9afb('0x1f'),_0x9afb('0x20'),_0x9afb('0x21')];if(_0x2f11b0===_0x9afb('0x13')&&_0x21d471===_0x9afb('0x22')){_0x3ff032[_0x9afb('0x23')](_0x9afb('0x24'),_0x9afb('0x25'),_0x9afb('0x26'),_0x9afb('0x27'),'dialMethod',_0x9afb('0x28'),_0x9afb('0x29'),_0x9afb('0x2a'),_0x9afb('0x2b'),_0x9afb('0x2c'),_0x9afb('0x2d'),_0x9afb('0x2e'),_0x9afb('0x2f'),_0x9afb('0x30'),_0x9afb('0x31'),_0x9afb('0x32'),_0x9afb('0x33'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x9afb('0x34'),_0x9afb('0x35'),_0x9afb('0x36'));}return _0x523bcb['map'](function(_0x255a59){var _0xd73522=_0x255a59[_0x9afb('0x37')]({'plain':!![]});_0xd73522[_0x9afb('0x38')]=[];_0xd73522['paused']=0x0;_0xd73522[_0x9afb('0x39')]=0x0;_0xd73522['loggedIn']=0x0;_0xd73522['available']=0x0;_0xd73522['waiting']=0x0;if(_0x2f11b0===_0x9afb('0x13')){_0xd73522[_0x9afb('0x20')]=0x0;_0xd73522[_0x9afb('0x3a')]=0x0;if(_0x21d471===_0x9afb('0x22')){_0xd73522['pTalking']=0x0;_0xd73522['originated']=0x0;}}var _0x5e9a6f=_[_0x9afb('0x3b')](_0x544032,['id',_0xd73522['id']]);if(_0x5e9a6f)_[_0x9afb('0x3c')](_0xd73522,_[_0x9afb('0x3d')](_0x5e9a6f,_0x3ff032));return _0xd73522;});}function updateAgentVoiceStatus(_0x239821,_0x97fdca,_0x45c9bc){var _0x218f21=_['filter'](_0x45c9bc,[_0x9afb('0x3e'),_0x97fdca[_0x9afb('0x11')]]);if(_0x218f21[_0x9afb('0x3f')]===0x0)return _0x239821[_0x9afb('0x3a')]=!![];if(_[_0x9afb('0x40')](_0x218f21,[_0x9afb('0x41'),_0x239821[_0x9afb('0x42')][_0x9afb('0x43')]()]))return _0x239821[_0x9afb('0x20')]=!![];if(!_0x239821[_0x9afb('0x20')])return _0x239821[_0x9afb('0x3a')]=!![];}function getVoiceQueueAgents(_0x55ef3d,_0x53811b,_0x5bbd31,_0x345c58){var _0x336318=_[_0x9afb('0x3b')](_0x53811b,['id',_0x55ef3d['id']]);if(!_0x336318)return _0x55ef3d;return _0x336318[_0x9afb('0x44')]({'raw':!![]})['then'](function(_0x2dd8fc){for(var _0x16f9b3=0x0;_0x16f9b3<_0x2dd8fc[_0x9afb('0x3f')];_0x16f9b3++){var _0x39c866=_[_0x9afb('0x3b')](_0x5bbd31,['id',_0x2dd8fc[_0x16f9b3]['UserId']]);if(!_0x39c866){_0x39c866={'id':_0x2dd8fc[_0x16f9b3][_0x9afb('0x45')],'name':_0x2dd8fc[_0x16f9b3][_0x9afb('0x45')],'accountcode':'','online':![]};}var _0x4ef773={'id':_0x39c866['id'],'name':_0x39c866[_0x9afb('0x11')],'internal':_0x39c866['accountcode'],'online':Boolean(_0x39c866['online']),'paused':Boolean(_0x2dd8fc[_0x16f9b3][_0x9afb('0x21')])};if(_0x39c866[_0x9afb('0x46')]===_0x9afb('0x20'))updateAgentVoiceStatus(_0x4ef773,_0x55ef3d,_0x345c58);if(_0x4ef773[_0x9afb('0x47')])_0x55ef3d[_0x9afb('0x39')]++;if(_0x4ef773['busy'])_0x55ef3d[_0x9afb('0x3a')]++;if(_0x4ef773[_0x9afb('0x21')]&&!_0x4ef773[_0x9afb('0x3a')]&&!_0x4ef773['talking'])_0x55ef3d[_0x9afb('0x21')]++;_0x55ef3d[_0x9afb('0x38')][_0x9afb('0x23')](_0x4ef773);}return _0x55ef3d;});}function getQueueAgents(_0x33e001,_0x59af73,_0x3e818e){var _0x92150d='User'+_['startCase'](_0x3e818e)+'Queue';var _0x2a0e00=_0x3e818e+'Pause';return db[_0x92150d][_0x9afb('0x48')]({'where':{[_['startCase'](_0x3e818e)+_0x9afb('0x49')]:_0x33e001['id']},'raw':!![]})[_0x9afb('0x17')](function(_0x44e12e){for(var _0x453e13=0x0;_0x453e13<_0x44e12e['length'];_0x453e13++){var _0x2ebcb8=_['find'](_0x59af73,['id',_0x44e12e[_0x453e13][_0x9afb('0x45')]]);if(!_0x2ebcb8){_0x2ebcb8={'id':_0x44e12e[_0x453e13][_0x9afb('0x45')],'name':_0x44e12e[_0x453e13][_0x9afb('0x45')],'online':![],['pauseField']:![]};}var _0x1cfa6f={'id':_0x2ebcb8['id'],'name':_0x2ebcb8[_0x9afb('0x11')],'online':Boolean(_0x2ebcb8[_0x9afb('0x47')]),'paused':Boolean(_0x2ebcb8[_0x2a0e00])};if(_0x1cfa6f[_0x9afb('0x47')])_0x33e001[_0x9afb('0x39')]++;_0x33e001[_0x9afb('0x38')][_0x9afb('0x23')](_0x1cfa6f);}return _0x33e001;});}function validateChannel(_0x463f4e){var _0x1f788f=utils[_0x9afb('0x4a')]();if(!_[_0x9afb('0x4b')](_0x1f788f,_0x463f4e['toLowerCase']()))throw new Error('Invalid\x20channel');return _0x463f4e[_0x9afb('0x4c')]();}exports[_0x9afb('0x4d')]=function(_0x1ecccd,_0x2571b0){var _0x3dae56={'count':0x0,'rows':[]};var _0x405665={};var _0x1f64ba;var _0x947374;var _0x332134;var _0x3a8dcb;var _0x2c1dfc=utils['getChannels']();var _0x245ed9=_0x1ecccd['query'][_0x9afb('0x4e')];var _0xec6d06=_0x1ecccd[_0x9afb('0x4f')]['globalStatusFilter'];var _0x4e0a23=_0x1ecccd['query'][_0x9afb('0x50')];var _0x2378b1=_0xec6d06===_0x9afb('0x51')||_0xec6d06===_0x9afb('0x52')?!![]:![];var _0x51eb7b=[];var _0x1b7e83;Promise['resolve']()['then'](function(){if(_0x1ecccd['query'][_0x9afb('0x53')]){_0x1f64ba=validateChannel(_0x1ecccd[_0x9afb('0x4f')]['channel']);}if(!_0x1ecccd[_0x9afb('0x4f')][_0x9afb('0x54')]||!_0x1ecccd[_0x9afb('0x4f')][_0x9afb('0x54')][_0x9afb('0x4b')](_0x9afb('0x55'))){_0x1ecccd['query']['sort']=rta[_0x9afb('0x56')](_0x1ecccd['query']['sort']);return;}var _0x526c23=rta[_0x9afb('0x57')](_0x1ecccd[_0x9afb('0x4f')][_0x9afb('0x54')]);_0x1ecccd[_0x9afb('0x4f')][_0x9afb('0x54')]=_0x526c23['fields']['join'](',');_0x947374=_0x526c23[_0x9afb('0x58')];})[_0x9afb('0x17')](function(){if(!_0x245ed9){return[];}return rta['getAgentIdsByQueues'](_0x245ed9,_0x1f64ba);})[_0x9afb('0x17')](function(_0xbfe203){_0x51eb7b=_0xbfe203;return rta[_0x9afb('0x59')]();})[_0x9afb('0x17')](function(_0x7ac72c){_0x3a8dcb=_0x7ac72c[_0x9afb('0x5a')];if((!_0xec6d06||_0x2378b1)&&!_0x947374){return _0x51eb7b;}if(_0x947374&&!_0xec6d06){return rta['getSortedAgentsIdsByStatus'](_0x3a8dcb,_0x51eb7b,_0x947374);}else{return rta['getAgentIdsByStatus'](_0x3a8dcb,_0x51eb7b,_0xec6d06);}})[_0x9afb('0x17')](function(_0x30946b){_0x51eb7b=_0x30946b;var _0x4abb2e=![];if(_0x51eb7b[_0x9afb('0x3f')]===0x0){if(_0x245ed9||_0xec6d06){_0x4abb2e=!![];}if(_0x2378b1){_0x4abb2e=![];}}if(_0x4abb2e){return _0x3dae56;}var _0x3c3761=_[_0x9afb('0x5b')](db[_0x9afb('0x5c')][_0x9afb('0x5d')],function(_0x486b57){return{'name':_0x486b57['fieldName'],'type':_0x486b57['type'][_0x9afb('0x5e')]};});_0x1ecccd['query'][_0x9afb('0x5f')]=_0x9afb('0x60');_0x1ecccd[_0x9afb('0x4f')][_0x9afb('0x47')]=!![];_0x405665=qs[_0x9afb('0x61')](_0x3c3761,_0x1ecccd);_0x405665[_0x9afb('0x62')]=!![];var _0x1283ba=[];if(_0x51eb7b[_0x9afb('0x3f')]>0x0){_0x1283ba[_0x9afb('0x23')]({'id':{'$in':_0x51eb7b}});if(_0x947374&&!_0xec6d06){_0x1b7e83=[db[_0x9afb('0x63')]['literal']('FIELD(id,'+_0x51eb7b+')')];_0x405665[_0x9afb('0x58')]=_0x1b7e83;}}if(_0x2378b1){_0x2c1dfc[_0x9afb('0x64')](function(_0x536e50){var _0x148f99=!![];if(_0xec6d06==='*pause'&&_0x1f64ba!==_0x536e50){_0x148f99=![];}_0x1283ba[_0x9afb('0x23')]({[_0x536e50+'Pause']:_0x148f99});});if(_0x4e0a23){_0x1283ba['push']({'pauseType':_0x4e0a23});}}else if(_0xec6d06){_0x2c1dfc[_0x9afb('0x64')](function(_0x272db3){_0x1283ba[_0x9afb('0x23')]({[_0x272db3+'Pause']:![]});});}_0x405665[_0x9afb('0x65')]=_[_0x9afb('0x3c')](_0x405665[_0x9afb('0x65')],{'$and':_0x1283ba});if(_0x1ecccd[_0x9afb('0x66')][_0x9afb('0x5f')]===_0x9afb('0x66')){var _0x5129d3={'params':{'id':_0x1ecccd[_0x9afb('0x66')]['userProfileId']},'query':{'section':_0x9afb('0x67'),'role':_0x9afb('0x60'),'online':!![],'raw':!![],'ids':_0x51eb7b,'customSorting':_0x1b7e83}};if(_0x2378b1){_0x5129d3['query'][_0x9afb('0x68')]=_0x1283ba;}_0x5129d3[_0x9afb('0x4f')]=Object[_0x9afb('0x69')](_0x5129d3[_0x9afb('0x4f')],_0x1ecccd[_0x9afb('0x4f')]);delete _0x5129d3[_0x9afb('0x4f')]['id'];return db[_0x9afb('0x6a')][_0x9afb('0x6b')](_0x5129d3);}return db['User'][_0x9afb('0x6c')](_0x405665);})[_0x9afb('0x17')](function(_0x596682){_0x3dae56[_0x9afb('0xc')]=_0x596682['count'];_0x332134=_0x596682[_0x9afb('0x5a')];return _0x332134[_0x9afb('0x5b')](function(_0x4abf28){var _0xddf486=_[_0x9afb('0x3b')](_0x3a8dcb,['id',_0x4abf28['id']]);if(_0xddf486){var _0x1f3dc8=rta['filterAgentAttributes'](_0xddf486);_[_0x9afb('0x3c')](_0x4abf28,_0x1f3dc8);}_0x4abf28[_0x9afb('0x55')]=rta[_0x9afb('0x6d')](_0x4abf28);if(_0x4abf28['globalStatus'][_0x9afb('0x4b')](_0x9afb('0x51'))){_0x2c1dfc[_0x9afb('0x64')](function(_0x3d31b8){if(_0x4abf28[_0x3d31b8+_0x9afb('0x6e')]){_0x4abf28[_0x3d31b8+_0x9afb('0x6f')]=_0x9afb('0x51');}});}return _0x4abf28;});})[_0x9afb('0x17')](function(_0x366d6f){if(!_0x947374||_0x1b7e83){return _0x366d6f;}return rta['sortAgentsByStatus'](_0x366d6f,_0x947374);})[_0x9afb('0x17')](function(_0xb7f660){_0x3dae56[_0x9afb('0x5a')]=_0xb7f660;return _0x3dae56;})['then'](respondWithFilteredResult(_0x2571b0,_0x405665))[_0x9afb('0x1b')](handleError(_0x2571b0,null));};exports[_0x9afb('0x70')]=function(_0xe684ef,_0x468743){var _0x4bfb35={'count':0x0,'rows':[]},_0x4505f0={},_0x42dc3a,_0x464111,_0x452d79,_0x45f863,_0x35d54a;Promise[_0x9afb('0x71')]()[_0x9afb('0x17')](function(){if(_0xe684ef[_0x9afb('0x4f')][_0x9afb('0x53')])_0x42dc3a=validateChannel(_0xe684ef[_0x9afb('0x4f')][_0x9afb('0x53')]);var _0x17b0e0=_['startCase'](_0x42dc3a)+_0x9afb('0x72');var _0x1d8c18=_[_0x9afb('0x5b')](db[_0x17b0e0][_0x9afb('0x5d')],function(_0x1868d3){return{'name':_0x1868d3[_0x9afb('0x73')],'type':_0x1868d3[_0x9afb('0x74')][_0x9afb('0x5e')]};});_0x4505f0=qs['getOptions'](_0x1d8c18,_0xe684ef);if(_0xe684ef[_0x9afb('0x66')][_0x9afb('0x5f')]===_0x9afb('0x66')){var _0x2e6e59={'params':{'id':_0xe684ef['user']['userProfileId']},'query':{'section':_0x42dc3a===_0x9afb('0x13')&&_0xe684ef[_0x9afb('0x4f')][_0x9afb('0x74')]===_0x9afb('0x22')?_0x9afb('0x75'):_['startCase'](_0x42dc3a)+_0x9afb('0x16'),'type':_0xe684ef[_0x9afb('0x4f')][_0x9afb('0x74')],'nolimit':!![],'sort':_0x9afb('0x11'),'filter':_0xe684ef[_0x9afb('0x4f')]['filter']}};return db[_0x9afb('0x6a')][_0x9afb('0x6b')](_0x2e6e59);}return db[_0x17b0e0][_0x9afb('0x6c')](_0x4505f0);})[_0x9afb('0x17')](function(_0x5e1531){_0x4bfb35[_0x9afb('0xc')]=_0x5e1531[_0x9afb('0xc')];_0x464111=_0x5e1531[_0x9afb('0x5a')];return getRealtimeQueues(_0xe684ef,_0x42dc3a);})[_0x9afb('0x17')](function(_0x14e88f){_0x45f863=_0x14e88f['rows'];return rta[_0x9afb('0x59')]();})['then'](function(_0x5991b9){_0x452d79=_0x5991b9[_0x9afb('0x5a')];if(_0x42dc3a!=_0x9afb('0x13'))return;return getRealtimeVoiceQueueChannels();})[_0x9afb('0x17')](function(_0x3534){_0x35d54a=_0x3534?_0x3534[_0x9afb('0x5a')]:[];return initializeQueues(_0x464111,_0x45f863,_0x42dc3a,_0xe684ef['query'][_0x9afb('0x74')]);})[_0x9afb('0x17')](function(_0x47dc24){var _0x39c538=_0x47dc24[_0x9afb('0x5b')](function(_0x138e83){if(_0x42dc3a===_0x9afb('0x13'))return getVoiceQueueAgents(_0x138e83,_0x464111,_0x452d79,_0x35d54a);else return getQueueAgents(_0x138e83,_0x452d79,_0x42dc3a);});return Promise['all'](_0x39c538);})[_0x9afb('0x17')](function(_0x3bfa9d){_0x4bfb35['rows']=_0x3bfa9d;return _0x4bfb35;})[_0x9afb('0x17')](respondWithFilteredResult(_0x468743,_0x4505f0))[_0x9afb('0x1b')](handleError(_0x468743,null));}; \ No newline at end of file +var _0x5e2f=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','loggedInDb','talking','busy','find','merge','pick','filter','queue','length','some','connectedlinenum','internal','toString','getMembers','UserId','online','agents','User','Queue','findAll','QueueId','getChannels','toLowerCase','Invalid\x20channel','getAgents','query','pauseTypeFilter','pause','*pause','resolve','channel','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','rawAttributes','fieldName','key','agent','getOptions','raw','sequelize','literal','FIELD(id,','Pause','forEach','user','userProfileId','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','getAgentStatus','sortAgentsByStatus','getQueues','type','role','QueueCampaigns','all','lodash','jayson/promise','../../components/realtime/agents','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','set','json','stack','name','status','send','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','paused','voice','outbound','push','pTalking','originated','Trunk','startPredictive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout'];(function(_0x394c7e,_0xcb0750){var _0x32872f=function(_0x49aa7d){while(--_0x49aa7d){_0x394c7e['push'](_0x394c7e['shift']());}};_0x32872f(++_0xcb0750);}(_0x5e2f,0x1a5));var _0xf5e2=function(_0x4932a6,_0x530e29){_0x4932a6=_0x4932a6-0x0;var _0x3b45b9=_0x5e2f[_0x4932a6];return _0x3b45b9;};'use strict';var util=require('util');var _=require(_0xf5e2('0x0'));var jayson=require(_0xf5e2('0x1'));var rta=require(_0xf5e2('0x2'));var qs=require(_0xf5e2('0x3'));var utils=require('../../config/utils');var logger=require(_0xf5e2('0x4'))('api');var db=require(_0xf5e2('0x5'))['db'];var amiClient=jayson[_0xf5e2('0x6')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xf5e2('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x2b933c,_0x3fa85a){return function(_0x26b561){if(_0x26b561){var _0x22ca2a=typeof _0x3fa85a[_0xf5e2('0x8')]===_0xf5e2('0x9')&&typeof _0x3fa85a[_0xf5e2('0xa')]==='undefined';var _0x46a175=_0x26b561[_0xf5e2('0xb')];var _0x5fccb2=_0x22ca2a?0x0:_0x3fa85a[_0xf5e2('0x8')];var _0x512129=_0x22ca2a?_0x26b561[_0xf5e2('0xb')]:_0x3fa85a[_0xf5e2('0x8')]+_0x3fa85a['limit'];var _0xb15a5f;if(_0x512129>=_0x46a175){_0x512129=_0x46a175;_0xb15a5f=0xc8;}else{_0xb15a5f=0xce;}_0x2b933c['status'](_0xb15a5f);return _0x2b933c[_0xf5e2('0xc')]('Content-Range',_0x5fccb2+'-'+_0x512129+'/'+_0x46a175)[_0xf5e2('0xd')](_0x26b561);}return null;};}function handleError(_0x502147,_0x57fe4f){_0x57fe4f=_0x57fe4f||0x1f4;return function(_0x12e6c1){logger['error'](_0x12e6c1[_0xf5e2('0xe')]);if(_0x12e6c1[_0xf5e2('0xf')]){delete _0x12e6c1[_0xf5e2('0xf')];}_0x502147[_0xf5e2('0x10')](_0x57fe4f)[_0xf5e2('0x11')](_0x12e6c1);};}function getRealtimeQueues(_0x131598,_0x5412ef){return new Promise(function(_0x4b7bde,_0xfaa67c){var _0x179cbd=_0x5412ef==='voice'?amiClient:routingClient;return _0x179cbd[_0xf5e2('0x12')](_[_0xf5e2('0x13')](_0x5412ef)+_0xf5e2('0x14'),_0x131598)[_0xf5e2('0x15')](function(_0x520f90){if(_0x520f90[_0xf5e2('0x16')])throw new Error(util[_0xf5e2('0x17')](_0xf5e2('0x18'),_0x5412ef));return _0x4b7bde(_0x520f90[_0xf5e2('0x19')]);})[_0xf5e2('0x1a')](function(_0xa3612c){_0xfaa67c(_0xa3612c);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x107706,_0x52df97){return amiClient['request'](_0xf5e2('0x1b'),{})['then'](function(_0x31cd1c){if(_0x31cd1c[_0xf5e2('0x16')])throw new Error(_0xf5e2('0x1c'));return _0x107706(_0x31cd1c[_0xf5e2('0x19')]);})[_0xf5e2('0x1a')](function(_0xe66f7f){_0x52df97(_0xe66f7f);});});}function initializeQueues(_0x3f282f,_0x2f93f5,_0x433e8a,_0x185643){var _0x431c47=['loggedIn',_0xf5e2('0x1d'),_0xf5e2('0x1e'),'talking',_0xf5e2('0x1f')];if(_0x433e8a===_0xf5e2('0x20')&&_0x185643===_0xf5e2('0x21')){_0x431c47[_0xf5e2('0x22')](_0xf5e2('0x23'),_0xf5e2('0x24'),'message','dialActive','dialMethod',_0xf5e2('0x25'),_0xf5e2('0x26'),'startProgressive',_0xf5e2('0x27'),'erlangCallToSecond',_0xf5e2('0x28'),_0xf5e2('0x29'),'dialPredictiveInterval',_0xf5e2('0x2a'),_0xf5e2('0x2b'),_0xf5e2('0x2c'),'predictiveIntervalTotalCalls',_0xf5e2('0x2d'),_0xf5e2('0x2e'),_0xf5e2('0x2f'),'predictiveIntervalAvgHoldtime',_0xf5e2('0x30'));}return _0x3f282f[_0xf5e2('0x31')](function(_0x1ca678){var _0x5ef3b7=_0x1ca678['get']({'plain':!![]});_0x5ef3b7['agents']=[];_0x5ef3b7[_0xf5e2('0x1f')]=0x0;_0x5ef3b7[_0xf5e2('0x32')]=0x0;_0x5ef3b7['loggedIn']=0x0;_0x5ef3b7[_0xf5e2('0x1d')]=0x0;_0x5ef3b7['waiting']=0x0;if(_0x433e8a===_0xf5e2('0x20')){_0x5ef3b7[_0xf5e2('0x33')]=0x0;_0x5ef3b7[_0xf5e2('0x34')]=0x0;if(_0x185643===_0xf5e2('0x21')){_0x5ef3b7[_0xf5e2('0x23')]=0x0;_0x5ef3b7['originated']=0x0;}}var _0x484647=_[_0xf5e2('0x35')](_0x2f93f5,['id',_0x5ef3b7['id']]);if(_0x484647)_[_0xf5e2('0x36')](_0x5ef3b7,_[_0xf5e2('0x37')](_0x484647,_0x431c47));return _0x5ef3b7;});}function updateAgentVoiceStatus(_0x30749e,_0x390dc3,_0x58f8e3){var _0xf5c1eb=_[_0xf5e2('0x38')](_0x58f8e3,[_0xf5e2('0x39'),_0x390dc3['name']]);if(_0xf5c1eb[_0xf5e2('0x3a')]===0x0)return _0x30749e['busy']=!![];if(_[_0xf5e2('0x3b')](_0xf5c1eb,[_0xf5e2('0x3c'),_0x30749e[_0xf5e2('0x3d')][_0xf5e2('0x3e')]()]))return _0x30749e[_0xf5e2('0x33')]=!![];if(!_0x30749e['talking'])return _0x30749e[_0xf5e2('0x34')]=!![];}function getVoiceQueueAgents(_0x40fc9a,_0x3bff6d,_0x49b931,_0x402438){var _0xba3987=_['find'](_0x3bff6d,['id',_0x40fc9a['id']]);if(!_0xba3987)return _0x40fc9a;return _0xba3987[_0xf5e2('0x3f')]({'raw':!![]})['then'](function(_0xcb2acd){for(var _0x22e65f=0x0;_0x22e65f<_0xcb2acd[_0xf5e2('0x3a')];_0x22e65f++){var _0x243ac5=_[_0xf5e2('0x35')](_0x49b931,['id',_0xcb2acd[_0x22e65f]['UserId']]);if(!_0x243ac5){_0x243ac5={'id':_0xcb2acd[_0x22e65f][_0xf5e2('0x40')],'name':_0xcb2acd[_0x22e65f][_0xf5e2('0x40')],'accountcode':'','online':![]};}var _0x4bd338={'id':_0x243ac5['id'],'name':_0x243ac5['name'],'internal':_0x243ac5['accountcode'],'online':Boolean(_0x243ac5[_0xf5e2('0x41')]),'paused':Boolean(_0xcb2acd[_0x22e65f][_0xf5e2('0x1f')])};if(_0x243ac5['voiceStatus']===_0xf5e2('0x33'))updateAgentVoiceStatus(_0x4bd338,_0x40fc9a,_0x402438);if(_0x4bd338[_0xf5e2('0x41')])_0x40fc9a[_0xf5e2('0x32')]++;if(_0x4bd338[_0xf5e2('0x34')])_0x40fc9a[_0xf5e2('0x34')]++;if(_0x4bd338[_0xf5e2('0x1f')]&&!_0x4bd338[_0xf5e2('0x34')]&&!_0x4bd338[_0xf5e2('0x33')])_0x40fc9a[_0xf5e2('0x1f')]++;_0x40fc9a[_0xf5e2('0x42')][_0xf5e2('0x22')](_0x4bd338);}return _0x40fc9a;});}function getQueueAgents(_0x446750,_0x3109f0,_0x4533c2){var _0x486032=_0xf5e2('0x43')+_['startCase'](_0x4533c2)+_0xf5e2('0x44');var _0x4a70f4=_0x4533c2+'Pause';return db[_0x486032][_0xf5e2('0x45')]({'where':{[_[_0xf5e2('0x13')](_0x4533c2)+_0xf5e2('0x46')]:_0x446750['id']},'raw':!![]})['then'](function(_0xd567d1){for(var _0x43acce=0x0;_0x43acce<_0xd567d1[_0xf5e2('0x3a')];_0x43acce++){var _0x39c927=_['find'](_0x3109f0,['id',_0xd567d1[_0x43acce][_0xf5e2('0x40')]]);if(!_0x39c927){_0x39c927={'id':_0xd567d1[_0x43acce][_0xf5e2('0x40')],'name':_0xd567d1[_0x43acce]['UserId'],'online':![],['pauseField']:![]};}var _0x5b9183={'id':_0x39c927['id'],'name':_0x39c927[_0xf5e2('0xf')],'online':Boolean(_0x39c927['online']),'paused':Boolean(_0x39c927[_0x4a70f4])};if(_0x5b9183['online'])_0x446750[_0xf5e2('0x32')]++;_0x446750[_0xf5e2('0x42')]['push'](_0x5b9183);}return _0x446750;});}function validateChannel(_0x3de013){var _0x11c9f=utils[_0xf5e2('0x47')]();if(!_['includes'](_0x11c9f,_0x3de013[_0xf5e2('0x48')]()))throw new Error(_0xf5e2('0x49'));return _0x3de013[_0xf5e2('0x48')]();}exports[_0xf5e2('0x4a')]=function(_0x2ab2f8,_0x2d2614){var _0x36e48e={'count':0x0,'rows':[]};var _0x2f55dc={};var _0x5c7bb6;var _0x199060;var _0x590ffe;var _0x18ef6d;var _0x2e6f07=utils[_0xf5e2('0x47')]();var _0x11464b=_0x2ab2f8[_0xf5e2('0x4b')]['globalQueueFilter'];var _0x3a6bc2=_0x2ab2f8[_0xf5e2('0x4b')]['globalStatusFilter'];var _0xa84541=_0x2ab2f8['query'][_0xf5e2('0x4c')];var _0x18f413=_0x3a6bc2===_0xf5e2('0x4d')||_0x3a6bc2===_0xf5e2('0x4e')?!![]:![];var _0x500da6=[];var _0x2b41d5;Promise[_0xf5e2('0x4f')]()[_0xf5e2('0x15')](function(){if(_0x2ab2f8['query'][_0xf5e2('0x50')]){_0x5c7bb6=validateChannel(_0x2ab2f8[_0xf5e2('0x4b')][_0xf5e2('0x50')]);}if(!_0x2ab2f8[_0xf5e2('0x4b')][_0xf5e2('0x51')]||!_0x2ab2f8[_0xf5e2('0x4b')]['sort'][_0xf5e2('0x52')](_0xf5e2('0x53'))){_0x2ab2f8[_0xf5e2('0x4b')]['sort']=rta[_0xf5e2('0x54')](_0x2ab2f8['query'][_0xf5e2('0x51')]);return;}var _0x210767=rta[_0xf5e2('0x55')](_0x2ab2f8['query'][_0xf5e2('0x51')]);_0x2ab2f8[_0xf5e2('0x4b')][_0xf5e2('0x51')]=_0x210767[_0xf5e2('0x56')][_0xf5e2('0x57')](',');_0x199060=_0x210767[_0xf5e2('0x58')];})['then'](function(){if(!_0x11464b){return[];}return rta['getAgentIdsByQueues'](_0x11464b,_0x5c7bb6);})[_0xf5e2('0x15')](function(_0x4d3079){_0x500da6=_0x4d3079;return rta[_0xf5e2('0x59')]();})[_0xf5e2('0x15')](function(_0x2f6800){_0x18ef6d=_0x2f6800[_0xf5e2('0x5a')];if((!_0x3a6bc2||_0x18f413)&&!_0x199060){return _0x500da6;}if(_0x199060&&!_0x3a6bc2){return rta['getSortedAgentsIdsByStatus'](_0x18ef6d,_0x500da6,_0x199060);}else{return rta['getAgentIdsByStatus'](_0x18ef6d,_0x500da6,_0x3a6bc2);}})[_0xf5e2('0x15')](function(_0xe773f0){_0x500da6=_0xe773f0;var _0x99a2b5=![];if(_0x500da6[_0xf5e2('0x3a')]===0x0){if(_0x11464b||_0x3a6bc2){_0x99a2b5=!![];}if(_0x18f413){_0x99a2b5=![];}}if(_0x99a2b5){return _0x36e48e;}var _0x59cc0f=_[_0xf5e2('0x31')](db[_0xf5e2('0x43')][_0xf5e2('0x5b')],function(_0x4925ab){return{'name':_0x4925ab[_0xf5e2('0x5c')],'type':_0x4925ab['type'][_0xf5e2('0x5d')]};});_0x2ab2f8[_0xf5e2('0x4b')]['role']=_0xf5e2('0x5e');_0x2ab2f8['query'][_0xf5e2('0x41')]=!![];_0x2f55dc=qs[_0xf5e2('0x5f')](_0x59cc0f,_0x2ab2f8);_0x2f55dc[_0xf5e2('0x60')]=!![];var _0x4fbc8a=[];if(_0x500da6[_0xf5e2('0x3a')]>0x0){_0x4fbc8a[_0xf5e2('0x22')]({'id':{'$in':_0x500da6}});if(_0x199060&&!_0x3a6bc2){_0x2b41d5=[db[_0xf5e2('0x61')][_0xf5e2('0x62')](_0xf5e2('0x63')+_0x500da6+')')];_0x2f55dc[_0xf5e2('0x58')]=_0x2b41d5;}}if(_0x18f413){_0x2e6f07['forEach'](function(_0x43ca75){var _0x181a6b=!![];if(_0x3a6bc2===_0xf5e2('0x4e')&&_0x5c7bb6!==_0x43ca75){_0x181a6b=![];}_0x4fbc8a[_0xf5e2('0x22')]({[_0x43ca75+_0xf5e2('0x64')]:_0x181a6b});});if(_0xa84541){_0x4fbc8a['push']({'pauseType':_0xa84541});}}else if(_0x3a6bc2){_0x2e6f07[_0xf5e2('0x65')](function(_0x25355b){_0x4fbc8a['push']({[_0x25355b+_0xf5e2('0x64')]:![]});});}_0x2f55dc['where']=_[_0xf5e2('0x36')](_0x2f55dc['where'],{'$and':_0x4fbc8a});if(_0x2ab2f8[_0xf5e2('0x66')]['role']===_0xf5e2('0x66')){var _0x5bdd88={'params':{'id':_0x2ab2f8[_0xf5e2('0x66')][_0xf5e2('0x67')]},'query':{'section':'Agents','role':_0xf5e2('0x5e'),'online':!![],'raw':!![],'ids':_0x500da6,'customSorting':_0x2b41d5}};if(_0x18f413){_0x5bdd88[_0xf5e2('0x4b')][_0xf5e2('0x68')]=_0x4fbc8a;}_0x5bdd88[_0xf5e2('0x4b')]=Object[_0xf5e2('0x69')](_0x5bdd88[_0xf5e2('0x4b')],_0x2ab2f8['query']);delete _0x5bdd88[_0xf5e2('0x4b')]['id'];return db[_0xf5e2('0x6a')][_0xf5e2('0x6b')](_0x5bdd88);}return db[_0xf5e2('0x43')][_0xf5e2('0x6c')](_0x2f55dc);})[_0xf5e2('0x15')](function(_0x1a93f9){_0x36e48e[_0xf5e2('0xb')]=_0x1a93f9['count'];_0x590ffe=_0x1a93f9[_0xf5e2('0x5a')];return _0x590ffe[_0xf5e2('0x31')](function(_0x235c24){var _0x45fb79=_[_0xf5e2('0x35')](_0x18ef6d,['id',_0x235c24['id']]);if(_0x45fb79){var _0x1a8cd6=rta[_0xf5e2('0x6d')](_0x45fb79);_[_0xf5e2('0x36')](_0x235c24,_0x1a8cd6);}_0x235c24['globalStatus']=rta[_0xf5e2('0x6e')](_0x235c24);if(_0x235c24['globalStatus'][_0xf5e2('0x52')](_0xf5e2('0x4d'))){_0x2e6f07[_0xf5e2('0x65')](function(_0x18e7be){if(_0x235c24[_0x18e7be+_0xf5e2('0x64')]){_0x235c24[_0x18e7be+'Status']=_0xf5e2('0x4d');}});}return _0x235c24;});})[_0xf5e2('0x15')](function(_0x142150){if(!_0x199060||_0x2b41d5){return _0x142150;}return rta[_0xf5e2('0x6f')](_0x142150,_0x199060);})[_0xf5e2('0x15')](function(_0x46c4d1){_0x36e48e['rows']=_0x46c4d1;return _0x36e48e;})[_0xf5e2('0x15')](respondWithFilteredResult(_0x2d2614,_0x2f55dc))[_0xf5e2('0x1a')](handleError(_0x2d2614,null));};exports[_0xf5e2('0x70')]=function(_0x418899,_0x3d92cd){var _0x28e900={'count':0x0,'rows':[]},_0x4547ac={},_0x4ba9b3,_0x538742,_0x5ce153,_0x12848c,_0x46cf1c;Promise[_0xf5e2('0x4f')]()[_0xf5e2('0x15')](function(){if(_0x418899['query'][_0xf5e2('0x50')])_0x4ba9b3=validateChannel(_0x418899[_0xf5e2('0x4b')][_0xf5e2('0x50')]);var _0x16c996=_[_0xf5e2('0x13')](_0x4ba9b3)+_0xf5e2('0x44');var _0x5115d2=_['map'](db[_0x16c996]['rawAttributes'],function(_0x3d039b){return{'name':_0x3d039b[_0xf5e2('0x5c')],'type':_0x3d039b[_0xf5e2('0x71')][_0xf5e2('0x5d')]};});_0x4547ac=qs['getOptions'](_0x5115d2,_0x418899);if(_0x418899[_0xf5e2('0x66')][_0xf5e2('0x72')]===_0xf5e2('0x66')){var _0x4733c3={'params':{'id':_0x418899[_0xf5e2('0x66')]['userProfileId']},'query':{'section':_0x4ba9b3===_0xf5e2('0x20')&&_0x418899[_0xf5e2('0x4b')][_0xf5e2('0x71')]===_0xf5e2('0x21')?_0xf5e2('0x73'):_['startCase'](_0x4ba9b3)+_0xf5e2('0x14'),'type':_0x418899[_0xf5e2('0x4b')][_0xf5e2('0x71')],'nolimit':!![],'sort':_0xf5e2('0xf'),'filter':_0x418899['query']['filter']}};return db[_0xf5e2('0x6a')][_0xf5e2('0x6b')](_0x4733c3);}return db[_0x16c996]['findAndCountAll'](_0x4547ac);})[_0xf5e2('0x15')](function(_0x3d9656){_0x28e900[_0xf5e2('0xb')]=_0x3d9656[_0xf5e2('0xb')];_0x538742=_0x3d9656['rows'];return getRealtimeQueues(_0x418899,_0x4ba9b3);})[_0xf5e2('0x15')](function(_0x54eafb){_0x12848c=_0x54eafb[_0xf5e2('0x5a')];return rta[_0xf5e2('0x59')]();})[_0xf5e2('0x15')](function(_0x2af02d){_0x5ce153=_0x2af02d[_0xf5e2('0x5a')];if(_0x4ba9b3!=_0xf5e2('0x20'))return;return getRealtimeVoiceQueueChannels();})[_0xf5e2('0x15')](function(_0x209a85){_0x46cf1c=_0x209a85?_0x209a85[_0xf5e2('0x5a')]:[];return initializeQueues(_0x538742,_0x12848c,_0x4ba9b3,_0x418899[_0xf5e2('0x4b')][_0xf5e2('0x71')]);})[_0xf5e2('0x15')](function(_0x41a2ca){var _0x54892e=_0x41a2ca[_0xf5e2('0x31')](function(_0x4886b6){if(_0x4ba9b3==='voice')return getVoiceQueueAgents(_0x4886b6,_0x538742,_0x5ce153,_0x46cf1c);else return getQueueAgents(_0x4886b6,_0x5ce153,_0x4ba9b3);});return Promise[_0xf5e2('0x74')](_0x54892e);})['then'](function(_0x2a55f4){_0x28e900[_0xf5e2('0x5a')]=_0x2a55f4;return _0x28e900;})[_0xf5e2('0x15')](respondWithFilteredResult(_0x3d92cd,_0x4547ac))['catch'](handleError(_0x3d92cd,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a1cc898..82afe6a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x544f37,_0x2de288){var _0x40b8f4=function(_0x502227){while(--_0x502227){_0x544f37['push'](_0x544f37['shift']());}};_0x40b8f4(++_0x2de288);}(_0x70e0,0x17b));var _0x070e=function(_0x1066ce,_0x10a8e1){_0x1066ce=_0x1066ce-0x0;var _0x2c7432=_0x70e0[_0x1066ce];return _0x2c7432;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x175a46,_0x467177){var _0x4050a7=function(_0x43d829){while(--_0x43d829){_0x175a46['push'](_0x175a46['shift']());}};_0x4050a7(++_0x467177);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 46cc124..ebd954c 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 _0xed1c=['DATE','INTEGER','STRING','sequelize','exports'];(function(_0x1b9c54,_0x387f9d){var _0x426a25=function(_0x3c10dc){while(--_0x3c10dc){_0x1b9c54['push'](_0x1b9c54['shift']());}};_0x426a25(++_0x387f9d);}(_0xed1c,0xe4));var _0xced1=function(_0x669b35,_0x4d8403){_0x669b35=_0x669b35-0x0;var _0x34b763=_0xed1c[_0x669b35];return _0x34b763;};'use strict';var Sequelize=require(_0xced1('0x0'));module[_0xced1('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xced1('0x2')]},'responsetime':{'type':Sequelize[_0xced1('0x2')]},'ringtime':{'type':Sequelize[_0xced1('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xced1('0x4')]},'membername':{'type':Sequelize[_0xced1('0x4')]}}; \ No newline at end of file +var _0xafca=['INTEGER','STRING','DATE','sequelize'];(function(_0x34d8ff,_0x532c9d){var _0x1f4ede=function(_0x3df129){while(--_0x3df129){_0x34d8ff['push'](_0x34d8ff['shift']());}};_0x1f4ede(++_0x532c9d);}(_0xafca,0x1ef));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaafc('0x0'));module['exports']={'state':{'type':Sequelize[_0xaafc('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xaafc('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaafc('0x3')]},'responsetime':{'type':Sequelize[_0xaafc('0x3')]},'ringtime':{'type':Sequelize[_0xaafc('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xaafc('0x2')]},'campaigntype':{'type':Sequelize[_0xaafc('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index e43233c..ca0034f 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 _0x26c0=['api','moment','path','rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x352b36,_0x4bad0a){var _0x4a443c=function(_0x3b9e24){while(--_0x3b9e24){_0x352b36['push'](_0x352b36['shift']());}};_0x4a443c(++_0x4bad0a);}(_0x26c0,0x1c1));var _0x026c=function(_0x115309,_0x3605f5){_0x115309=_0x115309-0x0;var _0x241e2b=_0x26c0[_0x115309];return _0x241e2b;};'use strict';var _=require(_0x026c('0x0'));var util=require(_0x026c('0x1'));var logger=require('../../config/logger')(_0x026c('0x2'));var moment=require(_0x026c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x026c('0x4'));var rimraf=require(_0x026c('0x5'));var config=require(_0x026c('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x026c('0x7')]=function(_0x194fa6,_0x1d494e){return _0x194fa6[_0x026c('0x8')](_0x026c('0x9'),attributes,{'tableName':_0x026c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d21=['./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1d947d,_0x1ec5c3){var _0x497335=function(_0x306acf){while(--_0x306acf){_0x1d947d['push'](_0x1d947d['shift']());}};_0x497335(++_0x1ec5c3);}(_0x9d21,0x115));var _0x19d2=function(_0x479f17,_0x3ddb13){_0x479f17=_0x479f17-0x0;var _0xba4508=_0x9d21[_0x479f17];return _0xba4508;};'use strict';var _=require(_0x19d2('0x0'));var util=require(_0x19d2('0x1'));var logger=require(_0x19d2('0x2'))(_0x19d2('0x3'));var moment=require(_0x19d2('0x4'));var BPromise=require(_0x19d2('0x5'));var rp=require(_0x19d2('0x6'));var fs=require('fs');var path=require(_0x19d2('0x7'));var rimraf=require('rimraf');var config=require(_0x19d2('0x8'));var attributes=require(_0x19d2('0x9'));module[_0x19d2('0xa')]=function(_0x17742b,_0xd15d68){return _0x17742b['define'](_0x19d2('0xb'),attributes,{'tableName':_0x19d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 501bc03..39c34f7 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 _0x8d8e=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x297806,_0x2134b2){var _0x55c003=function(_0x207195){while(--_0x207195){_0x297806['push'](_0x297806['shift']());}};_0x55c003(++_0x2134b2);}(_0x8d8e,0xd9));var _0xe8d8=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x8d8e[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xe8d8('0x0'));var util=require(_0xe8d8('0x1'));var moment=require(_0xe8d8('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8d8('0x3'));var fs=require('fs');var Redis=require(_0xe8d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8d8('0x5'));var logger=require(_0xe8d8('0x6'))(_0xe8d8('0x7'));var config=require(_0xe8d8('0x8'));var jayson=require(_0xe8d8('0x9'));var client=jayson[_0xe8d8('0xa')][_0xe8d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e40fb,_0xf4d452,_0x2ee240){return new BPromise(function(_0x567e10,_0x216e8b){return client['request'](_0x3e40fb,_0x2ee240)[_0xe8d8('0xc')](function(_0x3c4339){logger[_0xe8d8('0xd')](_0xe8d8('0xe'),_0xf4d452,'request\x20sent');logger['debug'](_0xe8d8('0xf'),_0xf4d452,_0xe8d8('0x10'),JSON[_0xe8d8('0x11')](_0x3c4339));if(_0x3c4339[_0xe8d8('0x12')]){if(_0x3c4339[_0xe8d8('0x12')]['code']===0x1f4){logger[_0xe8d8('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0xf4d452,_0x3c4339[_0xe8d8('0x12')][_0xe8d8('0x13')]);return _0x216e8b(_0x3c4339[_0xe8d8('0x12')]['message']);}logger[_0xe8d8('0x12')](_0xe8d8('0xe'),_0xf4d452,_0x3c4339['error'][_0xe8d8('0x13')]);return _0x567e10(_0x3c4339[_0xe8d8('0x12')]['message']);}else{logger[_0xe8d8('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xf4d452,_0xe8d8('0x10'));_0x567e10(_0x3c4339[_0xe8d8('0x14')][_0xe8d8('0x13')]);}})[_0xe8d8('0x15')](function(_0x594b78){logger[_0xe8d8('0x12')](_0xe8d8('0xe'),_0xf4d452,_0x594b78);_0x216e8b(_0x594b78);});});}exports[_0xe8d8('0x16')]=function(_0x5153e8){var _0x541034=this;return new Promise(function(_0x209370,_0x5427a0){return db[_0xe8d8('0x17')][_0xe8d8('0x18')](_0x5153e8[_0xe8d8('0x19')],{'raw':_0x5153e8['options']?_0x5153e8[_0xe8d8('0x1a')][_0xe8d8('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x32af49){logger[_0xe8d8('0xd')]('CreateReportAgentPreview',_0x5153e8);logger[_0xe8d8('0x1c')](_0xe8d8('0x16'),_0x5153e8,JSON[_0xe8d8('0x11')](_0x32af49));_0x209370(_0x32af49);})[_0xe8d8('0x15')](function(_0x25eedd){logger['error']('CreateReportAgentPreview',_0x25eedd[_0xe8d8('0x13')],_0x5153e8);_0x5427a0(_0x541034['error'](0x1f4,_0x25eedd[_0xe8d8('0x13')]));});});}; \ No newline at end of file +var _0x63aa=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','create','body','options','raw','then','CreateReportAgentPreview','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug'];(function(_0x221808,_0x4e6ee5){var _0x26c697=function(_0x18e6df){while(--_0x18e6df){_0x221808['push'](_0x221808['shift']());}};_0x26c697(++_0x4e6ee5);}(_0x63aa,0x1d8));var _0xa63a=function(_0x3507b5,_0x1ee543){_0x3507b5=_0x3507b5-0x0;var _0x2ab7f8=_0x63aa[_0x3507b5];return _0x2ab7f8;};'use strict';var _=require('lodash');var util=require(_0xa63a('0x0'));var moment=require(_0xa63a('0x1'));var BPromise=require(_0xa63a('0x2'));var rs=require(_0xa63a('0x3'));var fs=require('fs');var Redis=require(_0xa63a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa63a('0x5'));var logger=require(_0xa63a('0x6'))('rpc');var config=require(_0xa63a('0x7'));var jayson=require(_0xa63a('0x8'));var client=jayson['client'][_0xa63a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aa712,_0x30498a,_0x597bc7){return new BPromise(function(_0xf4fb17,_0xf56564){return client[_0xa63a('0xa')](_0x1aa712,_0x597bc7)['then'](function(_0x80d8fe){logger[_0xa63a('0xb')](_0xa63a('0xc'),_0x30498a,'request\x20sent');logger[_0xa63a('0xd')](_0xa63a('0xe'),_0x30498a,_0xa63a('0xf'),JSON[_0xa63a('0x10')](_0x80d8fe));if(_0x80d8fe[_0xa63a('0x11')]){if(_0x80d8fe['error'][_0xa63a('0x12')]===0x1f4){logger[_0xa63a('0x11')](_0xa63a('0xc'),_0x30498a,_0x80d8fe[_0xa63a('0x11')][_0xa63a('0x13')]);return _0xf56564(_0x80d8fe['error']['message']);}logger[_0xa63a('0x11')](_0xa63a('0xc'),_0x30498a,_0x80d8fe[_0xa63a('0x11')]['message']);return _0xf4fb17(_0x80d8fe[_0xa63a('0x11')]['message']);}else{logger[_0xa63a('0xb')](_0xa63a('0xc'),_0x30498a,_0xa63a('0xf'));_0xf4fb17(_0x80d8fe['result'][_0xa63a('0x13')]);}})[_0xa63a('0x14')](function(_0x4c2d8b){logger[_0xa63a('0x11')](_0xa63a('0xc'),_0x30498a,_0x4c2d8b);_0xf56564(_0x4c2d8b);});});}exports['CreateReportAgentPreview']=function(_0x392f51){var _0x4c2672=this;return new Promise(function(_0x43140a,_0x33e975){return db['ReportAgentPreview'][_0xa63a('0x15')](_0x392f51[_0xa63a('0x16')],{'raw':_0x392f51[_0xa63a('0x17')]?_0x392f51[_0xa63a('0x17')][_0xa63a('0x18')]===undefined?!![]:![]:!![]})[_0xa63a('0x19')](function(_0x4fee9a){logger['info'](_0xa63a('0x1a'),_0x392f51);logger[_0xa63a('0xd')]('CreateReportAgentPreview',_0x392f51,JSON[_0xa63a('0x10')](_0x4fee9a));_0x43140a(_0x4fee9a);})['catch'](function(_0x3923dd){logger[_0xa63a('0x11')](_0xa63a('0x1a'),_0x3923dd[_0xa63a('0x13')],_0x392f51);_0x33e975(_0x4c2672[_0xa63a('0x11')](0x1f4,_0x3923dd[_0xa63a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b6bdaf4..b053775 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 _0x7497=['isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','outbound','/outbound/channels','outboundChannels','agentCapacity','/telephones','telephones','/trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','showMailQueues','chat','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','multer','util','path','./rpc.controller','get'];(function(_0x2308cf,_0x4c3652){var _0x49c6fe=function(_0x22e1aa){while(--_0x22e1aa){_0x2308cf['push'](_0x2308cf['shift']());}};_0x49c6fe(++_0x4c3652);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var path=require(_0x7749('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x7749('0x3'));router[_0x7749('0x4')]('/voice/channels',auth[_0x7749('0x5')](),controller[_0x7749('0x6')]);router[_0x7749('0x4')](_0x7749('0x7'),auth[_0x7749('0x5')](),controller[_0x7749('0x8')]);router[_0x7749('0x4')](_0x7749('0x9'),auth[_0x7749('0x5')](),controller[_0x7749('0xa')]);router[_0x7749('0x4')]('/voice/queues',auth[_0x7749('0x5')](),controller['voiceQueues']);router[_0x7749('0x4')](_0x7749('0xb'),auth[_0x7749('0x5')](),controller[_0x7749('0xc')]);router[_0x7749('0x4')](_0x7749('0xd'),auth[_0x7749('0x5')](),controller[_0x7749('0xe')]);router[_0x7749('0x4')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x7749('0xf')]);router['get']('/openchannel/queues',auth[_0x7749('0x5')](),controller[_0x7749('0x10')]);router[_0x7749('0x4')](_0x7749('0x11'),auth[_0x7749('0x5')](),controller[_0x7749('0x12')]);router['get']('/whatsapp/queues',auth[_0x7749('0x5')](),controller[_0x7749('0x13')]);router['get'](_0x7749('0x14'),auth[_0x7749('0x5')](),controller[_0x7749('0x15')]);router[_0x7749('0x4')](_0x7749('0x16'),auth[_0x7749('0x5')](),controller[_0x7749('0x17')]);router[_0x7749('0x4')](_0x7749('0x18'),auth[_0x7749('0x5')](),controller['voiceQueuesChannels']);router[_0x7749('0x4')](_0x7749('0x19'),auth['isAuthenticated'](),controller[_0x7749('0x1a')]);router['get'](_0x7749('0x1b'),auth[_0x7749('0x5')](),controller[_0x7749('0x1c')]);router[_0x7749('0x4')](_0x7749('0x1d'),auth[_0x7749('0x5')](),controller[_0x7749('0x1e')]);router[_0x7749('0x4')](_0x7749('0x1f'),auth[_0x7749('0x5')](),controller['showVoiceQueues']);router[_0x7749('0x20')](_0x7749('0x1f'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x7749('0x4')]('/outbound',auth[_0x7749('0x5')](),controller[_0x7749('0x21')]);router[_0x7749('0x4')](_0x7749('0x22'),auth['isAuthenticated'](),controller[_0x7749('0x23')]);router['get']('/agents',auth['isAuthenticated'](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0x7749('0x5')](),controller[_0x7749('0x24')]);router['get'](_0x7749('0x25'),auth[_0x7749('0x5')](),controller[_0x7749('0x26')]);router[_0x7749('0x4')](_0x7749('0x27'),auth[_0x7749('0x5')](),controller['trunks']);router[_0x7749('0x4')](_0x7749('0x28'),auth[_0x7749('0x5')](),controller['campaigns']);router[_0x7749('0x4')](_0x7749('0x29'),auth[_0x7749('0x5')](),controller[_0x7749('0x2a')]);router[_0x7749('0x4')](_0x7749('0x2b'),auth[_0x7749('0x5')](),controller[_0x7749('0x2c')]);router[_0x7749('0x4')](_0x7749('0x2d'),auth[_0x7749('0x5')](),controller[_0x7749('0x2e')]);router[_0x7749('0x4')](_0x7749('0x2f'),auth[_0x7749('0x5')](),controller[_0x7749('0x30')]);router[_0x7749('0x4')]('/openchannel/queues/:id/waitinginteractions',auth[_0x7749('0x5')](),controller[_0x7749('0x31')]);router[_0x7749('0x4')](_0x7749('0x32'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get'](_0x7749('0x33'),auth[_0x7749('0x5')](),controller[_0x7749('0x34')]);router[_0x7749('0x4')]('/fax/queues/waitinginteractions',auth[_0x7749('0x5')](),controller[_0x7749('0x35')]);router[_0x7749('0x36')]('/mail/queues/:id/notify',auth[_0x7749('0x5')](),controller[_0x7749('0x37')]('mail'));router[_0x7749('0x4')]('/mail/queues/:id',auth[_0x7749('0x5')](),controller[_0x7749('0x38')]);router[_0x7749('0x36')]('/chat/queues/:id/notify',auth[_0x7749('0x5')](),controller[_0x7749('0x37')](_0x7749('0x39')));router[_0x7749('0x4')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x7749('0x36')](_0x7749('0x3a'),auth[_0x7749('0x5')](),controller[_0x7749('0x37')](_0x7749('0x3b')));router[_0x7749('0x4')](_0x7749('0x3c'),auth[_0x7749('0x5')](),controller['showFaxQueues']);router[_0x7749('0x36')](_0x7749('0x3d'),auth[_0x7749('0x5')](),controller[_0x7749('0x37')](_0x7749('0x3e')));router[_0x7749('0x4')](_0x7749('0x3f'),auth[_0x7749('0x5')](),controller[_0x7749('0x40')]);router[_0x7749('0x36')](_0x7749('0x41'),auth[_0x7749('0x5')](),controller[_0x7749('0x37')](_0x7749('0x42')));router[_0x7749('0x36')]('/whatsapp/queues/:id/notify',auth[_0x7749('0x5')](),controller[_0x7749('0x37')]('whatsapp'));router['get'](_0x7749('0x43'),auth[_0x7749('0x5')](),controller[_0x7749('0x44')]);router[_0x7749('0x4')]('/whatsapp/queues/:id',auth[_0x7749('0x5')](),controller[_0x7749('0x45')]);router[_0x7749('0x36')]('/agents/:id/notify',auth[_0x7749('0x5')](),controller[_0x7749('0x46')]);module['exports']=router; \ No newline at end of file +var _0xe57d=['voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','put','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','util','path','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id'];(function(_0x2ad9c3,_0x26becd){var _0x292e46=function(_0x41104a){while(--_0x41104a){_0x2ad9c3['push'](_0x2ad9c3['shift']());}};_0x292e46(++_0x26becd);}(_0xe57d,0x160));var _0xde57=function(_0x4a15ff,_0x44c30d){_0x4a15ff=_0x4a15ff-0x0;var _0x26b619=_0xe57d[_0x4a15ff];return _0x26b619;};'use strict';var multer=require('multer');var util=require(_0xde57('0x0'));var path=require(_0xde57('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xde57('0x2'));var controller=require(_0xde57('0x3'));router[_0xde57('0x4')]('/voice/channels',auth[_0xde57('0x5')](),controller[_0xde57('0x6')]);router['get'](_0xde57('0x7'),auth[_0xde57('0x5')](),controller[_0xde57('0x8')]);router[_0xde57('0x4')](_0xde57('0x9'),auth[_0xde57('0x5')](),controller[_0xde57('0xa')]);router[_0xde57('0x4')](_0xde57('0xb'),auth[_0xde57('0x5')](),controller['voiceQueues']);router[_0xde57('0x4')](_0xde57('0xc'),auth[_0xde57('0x5')](),controller['chatQueues']);router[_0xde57('0x4')]('/mail/queues',auth[_0xde57('0x5')](),controller[_0xde57('0xd')]);router[_0xde57('0x4')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xde57('0xe')]);router['get'](_0xde57('0xf'),auth['isAuthenticated'](),controller[_0xde57('0x10')]);router[_0xde57('0x4')]('/sms/queues',auth['isAuthenticated'](),controller[_0xde57('0x11')]);router[_0xde57('0x4')](_0xde57('0x12'),auth['isAuthenticated'](),controller[_0xde57('0x13')]);router[_0xde57('0x4')](_0xde57('0x14'),auth[_0xde57('0x5')](),controller[_0xde57('0x15')]);router[_0xde57('0x4')](_0xde57('0x16'),auth['isAuthenticated'](),controller[_0xde57('0x17')]);router['get'](_0xde57('0x18'),auth[_0xde57('0x5')](),controller[_0xde57('0x19')]);router[_0xde57('0x4')](_0xde57('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xde57('0x4')](_0xde57('0x1b'),auth[_0xde57('0x5')](),controller[_0xde57('0x1c')]);router[_0xde57('0x4')](_0xde57('0x1d'),auth['isAuthenticated'](),controller[_0xde57('0x1e')]);router[_0xde57('0x4')](_0xde57('0x1f'),auth['isAuthenticated'](),controller[_0xde57('0x20')]);router['put'](_0xde57('0x1f'),auth['isAuthenticated'](),controller[_0xde57('0x21')]);router[_0xde57('0x4')](_0xde57('0x22'),auth['isAuthenticated'](),controller[_0xde57('0x23')]);router['get']('/outbound/channels',auth[_0xde57('0x5')](),controller[_0xde57('0x24')]);router['get'](_0xde57('0x25'),auth['isAuthenticated'](),controller[_0xde57('0x26')]);router[_0xde57('0x27')]('/agents/:id/capacity',auth[_0xde57('0x5')](),controller['agentCapacity']);router['get']('/telephones',auth[_0xde57('0x5')](),controller[_0xde57('0x28')]);router['get'](_0xde57('0x29'),auth[_0xde57('0x5')](),controller[_0xde57('0x2a')]);router['get'](_0xde57('0x2b'),auth['isAuthenticated'](),controller['campaigns']);router[_0xde57('0x4')](_0xde57('0x2c'),auth[_0xde57('0x5')](),controller['faxAccounts']);router[_0xde57('0x4')](_0xde57('0x2d'),auth[_0xde57('0x5')](),controller['chatQueuesWaitingInteractions']);router[_0xde57('0x4')](_0xde57('0x2e'),auth[_0xde57('0x5')](),controller[_0xde57('0x2f')]);router[_0xde57('0x4')](_0xde57('0x30'),auth[_0xde57('0x5')](),controller[_0xde57('0x31')]);router[_0xde57('0x4')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xde57('0x32')]);router[_0xde57('0x4')]('/sms/queues/waitinginteractions',auth[_0xde57('0x5')](),controller[_0xde57('0x33')]);router[_0xde57('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0xde57('0x5')](),controller[_0xde57('0x34')]);router[_0xde57('0x4')]('/fax/queues/waitinginteractions',auth[_0xde57('0x5')](),controller[_0xde57('0x35')]);router[_0xde57('0x36')](_0xde57('0x37'),auth[_0xde57('0x5')](),controller['queueNotify'](_0xde57('0x38')));router[_0xde57('0x4')](_0xde57('0x39'),auth['isAuthenticated'](),controller[_0xde57('0x3a')]);router[_0xde57('0x36')](_0xde57('0x3b'),auth[_0xde57('0x5')](),controller[_0xde57('0x3c')](_0xde57('0x3d')));router[_0xde57('0x4')](_0xde57('0x3e'),auth[_0xde57('0x5')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0xde57('0x5')](),controller[_0xde57('0x3c')](_0xde57('0x3f')));router[_0xde57('0x4')]('/fax/queues/:id',auth[_0xde57('0x5')](),controller[_0xde57('0x40')]);router[_0xde57('0x36')](_0xde57('0x41'),auth[_0xde57('0x5')](),controller[_0xde57('0x3c')](_0xde57('0x42')));router[_0xde57('0x4')](_0xde57('0x43'),auth[_0xde57('0x5')](),controller['showOpenchannelQueues']);router[_0xde57('0x36')](_0xde57('0x44'),auth['isAuthenticated'](),controller[_0xde57('0x3c')](_0xde57('0x45')));router[_0xde57('0x36')]('/whatsapp/queues/:id/notify',auth[_0xde57('0x5')](),controller['queueNotify']('whatsapp'));router[_0xde57('0x4')](_0xde57('0x46'),auth[_0xde57('0x5')](),controller[_0xde57('0x47')]);router[_0xde57('0x4')](_0xde57('0x48'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0xde57('0x36')]('/agents/:id/notify',auth[_0xde57('0x5')](),controller[_0xde57('0x49')]);module[_0xde57('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d551e78..e2d1579 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 _0x8d0e=['merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','interface','SIP/%s','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','showChatQueues','ChatQueues','mailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','findOne','messageId','Interaction','update','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','agent','\x20Message\x20not\x20found','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','message','result','catch','json','stack','name','send','isNil','rows','voiceChannels','query','then','VoiceChannelMixMonitor'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2209a7,_0x2e8de3){_0x2209a7=_0x2209a7-0x0;var _0x23a37d=_0x8d0e[_0x2209a7];return _0x23a37d;};'use strict';var BPromise=require(_0xe8d0('0x0'));var moment=require(_0xe8d0('0x1'));var _=require(_0xe8d0('0x2'));var util=require(_0xe8d0('0x3'));var db=require(_0xe8d0('0x4'))['db'];var logger=require(_0xe8d0('0x5'))(_0xe8d0('0x6'));var jayson=require(_0xe8d0('0x7'));var amiClient=jayson[_0xe8d0('0x8')]['http']({'port':0x232a});var mailClient=jayson[_0xe8d0('0x8')]['http']({'port':0x232b});var routingClient=jayson['client'][_0xe8d0('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){var _0x1b353a=_0xcc03d0?_0xcc03d0:amiClient;return _0x1b353a[_0xe8d0('0xa')](_0x92483d,_0x469d37)['then'](function(_0x10e56c){if(_0x10e56c[_0xe8d0('0xb')]){if(_0x10e56c[_0xe8d0('0xb')]['code']===0x1f4){return _0x13aa63(_0x10e56c['error'][_0xe8d0('0xc')]);}return _0x2b6dce(_0x10e56c[_0xe8d0('0xb')][_0xe8d0('0xc')]);}else{_0x2b6dce(_0x10e56c[_0xe8d0('0xd')]);}})[_0xe8d0('0xe')](function(_0x41de69){_0x13aa63(_0x41de69);});});}function respondWithResult(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xc8;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['status'](_0x38fac0)[_0xe8d0('0xf')](_0x15b9e5);}return _0x5934b2['sendStatus'](0x194);};}function handleError(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0x1f4;return function(_0x2aa906){logger[_0xe8d0('0xb')](_0x2aa906[_0xe8d0('0x10')]);if(_0x2aa906[_0xe8d0('0x11')]){delete _0x2aa906[_0xe8d0('0x11')];}_0x59b4b7['status'](_0x90a1ea)[_0xe8d0('0x12')](_0x2aa906);};}function findById(_0x49554d){return function(_0x6d932b){if(!_[_0xe8d0('0x13')](_0x49554d)&&!_[_0xe8d0('0x13')](_0x6d932b)&&!_['isNil'](_0x6d932b['rows'])){return _['find'](_0x6d932b[_0xe8d0('0x14')],function(_0x384854){return _0x384854['id']==_0x49554d;});}return null;};}exports[_0xe8d0('0x15')]=function(_0x44bbe4,_0x83177b){return respondWithRpcPromise('VoiceChannels',_0x44bbe4[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x83177b,null))['catch'](handleError(_0x83177b,null));};exports['voiceChannelMixMonitor']=function(_0x554402,_0x384a60){return respondWithRpcPromise(_0xe8d0('0x18'),_[_0xe8d0('0x19')](_0x554402[_0xe8d0('0x16')],_0x554402[_0xe8d0('0x1a')]))[_0xe8d0('0x17')](respondWithResult(_0x384a60,null))[_0xe8d0('0xe')](handleError(_0x384a60,null));};exports[_0xe8d0('0x1b')]=function(_0x32e39a,_0x5ab4e7){return respondWithRpcPromise(_0xe8d0('0x1c'),_[_0xe8d0('0x19')](_0x32e39a['query'],_0x32e39a[_0xe8d0('0x1a')]))[_0xe8d0('0x17')](respondWithResult(_0x5ab4e7,null))[_0xe8d0('0xe')](handleError(_0x5ab4e7,null));};exports[_0xe8d0('0x1d')]=function(_0x146783,_0x149dfd){return respondWithRpcPromise(_0xe8d0('0x1e'),_0x146783[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x149dfd,null))[_0xe8d0('0xe')](handleError(_0x149dfd,null));};exports[_0xe8d0('0x1f')]=function(_0x539548,_0x24982c){return respondWithRpcPromise(_0xe8d0('0x1e'),_0x539548[_0xe8d0('0x16')])['then'](findById(_0x539548[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x24982c,null))['catch'](handleError(_0x24982c,null));};exports[_0xe8d0('0x20')]=function(_0x3ffcb7,_0x11fcf2){return respondWithRpcPromise(_0xe8d0('0x21'),_[_0xe8d0('0x19')](_0x3ffcb7['body'],_0x3ffcb7[_0xe8d0('0x1a')]))['then'](respondWithResult(_0x11fcf2,null))['catch'](handleError(_0x11fcf2,null));};exports['voiceQueuesPreview']=function(_0x547a2b,_0x13cd4c){return respondWithRpcPromise(_0xe8d0('0x22'),_['merge'](_0x547a2b['query'],_0x547a2b[_0xe8d0('0x1a')]))['then'](respondWithResult(_0x13cd4c,null))[_0xe8d0('0xe')](handleError(_0x13cd4c,null));};exports[_0xe8d0('0x23')]=function(_0x327004,_0x1b2b0a){return respondWithRpcPromise(_0xe8d0('0x24'),_0x327004['query'])[_0xe8d0('0x17')](respondWithResult(_0x1b2b0a,null))[_0xe8d0('0xe')](handleError(_0x1b2b0a,null));};exports[_0xe8d0('0x25')]=function(_0x145ddb,_0x587819){return respondWithRpcPromise(_0xe8d0('0x26'),_[_0xe8d0('0x19')](_0x145ddb['query'],_0x145ddb[_0xe8d0('0x1a')]))['then'](respondWithResult(_0x587819,null))[_0xe8d0('0xe')](handleError(_0x587819,null));};exports['voiceQueuesChannelHangup']=function(_0x197e01,_0x531835){return respondWithRpcPromise(_0xe8d0('0x27'),_[_0xe8d0('0x19')](_0x197e01[_0xe8d0('0x16')],_0x197e01[_0xe8d0('0x1a')]))['then'](respondWithResult(_0x531835,null))[_0xe8d0('0xe')](handleError(_0x531835,null));};exports[_0xe8d0('0x28')]=function(_0x20eec5,_0x516243){return respondWithRpcPromise(_0xe8d0('0x29'),_[_0xe8d0('0x19')](_0x20eec5[_0xe8d0('0x16')],_0x20eec5[_0xe8d0('0x1a')]))[_0xe8d0('0x17')](respondWithResult(_0x516243,null))['catch'](handleError(_0x516243,null));};exports[_0xe8d0('0x2a')]=function(_0x1828c5,_0x10970d){return respondWithRpcPromise(_0xe8d0('0x2b'),_0x1828c5[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x10970d,null))[_0xe8d0('0xe')](handleError(_0x10970d,null));};exports[_0xe8d0('0x2c')]=function(_0x4edb3d,_0x5dff14){return respondWithRpcPromise(_0xe8d0('0x2d'),_0x4edb3d[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x5dff14,null))[_0xe8d0('0xe')](handleError(_0x5dff14,null));};exports[_0xe8d0('0x2e')]=function(_0x585d27,_0x2e4362){var _0x4bd7a2;return respondWithRpcPromise(_0xe8d0('0x2f'),_0x585d27[_0xe8d0('0x16')])[_0xe8d0('0x17')](function(_0x48fa07){_0x4bd7a2=_0x48fa07;return respondWithRpcPromise(_0xe8d0('0x2f'),_0x585d27[_0xe8d0('0x16')],routingClient);})[_0xe8d0('0x17')](function(_0x230a90){return _[_0xe8d0('0x19')]({},_0x230a90,_0x4bd7a2);})['then'](respondWithResult(_0x2e4362,null))['catch'](handleError(_0x2e4362,null));};exports['agentCapacity']=function(_0x4cf0da,_0x14ffb6){if(_0x4cf0da['body']&&_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')]&&_0x4cf0da[_0xe8d0('0x32')]&&_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x11')]){for(var _0x1156da in _0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')]){if(_0x4cf0da['body'][_0xe8d0('0x31')][_0xe8d0('0x33')](_0x1156da)){db['MemberReport']['findAll']({'where':{'channel':_0x1156da,'membername':_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x11')],'type':_0xe8d0('0x34'),'exitAt':null,'uniqueid':_0x4cf0da['body'][_0xe8d0('0x31')][_0x1156da]&&_0x4cf0da[_0xe8d0('0x30')]['interaction'][_0x1156da][_0xe8d0('0x35')]?{'$notIn':_0x4cf0da[_0xe8d0('0x30')]['interaction'][_0x1156da]}:{'$ne':null}}})[_0xe8d0('0x17')](function(_0x23e250){var _0x1b7866=moment()[_0xe8d0('0x36')](_0xe8d0('0x37'));for(var _0x2a6760=0x0,_0x11339d=_0x23e250[_0xe8d0('0x35')];_0x2a6760<_0x11339d;_0x2a6760+=0x1){_0x23e250[_0x2a6760]['updateAttributes']({'exitAt':_0x1b7866});}});for(var _0x31a370=0x0;_0x31a370<_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')][_0x1156da][_0xe8d0('0x35')];_0x31a370+=0x1){db[_0xe8d0('0x38')][_0xe8d0('0x39')]({'where':{'channel':_0x1156da,'membername':_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x11')],'type':_0xe8d0('0x34'),'uniqueid':_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')][_0x1156da][_0x31a370],'exitAt':null},'defaults':{'channel':_0x1156da,'membername':_0x4cf0da[_0xe8d0('0x32')]['name'],'interface':_[_0xe8d0('0x13')](_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x3a')])?util[_0xe8d0('0x36')](_0xe8d0('0x3b'),_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x11')]):_0x4cf0da['user'][_0xe8d0('0x3a')],'type':_0xe8d0('0x34'),'enterAt':moment()[_0xe8d0('0x36')](_0xe8d0('0x37')),'role':'agent','internal':_0x4cf0da[_0xe8d0('0x32')]['internal'],'uniqueid':_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')][_0x1156da][_0x31a370]}});}}}}return respondWithRpcPromise(_0xe8d0('0x3c'),{'id':_0x4cf0da[_0xe8d0('0x1a')]['id'],'capacity':_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x3d')]},routingClient)[_0xe8d0('0x17')](respondWithResult(_0x14ffb6,null))['catch'](handleError(_0x14ffb6,null));};exports[_0xe8d0('0x3e')]=function(_0x55f93d,_0x581a34){return respondWithRpcPromise(_0xe8d0('0x3f'),_0x55f93d['query'])[_0xe8d0('0x17')](respondWithResult(_0x581a34,null))['catch'](handleError(_0x581a34,null));};exports[_0xe8d0('0x40')]=function(_0x28494c,_0x13713c){return respondWithRpcPromise(_0xe8d0('0x41'),_0x28494c['query'])[_0xe8d0('0x17')](respondWithResult(_0x13713c,null))[_0xe8d0('0xe')](handleError(_0x13713c,null));};exports[_0xe8d0('0x42')]=function(_0x2e3f1d,_0x18cc14){return respondWithRpcPromise('Campaigns',_0x2e3f1d[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x18cc14,null))[_0xe8d0('0xe')](handleError(_0x18cc14,null));};exports['chatQueues']=function(_0x2f4d43,_0x571c4e){return respondWithRpcPromise('ChatQueues',_0x2f4d43[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x571c4e,null))['catch'](handleError(_0x571c4e,null));};exports[_0xe8d0('0x43')]=function(_0x3a8074,_0x47893d){return respondWithRpcPromise(_0xe8d0('0x44'),_0x3a8074[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](findById(_0x3a8074[_0xe8d0('0x1a')]['id']))['then'](respondWithResult(_0x47893d,null))[_0xe8d0('0xe')](handleError(_0x47893d,null));};exports[_0xe8d0('0x45')]=function(_0x25e5ab,_0x76316a){return respondWithRpcPromise('MailQueues',_0x25e5ab[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x76316a,null))[_0xe8d0('0xe')](handleError(_0x76316a,null));};exports[_0xe8d0('0x46')]=function(_0x1a74d0,_0x29667c){return respondWithRpcPromise('MailQueues',_0x1a74d0['query'],routingClient)[_0xe8d0('0x17')](findById(_0x1a74d0['params']['id']))[_0xe8d0('0x17')](respondWithResult(_0x29667c,null))[_0xe8d0('0xe')](handleError(_0x29667c,null));};exports['mailAccounts']=function(_0x5ac1ae,_0x995163){return respondWithRpcPromise('MailAccounts',_0x5ac1ae[_0xe8d0('0x16')],mailClient)['then'](respondWithResult(_0x995163,null))[_0xe8d0('0xe')](handleError(_0x995163,null));};exports[_0xe8d0('0x47')]=function(_0x13b9f0,_0x4e2abc){return respondWithRpcPromise(_0xe8d0('0x48'),_0x13b9f0[_0xe8d0('0x16')],routingClient)['then'](respondWithResult(_0x4e2abc,null))[_0xe8d0('0xe')](handleError(_0x4e2abc,null));};exports['showOpenchannelQueues']=function(_0x3d0908,_0x4ff583){return respondWithRpcPromise(_0xe8d0('0x48'),_0x3d0908[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](findById(_0x3d0908[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x4ff583,null))['catch'](handleError(_0x4ff583,null));};exports['smsQueues']=function(_0xd7d433,_0x55a2df){return respondWithRpcPromise(_0xe8d0('0x49'),_0xd7d433[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x55a2df,null))[_0xe8d0('0xe')](handleError(_0x55a2df,null));};exports[_0xe8d0('0x4a')]=function(_0x1e806b,_0x177485){return respondWithRpcPromise(_0xe8d0('0x49'),_0x1e806b[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](findById(_0x1e806b[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x177485,null))[_0xe8d0('0xe')](handleError(_0x177485,null));};exports[_0xe8d0('0x4b')]=function(_0x22992f,_0x4a68d5){return respondWithRpcPromise(_0xe8d0('0x4c'),_0x22992f[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x4a68d5,null))[_0xe8d0('0xe')](handleError(_0x4a68d5,null));};exports[_0xe8d0('0x4d')]=function(_0x4848d4,_0x2eeb92){return respondWithRpcPromise(_0xe8d0('0x4c'),_0x4848d4[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](findById(_0x4848d4[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x2eeb92,null))[_0xe8d0('0xe')](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x4e')]=function(_0x40cb5c,_0x24be86){return respondWithRpcPromise(_0xe8d0('0x4f'),_0x40cb5c[_0xe8d0('0x16')],routingClient)['then'](respondWithResult(_0x24be86,null))['catch'](handleError(_0x24be86,null));};exports[_0xe8d0('0x50')]=function(_0x54c04f,_0x169047){return respondWithRpcPromise(_0xe8d0('0x4f'),_0x54c04f['query'],routingClient)[_0xe8d0('0x17')](findById(_0x54c04f[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x169047,null))[_0xe8d0('0xe')](handleError(_0x169047,null));};exports[_0xe8d0('0x51')]=function(_0x1b5df8,_0x473e0b){return respondWithRpcPromise(_0xe8d0('0x52'),_0x1b5df8[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x473e0b,null))[_0xe8d0('0xe')](handleError(_0x473e0b,null));};exports[_0xe8d0('0x53')]=function(_0xa0c61a,_0x2147d5){return respondWithRpcPromise(_0xe8d0('0x54'),_0xa0c61a[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x2147d5,null))[_0xe8d0('0xe')](handleError(_0x2147d5,null));};exports[_0xe8d0('0x55')]=function(_0x500fb0,_0x30ed66){return respondWithRpcPromise(_0xe8d0('0x56'),_0x500fb0[_0xe8d0('0x16')],routingClient)['then'](respondWithResult(_0x30ed66,null))[_0xe8d0('0xe')](handleError(_0x30ed66,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x31e6df,_0x1c1794){return respondWithRpcPromise(_0xe8d0('0x57'),_0x31e6df['query'],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x1c1794,null))[_0xe8d0('0xe')](handleError(_0x1c1794,null));};exports[_0xe8d0('0x58')]=function(_0x207680,_0x939184){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x207680[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](function(_0x23ba49){if(_0x207680[_0xe8d0('0x16')][_0xe8d0('0x59')]!==undefined){var _0x385a73=_(_0x23ba49[_0xe8d0('0x14')])[_0xe8d0('0x5a')]([_0x207680['query'][_0xe8d0('0x59')],_0x207680[_0xe8d0('0x1a')]['id']])[_0xe8d0('0x5b')](_0xe8d0('0x5c'))['uniq']()[_0xe8d0('0x5d')]();return _0x23ba49[_0xe8d0('0x14')][_0xe8d0('0x5a')](function(_0x575730){return _0x385a73[_0xe8d0('0x5e')](_0x575730['queue_id'])>-0x1;});}else{return _0x23ba49[_0xe8d0('0x14')]['filter'](function(_0x25bc77){return _0x25bc77[_0xe8d0('0x5c')]===parseInt(_0x207680[_0xe8d0('0x1a')]['id']);});}})[_0xe8d0('0x17')](respondWithResult(_0x939184,null))[_0xe8d0('0xe')](handleError(_0x939184,null));};exports[_0xe8d0('0x5f')]=function(_0x17fbdc,_0x3f5c69){return respondWithRpcPromise(_0xe8d0('0x60'),_0x17fbdc[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x3f5c69,null))[_0xe8d0('0xe')](handleError(_0x3f5c69,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x20e4ff,_0x1fa61e){return respondWithRpcPromise(_0xe8d0('0x61'),_0x20e4ff[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x1fa61e,null))[_0xe8d0('0xe')](handleError(_0x1fa61e,null));};exports[_0xe8d0('0x62')]=function(_0x605b5f,_0x2f9702){return respondWithRpcPromise(_0xe8d0('0x63'),_0x605b5f['query'],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x2f9702,null))[_0xe8d0('0xe')](handleError(_0x2f9702,null));};exports[_0xe8d0('0x64')]=function(_0xebc89e){return function(_0x255e4b,_0x550fe6){var _0x4c4ff0,_0xca752a;var _0x5c8c7d=_[_0xe8d0('0x65')](_0xebc89e);var _0x16098b=_0xebc89e===_0xe8d0('0x66')?'Website':_0xe8d0('0x67');return db[_0x5c8c7d+'Queue'][_0xe8d0('0x68')]({'raw':!![],'where':{'id':_0x255e4b[_0xe8d0('0x1a')]['id']}})[_0xe8d0('0x17')](function(_0x1a04a6){if(_[_0xe8d0('0x13')](_0x1a04a6)){throw new Error(_0x5c8c7d+'\x20Queue\x20not\x20found');}_0x4c4ff0=_0x1a04a6;return db[_0x5c8c7d+'Message'][_0xe8d0('0x68')]({'where':{'id':_0x255e4b[_0xe8d0('0x30')][_0xe8d0('0x69')]},'include':[{'model':db[_0x5c8c7d+_0xe8d0('0x6a')],'as':_0xe8d0('0x6a')},{'model':db[_0x5c8c7d+_0x16098b],'as':_0xe8d0('0x67')}]});})[_0xe8d0('0x17')](function(_0x1ff1cc){if(_[_0xe8d0('0x13')](_0x1ff1cc)){throw new Error(_0x5c8c7d+'\x20Message\x20not\x20found');}_0xca752a=_0x1ff1cc;return _0x1ff1cc[_0xe8d0('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe8d0('0x17')](function(){var _0x142db4={'uniqueid':_0xebc89e+'.'+_0xca752a['id']+'.'+_0xca752a[_0xe8d0('0x6a')]['id'],'FromUserId':_0x255e4b['user']['id'],'type':'queue'};_0x142db4[_0x5c8c7d+_0xe8d0('0x6c')]=_0xca752a['id'];_0x142db4[_0x5c8c7d+_0xe8d0('0x6d')]=_0xca752a[_0xe8d0('0x6a')]['id'];_0x142db4[_0xe8d0('0x6e')+_0x5c8c7d+_0x16098b+'Id']=_0xca752a[_0xe8d0('0x67')]['id'];_0x142db4['To'+_0x5c8c7d+_0xe8d0('0x6f')]=_0x4c4ff0['id'];return db[_0x5c8c7d+_0xe8d0('0x70')][_0xe8d0('0x71')](_0x142db4);})[_0xe8d0('0x17')](function(){return respondWithRpcPromise(_0xe8d0('0x72'),{'channel':_0xebc89e,'interaction':_0xca752a['Interaction'],'message':_0xca752a,'account':_0xca752a[_0xe8d0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe8d0('0x73'),'appdata':_0x4c4ff0[_0xe8d0('0x11')]+','+(_0xca752a[_0xe8d0('0x67')][_0xe8d0('0x74')]||0x12c),'interval':_0xe8d0('0x75')}]},routingClient);})[_0xe8d0('0x17')](respondWithResult(_0x550fe6,null))[_0xe8d0('0xe')](handleError(_0x550fe6,null));};};exports[_0xe8d0('0x76')]=function(_0x47bdc2,_0x52aece){var _0x2e11fc,_0x38e83f;if(_['isNil'](_0x47bdc2[_0xe8d0('0x30')][_0xe8d0('0x77')])){throw new Error(_0xe8d0('0x78'));}var _0x499efb=_0x47bdc2[_0xe8d0('0x30')][_0xe8d0('0x77')];var _0x233a5a=_[_0xe8d0('0x65')](_0x499efb);var _0x55588a=_0x499efb==='chat'?_0xe8d0('0x79'):_0xe8d0('0x67');return db['User']['findOne']({'raw':!![],'where':{'id':_0x47bdc2[_0xe8d0('0x1a')]['id'],'role':_0xe8d0('0x7a')}})[_0xe8d0('0x17')](function(_0x5eaf13){if(_[_0xe8d0('0x13')](_0x5eaf13)){throw new Error('Agent\x20not\x20found');}_0x2e11fc=_0x5eaf13;return db[_0x233a5a+'Message'][_0xe8d0('0x68')]({'where':{'id':_0x47bdc2[_0xe8d0('0x30')][_0xe8d0('0x69')]},'include':[{'model':db[_0x233a5a+_0xe8d0('0x6a')],'as':_0xe8d0('0x6a')},{'model':db[_0x233a5a+_0x55588a],'as':'Account'}]});})[_0xe8d0('0x17')](function(_0x455614){if(_['isNil'](_0x455614)){throw new Error(_0x233a5a+_0xe8d0('0x7b'));}_0x38e83f=_0x455614;return _0x455614[_0xe8d0('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe8d0('0x17')](function(){var _0x3e18af={'uniqueid':_0x499efb+'.'+_0x38e83f['id']+'.'+_0x38e83f['Interaction']['id'],'FromUserId':_0x47bdc2[_0xe8d0('0x32')]['id'],'type':_0xe8d0('0x73'),'ToUserId':_0x2e11fc['id']};_0x3e18af[_0x233a5a+_0xe8d0('0x6c')]=_0x38e83f['id'];_0x3e18af[_0x233a5a+_0xe8d0('0x6d')]=_0x38e83f[_0xe8d0('0x6a')]['id'];_0x3e18af[_0xe8d0('0x6e')+_0x233a5a+_0x55588a+'Id']=_0x38e83f[_0xe8d0('0x67')]['id'];return db[_0x233a5a+_0xe8d0('0x70')]['create'](_0x3e18af);})[_0xe8d0('0x17')](function(){return respondWithRpcPromise(_0xe8d0('0x72'),{'channel':_0x499efb,'interaction':_0x38e83f['Interaction'],'message':_0x38e83f,'account':_0x38e83f['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2e11fc['name']+','+(_0x38e83f[_0xe8d0('0x67')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe8d0('0x17')](respondWithResult(_0x52aece,null))['catch'](handleError(_0x52aece,null));}; \ No newline at end of file +var _0xdbf5=['SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','Account','QueueId','TransferReport','create','agentNotify','Website','Agent\x20not\x20found','MessageId','Start','moment','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','catch','status','json','stack','name','send','isNil','rows','find','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','query','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','interaction','user','MemberReport','findAll','INTERACTION','length','findOrCreate','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xa1f728,_0x5d4491){_0xa1f728=_0xa1f728-0x0;var _0x1d65d4=_0xdbf5[_0xa1f728];return _0x1d65d4;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5dbf('0x0'));var _=require('lodash');var util=require('util');var db=require(_0x5dbf('0x1'))['db'];var logger=require(_0x5dbf('0x2'))(_0x5dbf('0x3'));var jayson=require(_0x5dbf('0x4'));var amiClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232a});var mailClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232b});var routingClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){var _0x501cb1=_0x93e657?_0x93e657:amiClient;return _0x501cb1[_0x5dbf('0x7')](_0x209b7d,_0x88128e)[_0x5dbf('0x8')](function(_0x264007){if(_0x264007[_0x5dbf('0x9')]){if(_0x264007['error'][_0x5dbf('0xa')]===0x1f4){return _0x134810(_0x264007['error']['message']);}return _0x52b039(_0x264007[_0x5dbf('0x9')]['message']);}else{_0x52b039(_0x264007['result']);}})[_0x5dbf('0xb')](function(_0x490b38){_0x134810(_0x490b38);});});}function respondWithResult(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xc8;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0xc')](_0x2bb7ed)[_0x5dbf('0xd')](_0x1453a9);}return _0x182cec['sendStatus'](0x194);};}function handleError(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0x1f4;return function(_0x3480c8){logger['error'](_0x3480c8[_0x5dbf('0xe')]);if(_0x3480c8[_0x5dbf('0xf')]){delete _0x3480c8[_0x5dbf('0xf')];}_0x4803ca[_0x5dbf('0xc')](_0x2b4e1c)[_0x5dbf('0x10')](_0x3480c8);};}function findById(_0x472eb9){return function(_0x2d32cc){if(!_['isNil'](_0x472eb9)&&!_['isNil'](_0x2d32cc)&&!_[_0x5dbf('0x11')](_0x2d32cc[_0x5dbf('0x12')])){return _[_0x5dbf('0x13')](_0x2d32cc[_0x5dbf('0x12')],function(_0x20c2b0){return _0x20c2b0['id']==_0x472eb9;});}return null;};}exports['voiceChannels']=function(_0x11cd00,_0x4dd03c){return respondWithRpcPromise('VoiceChannels',_0x11cd00['query'])[_0x5dbf('0x8')](respondWithResult(_0x4dd03c,null))[_0x5dbf('0xb')](handleError(_0x4dd03c,null));};exports[_0x5dbf('0x14')]=function(_0x2ab57c,_0x1e3cce){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x5dbf('0x15')](_0x2ab57c['query'],_0x2ab57c[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x1e3cce,null))[_0x5dbf('0xb')](handleError(_0x1e3cce,null));};exports[_0x5dbf('0x17')]=function(_0x3b763c,_0x2f154e){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x5dbf('0x15')](_0x3b763c[_0x5dbf('0x18')],_0x3b763c[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x2f154e,null))[_0x5dbf('0xb')](handleError(_0x2f154e,null));};exports[_0x5dbf('0x19')]=function(_0x290456,_0x20ab1b){return respondWithRpcPromise(_0x5dbf('0x1a'),_0x290456[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x20ab1b,null))[_0x5dbf('0xb')](handleError(_0x20ab1b,null));};exports[_0x5dbf('0x1b')]=function(_0x407741,_0x729d8f){return respondWithRpcPromise(_0x5dbf('0x1a'),_0x407741[_0x5dbf('0x18')])[_0x5dbf('0x8')](findById(_0x407741[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x729d8f,null))[_0x5dbf('0xb')](handleError(_0x729d8f,null));};exports[_0x5dbf('0x1c')]=function(_0x21cd00,_0x5768b7){return respondWithRpcPromise(_0x5dbf('0x1d'),_[_0x5dbf('0x15')](_0x21cd00[_0x5dbf('0x1e')],_0x21cd00[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x5768b7,null))[_0x5dbf('0xb')](handleError(_0x5768b7,null));};exports[_0x5dbf('0x1f')]=function(_0x31d57a,_0x406ce6){return respondWithRpcPromise(_0x5dbf('0x20'),_[_0x5dbf('0x15')](_0x31d57a['query'],_0x31d57a['params']))[_0x5dbf('0x8')](respondWithResult(_0x406ce6,null))[_0x5dbf('0xb')](handleError(_0x406ce6,null));};exports[_0x5dbf('0x21')]=function(_0x3b73ad,_0x37cf25){return respondWithRpcPromise('VoiceQueuesChannels',_0x3b73ad['query'])[_0x5dbf('0x8')](respondWithResult(_0x37cf25,null))[_0x5dbf('0xb')](handleError(_0x37cf25,null));};exports['voiceQueuesChannel']=function(_0x3531a2,_0x2a0491){return respondWithRpcPromise(_0x5dbf('0x22'),_[_0x5dbf('0x15')](_0x3531a2[_0x5dbf('0x18')],_0x3531a2['params']))[_0x5dbf('0x8')](respondWithResult(_0x2a0491,null))[_0x5dbf('0xb')](handleError(_0x2a0491,null));};exports[_0x5dbf('0x23')]=function(_0x273577,_0x3a8196){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x5dbf('0x15')](_0x273577[_0x5dbf('0x18')],_0x273577[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x3a8196,null))['catch'](handleError(_0x3a8196,null));};exports[_0x5dbf('0x24')]=function(_0x1e9a4e,_0x302dda){return respondWithRpcPromise(_0x5dbf('0x25'),_[_0x5dbf('0x15')](_0x1e9a4e[_0x5dbf('0x18')],_0x1e9a4e[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x302dda,null))[_0x5dbf('0xb')](handleError(_0x302dda,null));};exports[_0x5dbf('0x26')]=function(_0x1ba835,_0x51c667){return respondWithRpcPromise(_0x5dbf('0x27'),_0x1ba835[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x51c667,null))['catch'](handleError(_0x51c667,null));};exports[_0x5dbf('0x28')]=function(_0x43954b,_0x2e4e67){return respondWithRpcPromise('OutboundChannels',_0x43954b[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x2e4e67,null))[_0x5dbf('0xb')](handleError(_0x2e4e67,null));};exports['agents']=function(_0x4527fb,_0x29a62d){var _0x2ac162;return respondWithRpcPromise(_0x5dbf('0x29'),_0x4527fb[_0x5dbf('0x18')])[_0x5dbf('0x8')](function(_0x321ae3){_0x2ac162=_0x321ae3;return respondWithRpcPromise(_0x5dbf('0x29'),_0x4527fb['query'],routingClient);})['then'](function(_0x57ee72){return _['merge']({},_0x57ee72,_0x2ac162);})[_0x5dbf('0x8')](respondWithResult(_0x29a62d,null))[_0x5dbf('0xb')](handleError(_0x29a62d,null));};exports['agentCapacity']=function(_0x3ef0eb,_0x229abf){if(_0x3ef0eb['body']&&_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]&&_0x3ef0eb[_0x5dbf('0x2b')]&&_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')]){for(var _0x7c390d in _0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]){if(_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]['hasOwnProperty'](_0x7c390d)){db[_0x5dbf('0x2c')][_0x5dbf('0x2d')]({'where':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')]['name'],'type':_0x5dbf('0x2e'),'exitAt':null,'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')][_0x7c390d]&&_0x3ef0eb[_0x5dbf('0x1e')]['interaction'][_0x7c390d][_0x5dbf('0x2f')]?{'$notIn':_0x3ef0eb['body'][_0x5dbf('0x2a')][_0x7c390d]}:{'$ne':null}}})[_0x5dbf('0x8')](function(_0x2d046b){var _0xcc1815=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x118ae6=0x0,_0x43f5e8=_0x2d046b[_0x5dbf('0x2f')];_0x118ae6<_0x43f5e8;_0x118ae6+=0x1){_0x2d046b[_0x118ae6]['updateAttributes']({'exitAt':_0xcc1815});}});for(var _0x2e241d=0x0;_0x2e241d<_0x3ef0eb['body']['interaction'][_0x7c390d]['length'];_0x2e241d+=0x1){db['MemberReport'][_0x5dbf('0x30')]({'where':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')]['name'],'type':_0x5dbf('0x2e'),'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')]['interaction'][_0x7c390d][_0x2e241d],'exitAt':null},'defaults':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')],'interface':_['isNil'](_0x3ef0eb[_0x5dbf('0x2b')]['interface'])?util['format'](_0x5dbf('0x31'),_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')]):_0x3ef0eb['user']['interface'],'type':_0x5dbf('0x2e'),'enterAt':moment()[_0x5dbf('0x32')](_0x5dbf('0x33')),'role':_0x5dbf('0x34'),'internal':_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0x35')],'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')][_0x7c390d][_0x2e241d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3ef0eb[_0x5dbf('0x16')]['id'],'capacity':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x36')]},routingClient)[_0x5dbf('0x8')](respondWithResult(_0x229abf,null))[_0x5dbf('0xb')](handleError(_0x229abf,null));};exports[_0x5dbf('0x37')]=function(_0x328dc5,_0x59f825){return respondWithRpcPromise(_0x5dbf('0x38'),_0x328dc5['query'])[_0x5dbf('0x8')](respondWithResult(_0x59f825,null))[_0x5dbf('0xb')](handleError(_0x59f825,null));};exports[_0x5dbf('0x39')]=function(_0x770c54,_0x78ab84){return respondWithRpcPromise(_0x5dbf('0x3a'),_0x770c54[_0x5dbf('0x18')])['then'](respondWithResult(_0x78ab84,null))['catch'](handleError(_0x78ab84,null));};exports['campaigns']=function(_0x1e1876,_0xfdacc7){return respondWithRpcPromise(_0x5dbf('0x3b'),_0x1e1876['query'])['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0xb')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x3c')]=function(_0x344df5,_0x5d70cc){return respondWithRpcPromise(_0x5dbf('0x3d'),_0x344df5['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x5d70cc,null))[_0x5dbf('0xb')](handleError(_0x5d70cc,null));};exports[_0x5dbf('0x3e')]=function(_0x5da14b,_0x55fd51){return respondWithRpcPromise(_0x5dbf('0x3d'),_0x5da14b[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x5da14b[_0x5dbf('0x16')]['id']))['then'](respondWithResult(_0x55fd51,null))[_0x5dbf('0xb')](handleError(_0x55fd51,null));};exports[_0x5dbf('0x3f')]=function(_0x478cc1,_0x5485f3){return respondWithRpcPromise(_0x5dbf('0x40'),_0x478cc1[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x5485f3,null))[_0x5dbf('0xb')](handleError(_0x5485f3,null));};exports[_0x5dbf('0x41')]=function(_0x4711d5,_0x50a029){return respondWithRpcPromise(_0x5dbf('0x40'),_0x4711d5['query'],routingClient)['then'](findById(_0x4711d5['params']['id']))[_0x5dbf('0x8')](respondWithResult(_0x50a029,null))['catch'](handleError(_0x50a029,null));};exports[_0x5dbf('0x42')]=function(_0x275c1d,_0x1c60ac){return respondWithRpcPromise(_0x5dbf('0x43'),_0x275c1d[_0x5dbf('0x18')],mailClient)[_0x5dbf('0x8')](respondWithResult(_0x1c60ac,null))[_0x5dbf('0xb')](handleError(_0x1c60ac,null));};exports[_0x5dbf('0x44')]=function(_0x2c84d6,_0x1d91de){return respondWithRpcPromise(_0x5dbf('0x45'),_0x2c84d6[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x1d91de,null))[_0x5dbf('0xb')](handleError(_0x1d91de,null));};exports[_0x5dbf('0x46')]=function(_0x53ab1a,_0x3fbc3d){return respondWithRpcPromise('OpenchannelQueues',_0x53ab1a[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x53ab1a[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x3fbc3d,null))['catch'](handleError(_0x3fbc3d,null));};exports[_0x5dbf('0x47')]=function(_0x1ade34,_0x4362c6){return respondWithRpcPromise(_0x5dbf('0x48'),_0x1ade34[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x4362c6,null))['catch'](handleError(_0x4362c6,null));};exports[_0x5dbf('0x49')]=function(_0x3e5a96,_0x3b0465){return respondWithRpcPromise(_0x5dbf('0x48'),_0x3e5a96[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x3e5a96[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x3b0465,null))[_0x5dbf('0xb')](handleError(_0x3b0465,null));};exports[_0x5dbf('0x4a')]=function(_0x13c8ab,_0x2997a8){return respondWithRpcPromise('WhatsappQueues',_0x13c8ab['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x2997a8,null))[_0x5dbf('0xb')](handleError(_0x2997a8,null));};exports[_0x5dbf('0x4b')]=function(_0x110713,_0xc000ee){return respondWithRpcPromise(_0x5dbf('0x4c'),_0x110713[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x110713[_0x5dbf('0x16')]['id']))['then'](respondWithResult(_0xc000ee,null))['catch'](handleError(_0xc000ee,null));};exports['faxQueues']=function(_0x4f4aa3,_0x408b51){return respondWithRpcPromise(_0x5dbf('0x4d'),_0x4f4aa3[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x408b51,null))[_0x5dbf('0xb')](handleError(_0x408b51,null));};exports[_0x5dbf('0x4e')]=function(_0x5331ff,_0x5bb990){return respondWithRpcPromise(_0x5dbf('0x4d'),_0x5331ff[_0x5dbf('0x18')],routingClient)['then'](findById(_0x5331ff[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x5bb990,null))[_0x5dbf('0xb')](handleError(_0x5bb990,null));};exports[_0x5dbf('0x4f')]=function(_0x569d9c,_0x431f08){return respondWithRpcPromise(_0x5dbf('0x50'),_0x569d9c[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x431f08,null))[_0x5dbf('0xb')](handleError(_0x431f08,null));};exports['chatQueuesWaitingInteractions']=function(_0x42478c,_0x3fce29){return respondWithRpcPromise(_0x5dbf('0x51'),_0x42478c[_0x5dbf('0x18')],routingClient)['then'](respondWithResult(_0x3fce29,null))[_0x5dbf('0xb')](handleError(_0x3fce29,null));};exports['mailQueuesWaitingInteractions']=function(_0x2ba37f,_0x118e56){return respondWithRpcPromise(_0x5dbf('0x52'),_0x2ba37f['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x118e56,null))[_0x5dbf('0xb')](handleError(_0x118e56,null));};exports[_0x5dbf('0x53')]=function(_0x1270f3,_0x50db0b){return respondWithRpcPromise(_0x5dbf('0x54'),_0x1270f3[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x50db0b,null))[_0x5dbf('0xb')](handleError(_0x50db0b,null));};exports[_0x5dbf('0x55')]=function(_0xf84095,_0x560d62){return respondWithRpcPromise(_0x5dbf('0x54'),_0xf84095[_0x5dbf('0x18')],routingClient)['then'](function(_0x30469c){if(_0xf84095[_0x5dbf('0x18')][_0x5dbf('0x56')]!==undefined){var _0x3457de=_(_0x30469c[_0x5dbf('0x12')])[_0x5dbf('0x57')]([_0xf84095[_0x5dbf('0x18')][_0x5dbf('0x56')],_0xf84095[_0x5dbf('0x16')]['id']])[_0x5dbf('0x58')](_0x5dbf('0x59'))[_0x5dbf('0x5a')]()[_0x5dbf('0x5b')]();return _0x30469c[_0x5dbf('0x12')][_0x5dbf('0x57')](function(_0x37c1a3){return _0x3457de['indexOf'](_0x37c1a3[_0x5dbf('0x59')])>-0x1;});}else{return _0x30469c[_0x5dbf('0x12')][_0x5dbf('0x57')](function(_0x2e7115){return _0x2e7115['queue_id']===parseInt(_0xf84095[_0x5dbf('0x16')]['id']);});}})[_0x5dbf('0x8')](respondWithResult(_0x560d62,null))[_0x5dbf('0xb')](handleError(_0x560d62,null));};exports[_0x5dbf('0x5c')]=function(_0x1ccdae,_0x525930){return respondWithRpcPromise(_0x5dbf('0x5d'),_0x1ccdae[_0x5dbf('0x18')],routingClient)['then'](respondWithResult(_0x525930,null))['catch'](handleError(_0x525930,null));};exports[_0x5dbf('0x5e')]=function(_0x39c0a7,_0x1efe3f){return respondWithRpcPromise(_0x5dbf('0x5f'),_0x39c0a7[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x1efe3f,null))[_0x5dbf('0xb')](handleError(_0x1efe3f,null));};exports['faxQueuesWaitingInteractions']=function(_0x310078,_0x3b01c0){return respondWithRpcPromise(_0x5dbf('0x60'),_0x310078[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x3b01c0,null))[_0x5dbf('0xb')](handleError(_0x3b01c0,null));};exports['queueNotify']=function(_0x625875){return function(_0x2a0c11,_0x43ca42){var _0x2c5a6e,_0x255ab0;var _0x5a27d2=_[_0x5dbf('0x61')](_0x625875);var _0x550bd1=_0x625875==='chat'?'Website':'Account';return db[_0x5a27d2+_0x5dbf('0x62')][_0x5dbf('0x63')]({'raw':!![],'where':{'id':_0x2a0c11[_0x5dbf('0x16')]['id']}})[_0x5dbf('0x8')](function(_0x4333db){if(_['isNil'](_0x4333db)){throw new Error(_0x5a27d2+'\x20Queue\x20not\x20found');}_0x2c5a6e=_0x4333db;return db[_0x5a27d2+_0x5dbf('0x64')]['findOne']({'where':{'id':_0x2a0c11[_0x5dbf('0x1e')][_0x5dbf('0x65')]},'include':[{'model':db[_0x5a27d2+'Interaction'],'as':_0x5dbf('0x66')},{'model':db[_0x5a27d2+_0x550bd1],'as':'Account'}]});})[_0x5dbf('0x8')](function(_0x24d90a){if(_[_0x5dbf('0x11')](_0x24d90a)){throw new Error(_0x5a27d2+_0x5dbf('0x67'));}_0x255ab0=_0x24d90a;return _0x24d90a[_0x5dbf('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x22b520={'uniqueid':_0x625875+'.'+_0x255ab0['id']+'.'+_0x255ab0[_0x5dbf('0x66')]['id'],'FromUserId':_0x2a0c11[_0x5dbf('0x2b')]['id'],'type':_0x5dbf('0x69')};_0x22b520[_0x5a27d2+'MessageId']=_0x255ab0['id'];_0x22b520[_0x5a27d2+_0x5dbf('0x6a')]=_0x255ab0[_0x5dbf('0x66')]['id'];_0x22b520[_0x5dbf('0x6b')+_0x5a27d2+_0x550bd1+'Id']=_0x255ab0[_0x5dbf('0x6c')]['id'];_0x22b520['To'+_0x5a27d2+_0x5dbf('0x6d')]=_0x2c5a6e['id'];return db[_0x5a27d2+_0x5dbf('0x6e')][_0x5dbf('0x6f')](_0x22b520);})[_0x5dbf('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x625875,'interaction':_0x255ab0['Interaction'],'message':_0x255ab0,'account':_0x255ab0[_0x5dbf('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5dbf('0x69'),'appdata':_0x2c5a6e[_0x5dbf('0xf')]+','+(_0x255ab0['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5dbf('0x8')](respondWithResult(_0x43ca42,null))[_0x5dbf('0xb')](handleError(_0x43ca42,null));};};exports[_0x5dbf('0x70')]=function(_0x4713b4,_0x12757d){var _0x13fcf5,_0x5ba5bb;if(_[_0x5dbf('0x11')](_0x4713b4[_0x5dbf('0x1e')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x289cc1=_0x4713b4['body']['channel'];var _0x3a27c4=_[_0x5dbf('0x61')](_0x289cc1);var _0x3722b9=_0x289cc1==='chat'?_0x5dbf('0x71'):_0x5dbf('0x6c');return db['User'][_0x5dbf('0x63')]({'raw':!![],'where':{'id':_0x4713b4[_0x5dbf('0x16')]['id'],'role':_0x5dbf('0x34')}})[_0x5dbf('0x8')](function(_0x7957cb){if(_[_0x5dbf('0x11')](_0x7957cb)){throw new Error(_0x5dbf('0x72'));}_0x13fcf5=_0x7957cb;return db[_0x3a27c4+_0x5dbf('0x64')]['findOne']({'where':{'id':_0x4713b4['body']['messageId']},'include':[{'model':db[_0x3a27c4+_0x5dbf('0x66')],'as':_0x5dbf('0x66')},{'model':db[_0x3a27c4+_0x3722b9],'as':_0x5dbf('0x6c')}]});})[_0x5dbf('0x8')](function(_0x400d98){if(_[_0x5dbf('0x11')](_0x400d98)){throw new Error(_0x3a27c4+_0x5dbf('0x67'));}_0x5ba5bb=_0x400d98;return _0x400d98[_0x5dbf('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5dbf('0x8')](function(){var _0x990814={'uniqueid':_0x289cc1+'.'+_0x5ba5bb['id']+'.'+_0x5ba5bb['Interaction']['id'],'FromUserId':_0x4713b4[_0x5dbf('0x2b')]['id'],'type':_0x5dbf('0x69'),'ToUserId':_0x13fcf5['id']};_0x990814[_0x3a27c4+_0x5dbf('0x73')]=_0x5ba5bb['id'];_0x990814[_0x3a27c4+_0x5dbf('0x6a')]=_0x5ba5bb[_0x5dbf('0x66')]['id'];_0x990814[_0x5dbf('0x6b')+_0x3a27c4+_0x3722b9+'Id']=_0x5ba5bb[_0x5dbf('0x6c')]['id'];return db[_0x3a27c4+_0x5dbf('0x6e')]['create'](_0x990814);})['then'](function(){return respondWithRpcPromise(_0x5dbf('0x74'),{'channel':_0x289cc1,'interaction':_0x5ba5bb['Interaction'],'message':_0x5ba5bb,'account':_0x5ba5bb['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x5dbf('0x34'),'appdata':_0x13fcf5['name']+','+(_0x5ba5bb['Account']['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5dbf('0x8')](respondWithResult(_0x12757d,null))['catch'](handleError(_0x12757d,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 66d699d..d41145c 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 _0x10af=['../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','put','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x10af,0x185));var _0xf10a=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x10af[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0xf10a('0x0'));var util=require(_0xf10a('0x1'));var path=require(_0xf10a('0x2'));var timeout=require('connect-timeout');var express=require(_0xf10a('0x3'));var router=express[_0xf10a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf10a('0x5'));var interaction=require(_0xf10a('0x6'));var config=require(_0xf10a('0x7'));var controller=require(_0xf10a('0x8'));router[_0xf10a('0x9')]('/',auth[_0xf10a('0xa')](),controller['index']);router[_0xf10a('0x9')](_0xf10a('0xb'),auth[_0xf10a('0xa')](),controller[_0xf10a('0xc')]);router[_0xf10a('0x9')](_0xf10a('0xd'),auth[_0xf10a('0xa')](),controller[_0xf10a('0xe')]);router['post']('/',auth[_0xf10a('0xa')](),controller['create']);router[_0xf10a('0xf')](_0xf10a('0xb'),auth[_0xf10a('0xa')](),controller['update']);router[_0xf10a('0x10')](_0xf10a('0xb'),auth[_0xf10a('0xa')](),controller['destroy']);module[_0xf10a('0x11')]=router; \ No newline at end of file +var _0xad6d=['delete','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/run','run','create','put','update'];(function(_0x4f5bdf,_0x11b1e2){var _0x2218d1=function(_0x15c84f){while(--_0x15c84f){_0x4f5bdf['push'](_0x4f5bdf['shift']());}};_0x2218d1(++_0x11b1e2);}(_0xad6d,0x78));var _0xdad6=function(_0x1ebeae,_0xbc413a){_0x1ebeae=_0x1ebeae-0x0;var _0x3a83c4=_0xad6d[_0x1ebeae];return _0x3a83c4;};'use strict';var multer=require('multer');var util=require(_0xdad6('0x0'));var path=require('path');var timeout=require(_0xdad6('0x1'));var express=require(_0xdad6('0x2'));var router=express[_0xdad6('0x3')]();var fs_extra=require(_0xdad6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdad6('0x5'));var config=require(_0xdad6('0x6'));var controller=require('./schedule.controller');router[_0xdad6('0x7')]('/',auth[_0xdad6('0x8')](),controller['index']);router[_0xdad6('0x7')](_0xdad6('0x9'),auth['isAuthenticated'](),controller[_0xdad6('0xa')]);router['get'](_0xdad6('0xb'),auth[_0xdad6('0x8')](),controller[_0xdad6('0xc')]);router['post']('/',auth[_0xdad6('0x8')](),controller[_0xdad6('0xd')]);router[_0xdad6('0xe')](_0xdad6('0x9'),auth[_0xdad6('0x8')](),controller[_0xdad6('0xf')]);router[_0xdad6('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 6a33e25..95ede65 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 _0x5c55=['TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','default'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x5c55,0x10b));var _0x55c5=function(_0xd6fcb5,_0x526523){_0xd6fcb5=_0xd6fcb5-0x0;var _0x278ac7=_0x5c55[_0xd6fcb5];return _0x278ac7;};'use strict';var Sequelize=require(_0x55c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x55c5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x55c5('0x1')]},'active':{'type':Sequelize[_0x55c5('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x55c5('0x1')],'allowNull':![],'defaultValue':_0x55c5('0x3')},'startAt':{'type':Sequelize[_0x55c5('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x55c5('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x55c5('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x55c5('0x6')](_0x55c5('0x7'),_0x55c5('0x8'),_0x55c5('0x9'),_0x55c5('0xa'),_0x55c5('0xb'),_0x55c5('0xc'),_0x55c5('0xd')),'allowNull':![],'defaultValue':_0x55c5('0xb')},'output':{'type':Sequelize[_0x55c5('0x6')](_0x55c5('0xe'),_0x55c5('0xf'),_0x55c5('0x10')),'allowNull':![],'defaultValue':_0x55c5('0xe')},'type':{'type':Sequelize[_0x55c5('0x6')]('custom',_0x55c5('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x55c5('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x55c5('0x1')]},'cc':{'type':Sequelize[_0x55c5('0x12')]},'bcc':{'type':Sequelize[_0x55c5('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x55c5('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd1cf=['default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','weeks','days','hours','csv','custom'];(function(_0xe40d82,_0x528005){var _0xe20444=function(_0x5b4f73){while(--_0x5b4f73){_0xe40d82['push'](_0xe40d82['shift']());}};_0xe20444(++_0x528005);}(_0xd1cf,0x1e2));var _0xfd1c=function(_0x1c0f3d,_0x55a9e2){_0x1c0f3d=_0x1c0f3d-0x0;var _0x4d71a8=_0xd1cf[_0x1c0f3d];return _0x4d71a8;};'use strict';var Sequelize=require(_0xfd1c('0x0'));module[_0xfd1c('0x1')]={'name':{'type':Sequelize[_0xfd1c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xfd1c('0x2')]},'active':{'type':Sequelize[_0xfd1c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xfd1c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xfd1c('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xfd1c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfd1c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfd1c('0x6')](_0xfd1c('0x7'),'quarters','months',_0xfd1c('0x8'),_0xfd1c('0x9'),_0xfd1c('0xa'),'minutes'),'allowNull':![],'defaultValue':_0xfd1c('0x9')},'output':{'type':Sequelize['ENUM'](_0xfd1c('0xb'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xfd1c('0xb')},'type':{'type':Sequelize[_0xfd1c('0x6')](_0xfd1c('0xc'),_0xfd1c('0xd')),'allowNull':![],'defaultValue':_0xfd1c('0xc')},'sendMail':{'type':Sequelize[_0xfd1c('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xfd1c('0xe')]},'bcc':{'type':Sequelize[_0xfd1c('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xfd1c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f73ef3c..f15c63e 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 _0x37f8=['set','json','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','Schedule','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','body','run','../../config/schedule','eml-format','rimraf','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x37f8,0x88));var _0x837f=function(_0x424ef5,_0x29a698){_0x424ef5=_0x424ef5-0x0;var _0x56bdb6=_0x37f8[_0x424ef5];return _0x56bdb6;};'use strict';var emlformat=require(_0x837f('0x0'));var rimraf=require(_0x837f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x837f('0x2'));var moment=require(_0x837f('0x3'));var BPromise=require(_0x837f('0x4'));var Mustache=require('mustache');var util=require(_0x837f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x837f('0x6'));var ejs=require(_0x837f('0x7'));var fs=require('fs');var fs_extra=require(_0x837f('0x8'));var _=require(_0x837f('0x9'));var squel=require('squel');var crypto=require(_0x837f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x837f('0xb'));var toCsv=require(_0x837f('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x837f('0xc'));var authService=require(_0x837f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x837f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x837f('0xf'))(_0x837f('0x10'));var utils=require('../../config/utils');var config=require(_0x837f('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x837f('0x12'))['db'];function respondWithStatusCode(_0x50b8bd,_0x5035b6){_0x5035b6=_0x5035b6||0xcc;return function(_0x3ff9f8){if(_0x3ff9f8){return _0x50b8bd[_0x837f('0x13')](_0x5035b6);}return _0x50b8bd[_0x837f('0x14')](_0x5035b6)[_0x837f('0x15')]();};}function respondWithResult(_0x5d8922,_0x4903b8){_0x4903b8=_0x4903b8||0xc8;return function(_0xcb4b48){if(_0xcb4b48){return _0x5d8922[_0x837f('0x14')](_0x4903b8)['json'](_0xcb4b48);}};}function respondWithFilteredResult(_0xc0fdde,_0x44d0ca){return function(_0x5e5d1b){if(_0x5e5d1b){var _0x5ce5db=typeof _0x44d0ca[_0x837f('0x16')]===_0x837f('0x17')&&typeof _0x44d0ca[_0x837f('0x18')]===_0x837f('0x17');var _0x906ae1=_0x5e5d1b[_0x837f('0x19')];var _0x2c09a5=_0x5ce5db?0x0:_0x44d0ca[_0x837f('0x16')];var _0x495661=_0x5ce5db?_0x5e5d1b[_0x837f('0x19')]:_0x44d0ca[_0x837f('0x16')]+_0x44d0ca[_0x837f('0x18')];var _0x47ce7a;if(_0x495661>=_0x906ae1){_0x495661=_0x906ae1;_0x47ce7a=0xc8;}else{_0x47ce7a=0xce;}_0xc0fdde['status'](_0x47ce7a);return _0xc0fdde[_0x837f('0x1a')]('Content-Range',_0x2c09a5+'-'+_0x495661+'/'+_0x906ae1)[_0x837f('0x1b')](_0x5e5d1b);}return null;};}function patchUpdates(_0x14b4b2){return function(_0x233bd7){try{jsonpatch[_0x837f('0x1c')](_0x233bd7,_0x14b4b2,!![]);}catch(_0x3f3475){return BPromise[_0x837f('0x1d')](_0x3f3475);}return _0x233bd7[_0x837f('0x1e')]();};}function saveUpdates(_0x5e97e2,_0x2e374d){return function(_0x1bbb0b){if(_0x1bbb0b){return _0x1bbb0b[_0x837f('0x1f')](_0x5e97e2)[_0x837f('0x20')](function(_0x49b914){return _0x49b914;});}return null;};}function removeEntity(_0x46a42f,_0x536832){return function(_0x4646ef){if(_0x4646ef){return _0x4646ef[_0x837f('0x21')]()[_0x837f('0x20')](function(){var _0x4e7c88=_0x4646ef['get']({'plain':!![]});var _0x65ac1d='Scheduler';return db[_0x837f('0x22')][_0x837f('0x21')]({'where':{'type':_0x65ac1d,'resourceId':_0x4e7c88['id']}})[_0x837f('0x20')](function(){return _0x4646ef;});})['then'](function(){_0x46a42f[_0x837f('0x14')](0xcc)[_0x837f('0x15')]();});}};}function handleEntityNotFound(_0x5eb792,_0x83aeda){return function(_0x3e1868){if(!_0x3e1868){_0x5eb792[_0x837f('0x13')](0x194);}return _0x3e1868;};}function handleError(_0x2fae9d,_0x34310e){_0x34310e=_0x34310e||0x1f4;return function(_0x44829e){logger[_0x837f('0x23')](_0x44829e[_0x837f('0x24')]);if(_0x44829e[_0x837f('0x25')]){delete _0x44829e[_0x837f('0x25')];}_0x2fae9d[_0x837f('0x14')](_0x34310e)['send'](_0x44829e);};}exports[_0x837f('0x26')]=function(_0x13a006,_0x4f1564){var _0x45e29e={},_0x183bfe={},_0x1b4440={'count':0x0,'rows':[]};var _0x3b6de1=_[_0x837f('0x27')](db[_0x837f('0x28')][_0x837f('0x29')],function(_0x96bb72){return{'name':_0x96bb72[_0x837f('0x2a')],'type':_0x96bb72['type'][_0x837f('0x2b')]};});_0x183bfe[_0x837f('0x2c')]=_['map'](_0x3b6de1,'name');_0x183bfe['query']=_[_0x837f('0x2d')](_0x13a006[_0x837f('0x2e')]);_0x183bfe[_0x837f('0x2f')]=_[_0x837f('0x30')](_0x183bfe[_0x837f('0x2c')],_0x183bfe[_0x837f('0x2e')]);_0x45e29e[_0x837f('0x31')]=_[_0x837f('0x30')](_0x183bfe[_0x837f('0x2c')],qs[_0x837f('0x32')](_0x13a006[_0x837f('0x2e')]['fields']));_0x45e29e[_0x837f('0x31')]=_0x45e29e[_0x837f('0x31')][_0x837f('0x33')]?_0x45e29e['attributes']:_0x183bfe[_0x837f('0x2c')];if(!_0x13a006['query'][_0x837f('0x34')](_0x837f('0x35'))){_0x45e29e[_0x837f('0x18')]=qs[_0x837f('0x18')](_0x13a006['query'][_0x837f('0x18')]);_0x45e29e[_0x837f('0x16')]=qs['offset'](_0x13a006[_0x837f('0x2e')][_0x837f('0x16')]);}_0x45e29e[_0x837f('0x36')]=qs[_0x837f('0x37')](_0x13a006[_0x837f('0x2e')][_0x837f('0x37')]);_0x45e29e[_0x837f('0x38')]=qs[_0x837f('0x2f')](_[_0x837f('0x39')](_0x13a006[_0x837f('0x2e')],_0x183bfe[_0x837f('0x2f')]),_0x3b6de1);if(_0x13a006[_0x837f('0x2e')]['filter']){_0x45e29e[_0x837f('0x38')]=_[_0x837f('0x3a')](_0x45e29e['where'],{'$or':_[_0x837f('0x27')](_0x3b6de1,function(_0x365252){if(_0x365252[_0x837f('0x3b')]!==_0x837f('0x3c')){var _0x3f9c47={};_0x3f9c47[_0x365252[_0x837f('0x25')]]={'$like':'%'+_0x13a006[_0x837f('0x2e')][_0x837f('0x3d')]+'%'};return _0x3f9c47;}})});}_0x45e29e=_['merge']({},_0x45e29e,_0x13a006[_0x837f('0x3e')]);var _0x2d4090={'where':_0x45e29e[_0x837f('0x38')]};return db[_0x837f('0x28')]['count'](_0x2d4090)[_0x837f('0x20')](function(_0x22ef26){_0x1b4440[_0x837f('0x19')]=_0x22ef26;if(_0x13a006[_0x837f('0x2e')][_0x837f('0x3f')]){_0x45e29e[_0x837f('0x40')]=[{'all':!![]}];}return db['Schedule'][_0x837f('0x41')](_0x45e29e);})[_0x837f('0x20')](function(_0x273250){_0x1b4440[_0x837f('0x42')]=_0x273250;return _0x1b4440;})['then'](respondWithFilteredResult(_0x4f1564,_0x45e29e))[_0x837f('0x43')](handleError(_0x4f1564,null));};exports[_0x837f('0x44')]=function(_0x206a4a,_0x19277f){var _0x22ac30={'raw':![],'where':{'id':_0x206a4a[_0x837f('0x45')]['id']}},_0x11dc72={};_0x11dc72[_0x837f('0x2c')]=_[_0x837f('0x2d')](db[_0x837f('0x28')]['rawAttributes']);_0x11dc72[_0x837f('0x2e')]=_['keys'](_0x206a4a['query']);_0x11dc72[_0x837f('0x2f')]=_[_0x837f('0x30')](_0x11dc72[_0x837f('0x2c')],_0x11dc72[_0x837f('0x2e')]);_0x22ac30[_0x837f('0x31')]=_[_0x837f('0x30')](_0x11dc72[_0x837f('0x2c')],qs[_0x837f('0x32')](_0x206a4a[_0x837f('0x2e')]['fields']));_0x22ac30[_0x837f('0x31')]=_0x22ac30[_0x837f('0x31')][_0x837f('0x33')]?_0x22ac30[_0x837f('0x31')]:_0x11dc72[_0x837f('0x2c')];if(_0x206a4a[_0x837f('0x2e')][_0x837f('0x3f')]){_0x22ac30[_0x837f('0x40')]=[{'all':!![]}];}_0x22ac30=_['merge']({},_0x22ac30,_0x206a4a[_0x837f('0x3e')]);return db[_0x837f('0x28')]['find'](_0x22ac30)[_0x837f('0x20')](handleEntityNotFound(_0x19277f,null))[_0x837f('0x20')](respondWithResult(_0x19277f,null))[_0x837f('0x43')](handleError(_0x19277f,null));};exports['create']=function(_0x50529f,_0x2af266){return db['Schedule'][_0x837f('0x46')](_0x50529f['body'],{})['then'](function(_0x5c4b7e){var _0x5c7ec9=_0x50529f[_0x837f('0x47')][_0x837f('0x48')]({'plain':!![]});if(!_0x5c7ec9)throw new Error(_0x837f('0x49'));if(_0x5c7ec9['role']===_0x837f('0x47')){var _0x2acf13=_0x5c4b7e[_0x837f('0x48')]({'plain':!![]});var _0x1c4732='Scheduler';return db[_0x837f('0x4a')][_0x837f('0x4b')]({'where':{'name':_0x1c4732,'userProfileId':_0x5c7ec9[_0x837f('0x4c')]},'raw':!![]})[_0x837f('0x20')](function(_0x234e8a){if(_0x234e8a&&_0x234e8a[_0x837f('0x4d')]===0x0){return db[_0x837f('0x22')]['create']({'name':_0x2acf13['name'],'resourceId':_0x2acf13['id'],'type':_0x234e8a[_0x837f('0x25')],'sectionId':_0x234e8a['id']},{})[_0x837f('0x20')](function(){return _0x5c4b7e;});}else{return _0x5c4b7e;}})[_0x837f('0x43')](function(_0x381064){logger[_0x837f('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x381064);throw _0x381064;});}return _0x5c4b7e;})[_0x837f('0x20')](respondWithResult(_0x2af266,0xc9))[_0x837f('0x43')](handleError(_0x2af266,null));};exports[_0x837f('0x1f')]=function(_0x1adfda,_0x2f7a7c){if(_0x1adfda['body']['id']){delete _0x1adfda[_0x837f('0x4e')]['id'];}return db[_0x837f('0x28')][_0x837f('0x4b')]({'where':{'id':_0x1adfda[_0x837f('0x45')]['id']}})[_0x837f('0x20')](handleEntityNotFound(_0x2f7a7c,null))['then'](saveUpdates(_0x1adfda[_0x837f('0x4e')],null))['then'](respondWithResult(_0x2f7a7c,null))['catch'](handleError(_0x2f7a7c,null));};exports[_0x837f('0x21')]=function(_0x39d80a,_0x406362){return db[_0x837f('0x28')]['find']({'where':{'id':_0x39d80a[_0x837f('0x45')]['id']}})['then'](handleEntityNotFound(_0x406362,null))[_0x837f('0x20')](removeEntity(_0x406362,null))[_0x837f('0x43')](handleError(_0x406362,null));};exports[_0x837f('0x4f')]=function(_0x4b116f,_0x30c4a9,_0xe46066){var _0x121e7f=require(_0x837f('0x50'));return db[_0x837f('0x28')][_0x837f('0x4b')]({'where':{'id':_0x4b116f['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x30c4a9,null))[_0x837f('0x20')](function(){_0x121e7f[_0x837f('0x4f')](_0x4b116f[_0x837f('0x45')]['id']);})[_0x837f('0x20')](respondWithStatusCode(_0x30c4a9,null))[_0x837f('0x43')](handleError(_0x30c4a9,null));}; \ No newline at end of file +var _0x2882=['crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','index','Schedule','rawAttributes','fieldName','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel'];(function(_0xcd40a7,_0x58e78d){var _0x336808=function(_0x198feb){while(--_0x198feb){_0xcd40a7['push'](_0xcd40a7['shift']());}};_0x336808(++_0x58e78d);}(_0x2882,0xe6));var _0x2288=function(_0xde54f3,_0x3b3afa){_0xde54f3=_0xde54f3-0x0;var _0x465cc3=_0x2882[_0xde54f3];return _0x465cc3;};'use strict';var emlformat=require(_0x2288('0x0'));var rimraf=require(_0x2288('0x1'));var zipdir=require(_0x2288('0x2'));var jsonpatch=require(_0x2288('0x3'));var rp=require(_0x2288('0x4'));var moment=require(_0x2288('0x5'));var BPromise=require(_0x2288('0x6'));var Mustache=require('mustache');var util=require(_0x2288('0x7'));var path=require(_0x2288('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2288('0x9'));var fs=require('fs');var fs_extra=require(_0x2288('0xa'));var _=require(_0x2288('0xb'));var squel=require(_0x2288('0xc'));var crypto=require(_0x2288('0xd'));var jsforce=require(_0x2288('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2288('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2288('0x10'));var authService=require(_0x2288('0x11'));var qs=require(_0x2288('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2288('0x13'));var logger=require(_0x2288('0x14'))(_0x2288('0x15'));var utils=require(_0x2288('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2288('0x17'))['db'];function respondWithStatusCode(_0xe05ac6,_0x467be5){_0x467be5=_0x467be5||0xcc;return function(_0x2f50af){if(_0x2f50af){return _0xe05ac6[_0x2288('0x18')](_0x467be5);}return _0xe05ac6[_0x2288('0x19')](_0x467be5)[_0x2288('0x1a')]();};}function respondWithResult(_0x1076a2,_0x216856){_0x216856=_0x216856||0xc8;return function(_0x8c9a45){if(_0x8c9a45){return _0x1076a2['status'](_0x216856)[_0x2288('0x1b')](_0x8c9a45);}};}function respondWithFilteredResult(_0xa7adc8,_0x369970){return function(_0x25241f){if(_0x25241f){var _0x22747c=typeof _0x369970[_0x2288('0x1c')]===_0x2288('0x1d')&&typeof _0x369970[_0x2288('0x1e')]===_0x2288('0x1d');var _0x647e1a=_0x25241f[_0x2288('0x1f')];var _0x28da36=_0x22747c?0x0:_0x369970['offset'];var _0x2dd807=_0x22747c?_0x25241f[_0x2288('0x1f')]:_0x369970[_0x2288('0x1c')]+_0x369970[_0x2288('0x1e')];var _0x509b5e;if(_0x2dd807>=_0x647e1a){_0x2dd807=_0x647e1a;_0x509b5e=0xc8;}else{_0x509b5e=0xce;}_0xa7adc8[_0x2288('0x19')](_0x509b5e);return _0xa7adc8['set'](_0x2288('0x20'),_0x28da36+'-'+_0x2dd807+'/'+_0x647e1a)[_0x2288('0x1b')](_0x25241f);}return null;};}function patchUpdates(_0x20e49c){return function(_0x5c9421){try{jsonpatch[_0x2288('0x21')](_0x5c9421,_0x20e49c,!![]);}catch(_0x473668){return BPromise[_0x2288('0x22')](_0x473668);}return _0x5c9421[_0x2288('0x23')]();};}function saveUpdates(_0x50e0d7,_0x8d6faa){return function(_0x360d3f){if(_0x360d3f){return _0x360d3f[_0x2288('0x24')](_0x50e0d7)[_0x2288('0x25')](function(_0x5d84ea){return _0x5d84ea;});}return null;};}function removeEntity(_0xd73445,_0x25e60c){return function(_0x2317b1){if(_0x2317b1){return _0x2317b1[_0x2288('0x26')]()[_0x2288('0x25')](function(){var _0x3f549c=_0x2317b1[_0x2288('0x27')]({'plain':!![]});var _0x19d71c=_0x2288('0x28');return db[_0x2288('0x29')][_0x2288('0x26')]({'where':{'type':_0x19d71c,'resourceId':_0x3f549c['id']}})['then'](function(){return _0x2317b1;});})[_0x2288('0x25')](function(){_0xd73445[_0x2288('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6163,_0x2c6ae4){return function(_0x9508a){if(!_0x9508a){_0x3b6163[_0x2288('0x18')](0x194);}return _0x9508a;};}function handleError(_0x2edf4d,_0x578d43){_0x578d43=_0x578d43||0x1f4;return function(_0x1c1407){logger[_0x2288('0x2a')](_0x1c1407[_0x2288('0x2b')]);if(_0x1c1407['name']){delete _0x1c1407[_0x2288('0x2c')];}_0x2edf4d[_0x2288('0x19')](_0x578d43)['send'](_0x1c1407);};}exports[_0x2288('0x2d')]=function(_0x13b675,_0x53a3d0){var _0x39015c={},_0x3d2648={},_0x25e9a2={'count':0x0,'rows':[]};var _0x36a093=_['map'](db[_0x2288('0x2e')][_0x2288('0x2f')],function(_0x5dedfe){return{'name':_0x5dedfe[_0x2288('0x30')],'type':_0x5dedfe['type']['key']};});_0x3d2648[_0x2288('0x31')]=_[_0x2288('0x32')](_0x36a093,_0x2288('0x2c'));_0x3d2648['query']=_[_0x2288('0x33')](_0x13b675[_0x2288('0x34')]);_0x3d2648[_0x2288('0x35')]=_[_0x2288('0x36')](_0x3d2648[_0x2288('0x31')],_0x3d2648[_0x2288('0x34')]);_0x39015c['attributes']=_[_0x2288('0x36')](_0x3d2648[_0x2288('0x31')],qs[_0x2288('0x37')](_0x13b675[_0x2288('0x34')][_0x2288('0x37')]));_0x39015c['attributes']=_0x39015c[_0x2288('0x38')][_0x2288('0x39')]?_0x39015c['attributes']:_0x3d2648[_0x2288('0x31')];if(!_0x13b675['query'][_0x2288('0x3a')](_0x2288('0x3b'))){_0x39015c[_0x2288('0x1e')]=qs[_0x2288('0x1e')](_0x13b675[_0x2288('0x34')][_0x2288('0x1e')]);_0x39015c[_0x2288('0x1c')]=qs[_0x2288('0x1c')](_0x13b675[_0x2288('0x34')][_0x2288('0x1c')]);}_0x39015c['order']=qs['sort'](_0x13b675[_0x2288('0x34')][_0x2288('0x3c')]);_0x39015c[_0x2288('0x3d')]=qs['filters'](_['pick'](_0x13b675['query'],_0x3d2648['filters']),_0x36a093);if(_0x13b675[_0x2288('0x34')][_0x2288('0x3e')]){_0x39015c[_0x2288('0x3d')]=_[_0x2288('0x3f')](_0x39015c[_0x2288('0x3d')],{'$or':_['map'](_0x36a093,function(_0x28a37f){if(_0x28a37f['type']!=='VIRTUAL'){var _0xb2812c={};_0xb2812c[_0x28a37f[_0x2288('0x2c')]]={'$like':'%'+_0x13b675[_0x2288('0x34')]['filter']+'%'};return _0xb2812c;}})});}_0x39015c=_['merge']({},_0x39015c,_0x13b675[_0x2288('0x40')]);var _0x3fb22c={'where':_0x39015c[_0x2288('0x3d')]};return db[_0x2288('0x2e')][_0x2288('0x1f')](_0x3fb22c)[_0x2288('0x25')](function(_0x5e674a){_0x25e9a2[_0x2288('0x1f')]=_0x5e674a;if(_0x13b675[_0x2288('0x34')][_0x2288('0x41')]){_0x39015c[_0x2288('0x42')]=[{'all':!![]}];}return db[_0x2288('0x2e')][_0x2288('0x43')](_0x39015c);})['then'](function(_0x55922e){_0x25e9a2[_0x2288('0x44')]=_0x55922e;return _0x25e9a2;})['then'](respondWithFilteredResult(_0x53a3d0,_0x39015c))[_0x2288('0x45')](handleError(_0x53a3d0,null));};exports[_0x2288('0x46')]=function(_0x5705f7,_0x15219e){var _0x546c8d={'raw':![],'where':{'id':_0x5705f7[_0x2288('0x47')]['id']}},_0x161bd9={};_0x161bd9[_0x2288('0x31')]=_[_0x2288('0x33')](db[_0x2288('0x2e')][_0x2288('0x2f')]);_0x161bd9[_0x2288('0x34')]=_[_0x2288('0x33')](_0x5705f7[_0x2288('0x34')]);_0x161bd9[_0x2288('0x35')]=_[_0x2288('0x36')](_0x161bd9[_0x2288('0x31')],_0x161bd9[_0x2288('0x34')]);_0x546c8d[_0x2288('0x38')]=_[_0x2288('0x36')](_0x161bd9[_0x2288('0x31')],qs[_0x2288('0x37')](_0x5705f7[_0x2288('0x34')][_0x2288('0x37')]));_0x546c8d[_0x2288('0x38')]=_0x546c8d['attributes'][_0x2288('0x39')]?_0x546c8d[_0x2288('0x38')]:_0x161bd9[_0x2288('0x31')];if(_0x5705f7[_0x2288('0x34')]['includeAll']){_0x546c8d[_0x2288('0x42')]=[{'all':!![]}];}_0x546c8d=_[_0x2288('0x3f')]({},_0x546c8d,_0x5705f7[_0x2288('0x40')]);return db[_0x2288('0x2e')][_0x2288('0x48')](_0x546c8d)['then'](handleEntityNotFound(_0x15219e,null))['then'](respondWithResult(_0x15219e,null))[_0x2288('0x45')](handleError(_0x15219e,null));};exports[_0x2288('0x49')]=function(_0x5eff46,_0x4698b3){return db[_0x2288('0x2e')][_0x2288('0x49')](_0x5eff46['body'],{})[_0x2288('0x25')](function(_0x24877a){var _0x2142c8=_0x5eff46[_0x2288('0x4a')]['get']({'plain':!![]});if(!_0x2142c8)throw new Error(_0x2288('0x4b'));if(_0x2142c8['role']==='user'){var _0x530691=_0x24877a[_0x2288('0x27')]({'plain':!![]});var _0x287255=_0x2288('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x287255,'userProfileId':_0x2142c8[_0x2288('0x4c')]},'raw':!![]})[_0x2288('0x25')](function(_0xdc6d16){if(_0xdc6d16&&_0xdc6d16['autoAssociation']===0x0){return db['UserProfileResource'][_0x2288('0x49')]({'name':_0x530691[_0x2288('0x2c')],'resourceId':_0x530691['id'],'type':_0xdc6d16['name'],'sectionId':_0xdc6d16['id']},{})[_0x2288('0x25')](function(){return _0x24877a;});}else{return _0x24877a;}})[_0x2288('0x45')](function(_0x3cd9b4){logger[_0x2288('0x2a')](_0x2288('0x4d'),_0x3cd9b4);throw _0x3cd9b4;});}return _0x24877a;})[_0x2288('0x25')](respondWithResult(_0x4698b3,0xc9))[_0x2288('0x45')](handleError(_0x4698b3,null));};exports[_0x2288('0x24')]=function(_0x5449be,_0x316893){if(_0x5449be[_0x2288('0x4e')]['id']){delete _0x5449be[_0x2288('0x4e')]['id'];}return db[_0x2288('0x2e')][_0x2288('0x48')]({'where':{'id':_0x5449be[_0x2288('0x47')]['id']}})[_0x2288('0x25')](handleEntityNotFound(_0x316893,null))[_0x2288('0x25')](saveUpdates(_0x5449be['body'],null))['then'](respondWithResult(_0x316893,null))['catch'](handleError(_0x316893,null));};exports[_0x2288('0x26')]=function(_0x241cdd,_0x5e330d){return db[_0x2288('0x2e')][_0x2288('0x48')]({'where':{'id':_0x241cdd[_0x2288('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e330d,null))[_0x2288('0x25')](removeEntity(_0x5e330d,null))[_0x2288('0x45')](handleError(_0x5e330d,null));};exports['run']=function(_0x1f51ad,_0x5aac11,_0x46fba2){var _0x1b2e98=require(_0x2288('0x4f'));return db[_0x2288('0x2e')]['find']({'where':{'id':_0x1f51ad[_0x2288('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5aac11,null))[_0x2288('0x25')](function(){_0x1b2e98[_0x2288('0x50')](_0x1f51ad[_0x2288('0x47')]['id']);})[_0x2288('0x25')](respondWithStatusCode(_0x5aac11,null))[_0x2288('0x45')](handleError(_0x5aac11,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index cf1e80a..78ab2ec 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 _0xc3c5=['Schedule','tools_schedules','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xc3c5,0x182));var _0x5c3c=function(_0x2f00be,_0x4f69b7){_0x2f00be=_0x2f00be-0x0;var _0x16d849=_0xc3c5[_0x2f00be];return _0x16d849;};'use strict';var _=require(_0x5c3c('0x0'));var util=require('util');var logger=require(_0x5c3c('0x1'))(_0x5c3c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5c3c('0x3'));var fs=require('fs');var path=require(_0x5c3c('0x4'));var rimraf=require(_0x5c3c('0x5'));var config=require(_0x5c3c('0x6'));var attributes=require(_0x5c3c('0x7'));module[_0x5c3c('0x8')]=function(_0x463485,_0x58eb69){return _0x463485[_0x5c3c('0x9')](_0x5c3c('0xa'),attributes,{'tableName':_0x5c3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6daf=['path','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa688c3,_0x5bd140){var _0x4e2f9c=function(_0x22cfa7){while(--_0x22cfa7){_0xa688c3['push'](_0xa688c3['shift']());}};_0x4e2f9c(++_0x5bd140);}(_0x6daf,0x16d));var _0xf6da=function(_0x32d822,_0xd63b5d){_0x32d822=_0x32d822-0x0;var _0x1db4d3=_0x6daf[_0x32d822];return _0x1db4d3;};'use strict';var _=require(_0xf6da('0x0'));var util=require(_0xf6da('0x1'));var logger=require(_0xf6da('0x2'))(_0xf6da('0x3'));var moment=require(_0xf6da('0x4'));var BPromise=require(_0xf6da('0x5'));var rp=require(_0xf6da('0x6'));var fs=require('fs');var path=require(_0xf6da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6da('0x8'));module[_0xf6da('0x9')]=function(_0x7a0aed,_0x110a61){return _0x7a0aed[_0xf6da('0xa')](_0xf6da('0xb'),attributes,{'tableName':'tools_schedules','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 dd30a24..0337083 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 _0x360d=['code','message','error','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3f8a48,_0x442d16){var _0x3b5767=function(_0x24ac44){while(--_0x24ac44){_0x3f8a48['push'](_0x3f8a48['shift']());}};_0x3b5767(++_0x442d16);}(_0x360d,0xad));var _0xd360=function(_0x50e410,_0x36bb68){_0x50e410=_0x50e410-0x0;var _0x3eb22c=_0x360d[_0x50e410];return _0x3eb22c;};'use strict';var _=require(_0xd360('0x0'));var util=require(_0xd360('0x1'));var moment=require(_0xd360('0x2'));var BPromise=require(_0xd360('0x3'));var rs=require(_0xd360('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd360('0x5'))['db'];var utils=require(_0xd360('0x6'));var logger=require('../../config/logger')(_0xd360('0x7'));var config=require(_0xd360('0x8'));var jayson=require(_0xd360('0x9'));var client=jayson[_0xd360('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c0d26,_0x1a5a90,_0x197a42){return new BPromise(function(_0x14444e,_0x5abd9b){return client[_0xd360('0xb')](_0x3c0d26,_0x197a42)[_0xd360('0xc')](function(_0x21a70e){logger[_0xd360('0xd')](_0xd360('0xe'),_0x1a5a90,'request\x20sent');logger[_0xd360('0xf')](_0xd360('0x10'),_0x1a5a90,_0xd360('0x11'),JSON[_0xd360('0x12')](_0x21a70e));if(_0x21a70e['error']){if(_0x21a70e['error'][_0xd360('0x13')]===0x1f4){logger['error'](_0xd360('0xe'),_0x1a5a90,_0x21a70e['error'][_0xd360('0x14')]);return _0x5abd9b(_0x21a70e['error'][_0xd360('0x14')]);}logger[_0xd360('0x15')](_0xd360('0xe'),_0x1a5a90,_0x21a70e[_0xd360('0x15')][_0xd360('0x14')]);return _0x14444e(_0x21a70e[_0xd360('0x15')][_0xd360('0x14')]);}else{logger[_0xd360('0xd')]('Schedule,\x20%s,\x20%s',_0x1a5a90,_0xd360('0x11'));_0x14444e(_0x21a70e[_0xd360('0x16')]['message']);}})[_0xd360('0x17')](function(_0x34ba1d){logger[_0xd360('0x15')](_0xd360('0xe'),_0x1a5a90,_0x34ba1d);_0x5abd9b(_0x34ba1d);});});} \ No newline at end of file +var _0x901d=['Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','debug'];(function(_0x2c7279,_0xa810b7){var _0x39cd25=function(_0x45d011){while(--_0x45d011){_0x2c7279['push'](_0x2c7279['shift']());}};_0x39cd25(++_0xa810b7);}(_0x901d,0xfa));var _0xd901=function(_0x2fdd40,_0x1bb200){_0x2fdd40=_0x2fdd40-0x0;var _0x44e423=_0x901d[_0x2fdd40];return _0x44e423;};'use strict';var _=require('lodash');var util=require(_0xd901('0x0'));var moment=require(_0xd901('0x1'));var BPromise=require('bluebird');var rs=require(_0xd901('0x2'));var fs=require('fs');var Redis=require(_0xd901('0x3'));var db=require(_0xd901('0x4'))['db'];var utils=require(_0xd901('0x5'));var logger=require(_0xd901('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd901('0x7'));var client=jayson['client'][_0xd901('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e5591,_0x1698ba,_0x5653a8){return new BPromise(function(_0x3e90b7,_0x27b769){return client[_0xd901('0x9')](_0x5e5591,_0x5653a8)[_0xd901('0xa')](function(_0x17a419){logger[_0xd901('0xb')](_0xd901('0xc'),_0x1698ba,'request\x20sent');logger[_0xd901('0xd')](_0xd901('0xe'),_0x1698ba,_0xd901('0xf'),JSON[_0xd901('0x10')](_0x17a419));if(_0x17a419[_0xd901('0x11')]){if(_0x17a419[_0xd901('0x11')][_0xd901('0x12')]===0x1f4){logger[_0xd901('0x11')](_0xd901('0xc'),_0x1698ba,_0x17a419[_0xd901('0x11')][_0xd901('0x13')]);return _0x27b769(_0x17a419[_0xd901('0x11')][_0xd901('0x13')]);}logger[_0xd901('0x11')](_0xd901('0xc'),_0x1698ba,_0x17a419[_0xd901('0x11')][_0xd901('0x13')]);return _0x3e90b7(_0x17a419[_0xd901('0x11')][_0xd901('0x13')]);}else{logger[_0xd901('0xb')]('Schedule,\x20%s,\x20%s',_0x1698ba,_0xd901('0xf'));_0x3e90b7(_0x17a419[_0xd901('0x14')]['message']);}})[_0xd901('0x15')](function(_0x5504c2){logger['error'](_0xd901('0xc'),_0x1698ba,_0x5504c2);_0x27b769(_0x5504c2);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ecc902b..b3c1968 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 _0x256e=['put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id/download','download','post','create'];(function(_0x15d3ec,_0x43499a){var _0x1c9e6e=function(_0x361b6f){while(--_0x361b6f){_0x15d3ec['push'](_0x15d3ec['shift']());}};_0x1c9e6e(++_0x43499a);}(_0x256e,0x176));var _0xe256=function(_0x3c08ce,_0x338c77){_0x3c08ce=_0x3c08ce-0x0;var _0x576c0a=_0x256e[_0x3c08ce];return _0x576c0a;};'use strict';var multer=require(_0xe256('0x0'));var util=require(_0xe256('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe256('0x2'));var router=express[_0xe256('0x3')]();var fs_extra=require(_0xe256('0x4'));var auth=require(_0xe256('0x5'));var interaction=require(_0xe256('0x6'));var config=require(_0xe256('0x7'));var controller=require(_0xe256('0x8'));router[_0xe256('0x9')]('/',auth[_0xe256('0xa')](),controller[_0xe256('0xb')]);router[_0xe256('0x9')](_0xe256('0xc'),auth[_0xe256('0xa')](),controller['describe']);router[_0xe256('0x9')]('/:id',auth[_0xe256('0xa')](),controller['show']);router[_0xe256('0x9')](_0xe256('0xd'),auth[_0xe256('0xa')](),controller[_0xe256('0xe')]);router[_0xe256('0xf')]('/',auth['isAuthenticated'](),controller[_0xe256('0x10')]);router[_0xe256('0x11')](_0xe256('0x12'),auth['isAuthenticated'](),controller[_0xe256('0x13')]);router[_0xe256('0x14')](_0xe256('0x12'),auth[_0xe256('0xa')](),controller[_0xe256('0x15')]);module[_0xe256('0x16')]=router; \ No newline at end of file +var _0xd961=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/download','download','post','create','put','update'];(function(_0xa91beb,_0x555206){var _0x2c04f3=function(_0xfa0bfb){while(--_0xfa0bfb){_0xa91beb['push'](_0xa91beb['shift']());}};_0x2c04f3(++_0x555206);}(_0xd961,0x145));var _0x1d96=function(_0x1cb86d,_0x202738){_0x1cb86d=_0x1cb86d-0x0;var _0x4130c3=_0xd961[_0x1cb86d];return _0x4130c3;};'use strict';var multer=require(_0x1d96('0x0'));var util=require(_0x1d96('0x1'));var path=require(_0x1d96('0x2'));var timeout=require(_0x1d96('0x3'));var express=require(_0x1d96('0x4'));var router=express['Router']();var fs_extra=require(_0x1d96('0x5'));var auth=require(_0x1d96('0x6'));var interaction=require(_0x1d96('0x7'));var config=require(_0x1d96('0x8'));var controller=require('./screenRecording.controller');router[_0x1d96('0x9')]('/',auth[_0x1d96('0xa')](),controller[_0x1d96('0xb')]);router[_0x1d96('0x9')](_0x1d96('0xc'),auth[_0x1d96('0xa')](),controller['describe']);router[_0x1d96('0x9')](_0x1d96('0xd'),auth[_0x1d96('0xa')](),controller['show']);router['get'](_0x1d96('0xe'),auth[_0x1d96('0xa')](),controller[_0x1d96('0xf')]);router[_0x1d96('0x10')]('/',auth['isAuthenticated'](),controller[_0x1d96('0x11')]);router[_0x1d96('0x12')](_0x1d96('0xd'),auth['isAuthenticated'](),controller[_0x1d96('0x13')]);router[_0x1d96('0x14')](_0x1d96('0xd'),auth[_0x1d96('0xa')](),controller[_0x1d96('0x15')]);module[_0x1d96('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index b44777e..7e60735 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 _0x5942=['getDataValue','value','extname','STRING','replace','INTEGER','startedAt','subtract','setDataValue','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL'];(function(_0x8336b5,_0x58c561){var _0x3fa124=function(_0x2d24b3){while(--_0x2d24b3){_0x8336b5['push'](_0x8336b5['shift']());}};_0x3fa124(++_0x58c561);}(_0x5942,0x16a));var _0x2594=function(_0x5ea778,_0x711f5f){_0x5ea778=_0x5ea778-0x0;var _0x4168f5=_0x5942[_0x5ea778];return _0x4168f5;};'use strict';var Sequelize=require(_0x2594('0x0'));var moment=require(_0x2594('0x1'));var path=require(_0x2594('0x2'));var config=require(_0x2594('0x3'));module[_0x2594('0x4')]={'format':{'type':Sequelize[_0x2594('0x5')],'get':function(){return this[_0x2594('0x6')](_0x2594('0x7'))?path[_0x2594('0x8')](this[_0x2594('0x6')](_0x2594('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x2594('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x381472){var _0xd0ada5=_0x381472[_0x2594('0xa')](/\\/g,'/');this['setDataValue'](_0x2594('0x7'),_0xd0ada5);}},'rating':{'type':Sequelize[_0x2594('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x29517f){this['setDataValue'](_0x2594('0xc'),moment()[_0x2594('0xd')](_0x29517f,'ms'));this[_0x2594('0xe')]('closedAt',moment());this[_0x2594('0xe')](_0x2594('0xf'),_0x29517f);}},'startedAt':{'type':Sequelize[_0x2594('0x10')],'get':function(){return moment(this[_0x2594('0x6')]('startedAt'))[_0x2594('0x11')](_0x2594('0x12'))[_0x2594('0x13')]();}},'closedAt':{'type':Sequelize[_0x2594('0x10')],'get':function(){return moment(this[_0x2594('0x6')](_0x2594('0x14')))[_0x2594('0x11')](_0x2594('0x12'))[_0x2594('0x13')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2594('0x6')](_0x2594('0x15')))['format'](_0x2594('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x2594('0x10')],'get':function(){return moment(this[_0x2594('0x6')](_0x2594('0x16')))[_0x2594('0x11')](_0x2594('0x12'))['toString']();}}}; \ No newline at end of file +var _0x2884=['MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','path','../../config/environment','exports','getDataValue','value','STRING','setDataValue','INTEGER','closedAt','duration','DATE','startedAt'];(function(_0x27733c,_0x5a22b5){var _0x580d35=function(_0x35b226){while(--_0x35b226){_0x27733c['push'](_0x27733c['shift']());}};_0x580d35(++_0x5a22b5);}(_0x2884,0x1eb));var _0x4288=function(_0x45bc3f,_0x234416){_0x45bc3f=_0x45bc3f-0x0;var _0x530329=_0x2884[_0x45bc3f];return _0x530329;};'use strict';var Sequelize=require(_0x4288('0x0'));var moment=require('moment');var path=require(_0x4288('0x1'));var config=require(_0x4288('0x2'));module[_0x4288('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4288('0x4')](_0x4288('0x5'))?path['extname'](this['getDataValue'](_0x4288('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x4288('0x6')]},'channel':{'type':Sequelize[_0x4288('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x526a07){var _0x3a930e=_0x526a07['replace'](/\\/g,'/');this[_0x4288('0x7')](_0x4288('0x5'),_0x3a930e);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4288('0x8')],'set':function(_0x3c8d6e){this[_0x4288('0x7')]('startedAt',moment()['subtract'](_0x3c8d6e,'ms'));this[_0x4288('0x7')](_0x4288('0x9'),moment());this[_0x4288('0x7')](_0x4288('0xa'),_0x3c8d6e);}},'startedAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this[_0x4288('0x4')](_0x4288('0xc')))['format'](_0x4288('0xd'))[_0x4288('0xe')]();}},'closedAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this[_0x4288('0x4')]('closedAt'))[_0x4288('0xf')](_0x4288('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this['getDataValue'](_0x4288('0x10')))['format'](_0x4288('0xd'))[_0x4288('0xe')]();}},'updatedAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this[_0x4288('0x4')](_0x4288('0x11')))[_0x4288('0xf')](_0x4288('0xd'))[_0x4288('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 87e9c0e..deaf88a 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 _0x207c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0x23a42d,_0x4a522e){var _0x31c9ed=function(_0x3b049f){while(--_0x3b049f){_0x23a42d['push'](_0x23a42d['shift']());}};_0x31c9ed(++_0x4a522e);}(_0x207c,0x1e8));var _0xc207=function(_0x4ab6a1,_0x4d64d5){_0x4ab6a1=_0x4ab6a1-0x0;var _0x2a24cc=_0x207c[_0x4ab6a1];return _0x2a24cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_['map'](_0x1bec3f,_0xc207('0x26')),[_0xc207('0x31')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x6a653d[_0xc207('0x32')]);_0x463ac8[_0xc207('0x34')]=_['intersection'](_0x463ac8[_0xc207('0x2f')],_0x463ac8[_0xc207('0x32')]);_0xe5e848[_0xc207('0x35')]=_[_0xc207('0x36')](_0x463ac8['model'],qs[_0xc207('0x37')](_0x6a653d[_0xc207('0x32')][_0xc207('0x37')]));_0xe5e848[_0xc207('0x35')]=_0xe5e848[_0xc207('0x35')][_0xc207('0x38')]?_0xe5e848[_0xc207('0x35')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x32')]['hasOwnProperty']('nolimit')){_0xe5e848[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1c')]);_0xe5e848['offset']=qs[_0xc207('0x1a')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d['query'][_0xc207('0x3a')]);_0xe5e848[_0xc207('0x3b')]=qs['filters'](_[_0xc207('0x3c')](_0x6a653d['query'],_0x463ac8[_0xc207('0x34')]),_0x1bec3f);if(_0x6a653d[_0xc207('0x32')]['filter']){_0xe5e848[_0xc207('0x3b')]=_[_0xc207('0x3d')](_0xe5e848[_0xc207('0x3b')],{'$or':_['map'](_0x1bec3f,function(_0x5b3041){if(_0x5b3041[_0xc207('0x2d')]!==_0xc207('0x3e')){var _0x41d66c={};_0x41d66c[_0x5b3041[_0xc207('0x26')]]={'$like':'%'+_0x6a653d['query'][_0xc207('0x3f')]+'%'};return _0x41d66c;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d['options']);var _0x4c10ed={'where':_0xe5e848['where']};return db[_0xc207('0x2a')][_0xc207('0x1d')](_0x4c10ed)[_0xc207('0x23')](function(_0x487f98){_0x6223ef[_0xc207('0x1d')]=_0x487f98;if(_0x6a653d[_0xc207('0x32')][_0xc207('0x40')]){_0xe5e848[_0xc207('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc207('0x42')](_0xe5e848);})[_0xc207('0x23')](function(_0x123a46){_0x6223ef[_0xc207('0x43')]=_0x123a46;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))['catch'](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x19a67d,_0x3a935a){var _0x471a85={'raw':![],'where':{'id':_0x19a67d[_0xc207('0x45')]['id']}},_0x153490={};_0x153490[_0xc207('0x2f')]=_[_0xc207('0x33')](db[_0xc207('0x2a')]['rawAttributes']);_0x153490[_0xc207('0x32')]=_[_0xc207('0x33')](_0x19a67d['query']);_0x153490[_0xc207('0x34')]=_[_0xc207('0x36')](_0x153490[_0xc207('0x2f')],_0x153490[_0xc207('0x32')]);_0x471a85[_0xc207('0x35')]=_['intersection'](_0x153490[_0xc207('0x2f')],qs[_0xc207('0x37')](_0x19a67d[_0xc207('0x32')]['fields']));_0x471a85[_0xc207('0x35')]=_0x471a85[_0xc207('0x35')][_0xc207('0x38')]?_0x471a85[_0xc207('0x35')]:_0x153490['model'];if(_0x19a67d['query'][_0xc207('0x40')]){_0x471a85[_0xc207('0x41')]=[{'all':!![]}];}_0x471a85=_[_0xc207('0x3d')]({},_0x471a85,_0x19a67d[_0xc207('0x46')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x471a85)[_0xc207('0x23')](handleEntityNotFound(_0x3a935a,null))[_0xc207('0x23')](respondWithResult(_0x3a935a,null))[_0xc207('0x48')](handleError(_0x3a935a,null));};exports[_0xc207('0x49')]=function(_0x2afcd1,_0x2fda4f){return db['ScreenRecording']['create'](_0x2afcd1[_0xc207('0x4a')],{})[_0xc207('0x23')](respondWithResult(_0x2fda4f,0xc9))[_0xc207('0x48')](handleError(_0x2fda4f,null));};exports['update']=function(_0x2b89e0,_0x3f712d){if(_0x2b89e0[_0xc207('0x4a')]['id']){delete _0x2b89e0[_0xc207('0x4a')]['id'];}delete _0x2b89e0['body'][_0xc207('0x4b')];delete _0x2b89e0['body'][_0xc207('0x4c')];delete _0x2b89e0['body']['closedAt'];delete _0x2b89e0[_0xc207('0x4a')][_0xc207('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x2b89e0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3f712d,null))[_0xc207('0x23')](saveUpdates(_0x2b89e0[_0xc207('0x4a')],null))[_0xc207('0x23')](respondWithResult(_0x3f712d,null))[_0xc207('0x48')](handleError(_0x3f712d,null));};exports[_0xc207('0x4e')]=function(_0x3dc457,_0x1dfdee){return db['ScreenRecording'][_0xc207('0x4e')]()[_0xc207('0x23')](respondWithResult(_0x1dfdee,null))['catch'](handleError(_0x1dfdee,null));};exports['download']=function(_0x362001,_0x47c630,_0x49a78b){var _0x2634d6=require(_0xc207('0x4f'));var _0x356c8c=![];var _0x3b2448={};if(_0x362001[_0xc207('0x32')][_0xc207('0x2d')]&&_0x362001[_0xc207('0x32')][_0xc207('0x2d')]===_0xc207('0x50')){_0x3b2448[_0xc207('0x50')]=_0x362001[_0xc207('0x45')]['id'];}else{_0x3b2448['id']=_0x362001['params']['id'];}return db['ScreenRecording'][_0xc207('0x47')]({'where':_0x3b2448,'attributes':['id',_0xc207('0x4d')],'raw':!![]})[_0xc207('0x23')](handleEntityNotFound(_0x47c630,null))[_0xc207('0x23')](function(_0xaff7a0){if(_0xaff7a0){var _0x21c12b=path[_0xc207('0x51')](config[_0xc207('0x52')],_0xc207('0x53'),_0xaff7a0['value']);var _0x1cc4e3=util[_0xc207('0x31')](_0xc207('0x54'),_0x21c12b);if(fs[_0xc207('0x55')](_0x1cc4e3)){_0x356c8c=!![];return _0x2634d6['decryptFile'](_0x1cc4e3,_0x21c12b,config[_0xc207('0x56')][_0xc207('0x57')])[_0xc207('0x23')](function(){return _0xaff7a0;});}return _0xaff7a0;}})[_0xc207('0x23')](function(_0x464263){if(_0x464263){var _0x45ad58=path[_0xc207('0x51')](config['root'],_0xc207('0x53'),_0x464263[_0xc207('0x4d')]);if(!fs[_0xc207('0x55')](_0x45ad58)){throw new db[(_0xc207('0x58'))]['ValidationError'](_0xc207('0x59'));}if(_0x464263['filename']){return _0x47c630['download'](_0x45ad58,_0x464263[_0xc207('0x5a')]+path[_0xc207('0x5b')](_0x45ad58),function(){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}else{return _0x47c630[_0xc207('0x5d')](_0x45ad58,function(_0x441d5f){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}}})[_0xc207('0x48')](function(_0x33c372){if(_0x33c372[_0xc207('0x5e')]===_0xc207('0x59')){_0x47c630[_0xc207('0x17')](0x194)[_0xc207('0x27')](_0xc207('0x5f'));}else{return handleError(_0x47c630,null);}});};exports[_0xc207('0x24')]=function(_0x282ae5,_0x501bca){return db[_0xc207('0x2a')]['find']({'where':{'id':_0x282ae5[_0xc207('0x45')]['id']}})[_0xc207('0x23')](function(_0x2ade23){if(_['isNil'](_0x2ade23)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ade23;})[_0xc207('0x23')](function(_0x3ac0dd){var _0x2f18a2=path['join'](config[_0xc207('0x52')],_0xc207('0x53'),_0x3ac0dd[_0xc207('0x4d')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f18a2);if(!_[_0xc207('0x60')](_0x3ac0dd['value'])&&fs[_0xc207('0x55')](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}_0x2f18a2=_0x2f18a2+_0xc207('0x65');if(!_[_0xc207('0x60')](_0x3ac0dd[_0xc207('0x4d')])&&fs['existsSync'](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}return _0x3ac0dd;})[_0xc207('0x23')](function(_0x14050a){if(!_0x14050a)throw new InternalError();return _0x14050a[_0xc207('0x24')]();})[_0xc207('0x23')](function(){_0x501bca[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();})[_0xc207('0x48')](handleError(_0x501bca,null));}; \ No newline at end of file +var _0xbd50=['unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','update','duration','value','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','recording','server/files/screen_recordings','ValidationError','filename','extname','download','unlink','message','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x5d0bf5,_0x4bbbbd){var _0x547a18=function(_0x1171a9){while(--_0x1171a9){_0x5d0bf5['push'](_0x5d0bf5['shift']());}};_0x547a18(++_0x4bbbbd);}(_0xbd50,0x196));var _0x0bd5=function(_0x28a6ad,_0x351697){_0x28a6ad=_0x28a6ad-0x0;var _0xbb804=_0xbd50[_0x28a6ad];return _0xbb804;};'use strict';var emlformat=require(_0x0bd5('0x0'));var rimraf=require(_0x0bd5('0x1'));var zipdir=require(_0x0bd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var BPromise=require(_0x0bd5('0x5'));var Mustache=require(_0x0bd5('0x6'));var util=require(_0x0bd5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bd5('0x8'));var fs=require('fs');var fs_extra=require(_0x0bd5('0x9'));var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0xd'));var querystring=require(_0x0bd5('0xe'));var Papa=require(_0x0bd5('0xf'));var Redis=require('ioredis');var authService=require(_0x0bd5('0x10'));var qs=require(_0x0bd5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd5('0x12'));var logger=require(_0x0bd5('0x13'))('api');var utils=require(_0x0bd5('0x14'));var config=require(_0x0bd5('0x15'));var licenseUtil=require(_0x0bd5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7a0c,_0x23982f){_0x23982f=_0x23982f||0xcc;return function(_0x2f9588){if(_0x2f9588){return _0x2f7a0c[_0x0bd5('0x17')](_0x23982f);}return _0x2f7a0c[_0x0bd5('0x18')](_0x23982f)[_0x0bd5('0x19')]();};}function respondWithResult(_0x30765e,_0x1e961d){_0x1e961d=_0x1e961d||0xc8;return function(_0x4f485b){if(_0x4f485b){return _0x30765e[_0x0bd5('0x18')](_0x1e961d)[_0x0bd5('0x1a')](_0x4f485b);}};}function respondWithFilteredResult(_0x574315,_0x31349f){return function(_0x23ef4e){if(_0x23ef4e){var _0x3a34e4=typeof _0x31349f[_0x0bd5('0x1b')]==='undefined'&&typeof _0x31349f[_0x0bd5('0x1c')]===_0x0bd5('0x1d');var _0xa890be=_0x23ef4e[_0x0bd5('0x1e')];var _0x833c14=_0x3a34e4?0x0:_0x31349f[_0x0bd5('0x1b')];var _0xc58e12=_0x3a34e4?_0x23ef4e[_0x0bd5('0x1e')]:_0x31349f[_0x0bd5('0x1b')]+_0x31349f[_0x0bd5('0x1c')];var _0x27bc1e;if(_0xc58e12>=_0xa890be){_0xc58e12=_0xa890be;_0x27bc1e=0xc8;}else{_0x27bc1e=0xce;}_0x574315[_0x0bd5('0x18')](_0x27bc1e);return _0x574315[_0x0bd5('0x1f')](_0x0bd5('0x20'),_0x833c14+'-'+_0xc58e12+'/'+_0xa890be)['json'](_0x23ef4e);}return null;};}function patchUpdates(_0x5ba943){return function(_0x596b6a){try{jsonpatch['apply'](_0x596b6a,_0x5ba943,!![]);}catch(_0x47d74a){return BPromise[_0x0bd5('0x21')](_0x47d74a);}return _0x596b6a[_0x0bd5('0x22')]();};}function saveUpdates(_0x13ce46,_0x4a6910){return function(_0x6ee1a8){if(_0x6ee1a8){return _0x6ee1a8['update'](_0x13ce46)[_0x0bd5('0x23')](function(_0x3b235b){return _0x3b235b;});}return null;};}function removeEntity(_0x38c21d,_0x5a8139){return function(_0x5b6dde){if(_0x5b6dde){return _0x5b6dde['destroy']()['then'](function(){_0x38c21d[_0x0bd5('0x18')](0xcc)[_0x0bd5('0x19')]();});}};}function handleEntityNotFound(_0x184db3,_0x4fde84){return function(_0x42428c){if(!_0x42428c){_0x184db3['sendStatus'](0x194);}return _0x42428c;};}function handleError(_0x456e87,_0x3ffb08){_0x3ffb08=_0x3ffb08||0x1f4;return function(_0x18cec3){logger[_0x0bd5('0x24')](_0x18cec3[_0x0bd5('0x25')]);if(_0x18cec3[_0x0bd5('0x26')]){delete _0x18cec3[_0x0bd5('0x26')];}_0x456e87[_0x0bd5('0x18')](_0x3ffb08)[_0x0bd5('0x27')](_0x18cec3);};}exports[_0x0bd5('0x28')]=function(_0x15561b,_0xcbfc51){var _0x2e10ce={},_0x2704ee={},_0x5e5a33={'count':0x0,'rows':[]};var _0x461ae3=_[_0x0bd5('0x29')](db['ScreenRecording'][_0x0bd5('0x2a')],function(_0x8eccc9){return{'name':_0x8eccc9['fieldName'],'type':_0x8eccc9[_0x0bd5('0x2b')][_0x0bd5('0x2c')]};});_0x2704ee[_0x0bd5('0x2d')]=_[_0x0bd5('0x2e')](_['map'](_0x461ae3,_0x0bd5('0x26')),[_0x0bd5('0x2f')]);_0x2704ee[_0x0bd5('0x30')]=_[_0x0bd5('0x31')](_0x15561b[_0x0bd5('0x30')]);_0x2704ee[_0x0bd5('0x32')]=_['intersection'](_0x2704ee[_0x0bd5('0x2d')],_0x2704ee['query']);_0x2e10ce[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x2704ee[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x35')]));_0x2e10ce[_0x0bd5('0x33')]=_0x2e10ce[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x2e10ce[_0x0bd5('0x33')]:_0x2704ee[_0x0bd5('0x2d')];if(!_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x37')]('nolimit')){_0x2e10ce[_0x0bd5('0x1c')]=qs[_0x0bd5('0x1c')](_0x15561b['query']['limit']);_0x2e10ce[_0x0bd5('0x1b')]=qs[_0x0bd5('0x1b')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x1b')]);}_0x2e10ce[_0x0bd5('0x38')]=qs[_0x0bd5('0x39')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x39')]);_0x2e10ce[_0x0bd5('0x3a')]=qs[_0x0bd5('0x32')](_[_0x0bd5('0x3b')](_0x15561b[_0x0bd5('0x30')],_0x2704ee[_0x0bd5('0x32')]),_0x461ae3);if(_0x15561b['query'][_0x0bd5('0x3c')]){_0x2e10ce['where']=_[_0x0bd5('0x3d')](_0x2e10ce[_0x0bd5('0x3a')],{'$or':_[_0x0bd5('0x29')](_0x461ae3,function(_0x1fcc49){if(_0x1fcc49[_0x0bd5('0x2b')]!==_0x0bd5('0x3e')){var _0x53a682={};_0x53a682[_0x1fcc49[_0x0bd5('0x26')]]={'$like':'%'+_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x3c')]+'%'};return _0x53a682;}})});}_0x2e10ce=_[_0x0bd5('0x3d')]({},_0x2e10ce,_0x15561b[_0x0bd5('0x3f')]);var _0x493089={'where':_0x2e10ce[_0x0bd5('0x3a')]};return db[_0x0bd5('0x40')][_0x0bd5('0x1e')](_0x493089)['then'](function(_0x177aa3){_0x5e5a33['count']=_0x177aa3;if(_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x41')]){_0x2e10ce['include']=[{'all':!![]}];}return db[_0x0bd5('0x40')][_0x0bd5('0x42')](_0x2e10ce);})[_0x0bd5('0x23')](function(_0x3ec4b0){_0x5e5a33[_0x0bd5('0x43')]=_0x3ec4b0;return _0x5e5a33;})[_0x0bd5('0x23')](respondWithFilteredResult(_0xcbfc51,_0x2e10ce))[_0x0bd5('0x44')](handleError(_0xcbfc51,null));};exports['show']=function(_0x4d3ca5,_0x994f24){var _0x545b63={'raw':![],'where':{'id':_0x4d3ca5[_0x0bd5('0x45')]['id']}},_0x5dd42b={};_0x5dd42b[_0x0bd5('0x2d')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x5dd42b[_0x0bd5('0x30')]=_['keys'](_0x4d3ca5['query']);_0x5dd42b[_0x0bd5('0x32')]=_[_0x0bd5('0x34')](_0x5dd42b['model'],_0x5dd42b['query']);_0x545b63[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x5dd42b[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x4d3ca5['query'][_0x0bd5('0x35')]));_0x545b63[_0x0bd5('0x33')]=_0x545b63[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x545b63[_0x0bd5('0x33')]:_0x5dd42b[_0x0bd5('0x2d')];if(_0x4d3ca5['query'][_0x0bd5('0x41')]){_0x545b63[_0x0bd5('0x46')]=[{'all':!![]}];}_0x545b63=_[_0x0bd5('0x3d')]({},_0x545b63,_0x4d3ca5['options']);return db[_0x0bd5('0x40')][_0x0bd5('0x47')](_0x545b63)[_0x0bd5('0x23')](handleEntityNotFound(_0x994f24,null))['then'](respondWithResult(_0x994f24,null))[_0x0bd5('0x44')](handleError(_0x994f24,null));};exports[_0x0bd5('0x48')]=function(_0x54cd78,_0x18c7c7){return db[_0x0bd5('0x40')]['create'](_0x54cd78[_0x0bd5('0x49')],{})[_0x0bd5('0x23')](respondWithResult(_0x18c7c7,0xc9))['catch'](handleError(_0x18c7c7,null));};exports[_0x0bd5('0x4a')]=function(_0x20960a,_0x146bdc){if(_0x20960a[_0x0bd5('0x49')]['id']){delete _0x20960a[_0x0bd5('0x49')]['id'];}delete _0x20960a['body'][_0x0bd5('0x4b')];delete _0x20960a[_0x0bd5('0x49')]['createdAt'];delete _0x20960a[_0x0bd5('0x49')]['closedAt'];delete _0x20960a[_0x0bd5('0x49')][_0x0bd5('0x4c')];return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x20960a['params']['id']}})[_0x0bd5('0x23')](handleEntityNotFound(_0x146bdc,null))['then'](saveUpdates(_0x20960a['body'],null))[_0x0bd5('0x23')](respondWithResult(_0x146bdc,null))[_0x0bd5('0x44')](handleError(_0x146bdc,null));};exports[_0x0bd5('0x4d')]=function(_0x4c9a79,_0x424187){return db['ScreenRecording'][_0x0bd5('0x4d')]()[_0x0bd5('0x23')](respondWithResult(_0x424187,null))[_0x0bd5('0x44')](handleError(_0x424187,null));};exports['download']=function(_0x512fe3,_0x4f0467,_0x122f84){var _0x21db5d=require(_0x0bd5('0x4e'));var _0x5b06c6=![];var _0x2b174a={};if(_0x512fe3[_0x0bd5('0x30')]['type']&&_0x512fe3[_0x0bd5('0x30')]['type']==='uniqueid'){_0x2b174a[_0x0bd5('0x4f')]=_0x512fe3[_0x0bd5('0x45')]['id'];}else{_0x2b174a['id']=_0x512fe3[_0x0bd5('0x45')]['id'];}return db[_0x0bd5('0x40')]['find']({'where':_0x2b174a,'attributes':['id',_0x0bd5('0x4c')],'raw':!![]})[_0x0bd5('0x23')](handleEntityNotFound(_0x4f0467,null))[_0x0bd5('0x23')](function(_0x5cf2f2){if(_0x5cf2f2){var _0x504e46=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],'server/files/screen_recordings',_0x5cf2f2['value']);var _0x2b11e8=util['format'](_0x0bd5('0x52'),_0x504e46);if(fs[_0x0bd5('0x53')](_0x2b11e8)){_0x5b06c6=!![];return _0x21db5d[_0x0bd5('0x54')](_0x2b11e8,_0x504e46,config['secrets'][_0x0bd5('0x55')])[_0x0bd5('0x23')](function(){return _0x5cf2f2;});}return _0x5cf2f2;}})[_0x0bd5('0x23')](function(_0x38aae5){if(_0x38aae5){var _0x5e93fa=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],_0x0bd5('0x56'),_0x38aae5[_0x0bd5('0x4c')]);if(!fs[_0x0bd5('0x53')](_0x5e93fa)){throw new db['Sequelize'][(_0x0bd5('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x38aae5[_0x0bd5('0x58')]){return _0x4f0467['download'](_0x5e93fa,_0x38aae5['filename']+path[_0x0bd5('0x59')](_0x5e93fa),function(){if(_0x5b06c6){fs['unlink'](_0x5e93fa);}});}else{return _0x4f0467[_0x0bd5('0x5a')](_0x5e93fa,function(_0x3087de){if(_0x5b06c6){fs[_0x0bd5('0x5b')](_0x5e93fa);}});}}})['catch'](function(_0x4f7e86){if(_0x4f7e86[_0x0bd5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x4f0467[_0x0bd5('0x18')](0x194)[_0x0bd5('0x27')]('Not\x20found');}else{return handleError(_0x4f0467,null);}});};exports[_0x0bd5('0x5d')]=function(_0x5a38b1,_0x45ccf5){return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x5a38b1[_0x0bd5('0x45')]['id']}})[_0x0bd5('0x23')](function(_0x467488){if(_[_0x0bd5('0x5e')](_0x467488)){throw new ReferenceError('Entity\x20not\x20found');}return _0x467488;})[_0x0bd5('0x23')](function(_0x1e5e7d){var _0x33c5eb=path['join'](config['root'],_0x0bd5('0x56'),_0x1e5e7d[_0x0bd5('0x4c')]);logger[_0x0bd5('0x5f')](_0x0bd5('0x60'),_0x33c5eb);if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs[_0x0bd5('0x63')](_0x33c5eb);}_0x33c5eb=_0x33c5eb+_0x0bd5('0x64');if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs['unlinkSync'](_0x33c5eb);}return _0x1e5e7d;})[_0x0bd5('0x23')](function(_0x32eaaf){if(!_0x32eaaf)throw new InternalError();return _0x32eaaf['destroy']();})[_0x0bd5('0x23')](function(){_0x45ccf5['status'](0xcc)[_0x0bd5('0x19')]();})[_0x0bd5('0x44')](handleError(_0x45ccf5,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 4a986f2..b1af96a 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 _0x122a=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid'];(function(_0x383e34,_0x46a499){var _0x319e3b=function(_0x23b52b){while(--_0x23b52b){_0x383e34['push'](_0x383e34['shift']());}};_0x319e3b(++_0x46a499);}(_0x122a,0x180));var _0xa122=function(_0x5c39a3,_0x392ccb){_0x5c39a3=_0x5c39a3-0x0;var _0x3b7d9e=_0x122a[_0x5c39a3];return _0x3b7d9e;};'use strict';var _=require(_0xa122('0x0'));var util=require('util');var logger=require(_0xa122('0x1'))(_0xa122('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa122('0x3'));var fs=require('fs');var path=require(_0xa122('0x4'));var rimraf=require(_0xa122('0x5'));var config=require(_0xa122('0x6'));var attributes=require(_0xa122('0x7'));module[_0xa122('0x8')]=function(_0x377329,_0xba5462){return _0x377329[_0xa122('0x9')]('ScreenRecording',attributes,{'tableName':_0xa122('0xa'),'paranoid':![],'indexes':[{'name':_0xa122('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4fac=['screen_recordings','interactionid','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x2761eb,_0x273dc7){var _0x4f8d90=function(_0x56df2d){while(--_0x56df2d){_0x2761eb['push'](_0x2761eb['shift']());}};_0x4f8d90(++_0x273dc7);}(_0x4fac,0x1ee));var _0xc4fa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4fac[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc4fa('0x0'));var util=require(_0xc4fa('0x1'));var logger=require(_0xc4fa('0x2'))('api');var moment=require(_0xc4fa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc4fa('0x4'));var config=require(_0xc4fa('0x5'));var attributes=require(_0xc4fa('0x6'));module[_0xc4fa('0x7')]=function(_0x4d26f2,_0x2ff8fd){return _0x4d26f2[_0xc4fa('0x8')](_0xc4fa('0x9'),attributes,{'tableName':_0xc4fa('0xa'),'paranoid':![],'indexes':[{'name':_0xc4fa('0xb'),'fields':[_0xc4fa('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 93bed27..3f97937 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 _0x07ed=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util'];(function(_0x37b1d5,_0x3b14dd){var _0x246576=function(_0x35a478){while(--_0x35a478){_0x37b1d5['push'](_0x37b1d5['shift']());}};_0x246576(++_0x3b14dd);}(_0x07ed,0x1de));var _0xd07e=function(_0x5eba32,_0x514993){_0x5eba32=_0x5eba32-0x0;var _0x36c6c7=_0x07ed[_0x5eba32];return _0x36c6c7;};'use strict';var _=require(_0xd07e('0x0'));var util=require(_0xd07e('0x1'));var moment=require(_0xd07e('0x2'));var BPromise=require(_0xd07e('0x3'));var rs=require(_0xd07e('0x4'));var fs=require('fs');var Redis=require(_0xd07e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd07e('0x6'));var logger=require(_0xd07e('0x7'))(_0xd07e('0x8'));var config=require(_0xd07e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd07e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5967f2,_0x330450,_0x52333d){return new BPromise(function(_0x5c51d6,_0xf3c195){return client[_0xd07e('0xb')](_0x5967f2,_0x52333d)[_0xd07e('0xc')](function(_0x4ecbd3){logger['info'](_0xd07e('0xd'),_0x330450,_0xd07e('0xe'));logger[_0xd07e('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x330450,_0xd07e('0xe'),JSON[_0xd07e('0x10')](_0x4ecbd3));if(_0x4ecbd3[_0xd07e('0x11')]){if(_0x4ecbd3['error']['code']===0x1f4){logger[_0xd07e('0x11')](_0xd07e('0xd'),_0x330450,_0x4ecbd3[_0xd07e('0x11')]['message']);return _0xf3c195(_0x4ecbd3[_0xd07e('0x11')][_0xd07e('0x12')]);}logger[_0xd07e('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x330450,_0x4ecbd3[_0xd07e('0x11')][_0xd07e('0x12')]);return _0x5c51d6(_0x4ecbd3[_0xd07e('0x11')]['message']);}else{logger['info'](_0xd07e('0xd'),_0x330450,_0xd07e('0xe'));_0x5c51d6(_0x4ecbd3[_0xd07e('0x13')][_0xd07e('0x12')]);}})['catch'](function(_0x231077){logger[_0xd07e('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x330450,_0x231077);_0xf3c195(_0x231077);});});} \ No newline at end of file +var _0xeec3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x35e71e,_0xfecbe5){var _0x5cca33=function(_0x5ccf64){while(--_0x5ccf64){_0x35e71e['push'](_0x35e71e['shift']());}};_0x5cca33(++_0xfecbe5);}(_0xeec3,0x1db));var _0x3eec=function(_0x32b1c7,_0x379fc0){_0x32b1c7=_0x32b1c7-0x0;var _0x4c5e05=_0xeec3[_0x32b1c7];return _0x4c5e05;};'use strict';var _=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var moment=require(_0x3eec('0x2'));var BPromise=require(_0x3eec('0x3'));var rs=require(_0x3eec('0x4'));var fs=require('fs');var Redis=require(_0x3eec('0x5'));var db=require(_0x3eec('0x6'))['db'];var utils=require(_0x3eec('0x7'));var logger=require(_0x3eec('0x8'))('rpc');var config=require(_0x3eec('0x9'));var jayson=require(_0x3eec('0xa'));var client=jayson[_0x3eec('0xb')][_0x3eec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23fa2b,_0x112063,_0x368253){return new BPromise(function(_0x25bf8b,_0x2627c3){return client[_0x3eec('0xd')](_0x23fa2b,_0x368253)[_0x3eec('0xe')](function(_0x31bcf3){logger[_0x3eec('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x112063,_0x3eec('0x10'));logger['debug'](_0x3eec('0x11'),_0x112063,_0x3eec('0x10'),JSON[_0x3eec('0x12')](_0x31bcf3));if(_0x31bcf3[_0x3eec('0x13')]){if(_0x31bcf3['error'][_0x3eec('0x14')]===0x1f4){logger['error'](_0x3eec('0x15'),_0x112063,_0x31bcf3[_0x3eec('0x13')]['message']);return _0x2627c3(_0x31bcf3[_0x3eec('0x13')]['message']);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x112063,_0x31bcf3[_0x3eec('0x13')][_0x3eec('0x16')]);return _0x25bf8b(_0x31bcf3['error'][_0x3eec('0x16')]);}else{logger['info'](_0x3eec('0x15'),_0x112063,_0x3eec('0x10'));_0x25bf8b(_0x31bcf3[_0x3eec('0x17')]['message']);}})['catch'](function(_0x2d853e){logger[_0x3eec('0x13')](_0x3eec('0x15'),_0x112063,_0x2d853e);_0x2627c3(_0x2d853e);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c8083a6..49ab4af 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 _0xec14=['/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','file','addLogo','format','logologin','addPreferred','favicon','addFavicon','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show'];(function(_0x25446b,_0x5d05aa){var _0x11409e=function(_0x605863){while(--_0x605863){_0x25446b['push'](_0x25446b['shift']());}};_0x11409e(++_0x5d05aa);}(_0xec14,0x7c));var _0x4ec1=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xec14[_0x25248b];return _0x509939;};'use strict';var multer=require(_0x4ec1('0x0'));var util=require(_0x4ec1('0x1'));var path=require(_0x4ec1('0x2'));var timeout=require(_0x4ec1('0x3'));var express=require(_0x4ec1('0x4'));var router=express[_0x4ec1('0x5')]();var fs_extra=require(_0x4ec1('0x6'));var auth=require(_0x4ec1('0x7'));var interaction=require(_0x4ec1('0x8'));var config=require(_0x4ec1('0x9'));var controller=require(_0x4ec1('0xa'));router[_0x4ec1('0xb')]('/',auth[_0x4ec1('0xc')](),controller[_0x4ec1('0xd')]);router[_0x4ec1('0xb')](_0x4ec1('0xe'),controller[_0x4ec1('0xf')]);router[_0x4ec1('0xb')]('/:id',controller[_0x4ec1('0x10')]);router[_0x4ec1('0xb')](_0x4ec1('0x11'),controller[_0x4ec1('0x12')]);router[_0x4ec1('0xb')](_0x4ec1('0x13'),controller[_0x4ec1('0x14')]);router[_0x4ec1('0xb')](_0x4ec1('0x15'),controller[_0x4ec1('0x16')]);router['get'](_0x4ec1('0x17'),controller['getPreferred']);router[_0x4ec1('0xb')](_0x4ec1('0x18'),controller[_0x4ec1('0x19')]);var upload=multer({'storage':multer[_0x4ec1('0x1a')]({'destination':function(_0x2af9a2,_0x1736e6,_0x57477b){_0x57477b(null,path[_0x4ec1('0x1b')](config[_0x4ec1('0x1c')],_0x4ec1('0x1d')));},'filename':function(_0x4f7f3e,_0x84e0cf,_0x56c96f){_0x56c96f(null,util['format'](_0x4ec1('0x1e'),_0x4ec1('0x1f'),path[_0x4ec1('0x20')](_0x84e0cf[_0x4ec1('0x21')])));}})});router[_0x4ec1('0x22')](_0x4ec1('0x11'),upload[_0x4ec1('0x23')](_0x4ec1('0x24')),controller[_0x4ec1('0x25')]);var upload=multer({'storage':multer[_0x4ec1('0x1a')]({'destination':function(_0x5ddef6,_0x172980,_0x2514ae){_0x2514ae(null,path[_0x4ec1('0x1b')](config[_0x4ec1('0x1c')],_0x4ec1('0x1d')));},'filename':function(_0x1b48b4,_0x971ce2,_0x115454){_0x115454(null,util[_0x4ec1('0x26')](_0x4ec1('0x1e'),_0x4ec1('0x27'),path[_0x4ec1('0x20')](_0x971ce2[_0x4ec1('0x21')])));}})});router[_0x4ec1('0x22')](_0x4ec1('0x13'),upload[_0x4ec1('0x23')](_0x4ec1('0x24')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x4ec1('0x1a')]({'destination':function(_0x34fa07,_0x46f01b,_0x377bff){_0x377bff(null,path[_0x4ec1('0x1b')](config['root'],_0x4ec1('0x1d')));},'filename':function(_0x178454,_0x26ef10,_0x1d5c8f){_0x1d5c8f(null,util['format'](_0x4ec1('0x1e'),'preferred',path['extname'](_0x26ef10['originalname'])));}})});router[_0x4ec1('0x22')](_0x4ec1('0x17'),upload['single'](_0x4ec1('0x24')),controller[_0x4ec1('0x28')]);var upload=multer({'storage':multer[_0x4ec1('0x1a')]({'destination':function(_0x17b89a,_0x2ac914,_0x104c8d){_0x104c8d(null,path[_0x4ec1('0x1b')](config[_0x4ec1('0x1c')],_0x4ec1('0x1d')));},'filename':function(_0x18e306,_0x202969,_0xd468b0){_0xd468b0(null,util[_0x4ec1('0x26')](_0x4ec1('0x1e'),_0x4ec1('0x29'),path[_0x4ec1('0x20')](_0x202969[_0x4ec1('0x21')])));}})});router['post'](_0x4ec1('0x18'),upload[_0x4ec1('0x23')](_0x4ec1('0x24')),controller[_0x4ec1('0x2a')]);router[_0x4ec1('0x2b')](_0x4ec1('0x2c'),auth[_0x4ec1('0xc')](),controller[_0x4ec1('0x2d')]);module[_0x4ec1('0x2e')]=router; \ No newline at end of file +var _0x2975=['addLogo','format','file','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','put','isAuthenticated','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single'];(function(_0x24868f,_0x373433){var _0x401096=function(_0x1cd967){while(--_0x1cd967){_0x24868f['push'](_0x24868f['shift']());}};_0x401096(++_0x373433);}(_0x2975,0x1a5));var _0x5297=function(_0x184b2e,_0x1f9bbb){_0x184b2e=_0x184b2e-0x0;var _0x1686b0=_0x2975[_0x184b2e];return _0x1686b0;};'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('./setting.controller');router[_0x5297('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5297('0x8')](_0x5297('0x9'),controller[_0x5297('0xa')]);router[_0x5297('0x8')](_0x5297('0xb'),controller['show']);router[_0x5297('0x8')](_0x5297('0xc'),controller[_0x5297('0xd')]);router[_0x5297('0x8')](_0x5297('0xe'),controller[_0x5297('0xf')]);router[_0x5297('0x8')]('/:id/gdpr',controller[_0x5297('0x10')]);router[_0x5297('0x8')]('/:id/preferred',controller[_0x5297('0x11')]);router['get'](_0x5297('0x12'),controller[_0x5297('0x13')]);var upload=multer({'storage':multer[_0x5297('0x14')]({'destination':function(_0x15a0eb,_0x1e0ec5,_0x4a6cfa){_0x4a6cfa(null,path[_0x5297('0x15')](config[_0x5297('0x16')],_0x5297('0x17')));},'filename':function(_0xfb7eaf,_0xb0ed14,_0x5d39a5){_0x5d39a5(null,util['format'](_0x5297('0x18'),_0x5297('0x19'),path[_0x5297('0x1a')](_0xb0ed14[_0x5297('0x1b')])));}})});router[_0x5297('0x1c')](_0x5297('0xc'),upload[_0x5297('0x1d')]('file'),controller[_0x5297('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3833b6,_0xd76ab3,_0x39a239){_0x39a239(null,path['join'](config[_0x5297('0x16')],_0x5297('0x17')));},'filename':function(_0x586452,_0x5e0d1f,_0xf51854){_0xf51854(null,util[_0x5297('0x1f')]('%s%s','logologin',path[_0x5297('0x1a')](_0x5e0d1f[_0x5297('0x1b')])));}})});router['post'](_0x5297('0xe'),upload[_0x5297('0x1d')](_0x5297('0x20')),controller[_0x5297('0x21')]);var upload=multer({'storage':multer[_0x5297('0x14')]({'destination':function(_0x220877,_0x4bf664,_0x3ac4bb){_0x3ac4bb(null,path['join'](config[_0x5297('0x16')],'server/files/images/logos/'));},'filename':function(_0xaf5b9f,_0x14e4e8,_0x483e32){_0x483e32(null,util[_0x5297('0x1f')]('%s%s',_0x5297('0x22'),path['extname'](_0x14e4e8[_0x5297('0x1b')])));}})});router[_0x5297('0x1c')](_0x5297('0x23'),upload[_0x5297('0x1d')](_0x5297('0x20')),controller[_0x5297('0x24')]);var upload=multer({'storage':multer[_0x5297('0x14')]({'destination':function(_0x2dd058,_0x121da2,_0x19c0fc){_0x19c0fc(null,path[_0x5297('0x15')](config[_0x5297('0x16')],_0x5297('0x17')));},'filename':function(_0x32c826,_0x313c9d,_0x53b9d3){_0x53b9d3(null,util[_0x5297('0x1f')](_0x5297('0x18'),_0x5297('0x25'),path['extname'](_0x313c9d[_0x5297('0x1b')])));}})});router[_0x5297('0x1c')](_0x5297('0x12'),upload[_0x5297('0x1d')](_0x5297('0x20')),controller['addFavicon']);router[_0x5297('0x26')]('/:id',auth[_0x5297('0x27')](),controller[_0x5297('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f628d6d..aac9da3 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x462bdf,_0x1dbbd9){var _0x5e0373=function(_0x3f02a0){while(--_0x3f02a0){_0x462bdf['push'](_0x462bdf['shift']());}};_0x5e0373(++_0x1dbbd9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x97385b,_0x1babc9){var _0x5712e9=function(_0x452426){while(--_0x452426){_0x97385b['push'](_0x97385b['shift']());}};_0x5712e9(++_0x1babc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6ad7efe..cf5ac02 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 _0x4680=['gdpr','securePassword','../../config/license/util','getPreferred','default_preferred.png','getFavicon','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Setting','include','findAll','show','keys','includeAll','find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','preferred','defaultLoginLogo','default_loginLogo.svg','custom'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4680,0x106));var _0x0468=function(_0x13b0e0,_0x204d71){_0x13b0e0=_0x13b0e0-0x0;var _0x1c15e5=_0x4680[_0x13b0e0];return _0x1c15e5;};'use strict';var emlformat=require(_0x0468('0x0'));var rimraf=require(_0x0468('0x1'));var zipdir=require(_0x0468('0x2'));var jsonpatch=require(_0x0468('0x3'));var rp=require('request-promise');var moment=require(_0x0468('0x4'));var BPromise=require(_0x0468('0x5'));var Mustache=require(_0x0468('0x6'));var util=require(_0x0468('0x7'));var path=require(_0x0468('0x8'));var sox=require(_0x0468('0x9'));var csv=require(_0x0468('0xa'));var ejs=require(_0x0468('0xb'));var fs=require('fs');var fs_extra=require(_0x0468('0xc'));var _=require('lodash');var squel=require(_0x0468('0xd'));var crypto=require(_0x0468('0xe'));var jsforce=require(_0x0468('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0468('0xa'));var querystring=require(_0x0468('0x10'));var Papa=require(_0x0468('0x11'));var Redis=require(_0x0468('0x12'));var authService=require(_0x0468('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0468('0x14'));var hardwareService=require(_0x0468('0x15'));var logger=require('../../config/logger')(_0x0468('0x16'));var utils=require('../../config/utils');var config=require(_0x0468('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0468('0x18'))['db'];var jayson=require(_0x0468('0x19'));var client=jayson[_0x0468('0x1a')][_0x0468('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x20c3fa,_0x3fee51,_0x37dd5a,_0x2fa8b4){return new BPromise(function(_0x1cf0a0,_0x2f583f){var _0x36ed72=_0x2fa8b4||client;return _0x36ed72[_0x0468('0x1c')](_0x20c3fa,_0x37dd5a)['then'](function(_0x12537a){logger[_0x0468('0x1d')]('Setting,\x20%s,\x20%s',_0x3fee51,_0x0468('0x1e'));logger[_0x0468('0x1f')](_0x0468('0x20'),_0x3fee51,_0x0468('0x1e'),JSON['stringify'](_0x12537a));if(_0x12537a[_0x0468('0x21')]){if(_0x12537a[_0x0468('0x21')][_0x0468('0x22')]===0x1f4){logger[_0x0468('0x21')](_0x0468('0x23'),_0x3fee51,_0x12537a[_0x0468('0x21')][_0x0468('0x24')]);return _0x2f583f(_0x12537a['error'][_0x0468('0x24')]);}logger[_0x0468('0x21')](_0x0468('0x23'),_0x3fee51,_0x12537a[_0x0468('0x21')][_0x0468('0x24')]);return _0x1cf0a0(_0x12537a[_0x0468('0x21')][_0x0468('0x24')]);}else{logger[_0x0468('0x1d')]('Setting,\x20%s,\x20%s',_0x3fee51,'request\x20sent');_0x1cf0a0(_0x12537a[_0x0468('0x25')][_0x0468('0x24')]);}})[_0x0468('0x26')](function(_0xf2ea57){logger[_0x0468('0x21')](_0x0468('0x23'),_0x3fee51,_0xf2ea57);_0x2f583f(_0xf2ea57);});});}function respondWithStatusCode(_0x5d9330,_0x57a232){_0x57a232=_0x57a232||0xcc;return function(_0x4cbbdf){if(_0x4cbbdf){return _0x5d9330[_0x0468('0x27')](_0x57a232);}return _0x5d9330[_0x0468('0x28')](_0x57a232)[_0x0468('0x29')]();};}function respondWithResult(_0x3d6042,_0x639946){_0x639946=_0x639946||0xc8;return function(_0x23e772){if(_0x23e772){return _0x3d6042['status'](_0x639946)['json'](_0x23e772);}};}function respondWithFilteredResult(_0x3b9d1f,_0x3d36a1){return function(_0x57c1cd){if(_0x57c1cd){var _0x203b69=typeof _0x3d36a1[_0x0468('0x2a')]===_0x0468('0x2b')&&typeof _0x3d36a1[_0x0468('0x2c')]===_0x0468('0x2b');var _0x17929b=_0x57c1cd[_0x0468('0x2d')];var _0x4097fd=_0x203b69?0x0:_0x3d36a1[_0x0468('0x2a')];var _0x240782=_0x203b69?_0x57c1cd['count']:_0x3d36a1[_0x0468('0x2a')]+_0x3d36a1[_0x0468('0x2c')];var _0x2e2089;if(_0x240782>=_0x17929b){_0x240782=_0x17929b;_0x2e2089=0xc8;}else{_0x2e2089=0xce;}_0x3b9d1f[_0x0468('0x28')](_0x2e2089);return _0x3b9d1f[_0x0468('0x2e')](_0x0468('0x2f'),_0x4097fd+'-'+_0x240782+'/'+_0x17929b)['json'](_0x57c1cd);}return null;};}function patchUpdates(_0xf921ce){return function(_0x51424d){try{jsonpatch[_0x0468('0x30')](_0x51424d,_0xf921ce,!![]);}catch(_0x1a8c4b){return BPromise['reject'](_0x1a8c4b);}return _0x51424d[_0x0468('0x31')]();};}function saveUpdates(_0x5d4391,_0x574888){return function(_0x4a6668){if(_0x4a6668){return _0x4a6668[_0x0468('0x32')](_0x5d4391)[_0x0468('0x33')](function(_0x3d42f3){return _0x3d42f3;});}return null;};}function removeEntity(_0x48afc8,_0x3510bb){return function(_0x2c9558){if(_0x2c9558){return _0x2c9558[_0x0468('0x34')]()[_0x0468('0x33')](function(){_0x48afc8[_0x0468('0x28')](0xcc)[_0x0468('0x29')]();});}};}function handleEntityNotFound(_0x241d3e,_0x882dd1){return function(_0x1caad1){if(!_0x1caad1){_0x241d3e[_0x0468('0x27')](0x194);}return _0x1caad1;};}function handleError(_0x2b387d,_0x56ded6){_0x56ded6=_0x56ded6||0x1f4;return function(_0x515fca){logger[_0x0468('0x21')](_0x515fca[_0x0468('0x35')]);if(_0x515fca[_0x0468('0x36')]){delete _0x515fca['name'];}_0x2b387d[_0x0468('0x28')](_0x56ded6)['send'](_0x515fca);};}exports[_0x0468('0x37')]=function(_0x10dcef,_0x5ac02b){var _0x1bfbc4={},_0x3b61cc={},_0x45f00a={'count':0x0,'rows':[]};var _0x8baaa1=_['map'](db['Setting'][_0x0468('0x38')],function(_0x109a5f){return{'name':_0x109a5f[_0x0468('0x39')],'type':_0x109a5f[_0x0468('0x3a')][_0x0468('0x3b')]};});_0x3b61cc[_0x0468('0x3c')]=_['map'](_0x8baaa1,_0x0468('0x36'));_0x3b61cc['query']=_['keys'](_0x10dcef[_0x0468('0x3d')]);_0x3b61cc[_0x0468('0x3e')]=_['intersection'](_0x3b61cc[_0x0468('0x3c')],_0x3b61cc[_0x0468('0x3d')]);_0x1bfbc4['attributes']=_[_0x0468('0x3f')](_0x3b61cc['model'],qs[_0x0468('0x40')](_0x10dcef[_0x0468('0x3d')][_0x0468('0x40')]));_0x1bfbc4[_0x0468('0x41')]=_0x1bfbc4['attributes'][_0x0468('0x42')]?_0x1bfbc4['attributes']:_0x3b61cc[_0x0468('0x3c')];if(!_0x10dcef[_0x0468('0x3d')][_0x0468('0x43')](_0x0468('0x44'))){_0x1bfbc4[_0x0468('0x2c')]=qs[_0x0468('0x2c')](_0x10dcef[_0x0468('0x3d')]['limit']);_0x1bfbc4[_0x0468('0x2a')]=qs[_0x0468('0x2a')](_0x10dcef[_0x0468('0x3d')]['offset']);}_0x1bfbc4[_0x0468('0x45')]=qs[_0x0468('0x46')](_0x10dcef[_0x0468('0x3d')]['sort']);_0x1bfbc4['where']=qs['filters'](_[_0x0468('0x47')](_0x10dcef['query'],_0x3b61cc[_0x0468('0x3e')]),_0x8baaa1);if(_0x10dcef[_0x0468('0x3d')][_0x0468('0x48')]){_0x1bfbc4[_0x0468('0x49')]=_[_0x0468('0x4a')](_0x1bfbc4['where'],{'$or':_['map'](_0x8baaa1,function(_0x491e6e){if(_0x491e6e[_0x0468('0x3a')]!=='VIRTUAL'){var _0x3746ce={};_0x3746ce[_0x491e6e[_0x0468('0x36')]]={'$like':'%'+_0x10dcef['query'][_0x0468('0x48')]+'%'};return _0x3746ce;}})});}_0x1bfbc4=_[_0x0468('0x4a')]({},_0x1bfbc4,_0x10dcef[_0x0468('0x4b')]);var _0x26fbc4={'where':_0x1bfbc4[_0x0468('0x49')]};return db[_0x0468('0x4c')][_0x0468('0x2d')](_0x26fbc4)[_0x0468('0x33')](function(_0x19516b){_0x45f00a[_0x0468('0x2d')]=_0x19516b;if(_0x10dcef[_0x0468('0x3d')]['includeAll']){_0x1bfbc4[_0x0468('0x4d')]=[{'all':!![]}];}return db[_0x0468('0x4c')][_0x0468('0x4e')](_0x1bfbc4);})['then'](function(_0x1b3fdc){_0x45f00a['rows']=_0x1b3fdc;return _0x45f00a;})['then'](respondWithFilteredResult(_0x5ac02b,_0x1bfbc4))[_0x0468('0x26')](handleError(_0x5ac02b,null));};exports[_0x0468('0x4f')]=function(_0x4bc0a1,_0x3488ed){var _0x228f29={'raw':![],'where':{'id':_0x4bc0a1['params']['id']}},_0x408ccb={};_0x408ccb['model']=_[_0x0468('0x50')](db[_0x0468('0x4c')][_0x0468('0x38')]);_0x408ccb[_0x0468('0x3d')]=_[_0x0468('0x50')](_0x4bc0a1[_0x0468('0x3d')]);_0x408ccb['filters']=_[_0x0468('0x3f')](_0x408ccb[_0x0468('0x3c')],_0x408ccb[_0x0468('0x3d')]);_0x228f29[_0x0468('0x41')]=_[_0x0468('0x3f')](_0x408ccb[_0x0468('0x3c')],qs['fields'](_0x4bc0a1[_0x0468('0x3d')][_0x0468('0x40')]));_0x228f29['attributes']=_0x228f29[_0x0468('0x41')][_0x0468('0x42')]?_0x228f29[_0x0468('0x41')]:_0x408ccb['model'];if(_0x4bc0a1[_0x0468('0x3d')][_0x0468('0x51')]){_0x228f29[_0x0468('0x4d')]=[{'all':!![]}];}_0x228f29=_[_0x0468('0x4a')]({},_0x228f29,_0x4bc0a1['options']);return db['Setting'][_0x0468('0x52')](_0x228f29)[_0x0468('0x33')](handleEntityNotFound(_0x3488ed,null))[_0x0468('0x33')](respondWithResult(_0x3488ed,null))[_0x0468('0x26')](handleError(_0x3488ed,null));};exports[_0x0468('0x32')]=function(_0x28e218,_0x27a4fe){if(_0x28e218['body']['id']){delete _0x28e218[_0x0468('0x53')]['id'];}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x28e218[_0x0468('0x54')]['id']}})['then'](handleEntityNotFound(_0x27a4fe,null))[_0x0468('0x33')](saveUpdates(_0x28e218[_0x0468('0x53')],null))[_0x0468('0x33')](respondWithResult(_0x27a4fe,null))[_0x0468('0x26')](handleError(_0x27a4fe,null));};exports[_0x0468('0x55')]=function(_0x501801,_0x2e107e,_0x1bbbea){if(_0x501801[_0x0468('0x56')]&&_0x501801['file'][_0x0468('0x57')]){_0x501801['body'][_0x0468('0x58')]=_0x501801['file']['filename'];}return db[_0x0468('0x4c')]['find']({'where':{'id':_0x501801[_0x0468('0x54')]['id']}})['then'](handleEntityNotFound(_0x2e107e,null))[_0x0468('0x33')](saveUpdates(_0x501801[_0x0468('0x53')],null))[_0x0468('0x33')](respondWithResult(_0x2e107e,null))[_0x0468('0x26')](handleError(_0x2e107e,null));};exports[_0x0468('0x59')]=function(_0x58d0ef,_0x16fb46,_0x3489c6){if(_0x58d0ef[_0x0468('0x56')]&&_0x58d0ef[_0x0468('0x56')][_0x0468('0x57')]){_0x58d0ef['body'][_0x0468('0x5a')]=_0x58d0ef[_0x0468('0x56')][_0x0468('0x57')];}return db['Setting']['find']({'where':{'id':_0x58d0ef[_0x0468('0x54')]['id']}})[_0x0468('0x33')](handleEntityNotFound(_0x16fb46,null))[_0x0468('0x33')](saveUpdates(_0x58d0ef[_0x0468('0x53')],null))['then'](respondWithResult(_0x16fb46,null))[_0x0468('0x26')](handleError(_0x16fb46,null));};var utilLicense=require('../../config/license/util');exports[_0x0468('0x5b')]=function(_0x143625,_0x3643b1,_0x121bcd){var _0x1c4538=_0x0468('0x5c');var _0x2ef05f={'custom':![]};return utilLicense[_0x0468('0x5d')]()['then'](function(_0x2cb9aa){if(_0x2cb9aa){_0x2ef05f=_0x2cb9aa;}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x143625[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),'preferred',_0x0468('0x5e'),_0x0468('0x5f'),'defaultLoginLogo',_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x3643b1,null))['then'](function(_0x1dc5ed){if(_0x1dc5ed){var _0xe01d32=_0x1dc5ed['logo']&&fs[_0x0468('0x62')](path[_0x0468('0x63')](config[_0x0468('0x64')],_0x1c4538,_[_0x0468('0x65')](_0x1dc5ed['logo'])))?path[_0x0468('0x63')](config[_0x0468('0x64')],_0x1c4538,_[_0x0468('0x65')](_0x1dc5ed[_0x0468('0x58')])):path[_0x0468('0x63')](config[_0x0468('0x64')],_0x1c4538,_[_0x0468('0x65')](_0x0468('0x66')));var _0x5267df=_0x0468('0x67')+_[_0x0468('0x68')](_0x0468('0x58'));if(_0x1dc5ed[_0x5267df]||!_0x2ef05f['custom']){_0xe01d32=path[_0x0468('0x63')](config['root'],_0x1c4538,_[_0x0468('0x65')]('default_logo.svg'));}if(!fs[_0x0468('0x62')](_0xe01d32)){throw new db[(_0x0468('0x69'))][(_0x0468('0x6a'))](_[_0x0468('0x68')](_0x0468('0x58'))+_0x0468('0x6b'));}return _0x3643b1[_0x0468('0x6c')](_0xe01d32);}})['catch'](handleError(_0x3643b1,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x87b8d6,_0x3f6015,_0x1fc857){var _0x4928bd='server/files/images/logos';var _0x1b7d48={'custom':![]};return utilLicense[_0x0468('0x5d')]()[_0x0468('0x33')](function(_0x42c077){if(_0x42c077){_0x1b7d48=_0x42c077;}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x87b8d6[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),_0x0468('0x6d'),_0x0468('0x5e'),_0x0468('0x5f'),_0x0468('0x6e'),_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})[_0x0468('0x33')](handleEntityNotFound(_0x3f6015,null))[_0x0468('0x33')](function(_0x159bca){if(_0x159bca){var _0x5a82ec=_0x159bca[_0x0468('0x5a')]&&fs[_0x0468('0x62')](path[_0x0468('0x63')](config['root'],_0x4928bd,_[_0x0468('0x65')](_0x159bca[_0x0468('0x5a')])))?path[_0x0468('0x63')](config[_0x0468('0x64')],_0x4928bd,_[_0x0468('0x65')](_0x159bca[_0x0468('0x5a')])):path[_0x0468('0x63')](config[_0x0468('0x64')],_0x4928bd,_[_0x0468('0x65')](_0x0468('0x6f')));var _0x1913d7=_0x0468('0x67')+_[_0x0468('0x68')](_0x0468('0x5a'));if(_0x159bca[_0x1913d7]||!_0x1b7d48[_0x0468('0x70')]){_0x5a82ec=path['join'](config[_0x0468('0x64')],_0x4928bd,_[_0x0468('0x65')](_0x0468('0x6f')));}if(!fs[_0x0468('0x62')](_0x5a82ec)){throw new db[(_0x0468('0x69'))][(_0x0468('0x6a'))](_['upperFirst'](_0x0468('0x5a'))+_0x0468('0x6b'));}return _0x3f6015[_0x0468('0x6c')](_0x5a82ec);}})[_0x0468('0x26')](handleError(_0x3f6015,null));};exports[_0x0468('0x71')]=function(_0x333eba,_0x419d8c){return db[_0x0468('0x4c')]['find']({'where':{'id':_0x333eba[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x72')]})[_0x0468('0x33')](respondWithResult(_0x419d8c,null))[_0x0468('0x26')](handleError(_0x419d8c,null));};exports['addPreferred']=function(_0x195933,_0x18fddc,_0x1a6ede){if(_0x195933[_0x0468('0x56')]&&_0x195933[_0x0468('0x56')][_0x0468('0x57')]){_0x195933[_0x0468('0x53')][_0x0468('0x6d')]=_0x195933[_0x0468('0x56')][_0x0468('0x57')];}return db['Setting'][_0x0468('0x52')]({'where':{'id':_0x195933[_0x0468('0x54')]['id']}})[_0x0468('0x33')](handleEntityNotFound(_0x18fddc,null))[_0x0468('0x33')](saveUpdates(_0x195933[_0x0468('0x53')],null))[_0x0468('0x33')](respondWithResult(_0x18fddc,null))[_0x0468('0x26')](handleError(_0x18fddc,null));};var utilLicense=require(_0x0468('0x73'));exports[_0x0468('0x74')]=function(_0x4bb7be,_0x402814,_0x2089d7){var _0x10cd21='server/files/images/logos';var _0x3c6828={'custom':![]};return utilLicense['getLicense']()[_0x0468('0x33')](function(_0x4a5792){if(_0x4a5792){_0x3c6828=_0x4a5792;}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x4bb7be['params']['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),_0x0468('0x6d'),_0x0468('0x5e'),'defaultLogo','defaultLoginLogo',_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})[_0x0468('0x33')](handleEntityNotFound(_0x402814,null))[_0x0468('0x33')](function(_0x5525a8){if(_0x5525a8){var _0x51f081=_0x5525a8[_0x0468('0x6d')]&&fs[_0x0468('0x62')](path['join'](config[_0x0468('0x64')],_0x10cd21,_[_0x0468('0x65')](_0x5525a8[_0x0468('0x6d')])))?path['join'](config[_0x0468('0x64')],_0x10cd21,_['toLower'](_0x5525a8[_0x0468('0x6d')])):path['join'](config['root'],_0x10cd21,_['toLower'](_0x0468('0x75')));var _0x364374=_0x0468('0x67')+_[_0x0468('0x68')]('preferred');if(_0x5525a8[_0x364374]||!_0x3c6828[_0x0468('0x70')]||!_0x3c6828['preferred']){_0x51f081=path[_0x0468('0x63')](config[_0x0468('0x64')],_0x10cd21,_['toLower']('default_preferred.png'));}if(!fs[_0x0468('0x62')](_0x51f081)){throw new db['Sequelize'][(_0x0468('0x6a'))](_['upperFirst'](_0x0468('0x6d'))+'\x20not\x20found');}return _0x402814[_0x0468('0x6c')](_0x51f081);}})[_0x0468('0x26')](handleError(_0x402814,null));};exports['addFavicon']=function(_0x737f24,_0x663f03,_0x6d2cef){if(_0x737f24['file']&&_0x737f24[_0x0468('0x56')][_0x0468('0x57')]){_0x737f24[_0x0468('0x53')][_0x0468('0x5e')]=_0x737f24['file']['filename'];}return db[_0x0468('0x4c')][_0x0468('0x52')]({'where':{'id':_0x737f24['params']['id']}})['then'](handleEntityNotFound(_0x663f03,null))[_0x0468('0x33')](saveUpdates(_0x737f24['body'],null))[_0x0468('0x33')](respondWithResult(_0x663f03,null))['catch'](handleError(_0x663f03,null));};var utilLicense=require(_0x0468('0x73'));exports[_0x0468('0x76')]=function(_0x4525af,_0x831127,_0x5686f9){var _0x3aa85c='server/files/images/logos';var _0x5909d8={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xe2ad56){if(_0xe2ad56){_0x5909d8=_0xe2ad56;}return db[_0x0468('0x4c')]['find']({'where':{'id':_0x4525af[_0x0468('0x54')]['id']},'attributes':[_0x0468('0x58'),_0x0468('0x5a'),_0x0468('0x6d'),_0x0468('0x5e'),'defaultLogo','defaultLoginLogo',_0x0468('0x60'),_0x0468('0x61')],'raw':!![]});})[_0x0468('0x33')](handleEntityNotFound(_0x831127,null))[_0x0468('0x33')](function(_0x4779a6){if(_0x4779a6){var _0xa66bc9=_0x4779a6[_0x0468('0x5e')]&&fs[_0x0468('0x62')](path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_[_0x0468('0x65')](_0x4779a6['favicon'])))?path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_['toLower'](_0x4779a6['favicon'])):path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_[_0x0468('0x65')]('default_favicon.ico'));var _0x3d79c6=_0x0468('0x67')+_[_0x0468('0x68')](_0x0468('0x5e'));if(_0x4779a6[_0x3d79c6]||!_0x5909d8[_0x0468('0x70')]){_0xa66bc9=path[_0x0468('0x63')](config[_0x0468('0x64')],_0x3aa85c,_[_0x0468('0x65')]('default_favicon.ico'));}if(!fs['existsSync'](_0xa66bc9)){throw new db[(_0x0468('0x69'))][(_0x0468('0x6a'))](_[_0x0468('0x68')]('favicon')+_0x0468('0x6b'));}return _0x831127[_0x0468('0x6c')](_0xa66bc9);}})[_0x0468('0x26')](handleError(_0x831127,null));};exports[_0x0468('0x77')]=function(_0x59485f,_0x4b21b5){var _0x2c82b5={'offset':moment()['utcOffset']()};_0x2c82b5[_0x0468('0x78')]=moment()[_0x0468('0x79')](_0x2c82b5[_0x0468('0x2a')])[_0x0468('0x7a')](_0x0468('0x7b'));return _0x4b21b5['status'](0xc8)[_0x0468('0x7c')](_0x2c82b5);}; \ No newline at end of file +var _0x9bae=['now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','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','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','update','name','send','index','map','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','fields','find','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','upperFirst','custom','ValidationError','\x20not\x20found','download','defaultPreferred','default_loginLogo.svg','default','addPreferred','preferred','getPreferred','Sequelize','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset'];(function(_0x3ac0fd,_0x2dfb0c){var _0x2670a9=function(_0x1bc374){while(--_0x1bc374){_0x3ac0fd['push'](_0x3ac0fd['shift']());}};_0x2670a9(++_0x2dfb0c);}(_0x9bae,0x7c));var _0xe9ba=function(_0x3377c2,_0x61a72c){_0x3377c2=_0x3377c2-0x0;var _0xdaa31=_0x9bae[_0x3377c2];return _0xdaa31;};'use strict';var emlformat=require(_0xe9ba('0x0'));var rimraf=require(_0xe9ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9ba('0x2'));var rp=require(_0xe9ba('0x3'));var moment=require(_0xe9ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9ba('0x5'));var util=require(_0xe9ba('0x6'));var path=require(_0xe9ba('0x7'));var sox=require('sox');var csv=require(_0xe9ba('0x8'));var ejs=require(_0xe9ba('0x9'));var fs=require('fs');var fs_extra=require(_0xe9ba('0xa'));var _=require(_0xe9ba('0xb'));var squel=require(_0xe9ba('0xc'));var crypto=require(_0xe9ba('0xd'));var jsforce=require(_0xe9ba('0xe'));var deskjs=require(_0xe9ba('0xf'));var toCsv=require(_0xe9ba('0x8'));var querystring=require(_0xe9ba('0x10'));var Papa=require('papaparse');var Redis=require(_0xe9ba('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe9ba('0x12'));var as=require(_0xe9ba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9ba('0x14'))(_0xe9ba('0x15'));var utils=require(_0xe9ba('0x16'));var config=require(_0xe9ba('0x17'));var licenseUtil=require(_0xe9ba('0x18'));var db=require(_0xe9ba('0x19'))['db'];var jayson=require(_0xe9ba('0x1a'));var client=jayson[_0xe9ba('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ff854,_0x6edc7,_0x137af5,_0x1ea690){return new BPromise(function(_0x517bdd,_0x482dbc){var _0x34bae6=_0x1ea690||client;return _0x34bae6[_0xe9ba('0x1c')](_0x2ff854,_0x137af5)[_0xe9ba('0x1d')](function(_0x48247d){logger[_0xe9ba('0x1e')](_0xe9ba('0x1f'),_0x6edc7,_0xe9ba('0x20'));logger[_0xe9ba('0x21')](_0xe9ba('0x22'),_0x6edc7,_0xe9ba('0x20'),JSON[_0xe9ba('0x23')](_0x48247d));if(_0x48247d[_0xe9ba('0x24')]){if(_0x48247d[_0xe9ba('0x24')][_0xe9ba('0x25')]===0x1f4){logger['error'](_0xe9ba('0x1f'),_0x6edc7,_0x48247d[_0xe9ba('0x24')][_0xe9ba('0x26')]);return _0x482dbc(_0x48247d['error'][_0xe9ba('0x26')]);}logger['error']('Setting,\x20%s,\x20%s',_0x6edc7,_0x48247d[_0xe9ba('0x24')][_0xe9ba('0x26')]);return _0x517bdd(_0x48247d[_0xe9ba('0x24')][_0xe9ba('0x26')]);}else{logger[_0xe9ba('0x1e')](_0xe9ba('0x1f'),_0x6edc7,_0xe9ba('0x20'));_0x517bdd(_0x48247d[_0xe9ba('0x27')][_0xe9ba('0x26')]);}})[_0xe9ba('0x28')](function(_0x36d65b){logger[_0xe9ba('0x24')]('Setting,\x20%s,\x20%s',_0x6edc7,_0x36d65b);_0x482dbc(_0x36d65b);});});}function respondWithStatusCode(_0x27fd40,_0xbe7e8c){_0xbe7e8c=_0xbe7e8c||0xcc;return function(_0x420051){if(_0x420051){return _0x27fd40[_0xe9ba('0x29')](_0xbe7e8c);}return _0x27fd40[_0xe9ba('0x2a')](_0xbe7e8c)[_0xe9ba('0x2b')]();};}function respondWithResult(_0x90b5a8,_0x1a1056){_0x1a1056=_0x1a1056||0xc8;return function(_0x5a60f1){if(_0x5a60f1){return _0x90b5a8[_0xe9ba('0x2a')](_0x1a1056)[_0xe9ba('0x2c')](_0x5a60f1);}};}function respondWithFilteredResult(_0x162fef,_0x3a775c){return function(_0xfcd2d1){if(_0xfcd2d1){var _0x4ec446=typeof _0x3a775c['offset']==='undefined'&&typeof _0x3a775c[_0xe9ba('0x2d')]===_0xe9ba('0x2e');var _0xa3d510=_0xfcd2d1[_0xe9ba('0x2f')];var _0x34d206=_0x4ec446?0x0:_0x3a775c['offset'];var _0x1247db=_0x4ec446?_0xfcd2d1[_0xe9ba('0x2f')]:_0x3a775c[_0xe9ba('0x30')]+_0x3a775c[_0xe9ba('0x2d')];var _0x4dcfd9;if(_0x1247db>=_0xa3d510){_0x1247db=_0xa3d510;_0x4dcfd9=0xc8;}else{_0x4dcfd9=0xce;}_0x162fef[_0xe9ba('0x2a')](_0x4dcfd9);return _0x162fef['set'](_0xe9ba('0x31'),_0x34d206+'-'+_0x1247db+'/'+_0xa3d510)[_0xe9ba('0x2c')](_0xfcd2d1);}return null;};}function patchUpdates(_0x354b80){return function(_0x26d057){try{jsonpatch[_0xe9ba('0x32')](_0x26d057,_0x354b80,!![]);}catch(_0x26d53a){return BPromise[_0xe9ba('0x33')](_0x26d53a);}return _0x26d057['save']();};}function saveUpdates(_0x4d3055,_0x163b41){return function(_0x57273b){if(_0x57273b){return _0x57273b[_0xe9ba('0x34')](_0x4d3055)['then'](function(_0x429738){return _0x429738;});}return null;};}function removeEntity(_0x11436f,_0x2a671e){return function(_0x58265e){if(_0x58265e){return _0x58265e['destroy']()[_0xe9ba('0x1d')](function(){_0x11436f[_0xe9ba('0x2a')](0xcc)[_0xe9ba('0x2b')]();});}};}function handleEntityNotFound(_0x5b285b,_0x3f11e3){return function(_0x1f16b8){if(!_0x1f16b8){_0x5b285b[_0xe9ba('0x29')](0x194);}return _0x1f16b8;};}function handleError(_0x41b32e,_0xa3e040){_0xa3e040=_0xa3e040||0x1f4;return function(_0x24bc78){logger['error'](_0x24bc78['stack']);if(_0x24bc78[_0xe9ba('0x35')]){delete _0x24bc78['name'];}_0x41b32e['status'](_0xa3e040)[_0xe9ba('0x36')](_0x24bc78);};}exports[_0xe9ba('0x37')]=function(_0x8f0a17,_0x5e44af){var _0x7d955e={},_0x4c8620={},_0x274424={'count':0x0,'rows':[]};var _0x3dfd3b=_[_0xe9ba('0x38')](db[_0xe9ba('0x39')][_0xe9ba('0x3a')],function(_0x1f6e2c){return{'name':_0x1f6e2c[_0xe9ba('0x3b')],'type':_0x1f6e2c[_0xe9ba('0x3c')]['key']};});_0x4c8620[_0xe9ba('0x3d')]=_['map'](_0x3dfd3b,_0xe9ba('0x35'));_0x4c8620[_0xe9ba('0x3e')]=_[_0xe9ba('0x3f')](_0x8f0a17['query']);_0x4c8620[_0xe9ba('0x40')]=_[_0xe9ba('0x41')](_0x4c8620[_0xe9ba('0x3d')],_0x4c8620['query']);_0x7d955e[_0xe9ba('0x42')]=_['intersection'](_0x4c8620[_0xe9ba('0x3d')],qs['fields'](_0x8f0a17[_0xe9ba('0x3e')]['fields']));_0x7d955e[_0xe9ba('0x42')]=_0x7d955e[_0xe9ba('0x42')][_0xe9ba('0x43')]?_0x7d955e['attributes']:_0x4c8620[_0xe9ba('0x3d')];if(!_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x44')](_0xe9ba('0x45'))){_0x7d955e[_0xe9ba('0x2d')]=qs['limit'](_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x2d')]);_0x7d955e[_0xe9ba('0x30')]=qs[_0xe9ba('0x30')](_0x8f0a17['query'][_0xe9ba('0x30')]);}_0x7d955e[_0xe9ba('0x46')]=qs[_0xe9ba('0x47')](_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x47')]);_0x7d955e[_0xe9ba('0x48')]=qs[_0xe9ba('0x40')](_[_0xe9ba('0x49')](_0x8f0a17[_0xe9ba('0x3e')],_0x4c8620[_0xe9ba('0x40')]),_0x3dfd3b);if(_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x4a')]){_0x7d955e[_0xe9ba('0x48')]=_[_0xe9ba('0x4b')](_0x7d955e[_0xe9ba('0x48')],{'$or':_['map'](_0x3dfd3b,function(_0x37dd7b){if(_0x37dd7b[_0xe9ba('0x3c')]!==_0xe9ba('0x4c')){var _0x2a8467={};_0x2a8467[_0x37dd7b[_0xe9ba('0x35')]]={'$like':'%'+_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x4a')]+'%'};return _0x2a8467;}})});}_0x7d955e=_[_0xe9ba('0x4b')]({},_0x7d955e,_0x8f0a17[_0xe9ba('0x4d')]);var _0x954dd2={'where':_0x7d955e[_0xe9ba('0x48')]};return db['Setting'][_0xe9ba('0x2f')](_0x954dd2)[_0xe9ba('0x1d')](function(_0x548b53){_0x274424[_0xe9ba('0x2f')]=_0x548b53;if(_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x4e')]){_0x7d955e[_0xe9ba('0x4f')]=[{'all':!![]}];}return db[_0xe9ba('0x39')][_0xe9ba('0x50')](_0x7d955e);})[_0xe9ba('0x1d')](function(_0x591558){_0x274424['rows']=_0x591558;return _0x274424;})[_0xe9ba('0x1d')](respondWithFilteredResult(_0x5e44af,_0x7d955e))[_0xe9ba('0x28')](handleError(_0x5e44af,null));};exports[_0xe9ba('0x51')]=function(_0x233c99,_0x486145){var _0x2d19da={'raw':![],'where':{'id':_0x233c99[_0xe9ba('0x52')]['id']}},_0x5b36d4={};_0x5b36d4['model']=_['keys'](db[_0xe9ba('0x39')][_0xe9ba('0x3a')]);_0x5b36d4[_0xe9ba('0x3e')]=_[_0xe9ba('0x3f')](_0x233c99['query']);_0x5b36d4['filters']=_[_0xe9ba('0x41')](_0x5b36d4['model'],_0x5b36d4[_0xe9ba('0x3e')]);_0x2d19da[_0xe9ba('0x42')]=_[_0xe9ba('0x41')](_0x5b36d4['model'],qs[_0xe9ba('0x53')](_0x233c99['query'][_0xe9ba('0x53')]));_0x2d19da['attributes']=_0x2d19da[_0xe9ba('0x42')]['length']?_0x2d19da['attributes']:_0x5b36d4[_0xe9ba('0x3d')];if(_0x233c99[_0xe9ba('0x3e')][_0xe9ba('0x4e')]){_0x2d19da[_0xe9ba('0x4f')]=[{'all':!![]}];}_0x2d19da=_[_0xe9ba('0x4b')]({},_0x2d19da,_0x233c99[_0xe9ba('0x4d')]);return db[_0xe9ba('0x39')][_0xe9ba('0x54')](_0x2d19da)['then'](handleEntityNotFound(_0x486145,null))['then'](respondWithResult(_0x486145,null))[_0xe9ba('0x28')](handleError(_0x486145,null));};exports[_0xe9ba('0x34')]=function(_0x2f40be,_0x13ddea){if(_0x2f40be[_0xe9ba('0x55')]['id']){delete _0x2f40be[_0xe9ba('0x55')]['id'];}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x2f40be[_0xe9ba('0x52')]['id']}})[_0xe9ba('0x1d')](handleEntityNotFound(_0x13ddea,null))[_0xe9ba('0x1d')](saveUpdates(_0x2f40be[_0xe9ba('0x55')],null))[_0xe9ba('0x1d')](respondWithResult(_0x13ddea,null))['catch'](handleError(_0x13ddea,null));};exports[_0xe9ba('0x56')]=function(_0x3f844b,_0xeda45b,_0x2b60d9){if(_0x3f844b['file']&&_0x3f844b[_0xe9ba('0x57')][_0xe9ba('0x58')]){_0x3f844b[_0xe9ba('0x55')][_0xe9ba('0x59')]=_0x3f844b[_0xe9ba('0x57')][_0xe9ba('0x58')];}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x3f844b[_0xe9ba('0x52')]['id']}})[_0xe9ba('0x1d')](handleEntityNotFound(_0xeda45b,null))[_0xe9ba('0x1d')](saveUpdates(_0x3f844b[_0xe9ba('0x55')],null))[_0xe9ba('0x1d')](respondWithResult(_0xeda45b,null))[_0xe9ba('0x28')](handleError(_0xeda45b,null));};exports['addLogoLogin']=function(_0x183925,_0x2c89bb,_0x21071c){if(_0x183925['file']&&_0x183925[_0xe9ba('0x57')][_0xe9ba('0x58')]){_0x183925[_0xe9ba('0x55')][_0xe9ba('0x5a')]=_0x183925[_0xe9ba('0x57')][_0xe9ba('0x58')];}return db['Setting'][_0xe9ba('0x54')]({'where':{'id':_0x183925[_0xe9ba('0x52')]['id']}})['then'](handleEntityNotFound(_0x2c89bb,null))[_0xe9ba('0x1d')](saveUpdates(_0x183925[_0xe9ba('0x55')],null))[_0xe9ba('0x1d')](respondWithResult(_0x2c89bb,null))[_0xe9ba('0x28')](handleError(_0x2c89bb,null));};var utilLicense=require('../../config/license/util');exports[_0xe9ba('0x5b')]=function(_0x20ead5,_0x52bd04,_0x1fa654){var _0x1989bf=_0xe9ba('0x5c');var _0x5688f2={'custom':![]};return utilLicense[_0xe9ba('0x5d')]()[_0xe9ba('0x1d')](function(_0x4033cb){if(_0x4033cb){_0x5688f2=_0x4033cb;}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x20ead5[_0xe9ba('0x52')]['id']},'attributes':['logo',_0xe9ba('0x5a'),'preferred',_0xe9ba('0x5e'),_0xe9ba('0x5f'),_0xe9ba('0x60'),'defaultPreferred',_0xe9ba('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x52bd04,null))[_0xe9ba('0x1d')](function(_0x249edc){if(_0x249edc){var _0x5a9031=_0x249edc['logo']&&fs[_0xe9ba('0x62')](path[_0xe9ba('0x63')](config['root'],_0x1989bf,_[_0xe9ba('0x64')](_0x249edc[_0xe9ba('0x59')])))?path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x1989bf,_[_0xe9ba('0x64')](_0x249edc[_0xe9ba('0x59')])):path[_0xe9ba('0x63')](config['root'],_0x1989bf,_['toLower'](_0xe9ba('0x66')));var _0x3298d7='default'+_[_0xe9ba('0x67')](_0xe9ba('0x59'));if(_0x249edc[_0x3298d7]||!_0x5688f2[_0xe9ba('0x68')]){_0x5a9031=path['join'](config['root'],_0x1989bf,_[_0xe9ba('0x64')](_0xe9ba('0x66')));}if(!fs[_0xe9ba('0x62')](_0x5a9031)){throw new db['Sequelize'][(_0xe9ba('0x69'))](_[_0xe9ba('0x67')](_0xe9ba('0x59'))+_0xe9ba('0x6a'));}return _0x52bd04[_0xe9ba('0x6b')](_0x5a9031);}})[_0xe9ba('0x28')](handleError(_0x52bd04,null));};var utilLicense=require(_0xe9ba('0x18'));exports['getLogoLogin']=function(_0x4a3209,_0x42bbbd,_0x21071a){var _0x393343=_0xe9ba('0x5c');var _0x19b887={'custom':![]};return utilLicense[_0xe9ba('0x5d')]()[_0xe9ba('0x1d')](function(_0x29bc6f){if(_0x29bc6f){_0x19b887=_0x29bc6f;}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x4a3209[_0xe9ba('0x52')]['id']},'attributes':['logo','loginLogo','preferred',_0xe9ba('0x5e'),_0xe9ba('0x5f'),'defaultLoginLogo',_0xe9ba('0x6c'),_0xe9ba('0x61')],'raw':!![]});})[_0xe9ba('0x1d')](handleEntityNotFound(_0x42bbbd,null))[_0xe9ba('0x1d')](function(_0x292a52){if(_0x292a52){var _0x108b12=_0x292a52[_0xe9ba('0x5a')]&&fs['existsSync'](path['join'](config[_0xe9ba('0x65')],_0x393343,_[_0xe9ba('0x64')](_0x292a52[_0xe9ba('0x5a')])))?path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x393343,_['toLower'](_0x292a52['loginLogo'])):path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x393343,_['toLower'](_0xe9ba('0x6d')));var _0x2b3424=_0xe9ba('0x6e')+_[_0xe9ba('0x67')](_0xe9ba('0x5a'));if(_0x292a52[_0x2b3424]||!_0x19b887['custom']){_0x108b12=path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x393343,_[_0xe9ba('0x64')](_0xe9ba('0x6d')));}if(!fs['existsSync'](_0x108b12)){throw new db['Sequelize'][(_0xe9ba('0x69'))](_['upperFirst'](_0xe9ba('0x5a'))+_0xe9ba('0x6a'));}return _0x42bbbd['download'](_0x108b12);}})[_0xe9ba('0x28')](handleError(_0x42bbbd,null));};exports['gdpr']=function(_0x18fa63,_0x58c242){return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x18fa63[_0xe9ba('0x52')]['id']},'attributes':['securePassword']})[_0xe9ba('0x1d')](respondWithResult(_0x58c242,null))[_0xe9ba('0x28')](handleError(_0x58c242,null));};exports[_0xe9ba('0x6f')]=function(_0x528123,_0x44835b,_0x4c0c36){if(_0x528123[_0xe9ba('0x57')]&&_0x528123[_0xe9ba('0x57')][_0xe9ba('0x58')]){_0x528123[_0xe9ba('0x55')][_0xe9ba('0x70')]=_0x528123[_0xe9ba('0x57')][_0xe9ba('0x58')];}return db['Setting']['find']({'where':{'id':_0x528123['params']['id']}})[_0xe9ba('0x1d')](handleEntityNotFound(_0x44835b,null))[_0xe9ba('0x1d')](saveUpdates(_0x528123['body'],null))[_0xe9ba('0x1d')](respondWithResult(_0x44835b,null))[_0xe9ba('0x28')](handleError(_0x44835b,null));};var utilLicense=require(_0xe9ba('0x18'));exports[_0xe9ba('0x71')]=function(_0x568140,_0x3f67e4,_0x241f9a){var _0x314421=_0xe9ba('0x5c');var _0x274fb6={'custom':![]};return utilLicense[_0xe9ba('0x5d')]()['then'](function(_0x2747b3){if(_0x2747b3){_0x274fb6=_0x2747b3;}return db[_0xe9ba('0x39')]['find']({'where':{'id':_0x568140[_0xe9ba('0x52')]['id']},'attributes':[_0xe9ba('0x59'),_0xe9ba('0x5a'),_0xe9ba('0x70'),_0xe9ba('0x5e'),_0xe9ba('0x5f'),'defaultLoginLogo',_0xe9ba('0x6c'),_0xe9ba('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x3f67e4,null))[_0xe9ba('0x1d')](function(_0x23f75f){if(_0x23f75f){var _0x48dbce=_0x23f75f['preferred']&&fs[_0xe9ba('0x62')](path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x314421,_['toLower'](_0x23f75f['preferred'])))?path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x314421,_[_0xe9ba('0x64')](_0x23f75f[_0xe9ba('0x70')])):path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x314421,_[_0xe9ba('0x64')]('default_preferred.png'));var _0x558072='default'+_[_0xe9ba('0x67')]('preferred');if(_0x23f75f[_0x558072]||!_0x274fb6[_0xe9ba('0x68')]||!_0x274fb6[_0xe9ba('0x70')]){_0x48dbce=path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x314421,_[_0xe9ba('0x64')]('default_preferred.png'));}if(!fs[_0xe9ba('0x62')](_0x48dbce)){throw new db[(_0xe9ba('0x72'))]['ValidationError'](_[_0xe9ba('0x67')](_0xe9ba('0x70'))+_0xe9ba('0x6a'));}return _0x3f67e4[_0xe9ba('0x6b')](_0x48dbce);}})[_0xe9ba('0x28')](handleError(_0x3f67e4,null));};exports[_0xe9ba('0x73')]=function(_0x5cda84,_0x46ae54,_0x370369){if(_0x5cda84[_0xe9ba('0x57')]&&_0x5cda84['file'][_0xe9ba('0x58')]){_0x5cda84[_0xe9ba('0x55')][_0xe9ba('0x5e')]=_0x5cda84[_0xe9ba('0x57')]['filename'];}return db[_0xe9ba('0x39')]['find']({'where':{'id':_0x5cda84[_0xe9ba('0x52')]['id']}})[_0xe9ba('0x1d')](handleEntityNotFound(_0x46ae54,null))[_0xe9ba('0x1d')](saveUpdates(_0x5cda84[_0xe9ba('0x55')],null))['then'](respondWithResult(_0x46ae54,null))[_0xe9ba('0x28')](handleError(_0x46ae54,null));};var utilLicense=require(_0xe9ba('0x18'));exports[_0xe9ba('0x74')]=function(_0x199af8,_0x57e695,_0x398cf0){var _0x38bb5c=_0xe9ba('0x5c');var _0x2f4d40={'custom':![]};return utilLicense[_0xe9ba('0x5d')]()['then'](function(_0x58f9ba){if(_0x58f9ba){_0x2f4d40=_0x58f9ba;}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x199af8[_0xe9ba('0x52')]['id']},'attributes':[_0xe9ba('0x59'),_0xe9ba('0x5a'),_0xe9ba('0x70'),_0xe9ba('0x5e'),_0xe9ba('0x5f'),_0xe9ba('0x60'),_0xe9ba('0x6c'),_0xe9ba('0x61')],'raw':!![]});})[_0xe9ba('0x1d')](handleEntityNotFound(_0x57e695,null))[_0xe9ba('0x1d')](function(_0x4b53dc){if(_0x4b53dc){var _0x15e403=_0x4b53dc[_0xe9ba('0x5e')]&&fs[_0xe9ba('0x62')](path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x38bb5c,_['toLower'](_0x4b53dc['favicon'])))?path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x38bb5c,_[_0xe9ba('0x64')](_0x4b53dc[_0xe9ba('0x5e')])):path['join'](config[_0xe9ba('0x65')],_0x38bb5c,_[_0xe9ba('0x64')]('default_favicon.ico'));var _0x2d6d94='default'+_[_0xe9ba('0x67')](_0xe9ba('0x5e'));if(_0x4b53dc[_0x2d6d94]||!_0x2f4d40[_0xe9ba('0x68')]){_0x15e403=path['join'](config['root'],_0x38bb5c,_[_0xe9ba('0x64')](_0xe9ba('0x75')));}if(!fs[_0xe9ba('0x62')](_0x15e403)){throw new db[(_0xe9ba('0x72'))][(_0xe9ba('0x69'))](_['upperFirst']('favicon')+'\x20not\x20found');}return _0x57e695[_0xe9ba('0x6b')](_0x15e403);}})[_0xe9ba('0x28')](handleError(_0x57e695,null));};exports[_0xe9ba('0x76')]=function(_0x1f64a1,_0x56cfc8){var _0x47de0c={'offset':moment()[_0xe9ba('0x77')]()};_0x47de0c[_0xe9ba('0x78')]=moment()[_0xe9ba('0x77')](_0x47de0c[_0xe9ba('0x30')])['format'](_0xe9ba('0x79'));return _0x56cfc8['status'](0xc8)[_0xe9ba('0x36')](_0x47de0c);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 398beca..987086a 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(_0x9ace37,_0x4d1159){var _0x23ecc0=function(_0xda11a){while(--_0xda11a){_0x9ace37['push'](_0x9ace37['shift']());}};_0x23ecc0(++_0x4d1159);}(_0x008c,0x188));var _0xc008=function(_0x58b14b,_0x5ab912){_0x58b14b=_0x58b14b-0x0;var _0x5aec73=_0x008c[_0x58b14b];return _0x5aec73;};'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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x3e74,0x175));var _0x43e7=function(_0x35bbec,_0x3a0993){_0x35bbec=_0x35bbec-0x0;var _0x2ca27c=_0x3e74[_0x35bbec];return _0x2ca27c;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index be33100..30ca0ab 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 _0xf889=['request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','ShowSetting','options','raw','attributes','include','model','map','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf889,0x8e));var _0x9f88=function(_0x407e34,_0x327b01){_0x407e34=_0x407e34-0x0;var _0x2c7b6e=_0xf889[_0x407e34];return _0x2c7b6e;};'use strict';var _=require(_0x9f88('0x0'));var util=require(_0x9f88('0x1'));var moment=require(_0x9f88('0x2'));var BPromise=require(_0x9f88('0x3'));var rs=require(_0x9f88('0x4'));var fs=require('fs');var Redis=require(_0x9f88('0x5'));var db=require(_0x9f88('0x6'))['db'];var utils=require(_0x9f88('0x7'));var logger=require(_0x9f88('0x8'))(_0x9f88('0x9'));var config=require(_0x9f88('0xa'));var jayson=require(_0x9f88('0xb'));var client=jayson['client'][_0x9f88('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20d16d,_0x30e000,_0x25d7c7){return new BPromise(function(_0x5b05c3,_0x47c34b){return client[_0x9f88('0xd')](_0x20d16d,_0x25d7c7)[_0x9f88('0xe')](function(_0x16ad1e){logger['info'](_0x9f88('0xf'),_0x30e000,_0x9f88('0x10'));logger['debug'](_0x9f88('0x11'),_0x30e000,_0x9f88('0x10'),JSON[_0x9f88('0x12')](_0x16ad1e));if(_0x16ad1e['error']){if(_0x16ad1e[_0x9f88('0x13')]['code']===0x1f4){logger['error'](_0x9f88('0xf'),_0x30e000,_0x16ad1e['error']['message']);return _0x47c34b(_0x16ad1e[_0x9f88('0x13')][_0x9f88('0x14')]);}logger[_0x9f88('0x13')](_0x9f88('0xf'),_0x30e000,_0x16ad1e[_0x9f88('0x13')][_0x9f88('0x14')]);return _0x5b05c3(_0x16ad1e[_0x9f88('0x13')][_0x9f88('0x14')]);}else{logger[_0x9f88('0x15')](_0x9f88('0xf'),_0x30e000,'request\x20sent');_0x5b05c3(_0x16ad1e[_0x9f88('0x16')]['message']);}})['catch'](function(_0x2ef89a){logger[_0x9f88('0x13')](_0x9f88('0xf'),_0x30e000,_0x2ef89a);_0x47c34b(_0x2ef89a);});});}exports[_0x9f88('0x17')]=function(_0x436919){var _0x573d09=this;return new Promise(function(_0x75fb10,_0x494e60){return db['Setting']['find']({'raw':_0x436919['options']?_0x436919[_0x9f88('0x18')][_0x9f88('0x19')]===undefined?!![]:![]:!![],'where':_0x436919[_0x9f88('0x18')]?_0x436919['options']['where']||null:null,'attributes':_0x436919['options']?_0x436919[_0x9f88('0x18')][_0x9f88('0x1a')]||null:null,'include':_0x436919['options']?_0x436919[_0x9f88('0x18')][_0x9f88('0x1b')]?_['map'](_0x436919[_0x9f88('0x18')][_0x9f88('0x1b')],function(_0x25b18d){return{'model':db[_0x25b18d[_0x9f88('0x1c')]],'as':_0x25b18d['as'],'attributes':_0x25b18d[_0x9f88('0x1a')],'include':_0x25b18d[_0x9f88('0x1b')]?_[_0x9f88('0x1d')](_0x25b18d[_0x9f88('0x1b')],function(_0x4fbe44){return{'model':db[_0x4fbe44['model']],'as':_0x4fbe44['as'],'attributes':_0x4fbe44['attributes'],'include':_0x4fbe44['include']?_[_0x9f88('0x1d')](_0x4fbe44['include'],function(_0x5cc343){return{'model':db[_0x5cc343[_0x9f88('0x1c')]],'as':_0x5cc343['as'],'attributes':_0x5cc343[_0x9f88('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9f88('0xe')](function(_0x566fb3){logger['info'](_0x9f88('0x17'),_0x436919);logger[_0x9f88('0x1e')](_0x9f88('0x17'),_0x436919,JSON['stringify'](_0x566fb3));_0x75fb10(_0x566fb3);})['catch'](function(_0x5b8451){logger[_0x9f88('0x13')](_0x9f88('0x17'),_0x5b8451[_0x9f88('0x14')],_0x436919);_0x494e60(_0x573d09['error'](0x1f4,_0x5b8451['message']));});});}; \ No newline at end of file +var _0xc0ea=['include','map','model','debug','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','info','ShowSetting','Setting','find','options','raw','where','attributes'];(function(_0x2c96a0,_0x1dc72c){var _0x1eff2e=function(_0x3a80c7){while(--_0x3a80c7){_0x2c96a0['push'](_0x2c96a0['shift']());}};_0x1eff2e(++_0x1dc72c);}(_0xc0ea,0x1e1));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac0e('0x0'));var util=require(_0xac0e('0x1'));var moment=require('moment');var BPromise=require(_0xac0e('0x2'));var rs=require(_0xac0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac0e('0x4'))['db'];var utils=require(_0xac0e('0x5'));var logger=require(_0xac0e('0x6'))(_0xac0e('0x7'));var config=require(_0xac0e('0x8'));var jayson=require(_0xac0e('0x9'));var client=jayson[_0xac0e('0xa')][_0xac0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd4b6c,_0x1eef04,_0x26c70f){return new BPromise(function(_0x3ccb68,_0x2e74e2){return client[_0xac0e('0xc')](_0xbd4b6c,_0x26c70f)[_0xac0e('0xd')](function(_0x2c79f3){logger['info']('Setting,\x20%s,\x20%s',_0x1eef04,'request\x20sent');logger['debug'](_0xac0e('0xe'),_0x1eef04,_0xac0e('0xf'),JSON[_0xac0e('0x10')](_0x2c79f3));if(_0x2c79f3[_0xac0e('0x11')]){if(_0x2c79f3['error'][_0xac0e('0x12')]===0x1f4){logger['error'](_0xac0e('0x13'),_0x1eef04,_0x2c79f3[_0xac0e('0x11')]['message']);return _0x2e74e2(_0x2c79f3[_0xac0e('0x11')][_0xac0e('0x14')]);}logger[_0xac0e('0x11')](_0xac0e('0x13'),_0x1eef04,_0x2c79f3[_0xac0e('0x11')][_0xac0e('0x14')]);return _0x3ccb68(_0x2c79f3[_0xac0e('0x11')][_0xac0e('0x14')]);}else{logger[_0xac0e('0x15')](_0xac0e('0x13'),_0x1eef04,_0xac0e('0xf'));_0x3ccb68(_0x2c79f3['result'][_0xac0e('0x14')]);}})['catch'](function(_0x4b11ab){logger[_0xac0e('0x11')](_0xac0e('0x13'),_0x1eef04,_0x4b11ab);_0x2e74e2(_0x4b11ab);});});}exports[_0xac0e('0x16')]=function(_0x4740ee){var _0x583a75=this;return new Promise(function(_0x151476,_0x765a6c){return db[_0xac0e('0x17')][_0xac0e('0x18')]({'raw':_0x4740ee[_0xac0e('0x19')]?_0x4740ee['options'][_0xac0e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4740ee['options']?_0x4740ee[_0xac0e('0x19')][_0xac0e('0x1b')]||null:null,'attributes':_0x4740ee[_0xac0e('0x19')]?_0x4740ee[_0xac0e('0x19')][_0xac0e('0x1c')]||null:null,'include':_0x4740ee[_0xac0e('0x19')]?_0x4740ee[_0xac0e('0x19')][_0xac0e('0x1d')]?_[_0xac0e('0x1e')](_0x4740ee[_0xac0e('0x19')][_0xac0e('0x1d')],function(_0x56ae6b){return{'model':db[_0x56ae6b[_0xac0e('0x1f')]],'as':_0x56ae6b['as'],'attributes':_0x56ae6b[_0xac0e('0x1c')],'include':_0x56ae6b[_0xac0e('0x1d')]?_[_0xac0e('0x1e')](_0x56ae6b[_0xac0e('0x1d')],function(_0x312e51){return{'model':db[_0x312e51['model']],'as':_0x312e51['as'],'attributes':_0x312e51[_0xac0e('0x1c')],'include':_0x312e51['include']?_[_0xac0e('0x1e')](_0x312e51['include'],function(_0x5c66bc){return{'model':db[_0x5c66bc[_0xac0e('0x1f')]],'as':_0x5c66bc['as'],'attributes':_0x5c66bc[_0xac0e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xac0e('0xd')](function(_0x2d0daf){logger[_0xac0e('0x15')]('ShowSetting',_0x4740ee);logger[_0xac0e('0x20')](_0xac0e('0x16'),_0x4740ee,JSON[_0xac0e('0x10')](_0x2d0daf));_0x151476(_0x2d0daf);})[_0xac0e('0x21')](function(_0x47f617){logger['error'](_0xac0e('0x16'),_0x47f617[_0xac0e('0x14')],_0x4740ee);_0x765a6c(_0x583a75[_0xac0e('0x11')](0x1f4,_0x47f617[_0xac0e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index f20efb8..15695ac 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 _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0xa9d6d1,_0x3762b2){var _0x53a4cb=function(_0x181c1f){while(--_0x181c1f){_0xa9d6d1['push'](_0xa9d6d1['shift']());}};_0x53a4cb(++_0x3762b2);}(_0x5fab,0x177));var _0xb5fa=function(_0x206f02,_0x36f322){_0x206f02=_0x206f02-0x0;var _0x8a2663=_0x5fab[_0x206f02];return _0x8a2663;};'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/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file +var _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7217,0x19e));var _0x7721=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7217[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('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['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);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 816b123..35c918f 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 _0x5111=['BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','twilio','connectel','plivo','clickatell','bandwidth','infobip','intelepeer'];(function(_0x1e9858,_0x46aa4f){var _0x1c68ac=function(_0x397523){while(--_0x397523){_0x1e9858['push'](_0x1e9858['shift']());}};_0x1c68ac(++_0x46aa4f);}(_0x5111,0x74));var _0x1511=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5111[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x1511('0x0'));var rs=require(_0x1511('0x1'));module['exports']={'name':{'type':Sequelize[_0x1511('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x1511('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x1511('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x1511('0x3'),'skebby',_0x1511('0x4'),'clicksend',_0x1511('0x5'),_0x1511('0x6'),_0x1511('0x7'),'csc',_0x1511('0x8'),_0x1511('0x9'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x1511('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x1511('0x2')]},'password':{'type':Sequelize[_0x1511('0x2')]},'apiKey':{'type':Sequelize[_0x1511('0x2')]},'applicationId':{'type':Sequelize[_0x1511('0x2')]},'accountId':{'type':Sequelize[_0x1511('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x1511('0xa')],'defaultValue':![]},'description':{'type':Sequelize[_0x1511('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1511('0xb');}},'notificationSound':{'type':Sequelize[_0x1511('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1511('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1511('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1511('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1511('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1511('0xc')],'comment':_0x1511('0xd')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1511('0xe'),'set':function(_0x4d2184){if(!_0x4d2184)this['setDataValue'](_0x1511('0xf'),null);this[_0x1511('0x10')](_0x1511('0x11'),_0x4d2184);}}}; \ No newline at end of file +var _0x4902=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x14a1a4,_0x599092){var _0x3f6201=function(_0x4ca5c5){while(--_0x4ca5c5){_0x14a1a4['push'](_0x14a1a4['shift']());}};_0x3f6201(++_0x599092);}(_0x4902,0xa2));var _0x2490=function(_0x1edaf7,_0x186509){_0x1edaf7=_0x1edaf7-0x0;var _0x5270b8=_0x4902[_0x1edaf7];return _0x5270b8;};'use strict';var Sequelize=require(_0x2490('0x0'));var rs=require(_0x2490('0x1'));module[_0x2490('0x2')]={'name':{'type':Sequelize[_0x2490('0x3')],'unique':_0x2490('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x2490('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2490('0x3')],'defaultValue':function(){return rs[_0x2490('0x5')]();}},'phone':{'type':Sequelize[_0x2490('0x3')]},'type':{'type':Sequelize[_0x2490('0x6')](_0x2490('0x7'),_0x2490('0x8'),_0x2490('0x9'),_0x2490('0xa'),_0x2490('0xb'),_0x2490('0xc'),_0x2490('0xd'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x2490('0x3')]},'authId':{'type':Sequelize[_0x2490('0x3')]},'authToken':{'type':Sequelize[_0x2490('0x3')]},'smsMethod':{'type':Sequelize[_0x2490('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x2490('0x3')]},'applicationId':{'type':Sequelize[_0x2490('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x2490('0x3')]},'deliveryReport':{'type':Sequelize[_0x2490('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x2490('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2490('0xf')],'defaultValue':function(){return _0x2490('0x10');}},'notificationSound':{'type':Sequelize[_0x2490('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2490('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2490('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2490('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2490('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2490('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2490('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2490('0x13'),'set':function(_0x2574c1){if(!_0x2574c1)this[_0x2490('0x14')](_0x2490('0x15'),null);this[_0x2490('0x14')](_0x2490('0x16'),_0x2574c1);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ee8a33a..f9b6503 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 _0x2292=['show','params','mandatoryDispositionPause','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','describe','addDisposition','getDispositions','Disposition','nolimit','sort','SmsAccountId','removeDispositions','ids','order','CannedAnswer','removeAnswers','notify','sms','Applications','account','orderBy','priority','asc','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','messageId','MessageSid','skebby','text','connectel','message_id','plivo','Text','infobip','results','csc','originatingAddress','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','applications','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','SmsApplication','findAndCountAll','stack','finally','findOne','getApplications','getInteractions','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','get','UserProfileResource','destroy','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','map','VIRTUAL','merge','includeAll','findAll','rows'];(function(_0x1ae7b0,_0x2301a2){var _0x2d83dc=function(_0x32a63f){while(--_0x32a63f){_0x1ae7b0['push'](_0x1ae7b0['shift']());}};_0x2d83dc(++_0x2301a2);}(_0x2292,0x169));var _0x2229=function(_0x3bb63a,_0x15af8f){_0x3bb63a=_0x3bb63a-0x0;var _0x3b822a=_0x2292[_0x3bb63a];return _0x3b822a;};'use strict';var emlformat=require(_0x2229('0x0'));var rimraf=require(_0x2229('0x1'));var zipdir=require(_0x2229('0x2'));var jsonpatch=require(_0x2229('0x3'));var rp=require(_0x2229('0x4'));var moment=require(_0x2229('0x5'));var BPromise=require(_0x2229('0x6'));var Mustache=require(_0x2229('0x7'));var util=require(_0x2229('0x8'));var path=require(_0x2229('0x9'));var sox=require('sox');var csv=require(_0x2229('0xa'));var ejs=require(_0x2229('0xb'));var fs=require('fs');var fs_extra=require(_0x2229('0xc'));var _=require(_0x2229('0xd'));var squel=require(_0x2229('0xe'));var crypto=require(_0x2229('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2229('0xa'));var querystring=require(_0x2229('0x10'));var Papa=require(_0x2229('0x11'));var Redis=require(_0x2229('0x12'));var authService=require(_0x2229('0x13'));var qs=require(_0x2229('0x14'));var as=require(_0x2229('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2229('0x16'))('api');var utils=require(_0x2229('0x17'));var config=require(_0x2229('0x18'));var licenseUtil=require(_0x2229('0x19'));var db=require('../../mysqldb')['db'];config[_0x2229('0x1a')]=_[_0x2229('0x1b')](config[_0x2229('0x1a')],{'host':_0x2229('0x1c'),'port':0x18eb});var socket=require(_0x2229('0x1d'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x2229('0x1e')](socket);var jayson=require(_0x2229('0x1f'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x5b43b9,_0x3395df,_0x7d6d07,_0x13dd17){return new BPromise(function(_0x3fa76a,_0x59173c){var _0x45bd2c=_0x13dd17||client;return _0x45bd2c['request'](_0x5b43b9,_0x7d6d07)['then'](function(_0x3acf74){logger['info'](_0x2229('0x20'),_0x3395df,_0x2229('0x21'));logger[_0x2229('0x22')](_0x2229('0x23'),_0x3395df,'request\x20sent',JSON[_0x2229('0x24')](_0x3acf74));if(_0x3acf74[_0x2229('0x25')]){if(_0x3acf74[_0x2229('0x25')]['code']===0x1f4){logger[_0x2229('0x25')](_0x2229('0x20'),_0x3395df,_0x3acf74[_0x2229('0x25')]['message']);return _0x59173c(_0x3acf74[_0x2229('0x25')][_0x2229('0x26')]);}logger[_0x2229('0x25')]('SmsAccount,\x20%s,\x20%s',_0x3395df,_0x3acf74[_0x2229('0x25')][_0x2229('0x26')]);return _0x3fa76a(_0x3acf74[_0x2229('0x25')]['message']);}else{logger[_0x2229('0x27')](_0x2229('0x20'),_0x3395df,_0x2229('0x21'));_0x3fa76a(_0x3acf74['result'][_0x2229('0x26')]);}})[_0x2229('0x28')](function(_0x19c37a){logger['error'](_0x2229('0x20'),_0x3395df,_0x19c37a);_0x59173c(_0x19c37a);});});}function respondWithStatusCode(_0x14fc0b,_0x4c1f3b){_0x4c1f3b=_0x4c1f3b||0xcc;return function(_0x273fac){if(_0x273fac){return _0x14fc0b[_0x2229('0x29')](_0x4c1f3b);}return _0x14fc0b[_0x2229('0x2a')](_0x4c1f3b)[_0x2229('0x2b')]();};}function respondWithResult(_0x14b771,_0x4e2821){_0x4e2821=_0x4e2821||0xc8;return function(_0xe3e510){if(_0xe3e510){return _0x14b771[_0x2229('0x2a')](_0x4e2821)[_0x2229('0x2c')](_0xe3e510);}};}function respondWithFilteredResult(_0x574c81,_0x508abc){return function(_0x2805e9){if(_0x2805e9){var _0x5a810f=typeof _0x508abc[_0x2229('0x2d')]===_0x2229('0x2e')&&typeof _0x508abc[_0x2229('0x2f')]===_0x2229('0x2e');var _0x164276=_0x2805e9[_0x2229('0x30')];var _0xdbecf8=_0x5a810f?0x0:_0x508abc[_0x2229('0x2d')];var _0x178a12=_0x5a810f?_0x2805e9[_0x2229('0x30')]:_0x508abc[_0x2229('0x2d')]+_0x508abc[_0x2229('0x2f')];var _0x201366;if(_0x178a12>=_0x164276){_0x178a12=_0x164276;_0x201366=0xc8;}else{_0x201366=0xce;}_0x574c81['status'](_0x201366);return _0x574c81['set'](_0x2229('0x31'),_0xdbecf8+'-'+_0x178a12+'/'+_0x164276)[_0x2229('0x2c')](_0x2805e9);}return null;};}function patchUpdates(_0x5375bc){return function(_0x1fcee7){try{jsonpatch['apply'](_0x1fcee7,_0x5375bc,!![]);}catch(_0x1e4ceb){return BPromise[_0x2229('0x32')](_0x1e4ceb);}return _0x1fcee7['save']();};}function saveUpdates(_0x4aafc1,_0x35bbbb){return function(_0x458477){if(_0x458477){return _0x458477[_0x2229('0x33')](_0x4aafc1)['then'](function(_0x491ab5){return _0x491ab5;});}return null;};}function removeEntity(_0x2437e2,_0x4b5b85){return function(_0x4242de){if(_0x4242de){return _0x4242de['destroy']()[_0x2229('0x34')](function(){var _0x203404=_0x4242de[_0x2229('0x35')]({'plain':!![]});var _0x5914dd='SmsAccounts';return db[_0x2229('0x36')][_0x2229('0x37')]({'where':{'type':_0x5914dd,'resourceId':_0x203404['id']}})[_0x2229('0x34')](function(){return _0x4242de;});})[_0x2229('0x34')](function(){_0x2437e2[_0x2229('0x2a')](0xcc)[_0x2229('0x2b')]();});}};}function handleEntityNotFound(_0xd18d58,_0x19393a){return function(_0x1a6e86){if(!_0x1a6e86){_0xd18d58[_0x2229('0x29')](0x194);}return _0x1a6e86;};}function handleError(_0x590904,_0x3621e2){_0x3621e2=_0x3621e2||0x1f4;return function(_0x2428a9){logger[_0x2229('0x25')](_0x2428a9['stack']);if(_0x2428a9[_0x2229('0x38')]){delete _0x2428a9['name'];}_0x590904['status'](_0x3621e2)[_0x2229('0x39')](_0x2428a9);};}exports[_0x2229('0x3a')]=function(_0x2ba5f8,_0x37200a){var _0x4bc757={'include':[{'model':db[_0x2229('0x3b')],'as':'mandatoryDispositionPause'}]},_0x3ccc0a={},_0x22bb50={'count':0x0,'rows':[]};var _0x5c3f16=_['map'](db[_0x2229('0x3c')][_0x2229('0x3d')],function(_0x851faf){return{'name':_0x851faf[_0x2229('0x3e')],'type':_0x851faf[_0x2229('0x3f')][_0x2229('0x40')]};});_0x3ccc0a[_0x2229('0x41')]=_['map'](_0x5c3f16,_0x2229('0x38'));_0x3ccc0a[_0x2229('0x42')]=_[_0x2229('0x43')](_0x2ba5f8['query']);_0x3ccc0a[_0x2229('0x44')]=_['intersection'](_0x3ccc0a[_0x2229('0x41')],_0x3ccc0a[_0x2229('0x42')]);_0x4bc757['attributes']=_[_0x2229('0x45')](_0x3ccc0a[_0x2229('0x41')],qs[_0x2229('0x46')](_0x2ba5f8[_0x2229('0x42')][_0x2229('0x46')]));_0x4bc757[_0x2229('0x47')]=_0x4bc757[_0x2229('0x47')][_0x2229('0x48')]?_0x4bc757[_0x2229('0x47')]:_0x3ccc0a[_0x2229('0x41')];if(!_0x2ba5f8[_0x2229('0x42')][_0x2229('0x49')]('nolimit')){_0x4bc757[_0x2229('0x2f')]=qs[_0x2229('0x2f')](_0x2ba5f8['query']['limit']);_0x4bc757[_0x2229('0x2d')]=qs[_0x2229('0x2d')](_0x2ba5f8[_0x2229('0x42')]['offset']);}_0x4bc757['order']=qs['sort'](_0x2ba5f8['query']['sort']);_0x4bc757[_0x2229('0x4a')]=qs[_0x2229('0x44')](_[_0x2229('0x4b')](_0x2ba5f8[_0x2229('0x42')],_0x3ccc0a[_0x2229('0x44')]),_0x5c3f16);if(_0x2ba5f8['query'][_0x2229('0x4c')]){_0x4bc757[_0x2229('0x4a')]=_['merge'](_0x4bc757[_0x2229('0x4a')],{'$or':_[_0x2229('0x4d')](_0x5c3f16,function(_0x7cea47){if(_0x7cea47['type']!==_0x2229('0x4e')){var _0x36ca2d={};_0x36ca2d[_0x7cea47[_0x2229('0x38')]]={'$like':'%'+_0x2ba5f8[_0x2229('0x42')][_0x2229('0x4c')]+'%'};return _0x36ca2d;}})});}_0x4bc757=_[_0x2229('0x4f')]({},_0x4bc757,_0x2ba5f8['options']);var _0x5874e9={'where':_0x4bc757['where']};return db[_0x2229('0x3c')][_0x2229('0x30')](_0x5874e9)['then'](function(_0x23113c){_0x22bb50['count']=_0x23113c;if(_0x2ba5f8[_0x2229('0x42')][_0x2229('0x50')]){_0x4bc757['include']=[{'all':!![]}];}return db['SmsAccount'][_0x2229('0x51')](_0x4bc757);})[_0x2229('0x34')](function(_0x3fc9b4){_0x22bb50[_0x2229('0x52')]=_0x3fc9b4;return _0x22bb50;})['then'](respondWithFilteredResult(_0x37200a,_0x4bc757))['catch'](handleError(_0x37200a,null));};exports[_0x2229('0x53')]=function(_0x4fbc03,_0x1d8873){var _0x388205={'raw':![],'where':{'id':_0x4fbc03[_0x2229('0x54')]['id']},'include':[{'model':db[_0x2229('0x3b')],'as':_0x2229('0x55')}]},_0x8802a={};_0x8802a[_0x2229('0x41')]=_[_0x2229('0x43')](db[_0x2229('0x3c')]['rawAttributes']);_0x8802a['query']=_[_0x2229('0x43')](_0x4fbc03['query']);_0x8802a[_0x2229('0x44')]=_[_0x2229('0x45')](_0x8802a[_0x2229('0x41')],_0x8802a[_0x2229('0x42')]);_0x388205[_0x2229('0x47')]=_[_0x2229('0x45')](_0x8802a[_0x2229('0x41')],qs[_0x2229('0x46')](_0x4fbc03[_0x2229('0x42')]['fields']));_0x388205[_0x2229('0x47')]=_0x388205[_0x2229('0x47')][_0x2229('0x48')]?_0x388205['attributes']:_0x8802a[_0x2229('0x41')];if(_0x4fbc03[_0x2229('0x42')][_0x2229('0x50')]){_0x388205[_0x2229('0x56')]=[{'all':!![]}];}_0x388205=_[_0x2229('0x4f')]({},_0x388205,_0x4fbc03[_0x2229('0x57')]);return db[_0x2229('0x3c')][_0x2229('0x58')](_0x388205)[_0x2229('0x34')](handleEntityNotFound(_0x1d8873,null))['then'](respondWithResult(_0x1d8873,null))['catch'](handleError(_0x1d8873,null));};exports[_0x2229('0x59')]=function(_0xffaf6a,_0x407e1b){return db['SmsAccount']['create'](_0xffaf6a[_0x2229('0x5a')],{})[_0x2229('0x34')](function(_0x3dcab7){var _0x522438=_0xffaf6a['user']['get']({'plain':!![]});if(!_0x522438)throw new Error(_0x2229('0x5b'));if(_0x522438[_0x2229('0x5c')]===_0x2229('0x5d')){var _0x1957b0=_0x3dcab7['get']({'plain':!![]});var _0x5a3677='SmsAccounts';return db['UserProfileSection'][_0x2229('0x58')]({'where':{'name':_0x5a3677,'userProfileId':_0x522438[_0x2229('0x5e')]},'raw':!![]})[_0x2229('0x34')](function(_0x4126fa){if(_0x4126fa&&_0x4126fa[_0x2229('0x5f')]===0x0){return db[_0x2229('0x36')][_0x2229('0x59')]({'name':_0x1957b0[_0x2229('0x38')],'resourceId':_0x1957b0['id'],'type':_0x4126fa[_0x2229('0x38')],'sectionId':_0x4126fa['id']},{})[_0x2229('0x34')](function(){return _0x3dcab7;});}else{return _0x3dcab7;}})[_0x2229('0x28')](function(_0x41e947){logger[_0x2229('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41e947);throw _0x41e947;});}return _0x3dcab7;})[_0x2229('0x34')](respondWithResult(_0x407e1b,0xc9))[_0x2229('0x28')](handleError(_0x407e1b,null));};exports[_0x2229('0x33')]=function(_0x572fb4,_0x2025e3){if(_0x572fb4[_0x2229('0x5a')]['id']){delete _0x572fb4[_0x2229('0x5a')]['id'];}return db['SmsAccount'][_0x2229('0x58')]({'where':{'id':_0x572fb4['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x2229('0x34')](handleEntityNotFound(_0x2025e3,null))[_0x2229('0x34')](saveUpdates(_0x572fb4[_0x2229('0x5a')],null))[_0x2229('0x34')](respondWithResult(_0x2025e3,null))[_0x2229('0x28')](handleError(_0x2025e3,null));};exports['destroy']=function(_0x1b2617,_0x1b9ec2){return db['SmsAccount'][_0x2229('0x58')]({'where':{'id':_0x1b2617['params']['id']}})['then'](handleEntityNotFound(_0x1b9ec2,null))[_0x2229('0x34')](removeEntity(_0x1b9ec2,null))['catch'](handleError(_0x1b9ec2,null));};exports[_0x2229('0x60')]=function(_0x55729a,_0x586676){return db[_0x2229('0x3c')][_0x2229('0x60')]()[_0x2229('0x34')](respondWithResult(_0x586676,null))[_0x2229('0x28')](handleError(_0x586676,null));};exports[_0x2229('0x61')]=function(_0xcd9d81,_0x143288,_0x406e7f){if(_0xcd9d81[_0x2229('0x5a')]['id']){delete _0xcd9d81[_0x2229('0x5a')]['id'];}return db[_0x2229('0x3c')]['find']({'where':{'id':_0xcd9d81['params']['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x143288,null))[_0x2229('0x34')](function(_0x365d77){if(_0x365d77){_0xcd9d81[_0x2229('0x5a')]['SmsAccountId']=_0x365d77['id'];return db['Disposition'][_0x2229('0x59')](_0xcd9d81[_0x2229('0x5a')]);}})['then'](respondWithResult(_0x143288,null))[_0x2229('0x28')](handleError(_0x143288,null));};exports[_0x2229('0x62')]=function(_0x19fbbe,_0x174820,_0x24e22a){var _0x1ddca1={'raw':![],'where':{}};var _0x42602a={};var _0x272760={'count':0x0,'rows':[]};return db[_0x2229('0x3c')]['findOne']({'where':{'id':_0x19fbbe[_0x2229('0x54')]['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x174820,null))[_0x2229('0x34')](function(_0x2d0f72){if(_0x2d0f72){_0x42602a['model']=_[_0x2229('0x43')](db[_0x2229('0x63')][_0x2229('0x3d')]);_0x42602a[_0x2229('0x42')]=_['keys'](_0x19fbbe[_0x2229('0x42')]);_0x42602a[_0x2229('0x44')]=_['intersection'](_0x42602a['model'],_0x42602a[_0x2229('0x42')]);_0x1ddca1['attributes']=_[_0x2229('0x45')](_0x42602a[_0x2229('0x41')],qs[_0x2229('0x46')](_0x19fbbe[_0x2229('0x42')]['fields']));_0x1ddca1[_0x2229('0x47')]=_0x1ddca1[_0x2229('0x47')][_0x2229('0x48')]?_0x1ddca1[_0x2229('0x47')]:_0x42602a[_0x2229('0x41')];if(!_0x19fbbe['query']['hasOwnProperty'](_0x2229('0x64'))){_0x1ddca1[_0x2229('0x2f')]=qs['limit'](_0x19fbbe['query']['limit']);_0x1ddca1[_0x2229('0x2d')]=qs[_0x2229('0x2d')](_0x19fbbe[_0x2229('0x42')][_0x2229('0x2d')]);}_0x1ddca1['order']=qs[_0x2229('0x65')](_0x19fbbe[_0x2229('0x42')][_0x2229('0x65')]);_0x1ddca1[_0x2229('0x4a')]=qs['filters'](_[_0x2229('0x4b')](_0x19fbbe[_0x2229('0x42')],_0x42602a[_0x2229('0x44')]));_0x1ddca1[_0x2229('0x4a')][_0x2229('0x66')]=_0x2d0f72['id'];if(_0x19fbbe[_0x2229('0x42')][_0x2229('0x4c')]){_0x1ddca1[_0x2229('0x4a')]=_[_0x2229('0x4f')](_0x1ddca1[_0x2229('0x4a')],{'$or':_[_0x2229('0x4d')](_0x1ddca1['attributes'],function(_0x476bf6){var _0x3dcbff={};_0x3dcbff[_0x476bf6]={'$like':'%'+_0x19fbbe[_0x2229('0x42')][_0x2229('0x4c')]+'%'};return _0x3dcbff;})});}_0x1ddca1=_['merge']({},_0x1ddca1,_0x19fbbe[_0x2229('0x57')]);return db['Disposition'][_0x2229('0x30')]({'where':_0x1ddca1[_0x2229('0x4a')]})[_0x2229('0x34')](function(_0x2a392c){_0x272760[_0x2229('0x30')]=_0x2a392c;if(_0x19fbbe[_0x2229('0x42')][_0x2229('0x50')]){_0x1ddca1[_0x2229('0x56')]=[{'all':!![]}];}return db[_0x2229('0x63')][_0x2229('0x51')](_0x1ddca1);})['then'](function(_0x133ff6){_0x272760[_0x2229('0x52')]=_0x133ff6;return _0x272760;});}})['then'](respondWithFilteredResult(_0x174820,_0x1ddca1))[_0x2229('0x28')](handleError(_0x174820,null));};exports[_0x2229('0x67')]=function(_0x31efde,_0x4f9126,_0x1f6cd5){return db['SmsAccount'][_0x2229('0x58')]({'where':{'id':_0x31efde[_0x2229('0x54')]['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x4f9126,null))[_0x2229('0x34')](function(_0x57e6ca){if(_0x57e6ca){return _0x57e6ca[_0x2229('0x67')](_0x31efde[_0x2229('0x42')][_0x2229('0x68')]);}})[_0x2229('0x34')](respondWithStatusCode(_0x4f9126,null))['catch'](handleError(_0x4f9126,null));};exports['addAnswer']=function(_0x1f14c0,_0x492cff,_0x543395){if(_0x1f14c0['body']['id']){delete _0x1f14c0[_0x2229('0x5a')]['id'];}return db['SmsAccount'][_0x2229('0x58')]({'where':{'id':_0x1f14c0['params']['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x492cff,null))['then'](function(_0x185540){if(_0x185540){_0x1f14c0[_0x2229('0x5a')][_0x2229('0x66')]=_0x185540['id'];return db['CannedAnswer']['create'](_0x1f14c0[_0x2229('0x5a')]);}})['then'](respondWithResult(_0x492cff,null))['catch'](handleError(_0x492cff,null));};exports['getAnswers']=function(_0x3ded1e,_0x230977,_0x3f8a13){var _0x53ae65={'raw':![],'where':{}};var _0x1569f7={};var _0x2e14dd={'count':0x0,'rows':[]};return db[_0x2229('0x3c')]['findOne']({'where':{'id':_0x3ded1e['params']['id']}})['then'](handleEntityNotFound(_0x230977,null))[_0x2229('0x34')](function(_0x3d89e9){if(_0x3d89e9){_0x1569f7['model']=_['keys'](db['CannedAnswer'][_0x2229('0x3d')]);_0x1569f7[_0x2229('0x42')]=_[_0x2229('0x43')](_0x3ded1e[_0x2229('0x42')]);_0x1569f7[_0x2229('0x44')]=_['intersection'](_0x1569f7['model'],_0x1569f7[_0x2229('0x42')]);_0x53ae65[_0x2229('0x47')]=_[_0x2229('0x45')](_0x1569f7['model'],qs['fields'](_0x3ded1e[_0x2229('0x42')][_0x2229('0x46')]));_0x53ae65['attributes']=_0x53ae65[_0x2229('0x47')][_0x2229('0x48')]?_0x53ae65[_0x2229('0x47')]:_0x1569f7['model'];if(!_0x3ded1e[_0x2229('0x42')][_0x2229('0x49')]('nolimit')){_0x53ae65['limit']=qs[_0x2229('0x2f')](_0x3ded1e['query']['limit']);_0x53ae65[_0x2229('0x2d')]=qs['offset'](_0x3ded1e[_0x2229('0x42')]['offset']);}_0x53ae65[_0x2229('0x69')]=qs['sort'](_0x3ded1e[_0x2229('0x42')]['sort']);_0x53ae65[_0x2229('0x4a')]=qs[_0x2229('0x44')](_[_0x2229('0x4b')](_0x3ded1e['query'],_0x1569f7['filters']));_0x53ae65[_0x2229('0x4a')][_0x2229('0x66')]=_0x3d89e9['id'];if(_0x3ded1e[_0x2229('0x42')][_0x2229('0x4c')]){_0x53ae65[_0x2229('0x4a')]=_['merge'](_0x53ae65[_0x2229('0x4a')],{'$or':_[_0x2229('0x4d')](_0x53ae65['attributes'],function(_0x30d4d1){var _0x43a410={};_0x43a410[_0x30d4d1]={'$like':'%'+_0x3ded1e[_0x2229('0x42')][_0x2229('0x4c')]+'%'};return _0x43a410;})});}_0x53ae65=_[_0x2229('0x4f')]({},_0x53ae65,_0x3ded1e[_0x2229('0x57')]);return db[_0x2229('0x6a')][_0x2229('0x30')]({'where':_0x53ae65[_0x2229('0x4a')]})[_0x2229('0x34')](function(_0x1ccbb6){_0x2e14dd[_0x2229('0x30')]=_0x1ccbb6;if(_0x3ded1e[_0x2229('0x42')][_0x2229('0x50')]){_0x53ae65[_0x2229('0x56')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x53ae65);})[_0x2229('0x34')](function(_0x4a69a2){_0x2e14dd[_0x2229('0x52')]=_0x4a69a2;return _0x2e14dd;});}})['then'](respondWithFilteredResult(_0x230977,_0x53ae65))[_0x2229('0x28')](handleError(_0x230977,null));};exports['removeAnswers']=function(_0x20db0c,_0x41d15e,_0x251c56){return db[_0x2229('0x3c')][_0x2229('0x58')]({'where':{'id':_0x20db0c[_0x2229('0x54')]['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x41d15e,null))[_0x2229('0x34')](function(_0x148f8a){if(_0x148f8a){return _0x148f8a[_0x2229('0x6b')](_0x20db0c[_0x2229('0x42')][_0x2229('0x68')]);}})[_0x2229('0x34')](respondWithStatusCode(_0x41d15e,null))[_0x2229('0x28')](handleError(_0x41d15e,null));};exports[_0x2229('0x6c')]=function(_0x1aad48,_0x11cc0f,_0x1ca618){var _0x4a289b={'channel':_0x2229('0x6d')};var _0x236856=[];var _0x18401c=[];var _0x156186={};return db[_0x2229('0x3c')][_0x2229('0x58')]({'where':{'id':_0x1aad48[_0x2229('0x54')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x2229('0x6e')}]})[_0x2229('0x34')](handleEntityNotFound(_0x11cc0f,null))['then'](function(_0x49eb0b){_0x4a289b[_0x2229('0x6f')]=_0x49eb0b;_0x4a289b['applications']=_[_0x2229('0x70')](_0x49eb0b[_0x2229('0x6e')],[_0x2229('0x71')],[_0x2229('0x72')]);if(_0x4a289b[_0x2229('0x6f')][_0x2229('0x6e')]){delete _0x4a289b[_0x2229('0x6f')][_0x2229('0x6e')];}return db['CmContact'][_0x2229('0x60')]();})[_0x2229('0x34')](function(_0xc2c0de){if(!_0xc2c0de){throw new db['Sequelize'][(_0x2229('0x73'))]('no\x20available\x20attributes');}_0x236856=_[_0x2229('0x74')](_['keys'](_0xc2c0de),[_0x2229('0x75'),'updatedAt']);_0x18401c=_[_0x2229('0x74')](_[_0x2229('0x43')](_0xc2c0de),['createdAt',_0x2229('0x76'),_0x2229('0x77'),_0x2229('0x78')]);_0x4a289b[_0x2229('0x5a')]={'mapKey':'mobile'};if(_0x4a289b[_0x2229('0x6f')][_0x2229('0x3f')]){switch(_0x4a289b['account']['type']){case _0x2229('0x79'):_0x4a289b['body'][_0x2229('0x7a')]=_0x1aad48['body'][_0x2229('0x7b')];_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')]=_0x1aad48[_0x2229('0x5a')]['Body'];_0x4a289b[_0x2229('0x5a')][_0x2229('0x7c')]=_0x1aad48['body'][_0x2229('0x7d')];break;case _0x2229('0x7e'):_0x4a289b[_0x2229('0x5a')][_0x2229('0x7a')]='+'+_0x1aad48[_0x2229('0x5a')]['sender'];_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')]=_0x1aad48['body'][_0x2229('0x7f')];break;case _0x2229('0x80'):_0x4a289b[_0x2229('0x5a')][_0x2229('0x7a')]=_0x1aad48['body'][_0x2229('0x7a')];_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')]=_0x1aad48[_0x2229('0x5a')][_0x2229('0x26')];break;case'clicksend':_0x4a289b[_0x2229('0x5a')]['from']=_0x1aad48[_0x2229('0x5a')][_0x2229('0x7a')];_0x4a289b['body']['body']=_0x1aad48['body'][_0x2229('0x5a')];_0x4a289b[_0x2229('0x5a')][_0x2229('0x7c')]=_0x1aad48[_0x2229('0x5a')][_0x2229('0x81')];break;case _0x2229('0x82'):_0x4a289b[_0x2229('0x5a')][_0x2229('0x7a')]=_0x1aad48['body']['From'];_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')]=_0x1aad48['body'][_0x2229('0x83')];_0x4a289b[_0x2229('0x5a')][_0x2229('0x7c')]=_0x1aad48[_0x2229('0x5a')]['MessageUUID'];break;case _0x2229('0x84'):_0x4a289b['body'][_0x2229('0x7a')]='+'+_0x1aad48[_0x2229('0x5a')][_0x2229('0x85')][0x0][_0x2229('0x7a')];_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')]=_0x1aad48[_0x2229('0x5a')][_0x2229('0x85')][0x0]['text'];_0x4a289b[_0x2229('0x5a')]['messageId']=_0x1aad48[_0x2229('0x5a')]['results'][0x0]['messageId'];break;case _0x2229('0x86'):_0x4a289b[_0x2229('0x5a')][_0x2229('0x7a')]=_0x1aad48[_0x2229('0x5a')][_0x2229('0x87')];_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')]=_0x1aad48['body'][_0x2229('0x88')][_0x2229('0x26')];break;case'clickatell':_0x4a289b['body'][_0x2229('0x7a')]=_0x1aad48[_0x2229('0x5a')]['fromNumber'];_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')]=_0x1aad48['body'][_0x2229('0x7f')];_0x4a289b[_0x2229('0x5a')][_0x2229('0x7c')]=_0x1aad48[_0x2229('0x5a')][_0x2229('0x89')];break;case _0x2229('0x8a'):_0x4a289b[_0x2229('0x5a')][_0x2229('0x7c')]=_0x1aad48[_0x2229('0x5a')][0x0][_0x2229('0x26')]['id'];_0x4a289b[_0x2229('0x5a')][_0x2229('0x7a')]=_0x1aad48['body'][0x0][_0x2229('0x26')][_0x2229('0x7a')];_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')]=_0x1aad48[_0x2229('0x5a')][0x0][_0x2229('0x26')]['text'];break;case _0x2229('0x8b'):_0x4a289b[_0x2229('0x5a')][_0x2229('0x7a')]=_0x1aad48[_0x2229('0x5a')][_0x2229('0x7a')];_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')]=_0x1aad48[_0x2229('0x5a')]['message'];_0x4a289b[_0x2229('0x5a')][_0x2229('0x7c')]=_0x1aad48[_0x2229('0x5a')][_0x2229('0x8c')];break;}}if(_0x4a289b[_0x2229('0x5a')]['id']){delete _0x4a289b[_0x2229('0x5a')]['id'];}if(_['isNil'](_0x4a289b[_0x2229('0x5a')]['from'])){throw new db[(_0x2229('0x8d'))][(_0x2229('0x73'))](_0x2229('0x8e'));}if(_[_0x2229('0x8f')](_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')])||_0x4a289b[_0x2229('0x5a')]['body']===''){throw new db[(_0x2229('0x8d'))][(_0x2229('0x73'))](_0x2229('0x90'));}if(_[_0x2229('0x8f')](_0x4a289b['body']['mapKey'])){throw new db[(_0x2229('0x8d'))][(_0x2229('0x73'))](_0x2229('0x91')+_0x18401c);}if(!_['includes'](_0x18401c,_0x4a289b[_0x2229('0x5a')][_0x2229('0x92')])){throw new db[(_0x2229('0x8d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18401c);}_0x156186[_0x4a289b[_0x2229('0x5a')][_0x2229('0x92')]]=_0x4a289b['body'][_0x2229('0x7a')];return db[_0x2229('0x93')][_0x2229('0x58')]({'where':{'id':_0x4a289b[_0x2229('0x6f')]['ListId']},'include':[{'model':db[_0x2229('0x94')],'as':'Contacts','where':_0x156186,'limit':0x1,'order':[[_0x2229('0x76'),_0x2229('0x95')]]}]});})[_0x2229('0x34')](handleEntityNotFound(_0x11cc0f,null))[_0x2229('0x34')](function(_0x33f0ff){if(_0x33f0ff){_0x4a289b[_0x2229('0x96')]=_[_0x2229('0x97')](_0x33f0ff,[_0x2229('0x98')]);if(_0x33f0ff[_0x2229('0x98')][_0x2229('0x48')]){return _0x33f0ff[_0x2229('0x98')][0x0];}var _0x5dedec=_[_0x2229('0x1b')](_0x4a289b[_0x2229('0x5a')],{'firstName':_0x4a289b[_0x2229('0x5a')]['from'],'ListId':_0x33f0ff['id']});_0x5dedec[_0x4a289b[_0x2229('0x5a')][_0x2229('0x92')]]=_0x4a289b[_0x2229('0x5a')]['from'];return db[_0x2229('0x94')][_0x2229('0x59')](_0x5dedec,{'fields':_0x236856,'raw':!![]});}})[_0x2229('0x34')](handleEntityNotFound(_0x11cc0f,null))[_0x2229('0x34')](function(_0x174a6c){if(_0x174a6c){_0x4a289b[_0x2229('0x99')]=_0x174a6c;var _0x2a999c={'ContactId':_0x174a6c['id'],'phone':_0x4a289b[_0x2229('0x5a')]['from'],'SmsAccountId':_0x1aad48[_0x2229('0x54')]['id']};var _0x1f854d={'ContactId':_0x174a6c['id'],'SmsAccountId':_0x1aad48[_0x2229('0x54')]['id'],'closed':![]};return db[_0x2229('0x9a')][_0x2229('0x58')]({'where':_0x1f854d})['then'](function(_0x19dfaa){if(_0x19dfaa){return[_0x19dfaa,![]];}return db[_0x2229('0x9a')][_0x2229('0x59')](_0x2a999c)[_0x2229('0x34')](function(_0x3e60ca){return[_0x3e60ca,!![]];});});}})[_0x2229('0x9b')](function(_0x54be86,_0x5c463f){_0x4a289b[_0x2229('0x9c')]=_0x54be86[_0x2229('0x35')]({'plain':!![]});_0x4a289b[_0x2229('0x9c')]['created']=![];if(_0x5c463f){if(_0x4a289b[_0x2229('0x6f')]['autoclose']){_0x4a289b[_0x2229('0x9d')][_0x2229('0x9e')]({'id':0x0,'priority':_0x4a289b[_0x2229('0x9d')][_0x2229('0x48')]+0x1,'app':_0x2229('0x9f'),'appdata':_0x2229('0xa0'),'interval':'*,*,*,*'});}_0x4a289b[_0x2229('0x9c')]['created']=!![];}return db[_0x2229('0xa1')][_0x2229('0x59')]({'phone':_0x4a289b['body'][_0x2229('0x7a')],'messageId':_0x4a289b['body']['messageId'],'body':_0x4a289b[_0x2229('0x5a')][_0x2229('0x5a')],'SmsAccountId':_0x1aad48['params']['id'],'SmsInteractionId':_0x54be86['id'],'direction':'in','ContactId':_0x54be86[_0x2229('0xa2')],'AttachmentId':_0x4a289b[_0x2229('0x5a')][_0x2229('0xa3')]});})[_0x2229('0x34')](function(_0x18beef){_0x4a289b[_0x2229('0x26')]=_0x18beef;if(_0x4a289b[_0x2229('0x9c')][_0x2229('0xa4')]){return db[_0x2229('0xa5')][_0x2229('0x58')]({'attributes':['id',_0x2229('0x38')],'where':{'id':_0x4a289b[_0x2229('0x9c')][_0x2229('0xa4')]}})[_0x2229('0x34')](function(_0x21af2f){if(_0x21af2f){_0x4a289b['applications'][_0x2229('0xa6')]({'id':0x0,'priority':0x0,'app':_0x2229('0xa7'),'appdata':_0x21af2f[_0x2229('0x38')]+','+(_0x4a289b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x2229('0xa8')});}return respondWithRpcPromise(_0x2229('0xa9'),_0x2229('0xaa'),_0x4a289b);});}return respondWithRpcPromise(_0x2229('0xa9'),_0x2229('0xaa'),_0x4a289b);})[_0x2229('0x34')](function(_0x10182a){if(_0x10182a){var _0x5ded41=0xc8;var _0x16406d=_0x2229('0xab');logger[_0x2229('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x16406d,_0x5ded41,_0x2229('0xac'));logger[_0x2229('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x16406d,_0x5ded41,_0x2229('0xac'),JSON[_0x2229('0x24')](_0x10182a));if(_0x4a289b[_0x2229('0x6f')][_0x2229('0x3f')]===_0x2229('0x79')){return _0x11cc0f[_0x2229('0x2a')](_0x5ded41)['set'](_0x2229('0xad'),_0x2229('0xae'))['send']('\x0a');}else{return _0x11cc0f[_0x2229('0x2a')](_0x5ded41)[_0x2229('0x2c')](_0x10182a);}}})[_0x2229('0x28')](handleError(_0x11cc0f,null));};exports[_0x2229('0xaf')]=function(_0xc03d2f,_0x57a526){var _0x5acc3e=_0xc03d2f['params']['id'];var _0x508e87=_0xc03d2f[_0x2229('0x5a')];var _0x1bf0d8=0xc8;var _0x2ddf91=null;return db[_0x2229('0xb0')][_0x2229('0xb1')]({'isolationLevel':db[_0x2229('0xb0')][_0x2229('0xb2')]['ISOLATION_LEVELS'][_0x2229('0xb3')]},function(_0x4ec386){return db[_0x2229('0x3c')]['findOne']({'where':{'id':_0x5acc3e},'transaction':_0x4ec386})[_0x2229('0x34')](function(_0x326407){if(_0x326407){return db[_0x2229('0xb4')][_0x2229('0x37')]({'where':{'SmsAccountId':_0x5acc3e},'transaction':_0x4ec386})[_0x2229('0x34')](function(){var _0x57eaf7=_[_0x2229('0x4d')](_0x508e87,function(_0x307cb6){_0x307cb6[_0x2229('0x66')]=_0x5acc3e;return _0x307cb6;});return db[_0x2229('0xb4')]['bulkCreate'](_0x57eaf7,{'transaction':_0x4ec386});});}else{_0x1bf0d8=0x194;_0x2ddf91=[];}});})[_0x2229('0x34')](function(){if(_0x1bf0d8!==0x194){return db[_0x2229('0xb4')][_0x2229('0xb5')]({'where':{'SmsAccountId':_0x5acc3e},'order':_0x2229('0x71')})['then'](function(_0x3f6bda){_0x2ddf91=_0x3f6bda;});}})[_0x2229('0x28')](function(_0x1d4f87){_0x1bf0d8=0x1f4;logger[_0x2229('0x25')](_0x1d4f87[_0x2229('0xb6')]);if(_0x1d4f87[_0x2229('0x38')]){delete _0x1d4f87[_0x2229('0x38')];}_0x2ddf91=_0x1d4f87;})[_0x2229('0xb7')](function(){if(_0x2ddf91===null){_0x57a526[_0x2229('0x29')](_0x1bf0d8);}else{if(_0x1bf0d8===0x1f4){_0x57a526[_0x2229('0x2a')](_0x1bf0d8)[_0x2229('0x39')](_0x2ddf91);}else{_0x57a526[_0x2229('0x2a')](_0x1bf0d8)[_0x2229('0x2c')](_0x2ddf91);}}});};exports['getApplications']=function(_0x43e61d,_0x2142db,_0x2b273d){var _0x12a431={};var _0xf60a34={};var _0x40f6f9;var _0x312ff3;return db[_0x2229('0x3c')][_0x2229('0xb8')]({'where':{'id':_0x43e61d[_0x2229('0x54')]['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x2142db,null))[_0x2229('0x34')](function(_0x453e1b){if(_0x453e1b){_0x40f6f9=_0x453e1b;_0xf60a34[_0x2229('0x41')]=_['keys'](db[_0x2229('0xb4')][_0x2229('0x3d')]);_0xf60a34[_0x2229('0x42')]=_[_0x2229('0x43')](_0x43e61d[_0x2229('0x42')]);_0xf60a34[_0x2229('0x44')]=_['intersection'](_0xf60a34[_0x2229('0x41')],_0xf60a34['query']);_0x12a431[_0x2229('0x47')]=_[_0x2229('0x45')](_0xf60a34[_0x2229('0x41')],qs['fields'](_0x43e61d[_0x2229('0x42')][_0x2229('0x46')]));_0x12a431[_0x2229('0x47')]=_0x12a431[_0x2229('0x47')]['length']?_0x12a431[_0x2229('0x47')]:_0xf60a34[_0x2229('0x41')];_0x12a431[_0x2229('0x69')]=qs['sort'](_0x43e61d[_0x2229('0x42')][_0x2229('0x65')]);_0x12a431['where']=qs[_0x2229('0x44')](_['pick'](_0x43e61d['query'],_0xf60a34['filters']));if(_0x43e61d[_0x2229('0x42')][_0x2229('0x4c')]){_0x12a431['where']=_[_0x2229('0x4f')](_0x12a431[_0x2229('0x4a')],{'$or':_[_0x2229('0x4d')](_0x12a431['attributes'],function(_0x2a9a8c){var _0x2bed00={};_0x2bed00[_0x2a9a8c]={'$like':'%'+_0x43e61d['query'][_0x2229('0x4c')]+'%'};return _0x2bed00;})});}_0x12a431=_['merge']({},_0x12a431,_0x43e61d[_0x2229('0x57')]);return _0x40f6f9[_0x2229('0xb9')](_0x12a431);}})['then'](function(_0x46fa5d){if(_0x46fa5d){_0x312ff3=_0x46fa5d[_0x2229('0x48')];if(!_0x43e61d[_0x2229('0x42')][_0x2229('0x49')](_0x2229('0x64'))){_0x12a431['limit']=qs['limit'](_0x43e61d['query'][_0x2229('0x2f')]);_0x12a431['offset']=qs['offset'](_0x43e61d['query'][_0x2229('0x2d')]);}return _0x40f6f9[_0x2229('0xb9')](_0x12a431);}})['then'](function(_0x44c155){if(_0x44c155){return _0x44c155?{'count':_0x312ff3,'rows':_0x44c155}:null;}})['then'](respondWithResult(_0x2142db,null))[_0x2229('0x28')](handleError(_0x2142db,null));};exports[_0x2229('0xba')]=function(_0x495305,_0x4d2a61,_0x25145d){var _0x1c8df2={'raw':![],'where':{}};var _0x1ac771={};var _0xe0e3cc={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x495305[_0x2229('0x54')]['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x4d2a61,null))[_0x2229('0x34')](function(_0x535340){if(_0x535340){_0x1ac771[_0x2229('0x41')]=_[_0x2229('0x43')](db[_0x2229('0x9a')]['rawAttributes']);_0x1ac771['query']=_['keys'](_0x495305[_0x2229('0x42')]);_0x1ac771[_0x2229('0x44')]=_[_0x2229('0x45')](_0x1ac771[_0x2229('0x41')],_0x1ac771[_0x2229('0x42')]);_0x1c8df2[_0x2229('0x47')]=_['intersection'](_0x1ac771['model'],qs['fields'](_0x495305[_0x2229('0x42')]['fields']));_0x1c8df2[_0x2229('0x47')]=_0x1c8df2[_0x2229('0x47')][_0x2229('0x48')]?_0x1c8df2[_0x2229('0x47')]:_0x1ac771['model'];if(!_0x495305[_0x2229('0x42')][_0x2229('0x49')](_0x2229('0x64'))){_0x1c8df2[_0x2229('0x2f')]=qs['limit'](_0x495305[_0x2229('0x42')]['limit']);_0x1c8df2[_0x2229('0x2d')]=qs['offset'](_0x495305[_0x2229('0x42')][_0x2229('0x2d')]);}_0x1c8df2[_0x2229('0x69')]=qs[_0x2229('0x65')](_0x495305['query'][_0x2229('0x65')]);_0x1c8df2[_0x2229('0x4a')]=qs['filters'](_['pick'](_0x495305['query'],_0x1ac771[_0x2229('0x44')]));_0x1c8df2[_0x2229('0x4a')][_0x2229('0x66')]=_0x535340['id'];if(_0x495305['query'][_0x2229('0x4c')]){_0x1c8df2['where']=_[_0x2229('0x4f')](_0x1c8df2[_0x2229('0x4a')],{'$or':_['map'](_0x1c8df2[_0x2229('0x47')],function(_0x4cb9b5){var _0x451ec3={};_0x451ec3[_0x4cb9b5]={'$like':'%'+_0x495305[_0x2229('0x42')]['filter']+'%'};return _0x451ec3;})});}_0x1c8df2=_['merge']({},_0x1c8df2,_0x495305[_0x2229('0x57')]);return db[_0x2229('0x9a')][_0x2229('0x30')]({'where':_0x1c8df2['where']})['then'](function(_0x3d8dd5){_0xe0e3cc[_0x2229('0x30')]=_0x3d8dd5;if(_0x495305[_0x2229('0x42')]['includeAll']){_0x1c8df2[_0x2229('0x56')]=[{'model':db[_0x2229('0x94')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x2229('0xbb'),'attributes':[_0x2229('0x38'),_0x2229('0xbc'),_0x2229('0xbd')],'required':![]},{'model':db[_0x2229('0xbe')],'as':'Tags','attributes':['id','name',_0x2229('0xbf')],'where':_0x495305[_0x2229('0x42')]['tag']?{'id':_0x495305[_0x2229('0x42')]['tag']}:undefined,'required':_0x495305[_0x2229('0x42')][_0x2229('0xc0')]?!![]:![]}];}return db[_0x2229('0x9a')][_0x2229('0x51')](_0x1c8df2);})[_0x2229('0x34')](function(_0x4a6250){_0xe0e3cc['rows']=_0x4a6250;return _0xe0e3cc;});}})[_0x2229('0x34')](respondWithFilteredResult(_0x4d2a61,_0x1c8df2))[_0x2229('0x28')](handleError(_0x4d2a61,null));};exports[_0x2229('0x39')]=function(_0x374598,_0xd9dda0,_0x579de7){var _0x2a55cf,_0x2483ed,_0x4db2bd;if(_[_0x2229('0x8f')](_0x374598[_0x2229('0x5a')][_0x2229('0x5a')])||_0x374598['body'][_0x2229('0x5a')]===''){throw new db[(_0x2229('0x8d'))]['ValidationError'](_0x2229('0x90'));}if(_[_0x2229('0x8f')](_0x374598[_0x2229('0x5a')]['to'])){throw new db[(_0x2229('0x8d'))][(_0x2229('0x73'))](_0x2229('0xc1'));}_0x2a55cf=_0x374598[_0x2229('0x5a')]['to'];return db[_0x2229('0x3c')][_0x2229('0x58')]({'where':{'id':_0x374598['params']['id']},'include':[{'model':db[_0x2229('0x93')],'as':_0x2229('0xc2'),'include':[{'model':db[_0x2229('0x94')],'as':_0x2229('0x98'),'where':{'mobile':_0x2a55cf},'limit':0x1,'order':[['updatedAt',_0x2229('0x95')]]}]}]})[_0x2229('0x34')](handleEntityNotFound(_0xd9dda0,null))[_0x2229('0x34')](function(_0x48ef9e){if(_0x48ef9e&&_0x48ef9e[_0x2229('0xc2')]){_0x2483ed=_0x48ef9e[_0x2229('0x35')]({'plain':!![]});if(_0x2483ed['List']&&_0x2483ed[_0x2229('0xc2')]['Contacts']['length']){return _0x2483ed[_0x2229('0xc2')][_0x2229('0x98')][0x0];}return db[_0x2229('0x94')]['create'](_[_0x2229('0x1b')](_0x374598['body'],{'firstName':_0x2a55cf,'mobile':_0x2a55cf,'phone':_0x2a55cf,'ListId':_0x2483ed['ListId']}));}})[_0x2229('0x34')](handleEntityNotFound(_0xd9dda0,null))[_0x2229('0x34')](function(_0x2978c3){if(_0x2978c3){_0x4db2bd=_0x2978c3;return db[_0x2229('0x9a')][_0x2229('0x58')]({'where':{'ContactId':_0x4db2bd['id'],'closed':![],'SmsAccountId':_0x2483ed['id']}})[_0x2229('0x34')](function(_0x47d02f){if(_0x47d02f){return[_0x47d02f,![]];}return db[_0x2229('0x9a')][_0x2229('0x59')]({'UserId':_0x374598[_0x2229('0x5d')]['id'],'ContactId':_0x4db2bd['id'],'SmsAccountId':_0x2483ed['id'],'phone':_0x2a55cf,'firstMsgDirection':_0x2229('0xc3'),'Messages':[_[_0x2229('0x4f')](_0x374598['body'],{'read':![],'body':_0x374598[_0x2229('0x5a')][_0x2229('0x5a')],'phone':_0x2a55cf,'SmsAccountId':_0x2483ed['id'],'UserId':_0x374598['user']['id'],'ContactId':_0x4db2bd['id']})]},{'include':[{'model':db[_0x2229('0xa1')],'as':_0x2229('0xc4')}]})[_0x2229('0x34')](function(_0x4ea181){return[_0x4ea181,!![]];});});}})[_0x2229('0x9b')](function(_0x32db62,_0x10bfa9){if(_0x10bfa9){return _0x32db62;}return db['SmsMessage'][_0x2229('0x59')](_['merge'](_0x374598[_0x2229('0x5a')],{'read':![],'body':_0x374598[_0x2229('0x5a')][_0x2229('0x5a')],'phone':_0x2a55cf,'SmsAccountId':_0x2483ed['id'],'SmsInteractionId':_0x32db62['id'],'UserId':_0x374598[_0x2229('0x5d')]['id'],'ContactId':_0x4db2bd['id']}))[_0x2229('0x34')](function(_0x561770){_0x32db62['dataValues'][_0x2229('0xc4')]=[];_0x32db62[_0x2229('0xc5')][_0x2229('0xc4')]['push'](_0x561770[_0x2229('0xc5')]);return _0x32db62;});})[_0x2229('0x34')](respondWithResult(_0xd9dda0,null))[_0x2229('0x28')](handleError(_0xd9dda0,null));};exports['status']=function(_0x330dba,_0x5738b3,_0x4eb178){if(_0x330dba[_0x2229('0x5a')]['id']){delete _0x330dba[_0x2229('0x5a')]['id'];}var _0x4f96b3,_0x2f4b6d,_0x11b9de;return db[_0x2229('0x3c')]['find']({'where':{'id':_0x330dba[_0x2229('0x54')]['id']}})['then'](handleEntityNotFound(_0x5738b3,null))[_0x2229('0x34')](function(_0x5b9b02){if(_0x5b9b02){_0x11b9de=_0x5b9b02;logger['debug'](_0x2229('0x23'),_0x2229('0x2a'),'received\x20delivery\x20report\x20from',_0x5b9b02[_0x2229('0x3f')],util[_0x2229('0xc6')](_0x330dba[_0x2229('0x5a')],{'showHidden':![],'depth':null}));switch(_0x5b9b02['type']){case _0x2229('0x7e'):if(_0x330dba[_0x2229('0x5a')][_0x2229('0xc7')]&&_0x330dba[_0x2229('0x5a')][_0x2229('0x2a')]){_0x2f4b6d=_0x330dba['body']['status'];return db[_0x2229('0xa1')]['find']({'where':{'messageId':_0x330dba[_0x2229('0x5a')][_0x2229('0xc7')]}});}break;case _0x2229('0x80'):if(_0x330dba[_0x2229('0x5a')][_0x2229('0xc8')]&&_0x330dba['body']['statusInt']){_0x2f4b6d=_0x330dba[_0x2229('0x5a')][_0x2229('0xc9')];return db['SmsMessage'][_0x2229('0x58')]({'where':{'messageId':_0x330dba[_0x2229('0x5a')][_0x2229('0xc8')]}});}break;case _0x2229('0xca'):if(_0x330dba['body'][_0x2229('0x81')]&&_0x330dba['body']['status_code']){_0x2f4b6d=_0x330dba[_0x2229('0x5a')][_0x2229('0xcb')];return db['SmsMessage'][_0x2229('0x58')]({'where':{'messageId':_0x330dba[_0x2229('0x5a')][_0x2229('0x81')]}});}break;case'infobip':var _0x3c3e17=_0x330dba[_0x2229('0x5a')][_0x2229('0x85')][0x0];if(_0x3c3e17[_0x2229('0x7c')]&&_0x3c3e17[_0x2229('0x2a')][_0x2229('0xcc')]===_0x2229('0xcd')){_0x2f4b6d=_0x3c3e17[_0x2229('0x2a')][_0x2229('0xcc')];return db[_0x2229('0xa1')][_0x2229('0x58')]({'where':{'messageId':_0x3c3e17[_0x2229('0x7c')]}});}break;case'clickatell':if(_0x330dba[_0x2229('0x5a')][_0x2229('0x7c')]&&_0x330dba['body'][_0x2229('0x2a')]){_0x2f4b6d=_0x330dba[_0x2229('0x5a')]['status'];return db['SmsMessage'][_0x2229('0x58')]({'where':{'messageId':_0x330dba['body'][_0x2229('0x7c')]}});}break;case'bandwidth':if(_0x330dba['body'][0x0][_0x2229('0x26')]['id']){_0x2f4b6d=_0x330dba[_0x2229('0x5a')][0x0][_0x2229('0x3f')];return db[_0x2229('0xa1')]['find']({'where':{'messageId':_0x330dba[_0x2229('0x5a')][0x0][_0x2229('0x26')]['id']}});}break;case _0x2229('0x8b'):if(_0x330dba[_0x2229('0x5a')]['redif']&&_0x330dba[_0x2229('0x5a')][_0x2229('0x2a')]){_0x2f4b6d=_0x330dba['body'][_0x2229('0x2a')];return db[_0x2229('0xa1')][_0x2229('0x58')]({'where':{'messageId':_0x330dba[_0x2229('0x5a')][_0x2229('0xce')]}});}break;}}})[_0x2229('0x34')](handleEntityNotFound(_0x5738b3,null))[_0x2229('0x34')](function(_0x135ad8){if(_0x135ad8){_0x4f96b3=_0x135ad8;switch(_0x11b9de[_0x2229('0x3f')]){case'skebby':if(_0x2f4b6d===_0x2229('0xcd')){return _0x4f96b3[_0x2229('0x33')]({'read':!![]});}else{logger['error'](_0x2229('0x23'),_0x2229('0x2a'),_0x2229('0x7e'),util[_0x2229('0xc6')](_0x330dba[_0x2229('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x2229('0x80'):if(_0x2f4b6d==='1'){return _0x4f96b3[_0x2229('0x33')]({'read':!![]});}else{logger[_0x2229('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x2229('0x7e'),util['inspect'](_0x330dba['body'],{'showHidden':![],'depth':null}));}break;case _0x2229('0xca'):if(!_0x330dba[_0x2229('0x5a')][_0x2229('0xcf')]&&_0x2f4b6d>=0xc8&&_0x2f4b6d<=0xce){return _0x4f96b3['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x2229('0xca'),util[_0x2229('0xc6')](_0x330dba[_0x2229('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x2229('0x84'):var _0x49024d=_0x330dba['body'][_0x2229('0x85')][0x0];if(_0x49024d[_0x2229('0x2a')][_0x2229('0xcc')]===_0x2229('0xcd')){return _0x4f96b3[_0x2229('0x33')]({'read':!![]});}else{logger[_0x2229('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2229('0x2a'),_0x2229('0x84'),util[_0x2229('0xc6')](_0x330dba[_0x2229('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2f4b6d==_0x2229('0xd0')||_0x2f4b6d==_0x2229('0xd1')){return _0x4f96b3[_0x2229('0x33')]({'read':!![]});}else{logger['error'](_0x2229('0x23'),_0x2229('0x2a'),'clickatell',util[_0x2229('0xc6')](_0x330dba[_0x2229('0x5a')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x2f4b6d=='message-delivered'){return _0x4f96b3['update']({'read':!![]});}else{logger[_0x2229('0x25')](_0x2229('0x23'),_0x2229('0x2a'),_0x2229('0x8a'),util[_0x2229('0xc6')](_0x330dba[_0x2229('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x2229('0x8b'):if(_0x2f4b6d===_0x2229('0xd2')||_0x2f4b6d===_0x2229('0xd3')){return _0x4f96b3[_0x2229('0x33')]({'read':!![]});}else{logger['error'](_0x2229('0x23'),_0x2229('0x2a'),_0x2229('0x8b'),util['inspect'](_0x330dba['body'],{'showHidden':![],'depth':null}));}break;}return _0x4f96b3;}})[_0x2229('0x34')](respondWithResult(_0x5738b3,null))[_0x2229('0x28')](handleError(_0x5738b3,null));};exports[_0x2229('0xd4')]=function(_0x418910,_0x3f50ff,_0x911392){var _0x58f99c,_0x5bba44,_0x1ea0fe;return db['SmsAccount']['find']({'where':{'id':_0x418910[_0x2229('0x54')]['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x3f50ff,null))[_0x2229('0x34')](function(_0x16057d){if(_0x16057d){_0x1ea0fe=_0x16057d;logger[_0x2229('0x22')](_0x2229('0x23'),_0x2229('0x2a'),_0x2229('0xd5'),_0x16057d[_0x2229('0x3f')],util[_0x2229('0xc6')](_0x418910[_0x2229('0x42')],{'showHidden':![],'depth':null}));switch(_0x16057d['type']){case _0x2229('0x86'):if(_0x418910[_0x2229('0x42')][_0x2229('0xd6')]&&_0x418910[_0x2229('0x42')][_0x2229('0xd7')]){_0x5bba44=_0x418910[_0x2229('0x42')][_0x2229('0xd7')];return db[_0x2229('0xa1')][_0x2229('0x58')]({'where':{'messageId':_0x418910['query']['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x3f50ff,null))[_0x2229('0x34')](function(_0x28c894){if(_0x28c894){_0x58f99c=_0x28c894;switch(_0x1ea0fe[_0x2229('0x3f')]){case _0x2229('0x86'):if(_0x5bba44==='2'||_0x5bba44==='6'){return _0x58f99c[_0x2229('0x33')]({'read':!![]});}else{logger[_0x2229('0x25')](_0x2229('0x23'),'status',_0x2229('0x86'),util[_0x2229('0xc6')](_0x418910[_0x2229('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x58f99c;}})[_0x2229('0x34')](respondWithResult(_0x3f50ff,null))[_0x2229('0x28')](handleError(_0x3f50ff,null));};exports[_0x2229('0xd8')]=function(_0x360909,_0x1547f1,_0x64f85a){return db['SmsAccount'][_0x2229('0x58')]({'where':{'id':_0x360909[_0x2229('0x54')]['id']}})['then'](handleEntityNotFound(_0x1547f1,null))[_0x2229('0x34')](function(_0x3c5a84){if(_0x3c5a84){return _0x3c5a84[_0x2229('0xd8')](_0x360909['body'][_0x2229('0x68')],_[_0x2229('0x97')](_0x360909[_0x2229('0x5a')],[_0x2229('0x68'),'id'])||{})[_0x2229('0x9b')](function(_0x2174c6){for(var _0x513903=0x0;_0x513903<_0x360909[_0x2229('0x5a')][_0x2229('0x68')][_0x2229('0x48')];_0x513903+=0x1){socket[_0x2229('0xd9')]('userSmsAccount:save',{'UserId':Number(_0x360909[_0x2229('0x5a')][_0x2229('0x68')][_0x513903]),'SmsAccountId':Number(_0x360909[_0x2229('0x54')]['id'])});}return _0x2174c6;});}})[_0x2229('0x34')](respondWithResult(_0x1547f1,null))[_0x2229('0x28')](handleError(_0x1547f1,null));};exports['removeAgents']=function(_0x1739fb,_0x2ba2b6,_0x5cb634){return db[_0x2229('0x3c')][_0x2229('0x58')]({'where':{'id':_0x1739fb['params']['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x2ba2b6,null))[_0x2229('0x34')](function(_0x50e6dc){if(_0x50e6dc){return _0x50e6dc[_0x2229('0xda')](_0x1739fb['query'][_0x2229('0x68')])[_0x2229('0x34')](function(){if(_[_0x2229('0xdb')](_0x1739fb[_0x2229('0x42')][_0x2229('0x68')])){for(var _0x4a259d=0x0;_0x4a259d<_0x1739fb[_0x2229('0x42')][_0x2229('0x68')]['length'];_0x4a259d+=0x1){socket[_0x2229('0xd9')](_0x2229('0xdc'),{'UserId':Number(_0x1739fb[_0x2229('0x42')][_0x2229('0x68')][_0x4a259d]),'SmsAccountId':Number(_0x1739fb['params']['id'])});}}else{socket[_0x2229('0xd9')]('userSmsAccount:remove',{'UserId':Number(_0x1739fb[_0x2229('0x42')][_0x2229('0x68')]),'SmsAccountId':Number(_0x1739fb[_0x2229('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x2ba2b6,null))[_0x2229('0x28')](handleError(_0x2ba2b6,null));};exports['getAgents']=function(_0x2adac3,_0x3b1052,_0x23710c){var _0x168449={};var _0x5005e8={};var _0x560a71;var _0x49887d;return db[_0x2229('0x3c')][_0x2229('0xb8')]({'where':{'id':_0x2adac3[_0x2229('0x54')]['id']}})[_0x2229('0x34')](handleEntityNotFound(_0x3b1052,null))[_0x2229('0x34')](function(_0x25871a){if(_0x25871a){_0x560a71=_0x25871a;_0x5005e8[_0x2229('0x41')]=_['keys'](db['User']['rawAttributes']);_0x5005e8[_0x2229('0x42')]=_[_0x2229('0x43')](_0x2adac3[_0x2229('0x42')]);_0x5005e8[_0x2229('0x44')]=_['intersection'](_0x5005e8[_0x2229('0x41')],_0x5005e8[_0x2229('0x42')]);_0x168449[_0x2229('0x47')]=_['intersection'](_0x5005e8['model'],qs['fields'](_0x2adac3[_0x2229('0x42')][_0x2229('0x46')]));_0x168449['attributes']=_0x168449[_0x2229('0x47')][_0x2229('0x48')]?_0x168449[_0x2229('0x47')]:_0x5005e8[_0x2229('0x41')];_0x168449[_0x2229('0x69')]=qs['sort'](_0x2adac3[_0x2229('0x42')][_0x2229('0x65')]);_0x168449[_0x2229('0x4a')]=qs[_0x2229('0x44')](_[_0x2229('0x4b')](_0x2adac3[_0x2229('0x42')],_0x5005e8[_0x2229('0x44')]));if(_0x2adac3[_0x2229('0x42')][_0x2229('0x4c')]){_0x168449[_0x2229('0x4a')]=_[_0x2229('0x4f')](_0x168449[_0x2229('0x4a')],{'$or':_['map'](_0x168449[_0x2229('0x47')],function(_0xd8e517){var _0x5a3fa0={};_0x5a3fa0[_0xd8e517]={'$like':'%'+_0x2adac3['query']['filter']+'%'};return _0x5a3fa0;})});}_0x168449=_['merge']({},_0x168449,_0x2adac3[_0x2229('0x57')]);return _0x560a71[_0x2229('0xdd')](_0x168449);}})['then'](function(_0x2e9da2){if(_0x2e9da2){_0x49887d=_0x2e9da2[_0x2229('0x48')];if(!_0x2adac3[_0x2229('0x42')][_0x2229('0x49')](_0x2229('0x64'))){_0x168449[_0x2229('0x2f')]=qs[_0x2229('0x2f')](_0x2adac3[_0x2229('0x42')][_0x2229('0x2f')]);_0x168449[_0x2229('0x2d')]=qs['offset'](_0x2adac3[_0x2229('0x42')][_0x2229('0x2d')]);}return _0x560a71['getAgents'](_0x168449);}})[_0x2229('0x34')](function(_0x2fbd23){if(_0x2fbd23){return _0x2fbd23?{'count':_0x49887d,'rows':_0x2fbd23}:null;}})[_0x2229('0x34')](respondWithResult(_0x3b1052,null))[_0x2229('0x28')](handleError(_0x3b1052,null));}; \ No newline at end of file +var _0x9ae4=['UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','getApplications','Contact','User','Owner','Tag','Tags','color','tag','List','out','SmsMessage','Messages','dataValues','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','received\x20delivery\x20report\x20from','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','get','SmsAccounts','end','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','Disposition','getDispositions','findOne','nolimit','SmsAccountId','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','sms','SmsApplication','Applications','applications','priority','account','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','mobile','twilio','from','Body','MessageSid','skebby','clicksend','messageId','message_id','plivo','From','Text','MessageUUID','infobip','text','results','csc','segmentedMessage','clickatell','intelepeer','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','ListId','updatedAt','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','*,*,*,*','AttachmentId'];(function(_0x5e5dac,_0xd06afc){var _0xc846b3=function(_0x31d171){while(--_0x31d171){_0x5e5dac['push'](_0x5e5dac['shift']());}};_0xc846b3(++_0xd06afc);}(_0x9ae4,0x119));var _0x49ae=function(_0x28a3b8,_0x42072d){_0x28a3b8=_0x28a3b8-0x0;var _0x3fa09a=_0x9ae4[_0x28a3b8];return _0x3fa09a;};'use strict';var emlformat=require(_0x49ae('0x0'));var rimraf=require(_0x49ae('0x1'));var zipdir=require(_0x49ae('0x2'));var jsonpatch=require(_0x49ae('0x3'));var rp=require('request-promise');var moment=require(_0x49ae('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x49ae('0x5'));var sox=require('sox');var csv=require(_0x49ae('0x6'));var ejs=require(_0x49ae('0x7'));var fs=require('fs');var fs_extra=require(_0x49ae('0x8'));var _=require(_0x49ae('0x9'));var squel=require(_0x49ae('0xa'));var crypto=require(_0x49ae('0xb'));var jsforce=require(_0x49ae('0xc'));var deskjs=require(_0x49ae('0xd'));var toCsv=require(_0x49ae('0x6'));var querystring=require(_0x49ae('0xe'));var Papa=require(_0x49ae('0xf'));var Redis=require(_0x49ae('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x49ae('0x11'));var as=require(_0x49ae('0x12'));var hardwareService=require(_0x49ae('0x13'));var logger=require('../../config/logger')(_0x49ae('0x14'));var utils=require(_0x49ae('0x15'));var config=require(_0x49ae('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x49ae('0x17'))['db'];config[_0x49ae('0x18')]=_[_0x49ae('0x19')](config[_0x49ae('0x18')],{'host':_0x49ae('0x1a'),'port':0x18eb});var socket=require(_0x49ae('0x1b'))(new Redis(config['redis']));require(_0x49ae('0x1c'))[_0x49ae('0x1d')](socket);var jayson=require(_0x49ae('0x1e'));var client=jayson[_0x49ae('0x1f')][_0x49ae('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1e09d3,_0x576374,_0x114904,_0x471dd0){return new BPromise(function(_0x599e5c,_0x5e5966){var _0x5f11d4=_0x471dd0||client;return _0x5f11d4[_0x49ae('0x21')](_0x1e09d3,_0x114904)['then'](function(_0x1a5a81){logger[_0x49ae('0x22')]('SmsAccount,\x20%s,\x20%s',_0x576374,_0x49ae('0x23'));logger['debug'](_0x49ae('0x24'),_0x576374,_0x49ae('0x23'),JSON[_0x49ae('0x25')](_0x1a5a81));if(_0x1a5a81[_0x49ae('0x26')]){if(_0x1a5a81['error'][_0x49ae('0x27')]===0x1f4){logger['error'](_0x49ae('0x28'),_0x576374,_0x1a5a81[_0x49ae('0x26')][_0x49ae('0x29')]);return _0x5e5966(_0x1a5a81[_0x49ae('0x26')][_0x49ae('0x29')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x576374,_0x1a5a81[_0x49ae('0x26')]['message']);return _0x599e5c(_0x1a5a81[_0x49ae('0x26')][_0x49ae('0x29')]);}else{logger[_0x49ae('0x22')]('SmsAccount,\x20%s,\x20%s',_0x576374,_0x49ae('0x23'));_0x599e5c(_0x1a5a81[_0x49ae('0x2a')][_0x49ae('0x29')]);}})[_0x49ae('0x2b')](function(_0x2913ce){logger[_0x49ae('0x26')]('SmsAccount,\x20%s,\x20%s',_0x576374,_0x2913ce);_0x5e5966(_0x2913ce);});});}function respondWithStatusCode(_0x2969c8,_0x56182d){_0x56182d=_0x56182d||0xcc;return function(_0x5148e6){if(_0x5148e6){return _0x2969c8[_0x49ae('0x2c')](_0x56182d);}return _0x2969c8['status'](_0x56182d)['end']();};}function respondWithResult(_0x20e28d,_0x12e958){_0x12e958=_0x12e958||0xc8;return function(_0x5d1cb2){if(_0x5d1cb2){return _0x20e28d[_0x49ae('0x2d')](_0x12e958)[_0x49ae('0x2e')](_0x5d1cb2);}};}function respondWithFilteredResult(_0x53a19c,_0x3ad341){return function(_0x5a4477){if(_0x5a4477){var _0x504b65=typeof _0x3ad341[_0x49ae('0x2f')]===_0x49ae('0x30')&&typeof _0x3ad341['limit']===_0x49ae('0x30');var _0xf41e79=_0x5a4477['count'];var _0x3e6a26=_0x504b65?0x0:_0x3ad341['offset'];var _0x372bb5=_0x504b65?_0x5a4477[_0x49ae('0x31')]:_0x3ad341[_0x49ae('0x2f')]+_0x3ad341[_0x49ae('0x32')];var _0x24dcd5;if(_0x372bb5>=_0xf41e79){_0x372bb5=_0xf41e79;_0x24dcd5=0xc8;}else{_0x24dcd5=0xce;}_0x53a19c[_0x49ae('0x2d')](_0x24dcd5);return _0x53a19c[_0x49ae('0x33')]('Content-Range',_0x3e6a26+'-'+_0x372bb5+'/'+_0xf41e79)[_0x49ae('0x2e')](_0x5a4477);}return null;};}function patchUpdates(_0x1ba0fb){return function(_0x279ec8){try{jsonpatch['apply'](_0x279ec8,_0x1ba0fb,!![]);}catch(_0x57729e){return BPromise[_0x49ae('0x34')](_0x57729e);}return _0x279ec8[_0x49ae('0x35')]();};}function saveUpdates(_0x3919c0,_0x53f2f9){return function(_0x241083){if(_0x241083){return _0x241083[_0x49ae('0x36')](_0x3919c0)[_0x49ae('0x37')](function(_0x5ca60d){return _0x5ca60d;});}return null;};}function removeEntity(_0x10fde5,_0x2f4501){return function(_0x88efca){if(_0x88efca){return _0x88efca[_0x49ae('0x38')]()['then'](function(){var _0x148e24=_0x88efca[_0x49ae('0x39')]({'plain':!![]});var _0x32b369=_0x49ae('0x3a');return db['UserProfileResource'][_0x49ae('0x38')]({'where':{'type':_0x32b369,'resourceId':_0x148e24['id']}})[_0x49ae('0x37')](function(){return _0x88efca;});})[_0x49ae('0x37')](function(){_0x10fde5[_0x49ae('0x2d')](0xcc)[_0x49ae('0x3b')]();});}};}function handleEntityNotFound(_0x3c859f,_0x599ee4){return function(_0x2f0797){if(!_0x2f0797){_0x3c859f[_0x49ae('0x2c')](0x194);}return _0x2f0797;};}function handleError(_0x2bf808,_0x1d215d){_0x1d215d=_0x1d215d||0x1f4;return function(_0x3b3ab1){logger[_0x49ae('0x26')](_0x3b3ab1['stack']);if(_0x3b3ab1[_0x49ae('0x3c')]){delete _0x3b3ab1[_0x49ae('0x3c')];}_0x2bf808[_0x49ae('0x2d')](_0x1d215d)[_0x49ae('0x3d')](_0x3b3ab1);};}exports[_0x49ae('0x3e')]=function(_0x2a3e74,_0x464262){var _0x3e638f={'include':[{'model':db[_0x49ae('0x3f')],'as':_0x49ae('0x40')}]},_0x2dce96={},_0x278326={'count':0x0,'rows':[]};var _0x57c76f=_[_0x49ae('0x41')](db[_0x49ae('0x42')][_0x49ae('0x43')],function(_0x458243){return{'name':_0x458243[_0x49ae('0x44')],'type':_0x458243[_0x49ae('0x45')][_0x49ae('0x46')]};});_0x2dce96[_0x49ae('0x47')]=_[_0x49ae('0x41')](_0x57c76f,_0x49ae('0x3c'));_0x2dce96[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x2a3e74['query']);_0x2dce96[_0x49ae('0x4a')]=_[_0x49ae('0x4b')](_0x2dce96['model'],_0x2dce96['query']);_0x3e638f[_0x49ae('0x4c')]=_['intersection'](_0x2dce96[_0x49ae('0x47')],qs[_0x49ae('0x4d')](_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x4d')]));_0x3e638f[_0x49ae('0x4c')]=_0x3e638f[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x3e638f[_0x49ae('0x4c')]:_0x2dce96[_0x49ae('0x47')];if(!_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x4f')]('nolimit')){_0x3e638f[_0x49ae('0x32')]=qs[_0x49ae('0x32')](_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x32')]);_0x3e638f[_0x49ae('0x2f')]=qs[_0x49ae('0x2f')](_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x2f')]);}_0x3e638f[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0x2a3e74['query']['sort']);_0x3e638f['where']=qs[_0x49ae('0x4a')](_[_0x49ae('0x52')](_0x2a3e74['query'],_0x2dce96[_0x49ae('0x4a')]),_0x57c76f);if(_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x53')]){_0x3e638f[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x3e638f['where'],{'$or':_[_0x49ae('0x41')](_0x57c76f,function(_0x446443){if(_0x446443[_0x49ae('0x45')]!==_0x49ae('0x56')){var _0x48f0cb={};_0x48f0cb[_0x446443['name']]={'$like':'%'+_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x48f0cb;}})});}_0x3e638f=_[_0x49ae('0x55')]({},_0x3e638f,_0x2a3e74[_0x49ae('0x57')]);var _0x5751ea={'where':_0x3e638f['where']};return db[_0x49ae('0x42')]['count'](_0x5751ea)[_0x49ae('0x37')](function(_0x34a8b3){_0x278326[_0x49ae('0x31')]=_0x34a8b3;if(_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x58')]){_0x3e638f['include']=[{'all':!![]}];}return db['SmsAccount'][_0x49ae('0x59')](_0x3e638f);})[_0x49ae('0x37')](function(_0x10e700){_0x278326[_0x49ae('0x5a')]=_0x10e700;return _0x278326;})[_0x49ae('0x37')](respondWithFilteredResult(_0x464262,_0x3e638f))['catch'](handleError(_0x464262,null));};exports[_0x49ae('0x5b')]=function(_0x118f9d,_0x51e776){var _0x3acf24={'raw':![],'where':{'id':_0x118f9d[_0x49ae('0x5c')]['id']},'include':[{'model':db[_0x49ae('0x3f')],'as':_0x49ae('0x40')}]},_0x2360b3={};_0x2360b3[_0x49ae('0x47')]=_[_0x49ae('0x49')](db[_0x49ae('0x42')][_0x49ae('0x43')]);_0x2360b3[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x118f9d[_0x49ae('0x48')]);_0x2360b3[_0x49ae('0x4a')]=_['intersection'](_0x2360b3[_0x49ae('0x47')],_0x2360b3['query']);_0x3acf24[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x2360b3[_0x49ae('0x47')],qs[_0x49ae('0x4d')](_0x118f9d['query']['fields']));_0x3acf24[_0x49ae('0x4c')]=_0x3acf24['attributes'][_0x49ae('0x4e')]?_0x3acf24[_0x49ae('0x4c')]:_0x2360b3[_0x49ae('0x47')];if(_0x118f9d[_0x49ae('0x48')][_0x49ae('0x58')]){_0x3acf24[_0x49ae('0x5d')]=[{'all':!![]}];}_0x3acf24=_[_0x49ae('0x55')]({},_0x3acf24,_0x118f9d[_0x49ae('0x57')]);return db[_0x49ae('0x42')][_0x49ae('0x5e')](_0x3acf24)[_0x49ae('0x37')](handleEntityNotFound(_0x51e776,null))[_0x49ae('0x37')](respondWithResult(_0x51e776,null))[_0x49ae('0x2b')](handleError(_0x51e776,null));};exports[_0x49ae('0x5f')]=function(_0x56ec9f,_0xd50aa){return db[_0x49ae('0x42')]['create'](_0x56ec9f['body'],{})[_0x49ae('0x37')](function(_0x1e7209){var _0x2d8e84=_0x56ec9f[_0x49ae('0x60')][_0x49ae('0x39')]({'plain':!![]});if(!_0x2d8e84)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d8e84[_0x49ae('0x61')]===_0x49ae('0x60')){var _0x1288c8=_0x1e7209[_0x49ae('0x39')]({'plain':!![]});var _0x1718d8=_0x49ae('0x3a');return db[_0x49ae('0x62')]['find']({'where':{'name':_0x1718d8,'userProfileId':_0x2d8e84[_0x49ae('0x63')]},'raw':!![]})[_0x49ae('0x37')](function(_0x4da759){if(_0x4da759&&_0x4da759[_0x49ae('0x64')]===0x0){return db[_0x49ae('0x65')][_0x49ae('0x5f')]({'name':_0x1288c8[_0x49ae('0x3c')],'resourceId':_0x1288c8['id'],'type':_0x4da759[_0x49ae('0x3c')],'sectionId':_0x4da759['id']},{})[_0x49ae('0x37')](function(){return _0x1e7209;});}else{return _0x1e7209;}})[_0x49ae('0x2b')](function(_0x46a209){logger[_0x49ae('0x26')](_0x49ae('0x66'),_0x46a209);throw _0x46a209;});}return _0x1e7209;})[_0x49ae('0x37')](respondWithResult(_0xd50aa,0xc9))[_0x49ae('0x2b')](handleError(_0xd50aa,null));};exports[_0x49ae('0x36')]=function(_0x2a74eb,_0x3d1854){if(_0x2a74eb[_0x49ae('0x67')]['id']){delete _0x2a74eb['body']['id'];}return db['SmsAccount'][_0x49ae('0x5e')]({'where':{'id':_0x2a74eb[_0x49ae('0x5c')]['id']},'include':[{'model':db[_0x49ae('0x3f')],'as':_0x49ae('0x40')}]})[_0x49ae('0x37')](handleEntityNotFound(_0x3d1854,null))[_0x49ae('0x37')](saveUpdates(_0x2a74eb[_0x49ae('0x67')],null))[_0x49ae('0x37')](respondWithResult(_0x3d1854,null))[_0x49ae('0x2b')](handleError(_0x3d1854,null));};exports[_0x49ae('0x38')]=function(_0x511846,_0x537db1){return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x511846[_0x49ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x537db1,null))[_0x49ae('0x37')](removeEntity(_0x537db1,null))[_0x49ae('0x2b')](handleError(_0x537db1,null));};exports['describe']=function(_0x1710b0,_0x468149){return db[_0x49ae('0x42')]['describe']()['then'](respondWithResult(_0x468149,null))[_0x49ae('0x2b')](handleError(_0x468149,null));};exports[_0x49ae('0x68')]=function(_0x5d3f28,_0x3f2046,_0xbd7bb6){if(_0x5d3f28['body']['id']){delete _0x5d3f28[_0x49ae('0x67')]['id'];}return db[_0x49ae('0x42')]['find']({'where':{'id':_0x5d3f28[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x3f2046,null))[_0x49ae('0x37')](function(_0x263f06){if(_0x263f06){_0x5d3f28[_0x49ae('0x67')]['SmsAccountId']=_0x263f06['id'];return db[_0x49ae('0x69')][_0x49ae('0x5f')](_0x5d3f28['body']);}})[_0x49ae('0x37')](respondWithResult(_0x3f2046,null))[_0x49ae('0x2b')](handleError(_0x3f2046,null));};exports[_0x49ae('0x6a')]=function(_0x38d83a,_0x2e98f1,_0x1ba96b){var _0x3aaf52={'raw':![],'where':{}};var _0x34122d={};var _0x58d53c={'count':0x0,'rows':[]};return db[_0x49ae('0x42')][_0x49ae('0x6b')]({'where':{'id':_0x38d83a[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x2e98f1,null))[_0x49ae('0x37')](function(_0x5e9e30){if(_0x5e9e30){_0x34122d[_0x49ae('0x47')]=_[_0x49ae('0x49')](db[_0x49ae('0x69')]['rawAttributes']);_0x34122d[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x38d83a[_0x49ae('0x48')]);_0x34122d[_0x49ae('0x4a')]=_['intersection'](_0x34122d[_0x49ae('0x47')],_0x34122d[_0x49ae('0x48')]);_0x3aaf52[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x34122d[_0x49ae('0x47')],qs[_0x49ae('0x4d')](_0x38d83a[_0x49ae('0x48')][_0x49ae('0x4d')]));_0x3aaf52[_0x49ae('0x4c')]=_0x3aaf52[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x3aaf52['attributes']:_0x34122d[_0x49ae('0x47')];if(!_0x38d83a[_0x49ae('0x48')][_0x49ae('0x4f')](_0x49ae('0x6c'))){_0x3aaf52[_0x49ae('0x32')]=qs['limit'](_0x38d83a['query']['limit']);_0x3aaf52[_0x49ae('0x2f')]=qs[_0x49ae('0x2f')](_0x38d83a[_0x49ae('0x48')][_0x49ae('0x2f')]);}_0x3aaf52[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0x38d83a[_0x49ae('0x48')]['sort']);_0x3aaf52[_0x49ae('0x54')]=qs['filters'](_[_0x49ae('0x52')](_0x38d83a[_0x49ae('0x48')],_0x34122d[_0x49ae('0x4a')]));_0x3aaf52[_0x49ae('0x54')][_0x49ae('0x6d')]=_0x5e9e30['id'];if(_0x38d83a[_0x49ae('0x48')][_0x49ae('0x53')]){_0x3aaf52[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x3aaf52['where'],{'$or':_[_0x49ae('0x41')](_0x3aaf52['attributes'],function(_0x47afe4){var _0x53b24d={};_0x53b24d[_0x47afe4]={'$like':'%'+_0x38d83a[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x53b24d;})});}_0x3aaf52=_['merge']({},_0x3aaf52,_0x38d83a[_0x49ae('0x57')]);return db['Disposition'][_0x49ae('0x31')]({'where':_0x3aaf52[_0x49ae('0x54')]})[_0x49ae('0x37')](function(_0x21a683){_0x58d53c[_0x49ae('0x31')]=_0x21a683;if(_0x38d83a[_0x49ae('0x48')][_0x49ae('0x58')]){_0x3aaf52[_0x49ae('0x5d')]=[{'all':!![]}];}return db[_0x49ae('0x69')][_0x49ae('0x59')](_0x3aaf52);})[_0x49ae('0x37')](function(_0x43d199){_0x58d53c[_0x49ae('0x5a')]=_0x43d199;return _0x58d53c;});}})['then'](respondWithFilteredResult(_0x2e98f1,_0x3aaf52))[_0x49ae('0x2b')](handleError(_0x2e98f1,null));};exports[_0x49ae('0x6e')]=function(_0xde2340,_0x4150ed,_0x2de762){return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0xde2340[_0x49ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4150ed,null))[_0x49ae('0x37')](function(_0x441eff){if(_0x441eff){return _0x441eff[_0x49ae('0x6e')](_0xde2340[_0x49ae('0x48')]['ids']);}})[_0x49ae('0x37')](respondWithStatusCode(_0x4150ed,null))[_0x49ae('0x2b')](handleError(_0x4150ed,null));};exports[_0x49ae('0x6f')]=function(_0x2d02e2,_0x2865db,_0x344e95){if(_0x2d02e2[_0x49ae('0x67')]['id']){delete _0x2d02e2[_0x49ae('0x67')]['id'];}return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x2d02e2['params']['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x2865db,null))[_0x49ae('0x37')](function(_0x449c92){if(_0x449c92){_0x2d02e2[_0x49ae('0x67')]['SmsAccountId']=_0x449c92['id'];return db['CannedAnswer'][_0x49ae('0x5f')](_0x2d02e2[_0x49ae('0x67')]);}})[_0x49ae('0x37')](respondWithResult(_0x2865db,null))['catch'](handleError(_0x2865db,null));};exports['getAnswers']=function(_0x311e8a,_0x144d70,_0x1389dd){var _0x4a535e={'raw':![],'where':{}};var _0x537021={};var _0x326ae4={'count':0x0,'rows':[]};return db[_0x49ae('0x42')][_0x49ae('0x6b')]({'where':{'id':_0x311e8a[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x144d70,null))[_0x49ae('0x37')](function(_0x7a7593){if(_0x7a7593){_0x537021[_0x49ae('0x47')]=_[_0x49ae('0x49')](db[_0x49ae('0x70')][_0x49ae('0x43')]);_0x537021[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x311e8a['query']);_0x537021[_0x49ae('0x4a')]=_['intersection'](_0x537021[_0x49ae('0x47')],_0x537021['query']);_0x4a535e['attributes']=_[_0x49ae('0x4b')](_0x537021[_0x49ae('0x47')],qs[_0x49ae('0x4d')](_0x311e8a['query'][_0x49ae('0x4d')]));_0x4a535e[_0x49ae('0x4c')]=_0x4a535e[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x4a535e[_0x49ae('0x4c')]:_0x537021['model'];if(!_0x311e8a[_0x49ae('0x48')][_0x49ae('0x4f')](_0x49ae('0x6c'))){_0x4a535e['limit']=qs['limit'](_0x311e8a[_0x49ae('0x48')]['limit']);_0x4a535e['offset']=qs[_0x49ae('0x2f')](_0x311e8a[_0x49ae('0x48')][_0x49ae('0x2f')]);}_0x4a535e[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0x311e8a[_0x49ae('0x48')][_0x49ae('0x51')]);_0x4a535e[_0x49ae('0x54')]=qs[_0x49ae('0x4a')](_[_0x49ae('0x52')](_0x311e8a[_0x49ae('0x48')],_0x537021[_0x49ae('0x4a')]));_0x4a535e[_0x49ae('0x54')][_0x49ae('0x6d')]=_0x7a7593['id'];if(_0x311e8a[_0x49ae('0x48')][_0x49ae('0x53')]){_0x4a535e[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x4a535e['where'],{'$or':_[_0x49ae('0x41')](_0x4a535e[_0x49ae('0x4c')],function(_0x27d115){var _0x2700da={};_0x2700da[_0x27d115]={'$like':'%'+_0x311e8a[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x2700da;})});}_0x4a535e=_[_0x49ae('0x55')]({},_0x4a535e,_0x311e8a[_0x49ae('0x57')]);return db[_0x49ae('0x70')][_0x49ae('0x31')]({'where':_0x4a535e[_0x49ae('0x54')]})[_0x49ae('0x37')](function(_0x4af2d1){_0x326ae4[_0x49ae('0x31')]=_0x4af2d1;if(_0x311e8a['query'][_0x49ae('0x58')]){_0x4a535e['include']=[{'all':!![]}];}return db[_0x49ae('0x70')][_0x49ae('0x59')](_0x4a535e);})['then'](function(_0x28bcea){_0x326ae4['rows']=_0x28bcea;return _0x326ae4;});}})[_0x49ae('0x37')](respondWithFilteredResult(_0x144d70,_0x4a535e))[_0x49ae('0x2b')](handleError(_0x144d70,null));};exports[_0x49ae('0x71')]=function(_0x2966f2,_0x28b132,_0x2a8592){return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x2966f2['params']['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x28b132,null))[_0x49ae('0x37')](function(_0x1ad60a){if(_0x1ad60a){return _0x1ad60a[_0x49ae('0x71')](_0x2966f2[_0x49ae('0x48')][_0x49ae('0x72')]);}})[_0x49ae('0x37')](respondWithStatusCode(_0x28b132,null))['catch'](handleError(_0x28b132,null));};exports['notify']=function(_0x23b225,_0x14817f,_0x37690d){var _0x2211b8={'channel':_0x49ae('0x73')};var _0x4ea021=[];var _0x43ff96=[];var _0x3a83e5={};return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x23b225[_0x49ae('0x5c')]['id']},'include':[{'model':db[_0x49ae('0x74')],'as':_0x49ae('0x75')}]})[_0x49ae('0x37')](handleEntityNotFound(_0x14817f,null))[_0x49ae('0x37')](function(_0x21208b){_0x2211b8['account']=_0x21208b;_0x2211b8[_0x49ae('0x76')]=_['orderBy'](_0x21208b[_0x49ae('0x75')],[_0x49ae('0x77')],['asc']);if(_0x2211b8[_0x49ae('0x78')][_0x49ae('0x75')]){delete _0x2211b8['account']['Applications'];}return db[_0x49ae('0x79')][_0x49ae('0x7a')]();})[_0x49ae('0x37')](function(_0xfe8dd9){if(!_0xfe8dd9){throw new db[(_0x49ae('0x7b'))]['ValidationError'](_0x49ae('0x7c'));}_0x4ea021=_[_0x49ae('0x7d')](_['keys'](_0xfe8dd9),[_0x49ae('0x7e'),'updatedAt']);_0x43ff96=_[_0x49ae('0x7d')](_['keys'](_0xfe8dd9),['createdAt','updatedAt',_0x49ae('0x7f'),'ListId']);_0x2211b8['body']={'mapKey':_0x49ae('0x80')};if(_0x2211b8[_0x49ae('0x78')][_0x49ae('0x45')]){switch(_0x2211b8[_0x49ae('0x78')][_0x49ae('0x45')]){case _0x49ae('0x81'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225['body']['From'];_0x2211b8[_0x49ae('0x67')]['body']=_0x23b225[_0x49ae('0x67')][_0x49ae('0x83')];_0x2211b8['body']['messageId']=_0x23b225[_0x49ae('0x67')][_0x49ae('0x84')];break;case _0x49ae('0x85'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]='+'+_0x23b225['body']['sender'];_0x2211b8['body'][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')]['text'];break;case'connectel':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225[_0x49ae('0x67')]['from'];_0x2211b8[_0x49ae('0x67')]['body']=_0x23b225[_0x49ae('0x67')][_0x49ae('0x29')];break;case _0x49ae('0x86'):_0x2211b8['body']['from']=_0x23b225[_0x49ae('0x67')]['from'];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225['body'][_0x49ae('0x67')];_0x2211b8['body'][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x88')];break;case _0x49ae('0x89'):_0x2211b8[_0x49ae('0x67')]['from']=_0x23b225[_0x49ae('0x67')][_0x49ae('0x8a')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x8b')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x8c')];break;case _0x49ae('0x8d'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]='+'+_0x23b225[_0x49ae('0x67')]['results'][0x0][_0x49ae('0x82')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')]['results'][0x0][_0x49ae('0x8e')];_0x2211b8['body'][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x8f')][0x0]['messageId'];break;case _0x49ae('0x90'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225[_0x49ae('0x67')]['originatingAddress'];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x91')]['message'];break;case _0x49ae('0x92'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225['body']['fromNumber'];_0x2211b8['body'][_0x49ae('0x67')]=_0x23b225['body'][_0x49ae('0x8e')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')]['replyMessageId'];break;case'bandwidth':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')][0x0][_0x49ae('0x29')]['id'];_0x2211b8['body'][_0x49ae('0x82')]=_0x23b225['body'][0x0]['message'][_0x49ae('0x82')];_0x2211b8['body'][_0x49ae('0x67')]=_0x23b225['body'][0x0][_0x49ae('0x29')][_0x49ae('0x8e')];break;case _0x49ae('0x93'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x82')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x29')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')]['refid'];break;}}if(_0x2211b8[_0x49ae('0x67')]['id']){delete _0x2211b8[_0x49ae('0x67')]['id'];}if(_[_0x49ae('0x94')](_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')])){throw new db[(_0x49ae('0x7b'))][(_0x49ae('0x95'))](_0x49ae('0x96'));}if(_[_0x49ae('0x94')](_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')])||_0x2211b8['body'][_0x49ae('0x67')]===''){throw new db['Sequelize'][(_0x49ae('0x95'))](_0x49ae('0x97'));}if(_[_0x49ae('0x94')](_0x2211b8[_0x49ae('0x67')]['mapKey'])){throw new db[(_0x49ae('0x7b'))]['ValidationError'](_0x49ae('0x98')+_0x43ff96);}if(!_[_0x49ae('0x99')](_0x43ff96,_0x2211b8[_0x49ae('0x67')][_0x49ae('0x9a')])){throw new db[(_0x49ae('0x7b'))][(_0x49ae('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43ff96);}_0x3a83e5[_0x2211b8['body'][_0x49ae('0x9a')]]=_0x2211b8[_0x49ae('0x67')]['from'];return db[_0x49ae('0x9b')]['find']({'where':{'id':_0x2211b8[_0x49ae('0x78')][_0x49ae('0x9c')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3a83e5,'limit':0x1,'order':[[_0x49ae('0x9d'),_0x49ae('0x9e')]]}]});})[_0x49ae('0x37')](handleEntityNotFound(_0x14817f,null))[_0x49ae('0x37')](function(_0x255dfb){if(_0x255dfb){_0x2211b8[_0x49ae('0x9f')]=_[_0x49ae('0xa0')](_0x255dfb,[_0x49ae('0xa1')]);if(_0x255dfb[_0x49ae('0xa1')]['length']){return _0x255dfb[_0x49ae('0xa1')][0x0];}var _0x2d2949=_['defaults'](_0x2211b8[_0x49ae('0x67')],{'firstName':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')],'ListId':_0x255dfb['id']});_0x2d2949[_0x2211b8[_0x49ae('0x67')][_0x49ae('0x9a')]]=_0x2211b8[_0x49ae('0x67')]['from'];return db[_0x49ae('0x79')][_0x49ae('0x5f')](_0x2d2949,{'fields':_0x4ea021,'raw':!![]});}})[_0x49ae('0x37')](handleEntityNotFound(_0x14817f,null))[_0x49ae('0x37')](function(_0x3a6626){if(_0x3a6626){_0x2211b8[_0x49ae('0xa2')]=_0x3a6626;var _0x417388={'ContactId':_0x3a6626['id'],'phone':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')],'SmsAccountId':_0x23b225[_0x49ae('0x5c')]['id']};var _0x52dad1={'ContactId':_0x3a6626['id'],'SmsAccountId':_0x23b225[_0x49ae('0x5c')]['id'],'closed':![]};return db[_0x49ae('0xa3')][_0x49ae('0x5e')]({'where':_0x52dad1})[_0x49ae('0x37')](function(_0x19b6e0){if(_0x19b6e0){return[_0x19b6e0,![]];}return db[_0x49ae('0xa3')][_0x49ae('0x5f')](_0x417388)['then'](function(_0x38c481){return[_0x38c481,!![]];});});}})[_0x49ae('0xa4')](function(_0x3acf92,_0x3796aa){_0x2211b8[_0x49ae('0xa5')]=_0x3acf92['get']({'plain':!![]});_0x2211b8[_0x49ae('0xa5')][_0x49ae('0xa6')]=![];if(_0x3796aa){if(_0x2211b8[_0x49ae('0x78')][_0x49ae('0xa7')]){_0x2211b8[_0x49ae('0x76')][_0x49ae('0xa8')]({'id':0x0,'priority':_0x2211b8['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x49ae('0xa9')});}_0x2211b8['interaction']['created']=!![];}return db['SmsMessage'][_0x49ae('0x5f')]({'phone':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')],'messageId':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')],'body':_0x2211b8[_0x49ae('0x67')]['body'],'SmsAccountId':_0x23b225[_0x49ae('0x5c')]['id'],'SmsInteractionId':_0x3acf92['id'],'direction':'in','ContactId':_0x3acf92['ContactId'],'AttachmentId':_0x2211b8[_0x49ae('0x67')][_0x49ae('0xaa')]});})[_0x49ae('0x37')](function(_0x47f6be){_0x2211b8[_0x49ae('0x29')]=_0x47f6be;if(_0x2211b8[_0x49ae('0xa5')][_0x49ae('0xab')]){return db['User'][_0x49ae('0x5e')]({'attributes':['id','name'],'where':{'id':_0x2211b8[_0x49ae('0xa5')]['UserId']}})['then'](function(_0x52cdc4){if(_0x52cdc4){_0x2211b8['applications'][_0x49ae('0xac')]({'id':0x0,'priority':0x0,'app':_0x49ae('0xad'),'appdata':_0x52cdc4[_0x49ae('0x3c')]+','+(_0x2211b8[_0x49ae('0x78')][_0x49ae('0xae')]||0xa),'interval':_0x49ae('0xa9')});}return respondWithRpcPromise('Start','startRouting',_0x2211b8);});}return respondWithRpcPromise(_0x49ae('0xaf'),_0x49ae('0xb0'),_0x2211b8);})[_0x49ae('0x37')](function(_0x584f2f){if(_0x584f2f){var _0x287d44=0xc8;var _0x3f2110=_0x49ae('0xb1');logger[_0x49ae('0x22')](_0x49ae('0x24'),_0x3f2110,_0x287d44,_0x49ae('0xb2'));logger[_0x49ae('0xb3')](_0x49ae('0xb4'),_0x3f2110,_0x287d44,_0x49ae('0xb2'),JSON[_0x49ae('0x25')](_0x584f2f));if(_0x2211b8['account'][_0x49ae('0x45')]===_0x49ae('0x81')){return _0x14817f[_0x49ae('0x2d')](_0x287d44)[_0x49ae('0x33')](_0x49ae('0xb5'),_0x49ae('0xb6'))[_0x49ae('0x3d')]('\x0a');}else{return _0x14817f[_0x49ae('0x2d')](_0x287d44)['json'](_0x584f2f);}}})[_0x49ae('0x2b')](handleError(_0x14817f,null));};exports[_0x49ae('0xb7')]=function(_0x5d9d8d,_0x62538a){var _0x31eb9a=_0x5d9d8d['params']['id'];var _0x1c2fa5=_0x5d9d8d['body'];var _0x4adb41=0xc8;var _0x222fd3=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x49ae('0xb8')][_0x49ae('0xb9')]},function(_0x4f3221){return db['SmsAccount'][_0x49ae('0x6b')]({'where':{'id':_0x31eb9a},'transaction':_0x4f3221})[_0x49ae('0x37')](function(_0x2284b4){if(_0x2284b4){return db[_0x49ae('0x74')][_0x49ae('0x38')]({'where':{'SmsAccountId':_0x31eb9a},'transaction':_0x4f3221})[_0x49ae('0x37')](function(){var _0x5d0bbb=_[_0x49ae('0x41')](_0x1c2fa5,function(_0x43db66){_0x43db66[_0x49ae('0x6d')]=_0x31eb9a;return _0x43db66;});return db['SmsApplication']['bulkCreate'](_0x5d0bbb,{'transaction':_0x4f3221});});}else{_0x4adb41=0x194;_0x222fd3=[];}});})[_0x49ae('0x37')](function(){if(_0x4adb41!==0x194){return db[_0x49ae('0x74')][_0x49ae('0xba')]({'where':{'SmsAccountId':_0x31eb9a},'order':_0x49ae('0x77')})[_0x49ae('0x37')](function(_0x235d63){_0x222fd3=_0x235d63;});}})['catch'](function(_0x2b7078){_0x4adb41=0x1f4;logger[_0x49ae('0x26')](_0x2b7078[_0x49ae('0xbb')]);if(_0x2b7078[_0x49ae('0x3c')]){delete _0x2b7078[_0x49ae('0x3c')];}_0x222fd3=_0x2b7078;})['finally'](function(){if(_0x222fd3===null){_0x62538a[_0x49ae('0x2c')](_0x4adb41);}else{if(_0x4adb41===0x1f4){_0x62538a[_0x49ae('0x2d')](_0x4adb41)[_0x49ae('0x3d')](_0x222fd3);}else{_0x62538a[_0x49ae('0x2d')](_0x4adb41)['json'](_0x222fd3);}}});};exports[_0x49ae('0xbc')]=function(_0x47491a,_0x137ea5,_0x325aab){var _0x587916={};var _0x5e654d={};var _0x432ed9;var _0x3d70c0;return db[_0x49ae('0x42')]['findOne']({'where':{'id':_0x47491a[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x137ea5,null))['then'](function(_0x9d068a){if(_0x9d068a){_0x432ed9=_0x9d068a;_0x5e654d['model']=_[_0x49ae('0x49')](db['SmsApplication'][_0x49ae('0x43')]);_0x5e654d[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x47491a['query']);_0x5e654d[_0x49ae('0x4a')]=_[_0x49ae('0x4b')](_0x5e654d[_0x49ae('0x47')],_0x5e654d['query']);_0x587916[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x5e654d[_0x49ae('0x47')],qs['fields'](_0x47491a['query'][_0x49ae('0x4d')]));_0x587916['attributes']=_0x587916[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x587916['attributes']:_0x5e654d['model'];_0x587916['order']=qs[_0x49ae('0x51')](_0x47491a[_0x49ae('0x48')][_0x49ae('0x51')]);_0x587916[_0x49ae('0x54')]=qs['filters'](_['pick'](_0x47491a['query'],_0x5e654d['filters']));if(_0x47491a[_0x49ae('0x48')][_0x49ae('0x53')]){_0x587916[_0x49ae('0x54')]=_['merge'](_0x587916[_0x49ae('0x54')],{'$or':_[_0x49ae('0x41')](_0x587916['attributes'],function(_0x18218c){var _0x3217d6={};_0x3217d6[_0x18218c]={'$like':'%'+_0x47491a[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x3217d6;})});}_0x587916=_[_0x49ae('0x55')]({},_0x587916,_0x47491a[_0x49ae('0x57')]);return _0x432ed9['getApplications'](_0x587916);}})[_0x49ae('0x37')](function(_0x58c438){if(_0x58c438){_0x3d70c0=_0x58c438['length'];if(!_0x47491a[_0x49ae('0x48')]['hasOwnProperty'](_0x49ae('0x6c'))){_0x587916[_0x49ae('0x32')]=qs[_0x49ae('0x32')](_0x47491a['query'][_0x49ae('0x32')]);_0x587916[_0x49ae('0x2f')]=qs['offset'](_0x47491a[_0x49ae('0x48')]['offset']);}return _0x432ed9[_0x49ae('0xbc')](_0x587916);}})[_0x49ae('0x37')](function(_0x403c5f){if(_0x403c5f){return _0x403c5f?{'count':_0x3d70c0,'rows':_0x403c5f}:null;}})[_0x49ae('0x37')](respondWithResult(_0x137ea5,null))['catch'](handleError(_0x137ea5,null));};exports['getInteractions']=function(_0xa991e6,_0x25ca3c,_0x5ceb2c){var _0x22ccb9={'raw':![],'where':{}};var _0x5e5873={};var _0x362553={'count':0x0,'rows':[]};return db[_0x49ae('0x42')][_0x49ae('0x6b')]({'where':{'id':_0xa991e6[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x25ca3c,null))[_0x49ae('0x37')](function(_0x59b3b7){if(_0x59b3b7){_0x5e5873[_0x49ae('0x47')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x5e5873[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0xa991e6[_0x49ae('0x48')]);_0x5e5873['filters']=_[_0x49ae('0x4b')](_0x5e5873[_0x49ae('0x47')],_0x5e5873['query']);_0x22ccb9[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x5e5873['model'],qs[_0x49ae('0x4d')](_0xa991e6[_0x49ae('0x48')][_0x49ae('0x4d')]));_0x22ccb9[_0x49ae('0x4c')]=_0x22ccb9[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x22ccb9[_0x49ae('0x4c')]:_0x5e5873[_0x49ae('0x47')];if(!_0xa991e6[_0x49ae('0x48')][_0x49ae('0x4f')](_0x49ae('0x6c'))){_0x22ccb9[_0x49ae('0x32')]=qs[_0x49ae('0x32')](_0xa991e6[_0x49ae('0x48')][_0x49ae('0x32')]);_0x22ccb9['offset']=qs[_0x49ae('0x2f')](_0xa991e6[_0x49ae('0x48')][_0x49ae('0x2f')]);}_0x22ccb9[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0xa991e6[_0x49ae('0x48')][_0x49ae('0x51')]);_0x22ccb9[_0x49ae('0x54')]=qs[_0x49ae('0x4a')](_[_0x49ae('0x52')](_0xa991e6[_0x49ae('0x48')],_0x5e5873['filters']));_0x22ccb9[_0x49ae('0x54')][_0x49ae('0x6d')]=_0x59b3b7['id'];if(_0xa991e6[_0x49ae('0x48')][_0x49ae('0x53')]){_0x22ccb9[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x22ccb9[_0x49ae('0x54')],{'$or':_['map'](_0x22ccb9['attributes'],function(_0x3cf78c){var _0x487d37={};_0x487d37[_0x3cf78c]={'$like':'%'+_0xa991e6[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x487d37;})});}_0x22ccb9=_[_0x49ae('0x55')]({},_0x22ccb9,_0xa991e6[_0x49ae('0x57')]);return db[_0x49ae('0xa3')]['count']({'where':_0x22ccb9['where']})[_0x49ae('0x37')](function(_0x5ad6bd){_0x362553['count']=_0x5ad6bd;if(_0xa991e6['query'][_0x49ae('0x58')]){_0x22ccb9[_0x49ae('0x5d')]=[{'model':db['CmContact'],'as':_0x49ae('0xbd'),'required':![]},{'model':db[_0x49ae('0xbe')],'as':_0x49ae('0xbf'),'attributes':[_0x49ae('0x3c'),'fullname','internal'],'required':![]},{'model':db[_0x49ae('0xc0')],'as':_0x49ae('0xc1'),'attributes':['id','name',_0x49ae('0xc2')],'where':_0xa991e6['query'][_0x49ae('0xc3')]?{'id':_0xa991e6[_0x49ae('0x48')][_0x49ae('0xc3')]}:undefined,'required':_0xa991e6[_0x49ae('0x48')][_0x49ae('0xc3')]?!![]:![]}];}return db[_0x49ae('0xa3')][_0x49ae('0x59')](_0x22ccb9);})[_0x49ae('0x37')](function(_0xd13c1e){_0x362553[_0x49ae('0x5a')]=_0xd13c1e;return _0x362553;});}})[_0x49ae('0x37')](respondWithFilteredResult(_0x25ca3c,_0x22ccb9))[_0x49ae('0x2b')](handleError(_0x25ca3c,null));};exports[_0x49ae('0x3d')]=function(_0x54d37f,_0x1c6576,_0x2d1816){var _0x4b480a,_0x1cf184,_0x3df455;if(_[_0x49ae('0x94')](_0x54d37f[_0x49ae('0x67')][_0x49ae('0x67')])||_0x54d37f['body'][_0x49ae('0x67')]===''){throw new db[(_0x49ae('0x7b'))][(_0x49ae('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x49ae('0x94')](_0x54d37f[_0x49ae('0x67')]['to'])){throw new db[(_0x49ae('0x7b'))][(_0x49ae('0x95'))]('to\x20is\x20mandatory');}_0x4b480a=_0x54d37f['body']['to'];return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x54d37f[_0x49ae('0x5c')]['id']},'include':[{'model':db[_0x49ae('0x9b')],'as':'List','include':[{'model':db[_0x49ae('0x79')],'as':_0x49ae('0xa1'),'where':{'mobile':_0x4b480a},'limit':0x1,'order':[[_0x49ae('0x9d'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1c6576,null))[_0x49ae('0x37')](function(_0x477fc5){if(_0x477fc5&&_0x477fc5[_0x49ae('0xc4')]){_0x1cf184=_0x477fc5[_0x49ae('0x39')]({'plain':!![]});if(_0x1cf184['List']&&_0x1cf184[_0x49ae('0xc4')]['Contacts'][_0x49ae('0x4e')]){return _0x1cf184[_0x49ae('0xc4')][_0x49ae('0xa1')][0x0];}return db[_0x49ae('0x79')][_0x49ae('0x5f')](_[_0x49ae('0x19')](_0x54d37f['body'],{'firstName':_0x4b480a,'mobile':_0x4b480a,'phone':_0x4b480a,'ListId':_0x1cf184[_0x49ae('0x9c')]}));}})[_0x49ae('0x37')](handleEntityNotFound(_0x1c6576,null))[_0x49ae('0x37')](function(_0x2026fd){if(_0x2026fd){_0x3df455=_0x2026fd;return db[_0x49ae('0xa3')][_0x49ae('0x5e')]({'where':{'ContactId':_0x3df455['id'],'closed':![],'SmsAccountId':_0x1cf184['id']}})[_0x49ae('0x37')](function(_0x24baf1){if(_0x24baf1){return[_0x24baf1,![]];}return db['SmsInteraction'][_0x49ae('0x5f')]({'UserId':_0x54d37f['user']['id'],'ContactId':_0x3df455['id'],'SmsAccountId':_0x1cf184['id'],'phone':_0x4b480a,'firstMsgDirection':_0x49ae('0xc5'),'Messages':[_['merge'](_0x54d37f['body'],{'read':![],'body':_0x54d37f[_0x49ae('0x67')][_0x49ae('0x67')],'phone':_0x4b480a,'SmsAccountId':_0x1cf184['id'],'UserId':_0x54d37f['user']['id'],'ContactId':_0x3df455['id']})]},{'include':[{'model':db[_0x49ae('0xc6')],'as':_0x49ae('0xc7')}]})['then'](function(_0x3ad8e0){return[_0x3ad8e0,!![]];});});}})[_0x49ae('0xa4')](function(_0x4de417,_0x7204c9){if(_0x7204c9){return _0x4de417;}return db['SmsMessage'][_0x49ae('0x5f')](_[_0x49ae('0x55')](_0x54d37f['body'],{'read':![],'body':_0x54d37f[_0x49ae('0x67')][_0x49ae('0x67')],'phone':_0x4b480a,'SmsAccountId':_0x1cf184['id'],'SmsInteractionId':_0x4de417['id'],'UserId':_0x54d37f['user']['id'],'ContactId':_0x3df455['id']}))[_0x49ae('0x37')](function(_0x53530e){_0x4de417[_0x49ae('0xc8')][_0x49ae('0xc7')]=[];_0x4de417[_0x49ae('0xc8')][_0x49ae('0xc7')][_0x49ae('0xa8')](_0x53530e['dataValues']);return _0x4de417;});})['then'](respondWithResult(_0x1c6576,null))[_0x49ae('0x2b')](handleError(_0x1c6576,null));};exports[_0x49ae('0x2d')]=function(_0x2271b7,_0x3a8278,_0x4d4162){if(_0x2271b7[_0x49ae('0x67')]['id']){delete _0x2271b7[_0x49ae('0x67')]['id'];}var _0x5da73d,_0x299ec6,_0x3caaf8;return db[_0x49ae('0x42')]['find']({'where':{'id':_0x2271b7[_0x49ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3a8278,null))[_0x49ae('0x37')](function(_0x209ac9){if(_0x209ac9){_0x3caaf8=_0x209ac9;logger['debug'](_0x49ae('0x24'),_0x49ae('0x2d'),'received\x20delivery\x20report\x20from',_0x209ac9[_0x49ae('0x45')],util[_0x49ae('0xc9')](_0x2271b7['body'],{'showHidden':![],'depth':null}));switch(_0x209ac9[_0x49ae('0x45')]){case _0x49ae('0x85'):if(_0x2271b7['body'][_0x49ae('0xca')]&&_0x2271b7[_0x49ae('0x67')][_0x49ae('0x2d')]){_0x299ec6=_0x2271b7[_0x49ae('0x67')][_0x49ae('0x2d')];return db[_0x49ae('0xc6')]['find']({'where':{'messageId':_0x2271b7[_0x49ae('0x67')][_0x49ae('0xca')]}});}break;case _0x49ae('0xcb'):if(_0x2271b7[_0x49ae('0x67')][_0x49ae('0xcc')]&&_0x2271b7['body'][_0x49ae('0xcd')]){_0x299ec6=_0x2271b7[_0x49ae('0x67')][_0x49ae('0xcd')];return db[_0x49ae('0xc6')]['find']({'where':{'messageId':_0x2271b7['body'][_0x49ae('0xcc')]}});}break;case _0x49ae('0x86'):if(_0x2271b7[_0x49ae('0x67')]['message_id']&&_0x2271b7['body'][_0x49ae('0xce')]){_0x299ec6=_0x2271b7[_0x49ae('0x67')]['status_code'];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x2271b7[_0x49ae('0x67')]['message_id']}});}break;case _0x49ae('0x8d'):var _0x77e358=_0x2271b7['body'][_0x49ae('0x8f')][0x0];if(_0x77e358['messageId']&&_0x77e358[_0x49ae('0x2d')][_0x49ae('0xcf')]===_0x49ae('0xd0')){_0x299ec6=_0x77e358[_0x49ae('0x2d')][_0x49ae('0xcf')];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x77e358[_0x49ae('0x87')]}});}break;case _0x49ae('0x92'):if(_0x2271b7['body'][_0x49ae('0x87')]&&_0x2271b7[_0x49ae('0x67')][_0x49ae('0x2d')]){_0x299ec6=_0x2271b7['body'][_0x49ae('0x2d')];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x2271b7[_0x49ae('0x67')][_0x49ae('0x87')]}});}break;case _0x49ae('0xd1'):if(_0x2271b7['body'][0x0]['message']['id']){_0x299ec6=_0x2271b7['body'][0x0][_0x49ae('0x45')];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x2271b7[_0x49ae('0x67')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x2271b7[_0x49ae('0x67')][_0x49ae('0xd2')]&&_0x2271b7[_0x49ae('0x67')]['status']){_0x299ec6=_0x2271b7[_0x49ae('0x67')][_0x49ae('0x2d')];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x2271b7[_0x49ae('0x67')][_0x49ae('0xd2')]}});}break;}}})[_0x49ae('0x37')](handleEntityNotFound(_0x3a8278,null))[_0x49ae('0x37')](function(_0x3b8ac6){if(_0x3b8ac6){_0x5da73d=_0x3b8ac6;switch(_0x3caaf8[_0x49ae('0x45')]){case'skebby':if(_0x299ec6===_0x49ae('0xd0')){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x85'),util[_0x49ae('0xc9')](_0x2271b7[_0x49ae('0x67')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x299ec6==='1'){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x85'),util[_0x49ae('0xc9')](_0x2271b7[_0x49ae('0x67')],{'showHidden':![],'depth':null}));}break;case _0x49ae('0x86'):if(!_0x2271b7[_0x49ae('0x67')][_0x49ae('0xd3')]&&_0x299ec6>=0xc8&&_0x299ec6<=0xce){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger['error'](_0x49ae('0x24'),'status',_0x49ae('0x86'),util['inspect'](_0x2271b7[_0x49ae('0x67')],{'showHidden':![],'depth':null}));}break;case _0x49ae('0x8d'):var _0x43957f=_0x2271b7[_0x49ae('0x67')][_0x49ae('0x8f')][0x0];if(_0x43957f[_0x49ae('0x2d')][_0x49ae('0xcf')]==='DELIVERED'){return _0x5da73d['update']({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x8d'),util[_0x49ae('0xc9')](_0x2271b7['body'],{'showHidden':![],'depth':null}));}break;case _0x49ae('0x92'):if(_0x299ec6==_0x49ae('0xd4')||_0x299ec6==_0x49ae('0xd5')){return _0x5da73d['update']({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x92'),util[_0x49ae('0xc9')](_0x2271b7['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x299ec6==_0x49ae('0xd6')){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger['error'](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0xd1'),util[_0x49ae('0xc9')](_0x2271b7[_0x49ae('0x67')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x299ec6===_0x49ae('0xd7')||_0x299ec6==='ACCEPTD'){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),'status',_0x49ae('0x93'),util[_0x49ae('0xc9')](_0x2271b7['body'],{'showHidden':![],'depth':null}));}break;}return _0x5da73d;}})[_0x49ae('0x37')](respondWithResult(_0x3a8278,null))['catch'](handleError(_0x3a8278,null));};exports['statusGet']=function(_0x1ff103,_0x48fd2f,_0x115d09){var _0x41d905,_0x252e19,_0x29a516;return db[_0x49ae('0x42')]['find']({'where':{'id':_0x1ff103[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x48fd2f,null))['then'](function(_0x10aa2f){if(_0x10aa2f){_0x29a516=_0x10aa2f;logger[_0x49ae('0xb3')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x49ae('0x2d'),_0x49ae('0xd8'),_0x10aa2f[_0x49ae('0x45')],util[_0x49ae('0xc9')](_0x1ff103['query'],{'showHidden':![],'depth':null}));switch(_0x10aa2f[_0x49ae('0x45')]){case _0x49ae('0x90'):if(_0x1ff103[_0x49ae('0x48')][_0x49ae('0xd9')]&&_0x1ff103[_0x49ae('0x48')][_0x49ae('0xda')]){_0x252e19=_0x1ff103['query'][_0x49ae('0xda')];return db[_0x49ae('0xc6')]['find']({'where':{'messageId':_0x1ff103[_0x49ae('0x48')][_0x49ae('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x48fd2f,null))['then'](function(_0x184e88){if(_0x184e88){_0x41d905=_0x184e88;switch(_0x29a516[_0x49ae('0x45')]){case _0x49ae('0x90'):if(_0x252e19==='2'||_0x252e19==='6'){return _0x41d905[_0x49ae('0x36')]({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x90'),util[_0x49ae('0xc9')](_0x1ff103[_0x49ae('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x41d905;}})[_0x49ae('0x37')](respondWithResult(_0x48fd2f,null))[_0x49ae('0x2b')](handleError(_0x48fd2f,null));};exports[_0x49ae('0xdb')]=function(_0x3b984a,_0x5893e8,_0x165eae){return db['SmsAccount'][_0x49ae('0x5e')]({'where':{'id':_0x3b984a['params']['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x5893e8,null))['then'](function(_0x59fa66){if(_0x59fa66){return _0x59fa66[_0x49ae('0xdb')](_0x3b984a[_0x49ae('0x67')][_0x49ae('0x72')],_[_0x49ae('0xa0')](_0x3b984a['body'],[_0x49ae('0x72'),'id'])||{})[_0x49ae('0xa4')](function(_0x29204d){for(var _0x1e8fa5=0x0;_0x1e8fa5<_0x3b984a[_0x49ae('0x67')]['ids'][_0x49ae('0x4e')];_0x1e8fa5+=0x1){socket['emit'](_0x49ae('0xdc'),{'UserId':Number(_0x3b984a[_0x49ae('0x67')][_0x49ae('0x72')][_0x1e8fa5]),'SmsAccountId':Number(_0x3b984a[_0x49ae('0x5c')]['id'])});}return _0x29204d;});}})['then'](respondWithResult(_0x5893e8,null))[_0x49ae('0x2b')](handleError(_0x5893e8,null));};exports[_0x49ae('0xdd')]=function(_0x448ec2,_0x25b848,_0x4b2403){return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x448ec2[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x25b848,null))[_0x49ae('0x37')](function(_0x9e1636){if(_0x9e1636){return _0x9e1636[_0x49ae('0xdd')](_0x448ec2['query'][_0x49ae('0x72')])[_0x49ae('0x37')](function(){if(_[_0x49ae('0xde')](_0x448ec2['query'][_0x49ae('0x72')])){for(var _0x188c1b=0x0;_0x188c1b<_0x448ec2['query'][_0x49ae('0x72')][_0x49ae('0x4e')];_0x188c1b+=0x1){socket['emit'](_0x49ae('0xdf'),{'UserId':Number(_0x448ec2[_0x49ae('0x48')][_0x49ae('0x72')][_0x188c1b]),'SmsAccountId':Number(_0x448ec2[_0x49ae('0x5c')]['id'])});}}else{socket[_0x49ae('0xe0')](_0x49ae('0xdf'),{'UserId':Number(_0x448ec2[_0x49ae('0x48')]['ids']),'SmsAccountId':Number(_0x448ec2[_0x49ae('0x5c')]['id'])});}});}})[_0x49ae('0x37')](respondWithStatusCode(_0x25b848,null))[_0x49ae('0x2b')](handleError(_0x25b848,null));};exports[_0x49ae('0xe1')]=function(_0x1904c9,_0x47208d,_0x2bdf78){var _0x383339={};var _0x3033be={};var _0x37d98a;var _0x10ad33;return db[_0x49ae('0x42')]['findOne']({'where':{'id':_0x1904c9[_0x49ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x47208d,null))[_0x49ae('0x37')](function(_0x5ed284){if(_0x5ed284){_0x37d98a=_0x5ed284;_0x3033be['model']=_[_0x49ae('0x49')](db[_0x49ae('0xbe')][_0x49ae('0x43')]);_0x3033be['query']=_['keys'](_0x1904c9[_0x49ae('0x48')]);_0x3033be[_0x49ae('0x4a')]=_[_0x49ae('0x4b')](_0x3033be[_0x49ae('0x47')],_0x3033be[_0x49ae('0x48')]);_0x383339[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x3033be[_0x49ae('0x47')],qs['fields'](_0x1904c9[_0x49ae('0x48')]['fields']));_0x383339[_0x49ae('0x4c')]=_0x383339[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x383339[_0x49ae('0x4c')]:_0x3033be[_0x49ae('0x47')];_0x383339[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0x1904c9['query']['sort']);_0x383339[_0x49ae('0x54')]=qs[_0x49ae('0x4a')](_[_0x49ae('0x52')](_0x1904c9[_0x49ae('0x48')],_0x3033be['filters']));if(_0x1904c9[_0x49ae('0x48')][_0x49ae('0x53')]){_0x383339[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x383339[_0x49ae('0x54')],{'$or':_['map'](_0x383339[_0x49ae('0x4c')],function(_0x7fdad3){var _0x9ab01a={};_0x9ab01a[_0x7fdad3]={'$like':'%'+_0x1904c9[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x9ab01a;})});}_0x383339=_['merge']({},_0x383339,_0x1904c9[_0x49ae('0x57')]);return _0x37d98a[_0x49ae('0xe1')](_0x383339);}})[_0x49ae('0x37')](function(_0xbc8b9c){if(_0xbc8b9c){_0x10ad33=_0xbc8b9c[_0x49ae('0x4e')];if(!_0x1904c9[_0x49ae('0x48')][_0x49ae('0x4f')]('nolimit')){_0x383339[_0x49ae('0x32')]=qs[_0x49ae('0x32')](_0x1904c9[_0x49ae('0x48')]['limit']);_0x383339[_0x49ae('0x2f')]=qs[_0x49ae('0x2f')](_0x1904c9[_0x49ae('0x48')][_0x49ae('0x2f')]);}return _0x37d98a['getAgents'](_0x383339);}})[_0x49ae('0x37')](function(_0xfcbe47){if(_0xfcbe47){return _0xfcbe47?{'count':_0x10ad33,'rows':_0xfcbe47}:null;}})['then'](respondWithResult(_0x47208d,null))[_0x49ae('0x2b')](handleError(_0x47208d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f05d39f..bbf70c4 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 _0x2565=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x380718,_0x2661bb){var _0x26e175=function(_0x93fc83){while(--_0x93fc83){_0x380718['push'](_0x380718['shift']());}};_0x26e175(++_0x2661bb);}(_0x2565,0x1cc));var _0x5256=function(_0x5b7c15,_0x964668){_0x5b7c15=_0x5b7c15-0x0;var _0xcdb61a=_0x2565[_0x5b7c15];return _0xcdb61a;};'use strict';var EventEmitter=require(_0x5256('0x0'));var SmsAccount=require(_0x5256('0x1'))['db'][_0x5256('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5256('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5256('0x4')};function emitEvent(_0x1ff0d1){return function(_0x2057b9,_0x47d3ee,_0x40d455){SmsAccountEvents['emit'](_0x1ff0d1+':'+_0x2057b9['id'],_0x2057b9);SmsAccountEvents[_0x5256('0x5')](_0x1ff0d1,_0x2057b9);_0x40d455(null);};}for(var e in events){if(events[_0x5256('0x6')](e)){var event=events[e];SmsAccount[_0x5256('0x7')](e,emitEvent(event));}}module[_0x5256('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x4f14=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x2fd5d6,_0x215d57){var _0x46a46f=function(_0x398ee9){while(--_0x398ee9){_0x2fd5d6['push'](_0x2fd5d6['shift']());}};_0x46a46f(++_0x215d57);}(_0x4f14,0x1a7));var _0x44f1=function(_0x229c8b,_0x3fcef6){_0x229c8b=_0x229c8b-0x0;var _0x520a1b=_0x4f14[_0x229c8b];return _0x520a1b;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x44f1('0x0'))['db'][_0x44f1('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x44f1('0x2')](0x0);var events={'afterCreate':_0x44f1('0x3'),'afterUpdate':_0x44f1('0x4'),'afterDestroy':_0x44f1('0x5')};function emitEvent(_0xf442b2){return function(_0x2ef960,_0x2063b8,_0x315575){SmsAccountEvents['emit'](_0xf442b2+':'+_0x2ef960['id'],_0x2ef960);SmsAccountEvents['emit'](_0xf442b2,_0x2ef960);_0x315575(null);};}for(var e in events){if(events[_0x44f1('0x6')](e)){var event=events[e];SmsAccount[_0x44f1('0x7')](e,emitEvent(event));}}module[_0x44f1('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 79943b0..2cfa5b4 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 _0x8f44=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','moment','bluebird','path'];(function(_0x580973,_0x45f49f){var _0x1079b0=function(_0x5e66e7){while(--_0x5e66e7){_0x580973['push'](_0x580973['shift']());}};_0x1079b0(++_0x45f49f);}(_0x8f44,0xd7));var _0x48f4=function(_0x420501,_0x4f5374){_0x420501=_0x420501-0x0;var _0x303742=_0x8f44[_0x420501];return _0x303742;};'use strict';var _=require(_0x48f4('0x0'));var util=require(_0x48f4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x48f4('0x2'));var BPromise=require(_0x48f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48f4('0x4'));var rimraf=require('rimraf');var config=require(_0x48f4('0x5'));var attributes=require(_0x48f4('0x6'));module[_0x48f4('0x7')]=function(_0x369c6b,_0x360c52){return _0x369c6b[_0x48f4('0x8')](_0x48f4('0x9'),attributes,{'tableName':_0x48f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ac=['moment','bluebird','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','util','../../config/logger','api'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x53ac,0x16f));var _0xc53a=function(_0x1b269a,_0x15daf8){_0x1b269a=_0x1b269a-0x0;var _0x4efdd1=_0x53ac[_0x1b269a];return _0x4efdd1;};'use strict';var _=require('lodash');var util=require(_0xc53a('0x0'));var logger=require(_0xc53a('0x1'))(_0xc53a('0x2'));var moment=require(_0xc53a('0x3'));var BPromise=require(_0xc53a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53a('0x5'));var rimraf=require('rimraf');var config=require(_0xc53a('0x6'));var attributes=require(_0xc53a('0x7'));module['exports']=function(_0x49f1e0,_0x57d3af){return _0x49f1e0[_0xc53a('0x8')](_0xc53a('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 393b094..206764d 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 _0x6eec=['error','code','message','SmsAccount','find','options','raw','where','attributes','include','model','map','ShowSmsAccount','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','stringify'];(function(_0x3e845b,_0x5ae50b){var _0x425a54=function(_0x72d265){while(--_0x72d265){_0x3e845b['push'](_0x3e845b['shift']());}};_0x425a54(++_0x5ae50b);}(_0x6eec,0x136));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var moment=require('moment');var BPromise=require(_0xc6ee('0x2'));var rs=require(_0xc6ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6ee('0x4'))['db'];var utils=require(_0xc6ee('0x5'));var logger=require(_0xc6ee('0x6'))(_0xc6ee('0x7'));var config=require(_0xc6ee('0x8'));var jayson=require(_0xc6ee('0x9'));var client=jayson[_0xc6ee('0xa')][_0xc6ee('0xb')]({'port':0x232a});config[_0xc6ee('0xc')]=_[_0xc6ee('0xd')](config[_0xc6ee('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6ee('0xe'))(new Redis(config['redis']));require(_0xc6ee('0xf'))[_0xc6ee('0x10')](socket);function respondWithRpcPromise(_0x1fcac2,_0x904e92,_0x31ee2a){return new BPromise(function(_0x484663,_0x5dcb57){return client[_0xc6ee('0x11')](_0x1fcac2,_0x31ee2a)[_0xc6ee('0x12')](function(_0x20031e){logger[_0xc6ee('0x13')](_0xc6ee('0x14'),_0x904e92,'request\x20sent');logger[_0xc6ee('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x904e92,'request\x20sent',JSON[_0xc6ee('0x16')](_0x20031e));if(_0x20031e[_0xc6ee('0x17')]){if(_0x20031e[_0xc6ee('0x17')][_0xc6ee('0x18')]===0x1f4){logger[_0xc6ee('0x17')](_0xc6ee('0x14'),_0x904e92,_0x20031e[_0xc6ee('0x17')][_0xc6ee('0x19')]);return _0x5dcb57(_0x20031e['error'][_0xc6ee('0x19')]);}logger[_0xc6ee('0x17')](_0xc6ee('0x14'),_0x904e92,_0x20031e[_0xc6ee('0x17')]['message']);return _0x484663(_0x20031e[_0xc6ee('0x17')][_0xc6ee('0x19')]);}else{logger[_0xc6ee('0x13')](_0xc6ee('0x14'),_0x904e92,'request\x20sent');_0x484663(_0x20031e['result'][_0xc6ee('0x19')]);}})['catch'](function(_0x348ce1){logger[_0xc6ee('0x17')](_0xc6ee('0x14'),_0x904e92,_0x348ce1);_0x5dcb57(_0x348ce1);});});}exports['ShowSmsAccount']=function(_0x29f1f2){var _0x357775=this;return new Promise(function(_0x1b41e6,_0x1c901a){return db[_0xc6ee('0x1a')][_0xc6ee('0x1b')]({'raw':_0x29f1f2['options']?_0x29f1f2[_0xc6ee('0x1c')][_0xc6ee('0x1d')]===undefined?!![]:![]:!![],'where':_0x29f1f2[_0xc6ee('0x1c')]?_0x29f1f2['options'][_0xc6ee('0x1e')]||null:null,'attributes':_0x29f1f2[_0xc6ee('0x1c')]?_0x29f1f2[_0xc6ee('0x1c')][_0xc6ee('0x1f')]||null:null,'include':_0x29f1f2[_0xc6ee('0x1c')]?_0x29f1f2[_0xc6ee('0x1c')]['include']?_['map'](_0x29f1f2[_0xc6ee('0x1c')][_0xc6ee('0x20')],function(_0x7e19a4){return{'model':db[_0x7e19a4[_0xc6ee('0x21')]],'as':_0x7e19a4['as'],'attributes':_0x7e19a4[_0xc6ee('0x1f')],'include':_0x7e19a4[_0xc6ee('0x20')]?_[_0xc6ee('0x22')](_0x7e19a4['include'],function(_0x22ae3f){return{'model':db[_0x22ae3f[_0xc6ee('0x21')]],'as':_0x22ae3f['as'],'attributes':_0x22ae3f[_0xc6ee('0x1f')],'include':_0x22ae3f[_0xc6ee('0x20')]?_[_0xc6ee('0x22')](_0x22ae3f['include'],function(_0x5e9cfd){return{'model':db[_0x5e9cfd[_0xc6ee('0x21')]],'as':_0x5e9cfd['as'],'attributes':_0x5e9cfd[_0xc6ee('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc6ee('0x12')](function(_0x16b91a){logger[_0xc6ee('0x13')](_0xc6ee('0x23'),_0x29f1f2);logger[_0xc6ee('0x15')]('ShowSmsAccount',_0x29f1f2,JSON[_0xc6ee('0x16')](_0x16b91a));_0x1b41e6(_0x16b91a);})[_0xc6ee('0x24')](function(_0x5af13f){logger['error'](_0xc6ee('0x23'),_0x5af13f['message'],_0x29f1f2);_0x1c901a(_0x357775[_0xc6ee('0x17')](0x1f4,_0x5af13f['message']));});});}; \ No newline at end of file +var _0x77fe=['stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','options','raw','where','attributes','map','include','model','then','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./smsAccount.socket','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x59c20e,_0x272105){var _0x383b97=function(_0x3400cf){while(--_0x3400cf){_0x59c20e['push'](_0x59c20e['shift']());}};_0x383b97(++_0x272105);}(_0x77fe,0x1e1));var _0xe77f=function(_0x29aae5,_0x1c8a1c){_0x29aae5=_0x29aae5-0x0;var _0x297189=_0x77fe[_0x29aae5];return _0x297189;};'use strict';var _=require(_0xe77f('0x0'));var util=require('util');var moment=require(_0xe77f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe77f('0x2'))['db'];var utils=require(_0xe77f('0x3'));var logger=require(_0xe77f('0x4'))('rpc');var config=require(_0xe77f('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe77f('0x6')]({'port':0x232a});config[_0xe77f('0x7')]=_[_0xe77f('0x8')](config['redis'],{'host':_0xe77f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe77f('0x7')]));require(_0xe77f('0xa'))['register'](socket);function respondWithRpcPromise(_0x5e8bba,_0x13efb7,_0x55be8d){return new BPromise(function(_0x290df3,_0x34b916){return client['request'](_0x5e8bba,_0x55be8d)['then'](function(_0x5f5df3){logger[_0xe77f('0xb')]('SmsAccount,\x20%s,\x20%s',_0x13efb7,_0xe77f('0xc'));logger[_0xe77f('0xd')](_0xe77f('0xe'),_0x13efb7,_0xe77f('0xc'),JSON[_0xe77f('0xf')](_0x5f5df3));if(_0x5f5df3[_0xe77f('0x10')]){if(_0x5f5df3[_0xe77f('0x10')][_0xe77f('0x11')]===0x1f4){logger[_0xe77f('0x10')]('SmsAccount,\x20%s,\x20%s',_0x13efb7,_0x5f5df3[_0xe77f('0x10')]['message']);return _0x34b916(_0x5f5df3[_0xe77f('0x10')]['message']);}logger[_0xe77f('0x10')](_0xe77f('0x12'),_0x13efb7,_0x5f5df3['error'][_0xe77f('0x13')]);return _0x290df3(_0x5f5df3[_0xe77f('0x10')][_0xe77f('0x13')]);}else{logger['info'](_0xe77f('0x12'),_0x13efb7,'request\x20sent');_0x290df3(_0x5f5df3[_0xe77f('0x14')][_0xe77f('0x13')]);}})[_0xe77f('0x15')](function(_0x1fb1a0){logger['error'](_0xe77f('0x12'),_0x13efb7,_0x1fb1a0);_0x34b916(_0x1fb1a0);});});}exports[_0xe77f('0x16')]=function(_0x1eb797){var _0x41cc5f=this;return new Promise(function(_0x580af1,_0x5e1fd7){return db['SmsAccount']['find']({'raw':_0x1eb797[_0xe77f('0x17')]?_0x1eb797['options'][_0xe77f('0x18')]===undefined?!![]:![]:!![],'where':_0x1eb797[_0xe77f('0x17')]?_0x1eb797[_0xe77f('0x17')][_0xe77f('0x19')]||null:null,'attributes':_0x1eb797[_0xe77f('0x17')]?_0x1eb797['options'][_0xe77f('0x1a')]||null:null,'include':_0x1eb797['options']?_0x1eb797[_0xe77f('0x17')]['include']?_[_0xe77f('0x1b')](_0x1eb797[_0xe77f('0x17')][_0xe77f('0x1c')],function(_0x3173f9){return{'model':db[_0x3173f9[_0xe77f('0x1d')]],'as':_0x3173f9['as'],'attributes':_0x3173f9[_0xe77f('0x1a')],'include':_0x3173f9[_0xe77f('0x1c')]?_[_0xe77f('0x1b')](_0x3173f9['include'],function(_0x34c203){return{'model':db[_0x34c203[_0xe77f('0x1d')]],'as':_0x34c203['as'],'attributes':_0x34c203['attributes'],'include':_0x34c203[_0xe77f('0x1c')]?_[_0xe77f('0x1b')](_0x34c203[_0xe77f('0x1c')],function(_0x32d065){return{'model':db[_0x32d065[_0xe77f('0x1d')]],'as':_0x32d065['as'],'attributes':_0x32d065[_0xe77f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe77f('0x1e')](function(_0x3abf38){logger[_0xe77f('0xb')]('ShowSmsAccount',_0x1eb797);logger[_0xe77f('0xd')](_0xe77f('0x16'),_0x1eb797,JSON[_0xe77f('0xf')](_0x3abf38));_0x580af1(_0x3abf38);})[_0xe77f('0x15')](function(_0xc2fd10){logger[_0xe77f('0x10')](_0xe77f('0x16'),_0xc2fd10[_0xe77f('0x13')],_0x1eb797);_0x5e1fd7(_0x41cc5f[_0xe77f('0x10')](0x1f4,_0xc2fd10['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 8137e32..618c9ee 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 92d43d8..8132258 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x762099,_0x4e03e4){var _0x2c0495=function(_0x2876cf){while(--_0x2876cf){_0x762099['push'](_0x762099['shift']());}};_0x2c0495(++_0x4e03e4);}(_0x7217,0x19e));var _0x7721=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x7217[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3d542c,_0x2098ae){var _0x4946de=function(_0x51171f){while(--_0x51171f){_0x3d542c['push'](_0x3d542c['shift']());}};_0x4946de(++_0x2098ae);}(_0x3e74,0x175));var _0x43e7=function(_0x4b164a,_0x21631c){_0x4b164a=_0x4b164a-0x0;var _0xc67168=_0x3e74[_0x4b164a];return _0xc67168;};'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('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 76930d5..233370c 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 _0x5f5e=['TEXT','*,*,*,*','exports','STRING'];(function(_0x26fdec,_0x46c36c){var _0x46b276=function(_0x1608b6){while(--_0x1608b6){_0x26fdec['push'](_0x26fdec['shift']());}};_0x46b276(++_0x46c36c);}(_0x5f5e,0xd6));var _0xe5f5=function(_0x5e15b5,_0x43036b){_0x5e15b5=_0x5e15b5-0x0;var _0x13cd01=_0x5f5e[_0x5e15b5];return _0x13cd01;};'use strict';var Sequelize=require('sequelize');module[_0xe5f5('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe5f5('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe5f5('0x2')]()},'description':{'type':Sequelize[_0xe5f5('0x1')]},'interval':{'type':Sequelize[_0xe5f5('0x1')],'defaultValue':_0xe5f5('0x3')}}; \ No newline at end of file +var _0xd9d7=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd9d7,0x1a8));var _0x7d9d=function(_0x444e8b,_0x3524cc){_0x444e8b=_0x444e8b-0x0;var _0x35eb37=_0xd9d7[_0x444e8b];return _0x35eb37;};'use strict';var Sequelize=require(_0x7d9d('0x0'));module[_0x7d9d('0x1')]={'priority':{'type':Sequelize[_0x7d9d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7d9d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7d9d('0x4')]()},'description':{'type':Sequelize[_0x7d9d('0x3')]},'interval':{'type':Sequelize[_0x7d9d('0x3')],'defaultValue':_0x7d9d('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6085982..75d7630 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 _0x5106=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','reject','update','then','end','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields'];(function(_0x55ed83,_0x18c410){var _0x1f2336=function(_0x463c37){while(--_0x463c37){_0x55ed83['push'](_0x55ed83['shift']());}};_0x1f2336(++_0x18c410);}(_0x5106,0xa3));var _0x6510=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5106[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6510('0x0'));var zipdir=require(_0x6510('0x1'));var jsonpatch=require(_0x6510('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6510('0x3'));var Mustache=require(_0x6510('0x4'));var util=require(_0x6510('0x5'));var path=require('path');var sox=require(_0x6510('0x6'));var csv=require('to-csv');var ejs=require(_0x6510('0x7'));var fs=require('fs');var fs_extra=require(_0x6510('0x8'));var _=require(_0x6510('0x9'));var squel=require(_0x6510('0xa'));var crypto=require(_0x6510('0xb'));var jsforce=require(_0x6510('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6510('0xd'));var querystring=require(_0x6510('0xe'));var Papa=require(_0x6510('0xf'));var Redis=require(_0x6510('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6510('0x11'));var as=require(_0x6510('0x12'));var hardwareService=require(_0x6510('0x13'));var logger=require('../../config/logger')(_0x6510('0x14'));var utils=require(_0x6510('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6510('0x16'));var db=require(_0x6510('0x17'))['db'];function respondWithStatusCode(_0xe9a3e2,_0x436d9e){_0x436d9e=_0x436d9e||0xcc;return function(_0x67a0d9){if(_0x67a0d9){return _0xe9a3e2[_0x6510('0x18')](_0x436d9e);}return _0xe9a3e2[_0x6510('0x19')](_0x436d9e)['end']();};}function respondWithResult(_0x5a760b,_0x35edb3){_0x35edb3=_0x35edb3||0xc8;return function(_0x769136){if(_0x769136){return _0x5a760b['status'](_0x35edb3)[_0x6510('0x1a')](_0x769136);}};}function respondWithFilteredResult(_0x21017b,_0x48215c){return function(_0x1c6d66){if(_0x1c6d66){var _0x5515be=typeof _0x48215c[_0x6510('0x1b')]===_0x6510('0x1c')&&typeof _0x48215c[_0x6510('0x1d')]===_0x6510('0x1c');var _0xff6643=_0x1c6d66[_0x6510('0x1e')];var _0x1d3933=_0x5515be?0x0:_0x48215c[_0x6510('0x1b')];var _0x2a7f31=_0x5515be?_0x1c6d66[_0x6510('0x1e')]:_0x48215c[_0x6510('0x1b')]+_0x48215c[_0x6510('0x1d')];var _0x1cb842;if(_0x2a7f31>=_0xff6643){_0x2a7f31=_0xff6643;_0x1cb842=0xc8;}else{_0x1cb842=0xce;}_0x21017b[_0x6510('0x19')](_0x1cb842);return _0x21017b['set']('Content-Range',_0x1d3933+'-'+_0x2a7f31+'/'+_0xff6643)['json'](_0x1c6d66);}return null;};}function patchUpdates(_0x30d7ba){return function(_0x37aae7){try{jsonpatch['apply'](_0x37aae7,_0x30d7ba,!![]);}catch(_0x4e95ae){return BPromise[_0x6510('0x1f')](_0x4e95ae);}return _0x37aae7['save']();};}function saveUpdates(_0x296492,_0x5a57bb){return function(_0x34a93c){if(_0x34a93c){return _0x34a93c[_0x6510('0x20')](_0x296492)[_0x6510('0x21')](function(_0x128a68){return _0x128a68;});}return null;};}function removeEntity(_0x535a72,_0x55054e){return function(_0x2cb164){if(_0x2cb164){return _0x2cb164['destroy']()[_0x6510('0x21')](function(){_0x535a72[_0x6510('0x19')](0xcc)[_0x6510('0x22')]();});}};}function handleEntityNotFound(_0x2088f1,_0x5df58a){return function(_0x275b2b){if(!_0x275b2b){_0x2088f1[_0x6510('0x18')](0x194);}return _0x275b2b;};}function handleError(_0x1b47a5,_0x330823){_0x330823=_0x330823||0x1f4;return function(_0x24a964){logger[_0x6510('0x23')](_0x24a964[_0x6510('0x24')]);if(_0x24a964[_0x6510('0x25')]){delete _0x24a964[_0x6510('0x25')];}_0x1b47a5[_0x6510('0x19')](_0x330823)['send'](_0x24a964);};}exports[_0x6510('0x26')]=function(_0x1e3178,_0x4be958){var _0x1bbfdf={},_0x5dea9e={},_0x209a30={'count':0x0,'rows':[]};var _0xd7ef9b=_[_0x6510('0x27')](db[_0x6510('0x28')][_0x6510('0x29')],function(_0x51a966){return{'name':_0x51a966[_0x6510('0x2a')],'type':_0x51a966['type']['key']};});_0x5dea9e[_0x6510('0x2b')]=_[_0x6510('0x27')](_0xd7ef9b,'name');_0x5dea9e['query']=_[_0x6510('0x2c')](_0x1e3178[_0x6510('0x2d')]);_0x5dea9e[_0x6510('0x2e')]=_[_0x6510('0x2f')](_0x5dea9e[_0x6510('0x2b')],_0x5dea9e[_0x6510('0x2d')]);_0x1bbfdf[_0x6510('0x30')]=_[_0x6510('0x2f')](_0x5dea9e[_0x6510('0x2b')],qs[_0x6510('0x31')](_0x1e3178[_0x6510('0x2d')]['fields']));_0x1bbfdf[_0x6510('0x30')]=_0x1bbfdf[_0x6510('0x30')][_0x6510('0x32')]?_0x1bbfdf['attributes']:_0x5dea9e['model'];if(!_0x1e3178['query'][_0x6510('0x33')](_0x6510('0x34'))){_0x1bbfdf['limit']=qs[_0x6510('0x1d')](_0x1e3178[_0x6510('0x2d')][_0x6510('0x1d')]);_0x1bbfdf[_0x6510('0x1b')]=qs[_0x6510('0x1b')](_0x1e3178[_0x6510('0x2d')][_0x6510('0x1b')]);}_0x1bbfdf['order']=qs[_0x6510('0x35')](_0x1e3178[_0x6510('0x2d')]['sort']);_0x1bbfdf[_0x6510('0x36')]=qs[_0x6510('0x2e')](_[_0x6510('0x37')](_0x1e3178[_0x6510('0x2d')],_0x5dea9e['filters']),_0xd7ef9b);if(_0x1e3178['query'][_0x6510('0x38')]){_0x1bbfdf['where']=_[_0x6510('0x39')](_0x1bbfdf[_0x6510('0x36')],{'$or':_[_0x6510('0x27')](_0xd7ef9b,function(_0x204200){if(_0x204200[_0x6510('0x3a')]!=='VIRTUAL'){var _0x71e614={};_0x71e614[_0x204200[_0x6510('0x25')]]={'$like':'%'+_0x1e3178[_0x6510('0x2d')][_0x6510('0x38')]+'%'};return _0x71e614;}})});}_0x1bbfdf=_[_0x6510('0x39')]({},_0x1bbfdf,_0x1e3178[_0x6510('0x3b')]);var _0x4cbdb5={'where':_0x1bbfdf[_0x6510('0x36')]};return db[_0x6510('0x28')][_0x6510('0x1e')](_0x4cbdb5)[_0x6510('0x21')](function(_0x301701){_0x209a30['count']=_0x301701;if(_0x1e3178[_0x6510('0x2d')][_0x6510('0x3c')]){_0x1bbfdf[_0x6510('0x3d')]=[{'all':!![]}];}return db[_0x6510('0x28')][_0x6510('0x3e')](_0x1bbfdf);})[_0x6510('0x21')](function(_0x13a21c){_0x209a30[_0x6510('0x3f')]=_0x13a21c;return _0x209a30;})[_0x6510('0x21')](respondWithFilteredResult(_0x4be958,_0x1bbfdf))['catch'](handleError(_0x4be958,null));};exports[_0x6510('0x40')]=function(_0x1df1b3,_0x1feef6){var _0x31b31b={'raw':!![],'where':{'id':_0x1df1b3['params']['id']}},_0x145185={};_0x145185['model']=_[_0x6510('0x2c')](db[_0x6510('0x28')][_0x6510('0x29')]);_0x145185[_0x6510('0x2d')]=_[_0x6510('0x2c')](_0x1df1b3[_0x6510('0x2d')]);_0x145185['filters']=_[_0x6510('0x2f')](_0x145185[_0x6510('0x2b')],_0x145185['query']);_0x31b31b[_0x6510('0x30')]=_[_0x6510('0x2f')](_0x145185[_0x6510('0x2b')],qs['fields'](_0x1df1b3[_0x6510('0x2d')][_0x6510('0x31')]));_0x31b31b[_0x6510('0x30')]=_0x31b31b[_0x6510('0x30')][_0x6510('0x32')]?_0x31b31b[_0x6510('0x30')]:_0x145185['model'];if(_0x1df1b3[_0x6510('0x2d')][_0x6510('0x3c')]){_0x31b31b[_0x6510('0x3d')]=[{'all':!![]}];}_0x31b31b=_[_0x6510('0x39')]({},_0x31b31b,_0x1df1b3[_0x6510('0x3b')]);return db[_0x6510('0x28')][_0x6510('0x41')](_0x31b31b)[_0x6510('0x21')](handleEntityNotFound(_0x1feef6,null))[_0x6510('0x21')](respondWithResult(_0x1feef6,null))[_0x6510('0x42')](handleError(_0x1feef6,null));};exports[_0x6510('0x43')]=function(_0x4fe5ee,_0x4912c9){return db[_0x6510('0x28')][_0x6510('0x43')](_0x4fe5ee['body'],{})[_0x6510('0x21')](respondWithResult(_0x4912c9,0xc9))['catch'](handleError(_0x4912c9,null));};exports['update']=function(_0x2a1af9,_0x3101c0){if(_0x2a1af9[_0x6510('0x44')]['id']){delete _0x2a1af9['body']['id'];}return db[_0x6510('0x28')][_0x6510('0x41')]({'where':{'id':_0x2a1af9[_0x6510('0x45')]['id']}})[_0x6510('0x21')](handleEntityNotFound(_0x3101c0,null))[_0x6510('0x21')](saveUpdates(_0x2a1af9[_0x6510('0x44')],null))[_0x6510('0x21')](respondWithResult(_0x3101c0,null))['catch'](handleError(_0x3101c0,null));};exports[_0x6510('0x46')]=function(_0x249892,_0x423ae8){return db[_0x6510('0x28')][_0x6510('0x41')]({'where':{'id':_0x249892[_0x6510('0x45')]['id']}})['then'](handleEntityNotFound(_0x423ae8,null))[_0x6510('0x21')](removeEntity(_0x423ae8,null))[_0x6510('0x42')](handleError(_0x423ae8,null));}; \ No newline at end of file +var _0x85ae=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','map','SmsApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','keys','find','create','body','eml-format','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x78f3a8,_0x4d9551){var _0x48af0d=function(_0x243b35){while(--_0x243b35){_0x78f3a8['push'](_0x78f3a8['shift']());}};_0x48af0d(++_0x4d9551);}(_0x85ae,0x145));var _0xe85a=function(_0x426da1,_0x48cbb1){_0x426da1=_0x426da1-0x0;var _0x270fdb=_0x85ae[_0x426da1];return _0x270fdb;};'use strict';var emlformat=require(_0xe85a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe85a('0x1'));var Mustache=require(_0xe85a('0x2'));var util=require(_0xe85a('0x3'));var path=require('path');var sox=require(_0xe85a('0x4'));var csv=require(_0xe85a('0x5'));var ejs=require(_0xe85a('0x6'));var fs=require('fs');var fs_extra=require(_0xe85a('0x7'));var _=require(_0xe85a('0x8'));var squel=require(_0xe85a('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe85a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe85a('0xb'));var Papa=require(_0xe85a('0xc'));var Redis=require(_0xe85a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe85a('0xe'));var as=require(_0xe85a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe85a('0x10'))('api');var utils=require(_0xe85a('0x11'));var config=require(_0xe85a('0x12'));var licenseUtil=require(_0xe85a('0x13'));var db=require(_0xe85a('0x14'))['db'];function respondWithStatusCode(_0x56046b,_0x3220a6){_0x3220a6=_0x3220a6||0xcc;return function(_0x4508eb){if(_0x4508eb){return _0x56046b[_0xe85a('0x15')](_0x3220a6);}return _0x56046b[_0xe85a('0x16')](_0x3220a6)[_0xe85a('0x17')]();};}function respondWithResult(_0x5a4716,_0x411970){_0x411970=_0x411970||0xc8;return function(_0x509266){if(_0x509266){return _0x5a4716[_0xe85a('0x16')](_0x411970)[_0xe85a('0x18')](_0x509266);}};}function respondWithFilteredResult(_0x37a6a0,_0x257f06){return function(_0x21966e){if(_0x21966e){var _0x544735=typeof _0x257f06[_0xe85a('0x19')]===_0xe85a('0x1a')&&typeof _0x257f06['limit']===_0xe85a('0x1a');var _0x2121ec=_0x21966e[_0xe85a('0x1b')];var _0x262e28=_0x544735?0x0:_0x257f06[_0xe85a('0x19')];var _0x12fa20=_0x544735?_0x21966e['count']:_0x257f06[_0xe85a('0x19')]+_0x257f06[_0xe85a('0x1c')];var _0x50288f;if(_0x12fa20>=_0x2121ec){_0x12fa20=_0x2121ec;_0x50288f=0xc8;}else{_0x50288f=0xce;}_0x37a6a0['status'](_0x50288f);return _0x37a6a0[_0xe85a('0x1d')](_0xe85a('0x1e'),_0x262e28+'-'+_0x12fa20+'/'+_0x2121ec)[_0xe85a('0x18')](_0x21966e);}return null;};}function patchUpdates(_0x1cc104){return function(_0x9fc564){try{jsonpatch['apply'](_0x9fc564,_0x1cc104,!![]);}catch(_0x29d78a){return BPromise[_0xe85a('0x1f')](_0x29d78a);}return _0x9fc564[_0xe85a('0x20')]();};}function saveUpdates(_0x17dce3,_0x57fcae){return function(_0x3f74b6){if(_0x3f74b6){return _0x3f74b6[_0xe85a('0x21')](_0x17dce3)[_0xe85a('0x22')](function(_0x57205c){return _0x57205c;});}return null;};}function removeEntity(_0x195e9f,_0x11885c){return function(_0x33cce2){if(_0x33cce2){return _0x33cce2['destroy']()[_0xe85a('0x22')](function(){_0x195e9f[_0xe85a('0x16')](0xcc)[_0xe85a('0x17')]();});}};}function handleEntityNotFound(_0xd99534,_0x43bca6){return function(_0x208863){if(!_0x208863){_0xd99534['sendStatus'](0x194);}return _0x208863;};}function handleError(_0x57f061,_0x11f917){_0x11f917=_0x11f917||0x1f4;return function(_0x4874f3){logger[_0xe85a('0x23')](_0x4874f3['stack']);if(_0x4874f3[_0xe85a('0x24')]){delete _0x4874f3['name'];}_0x57f061['status'](_0x11f917)[_0xe85a('0x25')](_0x4874f3);};}exports['index']=function(_0xd911aa,_0x51fd2e){var _0x2514db={},_0x89500={},_0x2228cb={'count':0x0,'rows':[]};var _0x27138d=_[_0xe85a('0x26')](db[_0xe85a('0x27')][_0xe85a('0x28')],function(_0xe21baf){return{'name':_0xe21baf['fieldName'],'type':_0xe21baf[_0xe85a('0x29')][_0xe85a('0x2a')]};});_0x89500[_0xe85a('0x2b')]=_['map'](_0x27138d,_0xe85a('0x24'));_0x89500[_0xe85a('0x2c')]=_['keys'](_0xd911aa['query']);_0x89500[_0xe85a('0x2d')]=_[_0xe85a('0x2e')](_0x89500[_0xe85a('0x2b')],_0x89500[_0xe85a('0x2c')]);_0x2514db[_0xe85a('0x2f')]=_['intersection'](_0x89500[_0xe85a('0x2b')],qs[_0xe85a('0x30')](_0xd911aa[_0xe85a('0x2c')]['fields']));_0x2514db[_0xe85a('0x2f')]=_0x2514db[_0xe85a('0x2f')][_0xe85a('0x31')]?_0x2514db['attributes']:_0x89500['model'];if(!_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x32')]('nolimit')){_0x2514db['limit']=qs['limit'](_0xd911aa['query'][_0xe85a('0x1c')]);_0x2514db[_0xe85a('0x19')]=qs[_0xe85a('0x19')](_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x19')]);}_0x2514db[_0xe85a('0x33')]=qs['sort'](_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x34')]);_0x2514db[_0xe85a('0x35')]=qs[_0xe85a('0x2d')](_[_0xe85a('0x36')](_0xd911aa[_0xe85a('0x2c')],_0x89500['filters']),_0x27138d);if(_0xd911aa[_0xe85a('0x2c')]['filter']){_0x2514db[_0xe85a('0x35')]=_[_0xe85a('0x37')](_0x2514db[_0xe85a('0x35')],{'$or':_[_0xe85a('0x26')](_0x27138d,function(_0x337765){if(_0x337765[_0xe85a('0x29')]!=='VIRTUAL'){var _0x40aeab={};_0x40aeab[_0x337765['name']]={'$like':'%'+_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x38')]+'%'};return _0x40aeab;}})});}_0x2514db=_[_0xe85a('0x37')]({},_0x2514db,_0xd911aa[_0xe85a('0x39')]);var _0x47a6c1={'where':_0x2514db[_0xe85a('0x35')]};return db[_0xe85a('0x27')][_0xe85a('0x1b')](_0x47a6c1)['then'](function(_0x2782b5){_0x2228cb[_0xe85a('0x1b')]=_0x2782b5;if(_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x3a')]){_0x2514db[_0xe85a('0x3b')]=[{'all':!![]}];}return db[_0xe85a('0x27')][_0xe85a('0x3c')](_0x2514db);})[_0xe85a('0x22')](function(_0x23f082){_0x2228cb[_0xe85a('0x3d')]=_0x23f082;return _0x2228cb;})['then'](respondWithFilteredResult(_0x51fd2e,_0x2514db))[_0xe85a('0x3e')](handleError(_0x51fd2e,null));};exports['show']=function(_0x254f72,_0x50c9c3){var _0x552a26={'raw':!![],'where':{'id':_0x254f72['params']['id']}},_0xc291e2={};_0xc291e2[_0xe85a('0x2b')]=_[_0xe85a('0x3f')](db[_0xe85a('0x27')]['rawAttributes']);_0xc291e2[_0xe85a('0x2c')]=_[_0xe85a('0x3f')](_0x254f72['query']);_0xc291e2[_0xe85a('0x2d')]=_[_0xe85a('0x2e')](_0xc291e2[_0xe85a('0x2b')],_0xc291e2[_0xe85a('0x2c')]);_0x552a26['attributes']=_[_0xe85a('0x2e')](_0xc291e2[_0xe85a('0x2b')],qs[_0xe85a('0x30')](_0x254f72[_0xe85a('0x2c')]['fields']));_0x552a26[_0xe85a('0x2f')]=_0x552a26['attributes'][_0xe85a('0x31')]?_0x552a26['attributes']:_0xc291e2[_0xe85a('0x2b')];if(_0x254f72['query']['includeAll']){_0x552a26['include']=[{'all':!![]}];}_0x552a26=_[_0xe85a('0x37')]({},_0x552a26,_0x254f72['options']);return db[_0xe85a('0x27')][_0xe85a('0x40')](_0x552a26)[_0xe85a('0x22')](handleEntityNotFound(_0x50c9c3,null))[_0xe85a('0x22')](respondWithResult(_0x50c9c3,null))[_0xe85a('0x3e')](handleError(_0x50c9c3,null));};exports[_0xe85a('0x41')]=function(_0x1e5d94,_0x1af361){return db[_0xe85a('0x27')]['create'](_0x1e5d94[_0xe85a('0x42')],{})[_0xe85a('0x22')](respondWithResult(_0x1af361,0xc9))[_0xe85a('0x3e')](handleError(_0x1af361,null));};exports['update']=function(_0x25a604,_0x3c6656){if(_0x25a604[_0xe85a('0x42')]['id']){delete _0x25a604[_0xe85a('0x42')]['id'];}return db[_0xe85a('0x27')]['find']({'where':{'id':_0x25a604['params']['id']}})[_0xe85a('0x22')](handleEntityNotFound(_0x3c6656,null))[_0xe85a('0x22')](saveUpdates(_0x25a604[_0xe85a('0x42')],null))[_0xe85a('0x22')](respondWithResult(_0x3c6656,null))['catch'](handleError(_0x3c6656,null));};exports['destroy']=function(_0x4fb5cd,_0x3258b5){return db[_0xe85a('0x27')][_0xe85a('0x40')]({'where':{'id':_0x4fb5cd['params']['id']}})[_0xe85a('0x22')](handleEntityNotFound(_0x3258b5,null))[_0xe85a('0x22')](removeEntity(_0x3258b5,null))[_0xe85a('0x3e')](handleError(_0x3258b5,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 00a965f..1adca9b 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 _0x95d9=['api','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1353dd,_0x15ddb5){var _0x438986=function(_0x3aa405){while(--_0x3aa405){_0x1353dd['push'](_0x1353dd['shift']());}};_0x438986(++_0x15ddb5);}(_0x95d9,0x97));var _0x995d=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x95d9[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x995d('0x0'));var util=require(_0x995d('0x1'));var logger=require(_0x995d('0x2'))(_0x995d('0x3'));var moment=require('moment');var BPromise=require(_0x995d('0x4'));var rp=require(_0x995d('0x5'));var fs=require('fs');var path=require(_0x995d('0x6'));var rimraf=require('rimraf');var config=require(_0x995d('0x7'));var attributes=require(_0x995d('0x8'));module[_0x995d('0x9')]=function(_0x226250,_0xe6d244){return _0x226250['define'](_0x995d('0xa'),attributes,{'tableName':_0x995d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x995d('0xc'),'collate':_0x995d('0xd')});}; \ No newline at end of file +var _0xedcb=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','define','sms_applications','utf8mb4','util'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0xedcb,0x1eb));var _0xbedc=function(_0x12da04,_0x57421e){_0x12da04=_0x12da04-0x0;var _0x4a022d=_0xedcb[_0x12da04];return _0x4a022d;};'use strict';var _=require('lodash');var util=require(_0xbedc('0x0'));var logger=require(_0xbedc('0x1'))(_0xbedc('0x2'));var moment=require(_0xbedc('0x3'));var BPromise=require(_0xbedc('0x4'));var rp=require(_0xbedc('0x5'));var fs=require('fs');var path=require(_0xbedc('0x6'));var rimraf=require('rimraf');var config=require(_0xbedc('0x7'));var attributes=require(_0xbedc('0x8'));module['exports']=function(_0x51fc15,_0x4f7f6c){return _0x51fc15[_0xbedc('0x9')]('SmsApplication',attributes,{'tableName':_0xbedc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbedc('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 51f6ffa..74d1e56 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 _0xce14=['code','message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x107872,_0x1c2f89){var _0x3fc897=function(_0x322af2){while(--_0x322af2){_0x107872['push'](_0x107872['shift']());}};_0x3fc897(++_0x1c2f89);}(_0xce14,0x17f));var _0x4ce1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xce14[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x4ce1('0x0'));var moment=require('moment');var BPromise=require(_0x4ce1('0x1'));var rs=require(_0x4ce1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce1('0x3'))['db'];var utils=require(_0x4ce1('0x4'));var logger=require(_0x4ce1('0x5'))(_0x4ce1('0x6'));var config=require(_0x4ce1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4ce1('0x8')][_0x4ce1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f603d,_0x2b9923,_0x539c1d){return new BPromise(function(_0x256648,_0x2beed4){return client[_0x4ce1('0xa')](_0x1f603d,_0x539c1d)['then'](function(_0x1b5bd8){logger[_0x4ce1('0xb')](_0x4ce1('0xc'),_0x2b9923,_0x4ce1('0xd'));logger['debug'](_0x4ce1('0xe'),_0x2b9923,_0x4ce1('0xd'),JSON[_0x4ce1('0xf')](_0x1b5bd8));if(_0x1b5bd8[_0x4ce1('0x10')]){if(_0x1b5bd8['error'][_0x4ce1('0x11')]===0x1f4){logger[_0x4ce1('0x10')](_0x4ce1('0xc'),_0x2b9923,_0x1b5bd8[_0x4ce1('0x10')][_0x4ce1('0x12')]);return _0x2beed4(_0x1b5bd8[_0x4ce1('0x10')][_0x4ce1('0x12')]);}logger[_0x4ce1('0x10')](_0x4ce1('0xc'),_0x2b9923,_0x1b5bd8[_0x4ce1('0x10')][_0x4ce1('0x12')]);return _0x256648(_0x1b5bd8['error'][_0x4ce1('0x12')]);}else{logger['info'](_0x4ce1('0xc'),_0x2b9923,_0x4ce1('0xd'));_0x256648(_0x1b5bd8[_0x4ce1('0x13')][_0x4ce1('0x12')]);}})['catch'](function(_0x221306){logger['error']('SmsApplication,\x20%s,\x20%s',_0x2b9923,_0x221306);_0x2beed4(_0x221306);});});} \ No newline at end of file +var _0x1c9a=['http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x1c9a,0x98));var _0xa1c9=function(_0x60b024,_0x50f851){_0x60b024=_0x60b024-0x0;var _0x2929e6=_0x1c9a[_0x60b024];return _0x2929e6;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('SmsApplication,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 72fc324..02271c1 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 _0x6324=['isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x51b506,_0x1b60bf){var _0x33c41a=function(_0x14b6cc){while(--_0x14b6cc){_0x51b506['push'](_0x51b506['shift']());}};_0x33c41a(++_0x1b60bf);}(_0x6324,0x142));var _0x4632=function(_0x8a22fd,_0x3f6c4e){_0x8a22fd=_0x8a22fd-0x0;var _0x3e12fe=_0x6324[_0x8a22fd];return _0x3e12fe;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./smsInteraction.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['get']('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0xc')]);router[_0x4632('0x7')](_0x4632('0xd'),auth[_0x4632('0x8')](),controller[_0x4632('0xe')]);router[_0x4632('0xf')]('/',auth[_0x4632('0x8')](),controller['create']);router[_0x4632('0xf')]('/:id/messages',auth[_0x4632('0x8')](),controller[_0x4632('0x10')]);router[_0x4632('0xf')](_0x4632('0x11'),auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x14')),controller[_0x4632('0x15')]);router[_0x4632('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x4632('0x12')](_0x4632('0x13'),_0x4632('0x17')),controller[_0x4632('0x18')]);router['delete'](_0x4632('0x19'),auth[_0x4632('0x8')](),interaction[_0x4632('0x12')]('sms',_0x4632('0x1a')),controller[_0x4632('0x1b')]);router['delete']('/:id/tags',auth[_0x4632('0x8')](),controller[_0x4632('0x1c')]);module[_0x4632('0x1d')]=router; \ No newline at end of file +var _0x087b=['sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x26ff28,_0xa51640){var _0x3631c2=function(_0x58269f){while(--_0x58269f){_0x26ff28['push'](_0x26ff28['shift']());}};_0x3631c2(++_0xa51640);}(_0x087b,0x11a));var _0xb087=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x087b[_0x368fb9];return _0x4892fb;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/messages',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x12')]('/',auth['isAuthenticated'](),controller[_0xb087('0x13')]);router[_0xb087('0x12')](_0xb087('0x14'),auth['isAuthenticated'](),controller[_0xb087('0x15')]);router[_0xb087('0x12')](_0xb087('0x16'),auth[_0xb087('0x9')](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x19')),controller[_0xb087('0x1a')]);router[_0xb087('0x1b')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),'smsinteraction:update'),controller[_0xb087('0x1c')]);router[_0xb087('0x1d')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x1e')),controller[_0xb087('0x1f')]);router['delete'](_0xb087('0x16'),auth[_0xb087('0x9')](),controller[_0xb087('0x20')]);module[_0xb087('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 931ca69..8b7d619 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 _0x3641=['out','moment','DATE','STRING','ENUM'];(function(_0x30baa0,_0x3d8e1b){var _0x3737c1=function(_0x126398){while(--_0x126398){_0x30baa0['push'](_0x30baa0['shift']());}};_0x3737c1(++_0x3d8e1b);}(_0x3641,0x173));var _0x1364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3641[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1364('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1364('0x1')]},'disposition':{'type':Sequelize[_0x1364('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1364('0x2')]},'note':{'type':Sequelize[_0x1364('0x2')]},'phone':{'type':Sequelize[_0x1364('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x1364('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1364('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x1364('0x3')]('in',_0x1364('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x126e=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x5a9438,_0x41f6ea){var _0x521a9d=function(_0x2acc17){while(--_0x2acc17){_0x5a9438['push'](_0x5a9438['shift']());}};_0x521a9d(++_0x41f6ea);}(_0x126e,0x108));var _0xe126=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x126e[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe126('0x0'));module[_0xe126('0x1')]={'closed':{'type':Sequelize[_0xe126('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe126('0x3')]},'disposition':{'type':Sequelize[_0xe126('0x4')]},'secondDisposition':{'type':Sequelize[_0xe126('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe126('0x4')]},'phone':{'type':Sequelize[_0xe126('0x4')]},'read1stAt':{'type':Sequelize[_0xe126('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe126('0x5')]('in',_0xe126('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe126('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe126('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe126('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 89a7734..eec99aa 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 _0x108d=['Messages','out','firstName','secret','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','then','sendStatus','error','stack','index','type','key','getOptions','findAll','sms','query','user','show','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','SmsInteraction','body','params','destroy','describe','addMessage','SmsMessage','ids','findOne','length','hasOwnProperty','order','sort','pick','where','SmsInteractionId','filter','map','$gte','format','rows','addTags','setTags','spread','Tag','name','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','Contact','lastName','createdAt','direction','read','SmsAccount','Account','Owner','fullname','get','Sms','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition'];(function(_0x3f450b,_0x23b2de){var _0x6f3679=function(_0x14153b){while(--_0x14153b){_0x3f450b['push'](_0x3f450b['shift']());}};_0x6f3679(++_0x23b2de);}(_0x108d,0x7e));var _0xd108=function(_0x2cedd5,_0x1f8e2b){_0x2cedd5=_0x2cedd5-0x0;var _0x1bdd01=_0x108d[_0x2cedd5];return _0x1bdd01;};'use strict';var rimraf=require(_0xd108('0x0'));var zipdir=require(_0xd108('0x1'));var moment=require(_0xd108('0x2'));var BPromise=require(_0xd108('0x3'));var util=require(_0xd108('0x4'));var path=require('path');var ejs=require(_0xd108('0x5'));var fs=require('fs');var _=require(_0xd108('0x6'));var Redis=require(_0xd108('0x7'));var interaction=require(_0xd108('0x8'));var qs=require(_0xd108('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0xd108('0xa'))(_0xd108('0xb'));var config=require(_0xd108('0xc'));var db=require('../../mysqldb')['db'];config[_0xd108('0xd')]=_['defaults'](config[_0xd108('0xd')],{'host':_0xd108('0xe'),'port':0x18eb});var socket=require(_0xd108('0xf'))(new Redis(config[_0xd108('0xd')]));require(_0xd108('0x10'))[_0xd108('0x11')](socket);function respondWithStatusCode(_0x16ffcd,_0x437794){_0x437794=_0x437794||0xcc;return function(_0x29e3fb){if(_0x29e3fb){return _0x16ffcd['sendStatus'](_0x437794);}return _0x16ffcd[_0xd108('0x12')](_0x437794)[_0xd108('0x13')]();};}function respondWithResult(_0x10f040,_0x2abf52){_0x2abf52=_0x2abf52||0xc8;return function(_0x347906){if(_0x347906){return _0x10f040[_0xd108('0x12')](_0x2abf52)[_0xd108('0x14')](_0x347906);}};}function respondWithFilteredResult(_0xe8e9c0,_0x13c1f7){return function(_0x1981bd){if(_0x1981bd){var _0x332a18=typeof _0x13c1f7['offset']===_0xd108('0x15')&&typeof _0x13c1f7[_0xd108('0x16')]===_0xd108('0x15');var _0x291ec2=_0x1981bd[_0xd108('0x17')];var _0x5e2284=_0x332a18?0x0:_0x13c1f7['offset'];var _0x277106=_0x332a18?_0x1981bd[_0xd108('0x17')]:_0x13c1f7[_0xd108('0x18')]+_0x13c1f7[_0xd108('0x16')];var _0x1da675;if(_0x277106>=_0x291ec2){_0x277106=_0x291ec2;_0x1da675=0xc8;}else{_0x1da675=0xce;}_0xe8e9c0[_0xd108('0x12')](_0x1da675);return _0xe8e9c0[_0xd108('0x19')](_0xd108('0x1a'),_0x5e2284+'-'+_0x277106+'/'+_0x291ec2)[_0xd108('0x14')](_0x1981bd);}return null;};}function saveUpdates(_0x108b76){return function(_0x53f9fd){if(_0x53f9fd){return _0x53f9fd['update'](_0x108b76)[_0xd108('0x1b')](function(_0x53e944){return _0x53e944;});}return null;};}function removeEntity(_0x41274c){return function(_0x212ffc){if(_0x212ffc){return _0x212ffc['destroy']()[_0xd108('0x1b')](function(){_0x41274c[_0xd108('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a6aa){return function(_0x5c5d0b){if(!_0x5c5d0b){_0x39a6aa[_0xd108('0x1c')](0x194);}return _0x5c5d0b;};}function handleError(_0x1da9e3,_0x238fb6){_0x238fb6=_0x238fb6||0x1f4;return function(_0x8a0a8f){logger[_0xd108('0x1d')](_0x8a0a8f[_0xd108('0x1e')]);if(_0x8a0a8f['name']){delete _0x8a0a8f['name'];}_0x1da9e3['status'](_0x238fb6)['send'](_0x8a0a8f);};}exports[_0xd108('0x1f')]=function(_0x3affc4,_0x25f940){var _0x32868c={};var _0x31c53d=_['map'](db['SmsInteraction']['rawAttributes'],function(_0x14ac48){return{'name':_0x14ac48['fieldName'],'type':_0x14ac48[_0xd108('0x20')][_0xd108('0x21')]};});_0x32868c=qs[_0xd108('0x22')](_0x31c53d,_0x3affc4);return interaction[_0xd108('0x23')](_0xd108('0x24'),_0x3affc4[_0xd108('0x25')],_0x3affc4[_0xd108('0x26')],_0x32868c,_0x31c53d)[_0xd108('0x1b')](respondWithFilteredResult(_0x25f940,_0x32868c))['catch'](handleError(_0x25f940,null));};exports[_0xd108('0x27')]=function(_0x555b13,_0x3cbedc){var _0x4efb98={'raw':![],'where':{'id':_0x555b13['params']['id']}},_0x3ad85a={};_0x3ad85a[_0xd108('0x28')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x3ad85a[_0xd108('0x25')]=_[_0xd108('0x29')](_0x555b13[_0xd108('0x25')]);_0x3ad85a[_0xd108('0x2a')]=_[_0xd108('0x2b')](_0x3ad85a[_0xd108('0x28')],_0x3ad85a['query']);_0x4efb98[_0xd108('0x2c')]=_[_0xd108('0x2b')](_0x3ad85a[_0xd108('0x28')],qs[_0xd108('0x2d')](_0x555b13[_0xd108('0x25')][_0xd108('0x2d')]));_0x4efb98[_0xd108('0x2c')]=_0x4efb98[_0xd108('0x2c')]['length']?_0x4efb98[_0xd108('0x2c')]:_0x3ad85a['model'];if(_0x555b13[_0xd108('0x25')][_0xd108('0x2e')]){_0x4efb98[_0xd108('0x2f')]=[{'all':!![]}];}_0x4efb98=_[_0xd108('0x30')]({},_0x4efb98,_0x555b13[_0xd108('0x31')]);return db['SmsInteraction'][_0xd108('0x32')](_0x4efb98)[_0xd108('0x1b')](handleEntityNotFound(_0x3cbedc,null))[_0xd108('0x1b')](respondWithResult(_0x3cbedc,null))[_0xd108('0x33')](handleError(_0x3cbedc,null));};exports[_0xd108('0x34')]=function(_0x150c68,_0x26106a){return db[_0xd108('0x35')]['create'](_0x150c68['body'],{})[_0xd108('0x1b')](respondWithResult(_0x26106a,0xc9))[_0xd108('0x33')](handleError(_0x26106a,null));};exports['update']=function(_0x4ae0a4,_0x3296d5){if(_0x4ae0a4[_0xd108('0x36')]['id']){delete _0x4ae0a4[_0xd108('0x36')]['id'];}return db['SmsInteraction'][_0xd108('0x32')]({'where':{'id':_0x4ae0a4[_0xd108('0x37')]['id']}})[_0xd108('0x1b')](handleEntityNotFound(_0x3296d5,null))[_0xd108('0x1b')](saveUpdates(_0x4ae0a4[_0xd108('0x36')],null))[_0xd108('0x1b')](respondWithResult(_0x3296d5,null))['catch'](handleError(_0x3296d5,null));};exports[_0xd108('0x38')]=function(_0x35d2ca,_0x5bf9a1){return db[_0xd108('0x35')][_0xd108('0x32')]({'where':{'id':_0x35d2ca['params']['id']}})['then'](handleEntityNotFound(_0x5bf9a1,null))[_0xd108('0x1b')](removeEntity(_0x5bf9a1,null))[_0xd108('0x33')](handleError(_0x5bf9a1,null));};exports[_0xd108('0x39')]=function(_0x3f88fd,_0x3ba730){return db[_0xd108('0x35')][_0xd108('0x39')]()['then'](respondWithResult(_0x3ba730,null))[_0xd108('0x33')](handleError(_0x3ba730,null));};exports[_0xd108('0x3a')]=function(_0x128887,_0x1db78a){return db[_0xd108('0x3b')][_0xd108('0x32')]({'where':{'id':_0x128887[_0xd108('0x37')]['id']}})['then'](handleEntityNotFound(_0x1db78a,null))['then'](function(_0x2f4d25){if(_0x2f4d25){return _0x2f4d25[_0xd108('0x3a')](_0x128887[_0xd108('0x36')][_0xd108('0x3c')],_['omit'](_0x128887[_0xd108('0x36')],[_0xd108('0x3c'),'id'])||{});}})[_0xd108('0x1b')](respondWithResult(_0x1db78a,null))['catch'](handleError(_0x1db78a,null));};exports['getMessages']=function(_0x2ef3e0,_0x4a96f1){var _0x4d5655={'raw':![],'where':{}};var _0x57549e={};var _0x262735={'count':0x0,'rows':[]};return db[_0xd108('0x35')][_0xd108('0x3d')]({'where':{'id':_0x2ef3e0[_0xd108('0x37')]['id']}})['then'](handleEntityNotFound(_0x4a96f1,null))['then'](function(_0x546430){if(_0x546430){_0x57549e[_0xd108('0x28')]=_[_0xd108('0x29')](db[_0xd108('0x3b')]['rawAttributes']);_0x57549e[_0xd108('0x25')]=_[_0xd108('0x29')](_0x2ef3e0[_0xd108('0x25')]);_0x57549e['filters']=_[_0xd108('0x2b')](_0x57549e[_0xd108('0x28')],_0x57549e['query']);_0x4d5655['attributes']=_['intersection'](_0x57549e[_0xd108('0x28')],qs[_0xd108('0x2d')](_0x2ef3e0[_0xd108('0x25')]['fields']));_0x4d5655['attributes']=_0x4d5655[_0xd108('0x2c')][_0xd108('0x3e')]?_0x4d5655[_0xd108('0x2c')]:_0x57549e[_0xd108('0x28')];if(!_0x2ef3e0[_0xd108('0x25')][_0xd108('0x3f')]('nolimit')){_0x4d5655[_0xd108('0x16')]=qs['limit'](_0x2ef3e0[_0xd108('0x25')][_0xd108('0x16')]);_0x4d5655[_0xd108('0x18')]=qs[_0xd108('0x18')](_0x2ef3e0['query'][_0xd108('0x18')]);}_0x4d5655[_0xd108('0x40')]=qs[_0xd108('0x41')](_0x2ef3e0[_0xd108('0x25')][_0xd108('0x41')]);_0x4d5655['where']=qs[_0xd108('0x2a')](_[_0xd108('0x42')](_0x2ef3e0[_0xd108('0x25')],_0x57549e[_0xd108('0x2a')]));_0x4d5655[_0xd108('0x43')][_0xd108('0x44')]=_0x546430['id'];if(_0x2ef3e0['query'][_0xd108('0x45')]){_0x4d5655[_0xd108('0x43')]=_[_0xd108('0x30')](_0x4d5655['where'],{'$or':_[_0xd108('0x46')](_0x4d5655[_0xd108('0x2c')],function(_0x4f013c){var _0x1ae795={};_0x1ae795[_0x4f013c]={'$like':'%'+_0x2ef3e0[_0xd108('0x25')]['filter']+'%'};return _0x1ae795;})});}if(_0x2ef3e0[_0xd108('0x25')][_0xd108('0x47')]){var _0x1d6018=_0x2ef3e0['query'][_0xd108('0x47')]['split'](',');var _0x5dc206={};_0x5dc206[_0x1d6018[0x0]]={'$gte':moment(_0x1d6018[0x1])[_0xd108('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4d5655[_0xd108('0x43')]=_[_0xd108('0x30')](_0x4d5655[_0xd108('0x43')],_0x5dc206);}_0x4d5655=_[_0xd108('0x30')]({},_0x4d5655,_0x2ef3e0['options']);return db[_0xd108('0x3b')][_0xd108('0x17')]({'where':_0x4d5655[_0xd108('0x43')]})[_0xd108('0x1b')](function(_0x1a2c7f){_0x262735['count']=_0x1a2c7f;if(_0x2ef3e0[_0xd108('0x25')][_0xd108('0x2e')]){_0x4d5655[_0xd108('0x2f')]=[{'all':!![]}];}return db[_0xd108('0x3b')][_0xd108('0x23')](_0x4d5655);})[_0xd108('0x1b')](function(_0x11c690){_0x262735[_0xd108('0x49')]=_0x11c690;return _0x262735;});}})[_0xd108('0x1b')](respondWithFilteredResult(_0x4a96f1,_0x4d5655))[_0xd108('0x33')](handleError(_0x4a96f1,null));};exports[_0xd108('0x4a')]=function(_0x228003,_0x2bacaf){return db[_0xd108('0x35')]['find']({'where':{'id':_0x228003[_0xd108('0x37')]['id']}})[_0xd108('0x1b')](handleEntityNotFound(_0x2bacaf,null))[_0xd108('0x1b')](function(_0x4a1b01){if(_0x4a1b01){return _0x4a1b01[_0xd108('0x4b')](_0x228003['body']['ids'],_['omit'](_0x228003[_0xd108('0x36')],[_0xd108('0x3c'),'id'])||{})[_0xd108('0x4c')](function(){return db[_0xd108('0x4d')][_0xd108('0x23')]({'attributes':['id',_0xd108('0x4e'),'color'],'where':{'id':_0x228003[_0xd108('0x36')][_0xd108('0x3c')]}});})[_0xd108('0x1b')](function(_0x550932){socket[_0xd108('0x4f')](_0xd108('0x50'),{'id':Number(_0x228003[_0xd108('0x37')]['id']),'tags':_0x550932||[]});return{'id':Number(_0x228003['params']['id']),'tags':_0x550932||[]};});}})[_0xd108('0x1b')](respondWithResult(_0x2bacaf,null))[_0xd108('0x33')](handleError(_0x2bacaf,null));};exports[_0xd108('0x51')]=function(_0x8d22ba,_0x5101d5){return db[_0xd108('0x35')][_0xd108('0x32')]({'where':{'id':_0x8d22ba['params']['id']}})[_0xd108('0x1b')](handleEntityNotFound(_0x5101d5,null))[_0xd108('0x1b')](function(_0x3627e9){if(_0x3627e9){return _0x3627e9[_0xd108('0x51')](_0x8d22ba[_0xd108('0x25')]['ids']);}})[_0xd108('0x1b')](respondWithStatusCode(_0x5101d5,null))[_0xd108('0x33')](handleError(_0x5101d5,null));};exports[_0xd108('0x52')]=function(_0x4e6415,_0x57914f){var _0x2ed16b=moment()[_0xd108('0x53')]()[_0xd108('0x54')]();var _0x4cb05e=path[_0xd108('0x55')](config[_0xd108('0x56')],_0xd108('0x57'),_0xd108('0x58'),_0xd108('0x59'));var _0x516ce9=path[_0xd108('0x55')](_0x4cb05e,_0x2ed16b);var _0x4fe09b=util[_0xd108('0x48')](_0xd108('0x5a'),_0x4e6415[_0xd108('0x37')]['id'],_0x2ed16b);var _0x1108a2=path[_0xd108('0x55')](_0x4cb05e,_0x4fe09b);var _0x923afa=[];_0x923afa[_0xd108('0x5b')]({'model':db[_0xd108('0x5c')],'as':_0xd108('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x923afa[_0xd108('0x5b')]({'model':db['CmContact'],'as':_0xd108('0x5d'),'attributes':['id','firstName',_0xd108('0x5e')],'raw':!![]});var _0xb46dec=[{'model':db[_0xd108('0x3b')],'as':'Messages','attributes':['id','body',_0xd108('0x5f'),_0xd108('0x60'),'secret',_0xd108('0x61')],'include':_0x923afa}];_0xb46dec[_0xd108('0x5b')]({'model':db[_0xd108('0x62')],'as':_0xd108('0x63'),'attributes':['id',_0xd108('0x4e')]});_0xb46dec[_0xd108('0x5b')]({'model':db['User'],'as':_0xd108('0x64'),'attributes':['id',_0xd108('0x65')]});return db[_0xd108('0x35')][_0xd108('0x32')]({'where':{'id':_0x4e6415['params']['id']},'include':_0xb46dec})[_0xd108('0x1b')](handleEntityNotFound(_0x57914f,null))[_0xd108('0x1b')](function(_0x400e41){if(_0x400e41){var _0x32de9a=_0x400e41[_0xd108('0x66')]({'plain':!![]});fs['mkdirSync'](_0x516ce9);var _0x21063f={'channel':_0xd108('0x67'),'account':_0x32de9a[_0xd108('0x63')][_0xd108('0x4e')],'agent':_0x32de9a[_0xd108('0x64')]?_0x32de9a[_0xd108('0x64')][_0xd108('0x65')]:'N.A.','createdAt':moment(_0x32de9a['createdAt'])[_0xd108('0x48')](_0xd108('0x68'))['toString'](),'closedAt':_0x32de9a[_0xd108('0x69')]?moment(_0x32de9a[_0xd108('0x6a')])[_0xd108('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd108('0x54')]():'','disposition':_0x32de9a[_0xd108('0x6b')],'messages':_(_0x32de9a[_0xd108('0x6c')])['filter']({'secret':![]})[_0xd108('0x46')](function(_0x40640a){return{'date':moment(_0x40640a[_0xd108('0x5f')])['format'](_0xd108('0x68'))[_0xd108('0x54')](),'sender':_0x40640a[_0xd108('0x60')]===_0xd108('0x6d')?_0x40640a[_0xd108('0x5c')]?_0x40640a['User'][_0xd108('0x65')]:'System':_0x40640a['Contact'][_0xd108('0x6e')]+(_0x40640a['Contact'][_0xd108('0x5e')]?'\x20'+_0x40640a['Contact'][_0xd108('0x5e')]:''),'body':_0x40640a[_0xd108('0x36')],'direction':_0x40640a[_0xd108('0x60')]===_0xd108('0x6d')?'A':'C','secret':_0x40640a[_0xd108('0x6f')],'read':_0x40640a[_0xd108('0x61')]};})['value']()};return ejs['renderFile'](path[_0xd108('0x55')](config[_0xd108('0x56')],_0xd108('0x57'),'views','downloadInteraction.ejs'),{'interaction':_0x21063f})['then'](function(_0x5c2ee0){var _0x36018d=path['join'](_0x516ce9,_0xd108('0x70')+_0x32de9a['id']+'-'+_0x2ed16b+'.pdf');var _0x4f6f32={'path':_0x36018d,'channel':_0xd108('0x67'),'interactionId':_0x32de9a['id']};return pdf[_0xd108('0x71')](_0x5c2ee0,_0x4f6f32);})[_0xd108('0x1b')](function(){return new BPromise(function(_0x54d21e,_0x3fd2db){zipdir(_0x516ce9,{'saveTo':_0x1108a2},function(_0x435191,_0x247071){if(_0x435191)return _0x3fd2db(_0x435191);return _0x54d21e(_0x247071);});})[_0xd108('0x1b')](function(){return new BPromise(function(_0x41ad25,_0x5cbf94){rimraf(_0x516ce9,function(_0x24efb0){if(_0x24efb0)_0x5cbf94(_0x24efb0);return _0x41ad25();});});})['then'](function(){return _0x57914f[_0xd108('0x52')](_0x1108a2,_0x4fe09b,function(_0x1272d4){if(_0x1272d4){console[_0xd108('0x72')](_0xd108('0x73'),_0x1272d4);}else{fs[_0xd108('0x74')](_0x1108a2);}});});});}else{return _0x57914f[_0xd108('0x1c')](0xc8);}})['catch'](handleError(_0x57914f,null));}; \ No newline at end of file +var _0x5ecf=['send','map','SmsInteraction','rawAttributes','type','key','query','user','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','find','create','body','describe','addMessage','SmsMessage','omit','ids','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','Tag','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','createdAt','direction','secret','SmsAccount','mkdirSync','Sms','Account','Owner','N.A.','closed','closedAt','disposition','Messages','out','System','read','value','renderFile','server','views','downloadInteraction.ejs','createPdfFromHTML','download','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','then','error','stack','name'];(function(_0x304048,_0x260711){var _0x430079=function(_0x552a51){while(--_0x552a51){_0x304048['push'](_0x304048['shift']());}};_0x430079(++_0x260711);}(_0x5ecf,0x1c3));var _0xf5ec=function(_0x7a572e,_0x2b7c6b){_0x7a572e=_0x7a572e-0x0;var _0x4398b2=_0x5ecf[_0x7a572e];return _0x4398b2;};'use strict';var rimraf=require(_0xf5ec('0x0'));var zipdir=require(_0xf5ec('0x1'));var moment=require(_0xf5ec('0x2'));var BPromise=require(_0xf5ec('0x3'));var util=require(_0xf5ec('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5ec('0x5'));var Redis=require(_0xf5ec('0x6'));var interaction=require(_0xf5ec('0x7'));var qs=require(_0xf5ec('0x8'));var pdf=require(_0xf5ec('0x9'));var logger=require('../../config/logger')(_0xf5ec('0xa'));var config=require(_0xf5ec('0xb'));var db=require(_0xf5ec('0xc'))['db'];config[_0xf5ec('0xd')]=_[_0xf5ec('0xe')](config[_0xf5ec('0xd')],{'host':_0xf5ec('0xf'),'port':0x18eb});var socket=require(_0xf5ec('0x10'))(new Redis(config[_0xf5ec('0xd')]));require(_0xf5ec('0x11'))[_0xf5ec('0x12')](socket);function respondWithStatusCode(_0x86970a,_0x2c2040){_0x2c2040=_0x2c2040||0xcc;return function(_0xea4f59){if(_0xea4f59){return _0x86970a[_0xf5ec('0x13')](_0x2c2040);}return _0x86970a[_0xf5ec('0x14')](_0x2c2040)['end']();};}function respondWithResult(_0x171ff8,_0x583fd2){_0x583fd2=_0x583fd2||0xc8;return function(_0x2ec877){if(_0x2ec877){return _0x171ff8[_0xf5ec('0x14')](_0x583fd2)[_0xf5ec('0x15')](_0x2ec877);}};}function respondWithFilteredResult(_0x4e8c0d,_0x31420f){return function(_0x52f22a){if(_0x52f22a){var _0x2a0ea1=typeof _0x31420f[_0xf5ec('0x16')]===_0xf5ec('0x17')&&typeof _0x31420f[_0xf5ec('0x18')]===_0xf5ec('0x17');var _0x170e10=_0x52f22a[_0xf5ec('0x19')];var _0x3038af=_0x2a0ea1?0x0:_0x31420f[_0xf5ec('0x16')];var _0xb41302=_0x2a0ea1?_0x52f22a[_0xf5ec('0x19')]:_0x31420f['offset']+_0x31420f[_0xf5ec('0x18')];var _0x249955;if(_0xb41302>=_0x170e10){_0xb41302=_0x170e10;_0x249955=0xc8;}else{_0x249955=0xce;}_0x4e8c0d[_0xf5ec('0x14')](_0x249955);return _0x4e8c0d[_0xf5ec('0x1a')]('Content-Range',_0x3038af+'-'+_0xb41302+'/'+_0x170e10)[_0xf5ec('0x15')](_0x52f22a);}return null;};}function saveUpdates(_0x3f9fb9){return function(_0xb04df6){if(_0xb04df6){return _0xb04df6[_0xf5ec('0x1b')](_0x3f9fb9)['then'](function(_0x342c82){return _0x342c82;});}return null;};}function removeEntity(_0x5c2d53){return function(_0x1df909){if(_0x1df909){return _0x1df909[_0xf5ec('0x1c')]()[_0xf5ec('0x1d')](function(){_0x5c2d53[_0xf5ec('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x332f93){return function(_0x16a8aa){if(!_0x16a8aa){_0x332f93[_0xf5ec('0x13')](0x194);}return _0x16a8aa;};}function handleError(_0x4964df,_0x12a45e){_0x12a45e=_0x12a45e||0x1f4;return function(_0x19026e){logger[_0xf5ec('0x1e')](_0x19026e[_0xf5ec('0x1f')]);if(_0x19026e[_0xf5ec('0x20')]){delete _0x19026e['name'];}_0x4964df[_0xf5ec('0x14')](_0x12a45e)[_0xf5ec('0x21')](_0x19026e);};}exports['index']=function(_0x19b1fe,_0x18a35b){var _0x54e528={};var _0x1cd244=_[_0xf5ec('0x22')](db[_0xf5ec('0x23')][_0xf5ec('0x24')],function(_0x33b785){return{'name':_0x33b785['fieldName'],'type':_0x33b785[_0xf5ec('0x25')][_0xf5ec('0x26')]};});_0x54e528=qs['getOptions'](_0x1cd244,_0x19b1fe);return interaction['findAll']('sms',_0x19b1fe[_0xf5ec('0x27')],_0x19b1fe[_0xf5ec('0x28')],_0x54e528,_0x1cd244)[_0xf5ec('0x1d')](respondWithFilteredResult(_0x18a35b,_0x54e528))[_0xf5ec('0x29')](handleError(_0x18a35b,null));};exports[_0xf5ec('0x2a')]=function(_0x322370,_0x386585){var _0x46d6af={'raw':![],'where':{'id':_0x322370[_0xf5ec('0x2b')]['id']}},_0x15b1c2={};_0x15b1c2['model']=_[_0xf5ec('0x2c')](db['SmsInteraction']['rawAttributes']);_0x15b1c2[_0xf5ec('0x27')]=_['keys'](_0x322370['query']);_0x15b1c2[_0xf5ec('0x2d')]=_[_0xf5ec('0x2e')](_0x15b1c2[_0xf5ec('0x2f')],_0x15b1c2['query']);_0x46d6af[_0xf5ec('0x30')]=_[_0xf5ec('0x2e')](_0x15b1c2[_0xf5ec('0x2f')],qs[_0xf5ec('0x31')](_0x322370[_0xf5ec('0x27')][_0xf5ec('0x31')]));_0x46d6af[_0xf5ec('0x30')]=_0x46d6af['attributes'][_0xf5ec('0x32')]?_0x46d6af[_0xf5ec('0x30')]:_0x15b1c2[_0xf5ec('0x2f')];if(_0x322370[_0xf5ec('0x27')][_0xf5ec('0x33')]){_0x46d6af[_0xf5ec('0x34')]=[{'all':!![]}];}_0x46d6af=_[_0xf5ec('0x35')]({},_0x46d6af,_0x322370['options']);return db['SmsInteraction'][_0xf5ec('0x36')](_0x46d6af)[_0xf5ec('0x1d')](handleEntityNotFound(_0x386585,null))[_0xf5ec('0x1d')](respondWithResult(_0x386585,null))[_0xf5ec('0x29')](handleError(_0x386585,null));};exports[_0xf5ec('0x37')]=function(_0x17bfe1,_0x5ec680){return db['SmsInteraction']['create'](_0x17bfe1[_0xf5ec('0x38')],{})[_0xf5ec('0x1d')](respondWithResult(_0x5ec680,0xc9))[_0xf5ec('0x29')](handleError(_0x5ec680,null));};exports[_0xf5ec('0x1b')]=function(_0x3efd46,_0x1e709c){if(_0x3efd46[_0xf5ec('0x38')]['id']){delete _0x3efd46[_0xf5ec('0x38')]['id'];}return db['SmsInteraction'][_0xf5ec('0x36')]({'where':{'id':_0x3efd46[_0xf5ec('0x2b')]['id']}})[_0xf5ec('0x1d')](handleEntityNotFound(_0x1e709c,null))[_0xf5ec('0x1d')](saveUpdates(_0x3efd46[_0xf5ec('0x38')],null))[_0xf5ec('0x1d')](respondWithResult(_0x1e709c,null))[_0xf5ec('0x29')](handleError(_0x1e709c,null));};exports['destroy']=function(_0x230042,_0x739364){return db[_0xf5ec('0x23')]['find']({'where':{'id':_0x230042[_0xf5ec('0x2b')]['id']}})[_0xf5ec('0x1d')](handleEntityNotFound(_0x739364,null))[_0xf5ec('0x1d')](removeEntity(_0x739364,null))[_0xf5ec('0x29')](handleError(_0x739364,null));};exports[_0xf5ec('0x39')]=function(_0x3ac89b,_0x1a7d0a){return db[_0xf5ec('0x23')][_0xf5ec('0x39')]()[_0xf5ec('0x1d')](respondWithResult(_0x1a7d0a,null))['catch'](handleError(_0x1a7d0a,null));};exports[_0xf5ec('0x3a')]=function(_0x198d92,_0x45fd36){return db[_0xf5ec('0x3b')][_0xf5ec('0x36')]({'where':{'id':_0x198d92[_0xf5ec('0x2b')]['id']}})['then'](handleEntityNotFound(_0x45fd36,null))[_0xf5ec('0x1d')](function(_0x22c0f0){if(_0x22c0f0){return _0x22c0f0[_0xf5ec('0x3a')](_0x198d92['body']['ids'],_[_0xf5ec('0x3c')](_0x198d92[_0xf5ec('0x38')],[_0xf5ec('0x3d'),'id'])||{});}})[_0xf5ec('0x1d')](respondWithResult(_0x45fd36,null))['catch'](handleError(_0x45fd36,null));};exports['getMessages']=function(_0x4cdc9a,_0xdb7e0){var _0x3847ab={'raw':![],'where':{}};var _0xc7b35d={};var _0x104f84={'count':0x0,'rows':[]};return db[_0xf5ec('0x23')][_0xf5ec('0x3e')]({'where':{'id':_0x4cdc9a[_0xf5ec('0x2b')]['id']}})['then'](handleEntityNotFound(_0xdb7e0,null))[_0xf5ec('0x1d')](function(_0x4879a4){if(_0x4879a4){_0xc7b35d[_0xf5ec('0x2f')]=_[_0xf5ec('0x2c')](db['SmsMessage'][_0xf5ec('0x24')]);_0xc7b35d[_0xf5ec('0x27')]=_[_0xf5ec('0x2c')](_0x4cdc9a['query']);_0xc7b35d['filters']=_[_0xf5ec('0x2e')](_0xc7b35d['model'],_0xc7b35d[_0xf5ec('0x27')]);_0x3847ab[_0xf5ec('0x30')]=_['intersection'](_0xc7b35d['model'],qs[_0xf5ec('0x31')](_0x4cdc9a[_0xf5ec('0x27')]['fields']));_0x3847ab[_0xf5ec('0x30')]=_0x3847ab[_0xf5ec('0x30')]['length']?_0x3847ab[_0xf5ec('0x30')]:_0xc7b35d[_0xf5ec('0x2f')];if(!_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x3f')](_0xf5ec('0x40'))){_0x3847ab['limit']=qs[_0xf5ec('0x18')](_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x18')]);_0x3847ab[_0xf5ec('0x16')]=qs[_0xf5ec('0x16')](_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x16')]);}_0x3847ab[_0xf5ec('0x41')]=qs[_0xf5ec('0x42')](_0x4cdc9a['query'][_0xf5ec('0x42')]);_0x3847ab[_0xf5ec('0x43')]=qs[_0xf5ec('0x2d')](_[_0xf5ec('0x44')](_0x4cdc9a[_0xf5ec('0x27')],_0xc7b35d[_0xf5ec('0x2d')]));_0x3847ab[_0xf5ec('0x43')][_0xf5ec('0x45')]=_0x4879a4['id'];if(_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x46')]){_0x3847ab[_0xf5ec('0x43')]=_[_0xf5ec('0x35')](_0x3847ab[_0xf5ec('0x43')],{'$or':_['map'](_0x3847ab['attributes'],function(_0x12f377){var _0x137bfd={};_0x137bfd[_0x12f377]={'$like':'%'+_0x4cdc9a['query'][_0xf5ec('0x46')]+'%'};return _0x137bfd;})});}if(_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x47')]){var _0x3e06d4=_0x4cdc9a[_0xf5ec('0x27')]['$gte']['split'](',');var _0x5e87c8={};_0x5e87c8[_0x3e06d4[0x0]]={'$gte':moment(_0x3e06d4[0x1])[_0xf5ec('0x48')](_0xf5ec('0x49'))};_0x3847ab[_0xf5ec('0x43')]=_[_0xf5ec('0x35')](_0x3847ab[_0xf5ec('0x43')],_0x5e87c8);}_0x3847ab=_[_0xf5ec('0x35')]({},_0x3847ab,_0x4cdc9a[_0xf5ec('0x4a')]);return db[_0xf5ec('0x3b')][_0xf5ec('0x19')]({'where':_0x3847ab[_0xf5ec('0x43')]})[_0xf5ec('0x1d')](function(_0x3b2440){_0x104f84[_0xf5ec('0x19')]=_0x3b2440;if(_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x33')]){_0x3847ab[_0xf5ec('0x34')]=[{'all':!![]}];}return db['SmsMessage'][_0xf5ec('0x4b')](_0x3847ab);})['then'](function(_0x3050fe){_0x104f84['rows']=_0x3050fe;return _0x104f84;});}})[_0xf5ec('0x1d')](respondWithFilteredResult(_0xdb7e0,_0x3847ab))[_0xf5ec('0x29')](handleError(_0xdb7e0,null));};exports[_0xf5ec('0x4c')]=function(_0x43cb4d,_0x4172d9){return db[_0xf5ec('0x23')][_0xf5ec('0x36')]({'where':{'id':_0x43cb4d[_0xf5ec('0x2b')]['id']}})[_0xf5ec('0x1d')](handleEntityNotFound(_0x4172d9,null))['then'](function(_0x582de3){if(_0x582de3){return _0x582de3[_0xf5ec('0x4d')](_0x43cb4d[_0xf5ec('0x38')][_0xf5ec('0x3d')],_[_0xf5ec('0x3c')](_0x43cb4d['body'],['ids','id'])||{})['spread'](function(){return db[_0xf5ec('0x4e')][_0xf5ec('0x4b')]({'attributes':['id',_0xf5ec('0x20'),_0xf5ec('0x4f')],'where':{'id':_0x43cb4d[_0xf5ec('0x38')][_0xf5ec('0x3d')]}});})[_0xf5ec('0x1d')](function(_0x527fc3){socket[_0xf5ec('0x50')](_0xf5ec('0x51'),{'id':Number(_0x43cb4d[_0xf5ec('0x2b')]['id']),'tags':_0x527fc3||[]});return{'id':Number(_0x43cb4d[_0xf5ec('0x2b')]['id']),'tags':_0x527fc3||[]};});}})['then'](respondWithResult(_0x4172d9,null))['catch'](handleError(_0x4172d9,null));};exports[_0xf5ec('0x52')]=function(_0x3242ea,_0x5e548b){return db['SmsInteraction'][_0xf5ec('0x36')]({'where':{'id':_0x3242ea['params']['id']}})['then'](handleEntityNotFound(_0x5e548b,null))[_0xf5ec('0x1d')](function(_0x41ec43){if(_0x41ec43){return _0x41ec43[_0xf5ec('0x52')](_0x3242ea['query'][_0xf5ec('0x3d')]);}})['then'](respondWithStatusCode(_0x5e548b,null))[_0xf5ec('0x29')](handleError(_0x5e548b,null));};exports['download']=function(_0x36fb79,_0x33ebbc){var _0x1429c1=moment()[_0xf5ec('0x53')]()[_0xf5ec('0x54')]();var _0x28dbb6=path[_0xf5ec('0x55')](config['root'],'server',_0xf5ec('0x56'),_0xf5ec('0x57'));var _0x83321d=path[_0xf5ec('0x55')](_0x28dbb6,_0x1429c1);var _0x7b1e00=util['format'](_0xf5ec('0x58'),_0x36fb79[_0xf5ec('0x2b')]['id'],_0x1429c1);var _0x4d02c5=path[_0xf5ec('0x55')](_0x28dbb6,_0x7b1e00);var _0x55133d=[];_0x55133d[_0xf5ec('0x59')]({'model':db[_0xf5ec('0x5a')],'as':'User','attributes':['id',_0xf5ec('0x5b')],'raw':!![]});_0x55133d[_0xf5ec('0x59')]({'model':db[_0xf5ec('0x5c')],'as':_0xf5ec('0x5d'),'attributes':['id',_0xf5ec('0x5e'),_0xf5ec('0x5f')],'raw':!![]});var _0x2f6514=[{'model':db[_0xf5ec('0x3b')],'as':'Messages','attributes':['id',_0xf5ec('0x38'),_0xf5ec('0x60'),_0xf5ec('0x61'),_0xf5ec('0x62'),'read'],'include':_0x55133d}];_0x2f6514['push']({'model':db[_0xf5ec('0x63')],'as':'Account','attributes':['id','name']});_0x2f6514[_0xf5ec('0x59')]({'model':db[_0xf5ec('0x5a')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xf5ec('0x36')]({'where':{'id':_0x36fb79[_0xf5ec('0x2b')]['id']},'include':_0x2f6514})[_0xf5ec('0x1d')](handleEntityNotFound(_0x33ebbc,null))[_0xf5ec('0x1d')](function(_0x33d70d){if(_0x33d70d){var _0x1053eb=_0x33d70d['get']({'plain':!![]});fs[_0xf5ec('0x64')](_0x83321d);var _0x53bce0={'channel':_0xf5ec('0x65'),'account':_0x1053eb[_0xf5ec('0x66')][_0xf5ec('0x20')],'agent':_0x1053eb[_0xf5ec('0x67')]?_0x1053eb[_0xf5ec('0x67')][_0xf5ec('0x5b')]:_0xf5ec('0x68'),'createdAt':moment(_0x1053eb[_0xf5ec('0x60')])[_0xf5ec('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf5ec('0x54')](),'closedAt':_0x1053eb[_0xf5ec('0x69')]?moment(_0x1053eb[_0xf5ec('0x6a')])['format'](_0xf5ec('0x49'))[_0xf5ec('0x54')]():'','disposition':_0x1053eb[_0xf5ec('0x6b')],'messages':_(_0x1053eb[_0xf5ec('0x6c')])['filter']({'secret':![]})[_0xf5ec('0x22')](function(_0x9d4f02){return{'date':moment(_0x9d4f02[_0xf5ec('0x60')])['format'](_0xf5ec('0x49'))[_0xf5ec('0x54')](),'sender':_0x9d4f02[_0xf5ec('0x61')]===_0xf5ec('0x6d')?_0x9d4f02[_0xf5ec('0x5a')]?_0x9d4f02['User'][_0xf5ec('0x5b')]:_0xf5ec('0x6e'):_0x9d4f02['Contact'][_0xf5ec('0x5e')]+(_0x9d4f02['Contact'][_0xf5ec('0x5f')]?'\x20'+_0x9d4f02[_0xf5ec('0x5d')][_0xf5ec('0x5f')]:''),'body':_0x9d4f02[_0xf5ec('0x38')],'direction':_0x9d4f02[_0xf5ec('0x61')]===_0xf5ec('0x6d')?'A':'C','secret':_0x9d4f02['secret'],'read':_0x9d4f02[_0xf5ec('0x6f')]};})[_0xf5ec('0x70')]()};return ejs[_0xf5ec('0x71')](path[_0xf5ec('0x55')](config['root'],_0xf5ec('0x72'),_0xf5ec('0x73'),_0xf5ec('0x74')),{'interaction':_0x53bce0})[_0xf5ec('0x1d')](function(_0x1313dc){var _0x4c7655=path[_0xf5ec('0x55')](_0x83321d,'transcript-'+_0x1053eb['id']+'-'+_0x1429c1+'.pdf');var _0x302fa1={'path':_0x4c7655,'channel':'Sms','interactionId':_0x1053eb['id']};return pdf[_0xf5ec('0x75')](_0x1313dc,_0x302fa1);})[_0xf5ec('0x1d')](function(){return new BPromise(function(_0x5481bd,_0xbdb3da){zipdir(_0x83321d,{'saveTo':_0x4d02c5},function(_0x238073,_0x4b50dd){if(_0x238073)return _0xbdb3da(_0x238073);return _0x5481bd(_0x4b50dd);});})[_0xf5ec('0x1d')](function(){return new BPromise(function(_0x331f38,_0x3d414f){rimraf(_0x83321d,function(_0x3f2e13){if(_0x3f2e13)_0x3d414f(_0x3f2e13);return _0x331f38();});});})[_0xf5ec('0x1d')](function(){return _0x33ebbc[_0xf5ec('0x76')](_0x4d02c5,_0x7b1e00,function(_0x33b1be){if(_0x33b1be){console[_0xf5ec('0x77')]('err',_0x33b1be);}else{fs[_0xf5ec('0x78')](_0x4d02c5);}});});});}else{return _0x33ebbc[_0xf5ec('0x13')](0xc8);}})[_0xf5ec('0x29')](handleError(_0x33ebbc,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 032288b..fecb81a 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 _0x47c5=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0x58f245,_0x3e4f31){var _0x1f0cfb=function(_0x515942){while(--_0x515942){_0x58f245['push'](_0x58f245['shift']());}};_0x1f0cfb(++_0x3e4f31);}(_0x47c5,0x165));var _0x547c=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x47c5[_0x296897];return _0x2b44ab;};'use strict';var EventEmitter=require(_0x547c('0x0'));var SmsInteraction=require(_0x547c('0x1'))['db'][_0x547c('0x2')];var SmsMessage=require(_0x547c('0x1'))['db'][_0x547c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x547c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x547c('0x5'),'afterDestroy':_0x547c('0x6')};function emitEvent(_0x5b48c9){return function(_0x3e827e,_0x468220,_0x51ab7f){_0x3e827e[_0x547c('0x7')]({'attributes':['id'],'raw':!![]})[_0x547c('0x8')](function(_0x381f2e){_0x3e827e[_0x547c('0x9')](_0x547c('0xa'),_0x381f2e[_0x547c('0xb')](function(_0x3e2279){return{'id':_0x3e2279['id']};}));return SmsMessage[_0x547c('0xc')]({'where':{'SmsInteractionId':_0x3e827e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x547c('0x8')](function(_0x44a581){_0x3e827e[_0x547c('0x9')](_0x547c('0xd'),_0x44a581[_0x547c('0xe')]);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9+':'+_0x3e827e['id'],_0x3e827e);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9,_0x3e827e);_0x51ab7f(null);})[_0x547c('0x10')](_0x51ab7f(null));};}for(var e in events){if(events[_0x547c('0x11')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x547c('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x14a0=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','setDataValue','Users','findAll','length','emit','catch'];(function(_0x3b47d2,_0x4637a6){var _0x54c5be=function(_0x5de877){while(--_0x5de877){_0x3b47d2['push'](_0x3b47d2['shift']());}};_0x54c5be(++_0x4637a6);}(_0x14a0,0x8e));var _0x014a=function(_0x28cddc,_0x1be16d){_0x28cddc=_0x28cddc-0x0;var _0x5ce855=_0x14a0[_0x28cddc];return _0x5ce855;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x014a('0x0'))['db'][_0x014a('0x1')];var SmsMessage=require(_0x014a('0x0'))['db'][_0x014a('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x014a('0x3')](0x0);var events={'afterCreate':_0x014a('0x4'),'afterUpdate':_0x014a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57a522){return function(_0x1730a5,_0x12e8da,_0x38a22c){_0x1730a5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x11b8ce){_0x1730a5[_0x014a('0x6')](_0x014a('0x7'),_0x11b8ce['map'](function(_0x5d3d7f){return{'id':_0x5d3d7f['id']};}));return SmsMessage[_0x014a('0x8')]({'where':{'SmsInteractionId':_0x1730a5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x490ea2){_0x1730a5['setDataValue']('unreadMessages',_0x490ea2[_0x014a('0x9')]);SmsInteractionEvents['emit'](_0x57a522+':'+_0x1730a5['id'],_0x1730a5);SmsInteractionEvents[_0x014a('0xa')](_0x57a522,_0x1730a5);_0x38a22c(null);})[_0x014a('0xb')](_0x38a22c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x014a('0xc')](e,emitEvent(event));}}module[_0x014a('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 27a1413..55def42 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 _0xa79d=['SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0xa79d,0x6f));var _0xda79=function(_0x5d9b68,_0x426f17){_0x5d9b68=_0x5d9b68-0x0;var _0x5561=_0xa79d[_0x5d9b68];return _0x5561;};'use strict';var _=require(_0xda79('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xda79('0x1'));var moment=require('moment');var BPromise=require(_0xda79('0x2'));var rp=require(_0xda79('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda79('0x4'));var config=require(_0xda79('0x5'));var attributes=require(_0xda79('0x6'));module[_0xda79('0x7')]=function(_0x162b5c,_0x2fb167){return _0x162b5c[_0xda79('0x8')](_0xda79('0x9'),attributes,{'tableName':_0xda79('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3cfb9f,_0x5409b5,_0x28673d){if(_0x3cfb9f[_0xda79('0xb')](_0xda79('0xc'))){_0x3cfb9f[_0xda79('0xd')]=moment()['format'](_0xda79('0xe'));}_0x28673d(null,_0x3cfb9f);}}});}; \ No newline at end of file +var _0x0357=['rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x0357,0xbe));var _0x7035=function(_0x42658f,_0x16c9af){_0x42658f=_0x42658f-0x0;var _0x2ba697=_0x0357[_0x42658f];return _0x2ba697;};'use strict';var _=require(_0x7035('0x0'));var util=require(_0x7035('0x1'));var logger=require(_0x7035('0x2'))(_0x7035('0x3'));var moment=require(_0x7035('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7035('0x5'));var rimraf=require(_0x7035('0x6'));var config=require('../../config/environment');var attributes=require(_0x7035('0x7'));module[_0x7035('0x8')]=function(_0x16fa61,_0x4f22b1){return _0x16fa61['define'](_0x7035('0x9'),attributes,{'tableName':_0x7035('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x522690,_0x173746,_0x5f34da){if(_0x522690[_0x7035('0xb')]('closed')){_0x522690[_0x7035('0xc')]=moment()['format'](_0x7035('0xd'));}_0x5f34da(null,_0x522690);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 4c5a05f..f589672 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 _0xafb6=['defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','options','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','where','body','omit','ids','spread','AddTags','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x123297,_0x38edbe){var _0x3a3dcd=function(_0x420f61){while(--_0x420f61){_0x123297['push'](_0x123297['shift']());}};_0x3a3dcd(++_0x38edbe);}(_0xafb6,0x9a));var _0x6afb=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0xafb6[_0x5ad220];return _0xdec77d;};'use strict';var _=require('lodash');var util=require(_0x6afb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6afb('0x1'));var fs=require('fs');var Redis=require(_0x6afb('0x2'));var db=require(_0x6afb('0x3'))['db'];var utils=require(_0x6afb('0x4'));var logger=require('../../config/logger')(_0x6afb('0x5'));var config=require(_0x6afb('0x6'));var jayson=require(_0x6afb('0x7'));var client=jayson[_0x6afb('0x8')]['http']({'port':0x232a});config[_0x6afb('0x9')]=_[_0x6afb('0xa')](config[_0x6afb('0x9')],{'host':_0x6afb('0xb'),'port':0x18eb});var socket=require(_0x6afb('0xc'))(new Redis(config[_0x6afb('0x9')]));require(_0x6afb('0xd'))[_0x6afb('0xe')](socket);function respondWithRpcPromise(_0x29f2e3,_0x370b22,_0x410389){return new BPromise(function(_0x3619b7,_0x4ed0f7){return client[_0x6afb('0xf')](_0x29f2e3,_0x410389)['then'](function(_0x361532){logger[_0x6afb('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x370b22,_0x6afb('0x11'));logger[_0x6afb('0x12')](_0x6afb('0x13'),_0x370b22,'request\x20sent',JSON[_0x6afb('0x14')](_0x361532));if(_0x361532['error']){if(_0x361532[_0x6afb('0x15')][_0x6afb('0x16')]===0x1f4){logger[_0x6afb('0x15')](_0x6afb('0x17'),_0x370b22,_0x361532[_0x6afb('0x15')]['message']);return _0x4ed0f7(_0x361532[_0x6afb('0x15')]['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x370b22,_0x361532[_0x6afb('0x15')][_0x6afb('0x18')]);return _0x3619b7(_0x361532[_0x6afb('0x15')]['message']);}else{logger[_0x6afb('0x10')](_0x6afb('0x17'),_0x370b22,_0x6afb('0x11'));_0x3619b7(_0x361532[_0x6afb('0x19')][_0x6afb('0x18')]);}})[_0x6afb('0x1a')](function(_0x79dd28){logger[_0x6afb('0x15')](_0x6afb('0x17'),_0x370b22,_0x79dd28);_0x4ed0f7(_0x79dd28);});});}exports['UpdateSmsInteraction']=function(_0x262faf){var _0x45068a=this;return new Promise(function(_0x3bc2ca,_0x2df80b){return db[_0x6afb('0x1b')][_0x6afb('0x1c')](_0x262faf['body'],{'raw':_0x262faf['options']?_0x262faf[_0x6afb('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x262faf['options']?_0x262faf[_0x6afb('0x1d')]['where']||null:null,'attributes':_0x262faf[_0x6afb('0x1d')]?_0x262faf[_0x6afb('0x1d')][_0x6afb('0x1e')]||null:null,'limit':_0x262faf[_0x6afb('0x1d')]?_0x262faf[_0x6afb('0x1d')][_0x6afb('0x1f')]||null:null})[_0x6afb('0x20')](function(_0xcdb0a){logger[_0x6afb('0x10')](_0x6afb('0x21'),_0x262faf);logger['debug'](_0x6afb('0x21'),_0x262faf,JSON[_0x6afb('0x14')](_0xcdb0a));_0x3bc2ca(_0xcdb0a);})[_0x6afb('0x1a')](function(_0x2762a8){logger[_0x6afb('0x15')]('UpdateSmsInteraction',_0x2762a8[_0x6afb('0x18')],_0x262faf);_0x2df80b(_0x45068a[_0x6afb('0x15')](0x1f4,_0x2762a8[_0x6afb('0x18')]));});});};exports[_0x6afb('0x22')]=function(_0x326732){return new Promise(function(_0x2a7551,_0x3b46fb){return db[_0x6afb('0x1b')]['find']({'where':_0x326732[_0x6afb('0x1d')]?_0x326732['options'][_0x6afb('0x23')]||null:null})[_0x6afb('0x20')](function(_0x13a51d){if(_0x13a51d){return _0x13a51d['addTags'](_0x326732[_0x6afb('0x24')]['ids'],_[_0x6afb('0x25')](_0x326732[_0x6afb('0x24')],[_0x6afb('0x26'),'id'])||{});}})[_0x6afb('0x27')](function(_0x54a1bd){logger[_0x6afb('0x10')](_0x6afb('0x28'),_0x326732);logger[_0x6afb('0x12')](_0x6afb('0x28'),_0x326732,JSON[_0x6afb('0x14')](_0x54a1bd));_0x2a7551(_0x54a1bd);})[_0x6afb('0x1a')](function(_0x376fd8){logger['error'](_0x6afb('0x28'),_0x376fd8['message'],_0x326732);_0x3b46fb(_this['error'](0x1f4,_0x376fd8[_0x6afb('0x18')]));});});}; \ No newline at end of file +var _0xc5b6=['SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','attributes','limit','debug','AddTagsToSmsInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info'];(function(_0x44e201,_0x2477f9){var _0xb720a9=function(_0x52c73f){while(--_0x52c73f){_0x44e201['push'](_0x44e201['shift']());}};_0xb720a9(++_0x2477f9);}(_0xc5b6,0xe8));var _0x6c5b=function(_0x11df96,_0x16c6bb){_0x11df96=_0x11df96-0x0;var _0x37b491=_0xc5b6[_0x11df96];return _0x37b491;};'use strict';var _=require(_0x6c5b('0x0'));var util=require(_0x6c5b('0x1'));var moment=require(_0x6c5b('0x2'));var BPromise=require(_0x6c5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c5b('0x5'));var logger=require(_0x6c5b('0x6'))('rpc');var config=require(_0x6c5b('0x7'));var jayson=require(_0x6c5b('0x8'));var client=jayson[_0x6c5b('0x9')][_0x6c5b('0xa')]({'port':0x232a});config[_0x6c5b('0xb')]=_[_0x6c5b('0xc')](config[_0x6c5b('0xb')],{'host':_0x6c5b('0xd'),'port':0x18eb});var socket=require(_0x6c5b('0xe'))(new Redis(config[_0x6c5b('0xb')]));require(_0x6c5b('0xf'))[_0x6c5b('0x10')](socket);function respondWithRpcPromise(_0xf941d3,_0x304a52,_0x1d08aa){return new BPromise(function(_0x43c589,_0x4122a8){return client[_0x6c5b('0x11')](_0xf941d3,_0x1d08aa)[_0x6c5b('0x12')](function(_0x464aac){logger[_0x6c5b('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x304a52,'request\x20sent');logger['debug'](_0x6c5b('0x14'),_0x304a52,_0x6c5b('0x15'),JSON[_0x6c5b('0x16')](_0x464aac));if(_0x464aac[_0x6c5b('0x17')]){if(_0x464aac[_0x6c5b('0x17')][_0x6c5b('0x18')]===0x1f4){logger[_0x6c5b('0x17')](_0x6c5b('0x19'),_0x304a52,_0x464aac[_0x6c5b('0x17')][_0x6c5b('0x1a')]);return _0x4122a8(_0x464aac['error'][_0x6c5b('0x1a')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x304a52,_0x464aac[_0x6c5b('0x17')][_0x6c5b('0x1a')]);return _0x43c589(_0x464aac[_0x6c5b('0x17')]['message']);}else{logger['info'](_0x6c5b('0x19'),_0x304a52,'request\x20sent');_0x43c589(_0x464aac[_0x6c5b('0x1b')][_0x6c5b('0x1a')]);}})[_0x6c5b('0x1c')](function(_0x1d9e8d){logger[_0x6c5b('0x17')](_0x6c5b('0x19'),_0x304a52,_0x1d9e8d);_0x4122a8(_0x1d9e8d);});});}exports[_0x6c5b('0x1d')]=function(_0x5119e9){var _0x5ca2bf=this;return new Promise(function(_0x2ada59,_0x10ce4e){return db[_0x6c5b('0x1e')][_0x6c5b('0x1f')](_0x5119e9[_0x6c5b('0x20')],{'raw':_0x5119e9[_0x6c5b('0x21')]?_0x5119e9[_0x6c5b('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5119e9['options']?_0x5119e9[_0x6c5b('0x21')]['where']||null:null,'attributes':_0x5119e9['options']?_0x5119e9[_0x6c5b('0x21')][_0x6c5b('0x22')]||null:null,'limit':_0x5119e9[_0x6c5b('0x21')]?_0x5119e9[_0x6c5b('0x21')][_0x6c5b('0x23')]||null:null})[_0x6c5b('0x12')](function(_0x5804f8){logger[_0x6c5b('0x13')](_0x6c5b('0x1d'),_0x5119e9);logger[_0x6c5b('0x24')](_0x6c5b('0x1d'),_0x5119e9,JSON[_0x6c5b('0x16')](_0x5804f8));_0x2ada59(_0x5804f8);})[_0x6c5b('0x1c')](function(_0x2253ad){logger[_0x6c5b('0x17')](_0x6c5b('0x1d'),_0x2253ad['message'],_0x5119e9);_0x10ce4e(_0x5ca2bf[_0x6c5b('0x17')](0x1f4,_0x2253ad[_0x6c5b('0x1a')]));});});};exports[_0x6c5b('0x25')]=function(_0x206d04){return new Promise(function(_0x59bebc,_0x1c2453){return db[_0x6c5b('0x1e')]['find']({'where':_0x206d04['options']?_0x206d04['options']['where']||null:null})['then'](function(_0x13d627){if(_0x13d627){return _0x13d627[_0x6c5b('0x26')](_0x206d04[_0x6c5b('0x20')][_0x6c5b('0x27')],_[_0x6c5b('0x28')](_0x206d04[_0x6c5b('0x20')],['ids','id'])||{});}})['spread'](function(_0x568699){logger['info'](_0x6c5b('0x29'),_0x206d04);logger['debug'](_0x6c5b('0x29'),_0x206d04,JSON[_0x6c5b('0x16')](_0x568699));_0x59bebc(_0x568699);})[_0x6c5b('0x1c')](function(_0x21bd5b){logger[_0x6c5b('0x17')]('AddTags',_0x21bd5b[_0x6c5b('0x1a')],_0x206d04);_0x1c2453(_this[_0x6c5b('0x17')](0x1f4,_0x21bd5b[_0x6c5b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 3f6b654..f197eb7 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 _0xfd46=['save','remove','update','emit','register','length','./smsInteraction.events'];(function(_0x40eec9,_0x817a67){var _0xfee890=function(_0x186640){while(--_0x186640){_0x40eec9['push'](_0x40eec9['shift']());}};_0xfee890(++_0x817a67);}(_0xfd46,0xae));var _0x6fd4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd46[_0x3ab51d];return _0x29a04e;};'use strict';var SmsInteractionEvents=require(_0x6fd4('0x0'));var events=[_0x6fd4('0x1'),_0x6fd4('0x2'),_0x6fd4('0x3')];function createListener(_0x1a5331,_0x430954){return function(_0x2cd6f9){_0x430954[_0x6fd4('0x4')](_0x1a5331,_0x2cd6f9);};}function removeListener(_0x5985e4,_0x4ba916){return function(){SmsInteractionEvents['removeListener'](_0x5985e4,_0x4ba916);};}exports[_0x6fd4('0x5')]=function(_0x43ebe5){for(var _0x4a1a48=0x0,_0x5ae8d4=events[_0x6fd4('0x6')];_0x4a1a48<_0x5ae8d4;_0x4a1a48++){var _0x1ace70=events[_0x4a1a48];var _0x34df52=createListener('smsInteraction:'+_0x1ace70,_0x43ebe5);SmsInteractionEvents['on'](_0x1ace70,_0x34df52);}}; \ No newline at end of file +var _0x91bf=['./smsInteraction.events','save','remove','update','emit','removeListener','register','smsInteraction:'];(function(_0x555c17,_0x2e6c2a){var _0x15a073=function(_0x411a4f){while(--_0x411a4f){_0x555c17['push'](_0x555c17['shift']());}};_0x15a073(++_0x2e6c2a);}(_0x91bf,0x170));var _0xf91b=function(_0x20d578,_0x1a58c9){_0x20d578=_0x20d578-0x0;var _0x5c595c=_0x91bf[_0x20d578];return _0x5c595c;};'use strict';var SmsInteractionEvents=require(_0xf91b('0x0'));var events=[_0xf91b('0x1'),_0xf91b('0x2'),_0xf91b('0x3')];function createListener(_0x42bfca,_0x32acf7){return function(_0x52c1b2){_0x32acf7[_0xf91b('0x4')](_0x42bfca,_0x52c1b2);};}function removeListener(_0x170c00,_0x213f79){return function(){SmsInteractionEvents[_0xf91b('0x5')](_0x170c00,_0x213f79);};}exports[_0xf91b('0x6')]=function(_0x31478b){for(var _0x262d74=0x0,_0x5d3f68=events['length'];_0x262d74<_0x5d3f68;_0x262d74++){var _0x441a1c=events[_0x262d74];var _0x4f899a=createListener(_0xf91b('0x7')+_0x441a1c,_0x31478b);SmsInteractionEvents['on'](_0x441a1c,_0x4f899a);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 32a4b65..5942d03 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 _0xfbd6=['smsmessage:create','create','/:id/status','status','update','put','/:id/reject','reject','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked'];(function(_0x503d9c,_0x32e000){var _0x197c52=function(_0x1be198){while(--_0x1be198){_0x503d9c['push'](_0x503d9c['shift']());}};_0x197c52(++_0x32e000);}(_0xfbd6,0x1b2));var _0x6fbd=function(_0x4fa692,_0x56313c){_0x4fa692=_0x4fa692-0x0;var _0x5a531b=_0xfbd6[_0x4fa692];return _0x5a531b;};'use strict';var multer=require(_0x6fbd('0x0'));var util=require(_0x6fbd('0x1'));var path=require(_0x6fbd('0x2'));var timeout=require(_0x6fbd('0x3'));var express=require('express');var router=express[_0x6fbd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6fbd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6fbd('0x6'));var controller=require(_0x6fbd('0x7'));router[_0x6fbd('0x8')]('/',auth[_0x6fbd('0x9')](),controller['index']);router[_0x6fbd('0x8')](_0x6fbd('0xa'),auth[_0x6fbd('0x9')](),controller[_0x6fbd('0xb')]);router[_0x6fbd('0x8')](_0x6fbd('0xc'),auth[_0x6fbd('0x9')](),controller[_0x6fbd('0xd')]);router[_0x6fbd('0xe')]('/',auth[_0x6fbd('0x9')](),interaction[_0x6fbd('0xf')]('sms',_0x6fbd('0x10')),controller[_0x6fbd('0x11')]);router[_0x6fbd('0xe')](_0x6fbd('0x12'),controller[_0x6fbd('0x13')]);router['put'](_0x6fbd('0xc'),auth[_0x6fbd('0x9')](),controller[_0x6fbd('0x14')]);router[_0x6fbd('0x15')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put'](_0x6fbd('0x16'),auth[_0x6fbd('0x9')](),controller[_0x6fbd('0x17')]);router['delete'](_0x6fbd('0xc'),auth[_0x6fbd('0x9')](),controller['destroy']);module[_0x6fbd('0x18')]=router; \ No newline at end of file +var _0xdb9b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','get','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xdb9b,0x72));var _0xbdb9=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xdb9b[_0x4709c0];return _0x13348b;};'use strict';var multer=require('multer');var util=require(_0xbdb9('0x0'));var path=require(_0xbdb9('0x1'));var timeout=require(_0xbdb9('0x2'));var express=require(_0xbdb9('0x3'));var router=express[_0xbdb9('0x4')]();var fs_extra=require(_0xbdb9('0x5'));var auth=require(_0xbdb9('0x6'));var interaction=require(_0xbdb9('0x7'));var config=require(_0xbdb9('0x8'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0xbdb9('0x9')](),controller['index']);router['get']('/describe',auth[_0xbdb9('0x9')](),controller[_0xbdb9('0xa')]);router[_0xbdb9('0xb')]('/:id',auth[_0xbdb9('0x9')](),controller[_0xbdb9('0xc')]);router[_0xbdb9('0xd')]('/',auth[_0xbdb9('0x9')](),interaction[_0xbdb9('0xe')](_0xbdb9('0xf'),_0xbdb9('0x10')),controller['create']);router[_0xbdb9('0xd')](_0xbdb9('0x11'),controller[_0xbdb9('0x12')]);router[_0xbdb9('0x13')](_0xbdb9('0x14'),auth[_0xbdb9('0x9')](),controller[_0xbdb9('0x15')]);router[_0xbdb9('0x13')](_0xbdb9('0x16'),auth[_0xbdb9('0x9')](),controller[_0xbdb9('0x17')]);router[_0xbdb9('0x13')](_0xbdb9('0x18'),auth['isAuthenticated'](),controller[_0xbdb9('0x19')]);router[_0xbdb9('0x1a')](_0xbdb9('0x14'),auth[_0xbdb9('0x9')](),controller[_0xbdb9('0x1b')]);module[_0xbdb9('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 8599be8..273f9c4 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 _0x71a1=['TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0x71a1,0xfa));var _0x171a=function(_0x1551c3,_0x5b202d){_0x1551c3=_0x1551c3-0x0;var _0x469e95=_0x71a1[_0x1551c3];return _0x469e95;};'use strict';var Sequelize=require(_0x171a('0x0'));module[_0x171a('0x1')]={'body':{'type':Sequelize[_0x171a('0x2')](_0x171a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x171a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x171a('0x5')]('in',_0x171a('0x6')),'defaultValue':_0x171a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x171a('0x7')]},'secret':{'type':Sequelize[_0x171a('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x171a('0x8')]},'providerResponse':{'type':Sequelize[_0x171a('0x2')]}}; \ No newline at end of file +var _0x0748=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x25e1b8,_0x29c86f){var _0xdd73c9=function(_0x535dd1){while(--_0x535dd1){_0x25e1b8['push'](_0x25e1b8['shift']());}};_0xdd73c9(++_0x29c86f);}(_0x0748,0xce));var _0x8074=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x0748[_0x361d3f];return _0x320229;};'use strict';var Sequelize=require(_0x8074('0x0'));module[_0x8074('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8074('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8074('0x3')]('in',_0x8074('0x4')),'defaultValue':_0x8074('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8074('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x8074('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8074('0x5')]},'providerResponse':{'type':Sequelize[_0x8074('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index ac906b2..8965595 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 _0xf470=['SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','name','index','map','SmsMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','keys','rawAttributes','include','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','fullname','email','manual','interface','channel','motionChannel','event','EventManager','reject','SmsInteraction','role','RejectMessage','Sequelize','QueryTypes','User','internal','rejectmessage','SmsAccount','SmsAccountId','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','then'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xf470,0xfd));var _0x0f47=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xf470[_0x49d41c];return _0xb64c5f;};'use strict';var emlformat=require(_0x0f47('0x0'));var rimraf=require(_0x0f47('0x1'));var zipdir=require(_0x0f47('0x2'));var jsonpatch=require(_0x0f47('0x3'));var rp=require(_0x0f47('0x4'));var moment=require(_0x0f47('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f47('0x6'));var util=require(_0x0f47('0x7'));var path=require('path');var sox=require(_0x0f47('0x8'));var csv=require(_0x0f47('0x9'));var ejs=require(_0x0f47('0xa'));var fs=require('fs');var fs_extra=require(_0x0f47('0xb'));var _=require(_0x0f47('0xc'));var squel=require(_0x0f47('0xd'));var crypto=require(_0x0f47('0xe'));var jsforce=require(_0x0f47('0xf'));var deskjs=require(_0x0f47('0x10'));var toCsv=require(_0x0f47('0x9'));var querystring=require(_0x0f47('0x11'));var Papa=require(_0x0f47('0x12'));var Redis=require(_0x0f47('0x13'));var authService=require(_0x0f47('0x14'));var qs=require(_0x0f47('0x15'));var as=require(_0x0f47('0x16'));var hardwareService=require(_0x0f47('0x17'));var logger=require(_0x0f47('0x18'))(_0x0f47('0x19'));var utils=require('../../config/utils');var config=require(_0x0f47('0x1a'));var licenseUtil=require(_0x0f47('0x1b'));var db=require(_0x0f47('0x1c'))['db'];config[_0x0f47('0x1d')]=_[_0x0f47('0x1e')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0f47('0x1f'))(new Redis(config[_0x0f47('0x1d')]));require(_0x0f47('0x20'))[_0x0f47('0x21')](socket);var jayson=require(_0x0f47('0x22'));var client=jayson['client'][_0x0f47('0x23')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e08f6,_0x2c2ba8,_0x3edb61,_0x1e84eb){return new BPromise(function(_0x475754,_0x325569){var _0x25e2e9=_0x1e84eb||client;return _0x25e2e9['request'](_0x1e08f6,_0x3edb61)[_0x0f47('0x24')](function(_0x3fcc5b){logger['info'](_0x0f47('0x25'),_0x2c2ba8,_0x0f47('0x26'));logger[_0x0f47('0x27')](_0x0f47('0x28'),_0x2c2ba8,_0x0f47('0x26'),JSON[_0x0f47('0x29')](_0x3fcc5b));if(_0x3fcc5b[_0x0f47('0x2a')]){if(_0x3fcc5b[_0x0f47('0x2a')][_0x0f47('0x2b')]===0x1f4){logger[_0x0f47('0x2a')](_0x0f47('0x25'),_0x2c2ba8,_0x3fcc5b['error']['message']);return _0x325569(_0x3fcc5b['error'][_0x0f47('0x2c')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x2c2ba8,_0x3fcc5b[_0x0f47('0x2a')][_0x0f47('0x2c')]);return _0x475754(_0x3fcc5b[_0x0f47('0x2a')][_0x0f47('0x2c')]);}else{logger[_0x0f47('0x2d')](_0x0f47('0x25'),_0x2c2ba8,_0x0f47('0x26'));_0x475754(_0x3fcc5b['result']['message']);}})[_0x0f47('0x2e')](function(_0x48c86){logger[_0x0f47('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x2c2ba8,_0x48c86);_0x325569(_0x48c86);});});}function respondWithStatusCode(_0x365482,_0x41a31e){_0x41a31e=_0x41a31e||0xcc;return function(_0x3e1fb0){if(_0x3e1fb0){return _0x365482[_0x0f47('0x2f')](_0x41a31e);}return _0x365482['status'](_0x41a31e)[_0x0f47('0x30')]();};}function respondWithResult(_0x327ebb,_0x44c56d){_0x44c56d=_0x44c56d||0xc8;return function(_0x401aea){if(_0x401aea){return _0x327ebb[_0x0f47('0x31')](_0x44c56d)[_0x0f47('0x32')](_0x401aea);}};}function respondWithFilteredResult(_0x1142cd,_0xd47c98){return function(_0x2b902e){if(_0x2b902e){var _0x2648f1=typeof _0xd47c98[_0x0f47('0x33')]===_0x0f47('0x34')&&typeof _0xd47c98['limit']===_0x0f47('0x34');var _0x28575c=_0x2b902e[_0x0f47('0x35')];var _0x1a0d44=_0x2648f1?0x0:_0xd47c98[_0x0f47('0x33')];var _0x49c679=_0x2648f1?_0x2b902e[_0x0f47('0x35')]:_0xd47c98[_0x0f47('0x33')]+_0xd47c98[_0x0f47('0x36')];var _0x503fd2;if(_0x49c679>=_0x28575c){_0x49c679=_0x28575c;_0x503fd2=0xc8;}else{_0x503fd2=0xce;}_0x1142cd[_0x0f47('0x31')](_0x503fd2);return _0x1142cd[_0x0f47('0x37')](_0x0f47('0x38'),_0x1a0d44+'-'+_0x49c679+'/'+_0x28575c)[_0x0f47('0x32')](_0x2b902e);}return null;};}function patchUpdates(_0xcfb085){return function(_0x52006a){try{jsonpatch['apply'](_0x52006a,_0xcfb085,!![]);}catch(_0x53ea2e){return BPromise['reject'](_0x53ea2e);}return _0x52006a[_0x0f47('0x39')]();};}function saveUpdates(_0x4f0aab,_0xdb5135){return function(_0x4bc23c){if(_0x4bc23c){return _0x4bc23c[_0x0f47('0x3a')](_0x4f0aab)[_0x0f47('0x24')](function(_0x5d10d3){return _0x5d10d3;});}return null;};}function removeEntity(_0x444d87,_0x4e879e){return function(_0x38470b){if(_0x38470b){return _0x38470b[_0x0f47('0x3b')]()[_0x0f47('0x24')](function(){_0x444d87[_0x0f47('0x31')](0xcc)[_0x0f47('0x30')]();});}};}function handleEntityNotFound(_0x4d7d38,_0x1c4e1a){return function(_0x280d77){if(!_0x280d77){_0x4d7d38[_0x0f47('0x2f')](0x194);}return _0x280d77;};}function handleError(_0x2d7fc6,_0x2fc8a3){_0x2fc8a3=_0x2fc8a3||0x1f4;return function(_0x47cf68){logger['error'](_0x47cf68['stack']);if(_0x47cf68[_0x0f47('0x3c')]){delete _0x47cf68[_0x0f47('0x3c')];}_0x2d7fc6[_0x0f47('0x31')](_0x2fc8a3)['send'](_0x47cf68);};}exports[_0x0f47('0x3d')]=function(_0x278e8c,_0x4814fe){var _0x5e17c7={},_0x497833={},_0xa42420={'count':0x0,'rows':[]};var _0x5471b6=_[_0x0f47('0x3e')](db[_0x0f47('0x3f')]['rawAttributes'],function(_0x477c59){return{'name':_0x477c59[_0x0f47('0x40')],'type':_0x477c59[_0x0f47('0x41')][_0x0f47('0x42')]};});_0x497833[_0x0f47('0x43')]=_[_0x0f47('0x3e')](_0x5471b6,_0x0f47('0x3c'));_0x497833[_0x0f47('0x44')]=_['keys'](_0x278e8c[_0x0f47('0x44')]);_0x497833[_0x0f47('0x45')]=_[_0x0f47('0x46')](_0x497833[_0x0f47('0x43')],_0x497833[_0x0f47('0x44')]);_0x5e17c7[_0x0f47('0x47')]=_['intersection'](_0x497833[_0x0f47('0x43')],qs['fields'](_0x278e8c[_0x0f47('0x44')][_0x0f47('0x48')]));_0x5e17c7['attributes']=_0x5e17c7[_0x0f47('0x47')][_0x0f47('0x49')]?_0x5e17c7[_0x0f47('0x47')]:_0x497833[_0x0f47('0x43')];if(!_0x278e8c[_0x0f47('0x44')]['hasOwnProperty']('nolimit')){_0x5e17c7[_0x0f47('0x36')]=qs[_0x0f47('0x36')](_0x278e8c[_0x0f47('0x44')][_0x0f47('0x36')]);_0x5e17c7[_0x0f47('0x33')]=qs[_0x0f47('0x33')](_0x278e8c[_0x0f47('0x44')]['offset']);}_0x5e17c7['order']=qs[_0x0f47('0x4a')](_0x278e8c[_0x0f47('0x44')][_0x0f47('0x4a')]);_0x5e17c7['where']=qs[_0x0f47('0x45')](_[_0x0f47('0x4b')](_0x278e8c[_0x0f47('0x44')],_0x497833[_0x0f47('0x45')]),_0x5471b6);if(_0x278e8c[_0x0f47('0x44')][_0x0f47('0x4c')]){_0x5e17c7[_0x0f47('0x4d')]=_[_0x0f47('0x4e')](_0x5e17c7[_0x0f47('0x4d')],{'$or':_['map'](_0x5471b6,function(_0x6fef01){if(_0x6fef01[_0x0f47('0x41')]!==_0x0f47('0x4f')){var _0x254176={};_0x254176[_0x6fef01[_0x0f47('0x3c')]]={'$like':'%'+_0x278e8c[_0x0f47('0x44')][_0x0f47('0x4c')]+'%'};return _0x254176;}})});}_0x5e17c7=_[_0x0f47('0x4e')]({},_0x5e17c7,_0x278e8c[_0x0f47('0x50')]);var _0x5b10f8={'where':_0x5e17c7['where']};return db[_0x0f47('0x3f')][_0x0f47('0x35')](_0x5b10f8)[_0x0f47('0x24')](function(_0x334c6f){_0xa42420[_0x0f47('0x35')]=_0x334c6f;if(_0x278e8c[_0x0f47('0x44')][_0x0f47('0x51')]){_0x5e17c7['include']=[{'all':!![]}];}return db[_0x0f47('0x3f')][_0x0f47('0x52')](_0x5e17c7);})[_0x0f47('0x24')](function(_0x6a478){_0xa42420[_0x0f47('0x53')]=_0x6a478;return _0xa42420;})[_0x0f47('0x24')](respondWithFilteredResult(_0x4814fe,_0x5e17c7))[_0x0f47('0x2e')](handleError(_0x4814fe,null));};exports['show']=function(_0x364950,_0xbc93b4){var _0x552dc3={'raw':!![],'where':{'id':_0x364950['params']['id']}},_0x2c2c04={};_0x2c2c04[_0x0f47('0x43')]=_[_0x0f47('0x54')](db[_0x0f47('0x3f')][_0x0f47('0x55')]);_0x2c2c04[_0x0f47('0x44')]=_[_0x0f47('0x54')](_0x364950[_0x0f47('0x44')]);_0x2c2c04[_0x0f47('0x45')]=_[_0x0f47('0x46')](_0x2c2c04['model'],_0x2c2c04[_0x0f47('0x44')]);_0x552dc3[_0x0f47('0x47')]=_[_0x0f47('0x46')](_0x2c2c04[_0x0f47('0x43')],qs[_0x0f47('0x48')](_0x364950[_0x0f47('0x44')][_0x0f47('0x48')]));_0x552dc3[_0x0f47('0x47')]=_0x552dc3[_0x0f47('0x47')][_0x0f47('0x49')]?_0x552dc3[_0x0f47('0x47')]:_0x2c2c04[_0x0f47('0x43')];if(_0x364950[_0x0f47('0x44')]['includeAll']){_0x552dc3[_0x0f47('0x56')]=[{'all':!![]}];}_0x552dc3=_[_0x0f47('0x4e')]({},_0x552dc3,_0x364950[_0x0f47('0x50')]);return db['SmsMessage'][_0x0f47('0x57')](_0x552dc3)[_0x0f47('0x24')](handleEntityNotFound(_0xbc93b4,null))[_0x0f47('0x24')](respondWithResult(_0xbc93b4,null))[_0x0f47('0x2e')](handleError(_0xbc93b4,null));};exports[_0x0f47('0x58')]=function(_0x4d9708,_0x1eaced){return db['SmsMessage'][_0x0f47('0x58')](_0x4d9708[_0x0f47('0x59')],{})[_0x0f47('0x24')](respondWithResult(_0x1eaced,0xc9))[_0x0f47('0x2e')](handleError(_0x1eaced,null));};exports[_0x0f47('0x3a')]=function(_0x26def7,_0x4e76a6){if(_0x26def7['body']['id']){delete _0x26def7[_0x0f47('0x59')]['id'];}return db['SmsMessage'][_0x0f47('0x57')]({'where':{'id':_0x26def7[_0x0f47('0x5a')]['id']}})[_0x0f47('0x24')](handleEntityNotFound(_0x4e76a6,null))['then'](saveUpdates(_0x26def7['body'],null))['then'](respondWithResult(_0x4e76a6,null))['catch'](handleError(_0x4e76a6,null));};exports['destroy']=function(_0x222be6,_0x650220){return db[_0x0f47('0x3f')][_0x0f47('0x57')]({'where':{'id':_0x222be6['params']['id']}})[_0x0f47('0x24')](handleEntityNotFound(_0x650220,null))['then'](removeEntity(_0x650220,null))[_0x0f47('0x2e')](handleError(_0x650220,null));};exports[_0x0f47('0x5b')]=function(_0x1f4b7c,_0xd39a78){return db[_0x0f47('0x3f')][_0x0f47('0x5b')]()[_0x0f47('0x24')](respondWithResult(_0xd39a78,null))[_0x0f47('0x2e')](handleError(_0xd39a78,null));};var interaction_log=require(_0x0f47('0x18'))(_0x0f47('0x5c'));exports[_0x0f47('0x5d')]=function(_0x8d72d0,_0x227aae,_0x3fd03b){var _0x5da95d={'agent':{},'channel':_0x0f47('0x5e')};if(_0x8d72d0[_0x0f47('0x59')]['id']){delete _0x8d72d0[_0x0f47('0x59')]['id'];}_0x8d72d0[_0x0f47('0x59')][_0x0f47('0x5f')]=!![];_0x8d72d0[_0x0f47('0x59')][_0x0f47('0x60')]=moment()[_0x0f47('0x61')](_0x0f47('0x62'));_0x8d72d0[_0x0f47('0x59')][_0x0f47('0x63')]=_0x8d72d0[_0x0f47('0x59')][_0x0f47('0x63')]||_0x8d72d0['user']['id'];_0x5da95d[_0x0f47('0x64')]['id']=_0x8d72d0[_0x0f47('0x59')][_0x0f47('0x63')];return db[_0x0f47('0x3f')][_0x0f47('0x57')]({'where':{'id':_0x8d72d0['params']['id'],'UserId':null}})[_0x0f47('0x24')](handleEntityNotFound(_0x227aae,null))[_0x0f47('0x24')](saveUpdates(_0x8d72d0[_0x0f47('0x59')],null))[_0x0f47('0x24')](function(_0x11fe7b){if(_0x11fe7b){_0x5da95d[_0x0f47('0x2c')]=_0x11fe7b[_0x0f47('0x65')]({'plain':!![]});return db['SmsInteraction'][_0x0f47('0x57')]({'where':{'id':_0x11fe7b[_0x0f47('0x66')]}});}return null;})[_0x0f47('0x24')](handleEntityNotFound(_0x227aae,null))['then'](function(_0x42c268){if(_0x42c268){return _0x42c268['update']({'UserId':_0x8d72d0[_0x0f47('0x59')][_0x0f47('0x63')],'read1stAt':_[_0x0f47('0x67')](_0x42c268[_0x0f47('0x68')])?moment()[_0x0f47('0x61')](_0x0f47('0x62')):undefined});}return null;})[_0x0f47('0x24')](function(_0x49cd50){if(_0x49cd50){_0x5da95d[_0x0f47('0x69')]=_0x49cd50[_0x0f47('0x65')]({'plain':!![]});interaction_log[_0x0f47('0x2d')](_0x0f47('0x6a'),_0x8d72d0[_0x0f47('0x6b')]['id'],_0x8d72d0['user'][_0x0f47('0x3c')],_0x8d72d0[_0x0f47('0x6b')]['role'],_0x5da95d[_0x0f47('0x69')]['id'],_0x8d72d0[_0x0f47('0x59')]?JSON[_0x0f47('0x29')](_0x8d72d0['body']):_0x0f47('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5da95d);}return null;})[_0x0f47('0x24')](function(_0x546bff){var _0x496ea7=_0x0f47('0x6d')+_0x546bff[_0x0f47('0x2c')]['ContactId'];return db['sequelize'][_0x0f47('0x44')](_0x496ea7,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x1571f1){return _0x1571f1;});})['then'](function(_0x2f142b){if(_0x2f142b){_0x5da95d['message'][_0x0f47('0x6e')]=_0x2f142b[0x0];if(!_0x8d72d0[_0x0f47('0x59')][_0x0f47('0x63')])return;return db['User'][_0x0f47('0x57')]({'where':{'id':_0x8d72d0[_0x0f47('0x59')]['UserId'],'role':_0x0f47('0x64')},'attributes':['id','name',_0x0f47('0x6f'),_0x0f47('0x70'),'internal'],'raw':!![]});}return null;})[_0x0f47('0x24')](function(_0x12ee48){if(!_0x12ee48)return null;_0x5da95d[_0x0f47('0x2c')][_0x0f47('0x64')]=_0x12ee48;return _0x5da95d;})[_0x0f47('0x24')](function(_0x5ab65e){if(_0x5ab65e){if(_0x8d72d0[_0x0f47('0x59')][_0x0f47('0x71')]){_0x5da95d[_0x0f47('0x2c')][_0x0f47('0x72')]=util['format']('SIP/%s',_0x8d72d0['user'][_0x0f47('0x3c')]);_0x5da95d[_0x0f47('0x2c')][_0x0f47('0x73')]=_0x5da95d[_0x0f47('0x73')];_0x5da95d['message'][_0x0f47('0x74')]=_0x5da95d[_0x0f47('0x73')];_0x5da95d[_0x0f47('0x2c')][_0x0f47('0x75')]='accept';return respondWithRpcPromise('EventManager',_0x0f47('0x76'),{'event':'acceptmessage','message':_0x5da95d['message']},client9002)[_0x0f47('0x24')](function(){return _0x5da95d;});}return _0x5da95d;}return null;})['then'](respondWithResult(_0x227aae,null))[_0x0f47('0x2e')](handleError(_0x227aae,null));};var interaction_log=require(_0x0f47('0x18'))(_0x0f47('0x5c'));exports[_0x0f47('0x77')]=function(_0x46de5d,_0x2dc480,_0x15274a){var _0x54262d={'agent':{},'channel':_0x0f47('0x5e')};if(_0x46de5d['body']['id']){delete _0x46de5d[_0x0f47('0x59')]['id'];}_0x46de5d[_0x0f47('0x59')][_0x0f47('0x63')]=_0x46de5d['body'][_0x0f47('0x63')]||_0x46de5d[_0x0f47('0x6b')]['id'];_0x54262d[_0x0f47('0x64')]['id']=_0x46de5d[_0x0f47('0x59')][_0x0f47('0x63')];return db['SmsMessage'][_0x0f47('0x57')]({'where':{'id':_0x46de5d[_0x0f47('0x5a')]['id'],'UserId':null}})[_0x0f47('0x24')](handleEntityNotFound(_0x2dc480,null))[_0x0f47('0x24')](function(_0x2bc339){if(_0x2bc339){_0x54262d[_0x0f47('0x2c')]=_0x2bc339[_0x0f47('0x65')]({'plain':!![]});return db[_0x0f47('0x78')][_0x0f47('0x57')]({'where':{'id':_0x2bc339[_0x0f47('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2dc480,null))[_0x0f47('0x24')](function(_0x157f6b){if(_0x157f6b){_0x54262d[_0x0f47('0x69')]=_0x157f6b['get']({'plain':!![]});interaction_log[_0x0f47('0x2d')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46de5d[_0x0f47('0x6b')]['id'],_0x46de5d[_0x0f47('0x6b')][_0x0f47('0x3c')],_0x46de5d[_0x0f47('0x6b')][_0x0f47('0x79')],_0x54262d[_0x0f47('0x69')]['id'],_0x46de5d[_0x0f47('0x59')]?JSON[_0x0f47('0x29')](_0x46de5d[_0x0f47('0x59')]):_0x0f47('0x6c'));return respondWithRpcPromise(_0x0f47('0x7a'),'rejectMessage',_0x54262d);}return null;})['then'](function(_0xbef679){var _0x1b7db5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xbef679[_0x0f47('0x2c')]['ContactId'];return db['sequelize'][_0x0f47('0x44')](_0x1b7db5,{'type':db[_0x0f47('0x7b')][_0x0f47('0x7c')]['SELECT'],'raw':!![]})['then'](function(_0xa16f52){return _0xa16f52;});})[_0x0f47('0x24')](function(_0x59cc63){if(_0x59cc63){_0x54262d[_0x0f47('0x2c')][_0x0f47('0x6e')]=_0x59cc63[0x0];if(!_0x46de5d[_0x0f47('0x59')][_0x0f47('0x63')])return;return db[_0x0f47('0x7d')][_0x0f47('0x57')]({'where':{'id':_0x46de5d['body'][_0x0f47('0x63')],'role':_0x0f47('0x64')},'attributes':['id','name',_0x0f47('0x6f'),_0x0f47('0x70'),_0x0f47('0x7e')],'raw':!![]});}return null;})['then'](function(_0x4b07b3){if(!_0x4b07b3)return null;_0x54262d[_0x0f47('0x2c')]['agent']=_0x4b07b3;return _0x54262d;})['then'](function(_0x4acb5c){if(_0x4acb5c){_0x4acb5c['message'][_0x0f47('0x72')]=util[_0x0f47('0x61')]('SIP/%s',_0x46de5d[_0x0f47('0x6b')][_0x0f47('0x3c')]);_0x4acb5c[_0x0f47('0x2c')][_0x0f47('0x73')]=_0x54262d[_0x0f47('0x73')];_0x4acb5c[_0x0f47('0x2c')]['motionChannel']=_0x54262d[_0x0f47('0x73')];_0x4acb5c[_0x0f47('0x2c')][_0x0f47('0x75')]=_0x0f47('0x77');respondWithRpcPromise('EventManager',_0x0f47('0x76'),{'event':_0x0f47('0x7f'),'message':_0x4acb5c[_0x0f47('0x2c')]},client9002);return _0x54262d;}return null;})[_0x0f47('0x24')](respondWithResult(_0x2dc480,null))[_0x0f47('0x2e')](handleError(_0x2dc480,null));};exports['status']=function(_0x4032c1,_0x1866bc,_0x226783){if(_0x4032c1[_0x0f47('0x59')]['id']){delete _0x4032c1[_0x0f47('0x59')]['id'];}var _0x36a654;return db['SmsMessage'][_0x0f47('0x57')]({'where':{'id':_0x4032c1[_0x0f47('0x5a')]['id']}})[_0x0f47('0x24')](handleEntityNotFound(_0x1866bc,null))[_0x0f47('0x24')](function(_0x24fbdf){if(_0x24fbdf){_0x36a654=_0x24fbdf;return db[_0x0f47('0x80')][_0x0f47('0x57')]({'where':{'id':_0x24fbdf[_0x0f47('0x81')]}});}})[_0x0f47('0x24')](handleEntityNotFound(_0x1866bc,null))[_0x0f47('0x24')](function(_0x155447){if(_0x155447){logger[_0x0f47('0x27')](_0x0f47('0x28'),_0x0f47('0x31'),'received\x20delivery\x20report\x20from',_0x155447[_0x0f47('0x41')],util[_0x0f47('0x82')](_0x4032c1[_0x0f47('0x59')],{'showHidden':![],'depth':null}));switch(_0x155447['type']){case'twilio':if(_0x4032c1[_0x0f47('0x59')][_0x0f47('0x83')]&&_0x4032c1[_0x0f47('0x59')][_0x0f47('0x83')]===_0x36a654[_0x0f47('0x84')]){return _0x36a654['update']({'read':!![]});}else{logger[_0x0f47('0x2a')](_0x0f47('0x85'),_0x0f47('0x31'),_0x0f47('0x86'),util['inspect'](_0x4032c1[_0x0f47('0x59')],{'showHidden':![],'depth':null}));}break;case _0x0f47('0x87'):if(_0x4032c1[_0x0f47('0x59')]['MessageUUID']&&_0x4032c1['body'][_0x0f47('0x88')]===_0x36a654[_0x0f47('0x84')]&&_[_0x0f47('0x89')]([_0x0f47('0x8a'),'delivered'],_0x4032c1[_0x0f47('0x59')][_0x0f47('0x8b')])>=0x0){return _0x36a654[_0x0f47('0x3a')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0f47('0x8c'),util[_0x0f47('0x82')](_0x4032c1[_0x0f47('0x59')],{'showHidden':![],'depth':null}));}break;case _0x0f47('0x8d'):var _0x169983=_0x4032c1[_0x0f47('0x59')][_0x0f47('0x8e')][0x0];if(_0x169983['status'][_0x0f47('0x8f')]===_0x0f47('0x90')){return _0x36a654[_0x0f47('0x3a')]({'read':!![]});}else{logger['error'](_0x0f47('0x85'),_0x0f47('0x31'),_0x0f47('0x8d'),util['inspect'](_0x4032c1[_0x0f47('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x36a654;}})[_0x0f47('0x24')](respondWithResult(_0x1866bc,null))[_0x0f47('0x2e')](handleError(_0x1866bc,null));}; \ No newline at end of file +var _0xa1d2=['UserId','user','agent','get','SmsInteractionId','isNil','format','interaction','info','[SMSMESSAGE: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','User','fullname','internal','manual','SIP/%s','channel','motionChannel','reject','SmsInteraction','role','RejectMessage','sequelize','QueryTypes','SELECT','contact','interface','event','EventManager','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageUUID','messageId','indexOf','delivered','infobip','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','rimraf','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/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','json','undefined','count','offset','limit','status','set','apply','destroy','end','name','send','map','SmsMessage','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','params','rawAttributes','keys','options','create','body','update','find','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x397843,_0xa7173e){var _0x2ba028=function(_0x243ab4){while(--_0x243ab4){_0x397843['push'](_0x397843['shift']());}};_0x2ba028(++_0xa7173e);}(_0xa1d2,0x151));var _0x2a1d=function(_0x138b33,_0x23073b){_0x138b33=_0x138b33-0x0;var _0x475983=_0xa1d2[_0x138b33];return _0x475983;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a1d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a1d('0x1'));var rp=require(_0x2a1d('0x2'));var moment=require(_0x2a1d('0x3'));var BPromise=require(_0x2a1d('0x4'));var Mustache=require(_0x2a1d('0x5'));var util=require(_0x2a1d('0x6'));var path=require(_0x2a1d('0x7'));var sox=require(_0x2a1d('0x8'));var csv=require(_0x2a1d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a1d('0xa'));var _=require(_0x2a1d('0xb'));var squel=require(_0x2a1d('0xc'));var crypto=require(_0x2a1d('0xd'));var jsforce=require(_0x2a1d('0xe'));var deskjs=require(_0x2a1d('0xf'));var toCsv=require(_0x2a1d('0x9'));var querystring=require(_0x2a1d('0x10'));var Papa=require(_0x2a1d('0x11'));var Redis=require(_0x2a1d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2a1d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a1d('0x14'));var logger=require(_0x2a1d('0x15'))('api');var utils=require(_0x2a1d('0x16'));var config=require(_0x2a1d('0x17'));var licenseUtil=require(_0x2a1d('0x18'));var db=require('../../mysqldb')['db'];config[_0x2a1d('0x19')]=_['defaults'](config[_0x2a1d('0x19')],{'host':_0x2a1d('0x1a'),'port':0x18eb});var socket=require(_0x2a1d('0x1b'))(new Redis(config[_0x2a1d('0x19')]));require(_0x2a1d('0x1c'))[_0x2a1d('0x1d')](socket);var jayson=require(_0x2a1d('0x1e'));var client=jayson[_0x2a1d('0x1f')][_0x2a1d('0x20')]({'port':0x232c});var client9002=jayson[_0x2a1d('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4630c4,_0x1cfb8b,_0x30a64b,_0x192585){return new BPromise(function(_0x3925e1,_0x12fa6d){var _0x229a21=_0x192585||client;return _0x229a21[_0x2a1d('0x21')](_0x4630c4,_0x30a64b)[_0x2a1d('0x22')](function(_0xb5d08d){logger['info'](_0x2a1d('0x23'),_0x1cfb8b,_0x2a1d('0x24'));logger[_0x2a1d('0x25')](_0x2a1d('0x26'),_0x1cfb8b,_0x2a1d('0x24'),JSON['stringify'](_0xb5d08d));if(_0xb5d08d[_0x2a1d('0x27')]){if(_0xb5d08d['error'][_0x2a1d('0x28')]===0x1f4){logger[_0x2a1d('0x27')](_0x2a1d('0x23'),_0x1cfb8b,_0xb5d08d[_0x2a1d('0x27')][_0x2a1d('0x29')]);return _0x12fa6d(_0xb5d08d['error']['message']);}logger[_0x2a1d('0x27')](_0x2a1d('0x23'),_0x1cfb8b,_0xb5d08d[_0x2a1d('0x27')][_0x2a1d('0x29')]);return _0x3925e1(_0xb5d08d[_0x2a1d('0x27')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1cfb8b,_0x2a1d('0x24'));_0x3925e1(_0xb5d08d['result']['message']);}})[_0x2a1d('0x2a')](function(_0x4f858d){logger[_0x2a1d('0x27')](_0x2a1d('0x23'),_0x1cfb8b,_0x4f858d);_0x12fa6d(_0x4f858d);});});}function respondWithStatusCode(_0x587d7b,_0x2a6055){_0x2a6055=_0x2a6055||0xcc;return function(_0x450bac){if(_0x450bac){return _0x587d7b[_0x2a1d('0x2b')](_0x2a6055);}return _0x587d7b['status'](_0x2a6055)['end']();};}function respondWithResult(_0x5e5716,_0x26b351){_0x26b351=_0x26b351||0xc8;return function(_0x2b57c9){if(_0x2b57c9){return _0x5e5716['status'](_0x26b351)[_0x2a1d('0x2c')](_0x2b57c9);}};}function respondWithFilteredResult(_0x511df0,_0x3d75ca){return function(_0x4a5ccd){if(_0x4a5ccd){var _0x3a00e2=typeof _0x3d75ca['offset']===_0x2a1d('0x2d')&&typeof _0x3d75ca['limit']==='undefined';var _0x47d6a6=_0x4a5ccd[_0x2a1d('0x2e')];var _0x58854b=_0x3a00e2?0x0:_0x3d75ca[_0x2a1d('0x2f')];var _0x3c972e=_0x3a00e2?_0x4a5ccd[_0x2a1d('0x2e')]:_0x3d75ca[_0x2a1d('0x2f')]+_0x3d75ca[_0x2a1d('0x30')];var _0x2abad0;if(_0x3c972e>=_0x47d6a6){_0x3c972e=_0x47d6a6;_0x2abad0=0xc8;}else{_0x2abad0=0xce;}_0x511df0[_0x2a1d('0x31')](_0x2abad0);return _0x511df0[_0x2a1d('0x32')]('Content-Range',_0x58854b+'-'+_0x3c972e+'/'+_0x47d6a6)['json'](_0x4a5ccd);}return null;};}function patchUpdates(_0x54031a){return function(_0x28937f){try{jsonpatch[_0x2a1d('0x33')](_0x28937f,_0x54031a,!![]);}catch(_0x4f6df7){return BPromise['reject'](_0x4f6df7);}return _0x28937f['save']();};}function saveUpdates(_0x1f01aa,_0xa43863){return function(_0x1486e6){if(_0x1486e6){return _0x1486e6['update'](_0x1f01aa)[_0x2a1d('0x22')](function(_0x240a0a){return _0x240a0a;});}return null;};}function removeEntity(_0xb8bd4e,_0x459636){return function(_0x192e48){if(_0x192e48){return _0x192e48[_0x2a1d('0x34')]()[_0x2a1d('0x22')](function(){_0xb8bd4e[_0x2a1d('0x31')](0xcc)[_0x2a1d('0x35')]();});}};}function handleEntityNotFound(_0x2eed5f,_0x4fb3ca){return function(_0x2a054e){if(!_0x2a054e){_0x2eed5f['sendStatus'](0x194);}return _0x2a054e;};}function handleError(_0x51d978,_0x5f1130){_0x5f1130=_0x5f1130||0x1f4;return function(_0xc43d4c){logger[_0x2a1d('0x27')](_0xc43d4c['stack']);if(_0xc43d4c['name']){delete _0xc43d4c[_0x2a1d('0x36')];}_0x51d978[_0x2a1d('0x31')](_0x5f1130)[_0x2a1d('0x37')](_0xc43d4c);};}exports['index']=function(_0x4e464a,_0x62be77){var _0x1c43a5={},_0x5d8f87={},_0x1a40ba={'count':0x0,'rows':[]};var _0x4a15c7=_[_0x2a1d('0x38')](db[_0x2a1d('0x39')]['rawAttributes'],function(_0x2ef779){return{'name':_0x2ef779[_0x2a1d('0x3a')],'type':_0x2ef779[_0x2a1d('0x3b')][_0x2a1d('0x3c')]};});_0x5d8f87['model']=_[_0x2a1d('0x38')](_0x4a15c7,_0x2a1d('0x36'));_0x5d8f87[_0x2a1d('0x3d')]=_['keys'](_0x4e464a[_0x2a1d('0x3d')]);_0x5d8f87[_0x2a1d('0x3e')]=_[_0x2a1d('0x3f')](_0x5d8f87[_0x2a1d('0x40')],_0x5d8f87[_0x2a1d('0x3d')]);_0x1c43a5[_0x2a1d('0x41')]=_['intersection'](_0x5d8f87[_0x2a1d('0x40')],qs[_0x2a1d('0x42')](_0x4e464a[_0x2a1d('0x3d')][_0x2a1d('0x42')]));_0x1c43a5[_0x2a1d('0x41')]=_0x1c43a5[_0x2a1d('0x41')][_0x2a1d('0x43')]?_0x1c43a5[_0x2a1d('0x41')]:_0x5d8f87['model'];if(!_0x4e464a[_0x2a1d('0x3d')]['hasOwnProperty'](_0x2a1d('0x44'))){_0x1c43a5['limit']=qs['limit'](_0x4e464a[_0x2a1d('0x3d')]['limit']);_0x1c43a5[_0x2a1d('0x2f')]=qs['offset'](_0x4e464a[_0x2a1d('0x3d')]['offset']);}_0x1c43a5[_0x2a1d('0x45')]=qs[_0x2a1d('0x46')](_0x4e464a['query']['sort']);_0x1c43a5['where']=qs[_0x2a1d('0x3e')](_[_0x2a1d('0x47')](_0x4e464a[_0x2a1d('0x3d')],_0x5d8f87['filters']),_0x4a15c7);if(_0x4e464a['query'][_0x2a1d('0x48')]){_0x1c43a5[_0x2a1d('0x49')]=_['merge'](_0x1c43a5[_0x2a1d('0x49')],{'$or':_[_0x2a1d('0x38')](_0x4a15c7,function(_0x11f017){if(_0x11f017[_0x2a1d('0x3b')]!==_0x2a1d('0x4a')){var _0x38b64f={};_0x38b64f[_0x11f017['name']]={'$like':'%'+_0x4e464a['query']['filter']+'%'};return _0x38b64f;}})});}_0x1c43a5=_[_0x2a1d('0x4b')]({},_0x1c43a5,_0x4e464a['options']);var _0x588ba0={'where':_0x1c43a5['where']};return db[_0x2a1d('0x39')][_0x2a1d('0x2e')](_0x588ba0)[_0x2a1d('0x22')](function(_0x166bb4){_0x1a40ba[_0x2a1d('0x2e')]=_0x166bb4;if(_0x4e464a[_0x2a1d('0x3d')][_0x2a1d('0x4c')]){_0x1c43a5[_0x2a1d('0x4d')]=[{'all':!![]}];}return db['SmsMessage'][_0x2a1d('0x4e')](_0x1c43a5);})['then'](function(_0x5b1c52){_0x1a40ba[_0x2a1d('0x4f')]=_0x5b1c52;return _0x1a40ba;})[_0x2a1d('0x22')](respondWithFilteredResult(_0x62be77,_0x1c43a5))[_0x2a1d('0x2a')](handleError(_0x62be77,null));};exports['show']=function(_0x1a700a,_0x42a16a){var _0x2b6e20={'raw':!![],'where':{'id':_0x1a700a[_0x2a1d('0x50')]['id']}},_0x16ad4b={};_0x16ad4b[_0x2a1d('0x40')]=_['keys'](db[_0x2a1d('0x39')][_0x2a1d('0x51')]);_0x16ad4b['query']=_[_0x2a1d('0x52')](_0x1a700a[_0x2a1d('0x3d')]);_0x16ad4b['filters']=_['intersection'](_0x16ad4b[_0x2a1d('0x40')],_0x16ad4b[_0x2a1d('0x3d')]);_0x2b6e20[_0x2a1d('0x41')]=_['intersection'](_0x16ad4b[_0x2a1d('0x40')],qs[_0x2a1d('0x42')](_0x1a700a['query'][_0x2a1d('0x42')]));_0x2b6e20[_0x2a1d('0x41')]=_0x2b6e20[_0x2a1d('0x41')][_0x2a1d('0x43')]?_0x2b6e20[_0x2a1d('0x41')]:_0x16ad4b[_0x2a1d('0x40')];if(_0x1a700a[_0x2a1d('0x3d')][_0x2a1d('0x4c')]){_0x2b6e20[_0x2a1d('0x4d')]=[{'all':!![]}];}_0x2b6e20=_['merge']({},_0x2b6e20,_0x1a700a[_0x2a1d('0x53')]);return db[_0x2a1d('0x39')]['find'](_0x2b6e20)[_0x2a1d('0x22')](handleEntityNotFound(_0x42a16a,null))[_0x2a1d('0x22')](respondWithResult(_0x42a16a,null))[_0x2a1d('0x2a')](handleError(_0x42a16a,null));};exports[_0x2a1d('0x54')]=function(_0x1e486f,_0x15eaf7){return db['SmsMessage']['create'](_0x1e486f[_0x2a1d('0x55')],{})[_0x2a1d('0x22')](respondWithResult(_0x15eaf7,0xc9))['catch'](handleError(_0x15eaf7,null));};exports[_0x2a1d('0x56')]=function(_0x4a3f85,_0x3950b0){if(_0x4a3f85['body']['id']){delete _0x4a3f85[_0x2a1d('0x55')]['id'];}return db[_0x2a1d('0x39')][_0x2a1d('0x57')]({'where':{'id':_0x4a3f85['params']['id']}})[_0x2a1d('0x22')](handleEntityNotFound(_0x3950b0,null))['then'](saveUpdates(_0x4a3f85[_0x2a1d('0x55')],null))[_0x2a1d('0x22')](respondWithResult(_0x3950b0,null))[_0x2a1d('0x2a')](handleError(_0x3950b0,null));};exports[_0x2a1d('0x34')]=function(_0x389115,_0x1844e7){return db[_0x2a1d('0x39')]['find']({'where':{'id':_0x389115[_0x2a1d('0x50')]['id']}})[_0x2a1d('0x22')](handleEntityNotFound(_0x1844e7,null))[_0x2a1d('0x22')](removeEntity(_0x1844e7,null))[_0x2a1d('0x2a')](handleError(_0x1844e7,null));};exports[_0x2a1d('0x58')]=function(_0x36e446,_0x2b5f29){return db[_0x2a1d('0x39')]['describe']()[_0x2a1d('0x22')](respondWithResult(_0x2b5f29,null))['catch'](handleError(_0x2b5f29,null));};var interaction_log=require(_0x2a1d('0x15'))(_0x2a1d('0x59'));exports[_0x2a1d('0x5a')]=function(_0xd518a0,_0x26df56,_0x58a69e){var _0x553a99={'agent':{},'channel':_0x2a1d('0x5b')};if(_0xd518a0['body']['id']){delete _0xd518a0['body']['id'];}_0xd518a0['body'][_0x2a1d('0x5c')]=!![];_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5d')]=moment()['format'](_0x2a1d('0x5e'));_0xd518a0['body'][_0x2a1d('0x5f')]=_0xd518a0['body'][_0x2a1d('0x5f')]||_0xd518a0[_0x2a1d('0x60')]['id'];_0x553a99[_0x2a1d('0x61')]['id']=_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5f')];return db['SmsMessage']['find']({'where':{'id':_0xd518a0[_0x2a1d('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x26df56,null))[_0x2a1d('0x22')](saveUpdates(_0xd518a0[_0x2a1d('0x55')],null))['then'](function(_0x1dcb6c){if(_0x1dcb6c){_0x553a99[_0x2a1d('0x29')]=_0x1dcb6c[_0x2a1d('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x2a1d('0x57')]({'where':{'id':_0x1dcb6c[_0x2a1d('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x26df56,null))['then'](function(_0x42bdaf){if(_0x42bdaf){return _0x42bdaf[_0x2a1d('0x56')]({'UserId':_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5f')],'read1stAt':_[_0x2a1d('0x64')](_0x42bdaf['read1stAt'])?moment()[_0x2a1d('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2a1d('0x22')](function(_0x567d0){if(_0x567d0){_0x553a99[_0x2a1d('0x66')]=_0x567d0[_0x2a1d('0x62')]({'plain':!![]});interaction_log[_0x2a1d('0x67')](_0x2a1d('0x68'),_0xd518a0['user']['id'],_0xd518a0['user'][_0x2a1d('0x36')],_0xd518a0[_0x2a1d('0x60')]['role'],_0x553a99[_0x2a1d('0x66')]['id'],_0xd518a0['body']?JSON[_0x2a1d('0x69')](_0xd518a0[_0x2a1d('0x55')]):_0x2a1d('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x2a1d('0x6b'),_0x553a99);}return null;})[_0x2a1d('0x22')](function(_0x19eedd){var _0xb2000d=_0x2a1d('0x6c')+_0x19eedd[_0x2a1d('0x29')][_0x2a1d('0x6d')];return db['sequelize'][_0x2a1d('0x3d')](_0xb2000d,{'type':db[_0x2a1d('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2a1d('0x22')](function(_0x2c2456){return _0x2c2456;});})[_0x2a1d('0x22')](function(_0xff1eb2){if(_0xff1eb2){_0x553a99['message']['contact']=_0xff1eb2[0x0];if(!_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5f')])return;return db[_0x2a1d('0x6f')]['find']({'where':{'id':_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5f')],'role':_0x2a1d('0x61')},'attributes':['id',_0x2a1d('0x36'),_0x2a1d('0x70'),'email',_0x2a1d('0x71')],'raw':!![]});}return null;})[_0x2a1d('0x22')](function(_0x262a29){if(!_0x262a29)return null;_0x553a99[_0x2a1d('0x29')][_0x2a1d('0x61')]=_0x262a29;return _0x553a99;})[_0x2a1d('0x22')](function(_0x29776f){if(_0x29776f){if(_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x72')]){_0x553a99[_0x2a1d('0x29')]['interface']=util[_0x2a1d('0x65')](_0x2a1d('0x73'),_0xd518a0['user'][_0x2a1d('0x36')]);_0x553a99[_0x2a1d('0x29')][_0x2a1d('0x74')]=_0x553a99[_0x2a1d('0x74')];_0x553a99[_0x2a1d('0x29')][_0x2a1d('0x75')]=_0x553a99[_0x2a1d('0x74')];_0x553a99[_0x2a1d('0x29')]['event']=_0x2a1d('0x5a');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x553a99[_0x2a1d('0x29')]},client9002)['then'](function(){return _0x553a99;});}return _0x553a99;}return null;})['then'](respondWithResult(_0x26df56,null))['catch'](handleError(_0x26df56,null));};var interaction_log=require(_0x2a1d('0x15'))(_0x2a1d('0x59'));exports[_0x2a1d('0x76')]=function(_0x461b0c,_0x1e2c0e,_0x231ba7){var _0x398e40={'agent':{},'channel':_0x2a1d('0x5b')};if(_0x461b0c[_0x2a1d('0x55')]['id']){delete _0x461b0c[_0x2a1d('0x55')]['id'];}_0x461b0c[_0x2a1d('0x55')][_0x2a1d('0x5f')]=_0x461b0c[_0x2a1d('0x55')][_0x2a1d('0x5f')]||_0x461b0c[_0x2a1d('0x60')]['id'];_0x398e40[_0x2a1d('0x61')]['id']=_0x461b0c['body'][_0x2a1d('0x5f')];return db['SmsMessage']['find']({'where':{'id':_0x461b0c[_0x2a1d('0x50')]['id'],'UserId':null}})[_0x2a1d('0x22')](handleEntityNotFound(_0x1e2c0e,null))[_0x2a1d('0x22')](function(_0x44022d){if(_0x44022d){_0x398e40[_0x2a1d('0x29')]=_0x44022d['get']({'plain':!![]});return db[_0x2a1d('0x77')][_0x2a1d('0x57')]({'where':{'id':_0x44022d[_0x2a1d('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x1e2c0e,null))[_0x2a1d('0x22')](function(_0x48536d){if(_0x48536d){_0x398e40[_0x2a1d('0x66')]=_0x48536d[_0x2a1d('0x62')]({'plain':!![]});interaction_log[_0x2a1d('0x67')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x461b0c['user']['id'],_0x461b0c[_0x2a1d('0x60')][_0x2a1d('0x36')],_0x461b0c[_0x2a1d('0x60')][_0x2a1d('0x78')],_0x398e40[_0x2a1d('0x66')]['id'],_0x461b0c[_0x2a1d('0x55')]?JSON[_0x2a1d('0x69')](_0x461b0c[_0x2a1d('0x55')]):_0x2a1d('0x6a'));return respondWithRpcPromise(_0x2a1d('0x79'),'rejectMessage',_0x398e40);}return null;})['then'](function(_0x524619){var _0x171acf=_0x2a1d('0x6c')+_0x524619[_0x2a1d('0x29')][_0x2a1d('0x6d')];return db[_0x2a1d('0x7a')][_0x2a1d('0x3d')](_0x171acf,{'type':db[_0x2a1d('0x6e')][_0x2a1d('0x7b')][_0x2a1d('0x7c')],'raw':!![]})[_0x2a1d('0x22')](function(_0x4e8e4b){return _0x4e8e4b;});})[_0x2a1d('0x22')](function(_0x3669c2){if(_0x3669c2){_0x398e40[_0x2a1d('0x29')][_0x2a1d('0x7d')]=_0x3669c2[0x0];if(!_0x461b0c[_0x2a1d('0x55')][_0x2a1d('0x5f')])return;return db[_0x2a1d('0x6f')][_0x2a1d('0x57')]({'where':{'id':_0x461b0c[_0x2a1d('0x55')][_0x2a1d('0x5f')],'role':'agent'},'attributes':['id','name',_0x2a1d('0x70'),'email',_0x2a1d('0x71')],'raw':!![]});}return null;})[_0x2a1d('0x22')](function(_0x597ef0){if(!_0x597ef0)return null;_0x398e40['message'][_0x2a1d('0x61')]=_0x597ef0;return _0x398e40;})[_0x2a1d('0x22')](function(_0x572bda){if(_0x572bda){_0x572bda[_0x2a1d('0x29')][_0x2a1d('0x7e')]=util[_0x2a1d('0x65')](_0x2a1d('0x73'),_0x461b0c[_0x2a1d('0x60')][_0x2a1d('0x36')]);_0x572bda['message'][_0x2a1d('0x74')]=_0x398e40['channel'];_0x572bda[_0x2a1d('0x29')]['motionChannel']=_0x398e40['channel'];_0x572bda['message'][_0x2a1d('0x7f')]='reject';respondWithRpcPromise(_0x2a1d('0x80'),_0x2a1d('0x80'),{'event':_0x2a1d('0x81'),'message':_0x572bda[_0x2a1d('0x29')]},client9002);return _0x398e40;}return null;})[_0x2a1d('0x22')](respondWithResult(_0x1e2c0e,null))['catch'](handleError(_0x1e2c0e,null));};exports[_0x2a1d('0x31')]=function(_0x3b86f6,_0xa41db2,_0x584fd9){if(_0x3b86f6[_0x2a1d('0x55')]['id']){delete _0x3b86f6[_0x2a1d('0x55')]['id'];}var _0xc33897;return db[_0x2a1d('0x39')][_0x2a1d('0x57')]({'where':{'id':_0x3b86f6['params']['id']}})['then'](handleEntityNotFound(_0xa41db2,null))['then'](function(_0xb0e757){if(_0xb0e757){_0xc33897=_0xb0e757;return db['SmsAccount'][_0x2a1d('0x57')]({'where':{'id':_0xb0e757[_0x2a1d('0x82')]}});}})[_0x2a1d('0x22')](handleEntityNotFound(_0xa41db2,null))['then'](function(_0xf06e3f){if(_0xf06e3f){logger[_0x2a1d('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2a1d('0x31'),_0x2a1d('0x83'),_0xf06e3f['type'],util[_0x2a1d('0x84')](_0x3b86f6['body'],{'showHidden':![],'depth':null}));switch(_0xf06e3f['type']){case _0x2a1d('0x85'):if(_0x3b86f6[_0x2a1d('0x55')][_0x2a1d('0x86')]&&_0x3b86f6[_0x2a1d('0x55')][_0x2a1d('0x86')]===_0xc33897['messageId']){return _0xc33897[_0x2a1d('0x56')]({'read':!![]});}else{logger[_0x2a1d('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a1d('0x31'),_0x2a1d('0x85'),util[_0x2a1d('0x84')](_0x3b86f6['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3b86f6[_0x2a1d('0x55')][_0x2a1d('0x87')]&&_0x3b86f6['body'][_0x2a1d('0x87')]===_0xc33897[_0x2a1d('0x88')]&&_[_0x2a1d('0x89')](['sent',_0x2a1d('0x8a')],_0x3b86f6[_0x2a1d('0x55')]['Status'])>=0x0){return _0xc33897['update']({'read':!![]});}else{logger[_0x2a1d('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a1d('0x31'),'plivio',util[_0x2a1d('0x84')](_0x3b86f6[_0x2a1d('0x55')],{'showHidden':![],'depth':null}));}break;case _0x2a1d('0x8b'):var _0x47adad=_0x3b86f6[_0x2a1d('0x55')][_0x2a1d('0x8c')][0x0];if(_0x47adad[_0x2a1d('0x31')][_0x2a1d('0x8d')]===_0x2a1d('0x8e')){return _0xc33897[_0x2a1d('0x56')]({'read':!![]});}else{logger[_0x2a1d('0x27')](_0x2a1d('0x8f'),_0x2a1d('0x31'),_0x2a1d('0x8b'),util['inspect'](_0x3b86f6[_0x2a1d('0x55')],{'showHidden':![],'depth':null}));}break;}return _0xc33897;}})[_0x2a1d('0x22')](respondWithResult(_0xa41db2,null))[_0x2a1d('0x2a')](handleError(_0xa41db2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f4fb4f8..d7a08f1 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 _0x3d60=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2e819c,_0x3f99a5){var _0x24e271=function(_0x27d596){while(--_0x27d596){_0x2e819c['push'](_0x2e819c['shift']());}};_0x24e271(++_0x3f99a5);}(_0x3d60,0x1f1));var _0x03d6=function(_0x3c5cff,_0x3136f2){_0x3c5cff=_0x3c5cff-0x0;var _0x489f32=_0x3d60[_0x3c5cff];return _0x489f32;};'use strict';var EventEmitter=require(_0x03d6('0x0'));var SmsMessage=require(_0x03d6('0x1'))['db'][_0x03d6('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x03d6('0x3')](0x0);var events={'afterCreate':_0x03d6('0x4'),'afterUpdate':_0x03d6('0x5'),'afterDestroy':_0x03d6('0x6')};function emitEvent(_0x2c07e2){return function(_0x4c36b1,_0x2b981d,_0x229dc5){SmsMessageEvents['emit'](_0x2c07e2+':'+_0x4c36b1['id'],_0x4c36b1);SmsMessageEvents[_0x03d6('0x7')](_0x2c07e2,_0x4c36b1);_0x229dc5(null);};}for(var e in events){if(events[_0x03d6('0x8')](e)){var event=events[e];SmsMessage[_0x03d6('0x9')](e,emitEvent(event));}}module[_0x03d6('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0x95a6=['hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x13cb09,_0x2516f4){var _0x5a04af=function(_0x37e1f9){while(--_0x37e1f9){_0x13cb09['push'](_0x13cb09['shift']());}};_0x5a04af(++_0x2516f4);}(_0x95a6,0x1a9));var _0x695a=function(_0x335619,_0x2a0531){_0x335619=_0x335619-0x0;var _0x5f32bf=_0x95a6[_0x335619];return _0x5f32bf;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x695a('0x0'))['db'][_0x695a('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x695a('0x2')](0x0);var events={'afterCreate':_0x695a('0x3'),'afterUpdate':_0x695a('0x4'),'afterDestroy':_0x695a('0x5')};function emitEvent(_0x2cfd26){return function(_0x5573e1,_0x144cb9,_0x4b22d2){SmsMessageEvents['emit'](_0x2cfd26+':'+_0x5573e1['id'],_0x5573e1);SmsMessageEvents[_0x695a('0x6')](_0x2cfd26,_0x5573e1);_0x4b22d2(null);};}for(var e in events){if(events[_0x695a('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x695a('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 708700a..94712db 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 _0x27a0=['/sms/2/text/advanced','token','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','login','sender','timestamp','sort','apiKey','digest','/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','catch','error','find','type','twilio','accountSid','phone','authToken','remote','/status?token=','update','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','login?username=','username','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','skebby','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','messages','message_id','deliveryReport','clickSend','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x27a0,0x19c));var _0x027a=function(_0x5433a5,_0x24e249){_0x5433a5=_0x5433a5-0x0;var _0x2474c8=_0x27a0[_0x5433a5];return _0x2474c8;};'use strict';var _=require(_0x027a('0x0'));var util=require(_0x027a('0x1'));var logger=require(_0x027a('0x2'))(_0x027a('0x3'));var moment=require(_0x027a('0x4'));var BPromise=require(_0x027a('0x5'));var rp=require(_0x027a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x027a('0x7'));var config=require('../../config/environment');var attributes=require(_0x027a('0x8'));module[_0x027a('0x9')]=function(_0x2d37c3,_0x3f8f32){return _0x2d37c3[_0x027a('0xa')](_0x027a('0xb'),attributes,{'tableName':_0x027a('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x027a('0xd')]},{'name':'fti_sms_messages','fields':[_0x027a('0xe')],'type':_0x027a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b4198,_0x3bbf94,_0x29aec0){var _0x5c10bd=_0x2d37c3[_0x027a('0x10')];var _0x593ad9=_0x1b4198['get']({'plain':!![]});if(_0x593ad9[_0x027a('0x11')][_0x027a('0x12')]()==='in'||_0x593ad9[_0x027a('0x11')]['toLowerCase']()===_0x027a('0x13')&&!_0x593ad9[_0x027a('0x14')]&&!_[_0x027a('0x15')](_0x593ad9['UserId'])&&!_[_0x027a('0x15')](_0x593ad9[_0x027a('0x16')])){_0x5c10bd[_0x027a('0x17')][_0x027a('0x18')]({'where':{'id':_0x593ad9[_0x027a('0x16')]}})[_0x027a('0x19')](function(_0x441432){if(_0x441432){_0x441432['update']({'lastMsgAt':_0x593ad9['createdAt'],'lastMsgDirection':_0x593ad9[_0x027a('0x11')][_0x027a('0x12')]()});}})[_0x027a('0x1a')](function(_0x16ccdd){console[_0x027a('0x1b')](_0x16ccdd);});}if(_0x593ad9[_0x027a('0x11')]===_0x027a('0x13')&&!_0x593ad9[_0x027a('0x14')]){var _0x3be662;_0x5c10bd['SmsAccount'][_0x027a('0x1c')]({'where':{'id':_0x593ad9['SmsAccountId']},'raw':!![]})[_0x027a('0x19')](function(_0x54a63a){_0x3be662=_0x54a63a;if(_0x3be662&&_0x3be662[_0x027a('0x1d')]){switch(_0x3be662['type']){case _0x027a('0x1e'):var _0x3b1f97=require('twilio');if(_0x3be662[_0x027a('0x1f')]&&_0x3be662['authToken']&&_0x3be662[_0x027a('0x20')]){var _0x215050=new _0x3b1f97(_0x3be662[_0x027a('0x1f')],_0x3be662[_0x027a('0x21')]);_0x215050['messages']['create']({'body':_0x593ad9['body'],'to':_0x593ad9[_0x027a('0x20')],'from':_0x3be662['phone'],'statusCallback':_0x3be662[_0x027a('0x22')]+'/api/sms/messages/'+_0x593ad9['id']+_0x027a('0x23')+_0x3be662['token']})['then'](function(_0x5b789a){if(_0x5b789a['sid']){return _0x1b4198[_0x027a('0x24')]({'messageId':_0x5b789a[_0x027a('0x25')]});}})[_0x027a('0x1a')](function(_0xd27722){logger[_0x027a('0x1b')](_0x027a('0x26'),'afterCreate',_0x027a('0x1e'),util[_0x027a('0x27')](_0xd27722,{'showHidden':![],'depth':null}));});}else{logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x1e'),_0x027a('0x29'));}break;case'skebby':var _0x2e6420=_0x027a('0x2a');if(_0x3be662['username']&&_0x3be662[_0x027a('0x2b')]){var _0x3cb479={'recipient':[_0x593ad9[_0x027a('0x20')]],'message':_0x593ad9['body'],'message_type':_0x3be662[_0x027a('0x2c')]};if(_0x3be662['smsMethod']&&_0x3be662[_0x027a('0x2c')]!=='SI'){_0x3cb479['sender']=_0x3be662[_0x027a('0x20')];}var _0x137a3f={'url':_0x2e6420+_0x027a('0x2d')+_0x3be662[_0x027a('0x2e')]+_0x027a('0x2f')+_0x3be662[_0x027a('0x2b')],'method':_0x027a('0x30')};rp(_0x137a3f)[_0x027a('0x19')](function(_0x20d8cc){var _0xa0794a=_0x20d8cc[_0x027a('0x31')](';');var _0x3823e8={'user_key':_0xa0794a[0x0],'session_key':_0xa0794a[0x1]};_0x137a3f={'url':_0x2e6420+_0x027a('0x32'),'method':_0x027a('0x33'),'headers':{'user_key':_0x3823e8[_0x027a('0x34')],'Session_key':_0x3823e8[_0x027a('0x35')]},'json':!![],'body':_0x3cb479};return rp(_0x137a3f);})[_0x027a('0x19')](function(_0x470a2c){if(_0x470a2c[_0x027a('0x36')]>=0x1){var _0x5559c0={'messageId':_0x470a2c[_0x027a('0x37')]};if(_0x3be662['smsMethod']!=='GP'||!_0x3be662['deliveryReport']){_0x5559c0['read']=!![];}return _0x1b4198[_0x027a('0x24')](_0x5559c0);}else{return logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x38'),util['inspect'](_0x470a2c,{'showHidden':![],'depth':null}));}})[_0x027a('0x1a')](function(_0x51dd5d){return logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x38'),util[_0x027a('0x27')](_0x51dd5d,{'showHidden':![],'depth':null}));});}else{logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x38'),_0x027a('0x39'));}break;case _0x027a('0x3a'):if(_0x3be662[_0x027a('0x21')]){var _0xd02eb5={'recipient':_0x593ad9[_0x027a('0x20')],'message':_0x593ad9[_0x027a('0xe')],'sender':_0x3be662['senderString']||_0x3be662[_0x027a('0x20')],'authorization':_0x3be662['authToken']};var _0x3bbf94={'method':_0x027a('0x33'),'uri':_0x027a('0x3b'),'body':_0xd02eb5,'json':!![]};rp(_0x3bbf94)['then'](function(_0x3f6f0b){var _0x1eadb5={'messageId':_0x3f6f0b[_0x027a('0x3c')]};if(!_0x3be662['deliveryReport']){_0x1eadb5[_0x027a('0x3d')]=!![];}return _0x1b4198[_0x027a('0x24')](_0x1eadb5);})[_0x027a('0x1a')](function(_0x22fe8a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x027a('0x28'),'connectel',util[_0x027a('0x27')](_0x22fe8a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x3a'),_0x027a('0x3e'));}break;case _0x027a('0x3f'):if(_0x3be662[_0x027a('0x2e')]&&_0x3be662[_0x027a('0x2b')]){var _0xd02eb5={'messages':[{'source':_0x027a('0x40'),'to':_0x593ad9['phone'],'body':_0x593ad9[_0x027a('0xe')],'from':_0x3be662[_0x027a('0x41')]||_0x3be662[_0x027a('0x20')]}]};var _0x1991be=util[_0x027a('0x42')](_0x027a('0x43'),_0x3be662[_0x027a('0x2e')],_0x3be662[_0x027a('0x2b')]);var _0x3bbf94={'method':_0x027a('0x33'),'uri':_0x027a('0x44'),'body':_0xd02eb5,'headers':{'Authorization':util[_0x027a('0x42')](_0x027a('0x45'),new Buffer(_0x1991be)[_0x027a('0x46')](_0x027a('0x47')))},'json':!![]};rp(_0x3bbf94)['then'](function(_0x2f1bfa){if(_0x2f1bfa['http_code']>=0xc8&&_0x2f1bfa[_0x027a('0x48')]<=0xce){if(_0x2f1bfa[_0x027a('0x49')]&&_0x2f1bfa['data']['queued_count']>0x0){var _0x409309=_[_0x027a('0x4a')](_0x2f1bfa[_0x027a('0x49')][_0x027a('0x4b')]);var _0x3c5bad={'messageId':_0x409309[_0x027a('0x4c')]};if(!_0x3be662[_0x027a('0x4d')]){_0x3c5bad[_0x027a('0x3d')]=!![];}return _0x1b4198[_0x027a('0x24')](_0x3c5bad);}else{logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x4e'),util[_0x027a('0x27')](_0x2f1bfa,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x027a('0x26'),_0x027a('0x28'),'clickSend',util[_0x027a('0x27')](_0x2f1bfa,{'showHidden':![],'depth':null}));}})['catch'](function(_0x36c6d1){logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),'clickSend',util['inspect'](_0x36c6d1,{'showHidden':![],'depth':null}));});}else{logger[_0x027a('0x1b')](_0x027a('0x26'),'afterCreate',_0x027a('0x4e'),_0x027a('0x39'));}break;case'plivo':if(_0x3be662[_0x027a('0x4f')]&&_0x3be662[_0x027a('0x21')]){var _0xd02eb5={'dst':_0x593ad9['phone'],'text':_0x593ad9['body'],'src':_0x3be662['senderString']||_0x3be662[_0x027a('0x20')],'url':_0x3be662[_0x027a('0x22')]+_0x027a('0x50')+_0x593ad9['id']+_0x027a('0x23')+_0x3be662['token']};var _0x1991be=util[_0x027a('0x42')](_0x027a('0x43'),_0x3be662[_0x027a('0x4f')],_0x3be662[_0x027a('0x21')]);var _0x3bbf94={'method':_0x027a('0x33'),'uri':util[_0x027a('0x42')](_0x027a('0x51'),_0x3be662[_0x027a('0x4f')]),'body':_0xd02eb5,'headers':{'Authorization':util[_0x027a('0x42')](_0x027a('0x45'),new Buffer(_0x1991be)['toString'](_0x027a('0x47')))},'json':!![]};rp(_0x3bbf94)[_0x027a('0x19')](function(_0x569954){var _0xb697e3={'messageId':_0x569954[_0x027a('0x52')][0x0]};return _0x1b4198['update'](_0xb697e3);})['catch'](function(_0x25eb2b){logger['error'](_0x027a('0x26'),_0x027a('0x28'),'plivo',util[_0x027a('0x27')](_0x25eb2b,{'showHidden':![],'depth':null}));});}else{logger[_0x027a('0x1b')](_0x027a('0x26'),'afterCreate',_0x027a('0x53'),_0x027a('0x54'));}break;case _0x027a('0x55'):if(_0x3be662[_0x027a('0x2e')]&&_0x3be662[_0x027a('0x2b')]){if(_0x3be662['baseUrl']){var _0x1cac67={'method':_0x027a('0x33'),'uri':_0x3be662[_0x027a('0x56')]+_0x027a('0x57'),'body':{'username':_0x3be662[_0x027a('0x2e')],'password':_0x3be662[_0x027a('0x2b')]},'json':!![]};return rp(_0x1cac67)[_0x027a('0x19')](function(_0xc8024d){var _0x51ea01={'method':_0x027a('0x33'),'uri':_0x3be662[_0x027a('0x56')]+_0x027a('0x58'),'body':{'messages':[{'from':_0x3be662[_0x027a('0x20')],'destinations':[{'to':_0x593ad9[_0x027a('0x20')]}],'text':_0x593ad9['body'],'notifyUrl':_0x3be662[_0x027a('0x22')]+_0x027a('0x50')+_0x593ad9['id']+'/status?token='+_0x3be662[_0x027a('0x59')],'notifyContentType':'application/json','callbackData':_0x3be662[_0x027a('0x20')]+';'+_0x593ad9['body']}]},'headers':{'Authorization':_0x027a('0x5a')+_0xc8024d[_0x027a('0x59')]},'json':!![]};return rp(_0x51ea01)[_0x027a('0x19')](function(_0x41debe){if(_0x41debe[_0x027a('0x4b')]){var _0x2857cc={'messageId':_0x41debe[_0x027a('0x4b')][0x0][_0x027a('0xd')]};if(!_0x3be662[_0x027a('0x4d')]){_0x2857cc['read']=!![];}return _0x1b4198[_0x027a('0x24')](_0x2857cc);}else{return logger[_0x027a('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x027a('0x27')](_0x41debe,{'showHidden':![],'depth':null}));}});})[_0x027a('0x1a')](function(_0x22fb45){return logger[_0x027a('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x027a('0x55'),util[_0x027a('0x27')](_0x22fb45,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x55'),_0x027a('0x5b'));}}else{logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x55'),_0x027a('0x39'));}break;case'csc':var _0x237467=require(_0x027a('0x5c'));if(_0x3be662['apiKey']){var _0x2c4ae4={};_0x2c4ae4[_0x027a('0x5d')]=_0x3be662['username'];_0x2c4ae4[_0x027a('0x20')]=_0x593ad9[_0x027a('0x20')];_0x2c4ae4[_0x027a('0x5e')]=_0x3be662[_0x027a('0x20')];_0x2c4ae4['text']=_0x593ad9['body'];_0x2c4ae4[_0x027a('0x5f')]=+new Date();var _0x3154b8='';var _0x4eebc3='';var _0x2d3c99=Object['keys'](_0x2c4ae4);_0x2d3c99[_0x027a('0x60')]();for(var _0x460258=0x0;_0x460258<_0x2d3c99['length'];_0x460258++){if(_0x3154b8!=''){_0x3154b8+='&';}_0x3154b8+=_0x2d3c99[_0x460258]+'='+encodeURIComponent(_0x2c4ae4[_0x2d3c99[_0x460258]]);_0x4eebc3+=_0x2c4ae4[_0x2d3c99[_0x460258]];}_0x4eebc3+=_0x3be662[_0x027a('0x61')];_0x4eebc3=_0x237467['createHash']('md5')['update'](_0x4eebc3)[_0x027a('0x62')]('hex');if(_0x3154b8!==''){_0x3154b8+='&';}_0x3154b8+='signature='+_0x4eebc3;var _0x137a3f={'method':_0x027a('0x30'),'uri':_0x3be662['baseUrl']+_0x027a('0x63')+_0x3154b8,'json':!![]};return rp(_0x137a3f)['then'](function(_0x4417c7){var _0x17386a=Object[_0x027a('0x64')](_0x4417c7);if(_0x4417c7[_0x17386a[0x0]][_0x027a('0x1b')]&&parseInt(_0x4417c7[_0x17386a[0x0]][_0x027a('0x1b')])===0x0){var _0x30a687={'messageId':_0x4417c7[_0x17386a[0x0]][_0x027a('0x65')]};if(!_0x3be662[_0x027a('0x4d')]){_0x30a687[_0x027a('0x3d')]=!![];}return _0x1b4198[_0x027a('0x24')](_0x30a687);}else{return logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),'csc',util[_0x027a('0x27')](_0x4417c7[_0x027a('0x1b')],{'showHidden':![],'depth':null}));}})[_0x027a('0x1a')](function(_0x570acc){return logger[_0x027a('0x1b')](_0x027a('0x26'),'afterCreate',_0x027a('0x66'),util[_0x027a('0x27')](_0x570acc,{'showHidden':![],'depth':null}));});}else{logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x66'),_0x027a('0x67'));}break;case _0x027a('0x68'):if(_0x3be662[_0x027a('0x61')]){var _0x4ebdc9={'method':_0x027a('0x33'),'uri':_0x027a('0x69'),'headers':{'Authorization':_0x3be662[_0x027a('0x61')]},'body':{'content':_0x593ad9[_0x027a('0xe')],'to':[_0x593ad9[_0x027a('0x20')]],'from':_0x3be662[_0x027a('0x20')],'binary':![],'clientMessageId':_0x027a('0x6a'),'charset':_0x027a('0x6b')},'json':!![]};rp(_0x4ebdc9)['then'](function(_0x411295){if(!_0x411295[_0x027a('0x1b')]){var _0x2dfe1f={'messageId':_0x411295[_0x027a('0x4b')][0x0]['apiMessageId']};if(!_0x3be662[_0x027a('0x4d')]){_0x2dfe1f[_0x027a('0x3d')]=!![];}return _0x1b4198[_0x027a('0x24')](_0x2dfe1f);}else{return logger[_0x027a('0x1b')](_0x027a('0x26'),'afterCreate',_0x027a('0x68'),util[_0x027a('0x27')](_0x411295[_0x027a('0x1b')],{'showHidden':![],'depth':null}));}})[_0x027a('0x1a')](function(_0x29b4ce){return logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),'clickatell',util['inspect'](_0x29b4ce,{'showHidden':![],'depth':null}));});}else{logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x68'),_0x027a('0x67'));}break;case _0x027a('0x6c'):if(_0x3be662[_0x027a('0x2e')]&&_0x3be662['password']){var _0x1991be=util[_0x027a('0x42')]('%s:%s',_0x3be662[_0x027a('0x2e')],_0x3be662[_0x027a('0x2b')]);var _0x3bbf94={'method':_0x027a('0x33'),'uri':_0x027a('0x6d')+_0x3be662[_0x027a('0x6e')]+_0x027a('0x6f'),'body':{'to':[_0x593ad9[_0x027a('0x20')]],'text':_0x593ad9[_0x027a('0xe')],'from':_0x3be662['phone'],'applicationId':_0x3be662[_0x027a('0x70')]},'headers':{'Authorization':util[_0x027a('0x42')]('Basic\x20%s',new Buffer(_0x1991be)[_0x027a('0x46')](_0x027a('0x47')))},'json':!![]};rp(_0x3bbf94)[_0x027a('0x19')](function(_0x4e1e6a){if(_0x4e1e6a['id']){var _0x505956={'messageId':_0x4e1e6a['id']};return _0x1b4198[_0x027a('0x24')](_0x505956);}else{logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),'bandwidth',util['inspect'](_0x4e1e6a,{'showHidden':![],'depth':null}));}})[_0x027a('0x1a')](function(_0x328cd8){logger[_0x027a('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x027a('0x28'),'bandwidth',util[_0x027a('0x27')](_0x328cd8,{'showHidden':![],'depth':null}));});}else{logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x6c'),_0x027a('0x39'));}break;case _0x027a('0x71'):if(_0x3be662[_0x027a('0x61')]){var _0x47393b={};var _0x137a3f={'method':_0x027a('0x33'),'uri':_0x027a('0x72'),'headers':{'Authorization':_0x027a('0x73')+_0x3be662[_0x027a('0x61')],'Content-Type':_0x027a('0x74')},'body':{'from':_0x3be662['phone'],'to':_0x593ad9[_0x027a('0x20')],'text':_0x593ad9[_0x027a('0xe')]},'json':!![]};return rp(_0x137a3f)[_0x027a('0x19')](function(_0x41f147){if(_0x41f147[_0x027a('0x75')]==0xca){_0x47393b[_0x027a('0x76')]=_0x41f147;var _0xc262c7={'method':'POST','uri':_0x027a('0x77'),'headers':{'Authorization':_0x027a('0x73')+_0x3be662[_0x027a('0x61')],'Content-Type':'application/json'},'body':{'refid':_0x47393b[_0x027a('0x76')][_0x027a('0x78')]},'json':!![]};return rp(_0xc262c7)[_0x027a('0x19')](function(_0x3c6488){_0x47393b[_0x027a('0x79')]=_0x3c6488;var _0xc4b582={'messageId':_0x47393b['message'][_0x027a('0x78')],'read':!![]};return _0x1b4198[_0x027a('0x24')](_0xc4b582);});}else{return logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x71'),util[_0x027a('0x27')](_0x41f147,{'showHidden':![],'depth':null}));}})[_0x027a('0x1a')](function(_0x94a60){return logger[_0x027a('0x1b')](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x71'),util['inspect'](_0x94a60,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x027a('0x26'),_0x027a('0x28'),_0x027a('0x71'),_0x027a('0x7a'));}break;}}})[_0x027a('0x7b')](function(){_0x29aec0();});}else{_0x29aec0();}}},'charset':_0x027a('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf19a=['../../config/environment','./smsMessage.attributes','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','phone','smsMethod','sender','login?username=','username','&password=','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','connectel','senderString','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','apiKey','createHash','md5','digest','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x41b425,_0x5ebf84){var _0x46ce98=function(_0x3eb769){while(--_0x3eb769){_0x41b425['push'](_0x41b425['shift']());}};_0x46ce98(++_0x5ebf84);}(_0xf19a,0x76));var _0xaf19=function(_0xb746a4,_0x355bdc){_0xb746a4=_0xb746a4-0x0;var _0x4b6a58=_0xf19a[_0xb746a4];return _0x4b6a58;};'use strict';var _=require(_0xaf19('0x0'));var util=require(_0xaf19('0x1'));var logger=require(_0xaf19('0x2'))('api');var moment=require(_0xaf19('0x3'));var BPromise=require(_0xaf19('0x4'));var rp=require(_0xaf19('0x5'));var fs=require('fs');var path=require(_0xaf19('0x6'));var rimraf=require(_0xaf19('0x7'));var config=require(_0xaf19('0x8'));var attributes=require(_0xaf19('0x9'));module['exports']=function(_0x57241c,_0x11fd18){return _0x57241c['define'](_0xaf19('0xa'),attributes,{'tableName':_0xaf19('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xaf19('0xc')]},{'name':_0xaf19('0xd'),'fields':[_0xaf19('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d2a13,_0x5cd12a,_0xec1268){var _0x338fc2=_0x57241c[_0xaf19('0xf')];var _0x2e8f8e=_0x4d2a13[_0xaf19('0x10')]({'plain':!![]});if(_0x2e8f8e[_0xaf19('0x11')][_0xaf19('0x12')]()==='in'||_0x2e8f8e[_0xaf19('0x11')][_0xaf19('0x12')]()===_0xaf19('0x13')&&!_0x2e8f8e[_0xaf19('0x14')]&&!_[_0xaf19('0x15')](_0x2e8f8e[_0xaf19('0x16')])&&!_[_0xaf19('0x15')](_0x2e8f8e['SmsInteractionId'])){_0x338fc2[_0xaf19('0x17')][_0xaf19('0x18')]({'where':{'id':_0x2e8f8e['SmsInteractionId']}})[_0xaf19('0x19')](function(_0x5b3cad){if(_0x5b3cad){_0x5b3cad[_0xaf19('0x1a')]({'lastMsgAt':_0x2e8f8e[_0xaf19('0x1b')],'lastMsgDirection':_0x2e8f8e[_0xaf19('0x11')][_0xaf19('0x12')]()});}})[_0xaf19('0x1c')](function(_0x194161){console[_0xaf19('0x1d')](_0x194161);});}if(_0x2e8f8e[_0xaf19('0x11')]===_0xaf19('0x13')&&!_0x2e8f8e[_0xaf19('0x14')]){var _0x19cd2f;_0x338fc2['SmsAccount'][_0xaf19('0x1e')]({'where':{'id':_0x2e8f8e[_0xaf19('0x1f')]},'raw':!![]})[_0xaf19('0x19')](function(_0x110ec3){_0x19cd2f=_0x110ec3;if(_0x19cd2f&&_0x19cd2f[_0xaf19('0x20')]){switch(_0x19cd2f[_0xaf19('0x20')]){case _0xaf19('0x21'):var _0x18814f=require(_0xaf19('0x21'));if(_0x19cd2f[_0xaf19('0x22')]&&_0x19cd2f[_0xaf19('0x23')]&&_0x19cd2f['phone']){var _0x3d3ac3=new _0x18814f(_0x19cd2f[_0xaf19('0x22')],_0x19cd2f[_0xaf19('0x23')]);_0x3d3ac3[_0xaf19('0x24')][_0xaf19('0x25')]({'body':_0x2e8f8e[_0xaf19('0xe')],'to':_0x2e8f8e['phone'],'from':_0x19cd2f['phone'],'statusCallback':_0x19cd2f['remote']+_0xaf19('0x26')+_0x2e8f8e['id']+_0xaf19('0x27')+_0x19cd2f[_0xaf19('0x28')]})['then'](function(_0x3fcf66){if(_0x3fcf66[_0xaf19('0x29')]){return _0x4d2a13[_0xaf19('0x1a')]({'messageId':_0x3fcf66[_0xaf19('0x29')]});}})[_0xaf19('0x1c')](function(_0x1399e4){logger[_0xaf19('0x1d')](_0xaf19('0x2a'),'afterCreate',_0xaf19('0x21'),util[_0xaf19('0x2b')](_0x1399e4,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x21'),_0xaf19('0x2d'));}break;case _0xaf19('0x2e'):var _0x4a44f2=_0xaf19('0x2f');if(_0x19cd2f['username']&&_0x19cd2f[_0xaf19('0x30')]){var _0x2a0f47={'recipient':[_0x2e8f8e[_0xaf19('0x31')]],'message':_0x2e8f8e[_0xaf19('0xe')],'message_type':_0x19cd2f['smsMethod']};if(_0x19cd2f[_0xaf19('0x32')]&&_0x19cd2f[_0xaf19('0x32')]!=='SI'){_0x2a0f47[_0xaf19('0x33')]=_0x19cd2f[_0xaf19('0x31')];}var _0x3dea34={'url':_0x4a44f2+_0xaf19('0x34')+_0x19cd2f[_0xaf19('0x35')]+_0xaf19('0x36')+_0x19cd2f[_0xaf19('0x30')],'method':'GET'};rp(_0x3dea34)['then'](function(_0x5a5bf2){var _0x2e9477=_0x5a5bf2[_0xaf19('0x37')](';');var _0x1a35b6={'user_key':_0x2e9477[0x0],'session_key':_0x2e9477[0x1]};_0x3dea34={'url':_0x4a44f2+_0xaf19('0x38'),'method':_0xaf19('0x39'),'headers':{'user_key':_0x1a35b6['user_key'],'Session_key':_0x1a35b6[_0xaf19('0x3a')]},'json':!![],'body':_0x2a0f47};return rp(_0x3dea34);})[_0xaf19('0x19')](function(_0x480cc9){if(_0x480cc9[_0xaf19('0x3b')]>=0x1){var _0x56ebb5={'messageId':_0x480cc9[_0xaf19('0x3c')]};if(_0x19cd2f[_0xaf19('0x32')]!=='GP'||!_0x19cd2f[_0xaf19('0x3d')]){_0x56ebb5['read']=!![];}return _0x4d2a13[_0xaf19('0x1a')](_0x56ebb5);}else{return logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),'skebby',util['inspect'](_0x480cc9,{'showHidden':![],'depth':null}));}})[_0xaf19('0x1c')](function(_0x37bb50){return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x2e'),util[_0xaf19('0x2b')](_0x37bb50,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xaf19('0x3e'):if(_0x19cd2f['authToken']){var _0x19847b={'recipient':_0x2e8f8e[_0xaf19('0x31')],'message':_0x2e8f8e[_0xaf19('0xe')],'sender':_0x19cd2f[_0xaf19('0x3f')]||_0x19cd2f[_0xaf19('0x31')],'authorization':_0x19cd2f[_0xaf19('0x23')]};var _0x5cd12a={'method':_0xaf19('0x39'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x19847b,'json':!![]};rp(_0x5cd12a)[_0xaf19('0x19')](function(_0x5c7de9){var _0x36120c={'messageId':_0x5c7de9[_0xaf19('0x40')]};if(!_0x19cd2f['deliveryReport']){_0x36120c[_0xaf19('0x41')]=!![];}return _0x4d2a13['update'](_0x36120c);})[_0xaf19('0x1c')](function(_0x1cb7fd){logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x3e'),util[_0xaf19('0x2b')](_0x1cb7fd,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x3e'),_0xaf19('0x42'));}break;case _0xaf19('0x43'):if(_0x19cd2f['username']&&_0x19cd2f[_0xaf19('0x30')]){var _0x19847b={'messages':[{'source':_0xaf19('0x44'),'to':_0x2e8f8e[_0xaf19('0x31')],'body':_0x2e8f8e[_0xaf19('0xe')],'from':_0x19cd2f[_0xaf19('0x3f')]||_0x19cd2f[_0xaf19('0x31')]}]};var _0x5168ac=util['format']('%s:%s',_0x19cd2f['username'],_0x19cd2f[_0xaf19('0x30')]);var _0x5cd12a={'method':'POST','uri':_0xaf19('0x45'),'body':_0x19847b,'headers':{'Authorization':util[_0xaf19('0x46')](_0xaf19('0x47'),new Buffer(_0x5168ac)[_0xaf19('0x48')](_0xaf19('0x49')))},'json':!![]};rp(_0x5cd12a)['then'](function(_0x83ebd7){if(_0x83ebd7['http_code']>=0xc8&&_0x83ebd7[_0xaf19('0x4a')]<=0xce){if(_0x83ebd7['data']&&_0x83ebd7['data'][_0xaf19('0x4b')]>0x0){var _0x5e9641=_[_0xaf19('0x4c')](_0x83ebd7['data'][_0xaf19('0x24')]);var _0x446d50={'messageId':_0x5e9641[_0xaf19('0x4d')]};if(!_0x19cd2f[_0xaf19('0x3d')]){_0x446d50[_0xaf19('0x41')]=!![];}return _0x4d2a13[_0xaf19('0x1a')](_0x446d50);}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x4e'),util[_0xaf19('0x2b')](_0x83ebd7,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xaf19('0x2a'),'afterCreate',_0xaf19('0x4e'),util[_0xaf19('0x2b')](_0x83ebd7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x497ea2){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x4e'),util['inspect'](_0x497ea2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x4e'),_0xaf19('0x4f'));}break;case'plivo':if(_0x19cd2f['authId']&&_0x19cd2f[_0xaf19('0x23')]){var _0x19847b={'dst':_0x2e8f8e[_0xaf19('0x31')],'text':_0x2e8f8e[_0xaf19('0xe')],'src':_0x19cd2f[_0xaf19('0x3f')]||_0x19cd2f[_0xaf19('0x31')],'url':_0x19cd2f['remote']+_0xaf19('0x26')+_0x2e8f8e['id']+_0xaf19('0x27')+_0x19cd2f['token']};var _0x5168ac=util['format'](_0xaf19('0x50'),_0x19cd2f[_0xaf19('0x51')],_0x19cd2f['authToken']);var _0x5cd12a={'method':_0xaf19('0x39'),'uri':util[_0xaf19('0x46')](_0xaf19('0x52'),_0x19cd2f['authId']),'body':_0x19847b,'headers':{'Authorization':util[_0xaf19('0x46')](_0xaf19('0x47'),new Buffer(_0x5168ac)[_0xaf19('0x48')](_0xaf19('0x49')))},'json':!![]};rp(_0x5cd12a)['then'](function(_0x4e7988){var _0x5ef6b0={'messageId':_0x4e7988[_0xaf19('0x53')][0x0]};return _0x4d2a13[_0xaf19('0x1a')](_0x5ef6b0);})['catch'](function(_0x28b44f){logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x54'),util[_0xaf19('0x2b')](_0x28b44f,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),'afterCreate',_0xaf19('0x54'),_0xaf19('0x55'));}break;case _0xaf19('0x56'):if(_0x19cd2f[_0xaf19('0x35')]&&_0x19cd2f['password']){if(_0x19cd2f[_0xaf19('0x57')]){var _0x115a69={'method':_0xaf19('0x39'),'uri':_0x19cd2f[_0xaf19('0x57')]+_0xaf19('0x58'),'body':{'username':_0x19cd2f[_0xaf19('0x35')],'password':_0x19cd2f[_0xaf19('0x30')]},'json':!![]};return rp(_0x115a69)[_0xaf19('0x19')](function(_0x345492){var _0x58a70b={'method':_0xaf19('0x39'),'uri':_0x19cd2f[_0xaf19('0x57')]+_0xaf19('0x59'),'body':{'messages':[{'from':_0x19cd2f[_0xaf19('0x31')],'destinations':[{'to':_0x2e8f8e['phone']}],'text':_0x2e8f8e['body'],'notifyUrl':_0x19cd2f[_0xaf19('0x5a')]+'/api/sms/messages/'+_0x2e8f8e['id']+_0xaf19('0x27')+_0x19cd2f['token'],'notifyContentType':'application/json','callbackData':_0x19cd2f[_0xaf19('0x31')]+';'+_0x2e8f8e[_0xaf19('0xe')]}]},'headers':{'Authorization':_0xaf19('0x5b')+_0x345492['token']},'json':!![]};return rp(_0x58a70b)['then'](function(_0x246670){if(_0x246670[_0xaf19('0x24')]){var _0x262501={'messageId':_0x246670['messages'][0x0][_0xaf19('0xc')]};if(!_0x19cd2f[_0xaf19('0x3d')]){_0x262501[_0xaf19('0x41')]=!![];}return _0x4d2a13['update'](_0x262501);}else{return logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x56'),util[_0xaf19('0x2b')](_0x246670,{'showHidden':![],'depth':null}));}});})[_0xaf19('0x1c')](function(_0x2308cb){return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x56'),util['inspect'](_0x2308cb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x56'),_0xaf19('0x5c'));}}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x56'),_0xaf19('0x4f'));}break;case _0xaf19('0x5d'):var _0x5a6758=require(_0xaf19('0x5e'));if(_0x19cd2f['apiKey']){var _0x410810={};_0x410810[_0xaf19('0x5f')]=_0x19cd2f[_0xaf19('0x35')];_0x410810['phone']=_0x2e8f8e[_0xaf19('0x31')];_0x410810['sender']=_0x19cd2f[_0xaf19('0x31')];_0x410810[_0xaf19('0x60')]=_0x2e8f8e[_0xaf19('0xe')];_0x410810[_0xaf19('0x61')]=+new Date();var _0x13667d='';var _0x38755b='';var _0x306e69=Object[_0xaf19('0x62')](_0x410810);_0x306e69['sort']();for(var _0x329e9d=0x0;_0x329e9d<_0x306e69['length'];_0x329e9d++){if(_0x13667d!=''){_0x13667d+='&';}_0x13667d+=_0x306e69[_0x329e9d]+'='+encodeURIComponent(_0x410810[_0x306e69[_0x329e9d]]);_0x38755b+=_0x410810[_0x306e69[_0x329e9d]];}_0x38755b+=_0x19cd2f[_0xaf19('0x63')];_0x38755b=_0x5a6758[_0xaf19('0x64')](_0xaf19('0x65'))[_0xaf19('0x1a')](_0x38755b)[_0xaf19('0x66')]('hex');if(_0x13667d!==''){_0x13667d+='&';}_0x13667d+=_0xaf19('0x67')+_0x38755b;var _0x3dea34={'method':_0xaf19('0x68'),'uri':_0x19cd2f[_0xaf19('0x57')]+_0xaf19('0x69')+_0x13667d,'json':!![]};return rp(_0x3dea34)[_0xaf19('0x19')](function(_0x528541){var _0xa89ca6=Object[_0xaf19('0x62')](_0x528541);if(_0x528541[_0xa89ca6[0x0]][_0xaf19('0x1d')]&&parseInt(_0x528541[_0xa89ca6[0x0]][_0xaf19('0x1d')])===0x0){var _0x1f0357={'messageId':_0x528541[_0xa89ca6[0x0]][_0xaf19('0x6a')]};if(!_0x19cd2f[_0xaf19('0x3d')]){_0x1f0357[_0xaf19('0x41')]=!![];}return _0x4d2a13[_0xaf19('0x1a')](_0x1f0357);}else{return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x5d'),util[_0xaf19('0x2b')](_0x528541[_0xaf19('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x79cad9){return logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x5d'),util[_0xaf19('0x2b')](_0x79cad9,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x5d'),_0xaf19('0x6b'));}break;case _0xaf19('0x6c'):if(_0x19cd2f['apiKey']){var _0x33f660={'method':'POST','uri':_0xaf19('0x6d'),'headers':{'Authorization':_0x19cd2f[_0xaf19('0x63')]},'body':{'content':_0x2e8f8e[_0xaf19('0xe')],'to':[_0x2e8f8e[_0xaf19('0x31')]],'from':_0x19cd2f[_0xaf19('0x31')],'binary':![],'clientMessageId':_0xaf19('0x6e'),'charset':_0xaf19('0x6f')},'json':!![]};rp(_0x33f660)[_0xaf19('0x19')](function(_0x289b89){if(!_0x289b89[_0xaf19('0x1d')]){var _0x70f975={'messageId':_0x289b89['messages'][0x0][_0xaf19('0x70')]};if(!_0x19cd2f[_0xaf19('0x3d')]){_0x70f975['read']=!![];}return _0x4d2a13['update'](_0x70f975);}else{return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x6c'),util[_0xaf19('0x2b')](_0x289b89[_0xaf19('0x1d')],{'showHidden':![],'depth':null}));}})[_0xaf19('0x1c')](function(_0x1b3619){return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x6c'),util['inspect'](_0x1b3619,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),'clickatell',_0xaf19('0x6b'));}break;case _0xaf19('0x71'):if(_0x19cd2f[_0xaf19('0x35')]&&_0x19cd2f[_0xaf19('0x30')]){var _0x5168ac=util[_0xaf19('0x46')](_0xaf19('0x50'),_0x19cd2f[_0xaf19('0x35')],_0x19cd2f[_0xaf19('0x30')]);var _0x5cd12a={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x19cd2f[_0xaf19('0x72')]+_0xaf19('0x73'),'body':{'to':[_0x2e8f8e[_0xaf19('0x31')]],'text':_0x2e8f8e[_0xaf19('0xe')],'from':_0x19cd2f[_0xaf19('0x31')],'applicationId':_0x19cd2f[_0xaf19('0x74')]},'headers':{'Authorization':util[_0xaf19('0x46')](_0xaf19('0x47'),new Buffer(_0x5168ac)[_0xaf19('0x48')](_0xaf19('0x49')))},'json':!![]};rp(_0x5cd12a)[_0xaf19('0x19')](function(_0x9fd17d){if(_0x9fd17d['id']){var _0x26dcd8={'messageId':_0x9fd17d['id']};return _0x4d2a13[_0xaf19('0x1a')](_0x26dcd8);}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),'bandwidth',util['inspect'](_0x9fd17d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x30bd79){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),'bandwidth',util[_0xaf19('0x2b')](_0x30bd79,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x71'),_0xaf19('0x4f'));}break;case _0xaf19('0x75'):if(_0x19cd2f[_0xaf19('0x63')]){var _0x2e4273={};var _0x3dea34={'method':'POST','uri':_0xaf19('0x76'),'headers':{'Authorization':_0xaf19('0x77')+_0x19cd2f[_0xaf19('0x63')],'Content-Type':_0xaf19('0x78')},'body':{'from':_0x19cd2f[_0xaf19('0x31')],'to':_0x2e8f8e[_0xaf19('0x31')],'text':_0x2e8f8e[_0xaf19('0xe')]},'json':!![]};return rp(_0x3dea34)[_0xaf19('0x19')](function(_0x4f300a){if(_0x4f300a['code']==0xca){_0x2e4273[_0xaf19('0x79')]=_0x4f300a;var _0x306a77={'method':_0xaf19('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xaf19('0x77')+_0x19cd2f[_0xaf19('0x63')],'Content-Type':'application/json'},'body':{'refid':_0x2e4273['message'][_0xaf19('0x7a')]},'json':!![]};return rp(_0x306a77)[_0xaf19('0x19')](function(_0x2c0f17){_0x2e4273['status']=_0x2c0f17;var _0x113561={'messageId':_0x2e4273['message']['refid'],'read':!![]};return _0x4d2a13[_0xaf19('0x1a')](_0x113561);});}else{return logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x75'),util[_0xaf19('0x2b')](_0x4f300a,{'showHidden':![],'depth':null}));}})[_0xaf19('0x1c')](function(_0x4e16d8){return logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x75'),util[_0xaf19('0x2b')](_0x4e16d8,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x75'),_0xaf19('0x7b'));}break;}}})['finally'](function(){_0xec1268();});}else{_0xec1268();}}},'charset':_0xaf19('0x7c'),'collate':_0xaf19('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 1397776..9648f1b 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 _0x3f87=['./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x46a5fa,_0x5d755a){var _0x5f5291=function(_0x36d09b){while(--_0x36d09b){_0x46a5fa['push'](_0x46a5fa['shift']());}};_0x5f5291(++_0x5d755a);}(_0x3f87,0x73));var _0x73f8=function(_0x111914,_0x2a83bc){_0x111914=_0x111914-0x0;var _0x576501=_0x3f87[_0x111914];return _0x576501;};'use strict';var _=require(_0x73f8('0x0'));var util=require(_0x73f8('0x1'));var moment=require(_0x73f8('0x2'));var BPromise=require(_0x73f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73f8('0x4'));var db=require(_0x73f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x73f8('0x6'));var config=require('../../config/environment');var jayson=require(_0x73f8('0x7'));var client=jayson[_0x73f8('0x8')][_0x73f8('0x9')]({'port':0x232a});config[_0x73f8('0xa')]=_[_0x73f8('0xb')](config[_0x73f8('0xa')],{'host':_0x73f8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73f8('0xa')]));require(_0x73f8('0xd'))[_0x73f8('0xe')](socket);function respondWithRpcPromise(_0x11f4d0,_0x7f7db5,_0x186058){return new BPromise(function(_0x271f4d,_0x44742f){return client[_0x73f8('0xf')](_0x11f4d0,_0x186058)[_0x73f8('0x10')](function(_0xd6c2dc){logger[_0x73f8('0x11')](_0x73f8('0x12'),_0x7f7db5,'request\x20sent');logger[_0x73f8('0x13')](_0x73f8('0x14'),_0x7f7db5,'request\x20sent',JSON['stringify'](_0xd6c2dc));if(_0xd6c2dc[_0x73f8('0x15')]){if(_0xd6c2dc[_0x73f8('0x15')][_0x73f8('0x16')]===0x1f4){logger[_0x73f8('0x15')](_0x73f8('0x12'),_0x7f7db5,_0xd6c2dc[_0x73f8('0x15')]['message']);return _0x44742f(_0xd6c2dc['error']['message']);}logger[_0x73f8('0x15')](_0x73f8('0x12'),_0x7f7db5,_0xd6c2dc[_0x73f8('0x15')][_0x73f8('0x17')]);return _0x271f4d(_0xd6c2dc[_0x73f8('0x15')]['message']);}else{logger[_0x73f8('0x11')](_0x73f8('0x12'),_0x7f7db5,'request\x20sent');_0x271f4d(_0xd6c2dc[_0x73f8('0x18')][_0x73f8('0x17')]);}})[_0x73f8('0x19')](function(_0x985a24){logger['error'](_0x73f8('0x12'),_0x7f7db5,_0x985a24);_0x44742f(_0x985a24);});});}exports[_0x73f8('0x1a')]=function(_0x4e80c6){var _0x5d323e=this;return new Promise(function(_0x1d8490,_0x5539ae){return db['SmsMessage'][_0x73f8('0x1b')](_0x4e80c6[_0x73f8('0x1c')],{'raw':_0x4e80c6[_0x73f8('0x1d')]?_0x4e80c6['options'][_0x73f8('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4673d5){logger[_0x73f8('0x11')](_0x73f8('0x1a'),_0x4e80c6);logger[_0x73f8('0x13')]('CreateSmsMessage',_0x4e80c6,JSON[_0x73f8('0x1f')](_0x4673d5));_0x1d8490(_0x4673d5);})[_0x73f8('0x19')](function(_0x2f9bd6){logger[_0x73f8('0x15')](_0x73f8('0x1a'),_0x2f9bd6['message'],_0x4e80c6);_0x5539ae(_0x5d323e[_0x73f8('0x15')](0x1f4,_0x2f9bd6['message']));});});}; \ No newline at end of file +var _0x5b21=['error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./smsMessage.socket','register','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21163b,_0x30996b){var _0x4bb3a2=function(_0x357b2f){while(--_0x357b2f){_0x21163b['push'](_0x21163b['shift']());}};_0x4bb3a2(++_0x30996b);}(_0x5b21,0x125));var _0x15b2=function(_0xd4f0af,_0x4bb3af){_0xd4f0af=_0xd4f0af-0x0;var _0x32f6fb=_0x5b21[_0xd4f0af];return _0x32f6fb;};'use strict';var _=require(_0x15b2('0x0'));var util=require(_0x15b2('0x1'));var moment=require(_0x15b2('0x2'));var BPromise=require(_0x15b2('0x3'));var rs=require(_0x15b2('0x4'));var fs=require('fs');var Redis=require(_0x15b2('0x5'));var db=require(_0x15b2('0x6'))['db'];var utils=require(_0x15b2('0x7'));var logger=require(_0x15b2('0x8'))(_0x15b2('0x9'));var config=require(_0x15b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x15b2('0xb')]['http']({'port':0x232a});config[_0x15b2('0xc')]=_[_0x15b2('0xd')](config[_0x15b2('0xc')],{'host':_0x15b2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15b2('0xc')]));require(_0x15b2('0xf'))[_0x15b2('0x10')](socket);function respondWithRpcPromise(_0x12b6d3,_0x2b49d6,_0x2ba4fe){return new BPromise(function(_0x30e241,_0x4e3c41){return client['request'](_0x12b6d3,_0x2ba4fe)[_0x15b2('0x11')](function(_0x44f88f){logger[_0x15b2('0x12')]('SmsMessage,\x20%s,\x20%s',_0x2b49d6,_0x15b2('0x13'));logger['debug'](_0x15b2('0x14'),_0x2b49d6,'request\x20sent',JSON[_0x15b2('0x15')](_0x44f88f));if(_0x44f88f[_0x15b2('0x16')]){if(_0x44f88f[_0x15b2('0x16')][_0x15b2('0x17')]===0x1f4){logger[_0x15b2('0x16')](_0x15b2('0x18'),_0x2b49d6,_0x44f88f[_0x15b2('0x16')]['message']);return _0x4e3c41(_0x44f88f['error'][_0x15b2('0x19')]);}logger[_0x15b2('0x16')]('SmsMessage,\x20%s,\x20%s',_0x2b49d6,_0x44f88f[_0x15b2('0x16')][_0x15b2('0x19')]);return _0x30e241(_0x44f88f[_0x15b2('0x16')][_0x15b2('0x19')]);}else{logger[_0x15b2('0x12')](_0x15b2('0x18'),_0x2b49d6,'request\x20sent');_0x30e241(_0x44f88f[_0x15b2('0x1a')]['message']);}})[_0x15b2('0x1b')](function(_0x6be998){logger[_0x15b2('0x16')](_0x15b2('0x18'),_0x2b49d6,_0x6be998);_0x4e3c41(_0x6be998);});});}exports['CreateSmsMessage']=function(_0x77f4e5){var _0x3797e2=this;return new Promise(function(_0x3fc9df,_0x36c133){return db[_0x15b2('0x1c')][_0x15b2('0x1d')](_0x77f4e5[_0x15b2('0x1e')],{'raw':_0x77f4e5[_0x15b2('0x1f')]?_0x77f4e5['options'][_0x15b2('0x20')]===undefined?!![]:![]:!![]})[_0x15b2('0x11')](function(_0x1700f4){logger['info'](_0x15b2('0x21'),_0x77f4e5);logger[_0x15b2('0x22')]('CreateSmsMessage',_0x77f4e5,JSON['stringify'](_0x1700f4));_0x3fc9df(_0x1700f4);})[_0x15b2('0x1b')](function(_0x2869b5){logger['error']('CreateSmsMessage',_0x2869b5['message'],_0x77f4e5);_0x36c133(_0x3797e2[_0x15b2('0x16')](0x1f4,_0x2869b5[_0x15b2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index beb1148..19182b3 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 _0x92ea=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','remove'];(function(_0x2c3872,_0x546554){var _0x173d19=function(_0x130339){while(--_0x130339){_0x2c3872['push'](_0x2c3872['shift']());}};_0x173d19(++_0x546554);}(_0x92ea,0x1c6));var _0xa92e=function(_0x3c45de,_0x1f0979){_0x3c45de=_0x3c45de-0x0;var _0x270350=_0x92ea[_0x3c45de];return _0x270350;};'use strict';var SmsMessageEvents=require(_0xa92e('0x0'));var events=['save',_0xa92e('0x1'),_0xa92e('0x2')];function createListener(_0x16bbc2,_0xc6f47e){return function(_0x15f10b){_0xc6f47e[_0xa92e('0x3')](_0x16bbc2,_0x15f10b);};}function removeListener(_0x4b9944,_0x27e7d9){return function(){SmsMessageEvents[_0xa92e('0x4')](_0x4b9944,_0x27e7d9);};}exports[_0xa92e('0x5')]=function(_0x3a9258){for(var _0x393a0d=0x0,_0x25bfbb=events[_0xa92e('0x6')];_0x393a0d<_0x25bfbb;_0x393a0d++){var _0x535bc7=events[_0x393a0d];var _0x535a3e=createListener(_0xa92e('0x7')+_0x535bc7,_0x3a9258);SmsMessageEvents['on'](_0x535bc7,_0x535a3e);}}; \ No newline at end of file +var _0xf155=['save','remove','emit','removeListener','register','length','smsMessage:'];(function(_0x22f8be,_0xce6014){var _0x13389a=function(_0x2d1fdf){while(--_0x2d1fdf){_0x22f8be['push'](_0x22f8be['shift']());}};_0x13389a(++_0xce6014);}(_0xf155,0x111));var _0x5f15=function(_0xe7d561,_0x146cef){_0xe7d561=_0xe7d561-0x0;var _0x4c27f0=_0xf155[_0xe7d561];return _0x4c27f0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x5f15('0x0'),_0x5f15('0x1'),'update'];function createListener(_0x398804,_0x3ec44b){return function(_0x18179d){_0x3ec44b[_0x5f15('0x2')](_0x398804,_0x18179d);};}function removeListener(_0x57e1dd,_0x4a9006){return function(){SmsMessageEvents[_0x5f15('0x3')](_0x57e1dd,_0x4a9006);};}exports[_0x5f15('0x4')]=function(_0x45cf97){for(var _0x3018cf=0x0,_0x40b100=events[_0x5f15('0x5')];_0x3018cf<_0x40b100;_0x3018cf++){var _0xd142e9=events[_0x3018cf];var _0x1ed121=createListener(_0x5f15('0x6')+_0xd142e9,_0x45cf97);SmsMessageEvents['on'](_0xd142e9,_0x1ed121);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 297de15..b9193e6 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 _0xf359=['isAuthenticated','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','/:id','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueue.controller','get','/describe'];(function(_0x16c083,_0x20476d){var _0x31c5e9=function(_0x541ce3){while(--_0x541ce3){_0x16c083['push'](_0x16c083['shift']());}};_0x31c5e9(++_0x20476d);}(_0xf359,0xe9));var _0x9f35=function(_0x5984a5,_0x487391){_0x5984a5=_0x5984a5-0x0;var _0x4e3e31=_0xf359[_0x5984a5];return _0x4e3e31;};'use strict';var multer=require(_0x9f35('0x0'));var util=require(_0x9f35('0x1'));var path=require('path');var timeout=require(_0x9f35('0x2'));var express=require(_0x9f35('0x3'));var router=express[_0x9f35('0x4')]();var fs_extra=require(_0x9f35('0x5'));var auth=require(_0x9f35('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f35('0x7'));router[_0x9f35('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9f35('0x9'),auth[_0x9f35('0xa')](),controller[_0x9f35('0xb')]);router[_0x9f35('0x8')]('/:id',auth[_0x9f35('0xa')](),controller['show']);router[_0x9f35('0x8')](_0x9f35('0xc'),auth[_0x9f35('0xa')](),controller[_0x9f35('0xd')]);router[_0x9f35('0x8')](_0x9f35('0xe'),auth[_0x9f35('0xa')](),controller[_0x9f35('0xf')]);router[_0x9f35('0x8')](_0x9f35('0x10'),auth[_0x9f35('0xa')](),controller[_0x9f35('0x11')]);router[_0x9f35('0x12')]('/',auth[_0x9f35('0xa')](),controller['create']);router[_0x9f35('0x12')]('/:id/teams',auth[_0x9f35('0xa')](),controller[_0x9f35('0x13')]);router['post'](_0x9f35('0x10'),auth[_0x9f35('0xa')](),controller['addAgents']);router[_0x9f35('0x14')](_0x9f35('0x15'),auth[_0x9f35('0xa')](),controller['update']);router['delete'](_0x9f35('0x15'),auth[_0x9f35('0xa')](),controller[_0x9f35('0x16')]);router[_0x9f35('0x17')](_0x9f35('0xe'),auth[_0x9f35('0xa')](),controller[_0x9f35('0x18')]);router[_0x9f35('0x17')]('/:id/users',auth[_0x9f35('0xa')](),controller[_0x9f35('0x19')]);module[_0x9f35('0x1a')]=router; \ No newline at end of file +var _0xd60d=['put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents'];(function(_0x300b26,_0x3a9b67){var _0x5cb1ae=function(_0x2b8e7f){while(--_0x2b8e7f){_0x300b26['push'](_0x300b26['shift']());}};_0x5cb1ae(++_0x3a9b67);}(_0xd60d,0xff));var _0xdd60=function(_0x18361a,_0x8a987b){_0x18361a=_0x18361a-0x0;var _0x41ac69=_0xd60d[_0x18361a];return _0x41ac69;};'use strict';var multer=require(_0xdd60('0x0'));var util=require(_0xdd60('0x1'));var path=require('path');var timeout=require(_0xdd60('0x2'));var express=require('express');var router=express[_0xdd60('0x3')]();var fs_extra=require(_0xdd60('0x4'));var auth=require(_0xdd60('0x5'));var interaction=require(_0xdd60('0x6'));var config=require(_0xdd60('0x7'));var controller=require('./smsQueue.controller');router[_0xdd60('0x8')]('/',auth[_0xdd60('0x9')](),controller[_0xdd60('0xa')]);router[_0xdd60('0x8')](_0xdd60('0xb'),auth[_0xdd60('0x9')](),controller[_0xdd60('0xc')]);router['get'](_0xdd60('0xd'),auth[_0xdd60('0x9')](),controller[_0xdd60('0xe')]);router[_0xdd60('0x8')](_0xdd60('0xf'),auth['isAuthenticated'](),controller[_0xdd60('0x10')]);router[_0xdd60('0x8')](_0xdd60('0x11'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x12')]);router[_0xdd60('0x8')]('/:id/users',auth[_0xdd60('0x9')](),controller['getAgents']);router[_0xdd60('0x13')]('/',auth[_0xdd60('0x9')](),controller[_0xdd60('0x14')]);router[_0xdd60('0x13')](_0xdd60('0x11'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x15')]);router[_0xdd60('0x13')](_0xdd60('0x16'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x17')]);router[_0xdd60('0x18')](_0xdd60('0xd'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x19')]);router[_0xdd60('0x1a')](_0xdd60('0xd'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x1b')]);router[_0xdd60('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdd60('0x1c')]);router[_0xdd60('0x1a')]('/:id/users',auth[_0xdd60('0x9')](),controller[_0xdd60('0x1d')]);module[_0xdd60('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index d5e1006..d9257b5 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 _0x67c6=['sequelize','exports','name','rrmemory','beepall','roundrobin'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x67c6,0x180));var _0x667c=function(_0x2e6dec,_0x436b65){_0x2e6dec=_0x2e6dec-0x0;var _0xed156=_0x67c6[_0x2e6dec];return _0xed156;};'use strict';var Sequelize=require(_0x667c('0x0'));module[_0x667c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x667c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x667c('0x3'),_0x667c('0x4'),_0x667c('0x5'))}}; \ No newline at end of file +var _0x1e2c=['STRING','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x2778b2,_0x2aaeba){var _0x1b77bc=function(_0x3bca8f){while(--_0x3bca8f){_0x2778b2['push'](_0x2778b2['shift']());}};_0x1b77bc(++_0x2aaeba);}(_0x1e2c,0xd0));var _0xc1e2=function(_0xd8acea,_0x58cf28){_0xd8acea=_0xd8acea-0x0;var _0x2eb579=_0x1e2c[_0xd8acea];return _0x2eb579;};'use strict';var Sequelize=require(_0xc1e2('0x0'));module[_0xc1e2('0x1')]={'name':{'type':Sequelize[_0xc1e2('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc1e2('0x2')]},'timeout':{'type':Sequelize[_0xc1e2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc1e2('0x4')](_0xc1e2('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 44c3a3a..b7fea04 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 _0x0f97=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','name','index','map','SmsQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','describe','findOne','UserSmsQueue','options','User','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','Team','Agents','online','voicePause','interface','sequelize','each','findOrCreate','emit','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','forEach','userSmsQueue:remove','addAgents','spread','getAgents','nolimit','eml-format','rimraf'];(function(_0x4b2617,_0x1bb529){var _0x31ac19=function(_0x31e145){while(--_0x31e145){_0x4b2617['push'](_0x4b2617['shift']());}};_0x31ac19(++_0x1bb529);}(_0x0f97,0x196));var _0x70f9=function(_0x5f50b5,_0xa8db83){_0x5f50b5=_0x5f50b5-0x0;var _0x54c383=_0x0f97[_0x5f50b5];return _0x54c383;};'use strict';var emlformat=require(_0x70f9('0x0'));var rimraf=require(_0x70f9('0x1'));var zipdir=require(_0x70f9('0x2'));var jsonpatch=require(_0x70f9('0x3'));var rp=require(_0x70f9('0x4'));var moment=require(_0x70f9('0x5'));var BPromise=require(_0x70f9('0x6'));var Mustache=require(_0x70f9('0x7'));var util=require(_0x70f9('0x8'));var path=require(_0x70f9('0x9'));var sox=require(_0x70f9('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70f9('0xb'));var _=require(_0x70f9('0xc'));var squel=require(_0x70f9('0xd'));var crypto=require(_0x70f9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x70f9('0xf'));var querystring=require(_0x70f9('0x10'));var Papa=require(_0x70f9('0x11'));var Redis=require(_0x70f9('0x12'));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(_0x70f9('0x13'))(_0x70f9('0x14'));var utils=require(_0x70f9('0x15'));var config=require(_0x70f9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x70f9('0x17'))['db'];config[_0x70f9('0x18')]=_[_0x70f9('0x19')](config[_0x70f9('0x18')],{'host':_0x70f9('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70f9('0x18')]));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x4879b4,_0x4f1ba0){_0x4f1ba0=_0x4f1ba0||0xcc;return function(_0x30b651){if(_0x30b651){return _0x4879b4['sendStatus'](_0x4f1ba0);}return _0x4879b4[_0x70f9('0x1b')](_0x4f1ba0)[_0x70f9('0x1c')]();};}function respondWithResult(_0x138a8e,_0x3ce5ed){_0x3ce5ed=_0x3ce5ed||0xc8;return function(_0x25b88f){if(_0x25b88f){return _0x138a8e[_0x70f9('0x1b')](_0x3ce5ed)[_0x70f9('0x1d')](_0x25b88f);}};}function respondWithFilteredResult(_0x344590,_0x3a21d9){return function(_0x4b6e93){if(_0x4b6e93){var _0x59d036=typeof _0x3a21d9[_0x70f9('0x1e')]==='undefined'&&typeof _0x3a21d9[_0x70f9('0x1f')]===_0x70f9('0x20');var _0x1cc58c=_0x4b6e93[_0x70f9('0x21')];var _0x4e7cce=_0x59d036?0x0:_0x3a21d9['offset'];var _0x14de5c=_0x59d036?_0x4b6e93[_0x70f9('0x21')]:_0x3a21d9[_0x70f9('0x1e')]+_0x3a21d9[_0x70f9('0x1f')];var _0x4b87c8;if(_0x14de5c>=_0x1cc58c){_0x14de5c=_0x1cc58c;_0x4b87c8=0xc8;}else{_0x4b87c8=0xce;}_0x344590[_0x70f9('0x1b')](_0x4b87c8);return _0x344590['set'](_0x70f9('0x22'),_0x4e7cce+'-'+_0x14de5c+'/'+_0x1cc58c)[_0x70f9('0x1d')](_0x4b6e93);}return null;};}function patchUpdates(_0x3ce965){return function(_0x334fdc){try{jsonpatch[_0x70f9('0x23')](_0x334fdc,_0x3ce965,!![]);}catch(_0x4ae0c9){return BPromise[_0x70f9('0x24')](_0x4ae0c9);}return _0x334fdc[_0x70f9('0x25')]();};}function saveUpdates(_0x388f13,_0x5d5372){return function(_0x47057b){if(_0x47057b){return _0x47057b[_0x70f9('0x26')](_0x388f13)[_0x70f9('0x27')](function(_0x3c3051){return _0x3c3051;});}return null;};}function removeEntity(_0x2a9c4b,_0x49337a){return function(_0x3a8209){if(_0x3a8209){return _0x3a8209[_0x70f9('0x28')]()[_0x70f9('0x27')](function(){var _0x386ded=_0x3a8209[_0x70f9('0x29')]({'plain':!![]});var _0xfe324e='SmsQueues';return db[_0x70f9('0x2a')][_0x70f9('0x28')]({'where':{'type':_0xfe324e,'resourceId':_0x386ded['id']}})[_0x70f9('0x27')](function(){return _0x3a8209;});})[_0x70f9('0x27')](function(){_0x2a9c4b[_0x70f9('0x1b')](0xcc)[_0x70f9('0x1c')]();});}};}function handleEntityNotFound(_0x3e29b9,_0x28a8c6){return function(_0x562b72){if(!_0x562b72){_0x3e29b9['sendStatus'](0x194);}return _0x562b72;};}function handleError(_0xd56d2d,_0x428646){_0x428646=_0x428646||0x1f4;return function(_0x2f805a){logger['error'](_0x2f805a['stack']);if(_0x2f805a[_0x70f9('0x2b')]){delete _0x2f805a[_0x70f9('0x2b')];}_0xd56d2d['status'](_0x428646)['send'](_0x2f805a);};}exports[_0x70f9('0x2c')]=function(_0x17cf3f,_0x4c4a14){var _0x2a8cc9={},_0x227845={},_0x47a7d7={'count':0x0,'rows':[]};var _0x8bc855=_[_0x70f9('0x2d')](db[_0x70f9('0x2e')]['rawAttributes'],function(_0xa93f4a){return{'name':_0xa93f4a[_0x70f9('0x2f')],'type':_0xa93f4a['type'][_0x70f9('0x30')]};});_0x227845[_0x70f9('0x31')]=_['map'](_0x8bc855,_0x70f9('0x2b'));_0x227845[_0x70f9('0x32')]=_[_0x70f9('0x33')](_0x17cf3f[_0x70f9('0x32')]);_0x227845[_0x70f9('0x34')]=_[_0x70f9('0x35')](_0x227845[_0x70f9('0x31')],_0x227845['query']);_0x2a8cc9[_0x70f9('0x36')]=_[_0x70f9('0x35')](_0x227845[_0x70f9('0x31')],qs[_0x70f9('0x37')](_0x17cf3f[_0x70f9('0x32')][_0x70f9('0x37')]));_0x2a8cc9['attributes']=_0x2a8cc9[_0x70f9('0x36')][_0x70f9('0x38')]?_0x2a8cc9['attributes']:_0x227845[_0x70f9('0x31')];if(!_0x17cf3f['query'][_0x70f9('0x39')]('nolimit')){_0x2a8cc9[_0x70f9('0x1f')]=qs[_0x70f9('0x1f')](_0x17cf3f[_0x70f9('0x32')][_0x70f9('0x1f')]);_0x2a8cc9[_0x70f9('0x1e')]=qs[_0x70f9('0x1e')](_0x17cf3f[_0x70f9('0x32')][_0x70f9('0x1e')]);}_0x2a8cc9[_0x70f9('0x3a')]=qs[_0x70f9('0x3b')](_0x17cf3f['query'][_0x70f9('0x3b')]);_0x2a8cc9[_0x70f9('0x3c')]=qs[_0x70f9('0x34')](_[_0x70f9('0x3d')](_0x17cf3f[_0x70f9('0x32')],_0x227845[_0x70f9('0x34')]),_0x8bc855);if(_0x17cf3f['query'][_0x70f9('0x3e')]){_0x2a8cc9[_0x70f9('0x3c')]=_[_0x70f9('0x3f')](_0x2a8cc9[_0x70f9('0x3c')],{'$or':_[_0x70f9('0x2d')](_0x8bc855,function(_0x4e75c5){if(_0x4e75c5[_0x70f9('0x40')]!=='VIRTUAL'){var _0x8ca1a6={};_0x8ca1a6[_0x4e75c5['name']]={'$like':'%'+_0x17cf3f[_0x70f9('0x32')]['filter']+'%'};return _0x8ca1a6;}})});}_0x2a8cc9=_[_0x70f9('0x3f')]({},_0x2a8cc9,_0x17cf3f['options']);var _0x5e1292={'where':_0x2a8cc9[_0x70f9('0x3c')]};return db['SmsQueue'][_0x70f9('0x21')](_0x5e1292)['then'](function(_0x70e4a7){_0x47a7d7[_0x70f9('0x21')]=_0x70e4a7;if(_0x17cf3f[_0x70f9('0x32')]['includeAll']){_0x2a8cc9['include']=[{'all':!![]}];}return db[_0x70f9('0x2e')][_0x70f9('0x41')](_0x2a8cc9);})['then'](function(_0x29d827){_0x47a7d7[_0x70f9('0x42')]=_0x29d827;return _0x47a7d7;})[_0x70f9('0x27')](respondWithFilteredResult(_0x4c4a14,_0x2a8cc9))[_0x70f9('0x43')](handleError(_0x4c4a14,null));};exports[_0x70f9('0x44')]=function(_0x69485a,_0x1e4008){var _0x49d466={'raw':!![],'where':{'id':_0x69485a[_0x70f9('0x45')]['id']}},_0x49a7af={};_0x49a7af[_0x70f9('0x31')]=_[_0x70f9('0x33')](db['SmsQueue'][_0x70f9('0x46')]);_0x49a7af[_0x70f9('0x32')]=_[_0x70f9('0x33')](_0x69485a[_0x70f9('0x32')]);_0x49a7af[_0x70f9('0x34')]=_[_0x70f9('0x35')](_0x49a7af['model'],_0x49a7af[_0x70f9('0x32')]);_0x49d466[_0x70f9('0x36')]=_[_0x70f9('0x35')](_0x49a7af[_0x70f9('0x31')],qs['fields'](_0x69485a[_0x70f9('0x32')]['fields']));_0x49d466[_0x70f9('0x36')]=_0x49d466['attributes'][_0x70f9('0x38')]?_0x49d466[_0x70f9('0x36')]:_0x49a7af[_0x70f9('0x31')];if(_0x69485a[_0x70f9('0x32')][_0x70f9('0x47')]){_0x49d466['include']=[{'all':!![]}];}_0x49d466=_[_0x70f9('0x3f')]({},_0x49d466,_0x69485a['options']);return db[_0x70f9('0x2e')][_0x70f9('0x48')](_0x49d466)[_0x70f9('0x27')](handleEntityNotFound(_0x1e4008,null))[_0x70f9('0x27')](respondWithResult(_0x1e4008,null))[_0x70f9('0x43')](handleError(_0x1e4008,null));};exports['create']=function(_0x8bc338,_0x580ac4){return db['SmsQueue'][_0x70f9('0x49')](_0x8bc338[_0x70f9('0x4a')],{})['then'](function(_0x128bb6){var _0x175083=_0x8bc338[_0x70f9('0x4b')][_0x70f9('0x29')]({'plain':!![]});if(!_0x175083)throw new Error(_0x70f9('0x4c'));if(_0x175083[_0x70f9('0x4d')]===_0x70f9('0x4b')){var _0x344f7c=_0x128bb6[_0x70f9('0x29')]({'plain':!![]});var _0x1adb3d='SmsQueues';return db[_0x70f9('0x4e')][_0x70f9('0x48')]({'where':{'name':_0x1adb3d,'userProfileId':_0x175083['userProfileId']},'raw':!![]})[_0x70f9('0x27')](function(_0x28b50e){if(_0x28b50e&&_0x28b50e[_0x70f9('0x4f')]===0x0){return db[_0x70f9('0x2a')]['create']({'name':_0x344f7c[_0x70f9('0x2b')],'resourceId':_0x344f7c['id'],'type':_0x28b50e['name'],'sectionId':_0x28b50e['id']},{})[_0x70f9('0x27')](function(){return _0x128bb6;});}else{return _0x128bb6;}})[_0x70f9('0x43')](function(_0x2825cd){logger[_0x70f9('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2825cd);throw _0x2825cd;});}return _0x128bb6;})['then'](respondWithResult(_0x580ac4,0xc9))[_0x70f9('0x43')](handleError(_0x580ac4,null));};exports['update']=function(_0xab9755,_0xeab778){if(_0xab9755[_0x70f9('0x4a')]['id']){delete _0xab9755['body']['id'];}return db[_0x70f9('0x2e')][_0x70f9('0x48')]({'where':{'id':_0xab9755[_0x70f9('0x45')]['id']}})[_0x70f9('0x27')](handleEntityNotFound(_0xeab778,null))[_0x70f9('0x27')](saveUpdates(_0xab9755[_0x70f9('0x4a')],null))[_0x70f9('0x27')](respondWithResult(_0xeab778,null))[_0x70f9('0x43')](handleError(_0xeab778,null));};exports[_0x70f9('0x28')]=function(_0x2c2dd5,_0x1f7197){return db[_0x70f9('0x2e')]['find']({'where':{'id':_0x2c2dd5[_0x70f9('0x45')]['id']}})[_0x70f9('0x27')](handleEntityNotFound(_0x1f7197,null))['then'](removeEntity(_0x1f7197,null))[_0x70f9('0x43')](handleError(_0x1f7197,null));};exports[_0x70f9('0x51')]=function(_0x372cc6,_0x237ccb){return db['SmsQueue'][_0x70f9('0x51')]()['then'](respondWithResult(_0x237ccb,null))['catch'](handleError(_0x237ccb,null));};exports['getMembers']=function(_0x1681b2,_0x4ac43f,_0x465521){var _0x27eb58={'raw':!![],'where':{}},_0xc1f296={},_0x487b25;return db[_0x70f9('0x2e')][_0x70f9('0x52')]({'where':{'id':_0x1681b2[_0x70f9('0x45')]['id']}})[_0x70f9('0x27')](handleEntityNotFound(_0x4ac43f,null))[_0x70f9('0x27')](function(_0x389b83){if(_0x389b83){_0x487b25=_0x389b83[_0x70f9('0x29')]({'plain':!![]});_0xc1f296['model']=_[_0x70f9('0x33')](db[_0x70f9('0x53')][_0x70f9('0x46')]);_0xc1f296[_0x70f9('0x32')]=_[_0x70f9('0x33')](_0x1681b2['query']);_0xc1f296[_0x70f9('0x34')]=_[_0x70f9('0x35')](_0xc1f296[_0x70f9('0x31')],_0xc1f296['query']);_0x27eb58[_0x70f9('0x36')]=_[_0x70f9('0x35')](_0xc1f296[_0x70f9('0x31')],qs[_0x70f9('0x37')](_0x1681b2[_0x70f9('0x32')]['fields']));_0x27eb58[_0x70f9('0x36')]=_0x27eb58[_0x70f9('0x36')][_0x70f9('0x38')]?_0x27eb58[_0x70f9('0x36')]:_0xc1f296[_0x70f9('0x31')];if(!_0x1681b2['query'][_0x70f9('0x39')]('nolimit')){_0x27eb58[_0x70f9('0x1f')]=qs[_0x70f9('0x1f')](_0x1681b2[_0x70f9('0x32')][_0x70f9('0x1f')]);_0x27eb58[_0x70f9('0x1e')]=qs[_0x70f9('0x1e')](_0x1681b2[_0x70f9('0x32')][_0x70f9('0x1e')]);}_0x27eb58['order']=qs['sort'](_0x1681b2[_0x70f9('0x32')][_0x70f9('0x3b')]);_0x27eb58[_0x70f9('0x3c')]=qs[_0x70f9('0x34')](_[_0x70f9('0x3d')](_0x1681b2[_0x70f9('0x32')],_0xc1f296['filters']));_0x27eb58[_0x70f9('0x3c')]['SmsQueueId']=_0x389b83['id'];if(_0x1681b2[_0x70f9('0x32')][_0x70f9('0x3e')]){_0x27eb58['where']=_['merge'](_0x27eb58[_0x70f9('0x3c')],{'$or':_[_0x70f9('0x2d')](_0x27eb58['attributes'],function(_0x3f9e0f){var _0x4041d3={};_0x4041d3[_0x3f9e0f]={'$like':'%'+_0x1681b2[_0x70f9('0x32')][_0x70f9('0x3e')]+'%'};return _0x4041d3;})});}_0x27eb58=_[_0x70f9('0x3f')]({},_0x27eb58,_0x1681b2[_0x70f9('0x54')]);return db[_0x70f9('0x53')]['findAll'](_0x27eb58);}})[_0x70f9('0x27')](function(_0x3c88ce){if(_0x3c88ce){return db[_0x70f9('0x55')]['findAndCountAll']({'where':{'id':_[_0x70f9('0x2d')](_0x3c88ce,_0x70f9('0x56')),'role':_0x70f9('0x57')},'attributes':['id',_0x70f9('0x2b'),_0x70f9('0x58'),_0x70f9('0x59'),_0x70f9('0x5a')]});}})[_0x70f9('0x27')](function(_0x45e660){if(_0x45e660){return{'count':_0x45e660[_0x70f9('0x21')],'rows':_['map'](_0x45e660[_0x70f9('0x42')],function(_0x5b3676){return{'membername':_0x5b3676[_0x70f9('0x2b')],'UserId':_0x5b3676['id'],'queue_name':_0x487b25['name'],'SmsQueueId':_0x487b25['id'],'interface':util['format'](_0x70f9('0x5b'),_0x70f9('0x5c'),_0x5b3676['name']),'penalty':0x0,'paused':_0x5b3676[_0x70f9('0x58')],'createdAt':_0x5b3676['createdAt'],'updatedAt':_0x5b3676[_0x70f9('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4ac43f,_0x27eb58))[_0x70f9('0x43')](handleError(_0x4ac43f,null));};exports[_0x70f9('0x5d')]=function(_0x949af,_0x2ce2d1,_0x4904b3){var _0x49a4c4={};var _0x2a9421={};var _0x2e128d;var _0x1cba10;return db[_0x70f9('0x2e')]['findOne']({'where':{'id':_0x949af[_0x70f9('0x45')]['id']}})[_0x70f9('0x27')](handleEntityNotFound(_0x2ce2d1,null))['then'](function(_0x4151e1){if(_0x4151e1){_0x2e128d=_0x4151e1;_0x2a9421['model']=_[_0x70f9('0x33')](db['Team'][_0x70f9('0x46')]);_0x2a9421[_0x70f9('0x32')]=_[_0x70f9('0x33')](_0x949af[_0x70f9('0x32')]);_0x2a9421[_0x70f9('0x34')]=_[_0x70f9('0x35')](_0x2a9421['model'],_0x2a9421['query']);_0x49a4c4['attributes']=_[_0x70f9('0x35')](_0x2a9421[_0x70f9('0x31')],qs[_0x70f9('0x37')](_0x949af[_0x70f9('0x32')][_0x70f9('0x37')]));_0x49a4c4[_0x70f9('0x36')]=_0x49a4c4['attributes'][_0x70f9('0x38')]?_0x49a4c4['attributes']:_0x2a9421[_0x70f9('0x31')];_0x49a4c4[_0x70f9('0x3a')]=qs[_0x70f9('0x3b')](_0x949af['query'][_0x70f9('0x3b')]);_0x49a4c4[_0x70f9('0x3c')]=qs[_0x70f9('0x34')](_[_0x70f9('0x3d')](_0x949af[_0x70f9('0x32')],_0x2a9421[_0x70f9('0x34')]));if(_0x949af[_0x70f9('0x32')]['filter']){_0x49a4c4[_0x70f9('0x3c')]=_[_0x70f9('0x3f')](_0x49a4c4[_0x70f9('0x3c')],{'$or':_['map'](_0x49a4c4[_0x70f9('0x36')],function(_0x1b661d){var _0x3ca31c={};_0x3ca31c[_0x1b661d]={'$like':'%'+_0x949af[_0x70f9('0x32')][_0x70f9('0x3e')]+'%'};return _0x3ca31c;})});}_0x49a4c4=_[_0x70f9('0x3f')]({},_0x49a4c4,_0x949af['options']);return _0x2e128d['getTeams'](_0x49a4c4);}})[_0x70f9('0x27')](function(_0x5be371){if(_0x5be371){_0x1cba10=_0x5be371[_0x70f9('0x38')];if(!_0x949af[_0x70f9('0x32')][_0x70f9('0x39')]('nolimit')){_0x49a4c4['limit']=qs[_0x70f9('0x1f')](_0x949af[_0x70f9('0x32')][_0x70f9('0x1f')]);_0x49a4c4[_0x70f9('0x1e')]=qs[_0x70f9('0x1e')](_0x949af['query']['offset']);}return _0x2e128d[_0x70f9('0x5d')](_0x49a4c4);}})['then'](function(_0x67275d){if(_0x67275d){return _0x67275d?{'count':_0x1cba10,'rows':_0x67275d}:null;}})['then'](respondWithResult(_0x2ce2d1,null))[_0x70f9('0x43')](handleError(_0x2ce2d1,null));};exports[_0x70f9('0x5e')]=function(_0x5165e7,_0x166114,_0x203f1c){var _0x1208a5=_0x5165e7['body']['ids'];return db[_0x70f9('0x5f')][_0x70f9('0x41')]({'where':{'id':_0x1208a5},'attributes':['id'],'include':[{'model':db[_0x70f9('0x55')],'as':_0x70f9('0x60'),'attributes':['id','name',_0x70f9('0x61'),_0x70f9('0x62'),_0x70f9('0x63')],'raw':!![]}]})['then'](function(_0xa603d7){if(_0xa603d7){var _0x36469e=_['flatMap'](_0xa603d7,function(_0x584ab4){var _0x39ef3f=_0x584ab4[_0x70f9('0x29')]({'plain':!![]});return _0x39ef3f[_0x70f9('0x60')];});return db[_0x70f9('0x2e')]['find']({'where':{'id':_0x5165e7[_0x70f9('0x45')]['id']}})['then'](function(_0x4a8298){return db[_0x70f9('0x64')]['transaction'](function(_0x5eb493){return _0x4a8298[_0x70f9('0x5e')](_0x1208a5,{'transaction':_0x5eb493})['then'](function(){return BPromise[_0x70f9('0x65')](_0x36469e,function(_0xd498d5){return db['UserSmsQueue'][_0x70f9('0x66')]({'where':{'UserId':_0xd498d5['id'],'SmsQueueId':_0x5165e7['params']['id']},'transaction':_0x5eb493});});})[_0x70f9('0x27')](function(){_0x36469e['forEach'](function(_0x2e12de){socket[_0x70f9('0x67')](_0x70f9('0x68'),{'UserId':_0x2e12de['id'],'SmsQueueId':_0x4a8298['id']});});});});});}})[_0x70f9('0x27')](respondWithStatusCode(_0x166114,null))[_0x70f9('0x43')](handleError(_0x166114,null));};exports[_0x70f9('0x69')]=function(_0x2df2be,_0x48b6a5,_0x589764){return db[_0x70f9('0x5f')][_0x70f9('0x41')]({'where':{'id':_0x2df2be[_0x70f9('0x32')][_0x70f9('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x48b6a5,null))['then'](function(_0x3d7290){var _0x2b5236=_[_0x70f9('0x2d')](_0x3d7290,'id');var _0x41ea52=[];var _0x230f9c=[];var _0x351189=squel[_0x70f9('0x6b')]();_0x351189[_0x70f9('0x6c')](_0x70f9('0x6d'))[_0x70f9('0x6e')]('team_has_sms_queues','tq')[_0x70f9('0x6f')](_0x70f9('0x70'),'ut',_0x70f9('0x71'))[_0x70f9('0x3c')](_0x70f9('0x72'),_0x2df2be[_0x70f9('0x45')]['id']);for(var _0x5d3882=0x0;_0x5d3882<_0x3d7290[_0x70f9('0x38')];_0x5d3882+=0x1){let _0x546f23=_0x3d7290[_0x5d3882];for(var _0x23d8f0=0x0;_0x23d8f0<_0x546f23[_0x70f9('0x60')][_0x70f9('0x38')];_0x23d8f0+=0x1){let _0x5edc63=_0x546f23[_0x70f9('0x60')][_0x23d8f0];var _0x282756=_0x351189[_0x70f9('0x73')]();_0x282756[_0x70f9('0x3c')](_0x70f9('0x74'),_0x5edc63['id']);_0x230f9c[_0x70f9('0x75')](db[_0x70f9('0x64')][_0x70f9('0x32')](_0x282756[_0x70f9('0x76')](),{'type':db[_0x70f9('0x64')][_0x70f9('0x77')][_0x70f9('0x78')]})['then'](function(_0x2b75d0){if(_0x2b75d0[_0x70f9('0x38')]===0x1){return _0x5edc63['id'];}else{var _0x31aa5f=_[_0x70f9('0x79')](_[_0x70f9('0x2d')](_0x2b75d0,_0x70f9('0x7a')),function(_0xa3578b){return _[_0x70f9('0x7b')](_0x2b5236,_0xa3578b);});if(_0x31aa5f){return _0x5edc63['id'];}}}));}}return BPromise[_0x70f9('0x7c')](_0x230f9c)[_0x70f9('0x27')](function(_0x4ca260){_0x41ea52=_(_0x41ea52)[_0x70f9('0x7d')](_0x4ca260)[_0x70f9('0x7e')]()[_0x70f9('0x7f')]();return db[_0x70f9('0x2e')][_0x70f9('0x48')]({'where':{'id':_0x2df2be['params']['id']}})[_0x70f9('0x27')](function(_0x2c6281){return db[_0x70f9('0x64')][_0x70f9('0x80')](function(_0x41280b){return _0x2c6281[_0x70f9('0x69')](_0x2df2be['query']['ids'],{'transaction':_0x41280b})[_0x70f9('0x27')](function(){if(!_['isEmpty'](_0x41ea52)){return _0x2c6281[_0x70f9('0x81')](_0x41ea52,{'transaction':_0x41280b});}})[_0x70f9('0x27')](function(){_0x41ea52[_0x70f9('0x82')](function(_0x32e6ca){socket[_0x70f9('0x67')](_0x70f9('0x83'),{'UserId':_0x32e6ca,'SmsQueueId':_0x2c6281['id']});});});});});});})[_0x70f9('0x27')](respondWithStatusCode(_0x48b6a5,null))[_0x70f9('0x43')](handleError(_0x48b6a5,null));};exports[_0x70f9('0x84')]=function(_0x13ea71,_0x542fab,_0x13b458){return db['SmsQueue'][_0x70f9('0x48')]({'where':{'id':_0x13ea71[_0x70f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x542fab,null))['then'](function(_0x1c2e24){if(_0x1c2e24){return _0x1c2e24['addAgents'](_0x13ea71[_0x70f9('0x4a')][_0x70f9('0x6a')],_['omit'](_0x13ea71[_0x70f9('0x4a')],[_0x70f9('0x6a'),'id'])||{})[_0x70f9('0x85')](function(_0x4802e5){for(var _0x4e850e=0x0;_0x4e850e<_0x13ea71[_0x70f9('0x4a')]['ids'][_0x70f9('0x38')];_0x4e850e+=0x1){socket[_0x70f9('0x67')](_0x70f9('0x68'),{'UserId':Number(_0x13ea71[_0x70f9('0x4a')][_0x70f9('0x6a')][_0x4e850e]),'SmsQueueId':Number(_0x13ea71[_0x70f9('0x45')]['id'])});}return _0x4802e5;});}})[_0x70f9('0x27')](respondWithResult(_0x542fab,null))[_0x70f9('0x43')](handleError(_0x542fab,null));};exports[_0x70f9('0x81')]=function(_0x30abfc,_0x330cb7,_0x2da6d0){return db[_0x70f9('0x2e')]['find']({'where':{'id':_0x30abfc[_0x70f9('0x45')]['id']}})[_0x70f9('0x27')](handleEntityNotFound(_0x330cb7,null))[_0x70f9('0x27')](function(_0x228562){if(_0x228562){return _0x228562['removeAgents'](_0x30abfc[_0x70f9('0x32')][_0x70f9('0x6a')])[_0x70f9('0x27')](function(){if(_['isArray'](_0x30abfc['query'][_0x70f9('0x6a')])){for(var _0x9c4b9c=0x0;_0x9c4b9c<_0x30abfc['query'][_0x70f9('0x6a')]['length'];_0x9c4b9c+=0x1){socket[_0x70f9('0x67')]('userSmsQueue:remove',{'UserId':Number(_0x30abfc[_0x70f9('0x32')]['ids'][_0x9c4b9c]),'SmsQueueId':Number(_0x30abfc['params']['id'])});}}else{socket[_0x70f9('0x67')](_0x70f9('0x83'),{'UserId':Number(_0x30abfc[_0x70f9('0x32')][_0x70f9('0x6a')]),'SmsQueueId':Number(_0x30abfc['params']['id'])});}});}})[_0x70f9('0x27')](respondWithStatusCode(_0x330cb7,null))['catch'](handleError(_0x330cb7,null));};exports[_0x70f9('0x86')]=function(_0xd1214e,_0xf71ed8,_0x4ee471){var _0x114b4d={};var _0xca9a74={};var _0x2e581a;var _0x3f7242;return db[_0x70f9('0x2e')][_0x70f9('0x52')]({'where':{'id':_0xd1214e['params']['id']}})['then'](handleEntityNotFound(_0xf71ed8,null))['then'](function(_0x6c2e67){if(_0x6c2e67){_0x2e581a=_0x6c2e67;_0xca9a74[_0x70f9('0x31')]=_[_0x70f9('0x33')](db['User'][_0x70f9('0x46')]);_0xca9a74['query']=_[_0x70f9('0x33')](_0xd1214e[_0x70f9('0x32')]);_0xca9a74[_0x70f9('0x34')]=_[_0x70f9('0x35')](_0xca9a74[_0x70f9('0x31')],_0xca9a74[_0x70f9('0x32')]);_0x114b4d['attributes']=_[_0x70f9('0x35')](_0xca9a74[_0x70f9('0x31')],qs[_0x70f9('0x37')](_0xd1214e[_0x70f9('0x32')][_0x70f9('0x37')]));_0x114b4d[_0x70f9('0x36')]=_0x114b4d[_0x70f9('0x36')]['length']?_0x114b4d['attributes']:_0xca9a74[_0x70f9('0x31')];_0x114b4d[_0x70f9('0x3a')]=qs[_0x70f9('0x3b')](_0xd1214e[_0x70f9('0x32')][_0x70f9('0x3b')]);_0x114b4d[_0x70f9('0x3c')]=qs['filters'](_[_0x70f9('0x3d')](_0xd1214e[_0x70f9('0x32')],_0xca9a74['filters']));if(_0xd1214e[_0x70f9('0x32')][_0x70f9('0x3e')]){_0x114b4d[_0x70f9('0x3c')]=_['merge'](_0x114b4d['where'],{'$or':_[_0x70f9('0x2d')](_0x114b4d[_0x70f9('0x36')],function(_0x3f7c01){var _0x29c180={};_0x29c180[_0x3f7c01]={'$like':'%'+_0xd1214e[_0x70f9('0x32')]['filter']+'%'};return _0x29c180;})});}_0x114b4d=_[_0x70f9('0x3f')]({},_0x114b4d,_0xd1214e['options']);return _0x2e581a[_0x70f9('0x86')](_0x114b4d);}})['then'](function(_0x3a904a){if(_0x3a904a){_0x3f7242=_0x3a904a[_0x70f9('0x38')];if(!_0xd1214e['query'][_0x70f9('0x39')](_0x70f9('0x87'))){_0x114b4d[_0x70f9('0x1f')]=qs[_0x70f9('0x1f')](_0xd1214e[_0x70f9('0x32')]['limit']);_0x114b4d['offset']=qs['offset'](_0xd1214e[_0x70f9('0x32')][_0x70f9('0x1e')]);}return _0x2e581a['getAgents'](_0x114b4d);}})[_0x70f9('0x27')](function(_0x15869a){if(_0x15869a){return _0x15869a?{'count':_0x3f7242,'rows':_0x15869a}:null;}})['then'](respondWithResult(_0xf71ed8,null))['catch'](handleError(_0xf71ed8,null));}; \ No newline at end of file +var _0x4547=['QueryTypes','SELECT','TeamId','includes','all','transaction','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','emit','userSmsQueue:save','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','offset','undefined','count','limit','status','set','Content-Range','json','update','destroy','then','get','SmsQueues','end','stack','name','send','index','SmsQueue','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','pick','SmsQueueId','findAll','UserId','smsPause','updatedAt','createdAt','format','getTeams','Team','addTeams','User','Agents','online','voicePause','flatMap','sequelize','each','UserSmsQueue','findOrCreate','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0x1278c4,_0x5c2d2d){var _0x365887=function(_0x316fc4){while(--_0x316fc4){_0x1278c4['push'](_0x1278c4['shift']());}};_0x365887(++_0x5c2d2d);}(_0x4547,0x11b));var _0x7454=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x4547[_0xb3b452];return _0x238983;};'use strict';var emlformat=require(_0x7454('0x0'));var rimraf=require(_0x7454('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7454('0x2'));var rp=require(_0x7454('0x3'));var moment=require('moment');var BPromise=require(_0x7454('0x4'));var Mustache=require(_0x7454('0x5'));var util=require(_0x7454('0x6'));var path=require(_0x7454('0x7'));var sox=require(_0x7454('0x8'));var csv=require(_0x7454('0x9'));var ejs=require(_0x7454('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7454('0xb'));var squel=require('squel');var crypto=require(_0x7454('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7454('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7454('0xe'));var Papa=require(_0x7454('0xf'));var Redis=require('ioredis');var authService=require(_0x7454('0x10'));var qs=require(_0x7454('0x11'));var as=require(_0x7454('0x12'));var hardwareService=require(_0x7454('0x13'));var logger=require(_0x7454('0x14'))(_0x7454('0x15'));var utils=require('../../config/utils');var config=require(_0x7454('0x16'));var licenseUtil=require(_0x7454('0x17'));var db=require(_0x7454('0x18'))['db'];config['redis']=_['defaults'](config[_0x7454('0x19')],{'host':_0x7454('0x1a'),'port':0x18eb});var socket=require(_0x7454('0x1b'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x4d575f,_0x51fd5b){_0x51fd5b=_0x51fd5b||0xcc;return function(_0x2896c0){if(_0x2896c0){return _0x4d575f[_0x7454('0x1c')](_0x51fd5b);}return _0x4d575f['status'](_0x51fd5b)['end']();};}function respondWithResult(_0x22d4c7,_0x2186a9){_0x2186a9=_0x2186a9||0xc8;return function(_0x13a8fb){if(_0x13a8fb){return _0x22d4c7['status'](_0x2186a9)['json'](_0x13a8fb);}};}function respondWithFilteredResult(_0x4396f7,_0x1ff00b){return function(_0x2df42e){if(_0x2df42e){var _0x1ca614=typeof _0x1ff00b[_0x7454('0x1d')]===_0x7454('0x1e')&&typeof _0x1ff00b['limit']===_0x7454('0x1e');var _0x56d3ba=_0x2df42e[_0x7454('0x1f')];var _0x2ddb7f=_0x1ca614?0x0:_0x1ff00b['offset'];var _0x2df7b5=_0x1ca614?_0x2df42e[_0x7454('0x1f')]:_0x1ff00b[_0x7454('0x1d')]+_0x1ff00b[_0x7454('0x20')];var _0x2640fb;if(_0x2df7b5>=_0x56d3ba){_0x2df7b5=_0x56d3ba;_0x2640fb=0xc8;}else{_0x2640fb=0xce;}_0x4396f7[_0x7454('0x21')](_0x2640fb);return _0x4396f7[_0x7454('0x22')](_0x7454('0x23'),_0x2ddb7f+'-'+_0x2df7b5+'/'+_0x56d3ba)[_0x7454('0x24')](_0x2df42e);}return null;};}function patchUpdates(_0x1aaa17){return function(_0x1f3c4d){try{jsonpatch['apply'](_0x1f3c4d,_0x1aaa17,!![]);}catch(_0x5a121f){return BPromise['reject'](_0x5a121f);}return _0x1f3c4d['save']();};}function saveUpdates(_0x5366ff,_0x2c51f2){return function(_0x344adf){if(_0x344adf){return _0x344adf[_0x7454('0x25')](_0x5366ff)['then'](function(_0xc0ef45){return _0xc0ef45;});}return null;};}function removeEntity(_0x29526a,_0x13563f){return function(_0x1a1d11){if(_0x1a1d11){return _0x1a1d11[_0x7454('0x26')]()[_0x7454('0x27')](function(){var _0x2bfe84=_0x1a1d11[_0x7454('0x28')]({'plain':!![]});var _0x2d9f59=_0x7454('0x29');return db['UserProfileResource'][_0x7454('0x26')]({'where':{'type':_0x2d9f59,'resourceId':_0x2bfe84['id']}})[_0x7454('0x27')](function(){return _0x1a1d11;});})[_0x7454('0x27')](function(){_0x29526a[_0x7454('0x21')](0xcc)[_0x7454('0x2a')]();});}};}function handleEntityNotFound(_0x47603e,_0x14c525){return function(_0x107dd8){if(!_0x107dd8){_0x47603e['sendStatus'](0x194);}return _0x107dd8;};}function handleError(_0x505a2d,_0x405915){_0x405915=_0x405915||0x1f4;return function(_0x4ae613){logger['error'](_0x4ae613[_0x7454('0x2b')]);if(_0x4ae613[_0x7454('0x2c')]){delete _0x4ae613[_0x7454('0x2c')];}_0x505a2d[_0x7454('0x21')](_0x405915)[_0x7454('0x2d')](_0x4ae613);};}exports[_0x7454('0x2e')]=function(_0x1304e8,_0xc6d9f2){var _0x234a30={},_0x1031d8={},_0x644efd={'count':0x0,'rows':[]};var _0x4cfd57=_['map'](db[_0x7454('0x2f')]['rawAttributes'],function(_0x3009e1){return{'name':_0x3009e1[_0x7454('0x30')],'type':_0x3009e1['type'][_0x7454('0x31')]};});_0x1031d8['model']=_[_0x7454('0x32')](_0x4cfd57,_0x7454('0x2c'));_0x1031d8['query']=_[_0x7454('0x33')](_0x1304e8[_0x7454('0x34')]);_0x1031d8[_0x7454('0x35')]=_[_0x7454('0x36')](_0x1031d8[_0x7454('0x37')],_0x1031d8[_0x7454('0x34')]);_0x234a30[_0x7454('0x38')]=_[_0x7454('0x36')](_0x1031d8[_0x7454('0x37')],qs[_0x7454('0x39')](_0x1304e8[_0x7454('0x34')][_0x7454('0x39')]));_0x234a30['attributes']=_0x234a30[_0x7454('0x38')][_0x7454('0x3a')]?_0x234a30[_0x7454('0x38')]:_0x1031d8[_0x7454('0x37')];if(!_0x1304e8[_0x7454('0x34')][_0x7454('0x3b')](_0x7454('0x3c'))){_0x234a30[_0x7454('0x20')]=qs[_0x7454('0x20')](_0x1304e8[_0x7454('0x34')][_0x7454('0x20')]);_0x234a30[_0x7454('0x1d')]=qs['offset'](_0x1304e8['query'][_0x7454('0x1d')]);}_0x234a30['order']=qs[_0x7454('0x3d')](_0x1304e8['query'][_0x7454('0x3d')]);_0x234a30['where']=qs[_0x7454('0x35')](_['pick'](_0x1304e8['query'],_0x1031d8[_0x7454('0x35')]),_0x4cfd57);if(_0x1304e8[_0x7454('0x34')][_0x7454('0x3e')]){_0x234a30['where']=_[_0x7454('0x3f')](_0x234a30[_0x7454('0x40')],{'$or':_[_0x7454('0x32')](_0x4cfd57,function(_0x25e79e){if(_0x25e79e['type']!==_0x7454('0x41')){var _0x47e98a={};_0x47e98a[_0x25e79e[_0x7454('0x2c')]]={'$like':'%'+_0x1304e8[_0x7454('0x34')][_0x7454('0x3e')]+'%'};return _0x47e98a;}})});}_0x234a30=_[_0x7454('0x3f')]({},_0x234a30,_0x1304e8[_0x7454('0x42')]);var _0x5117c5={'where':_0x234a30[_0x7454('0x40')]};return db['SmsQueue']['count'](_0x5117c5)['then'](function(_0x28e852){_0x644efd[_0x7454('0x1f')]=_0x28e852;if(_0x1304e8[_0x7454('0x34')]['includeAll']){_0x234a30[_0x7454('0x43')]=[{'all':!![]}];}return db[_0x7454('0x2f')]['findAll'](_0x234a30);})['then'](function(_0x38165f){_0x644efd[_0x7454('0x44')]=_0x38165f;return _0x644efd;})[_0x7454('0x27')](respondWithFilteredResult(_0xc6d9f2,_0x234a30))[_0x7454('0x45')](handleError(_0xc6d9f2,null));};exports[_0x7454('0x46')]=function(_0x46b676,_0x58e96d){var _0xdd661e={'raw':!![],'where':{'id':_0x46b676[_0x7454('0x47')]['id']}},_0x22ceac={};_0x22ceac[_0x7454('0x37')]=_[_0x7454('0x33')](db['SmsQueue'][_0x7454('0x48')]);_0x22ceac[_0x7454('0x34')]=_[_0x7454('0x33')](_0x46b676['query']);_0x22ceac[_0x7454('0x35')]=_[_0x7454('0x36')](_0x22ceac[_0x7454('0x37')],_0x22ceac[_0x7454('0x34')]);_0xdd661e[_0x7454('0x38')]=_[_0x7454('0x36')](_0x22ceac['model'],qs[_0x7454('0x39')](_0x46b676[_0x7454('0x34')][_0x7454('0x39')]));_0xdd661e[_0x7454('0x38')]=_0xdd661e['attributes'][_0x7454('0x3a')]?_0xdd661e[_0x7454('0x38')]:_0x22ceac['model'];if(_0x46b676['query']['includeAll']){_0xdd661e[_0x7454('0x43')]=[{'all':!![]}];}_0xdd661e=_[_0x7454('0x3f')]({},_0xdd661e,_0x46b676[_0x7454('0x42')]);return db[_0x7454('0x2f')][_0x7454('0x49')](_0xdd661e)[_0x7454('0x27')](handleEntityNotFound(_0x58e96d,null))[_0x7454('0x27')](respondWithResult(_0x58e96d,null))[_0x7454('0x45')](handleError(_0x58e96d,null));};exports[_0x7454('0x4a')]=function(_0xcfe6c1,_0x4dc4d1){return db[_0x7454('0x2f')]['create'](_0xcfe6c1[_0x7454('0x4b')],{})[_0x7454('0x27')](function(_0x159927){var _0x240f1d=_0xcfe6c1[_0x7454('0x4c')]['get']({'plain':!![]});if(!_0x240f1d)throw new Error(_0x7454('0x4d'));if(_0x240f1d[_0x7454('0x4e')]===_0x7454('0x4c')){var _0x141b3f=_0x159927[_0x7454('0x28')]({'plain':!![]});var _0x1ca0e3=_0x7454('0x29');return db[_0x7454('0x4f')][_0x7454('0x49')]({'where':{'name':_0x1ca0e3,'userProfileId':_0x240f1d[_0x7454('0x50')]},'raw':!![]})[_0x7454('0x27')](function(_0x5ab838){if(_0x5ab838&&_0x5ab838[_0x7454('0x51')]===0x0){return db[_0x7454('0x52')]['create']({'name':_0x141b3f[_0x7454('0x2c')],'resourceId':_0x141b3f['id'],'type':_0x5ab838['name'],'sectionId':_0x5ab838['id']},{})['then'](function(){return _0x159927;});}else{return _0x159927;}})[_0x7454('0x45')](function(_0x155bdc){logger[_0x7454('0x53')](_0x7454('0x54'),_0x155bdc);throw _0x155bdc;});}return _0x159927;})['then'](respondWithResult(_0x4dc4d1,0xc9))[_0x7454('0x45')](handleError(_0x4dc4d1,null));};exports['update']=function(_0x5d967f,_0x40b571){if(_0x5d967f[_0x7454('0x4b')]['id']){delete _0x5d967f['body']['id'];}return db[_0x7454('0x2f')]['find']({'where':{'id':_0x5d967f[_0x7454('0x47')]['id']}})[_0x7454('0x27')](handleEntityNotFound(_0x40b571,null))[_0x7454('0x27')](saveUpdates(_0x5d967f[_0x7454('0x4b')],null))[_0x7454('0x27')](respondWithResult(_0x40b571,null))[_0x7454('0x45')](handleError(_0x40b571,null));};exports[_0x7454('0x26')]=function(_0x41ebdc,_0x1b2035){return db[_0x7454('0x2f')][_0x7454('0x49')]({'where':{'id':_0x41ebdc[_0x7454('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b2035,null))['then'](removeEntity(_0x1b2035,null))[_0x7454('0x45')](handleError(_0x1b2035,null));};exports[_0x7454('0x55')]=function(_0x4ebb8e,_0x3f7c5f){return db[_0x7454('0x2f')][_0x7454('0x55')]()[_0x7454('0x27')](respondWithResult(_0x3f7c5f,null))['catch'](handleError(_0x3f7c5f,null));};exports[_0x7454('0x56')]=function(_0x31e6e9,_0x10c79d,_0x1aae8a){var _0x19181f={'raw':!![],'where':{}},_0x3ecd4c={},_0x23e2a9;return db[_0x7454('0x2f')][_0x7454('0x57')]({'where':{'id':_0x31e6e9['params']['id']}})[_0x7454('0x27')](handleEntityNotFound(_0x10c79d,null))['then'](function(_0x5505d9){if(_0x5505d9){_0x23e2a9=_0x5505d9[_0x7454('0x28')]({'plain':!![]});_0x3ecd4c[_0x7454('0x37')]=_['keys'](db['UserSmsQueue'][_0x7454('0x48')]);_0x3ecd4c[_0x7454('0x34')]=_['keys'](_0x31e6e9[_0x7454('0x34')]);_0x3ecd4c['filters']=_['intersection'](_0x3ecd4c[_0x7454('0x37')],_0x3ecd4c['query']);_0x19181f[_0x7454('0x38')]=_[_0x7454('0x36')](_0x3ecd4c[_0x7454('0x37')],qs[_0x7454('0x39')](_0x31e6e9[_0x7454('0x34')][_0x7454('0x39')]));_0x19181f['attributes']=_0x19181f[_0x7454('0x38')][_0x7454('0x3a')]?_0x19181f[_0x7454('0x38')]:_0x3ecd4c[_0x7454('0x37')];if(!_0x31e6e9[_0x7454('0x34')]['hasOwnProperty'](_0x7454('0x3c'))){_0x19181f['limit']=qs[_0x7454('0x20')](_0x31e6e9[_0x7454('0x34')]['limit']);_0x19181f[_0x7454('0x1d')]=qs[_0x7454('0x1d')](_0x31e6e9[_0x7454('0x34')]['offset']);}_0x19181f[_0x7454('0x58')]=qs[_0x7454('0x3d')](_0x31e6e9[_0x7454('0x34')]['sort']);_0x19181f[_0x7454('0x40')]=qs[_0x7454('0x35')](_[_0x7454('0x59')](_0x31e6e9[_0x7454('0x34')],_0x3ecd4c['filters']));_0x19181f[_0x7454('0x40')][_0x7454('0x5a')]=_0x5505d9['id'];if(_0x31e6e9[_0x7454('0x34')][_0x7454('0x3e')]){_0x19181f[_0x7454('0x40')]=_[_0x7454('0x3f')](_0x19181f[_0x7454('0x40')],{'$or':_[_0x7454('0x32')](_0x19181f[_0x7454('0x38')],function(_0x19ecc1){var _0x4719bc={};_0x4719bc[_0x19ecc1]={'$like':'%'+_0x31e6e9[_0x7454('0x34')][_0x7454('0x3e')]+'%'};return _0x4719bc;})});}_0x19181f=_[_0x7454('0x3f')]({},_0x19181f,_0x31e6e9[_0x7454('0x42')]);return db['UserSmsQueue'][_0x7454('0x5b')](_0x19181f);}})['then'](function(_0x3f879d){if(_0x3f879d){return db['User']['findAndCountAll']({'where':{'id':_[_0x7454('0x32')](_0x3f879d,_0x7454('0x5c')),'role':'agent'},'attributes':['id',_0x7454('0x2c'),_0x7454('0x5d'),_0x7454('0x5e'),_0x7454('0x5f')]});}})[_0x7454('0x27')](function(_0x597ab4){if(_0x597ab4){return{'count':_0x597ab4['count'],'rows':_[_0x7454('0x32')](_0x597ab4['rows'],function(_0x3d17df){return{'membername':_0x3d17df[_0x7454('0x2c')],'UserId':_0x3d17df['id'],'queue_name':_0x23e2a9[_0x7454('0x2c')],'SmsQueueId':_0x23e2a9['id'],'interface':util[_0x7454('0x60')]('%s/%s','SIP',_0x3d17df[_0x7454('0x2c')]),'penalty':0x0,'paused':_0x3d17df['smsPause'],'createdAt':_0x3d17df[_0x7454('0x5f')],'updatedAt':_0x3d17df[_0x7454('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7454('0x27')](respondWithFilteredResult(_0x10c79d,_0x19181f))[_0x7454('0x45')](handleError(_0x10c79d,null));};exports[_0x7454('0x61')]=function(_0x518282,_0x20db14,_0x26ef3d){var _0x5df5d6={};var _0x2921d5={};var _0x1c0b27;var _0x3dda26;return db['SmsQueue'][_0x7454('0x57')]({'where':{'id':_0x518282[_0x7454('0x47')]['id']}})['then'](handleEntityNotFound(_0x20db14,null))[_0x7454('0x27')](function(_0x4bef3b){if(_0x4bef3b){_0x1c0b27=_0x4bef3b;_0x2921d5['model']=_[_0x7454('0x33')](db[_0x7454('0x62')][_0x7454('0x48')]);_0x2921d5[_0x7454('0x34')]=_['keys'](_0x518282[_0x7454('0x34')]);_0x2921d5['filters']=_[_0x7454('0x36')](_0x2921d5[_0x7454('0x37')],_0x2921d5['query']);_0x5df5d6['attributes']=_[_0x7454('0x36')](_0x2921d5['model'],qs['fields'](_0x518282['query'][_0x7454('0x39')]));_0x5df5d6[_0x7454('0x38')]=_0x5df5d6[_0x7454('0x38')][_0x7454('0x3a')]?_0x5df5d6['attributes']:_0x2921d5[_0x7454('0x37')];_0x5df5d6[_0x7454('0x58')]=qs[_0x7454('0x3d')](_0x518282['query'][_0x7454('0x3d')]);_0x5df5d6['where']=qs[_0x7454('0x35')](_['pick'](_0x518282[_0x7454('0x34')],_0x2921d5[_0x7454('0x35')]));if(_0x518282[_0x7454('0x34')][_0x7454('0x3e')]){_0x5df5d6['where']=_['merge'](_0x5df5d6[_0x7454('0x40')],{'$or':_[_0x7454('0x32')](_0x5df5d6[_0x7454('0x38')],function(_0x13a547){var _0x46dffe={};_0x46dffe[_0x13a547]={'$like':'%'+_0x518282['query'][_0x7454('0x3e')]+'%'};return _0x46dffe;})});}_0x5df5d6=_[_0x7454('0x3f')]({},_0x5df5d6,_0x518282[_0x7454('0x42')]);return _0x1c0b27[_0x7454('0x61')](_0x5df5d6);}})[_0x7454('0x27')](function(_0x3dfced){if(_0x3dfced){_0x3dda26=_0x3dfced[_0x7454('0x3a')];if(!_0x518282['query'][_0x7454('0x3b')](_0x7454('0x3c'))){_0x5df5d6[_0x7454('0x20')]=qs[_0x7454('0x20')](_0x518282[_0x7454('0x34')]['limit']);_0x5df5d6[_0x7454('0x1d')]=qs[_0x7454('0x1d')](_0x518282[_0x7454('0x34')][_0x7454('0x1d')]);}return _0x1c0b27[_0x7454('0x61')](_0x5df5d6);}})[_0x7454('0x27')](function(_0x1c9707){if(_0x1c9707){return _0x1c9707?{'count':_0x3dda26,'rows':_0x1c9707}:null;}})['then'](respondWithResult(_0x20db14,null))[_0x7454('0x45')](handleError(_0x20db14,null));};exports[_0x7454('0x63')]=function(_0x5c5183,_0x335971,_0x471aaf){var _0x4af6a0=_0x5c5183[_0x7454('0x4b')]['ids'];return db[_0x7454('0x62')][_0x7454('0x5b')]({'where':{'id':_0x4af6a0},'attributes':['id'],'include':[{'model':db[_0x7454('0x64')],'as':_0x7454('0x65'),'attributes':['id',_0x7454('0x2c'),_0x7454('0x66'),_0x7454('0x67'),'interface'],'raw':!![]}]})[_0x7454('0x27')](function(_0x1af3c7){if(_0x1af3c7){var _0x33a196=_[_0x7454('0x68')](_0x1af3c7,function(_0x8910aa){var _0x2f68e6=_0x8910aa[_0x7454('0x28')]({'plain':!![]});return _0x2f68e6[_0x7454('0x65')];});return db['SmsQueue']['find']({'where':{'id':_0x5c5183[_0x7454('0x47')]['id']}})[_0x7454('0x27')](function(_0x494488){return db[_0x7454('0x69')]['transaction'](function(_0xbfda60){return _0x494488[_0x7454('0x63')](_0x4af6a0,{'transaction':_0xbfda60})[_0x7454('0x27')](function(){return BPromise[_0x7454('0x6a')](_0x33a196,function(_0x33150d){return db[_0x7454('0x6b')][_0x7454('0x6c')]({'where':{'UserId':_0x33150d['id'],'SmsQueueId':_0x5c5183['params']['id']},'transaction':_0xbfda60});});})[_0x7454('0x27')](function(){_0x33a196['forEach'](function(_0x56a861){socket['emit']('userSmsQueue:save',{'UserId':_0x56a861['id'],'SmsQueueId':_0x494488['id']});});});});});}})[_0x7454('0x27')](respondWithStatusCode(_0x335971,null))['catch'](handleError(_0x335971,null));};exports[_0x7454('0x6d')]=function(_0x16214d,_0xe986e5,_0x385e14){return db[_0x7454('0x62')]['findAll']({'where':{'id':_0x16214d['query'][_0x7454('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x7454('0x64')],'as':_0x7454('0x65'),'attributes':['id'],'raw':!![]}]})[_0x7454('0x27')](handleEntityNotFound(_0xe986e5,null))['then'](function(_0x18682e){var _0x99abf0=_[_0x7454('0x32')](_0x18682e,'id');var _0x154eb2=[];var _0x38284c=[];var _0x202422=squel[_0x7454('0x6f')]();_0x202422['field'](_0x7454('0x70'))[_0x7454('0x71')]('team_has_sms_queues','tq')[_0x7454('0x72')](_0x7454('0x73'),'ut',_0x7454('0x74'))[_0x7454('0x40')](_0x7454('0x75'),_0x16214d[_0x7454('0x47')]['id']);for(var _0x21a6b2=0x0;_0x21a6b2<_0x18682e[_0x7454('0x3a')];_0x21a6b2+=0x1){let _0x252d8b=_0x18682e[_0x21a6b2];for(var _0x544616=0x0;_0x544616<_0x252d8b[_0x7454('0x65')]['length'];_0x544616+=0x1){let _0x3a8d6d=_0x252d8b[_0x7454('0x65')][_0x544616];var _0x57e083=_0x202422['clone']();_0x57e083[_0x7454('0x40')](_0x7454('0x76'),_0x3a8d6d['id']);_0x38284c['push'](db[_0x7454('0x69')][_0x7454('0x34')](_0x57e083['toString'](),{'type':db[_0x7454('0x69')][_0x7454('0x77')][_0x7454('0x78')]})['then'](function(_0x26b358){if(_0x26b358[_0x7454('0x3a')]===0x1){return _0x3a8d6d['id'];}else{var _0x4d1a52=_['every'](_[_0x7454('0x32')](_0x26b358,_0x7454('0x79')),function(_0xefa7e3){return _[_0x7454('0x7a')](_0x99abf0,_0xefa7e3);});if(_0x4d1a52){return _0x3a8d6d['id'];}}}));}}return BPromise[_0x7454('0x7b')](_0x38284c)[_0x7454('0x27')](function(_0x13e212){_0x154eb2=_(_0x154eb2)['union'](_0x13e212)['compact']()['value']();return db[_0x7454('0x2f')][_0x7454('0x49')]({'where':{'id':_0x16214d[_0x7454('0x47')]['id']}})['then'](function(_0x2d8d36){return db[_0x7454('0x69')][_0x7454('0x7c')](function(_0x5dcb19){return _0x2d8d36[_0x7454('0x6d')](_0x16214d[_0x7454('0x34')][_0x7454('0x6e')],{'transaction':_0x5dcb19})['then'](function(){if(!_['isEmpty'](_0x154eb2)){return _0x2d8d36[_0x7454('0x7d')](_0x154eb2,{'transaction':_0x5dcb19});}})[_0x7454('0x27')](function(){_0x154eb2[_0x7454('0x7e')](function(_0x11edd5){socket['emit'](_0x7454('0x7f'),{'UserId':_0x11edd5,'SmsQueueId':_0x2d8d36['id']});});});});});});})[_0x7454('0x27')](respondWithStatusCode(_0xe986e5,null))['catch'](handleError(_0xe986e5,null));};exports[_0x7454('0x80')]=function(_0x77a111,_0x2b9e8a,_0x1a9613){return db[_0x7454('0x2f')][_0x7454('0x49')]({'where':{'id':_0x77a111[_0x7454('0x47')]['id']}})[_0x7454('0x27')](handleEntityNotFound(_0x2b9e8a,null))['then'](function(_0xa9f500){if(_0xa9f500){return _0xa9f500[_0x7454('0x80')](_0x77a111['body'][_0x7454('0x6e')],_[_0x7454('0x81')](_0x77a111[_0x7454('0x4b')],[_0x7454('0x6e'),'id'])||{})[_0x7454('0x82')](function(_0x5ec04a){for(var _0x4561e1=0x0;_0x4561e1<_0x77a111[_0x7454('0x4b')][_0x7454('0x6e')][_0x7454('0x3a')];_0x4561e1+=0x1){socket[_0x7454('0x83')](_0x7454('0x84'),{'UserId':Number(_0x77a111[_0x7454('0x4b')][_0x7454('0x6e')][_0x4561e1]),'SmsQueueId':Number(_0x77a111[_0x7454('0x47')]['id'])});}return _0x5ec04a;});}})[_0x7454('0x27')](respondWithResult(_0x2b9e8a,null))[_0x7454('0x45')](handleError(_0x2b9e8a,null));};exports[_0x7454('0x7d')]=function(_0x12f983,_0x535065,_0x6ad9a6){return db[_0x7454('0x2f')][_0x7454('0x49')]({'where':{'id':_0x12f983[_0x7454('0x47')]['id']}})['then'](handleEntityNotFound(_0x535065,null))[_0x7454('0x27')](function(_0x27a39e){if(_0x27a39e){return _0x27a39e[_0x7454('0x7d')](_0x12f983[_0x7454('0x34')][_0x7454('0x6e')])['then'](function(){if(_['isArray'](_0x12f983[_0x7454('0x34')][_0x7454('0x6e')])){for(var _0x133040=0x0;_0x133040<_0x12f983[_0x7454('0x34')][_0x7454('0x6e')][_0x7454('0x3a')];_0x133040+=0x1){socket[_0x7454('0x83')]('userSmsQueue:remove',{'UserId':Number(_0x12f983['query'][_0x7454('0x6e')][_0x133040]),'SmsQueueId':Number(_0x12f983[_0x7454('0x47')]['id'])});}}else{socket[_0x7454('0x83')]('userSmsQueue:remove',{'UserId':Number(_0x12f983[_0x7454('0x34')][_0x7454('0x6e')]),'SmsQueueId':Number(_0x12f983[_0x7454('0x47')]['id'])});}});}})[_0x7454('0x27')](respondWithStatusCode(_0x535065,null))[_0x7454('0x45')](handleError(_0x535065,null));};exports['getAgents']=function(_0x3f5f5d,_0x4b244c,_0x55a7ad){var _0x299bc1={};var _0x193ae4={};var _0x165b53;var _0x30012e;return db[_0x7454('0x2f')]['findOne']({'where':{'id':_0x3f5f5d[_0x7454('0x47')]['id']}})[_0x7454('0x27')](handleEntityNotFound(_0x4b244c,null))[_0x7454('0x27')](function(_0x144f71){if(_0x144f71){_0x165b53=_0x144f71;_0x193ae4[_0x7454('0x37')]=_['keys'](db[_0x7454('0x64')][_0x7454('0x48')]);_0x193ae4[_0x7454('0x34')]=_[_0x7454('0x33')](_0x3f5f5d[_0x7454('0x34')]);_0x193ae4[_0x7454('0x35')]=_[_0x7454('0x36')](_0x193ae4[_0x7454('0x37')],_0x193ae4[_0x7454('0x34')]);_0x299bc1[_0x7454('0x38')]=_[_0x7454('0x36')](_0x193ae4[_0x7454('0x37')],qs[_0x7454('0x39')](_0x3f5f5d[_0x7454('0x34')][_0x7454('0x39')]));_0x299bc1[_0x7454('0x38')]=_0x299bc1[_0x7454('0x38')][_0x7454('0x3a')]?_0x299bc1['attributes']:_0x193ae4[_0x7454('0x37')];_0x299bc1[_0x7454('0x58')]=qs[_0x7454('0x3d')](_0x3f5f5d[_0x7454('0x34')][_0x7454('0x3d')]);_0x299bc1[_0x7454('0x40')]=qs[_0x7454('0x35')](_[_0x7454('0x59')](_0x3f5f5d[_0x7454('0x34')],_0x193ae4[_0x7454('0x35')]));if(_0x3f5f5d['query']['filter']){_0x299bc1['where']=_[_0x7454('0x3f')](_0x299bc1[_0x7454('0x40')],{'$or':_[_0x7454('0x32')](_0x299bc1[_0x7454('0x38')],function(_0x452eac){var _0x2dc40a={};_0x2dc40a[_0x452eac]={'$like':'%'+_0x3f5f5d[_0x7454('0x34')][_0x7454('0x3e')]+'%'};return _0x2dc40a;})});}_0x299bc1=_[_0x7454('0x3f')]({},_0x299bc1,_0x3f5f5d[_0x7454('0x42')]);return _0x165b53[_0x7454('0x85')](_0x299bc1);}})['then'](function(_0x4e7c8a){if(_0x4e7c8a){_0x30012e=_0x4e7c8a[_0x7454('0x3a')];if(!_0x3f5f5d['query'][_0x7454('0x3b')](_0x7454('0x3c'))){_0x299bc1['limit']=qs[_0x7454('0x20')](_0x3f5f5d[_0x7454('0x34')][_0x7454('0x20')]);_0x299bc1[_0x7454('0x1d')]=qs[_0x7454('0x1d')](_0x3f5f5d[_0x7454('0x34')][_0x7454('0x1d')]);}return _0x165b53[_0x7454('0x85')](_0x299bc1);}})[_0x7454('0x27')](function(_0x2074bb){if(_0x2074bb){return _0x2074bb?{'count':_0x30012e,'rows':_0x2074bb}:null;}})[_0x7454('0x27')](respondWithResult(_0x4b244c,null))[_0x7454('0x45')](handleError(_0x4b244c,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3cd0270..93ab731 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 _0xc527=['events','../../mysqldb','SmsQueue','save','update','emit'];(function(_0xb4a704,_0x1deea9){var _0x23a1d5=function(_0x2f0120){while(--_0x2f0120){_0xb4a704['push'](_0xb4a704['shift']());}};_0x23a1d5(++_0x1deea9);}(_0xc527,0x168));var _0x7c52=function(_0x1dea0f,_0x218090){_0x1dea0f=_0x1dea0f-0x0;var _0x55f8f7=_0xc527[_0x1dea0f];return _0x55f8f7;};'use strict';var EventEmitter=require(_0x7c52('0x0'));var SmsQueue=require(_0x7c52('0x1'))['db'][_0x7c52('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7c52('0x3'),'afterUpdate':_0x7c52('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4fbcd3){return function(_0x3302c3,_0x4139b5,_0x4f9dd3){SmsQueueEvents[_0x7c52('0x5')](_0x4fbcd3+':'+_0x3302c3['id'],_0x3302c3);SmsQueueEvents[_0x7c52('0x5')](_0x4fbcd3,_0x3302c3);_0x4f9dd3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x7643=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x7643,0x1b3));var _0x3764=function(_0x374785,_0x4f71b8){_0x374785=_0x374785-0x0;var _0x572c40=_0x7643[_0x374785];return _0x572c40;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x3764('0x0'))['db'][_0x3764('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3764('0x2')](0x0);var events={'afterCreate':_0x3764('0x3'),'afterUpdate':_0x3764('0x4'),'afterDestroy':_0x3764('0x5')};function emitEvent(_0x3128d7){return function(_0x2cd80a,_0x53573e,_0x4d8257){SmsQueueEvents[_0x3764('0x6')](_0x3128d7+':'+_0x2cd80a['id'],_0x2cd80a);SmsQueueEvents['emit'](_0x3128d7,_0x2cd80a);_0x4d8257(null);};}for(var e in events){if(events[_0x3764('0x7')](e)){var event=events[e];SmsQueue[_0x3764('0x8')](e,emitEvent(event));}}module[_0x3764('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index f1b1ce4..8cb2912 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 _0xa2a1=['../../config/logger','moment','bluebird','request-promise','path','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0x50345a,_0x4ba3bc){var _0x49d587=function(_0x2550b3){while(--_0x2550b3){_0x50345a['push'](_0x50345a['shift']());}};_0x49d587(++_0x4ba3bc);}(_0xa2a1,0x1c6));var _0x1a2a=function(_0x4ef8ff,_0x47d1e5){_0x4ef8ff=_0x4ef8ff-0x0;var _0x25631a=_0xa2a1[_0x4ef8ff];return _0x25631a;};'use strict';var _=require(_0x1a2a('0x0'));var util=require(_0x1a2a('0x1'));var logger=require(_0x1a2a('0x2'))('api');var moment=require(_0x1a2a('0x3'));var BPromise=require(_0x1a2a('0x4'));var rp=require(_0x1a2a('0x5'));var fs=require('fs');var path=require(_0x1a2a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1a2a('0x7'));module[_0x1a2a('0x8')]=function(_0x10ff7f,_0x4e4eb2){return _0x10ff7f[_0x1a2a('0x9')](_0x1a2a('0xa'),attributes,{'tableName':_0x1a2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b23=['request-promise','path','rimraf','../../config/environment','exports','define','SmsQueue','sms_queues','lodash','util','moment','bluebird'];(function(_0x3ee168,_0x28dbad){var _0x2d50a6=function(_0x55e812){while(--_0x55e812){_0x3ee168['push'](_0x3ee168['shift']());}};_0x2d50a6(++_0x28dbad);}(_0x7b23,0x104));var _0x37b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7b23[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x37b2('0x0'));var util=require(_0x37b2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x37b2('0x2'));var BPromise=require(_0x37b2('0x3'));var rp=require(_0x37b2('0x4'));var fs=require('fs');var path=require(_0x37b2('0x5'));var rimraf=require(_0x37b2('0x6'));var config=require(_0x37b2('0x7'));var attributes=require('./smsQueue.attributes');module[_0x37b2('0x8')]=function(_0x232379,_0x1e9e35){return _0x232379[_0x37b2('0x9')](_0x37b2('0xa'),attributes,{'tableName':_0x37b2('0xb'),'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 bc8c654..0a31cb8 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 _0x39a1=['attributes','stringify','ShowSmsQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x39a1,0xf4));var _0x139a=function(_0x5ad72d,_0x2e75ea){_0x5ad72d=_0x5ad72d-0x0;var _0x2c0a1e=_0x39a1[_0x5ad72d];return _0x2c0a1e;};'use strict';var _=require(_0x139a('0x0'));var util=require('util');var moment=require(_0x139a('0x1'));var BPromise=require(_0x139a('0x2'));var rs=require(_0x139a('0x3'));var fs=require('fs');var Redis=require(_0x139a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x139a('0x5'));var logger=require(_0x139a('0x6'))(_0x139a('0x7'));var config=require(_0x139a('0x8'));var jayson=require(_0x139a('0x9'));var client=jayson['client'][_0x139a('0xa')]({'port':0x232a});config[_0x139a('0xb')]=_[_0x139a('0xc')](config[_0x139a('0xb')],{'host':_0x139a('0xd'),'port':0x18eb});var socket=require(_0x139a('0xe'))(new Redis(config[_0x139a('0xb')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x561a07,_0x26a4c1,_0x13b6cf){return new BPromise(function(_0x5b5ed7,_0x515b0f){return client[_0x139a('0xf')](_0x561a07,_0x13b6cf)[_0x139a('0x10')](function(_0x411086){logger[_0x139a('0x11')](_0x139a('0x12'),_0x26a4c1,_0x139a('0x13'));logger[_0x139a('0x14')](_0x139a('0x15'),_0x26a4c1,'request\x20sent',JSON['stringify'](_0x411086));if(_0x411086[_0x139a('0x16')]){if(_0x411086[_0x139a('0x16')][_0x139a('0x17')]===0x1f4){logger['error'](_0x139a('0x12'),_0x26a4c1,_0x411086['error']['message']);return _0x515b0f(_0x411086[_0x139a('0x16')][_0x139a('0x18')]);}logger[_0x139a('0x16')]('SmsQueue,\x20%s,\x20%s',_0x26a4c1,_0x411086['error'][_0x139a('0x18')]);return _0x5b5ed7(_0x411086['error'][_0x139a('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x26a4c1,'request\x20sent');_0x5b5ed7(_0x411086['result']['message']);}})[_0x139a('0x19')](function(_0xb45488){logger['error'](_0x139a('0x12'),_0x26a4c1,_0xb45488);_0x515b0f(_0xb45488);});});}exports[_0x139a('0x1a')]=function(_0x7890d3){var _0x3b55f0=this;return new Promise(function(_0x104d9c,_0x4e1d0c){return db[_0x139a('0x1b')][_0x139a('0x1c')]({'raw':_0x7890d3[_0x139a('0x1d')]?_0x7890d3[_0x139a('0x1d')][_0x139a('0x1e')]===undefined?!![]:![]:!![],'where':_0x7890d3[_0x139a('0x1d')]?_0x7890d3[_0x139a('0x1d')][_0x139a('0x1f')]||null:null,'attributes':_0x7890d3[_0x139a('0x1d')]?_0x7890d3[_0x139a('0x1d')]['attributes']||null:null,'limit':_0x7890d3['options']?_0x7890d3[_0x139a('0x1d')][_0x139a('0x20')]||null:null,'include':_0x7890d3[_0x139a('0x1d')]?_0x7890d3[_0x139a('0x1d')][_0x139a('0x21')]?_[_0x139a('0x22')](_0x7890d3[_0x139a('0x1d')][_0x139a('0x21')],function(_0x1c820c){return{'model':db[_0x1c820c[_0x139a('0x23')]],'as':_0x1c820c['as'],'attributes':_0x1c820c['attributes'],'include':_0x1c820c['include']?_['map'](_0x1c820c[_0x139a('0x21')],function(_0xbb1d72){return{'model':db[_0xbb1d72[_0x139a('0x23')]],'as':_0xbb1d72['as'],'attributes':_0xbb1d72['attributes'],'include':_0xbb1d72['include']?_[_0x139a('0x22')](_0xbb1d72[_0x139a('0x21')],function(_0x7e37b9){return{'model':db[_0x7e37b9[_0x139a('0x23')]],'as':_0x7e37b9['as'],'attributes':_0x7e37b9[_0x139a('0x24')]};}):[]};}):[]};}):[]:[]})[_0x139a('0x10')](function(_0x359533){logger['info'](_0x139a('0x1a'),_0x7890d3);logger[_0x139a('0x14')](_0x139a('0x1a'),_0x7890d3,JSON[_0x139a('0x25')](_0x359533));_0x104d9c(_0x359533);})[_0x139a('0x19')](function(_0x26670c){logger['error']('GetSmsQueue',_0x26670c[_0x139a('0x18')],_0x7890d3);_0x4e1d0c(_0x3b55f0[_0x139a('0x16')](0x1f4,_0x26670c[_0x139a('0x18')]));});});};exports[_0x139a('0x26')]=function(_0x57ef7d){var _0x2edd17=this;return new Promise(function(_0x393bfd,_0xa8198d){return db[_0x139a('0x1b')][_0x139a('0x27')]({'raw':_0x57ef7d[_0x139a('0x1d')]?_0x57ef7d[_0x139a('0x1d')][_0x139a('0x1e')]===undefined?!![]:![]:!![],'where':_0x57ef7d[_0x139a('0x1d')]?_0x57ef7d[_0x139a('0x1d')][_0x139a('0x1f')]||null:null,'attributes':_0x57ef7d[_0x139a('0x1d')]?_0x57ef7d[_0x139a('0x1d')]['attributes']||null:null,'include':_0x57ef7d[_0x139a('0x1d')]?_0x57ef7d[_0x139a('0x1d')]['include']?_['map'](_0x57ef7d[_0x139a('0x1d')][_0x139a('0x21')],function(_0x18a4a8){return{'model':db[_0x18a4a8[_0x139a('0x23')]],'as':_0x18a4a8['as'],'attributes':_0x18a4a8[_0x139a('0x24')],'include':_0x18a4a8['include']?_[_0x139a('0x22')](_0x18a4a8[_0x139a('0x21')],function(_0x486f2d){return{'model':db[_0x486f2d['model']],'as':_0x486f2d['as'],'attributes':_0x486f2d['attributes'],'include':_0x486f2d[_0x139a('0x21')]?_['map'](_0x486f2d[_0x139a('0x21')],function(_0x1909a0){return{'model':db[_0x1909a0[_0x139a('0x23')]],'as':_0x1909a0['as'],'attributes':_0x1909a0[_0x139a('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5df7a9){logger[_0x139a('0x11')](_0x139a('0x26'),_0x57ef7d);logger['debug'](_0x139a('0x26'),_0x57ef7d,JSON[_0x139a('0x25')](_0x5df7a9));_0x393bfd(_0x5df7a9);})['catch'](function(_0x227200){logger['error'](_0x139a('0x26'),_0x227200[_0x139a('0x18')],_0x57ef7d);_0xa8198d(_0x2edd17['error'](0x1f4,_0x227200[_0x139a('0x18')]));});});}; \ No newline at end of file +var _0xa974=['map','model','attributes','debug','ShowSmsQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','include'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0xa974,0x13e));var _0x4a97=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xa974[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require(_0x4a97('0x0'));var util=require('util');var moment=require(_0x4a97('0x1'));var BPromise=require(_0x4a97('0x2'));var rs=require(_0x4a97('0x3'));var fs=require('fs');var Redis=require(_0x4a97('0x4'));var db=require(_0x4a97('0x5'))['db'];var utils=require(_0x4a97('0x6'));var logger=require('../../config/logger')(_0x4a97('0x7'));var config=require(_0x4a97('0x8'));var jayson=require(_0x4a97('0x9'));var client=jayson[_0x4a97('0xa')]['http']({'port':0x232a});config[_0x4a97('0xb')]=_[_0x4a97('0xc')](config[_0x4a97('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a97('0xd'))(new Redis(config[_0x4a97('0xb')]));require(_0x4a97('0xe'))['register'](socket);function respondWithRpcPromise(_0xe6ba77,_0x2c9357,_0x48cbdf){return new BPromise(function(_0x37551e,_0x10a7bd){return client[_0x4a97('0xf')](_0xe6ba77,_0x48cbdf)[_0x4a97('0x10')](function(_0x5157df){logger[_0x4a97('0x11')](_0x4a97('0x12'),_0x2c9357,_0x4a97('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2c9357,_0x4a97('0x13'),JSON[_0x4a97('0x14')](_0x5157df));if(_0x5157df['error']){if(_0x5157df[_0x4a97('0x15')][_0x4a97('0x16')]===0x1f4){logger[_0x4a97('0x15')](_0x4a97('0x12'),_0x2c9357,_0x5157df[_0x4a97('0x15')][_0x4a97('0x17')]);return _0x10a7bd(_0x5157df['error'][_0x4a97('0x17')]);}logger[_0x4a97('0x15')]('SmsQueue,\x20%s,\x20%s',_0x2c9357,_0x5157df['error'][_0x4a97('0x17')]);return _0x37551e(_0x5157df[_0x4a97('0x15')][_0x4a97('0x17')]);}else{logger[_0x4a97('0x11')](_0x4a97('0x12'),_0x2c9357,'request\x20sent');_0x37551e(_0x5157df[_0x4a97('0x18')][_0x4a97('0x17')]);}})[_0x4a97('0x19')](function(_0x258062){logger['error'](_0x4a97('0x12'),_0x2c9357,_0x258062);_0x10a7bd(_0x258062);});});}exports[_0x4a97('0x1a')]=function(_0x52660e){var _0x1fa306=this;return new Promise(function(_0x27aec6,_0x38bd39){return db[_0x4a97('0x1b')][_0x4a97('0x1c')]({'raw':_0x52660e[_0x4a97('0x1d')]?_0x52660e['options'][_0x4a97('0x1e')]===undefined?!![]:![]:!![],'where':_0x52660e[_0x4a97('0x1d')]?_0x52660e[_0x4a97('0x1d')][_0x4a97('0x1f')]||null:null,'attributes':_0x52660e[_0x4a97('0x1d')]?_0x52660e[_0x4a97('0x1d')]['attributes']||null:null,'limit':_0x52660e[_0x4a97('0x1d')]?_0x52660e[_0x4a97('0x1d')]['limit']||null:null,'include':_0x52660e['options']?_0x52660e['options'][_0x4a97('0x20')]?_[_0x4a97('0x21')](_0x52660e[_0x4a97('0x1d')][_0x4a97('0x20')],function(_0x8b11da){return{'model':db[_0x8b11da[_0x4a97('0x22')]],'as':_0x8b11da['as'],'attributes':_0x8b11da[_0x4a97('0x23')],'include':_0x8b11da[_0x4a97('0x20')]?_[_0x4a97('0x21')](_0x8b11da[_0x4a97('0x20')],function(_0x309d0c){return{'model':db[_0x309d0c[_0x4a97('0x22')]],'as':_0x309d0c['as'],'attributes':_0x309d0c['attributes'],'include':_0x309d0c['include']?_[_0x4a97('0x21')](_0x309d0c[_0x4a97('0x20')],function(_0x471e85){return{'model':db[_0x471e85[_0x4a97('0x22')]],'as':_0x471e85['as'],'attributes':_0x471e85[_0x4a97('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4a97('0x10')](function(_0x1cdf18){logger['info']('GetSmsQueue',_0x52660e);logger[_0x4a97('0x24')](_0x4a97('0x1a'),_0x52660e,JSON['stringify'](_0x1cdf18));_0x27aec6(_0x1cdf18);})[_0x4a97('0x19')](function(_0xeb882d){logger['error'](_0x4a97('0x1a'),_0xeb882d[_0x4a97('0x17')],_0x52660e);_0x38bd39(_0x1fa306[_0x4a97('0x15')](0x1f4,_0xeb882d[_0x4a97('0x17')]));});});};exports[_0x4a97('0x25')]=function(_0x11cb42){var _0x5f275e=this;return new Promise(function(_0x2e088c,_0x1d66a9){return db['SmsQueue'][_0x4a97('0x26')]({'raw':_0x11cb42['options']?_0x11cb42[_0x4a97('0x1d')][_0x4a97('0x1e')]===undefined?!![]:![]:!![],'where':_0x11cb42[_0x4a97('0x1d')]?_0x11cb42[_0x4a97('0x1d')][_0x4a97('0x1f')]||null:null,'attributes':_0x11cb42['options']?_0x11cb42[_0x4a97('0x1d')][_0x4a97('0x23')]||null:null,'include':_0x11cb42[_0x4a97('0x1d')]?_0x11cb42['options'][_0x4a97('0x20')]?_[_0x4a97('0x21')](_0x11cb42['options'][_0x4a97('0x20')],function(_0x70740f){return{'model':db[_0x70740f['model']],'as':_0x70740f['as'],'attributes':_0x70740f[_0x4a97('0x23')],'include':_0x70740f[_0x4a97('0x20')]?_['map'](_0x70740f[_0x4a97('0x20')],function(_0x223333){return{'model':db[_0x223333['model']],'as':_0x223333['as'],'attributes':_0x223333[_0x4a97('0x23')],'include':_0x223333[_0x4a97('0x20')]?_[_0x4a97('0x21')](_0x223333[_0x4a97('0x20')],function(_0x42afd5){return{'model':db[_0x42afd5[_0x4a97('0x22')]],'as':_0x42afd5['as'],'attributes':_0x42afd5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58e184){logger[_0x4a97('0x11')]('ShowSmsQueue',_0x11cb42);logger[_0x4a97('0x24')]('ShowSmsQueue',_0x11cb42,JSON[_0x4a97('0x14')](_0x58e184));_0x2e088c(_0x58e184);})[_0x4a97('0x19')](function(_0x400dbf){logger[_0x4a97('0x15')](_0x4a97('0x25'),_0x400dbf[_0x4a97('0x17')],_0x11cb42);_0x1d66a9(_0x5f275e[_0x4a97('0x15')](0x1f4,_0x400dbf['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 582466b..e5a2170 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 _0xaf0d=['save','remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0xe6e557,_0x4f724b){var _0x15f8a1=function(_0x50a1cf){while(--_0x50a1cf){_0xe6e557['push'](_0xe6e557['shift']());}};_0x15f8a1(++_0x4f724b);}(_0xaf0d,0x182));var _0xdaf0=function(_0x42dd25,_0x1b94a5){_0x42dd25=_0x42dd25-0x0;var _0xfe36e=_0xaf0d[_0x42dd25];return _0xfe36e;};'use strict';var SmsQueueEvents=require(_0xdaf0('0x0'));var events=[_0xdaf0('0x1'),_0xdaf0('0x2'),_0xdaf0('0x3')];function createListener(_0x3917fc,_0x8060c3){return function(_0x26879e){_0x8060c3[_0xdaf0('0x4')](_0x3917fc,_0x26879e);};}function removeListener(_0x362b79,_0x2b310c){return function(){SmsQueueEvents[_0xdaf0('0x5')](_0x362b79,_0x2b310c);};}exports[_0xdaf0('0x6')]=function(_0x5947af){for(var _0x516b2a=0x0,_0x64b68b=events[_0xdaf0('0x7')];_0x516b2a<_0x64b68b;_0x516b2a++){var _0x287597=events[_0x516b2a];var _0x1b3957=createListener(_0xdaf0('0x8')+_0x287597,_0x5947af);SmsQueueEvents['on'](_0x287597,_0x1b3957);}}; \ No newline at end of file +var _0xd613=['removeListener','register','length','smsQueue:','./smsQueue.events','remove','update'];(function(_0x4b9861,_0x405bc6){var _0x5188c1=function(_0x5c3600){while(--_0x5c3600){_0x4b9861['push'](_0x4b9861['shift']());}};_0x5188c1(++_0x405bc6);}(_0xd613,0x1af));var _0x3d61=function(_0x429806,_0x9471b7){_0x429806=_0x429806-0x0;var _0x4a056d=_0xd613[_0x429806];return _0x4a056d;};'use strict';var SmsQueueEvents=require(_0x3d61('0x0'));var events=['save',_0x3d61('0x1'),_0x3d61('0x2')];function createListener(_0x3653e2,_0x3bcd7e){return function(_0x5d5cdd){_0x3bcd7e['emit'](_0x3653e2,_0x5d5cdd);};}function removeListener(_0x553176,_0x1172be){return function(){SmsQueueEvents[_0x3d61('0x3')](_0x553176,_0x1172be);};}exports[_0x3d61('0x4')]=function(_0x3d31e6){for(var _0x4b8489=0x0,_0x1a57fd=events[_0x3d61('0x5')];_0x4b8489<_0x1a57fd;_0x4b8489++){var _0x435f2a=events[_0x4b8489];var _0x2914e6=createListener(_0x3d61('0x6')+_0x435f2a,_0x3d31e6);SmsQueueEvents['on'](_0x435f2a,_0x2914e6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 948ea08..e056e9f 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 _0x4569=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','/:id','isAuthenticated','show','post','create','delete','exports','multer','util','path'];(function(_0x5f09ac,_0x428ad7){var _0x250af0=function(_0xe606a1){while(--_0xe606a1){_0x5f09ac['push'](_0x5f09ac['shift']());}};_0x250af0(++_0x428ad7);}(_0x4569,0xed));var _0x9456=function(_0x41921b,_0x5e66ed){_0x41921b=_0x41921b-0x0;var _0x164086=_0x4569[_0x41921b];return _0x164086;};'use strict';var multer=require(_0x9456('0x0'));var util=require(_0x9456('0x1'));var path=require(_0x9456('0x2'));var timeout=require(_0x9456('0x3'));var express=require(_0x9456('0x4'));var router=express[_0x9456('0x5')]();var fs_extra=require(_0x9456('0x6'));var auth=require(_0x9456('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9456('0x8'));var controller=require(_0x9456('0x9'));router[_0x9456('0xa')]('/',auth['isAuthenticated'](),controller[_0x9456('0xb')]);router[_0x9456('0xa')](_0x9456('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9456('0xa')](_0x9456('0xd'),auth[_0x9456('0xe')](),controller[_0x9456('0xf')]);router[_0x9456('0x10')]('/',auth['isAuthenticated'](),controller[_0x9456('0x11')]);router['put']('/:id',auth[_0x9456('0xe')](),controller['update']);router[_0x9456('0x12')](_0x9456('0xd'),auth[_0x9456('0xe')](),controller['destroy']);module[_0x9456('0x13')]=router; \ No newline at end of file +var _0x315c=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4eeacc,_0x59eb9d){var _0x54c266=function(_0x5466ae){while(--_0x5466ae){_0x4eeacc['push'](_0x4eeacc['shift']());}};_0x54c266(++_0x59eb9d);}(_0x315c,0xe1));var _0xc315=function(_0x52119a,_0xa099cc){_0x52119a=_0x52119a-0x0;var _0xde2a5c=_0x315c[_0x52119a];return _0xde2a5c;};'use strict';var multer=require(_0xc315('0x0'));var util=require(_0xc315('0x1'));var path=require('path');var timeout=require(_0xc315('0x2'));var express=require('express');var router=express[_0xc315('0x3')]();var fs_extra=require(_0xc315('0x4'));var auth=require(_0xc315('0x5'));var interaction=require(_0xc315('0x6'));var config=require(_0xc315('0x7'));var controller=require(_0xc315('0x8'));router[_0xc315('0x9')]('/',auth[_0xc315('0xa')](),controller[_0xc315('0xb')]);router[_0xc315('0x9')](_0xc315('0xc'),auth[_0xc315('0xa')](),controller[_0xc315('0xd')]);router[_0xc315('0x9')](_0xc315('0xe'),auth['isAuthenticated'](),controller[_0xc315('0xf')]);router[_0xc315('0x10')]('/',auth[_0xc315('0xa')](),controller['create']);router[_0xc315('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc315('0x12')]);router[_0xc315('0x13')]('/:id',auth[_0xc315('0xa')](),controller['destroy']);module[_0xc315('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index f87d594..acefb19 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 _0xbb78=['DATE','exports','STRING'];(function(_0x59b2d3,_0xeca810){var _0x41aab1=function(_0x37c55c){while(--_0x37c55c){_0x59b2d3['push'](_0x59b2d3['shift']());}};_0x41aab1(++_0xeca810);}(_0xbb78,0xf4));var _0x8bb7=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xbb78[_0x4a7631];return _0x1a5a6f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x8bb7('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8bb7('0x1')]},'joinAt':{'type':Sequelize[_0x8bb7('0x2')]},'leaveAt':{'type':Sequelize[_0x8bb7('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8bb7('0x1')]}}; \ No newline at end of file +var _0xd4f4=['moment','STRING','DATE'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xd4f4,0x1bc));var _0x4d4f=function(_0x1c3c75,_0x178112){_0x1c3c75=_0x1c3c75-0x0;var _0x1433ee=_0xd4f4[_0x1c3c75];return _0x1433ee;};'use strict';var moment=require(_0x4d4f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4d4f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4d4f('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4d4f('0x2')]},'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 4345ee9..c7c4c3d 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 _0x6169=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','offset','limit','count','status','set','Content-Range','json','apply','reject','update','then','destroy','end','stack','name','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','order','sort','where','pick','type','merge','options','SmsQueueReport','includeAll','include','findAll','rows','catch','keys','length','find','create','body','params','describe','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel'];(function(_0x5b1003,_0x4bfeb9){var _0x4a3ca8=function(_0x4f5bde){while(--_0x4f5bde){_0x5b1003['push'](_0x5b1003['shift']());}};_0x4a3ca8(++_0x4bfeb9);}(_0x6169,0x79));var _0x9616=function(_0x1f8935,_0x45a5c7){_0x1f8935=_0x1f8935-0x0;var _0x439176=_0x6169[_0x1f8935];return _0x439176;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9616('0x0'));var BPromise=require(_0x9616('0x1'));var Mustache=require(_0x9616('0x2'));var util=require(_0x9616('0x3'));var path=require(_0x9616('0x4'));var sox=require('sox');var csv=require(_0x9616('0x5'));var ejs=require(_0x9616('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9616('0x7'));var squel=require(_0x9616('0x8'));var crypto=require(_0x9616('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9616('0xa'));var toCsv=require(_0x9616('0x5'));var querystring=require(_0x9616('0xb'));var Papa=require(_0x9616('0xc'));var Redis=require(_0x9616('0xd'));var authService=require(_0x9616('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9616('0xf'))('api');var utils=require(_0x9616('0x10'));var config=require(_0x9616('0x11'));var licenseUtil=require(_0x9616('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x449338,_0x14f4a9){_0x14f4a9=_0x14f4a9||0xcc;return function(_0x5d7830){if(_0x5d7830){return _0x449338['sendStatus'](_0x14f4a9);}return _0x449338['status'](_0x14f4a9)['end']();};}function respondWithResult(_0x204ef6,_0x41ef97){_0x41ef97=_0x41ef97||0xc8;return function(_0x995a5d){if(_0x995a5d){return _0x204ef6['status'](_0x41ef97)['json'](_0x995a5d);}};}function respondWithFilteredResult(_0x524440,_0x55a728){return function(_0x31b03b){if(_0x31b03b){var _0x19fdbb=typeof _0x55a728[_0x9616('0x13')]==='undefined'&&typeof _0x55a728[_0x9616('0x14')]==='undefined';var _0x1f673d=_0x31b03b[_0x9616('0x15')];var _0xbe2545=_0x19fdbb?0x0:_0x55a728[_0x9616('0x13')];var _0x5a6cfd=_0x19fdbb?_0x31b03b[_0x9616('0x15')]:_0x55a728[_0x9616('0x13')]+_0x55a728[_0x9616('0x14')];var _0x2b2feb;if(_0x5a6cfd>=_0x1f673d){_0x5a6cfd=_0x1f673d;_0x2b2feb=0xc8;}else{_0x2b2feb=0xce;}_0x524440[_0x9616('0x16')](_0x2b2feb);return _0x524440[_0x9616('0x17')](_0x9616('0x18'),_0xbe2545+'-'+_0x5a6cfd+'/'+_0x1f673d)[_0x9616('0x19')](_0x31b03b);}return null;};}function patchUpdates(_0x368838){return function(_0x2f706b){try{jsonpatch[_0x9616('0x1a')](_0x2f706b,_0x368838,!![]);}catch(_0x1325b6){return BPromise[_0x9616('0x1b')](_0x1325b6);}return _0x2f706b['save']();};}function saveUpdates(_0x5afdf1,_0x3d9d2d){return function(_0x36f1d0){if(_0x36f1d0){return _0x36f1d0[_0x9616('0x1c')](_0x5afdf1)[_0x9616('0x1d')](function(_0x16355f){return _0x16355f;});}return null;};}function removeEntity(_0x18f32,_0x1d08cf){return function(_0x2f421d){if(_0x2f421d){return _0x2f421d[_0x9616('0x1e')]()[_0x9616('0x1d')](function(){_0x18f32[_0x9616('0x16')](0xcc)[_0x9616('0x1f')]();});}};}function handleEntityNotFound(_0x15966e,_0x23d434){return function(_0x20325e){if(!_0x20325e){_0x15966e['sendStatus'](0x194);}return _0x20325e;};}function handleError(_0x43ba04,_0x425e27){_0x425e27=_0x425e27||0x1f4;return function(_0x2c6b3e){logger['error'](_0x2c6b3e[_0x9616('0x20')]);if(_0x2c6b3e[_0x9616('0x21')]){delete _0x2c6b3e[_0x9616('0x21')];}_0x43ba04[_0x9616('0x16')](_0x425e27)['send'](_0x2c6b3e);};}exports[_0x9616('0x22')]=function(_0x52ce82,_0x628ce7){var _0x36890b={},_0x6e0db6={},_0x484cd4={'count':0x0,'rows':[]};var _0x148cb1=_['map'](db['SmsQueueReport'][_0x9616('0x23')],function(_0x5104b9){return{'name':_0x5104b9[_0x9616('0x24')],'type':_0x5104b9['type'][_0x9616('0x25')]};});_0x6e0db6[_0x9616('0x26')]=_[_0x9616('0x27')](_0x148cb1,'name');_0x6e0db6['query']=_['keys'](_0x52ce82[_0x9616('0x28')]);_0x6e0db6[_0x9616('0x29')]=_[_0x9616('0x2a')](_0x6e0db6[_0x9616('0x26')],_0x6e0db6[_0x9616('0x28')]);_0x36890b[_0x9616('0x2b')]=_[_0x9616('0x2a')](_0x6e0db6[_0x9616('0x26')],qs[_0x9616('0x2c')](_0x52ce82[_0x9616('0x28')][_0x9616('0x2c')]));_0x36890b[_0x9616('0x2b')]=_0x36890b['attributes']['length']?_0x36890b[_0x9616('0x2b')]:_0x6e0db6[_0x9616('0x26')];if(!_0x52ce82[_0x9616('0x28')]['hasOwnProperty']('nolimit')){_0x36890b[_0x9616('0x14')]=qs[_0x9616('0x14')](_0x52ce82[_0x9616('0x28')][_0x9616('0x14')]);_0x36890b[_0x9616('0x13')]=qs[_0x9616('0x13')](_0x52ce82[_0x9616('0x28')][_0x9616('0x13')]);}_0x36890b[_0x9616('0x2d')]=qs[_0x9616('0x2e')](_0x52ce82[_0x9616('0x28')][_0x9616('0x2e')]);_0x36890b[_0x9616('0x2f')]=qs[_0x9616('0x29')](_[_0x9616('0x30')](_0x52ce82[_0x9616('0x28')],_0x6e0db6['filters']),_0x148cb1);if(_0x52ce82[_0x9616('0x28')]['filter']){_0x36890b['where']=_['merge'](_0x36890b[_0x9616('0x2f')],{'$or':_[_0x9616('0x27')](_0x148cb1,function(_0x1d784d){if(_0x1d784d[_0x9616('0x31')]!=='VIRTUAL'){var _0x5daee4={};_0x5daee4[_0x1d784d[_0x9616('0x21')]]={'$like':'%'+_0x52ce82[_0x9616('0x28')]['filter']+'%'};return _0x5daee4;}})});}_0x36890b=_[_0x9616('0x32')]({},_0x36890b,_0x52ce82[_0x9616('0x33')]);var _0x427059={'where':_0x36890b[_0x9616('0x2f')]};return db[_0x9616('0x34')]['count'](_0x427059)[_0x9616('0x1d')](function(_0x3833eb){_0x484cd4[_0x9616('0x15')]=_0x3833eb;if(_0x52ce82[_0x9616('0x28')][_0x9616('0x35')]){_0x36890b[_0x9616('0x36')]=[{'all':!![]}];}return db[_0x9616('0x34')][_0x9616('0x37')](_0x36890b);})[_0x9616('0x1d')](function(_0x38d627){_0x484cd4[_0x9616('0x38')]=_0x38d627;return _0x484cd4;})['then'](respondWithFilteredResult(_0x628ce7,_0x36890b))[_0x9616('0x39')](handleError(_0x628ce7,null));};exports['show']=function(_0x4d90b4,_0x3fc682){var _0x435bd0={'raw':!![],'where':{'id':_0x4d90b4['params']['id']}},_0x35e6ce={};_0x35e6ce[_0x9616('0x26')]=_[_0x9616('0x3a')](db[_0x9616('0x34')][_0x9616('0x23')]);_0x35e6ce[_0x9616('0x28')]=_[_0x9616('0x3a')](_0x4d90b4[_0x9616('0x28')]);_0x35e6ce['filters']=_[_0x9616('0x2a')](_0x35e6ce[_0x9616('0x26')],_0x35e6ce[_0x9616('0x28')]);_0x435bd0[_0x9616('0x2b')]=_[_0x9616('0x2a')](_0x35e6ce[_0x9616('0x26')],qs[_0x9616('0x2c')](_0x4d90b4[_0x9616('0x28')]['fields']));_0x435bd0[_0x9616('0x2b')]=_0x435bd0[_0x9616('0x2b')][_0x9616('0x3b')]?_0x435bd0[_0x9616('0x2b')]:_0x35e6ce[_0x9616('0x26')];if(_0x4d90b4[_0x9616('0x28')]['includeAll']){_0x435bd0[_0x9616('0x36')]=[{'all':!![]}];}_0x435bd0=_[_0x9616('0x32')]({},_0x435bd0,_0x4d90b4[_0x9616('0x33')]);return db[_0x9616('0x34')][_0x9616('0x3c')](_0x435bd0)[_0x9616('0x1d')](handleEntityNotFound(_0x3fc682,null))[_0x9616('0x1d')](respondWithResult(_0x3fc682,null))[_0x9616('0x39')](handleError(_0x3fc682,null));};exports[_0x9616('0x3d')]=function(_0x14eb79,_0x403d97){return db[_0x9616('0x34')]['create'](_0x14eb79['body'],{})[_0x9616('0x1d')](respondWithResult(_0x403d97,0xc9))['catch'](handleError(_0x403d97,null));};exports[_0x9616('0x1c')]=function(_0x7b334e,_0xe1c376){if(_0x7b334e[_0x9616('0x3e')]['id']){delete _0x7b334e[_0x9616('0x3e')]['id'];}return db[_0x9616('0x34')][_0x9616('0x3c')]({'where':{'id':_0x7b334e[_0x9616('0x3f')]['id']}})[_0x9616('0x1d')](handleEntityNotFound(_0xe1c376,null))['then'](saveUpdates(_0x7b334e[_0x9616('0x3e')],null))['then'](respondWithResult(_0xe1c376,null))[_0x9616('0x39')](handleError(_0xe1c376,null));};exports[_0x9616('0x1e')]=function(_0x24574b,_0x526402){return db[_0x9616('0x34')][_0x9616('0x3c')]({'where':{'id':_0x24574b[_0x9616('0x3f')]['id']}})[_0x9616('0x1d')](handleEntityNotFound(_0x526402,null))[_0x9616('0x1d')](removeEntity(_0x526402,null))['catch'](handleError(_0x526402,null));};exports[_0x9616('0x40')]=function(_0x4bf88a,_0x102ca8){return db[_0x9616('0x34')][_0x9616('0x40')]()[_0x9616('0x1d')](respondWithResult(_0x102ca8,null))[_0x9616('0x39')](handleError(_0x102ca8,null));}; \ No newline at end of file +var _0x98a4=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','map','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','SmsQueueReport','include','findAll','catch','show','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xcaf756,_0x3fc049){var _0x378827=function(_0x42f799){while(--_0x42f799){_0xcaf756['push'](_0xcaf756['shift']());}};_0x378827(++_0x3fc049);}(_0x98a4,0x1b2));var _0x498a=function(_0x137f05,_0x9f575e){_0x137f05=_0x137f05-0x0;var _0x2c728e=_0x98a4[_0x137f05];return _0x2c728e;};'use strict';var emlformat=require(_0x498a('0x0'));var rimraf=require(_0x498a('0x1'));var zipdir=require(_0x498a('0x2'));var jsonpatch=require(_0x498a('0x3'));var rp=require(_0x498a('0x4'));var moment=require(_0x498a('0x5'));var BPromise=require(_0x498a('0x6'));var Mustache=require(_0x498a('0x7'));var util=require('util');var path=require(_0x498a('0x8'));var sox=require(_0x498a('0x9'));var csv=require(_0x498a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x498a('0xb'));var _=require(_0x498a('0xc'));var squel=require(_0x498a('0xd'));var crypto=require(_0x498a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x498a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x498a('0x10'));var Papa=require(_0x498a('0x11'));var Redis=require(_0x498a('0x12'));var authService=require(_0x498a('0x13'));var qs=require(_0x498a('0x14'));var as=require(_0x498a('0x15'));var hardwareService=require(_0x498a('0x16'));var logger=require(_0x498a('0x17'))(_0x498a('0x18'));var utils=require(_0x498a('0x19'));var config=require(_0x498a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x498a('0x1b'))['db'];function respondWithStatusCode(_0x1e633a,_0x136902){_0x136902=_0x136902||0xcc;return function(_0x469d61){if(_0x469d61){return _0x1e633a[_0x498a('0x1c')](_0x136902);}return _0x1e633a['status'](_0x136902)['end']();};}function respondWithResult(_0x36269d,_0xce9c18){_0xce9c18=_0xce9c18||0xc8;return function(_0x6e1913){if(_0x6e1913){return _0x36269d[_0x498a('0x1d')](_0xce9c18)[_0x498a('0x1e')](_0x6e1913);}};}function respondWithFilteredResult(_0x54f68b,_0x50cc83){return function(_0x47dc89){if(_0x47dc89){var _0x32a90c=typeof _0x50cc83[_0x498a('0x1f')]===_0x498a('0x20')&&typeof _0x50cc83[_0x498a('0x21')]===_0x498a('0x20');var _0x5d1ca4=_0x47dc89[_0x498a('0x22')];var _0x29f6f8=_0x32a90c?0x0:_0x50cc83[_0x498a('0x1f')];var _0x2e8e97=_0x32a90c?_0x47dc89[_0x498a('0x22')]:_0x50cc83[_0x498a('0x1f')]+_0x50cc83[_0x498a('0x21')];var _0x410110;if(_0x2e8e97>=_0x5d1ca4){_0x2e8e97=_0x5d1ca4;_0x410110=0xc8;}else{_0x410110=0xce;}_0x54f68b[_0x498a('0x1d')](_0x410110);return _0x54f68b[_0x498a('0x23')](_0x498a('0x24'),_0x29f6f8+'-'+_0x2e8e97+'/'+_0x5d1ca4)[_0x498a('0x1e')](_0x47dc89);}return null;};}function patchUpdates(_0x551920){return function(_0x413e25){try{jsonpatch[_0x498a('0x25')](_0x413e25,_0x551920,!![]);}catch(_0x1e8de0){return BPromise[_0x498a('0x26')](_0x1e8de0);}return _0x413e25[_0x498a('0x27')]();};}function saveUpdates(_0x20f736,_0x56b125){return function(_0x5d8678){if(_0x5d8678){return _0x5d8678[_0x498a('0x28')](_0x20f736)[_0x498a('0x29')](function(_0x4e7776){return _0x4e7776;});}return null;};}function removeEntity(_0x19c770,_0x5c6df2){return function(_0x2c05d8){if(_0x2c05d8){return _0x2c05d8[_0x498a('0x2a')]()[_0x498a('0x29')](function(){_0x19c770[_0x498a('0x1d')](0xcc)[_0x498a('0x2b')]();});}};}function handleEntityNotFound(_0x9a9c8e,_0x41dde3){return function(_0x3397ee){if(!_0x3397ee){_0x9a9c8e[_0x498a('0x1c')](0x194);}return _0x3397ee;};}function handleError(_0x301f56,_0x235a48){_0x235a48=_0x235a48||0x1f4;return function(_0x211b61){logger['error'](_0x211b61['stack']);if(_0x211b61[_0x498a('0x2c')]){delete _0x211b61[_0x498a('0x2c')];}_0x301f56[_0x498a('0x1d')](_0x235a48)['send'](_0x211b61);};}exports['index']=function(_0x3f3393,_0xd79d40){var _0x59cd93={},_0x3d4fa3={},_0xb99a12={'count':0x0,'rows':[]};var _0xed5201=_[_0x498a('0x2d')](db['SmsQueueReport'][_0x498a('0x2e')],function(_0x5f1727){return{'name':_0x5f1727['fieldName'],'type':_0x5f1727['type'][_0x498a('0x2f')]};});_0x3d4fa3[_0x498a('0x30')]=_[_0x498a('0x2d')](_0xed5201,_0x498a('0x2c'));_0x3d4fa3['query']=_[_0x498a('0x31')](_0x3f3393[_0x498a('0x32')]);_0x3d4fa3[_0x498a('0x33')]=_['intersection'](_0x3d4fa3[_0x498a('0x30')],_0x3d4fa3['query']);_0x59cd93[_0x498a('0x34')]=_[_0x498a('0x35')](_0x3d4fa3[_0x498a('0x30')],qs[_0x498a('0x36')](_0x3f3393['query'][_0x498a('0x36')]));_0x59cd93['attributes']=_0x59cd93[_0x498a('0x34')][_0x498a('0x37')]?_0x59cd93[_0x498a('0x34')]:_0x3d4fa3[_0x498a('0x30')];if(!_0x3f3393[_0x498a('0x32')][_0x498a('0x38')](_0x498a('0x39'))){_0x59cd93[_0x498a('0x21')]=qs[_0x498a('0x21')](_0x3f3393[_0x498a('0x32')][_0x498a('0x21')]);_0x59cd93[_0x498a('0x1f')]=qs[_0x498a('0x1f')](_0x3f3393[_0x498a('0x32')][_0x498a('0x1f')]);}_0x59cd93[_0x498a('0x3a')]=qs[_0x498a('0x3b')](_0x3f3393[_0x498a('0x32')][_0x498a('0x3b')]);_0x59cd93[_0x498a('0x3c')]=qs[_0x498a('0x33')](_[_0x498a('0x3d')](_0x3f3393[_0x498a('0x32')],_0x3d4fa3[_0x498a('0x33')]),_0xed5201);if(_0x3f3393[_0x498a('0x32')][_0x498a('0x3e')]){_0x59cd93[_0x498a('0x3c')]=_['merge'](_0x59cd93[_0x498a('0x3c')],{'$or':_[_0x498a('0x2d')](_0xed5201,function(_0x49c2fd){if(_0x49c2fd[_0x498a('0x3f')]!=='VIRTUAL'){var _0x266afb={};_0x266afb[_0x49c2fd[_0x498a('0x2c')]]={'$like':'%'+_0x3f3393[_0x498a('0x32')][_0x498a('0x3e')]+'%'};return _0x266afb;}})});}_0x59cd93=_[_0x498a('0x40')]({},_0x59cd93,_0x3f3393['options']);var _0x13e383={'where':_0x59cd93[_0x498a('0x3c')]};return db[_0x498a('0x41')]['count'](_0x13e383)[_0x498a('0x29')](function(_0x13673a){_0xb99a12['count']=_0x13673a;if(_0x3f3393[_0x498a('0x32')]['includeAll']){_0x59cd93[_0x498a('0x42')]=[{'all':!![]}];}return db[_0x498a('0x41')][_0x498a('0x43')](_0x59cd93);})['then'](function(_0x44430c){_0xb99a12['rows']=_0x44430c;return _0xb99a12;})[_0x498a('0x29')](respondWithFilteredResult(_0xd79d40,_0x59cd93))[_0x498a('0x44')](handleError(_0xd79d40,null));};exports[_0x498a('0x45')]=function(_0x2c44f8,_0x44d003){var _0x5be773={'raw':!![],'where':{'id':_0x2c44f8[_0x498a('0x46')]['id']}},_0x46e011={};_0x46e011[_0x498a('0x30')]=_[_0x498a('0x31')](db[_0x498a('0x41')][_0x498a('0x2e')]);_0x46e011[_0x498a('0x32')]=_[_0x498a('0x31')](_0x2c44f8[_0x498a('0x32')]);_0x46e011[_0x498a('0x33')]=_[_0x498a('0x35')](_0x46e011[_0x498a('0x30')],_0x46e011[_0x498a('0x32')]);_0x5be773['attributes']=_[_0x498a('0x35')](_0x46e011[_0x498a('0x30')],qs[_0x498a('0x36')](_0x2c44f8[_0x498a('0x32')]['fields']));_0x5be773['attributes']=_0x5be773[_0x498a('0x34')][_0x498a('0x37')]?_0x5be773[_0x498a('0x34')]:_0x46e011['model'];if(_0x2c44f8[_0x498a('0x32')][_0x498a('0x47')]){_0x5be773[_0x498a('0x42')]=[{'all':!![]}];}_0x5be773=_[_0x498a('0x40')]({},_0x5be773,_0x2c44f8[_0x498a('0x48')]);return db[_0x498a('0x41')][_0x498a('0x49')](_0x5be773)[_0x498a('0x29')](handleEntityNotFound(_0x44d003,null))[_0x498a('0x29')](respondWithResult(_0x44d003,null))[_0x498a('0x44')](handleError(_0x44d003,null));};exports[_0x498a('0x4a')]=function(_0xb5e0f5,_0x1bad29){return db[_0x498a('0x41')][_0x498a('0x4a')](_0xb5e0f5['body'],{})['then'](respondWithResult(_0x1bad29,0xc9))[_0x498a('0x44')](handleError(_0x1bad29,null));};exports[_0x498a('0x28')]=function(_0x247baa,_0xfa35fe){if(_0x247baa['body']['id']){delete _0x247baa[_0x498a('0x4b')]['id'];}return db[_0x498a('0x41')][_0x498a('0x49')]({'where':{'id':_0x247baa[_0x498a('0x46')]['id']}})[_0x498a('0x29')](handleEntityNotFound(_0xfa35fe,null))[_0x498a('0x29')](saveUpdates(_0x247baa['body'],null))[_0x498a('0x29')](respondWithResult(_0xfa35fe,null))['catch'](handleError(_0xfa35fe,null));};exports[_0x498a('0x2a')]=function(_0x49944a,_0x550cc1){return db[_0x498a('0x41')][_0x498a('0x49')]({'where':{'id':_0x49944a['params']['id']}})[_0x498a('0x29')](handleEntityNotFound(_0x550cc1,null))[_0x498a('0x29')](removeEntity(_0x550cc1,null))[_0x498a('0x44')](handleError(_0x550cc1,null));};exports[_0x498a('0x4c')]=function(_0x510e2f,_0x190097){return db['SmsQueueReport']['describe']()[_0x498a('0x29')](respondWithResult(_0x190097,null))['catch'](handleError(_0x190097,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c9d419b..4a193fa 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x432291,_0x283269){var _0xec2018=function(_0x11d4d3){while(--_0x11d4d3){_0x432291['push'](_0x432291['shift']());}};_0xec2018(++_0x283269);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x5e62ac,_0x38fa2a){var _0x4dcd4a=function(_0x344a7c){while(--_0x344a7c){_0x5e62ac['push'](_0x5e62ac['shift']());}};_0x4dcd4a(++_0x38fa2a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xcb91[_0x58afd5];return _0x3e503b;};'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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f6bb7dc..63d6afb 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 _0x827a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','UpdateSmsQueueReport','SmsQueueReport','raw','limit','lodash','moment'];(function(_0x279b79,_0x378069){var _0x1ddaba=function(_0x21c66f){while(--_0x21c66f){_0x279b79['push'](_0x279b79['shift']());}};_0x1ddaba(++_0x378069);}(_0x827a,0xb8));var _0xa827=function(_0x1ab466,_0x59ee18){_0x1ab466=_0x1ab466-0x0;var _0x406801=_0x827a[_0x1ab466];return _0x406801;};'use strict';var _=require(_0xa827('0x0'));var util=require('util');var moment=require(_0xa827('0x1'));var BPromise=require(_0xa827('0x2'));var rs=require(_0xa827('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa827('0x4'))['db'];var utils=require(_0xa827('0x5'));var logger=require(_0xa827('0x6'))(_0xa827('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa827('0x8')][_0xa827('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x452349,_0x59d69f,_0x3a2be7){return new BPromise(function(_0x1495c3,_0xd679a){return client[_0xa827('0xa')](_0x452349,_0x3a2be7)[_0xa827('0xb')](function(_0x3fb062){logger[_0xa827('0xc')](_0xa827('0xd'),_0x59d69f,_0xa827('0xe'));logger[_0xa827('0xf')](_0xa827('0x10'),_0x59d69f,_0xa827('0xe'),JSON[_0xa827('0x11')](_0x3fb062));if(_0x3fb062[_0xa827('0x12')]){if(_0x3fb062[_0xa827('0x12')][_0xa827('0x13')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x59d69f,_0x3fb062['error'][_0xa827('0x14')]);return _0xd679a(_0x3fb062[_0xa827('0x12')]['message']);}logger['error'](_0xa827('0xd'),_0x59d69f,_0x3fb062[_0xa827('0x12')][_0xa827('0x14')]);return _0x1495c3(_0x3fb062['error']['message']);}else{logger[_0xa827('0xc')](_0xa827('0xd'),_0x59d69f,'request\x20sent');_0x1495c3(_0x3fb062[_0xa827('0x15')]['message']);}})[_0xa827('0x16')](function(_0x5ebd2c){logger[_0xa827('0x12')](_0xa827('0xd'),_0x59d69f,_0x5ebd2c);_0xd679a(_0x5ebd2c);});});}exports[_0xa827('0x17')]=function(_0x513af9){var _0x359223=this;return new Promise(function(_0x587d51,_0xde06c0){return db['SmsQueueReport'][_0xa827('0x18')](_0x513af9[_0xa827('0x19')],{'raw':_0x513af9['options']?_0x513af9[_0xa827('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xa827('0xb')](function(_0x1a3b95){logger[_0xa827('0xc')](_0xa827('0x17'),_0x513af9);logger['debug'](_0xa827('0x17'),_0x513af9,JSON[_0xa827('0x11')](_0x1a3b95));_0x587d51(_0x1a3b95);})[_0xa827('0x16')](function(_0x28745c){logger[_0xa827('0x12')]('CreateSmsQueueReport',_0x28745c[_0xa827('0x14')],_0x513af9);_0xde06c0(_0x359223['error'](0x1f4,_0x28745c[_0xa827('0x14')]));});});};exports[_0xa827('0x1b')]=function(_0x5c52ac){var _0x4515f1=this;return new Promise(function(_0x4f7eb8,_0xad35e9){return db[_0xa827('0x1c')]['update'](_0x5c52ac[_0xa827('0x19')],{'raw':_0x5c52ac[_0xa827('0x1a')]?_0x5c52ac[_0xa827('0x1a')][_0xa827('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c52ac['options']?_0x5c52ac[_0xa827('0x1a')]['where']||null:null,'attributes':_0x5c52ac['options']?_0x5c52ac['options']['attributes']||null:null,'limit':_0x5c52ac['options']?_0x5c52ac['options'][_0xa827('0x1e')]||null:null})['then'](function(_0x5d874e){logger[_0xa827('0xc')]('UpdateSmsQueueReport',_0x5c52ac);logger['debug'](_0xa827('0x1b'),_0x5c52ac,JSON[_0xa827('0x11')](_0x5d874e));_0x4f7eb8(_0x5d874e);})[_0xa827('0x16')](function(_0x3e166b){logger['error']('UpdateSmsQueueReport',_0x3e166b[_0xa827('0x14')],_0x5c52ac);_0xad35e9(_0x4515f1[_0xa827('0x12')](0x1f4,_0x3e166b[_0xa827('0x14')]));});});}; \ No newline at end of file +var _0xd44f=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x277079,_0x511204){var _0x205a0b=function(_0x4f7df8){while(--_0x4f7df8){_0x277079['push'](_0x277079['shift']());}};_0x205a0b(++_0x511204);}(_0xd44f,0x163));var _0xfd44=function(_0x5e2128,_0xe2107e){_0x5e2128=_0x5e2128-0x0;var _0x2bbc88=_0xd44f[_0x5e2128];return _0x2bbc88;};'use strict';var _=require(_0xfd44('0x0'));var util=require(_0xfd44('0x1'));var moment=require(_0xfd44('0x2'));var BPromise=require(_0xfd44('0x3'));var rs=require(_0xfd44('0x4'));var fs=require('fs');var Redis=require(_0xfd44('0x5'));var db=require(_0xfd44('0x6'))['db'];var utils=require(_0xfd44('0x7'));var logger=require(_0xfd44('0x8'))(_0xfd44('0x9'));var config=require('../../config/environment');var jayson=require(_0xfd44('0xa'));var client=jayson[_0xfd44('0xb')][_0xfd44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x353bb8,_0x55dc74,_0x1aa234){return new BPromise(function(_0x34b301,_0x25ceef){return client[_0xfd44('0xd')](_0x353bb8,_0x1aa234)[_0xfd44('0xe')](function(_0x5ce8f5){logger[_0xfd44('0xf')](_0xfd44('0x10'),_0x55dc74,_0xfd44('0x11'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x55dc74,'request\x20sent',JSON[_0xfd44('0x12')](_0x5ce8f5));if(_0x5ce8f5[_0xfd44('0x13')]){if(_0x5ce8f5[_0xfd44('0x13')][_0xfd44('0x14')]===0x1f4){logger[_0xfd44('0x13')](_0xfd44('0x10'),_0x55dc74,_0x5ce8f5[_0xfd44('0x13')]['message']);return _0x25ceef(_0x5ce8f5[_0xfd44('0x13')][_0xfd44('0x15')]);}logger[_0xfd44('0x13')](_0xfd44('0x10'),_0x55dc74,_0x5ce8f5[_0xfd44('0x13')][_0xfd44('0x15')]);return _0x34b301(_0x5ce8f5[_0xfd44('0x13')][_0xfd44('0x15')]);}else{logger['info'](_0xfd44('0x10'),_0x55dc74,_0xfd44('0x11'));_0x34b301(_0x5ce8f5['result'][_0xfd44('0x15')]);}})['catch'](function(_0x260a1a){logger[_0xfd44('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x55dc74,_0x260a1a);_0x25ceef(_0x260a1a);});});}exports[_0xfd44('0x16')]=function(_0x15812c){var _0x14e772=this;return new Promise(function(_0x26a7d1,_0x145516){return db[_0xfd44('0x17')][_0xfd44('0x18')](_0x15812c[_0xfd44('0x19')],{'raw':_0x15812c[_0xfd44('0x1a')]?_0x15812c['options'][_0xfd44('0x1b')]===undefined?!![]:![]:!![]})[_0xfd44('0xe')](function(_0x2e7e68){logger[_0xfd44('0xf')](_0xfd44('0x16'),_0x15812c);logger[_0xfd44('0x1c')](_0xfd44('0x16'),_0x15812c,JSON[_0xfd44('0x12')](_0x2e7e68));_0x26a7d1(_0x2e7e68);})['catch'](function(_0x4e0426){logger[_0xfd44('0x13')](_0xfd44('0x16'),_0x4e0426['message'],_0x15812c);_0x145516(_0x14e772[_0xfd44('0x13')](0x1f4,_0x4e0426[_0xfd44('0x15')]));});});};exports[_0xfd44('0x1d')]=function(_0x4c537f){var _0x5c0690=this;return new Promise(function(_0x6c9b12,_0x3abbff){return db['SmsQueueReport'][_0xfd44('0x1e')](_0x4c537f[_0xfd44('0x19')],{'raw':_0x4c537f[_0xfd44('0x1a')]?_0x4c537f[_0xfd44('0x1a')][_0xfd44('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c537f[_0xfd44('0x1a')]?_0x4c537f[_0xfd44('0x1a')]['where']||null:null,'attributes':_0x4c537f['options']?_0x4c537f[_0xfd44('0x1a')]['attributes']||null:null,'limit':_0x4c537f[_0xfd44('0x1a')]?_0x4c537f[_0xfd44('0x1a')][_0xfd44('0x1f')]||null:null})[_0xfd44('0xe')](function(_0x93f931){logger[_0xfd44('0xf')](_0xfd44('0x1d'),_0x4c537f);logger[_0xfd44('0x1c')]('UpdateSmsQueueReport',_0x4c537f,JSON[_0xfd44('0x12')](_0x93f931));_0x6c9b12(_0x93f931);})[_0xfd44('0x20')](function(_0x1b65ca){logger[_0xfd44('0x13')]('UpdateSmsQueueReport',_0x1b65ca[_0xfd44('0x15')],_0x4c537f);_0x3abbff(_0x5c0690['error'](0x1f4,_0x1b65ca[_0xfd44('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 6090a2f..8c851b7 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 _0xf8b2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x4f2023,_0x3cfb01){_0x4f2023=_0x4f2023-0x0;var _0x58e5f8=_0xf8b2[_0x4f2023];return _0x58e5f8;};'use strict';var multer=require(_0x2f8b('0x0'));var util=require(_0x2f8b('0x1'));var path=require(_0x2f8b('0x2'));var timeout=require(_0x2f8b('0x3'));var express=require(_0x2f8b('0x4'));var router=express[_0x2f8b('0x5')]();var fs_extra=require(_0x2f8b('0x6'));var auth=require(_0x2f8b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2f8b('0x8'));router[_0x2f8b('0x9')]('/',auth[_0x2f8b('0xa')](),controller[_0x2f8b('0xb')]);router[_0x2f8b('0x9')](_0x2f8b('0xc'),auth[_0x2f8b('0xa')](),controller[_0x2f8b('0xd')]);router[_0x2f8b('0x9')]('/:id',auth[_0x2f8b('0xa')](),controller[_0x2f8b('0xe')]);router[_0x2f8b('0xf')]('/',auth['isAuthenticated'](),controller[_0x2f8b('0x10')]);router[_0x2f8b('0x11')](_0x2f8b('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x2f8b('0x13')](_0x2f8b('0x12'),auth[_0x2f8b('0xa')](),controller[_0x2f8b('0x14')]);module[_0x2f8b('0x15')]=router; \ No newline at end of file +var _0xa1f6=['util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x57278d,_0x2660c4){var _0x4ca698=function(_0x7a9701){while(--_0x7a9701){_0x57278d['push'](_0x57278d['shift']());}};_0x4ca698(++_0x2660c4);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0xa1f6[_0x47e93d];return _0xe86c46;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0xd')]('/',auth[_0x6a1f('0x7')](),controller['create']);router[_0x6a1f('0xe')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xf')]);router['delete'](_0x6a1f('0xb'),auth['isAuthenticated'](),controller[_0x6a1f('0x10')]);module[_0x6a1f('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 4f2f9dd..d848d57 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x4434d6,_0x62fbc0){var _0x39b89c=function(_0x1b1d3b){while(--_0x1b1d3b){_0x4434d6['push'](_0x4434d6['shift']());}};_0x39b89c(++_0x62fbc0);}(_0xe706,0xa3));var _0x6e70=function(_0x36153d,_0x4fed67){_0x36153d=_0x36153d-0x0;var _0xfdacff=_0xe706[_0x36153d];return _0xfdacff;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5ae6d9,_0x3b8022){_0x5ae6d9=_0x5ae6d9-0x0;var _0x3a240f=_0xb43b[_0x5ae6d9];return _0x3a240f;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 195d044..ea983ad 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 _0x7770=['catch','show','params','keys','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','status','end','stack','name','send','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','filter','options','SmsTransferReport','include','findAll','rows'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7770,0xe1));var _0x0777=function(_0xb0725b,_0x23e17b){_0xb0725b=_0xb0725b-0x0;var _0x4267b9=_0x7770[_0xb0725b];return _0x4267b9;};'use strict';var emlformat=require(_0x0777('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0777('0x1'));var jsonpatch=require(_0x0777('0x2'));var rp=require('request-promise');var moment=require(_0x0777('0x3'));var BPromise=require(_0x0777('0x4'));var Mustache=require(_0x0777('0x5'));var util=require(_0x0777('0x6'));var path=require(_0x0777('0x7'));var sox=require('sox');var csv=require(_0x0777('0x8'));var ejs=require(_0x0777('0x9'));var fs=require('fs');var fs_extra=require(_0x0777('0xa'));var _=require('lodash');var squel=require(_0x0777('0xb'));var crypto=require(_0x0777('0xc'));var jsforce=require(_0x0777('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0777('0x8'));var querystring=require('querystring');var Papa=require(_0x0777('0xe'));var Redis=require('ioredis');var authService=require(_0x0777('0xf'));var qs=require(_0x0777('0x10'));var as=require(_0x0777('0x11'));var hardwareService=require(_0x0777('0x12'));var logger=require(_0x0777('0x13'))(_0x0777('0x14'));var utils=require('../../config/utils');var config=require(_0x0777('0x15'));var licenseUtil=require(_0x0777('0x16'));var db=require(_0x0777('0x17'))['db'];function respondWithStatusCode(_0x4afbb3,_0x2c026c){_0x2c026c=_0x2c026c||0xcc;return function(_0x199816){if(_0x199816){return _0x4afbb3[_0x0777('0x18')](_0x2c026c);}return _0x4afbb3['status'](_0x2c026c)['end']();};}function respondWithResult(_0x1431d3,_0x299831){_0x299831=_0x299831||0xc8;return function(_0x1e80cb){if(_0x1e80cb){return _0x1431d3['status'](_0x299831)[_0x0777('0x19')](_0x1e80cb);}};}function respondWithFilteredResult(_0x29f529,_0x198c79){return function(_0x51c844){if(_0x51c844){var _0x275dd0=typeof _0x198c79['offset']==='undefined'&&typeof _0x198c79[_0x0777('0x1a')]==='undefined';var _0x576e84=_0x51c844[_0x0777('0x1b')];var _0xa828d3=_0x275dd0?0x0:_0x198c79['offset'];var _0x254ce9=_0x275dd0?_0x51c844[_0x0777('0x1b')]:_0x198c79[_0x0777('0x1c')]+_0x198c79['limit'];var _0x460c38;if(_0x254ce9>=_0x576e84){_0x254ce9=_0x576e84;_0x460c38=0xc8;}else{_0x460c38=0xce;}_0x29f529['status'](_0x460c38);return _0x29f529[_0x0777('0x1d')](_0x0777('0x1e'),_0xa828d3+'-'+_0x254ce9+'/'+_0x576e84)[_0x0777('0x19')](_0x51c844);}return null;};}function patchUpdates(_0x171967){return function(_0xdc7743){try{jsonpatch['apply'](_0xdc7743,_0x171967,!![]);}catch(_0x1c58c3){return BPromise[_0x0777('0x1f')](_0x1c58c3);}return _0xdc7743[_0x0777('0x20')]();};}function saveUpdates(_0x4625f0,_0x119121){return function(_0x4a1126){if(_0x4a1126){return _0x4a1126[_0x0777('0x21')](_0x4625f0)[_0x0777('0x22')](function(_0x63e3b6){return _0x63e3b6;});}return null;};}function removeEntity(_0x4b05a1,_0x7c8d08){return function(_0x42cbe7){if(_0x42cbe7){return _0x42cbe7[_0x0777('0x23')]()[_0x0777('0x22')](function(){_0x4b05a1[_0x0777('0x24')](0xcc)[_0x0777('0x25')]();});}};}function handleEntityNotFound(_0x4e7f4e,_0x2ab1df){return function(_0x8b4045){if(!_0x8b4045){_0x4e7f4e['sendStatus'](0x194);}return _0x8b4045;};}function handleError(_0x3ac842,_0x334a73){_0x334a73=_0x334a73||0x1f4;return function(_0x22cf68){logger['error'](_0x22cf68[_0x0777('0x26')]);if(_0x22cf68[_0x0777('0x27')]){delete _0x22cf68[_0x0777('0x27')];}_0x3ac842[_0x0777('0x24')](_0x334a73)[_0x0777('0x28')](_0x22cf68);};}exports[_0x0777('0x29')]=function(_0x34bf4e,_0x178904){var _0x44ccf3={},_0xb7e14e={},_0x3c7be7={'count':0x0,'rows':[]};var _0x3eb987=_[_0x0777('0x2a')](db['SmsTransferReport'][_0x0777('0x2b')],function(_0x20b547){return{'name':_0x20b547['fieldName'],'type':_0x20b547['type'][_0x0777('0x2c')]};});_0xb7e14e[_0x0777('0x2d')]=_[_0x0777('0x2a')](_0x3eb987,'name');_0xb7e14e[_0x0777('0x2e')]=_['keys'](_0x34bf4e[_0x0777('0x2e')]);_0xb7e14e[_0x0777('0x2f')]=_[_0x0777('0x30')](_0xb7e14e[_0x0777('0x2d')],_0xb7e14e['query']);_0x44ccf3[_0x0777('0x31')]=_[_0x0777('0x30')](_0xb7e14e['model'],qs[_0x0777('0x32')](_0x34bf4e[_0x0777('0x2e')][_0x0777('0x32')]));_0x44ccf3[_0x0777('0x31')]=_0x44ccf3[_0x0777('0x31')]['length']?_0x44ccf3[_0x0777('0x31')]:_0xb7e14e[_0x0777('0x2d')];if(!_0x34bf4e['query']['hasOwnProperty'](_0x0777('0x33'))){_0x44ccf3['limit']=qs['limit'](_0x34bf4e[_0x0777('0x2e')]['limit']);_0x44ccf3[_0x0777('0x1c')]=qs['offset'](_0x34bf4e[_0x0777('0x2e')][_0x0777('0x1c')]);}_0x44ccf3[_0x0777('0x34')]=qs[_0x0777('0x35')](_0x34bf4e[_0x0777('0x2e')][_0x0777('0x35')]);_0x44ccf3[_0x0777('0x36')]=qs[_0x0777('0x2f')](_['pick'](_0x34bf4e[_0x0777('0x2e')],_0xb7e14e[_0x0777('0x2f')]),_0x3eb987);if(_0x34bf4e[_0x0777('0x2e')]['filter']){_0x44ccf3[_0x0777('0x36')]=_[_0x0777('0x37')](_0x44ccf3[_0x0777('0x36')],{'$or':_[_0x0777('0x2a')](_0x3eb987,function(_0x498754){if(_0x498754[_0x0777('0x38')]!=='VIRTUAL'){var _0x278cd9={};_0x278cd9[_0x498754['name']]={'$like':'%'+_0x34bf4e[_0x0777('0x2e')][_0x0777('0x39')]+'%'};return _0x278cd9;}})});}_0x44ccf3=_[_0x0777('0x37')]({},_0x44ccf3,_0x34bf4e[_0x0777('0x3a')]);var _0x1eb43e={'where':_0x44ccf3['where']};return db[_0x0777('0x3b')][_0x0777('0x1b')](_0x1eb43e)['then'](function(_0x32a032){_0x3c7be7[_0x0777('0x1b')]=_0x32a032;if(_0x34bf4e['query']['includeAll']){_0x44ccf3[_0x0777('0x3c')]=[{'all':!![]}];}return db[_0x0777('0x3b')][_0x0777('0x3d')](_0x44ccf3);})[_0x0777('0x22')](function(_0x3e8256){_0x3c7be7[_0x0777('0x3e')]=_0x3e8256;return _0x3c7be7;})['then'](respondWithFilteredResult(_0x178904,_0x44ccf3))[_0x0777('0x3f')](handleError(_0x178904,null));};exports[_0x0777('0x40')]=function(_0x39c3b3,_0x2c9156){var _0x1055e8={'raw':!![],'where':{'id':_0x39c3b3[_0x0777('0x41')]['id']}},_0x5e9c61={};_0x5e9c61['model']=_[_0x0777('0x42')](db['SmsTransferReport']['rawAttributes']);_0x5e9c61[_0x0777('0x2e')]=_[_0x0777('0x42')](_0x39c3b3['query']);_0x5e9c61[_0x0777('0x2f')]=_['intersection'](_0x5e9c61['model'],_0x5e9c61['query']);_0x1055e8[_0x0777('0x31')]=_[_0x0777('0x30')](_0x5e9c61['model'],qs[_0x0777('0x32')](_0x39c3b3[_0x0777('0x2e')][_0x0777('0x32')]));_0x1055e8[_0x0777('0x31')]=_0x1055e8[_0x0777('0x31')]['length']?_0x1055e8[_0x0777('0x31')]:_0x5e9c61['model'];if(_0x39c3b3[_0x0777('0x2e')][_0x0777('0x43')]){_0x1055e8[_0x0777('0x3c')]=[{'all':!![]}];}_0x1055e8=_[_0x0777('0x37')]({},_0x1055e8,_0x39c3b3['options']);return db['SmsTransferReport'][_0x0777('0x44')](_0x1055e8)[_0x0777('0x22')](handleEntityNotFound(_0x2c9156,null))[_0x0777('0x22')](respondWithResult(_0x2c9156,null))['catch'](handleError(_0x2c9156,null));};exports['create']=function(_0x298e80,_0x59fcdc){return db['SmsTransferReport'][_0x0777('0x45')](_0x298e80['body'],{})[_0x0777('0x22')](respondWithResult(_0x59fcdc,0xc9))[_0x0777('0x3f')](handleError(_0x59fcdc,null));};exports[_0x0777('0x21')]=function(_0x245889,_0x593994){if(_0x245889['body']['id']){delete _0x245889[_0x0777('0x46')]['id'];}return db['SmsTransferReport'][_0x0777('0x44')]({'where':{'id':_0x245889[_0x0777('0x41')]['id']}})[_0x0777('0x22')](handleEntityNotFound(_0x593994,null))[_0x0777('0x22')](saveUpdates(_0x245889[_0x0777('0x46')],null))[_0x0777('0x22')](respondWithResult(_0x593994,null))[_0x0777('0x3f')](handleError(_0x593994,null));};exports[_0x0777('0x23')]=function(_0x3bbe8a,_0x205419){return db[_0x0777('0x3b')][_0x0777('0x44')]({'where':{'id':_0x3bbe8a['params']['id']}})[_0x0777('0x22')](handleEntityNotFound(_0x205419,null))[_0x0777('0x22')](removeEntity(_0x205419,null))[_0x0777('0x3f')](handleError(_0x205419,null));};exports[_0x0777('0x47')]=function(_0x3ab890,_0x23f49a){return db[_0x0777('0x3b')][_0x0777('0x47')]()[_0x0777('0x22')](respondWithResult(_0x23f49a,null))[_0x0777('0x3f')](handleError(_0x23f49a,null));}; \ No newline at end of file +var _0x801f=['stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0x367ffd,_0x23cc3d){var _0x26f467=function(_0x460c8f){while(--_0x460c8f){_0x367ffd['push'](_0x367ffd['shift']());}};_0x26f467(++_0x23cc3d);}(_0x801f,0x1ee));var _0xf801=function(_0x3f18ba,_0x38da0e){_0x3f18ba=_0x3f18ba-0x0;var _0x1d3b77=_0x801f[_0x3f18ba];return _0x1d3b77;};'use strict';var emlformat=require(_0xf801('0x0'));var rimraf=require(_0xf801('0x1'));var zipdir=require(_0xf801('0x2'));var jsonpatch=require(_0xf801('0x3'));var rp=require(_0xf801('0x4'));var moment=require(_0xf801('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf801('0x6'));var path=require('path');var sox=require(_0xf801('0x7'));var csv=require(_0xf801('0x8'));var ejs=require(_0xf801('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf801('0xa'));var crypto=require('crypto');var jsforce=require(_0xf801('0xb'));var deskjs=require(_0xf801('0xc'));var toCsv=require(_0xf801('0x8'));var querystring=require('querystring');var Papa=require(_0xf801('0xd'));var Redis=require(_0xf801('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf801('0xf'));var as=require(_0xf801('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf801('0x11'))(_0xf801('0x12'));var utils=require(_0xf801('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf801('0x14'));var db=require(_0xf801('0x15'))['db'];function respondWithStatusCode(_0x35c661,_0x121f94){_0x121f94=_0x121f94||0xcc;return function(_0x2d0dfc){if(_0x2d0dfc){return _0x35c661[_0xf801('0x16')](_0x121f94);}return _0x35c661[_0xf801('0x17')](_0x121f94)[_0xf801('0x18')]();};}function respondWithResult(_0x5666e1,_0x2a6d93){_0x2a6d93=_0x2a6d93||0xc8;return function(_0x29f7de){if(_0x29f7de){return _0x5666e1['status'](_0x2a6d93)[_0xf801('0x19')](_0x29f7de);}};}function respondWithFilteredResult(_0x1805f5,_0x24a085){return function(_0x56272e){if(_0x56272e){var _0x39cdfc=typeof _0x24a085[_0xf801('0x1a')]===_0xf801('0x1b')&&typeof _0x24a085['limit']===_0xf801('0x1b');var _0x541c2f=_0x56272e[_0xf801('0x1c')];var _0x249b85=_0x39cdfc?0x0:_0x24a085[_0xf801('0x1a')];var _0xeb1c37=_0x39cdfc?_0x56272e[_0xf801('0x1c')]:_0x24a085[_0xf801('0x1a')]+_0x24a085[_0xf801('0x1d')];var _0xccd0d3;if(_0xeb1c37>=_0x541c2f){_0xeb1c37=_0x541c2f;_0xccd0d3=0xc8;}else{_0xccd0d3=0xce;}_0x1805f5[_0xf801('0x17')](_0xccd0d3);return _0x1805f5[_0xf801('0x1e')](_0xf801('0x1f'),_0x249b85+'-'+_0xeb1c37+'/'+_0x541c2f)['json'](_0x56272e);}return null;};}function patchUpdates(_0x3d48f6){return function(_0xf62212){try{jsonpatch[_0xf801('0x20')](_0xf62212,_0x3d48f6,!![]);}catch(_0x5b6439){return BPromise['reject'](_0x5b6439);}return _0xf62212[_0xf801('0x21')]();};}function saveUpdates(_0x37b1cd,_0x1a8802){return function(_0x5641ff){if(_0x5641ff){return _0x5641ff[_0xf801('0x22')](_0x37b1cd)[_0xf801('0x23')](function(_0x586da0){return _0x586da0;});}return null;};}function removeEntity(_0x5b4a42,_0x30b35a){return function(_0x3ff030){if(_0x3ff030){return _0x3ff030[_0xf801('0x24')]()[_0xf801('0x23')](function(){_0x5b4a42[_0xf801('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f0f8b,_0xb0565b){return function(_0x5a67d0){if(!_0x5a67d0){_0x9f0f8b[_0xf801('0x16')](0x194);}return _0x5a67d0;};}function handleError(_0x6ae70a,_0x370778){_0x370778=_0x370778||0x1f4;return function(_0x4333b7){logger[_0xf801('0x25')](_0x4333b7[_0xf801('0x26')]);if(_0x4333b7[_0xf801('0x27')]){delete _0x4333b7[_0xf801('0x27')];}_0x6ae70a[_0xf801('0x17')](_0x370778)[_0xf801('0x28')](_0x4333b7);};}exports[_0xf801('0x29')]=function(_0x5846ea,_0x31ddeb){var _0x3f0d70={},_0x56ff51={},_0x2d5b96={'count':0x0,'rows':[]};var _0x4358df=_[_0xf801('0x2a')](db[_0xf801('0x2b')]['rawAttributes'],function(_0x383480){return{'name':_0x383480[_0xf801('0x2c')],'type':_0x383480[_0xf801('0x2d')][_0xf801('0x2e')]};});_0x56ff51[_0xf801('0x2f')]=_[_0xf801('0x2a')](_0x4358df,_0xf801('0x27'));_0x56ff51[_0xf801('0x30')]=_[_0xf801('0x31')](_0x5846ea[_0xf801('0x30')]);_0x56ff51['filters']=_[_0xf801('0x32')](_0x56ff51[_0xf801('0x2f')],_0x56ff51[_0xf801('0x30')]);_0x3f0d70['attributes']=_[_0xf801('0x32')](_0x56ff51[_0xf801('0x2f')],qs[_0xf801('0x33')](_0x5846ea[_0xf801('0x30')]['fields']));_0x3f0d70[_0xf801('0x34')]=_0x3f0d70[_0xf801('0x34')]['length']?_0x3f0d70[_0xf801('0x34')]:_0x56ff51['model'];if(!_0x5846ea[_0xf801('0x30')][_0xf801('0x35')](_0xf801('0x36'))){_0x3f0d70[_0xf801('0x1d')]=qs[_0xf801('0x1d')](_0x5846ea[_0xf801('0x30')][_0xf801('0x1d')]);_0x3f0d70['offset']=qs[_0xf801('0x1a')](_0x5846ea[_0xf801('0x30')][_0xf801('0x1a')]);}_0x3f0d70[_0xf801('0x37')]=qs[_0xf801('0x38')](_0x5846ea[_0xf801('0x30')][_0xf801('0x38')]);_0x3f0d70['where']=qs[_0xf801('0x39')](_[_0xf801('0x3a')](_0x5846ea['query'],_0x56ff51[_0xf801('0x39')]),_0x4358df);if(_0x5846ea[_0xf801('0x30')][_0xf801('0x3b')]){_0x3f0d70[_0xf801('0x3c')]=_[_0xf801('0x3d')](_0x3f0d70[_0xf801('0x3c')],{'$or':_[_0xf801('0x2a')](_0x4358df,function(_0xad4cb3){if(_0xad4cb3['type']!==_0xf801('0x3e')){var _0x256856={};_0x256856[_0xad4cb3[_0xf801('0x27')]]={'$like':'%'+_0x5846ea[_0xf801('0x30')][_0xf801('0x3b')]+'%'};return _0x256856;}})});}_0x3f0d70=_['merge']({},_0x3f0d70,_0x5846ea[_0xf801('0x3f')]);var _0x4b1f87={'where':_0x3f0d70[_0xf801('0x3c')]};return db[_0xf801('0x2b')]['count'](_0x4b1f87)[_0xf801('0x23')](function(_0x806741){_0x2d5b96[_0xf801('0x1c')]=_0x806741;if(_0x5846ea['query'][_0xf801('0x40')]){_0x3f0d70[_0xf801('0x41')]=[{'all':!![]}];}return db[_0xf801('0x2b')][_0xf801('0x42')](_0x3f0d70);})[_0xf801('0x23')](function(_0x128697){_0x2d5b96[_0xf801('0x43')]=_0x128697;return _0x2d5b96;})['then'](respondWithFilteredResult(_0x31ddeb,_0x3f0d70))[_0xf801('0x44')](handleError(_0x31ddeb,null));};exports[_0xf801('0x45')]=function(_0x4ae44b,_0x4c931b){var _0x544b8b={'raw':!![],'where':{'id':_0x4ae44b[_0xf801('0x46')]['id']}},_0x5d0a16={};_0x5d0a16['model']=_[_0xf801('0x31')](db[_0xf801('0x2b')]['rawAttributes']);_0x5d0a16[_0xf801('0x30')]=_['keys'](_0x4ae44b[_0xf801('0x30')]);_0x5d0a16[_0xf801('0x39')]=_['intersection'](_0x5d0a16[_0xf801('0x2f')],_0x5d0a16['query']);_0x544b8b[_0xf801('0x34')]=_['intersection'](_0x5d0a16[_0xf801('0x2f')],qs['fields'](_0x4ae44b[_0xf801('0x30')][_0xf801('0x33')]));_0x544b8b[_0xf801('0x34')]=_0x544b8b[_0xf801('0x34')][_0xf801('0x47')]?_0x544b8b[_0xf801('0x34')]:_0x5d0a16[_0xf801('0x2f')];if(_0x4ae44b[_0xf801('0x30')][_0xf801('0x40')]){_0x544b8b[_0xf801('0x41')]=[{'all':!![]}];}_0x544b8b=_[_0xf801('0x3d')]({},_0x544b8b,_0x4ae44b[_0xf801('0x3f')]);return db[_0xf801('0x2b')][_0xf801('0x48')](_0x544b8b)[_0xf801('0x23')](handleEntityNotFound(_0x4c931b,null))[_0xf801('0x23')](respondWithResult(_0x4c931b,null))[_0xf801('0x44')](handleError(_0x4c931b,null));};exports[_0xf801('0x49')]=function(_0x42a3b6,_0x55ead8){return db['SmsTransferReport'][_0xf801('0x49')](_0x42a3b6[_0xf801('0x4a')],{})[_0xf801('0x23')](respondWithResult(_0x55ead8,0xc9))[_0xf801('0x44')](handleError(_0x55ead8,null));};exports[_0xf801('0x22')]=function(_0x413d01,_0x2ab0f4){if(_0x413d01[_0xf801('0x4a')]['id']){delete _0x413d01[_0xf801('0x4a')]['id'];}return db[_0xf801('0x2b')][_0xf801('0x48')]({'where':{'id':_0x413d01[_0xf801('0x46')]['id']}})[_0xf801('0x23')](handleEntityNotFound(_0x2ab0f4,null))[_0xf801('0x23')](saveUpdates(_0x413d01[_0xf801('0x4a')],null))[_0xf801('0x23')](respondWithResult(_0x2ab0f4,null))['catch'](handleError(_0x2ab0f4,null));};exports[_0xf801('0x24')]=function(_0x447394,_0x232988){return db[_0xf801('0x2b')]['find']({'where':{'id':_0x447394['params']['id']}})[_0xf801('0x23')](handleEntityNotFound(_0x232988,null))[_0xf801('0x23')](removeEntity(_0x232988,null))['catch'](handleError(_0x232988,null));};exports['describe']=function(_0x10b287,_0x451b22){return db[_0xf801('0x2b')][_0xf801('0x4b')]()[_0xf801('0x23')](respondWithResult(_0x451b22,null))[_0xf801('0x44')](handleError(_0x451b22,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 95af897..0b86f82 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 _0x56e6=['bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5b142f,_0x10815a){var _0x327bbd=function(_0x56806f){while(--_0x56806f){_0x5b142f['push'](_0x5b142f['shift']());}};_0x327bbd(++_0x10815a);}(_0x56e6,0x6b));var _0x656e=function(_0x500364,_0x2b19e0){_0x500364=_0x500364-0x0;var _0x5b023a=_0x56e6[_0x500364];return _0x5b023a;};'use strict';var _=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var logger=require(_0x656e('0x2'))(_0x656e('0x3'));var moment=require(_0x656e('0x4'));var BPromise=require(_0x656e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x656e('0x6'));var rimraf=require(_0x656e('0x7'));var config=require(_0x656e('0x8'));var attributes=require(_0x656e('0x9'));module[_0x656e('0xa')]=function(_0x3fef98,_0x81c232){return _0x3fef98['define'](_0x656e('0xb'),attributes,{'tableName':_0x656e('0xc'),'paranoid':![],'indexes':[{'name':_0x656e('0xd'),'fields':[_0x656e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x668b=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_sms_transfer'];(function(_0x38a43a,_0x19fabf){var _0x49ca46=function(_0x150238){while(--_0x150238){_0x38a43a['push'](_0x38a43a['shift']());}};_0x49ca46(++_0x19fabf);}(_0x668b,0x8d));var _0xb668=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x668b[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require(_0xb668('0x2'))(_0xb668('0x3'));var moment=require(_0xb668('0x4'));var BPromise=require(_0xb668('0x5'));var rp=require(_0xb668('0x6'));var fs=require('fs');var path=require(_0xb668('0x7'));var rimraf=require(_0xb668('0x8'));var config=require(_0xb668('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0xb668('0xa')]=function(_0x145564,_0x551fc3){return _0x145564[_0xb668('0xb')]('SmsTransferReport',attributes,{'tableName':_0xb668('0xc'),'paranoid':![],'indexes':[{'name':_0xb668('0xd'),'fields':[_0xb668('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index f401f1b..6cc8848 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 _0x562d=['stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x14d326,_0x17ca1c){var _0x5b5e0b=function(_0xf6b54c){while(--_0xf6b54c){_0x14d326['push'](_0x14d326['shift']());}};_0x5b5e0b(++_0x17ca1c);}(_0x562d,0xe1));var _0xd562=function(_0xef5f0f,_0x35b798){_0xef5f0f=_0xef5f0f-0x0;var _0xd3b8d=_0x562d[_0xef5f0f];return _0xd3b8d;};'use strict';var _=require(_0xd562('0x0'));var util=require(_0xd562('0x1'));var moment=require(_0xd562('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd562('0x3'));var db=require(_0xd562('0x4'))['db'];var utils=require(_0xd562('0x5'));var logger=require('../../config/logger')(_0xd562('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd562('0x7')][_0xd562('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e6465,_0x3b03fe,_0x21f82a){return new BPromise(function(_0x38e1a7,_0x56c6f7){return client[_0xd562('0x9')](_0x3e6465,_0x21f82a)['then'](function(_0x32c054){logger[_0xd562('0xa')](_0xd562('0xb'),_0x3b03fe,_0xd562('0xc'));logger[_0xd562('0xd')](_0xd562('0xe'),_0x3b03fe,_0xd562('0xc'),JSON[_0xd562('0xf')](_0x32c054));if(_0x32c054[_0xd562('0x10')]){if(_0x32c054[_0xd562('0x10')][_0xd562('0x11')]===0x1f4){logger['error'](_0xd562('0xb'),_0x3b03fe,_0x32c054['error']['message']);return _0x56c6f7(_0x32c054[_0xd562('0x10')]['message']);}logger[_0xd562('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3b03fe,_0x32c054['error'][_0xd562('0x12')]);return _0x38e1a7(_0x32c054[_0xd562('0x10')][_0xd562('0x12')]);}else{logger[_0xd562('0xa')](_0xd562('0xb'),_0x3b03fe,'request\x20sent');_0x38e1a7(_0x32c054[_0xd562('0x13')][_0xd562('0x12')]);}})['catch'](function(_0x24b1c4){logger[_0xd562('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3b03fe,_0x24b1c4);_0x56c6f7(_0x24b1c4);});});} \ No newline at end of file +var _0x861a=['stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x13f808,_0x3a7d80){var _0x2e79ab=function(_0x49e621){while(--_0x49e621){_0x13f808['push'](_0x13f808['shift']());}};_0x2e79ab(++_0x3a7d80);}(_0x861a,0x194));var _0xa861=function(_0x5eea9d,_0x44d620){_0x5eea9d=_0x5eea9d-0x0;var _0xb568f2=_0x861a[_0x5eea9d];return _0xb568f2;};'use strict';var _=require(_0xa861('0x0'));var util=require('util');var moment=require(_0xa861('0x1'));var BPromise=require(_0xa861('0x2'));var rs=require(_0xa861('0x3'));var fs=require('fs');var Redis=require(_0xa861('0x4'));var db=require(_0xa861('0x5'))['db'];var utils=require(_0xa861('0x6'));var logger=require('../../config/logger')(_0xa861('0x7'));var config=require(_0xa861('0x8'));var jayson=require(_0xa861('0x9'));var client=jayson[_0xa861('0xa')][_0xa861('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bc6cb,_0x2c9016,_0x410918){return new BPromise(function(_0x46e2ce,_0x300ab7){return client[_0xa861('0xc')](_0x5bc6cb,_0x410918)[_0xa861('0xd')](function(_0x24e3ad){logger[_0xa861('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x2c9016,'request\x20sent');logger[_0xa861('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2c9016,'request\x20sent',JSON[_0xa861('0x10')](_0x24e3ad));if(_0x24e3ad[_0xa861('0x11')]){if(_0x24e3ad[_0xa861('0x11')]['code']===0x1f4){logger[_0xa861('0x11')](_0xa861('0x12'),_0x2c9016,_0x24e3ad[_0xa861('0x11')][_0xa861('0x13')]);return _0x300ab7(_0x24e3ad[_0xa861('0x11')]['message']);}logger['error'](_0xa861('0x12'),_0x2c9016,_0x24e3ad['error']['message']);return _0x46e2ce(_0x24e3ad[_0xa861('0x11')][_0xa861('0x13')]);}else{logger[_0xa861('0xe')](_0xa861('0x12'),_0x2c9016,'request\x20sent');_0x46e2ce(_0x24e3ad[_0xa861('0x14')]['message']);}})['catch'](function(_0x5503fd){logger[_0xa861('0x11')](_0xa861('0x12'),_0x2c9016,_0x5503fd);_0x300ab7(_0x5503fd);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 5d9428a..694d6b2 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 _0xf480=['replace','basename','extname','post','single','create','/:id','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname'];(function(_0x72c194,_0x1a953a){var _0x1f4f68=function(_0x43bcdd){while(--_0x43bcdd){_0x72c194['push'](_0x72c194['shift']());}};_0x1f4f68(++_0x1a953a);}(_0xf480,0x1ef));var _0x0f48=function(_0x20e408,_0x578764){_0x20e408=_0x20e408-0x0;var _0x157fae=_0xf480[_0x20e408];return _0x157fae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f48('0x0'));var timeout=require(_0x0f48('0x1'));var express=require(_0x0f48('0x2'));var router=express[_0x0f48('0x3')]();var fs_extra=require(_0x0f48('0x4'));var auth=require(_0x0f48('0x5'));var interaction=require(_0x0f48('0x6'));var config=require('../../config/environment');var controller=require(_0x0f48('0x7'));router[_0x0f48('0x8')]('/',auth[_0x0f48('0x9')](),controller[_0x0f48('0xa')]);router[_0x0f48('0x8')]('/:id',auth[_0x0f48('0x9')](),controller[_0x0f48('0xb')]);router[_0x0f48('0x8')](_0x0f48('0xc'),auth[_0x0f48('0x9')](),controller[_0x0f48('0xd')]);var upload=multer({'storage':multer[_0x0f48('0xe')]({'destination':function(_0x43bf46,_0x403e85,_0xc68a80){_0xc68a80(null,path['join'](config[_0x0f48('0xf')],_0x0f48('0x10')));},'filename':function(_0x357771,_0x108ef0,_0x5e8074){_0x108ef0[_0x0f48('0x11')]=_0x108ef0[_0x0f48('0x11')][_0x0f48('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e8074(null,util['format']('%s-%s%s',path[_0x0f48('0x13')](_0x108ef0[_0x0f48('0x11')],path[_0x0f48('0x14')](_0x108ef0['originalname'])),Date['now'](),path[_0x0f48('0x14')](_0x108ef0[_0x0f48('0x11')])));}})});router[_0x0f48('0x15')]('/',upload[_0x0f48('0x16')]('file'),controller[_0x0f48('0x17')]);router['put'](_0x0f48('0x18'),auth[_0x0f48('0x9')](),controller[_0x0f48('0x19')]);router[_0x0f48('0x1a')](_0x0f48('0x18'),auth[_0x0f48('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x6a88=['delete','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','post','single','create','put','update'];(function(_0x50ac7a,_0x184d00){var _0x506154=function(_0x55d5cc){while(--_0x55d5cc){_0x50ac7a['push'](_0x50ac7a['shift']());}};_0x506154(++_0x184d00);}(_0x6a88,0xe1));var _0x86a8=function(_0x54a687,_0x4ce189){_0x54a687=_0x54a687-0x0;var _0x4b5083=_0x6a88[_0x54a687];return _0x4b5083;};'use strict';var multer=require(_0x86a8('0x0'));var util=require(_0x86a8('0x1'));var path=require(_0x86a8('0x2'));var timeout=require(_0x86a8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x86a8('0x5'));var config=require('../../config/environment');var controller=require(_0x86a8('0x6'));router[_0x86a8('0x7')]('/',auth['isAuthenticated'](),controller[_0x86a8('0x8')]);router[_0x86a8('0x7')](_0x86a8('0x9'),auth[_0x86a8('0xa')](),controller[_0x86a8('0xb')]);router['get'](_0x86a8('0xc'),auth[_0x86a8('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x86a8('0xd')]({'destination':function(_0x420071,_0x1bad3c,_0x2c6439){_0x2c6439(null,path[_0x86a8('0xe')](config[_0x86a8('0xf')],_0x86a8('0x10')));},'filename':function(_0x26411b,_0x26dc76,_0x358b44){_0x26dc76['originalname']=_0x26dc76[_0x86a8('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x358b44(null,util[_0x86a8('0x12')](_0x86a8('0x13'),path[_0x86a8('0x14')](_0x26dc76[_0x86a8('0x11')],path['extname'](_0x26dc76['originalname'])),Date['now'](),path[_0x86a8('0x15')](_0x26dc76[_0x86a8('0x11')])));}})});router[_0x86a8('0x16')]('/',upload[_0x86a8('0x17')]('file'),controller[_0x86a8('0x18')]);router[_0x86a8('0x19')](_0x86a8('0x9'),auth[_0x86a8('0xa')](),controller[_0x86a8('0x1a')]);router[_0x86a8('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x86a8('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a5b3612..66b6d5a 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 _0x686e=['FLOAT','BIGINT','INTEGER','exports','STRING','name'];(function(_0x11505d,_0x3064df){var _0x2147ce=function(_0x1c33e9){while(--_0x1c33e9){_0x11505d['push'](_0x11505d['shift']());}};_0x2147ce(++_0x3064df);}(_0x686e,0x195));var _0xe686=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x686e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe686('0x0')]={'name':{'type':Sequelize[_0xe686('0x1')],'unique':_0xe686('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe686('0x1')]},'display_name':{'type':Sequelize[_0xe686('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xe686('0x1')]},'original_format':{'type':Sequelize[_0xe686('0x1')]},'original_duration':{'type':Sequelize[_0xe686('0x3')]},'original_sampleCount':{'type':Sequelize[_0xe686('0x4')]},'original_channelCount':{'type':Sequelize[_0xe686('0x5')]},'original_bitRate':{'type':Sequelize[_0xe686('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xe686('0x1')]},'converted_duration':{'type':Sequelize[_0xe686('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xe686('0x4')]},'converted_channelCount':{'type':Sequelize[_0xe686('0x5')]},'converted_bitRate':{'type':Sequelize[_0xe686('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xe686('0x5')]}}; \ No newline at end of file +var _0x367f=['name','FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x22789a,_0x4a1c8c){var _0xede88=function(_0x49243f){while(--_0x49243f){_0x22789a['push'](_0x22789a['shift']());}};_0xede88(++_0x4a1c8c);}(_0x367f,0xee));var _0xf367=function(_0xd32b5e,_0x3d7a78){_0xd32b5e=_0xd32b5e-0x0;var _0x417084=_0x367f[_0xd32b5e];return _0x417084;};'use strict';var Sequelize=require(_0xf367('0x0'));module['exports']={'name':{'type':Sequelize[_0xf367('0x1')],'unique':_0xf367('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf367('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf367('0x1')]},'original_format':{'type':Sequelize[_0xf367('0x1')]},'original_duration':{'type':Sequelize[_0xf367('0x3')]},'original_sampleCount':{'type':Sequelize[_0xf367('0x4')]},'original_channelCount':{'type':Sequelize[_0xf367('0x5')]},'original_bitRate':{'type':Sequelize[_0xf367('0x4')]},'original_sampleRate':{'type':Sequelize[_0xf367('0x5')]},'converted_format':{'type':Sequelize[_0xf367('0x1')]},'converted_duration':{'type':Sequelize[_0xf367('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xf367('0x4')]},'converted_channelCount':{'type':Sequelize[_0xf367('0x5')]},'converted_bitRate':{'type':Sequelize[_0xf367('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 44be5b2..64b7357 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 _0x7b83=['keys','query','intersection','model','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','length','find','catch','download','save_name','converted_format','join','root','server/files/sounds/converted','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','originalname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','pick','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','then','get','Sounds','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','Sound','fieldName','type','key'];(function(_0x1c7ba2,_0x116154){var _0x156cb5=function(_0x26593e){while(--_0x26593e){_0x1c7ba2['push'](_0x1c7ba2['shift']());}};_0x156cb5(++_0x116154);}(_0x7b83,0xcb));var _0x37b8=function(_0x49d80d,_0x2ebb62){_0x49d80d=_0x49d80d-0x0;var _0x4de96a=_0x7b83[_0x49d80d];return _0x4de96a;};'use strict';var emlformat=require(_0x37b8('0x0'));var rimraf=require(_0x37b8('0x1'));var zipdir=require(_0x37b8('0x2'));var jsonpatch=require(_0x37b8('0x3'));var rp=require(_0x37b8('0x4'));var moment=require(_0x37b8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x37b8('0x6'));var util=require('util');var path=require(_0x37b8('0x7'));var sox=require(_0x37b8('0x8'));var csv=require('to-csv');var ejs=require(_0x37b8('0x9'));var fs=require('fs');var fs_extra=require(_0x37b8('0xa'));var _=require(_0x37b8('0xb'));var squel=require('squel');var crypto=require(_0x37b8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x37b8('0xd'));var toCsv=require(_0x37b8('0xe'));var querystring=require(_0x37b8('0xf'));var Papa=require('papaparse');var Redis=require(_0x37b8('0x10'));var authService=require(_0x37b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x37b8('0x12'));var hardwareService=require(_0x37b8('0x13'));var logger=require(_0x37b8('0x14'))(_0x37b8('0x15'));var utils=require(_0x37b8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x37b8('0x17'));var db=require(_0x37b8('0x18'))['db'];function respondWithStatusCode(_0x758ee9,_0x2ffe42){_0x2ffe42=_0x2ffe42||0xcc;return function(_0x2ce192){if(_0x2ce192){return _0x758ee9['sendStatus'](_0x2ffe42);}return _0x758ee9[_0x37b8('0x19')](_0x2ffe42)[_0x37b8('0x1a')]();};}function respondWithResult(_0x3eb52e,_0x2a71f6){_0x2a71f6=_0x2a71f6||0xc8;return function(_0x1b7ced){if(_0x1b7ced){return _0x3eb52e[_0x37b8('0x19')](_0x2a71f6)[_0x37b8('0x1b')](_0x1b7ced);}};}function respondWithFilteredResult(_0x5ef0fc,_0x1975b8){return function(_0x23e2da){if(_0x23e2da){var _0x40d683=typeof _0x1975b8[_0x37b8('0x1c')]===_0x37b8('0x1d')&&typeof _0x1975b8['limit']==='undefined';var _0x232395=_0x23e2da[_0x37b8('0x1e')];var _0x2b5398=_0x40d683?0x0:_0x1975b8['offset'];var _0x1546f4=_0x40d683?_0x23e2da[_0x37b8('0x1e')]:_0x1975b8[_0x37b8('0x1c')]+_0x1975b8['limit'];var _0x15abef;if(_0x1546f4>=_0x232395){_0x1546f4=_0x232395;_0x15abef=0xc8;}else{_0x15abef=0xce;}_0x5ef0fc[_0x37b8('0x19')](_0x15abef);return _0x5ef0fc[_0x37b8('0x1f')](_0x37b8('0x20'),_0x2b5398+'-'+_0x1546f4+'/'+_0x232395)[_0x37b8('0x1b')](_0x23e2da);}return null;};}function patchUpdates(_0x53d017){return function(_0x5a9338){try{jsonpatch[_0x37b8('0x21')](_0x5a9338,_0x53d017,!![]);}catch(_0x54e5d7){return BPromise['reject'](_0x54e5d7);}return _0x5a9338['save']();};}function saveUpdates(_0x58891f,_0x3040a8){return function(_0x2a5605){if(_0x2a5605){return _0x2a5605['update'](_0x58891f)[_0x37b8('0x22')](function(_0x280726){return _0x280726;});}return null;};}function removeEntity(_0x1613ba,_0x312d54){return function(_0x4b265e){if(_0x4b265e){return _0x4b265e['destroy']()[_0x37b8('0x22')](function(){var _0x2045d3=_0x4b265e[_0x37b8('0x23')]({'plain':!![]});var _0x4736cf=_0x37b8('0x24');return db[_0x37b8('0x25')][_0x37b8('0x26')]({'where':{'type':_0x4736cf,'resourceId':_0x2045d3['id']}})[_0x37b8('0x22')](function(){return _0x4b265e;});})['then'](function(){_0x1613ba[_0x37b8('0x19')](0xcc)[_0x37b8('0x1a')]();});}};}function handleEntityNotFound(_0x154876,_0x1ad7da){return function(_0x2693cc){if(!_0x2693cc){_0x154876[_0x37b8('0x27')](0x194);}return _0x2693cc;};}function handleError(_0x2c20f8,_0x28895f){_0x28895f=_0x28895f||0x1f4;return function(_0x1839af){logger[_0x37b8('0x28')](_0x1839af[_0x37b8('0x29')]);if(_0x1839af[_0x37b8('0x2a')]){delete _0x1839af[_0x37b8('0x2a')];}_0x2c20f8[_0x37b8('0x19')](_0x28895f)['send'](_0x1839af);};}exports[_0x37b8('0x2b')]=function(_0x3ae08c,_0x509264){var _0x2c2ec0={},_0x108d75={},_0x5daf98={'count':0x0,'rows':[]};var _0x214fe0=_[_0x37b8('0x2c')](db[_0x37b8('0x2d')]['rawAttributes'],function(_0x475c4b){return{'name':_0x475c4b[_0x37b8('0x2e')],'type':_0x475c4b[_0x37b8('0x2f')][_0x37b8('0x30')]};});_0x108d75['model']=_[_0x37b8('0x2c')](_0x214fe0,_0x37b8('0x2a'));_0x108d75['query']=_[_0x37b8('0x31')](_0x3ae08c[_0x37b8('0x32')]);_0x108d75['filters']=_[_0x37b8('0x33')](_0x108d75[_0x37b8('0x34')],_0x108d75[_0x37b8('0x32')]);_0x2c2ec0['attributes']=_[_0x37b8('0x33')](_0x108d75[_0x37b8('0x34')],qs['fields'](_0x3ae08c[_0x37b8('0x32')]['fields']));_0x2c2ec0[_0x37b8('0x35')]=_0x2c2ec0[_0x37b8('0x35')]['length']?_0x2c2ec0[_0x37b8('0x35')]:_0x108d75[_0x37b8('0x34')];if(!_0x3ae08c['query'][_0x37b8('0x36')](_0x37b8('0x37'))){_0x2c2ec0[_0x37b8('0x38')]=qs[_0x37b8('0x38')](_0x3ae08c[_0x37b8('0x32')][_0x37b8('0x38')]);_0x2c2ec0[_0x37b8('0x1c')]=qs[_0x37b8('0x1c')](_0x3ae08c['query'][_0x37b8('0x1c')]);}_0x2c2ec0['order']=qs['sort'](_0x3ae08c[_0x37b8('0x32')][_0x37b8('0x39')]);_0x2c2ec0[_0x37b8('0x3a')]=qs['filters'](_['pick'](_0x3ae08c[_0x37b8('0x32')],_0x108d75[_0x37b8('0x3b')]),_0x214fe0);if(_0x3ae08c[_0x37b8('0x32')][_0x37b8('0x3c')]){_0x2c2ec0[_0x37b8('0x3a')]=_[_0x37b8('0x3d')](_0x2c2ec0[_0x37b8('0x3a')],{'$or':_[_0x37b8('0x2c')](_0x214fe0,function(_0x1c682c){if(_0x1c682c[_0x37b8('0x2f')]!=='VIRTUAL'){var _0x4211eb={};_0x4211eb[_0x1c682c[_0x37b8('0x2a')]]={'$like':'%'+_0x3ae08c[_0x37b8('0x32')]['filter']+'%'};return _0x4211eb;}})});}_0x2c2ec0=_['merge']({},_0x2c2ec0,_0x3ae08c[_0x37b8('0x3e')]);var _0x45a9e7={'where':_0x2c2ec0[_0x37b8('0x3a')]};return db[_0x37b8('0x2d')][_0x37b8('0x1e')](_0x45a9e7)['then'](function(_0x1d4419){_0x5daf98['count']=_0x1d4419;if(_0x3ae08c[_0x37b8('0x32')][_0x37b8('0x3f')]){_0x2c2ec0[_0x37b8('0x40')]=[{'all':!![]}];}return db[_0x37b8('0x2d')][_0x37b8('0x41')](_0x2c2ec0);})[_0x37b8('0x22')](function(_0x51c47d){_0x5daf98[_0x37b8('0x42')]=_0x51c47d;return _0x5daf98;})[_0x37b8('0x22')](respondWithFilteredResult(_0x509264,_0x2c2ec0))['catch'](handleError(_0x509264,null));};exports[_0x37b8('0x43')]=function(_0x44cbca,_0x4c8d07){var _0x545ee5={'raw':!![],'where':{'id':_0x44cbca[_0x37b8('0x44')]['id']}},_0x1ca3eb={};_0x1ca3eb[_0x37b8('0x34')]=_[_0x37b8('0x31')](db[_0x37b8('0x2d')][_0x37b8('0x45')]);_0x1ca3eb[_0x37b8('0x32')]=_[_0x37b8('0x31')](_0x44cbca[_0x37b8('0x32')]);_0x1ca3eb[_0x37b8('0x3b')]=_[_0x37b8('0x33')](_0x1ca3eb[_0x37b8('0x34')],_0x1ca3eb[_0x37b8('0x32')]);_0x545ee5[_0x37b8('0x35')]=_['intersection'](_0x1ca3eb[_0x37b8('0x34')],qs[_0x37b8('0x46')](_0x44cbca[_0x37b8('0x32')][_0x37b8('0x46')]));_0x545ee5[_0x37b8('0x35')]=_0x545ee5[_0x37b8('0x35')][_0x37b8('0x47')]?_0x545ee5[_0x37b8('0x35')]:_0x1ca3eb[_0x37b8('0x34')];if(_0x44cbca[_0x37b8('0x32')]['includeAll']){_0x545ee5[_0x37b8('0x40')]=[{'all':!![]}];}_0x545ee5=_[_0x37b8('0x3d')]({},_0x545ee5,_0x44cbca['options']);return db[_0x37b8('0x2d')][_0x37b8('0x48')](_0x545ee5)[_0x37b8('0x22')](handleEntityNotFound(_0x4c8d07,null))[_0x37b8('0x22')](respondWithResult(_0x4c8d07,null))[_0x37b8('0x49')](handleError(_0x4c8d07,null));};exports[_0x37b8('0x4a')]=function(_0x43cfc0,_0x3ba441,_0x95085e){return db['Sound']['find']({'where':{'id':_0x43cfc0[_0x37b8('0x44')]['id']},'attributes':[_0x37b8('0x2a'),_0x37b8('0x4b'),_0x37b8('0x4c')],'raw':!![]})[_0x37b8('0x22')](handleEntityNotFound(_0x3ba441,null))[_0x37b8('0x22')](function(_0x374286){if(_0x374286){if(!fs['existsSync'](path[_0x37b8('0x4d')](config[_0x37b8('0x4e')],_0x37b8('0x4f'),_0x374286['save_name']+'.'+_0x374286['converted_format']))){throw new db['Sequelize']['ValidationError'](_0x37b8('0x50'));}return _0x3ba441[_0x37b8('0x4a')](path[_0x37b8('0x4d')](config[_0x37b8('0x4e')],_0x37b8('0x4f'),util['format']('%s.%s',_0x374286['save_name'],_0x374286[_0x37b8('0x4c')])),util[_0x37b8('0x51')](_0x37b8('0x52'),_0x374286[_0x37b8('0x2a')],_0x374286[_0x37b8('0x4c')]));}return null;})[_0x37b8('0x49')](handleError(_0x3ba441,null));};exports[_0x37b8('0x53')]=function(_0x560108,_0xde1b7d,_0x284782){var _0x5edd23={'name':path[_0x37b8('0x54')](_0x560108[_0x37b8('0x55')]['originalname'],path[_0x37b8('0x56')](_0x560108[_0x37b8('0x55')][_0x37b8('0x57')])),'save_name':path['basename'](_0x560108[_0x37b8('0x55')][_0x37b8('0x58')],path[_0x37b8('0x56')](_0x560108[_0x37b8('0x55')][_0x37b8('0x58')])),'original_format':path['extname'](_0x560108['file'][_0x37b8('0x57')])[_0x37b8('0x59')](0x1),'converted_format':'wav'};var _0x10ddcb=path[_0x37b8('0x4d')](config['root'],_0x37b8('0x5a'),_0x560108[_0x37b8('0x55')]['filename']);var _0x167134=path['join'](config[_0x37b8('0x4e')],_0x37b8('0x4f'),util['format'](_0x37b8('0x52'),path['basename'](_0x560108['file']['filename'],path[_0x37b8('0x56')](_0x560108['file'][_0x37b8('0x58')])),_0x5edd23[_0x37b8('0x4c')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x10ddcb);logger[_0x37b8('0x5b')](_0x37b8('0x5c'),_0x167134);try{fs[_0x37b8('0x5d')](_0x10ddcb,parseInt(_0x37b8('0x5e'),0x8));var _0x47b7a6=sox[_0x37b8('0x5f')](_0x10ddcb,_0x167134,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x47b7a6['on']('error',function(_0x1e8baa){fs[_0x37b8('0x60')](_0x10ddcb);_0xde1b7d[_0x37b8('0x19')](0x1f4)[_0x37b8('0x61')](_0x1e8baa);});_0x47b7a6['on'](_0x37b8('0x62'),function(_0x286bff){_0x5edd23[_0x37b8('0x63')]=isNaN(_0x286bff[_0x37b8('0x64')])?null:_0x286bff[_0x37b8('0x64')]*0x3e8;_0x5edd23[_0x37b8('0x65')]=isNaN(_0x286bff[_0x37b8('0x66')])?null:_0x286bff[_0x37b8('0x66')];_0x5edd23[_0x37b8('0x67')]=isNaN(_0x286bff[_0x37b8('0x68')])?null:_0x286bff[_0x37b8('0x68')];_0x5edd23[_0x37b8('0x69')]=isNaN(_0x286bff[_0x37b8('0x6a')])?null:_0x286bff['bitRate'];_0x5edd23[_0x37b8('0x6b')]=isNaN(_0x286bff[_0x37b8('0x6c')])?null:_0x286bff[_0x37b8('0x6c')];});_0x47b7a6['on'](_0x37b8('0x6d'),function(_0x449fc8){_0x5edd23[_0x37b8('0x6e')]=isNaN(_0x449fc8[_0x37b8('0x64')])?null:_0x449fc8[_0x37b8('0x64')]*0x3e8;_0x5edd23[_0x37b8('0x6f')]=isNaN(_0x449fc8[_0x37b8('0x66')])?null:_0x449fc8['sampleCount'];_0x5edd23[_0x37b8('0x70')]=isNaN(_0x449fc8[_0x37b8('0x68')])?null:_0x449fc8['channelCount'];_0x5edd23[_0x37b8('0x71')]=isNaN(_0x449fc8['bitRate'])?null:_0x449fc8[_0x37b8('0x6a')];_0x5edd23[_0x37b8('0x72')]=isNaN(_0x449fc8[_0x37b8('0x6c')])?null:_0x449fc8[_0x37b8('0x6c')];});_0x47b7a6['on'](_0x37b8('0x1a'),function(){fs[_0x37b8('0x5d')](_0x167134,parseInt(_0x37b8('0x5e'),0x8));return db[_0x37b8('0x2d')]['create'](_0x5edd23)[_0x37b8('0x22')](function(_0x3a2bcf){var _0xb1032a={'role':_0x560108[_0x37b8('0x73')]['role'],'userProfileId':_0x560108[_0x37b8('0x73')]['userProfileId']};if(!_0xb1032a)throw new Error(_0x37b8('0x74'));if(_0xb1032a[_0x37b8('0x75')]===_0x37b8('0x76')){var _0xc70397=_0x3a2bcf['get']({'plain':!![]});return db[_0x37b8('0x77')]['find']({'where':{'name':'Sounds','userProfileId':_0xb1032a[_0x37b8('0x78')]},'raw':!![]})[_0x37b8('0x22')](function(_0x1be081){if(_0x1be081&&_0x1be081[_0x37b8('0x79')]===0x0){return db[_0x37b8('0x25')][_0x37b8('0x53')]({'name':_0xc70397[_0x37b8('0x2a')],'resourceId':_0xc70397['id'],'type':_0x1be081['name'],'sectionId':_0x1be081['id']},{})[_0x37b8('0x22')](function(){return _0x3a2bcf;});}else{return _0x3a2bcf;}})['catch'](function(_0x3a8b0c){logger[_0x37b8('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a8b0c);throw _0x3a8b0c;});}return _0x3a2bcf;})[_0x37b8('0x22')](respondWithResult(_0xde1b7d,null))[_0x37b8('0x49')](handleError(_0xde1b7d,null));});_0x47b7a6['start']();}catch(_0x4d8f91){_0xde1b7d[_0x37b8('0x19')](0x1f4)[_0x37b8('0x61')](_0x4d8f91);}};exports[_0x37b8('0x7a')]=function(_0x185fd9,_0x56859e,_0x12b5b1){return db[_0x37b8('0x2d')][_0x37b8('0x48')]({'where':{'id':_0x185fd9['params']['id']}})[_0x37b8('0x22')](handleEntityNotFound(_0x56859e,null))[_0x37b8('0x22')](saveUpdates(_[_0x37b8('0x7b')](_0x185fd9[_0x37b8('0x73')],['name','description']),null))[_0x37b8('0x22')](respondWithResult(_0x56859e,null))['catch'](handleError(_0x56859e,null));};exports[_0x37b8('0x7c')]=function(_0x40e85c,_0x4e9657,_0x306804){return db[_0x37b8('0x2d')][_0x37b8('0x48')]({'where':{'id':_0x40e85c['params']['id']}})[_0x37b8('0x22')](function(_0x14ffeb){if(_0x14ffeb){return _0x14ffeb['destroy']();}})[_0x37b8('0x22')](function(_0x1d32cd){var _0x4f9832=path['join'](config[_0x37b8('0x4e')],'server/files/sounds/original',util[_0x37b8('0x51')](_0x37b8('0x52'),_0x1d32cd[_0x37b8('0x4b')],_0x1d32cd[_0x37b8('0x7d')]));var _0x4bc61b=path[_0x37b8('0x4d')](config[_0x37b8('0x4e')],'server/files/sounds/converted',util['format'](_0x37b8('0x52'),_0x1d32cd[_0x37b8('0x4b')],_0x1d32cd['converted_format']));fs[_0x37b8('0x60')](_0x4f9832);fs[_0x37b8('0x60')](_0x4bc61b);return _0x1d32cd;})[_0x37b8('0x22')](function(_0x16e769){if(_0x16e769){return _0x4e9657[_0x37b8('0x19')](0xcc)[_0x37b8('0x1a')]();}})[_0x37b8('0x22')](handleEntityNotFound(_0x4e9657,null))[_0x37b8('0x49')](handleError(_0x4e9657,null));}; \ No newline at end of file +var _0x6178=['util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','save_name','converted_format','existsSync','Sound\x20not\x20found','download','root','server/files/sounds/converted','%s.%s','format','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','join','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','end','chmodSync','create','body','userProfileId','role','user','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x183912,_0x3ed50a){var _0x1a6376=function(_0x1fd167){while(--_0x1fd167){_0x183912['push'](_0x183912['shift']());}};_0x1a6376(++_0x3ed50a);}(_0x6178,0xed));var _0x8617=function(_0x35f7d1,_0x39d318){_0x35f7d1=_0x35f7d1-0x0;var _0x53ac5f=_0x6178[_0x35f7d1];return _0x53ac5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8617('0x0'));var zipdir=require(_0x8617('0x1'));var jsonpatch=require(_0x8617('0x2'));var rp=require(_0x8617('0x3'));var moment=require(_0x8617('0x4'));var BPromise=require(_0x8617('0x5'));var Mustache=require(_0x8617('0x6'));var util=require(_0x8617('0x7'));var path=require(_0x8617('0x8'));var sox=require(_0x8617('0x9'));var csv=require(_0x8617('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8617('0xb'));var squel=require('squel');var crypto=require(_0x8617('0xc'));var jsforce=require(_0x8617('0xd'));var deskjs=require(_0x8617('0xe'));var toCsv=require(_0x8617('0xa'));var querystring=require(_0x8617('0xf'));var Papa=require('papaparse');var Redis=require(_0x8617('0x10'));var authService=require(_0x8617('0x11'));var qs=require(_0x8617('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8617('0x13'));var logger=require(_0x8617('0x14'))('api');var utils=require(_0x8617('0x15'));var config=require(_0x8617('0x16'));var licenseUtil=require(_0x8617('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34438c,_0x36beac){_0x36beac=_0x36beac||0xcc;return function(_0x1507a2){if(_0x1507a2){return _0x34438c[_0x8617('0x18')](_0x36beac);}return _0x34438c['status'](_0x36beac)['end']();};}function respondWithResult(_0x1059bc,_0x593090){_0x593090=_0x593090||0xc8;return function(_0x39c67f){if(_0x39c67f){return _0x1059bc[_0x8617('0x19')](_0x593090)[_0x8617('0x1a')](_0x39c67f);}};}function respondWithFilteredResult(_0x2f4c53,_0x48dc57){return function(_0x11482b){if(_0x11482b){var _0x55a4c1=typeof _0x48dc57[_0x8617('0x1b')]==='undefined'&&typeof _0x48dc57[_0x8617('0x1c')]===_0x8617('0x1d');var _0x517c8f=_0x11482b[_0x8617('0x1e')];var _0xde380a=_0x55a4c1?0x0:_0x48dc57['offset'];var _0x146679=_0x55a4c1?_0x11482b[_0x8617('0x1e')]:_0x48dc57['offset']+_0x48dc57[_0x8617('0x1c')];var _0x41094d;if(_0x146679>=_0x517c8f){_0x146679=_0x517c8f;_0x41094d=0xc8;}else{_0x41094d=0xce;}_0x2f4c53['status'](_0x41094d);return _0x2f4c53[_0x8617('0x1f')](_0x8617('0x20'),_0xde380a+'-'+_0x146679+'/'+_0x517c8f)[_0x8617('0x1a')](_0x11482b);}return null;};}function patchUpdates(_0x3a976d){return function(_0x4df454){try{jsonpatch['apply'](_0x4df454,_0x3a976d,!![]);}catch(_0x357d88){return BPromise[_0x8617('0x21')](_0x357d88);}return _0x4df454[_0x8617('0x22')]();};}function saveUpdates(_0x10230e,_0x5d5943){return function(_0x4eb711){if(_0x4eb711){return _0x4eb711[_0x8617('0x23')](_0x10230e)[_0x8617('0x24')](function(_0x4b1b1e){return _0x4b1b1e;});}return null;};}function removeEntity(_0x2e1315,_0x3da23a){return function(_0x46f1e6){if(_0x46f1e6){return _0x46f1e6[_0x8617('0x25')]()['then'](function(){var _0x3e2868=_0x46f1e6[_0x8617('0x26')]({'plain':!![]});var _0x2e5d8d='Sounds';return db[_0x8617('0x27')][_0x8617('0x25')]({'where':{'type':_0x2e5d8d,'resourceId':_0x3e2868['id']}})[_0x8617('0x24')](function(){return _0x46f1e6;});})['then'](function(){_0x2e1315[_0x8617('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1262df,_0xd4adde){return function(_0x5d100c){if(!_0x5d100c){_0x1262df[_0x8617('0x18')](0x194);}return _0x5d100c;};}function handleError(_0x2c7371,_0x2168bc){_0x2168bc=_0x2168bc||0x1f4;return function(_0xd2520d){logger[_0x8617('0x28')](_0xd2520d[_0x8617('0x29')]);if(_0xd2520d[_0x8617('0x2a')]){delete _0xd2520d[_0x8617('0x2a')];}_0x2c7371['status'](_0x2168bc)[_0x8617('0x2b')](_0xd2520d);};}exports[_0x8617('0x2c')]=function(_0x3d83c7,_0x3596ad){var _0x3bd1be={},_0x345cc5={},_0x330892={'count':0x0,'rows':[]};var _0x2dd635=_[_0x8617('0x2d')](db[_0x8617('0x2e')][_0x8617('0x2f')],function(_0x58abf0){return{'name':_0x58abf0['fieldName'],'type':_0x58abf0[_0x8617('0x30')][_0x8617('0x31')]};});_0x345cc5[_0x8617('0x32')]=_[_0x8617('0x2d')](_0x2dd635,'name');_0x345cc5[_0x8617('0x33')]=_[_0x8617('0x34')](_0x3d83c7[_0x8617('0x33')]);_0x345cc5[_0x8617('0x35')]=_['intersection'](_0x345cc5[_0x8617('0x32')],_0x345cc5[_0x8617('0x33')]);_0x3bd1be['attributes']=_[_0x8617('0x36')](_0x345cc5[_0x8617('0x32')],qs['fields'](_0x3d83c7[_0x8617('0x33')]['fields']));_0x3bd1be[_0x8617('0x37')]=_0x3bd1be['attributes'][_0x8617('0x38')]?_0x3bd1be[_0x8617('0x37')]:_0x345cc5['model'];if(!_0x3d83c7[_0x8617('0x33')][_0x8617('0x39')]('nolimit')){_0x3bd1be[_0x8617('0x1c')]=qs['limit'](_0x3d83c7[_0x8617('0x33')][_0x8617('0x1c')]);_0x3bd1be[_0x8617('0x1b')]=qs[_0x8617('0x1b')](_0x3d83c7[_0x8617('0x33')][_0x8617('0x1b')]);}_0x3bd1be['order']=qs[_0x8617('0x3a')](_0x3d83c7[_0x8617('0x33')]['sort']);_0x3bd1be[_0x8617('0x3b')]=qs[_0x8617('0x35')](_['pick'](_0x3d83c7[_0x8617('0x33')],_0x345cc5['filters']),_0x2dd635);if(_0x3d83c7[_0x8617('0x33')][_0x8617('0x3c')]){_0x3bd1be['where']=_[_0x8617('0x3d')](_0x3bd1be[_0x8617('0x3b')],{'$or':_[_0x8617('0x2d')](_0x2dd635,function(_0x491f94){if(_0x491f94['type']!==_0x8617('0x3e')){var _0x2fb6f1={};_0x2fb6f1[_0x491f94['name']]={'$like':'%'+_0x3d83c7[_0x8617('0x33')]['filter']+'%'};return _0x2fb6f1;}})});}_0x3bd1be=_['merge']({},_0x3bd1be,_0x3d83c7[_0x8617('0x3f')]);var _0xabe723={'where':_0x3bd1be['where']};return db[_0x8617('0x2e')]['count'](_0xabe723)['then'](function(_0x3f57a2){_0x330892[_0x8617('0x1e')]=_0x3f57a2;if(_0x3d83c7[_0x8617('0x33')][_0x8617('0x40')]){_0x3bd1be[_0x8617('0x41')]=[{'all':!![]}];}return db[_0x8617('0x2e')][_0x8617('0x42')](_0x3bd1be);})[_0x8617('0x24')](function(_0x48c1b4){_0x330892[_0x8617('0x43')]=_0x48c1b4;return _0x330892;})[_0x8617('0x24')](respondWithFilteredResult(_0x3596ad,_0x3bd1be))[_0x8617('0x44')](handleError(_0x3596ad,null));};exports[_0x8617('0x45')]=function(_0x3884f1,_0x3ce671){var _0xcce458={'raw':!![],'where':{'id':_0x3884f1[_0x8617('0x46')]['id']}},_0x1d048d={};_0x1d048d[_0x8617('0x32')]=_[_0x8617('0x34')](db[_0x8617('0x2e')][_0x8617('0x2f')]);_0x1d048d[_0x8617('0x33')]=_[_0x8617('0x34')](_0x3884f1[_0x8617('0x33')]);_0x1d048d[_0x8617('0x35')]=_[_0x8617('0x36')](_0x1d048d[_0x8617('0x32')],_0x1d048d['query']);_0xcce458[_0x8617('0x37')]=_['intersection'](_0x1d048d[_0x8617('0x32')],qs[_0x8617('0x47')](_0x3884f1['query'][_0x8617('0x47')]));_0xcce458[_0x8617('0x37')]=_0xcce458['attributes'][_0x8617('0x38')]?_0xcce458[_0x8617('0x37')]:_0x1d048d[_0x8617('0x32')];if(_0x3884f1[_0x8617('0x33')]['includeAll']){_0xcce458[_0x8617('0x41')]=[{'all':!![]}];}_0xcce458=_[_0x8617('0x3d')]({},_0xcce458,_0x3884f1[_0x8617('0x3f')]);return db[_0x8617('0x2e')][_0x8617('0x48')](_0xcce458)['then'](handleEntityNotFound(_0x3ce671,null))['then'](respondWithResult(_0x3ce671,null))[_0x8617('0x44')](handleError(_0x3ce671,null));};exports['download']=function(_0x129b96,_0x48f0d7,_0x39b47b){return db[_0x8617('0x2e')][_0x8617('0x48')]({'where':{'id':_0x129b96[_0x8617('0x46')]['id']},'attributes':['name',_0x8617('0x49'),_0x8617('0x4a')],'raw':!![]})[_0x8617('0x24')](handleEntityNotFound(_0x48f0d7,null))['then'](function(_0x6d05aa){if(_0x6d05aa){if(!fs[_0x8617('0x4b')](path['join'](config['root'],'server/files/sounds/converted',_0x6d05aa['save_name']+'.'+_0x6d05aa[_0x8617('0x4a')]))){throw new db['Sequelize']['ValidationError'](_0x8617('0x4c'));}return _0x48f0d7[_0x8617('0x4d')](path['join'](config[_0x8617('0x4e')],_0x8617('0x4f'),util['format'](_0x8617('0x50'),_0x6d05aa[_0x8617('0x49')],_0x6d05aa[_0x8617('0x4a')])),util[_0x8617('0x51')](_0x8617('0x50'),_0x6d05aa[_0x8617('0x2a')],_0x6d05aa[_0x8617('0x4a')]));}return null;})[_0x8617('0x44')](handleError(_0x48f0d7,null));};exports['create']=function(_0x49507f,_0x1fcb03,_0xee4b75){var _0x1f44e4={'name':path[_0x8617('0x52')](_0x49507f[_0x8617('0x53')][_0x8617('0x54')],path[_0x8617('0x55')](_0x49507f[_0x8617('0x53')][_0x8617('0x54')])),'save_name':path[_0x8617('0x52')](_0x49507f[_0x8617('0x53')][_0x8617('0x56')],path[_0x8617('0x55')](_0x49507f[_0x8617('0x53')][_0x8617('0x56')])),'original_format':path[_0x8617('0x55')](_0x49507f[_0x8617('0x53')][_0x8617('0x54')])[_0x8617('0x57')](0x1),'converted_format':_0x8617('0x58')};var _0x543052=path['join'](config[_0x8617('0x4e')],_0x8617('0x59'),_0x49507f[_0x8617('0x53')][_0x8617('0x56')]);var _0x303342=path[_0x8617('0x5a')](config[_0x8617('0x4e')],_0x8617('0x4f'),util[_0x8617('0x51')](_0x8617('0x50'),path[_0x8617('0x52')](_0x49507f[_0x8617('0x53')][_0x8617('0x56')],path[_0x8617('0x55')](_0x49507f[_0x8617('0x53')][_0x8617('0x56')])),_0x1f44e4['converted_format']));logger[_0x8617('0x5b')](_0x8617('0x5c'),_0x543052);logger[_0x8617('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0x303342);try{fs['chmodSync'](_0x543052,parseInt(_0x8617('0x5d'),0x8));var _0x1bb09d=sox[_0x8617('0x5e')](_0x543052,_0x303342,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1bb09d['on'](_0x8617('0x28'),function(_0x19e452){fs[_0x8617('0x5f')](_0x543052);_0x1fcb03[_0x8617('0x19')](0x1f4)[_0x8617('0x2b')](_0x19e452);});_0x1bb09d['on'](_0x8617('0x60'),function(_0xab0877){_0x1f44e4[_0x8617('0x61')]=isNaN(_0xab0877[_0x8617('0x62')])?null:_0xab0877[_0x8617('0x62')]*0x3e8;_0x1f44e4[_0x8617('0x63')]=isNaN(_0xab0877['sampleCount'])?null:_0xab0877[_0x8617('0x64')];_0x1f44e4[_0x8617('0x65')]=isNaN(_0xab0877['channelCount'])?null:_0xab0877[_0x8617('0x66')];_0x1f44e4['original_bitRate']=isNaN(_0xab0877[_0x8617('0x67')])?null:_0xab0877[_0x8617('0x67')];_0x1f44e4['original_sampleRate']=isNaN(_0xab0877[_0x8617('0x68')])?null:_0xab0877[_0x8617('0x68')];});_0x1bb09d['on'](_0x8617('0x69'),function(_0x52afb5){_0x1f44e4[_0x8617('0x6a')]=isNaN(_0x52afb5[_0x8617('0x62')])?null:_0x52afb5[_0x8617('0x62')]*0x3e8;_0x1f44e4[_0x8617('0x6b')]=isNaN(_0x52afb5['sampleCount'])?null:_0x52afb5['sampleCount'];_0x1f44e4[_0x8617('0x6c')]=isNaN(_0x52afb5['channelCount'])?null:_0x52afb5['channelCount'];_0x1f44e4[_0x8617('0x6d')]=isNaN(_0x52afb5[_0x8617('0x67')])?null:_0x52afb5[_0x8617('0x67')];_0x1f44e4[_0x8617('0x6e')]=isNaN(_0x52afb5[_0x8617('0x68')])?null:_0x52afb5[_0x8617('0x68')];});_0x1bb09d['on'](_0x8617('0x6f'),function(){fs[_0x8617('0x70')](_0x303342,parseInt(_0x8617('0x5d'),0x8));return db['Sound'][_0x8617('0x71')](_0x1f44e4)[_0x8617('0x24')](function(_0x5c42c3){var _0x15626c={'role':_0x49507f[_0x8617('0x72')]['role'],'userProfileId':_0x49507f[_0x8617('0x72')][_0x8617('0x73')]};if(!_0x15626c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15626c[_0x8617('0x74')]===_0x8617('0x75')){var _0x341ef0=_0x5c42c3[_0x8617('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x8617('0x48')]({'where':{'name':_0x8617('0x76'),'userProfileId':_0x15626c[_0x8617('0x73')]},'raw':!![]})[_0x8617('0x24')](function(_0x45dc0d){if(_0x45dc0d&&_0x45dc0d['autoAssociation']===0x0){return db[_0x8617('0x27')]['create']({'name':_0x341ef0[_0x8617('0x2a')],'resourceId':_0x341ef0['id'],'type':_0x45dc0d['name'],'sectionId':_0x45dc0d['id']},{})[_0x8617('0x24')](function(){return _0x5c42c3;});}else{return _0x5c42c3;}})[_0x8617('0x44')](function(_0x1232cc){logger[_0x8617('0x28')](_0x8617('0x77'),_0x1232cc);throw _0x1232cc;});}return _0x5c42c3;})[_0x8617('0x24')](respondWithResult(_0x1fcb03,null))[_0x8617('0x44')](handleError(_0x1fcb03,null));});_0x1bb09d['start']();}catch(_0x1e4c29){_0x1fcb03[_0x8617('0x19')](0x1f4)['send'](_0x1e4c29);}};exports['update']=function(_0x17eb9a,_0x364c22,_0x507fc2){return db[_0x8617('0x2e')]['find']({'where':{'id':_0x17eb9a[_0x8617('0x46')]['id']}})['then'](handleEntityNotFound(_0x364c22,null))['then'](saveUpdates(_['pick'](_0x17eb9a['body'],['name','description']),null))[_0x8617('0x24')](respondWithResult(_0x364c22,null))['catch'](handleError(_0x364c22,null));};exports[_0x8617('0x78')]=function(_0x5825f2,_0x3607c8,_0x2ff23e){return db['Sound']['find']({'where':{'id':_0x5825f2['params']['id']}})[_0x8617('0x24')](function(_0x2a17db){if(_0x2a17db){return _0x2a17db['destroy']();}})['then'](function(_0x4448f4){var _0x216b1f=path['join'](config['root'],_0x8617('0x59'),util['format'](_0x8617('0x50'),_0x4448f4[_0x8617('0x49')],_0x4448f4[_0x8617('0x79')]));var _0x24ccc9=path['join'](config[_0x8617('0x4e')],'server/files/sounds/converted',util[_0x8617('0x51')](_0x8617('0x50'),_0x4448f4[_0x8617('0x49')],_0x4448f4[_0x8617('0x4a')]));fs['unlinkSync'](_0x216b1f);fs['unlinkSync'](_0x24ccc9);return _0x4448f4;})[_0x8617('0x24')](function(_0x501ab7){if(_0x501ab7){return _0x3607c8[_0x8617('0x19')](0xcc)['end']();}})[_0x8617('0x24')](handleEntityNotFound(_0x3607c8,null))[_0x8617('0x44')](handleError(_0x3607c8,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7b03878..788a23d 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 _0xfca4=['Sound','tools_sounds','lodash','api','request-promise','path','../../config/environment','exports','define'];(function(_0x1f6691,_0x3a3d46){var _0xf786b6=function(_0x2afbdb){while(--_0x2afbdb){_0x1f6691['push'](_0x1f6691['shift']());}};_0xf786b6(++_0x3a3d46);}(_0xfca4,0x1a0));var _0x4fca=function(_0x5c4d92,_0x1cca09){_0x5c4d92=_0x5c4d92-0x0;var _0x454a6a=_0xfca4[_0x5c4d92];return _0x454a6a;};'use strict';var _=require(_0x4fca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4fca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4fca('0x2'));var fs=require('fs');var path=require(_0x4fca('0x3'));var rimraf=require('rimraf');var config=require(_0x4fca('0x4'));var attributes=require('./sound.attributes');module[_0x4fca('0x5')]=function(_0x44163f,_0x3753ca){return _0x44163f[_0x4fca('0x6')](_0x4fca('0x7'),attributes,{'tableName':_0x4fca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5700=['../../config/environment','exports','define','tools_sounds','lodash','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x5700,0x9d));var _0x0570=function(_0x3e30aa,_0x1be53b){_0x3e30aa=_0x3e30aa-0x0;var _0x212ec8=_0x5700[_0x3e30aa];return _0x212ec8;};'use strict';var _=require(_0x0570('0x0'));var util=require('util');var logger=require(_0x0570('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0570('0x2'));var rp=require(_0x0570('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0570('0x4'));var config=require(_0x0570('0x5'));var attributes=require('./sound.attributes');module[_0x0570('0x6')]=function(_0x6671d,_0x15e292){return _0x6671d[_0x0570('0x7')]('Sound',attributes,{'tableName':_0x0570('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 3d338a5..c32293d 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 _0x82c4=['options','raw','where','attributes','map','include','model','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0x82c4,0x17b));var _0x482c=function(_0x30aebd,_0x4d2300){_0x30aebd=_0x30aebd-0x0;var _0xf1f2bc=_0x82c4[_0x30aebd];return _0xf1f2bc;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require('moment');var BPromise=require(_0x482c('0x2'));var rs=require(_0x482c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x482c('0x4'));var logger=require(_0x482c('0x5'))(_0x482c('0x6'));var config=require('../../config/environment');var jayson=require(_0x482c('0x7'));var client=jayson[_0x482c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0595,_0x44c850,_0x3d8c6c){return new BPromise(function(_0x5c60ec,_0x4570b9){return client['request'](_0x2f0595,_0x3d8c6c)[_0x482c('0x9')](function(_0x1e3829){logger[_0x482c('0xa')](_0x482c('0xb'),_0x44c850,_0x482c('0xc'));logger[_0x482c('0xd')](_0x482c('0xe'),_0x44c850,_0x482c('0xc'),JSON[_0x482c('0xf')](_0x1e3829));if(_0x1e3829[_0x482c('0x10')]){if(_0x1e3829[_0x482c('0x10')][_0x482c('0x11')]===0x1f4){logger['error'](_0x482c('0xb'),_0x44c850,_0x1e3829[_0x482c('0x10')][_0x482c('0x12')]);return _0x4570b9(_0x1e3829['error'][_0x482c('0x12')]);}logger[_0x482c('0x10')](_0x482c('0xb'),_0x44c850,_0x1e3829[_0x482c('0x10')]['message']);return _0x5c60ec(_0x1e3829['error']['message']);}else{logger[_0x482c('0xa')](_0x482c('0xb'),_0x44c850,_0x482c('0xc'));_0x5c60ec(_0x1e3829[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x55110){logger[_0x482c('0x10')](_0x482c('0xb'),_0x44c850,_0x55110);_0x4570b9(_0x55110);});});}exports[_0x482c('0x15')]=function(_0xe7bd4d){var _0x25c531=this;return new Promise(function(_0xc659fa,_0xb2a306){return db[_0x482c('0x16')][_0x482c('0x17')]({'raw':_0xe7bd4d[_0x482c('0x18')]?_0xe7bd4d[_0x482c('0x18')][_0x482c('0x19')]===undefined?!![]:![]:!![],'where':_0xe7bd4d['options']?_0xe7bd4d[_0x482c('0x18')][_0x482c('0x1a')]||null:null,'attributes':_0xe7bd4d[_0x482c('0x18')]?_0xe7bd4d[_0x482c('0x18')][_0x482c('0x1b')]||null:null,'include':_0xe7bd4d[_0x482c('0x18')]?_0xe7bd4d[_0x482c('0x18')]['include']?_[_0x482c('0x1c')](_0xe7bd4d['options'][_0x482c('0x1d')],function(_0x5634e5){return{'model':db[_0x5634e5[_0x482c('0x1e')]],'as':_0x5634e5['as'],'attributes':_0x5634e5[_0x482c('0x1b')],'include':_0x5634e5['include']?_[_0x482c('0x1c')](_0x5634e5[_0x482c('0x1d')],function(_0x8c590a){return{'model':db[_0x8c590a[_0x482c('0x1e')]],'as':_0x8c590a['as'],'attributes':_0x8c590a[_0x482c('0x1b')],'include':_0x8c590a[_0x482c('0x1d')]?_[_0x482c('0x1c')](_0x8c590a['include'],function(_0xf16ee8){return{'model':db[_0xf16ee8['model']],'as':_0xf16ee8['as'],'attributes':_0xf16ee8['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0x9')](function(_0xd68822){logger[_0x482c('0xa')]('ShowSound',_0xe7bd4d);logger['debug']('ShowSound',_0xe7bd4d,JSON['stringify'](_0xd68822));_0xc659fa(_0xd68822);})['catch'](function(_0x36fe02){logger['error'](_0x482c('0x15'),_0x36fe02[_0x482c('0x12')],_0xe7bd4d);_0xb2a306(_0x25c531[_0x482c('0x10')](0x1f4,_0x36fe02[_0x482c('0x12')]));});});}; \ No newline at end of file +var _0x04b6=['then','request\x20sent','error','Sound,\x20%s,\x20%s','message','info','result','catch','ShowSound','Sound','options','attributes','include','map','model','debug','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x1250c9,_0x4034c2){var _0x6fbaa=function(_0x368ea0){while(--_0x368ea0){_0x1250c9['push'](_0x1250c9['shift']());}};_0x6fbaa(++_0x4034c2);}(_0x04b6,0x162));var _0x604b=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x04b6[_0x1f99a0];return _0x1e0849;};'use strict';var _=require('lodash');var util=require(_0x604b('0x0'));var moment=require(_0x604b('0x1'));var BPromise=require('bluebird');var rs=require(_0x604b('0x2'));var fs=require('fs');var Redis=require(_0x604b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x604b('0x4'));var logger=require(_0x604b('0x5'))(_0x604b('0x6'));var config=require(_0x604b('0x7'));var jayson=require(_0x604b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16aae2,_0x457437,_0x67eb6e){return new BPromise(function(_0x340c2c,_0x315365){return client[_0x604b('0x9')](_0x16aae2,_0x67eb6e)[_0x604b('0xa')](function(_0x3121d0){logger['info']('Sound,\x20%s,\x20%s',_0x457437,_0x604b('0xb'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x457437,_0x604b('0xb'),JSON['stringify'](_0x3121d0));if(_0x3121d0[_0x604b('0xc')]){if(_0x3121d0[_0x604b('0xc')]['code']===0x1f4){logger[_0x604b('0xc')](_0x604b('0xd'),_0x457437,_0x3121d0['error'][_0x604b('0xe')]);return _0x315365(_0x3121d0[_0x604b('0xc')]['message']);}logger[_0x604b('0xc')]('Sound,\x20%s,\x20%s',_0x457437,_0x3121d0['error'][_0x604b('0xe')]);return _0x340c2c(_0x3121d0[_0x604b('0xc')]['message']);}else{logger[_0x604b('0xf')](_0x604b('0xd'),_0x457437,_0x604b('0xb'));_0x340c2c(_0x3121d0[_0x604b('0x10')][_0x604b('0xe')]);}})[_0x604b('0x11')](function(_0xb615de){logger['error'](_0x604b('0xd'),_0x457437,_0xb615de);_0x315365(_0xb615de);});});}exports[_0x604b('0x12')]=function(_0x2d1651){var _0x16b67f=this;return new Promise(function(_0x185e68,_0x164df2){return db[_0x604b('0x13')]['find']({'raw':_0x2d1651['options']?_0x2d1651['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d1651['options']?_0x2d1651[_0x604b('0x14')]['where']||null:null,'attributes':_0x2d1651[_0x604b('0x14')]?_0x2d1651[_0x604b('0x14')][_0x604b('0x15')]||null:null,'include':_0x2d1651[_0x604b('0x14')]?_0x2d1651[_0x604b('0x14')][_0x604b('0x16')]?_[_0x604b('0x17')](_0x2d1651[_0x604b('0x14')]['include'],function(_0x488257){return{'model':db[_0x488257[_0x604b('0x18')]],'as':_0x488257['as'],'attributes':_0x488257[_0x604b('0x15')],'include':_0x488257['include']?_[_0x604b('0x17')](_0x488257['include'],function(_0x248acd){return{'model':db[_0x248acd[_0x604b('0x18')]],'as':_0x248acd['as'],'attributes':_0x248acd['attributes'],'include':_0x248acd['include']?_[_0x604b('0x17')](_0x248acd['include'],function(_0x57d66d){return{'model':db[_0x57d66d['model']],'as':_0x57d66d['as'],'attributes':_0x57d66d['attributes']};}):[]};}):[]};}):[]:[]})[_0x604b('0xa')](function(_0x450242){logger[_0x604b('0xf')]('ShowSound',_0x2d1651);logger[_0x604b('0x19')](_0x604b('0x12'),_0x2d1651,JSON['stringify'](_0x450242));_0x185e68(_0x450242);})[_0x604b('0x11')](function(_0x18bb50){logger[_0x604b('0xc')](_0x604b('0x12'),_0x18bb50[_0x604b('0xe')],_0x2d1651);_0x164df2(_0x16b67f[_0x604b('0xc')](0x1f4,_0x18bb50[_0x604b('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 95eba14..1f0e2cd 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x4ad9f0,_0x6ec64b){var _0x57d2df=function(_0x1d6bfa){while(--_0x1d6bfa){_0x4ad9f0['push'](_0x4ad9f0['shift']());}};_0x57d2df(++_0x6ec64b);}(_0x757a,0xde));var _0xa757=function(_0x132eb5,_0x2607a6){_0x132eb5=_0x132eb5-0x0;var _0x16229c=_0x757a[_0x132eb5];return _0x16229c;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x43ffa9,_0x408818){var _0x19a91b=function(_0xd6025c){while(--_0xd6025c){_0x43ffa9['push'](_0x43ffa9['shift']());}};_0x19a91b(++_0x408818);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x5eb8[_0x1762b4];return _0x29beda;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6840988..37fb50e 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 _0x558a=['medium','out','exports','STRING','TEXT'];(function(_0x25ddf7,_0x24f36b){var _0x2851b1=function(_0x2fc637){while(--_0x2fc637){_0x25ddf7['push'](_0x25ddf7['shift']());}};_0x2851b1(++_0x24f36b);}(_0x558a,0x101));var _0xa558=function(_0x17c624,_0x2c6f74){_0x17c624=_0x17c624-0x0;var _0x24c927=_0x558a[_0x17c624];return _0x24c927;};'use strict';var Sequelize=require('sequelize');module[_0xa558('0x0')]={'uniqueid':{'type':Sequelize[_0xa558('0x1')]},'body':{'type':Sequelize[_0xa558('0x2')](_0xa558('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa558('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xa558('0x1')]},'providerResponse':{'type':Sequelize[_0xa558('0x2')]}}; \ No newline at end of file +var _0xa211=['TEXT','sequelize','exports','STRING','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa211,0xec));var _0x1a21=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa211[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x1a21('0x0'));module[_0x1a21('0x1')]={'uniqueid':{'type':Sequelize[_0x1a21('0x2')]},'body':{'type':Sequelize['TEXT'](_0x1a21('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x1a21('0x4')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0986aee..6d08706 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 _0x83d9=['map','SquareMessage','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','where','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','name','send'];(function(_0x266271,_0x5eac91){var _0x3bf3fd=function(_0x1da5e0){while(--_0x1da5e0){_0x266271['push'](_0x266271['shift']());}};_0x3bf3fd(++_0x5eac91);}(_0x83d9,0x134));var _0x983d=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x83d9[_0xf0bcac];return _0x4e4c65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x983d('0x0'));var zipdir=require(_0x983d('0x1'));var jsonpatch=require(_0x983d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x983d('0x3'));var util=require(_0x983d('0x4'));var path=require(_0x983d('0x5'));var sox=require(_0x983d('0x6'));var csv=require(_0x983d('0x7'));var ejs=require(_0x983d('0x8'));var fs=require('fs');var fs_extra=require(_0x983d('0x9'));var _=require(_0x983d('0xa'));var squel=require(_0x983d('0xb'));var crypto=require(_0x983d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x983d('0x7'));var querystring=require(_0x983d('0xd'));var Papa=require('papaparse');var Redis=require(_0x983d('0xe'));var authService=require(_0x983d('0xf'));var qs=require(_0x983d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x983d('0x11'));var logger=require(_0x983d('0x12'))(_0x983d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x983d('0x14'))['db'];function respondWithStatusCode(_0x47c3f7,_0x53575a){_0x53575a=_0x53575a||0xcc;return function(_0x57114e){if(_0x57114e){return _0x47c3f7[_0x983d('0x15')](_0x53575a);}return _0x47c3f7[_0x983d('0x16')](_0x53575a)[_0x983d('0x17')]();};}function respondWithResult(_0x9f87ff,_0x127f12){_0x127f12=_0x127f12||0xc8;return function(_0x1c6de1){if(_0x1c6de1){return _0x9f87ff[_0x983d('0x16')](_0x127f12)['json'](_0x1c6de1);}};}function respondWithFilteredResult(_0x39c63f,_0x5847ee){return function(_0x2cf3a5){if(_0x2cf3a5){var _0x39abb6=typeof _0x5847ee[_0x983d('0x18')]==='undefined'&&typeof _0x5847ee[_0x983d('0x19')]===_0x983d('0x1a');var _0x1dbe66=_0x2cf3a5[_0x983d('0x1b')];var _0x59e060=_0x39abb6?0x0:_0x5847ee['offset'];var _0x20885f=_0x39abb6?_0x2cf3a5[_0x983d('0x1b')]:_0x5847ee['offset']+_0x5847ee[_0x983d('0x19')];var _0xb84d59;if(_0x20885f>=_0x1dbe66){_0x20885f=_0x1dbe66;_0xb84d59=0xc8;}else{_0xb84d59=0xce;}_0x39c63f[_0x983d('0x16')](_0xb84d59);return _0x39c63f[_0x983d('0x1c')](_0x983d('0x1d'),_0x59e060+'-'+_0x20885f+'/'+_0x1dbe66)[_0x983d('0x1e')](_0x2cf3a5);}return null;};}function patchUpdates(_0x4c19a0){return function(_0x101077){try{jsonpatch[_0x983d('0x1f')](_0x101077,_0x4c19a0,!![]);}catch(_0x28a54b){return BPromise[_0x983d('0x20')](_0x28a54b);}return _0x101077[_0x983d('0x21')]();};}function saveUpdates(_0x43916f,_0x18b2c6){return function(_0x2fddca){if(_0x2fddca){return _0x2fddca['update'](_0x43916f)[_0x983d('0x22')](function(_0xa8d5ab){return _0xa8d5ab;});}return null;};}function removeEntity(_0x1ac4ec,_0x4a2653){return function(_0x184722){if(_0x184722){return _0x184722['destroy']()[_0x983d('0x22')](function(){_0x1ac4ec[_0x983d('0x16')](0xcc)[_0x983d('0x17')]();});}};}function handleEntityNotFound(_0x2bb9be,_0x1ab414){return function(_0x45ce11){if(!_0x45ce11){_0x2bb9be[_0x983d('0x15')](0x194);}return _0x45ce11;};}function handleError(_0x201e31,_0x52a78b){_0x52a78b=_0x52a78b||0x1f4;return function(_0x4ca386){logger['error'](_0x4ca386['stack']);if(_0x4ca386[_0x983d('0x23')]){delete _0x4ca386['name'];}_0x201e31[_0x983d('0x16')](_0x52a78b)[_0x983d('0x24')](_0x4ca386);};}exports['index']=function(_0x26e987,_0x1578d8){var _0x32202f={},_0x3878dd={},_0x2b70f8={'count':0x0,'rows':[]};var _0x192272=_[_0x983d('0x25')](db[_0x983d('0x26')][_0x983d('0x27')],function(_0x1622ba){return{'name':_0x1622ba[_0x983d('0x28')],'type':_0x1622ba[_0x983d('0x29')]['key']};});_0x3878dd[_0x983d('0x2a')]=_[_0x983d('0x25')](_0x192272,_0x983d('0x23'));_0x3878dd[_0x983d('0x2b')]=_['keys'](_0x26e987[_0x983d('0x2b')]);_0x3878dd['filters']=_[_0x983d('0x2c')](_0x3878dd[_0x983d('0x2a')],_0x3878dd['query']);_0x32202f[_0x983d('0x2d')]=_[_0x983d('0x2c')](_0x3878dd[_0x983d('0x2a')],qs['fields'](_0x26e987['query'][_0x983d('0x2e')]));_0x32202f[_0x983d('0x2d')]=_0x32202f[_0x983d('0x2d')][_0x983d('0x2f')]?_0x32202f['attributes']:_0x3878dd[_0x983d('0x2a')];if(!_0x26e987[_0x983d('0x2b')][_0x983d('0x30')](_0x983d('0x31'))){_0x32202f[_0x983d('0x19')]=qs[_0x983d('0x19')](_0x26e987['query'][_0x983d('0x19')]);_0x32202f[_0x983d('0x18')]=qs[_0x983d('0x18')](_0x26e987[_0x983d('0x2b')][_0x983d('0x18')]);}_0x32202f[_0x983d('0x32')]=qs[_0x983d('0x33')](_0x26e987[_0x983d('0x2b')]['sort']);_0x32202f['where']=qs[_0x983d('0x34')](_['pick'](_0x26e987[_0x983d('0x2b')],_0x3878dd['filters']),_0x192272);if(_0x26e987[_0x983d('0x2b')]['filter']){_0x32202f['where']=_[_0x983d('0x35')](_0x32202f[_0x983d('0x36')],{'$or':_[_0x983d('0x25')](_0x192272,function(_0x2919d7){if(_0x2919d7[_0x983d('0x29')]!=='VIRTUAL'){var _0x213140={};_0x213140[_0x2919d7['name']]={'$like':'%'+_0x26e987[_0x983d('0x2b')][_0x983d('0x37')]+'%'};return _0x213140;}})});}_0x32202f=_['merge']({},_0x32202f,_0x26e987[_0x983d('0x38')]);var _0x224f17={'where':_0x32202f[_0x983d('0x36')]};return db[_0x983d('0x26')][_0x983d('0x1b')](_0x224f17)[_0x983d('0x22')](function(_0x1e18cf){_0x2b70f8['count']=_0x1e18cf;if(_0x26e987['query'][_0x983d('0x39')]){_0x32202f[_0x983d('0x3a')]=[{'all':!![]}];}return db[_0x983d('0x26')]['findAll'](_0x32202f);})['then'](function(_0x2935a9){_0x2b70f8[_0x983d('0x3b')]=_0x2935a9;return _0x2b70f8;})[_0x983d('0x22')](respondWithFilteredResult(_0x1578d8,_0x32202f))[_0x983d('0x3c')](handleError(_0x1578d8,null));};exports[_0x983d('0x3d')]=function(_0x92ba82,_0x15ac5c){var _0x1d934c={'raw':!![],'where':{'id':_0x92ba82[_0x983d('0x3e')]['id']}},_0x52499c={};_0x52499c[_0x983d('0x2a')]=_[_0x983d('0x3f')](db[_0x983d('0x26')][_0x983d('0x27')]);_0x52499c[_0x983d('0x2b')]=_['keys'](_0x92ba82[_0x983d('0x2b')]);_0x52499c[_0x983d('0x34')]=_[_0x983d('0x2c')](_0x52499c[_0x983d('0x2a')],_0x52499c['query']);_0x1d934c[_0x983d('0x2d')]=_[_0x983d('0x2c')](_0x52499c[_0x983d('0x2a')],qs['fields'](_0x92ba82[_0x983d('0x2b')][_0x983d('0x2e')]));_0x1d934c[_0x983d('0x2d')]=_0x1d934c['attributes'][_0x983d('0x2f')]?_0x1d934c[_0x983d('0x2d')]:_0x52499c[_0x983d('0x2a')];if(_0x92ba82['query']['includeAll']){_0x1d934c[_0x983d('0x3a')]=[{'all':!![]}];}_0x1d934c=_[_0x983d('0x35')]({},_0x1d934c,_0x92ba82['options']);return db[_0x983d('0x26')][_0x983d('0x40')](_0x1d934c)[_0x983d('0x22')](handleEntityNotFound(_0x15ac5c,null))[_0x983d('0x22')](respondWithResult(_0x15ac5c,null))[_0x983d('0x3c')](handleError(_0x15ac5c,null));};exports[_0x983d('0x41')]=function(_0x2c2c2b,_0x24ef47){return db[_0x983d('0x26')][_0x983d('0x41')](_0x2c2c2b[_0x983d('0x42')],{})[_0x983d('0x22')](respondWithResult(_0x24ef47,0xc9))['catch'](handleError(_0x24ef47,null));};exports[_0x983d('0x43')]=function(_0x4e2557,_0x17b5b9){if(_0x4e2557[_0x983d('0x42')]['id']){delete _0x4e2557[_0x983d('0x42')]['id'];}return db[_0x983d('0x26')]['find']({'where':{'id':_0x4e2557[_0x983d('0x3e')]['id']}})[_0x983d('0x22')](handleEntityNotFound(_0x17b5b9,null))[_0x983d('0x22')](saveUpdates(_0x4e2557[_0x983d('0x42')],null))[_0x983d('0x22')](respondWithResult(_0x17b5b9,null))['catch'](handleError(_0x17b5b9,null));};exports[_0x983d('0x44')]=function(_0x34ad99,_0x2fc5f1){return db[_0x983d('0x26')][_0x983d('0x40')]({'where':{'id':_0x34ad99[_0x983d('0x3e')]['id']}})[_0x983d('0x22')](handleEntityNotFound(_0x2fc5f1,null))[_0x983d('0x22')](removeEntity(_0x2fc5f1,null))[_0x983d('0x3c')](handleError(_0x2fc5f1,null));}; \ No newline at end of file +var _0xf300=['../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SquareMessage','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x23fbf8,_0x1953d3){var _0x12b407=function(_0x36eb7e){while(--_0x36eb7e){_0x23fbf8['push'](_0x23fbf8['shift']());}};_0x12b407(++_0x1953d3);}(_0xf300,0xc6));var _0x0f30=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0xf300[_0x38fb0d];return _0x30a5d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0f30('0x0'));var jsonpatch=require(_0x0f30('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f30('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0f30('0x3'));var sox=require(_0x0f30('0x4'));var csv=require(_0x0f30('0x5'));var ejs=require(_0x0f30('0x6'));var fs=require('fs');var fs_extra=require(_0x0f30('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f30('0x8'));var jsforce=require(_0x0f30('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x0f30('0x5'));var querystring=require(_0x0f30('0xa'));var Papa=require(_0x0f30('0xb'));var Redis=require(_0x0f30('0xc'));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(_0x0f30('0xd'))(_0x0f30('0xe'));var utils=require(_0x0f30('0xf'));var config=require(_0x0f30('0x10'));var licenseUtil=require(_0x0f30('0x11'));var db=require(_0x0f30('0x12'))['db'];function respondWithStatusCode(_0xd92bdb,_0x4c9ca0){_0x4c9ca0=_0x4c9ca0||0xcc;return function(_0x4f3b97){if(_0x4f3b97){return _0xd92bdb['sendStatus'](_0x4c9ca0);}return _0xd92bdb[_0x0f30('0x13')](_0x4c9ca0)[_0x0f30('0x14')]();};}function respondWithResult(_0x45b5f4,_0x5b379d){_0x5b379d=_0x5b379d||0xc8;return function(_0xb35fae){if(_0xb35fae){return _0x45b5f4['status'](_0x5b379d)[_0x0f30('0x15')](_0xb35fae);}};}function respondWithFilteredResult(_0x56203c,_0x2aea33){return function(_0x17657c){if(_0x17657c){var _0x552d20=typeof _0x2aea33['offset']==='undefined'&&typeof _0x2aea33[_0x0f30('0x16')]===_0x0f30('0x17');var _0x1d89f5=_0x17657c[_0x0f30('0x18')];var _0x3b10b9=_0x552d20?0x0:_0x2aea33[_0x0f30('0x19')];var _0x24bc69=_0x552d20?_0x17657c[_0x0f30('0x18')]:_0x2aea33['offset']+_0x2aea33[_0x0f30('0x16')];var _0x221483;if(_0x24bc69>=_0x1d89f5){_0x24bc69=_0x1d89f5;_0x221483=0xc8;}else{_0x221483=0xce;}_0x56203c[_0x0f30('0x13')](_0x221483);return _0x56203c['set'](_0x0f30('0x1a'),_0x3b10b9+'-'+_0x24bc69+'/'+_0x1d89f5)['json'](_0x17657c);}return null;};}function patchUpdates(_0x1b750f){return function(_0x45abab){try{jsonpatch[_0x0f30('0x1b')](_0x45abab,_0x1b750f,!![]);}catch(_0xb6b397){return BPromise[_0x0f30('0x1c')](_0xb6b397);}return _0x45abab[_0x0f30('0x1d')]();};}function saveUpdates(_0x202b5a,_0x192744){return function(_0x242873){if(_0x242873){return _0x242873[_0x0f30('0x1e')](_0x202b5a)[_0x0f30('0x1f')](function(_0xd0e52e){return _0xd0e52e;});}return null;};}function removeEntity(_0x23ff04,_0x56623a){return function(_0x5dd65a){if(_0x5dd65a){return _0x5dd65a[_0x0f30('0x20')]()['then'](function(){_0x23ff04[_0x0f30('0x13')](0xcc)[_0x0f30('0x14')]();});}};}function handleEntityNotFound(_0x539b15,_0x542276){return function(_0x4c36ab){if(!_0x4c36ab){_0x539b15[_0x0f30('0x21')](0x194);}return _0x4c36ab;};}function handleError(_0x48f9b9,_0x42fd86){_0x42fd86=_0x42fd86||0x1f4;return function(_0x50f37e){logger[_0x0f30('0x22')](_0x50f37e[_0x0f30('0x23')]);if(_0x50f37e[_0x0f30('0x24')]){delete _0x50f37e[_0x0f30('0x24')];}_0x48f9b9[_0x0f30('0x13')](_0x42fd86)[_0x0f30('0x25')](_0x50f37e);};}exports[_0x0f30('0x26')]=function(_0x2bc919,_0x18c34e){var _0x5ba84d={},_0x2263fe={},_0x58a6c5={'count':0x0,'rows':[]};var _0x54e286=_[_0x0f30('0x27')](db['SquareMessage'][_0x0f30('0x28')],function(_0x540b10){return{'name':_0x540b10[_0x0f30('0x29')],'type':_0x540b10[_0x0f30('0x2a')]['key']};});_0x2263fe[_0x0f30('0x2b')]=_['map'](_0x54e286,_0x0f30('0x24'));_0x2263fe['query']=_['keys'](_0x2bc919[_0x0f30('0x2c')]);_0x2263fe[_0x0f30('0x2d')]=_[_0x0f30('0x2e')](_0x2263fe[_0x0f30('0x2b')],_0x2263fe[_0x0f30('0x2c')]);_0x5ba84d[_0x0f30('0x2f')]=_['intersection'](_0x2263fe[_0x0f30('0x2b')],qs['fields'](_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x30')]));_0x5ba84d[_0x0f30('0x2f')]=_0x5ba84d['attributes'][_0x0f30('0x31')]?_0x5ba84d[_0x0f30('0x2f')]:_0x2263fe[_0x0f30('0x2b')];if(!_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x32')](_0x0f30('0x33'))){_0x5ba84d[_0x0f30('0x16')]=qs[_0x0f30('0x16')](_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x16')]);_0x5ba84d['offset']=qs[_0x0f30('0x19')](_0x2bc919['query'][_0x0f30('0x19')]);}_0x5ba84d[_0x0f30('0x34')]=qs[_0x0f30('0x35')](_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x35')]);_0x5ba84d['where']=qs['filters'](_[_0x0f30('0x36')](_0x2bc919['query'],_0x2263fe[_0x0f30('0x2d')]),_0x54e286);if(_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x37')]){_0x5ba84d[_0x0f30('0x38')]=_[_0x0f30('0x39')](_0x5ba84d[_0x0f30('0x38')],{'$or':_['map'](_0x54e286,function(_0x779ded){if(_0x779ded[_0x0f30('0x2a')]!==_0x0f30('0x3a')){var _0x35a292={};_0x35a292[_0x779ded[_0x0f30('0x24')]]={'$like':'%'+_0x2bc919['query']['filter']+'%'};return _0x35a292;}})});}_0x5ba84d=_[_0x0f30('0x39')]({},_0x5ba84d,_0x2bc919[_0x0f30('0x3b')]);var _0x58353c={'where':_0x5ba84d[_0x0f30('0x38')]};return db[_0x0f30('0x3c')]['count'](_0x58353c)[_0x0f30('0x1f')](function(_0x5253a3){_0x58a6c5['count']=_0x5253a3;if(_0x2bc919[_0x0f30('0x2c')]['includeAll']){_0x5ba84d[_0x0f30('0x3d')]=[{'all':!![]}];}return db[_0x0f30('0x3c')][_0x0f30('0x3e')](_0x5ba84d);})[_0x0f30('0x1f')](function(_0x450c8e){_0x58a6c5[_0x0f30('0x3f')]=_0x450c8e;return _0x58a6c5;})[_0x0f30('0x1f')](respondWithFilteredResult(_0x18c34e,_0x5ba84d))['catch'](handleError(_0x18c34e,null));};exports[_0x0f30('0x40')]=function(_0x20952c,_0x430987){var _0x5c7e53={'raw':!![],'where':{'id':_0x20952c[_0x0f30('0x41')]['id']}},_0x2f58d4={};_0x2f58d4[_0x0f30('0x2b')]=_[_0x0f30('0x42')](db[_0x0f30('0x3c')][_0x0f30('0x28')]);_0x2f58d4[_0x0f30('0x2c')]=_['keys'](_0x20952c[_0x0f30('0x2c')]);_0x2f58d4['filters']=_[_0x0f30('0x2e')](_0x2f58d4[_0x0f30('0x2b')],_0x2f58d4[_0x0f30('0x2c')]);_0x5c7e53[_0x0f30('0x2f')]=_[_0x0f30('0x2e')](_0x2f58d4[_0x0f30('0x2b')],qs[_0x0f30('0x30')](_0x20952c[_0x0f30('0x2c')][_0x0f30('0x30')]));_0x5c7e53[_0x0f30('0x2f')]=_0x5c7e53['attributes'][_0x0f30('0x31')]?_0x5c7e53['attributes']:_0x2f58d4[_0x0f30('0x2b')];if(_0x20952c[_0x0f30('0x2c')][_0x0f30('0x43')]){_0x5c7e53[_0x0f30('0x3d')]=[{'all':!![]}];}_0x5c7e53=_[_0x0f30('0x39')]({},_0x5c7e53,_0x20952c[_0x0f30('0x3b')]);return db[_0x0f30('0x3c')][_0x0f30('0x44')](_0x5c7e53)[_0x0f30('0x1f')](handleEntityNotFound(_0x430987,null))[_0x0f30('0x1f')](respondWithResult(_0x430987,null))['catch'](handleError(_0x430987,null));};exports['create']=function(_0xbfe5c4,_0x30bcdc){return db[_0x0f30('0x3c')][_0x0f30('0x45')](_0xbfe5c4[_0x0f30('0x46')],{})[_0x0f30('0x1f')](respondWithResult(_0x30bcdc,0xc9))[_0x0f30('0x47')](handleError(_0x30bcdc,null));};exports[_0x0f30('0x1e')]=function(_0x5110bf,_0x3c4279){if(_0x5110bf[_0x0f30('0x46')]['id']){delete _0x5110bf[_0x0f30('0x46')]['id'];}return db[_0x0f30('0x3c')][_0x0f30('0x44')]({'where':{'id':_0x5110bf[_0x0f30('0x41')]['id']}})[_0x0f30('0x1f')](handleEntityNotFound(_0x3c4279,null))[_0x0f30('0x1f')](saveUpdates(_0x5110bf[_0x0f30('0x46')],null))['then'](respondWithResult(_0x3c4279,null))[_0x0f30('0x47')](handleError(_0x3c4279,null));};exports['destroy']=function(_0x15d193,_0xa49a8c){return db[_0x0f30('0x3c')]['find']({'where':{'id':_0x15d193[_0x0f30('0x41')]['id']}})[_0x0f30('0x1f')](handleEntityNotFound(_0xa49a8c,null))[_0x0f30('0x1f')](removeEntity(_0xa49a8c,null))[_0x0f30('0x47')](handleError(_0xa49a8c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 82f0e02..f481141 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 _0x214b=['path','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x214b,0x8a));var _0xb214=function(_0x1094cb,_0x4cc56e){_0x1094cb=_0x1094cb-0x0;var _0x24a983=_0x214b[_0x1094cb];return _0x24a983;};'use strict';var _=require(_0xb214('0x0'));var util=require(_0xb214('0x1'));var logger=require(_0xb214('0x2'))(_0xb214('0x3'));var moment=require(_0xb214('0x4'));var BPromise=require('bluebird');var rp=require(_0xb214('0x5'));var fs=require('fs');var path=require(_0xb214('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb214('0x7'));module[_0xb214('0x8')]=function(_0x51c712,_0x30c772){return _0x51c712[_0xb214('0x9')](_0xb214('0xa'),attributes,{'tableName':_0xb214('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d35=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','SquareMessage','square_messages'];(function(_0x3cf150,_0x178cb5){var _0x931f8b=function(_0x40a693){while(--_0x40a693){_0x3cf150['push'](_0x3cf150['shift']());}};_0x931f8b(++_0x178cb5);}(_0x6d35,0xa5));var _0x56d3=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x6d35[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0x56d3('0x0'));var util=require(_0x56d3('0x1'));var logger=require('../../config/logger')(_0x56d3('0x2'));var moment=require(_0x56d3('0x3'));var BPromise=require('bluebird');var rp=require(_0x56d3('0x4'));var fs=require('fs');var path=require(_0x56d3('0x5'));var rimraf=require(_0x56d3('0x6'));var config=require(_0x56d3('0x7'));var attributes=require(_0x56d3('0x8'));module['exports']=function(_0x49805f,_0x3b9b3a){return _0x49805f['define'](_0x56d3('0x9'),attributes,{'tableName':_0x56d3('0xa'),'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 e5b6c5f..621c9d5 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 _0x7ce7=['message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x9adcd6,_0x36278b){var _0xdf8ff2=function(_0x4f7087){while(--_0x4f7087){_0x9adcd6['push'](_0x9adcd6['shift']());}};_0xdf8ff2(++_0x36278b);}(_0x7ce7,0x7e));var _0x77ce=function(_0x38419f,_0x3e326e){_0x38419f=_0x38419f-0x0;var _0x4ee9b3=_0x7ce7[_0x38419f];return _0x4ee9b3;};'use strict';var _=require(_0x77ce('0x0'));var util=require('util');var moment=require(_0x77ce('0x1'));var BPromise=require(_0x77ce('0x2'));var rs=require(_0x77ce('0x3'));var fs=require('fs');var Redis=require(_0x77ce('0x4'));var db=require(_0x77ce('0x5'))['db'];var utils=require(_0x77ce('0x6'));var logger=require('../../config/logger')(_0x77ce('0x7'));var config=require(_0x77ce('0x8'));var jayson=require(_0x77ce('0x9'));var client=jayson[_0x77ce('0xa')][_0x77ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9c99ab,_0x5208de,_0x1b0dd5){return new BPromise(function(_0x5a437d,_0x127540){return client[_0x77ce('0xc')](_0x9c99ab,_0x1b0dd5)[_0x77ce('0xd')](function(_0x1a23ca){logger['info'](_0x77ce('0xe'),_0x5208de,_0x77ce('0xf'));logger[_0x77ce('0x10')](_0x77ce('0x11'),_0x5208de,_0x77ce('0xf'),JSON['stringify'](_0x1a23ca));if(_0x1a23ca[_0x77ce('0x12')]){if(_0x1a23ca[_0x77ce('0x12')]['code']===0x1f4){logger[_0x77ce('0x12')]('SquareMessage,\x20%s,\x20%s',_0x5208de,_0x1a23ca[_0x77ce('0x12')][_0x77ce('0x13')]);return _0x127540(_0x1a23ca[_0x77ce('0x12')][_0x77ce('0x13')]);}logger[_0x77ce('0x12')](_0x77ce('0xe'),_0x5208de,_0x1a23ca[_0x77ce('0x12')][_0x77ce('0x13')]);return _0x5a437d(_0x1a23ca[_0x77ce('0x12')][_0x77ce('0x13')]);}else{logger[_0x77ce('0x14')]('SquareMessage,\x20%s,\x20%s',_0x5208de,_0x77ce('0xf'));_0x5a437d(_0x1a23ca[_0x77ce('0x15')][_0x77ce('0x13')]);}})[_0x77ce('0x16')](function(_0x2bfe71){logger[_0x77ce('0x12')](_0x77ce('0xe'),_0x5208de,_0x2bfe71);_0x127540(_0x2bfe71);});});}exports[_0x77ce('0x17')]=function(_0x26a14d){var _0x12130d=this;return new Promise(function(_0x7ddf90,_0x58142e){return db[_0x77ce('0x18')][_0x77ce('0x19')](_0x26a14d[_0x77ce('0x1a')],{'raw':_0x26a14d[_0x77ce('0x1b')]?_0x26a14d['options'][_0x77ce('0x1c')]===undefined?!![]:![]:!![]})[_0x77ce('0xd')](function(_0x34dde3){logger[_0x77ce('0x14')](_0x77ce('0x17'),_0x26a14d);logger[_0x77ce('0x10')](_0x77ce('0x17'),_0x26a14d,JSON['stringify'](_0x34dde3));_0x7ddf90(_0x34dde3);})['catch'](function(_0x670bcb){logger[_0x77ce('0x12')]('CreateSquareMessage',_0x670bcb[_0x77ce('0x13')],_0x26a14d);_0x58142e(_0x12130d[_0x77ce('0x12')](0x1f4,_0x670bcb['message']));});});}; \ No newline at end of file +var _0xbfea=['SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','SquareMessage','body','options','raw','CreateSquareMessage','debug','stringify','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','SquareMessage,\x20%s,\x20%s'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xbfea,0x73));var _0xabfe=function(_0x21f9d6,_0x310fd4){_0x21f9d6=_0x21f9d6-0x0;var _0xd0e11c=_0xbfea[_0x21f9d6];return _0xd0e11c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xabfe('0x0'));var BPromise=require('bluebird');var rs=require(_0xabfe('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabfe('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xabfe('0x3'))(_0xabfe('0x4'));var config=require('../../config/environment');var jayson=require(_0xabfe('0x5'));var client=jayson[_0xabfe('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2788ca,_0x27925a,_0x3ae972){return new BPromise(function(_0x40a8d9,_0x49cbe9){return client[_0xabfe('0x7')](_0x2788ca,_0x3ae972)[_0xabfe('0x8')](function(_0x518b27){logger['info'](_0xabfe('0x9'),_0x27925a,'request\x20sent');logger['debug'](_0xabfe('0xa'),_0x27925a,'request\x20sent',JSON['stringify'](_0x518b27));if(_0x518b27['error']){if(_0x518b27[_0xabfe('0xb')][_0xabfe('0xc')]===0x1f4){logger[_0xabfe('0xb')](_0xabfe('0x9'),_0x27925a,_0x518b27[_0xabfe('0xb')][_0xabfe('0xd')]);return _0x49cbe9(_0x518b27[_0xabfe('0xb')][_0xabfe('0xd')]);}logger[_0xabfe('0xb')]('SquareMessage,\x20%s,\x20%s',_0x27925a,_0x518b27[_0xabfe('0xb')][_0xabfe('0xd')]);return _0x40a8d9(_0x518b27[_0xabfe('0xb')][_0xabfe('0xd')]);}else{logger[_0xabfe('0xe')](_0xabfe('0x9'),_0x27925a,_0xabfe('0xf'));_0x40a8d9(_0x518b27[_0xabfe('0x10')][_0xabfe('0xd')]);}})[_0xabfe('0x11')](function(_0x288c58){logger[_0xabfe('0xb')](_0xabfe('0x9'),_0x27925a,_0x288c58);_0x49cbe9(_0x288c58);});});}exports['CreateSquareMessage']=function(_0xe34e8a){var _0x4ef1be=this;return new Promise(function(_0x5115e7,_0x1c16cb){return db[_0xabfe('0x12')]['create'](_0xe34e8a[_0xabfe('0x13')],{'raw':_0xe34e8a[_0xabfe('0x14')]?_0xe34e8a[_0xabfe('0x14')][_0xabfe('0x15')]===undefined?!![]:![]:!![]})[_0xabfe('0x8')](function(_0x5d6a94){logger[_0xabfe('0xe')](_0xabfe('0x16'),_0xe34e8a);logger[_0xabfe('0x17')](_0xabfe('0x16'),_0xe34e8a,JSON[_0xabfe('0x18')](_0x5d6a94));_0x5115e7(_0x5d6a94);})[_0xabfe('0x11')](function(_0x1eeefe){logger[_0xabfe('0xb')](_0xabfe('0x16'),_0x1eeefe['message'],_0xe34e8a);_0x1c16cb(_0x4ef1be[_0xabfe('0xb')](0x1f4,_0x1eeefe[_0xabfe('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1096c47..f86c8e2 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 _0x49b2=['update','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','test','post','create','put'];(function(_0x46614f,_0x2d3cd7){var _0x5c77c5=function(_0xa8448a){while(--_0xa8448a){_0x46614f['push'](_0x46614f['shift']());}};_0x5c77c5(++_0x2d3cd7);}(_0x49b2,0xfb));var _0x249b=function(_0x10ab17,_0x24de77){_0x10ab17=_0x10ab17-0x0;var _0xbbb279=_0x49b2[_0x10ab17];return _0xbbb279;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x249b('0x0'));var timeout=require('connect-timeout');var express=require(_0x249b('0x1'));var router=express['Router']();var fs_extra=require(_0x249b('0x2'));var auth=require(_0x249b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x249b('0x4'));var controller=require(_0x249b('0x5'));router[_0x249b('0x6')]('/',auth[_0x249b('0x7')](),controller[_0x249b('0x8')]);router[_0x249b('0x6')](_0x249b('0x9'),auth[_0x249b('0x7')](),controller['show']);router[_0x249b('0x6')](_0x249b('0xa'),auth[_0x249b('0x7')](),timeout('15s'),controller[_0x249b('0xb')]);router[_0x249b('0xc')]('/',auth[_0x249b('0x7')](),controller[_0x249b('0xd')]);router[_0x249b('0xe')](_0x249b('0x9'),auth[_0x249b('0x7')](),controller[_0x249b('0xf')]);router[_0x249b('0x10')](_0x249b('0x9'),auth[_0x249b('0x7')](),controller[_0x249b('0x11')]);module[_0x249b('0x12')]=router; \ No newline at end of file +var _0x15c5=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','post','create','put','/:id','update','delete','destroy'];(function(_0x192a08,_0x2ca8d8){var _0x1e962f=function(_0x3ce828){while(--_0x3ce828){_0x192a08['push'](_0x192a08['shift']());}};_0x1e962f(++_0x2ca8d8);}(_0x15c5,0x127));var _0x515c=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x15c5[_0x2675da];return _0x5e6153;};'use strict';var multer=require(_0x515c('0x0'));var util=require(_0x515c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x515c('0x2'));var router=express[_0x515c('0x3')]();var fs_extra=require(_0x515c('0x4'));var auth=require(_0x515c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x515c('0x6'));var controller=require(_0x515c('0x7'));router[_0x515c('0x8')]('/',auth[_0x515c('0x9')](),controller[_0x515c('0xa')]);router['get']('/:id',auth[_0x515c('0x9')](),controller[_0x515c('0xb')]);router['get'](_0x515c('0xc'),auth[_0x515c('0x9')](),timeout('15s'),controller['test']);router[_0x515c('0xd')]('/',auth[_0x515c('0x9')](),controller[_0x515c('0xe')]);router[_0x515c('0xf')](_0x515c('0x10'),auth[_0x515c('0x9')](),controller[_0x515c('0x11')]);router[_0x515c('0x12')]('/:id',auth[_0x515c('0x9')](),controller[_0x515c('0x13')]);module[_0x515c('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f0cf3a2..f20e6d9 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 _0xdef8=['STRING','name'];(function(_0x29f014,_0x508522){var _0x316be5=function(_0x1753a5){while(--_0x1753a5){_0x29f014['push'](_0x29f014['shift']());}};_0x316be5(++_0x508522);}(_0xdef8,0x125));var _0x8def=function(_0x56b35c,_0x7c821b){_0x56b35c=_0x56b35c-0x0;var _0x360b30=_0xdef8[_0x56b35c];return _0x360b30;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8def('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8def('0x1')]},'description':{'type':Sequelize[_0x8def('0x1')]}}; \ No newline at end of file +var _0x72c6=['STRING','name','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x72c6,0x92));var _0x672c=function(_0x2a442d,_0x15849b){_0x2a442d=_0x2a442d-0x0;var _0x439ede=_0x72c6[_0x2a442d];return _0x439ede;};'use strict';var Sequelize=require(_0x672c('0x0'));module[_0x672c('0x1')]={'name':{'type':Sequelize[_0x672c('0x2')],'unique':_0x672c('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x672c('0x2')]},'description':{'type':Sequelize[_0x672c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 3ec1170..cad1416 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 _0x0489=['lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','update','then','destroy','get','ODBC','error','stack','name','index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x0489,0x1f0));var _0x9048=function(_0x31c5e9,_0x30e373){_0x31c5e9=_0x31c5e9-0x0;var _0x517a8d=_0x0489[_0x31c5e9];return _0x517a8d;};'use strict';var emlformat=require(_0x9048('0x0'));var rimraf=require(_0x9048('0x1'));var zipdir=require(_0x9048('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9048('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9048('0x4'));var path=require(_0x9048('0x5'));var sox=require(_0x9048('0x6'));var csv=require(_0x9048('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9048('0x8'));var squel=require(_0x9048('0x9'));var crypto=require(_0x9048('0xa'));var jsforce=require(_0x9048('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9048('0xc'));var Redis=require(_0x9048('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9048('0xe'));var as=require(_0x9048('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9048('0x10'))(_0x9048('0x11'));var utils=require(_0x9048('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9048('0x13'));var db=require(_0x9048('0x14'))['db'];function respondWithStatusCode(_0x1d47ec,_0x51aaf4){_0x51aaf4=_0x51aaf4||0xcc;return function(_0x477814){if(_0x477814){return _0x1d47ec[_0x9048('0x15')](_0x51aaf4);}return _0x1d47ec[_0x9048('0x16')](_0x51aaf4)[_0x9048('0x17')]();};}function respondWithResult(_0xd08fe6,_0x21c129){_0x21c129=_0x21c129||0xc8;return function(_0x43fb52){if(_0x43fb52){return _0xd08fe6['status'](_0x21c129)[_0x9048('0x18')](_0x43fb52);}};}function respondWithFilteredResult(_0x4d427c,_0x5c0bfa){return function(_0x33f7ea){if(_0x33f7ea){var _0x3ec7bf=typeof _0x5c0bfa[_0x9048('0x19')]===_0x9048('0x1a')&&typeof _0x5c0bfa[_0x9048('0x1b')]===_0x9048('0x1a');var _0x102168=_0x33f7ea['count'];var _0x15c5f0=_0x3ec7bf?0x0:_0x5c0bfa[_0x9048('0x19')];var _0x2dfd8f=_0x3ec7bf?_0x33f7ea['count']:_0x5c0bfa[_0x9048('0x19')]+_0x5c0bfa['limit'];var _0x4cab47;if(_0x2dfd8f>=_0x102168){_0x2dfd8f=_0x102168;_0x4cab47=0xc8;}else{_0x4cab47=0xce;}_0x4d427c[_0x9048('0x16')](_0x4cab47);return _0x4d427c[_0x9048('0x1c')](_0x9048('0x1d'),_0x15c5f0+'-'+_0x2dfd8f+'/'+_0x102168)['json'](_0x33f7ea);}return null;};}function patchUpdates(_0xed6bb2){return function(_0x5adcd4){try{jsonpatch[_0x9048('0x1e')](_0x5adcd4,_0xed6bb2,!![]);}catch(_0x381496){return BPromise['reject'](_0x381496);}return _0x5adcd4['save']();};}function saveUpdates(_0x474e28,_0x2e7f93){return function(_0x3b4173){if(_0x3b4173){return _0x3b4173[_0x9048('0x1f')](_0x474e28)[_0x9048('0x20')](function(_0x65e0ec){return _0x65e0ec;});}return null;};}function removeEntity(_0x364711,_0x575b97){return function(_0x25b114){if(_0x25b114){return _0x25b114[_0x9048('0x21')]()[_0x9048('0x20')](function(){var _0x41b257=_0x25b114[_0x9048('0x22')]({'plain':!![]});var _0x40cc60=_0x9048('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x40cc60,'resourceId':_0x41b257['id']}})[_0x9048('0x20')](function(){return _0x25b114;});})[_0x9048('0x20')](function(){_0x364711[_0x9048('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x786171,_0x1523f9){return function(_0xdd818){if(!_0xdd818){_0x786171['sendStatus'](0x194);}return _0xdd818;};}function handleError(_0x179e04,_0x4382b1){_0x4382b1=_0x4382b1||0x1f4;return function(_0x438a0d){logger[_0x9048('0x24')](_0x438a0d[_0x9048('0x25')]);if(_0x438a0d[_0x9048('0x26')]){delete _0x438a0d['name'];}_0x179e04[_0x9048('0x16')](_0x4382b1)['send'](_0x438a0d);};}exports[_0x9048('0x27')]=function(_0x22fcc1,_0x37da41){var _0x36c900={},_0x289d10={},_0xe8851e={'count':0x0,'rows':[]};var _0x50c162=_[_0x9048('0x28')](db[_0x9048('0x29')]['rawAttributes'],function(_0x47f292){return{'name':_0x47f292[_0x9048('0x2a')],'type':_0x47f292[_0x9048('0x2b')][_0x9048('0x2c')]};});_0x289d10[_0x9048('0x2d')]=_['map'](_0x50c162,_0x9048('0x26'));_0x289d10[_0x9048('0x2e')]=_['keys'](_0x22fcc1[_0x9048('0x2e')]);_0x289d10[_0x9048('0x2f')]=_[_0x9048('0x30')](_0x289d10[_0x9048('0x2d')],_0x289d10[_0x9048('0x2e')]);_0x36c900[_0x9048('0x31')]=_['intersection'](_0x289d10['model'],qs['fields'](_0x22fcc1['query']['fields']));_0x36c900[_0x9048('0x31')]=_0x36c900['attributes'][_0x9048('0x32')]?_0x36c900['attributes']:_0x289d10[_0x9048('0x2d')];if(!_0x22fcc1[_0x9048('0x2e')][_0x9048('0x33')](_0x9048('0x34'))){_0x36c900['limit']=qs[_0x9048('0x1b')](_0x22fcc1['query']['limit']);_0x36c900['offset']=qs[_0x9048('0x19')](_0x22fcc1[_0x9048('0x2e')][_0x9048('0x19')]);}_0x36c900['order']=qs[_0x9048('0x35')](_0x22fcc1[_0x9048('0x2e')][_0x9048('0x35')]);_0x36c900['where']=qs['filters'](_[_0x9048('0x36')](_0x22fcc1[_0x9048('0x2e')],_0x289d10[_0x9048('0x2f')]),_0x50c162);if(_0x22fcc1[_0x9048('0x2e')]['filter']){_0x36c900['where']=_['merge'](_0x36c900[_0x9048('0x37')],{'$or':_[_0x9048('0x28')](_0x50c162,function(_0x537a41){if(_0x537a41['type']!==_0x9048('0x38')){var _0x54821c={};_0x54821c[_0x537a41[_0x9048('0x26')]]={'$like':'%'+_0x22fcc1[_0x9048('0x2e')][_0x9048('0x39')]+'%'};return _0x54821c;}})});}_0x36c900=_[_0x9048('0x3a')]({},_0x36c900,_0x22fcc1[_0x9048('0x3b')]);var _0x316f99={'where':_0x36c900[_0x9048('0x37')]};return db[_0x9048('0x29')][_0x9048('0x3c')](_0x316f99)[_0x9048('0x20')](function(_0x335887){_0xe8851e['count']=_0x335887;if(_0x22fcc1[_0x9048('0x2e')][_0x9048('0x3d')]){_0x36c900[_0x9048('0x3e')]=[{'all':!![]}];}return db[_0x9048('0x29')][_0x9048('0x3f')](_0x36c900);})[_0x9048('0x20')](function(_0x303080){_0xe8851e[_0x9048('0x40')]=_0x303080;return _0xe8851e;})[_0x9048('0x20')](respondWithFilteredResult(_0x37da41,_0x36c900))[_0x9048('0x41')](handleError(_0x37da41,null));};exports[_0x9048('0x42')]=function(_0x49823c,_0x2889b1){var _0x234b82={'raw':!![],'where':{'id':_0x49823c[_0x9048('0x43')]['id']}},_0x1104a1={};_0x1104a1[_0x9048('0x2d')]=_['keys'](db[_0x9048('0x29')][_0x9048('0x44')]);_0x1104a1['query']=_['keys'](_0x49823c[_0x9048('0x2e')]);_0x1104a1['filters']=_['intersection'](_0x1104a1[_0x9048('0x2d')],_0x1104a1[_0x9048('0x2e')]);_0x234b82[_0x9048('0x31')]=_[_0x9048('0x30')](_0x1104a1[_0x9048('0x2d')],qs[_0x9048('0x45')](_0x49823c[_0x9048('0x2e')][_0x9048('0x45')]));_0x234b82[_0x9048('0x31')]=_0x234b82[_0x9048('0x31')][_0x9048('0x32')]?_0x234b82[_0x9048('0x31')]:_0x1104a1['model'];if(_0x49823c['query'][_0x9048('0x3d')]){_0x234b82[_0x9048('0x3e')]=[{'all':!![]}];}_0x234b82=_[_0x9048('0x3a')]({},_0x234b82,_0x49823c[_0x9048('0x3b')]);return db[_0x9048('0x29')]['find'](_0x234b82)[_0x9048('0x20')](handleEntityNotFound(_0x2889b1,null))[_0x9048('0x20')](respondWithResult(_0x2889b1,null))['catch'](handleError(_0x2889b1,null));};exports[_0x9048('0x46')]=function(_0x2ea8c3,_0x4e2c09){return db[_0x9048('0x29')][_0x9048('0x46')](_0x2ea8c3[_0x9048('0x47')],{})[_0x9048('0x20')](function(_0x70d7d0){var _0x5170a3=_0x2ea8c3[_0x9048('0x48')][_0x9048('0x22')]({'plain':!![]});if(!_0x5170a3)throw new Error(_0x9048('0x49'));if(_0x5170a3['role']===_0x9048('0x48')){var _0x1266c8=_0x70d7d0[_0x9048('0x22')]({'plain':!![]});var _0x3fb988=_0x9048('0x23');return db[_0x9048('0x4a')][_0x9048('0x4b')]({'where':{'name':_0x3fb988,'userProfileId':_0x5170a3[_0x9048('0x4c')]},'raw':!![]})['then'](function(_0x2acf19){if(_0x2acf19&&_0x2acf19[_0x9048('0x4d')]===0x0){return db[_0x9048('0x4e')][_0x9048('0x46')]({'name':_0x1266c8[_0x9048('0x26')],'resourceId':_0x1266c8['id'],'type':_0x2acf19['name'],'sectionId':_0x2acf19['id']},{})[_0x9048('0x20')](function(){return _0x70d7d0;});}else{return _0x70d7d0;}})[_0x9048('0x41')](function(_0x9a6c9e){logger[_0x9048('0x24')](_0x9048('0x4f'),_0x9a6c9e);throw _0x9a6c9e;});}return _0x70d7d0;})['then'](respondWithResult(_0x4e2c09,0xc9))['catch'](handleError(_0x4e2c09,null));};exports[_0x9048('0x1f')]=function(_0x1be032,_0x8a6374){if(_0x1be032[_0x9048('0x47')]['id']){delete _0x1be032[_0x9048('0x47')]['id'];}return db[_0x9048('0x29')][_0x9048('0x4b')]({'where':{'id':_0x1be032[_0x9048('0x43')]['id']}})[_0x9048('0x20')](handleEntityNotFound(_0x8a6374,null))['then'](saveUpdates(_0x1be032['body'],null))[_0x9048('0x20')](respondWithResult(_0x8a6374,null))[_0x9048('0x41')](handleError(_0x8a6374,null));};exports['destroy']=function(_0x16f40e,_0x3e5b35){return db[_0x9048('0x29')]['find']({'where':{'id':_0x16f40e[_0x9048('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e5b35,null))['then'](removeEntity(_0x3e5b35,null))['catch'](handleError(_0x3e5b35,null));};exports['test']=function(_0x34c6c,_0xf9adeb,_0x184644){var _0x56e634;return db['SquareOdbc']['find']({'where':{'id':_0x34c6c[_0x9048('0x43')]['id']},'attributes':['id',_0x9048('0x50')]})[_0x9048('0x20')](handleEntityNotFound(_0xf9adeb,null))[_0x9048('0x20')](function(_0x16a616){if(_0x16a616){var _0x477b9a=require(_0x9048('0x51'))();_0x477b9a[_0x9048('0x52')](_0x16a616[_0x9048('0x50')]);_0x477b9a[_0x9048('0x53')]();return _0x16a616;}})[_0x9048('0x20')](respondWithResult(_0xf9adeb,null))[_0x9048('0x41')](handleError(_0xf9adeb,null));}; \ No newline at end of file +var _0xaf34=['filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','options','include','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','UserProfileSection','userProfileId','update','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys'];(function(_0x50d326,_0x1fc7e2){var _0x10f473=function(_0x2588fd){while(--_0x2588fd){_0x50d326['push'](_0x50d326['shift']());}};_0x10f473(++_0x1fc7e2);}(_0xaf34,0x11a));var _0x4af3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xaf34[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x4af3('0x0'));var rimraf=require(_0x4af3('0x1'));var zipdir=require(_0x4af3('0x2'));var jsonpatch=require(_0x4af3('0x3'));var rp=require(_0x4af3('0x4'));var moment=require(_0x4af3('0x5'));var BPromise=require(_0x4af3('0x6'));var Mustache=require(_0x4af3('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4af3('0x8'));var ejs=require(_0x4af3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4af3('0xa'));var squel=require(_0x4af3('0xb'));var crypto=require(_0x4af3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4af3('0xd'));var Papa=require(_0x4af3('0xe'));var Redis=require('ioredis');var authService=require(_0x4af3('0xf'));var qs=require(_0x4af3('0x10'));var as=require(_0x4af3('0x11'));var hardwareService=require(_0x4af3('0x12'));var logger=require(_0x4af3('0x13'))(_0x4af3('0x14'));var utils=require(_0x4af3('0x15'));var config=require(_0x4af3('0x16'));var licenseUtil=require(_0x4af3('0x17'));var db=require(_0x4af3('0x18'))['db'];function respondWithStatusCode(_0x535e02,_0x540360){_0x540360=_0x540360||0xcc;return function(_0x55e1c8){if(_0x55e1c8){return _0x535e02[_0x4af3('0x19')](_0x540360);}return _0x535e02[_0x4af3('0x1a')](_0x540360)[_0x4af3('0x1b')]();};}function respondWithResult(_0x21e417,_0x2bf213){_0x2bf213=_0x2bf213||0xc8;return function(_0x351dea){if(_0x351dea){return _0x21e417[_0x4af3('0x1a')](_0x2bf213)['json'](_0x351dea);}};}function respondWithFilteredResult(_0xcdd21d,_0x5e3f70){return function(_0x28534a){if(_0x28534a){var _0x127440=typeof _0x5e3f70[_0x4af3('0x1c')]===_0x4af3('0x1d')&&typeof _0x5e3f70['limit']==='undefined';var _0x12cd24=_0x28534a[_0x4af3('0x1e')];var _0x3a970f=_0x127440?0x0:_0x5e3f70[_0x4af3('0x1c')];var _0x12b676=_0x127440?_0x28534a[_0x4af3('0x1e')]:_0x5e3f70[_0x4af3('0x1c')]+_0x5e3f70[_0x4af3('0x1f')];var _0xe0d622;if(_0x12b676>=_0x12cd24){_0x12b676=_0x12cd24;_0xe0d622=0xc8;}else{_0xe0d622=0xce;}_0xcdd21d[_0x4af3('0x1a')](_0xe0d622);return _0xcdd21d['set'](_0x4af3('0x20'),_0x3a970f+'-'+_0x12b676+'/'+_0x12cd24)[_0x4af3('0x21')](_0x28534a);}return null;};}function patchUpdates(_0x346194){return function(_0x39eeb0){try{jsonpatch['apply'](_0x39eeb0,_0x346194,!![]);}catch(_0x56b69a){return BPromise[_0x4af3('0x22')](_0x56b69a);}return _0x39eeb0[_0x4af3('0x23')]();};}function saveUpdates(_0x1e5714,_0x1d4e8f){return function(_0x4d3edc){if(_0x4d3edc){return _0x4d3edc['update'](_0x1e5714)[_0x4af3('0x24')](function(_0x45fbd9){return _0x45fbd9;});}return null;};}function removeEntity(_0x1d1269,_0x1f0efd){return function(_0x9cb93b){if(_0x9cb93b){return _0x9cb93b[_0x4af3('0x25')]()[_0x4af3('0x24')](function(){var _0x4a9745=_0x9cb93b[_0x4af3('0x26')]({'plain':!![]});var _0x13bbb9=_0x4af3('0x27');return db[_0x4af3('0x28')][_0x4af3('0x25')]({'where':{'type':_0x13bbb9,'resourceId':_0x4a9745['id']}})[_0x4af3('0x24')](function(){return _0x9cb93b;});})[_0x4af3('0x24')](function(){_0x1d1269['status'](0xcc)[_0x4af3('0x1b')]();});}};}function handleEntityNotFound(_0x36bac6,_0x4dfb3c){return function(_0x1511ef){if(!_0x1511ef){_0x36bac6['sendStatus'](0x194);}return _0x1511ef;};}function handleError(_0x567faf,_0x2dd793){_0x2dd793=_0x2dd793||0x1f4;return function(_0x5b5628){logger[_0x4af3('0x29')](_0x5b5628[_0x4af3('0x2a')]);if(_0x5b5628['name']){delete _0x5b5628[_0x4af3('0x2b')];}_0x567faf['status'](_0x2dd793)[_0x4af3('0x2c')](_0x5b5628);};}exports[_0x4af3('0x2d')]=function(_0x4a34d7,_0x516470){var _0x1490b6={},_0x3b70c2={},_0x411aaf={'count':0x0,'rows':[]};var _0x3a0d46=_[_0x4af3('0x2e')](db[_0x4af3('0x2f')]['rawAttributes'],function(_0xc88bc2){return{'name':_0xc88bc2[_0x4af3('0x30')],'type':_0xc88bc2[_0x4af3('0x31')][_0x4af3('0x32')]};});_0x3b70c2[_0x4af3('0x33')]=_['map'](_0x3a0d46,_0x4af3('0x2b'));_0x3b70c2[_0x4af3('0x34')]=_[_0x4af3('0x35')](_0x4a34d7['query']);_0x3b70c2[_0x4af3('0x36')]=_[_0x4af3('0x37')](_0x3b70c2[_0x4af3('0x33')],_0x3b70c2['query']);_0x1490b6['attributes']=_['intersection'](_0x3b70c2[_0x4af3('0x33')],qs['fields'](_0x4a34d7[_0x4af3('0x34')][_0x4af3('0x38')]));_0x1490b6['attributes']=_0x1490b6['attributes']['length']?_0x1490b6[_0x4af3('0x39')]:_0x3b70c2['model'];if(!_0x4a34d7[_0x4af3('0x34')]['hasOwnProperty']('nolimit')){_0x1490b6[_0x4af3('0x1f')]=qs[_0x4af3('0x1f')](_0x4a34d7[_0x4af3('0x34')]['limit']);_0x1490b6['offset']=qs['offset'](_0x4a34d7[_0x4af3('0x34')][_0x4af3('0x1c')]);}_0x1490b6[_0x4af3('0x3a')]=qs[_0x4af3('0x3b')](_0x4a34d7[_0x4af3('0x34')]['sort']);_0x1490b6['where']=qs[_0x4af3('0x36')](_[_0x4af3('0x3c')](_0x4a34d7[_0x4af3('0x34')],_0x3b70c2[_0x4af3('0x36')]),_0x3a0d46);if(_0x4a34d7[_0x4af3('0x34')][_0x4af3('0x3d')]){_0x1490b6[_0x4af3('0x3e')]=_[_0x4af3('0x3f')](_0x1490b6[_0x4af3('0x3e')],{'$or':_['map'](_0x3a0d46,function(_0x270243){if(_0x270243[_0x4af3('0x31')]!=='VIRTUAL'){var _0x4ab792={};_0x4ab792[_0x270243[_0x4af3('0x2b')]]={'$like':'%'+_0x4a34d7[_0x4af3('0x34')][_0x4af3('0x3d')]+'%'};return _0x4ab792;}})});}_0x1490b6=_[_0x4af3('0x3f')]({},_0x1490b6,_0x4a34d7[_0x4af3('0x40')]);var _0x297144={'where':_0x1490b6[_0x4af3('0x3e')]};return db[_0x4af3('0x2f')][_0x4af3('0x1e')](_0x297144)[_0x4af3('0x24')](function(_0x50fc3c){_0x411aaf[_0x4af3('0x1e')]=_0x50fc3c;if(_0x4a34d7[_0x4af3('0x34')]['includeAll']){_0x1490b6[_0x4af3('0x41')]=[{'all':!![]}];}return db[_0x4af3('0x2f')]['findAll'](_0x1490b6);})[_0x4af3('0x24')](function(_0x72d8a4){_0x411aaf['rows']=_0x72d8a4;return _0x411aaf;})['then'](respondWithFilteredResult(_0x516470,_0x1490b6))[_0x4af3('0x42')](handleError(_0x516470,null));};exports[_0x4af3('0x43')]=function(_0x51d099,_0x474944){var _0x4ecd09={'raw':!![],'where':{'id':_0x51d099[_0x4af3('0x44')]['id']}},_0x59594f={};_0x59594f[_0x4af3('0x33')]=_[_0x4af3('0x35')](db[_0x4af3('0x2f')][_0x4af3('0x45')]);_0x59594f['query']=_[_0x4af3('0x35')](_0x51d099['query']);_0x59594f[_0x4af3('0x36')]=_[_0x4af3('0x37')](_0x59594f[_0x4af3('0x33')],_0x59594f[_0x4af3('0x34')]);_0x4ecd09[_0x4af3('0x39')]=_[_0x4af3('0x37')](_0x59594f[_0x4af3('0x33')],qs[_0x4af3('0x38')](_0x51d099[_0x4af3('0x34')]['fields']));_0x4ecd09['attributes']=_0x4ecd09[_0x4af3('0x39')][_0x4af3('0x46')]?_0x4ecd09['attributes']:_0x59594f[_0x4af3('0x33')];if(_0x51d099['query'][_0x4af3('0x47')]){_0x4ecd09[_0x4af3('0x41')]=[{'all':!![]}];}_0x4ecd09=_['merge']({},_0x4ecd09,_0x51d099[_0x4af3('0x40')]);return db['SquareOdbc'][_0x4af3('0x48')](_0x4ecd09)[_0x4af3('0x24')](handleEntityNotFound(_0x474944,null))[_0x4af3('0x24')](respondWithResult(_0x474944,null))['catch'](handleError(_0x474944,null));};exports[_0x4af3('0x49')]=function(_0x35fb3a,_0x3d79b2){return db['SquareOdbc']['create'](_0x35fb3a[_0x4af3('0x4a')],{})[_0x4af3('0x24')](function(_0x10c22f){var _0x545a82=_0x35fb3a[_0x4af3('0x4b')]['get']({'plain':!![]});if(!_0x545a82)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x545a82['role']===_0x4af3('0x4b')){var _0x2ab345=_0x10c22f['get']({'plain':!![]});var _0x327505=_0x4af3('0x27');return db[_0x4af3('0x4c')][_0x4af3('0x48')]({'where':{'name':_0x327505,'userProfileId':_0x545a82[_0x4af3('0x4d')]},'raw':!![]})[_0x4af3('0x24')](function(_0x5bcd5b){if(_0x5bcd5b&&_0x5bcd5b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2ab345[_0x4af3('0x2b')],'resourceId':_0x2ab345['id'],'type':_0x5bcd5b['name'],'sectionId':_0x5bcd5b['id']},{})[_0x4af3('0x24')](function(){return _0x10c22f;});}else{return _0x10c22f;}})[_0x4af3('0x42')](function(_0x524903){logger[_0x4af3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x524903);throw _0x524903;});}return _0x10c22f;})[_0x4af3('0x24')](respondWithResult(_0x3d79b2,0xc9))['catch'](handleError(_0x3d79b2,null));};exports[_0x4af3('0x4e')]=function(_0x5dfd5f,_0x359cbf){if(_0x5dfd5f[_0x4af3('0x4a')]['id']){delete _0x5dfd5f[_0x4af3('0x4a')]['id'];}return db[_0x4af3('0x2f')][_0x4af3('0x48')]({'where':{'id':_0x5dfd5f[_0x4af3('0x44')]['id']}})[_0x4af3('0x24')](handleEntityNotFound(_0x359cbf,null))[_0x4af3('0x24')](saveUpdates(_0x5dfd5f[_0x4af3('0x4a')],null))[_0x4af3('0x24')](respondWithResult(_0x359cbf,null))[_0x4af3('0x42')](handleError(_0x359cbf,null));};exports['destroy']=function(_0x3d3a6b,_0x43dd3e){return db[_0x4af3('0x2f')][_0x4af3('0x48')]({'where':{'id':_0x3d3a6b[_0x4af3('0x44')]['id']}})[_0x4af3('0x24')](handleEntityNotFound(_0x43dd3e,null))['then'](removeEntity(_0x43dd3e,null))[_0x4af3('0x42')](handleError(_0x43dd3e,null));};exports[_0x4af3('0x4f')]=function(_0x5ea305,_0x2f3ced,_0x3d29f6){var _0x58b280;return db['SquareOdbc'][_0x4af3('0x48')]({'where':{'id':_0x5ea305[_0x4af3('0x44')]['id']},'attributes':['id',_0x4af3('0x50')]})[_0x4af3('0x24')](handleEntityNotFound(_0x2f3ced,null))['then'](function(_0x18780e){if(_0x18780e){var _0x5c1fa8=require(_0x4af3('0x51'))();_0x5c1fa8[_0x4af3('0x52')](_0x18780e[_0x4af3('0x50')]);_0x5c1fa8[_0x4af3('0x53')]();return _0x18780e;}})['then'](respondWithResult(_0x2f3ced,null))[_0x4af3('0x42')](handleError(_0x2f3ced,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1c53ae5..eff99ee 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 _0x4808=['exports','SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise','path','./squareOdbc.attributes'];(function(_0x2e0661,_0x22ad87){var _0x2185d5=function(_0x58f56f){while(--_0x58f56f){_0x2e0661['push'](_0x2e0661['shift']());}};_0x2185d5(++_0x22ad87);}(_0x4808,0xd4));var _0x8480=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x4808[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0x8480('0x0'));var logger=require(_0x8480('0x1'))(_0x8480('0x2'));var moment=require(_0x8480('0x3'));var BPromise=require(_0x8480('0x4'));var rp=require(_0x8480('0x5'));var fs=require('fs');var path=require(_0x8480('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8480('0x7'));module[_0x8480('0x8')]=function(_0x47b1c9,_0x18ec11){return _0x47b1c9['define'](_0x8480('0x9'),attributes,{'tableName':_0x8480('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1b4=['./squareOdbc.attributes','square_odbc','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc1b4,0x10a));var _0x4c1b=function(_0x4aff5c,_0xfe07b9){_0x4aff5c=_0x4aff5c-0x0;var _0x281964=_0xc1b4[_0x4aff5c];return _0x281964;};'use strict';var _=require(_0x4c1b('0x0'));var util=require(_0x4c1b('0x1'));var logger=require('../../config/logger')(_0x4c1b('0x2'));var moment=require(_0x4c1b('0x3'));var BPromise=require(_0x4c1b('0x4'));var rp=require(_0x4c1b('0x5'));var fs=require('fs');var path=require(_0x4c1b('0x6'));var rimraf=require(_0x4c1b('0x7'));var config=require(_0x4c1b('0x8'));var attributes=require(_0x4c1b('0x9'));module['exports']=function(_0x31a6f1,_0x2389ea){return _0x31a6f1['define']('SquareOdbc',attributes,{'tableName':_0x4c1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 1163566..c2ca526 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 _0x8d5e=['http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','include','map','model','attributes','debug','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a3509,_0x37ab8d){var _0x364c19=function(_0x201721){while(--_0x201721){_0x1a3509['push'](_0x1a3509['shift']());}};_0x364c19(++_0x37ab8d);}(_0x8d5e,0xfd));var _0xe8d5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8d5e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xe8d5('0x0'));var util=require(_0xe8d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8d5('0x2'));var logger=require(_0xe8d5('0x3'))(_0xe8d5('0x4'));var config=require(_0xe8d5('0x5'));var jayson=require(_0xe8d5('0x6'));var client=jayson[_0xe8d5('0x7')][_0xe8d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x315ff8,_0x2f5d2d,_0x545ffb){return new BPromise(function(_0x386a78,_0x2332b5){return client[_0xe8d5('0x9')](_0x315ff8,_0x545ffb)[_0xe8d5('0xa')](function(_0x4be548){logger[_0xe8d5('0xb')](_0xe8d5('0xc'),_0x2f5d2d,_0xe8d5('0xd'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x2f5d2d,_0xe8d5('0xd'),JSON[_0xe8d5('0xe')](_0x4be548));if(_0x4be548[_0xe8d5('0xf')]){if(_0x4be548[_0xe8d5('0xf')][_0xe8d5('0x10')]===0x1f4){logger[_0xe8d5('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x2f5d2d,_0x4be548['error'][_0xe8d5('0x11')]);return _0x2332b5(_0x4be548[_0xe8d5('0xf')]['message']);}logger['error'](_0xe8d5('0xc'),_0x2f5d2d,_0x4be548[_0xe8d5('0xf')][_0xe8d5('0x11')]);return _0x386a78(_0x4be548[_0xe8d5('0xf')][_0xe8d5('0x11')]);}else{logger[_0xe8d5('0xb')](_0xe8d5('0xc'),_0x2f5d2d,_0xe8d5('0xd'));_0x386a78(_0x4be548['result']['message']);}})[_0xe8d5('0x12')](function(_0x3613ce){logger[_0xe8d5('0xf')](_0xe8d5('0xc'),_0x2f5d2d,_0x3613ce);_0x2332b5(_0x3613ce);});});}exports[_0xe8d5('0x13')]=function(_0x1c59d9){var _0x3b55eb=this;return new Promise(function(_0x388943,_0x3c8540){return db[_0xe8d5('0x14')][_0xe8d5('0x15')]({'raw':_0x1c59d9[_0xe8d5('0x16')]?_0x1c59d9['options'][_0xe8d5('0x17')]===undefined?!![]:![]:!![],'where':_0x1c59d9[_0xe8d5('0x16')]?_0x1c59d9['options']['where']||null:null,'attributes':_0x1c59d9[_0xe8d5('0x16')]?_0x1c59d9['options']['attributes']||null:null,'include':_0x1c59d9[_0xe8d5('0x16')]?_0x1c59d9['options'][_0xe8d5('0x18')]?_['map'](_0x1c59d9[_0xe8d5('0x16')][_0xe8d5('0x18')],function(_0x2401f4){return{'model':db[_0x2401f4['model']],'as':_0x2401f4['as'],'attributes':_0x2401f4['attributes'],'include':_0x2401f4['include']?_[_0xe8d5('0x19')](_0x2401f4[_0xe8d5('0x18')],function(_0x3b9a84){return{'model':db[_0x3b9a84[_0xe8d5('0x1a')]],'as':_0x3b9a84['as'],'attributes':_0x3b9a84[_0xe8d5('0x1b')],'include':_0x3b9a84['include']?_[_0xe8d5('0x19')](_0x3b9a84[_0xe8d5('0x18')],function(_0x3f8c04){return{'model':db[_0x3f8c04[_0xe8d5('0x1a')]],'as':_0x3f8c04['as'],'attributes':_0x3f8c04[_0xe8d5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11b74d){logger[_0xe8d5('0xb')](_0xe8d5('0x13'),_0x1c59d9);logger[_0xe8d5('0x1c')](_0xe8d5('0x13'),_0x1c59d9,JSON[_0xe8d5('0xe')](_0x11b74d));_0x388943(_0x11b74d);})[_0xe8d5('0x12')](function(_0x29ac1e){logger['error']('ShowSquareOdbc',_0x29ac1e[_0xe8d5('0x11')],_0x1c59d9);_0x3c8540(_0x3b55eb[_0xe8d5('0xf')](0x1f4,_0x29ac1e[_0xe8d5('0x11')]));});});}; \ No newline at end of file +var _0x72d4=['request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareOdbc','SquareOdbc','find','options','where','include','map','model','attributes','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5c29b3,_0x47b390){var _0x71e471=function(_0x1f2e8b){while(--_0x1f2e8b){_0x5c29b3['push'](_0x5c29b3['shift']());}};_0x71e471(++_0x47b390);}(_0x72d4,0x76));var _0x472d=function(_0x3cd764,_0x21c54b){_0x3cd764=_0x3cd764-0x0;var _0x3bb668=_0x72d4[_0x3cd764];return _0x3bb668;};'use strict';var _=require(_0x472d('0x0'));var util=require(_0x472d('0x1'));var moment=require(_0x472d('0x2'));var BPromise=require('bluebird');var rs=require(_0x472d('0x3'));var fs=require('fs');var Redis=require(_0x472d('0x4'));var db=require(_0x472d('0x5'))['db'];var utils=require(_0x472d('0x6'));var logger=require(_0x472d('0x7'))(_0x472d('0x8'));var config=require('../../config/environment');var jayson=require(_0x472d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7ac942,_0x2cb0b1,_0x27a2c3){return new BPromise(function(_0x5ae6ed,_0x548f93){return client[_0x472d('0xa')](_0x7ac942,_0x27a2c3)[_0x472d('0xb')](function(_0x375803){logger[_0x472d('0xc')](_0x472d('0xd'),_0x2cb0b1,_0x472d('0xe'));logger[_0x472d('0xf')](_0x472d('0x10'),_0x2cb0b1,'request\x20sent',JSON[_0x472d('0x11')](_0x375803));if(_0x375803[_0x472d('0x12')]){if(_0x375803[_0x472d('0x12')][_0x472d('0x13')]===0x1f4){logger[_0x472d('0x12')](_0x472d('0xd'),_0x2cb0b1,_0x375803['error'][_0x472d('0x14')]);return _0x548f93(_0x375803[_0x472d('0x12')][_0x472d('0x14')]);}logger[_0x472d('0x12')](_0x472d('0xd'),_0x2cb0b1,_0x375803[_0x472d('0x12')][_0x472d('0x14')]);return _0x5ae6ed(_0x375803[_0x472d('0x12')][_0x472d('0x14')]);}else{logger[_0x472d('0xc')](_0x472d('0xd'),_0x2cb0b1,'request\x20sent');_0x5ae6ed(_0x375803[_0x472d('0x15')][_0x472d('0x14')]);}})['catch'](function(_0x157781){logger[_0x472d('0x12')](_0x472d('0xd'),_0x2cb0b1,_0x157781);_0x548f93(_0x157781);});});}exports[_0x472d('0x16')]=function(_0x3662b8){var _0x2fc4f6=this;return new Promise(function(_0x5d467e,_0x2a8c45){return db[_0x472d('0x17')][_0x472d('0x18')]({'raw':_0x3662b8[_0x472d('0x19')]?_0x3662b8[_0x472d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3662b8['options']?_0x3662b8[_0x472d('0x19')][_0x472d('0x1a')]||null:null,'attributes':_0x3662b8[_0x472d('0x19')]?_0x3662b8['options']['attributes']||null:null,'include':_0x3662b8[_0x472d('0x19')]?_0x3662b8[_0x472d('0x19')][_0x472d('0x1b')]?_[_0x472d('0x1c')](_0x3662b8[_0x472d('0x19')][_0x472d('0x1b')],function(_0x269270){return{'model':db[_0x269270[_0x472d('0x1d')]],'as':_0x269270['as'],'attributes':_0x269270[_0x472d('0x1e')],'include':_0x269270[_0x472d('0x1b')]?_[_0x472d('0x1c')](_0x269270[_0x472d('0x1b')],function(_0x181a1d){return{'model':db[_0x181a1d[_0x472d('0x1d')]],'as':_0x181a1d['as'],'attributes':_0x181a1d['attributes'],'include':_0x181a1d['include']?_[_0x472d('0x1c')](_0x181a1d[_0x472d('0x1b')],function(_0x14a5f3){return{'model':db[_0x14a5f3['model']],'as':_0x14a5f3['as'],'attributes':_0x14a5f3[_0x472d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x472d('0xb')](function(_0x25cce2){logger['info'](_0x472d('0x16'),_0x3662b8);logger[_0x472d('0xf')](_0x472d('0x16'),_0x3662b8,JSON[_0x472d('0x11')](_0x25cce2));_0x5d467e(_0x25cce2);})[_0x472d('0x1f')](function(_0x50cfb0){logger[_0x472d('0x12')](_0x472d('0x16'),_0x50cfb0['message'],_0x3662b8);_0x2a8c45(_0x2fc4f6[_0x472d('0x12')](0x1f4,_0x50cfb0[_0x472d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 79e0490..65e9a07 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 _0x1a21=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','post','create','addUsers','update','destroy','removeUsers','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x1a21,0x1d9));var _0x11a2=function(_0x363b81,_0x81e6ca){_0x363b81=_0x363b81-0x0;var _0x1d92fb=_0x1a21[_0x363b81];return _0x1d92fb;};'use strict';var multer=require(_0x11a2('0x0'));var util=require(_0x11a2('0x1'));var path=require(_0x11a2('0x2'));var timeout=require(_0x11a2('0x3'));var express=require(_0x11a2('0x4'));var router=express[_0x11a2('0x5')]();var fs_extra=require(_0x11a2('0x6'));var auth=require(_0x11a2('0x7'));var interaction=require(_0x11a2('0x8'));var config=require(_0x11a2('0x9'));var controller=require(_0x11a2('0xa'));router['get']('/',auth[_0x11a2('0xb')](),controller[_0x11a2('0xc')]);router[_0x11a2('0xd')](_0x11a2('0xe'),auth[_0x11a2('0xb')](),controller[_0x11a2('0xf')]);router['get'](_0x11a2('0x10'),auth[_0x11a2('0xb')](),controller[_0x11a2('0x11')]);router[_0x11a2('0x12')]('/',auth['isAuthenticated'](),controller[_0x11a2('0x13')]);router[_0x11a2('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x11a2('0x14')]);router['put'](_0x11a2('0xe'),auth[_0x11a2('0xb')](),controller[_0x11a2('0x15')]);router['delete'](_0x11a2('0xe'),auth[_0x11a2('0xb')](),controller[_0x11a2('0x16')]);router['delete']('/:id/users',auth[_0x11a2('0xb')](),controller[_0x11a2('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe896=['get','/:id/users','create','put','/:id','update','delete','removeUsers','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe896,0x15f));var _0x6e89=function(_0x25a04e,_0x435456){_0x25a04e=_0x25a04e-0x0;var _0x195480=_0xe896[_0x25a04e];return _0x195480;};'use strict';var multer=require(_0x6e89('0x0'));var util=require(_0x6e89('0x1'));var path=require(_0x6e89('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e89('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e89('0x4'));var interaction=require(_0x6e89('0x5'));var config=require(_0x6e89('0x6'));var controller=require('./squareProject.controller');router['get']('/',auth[_0x6e89('0x7')](),controller['index']);router['get']('/:id',auth[_0x6e89('0x7')](),controller[_0x6e89('0x8')]);router[_0x6e89('0x9')](_0x6e89('0xa'),auth[_0x6e89('0x7')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0x6e89('0xb')]);router['post']('/:id/users',auth[_0x6e89('0x7')](),controller['addUsers']);router[_0x6e89('0xc')](_0x6e89('0xd'),auth[_0x6e89('0x7')](),controller[_0x6e89('0xe')]);router[_0x6e89('0xf')](_0x6e89('0xd'),auth[_0x6e89('0x7')](),controller['destroy']);router[_0x6e89('0xf')](_0x6e89('0xa'),auth[_0x6e89('0x7')](),controller[_0x6e89('0x10')]);module[_0x6e89('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index fcf42fa..f24be83 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 _0x5fab=['toString','production','utf8','sequelize','exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction'];(function(_0x4957c4,_0x1e3896){var _0x4f6844=function(_0x212e90){while(--_0x212e90){_0x4957c4['push'](_0x4957c4['shift']());}};_0x4f6844(++_0x1e3896);}(_0x5fab,0x177));var _0xb5fa=function(_0xce1a87,_0x372c44){_0xce1a87=_0xce1a87-0x0;var _0x26669d=_0x5fab[_0xce1a87];return _0x26669d;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb5fa('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x3')]},'notes':{'type':Sequelize[_0xb5fa('0x4')]},'preproduction':{'type':Sequelize[_0xb5fa('0x5')](_0xb5fa('0x6')),'get':function(){if(this[_0xb5fa('0x7')](_0xb5fa('0x8'))){return this[_0xb5fa('0x7')](_0xb5fa('0x8'))[_0xb5fa('0x9')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xb5fa('0x6')),'get':function(){if(this[_0xb5fa('0x7')](_0xb5fa('0xa'))){return this['getDataValue'](_0xb5fa('0xa'))[_0xb5fa('0x9')](_0xb5fa('0xb'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xff22=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING'];(function(_0x1cb84c,_0x576b00){var _0x1ff4ed=function(_0x27e6b4){while(--_0x27e6b4){_0x1cb84c['push'](_0x1cb84c['shift']());}};_0x1ff4ed(++_0x576b00);}(_0xff22,0x135));var _0x2ff2=function(_0x1860f6,_0x4ac372){_0x1860f6=_0x1860f6-0x0;var _0x47ce74=_0xff22[_0x1860f6];return _0x47ce74;};'use strict';var Sequelize=require(_0x2ff2('0x0'));module[_0x2ff2('0x1')]={'name':{'type':Sequelize[_0x2ff2('0x2')],'unique':_0x2ff2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2ff2('0x2')]},'notes':{'type':Sequelize[_0x2ff2('0x4')]},'preproduction':{'type':Sequelize[_0x2ff2('0x5')](_0x2ff2('0x6')),'get':function(){if(this[_0x2ff2('0x7')](_0x2ff2('0x8'))){return this[_0x2ff2('0x7')](_0x2ff2('0x8'))[_0x2ff2('0x9')](_0x2ff2('0xa'));}}},'production':{'type':Sequelize[_0x2ff2('0x5')](_0x2ff2('0x6')),'get':function(){if(this[_0x2ff2('0x7')](_0x2ff2('0xb'))){return this[_0x2ff2('0x7')](_0x2ff2('0xb'))[_0x2ff2('0x9')](_0x2ff2('0xa'));}}},'savedAt':{'type':Sequelize[_0x2ff2('0xc')]},'publishedAt':{'type':Sequelize[_0x2ff2('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 40b4985..64e4c74 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 _0x2ef3=['include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','stringify','pick','production','addUsers','omit','removeUsers','ids','isArray','getUsers','findOne','User','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','count','limit','set','update','then','destroy','get','UserProfileResource','agi','error','stack','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','merge','where','VIRTUAL','name','filter','options','includeAll'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2ef3,0xba));var _0x32ef=function(_0x474f22,_0x27cf6b){_0x474f22=_0x474f22-0x0;var _0x14aecb=_0x2ef3[_0x474f22];return _0x14aecb;};'use strict';var _=require(_0x32ef('0x0'));var Redis=require(_0x32ef('0x1'));var qs=require(_0x32ef('0x2'));var logger=require(_0x32ef('0x3'))(_0x32ef('0x4'));var config=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x6')]=_[_0x32ef('0x7')](config['redis'],{'host':_0x32ef('0x8'),'port':0x18eb});var socket=require(_0x32ef('0x9'))(new Redis(config['redis']));require('./squareProject.socket')[_0x32ef('0xa')](socket);function respondWithStatusCode(_0x4bfcf8,_0x367c39){_0x367c39=_0x367c39||0xcc;return function(_0x2fb8eb){if(_0x2fb8eb){return _0x4bfcf8[_0x32ef('0xb')](_0x367c39);}return _0x4bfcf8[_0x32ef('0xc')](_0x367c39)[_0x32ef('0xd')]();};}function respondWithResult(_0x2bbb50,_0x28275c){_0x28275c=_0x28275c||0xc8;return function(_0x77df79){if(_0x77df79){return _0x2bbb50['status'](_0x28275c)['json'](_0x77df79);}};}function respondWithFilteredResult(_0x401d0b,_0x33281d){return function(_0x45bfd5){if(_0x45bfd5){var _0x1499c2=typeof _0x33281d['offset']===_0x32ef('0xe')&&typeof _0x33281d['limit']===_0x32ef('0xe');var _0x49d590=_0x45bfd5[_0x32ef('0xf')];var _0x1ef1ae=_0x1499c2?0x0:_0x33281d['offset'];var _0x539d18=_0x1499c2?_0x45bfd5[_0x32ef('0xf')]:_0x33281d['offset']+_0x33281d[_0x32ef('0x10')];var _0x40a6e6;if(_0x539d18>=_0x49d590){_0x539d18=_0x49d590;_0x40a6e6=0xc8;}else{_0x40a6e6=0xce;}_0x401d0b[_0x32ef('0xc')](_0x40a6e6);return _0x401d0b[_0x32ef('0x11')]('Content-Range',_0x1ef1ae+'-'+_0x539d18+'/'+_0x49d590)['json'](_0x45bfd5);}return null;};}function saveUpdates(_0x531e30){return function(_0x13db1a){if(_0x13db1a){return _0x13db1a[_0x32ef('0x12')](_0x531e30)[_0x32ef('0x13')](function(_0x53a5ca){return _0x53a5ca;});}return null;};}function removeEntity(_0x5d559b){return function(_0x1eb468){if(_0x1eb468){return _0x1eb468[_0x32ef('0x14')]()[_0x32ef('0x13')](function(){var _0x57863c=_0x1eb468[_0x32ef('0x15')]({'plain':!![]});var _0x33e230='SquareProjects';return db[_0x32ef('0x16')][_0x32ef('0x14')]({'where':{'type':_0x33e230,'resourceId':_0x57863c['id']}})[_0x32ef('0x13')](function(){return _0x1eb468;});})[_0x32ef('0x13')](function(){var _0x445cda=new Redis(config[_0x32ef('0x6')]);_0x445cda['publish'](_0x32ef('0x17'),JSON['stringify']({'id':_0x1eb468['id'],'deleted':!![]}));})[_0x32ef('0x13')](function(){_0x5d559b[_0x32ef('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af371){return function(_0x97780){if(!_0x97780){_0x1af371[_0x32ef('0xb')](0x194);}return _0x97780;};}function handleError(_0x55f7f2,_0x57f5e5){_0x57f5e5=_0x57f5e5||0x1f4;return function(_0x22f2d7){logger[_0x32ef('0x18')](_0x22f2d7[_0x32ef('0x19')]);if(_0x22f2d7['name']){delete _0x22f2d7['name'];}_0x55f7f2[_0x32ef('0xc')](_0x57f5e5)['send'](_0x22f2d7);};}exports['index']=function(_0x278495,_0x14d4b3){var _0x371540={},_0x1dbe98={},_0x15ce54={'count':0x0,'rows':[]};var _0x234175=_[_0x32ef('0x1a')](db[_0x32ef('0x1b')][_0x32ef('0x1c')],function(_0x2f52d7){return{'name':_0x2f52d7[_0x32ef('0x1d')],'type':_0x2f52d7[_0x32ef('0x1e')]['key']};});_0x1dbe98[_0x32ef('0x1f')]=_[_0x32ef('0x1a')](_0x234175,'name');_0x1dbe98[_0x32ef('0x20')]=_[_0x32ef('0x21')](_0x278495[_0x32ef('0x20')]);_0x1dbe98[_0x32ef('0x22')]=_['intersection'](_0x1dbe98[_0x32ef('0x1f')],_0x1dbe98[_0x32ef('0x20')]);_0x371540[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0x1dbe98[_0x32ef('0x1f')],qs[_0x32ef('0x25')](_0x278495[_0x32ef('0x20')]['fields']));_0x371540[_0x32ef('0x23')]=_0x371540['attributes'][_0x32ef('0x26')]?_0x371540[_0x32ef('0x23')]:_0x1dbe98['model'];if(!_0x278495[_0x32ef('0x20')][_0x32ef('0x27')](_0x32ef('0x28'))){_0x371540[_0x32ef('0x10')]=qs[_0x32ef('0x10')](_0x278495['query']['limit']);_0x371540[_0x32ef('0x29')]=qs['offset'](_0x278495[_0x32ef('0x20')][_0x32ef('0x29')]);}_0x371540[_0x32ef('0x2a')]=qs[_0x32ef('0x2b')](_0x278495[_0x32ef('0x20')][_0x32ef('0x2b')]);_0x371540['where']=qs['filters'](_['pick'](_0x278495[_0x32ef('0x20')],_0x1dbe98[_0x32ef('0x22')]),_0x234175);if(_0x278495[_0x32ef('0x20')]['filter']){_0x371540['where']=_[_0x32ef('0x2c')](_0x371540[_0x32ef('0x2d')],{'$or':_[_0x32ef('0x1a')](_0x234175,function(_0x480348){if(_0x480348['type']!==_0x32ef('0x2e')){var _0x21706f={};_0x21706f[_0x480348[_0x32ef('0x2f')]]={'$like':'%'+_0x278495[_0x32ef('0x20')][_0x32ef('0x30')]+'%'};return _0x21706f;}})});}_0x371540=_[_0x32ef('0x2c')]({},_0x371540,_0x278495[_0x32ef('0x31')]);var _0x21da90={'where':_0x371540[_0x32ef('0x2d')]};return db['SquareProject'][_0x32ef('0xf')](_0x21da90)[_0x32ef('0x13')](function(_0x14b54f){_0x15ce54['count']=_0x14b54f;if(_0x278495[_0x32ef('0x20')][_0x32ef('0x32')]){_0x371540[_0x32ef('0x33')]=[{'all':!![]}];}return db[_0x32ef('0x1b')][_0x32ef('0x34')](_0x371540);})[_0x32ef('0x13')](function(_0x256c40){_0x15ce54[_0x32ef('0x35')]=_0x256c40;return _0x15ce54;})[_0x32ef('0x13')](respondWithFilteredResult(_0x14d4b3,_0x371540))[_0x32ef('0x36')](handleError(_0x14d4b3,null));};exports[_0x32ef('0x37')]=function(_0x4615b4,_0x48e071){var _0x3cac2e={'raw':![],'where':{'id':_0x4615b4[_0x32ef('0x38')]['id']}},_0xc3a6d3={};_0xc3a6d3[_0x32ef('0x1f')]=_[_0x32ef('0x21')](db[_0x32ef('0x1b')][_0x32ef('0x1c')]);_0xc3a6d3['query']=_['keys'](_0x4615b4[_0x32ef('0x20')]);_0xc3a6d3[_0x32ef('0x22')]=_[_0x32ef('0x24')](_0xc3a6d3[_0x32ef('0x1f')],_0xc3a6d3['query']);_0x3cac2e[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0xc3a6d3['model'],qs[_0x32ef('0x25')](_0x4615b4['query'][_0x32ef('0x25')]));_0x3cac2e[_0x32ef('0x23')]=_0x3cac2e[_0x32ef('0x23')][_0x32ef('0x26')]?_0x3cac2e[_0x32ef('0x23')]:_0xc3a6d3[_0x32ef('0x1f')];if(_0x4615b4[_0x32ef('0x20')][_0x32ef('0x32')]){_0x3cac2e[_0x32ef('0x33')]=[{'all':!![]}];}_0x3cac2e=_[_0x32ef('0x2c')]({},_0x3cac2e,_0x4615b4['options']);return db[_0x32ef('0x1b')]['find'](_0x3cac2e)[_0x32ef('0x13')](handleEntityNotFound(_0x48e071,null))[_0x32ef('0x13')](respondWithResult(_0x48e071,null))[_0x32ef('0x36')](handleError(_0x48e071,null));};exports['create']=function(_0x502113,_0x230ac9){return db[_0x32ef('0x1b')][_0x32ef('0x39')](_0x502113[_0x32ef('0x3a')],{})[_0x32ef('0x13')](function(_0x12c9e6){var _0x47dbe1=_0x502113['user'][_0x32ef('0x15')]({'plain':!![]});if(!_0x47dbe1)throw new Error(_0x32ef('0x3b'));if(_0x47dbe1[_0x32ef('0x3c')]===_0x32ef('0x3d')){var _0x209361=_0x12c9e6[_0x32ef('0x15')]({'plain':!![]});var _0x44ad11=_0x32ef('0x3e');return db[_0x32ef('0x3f')][_0x32ef('0x40')]({'where':{'name':_0x44ad11,'userProfileId':_0x47dbe1[_0x32ef('0x41')]},'raw':!![]})[_0x32ef('0x13')](function(_0x36a65c){if(_0x36a65c&&_0x36a65c['autoAssociation']===0x0){return db[_0x32ef('0x16')][_0x32ef('0x39')]({'name':_0x209361[_0x32ef('0x2f')],'resourceId':_0x209361['id'],'type':_0x36a65c[_0x32ef('0x2f')],'sectionId':_0x36a65c['id']},{})[_0x32ef('0x13')](function(){return _0x12c9e6;});}else{return _0x12c9e6;}})[_0x32ef('0x36')](function(_0x278696){logger[_0x32ef('0x18')](_0x32ef('0x42'),_0x278696);throw _0x278696;});}return _0x12c9e6;})[_0x32ef('0x13')](respondWithResult(_0x230ac9,0xc9))[_0x32ef('0x36')](handleError(_0x230ac9,null));};exports[_0x32ef('0x12')]=function(_0x272377,_0x326445){if(_0x272377[_0x32ef('0x3a')]['id']){delete _0x272377[_0x32ef('0x3a')]['id'];}return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x272377['params']['id']}})['then'](handleEntityNotFound(_0x326445,null))[_0x32ef('0x13')](saveUpdates(_0x272377[_0x32ef('0x3a')],null))[_0x32ef('0x13')](function(_0x166405){if(!_0x166405)return;var _0x34bd3e=_0x166405[_0x32ef('0x15')]({'plain':!![]});return _0x34bd3e;})[_0x32ef('0x13')](function(_0x1f105a){var _0x15b640=new Redis(config[_0x32ef('0x6')]);_0x15b640[_0x32ef('0x43')]('agi',JSON[_0x32ef('0x44')](_[_0x32ef('0x45')](_0x1f105a,['id',_0x32ef('0x2f'),_0x32ef('0x46')])));return _0x1f105a;})[_0x32ef('0x13')](respondWithResult(_0x326445,null))[_0x32ef('0x36')](handleError(_0x326445,null));};exports['destroy']=function(_0x44a4e9,_0x1eeb3e){return db[_0x32ef('0x1b')]['find']({'where':{'id':_0x44a4e9[_0x32ef('0x38')]['id']}})['then'](handleEntityNotFound(_0x1eeb3e,null))[_0x32ef('0x13')](removeEntity(_0x1eeb3e,null))[_0x32ef('0x36')](handleError(_0x1eeb3e,null));};exports['addUsers']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x206ad5[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x13')](function(_0x30e377){if(_0x30e377){return _0x30e377[_0x32ef('0x47')](_0x206ad5['body']['ids'],_[_0x32ef('0x48')](_0x206ad5['body'],['ids','id'])||{});}})[_0x32ef('0x13')](respondWithResult(_0x59e5f9,null))[_0x32ef('0x36')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x49')]=function(_0x6aae59,_0x2468e6){return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x6aae59[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x2468e6,null))[_0x32ef('0x13')](function(_0x4c125c){if(_0x4c125c){return _0x4c125c['removeUsers'](_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')])['then'](function(){if(_[_0x32ef('0x4b')](_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')])){for(var _0x49c245=0x0;_0x49c245<_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')][_0x32ef('0x26')];_0x49c245+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x6aae59[_0x32ef('0x20')]['ids'][_0x49c245]),'SquareProjectId':Number(_0x6aae59[_0x32ef('0x38')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')]),'SquareProjectId':Number(_0x6aae59[_0x32ef('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2468e6,null))[_0x32ef('0x36')](handleError(_0x2468e6,null));};exports[_0x32ef('0x4c')]=function(_0x5f9da7,_0x58ecbb){var _0x4557ce={};var _0x12b7f8={};var _0x4c3bab;var _0x4a4eaa;return db[_0x32ef('0x1b')][_0x32ef('0x4d')]({'where':{'id':_0x5f9da7[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x58ecbb,null))[_0x32ef('0x13')](function(_0x40700e){if(_0x40700e){_0x4c3bab=_0x40700e;_0x12b7f8['model']=_[_0x32ef('0x21')](db[_0x32ef('0x4e')][_0x32ef('0x1c')]);_0x12b7f8[_0x32ef('0x20')]=_[_0x32ef('0x21')](_0x5f9da7[_0x32ef('0x20')]);_0x12b7f8[_0x32ef('0x22')]=_[_0x32ef('0x24')](_0x12b7f8[_0x32ef('0x1f')],_0x12b7f8['query']);_0x4557ce[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0x12b7f8[_0x32ef('0x1f')],qs[_0x32ef('0x25')](_0x5f9da7[_0x32ef('0x20')]['fields']));_0x4557ce['attributes']=_0x4557ce[_0x32ef('0x23')][_0x32ef('0x26')]?_0x4557ce[_0x32ef('0x23')]:_0x12b7f8[_0x32ef('0x1f')];_0x4557ce[_0x32ef('0x2a')]=qs['sort'](_0x5f9da7[_0x32ef('0x20')]['sort']);_0x4557ce[_0x32ef('0x2d')]=qs[_0x32ef('0x22')](_['pick'](_0x5f9da7['query'],_0x12b7f8[_0x32ef('0x22')]));if(_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x30')]){_0x4557ce['where']=_['merge'](_0x4557ce[_0x32ef('0x2d')],{'$or':_[_0x32ef('0x1a')](_0x4557ce[_0x32ef('0x23')],function(_0x416e62){var _0x4f4006={};_0x4f4006[_0x416e62]={'$like':'%'+_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x30')]+'%'};return _0x4f4006;})});}_0x4557ce=_[_0x32ef('0x2c')]({},_0x4557ce,_0x5f9da7[_0x32ef('0x31')]);return _0x4c3bab[_0x32ef('0x4c')](_0x4557ce);}})[_0x32ef('0x13')](function(_0x43b176){if(_0x43b176){_0x4a4eaa=_0x43b176[_0x32ef('0x26')];if(!_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x27')](_0x32ef('0x28'))){_0x4557ce[_0x32ef('0x10')]=qs['limit'](_0x5f9da7['query'][_0x32ef('0x10')]);_0x4557ce[_0x32ef('0x29')]=qs['offset'](_0x5f9da7[_0x32ef('0x20')]['offset']);}return _0x4c3bab[_0x32ef('0x4c')](_0x4557ce);}})[_0x32ef('0x13')](function(_0x323758){if(_0x323758){return _0x323758?{'count':_0x4a4eaa,'rows':_0x323758}:null;}})['then'](respondWithResult(_0x58ecbb,null))[_0x32ef('0x36')](handleError(_0x58ecbb,null));}; \ No newline at end of file +var _0x7096=['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','production','addUsers','omit','removeUsers','isArray','ids','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','end','status','json','offset','undefined','limit','count','set','update','destroy','get','UserProfileResource','then','publish','agi','stringify','sendStatus','error','stack','name','send','index','map','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','SquareProject','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x197af7,_0x346019){var _0x3b1979=function(_0x1ab1c3){while(--_0x1ab1c3){_0x197af7['push'](_0x197af7['shift']());}};_0x3b1979(++_0x346019);}(_0x7096,0x10c));var _0x6709=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7096[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var Redis=require(_0x6709('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x6709('0x1'))('api');var config=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];config[_0x6709('0x4')]=_[_0x6709('0x5')](config[_0x6709('0x4')],{'host':_0x6709('0x6'),'port':0x18eb});var socket=require(_0x6709('0x7'))(new Redis(config[_0x6709('0x4')]));require(_0x6709('0x8'))[_0x6709('0x9')](socket);function respondWithStatusCode(_0x11ad23,_0x985814){_0x985814=_0x985814||0xcc;return function(_0x30147f){if(_0x30147f){return _0x11ad23['sendStatus'](_0x985814);}return _0x11ad23['status'](_0x985814)[_0x6709('0xa')]();};}function respondWithResult(_0x2d8c0b,_0xbcb47){_0xbcb47=_0xbcb47||0xc8;return function(_0x1aa476){if(_0x1aa476){return _0x2d8c0b[_0x6709('0xb')](_0xbcb47)[_0x6709('0xc')](_0x1aa476);}};}function respondWithFilteredResult(_0x5de1fa,_0x5b9f26){return function(_0x329aa9){if(_0x329aa9){var _0x262261=typeof _0x5b9f26[_0x6709('0xd')]===_0x6709('0xe')&&typeof _0x5b9f26[_0x6709('0xf')]===_0x6709('0xe');var _0x1d56a5=_0x329aa9[_0x6709('0x10')];var _0x5a8ebb=_0x262261?0x0:_0x5b9f26[_0x6709('0xd')];var _0xf59b6e=_0x262261?_0x329aa9[_0x6709('0x10')]:_0x5b9f26[_0x6709('0xd')]+_0x5b9f26['limit'];var _0xc728aa;if(_0xf59b6e>=_0x1d56a5){_0xf59b6e=_0x1d56a5;_0xc728aa=0xc8;}else{_0xc728aa=0xce;}_0x5de1fa['status'](_0xc728aa);return _0x5de1fa[_0x6709('0x11')]('Content-Range',_0x5a8ebb+'-'+_0xf59b6e+'/'+_0x1d56a5)[_0x6709('0xc')](_0x329aa9);}return null;};}function saveUpdates(_0x28866a){return function(_0x95c0c2){if(_0x95c0c2){return _0x95c0c2[_0x6709('0x12')](_0x28866a)['then'](function(_0x52e342){return _0x52e342;});}return null;};}function removeEntity(_0x5c4f94){return function(_0x3fa5b1){if(_0x3fa5b1){return _0x3fa5b1[_0x6709('0x13')]()['then'](function(){var _0x9c1fd8=_0x3fa5b1[_0x6709('0x14')]({'plain':!![]});var _0xf1a70d='SquareProjects';return db[_0x6709('0x15')][_0x6709('0x13')]({'where':{'type':_0xf1a70d,'resourceId':_0x9c1fd8['id']}})[_0x6709('0x16')](function(){return _0x3fa5b1;});})[_0x6709('0x16')](function(){var _0x5485d7=new Redis(config[_0x6709('0x4')]);_0x5485d7[_0x6709('0x17')](_0x6709('0x18'),JSON[_0x6709('0x19')]({'id':_0x3fa5b1['id'],'deleted':!![]}));})[_0x6709('0x16')](function(){_0x5c4f94[_0x6709('0xb')](0xcc)[_0x6709('0xa')]();});}};}function handleEntityNotFound(_0x17763d){return function(_0x386224){if(!_0x386224){_0x17763d[_0x6709('0x1a')](0x194);}return _0x386224;};}function handleError(_0x2f3415,_0xa36371){_0xa36371=_0xa36371||0x1f4;return function(_0x5cf48b){logger[_0x6709('0x1b')](_0x5cf48b[_0x6709('0x1c')]);if(_0x5cf48b[_0x6709('0x1d')]){delete _0x5cf48b['name'];}_0x2f3415[_0x6709('0xb')](_0xa36371)[_0x6709('0x1e')](_0x5cf48b);};}exports[_0x6709('0x1f')]=function(_0x44b465,_0x588e00){var _0x241428={},_0x3076fe={},_0x50f7d6={'count':0x0,'rows':[]};var _0x585073=_[_0x6709('0x20')](db['SquareProject'][_0x6709('0x21')],function(_0x2499a2){return{'name':_0x2499a2['fieldName'],'type':_0x2499a2[_0x6709('0x22')]['key']};});_0x3076fe[_0x6709('0x23')]=_[_0x6709('0x20')](_0x585073,'name');_0x3076fe[_0x6709('0x24')]=_['keys'](_0x44b465[_0x6709('0x24')]);_0x3076fe[_0x6709('0x25')]=_['intersection'](_0x3076fe[_0x6709('0x23')],_0x3076fe['query']);_0x241428[_0x6709('0x26')]=_[_0x6709('0x27')](_0x3076fe['model'],qs['fields'](_0x44b465[_0x6709('0x24')][_0x6709('0x28')]));_0x241428[_0x6709('0x26')]=_0x241428[_0x6709('0x26')][_0x6709('0x29')]?_0x241428[_0x6709('0x26')]:_0x3076fe[_0x6709('0x23')];if(!_0x44b465[_0x6709('0x24')][_0x6709('0x2a')]('nolimit')){_0x241428[_0x6709('0xf')]=qs[_0x6709('0xf')](_0x44b465[_0x6709('0x24')][_0x6709('0xf')]);_0x241428['offset']=qs[_0x6709('0xd')](_0x44b465[_0x6709('0x24')][_0x6709('0xd')]);}_0x241428[_0x6709('0x2b')]=qs['sort'](_0x44b465[_0x6709('0x24')][_0x6709('0x2c')]);_0x241428['where']=qs[_0x6709('0x25')](_[_0x6709('0x2d')](_0x44b465['query'],_0x3076fe[_0x6709('0x25')]),_0x585073);if(_0x44b465[_0x6709('0x24')][_0x6709('0x2e')]){_0x241428[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x241428[_0x6709('0x2f')],{'$or':_[_0x6709('0x20')](_0x585073,function(_0x4bfed4){if(_0x4bfed4[_0x6709('0x22')]!==_0x6709('0x31')){var _0x4fad54={};_0x4fad54[_0x4bfed4[_0x6709('0x1d')]]={'$like':'%'+_0x44b465[_0x6709('0x24')][_0x6709('0x2e')]+'%'};return _0x4fad54;}})});}_0x241428=_[_0x6709('0x30')]({},_0x241428,_0x44b465[_0x6709('0x32')]);var _0x1c12bb={'where':_0x241428['where']};return db[_0x6709('0x33')]['count'](_0x1c12bb)[_0x6709('0x16')](function(_0xbb7a64){_0x50f7d6[_0x6709('0x10')]=_0xbb7a64;if(_0x44b465['query'][_0x6709('0x34')]){_0x241428[_0x6709('0x35')]=[{'all':!![]}];}return db[_0x6709('0x33')][_0x6709('0x36')](_0x241428);})[_0x6709('0x16')](function(_0x1030ee){_0x50f7d6[_0x6709('0x37')]=_0x1030ee;return _0x50f7d6;})['then'](respondWithFilteredResult(_0x588e00,_0x241428))[_0x6709('0x38')](handleError(_0x588e00,null));};exports[_0x6709('0x39')]=function(_0x50fbcd,_0x31d2a6){var _0xe80008={'raw':![],'where':{'id':_0x50fbcd[_0x6709('0x3a')]['id']}},_0x15b18f={};_0x15b18f['model']=_['keys'](db[_0x6709('0x33')][_0x6709('0x21')]);_0x15b18f[_0x6709('0x24')]=_[_0x6709('0x3b')](_0x50fbcd['query']);_0x15b18f['filters']=_['intersection'](_0x15b18f[_0x6709('0x23')],_0x15b18f[_0x6709('0x24')]);_0xe80008['attributes']=_[_0x6709('0x27')](_0x15b18f[_0x6709('0x23')],qs['fields'](_0x50fbcd['query'][_0x6709('0x28')]));_0xe80008[_0x6709('0x26')]=_0xe80008[_0x6709('0x26')][_0x6709('0x29')]?_0xe80008[_0x6709('0x26')]:_0x15b18f['model'];if(_0x50fbcd[_0x6709('0x24')]['includeAll']){_0xe80008[_0x6709('0x35')]=[{'all':!![]}];}_0xe80008=_[_0x6709('0x30')]({},_0xe80008,_0x50fbcd[_0x6709('0x32')]);return db['SquareProject'][_0x6709('0x3c')](_0xe80008)['then'](handleEntityNotFound(_0x31d2a6,null))['then'](respondWithResult(_0x31d2a6,null))[_0x6709('0x38')](handleError(_0x31d2a6,null));};exports[_0x6709('0x3d')]=function(_0x14fcb6,_0x7e38b9){return db[_0x6709('0x33')][_0x6709('0x3d')](_0x14fcb6[_0x6709('0x3e')],{})[_0x6709('0x16')](function(_0x123793){var _0xe999aa=_0x14fcb6[_0x6709('0x3f')][_0x6709('0x14')]({'plain':!![]});if(!_0xe999aa)throw new Error(_0x6709('0x40'));if(_0xe999aa[_0x6709('0x41')]===_0x6709('0x3f')){var _0x4f82a0=_0x123793[_0x6709('0x14')]({'plain':!![]});var _0x4d841a='SquareProjects';return db[_0x6709('0x42')][_0x6709('0x3c')]({'where':{'name':_0x4d841a,'userProfileId':_0xe999aa[_0x6709('0x43')]},'raw':!![]})[_0x6709('0x16')](function(_0x22363b){if(_0x22363b&&_0x22363b[_0x6709('0x44')]===0x0){return db[_0x6709('0x15')][_0x6709('0x3d')]({'name':_0x4f82a0['name'],'resourceId':_0x4f82a0['id'],'type':_0x22363b[_0x6709('0x1d')],'sectionId':_0x22363b['id']},{})[_0x6709('0x16')](function(){return _0x123793;});}else{return _0x123793;}})[_0x6709('0x38')](function(_0x214fbb){logger['error'](_0x6709('0x45'),_0x214fbb);throw _0x214fbb;});}return _0x123793;})['then'](respondWithResult(_0x7e38b9,0xc9))[_0x6709('0x38')](handleError(_0x7e38b9,null));};exports[_0x6709('0x12')]=function(_0x2a563b,_0xb257b5){if(_0x2a563b[_0x6709('0x3e')]['id']){delete _0x2a563b['body']['id'];}return db[_0x6709('0x33')][_0x6709('0x3c')]({'where':{'id':_0x2a563b[_0x6709('0x3a')]['id']}})[_0x6709('0x16')](handleEntityNotFound(_0xb257b5,null))[_0x6709('0x16')](saveUpdates(_0x2a563b['body'],null))['then'](function(_0x447aa5){if(!_0x447aa5)return;var _0x4b5eca=_0x447aa5['get']({'plain':!![]});return _0x4b5eca;})[_0x6709('0x16')](function(_0x437910){var _0x1bf824=new Redis(config[_0x6709('0x4')]);_0x1bf824[_0x6709('0x17')](_0x6709('0x18'),JSON[_0x6709('0x19')](_[_0x6709('0x2d')](_0x437910,['id',_0x6709('0x1d'),_0x6709('0x46')])));return _0x437910;})[_0x6709('0x16')](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x13')]=function(_0x8c2616,_0x5ea29f){return db['SquareProject'][_0x6709('0x3c')]({'where':{'id':_0x8c2616[_0x6709('0x3a')]['id']}})[_0x6709('0x16')](handleEntityNotFound(_0x5ea29f,null))[_0x6709('0x16')](removeEntity(_0x5ea29f,null))['catch'](handleError(_0x5ea29f,null));};exports[_0x6709('0x47')]=function(_0x492bca,_0x1f838d){return db[_0x6709('0x33')][_0x6709('0x3c')]({'where':{'id':_0x492bca[_0x6709('0x3a')]['id']}})[_0x6709('0x16')](handleEntityNotFound(_0x1f838d,null))['then'](function(_0x49d3c6){if(_0x49d3c6){return _0x49d3c6[_0x6709('0x47')](_0x492bca[_0x6709('0x3e')]['ids'],_[_0x6709('0x48')](_0x492bca[_0x6709('0x3e')],['ids','id'])||{});}})[_0x6709('0x16')](respondWithResult(_0x1f838d,null))[_0x6709('0x38')](handleError(_0x1f838d,null));};exports[_0x6709('0x49')]=function(_0x24c451,_0x4f596e){return db['SquareProject'][_0x6709('0x3c')]({'where':{'id':_0x24c451['params']['id']}})[_0x6709('0x16')](handleEntityNotFound(_0x4f596e,null))[_0x6709('0x16')](function(_0x3c3df7){if(_0x3c3df7){return _0x3c3df7['removeUsers'](_0x24c451[_0x6709('0x24')]['ids'])['then'](function(){if(_[_0x6709('0x4a')](_0x24c451['query'][_0x6709('0x4b')])){for(var _0x5cf7c0=0x0;_0x5cf7c0<_0x24c451[_0x6709('0x24')][_0x6709('0x4b')][_0x6709('0x29')];_0x5cf7c0+=0x1){socket[_0x6709('0x4c')]('userSquareProject:remove',{'UserId':Number(_0x24c451[_0x6709('0x24')][_0x6709('0x4b')][_0x5cf7c0]),'SquareProjectId':Number(_0x24c451[_0x6709('0x3a')]['id'])});}}else{socket[_0x6709('0x4c')](_0x6709('0x4d'),{'UserId':Number(_0x24c451[_0x6709('0x24')][_0x6709('0x4b')]),'SquareProjectId':Number(_0x24c451['params']['id'])});}});}})[_0x6709('0x16')](respondWithStatusCode(_0x4f596e,null))[_0x6709('0x38')](handleError(_0x4f596e,null));};exports[_0x6709('0x4e')]=function(_0x145508,_0x3f4dae){var _0x304268={};var _0xea95f6={};var _0x250bcd;var _0x36b514;return db['SquareProject'][_0x6709('0x4f')]({'where':{'id':_0x145508[_0x6709('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3f4dae,null))[_0x6709('0x16')](function(_0x18b4fa){if(_0x18b4fa){_0x250bcd=_0x18b4fa;_0xea95f6[_0x6709('0x23')]=_[_0x6709('0x3b')](db[_0x6709('0x50')][_0x6709('0x21')]);_0xea95f6[_0x6709('0x24')]=_[_0x6709('0x3b')](_0x145508[_0x6709('0x24')]);_0xea95f6['filters']=_[_0x6709('0x27')](_0xea95f6[_0x6709('0x23')],_0xea95f6[_0x6709('0x24')]);_0x304268[_0x6709('0x26')]=_[_0x6709('0x27')](_0xea95f6[_0x6709('0x23')],qs[_0x6709('0x28')](_0x145508[_0x6709('0x24')][_0x6709('0x28')]));_0x304268[_0x6709('0x26')]=_0x304268[_0x6709('0x26')]['length']?_0x304268[_0x6709('0x26')]:_0xea95f6['model'];_0x304268['order']=qs[_0x6709('0x2c')](_0x145508[_0x6709('0x24')][_0x6709('0x2c')]);_0x304268[_0x6709('0x2f')]=qs[_0x6709('0x25')](_[_0x6709('0x2d')](_0x145508[_0x6709('0x24')],_0xea95f6['filters']));if(_0x145508['query'][_0x6709('0x2e')]){_0x304268['where']=_[_0x6709('0x30')](_0x304268['where'],{'$or':_[_0x6709('0x20')](_0x304268[_0x6709('0x26')],function(_0x59d3d1){var _0x5c4277={};_0x5c4277[_0x59d3d1]={'$like':'%'+_0x145508['query'][_0x6709('0x2e')]+'%'};return _0x5c4277;})});}_0x304268=_[_0x6709('0x30')]({},_0x304268,_0x145508[_0x6709('0x32')]);return _0x250bcd[_0x6709('0x4e')](_0x304268);}})[_0x6709('0x16')](function(_0x193d67){if(_0x193d67){_0x36b514=_0x193d67[_0x6709('0x29')];if(!_0x145508[_0x6709('0x24')][_0x6709('0x2a')](_0x6709('0x51'))){_0x304268[_0x6709('0xf')]=qs[_0x6709('0xf')](_0x145508[_0x6709('0x24')]['limit']);_0x304268[_0x6709('0xd')]=qs[_0x6709('0xd')](_0x145508[_0x6709('0x24')][_0x6709('0xd')]);}return _0x250bcd['getUsers'](_0x304268);}})['then'](function(_0x18fe97){if(_0x18fe97){return _0x18fe97?{'count':_0x36b514,'rows':_0x18fe97}:null;}})['then'](respondWithResult(_0x3f4dae,null))['catch'](handleError(_0x3f4dae,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 8509951..da97cb8 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 _0xae67=['setMaxListeners','save','update','emit','hook','exports','events','SquareProject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae67,0xae));var _0x7ae6=function(_0x4b3904,_0x257ae3){_0x4b3904=_0x4b3904-0x0;var _0x475f19=_0xae67[_0x4b3904];return _0x475f19;};'use strict';var EventEmitter=require(_0x7ae6('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x7ae6('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7ae6('0x2')](0x0);var events={'afterCreate':_0x7ae6('0x3'),'afterUpdate':_0x7ae6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x206da7){return function(_0x425883,_0x408ed1,_0x388c74){SquareProjectEvents[_0x7ae6('0x5')](_0x206da7+':'+_0x425883['id'],_0x425883);SquareProjectEvents['emit'](_0x206da7,_0x425883);_0x388c74(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x7ae6('0x6')](e,emitEvent(event));}}module[_0x7ae6('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xc47d=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x417574,_0x1b434e){var _0x55c056=function(_0x350283){while(--_0x350283){_0x417574['push'](_0x417574['shift']());}};_0x55c056(++_0x1b434e);}(_0xc47d,0x100));var _0xdc47=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xc47d[_0x21aec3];return _0x288bbc;};'use strict';var EventEmitter=require(_0xdc47('0x0'));var SquareProject=require(_0xdc47('0x1'))['db'][_0xdc47('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xdc47('0x3')](0x0);var events={'afterCreate':_0xdc47('0x4'),'afterUpdate':_0xdc47('0x5'),'afterDestroy':_0xdc47('0x6')};function emitEvent(_0x44e6cf){return function(_0x38abca,_0x177f18,_0xbfcdd7){SquareProjectEvents[_0xdc47('0x7')](_0x44e6cf+':'+_0x38abca['id'],_0x38abca);SquareProjectEvents[_0xdc47('0x7')](_0x44e6cf,_0x38abca);_0xbfcdd7(null);};}for(var e in events){if(events[_0xdc47('0x8')](e)){var event=events[e];SquareProject[_0xdc47('0x9')](e,emitEvent(event));}}module[_0xdc47('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index f31cc5e..0344c65 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 _0xbda2=['path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x496c69,_0x10d8fa){var _0x4814fc=function(_0x2c5642){while(--_0x2c5642){_0x496c69['push'](_0x496c69['shift']());}};_0x4814fc(++_0x10d8fa);}(_0xbda2,0x111));var _0x2bda=function(_0x1bbd2e,_0x378a2f){_0x1bbd2e=_0x1bbd2e-0x0;var _0x306824=_0xbda2[_0x1bbd2e];return _0x306824;};'use strict';var _=require(_0x2bda('0x0'));var util=require(_0x2bda('0x1'));var logger=require(_0x2bda('0x2'))(_0x2bda('0x3'));var moment=require(_0x2bda('0x4'));var BPromise=require(_0x2bda('0x5'));var rp=require(_0x2bda('0x6'));var fs=require('fs');var path=require(_0x2bda('0x7'));var rimraf=require(_0x2bda('0x8'));var config=require(_0x2bda('0x9'));var attributes=require(_0x2bda('0xa'));module[_0x2bda('0xb')]=function(_0x228573,_0x424620){return _0x228573[_0x2bda('0xc')](_0x2bda('0xd'),attributes,{'tableName':_0x2bda('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x543173,_0x5f5dd7,_0x145298){if(_0x543173[_0x2bda('0xf')](_0x2bda('0x10'))){_0x543173['savedAt']=moment()[_0x2bda('0x11')](_0x2bda('0x12'));}if(_0x543173['changed']('production')){_0x543173[_0x2bda('0x13')]=moment()['format'](_0x2bda('0x12'));}_0x145298(null,_0x543173);}}});}; \ No newline at end of file +var _0xcf98=['format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','define','SquareProject','square_projects','changed'];(function(_0x34b5ca,_0x594010){var _0x2d72c0=function(_0x4ae1d3){while(--_0x4ae1d3){_0x34b5ca['push'](_0x34b5ca['shift']());}};_0x2d72c0(++_0x594010);}(_0xcf98,0x1c5));var _0x8cf9=function(_0x7a31b0,_0x3fcc7f){_0x7a31b0=_0x7a31b0-0x0;var _0x2fde01=_0xcf98[_0x7a31b0];return _0x2fde01;};'use strict';var _=require(_0x8cf9('0x0'));var util=require(_0x8cf9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cf9('0x2'));var BPromise=require(_0x8cf9('0x3'));var rp=require(_0x8cf9('0x4'));var fs=require('fs');var path=require(_0x8cf9('0x5'));var rimraf=require(_0x8cf9('0x6'));var config=require('../../config/environment');var attributes=require(_0x8cf9('0x7'));module['exports']=function(_0x473e76,_0x54b0d5){return _0x473e76[_0x8cf9('0x8')](_0x8cf9('0x9'),attributes,{'tableName':_0x8cf9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b44c3,_0x5a168a,_0x57f8f7){if(_0x3b44c3[_0x8cf9('0xb')]('preproduction')){_0x3b44c3['savedAt']=moment()[_0x8cf9('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3b44c3[_0x8cf9('0xb')](_0x8cf9('0xd'))){_0x3b44c3['publishedAt']=moment()[_0x8cf9('0xc')](_0x8cf9('0xe'));}_0x57f8f7(null,_0x3b44c3);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 9d3d788..2b3537d 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 _0xe367=['ioredis','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','attributes','limit','map','include','model','then','info','debug','catch','message','error','find','where','ShowSquareProject','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe367,0x1bf));var _0x7e36=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe367[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x7e36('0x0'));var Redis=require(_0x7e36('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x7e36('0x2'));var config=require(_0x7e36('0x3'));config[_0x7e36('0x4')]=_[_0x7e36('0x5')](config[_0x7e36('0x4')],{'host':_0x7e36('0x6'),'port':0x18eb});var socket=require(_0x7e36('0x7'))(new Redis(config['redis']));require(_0x7e36('0x8'))[_0x7e36('0x9')](socket);exports[_0x7e36('0xa')]=function(_0x27464b){var _0x3ca86d=this;return new Promise(function(_0x11c077,_0x457692){return db[_0x7e36('0xb')]['findAll']({'raw':_0x27464b[_0x7e36('0xc')]?_0x27464b[_0x7e36('0xc')][_0x7e36('0xd')]===undefined?!![]:![]:!![],'where':_0x27464b[_0x7e36('0xc')]?_0x27464b[_0x7e36('0xc')]['where']||null:null,'attributes':_0x27464b[_0x7e36('0xc')]?_0x27464b[_0x7e36('0xc')][_0x7e36('0xe')]||null:null,'limit':_0x27464b[_0x7e36('0xc')]?_0x27464b[_0x7e36('0xc')][_0x7e36('0xf')]||null:null,'include':_0x27464b[_0x7e36('0xc')]?_0x27464b[_0x7e36('0xc')]['include']?_[_0x7e36('0x10')](_0x27464b[_0x7e36('0xc')][_0x7e36('0x11')],function(_0x50b7c9){return{'model':db[_0x50b7c9[_0x7e36('0x12')]],'as':_0x50b7c9['as'],'attributes':_0x50b7c9[_0x7e36('0xe')],'include':_0x50b7c9[_0x7e36('0x11')]?_[_0x7e36('0x10')](_0x50b7c9[_0x7e36('0x11')],function(_0x31b410){return{'model':db[_0x31b410[_0x7e36('0x12')]],'as':_0x31b410['as'],'attributes':_0x31b410[_0x7e36('0xe')],'include':_0x31b410[_0x7e36('0x11')]?_[_0x7e36('0x10')](_0x31b410[_0x7e36('0x11')],function(_0x69eb76){return{'model':db[_0x69eb76['model']],'as':_0x69eb76['as'],'attributes':_0x69eb76[_0x7e36('0xe')]};}):[]};}):[]};}):[]:[]})[_0x7e36('0x13')](function(_0x5b09c7){logger[_0x7e36('0x14')](_0x7e36('0xa'),_0x27464b);logger[_0x7e36('0x15')](_0x7e36('0xa'),_0x27464b,JSON['stringify'](_0x5b09c7));_0x11c077(_0x5b09c7);})[_0x7e36('0x16')](function(_0x1c68d8){logger['error']('GetSquareProjects',_0x1c68d8[_0x7e36('0x17')],_0x27464b);_0x457692(_0x3ca86d[_0x7e36('0x18')](0x1f4,_0x1c68d8[_0x7e36('0x17')]));});});};exports['ShowSquareProject']=function(_0x34b52c){var _0x27e577=this;return new Promise(function(_0x322da5,_0x29d6c4){return db[_0x7e36('0xb')][_0x7e36('0x19')]({'raw':_0x34b52c[_0x7e36('0xc')]?_0x34b52c[_0x7e36('0xc')][_0x7e36('0xd')]===undefined?!![]:![]:!![],'where':_0x34b52c[_0x7e36('0xc')]?_0x34b52c[_0x7e36('0xc')][_0x7e36('0x1a')]||null:null,'attributes':_0x34b52c['options']?_0x34b52c[_0x7e36('0xc')][_0x7e36('0xe')]||null:null,'include':_0x34b52c[_0x7e36('0xc')]?_0x34b52c[_0x7e36('0xc')]['include']?_[_0x7e36('0x10')](_0x34b52c['options']['include'],function(_0x2143fe){return{'model':db[_0x2143fe[_0x7e36('0x12')]],'as':_0x2143fe['as'],'attributes':_0x2143fe[_0x7e36('0xe')],'include':_0x2143fe[_0x7e36('0x11')]?_['map'](_0x2143fe[_0x7e36('0x11')],function(_0x434d96){return{'model':db[_0x434d96[_0x7e36('0x12')]],'as':_0x434d96['as'],'attributes':_0x434d96['attributes'],'include':_0x434d96['include']?_[_0x7e36('0x10')](_0x434d96['include'],function(_0x5d4e4b){return{'model':db[_0x5d4e4b['model']],'as':_0x5d4e4b['as'],'attributes':_0x5d4e4b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e36('0x13')](function(_0x2ec8ee){logger[_0x7e36('0x14')](_0x7e36('0x1b'),_0x34b52c);logger[_0x7e36('0x15')](_0x7e36('0x1b'),_0x34b52c,JSON['stringify'](_0x2ec8ee));_0x322da5(_0x2ec8ee);})[_0x7e36('0x16')](function(_0x3c33d9){logger['error'](_0x7e36('0x1b'),_0x3c33d9[_0x7e36('0x17')],_0x34b52c);_0x29d6c4(_0x27e577[_0x7e36('0x18')](0x1f4,_0x3c33d9['message']));});});}; \ No newline at end of file +var _0x4b5d=['info','debug','stringify','error','message','find','ShowSquareProject','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','map','include','model','then'];(function(_0x386422,_0x261b43){var _0x3a73f3=function(_0x3de190){while(--_0x3de190){_0x386422['push'](_0x386422['shift']());}};_0x3a73f3(++_0x261b43);}(_0x4b5d,0x1d9));var _0xd4b5=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x4b5d[_0x4bb145];return _0x4db596;};'use strict';var _=require(_0xd4b5('0x0'));var Redis=require(_0xd4b5('0x1'));var db=require(_0xd4b5('0x2'))['db'];var logger=require(_0xd4b5('0x3'))(_0xd4b5('0x4'));var config=require(_0xd4b5('0x5'));config[_0xd4b5('0x6')]=_[_0xd4b5('0x7')](config[_0xd4b5('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xd4b5('0x8'))(new Redis(config[_0xd4b5('0x6')]));require(_0xd4b5('0x9'))[_0xd4b5('0xa')](socket);exports[_0xd4b5('0xb')]=function(_0x5937e7){var _0x21ba1f=this;return new Promise(function(_0x4195d9,_0x3184d6){return db[_0xd4b5('0xc')][_0xd4b5('0xd')]({'raw':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0xf')]===undefined?!![]:![]:!![],'where':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0x10')]||null:null,'attributes':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0x11')]||null:null,'limit':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0x12')]||null:null,'include':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7['options']['include']?_[_0xd4b5('0x13')](_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0x14')],function(_0x2e49b2){return{'model':db[_0x2e49b2['model']],'as':_0x2e49b2['as'],'attributes':_0x2e49b2[_0xd4b5('0x11')],'include':_0x2e49b2['include']?_['map'](_0x2e49b2[_0xd4b5('0x14')],function(_0x5c4dd4){return{'model':db[_0x5c4dd4[_0xd4b5('0x15')]],'as':_0x5c4dd4['as'],'attributes':_0x5c4dd4[_0xd4b5('0x11')],'include':_0x5c4dd4[_0xd4b5('0x14')]?_['map'](_0x5c4dd4[_0xd4b5('0x14')],function(_0x27d718){return{'model':db[_0x27d718[_0xd4b5('0x15')]],'as':_0x27d718['as'],'attributes':_0x27d718[_0xd4b5('0x11')]};}):[]};}):[]};}):[]:[]})[_0xd4b5('0x16')](function(_0x67d886){logger[_0xd4b5('0x17')](_0xd4b5('0xb'),_0x5937e7);logger[_0xd4b5('0x18')](_0xd4b5('0xb'),_0x5937e7,JSON[_0xd4b5('0x19')](_0x67d886));_0x4195d9(_0x67d886);})['catch'](function(_0x4baa54){logger[_0xd4b5('0x1a')](_0xd4b5('0xb'),_0x4baa54[_0xd4b5('0x1b')],_0x5937e7);_0x3184d6(_0x21ba1f[_0xd4b5('0x1a')](0x1f4,_0x4baa54[_0xd4b5('0x1b')]));});});};exports['ShowSquareProject']=function(_0x53af7a){var _0x558c04=this;return new Promise(function(_0x454dea,_0x3b269f){return db[_0xd4b5('0xc')][_0xd4b5('0x1c')]({'raw':_0x53af7a[_0xd4b5('0xe')]?_0x53af7a[_0xd4b5('0xe')][_0xd4b5('0xf')]===undefined?!![]:![]:!![],'where':_0x53af7a[_0xd4b5('0xe')]?_0x53af7a[_0xd4b5('0xe')][_0xd4b5('0x10')]||null:null,'attributes':_0x53af7a[_0xd4b5('0xe')]?_0x53af7a[_0xd4b5('0xe')][_0xd4b5('0x11')]||null:null,'include':_0x53af7a['options']?_0x53af7a['options'][_0xd4b5('0x14')]?_[_0xd4b5('0x13')](_0x53af7a[_0xd4b5('0xe')][_0xd4b5('0x14')],function(_0x29fa1a){return{'model':db[_0x29fa1a['model']],'as':_0x29fa1a['as'],'attributes':_0x29fa1a[_0xd4b5('0x11')],'include':_0x29fa1a['include']?_[_0xd4b5('0x13')](_0x29fa1a[_0xd4b5('0x14')],function(_0x5e2630){return{'model':db[_0x5e2630[_0xd4b5('0x15')]],'as':_0x5e2630['as'],'attributes':_0x5e2630[_0xd4b5('0x11')],'include':_0x5e2630['include']?_[_0xd4b5('0x13')](_0x5e2630[_0xd4b5('0x14')],function(_0x1eef15){return{'model':db[_0x1eef15[_0xd4b5('0x15')]],'as':_0x1eef15['as'],'attributes':_0x1eef15['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4b5('0x16')](function(_0x33f642){logger['info'](_0xd4b5('0x1d'),_0x53af7a);logger['debug'](_0xd4b5('0x1d'),_0x53af7a,JSON[_0xd4b5('0x19')](_0x33f642));_0x454dea(_0x33f642);})[_0xd4b5('0x1e')](function(_0x2d6dd9){logger[_0xd4b5('0x1a')](_0xd4b5('0x1d'),_0x2d6dd9[_0xd4b5('0x1b')],_0x53af7a);_0x3b269f(_0x558c04[_0xd4b5('0x1a')](0x1f4,_0x2d6dd9[_0xd4b5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 6551b69..0a7a62e 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 _0x31b3=['length','squareProject:','save','update','emit','removeListener','register'];(function(_0xa35666,_0x19fb8a){var _0x4b2d2f=function(_0x5d3fca){while(--_0x5d3fca){_0xa35666['push'](_0xa35666['shift']());}};_0x4b2d2f(++_0x19fb8a);}(_0x31b3,0x1ec));var _0x331b=function(_0x5bd6d9,_0x51aa71){_0x5bd6d9=_0x5bd6d9-0x0;var _0x32dab4=_0x31b3[_0x5bd6d9];return _0x32dab4;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x331b('0x0'),'remove',_0x331b('0x1')];function createListener(_0xddfa24,_0x2bfa26){return function(_0x43d52d){_0x2bfa26[_0x331b('0x2')](_0xddfa24,_0x43d52d);};}function removeListener(_0x26b727,_0x2376ca){return function(){SquareProjectEvents[_0x331b('0x3')](_0x26b727,_0x2376ca);};}exports[_0x331b('0x4')]=function(_0x2206a5){for(var _0x337973=0x0,_0x421af2=events[_0x331b('0x5')];_0x337973<_0x421af2;_0x337973++){var _0x51cf19=events[_0x337973];var _0x3dbc23=createListener(_0x331b('0x6')+_0x51cf19,_0x2206a5);SquareProjectEvents['on'](_0x51cf19,_0x3dbc23);}}; \ No newline at end of file +var _0xb1d0=['removeListener','register','length','squareProject:','remove'];(function(_0x482238,_0x35a004){var _0x37287c=function(_0x37db7d){while(--_0x37db7d){_0x482238['push'](_0x482238['shift']());}};_0x37287c(++_0x35a004);}(_0xb1d0,0x167));var _0x0b1d=function(_0x2931e6,_0x4b79a2){_0x2931e6=_0x2931e6-0x0;var _0x1b1208=_0xb1d0[_0x2931e6];return _0x1b1208;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x0b1d('0x0'),'update'];function createListener(_0xcd2c02,_0x436156){return function(_0x45aa8b){_0x436156['emit'](_0xcd2c02,_0x45aa8b);};}function removeListener(_0x292a76,_0x4c9792){return function(){SquareProjectEvents[_0x0b1d('0x1')](_0x292a76,_0x4c9792);};}exports[_0x0b1d('0x2')]=function(_0x35cdb2){for(var _0x48c758=0x0,_0x203af4=events[_0x0b1d('0x3')];_0x48c758<_0x203af4;_0x48c758++){var _0x3ef7f4=events[_0x48c758];var _0x4ca534=createListener(_0x0b1d('0x4')+_0x3ef7f4,_0x35cdb2);SquareProjectEvents['on'](_0x3ef7f4,_0x4ca534);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index a726772..e7fed1f 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3c0ba0,_0x48fa5e){var _0x5f360f=function(_0x4530b6){while(--_0x4530b6){_0x3c0ba0['push'](_0x3c0ba0['shift']());}};_0x5f360f(++_0x48fa5e);}(_0x4975,0x86));var _0x5497=function(_0x308786,_0x2f1d02){_0x308786=_0x308786-0x0;var _0x461513=_0x4975[_0x308786];return _0x461513;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x281263,_0x5f20aa){var _0x3cbc91=function(_0x3f67e8){while(--_0x3f67e8){_0x281263['push'](_0x281263['shift']());}};_0x3cbc91(++_0x5f20aa);}(_0x814b,0x1a2));var _0xb814=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x814b[_0x24a654];return _0x458651;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 38130f0..b152746 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 _0xdbf5=['lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x2b39d9,_0x18d637){var _0x3978be=function(_0x3ec6f8){while(--_0x3ec6f8){_0x2b39d9['push'](_0x2b39d9['shift']());}};_0x3978be(++_0x18d637);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3ffb74,_0x39e685){_0x3ffb74=_0x3ffb74-0x0;var _0x2a735a=_0xdbf5[_0x3ffb74];return _0x2a735a;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'context':{'type':Sequelize[_0x5dbf('0x1')]},'extension':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize[_0x5dbf('0x1')]},'dnid':{'type':Sequelize[_0x5dbf('0x1')]},'projectName':{'type':Sequelize[_0x5dbf('0x1')]},'saveName':{'type':Sequelize[_0x5dbf('0x1')]},'filename':{'type':Sequelize[_0x5dbf('0x1')]},'savePath':{'type':Sequelize[_0x5dbf('0x1')]},'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){var _0x88128e='';var _0x93e657=this['getDataValue'](_0x5dbf('0x3'));if(_0x93e657){_0x88128e=_0x93e657['substring'](_0x93e657[_0x5dbf('0x4')]('.'));}return _0x88128e;}}}; \ No newline at end of file +var _0xf2ca=['getDataValue','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x3fdd14,_0x1cd210){var _0x101823=function(_0x1a6e8e){while(--_0x1a6e8e){_0x3fdd14['push'](_0x3fdd14['shift']());}};_0x101823(++_0x1cd210);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0xf2ca[_0x43a6cd];return _0x5acb36;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'uniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'extension':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'dnid':{'type':Sequelize[_0xaf2c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xaf2c('0x2')]},'filename':{'type':Sequelize[_0xaf2c('0x2')]},'savePath':{'type':Sequelize[_0xaf2c('0x2')]},'format':{'type':Sequelize[_0xaf2c('0x3')],'get':function(){var _0x58351f='';var _0x37fedd=this[_0xaf2c('0x4')]('savePath');if(_0x37fedd){_0x58351f=_0x37fedd[_0xaf2c('0x5')](_0x37fedd['lastIndexOf']('.'));}return _0x58351f;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b20edc1..6932f2a 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 _0x1dfe=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','SquareRecording','includeAll','include','findAll','catch','create','body','update','find','params','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','secrets','recording','Sequelize','ValidationError','download','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','existsSync','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','fast-json-patch','moment','bluebird','to-csv','ejs','lodash'];(function(_0x29797a,_0x4eee43){var _0x7197ce=function(_0x57f011){while(--_0x57f011){_0x29797a['push'](_0x29797a['shift']());}};_0x7197ce(++_0x4eee43);}(_0x1dfe,0xb0));var _0xe1df=function(_0x4bc792,_0x29eee9){_0x4bc792=_0x4bc792-0x0;var _0x2f54c5=_0x1dfe[_0x4bc792];return _0x2f54c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe1df('0x0'));var rp=require('request-promise');var moment=require(_0xe1df('0x1'));var BPromise=require(_0xe1df('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe1df('0x3'));var ejs=require(_0xe1df('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe1df('0x5'));var squel=require(_0xe1df('0x6'));var crypto=require(_0xe1df('0x7'));var jsforce=require(_0xe1df('0x8'));var deskjs=require(_0xe1df('0x9'));var toCsv=require(_0xe1df('0x3'));var querystring=require('querystring');var Papa=require(_0xe1df('0xa'));var Redis=require(_0xe1df('0xb'));var authService=require(_0xe1df('0xc'));var qs=require(_0xe1df('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1df('0xe'))(_0xe1df('0xf'));var utils=require(_0xe1df('0x10'));var config=require(_0xe1df('0x11'));var licenseUtil=require(_0xe1df('0x12'));var db=require(_0xe1df('0x13'))['db'];function respondWithStatusCode(_0x1ef891,_0x269555){_0x269555=_0x269555||0xcc;return function(_0x4ceaec){if(_0x4ceaec){return _0x1ef891['sendStatus'](_0x269555);}return _0x1ef891[_0xe1df('0x14')](_0x269555)['end']();};}function respondWithResult(_0x45833a,_0x5e6a59){_0x5e6a59=_0x5e6a59||0xc8;return function(_0x240685){if(_0x240685){return _0x45833a[_0xe1df('0x14')](_0x5e6a59)[_0xe1df('0x15')](_0x240685);}};}function respondWithFilteredResult(_0x5935b0,_0x493ab4){return function(_0x31831b){if(_0x31831b){var _0x2e38c6=typeof _0x493ab4[_0xe1df('0x16')]===_0xe1df('0x17')&&typeof _0x493ab4[_0xe1df('0x18')]===_0xe1df('0x17');var _0xbc19ef=_0x31831b[_0xe1df('0x19')];var _0x5dc0c1=_0x2e38c6?0x0:_0x493ab4['offset'];var _0x71b27b=_0x2e38c6?_0x31831b[_0xe1df('0x19')]:_0x493ab4['offset']+_0x493ab4['limit'];var _0xfa477;if(_0x71b27b>=_0xbc19ef){_0x71b27b=_0xbc19ef;_0xfa477=0xc8;}else{_0xfa477=0xce;}_0x5935b0[_0xe1df('0x14')](_0xfa477);return _0x5935b0[_0xe1df('0x1a')](_0xe1df('0x1b'),_0x5dc0c1+'-'+_0x71b27b+'/'+_0xbc19ef)[_0xe1df('0x15')](_0x31831b);}return null;};}function patchUpdates(_0x23ce64){return function(_0x167862){try{jsonpatch['apply'](_0x167862,_0x23ce64,!![]);}catch(_0xbc935c){return BPromise['reject'](_0xbc935c);}return _0x167862[_0xe1df('0x1c')]();};}function saveUpdates(_0x1303ad,_0x28c0ac){return function(_0x55a862){if(_0x55a862){return _0x55a862['update'](_0x1303ad)[_0xe1df('0x1d')](function(_0x46e975){return _0x46e975;});}return null;};}function removeEntity(_0x33fb14,_0x1d3dd2){return function(_0x2e40a9){if(_0x2e40a9){return _0x2e40a9[_0xe1df('0x1e')]()[_0xe1df('0x1d')](function(){_0x33fb14[_0xe1df('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a9713,_0x7f6713){return function(_0x57a9be){if(!_0x57a9be){_0x3a9713[_0xe1df('0x1f')](0x194);}return _0x57a9be;};}function handleError(_0x28c7cd,_0x550452){_0x550452=_0x550452||0x1f4;return function(_0x591cd6){logger[_0xe1df('0x20')](_0x591cd6['stack']);if(_0x591cd6[_0xe1df('0x21')]){delete _0x591cd6[_0xe1df('0x21')];}_0x28c7cd[_0xe1df('0x14')](_0x550452)[_0xe1df('0x22')](_0x591cd6);};}exports[_0xe1df('0x23')]=function(_0x4eba5a,_0x445022){var _0x436b35={},_0x2effe0={},_0x1dba7c={'count':0x0,'rows':[]};var _0x2be342=_[_0xe1df('0x24')](db['SquareRecording'][_0xe1df('0x25')],function(_0x451f0e){return{'name':_0x451f0e[_0xe1df('0x26')],'type':_0x451f0e[_0xe1df('0x27')]['key']};});_0x2effe0[_0xe1df('0x28')]=_[_0xe1df('0x24')](_0x2be342,_0xe1df('0x21'));_0x2effe0[_0xe1df('0x29')]=_[_0xe1df('0x2a')](_0x4eba5a[_0xe1df('0x29')]);_0x2effe0[_0xe1df('0x2b')]=_[_0xe1df('0x2c')](_0x2effe0[_0xe1df('0x28')],_0x2effe0[_0xe1df('0x29')]);_0x436b35[_0xe1df('0x2d')]=_[_0xe1df('0x2c')](_0x2effe0[_0xe1df('0x28')],qs[_0xe1df('0x2e')](_0x4eba5a[_0xe1df('0x29')]['fields']));_0x436b35[_0xe1df('0x2d')]=_0x436b35[_0xe1df('0x2d')][_0xe1df('0x2f')]?_0x436b35[_0xe1df('0x2d')]:_0x2effe0[_0xe1df('0x28')];if(!_0x4eba5a[_0xe1df('0x29')][_0xe1df('0x30')](_0xe1df('0x31'))){_0x436b35['limit']=qs[_0xe1df('0x18')](_0x4eba5a[_0xe1df('0x29')][_0xe1df('0x18')]);_0x436b35[_0xe1df('0x16')]=qs[_0xe1df('0x16')](_0x4eba5a['query']['offset']);}_0x436b35[_0xe1df('0x32')]=qs[_0xe1df('0x33')](_0x4eba5a['query'][_0xe1df('0x33')]);_0x436b35['where']=qs[_0xe1df('0x2b')](_[_0xe1df('0x34')](_0x4eba5a[_0xe1df('0x29')],_0x2effe0[_0xe1df('0x2b')]),_0x2be342);if(_0x4eba5a['query']['filter']){_0x436b35['where']=_[_0xe1df('0x35')](_0x436b35[_0xe1df('0x36')],{'$or':_[_0xe1df('0x24')](_0x2be342,function(_0x3f7538){if(_0x3f7538[_0xe1df('0x27')]!==_0xe1df('0x37')){var _0x57e8f8={};_0x57e8f8[_0x3f7538[_0xe1df('0x21')]]={'$like':'%'+_0x4eba5a[_0xe1df('0x29')][_0xe1df('0x38')]+'%'};return _0x57e8f8;}})});}_0x436b35=_[_0xe1df('0x35')]({},_0x436b35,_0x4eba5a[_0xe1df('0x39')]);var _0x4367f8={'where':_0x436b35[_0xe1df('0x36')]};return db[_0xe1df('0x3a')][_0xe1df('0x19')](_0x4367f8)['then'](function(_0x183328){_0x1dba7c[_0xe1df('0x19')]=_0x183328;if(_0x4eba5a[_0xe1df('0x29')][_0xe1df('0x3b')]){_0x436b35[_0xe1df('0x3c')]=[{'all':!![]}];}return db[_0xe1df('0x3a')][_0xe1df('0x3d')](_0x436b35);})[_0xe1df('0x1d')](function(_0x50483a){_0x1dba7c['rows']=_0x50483a;return _0x1dba7c;})[_0xe1df('0x1d')](respondWithFilteredResult(_0x445022,_0x436b35))[_0xe1df('0x3e')](handleError(_0x445022,null));};exports['show']=function(_0x4c8b32,_0x2e080a){var _0x45e400={'raw':!![],'where':{'id':_0x4c8b32['params']['id']}},_0x5e07ca={};_0x5e07ca[_0xe1df('0x28')]=_[_0xe1df('0x2a')](db[_0xe1df('0x3a')][_0xe1df('0x25')]);_0x5e07ca[_0xe1df('0x29')]=_[_0xe1df('0x2a')](_0x4c8b32[_0xe1df('0x29')]);_0x5e07ca[_0xe1df('0x2b')]=_[_0xe1df('0x2c')](_0x5e07ca[_0xe1df('0x28')],_0x5e07ca['query']);_0x45e400[_0xe1df('0x2d')]=_[_0xe1df('0x2c')](_0x5e07ca[_0xe1df('0x28')],qs[_0xe1df('0x2e')](_0x4c8b32[_0xe1df('0x29')][_0xe1df('0x2e')]));_0x45e400['attributes']=_0x45e400[_0xe1df('0x2d')][_0xe1df('0x2f')]?_0x45e400['attributes']:_0x5e07ca['model'];if(_0x4c8b32['query'][_0xe1df('0x3b')]){_0x45e400[_0xe1df('0x3c')]=[{'all':!![]}];}_0x45e400=_[_0xe1df('0x35')]({},_0x45e400,_0x4c8b32[_0xe1df('0x39')]);return db['SquareRecording']['find'](_0x45e400)['then'](handleEntityNotFound(_0x2e080a,null))[_0xe1df('0x1d')](respondWithResult(_0x2e080a,null))[_0xe1df('0x3e')](handleError(_0x2e080a,null));};exports[_0xe1df('0x3f')]=function(_0x390eb5,_0x34395c){return db['SquareRecording']['create'](_0x390eb5[_0xe1df('0x40')],{})[_0xe1df('0x1d')](respondWithResult(_0x34395c,0xc9))[_0xe1df('0x3e')](handleError(_0x34395c,null));};exports[_0xe1df('0x41')]=function(_0x571a30,_0x2c65d4){if(_0x571a30[_0xe1df('0x40')]['id']){delete _0x571a30[_0xe1df('0x40')]['id'];}return db[_0xe1df('0x3a')][_0xe1df('0x42')]({'where':{'id':_0x571a30[_0xe1df('0x43')]['id']}})[_0xe1df('0x1d')](handleEntityNotFound(_0x2c65d4,null))[_0xe1df('0x1d')](saveUpdates(_0x571a30[_0xe1df('0x40')],null))[_0xe1df('0x1d')](respondWithResult(_0x2c65d4,null))[_0xe1df('0x3e')](handleError(_0x2c65d4,null));};exports['download']=function(_0x1e949c,_0x1676be,_0x3b8d03){var _0xa0e76a=require(_0xe1df('0x44'));var _0x2a0dfa=![];var _0x2c3d40={};if(_0x1e949c[_0xe1df('0x29')][_0xe1df('0x27')]&&_0x1e949c[_0xe1df('0x29')][_0xe1df('0x27')]===_0xe1df('0x45')){_0x2c3d40[_0xe1df('0x45')]=_0x1e949c[_0xe1df('0x43')]['id'];}else{_0x2c3d40['id']=_0x1e949c['params']['id'];}return db[_0xe1df('0x3a')][_0xe1df('0x42')]({'where':_0x2c3d40,'attributes':['id','savePath',_0xe1df('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x1676be,null))[_0xe1df('0x1d')](function(_0x12b547){if(_0x12b547){var _0x570286=_0x12b547[_0xe1df('0x47')];var _0x37bad5=util[_0xe1df('0x48')](_0xe1df('0x49'),_0x570286);if(fs['existsSync'](_0x37bad5)){_0x2a0dfa=!![];return _0xa0e76a['decryptFile'](_0x37bad5,_0x570286,config[_0xe1df('0x4a')][_0xe1df('0x4b')])['then'](function(){return _0x12b547;});}return _0x12b547;}})[_0xe1df('0x1d')](function(_0x34db38){if(_0x34db38){var _0x30ce55=_0x34db38[_0xe1df('0x47')];if(!fs['existsSync'](_0x30ce55)){throw new db[(_0xe1df('0x4c'))][(_0xe1df('0x4d'))]('SquareRecording\x20not\x20found');}if(_0x34db38[_0xe1df('0x46')]){return _0x1676be[_0xe1df('0x4e')](_0x30ce55,_0x34db38[_0xe1df('0x46')]+path[_0xe1df('0x4f')](_0x30ce55),function(){if(_0x2a0dfa){fs[_0xe1df('0x50')](_0x30ce55);}});}else{return _0x1676be[_0xe1df('0x4e')](_0x30ce55,function(_0x40911f){if(_0x2a0dfa){fs[_0xe1df('0x50')](_0x30ce55);}});}}})[_0xe1df('0x3e')](function(_0x443496){if(_0x443496[_0xe1df('0x51')]===_0xe1df('0x52')){_0x1676be[_0xe1df('0x14')](0x194)[_0xe1df('0x22')](_0xe1df('0x53'));}else{return handleError(_0x1676be,null);}});};exports['destroy']=function(_0x3c7e99,_0x15cfbe){return db['SquareRecording']['find']({'where':{'id':_0x3c7e99[_0xe1df('0x43')]['id']}})[_0xe1df('0x1d')](function(_0x1b9048){if(_[_0xe1df('0x54')](_0x1b9048)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1b9048;})[_0xe1df('0x1d')](function(_0x3145f7){var _0xb66092=_0x3145f7[_0xe1df('0x47')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0xb66092);if(!_[_0xe1df('0x54')](_0x3145f7[_0xe1df('0x47')])&&fs[_0xe1df('0x55')](_0xb66092)){logger[_0xe1df('0x56')](_0xe1df('0x57')+_0xb66092+_0xe1df('0x58'));fs[_0xe1df('0x59')](_0xb66092);}_0xb66092=_0xb66092+_0xe1df('0x5a');if(!_[_0xe1df('0x54')](_0x3145f7['savePath'])&&fs[_0xe1df('0x55')](_0xb66092)){logger[_0xe1df('0x56')](_0xe1df('0x57')+_0xb66092+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe1df('0x59')](_0xb66092);}return _0x3145f7;})['then'](function(_0x2996a2){if(!_0x2996a2)throw new InternalError();return _0x2996a2[_0xe1df('0x1e')]();})[_0xe1df('0x1d')](function(){_0x15cfbe['status'](0xcc)['end']();})[_0xe1df('0x3e')](handleError(_0x15cfbe,null));}; \ No newline at end of file +var _0x0c2d=['body','find','params','download','../../components/encryptor','uniqueid','savePath','filename','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','send','fieldName','type','key','model','map','name','query','keys','fields','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','findAll','rows','catch','show','rawAttributes','intersection','length','include','create'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x0c2d,0x1ef));var _0xd0c2=function(_0x1cad89,_0x18c165){_0x1cad89=_0x1cad89-0x0;var _0xdc44b6=_0x0c2d[_0x1cad89];return _0xdc44b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd0c2('0x0'));var jsonpatch=require(_0xd0c2('0x1'));var rp=require(_0xd0c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd0c2('0x3'));var util=require(_0xd0c2('0x4'));var path=require('path');var sox=require(_0xd0c2('0x5'));var csv=require(_0xd0c2('0x6'));var ejs=require(_0xd0c2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0c2('0x8'));var squel=require('squel');var crypto=require(_0xd0c2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd0c2('0xa'));var toCsv=require(_0xd0c2('0x6'));var querystring=require(_0xd0c2('0xb'));var Papa=require(_0xd0c2('0xc'));var Redis=require(_0xd0c2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd0c2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0c2('0xf'));var logger=require(_0xd0c2('0x10'))(_0xd0c2('0x11'));var utils=require(_0xd0c2('0x12'));var config=require(_0xd0c2('0x13'));var licenseUtil=require(_0xd0c2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ab737,_0x375929){_0x375929=_0x375929||0xcc;return function(_0x2e9ec3){if(_0x2e9ec3){return _0x1ab737[_0xd0c2('0x15')](_0x375929);}return _0x1ab737[_0xd0c2('0x16')](_0x375929)[_0xd0c2('0x17')]();};}function respondWithResult(_0x46e260,_0x476b52){_0x476b52=_0x476b52||0xc8;return function(_0x572ceb){if(_0x572ceb){return _0x46e260[_0xd0c2('0x16')](_0x476b52)['json'](_0x572ceb);}};}function respondWithFilteredResult(_0x2b33f1,_0x30de42){return function(_0x2d23e2){if(_0x2d23e2){var _0x3c754b=typeof _0x30de42['offset']===_0xd0c2('0x18')&&typeof _0x30de42[_0xd0c2('0x19')]===_0xd0c2('0x18');var _0x3ae8eb=_0x2d23e2[_0xd0c2('0x1a')];var _0x25079e=_0x3c754b?0x0:_0x30de42[_0xd0c2('0x1b')];var _0x39f6c7=_0x3c754b?_0x2d23e2[_0xd0c2('0x1a')]:_0x30de42[_0xd0c2('0x1b')]+_0x30de42['limit'];var _0x14fde4;if(_0x39f6c7>=_0x3ae8eb){_0x39f6c7=_0x3ae8eb;_0x14fde4=0xc8;}else{_0x14fde4=0xce;}_0x2b33f1['status'](_0x14fde4);return _0x2b33f1[_0xd0c2('0x1c')](_0xd0c2('0x1d'),_0x25079e+'-'+_0x39f6c7+'/'+_0x3ae8eb)[_0xd0c2('0x1e')](_0x2d23e2);}return null;};}function patchUpdates(_0x478a02){return function(_0x45a87b){try{jsonpatch['apply'](_0x45a87b,_0x478a02,!![]);}catch(_0x423b85){return BPromise[_0xd0c2('0x1f')](_0x423b85);}return _0x45a87b[_0xd0c2('0x20')]();};}function saveUpdates(_0x418302,_0x4b367d){return function(_0x1604b5){if(_0x1604b5){return _0x1604b5[_0xd0c2('0x21')](_0x418302)[_0xd0c2('0x22')](function(_0x1a31c0){return _0x1a31c0;});}return null;};}function removeEntity(_0x5a57a3,_0x528c61){return function(_0x33d38b){if(_0x33d38b){return _0x33d38b[_0xd0c2('0x23')]()[_0xd0c2('0x22')](function(){_0x5a57a3['status'](0xcc)[_0xd0c2('0x17')]();});}};}function handleEntityNotFound(_0x410cfa,_0x351a1a){return function(_0x36800f){if(!_0x36800f){_0x410cfa[_0xd0c2('0x15')](0x194);}return _0x36800f;};}function handleError(_0x8abab6,_0x468265){_0x468265=_0x468265||0x1f4;return function(_0x31e72a){logger[_0xd0c2('0x24')](_0x31e72a[_0xd0c2('0x25')]);if(_0x31e72a['name']){delete _0x31e72a['name'];}_0x8abab6['status'](_0x468265)[_0xd0c2('0x26')](_0x31e72a);};}exports['index']=function(_0x54a3c4,_0x1a89c4){var _0x1d7781={},_0x63785f={},_0x543dc5={'count':0x0,'rows':[]};var _0x28e34b=_['map'](db['SquareRecording']['rawAttributes'],function(_0x446dea){return{'name':_0x446dea[_0xd0c2('0x27')],'type':_0x446dea[_0xd0c2('0x28')][_0xd0c2('0x29')]};});_0x63785f[_0xd0c2('0x2a')]=_[_0xd0c2('0x2b')](_0x28e34b,_0xd0c2('0x2c'));_0x63785f[_0xd0c2('0x2d')]=_[_0xd0c2('0x2e')](_0x54a3c4[_0xd0c2('0x2d')]);_0x63785f['filters']=_['intersection'](_0x63785f[_0xd0c2('0x2a')],_0x63785f['query']);_0x1d7781['attributes']=_['intersection'](_0x63785f[_0xd0c2('0x2a')],qs['fields'](_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x2f')]));_0x1d7781[_0xd0c2('0x30')]=_0x1d7781[_0xd0c2('0x30')]['length']?_0x1d7781[_0xd0c2('0x30')]:_0x63785f[_0xd0c2('0x2a')];if(!_0x54a3c4[_0xd0c2('0x2d')]['hasOwnProperty']('nolimit')){_0x1d7781['limit']=qs['limit'](_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x19')]);_0x1d7781[_0xd0c2('0x1b')]=qs['offset'](_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x1b')]);}_0x1d7781[_0xd0c2('0x31')]=qs[_0xd0c2('0x32')](_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x32')]);_0x1d7781[_0xd0c2('0x33')]=qs[_0xd0c2('0x34')](_[_0xd0c2('0x35')](_0x54a3c4[_0xd0c2('0x2d')],_0x63785f['filters']),_0x28e34b);if(_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x36')]){_0x1d7781[_0xd0c2('0x33')]=_[_0xd0c2('0x37')](_0x1d7781[_0xd0c2('0x33')],{'$or':_[_0xd0c2('0x2b')](_0x28e34b,function(_0x1f6f99){if(_0x1f6f99[_0xd0c2('0x28')]!==_0xd0c2('0x38')){var _0x37795c={};_0x37795c[_0x1f6f99[_0xd0c2('0x2c')]]={'$like':'%'+_0x54a3c4[_0xd0c2('0x2d')]['filter']+'%'};return _0x37795c;}})});}_0x1d7781=_[_0xd0c2('0x37')]({},_0x1d7781,_0x54a3c4[_0xd0c2('0x39')]);var _0x52d29d={'where':_0x1d7781[_0xd0c2('0x33')]};return db[_0xd0c2('0x3a')][_0xd0c2('0x1a')](_0x52d29d)[_0xd0c2('0x22')](function(_0x27de33){_0x543dc5[_0xd0c2('0x1a')]=_0x27de33;if(_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x3b')]){_0x1d7781['include']=[{'all':!![]}];}return db[_0xd0c2('0x3a')][_0xd0c2('0x3c')](_0x1d7781);})[_0xd0c2('0x22')](function(_0x263326){_0x543dc5[_0xd0c2('0x3d')]=_0x263326;return _0x543dc5;})[_0xd0c2('0x22')](respondWithFilteredResult(_0x1a89c4,_0x1d7781))[_0xd0c2('0x3e')](handleError(_0x1a89c4,null));};exports[_0xd0c2('0x3f')]=function(_0x3a9d9b,_0x42d842){var _0x551a88={'raw':!![],'where':{'id':_0x3a9d9b['params']['id']}},_0x57cf89={};_0x57cf89['model']=_[_0xd0c2('0x2e')](db[_0xd0c2('0x3a')][_0xd0c2('0x40')]);_0x57cf89['query']=_['keys'](_0x3a9d9b[_0xd0c2('0x2d')]);_0x57cf89[_0xd0c2('0x34')]=_[_0xd0c2('0x41')](_0x57cf89[_0xd0c2('0x2a')],_0x57cf89['query']);_0x551a88[_0xd0c2('0x30')]=_[_0xd0c2('0x41')](_0x57cf89['model'],qs[_0xd0c2('0x2f')](_0x3a9d9b['query']['fields']));_0x551a88[_0xd0c2('0x30')]=_0x551a88['attributes'][_0xd0c2('0x42')]?_0x551a88[_0xd0c2('0x30')]:_0x57cf89[_0xd0c2('0x2a')];if(_0x3a9d9b[_0xd0c2('0x2d')][_0xd0c2('0x3b')]){_0x551a88[_0xd0c2('0x43')]=[{'all':!![]}];}_0x551a88=_[_0xd0c2('0x37')]({},_0x551a88,_0x3a9d9b[_0xd0c2('0x39')]);return db[_0xd0c2('0x3a')]['find'](_0x551a88)[_0xd0c2('0x22')](handleEntityNotFound(_0x42d842,null))['then'](respondWithResult(_0x42d842,null))['catch'](handleError(_0x42d842,null));};exports[_0xd0c2('0x44')]=function(_0x113110,_0x34ec03){return db[_0xd0c2('0x3a')]['create'](_0x113110[_0xd0c2('0x45')],{})[_0xd0c2('0x22')](respondWithResult(_0x34ec03,0xc9))[_0xd0c2('0x3e')](handleError(_0x34ec03,null));};exports[_0xd0c2('0x21')]=function(_0x4a0f9c,_0x50d871){if(_0x4a0f9c[_0xd0c2('0x45')]['id']){delete _0x4a0f9c['body']['id'];}return db[_0xd0c2('0x3a')][_0xd0c2('0x46')]({'where':{'id':_0x4a0f9c[_0xd0c2('0x47')]['id']}})[_0xd0c2('0x22')](handleEntityNotFound(_0x50d871,null))[_0xd0c2('0x22')](saveUpdates(_0x4a0f9c[_0xd0c2('0x45')],null))[_0xd0c2('0x22')](respondWithResult(_0x50d871,null))[_0xd0c2('0x3e')](handleError(_0x50d871,null));};exports[_0xd0c2('0x48')]=function(_0x51ebeb,_0x4dd56b,_0x1d26e8){var _0x488382=require(_0xd0c2('0x49'));var _0x44fca0=![];var _0x3acd99={};if(_0x51ebeb[_0xd0c2('0x2d')][_0xd0c2('0x28')]&&_0x51ebeb['query'][_0xd0c2('0x28')]==='uniqueid'){_0x3acd99[_0xd0c2('0x4a')]=_0x51ebeb[_0xd0c2('0x47')]['id'];}else{_0x3acd99['id']=_0x51ebeb[_0xd0c2('0x47')]['id'];}return db[_0xd0c2('0x3a')][_0xd0c2('0x46')]({'where':_0x3acd99,'attributes':['id',_0xd0c2('0x4b'),_0xd0c2('0x4c')],'raw':!![]})[_0xd0c2('0x22')](handleEntityNotFound(_0x4dd56b,null))[_0xd0c2('0x22')](function(_0x33b7bb){if(_0x33b7bb){var _0x24c1e3=_0x33b7bb[_0xd0c2('0x4b')];var _0x3ed628=util['format']('%s.cypher',_0x24c1e3);if(fs[_0xd0c2('0x4d')](_0x3ed628)){_0x44fca0=!![];return _0x488382[_0xd0c2('0x4e')](_0x3ed628,_0x24c1e3,config[_0xd0c2('0x4f')][_0xd0c2('0x50')])[_0xd0c2('0x22')](function(){return _0x33b7bb;});}return _0x33b7bb;}})[_0xd0c2('0x22')](function(_0x2b7ad9){if(_0x2b7ad9){var _0x5d7401=_0x2b7ad9[_0xd0c2('0x4b')];if(!fs['existsSync'](_0x5d7401)){throw new db[(_0xd0c2('0x51'))][(_0xd0c2('0x52'))](_0xd0c2('0x53'));}if(_0x2b7ad9[_0xd0c2('0x4c')]){return _0x4dd56b[_0xd0c2('0x48')](_0x5d7401,_0x2b7ad9[_0xd0c2('0x4c')]+path[_0xd0c2('0x54')](_0x5d7401),function(){if(_0x44fca0){fs[_0xd0c2('0x55')](_0x5d7401);}});}else{return _0x4dd56b[_0xd0c2('0x48')](_0x5d7401,function(_0x4bd349){if(_0x44fca0){fs['unlink'](_0x5d7401);}});}}})[_0xd0c2('0x3e')](function(_0x12dce6){if(_0x12dce6['message']==='SquareRecording\x20not\x20found'){_0x4dd56b[_0xd0c2('0x16')](0x194)[_0xd0c2('0x26')](_0xd0c2('0x56'));}else{return handleError(_0x4dd56b,null);}});};exports['destroy']=function(_0x5e2942,_0x5b3c97){return db[_0xd0c2('0x3a')][_0xd0c2('0x46')]({'where':{'id':_0x5e2942[_0xd0c2('0x47')]['id']}})[_0xd0c2('0x22')](function(_0x3e34d4){if(_[_0xd0c2('0x57')](_0x3e34d4)){throw new ReferenceError(_0xd0c2('0x58'));}return _0x3e34d4;})['then'](function(_0x509fe3){var _0x361274=_0x509fe3[_0xd0c2('0x4b')];logger['info'](_0xd0c2('0x59'),_0x361274);if(!_[_0xd0c2('0x57')](_0x509fe3['savePath'])&&fs[_0xd0c2('0x4d')](_0x361274)){logger['info'](_0xd0c2('0x5a')+_0x361274+_0xd0c2('0x5b'));fs['unlinkSync'](_0x361274);}_0x361274=_0x361274+_0xd0c2('0x5c');if(!_[_0xd0c2('0x57')](_0x509fe3[_0xd0c2('0x4b')])&&fs[_0xd0c2('0x4d')](_0x361274)){logger['info'](_0xd0c2('0x5a')+_0x361274+_0xd0c2('0x5b'));fs[_0xd0c2('0x5d')](_0x361274);}return _0x509fe3;})[_0xd0c2('0x22')](function(_0x1665ff){if(!_0x1665ff)throw new InternalError();return _0x1665ff['destroy']();})[_0xd0c2('0x22')](function(){_0x5b3c97['status'](0xcc)[_0xd0c2('0x17')]();})[_0xd0c2('0x3e')](handleError(_0x5b3c97,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 89fc727..3f623e7 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 _0xc4d8=['../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','request-promise'];(function(_0x114ccd,_0x285307){var _0x24eae6=function(_0x3b4d2a){while(--_0x3b4d2a){_0x114ccd['push'](_0x114ccd['shift']());}};_0x24eae6(++_0x285307);}(_0xc4d8,0xa6));var _0x8c4d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc4d8[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x8c4d('0x0'));var util=require('util');var logger=require(_0x8c4d('0x1'))(_0x8c4d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8c4d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c4d('0x4'));var attributes=require(_0x8c4d('0x5'));module[_0x8c4d('0x6')]=function(_0xa1bc80,_0x227bc8){return _0xa1bc80[_0x8c4d('0x7')](_0x8c4d('0x8'),attributes,{'tableName':_0x8c4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['exports','define','SquareRecording','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x3ea1cd,_0xa47190){var _0x41bd69=function(_0x143db5){while(--_0x143db5){_0x3ea1cd['push'](_0x3ea1cd['shift']());}};_0x41bd69(++_0xa47190);}(_0x4bd3,0x174));var _0x34bd=function(_0x2b63ed,_0x15c4f1){_0x2b63ed=_0x2b63ed-0x0;var _0x47acb2=_0x4bd3[_0x2b63ed];return _0x47acb2;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./squareRecording.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'square_recordings','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 f9fb44b..145392e 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 _0x692b=['then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request'];(function(_0x5983ce,_0x2121a2){var _0x3ccc0e=function(_0x92f5a1){while(--_0x92f5a1){_0x5983ce['push'](_0x5983ce['shift']());}};_0x3ccc0e(++_0x2121a2);}(_0x692b,0x114));var _0xb692=function(_0x3e3fde,_0x418b27){_0x3e3fde=_0x3e3fde-0x0;var _0x6a2763=_0x692b[_0x3e3fde];return _0x6a2763;};'use strict';var _=require(_0xb692('0x0'));var util=require(_0xb692('0x1'));var moment=require('moment');var BPromise=require(_0xb692('0x2'));var rs=require(_0xb692('0x3'));var fs=require('fs');var Redis=require(_0xb692('0x4'));var db=require(_0xb692('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb692('0x6'));var client=jayson[_0xb692('0x7')][_0xb692('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x531c63,_0x3912f8,_0x25fd8d){return new BPromise(function(_0x25e2f6,_0x456a5e){return client[_0xb692('0x9')](_0x531c63,_0x25fd8d)[_0xb692('0xa')](function(_0x303474){logger[_0xb692('0xb')](_0xb692('0xc'),_0x3912f8,'request\x20sent');logger['debug'](_0xb692('0xd'),_0x3912f8,_0xb692('0xe'),JSON[_0xb692('0xf')](_0x303474));if(_0x303474[_0xb692('0x10')]){if(_0x303474[_0xb692('0x10')][_0xb692('0x11')]===0x1f4){logger[_0xb692('0x10')](_0xb692('0xc'),_0x3912f8,_0x303474[_0xb692('0x10')][_0xb692('0x12')]);return _0x456a5e(_0x303474[_0xb692('0x10')][_0xb692('0x12')]);}logger[_0xb692('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3912f8,_0x303474[_0xb692('0x10')]['message']);return _0x25e2f6(_0x303474[_0xb692('0x10')]['message']);}else{logger[_0xb692('0xb')]('SquareRecording,\x20%s,\x20%s',_0x3912f8,_0xb692('0xe'));_0x25e2f6(_0x303474[_0xb692('0x13')][_0xb692('0x12')]);}})[_0xb692('0x14')](function(_0x5083d7){logger[_0xb692('0x10')](_0xb692('0xc'),_0x3912f8,_0x5083d7);_0x456a5e(_0x5083d7);});});}exports[_0xb692('0x15')]=function(_0x4d3ddb){var _0x4a3eba=this;return new Promise(function(_0x459cb3,_0x473c14){return db['SquareRecording'][_0xb692('0x16')](_0x4d3ddb[_0xb692('0x17')],{'raw':_0x4d3ddb[_0xb692('0x18')]?_0x4d3ddb[_0xb692('0x18')][_0xb692('0x19')]===undefined?!![]:![]:!![]})[_0xb692('0xa')](function(_0x3520e0){logger[_0xb692('0xb')](_0xb692('0x15'),_0x4d3ddb);logger['debug'](_0xb692('0x15'),_0x4d3ddb,JSON[_0xb692('0xf')](_0x3520e0));_0x459cb3(_0x3520e0);})['catch'](function(_0xafe923){logger[_0xb692('0x10')]('CreateSquareRecording',_0xafe923['message'],_0x4d3ddb);_0x473c14(_0x4a3eba[_0xb692('0x10')](0x1f4,_0xafe923['message']));});});}; \ No newline at end of file +var _0xb2b6=['raw','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','debug','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0x33469,_0xddbd64){var _0x2a8dbe=function(_0x4dfef1){while(--_0x4dfef1){_0x33469['push'](_0x33469['shift']());}};_0x2a8dbe(++_0xddbd64);}(_0xb2b6,0xeb));var _0x6b2b=function(_0xfe1621,_0x517769){_0xfe1621=_0xfe1621-0x0;var _0x3dbe30=_0xb2b6[_0xfe1621];return _0x3dbe30;};'use strict';var _=require('lodash');var util=require(_0x6b2b('0x0'));var moment=require(_0x6b2b('0x1'));var BPromise=require(_0x6b2b('0x2'));var rs=require(_0x6b2b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6b2b('0x4'));var logger=require(_0x6b2b('0x5'))('rpc');var config=require(_0x6b2b('0x6'));var jayson=require(_0x6b2b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26a1b0,_0x3cf394,_0x339683){return new BPromise(function(_0x44f21c,_0x3f8e36){return client[_0x6b2b('0x8')](_0x26a1b0,_0x339683)[_0x6b2b('0x9')](function(_0x11aa3b){logger[_0x6b2b('0xa')]('SquareRecording,\x20%s,\x20%s',_0x3cf394,'request\x20sent');logger[_0x6b2b('0xb')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3cf394,_0x6b2b('0xc'),JSON[_0x6b2b('0xd')](_0x11aa3b));if(_0x11aa3b[_0x6b2b('0xe')]){if(_0x11aa3b[_0x6b2b('0xe')][_0x6b2b('0xf')]===0x1f4){logger[_0x6b2b('0xe')](_0x6b2b('0x10'),_0x3cf394,_0x11aa3b[_0x6b2b('0xe')]['message']);return _0x3f8e36(_0x11aa3b[_0x6b2b('0xe')][_0x6b2b('0x11')]);}logger['error'](_0x6b2b('0x10'),_0x3cf394,_0x11aa3b['error'][_0x6b2b('0x11')]);return _0x44f21c(_0x11aa3b[_0x6b2b('0xe')][_0x6b2b('0x11')]);}else{logger[_0x6b2b('0xa')](_0x6b2b('0x10'),_0x3cf394,_0x6b2b('0xc'));_0x44f21c(_0x11aa3b[_0x6b2b('0x12')][_0x6b2b('0x11')]);}})[_0x6b2b('0x13')](function(_0x58ef1d){logger[_0x6b2b('0xe')](_0x6b2b('0x10'),_0x3cf394,_0x58ef1d);_0x3f8e36(_0x58ef1d);});});}exports[_0x6b2b('0x14')]=function(_0x78827c){var _0x4fc33c=this;return new Promise(function(_0x5f4606,_0x6c5bb7){return db[_0x6b2b('0x15')][_0x6b2b('0x16')](_0x78827c[_0x6b2b('0x17')],{'raw':_0x78827c['options']?_0x78827c[_0x6b2b('0x18')][_0x6b2b('0x19')]===undefined?!![]:![]:!![]})[_0x6b2b('0x9')](function(_0x384f6d){logger[_0x6b2b('0xa')](_0x6b2b('0x14'),_0x78827c);logger['debug'](_0x6b2b('0x14'),_0x78827c,JSON['stringify'](_0x384f6d));_0x5f4606(_0x384f6d);})[_0x6b2b('0x13')](function(_0x28a9a6){logger[_0x6b2b('0xe')]('CreateSquareRecording',_0x28a9a6[_0x6b2b('0x11')],_0x78827c);_0x6c5bb7(_0x4fc33c['error'](0x1f4,_0x28a9a6[_0x6b2b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d8e53e7..609714b 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(_0x2dfd0e,_0x13739e){var _0x343af6=function(_0x206e2f){while(--_0x206e2f){_0x2dfd0e['push'](_0x2dfd0e['shift']());}};_0x343af6(++_0x13739e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a1b5565..d99f08d 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 _0x194f=['sequelize','exports','STRING','DATE'];(function(_0x5d946b,_0x1a7996){var _0x5c2ea7=function(_0x3f4dc6){while(--_0x3f4dc6){_0x5d946b['push'](_0x5d946b['shift']());}};_0x5c2ea7(++_0x1a7996);}(_0x194f,0x188));var _0xf194=function(_0x2f2b66,_0x6825bd){_0x2f2b66=_0x2f2b66-0x0;var _0xdd99be=_0x194f[_0x2f2b66];return _0xdd99be;};'use strict';var Sequelize=require(_0xf194('0x0'));module[_0xf194('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xf194('0x2')]},'request':{'type':Sequelize[_0xf194('0x2')]},'channel':{'type':Sequelize[_0xf194('0x2')]},'language':{'type':Sequelize[_0xf194('0x2')]},'type':{'type':Sequelize[_0xf194('0x2')]},'uniqueid':{'type':Sequelize[_0xf194('0x2')]},'version':{'type':Sequelize[_0xf194('0x2')]},'callerid':{'type':Sequelize[_0xf194('0x2')]},'calleridname':{'type':Sequelize[_0xf194('0x2')]},'callingpres':{'type':Sequelize[_0xf194('0x2')]},'callingani2':{'type':Sequelize[_0xf194('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xf194('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf194('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xf194('0x2')]},'priority':{'type':Sequelize[_0xf194('0x2')]},'enhanced':{'type':Sequelize[_0xf194('0x2')]},'accountcode':{'type':Sequelize[_0xf194('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf194('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe32a=['BOOLEAN','exports','STRING','DATE'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe32a,0x125));var _0xae32=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xe32a[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');module[_0xae32('0x0')]={'network':{'type':Sequelize[_0xae32('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xae32('0x1')]},'channel':{'type':Sequelize[_0xae32('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xae32('0x1')]},'uniqueid':{'type':Sequelize[_0xae32('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xae32('0x1')]},'calleridname':{'type':Sequelize[_0xae32('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xae32('0x1')]},'callington':{'type':Sequelize[_0xae32('0x1')]},'callingtns':{'type':Sequelize[_0xae32('0x1')]},'dnid':{'type':Sequelize[_0xae32('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xae32('0x1')]},'accountcode':{'type':Sequelize[_0xae32('0x1')]},'threadid':{'type':Sequelize[_0xae32('0x1')]},'project_name':{'type':Sequelize[_0xae32('0x1')]},'joinAt':{'type':Sequelize[_0xae32('0x2')]},'leaveAt':{'type':Sequelize[_0xae32('0x2')]},'bot':{'type':Sequelize[_0xae32('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 29afd60..542841a 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 _0xf339=['findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','status','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options','SquareReport','includeAll','include'];(function(_0x2ea3a8,_0x5ec0a4){var _0x269226=function(_0x269c5b){while(--_0x269c5b){_0x2ea3a8['push'](_0x2ea3a8['shift']());}};_0x269226(++_0x5ec0a4);}(_0xf339,0xa8));var _0x9f33=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf339[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x9f33('0x0'));var rimraf=require(_0x9f33('0x1'));var zipdir=require(_0x9f33('0x2'));var jsonpatch=require(_0x9f33('0x3'));var rp=require(_0x9f33('0x4'));var moment=require(_0x9f33('0x5'));var BPromise=require(_0x9f33('0x6'));var Mustache=require('mustache');var util=require(_0x9f33('0x7'));var path=require(_0x9f33('0x8'));var sox=require('sox');var csv=require(_0x9f33('0x9'));var ejs=require(_0x9f33('0xa'));var fs=require('fs');var fs_extra=require(_0x9f33('0xb'));var _=require('lodash');var squel=require(_0x9f33('0xc'));var crypto=require(_0x9f33('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f33('0xe'));var toCsv=require(_0x9f33('0x9'));var querystring=require(_0x9f33('0xf'));var Papa=require(_0x9f33('0x10'));var Redis=require(_0x9f33('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f33('0x12'));var as=require(_0x9f33('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f33('0x14'))(_0x9f33('0x15'));var utils=require(_0x9f33('0x16'));var config=require(_0x9f33('0x17'));var licenseUtil=require(_0x9f33('0x18'));var db=require(_0x9f33('0x19'))['db'];function respondWithStatusCode(_0x34ed60,_0x16b11d){_0x16b11d=_0x16b11d||0xcc;return function(_0x37612b){if(_0x37612b){return _0x34ed60[_0x9f33('0x1a')](_0x16b11d);}return _0x34ed60['status'](_0x16b11d)[_0x9f33('0x1b')]();};}function respondWithResult(_0x3829a1,_0x1515c6){_0x1515c6=_0x1515c6||0xc8;return function(_0x456db5){if(_0x456db5){return _0x3829a1['status'](_0x1515c6)[_0x9f33('0x1c')](_0x456db5);}};}function respondWithFilteredResult(_0x1a1975,_0x833447){return function(_0x1e869d){if(_0x1e869d){var _0x1b0305=typeof _0x833447['offset']===_0x9f33('0x1d')&&typeof _0x833447[_0x9f33('0x1e')]===_0x9f33('0x1d');var _0x380cf2=_0x1e869d[_0x9f33('0x1f')];var _0x1efb78=_0x1b0305?0x0:_0x833447[_0x9f33('0x20')];var _0x53d9cd=_0x1b0305?_0x1e869d[_0x9f33('0x1f')]:_0x833447['offset']+_0x833447[_0x9f33('0x1e')];var _0x128087;if(_0x53d9cd>=_0x380cf2){_0x53d9cd=_0x380cf2;_0x128087=0xc8;}else{_0x128087=0xce;}_0x1a1975['status'](_0x128087);return _0x1a1975[_0x9f33('0x21')](_0x9f33('0x22'),_0x1efb78+'-'+_0x53d9cd+'/'+_0x380cf2)['json'](_0x1e869d);}return null;};}function patchUpdates(_0x255949){return function(_0x136fa1){try{jsonpatch[_0x9f33('0x23')](_0x136fa1,_0x255949,!![]);}catch(_0x7913ba){return BPromise[_0x9f33('0x24')](_0x7913ba);}return _0x136fa1[_0x9f33('0x25')]();};}function saveUpdates(_0x2f129e,_0x929ca6){return function(_0xde4816){if(_0xde4816){return _0xde4816[_0x9f33('0x26')](_0x2f129e)[_0x9f33('0x27')](function(_0x27656d){return _0x27656d;});}return null;};}function removeEntity(_0x39704f,_0x4b47ea){return function(_0x12b505){if(_0x12b505){return _0x12b505['destroy']()['then'](function(){_0x39704f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc51a,_0x1d99a7){return function(_0x250a06){if(!_0x250a06){_0x2cc51a[_0x9f33('0x1a')](0x194);}return _0x250a06;};}function handleError(_0x42bde4,_0x4ae9ea){_0x4ae9ea=_0x4ae9ea||0x1f4;return function(_0x11dd2){logger[_0x9f33('0x28')](_0x11dd2['stack']);if(_0x11dd2[_0x9f33('0x29')]){delete _0x11dd2[_0x9f33('0x29')];}_0x42bde4[_0x9f33('0x2a')](_0x4ae9ea)[_0x9f33('0x2b')](_0x11dd2);};}exports[_0x9f33('0x2c')]=function(_0x55c522,_0x3ad1b2){var _0x2fc8ab={},_0x8c9530={},_0x4700bf={'count':0x0,'rows':[]};var _0x2069d7=_['map'](db['SquareReport'][_0x9f33('0x2d')],function(_0x3d84f7){return{'name':_0x3d84f7[_0x9f33('0x2e')],'type':_0x3d84f7[_0x9f33('0x2f')][_0x9f33('0x30')]};});_0x8c9530[_0x9f33('0x31')]=_[_0x9f33('0x32')](_0x2069d7,_0x9f33('0x29'));_0x8c9530['query']=_[_0x9f33('0x33')](_0x55c522[_0x9f33('0x34')]);_0x8c9530[_0x9f33('0x35')]=_['intersection'](_0x8c9530[_0x9f33('0x31')],_0x8c9530['query']);_0x2fc8ab[_0x9f33('0x36')]=_[_0x9f33('0x37')](_0x8c9530[_0x9f33('0x31')],qs[_0x9f33('0x38')](_0x55c522[_0x9f33('0x34')][_0x9f33('0x38')]));_0x2fc8ab[_0x9f33('0x36')]=_0x2fc8ab['attributes'][_0x9f33('0x39')]?_0x2fc8ab[_0x9f33('0x36')]:_0x8c9530[_0x9f33('0x31')];if(!_0x55c522[_0x9f33('0x34')]['hasOwnProperty'](_0x9f33('0x3a'))){_0x2fc8ab[_0x9f33('0x1e')]=qs[_0x9f33('0x1e')](_0x55c522[_0x9f33('0x34')]['limit']);_0x2fc8ab[_0x9f33('0x20')]=qs[_0x9f33('0x20')](_0x55c522[_0x9f33('0x34')][_0x9f33('0x20')]);}_0x2fc8ab[_0x9f33('0x3b')]=qs['sort'](_0x55c522[_0x9f33('0x34')]['sort']);_0x2fc8ab[_0x9f33('0x3c')]=qs[_0x9f33('0x35')](_[_0x9f33('0x3d')](_0x55c522[_0x9f33('0x34')],_0x8c9530[_0x9f33('0x35')]),_0x2069d7);if(_0x55c522[_0x9f33('0x34')][_0x9f33('0x3e')]){_0x2fc8ab[_0x9f33('0x3c')]=_['merge'](_0x2fc8ab[_0x9f33('0x3c')],{'$or':_[_0x9f33('0x32')](_0x2069d7,function(_0x13dbda){if(_0x13dbda[_0x9f33('0x2f')]!==_0x9f33('0x3f')){var _0x3074fe={};_0x3074fe[_0x13dbda[_0x9f33('0x29')]]={'$like':'%'+_0x55c522[_0x9f33('0x34')]['filter']+'%'};return _0x3074fe;}})});}_0x2fc8ab=_[_0x9f33('0x40')]({},_0x2fc8ab,_0x55c522[_0x9f33('0x41')]);var _0x774301={'where':_0x2fc8ab[_0x9f33('0x3c')]};return db[_0x9f33('0x42')]['count'](_0x774301)['then'](function(_0x301801){_0x4700bf[_0x9f33('0x1f')]=_0x301801;if(_0x55c522[_0x9f33('0x34')][_0x9f33('0x43')]){_0x2fc8ab[_0x9f33('0x44')]=[{'all':!![]}];}return db[_0x9f33('0x42')][_0x9f33('0x45')](_0x2fc8ab);})[_0x9f33('0x27')](function(_0x328aa0){_0x4700bf[_0x9f33('0x46')]=_0x328aa0;return _0x4700bf;})[_0x9f33('0x27')](respondWithFilteredResult(_0x3ad1b2,_0x2fc8ab))[_0x9f33('0x47')](handleError(_0x3ad1b2,null));};exports[_0x9f33('0x48')]=function(_0x50d177,_0xfd77bb){var _0x589009={'raw':!![],'where':{'id':_0x50d177[_0x9f33('0x49')]['id']}},_0x520efb={};_0x520efb[_0x9f33('0x31')]=_['keys'](db[_0x9f33('0x42')][_0x9f33('0x2d')]);_0x520efb['query']=_[_0x9f33('0x33')](_0x50d177[_0x9f33('0x34')]);_0x520efb['filters']=_[_0x9f33('0x37')](_0x520efb['model'],_0x520efb[_0x9f33('0x34')]);_0x589009[_0x9f33('0x36')]=_[_0x9f33('0x37')](_0x520efb[_0x9f33('0x31')],qs['fields'](_0x50d177[_0x9f33('0x34')][_0x9f33('0x38')]));_0x589009[_0x9f33('0x36')]=_0x589009['attributes'][_0x9f33('0x39')]?_0x589009[_0x9f33('0x36')]:_0x520efb[_0x9f33('0x31')];if(_0x50d177[_0x9f33('0x34')][_0x9f33('0x43')]){_0x589009['include']=[{'all':!![]}];}_0x589009=_[_0x9f33('0x40')]({},_0x589009,_0x50d177[_0x9f33('0x41')]);return db['SquareReport'][_0x9f33('0x4a')](_0x589009)[_0x9f33('0x27')](handleEntityNotFound(_0xfd77bb,null))[_0x9f33('0x27')](respondWithResult(_0xfd77bb,null))[_0x9f33('0x47')](handleError(_0xfd77bb,null));};exports[_0x9f33('0x4b')]=function(_0x209479,_0x322f51){return db[_0x9f33('0x42')][_0x9f33('0x4b')](_0x209479['body'],{})[_0x9f33('0x27')](respondWithResult(_0x322f51,0xc9))['catch'](handleError(_0x322f51,null));};exports[_0x9f33('0x26')]=function(_0x4312ee,_0x41f5f6){if(_0x4312ee['body']['id']){delete _0x4312ee[_0x9f33('0x4c')]['id'];}return db[_0x9f33('0x42')][_0x9f33('0x4a')]({'where':{'id':_0x4312ee[_0x9f33('0x49')]['id']}})['then'](handleEntityNotFound(_0x41f5f6,null))[_0x9f33('0x27')](saveUpdates(_0x4312ee[_0x9f33('0x4c')],null))[_0x9f33('0x27')](respondWithResult(_0x41f5f6,null))[_0x9f33('0x47')](handleError(_0x41f5f6,null));};exports[_0x9f33('0x4d')]=function(_0x2ab185,_0x39839c){return db['SquareReport']['find']({'where':{'id':_0x2ab185[_0x9f33('0x49')]['id']}})[_0x9f33('0x27')](handleEntityNotFound(_0x39839c,null))['then'](removeEntity(_0x39839c,null))['catch'](handleError(_0x39839c,null));};exports['describe']=function(_0x11628e,_0x493c47){return db[_0x9f33('0x42')][_0x9f33('0x4e')]()[_0x9f33('0x27')](respondWithResult(_0x493c47,null))[_0x9f33('0x47')](handleError(_0x493c47,null));}; \ No newline at end of file +var _0xaa61=['model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareReport','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key'];(function(_0x1ba9b6,_0x24db56){var _0x44fbd2=function(_0x37f5a0){while(--_0x37f5a0){_0x1ba9b6['push'](_0x1ba9b6['shift']());}};_0x44fbd2(++_0x24db56);}(_0xaa61,0x106));var _0x1aa6=function(_0x2674bb,_0xba2d50){_0x2674bb=_0x2674bb-0x0;var _0x458718=_0xaa61[_0x2674bb];return _0x458718;};'use strict';var emlformat=require(_0x1aa6('0x0'));var rimraf=require(_0x1aa6('0x1'));var zipdir=require(_0x1aa6('0x2'));var jsonpatch=require(_0x1aa6('0x3'));var rp=require('request-promise');var moment=require(_0x1aa6('0x4'));var BPromise=require(_0x1aa6('0x5'));var Mustache=require(_0x1aa6('0x6'));var util=require(_0x1aa6('0x7'));var path=require('path');var sox=require(_0x1aa6('0x8'));var csv=require(_0x1aa6('0x9'));var ejs=require(_0x1aa6('0xa'));var fs=require('fs');var fs_extra=require(_0x1aa6('0xb'));var _=require(_0x1aa6('0xc'));var squel=require(_0x1aa6('0xd'));var crypto=require(_0x1aa6('0xe'));var jsforce=require(_0x1aa6('0xf'));var deskjs=require(_0x1aa6('0x10'));var toCsv=require(_0x1aa6('0x9'));var querystring=require(_0x1aa6('0x11'));var Papa=require(_0x1aa6('0x12'));var Redis=require(_0x1aa6('0x13'));var authService=require(_0x1aa6('0x14'));var qs=require(_0x1aa6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1aa6('0x16'));var logger=require(_0x1aa6('0x17'))(_0x1aa6('0x18'));var utils=require(_0x1aa6('0x19'));var config=require(_0x1aa6('0x1a'));var licenseUtil=require(_0x1aa6('0x1b'));var db=require(_0x1aa6('0x1c'))['db'];function respondWithStatusCode(_0x243613,_0x8b7627){_0x8b7627=_0x8b7627||0xcc;return function(_0x418411){if(_0x418411){return _0x243613['sendStatus'](_0x8b7627);}return _0x243613['status'](_0x8b7627)[_0x1aa6('0x1d')]();};}function respondWithResult(_0x2d2880,_0x520a66){_0x520a66=_0x520a66||0xc8;return function(_0x9698ed){if(_0x9698ed){return _0x2d2880[_0x1aa6('0x1e')](_0x520a66)[_0x1aa6('0x1f')](_0x9698ed);}};}function respondWithFilteredResult(_0x5b917c,_0x856e09){return function(_0x6d7868){if(_0x6d7868){var _0x4ab997=typeof _0x856e09[_0x1aa6('0x20')]==='undefined'&&typeof _0x856e09[_0x1aa6('0x21')]===_0x1aa6('0x22');var _0x467c34=_0x6d7868[_0x1aa6('0x23')];var _0x25669a=_0x4ab997?0x0:_0x856e09[_0x1aa6('0x20')];var _0x3ec5ed=_0x4ab997?_0x6d7868[_0x1aa6('0x23')]:_0x856e09[_0x1aa6('0x20')]+_0x856e09[_0x1aa6('0x21')];var _0x3d8e42;if(_0x3ec5ed>=_0x467c34){_0x3ec5ed=_0x467c34;_0x3d8e42=0xc8;}else{_0x3d8e42=0xce;}_0x5b917c[_0x1aa6('0x1e')](_0x3d8e42);return _0x5b917c[_0x1aa6('0x24')](_0x1aa6('0x25'),_0x25669a+'-'+_0x3ec5ed+'/'+_0x467c34)[_0x1aa6('0x1f')](_0x6d7868);}return null;};}function patchUpdates(_0x455481){return function(_0x13ed46){try{jsonpatch[_0x1aa6('0x26')](_0x13ed46,_0x455481,!![]);}catch(_0x5ab23c){return BPromise[_0x1aa6('0x27')](_0x5ab23c);}return _0x13ed46['save']();};}function saveUpdates(_0x53f978,_0x424cb7){return function(_0x5aefa4){if(_0x5aefa4){return _0x5aefa4['update'](_0x53f978)['then'](function(_0x32555d){return _0x32555d;});}return null;};}function removeEntity(_0x4c4e14,_0x487ba7){return function(_0x1437f3){if(_0x1437f3){return _0x1437f3[_0x1aa6('0x28')]()[_0x1aa6('0x29')](function(){_0x4c4e14['status'](0xcc)[_0x1aa6('0x1d')]();});}};}function handleEntityNotFound(_0x44e0a9,_0x107536){return function(_0x4baeaf){if(!_0x4baeaf){_0x44e0a9['sendStatus'](0x194);}return _0x4baeaf;};}function handleError(_0x390c31,_0x3b6fd8){_0x3b6fd8=_0x3b6fd8||0x1f4;return function(_0x30812c){logger['error'](_0x30812c[_0x1aa6('0x2a')]);if(_0x30812c[_0x1aa6('0x2b')]){delete _0x30812c[_0x1aa6('0x2b')];}_0x390c31['status'](_0x3b6fd8)[_0x1aa6('0x2c')](_0x30812c);};}exports[_0x1aa6('0x2d')]=function(_0x934c1e,_0x26c54f){var _0x676ae0={},_0x3267e6={},_0x39efc3={'count':0x0,'rows':[]};var _0x5ad98e=_['map'](db['SquareReport'][_0x1aa6('0x2e')],function(_0x3aebec){return{'name':_0x3aebec[_0x1aa6('0x2f')],'type':_0x3aebec[_0x1aa6('0x30')][_0x1aa6('0x31')]};});_0x3267e6[_0x1aa6('0x32')]=_[_0x1aa6('0x33')](_0x5ad98e,_0x1aa6('0x2b'));_0x3267e6['query']=_[_0x1aa6('0x34')](_0x934c1e[_0x1aa6('0x35')]);_0x3267e6[_0x1aa6('0x36')]=_[_0x1aa6('0x37')](_0x3267e6['model'],_0x3267e6[_0x1aa6('0x35')]);_0x676ae0[_0x1aa6('0x38')]=_['intersection'](_0x3267e6[_0x1aa6('0x32')],qs[_0x1aa6('0x39')](_0x934c1e[_0x1aa6('0x35')]['fields']));_0x676ae0[_0x1aa6('0x38')]=_0x676ae0[_0x1aa6('0x38')]['length']?_0x676ae0[_0x1aa6('0x38')]:_0x3267e6[_0x1aa6('0x32')];if(!_0x934c1e['query'][_0x1aa6('0x3a')](_0x1aa6('0x3b'))){_0x676ae0[_0x1aa6('0x21')]=qs[_0x1aa6('0x21')](_0x934c1e[_0x1aa6('0x35')][_0x1aa6('0x21')]);_0x676ae0[_0x1aa6('0x20')]=qs['offset'](_0x934c1e[_0x1aa6('0x35')]['offset']);}_0x676ae0[_0x1aa6('0x3c')]=qs[_0x1aa6('0x3d')](_0x934c1e[_0x1aa6('0x35')][_0x1aa6('0x3d')]);_0x676ae0[_0x1aa6('0x3e')]=qs[_0x1aa6('0x36')](_[_0x1aa6('0x3f')](_0x934c1e['query'],_0x3267e6['filters']),_0x5ad98e);if(_0x934c1e['query'][_0x1aa6('0x40')]){_0x676ae0[_0x1aa6('0x3e')]=_[_0x1aa6('0x41')](_0x676ae0[_0x1aa6('0x3e')],{'$or':_[_0x1aa6('0x33')](_0x5ad98e,function(_0x5c7b87){if(_0x5c7b87[_0x1aa6('0x30')]!==_0x1aa6('0x42')){var _0x328641={};_0x328641[_0x5c7b87['name']]={'$like':'%'+_0x934c1e['query'][_0x1aa6('0x40')]+'%'};return _0x328641;}})});}_0x676ae0=_['merge']({},_0x676ae0,_0x934c1e['options']);var _0x2957ad={'where':_0x676ae0[_0x1aa6('0x3e')]};return db[_0x1aa6('0x43')][_0x1aa6('0x23')](_0x2957ad)[_0x1aa6('0x29')](function(_0x31f50f){_0x39efc3[_0x1aa6('0x23')]=_0x31f50f;if(_0x934c1e[_0x1aa6('0x35')][_0x1aa6('0x44')]){_0x676ae0[_0x1aa6('0x45')]=[{'all':!![]}];}return db[_0x1aa6('0x43')][_0x1aa6('0x46')](_0x676ae0);})[_0x1aa6('0x29')](function(_0x4d47a7){_0x39efc3['rows']=_0x4d47a7;return _0x39efc3;})['then'](respondWithFilteredResult(_0x26c54f,_0x676ae0))[_0x1aa6('0x47')](handleError(_0x26c54f,null));};exports[_0x1aa6('0x48')]=function(_0x14ddb5,_0xf3072d){var _0x467a8c={'raw':!![],'where':{'id':_0x14ddb5[_0x1aa6('0x49')]['id']}},_0x15d208={};_0x15d208[_0x1aa6('0x32')]=_[_0x1aa6('0x34')](db['SquareReport'][_0x1aa6('0x2e')]);_0x15d208[_0x1aa6('0x35')]=_[_0x1aa6('0x34')](_0x14ddb5[_0x1aa6('0x35')]);_0x15d208['filters']=_[_0x1aa6('0x37')](_0x15d208[_0x1aa6('0x32')],_0x15d208[_0x1aa6('0x35')]);_0x467a8c[_0x1aa6('0x38')]=_[_0x1aa6('0x37')](_0x15d208['model'],qs[_0x1aa6('0x39')](_0x14ddb5[_0x1aa6('0x35')]['fields']));_0x467a8c[_0x1aa6('0x38')]=_0x467a8c['attributes']['length']?_0x467a8c[_0x1aa6('0x38')]:_0x15d208['model'];if(_0x14ddb5['query'][_0x1aa6('0x44')]){_0x467a8c[_0x1aa6('0x45')]=[{'all':!![]}];}_0x467a8c=_[_0x1aa6('0x41')]({},_0x467a8c,_0x14ddb5['options']);return db[_0x1aa6('0x43')]['find'](_0x467a8c)[_0x1aa6('0x29')](handleEntityNotFound(_0xf3072d,null))[_0x1aa6('0x29')](respondWithResult(_0xf3072d,null))['catch'](handleError(_0xf3072d,null));};exports[_0x1aa6('0x4a')]=function(_0x2d2869,_0x282bf0){return db[_0x1aa6('0x43')][_0x1aa6('0x4a')](_0x2d2869[_0x1aa6('0x4b')],{})[_0x1aa6('0x29')](respondWithResult(_0x282bf0,0xc9))['catch'](handleError(_0x282bf0,null));};exports['update']=function(_0x2d1e20,_0x59ad75){if(_0x2d1e20[_0x1aa6('0x4b')]['id']){delete _0x2d1e20[_0x1aa6('0x4b')]['id'];}return db['SquareReport'][_0x1aa6('0x4c')]({'where':{'id':_0x2d1e20[_0x1aa6('0x49')]['id']}})[_0x1aa6('0x29')](handleEntityNotFound(_0x59ad75,null))[_0x1aa6('0x29')](saveUpdates(_0x2d1e20[_0x1aa6('0x4b')],null))['then'](respondWithResult(_0x59ad75,null))[_0x1aa6('0x47')](handleError(_0x59ad75,null));};exports[_0x1aa6('0x28')]=function(_0xd44fa7,_0x27d26e){return db[_0x1aa6('0x43')][_0x1aa6('0x4c')]({'where':{'id':_0xd44fa7[_0x1aa6('0x49')]['id']}})[_0x1aa6('0x29')](handleEntityNotFound(_0x27d26e,null))[_0x1aa6('0x29')](removeEntity(_0x27d26e,null))[_0x1aa6('0x47')](handleError(_0x27d26e,null));};exports[_0x1aa6('0x4d')]=function(_0x4e83eb,_0x585ffd){return db['SquareReport']['describe']()[_0x1aa6('0x29')](respondWithResult(_0x585ffd,null))[_0x1aa6('0x47')](handleError(_0x585ffd,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a0512f8..5f4f647 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 _0x5b40=['moment','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','api'];(function(_0x26d741,_0x18409b){var _0x564540=function(_0x23250b){while(--_0x23250b){_0x26d741['push'](_0x26d741['shift']());}};_0x564540(++_0x18409b);}(_0x5b40,0x1a2));var _0x05b4=function(_0xf5b1be,_0x5b6e02){_0xf5b1be=_0xf5b1be-0x0;var _0x10ccab=_0x5b40[_0xf5b1be];return _0x10ccab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x05b4('0x0'))(_0x05b4('0x1'));var moment=require(_0x05b4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x05b4('0x3'));var config=require(_0x05b4('0x4'));var attributes=require(_0x05b4('0x5'));module['exports']=function(_0x5f28f7,_0x4e4522){return _0x5f28f7[_0x05b4('0x6')](_0x05b4('0x7'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x05b4('0x8'),'fields':[_0x05b4('0x9'),_0x05b4('0xa')]},{'name':_0x05b4('0xb'),'fields':[_0x05b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53be=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger'];(function(_0x53f1de,_0x37d8d3){var _0x2fa505=function(_0x220b34){while(--_0x220b34){_0x53f1de['push'](_0x53f1de['shift']());}};_0x2fa505(++_0x37d8d3);}(_0x53be,0x1b8));var _0xe53b=function(_0x47248d,_0x21ad75){_0x47248d=_0x47248d-0x0;var _0xd69b6d=_0x53be[_0x47248d];return _0xd69b6d;};'use strict';var _=require(_0xe53b('0x0'));var util=require('util');var logger=require(_0xe53b('0x1'))(_0xe53b('0x2'));var moment=require(_0xe53b('0x3'));var BPromise=require(_0xe53b('0x4'));var rp=require(_0xe53b('0x5'));var fs=require('fs');var path=require(_0xe53b('0x6'));var rimraf=require(_0xe53b('0x7'));var config=require(_0xe53b('0x8'));var attributes=require('./squareReport.attributes');module[_0xe53b('0x9')]=function(_0x10bbc0,_0x4267bc){return _0x10bbc0[_0xe53b('0xa')](_0xe53b('0xb'),attributes,{'tableName':_0xe53b('0xc'),'paranoid':![],'indexes':[{'name':_0xe53b('0xd'),'fields':[_0xe53b('0xe'),_0xe53b('0xf')]},{'name':_0xe53b('0x10'),'fields':[_0xe53b('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 9a56c93..7882112 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 _0x4d8f=['info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x4d8f,0xdf));var _0xf4d8=function(_0x4d6e5c,_0x116c67){_0x4d6e5c=_0x4d6e5c-0x0;var _0x11bfa3=_0x4d8f[_0x4d6e5c];return _0x11bfa3;};'use strict';var _=require('lodash');var util=require(_0xf4d8('0x0'));var moment=require('moment');var BPromise=require(_0xf4d8('0x1'));var rs=require(_0xf4d8('0x2'));var fs=require('fs');var Redis=require(_0xf4d8('0x3'));var db=require(_0xf4d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf4d8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf4d8('0x6')][_0xf4d8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43c1d1,_0x27de15,_0x556b70){return new BPromise(function(_0x722629,_0x499fa8){return client[_0xf4d8('0x8')](_0x43c1d1,_0x556b70)[_0xf4d8('0x9')](function(_0x2f6fef){logger['info'](_0xf4d8('0xa'),_0x27de15,_0xf4d8('0xb'));logger[_0xf4d8('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x27de15,_0xf4d8('0xb'),JSON[_0xf4d8('0xd')](_0x2f6fef));if(_0x2f6fef['error']){if(_0x2f6fef[_0xf4d8('0xe')][_0xf4d8('0xf')]===0x1f4){logger[_0xf4d8('0xe')](_0xf4d8('0xa'),_0x27de15,_0x2f6fef['error']['message']);return _0x499fa8(_0x2f6fef[_0xf4d8('0xe')][_0xf4d8('0x10')]);}logger[_0xf4d8('0xe')](_0xf4d8('0xa'),_0x27de15,_0x2f6fef['error'][_0xf4d8('0x10')]);return _0x722629(_0x2f6fef[_0xf4d8('0xe')][_0xf4d8('0x10')]);}else{logger[_0xf4d8('0x11')](_0xf4d8('0xa'),_0x27de15,'request\x20sent');_0x722629(_0x2f6fef[_0xf4d8('0x12')]['message']);}})[_0xf4d8('0x13')](function(_0x39c287){logger['error'](_0xf4d8('0xa'),_0x27de15,_0x39c287);_0x499fa8(_0x39c287);});});}exports[_0xf4d8('0x14')]=function(_0x4275ba){var _0x418e13=this;return new Promise(function(_0x5edeaf,_0x5e3788){return db[_0xf4d8('0x15')][_0xf4d8('0x16')](_0x4275ba[_0xf4d8('0x17')],{'raw':_0x4275ba['options']?_0x4275ba[_0xf4d8('0x18')][_0xf4d8('0x19')]===undefined?!![]:![]:!![]})[_0xf4d8('0x9')](function(_0x54b37d){logger[_0xf4d8('0x11')](_0xf4d8('0x14'),_0x4275ba);logger[_0xf4d8('0xc')](_0xf4d8('0x14'),_0x4275ba,JSON[_0xf4d8('0xd')](_0x54b37d));_0x5edeaf(_0x54b37d);})['catch'](function(_0x68d5b1){logger['error']('CreateSquareReport',_0x68d5b1[_0xf4d8('0x10')],_0x4275ba);_0x5e3788(_0x418e13[_0xf4d8('0xe')](0x1f4,_0x68d5b1[_0xf4d8('0x10')]));});});};exports[_0xf4d8('0x1a')]=function(_0x5b3e00){var _0x3e5b33=this;return new Promise(function(_0x34f73a,_0x1c5301){return db[_0xf4d8('0x15')][_0xf4d8('0x1b')](_0x5b3e00[_0xf4d8('0x17')],{'raw':_0x5b3e00['options']?_0x5b3e00[_0xf4d8('0x18')][_0xf4d8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b3e00[_0xf4d8('0x18')]?_0x5b3e00[_0xf4d8('0x18')][_0xf4d8('0x1c')]||null:null,'attributes':_0x5b3e00['options']?_0x5b3e00[_0xf4d8('0x18')]['attributes']||null:null,'limit':_0x5b3e00[_0xf4d8('0x18')]?_0x5b3e00[_0xf4d8('0x18')][_0xf4d8('0x1d')]||null:null})[_0xf4d8('0x9')](function(_0x9819f6){logger[_0xf4d8('0x11')](_0xf4d8('0x1a'),_0x5b3e00);logger[_0xf4d8('0xc')](_0xf4d8('0x1a'),_0x5b3e00,JSON[_0xf4d8('0xd')](_0x9819f6));_0x34f73a(_0x9819f6);})['catch'](function(_0xdfba9a){logger[_0xf4d8('0xe')]('UpdateSquareReport',_0xdfba9a['message'],_0x5b3e00);_0x1c5301(_0x3e5b33[_0xf4d8('0xe')](0x1f4,_0xdfba9a[_0xf4d8('0x10')]));});});}; \ No newline at end of file +var _0xd775=['result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x43d6a8,_0x5c6bef){var _0x4d1ffe=function(_0x51f0bf){while(--_0x51f0bf){_0x43d6a8['push'](_0x43d6a8['shift']());}};_0x4d1ffe(++_0x5c6bef);}(_0xd775,0x18e));var _0x5d77=function(_0x2254b8,_0x5d2384){_0x2254b8=_0x2254b8-0x0;var _0xc7514e=_0xd775[_0x2254b8];return _0xc7514e;};'use strict';var _=require(_0x5d77('0x0'));var util=require(_0x5d77('0x1'));var moment=require(_0x5d77('0x2'));var BPromise=require(_0x5d77('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d77('0x4'));var db=require(_0x5d77('0x5'))['db'];var utils=require(_0x5d77('0x6'));var logger=require(_0x5d77('0x7'))(_0x5d77('0x8'));var config=require(_0x5d77('0x9'));var jayson=require(_0x5d77('0xa'));var client=jayson[_0x5d77('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4eeb,_0x25fe83,_0xe41cc8){return new BPromise(function(_0x3df699,_0x4f2a00){return client['request'](_0x3c4eeb,_0xe41cc8)[_0x5d77('0xc')](function(_0x30fdfd){logger[_0x5d77('0xd')](_0x5d77('0xe'),_0x25fe83,'request\x20sent');logger[_0x5d77('0xf')](_0x5d77('0x10'),_0x25fe83,'request\x20sent',JSON[_0x5d77('0x11')](_0x30fdfd));if(_0x30fdfd[_0x5d77('0x12')]){if(_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x13')]===0x1f4){logger[_0x5d77('0x12')]('SquareReport,\x20%s,\x20%s',_0x25fe83,_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x14')]);return _0x4f2a00(_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x14')]);}logger[_0x5d77('0x12')]('SquareReport,\x20%s,\x20%s',_0x25fe83,_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x14')]);return _0x3df699(_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x14')]);}else{logger[_0x5d77('0xd')]('SquareReport,\x20%s,\x20%s',_0x25fe83,_0x5d77('0x15'));_0x3df699(_0x30fdfd[_0x5d77('0x16')][_0x5d77('0x14')]);}})[_0x5d77('0x17')](function(_0x70c377){logger[_0x5d77('0x12')](_0x5d77('0xe'),_0x25fe83,_0x70c377);_0x4f2a00(_0x70c377);});});}exports[_0x5d77('0x18')]=function(_0x2c1f6b){var _0x27588f=this;return new Promise(function(_0x4c953d,_0x535fb9){return db[_0x5d77('0x19')][_0x5d77('0x1a')](_0x2c1f6b[_0x5d77('0x1b')],{'raw':_0x2c1f6b[_0x5d77('0x1c')]?_0x2c1f6b[_0x5d77('0x1c')][_0x5d77('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x285c5f){logger[_0x5d77('0xd')](_0x5d77('0x18'),_0x2c1f6b);logger[_0x5d77('0xf')](_0x5d77('0x18'),_0x2c1f6b,JSON[_0x5d77('0x11')](_0x285c5f));_0x4c953d(_0x285c5f);})[_0x5d77('0x17')](function(_0x4b7e24){logger['error'](_0x5d77('0x18'),_0x4b7e24[_0x5d77('0x14')],_0x2c1f6b);_0x535fb9(_0x27588f[_0x5d77('0x12')](0x1f4,_0x4b7e24[_0x5d77('0x14')]));});});};exports[_0x5d77('0x1e')]=function(_0x228f6d){var _0x4df3bd=this;return new Promise(function(_0x48b75e,_0x45b8a3){return db[_0x5d77('0x19')][_0x5d77('0x1f')](_0x228f6d[_0x5d77('0x1b')],{'raw':_0x228f6d['options']?_0x228f6d[_0x5d77('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x228f6d[_0x5d77('0x1c')]?_0x228f6d['options'][_0x5d77('0x20')]||null:null,'attributes':_0x228f6d[_0x5d77('0x1c')]?_0x228f6d[_0x5d77('0x1c')][_0x5d77('0x21')]||null:null,'limit':_0x228f6d[_0x5d77('0x1c')]?_0x228f6d['options'][_0x5d77('0x22')]||null:null})['then'](function(_0x242b4c){logger['info']('UpdateSquareReport',_0x228f6d);logger[_0x5d77('0xf')]('UpdateSquareReport',_0x228f6d,JSON[_0x5d77('0x11')](_0x242b4c));_0x48b75e(_0x242b4c);})['catch'](function(_0x3aaa5e){logger['error'](_0x5d77('0x1e'),_0x3aaa5e['message'],_0x228f6d);_0x45b8a3(_0x4df3bd['error'](0x1f4,_0x3aaa5e[_0x5d77('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index df3a9a5..2eb5b6b 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 _0x3813=['exports','path','connect-timeout','Router','fs-extra','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x164a85,_0x52f341){var _0x4e40c4=function(_0x3e692e){while(--_0x3e692e){_0x164a85['push'](_0x164a85['shift']());}};_0x4e40c4(++_0x52f341);}(_0x3813,0xd2));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3381('0x0'));var timeout=require(_0x3381('0x1'));var express=require('express');var router=express[_0x3381('0x2')]();var fs_extra=require(_0x3381('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3381('0x4'));var controller=require(_0x3381('0x5'));router[_0x3381('0x6')]('/',auth[_0x3381('0x7')](),controller[_0x3381('0x8')]);router[_0x3381('0x6')]('/describe',auth[_0x3381('0x7')](),controller[_0x3381('0x9')]);router['get'](_0x3381('0xa'),auth[_0x3381('0x7')](),controller[_0x3381('0xb')]);router[_0x3381('0xc')]('/',auth[_0x3381('0x7')](),controller[_0x3381('0xd')]);router[_0x3381('0xe')](_0x3381('0xa'),auth['isAuthenticated'](),controller[_0x3381('0xf')]);router[_0x3381('0x10')](_0x3381('0xa'),auth[_0x3381('0x7')](),controller[_0x3381('0x11')]);module[_0x3381('0x12')]=router; \ No newline at end of file +var _0x9f5d=['post','create','put','/:id','update','delete','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/describe','isAuthenticated','get','show'];(function(_0x50c35f,_0x25bcd3){var _0x1d9627=function(_0x3d0007){while(--_0x3d0007){_0x50c35f['push'](_0x50c35f['shift']());}};_0x1d9627(++_0x25bcd3);}(_0x9f5d,0x1a6));var _0xd9f5=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x9f5d[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd9f5('0x0'));var express=require(_0xd9f5('0x1'));var router=express['Router']();var fs_extra=require(_0xd9f5('0x2'));var auth=require(_0xd9f5('0x3'));var interaction=require(_0xd9f5('0x4'));var config=require(_0xd9f5('0x5'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd9f5('0x6'),auth[_0xd9f5('0x7')](),controller['describe']);router[_0xd9f5('0x8')]('/:id',auth[_0xd9f5('0x7')](),controller[_0xd9f5('0x9')]);router[_0xd9f5('0xa')]('/',auth['isAuthenticated'](),controller[_0xd9f5('0xb')]);router[_0xd9f5('0xc')](_0xd9f5('0xd'),auth[_0xd9f5('0x7')](),controller[_0xd9f5('0xe')]);router[_0xd9f5('0xf')](_0xd9f5('0xd'),auth[_0xd9f5('0x7')](),controller[_0xd9f5('0x10')]);module[_0xd9f5('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 37f1e28..0513fb4 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 _0x3306=['sequelize','exports','STRING','TEXT'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x3306,0x1e0));var _0x6330=function(_0x1a6543,_0x5d0116){_0x1a6543=_0x1a6543-0x0;var _0x12ba9a=_0x3306[_0x1a6543];return _0x12ba9a;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'uniqueid':{'type':Sequelize[_0x6330('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6330('0x2')]},'data':{'type':Sequelize[_0x6330('0x3')]},'project_name':{'type':Sequelize[_0x6330('0x2')]},'callerid':{'type':Sequelize[_0x6330('0x2')]}}; \ No newline at end of file +var _0x891b=['TEXT','STRING'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x891b,0x177));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb891('0x0')]},'node':{'type':Sequelize[_0xb891('0x0')]},'application':{'type':Sequelize[_0xb891('0x0')]},'data':{'type':Sequelize[_0xb891('0x1')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb891('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a6ff9b5..40b9870 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 _0x9465=['index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send'];(function(_0x4f2654,_0xddb1ad){var _0x3858b6=function(_0x2ff80e){while(--_0x2ff80e){_0x4f2654['push'](_0x4f2654['shift']());}};_0x3858b6(++_0xddb1ad);}(_0x9465,0xbc));var _0x5946=function(_0x2002b3,_0x11e91c){_0x2002b3=_0x2002b3-0x0;var _0x2756f0=_0x9465[_0x2002b3];return _0x2756f0;};'use strict';var emlformat=require(_0x5946('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5946('0x1'));var rp=require(_0x5946('0x2'));var moment=require(_0x5946('0x3'));var BPromise=require(_0x5946('0x4'));var Mustache=require(_0x5946('0x5'));var util=require('util');var path=require(_0x5946('0x6'));var sox=require(_0x5946('0x7'));var csv=require(_0x5946('0x8'));var ejs=require(_0x5946('0x9'));var fs=require('fs');var fs_extra=require(_0x5946('0xa'));var _=require(_0x5946('0xb'));var squel=require(_0x5946('0xc'));var crypto=require(_0x5946('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5946('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5946('0xf'));var Papa=require(_0x5946('0x10'));var Redis=require('ioredis');var authService=require(_0x5946('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5946('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5946('0x13'));var db=require(_0x5946('0x14'))['db'];function respondWithStatusCode(_0x45ef04,_0x18b131){_0x18b131=_0x18b131||0xcc;return function(_0x50acb1){if(_0x50acb1){return _0x45ef04[_0x5946('0x15')](_0x18b131);}return _0x45ef04[_0x5946('0x16')](_0x18b131)['end']();};}function respondWithResult(_0x432a4a,_0x15d59d){_0x15d59d=_0x15d59d||0xc8;return function(_0x424bab){if(_0x424bab){return _0x432a4a[_0x5946('0x16')](_0x15d59d)[_0x5946('0x17')](_0x424bab);}};}function respondWithFilteredResult(_0xc719f6,_0x47f6c7){return function(_0x58cbdc){if(_0x58cbdc){var _0xaf795c=typeof _0x47f6c7['offset']===_0x5946('0x18')&&typeof _0x47f6c7[_0x5946('0x19')]===_0x5946('0x18');var _0x3d75a5=_0x58cbdc[_0x5946('0x1a')];var _0x2f4a68=_0xaf795c?0x0:_0x47f6c7[_0x5946('0x1b')];var _0x864805=_0xaf795c?_0x58cbdc[_0x5946('0x1a')]:_0x47f6c7['offset']+_0x47f6c7[_0x5946('0x19')];var _0xe65bc4;if(_0x864805>=_0x3d75a5){_0x864805=_0x3d75a5;_0xe65bc4=0xc8;}else{_0xe65bc4=0xce;}_0xc719f6['status'](_0xe65bc4);return _0xc719f6[_0x5946('0x1c')](_0x5946('0x1d'),_0x2f4a68+'-'+_0x864805+'/'+_0x3d75a5)[_0x5946('0x17')](_0x58cbdc);}return null;};}function patchUpdates(_0x2ba013){return function(_0x58d496){try{jsonpatch[_0x5946('0x1e')](_0x58d496,_0x2ba013,!![]);}catch(_0x47a1d9){return BPromise[_0x5946('0x1f')](_0x47a1d9);}return _0x58d496[_0x5946('0x20')]();};}function saveUpdates(_0x4cba19,_0xdbbc69){return function(_0x3f1bc4){if(_0x3f1bc4){return _0x3f1bc4[_0x5946('0x21')](_0x4cba19)[_0x5946('0x22')](function(_0x3daa53){return _0x3daa53;});}return null;};}function removeEntity(_0x5ee992,_0xf11a78){return function(_0x35ef7f){if(_0x35ef7f){return _0x35ef7f[_0x5946('0x23')]()[_0x5946('0x22')](function(){_0x5ee992[_0x5946('0x16')](0xcc)[_0x5946('0x24')]();});}};}function handleEntityNotFound(_0x511aa5,_0x5b6936){return function(_0x2ddf6d){if(!_0x2ddf6d){_0x511aa5[_0x5946('0x15')](0x194);}return _0x2ddf6d;};}function handleError(_0x15f3b8,_0x5b5a49){_0x5b5a49=_0x5b5a49||0x1f4;return function(_0x4db637){logger[_0x5946('0x25')](_0x4db637['stack']);if(_0x4db637[_0x5946('0x26')]){delete _0x4db637[_0x5946('0x26')];}_0x15f3b8['status'](_0x5b5a49)[_0x5946('0x27')](_0x4db637);};}exports[_0x5946('0x28')]=function(_0x57c17e,_0x3faf35){var _0x24d5e3={},_0x1b870c={},_0xd46da7={'count':0x0,'rows':[]};var _0x3c06cc=_[_0x5946('0x29')](db[_0x5946('0x2a')][_0x5946('0x2b')],function(_0x1ea745){return{'name':_0x1ea745[_0x5946('0x2c')],'type':_0x1ea745[_0x5946('0x2d')][_0x5946('0x2e')]};});_0x1b870c['model']=_[_0x5946('0x29')](_0x3c06cc,'name');_0x1b870c[_0x5946('0x2f')]=_[_0x5946('0x30')](_0x57c17e[_0x5946('0x2f')]);_0x1b870c['filters']=_[_0x5946('0x31')](_0x1b870c[_0x5946('0x32')],_0x1b870c['query']);_0x24d5e3[_0x5946('0x33')]=_['intersection'](_0x1b870c[_0x5946('0x32')],qs['fields'](_0x57c17e[_0x5946('0x2f')][_0x5946('0x34')]));_0x24d5e3[_0x5946('0x33')]=_0x24d5e3[_0x5946('0x33')][_0x5946('0x35')]?_0x24d5e3['attributes']:_0x1b870c[_0x5946('0x32')];if(!_0x57c17e[_0x5946('0x2f')][_0x5946('0x36')](_0x5946('0x37'))){_0x24d5e3[_0x5946('0x19')]=qs['limit'](_0x57c17e[_0x5946('0x2f')][_0x5946('0x19')]);_0x24d5e3[_0x5946('0x1b')]=qs[_0x5946('0x1b')](_0x57c17e[_0x5946('0x2f')][_0x5946('0x1b')]);}_0x24d5e3[_0x5946('0x38')]=qs[_0x5946('0x39')](_0x57c17e[_0x5946('0x2f')][_0x5946('0x39')]);_0x24d5e3[_0x5946('0x3a')]=qs['filters'](_[_0x5946('0x3b')](_0x57c17e[_0x5946('0x2f')],_0x1b870c[_0x5946('0x3c')]),_0x3c06cc);if(_0x57c17e['query'][_0x5946('0x3d')]){_0x24d5e3[_0x5946('0x3a')]=_[_0x5946('0x3e')](_0x24d5e3[_0x5946('0x3a')],{'$or':_[_0x5946('0x29')](_0x3c06cc,function(_0x247e2a){if(_0x247e2a[_0x5946('0x2d')]!==_0x5946('0x3f')){var _0x399303={};_0x399303[_0x247e2a['name']]={'$like':'%'+_0x57c17e[_0x5946('0x2f')]['filter']+'%'};return _0x399303;}})});}_0x24d5e3=_[_0x5946('0x3e')]({},_0x24d5e3,_0x57c17e['options']);var _0x2b0999={'where':_0x24d5e3['where']};return db[_0x5946('0x2a')][_0x5946('0x1a')](_0x2b0999)['then'](function(_0x5ec92f){_0xd46da7[_0x5946('0x1a')]=_0x5ec92f;if(_0x57c17e[_0x5946('0x2f')][_0x5946('0x40')]){_0x24d5e3[_0x5946('0x41')]=[{'all':!![]}];}return db[_0x5946('0x2a')][_0x5946('0x42')](_0x24d5e3);})[_0x5946('0x22')](function(_0x24f8d7){_0xd46da7[_0x5946('0x43')]=_0x24f8d7;return _0xd46da7;})[_0x5946('0x22')](respondWithFilteredResult(_0x3faf35,_0x24d5e3))[_0x5946('0x44')](handleError(_0x3faf35,null));};exports[_0x5946('0x45')]=function(_0x428e76,_0x5a1416){var _0x22e260={'raw':!![],'where':{'id':_0x428e76['params']['id']}},_0x784b3b={};_0x784b3b[_0x5946('0x32')]=_[_0x5946('0x30')](db[_0x5946('0x2a')][_0x5946('0x2b')]);_0x784b3b[_0x5946('0x2f')]=_[_0x5946('0x30')](_0x428e76[_0x5946('0x2f')]);_0x784b3b[_0x5946('0x3c')]=_[_0x5946('0x31')](_0x784b3b[_0x5946('0x32')],_0x784b3b[_0x5946('0x2f')]);_0x22e260[_0x5946('0x33')]=_[_0x5946('0x31')](_0x784b3b[_0x5946('0x32')],qs[_0x5946('0x34')](_0x428e76[_0x5946('0x2f')][_0x5946('0x34')]));_0x22e260[_0x5946('0x33')]=_0x22e260[_0x5946('0x33')][_0x5946('0x35')]?_0x22e260['attributes']:_0x784b3b[_0x5946('0x32')];if(_0x428e76[_0x5946('0x2f')][_0x5946('0x40')]){_0x22e260[_0x5946('0x41')]=[{'all':!![]}];}_0x22e260=_['merge']({},_0x22e260,_0x428e76[_0x5946('0x46')]);return db['SquareDetailsReport'][_0x5946('0x47')](_0x22e260)[_0x5946('0x22')](handleEntityNotFound(_0x5a1416,null))[_0x5946('0x22')](respondWithResult(_0x5a1416,null))[_0x5946('0x44')](handleError(_0x5a1416,null));};exports[_0x5946('0x48')]=function(_0x1bcf22,_0x273d94){return db[_0x5946('0x2a')]['create'](_0x1bcf22[_0x5946('0x49')],{})['then'](respondWithResult(_0x273d94,0xc9))[_0x5946('0x44')](handleError(_0x273d94,null));};exports['update']=function(_0x5a3fd8,_0xa5f67c){if(_0x5a3fd8['body']['id']){delete _0x5a3fd8[_0x5946('0x49')]['id'];}return db[_0x5946('0x2a')][_0x5946('0x47')]({'where':{'id':_0x5a3fd8['params']['id']}})['then'](handleEntityNotFound(_0xa5f67c,null))[_0x5946('0x22')](saveUpdates(_0x5a3fd8[_0x5946('0x49')],null))[_0x5946('0x22')](respondWithResult(_0xa5f67c,null))['catch'](handleError(_0xa5f67c,null));};exports[_0x5946('0x23')]=function(_0x4f8aa3,_0x3be7d6){return db[_0x5946('0x2a')]['find']({'where':{'id':_0x4f8aa3[_0x5946('0x4a')]['id']}})[_0x5946('0x22')](handleEntityNotFound(_0x3be7d6,null))[_0x5946('0x22')](removeEntity(_0x3be7d6,null))[_0x5946('0x44')](handleError(_0x3be7d6,null));};exports[_0x5946('0x4b')]=function(_0x207307,_0x3f66ed){return db[_0x5946('0x2a')][_0x5946('0x4b')]()[_0x5946('0x22')](respondWithResult(_0x3f66ed,null))[_0x5946('0x44')](handleError(_0x3f66ed,null));}; \ No newline at end of file +var _0xf27b=['filters','pick','filter','merge','type','SquareDetailsReport','include','findAll','rows','then','catch','show','rawAttributes','fields','includeAll','options','find','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','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','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','key','query','keys','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xf27b,0x18b));var _0xbf27=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xf27b[_0x30faec];return _0x29484f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf27('0x0'));var zipdir=require(_0xbf27('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf27('0x2'));var moment=require(_0xbf27('0x3'));var BPromise=require(_0xbf27('0x4'));var Mustache=require('mustache');var util=require(_0xbf27('0x5'));var path=require(_0xbf27('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbf27('0x7'));var fs=require('fs');var fs_extra=require(_0xbf27('0x8'));var _=require('lodash');var squel=require(_0xbf27('0x9'));var crypto=require(_0xbf27('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbf27('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf27('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbf27('0xd'));var as=require(_0xbf27('0xe'));var hardwareService=require(_0xbf27('0xf'));var logger=require(_0xbf27('0x10'))(_0xbf27('0x11'));var utils=require(_0xbf27('0x12'));var config=require(_0xbf27('0x13'));var licenseUtil=require(_0xbf27('0x14'));var db=require(_0xbf27('0x15'))['db'];function respondWithStatusCode(_0x395dd4,_0x48ba3e){_0x48ba3e=_0x48ba3e||0xcc;return function(_0x3d88fd){if(_0x3d88fd){return _0x395dd4[_0xbf27('0x16')](_0x48ba3e);}return _0x395dd4['status'](_0x48ba3e)['end']();};}function respondWithResult(_0x17da3f,_0x485c21){_0x485c21=_0x485c21||0xc8;return function(_0x3cf114){if(_0x3cf114){return _0x17da3f[_0xbf27('0x17')](_0x485c21)[_0xbf27('0x18')](_0x3cf114);}};}function respondWithFilteredResult(_0x48477f,_0x1f66aa){return function(_0xaace8c){if(_0xaace8c){var _0x5e8f43=typeof _0x1f66aa['offset']===_0xbf27('0x19')&&typeof _0x1f66aa[_0xbf27('0x1a')]==='undefined';var _0x2c1d8e=_0xaace8c[_0xbf27('0x1b')];var _0x5deec0=_0x5e8f43?0x0:_0x1f66aa[_0xbf27('0x1c')];var _0x316587=_0x5e8f43?_0xaace8c[_0xbf27('0x1b')]:_0x1f66aa['offset']+_0x1f66aa[_0xbf27('0x1a')];var _0x47abb6;if(_0x316587>=_0x2c1d8e){_0x316587=_0x2c1d8e;_0x47abb6=0xc8;}else{_0x47abb6=0xce;}_0x48477f[_0xbf27('0x17')](_0x47abb6);return _0x48477f[_0xbf27('0x1d')]('Content-Range',_0x5deec0+'-'+_0x316587+'/'+_0x2c1d8e)[_0xbf27('0x18')](_0xaace8c);}return null;};}function patchUpdates(_0x180c33){return function(_0xaeb85){try{jsonpatch[_0xbf27('0x1e')](_0xaeb85,_0x180c33,!![]);}catch(_0x4c7f1f){return BPromise[_0xbf27('0x1f')](_0x4c7f1f);}return _0xaeb85[_0xbf27('0x20')]();};}function saveUpdates(_0x523a75,_0x4db08f){return function(_0x1f4119){if(_0x1f4119){return _0x1f4119[_0xbf27('0x21')](_0x523a75)['then'](function(_0x1b67b7){return _0x1b67b7;});}return null;};}function removeEntity(_0x40bd2d,_0x1fcb6c){return function(_0x51b80f){if(_0x51b80f){return _0x51b80f[_0xbf27('0x22')]()['then'](function(){_0x40bd2d[_0xbf27('0x17')](0xcc)[_0xbf27('0x23')]();});}};}function handleEntityNotFound(_0xdd43b,_0x2b3ddb){return function(_0x2fe0d2){if(!_0x2fe0d2){_0xdd43b['sendStatus'](0x194);}return _0x2fe0d2;};}function handleError(_0x461b46,_0xf90c27){_0xf90c27=_0xf90c27||0x1f4;return function(_0x502d0e){logger[_0xbf27('0x24')](_0x502d0e[_0xbf27('0x25')]);if(_0x502d0e[_0xbf27('0x26')]){delete _0x502d0e[_0xbf27('0x26')];}_0x461b46['status'](_0xf90c27)[_0xbf27('0x27')](_0x502d0e);};}exports[_0xbf27('0x28')]=function(_0x3b096f,_0x284560){var _0x4e2093={},_0x32eea4={},_0x54328e={'count':0x0,'rows':[]};var _0x405036=_[_0xbf27('0x29')](db['SquareDetailsReport']['rawAttributes'],function(_0x2d5518){return{'name':_0x2d5518[_0xbf27('0x2a')],'type':_0x2d5518['type'][_0xbf27('0x2b')]};});_0x32eea4['model']=_[_0xbf27('0x29')](_0x405036,_0xbf27('0x26'));_0x32eea4[_0xbf27('0x2c')]=_[_0xbf27('0x2d')](_0x3b096f['query']);_0x32eea4['filters']=_['intersection'](_0x32eea4[_0xbf27('0x2e')],_0x32eea4[_0xbf27('0x2c')]);_0x4e2093['attributes']=_[_0xbf27('0x2f')](_0x32eea4['model'],qs['fields'](_0x3b096f['query']['fields']));_0x4e2093['attributes']=_0x4e2093[_0xbf27('0x30')][_0xbf27('0x31')]?_0x4e2093[_0xbf27('0x30')]:_0x32eea4[_0xbf27('0x2e')];if(!_0x3b096f[_0xbf27('0x2c')][_0xbf27('0x32')](_0xbf27('0x33'))){_0x4e2093['limit']=qs['limit'](_0x3b096f['query']['limit']);_0x4e2093[_0xbf27('0x1c')]=qs[_0xbf27('0x1c')](_0x3b096f[_0xbf27('0x2c')][_0xbf27('0x1c')]);}_0x4e2093[_0xbf27('0x34')]=qs[_0xbf27('0x35')](_0x3b096f[_0xbf27('0x2c')]['sort']);_0x4e2093[_0xbf27('0x36')]=qs[_0xbf27('0x37')](_[_0xbf27('0x38')](_0x3b096f[_0xbf27('0x2c')],_0x32eea4['filters']),_0x405036);if(_0x3b096f[_0xbf27('0x2c')][_0xbf27('0x39')]){_0x4e2093[_0xbf27('0x36')]=_[_0xbf27('0x3a')](_0x4e2093[_0xbf27('0x36')],{'$or':_[_0xbf27('0x29')](_0x405036,function(_0x58e2ab){if(_0x58e2ab[_0xbf27('0x3b')]!=='VIRTUAL'){var _0x2308ff={};_0x2308ff[_0x58e2ab['name']]={'$like':'%'+_0x3b096f[_0xbf27('0x2c')][_0xbf27('0x39')]+'%'};return _0x2308ff;}})});}_0x4e2093=_[_0xbf27('0x3a')]({},_0x4e2093,_0x3b096f['options']);var _0x3360cc={'where':_0x4e2093[_0xbf27('0x36')]};return db[_0xbf27('0x3c')][_0xbf27('0x1b')](_0x3360cc)['then'](function(_0x1800f1){_0x54328e[_0xbf27('0x1b')]=_0x1800f1;if(_0x3b096f[_0xbf27('0x2c')]['includeAll']){_0x4e2093[_0xbf27('0x3d')]=[{'all':!![]}];}return db[_0xbf27('0x3c')][_0xbf27('0x3e')](_0x4e2093);})['then'](function(_0x69f025){_0x54328e[_0xbf27('0x3f')]=_0x69f025;return _0x54328e;})[_0xbf27('0x40')](respondWithFilteredResult(_0x284560,_0x4e2093))[_0xbf27('0x41')](handleError(_0x284560,null));};exports[_0xbf27('0x42')]=function(_0x4a4460,_0x5f1957){var _0x5645a6={'raw':!![],'where':{'id':_0x4a4460['params']['id']}},_0x5195a7={};_0x5195a7['model']=_['keys'](db[_0xbf27('0x3c')][_0xbf27('0x43')]);_0x5195a7['query']=_[_0xbf27('0x2d')](_0x4a4460[_0xbf27('0x2c')]);_0x5195a7[_0xbf27('0x37')]=_[_0xbf27('0x2f')](_0x5195a7[_0xbf27('0x2e')],_0x5195a7[_0xbf27('0x2c')]);_0x5645a6[_0xbf27('0x30')]=_['intersection'](_0x5195a7[_0xbf27('0x2e')],qs[_0xbf27('0x44')](_0x4a4460['query'][_0xbf27('0x44')]));_0x5645a6[_0xbf27('0x30')]=_0x5645a6[_0xbf27('0x30')][_0xbf27('0x31')]?_0x5645a6[_0xbf27('0x30')]:_0x5195a7[_0xbf27('0x2e')];if(_0x4a4460['query'][_0xbf27('0x45')]){_0x5645a6[_0xbf27('0x3d')]=[{'all':!![]}];}_0x5645a6=_[_0xbf27('0x3a')]({},_0x5645a6,_0x4a4460[_0xbf27('0x46')]);return db[_0xbf27('0x3c')][_0xbf27('0x47')](_0x5645a6)[_0xbf27('0x40')](handleEntityNotFound(_0x5f1957,null))[_0xbf27('0x40')](respondWithResult(_0x5f1957,null))[_0xbf27('0x41')](handleError(_0x5f1957,null));};exports['create']=function(_0x347869,_0x397ae3){return db[_0xbf27('0x3c')]['create'](_0x347869[_0xbf27('0x48')],{})[_0xbf27('0x40')](respondWithResult(_0x397ae3,0xc9))[_0xbf27('0x41')](handleError(_0x397ae3,null));};exports[_0xbf27('0x21')]=function(_0x4f1e0a,_0xc8fb15){if(_0x4f1e0a[_0xbf27('0x48')]['id']){delete _0x4f1e0a[_0xbf27('0x48')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x4f1e0a[_0xbf27('0x49')]['id']}})[_0xbf27('0x40')](handleEntityNotFound(_0xc8fb15,null))[_0xbf27('0x40')](saveUpdates(_0x4f1e0a[_0xbf27('0x48')],null))['then'](respondWithResult(_0xc8fb15,null))[_0xbf27('0x41')](handleError(_0xc8fb15,null));};exports[_0xbf27('0x22')]=function(_0x2b7816,_0x280895){return db[_0xbf27('0x3c')][_0xbf27('0x47')]({'where':{'id':_0x2b7816[_0xbf27('0x49')]['id']}})['then'](handleEntityNotFound(_0x280895,null))[_0xbf27('0x40')](removeEntity(_0x280895,null))[_0xbf27('0x41')](handleError(_0x280895,null));};exports[_0xbf27('0x4a')]=function(_0x179540,_0x5b2f34){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0x5b2f34,null))[_0xbf27('0x41')](handleError(_0x5b2f34,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 6d7040f..35d207d 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 _0x7233=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7233,0x18c));var _0x3723=function(_0x37d95e,_0x20dacf){_0x37d95e=_0x37d95e-0x0;var _0x5dbacd=_0x7233[_0x37d95e];return _0x5dbacd;};'use strict';var _=require('lodash');var util=require(_0x3723('0x0'));var logger=require(_0x3723('0x1'))(_0x3723('0x2'));var moment=require('moment');var BPromise=require(_0x3723('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3723('0x4'));var rimraf=require(_0x3723('0x5'));var config=require(_0x3723('0x6'));var attributes=require(_0x3723('0x7'));module[_0x3723('0x8')]=function(_0x9d10c5,_0x2aa24b){return _0x9d10c5[_0x3723('0x9')]('SquareDetailsReport',attributes,{'tableName':_0x3723('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08a2=['request-promise','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird'];(function(_0x175f6f,_0x1a4a05){var _0x1aa501=function(_0x2e4488){while(--_0x2e4488){_0x175f6f['push'](_0x175f6f['shift']());}};_0x1aa501(++_0x1a4a05);}(_0x08a2,0x181));var _0x208a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x08a2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x208a('0x0'));var util=require(_0x208a('0x1'));var logger=require(_0x208a('0x2'))(_0x208a('0x3'));var moment=require('moment');var BPromise=require(_0x208a('0x4'));var rp=require(_0x208a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x208a('0x6'));module['exports']=function(_0xc90e6b,_0x3c1b95){return _0xc90e6b[_0x208a('0x7')](_0x208a('0x8'),attributes,{'tableName':_0x208a('0x9'),'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 e50768c..06154f4 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 _0xe493=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','create','options','raw','lodash','util','moment','bluebird'];(function(_0x50a6e6,_0x54fcc3){var _0x28ae3d=function(_0x9cad6e){while(--_0x9cad6e){_0x50a6e6['push'](_0x50a6e6['shift']());}};_0x28ae3d(++_0x54fcc3);}(_0xe493,0x7e));var _0x3e49=function(_0x3afaa6,_0x20bae5){_0x3afaa6=_0x3afaa6-0x0;var _0x532cef=_0xe493[_0x3afaa6];return _0x532cef;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7821,_0x12dd84,_0x3626b6){return new BPromise(function(_0x4e96ac,_0x56b767){return client['request'](_0x3f7821,_0x3626b6)[_0x3e49('0xb')](function(_0x8b8c0e){logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));logger[_0x3e49('0xf')](_0x3e49('0x10'),_0x12dd84,_0x3e49('0xe'),JSON[_0x3e49('0x11')](_0x8b8c0e));if(_0x8b8c0e[_0x3e49('0x12')]){if(_0x8b8c0e[_0x3e49('0x12')]['code']===0x1f4){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x56b767(_0x8b8c0e[_0x3e49('0x12')]['message']);}logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x4e96ac(_0x8b8c0e[_0x3e49('0x12')][_0x3e49('0x13')]);}else{logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));_0x4e96ac(_0x8b8c0e[_0x3e49('0x14')][_0x3e49('0x13')]);}})[_0x3e49('0x15')](function(_0x1d9cce){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x1d9cce);_0x56b767(_0x1d9cce);});});}exports[_0x3e49('0x16')]=function(_0x3ae5f4){var _0x448c36=this;return new Promise(function(_0x4e1cdf,_0xf33205){return db['SquareDetailsReport'][_0x3e49('0x17')](_0x3ae5f4['body'],{'raw':_0x3ae5f4[_0x3e49('0x18')]?_0x3ae5f4['options'][_0x3e49('0x19')]===undefined?!![]:![]:!![]})[_0x3e49('0xb')](function(_0x420d7b){logger['info'](_0x3e49('0x16'),_0x3ae5f4);logger['debug'](_0x3e49('0x16'),_0x3ae5f4,JSON[_0x3e49('0x11')](_0x420d7b));_0x4e1cdf(_0x420d7b);})[_0x3e49('0x15')](function(_0x5e0f1d){logger['error'](_0x3e49('0x16'),_0x5e0f1d['message'],_0x3ae5f4);_0xf33205(_0x448c36[_0x3e49('0x12')](0x1f4,_0x5e0f1d[_0x3e49('0x13')]));});});}; \ No newline at end of file +var _0x4e81=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x54e61b,_0x5b88bd){var _0x143454=function(_0x554c8f){while(--_0x554c8f){_0x54e61b['push'](_0x54e61b['shift']());}};_0x143454(++_0x5b88bd);}(_0x4e81,0x1bc));var _0x14e8=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0x4e81[_0x115d5b];return _0x6cfc50;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});}exports[_0x14e8('0x15')]=function(_0x10dc8b){var _0x462259=this;return new Promise(function(_0x5a38c1,_0x328c5a){return db[_0x14e8('0x16')][_0x14e8('0x17')](_0x10dc8b[_0x14e8('0x18')],{'raw':_0x10dc8b[_0x14e8('0x19')]?_0x10dc8b['options'][_0x14e8('0x1a')]===undefined?!![]:![]:!![]})[_0x14e8('0xa')](function(_0x2abfec){logger['info'](_0x14e8('0x15'),_0x10dc8b);logger['debug'](_0x14e8('0x15'),_0x10dc8b,JSON[_0x14e8('0xf')](_0x2abfec));_0x5a38c1(_0x2abfec);})[_0x14e8('0x14')](function(_0x117b00){logger[_0x14e8('0x10')]('CreateSquareDetailsReport',_0x117b00[_0x14e8('0x13')],_0x10dc8b);_0x328c5a(_0x462259['error'](0x1f4,_0x117b00[_0x14e8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 08bda8b..b0b708a 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 _0xd81b=['/process/:pid/kill','exports','express','Router','../../components/auth/service','isAuthenticated','index','get'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0xd81b,0x152));var _0xbd81=function(_0x43bf05,_0xec3c37){_0x43bf05=_0x43bf05-0x0;var _0x514dde=_0xd81b[_0x43bf05];return _0x514dde;};'use strict';var express=require(_0xbd81('0x0'));var router=express[_0xbd81('0x1')]();var auth=require(_0xbd81('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0xbd81('0x3')](),controller[_0xbd81('0x4')]);router[_0xbd81('0x5')](_0xbd81('0x6'),auth[_0xbd81('0x3')](),controller['killProcess']);module[_0xbd81('0x7')]=router; \ No newline at end of file +var _0x07a1=['/process/:pid/kill','killProcess','./system.controller','get','index'];(function(_0x299144,_0x461ddc){var _0x2f5bf2=function(_0x11a45f){while(--_0x11a45f){_0x299144['push'](_0x299144['shift']());}};_0x2f5bf2(++_0x461ddc);}(_0x07a1,0x7f));var _0x107a=function(_0x3edefe,_0x156f53){_0x3edefe=_0x3edefe-0x0;var _0x3a2e9c=_0x07a1[_0x3edefe];return _0x3a2e9c;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x107a('0x0'));router[_0x107a('0x1')]('/',auth['isAuthenticated'](),controller[_0x107a('0x2')]);router[_0x107a('0x1')](_0x107a('0x3'),auth['isAuthenticated'](),controller[_0x107a('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index b87949b..aeab7e4 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 _0xdc59=['indexOf','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','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','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid'];(function(_0x24fda4,_0x299583){var _0x56b85b=function(_0x3cea84){while(--_0x3cea84){_0x24fda4['push'](_0x24fda4['shift']());}};_0x56b85b(++_0x299583);}(_0xdc59,0x19c));var _0x9dc5=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xdc59[_0x8c43de];return _0xa6591b;};'use strict';var info=require(_0x9dc5('0x0'));var exec=require(_0x9dc5('0x1'))[_0x9dc5('0x2')];var logger=require(_0x9dc5('0x3'))(_0x9dc5('0x4'));var util=require(_0x9dc5('0x5'));var BPromise=require(_0x9dc5('0x6'));var _=require(_0x9dc5('0x7'));function handleError(_0x64f751,_0x1e276f,_0x10b7fb){_0x1e276f=_0x1e276f||0x1f4;return function(_0x51d2da){logger[_0x9dc5('0x8')](_0x9dc5('0x9'),_0x10b7fb,_0x1e276f,util[_0x9dc5('0xa')](_0x51d2da,{'showHidden':![],'depth':null}));delete _0x51d2da[_0x9dc5('0xb')];_0x64f751[_0x9dc5('0xc')](_0x1e276f)[_0x9dc5('0xd')](_0x51d2da);};}exports[_0x9dc5('0xe')]=function(_0x597497,_0x22d0a4){return info[_0x9dc5('0xf')]()[_0x9dc5('0x10')](function(_0x196e45){return _0x22d0a4[_0x9dc5('0xc')](0xc8)[_0x9dc5('0x11')](_0x196e45);})[_0x9dc5('0x12')](function(_0x56af6a){return _0x22d0a4['status'](0x1f4)['json'](_0x56af6a);});};exports['killProcess']=function(_0x42d8f0,_0x149e52){var _0x5c806b=[_0x9dc5('0x13')];return new BPromise(function(_0x43c351,_0x25bcea){return exec(util[_0x9dc5('0x14')](_0x9dc5('0x15'),_0x42d8f0['params'][_0x9dc5('0x16')]),function(_0x253aaa,_0x5f11a9,_0x9786fe){if(_0x253aaa){return _0x25bcea(_0x253aaa);}return _0x43c351(_0x5f11a9);});})[_0x9dc5('0x10')](function(_0x5dbe7b){var _0x1f6892=![];var _0x52d328=_0x5dbe7b['split'](/\n/);for(var _0x1ea302=0x0,_0x154742=_0x5c806b['length'];_0x1ea302<_0x154742,_0x1f6892===![];_0x1ea302+=0x1){if(_0x5dbe7b[_0x9dc5('0x17')](_0x5c806b[_0x1ea302])>=0x0){_0x1f6892=!![];}}if(!_0x1f6892){throw new Error(util[_0x9dc5('0x14')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x42d8f0[_0x9dc5('0x18')][_0x9dc5('0x16')]));}process[_0x9dc5('0x19')](_0x42d8f0['params']['pid'],_0x9dc5('0x1a'));return _0x149e52[_0x9dc5('0xc')](0xc8)['json']({'message':util[_0x9dc5('0x14')](_0x9dc5('0x1b'),_0x42d8f0[_0x9dc5('0x18')][_0x9dc5('0x16')])});})[_0x9dc5('0x12')](handleError(_0x149e52,null,_0x9dc5('0x1c')));}; \ No newline at end of file +var _0x7f35=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','exec','../../config/logger','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill'];(function(_0x47c4fa,_0xbd8e89){var _0x31b52f=function(_0x331106){while(--_0x331106){_0x47c4fa['push'](_0x47c4fa['shift']());}};_0x31b52f(++_0xbd8e89);}(_0x7f35,0x8f));var _0x57f3=function(_0x5340b2,_0x4797f6){_0x5340b2=_0x5340b2-0x0;var _0x2af045=_0x7f35[_0x5340b2];return _0x2af045;};'use strict';var info=require(_0x57f3('0x0'));var exec=require('child_process')[_0x57f3('0x1')];var logger=require(_0x57f3('0x2'))(_0x57f3('0x3'));var util=require(_0x57f3('0x4'));var BPromise=require('bluebird');var _=require(_0x57f3('0x5'));function handleError(_0x1ab9ec,_0x3e6094,_0x3d7954){_0x3e6094=_0x3e6094||0x1f4;return function(_0x3ef9bb){logger['error'](_0x57f3('0x6'),_0x3d7954,_0x3e6094,util[_0x57f3('0x7')](_0x3ef9bb,{'showHidden':![],'depth':null}));delete _0x3ef9bb[_0x57f3('0x8')];_0x1ab9ec[_0x57f3('0x9')](_0x3e6094)[_0x57f3('0xa')](_0x3ef9bb);};}exports[_0x57f3('0xb')]=function(_0x5488e0,_0x1062c6){return info['getAllData']()[_0x57f3('0xc')](function(_0x12e5fd){return _0x1062c6[_0x57f3('0x9')](0xc8)[_0x57f3('0xd')](_0x12e5fd);})['catch'](function(_0x251f3c){return _0x1062c6[_0x57f3('0x9')](0x1f4)['json'](_0x251f3c);});};exports[_0x57f3('0xe')]=function(_0x105269,_0x387e7e){var _0x2fd7d5=[_0x57f3('0xf')];return new BPromise(function(_0x40ad2b,_0xab97ba){return exec(util[_0x57f3('0x10')](_0x57f3('0x11'),_0x105269['params'][_0x57f3('0x12')]),function(_0x3f2030,_0x1146f9,_0x47e037){if(_0x3f2030){return _0xab97ba(_0x3f2030);}return _0x40ad2b(_0x1146f9);});})[_0x57f3('0xc')](function(_0x301102){var _0xaf7ebc=![];var _0x5734f0=_0x301102[_0x57f3('0x13')](/\n/);for(var _0x184a8f=0x0,_0x324e21=_0x2fd7d5[_0x57f3('0x14')];_0x184a8f<_0x324e21,_0xaf7ebc===![];_0x184a8f+=0x1){if(_0x301102[_0x57f3('0x15')](_0x2fd7d5[_0x184a8f])>=0x0){_0xaf7ebc=!![];}}if(!_0xaf7ebc){throw new Error(util['format'](_0x57f3('0x16'),_0x105269[_0x57f3('0x17')][_0x57f3('0x12')]));}process[_0x57f3('0x18')](_0x105269['params'][_0x57f3('0x12')],_0x57f3('0x19'));return _0x387e7e[_0x57f3('0x9')](0xc8)[_0x57f3('0xd')]({'message':util[_0x57f3('0x10')](_0x57f3('0x1a'),_0x105269[_0x57f3('0x17')][_0x57f3('0x12')])});})[_0x57f3('0x1b')](handleError(_0x387e7e,null,_0x57f3('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4d3cdec..5a7184a 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 _0xb098=['post','create','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xb098,0x1c4));var _0x8b09=function(_0x54d739,_0xd35798){_0x54d739=_0x54d739-0x0;var _0x44ecf4=_0xb098[_0x54d739];return _0x44ecf4;};'use strict';var multer=require(_0x8b09('0x0'));var util=require(_0x8b09('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b09('0x2'));var router=express[_0x8b09('0x3')]();var fs_extra=require(_0x8b09('0x4'));var auth=require(_0x8b09('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b09('0x6'));var controller=require('./tag.controller');router[_0x8b09('0x7')]('/',auth[_0x8b09('0x8')](),controller[_0x8b09('0x9')]);router[_0x8b09('0x7')](_0x8b09('0xa'),auth[_0x8b09('0x8')](),controller[_0x8b09('0xb')]);router[_0x8b09('0xc')]('/',auth[_0x8b09('0x8')](),controller[_0x8b09('0xd')]);router['put'](_0x8b09('0xa'),auth[_0x8b09('0x8')](),controller['update']);router[_0x8b09('0xe')](_0x8b09('0xa'),auth[_0x8b09('0x8')](),controller['destroy']);module[_0x8b09('0xf')]=router; \ No newline at end of file +var _0x3f4b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1f9464,_0x1aa0a7){var _0x4ab479=function(_0x15c485){while(--_0x15c485){_0x1f9464['push'](_0x1f9464['shift']());}};_0x4ab479(++_0x1aa0a7);}(_0x3f4b,0x1c4));var _0xb3f4=function(_0x5b6999,_0x2ceebb){_0x5b6999=_0x5b6999-0x0;var _0x9fe2bb=_0x3f4b[_0x5b6999];return _0x9fe2bb;};'use strict';var multer=require(_0xb3f4('0x0'));var util=require(_0xb3f4('0x1'));var path=require(_0xb3f4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3f4('0x3'));var router=express[_0xb3f4('0x4')]();var fs_extra=require(_0xb3f4('0x5'));var auth=require(_0xb3f4('0x6'));var interaction=require(_0xb3f4('0x7'));var config=require(_0xb3f4('0x8'));var controller=require('./tag.controller');router[_0xb3f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb3f4('0x9')](_0xb3f4('0xa'),auth[_0xb3f4('0xb')](),controller[_0xb3f4('0xc')]);router[_0xb3f4('0xd')]('/',auth[_0xb3f4('0xb')](),controller['create']);router[_0xb3f4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb3f4('0xf')]);router[_0xb3f4('0x10')](_0xb3f4('0xa'),auth[_0xb3f4('0xb')](),controller[_0xb3f4('0x11')]);module[_0xb3f4('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index e2c20ea..9070b91 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 _0x73a1=['name','#0091EA','STRING'];(function(_0x41c79b,_0x465ebd){var _0x36402d=function(_0x340d91){while(--_0x340d91){_0x41c79b['push'](_0x41c79b['shift']());}};_0x36402d(++_0x465ebd);}(_0x73a1,0x161));var _0x173a=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x73a1[_0x1147ab];return _0x55cb5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x173a('0x0')],'unique':_0x173a('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x173a('0x2')},'description':{'type':Sequelize[_0x173a('0x0')]}}; \ No newline at end of file +var _0x0c71=['name','STRING','#0091EA','exports'];(function(_0x22bda9,_0x4637b7){var _0x43af19=function(_0x5f07bc){while(--_0x5f07bc){_0x22bda9['push'](_0x22bda9['shift']());}};_0x43af19(++_0x4637b7);}(_0x0c71,0xfb));var _0x10c7=function(_0x3ffa92,_0x144ac0){_0x3ffa92=_0x3ffa92-0x0;var _0x344612=_0x0c71[_0x3ffa92];return _0x344612;};'use strict';var Sequelize=require('sequelize');module[_0x10c7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x10c7('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x10c7('0x2')],'defaultValue':_0x10c7('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index c82758f..92ee9cd 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 _0x6c76=['to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','apply','reject','save','then','destroy','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x6c76,0x184));var _0x66c7=function(_0x5415cd,_0x7d0518){_0x5415cd=_0x5415cd-0x0;var _0x308bac=_0x6c76[_0x5415cd];return _0x308bac;};'use strict';var emlformat=require(_0x66c7('0x0'));var rimraf=require(_0x66c7('0x1'));var zipdir=require(_0x66c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66c7('0x5'));var path=require(_0x66c7('0x6'));var sox=require('sox');var csv=require(_0x66c7('0x7'));var ejs=require(_0x66c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x7'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];function respondWithStatusCode(_0x5176a3,_0x18c309){_0x18c309=_0x18c309||0xcc;return function(_0x760e36){if(_0x760e36){return _0x5176a3[_0x66c7('0x17')](_0x18c309);}return _0x5176a3[_0x66c7('0x18')](_0x18c309)[_0x66c7('0x19')]();};}function respondWithResult(_0x1e91d1,_0x618bd7){_0x618bd7=_0x618bd7||0xc8;return function(_0xf3b04){if(_0xf3b04){return _0x1e91d1[_0x66c7('0x18')](_0x618bd7)['json'](_0xf3b04);}};}function respondWithFilteredResult(_0x110f6d,_0x4dd902){return function(_0x208010){if(_0x208010){var _0x39f951=typeof _0x4dd902[_0x66c7('0x1a')]===_0x66c7('0x1b')&&typeof _0x4dd902[_0x66c7('0x1c')]==='undefined';var _0x5cf913=_0x208010['count'];var _0x5129f6=_0x39f951?0x0:_0x4dd902[_0x66c7('0x1a')];var _0x19f29d=_0x39f951?_0x208010['count']:_0x4dd902['offset']+_0x4dd902[_0x66c7('0x1c')];var _0x9b65cf;if(_0x19f29d>=_0x5cf913){_0x19f29d=_0x5cf913;_0x9b65cf=0xc8;}else{_0x9b65cf=0xce;}_0x110f6d[_0x66c7('0x18')](_0x9b65cf);return _0x110f6d[_0x66c7('0x1d')]('Content-Range',_0x5129f6+'-'+_0x19f29d+'/'+_0x5cf913)['json'](_0x208010);}return null;};}function patchUpdates(_0x1853b2){return function(_0x237177){try{jsonpatch[_0x66c7('0x1e')](_0x237177,_0x1853b2,!![]);}catch(_0x1c43c4){return BPromise[_0x66c7('0x1f')](_0x1c43c4);}return _0x237177[_0x66c7('0x20')]();};}function saveUpdates(_0x4804cf,_0x4ddbd2){return function(_0x366e9b){if(_0x366e9b){return _0x366e9b['update'](_0x4804cf)[_0x66c7('0x21')](function(_0x8b96b1){return _0x8b96b1;});}return null;};}function removeEntity(_0x44bdef,_0x1fc9d3){return function(_0x5bfaf6){if(_0x5bfaf6){return _0x5bfaf6[_0x66c7('0x22')]()[_0x66c7('0x21')](function(){var _0x5b28e6=_0x5bfaf6[_0x66c7('0x23')]({'plain':!![]});var _0x11a6b9=_0x66c7('0x24');return db[_0x66c7('0x25')][_0x66c7('0x22')]({'where':{'type':_0x11a6b9,'resourceId':_0x5b28e6['id']}})['then'](function(){return _0x5bfaf6;});})['then'](function(){_0x44bdef['status'](0xcc)[_0x66c7('0x19')]();});}};}function handleEntityNotFound(_0x542ff1,_0x5c5e42){return function(_0x9afd50){if(!_0x9afd50){_0x542ff1[_0x66c7('0x17')](0x194);}return _0x9afd50;};}function handleError(_0x205b7e,_0xb4b65b){_0xb4b65b=_0xb4b65b||0x1f4;return function(_0x36a830){logger[_0x66c7('0x26')](_0x36a830['stack']);if(_0x36a830[_0x66c7('0x27')]){delete _0x36a830[_0x66c7('0x27')];}_0x205b7e[_0x66c7('0x18')](_0xb4b65b)[_0x66c7('0x28')](_0x36a830);};}exports[_0x66c7('0x29')]=function(_0x592f0e,_0x263b48){var _0x4f1a34={},_0xfbd97={},_0x543fbf={'count':0x0,'rows':[]};var _0x296875=_[_0x66c7('0x2a')](db[_0x66c7('0x2b')][_0x66c7('0x2c')],function(_0xb26028){return{'name':_0xb26028[_0x66c7('0x2d')],'type':_0xb26028['type']['key']};});_0xfbd97[_0x66c7('0x2e')]=_[_0x66c7('0x2a')](_0x296875,_0x66c7('0x27'));_0xfbd97[_0x66c7('0x2f')]=_[_0x66c7('0x30')](_0x592f0e[_0x66c7('0x2f')]);_0xfbd97[_0x66c7('0x31')]=_[_0x66c7('0x32')](_0xfbd97[_0x66c7('0x2e')],_0xfbd97[_0x66c7('0x2f')]);_0x4f1a34[_0x66c7('0x33')]=_[_0x66c7('0x32')](_0xfbd97['model'],qs['fields'](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x34')]));_0x4f1a34[_0x66c7('0x33')]=_0x4f1a34[_0x66c7('0x33')][_0x66c7('0x35')]?_0x4f1a34[_0x66c7('0x33')]:_0xfbd97[_0x66c7('0x2e')];if(!_0x592f0e['query'][_0x66c7('0x36')](_0x66c7('0x37'))){_0x4f1a34[_0x66c7('0x1c')]=qs[_0x66c7('0x1c')](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x1c')]);_0x4f1a34[_0x66c7('0x1a')]=qs[_0x66c7('0x1a')](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x1a')]);}_0x4f1a34[_0x66c7('0x38')]=qs['sort'](_0x592f0e['query'][_0x66c7('0x39')]);_0x4f1a34[_0x66c7('0x3a')]=qs[_0x66c7('0x31')](_['pick'](_0x592f0e['query'],_0xfbd97[_0x66c7('0x31')]),_0x296875);if(_0x592f0e[_0x66c7('0x2f')]['filter']){_0x4f1a34[_0x66c7('0x3a')]=_[_0x66c7('0x3b')](_0x4f1a34[_0x66c7('0x3a')],{'$or':_['map'](_0x296875,function(_0x20374a){if(_0x20374a[_0x66c7('0x3c')]!==_0x66c7('0x3d')){var _0x14d59c={};_0x14d59c[_0x20374a[_0x66c7('0x27')]]={'$like':'%'+_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x3e')]+'%'};return _0x14d59c;}})});}_0x4f1a34=_[_0x66c7('0x3b')]({},_0x4f1a34,_0x592f0e[_0x66c7('0x3f')]);var _0x5f34ed={'where':_0x4f1a34[_0x66c7('0x3a')]};return db[_0x66c7('0x2b')][_0x66c7('0x40')](_0x5f34ed)[_0x66c7('0x21')](function(_0x3f169e){_0x543fbf[_0x66c7('0x40')]=_0x3f169e;if(_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x41')]){_0x4f1a34[_0x66c7('0x42')]=[{'all':!![]}];}return db[_0x66c7('0x2b')]['findAll'](_0x4f1a34);})['then'](function(_0x528f5c){_0x543fbf[_0x66c7('0x43')]=_0x528f5c;return _0x543fbf;})[_0x66c7('0x21')](respondWithFilteredResult(_0x263b48,_0x4f1a34))['catch'](handleError(_0x263b48,null));};exports['show']=function(_0x34d002,_0x3cd3ab){var _0x44d637={'raw':!![],'where':{'id':_0x34d002[_0x66c7('0x44')]['id']}},_0x900ee7={};_0x900ee7['model']=_[_0x66c7('0x30')](db['Tag']['rawAttributes']);_0x900ee7[_0x66c7('0x2f')]=_[_0x66c7('0x30')](_0x34d002[_0x66c7('0x2f')]);_0x900ee7[_0x66c7('0x31')]=_['intersection'](_0x900ee7['model'],_0x900ee7[_0x66c7('0x2f')]);_0x44d637['attributes']=_['intersection'](_0x900ee7[_0x66c7('0x2e')],qs[_0x66c7('0x34')](_0x34d002[_0x66c7('0x2f')][_0x66c7('0x34')]));_0x44d637['attributes']=_0x44d637[_0x66c7('0x33')][_0x66c7('0x35')]?_0x44d637[_0x66c7('0x33')]:_0x900ee7['model'];if(_0x34d002[_0x66c7('0x2f')][_0x66c7('0x41')]){_0x44d637[_0x66c7('0x42')]=[{'all':!![]}];}_0x44d637=_[_0x66c7('0x3b')]({},_0x44d637,_0x34d002[_0x66c7('0x3f')]);return db[_0x66c7('0x2b')][_0x66c7('0x45')](_0x44d637)[_0x66c7('0x21')](handleEntityNotFound(_0x3cd3ab,null))['then'](respondWithResult(_0x3cd3ab,null))[_0x66c7('0x46')](handleError(_0x3cd3ab,null));};exports[_0x66c7('0x47')]=function(_0x23d0eb,_0x1386a2){return db[_0x66c7('0x2b')][_0x66c7('0x47')](_0x23d0eb[_0x66c7('0x48')],{})[_0x66c7('0x21')](function(_0x1b3dc2){var _0x2d8eeb=_0x23d0eb[_0x66c7('0x49')][_0x66c7('0x23')]({'plain':!![]});if(!_0x2d8eeb)throw new Error(_0x66c7('0x4a'));if(_0x2d8eeb[_0x66c7('0x4b')]==='user'){var _0x43d4db=_0x1b3dc2[_0x66c7('0x23')]({'plain':!![]});var _0x27070b=_0x66c7('0x24');return db['UserProfileSection'][_0x66c7('0x45')]({'where':{'name':_0x27070b,'userProfileId':_0x2d8eeb[_0x66c7('0x4c')]},'raw':!![]})['then'](function(_0x275a20){if(_0x275a20&&_0x275a20[_0x66c7('0x4d')]===0x0){return db[_0x66c7('0x25')][_0x66c7('0x47')]({'name':_0x43d4db[_0x66c7('0x27')],'resourceId':_0x43d4db['id'],'type':_0x275a20[_0x66c7('0x27')],'sectionId':_0x275a20['id']},{})[_0x66c7('0x21')](function(){return _0x1b3dc2;});}else{return _0x1b3dc2;}})['catch'](function(_0x933dd6){logger[_0x66c7('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x933dd6);throw _0x933dd6;});}return _0x1b3dc2;})[_0x66c7('0x21')](respondWithResult(_0x1386a2,0xc9))[_0x66c7('0x46')](handleError(_0x1386a2,null));};exports[_0x66c7('0x4e')]=function(_0x5df6d1,_0x382a48){if(_0x5df6d1[_0x66c7('0x48')]['id']){delete _0x5df6d1[_0x66c7('0x48')]['id'];}return db[_0x66c7('0x2b')][_0x66c7('0x45')]({'where':{'id':_0x5df6d1[_0x66c7('0x44')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x382a48,null))[_0x66c7('0x21')](saveUpdates(_0x5df6d1['body'],null))[_0x66c7('0x21')](respondWithResult(_0x382a48,null))[_0x66c7('0x46')](handleError(_0x382a48,null));};exports['destroy']=function(_0x23f865,_0x167968){return db[_0x66c7('0x2b')]['find']({'where':{'id':_0x23f865['params']['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x167968,null))['then'](removeEntity(_0x167968,null))[_0x66c7('0x46')](handleError(_0x167968,null));}; \ No newline at end of file +var _0xb469=['to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','includeAll','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x140808,_0x2921b0){var _0x446482=function(_0x162c5a){while(--_0x162c5a){_0x140808['push'](_0x140808['shift']());}};_0x446482(++_0x2921b0);}(_0xb469,0x13b));var _0x9b46=function(_0x15f121,_0x4bb20b){_0x15f121=_0x15f121-0x0;var _0x36275b=_0xb469[_0x15f121];return _0x36275b;};'use strict';var emlformat=require(_0x9b46('0x0'));var rimraf=require(_0x9b46('0x1'));var zipdir=require(_0x9b46('0x2'));var jsonpatch=require(_0x9b46('0x3'));var rp=require(_0x9b46('0x4'));var moment=require(_0x9b46('0x5'));var BPromise=require(_0x9b46('0x6'));var Mustache=require('mustache');var util=require(_0x9b46('0x7'));var path=require(_0x9b46('0x8'));var sox=require('sox');var csv=require(_0x9b46('0x9'));var ejs=require(_0x9b46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b46('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b46('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9b46('0x9'));var querystring=require(_0x9b46('0xd'));var Papa=require(_0x9b46('0xe'));var Redis=require('ioredis');var authService=require(_0x9b46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9b46('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b46('0x11'))('api');var utils=require(_0x9b46('0x12'));var config=require(_0x9b46('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b46('0x14'))['db'];function respondWithStatusCode(_0x417df5,_0x5b65c2){_0x5b65c2=_0x5b65c2||0xcc;return function(_0x14362a){if(_0x14362a){return _0x417df5[_0x9b46('0x15')](_0x5b65c2);}return _0x417df5[_0x9b46('0x16')](_0x5b65c2)[_0x9b46('0x17')]();};}function respondWithResult(_0xa8f4ac,_0x35c5c1){_0x35c5c1=_0x35c5c1||0xc8;return function(_0x2136bc){if(_0x2136bc){return _0xa8f4ac[_0x9b46('0x16')](_0x35c5c1)[_0x9b46('0x18')](_0x2136bc);}};}function respondWithFilteredResult(_0x178293,_0xbc1ba6){return function(_0x135cc2){if(_0x135cc2){var _0x1e6911=typeof _0xbc1ba6['offset']==='undefined'&&typeof _0xbc1ba6['limit']===_0x9b46('0x19');var _0x5a380c=_0x135cc2[_0x9b46('0x1a')];var _0x5c5cc9=_0x1e6911?0x0:_0xbc1ba6['offset'];var _0x3d9efa=_0x1e6911?_0x135cc2['count']:_0xbc1ba6['offset']+_0xbc1ba6[_0x9b46('0x1b')];var _0x3a15cc;if(_0x3d9efa>=_0x5a380c){_0x3d9efa=_0x5a380c;_0x3a15cc=0xc8;}else{_0x3a15cc=0xce;}_0x178293['status'](_0x3a15cc);return _0x178293[_0x9b46('0x1c')](_0x9b46('0x1d'),_0x5c5cc9+'-'+_0x3d9efa+'/'+_0x5a380c)['json'](_0x135cc2);}return null;};}function patchUpdates(_0x55aece){return function(_0xbec2ea){try{jsonpatch[_0x9b46('0x1e')](_0xbec2ea,_0x55aece,!![]);}catch(_0x204098){return BPromise['reject'](_0x204098);}return _0xbec2ea['save']();};}function saveUpdates(_0x2b3440,_0x51d2ca){return function(_0x21dacb){if(_0x21dacb){return _0x21dacb[_0x9b46('0x1f')](_0x2b3440)['then'](function(_0xadff19){return _0xadff19;});}return null;};}function removeEntity(_0x5182b1,_0x141cb6){return function(_0x2b6f72){if(_0x2b6f72){return _0x2b6f72['destroy']()[_0x9b46('0x20')](function(){var _0x31ca63=_0x2b6f72[_0x9b46('0x21')]({'plain':!![]});var _0x319930=_0x9b46('0x22');return db[_0x9b46('0x23')][_0x9b46('0x24')]({'where':{'type':_0x319930,'resourceId':_0x31ca63['id']}})['then'](function(){return _0x2b6f72;});})[_0x9b46('0x20')](function(){_0x5182b1[_0x9b46('0x16')](0xcc)[_0x9b46('0x17')]();});}};}function handleEntityNotFound(_0x268821,_0x2468be){return function(_0x2a79a5){if(!_0x2a79a5){_0x268821[_0x9b46('0x15')](0x194);}return _0x2a79a5;};}function handleError(_0x50fb4a,_0x3bf5b9){_0x3bf5b9=_0x3bf5b9||0x1f4;return function(_0xee519e){logger[_0x9b46('0x25')](_0xee519e[_0x9b46('0x26')]);if(_0xee519e[_0x9b46('0x27')]){delete _0xee519e[_0x9b46('0x27')];}_0x50fb4a[_0x9b46('0x16')](_0x3bf5b9)[_0x9b46('0x28')](_0xee519e);};}exports[_0x9b46('0x29')]=function(_0x20090a,_0x2e1c51){var _0x5ab8b7={},_0x1f722d={},_0x27f326={'count':0x0,'rows':[]};var _0x807f2=_[_0x9b46('0x2a')](db[_0x9b46('0x2b')][_0x9b46('0x2c')],function(_0xbf8bc5){return{'name':_0xbf8bc5[_0x9b46('0x2d')],'type':_0xbf8bc5[_0x9b46('0x2e')][_0x9b46('0x2f')]};});_0x1f722d[_0x9b46('0x30')]=_['map'](_0x807f2,_0x9b46('0x27'));_0x1f722d['query']=_[_0x9b46('0x31')](_0x20090a[_0x9b46('0x32')]);_0x1f722d[_0x9b46('0x33')]=_['intersection'](_0x1f722d[_0x9b46('0x30')],_0x1f722d[_0x9b46('0x32')]);_0x5ab8b7[_0x9b46('0x34')]=_[_0x9b46('0x35')](_0x1f722d[_0x9b46('0x30')],qs['fields'](_0x20090a['query'][_0x9b46('0x36')]));_0x5ab8b7[_0x9b46('0x34')]=_0x5ab8b7[_0x9b46('0x34')][_0x9b46('0x37')]?_0x5ab8b7['attributes']:_0x1f722d[_0x9b46('0x30')];if(!_0x20090a['query'][_0x9b46('0x38')](_0x9b46('0x39'))){_0x5ab8b7[_0x9b46('0x1b')]=qs[_0x9b46('0x1b')](_0x20090a['query'][_0x9b46('0x1b')]);_0x5ab8b7['offset']=qs[_0x9b46('0x3a')](_0x20090a[_0x9b46('0x32')][_0x9b46('0x3a')]);}_0x5ab8b7[_0x9b46('0x3b')]=qs[_0x9b46('0x3c')](_0x20090a[_0x9b46('0x32')][_0x9b46('0x3c')]);_0x5ab8b7[_0x9b46('0x3d')]=qs[_0x9b46('0x33')](_[_0x9b46('0x3e')](_0x20090a[_0x9b46('0x32')],_0x1f722d['filters']),_0x807f2);if(_0x20090a[_0x9b46('0x32')]['filter']){_0x5ab8b7[_0x9b46('0x3d')]=_[_0x9b46('0x3f')](_0x5ab8b7['where'],{'$or':_[_0x9b46('0x2a')](_0x807f2,function(_0x4f953e){if(_0x4f953e[_0x9b46('0x2e')]!=='VIRTUAL'){var _0x443226={};_0x443226[_0x4f953e[_0x9b46('0x27')]]={'$like':'%'+_0x20090a[_0x9b46('0x32')][_0x9b46('0x40')]+'%'};return _0x443226;}})});}_0x5ab8b7=_[_0x9b46('0x3f')]({},_0x5ab8b7,_0x20090a['options']);var _0x4e268c={'where':_0x5ab8b7[_0x9b46('0x3d')]};return db['Tag']['count'](_0x4e268c)['then'](function(_0x4e1911){_0x27f326[_0x9b46('0x1a')]=_0x4e1911;if(_0x20090a['query'][_0x9b46('0x41')]){_0x5ab8b7['include']=[{'all':!![]}];}return db[_0x9b46('0x2b')][_0x9b46('0x42')](_0x5ab8b7);})[_0x9b46('0x20')](function(_0xa14b){_0x27f326[_0x9b46('0x43')]=_0xa14b;return _0x27f326;})[_0x9b46('0x20')](respondWithFilteredResult(_0x2e1c51,_0x5ab8b7))[_0x9b46('0x44')](handleError(_0x2e1c51,null));};exports[_0x9b46('0x45')]=function(_0x148d86,_0x5602a9){var _0x447302={'raw':!![],'where':{'id':_0x148d86[_0x9b46('0x46')]['id']}},_0xe7d0fc={};_0xe7d0fc[_0x9b46('0x30')]=_[_0x9b46('0x31')](db[_0x9b46('0x2b')][_0x9b46('0x2c')]);_0xe7d0fc[_0x9b46('0x32')]=_[_0x9b46('0x31')](_0x148d86[_0x9b46('0x32')]);_0xe7d0fc[_0x9b46('0x33')]=_[_0x9b46('0x35')](_0xe7d0fc[_0x9b46('0x30')],_0xe7d0fc[_0x9b46('0x32')]);_0x447302['attributes']=_['intersection'](_0xe7d0fc[_0x9b46('0x30')],qs[_0x9b46('0x36')](_0x148d86[_0x9b46('0x32')]['fields']));_0x447302['attributes']=_0x447302[_0x9b46('0x34')][_0x9b46('0x37')]?_0x447302[_0x9b46('0x34')]:_0xe7d0fc[_0x9b46('0x30')];if(_0x148d86[_0x9b46('0x32')][_0x9b46('0x41')]){_0x447302['include']=[{'all':!![]}];}_0x447302=_[_0x9b46('0x3f')]({},_0x447302,_0x148d86[_0x9b46('0x47')]);return db[_0x9b46('0x2b')]['find'](_0x447302)[_0x9b46('0x20')](handleEntityNotFound(_0x5602a9,null))['then'](respondWithResult(_0x5602a9,null))[_0x9b46('0x44')](handleError(_0x5602a9,null));};exports[_0x9b46('0x48')]=function(_0x16e6d8,_0x566bad){return db[_0x9b46('0x2b')][_0x9b46('0x48')](_0x16e6d8[_0x9b46('0x49')],{})[_0x9b46('0x20')](function(_0x3d4c13){var _0x373ffd=_0x16e6d8['user'][_0x9b46('0x21')]({'plain':!![]});if(!_0x373ffd)throw new Error(_0x9b46('0x4a'));if(_0x373ffd[_0x9b46('0x4b')]===_0x9b46('0x4c')){var _0x362311=_0x3d4c13[_0x9b46('0x21')]({'plain':!![]});var _0x4a1df0=_0x9b46('0x22');return db['UserProfileSection'][_0x9b46('0x4d')]({'where':{'name':_0x4a1df0,'userProfileId':_0x373ffd[_0x9b46('0x4e')]},'raw':!![]})[_0x9b46('0x20')](function(_0x33d9ac){if(_0x33d9ac&&_0x33d9ac[_0x9b46('0x4f')]===0x0){return db['UserProfileResource'][_0x9b46('0x48')]({'name':_0x362311[_0x9b46('0x27')],'resourceId':_0x362311['id'],'type':_0x33d9ac[_0x9b46('0x27')],'sectionId':_0x33d9ac['id']},{})[_0x9b46('0x20')](function(){return _0x3d4c13;});}else{return _0x3d4c13;}})[_0x9b46('0x44')](function(_0x14080e){logger[_0x9b46('0x25')](_0x9b46('0x50'),_0x14080e);throw _0x14080e;});}return _0x3d4c13;})[_0x9b46('0x20')](respondWithResult(_0x566bad,0xc9))[_0x9b46('0x44')](handleError(_0x566bad,null));};exports[_0x9b46('0x1f')]=function(_0x4d473f,_0x551a64){if(_0x4d473f['body']['id']){delete _0x4d473f[_0x9b46('0x49')]['id'];}return db['Tag'][_0x9b46('0x4d')]({'where':{'id':_0x4d473f['params']['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x551a64,null))['then'](saveUpdates(_0x4d473f[_0x9b46('0x49')],null))[_0x9b46('0x20')](respondWithResult(_0x551a64,null))[_0x9b46('0x44')](handleError(_0x551a64,null));};exports[_0x9b46('0x24')]=function(_0x35f71d,_0x5bcaad){return db[_0x9b46('0x2b')][_0x9b46('0x4d')]({'where':{'id':_0x35f71d[_0x9b46('0x46')]['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x5bcaad,null))[_0x9b46('0x20')](removeEntity(_0x5bcaad,null))['catch'](handleError(_0x5bcaad,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 02cb20e..fe9b282 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 _0x9a91=['define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x5b35d9,_0x2e3e2d){var _0x263f91=function(_0x54eefb){while(--_0x54eefb){_0x5b35d9['push'](_0x5b35d9['shift']());}};_0x263f91(++_0x2e3e2d);}(_0x9a91,0x153));var _0x19a9=function(_0x56b4f6,_0x3124e1){_0x56b4f6=_0x56b4f6-0x0;var _0x3c230f=_0x9a91[_0x56b4f6];return _0x3c230f;};'use strict';var _=require(_0x19a9('0x0'));var util=require(_0x19a9('0x1'));var logger=require(_0x19a9('0x2'))(_0x19a9('0x3'));var moment=require(_0x19a9('0x4'));var BPromise=require(_0x19a9('0x5'));var rp=require(_0x19a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19a9('0x7'));var config=require(_0x19a9('0x8'));var attributes=require(_0x19a9('0x9'));module[_0x19a9('0xa')]=function(_0x56ee26,_0x4c7821){return _0x56ee26[_0x19a9('0xb')](_0x19a9('0xc'),attributes,{'tableName':_0x19a9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa575=['path','rimraf','../../config/environment','./tag.attributes','Tag','tools_tags','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa575,0x150));var _0x5a57=function(_0x34c276,_0x5bb256){_0x34c276=_0x34c276-0x0;var _0x6cec06=_0xa575[_0x34c276];return _0x6cec06;};'use strict';var _=require(_0x5a57('0x0'));var util=require('util');var logger=require(_0x5a57('0x1'))(_0x5a57('0x2'));var moment=require('moment');var BPromise=require(_0x5a57('0x3'));var rp=require(_0x5a57('0x4'));var fs=require('fs');var path=require(_0x5a57('0x5'));var rimraf=require(_0x5a57('0x6'));var config=require(_0x5a57('0x7'));var attributes=require(_0x5a57('0x8'));module['exports']=function(_0x11a1c6,_0xf9690b){return _0x11a1c6['define'](_0x5a57('0x9'),attributes,{'tableName':_0x5a57('0xa'),'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 eb85c99..c0f2d03 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x31f9a5,_0x21f66c){var _0x2e5293=function(_0x236efc){while(--_0x236efc){_0x31f9a5['push'](_0x31f9a5['shift']());}};_0x2e5293(++_0x21f66c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x00bb[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x495e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x40c5f7,_0x1752a7){var _0x132694=function(_0x37b03b){while(--_0x37b03b){_0x40c5f7['push'](_0x40c5f7['shift']());}};_0x132694(++_0x1752a7);}(_0x495e,0xfb));var _0xe495=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x495e[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0xe495('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe495('0x1'));var rs=require(_0xe495('0x2'));var fs=require('fs');var Redis=require(_0xe495('0x3'));var db=require(_0xe495('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe495('0x5'))(_0xe495('0x6'));var config=require(_0xe495('0x7'));var jayson=require(_0xe495('0x8'));var client=jayson[_0xe495('0x9')][_0xe495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101a7e,_0x5745e3,_0x599ab4){return new BPromise(function(_0x5c17d0,_0x16f146){return client['request'](_0x101a7e,_0x599ab4)[_0xe495('0xb')](function(_0x3a9a00){logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));logger['debug'](_0xe495('0xf'),_0x5745e3,_0xe495('0xe'),JSON[_0xe495('0x10')](_0x3a9a00));if(_0x3a9a00['error']){if(_0x3a9a00[_0xe495('0x11')][_0xe495('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x16f146(_0x3a9a00['error'][_0xe495('0x13')]);}logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x5c17d0(_0x3a9a00['error'][_0xe495('0x13')]);}else{logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));_0x5c17d0(_0x3a9a00[_0xe495('0x14')]['message']);}})['catch'](function(_0x4de730){logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x4de730);_0x16f146(_0x4de730);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f9fa1bb..a18b20b 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 9e6eb63..3b404e4 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x1efa26,_0x431db3){var _0x16a0b4=function(_0x8a0359){while(--_0x8a0359){_0x1efa26['push'](_0x1efa26['shift']());}};_0x16a0b4(++_0x431db3);}(_0x757a,0xde));var _0xa757=function(_0x4ed8eb,_0x4fa5d3){_0x4ed8eb=_0x4ed8eb-0x0;var _0x3ff638=_0x757a[_0x4ed8eb];return _0x3ff638;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 73510b0..db49589 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 _0xf48f=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','order','capitalize','Queues','add','ids','remove','addAgents','Voice','Chat','Sms','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','TeamVoicePrefix','VoicePrefixId','isArray','Fax','Openchannel','removeAgents','Queue:remove','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','error','stack','name','send','map','Team','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x329808,_0x343255){var _0x1bbad0=function(_0x458c5b){while(--_0x458c5b){_0x329808['push'](_0x329808['shift']());}};_0x1bbad0(++_0x343255);}(_0xf48f,0x181));var _0xff48=function(_0x443423,_0x171ddc){_0x443423=_0x443423-0x0;var _0x56256b=_0xf48f[_0x443423];return _0x56256b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xff48('0x0'));var jsonpatch=require(_0xff48('0x1'));var rp=require(_0xff48('0x2'));var moment=require('moment');var BPromise=require(_0xff48('0x3'));var Mustache=require(_0xff48('0x4'));var util=require(_0xff48('0x5'));var path=require(_0xff48('0x6'));var sox=require(_0xff48('0x7'));var csv=require(_0xff48('0x8'));var ejs=require(_0xff48('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff48('0xa'));var squel=require('squel');var crypto=require(_0xff48('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff48('0x8'));var querystring=require('querystring');var Papa=require(_0xff48('0xc'));var Redis=require(_0xff48('0xd'));var authService=require(_0xff48('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xff48('0xf'));var hardwareService=require(_0xff48('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xff48('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xff48('0x12'));var db=require('../../mysqldb')['db'];config[_0xff48('0x13')]=_['defaults'](config[_0xff48('0x13')],{'host':_0xff48('0x14'),'port':0x18eb});var socket=require(_0xff48('0x15'))(new Redis(config[_0xff48('0x13')]));require(_0xff48('0x16'))['register'](socket);function respondWithStatusCode(_0x400700,_0x49dfe9){_0x49dfe9=_0x49dfe9||0xcc;return function(_0x215e87){if(_0x215e87){return _0x400700[_0xff48('0x17')](_0x49dfe9);}return _0x400700[_0xff48('0x18')](_0x49dfe9)[_0xff48('0x19')]();};}function respondWithResult(_0x36b735,_0x4fdacf){_0x4fdacf=_0x4fdacf||0xc8;return function(_0x2d74c5){if(_0x2d74c5){return _0x36b735[_0xff48('0x18')](_0x4fdacf)[_0xff48('0x1a')](_0x2d74c5);}};}function respondWithFilteredResult(_0x206c67,_0x9ec550){return function(_0x5a5e3d){if(_0x5a5e3d){var _0x128ebd=typeof _0x9ec550['offset']===_0xff48('0x1b')&&typeof _0x9ec550[_0xff48('0x1c')]==='undefined';var _0x402684=_0x5a5e3d['count'];var _0x3bcc8b=_0x128ebd?0x0:_0x9ec550[_0xff48('0x1d')];var _0x5959f4=_0x128ebd?_0x5a5e3d[_0xff48('0x1e')]:_0x9ec550[_0xff48('0x1d')]+_0x9ec550[_0xff48('0x1c')];var _0x58f2a2;if(_0x5959f4>=_0x402684){_0x5959f4=_0x402684;_0x58f2a2=0xc8;}else{_0x58f2a2=0xce;}_0x206c67[_0xff48('0x18')](_0x58f2a2);return _0x206c67[_0xff48('0x1f')](_0xff48('0x20'),_0x3bcc8b+'-'+_0x5959f4+'/'+_0x402684)['json'](_0x5a5e3d);}return null;};}function patchUpdates(_0x31cf16){return function(_0x1b057e){try{jsonpatch['apply'](_0x1b057e,_0x31cf16,!![]);}catch(_0x17756e){return BPromise[_0xff48('0x21')](_0x17756e);}return _0x1b057e[_0xff48('0x22')]();};}function saveUpdates(_0x24b46f,_0x43164a){return function(_0x52e56a){if(_0x52e56a){return _0x52e56a[_0xff48('0x23')](_0x24b46f)[_0xff48('0x24')](function(_0x1015e7){return _0x1015e7;});}return null;};}function handleEntityNotFound(_0x212b16,_0x4285ad){return function(_0x3ebaf4){if(!_0x3ebaf4){_0x212b16['sendStatus'](0x194);}return _0x3ebaf4;};}function handleError(_0x6c6cd6,_0x1d3aa6){_0x1d3aa6=_0x1d3aa6||0x1f4;return function(_0x4b44f9){logger[_0xff48('0x25')](_0x4b44f9[_0xff48('0x26')]);if(_0x4b44f9[_0xff48('0x27')]){delete _0x4b44f9[_0xff48('0x27')];}_0x6c6cd6['status'](_0x1d3aa6)[_0xff48('0x28')](_0x4b44f9);};}exports['index']=function(_0x2cbfb9,_0x173aa4){var _0x3ee0b1={},_0x5e8102={},_0x2a9f81={'count':0x0,'rows':[]};var _0x17d44b=_[_0xff48('0x29')](db[_0xff48('0x2a')][_0xff48('0x2b')],function(_0x5c0762){return{'name':_0x5c0762[_0xff48('0x2c')],'type':_0x5c0762['type'][_0xff48('0x2d')]};});_0x5e8102['model']=_[_0xff48('0x29')](_0x17d44b,_0xff48('0x27'));_0x5e8102[_0xff48('0x2e')]=_[_0xff48('0x2f')](_0x2cbfb9[_0xff48('0x2e')]);_0x5e8102[_0xff48('0x30')]=_[_0xff48('0x31')](_0x5e8102[_0xff48('0x32')],_0x5e8102[_0xff48('0x2e')]);_0x3ee0b1[_0xff48('0x33')]=_[_0xff48('0x31')](_0x5e8102[_0xff48('0x32')],qs['fields'](_0x2cbfb9[_0xff48('0x2e')][_0xff48('0x34')]));_0x3ee0b1[_0xff48('0x33')]=_0x3ee0b1['attributes']['length']?_0x3ee0b1[_0xff48('0x33')]:_0x5e8102[_0xff48('0x32')];if(!_0x2cbfb9['query'][_0xff48('0x35')](_0xff48('0x36'))){_0x3ee0b1[_0xff48('0x1c')]=qs[_0xff48('0x1c')](_0x2cbfb9[_0xff48('0x2e')][_0xff48('0x1c')]);_0x3ee0b1[_0xff48('0x1d')]=qs[_0xff48('0x1d')](_0x2cbfb9[_0xff48('0x2e')][_0xff48('0x1d')]);}_0x3ee0b1['order']=qs['sort'](_0x2cbfb9[_0xff48('0x2e')][_0xff48('0x37')]);_0x3ee0b1[_0xff48('0x38')]=qs[_0xff48('0x30')](_[_0xff48('0x39')](_0x2cbfb9[_0xff48('0x2e')],_0x5e8102[_0xff48('0x30')]),_0x17d44b);if(_0x2cbfb9[_0xff48('0x2e')][_0xff48('0x3a')]){_0x3ee0b1[_0xff48('0x38')]=_[_0xff48('0x3b')](_0x3ee0b1[_0xff48('0x38')],{'$or':_[_0xff48('0x29')](_0x17d44b,function(_0x3d4b4c){if(_0x3d4b4c['type']!==_0xff48('0x3c')){var _0x54b224={};_0x54b224[_0x3d4b4c[_0xff48('0x27')]]={'$like':'%'+_0x2cbfb9[_0xff48('0x2e')][_0xff48('0x3a')]+'%'};return _0x54b224;}})});}_0x3ee0b1=_[_0xff48('0x3b')]({},_0x3ee0b1,_0x2cbfb9[_0xff48('0x3d')]);var _0x5188c0={'where':_0x3ee0b1[_0xff48('0x38')]};return db[_0xff48('0x2a')][_0xff48('0x1e')](_0x5188c0)[_0xff48('0x24')](function(_0x233e5f){_0x2a9f81[_0xff48('0x1e')]=_0x233e5f;if(_0x2cbfb9['query'][_0xff48('0x3e')]){_0x3ee0b1[_0xff48('0x3f')]=[{'all':!![]}];}return db[_0xff48('0x2a')][_0xff48('0x40')](_0x3ee0b1);})['then'](function(_0x3c5ffb){_0x2a9f81[_0xff48('0x41')]=_0x3c5ffb;return _0x2a9f81;})[_0xff48('0x24')](respondWithFilteredResult(_0x173aa4,_0x3ee0b1))[_0xff48('0x42')](handleError(_0x173aa4,null));};exports['show']=function(_0x1c8dd3,_0x27ae8e){var _0xcb0dcb={'raw':![],'where':{'id':_0x1c8dd3[_0xff48('0x43')]['id']}},_0x1f6a51={};_0x1f6a51[_0xff48('0x32')]=_[_0xff48('0x2f')](db[_0xff48('0x2a')][_0xff48('0x2b')]);_0x1f6a51[_0xff48('0x2e')]=_[_0xff48('0x2f')](_0x1c8dd3[_0xff48('0x2e')]);_0x1f6a51[_0xff48('0x30')]=_[_0xff48('0x31')](_0x1f6a51[_0xff48('0x32')],_0x1f6a51[_0xff48('0x2e')]);_0xcb0dcb[_0xff48('0x33')]=_[_0xff48('0x31')](_0x1f6a51[_0xff48('0x32')],qs[_0xff48('0x34')](_0x1c8dd3['query'][_0xff48('0x34')]));_0xcb0dcb[_0xff48('0x33')]=_0xcb0dcb['attributes'][_0xff48('0x44')]?_0xcb0dcb[_0xff48('0x33')]:_0x1f6a51[_0xff48('0x32')];if(_0x1c8dd3[_0xff48('0x2e')][_0xff48('0x3e')]){_0xcb0dcb[_0xff48('0x3f')]=[{'all':!![]}];}_0xcb0dcb=_[_0xff48('0x3b')]({},_0xcb0dcb,_0x1c8dd3['options']);return db['Team'][_0xff48('0x45')](_0xcb0dcb)[_0xff48('0x24')](handleEntityNotFound(_0x27ae8e,null))['then'](respondWithResult(_0x27ae8e,null))[_0xff48('0x42')](handleError(_0x27ae8e,null));};exports[_0xff48('0x46')]=function(_0x21d0b3,_0x91766b){return db[_0xff48('0x2a')][_0xff48('0x46')](_0x21d0b3[_0xff48('0x47')],{})['then'](function(_0x459e36){var _0x23d4b9=_0x21d0b3[_0xff48('0x48')][_0xff48('0x49')]({'plain':!![]});if(!_0x23d4b9)throw new Error(_0xff48('0x4a'));if(_0x23d4b9['role']===_0xff48('0x48')){var _0x26f584=_0x459e36[_0xff48('0x49')]({'plain':!![]});var _0x55f883=_0xff48('0x4b');return db['UserProfileSection'][_0xff48('0x45')]({'where':{'name':_0x55f883,'userProfileId':_0x23d4b9['userProfileId']},'raw':!![]})[_0xff48('0x24')](function(_0x1b248a){if(_0x1b248a&&_0x1b248a[_0xff48('0x4c')]===0x0){return db[_0xff48('0x4d')][_0xff48('0x46')]({'name':_0x26f584[_0xff48('0x27')],'resourceId':_0x26f584['id'],'type':_0x1b248a[_0xff48('0x27')],'sectionId':_0x1b248a['id']},{})['then'](function(){return _0x459e36;});}else{return _0x459e36;}})[_0xff48('0x42')](function(_0x284727){logger[_0xff48('0x25')](_0xff48('0x4e'),_0x284727);throw _0x284727;});}return _0x459e36;})['then'](respondWithResult(_0x91766b,0xc9))['catch'](handleError(_0x91766b,null));};exports[_0xff48('0x23')]=function(_0xc9c411,_0x5764d3){if(_0xc9c411['body']['id']){delete _0xc9c411['body']['id'];}return db[_0xff48('0x2a')][_0xff48('0x45')]({'where':{'id':_0xc9c411[_0xff48('0x43')]['id']}})[_0xff48('0x24')](handleEntityNotFound(_0x5764d3,null))[_0xff48('0x24')](saveUpdates(_0xc9c411[_0xff48('0x47')],null))['then'](respondWithResult(_0x5764d3,null))[_0xff48('0x42')](handleError(_0x5764d3,null));};exports[_0xff48('0x4f')]=function(_0x3bfa94,_0x3d3d8c){var _0x57fff0=_0x3bfa94[_0xff48('0x43')]['id'];var _0x126f53=[];return db[_0xff48('0x50')][_0xff48('0x51')](function(_0x11a62f){var _0x294b41=_0xff48('0x52')+_0x57fff0;return db[_0xff48('0x50')]['query'](_0x294b41,{'type':db[_0xff48('0x53')][_0xff48('0x54')][_0xff48('0x55')],'raw':!![],'transaction':_0x11a62f})[_0xff48('0x24')](function(_0x55a4ff){_0x126f53=_[_0xff48('0x29')](_0x55a4ff,function(_0x10046b){return Number(_0x10046b[_0xff48('0x56')]);});})[_0xff48('0x24')](function(){var _0xa58678=_0xff48('0x57')+_0x57fff0;return db['sequelize'][_0xff48('0x2e')](_0xa58678,{'type':db['Sequelize'][_0xff48('0x54')][_0xff48('0x55')],'raw':!![],'transaction':_0x11a62f});})[_0xff48('0x24')](function(_0x1f414f){var _0x3928ba=_[_0xff48('0x29')](_0x1f414f,function(_0x5bf661){return Number(_0x5bf661['VoiceQueueId']);});return db[_0xff48('0x58')][_0xff48('0x4f')]({'where':{'UserId':{'$in':_0x126f53},'VoiceQueueId':{'$in':_0x3928ba}},'transaction':_0x11a62f});})[_0xff48('0x24')](function(){var _0x250b74=_0xff48('0x59')+_0x57fff0;return db[_0xff48('0x50')][_0xff48('0x2e')](_0x250b74,{'type':db[_0xff48('0x53')]['QueryTypes'][_0xff48('0x55')],'raw':!![],'transaction':_0x11a62f});})[_0xff48('0x24')](function(_0x1566ee){var _0x209bf0=_[_0xff48('0x29')](_0x1566ee,function(_0x5331bc){return Number(_0x5331bc[_0xff48('0x5a')]);});return db[_0xff48('0x5b')][_0xff48('0x4f')]({'where':{'UserId':{'$in':_0x126f53},'MailQueueId':{'$in':_0x209bf0}},'transaction':_0x11a62f});})[_0xff48('0x24')](function(){var _0x327348=_0xff48('0x5c')+_0x57fff0;return db[_0xff48('0x50')][_0xff48('0x2e')](_0x327348,{'type':db[_0xff48('0x53')][_0xff48('0x54')][_0xff48('0x55')],'raw':!![],'transaction':_0x11a62f});})[_0xff48('0x24')](function(_0x49387d){var _0x334683=_[_0xff48('0x29')](_0x49387d,function(_0x5504bd){return Number(_0x5504bd['SmsQueueId']);});return db[_0xff48('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x126f53},'SmsQueueId':{'$in':_0x334683}},'transaction':_0x11a62f});})[_0xff48('0x24')](function(){var _0x1b3c4a=_0xff48('0x5e')+_0x57fff0;return db['sequelize'][_0xff48('0x2e')](_0x1b3c4a,{'type':db[_0xff48('0x53')][_0xff48('0x54')]['SELECT'],'raw':!![],'transaction':_0x11a62f});})[_0xff48('0x24')](function(_0x5beb91){var _0x244631=_[_0xff48('0x29')](_0x5beb91,function(_0x23417e){return Number(_0x23417e['ChatQueueId']);});return db[_0xff48('0x5f')][_0xff48('0x4f')]({'where':{'UserId':{'$in':_0x126f53},'ChatQueueId':{'$in':_0x244631}},'transaction':_0x11a62f});})['then'](function(){var _0x48501f=_0xff48('0x60')+_0x57fff0;return db[_0xff48('0x50')][_0xff48('0x2e')](_0x48501f,{'type':db[_0xff48('0x53')]['QueryTypes'][_0xff48('0x55')],'raw':!![],'transaction':_0x11a62f});})['then'](function(_0x52fd86){var _0x282d99=_[_0xff48('0x29')](_0x52fd86,function(_0xaa431f){return Number(_0xaa431f['FaxQueueId']);});return db[_0xff48('0x61')][_0xff48('0x4f')]({'where':{'UserId':{'$in':_0x126f53},'FaxQueueId':{'$in':_0x282d99}},'transaction':_0x11a62f});})[_0xff48('0x24')](function(){var _0xe0d50b='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x57fff0;return db[_0xff48('0x50')][_0xff48('0x2e')](_0xe0d50b,{'type':db[_0xff48('0x53')][_0xff48('0x54')][_0xff48('0x55')],'raw':!![],'transaction':_0x11a62f});})[_0xff48('0x24')](function(_0x342a67){var _0x22a796=_[_0xff48('0x29')](_0x342a67,function(_0x154bfa){return Number(_0x154bfa[_0xff48('0x62')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x126f53},'OpenchannelQueueId':{'$in':_0x22a796}},'transaction':_0x11a62f});})[_0xff48('0x24')](function(){var _0x447729=_0xff48('0x63')+_0x57fff0;return db[_0xff48('0x50')][_0xff48('0x2e')](_0x447729,{'type':db[_0xff48('0x53')][_0xff48('0x54')][_0xff48('0x55')],'raw':!![],'transaction':_0x11a62f});})[_0xff48('0x24')](function(_0x6e13c6){var _0x5b43f7=_[_0xff48('0x29')](_0x6e13c6,function(_0x29c380){return Number(_0x29c380[_0xff48('0x64')]);});return db[_0xff48('0x65')]['destroy']({'where':{'UserId':{'$in':_0x126f53},'WhatsappQueueId':{'$in':_0x5b43f7}},'transaction':_0x11a62f});})[_0xff48('0x24')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x57fff0}});})[_0xff48('0x24')](function(_0x35d85f){if(_0x35d85f===null){return;}return db[_0xff48('0x66')][_0xff48('0x4f')]({'where':{'UserId':{'$in':_0x126f53},'VoicePrefixId':_0x35d85f['VoicePrefixId']},'transaction':_0x11a62f});})['then'](function(){return db[_0xff48('0x2a')][_0xff48('0x4f')]({'where':{'id':_0x57fff0},'cascade':!![],'transaction':_0x11a62f});})[_0xff48('0x24')](function(_0x3b12a0){if(_0x3b12a0===0x0){_0x3d3d8c[_0xff48('0x17')](0x194);}else{return db[_0xff48('0x4d')][_0xff48('0x4f')]({'where':{'type':_0xff48('0x4b'),'resourceId':_0x57fff0},'cascade':!![],'transaction':_0x11a62f})[_0xff48('0x24')](function(){_0x3d3d8c['status'](0xcc)[_0xff48('0x19')]();});}})['catch'](function(_0x1282dd){_0x3d3d8c[_0xff48('0x18')](0x1f4)[_0xff48('0x28')](_0x1282dd);});});};exports[_0xff48('0x67')]=function(_0x4fbab7,_0x393358,_0x399cc5){return db[_0xff48('0x2a')][_0xff48('0x68')]({'where':{'id':_0x4fbab7[_0xff48('0x43')]['id']}})['then'](handleEntityNotFound(_0x393358,null))[_0xff48('0x24')](function(_0x333bed){if(!_0x4fbab7[_0xff48('0x2e')][_0xff48('0x69')]||!utils[_0xff48('0x6a')](_0x4fbab7['query'][_0xff48('0x69')])){throw new db['Sequelize'][(_0xff48('0x6b'))](_0xff48('0x6c'));}var _0x1e4dfa={};var _0x43b39c={};_0x43b39c[_0xff48('0x32')]=_[_0xff48('0x2f')](db[_['capitalize'](_0x4fbab7['query'][_0xff48('0x69')][_0xff48('0x6d')]())+'Queue'][_0xff48('0x2b')]);_0x43b39c[_0xff48('0x2e')]=_['keys'](_0x4fbab7['query']);_0x43b39c[_0xff48('0x30')]=_[_0xff48('0x31')](_0x43b39c['model'],_0x43b39c[_0xff48('0x2e')]);_0x1e4dfa[_0xff48('0x33')]=_['intersection'](_0x43b39c[_0xff48('0x32')],qs[_0xff48('0x34')](_0x4fbab7[_0xff48('0x2e')][_0xff48('0x34')]));_0x1e4dfa[_0xff48('0x33')]=_0x1e4dfa[_0xff48('0x33')][_0xff48('0x44')]?_0x1e4dfa[_0xff48('0x33')]:_0x43b39c[_0xff48('0x32')];_0x1e4dfa[_0xff48('0x1c')]=qs['limit'](_0x4fbab7[_0xff48('0x2e')][_0xff48('0x1c')]);_0x1e4dfa['offset']=qs[_0xff48('0x1d')](_0x4fbab7[_0xff48('0x2e')][_0xff48('0x1d')]);_0x1e4dfa[_0xff48('0x6e')]=qs[_0xff48('0x37')](_0x4fbab7[_0xff48('0x2e')][_0xff48('0x37')]);_0x1e4dfa[_0xff48('0x38')]=qs[_0xff48('0x30')](_[_0xff48('0x39')](_0x4fbab7['query'],_0x43b39c[_0xff48('0x30')]));_0x1e4dfa=_[_0xff48('0x3b')]({},_0x1e4dfa,_0x4fbab7['options']);return _0x333bed[_0xff48('0x49')+_[_0xff48('0x6f')](_0x4fbab7[_0xff48('0x2e')][_0xff48('0x69')][_0xff48('0x6d')]())+_0xff48('0x70')](_0x1e4dfa);})[_0xff48('0x24')](respondWithResult(_0x393358,null))[_0xff48('0x42')](handleError(_0x393358,null));};exports['addQueues']=function(_0x590ebe,_0x3bbf16,_0x2aced2){return db[_0xff48('0x2a')][_0xff48('0x68')]({'where':{'id':_0x590ebe[_0xff48('0x43')]['id']}})[_0xff48('0x24')](function(_0x150c58){if(_0x150c58){if(!_0x590ebe[_0xff48('0x47')][_0xff48('0x69')]||!utils[_0xff48('0x6a')](_0x590ebe['body'][_0xff48('0x69')])){throw new db[(_0xff48('0x53'))][(_0xff48('0x6b'))]('Unknown\x20channel');}return _0x150c58[_0xff48('0x71')+_[_0xff48('0x6f')](_0x590ebe['body'][_0xff48('0x69')][_0xff48('0x6d')]())+_0xff48('0x70')](_0x590ebe[_0xff48('0x47')][_0xff48('0x72')]);}return null;})['then'](handleEntityNotFound(_0x3bbf16,null))[_0xff48('0x24')](respondWithStatusCode(_0x3bbf16,null))[_0xff48('0x42')](handleError(_0x3bbf16,null));};exports['removeQueues']=function(_0x2cf50f,_0x28dbbc,_0x29a390){return db[_0xff48('0x2a')]['findOne']({'where':{'id':_0x2cf50f[_0xff48('0x43')]['id']}})[_0xff48('0x24')](function(_0x53b558){if(_0x53b558){if(!_0x2cf50f[_0xff48('0x2e')][_0xff48('0x69')]||!utils[_0xff48('0x6a')](_0x2cf50f[_0xff48('0x2e')][_0xff48('0x69')])){throw new db[(_0xff48('0x53'))][(_0xff48('0x6b'))](_0xff48('0x6c'));}return _0x53b558[_0xff48('0x73')+_[_0xff48('0x6f')](_0x2cf50f[_0xff48('0x2e')]['channel'][_0xff48('0x6d')]())+'Queues'](_0x2cf50f['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x28dbbc,null))[_0xff48('0x24')](respondWithStatusCode(_0x28dbbc,null))[_0xff48('0x42')](handleError(_0x28dbbc,null));};exports[_0xff48('0x74')]=function(_0x294d54,_0x43cfff){var _0x95e175=_['isArray'](_0x294d54[_0xff48('0x47')][_0xff48('0x72')])?_0x294d54[_0xff48('0x47')]['ids']:[_0x294d54[_0xff48('0x47')][_0xff48('0x72')]];var _0x3e03fa=_0x294d54[_0xff48('0x43')]['id'];return db[_0xff48('0x2a')]['find']({'where':{'id':_0x3e03fa}})['then'](handleEntityNotFound(_0x43cfff,null))[_0xff48('0x24')](function(_0x29c06d){if(_0x29c06d){var _0x1f8af5=[_0xff48('0x75'),_0xff48('0x76'),'Mail',_0xff48('0x77'),'Fax','Openchannel',_0xff48('0x78')];return db['sequelize'][_0xff48('0x51')](function(_0x52528a){var _0x534535=_['map'](_0x1f8af5,function(_0x5cd9fd){var _0x3362e6={'attributes':['id',_0xff48('0x27')]};if(_0x5cd9fd===_0xff48('0x75')){_0x3362e6[_0xff48('0x79')]={'attributes':[_0xff48('0x7a')]};}return _0x29c06d[_0xff48('0x49')+_0x5cd9fd+_0xff48('0x70')](_0x3362e6)[_0xff48('0x24')](function(_0x4abfb5){var _0x2685ff=_[_0xff48('0x29')](_0x4abfb5,function(_0x5190b3){var _0x1facee=_[_0xff48('0x29')](_0x95e175,function(_0x3ee6a0){var _0x1d3951={'where':{'UserId':_0x3ee6a0,[_0x5cd9fd+_0xff48('0x7b')]:_0x5190b3['id']},'transaction':_0x52528a};if(_0x5cd9fd==='Voice'){_0x1d3951[_0xff48('0x7c')]={'penalty':_0x5190b3[_0xff48('0x7d')]['penalty']};}return db[_0xff48('0x7e')+_0x5cd9fd+_0xff48('0x7f')][_0xff48('0x80')](_0x1d3951)[_0xff48('0x24')](function(){socket[_0xff48('0x81')]('user'+_0x5cd9fd+_0xff48('0x82'),{'UserId':_0x3ee6a0,[_0x5cd9fd+'QueueId']:_0x5190b3['id']});if(_0x5cd9fd!==_0xff48('0x75')){return;}return db[_0xff48('0x7e')][_0xff48('0x40')]({'where':{'id':_0x95e175,'online':0x1},'attributes':['id',_0xff48('0x27'),_0xff48('0x83'),_0xff48('0x84'),'interface'],'raw':!![]})[_0xff48('0x24')](function(_0x426210){var _0x579711=_['map'](_0x426210,function(_0x374c7f){return db[_0xff48('0x85')][_0xff48('0x86')]({'membername':_0x374c7f[_0xff48('0x27')],'UserId':_0x374c7f['id'],'queue_name':_0x5190b3[_0xff48('0x27')],'VoiceQueueId':_0x5190b3['id'],'interface':_[_0xff48('0x87')](_0x374c7f[_0xff48('0x88')])?util[_0xff48('0x89')](_0xff48('0x8a'),_0x374c7f[_0xff48('0x27')]):_0x374c7f[_0xff48('0x88')],'paused':_0x374c7f['voicePause']||![],'penalty':_0x5190b3[_0xff48('0x7d')][_0xff48('0x7a')]},{'transaction':_0x52528a});});return Promise[_0xff48('0x8b')](_0x579711);});});});return Promise[_0xff48('0x8b')](_0x1facee);});return Promise[_0xff48('0x8b')](_0x2685ff);})['then'](function(){return db[_0xff48('0x8c')]['findOne']({'where':{'teamId':_0x3e03fa}})[_0xff48('0x24')](function(_0x3f6661){if(_0x3f6661){var _0x58210d=_[_0xff48('0x29')](_0x95e175,function(_0x37b6cc){db[_0xff48('0x66')][_0xff48('0x86')]({'UserId':_0x37b6cc,'VoicePrefixId':_0x3f6661[_0xff48('0x8d')]});});return Promise[_0xff48('0x8b')](_0x58210d);}});});});return Promise[_0xff48('0x8b')](_0x534535)[_0xff48('0x24')](function(){return _0x29c06d[_0xff48('0x74')](_0x95e175,{'transaction':_0x52528a})['spread'](function(_0xfed814){return _0xfed814;});});});}})[_0xff48('0x24')](respondWithResult(_0x43cfff,null))[_0xff48('0x42')](handleError(_0x43cfff,null));};exports['removeAgents']=function(_0x8f2425,_0x546315){var _0x55a334=_[_0xff48('0x8e')](_0x8f2425[_0xff48('0x2e')][_0xff48('0x72')])?_0x8f2425[_0xff48('0x2e')]['ids']:[_0x8f2425[_0xff48('0x2e')][_0xff48('0x72')]];var _0x3695b5=_0x8f2425['params']['id'];return db[_0xff48('0x2a')][_0xff48('0x45')]({'where':{'id':_0x3695b5}})[_0xff48('0x24')](handleEntityNotFound(_0x546315,null))[_0xff48('0x24')](function(_0xd155a2){if(_0xd155a2){var _0xfa8f4a=['Voice',_0xff48('0x76'),'Mail',_0xff48('0x77'),_0xff48('0x8f'),_0xff48('0x90'),_0xff48('0x78')];return db[_0xff48('0x50')][_0xff48('0x51')](function(_0x1046cf){var _0x4e3ef7=_[_0xff48('0x29')](_0xfa8f4a,function(_0xdfa42f){var _0xf968bc={'attributes':['id',_0xff48('0x27')]};return _0xd155a2[_0xff48('0x49')+_0xdfa42f+_0xff48('0x70')](_0xf968bc)[_0xff48('0x24')](function(_0x2762bf){var _0x543bde=_['map'](_0x2762bf,function(_0x252e76){return _0x252e76[_0xff48('0x91')](_0x55a334,{'transaction':_0x1046cf})['then'](function(){var _0x526442=_[_0xff48('0x29')](_0x55a334,function(_0x2e5747){socket[_0xff48('0x81')](_0xff48('0x48')+_0xdfa42f+_0xff48('0x92'),{'UserId':Number(_0x2e5747),[_0xdfa42f+'QueueId']:_0x252e76['id']});if(_0xdfa42f!==_0xff48('0x75')){return;}return db[_0xff48('0x85')][_0xff48('0x4f')]({'where':{'VoiceQueueId':_0x252e76['id'],'UserId':_0x2e5747},'transaction':_0x1046cf});});return Promise['all'](_0x526442);});});return Promise['all'](_0x543bde);});});return Promise['all'](_0x4e3ef7)['then'](function(){return _0xd155a2[_0xff48('0x91')](_0x55a334,{'transaction':_0x1046cf});})[_0xff48('0x24')](function(){return db[_0xff48('0x8c')]['findOne']({'where':{'teamId':_0x3695b5}})['then'](function(_0xacf12e){if(_0xacf12e){var _0x5c27b1=_['map'](_0x55a334,function(_0x4f4e6e){db[_0xff48('0x66')][_0xff48('0x4f')]({'where':{'UserId':_0x4f4e6e,'VoicePrefixId':_0xacf12e[_0xff48('0x8d')]}});});return Promise[_0xff48('0x8b')](_0x5c27b1);}});});});}})[_0xff48('0x24')](respondWithStatusCode(_0x546315,null))[_0xff48('0x42')](handleError(_0x546315,null));};exports[_0xff48('0x93')]=function(_0x53c7a2,_0x44dbfe,_0x38100c){var _0x910732={};var _0x11ab28={};var _0xa90e08;var _0x3d2cc2;return db[_0xff48('0x2a')][_0xff48('0x68')]({'where':{'id':_0x53c7a2[_0xff48('0x43')]['id']}})[_0xff48('0x24')](handleEntityNotFound(_0x44dbfe,null))[_0xff48('0x24')](function(_0x371b8a){if(_0x371b8a){_0xa90e08=_0x371b8a;_0x11ab28[_0xff48('0x32')]=_[_0xff48('0x2f')](db['User']['rawAttributes']);_0x11ab28[_0xff48('0x2e')]=_[_0xff48('0x2f')](_0x53c7a2[_0xff48('0x2e')]);_0x11ab28[_0xff48('0x30')]=_[_0xff48('0x31')](_0x11ab28['model'],_0x11ab28[_0xff48('0x2e')]);_0x910732[_0xff48('0x33')]=_['intersection'](_0x11ab28[_0xff48('0x32')],qs[_0xff48('0x34')](_0x53c7a2['query']['fields']));_0x910732[_0xff48('0x33')]=_0x910732[_0xff48('0x33')][_0xff48('0x44')]?_0x910732['attributes']:_0x11ab28[_0xff48('0x32')];_0x910732[_0xff48('0x6e')]=qs['sort'](_0x53c7a2['query'][_0xff48('0x37')]);_0x910732[_0xff48('0x38')]=qs[_0xff48('0x30')](_['pick'](_0x53c7a2[_0xff48('0x2e')],_0x11ab28['filters']));if(_0x53c7a2[_0xff48('0x2e')][_0xff48('0x3a')]){_0x910732[_0xff48('0x38')]=_[_0xff48('0x3b')](_0x910732[_0xff48('0x38')],{'$or':_[_0xff48('0x29')](_0x910732[_0xff48('0x33')],function(_0x24bc01){var _0x16c0ce={};_0x16c0ce[_0x24bc01]={'$like':'%'+_0x53c7a2[_0xff48('0x2e')][_0xff48('0x3a')]+'%'};return _0x16c0ce;})});}_0x910732=_[_0xff48('0x3b')]({},_0x910732,_0x53c7a2[_0xff48('0x3d')]);return _0xa90e08[_0xff48('0x93')](_0x910732);}})['then'](function(_0x23a0a5){if(_0x23a0a5){_0x3d2cc2=_0x23a0a5[_0xff48('0x44')];if(!_0x53c7a2[_0xff48('0x2e')][_0xff48('0x35')](_0xff48('0x36'))){_0x910732['limit']=qs['limit'](_0x53c7a2[_0xff48('0x2e')][_0xff48('0x1c')]);_0x910732[_0xff48('0x1d')]=qs[_0xff48('0x1d')](_0x53c7a2['query'][_0xff48('0x1d')]);}return _0xa90e08[_0xff48('0x93')](_0x910732);}})[_0xff48('0x24')](function(_0x3e6217){if(_0x3e6217){return _0x3e6217?{'count':_0x3d2cc2,'rows':_0x3e6217}:null;}})[_0xff48('0x24')](respondWithResult(_0x44dbfe,null))[_0xff48('0x42')](handleError(_0x44dbfe,null));}; \ No newline at end of file +var _0xf5cf=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','send','map','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','Team','includeAll','include','findAll','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','toLowerCase','pick','options','get','capitalize','addQueues','isValidChannel','Unknown\x20channel','add','Queues','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','defaults','TeamVoiceQueue','penalty','User','Queue','Queue:save','online','UserVoiceQueueRt','upsert','isNil','SIP/%s','interface','all','TeamVoicePrefix','removeAgents','emit','Queue:remove','getAgents','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register'];(function(_0x286e78,_0x2458b5){var _0x4448c1=function(_0x1f8574){while(--_0x1f8574){_0x286e78['push'](_0x286e78['shift']());}};_0x4448c1(++_0x2458b5);}(_0xf5cf,0x11c));var _0xff5c=function(_0x2635dd,_0x5317f6){_0x2635dd=_0x2635dd-0x0;var _0x575c04=_0xf5cf[_0x2635dd];return _0x575c04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff5c('0x0'));var zipdir=require(_0xff5c('0x1'));var jsonpatch=require(_0xff5c('0x2'));var rp=require(_0xff5c('0x3'));var moment=require('moment');var BPromise=require(_0xff5c('0x4'));var Mustache=require(_0xff5c('0x5'));var util=require('util');var path=require(_0xff5c('0x6'));var sox=require(_0xff5c('0x7'));var csv=require('to-csv');var ejs=require(_0xff5c('0x8'));var fs=require('fs');var fs_extra=require(_0xff5c('0x9'));var _=require(_0xff5c('0xa'));var squel=require('squel');var crypto=require(_0xff5c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xff5c('0xc'));var toCsv=require(_0xff5c('0xd'));var querystring=require(_0xff5c('0xe'));var Papa=require(_0xff5c('0xf'));var Redis=require(_0xff5c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xff5c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff5c('0x12'));var logger=require(_0xff5c('0x13'))(_0xff5c('0x14'));var utils=require(_0xff5c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff5c('0x16'))['db'];config[_0xff5c('0x17')]=_['defaults'](config[_0xff5c('0x17')],{'host':_0xff5c('0x18'),'port':0x18eb});var socket=require(_0xff5c('0x19'))(new Redis(config[_0xff5c('0x17')]));require(_0xff5c('0x1a'))[_0xff5c('0x1b')](socket);function respondWithStatusCode(_0x459346,_0x5d5f67){_0x5d5f67=_0x5d5f67||0xcc;return function(_0x4f2bcf){if(_0x4f2bcf){return _0x459346['sendStatus'](_0x5d5f67);}return _0x459346['status'](_0x5d5f67)[_0xff5c('0x1c')]();};}function respondWithResult(_0x530bc9,_0x4b10c6){_0x4b10c6=_0x4b10c6||0xc8;return function(_0x17bc74){if(_0x17bc74){return _0x530bc9[_0xff5c('0x1d')](_0x4b10c6)[_0xff5c('0x1e')](_0x17bc74);}};}function respondWithFilteredResult(_0x19e9ad,_0x187c6d){return function(_0x367e09){if(_0x367e09){var _0x46d2a6=typeof _0x187c6d[_0xff5c('0x1f')]===_0xff5c('0x20')&&typeof _0x187c6d[_0xff5c('0x21')]===_0xff5c('0x20');var _0x59af22=_0x367e09[_0xff5c('0x22')];var _0x1a3d0c=_0x46d2a6?0x0:_0x187c6d['offset'];var _0x1806dd=_0x46d2a6?_0x367e09[_0xff5c('0x22')]:_0x187c6d[_0xff5c('0x1f')]+_0x187c6d[_0xff5c('0x21')];var _0x3cea96;if(_0x1806dd>=_0x59af22){_0x1806dd=_0x59af22;_0x3cea96=0xc8;}else{_0x3cea96=0xce;}_0x19e9ad['status'](_0x3cea96);return _0x19e9ad[_0xff5c('0x23')](_0xff5c('0x24'),_0x1a3d0c+'-'+_0x1806dd+'/'+_0x59af22)[_0xff5c('0x1e')](_0x367e09);}return null;};}function patchUpdates(_0x17d2a1){return function(_0x103cdb){try{jsonpatch[_0xff5c('0x25')](_0x103cdb,_0x17d2a1,!![]);}catch(_0x202410){return BPromise[_0xff5c('0x26')](_0x202410);}return _0x103cdb[_0xff5c('0x27')]();};}function saveUpdates(_0x399d66,_0x1cd8ab){return function(_0x514f3d){if(_0x514f3d){return _0x514f3d[_0xff5c('0x28')](_0x399d66)[_0xff5c('0x29')](function(_0x56df34){return _0x56df34;});}return null;};}function handleEntityNotFound(_0x3ad571,_0x1605bf){return function(_0x137ed6){if(!_0x137ed6){_0x3ad571[_0xff5c('0x2a')](0x194);}return _0x137ed6;};}function handleError(_0xdf658,_0x213da8){_0x213da8=_0x213da8||0x1f4;return function(_0x2c96d5){logger['error'](_0x2c96d5[_0xff5c('0x2b')]);if(_0x2c96d5['name']){delete _0x2c96d5['name'];}_0xdf658[_0xff5c('0x1d')](_0x213da8)[_0xff5c('0x2c')](_0x2c96d5);};}exports['index']=function(_0x18f3d5,_0x40b42e){var _0x107263={},_0x51a3c2={},_0x221eb5={'count':0x0,'rows':[]};var _0x40d8bf=_[_0xff5c('0x2d')](db['Team'][_0xff5c('0x2e')],function(_0x5375ec){return{'name':_0x5375ec[_0xff5c('0x2f')],'type':_0x5375ec['type'][_0xff5c('0x30')]};});_0x51a3c2[_0xff5c('0x31')]=_[_0xff5c('0x2d')](_0x40d8bf,_0xff5c('0x32'));_0x51a3c2[_0xff5c('0x33')]=_[_0xff5c('0x34')](_0x18f3d5[_0xff5c('0x33')]);_0x51a3c2[_0xff5c('0x35')]=_['intersection'](_0x51a3c2[_0xff5c('0x31')],_0x51a3c2[_0xff5c('0x33')]);_0x107263[_0xff5c('0x36')]=_[_0xff5c('0x37')](_0x51a3c2[_0xff5c('0x31')],qs['fields'](_0x18f3d5['query'][_0xff5c('0x38')]));_0x107263[_0xff5c('0x36')]=_0x107263[_0xff5c('0x36')][_0xff5c('0x39')]?_0x107263[_0xff5c('0x36')]:_0x51a3c2[_0xff5c('0x31')];if(!_0x18f3d5[_0xff5c('0x33')]['hasOwnProperty'](_0xff5c('0x3a'))){_0x107263[_0xff5c('0x21')]=qs[_0xff5c('0x21')](_0x18f3d5['query']['limit']);_0x107263[_0xff5c('0x1f')]=qs[_0xff5c('0x1f')](_0x18f3d5[_0xff5c('0x33')]['offset']);}_0x107263[_0xff5c('0x3b')]=qs[_0xff5c('0x3c')](_0x18f3d5[_0xff5c('0x33')][_0xff5c('0x3c')]);_0x107263[_0xff5c('0x3d')]=qs[_0xff5c('0x35')](_['pick'](_0x18f3d5[_0xff5c('0x33')],_0x51a3c2[_0xff5c('0x35')]),_0x40d8bf);if(_0x18f3d5['query'][_0xff5c('0x3e')]){_0x107263[_0xff5c('0x3d')]=_['merge'](_0x107263[_0xff5c('0x3d')],{'$or':_['map'](_0x40d8bf,function(_0x1e70b2){if(_0x1e70b2[_0xff5c('0x3f')]!==_0xff5c('0x40')){var _0x1f9519={};_0x1f9519[_0x1e70b2[_0xff5c('0x32')]]={'$like':'%'+_0x18f3d5['query'][_0xff5c('0x3e')]+'%'};return _0x1f9519;}})});}_0x107263=_[_0xff5c('0x41')]({},_0x107263,_0x18f3d5['options']);var _0x229449={'where':_0x107263[_0xff5c('0x3d')]};return db[_0xff5c('0x42')]['count'](_0x229449)['then'](function(_0x5bda89){_0x221eb5[_0xff5c('0x22')]=_0x5bda89;if(_0x18f3d5['query'][_0xff5c('0x43')]){_0x107263[_0xff5c('0x44')]=[{'all':!![]}];}return db['Team'][_0xff5c('0x45')](_0x107263);})[_0xff5c('0x29')](function(_0x5f4e24){_0x221eb5['rows']=_0x5f4e24;return _0x221eb5;})[_0xff5c('0x29')](respondWithFilteredResult(_0x40b42e,_0x107263))[_0xff5c('0x46')](handleError(_0x40b42e,null));};exports[_0xff5c('0x47')]=function(_0x3e6b17,_0x383749){var _0x463fc0={'raw':![],'where':{'id':_0x3e6b17[_0xff5c('0x48')]['id']}},_0x24effd={};_0x24effd[_0xff5c('0x31')]=_[_0xff5c('0x34')](db['Team'][_0xff5c('0x2e')]);_0x24effd[_0xff5c('0x33')]=_['keys'](_0x3e6b17['query']);_0x24effd[_0xff5c('0x35')]=_[_0xff5c('0x37')](_0x24effd[_0xff5c('0x31')],_0x24effd[_0xff5c('0x33')]);_0x463fc0[_0xff5c('0x36')]=_[_0xff5c('0x37')](_0x24effd['model'],qs[_0xff5c('0x38')](_0x3e6b17[_0xff5c('0x33')][_0xff5c('0x38')]));_0x463fc0['attributes']=_0x463fc0[_0xff5c('0x36')][_0xff5c('0x39')]?_0x463fc0[_0xff5c('0x36')]:_0x24effd['model'];if(_0x3e6b17[_0xff5c('0x33')][_0xff5c('0x43')]){_0x463fc0[_0xff5c('0x44')]=[{'all':!![]}];}_0x463fc0=_[_0xff5c('0x41')]({},_0x463fc0,_0x3e6b17['options']);return db[_0xff5c('0x42')]['find'](_0x463fc0)[_0xff5c('0x29')](handleEntityNotFound(_0x383749,null))[_0xff5c('0x29')](respondWithResult(_0x383749,null))[_0xff5c('0x46')](handleError(_0x383749,null));};exports[_0xff5c('0x49')]=function(_0x1e8e55,_0x447712){return db[_0xff5c('0x42')]['create'](_0x1e8e55[_0xff5c('0x4a')],{})['then'](function(_0xa0d36b){var _0xbdc384=_0x1e8e55['user']['get']({'plain':!![]});if(!_0xbdc384)throw new Error(_0xff5c('0x4b'));if(_0xbdc384['role']===_0xff5c('0x4c')){var _0x3ec6da=_0xa0d36b['get']({'plain':!![]});var _0x5f5aba=_0xff5c('0x4d');return db[_0xff5c('0x4e')][_0xff5c('0x4f')]({'where':{'name':_0x5f5aba,'userProfileId':_0xbdc384['userProfileId']},'raw':!![]})[_0xff5c('0x29')](function(_0x1c80a3){if(_0x1c80a3&&_0x1c80a3[_0xff5c('0x50')]===0x0){return db[_0xff5c('0x51')][_0xff5c('0x49')]({'name':_0x3ec6da[_0xff5c('0x32')],'resourceId':_0x3ec6da['id'],'type':_0x1c80a3[_0xff5c('0x32')],'sectionId':_0x1c80a3['id']},{})[_0xff5c('0x29')](function(){return _0xa0d36b;});}else{return _0xa0d36b;}})[_0xff5c('0x46')](function(_0x37e211){logger[_0xff5c('0x52')](_0xff5c('0x53'),_0x37e211);throw _0x37e211;});}return _0xa0d36b;})['then'](respondWithResult(_0x447712,0xc9))[_0xff5c('0x46')](handleError(_0x447712,null));};exports[_0xff5c('0x28')]=function(_0x3bde89,_0x10db2f){if(_0x3bde89[_0xff5c('0x4a')]['id']){delete _0x3bde89['body']['id'];}return db[_0xff5c('0x42')][_0xff5c('0x4f')]({'where':{'id':_0x3bde89[_0xff5c('0x48')]['id']}})[_0xff5c('0x29')](handleEntityNotFound(_0x10db2f,null))[_0xff5c('0x29')](saveUpdates(_0x3bde89[_0xff5c('0x4a')],null))['then'](respondWithResult(_0x10db2f,null))[_0xff5c('0x46')](handleError(_0x10db2f,null));};exports[_0xff5c('0x54')]=function(_0x442465,_0x5045e5){var _0x6e61f4=_0x442465[_0xff5c('0x48')]['id'];var _0x50c36a=[];return db[_0xff5c('0x55')][_0xff5c('0x56')](function(_0x42d00f){var _0x36b136=_0xff5c('0x57')+_0x6e61f4;return db[_0xff5c('0x55')][_0xff5c('0x33')](_0x36b136,{'type':db[_0xff5c('0x58')][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f})['then'](function(_0x534130){_0x50c36a=_['map'](_0x534130,function(_0x2e5093){return Number(_0x2e5093[_0xff5c('0x5b')]);});})[_0xff5c('0x29')](function(){var _0x585ff5=_0xff5c('0x5c')+_0x6e61f4;return db['sequelize']['query'](_0x585ff5,{'type':db['Sequelize'][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x1e3f9f){var _0x125b5d=_['map'](_0x1e3f9f,function(_0x2d6efc){return Number(_0x2d6efc['VoiceQueueId']);});return db[_0xff5c('0x5d')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'VoiceQueueId':{'$in':_0x125b5d}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){var _0x580d64='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x6e61f4;return db[_0xff5c('0x55')]['query'](_0x580d64,{'type':db[_0xff5c('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x42d00f});})['then'](function(_0x6126fb){var _0x5864e8=_[_0xff5c('0x2d')](_0x6126fb,function(_0x4fefc7){return Number(_0x4fefc7[_0xff5c('0x5e')]);});return db[_0xff5c('0x5f')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'MailQueueId':{'$in':_0x5864e8}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){var _0x1f4b1e=_0xff5c('0x60')+_0x6e61f4;return db['sequelize']['query'](_0x1f4b1e,{'type':db[_0xff5c('0x58')][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x18ffc9){var _0x383674=_['map'](_0x18ffc9,function(_0x545225){return Number(_0x545225[_0xff5c('0x61')]);});return db[_0xff5c('0x62')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'SmsQueueId':{'$in':_0x383674}},'transaction':_0x42d00f});})['then'](function(){var _0x21afcb=_0xff5c('0x63')+_0x6e61f4;return db['sequelize'][_0xff5c('0x33')](_0x21afcb,{'type':db['Sequelize'][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x36d630){var _0x58d2fd=_[_0xff5c('0x2d')](_0x36d630,function(_0x180909){return Number(_0x180909[_0xff5c('0x64')]);});return db[_0xff5c('0x65')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'ChatQueueId':{'$in':_0x58d2fd}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){var _0x5470c9=_0xff5c('0x66')+_0x6e61f4;return db[_0xff5c('0x55')][_0xff5c('0x33')](_0x5470c9,{'type':db[_0xff5c('0x58')][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x5c5ad6){var _0x4513cc=_[_0xff5c('0x2d')](_0x5c5ad6,function(_0x58824a){return Number(_0x58824a[_0xff5c('0x67')]);});return db[_0xff5c('0x68')]['destroy']({'where':{'UserId':{'$in':_0x50c36a},'FaxQueueId':{'$in':_0x4513cc}},'transaction':_0x42d00f});})['then'](function(){var _0x1b5d84=_0xff5c('0x69')+_0x6e61f4;return db[_0xff5c('0x55')][_0xff5c('0x33')](_0x1b5d84,{'type':db[_0xff5c('0x58')][_0xff5c('0x59')]['SELECT'],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x3a3250){var _0x18c5d8=_[_0xff5c('0x2d')](_0x3a3250,function(_0xc04be3){return Number(_0xc04be3['OpenchannelQueueId']);});return db[_0xff5c('0x6a')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'OpenchannelQueueId':{'$in':_0x18c5d8}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){var _0x201c83=_0xff5c('0x6b')+_0x6e61f4;return db[_0xff5c('0x55')]['query'](_0x201c83,{'type':db['Sequelize'][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})['then'](function(_0x571964){var _0x2e5284=_['map'](_0x571964,function(_0x189520){return Number(_0x189520[_0xff5c('0x6c')]);});return db['UserWhatsappQueue'][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'WhatsappQueueId':{'$in':_0x2e5284}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){return db['TeamVoicePrefix'][_0xff5c('0x4f')]({'where':{'TeamId':_0x6e61f4}});})[_0xff5c('0x29')](function(_0x40fd39){if(_0x40fd39===null){return;}return db[_0xff5c('0x6d')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'VoicePrefixId':_0x40fd39[_0xff5c('0x6e')]},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){return db[_0xff5c('0x42')][_0xff5c('0x54')]({'where':{'id':_0x6e61f4},'cascade':!![],'transaction':_0x42d00f});})['then'](function(_0x12c047){if(_0x12c047===0x0){_0x5045e5[_0xff5c('0x2a')](0x194);}else{return db[_0xff5c('0x51')][_0xff5c('0x54')]({'where':{'type':_0xff5c('0x4d'),'resourceId':_0x6e61f4},'cascade':!![],'transaction':_0x42d00f})[_0xff5c('0x29')](function(){_0x5045e5['status'](0xcc)[_0xff5c('0x1c')]();});}})[_0xff5c('0x46')](function(_0xe4a2a1){_0x5045e5[_0xff5c('0x1d')](0x1f4)[_0xff5c('0x2c')](_0xe4a2a1);});});};exports[_0xff5c('0x6f')]=function(_0x5a23c2,_0x44ae4c,_0x3d437a){return db[_0xff5c('0x42')][_0xff5c('0x70')]({'where':{'id':_0x5a23c2[_0xff5c('0x48')]['id']}})[_0xff5c('0x29')](handleEntityNotFound(_0x44ae4c,null))[_0xff5c('0x29')](function(_0x4ee16c){if(!_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x71')]||!utils['isValidChannel'](_0x5a23c2[_0xff5c('0x33')]['channel'])){throw new db[(_0xff5c('0x58'))][(_0xff5c('0x72'))]('Unknown\x20channel');}var _0x5b3141={};var _0x4aa4a0={};_0x4aa4a0['model']=_[_0xff5c('0x34')](db[_['capitalize'](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x71')][_0xff5c('0x73')]())+'Queue'][_0xff5c('0x2e')]);_0x4aa4a0[_0xff5c('0x33')]=_[_0xff5c('0x34')](_0x5a23c2[_0xff5c('0x33')]);_0x4aa4a0['filters']=_[_0xff5c('0x37')](_0x4aa4a0['model'],_0x4aa4a0[_0xff5c('0x33')]);_0x5b3141[_0xff5c('0x36')]=_[_0xff5c('0x37')](_0x4aa4a0['model'],qs[_0xff5c('0x38')](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x38')]));_0x5b3141[_0xff5c('0x36')]=_0x5b3141[_0xff5c('0x36')][_0xff5c('0x39')]?_0x5b3141['attributes']:_0x4aa4a0[_0xff5c('0x31')];_0x5b3141[_0xff5c('0x21')]=qs[_0xff5c('0x21')](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x21')]);_0x5b3141[_0xff5c('0x1f')]=qs[_0xff5c('0x1f')](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x1f')]);_0x5b3141[_0xff5c('0x3b')]=qs['sort'](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x3c')]);_0x5b3141['where']=qs['filters'](_[_0xff5c('0x74')](_0x5a23c2['query'],_0x4aa4a0['filters']));_0x5b3141=_[_0xff5c('0x41')]({},_0x5b3141,_0x5a23c2[_0xff5c('0x75')]);return _0x4ee16c[_0xff5c('0x76')+_[_0xff5c('0x77')](_0x5a23c2['query']['channel']['toLowerCase']())+'Queues'](_0x5b3141);})[_0xff5c('0x29')](respondWithResult(_0x44ae4c,null))['catch'](handleError(_0x44ae4c,null));};exports[_0xff5c('0x78')]=function(_0x2957f6,_0x58b2c4,_0x114b41){return db[_0xff5c('0x42')][_0xff5c('0x70')]({'where':{'id':_0x2957f6[_0xff5c('0x48')]['id']}})[_0xff5c('0x29')](function(_0x46b2dd){if(_0x46b2dd){if(!_0x2957f6['body'][_0xff5c('0x71')]||!utils[_0xff5c('0x79')](_0x2957f6[_0xff5c('0x4a')][_0xff5c('0x71')])){throw new db[(_0xff5c('0x58'))][(_0xff5c('0x72'))](_0xff5c('0x7a'));}return _0x46b2dd[_0xff5c('0x7b')+_[_0xff5c('0x77')](_0x2957f6[_0xff5c('0x4a')][_0xff5c('0x71')][_0xff5c('0x73')]())+_0xff5c('0x7c')](_0x2957f6[_0xff5c('0x4a')][_0xff5c('0x7d')]);}return null;})['then'](handleEntityNotFound(_0x58b2c4,null))[_0xff5c('0x29')](respondWithStatusCode(_0x58b2c4,null))[_0xff5c('0x46')](handleError(_0x58b2c4,null));};exports[_0xff5c('0x7e')]=function(_0x2286ac,_0x4ca3e3,_0x5c2343){return db['Team'][_0xff5c('0x70')]({'where':{'id':_0x2286ac['params']['id']}})[_0xff5c('0x29')](function(_0x434f32){if(_0x434f32){if(!_0x2286ac[_0xff5c('0x33')][_0xff5c('0x71')]||!utils[_0xff5c('0x79')](_0x2286ac[_0xff5c('0x33')]['channel'])){throw new db['Sequelize'][(_0xff5c('0x72'))](_0xff5c('0x7a'));}return _0x434f32[_0xff5c('0x7f')+_['capitalize'](_0x2286ac['query'][_0xff5c('0x71')][_0xff5c('0x73')]())+_0xff5c('0x7c')](_0x2286ac['query'][_0xff5c('0x7d')]);}return null;})[_0xff5c('0x29')](handleEntityNotFound(_0x4ca3e3,null))[_0xff5c('0x29')](respondWithStatusCode(_0x4ca3e3,null))[_0xff5c('0x46')](handleError(_0x4ca3e3,null));};exports[_0xff5c('0x80')]=function(_0x310bf4,_0xf584cd){var _0x296b95=_[_0xff5c('0x81')](_0x310bf4[_0xff5c('0x4a')][_0xff5c('0x7d')])?_0x310bf4[_0xff5c('0x4a')][_0xff5c('0x7d')]:[_0x310bf4[_0xff5c('0x4a')][_0xff5c('0x7d')]];var _0x302922=_0x310bf4[_0xff5c('0x48')]['id'];return db[_0xff5c('0x42')]['find']({'where':{'id':_0x302922}})[_0xff5c('0x29')](handleEntityNotFound(_0xf584cd,null))['then'](function(_0x5e6c23){if(_0x5e6c23){var _0x5ad9a5=[_0xff5c('0x82'),_0xff5c('0x83'),_0xff5c('0x84'),_0xff5c('0x85'),_0xff5c('0x86'),_0xff5c('0x87'),_0xff5c('0x88')];return db['sequelize'][_0xff5c('0x56')](function(_0x2f8d2e){var _0x276962=_[_0xff5c('0x2d')](_0x5ad9a5,function(_0x32e71a){var _0x14d3d8={'attributes':['id','name']};if(_0x32e71a===_0xff5c('0x82')){_0x14d3d8['through']={'attributes':['penalty']};}return _0x5e6c23[_0xff5c('0x76')+_0x32e71a+_0xff5c('0x7c')](_0x14d3d8)[_0xff5c('0x29')](function(_0x234c66){var _0x45f998=_['map'](_0x234c66,function(_0x3e33e7){var _0x3a40e9=_[_0xff5c('0x2d')](_0x296b95,function(_0x358345){var _0x28a5f4={'where':{'UserId':_0x358345,[_0x32e71a+'QueueId']:_0x3e33e7['id']},'transaction':_0x2f8d2e};if(_0x32e71a===_0xff5c('0x82')){_0x28a5f4[_0xff5c('0x89')]={'penalty':_0x3e33e7[_0xff5c('0x8a')][_0xff5c('0x8b')]};}return db[_0xff5c('0x8c')+_0x32e71a+_0xff5c('0x8d')]['findOrCreate'](_0x28a5f4)[_0xff5c('0x29')](function(){socket['emit'](_0xff5c('0x4c')+_0x32e71a+_0xff5c('0x8e'),{'UserId':_0x358345,[_0x32e71a+'QueueId']:_0x3e33e7['id']});if(_0x32e71a!=='Voice'){return;}return db[_0xff5c('0x8c')][_0xff5c('0x45')]({'where':{'id':_0x296b95,'online':0x1},'attributes':['id',_0xff5c('0x32'),_0xff5c('0x8f'),'voicePause','interface'],'raw':!![]})[_0xff5c('0x29')](function(_0x4fedf6){var _0x1f2200=_['map'](_0x4fedf6,function(_0x2850bb){return db[_0xff5c('0x90')][_0xff5c('0x91')]({'membername':_0x2850bb[_0xff5c('0x32')],'UserId':_0x2850bb['id'],'queue_name':_0x3e33e7[_0xff5c('0x32')],'VoiceQueueId':_0x3e33e7['id'],'interface':_[_0xff5c('0x92')](_0x2850bb['interface'])?util['format'](_0xff5c('0x93'),_0x2850bb['name']):_0x2850bb[_0xff5c('0x94')],'paused':_0x2850bb['voicePause']||![],'penalty':_0x3e33e7[_0xff5c('0x8a')][_0xff5c('0x8b')]},{'transaction':_0x2f8d2e});});return Promise[_0xff5c('0x95')](_0x1f2200);});});});return Promise[_0xff5c('0x95')](_0x3a40e9);});return Promise[_0xff5c('0x95')](_0x45f998);})[_0xff5c('0x29')](function(){return db[_0xff5c('0x96')][_0xff5c('0x70')]({'where':{'teamId':_0x302922}})[_0xff5c('0x29')](function(_0x244410){if(_0x244410){var _0x4ab2a7=_[_0xff5c('0x2d')](_0x296b95,function(_0xbfdff6){db[_0xff5c('0x6d')]['upsert']({'UserId':_0xbfdff6,'VoicePrefixId':_0x244410[_0xff5c('0x6e')]});});return Promise[_0xff5c('0x95')](_0x4ab2a7);}});});});return Promise['all'](_0x276962)[_0xff5c('0x29')](function(){return _0x5e6c23[_0xff5c('0x80')](_0x296b95,{'transaction':_0x2f8d2e})['spread'](function(_0x1e59d7){return _0x1e59d7;});});});}})[_0xff5c('0x29')](respondWithResult(_0xf584cd,null))['catch'](handleError(_0xf584cd,null));};exports[_0xff5c('0x97')]=function(_0x2f7ed2,_0x6d81eb){var _0x308de8=_[_0xff5c('0x81')](_0x2f7ed2[_0xff5c('0x33')]['ids'])?_0x2f7ed2['query'][_0xff5c('0x7d')]:[_0x2f7ed2[_0xff5c('0x33')][_0xff5c('0x7d')]];var _0x29dafe=_0x2f7ed2[_0xff5c('0x48')]['id'];return db[_0xff5c('0x42')][_0xff5c('0x4f')]({'where':{'id':_0x29dafe}})[_0xff5c('0x29')](handleEntityNotFound(_0x6d81eb,null))[_0xff5c('0x29')](function(_0x5997cd){if(_0x5997cd){var _0xf571c9=['Voice',_0xff5c('0x83'),_0xff5c('0x84'),_0xff5c('0x85'),_0xff5c('0x86'),_0xff5c('0x87'),_0xff5c('0x88')];return db[_0xff5c('0x55')][_0xff5c('0x56')](function(_0x507359){var _0x11d8cb=_[_0xff5c('0x2d')](_0xf571c9,function(_0x5c950d){var _0x588c79={'attributes':['id',_0xff5c('0x32')]};return _0x5997cd['get'+_0x5c950d+_0xff5c('0x7c')](_0x588c79)[_0xff5c('0x29')](function(_0x2289c1){var _0x3994ae=_[_0xff5c('0x2d')](_0x2289c1,function(_0x522b8e){return _0x522b8e[_0xff5c('0x97')](_0x308de8,{'transaction':_0x507359})[_0xff5c('0x29')](function(){var _0x2d5542=_['map'](_0x308de8,function(_0x5e33e1){socket[_0xff5c('0x98')](_0xff5c('0x4c')+_0x5c950d+_0xff5c('0x99'),{'UserId':Number(_0x5e33e1),[_0x5c950d+'QueueId']:_0x522b8e['id']});if(_0x5c950d!=='Voice'){return;}return db[_0xff5c('0x90')][_0xff5c('0x54')]({'where':{'VoiceQueueId':_0x522b8e['id'],'UserId':_0x5e33e1},'transaction':_0x507359});});return Promise['all'](_0x2d5542);});});return Promise[_0xff5c('0x95')](_0x3994ae);});});return Promise[_0xff5c('0x95')](_0x11d8cb)[_0xff5c('0x29')](function(){return _0x5997cd[_0xff5c('0x97')](_0x308de8,{'transaction':_0x507359});})[_0xff5c('0x29')](function(){return db[_0xff5c('0x96')][_0xff5c('0x70')]({'where':{'teamId':_0x29dafe}})[_0xff5c('0x29')](function(_0x4ad934){if(_0x4ad934){var _0x4b6445=_[_0xff5c('0x2d')](_0x308de8,function(_0x20c92e){db[_0xff5c('0x6d')]['destroy']({'where':{'UserId':_0x20c92e,'VoicePrefixId':_0x4ad934[_0xff5c('0x6e')]}});});return Promise[_0xff5c('0x95')](_0x4b6445);}});});});}})[_0xff5c('0x29')](respondWithStatusCode(_0x6d81eb,null))[_0xff5c('0x46')](handleError(_0x6d81eb,null));};exports[_0xff5c('0x9a')]=function(_0x274fdc,_0x1d29e5,_0x435206){var _0x3565b7={};var _0x51e83b={};var _0xc032f2;var _0x2d08d6;return db[_0xff5c('0x42')][_0xff5c('0x70')]({'where':{'id':_0x274fdc['params']['id']}})[_0xff5c('0x29')](handleEntityNotFound(_0x1d29e5,null))[_0xff5c('0x29')](function(_0x91dd14){if(_0x91dd14){_0xc032f2=_0x91dd14;_0x51e83b[_0xff5c('0x31')]=_[_0xff5c('0x34')](db[_0xff5c('0x8c')][_0xff5c('0x2e')]);_0x51e83b[_0xff5c('0x33')]=_[_0xff5c('0x34')](_0x274fdc['query']);_0x51e83b[_0xff5c('0x35')]=_['intersection'](_0x51e83b[_0xff5c('0x31')],_0x51e83b[_0xff5c('0x33')]);_0x3565b7['attributes']=_['intersection'](_0x51e83b[_0xff5c('0x31')],qs[_0xff5c('0x38')](_0x274fdc['query'][_0xff5c('0x38')]));_0x3565b7[_0xff5c('0x36')]=_0x3565b7['attributes'][_0xff5c('0x39')]?_0x3565b7[_0xff5c('0x36')]:_0x51e83b[_0xff5c('0x31')];_0x3565b7['order']=qs[_0xff5c('0x3c')](_0x274fdc[_0xff5c('0x33')][_0xff5c('0x3c')]);_0x3565b7[_0xff5c('0x3d')]=qs[_0xff5c('0x35')](_[_0xff5c('0x74')](_0x274fdc[_0xff5c('0x33')],_0x51e83b[_0xff5c('0x35')]));if(_0x274fdc[_0xff5c('0x33')][_0xff5c('0x3e')]){_0x3565b7[_0xff5c('0x3d')]=_[_0xff5c('0x41')](_0x3565b7[_0xff5c('0x3d')],{'$or':_[_0xff5c('0x2d')](_0x3565b7['attributes'],function(_0x328334){var _0x236328={};_0x236328[_0x328334]={'$like':'%'+_0x274fdc[_0xff5c('0x33')][_0xff5c('0x3e')]+'%'};return _0x236328;})});}_0x3565b7=_[_0xff5c('0x41')]({},_0x3565b7,_0x274fdc['options']);return _0xc032f2['getAgents'](_0x3565b7);}})[_0xff5c('0x29')](function(_0x1b2b7d){if(_0x1b2b7d){_0x2d08d6=_0x1b2b7d[_0xff5c('0x39')];if(!_0x274fdc[_0xff5c('0x33')][_0xff5c('0x9b')](_0xff5c('0x3a'))){_0x3565b7[_0xff5c('0x21')]=qs[_0xff5c('0x21')](_0x274fdc[_0xff5c('0x33')]['limit']);_0x3565b7[_0xff5c('0x1f')]=qs[_0xff5c('0x1f')](_0x274fdc[_0xff5c('0x33')][_0xff5c('0x1f')]);}return _0xc032f2['getAgents'](_0x3565b7);}})[_0xff5c('0x29')](function(_0x1207f7){if(_0x1207f7){return _0x1207f7?{'count':_0x2d08d6,'rows':_0x1207f7}:null;}})[_0xff5c('0x29')](respondWithResult(_0x1d29e5,null))[_0xff5c('0x46')](handleError(_0x1d29e5,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 472c3a2..899799b 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 _0xda7a=['Team','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda7a,0xe9));var _0xada7=function(_0x181849,_0x23d2e0){_0x181849=_0x181849-0x0;var _0xa2ef85=_0xda7a[_0x181849];return _0xa2ef85;};'use strict';var EventEmitter=require(_0xada7('0x0'));var Team=require('../../mysqldb')['db'][_0xada7('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xada7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xada7('0x3'),'afterDestroy':_0xada7('0x4')};function emitEvent(_0x302655){return function(_0x5c98d2,_0x414422,_0x3b4c96){TeamEvents[_0xada7('0x5')](_0x302655+':'+_0x5c98d2['id'],_0x5c98d2);TeamEvents[_0xada7('0x5')](_0x302655,_0x5c98d2);_0x3b4c96(null);};}for(var e in events){if(events[_0xada7('0x6')](e)){var event=events[e];Team[_0xada7('0x7')](e,emitEvent(event));}}module[_0xada7('0x8')]=TeamEvents; \ No newline at end of file +var _0x0011=['Team','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x59e78d,_0x112ae3){var _0x2d7f80=function(_0x222f0f){while(--_0x222f0f){_0x59e78d['push'](_0x59e78d['shift']());}};_0x2d7f80(++_0x112ae3);}(_0x0011,0x10c));var _0x1001=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0011[_0x160c73];return _0xd9302;};'use strict';var EventEmitter=require(_0x1001('0x0'));var Team=require(_0x1001('0x1'))['db'][_0x1001('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x1001('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1001('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5be5a4){return function(_0x134378,_0x55f4b5,_0x142de6){TeamEvents[_0x1001('0x5')](_0x5be5a4+':'+_0x134378['id'],_0x134378);TeamEvents[_0x1001('0x5')](_0x5be5a4,_0x134378);_0x142de6(null);};}for(var e in events){if(events[_0x1001('0x6')](e)){var event=events[e];Team[_0x1001('0x7')](e,emitEvent(event));}}module[_0x1001('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d4b22ab..93ca811 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 _0xf9a4=['setDataValue','channel','catch','exports','define','Chat','Sms','Voice','Whatsapp','resolve','all','Queues','map'];(function(_0x1e4f5f,_0x15cc5f){var _0x47b799=function(_0x35ee43){while(--_0x35ee43){_0x1e4f5f['push'](_0x1e4f5f['shift']());}};_0x47b799(++_0x15cc5f);}(_0xf9a4,0x8d));var _0x4f9a=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf9a4[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x5b43b1,_0x2cdc13){var _0x4fb86e='get'+_0x2cdc13+_0x4f9a('0x0');return _0x5b43b1[_0x4fb86e]()['then'](function(_0x13d14c){return _[_0x4f9a('0x1')](_0x13d14c,function(_0x4811d6){_0x4811d6[_0x4f9a('0x2')](_0x4f9a('0x3'),_0x2cdc13);return _0x4811d6;});})[_0x4f9a('0x4')](function(_0x18236f){throw _0x18236f;});}module[_0x4f9a('0x5')]=function(_0x58256c){return _0x58256c[_0x4f9a('0x6')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5250e6=this;var _0x5ecb7b=[_0x4f9a('0x7'),'Fax','Mail','Openchannel',_0x4f9a('0x8'),_0x4f9a('0x9'),_0x4f9a('0xa')];return Promise[_0x4f9a('0xb')]()['then'](function(){var _0x295ad1=_[_0x4f9a('0x1')](_0x5ecb7b,function(_0x260213){return getQueuesByChannel(_0x5250e6,_0x260213);});return Promise[_0x4f9a('0xc')](_0x295ad1);})[_0x4f9a('0x4')](function(_0x154cb2){throw _0x154cb2;});}}});}; \ No newline at end of file +var _0x7095=['./team.attributes','get','Queues','map','setDataValue','catch','Team','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x7095,0xdf));var _0x5709=function(_0x36876b,_0x1645e7){_0x36876b=_0x36876b-0x0;var _0x114691=_0x7095[_0x36876b];return _0x114691;};'use strict';var _=require(_0x5709('0x0'));var attributes=require(_0x5709('0x1'));function getQueuesByChannel(_0x5951eb,_0x4d4384){var _0x346766=_0x5709('0x2')+_0x4d4384+_0x5709('0x3');return _0x5951eb[_0x346766]()['then'](function(_0x166532){return _[_0x5709('0x4')](_0x166532,function(_0x39defa){_0x39defa[_0x5709('0x5')]('channel',_0x4d4384);return _0x39defa;});})[_0x5709('0x6')](function(_0x20707b){throw _0x20707b;});}module['exports']=function(_0xa22921){return _0xa22921['define'](_0x5709('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x57fcfd=this;var _0xbbf22e=['Chat',_0x5709('0x8'),_0x5709('0x9'),_0x5709('0xa'),_0x5709('0xb'),_0x5709('0xc'),_0x5709('0xd')];return Promise[_0x5709('0xe')]()['then'](function(){var _0x14512a=_['map'](_0xbbf22e,function(_0x952a68){return getQueuesByChannel(_0x57fcfd,_0x952a68);});return Promise[_0x5709('0xf')](_0x14512a);})[_0x5709('0x6')](function(_0x1859a3){throw _0x1859a3;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index be71223..a9e9846 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 _0x9ea0=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Team,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x10921d,_0x242a14){var _0x163ca1=function(_0x3429b2){while(--_0x3429b2){_0x10921d['push'](_0x10921d['shift']());}};_0x163ca1(++_0x242a14);}(_0x9ea0,0xc0));var _0x09ea=function(_0x8956eb,_0x3ee779){_0x8956eb=_0x8956eb-0x0;var _0x14fbee=_0x9ea0[_0x8956eb];return _0x14fbee;};'use strict';var _=require(_0x09ea('0x0'));var util=require(_0x09ea('0x1'));var moment=require(_0x09ea('0x2'));var BPromise=require(_0x09ea('0x3'));var rs=require(_0x09ea('0x4'));var fs=require('fs');var Redis=require(_0x09ea('0x5'));var db=require(_0x09ea('0x6'))['db'];var utils=require(_0x09ea('0x7'));var logger=require(_0x09ea('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x09ea('0x9'));var client=jayson[_0x09ea('0xa')]['http']({'port':0x232a});config[_0x09ea('0xb')]=_[_0x09ea('0xc')](config[_0x09ea('0xb')],{'host':_0x09ea('0xd'),'port':0x18eb});var socket=require(_0x09ea('0xe'))(new Redis(config[_0x09ea('0xb')]));require('./team.socket')[_0x09ea('0xf')](socket);function respondWithRpcPromise(_0x17cddc,_0x3dc9cd,_0x595d8d){return new BPromise(function(_0x56563a,_0x96f289){return client[_0x09ea('0x10')](_0x17cddc,_0x595d8d)[_0x09ea('0x11')](function(_0x3a05e8){logger[_0x09ea('0x12')]('Team,\x20%s,\x20%s',_0x3dc9cd,_0x09ea('0x13'));logger[_0x09ea('0x14')](_0x09ea('0x15'),_0x3dc9cd,_0x09ea('0x13'),JSON[_0x09ea('0x16')](_0x3a05e8));if(_0x3a05e8[_0x09ea('0x17')]){if(_0x3a05e8[_0x09ea('0x17')][_0x09ea('0x18')]===0x1f4){logger[_0x09ea('0x17')]('Team,\x20%s,\x20%s',_0x3dc9cd,_0x3a05e8['error'][_0x09ea('0x19')]);return _0x96f289(_0x3a05e8[_0x09ea('0x17')][_0x09ea('0x19')]);}logger[_0x09ea('0x17')](_0x09ea('0x1a'),_0x3dc9cd,_0x3a05e8['error']['message']);return _0x56563a(_0x3a05e8[_0x09ea('0x17')][_0x09ea('0x19')]);}else{logger[_0x09ea('0x12')]('Team,\x20%s,\x20%s',_0x3dc9cd,'request\x20sent');_0x56563a(_0x3a05e8[_0x09ea('0x1b')]['message']);}})[_0x09ea('0x1c')](function(_0x312042){logger['error'](_0x09ea('0x1a'),_0x3dc9cd,_0x312042);_0x96f289(_0x312042);});});} \ No newline at end of file +var _0x2551=['../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../config/utils'];(function(_0x54ca91,_0x1f01cb){var _0x4e400e=function(_0x5b4be2){while(--_0x5b4be2){_0x54ca91['push'](_0x54ca91['shift']());}};_0x4e400e(++_0x1f01cb);}(_0x2551,0x9d));var _0x1255=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x2551[_0xa4f636];return _0x37e02a;};'use strict';var _=require(_0x1255('0x0'));var util=require(_0x1255('0x1'));var moment=require('moment');var BPromise=require(_0x1255('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1255('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1255('0x4'));var logger=require(_0x1255('0x5'))('rpc');var config=require(_0x1255('0x6'));var jayson=require(_0x1255('0x7'));var client=jayson[_0x1255('0x8')][_0x1255('0x9')]({'port':0x232a});config['redis']=_[_0x1255('0xa')](config[_0x1255('0xb')],{'host':_0x1255('0xc'),'port':0x18eb});var socket=require(_0x1255('0xd'))(new Redis(config[_0x1255('0xb')]));require(_0x1255('0xe'))[_0x1255('0xf')](socket);function respondWithRpcPromise(_0xaa05a8,_0x45e72b,_0x5b9dee){return new BPromise(function(_0x5bb635,_0x18037e){return client[_0x1255('0x10')](_0xaa05a8,_0x5b9dee)['then'](function(_0x3b05ed){logger['info'](_0x1255('0x11'),_0x45e72b,_0x1255('0x12'));logger[_0x1255('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x45e72b,_0x1255('0x12'),JSON[_0x1255('0x14')](_0x3b05ed));if(_0x3b05ed['error']){if(_0x3b05ed[_0x1255('0x15')][_0x1255('0x16')]===0x1f4){logger[_0x1255('0x15')](_0x1255('0x11'),_0x45e72b,_0x3b05ed[_0x1255('0x15')]['message']);return _0x18037e(_0x3b05ed[_0x1255('0x15')][_0x1255('0x17')]);}logger[_0x1255('0x15')](_0x1255('0x11'),_0x45e72b,_0x3b05ed['error'][_0x1255('0x17')]);return _0x5bb635(_0x3b05ed[_0x1255('0x15')][_0x1255('0x17')]);}else{logger[_0x1255('0x18')](_0x1255('0x11'),_0x45e72b,_0x1255('0x12'));_0x5bb635(_0x3b05ed[_0x1255('0x19')][_0x1255('0x17')]);}})[_0x1255('0x1a')](function(_0x160a77){logger['error']('Team,\x20%s,\x20%s',_0x45e72b,_0x160a77);_0x18037e(_0x160a77);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 91f87db..1a18753 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 _0x1601=['length','save','update','removeListener'];(function(_0x27df4c,_0x2715f4){var _0x71f61f=function(_0x44e228){while(--_0x44e228){_0x27df4c['push'](_0x27df4c['shift']());}};_0x71f61f(++_0x2715f4);}(_0x1601,0x151));var _0x1160=function(_0x4dd909,_0x407b30){_0x4dd909=_0x4dd909-0x0;var _0x73872=_0x1601[_0x4dd909];return _0x73872;};'use strict';var TeamEvents=require('./team.events');var events=[_0x1160('0x0'),'remove',_0x1160('0x1')];function createListener(_0x5ab7da,_0x3adf1d){return function(_0x5afc50){_0x3adf1d['emit'](_0x5ab7da,_0x5afc50);};}function removeListener(_0x403b07,_0xae5d8a){return function(){TeamEvents[_0x1160('0x2')](_0x403b07,_0xae5d8a);};}exports['register']=function(_0x50e2bf){for(var _0x305897=0x0,_0x154a88=events[_0x1160('0x3')];_0x305897<_0x154a88;_0x305897++){var _0x5cbc51=events[_0x305897];var _0x40e174=createListener('team:'+_0x5cbc51,_0x50e2bf);TeamEvents['on'](_0x5cbc51,_0x40e174);}}; \ No newline at end of file +var _0xa988=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x338b40,_0x199519){var _0x47e249=function(_0x26d703){while(--_0x26d703){_0x338b40['push'](_0x338b40['shift']());}};_0x47e249(++_0x199519);}(_0xa988,0x1a7));var _0x8a98=function(_0x2b4d02,_0x54d4f9){_0x2b4d02=_0x2b4d02-0x0;var _0x19a9c2=_0xa988[_0x2b4d02];return _0x19a9c2;};'use strict';var TeamEvents=require(_0x8a98('0x0'));var events=[_0x8a98('0x1'),_0x8a98('0x2'),_0x8a98('0x3')];function createListener(_0x301da0,_0x59970e){return function(_0x14901a){_0x59970e[_0x8a98('0x4')](_0x301da0,_0x14901a);};}function removeListener(_0x1380fa,_0x12efcf){return function(){TeamEvents[_0x8a98('0x5')](_0x1380fa,_0x12efcf);};}exports[_0x8a98('0x6')]=function(_0x3eb5cf){for(var _0x3fcd06=0x0,_0x4ef481=events[_0x8a98('0x7')];_0x3fcd06<_0x4ef481;_0x3fcd06++){var _0x336f5f=events[_0x3fcd06];var _0x5f3abf=createListener(_0x8a98('0x8')+_0x336f5f,_0x3eb5cf);TeamEvents['on'](_0x336f5f,_0x5f3abf);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index ff16b29..76d2d6a 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 _0x834d=['exports','INTEGER','sequelize'];(function(_0x58fb13,_0x3c1350){var _0x210e69=function(_0x1b2c97){while(--_0x1b2c97){_0x58fb13['push'](_0x58fb13['shift']());}};_0x210e69(++_0x3c1350);}(_0x834d,0x140));var _0xd834=function(_0x5e513b,_0x4f363a){_0x5e513b=_0x5e513b-0x0;var _0x7eb087=_0x834d[_0x5e513b];return _0x7eb087;};'use strict';var Sequelize=require(_0xd834('0x0'));module[_0xd834('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xd834('0x2')]}}; \ No newline at end of file +var _0x91ff=['INTEGER'];(function(_0x372a58,_0x2cb91d){var _0x68a7dc=function(_0x412b38){while(--_0x412b38){_0x372a58['push'](_0x372a58['shift']());}};_0x68a7dc(++_0x2cb91d);}(_0x91ff,0x15b));var _0xf91f=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x91ff[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0xf91f('0x0')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 79048dd..d56f66d 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 _0x8286=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x3210f7,_0xecec0e){var _0x32f551=function(_0x1e5b54){while(--_0x1e5b54){_0x3210f7['push'](_0x3210f7['shift']());}};_0x32f551(++_0xecec0e);}(_0x8286,0x66));var _0x6828=function(_0xb129c9,_0x51f85e){_0xb129c9=_0xb129c9-0x0;var _0x50f023=_0x8286[_0xb129c9];return _0x50f023;};'use strict';var _=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var logger=require(_0x6828('0x2'))(_0x6828('0x3'));var moment=require(_0x6828('0x4'));var BPromise=require(_0x6828('0x5'));var rp=require(_0x6828('0x6'));var fs=require('fs');var path=require(_0x6828('0x7'));var rimraf=require(_0x6828('0x8'));var config=require(_0x6828('0x9'));var attributes=require(_0x6828('0xa'));module['exports']=function(_0x31c3d0,_0xe4b9bb){return _0x31c3d0['define'](_0x6828('0xb'),attributes,{'tableName':_0x6828('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','TeamVoicePrefix','team_has_voice_prefixes','../../config/logger','api'];(function(_0x522302,_0x6cf3d1){var _0x1248b7=function(_0xa5e55){while(--_0xa5e55){_0x522302['push'](_0x522302['shift']());}};_0x1248b7(++_0x6cf3d1);}(_0x1339,0x1ed));var _0x9133=function(_0x2dbbc7,_0x1df3c5){_0x2dbbc7=_0x2dbbc7-0x0;var _0x427cca=_0x1339[_0x2dbbc7];return _0x427cca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 7f12911..7df082f 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3f163a,_0x1a2ff4){var _0x2a07a4=function(_0x1e0666){while(--_0x1e0666){_0x3f163a['push'](_0x3f163a['shift']());}};_0x2a07a4(++_0x1a2ff4);}(_0x70e0,0x17b));var _0x070e=function(_0x1c30fd,_0x3bf7bc){_0x1c30fd=_0x1c30fd-0x0;var _0x1e060b=_0x70e0[_0x1c30fd];return _0x1e060b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3461c8,_0x2a904f){var _0x411111=function(_0x591ad1){while(--_0x591ad1){_0x3461c8['push'](_0x3461c8['shift']());}};_0x411111(++_0x2a904f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f94cfef..890359f 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 _0x4b28=['INTEGER','sequelize','exports'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x4b28,0x121));var _0x84b2=function(_0xd11b94,_0x152cff){_0xd11b94=_0xd11b94-0x0;var _0x4292ba=_0x4b28[_0xd11b94];return _0x4292ba;};'use strict';var Sequelize=require(_0x84b2('0x0'));module[_0x84b2('0x1')]={'penalty':{'type':Sequelize[_0x84b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x885f=['INTEGER','exports'];(function(_0x37df3f,_0x75c9b6){var _0x2313fe=function(_0x3199a9){while(--_0x3199a9){_0x37df3f['push'](_0x37df3f['shift']());}};_0x2313fe(++_0x75c9b6);}(_0x885f,0x18d));var _0xf885=function(_0x5f23d9,_0x431d9a){_0x5f23d9=_0x5f23d9-0x0;var _0x68fb9e=_0x885f[_0x5f23d9];return _0x68fb9e;};'use strict';var Sequelize=require('sequelize');module[_0xf885('0x0')]={'penalty':{'type':Sequelize[_0xf885('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 68b6bb9..76e858f 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 _0xa25a=['rimraf','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3873ab,_0x360457){var _0x5238bb=function(_0x3ce9ec){while(--_0x3ce9ec){_0x3873ab['push'](_0x3873ab['shift']());}};_0x5238bb(++_0x360457);}(_0xa25a,0x160));var _0xaa25=function(_0x399dbc,_0x48ada2){_0x399dbc=_0x399dbc-0x0;var _0x586e79=_0xa25a[_0x399dbc];return _0x586e79;};'use strict';var _=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var logger=require(_0xaa25('0x2'))(_0xaa25('0x3'));var moment=require(_0xaa25('0x4'));var BPromise=require(_0xaa25('0x5'));var rp=require(_0xaa25('0x6'));var fs=require('fs');var path=require(_0xaa25('0x7'));var rimraf=require(_0xaa25('0x8'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0xaa25('0x9')]=function(_0x866fa1,_0x51ce9a){return _0x866fa1[_0xaa25('0xa')](_0xaa25('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe02=['exports','team_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe02,0x146));var _0x2be0=function(_0x312cf0,_0x2f25d2){_0x312cf0=_0x312cf0-0x0;var _0x7d0db8=_0xbe02[_0x312cf0];return _0x7d0db8;};'use strict';var _=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var logger=require(_0x2be0('0x2'))(_0x2be0('0x3'));var moment=require('moment');var BPromise=require(_0x2be0('0x4'));var rp=require(_0x2be0('0x5'));var fs=require('fs');var path=require(_0x2be0('0x6'));var rimraf=require(_0x2be0('0x7'));var config=require(_0x2be0('0x8'));var attributes=require(_0x2be0('0x9'));module[_0x2be0('0xa')]=function(_0x474a35,_0x39a2ca){return _0x474a35['define']('TeamVoiceQueue',attributes,{'tableName':_0x2be0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 795abb9..fbb900c 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 _0xf9cb=['request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0xf9cb,0xdb));var _0xbf9c=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0xf9cb[_0x21f3bf];return _0x249d08;};'use strict';var _=require(_0xbf9c('0x0'));var util=require(_0xbf9c('0x1'));var moment=require(_0xbf9c('0x2'));var BPromise=require(_0xbf9c('0x3'));var rs=require(_0xbf9c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf9c('0x5'))['db'];var utils=require(_0xbf9c('0x6'));var logger=require(_0xbf9c('0x7'))('rpc');var config=require(_0xbf9c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x239728,_0x3ba567,_0x2f669e){return new BPromise(function(_0x5d8ca6,_0x1be20f){return client[_0xbf9c('0x9')](_0x239728,_0x2f669e)[_0xbf9c('0xa')](function(_0x352a17){logger[_0xbf9c('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3ba567,_0xbf9c('0xc'));logger[_0xbf9c('0xd')](_0xbf9c('0xe'),_0x3ba567,'request\x20sent',JSON[_0xbf9c('0xf')](_0x352a17));if(_0x352a17[_0xbf9c('0x10')]){if(_0x352a17['error'][_0xbf9c('0x11')]===0x1f4){logger['error'](_0xbf9c('0x12'),_0x3ba567,_0x352a17[_0xbf9c('0x10')]['message']);return _0x1be20f(_0x352a17[_0xbf9c('0x10')][_0xbf9c('0x13')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3ba567,_0x352a17['error'][_0xbf9c('0x13')]);return _0x5d8ca6(_0x352a17['error'][_0xbf9c('0x13')]);}else{logger['info'](_0xbf9c('0x12'),_0x3ba567,_0xbf9c('0xc'));_0x5d8ca6(_0x352a17[_0xbf9c('0x14')]['message']);}})['catch'](function(_0x54db91){logger[_0xbf9c('0x10')](_0xbf9c('0x12'),_0x3ba567,_0x54db91);_0x1be20f(_0x54db91);});});} \ No newline at end of file +var _0x42a1=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x17c8ae,_0x1f0ab1){var _0x5a42c1=function(_0x2752a0){while(--_0x2752a0){_0x17c8ae['push'](_0x17c8ae['shift']());}};_0x5a42c1(++_0x1f0ab1);}(_0x42a1,0x155));var _0x142a=function(_0x38f737,_0x54f685){_0x38f737=_0x38f737-0x0;var _0x7afda3=_0x42a1[_0x38f737];return _0x7afda3;};'use strict';var _=require(_0x142a('0x0'));var util=require(_0x142a('0x1'));var moment=require(_0x142a('0x2'));var BPromise=require(_0x142a('0x3'));var rs=require(_0x142a('0x4'));var fs=require('fs');var Redis=require(_0x142a('0x5'));var db=require(_0x142a('0x6'))['db'];var utils=require(_0x142a('0x7'));var logger=require(_0x142a('0x8'))('rpc');var config=require(_0x142a('0x9'));var jayson=require(_0x142a('0xa'));var client=jayson[_0x142a('0xb')][_0x142a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x201ba1,_0x54ef0b,_0x3acedc){return new BPromise(function(_0x4f56f0,_0x2318ca){return client[_0x142a('0xd')](_0x201ba1,_0x3acedc)[_0x142a('0xe')](function(_0x62124e){logger[_0x142a('0xf')](_0x142a('0x10'),_0x54ef0b,'request\x20sent');logger['debug'](_0x142a('0x11'),_0x54ef0b,_0x142a('0x12'),JSON[_0x142a('0x13')](_0x62124e));if(_0x62124e[_0x142a('0x14')]){if(_0x62124e['error']['code']===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x54ef0b,_0x62124e[_0x142a('0x14')][_0x142a('0x15')]);return _0x2318ca(_0x62124e[_0x142a('0x14')]['message']);}logger[_0x142a('0x14')](_0x142a('0x10'),_0x54ef0b,_0x62124e[_0x142a('0x14')][_0x142a('0x15')]);return _0x4f56f0(_0x62124e[_0x142a('0x14')][_0x142a('0x15')]);}else{logger[_0x142a('0xf')](_0x142a('0x10'),_0x54ef0b,'request\x20sent');_0x4f56f0(_0x62124e[_0x142a('0x16')]['message']);}})[_0x142a('0x17')](function(_0x2741be){logger[_0x142a('0x14')](_0x142a('0x10'),_0x54ef0b,_0x2741be);_0x2318ca(_0x2741be);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 693f296..4ec1c36 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 _0x6bab=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer'];(function(_0x12370d,_0x56f1d6){var _0x4e51ea=function(_0x5ac682){while(--_0x5ac682){_0x12370d['push'](_0x12370d['shift']());}};_0x4e51ea(++_0x56f1d6);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0x6bab[_0x26e727];return _0x563800;};'use strict';var multer=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var path=require(_0xb6ba('0x2'));var timeout=require(_0xb6ba('0x3'));var express=require('express');var router=express[_0xb6ba('0x4')]();var fs_extra=require(_0xb6ba('0x5'));var auth=require(_0xb6ba('0x6'));var interaction=require(_0xb6ba('0x7'));var config=require(_0xb6ba('0x8'));var controller=require('./template.controller');router[_0xb6ba('0x9')]('/',auth['isAuthenticated'](),controller[_0xb6ba('0xa')]);router[_0xb6ba('0x9')](_0xb6ba('0xb'),auth[_0xb6ba('0xc')](),controller[_0xb6ba('0xd')]);router[_0xb6ba('0xe')]('/',auth[_0xb6ba('0xc')](),controller[_0xb6ba('0xf')]);router[_0xb6ba('0x10')]('/:id',auth[_0xb6ba('0xc')](),controller['update']);router['delete']('/:id',auth[_0xb6ba('0xc')](),controller[_0xb6ba('0x11')]);module[_0xb6ba('0x12')]=router; \ No newline at end of file +var _0xf4c9=['../../components/interaction/service','./template.controller','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0xd321df,_0x13ed85){var _0x4d8cf1=function(_0xff3c72){while(--_0xff3c72){_0xd321df['push'](_0xd321df['shift']());}};_0x4d8cf1(++_0x13ed85);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xf4c9[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var path=require(_0x9f4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f4c('0x3'));var router=express['Router']();var fs_extra=require(_0x9f4c('0x4'));var auth=require(_0x9f4c('0x5'));var interaction=require(_0x9f4c('0x6'));var config=require('../../config/environment');var controller=require(_0x9f4c('0x7'));router['get']('/',auth[_0x9f4c('0x8')](),controller['index']);router['get']('/:id',auth[_0x9f4c('0x8')](),controller[_0x9f4c('0x9')]);router[_0x9f4c('0xa')]('/',auth[_0x9f4c('0x8')](),controller[_0x9f4c('0xb')]);router[_0x9f4c('0xc')]('/:id',auth[_0x9f4c('0x8')](),controller[_0x9f4c('0xd')]);router[_0x9f4c('0xe')](_0x9f4c('0xf'),auth[_0x9f4c('0x8')](),controller[_0x9f4c('0x10')]);module[_0x9f4c('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 e6abf4f..2647e13 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 _0x0ca7=['exports','STRING','TEXT','sequelize'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x0ca7,0x17f));var _0x70ca=function(_0x5ea529,_0xb364a2){_0x5ea529=_0x5ea529-0x0;var _0x42c1af=_0x0ca7[_0x5ea529];return _0x42c1af;};'use strict';var Sequelize=require(_0x70ca('0x0'));module[_0x70ca('0x1')]={'name':{'type':Sequelize[_0x70ca('0x2')]},'description':{'type':Sequelize[_0x70ca('0x2')]},'html':{'type':Sequelize[_0x70ca('0x3')]}}; \ No newline at end of file +var _0x6cac=['exports','STRING','TEXT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6cac,0x105));var _0xc6ca=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6cac[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0xc6ca('0x0')]={'name':{'type':Sequelize[_0xc6ca('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xc6ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a7a4492..d641d00 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 _0xb6c2=['stack','name','send','index','map','Template','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','status'];(function(_0x141adb,_0x1116e0){var _0x25bcc2=function(_0x4baee2){while(--_0x4baee2){_0x141adb['push'](_0x141adb['shift']());}};_0x25bcc2(++_0x1116e0);}(_0xb6c2,0x131));var _0x2b6c=function(_0x3c7cf0,_0x81feb7){_0x3c7cf0=_0x3c7cf0-0x0;var _0x2ddb7e=_0xb6c2[_0x3c7cf0];return _0x2ddb7e;};'use strict';var emlformat=require(_0x2b6c('0x0'));var rimraf=require(_0x2b6c('0x1'));var zipdir=require(_0x2b6c('0x2'));var jsonpatch=require(_0x2b6c('0x3'));var rp=require(_0x2b6c('0x4'));var moment=require(_0x2b6c('0x5'));var BPromise=require(_0x2b6c('0x6'));var Mustache=require(_0x2b6c('0x7'));var util=require(_0x2b6c('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2b6c('0x9'));var fs=require('fs');var fs_extra=require(_0x2b6c('0xa'));var _=require(_0x2b6c('0xb'));var squel=require(_0x2b6c('0xc'));var crypto=require('crypto');var jsforce=require(_0x2b6c('0xd'));var deskjs=require(_0x2b6c('0xe'));var toCsv=require(_0x2b6c('0xf'));var querystring=require(_0x2b6c('0x10'));var Papa=require(_0x2b6c('0x11'));var Redis=require(_0x2b6c('0x12'));var authService=require(_0x2b6c('0x13'));var qs=require(_0x2b6c('0x14'));var as=require(_0x2b6c('0x15'));var hardwareService=require(_0x2b6c('0x16'));var logger=require(_0x2b6c('0x17'))(_0x2b6c('0x18'));var utils=require(_0x2b6c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2b6c('0x1a'));var db=require(_0x2b6c('0x1b'))['db'];function respondWithStatusCode(_0x35b2d3,_0x97d461){_0x97d461=_0x97d461||0xcc;return function(_0x11d696){if(_0x11d696){return _0x35b2d3[_0x2b6c('0x1c')](_0x97d461);}return _0x35b2d3['status'](_0x97d461)[_0x2b6c('0x1d')]();};}function respondWithResult(_0x323e80,_0x59ba94){_0x59ba94=_0x59ba94||0xc8;return function(_0x3b1c04){if(_0x3b1c04){return _0x323e80['status'](_0x59ba94)[_0x2b6c('0x1e')](_0x3b1c04);}};}function respondWithFilteredResult(_0x524b3a,_0x56ca7f){return function(_0x2ede2f){if(_0x2ede2f){var _0x219439=typeof _0x56ca7f[_0x2b6c('0x1f')]===_0x2b6c('0x20')&&typeof _0x56ca7f['limit']===_0x2b6c('0x20');var _0x464009=_0x2ede2f[_0x2b6c('0x21')];var _0x22a39d=_0x219439?0x0:_0x56ca7f[_0x2b6c('0x1f')];var _0x572448=_0x219439?_0x2ede2f['count']:_0x56ca7f['offset']+_0x56ca7f[_0x2b6c('0x22')];var _0x4f4c1a;if(_0x572448>=_0x464009){_0x572448=_0x464009;_0x4f4c1a=0xc8;}else{_0x4f4c1a=0xce;}_0x524b3a['status'](_0x4f4c1a);return _0x524b3a[_0x2b6c('0x23')](_0x2b6c('0x24'),_0x22a39d+'-'+_0x572448+'/'+_0x464009)[_0x2b6c('0x1e')](_0x2ede2f);}return null;};}function patchUpdates(_0x3f193c){return function(_0x5b0796){try{jsonpatch[_0x2b6c('0x25')](_0x5b0796,_0x3f193c,!![]);}catch(_0x3317c1){return BPromise[_0x2b6c('0x26')](_0x3317c1);}return _0x5b0796[_0x2b6c('0x27')]();};}function saveUpdates(_0x31c831,_0xe75d16){return function(_0x197e42){if(_0x197e42){return _0x197e42[_0x2b6c('0x28')](_0x31c831)[_0x2b6c('0x29')](function(_0x3499b6){return _0x3499b6;});}return null;};}function removeEntity(_0x357616,_0x37b76c){return function(_0x1eed2e){if(_0x1eed2e){return _0x1eed2e[_0x2b6c('0x2a')]()[_0x2b6c('0x29')](function(){var _0x31f128=_0x1eed2e[_0x2b6c('0x2b')]({'plain':!![]});var _0x39bbcb=_0x2b6c('0x2c');return db[_0x2b6c('0x2d')][_0x2b6c('0x2a')]({'where':{'type':_0x39bbcb,'resourceId':_0x31f128['id']}})['then'](function(){return _0x1eed2e;});})[_0x2b6c('0x29')](function(){_0x357616[_0x2b6c('0x2e')](0xcc)[_0x2b6c('0x1d')]();});}};}function handleEntityNotFound(_0x281c31,_0x1f03b0){return function(_0x36e692){if(!_0x36e692){_0x281c31[_0x2b6c('0x1c')](0x194);}return _0x36e692;};}function handleError(_0x482254,_0x5a3878){_0x5a3878=_0x5a3878||0x1f4;return function(_0xcdb359){logger['error'](_0xcdb359[_0x2b6c('0x2f')]);if(_0xcdb359[_0x2b6c('0x30')]){delete _0xcdb359[_0x2b6c('0x30')];}_0x482254[_0x2b6c('0x2e')](_0x5a3878)[_0x2b6c('0x31')](_0xcdb359);};}exports[_0x2b6c('0x32')]=function(_0x1105b7,_0x31394b){var _0x50b5f5={},_0x184e30={},_0x2611b4={'count':0x0,'rows':[]};var _0x23867a=_[_0x2b6c('0x33')](db[_0x2b6c('0x34')]['rawAttributes'],function(_0xefd3ed){return{'name':_0xefd3ed[_0x2b6c('0x35')],'type':_0xefd3ed[_0x2b6c('0x36')]['key']};});_0x184e30[_0x2b6c('0x37')]=_['map'](_0x23867a,_0x2b6c('0x30'));_0x184e30[_0x2b6c('0x38')]=_[_0x2b6c('0x39')](_0x1105b7[_0x2b6c('0x38')]);_0x184e30[_0x2b6c('0x3a')]=_['intersection'](_0x184e30[_0x2b6c('0x37')],_0x184e30['query']);_0x50b5f5[_0x2b6c('0x3b')]=_[_0x2b6c('0x3c')](_0x184e30[_0x2b6c('0x37')],qs['fields'](_0x1105b7[_0x2b6c('0x38')]['fields']));_0x50b5f5[_0x2b6c('0x3b')]=_0x50b5f5['attributes'][_0x2b6c('0x3d')]?_0x50b5f5[_0x2b6c('0x3b')]:_0x184e30[_0x2b6c('0x37')];if(!_0x1105b7[_0x2b6c('0x38')][_0x2b6c('0x3e')](_0x2b6c('0x3f'))){_0x50b5f5[_0x2b6c('0x22')]=qs[_0x2b6c('0x22')](_0x1105b7[_0x2b6c('0x38')][_0x2b6c('0x22')]);_0x50b5f5[_0x2b6c('0x1f')]=qs[_0x2b6c('0x1f')](_0x1105b7[_0x2b6c('0x38')]['offset']);}_0x50b5f5[_0x2b6c('0x40')]=qs['sort'](_0x1105b7[_0x2b6c('0x38')][_0x2b6c('0x41')]);_0x50b5f5[_0x2b6c('0x42')]=qs[_0x2b6c('0x3a')](_['pick'](_0x1105b7[_0x2b6c('0x38')],_0x184e30[_0x2b6c('0x3a')]),_0x23867a);if(_0x1105b7[_0x2b6c('0x38')][_0x2b6c('0x43')]){_0x50b5f5[_0x2b6c('0x42')]=_[_0x2b6c('0x44')](_0x50b5f5[_0x2b6c('0x42')],{'$or':_['map'](_0x23867a,function(_0x56d3af){if(_0x56d3af[_0x2b6c('0x36')]!==_0x2b6c('0x45')){var _0x24c04d={};_0x24c04d[_0x56d3af[_0x2b6c('0x30')]]={'$like':'%'+_0x1105b7[_0x2b6c('0x38')]['filter']+'%'};return _0x24c04d;}})});}_0x50b5f5=_[_0x2b6c('0x44')]({},_0x50b5f5,_0x1105b7[_0x2b6c('0x46')]);var _0x339700={'where':_0x50b5f5['where']};return db[_0x2b6c('0x34')][_0x2b6c('0x21')](_0x339700)[_0x2b6c('0x29')](function(_0x1bb413){_0x2611b4['count']=_0x1bb413;if(_0x1105b7[_0x2b6c('0x38')][_0x2b6c('0x47')]){_0x50b5f5[_0x2b6c('0x48')]=[{'all':!![]}];}return db['Template'][_0x2b6c('0x49')](_0x50b5f5);})['then'](function(_0x343349){_0x2611b4[_0x2b6c('0x4a')]=_0x343349;return _0x2611b4;})[_0x2b6c('0x29')](respondWithFilteredResult(_0x31394b,_0x50b5f5))[_0x2b6c('0x4b')](handleError(_0x31394b,null));};exports[_0x2b6c('0x4c')]=function(_0xb1b7c9,_0x42d90f){var _0x1ab18c={'raw':!![],'where':{'id':_0xb1b7c9[_0x2b6c('0x4d')]['id']}},_0xd10220={};_0xd10220['model']=_['keys'](db[_0x2b6c('0x34')]['rawAttributes']);_0xd10220['query']=_['keys'](_0xb1b7c9[_0x2b6c('0x38')]);_0xd10220[_0x2b6c('0x3a')]=_[_0x2b6c('0x3c')](_0xd10220[_0x2b6c('0x37')],_0xd10220[_0x2b6c('0x38')]);_0x1ab18c[_0x2b6c('0x3b')]=_[_0x2b6c('0x3c')](_0xd10220[_0x2b6c('0x37')],qs[_0x2b6c('0x4e')](_0xb1b7c9['query'][_0x2b6c('0x4e')]));_0x1ab18c['attributes']=_0x1ab18c[_0x2b6c('0x3b')][_0x2b6c('0x3d')]?_0x1ab18c['attributes']:_0xd10220[_0x2b6c('0x37')];if(_0xb1b7c9['query'][_0x2b6c('0x47')]){_0x1ab18c[_0x2b6c('0x48')]=[{'all':!![]}];}_0x1ab18c=_[_0x2b6c('0x44')]({},_0x1ab18c,_0xb1b7c9[_0x2b6c('0x46')]);return db['Template'][_0x2b6c('0x4f')](_0x1ab18c)[_0x2b6c('0x29')](handleEntityNotFound(_0x42d90f,null))['then'](respondWithResult(_0x42d90f,null))[_0x2b6c('0x4b')](handleError(_0x42d90f,null));};exports[_0x2b6c('0x50')]=function(_0x4bd28b,_0x445fe9){return db['Template'][_0x2b6c('0x50')](_0x4bd28b[_0x2b6c('0x51')],{})[_0x2b6c('0x29')](function(_0x5e90ab){var _0x98f37b=_0x4bd28b[_0x2b6c('0x52')]['get']({'plain':!![]});if(!_0x98f37b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x98f37b[_0x2b6c('0x53')]===_0x2b6c('0x52')){var _0xb27769=_0x5e90ab['get']({'plain':!![]});var _0x46447f=_0x2b6c('0x2c');return db[_0x2b6c('0x54')][_0x2b6c('0x4f')]({'where':{'name':_0x46447f,'userProfileId':_0x98f37b[_0x2b6c('0x55')]},'raw':!![]})[_0x2b6c('0x29')](function(_0x11d0e0){if(_0x11d0e0&&_0x11d0e0['autoAssociation']===0x0){return db[_0x2b6c('0x2d')][_0x2b6c('0x50')]({'name':_0xb27769[_0x2b6c('0x30')],'resourceId':_0xb27769['id'],'type':_0x11d0e0['name'],'sectionId':_0x11d0e0['id']},{})[_0x2b6c('0x29')](function(){return _0x5e90ab;});}else{return _0x5e90ab;}})[_0x2b6c('0x4b')](function(_0x28fe9b){logger[_0x2b6c('0x56')](_0x2b6c('0x57'),_0x28fe9b);throw _0x28fe9b;});}return _0x5e90ab;})[_0x2b6c('0x29')](respondWithResult(_0x445fe9,0xc9))[_0x2b6c('0x4b')](handleError(_0x445fe9,null));};exports[_0x2b6c('0x28')]=function(_0x4fc261,_0x59bb67){if(_0x4fc261[_0x2b6c('0x51')]['id']){delete _0x4fc261['body']['id'];}return db['Template']['find']({'where':{'id':_0x4fc261[_0x2b6c('0x4d')]['id']}})[_0x2b6c('0x29')](handleEntityNotFound(_0x59bb67,null))['then'](saveUpdates(_0x4fc261[_0x2b6c('0x51')],null))[_0x2b6c('0x29')](respondWithResult(_0x59bb67,null))[_0x2b6c('0x4b')](handleError(_0x59bb67,null));};exports[_0x2b6c('0x2a')]=function(_0x2a475b,_0x1ad447){return db['Template'][_0x2b6c('0x4f')]({'where':{'id':_0x2a475b['params']['id']}})[_0x2b6c('0x29')](handleEntityNotFound(_0x1ad447,null))[_0x2b6c('0x29')](removeEntity(_0x1ad447,null))[_0x2b6c('0x4b')](handleError(_0x1ad447,null));}; \ No newline at end of file +var _0x8512=['includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Templates','then','sendStatus','stack','name','send','map','Template','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x8512,0xbc));var _0x2851=function(_0x57169e,_0x1e711d){_0x57169e=_0x57169e-0x0;var _0xbfd65f=_0x8512[_0x57169e];return _0xbfd65f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2851('0x0'));var zipdir=require(_0x2851('0x1'));var jsonpatch=require(_0x2851('0x2'));var rp=require(_0x2851('0x3'));var moment=require(_0x2851('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2851('0x5'));var util=require(_0x2851('0x6'));var path=require('path');var sox=require(_0x2851('0x7'));var csv=require(_0x2851('0x8'));var ejs=require(_0x2851('0x9'));var fs=require('fs');var fs_extra=require(_0x2851('0xa'));var _=require(_0x2851('0xb'));var squel=require(_0x2851('0xc'));var crypto=require(_0x2851('0xd'));var jsforce=require(_0x2851('0xe'));var deskjs=require(_0x2851('0xf'));var toCsv=require(_0x2851('0x8'));var querystring=require(_0x2851('0x10'));var Papa=require('papaparse');var Redis=require(_0x2851('0x11'));var authService=require(_0x2851('0x12'));var qs=require(_0x2851('0x13'));var as=require(_0x2851('0x14'));var hardwareService=require(_0x2851('0x15'));var logger=require(_0x2851('0x16'))('api');var utils=require(_0x2851('0x17'));var config=require(_0x2851('0x18'));var licenseUtil=require(_0x2851('0x19'));var db=require(_0x2851('0x1a'))['db'];function respondWithStatusCode(_0x1c54be,_0x431fe2){_0x431fe2=_0x431fe2||0xcc;return function(_0x3e135e){if(_0x3e135e){return _0x1c54be['sendStatus'](_0x431fe2);}return _0x1c54be['status'](_0x431fe2)[_0x2851('0x1b')]();};}function respondWithResult(_0x212744,_0x3d58ee){_0x3d58ee=_0x3d58ee||0xc8;return function(_0x4893e1){if(_0x4893e1){return _0x212744[_0x2851('0x1c')](_0x3d58ee)['json'](_0x4893e1);}};}function respondWithFilteredResult(_0x100f8c,_0x39d02f){return function(_0x7aaf1d){if(_0x7aaf1d){var _0x1a535a=typeof _0x39d02f[_0x2851('0x1d')]==='undefined'&&typeof _0x39d02f[_0x2851('0x1e')]==='undefined';var _0x126c6e=_0x7aaf1d[_0x2851('0x1f')];var _0x5275ff=_0x1a535a?0x0:_0x39d02f[_0x2851('0x1d')];var _0x38cd6d=_0x1a535a?_0x7aaf1d[_0x2851('0x1f')]:_0x39d02f[_0x2851('0x1d')]+_0x39d02f[_0x2851('0x1e')];var _0x1ea5a8;if(_0x38cd6d>=_0x126c6e){_0x38cd6d=_0x126c6e;_0x1ea5a8=0xc8;}else{_0x1ea5a8=0xce;}_0x100f8c[_0x2851('0x1c')](_0x1ea5a8);return _0x100f8c[_0x2851('0x20')](_0x2851('0x21'),_0x5275ff+'-'+_0x38cd6d+'/'+_0x126c6e)[_0x2851('0x22')](_0x7aaf1d);}return null;};}function patchUpdates(_0x56c5f0){return function(_0x1baa04){try{jsonpatch[_0x2851('0x23')](_0x1baa04,_0x56c5f0,!![]);}catch(_0xd0524b){return BPromise[_0x2851('0x24')](_0xd0524b);}return _0x1baa04[_0x2851('0x25')]();};}function saveUpdates(_0x1426a4,_0x343857){return function(_0x352ce0){if(_0x352ce0){return _0x352ce0[_0x2851('0x26')](_0x1426a4)['then'](function(_0x5350b3){return _0x5350b3;});}return null;};}function removeEntity(_0x2548eb,_0x16f588){return function(_0x16a4d8){if(_0x16a4d8){return _0x16a4d8[_0x2851('0x27')]()['then'](function(){var _0x340845=_0x16a4d8[_0x2851('0x28')]({'plain':!![]});var _0x3a3f7a=_0x2851('0x29');return db['UserProfileResource'][_0x2851('0x27')]({'where':{'type':_0x3a3f7a,'resourceId':_0x340845['id']}})[_0x2851('0x2a')](function(){return _0x16a4d8;});})[_0x2851('0x2a')](function(){_0x2548eb[_0x2851('0x1c')](0xcc)[_0x2851('0x1b')]();});}};}function handleEntityNotFound(_0x2d2334,_0x2e0e28){return function(_0x2bd165){if(!_0x2bd165){_0x2d2334[_0x2851('0x2b')](0x194);}return _0x2bd165;};}function handleError(_0x2abd35,_0x10f6b2){_0x10f6b2=_0x10f6b2||0x1f4;return function(_0xe58b71){logger['error'](_0xe58b71[_0x2851('0x2c')]);if(_0xe58b71[_0x2851('0x2d')]){delete _0xe58b71['name'];}_0x2abd35[_0x2851('0x1c')](_0x10f6b2)[_0x2851('0x2e')](_0xe58b71);};}exports['index']=function(_0x4c84ba,_0x540e33){var _0x53845c={},_0x41550d={},_0x34c3ec={'count':0x0,'rows':[]};var _0x3dc1d2=_[_0x2851('0x2f')](db[_0x2851('0x30')][_0x2851('0x31')],function(_0x502fcd){return{'name':_0x502fcd[_0x2851('0x32')],'type':_0x502fcd['type'][_0x2851('0x33')]};});_0x41550d[_0x2851('0x34')]=_['map'](_0x3dc1d2,_0x2851('0x2d'));_0x41550d['query']=_[_0x2851('0x35')](_0x4c84ba['query']);_0x41550d[_0x2851('0x36')]=_[_0x2851('0x37')](_0x41550d[_0x2851('0x34')],_0x41550d['query']);_0x53845c[_0x2851('0x38')]=_[_0x2851('0x37')](_0x41550d[_0x2851('0x34')],qs[_0x2851('0x39')](_0x4c84ba[_0x2851('0x3a')][_0x2851('0x39')]));_0x53845c['attributes']=_0x53845c['attributes'][_0x2851('0x3b')]?_0x53845c[_0x2851('0x38')]:_0x41550d['model'];if(!_0x4c84ba[_0x2851('0x3a')][_0x2851('0x3c')](_0x2851('0x3d'))){_0x53845c[_0x2851('0x1e')]=qs[_0x2851('0x1e')](_0x4c84ba[_0x2851('0x3a')][_0x2851('0x1e')]);_0x53845c[_0x2851('0x1d')]=qs['offset'](_0x4c84ba[_0x2851('0x3a')][_0x2851('0x1d')]);}_0x53845c[_0x2851('0x3e')]=qs[_0x2851('0x3f')](_0x4c84ba[_0x2851('0x3a')][_0x2851('0x3f')]);_0x53845c['where']=qs[_0x2851('0x36')](_['pick'](_0x4c84ba[_0x2851('0x3a')],_0x41550d[_0x2851('0x36')]),_0x3dc1d2);if(_0x4c84ba['query'][_0x2851('0x40')]){_0x53845c[_0x2851('0x41')]=_['merge'](_0x53845c[_0x2851('0x41')],{'$or':_[_0x2851('0x2f')](_0x3dc1d2,function(_0x30250c){if(_0x30250c[_0x2851('0x42')]!==_0x2851('0x43')){var _0x37d5f8={};_0x37d5f8[_0x30250c[_0x2851('0x2d')]]={'$like':'%'+_0x4c84ba[_0x2851('0x3a')]['filter']+'%'};return _0x37d5f8;}})});}_0x53845c=_[_0x2851('0x44')]({},_0x53845c,_0x4c84ba[_0x2851('0x45')]);var _0x14dc71={'where':_0x53845c[_0x2851('0x41')]};return db[_0x2851('0x30')][_0x2851('0x1f')](_0x14dc71)[_0x2851('0x2a')](function(_0x1751e5){_0x34c3ec[_0x2851('0x1f')]=_0x1751e5;if(_0x4c84ba[_0x2851('0x3a')][_0x2851('0x46')]){_0x53845c['include']=[{'all':!![]}];}return db[_0x2851('0x30')][_0x2851('0x47')](_0x53845c);})[_0x2851('0x2a')](function(_0xee82ea){_0x34c3ec['rows']=_0xee82ea;return _0x34c3ec;})[_0x2851('0x2a')](respondWithFilteredResult(_0x540e33,_0x53845c))[_0x2851('0x48')](handleError(_0x540e33,null));};exports[_0x2851('0x49')]=function(_0x4130fa,_0x478e80){var _0x11574a={'raw':!![],'where':{'id':_0x4130fa[_0x2851('0x4a')]['id']}},_0x43af27={};_0x43af27['model']=_[_0x2851('0x35')](db[_0x2851('0x30')]['rawAttributes']);_0x43af27[_0x2851('0x3a')]=_[_0x2851('0x35')](_0x4130fa[_0x2851('0x3a')]);_0x43af27[_0x2851('0x36')]=_[_0x2851('0x37')](_0x43af27[_0x2851('0x34')],_0x43af27[_0x2851('0x3a')]);_0x11574a[_0x2851('0x38')]=_['intersection'](_0x43af27['model'],qs[_0x2851('0x39')](_0x4130fa[_0x2851('0x3a')][_0x2851('0x39')]));_0x11574a[_0x2851('0x38')]=_0x11574a[_0x2851('0x38')][_0x2851('0x3b')]?_0x11574a[_0x2851('0x38')]:_0x43af27[_0x2851('0x34')];if(_0x4130fa[_0x2851('0x3a')][_0x2851('0x46')]){_0x11574a[_0x2851('0x4b')]=[{'all':!![]}];}_0x11574a=_[_0x2851('0x44')]({},_0x11574a,_0x4130fa[_0x2851('0x45')]);return db[_0x2851('0x30')][_0x2851('0x4c')](_0x11574a)[_0x2851('0x2a')](handleEntityNotFound(_0x478e80,null))[_0x2851('0x2a')](respondWithResult(_0x478e80,null))[_0x2851('0x48')](handleError(_0x478e80,null));};exports[_0x2851('0x4d')]=function(_0x1ca281,_0xfa5571){return db[_0x2851('0x30')][_0x2851('0x4d')](_0x1ca281[_0x2851('0x4e')],{})['then'](function(_0x2f423e){var _0x64577f=_0x1ca281[_0x2851('0x4f')][_0x2851('0x28')]({'plain':!![]});if(!_0x64577f)throw new Error(_0x2851('0x50'));if(_0x64577f[_0x2851('0x51')]===_0x2851('0x4f')){var _0x545e17=_0x2f423e[_0x2851('0x28')]({'plain':!![]});var _0x3dd58c=_0x2851('0x29');return db['UserProfileSection'][_0x2851('0x4c')]({'where':{'name':_0x3dd58c,'userProfileId':_0x64577f[_0x2851('0x52')]},'raw':!![]})['then'](function(_0x1c3702){if(_0x1c3702&&_0x1c3702[_0x2851('0x53')]===0x0){return db[_0x2851('0x54')][_0x2851('0x4d')]({'name':_0x545e17[_0x2851('0x2d')],'resourceId':_0x545e17['id'],'type':_0x1c3702[_0x2851('0x2d')],'sectionId':_0x1c3702['id']},{})[_0x2851('0x2a')](function(){return _0x2f423e;});}else{return _0x2f423e;}})['catch'](function(_0x73738d){logger[_0x2851('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x73738d);throw _0x73738d;});}return _0x2f423e;})['then'](respondWithResult(_0xfa5571,0xc9))[_0x2851('0x48')](handleError(_0xfa5571,null));};exports[_0x2851('0x26')]=function(_0x260fd0,_0x4421dd){if(_0x260fd0[_0x2851('0x4e')]['id']){delete _0x260fd0['body']['id'];}return db[_0x2851('0x30')][_0x2851('0x4c')]({'where':{'id':_0x260fd0['params']['id']}})['then'](handleEntityNotFound(_0x4421dd,null))[_0x2851('0x2a')](saveUpdates(_0x260fd0[_0x2851('0x4e')],null))['then'](respondWithResult(_0x4421dd,null))[_0x2851('0x48')](handleError(_0x4421dd,null));};exports['destroy']=function(_0x10db8e,_0x35c2b1){return db[_0x2851('0x30')]['find']({'where':{'id':_0x10db8e[_0x2851('0x4a')]['id']}})[_0x2851('0x2a')](handleEntityNotFound(_0x35c2b1,null))[_0x2851('0x2a')](removeEntity(_0x35c2b1,null))[_0x2851('0x48')](handleError(_0x35c2b1,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 4d2675c..e7cc80d 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 _0x1de2=['tools_templates','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Template'];(function(_0xc7f289,_0x5cc966){var _0x527f3d=function(_0x764e45){while(--_0x764e45){_0xc7f289['push'](_0xc7f289['shift']());}};_0x527f3d(++_0x5cc966);}(_0x1de2,0x1a1));var _0x21de=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1de2[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x21de('0x0'));var util=require(_0x21de('0x1'));var logger=require(_0x21de('0x2'))(_0x21de('0x3'));var moment=require(_0x21de('0x4'));var BPromise=require('bluebird');var rp=require(_0x21de('0x5'));var fs=require('fs');var path=require(_0x21de('0x6'));var rimraf=require(_0x21de('0x7'));var config=require(_0x21de('0x8'));var attributes=require('./template.attributes');module[_0x21de('0x9')]=function(_0x2d2907,_0x31e07c){return _0x2d2907[_0x21de('0xa')](_0x21de('0xb'),attributes,{'tableName':_0x21de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9552=['moment','bluebird','request-promise','path','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x9552,0xc4));var _0x2955=function(_0x5892e3,_0x41d768){_0x5892e3=_0x5892e3-0x0;var _0x2706cd=_0x9552[_0x5892e3];return _0x2706cd;};'use strict';var _=require(_0x2955('0x0'));var util=require(_0x2955('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2955('0x2'));var BPromise=require(_0x2955('0x3'));var rp=require(_0x2955('0x4'));var fs=require('fs');var path=require(_0x2955('0x5'));var rimraf=require('rimraf');var config=require(_0x2955('0x6'));var attributes=require(_0x2955('0x7'));module['exports']=function(_0x1c9ca6,_0x4a46b0){return _0x1c9ca6[_0x2955('0x8')](_0x2955('0x9'),attributes,{'tableName':_0x2955('0xa'),'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 e9c065b..6f51ffb 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 _0x6b6d=['then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','limit','include','map','model','attributes'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x6b6d,0xb1));var _0xd6b6=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x6b6d[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0xd6b6('0x0'));var util=require(_0xd6b6('0x1'));var moment=require(_0xd6b6('0x2'));var BPromise=require(_0xd6b6('0x3'));var rs=require(_0xd6b6('0x4'));var fs=require('fs');var Redis=require(_0xd6b6('0x5'));var db=require(_0xd6b6('0x6'))['db'];var utils=require(_0xd6b6('0x7'));var logger=require(_0xd6b6('0x8'))(_0xd6b6('0x9'));var config=require(_0xd6b6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd6b6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aa6c1,_0x381e97,_0x416f64){return new BPromise(function(_0x3bb835,_0x1dce6e){return client[_0xd6b6('0xc')](_0x4aa6c1,_0x416f64)['then'](function(_0x413310){logger[_0xd6b6('0xd')](_0xd6b6('0xe'),_0x381e97,'request\x20sent');logger[_0xd6b6('0xf')](_0xd6b6('0x10'),_0x381e97,_0xd6b6('0x11'),JSON['stringify'](_0x413310));if(_0x413310[_0xd6b6('0x12')]){if(_0x413310[_0xd6b6('0x12')][_0xd6b6('0x13')]===0x1f4){logger[_0xd6b6('0x12')](_0xd6b6('0xe'),_0x381e97,_0x413310[_0xd6b6('0x12')][_0xd6b6('0x14')]);return _0x1dce6e(_0x413310[_0xd6b6('0x12')]['message']);}logger[_0xd6b6('0x12')](_0xd6b6('0xe'),_0x381e97,_0x413310[_0xd6b6('0x12')]['message']);return _0x3bb835(_0x413310['error'][_0xd6b6('0x14')]);}else{logger[_0xd6b6('0xd')](_0xd6b6('0xe'),_0x381e97,_0xd6b6('0x11'));_0x3bb835(_0x413310[_0xd6b6('0x15')][_0xd6b6('0x14')]);}})[_0xd6b6('0x16')](function(_0x497fd8){logger[_0xd6b6('0x12')](_0xd6b6('0xe'),_0x381e97,_0x497fd8);_0x1dce6e(_0x497fd8);});});}exports[_0xd6b6('0x17')]=function(_0x52f934){var _0x35558b=this;return new Promise(function(_0x579e9e,_0x2af087){return db[_0xd6b6('0x18')][_0xd6b6('0x19')]({'raw':_0x52f934[_0xd6b6('0x1a')]?_0x52f934[_0xd6b6('0x1a')][_0xd6b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x52f934['options']?_0x52f934[_0xd6b6('0x1a')]['where']||null:null,'attributes':_0x52f934[_0xd6b6('0x1a')]?_0x52f934['options']['attributes']||null:null,'limit':_0x52f934[_0xd6b6('0x1a')]?_0x52f934[_0xd6b6('0x1a')][_0xd6b6('0x1c')]||null:null,'include':_0x52f934[_0xd6b6('0x1a')]?_0x52f934['options'][_0xd6b6('0x1d')]?_[_0xd6b6('0x1e')](_0x52f934[_0xd6b6('0x1a')][_0xd6b6('0x1d')],function(_0x195cb5){return{'model':db[_0x195cb5[_0xd6b6('0x1f')]],'as':_0x195cb5['as'],'attributes':_0x195cb5[_0xd6b6('0x20')],'include':_0x195cb5['include']?_[_0xd6b6('0x1e')](_0x195cb5[_0xd6b6('0x1d')],function(_0x34e24b){return{'model':db[_0x34e24b[_0xd6b6('0x1f')]],'as':_0x34e24b['as'],'attributes':_0x34e24b['attributes'],'include':_0x34e24b[_0xd6b6('0x1d')]?_[_0xd6b6('0x1e')](_0x34e24b[_0xd6b6('0x1d')],function(_0x41db65){return{'model':db[_0x41db65[_0xd6b6('0x1f')]],'as':_0x41db65['as'],'attributes':_0x41db65[_0xd6b6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd6b6('0x21')](function(_0x3d1afb){logger['info']('GetTemplate',_0x52f934);logger['debug'](_0xd6b6('0x17'),_0x52f934,JSON[_0xd6b6('0x22')](_0x3d1afb));_0x579e9e(_0x3d1afb);})['catch'](function(_0xf98c57){logger[_0xd6b6('0x12')](_0xd6b6('0x17'),_0xf98c57[_0xd6b6('0x14')],_0x52f934);_0x2af087(_0x35558b[_0xd6b6('0x12')](0x1f4,_0xf98c57[_0xd6b6('0x14')]));});});}; \ No newline at end of file +var _0x49bf=['message','info','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x39642a,_0xf1650e){var _0x2ac68b=function(_0x30bb86){while(--_0x30bb86){_0x39642a['push'](_0x39642a['shift']());}};_0x2ac68b(++_0xf1650e);}(_0x49bf,0x126));var _0xf49b=function(_0x44671c,_0x2a7436){_0x44671c=_0x44671c-0x0;var _0x5a61bc=_0x49bf[_0x44671c];return _0x5a61bc;};'use strict';var _=require(_0xf49b('0x0'));var util=require(_0xf49b('0x1'));var moment=require(_0xf49b('0x2'));var BPromise=require(_0xf49b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf49b('0x4'));var db=require(_0xf49b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf49b('0x6'))(_0xf49b('0x7'));var config=require(_0xf49b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf49b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10f1da,_0x3dd582,_0x5e25ff){return new BPromise(function(_0x1963ed,_0x1d5737){return client['request'](_0x10f1da,_0x5e25ff)['then'](function(_0x467e5b){logger['info'](_0xf49b('0xa'),_0x3dd582,'request\x20sent');logger[_0xf49b('0xb')]('Template,\x20%s,\x20%s,\x20%s',_0x3dd582,_0xf49b('0xc'),JSON[_0xf49b('0xd')](_0x467e5b));if(_0x467e5b[_0xf49b('0xe')]){if(_0x467e5b[_0xf49b('0xe')][_0xf49b('0xf')]===0x1f4){logger[_0xf49b('0xe')]('Template,\x20%s,\x20%s',_0x3dd582,_0x467e5b[_0xf49b('0xe')][_0xf49b('0x10')]);return _0x1d5737(_0x467e5b[_0xf49b('0xe')][_0xf49b('0x10')]);}logger[_0xf49b('0xe')](_0xf49b('0xa'),_0x3dd582,_0x467e5b[_0xf49b('0xe')]['message']);return _0x1963ed(_0x467e5b[_0xf49b('0xe')][_0xf49b('0x10')]);}else{logger[_0xf49b('0x11')](_0xf49b('0xa'),_0x3dd582,'request\x20sent');_0x1963ed(_0x467e5b[_0xf49b('0x12')][_0xf49b('0x10')]);}})[_0xf49b('0x13')](function(_0x179a6d){logger[_0xf49b('0xe')](_0xf49b('0xa'),_0x3dd582,_0x179a6d);_0x1d5737(_0x179a6d);});});}exports[_0xf49b('0x14')]=function(_0x85c7f8){var _0x40152e=this;return new Promise(function(_0x59b31b,_0x48c269){return db[_0xf49b('0x15')][_0xf49b('0x16')]({'raw':_0x85c7f8['options']?_0x85c7f8[_0xf49b('0x17')][_0xf49b('0x18')]===undefined?!![]:![]:!![],'where':_0x85c7f8[_0xf49b('0x17')]?_0x85c7f8[_0xf49b('0x17')][_0xf49b('0x19')]||null:null,'attributes':_0x85c7f8[_0xf49b('0x17')]?_0x85c7f8[_0xf49b('0x17')][_0xf49b('0x1a')]||null:null,'limit':_0x85c7f8['options']?_0x85c7f8[_0xf49b('0x17')]['limit']||null:null,'include':_0x85c7f8[_0xf49b('0x17')]?_0x85c7f8[_0xf49b('0x17')][_0xf49b('0x1b')]?_[_0xf49b('0x1c')](_0x85c7f8[_0xf49b('0x17')]['include'],function(_0x11f184){return{'model':db[_0x11f184['model']],'as':_0x11f184['as'],'attributes':_0x11f184[_0xf49b('0x1a')],'include':_0x11f184[_0xf49b('0x1b')]?_[_0xf49b('0x1c')](_0x11f184['include'],function(_0x41a214){return{'model':db[_0x41a214['model']],'as':_0x41a214['as'],'attributes':_0x41a214[_0xf49b('0x1a')],'include':_0x41a214['include']?_[_0xf49b('0x1c')](_0x41a214['include'],function(_0x18e59b){return{'model':db[_0x18e59b[_0xf49b('0x1d')]],'as':_0x18e59b['as'],'attributes':_0x18e59b[_0xf49b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf49b('0x1e')](function(_0x5a22cb){logger[_0xf49b('0x11')](_0xf49b('0x14'),_0x85c7f8);logger[_0xf49b('0xb')](_0xf49b('0x14'),_0x85c7f8,JSON[_0xf49b('0xd')](_0x5a22cb));_0x59b31b(_0x5a22cb);})[_0xf49b('0x13')](function(_0x41f71d){logger[_0xf49b('0xe')](_0xf49b('0x14'),_0x41f71d[_0xf49b('0x10')],_0x85c7f8);_0x48c269(_0x40152e[_0xf49b('0xe')](0x1f4,_0x41f71d[_0xf49b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 38e874a..e06a58b 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 _0xb2ca=['../../config/environment','isAuthenticated','index','get','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAction','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3df1e9,_0x3cd30e){var _0xd6b371=function(_0x4b5457){while(--_0x4b5457){_0x3df1e9['push'](_0x3df1e9['shift']());}};_0xd6b371(++_0x3cd30e);}(_0xb2ca,0x1a8));var _0xab2c=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb2ca[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xab2c('0x0'));var util=require(_0xab2c('0x1'));var path=require('path');var timeout=require(_0xab2c('0x2'));var express=require(_0xab2c('0x3'));var router=express[_0xab2c('0x4')]();var fs_extra=require(_0xab2c('0x5'));var auth=require(_0xab2c('0x6'));var interaction=require(_0xab2c('0x7'));var config=require(_0xab2c('0x8'));var controller=require('./trigger.controller');router['get']('/',auth[_0xab2c('0x9')](),controller[_0xab2c('0xa')]);router[_0xab2c('0xb')]('/:id',auth[_0xab2c('0x9')](),controller[_0xab2c('0xc')]);router[_0xab2c('0xb')](_0xab2c('0xd'),auth[_0xab2c('0x9')](),controller[_0xab2c('0xe')]);router['get'](_0xab2c('0xf'),auth[_0xab2c('0x9')](),controller[_0xab2c('0x10')]);router[_0xab2c('0xb')](_0xab2c('0x11'),auth[_0xab2c('0x9')](),controller[_0xab2c('0x12')]);router[_0xab2c('0x13')]('/',auth[_0xab2c('0x9')](),controller['create']);router['post'](_0xab2c('0xd'),auth[_0xab2c('0x9')](),controller[_0xab2c('0x14')]);router[_0xab2c('0x13')](_0xab2c('0xf'),auth[_0xab2c('0x9')](),controller['addAnyCondition']);router[_0xab2c('0x13')](_0xab2c('0x11'),auth[_0xab2c('0x9')](),controller[_0xab2c('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xab2c('0x16')]);router[_0xab2c('0x17')](_0xab2c('0x18'),auth[_0xab2c('0x9')](),controller[_0xab2c('0x19')]);module[_0xab2c('0x1a')]=router; \ No newline at end of file +var _0x1373=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAction','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','isAuthenticated','index','/:id','show','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1373,0x1e1));var _0x3137=function(_0x46d354,_0x45fea4){_0x46d354=_0x46d354-0x0;var _0x2c6550=_0x1373[_0x46d354];return _0x2c6550;};'use strict';var multer=require(_0x3137('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3137('0x1'));var express=require(_0x3137('0x2'));var router=express[_0x3137('0x3')]();var fs_extra=require(_0x3137('0x4'));var auth=require(_0x3137('0x5'));var interaction=require(_0x3137('0x6'));var config=require('../../config/environment');var controller=require(_0x3137('0x7'));router['get']('/',auth[_0x3137('0x8')](),controller[_0x3137('0x9')]);router['get'](_0x3137('0xa'),auth['isAuthenticated'](),controller[_0x3137('0xb')]);router[_0x3137('0xc')]('/:id/all_conditions',auth[_0x3137('0x8')](),controller['getAllConditions']);router[_0x3137('0xc')](_0x3137('0xd'),auth[_0x3137('0x8')](),controller[_0x3137('0xe')]);router[_0x3137('0xc')](_0x3137('0xf'),auth[_0x3137('0x8')](),controller[_0x3137('0x10')]);router[_0x3137('0x11')]('/',auth[_0x3137('0x8')](),controller[_0x3137('0x12')]);router[_0x3137('0x11')](_0x3137('0x13'),auth[_0x3137('0x8')](),controller[_0x3137('0x14')]);router[_0x3137('0x11')](_0x3137('0xd'),auth[_0x3137('0x8')](),controller['addAnyCondition']);router[_0x3137('0x11')](_0x3137('0xf'),auth['isAuthenticated'](),controller[_0x3137('0x15')]);router[_0x3137('0x16')](_0x3137('0xa'),auth[_0x3137('0x8')](),controller[_0x3137('0x17')]);router[_0x3137('0x18')]('/:id',auth[_0x3137('0x8')](),controller[_0x3137('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 44846c0..e618aa8 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 _0xfb68=['BOOLEAN','sequelize','STRING'];(function(_0x3c1f23,_0x30ae2b){var _0x44896f=function(_0x4347c6){while(--_0x4347c6){_0x3c1f23['push'](_0x3c1f23['shift']());}};_0x44896f(++_0x30ae2b);}(_0xfb68,0xca));var _0x8fb6=function(_0x3ab175,_0x235a0a){_0x3ab175=_0x3ab175-0x0;var _0x3f65d3=_0xfb68[_0x3ab175];return _0x3f65d3;};'use strict';var Sequelize=require(_0x8fb6('0x0'));module['exports']={'name':{'type':Sequelize[_0x8fb6('0x1')]},'channel':{'type':Sequelize[_0x8fb6('0x1')]},'description':{'type':Sequelize[_0x8fb6('0x1')]},'status':{'type':Sequelize[_0x8fb6('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x04f7=['sequelize','STRING','BOOLEAN'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x04f7,0x1f2));var _0x704f=function(_0x2f5b57,_0x2e3cb1){_0x2f5b57=_0x2f5b57-0x0;var _0x137628=_0x04f7[_0x2f5b57];return _0x137628;};'use strict';var Sequelize=require(_0x704f('0x0'));module['exports']={'name':{'type':Sequelize[_0x704f('0x1')]},'channel':{'type':Sequelize[_0x704f('0x1')]},'description':{'type':Sequelize[_0x704f('0x1')]},'status':{'type':Sequelize[_0x704f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index da7db14..0cc0761 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 _0x5d13=['create','body','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','order','getAnyConditions','rawAttributes','options','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','Trigger','includeAll','include','rows','catch','show','params','length','find'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5d13,0x1f3));var _0x35d1=function(_0x42c351,_0x52c100){_0x42c351=_0x42c351-0x0;var _0x16bc83=_0x5d13[_0x42c351];return _0x16bc83;};'use strict';var emlformat=require(_0x35d1('0x0'));var rimraf=require(_0x35d1('0x1'));var zipdir=require(_0x35d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35d1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x35d1('0x4'));var util=require(_0x35d1('0x5'));var path=require(_0x35d1('0x6'));var sox=require(_0x35d1('0x7'));var csv=require(_0x35d1('0x8'));var ejs=require(_0x35d1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35d1('0xa'));var squel=require(_0x35d1('0xb'));var crypto=require(_0x35d1('0xc'));var jsforce=require(_0x35d1('0xd'));var deskjs=require(_0x35d1('0xe'));var toCsv=require(_0x35d1('0x8'));var querystring=require('querystring');var Papa=require(_0x35d1('0xf'));var Redis=require(_0x35d1('0x10'));var authService=require(_0x35d1('0x11'));var qs=require(_0x35d1('0x12'));var as=require(_0x35d1('0x13'));var hardwareService=require(_0x35d1('0x14'));var logger=require(_0x35d1('0x15'))(_0x35d1('0x16'));var utils=require(_0x35d1('0x17'));var config=require(_0x35d1('0x18'));var licenseUtil=require(_0x35d1('0x19'));var db=require(_0x35d1('0x1a'))['db'];function respondWithStatusCode(_0x5bb3f9,_0x5e3a2a){_0x5e3a2a=_0x5e3a2a||0xcc;return function(_0x20a69c){if(_0x20a69c){return _0x5bb3f9[_0x35d1('0x1b')](_0x5e3a2a);}return _0x5bb3f9[_0x35d1('0x1c')](_0x5e3a2a)[_0x35d1('0x1d')]();};}function respondWithResult(_0x1befd2,_0x2626f0){_0x2626f0=_0x2626f0||0xc8;return function(_0x35916f){if(_0x35916f){return _0x1befd2[_0x35d1('0x1c')](_0x2626f0)[_0x35d1('0x1e')](_0x35916f);}};}function respondWithFilteredResult(_0x4aecf4,_0xf6916c){return function(_0x59efe3){if(_0x59efe3){var _0x559bc7=typeof _0xf6916c[_0x35d1('0x1f')]===_0x35d1('0x20')&&typeof _0xf6916c[_0x35d1('0x21')]==='undefined';var _0x41970e=_0x59efe3[_0x35d1('0x22')];var _0x3df230=_0x559bc7?0x0:_0xf6916c[_0x35d1('0x1f')];var _0x40d8b9=_0x559bc7?_0x59efe3['count']:_0xf6916c[_0x35d1('0x1f')]+_0xf6916c[_0x35d1('0x21')];var _0xd0338f;if(_0x40d8b9>=_0x41970e){_0x40d8b9=_0x41970e;_0xd0338f=0xc8;}else{_0xd0338f=0xce;}_0x4aecf4[_0x35d1('0x1c')](_0xd0338f);return _0x4aecf4[_0x35d1('0x23')](_0x35d1('0x24'),_0x3df230+'-'+_0x40d8b9+'/'+_0x41970e)['json'](_0x59efe3);}return null;};}function patchUpdates(_0x56f535){return function(_0x37ed7e){try{jsonpatch[_0x35d1('0x25')](_0x37ed7e,_0x56f535,!![]);}catch(_0x2bc2c0){return BPromise[_0x35d1('0x26')](_0x2bc2c0);}return _0x37ed7e[_0x35d1('0x27')]();};}function saveUpdates(_0x40a3b6,_0x596ac3){return function(_0x5aa20d){if(_0x5aa20d){return _0x5aa20d[_0x35d1('0x28')](_0x40a3b6)[_0x35d1('0x29')](function(_0xf5077e){return _0xf5077e;});}return null;};}function removeEntity(_0x4f9627,_0x1386a2){return function(_0x361a66){if(_0x361a66){return _0x361a66[_0x35d1('0x2a')]()[_0x35d1('0x29')](function(){var _0x32922d=_0x361a66[_0x35d1('0x2b')]({'plain':!![]});var _0x40eb3d=_0x35d1('0x2c');return db[_0x35d1('0x2d')][_0x35d1('0x2a')]({'where':{'type':_0x40eb3d,'resourceId':_0x32922d['id']}})[_0x35d1('0x29')](function(){return _0x361a66;});})[_0x35d1('0x29')](function(){_0x4f9627[_0x35d1('0x1c')](0xcc)[_0x35d1('0x1d')]();});}};}function handleEntityNotFound(_0x157342,_0x64cc06){return function(_0x2cc20c){if(!_0x2cc20c){_0x157342['sendStatus'](0x194);}return _0x2cc20c;};}function handleError(_0x34c88f,_0x2b9ef8){_0x2b9ef8=_0x2b9ef8||0x1f4;return function(_0x6b558){logger['error'](_0x6b558['stack']);if(_0x6b558[_0x35d1('0x2e')]){delete _0x6b558['name'];}_0x34c88f['status'](_0x2b9ef8)[_0x35d1('0x2f')](_0x6b558);};}exports[_0x35d1('0x30')]=function(_0x5894ff,_0x3da2d7){var _0x17ee15={},_0x2adbbb={},_0x2d54e8={'count':0x0,'rows':[]};var _0x273b08=_[_0x35d1('0x31')](db['Trigger']['rawAttributes'],function(_0x59c65e){return{'name':_0x59c65e[_0x35d1('0x32')],'type':_0x59c65e[_0x35d1('0x33')][_0x35d1('0x34')]};});_0x2adbbb[_0x35d1('0x35')]=_[_0x35d1('0x31')](_0x273b08,'name');_0x2adbbb[_0x35d1('0x36')]=_[_0x35d1('0x37')](_0x5894ff[_0x35d1('0x36')]);_0x2adbbb[_0x35d1('0x38')]=_['intersection'](_0x2adbbb['model'],_0x2adbbb['query']);_0x17ee15[_0x35d1('0x39')]=_[_0x35d1('0x3a')](_0x2adbbb[_0x35d1('0x35')],qs[_0x35d1('0x3b')](_0x5894ff['query'][_0x35d1('0x3b')]));_0x17ee15[_0x35d1('0x39')]=_0x17ee15[_0x35d1('0x39')]['length']?_0x17ee15['attributes']:_0x2adbbb[_0x35d1('0x35')];if(!_0x5894ff[_0x35d1('0x36')][_0x35d1('0x3c')](_0x35d1('0x3d'))){_0x17ee15[_0x35d1('0x21')]=qs[_0x35d1('0x21')](_0x5894ff['query']['limit']);_0x17ee15['offset']=qs['offset'](_0x5894ff[_0x35d1('0x36')][_0x35d1('0x1f')]);}_0x17ee15['order']=qs[_0x35d1('0x3e')](_0x5894ff[_0x35d1('0x36')][_0x35d1('0x3e')]);_0x17ee15[_0x35d1('0x3f')]=qs[_0x35d1('0x38')](_[_0x35d1('0x40')](_0x5894ff[_0x35d1('0x36')],_0x2adbbb[_0x35d1('0x38')]),_0x273b08);if(_0x5894ff[_0x35d1('0x36')]['filter']){_0x17ee15[_0x35d1('0x3f')]=_[_0x35d1('0x41')](_0x17ee15[_0x35d1('0x3f')],{'$or':_[_0x35d1('0x31')](_0x273b08,function(_0x3569a3){if(_0x3569a3[_0x35d1('0x33')]!==_0x35d1('0x42')){var _0xc35bad={};_0xc35bad[_0x3569a3[_0x35d1('0x2e')]]={'$like':'%'+_0x5894ff[_0x35d1('0x36')][_0x35d1('0x43')]+'%'};return _0xc35bad;}})});}_0x17ee15=_[_0x35d1('0x41')]({},_0x17ee15,_0x5894ff['options']);var _0x5dcb5f={'where':_0x17ee15[_0x35d1('0x3f')]};return db[_0x35d1('0x44')][_0x35d1('0x22')](_0x5dcb5f)[_0x35d1('0x29')](function(_0x80d5d6){_0x2d54e8['count']=_0x80d5d6;if(_0x5894ff[_0x35d1('0x36')][_0x35d1('0x45')]){_0x17ee15[_0x35d1('0x46')]=[{'all':!![]}];}return db[_0x35d1('0x44')]['findAll'](_0x17ee15);})[_0x35d1('0x29')](function(_0x5a1eea){_0x2d54e8[_0x35d1('0x47')]=_0x5a1eea;return _0x2d54e8;})['then'](respondWithFilteredResult(_0x3da2d7,_0x17ee15))[_0x35d1('0x48')](handleError(_0x3da2d7,null));};exports[_0x35d1('0x49')]=function(_0x1f9a3b,_0x194294){var _0x29194c={'raw':![],'where':{'id':_0x1f9a3b[_0x35d1('0x4a')]['id']}},_0x2deadc={};_0x2deadc[_0x35d1('0x35')]=_[_0x35d1('0x37')](db[_0x35d1('0x44')]['rawAttributes']);_0x2deadc[_0x35d1('0x36')]=_[_0x35d1('0x37')](_0x1f9a3b[_0x35d1('0x36')]);_0x2deadc['filters']=_[_0x35d1('0x3a')](_0x2deadc[_0x35d1('0x35')],_0x2deadc[_0x35d1('0x36')]);_0x29194c[_0x35d1('0x39')]=_[_0x35d1('0x3a')](_0x2deadc[_0x35d1('0x35')],qs[_0x35d1('0x3b')](_0x1f9a3b[_0x35d1('0x36')][_0x35d1('0x3b')]));_0x29194c['attributes']=_0x29194c[_0x35d1('0x39')][_0x35d1('0x4b')]?_0x29194c[_0x35d1('0x39')]:_0x2deadc[_0x35d1('0x35')];if(_0x1f9a3b[_0x35d1('0x36')]['includeAll']){_0x29194c[_0x35d1('0x46')]=[{'all':!![]}];}_0x29194c=_['merge']({},_0x29194c,_0x1f9a3b['options']);return db[_0x35d1('0x44')][_0x35d1('0x4c')](_0x29194c)[_0x35d1('0x29')](handleEntityNotFound(_0x194294,null))[_0x35d1('0x29')](respondWithResult(_0x194294,null))[_0x35d1('0x48')](handleError(_0x194294,null));};exports['create']=function(_0x2e3d08,_0x55cd1b){return db['Trigger'][_0x35d1('0x4d')](_0x2e3d08[_0x35d1('0x4e')],{})[_0x35d1('0x29')](function(_0xf3784a){var _0x11bf55=_0x2e3d08['user'][_0x35d1('0x2b')]({'plain':!![]});if(!_0x11bf55)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11bf55['role']==='user'){var _0x7c286a=_0xf3784a[_0x35d1('0x2b')]({'plain':!![]});var _0x9a6451='Triggers';return db[_0x35d1('0x4f')][_0x35d1('0x4c')]({'where':{'name':_0x9a6451,'userProfileId':_0x11bf55[_0x35d1('0x50')]},'raw':!![]})[_0x35d1('0x29')](function(_0x29a1bf){if(_0x29a1bf&&_0x29a1bf['autoAssociation']===0x0){return db['UserProfileResource'][_0x35d1('0x4d')]({'name':_0x7c286a['name'],'resourceId':_0x7c286a['id'],'type':_0x29a1bf[_0x35d1('0x2e')],'sectionId':_0x29a1bf['id']},{})[_0x35d1('0x29')](function(){return _0xf3784a;});}else{return _0xf3784a;}})[_0x35d1('0x48')](function(_0x54791a){logger[_0x35d1('0x51')](_0x35d1('0x52'),_0x54791a);throw _0x54791a;});}return _0xf3784a;})['then'](respondWithResult(_0x55cd1b,0xc9))['catch'](handleError(_0x55cd1b,null));};exports[_0x35d1('0x28')]=function(_0x9b8f29,_0x4f08b5){if(_0x9b8f29['body']['id']){delete _0x9b8f29[_0x35d1('0x4e')]['id'];}return db[_0x35d1('0x44')][_0x35d1('0x4c')]({'where':{'id':_0x9b8f29[_0x35d1('0x4a')]['id']}})[_0x35d1('0x29')](handleEntityNotFound(_0x4f08b5,null))[_0x35d1('0x29')](saveUpdates(_0x9b8f29[_0x35d1('0x4e')],null))[_0x35d1('0x29')](respondWithResult(_0x4f08b5,null))[_0x35d1('0x48')](handleError(_0x4f08b5,null));};exports[_0x35d1('0x2a')]=function(_0x968828,_0x1c1e2e){return db[_0x35d1('0x44')][_0x35d1('0x4c')]({'where':{'id':_0x968828[_0x35d1('0x4a')]['id']}})[_0x35d1('0x29')](handleEntityNotFound(_0x1c1e2e,null))['then'](removeEntity(_0x1c1e2e,null))[_0x35d1('0x48')](handleError(_0x1c1e2e,null));};exports[_0x35d1('0x53')]=function(_0xc851e7,_0x4a0e26,_0x1d33d2){if(_0xc851e7[_0x35d1('0x4e')]['id']){delete _0xc851e7[_0x35d1('0x4e')]['id'];}return db[_0x35d1('0x44')]['find']({'where':{'id':_0xc851e7[_0x35d1('0x4a')]['id']}})[_0x35d1('0x29')](handleEntityNotFound(_0x4a0e26,null))['then'](function(_0x2ad392){if(_0x2ad392){_0xc851e7[_0x35d1('0x4e')]['TriggerAllId']=_0x2ad392['id'];return db[_0x35d1('0x54')][_0x35d1('0x4d')](_0xc851e7[_0x35d1('0x4e')]);}})[_0x35d1('0x29')](respondWithResult(_0x4a0e26,null))[_0x35d1('0x48')](handleError(_0x4a0e26,null));};exports[_0x35d1('0x55')]=function(_0x298b00,_0x37cb7e,_0x23820a){if(_0x298b00[_0x35d1('0x4e')]['id']){delete _0x298b00[_0x35d1('0x4e')]['id'];}return db[_0x35d1('0x44')]['find']({'where':{'id':_0x298b00[_0x35d1('0x4a')]['id']}})[_0x35d1('0x29')](handleEntityNotFound(_0x37cb7e,null))[_0x35d1('0x29')](function(_0x479b95){if(_0x479b95){_0x298b00[_0x35d1('0x4e')]['TriggerAnyId']=_0x479b95['id'];return db['Condition'][_0x35d1('0x4d')](_0x298b00['body']);}})[_0x35d1('0x29')](respondWithResult(_0x37cb7e,null))[_0x35d1('0x48')](handleError(_0x37cb7e,null));};exports[_0x35d1('0x56')]=function(_0x5ccb5e,_0xa0233a,_0x8b0cf2){var _0xe9d8d8={};var _0x2a1c31={};var _0x323c24;var _0x1428ad;return db[_0x35d1('0x44')][_0x35d1('0x57')]({'where':{'id':_0x5ccb5e['params']['id']}})['then'](handleEntityNotFound(_0xa0233a,null))[_0x35d1('0x29')](function(_0x474034){if(_0x474034){_0x323c24=_0x474034;_0x2a1c31[_0x35d1('0x35')]=_[_0x35d1('0x37')](db['Condition']['rawAttributes']);_0x2a1c31[_0x35d1('0x36')]=_[_0x35d1('0x37')](_0x5ccb5e[_0x35d1('0x36')]);_0x2a1c31[_0x35d1('0x38')]=_['intersection'](_0x2a1c31[_0x35d1('0x35')],_0x2a1c31[_0x35d1('0x36')]);_0xe9d8d8[_0x35d1('0x39')]=_['intersection'](_0x2a1c31[_0x35d1('0x35')],qs[_0x35d1('0x3b')](_0x5ccb5e[_0x35d1('0x36')]['fields']));_0xe9d8d8['attributes']=_0xe9d8d8[_0x35d1('0x39')][_0x35d1('0x4b')]?_0xe9d8d8[_0x35d1('0x39')]:_0x2a1c31[_0x35d1('0x35')];_0xe9d8d8[_0x35d1('0x58')]=qs[_0x35d1('0x3e')](_0x5ccb5e['query'][_0x35d1('0x3e')]);_0xe9d8d8['where']=qs[_0x35d1('0x38')](_[_0x35d1('0x40')](_0x5ccb5e[_0x35d1('0x36')],_0x2a1c31[_0x35d1('0x38')]));if(_0x5ccb5e[_0x35d1('0x36')]['filter']){_0xe9d8d8[_0x35d1('0x3f')]=_[_0x35d1('0x41')](_0xe9d8d8[_0x35d1('0x3f')],{'$or':_[_0x35d1('0x31')](_0xe9d8d8['attributes'],function(_0x3c013f){var _0x26039f={};_0x26039f[_0x3c013f]={'$like':'%'+_0x5ccb5e[_0x35d1('0x36')]['filter']+'%'};return _0x26039f;})});}_0xe9d8d8=_[_0x35d1('0x41')]({},_0xe9d8d8,_0x5ccb5e['options']);return _0x323c24[_0x35d1('0x56')](_0xe9d8d8);}})[_0x35d1('0x29')](function(_0x18f2e0){if(_0x18f2e0){_0x1428ad=_0x18f2e0['length'];if(!_0x5ccb5e[_0x35d1('0x36')][_0x35d1('0x3c')](_0x35d1('0x3d'))){_0xe9d8d8[_0x35d1('0x21')]=qs['limit'](_0x5ccb5e[_0x35d1('0x36')][_0x35d1('0x21')]);_0xe9d8d8[_0x35d1('0x1f')]=qs[_0x35d1('0x1f')](_0x5ccb5e[_0x35d1('0x36')][_0x35d1('0x1f')]);}return _0x323c24[_0x35d1('0x56')](_0xe9d8d8);}})[_0x35d1('0x29')](function(_0x28e375){if(_0x28e375){return _0x28e375?{'count':_0x1428ad,'rows':_0x28e375}:null;}})[_0x35d1('0x29')](respondWithResult(_0xa0233a,null))[_0x35d1('0x48')](handleError(_0xa0233a,null));};exports[_0x35d1('0x59')]=function(_0x135661,_0xdf38c4,_0x3fdc66){var _0x318f04={};var _0x4b0705={};var _0x477ce7;var _0x51de77;return db[_0x35d1('0x44')][_0x35d1('0x57')]({'where':{'id':_0x135661[_0x35d1('0x4a')]['id']}})[_0x35d1('0x29')](handleEntityNotFound(_0xdf38c4,null))[_0x35d1('0x29')](function(_0x465f5f){if(_0x465f5f){_0x477ce7=_0x465f5f;_0x4b0705[_0x35d1('0x35')]=_[_0x35d1('0x37')](db['Condition'][_0x35d1('0x5a')]);_0x4b0705[_0x35d1('0x36')]=_[_0x35d1('0x37')](_0x135661[_0x35d1('0x36')]);_0x4b0705[_0x35d1('0x38')]=_[_0x35d1('0x3a')](_0x4b0705['model'],_0x4b0705[_0x35d1('0x36')]);_0x318f04[_0x35d1('0x39')]=_[_0x35d1('0x3a')](_0x4b0705['model'],qs[_0x35d1('0x3b')](_0x135661[_0x35d1('0x36')][_0x35d1('0x3b')]));_0x318f04[_0x35d1('0x39')]=_0x318f04[_0x35d1('0x39')][_0x35d1('0x4b')]?_0x318f04[_0x35d1('0x39')]:_0x4b0705[_0x35d1('0x35')];_0x318f04[_0x35d1('0x58')]=qs['sort'](_0x135661[_0x35d1('0x36')][_0x35d1('0x3e')]);_0x318f04['where']=qs['filters'](_['pick'](_0x135661['query'],_0x4b0705['filters']));if(_0x135661[_0x35d1('0x36')][_0x35d1('0x43')]){_0x318f04[_0x35d1('0x3f')]=_[_0x35d1('0x41')](_0x318f04[_0x35d1('0x3f')],{'$or':_[_0x35d1('0x31')](_0x318f04[_0x35d1('0x39')],function(_0xe7a9d8){var _0x2f7559={};_0x2f7559[_0xe7a9d8]={'$like':'%'+_0x135661['query'][_0x35d1('0x43')]+'%'};return _0x2f7559;})});}_0x318f04=_[_0x35d1('0x41')]({},_0x318f04,_0x135661[_0x35d1('0x5b')]);return _0x477ce7['getAnyConditions'](_0x318f04);}})[_0x35d1('0x29')](function(_0x2f47ca){if(_0x2f47ca){_0x51de77=_0x2f47ca[_0x35d1('0x4b')];if(!_0x135661[_0x35d1('0x36')][_0x35d1('0x3c')](_0x35d1('0x3d'))){_0x318f04['limit']=qs[_0x35d1('0x21')](_0x135661[_0x35d1('0x36')][_0x35d1('0x21')]);_0x318f04[_0x35d1('0x1f')]=qs[_0x35d1('0x1f')](_0x135661['query'][_0x35d1('0x1f')]);}return _0x477ce7[_0x35d1('0x59')](_0x318f04);}})[_0x35d1('0x29')](function(_0x3e6c70){if(_0x3e6c70){return _0x3e6c70?{'count':_0x51de77,'rows':_0x3e6c70}:null;}})[_0x35d1('0x29')](respondWithResult(_0xdf38c4,null))[_0x35d1('0x48')](handleError(_0xdf38c4,null));};exports[_0x35d1('0x5c')]=function(_0x4dd6fc,_0x2a54f,_0x246a24){if(_0x4dd6fc[_0x35d1('0x4e')]['id']){delete _0x4dd6fc[_0x35d1('0x4e')]['id'];}return db[_0x35d1('0x44')][_0x35d1('0x4c')]({'where':{'id':_0x4dd6fc[_0x35d1('0x4a')]['id']}})[_0x35d1('0x29')](handleEntityNotFound(_0x2a54f,null))[_0x35d1('0x29')](function(_0x3fef2f){if(_0x3fef2f){_0x4dd6fc[_0x35d1('0x4e')][_0x35d1('0x5d')]=_0x3fef2f['id'];return db[_0x35d1('0x5e')][_0x35d1('0x4d')](_0x4dd6fc[_0x35d1('0x4e')]);}})[_0x35d1('0x29')](respondWithResult(_0x2a54f,null))[_0x35d1('0x48')](handleError(_0x2a54f,null));};exports[_0x35d1('0x5f')]=function(_0x1ef0be,_0x36c47d,_0x3b88a5){var _0x5d9259={};var _0x3b6df3={};var _0xf85200;var _0x440866;return db['Trigger']['findOne']({'where':{'id':_0x1ef0be[_0x35d1('0x4a')]['id']}})[_0x35d1('0x29')](handleEntityNotFound(_0x36c47d,null))['then'](function(_0x236410){if(_0x236410){_0xf85200=_0x236410;_0x3b6df3[_0x35d1('0x35')]=_[_0x35d1('0x37')](db['Action'][_0x35d1('0x5a')]);_0x3b6df3['query']=_['keys'](_0x1ef0be[_0x35d1('0x36')]);_0x3b6df3[_0x35d1('0x38')]=_[_0x35d1('0x3a')](_0x3b6df3[_0x35d1('0x35')],_0x3b6df3['query']);_0x5d9259['attributes']=_[_0x35d1('0x3a')](_0x3b6df3[_0x35d1('0x35')],qs[_0x35d1('0x3b')](_0x1ef0be[_0x35d1('0x36')]['fields']));_0x5d9259[_0x35d1('0x39')]=_0x5d9259['attributes'][_0x35d1('0x4b')]?_0x5d9259[_0x35d1('0x39')]:_0x3b6df3['model'];_0x5d9259['order']=qs[_0x35d1('0x3e')](_0x1ef0be['query'][_0x35d1('0x3e')]);_0x5d9259['where']=qs['filters'](_[_0x35d1('0x40')](_0x1ef0be['query'],_0x3b6df3['filters']));if(_0x1ef0be[_0x35d1('0x36')][_0x35d1('0x43')]){_0x5d9259[_0x35d1('0x3f')]=_[_0x35d1('0x41')](_0x5d9259[_0x35d1('0x3f')],{'$or':_[_0x35d1('0x31')](_0x5d9259[_0x35d1('0x39')],function(_0x1f9ea2){var _0x23e8c9={};_0x23e8c9[_0x1f9ea2]={'$like':'%'+_0x1ef0be[_0x35d1('0x36')]['filter']+'%'};return _0x23e8c9;})});}_0x5d9259=_[_0x35d1('0x41')]({},_0x5d9259,_0x1ef0be[_0x35d1('0x5b')]);return _0xf85200['getActions'](_0x5d9259);}})['then'](function(_0x1acbbb){if(_0x1acbbb){_0x440866=_0x1acbbb[_0x35d1('0x4b')];if(!_0x1ef0be[_0x35d1('0x36')][_0x35d1('0x3c')](_0x35d1('0x3d'))){_0x5d9259[_0x35d1('0x21')]=qs[_0x35d1('0x21')](_0x1ef0be['query'][_0x35d1('0x21')]);_0x5d9259[_0x35d1('0x1f')]=qs[_0x35d1('0x1f')](_0x1ef0be[_0x35d1('0x36')][_0x35d1('0x1f')]);}return _0xf85200[_0x35d1('0x5f')](_0x5d9259);}})[_0x35d1('0x29')](function(_0x37ac81){if(_0x37ac81){return _0x37ac81?{'count':_0x440866,'rows':_0x37ac81}:null;}})[_0x35d1('0x29')](respondWithResult(_0x36c47d,null))[_0x35d1('0x48')](handleError(_0x36c47d,null));}; \ No newline at end of file +var _0xa9e0=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','Trigger','include','findAll','rows','catch','show','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','body','params','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','TriggerId','getActions','Action','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','Triggers','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x352d55,_0x43aa7c){var _0x5743bb=function(_0x5ddfbb){while(--_0x5ddfbb){_0x352d55['push'](_0x352d55['shift']());}};_0x5743bb(++_0x43aa7c);}(_0xa9e0,0xe2));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0a9e('0x0'));var jsonpatch=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x0a9e('0x4'));var ejs=require(_0x0a9e('0x5'));var fs=require('fs');var fs_extra=require(_0x0a9e('0x6'));var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require(_0x0a9e('0x9'));var jsforce=require(_0x0a9e('0xa'));var deskjs=require(_0x0a9e('0xb'));var toCsv=require(_0x0a9e('0x4'));var querystring=require(_0x0a9e('0xc'));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(_0x0a9e('0x13'))(_0x0a9e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x15'));var db=require(_0x0a9e('0x16'))['db'];function respondWithStatusCode(_0x490ae7,_0x28b2a5){_0x28b2a5=_0x28b2a5||0xcc;return function(_0x387f0a){if(_0x387f0a){return _0x490ae7[_0x0a9e('0x17')](_0x28b2a5);}return _0x490ae7[_0x0a9e('0x18')](_0x28b2a5)[_0x0a9e('0x19')]();};}function respondWithResult(_0x4e445f,_0xe956ee){_0xe956ee=_0xe956ee||0xc8;return function(_0x9515f4){if(_0x9515f4){return _0x4e445f[_0x0a9e('0x18')](_0xe956ee)[_0x0a9e('0x1a')](_0x9515f4);}};}function respondWithFilteredResult(_0x187b51,_0x3bb8ca){return function(_0x8860a4){if(_0x8860a4){var _0x2366f2=typeof _0x3bb8ca['offset']===_0x0a9e('0x1b')&&typeof _0x3bb8ca[_0x0a9e('0x1c')]===_0x0a9e('0x1b');var _0x10aff7=_0x8860a4[_0x0a9e('0x1d')];var _0x386727=_0x2366f2?0x0:_0x3bb8ca['offset'];var _0x37a046=_0x2366f2?_0x8860a4[_0x0a9e('0x1d')]:_0x3bb8ca[_0x0a9e('0x1e')]+_0x3bb8ca[_0x0a9e('0x1c')];var _0x28c391;if(_0x37a046>=_0x10aff7){_0x37a046=_0x10aff7;_0x28c391=0xc8;}else{_0x28c391=0xce;}_0x187b51[_0x0a9e('0x18')](_0x28c391);return _0x187b51[_0x0a9e('0x1f')]('Content-Range',_0x386727+'-'+_0x37a046+'/'+_0x10aff7)[_0x0a9e('0x1a')](_0x8860a4);}return null;};}function patchUpdates(_0x39d2cb){return function(_0x18ba46){try{jsonpatch[_0x0a9e('0x20')](_0x18ba46,_0x39d2cb,!![]);}catch(_0x19e3f5){return BPromise[_0x0a9e('0x21')](_0x19e3f5);}return _0x18ba46[_0x0a9e('0x22')]();};}function saveUpdates(_0x3af648,_0x37e5ca){return function(_0x838073){if(_0x838073){return _0x838073[_0x0a9e('0x23')](_0x3af648)[_0x0a9e('0x24')](function(_0xaf83f8){return _0xaf83f8;});}return null;};}function removeEntity(_0x100210,_0xe54240){return function(_0x23ca21){if(_0x23ca21){return _0x23ca21['destroy']()['then'](function(){var _0x1bd0ca=_0x23ca21[_0x0a9e('0x25')]({'plain':!![]});var _0x1fcf80=_0x0a9e('0x26');return db['UserProfileResource'][_0x0a9e('0x27')]({'where':{'type':_0x1fcf80,'resourceId':_0x1bd0ca['id']}})[_0x0a9e('0x24')](function(){return _0x23ca21;});})['then'](function(){_0x100210[_0x0a9e('0x18')](0xcc)[_0x0a9e('0x19')]();});}};}function handleEntityNotFound(_0x513383,_0x1c4875){return function(_0x52ffed){if(!_0x52ffed){_0x513383[_0x0a9e('0x17')](0x194);}return _0x52ffed;};}function handleError(_0x12a812,_0x51eaa3){_0x51eaa3=_0x51eaa3||0x1f4;return function(_0x59a053){logger[_0x0a9e('0x28')](_0x59a053['stack']);if(_0x59a053[_0x0a9e('0x29')]){delete _0x59a053[_0x0a9e('0x29')];}_0x12a812[_0x0a9e('0x18')](_0x51eaa3)[_0x0a9e('0x2a')](_0x59a053);};}exports[_0x0a9e('0x2b')]=function(_0x4ab1c9,_0x254025){var _0x3d2e72={},_0x42ea01={},_0x1db049={'count':0x0,'rows':[]};var _0x5a2fec=_[_0x0a9e('0x2c')](db['Trigger'][_0x0a9e('0x2d')],function(_0x593e75){return{'name':_0x593e75[_0x0a9e('0x2e')],'type':_0x593e75[_0x0a9e('0x2f')][_0x0a9e('0x30')]};});_0x42ea01[_0x0a9e('0x31')]=_['map'](_0x5a2fec,_0x0a9e('0x29'));_0x42ea01[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x4ab1c9['query']);_0x42ea01['filters']=_[_0x0a9e('0x34')](_0x42ea01['model'],_0x42ea01['query']);_0x3d2e72[_0x0a9e('0x35')]=_[_0x0a9e('0x34')](_0x42ea01['model'],qs[_0x0a9e('0x36')](_0x4ab1c9[_0x0a9e('0x32')]['fields']));_0x3d2e72[_0x0a9e('0x35')]=_0x3d2e72[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x3d2e72['attributes']:_0x42ea01[_0x0a9e('0x31')];if(!_0x4ab1c9['query'][_0x0a9e('0x38')](_0x0a9e('0x39'))){_0x3d2e72['limit']=qs[_0x0a9e('0x1c')](_0x4ab1c9[_0x0a9e('0x32')]['limit']);_0x3d2e72[_0x0a9e('0x1e')]=qs['offset'](_0x4ab1c9[_0x0a9e('0x32')][_0x0a9e('0x1e')]);}_0x3d2e72[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x4ab1c9[_0x0a9e('0x32')][_0x0a9e('0x3b')]);_0x3d2e72['where']=qs[_0x0a9e('0x3c')](_[_0x0a9e('0x3d')](_0x4ab1c9[_0x0a9e('0x32')],_0x42ea01[_0x0a9e('0x3c')]),_0x5a2fec);if(_0x4ab1c9[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x3d2e72['where']=_[_0x0a9e('0x3f')](_0x3d2e72[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2c')](_0x5a2fec,function(_0x4c713e){if(_0x4c713e[_0x0a9e('0x2f')]!==_0x0a9e('0x41')){var _0x53e804={};_0x53e804[_0x4c713e['name']]={'$like':'%'+_0x4ab1c9[_0x0a9e('0x32')]['filter']+'%'};return _0x53e804;}})});}_0x3d2e72=_[_0x0a9e('0x3f')]({},_0x3d2e72,_0x4ab1c9[_0x0a9e('0x42')]);var _0x1a1407={'where':_0x3d2e72[_0x0a9e('0x40')]};return db[_0x0a9e('0x43')][_0x0a9e('0x1d')](_0x1a1407)[_0x0a9e('0x24')](function(_0x48f44e){_0x1db049[_0x0a9e('0x1d')]=_0x48f44e;if(_0x4ab1c9[_0x0a9e('0x32')]['includeAll']){_0x3d2e72[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x43')][_0x0a9e('0x45')](_0x3d2e72);})[_0x0a9e('0x24')](function(_0x23e57c){_0x1db049[_0x0a9e('0x46')]=_0x23e57c;return _0x1db049;})[_0x0a9e('0x24')](respondWithFilteredResult(_0x254025,_0x3d2e72))[_0x0a9e('0x47')](handleError(_0x254025,null));};exports[_0x0a9e('0x48')]=function(_0x5ecdb0,_0x4db2c6){var _0x4d0b96={'raw':![],'where':{'id':_0x5ecdb0['params']['id']}},_0x388e68={};_0x388e68[_0x0a9e('0x31')]=_[_0x0a9e('0x33')](db['Trigger'][_0x0a9e('0x2d')]);_0x388e68['query']=_[_0x0a9e('0x33')](_0x5ecdb0[_0x0a9e('0x32')]);_0x388e68['filters']=_['intersection'](_0x388e68[_0x0a9e('0x31')],_0x388e68[_0x0a9e('0x32')]);_0x4d0b96[_0x0a9e('0x35')]=_[_0x0a9e('0x34')](_0x388e68['model'],qs[_0x0a9e('0x36')](_0x5ecdb0[_0x0a9e('0x32')][_0x0a9e('0x36')]));_0x4d0b96[_0x0a9e('0x35')]=_0x4d0b96[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x4d0b96[_0x0a9e('0x35')]:_0x388e68[_0x0a9e('0x31')];if(_0x5ecdb0['query'][_0x0a9e('0x49')]){_0x4d0b96[_0x0a9e('0x44')]=[{'all':!![]}];}_0x4d0b96=_[_0x0a9e('0x3f')]({},_0x4d0b96,_0x5ecdb0[_0x0a9e('0x42')]);return db[_0x0a9e('0x43')][_0x0a9e('0x4a')](_0x4d0b96)['then'](handleEntityNotFound(_0x4db2c6,null))[_0x0a9e('0x24')](respondWithResult(_0x4db2c6,null))[_0x0a9e('0x47')](handleError(_0x4db2c6,null));};exports[_0x0a9e('0x4b')]=function(_0x33f27d,_0xbdffcb){return db[_0x0a9e('0x43')][_0x0a9e('0x4b')](_0x33f27d['body'],{})['then'](function(_0x5c6cfc){var _0x45da17=_0x33f27d[_0x0a9e('0x4c')][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45da17)throw new Error(_0x0a9e('0x4d'));if(_0x45da17['role']===_0x0a9e('0x4c')){var _0x38aafe=_0x5c6cfc[_0x0a9e('0x25')]({'plain':!![]});var _0x5d6dee=_0x0a9e('0x26');return db['UserProfileSection'][_0x0a9e('0x4a')]({'where':{'name':_0x5d6dee,'userProfileId':_0x45da17[_0x0a9e('0x4e')]},'raw':!![]})[_0x0a9e('0x24')](function(_0x63d01b){if(_0x63d01b&&_0x63d01b['autoAssociation']===0x0){return db[_0x0a9e('0x4f')][_0x0a9e('0x4b')]({'name':_0x38aafe[_0x0a9e('0x29')],'resourceId':_0x38aafe['id'],'type':_0x63d01b[_0x0a9e('0x29')],'sectionId':_0x63d01b['id']},{})[_0x0a9e('0x24')](function(){return _0x5c6cfc;});}else{return _0x5c6cfc;}})[_0x0a9e('0x47')](function(_0x3439ef){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3439ef);throw _0x3439ef;});}return _0x5c6cfc;})[_0x0a9e('0x24')](respondWithResult(_0xbdffcb,0xc9))[_0x0a9e('0x47')](handleError(_0xbdffcb,null));};exports[_0x0a9e('0x23')]=function(_0xe27fdd,_0xb74f36){if(_0xe27fdd[_0x0a9e('0x50')]['id']){delete _0xe27fdd[_0x0a9e('0x50')]['id'];}return db['Trigger'][_0x0a9e('0x4a')]({'where':{'id':_0xe27fdd['params']['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0xb74f36,null))[_0x0a9e('0x24')](saveUpdates(_0xe27fdd[_0x0a9e('0x50')],null))[_0x0a9e('0x24')](respondWithResult(_0xb74f36,null))[_0x0a9e('0x47')](handleError(_0xb74f36,null));};exports[_0x0a9e('0x27')]=function(_0x3e71e0,_0x3d27bf){return db[_0x0a9e('0x43')][_0x0a9e('0x4a')]({'where':{'id':_0x3e71e0[_0x0a9e('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d27bf,null))[_0x0a9e('0x24')](removeEntity(_0x3d27bf,null))[_0x0a9e('0x47')](handleError(_0x3d27bf,null));};exports['addAllCondition']=function(_0x47819d,_0x2af00c,_0x139ad6){if(_0x47819d[_0x0a9e('0x50')]['id']){delete _0x47819d[_0x0a9e('0x50')]['id'];}return db['Trigger'][_0x0a9e('0x4a')]({'where':{'id':_0x47819d[_0x0a9e('0x51')]['id']}})['then'](handleEntityNotFound(_0x2af00c,null))[_0x0a9e('0x24')](function(_0x434c23){if(_0x434c23){_0x47819d[_0x0a9e('0x50')][_0x0a9e('0x52')]=_0x434c23['id'];return db['Condition'][_0x0a9e('0x4b')](_0x47819d[_0x0a9e('0x50')]);}})['then'](respondWithResult(_0x2af00c,null))[_0x0a9e('0x47')](handleError(_0x2af00c,null));};exports[_0x0a9e('0x53')]=function(_0x25b672,_0x2757d6,_0x18438b){if(_0x25b672['body']['id']){delete _0x25b672[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x4a')]({'where':{'id':_0x25b672['params']['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x2757d6,null))[_0x0a9e('0x24')](function(_0x1d2aed){if(_0x1d2aed){_0x25b672[_0x0a9e('0x50')][_0x0a9e('0x54')]=_0x1d2aed['id'];return db[_0x0a9e('0x55')][_0x0a9e('0x4b')](_0x25b672[_0x0a9e('0x50')]);}})['then'](respondWithResult(_0x2757d6,null))[_0x0a9e('0x47')](handleError(_0x2757d6,null));};exports[_0x0a9e('0x56')]=function(_0x5610a6,_0x4c5221,_0x22cca4){var _0x224991={};var _0x394dc3={};var _0x5944f6;var _0x415567;return db[_0x0a9e('0x43')][_0x0a9e('0x57')]({'where':{'id':_0x5610a6[_0x0a9e('0x51')]['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x4c5221,null))[_0x0a9e('0x24')](function(_0x2c49d2){if(_0x2c49d2){_0x5944f6=_0x2c49d2;_0x394dc3[_0x0a9e('0x31')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x55')][_0x0a9e('0x2d')]);_0x394dc3[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x5610a6[_0x0a9e('0x32')]);_0x394dc3['filters']=_[_0x0a9e('0x34')](_0x394dc3['model'],_0x394dc3['query']);_0x224991[_0x0a9e('0x35')]=_[_0x0a9e('0x34')](_0x394dc3[_0x0a9e('0x31')],qs['fields'](_0x5610a6[_0x0a9e('0x32')]['fields']));_0x224991[_0x0a9e('0x35')]=_0x224991[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x224991[_0x0a9e('0x35')]:_0x394dc3['model'];_0x224991[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x5610a6[_0x0a9e('0x32')]['sort']);_0x224991['where']=qs['filters'](_[_0x0a9e('0x3d')](_0x5610a6['query'],_0x394dc3['filters']));if(_0x5610a6[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x224991[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x224991['where'],{'$or':_[_0x0a9e('0x2c')](_0x224991[_0x0a9e('0x35')],function(_0x35e071){var _0x11e4be={};_0x11e4be[_0x35e071]={'$like':'%'+_0x5610a6['query'][_0x0a9e('0x3e')]+'%'};return _0x11e4be;})});}_0x224991=_[_0x0a9e('0x3f')]({},_0x224991,_0x5610a6[_0x0a9e('0x42')]);return _0x5944f6['getAllConditions'](_0x224991);}})[_0x0a9e('0x24')](function(_0x1f87d7){if(_0x1f87d7){_0x415567=_0x1f87d7['length'];if(!_0x5610a6['query'][_0x0a9e('0x38')](_0x0a9e('0x39'))){_0x224991[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5610a6[_0x0a9e('0x32')][_0x0a9e('0x1c')]);_0x224991[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5610a6['query'][_0x0a9e('0x1e')]);}return _0x5944f6['getAllConditions'](_0x224991);}})['then'](function(_0x4f3215){if(_0x4f3215){return _0x4f3215?{'count':_0x415567,'rows':_0x4f3215}:null;}})[_0x0a9e('0x24')](respondWithResult(_0x4c5221,null))[_0x0a9e('0x47')](handleError(_0x4c5221,null));};exports['getAnyConditions']=function(_0x59f28d,_0x628a36,_0x52af4e){var _0x3972df={};var _0x57a8c4={};var _0x4035d5;var _0x380352;return db['Trigger'][_0x0a9e('0x57')]({'where':{'id':_0x59f28d['params']['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x628a36,null))[_0x0a9e('0x24')](function(_0x2d298a){if(_0x2d298a){_0x4035d5=_0x2d298a;_0x57a8c4[_0x0a9e('0x31')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x55')][_0x0a9e('0x2d')]);_0x57a8c4[_0x0a9e('0x32')]=_['keys'](_0x59f28d[_0x0a9e('0x32')]);_0x57a8c4[_0x0a9e('0x3c')]=_['intersection'](_0x57a8c4[_0x0a9e('0x31')],_0x57a8c4['query']);_0x3972df[_0x0a9e('0x35')]=_[_0x0a9e('0x34')](_0x57a8c4[_0x0a9e('0x31')],qs[_0x0a9e('0x36')](_0x59f28d['query']['fields']));_0x3972df[_0x0a9e('0x35')]=_0x3972df[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x3972df[_0x0a9e('0x35')]:_0x57a8c4[_0x0a9e('0x31')];_0x3972df[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x59f28d[_0x0a9e('0x32')][_0x0a9e('0x3b')]);_0x3972df['where']=qs[_0x0a9e('0x3c')](_[_0x0a9e('0x3d')](_0x59f28d[_0x0a9e('0x32')],_0x57a8c4[_0x0a9e('0x3c')]));if(_0x59f28d[_0x0a9e('0x32')]['filter']){_0x3972df[_0x0a9e('0x40')]=_['merge'](_0x3972df[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2c')](_0x3972df[_0x0a9e('0x35')],function(_0x2afafc){var _0x771ea7={};_0x771ea7[_0x2afafc]={'$like':'%'+_0x59f28d[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x771ea7;})});}_0x3972df=_[_0x0a9e('0x3f')]({},_0x3972df,_0x59f28d[_0x0a9e('0x42')]);return _0x4035d5[_0x0a9e('0x58')](_0x3972df);}})['then'](function(_0x2bad95){if(_0x2bad95){_0x380352=_0x2bad95[_0x0a9e('0x37')];if(!_0x59f28d[_0x0a9e('0x32')]['hasOwnProperty'](_0x0a9e('0x39'))){_0x3972df[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x59f28d[_0x0a9e('0x32')][_0x0a9e('0x1c')]);_0x3972df[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x59f28d[_0x0a9e('0x32')][_0x0a9e('0x1e')]);}return _0x4035d5['getAnyConditions'](_0x3972df);}})[_0x0a9e('0x24')](function(_0x3be807){if(_0x3be807){return _0x3be807?{'count':_0x380352,'rows':_0x3be807}:null;}})['then'](respondWithResult(_0x628a36,null))[_0x0a9e('0x47')](handleError(_0x628a36,null));};exports['addAction']=function(_0x2ac7ae,_0x35be11,_0x480472){if(_0x2ac7ae[_0x0a9e('0x50')]['id']){delete _0x2ac7ae[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x4a')]({'where':{'id':_0x2ac7ae[_0x0a9e('0x51')]['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x35be11,null))[_0x0a9e('0x24')](function(_0x1f9732){if(_0x1f9732){_0x2ac7ae[_0x0a9e('0x50')][_0x0a9e('0x59')]=_0x1f9732['id'];return db['Action'][_0x0a9e('0x4b')](_0x2ac7ae[_0x0a9e('0x50')]);}})['then'](respondWithResult(_0x35be11,null))['catch'](handleError(_0x35be11,null));};exports[_0x0a9e('0x5a')]=function(_0x4e1688,_0x3a2c7d,_0x59b5ec){var _0x3c0eef={};var _0x2cd781={};var _0x467c2f;var _0x2aa344;return db[_0x0a9e('0x43')]['findOne']({'where':{'id':_0x4e1688['params']['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x3a2c7d,null))[_0x0a9e('0x24')](function(_0x8d2193){if(_0x8d2193){_0x467c2f=_0x8d2193;_0x2cd781['model']=_['keys'](db[_0x0a9e('0x5b')][_0x0a9e('0x2d')]);_0x2cd781[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x4e1688[_0x0a9e('0x32')]);_0x2cd781[_0x0a9e('0x3c')]=_[_0x0a9e('0x34')](_0x2cd781[_0x0a9e('0x31')],_0x2cd781[_0x0a9e('0x32')]);_0x3c0eef['attributes']=_['intersection'](_0x2cd781[_0x0a9e('0x31')],qs['fields'](_0x4e1688['query'][_0x0a9e('0x36')]));_0x3c0eef[_0x0a9e('0x35')]=_0x3c0eef[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x3c0eef[_0x0a9e('0x35')]:_0x2cd781[_0x0a9e('0x31')];_0x3c0eef['order']=qs[_0x0a9e('0x3b')](_0x4e1688['query'][_0x0a9e('0x3b')]);_0x3c0eef[_0x0a9e('0x40')]=qs[_0x0a9e('0x3c')](_[_0x0a9e('0x3d')](_0x4e1688[_0x0a9e('0x32')],_0x2cd781[_0x0a9e('0x3c')]));if(_0x4e1688[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x3c0eef['where']=_['merge'](_0x3c0eef[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2c')](_0x3c0eef[_0x0a9e('0x35')],function(_0x17e3b7){var _0x36ac80={};_0x36ac80[_0x17e3b7]={'$like':'%'+_0x4e1688['query'][_0x0a9e('0x3e')]+'%'};return _0x36ac80;})});}_0x3c0eef=_[_0x0a9e('0x3f')]({},_0x3c0eef,_0x4e1688['options']);return _0x467c2f[_0x0a9e('0x5a')](_0x3c0eef);}})['then'](function(_0x3b2294){if(_0x3b2294){_0x2aa344=_0x3b2294['length'];if(!_0x4e1688[_0x0a9e('0x32')][_0x0a9e('0x38')](_0x0a9e('0x39'))){_0x3c0eef[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x4e1688[_0x0a9e('0x32')]['limit']);_0x3c0eef[_0x0a9e('0x1e')]=qs['offset'](_0x4e1688['query'][_0x0a9e('0x1e')]);}return _0x467c2f[_0x0a9e('0x5a')](_0x3c0eef);}})[_0x0a9e('0x24')](function(_0x54a1b0){if(_0x54a1b0){return _0x54a1b0?{'count':_0x2aa344,'rows':_0x54a1b0}:null;}})[_0x0a9e('0x24')](respondWithResult(_0x3a2c7d,null))[_0x0a9e('0x47')](handleError(_0x3a2c7d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ecba93f..1ed1e01 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 _0xf7f3=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x21a6f0,_0x34f377){var _0x394ada=function(_0x523061){while(--_0x523061){_0x21a6f0['push'](_0x21a6f0['shift']());}};_0x394ada(++_0x34f377);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x247611,_0x2df0ec){_0x247611=_0x247611-0x0;var _0x3c42bb=_0xf7f3[_0x247611];return _0x3c42bb;};'use strict';var _=require(_0x3f7f('0x0'));var util=require(_0x3f7f('0x1'));var logger=require(_0x3f7f('0x2'))(_0x3f7f('0x3'));var moment=require(_0x3f7f('0x4'));var BPromise=require(_0x3f7f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f7f('0x6'));var config=require(_0x3f7f('0x7'));var attributes=require('./trigger.attributes');module[_0x3f7f('0x8')]=function(_0x4876e8,_0x2198f7){return _0x4876e8[_0x3f7f('0x9')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9b1=['bluebird','request-promise','path','exports','define','Trigger','tools_triggers','../../config/logger','api','moment'];(function(_0x45a069,_0x19d0b5){var _0x58c780=function(_0x2c9187){while(--_0x2c9187){_0x45a069['push'](_0x45a069['shift']());}};_0x58c780(++_0x19d0b5);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1a9b('0x0'))(_0x1a9b('0x1'));var moment=require(_0x1a9b('0x2'));var BPromise=require(_0x1a9b('0x3'));var rp=require(_0x1a9b('0x4'));var fs=require('fs');var path=require(_0x1a9b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x1a9b('0x6')]=function(_0x15861d,_0x1a78b6){return _0x15861d[_0x1a9b('0x7')](_0x1a9b('0x8'),attributes,{'tableName':_0x1a9b('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 5789709..550c09a 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 _0x21e5=['catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','debug','ShowTrigger','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result'];(function(_0x262d7c,_0x160444){var _0x8d0d7e=function(_0x250373){while(--_0x250373){_0x262d7c['push'](_0x262d7c['shift']());}};_0x8d0d7e(++_0x160444);}(_0x21e5,0x1a5));var _0x521e=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0x21e5[_0x28669c];return _0x4a3af6;};'use strict';var _=require(_0x521e('0x0'));var util=require(_0x521e('0x1'));var moment=require(_0x521e('0x2'));var BPromise=require(_0x521e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x521e('0x4'));var db=require(_0x521e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x521e('0x6'))(_0x521e('0x7'));var config=require(_0x521e('0x8'));var jayson=require(_0x521e('0x9'));var client=jayson[_0x521e('0xa')][_0x521e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x343bc2,_0x336b6f,_0x873fa0){return new BPromise(function(_0x393957,_0x4e9995){return client['request'](_0x343bc2,_0x873fa0)[_0x521e('0xc')](function(_0x48f83a){logger[_0x521e('0xd')](_0x521e('0xe'),_0x336b6f,_0x521e('0xf'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x336b6f,_0x521e('0xf'),JSON[_0x521e('0x10')](_0x48f83a));if(_0x48f83a['error']){if(_0x48f83a['error'][_0x521e('0x11')]===0x1f4){logger['error'](_0x521e('0xe'),_0x336b6f,_0x48f83a['error'][_0x521e('0x12')]);return _0x4e9995(_0x48f83a['error'][_0x521e('0x12')]);}logger[_0x521e('0x13')](_0x521e('0xe'),_0x336b6f,_0x48f83a[_0x521e('0x13')][_0x521e('0x12')]);return _0x393957(_0x48f83a[_0x521e('0x13')][_0x521e('0x12')]);}else{logger[_0x521e('0xd')](_0x521e('0xe'),_0x336b6f,_0x521e('0xf'));_0x393957(_0x48f83a[_0x521e('0x14')]['message']);}})[_0x521e('0x15')](function(_0x76e95d){logger[_0x521e('0x13')]('Trigger,\x20%s,\x20%s',_0x336b6f,_0x76e95d);_0x4e9995(_0x76e95d);});});}exports[_0x521e('0x16')]=function(_0x567a0f){var _0x5a09cf=this;return new Promise(function(_0x495da8,_0x4f591e){return db[_0x521e('0x17')]['findAll']({'raw':_0x567a0f[_0x521e('0x18')]?_0x567a0f[_0x521e('0x18')][_0x521e('0x19')]===undefined?!![]:![]:!![],'where':_0x567a0f['options']?_0x567a0f[_0x521e('0x18')][_0x521e('0x1a')]||null:null,'attributes':_0x567a0f['options']?_0x567a0f[_0x521e('0x18')][_0x521e('0x1b')]||null:null,'limit':_0x567a0f[_0x521e('0x18')]?_0x567a0f[_0x521e('0x18')][_0x521e('0x1c')]||null:null,'include':_0x567a0f['options']?_0x567a0f[_0x521e('0x18')][_0x521e('0x1d')]?_['map'](_0x567a0f[_0x521e('0x18')][_0x521e('0x1d')],function(_0x35f9bf){return{'model':db[_0x35f9bf['model']],'as':_0x35f9bf['as'],'attributes':_0x35f9bf['attributes'],'include':_0x35f9bf[_0x521e('0x1d')]?_[_0x521e('0x1e')](_0x35f9bf[_0x521e('0x1d')],function(_0x52e870){return{'model':db[_0x52e870[_0x521e('0x1f')]],'as':_0x52e870['as'],'attributes':_0x52e870[_0x521e('0x1b')],'include':_0x52e870[_0x521e('0x1d')]?_[_0x521e('0x1e')](_0x52e870['include'],function(_0x4d2b7d){return{'model':db[_0x4d2b7d[_0x521e('0x1f')]],'as':_0x4d2b7d['as'],'attributes':_0x4d2b7d[_0x521e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x521e('0xc')](function(_0x4986af){logger[_0x521e('0xd')]('GetTrigger',_0x567a0f);logger[_0x521e('0x20')](_0x521e('0x16'),_0x567a0f,JSON['stringify'](_0x4986af));_0x495da8(_0x4986af);})[_0x521e('0x15')](function(_0x4acb73){logger[_0x521e('0x13')](_0x521e('0x16'),_0x4acb73['message'],_0x567a0f);_0x4f591e(_0x5a09cf[_0x521e('0x13')](0x1f4,_0x4acb73[_0x521e('0x12')]));});});};exports[_0x521e('0x21')]=function(_0x5e51a4){var _0x6e466d=this;return new Promise(function(_0x38c396,_0x5d3ae1){return db[_0x521e('0x17')]['find']({'raw':_0x5e51a4['options']?_0x5e51a4['options'][_0x521e('0x19')]===undefined?!![]:![]:!![],'where':_0x5e51a4[_0x521e('0x18')]?_0x5e51a4[_0x521e('0x18')][_0x521e('0x1a')]||null:null,'attributes':_0x5e51a4['options']?_0x5e51a4['options'][_0x521e('0x1b')]||null:null,'include':_0x5e51a4['options']?_0x5e51a4[_0x521e('0x18')][_0x521e('0x1d')]?_['map'](_0x5e51a4[_0x521e('0x18')][_0x521e('0x1d')],function(_0x11b732){return{'model':db[_0x11b732[_0x521e('0x1f')]],'as':_0x11b732['as'],'attributes':_0x11b732['attributes'],'include':_0x11b732[_0x521e('0x1d')]?_[_0x521e('0x1e')](_0x11b732['include'],function(_0x282d2c){return{'model':db[_0x282d2c[_0x521e('0x1f')]],'as':_0x282d2c['as'],'attributes':_0x282d2c[_0x521e('0x1b')],'include':_0x282d2c['include']?_['map'](_0x282d2c[_0x521e('0x1d')],function(_0x1888f6){return{'model':db[_0x1888f6['model']],'as':_0x1888f6['as'],'attributes':_0x1888f6['attributes']};}):[]};}):[]};}):[]:[]})[_0x521e('0xc')](function(_0x4d1216){logger[_0x521e('0xd')](_0x521e('0x21'),_0x5e51a4);logger['debug'](_0x521e('0x21'),_0x5e51a4,JSON[_0x521e('0x10')](_0x4d1216));_0x38c396(_0x4d1216);})[_0x521e('0x15')](function(_0x25fe3a){logger[_0x521e('0x13')](_0x521e('0x21'),_0x25fe3a['message'],_0x5e51a4);_0x5d3ae1(_0x6e466d[_0x521e('0x13')](0x1f4,_0x25fe3a[_0x521e('0x12')]));});});}; \ No newline at end of file +var _0x9b96=['options','raw','limit','include','map','model','attributes','stringify','ShowTrigger','Trigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x9b96,0x9e));var _0x69b9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x9b96[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x69b9('0x0'));var util=require(_0x69b9('0x1'));var moment=require(_0x69b9('0x2'));var BPromise=require(_0x69b9('0x3'));var rs=require(_0x69b9('0x4'));var fs=require('fs');var Redis=require(_0x69b9('0x5'));var db=require(_0x69b9('0x6'))['db'];var utils=require(_0x69b9('0x7'));var logger=require(_0x69b9('0x8'))(_0x69b9('0x9'));var config=require(_0x69b9('0xa'));var jayson=require(_0x69b9('0xb'));var client=jayson[_0x69b9('0xc')][_0x69b9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2f5f3d,_0x13382a,_0x2a9549){return new BPromise(function(_0x4411b9,_0x43fe8c){return client[_0x69b9('0xe')](_0x2f5f3d,_0x2a9549)[_0x69b9('0xf')](function(_0x1f889f){logger[_0x69b9('0x10')]('Trigger,\x20%s,\x20%s',_0x13382a,'request\x20sent');logger[_0x69b9('0x11')](_0x69b9('0x12'),_0x13382a,_0x69b9('0x13'),JSON['stringify'](_0x1f889f));if(_0x1f889f[_0x69b9('0x14')]){if(_0x1f889f['error'][_0x69b9('0x15')]===0x1f4){logger[_0x69b9('0x14')](_0x69b9('0x16'),_0x13382a,_0x1f889f[_0x69b9('0x14')][_0x69b9('0x17')]);return _0x43fe8c(_0x1f889f[_0x69b9('0x14')][_0x69b9('0x17')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x13382a,_0x1f889f[_0x69b9('0x14')][_0x69b9('0x17')]);return _0x4411b9(_0x1f889f[_0x69b9('0x14')][_0x69b9('0x17')]);}else{logger['info'](_0x69b9('0x16'),_0x13382a,_0x69b9('0x13'));_0x4411b9(_0x1f889f[_0x69b9('0x18')][_0x69b9('0x17')]);}})[_0x69b9('0x19')](function(_0xfb3c93){logger[_0x69b9('0x14')](_0x69b9('0x16'),_0x13382a,_0xfb3c93);_0x43fe8c(_0xfb3c93);});});}exports[_0x69b9('0x1a')]=function(_0x4f35c9){var _0x540c98=this;return new Promise(function(_0x43a9f6,_0x5f1843){return db['Trigger']['findAll']({'raw':_0x4f35c9[_0x69b9('0x1b')]?_0x4f35c9['options'][_0x69b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f35c9[_0x69b9('0x1b')]?_0x4f35c9[_0x69b9('0x1b')]['where']||null:null,'attributes':_0x4f35c9['options']?_0x4f35c9['options']['attributes']||null:null,'limit':_0x4f35c9[_0x69b9('0x1b')]?_0x4f35c9[_0x69b9('0x1b')][_0x69b9('0x1d')]||null:null,'include':_0x4f35c9[_0x69b9('0x1b')]?_0x4f35c9['options'][_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x4f35c9[_0x69b9('0x1b')]['include'],function(_0x3bb394){return{'model':db[_0x3bb394[_0x69b9('0x20')]],'as':_0x3bb394['as'],'attributes':_0x3bb394['attributes'],'include':_0x3bb394[_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x3bb394[_0x69b9('0x1e')],function(_0x2fb521){return{'model':db[_0x2fb521[_0x69b9('0x20')]],'as':_0x2fb521['as'],'attributes':_0x2fb521['attributes'],'include':_0x2fb521[_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x2fb521['include'],function(_0x154eef){return{'model':db[_0x154eef[_0x69b9('0x20')]],'as':_0x154eef['as'],'attributes':_0x154eef[_0x69b9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x69b9('0xf')](function(_0x350979){logger[_0x69b9('0x10')](_0x69b9('0x1a'),_0x4f35c9);logger['debug'](_0x69b9('0x1a'),_0x4f35c9,JSON[_0x69b9('0x22')](_0x350979));_0x43a9f6(_0x350979);})[_0x69b9('0x19')](function(_0x4c397e){logger[_0x69b9('0x14')]('GetTrigger',_0x4c397e[_0x69b9('0x17')],_0x4f35c9);_0x5f1843(_0x540c98[_0x69b9('0x14')](0x1f4,_0x4c397e['message']));});});};exports[_0x69b9('0x23')]=function(_0x2f66b5){var _0x1f1f97=this;return new Promise(function(_0x4e7bc7,_0x12305c){return db[_0x69b9('0x24')]['find']({'raw':_0x2f66b5[_0x69b9('0x1b')]?_0x2f66b5['options'][_0x69b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f66b5[_0x69b9('0x1b')]?_0x2f66b5[_0x69b9('0x1b')]['where']||null:null,'attributes':_0x2f66b5['options']?_0x2f66b5['options'][_0x69b9('0x21')]||null:null,'include':_0x2f66b5[_0x69b9('0x1b')]?_0x2f66b5['options'][_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x2f66b5[_0x69b9('0x1b')][_0x69b9('0x1e')],function(_0x226218){return{'model':db[_0x226218[_0x69b9('0x20')]],'as':_0x226218['as'],'attributes':_0x226218['attributes'],'include':_0x226218[_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x226218['include'],function(_0x47c787){return{'model':db[_0x47c787[_0x69b9('0x20')]],'as':_0x47c787['as'],'attributes':_0x47c787[_0x69b9('0x21')],'include':_0x47c787[_0x69b9('0x1e')]?_['map'](_0x47c787['include'],function(_0x11709f){return{'model':db[_0x11709f[_0x69b9('0x20')]],'as':_0x11709f['as'],'attributes':_0x11709f[_0x69b9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x69b9('0xf')](function(_0x4963e4){logger[_0x69b9('0x10')]('ShowTrigger',_0x2f66b5);logger[_0x69b9('0x11')](_0x69b9('0x23'),_0x2f66b5,JSON['stringify'](_0x4963e4));_0x4e7bc7(_0x4963e4);})[_0x69b9('0x19')](function(_0x146554){logger['error'](_0x69b9('0x23'),_0x146554[_0x69b9('0x17')],_0x2f66b5);_0x12305c(_0x1f1f97[_0x69b9('0x14')](0x1f4,_0x146554[_0x69b9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 73428f4..f9b0e48 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 _0x09e6=['index','get','post','/:id/clone','create','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x09e6,0xb4));var _0x609e=function(_0x42f623,_0x3e37fb){_0x42f623=_0x42f623-0x0;var _0x57bc9e=_0x09e6[_0x42f623];return _0x57bc9e;};'use strict';var multer=require(_0x609e('0x0'));var util=require('util');var path=require(_0x609e('0x1'));var timeout=require(_0x609e('0x2'));var express=require(_0x609e('0x3'));var router=express[_0x609e('0x4')]();var fs_extra=require(_0x609e('0x5'));var auth=require(_0x609e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x609e('0x7'));var controller=require(_0x609e('0x8'));router['get']('/',auth[_0x609e('0x9')](),controller[_0x609e('0xa')]);router[_0x609e('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x609e('0xc')](_0x609e('0xd'),auth['isAuthenticated'](),controller['clone']);router['post']('/',auth[_0x609e('0x9')](),controller[_0x609e('0xe')]);router['put'](_0x609e('0xf'),auth['isAuthenticated'](),controller[_0x609e('0x10')]);router[_0x609e('0x11')]('/:id',auth[_0x609e('0x9')](),controller['destroy']);module[_0x609e('0x12')]=router; \ No newline at end of file +var _0xb006=['get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58e32c,_0x309781){var _0x481e60=function(_0x5326ab){while(--_0x5326ab){_0x58e32c['push'](_0x58e32c['shift']());}};_0x481e60(++_0x309781);}(_0xb006,0x184));var _0x6b00=function(_0x14af87,_0x149ac3){_0x14af87=_0x14af87-0x0;var _0x4ff770=_0xb006[_0x14af87];return _0x4ff770;};'use strict';var multer=require(_0x6b00('0x0'));var util=require('util');var path=require(_0x6b00('0x1'));var timeout=require(_0x6b00('0x2'));var express=require(_0x6b00('0x3'));var router=express['Router']();var fs_extra=require(_0x6b00('0x4'));var auth=require(_0x6b00('0x5'));var interaction=require(_0x6b00('0x6'));var config=require(_0x6b00('0x7'));var controller=require('./trunk.controller');router[_0x6b00('0x8')]('/',auth[_0x6b00('0x9')](),controller[_0x6b00('0xa')]);router[_0x6b00('0x8')](_0x6b00('0xb'),auth[_0x6b00('0x9')](),controller['show']);router[_0x6b00('0xc')]('/:id/clone',auth[_0x6b00('0x9')](),controller['clone']);router[_0x6b00('0xc')]('/',auth[_0x6b00('0x9')](),controller[_0x6b00('0xd')]);router['put'](_0x6b00('0xb'),auth[_0x6b00('0x9')](),controller[_0x6b00('0xe')]);router[_0x6b00('0xf')](_0x6b00('0xb'),auth[_0x6b00('0x9')](),controller[_0x6b00('0x10')]);module[_0x6b00('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c7d1b15..cfc09f6 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 _0x9a58=['\x22\x22\x20<>','always','refuse','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER'];(function(_0x4f8acd,_0xf09cf4){var _0x5ddf80=function(_0x52e33f){while(--_0x52e33f){_0x4f8acd['push'](_0x4f8acd['shift']());}};_0x5ddf80(++_0xf09cf4);}(_0x9a58,0xde));var _0x89a5=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x9a58[_0x3c6dce];return _0x1450e9;};'use strict';var Sequelize=require(_0x89a5('0x0'));module[_0x89a5('0x1')]={'name':{'type':Sequelize[_0x89a5('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x89a5('0x3'),_0x89a5('0x4'),_0x89a5('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x89a5('0x2')],'allowNull':![],'defaultValue':_0x89a5('0x6')},'callingpres':{'type':Sequelize[_0x89a5('0x7')]('ALLOWED_NOT_SCREENED',_0x89a5('0x8'),'ALLOWED_FAILED_SCREEN',_0x89a5('0x9'),_0x89a5('0xa'),_0x89a5('0xb'),_0x89a5('0xc'),_0x89a5('0xd'))},'deny':{'type':Sequelize[_0x89a5('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x89a5('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x89a5('0xe'),'set':function(_0x951c4e){this[_0x89a5('0xf')]('transport',_0x951c4e?_0x951c4e['join'](','):null);},'get':function(){return this[_0x89a5('0x10')](_0x89a5('0x11'))?this[_0x89a5('0x10')](_0x89a5('0x11'))[_0x89a5('0x12')](','):null;},'comment':_0x89a5('0x13')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x89a5('0x14'),_0x89a5('0x15'),'inband',_0x89a5('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no',_0x89a5('0x18'),'update',_0x89a5('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x89a5('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x89a5('0x2')]},'directmediadeny':{'type':Sequelize[_0x89a5('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x89a5('0x1a'),'set':function(_0x181641){this[_0x89a5('0xf')](_0x89a5('0x1b'),_0x181641?_0x181641[_0x89a5('0x1c')](','):null);},'get':function(){return this['getDataValue'](_0x89a5('0x1b'))?this['getDataValue'](_0x89a5('0x1b'))['split'](','):null;},'comment':_0x89a5('0x1d')},'callgroup':{'type':Sequelize[_0x89a5('0x2')]},'namedcallgroup':{'type':Sequelize[_0x89a5('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x89a5('0x2')]},'language':{'type':Sequelize[_0x89a5('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x89a5('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x89a5('0x2')],'defaultValue':_0x89a5('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x89a5('0x1f'),'set':function(_0x39b52d){this[_0x89a5('0xf')](_0x89a5('0x20'),_0x39b52d?_0x39b52d['join'](';'):_0x89a5('0x1f'));},'get':function(){return this[_0x89a5('0x10')](_0x89a5('0x20'))?this['getDataValue']('allow')[_0x89a5('0x12')](';'):null;},'comment':_0x89a5('0x21')},'autoframing':{'type':Sequelize[_0x89a5('0x7')]('yes','no')},'insecure':{'type':Sequelize[_0x89a5('0x2')],'defaultValue':'port,invite','set':function(_0x30438c){this['setDataValue'](_0x89a5('0x22'),_0x30438c?_0x30438c[_0x89a5('0x1c')](','):null);},'get':function(){return this[_0x89a5('0x10')](_0x89a5('0x22'))?this[_0x89a5('0x10')](_0x89a5('0x22'))[_0x89a5('0x12')](','):null;},'comment':_0x89a5('0x23')},'trustrpid':{'type':Sequelize[_0x89a5('0x7')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x89a5('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no',_0x89a5('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0x89a5('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no')},'accountcode':{'type':Sequelize[_0x89a5('0x25')](0xb)},'setvar':{'type':Sequelize[_0x89a5('0x2')]},'callerid':{'type':Sequelize[_0x89a5('0x2')],'defaultValue':_0x89a5('0x26')},'amaflags':{'type':Sequelize[_0x89a5('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x89a5('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x89a5('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x89a5('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x89a5('0x7')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x89a5('0x2')]},'template':{'type':Sequelize[_0x89a5('0x2')]},'videosupport':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no',_0x89a5('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x89a5('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no')},'mailbox':{'type':Sequelize[_0x89a5('0x2')]},'session_timers':{'type':Sequelize[_0x89a5('0x7')]('accept',_0x89a5('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x89a5('0x25')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x29'),_0x89a5('0x2a')),'defaultValue':_0x89a5('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x89a5('0x2')]},'fromdomain':{'type':Sequelize[_0x89a5('0x2')]},'fromuser':{'type':Sequelize[_0x89a5('0x2')]},'port':{'type':Sequelize[_0x89a5('0x25')](0x5)},'qualify':{'type':Sequelize[_0x89a5('0x7')]('yes','no'),'defaultValue':_0x89a5('0x17')},'keepalive':{'type':Sequelize[_0x89a5('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x89a5('0x2')]},'defaultuser':{'type':Sequelize[_0x89a5('0x2')]},'rtptimeout':{'type':Sequelize[_0x89a5('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x89a5('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no',_0x89a5('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x89a5('0x2')]},'callbackextension':{'type':Sequelize[_0x89a5('0x2')]},'timert1':{'type':Sequelize[_0x89a5('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x89a5('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x89a5('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x89a5('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x89a5('0x25')](0xb)},'encryption':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x89a5('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x89a5('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x89a5('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x89a5('0x17'),'no',_0x89a5('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x89a5('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x89a5('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x89a5('0x2')]},'dtlscipher':{'type':Sequelize[_0x89a5('0x2')]},'dtlscafile':{'type':Sequelize[_0x89a5('0x2')]},'dtlscapath':{'type':Sequelize[_0x89a5('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x89a5('0x2d'),_0x89a5('0x2e'),_0x89a5('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x89a5('0x2')]},'usereqphone':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x89a5('0x2')]},'recordofffeature':{'type':Sequelize[_0x89a5('0x2')]},'call_limit':{'type':Sequelize[_0x89a5('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x89a5('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x89a5('0x17'),'no')},'vmexten':{'type':Sequelize[_0x89a5('0x2')]},'mohinterpret':{'type':Sequelize[_0x89a5('0x2')]},'mohsuggest':{'type':Sequelize[_0x89a5('0x2')]},'parkinglot':{'type':Sequelize[_0x89a5('0x2')]},'description':{'type':Sequelize[_0x89a5('0x2')]},'host':{'type':Sequelize[_0x89a5('0x2')],'defaultValue':_0x89a5('0x30')},'canreinvite':{'type':Sequelize[_0x89a5('0x7')](_0x89a5('0x17'),'no','nonat',_0x89a5('0x31'),_0x89a5('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x89a5('0x2')]},'otherFields':{'type':Sequelize[_0x89a5('0x2')]},'active':{'type':Sequelize[_0x89a5('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xda8a=['setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','update','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xda8a,0x17b));var _0xada8=function(_0x3b8021,_0x1c9435){_0x3b8021=_0x3b8021-0x0;var _0x285028=_0xda8a[_0x3b8021];return _0x285028;};'use strict';var Sequelize=require('sequelize');module[_0xada8('0x0')]={'name':{'type':Sequelize[_0xada8('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x3'),_0xada8('0x4'),_0xada8('0x5')),'allowNull':![],'defaultValue':_0xada8('0x3')},'context':{'type':Sequelize[_0xada8('0x1')],'allowNull':![],'defaultValue':_0xada8('0x6')},'callingpres':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x7'),_0xada8('0x8'),'ALLOWED_FAILED_SCREEN',_0xada8('0x9'),_0xada8('0xa'),_0xada8('0xb'),'PROHIB_FAILED_SCREEN',_0xada8('0xc'))},'deny':{'type':Sequelize[_0xada8('0x1')]},'permit':{'type':Sequelize[_0xada8('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xada8('0x1')]},'remotesecret':{'type':Sequelize[_0xada8('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x5376bc){this[_0xada8('0xd')](_0xada8('0xe'),_0x5376bc?_0x5376bc[_0xada8('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xada8('0xe'))?this[_0xada8('0x10')]('transport')[_0xada8('0x11')](','):null;},'comment':_0xada8('0x12')},'dtmfmode':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x13'),_0xada8('0x14'),_0xada8('0x15'),_0xada8('0x16'),_0xada8('0x17')),'defaultValue':_0xada8('0x13')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xada8('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xada8('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xada8('0x1')]},'directmediadeny':{'type':Sequelize[_0xada8('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x144a2a){this[_0xada8('0xd')](_0xada8('0x1a'),_0x144a2a?_0x144a2a[_0xada8('0xf')](','):null);},'get':function(){return this[_0xada8('0x10')](_0xada8('0x1a'))?this[_0xada8('0x10')](_0xada8('0x1a'))[_0xada8('0x11')](','):null;},'comment':_0xada8('0x1b')},'callgroup':{'type':Sequelize[_0xada8('0x1')]},'namedcallgroup':{'type':Sequelize[_0xada8('0x1')]},'pickupgroup':{'type':Sequelize[_0xada8('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xada8('0x1')]},'language':{'type':Sequelize[_0xada8('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xada8('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2329f6){this[_0xada8('0xd')](_0xada8('0x1c'),_0x2329f6?_0x2329f6[_0xada8('0xf')](';'):_0xada8('0x1d'));},'get':function(){return this[_0xada8('0x10')]('allow')?this[_0xada8('0x10')]('allow')['split'](';'):null;},'comment':_0xada8('0x1e')},'autoframing':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'insecure':{'type':Sequelize[_0xada8('0x1')],'defaultValue':_0xada8('0x1f'),'set':function(_0x11fa11){this[_0xada8('0xd')](_0xada8('0x20'),_0x11fa11?_0x11fa11[_0xada8('0xf')](','):null);},'get':function(){return this[_0xada8('0x10')]('insecure')?this[_0xada8('0x10')](_0xada8('0x20'))['split'](','):null;},'comment':_0xada8('0x21')},'trustrpid':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xada8('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xada8('0x19'),'no',_0xada8('0x22'))},'promiscredir':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0xada8('0x23')](0xb)},'setvar':{'type':Sequelize[_0xada8('0x1')]},'callerid':{'type':Sequelize[_0xada8('0x1')],'defaultValue':_0xada8('0x24')},'amaflags':{'type':Sequelize[_0xada8('0x1')]},'callcounter':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no'),'defaultValue':_0xada8('0x19')},'busylevel':{'type':Sequelize[_0xada8('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xada8('0x1')]},'template':{'type':Sequelize[_0xada8('0x1')]},'videosupport':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no',_0xada8('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xada8('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'mailbox':{'type':Sequelize[_0xada8('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xada8('0x26'),_0xada8('0x27'))},'session_expires':{'type':Sequelize[_0xada8('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x28'),_0xada8('0x29')),'defaultValue':_0xada8('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xada8('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xada8('0x1')]},'port':{'type':Sequelize[_0xada8('0x23')](0x5)},'qualify':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no'),'defaultValue':_0xada8('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xada8('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xada8('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xada8('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xada8('0x1')]},'callbackextension':{'type':Sequelize[_0xada8('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xada8('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xada8('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xada8('0x1')]},'contactdeny':{'type':Sequelize[_0xada8('0x1')]},'contactacl':{'type':Sequelize[_0xada8('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xada8('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xada8('0x23')](0xb)},'encryption':{'type':Sequelize[_0xada8('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no','fingerprint',_0xada8('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xada8('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xada8('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xada8('0x1')]},'dtlscapath':{'type':Sequelize[_0xada8('0x1')]},'dtlssetup':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x2b'),_0xada8('0x2c'),_0xada8('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xada8('0x1')]},'usereqphone':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xada8('0x1')]},'recordofffeature':{'type':Sequelize[_0xada8('0x1')]},'call_limit':{'type':Sequelize[_0xada8('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xada8('0x1')]},'mohsuggest':{'type':Sequelize[_0xada8('0x1')]},'parkinglot':{'type':Sequelize[_0xada8('0x1')]},'description':{'type':Sequelize[_0xada8('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xada8('0x2e')},'canreinvite':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no','nonat',_0xada8('0x18'),_0xada8('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xada8('0x1')]},'otherFields':{'type':Sequelize[_0xada8('0x1')]},'active':{'type':Sequelize[_0xada8('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xada8('0x1')],'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 68db3de..a191cd2 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 _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0x122974,_0x111030){var _0x236b4b=function(_0x260de7){while(--_0x260de7){_0x122974['push'](_0x122974['shift']());}};_0x236b4b(++_0x111030);}(_0xa41a,0x6b));var _0xaa41=function(_0x262ac4,_0x2c337e){_0x262ac4=_0x262ac4-0x0;var _0x42debb=_0xa41a[_0x262ac4];return _0x42debb;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file +var _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','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','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x285b20,_0x16d411){var _0x2451b0=function(_0x387194){while(--_0x387194){_0x285b20['push'](_0x285b20['shift']());}};_0x2451b0(++_0x16d411);}(_0x6aa7,0x178));var _0x76aa=function(_0x19e57f,_0x400ae9){_0x19e57f=_0x19e57f-0x0;var _0x5046a1=_0x6aa7[_0x19e57f];return _0x5046a1;};'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'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index faeeed6..41c38c6 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 _0x2d24=['moment','bluebird','path','rimraf','../../config/environment','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger'];(function(_0x5270f1,_0x566ef4){var _0x2c360b=function(_0x13684f){while(--_0x13684f){_0x5270f1['push'](_0x5270f1['shift']());}};_0x2c360b(++_0x566ef4);}(_0x2d24,0x81));var _0x42d2=function(_0x52033e,_0x19dcac){_0x52033e=_0x52033e-0x0;var _0x561278=_0x2d24[_0x52033e];return _0x561278;};'use strict';var _=require(_0x42d2('0x0'));var util=require(_0x42d2('0x1'));var logger=require(_0x42d2('0x2'))('api');var moment=require(_0x42d2('0x3'));var BPromise=require(_0x42d2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42d2('0x5'));var rimraf=require(_0x42d2('0x6'));var config=require(_0x42d2('0x7'));var attributes=require('./trunk.attributes');module[_0x42d2('0x8')]=function(_0x4966ab,_0x489b50){return _0x4966ab[_0x42d2('0x9')](_0x42d2('0xa'),attributes,{'tableName':_0x42d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x542a=['Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./trunk.attributes'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x542a,0x162));var _0xa542=function(_0x506df8,_0x3498da){_0x506df8=_0x506df8-0x0;var _0x54aa08=_0x542a[_0x506df8];return _0x54aa08;};'use strict';var _=require(_0xa542('0x0'));var util=require(_0xa542('0x1'));var logger=require(_0xa542('0x2'))(_0xa542('0x3'));var moment=require(_0xa542('0x4'));var BPromise=require(_0xa542('0x5'));var rp=require(_0xa542('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa542('0x7'));var config=require('../../config/environment');var attributes=require(_0xa542('0x8'));module['exports']=function(_0x111b54,_0x324118){return _0x111b54['define'](_0xa542('0x9'),attributes,{'tableName':_0xa542('0xa'),'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 35beeb2..88a289d 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 _0x96f2=['Trunk','options','raw','where','attributes','include','model','map','find','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x96f2,0x168));var _0x296f=function(_0x1e057b,_0x4a8660){_0x1e057b=_0x1e057b-0x0;var _0x28c8bf=_0x96f2[_0x1e057b];return _0x28c8bf;};'use strict';var _=require(_0x296f('0x0'));var util=require(_0x296f('0x1'));var moment=require(_0x296f('0x2'));var BPromise=require(_0x296f('0x3'));var rs=require(_0x296f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x296f('0x5'))['db'];var utils=require(_0x296f('0x6'));var logger=require('../../config/logger')(_0x296f('0x7'));var config=require(_0x296f('0x8'));var jayson=require(_0x296f('0x9'));var client=jayson[_0x296f('0xa')][_0x296f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e86ff,_0x25b423,_0xcf438a){return new BPromise(function(_0x592a8b,_0x5f0763){return client['request'](_0x2e86ff,_0xcf438a)[_0x296f('0xc')](function(_0x158972){logger[_0x296f('0xd')]('Trunk,\x20%s,\x20%s',_0x25b423,'request\x20sent');logger[_0x296f('0xe')](_0x296f('0xf'),_0x25b423,_0x296f('0x10'),JSON[_0x296f('0x11')](_0x158972));if(_0x158972[_0x296f('0x12')]){if(_0x158972[_0x296f('0x12')][_0x296f('0x13')]===0x1f4){logger[_0x296f('0x12')](_0x296f('0x14'),_0x25b423,_0x158972[_0x296f('0x12')]['message']);return _0x5f0763(_0x158972[_0x296f('0x12')][_0x296f('0x15')]);}logger[_0x296f('0x12')]('Trunk,\x20%s,\x20%s',_0x25b423,_0x158972[_0x296f('0x12')][_0x296f('0x15')]);return _0x592a8b(_0x158972[_0x296f('0x12')][_0x296f('0x15')]);}else{logger[_0x296f('0xd')]('Trunk,\x20%s,\x20%s',_0x25b423,_0x296f('0x10'));_0x592a8b(_0x158972[_0x296f('0x16')]['message']);}})[_0x296f('0x17')](function(_0x5889a3){logger[_0x296f('0x12')](_0x296f('0x14'),_0x25b423,_0x5889a3);_0x5f0763(_0x5889a3);});});}exports[_0x296f('0x18')]=function(_0x5c4d28){var _0x1b5aeb=this;return new Promise(function(_0x46b1e0,_0x4b1b05){return db[_0x296f('0x19')]['findAll']({'raw':_0x5c4d28[_0x296f('0x1a')]?_0x5c4d28[_0x296f('0x1a')][_0x296f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c4d28['options']?_0x5c4d28[_0x296f('0x1a')][_0x296f('0x1c')]||null:null,'attributes':_0x5c4d28['options']?_0x5c4d28[_0x296f('0x1a')][_0x296f('0x1d')]||null:null,'limit':_0x5c4d28[_0x296f('0x1a')]?_0x5c4d28[_0x296f('0x1a')]['limit']||null:null,'include':_0x5c4d28[_0x296f('0x1a')]?_0x5c4d28[_0x296f('0x1a')]['include']?_['map'](_0x5c4d28['options'][_0x296f('0x1e')],function(_0x17dde8){return{'model':db[_0x17dde8[_0x296f('0x1f')]],'as':_0x17dde8['as'],'attributes':_0x17dde8['attributes'],'include':_0x17dde8[_0x296f('0x1e')]?_[_0x296f('0x20')](_0x17dde8[_0x296f('0x1e')],function(_0x52831e){return{'model':db[_0x52831e[_0x296f('0x1f')]],'as':_0x52831e['as'],'attributes':_0x52831e['attributes'],'include':_0x52831e[_0x296f('0x1e')]?_['map'](_0x52831e[_0x296f('0x1e')],function(_0x13f394){return{'model':db[_0x13f394[_0x296f('0x1f')]],'as':_0x13f394['as'],'attributes':_0x13f394[_0x296f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57d593){logger[_0x296f('0xd')]('GetTrunk',_0x5c4d28);logger[_0x296f('0xe')](_0x296f('0x18'),_0x5c4d28,JSON[_0x296f('0x11')](_0x57d593));_0x46b1e0(_0x57d593);})[_0x296f('0x17')](function(_0x4c9d85){logger['error'](_0x296f('0x18'),_0x4c9d85['message'],_0x5c4d28);_0x4b1b05(_0x1b5aeb[_0x296f('0x12')](0x1f4,_0x4c9d85['message']));});});};exports['ShowTrunk']=function(_0x1e967a){var _0x3b1052=this;return new Promise(function(_0x1e31ab,_0x367095){return db[_0x296f('0x19')][_0x296f('0x21')]({'raw':_0x1e967a[_0x296f('0x1a')]?_0x1e967a[_0x296f('0x1a')][_0x296f('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e967a['options']?_0x1e967a[_0x296f('0x1a')][_0x296f('0x1c')]||null:null,'attributes':_0x1e967a[_0x296f('0x1a')]?_0x1e967a[_0x296f('0x1a')][_0x296f('0x1d')]||null:null,'include':_0x1e967a[_0x296f('0x1a')]?_0x1e967a[_0x296f('0x1a')][_0x296f('0x1e')]?_[_0x296f('0x20')](_0x1e967a[_0x296f('0x1a')][_0x296f('0x1e')],function(_0x5b53ae){return{'model':db[_0x5b53ae[_0x296f('0x1f')]],'as':_0x5b53ae['as'],'attributes':_0x5b53ae['attributes'],'include':_0x5b53ae['include']?_[_0x296f('0x20')](_0x5b53ae[_0x296f('0x1e')],function(_0x42bba3){return{'model':db[_0x42bba3[_0x296f('0x1f')]],'as':_0x42bba3['as'],'attributes':_0x42bba3[_0x296f('0x1d')],'include':_0x42bba3[_0x296f('0x1e')]?_[_0x296f('0x20')](_0x42bba3[_0x296f('0x1e')],function(_0x2456d3){return{'model':db[_0x2456d3['model']],'as':_0x2456d3['as'],'attributes':_0x2456d3[_0x296f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x296f('0xc')](function(_0x17c277){logger[_0x296f('0xd')]('ShowTrunk',_0x1e967a);logger[_0x296f('0xe')](_0x296f('0x22'),_0x1e967a,JSON[_0x296f('0x11')](_0x17c277));_0x1e31ab(_0x17c277);})['catch'](function(_0x3c7d9e){logger[_0x296f('0x12')](_0x296f('0x22'),_0x3c7d9e[_0x296f('0x15')],_0x1e967a);_0x367095(_0x3b1052[_0x296f('0x12')](0x1f4,_0x3c7d9e[_0x296f('0x15')]));});});}; \ No newline at end of file +var _0x0218=['limit','include','map','model','then','debug','stringify','ShowTrunk','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrunk','Trunk','findAll','raw','options','where','attributes'];(function(_0x25c4b5,_0x1fc4bd){var _0x3ce832=function(_0x338a7d){while(--_0x338a7d){_0x25c4b5['push'](_0x25c4b5['shift']());}};_0x3ce832(++_0x1fc4bd);}(_0x0218,0xe7));var _0x8021=function(_0xe8554f,_0x4d11de){_0xe8554f=_0xe8554f-0x0;var _0x45c795=_0x0218[_0xe8554f];return _0x45c795;};'use strict';var _=require(_0x8021('0x0'));var util=require(_0x8021('0x1'));var moment=require(_0x8021('0x2'));var BPromise=require('bluebird');var rs=require(_0x8021('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8021('0x4'))['db'];var utils=require(_0x8021('0x5'));var logger=require(_0x8021('0x6'))(_0x8021('0x7'));var config=require(_0x8021('0x8'));var jayson=require(_0x8021('0x9'));var client=jayson[_0x8021('0xa')][_0x8021('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdf2d6,_0x21efcd,_0x43d4c9){return new BPromise(function(_0x4755f0,_0x46e194){return client['request'](_0xdf2d6,_0x43d4c9)['then'](function(_0x3e3b6e){logger[_0x8021('0xc')](_0x8021('0xd'),_0x21efcd,_0x8021('0xe'));logger['debug'](_0x8021('0xf'),_0x21efcd,'request\x20sent',JSON['stringify'](_0x3e3b6e));if(_0x3e3b6e['error']){if(_0x3e3b6e[_0x8021('0x10')][_0x8021('0x11')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x21efcd,_0x3e3b6e['error'][_0x8021('0x12')]);return _0x46e194(_0x3e3b6e[_0x8021('0x10')][_0x8021('0x12')]);}logger[_0x8021('0x10')](_0x8021('0xd'),_0x21efcd,_0x3e3b6e['error'][_0x8021('0x12')]);return _0x4755f0(_0x3e3b6e[_0x8021('0x10')][_0x8021('0x12')]);}else{logger[_0x8021('0xc')](_0x8021('0xd'),_0x21efcd,_0x8021('0xe'));_0x4755f0(_0x3e3b6e[_0x8021('0x13')]['message']);}})[_0x8021('0x14')](function(_0xcf539b){logger[_0x8021('0x10')](_0x8021('0xd'),_0x21efcd,_0xcf539b);_0x46e194(_0xcf539b);});});}exports[_0x8021('0x15')]=function(_0x8dbbdc){var _0x528418=this;return new Promise(function(_0x33cdab,_0x43d814){return db[_0x8021('0x16')][_0x8021('0x17')]({'raw':_0x8dbbdc['options']?_0x8dbbdc['options'][_0x8021('0x18')]===undefined?!![]:![]:!![],'where':_0x8dbbdc[_0x8021('0x19')]?_0x8dbbdc[_0x8021('0x19')][_0x8021('0x1a')]||null:null,'attributes':_0x8dbbdc[_0x8021('0x19')]?_0x8dbbdc[_0x8021('0x19')][_0x8021('0x1b')]||null:null,'limit':_0x8dbbdc[_0x8021('0x19')]?_0x8dbbdc[_0x8021('0x19')][_0x8021('0x1c')]||null:null,'include':_0x8dbbdc['options']?_0x8dbbdc[_0x8021('0x19')]['include']?_['map'](_0x8dbbdc[_0x8021('0x19')][_0x8021('0x1d')],function(_0x38250e){return{'model':db[_0x38250e['model']],'as':_0x38250e['as'],'attributes':_0x38250e[_0x8021('0x1b')],'include':_0x38250e[_0x8021('0x1d')]?_[_0x8021('0x1e')](_0x38250e[_0x8021('0x1d')],function(_0x468b0d){return{'model':db[_0x468b0d[_0x8021('0x1f')]],'as':_0x468b0d['as'],'attributes':_0x468b0d['attributes'],'include':_0x468b0d[_0x8021('0x1d')]?_[_0x8021('0x1e')](_0x468b0d[_0x8021('0x1d')],function(_0xff2397){return{'model':db[_0xff2397[_0x8021('0x1f')]],'as':_0xff2397['as'],'attributes':_0xff2397[_0x8021('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8021('0x20')](function(_0x4ee308){logger[_0x8021('0xc')](_0x8021('0x15'),_0x8dbbdc);logger[_0x8021('0x21')](_0x8021('0x15'),_0x8dbbdc,JSON[_0x8021('0x22')](_0x4ee308));_0x33cdab(_0x4ee308);})[_0x8021('0x14')](function(_0x239623){logger[_0x8021('0x10')](_0x8021('0x15'),_0x239623[_0x8021('0x12')],_0x8dbbdc);_0x43d814(_0x528418[_0x8021('0x10')](0x1f4,_0x239623[_0x8021('0x12')]));});});};exports[_0x8021('0x23')]=function(_0xb07aea){var _0x5671fc=this;return new Promise(function(_0x40125a,_0x18951e){return db[_0x8021('0x16')][_0x8021('0x24')]({'raw':_0xb07aea[_0x8021('0x19')]?_0xb07aea['options']['raw']===undefined?!![]:![]:!![],'where':_0xb07aea[_0x8021('0x19')]?_0xb07aea[_0x8021('0x19')][_0x8021('0x1a')]||null:null,'attributes':_0xb07aea[_0x8021('0x19')]?_0xb07aea[_0x8021('0x19')][_0x8021('0x1b')]||null:null,'include':_0xb07aea[_0x8021('0x19')]?_0xb07aea[_0x8021('0x19')][_0x8021('0x1d')]?_[_0x8021('0x1e')](_0xb07aea[_0x8021('0x19')]['include'],function(_0x201551){return{'model':db[_0x201551[_0x8021('0x1f')]],'as':_0x201551['as'],'attributes':_0x201551[_0x8021('0x1b')],'include':_0x201551[_0x8021('0x1d')]?_['map'](_0x201551[_0x8021('0x1d')],function(_0xeedc1){return{'model':db[_0xeedc1[_0x8021('0x1f')]],'as':_0xeedc1['as'],'attributes':_0xeedc1[_0x8021('0x1b')],'include':_0xeedc1[_0x8021('0x1d')]?_['map'](_0xeedc1[_0x8021('0x1d')],function(_0x5a4c92){return{'model':db[_0x5a4c92['model']],'as':_0x5a4c92['as'],'attributes':_0x5a4c92[_0x8021('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8021('0x20')](function(_0x473ff6){logger['info'](_0x8021('0x23'),_0xb07aea);logger[_0x8021('0x21')](_0x8021('0x23'),_0xb07aea,JSON[_0x8021('0x22')](_0x473ff6));_0x40125a(_0x473ff6);})[_0x8021('0x14')](function(_0x1c4edf){logger[_0x8021('0x10')](_0x8021('0x23'),_0x1c4edf[_0x8021('0x12')],_0xb07aea);_0x18951e(_0x5671fc[_0x8021('0x10')](0x1f4,_0x1c4edf[_0x8021('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index c7d63b5..a3fcace 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7c3=['update','exports','express','Router','../../components/auth/service','put','/:id','isAuthenticated'];(function(_0x4b1f40,_0x5d2a33){var _0xf5cdcc=function(_0x383b64){while(--_0x383b64){_0x4b1f40['push'](_0x4b1f40['shift']());}};_0xf5cdcc(++_0x5d2a33);}(_0xb7c3,0xaa));var _0x3b7c=function(_0x12e87f,_0x2fa71e){_0x12e87f=_0x12e87f-0x0;var _0x4e0f51=_0xb7c3[_0x12e87f];return _0x4e0f51;};'use strict';var express=require(_0x3b7c('0x0'));var router=express[_0x3b7c('0x1')]();var auth=require(_0x3b7c('0x2'));var controller=require('./user-setting.controller');router[_0x3b7c('0x3')](_0x3b7c('0x4'),auth[_0x3b7c('0x5')](),controller[_0x3b7c('0x6')]);module[_0x3b7c('0x7')]=router; \ No newline at end of file +var _0x2a4b=['/:id','isAuthenticated','update','exports','express','Router'];(function(_0x20a57e,_0x3fa17a){var _0x1dc70e=function(_0xfac388){while(--_0xfac388){_0x20a57e['push'](_0x20a57e['shift']());}};_0x1dc70e(++_0x3fa17a);}(_0x2a4b,0x94));var _0xb2a4=function(_0x3e12d9,_0x499f5b){_0x3e12d9=_0x3e12d9-0x0;var _0x114fc5=_0x2a4b[_0x3e12d9];return _0x114fc5;};'use strict';var express=require(_0xb2a4('0x0'));var router=express[_0xb2a4('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router['put'](_0xb2a4('0x2'),auth[_0xb2a4('0x3')](),controller[_0xb2a4('0x4')]);module[_0xb2a4('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 01d5b31..9f80340 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5abf=['BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','info','debug','exports','ENUM'];(function(_0x2c1f58,_0x3d21ef){var _0x19ef5c=function(_0x320890){while(--_0x320890){_0x2c1f58['push'](_0x2c1f58['shift']());}};_0x19ef5c(++_0x3d21ef);}(_0x5abf,0x73));var _0xf5ab=function(_0x131585,_0x1abd33){_0x131585=_0x131585-0x0;var _0x1fcca2=_0x5abf[_0x131585];return _0x1fcca2;};'use strict';var Sequelize=require(_0xf5ab('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xf5ab('0x1'),'warning',_0xf5ab('0x2'),_0xf5ab('0x3')];module[_0xf5ab('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xf5ab('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xf5ab('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xf5ab('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf5ab('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xf5ab('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf5ab('0x9')],'unique':_0xf5ab('0xa')}}; \ No newline at end of file +var _0x21c4=['UserId','warning','info','debug','ENUM','BOOLEAN','TEXT','INTEGER'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x21c4,0xd9));var _0x421c=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0x21c4[_0x478c8a];return _0x3b6b3e;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x421c('0x0'),_0x421c('0x1'),_0x421c('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x421c('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x421c('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x421c('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x421c('0x6')],'unique':_0x421c('0x7')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 2598183..e118579 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a34=['api','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','json','update','then','sendStatus','error','name','send','user','role','admin','UserSetting','find','params','body','catch','lodash','ioredis'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x0a34,0x12a));var _0x40a3=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x0a34[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x40a3('0x0'));var Redis=require(_0x40a3('0x1'));var logger=require('../../config/logger')(_0x40a3('0x2'));var config=require(_0x40a3('0x3'));var db=require(_0x40a3('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x40a3('0x5')]));require(_0x40a3('0x6'))[_0x40a3('0x7')](socket);config['redis']=_[_0x40a3('0x8')](config[_0x40a3('0x5')],{'host':_0x40a3('0x9'),'port':0x18eb});function respondWithResult(_0x394f67,_0x655437){_0x655437=_0x655437||0xc8;return function(_0x3bf1de){if(_0x3bf1de){return _0x394f67['status'](_0x655437)[_0x40a3('0xa')](_0x3bf1de);}};}function saveUpdates(_0x2c938c){return function(_0x258101){if(_0x258101){return _0x258101[_0x40a3('0xb')](_0x2c938c)[_0x40a3('0xc')](function(_0x2edb15){return _0x2edb15;});}return null;};}function handleEntityNotFound(_0x4f3c10){return function(_0x643d61){if(!_0x643d61){_0x4f3c10[_0x40a3('0xd')](0x194);}return _0x643d61;};}function handleError(_0x261080,_0x52adb2){_0x52adb2=_0x52adb2||0x1f4;return function(_0x1ee5f8){logger[_0x40a3('0xe')](_0x1ee5f8['stack']);if(_0x1ee5f8[_0x40a3('0xf')]){delete _0x1ee5f8[_0x40a3('0xf')];}_0x261080['status'](_0x52adb2)[_0x40a3('0x10')](_0x1ee5f8);};}exports[_0x40a3('0xb')]=function(_0x5b8539,_0x116b69){if(_0x5b8539[_0x40a3('0x11')][_0x40a3('0x12')]!==_0x40a3('0x13'))throw new Error('Unauthorized');if(isNaN(Number(_0x5b8539['params']['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x40a3('0x14')][_0x40a3('0x15')]({'where':{'id':_0x5b8539[_0x40a3('0x16')]['id']}})['then'](handleEntityNotFound(_0x116b69,null))[_0x40a3('0xc')](saveUpdates(_0x5b8539[_0x40a3('0x17')],null))['then'](respondWithResult(_0x116b69,null))[_0x40a3('0x18')](handleError(_0x116b69,null));}; \ No newline at end of file +var _0x4156=['then','error','stack','name','user','role','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','update'];(function(_0x4a0576,_0x3b4a53){var _0x3044fe=function(_0x3bd182){while(--_0x3bd182){_0x4a0576['push'](_0x4a0576['shift']());}};_0x3044fe(++_0x3b4a53);}(_0x4156,0xf1));var _0x6415=function(_0x5312ea,_0x37705c){_0x5312ea=_0x5312ea-0x0;var _0x3f5e70=_0x4156[_0x5312ea];return _0x3f5e70;};'use strict';var _=require(_0x6415('0x0'));var Redis=require(_0x6415('0x1'));var logger=require(_0x6415('0x2'))(_0x6415('0x3'));var config=require(_0x6415('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0x6415('0x5'))(new Redis(config[_0x6415('0x6')]));require(_0x6415('0x7'))[_0x6415('0x8')](socket);config[_0x6415('0x6')]=_[_0x6415('0x9')](config[_0x6415('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x24cb0,_0x47ec13){_0x47ec13=_0x47ec13||0xc8;return function(_0x4045ec){if(_0x4045ec){return _0x24cb0[_0x6415('0xa')](_0x47ec13)['json'](_0x4045ec);}};}function saveUpdates(_0x919b59){return function(_0x224e7b){if(_0x224e7b){return _0x224e7b[_0x6415('0xb')](_0x919b59)[_0x6415('0xc')](function(_0x4c70b4){return _0x4c70b4;});}return null;};}function handleEntityNotFound(_0x10b49c){return function(_0x5abdf6){if(!_0x5abdf6){_0x10b49c['sendStatus'](0x194);}return _0x5abdf6;};}function handleError(_0x277766,_0x153336){_0x153336=_0x153336||0x1f4;return function(_0x2ff916){logger[_0x6415('0xd')](_0x2ff916[_0x6415('0xe')]);if(_0x2ff916[_0x6415('0xf')]){delete _0x2ff916[_0x6415('0xf')];}_0x277766['status'](_0x153336)['send'](_0x2ff916);};}exports[_0x6415('0xb')]=function(_0x49d6b7,_0x2a4d5c){if(_0x49d6b7[_0x6415('0x10')][_0x6415('0x11')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x49d6b7[_0x6415('0x12')]['id'])))throw new Error(_0x6415('0x13'));return db['UserSetting'][_0x6415('0x14')]({'where':{'id':_0x49d6b7[_0x6415('0x12')]['id']}})['then'](handleEntityNotFound(_0x2a4d5c,null))['then'](saveUpdates(_0x49d6b7[_0x6415('0x15')],null))[_0x6415('0xc')](respondWithResult(_0x2a4d5c,null))[_0x6415('0x16')](handleError(_0x2a4d5c,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 4196ea5..771af94 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x801e=['save','update','emit','exports','../../mysqldb','UserSetting'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x801e,0xd6));var _0xe801=function(_0x509fd5,_0x4f8493){_0x509fd5=_0x509fd5-0x0;var _0x3738b8=_0x801e[_0x509fd5];return _0x3738b8;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xe801('0x0'))['db'][_0xe801('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe801('0x2'),'afterUpdate':_0xe801('0x3'),'afterDestroy':'remove'};function emitEvent(_0x123ba8){return function(_0x1bd497,_0x322058,_0x1dcee5){UserSettingEvents[_0xe801('0x4')](_0x123ba8+':'+_0x1bd497['id'],_0x1bd497);UserSettingEvents['emit'](_0x123ba8,_0x1bd497);_0x1dcee5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xe801('0x5')]=UserSettingEvents; \ No newline at end of file +var _0x7b11=['emit','hook','events','../../mysqldb','UserSetting','setMaxListeners','save','remove'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7b11,0x6a));var _0x17b1=function(_0x3c165d,_0xcbcca0){_0x3c165d=_0x3c165d-0x0;var _0x2ed713=_0x7b11[_0x3c165d];return _0x2ed713;};'use strict';var EventEmitter=require(_0x17b1('0x0'));var UserSetting=require(_0x17b1('0x1'))['db'][_0x17b1('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x17b1('0x3')](0x0);var events={'afterCreate':_0x17b1('0x4'),'afterUpdate':'update','afterDestroy':_0x17b1('0x5')};function emitEvent(_0xf23e35){return function(_0x3f5511,_0x5a13e9,_0x519e97){UserSettingEvents[_0x17b1('0x6')](_0xf23e35+':'+_0x3f5511['id'],_0x3f5511);UserSettingEvents[_0x17b1('0x6')](_0xf23e35,_0x3f5511);_0x519e97(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x17b1('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index d4fb430..2b4ca48 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadcc=['UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','define'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xadcc,0x76));var _0xcadc=function(_0x379686,_0x5a40ce){_0x379686=_0x379686-0x0;var _0x35dc97=_0xadcc[_0x379686];return _0x35dc97;};'use strict';var attributes=require(_0xcadc('0x0'));module['exports']=function(_0x150e40){return _0x150e40[_0xcadc('0x1')](_0xcadc('0x2'),attributes,{'tableName':_0xcadc('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c174f){if(!_0x2c174f['clientSideLoggingEnabled'])_0x2c174f['clientSideLoggingEnabledSince']=null;else if(_0x2c174f[_0xcadc('0x4')]===null)_0x2c174f[_0xcadc('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x9f4d=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x2147a3,_0x41b93b){var _0xfc6cd1=function(_0x25fc4b){while(--_0x25fc4b){_0x2147a3['push'](_0x2147a3['shift']());}};_0xfc6cd1(++_0x41b93b);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x51172d,_0x200cf2){_0x51172d=_0x51172d-0x0;var _0x52064d=_0x9f4d[_0x51172d];return _0x52064d;};'use strict';var attributes=require(_0xd9f4('0x0'));module[_0xd9f4('0x1')]=function(_0x34f803){return _0x34f803[_0xd9f4('0x2')](_0xd9f4('0x3'),attributes,{'tableName':_0xd9f4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36dc75){if(!_0x36dc75[_0xd9f4('0x5')])_0x36dc75[_0xd9f4('0x6')]=null;else if(_0x36dc75['clientSideLoggingEnabledSince']===null)_0x36dc75[_0xd9f4('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 4ef7ebd..3aefd61 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12f8=['register','length','user-setting:','./user-setting.events','update','emit','user-setting:update:user-','UserId'];(function(_0x2cdf0c,_0x4c66f4){var _0x4260d7=function(_0x1df228){while(--_0x1df228){_0x2cdf0c['push'](_0x2cdf0c['shift']());}};_0x4260d7(++_0x4c66f4);}(_0x12f8,0x1c3));var _0x812f=function(_0xa260aa,_0x3608b2){_0xa260aa=_0xa260aa-0x0;var _0x4bfb81=_0x12f8[_0xa260aa];return _0x4bfb81;};'use strict';var UserSettingEvents=require(_0x812f('0x0'));var events=['save','remove',_0x812f('0x1')];function createListener(_0x110bf9,_0x417667){return function(_0x134999){_0x417667[_0x812f('0x2')](_0x110bf9,_0x134999);if(_0x110bf9==='user-setting:update'){_0x417667[_0x812f('0x2')](_0x812f('0x3')+_0x134999[_0x812f('0x4')],_0x134999);}};}exports[_0x812f('0x5')]=function(_0x20af35){for(var _0x53c6b0=0x0,_0x594033=events[_0x812f('0x6')];_0x53c6b0<_0x594033;_0x53c6b0++){var _0x44ae72=events[_0x53c6b0];var _0x5aee78=createListener(_0x812f('0x7')+_0x44ae72,_0x20af35);UserSettingEvents['on'](_0x44ae72,_0x5aee78);}}; \ No newline at end of file +var _0x3de4=['user-setting:update','emit','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','update'];(function(_0xb02a51,_0x4fefca){var _0xfdc48f=function(_0x21ffb3){while(--_0x21ffb3){_0xb02a51['push'](_0xb02a51['shift']());}};_0xfdc48f(++_0x4fefca);}(_0x3de4,0x101));var _0x43de=function(_0x4c5ead,_0xaec00e){_0x4c5ead=_0x4c5ead-0x0;var _0x378177=_0x3de4[_0x4c5ead];return _0x378177;};'use strict';var UserSettingEvents=require(_0x43de('0x0'));var events=[_0x43de('0x1'),'remove',_0x43de('0x2')];function createListener(_0x331e9e,_0x1bae03){return function(_0x118898){_0x1bae03['emit'](_0x331e9e,_0x118898);if(_0x331e9e===_0x43de('0x3')){_0x1bae03[_0x43de('0x4')](_0x43de('0x5')+_0x118898[_0x43de('0x6')],_0x118898);}};}exports[_0x43de('0x7')]=function(_0x289e2b){for(var _0x5b337c=0x0,_0x8f9e06=events[_0x43de('0x8')];_0x5b337c<_0x8f9e06;_0x5b337c++){var _0x1764d8=events[_0x5b337c];var _0x51b448=createListener(_0x43de('0x9')+_0x1764d8,_0x289e2b);UserSettingEvents['on'](_0x1764d8,_0x51b448);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index b1e6aa4..cfedd39 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 _0xd7d7=['/:id/logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/square_projects','addSquareProjects','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getApiKey','post','addContacts','create','/create_many','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login'];(function(_0x119940,_0x4f6830){var _0x158581=function(_0x2ce545){while(--_0x2ce545){_0x119940['push'](_0x119940['shift']());}};_0x158581(++_0x4f6830);}(_0xd7d7,0x193));var _0x7d7d=function(_0x43ec69,_0x209500){_0x43ec69=_0x43ec69-0x0;var _0x1e0fcb=_0xd7d7[_0x43ec69];return _0x1e0fcb;};'use strict';var multer=require(_0x7d7d('0x0'));var util=require(_0x7d7d('0x1'));var path=require(_0x7d7d('0x2'));var timeout=require(_0x7d7d('0x3'));var express=require(_0x7d7d('0x4'));var router=express[_0x7d7d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7d7d('0x6'));var config=require(_0x7d7d('0x7'));var controller=require(_0x7d7d('0x8'));router[_0x7d7d('0x9')]('/',auth[_0x7d7d('0xa')](),controller['index']);router['get'](_0x7d7d('0xb'),auth[_0x7d7d('0xa')](),controller['describe']);router[_0x7d7d('0x9')](_0x7d7d('0xc'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0xd')]);router[_0x7d7d('0x9')](_0x7d7d('0xe'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0xf')]);router['get'](_0x7d7d('0x10'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x11')]);router[_0x7d7d('0x9')](_0x7d7d('0x12'),controller[_0x7d7d('0x13')]);router['get'](_0x7d7d('0x14'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x15')]);router[_0x7d7d('0x9')]('/:id/contacts',auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x16')]);router[_0x7d7d('0x9')](_0x7d7d('0x17'),auth['isAuthenticated'](),controller[_0x7d7d('0x18')]);router[_0x7d7d('0x9')](_0x7d7d('0x19'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x7d7d('0x9')](_0x7d7d('0x1a'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x1b')]);router[_0x7d7d('0x9')](_0x7d7d('0x1c'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x1d')]);router[_0x7d7d('0x9')](_0x7d7d('0x1e'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x1f')]);router['get'](_0x7d7d('0x20'),auth[_0x7d7d('0xa')](),controller['getChatInteractions']);router[_0x7d7d('0x9')](_0x7d7d('0x21'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x22')]);router[_0x7d7d('0x9')](_0x7d7d('0x23'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x24')]);router['get'](_0x7d7d('0x25'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x26')]);router['get'](_0x7d7d('0x27'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x28')]);router[_0x7d7d('0x9')](_0x7d7d('0x29'),auth[_0x7d7d('0xa')](),controller['getWhatsappInteractions']);router[_0x7d7d('0x9')]('/:id/teams',auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x2a')]);router['get']('/:id/lists',auth[_0x7d7d('0xa')](),controller['getLists']);router[_0x7d7d('0x9')](_0x7d7d('0x2b'),auth[_0x7d7d('0xa')](),controller['getAgents']);router[_0x7d7d('0x9')](_0x7d7d('0x2c'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x2d')]);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x7d7d('0x2e')]);router[_0x7d7d('0x9')](_0x7d7d('0x2f'),auth['isAuthenticated'](),controller[_0x7d7d('0x30')]);router['get'](_0x7d7d('0x31'),auth[_0x7d7d('0xa')](),controller['getOpenchannelAccounts']);router[_0x7d7d('0x9')](_0x7d7d('0x32'),auth['isAuthenticated'](),controller['getSmsAccounts']);router['get'](_0x7d7d('0x33'),auth['isAuthenticated'](),controller[_0x7d7d('0x34')]);router['get'](_0x7d7d('0x35'),auth['isAuthenticated'](),controller[_0x7d7d('0x36')]);router[_0x7d7d('0x9')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x7d7d('0x37')]);router[_0x7d7d('0x9')](_0x7d7d('0x38'),auth[_0x7d7d('0xa')](),controller['getScheduledCalls']);router[_0x7d7d('0x9')]('/:id/api_key',auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x39')]);router[_0x7d7d('0x3a')]('/:id/contacts',auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x3b')]);router[_0x7d7d('0x3a')]('/',auth['isAuthenticated'](),controller[_0x7d7d('0x3c')]);router[_0x7d7d('0x3a')](_0x7d7d('0x3d'),auth[_0x7d7d('0xa')](),controller['bulkCreate']);router[_0x7d7d('0x3a')]('/:id/queues',auth[_0x7d7d('0xa')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x47f470,_0x5ddcbd,_0x37b093){_0x37b093(null,path[_0x7d7d('0x3e')](config[_0x7d7d('0x3f')],_0x7d7d('0x40')));},'filename':function(_0x1f2615,_0x5320c2,_0xcdbdbf){_0xcdbdbf(null,util[_0x7d7d('0x41')](_0x7d7d('0x42'),Date[_0x7d7d('0x43')](),_0x5320c2[_0x7d7d('0x44')]));}})});router[_0x7d7d('0x3a')](_0x7d7d('0x12'),upload[_0x7d7d('0x45')](_0x7d7d('0x46')),controller[_0x7d7d('0x47')]);router[_0x7d7d('0x3a')](_0x7d7d('0x48'),auth['isAuthenticated'](),controller['login']);router[_0x7d7d('0x3a')](_0x7d7d('0x49'),auth[_0x7d7d('0xa')](),controller['logout']);router[_0x7d7d('0x3a')](_0x7d7d('0x4a'),auth['isAuthenticated'](),controller[_0x7d7d('0x4b')]);router[_0x7d7d('0x3a')](_0x7d7d('0x4c'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x4d')]);router[_0x7d7d('0x3a')](_0x7d7d('0x4e'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x4f')]);router['post'](_0x7d7d('0x50'),auth[_0x7d7d('0xa')](),controller['addChatInteractions']);router['post'](_0x7d7d('0x51'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x52')]);router[_0x7d7d('0x3a')](_0x7d7d('0x53'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x7d7d('0x3a')](_0x7d7d('0x54'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x55')]);router[_0x7d7d('0x3a')](_0x7d7d('0x56'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x57')]);router['post']('/:id/whatsapp_interactions',auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x58')]);router['post']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x7d7d('0x59')]);router[_0x7d7d('0x3a')](_0x7d7d('0x2f'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x5a')]);router['post'](_0x7d7d('0x31'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x5b')]);router[_0x7d7d('0x3a')](_0x7d7d('0x32'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x5c')]);router[_0x7d7d('0x3a')](_0x7d7d('0x33'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x5d')]);router[_0x7d7d('0x3a')]('/:id/whatsapp_accounts',auth[_0x7d7d('0xa')](),controller['addWhatsappAccounts']);router[_0x7d7d('0x3a')](_0x7d7d('0x5e'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x5f')]);router['post'](_0x7d7d('0x60'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x61')]);router[_0x7d7d('0x62')](_0x7d7d('0x10'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x63')]);router['put'](_0x7d7d('0x64'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x65')]);router[_0x7d7d('0x66')](_0x7d7d('0x17'),auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0x7d7d('0x4e'),auth['isAuthenticated'](),controller[_0x7d7d('0x67')]);router[_0x7d7d('0x66')](_0x7d7d('0x10'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x68')]);router['delete'](_0x7d7d('0x50'),auth['isAuthenticated'](),controller[_0x7d7d('0x69')]);router['delete'](_0x7d7d('0x51'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x6a')]);router[_0x7d7d('0x66')](_0x7d7d('0x53'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x6b')]);router[_0x7d7d('0x66')](_0x7d7d('0x54'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x6c')]);router[_0x7d7d('0x66')](_0x7d7d('0x56'),auth['isAuthenticated'](),controller[_0x7d7d('0x6d')]);router[_0x7d7d('0x66')](_0x7d7d('0x6e'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x6f')]);router['delete'](_0x7d7d('0x70'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x71')]);router['delete'](_0x7d7d('0x2f'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x72')]);router['delete'](_0x7d7d('0x31'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x7d7d('0x66')](_0x7d7d('0x32'),auth[_0x7d7d('0xa')](),controller['removeSmsAccounts']);router[_0x7d7d('0x66')](_0x7d7d('0x33'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x7d7d('0x66')](_0x7d7d('0x35'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x73')]);router[_0x7d7d('0x66')](_0x7d7d('0x5e'),auth['isAuthenticated'](),controller[_0x7d7d('0x74')]);router[_0x7d7d('0x66')](_0x7d7d('0x60'),auth[_0x7d7d('0xa')](),controller[_0x7d7d('0x75')]);module[_0x7d7d('0x76')]=router; \ No newline at end of file +var _0x9377=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','create','bulkCreate','addQueues','diskStorage','join','root','format','originalname','/:id/avatar','single','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','/:id/teams','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','/:id','update','put','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeApiKey','multer','util','connect-timeout','express'];(function(_0x193f0d,_0x8b9309){var _0x36f9c0=function(_0xcb7224){while(--_0xcb7224){_0x193f0d['push'](_0x193f0d['shift']());}};_0x36f9c0(++_0x8b9309);}(_0x9377,0xda));var _0x7937=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9377[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7937('0x0'));var util=require(_0x7937('0x1'));var path=require('path');var timeout=require(_0x7937('0x2'));var express=require(_0x7937('0x3'));var router=express[_0x7937('0x4')]();var fs_extra=require(_0x7937('0x5'));var auth=require(_0x7937('0x6'));var interaction=require(_0x7937('0x7'));var config=require(_0x7937('0x8'));var controller=require(_0x7937('0x9'));router[_0x7937('0xa')]('/',auth['isAuthenticated'](),controller[_0x7937('0xb')]);router[_0x7937('0xa')](_0x7937('0xc'),auth[_0x7937('0xd')](),controller[_0x7937('0xe')]);router['get'](_0x7937('0xf'),auth[_0x7937('0xd')](),controller[_0x7937('0x10')]);router['get'](_0x7937('0x11'),auth[_0x7937('0xd')](),controller[_0x7937('0x12')]);router[_0x7937('0xa')]('/:id',auth[_0x7937('0xd')](),controller['show']);router['get']('/:id/avatar',controller['getAvatar']);router['get']('/:id/open_tabs',auth[_0x7937('0xd')](),controller['getOpenTabs']);router['get'](_0x7937('0x13'),auth['isAuthenticated'](),controller[_0x7937('0x14')]);router['get'](_0x7937('0x15'),auth[_0x7937('0xd')](),controller[_0x7937('0x16')]);router[_0x7937('0xa')]('/:id/queues_rt',auth[_0x7937('0xd')](),controller[_0x7937('0x17')]);router[_0x7937('0xa')](_0x7937('0x18'),auth[_0x7937('0xd')](),controller[_0x7937('0x19')]);router[_0x7937('0xa')](_0x7937('0x1a'),auth[_0x7937('0xd')](),controller[_0x7937('0x1b')]);router['get'](_0x7937('0x1c'),auth[_0x7937('0xd')](),controller['getScreenRecordings']);router[_0x7937('0xa')](_0x7937('0x1d'),auth[_0x7937('0xd')](),controller['getChatInteractions']);router[_0x7937('0xa')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x7937('0x1e')]);router['get'](_0x7937('0x1f'),auth[_0x7937('0xd')](),controller[_0x7937('0x20')]);router[_0x7937('0xa')]('/:id/sms/interactions',auth[_0x7937('0xd')](),controller[_0x7937('0x21')]);router[_0x7937('0xa')](_0x7937('0x22'),auth['isAuthenticated'](),controller[_0x7937('0x23')]);router['get']('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x7937('0x24')]);router['get']('/:id/teams',auth[_0x7937('0xd')](),controller[_0x7937('0x25')]);router['get'](_0x7937('0x26'),auth[_0x7937('0xd')](),controller['getLists']);router[_0x7937('0xa')](_0x7937('0x27'),auth[_0x7937('0xd')](),controller[_0x7937('0x28')]);router[_0x7937('0xa')](_0x7937('0x29'),auth[_0x7937('0xd')](),controller[_0x7937('0x2a')]);router['get'](_0x7937('0x2b'),auth['isAuthenticated'](),controller[_0x7937('0x2c')]);router[_0x7937('0xa')]('/:id/mail_accounts',auth[_0x7937('0xd')](),controller['getMailAccounts']);router[_0x7937('0xa')](_0x7937('0x2d'),auth[_0x7937('0xd')](),controller['getOpenchannelAccounts']);router[_0x7937('0xa')]('/:id/sms_accounts',auth[_0x7937('0xd')](),controller[_0x7937('0x2e')]);router[_0x7937('0xa')](_0x7937('0x2f'),auth['isAuthenticated'](),controller[_0x7937('0x30')]);router[_0x7937('0xa')](_0x7937('0x31'),auth[_0x7937('0xd')](),controller['getWhatsappAccounts']);router[_0x7937('0xa')](_0x7937('0x32'),auth[_0x7937('0xd')](),controller[_0x7937('0x33')]);router['get'](_0x7937('0x34'),auth['isAuthenticated'](),controller[_0x7937('0x35')]);router[_0x7937('0xa')]('/:id/api_key',auth[_0x7937('0xd')](),controller[_0x7937('0x36')]);router[_0x7937('0x37')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0x7937('0xd')](),controller[_0x7937('0x38')]);router[_0x7937('0x37')]('/create_many',auth[_0x7937('0xd')](),controller[_0x7937('0x39')]);router[_0x7937('0x37')]('/:id/queues',auth[_0x7937('0xd')](),controller[_0x7937('0x3a')]);var upload=multer({'storage':multer[_0x7937('0x3b')]({'destination':function(_0x25e23a,_0x45dbe1,_0x8dc93d){_0x8dc93d(null,path[_0x7937('0x3c')](config[_0x7937('0x3d')],'server/files/images/'));},'filename':function(_0x52e96d,_0x5ae3cd,_0x753979){_0x753979(null,util[_0x7937('0x3e')]('%s-%s',Date['now'](),_0x5ae3cd[_0x7937('0x3f')]));}})});router[_0x7937('0x37')](_0x7937('0x40'),upload[_0x7937('0x41')]('file'),controller[_0x7937('0x42')]);router[_0x7937('0x37')](_0x7937('0x43'),auth[_0x7937('0xd')](),controller['login']);router[_0x7937('0x37')](_0x7937('0x44'),auth['isAuthenticated'](),controller[_0x7937('0x45')]);router[_0x7937('0x37')](_0x7937('0x46'),auth['isAuthenticated'](),controller['pause']);router[_0x7937('0x37')](_0x7937('0x47'),auth[_0x7937('0xd')](),controller['unpause']);router[_0x7937('0x37')](_0x7937('0x48'),auth['isAuthenticated'](),controller[_0x7937('0x49')]);router[_0x7937('0x37')]('/:id/chat_interactions',auth[_0x7937('0xd')](),controller['addChatInteractions']);router['post'](_0x7937('0x4a'),auth[_0x7937('0xd')](),controller[_0x7937('0x4b')]);router['post'](_0x7937('0x4c'),auth[_0x7937('0xd')](),controller[_0x7937('0x4d')]);router[_0x7937('0x37')](_0x7937('0x4e'),auth[_0x7937('0xd')](),controller[_0x7937('0x4f')]);router[_0x7937('0x37')](_0x7937('0x50'),auth[_0x7937('0xd')](),controller[_0x7937('0x51')]);router[_0x7937('0x37')](_0x7937('0x52'),auth[_0x7937('0xd')](),controller[_0x7937('0x53')]);router[_0x7937('0x37')](_0x7937('0x2b'),auth[_0x7937('0xd')](),controller[_0x7937('0x54')]);router['post'](_0x7937('0x55'),auth['isAuthenticated'](),controller[_0x7937('0x56')]);router['post'](_0x7937('0x2d'),auth[_0x7937('0xd')](),controller[_0x7937('0x57')]);router[_0x7937('0x37')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['addSmsAccounts']);router['post'](_0x7937('0x2f'),auth[_0x7937('0xd')](),controller[_0x7937('0x58')]);router[_0x7937('0x37')](_0x7937('0x31'),auth[_0x7937('0xd')](),controller[_0x7937('0x59')]);router[_0x7937('0x37')]('/:id/square_projects',auth[_0x7937('0xd')](),controller[_0x7937('0x5a')]);router[_0x7937('0x37')](_0x7937('0x5b'),auth['isAuthenticated'](),controller[_0x7937('0x5c')]);router['put'](_0x7937('0x5d'),auth[_0x7937('0xd')](),controller[_0x7937('0x5e')]);router[_0x7937('0x5f')]('/:id/password',auth['isAuthenticated'](),controller['changePassword']);router[_0x7937('0x60')](_0x7937('0x15'),auth[_0x7937('0xd')](),controller[_0x7937('0x61')]);router[_0x7937('0x60')](_0x7937('0x48'),auth[_0x7937('0xd')](),controller[_0x7937('0x62')]);router[_0x7937('0x60')](_0x7937('0x5d'),auth['isAuthenticated'](),controller[_0x7937('0x63')]);router[_0x7937('0x60')]('/:id/chat_interactions',auth[_0x7937('0xd')](),controller[_0x7937('0x64')]);router[_0x7937('0x60')](_0x7937('0x4a'),auth[_0x7937('0xd')](),controller['removeMailInteractions']);router[_0x7937('0x60')](_0x7937('0x4c'),auth[_0x7937('0xd')](),controller[_0x7937('0x65')]);router[_0x7937('0x60')]('/:id/sms_interactions',auth[_0x7937('0xd')](),controller[_0x7937('0x66')]);router[_0x7937('0x60')](_0x7937('0x50'),auth[_0x7937('0xd')](),controller[_0x7937('0x67')]);router[_0x7937('0x60')]('/:id/whatsapp_interactions',auth[_0x7937('0xd')](),controller[_0x7937('0x68')]);router[_0x7937('0x60')](_0x7937('0x2b'),auth['isAuthenticated'](),controller[_0x7937('0x69')]);router[_0x7937('0x60')]('/:id/mail_accounts',auth[_0x7937('0xd')](),controller[_0x7937('0x6a')]);router[_0x7937('0x60')](_0x7937('0x2d'),auth['isAuthenticated'](),controller[_0x7937('0x6b')]);router[_0x7937('0x60')](_0x7937('0x6c'),auth[_0x7937('0xd')](),controller[_0x7937('0x6d')]);router['delete'](_0x7937('0x2f'),auth[_0x7937('0xd')](),controller['removeChatWebsites']);router[_0x7937('0x60')](_0x7937('0x31'),auth[_0x7937('0xd')](),controller['removeWhatsappAccounts']);router[_0x7937('0x60')](_0x7937('0x32'),auth[_0x7937('0xd')](),controller['removeSquareProjects']);router[_0x7937('0x60')](_0x7937('0x5b'),auth[_0x7937('0xd')](),controller[_0x7937('0x6e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 5d099f9..cda2218 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 _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x406e46,_0x5799cb){var _0x4a3742=function(_0x1fa435){while(--_0x1fa435){_0x406e46['push'](_0x406e46['shift']());}};_0x4a3742(++_0x5799cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 8260123..429e1af 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 _0xd1b7=['desc','asc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','ui.','InteractionId','field','ui.createdAt','ui.UserId\x20=\x20?','moment','util','squel','jayson/promise','ioredis','api','../../config/utils','../../config/license/util','APINotFoundError','../../errors/api','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','http','request','then','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','undefined','count','limit','set','update','userNotification:recalc:','destroy','get','role','admin','Users','user','Agents','telephone','filter','ignore','value','find','name','UserProfileResource','sendStatus','stack','send','index','User','map','fieldName','type','key','includes','password','salt','where','query','includeAll','include','userSetting','true','attributes','findAll','rows','length','push','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','model','differenceBy','keys','rawAttributes','intersection','fields','UserSetting','merge','options','openTabs','body','params','describe','addContacts','omit','ids','internal','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','agent','permissions','113','110','104','105','106','107','108','109','100','111','114','115','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','create','UserProfileSection','Telephones','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','isEmpty','compact','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','loginInPause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','QueueId','emit','Queue:save','voice','VoiceQueue','online','interface','format','SIP/%s','voicePause','UserVoiceQueueRt','upsert','removeQueues','channel','remove','isArray','Queue:remove','userpic','filename','getAvatar','root','server/files/images/logos/default_profile.png','join','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','CmContact','filters','order','sort','hasOwnProperty','List','Tag','Tags','tag','nolimit','getQueues','Queue','Queues','Unknown\x20role','pick','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','removeAgent','TeamVoicePrefix','getLists','getAgents','getVoiceQueues','addChatInteractions','spread','removeChatInteractions','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','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','Contact','dialActive','CmHopper','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','queues','teams','inbound','flatten','lower','col','toString'];(function(_0x5757c6,_0x444a45){var _0x498d31=function(_0x2bb918){while(--_0x2bb918){_0x5757c6['push'](_0x5757c6['shift']());}};_0x498d31(++_0x444a45);}(_0xd1b7,0x1a8));var _0x7d1b=function(_0x5ed199,_0x31e75e){_0x5ed199=_0x5ed199-0x0;var _0x4100be=_0xd1b7[_0x5ed199];return _0x4100be;};'use strict';var moment=require(_0x7d1b('0x0'));var util=require(_0x7d1b('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x7d1b('0x2'));var jayson=require(_0x7d1b('0x3'));var Redis=require(_0x7d1b('0x4'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7d1b('0x5'));var utils=require(_0x7d1b('0x6'));var config=require('../../config/environment');var licenseUtil=require(_0x7d1b('0x7'));var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0x7d1b('0x8')];var APIHandleError=require(_0x7d1b('0x9'))[_0x7d1b('0xa')];var db=require(_0x7d1b('0xb'))['db'];var socket=require(_0x7d1b('0xc'))(new Redis(config[_0x7d1b('0xd')]));require(_0x7d1b('0xe'))[_0x7d1b('0xf')](socket);config[_0x7d1b('0xd')]=_[_0x7d1b('0x10')](config[_0x7d1b('0xd')],{'host':_0x7d1b('0x11'),'port':0x18eb});var amiClient=jayson['client'][_0x7d1b('0x12')]({'port':0x232a});var values;function respondWithRpcPromise(_0x568b90,_0x36b9f1,_0x23b044,_0x43a37b){return new Promise(function(_0x4361f7,_0x2c044e){var _0x1ca2d6=_0x43a37b||amiClient;return _0x1ca2d6[_0x7d1b('0x13')](_0x568b90,_0x23b044)[_0x7d1b('0x14')](function(_0x520ba0){logger['info'](_0x7d1b('0x15'),_0x36b9f1,'request\x20sent');logger['debug'](_0x7d1b('0x16'),_0x36b9f1,_0x7d1b('0x17'),JSON[_0x7d1b('0x18')](_0x520ba0));if(_0x520ba0['error']){if(_0x520ba0[_0x7d1b('0x19')]['code']===0x1f4){logger[_0x7d1b('0x19')](_0x7d1b('0x15'),_0x36b9f1,_0x520ba0[_0x7d1b('0x19')][_0x7d1b('0x1a')]);return _0x2c044e(_0x520ba0[_0x7d1b('0x19')][_0x7d1b('0x1a')]);}logger['error'](_0x7d1b('0x15'),_0x36b9f1,_0x520ba0[_0x7d1b('0x19')][_0x7d1b('0x1a')]);return _0x4361f7(_0x520ba0[_0x7d1b('0x19')][_0x7d1b('0x1a')]);}else{logger['info']('User,\x20%s,\x20%s',_0x36b9f1,_0x7d1b('0x17'));_0x4361f7(_0x520ba0[_0x7d1b('0x1b')]['message']);}})[_0x7d1b('0x1c')](function(_0x3d044f){logger['error'](_0x7d1b('0x15'),_0x36b9f1,_0x3d044f);_0x2c044e(_0x3d044f);});});}function respondWithStatusCode(_0x1c7990,_0x58f3d6){_0x58f3d6=_0x58f3d6||0xcc;return function(_0xe2035c){if(_0xe2035c){return _0x1c7990['sendStatus'](_0x58f3d6);}return _0x1c7990[_0x7d1b('0x1d')](_0x58f3d6)[_0x7d1b('0x1e')]();};}function respondWithResult(_0x5d9e1d,_0x2a6a43){_0x2a6a43=_0x2a6a43||0xc8;return function(_0x2e4b6b){if(_0x2e4b6b){return _0x5d9e1d[_0x7d1b('0x1d')](_0x2a6a43)[_0x7d1b('0x1f')](_0x2e4b6b);}};}function respondWithFilteredResult(_0x2d3eb0,_0x3824f0){return function(_0x4a4b37){if(_0x4a4b37){var _0x43118c=typeof _0x3824f0[_0x7d1b('0x20')]===_0x7d1b('0x21')&&typeof _0x3824f0['limit']===_0x7d1b('0x21');var _0x1bf552=_0x4a4b37[_0x7d1b('0x22')];var _0x11b9b0=_0x43118c?0x0:_0x3824f0['offset'];var _0x14fb8c=_0x43118c?_0x4a4b37[_0x7d1b('0x22')]:_0x3824f0[_0x7d1b('0x20')]+_0x3824f0[_0x7d1b('0x23')];var _0x5c9a8d;if(_0x14fb8c>=_0x1bf552){_0x14fb8c=_0x1bf552;_0x5c9a8d=0xc8;}else{_0x5c9a8d=0xce;}_0x2d3eb0[_0x7d1b('0x1d')](_0x5c9a8d);return _0x2d3eb0[_0x7d1b('0x24')]('Content-Range',_0x11b9b0+'-'+_0x14fb8c+'/'+_0x1bf552)[_0x7d1b('0x1f')](_0x4a4b37);}return null;};}function saveUpdates(_0x593340){return function(_0x8c1670){if(_0x8c1670){return _0x8c1670[_0x7d1b('0x25')](_0x593340)[_0x7d1b('0x14')](function(_0x58ec95){socket['emit'](_0x7d1b('0x26')+_0x58ec95['id'],{});return _0x58ec95;});}return null;};}function removeEntity(_0x5e598d){return function(_0x555588){if(_0x555588){return _0x555588[_0x7d1b('0x27')]()['then'](function(){var _0x253d43=_0x555588[_0x7d1b('0x28')]({'plain':!![]});if(_0x253d43[_0x7d1b('0x29')]===_0x7d1b('0x2a'))return;var _0x24bd62=[{'name':_0x7d1b('0x2b'),'value':_0x7d1b('0x2c'),'ignore':!![]},{'name':_0x7d1b('0x2d'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x7d1b('0x2e'),'ignore':![]}];var _0x4b0e44=_(_0x24bd62)[_0x7d1b('0x2f')](_0x7d1b('0x30'))['map'](_0x7d1b('0x31'))[_0x7d1b('0x31')]();if(_['includes'](_0x4b0e44,_0x253d43[_0x7d1b('0x29')])){return;}var _0x467fa4=_[_0x7d1b('0x32')](_0x24bd62,['value',_0x253d43[_0x7d1b('0x29')]])[_0x7d1b('0x33')];return db[_0x7d1b('0x34')]['destroy']({'where':{'type':_0x467fa4,'resourceId':_0x253d43['id']}})[_0x7d1b('0x14')](function(){return _0x555588;});})['then'](function(){_0x5e598d[_0x7d1b('0x1d')](0xcc)[_0x7d1b('0x1e')]();});}};}function handleEntityNotFound(_0x18202d){return function(_0x422e15){if(!_0x422e15){_0x18202d[_0x7d1b('0x35')](0x194);}return _0x422e15;};}function handleError(_0x7b20c0,_0x2d492f){_0x2d492f=_0x2d492f||0x1f4;return function(_0x24e443){logger[_0x7d1b('0x19')](_0x24e443[_0x7d1b('0x36')]);if(_0x24e443['name']){delete _0x24e443[_0x7d1b('0x33')];}_0x7b20c0[_0x7d1b('0x1d')](_0x2d492f)[_0x7d1b('0x37')](_0x24e443);};}exports[_0x7d1b('0x38')]=function(_0x477264,_0x2112b3){var _0x48bfa9={},_0x565e25={'count':0x0,'rows':[]};var _0xa6c692=_(db[_0x7d1b('0x39')]['rawAttributes'])[_0x7d1b('0x3a')](function(_0x38a7ee){return{'name':_0x38a7ee[_0x7d1b('0x3b')],'type':_0x38a7ee[_0x7d1b('0x3c')][_0x7d1b('0x3d')]};})[_0x7d1b('0x2f')](function(_0x5ad690){return!_[_0x7d1b('0x3e')]([_0x7d1b('0x3f'),_0x7d1b('0x40')],_0x5ad690[_0x7d1b('0x33')]);})[_0x7d1b('0x31')]();_0x48bfa9=qs['getOptions'](_0xa6c692,_0x477264);var _0x40aabc={'where':_0x48bfa9[_0x7d1b('0x41')]};return db[_0x7d1b('0x39')][_0x7d1b('0x22')](_0x40aabc)[_0x7d1b('0x14')](function(_0x479f1f){_0x565e25[_0x7d1b('0x22')]=_0x479f1f;if(_0x477264[_0x7d1b('0x42')][_0x7d1b('0x43')]){_0x48bfa9[_0x7d1b('0x44')]=[{'all':!![]}];}if(_0x477264[_0x7d1b('0x42')][_0x7d1b('0x45')]===_0x7d1b('0x46')){_0x48bfa9['include']=[{'model':db['UserSetting'],'as':_0x7d1b('0x45')}];}if(!_[_0x7d1b('0x3e')](_0x48bfa9[_0x7d1b('0x47')],'id')){_0x48bfa9['attributes']['push']('id');}return db['User'][_0x7d1b('0x48')](_0x48bfa9);})[_0x7d1b('0x14')](function(_0x334bde){_0x565e25[_0x7d1b('0x49')]=_0x334bde;if(_0x477264[_0x7d1b('0x42')]['openTabs']===_0x7d1b('0x46')){var _0x3ae259=[];for(var _0x2b6624=0x0;_0x2b6624<_0x565e25[_0x7d1b('0x49')][_0x7d1b('0x4a')];_0x2b6624++){_0x3ae259[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x4c'),_0x565e25[_0x7d1b('0x49')][_0x2b6624][_0x7d1b('0x4d')]));_0x3ae259['push'](get_open_tabs(_0x7d1b('0x4e'),_0x565e25[_0x7d1b('0x49')][_0x2b6624][_0x7d1b('0x4d')]));_0x3ae259[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x4f'),_0x565e25[_0x7d1b('0x49')][_0x2b6624][_0x7d1b('0x4d')]));_0x3ae259['push'](get_open_tabs(_0x7d1b('0x50'),_0x565e25[_0x7d1b('0x49')][_0x2b6624][_0x7d1b('0x4d')]));_0x3ae259[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x51'),_0x565e25[_0x7d1b('0x49')][_0x2b6624]['dataValues']));_0x3ae259[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x52'),_0x565e25[_0x7d1b('0x49')][_0x2b6624][_0x7d1b('0x4d')]));}return Promise[_0x7d1b('0x53')](_0x3ae259)[_0x7d1b('0x14')](function(){return _0x565e25;});}else{return _0x565e25;}})[_0x7d1b('0x14')](respondWithFilteredResult(_0x2112b3,_0x48bfa9))['catch'](handleError(_0x2112b3,null));};exports[_0x7d1b('0x54')]=function(_0x188b79,_0x145054){var _0x33cc37={'raw':![],'where':{'id':_0x188b79['params']['id']}},_0x1c3e6b={};_0x1c3e6b[_0x7d1b('0x55')]=_[_0x7d1b('0x56')](_[_0x7d1b('0x57')](db['User'][_0x7d1b('0x58')]),['password','salt']);_0x1c3e6b['query']=_[_0x7d1b('0x57')](_0x188b79['query']);_0x1c3e6b['filters']=_[_0x7d1b('0x59')](_0x1c3e6b[_0x7d1b('0x55')],_0x1c3e6b[_0x7d1b('0x42')]);_0x33cc37[_0x7d1b('0x47')]=_['intersection'](_0x1c3e6b[_0x7d1b('0x55')],qs[_0x7d1b('0x5a')](_0x188b79['query'][_0x7d1b('0x5a')]));_0x33cc37[_0x7d1b('0x47')]=_0x33cc37[_0x7d1b('0x47')][_0x7d1b('0x4a')]?_0x33cc37[_0x7d1b('0x47')]:_0x1c3e6b[_0x7d1b('0x55')];if(_0x188b79[_0x7d1b('0x42')]['includeAll']){_0x33cc37[_0x7d1b('0x44')]=[{'all':!![]}];}if(_0x188b79[_0x7d1b('0x42')][_0x7d1b('0x45')]===_0x7d1b('0x46')){_0x33cc37[_0x7d1b('0x44')]=[{'model':db[_0x7d1b('0x5b')],'as':'userSetting'}];}_0x33cc37=_[_0x7d1b('0x5c')]({},_0x33cc37,_0x188b79[_0x7d1b('0x5d')]);if(!_['includes'](_0x33cc37[_0x7d1b('0x47')],'id')){_0x33cc37[_0x7d1b('0x47')][_0x7d1b('0x4b')]('id');}return db[_0x7d1b('0x39')]['find'](_0x33cc37)['then'](handleEntityNotFound(_0x145054,null))[_0x7d1b('0x14')](function(_0x3e4a50){var _0x3536b6=[];values=_0x3e4a50;if(_0x188b79[_0x7d1b('0x42')][_0x7d1b('0x5e')]===_0x7d1b('0x46')){_0x3536b6[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x4c'),_0x3e4a50['dataValues']));_0x3536b6[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x4e'),_0x3e4a50[_0x7d1b('0x4d')]));_0x3536b6[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x51'),_0x3e4a50[_0x7d1b('0x4d')]));_0x3536b6['push'](get_open_tabs(_0x7d1b('0x52'),_0x3e4a50['dataValues']));_0x3536b6[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x4f'),_0x3e4a50[_0x7d1b('0x4d')]));_0x3536b6['push'](get_open_tabs(_0x7d1b('0x50'),_0x3e4a50[_0x7d1b('0x4d')]));return Promise[_0x7d1b('0x53')](_0x3536b6);}else{return values;}})[_0x7d1b('0x14')](function(){return values;})['then'](respondWithResult(_0x145054,null))[_0x7d1b('0x1c')](handleError(_0x145054,null));};exports[_0x7d1b('0x25')]=function(_0x3a2862,_0x2b46e9){if(_0x3a2862[_0x7d1b('0x5f')]['id']){delete _0x3a2862[_0x7d1b('0x5f')]['id'];}delete _0x3a2862[_0x7d1b('0x5f')]['role'];return db['User']['find']({'where':{'id':_0x3a2862[_0x7d1b('0x60')]['id']}})['then'](handleEntityNotFound(_0x2b46e9,null))['then'](saveUpdates(_0x3a2862[_0x7d1b('0x5f')],null))[_0x7d1b('0x14')](respondWithResult(_0x2b46e9,null))[_0x7d1b('0x1c')](handleError(_0x2b46e9,null));};exports[_0x7d1b('0x61')]=function(_0x39f3d4,_0x34472d){return db['User'][_0x7d1b('0x61')]()[_0x7d1b('0x14')](respondWithResult(_0x34472d,null))[_0x7d1b('0x1c')](handleError(_0x34472d,null));};exports['addContacts']=function(_0x3666e6,_0x24a3db){return db['User'][_0x7d1b('0x32')]({'where':{'id':_0x3666e6[_0x7d1b('0x60')]['id']}})['then'](handleEntityNotFound(_0x24a3db,null))[_0x7d1b('0x14')](function(_0x1176f9){if(_0x1176f9){return _0x1176f9[_0x7d1b('0x62')](_0x3666e6[_0x7d1b('0x5f')]['ids'],_[_0x7d1b('0x63')](_0x3666e6['body'],[_0x7d1b('0x64'),'id'])||{});}})[_0x7d1b('0x14')](respondWithResult(_0x24a3db,null))['catch'](handleError(_0x24a3db,null));};function validateUser(_0x30458d){return new Promise(function(_0x8c0fc3,_0x2a367d){if(_0x30458d[_0x7d1b('0x65')])return _0x8c0fc3(_0x30458d);return db['Setting'][_0x7d1b('0x66')](0x1)[_0x7d1b('0x14')](function(_0x19a828){if(_0x19a828[_0x7d1b('0x67')])authService[_0x7d1b('0x68')](_0x30458d['password']);db['User'][_0x7d1b('0x69')]('internal')[_0x7d1b('0x14')](function(_0x5aeafa){if(_[_0x7d1b('0x6a')](_0x5aeafa)){_0x30458d[_0x7d1b('0x65')]=_0x19a828[_0x7d1b('0x6b')]||0x1;return;}if(_['isNil'](_0x19a828[_0x7d1b('0x6b')])||_0x19a828[_0x7d1b('0x6b')]===_0x5aeafa){_0x30458d['internal']=_0x5aeafa+0x1;return;}if(_0x19a828['min_internal']>_0x5aeafa){_0x30458d[_0x7d1b('0x65')]=_0x19a828[_0x7d1b('0x6b')];return;}return db['sequelize']['query'](_0x7d1b('0x6c'),{'type':db[_0x7d1b('0x6d')][_0x7d1b('0x6e')][_0x7d1b('0x6f')]})[_0x7d1b('0x14')](function(_0x16ebb9){if(_0x16ebb9&&_0x16ebb9[_0x7d1b('0x4a')]){for(var _0x26c472=0x0,_0xb10d9=_0x16ebb9['length'];_0x26c472<_0xb10d9&&_[_0x7d1b('0x6a')](_0x30458d[_0x7d1b('0x65')]);_0x26c472++){if(_0x19a828['min_internal']<=_0x16ebb9[_0x26c472][_0x7d1b('0x70')]){_0x30458d[_0x7d1b('0x65')]=_0x16ebb9[_0x26c472][_0x7d1b('0x70')];}else if(_0x19a828[_0x7d1b('0x6b')]>_0x16ebb9[_0x26c472]['from']&&_0x19a828[_0x7d1b('0x6b')]<=_0x16ebb9[_0x26c472]['to']){_0x30458d['internal']=_0x19a828[_0x7d1b('0x6b')];}}}if(_[_0x7d1b('0x6a')](_0x30458d[_0x7d1b('0x65')])){_0x30458d[_0x7d1b('0x65')]=_0x5aeafa+0x1;}return _0x8c0fc3(_0x30458d);});});})[_0x7d1b('0x1c')](function(_0x5844e6){_0x2a367d(_0x5844e6);});});}function updateUser(_0x1e04db){return new Promise(function(_0x12aa3f,_0x3b8e26){try{if(_0x1e04db[_0x7d1b('0x71')]){_0x1e04db[_0x7d1b('0x72')]=_0x1e04db['internal'];_0x1e04db[_0x7d1b('0x73')]={'mailbox':_0x1e04db[_0x7d1b('0x65')],'password':_0x1e04db['password'],'fullname':_0x1e04db['fullname'],'email':_0x1e04db[_0x7d1b('0x74')]};}if(_0x1e04db[_0x7d1b('0x29')]===_0x7d1b('0x75')){if(!_0x1e04db[_0x7d1b('0x76')])_0x1e04db[_0x7d1b('0x76')]=['101','102','103',_0x7d1b('0x77'),_0x7d1b('0x78'),_0x7d1b('0x79'),_0x7d1b('0x7a'),_0x7d1b('0x7b'),_0x7d1b('0x7c'),_0x7d1b('0x7d'),_0x7d1b('0x7e'),_0x7d1b('0x7f'),_0x7d1b('0x80'),_0x7d1b('0x81'),_0x7d1b('0x82')];}_0x12aa3f(_0x1e04db);}catch(_0x515c21){_0x3b8e26(_0x515c21);}});}exports['create']=function(_0x203df0,_0xff2f6b){if(_0x203df0['user'][_0x7d1b('0x29')]===_0x7d1b('0x75'))throw new Error('Unauthorized');if(_0x203df0[_0x7d1b('0x5f')][_0x7d1b('0x29')]===_0x7d1b('0x2c')&&_0x203df0['user'][_0x7d1b('0x29')]!==_0x7d1b('0x2a')){throw new Error(_0x7d1b('0x83'));}if(_0x203df0[_0x7d1b('0x5f')][_0x7d1b('0x29')]===_0x7d1b('0x2a')&&_0x203df0[_0x7d1b('0x2c')][_0x7d1b('0x29')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x7d1b('0x84')]([_0x203df0['body']])[_0x7d1b('0x14')](function(){return validateUser(_0x203df0['body']);})['then'](function(_0x47174b){return updateUser(_0x47174b)[_0x7d1b('0x14')](function(_0x13a0fc){if(_0x13a0fc[_0x7d1b('0x29')]===_0x7d1b('0x2a')){_0x13a0fc['settingsEnabled']=_0x203df0[_0x7d1b('0x2c')]['settingsEnabled'];delete _0x13a0fc['userProfileId'];}return _0x13a0fc;});})[_0x7d1b('0x14')](function(_0x117841){return db[_0x7d1b('0x39')][_0x7d1b('0x85')](_0x117841,{'include':[{'model':db[_0x7d1b('0x73')],'as':_0x7d1b('0x73')}]});})[_0x7d1b('0x14')](function(_0x46de22){if(_0x203df0[_0x7d1b('0x5f')]['role']===_0x7d1b('0x2c'))return _0x46de22;if(_0x203df0[_0x7d1b('0x2c')][_0x7d1b('0x29')]!=='user')return _0x46de22;return db[_0x7d1b('0x86')][_0x7d1b('0x32')]({'where':{'name':_0x46de22['role']===_0x7d1b('0x75')?_0x7d1b('0x2d'):_0x7d1b('0x87'),'userProfileId':_0x203df0[_0x7d1b('0x2c')][_0x7d1b('0x88')]},'raw':!![]})[_0x7d1b('0x14')](function(_0xb65775){if(!_0xb65775||_0xb65775[_0x7d1b('0x89')]!=0x0)return _0x46de22;return db[_0x7d1b('0x34')][_0x7d1b('0x85')]({'name':_0x46de22[_0x7d1b('0x33')],'resourceId':_0x46de22['id'],'type':_0xb65775[_0x7d1b('0x33')],'sectionId':_0xb65775['id']},{})['then'](function(){return _0x46de22;});})[_0x7d1b('0x1c')](function(_0x44478c){logger['error'](_0x7d1b('0x8a'),_0x44478c);throw _0x44478c;});})[_0x7d1b('0x14')](respondWithResult(_0xff2f6b,0xc9))['catch'](handleError(_0xff2f6b,null));};exports[_0x7d1b('0x8b')]=function(_0x2e0a10,_0x470fca){var _0x396ea0=_0x2e0a10[_0x7d1b('0x5f')];var _0x1b79f1=[];if(_0x2e0a10[_0x7d1b('0x2c')][_0x7d1b('0x29')]===_0x7d1b('0x75'))throw new Error('Unauthorized');if(_[_0x7d1b('0x8c')](_0x396ea0,['role',_0x7d1b('0x2c')])&&_0x2e0a10[_0x7d1b('0x2c')][_0x7d1b('0x29')]!==_0x7d1b('0x2a')){throw new Error(_0x7d1b('0x83'));}if(_[_0x7d1b('0x8c')](_0x396ea0,['role','admin'])&&_0x2e0a10['user'][_0x7d1b('0x29')]!==_0x7d1b('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x7d1b('0x84')](_0x396ea0)[_0x7d1b('0x14')](function(){return validateUser(_0x396ea0[0x0]);})[_0x7d1b('0x14')](function(){for(var _0x1645bc=0x1;_0x1645bc<_0x396ea0[_0x7d1b('0x4a')];_0x1645bc++){var _0x3a3cf9=_0x396ea0[_0x1645bc-0x1][_0x7d1b('0x65')];if(!_0x396ea0[_0x1645bc][_0x7d1b('0x65')])_0x396ea0[_0x1645bc][_0x7d1b('0x65')]=_0x3a3cf9+0x1;_0x1b79f1['push'](validateUser(_0x396ea0[_0x1645bc]));}return Promise[_0x7d1b('0x53')](_0x1b79f1);})[_0x7d1b('0x14')](function(){_0x1b79f1=[];for(var _0x547b41=0x0;_0x547b41<_0x396ea0['length'];_0x547b41++){_0x1b79f1[_0x7d1b('0x4b')](updateUser(_0x396ea0[_0x547b41]));}return Promise['all'](_0x1b79f1);})[_0x7d1b('0x14')](function(){_0x1b79f1=_0x396ea0[_0x7d1b('0x3a')](function(_0x3e0098){return db[_0x7d1b('0x39')]['create'](_0x3e0098,{'include':[{'model':db[_0x7d1b('0x73')],'as':_0x7d1b('0x73')}]})[_0x7d1b('0x14')](function(_0x5512db){_0x3e0098['id']=_0x5512db['id'];return _0x3e0098;});});return Promise[_0x7d1b('0x53')](_0x1b79f1);})[_0x7d1b('0x14')](function(_0x3bfa55){if(_0x2e0a10['body'][_0x7d1b('0x29')]==='user')return _0x3bfa55;if(_0x2e0a10[_0x7d1b('0x2c')]['role']!=='user')return _0x3bfa55;var _0x5292fd=_['some'](_0x3bfa55,function(_0x49fe1d){return _0x49fe1d['role']===_0x7d1b('0x75')||_0x49fe1d[_0x7d1b('0x29')]===_0x7d1b('0x2e');});if(!_0x5292fd)return _0x3bfa55;return db[_0x7d1b('0x86')][_0x7d1b('0x48')]({'where':{'name':{'$or':[_0x7d1b('0x2d'),_0x7d1b('0x87')]},'userProfileId':_0x2e0a10[_0x7d1b('0x2c')][_0x7d1b('0x88')]},'raw':!![]})[_0x7d1b('0x14')](function(_0xa35c92){if(_[_0x7d1b('0x8d')](_0xa35c92)||!_['some'](_0xa35c92,[_0x7d1b('0x89'),0x0]))return _0x3bfa55;_0x1b79f1=[];var _0x36b2dc=_(_0xa35c92)[_0x7d1b('0x3a')](function(_0x112470){if(_0x112470[_0x7d1b('0x89')]===0x1)return;return _0x112470['name']==='Agents'?'agent':_0x7d1b('0x2e');})[_0x7d1b('0x8e')]()[_0x7d1b('0x31')]();for(var _0x53e645=0x0;_0x53e645<_0x3bfa55['length'];_0x53e645++){if(!_['includes'](_0x36b2dc,_0x3bfa55[_0x53e645]['role']))return;var _0x1c1e3e=_0x3bfa55[_0x53e645][_0x7d1b('0x29')]===_0x7d1b('0x75')?_0x7d1b('0x2d'):'Telephones';_0x1b79f1[_0x7d1b('0x4b')](db[_0x7d1b('0x34')][_0x7d1b('0x85')]({'name':_0x3bfa55[_0x53e645][_0x7d1b('0x33')],'resourceId':_0x3bfa55[_0x53e645]['id'],'type':_0x1c1e3e,'sectionId':_[_0x7d1b('0x32')](_0xa35c92,[_0x7d1b('0x33'),_0x1c1e3e])['id']},{}));}return Promise[_0x7d1b('0x53')](_0x1b79f1);});})[_0x7d1b('0x14')](respondWithResult(_0x470fca,0xc9))[_0x7d1b('0x1c')](handleError(_0x470fca,null));};exports['changePassword']=function(_0x5b0bb1,_0x1adbe7){if(_0x5b0bb1['body']['id']){delete _0x5b0bb1[_0x7d1b('0x5f')]['id'];}return db[_0x7d1b('0x39')][_0x7d1b('0x32')]({'where':{'id':_0x5b0bb1[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](function(_0x110945){if(!_0x110945)return null;if(_0x110945['id']===_0x5b0bb1[_0x7d1b('0x2c')]['id']){if(!_0x5b0bb1[_0x7d1b('0x5f')][_0x7d1b('0x8f')]||!_0x5b0bb1[_0x7d1b('0x5f')][_0x7d1b('0x90')]){throw new db[(_0x7d1b('0x91'))][(_0x7d1b('0x92'))](_0x7d1b('0x93'));}if(!_0x110945[_0x7d1b('0x94')](_0x5b0bb1['body'][_0x7d1b('0x8f')])){throw new db[(_0x7d1b('0x91'))][(_0x7d1b('0x92'))]('Wrong\x20credentials');}if(_0x5b0bb1['body']['oldPassword']===_0x5b0bb1[_0x7d1b('0x5f')][_0x7d1b('0x90')]){throw new db[(_0x7d1b('0x91'))][(_0x7d1b('0x92'))](_0x7d1b('0x95'));}}else if(_0x5b0bb1[_0x7d1b('0x2c')][_0x7d1b('0x29')]===_0x7d1b('0x2a')){if(!_0x5b0bb1['body'][_0x7d1b('0x90')]){throw new db[(_0x7d1b('0x91'))][(_0x7d1b('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x5b0bb1['user'][_0x7d1b('0x29')]===_0x7d1b('0x2c')){if(!_0x5b0bb1['body'][_0x7d1b('0x90')]){throw new db[(_0x7d1b('0x91'))][(_0x7d1b('0x92'))](_0x7d1b('0x96'));}if(_0x110945[_0x7d1b('0x29')]!==_0x7d1b('0x75')){throw new db[(_0x7d1b('0x91'))]['ValidationError'](_0x7d1b('0x97'));}}else{throw new db[(_0x7d1b('0x91'))][(_0x7d1b('0x92'))](_0x7d1b('0x97'));}return _0x110945;})[_0x7d1b('0x14')](handleEntityNotFound(_0x1adbe7,null))[_0x7d1b('0x14')](function(_0x16fb0d){return db['Setting']['findOne']({'attributes':['id','securePassword',_0x7d1b('0x98'),_0x7d1b('0x99')]})[_0x7d1b('0x14')](function(_0xff591f){if(_0xff591f[_0x7d1b('0x67')])authService[_0x7d1b('0x68')](_0x5b0bb1[_0x7d1b('0x5f')][_0x7d1b('0x90')]);if(!_0xff591f[_0x7d1b('0x98')]||!_0x16fb0d[_0x7d1b('0x9a')])return _0x16fb0d;authService['validatePasswordHistory'](_0x5b0bb1['body'][_0x7d1b('0x90')],_0x16fb0d['previousPasswords'],_0xff591f['passwordHistoryLimit']);return _0x16fb0d;})['then'](saveUpdates({'password':_0x5b0bb1[_0x7d1b('0x5f')]['newPassword'],'passwordResetAt':_0x5b0bb1['user']['id']==_0x5b0bb1[_0x7d1b('0x60')]['id']?moment():null,'previousPasswords':authService[_0x7d1b('0x9b')](_0x5b0bb1[_0x7d1b('0x5f')]['newPassword'],_0x16fb0d['previousPasswords'])},null));})[_0x7d1b('0x14')](respondWithResult(_0x1adbe7,null))['catch'](handleError(_0x1adbe7,null));};exports['addQueues']=function(_0x25edf9,_0x34bfca){var _0x1e99b6=_0x25edf9[_0x7d1b('0x5f')]['channel'];return db[_0x7d1b('0x39')]['find']({'where':{'id':_0x25edf9[_0x7d1b('0x60')]['id']},'attributes':['id',_0x7d1b('0x33'),'role','online',_0x7d1b('0x9c'),'voicePause','interface']})[_0x7d1b('0x14')](handleEntityNotFound(_0x34bfca,null))[_0x7d1b('0x14')](function(_0x30dced){if(_0x30dced){if(!utils[_0x7d1b('0x9d')](_0x1e99b6)){throw new db['Sequelize'][(_0x7d1b('0x92'))](_0x7d1b('0x9e'));}return _0x30dced[_0x7d1b('0x9f')+_[_0x7d1b('0xa0')](_0x1e99b6[_0x7d1b('0xa1')]())+'Queues'](_0x25edf9[_0x7d1b('0x5f')][_0x7d1b('0x64')],{'penalty':_0x25edf9[_0x7d1b('0x5f')][_0x7d1b('0xa2')]||0x0})['spread'](function(_0x42aecd){for(var _0x4876ad=0x0;_0x4876ad<_0x25edf9[_0x7d1b('0x5f')][_0x7d1b('0x64')][_0x7d1b('0x4a')];_0x4876ad+=0x1){var _0x3cf194={'UserId':Number(_0x25edf9[_0x7d1b('0x60')]['id'])};_0x3cf194[_[_0x7d1b('0xa0')](_0x1e99b6[_0x7d1b('0xa1')]())+_0x7d1b('0xa3')]=Number(_0x25edf9[_0x7d1b('0x5f')][_0x7d1b('0x64')][_0x4876ad]);socket[_0x7d1b('0xa4')](_0x7d1b('0x2c')+_[_0x7d1b('0xa0')](_0x1e99b6['toLowerCase']())+_0x7d1b('0xa5'),_0x3cf194);}return _0x42aecd;})[_0x7d1b('0x14')](function(){if(_0x1e99b6===_0x7d1b('0xa6')){return db[_0x7d1b('0xa7')][_0x7d1b('0x48')]({'where':{'id':_0x25edf9[_0x7d1b('0x5f')]['ids']||[]},'raw':!![],'attributes':['id',_0x7d1b('0x33')]});}})[_0x7d1b('0x14')](function(_0x2f9694){var _0x57e386=_0x30dced['get']({'plain':!![]});var _0x46ab08=[];if(_0x1e99b6===_0x7d1b('0xa6')&&_0x57e386[_0x7d1b('0x29')]===_0x7d1b('0x75')&&_0x57e386[_0x7d1b('0xa8')]){for(let _0x539023=0x0;_0x539023<_0x2f9694[_0x7d1b('0x4a')];_0x539023+=0x1){_0x46ab08['push']({'membername':_0x57e386[_0x7d1b('0x33')],'UserId':_0x57e386['id'],'queue_name':_0x2f9694[_0x539023]['name'],'VoiceQueueId':_0x2f9694[_0x539023]['id'],'interface':_[_0x7d1b('0x6a')](_0x57e386[_0x7d1b('0xa9')])?util[_0x7d1b('0xaa')](_0x7d1b('0xab'),_0x57e386[_0x7d1b('0x33')]):_0x57e386['interface'],'paused':_0x57e386[_0x7d1b('0xac')]||![],'penalty':_0x25edf9[_0x7d1b('0x5f')]['penalty']||0x0});}return Promise[_0x7d1b('0x53')](_0x46ab08[_0x7d1b('0x3a')](function(_0x18708e){return db[_0x7d1b('0xad')][_0x7d1b('0xae')](_0x18708e);}));}return _0x30dced;});}})['then'](respondWithStatusCode(_0x34bfca,null))[_0x7d1b('0x1c')](handleError(_0x34bfca,null));};exports[_0x7d1b('0xaf')]=function(_0x2b333e,_0x11e00c){var _0x296140,_0x4e7bd6;return db['User'][_0x7d1b('0x32')]({'where':{'id':_0x2b333e[_0x7d1b('0x60')]['id']},'attributes':['id',_0x7d1b('0x33'),_0x7d1b('0x29')]})[_0x7d1b('0x14')](handleEntityNotFound(_0x11e00c,null))[_0x7d1b('0x14')](function(_0x5547e7){if(_0x5547e7){_0x296140=_0x5547e7;if(!_0x2b333e[_0x7d1b('0x42')][_0x7d1b('0xb0')]||!utils['isValidChannel'](_0x2b333e[_0x7d1b('0x42')][_0x7d1b('0xb0')])){throw new db[(_0x7d1b('0x91'))]['ValidationError'](_0x7d1b('0x9e'));}return _0x5547e7[_0x7d1b('0xb1')+_['capitalize'](_0x2b333e[_0x7d1b('0x42')][_0x7d1b('0xb0')]['toLowerCase']())+'Queues'](_0x2b333e[_0x7d1b('0x42')][_0x7d1b('0x64')]);}})[_0x7d1b('0x14')](function(_0x4252a6){if(_[_0x7d1b('0xb2')](_0x2b333e[_0x7d1b('0x42')]['ids'])){for(var _0x24b784=0x0;_0x24b784<_0x2b333e[_0x7d1b('0x42')][_0x7d1b('0x64')][_0x7d1b('0x4a')];_0x24b784+=0x1){_0x4e7bd6={'UserId':Number(_0x2b333e[_0x7d1b('0x60')]['id'])};_0x4e7bd6[_[_0x7d1b('0xa0')](_0x2b333e['query'][_0x7d1b('0xb0')][_0x7d1b('0xa1')]())+_0x7d1b('0xa3')]=Number(_0x2b333e[_0x7d1b('0x42')]['ids'][_0x24b784]);socket[_0x7d1b('0xa4')](_0x7d1b('0x2c')+_[_0x7d1b('0xa0')](_0x2b333e[_0x7d1b('0x42')][_0x7d1b('0xb0')]['toLowerCase']())+_0x7d1b('0xb3'),_0x4e7bd6);}}else{_0x4e7bd6={'UserId':Number(_0x2b333e['params']['id'])};_0x4e7bd6[_[_0x7d1b('0xa0')](_0x2b333e['query'][_0x7d1b('0xb0')][_0x7d1b('0xa1')]())+_0x7d1b('0xa3')]=Number(_0x2b333e[_0x7d1b('0x42')][_0x7d1b('0x64')]);socket[_0x7d1b('0xa4')](_0x7d1b('0x2c')+_['capitalize'](_0x2b333e[_0x7d1b('0x42')][_0x7d1b('0xb0')][_0x7d1b('0xa1')]())+_0x7d1b('0xb3'),_0x4e7bd6);}return _0x4252a6;})['then'](function(){if(_0x2b333e[_0x7d1b('0x42')]['channel']===_0x7d1b('0xa6')){return db[_0x7d1b('0xad')][_0x7d1b('0x27')]({'where':{'UserId':_0x2b333e[_0x7d1b('0x60')]['id'],'VoiceQueueId':_0x2b333e[_0x7d1b('0x42')][_0x7d1b('0x64')]},'individualHooks':!![]})[_0x7d1b('0x14')](function(){return _0x296140;});}return _0x296140;})[_0x7d1b('0x14')](respondWithStatusCode(_0x11e00c,null))['catch'](handleError(_0x11e00c,null));};exports['addAvatar']=function(_0x567b34,_0x4c691c){_0x567b34['body'][_0x7d1b('0xb4')]=_0x567b34['file'][_0x7d1b('0xb5')];return db['User'][_0x7d1b('0x32')]({'where':{'id':_0x567b34[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x4c691c,null))['then'](saveUpdates(_0x567b34[_0x7d1b('0x5f')],null))[_0x7d1b('0x14')](respondWithResult(_0x4c691c,null))['catch'](handleError(_0x4c691c,null));};exports[_0x7d1b('0xb6')]=function(_0x1453c9,_0x193fa5){var _0x2c53b1=path['join'](config[_0x7d1b('0xb7')],_0x7d1b('0xb8'));return db[_0x7d1b('0x39')][_0x7d1b('0x32')]({'where':{'id':_0x1453c9[_0x7d1b('0x60')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x7d1b('0x14')](handleEntityNotFound(_0x193fa5,null))[_0x7d1b('0x14')](function(_0x15fa5e){if(_0x15fa5e){if(_[_0x7d1b('0x6a')](_0x15fa5e[_0x7d1b('0xb4')])){return _0x193fa5['download'](_0x2c53b1);}else{if(!fs['existsSync'](path[_0x7d1b('0xb9')](config[_0x7d1b('0xb7')],_0x7d1b('0xba'),_0x15fa5e[_0x7d1b('0xb4')]))){return _0x193fa5[_0x7d1b('0xbb')](_0x2c53b1);}return _0x193fa5['download'](path['join'](config[_0x7d1b('0xb7')],_0x7d1b('0xba'),_0x15fa5e[_0x7d1b('0xb4')]));}}})[_0x7d1b('0x1c')](handleError(_0x193fa5,null));};exports[_0x7d1b('0xbc')]=function(_0x29d69d,_0x3d9809){return db[_0x7d1b('0x39')][_0x7d1b('0x32')]({'where':{'id':_0x29d69d['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3d9809,null))['then'](function(_0x42cd1d){var _0x28a018=[];values=_0x42cd1d[_0x7d1b('0x4d')];_0x28a018[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x4c'),_0x42cd1d[_0x7d1b('0x4d')]));_0x28a018[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x4e'),_0x42cd1d[_0x7d1b('0x4d')]));_0x28a018['push'](get_open_tabs('openchannel',_0x42cd1d['dataValues']));_0x28a018['push'](get_open_tabs(_0x7d1b('0x52'),_0x42cd1d['dataValues']));_0x28a018['push'](get_open_tabs(_0x7d1b('0x4f'),_0x42cd1d[_0x7d1b('0x4d')]));_0x28a018[_0x7d1b('0x4b')](get_open_tabs(_0x7d1b('0x50'),_0x42cd1d['dataValues']));return Promise['all'](_0x28a018);})[_0x7d1b('0x14')](function(_0x38057c){if(_0x38057c){var _0x136677=_[_0x7d1b('0x3a')](values[_0x7d1b('0xbd')],function(_0xe827dd){return{'channel':_0x7d1b('0xbe'),'id':_0xe827dd['id'],'createdAt':_0xe827dd[_0x7d1b('0xbf')]};});var _0x5df788=_[_0x7d1b('0x3a')](values[_0x7d1b('0xc0')],function(_0x48687d){return{'channel':_0x7d1b('0xc1'),'id':_0x48687d['id'],'createdAt':_0x48687d[_0x7d1b('0xbf')]};});var _0x93a04b=_[_0x7d1b('0x3a')](values[_0x7d1b('0xc2')],function(_0x1bfe54){return{'channel':_0x7d1b('0xc3'),'id':_0x1bfe54['id'],'createdAt':_0x1bfe54[_0x7d1b('0xbf')]};});var _0x126939=_['map'](values['MailOpenTabs'],function(_0x23a84c){return{'channel':_0x7d1b('0xc4'),'id':_0x23a84c['id'],'createdAt':_0x23a84c[_0x7d1b('0xbf')]};});var _0x190d0f=_['map'](values[_0x7d1b('0xc5')],function(_0x392f60){return{'channel':_0x7d1b('0xc6'),'id':_0x392f60['id'],'createdAt':_0x392f60[_0x7d1b('0xbf')]};});var _0x2ea12a=_[_0x7d1b('0x3a')](values[_0x7d1b('0xc7')],function(_0x38e2f5){return{'channel':_0x7d1b('0xc8'),'id':_0x38e2f5['id'],'createdAt':_0x38e2f5['createdAt']};});var _0xec89e=_[_0x7d1b('0xc9')](_0x136677,_0x5df788,_0x93a04b,_0x126939,_0x190d0f,_0x2ea12a);var _0x5f3ebc={'count':_0xec89e[_0x7d1b('0x4a')],'rows':_0xec89e};return _0x5f3ebc;}else return null;})[_0x7d1b('0x14')](respondWithResult(_0x3d9809,null))[_0x7d1b('0x1c')](handleError(_0x3d9809,null));};exports[_0x7d1b('0xca')]=function(_0x444f9a,_0x2d1460){var _0xea7ef7={};var _0x11c754={};var _0x548e41;var _0x4c85df;return db['User'][_0x7d1b('0xcb')]({'where':{'id':_0x444f9a[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x2d1460,null))[_0x7d1b('0x14')](function(_0x5ce62e){if(_0x5ce62e){_0x548e41=_0x5ce62e;_0x11c754[_0x7d1b('0x55')]=_[_0x7d1b('0x57')](db[_0x7d1b('0xcc')][_0x7d1b('0x58')]);_0x11c754[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x444f9a[_0x7d1b('0x42')]);_0x11c754[_0x7d1b('0xcd')]=_['intersection'](_0x11c754['model'],_0x11c754[_0x7d1b('0x42')]);_0xea7ef7[_0x7d1b('0x47')]=_[_0x7d1b('0x59')](_0x11c754[_0x7d1b('0x55')],qs[_0x7d1b('0x5a')](_0x444f9a[_0x7d1b('0x42')]['fields']));_0xea7ef7[_0x7d1b('0x47')]=_0xea7ef7[_0x7d1b('0x47')][_0x7d1b('0x4a')]?_0xea7ef7[_0x7d1b('0x47')]:_0x11c754['model'];_0xea7ef7[_0x7d1b('0xce')]=qs['sort'](_0x444f9a['query'][_0x7d1b('0xcf')]);_0xea7ef7[_0x7d1b('0x41')]=qs['filters'](_['pick'](_0x444f9a[_0x7d1b('0x42')],_0x11c754[_0x7d1b('0xcd')]));if(_0x444f9a[_0x7d1b('0x42')][_0x7d1b('0x2f')]){_0xea7ef7[_0x7d1b('0x41')]=_[_0x7d1b('0x5c')](_0xea7ef7[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0xea7ef7['attributes'],function(_0x15fb40){var _0x241b30={};_0x241b30[_0x15fb40]={'$like':'%'+_0x444f9a[_0x7d1b('0x42')]['filter']+'%'};return _0x241b30;})});}_0xea7ef7=_[_0x7d1b('0x5c')]({},_0xea7ef7,_0x444f9a[_0x7d1b('0x5d')]);return _0x548e41[_0x7d1b('0xca')](_0xea7ef7);}})[_0x7d1b('0x14')](function(_0x2f3313){if(_0x2f3313){_0x4c85df=_0x2f3313['length'];if(_0x444f9a[_0x7d1b('0x42')][_0x7d1b('0xd0')](_0x7d1b('0x43'))){_0xea7ef7['include']=[{'model':db['CmList'],'as':_0x7d1b('0xd1'),'required':![]},{'model':db[_0x7d1b('0xd2')],'as':_0x7d1b('0xd3'),'attributes':['id',_0x7d1b('0x33'),'color'],'where':_0x444f9a['query']['tag']?{'id':_0x444f9a[_0x7d1b('0x42')][_0x7d1b('0xd4')]}:undefined,'required':_0x444f9a['query'][_0x7d1b('0xd4')]?!![]:![]}];}if(!_0x444f9a[_0x7d1b('0x42')][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0xea7ef7[_0x7d1b('0x23')]=qs[_0x7d1b('0x23')](_0x444f9a[_0x7d1b('0x42')][_0x7d1b('0x23')]);_0xea7ef7[_0x7d1b('0x20')]=qs[_0x7d1b('0x20')](_0x444f9a[_0x7d1b('0x42')][_0x7d1b('0x20')]);}return _0x548e41['getContacts'](_0xea7ef7);}})[_0x7d1b('0x14')](function(_0x3e1c2b){if(_0x3e1c2b){return _0x3e1c2b?{'count':_0x4c85df,'rows':_0x3e1c2b}:null;}})[_0x7d1b('0x14')](respondWithResult(_0x2d1460,null))['catch'](handleError(_0x2d1460,null));};exports[_0x7d1b('0xd6')]=function(_0x1841b6,_0x4a82f2){var _0x92b250;var _0x5081e3={};var _0x574c92;return db[_0x7d1b('0x39')]['findOne']({'where':{'id':_0x1841b6[_0x7d1b('0x60')]['id']},'attributes':['id','name',_0x7d1b('0x29')]})[_0x7d1b('0x14')](handleEntityNotFound(_0x4a82f2,null))[_0x7d1b('0x14')](function(_0x3962d7){if(!utils['isValidChannel'](_0x1841b6[_0x7d1b('0x42')][_0x7d1b('0xb0')])){throw new db[(_0x7d1b('0x91'))][(_0x7d1b('0x92'))]('Unknown\x20channel');}_0x92b250=_0x3962d7;var _0x1512e5={};_0x1512e5['model']=_[_0x7d1b('0x57')](db[_[_0x7d1b('0xa0')](_0x1841b6['query'][_0x7d1b('0xb0')])+'Queue'][_0x7d1b('0x58')]);_0x1512e5[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x1841b6['query']);_0x1512e5['filters']=_[_0x7d1b('0x59')](_0x1512e5[_0x7d1b('0x55')],_0x1512e5[_0x7d1b('0x42')]);_0x5081e3[_0x7d1b('0x47')]=_[_0x7d1b('0x59')](_0x1512e5[_0x7d1b('0x55')],qs['fields'](_0x1841b6['query'][_0x7d1b('0x5a')]));_0x5081e3[_0x7d1b('0x47')]=_0x5081e3[_0x7d1b('0x47')][_0x7d1b('0x4a')]?_0x5081e3[_0x7d1b('0x47')]:_0x1512e5[_0x7d1b('0x55')];_0x5081e3[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x1841b6[_0x7d1b('0x42')][_0x7d1b('0xcf')]);_0x5081e3[_0x7d1b('0x41')]=qs[_0x7d1b('0xcd')](_['pick'](_0x1841b6[_0x7d1b('0x42')],_0x1512e5[_0x7d1b('0xcd')]));if(_0x1841b6[_0x7d1b('0x42')][_0x7d1b('0x2f')]){_0x5081e3[_0x7d1b('0x41')]=_[_0x7d1b('0x5c')](_0x5081e3[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0x5081e3[_0x7d1b('0x47')],function(_0x2a8d26){var _0x20354d={};_0x20354d[_0x2a8d26]={'$like':'%'+_0x1841b6[_0x7d1b('0x42')][_0x7d1b('0x2f')]+'%'};return _0x20354d;})});}_0x5081e3=_[_0x7d1b('0x5c')]({},_0x5081e3,_0x1841b6[_0x7d1b('0x5d')]);switch(_0x92b250[_0x7d1b('0x29')]){case'admin':return db[_[_0x7d1b('0xa0')](_0x1841b6['query'][_0x7d1b('0xb0')])+_0x7d1b('0xd7')][_0x7d1b('0x48')](_0x5081e3);case'user':case _0x7d1b('0x75'):return _0x92b250[_0x7d1b('0x28')+_[_0x7d1b('0xa0')](_0x1841b6[_0x7d1b('0x42')][_0x7d1b('0xb0')])+_0x7d1b('0xd8')](_0x5081e3);default:throw new db['Sequelize'][(_0x7d1b('0x92'))](_0x7d1b('0xd9'));}})[_0x7d1b('0x14')](function(_0x2facc1){_0x574c92=_0x2facc1[_0x7d1b('0x4a')];if(!_0x1841b6['query'][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0x5081e3['limit']=qs['limit'](_0x1841b6['query'][_0x7d1b('0x23')]);_0x5081e3[_0x7d1b('0x20')]=qs['offset'](_0x1841b6[_0x7d1b('0x42')]['offset']);}switch(_0x92b250[_0x7d1b('0x29')]){case _0x7d1b('0x2a'):return db[_['capitalize'](_0x1841b6['query'][_0x7d1b('0xb0')])+'Queue'][_0x7d1b('0x48')](_0x5081e3);case _0x7d1b('0x2c'):case _0x7d1b('0x75'):return _0x92b250[_0x7d1b('0x28')+_['capitalize'](_0x1841b6[_0x7d1b('0x42')][_0x7d1b('0xb0')])+_0x7d1b('0xd8')](_0x5081e3);}})[_0x7d1b('0x14')](function(_0x7b1ec2){return{'count':_0x574c92,'rows':_0x7b1ec2};})[_0x7d1b('0x14')](respondWithResult(_0x4a82f2,null))[_0x7d1b('0x1c')](handleError(_0x4a82f2,null));};exports['getVoiceQueuesRt']=function(_0x2ee867,_0x1b490d){var _0x186d42={};var _0x2dd6a1={};var _0x25a08d;var _0x3e3c60;return db[_0x7d1b('0x39')][_0x7d1b('0xcb')]({'where':{'id':_0x2ee867[_0x7d1b('0x60')]['id']}})['then'](handleEntityNotFound(_0x1b490d,null))[_0x7d1b('0x14')](function(_0x4c313b){if(_0x4c313b){_0x25a08d=_0x4c313b;_0x2dd6a1['model']=_['keys'](db[_0x7d1b('0xad')][_0x7d1b('0x58')]);_0x2dd6a1[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x2ee867[_0x7d1b('0x42')]);_0x2dd6a1['filters']=_['intersection'](_0x2dd6a1['model'],_0x2dd6a1[_0x7d1b('0x42')]);_0x186d42[_0x7d1b('0x47')]=_[_0x7d1b('0x59')](_0x2dd6a1['model'],qs[_0x7d1b('0x5a')](_0x2ee867[_0x7d1b('0x42')][_0x7d1b('0x5a')]));_0x186d42['attributes']=_0x186d42[_0x7d1b('0x47')][_0x7d1b('0x4a')]?_0x186d42['attributes']:_0x2dd6a1[_0x7d1b('0x55')];_0x186d42[_0x7d1b('0xce')]=qs['sort'](_0x2ee867['query'][_0x7d1b('0xcf')]);_0x186d42[_0x7d1b('0x41')]=qs['filters'](_[_0x7d1b('0xda')](_0x2ee867[_0x7d1b('0x42')],_0x2dd6a1['filters']));if(_0x2ee867[_0x7d1b('0x42')]['filter']){_0x186d42[_0x7d1b('0x41')]=_['merge'](_0x186d42[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0x186d42[_0x7d1b('0x47')],function(_0x565c85){var _0x20108e={};_0x20108e[_0x565c85]={'$like':'%'+_0x2ee867[_0x7d1b('0x42')][_0x7d1b('0x2f')]+'%'};return _0x20108e;})});}_0x186d42=_[_0x7d1b('0x5c')]({},_0x186d42,_0x2ee867[_0x7d1b('0x5d')]);return _0x25a08d[_0x7d1b('0xdb')](_0x186d42);}})['then'](function(_0x19095c){if(_0x19095c){_0x3e3c60=_0x19095c[_0x7d1b('0x4a')];if(!_0x2ee867[_0x7d1b('0x42')]['hasOwnProperty'](_0x7d1b('0xd5'))){_0x186d42[_0x7d1b('0x23')]=qs['limit'](_0x2ee867[_0x7d1b('0x42')]['limit']);_0x186d42[_0x7d1b('0x20')]=qs[_0x7d1b('0x20')](_0x2ee867['query'][_0x7d1b('0x20')]);}return _0x25a08d['getVoiceQueuesRt'](_0x186d42);}})[_0x7d1b('0x14')](function(_0x3b26e7){if(_0x3b26e7){return _0x3b26e7?{'count':_0x3e3c60,'rows':_0x3b26e7}:null;}})[_0x7d1b('0x14')](respondWithResult(_0x1b490d,null))[_0x7d1b('0x1c')](handleError(_0x1b490d,null));};exports[_0x7d1b('0xdc')]=function(_0x3fe9d5,_0x5551ee){var _0x260df0={};var _0x1e858e={};var _0x34159f;var _0x5f4611;return db[_0x7d1b('0x39')][_0x7d1b('0xcb')]({'where':{'id':_0x3fe9d5[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x5551ee,null))['then'](function(_0x3fd211){if(_0x3fd211){_0x34159f=_0x3fd211;_0x1e858e[_0x7d1b('0x55')]=_['keys'](db[_0x7d1b('0xdd')][_0x7d1b('0x58')]);_0x1e858e[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x3fe9d5[_0x7d1b('0x42')]);_0x1e858e['filters']=_[_0x7d1b('0x59')](_0x1e858e[_0x7d1b('0x55')],_0x1e858e[_0x7d1b('0x42')]);_0x260df0[_0x7d1b('0x47')]=_[_0x7d1b('0x59')](_0x1e858e[_0x7d1b('0x55')],qs[_0x7d1b('0x5a')](_0x3fe9d5[_0x7d1b('0x42')][_0x7d1b('0x5a')]));_0x260df0[_0x7d1b('0x47')]=_0x260df0[_0x7d1b('0x47')][_0x7d1b('0x4a')]?_0x260df0[_0x7d1b('0x47')]:_0x1e858e[_0x7d1b('0x55')];_0x260df0['order']=qs['sort'](_0x3fe9d5[_0x7d1b('0x42')][_0x7d1b('0xcf')]);_0x260df0['where']=qs['filters'](_['pick'](_0x3fe9d5[_0x7d1b('0x42')],_0x1e858e[_0x7d1b('0xcd')]));if(_0x3fe9d5['query'][_0x7d1b('0x2f')]){_0x260df0['where']=_['merge'](_0x260df0[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0x260df0[_0x7d1b('0x47')],function(_0x58a240){var _0x2c0281={};_0x2c0281[_0x58a240]={'$like':'%'+_0x3fe9d5[_0x7d1b('0x42')][_0x7d1b('0x2f')]+'%'};return _0x2c0281;})});}_0x260df0=_[_0x7d1b('0x5c')]({},_0x260df0,_0x3fe9d5[_0x7d1b('0x5d')]);return _0x34159f['getGroups'](_0x260df0);}})[_0x7d1b('0x14')](function(_0x380e88){if(_0x380e88){_0x5f4611=_0x380e88[_0x7d1b('0x4a')];if(!_0x3fe9d5['query']['hasOwnProperty']('nolimit')){_0x260df0[_0x7d1b('0x23')]=qs[_0x7d1b('0x23')](_0x3fe9d5[_0x7d1b('0x42')][_0x7d1b('0x23')]);_0x260df0[_0x7d1b('0x20')]=qs['offset'](_0x3fe9d5['query']['offset']);}return _0x34159f[_0x7d1b('0xdc')](_0x260df0);}})[_0x7d1b('0x14')](function(_0x2b3c71){if(_0x2b3c71){return _0x2b3c71?{'count':_0x5f4611,'rows':_0x2b3c71}:null;}})[_0x7d1b('0x14')](respondWithResult(_0x5551ee,null))[_0x7d1b('0x1c')](handleError(_0x5551ee,null));};exports[_0x7d1b('0xde')]=function(_0x4a5ebe,_0x1e2583){var _0x12a3d9={'raw':!![],'where':{}};var _0x6b5cdd={};var _0x530b41={'count':0x0,'rows':[]};return db['User'][_0x7d1b('0xcb')]({'where':{'id':_0x4a5ebe[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x1e2583,null))[_0x7d1b('0x14')](function(_0x1f2a65){if(_0x1f2a65){_0x6b5cdd['model']=_[_0x7d1b('0x57')](db[_0x7d1b('0xdf')][_0x7d1b('0x58')]);_0x6b5cdd[_0x7d1b('0x42')]=_['keys'](_0x4a5ebe['query']);_0x6b5cdd[_0x7d1b('0xcd')]=_['intersection'](_0x6b5cdd[_0x7d1b('0x55')],_0x6b5cdd['query']);_0x12a3d9[_0x7d1b('0x47')]=_['intersection'](_0x6b5cdd[_0x7d1b('0x55')],qs[_0x7d1b('0x5a')](_0x4a5ebe['query'][_0x7d1b('0x5a')]));_0x12a3d9[_0x7d1b('0x47')]=_0x12a3d9[_0x7d1b('0x47')]['length']?_0x12a3d9[_0x7d1b('0x47')]:_0x6b5cdd['model'];if(!_0x4a5ebe[_0x7d1b('0x42')][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0x12a3d9['limit']=qs[_0x7d1b('0x23')](_0x4a5ebe['query']['limit']);_0x12a3d9[_0x7d1b('0x20')]=qs[_0x7d1b('0x20')](_0x4a5ebe['query'][_0x7d1b('0x20')]);}_0x12a3d9[_0x7d1b('0xce')]=qs['sort'](_0x4a5ebe[_0x7d1b('0x42')][_0x7d1b('0xcf')]);_0x12a3d9[_0x7d1b('0x41')]=qs[_0x7d1b('0xcd')](_[_0x7d1b('0xda')](_0x4a5ebe[_0x7d1b('0x42')],_0x6b5cdd['filters']));_0x12a3d9['where'][_0x7d1b('0xe0')]=_0x1f2a65['id'];if(_0x4a5ebe[_0x7d1b('0x42')][_0x7d1b('0x2f')]){_0x12a3d9[_0x7d1b('0x41')]=_[_0x7d1b('0x5c')](_0x12a3d9[_0x7d1b('0x41')],{'$or':_['map'](_0x12a3d9[_0x7d1b('0x47')],function(_0x1d234c){var _0x395249={};_0x395249[_0x1d234c]={'$like':'%'+_0x4a5ebe['query'][_0x7d1b('0x2f')]+'%'};return _0x395249;})});}_0x12a3d9=_[_0x7d1b('0x5c')]({},_0x12a3d9,_0x4a5ebe[_0x7d1b('0x5d')]);return db['VoiceRecording'][_0x7d1b('0x22')]({'where':_0x12a3d9[_0x7d1b('0x41')]})[_0x7d1b('0x14')](function(_0x3e83aa){_0x530b41[_0x7d1b('0x22')]=_0x3e83aa;if(_0x4a5ebe['query']['includeAll']){_0x12a3d9[_0x7d1b('0x44')]=[{'all':!![]}];}return db[_0x7d1b('0xdf')][_0x7d1b('0x48')](_0x12a3d9);})[_0x7d1b('0x14')](function(_0x4ac73a){_0x530b41['rows']=_0x4ac73a;return _0x530b41;});}})['then'](respondWithFilteredResult(_0x1e2583,_0x12a3d9))['catch'](handleError(_0x1e2583,null));};exports[_0x7d1b('0xe1')]=function(_0x3b8c75,_0x4cdff7){var _0x230811={'raw':!![],'where':{}};var _0x54c0e9={};var _0x3fbaf6={'count':0x0,'rows':[]};return db['User'][_0x7d1b('0xcb')]({'where':{'id':_0x3b8c75[_0x7d1b('0x60')]['id']}})['then'](handleEntityNotFound(_0x4cdff7,null))[_0x7d1b('0x14')](function(_0x54b9b6){if(_0x54b9b6){_0x54c0e9[_0x7d1b('0x55')]=_['keys'](db[_0x7d1b('0xe2')][_0x7d1b('0x58')]);_0x54c0e9[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x3b8c75[_0x7d1b('0x42')]);_0x54c0e9[_0x7d1b('0xcd')]=_[_0x7d1b('0x59')](_0x54c0e9[_0x7d1b('0x55')],_0x54c0e9[_0x7d1b('0x42')]);_0x230811[_0x7d1b('0x47')]=_[_0x7d1b('0x59')](_0x54c0e9[_0x7d1b('0x55')],qs[_0x7d1b('0x5a')](_0x3b8c75[_0x7d1b('0x42')][_0x7d1b('0x5a')]));_0x230811[_0x7d1b('0x47')]=_0x230811[_0x7d1b('0x47')][_0x7d1b('0x4a')]?_0x230811['attributes']:_0x54c0e9[_0x7d1b('0x55')];if(!_0x3b8c75['query'][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0x230811['limit']=qs[_0x7d1b('0x23')](_0x3b8c75['query']['limit']);_0x230811['offset']=qs[_0x7d1b('0x20')](_0x3b8c75[_0x7d1b('0x42')][_0x7d1b('0x20')]);}_0x230811[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x3b8c75[_0x7d1b('0x42')]['sort']);_0x230811[_0x7d1b('0x41')]=qs[_0x7d1b('0xcd')](_[_0x7d1b('0xda')](_0x3b8c75[_0x7d1b('0x42')],_0x54c0e9[_0x7d1b('0xcd')]));_0x230811[_0x7d1b('0x41')][_0x7d1b('0xe0')]=_0x54b9b6['id'];if(_0x3b8c75[_0x7d1b('0x42')]['filter']){_0x230811[_0x7d1b('0x41')]=_[_0x7d1b('0x5c')](_0x230811['where'],{'$or':_[_0x7d1b('0x3a')](_0x230811[_0x7d1b('0x47')],function(_0x2a9b69){var _0x5bb256={};_0x5bb256[_0x2a9b69]={'$like':'%'+_0x3b8c75[_0x7d1b('0x42')][_0x7d1b('0x2f')]+'%'};return _0x5bb256;})});}_0x230811=_[_0x7d1b('0x5c')]({},_0x230811,_0x3b8c75['options']);return db[_0x7d1b('0xe2')]['count']({'where':_0x230811[_0x7d1b('0x41')]})[_0x7d1b('0x14')](function(_0x2f2850){_0x3fbaf6[_0x7d1b('0x22')]=_0x2f2850;if(_0x3b8c75[_0x7d1b('0x42')][_0x7d1b('0x43')]){_0x230811[_0x7d1b('0x44')]=[{'all':!![]}];}return db[_0x7d1b('0xe2')][_0x7d1b('0x48')](_0x230811);})[_0x7d1b('0x14')](function(_0x1a24b5){_0x3fbaf6[_0x7d1b('0x49')]=_0x1a24b5;return _0x3fbaf6;});}})[_0x7d1b('0x14')](respondWithFilteredResult(_0x4cdff7,_0x230811))[_0x7d1b('0x1c')](handleError(_0x4cdff7,null));};exports['getChatInteractions']=function(_0x13305f,_0x196321){var _0x48537b={};var _0xc0e6a1={};var _0x4a68db;var _0x284776;return db['User'][_0x7d1b('0xcb')]({'where':{'id':_0x13305f[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x196321,null))[_0x7d1b('0x14')](function(_0x7dfe0a){if(_0x7dfe0a){_0x4a68db=_0x7dfe0a;_0xc0e6a1[_0x7d1b('0x55')]=_['keys'](db[_0x7d1b('0xe3')][_0x7d1b('0x58')]);_0xc0e6a1[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x13305f['query']);_0xc0e6a1['filters']=_[_0x7d1b('0x59')](_0xc0e6a1['model'],_0xc0e6a1[_0x7d1b('0x42')]);_0x48537b['attributes']=_[_0x7d1b('0x59')](_0xc0e6a1[_0x7d1b('0x55')],qs[_0x7d1b('0x5a')](_0x13305f['query'][_0x7d1b('0x5a')]));_0x48537b[_0x7d1b('0x47')]=_0x48537b['attributes'][_0x7d1b('0x4a')]?_0x48537b[_0x7d1b('0x47')]:_0xc0e6a1[_0x7d1b('0x55')];_0x48537b[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x13305f[_0x7d1b('0x42')][_0x7d1b('0xcf')]);_0x48537b[_0x7d1b('0x41')]=qs[_0x7d1b('0xcd')](_[_0x7d1b('0xda')](_0x13305f[_0x7d1b('0x42')],_0xc0e6a1[_0x7d1b('0xcd')]));if(_0x13305f[_0x7d1b('0x42')][_0x7d1b('0x2f')]){_0x48537b[_0x7d1b('0x41')]=_[_0x7d1b('0x5c')](_0x48537b[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0x48537b[_0x7d1b('0x47')],function(_0x1d749c){var _0xe8b3eb={};_0xe8b3eb[_0x1d749c]={'$like':'%'+_0x13305f['query'][_0x7d1b('0x2f')]+'%'};return _0xe8b3eb;})});}_0x48537b=_[_0x7d1b('0x5c')]({},_0x48537b,_0x13305f[_0x7d1b('0x5d')]);return _0x4a68db[_0x7d1b('0xe4')](_0x48537b);}})[_0x7d1b('0x14')](function(_0x47be96){if(_0x47be96){_0x284776=_0x47be96['length'];if(!_0x13305f['query'][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0x48537b['limit']=qs[_0x7d1b('0x23')](_0x13305f[_0x7d1b('0x42')][_0x7d1b('0x23')]);_0x48537b['offset']=qs[_0x7d1b('0x20')](_0x13305f[_0x7d1b('0x42')][_0x7d1b('0x20')]);}return _0x4a68db[_0x7d1b('0xe4')](_0x48537b);}})['then'](function(_0x5f5925){if(_0x5f5925){return _0x5f5925?{'count':_0x284776,'rows':_0x5f5925}:null;}})['then'](respondWithResult(_0x196321,null))[_0x7d1b('0x1c')](handleError(_0x196321,null));};exports[_0x7d1b('0xe5')]=function(_0x3e18d2,_0x5d2dd5){var _0xaf8a5d={};var _0xe6d27c={};var _0x540778;var _0x4f787f;return db[_0x7d1b('0x39')][_0x7d1b('0xcb')]({'where':{'id':_0x3e18d2[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x5d2dd5,null))[_0x7d1b('0x14')](function(_0x273e97){if(_0x273e97){_0x540778=_0x273e97;_0xe6d27c['model']=_[_0x7d1b('0x57')](db[_0x7d1b('0xe6')]['rawAttributes']);_0xe6d27c[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x3e18d2[_0x7d1b('0x42')]);_0xe6d27c[_0x7d1b('0xcd')]=_[_0x7d1b('0x59')](_0xe6d27c[_0x7d1b('0x55')],_0xe6d27c[_0x7d1b('0x42')]);_0xaf8a5d['attributes']=_[_0x7d1b('0x59')](_0xe6d27c[_0x7d1b('0x55')],qs['fields'](_0x3e18d2[_0x7d1b('0x42')]['fields']));_0xaf8a5d[_0x7d1b('0x47')]=_0xaf8a5d[_0x7d1b('0x47')][_0x7d1b('0x4a')]?_0xaf8a5d['attributes']:_0xe6d27c[_0x7d1b('0x55')];_0xaf8a5d[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x3e18d2[_0x7d1b('0x42')]['sort']);_0xaf8a5d[_0x7d1b('0x41')]=qs['filters'](_['pick'](_0x3e18d2[_0x7d1b('0x42')],_0xe6d27c['filters']));if(_0x3e18d2[_0x7d1b('0x42')][_0x7d1b('0x2f')]){_0xaf8a5d[_0x7d1b('0x41')]=_['merge'](_0xaf8a5d[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0xaf8a5d[_0x7d1b('0x47')],function(_0xcb1727){var _0x106876={};_0x106876[_0xcb1727]={'$like':'%'+_0x3e18d2[_0x7d1b('0x42')]['filter']+'%'};return _0x106876;})});}_0xaf8a5d=_[_0x7d1b('0x5c')]({},_0xaf8a5d,_0x3e18d2[_0x7d1b('0x5d')]);return _0x540778[_0x7d1b('0xe5')](_0xaf8a5d);}})['then'](function(_0x222ed8){if(_0x222ed8){_0x4f787f=_0x222ed8[_0x7d1b('0x4a')];if(!_0x3e18d2[_0x7d1b('0x42')][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0xaf8a5d['limit']=qs[_0x7d1b('0x23')](_0x3e18d2[_0x7d1b('0x42')]['limit']);_0xaf8a5d[_0x7d1b('0x20')]=qs[_0x7d1b('0x20')](_0x3e18d2['query'][_0x7d1b('0x20')]);}return _0x540778['getOpenchannelInteractions'](_0xaf8a5d);}})[_0x7d1b('0x14')](function(_0x1f7b1c){if(_0x1f7b1c){return _0x1f7b1c?{'count':_0x4f787f,'rows':_0x1f7b1c}:null;}})['then'](respondWithResult(_0x5d2dd5,null))[_0x7d1b('0x1c')](handleError(_0x5d2dd5,null));};exports['getMailInteractions']=function(_0x12b839,_0x531a31){var _0x3dd405={'raw':!![],'where':{}};var _0x540732={};var _0x59b7c2={'count':0x0,'rows':[]};return db['User'][_0x7d1b('0xcb')]({'where':{'id':_0x12b839[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x531a31,null))[_0x7d1b('0x14')](function(_0x550dbc){if(_0x550dbc){_0x540732[_0x7d1b('0x55')]=_[_0x7d1b('0x57')](db[_0x7d1b('0xe7')][_0x7d1b('0x58')]);_0x540732[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x12b839[_0x7d1b('0x42')]);_0x540732[_0x7d1b('0xcd')]=_[_0x7d1b('0x59')](_0x540732[_0x7d1b('0x55')],_0x540732['query']);_0x3dd405[_0x7d1b('0x47')]=_[_0x7d1b('0x59')](_0x540732[_0x7d1b('0x55')],qs['fields'](_0x12b839[_0x7d1b('0x42')][_0x7d1b('0x5a')]));_0x3dd405[_0x7d1b('0x47')]=_0x3dd405['attributes'][_0x7d1b('0x4a')]?_0x3dd405[_0x7d1b('0x47')]:_0x540732[_0x7d1b('0x55')];if(!_0x12b839[_0x7d1b('0x42')][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0x3dd405[_0x7d1b('0x23')]=qs['limit'](_0x12b839['query']['limit']);_0x3dd405[_0x7d1b('0x20')]=qs[_0x7d1b('0x20')](_0x12b839['query'][_0x7d1b('0x20')]);}_0x3dd405[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x12b839[_0x7d1b('0x42')][_0x7d1b('0xcf')]);_0x3dd405[_0x7d1b('0x41')]=qs['filters'](_[_0x7d1b('0xda')](_0x12b839[_0x7d1b('0x42')],_0x540732['filters']));_0x3dd405['where'][_0x7d1b('0xe0')]=_0x550dbc['id'];if(_0x12b839[_0x7d1b('0x42')]['filter']){_0x3dd405[_0x7d1b('0x41')]=_[_0x7d1b('0x5c')](_0x3dd405[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0x3dd405[_0x7d1b('0x47')],function(_0x3dcb96){var _0x13db06={};_0x13db06[_0x3dcb96]={'$like':'%'+_0x12b839[_0x7d1b('0x42')]['filter']+'%'};return _0x13db06;})});}_0x3dd405=_['merge']({},_0x3dd405,_0x12b839[_0x7d1b('0x5d')]);return db[_0x7d1b('0xe7')][_0x7d1b('0x22')]({'where':_0x3dd405[_0x7d1b('0x41')]})[_0x7d1b('0x14')](function(_0x256604){_0x59b7c2['count']=_0x256604;if(_0x12b839[_0x7d1b('0x42')][_0x7d1b('0x43')]){_0x3dd405[_0x7d1b('0x44')]=[{'all':!![]}];}return db[_0x7d1b('0xe7')]['findAll'](_0x3dd405);})[_0x7d1b('0x14')](function(_0x5decac){_0x59b7c2[_0x7d1b('0x49')]=_0x5decac;return _0x59b7c2;});}})[_0x7d1b('0x14')](respondWithFilteredResult(_0x531a31,_0x3dd405))['catch'](handleError(_0x531a31,null));};exports['getSmsInteractions']=function(_0x3f8e7e,_0x4696ad){var _0x4f9d12={};var _0xfb6dc0={};var _0x370930;var _0x222841;return db[_0x7d1b('0x39')][_0x7d1b('0xcb')]({'where':{'id':_0x3f8e7e[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x4696ad,null))['then'](function(_0x4d2620){if(_0x4d2620){_0x370930=_0x4d2620;_0xfb6dc0[_0x7d1b('0x55')]=_[_0x7d1b('0x57')](db[_0x7d1b('0xe8')][_0x7d1b('0x58')]);_0xfb6dc0[_0x7d1b('0x42')]=_['keys'](_0x3f8e7e[_0x7d1b('0x42')]);_0xfb6dc0['filters']=_[_0x7d1b('0x59')](_0xfb6dc0[_0x7d1b('0x55')],_0xfb6dc0['query']);_0x4f9d12[_0x7d1b('0x47')]=_[_0x7d1b('0x59')](_0xfb6dc0[_0x7d1b('0x55')],qs[_0x7d1b('0x5a')](_0x3f8e7e[_0x7d1b('0x42')][_0x7d1b('0x5a')]));_0x4f9d12[_0x7d1b('0x47')]=_0x4f9d12[_0x7d1b('0x47')]['length']?_0x4f9d12[_0x7d1b('0x47')]:_0xfb6dc0[_0x7d1b('0x55')];_0x4f9d12[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x3f8e7e[_0x7d1b('0x42')]['sort']);_0x4f9d12[_0x7d1b('0x41')]=qs[_0x7d1b('0xcd')](_[_0x7d1b('0xda')](_0x3f8e7e[_0x7d1b('0x42')],_0xfb6dc0[_0x7d1b('0xcd')]));if(_0x3f8e7e[_0x7d1b('0x42')][_0x7d1b('0x2f')]){_0x4f9d12['where']=_[_0x7d1b('0x5c')](_0x4f9d12['where'],{'$or':_[_0x7d1b('0x3a')](_0x4f9d12[_0x7d1b('0x47')],function(_0x5cea9c){var _0x3bdb0e={};_0x3bdb0e[_0x5cea9c]={'$like':'%'+_0x3f8e7e['query'][_0x7d1b('0x2f')]+'%'};return _0x3bdb0e;})});}_0x4f9d12=_['merge']({},_0x4f9d12,_0x3f8e7e[_0x7d1b('0x5d')]);return _0x370930[_0x7d1b('0xe9')](_0x4f9d12);}})[_0x7d1b('0x14')](function(_0x3e926d){if(_0x3e926d){_0x222841=_0x3e926d[_0x7d1b('0x4a')];if(!_0x3f8e7e[_0x7d1b('0x42')][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0x4f9d12[_0x7d1b('0x23')]=qs[_0x7d1b('0x23')](_0x3f8e7e[_0x7d1b('0x42')]['limit']);_0x4f9d12['offset']=qs[_0x7d1b('0x20')](_0x3f8e7e['query'][_0x7d1b('0x20')]);}return _0x370930[_0x7d1b('0xe9')](_0x4f9d12);}})['then'](function(_0x259063){if(_0x259063){return _0x259063?{'count':_0x222841,'rows':_0x259063}:null;}})[_0x7d1b('0x14')](respondWithResult(_0x4696ad,null))[_0x7d1b('0x1c')](handleError(_0x4696ad,null));};exports[_0x7d1b('0xea')]=function(_0x49bca6,_0x136c99){var _0x88830e={};var _0x151dd2={};var _0x372c6e;var _0x24ccf5;return db[_0x7d1b('0x39')][_0x7d1b('0xcb')]({'where':{'id':_0x49bca6[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x136c99,null))[_0x7d1b('0x14')](function(_0x213d45){if(_0x213d45){_0x372c6e=_0x213d45;_0x151dd2['model']=_['keys'](db[_0x7d1b('0xeb')][_0x7d1b('0x58')]);_0x151dd2['query']=_['keys'](_0x49bca6[_0x7d1b('0x42')]);_0x151dd2[_0x7d1b('0xcd')]=_['intersection'](_0x151dd2[_0x7d1b('0x55')],_0x151dd2[_0x7d1b('0x42')]);_0x88830e[_0x7d1b('0x47')]=_[_0x7d1b('0x59')](_0x151dd2['model'],qs[_0x7d1b('0x5a')](_0x49bca6[_0x7d1b('0x42')]['fields']));_0x88830e[_0x7d1b('0x47')]=_0x88830e['attributes']['length']?_0x88830e[_0x7d1b('0x47')]:_0x151dd2[_0x7d1b('0x55')];_0x88830e['order']=qs[_0x7d1b('0xcf')](_0x49bca6[_0x7d1b('0x42')]['sort']);_0x88830e[_0x7d1b('0x41')]=qs['filters'](_[_0x7d1b('0xda')](_0x49bca6[_0x7d1b('0x42')],_0x151dd2[_0x7d1b('0xcd')]));if(_0x49bca6[_0x7d1b('0x42')]['filter']){_0x88830e[_0x7d1b('0x41')]=_[_0x7d1b('0x5c')](_0x88830e[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0x88830e['attributes'],function(_0x5b34b5){var _0x2cecb9={};_0x2cecb9[_0x5b34b5]={'$like':'%'+_0x49bca6[_0x7d1b('0x42')][_0x7d1b('0x2f')]+'%'};return _0x2cecb9;})});}_0x88830e=_[_0x7d1b('0x5c')]({},_0x88830e,_0x49bca6['options']);return _0x372c6e[_0x7d1b('0xea')](_0x88830e);}})[_0x7d1b('0x14')](function(_0xec5ced){if(_0xec5ced){_0x24ccf5=_0xec5ced[_0x7d1b('0x4a')];if(!_0x49bca6[_0x7d1b('0x42')][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0x88830e[_0x7d1b('0x23')]=qs[_0x7d1b('0x23')](_0x49bca6['query'][_0x7d1b('0x23')]);_0x88830e['offset']=qs[_0x7d1b('0x20')](_0x49bca6[_0x7d1b('0x42')][_0x7d1b('0x20')]);}return _0x372c6e['getFaxInteractions'](_0x88830e);}})[_0x7d1b('0x14')](function(_0x14449c){if(_0x14449c){return _0x14449c?{'count':_0x24ccf5,'rows':_0x14449c}:null;}})['then'](respondWithResult(_0x136c99,null))[_0x7d1b('0x1c')](handleError(_0x136c99,null));};exports['getWhatsappInteractions']=function(_0x1f4948,_0x404f5e){var _0x2a254e={};var _0x153647={};var _0xb70064;var _0x288e57;return db[_0x7d1b('0x39')][_0x7d1b('0xcb')]({'where':{'id':_0x1f4948[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x404f5e,null))[_0x7d1b('0x14')](function(_0x588c82){if(_0x588c82){_0xb70064=_0x588c82;_0x153647[_0x7d1b('0x55')]=_[_0x7d1b('0x57')](db[_0x7d1b('0xec')][_0x7d1b('0x58')]);_0x153647[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x1f4948[_0x7d1b('0x42')]);_0x153647[_0x7d1b('0xcd')]=_[_0x7d1b('0x59')](_0x153647[_0x7d1b('0x55')],_0x153647[_0x7d1b('0x42')]);_0x2a254e['attributes']=_[_0x7d1b('0x59')](_0x153647['model'],qs[_0x7d1b('0x5a')](_0x1f4948['query'][_0x7d1b('0x5a')]));_0x2a254e['attributes']=_0x2a254e[_0x7d1b('0x47')][_0x7d1b('0x4a')]?_0x2a254e[_0x7d1b('0x47')]:_0x153647[_0x7d1b('0x55')];_0x2a254e[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x1f4948[_0x7d1b('0x42')]['sort']);_0x2a254e[_0x7d1b('0x41')]=qs[_0x7d1b('0xcd')](_[_0x7d1b('0xda')](_0x1f4948[_0x7d1b('0x42')],_0x153647['filters']));if(_0x1f4948['query'][_0x7d1b('0x2f')]){_0x2a254e[_0x7d1b('0x41')]=_['merge'](_0x2a254e[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0x2a254e[_0x7d1b('0x47')],function(_0x7cab64){var _0x5542db={};_0x5542db[_0x7cab64]={'$like':'%'+_0x1f4948[_0x7d1b('0x42')][_0x7d1b('0x2f')]+'%'};return _0x5542db;})});}_0x2a254e=_['merge']({},_0x2a254e,_0x1f4948[_0x7d1b('0x5d')]);return _0xb70064[_0x7d1b('0xed')](_0x2a254e);}})[_0x7d1b('0x14')](function(_0x41d1e4){if(_0x41d1e4){_0x288e57=_0x41d1e4[_0x7d1b('0x4a')];if(!_0x1f4948[_0x7d1b('0x42')][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0x2a254e[_0x7d1b('0x23')]=qs[_0x7d1b('0x23')](_0x1f4948[_0x7d1b('0x42')][_0x7d1b('0x23')]);_0x2a254e[_0x7d1b('0x20')]=qs[_0x7d1b('0x20')](_0x1f4948[_0x7d1b('0x42')][_0x7d1b('0x20')]);}return _0xb70064[_0x7d1b('0xed')](_0x2a254e);}})['then'](function(_0xf258fe){if(_0xf258fe){return _0xf258fe?{'count':_0x288e57,'rows':_0xf258fe}:null;}})[_0x7d1b('0x14')](respondWithResult(_0x404f5e,null))['catch'](handleError(_0x404f5e,null));};exports[_0x7d1b('0xee')]=function(_0x332b3b,_0x3063d,_0x4c59a6){var _0x520334;var _0x594e0f;var _0x594ee5;var _0x32bd63=!_['isNil'](_0x332b3b[_0x7d1b('0x60')]['id'])?_0x332b3b['params']['id']:!_[_0x7d1b('0x6a')](_0x332b3b['user']['id'])?_0x332b3b[_0x7d1b('0x2c')]['id']:null;return db[_0x7d1b('0x39')]['find']({'where':{'id':_0x32bd63,'role':{'$or':[_0x7d1b('0x2a'),_0x7d1b('0x2c'),'agent']}},'attributes':['id',_0x7d1b('0x33'),_0x7d1b('0xef'),_0x7d1b('0xf0'),_0x7d1b('0x29'),'internal',_0x7d1b('0x9c')]})[_0x7d1b('0x14')](function(_0x712b0d){if(_0x712b0d){if(_0x712b0d[_0x7d1b('0x29')]===_0x7d1b('0x75')){_0x520334=_0x712b0d;if(_0x332b3b[_0x7d1b('0x5f')][_0x7d1b('0xa9')]){_0x594ee5=util[_0x7d1b('0xaa')](_0x7d1b('0xf1'),_0x520334[_0x332b3b[_0x7d1b('0x5f')][_0x7d1b('0xa9')]]);}else if(_0x332b3b['body'][_0x7d1b('0xf2')]){_0x594ee5=util[_0x7d1b('0xaa')](_0x7d1b('0xab'),_0x332b3b[_0x7d1b('0x5f')][_0x7d1b('0xf2')]);}else{_0x594ee5=util[_0x7d1b('0xaa')]('SIP/%s',_0x520334['name']);}socket['to'](util[_0x7d1b('0xaa')](_0x7d1b('0xf3'),_0x520334['name']))['emit'](_0x7d1b('0xf4'),{'user':{'id':_0x520334['id'],'name':_0x520334['name']},'ip':_0x332b3b[_0x7d1b('0xf5')][_0x7d1b('0xf6')]||_0x332b3b[_0x7d1b('0xf7')][_0x7d1b('0xf8')]||_0x332b3b[_0x7d1b('0xf9')][_0x7d1b('0xf8')]||_0x332b3b[_0x7d1b('0xf7')][_0x7d1b('0xf9')][_0x7d1b('0xf8')]});return db[_0x7d1b('0xad')][_0x7d1b('0x27')]({'where':{'membername':_0x520334[_0x7d1b('0x33')]},'individualHooks':!![]});}}else{throw new db[(_0x7d1b('0x91'))][(_0x7d1b('0x92'))](_0x7d1b('0xfa'));}})['then'](function(){if(_0x520334){return _0x520334['getVoiceQueues']({'raw':!![]});}})[_0x7d1b('0x14')](function(_0xe91fc5){if(_0x520334){if(_0xe91fc5){_0x594e0f=_0xe91fc5;if(_0x594e0f[_0x7d1b('0x4a')]){var _0x298ac6=_0x594e0f[_0x7d1b('0x3a')](function(_0x2d9064){var _0xe767a5={'membername':_0x520334[_0x7d1b('0x33')],'UserId':_0x520334['id'],'queue_name':_0x2d9064[_0x7d1b('0x33')],'VoiceQueueId':_0x2d9064['id'],'interface':_0x594ee5,'paused':_0x520334['loginInPause']||![],'penalty':_0x2d9064[_0x7d1b('0xfb')]||0x0};return db['UserVoiceQueueRt'][_0x7d1b('0xae')](_0xe767a5);});return Promise[_0x7d1b('0x53')](_0x298ac6);}}}})[_0x7d1b('0x14')](function(){if(_0x520334){return db[_0x7d1b('0xfc')][_0x7d1b('0x48')]({'where':{'membername':_0x520334[_0x7d1b('0x33')],'exitAt':null}});}})[_0x7d1b('0x14')](function(_0x14391e){if(_0x520334){var _0x13d80c=[];_0x14391e[_0x7d1b('0xfd')](function(_0x6f4dbd){_0x13d80c[_0x7d1b('0x4b')](_0x6f4dbd['update']({'exitAt':moment()[_0x7d1b('0xaa')](_0x7d1b('0xfe'))}));});return Promise[_0x7d1b('0x53')](_0x13d80c);}})[_0x7d1b('0x14')](function(){if(_0x520334){var _0x3b1711=[];var _0xaf5bec=[];var _0x4ffb4c=utils[_0x7d1b('0xff')]();var _0x5ab95b={'membername':_0x520334['name'],'interface':_0x594ee5,'enterAt':moment()[_0x7d1b('0xaa')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x520334[_0x7d1b('0x29')],'internal':_0x520334['internal']};_0x4ffb4c[_0x7d1b('0xfd')](function(_0xa0ed59){_0x3b1711['push'](_[_0x7d1b('0x5c')]({'channel':_0xa0ed59,'type':_0x7d1b('0x100'),'data1':_0x332b3b[_0x7d1b('0x5f')][_0x7d1b('0x101')],'data2':_0x594ee5},_0x5ab95b));if(_0x520334[_0x7d1b('0x9c')]){_0xaf5bec[_0x7d1b('0x4b')](_[_0x7d1b('0x5c')]({'channel':_0xa0ed59,'type':_0x7d1b('0x102'),'data1':_0x7d1b('0x103')},_0x5ab95b));}});return db[_0x7d1b('0xfc')][_0x7d1b('0x8b')](_0x3b1711['concat'](_0xaf5bec),{'individualHooks':!![]});}})[_0x7d1b('0x14')](function(){if(_0x520334){return _0x520334[_0x7d1b('0x25')]({'online':!![],'lastLoginAt':moment()[_0x7d1b('0xaa')](_0x7d1b('0xfe')),'voicePause':_0x520334[_0x7d1b('0x9c')]||![],'mailPause':_0x520334['loginInPause']||![],'chatPause':_0x520334[_0x7d1b('0x9c')]||![],'faxPause':_0x520334[_0x7d1b('0x9c')]||![],'smsPause':_0x520334[_0x7d1b('0x9c')]||![],'openchannelPause':_0x520334['loginInPause']||![],'whatsappPause':_0x520334[_0x7d1b('0x9c')]||![],'pauseType':_0x520334[_0x7d1b('0x9c')]?_0x7d1b('0x103'):null,'interface':_0x594ee5,'lastPauseAt':moment()[_0x7d1b('0xaa')](_0x7d1b('0xfe'))});}})[_0x7d1b('0x14')](function(_0x278247){if(_0x332b3b[_0x7d1b('0x104')]){return _0x4c59a6();}else{return Promise[_0x7d1b('0x105')](_0x278247)['then'](respondWithResult(_0x3063d,null));}})[_0x7d1b('0x1c')](handleError(_0x3063d,null));};exports[_0x7d1b('0x106')]=function(_0x1ffa7a,_0x2c5f70){var _0x4635a4;return db[_0x7d1b('0x39')][_0x7d1b('0x32')]({'where':{'id':_0x1ffa7a[_0x7d1b('0x60')]['id'],'role':_0x7d1b('0x75')},'attributes':['id',_0x7d1b('0x33'),_0x7d1b('0x29')]})[_0x7d1b('0x14')](handleEntityNotFound(_0x2c5f70,null))[_0x7d1b('0x14')](function(_0x1e76aa){if(_0x1e76aa){_0x4635a4=_0x1e76aa;return db[_0x7d1b('0xad')][_0x7d1b('0x27')]({'where':{'membername':_0x4635a4[_0x7d1b('0x33')]},'individualHooks':!![]});}})[_0x7d1b('0x14')](function(){return db[_0x7d1b('0xfc')][_0x7d1b('0x48')]({'where':{'membername':_0x4635a4[_0x7d1b('0x33')],'exitAt':null}});})['then'](function(_0x2e9ca1){var _0x19a505=[];_0x2e9ca1['forEach'](function(_0x23fb14){_0x19a505[_0x7d1b('0x4b')](_0x23fb14[_0x7d1b('0x25')]({'exitAt':moment()[_0x7d1b('0xaa')](_0x7d1b('0xfe'))}));});return Promise[_0x7d1b('0x53')](_0x19a505);})[_0x7d1b('0x14')](function(){return _0x4635a4[_0x7d1b('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2c5f70,null))['catch'](handleError(_0x2c5f70,null));};exports[_0x7d1b('0x107')]=function(_0x592eae,_0x361bbb){var _0x38876b;return db[_0x7d1b('0xad')][_0x7d1b('0x25')]({'paused':0x1},{'where':{'UserId':_0x592eae[_0x7d1b('0x60')]['id']},'individualHooks':!![]})[_0x7d1b('0x14')](function(){return db[_0x7d1b('0x39')][_0x7d1b('0x32')]({'where':{'id':_0x592eae[_0x7d1b('0x60')]['id'],'role':'agent'},'attributes':['id',_0x7d1b('0x33'),_0x7d1b('0x29'),_0x7d1b('0x65'),_0x7d1b('0xa9'),_0x7d1b('0xa8')]});})[_0x7d1b('0x14')](handleEntityNotFound(_0x361bbb,null))[_0x7d1b('0x14')](function(_0x40912a){if(_0x40912a){_0x38876b=_0x40912a;return respondWithRpcPromise('QueuePause',_0x7d1b('0x107'),{'id':_0x38876b['id'],'name':_0x38876b[_0x7d1b('0x33')],'pause':!![]});}})[_0x7d1b('0x14')](function(){if(_0x38876b){return db[_0x7d1b('0xfc')]['findAll']({'where':{'membername':_0x38876b['name'],'type':_0x7d1b('0x102'),'exitAt':null}});}})[_0x7d1b('0x14')](function(_0x4aeba6){if(_0x4aeba6[_0x7d1b('0x4a')]){var _0x5858a5=moment()['format'](_0x7d1b('0xfe'));for(var _0x5ca59e=0x0,_0x5cdd05=_0x4aeba6[_0x7d1b('0x4a')];_0x5ca59e<_0x5cdd05;_0x5ca59e++){_0x4aeba6[_0x5ca59e][_0x7d1b('0x108')]({'exitAt':_0x5858a5});}}})[_0x7d1b('0x14')](function(){var _0x1827b3=[];var _0x137653=utils[_0x7d1b('0xff')]();_0x137653['forEach'](function(_0x4d0457){_0x1827b3[_0x7d1b('0x4b')]({'channel':_0x4d0457,'membername':_0x38876b[_0x7d1b('0x33')],'interface':_[_0x7d1b('0x6a')](_0x38876b['interface'])?util[_0x7d1b('0xaa')](_0x7d1b('0xab'),_0x38876b[_0x7d1b('0x33')]):_0x38876b[_0x7d1b('0xa9')],'type':_0x7d1b('0x102'),'enterAt':moment()[_0x7d1b('0xaa')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x592eae[_0x7d1b('0x5f')]['type']||_0x7d1b('0x109'),'role':_0x38876b[_0x7d1b('0x29')],'internal':_0x38876b['internal']});});return db[_0x7d1b('0xfc')][_0x7d1b('0x8b')](_0x1827b3,{'individualHooks':!![]});})[_0x7d1b('0x14')](function(){return _0x38876b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x592eae[_0x7d1b('0x5f')][_0x7d1b('0x3c')]||_0x7d1b('0x109'),'lastPauseAt':moment()[_0x7d1b('0xaa')](_0x7d1b('0xfe'))});})[_0x7d1b('0x14')](respondWithResult(_0x361bbb,null))['catch'](handleError(_0x361bbb,null));};exports[_0x7d1b('0x10a')]=function(_0x398741,_0x5935c7){if(_0x398741[_0x7d1b('0x5f')]['channel']&&!utils[_0x7d1b('0x9d')](_0x398741[_0x7d1b('0x5f')][_0x7d1b('0xb0')])){throw new APIBadRequestError(util['format'](_0x7d1b('0x10b'),_0x398741['body'][_0x7d1b('0xb0')]));}return db['User'][_0x7d1b('0x32')]({'where':{'id':_0x398741[_0x7d1b('0x60')]['id']},'attributes':['id',_0x7d1b('0x33'),_0x7d1b('0x29'),_0x7d1b('0x65'),'interface',_0x7d1b('0xa8'),_0x7d1b('0xac'),_0x7d1b('0x10c'),_0x7d1b('0x10d'),'faxPause','openchannelPause','smsPause','whatsappPause',_0x7d1b('0x10e'),_0x7d1b('0x10f')]})[_0x7d1b('0x14')](function(_0x109d28){if(!_0x109d28){throw new APINotFoundError(util[_0x7d1b('0xaa')](_0x7d1b('0x110'),_0x398741[_0x7d1b('0x60')]['id']));}return _0x109d28['unpause'](_0x398741['body'][_0x7d1b('0xb0')]);})[_0x7d1b('0x14')](respondWithResult(_0x5935c7,null))[_0x7d1b('0x1c')](APIHandleError(_0x5935c7));};exports[_0x7d1b('0x111')]=function(_0x8bdccb,_0x3af345){var _0x57d86a={};var _0x227e89={};var _0x5db131;var _0x234c98;return db[_0x7d1b('0x39')][_0x7d1b('0xcb')]({'where':{'id':_0x8bdccb[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x3af345,null))['then'](function(_0x47e7a8){if(_0x47e7a8){_0x5db131=_0x47e7a8;_0x227e89[_0x7d1b('0x55')]=_[_0x7d1b('0x57')](db[_0x7d1b('0x112')][_0x7d1b('0x58')]);_0x227e89[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x8bdccb[_0x7d1b('0x42')]);_0x227e89['filters']=_[_0x7d1b('0x59')](_0x227e89[_0x7d1b('0x55')],_0x227e89['query']);_0x57d86a[_0x7d1b('0x47')]=_[_0x7d1b('0x59')](_0x227e89[_0x7d1b('0x55')],qs[_0x7d1b('0x5a')](_0x8bdccb['query'][_0x7d1b('0x5a')]));_0x57d86a[_0x7d1b('0x47')]=_0x57d86a[_0x7d1b('0x47')][_0x7d1b('0x4a')]?_0x57d86a[_0x7d1b('0x47')]:_0x227e89[_0x7d1b('0x55')];_0x57d86a[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x8bdccb[_0x7d1b('0x42')][_0x7d1b('0xcf')]);_0x57d86a[_0x7d1b('0x41')]=qs['filters'](_[_0x7d1b('0xda')](_0x8bdccb[_0x7d1b('0x42')],_0x227e89[_0x7d1b('0xcd')]));if(_0x8bdccb[_0x7d1b('0x42')][_0x7d1b('0x2f')]){_0x57d86a[_0x7d1b('0x41')]=_[_0x7d1b('0x5c')](_0x57d86a[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0x57d86a[_0x7d1b('0x47')],function(_0x391ef1){var _0x34061e={};_0x34061e[_0x391ef1]={'$like':'%'+_0x8bdccb[_0x7d1b('0x42')]['filter']+'%'};return _0x34061e;})});}_0x57d86a=_[_0x7d1b('0x5c')]({},_0x57d86a,_0x8bdccb[_0x7d1b('0x5d')]);return _0x5db131[_0x7d1b('0x111')](_0x57d86a);}})[_0x7d1b('0x14')](function(_0xde9561){if(_0xde9561){_0x234c98=_0xde9561[_0x7d1b('0x4a')];if(!_0x8bdccb[_0x7d1b('0x42')]['hasOwnProperty']('nolimit')){_0x57d86a[_0x7d1b('0x23')]=qs[_0x7d1b('0x23')](_0x8bdccb['query'][_0x7d1b('0x23')]);_0x57d86a['offset']=qs[_0x7d1b('0x20')](_0x8bdccb[_0x7d1b('0x42')]['offset']);}return _0x5db131['getTeams'](_0x57d86a);}})[_0x7d1b('0x14')](function(_0x3fc5d8){if(_0x3fc5d8){return _0x3fc5d8?{'count':_0x234c98,'rows':_0x3fc5d8}:null;}})[_0x7d1b('0x14')](respondWithResult(_0x3af345,null))[_0x7d1b('0x1c')](handleError(_0x3af345,null));};exports[_0x7d1b('0x113')]=function(_0x2a906f,_0x10080e){var _0x81dbae=_0x2a906f[_0x7d1b('0x60')]['id'];var _0x107057=_0x2a906f['body']?_0x2a906f[_0x7d1b('0x5f')][_0x7d1b('0x64')]:null;var _0x4736c2=[];return Promise[_0x7d1b('0x105')]()[_0x7d1b('0x14')](function(){if(!_0x107057)throw new APIBadRequestError(_0x7d1b('0x114'));})['then'](function(){return db['User'][_0x7d1b('0xcb')]({'where':{'id':_0x81dbae}});})[_0x7d1b('0x14')](function(_0x2b421c){if(!_0x2b421c)throw new APINotFoundError(util[_0x7d1b('0xaa')](_0x7d1b('0x110'),_0x2a906f[_0x7d1b('0x60')]['id']));return db[_0x7d1b('0x6d')]['transaction'](function(_0x1615d7){return _0x2b421c[_0x7d1b('0x113')](_0x107057,{'transaction':_0x1615d7})[_0x7d1b('0x14')](function(){return db[_0x7d1b('0x112')][_0x7d1b('0x48')]({'where':{'id':{'$in':_0x107057}}});})[_0x7d1b('0x14')](function(_0x2bd619){var _0x282972=_[_0x7d1b('0x3a')](_0x2bd619,function(_0x12c3e7){return _0x12c3e7['getAssociatedQueues']();});return Promise[_0x7d1b('0x53')](_0x282972);})[_0x7d1b('0x14')](function(_0x596f10){_0x4736c2=_['flattenDeep'](_0x596f10);var _0x4e5094=_['map'](_0x4736c2,function(_0xd7e81){return _0xd7e81['addAgent'](_0x2b421c['id'],{'transaction':_0x1615d7});});return Promise[_0x7d1b('0x53')](_0x4e5094);})['then'](function(){if(!_0x2b421c[_0x7d1b('0xa8')])return;var _0x51eb77=_[_0x7d1b('0x2f')](_0x4736c2,function(_0xe0ee9a){return _0xe0ee9a[_0x7d1b('0x115')]('channel')===_0x7d1b('0x116');});var _0x558c4e=_[_0x7d1b('0x3a')](_0x51eb77,function(_0x263186){return db[_0x7d1b('0xad')][_0x7d1b('0xae')]({'membername':_0x2b421c['name'],'UserId':_0x2b421c['id'],'queue_name':_0x263186[_0x7d1b('0x33')],'VoiceQueueId':_0x263186['id'],'interface':_[_0x7d1b('0x6a')](_0x2b421c[_0x7d1b('0xa9')])?util[_0x7d1b('0xaa')]('SIP/%s',_0x2b421c[_0x7d1b('0x33')]):_0x2b421c['interface'],'paused':_0x2b421c[_0x7d1b('0xac')]||![],'penalty':_0x2b421c[_0x7d1b('0xa2')]},{'transaction':_0x1615d7});});return Promise[_0x7d1b('0x53')](_0x558c4e);})[_0x7d1b('0x14')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x107057}}});})[_0x7d1b('0x14')](function(_0x3bff3d){var _0x36abed=_['map'](_0x3bff3d,function(_0x549f37){return db[_0x7d1b('0x117')][_0x7d1b('0x85')]({'UserId':_0x2b421c['id'],'VoicePrefixId':_0x549f37[_0x7d1b('0x118')]},{'transaction':_0x1615d7});});return Promise['all'](_0x36abed);});});})[_0x7d1b('0x14')](function(){for(var _0x130eec=0x0;_0x130eec<_0x4736c2[_0x7d1b('0x4a')];_0x130eec++){var _0x24a95d=_0x4736c2[_0x130eec][_0x7d1b('0x115')](_0x7d1b('0xb0'));var _0x20a38b=_0x24a95d+_0x7d1b('0xa3');socket[_0x7d1b('0xa4')](_0x7d1b('0x2c')+_0x24a95d+'Queue:save',{'UserId':_0x81dbae,['queueField']:_0x4736c2[_0x130eec]['id']});}})[_0x7d1b('0x14')](respondWithStatusCode(_0x10080e,null))[_0x7d1b('0x1c')](APIHandleError(_0x10080e));};exports[_0x7d1b('0x119')]=function(_0x37b2aa,_0xf19edb){var _0x2f282b=_0x37b2aa[_0x7d1b('0x60')]['id'];var _0x57b083=null;if(_0x37b2aa[_0x7d1b('0x42')][_0x7d1b('0x64')]){_0x57b083=_[_0x7d1b('0xb2')](_0x37b2aa['query'][_0x7d1b('0x64')])?_0x37b2aa[_0x7d1b('0x42')][_0x7d1b('0x64')]:[_0x37b2aa[_0x7d1b('0x42')][_0x7d1b('0x64')]];}var _0x347f4e=[];return Promise[_0x7d1b('0x105')]()['then'](function(){if(!_0x57b083)throw new APIBadRequestError(_0x7d1b('0x11a'));})[_0x7d1b('0x14')](function(){return db[_0x7d1b('0x39')]['findOne']({'where':{'id':_0x2f282b}});})[_0x7d1b('0x14')](function(_0x377a85){if(!_0x377a85)throw new APINotFoundError(util[_0x7d1b('0xaa')]('User\x20with\x20id\x20%s\x20not\x20found',_0x37b2aa[_0x7d1b('0x60')]['id']));return db['sequelize'][_0x7d1b('0x11b')](function(_0x35d031){return _0x377a85[_0x7d1b('0x119')](_0x57b083,{'transaction':_0x35d031})[_0x7d1b('0x14')](function(){return db[_0x7d1b('0x112')][_0x7d1b('0x48')]({'where':{'id':{'$in':_0x57b083}}});})[_0x7d1b('0x14')](function(_0x2f9636){var _0xf0d119=_[_0x7d1b('0x3a')](_0x2f9636,function(_0x31a85e){return _0x31a85e[_0x7d1b('0x11c')]();});return Promise[_0x7d1b('0x53')](_0xf0d119);})[_0x7d1b('0x14')](function(_0x466701){_0x347f4e=_['flattenDeep'](_0x466701);var _0x1133da=_[_0x7d1b('0x3a')](_0x347f4e,function(_0x3f1fd0){return _0x3f1fd0[_0x7d1b('0x11d')](_0x377a85['id'],{'transaction':_0x35d031});});return Promise[_0x7d1b('0x53')](_0x1133da);})[_0x7d1b('0x14')](function(){if(!_0x377a85['online'])return;var _0x418d3a=_[_0x7d1b('0x2f')](_0x347f4e,function(_0xbf9460){return _0xbf9460[_0x7d1b('0x115')]('channel')==='Voice';});var _0x2014e1=_[_0x7d1b('0x3a')](_0x418d3a,function(_0x2b5d74){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2b5d74['id'],'UserId':_0x377a85['id']},'transaction':_0x35d031});});return Promise[_0x7d1b('0x53')](_0x2014e1);})['then'](function(){return db[_0x7d1b('0x11e')][_0x7d1b('0x48')]({'where':{'teamId':{'$in':_0x57b083}}});})[_0x7d1b('0x14')](function(_0x4443a1){var _0x59b9cb=_[_0x7d1b('0x3a')](_0x4443a1,function(_0xe432e2){return db[_0x7d1b('0x117')][_0x7d1b('0x27')]({'where':{'UserId':_0x377a85['id'],'VoicePrefixId':_0xe432e2['VoicePrefixId']}},{'transaction':_0x35d031});});return Promise['all'](_0x59b9cb);});});})['then'](function(){for(var _0x1de863=0x0;_0x1de863<_0x347f4e[_0x7d1b('0x4a')];_0x1de863++){var _0x4648d2=_0x347f4e[_0x1de863][_0x7d1b('0x115')](_0x7d1b('0xb0'));var _0x29519c=_0x4648d2+_0x7d1b('0xa3');socket[_0x7d1b('0xa4')]('user'+_0x4648d2+'Queue:remove',{'UserId':_0x2f282b,['queueField']:_0x347f4e[_0x1de863]['id']});}})[_0x7d1b('0x14')](respondWithStatusCode(_0xf19edb,null))[_0x7d1b('0x1c')](APIHandleError(_0xf19edb));};exports[_0x7d1b('0x11f')]=function(_0x9891d6,_0x480baa){var _0x4944ff={};var _0xec5dfa={};var _0x422caf;var _0x70fb3a;return db[_0x7d1b('0x39')]['findOne']({'where':{'id':_0x9891d6[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x480baa,null))[_0x7d1b('0x14')](function(_0xd04f2c){if(_0xd04f2c){_0x422caf=_0xd04f2c;_0xec5dfa[_0x7d1b('0x55')]=_[_0x7d1b('0x57')](db['CmList'][_0x7d1b('0x58')]);_0xec5dfa[_0x7d1b('0x42')]=_[_0x7d1b('0x57')](_0x9891d6[_0x7d1b('0x42')]);_0xec5dfa[_0x7d1b('0xcd')]=_[_0x7d1b('0x59')](_0xec5dfa[_0x7d1b('0x55')],_0xec5dfa[_0x7d1b('0x42')]);_0x4944ff['attributes']=_[_0x7d1b('0x59')](_0xec5dfa[_0x7d1b('0x55')],qs[_0x7d1b('0x5a')](_0x9891d6[_0x7d1b('0x42')][_0x7d1b('0x5a')]));_0x4944ff[_0x7d1b('0x47')]=_0x4944ff[_0x7d1b('0x47')]['length']?_0x4944ff[_0x7d1b('0x47')]:_0xec5dfa[_0x7d1b('0x55')];_0x4944ff[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x9891d6[_0x7d1b('0x42')]['sort']);_0x4944ff['where']=qs[_0x7d1b('0xcd')](_[_0x7d1b('0xda')](_0x9891d6[_0x7d1b('0x42')],_0xec5dfa[_0x7d1b('0xcd')]));if(_0x9891d6['query'][_0x7d1b('0x2f')]){_0x4944ff[_0x7d1b('0x41')]=_['merge'](_0x4944ff[_0x7d1b('0x41')],{'$or':_['map'](_0x4944ff['attributes'],function(_0x4459e4){var _0x18e55b={};_0x18e55b[_0x4459e4]={'$like':'%'+_0x9891d6['query'][_0x7d1b('0x2f')]+'%'};return _0x18e55b;})});}_0x4944ff=_[_0x7d1b('0x5c')]({},_0x4944ff,_0x9891d6['options']);return _0x422caf[_0x7d1b('0x11f')](_0x4944ff);}})['then'](function(_0x350420){if(_0x350420){_0x70fb3a=_0x350420[_0x7d1b('0x4a')];if(!_0x9891d6[_0x7d1b('0x42')][_0x7d1b('0xd0')](_0x7d1b('0xd5'))){_0x4944ff[_0x7d1b('0x23')]=qs[_0x7d1b('0x23')](_0x9891d6[_0x7d1b('0x42')]['limit']);_0x4944ff[_0x7d1b('0x20')]=qs[_0x7d1b('0x20')](_0x9891d6[_0x7d1b('0x42')][_0x7d1b('0x20')]);}return _0x422caf['getLists'](_0x4944ff);}})[_0x7d1b('0x14')](function(_0x536634){if(_0x536634){return _0x536634?{'count':_0x70fb3a,'rows':_0x536634}:null;}})[_0x7d1b('0x14')](respondWithResult(_0x480baa,null))[_0x7d1b('0x1c')](handleError(_0x480baa,null));};exports[_0x7d1b('0x120')]=function(_0x3fda50,_0x202c79){var _0x24abdc={};var _0x134ff6={};var _0x2886bc;return db[_0x7d1b('0x39')][_0x7d1b('0xcb')]({'where':{'id':_0x3fda50[_0x7d1b('0x60')]['id']}})[_0x7d1b('0x14')](handleEntityNotFound(_0x202c79,null))[_0x7d1b('0x14')](function(_0x2786af){if(_0x2786af){_0x2886bc=_0x2786af;_0x134ff6['model']=_[_0x7d1b('0x57')](db[_0x7d1b('0x39')]['rawAttributes']);_0x134ff6[_0x7d1b('0x42')]=_['keys'](_0x3fda50[_0x7d1b('0x42')]);_0x134ff6['filters']=_[_0x7d1b('0x59')](_0x134ff6[_0x7d1b('0x55')],_0x134ff6[_0x7d1b('0x42')]);_0x24abdc[_0x7d1b('0x47')]=_['intersection'](_0x134ff6['model'],qs[_0x7d1b('0x5a')](_0x3fda50['query'][_0x7d1b('0x5a')]));_0x24abdc[_0x7d1b('0x47')]=_0x24abdc[_0x7d1b('0x47')]['length']?_0x24abdc[_0x7d1b('0x47')]:_0x134ff6['model'];_0x24abdc[_0x7d1b('0xce')]=qs[_0x7d1b('0xcf')](_0x3fda50['query'][_0x7d1b('0xcf')]);_0x24abdc[_0x7d1b('0x41')]=qs['filters'](_[_0x7d1b('0xda')](_0x3fda50[_0x7d1b('0x42')],_0x134ff6[_0x7d1b('0xcd')]));if(_0x3fda50[_0x7d1b('0x42')][_0x7d1b('0x2f')]){_0x24abdc[_0x7d1b('0x41')]=_[_0x7d1b('0x5c')](_0x24abdc[_0x7d1b('0x41')],{'$or':_[_0x7d1b('0x3a')](_0x24abdc[_0x7d1b('0x47')],function(_0x169818){var _0x40cb9f={};_0x40cb9f[_0x169818]={'$like':'%'+_0x3fda50['query'][_0x7d1b('0x2f')]+'%'};return _0x40cb9f;})});}_0x24abdc[_0x7d1b('0x55')]=db[_0x7d1b('0x39')];_0x24abdc['as']=_0x7d1b('0x2d');_0x24abdc=_[_0x7d1b('0x5c')]({},_0x24abdc,_0x3fda50['options']);return _0x2886bc[_0x7d1b('0x121')]({'include':[_0x24abdc]});}})['then'](function(_0xf40678){if(_0xf40678){var _0x29bfd0={},_0x5c886b=[];for(var _0x271074=0x0;_0x271074<_0xf40678[_0x7d1b('0x4a')];_0x271074+=0x1){for(var _0x1c3c1b=0x0,_0xd0cbca;_0x1c3c1b<_0xf40678[_0x271074][_0x7d1b('0x2d')]['length'];_0x1c3c1b+=0x1){_0xd0cbca=_0xf40678[_0x271074][_0x7d1b('0x2d')][_0x1c3c1b][_0x7d1b('0x28')]({'plain':!![]});_0x29bfd0[_0xd0cbca['id']]=_0xd0cbca;}}_0x29bfd0=_['values'](_0x29bfd0);for(var _0x3cc8ab=qs[_0x7d1b('0x20')](_0x3fda50[_0x7d1b('0x42')][_0x7d1b('0x20')]);_0x3cc8ab<_0x29bfd0[_0x7d1b('0x4a')]&&_0x5c886b[_0x7d1b('0x4a')]=_0x3db627){_0x597284=_0x3db627;_0x1e4e68=0xc8;}else{_0x1e4e68=0xce;}_0x39b882['status'](_0x1e4e68);return _0x39b882[_0x3421('0x27')](_0x3421('0x28'),_0x2a0031+'-'+_0x597284+'/'+_0x3db627)['json'](_0x11f9db);}return null;};}function saveUpdates(_0x337afd){return function(_0x2270ac){if(_0x2270ac){return _0x2270ac['update'](_0x337afd)[_0x3421('0x29')](function(_0x1ca943){socket[_0x3421('0x2a')](_0x3421('0x2b')+_0x1ca943['id'],{});return _0x1ca943;});}return null;};}function removeEntity(_0x5cbdae){return function(_0x182112){if(_0x182112){return _0x182112['destroy']()[_0x3421('0x29')](function(){var _0x6e11d1=_0x182112[_0x3421('0x2c')]({'plain':!![]});if(_0x6e11d1[_0x3421('0x2d')]===_0x3421('0x2e'))return;var _0x57e23f=[{'name':_0x3421('0x2f'),'value':_0x3421('0x30'),'ignore':!![]},{'name':_0x3421('0x31'),'value':_0x3421('0x32'),'ignore':![]},{'name':_0x3421('0x33'),'value':'telephone','ignore':![]}];var _0x5e979c=_(_0x57e23f)['filter'](_0x3421('0x34'))['map'](_0x3421('0x35'))['value']();if(_['includes'](_0x5e979c,_0x6e11d1[_0x3421('0x2d')])){return;}var _0x5df560=_[_0x3421('0x36')](_0x57e23f,['value',_0x6e11d1[_0x3421('0x2d')]])[_0x3421('0x37')];return db[_0x3421('0x38')]['destroy']({'where':{'type':_0x5df560,'resourceId':_0x6e11d1['id']}})[_0x3421('0x29')](function(){return _0x182112;});})['then'](function(){_0x5cbdae[_0x3421('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16bcea){return function(_0x53d94c){if(!_0x53d94c){_0x16bcea[_0x3421('0x20')](0x194);}return _0x53d94c;};}function handleError(_0x12cbac,_0x2809a3){_0x2809a3=_0x2809a3||0x1f4;return function(_0x102829){logger[_0x3421('0x1d')](_0x102829[_0x3421('0x39')]);if(_0x102829['name']){delete _0x102829['name'];}_0x12cbac[_0x3421('0x21')](_0x2809a3)['send'](_0x102829);};}exports[_0x3421('0x3a')]=function(_0x32cafc,_0x18151f){var _0x3088f5={},_0x49c8f8={'count':0x0,'rows':[]};var _0x3efac9=_(db[_0x3421('0x3b')][_0x3421('0x3c')])['map'](function(_0x4246a9){return{'name':_0x4246a9[_0x3421('0x3d')],'type':_0x4246a9[_0x3421('0x3e')][_0x3421('0x3f')]};})[_0x3421('0x40')](function(_0x1829c5){return!_['includes']([_0x3421('0x41'),_0x3421('0x42')],_0x1829c5[_0x3421('0x37')]);})[_0x3421('0x35')]();_0x3088f5=qs['getOptions'](_0x3efac9,_0x32cafc);var _0xa94230={'where':_0x3088f5[_0x3421('0x43')]};return db[_0x3421('0x3b')][_0x3421('0x44')](_0xa94230)[_0x3421('0x29')](function(_0x4864b7){_0x49c8f8[_0x3421('0x44')]=_0x4864b7;if(_0x32cafc[_0x3421('0x45')][_0x3421('0x46')]){_0x3088f5[_0x3421('0x47')]=[{'all':!![]}];}if(_0x32cafc[_0x3421('0x45')][_0x3421('0x48')]==='true'){_0x3088f5['include']=[{'model':db['UserSetting'],'as':_0x3421('0x48')}];}if(!_[_0x3421('0x49')](_0x3088f5[_0x3421('0x4a')],'id')){_0x3088f5[_0x3421('0x4a')][_0x3421('0x4b')]('id');}return db[_0x3421('0x3b')][_0x3421('0x4c')](_0x3088f5);})['then'](function(_0x51d21f){_0x49c8f8[_0x3421('0x4d')]=_0x51d21f;if(_0x32cafc[_0x3421('0x45')]['openTabs']===_0x3421('0x4e')){var _0x5ce859=[];for(var _0x502313=0x0;_0x502313<_0x49c8f8[_0x3421('0x4d')][_0x3421('0x4f')];_0x502313++){_0x5ce859[_0x3421('0x4b')](get_open_tabs(_0x3421('0x50'),_0x49c8f8[_0x3421('0x4d')][_0x502313][_0x3421('0x51')]));_0x5ce859['push'](get_open_tabs('sms',_0x49c8f8[_0x3421('0x4d')][_0x502313][_0x3421('0x51')]));_0x5ce859['push'](get_open_tabs(_0x3421('0x52'),_0x49c8f8[_0x3421('0x4d')][_0x502313][_0x3421('0x51')]));_0x5ce859[_0x3421('0x4b')](get_open_tabs(_0x3421('0x53'),_0x49c8f8['rows'][_0x502313][_0x3421('0x51')]));_0x5ce859[_0x3421('0x4b')](get_open_tabs(_0x3421('0x54'),_0x49c8f8[_0x3421('0x4d')][_0x502313][_0x3421('0x51')]));_0x5ce859['push'](get_open_tabs('whatsapp',_0x49c8f8['rows'][_0x502313][_0x3421('0x51')]));}return Promise['all'](_0x5ce859)[_0x3421('0x29')](function(){return _0x49c8f8;});}else{return _0x49c8f8;}})['then'](respondWithFilteredResult(_0x18151f,_0x3088f5))[_0x3421('0x1f')](handleError(_0x18151f,null));};exports[_0x3421('0x55')]=function(_0x55db46,_0x3cff71){var _0x755cc5={'raw':![],'where':{'id':_0x55db46[_0x3421('0x56')]['id']}},_0x80b492={};_0x80b492[_0x3421('0x57')]=_[_0x3421('0x58')](_[_0x3421('0x59')](db[_0x3421('0x3b')][_0x3421('0x3c')]),[_0x3421('0x41'),_0x3421('0x42')]);_0x80b492[_0x3421('0x45')]=_['keys'](_0x55db46[_0x3421('0x45')]);_0x80b492[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x80b492[_0x3421('0x57')],_0x80b492['query']);_0x755cc5['attributes']=_['intersection'](_0x80b492[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x55db46['query'][_0x3421('0x5c')]));_0x755cc5[_0x3421('0x4a')]=_0x755cc5['attributes'][_0x3421('0x4f')]?_0x755cc5['attributes']:_0x80b492[_0x3421('0x57')];if(_0x55db46[_0x3421('0x45')][_0x3421('0x46')]){_0x755cc5[_0x3421('0x47')]=[{'all':!![]}];}if(_0x55db46[_0x3421('0x45')][_0x3421('0x48')]==='true'){_0x755cc5[_0x3421('0x47')]=[{'model':db[_0x3421('0x5d')],'as':'userSetting'}];}_0x755cc5=_[_0x3421('0x5e')]({},_0x755cc5,_0x55db46[_0x3421('0x5f')]);if(!_[_0x3421('0x49')](_0x755cc5[_0x3421('0x4a')],'id')){_0x755cc5[_0x3421('0x4a')]['push']('id');}return db[_0x3421('0x3b')][_0x3421('0x36')](_0x755cc5)[_0x3421('0x29')](handleEntityNotFound(_0x3cff71,null))[_0x3421('0x29')](function(_0x2b178d){var _0x17d246=[];values=_0x2b178d;if(_0x55db46[_0x3421('0x45')][_0x3421('0x60')]==='true'){_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x50'),_0x2b178d[_0x3421('0x51')]));_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x61'),_0x2b178d[_0x3421('0x51')]));_0x17d246['push'](get_open_tabs(_0x3421('0x54'),_0x2b178d[_0x3421('0x51')]));_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x62'),_0x2b178d[_0x3421('0x51')]));_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x52'),_0x2b178d['dataValues']));_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x53'),_0x2b178d[_0x3421('0x51')]));return Promise[_0x3421('0x63')](_0x17d246);}else{return values;}})[_0x3421('0x29')](function(){return values;})[_0x3421('0x29')](respondWithResult(_0x3cff71,null))[_0x3421('0x1f')](handleError(_0x3cff71,null));};exports[_0x3421('0x64')]=function(_0x22cd19,_0x2a62f3){if(_0x22cd19[_0x3421('0x65')]['id']){delete _0x22cd19[_0x3421('0x65')]['id'];}delete _0x22cd19[_0x3421('0x65')][_0x3421('0x2d')];return db['User'][_0x3421('0x36')]({'where':{'id':_0x22cd19['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x2a62f3,null))['then'](saveUpdates(_0x22cd19[_0x3421('0x65')],null))['then'](respondWithResult(_0x2a62f3,null))[_0x3421('0x1f')](handleError(_0x2a62f3,null));};exports[_0x3421('0x66')]=function(_0x33602d,_0x5b0070){return db[_0x3421('0x3b')][_0x3421('0x66')]()['then'](respondWithResult(_0x5b0070,null))[_0x3421('0x1f')](handleError(_0x5b0070,null));};exports[_0x3421('0x67')]=function(_0x5bfeea,_0x362f82){return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x5bfeea[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x362f82,null))[_0x3421('0x29')](function(_0x5e2a30){if(_0x5e2a30){return _0x5e2a30[_0x3421('0x67')](_0x5bfeea[_0x3421('0x65')]['ids'],_[_0x3421('0x68')](_0x5bfeea[_0x3421('0x65')],[_0x3421('0x69'),'id'])||{});}})[_0x3421('0x29')](respondWithResult(_0x362f82,null))['catch'](handleError(_0x362f82,null));};function validateUser(_0x11d834){return new Promise(function(_0x25e208,_0x23b5a3){if(_0x11d834[_0x3421('0x6a')])return _0x25e208(_0x11d834);return db[_0x3421('0x6b')]['findById'](0x1)[_0x3421('0x29')](function(_0x305dd2){if(_0x305dd2[_0x3421('0x6c')])authService[_0x3421('0x6d')](_0x11d834[_0x3421('0x41')]);db[_0x3421('0x3b')][_0x3421('0x6e')](_0x3421('0x6a'))['then'](function(_0x2a1cb5){if(_[_0x3421('0x6f')](_0x2a1cb5)){_0x11d834[_0x3421('0x6a')]=_0x305dd2[_0x3421('0x70')]||0x1;return;}if(_['isNil'](_0x305dd2[_0x3421('0x70')])||_0x305dd2[_0x3421('0x70')]===_0x2a1cb5){_0x11d834[_0x3421('0x6a')]=_0x2a1cb5+0x1;return;}if(_0x305dd2['min_internal']>_0x2a1cb5){_0x11d834['internal']=_0x305dd2[_0x3421('0x70')];return;}return db[_0x3421('0x71')]['query'](_0x3421('0x72'),{'type':db[_0x3421('0x71')][_0x3421('0x73')]['SELECT']})['then'](function(_0x3b359c){if(_0x3b359c&&_0x3b359c[_0x3421('0x4f')]){for(var _0x220ea9=0x0,_0x17f98d=_0x3b359c[_0x3421('0x4f')];_0x220ea9<_0x17f98d&&_['isNil'](_0x11d834['internal']);_0x220ea9++){if(_0x305dd2['min_internal']<=_0x3b359c[_0x220ea9]['from']){_0x11d834[_0x3421('0x6a')]=_0x3b359c[_0x220ea9][_0x3421('0x74')];}else if(_0x305dd2[_0x3421('0x70')]>_0x3b359c[_0x220ea9]['from']&&_0x305dd2['min_internal']<=_0x3b359c[_0x220ea9]['to']){_0x11d834['internal']=_0x305dd2[_0x3421('0x70')];}}}if(_[_0x3421('0x6f')](_0x11d834[_0x3421('0x6a')])){_0x11d834[_0x3421('0x6a')]=_0x2a1cb5+0x1;}return _0x25e208(_0x11d834);});});})['catch'](function(_0x59d182){_0x23b5a3(_0x59d182);});});}function updateUser(_0x225a62){return new Promise(function(_0x3a14d5,_0x383dd6){try{if(_0x225a62[_0x3421('0x75')]){_0x225a62[_0x3421('0x76')]=_0x225a62[_0x3421('0x6a')];_0x225a62['VoiceMail']={'mailbox':_0x225a62[_0x3421('0x6a')],'password':_0x225a62[_0x3421('0x41')],'fullname':_0x225a62[_0x3421('0x77')],'email':_0x225a62['email']};}if(_0x225a62['role']==='agent'){if(!_0x225a62[_0x3421('0x78')])_0x225a62[_0x3421('0x78')]=[_0x3421('0x79'),_0x3421('0x7a'),_0x3421('0x7b'),'113',_0x3421('0x7c'),_0x3421('0x7d'),_0x3421('0x7e'),_0x3421('0x7f'),_0x3421('0x80'),_0x3421('0x81'),_0x3421('0x82'),_0x3421('0x83'),'111',_0x3421('0x84'),'115'];}_0x3a14d5(_0x225a62);}catch(_0x41d240){_0x383dd6(_0x41d240);}});}exports[_0x3421('0x85')]=function(_0x1d039f,_0xfb38f6){if(_0x1d039f[_0x3421('0x30')][_0x3421('0x2d')]===_0x3421('0x32'))throw new Error(_0x3421('0x86'));if(_0x1d039f[_0x3421('0x65')][_0x3421('0x2d')]===_0x3421('0x30')&&_0x1d039f['user'][_0x3421('0x2d')]!==_0x3421('0x2e')){throw new Error(_0x3421('0x87'));}if(_0x1d039f[_0x3421('0x65')]['role']==='admin'&&_0x1d039f[_0x3421('0x30')][_0x3421('0x2d')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x3421('0x88')]([_0x1d039f[_0x3421('0x65')]])[_0x3421('0x29')](function(){return validateUser(_0x1d039f[_0x3421('0x65')]);})['then'](function(_0x215d5e){return updateUser(_0x215d5e)[_0x3421('0x29')](function(_0x19c51f){if(_0x19c51f[_0x3421('0x2d')]==='admin'){_0x19c51f[_0x3421('0x89')]=_0x1d039f['user'][_0x3421('0x89')];delete _0x19c51f['userProfileId'];}return _0x19c51f;});})[_0x3421('0x29')](function(_0x4c3ffa){return db[_0x3421('0x3b')][_0x3421('0x85')](_0x4c3ffa,{'include':[{'model':db[_0x3421('0x8a')],'as':_0x3421('0x8a')}]});})[_0x3421('0x29')](function(_0x1c9d50){if(_0x1d039f[_0x3421('0x65')]['role']==='user')return _0x1c9d50;if(_0x1d039f['user'][_0x3421('0x2d')]!==_0x3421('0x30'))return _0x1c9d50;return db[_0x3421('0x8b')][_0x3421('0x36')]({'where':{'name':_0x1c9d50[_0x3421('0x2d')]===_0x3421('0x32')?_0x3421('0x31'):'Telephones','userProfileId':_0x1d039f['user']['userProfileId']},'raw':!![]})[_0x3421('0x29')](function(_0x369b87){if(!_0x369b87||_0x369b87['autoAssociation']!=0x0)return _0x1c9d50;return db[_0x3421('0x38')][_0x3421('0x85')]({'name':_0x1c9d50[_0x3421('0x37')],'resourceId':_0x1c9d50['id'],'type':_0x369b87['name'],'sectionId':_0x369b87['id']},{})[_0x3421('0x29')](function(){return _0x1c9d50;});})[_0x3421('0x1f')](function(_0xee9019){logger[_0x3421('0x1d')](_0x3421('0x8c'),_0xee9019);throw _0xee9019;});})[_0x3421('0x29')](respondWithResult(_0xfb38f6,0xc9))[_0x3421('0x1f')](handleError(_0xfb38f6,null));};exports['bulkCreate']=function(_0x2279e8,_0x18bfff){var _0x22cd4f=_0x2279e8['body'];var _0x303ada=[];if(_0x2279e8[_0x3421('0x30')][_0x3421('0x2d')]===_0x3421('0x32'))throw new Error(_0x3421('0x86'));if(_[_0x3421('0x8d')](_0x22cd4f,[_0x3421('0x2d'),_0x3421('0x30')])&&_0x2279e8[_0x3421('0x30')]['role']!=='admin'){throw new Error(_0x3421('0x87'));}if(_[_0x3421('0x8d')](_0x22cd4f,[_0x3421('0x2d'),_0x3421('0x2e')])&&_0x2279e8[_0x3421('0x30')]['role']!==_0x3421('0x2e')){throw new Error(_0x3421('0x8e'));}return licenseUtil[_0x3421('0x88')](_0x22cd4f)[_0x3421('0x29')](function(){return validateUser(_0x22cd4f[0x0]);})[_0x3421('0x29')](function(){for(var _0x520bf0=0x1;_0x520bf0<_0x22cd4f[_0x3421('0x4f')];_0x520bf0++){var _0x27f246=_0x22cd4f[_0x520bf0-0x1][_0x3421('0x6a')];if(!_0x22cd4f[_0x520bf0][_0x3421('0x6a')])_0x22cd4f[_0x520bf0][_0x3421('0x6a')]=_0x27f246+0x1;_0x303ada[_0x3421('0x4b')](validateUser(_0x22cd4f[_0x520bf0]));}return Promise[_0x3421('0x63')](_0x303ada);})[_0x3421('0x29')](function(){_0x303ada=[];for(var _0x5268a8=0x0;_0x5268a8<_0x22cd4f[_0x3421('0x4f')];_0x5268a8++){_0x303ada[_0x3421('0x4b')](updateUser(_0x22cd4f[_0x5268a8]));}return Promise['all'](_0x303ada);})['then'](function(){_0x303ada=_0x22cd4f[_0x3421('0x8f')](function(_0x514caa){return db[_0x3421('0x3b')][_0x3421('0x85')](_0x514caa,{'include':[{'model':db[_0x3421('0x8a')],'as':_0x3421('0x8a')}]})[_0x3421('0x29')](function(_0xc49cc8){_0x514caa['id']=_0xc49cc8['id'];return _0x514caa;});});return Promise[_0x3421('0x63')](_0x303ada);})[_0x3421('0x29')](function(_0x2a7089){if(_0x2279e8[_0x3421('0x65')]['role']===_0x3421('0x30'))return _0x2a7089;if(_0x2279e8['user'][_0x3421('0x2d')]!==_0x3421('0x30'))return _0x2a7089;var _0x20dd42=_[_0x3421('0x8d')](_0x2a7089,function(_0x491400){return _0x491400[_0x3421('0x2d')]===_0x3421('0x32')||_0x491400['role']===_0x3421('0x90');});if(!_0x20dd42)return _0x2a7089;return db[_0x3421('0x8b')][_0x3421('0x4c')]({'where':{'name':{'$or':[_0x3421('0x31'),_0x3421('0x33')]},'userProfileId':_0x2279e8[_0x3421('0x30')][_0x3421('0x91')]},'raw':!![]})[_0x3421('0x29')](function(_0x288a59){if(_['isEmpty'](_0x288a59)||!_['some'](_0x288a59,[_0x3421('0x92'),0x0]))return _0x2a7089;_0x303ada=[];var _0x1a060a=_(_0x288a59)[_0x3421('0x8f')](function(_0x58f9fe){if(_0x58f9fe[_0x3421('0x92')]===0x1)return;return _0x58f9fe[_0x3421('0x37')]==='Agents'?_0x3421('0x32'):'telephone';})[_0x3421('0x93')]()['value']();for(var _0x5c631e=0x0;_0x5c631e<_0x2a7089[_0x3421('0x4f')];_0x5c631e++){if(!_[_0x3421('0x49')](_0x1a060a,_0x2a7089[_0x5c631e][_0x3421('0x2d')]))return;var _0x279296=_0x2a7089[_0x5c631e]['role']===_0x3421('0x32')?_0x3421('0x31'):_0x3421('0x33');_0x303ada['push'](db['UserProfileResource'][_0x3421('0x85')]({'name':_0x2a7089[_0x5c631e]['name'],'resourceId':_0x2a7089[_0x5c631e]['id'],'type':_0x279296,'sectionId':_[_0x3421('0x36')](_0x288a59,[_0x3421('0x37'),_0x279296])['id']},{}));}return Promise['all'](_0x303ada);});})[_0x3421('0x29')](respondWithResult(_0x18bfff,0xc9))[_0x3421('0x1f')](handleError(_0x18bfff,null));};exports[_0x3421('0x94')]=function(_0x8ff8a2,_0x3dcf15){if(_0x8ff8a2['body']['id']){delete _0x8ff8a2['body']['id'];}return db['User'][_0x3421('0x36')]({'where':{'id':_0x8ff8a2['params']['id']}})[_0x3421('0x29')](function(_0x51ba2a){if(!_0x51ba2a)return null;if(_0x51ba2a['id']===_0x8ff8a2['user']['id']){if(!_0x8ff8a2[_0x3421('0x65')][_0x3421('0x95')]||!_0x8ff8a2[_0x3421('0x65')][_0x3421('0x96')]){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0x99'));}if(!_0x51ba2a[_0x3421('0x9a')](_0x8ff8a2[_0x3421('0x65')][_0x3421('0x95')])){throw new db[(_0x3421('0x97'))]['ValidationError'](_0x3421('0x9b'));}if(_0x8ff8a2[_0x3421('0x65')][_0x3421('0x95')]===_0x8ff8a2[_0x3421('0x65')][_0x3421('0x96')]){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0x9c'));}}else if(_0x8ff8a2[_0x3421('0x30')][_0x3421('0x2d')]===_0x3421('0x2e')){if(!_0x8ff8a2['body'][_0x3421('0x96')]){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x8ff8a2[_0x3421('0x30')][_0x3421('0x2d')]===_0x3421('0x30')){if(!_0x8ff8a2[_0x3421('0x65')][_0x3421('0x96')]){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x51ba2a[_0x3421('0x2d')]!==_0x3421('0x32')){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0x86'));}}else{throw new db[(_0x3421('0x97'))]['ValidationError']('Unauthorized');}return _0x51ba2a;})[_0x3421('0x29')](handleEntityNotFound(_0x3dcf15,null))[_0x3421('0x29')](function(_0x432ac7){return db[_0x3421('0x6b')][_0x3421('0x9d')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x3421('0x9e')]})['then'](function(_0xf18489){if(_0xf18489['securePassword'])authService[_0x3421('0x6d')](_0x8ff8a2['body'][_0x3421('0x96')]);if(!_0xf18489[_0x3421('0x9f')]||!_0x432ac7[_0x3421('0xa0')])return _0x432ac7;authService[_0x3421('0xa1')](_0x8ff8a2[_0x3421('0x65')][_0x3421('0x96')],_0x432ac7[_0x3421('0xa0')],_0xf18489[_0x3421('0x9e')]);return _0x432ac7;})[_0x3421('0x29')](saveUpdates({'password':_0x8ff8a2['body']['newPassword'],'passwordResetAt':_0x8ff8a2[_0x3421('0x30')]['id']==_0x8ff8a2[_0x3421('0x56')]['id']?moment():null,'previousPasswords':authService[_0x3421('0xa2')](_0x8ff8a2['body'][_0x3421('0x96')],_0x432ac7['previousPasswords'])},null));})[_0x3421('0x29')](respondWithResult(_0x3dcf15,null))[_0x3421('0x1f')](handleError(_0x3dcf15,null));};exports[_0x3421('0xa3')]=function(_0x47f6bc,_0xf38a12){var _0x3e9661=_0x47f6bc[_0x3421('0x65')][_0x3421('0xa4')];return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x47f6bc['params']['id']},'attributes':['id',_0x3421('0x37'),'role',_0x3421('0xa5'),_0x3421('0xa6'),_0x3421('0xa7'),_0x3421('0xa8')]})[_0x3421('0x29')](handleEntityNotFound(_0xf38a12,null))[_0x3421('0x29')](function(_0x300bb8){if(_0x300bb8){if(!utils[_0x3421('0xa9')](_0x3e9661)){throw new db['Sequelize'][(_0x3421('0x98'))](_0x3421('0xaa'));}return _0x300bb8['add'+_['capitalize'](_0x3e9661[_0x3421('0xab')]())+_0x3421('0xac')](_0x47f6bc[_0x3421('0x65')]['ids'],{'penalty':_0x47f6bc[_0x3421('0x65')]['penalty']||0x0})[_0x3421('0xad')](function(_0x298b4c){for(var _0x13c556=0x0;_0x13c556<_0x47f6bc[_0x3421('0x65')][_0x3421('0x69')][_0x3421('0x4f')];_0x13c556+=0x1){var _0x1397c6={'UserId':Number(_0x47f6bc[_0x3421('0x56')]['id'])};_0x1397c6[_['capitalize'](_0x3e9661['toLowerCase']())+_0x3421('0xae')]=Number(_0x47f6bc[_0x3421('0x65')][_0x3421('0x69')][_0x13c556]);socket['emit'](_0x3421('0x30')+_[_0x3421('0xaf')](_0x3e9661[_0x3421('0xab')]())+'Queue:save',_0x1397c6);}return _0x298b4c;})[_0x3421('0x29')](function(){if(_0x3e9661===_0x3421('0xb0')){return db[_0x3421('0xb1')]['findAll']({'where':{'id':_0x47f6bc[_0x3421('0x65')]['ids']||[]},'raw':!![],'attributes':['id',_0x3421('0x37')]});}})[_0x3421('0x29')](function(_0x24a846){var _0x82c418=_0x300bb8[_0x3421('0x2c')]({'plain':!![]});var _0x1d2716=[];if(_0x3e9661===_0x3421('0xb0')&&_0x82c418['role']===_0x3421('0x32')&&_0x82c418[_0x3421('0xa5')]){for(let _0x4c3980=0x0;_0x4c3980<_0x24a846['length'];_0x4c3980+=0x1){_0x1d2716[_0x3421('0x4b')]({'membername':_0x82c418[_0x3421('0x37')],'UserId':_0x82c418['id'],'queue_name':_0x24a846[_0x4c3980][_0x3421('0x37')],'VoiceQueueId':_0x24a846[_0x4c3980]['id'],'interface':_[_0x3421('0x6f')](_0x82c418[_0x3421('0xa8')])?util[_0x3421('0xb2')](_0x3421('0xb3'),_0x82c418[_0x3421('0x37')]):_0x82c418[_0x3421('0xa8')],'paused':_0x82c418[_0x3421('0xa7')]||![],'penalty':_0x47f6bc[_0x3421('0x65')][_0x3421('0xb4')]||0x0});}return Promise['all'](_0x1d2716[_0x3421('0x8f')](function(_0x2449c0){return db[_0x3421('0xb5')]['upsert'](_0x2449c0);}));}return _0x300bb8;});}})[_0x3421('0x29')](respondWithStatusCode(_0xf38a12,null))[_0x3421('0x1f')](handleError(_0xf38a12,null));};exports['removeQueues']=function(_0x202416,_0x26b3ee){var _0x2f82c1,_0x40eb5c;return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x202416['params']['id']},'attributes':['id',_0x3421('0x37'),_0x3421('0x2d')]})[_0x3421('0x29')](handleEntityNotFound(_0x26b3ee,null))['then'](function(_0x850584){if(_0x850584){_0x2f82c1=_0x850584;if(!_0x202416[_0x3421('0x45')]['channel']||!utils[_0x3421('0xa9')](_0x202416[_0x3421('0x45')][_0x3421('0xa4')])){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0xaa'));}return _0x850584[_0x3421('0xb6')+_[_0x3421('0xaf')](_0x202416['query']['channel']['toLowerCase']())+_0x3421('0xac')](_0x202416[_0x3421('0x45')][_0x3421('0x69')]);}})['then'](function(_0x3800fa){if(_['isArray'](_0x202416[_0x3421('0x45')][_0x3421('0x69')])){for(var _0x4d295c=0x0;_0x4d295c<_0x202416[_0x3421('0x45')][_0x3421('0x69')][_0x3421('0x4f')];_0x4d295c+=0x1){_0x40eb5c={'UserId':Number(_0x202416[_0x3421('0x56')]['id'])};_0x40eb5c[_[_0x3421('0xaf')](_0x202416[_0x3421('0x45')][_0x3421('0xa4')][_0x3421('0xab')]())+_0x3421('0xae')]=Number(_0x202416[_0x3421('0x45')]['ids'][_0x4d295c]);socket[_0x3421('0x2a')](_0x3421('0x30')+_[_0x3421('0xaf')](_0x202416[_0x3421('0x45')][_0x3421('0xa4')][_0x3421('0xab')]())+_0x3421('0xb7'),_0x40eb5c);}}else{_0x40eb5c={'UserId':Number(_0x202416[_0x3421('0x56')]['id'])};_0x40eb5c[_[_0x3421('0xaf')](_0x202416[_0x3421('0x45')][_0x3421('0xa4')][_0x3421('0xab')]())+_0x3421('0xae')]=Number(_0x202416['query'][_0x3421('0x69')]);socket['emit'](_0x3421('0x30')+_[_0x3421('0xaf')](_0x202416[_0x3421('0x45')]['channel'][_0x3421('0xab')]())+_0x3421('0xb7'),_0x40eb5c);}return _0x3800fa;})[_0x3421('0x29')](function(){if(_0x202416[_0x3421('0x45')]['channel']===_0x3421('0xb0')){return db[_0x3421('0xb5')]['destroy']({'where':{'UserId':_0x202416['params']['id'],'VoiceQueueId':_0x202416['query'][_0x3421('0x69')]},'individualHooks':!![]})[_0x3421('0x29')](function(){return _0x2f82c1;});}return _0x2f82c1;})[_0x3421('0x29')](respondWithStatusCode(_0x26b3ee,null))[_0x3421('0x1f')](handleError(_0x26b3ee,null));};exports['addAvatar']=function(_0xa0be8f,_0x549f74){_0xa0be8f[_0x3421('0x65')][_0x3421('0xb8')]=_0xa0be8f[_0x3421('0xb9')]['filename'];return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0xa0be8f['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x549f74,null))[_0x3421('0x29')](saveUpdates(_0xa0be8f[_0x3421('0x65')],null))[_0x3421('0x29')](respondWithResult(_0x549f74,null))[_0x3421('0x1f')](handleError(_0x549f74,null));};exports['getAvatar']=function(_0x99f8f4,_0x4447f0){var _0x15fe37=path[_0x3421('0xba')](config[_0x3421('0xbb')],_0x3421('0xbc'));return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x99f8f4['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x3421('0x29')](handleEntityNotFound(_0x4447f0,null))[_0x3421('0x29')](function(_0xc63b91){if(_0xc63b91){if(_[_0x3421('0x6f')](_0xc63b91[_0x3421('0xb8')])){return _0x4447f0[_0x3421('0xbd')](_0x15fe37);}else{if(!fs[_0x3421('0xbe')](path[_0x3421('0xba')](config[_0x3421('0xbb')],_0x3421('0xbf'),_0xc63b91[_0x3421('0xb8')]))){return _0x4447f0[_0x3421('0xbd')](_0x15fe37);}return _0x4447f0[_0x3421('0xbd')](path[_0x3421('0xba')](config['root'],'server/files/images/',_0xc63b91[_0x3421('0xb8')]));}}})[_0x3421('0x1f')](handleError(_0x4447f0,null));};exports[_0x3421('0xc0')]=function(_0x36b677,_0x543275){return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x36b677['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x543275,null))[_0x3421('0x29')](function(_0x141693){var _0x25f983=[];values=_0x141693[_0x3421('0x51')];_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x50'),_0x141693['dataValues']));_0x25f983['push'](get_open_tabs(_0x3421('0x61'),_0x141693[_0x3421('0x51')]));_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x54'),_0x141693[_0x3421('0x51')]));_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x62'),_0x141693[_0x3421('0x51')]));_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x52'),_0x141693['dataValues']));_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x53'),_0x141693[_0x3421('0x51')]));return Promise[_0x3421('0x63')](_0x25f983);})['then'](function(_0x3c2076){if(_0x3c2076){var _0x2df1fd=_[_0x3421('0x8f')](values['ChatOpenTabs'],function(_0x2eb0cd){return{'channel':_0x3421('0xc1'),'id':_0x2eb0cd['id'],'createdAt':_0x2eb0cd[_0x3421('0xc2')]};});var _0x1f8eed=_[_0x3421('0x8f')](values['FaxOpenTabs'],function(_0x506ebd){return{'channel':_0x3421('0xc3'),'id':_0x506ebd['id'],'createdAt':_0x506ebd[_0x3421('0xc2')]};});var _0x3392d1=_[_0x3421('0x8f')](values['OpenchannelOpenTabs'],function(_0x448b64){return{'channel':_0x3421('0xc4'),'id':_0x448b64['id'],'createdAt':_0x448b64[_0x3421('0xc2')]};});var _0x536ccb=_[_0x3421('0x8f')](values['MailOpenTabs'],function(_0x1f1a24){return{'channel':_0x3421('0xc5'),'id':_0x1f1a24['id'],'createdAt':_0x1f1a24['createdAt']};});var _0xf6dd94=_[_0x3421('0x8f')](values[_0x3421('0xc6')],function(_0x160e83){return{'channel':_0x3421('0xc7'),'id':_0x160e83['id'],'createdAt':_0x160e83['createdAt']};});var _0x48f193=_['map'](values[_0x3421('0xc8')],function(_0x149774){return{'channel':_0x3421('0xc9'),'id':_0x149774['id'],'createdAt':_0x149774[_0x3421('0xc2')]};});var _0x4df5b6=_['concat'](_0x2df1fd,_0x1f8eed,_0x3392d1,_0x536ccb,_0xf6dd94,_0x48f193);var _0x43e05a={'count':_0x4df5b6[_0x3421('0x4f')],'rows':_0x4df5b6};return _0x43e05a;}else return null;})[_0x3421('0x29')](respondWithResult(_0x543275,null))[_0x3421('0x1f')](handleError(_0x543275,null));};exports['getContacts']=function(_0x5d7eb9,_0x1da942){var _0x2029bb={};var _0x4f7012={};var _0x5d42b2;var _0x5b5ec3;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x5d7eb9['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x1da942,null))[_0x3421('0x29')](function(_0x41990){if(_0x41990){_0x5d42b2=_0x41990;_0x4f7012[_0x3421('0x57')]=_[_0x3421('0x59')](db['CmContact']['rawAttributes']);_0x4f7012[_0x3421('0x45')]=_[_0x3421('0x59')](_0x5d7eb9['query']);_0x4f7012[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x4f7012['model'],_0x4f7012[_0x3421('0x45')]);_0x2029bb[_0x3421('0x4a')]=_['intersection'](_0x4f7012[_0x3421('0x57')],qs['fields'](_0x5d7eb9[_0x3421('0x45')][_0x3421('0x5c')]));_0x2029bb[_0x3421('0x4a')]=_0x2029bb[_0x3421('0x4a')][_0x3421('0x4f')]?_0x2029bb['attributes']:_0x4f7012[_0x3421('0x57')];_0x2029bb[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x5d7eb9[_0x3421('0x45')][_0x3421('0xcb')]);_0x2029bb[_0x3421('0x43')]=qs['filters'](_[_0x3421('0xcc')](_0x5d7eb9[_0x3421('0x45')],_0x4f7012[_0x3421('0x5a')]));if(_0x5d7eb9[_0x3421('0x45')]['filter']){_0x2029bb[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x2029bb[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x2029bb[_0x3421('0x4a')],function(_0x759b01){var _0xb504d6={};_0xb504d6[_0x759b01]={'$like':'%'+_0x5d7eb9['query'][_0x3421('0x40')]+'%'};return _0xb504d6;})});}_0x2029bb=_[_0x3421('0x5e')]({},_0x2029bb,_0x5d7eb9[_0x3421('0x5f')]);return _0x5d42b2[_0x3421('0xcd')](_0x2029bb);}})['then'](function(_0x23b3be){if(_0x23b3be){_0x5b5ec3=_0x23b3be[_0x3421('0x4f')];if(_0x5d7eb9[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0x46'))){_0x2029bb[_0x3421('0x47')]=[{'model':db[_0x3421('0xcf')],'as':_0x3421('0xd0'),'required':![]},{'model':db[_0x3421('0xd1')],'as':_0x3421('0xd2'),'attributes':['id',_0x3421('0x37'),'color'],'where':_0x5d7eb9['query'][_0x3421('0xd3')]?{'id':_0x5d7eb9[_0x3421('0x45')][_0x3421('0xd3')]}:undefined,'required':_0x5d7eb9['query'][_0x3421('0xd3')]?!![]:![]}];}if(!_0x5d7eb9[_0x3421('0x45')][_0x3421('0xce')]('nolimit')){_0x2029bb[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x5d7eb9['query']['limit']);_0x2029bb[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x5d7eb9[_0x3421('0x45')][_0x3421('0x24')]);}return _0x5d42b2[_0x3421('0xcd')](_0x2029bb);}})[_0x3421('0x29')](function(_0x23e05d){if(_0x23e05d){return _0x23e05d?{'count':_0x5b5ec3,'rows':_0x23e05d}:null;}})[_0x3421('0x29')](respondWithResult(_0x1da942,null))[_0x3421('0x1f')](handleError(_0x1da942,null));};exports[_0x3421('0xd4')]=function(_0x3fd247,_0x55db5d){var _0x1a6ddd;var _0x2e7601={};var _0x23728d;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x3fd247['params']['id']},'attributes':['id',_0x3421('0x37'),'role']})[_0x3421('0x29')](handleEntityNotFound(_0x55db5d,null))[_0x3421('0x29')](function(_0xb750f9){if(!utils[_0x3421('0xa9')](_0x3fd247['query'][_0x3421('0xa4')])){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))]('Unknown\x20channel');}_0x1a6ddd=_0xb750f9;var _0x1f4181={};_0x1f4181['model']=_[_0x3421('0x59')](db[_[_0x3421('0xaf')](_0x3fd247['query']['channel'])+_0x3421('0xd5')]['rawAttributes']);_0x1f4181['query']=_[_0x3421('0x59')](_0x3fd247[_0x3421('0x45')]);_0x1f4181[_0x3421('0x5a')]=_['intersection'](_0x1f4181[_0x3421('0x57')],_0x1f4181[_0x3421('0x45')]);_0x2e7601['attributes']=_[_0x3421('0x5b')](_0x1f4181[_0x3421('0x57')],qs['fields'](_0x3fd247[_0x3421('0x45')][_0x3421('0x5c')]));_0x2e7601['attributes']=_0x2e7601['attributes']['length']?_0x2e7601[_0x3421('0x4a')]:_0x1f4181[_0x3421('0x57')];_0x2e7601[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x3fd247[_0x3421('0x45')][_0x3421('0xcb')]);_0x2e7601[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x3fd247['query'],_0x1f4181[_0x3421('0x5a')]));if(_0x3fd247[_0x3421('0x45')][_0x3421('0x40')]){_0x2e7601[_0x3421('0x43')]=_['merge'](_0x2e7601[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x2e7601['attributes'],function(_0x321f39){var _0x2cb77c={};_0x2cb77c[_0x321f39]={'$like':'%'+_0x3fd247['query'][_0x3421('0x40')]+'%'};return _0x2cb77c;})});}_0x2e7601=_[_0x3421('0x5e')]({},_0x2e7601,_0x3fd247['options']);switch(_0x1a6ddd[_0x3421('0x2d')]){case _0x3421('0x2e'):return db[_[_0x3421('0xaf')](_0x3fd247['query'][_0x3421('0xa4')])+'Queue'][_0x3421('0x4c')](_0x2e7601);case _0x3421('0x30'):case'agent':return _0x1a6ddd[_0x3421('0x2c')+_['capitalize'](_0x3fd247[_0x3421('0x45')][_0x3421('0xa4')])+'Queues'](_0x2e7601);default:throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0xd6'));}})[_0x3421('0x29')](function(_0x6ee685){_0x23728d=_0x6ee685[_0x3421('0x4f')];if(!_0x3fd247[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x2e7601[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x3fd247[_0x3421('0x45')][_0x3421('0x26')]);_0x2e7601[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x3fd247[_0x3421('0x45')][_0x3421('0x24')]);}switch(_0x1a6ddd['role']){case _0x3421('0x2e'):return db[_['capitalize'](_0x3fd247[_0x3421('0x45')]['channel'])+_0x3421('0xd5')][_0x3421('0x4c')](_0x2e7601);case _0x3421('0x30'):case _0x3421('0x32'):return _0x1a6ddd[_0x3421('0x2c')+_[_0x3421('0xaf')](_0x3fd247[_0x3421('0x45')]['channel'])+_0x3421('0xac')](_0x2e7601);}})[_0x3421('0x29')](function(_0x1e5337){return{'count':_0x23728d,'rows':_0x1e5337};})[_0x3421('0x29')](respondWithResult(_0x55db5d,null))['catch'](handleError(_0x55db5d,null));};exports[_0x3421('0xd8')]=function(_0x4ffb90,_0x3e45fd){var _0x1d5c97={};var _0x3e9a9b={};var _0x19f109;var _0x400ed7;return db[_0x3421('0x3b')]['findOne']({'where':{'id':_0x4ffb90[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x3e45fd,null))[_0x3421('0x29')](function(_0x185132){if(_0x185132){_0x19f109=_0x185132;_0x3e9a9b[_0x3421('0x57')]=_[_0x3421('0x59')](db['UserVoiceQueueRt'][_0x3421('0x3c')]);_0x3e9a9b[_0x3421('0x45')]=_[_0x3421('0x59')](_0x4ffb90[_0x3421('0x45')]);_0x3e9a9b['filters']=_['intersection'](_0x3e9a9b[_0x3421('0x57')],_0x3e9a9b[_0x3421('0x45')]);_0x1d5c97['attributes']=_[_0x3421('0x5b')](_0x3e9a9b[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x4ffb90[_0x3421('0x45')][_0x3421('0x5c')]));_0x1d5c97[_0x3421('0x4a')]=_0x1d5c97[_0x3421('0x4a')][_0x3421('0x4f')]?_0x1d5c97[_0x3421('0x4a')]:_0x3e9a9b['model'];_0x1d5c97[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x4ffb90[_0x3421('0x45')]['sort']);_0x1d5c97[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x4ffb90[_0x3421('0x45')],_0x3e9a9b['filters']));if(_0x4ffb90[_0x3421('0x45')][_0x3421('0x40')]){_0x1d5c97[_0x3421('0x43')]=_['merge'](_0x1d5c97[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x1d5c97[_0x3421('0x4a')],function(_0x37969f){var _0x88aeb2={};_0x88aeb2[_0x37969f]={'$like':'%'+_0x4ffb90['query'][_0x3421('0x40')]+'%'};return _0x88aeb2;})});}_0x1d5c97=_[_0x3421('0x5e')]({},_0x1d5c97,_0x4ffb90[_0x3421('0x5f')]);return _0x19f109[_0x3421('0xd8')](_0x1d5c97);}})['then'](function(_0x4a4272){if(_0x4a4272){_0x400ed7=_0x4a4272[_0x3421('0x4f')];if(!_0x4ffb90[_0x3421('0x45')]['hasOwnProperty'](_0x3421('0xd7'))){_0x1d5c97['limit']=qs[_0x3421('0x26')](_0x4ffb90[_0x3421('0x45')][_0x3421('0x26')]);_0x1d5c97[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x4ffb90[_0x3421('0x45')][_0x3421('0x24')]);}return _0x19f109[_0x3421('0xd8')](_0x1d5c97);}})['then'](function(_0xe5ef24){if(_0xe5ef24){return _0xe5ef24?{'count':_0x400ed7,'rows':_0xe5ef24}:null;}})[_0x3421('0x29')](respondWithResult(_0x3e45fd,null))[_0x3421('0x1f')](handleError(_0x3e45fd,null));};exports[_0x3421('0xd9')]=function(_0x2f3403,_0x2ae580){var _0x2cf7ec={};var _0x1adcb4={};var _0x7cb2c8;var _0x3e0100;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x2f3403[_0x3421('0x56')]['id']}})['then'](handleEntityNotFound(_0x2ae580,null))[_0x3421('0x29')](function(_0x361d61){if(_0x361d61){_0x7cb2c8=_0x361d61;_0x1adcb4[_0x3421('0x57')]=_['keys'](db['ChatGroup'][_0x3421('0x3c')]);_0x1adcb4[_0x3421('0x45')]=_[_0x3421('0x59')](_0x2f3403[_0x3421('0x45')]);_0x1adcb4[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x1adcb4[_0x3421('0x57')],_0x1adcb4[_0x3421('0x45')]);_0x2cf7ec[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x1adcb4[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x2f3403[_0x3421('0x45')][_0x3421('0x5c')]));_0x2cf7ec[_0x3421('0x4a')]=_0x2cf7ec[_0x3421('0x4a')][_0x3421('0x4f')]?_0x2cf7ec['attributes']:_0x1adcb4[_0x3421('0x57')];_0x2cf7ec[_0x3421('0xca')]=qs['sort'](_0x2f3403[_0x3421('0x45')][_0x3421('0xcb')]);_0x2cf7ec['where']=qs['filters'](_[_0x3421('0xcc')](_0x2f3403[_0x3421('0x45')],_0x1adcb4['filters']));if(_0x2f3403[_0x3421('0x45')]['filter']){_0x2cf7ec[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x2cf7ec[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x2cf7ec[_0x3421('0x4a')],function(_0xf33dfc){var _0x44fca8={};_0x44fca8[_0xf33dfc]={'$like':'%'+_0x2f3403['query'][_0x3421('0x40')]+'%'};return _0x44fca8;})});}_0x2cf7ec=_[_0x3421('0x5e')]({},_0x2cf7ec,_0x2f3403[_0x3421('0x5f')]);return _0x7cb2c8[_0x3421('0xd9')](_0x2cf7ec);}})[_0x3421('0x29')](function(_0x584163){if(_0x584163){_0x3e0100=_0x584163[_0x3421('0x4f')];if(!_0x2f3403['query'][_0x3421('0xce')](_0x3421('0xd7'))){_0x2cf7ec[_0x3421('0x26')]=qs['limit'](_0x2f3403[_0x3421('0x45')][_0x3421('0x26')]);_0x2cf7ec[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x2f3403[_0x3421('0x45')][_0x3421('0x24')]);}return _0x7cb2c8['getGroups'](_0x2cf7ec);}})[_0x3421('0x29')](function(_0x132345){if(_0x132345){return _0x132345?{'count':_0x3e0100,'rows':_0x132345}:null;}})[_0x3421('0x29')](respondWithResult(_0x2ae580,null))[_0x3421('0x1f')](handleError(_0x2ae580,null));};exports[_0x3421('0xda')]=function(_0x425b8d,_0x28b4b7){var _0x24fcf5={'raw':!![],'where':{}};var _0x4836de={};var _0x294981={'count':0x0,'rows':[]};return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x425b8d['params']['id']}})['then'](handleEntityNotFound(_0x28b4b7,null))[_0x3421('0x29')](function(_0x3af1eb){if(_0x3af1eb){_0x4836de[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xdb')][_0x3421('0x3c')]);_0x4836de[_0x3421('0x45')]=_[_0x3421('0x59')](_0x425b8d[_0x3421('0x45')]);_0x4836de[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x4836de[_0x3421('0x57')],_0x4836de[_0x3421('0x45')]);_0x24fcf5[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x4836de[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x425b8d[_0x3421('0x45')][_0x3421('0x5c')]));_0x24fcf5[_0x3421('0x4a')]=_0x24fcf5[_0x3421('0x4a')][_0x3421('0x4f')]?_0x24fcf5[_0x3421('0x4a')]:_0x4836de[_0x3421('0x57')];if(!_0x425b8d[_0x3421('0x45')][_0x3421('0xce')]('nolimit')){_0x24fcf5['limit']=qs[_0x3421('0x26')](_0x425b8d[_0x3421('0x45')]['limit']);_0x24fcf5[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x425b8d['query'][_0x3421('0x24')]);}_0x24fcf5[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x425b8d[_0x3421('0x45')][_0x3421('0xcb')]);_0x24fcf5[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x425b8d[_0x3421('0x45')],_0x4836de[_0x3421('0x5a')]));_0x24fcf5['where'][_0x3421('0xdc')]=_0x3af1eb['id'];if(_0x425b8d[_0x3421('0x45')]['filter']){_0x24fcf5[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x24fcf5['where'],{'$or':_[_0x3421('0x8f')](_0x24fcf5[_0x3421('0x4a')],function(_0x974094){var _0x955bcd={};_0x955bcd[_0x974094]={'$like':'%'+_0x425b8d[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x955bcd;})});}_0x24fcf5=_[_0x3421('0x5e')]({},_0x24fcf5,_0x425b8d['options']);return db[_0x3421('0xdb')][_0x3421('0x44')]({'where':_0x24fcf5[_0x3421('0x43')]})[_0x3421('0x29')](function(_0x213ebd){_0x294981['count']=_0x213ebd;if(_0x425b8d['query'][_0x3421('0x46')]){_0x24fcf5[_0x3421('0x47')]=[{'all':!![]}];}return db[_0x3421('0xdb')]['findAll'](_0x24fcf5);})[_0x3421('0x29')](function(_0x23d16d){_0x294981[_0x3421('0x4d')]=_0x23d16d;return _0x294981;});}})['then'](respondWithFilteredResult(_0x28b4b7,_0x24fcf5))[_0x3421('0x1f')](handleError(_0x28b4b7,null));};exports[_0x3421('0xdd')]=function(_0x36f447,_0x396314){var _0x41b537={'raw':!![],'where':{}};var _0x3198f8={};var _0x3a9560={'count':0x0,'rows':[]};return db[_0x3421('0x3b')]['findOne']({'where':{'id':_0x36f447['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x396314,null))[_0x3421('0x29')](function(_0x3c0496){if(_0x3c0496){_0x3198f8['model']=_[_0x3421('0x59')](db[_0x3421('0xde')][_0x3421('0x3c')]);_0x3198f8['query']=_[_0x3421('0x59')](_0x36f447['query']);_0x3198f8['filters']=_[_0x3421('0x5b')](_0x3198f8['model'],_0x3198f8[_0x3421('0x45')]);_0x41b537[_0x3421('0x4a')]=_['intersection'](_0x3198f8[_0x3421('0x57')],qs['fields'](_0x36f447[_0x3421('0x45')][_0x3421('0x5c')]));_0x41b537[_0x3421('0x4a')]=_0x41b537[_0x3421('0x4a')][_0x3421('0x4f')]?_0x41b537[_0x3421('0x4a')]:_0x3198f8[_0x3421('0x57')];if(!_0x36f447[_0x3421('0x45')]['hasOwnProperty'](_0x3421('0xd7'))){_0x41b537[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x36f447['query'][_0x3421('0x26')]);_0x41b537[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x36f447['query'][_0x3421('0x24')]);}_0x41b537[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x36f447[_0x3421('0x45')][_0x3421('0xcb')]);_0x41b537[_0x3421('0x43')]=qs['filters'](_['pick'](_0x36f447[_0x3421('0x45')],_0x3198f8[_0x3421('0x5a')]));_0x41b537['where'][_0x3421('0xdc')]=_0x3c0496['id'];if(_0x36f447[_0x3421('0x45')][_0x3421('0x40')]){_0x41b537['where']=_[_0x3421('0x5e')](_0x41b537[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x41b537[_0x3421('0x4a')],function(_0x3e0c11){var _0x5933b3={};_0x5933b3[_0x3e0c11]={'$like':'%'+_0x36f447[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x5933b3;})});}_0x41b537=_['merge']({},_0x41b537,_0x36f447[_0x3421('0x5f')]);return db[_0x3421('0xde')][_0x3421('0x44')]({'where':_0x41b537[_0x3421('0x43')]})['then'](function(_0x5dc48b){_0x3a9560[_0x3421('0x44')]=_0x5dc48b;if(_0x36f447['query'][_0x3421('0x46')]){_0x41b537[_0x3421('0x47')]=[{'all':!![]}];}return db['ScreenRecording'][_0x3421('0x4c')](_0x41b537);})[_0x3421('0x29')](function(_0x343134){_0x3a9560[_0x3421('0x4d')]=_0x343134;return _0x3a9560;});}})[_0x3421('0x29')](respondWithFilteredResult(_0x396314,_0x41b537))[_0x3421('0x1f')](handleError(_0x396314,null));};exports[_0x3421('0xdf')]=function(_0x3648b9,_0x251175){var _0x2c3d7b={};var _0x36f864={};var _0x4ed888;var _0x1b0c8b;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x3648b9[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x251175,null))[_0x3421('0x29')](function(_0x4091de){if(_0x4091de){_0x4ed888=_0x4091de;_0x36f864[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xe0')]['rawAttributes']);_0x36f864[_0x3421('0x45')]=_[_0x3421('0x59')](_0x3648b9[_0x3421('0x45')]);_0x36f864[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x36f864['model'],_0x36f864[_0x3421('0x45')]);_0x2c3d7b[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x36f864[_0x3421('0x57')],qs['fields'](_0x3648b9[_0x3421('0x45')][_0x3421('0x5c')]));_0x2c3d7b[_0x3421('0x4a')]=_0x2c3d7b['attributes'][_0x3421('0x4f')]?_0x2c3d7b[_0x3421('0x4a')]:_0x36f864[_0x3421('0x57')];_0x2c3d7b['order']=qs['sort'](_0x3648b9[_0x3421('0x45')][_0x3421('0xcb')]);_0x2c3d7b[_0x3421('0x43')]=qs['filters'](_['pick'](_0x3648b9[_0x3421('0x45')],_0x36f864[_0x3421('0x5a')]));if(_0x3648b9[_0x3421('0x45')][_0x3421('0x40')]){_0x2c3d7b['where']=_['merge'](_0x2c3d7b[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x2c3d7b[_0x3421('0x4a')],function(_0x43c347){var _0x3453bf={};_0x3453bf[_0x43c347]={'$like':'%'+_0x3648b9['query'][_0x3421('0x40')]+'%'};return _0x3453bf;})});}_0x2c3d7b=_[_0x3421('0x5e')]({},_0x2c3d7b,_0x3648b9['options']);return _0x4ed888[_0x3421('0xdf')](_0x2c3d7b);}})[_0x3421('0x29')](function(_0xff9808){if(_0xff9808){_0x1b0c8b=_0xff9808[_0x3421('0x4f')];if(!_0x3648b9['query'][_0x3421('0xce')](_0x3421('0xd7'))){_0x2c3d7b[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x3648b9['query'][_0x3421('0x26')]);_0x2c3d7b[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x3648b9[_0x3421('0x45')][_0x3421('0x24')]);}return _0x4ed888[_0x3421('0xdf')](_0x2c3d7b);}})[_0x3421('0x29')](function(_0x5665bc){if(_0x5665bc){return _0x5665bc?{'count':_0x1b0c8b,'rows':_0x5665bc}:null;}})[_0x3421('0x29')](respondWithResult(_0x251175,null))[_0x3421('0x1f')](handleError(_0x251175,null));};exports[_0x3421('0xe1')]=function(_0x589252,_0x17a45){var _0x333edf={};var _0x1c2340={};var _0x278fbc;var _0x221a45;return db[_0x3421('0x3b')]['findOne']({'where':{'id':_0x589252[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x17a45,null))[_0x3421('0x29')](function(_0x525c3b){if(_0x525c3b){_0x278fbc=_0x525c3b;_0x1c2340[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xe2')][_0x3421('0x3c')]);_0x1c2340[_0x3421('0x45')]=_['keys'](_0x589252[_0x3421('0x45')]);_0x1c2340[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x1c2340[_0x3421('0x57')],_0x1c2340[_0x3421('0x45')]);_0x333edf[_0x3421('0x4a')]=_['intersection'](_0x1c2340[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x589252['query'][_0x3421('0x5c')]));_0x333edf[_0x3421('0x4a')]=_0x333edf[_0x3421('0x4a')][_0x3421('0x4f')]?_0x333edf[_0x3421('0x4a')]:_0x1c2340[_0x3421('0x57')];_0x333edf[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x589252[_0x3421('0x45')]['sort']);_0x333edf[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x589252[_0x3421('0x45')],_0x1c2340['filters']));if(_0x589252['query'][_0x3421('0x40')]){_0x333edf['where']=_[_0x3421('0x5e')](_0x333edf[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x333edf[_0x3421('0x4a')],function(_0x65c5a){var _0x3bed3f={};_0x3bed3f[_0x65c5a]={'$like':'%'+_0x589252['query']['filter']+'%'};return _0x3bed3f;})});}_0x333edf=_[_0x3421('0x5e')]({},_0x333edf,_0x589252[_0x3421('0x5f')]);return _0x278fbc[_0x3421('0xe1')](_0x333edf);}})[_0x3421('0x29')](function(_0x406edc){if(_0x406edc){_0x221a45=_0x406edc['length'];if(!_0x589252['query'][_0x3421('0xce')]('nolimit')){_0x333edf[_0x3421('0x26')]=qs['limit'](_0x589252[_0x3421('0x45')][_0x3421('0x26')]);_0x333edf[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x589252['query']['offset']);}return _0x278fbc[_0x3421('0xe1')](_0x333edf);}})[_0x3421('0x29')](function(_0x450520){if(_0x450520){return _0x450520?{'count':_0x221a45,'rows':_0x450520}:null;}})[_0x3421('0x29')](respondWithResult(_0x17a45,null))[_0x3421('0x1f')](handleError(_0x17a45,null));};exports[_0x3421('0xe3')]=function(_0x13aaa8,_0x32ec38){var _0x263e8a={'raw':!![],'where':{}};var _0x88455f={};var _0x10240a={'count':0x0,'rows':[]};return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x13aaa8['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x32ec38,null))[_0x3421('0x29')](function(_0xd0b831){if(_0xd0b831){_0x88455f[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xe4')][_0x3421('0x3c')]);_0x88455f[_0x3421('0x45')]=_['keys'](_0x13aaa8['query']);_0x88455f['filters']=_[_0x3421('0x5b')](_0x88455f[_0x3421('0x57')],_0x88455f[_0x3421('0x45')]);_0x263e8a[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x88455f['model'],qs[_0x3421('0x5c')](_0x13aaa8[_0x3421('0x45')]['fields']));_0x263e8a['attributes']=_0x263e8a[_0x3421('0x4a')][_0x3421('0x4f')]?_0x263e8a['attributes']:_0x88455f[_0x3421('0x57')];if(!_0x13aaa8['query']['hasOwnProperty'](_0x3421('0xd7'))){_0x263e8a[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x13aaa8['query']['limit']);_0x263e8a[_0x3421('0x24')]=qs['offset'](_0x13aaa8['query'][_0x3421('0x24')]);}_0x263e8a['order']=qs[_0x3421('0xcb')](_0x13aaa8[_0x3421('0x45')][_0x3421('0xcb')]);_0x263e8a[_0x3421('0x43')]=qs[_0x3421('0x5a')](_['pick'](_0x13aaa8[_0x3421('0x45')],_0x88455f['filters']));_0x263e8a[_0x3421('0x43')][_0x3421('0xdc')]=_0xd0b831['id'];if(_0x13aaa8[_0x3421('0x45')][_0x3421('0x40')]){_0x263e8a[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x263e8a[_0x3421('0x43')],{'$or':_['map'](_0x263e8a[_0x3421('0x4a')],function(_0x34e2d2){var _0x1ba99b={};_0x1ba99b[_0x34e2d2]={'$like':'%'+_0x13aaa8[_0x3421('0x45')]['filter']+'%'};return _0x1ba99b;})});}_0x263e8a=_[_0x3421('0x5e')]({},_0x263e8a,_0x13aaa8[_0x3421('0x5f')]);return db[_0x3421('0xe4')][_0x3421('0x44')]({'where':_0x263e8a[_0x3421('0x43')]})[_0x3421('0x29')](function(_0x455fe9){_0x10240a[_0x3421('0x44')]=_0x455fe9;if(_0x13aaa8[_0x3421('0x45')][_0x3421('0x46')]){_0x263e8a[_0x3421('0x47')]=[{'all':!![]}];}return db['MailInteraction'][_0x3421('0x4c')](_0x263e8a);})[_0x3421('0x29')](function(_0x59bfc5){_0x10240a[_0x3421('0x4d')]=_0x59bfc5;return _0x10240a;});}})[_0x3421('0x29')](respondWithFilteredResult(_0x32ec38,_0x263e8a))[_0x3421('0x1f')](handleError(_0x32ec38,null));};exports[_0x3421('0xe5')]=function(_0x1115c2,_0x2f40d3){var _0x43897e={};var _0x2f85b3={};var _0x9433a4;var _0x56c74c;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x1115c2[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x2f40d3,null))[_0x3421('0x29')](function(_0xc5ffc2){if(_0xc5ffc2){_0x9433a4=_0xc5ffc2;_0x2f85b3[_0x3421('0x57')]=_['keys'](db[_0x3421('0xe6')][_0x3421('0x3c')]);_0x2f85b3[_0x3421('0x45')]=_[_0x3421('0x59')](_0x1115c2['query']);_0x2f85b3[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x2f85b3[_0x3421('0x57')],_0x2f85b3['query']);_0x43897e[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x2f85b3[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x1115c2[_0x3421('0x45')][_0x3421('0x5c')]));_0x43897e[_0x3421('0x4a')]=_0x43897e[_0x3421('0x4a')][_0x3421('0x4f')]?_0x43897e['attributes']:_0x2f85b3[_0x3421('0x57')];_0x43897e[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x1115c2[_0x3421('0x45')][_0x3421('0xcb')]);_0x43897e[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x1115c2[_0x3421('0x45')],_0x2f85b3[_0x3421('0x5a')]));if(_0x1115c2[_0x3421('0x45')]['filter']){_0x43897e[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x43897e[_0x3421('0x43')],{'$or':_['map'](_0x43897e[_0x3421('0x4a')],function(_0xed5d92){var _0x2935f4={};_0x2935f4[_0xed5d92]={'$like':'%'+_0x1115c2['query'][_0x3421('0x40')]+'%'};return _0x2935f4;})});}_0x43897e=_['merge']({},_0x43897e,_0x1115c2[_0x3421('0x5f')]);return _0x9433a4[_0x3421('0xe5')](_0x43897e);}})[_0x3421('0x29')](function(_0x149851){if(_0x149851){_0x56c74c=_0x149851[_0x3421('0x4f')];if(!_0x1115c2[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x43897e['limit']=qs[_0x3421('0x26')](_0x1115c2[_0x3421('0x45')]['limit']);_0x43897e[_0x3421('0x24')]=qs['offset'](_0x1115c2[_0x3421('0x45')][_0x3421('0x24')]);}return _0x9433a4[_0x3421('0xe5')](_0x43897e);}})[_0x3421('0x29')](function(_0x5796f4){if(_0x5796f4){return _0x5796f4?{'count':_0x56c74c,'rows':_0x5796f4}:null;}})[_0x3421('0x29')](respondWithResult(_0x2f40d3,null))[_0x3421('0x1f')](handleError(_0x2f40d3,null));};exports['getFaxInteractions']=function(_0x597c04,_0x51d10d){var _0x441562={};var _0x130905={};var _0x15da32;var _0x2b02d9;return db['User'][_0x3421('0x9d')]({'where':{'id':_0x597c04[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x51d10d,null))['then'](function(_0x106c64){if(_0x106c64){_0x15da32=_0x106c64;_0x130905[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xe7')]['rawAttributes']);_0x130905[_0x3421('0x45')]=_[_0x3421('0x59')](_0x597c04[_0x3421('0x45')]);_0x130905['filters']=_['intersection'](_0x130905['model'],_0x130905[_0x3421('0x45')]);_0x441562[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x130905[_0x3421('0x57')],qs['fields'](_0x597c04[_0x3421('0x45')][_0x3421('0x5c')]));_0x441562[_0x3421('0x4a')]=_0x441562[_0x3421('0x4a')][_0x3421('0x4f')]?_0x441562['attributes']:_0x130905[_0x3421('0x57')];_0x441562[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x597c04[_0x3421('0x45')][_0x3421('0xcb')]);_0x441562[_0x3421('0x43')]=qs['filters'](_[_0x3421('0xcc')](_0x597c04[_0x3421('0x45')],_0x130905[_0x3421('0x5a')]));if(_0x597c04[_0x3421('0x45')]['filter']){_0x441562[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x441562[_0x3421('0x43')],{'$or':_['map'](_0x441562[_0x3421('0x4a')],function(_0x2f61d6){var _0x3d74e9={};_0x3d74e9[_0x2f61d6]={'$like':'%'+_0x597c04[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x3d74e9;})});}_0x441562=_[_0x3421('0x5e')]({},_0x441562,_0x597c04[_0x3421('0x5f')]);return _0x15da32[_0x3421('0xe8')](_0x441562);}})[_0x3421('0x29')](function(_0x31bba3){if(_0x31bba3){_0x2b02d9=_0x31bba3['length'];if(!_0x597c04[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x441562[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x597c04[_0x3421('0x45')][_0x3421('0x26')]);_0x441562[_0x3421('0x24')]=qs['offset'](_0x597c04[_0x3421('0x45')][_0x3421('0x24')]);}return _0x15da32[_0x3421('0xe8')](_0x441562);}})[_0x3421('0x29')](function(_0x24efe9){if(_0x24efe9){return _0x24efe9?{'count':_0x2b02d9,'rows':_0x24efe9}:null;}})['then'](respondWithResult(_0x51d10d,null))[_0x3421('0x1f')](handleError(_0x51d10d,null));};exports[_0x3421('0xe9')]=function(_0x33b53c,_0x132ca2){var _0x1d14dc={};var _0x263cc1={};var _0x3a3c62;var _0x2475be;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x33b53c['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x132ca2,null))[_0x3421('0x29')](function(_0x5ba499){if(_0x5ba499){_0x3a3c62=_0x5ba499;_0x263cc1[_0x3421('0x57')]=_['keys'](db[_0x3421('0xea')][_0x3421('0x3c')]);_0x263cc1[_0x3421('0x45')]=_[_0x3421('0x59')](_0x33b53c[_0x3421('0x45')]);_0x263cc1[_0x3421('0x5a')]=_['intersection'](_0x263cc1[_0x3421('0x57')],_0x263cc1[_0x3421('0x45')]);_0x1d14dc[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x263cc1[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x33b53c[_0x3421('0x45')][_0x3421('0x5c')]));_0x1d14dc[_0x3421('0x4a')]=_0x1d14dc[_0x3421('0x4a')][_0x3421('0x4f')]?_0x1d14dc[_0x3421('0x4a')]:_0x263cc1[_0x3421('0x57')];_0x1d14dc[_0x3421('0xca')]=qs['sort'](_0x33b53c[_0x3421('0x45')][_0x3421('0xcb')]);_0x1d14dc['where']=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x33b53c[_0x3421('0x45')],_0x263cc1['filters']));if(_0x33b53c[_0x3421('0x45')][_0x3421('0x40')]){_0x1d14dc[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x1d14dc[_0x3421('0x43')],{'$or':_['map'](_0x1d14dc[_0x3421('0x4a')],function(_0x2d8418){var _0x2a896c={};_0x2a896c[_0x2d8418]={'$like':'%'+_0x33b53c['query'][_0x3421('0x40')]+'%'};return _0x2a896c;})});}_0x1d14dc=_[_0x3421('0x5e')]({},_0x1d14dc,_0x33b53c['options']);return _0x3a3c62[_0x3421('0xe9')](_0x1d14dc);}})[_0x3421('0x29')](function(_0x5e3620){if(_0x5e3620){_0x2475be=_0x5e3620[_0x3421('0x4f')];if(!_0x33b53c[_0x3421('0x45')][_0x3421('0xce')]('nolimit')){_0x1d14dc['limit']=qs[_0x3421('0x26')](_0x33b53c[_0x3421('0x45')][_0x3421('0x26')]);_0x1d14dc[_0x3421('0x24')]=qs['offset'](_0x33b53c[_0x3421('0x45')][_0x3421('0x24')]);}return _0x3a3c62[_0x3421('0xe9')](_0x1d14dc);}})[_0x3421('0x29')](function(_0x27dafe){if(_0x27dafe){return _0x27dafe?{'count':_0x2475be,'rows':_0x27dafe}:null;}})[_0x3421('0x29')](respondWithResult(_0x132ca2,null))['catch'](handleError(_0x132ca2,null));};exports[_0x3421('0xeb')]=function(_0x43ab9a,_0x137553,_0x1f2e0f){var _0x134669;var _0x50f651;var _0x37cb92;var _0xb7e827=!_[_0x3421('0x6f')](_0x43ab9a[_0x3421('0x56')]['id'])?_0x43ab9a[_0x3421('0x56')]['id']:!_[_0x3421('0x6f')](_0x43ab9a[_0x3421('0x30')]['id'])?_0x43ab9a[_0x3421('0x30')]['id']:null;return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0xb7e827,'role':{'$or':[_0x3421('0x2e'),_0x3421('0x30'),_0x3421('0x32')]}},'attributes':['id',_0x3421('0x37'),_0x3421('0xec'),'mobile',_0x3421('0x2d'),_0x3421('0x6a'),_0x3421('0xa6')]})[_0x3421('0x29')](function(_0x43d25e){if(_0x43d25e){if(_0x43d25e['role']===_0x3421('0x32')){_0x134669=_0x43d25e;if(_0x43ab9a['body'][_0x3421('0xa8')]){_0x37cb92=util[_0x3421('0xb2')](_0x3421('0xed'),_0x134669[_0x43ab9a['body'][_0x3421('0xa8')]]);}else if(_0x43ab9a['body'][_0x3421('0xee')]){_0x37cb92=util[_0x3421('0xb2')](_0x3421('0xb3'),_0x43ab9a[_0x3421('0x65')][_0x3421('0xee')]);}else{_0x37cb92=util[_0x3421('0xb2')]('SIP/%s',_0x134669['name']);}socket['to'](util['format']('user:%s',_0x134669['name']))[_0x3421('0x2a')]('user:forcelogout',{'user':{'id':_0x134669['id'],'name':_0x134669[_0x3421('0x37')]},'ip':_0x43ab9a[_0x3421('0xef')][_0x3421('0xf0')]||_0x43ab9a[_0x3421('0xf1')][_0x3421('0xf2')]||_0x43ab9a['socket'][_0x3421('0xf2')]||_0x43ab9a[_0x3421('0xf1')][_0x3421('0xf3')]['remoteAddress']});return db[_0x3421('0xb5')][_0x3421('0xf4')]({'where':{'membername':_0x134669[_0x3421('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0xf5'));}})[_0x3421('0x29')](function(){if(_0x134669){return _0x134669['getVoiceQueues']({'raw':!![]});}})[_0x3421('0x29')](function(_0x315271){if(_0x134669){if(_0x315271){_0x50f651=_0x315271;if(_0x50f651[_0x3421('0x4f')]){var _0x545aae=_0x50f651[_0x3421('0x8f')](function(_0x58d700){var _0x168fe7={'membername':_0x134669[_0x3421('0x37')],'UserId':_0x134669['id'],'queue_name':_0x58d700[_0x3421('0x37')],'VoiceQueueId':_0x58d700['id'],'interface':_0x37cb92,'paused':_0x134669[_0x3421('0xa6')]||![],'penalty':_0x58d700[_0x3421('0xf6')]||0x0};return db[_0x3421('0xb5')][_0x3421('0xf7')](_0x168fe7);});return Promise[_0x3421('0x63')](_0x545aae);}}}})[_0x3421('0x29')](function(){if(_0x134669){return db[_0x3421('0xf8')][_0x3421('0x4c')]({'where':{'membername':_0x134669['name'],'exitAt':null}});}})[_0x3421('0x29')](function(_0x3bc59d){if(_0x134669){var _0xd624a=[];_0x3bc59d['forEach'](function(_0x346b5d){_0xd624a[_0x3421('0x4b')](_0x346b5d[_0x3421('0x64')]({'exitAt':moment()['format'](_0x3421('0xf9'))}));});return Promise['all'](_0xd624a);}})[_0x3421('0x29')](function(){if(_0x134669){var _0x3a4721=[];var _0x5ec79b=[];var _0x47967b=utils['getChannels']();var _0x8b8437={'membername':_0x134669['name'],'interface':_0x37cb92,'enterAt':moment()[_0x3421('0xb2')](_0x3421('0xf9')),'role':_0x134669[_0x3421('0x2d')],'internal':_0x134669[_0x3421('0x6a')]};_0x47967b[_0x3421('0xfa')](function(_0x3f7f09){_0x3a4721[_0x3421('0x4b')](_['merge']({'channel':_0x3f7f09,'type':'LOGIN','data1':_0x43ab9a[_0x3421('0x65')][_0x3421('0xfb')],'data2':_0x37cb92},_0x8b8437));if(_0x134669['loginInPause']){_0x5ec79b['push'](_[_0x3421('0x5e')]({'channel':_0x3f7f09,'type':_0x3421('0xfc'),'data1':_0x3421('0xfd')},_0x8b8437));}});return db[_0x3421('0xf8')][_0x3421('0xfe')](_0x3a4721[_0x3421('0xff')](_0x5ec79b),{'individualHooks':!![]});}})[_0x3421('0x29')](function(){if(_0x134669){return _0x134669[_0x3421('0x64')]({'online':!![],'lastLoginAt':moment()[_0x3421('0xb2')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x134669[_0x3421('0xa6')]||![],'mailPause':_0x134669[_0x3421('0xa6')]||![],'chatPause':_0x134669[_0x3421('0xa6')]||![],'faxPause':_0x134669[_0x3421('0xa6')]||![],'smsPause':_0x134669[_0x3421('0xa6')]||![],'openchannelPause':_0x134669[_0x3421('0xa6')]||![],'whatsappPause':_0x134669[_0x3421('0xa6')]||![],'pauseType':_0x134669['loginInPause']?'LOGININPAUSE':null,'interface':_0x37cb92,'lastPauseAt':moment()[_0x3421('0xb2')](_0x3421('0xf9'))});}})[_0x3421('0x29')](function(_0x23985c){if(_0x43ab9a['isMiddleware']){return _0x1f2e0f();}else{return Promise[_0x3421('0x100')](_0x23985c)[_0x3421('0x29')](respondWithResult(_0x137553,null));}})['catch'](handleError(_0x137553,null));};exports['logout']=function(_0x58d613,_0x1f2018){var _0x445482;return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x58d613[_0x3421('0x56')]['id'],'role':_0x3421('0x32')},'attributes':['id','name','role']})[_0x3421('0x29')](handleEntityNotFound(_0x1f2018,null))[_0x3421('0x29')](function(_0xb8e37c){if(_0xb8e37c){_0x445482=_0xb8e37c;return db[_0x3421('0xb5')]['destroy']({'where':{'membername':_0x445482[_0x3421('0x37')]},'individualHooks':!![]});}})[_0x3421('0x29')](function(){return db[_0x3421('0xf8')][_0x3421('0x4c')]({'where':{'membername':_0x445482['name'],'exitAt':null}});})[_0x3421('0x29')](function(_0x240db9){var _0x17fc8b=[];_0x240db9[_0x3421('0xfa')](function(_0x5c475c){_0x17fc8b['push'](_0x5c475c['update']({'exitAt':moment()[_0x3421('0xb2')](_0x3421('0xf9'))}));});return Promise[_0x3421('0x63')](_0x17fc8b);})[_0x3421('0x29')](function(){return _0x445482[_0x3421('0x64')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3421('0x29')](respondWithResult(_0x1f2018,null))['catch'](handleError(_0x1f2018,null));};exports[_0x3421('0x101')]=function(_0x3fbaf7,_0x305b37){var _0x2ba0b6;return db[_0x3421('0xb5')][_0x3421('0x64')]({'paused':0x1},{'where':{'UserId':_0x3fbaf7[_0x3421('0x56')]['id']},'individualHooks':!![]})[_0x3421('0x29')](function(){return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x3fbaf7[_0x3421('0x56')]['id'],'role':'agent'},'attributes':['id',_0x3421('0x37'),_0x3421('0x2d'),_0x3421('0x6a'),'interface',_0x3421('0xa5')]});})['then'](handleEntityNotFound(_0x305b37,null))[_0x3421('0x29')](function(_0x6263c9){if(_0x6263c9){_0x2ba0b6=_0x6263c9;return respondWithRpcPromise(_0x3421('0x102'),_0x3421('0x101'),{'id':_0x2ba0b6['id'],'name':_0x2ba0b6[_0x3421('0x37')],'pause':!![]});}})['then'](function(){if(_0x2ba0b6){return db[_0x3421('0xf8')][_0x3421('0x4c')]({'where':{'membername':_0x2ba0b6[_0x3421('0x37')],'type':_0x3421('0xfc'),'exitAt':null}});}})[_0x3421('0x29')](function(_0x41af65){if(_0x41af65['length']){var _0x450b2e=moment()[_0x3421('0xb2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x340d4c=0x0,_0x1cc8b1=_0x41af65[_0x3421('0x4f')];_0x340d4c<_0x1cc8b1;_0x340d4c++){_0x41af65[_0x340d4c][_0x3421('0x103')]({'exitAt':_0x450b2e});}}})[_0x3421('0x29')](function(){var _0x3aa613=[];var _0x58f705=utils[_0x3421('0x104')]();_0x58f705[_0x3421('0xfa')](function(_0x1e809e){_0x3aa613[_0x3421('0x4b')]({'channel':_0x1e809e,'membername':_0x2ba0b6[_0x3421('0x37')],'interface':_['isNil'](_0x2ba0b6[_0x3421('0xa8')])?util['format'](_0x3421('0xb3'),_0x2ba0b6['name']):_0x2ba0b6[_0x3421('0xa8')],'type':_0x3421('0xfc'),'enterAt':moment()['format'](_0x3421('0xf9')),'data1':_0x3fbaf7[_0x3421('0x65')][_0x3421('0x3e')]||_0x3421('0x105'),'role':_0x2ba0b6[_0x3421('0x2d')],'internal':_0x2ba0b6[_0x3421('0x6a')]});});return db[_0x3421('0xf8')][_0x3421('0xfe')](_0x3aa613,{'individualHooks':!![]});})[_0x3421('0x29')](function(){return _0x2ba0b6[_0x3421('0x64')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3fbaf7[_0x3421('0x65')][_0x3421('0x3e')]||_0x3421('0x105'),'lastPauseAt':moment()[_0x3421('0xb2')](_0x3421('0xf9'))});})[_0x3421('0x29')](respondWithResult(_0x305b37,null))[_0x3421('0x1f')](handleError(_0x305b37,null));};exports['unpause']=function(_0x2704db,_0xc506c9){if(_0x2704db[_0x3421('0x65')][_0x3421('0xa4')]&&!utils['isValidChannel'](_0x2704db[_0x3421('0x65')][_0x3421('0xa4')])){throw new APIBadRequestError(util['format'](_0x3421('0x106'),_0x2704db[_0x3421('0x65')][_0x3421('0xa4')]));}return db[_0x3421('0x3b')]['find']({'where':{'id':_0x2704db[_0x3421('0x56')]['id']},'attributes':['id',_0x3421('0x37'),_0x3421('0x2d'),'internal','interface',_0x3421('0xa5'),_0x3421('0xa7'),_0x3421('0x107'),_0x3421('0x108'),_0x3421('0x109'),_0x3421('0x10a'),_0x3421('0x10b'),_0x3421('0x10c'),_0x3421('0x10d'),_0x3421('0x10e')]})[_0x3421('0x29')](function(_0x5d3142){if(!_0x5d3142){throw new APINotFoundError(util[_0x3421('0xb2')](_0x3421('0x10f'),_0x2704db[_0x3421('0x56')]['id']));}return _0x5d3142[_0x3421('0x110')](_0x2704db[_0x3421('0x65')][_0x3421('0xa4')]);})[_0x3421('0x29')](respondWithResult(_0xc506c9,null))[_0x3421('0x1f')](APIHandleError(_0xc506c9));};exports[_0x3421('0x111')]=function(_0x40bb88,_0x3606ad){var _0x3058b0={};var _0x3727cc={};var _0x2180d5;var _0x4341c8;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x40bb88[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x3606ad,null))[_0x3421('0x29')](function(_0x26ebf9){if(_0x26ebf9){_0x2180d5=_0x26ebf9;_0x3727cc['model']=_[_0x3421('0x59')](db[_0x3421('0x112')][_0x3421('0x3c')]);_0x3727cc[_0x3421('0x45')]=_['keys'](_0x40bb88[_0x3421('0x45')]);_0x3727cc[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x3727cc[_0x3421('0x57')],_0x3727cc[_0x3421('0x45')]);_0x3058b0[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x3727cc['model'],qs[_0x3421('0x5c')](_0x40bb88[_0x3421('0x45')][_0x3421('0x5c')]));_0x3058b0['attributes']=_0x3058b0[_0x3421('0x4a')][_0x3421('0x4f')]?_0x3058b0[_0x3421('0x4a')]:_0x3727cc[_0x3421('0x57')];_0x3058b0[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x40bb88[_0x3421('0x45')][_0x3421('0xcb')]);_0x3058b0[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x40bb88['query'],_0x3727cc[_0x3421('0x5a')]));if(_0x40bb88[_0x3421('0x45')][_0x3421('0x40')]){_0x3058b0[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x3058b0[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x3058b0[_0x3421('0x4a')],function(_0x5d3bb8){var _0x1c268d={};_0x1c268d[_0x5d3bb8]={'$like':'%'+_0x40bb88[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x1c268d;})});}_0x3058b0=_[_0x3421('0x5e')]({},_0x3058b0,_0x40bb88[_0x3421('0x5f')]);return _0x2180d5['getTeams'](_0x3058b0);}})['then'](function(_0x40a458){if(_0x40a458){_0x4341c8=_0x40a458[_0x3421('0x4f')];if(!_0x40bb88[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x3058b0['limit']=qs[_0x3421('0x26')](_0x40bb88[_0x3421('0x45')][_0x3421('0x26')]);_0x3058b0['offset']=qs[_0x3421('0x24')](_0x40bb88[_0x3421('0x45')][_0x3421('0x24')]);}return _0x2180d5[_0x3421('0x111')](_0x3058b0);}})[_0x3421('0x29')](function(_0x283ab1){if(_0x283ab1){return _0x283ab1?{'count':_0x4341c8,'rows':_0x283ab1}:null;}})[_0x3421('0x29')](respondWithResult(_0x3606ad,null))[_0x3421('0x1f')](handleError(_0x3606ad,null));};exports['addTeams']=function(_0x28b0d5,_0x20d2ee){var _0x1d2808=_0x28b0d5['params']['id'];var _0x204a00=_0x28b0d5[_0x3421('0x65')]?_0x28b0d5['body']['ids']:null;var _0x181c3c=[];return Promise[_0x3421('0x100')]()[_0x3421('0x29')](function(){if(!_0x204a00)throw new APIBadRequestError(_0x3421('0x113'));})['then'](function(){return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x1d2808}});})['then'](function(_0x2a82eb){if(!_0x2a82eb)throw new APINotFoundError(util[_0x3421('0xb2')](_0x3421('0x10f'),_0x28b0d5[_0x3421('0x56')]['id']));return db['sequelize'][_0x3421('0x114')](function(_0x3c8d93){return _0x2a82eb[_0x3421('0x115')](_0x204a00,{'transaction':_0x3c8d93})[_0x3421('0x29')](function(){return db[_0x3421('0x112')][_0x3421('0x4c')]({'where':{'id':{'$in':_0x204a00}}});})[_0x3421('0x29')](function(_0x36498e){var _0x487a43=_['map'](_0x36498e,function(_0x28db20){return _0x28db20[_0x3421('0x116')]();});return Promise[_0x3421('0x63')](_0x487a43);})[_0x3421('0x29')](function(_0x2dd716){_0x181c3c=_[_0x3421('0x117')](_0x2dd716);var _0x2cd1ce=_['map'](_0x181c3c,function(_0x208248){return _0x208248[_0x3421('0x118')](_0x2a82eb['id'],{'transaction':_0x3c8d93});});return Promise[_0x3421('0x63')](_0x2cd1ce);})[_0x3421('0x29')](function(){if(!_0x2a82eb[_0x3421('0xa5')])return;var _0x40421c=_[_0x3421('0x40')](_0x181c3c,function(_0x5b6b46){return _0x5b6b46[_0x3421('0x119')]('channel')===_0x3421('0x11a');});var _0x3dab51=_[_0x3421('0x8f')](_0x40421c,function(_0x3f7381){return db['UserVoiceQueueRt'][_0x3421('0xf7')]({'membername':_0x2a82eb[_0x3421('0x37')],'UserId':_0x2a82eb['id'],'queue_name':_0x3f7381[_0x3421('0x37')],'VoiceQueueId':_0x3f7381['id'],'interface':_[_0x3421('0x6f')](_0x2a82eb['interface'])?util[_0x3421('0xb2')](_0x3421('0xb3'),_0x2a82eb[_0x3421('0x37')]):_0x2a82eb['interface'],'paused':_0x2a82eb[_0x3421('0xa7')]||![],'penalty':_0x2a82eb[_0x3421('0xb4')]},{'transaction':_0x3c8d93});});return Promise['all'](_0x3dab51);})[_0x3421('0x29')](function(){return db[_0x3421('0x11b')][_0x3421('0x4c')]({'where':{'teamId':{'$in':_0x204a00}}});})[_0x3421('0x29')](function(_0x21694c){var _0x139020=_['map'](_0x21694c,function(_0x476eb0){return db[_0x3421('0x11c')]['create']({'UserId':_0x2a82eb['id'],'VoicePrefixId':_0x476eb0['VoicePrefixId']},{'transaction':_0x3c8d93});});return Promise[_0x3421('0x63')](_0x139020);});});})['then'](function(){for(var _0x122abc=0x0;_0x122abc<_0x181c3c['length'];_0x122abc++){var _0x5ee7f6=_0x181c3c[_0x122abc][_0x3421('0x119')](_0x3421('0xa4'));var _0x4e5e0f=_0x5ee7f6+'QueueId';socket[_0x3421('0x2a')](_0x3421('0x30')+_0x5ee7f6+'Queue:save',{'UserId':_0x1d2808,['queueField']:_0x181c3c[_0x122abc]['id']});}})[_0x3421('0x29')](respondWithStatusCode(_0x20d2ee,null))[_0x3421('0x1f')](APIHandleError(_0x20d2ee));};exports['removeTeams']=function(_0x2c6687,_0x59e30a){var _0x37285c=_0x2c6687['params']['id'];var _0x2c661d=null;if(_0x2c6687[_0x3421('0x45')][_0x3421('0x69')]){_0x2c661d=_[_0x3421('0x11d')](_0x2c6687[_0x3421('0x45')]['ids'])?_0x2c6687[_0x3421('0x45')][_0x3421('0x69')]:[_0x2c6687[_0x3421('0x45')][_0x3421('0x69')]];}var _0x4f64b1=[];return Promise[_0x3421('0x100')]()['then'](function(){if(!_0x2c661d)throw new APIBadRequestError(_0x3421('0x11e'));})[_0x3421('0x29')](function(){return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x37285c}});})[_0x3421('0x29')](function(_0x1f39a7){if(!_0x1f39a7)throw new APINotFoundError(util[_0x3421('0xb2')](_0x3421('0x10f'),_0x2c6687['params']['id']));return db[_0x3421('0x71')][_0x3421('0x114')](function(_0x300548){return _0x1f39a7[_0x3421('0x11f')](_0x2c661d,{'transaction':_0x300548})[_0x3421('0x29')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x2c661d}}});})['then'](function(_0x107ecb){var _0xaa3fc8=_[_0x3421('0x8f')](_0x107ecb,function(_0x4d31ff){return _0x4d31ff['getAssociatedQueues']();});return Promise['all'](_0xaa3fc8);})[_0x3421('0x29')](function(_0x2df606){_0x4f64b1=_[_0x3421('0x117')](_0x2df606);var _0x455271=_['map'](_0x4f64b1,function(_0x5b517c){return _0x5b517c[_0x3421('0x120')](_0x1f39a7['id'],{'transaction':_0x300548});});return Promise[_0x3421('0x63')](_0x455271);})[_0x3421('0x29')](function(){if(!_0x1f39a7['online'])return;var _0x1c43d2=_['filter'](_0x4f64b1,function(_0x3cf737){return _0x3cf737['getDataValue']('channel')===_0x3421('0x11a');});var _0x5d112d=_['map'](_0x1c43d2,function(_0x5253ae){return db['UserVoiceQueueRt'][_0x3421('0xf4')]({'where':{'VoiceQueueId':_0x5253ae['id'],'UserId':_0x1f39a7['id']},'transaction':_0x300548});});return Promise[_0x3421('0x63')](_0x5d112d);})['then'](function(){return db[_0x3421('0x11b')][_0x3421('0x4c')]({'where':{'teamId':{'$in':_0x2c661d}}});})[_0x3421('0x29')](function(_0x187f05){var _0x216168=_[_0x3421('0x8f')](_0x187f05,function(_0x157142){return db[_0x3421('0x11c')][_0x3421('0xf4')]({'where':{'UserId':_0x1f39a7['id'],'VoicePrefixId':_0x157142[_0x3421('0x121')]}},{'transaction':_0x300548});});return Promise[_0x3421('0x63')](_0x216168);});});})[_0x3421('0x29')](function(){for(var _0x138a77=0x0;_0x138a77<_0x4f64b1[_0x3421('0x4f')];_0x138a77++){var _0xaca304=_0x4f64b1[_0x138a77][_0x3421('0x119')](_0x3421('0xa4'));var _0x154cc8=_0xaca304+_0x3421('0xae');socket[_0x3421('0x2a')](_0x3421('0x30')+_0xaca304+_0x3421('0xb7'),{'UserId':_0x37285c,['queueField']:_0x4f64b1[_0x138a77]['id']});}})[_0x3421('0x29')](respondWithStatusCode(_0x59e30a,null))['catch'](APIHandleError(_0x59e30a));};exports[_0x3421('0x122')]=function(_0x2395ee,_0x155902){var _0x54abcd={};var _0x186fe9={};var _0x4baf70;var _0x22d474;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x2395ee[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x155902,null))[_0x3421('0x29')](function(_0x29107d){if(_0x29107d){_0x4baf70=_0x29107d;_0x186fe9[_0x3421('0x57')]=_['keys'](db[_0x3421('0xcf')][_0x3421('0x3c')]);_0x186fe9['query']=_[_0x3421('0x59')](_0x2395ee[_0x3421('0x45')]);_0x186fe9[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x186fe9[_0x3421('0x57')],_0x186fe9[_0x3421('0x45')]);_0x54abcd[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x186fe9[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x2395ee['query'][_0x3421('0x5c')]));_0x54abcd[_0x3421('0x4a')]=_0x54abcd[_0x3421('0x4a')][_0x3421('0x4f')]?_0x54abcd[_0x3421('0x4a')]:_0x186fe9['model'];_0x54abcd[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x2395ee[_0x3421('0x45')][_0x3421('0xcb')]);_0x54abcd[_0x3421('0x43')]=qs[_0x3421('0x5a')](_['pick'](_0x2395ee[_0x3421('0x45')],_0x186fe9[_0x3421('0x5a')]));if(_0x2395ee[_0x3421('0x45')][_0x3421('0x40')]){_0x54abcd['where']=_['merge'](_0x54abcd['where'],{'$or':_[_0x3421('0x8f')](_0x54abcd[_0x3421('0x4a')],function(_0x5f4d14){var _0x212a50={};_0x212a50[_0x5f4d14]={'$like':'%'+_0x2395ee[_0x3421('0x45')]['filter']+'%'};return _0x212a50;})});}_0x54abcd=_[_0x3421('0x5e')]({},_0x54abcd,_0x2395ee[_0x3421('0x5f')]);return _0x4baf70['getLists'](_0x54abcd);}})['then'](function(_0x640b87){if(_0x640b87){_0x22d474=_0x640b87[_0x3421('0x4f')];if(!_0x2395ee[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x54abcd[_0x3421('0x26')]=qs['limit'](_0x2395ee[_0x3421('0x45')][_0x3421('0x26')]);_0x54abcd['offset']=qs['offset'](_0x2395ee['query'][_0x3421('0x24')]);}return _0x4baf70['getLists'](_0x54abcd);}})[_0x3421('0x29')](function(_0x401d7a){if(_0x401d7a){return _0x401d7a?{'count':_0x22d474,'rows':_0x401d7a}:null;}})[_0x3421('0x29')](respondWithResult(_0x155902,null))[_0x3421('0x1f')](handleError(_0x155902,null));};exports[_0x3421('0x123')]=function(_0x31f592,_0x2a2ee9){var _0x1ac4ea={};var _0x3d982f={};var _0x2873b8;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x31f592['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x2a2ee9,null))[_0x3421('0x29')](function(_0x5a910b){if(_0x5a910b){_0x2873b8=_0x5a910b;_0x3d982f['model']=_['keys'](db[_0x3421('0x3b')][_0x3421('0x3c')]);_0x3d982f['query']=_[_0x3421('0x59')](_0x31f592[_0x3421('0x45')]);_0x3d982f[_0x3421('0x5a')]=_['intersection'](_0x3d982f['model'],_0x3d982f[_0x3421('0x45')]);_0x1ac4ea[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x3d982f[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x31f592['query'][_0x3421('0x5c')]));_0x1ac4ea[_0x3421('0x4a')]=_0x1ac4ea[_0x3421('0x4a')][_0x3421('0x4f')]?_0x1ac4ea[_0x3421('0x4a')]:_0x3d982f[_0x3421('0x57')];_0x1ac4ea['order']=qs[_0x3421('0xcb')](_0x31f592[_0x3421('0x45')][_0x3421('0xcb')]);_0x1ac4ea[_0x3421('0x43')]=qs[_0x3421('0x5a')](_['pick'](_0x31f592[_0x3421('0x45')],_0x3d982f[_0x3421('0x5a')]));if(_0x31f592[_0x3421('0x45')][_0x3421('0x40')]){_0x1ac4ea[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x1ac4ea['where'],{'$or':_[_0x3421('0x8f')](_0x1ac4ea[_0x3421('0x4a')],function(_0x45df52){var _0x4eb67a={};_0x4eb67a[_0x45df52]={'$like':'%'+_0x31f592[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x4eb67a;})});}_0x1ac4ea[_0x3421('0x57')]=db[_0x3421('0x3b')];_0x1ac4ea['as']=_0x3421('0x31');_0x1ac4ea=_[_0x3421('0x5e')]({},_0x1ac4ea,_0x31f592['options']);return _0x2873b8[_0x3421('0x124')]({'include':[_0x1ac4ea]});}})['then'](function(_0x14280e){if(_0x14280e){var _0x25b780={},_0x2a36d8=[];for(var _0x566067=0x0;_0x566067<_0x14280e[_0x3421('0x4f')];_0x566067+=0x1){for(var _0x4e5f6e=0x0,_0x80ba5a;_0x4e5f6e<_0x14280e[_0x566067][_0x3421('0x31')][_0x3421('0x4f')];_0x4e5f6e+=0x1){_0x80ba5a=_0x14280e[_0x566067][_0x3421('0x31')][_0x4e5f6e][_0x3421('0x2c')]({'plain':!![]});_0x25b780[_0x80ba5a['id']]=_0x80ba5a;}}_0x25b780=_[_0x3421('0x125')](_0x25b780);for(var _0x3d194f=qs[_0x3421('0x24')](_0x31f592[_0x3421('0x45')][_0x3421('0x24')]);_0x3d194f<_0x25b780['length']&&_0x2a36d8[_0x3421('0x4f')]=_0x5232b1[_0x8300('0x48')]){throw new Error(_0x8300('0x49'));}})['then'](function(){if(_0x292f6e){return db[_0x8300('0x22')]['destroy']({'where':{'membername':_0x292f6e['name']},'individualHooks':!![]});}})[_0x8300('0x19')](function(){if(_0x292f6e){return _0x292f6e['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x26a397){if(_0x292f6e){if(_0x26a397){var _0xfc3cb6=[];_0x3e313d=_0x26a397;if(_0x3e313d[_0x8300('0x26')]){for(var _0x43a631=0x0;_0x43a631<_0x3e313d[_0x8300('0x26')];_0x43a631++){_0xfc3cb6['push'](db[_0x8300('0x22')][_0x8300('0x4a')]({'membername':_0x292f6e[_0x8300('0x1e')],'UserId':_0x292f6e['id'],'queue_name':_0x3e313d[_0x43a631][_0x8300('0x1e')],'VoiceQueueId':_0x3e313d[_0x43a631]['id'],'interface':_0x1c941f,'paused':_0x292f6e[_0x8300('0x4b')]||![],'penalty':_0x3e313d[_0x43a631]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x8300('0x41')](_0xfc3cb6);}}}})[_0x8300('0x19')](function(){if(_0x292f6e){return db[_0x8300('0x24')]['findAll']({'where':{'membername':_0x292f6e[_0x8300('0x1e')],'exitAt':null}});}})[_0x8300('0x19')](function(_0x264da3){if(_0x292f6e){if(_0x264da3&&_0x264da3[_0x8300('0x26')]){var _0x51dd69=[];_0x264da3['forEach'](function(_0x51e94d){_0x51dd69[_0x8300('0x2a')](_0x51e94d[_0x8300('0x23')]({'exitAt':moment()[_0x8300('0x27')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x8300('0x41')](_0x51dd69);}}})[_0x8300('0x19')](function(){if(_0x292f6e){var _0x7b435c=[];var _0x4d46d1=[];var _0x4237a4=utils[_0x8300('0x4c')]();var _0x4bb287={'membername':_0x292f6e['name'],'interface':_0x1c941f,'enterAt':moment()[_0x8300('0x27')](_0x8300('0x28')),'role':_0x292f6e[_0x8300('0x1f')],'internal':_0x292f6e['internal']};_0x4237a4[_0x8300('0x29')](function(_0x25d9ab){_0x7b435c[_0x8300('0x2a')](_[_0x8300('0x4d')]({'channel':_0x25d9ab,'type':_0x8300('0x4e'),'data1':_0x8300('0x4f'),'data2':_0x1c941f},_0x4bb287));if(_0x292f6e[_0x8300('0x4b')]){_0x4d46d1['push'](_[_0x8300('0x4d')]({'channel':_0x25d9ab,'type':'PAUSE','data1':_0x8300('0x50')},_0x4bb287));}});return db[_0x8300('0x24')][_0x8300('0x2f')](_0x7b435c[_0x8300('0x51')](_0x4d46d1),{'individualHooks':!![]});}})[_0x8300('0x19')](function(){if(_0x292f6e){return _0x292f6e[_0x8300('0x23')]({'online':!![],'lastLoginAt':moment()[_0x8300('0x27')](_0x8300('0x28')),'voicePause':_0x292f6e['loginInPause']||![],'mailPause':_0x292f6e['loginInPause']||![],'chatPause':_0x292f6e[_0x8300('0x4b')]||![],'faxPause':_0x292f6e[_0x8300('0x4b')]||![],'smsPause':_0x292f6e[_0x8300('0x4b')]||![],'openchannelPause':_0x292f6e[_0x8300('0x4b')]||![],'pauseType':_0x292f6e['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x8300('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x1c941f});}})[_0x8300('0x19')](function(_0x549a2b){_0x4d1fdc(_0x549a2b);})[_0x8300('0x15')](function(_0x5beaf4){_0x2fe318(_0x526fe3[_0x8300('0x1c')](0x1f4,_0x5beaf4[_0x8300('0x16')]));});});}; \ No newline at end of file +var _0x2252=['getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./user.socket','User','findAll','options','raw','limit','include','map','attributes','model','then','GetUser','debug','stringify','message','error','ShowUser','find','where','info','catch','PauseUser','name','role','internal','interface','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','LogoutUser','all','mobile','loginInPause','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueueRt'];(function(_0x58d227,_0x4ffb12){var _0x3f5093=function(_0x2dfb00){while(--_0x2dfb00){_0x58d227['push'](_0x58d227['shift']());}};_0x3f5093(++_0x4ffb12);}(_0x2252,0x157));var _0x2225=function(_0x577e1b,_0x5eb52d){_0x577e1b=_0x577e1b-0x0;var _0x1ddfa6=_0x2252[_0x577e1b];return _0x1ddfa6;};'use strict';var _=require(_0x2225('0x0'));var util=require(_0x2225('0x1'));var moment=require(_0x2225('0x2'));var BPromise=require(_0x2225('0x3'));var Redis=require(_0x2225('0x4'));var db=require(_0x2225('0x5'))['db'];var utils=require(_0x2225('0x6'));var logger=require(_0x2225('0x7'))(_0x2225('0x8'));var config=require(_0x2225('0x9'));config[_0x2225('0xa')]=_[_0x2225('0xb')](config[_0x2225('0xa')],{'host':_0x2225('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2225('0xa')]));require(_0x2225('0xd'))['register'](socket);exports['GetUser']=function(_0x367fe5){var _0x6f8da0=this;return new Promise(function(_0x309545,_0x4ee4d0){return db[_0x2225('0xe')][_0x2225('0xf')]({'raw':_0x367fe5[_0x2225('0x10')]?_0x367fe5[_0x2225('0x10')][_0x2225('0x11')]===undefined?!![]:![]:!![],'where':_0x367fe5[_0x2225('0x10')]?_0x367fe5[_0x2225('0x10')]['where']||null:null,'attributes':_0x367fe5['options']?_0x367fe5[_0x2225('0x10')]['attributes']||null:null,'limit':_0x367fe5[_0x2225('0x10')]?_0x367fe5[_0x2225('0x10')][_0x2225('0x12')]||null:null,'include':_0x367fe5[_0x2225('0x10')]?_0x367fe5['options'][_0x2225('0x13')]?_[_0x2225('0x14')](_0x367fe5[_0x2225('0x10')][_0x2225('0x13')],function(_0x3dc8ec){return{'model':db[_0x3dc8ec['model']],'as':_0x3dc8ec['as'],'attributes':_0x3dc8ec[_0x2225('0x15')],'include':_0x3dc8ec[_0x2225('0x13')]?_[_0x2225('0x14')](_0x3dc8ec[_0x2225('0x13')],function(_0x3e347e){return{'model':db[_0x3e347e[_0x2225('0x16')]],'as':_0x3e347e['as'],'attributes':_0x3e347e[_0x2225('0x15')],'include':_0x3e347e['include']?_[_0x2225('0x14')](_0x3e347e[_0x2225('0x13')],function(_0x1100d2){return{'model':db[_0x1100d2[_0x2225('0x16')]],'as':_0x1100d2['as'],'attributes':_0x1100d2[_0x2225('0x15')]};}):[]};}):[]};}):[]:[]})[_0x2225('0x17')](function(_0x2818be){logger['info'](_0x2225('0x18'),_0x367fe5);logger[_0x2225('0x19')](_0x2225('0x18'),_0x367fe5,JSON[_0x2225('0x1a')](_0x2818be));_0x309545(_0x2818be);})['catch'](function(_0x3c9f24){logger['error']('GetUser',_0x3c9f24[_0x2225('0x1b')],_0x367fe5);_0x4ee4d0(_0x6f8da0[_0x2225('0x1c')](0x1f4,_0x3c9f24[_0x2225('0x1b')]));});});};exports[_0x2225('0x1d')]=function(_0x2dd463){var _0x158955=this;return new Promise(function(_0x7411bb,_0x2f8eed){return db[_0x2225('0xe')][_0x2225('0x1e')]({'raw':_0x2dd463[_0x2225('0x10')]?_0x2dd463['options'][_0x2225('0x11')]===undefined?!![]:![]:!![],'where':_0x2dd463[_0x2225('0x10')]?_0x2dd463[_0x2225('0x10')][_0x2225('0x1f')]||null:null,'attributes':_0x2dd463[_0x2225('0x10')]?_0x2dd463[_0x2225('0x10')][_0x2225('0x15')]||null:null,'include':_0x2dd463[_0x2225('0x10')]?_0x2dd463[_0x2225('0x10')]['include']?_[_0x2225('0x14')](_0x2dd463[_0x2225('0x10')]['include'],function(_0x752018){return{'model':db[_0x752018['model']],'as':_0x752018['as'],'attributes':_0x752018[_0x2225('0x15')],'include':_0x752018['include']?_[_0x2225('0x14')](_0x752018[_0x2225('0x13')],function(_0x4fce89){return{'model':db[_0x4fce89[_0x2225('0x16')]],'as':_0x4fce89['as'],'attributes':_0x4fce89[_0x2225('0x15')],'include':_0x4fce89[_0x2225('0x13')]?_[_0x2225('0x14')](_0x4fce89[_0x2225('0x13')],function(_0x452c42){return{'model':db[_0x452c42['model']],'as':_0x452c42['as'],'attributes':_0x452c42[_0x2225('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f8fda){logger[_0x2225('0x20')](_0x2225('0x1d'),_0x2dd463);logger[_0x2225('0x19')]('ShowUser',_0x2dd463,JSON[_0x2225('0x1a')](_0x3f8fda));_0x7411bb(_0x3f8fda);})[_0x2225('0x21')](function(_0x455a6b){logger[_0x2225('0x1c')](_0x2225('0x1d'),_0x455a6b[_0x2225('0x1b')],_0x2dd463);_0x2f8eed(_0x158955[_0x2225('0x1c')](0x1f4,_0x455a6b[_0x2225('0x1b')]));});});};exports[_0x2225('0x22')]=function(_0x33c9fc){var _0xd5bf12=this;return new Promise(function(_0x13de96,_0x1ace1f){var _0x3eefd3;return db[_0x2225('0xe')]['find']({'where':_0x33c9fc['options'][_0x2225('0x1f')]||{},'attributes':['id',_0x2225('0x23'),_0x2225('0x24'),_0x2225('0x25'),_0x2225('0x26')]})[_0x2225('0x17')](function(_0x5866d6){if(_0x5866d6){_0x3eefd3=_0x5866d6;return db['UserVoiceQueueRt'][_0x2225('0x27')]({'paused':0x1},{'where':{'UserId':_0x3eefd3['id']},'individualHooks':!![]});}})[_0x2225('0x17')](function(){if(_0x3eefd3){return db[_0x2225('0x28')]['findAll']({'where':{'membername':_0x3eefd3[_0x2225('0x23')],'type':_0x2225('0x29'),'exitAt':null}});}})[_0x2225('0x17')](function(_0x1aa30a){if(_0x3eefd3){if(_0x1aa30a&&_0x1aa30a[_0x2225('0x2a')]){var _0x2de0ab=moment()[_0x2225('0x2b')](_0x2225('0x2c'));for(var _0xd2fa65=0x0,_0x335cc2=_0x1aa30a[_0x2225('0x2a')];_0xd2fa65<_0x335cc2;_0xd2fa65++){_0x1aa30a[_0xd2fa65][_0x2225('0x2d')]({'exitAt':_0x2de0ab});}}}})[_0x2225('0x17')](function(){if(_0x3eefd3){var _0x52aed1=[];var _0x586d46=utils['getChannels']();_0x586d46[_0x2225('0x2e')](function(_0x11fd8a){_0x52aed1[_0x2225('0x2f')]({'channel':_0x11fd8a,'membername':_0x3eefd3[_0x2225('0x23')],'interface':_[_0x2225('0x30')](_0x3eefd3[_0x2225('0x26')])?util['format']('SIP/%s',_0x3eefd3[_0x2225('0x23')]):_0x3eefd3[_0x2225('0x26')],'type':_0x2225('0x29'),'enterAt':moment()['format'](_0x2225('0x2c')),'data1':_0x33c9fc[_0x2225('0x31')][_0x2225('0x32')]||_0x2225('0x33'),'role':_0x3eefd3['role'],'internal':_0x3eefd3[_0x2225('0x25')],'uniqueid':_0x33c9fc[_0x2225('0x31')][_0x2225('0x34')]||null});});return db[_0x2225('0x28')][_0x2225('0x35')](_0x52aed1,{'individualHooks':!![]});}})[_0x2225('0x17')](function(){if(_0x3eefd3){return _0x3eefd3['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x33c9fc[_0x2225('0x31')]['type']||_0x2225('0x33'),'lastPauseAt':moment()[_0x2225('0x2b')](_0x2225('0x2c'))});}})[_0x2225('0x17')](function(_0x399164){_0x13de96(_0x399164);})[_0x2225('0x21')](function(_0x281ead){_0x1ace1f(_0xd5bf12[_0x2225('0x1c')](0x1f4,_0x281ead[_0x2225('0x1b')]));});});};exports['UnpauseUser']=function(_0x40c763){var _0x5967d1=this;return new Promise(function(_0x529668,_0x2a964c){if(_0x40c763[_0x2225('0x31')][_0x2225('0x36')]&&!utils['isValidChannel'](_0x40c763['body']['channel'])){throw new Error(util[_0x2225('0x2b')](_0x2225('0x37'),_0x40c763[_0x2225('0x31')][_0x2225('0x36')]));}return db[_0x2225('0xe')][_0x2225('0x38')]({'where':_0x40c763[_0x2225('0x10')][_0x2225('0x1f')]||{},'attributes':['id','name',_0x2225('0x24'),'internal',_0x2225('0x26'),_0x2225('0x39'),_0x2225('0x3a'),_0x2225('0x3b'),_0x2225('0x3c'),_0x2225('0x3d'),_0x2225('0x3e'),'smsPause',_0x2225('0x3f'),_0x2225('0x40'),_0x2225('0x41')]})[_0x2225('0x17')](function(_0x7b8e7b){if(!_0x7b8e7b){throw new Error(util['format'](_0x2225('0x42'),_0x40c763[_0x2225('0x43')]['id']));}return _0x7b8e7b[_0x2225('0x44')](_0x40c763['body'][_0x2225('0x36')],'system');})[_0x2225('0x17')](function(_0x538d57){_0x529668(_0x538d57);})[_0x2225('0x21')](function(_0x37c372){_0x2a964c(_0x5967d1[_0x2225('0x1c')](0x1f4,_0x37c372[_0x2225('0x1b')]));});});};exports[_0x2225('0x45')]=function(_0x25ddd3){var _0x3a6a32=this;return new Promise(function(_0x59858f,_0xeb9185){var _0x80db60;return db[_0x2225('0xe')][_0x2225('0x38')]({'where':_0x25ddd3[_0x2225('0x10')][_0x2225('0x1f')]||{},'attributes':['id',_0x2225('0x23')]})[_0x2225('0x17')](function(_0x44abb5){if(_0x44abb5){_0x80db60=_0x44abb5;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x80db60[_0x2225('0x23')]},'individualHooks':!![]});}})[_0x2225('0x17')](function(){if(_0x80db60){return db[_0x2225('0x28')][_0x2225('0xf')]({'where':{'membername':_0x80db60['name'],'exitAt':null}});}})[_0x2225('0x17')](function(_0x1701fc){if(_0x80db60){if(_0x1701fc&&_0x1701fc[_0x2225('0x2a')]){var _0x3d97f4=[];_0x1701fc['forEach'](function(_0x14446a){_0x3d97f4[_0x2225('0x2f')](_0x14446a[_0x2225('0x27')]({'exitAt':moment()[_0x2225('0x2b')](_0x2225('0x2c'))}));});return BPromise[_0x2225('0x46')](_0x3d97f4);}}})[_0x2225('0x17')](function(){if(_0x80db60){return _0x80db60['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2225('0x17')](function(_0xd2a6f5){_0x59858f(_0xd2a6f5);})['catch'](function(_0x4f41cb){_0xeb9185(_0x3a6a32['error'](0x1f4,_0x4f41cb['message']));});});};exports['LoginUser']=function(_0x3865c2){var _0x30150e=this;return new Promise(function(_0x100ff3,_0x42bdd5){var _0x36408a;var _0x1b0b54;var _0x26d75f;var _0x3af9e2;return db[_0x2225('0xe')]['findOne']({'where':_0x3865c2[_0x2225('0x10')][_0x2225('0x1f')]||{},'attributes':['id',_0x2225('0x23'),_0x2225('0x24'),_0x2225('0x47'),'phone','internal',_0x2225('0x48'),_0x2225('0x26')]})['then'](function(_0x19ba2f){if(_0x19ba2f){_0x36408a=_0x19ba2f;_0x3af9e2=_0x3865c2[_0x2225('0x31')][_0x2225('0x26')]?_0x3865c2['body'][_0x2225('0x26')]:util[_0x2225('0x2b')]('SIP/%s',_0x36408a[_0x2225('0x23')]);return db[_0x2225('0xe')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x36408a['id']}}});}})[_0x2225('0x17')](function(_0x439cc0){if(_0x439cc0){_0x26d75f=_0x439cc0;return require(_0x2225('0x49'))['getLicense']();}})[_0x2225('0x17')](function(_0x4de74b){if(_0x4de74b&&_0x4de74b[_0x2225('0x4a')]&&_0x26d75f>=_0x4de74b[_0x2225('0x4a')]){throw new Error(_0x2225('0x4b'));}})[_0x2225('0x17')](function(){if(_0x36408a){return db[_0x2225('0x4c')]['destroy']({'where':{'membername':_0x36408a[_0x2225('0x23')]},'individualHooks':!![]});}})[_0x2225('0x17')](function(){if(_0x36408a){return _0x36408a[_0x2225('0x4d')]({'raw':!![]});}})[_0x2225('0x17')](function(_0x473f6b){if(_0x36408a){if(_0x473f6b){var _0x142fc1=[];_0x1b0b54=_0x473f6b;if(_0x1b0b54[_0x2225('0x2a')]){for(var _0x3acafd=0x0;_0x3acafd<_0x1b0b54[_0x2225('0x2a')];_0x3acafd++){_0x142fc1[_0x2225('0x2f')](db[_0x2225('0x4c')][_0x2225('0x4e')]({'membername':_0x36408a[_0x2225('0x23')],'UserId':_0x36408a['id'],'queue_name':_0x1b0b54[_0x3acafd]['name'],'VoiceQueueId':_0x1b0b54[_0x3acafd]['id'],'interface':_0x3af9e2,'paused':_0x36408a[_0x2225('0x48')]||![],'penalty':_0x1b0b54[_0x3acafd][_0x2225('0x4f')]||0x0}));}return BPromise[_0x2225('0x46')](_0x142fc1);}}}})[_0x2225('0x17')](function(){if(_0x36408a){return db[_0x2225('0x28')][_0x2225('0xf')]({'where':{'membername':_0x36408a[_0x2225('0x23')],'exitAt':null}});}})[_0x2225('0x17')](function(_0x24ae80){if(_0x36408a){if(_0x24ae80&&_0x24ae80[_0x2225('0x2a')]){var _0xf45869=[];_0x24ae80['forEach'](function(_0x2f5bc7){_0xf45869[_0x2225('0x2f')](_0x2f5bc7['update']({'exitAt':moment()[_0x2225('0x2b')](_0x2225('0x2c'))}));});return BPromise[_0x2225('0x46')](_0xf45869);}}})[_0x2225('0x17')](function(){if(_0x36408a){var _0x1c25fe=[];var _0x416ec7=[];var _0x5bda34=utils['getChannels']();var _0x42aff7={'membername':_0x36408a['name'],'interface':_0x3af9e2,'enterAt':moment()[_0x2225('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x36408a[_0x2225('0x24')],'internal':_0x36408a[_0x2225('0x25')]};_0x5bda34[_0x2225('0x2e')](function(_0x48bef0){_0x1c25fe[_0x2225('0x2f')](_[_0x2225('0x50')]({'channel':_0x48bef0,'type':'LOGIN','data1':_0x2225('0x51'),'data2':_0x3af9e2},_0x42aff7));if(_0x36408a[_0x2225('0x48')]){_0x416ec7['push'](_[_0x2225('0x50')]({'channel':_0x48bef0,'type':_0x2225('0x29'),'data1':'LOGININPAUSE'},_0x42aff7));}});return db[_0x2225('0x28')][_0x2225('0x35')](_0x1c25fe[_0x2225('0x52')](_0x416ec7),{'individualHooks':!![]});}})[_0x2225('0x17')](function(){if(_0x36408a){return _0x36408a['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x36408a['loginInPause']||![],'mailPause':_0x36408a[_0x2225('0x48')]||![],'chatPause':_0x36408a[_0x2225('0x48')]||![],'faxPause':_0x36408a['loginInPause']||![],'smsPause':_0x36408a[_0x2225('0x48')]||![],'openchannelPause':_0x36408a[_0x2225('0x48')]||![],'pauseType':_0x36408a[_0x2225('0x48')]?_0x2225('0x53'):null,'lastPauseAt':moment()[_0x2225('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3af9e2});}})[_0x2225('0x17')](function(_0x3df2a3){_0x100ff3(_0x3df2a3);})[_0x2225('0x21')](function(_0xad8f55){_0x42bdd5(_0x30150e['error'](0x1f4,_0xad8f55[_0x2225('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e496bca..b7ea79f 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 _0x668a=['length','./user.events','update','emit','removeListener'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x668a,0x132));var _0xa668=function(_0x3e74a4,_0x5a9801){_0x3e74a4=_0x3e74a4-0x0;var _0x561749=_0x668a[_0x3e74a4];return _0x561749;};'use strict';var UserEvents=require(_0xa668('0x0'));var events=['save','remove',_0xa668('0x1')];function createListener(_0xf1aec6,_0x14af75){return function(_0x185394){_0x14af75[_0xa668('0x2')](_0xf1aec6,_0x185394);};}function removeListener(_0x4a96c1,_0x5b93f4){return function(){UserEvents[_0xa668('0x3')](_0x4a96c1,_0x5b93f4);};}exports['register']=function(_0x130fb9){for(var _0x41c1f1=0x0,_0x33f29d=events[_0xa668('0x4')];_0x41c1f1<_0x33f29d;_0x41c1f1++){var _0x3591df=events[_0x41c1f1];var _0x3b6dd1=createListener('user:'+_0x3591df,_0x130fb9);UserEvents['on'](_0x3591df,_0x3b6dd1);}}; \ No newline at end of file +var _0x0dae=['save','remove','update','removeListener','register','length','user:'];(function(_0x15fa50,_0x32c57f){var _0x9e62da=function(_0x139cee){while(--_0x139cee){_0x15fa50['push'](_0x15fa50['shift']());}};_0x9e62da(++_0x32c57f);}(_0x0dae,0x165));var _0xe0da=function(_0xcad9e7,_0x255d6f){_0xcad9e7=_0xcad9e7-0x0;var _0x170a86=_0x0dae[_0xcad9e7];return _0x170a86;};'use strict';var UserEvents=require('./user.events');var events=[_0xe0da('0x0'),_0xe0da('0x1'),_0xe0da('0x2')];function createListener(_0x37173b,_0x2ddffe){return function(_0x5e3582){_0x2ddffe['emit'](_0x37173b,_0x5e3582);};}function removeListener(_0x5294ab,_0x3bad40){return function(){UserEvents[_0xe0da('0x3')](_0x5294ab,_0x3bad40);};}exports[_0xe0da('0x4')]=function(_0x3e1aae){for(var _0x52a54d=0x0,_0x2aa143=events[_0xe0da('0x5')];_0x52a54d<_0x2aa143;_0x52a54d++){var _0x589dc9=events[_0x52a54d];var _0x38f45a=createListener(_0xe0da('0x6')+_0x589dc9,_0x3e1aae);UserEvents['on'](_0x589dc9,_0x38f45a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f65d389..471e196 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5f0a4d,_0x4dfc04){var _0x382972=function(_0x24913c){while(--_0x24913c){_0x5f0a4d['push'](_0x5f0a4d['shift']());}};_0x382972(++_0x4dfc04);}(_0x70e0,0x17b));var _0x070e=function(_0xbdd6bc,_0xd4d56f){_0xbdd6bc=_0xbdd6bc-0x0;var _0x1e98ab=_0x70e0[_0xbdd6bc];return _0x1e98ab;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2ce591,_0x2075ec){var _0x18121b=function(_0x1288bc){while(--_0x1288bc){_0x2ce591['push'](_0x2ce591['shift']());}};_0x18121b(++_0x2075ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d707b68..ea4de98 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 _0x8a26=['sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8a26,0x1a8));var _0x68a2=function(_0x5f7495,_0x3beb03){_0x5f7495=_0x5f7495-0x0;var _0x65a897=_0x8a26[_0x5f7495];return _0x65a897;};'use strict';var Sequelize=require(_0x68a2('0x0'));module[_0x68a2('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4f03=['INTEGER','sequelize'];(function(_0xa9cbd6,_0x4acd4c){var _0x1c9d61=function(_0x2b2879){while(--_0x2b2879){_0xa9cbd6['push'](_0xa9cbd6['shift']());}};_0x1c9d61(++_0x4acd4c);}(_0x4f03,0x17b));var _0x34f0=function(_0x4776cc,_0x3a715e){_0x4776cc=_0x4776cc-0x0;var _0x427bda=_0x4f03[_0x4776cc];return _0x427bda;};'use strict';var Sequelize=require(_0x34f0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x34f0('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 22c72f7..50822a6 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 _0x7aa1=['lodash','util','api','moment','bluebird','../../config/environment','./userChatQueue.attributes','exports','user_has_chat_queues'];(function(_0x55fa5c,_0x30bd41){var _0xea802f=function(_0x4bc014){while(--_0x4bc014){_0x55fa5c['push'](_0x55fa5c['shift']());}};_0xea802f(++_0x30bd41);}(_0x7aa1,0xc6));var _0x17aa=function(_0x3f51e3,_0x48a100){_0x3f51e3=_0x3f51e3-0x0;var _0x4f2a88=_0x7aa1[_0x3f51e3];return _0x4f2a88;};'use strict';var _=require(_0x17aa('0x0'));var util=require(_0x17aa('0x1'));var logger=require('../../config/logger')(_0x17aa('0x2'));var moment=require(_0x17aa('0x3'));var BPromise=require(_0x17aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x17aa('0x5'));var attributes=require(_0x17aa('0x6'));module[_0x17aa('0x7')]=function(_0x8d446e,_0x3717ac){return _0x8d446e['define']('UserChatQueue',attributes,{'tableName':_0x17aa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x319a=['define','UserChatQueue','user_has_chat_queues','lodash','util','moment','bluebird','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x29b9a8,_0x1b05d5){var _0xea829d=function(_0x42f4f8){while(--_0x42f4f8){_0x29b9a8['push'](_0x29b9a8['shift']());}};_0xea829d(++_0x1b05d5);}(_0x319a,0x7b));var _0xa319=function(_0x1d8a49,_0x1291b9){_0x1d8a49=_0x1d8a49-0x0;var _0xd313c1=_0x319a[_0x1d8a49];return _0xd313c1;};'use strict';var _=require(_0xa319('0x0'));var util=require(_0xa319('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa319('0x2'));var BPromise=require(_0xa319('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa319('0x4'));var attributes=require(_0xa319('0x5'));module[_0xa319('0x6')]=function(_0x2d111e,_0x496857){return _0x2d111e[_0xa319('0x7')](_0xa319('0x8'),attributes,{'tableName':_0xa319('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 9684244..06b04cf 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 _0xa49b=['info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa49b,0x78));var _0xba49=function(_0x122194,_0x4e596f){_0x122194=_0x122194-0x0;var _0x30ba40=_0xa49b[_0x122194];return _0x30ba40;};'use strict';var _=require(_0xba49('0x0'));var util=require('util');var moment=require(_0xba49('0x1'));var BPromise=require(_0xba49('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba49('0x3'));var db=require(_0xba49('0x4'))['db'];var utils=require(_0xba49('0x5'));var logger=require(_0xba49('0x6'))(_0xba49('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xba49('0x8')][_0xba49('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56c03d,_0x2dd789,_0x31a74f){return new BPromise(function(_0x191c88,_0x3bca65){return client[_0xba49('0xa')](_0x56c03d,_0x31a74f)[_0xba49('0xb')](function(_0x4ac0a2){logger[_0xba49('0xc')](_0xba49('0xd'),_0x2dd789,_0xba49('0xe'));logger[_0xba49('0xf')](_0xba49('0x10'),_0x2dd789,'request\x20sent',JSON[_0xba49('0x11')](_0x4ac0a2));if(_0x4ac0a2['error']){if(_0x4ac0a2['error'][_0xba49('0x12')]===0x1f4){logger[_0xba49('0x13')](_0xba49('0xd'),_0x2dd789,_0x4ac0a2[_0xba49('0x13')]['message']);return _0x3bca65(_0x4ac0a2[_0xba49('0x13')][_0xba49('0x14')]);}logger[_0xba49('0x13')](_0xba49('0xd'),_0x2dd789,_0x4ac0a2[_0xba49('0x13')][_0xba49('0x14')]);return _0x191c88(_0x4ac0a2['error']['message']);}else{logger['info'](_0xba49('0xd'),_0x2dd789,_0xba49('0xe'));_0x191c88(_0x4ac0a2['result'][_0xba49('0x14')]);}})[_0xba49('0x15')](function(_0x30389d){logger[_0xba49('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x2dd789,_0x30389d);_0x3bca65(_0x30389d);});});} \ No newline at end of file +var _0xe775=['stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x58ce75,_0x107ebe){var _0x3d1211=function(_0x2945d3){while(--_0x2945d3){_0x58ce75['push'](_0x58ce75['shift']());}};_0x3d1211(++_0x107ebe);}(_0xe775,0x10d));var _0x5e77=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xe775[_0x54c9dd];return _0x855156;};'use strict';var _=require(_0x5e77('0x0'));var util=require(_0x5e77('0x1'));var moment=require(_0x5e77('0x2'));var BPromise=require(_0x5e77('0x3'));var rs=require(_0x5e77('0x4'));var fs=require('fs');var Redis=require(_0x5e77('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5e77('0x6'))(_0x5e77('0x7'));var config=require(_0x5e77('0x8'));var jayson=require(_0x5e77('0x9'));var client=jayson['client'][_0x5e77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x532d34,_0x262529,_0x2f6118){return new BPromise(function(_0x1acb0a,_0x57476c){return client[_0x5e77('0xb')](_0x532d34,_0x2f6118)[_0x5e77('0xc')](function(_0x5d4b85){logger['info'](_0x5e77('0xd'),_0x262529,_0x5e77('0xe'));logger[_0x5e77('0xf')](_0x5e77('0x10'),_0x262529,_0x5e77('0xe'),JSON[_0x5e77('0x11')](_0x5d4b85));if(_0x5d4b85[_0x5e77('0x12')]){if(_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x13')]===0x1f4){logger[_0x5e77('0x12')](_0x5e77('0xd'),_0x262529,_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x14')]);return _0x57476c(_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x14')]);}logger[_0x5e77('0x12')](_0x5e77('0xd'),_0x262529,_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x14')]);return _0x1acb0a(_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x14')]);}else{logger[_0x5e77('0x15')](_0x5e77('0xd'),_0x262529,_0x5e77('0xe'));_0x1acb0a(_0x5d4b85['result']['message']);}})['catch'](function(_0x322220){logger['error'](_0x5e77('0xd'),_0x262529,_0x322220);_0x57476c(_0x322220);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d6a3ed5..d70994a 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3cb7e8,_0xb8f77){var _0x72798f=function(_0x114662){while(--_0x114662){_0x3cb7e8['push'](_0x3cb7e8['shift']());}};_0x72798f(++_0xb8f77);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x55adee,_0x4d9108){var _0x5f0455=function(_0x216c59){while(--_0x216c59){_0x55adee['push'](_0x55adee['shift']());}};_0x5f0455(++_0x4d9108);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 940a53b..95d4c6c 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 _0x6d9d=['sequelize','exports','INTEGER'];(function(_0x5353a5,_0x550668){var _0x1a856b=function(_0x140fb2){while(--_0x140fb2){_0x5353a5['push'](_0x5353a5['shift']());}};_0x1a856b(++_0x550668);}(_0x6d9d,0x1d1));var _0xd6d9=function(_0x3bbe32,_0x3b10ca){_0x3bbe32=_0x3bbe32-0x0;var _0x4a5efe=_0x6d9d[_0x3bbe32];return _0x4a5efe;};'use strict';var Sequelize=require(_0xd6d9('0x0'));module[_0xd6d9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd6d9('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x95ae=['INTEGER','STRING','sequelize','exports'];(function(_0x350b76,_0x3e804b){var _0x3a9adb=function(_0x1f16b5){while(--_0x1f16b5){_0x350b76['push'](_0x350b76['shift']());}};_0x3a9adb(++_0x3e804b);}(_0x95ae,0x152));var _0xe95a=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x95ae[_0x1a72f3];return _0x57ef47;};'use strict';var Sequelize=require(_0xe95a('0x0'));module[_0xe95a('0x1')]={'penalty':{'type':Sequelize[_0xe95a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe95a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe95a('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index c3abe84..e84d463 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 _0x664d=['./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','util','api','moment','request-promise','../../config/environment'];(function(_0x448649,_0x63bb21){var _0x2e91c6=function(_0x5babca){while(--_0x5babca){_0x448649['push'](_0x448649['shift']());}};_0x2e91c6(++_0x63bb21);}(_0x664d,0x1c6));var _0xd664=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x664d[_0xbc346f];return _0x9f9260;};'use strict';var _=require('lodash');var util=require(_0xd664('0x0'));var logger=require('../../config/logger')(_0xd664('0x1'));var moment=require(_0xd664('0x2'));var BPromise=require('bluebird');var rp=require(_0xd664('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd664('0x4'));var attributes=require(_0xd664('0x5'));module[_0xd664('0x6')]=function(_0x33bfee,_0x4e35f6){return _0x33bfee['define'](_0xd664('0x7'),attributes,{'tableName':_0xd664('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff67=['rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xff67,0x1e7));var _0x7ff6=function(_0x6ce73,_0x4b9160){_0x6ce73=_0x6ce73-0x0;var _0x23a31b=_0xff67[_0x6ce73];return _0x23a31b;};'use strict';var _=require(_0x7ff6('0x0'));var util=require(_0x7ff6('0x1'));var logger=require(_0x7ff6('0x2'))(_0x7ff6('0x3'));var moment=require(_0x7ff6('0x4'));var BPromise=require(_0x7ff6('0x5'));var rp=require(_0x7ff6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ff6('0x7'));var config=require(_0x7ff6('0x8'));var attributes=require(_0x7ff6('0x9'));module['exports']=function(_0x182106,_0x2a3a5a){return _0x182106[_0x7ff6('0xa')](_0x7ff6('0xb'),attributes,{'tableName':_0x7ff6('0xc'),'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 ade532e..3641477 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 _0xe952=['jayson/promise','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f85b9,_0x3c5346){var _0x11b468=function(_0x1804ea){while(--_0x1804ea){_0x2f85b9['push'](_0x2f85b9['shift']());}};_0x11b468(++_0x3c5346);}(_0xe952,0x175));var _0x2e95=function(_0xb1dd47,_0x179ed0){_0xb1dd47=_0xb1dd47-0x0;var _0x279006=_0xe952[_0xb1dd47];return _0x279006;};'use strict';var _=require(_0x2e95('0x0'));var util=require(_0x2e95('0x1'));var moment=require(_0x2e95('0x2'));var BPromise=require(_0x2e95('0x3'));var rs=require(_0x2e95('0x4'));var fs=require('fs');var Redis=require(_0x2e95('0x5'));var db=require(_0x2e95('0x6'))['db'];var utils=require(_0x2e95('0x7'));var logger=require(_0x2e95('0x8'))(_0x2e95('0x9'));var config=require(_0x2e95('0xa'));var jayson=require(_0x2e95('0xb'));var client=jayson['client'][_0x2e95('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x480cfa,_0x2851fe,_0x4d40a1){return new BPromise(function(_0x42b8f4,_0x2ac6f8){return client[_0x2e95('0xd')](_0x480cfa,_0x4d40a1)[_0x2e95('0xe')](function(_0x99f3a6){logger['info'](_0x2e95('0xf'),_0x2851fe,_0x2e95('0x10'));logger[_0x2e95('0x11')](_0x2e95('0x12'),_0x2851fe,_0x2e95('0x10'),JSON[_0x2e95('0x13')](_0x99f3a6));if(_0x99f3a6[_0x2e95('0x14')]){if(_0x99f3a6[_0x2e95('0x14')]['code']===0x1f4){logger[_0x2e95('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x2851fe,_0x99f3a6[_0x2e95('0x14')][_0x2e95('0x15')]);return _0x2ac6f8(_0x99f3a6[_0x2e95('0x14')]['message']);}logger[_0x2e95('0x14')](_0x2e95('0xf'),_0x2851fe,_0x99f3a6['error'][_0x2e95('0x15')]);return _0x42b8f4(_0x99f3a6[_0x2e95('0x14')][_0x2e95('0x15')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x2851fe,'request\x20sent');_0x42b8f4(_0x99f3a6[_0x2e95('0x16')][_0x2e95('0x15')]);}})[_0x2e95('0x17')](function(_0x145776){logger[_0x2e95('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x2851fe,_0x145776);_0x2ac6f8(_0x145776);});});} \ No newline at end of file +var _0xd374=['jayson/promise','client','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x196b6e,_0x3c94b2){var _0x4e3630=function(_0x33ec3c){while(--_0x33ec3c){_0x196b6e['push'](_0x196b6e['shift']());}};_0x4e3630(++_0x3c94b2);}(_0xd374,0x14d));var _0x4d37=function(_0xca7135,_0xa058f5){_0xca7135=_0xca7135-0x0;var _0x2747dd=_0xd374[_0xca7135];return _0x2747dd;};'use strict';var _=require('lodash');var util=require(_0x4d37('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d37('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d37('0x2'))['db'];var utils=require(_0x4d37('0x3'));var logger=require(_0x4d37('0x4'))(_0x4d37('0x5'));var config=require(_0x4d37('0x6'));var jayson=require(_0x4d37('0x7'));var client=jayson[_0x4d37('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3874a8,_0x1d3b7d,_0x22bd66){return new BPromise(function(_0x2dff04,_0x62d21d){return client['request'](_0x3874a8,_0x22bd66)[_0x4d37('0x9')](function(_0x3d537f){logger[_0x4d37('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x1d3b7d,_0x4d37('0xb'));logger[_0x4d37('0xc')](_0x4d37('0xd'),_0x1d3b7d,_0x4d37('0xb'),JSON[_0x4d37('0xe')](_0x3d537f));if(_0x3d537f[_0x4d37('0xf')]){if(_0x3d537f[_0x4d37('0xf')][_0x4d37('0x10')]===0x1f4){logger[_0x4d37('0xf')](_0x4d37('0x11'),_0x1d3b7d,_0x3d537f[_0x4d37('0xf')][_0x4d37('0x12')]);return _0x62d21d(_0x3d537f[_0x4d37('0xf')][_0x4d37('0x12')]);}logger[_0x4d37('0xf')](_0x4d37('0x11'),_0x1d3b7d,_0x3d537f[_0x4d37('0xf')][_0x4d37('0x12')]);return _0x2dff04(_0x3d537f[_0x4d37('0xf')][_0x4d37('0x12')]);}else{logger[_0x4d37('0xa')](_0x4d37('0x11'),_0x1d3b7d,'request\x20sent');_0x2dff04(_0x3d537f[_0x4d37('0x13')][_0x4d37('0x12')]);}})['catch'](function(_0x468d01){logger[_0x4d37('0xf')](_0x4d37('0x11'),_0x1d3b7d,_0x468d01);_0x62d21d(_0x468d01);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 10669fa..762a5f2 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d652a,_0x1613be){var _0x16c18b=function(_0x13fb15){while(--_0x13fb15){_0x1d652a['push'](_0x1d652a['shift']());}};_0x16c18b(++_0x1613be);}(_0xe706,0xa3));var _0x6e70=function(_0x352713,_0x737610){_0x352713=_0x352713-0x0;var _0x46a4ea=_0xe706[_0x352713];return _0x46a4ea;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ca8c7a0..68683b4 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 _0xf2c0=['sequelize','exports','INTEGER'];(function(_0x245c9f,_0x1d9e8c){var _0x276b79=function(_0x2bdbd7){while(--_0x2bdbd7){_0x245c9f['push'](_0x245c9f['shift']());}};_0x276b79(++_0x1d9e8c);}(_0xf2c0,0xc0));var _0x0f2c=function(_0x52abc2,_0x1dc8de){_0x52abc2=_0x52abc2-0x0;var _0x497e6c=_0xf2c0[_0x52abc2];return _0x497e6c;};'use strict';var Sequelize=require(_0x0f2c('0x0'));module[_0x0f2c('0x1')]={'penalty':{'type':Sequelize[_0x0f2c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x31dc=['sequelize','exports','INTEGER'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x31dc,0xc3));var _0xc31d=function(_0x13bfc5,_0x35b5b0){_0x13bfc5=_0x13bfc5-0x0;var _0x24d68d=_0x31dc[_0x13bfc5];return _0x24d68d;};'use strict';var Sequelize=require(_0xc31d('0x0'));module[_0xc31d('0x1')]={'penalty':{'type':Sequelize[_0xc31d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 40b4a8a..534979a 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 _0x7974=['../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x599c44,_0x2fb16e){var _0x1d6cf6=function(_0x43f375){while(--_0x43f375){_0x599c44['push'](_0x599c44['shift']());}};_0x1d6cf6(++_0x2fb16e);}(_0x7974,0x10f));var _0x4797=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x7974[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x4797('0x0'));var util=require(_0x4797('0x1'));var logger=require(_0x4797('0x2'))(_0x4797('0x3'));var moment=require(_0x4797('0x4'));var BPromise=require(_0x4797('0x5'));var rp=require(_0x4797('0x6'));var fs=require('fs');var path=require(_0x4797('0x7'));var rimraf=require(_0x4797('0x8'));var config=require(_0x4797('0x9'));var attributes=require('./userMailQueue.attributes');module[_0x4797('0xa')]=function(_0x48260b,_0x3747d5){return _0x48260b[_0x4797('0xb')](_0x4797('0xc'),attributes,{'tableName':_0x4797('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4f9=['../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xe5cf60,_0x35ee32){var _0x3c1f42=function(_0x577c00){while(--_0x577c00){_0xe5cf60['push'](_0xe5cf60['shift']());}};_0x3c1f42(++_0x35ee32);}(_0xe4f9,0xe2));var _0x9e4f=function(_0x55b22f,_0x5b22d4){_0x55b22f=_0x55b22f-0x0;var _0x6eb279=_0xe4f9[_0x55b22f];return _0x6eb279;};'use strict';var _=require(_0x9e4f('0x0'));var util=require(_0x9e4f('0x1'));var logger=require(_0x9e4f('0x2'))(_0x9e4f('0x3'));var moment=require(_0x9e4f('0x4'));var BPromise=require(_0x9e4f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e4f('0x6'));var rimraf=require(_0x9e4f('0x7'));var config=require(_0x9e4f('0x8'));var attributes=require(_0x9e4f('0x9'));module[_0x9e4f('0xa')]=function(_0x32f6e0,_0x42f0b3){return _0x32f6e0[_0x9e4f('0xb')]('UserMailQueue',attributes,{'tableName':_0x9e4f('0xc'),'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 1f2eca2..c4334c6 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3f62b6,_0x38b161){var _0x2f43ef=function(_0x3347fe){while(--_0x3347fe){_0x3f62b6['push'](_0x3f62b6['shift']());}};_0x2f43ef(++_0x38b161);}(_0x34e8,0x12c));var _0x834e=function(_0x2d2507,_0x3a474e){_0x2d2507=_0x2d2507-0x0;var _0x2c37da=_0x34e8[_0x2d2507];return _0x2c37da;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7217,0x19e));var _0x7721=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7217[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 82eb036..fb3fd87 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 _0xfbcb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','sendUserNotification','multer','path','connect-timeout','express','Router'];(function(_0x3aa065,_0x47d67b){var _0x146d37=function(_0x16c9a4){while(--_0x16c9a4){_0x3aa065['push'](_0x3aa065['shift']());}};_0x146d37(++_0x47d67b);}(_0xfbcb,0xa0));var _0xbfbc=function(_0x504172,_0x4b0a3e){_0x504172=_0x504172-0x0;var _0x1968b5=_0xfbcb[_0x504172];return _0x1968b5;};'use strict';var multer=require(_0xbfbc('0x0'));var util=require('util');var path=require(_0xbfbc('0x1'));var timeout=require(_0xbfbc('0x2'));var express=require(_0xbfbc('0x3'));var router=express[_0xbfbc('0x4')]();var fs_extra=require(_0xbfbc('0x5'));var auth=require(_0xbfbc('0x6'));var interaction=require(_0xbfbc('0x7'));var config=require(_0xbfbc('0x8'));var controller=require(_0xbfbc('0x9'));router['post']('/',auth['isAuthenticated'](),controller[_0xbfbc('0xa')]);module['exports']=router; \ No newline at end of file +var _0xf8c3=['util','path','Router','fs-extra','../../components/auth/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf8c3,0xa9));var _0x3f8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f8c('0x0'));var util=require(_0x3f8c('0x1'));var path=require(_0x3f8c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f8c('0x3')]();var fs_extra=require(_0x3f8c('0x4'));var auth=require(_0x3f8c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3f8c('0x6'));router['post']('/',auth[_0x3f8c('0x7')](),controller[_0x3f8c('0x8')]);module[_0x3f8c('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0dfbbf0..d3b517d 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 _0xd34f=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xd34f,0xd9));var _0xfd34=function(_0x3784bd,_0x49b5c7){_0x3784bd=_0x3784bd-0x0;var _0x53457e=_0xd34f[_0x3784bd];return _0x53457e;};'use strict';var Sequelize=require(_0xfd34('0x0'));module[_0xfd34('0x1')]={'body':{'type':Sequelize[_0xfd34('0x2')]},'senderName':{'type':Sequelize[_0xfd34('0x3')]},'recipientsId':{'type':Sequelize[_0xfd34('0x2')]},'recipientsDescription':{'type':Sequelize[_0xfd34('0x3')]},'beep':{'type':Sequelize[_0xfd34('0x4')]}}; \ No newline at end of file +var _0x0e03=['STRING','sequelize','TEXT'];(function(_0x15ec35,_0x5b9972){var _0x937cce=function(_0x59326b){while(--_0x59326b){_0x15ec35['push'](_0x15ec35['shift']());}};_0x937cce(++_0x5b9972);}(_0x0e03,0x1bd));var _0x30e0=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x0e03[_0x616290];return _0x453879;};'use strict';var Sequelize=require(_0x30e0('0x0'));module['exports']={'body':{'type':Sequelize[_0x30e0('0x1')]},'senderName':{'type':Sequelize[_0x30e0('0x2')]},'recipientsId':{'type':Sequelize[_0x30e0('0x1')]},'recipientsDescription':{'type':Sequelize[_0x30e0('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 27b50d7..27d585c 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 _0x5ea4=['request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','register','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','name','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','mailqueue','openchannelqueue','smsqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1f75f6,_0x3654e1){var _0x5c06c1=function(_0x21b3ba){while(--_0x21b3ba){_0x1f75f6['push'](_0x1f75f6['shift']());}};_0x5c06c1(++_0x3654e1);}(_0x5ea4,0x178));var _0x45ea=function(_0x1bcc8d,_0x39f043){_0x1bcc8d=_0x1bcc8d-0x0;var _0x471167=_0x5ea4[_0x1bcc8d];return _0x471167;};'use strict';var emlformat=require(_0x45ea('0x0'));var rimraf=require(_0x45ea('0x1'));var zipdir=require(_0x45ea('0x2'));var jsonpatch=require(_0x45ea('0x3'));var rp=require(_0x45ea('0x4'));var moment=require(_0x45ea('0x5'));var BPromise=require(_0x45ea('0x6'));var Mustache=require(_0x45ea('0x7'));var util=require('util');var path=require(_0x45ea('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x45ea('0x9'));var fs=require('fs');var fs_extra=require(_0x45ea('0xa'));var _=require(_0x45ea('0xb'));var squel=require(_0x45ea('0xc'));var crypto=require('crypto');var jsforce=require(_0x45ea('0xd'));var deskjs=require(_0x45ea('0xe'));var toCsv=require(_0x45ea('0xf'));var querystring=require('querystring');var Papa=require(_0x45ea('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x45ea('0x11'));var as=require(_0x45ea('0x12'));var hardwareService=require(_0x45ea('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x45ea('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x45ea('0x15'));var db=require('../../mysqldb')['db'];config[_0x45ea('0x16')]=_[_0x45ea('0x17')](config[_0x45ea('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0x45ea('0x18')](socket);function respondWithStatusCode(_0x3dadd2,_0x7a8a4){_0x7a8a4=_0x7a8a4||0xcc;return function(_0x439997){if(_0x439997){return _0x3dadd2['sendStatus'](_0x7a8a4);}return _0x3dadd2[_0x45ea('0x19')](_0x7a8a4)[_0x45ea('0x1a')]();};}function respondWithResult(_0x3a632e,_0x40ec3d){_0x40ec3d=_0x40ec3d||0xc8;return function(_0x3996ae){if(_0x3996ae){return _0x3a632e['status'](_0x40ec3d)[_0x45ea('0x1b')](_0x3996ae);}};}function respondWithFilteredResult(_0x18ce1b,_0x1be41b){return function(_0x39cb9c){if(_0x39cb9c){var _0xb05751=typeof _0x1be41b[_0x45ea('0x1c')]===_0x45ea('0x1d')&&typeof _0x1be41b[_0x45ea('0x1e')]===_0x45ea('0x1d');var _0x51b247=_0x39cb9c['count'];var _0x4336c5=_0xb05751?0x0:_0x1be41b['offset'];var _0xcd97e1=_0xb05751?_0x39cb9c[_0x45ea('0x1f')]:_0x1be41b['offset']+_0x1be41b[_0x45ea('0x1e')];var _0x1a168e;if(_0xcd97e1>=_0x51b247){_0xcd97e1=_0x51b247;_0x1a168e=0xc8;}else{_0x1a168e=0xce;}_0x18ce1b[_0x45ea('0x19')](_0x1a168e);return _0x18ce1b[_0x45ea('0x20')]('Content-Range',_0x4336c5+'-'+_0xcd97e1+'/'+_0x51b247)['json'](_0x39cb9c);}return null;};}function patchUpdates(_0xc85a31){return function(_0x56aae2){try{jsonpatch['apply'](_0x56aae2,_0xc85a31,!![]);}catch(_0x3a76be){return BPromise[_0x45ea('0x21')](_0x3a76be);}return _0x56aae2[_0x45ea('0x22')]();};}function saveUpdates(_0x306df3,_0x96e46b){return function(_0x27e278){if(_0x27e278){return _0x27e278[_0x45ea('0x23')](_0x306df3)[_0x45ea('0x24')](function(_0x1c3adf){return _0x1c3adf;});}return null;};}function removeEntity(_0x4c8dd1,_0x1f247f){return function(_0x27be42){if(_0x27be42){return _0x27be42[_0x45ea('0x25')]()['then'](function(){_0x4c8dd1[_0x45ea('0x19')](0xcc)[_0x45ea('0x1a')]();});}};}function handleEntityNotFound(_0x46f64c,_0x207499){return function(_0xc6bc9){if(!_0xc6bc9){_0x46f64c[_0x45ea('0x26')](0x194);}return _0xc6bc9;};}function handleError(_0x23b140,_0x403be7){_0x403be7=_0x403be7||0x1f4;return function(_0x7cd21c){logger['error'](_0x7cd21c['stack']);if(_0x7cd21c[_0x45ea('0x27')]){delete _0x7cd21c['name'];}_0x23b140[_0x45ea('0x19')](_0x403be7)['send'](_0x7cd21c);};}exports[_0x45ea('0x28')]=function(_0x2ac9e4,_0x39611b,_0x3a92dc){if(!_0x2ac9e4[_0x45ea('0x29')]['hasOwnProperty'](_0x45ea('0x2a'))&&!_0x2ac9e4[_0x45ea('0x29')][_0x45ea('0x2b')](_0x45ea('0x2c'))){throw new db['Sequelize'][(_0x45ea('0x2d'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2ac9e4[_0x45ea('0x29')][_0x45ea('0x2b')]('TemplateId')&&!_0x2ac9e4[_0x45ea('0x29')][_0x45ea('0x2b')](_0x45ea('0x2e'))){throw new db[(_0x45ea('0x2f'))][(_0x45ea('0x2d'))](_0x45ea('0x30'));}if(!_0x2ac9e4[_0x45ea('0x29')][_0x45ea('0x2b')](_0x45ea('0x31'))){throw new db['Sequelize'][(_0x45ea('0x2d'))](_0x45ea('0x32'));}else{try{var _0x580498=JSON[_0x45ea('0x33')](_0x2ac9e4[_0x45ea('0x29')][_0x45ea('0x31')]);}catch(_0x33f987){logger[_0x45ea('0x34')](_0x33f987);throw new db['Sequelize'][(_0x45ea('0x2d'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5e94c5=['chatqueue','faxqueue',_0x45ea('0x35'),_0x45ea('0x36'),_0x45ea('0x37'),'voicequeue','whatsappqueue',_0x45ea('0x38'),_0x45ea('0x39')];if(_[_0x45ea('0x3a')](_0x580498,function(_0x2b27f9){return!_[_0x45ea('0x3b')](_0x5e94c5,_0x2b27f9[_0x45ea('0x3c')][_0x45ea('0x3d')]());})){throw new db['Sequelize']['ValidationError'](_0x45ea('0x3e'));}}}var _0x2f706f={};_0x2f706f[_0x45ea('0x3f')]=_0x2ac9e4[_0x45ea('0x29')][_0x45ea('0x2b')](_0x45ea('0x3f'))?_0x2ac9e4[_0x45ea('0x29')]['senderName']:_0x2ac9e4[_0x45ea('0x39')][_0x45ea('0x40')];_0x2f706f[_0x45ea('0x41')]=_[_0x45ea('0x42')](_0x2ac9e4['body'][_0x45ea('0x41')])?null:_0x2ac9e4['body'][_0x45ea('0x41')];_0x2f706f[_0x45ea('0x43')]=_0x2ac9e4[_0x45ea('0x29')][_0x45ea('0x43')]||![];_0x2f706f[_0x45ea('0x44')]=_0x2ac9e4['user']['id'];return getContent(_0x2ac9e4[_0x45ea('0x29')])[_0x45ea('0x24')](function(_0x1ec6db){_0x2f706f['body']=_0x1ec6db;return getRecipients(_0x580498);})[_0x45ea('0x24')](function(_0x551d9f){_0x2f706f[_0x45ea('0x45')]=_[_0x45ea('0x46')](_0x551d9f)[_0x45ea('0x47')](',');return db[_0x45ea('0x48')][_0x45ea('0x49')](function(_0xd57fb5){return db[_0x45ea('0x4a')]['create'](_0x2f706f,{'raw':!![],'transaction':_0xd57fb5})[_0x45ea('0x24')](function(_0x5bf302){var _0x116357={'sender':_0x2f706f[_0x45ea('0x3f')],'description':_0x2f706f[_0x45ea('0x41')],'content':_0x2f706f[_0x45ea('0x29')],'beep':_0x2f706f[_0x45ea('0x43')]};_0x551d9f[_0x45ea('0x4b')](function(_0x557d72){_0x116357[_0x45ea('0x4c')]=_0x557d72;socket[_0x45ea('0x4d')](_0x45ea('0x4e'),_0x116357);});return _0x5bf302;});});})[_0x45ea('0x24')](respondWithResult(_0x39611b,0xc9))[_0x45ea('0x4f')](handleError(_0x39611b,null));};function getContent(_0x2265d3){return new BPromise(function(_0x4245bc,_0x76087e){if(_0x2265d3['text']){_0x4245bc(_0x2265d3[_0x45ea('0x2a')]);return;}return db['Template'][_0x45ea('0x50')]({'attributes':[_0x45ea('0x51')],'where':{'id':_0x2265d3['TemplateId']},'raw':!![]})[_0x45ea('0x24')](function(_0x518f79){if(!_0x518f79)throw new db[(_0x45ea('0x2f'))][(_0x45ea('0x2d'))](_0x45ea('0x52'));var _0x41d8bf=Mustache[_0x45ea('0x53')](_0x518f79['html'],_0x2265d3[_0x45ea('0x2e')]);_0x4245bc(_0x41d8bf);})[_0x45ea('0x4f')](function(_0x13731a){_0x76087e(_0x13731a);});});}function getRecipients(_0x2445ac){return new BPromise(function(_0x7e9d3f,_0x47c050){var _0x563a73=[];var _0x36ca94=[];_0x2445ac[_0x45ea('0x4b')](function(_0x1e359f){var _0x2f402a=_[_0x45ea('0x54')](_0x1e359f[_0x45ea('0x3c')][_0x45ea('0x3d')]());if(_0x2f402a===_0x45ea('0x55')){_0x563a73=_[_0x45ea('0x56')](_0x563a73,_0x1e359f[_0x45ea('0x57')]);}else{if(_[_0x45ea('0x3b')](_0x2f402a,_0x45ea('0x58')))_0x2f402a=_0x2f402a['replace']('queue',_0x45ea('0x59'));_0x1e359f['ids'][_0x45ea('0x4b')](function(_0x5aaf4a){_0x36ca94[_0x45ea('0x5a')](getAgents(_0x2f402a,_0x5aaf4a));});}});return BPromise[_0x45ea('0x5b')](_0x36ca94)['then'](function(_0x3b5a7a){_0x563a73=_[_0x45ea('0x56')](_0x563a73,_[_0x45ea('0x5c')](_0x3b5a7a));_0x7e9d3f(_0x563a73);})[_0x45ea('0x4f')](function(_0x1c78e8){_0x47c050(_0x1c78e8);});});}function getAgents(_0x4c3220,_0x37d06f){return new BPromise(function(_0x17c1b9,_0x3de9d0){return db[_0x4c3220][_0x45ea('0x50')]({'where':{'id':_0x37d06f}})[_0x45ea('0x24')](function(_0xf46c8d){return _0xf46c8d[_0x45ea('0x5d')]({'attributes':['id'],'raw':!![]})[_0x45ea('0x24')](function(_0xe3e5c8){var _0x29357b=_[_0x45ea('0x5e')](_0xe3e5c8,'id');_0x17c1b9(_0x29357b);});})[_0x45ea('0x4f')](function(_0x59bf53){_0x3de9d0(_0x59bf53);});});} \ No newline at end of file +var _0x088c=['rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','hasOwnProperty','body','TemplateId','ValidationError','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','view','startCase','model','User','union','includes','replace','queue','Queue','ids','flatten','getAgents','map','eml-format'];(function(_0x75b352,_0xcf29c9){var _0x4b08dc=function(_0x4e0232){while(--_0x4e0232){_0x75b352['push'](_0x75b352['shift']());}};_0x4b08dc(++_0xcf29c9);}(_0x088c,0x11f));var _0xc088=function(_0x3c45d8,_0x5a303e){_0x3c45d8=_0x3c45d8-0x0;var _0x1b8213=_0x088c[_0x3c45d8];return _0x1b8213;};'use strict';var emlformat=require(_0xc088('0x0'));var rimraf=require(_0xc088('0x1'));var zipdir=require(_0xc088('0x2'));var jsonpatch=require(_0xc088('0x3'));var rp=require(_0xc088('0x4'));var moment=require(_0xc088('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc088('0x6'));var sox=require('sox');var csv=require(_0xc088('0x7'));var ejs=require(_0xc088('0x8'));var fs=require('fs');var fs_extra=require(_0xc088('0x9'));var _=require(_0xc088('0xa'));var squel=require(_0xc088('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc088('0xc'));var toCsv=require(_0xc088('0x7'));var querystring=require('querystring');var Papa=require(_0xc088('0xd'));var Redis=require(_0xc088('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc088('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc088('0x10'))('api');var utils=require(_0xc088('0x11'));var config=require(_0xc088('0x12'));var licenseUtil=require(_0xc088('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc088('0x14')](config[_0xc088('0x15')],{'host':_0xc088('0x16'),'port':0x18eb});var socket=require(_0xc088('0x17'))(new Redis(config[_0xc088('0x15')]));require('./userNotification.socket')[_0xc088('0x18')](socket);function respondWithStatusCode(_0x37396d,_0x5164cd){_0x5164cd=_0x5164cd||0xcc;return function(_0x4a2934){if(_0x4a2934){return _0x37396d[_0xc088('0x19')](_0x5164cd);}return _0x37396d[_0xc088('0x1a')](_0x5164cd)[_0xc088('0x1b')]();};}function respondWithResult(_0x133e92,_0x1cd9dd){_0x1cd9dd=_0x1cd9dd||0xc8;return function(_0x56f9e7){if(_0x56f9e7){return _0x133e92['status'](_0x1cd9dd)['json'](_0x56f9e7);}};}function respondWithFilteredResult(_0x5d6497,_0x3e8b30){return function(_0x2006ad){if(_0x2006ad){var _0x5791f0=typeof _0x3e8b30[_0xc088('0x1c')]===_0xc088('0x1d')&&typeof _0x3e8b30[_0xc088('0x1e')]===_0xc088('0x1d');var _0xd7f5b2=_0x2006ad[_0xc088('0x1f')];var _0x4c64de=_0x5791f0?0x0:_0x3e8b30[_0xc088('0x1c')];var _0x58a9f8=_0x5791f0?_0x2006ad[_0xc088('0x1f')]:_0x3e8b30['offset']+_0x3e8b30[_0xc088('0x1e')];var _0x241294;if(_0x58a9f8>=_0xd7f5b2){_0x58a9f8=_0xd7f5b2;_0x241294=0xc8;}else{_0x241294=0xce;}_0x5d6497[_0xc088('0x1a')](_0x241294);return _0x5d6497[_0xc088('0x20')](_0xc088('0x21'),_0x4c64de+'-'+_0x58a9f8+'/'+_0xd7f5b2)[_0xc088('0x22')](_0x2006ad);}return null;};}function patchUpdates(_0x1b71f2){return function(_0xe9fd50){try{jsonpatch[_0xc088('0x23')](_0xe9fd50,_0x1b71f2,!![]);}catch(_0x527128){return BPromise[_0xc088('0x24')](_0x527128);}return _0xe9fd50[_0xc088('0x25')]();};}function saveUpdates(_0x4ec896,_0x424365){return function(_0x4ebec7){if(_0x4ebec7){return _0x4ebec7[_0xc088('0x26')](_0x4ec896)[_0xc088('0x27')](function(_0x50ddff){return _0x50ddff;});}return null;};}function removeEntity(_0x1100f2,_0x3376cd){return function(_0x496661){if(_0x496661){return _0x496661[_0xc088('0x28')]()[_0xc088('0x27')](function(){_0x1100f2[_0xc088('0x1a')](0xcc)[_0xc088('0x1b')]();});}};}function handleEntityNotFound(_0x2718a1,_0x3e306e){return function(_0x103b81){if(!_0x103b81){_0x2718a1[_0xc088('0x19')](0x194);}return _0x103b81;};}function handleError(_0x1616a6,_0x2dec3b){_0x2dec3b=_0x2dec3b||0x1f4;return function(_0x102ae0){logger['error'](_0x102ae0['stack']);if(_0x102ae0[_0xc088('0x29')]){delete _0x102ae0[_0xc088('0x29')];}_0x1616a6['status'](_0x2dec3b)[_0xc088('0x2a')](_0x102ae0);};}exports['sendUserNotification']=function(_0x3e99cc,_0x5a0248,_0x957805){if(!_0x3e99cc['body'][_0xc088('0x2b')]('text')&&!_0x3e99cc[_0xc088('0x2c')][_0xc088('0x2b')](_0xc088('0x2d'))){throw new db['Sequelize'][(_0xc088('0x2e'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3e99cc[_0xc088('0x2c')][_0xc088('0x2b')](_0xc088('0x2d'))&&!_0x3e99cc[_0xc088('0x2c')][_0xc088('0x2b')]('view')){throw new db['Sequelize']['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x3e99cc['body']['hasOwnProperty'](_0xc088('0x2f'))){throw new db[(_0xc088('0x30'))]['ValidationError'](_0xc088('0x31'));}else{try{var _0xfacbc7=JSON[_0xc088('0x32')](_0x3e99cc[_0xc088('0x2c')][_0xc088('0x2f')]);}catch(_0x96a020){logger[_0xc088('0x33')](_0x96a020);throw new db['Sequelize']['ValidationError'](_0xc088('0x34'));}var _0x548d50=[_0xc088('0x35'),_0xc088('0x36'),_0xc088('0x37'),_0xc088('0x38'),_0xc088('0x39'),_0xc088('0x3a'),_0xc088('0x3b'),_0xc088('0x3c'),_0xc088('0x3d')];if(_['some'](_0xfacbc7,function(_0x2baa72){return!_['includes'](_0x548d50,_0x2baa72['model'][_0xc088('0x3e')]());})){throw new db['Sequelize'][(_0xc088('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x13dc3f={};_0x13dc3f[_0xc088('0x3f')]=_0x3e99cc[_0xc088('0x2c')]['hasOwnProperty'](_0xc088('0x3f'))?_0x3e99cc[_0xc088('0x2c')][_0xc088('0x3f')]:_0x3e99cc[_0xc088('0x3d')][_0xc088('0x40')];_0x13dc3f['recipientsDescription']=_[_0xc088('0x41')](_0x3e99cc[_0xc088('0x2c')][_0xc088('0x42')])?null:_0x3e99cc['body'][_0xc088('0x42')];_0x13dc3f[_0xc088('0x43')]=_0x3e99cc[_0xc088('0x2c')]['beep']||![];_0x13dc3f[_0xc088('0x44')]=_0x3e99cc[_0xc088('0x3d')]['id'];return getContent(_0x3e99cc[_0xc088('0x2c')])[_0xc088('0x27')](function(_0x1f630f){_0x13dc3f['body']=_0x1f630f;return getRecipients(_0xfacbc7);})[_0xc088('0x27')](function(_0x556eda){_0x13dc3f[_0xc088('0x45')]=_[_0xc088('0x46')](_0x556eda)[_0xc088('0x47')](',');return db['sequelize']['transaction'](function(_0x4546e1){return db[_0xc088('0x48')][_0xc088('0x49')](_0x13dc3f,{'raw':!![],'transaction':_0x4546e1})[_0xc088('0x27')](function(_0x545ca7){var _0x37ee66={'sender':_0x13dc3f['senderName'],'description':_0x13dc3f[_0xc088('0x42')],'content':_0x13dc3f[_0xc088('0x2c')],'beep':_0x13dc3f[_0xc088('0x43')]};_0x556eda[_0xc088('0x4a')](function(_0x28a330){_0x37ee66[_0xc088('0x4b')]=_0x28a330;socket[_0xc088('0x4c')](_0xc088('0x4d'),_0x37ee66);});return _0x545ca7;});});})[_0xc088('0x27')](respondWithResult(_0x5a0248,0xc9))[_0xc088('0x4e')](handleError(_0x5a0248,null));};function getContent(_0x5ad53a){return new BPromise(function(_0x587a90,_0x123f70){if(_0x5ad53a[_0xc088('0x4f')]){_0x587a90(_0x5ad53a[_0xc088('0x4f')]);return;}return db[_0xc088('0x50')][_0xc088('0x51')]({'attributes':[_0xc088('0x52')],'where':{'id':_0x5ad53a[_0xc088('0x2d')]},'raw':!![]})[_0xc088('0x27')](function(_0x4d85ff){if(!_0x4d85ff)throw new db[(_0xc088('0x30'))][(_0xc088('0x2e'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xf4b031=Mustache['render'](_0x4d85ff[_0xc088('0x52')],_0x5ad53a[_0xc088('0x53')]);_0x587a90(_0xf4b031);})['catch'](function(_0xc9b0b1){_0x123f70(_0xc9b0b1);});});}function getRecipients(_0x29c945){return new BPromise(function(_0x4b0a7f,_0x149e66){var _0x2760a0=[];var _0x5d2103=[];_0x29c945[_0xc088('0x4a')](function(_0x2bced7){var _0x2336a2=_[_0xc088('0x54')](_0x2bced7[_0xc088('0x55')][_0xc088('0x3e')]());if(_0x2336a2===_0xc088('0x56')){_0x2760a0=_[_0xc088('0x57')](_0x2760a0,_0x2bced7['ids']);}else{if(_[_0xc088('0x58')](_0x2336a2,'queue'))_0x2336a2=_0x2336a2[_0xc088('0x59')](_0xc088('0x5a'),_0xc088('0x5b'));_0x2bced7[_0xc088('0x5c')][_0xc088('0x4a')](function(_0x332954){_0x5d2103['push'](getAgents(_0x2336a2,_0x332954));});}});return BPromise['all'](_0x5d2103)[_0xc088('0x27')](function(_0x2b36d5){_0x2760a0=_[_0xc088('0x57')](_0x2760a0,_[_0xc088('0x5d')](_0x2b36d5));_0x4b0a7f(_0x2760a0);})[_0xc088('0x4e')](function(_0x35f9de){_0x149e66(_0x35f9de);});});}function getAgents(_0x3886d7,_0x5ac89c){return new BPromise(function(_0x5750aa,_0x247bbf){return db[_0x3886d7]['findOne']({'where':{'id':_0x5ac89c}})[_0xc088('0x27')](function(_0x4138ce){return _0x4138ce[_0xc088('0x5e')]({'attributes':['id'],'raw':!![]})[_0xc088('0x27')](function(_0x16a52d){var _0x3c46c6=_[_0xc088('0x5f')](_0x16a52d,'id');_0x5750aa(_0x3c46c6);});})['catch'](function(_0x218016){_0x247bbf(_0x218016);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e977ff0..7aa9c45 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 _0x759e=['exports','../../mysqldb','UserNotification','update','remove','emit','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x759e,0x1d1));var _0xe759=function(_0x3b8085,_0x460d46){_0x3b8085=_0x3b8085-0x0;var _0x18abec=_0x759e[_0x3b8085];return _0x18abec;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xe759('0x0'))['db'][_0xe759('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe759('0x2'),'afterDestroy':_0xe759('0x3')};function emitEvent(_0x24fe45){return function(_0x308f07,_0x5a6d40,_0x50c50c){UserNotificationEvents[_0xe759('0x4')](_0x24fe45+':'+_0x308f07['id'],_0x308f07);UserNotificationEvents[_0xe759('0x4')](_0x24fe45,_0x308f07);_0x50c50c(null);};}for(var e in events){if(events[_0xe759('0x5')](e)){var event=events[e];UserNotification[_0xe759('0x6')](e,emitEvent(event));}}module[_0xe759('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x738b=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2f9d83,_0xfbc7e7){var _0x112d5f=function(_0x513735){while(--_0x513735){_0x2f9d83['push'](_0x2f9d83['shift']());}};_0x112d5f(++_0xfbc7e7);}(_0x738b,0x19e));var _0xb738=function(_0x37ca3b,_0x116dad){_0x37ca3b=_0x37ca3b-0x0;var _0x5c2cf1=_0x738b[_0x37ca3b];return _0x5c2cf1;};'use strict';var EventEmitter=require(_0xb738('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb738('0x1')](0x0);var events={'afterCreate':_0xb738('0x2'),'afterUpdate':_0xb738('0x3'),'afterDestroy':_0xb738('0x4')};function emitEvent(_0x5527a6){return function(_0x50fda2,_0x3cfdaa,_0x131bc4){UserNotificationEvents[_0xb738('0x5')](_0x5527a6+':'+_0x50fda2['id'],_0x50fda2);UserNotificationEvents[_0xb738('0x5')](_0x5527a6,_0x50fda2);_0x131bc4(null);};}for(var e in events){if(events[_0xb738('0x6')](e)){var event=events[e];UserNotification[_0xb738('0x7')](e,emitEvent(event));}}module[_0xb738('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index fc6b7cb..ab6314a 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 _0xb21b=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications'];(function(_0x4325ab,_0x3d6d50){var _0x3a8cf7=function(_0x4c443e){while(--_0x4c443e){_0x4325ab['push'](_0x4325ab['shift']());}};_0x3a8cf7(++_0x3d6d50);}(_0xb21b,0x1ec));var _0xbb21=function(_0x16da9d,_0x41329b){_0x16da9d=_0x16da9d-0x0;var _0x3b8fe2=_0xb21b[_0x16da9d];return _0x3b8fe2;};'use strict';var _=require(_0xbb21('0x0'));var util=require('util');var logger=require(_0xbb21('0x1'))('api');var moment=require(_0xbb21('0x2'));var BPromise=require(_0xbb21('0x3'));var rp=require(_0xbb21('0x4'));var fs=require('fs');var path=require(_0xbb21('0x5'));var rimraf=require(_0xbb21('0x6'));var config=require(_0xbb21('0x7'));var attributes=require('./userNotification.attributes');module[_0xbb21('0x8')]=function(_0x51e21f,_0x4705d3){return _0x51e21f[_0xbb21('0x9')](_0xbb21('0xa'),attributes,{'tableName':_0xbb21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb21('0xc'),'collate':_0xbb21('0xd')});}; \ No newline at end of file +var _0xb0d3=['util','api','moment','bluebird','request-promise','path','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x491ec9,_0x48658f){var _0x1edaee=function(_0x107107){while(--_0x107107){_0x491ec9['push'](_0x491ec9['shift']());}};_0x1edaee(++_0x48658f);}(_0xb0d3,0x137));var _0x3b0d=function(_0x20ae13,_0x2a0c8e){_0x20ae13=_0x20ae13-0x0;var _0x533fd5=_0xb0d3[_0x20ae13];return _0x533fd5;};'use strict';var _=require(_0x3b0d('0x0'));var util=require(_0x3b0d('0x1'));var logger=require('../../config/logger')(_0x3b0d('0x2'));var moment=require(_0x3b0d('0x3'));var BPromise=require(_0x3b0d('0x4'));var rp=require(_0x3b0d('0x5'));var fs=require('fs');var path=require(_0x3b0d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x3b0d('0x7')]=function(_0x12ef6f,_0x1738e2){return _0x12ef6f['define'](_0x3b0d('0x8'),attributes,{'tableName':_0x3b0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b0d('0xa'),'collate':_0x3b0d('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 013fc54..e43ac08 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 _0xb82c=['rpc','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','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4f35ca,_0x232f60){var _0x44ad50=function(_0x57e6c9){while(--_0x57e6c9){_0x4f35ca['push'](_0x4f35ca['shift']());}};_0x44ad50(++_0x232f60);}(_0xb82c,0x89));var _0xcb82=function(_0x526f88,_0x4fcbf2){_0x526f88=_0x526f88-0x0;var _0x234959=_0xb82c[_0x526f88];return _0x234959;};'use strict';var _=require('lodash');var util=require(_0xcb82('0x0'));var moment=require('moment');var BPromise=require(_0xcb82('0x1'));var rs=require(_0xcb82('0x2'));var fs=require('fs');var Redis=require(_0xcb82('0x3'));var db=require(_0xcb82('0x4'))['db'];var utils=require(_0xcb82('0x5'));var logger=require(_0xcb82('0x6'))(_0xcb82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcb82('0x8')][_0xcb82('0x9')]({'port':0x232a});config['redis']=_[_0xcb82('0xa')](config[_0xcb82('0xb')],{'host':_0xcb82('0xc'),'port':0x18eb});var socket=require(_0xcb82('0xd'))(new Redis(config[_0xcb82('0xb')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x7d9b2c,_0x5d08ed,_0x3c8f31){return new BPromise(function(_0x330b00,_0x2e29d3){return client['request'](_0x7d9b2c,_0x3c8f31)[_0xcb82('0xe')](function(_0xd8920c){logger['info'](_0xcb82('0xf'),_0x5d08ed,_0xcb82('0x10'));logger[_0xcb82('0x11')](_0xcb82('0x12'),_0x5d08ed,_0xcb82('0x10'),JSON['stringify'](_0xd8920c));if(_0xd8920c[_0xcb82('0x13')]){if(_0xd8920c[_0xcb82('0x13')]['code']===0x1f4){logger['error'](_0xcb82('0xf'),_0x5d08ed,_0xd8920c[_0xcb82('0x13')][_0xcb82('0x14')]);return _0x2e29d3(_0xd8920c[_0xcb82('0x13')][_0xcb82('0x14')]);}logger[_0xcb82('0x13')](_0xcb82('0xf'),_0x5d08ed,_0xd8920c[_0xcb82('0x13')][_0xcb82('0x14')]);return _0x330b00(_0xd8920c[_0xcb82('0x13')][_0xcb82('0x14')]);}else{logger[_0xcb82('0x15')]('UserNotification,\x20%s,\x20%s',_0x5d08ed,_0xcb82('0x10'));_0x330b00(_0xd8920c[_0xcb82('0x16')][_0xcb82('0x14')]);}})[_0xcb82('0x17')](function(_0x548cb0){logger[_0xcb82('0x13')](_0xcb82('0xf'),_0x5d08ed,_0x548cb0);_0x2e29d3(_0x548cb0);});});} \ No newline at end of file +var _0x2c06=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','request','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s','message','error','result','catch','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2c06,0x143));var _0x62c0=function(_0x1a77b3,_0x506cf5){_0x1a77b3=_0x1a77b3-0x0;var _0x556fc2=_0x2c06[_0x1a77b3];return _0x556fc2;};'use strict';var _=require(_0x62c0('0x0'));var util=require(_0x62c0('0x1'));var moment=require(_0x62c0('0x2'));var BPromise=require(_0x62c0('0x3'));var rs=require(_0x62c0('0x4'));var fs=require('fs');var Redis=require(_0x62c0('0x5'));var db=require(_0x62c0('0x6'))['db'];var utils=require(_0x62c0('0x7'));var logger=require('../../config/logger')(_0x62c0('0x8'));var config=require(_0x62c0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x62c0('0xa')][_0x62c0('0xb')]({'port':0x232a});config[_0x62c0('0xc')]=_[_0x62c0('0xd')](config[_0x62c0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x62c0('0xe'))(new Redis(config['redis']));require(_0x62c0('0xf'))['register'](socket);function respondWithRpcPromise(_0x251d9d,_0x4df72a,_0x1c4553){return new BPromise(function(_0x550a7b,_0x38705d){return client[_0x62c0('0x10')](_0x251d9d,_0x1c4553)[_0x62c0('0x11')](function(_0x33b1c2){logger[_0x62c0('0x12')]('UserNotification,\x20%s,\x20%s',_0x4df72a,'request\x20sent');logger[_0x62c0('0x13')](_0x62c0('0x14'),_0x4df72a,_0x62c0('0x15'),JSON['stringify'](_0x33b1c2));if(_0x33b1c2['error']){if(_0x33b1c2['error']['code']===0x1f4){logger['error'](_0x62c0('0x16'),_0x4df72a,_0x33b1c2['error'][_0x62c0('0x17')]);return _0x38705d(_0x33b1c2['error'][_0x62c0('0x17')]);}logger[_0x62c0('0x18')]('UserNotification,\x20%s,\x20%s',_0x4df72a,_0x33b1c2[_0x62c0('0x18')][_0x62c0('0x17')]);return _0x550a7b(_0x33b1c2[_0x62c0('0x18')]['message']);}else{logger[_0x62c0('0x12')](_0x62c0('0x16'),_0x4df72a,'request\x20sent');_0x550a7b(_0x33b1c2[_0x62c0('0x19')][_0x62c0('0x17')]);}})[_0x62c0('0x1a')](function(_0x50abbf){logger[_0x62c0('0x18')](_0x62c0('0x16'),_0x4df72a,_0x50abbf);_0x38705d(_0x50abbf);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index af2a271..788722b 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 _0x4bcb=['update','emit','removeListener','length','userNotification:','./userNotification.events','save'];(function(_0x50d12f,_0x33ed91){var _0xa0cf4d=function(_0x3d723e){while(--_0x3d723e){_0x50d12f['push'](_0x50d12f['shift']());}};_0xa0cf4d(++_0x33ed91);}(_0x4bcb,0x7c));var _0xb4bc=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x4bcb[_0x4c1ec2];return _0x3f6f1c;};'use strict';var UserNotificationEvents=require(_0xb4bc('0x0'));var events=[_0xb4bc('0x1'),'remove',_0xb4bc('0x2')];function createListener(_0x53a7b5,_0x2efcd6){return function(_0x3287f4){_0x2efcd6[_0xb4bc('0x3')](_0x53a7b5,_0x3287f4);};}function removeListener(_0x93a34b,_0xcea2af){return function(){UserNotificationEvents[_0xb4bc('0x4')](_0x93a34b,_0xcea2af);};}exports['register']=function(_0x2fa90b){for(var _0x131e75=0x0,_0x3f3b8f=events[_0xb4bc('0x5')];_0x131e75<_0x3f3b8f;_0x131e75++){var _0x5b4e7a=events[_0x131e75];var _0x5e0272=createListener(_0xb4bc('0x6')+_0x5b4e7a,_0x2fa90b);UserNotificationEvents['on'](_0x5b4e7a,_0x5e0272);}}; \ No newline at end of file +var _0x27c5=['./userNotification.events','save','remove','removeListener','length','userNotification:'];(function(_0xb6c101,_0x5bd93d){var _0x163d78=function(_0xf77b12){while(--_0xf77b12){_0xb6c101['push'](_0xb6c101['shift']());}};_0x163d78(++_0x5bd93d);}(_0x27c5,0x1f2));var _0x527c=function(_0x533bf7,_0x29485b){_0x533bf7=_0x533bf7-0x0;var _0x9e4c57=_0x27c5[_0x533bf7];return _0x9e4c57;};'use strict';var UserNotificationEvents=require(_0x527c('0x0'));var events=[_0x527c('0x1'),_0x527c('0x2'),'update'];function createListener(_0x5bf719,_0x472f62){return function(_0x1a1cb4){_0x472f62['emit'](_0x5bf719,_0x1a1cb4);};}function removeListener(_0x4300c2,_0x5074a2){return function(){UserNotificationEvents[_0x527c('0x3')](_0x4300c2,_0x5074a2);};}exports['register']=function(_0x3f5e94){for(var _0xb698b6=0x0,_0x495361=events[_0x527c('0x4')];_0xb698b6<_0x495361;_0xb698b6++){var _0x322261=events[_0xb698b6];var _0x3f0934=createListener(_0x527c('0x5')+_0x322261,_0x3f5e94);UserNotificationEvents['on'](_0x322261,_0x3f0934);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 184b461..156652a 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3dcc78,_0x5a3972){var _0x4c173c=function(_0x2f675f){while(--_0x2f675f){_0x3dcc78['push'](_0x3dcc78['shift']());}};_0x4c173c(++_0x5a3972);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4ed30a,_0x3beecb){var _0x3a0c38=function(_0x3a37c9){while(--_0x3a37c9){_0x4ed30a['push'](_0x4ed30a['shift']());}};_0x3a0c38(++_0x3beecb);}(_0xedd9,0xfc));var _0x9edd=function(_0x37ee7a,_0x3e93fa){_0x37ee7a=_0x37ee7a-0x0;var _0x46ee5b=_0xedd9[_0x37ee7a];return _0x46ee5b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 3732954..3ed89ea 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 _0x9fcf=['INTEGER','sequelize','exports'];(function(_0x5dd7ed,_0x14b936){var _0x313013=function(_0x28fd7f){while(--_0x28fd7f){_0x5dd7ed['push'](_0x5dd7ed['shift']());}};_0x313013(++_0x14b936);}(_0x9fcf,0x73));var _0xf9fc=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x9fcf[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require(_0xf9fc('0x0'));module[_0xf9fc('0x1')]={'penalty':{'type':Sequelize[_0xf9fc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa002=['exports','INTEGER','sequelize'];(function(_0x2aff46,_0x6eac77){var _0x492ced=function(_0x13b3ea){while(--_0x13b3ea){_0x2aff46['push'](_0x2aff46['shift']());}};_0x492ced(++_0x6eac77);}(_0xa002,0x17c));var _0x2a00=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa002[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x2a00('0x0'));module[_0x2a00('0x1')]={'penalty':{'type':Sequelize[_0x2a00('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 900372e..bb4f262 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 _0xdc84=['util','../../config/logger','api','moment','request-promise','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdc84,0x10e));var _0x4dc8=function(_0x260b48,_0x117977){_0x260b48=_0x260b48-0x0;var _0x3f730b=_0xdc84[_0x260b48];return _0x3f730b;};'use strict';var _=require('lodash');var util=require(_0x4dc8('0x0'));var logger=require(_0x4dc8('0x1'))(_0x4dc8('0x2'));var moment=require(_0x4dc8('0x3'));var BPromise=require('bluebird');var rp=require(_0x4dc8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4dc8('0x5'));var config=require('../../config/environment');var attributes=require(_0x4dc8('0x6'));module['exports']=function(_0x192549,_0x453f42){return _0x192549[_0x4dc8('0x7')](_0x4dc8('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c97=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userOpenchannelQueue.attributes','exports'];(function(_0x444435,_0x529006){var _0x583ad3=function(_0x95ef86){while(--_0x95ef86){_0x444435['push'](_0x444435['shift']());}};_0x583ad3(++_0x529006);}(_0x7c97,0x1ca));var _0x77c9=function(_0x3aa11f,_0x5382c6){_0x3aa11f=_0x3aa11f-0x0;var _0x53ab29=_0x7c97[_0x3aa11f];return _0x53ab29;};'use strict';var _=require(_0x77c9('0x0'));var util=require(_0x77c9('0x1'));var logger=require(_0x77c9('0x2'))(_0x77c9('0x3'));var moment=require(_0x77c9('0x4'));var BPromise=require(_0x77c9('0x5'));var rp=require(_0x77c9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x77c9('0x7'));var attributes=require(_0x77c9('0x8'));module[_0x77c9('0x9')]=function(_0x1a5ff9,_0x363980){return _0x1a5ff9[_0x77c9('0xa')](_0x77c9('0xb'),attributes,{'tableName':_0x77c9('0xc'),'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 dd87966..3fb7219 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 _0x6df0=['moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4a845d,_0x8c0c4a){var _0x5b763a=function(_0xfbc195){while(--_0xfbc195){_0x4a845d['push'](_0x4a845d['shift']());}};_0x5b763a(++_0x8c0c4a);}(_0x6df0,0x7c));var _0x06df=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x6df0[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x06df('0x0'));var util=require(_0x06df('0x1'));var moment=require(_0x06df('0x2'));var BPromise=require('bluebird');var rs=require(_0x06df('0x3'));var fs=require('fs');var Redis=require(_0x06df('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x06df('0x5'))(_0x06df('0x6'));var config=require(_0x06df('0x7'));var jayson=require(_0x06df('0x8'));var client=jayson['client'][_0x06df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36caae,_0x2bd2cc,_0x50004a){return new BPromise(function(_0x1e2b00,_0x452908){return client[_0x06df('0xa')](_0x36caae,_0x50004a)[_0x06df('0xb')](function(_0x5b6eef){logger[_0x06df('0xc')](_0x06df('0xd'),_0x2bd2cc,_0x06df('0xe'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2bd2cc,_0x06df('0xe'),JSON[_0x06df('0xf')](_0x5b6eef));if(_0x5b6eef['error']){if(_0x5b6eef[_0x06df('0x10')][_0x06df('0x11')]===0x1f4){logger[_0x06df('0x10')](_0x06df('0xd'),_0x2bd2cc,_0x5b6eef[_0x06df('0x10')][_0x06df('0x12')]);return _0x452908(_0x5b6eef[_0x06df('0x10')][_0x06df('0x12')]);}logger[_0x06df('0x10')](_0x06df('0xd'),_0x2bd2cc,_0x5b6eef[_0x06df('0x10')]['message']);return _0x1e2b00(_0x5b6eef['error']['message']);}else{logger[_0x06df('0xc')](_0x06df('0xd'),_0x2bd2cc,_0x06df('0xe'));_0x1e2b00(_0x5b6eef[_0x06df('0x13')][_0x06df('0x12')]);}})[_0x06df('0x14')](function(_0xa22eb2){logger[_0x06df('0x10')](_0x06df('0xd'),_0x2bd2cc,_0xa22eb2);_0x452908(_0xa22eb2);});});} \ No newline at end of file +var _0xb9d6=['request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5ca23d,_0x5d7e9e){var _0x552791=function(_0x4a2c4e){while(--_0x4a2c4e){_0x5ca23d['push'](_0x5ca23d['shift']());}};_0x552791(++_0x5d7e9e);}(_0xb9d6,0x144));var _0x6b9d=function(_0x471c7b,_0x489243){_0x471c7b=_0x471c7b-0x0;var _0x48f9b8=_0xb9d6[_0x471c7b];return _0x48f9b8;};'use strict';var _=require(_0x6b9d('0x0'));var util=require(_0x6b9d('0x1'));var moment=require(_0x6b9d('0x2'));var BPromise=require(_0x6b9d('0x3'));var rs=require(_0x6b9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b9d('0x5'))['db'];var utils=require(_0x6b9d('0x6'));var logger=require(_0x6b9d('0x7'))(_0x6b9d('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b9d('0x9'));var client=jayson[_0x6b9d('0xa')][_0x6b9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x334a4b,_0x164d57,_0x337694){return new BPromise(function(_0x4500bf,_0x3c8ab){return client[_0x6b9d('0xc')](_0x334a4b,_0x337694)[_0x6b9d('0xd')](function(_0x461e6e){logger[_0x6b9d('0xe')](_0x6b9d('0xf'),_0x164d57,'request\x20sent');logger[_0x6b9d('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x164d57,_0x6b9d('0x11'),JSON[_0x6b9d('0x12')](_0x461e6e));if(_0x461e6e['error']){if(_0x461e6e['error'][_0x6b9d('0x13')]===0x1f4){logger[_0x6b9d('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x164d57,_0x461e6e[_0x6b9d('0x14')][_0x6b9d('0x15')]);return _0x3c8ab(_0x461e6e[_0x6b9d('0x14')][_0x6b9d('0x15')]);}logger[_0x6b9d('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x164d57,_0x461e6e[_0x6b9d('0x14')]['message']);return _0x4500bf(_0x461e6e[_0x6b9d('0x14')][_0x6b9d('0x15')]);}else{logger['info'](_0x6b9d('0xf'),_0x164d57,_0x6b9d('0x11'));_0x4500bf(_0x461e6e[_0x6b9d('0x16')][_0x6b9d('0x15')]);}})[_0x6b9d('0x17')](function(_0x4f291a){logger[_0x6b9d('0x14')](_0x6b9d('0xf'),_0x164d57,_0x4f291a);_0x3c8ab(_0x4f291a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 0c140ab..40ba83f 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 _0x853d=['describe','show','/:id/sections','getSections','getResources','post','addSections','/:id/resources','put','/:id','destroy','delete','removeResources','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x853d,0xd5));var _0xd853=function(_0x2d4224,_0x394591){_0x2d4224=_0x2d4224-0x0;var _0x2246fe=_0x853d[_0x2d4224];return _0x2246fe;};'use strict';var multer=require(_0xd853('0x0'));var util=require(_0xd853('0x1'));var path=require(_0xd853('0x2'));var timeout=require('connect-timeout');var express=require(_0xd853('0x3'));var router=express['Router']();var fs_extra=require(_0xd853('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd853('0x5'));var config=require(_0xd853('0x6'));var controller=require(_0xd853('0x7'));router[_0xd853('0x8')]('/',auth[_0xd853('0x9')](),controller[_0xd853('0xa')]);router[_0xd853('0x8')](_0xd853('0xb'),auth[_0xd853('0x9')](),controller[_0xd853('0xc')]);router[_0xd853('0x8')]('/:id',auth[_0xd853('0x9')](),controller[_0xd853('0xd')]);router[_0xd853('0x8')](_0xd853('0xe'),auth['isAuthenticated'](),controller[_0xd853('0xf')]);router['get']('/:id/resources',auth['isAuthenticated'](),controller[_0xd853('0x10')]);router[_0xd853('0x11')]('/',auth[_0xd853('0x9')](),controller['create']);router['post']('/:id/clone',auth[_0xd853('0x9')](),controller['clone']);router[_0xd853('0x11')](_0xd853('0xe'),auth['isAuthenticated'](),controller[_0xd853('0x12')]);router['post'](_0xd853('0x13'),auth[_0xd853('0x9')](),controller['addResources']);router[_0xd853('0x14')](_0xd853('0x15'),auth[_0xd853('0x9')](),controller['update']);router['delete'](_0xd853('0x15'),auth[_0xd853('0x9')](),controller[_0xd853('0x16')]);router[_0xd853('0x17')](_0xd853('0xe'),auth['isAuthenticated'](),controller['removeSections']);router[_0xd853('0x17')](_0xd853('0x13'),auth[_0xd853('0x9')](),controller[_0xd853('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe408=['/:id/clone','addSections','/:id/resources','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','getSections','post'];(function(_0x44d1d7,_0x2bbc3b){var _0x4951c8=function(_0x44e26d){while(--_0x44e26d){_0x44d1d7['push'](_0x44d1d7['shift']());}};_0x4951c8(++_0x2bbc3b);}(_0xe408,0x19d));var _0x8e40=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0xe408[_0x396466];return _0x5e9ab4;};'use strict';var multer=require(_0x8e40('0x0'));var util=require(_0x8e40('0x1'));var path=require(_0x8e40('0x2'));var timeout=require(_0x8e40('0x3'));var express=require('express');var router=express[_0x8e40('0x4')]();var fs_extra=require(_0x8e40('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8e40('0x6'));var config=require(_0x8e40('0x7'));var controller=require(_0x8e40('0x8'));router['get']('/',auth[_0x8e40('0x9')](),controller[_0x8e40('0xa')]);router[_0x8e40('0xb')](_0x8e40('0xc'),auth[_0x8e40('0x9')](),controller[_0x8e40('0xd')]);router[_0x8e40('0xb')](_0x8e40('0xe'),auth[_0x8e40('0x9')](),controller[_0x8e40('0xf')]);router[_0x8e40('0xb')](_0x8e40('0x10'),auth['isAuthenticated'](),controller[_0x8e40('0x11')]);router[_0x8e40('0xb')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router[_0x8e40('0x12')]('/',auth[_0x8e40('0x9')](),controller['create']);router[_0x8e40('0x12')](_0x8e40('0x13'),auth[_0x8e40('0x9')](),controller['clone']);router[_0x8e40('0x12')](_0x8e40('0x10'),auth[_0x8e40('0x9')](),controller[_0x8e40('0x14')]);router[_0x8e40('0x12')](_0x8e40('0x15'),auth[_0x8e40('0x9')](),controller['addResources']);router['put'](_0x8e40('0xe'),auth['isAuthenticated'](),controller[_0x8e40('0x16')]);router[_0x8e40('0x17')](_0x8e40('0xe'),auth['isAuthenticated'](),controller[_0x8e40('0x18')]);router[_0x8e40('0x17')](_0x8e40('0x10'),auth[_0x8e40('0x9')](),controller[_0x8e40('0x19')]);router['delete'](_0x8e40('0x15'),auth['isAuthenticated'](),controller['removeResources']);module[_0x8e40('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index d9a44cf..7eeca1b 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 _0x053c=['crudPermissions','join','getDataValue','BOOLEAN','STRING','name'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x053c,0x106));var _0xc053=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x053c[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc053('0x0')],'allowNull':![],'unique':_0xc053('0x1')},'crudPermissions':{'type':Sequelize[_0xc053('0x0')],'set':function(_0xe8c4ea){this['setDataValue'](_0xc053('0x2'),_0xe8c4ea?_0xe8c4ea[_0xc053('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xc053('0x2'))?this[_0xc053('0x4')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc053('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc053('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc053('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc053('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc053('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc053('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xc053('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc053('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x947b=['BOOLEAN','sequelize','exports','STRING','name','crudPermissions','join','getDataValue','split'];(function(_0x180dc6,_0x4f9508){var _0x4a56e3=function(_0x1fe62e){while(--_0x1fe62e){_0x180dc6['push'](_0x180dc6['shift']());}};_0x4a56e3(++_0x4f9508);}(_0x947b,0xc7));var _0xb947=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x947b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb947('0x0'));module[_0xb947('0x1')]={'name':{'type':Sequelize[_0xb947('0x2')],'allowNull':![],'unique':_0xb947('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x441422){this['setDataValue'](_0xb947('0x4'),_0x441422?_0x441422[_0xb947('0x5')](''):[]);},'get':function(){return this[_0xb947('0x6')](_0xb947('0x4'))?this[_0xb947('0x6')](_0xb947('0x4'))[_0xb947('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb947('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb947('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb947('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb947('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb947('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb947('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb947('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 30fa266..c0f7760 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 _0x8ff9=['send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','params','find','catch','create','body','clone','includeAll','options','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','destroy','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','push','findOne','Dashboard','resourceId','forEach','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','name'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x4d52e6,_0x40d3ea){_0x4d52e6=_0x4d52e6-0x0;var _0x3646c6=_0x8ff9[_0x4d52e6];return _0x3646c6;};'use strict';var emlformat=require(_0x98ff('0x0'));var rimraf=require(_0x98ff('0x1'));var zipdir=require(_0x98ff('0x2'));var jsonpatch=require(_0x98ff('0x3'));var rp=require(_0x98ff('0x4'));var moment=require(_0x98ff('0x5'));var BPromise=require(_0x98ff('0x6'));var Mustache=require(_0x98ff('0x7'));var util=require(_0x98ff('0x8'));var path=require(_0x98ff('0x9'));var sox=require(_0x98ff('0xa'));var csv=require('to-csv');var ejs=require(_0x98ff('0xb'));var fs=require('fs');var fs_extra=require(_0x98ff('0xc'));var _=require(_0x98ff('0xd'));var squel=require(_0x98ff('0xe'));var crypto=require(_0x98ff('0xf'));var jsforce=require(_0x98ff('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x98ff('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98ff('0x12'));var authService=require(_0x98ff('0x13'));var qs=require(_0x98ff('0x14'));var as=require(_0x98ff('0x15'));var hardwareService=require(_0x98ff('0x16'));var logger=require('../../config/logger')(_0x98ff('0x17'));var utils=require('../../config/utils');var config=require(_0x98ff('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x98ff('0x19')]=_[_0x98ff('0x1a')](config[_0x98ff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x98ff('0x1b'))(new Redis(config['redis']));require(_0x98ff('0x1c'))[_0x98ff('0x1d')](socket);function respondWithStatusCode(_0x2c4e4d,_0x3a7e21){_0x3a7e21=_0x3a7e21||0xcc;return function(_0x2aae4d){if(_0x2aae4d){return _0x2c4e4d[_0x98ff('0x1e')](_0x3a7e21);}return _0x2c4e4d['status'](_0x3a7e21)[_0x98ff('0x1f')]();};}function respondWithResult(_0x196f27,_0xb48c72){_0xb48c72=_0xb48c72||0xc8;return function(_0x5af32){if(_0x5af32){return _0x196f27[_0x98ff('0x20')](_0xb48c72)[_0x98ff('0x21')](_0x5af32);}};}function respondWithFilteredResult(_0x1f3044,_0x33023e){return function(_0x268121){if(_0x268121){var _0x3c04d4=typeof _0x33023e[_0x98ff('0x22')]===_0x98ff('0x23')&&typeof _0x33023e[_0x98ff('0x24')]===_0x98ff('0x23');var _0x4c235b=_0x268121[_0x98ff('0x25')];var _0x31f525=_0x3c04d4?0x0:_0x33023e[_0x98ff('0x22')];var _0x43fb4f=_0x3c04d4?_0x268121[_0x98ff('0x25')]:_0x33023e[_0x98ff('0x22')]+_0x33023e[_0x98ff('0x24')];var _0x3a6c52;if(_0x43fb4f>=_0x4c235b){_0x43fb4f=_0x4c235b;_0x3a6c52=0xc8;}else{_0x3a6c52=0xce;}_0x1f3044[_0x98ff('0x20')](_0x3a6c52);return _0x1f3044[_0x98ff('0x26')](_0x98ff('0x27'),_0x31f525+'-'+_0x43fb4f+'/'+_0x4c235b)[_0x98ff('0x21')](_0x268121);}return null;};}function patchUpdates(_0x2fdbc2){return function(_0x4ea518){try{jsonpatch['apply'](_0x4ea518,_0x2fdbc2,!![]);}catch(_0x4c6ddc){return BPromise[_0x98ff('0x28')](_0x4c6ddc);}return _0x4ea518[_0x98ff('0x29')]();};}function saveUpdates(_0x547fab,_0xd0293e){return function(_0x58b281){if(_0x58b281){return _0x58b281[_0x98ff('0x2a')](_0x547fab)[_0x98ff('0x2b')](function(_0x308efd){return _0x308efd;});}return null;};}function removeEntity(_0x2b3ee9,_0x4003de){return function(_0x5c1c0c){if(_0x5c1c0c){return _0x5c1c0c['destroy']()[_0x98ff('0x2b')](function(){_0x2b3ee9[_0x98ff('0x20')](0xcc)[_0x98ff('0x1f')]();});}};}function handleEntityNotFound(_0x6ccf21,_0x8b7939){return function(_0x231e00){if(!_0x231e00){_0x6ccf21[_0x98ff('0x1e')](0x194);}return _0x231e00;};}function handleError(_0x28e0a0,_0xda7649){_0xda7649=_0xda7649||0x1f4;return function(_0x25a658){logger['error'](_0x25a658[_0x98ff('0x2c')]);if(_0x25a658[_0x98ff('0x2d')]){delete _0x25a658[_0x98ff('0x2d')];}_0x28e0a0[_0x98ff('0x20')](_0xda7649)[_0x98ff('0x2e')](_0x25a658);};}exports[_0x98ff('0x2f')]=function(_0x17975c,_0x41c093){var _0x42213a={},_0x205d85={},_0x3fa70c={'count':0x0,'rows':[]};var _0x1472cb=_[_0x98ff('0x30')](db[_0x98ff('0x31')][_0x98ff('0x32')],function(_0x81e918){return{'name':_0x81e918[_0x98ff('0x33')],'type':_0x81e918[_0x98ff('0x34')][_0x98ff('0x35')]};});_0x205d85[_0x98ff('0x36')]=_[_0x98ff('0x30')](_0x1472cb,'name');_0x205d85[_0x98ff('0x37')]=_[_0x98ff('0x38')](_0x17975c[_0x98ff('0x37')]);_0x205d85[_0x98ff('0x39')]=_[_0x98ff('0x3a')](_0x205d85['model'],_0x205d85[_0x98ff('0x37')]);_0x42213a['attributes']=_[_0x98ff('0x3a')](_0x205d85[_0x98ff('0x36')],qs[_0x98ff('0x3b')](_0x17975c[_0x98ff('0x37')][_0x98ff('0x3b')]));_0x42213a[_0x98ff('0x3c')]=_0x42213a[_0x98ff('0x3c')][_0x98ff('0x3d')]?_0x42213a[_0x98ff('0x3c')]:_0x205d85[_0x98ff('0x36')];if(!_0x17975c['query'][_0x98ff('0x3e')](_0x98ff('0x3f'))){_0x42213a[_0x98ff('0x24')]=qs[_0x98ff('0x24')](_0x17975c[_0x98ff('0x37')][_0x98ff('0x24')]);_0x42213a[_0x98ff('0x22')]=qs[_0x98ff('0x22')](_0x17975c['query'][_0x98ff('0x22')]);}_0x42213a['order']=qs[_0x98ff('0x40')](_0x17975c[_0x98ff('0x37')][_0x98ff('0x40')]);_0x42213a[_0x98ff('0x41')]=qs[_0x98ff('0x39')](_['pick'](_0x17975c['query'],_0x205d85[_0x98ff('0x39')]),_0x1472cb);if(_0x17975c[_0x98ff('0x37')][_0x98ff('0x42')]){_0x42213a[_0x98ff('0x41')]=_[_0x98ff('0x43')](_0x42213a[_0x98ff('0x41')],{'$or':_[_0x98ff('0x30')](_0x1472cb,function(_0x55286f){if(_0x55286f[_0x98ff('0x34')]!==_0x98ff('0x44')){var _0x2ef081={};_0x2ef081[_0x55286f[_0x98ff('0x2d')]]={'$like':'%'+_0x17975c[_0x98ff('0x37')][_0x98ff('0x42')]+'%'};return _0x2ef081;}})});}_0x42213a=_[_0x98ff('0x43')]({},_0x42213a,_0x17975c['options']);var _0x2c6ea8={'where':_0x42213a[_0x98ff('0x41')]};return db[_0x98ff('0x31')][_0x98ff('0x25')](_0x2c6ea8)[_0x98ff('0x2b')](function(_0x5d8c45){_0x3fa70c['count']=_0x5d8c45;if(_0x17975c[_0x98ff('0x37')]['includeAll']){_0x42213a[_0x98ff('0x45')]=[{'all':!![]}];}return db[_0x98ff('0x31')][_0x98ff('0x46')](_0x42213a);})[_0x98ff('0x2b')](function(_0x4208f5){_0x3fa70c[_0x98ff('0x47')]=_0x4208f5;return _0x3fa70c;})['then'](respondWithFilteredResult(_0x41c093,_0x42213a))['catch'](handleError(_0x41c093,null));};exports[_0x98ff('0x48')]=function(_0x4f2be4,_0x1507d1){var _0x61d31d={'raw':![],'where':{'id':_0x4f2be4[_0x98ff('0x49')]['id']}},_0xd3c5b0={};_0xd3c5b0[_0x98ff('0x36')]=_[_0x98ff('0x38')](db['UserProfile'][_0x98ff('0x32')]);_0xd3c5b0[_0x98ff('0x37')]=_[_0x98ff('0x38')](_0x4f2be4['query']);_0xd3c5b0[_0x98ff('0x39')]=_[_0x98ff('0x3a')](_0xd3c5b0[_0x98ff('0x36')],_0xd3c5b0[_0x98ff('0x37')]);_0x61d31d[_0x98ff('0x3c')]=_[_0x98ff('0x3a')](_0xd3c5b0[_0x98ff('0x36')],qs[_0x98ff('0x3b')](_0x4f2be4[_0x98ff('0x37')][_0x98ff('0x3b')]));_0x61d31d[_0x98ff('0x3c')]=_0x61d31d[_0x98ff('0x3c')][_0x98ff('0x3d')]?_0x61d31d[_0x98ff('0x3c')]:_0xd3c5b0[_0x98ff('0x36')];if(_0x4f2be4[_0x98ff('0x37')]['includeAll']){_0x61d31d['include']=[{'all':!![]}];}_0x61d31d=_[_0x98ff('0x43')]({},_0x61d31d,_0x4f2be4['options']);return db[_0x98ff('0x31')][_0x98ff('0x4a')](_0x61d31d)[_0x98ff('0x2b')](handleEntityNotFound(_0x1507d1,null))[_0x98ff('0x2b')](respondWithResult(_0x1507d1,null))[_0x98ff('0x4b')](handleError(_0x1507d1,null));};exports[_0x98ff('0x4c')]=function(_0x4596f5,_0x3eb900){return db[_0x98ff('0x31')]['create'](_0x4596f5[_0x98ff('0x4d')],{})['then'](respondWithResult(_0x3eb900,0xc9))[_0x98ff('0x4b')](handleError(_0x3eb900,null));};exports[_0x98ff('0x4e')]=function(_0x5e3283,_0x1e62ec){var _0x35cda7={'where':{'id':_0x5e3283[_0x98ff('0x49')]['id']}},_0x55c04f={};_0x55c04f[_0x98ff('0x36')]=_['keys'](db[_0x98ff('0x31')][_0x98ff('0x32')]);_0x35cda7[_0x98ff('0x3c')]=_[_0x98ff('0x3a')](_0x55c04f[_0x98ff('0x36')],qs[_0x98ff('0x3b')](_0x5e3283['query'][_0x98ff('0x3b')]));_0x35cda7[_0x98ff('0x3c')]=_0x35cda7[_0x98ff('0x3c')][_0x98ff('0x3d')]?_0x35cda7[_0x98ff('0x3c')]:_0x55c04f[_0x98ff('0x36')];if(_0x5e3283[_0x98ff('0x37')][_0x98ff('0x4f')]){_0x35cda7[_0x98ff('0x45')]=[{'all':!![]}];}_0x35cda7=_[_0x98ff('0x43')]({},_0x35cda7,_0x5e3283[_0x98ff('0x50')]);return db['UserProfile']['find'](_0x35cda7)[_0x98ff('0x2b')](handleEntityNotFound(_0x1e62ec,null))[_0x98ff('0x2b')](function(_0x3fe60f){if(_0x3fe60f){var _0x2b9789=_0x3fe60f[_0x98ff('0x51')]({'plain':!![]});_0x2b9789=qs[_0x98ff('0x52')](_0x2b9789,['id',_0x98ff('0x53'),_0x98ff('0x54'),_0x98ff('0x55')]);_0x5e3283['body']=_[_0x98ff('0x52')](_0x5e3283[_0x98ff('0x4d')],['id',_0x98ff('0x53'),_0x98ff('0x54')]);return db[_0x98ff('0x56')][_0x98ff('0x57')](function(_0x407fc8){return db[_0x98ff('0x31')][_0x98ff('0x4c')](_[_0x98ff('0x43')](_0x2b9789,_0x5e3283['body']),{'include':_0x5e3283['query'][_0x98ff('0x4f')]?[{'all':!![]}]:undefined,'transaction':_0x407fc8})[_0x98ff('0x2b')](function(_0x56b10a){var _0x302e7c=_0x56b10a['get']({'plain':!![]});return db['UserProfileSection'][_0x98ff('0x46')]({'where':{'userProfileId':_0x5e3283[_0x98ff('0x49')]['id']},'raw':!![]})['then'](function(_0x4f97c9){if(_0x4f97c9){return BPromise[_0x98ff('0x58')](_0x4f97c9,function(_0x3bb079){return new BPromise(function(_0x3a4ee2,_0x38fc80){if(_0x3bb079[_0x98ff('0x59')]===null||_0x3bb079['autoAssociation']===0x1)_0x3a4ee2(null);return db[_0x98ff('0x5a')][_0x98ff('0x46')]({'where':{'sectionId':_0x3bb079['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0xa794c4){var _0x23479a=_[_0x98ff('0x30')](_0xa794c4,function(_0x595e5a){return qs['omit'](_0x595e5a,['id',_0x98ff('0x53'),_0x98ff('0x54'),_0x98ff('0x5b')]);});_0x3a4ee2(_0x23479a);})['catch'](function(_0x3abd71){_0x38fc80(_0x3abd71);});})[_0x98ff('0x2b')](function(_0x717195){var _0xc88fee=qs[_0x98ff('0x52')](_0x3bb079,['id',_0x98ff('0x53'),_0x98ff('0x54')]);_0xc88fee[_0x98ff('0x5c')]=_0x302e7c['id'];if(_0x717195)_0xc88fee['Resources']=_0x717195;return _0xc88fee;})[_0x98ff('0x2b')](function(_0x1d3bf6){return db['UserProfileSection'][_0x98ff('0x4c')](_0x1d3bf6,{'include':[{'model':db[_0x98ff('0x5a')],'as':_0x98ff('0x5d')}],'raw':!![],'transaction':_0x407fc8});});})[_0x98ff('0x2b')](function(){return _0x302e7c;});}});});});}})['then'](respondWithResult(_0x1e62ec,0xc9))[_0x98ff('0x4b')](handleError(_0x1e62ec,null));};exports['update']=function(_0x488d84,_0x1d28d7){if(_0x488d84[_0x98ff('0x4d')]['id']){delete _0x488d84[_0x98ff('0x4d')]['id'];}return db[_0x98ff('0x31')][_0x98ff('0x4a')]({'where':{'id':_0x488d84[_0x98ff('0x49')]['id']}})[_0x98ff('0x2b')](handleEntityNotFound(_0x1d28d7,null))[_0x98ff('0x2b')](saveUpdates(_0x488d84['body'],null))[_0x98ff('0x2b')](respondWithResult(_0x1d28d7,null))[_0x98ff('0x4b')](handleError(_0x1d28d7,null));};exports['destroy']=function(_0x47dde5,_0x54ed73){return db[_0x98ff('0x31')]['find']({'where':{'id':_0x47dde5[_0x98ff('0x49')]['id']}})[_0x98ff('0x2b')](handleEntityNotFound(_0x54ed73,null))[_0x98ff('0x2b')](removeEntity(_0x54ed73,null))[_0x98ff('0x4b')](handleError(_0x54ed73,null));};exports[_0x98ff('0x5e')]=function(_0x3960e2,_0x1e5937){return db[_0x98ff('0x31')][_0x98ff('0x5e')]()[_0x98ff('0x2b')](respondWithResult(_0x1e5937,null))[_0x98ff('0x4b')](handleError(_0x1e5937,null));};exports[_0x98ff('0x5f')]=function(_0x46dfad,_0x4f27ed){var _0x1fe438=_0x46dfad['body'];return db[_0x98ff('0x31')]['find']({'where':{'id':_0x46dfad[_0x98ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f27ed,null))[_0x98ff('0x2b')](function(_0x41e465){if(_0x41e465){return db[_0x98ff('0x56')][_0x98ff('0x57')](function(_0x580d9a){return db[_0x98ff('0x60')][_0x98ff('0x61')]({'where':{'userProfileId':_0x46dfad[_0x98ff('0x49')]['id'],'sectionId':_[_0x98ff('0x30')](_0x1fe438,function(_0x531a4d){return _0x531a4d['sectionId'];})},'transaction':_0x580d9a})['then'](function(){var _0x200064=_[_0x98ff('0x30')](_0x1fe438,function(_0x13e386){_0x13e386[_0x98ff('0x5c')]=_0x46dfad[_0x98ff('0x49')]['id'];return _0x13e386;});var _0x4bc79f=[];return BPromise[_0x98ff('0x58')](_0x200064,function(_0x426979){return db[_0x98ff('0x60')][_0x98ff('0x4c')](_0x426979,{'include':[{'model':db[_0x98ff('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x580d9a})[_0x98ff('0x2b')](function(_0x5c887c){_0x4bc79f['push'](_0x5c887c[_0x98ff('0x51')]({'plain':!![]}));});})[_0x98ff('0x2b')](function(){return _0x4bc79f;});});});}})[_0x98ff('0x2b')](function(_0x3e5572){return _0x3e5572;})[_0x98ff('0x2b')](respondWithResult(_0x4f27ed,null))['catch'](handleError(_0x4f27ed,null));};exports[_0x98ff('0x62')]=function(_0x5f197d,_0x5302ac){var _0x321f61;return db[_0x98ff('0x31')][_0x98ff('0x4a')]({'where':{'id':_0x5f197d['params']['id']},'attributes':['id',_0x98ff('0x2d')]})[_0x98ff('0x2b')](handleEntityNotFound(_0x5302ac,null))[_0x98ff('0x2b')](function(_0x3f78a7){if(_0x3f78a7){_0x321f61=_0x3f78a7;return db[_0x98ff('0x60')][_0x98ff('0x61')]({'where':{'userProfileId':_0x5f197d[_0x98ff('0x49')]['id'],'sectionId':_0x5f197d['query'][_0x98ff('0x63')]}});}})['then'](function(){return _0x321f61;})['then'](respondWithStatusCode(_0x5302ac,null))[_0x98ff('0x4b')](handleError(_0x5302ac,null));};exports[_0x98ff('0x64')]=function(_0x460bed,_0x1af88c){var _0x1ccae4=[];var _0x3d9333=[];return db[_0x98ff('0x60')][_0x98ff('0x46')]({'where':{'userProfileId':_0x460bed[_0x98ff('0x49')]['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0x5efbdc){_0x1ccae4=_[_0x98ff('0x42')](_0x5efbdc,function(_0xf01703){return _0xf01703[_0x98ff('0x65')]===0x1||_['includes']([0x3eb,0x709],_0xf01703[_0x98ff('0x5b')]);});if(!_[_0x98ff('0x66')](_0x1ccae4)){return _[_0x98ff('0x30')](_0x1ccae4,function(_0x5b9d87){return _0x5b9d87[_0x98ff('0x5b')];});}else{return;}})[_0x98ff('0x2b')](function(_0x41ca49){if(_0x41ca49)_0x3d9333=_0x41ca49;if(_[_0x98ff('0x67')](_0x3d9333,0x64)){var _0x184005=_[_0x98ff('0x4a')](_0x1ccae4,{'sectionId':0x64});return hasDefaultDashboard(_0x184005)[_0x98ff('0x2b')](function(_0x93ea98){return _['map'](_0x1ccae4,function(_0xee17ca){if(_0xee17ca[_0x98ff('0x5b')]===0x64){_0xee17ca[_0x98ff('0x68')]=_0x93ea98;}return _0xee17ca;});});}else{return;}})['then'](function(_0x5c388c){if(_0x5c388c)_0x1ccae4=_0x5c388c;if(_['includes'](_0x3d9333,0x3eb)){var _0x48dcb5=_['find'](_0x1ccae4,{'sectionId':0x3eb});return getCustomDashboards(_0x48dcb5)[_0x98ff('0x2b')](function(_0x34bf7d){return _[_0x98ff('0x30')](_0x1ccae4,function(_0x7f7a01){if(_0x48dcb5[_0x98ff('0x65')]){if(_0x7f7a01[_0x98ff('0x5b')]===0x3eb){_0x7f7a01['subsections']=_0x34bf7d;}}else{if(_0x7f7a01[_0x98ff('0x5b')]===0x64){_0x7f7a01[_0x98ff('0x68')]=_0x34bf7d;}}return _0x7f7a01;});});}else{return;}})[_0x98ff('0x2b')](function(_0x5e90f7){if(_0x5e90f7)_0x1ccae4=_0x5e90f7;if(_['includes'](_0x3d9333,0x709)){var _0x591239=_[_0x98ff('0x4a')](_0x1ccae4,{'sectionId':0x709});return getPlugins(_0x591239)['then'](function(_0xa5f58a){if(_0x591239[_0x98ff('0x65')]){return _[_0x98ff('0x30')](_0x1ccae4,function(_0x46ebbf){if(_0x46ebbf['sectionId']===0x709){_0x46ebbf['subsections']=_0xa5f58a;}return _0x46ebbf;});}else{var _0x4b7100={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa5f58a};var _0x538497=_[_0x98ff('0x30')](_0x1ccae4);_0x538497[_0x98ff('0x69')](_0x4b7100);return _0x538497;}});}else{return;}})[_0x98ff('0x2b')](function(_0x8a790a){if(_0x8a790a)_0x1ccae4=_0x8a790a;return _[_0x98ff('0x42')](_0x1ccae4,[_0x98ff('0x65'),0x1]);})[_0x98ff('0x2b')](respondWithResult(_0x1af88c,null))['catch'](handleError(_0x1af88c,null));};function hasDefaultDashboard(_0x348833){var _0x4ba137=[0x65];return new BPromise(function(_0x3a0faa,_0x50fda4){try{if(_0x348833[_0x98ff('0x59')]){_0x3a0faa(_0x4ba137);}else{return db['UserProfileResource'][_0x98ff('0x6a')]({'where':{'sectionId':_0x348833['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0x4c3c62){_0x4c3c62?_0x3a0faa(_0x4ba137):_0x3a0faa();});}}catch(_0x528cb3){_0x50fda4(_0x528cb3);}});}function getCustomDashboards(_0x39fab1){var _0x527d68=[];return new BPromise(function(_0x2bc84f,_0x358fb6){try{if(_0x39fab1[_0x98ff('0x59')]){return db[_0x98ff('0x6b')][_0x98ff('0x46')]({'raw':!![]})[_0x98ff('0x2b')](function(_0x5cd834){_0x5cd834['forEach'](function(_0x61dcdf){_0x527d68[_0x98ff('0x69')](_0x61dcdf['id']+0x1869f);});_0x2bc84f(_0x527d68);});}else{return db[_0x98ff('0x5a')][_0x98ff('0x46')]({'where':{'sectionId':_0x39fab1['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0x10da98){_0x10da98['forEach'](function(_0x4c8899){_0x527d68[_0x98ff('0x69')](_0x4c8899[_0x98ff('0x6c')]+0x1869f);});_0x2bc84f(_0x527d68);});}}catch(_0x8b1ee1){_0x358fb6(_0x8b1ee1);}});}function getPlugins(_0x7be72c){var _0x468157=[];return new BPromise(function(_0x30de9b,_0x1f7537){try{if(_0x7be72c[_0x98ff('0x59')]){return db['Plugin'][_0x98ff('0x46')]({'raw':!![]})['then'](function(_0x2bd7a7){_0x2bd7a7[_0x98ff('0x6d')](function(_0x58532b){_0x468157[_0x98ff('0x69')](_0x58532b['id']+0x15b38);});_0x30de9b(_0x468157);});}else{return db[_0x98ff('0x5a')][_0x98ff('0x46')]({'where':{'sectionId':_0x7be72c['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0x45890c){_0x45890c[_0x98ff('0x6d')](function(_0x1f3345){_0x468157[_0x98ff('0x69')](_0x1f3345[_0x98ff('0x6c')]+0x15b38);});_0x30de9b(_0x468157);});}}catch(_0x106f0b){_0x1f7537(_0x106f0b);}});}exports[_0x98ff('0x6e')]=function(_0x541994,_0x4eeeea){return db[_0x98ff('0x31')][_0x98ff('0x4a')]({'where':{'id':_0x541994['params']['id']}})['then'](handleEntityNotFound(_0x4eeeea,null))['then'](function(_0x553df4){if(_0x553df4){return db[_0x98ff('0x56')][_0x98ff('0x57')](function(_0x3a337b){return db[_0x98ff('0x60')][_0x98ff('0x46')]({'where':{'userProfileId':_0x541994[_0x98ff('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x98ff('0x2b')](function(_0x436859){if(_0x436859){return db[_0x98ff('0x60')][_0x98ff('0x61')]({'where':{'userProfileId':_0x541994['params']['id'],'id':_[_0x98ff('0x30')](_0x436859,function(_0x3a51b2){return _0x3a51b2['id'];})},'transaction':_0x3a337b});}})[_0x98ff('0x2b')](function(_0x19be95){var _0x5eaeb8=_[_0x98ff('0x30')](_0x541994[_0x98ff('0x4d')],function(_0x5b3aa0){_0x5b3aa0[_0x98ff('0x5c')]=_0x541994[_0x98ff('0x49')]['id'];return _0x5b3aa0;});return db['UserProfileSection'][_0x98ff('0x6f')](_0x5eaeb8,{'raw':!![],'transaction':_0x3a337b});})[_0x98ff('0x2b')](function(_0x150b27){var _0x2e12c6=_[_0x98ff('0x42')](_[_0x98ff('0x30')](_0x150b27,function(_0x552d36){return _0x552d36[_0x98ff('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x2e12c6){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x541994[_0x98ff('0x49')]['id'],'sectionId':_[_0x98ff('0x30')](_0x2e12c6,function(_0x8d939c){return _0x8d939c['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x98ff('0x2b')](function(_0x306f88){var _0xfbf24f=_[_0x98ff('0x30')](_0x541994[_0x98ff('0x4d')],function(_0x435b95){_0x435b95[_0x98ff('0x5c')]=_0x541994[_0x98ff('0x49')]['id'];return _0x435b95;});return db[_0x98ff('0x5a')]['bulkCreate'](_0xfbf24f,{'raw':!![],'transaction':_0x3a337b});});}})['catch'](handleError(_0x4eeeea,null));});}})['then'](function(_0x222765){var _0x16b43c=_[_0x98ff('0x30')](_0x222765,function(_0x2b631d){return _0x2b631d[_0x98ff('0x51')]({'plain':!![]});});})[_0x98ff('0x2b')](respondWithResult(_0x4eeeea,null))[_0x98ff('0x4b')](handleError(_0x4eeeea,null));};exports['removeResources']=function(_0x80d1e8,_0x2f7370,_0x4fb094){return db['UserProfile'][_0x98ff('0x4a')]({'where':{'id':_0x80d1e8['params']['id']}})['then'](handleEntityNotFound(_0x2f7370,null))[_0x98ff('0x2b')](function(_0xac0688){if(_0xac0688){return _0xac0688[_0x98ff('0x70')](_0x80d1e8['query'][_0x98ff('0x63')]);}})[_0x98ff('0x2b')](respondWithStatusCode(_0x2f7370,null))[_0x98ff('0x4b')](handleError(_0x2f7370,null));};exports[_0x98ff('0x71')]=function(_0x4931aa,_0x5b0d37){var _0x33db1d={};if(!_0x4931aa['query'][_0x98ff('0x72')])throw new Error(_0x98ff('0x73'));if(!_0x4931aa['query'][_0x98ff('0x3e')](_0x98ff('0x3f'))){_0x33db1d[_0x98ff('0x24')]=qs['limit'](_0x4931aa[_0x98ff('0x37')][_0x98ff('0x24')]);_0x33db1d['offset']=qs[_0x98ff('0x22')](_0x4931aa[_0x98ff('0x37')][_0x98ff('0x22')]);}return db[_0x98ff('0x31')][_0x98ff('0x4a')]({'where':{'id':_0x4931aa[_0x98ff('0x49')]['id']}})[_0x98ff('0x2b')](function(_0x40d35d){if(!_0x40d35d)throw new Error(_0x98ff('0x74')+_0x4931aa[_0x98ff('0x49')]['id']);return db[_0x98ff('0x31')][_0x98ff('0x71')](_0x4931aa);})[_0x98ff('0x2b')](respondWithFilteredResult(_0x5b0d37,_0x33db1d))['catch'](handleError(_0x5b0d37,null));}; \ No newline at end of file +var _0xbcae=['fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','clone','get','createdAt','crudPermissions','body','omit','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','userProfileId','Resources','UserProfileResource','destroy','describe','push','ids','getSections','findAll','includes','isEmpty','sectionId','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xbcae,0xa9));var _0xebca=function(_0x1b1efc,_0x434a8b){_0x1b1efc=_0x1b1efc-0x0;var _0x53fed4=_0xbcae[_0x1b1efc];return _0x53fed4;};'use strict';var emlformat=require(_0xebca('0x0'));var rimraf=require(_0xebca('0x1'));var zipdir=require(_0xebca('0x2'));var jsonpatch=require(_0xebca('0x3'));var rp=require(_0xebca('0x4'));var moment=require(_0xebca('0x5'));var BPromise=require(_0xebca('0x6'));var Mustache=require(_0xebca('0x7'));var util=require(_0xebca('0x8'));var path=require(_0xebca('0x9'));var sox=require('sox');var csv=require(_0xebca('0xa'));var ejs=require(_0xebca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xebca('0xc'));var squel=require(_0xebca('0xd'));var crypto=require(_0xebca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xebca('0xf'));var toCsv=require(_0xebca('0xa'));var querystring=require(_0xebca('0x10'));var Papa=require(_0xebca('0x11'));var Redis=require(_0xebca('0x12'));var authService=require(_0xebca('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xebca('0x14'))(_0xebca('0x15'));var utils=require(_0xebca('0x16'));var config=require(_0xebca('0x17'));var licenseUtil=require(_0xebca('0x18'));var db=require('../../mysqldb')['db'];config[_0xebca('0x19')]=_[_0xebca('0x1a')](config[_0xebca('0x19')],{'host':_0xebca('0x1b'),'port':0x18eb});var socket=require(_0xebca('0x1c'))(new Redis(config[_0xebca('0x19')]));require(_0xebca('0x1d'))[_0xebca('0x1e')](socket);function respondWithStatusCode(_0x4df669,_0x5481f9){_0x5481f9=_0x5481f9||0xcc;return function(_0x224f4b){if(_0x224f4b){return _0x4df669['sendStatus'](_0x5481f9);}return _0x4df669[_0xebca('0x1f')](_0x5481f9)[_0xebca('0x20')]();};}function respondWithResult(_0x438d73,_0x2ff752){_0x2ff752=_0x2ff752||0xc8;return function(_0x4c8760){if(_0x4c8760){return _0x438d73[_0xebca('0x1f')](_0x2ff752)[_0xebca('0x21')](_0x4c8760);}};}function respondWithFilteredResult(_0xa4a29f,_0x31d44b){return function(_0x500855){if(_0x500855){var _0x3ee019=typeof _0x31d44b[_0xebca('0x22')]===_0xebca('0x23')&&typeof _0x31d44b['limit']===_0xebca('0x23');var _0x93e7b9=_0x500855['count'];var _0x2c0546=_0x3ee019?0x0:_0x31d44b[_0xebca('0x22')];var _0x37b271=_0x3ee019?_0x500855[_0xebca('0x24')]:_0x31d44b[_0xebca('0x22')]+_0x31d44b[_0xebca('0x25')];var _0x186096;if(_0x37b271>=_0x93e7b9){_0x37b271=_0x93e7b9;_0x186096=0xc8;}else{_0x186096=0xce;}_0xa4a29f[_0xebca('0x1f')](_0x186096);return _0xa4a29f[_0xebca('0x26')](_0xebca('0x27'),_0x2c0546+'-'+_0x37b271+'/'+_0x93e7b9)[_0xebca('0x21')](_0x500855);}return null;};}function patchUpdates(_0x451ed3){return function(_0x46613b){try{jsonpatch[_0xebca('0x28')](_0x46613b,_0x451ed3,!![]);}catch(_0x5a4de4){return BPromise[_0xebca('0x29')](_0x5a4de4);}return _0x46613b[_0xebca('0x2a')]();};}function saveUpdates(_0x398d39,_0x534ce0){return function(_0x570fe6){if(_0x570fe6){return _0x570fe6[_0xebca('0x2b')](_0x398d39)[_0xebca('0x2c')](function(_0x555a9a){return _0x555a9a;});}return null;};}function removeEntity(_0xf340fe,_0x163478){return function(_0x38088b){if(_0x38088b){return _0x38088b['destroy']()[_0xebca('0x2c')](function(){_0xf340fe[_0xebca('0x1f')](0xcc)[_0xebca('0x20')]();});}};}function handleEntityNotFound(_0x2234af,_0x46d79c){return function(_0x1652e4){if(!_0x1652e4){_0x2234af[_0xebca('0x2d')](0x194);}return _0x1652e4;};}function handleError(_0x27fc75,_0x20fd04){_0x20fd04=_0x20fd04||0x1f4;return function(_0x98b94a){logger[_0xebca('0x2e')](_0x98b94a[_0xebca('0x2f')]);if(_0x98b94a[_0xebca('0x30')]){delete _0x98b94a[_0xebca('0x30')];}_0x27fc75[_0xebca('0x1f')](_0x20fd04)[_0xebca('0x31')](_0x98b94a);};}exports[_0xebca('0x32')]=function(_0x3aff0b,_0x14eb42){var _0x166112={},_0x217398={},_0x2a62a4={'count':0x0,'rows':[]};var _0x1aeac4=_[_0xebca('0x33')](db[_0xebca('0x34')][_0xebca('0x35')],function(_0x4a6449){return{'name':_0x4a6449[_0xebca('0x36')],'type':_0x4a6449[_0xebca('0x37')][_0xebca('0x38')]};});_0x217398['model']=_['map'](_0x1aeac4,_0xebca('0x30'));_0x217398[_0xebca('0x39')]=_[_0xebca('0x3a')](_0x3aff0b[_0xebca('0x39')]);_0x217398[_0xebca('0x3b')]=_[_0xebca('0x3c')](_0x217398[_0xebca('0x3d')],_0x217398[_0xebca('0x39')]);_0x166112[_0xebca('0x3e')]=_[_0xebca('0x3c')](_0x217398['model'],qs[_0xebca('0x3f')](_0x3aff0b[_0xebca('0x39')][_0xebca('0x3f')]));_0x166112[_0xebca('0x3e')]=_0x166112['attributes'][_0xebca('0x40')]?_0x166112[_0xebca('0x3e')]:_0x217398[_0xebca('0x3d')];if(!_0x3aff0b[_0xebca('0x39')][_0xebca('0x41')](_0xebca('0x42'))){_0x166112[_0xebca('0x25')]=qs[_0xebca('0x25')](_0x3aff0b[_0xebca('0x39')][_0xebca('0x25')]);_0x166112[_0xebca('0x22')]=qs[_0xebca('0x22')](_0x3aff0b[_0xebca('0x39')][_0xebca('0x22')]);}_0x166112[_0xebca('0x43')]=qs['sort'](_0x3aff0b[_0xebca('0x39')]['sort']);_0x166112[_0xebca('0x44')]=qs[_0xebca('0x3b')](_['pick'](_0x3aff0b[_0xebca('0x39')],_0x217398[_0xebca('0x3b')]),_0x1aeac4);if(_0x3aff0b['query'][_0xebca('0x45')]){_0x166112[_0xebca('0x44')]=_[_0xebca('0x46')](_0x166112['where'],{'$or':_[_0xebca('0x33')](_0x1aeac4,function(_0x3d8eeb){if(_0x3d8eeb[_0xebca('0x37')]!==_0xebca('0x47')){var _0x5bdc23={};_0x5bdc23[_0x3d8eeb[_0xebca('0x30')]]={'$like':'%'+_0x3aff0b[_0xebca('0x39')][_0xebca('0x45')]+'%'};return _0x5bdc23;}})});}_0x166112=_[_0xebca('0x46')]({},_0x166112,_0x3aff0b[_0xebca('0x48')]);var _0x175544={'where':_0x166112['where']};return db[_0xebca('0x34')][_0xebca('0x24')](_0x175544)[_0xebca('0x2c')](function(_0x4de99e){_0x2a62a4[_0xebca('0x24')]=_0x4de99e;if(_0x3aff0b[_0xebca('0x39')][_0xebca('0x49')]){_0x166112['include']=[{'all':!![]}];}return db[_0xebca('0x34')]['findAll'](_0x166112);})[_0xebca('0x2c')](function(_0x3a2575){_0x2a62a4[_0xebca('0x4a')]=_0x3a2575;return _0x2a62a4;})[_0xebca('0x2c')](respondWithFilteredResult(_0x14eb42,_0x166112))[_0xebca('0x4b')](handleError(_0x14eb42,null));};exports[_0xebca('0x4c')]=function(_0x41562c,_0x365e0c){var _0x1abab0={'raw':![],'where':{'id':_0x41562c[_0xebca('0x4d')]['id']}},_0x310076={};_0x310076[_0xebca('0x3d')]=_[_0xebca('0x3a')](db[_0xebca('0x34')][_0xebca('0x35')]);_0x310076['query']=_[_0xebca('0x3a')](_0x41562c[_0xebca('0x39')]);_0x310076[_0xebca('0x3b')]=_[_0xebca('0x3c')](_0x310076['model'],_0x310076['query']);_0x1abab0[_0xebca('0x3e')]=_[_0xebca('0x3c')](_0x310076['model'],qs['fields'](_0x41562c[_0xebca('0x39')][_0xebca('0x3f')]));_0x1abab0[_0xebca('0x3e')]=_0x1abab0['attributes']['length']?_0x1abab0['attributes']:_0x310076[_0xebca('0x3d')];if(_0x41562c['query'][_0xebca('0x49')]){_0x1abab0[_0xebca('0x4e')]=[{'all':!![]}];}_0x1abab0=_['merge']({},_0x1abab0,_0x41562c[_0xebca('0x48')]);return db[_0xebca('0x34')][_0xebca('0x4f')](_0x1abab0)[_0xebca('0x2c')](handleEntityNotFound(_0x365e0c,null))['then'](respondWithResult(_0x365e0c,null))[_0xebca('0x4b')](handleError(_0x365e0c,null));};exports['create']=function(_0x4497b7,_0x7aa50c){return db['UserProfile'][_0xebca('0x50')](_0x4497b7['body'],{})[_0xebca('0x2c')](respondWithResult(_0x7aa50c,0xc9))[_0xebca('0x4b')](handleError(_0x7aa50c,null));};exports[_0xebca('0x51')]=function(_0x171fc1,_0x29a479){var _0xfe4565={'where':{'id':_0x171fc1[_0xebca('0x4d')]['id']}},_0x57ec7a={};_0x57ec7a[_0xebca('0x3d')]=_[_0xebca('0x3a')](db['UserProfile'][_0xebca('0x35')]);_0xfe4565[_0xebca('0x3e')]=_[_0xebca('0x3c')](_0x57ec7a[_0xebca('0x3d')],qs['fields'](_0x171fc1['query'][_0xebca('0x3f')]));_0xfe4565['attributes']=_0xfe4565[_0xebca('0x3e')][_0xebca('0x40')]?_0xfe4565[_0xebca('0x3e')]:_0x57ec7a[_0xebca('0x3d')];if(_0x171fc1['query'][_0xebca('0x49')]){_0xfe4565[_0xebca('0x4e')]=[{'all':!![]}];}_0xfe4565=_[_0xebca('0x46')]({},_0xfe4565,_0x171fc1[_0xebca('0x48')]);return db[_0xebca('0x34')]['find'](_0xfe4565)[_0xebca('0x2c')](handleEntityNotFound(_0x29a479,null))['then'](function(_0x3a4a11){if(_0x3a4a11){var _0x34d30e=_0x3a4a11[_0xebca('0x52')]({'plain':!![]});_0x34d30e=qs['omit'](_0x34d30e,['id',_0xebca('0x53'),'updatedAt',_0xebca('0x54')]);_0x171fc1[_0xebca('0x55')]=_[_0xebca('0x56')](_0x171fc1[_0xebca('0x55')],['id','createdAt',_0xebca('0x57')]);return db[_0xebca('0x58')][_0xebca('0x59')](function(_0x31d8c2){return db[_0xebca('0x34')][_0xebca('0x50')](_[_0xebca('0x46')](_0x34d30e,_0x171fc1[_0xebca('0x55')]),{'include':_0x171fc1[_0xebca('0x39')][_0xebca('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x31d8c2})[_0xebca('0x2c')](function(_0x13a1ee){var _0x48a16a=_0x13a1ee[_0xebca('0x52')]({'plain':!![]});return db[_0xebca('0x5a')]['findAll']({'where':{'userProfileId':_0x171fc1[_0xebca('0x4d')]['id']},'raw':!![]})[_0xebca('0x2c')](function(_0x3f5566){if(_0x3f5566){return BPromise[_0xebca('0x5b')](_0x3f5566,function(_0x1a0041){return new BPromise(function(_0xf9f4be,_0xff679){if(_0x1a0041['autoAssociation']===null||_0x1a0041[_0xebca('0x5c')]===0x1)_0xf9f4be(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1a0041['id']},'raw':!![]})['then'](function(_0x2658f6){var _0x308184=_[_0xebca('0x33')](_0x2658f6,function(_0x5da519){return qs[_0xebca('0x56')](_0x5da519,['id','createdAt',_0xebca('0x57'),'sectionId']);});_0xf9f4be(_0x308184);})[_0xebca('0x4b')](function(_0x5947af){_0xff679(_0x5947af);});})[_0xebca('0x2c')](function(_0x14b9cc){var _0x5cb46e=qs[_0xebca('0x56')](_0x1a0041,['id',_0xebca('0x53'),_0xebca('0x57')]);_0x5cb46e[_0xebca('0x5d')]=_0x48a16a['id'];if(_0x14b9cc)_0x5cb46e[_0xebca('0x5e')]=_0x14b9cc;return _0x5cb46e;})['then'](function(_0x5e2517){return db[_0xebca('0x5a')][_0xebca('0x50')](_0x5e2517,{'include':[{'model':db[_0xebca('0x5f')],'as':_0xebca('0x5e')}],'raw':!![],'transaction':_0x31d8c2});});})['then'](function(){return _0x48a16a;});}});});});}})[_0xebca('0x2c')](respondWithResult(_0x29a479,0xc9))[_0xebca('0x4b')](handleError(_0x29a479,null));};exports[_0xebca('0x2b')]=function(_0x55e9b4,_0x52094e){if(_0x55e9b4['body']['id']){delete _0x55e9b4[_0xebca('0x55')]['id'];}return db[_0xebca('0x34')][_0xebca('0x4f')]({'where':{'id':_0x55e9b4['params']['id']}})[_0xebca('0x2c')](handleEntityNotFound(_0x52094e,null))[_0xebca('0x2c')](saveUpdates(_0x55e9b4[_0xebca('0x55')],null))['then'](respondWithResult(_0x52094e,null))[_0xebca('0x4b')](handleError(_0x52094e,null));};exports[_0xebca('0x60')]=function(_0x512a40,_0x23c74e){return db[_0xebca('0x34')][_0xebca('0x4f')]({'where':{'id':_0x512a40[_0xebca('0x4d')]['id']}})[_0xebca('0x2c')](handleEntityNotFound(_0x23c74e,null))[_0xebca('0x2c')](removeEntity(_0x23c74e,null))['catch'](handleError(_0x23c74e,null));};exports['describe']=function(_0xceabfc,_0x5845ec){return db[_0xebca('0x34')][_0xebca('0x61')]()['then'](respondWithResult(_0x5845ec,null))[_0xebca('0x4b')](handleError(_0x5845ec,null));};exports['addSections']=function(_0x418a33,_0x4c4d8f){var _0xd0065c=_0x418a33[_0xebca('0x55')];return db['UserProfile'][_0xebca('0x4f')]({'where':{'id':_0x418a33[_0xebca('0x4d')]['id']}})[_0xebca('0x2c')](handleEntityNotFound(_0x4c4d8f,null))[_0xebca('0x2c')](function(_0xe9ba34){if(_0xe9ba34){return db['sequelize'][_0xebca('0x59')](function(_0xe2b90e){return db['UserProfileSection'][_0xebca('0x60')]({'where':{'userProfileId':_0x418a33['params']['id'],'sectionId':_['map'](_0xd0065c,function(_0x200b0a){return _0x200b0a['sectionId'];})},'transaction':_0xe2b90e})[_0xebca('0x2c')](function(){var _0x4bb71d=_[_0xebca('0x33')](_0xd0065c,function(_0x54e318){_0x54e318[_0xebca('0x5d')]=_0x418a33[_0xebca('0x4d')]['id'];return _0x54e318;});var _0x5fdf10=[];return BPromise[_0xebca('0x5b')](_0x4bb71d,function(_0x285b22){return db[_0xebca('0x5a')][_0xebca('0x50')](_0x285b22,{'include':[{'model':db['UserProfileResource'],'as':_0xebca('0x5e')}],'raw':!![],'transaction':_0xe2b90e})[_0xebca('0x2c')](function(_0x54476c){_0x5fdf10[_0xebca('0x62')](_0x54476c['get']({'plain':!![]}));});})[_0xebca('0x2c')](function(){return _0x5fdf10;});});});}})[_0xebca('0x2c')](function(_0x390f5c){return _0x390f5c;})[_0xebca('0x2c')](respondWithResult(_0x4c4d8f,null))[_0xebca('0x4b')](handleError(_0x4c4d8f,null));};exports['removeSections']=function(_0x59facb,_0x52eb12){var _0x16b836;return db[_0xebca('0x34')]['find']({'where':{'id':_0x59facb['params']['id']},'attributes':['id',_0xebca('0x30')]})[_0xebca('0x2c')](handleEntityNotFound(_0x52eb12,null))[_0xebca('0x2c')](function(_0x2c6746){if(_0x2c6746){_0x16b836=_0x2c6746;return db[_0xebca('0x5a')]['destroy']({'where':{'userProfileId':_0x59facb[_0xebca('0x4d')]['id'],'sectionId':_0x59facb[_0xebca('0x39')][_0xebca('0x63')]}});}})[_0xebca('0x2c')](function(){return _0x16b836;})['then'](respondWithStatusCode(_0x52eb12,null))[_0xebca('0x4b')](handleError(_0x52eb12,null));};exports[_0xebca('0x64')]=function(_0x4cfa91,_0x5250cd){var _0x8d2348=[];var _0x270844=[];return db[_0xebca('0x5a')][_0xebca('0x65')]({'where':{'userProfileId':_0x4cfa91[_0xebca('0x4d')]['id']},'raw':!![]})[_0xebca('0x2c')](function(_0xf38de1){_0x8d2348=_[_0xebca('0x45')](_0xf38de1,function(_0x3e19ac){return _0x3e19ac['enabled']===0x1||_[_0xebca('0x66')]([0x3eb,0x709],_0x3e19ac['sectionId']);});if(!_[_0xebca('0x67')](_0x8d2348)){return _[_0xebca('0x33')](_0x8d2348,function(_0x4c0c7e){return _0x4c0c7e[_0xebca('0x68')];});}else{return;}})['then'](function(_0x37ffe5){if(_0x37ffe5)_0x270844=_0x37ffe5;if(_[_0xebca('0x66')](_0x270844,0x64)){var _0x1fb3c0=_[_0xebca('0x4f')](_0x8d2348,{'sectionId':0x64});return hasDefaultDashboard(_0x1fb3c0)['then'](function(_0x55729a){return _[_0xebca('0x33')](_0x8d2348,function(_0x451481){if(_0x451481['sectionId']===0x64){_0x451481[_0xebca('0x69')]=_0x55729a;}return _0x451481;});});}else{return;}})['then'](function(_0x5ca582){if(_0x5ca582)_0x8d2348=_0x5ca582;if(_[_0xebca('0x66')](_0x270844,0x3eb)){var _0x3c78ab=_['find'](_0x8d2348,{'sectionId':0x3eb});return getCustomDashboards(_0x3c78ab)[_0xebca('0x2c')](function(_0x4ec46b){return _[_0xebca('0x33')](_0x8d2348,function(_0x53db4c){if(_0x3c78ab[_0xebca('0x6a')]){if(_0x53db4c[_0xebca('0x68')]===0x3eb){_0x53db4c[_0xebca('0x69')]=_0x4ec46b;}}else{if(_0x53db4c[_0xebca('0x68')]===0x64){_0x53db4c[_0xebca('0x69')]=_0x4ec46b;}}return _0x53db4c;});});}else{return;}})[_0xebca('0x2c')](function(_0x3becda){if(_0x3becda)_0x8d2348=_0x3becda;if(_[_0xebca('0x66')](_0x270844,0x709)){var _0x2f180f=_[_0xebca('0x4f')](_0x8d2348,{'sectionId':0x709});return getPlugins(_0x2f180f)[_0xebca('0x2c')](function(_0x3b5e64){if(_0x2f180f[_0xebca('0x6a')]){return _['map'](_0x8d2348,function(_0x5811ff){if(_0x5811ff[_0xebca('0x68')]===0x709){_0x5811ff[_0xebca('0x69')]=_0x3b5e64;}return _0x5811ff;});}else{var _0x2a22c8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3b5e64};var _0x38012e=_[_0xebca('0x33')](_0x8d2348);_0x38012e[_0xebca('0x62')](_0x2a22c8);return _0x38012e;}});}else{return;}})[_0xebca('0x2c')](function(_0x218204){if(_0x218204)_0x8d2348=_0x218204;return _['filter'](_0x8d2348,['enabled',0x1]);})[_0xebca('0x2c')](respondWithResult(_0x5250cd,null))[_0xebca('0x4b')](handleError(_0x5250cd,null));};function hasDefaultDashboard(_0x13e357){var _0x5ba89a=[0x65];return new BPromise(function(_0x4c36b0,_0x50cb9c){try{if(_0x13e357[_0xebca('0x5c')]){_0x4c36b0(_0x5ba89a);}else{return db[_0xebca('0x5f')][_0xebca('0x6b')]({'where':{'sectionId':_0x13e357['id']},'raw':!![]})['then'](function(_0x2dec45){_0x2dec45?_0x4c36b0(_0x5ba89a):_0x4c36b0();});}}catch(_0x5d38c6){_0x50cb9c(_0x5d38c6);}});}function getCustomDashboards(_0x2483cf){var _0x38cfc7=[];return new BPromise(function(_0x173ee9,_0x9fca9e){try{if(_0x2483cf['autoAssociation']){return db[_0xebca('0x6c')]['findAll']({'raw':!![]})[_0xebca('0x2c')](function(_0x1601d2){_0x1601d2['forEach'](function(_0x330496){_0x38cfc7[_0xebca('0x62')](_0x330496['id']+0x1869f);});_0x173ee9(_0x38cfc7);});}else{return db[_0xebca('0x5f')][_0xebca('0x65')]({'where':{'sectionId':_0x2483cf['id']},'raw':!![]})[_0xebca('0x2c')](function(_0x6055f4){_0x6055f4[_0xebca('0x6d')](function(_0x19102d){_0x38cfc7[_0xebca('0x62')](_0x19102d[_0xebca('0x6e')]+0x1869f);});_0x173ee9(_0x38cfc7);});}}catch(_0x4bced8){_0x9fca9e(_0x4bced8);}});}function getPlugins(_0x2753d0){var _0x3a9b1a=[];return new BPromise(function(_0x473f6e,_0x22ce9f){try{if(_0x2753d0['autoAssociation']){return db['Plugin'][_0xebca('0x65')]({'raw':!![]})[_0xebca('0x2c')](function(_0x1c294d){_0x1c294d[_0xebca('0x6d')](function(_0x45bfeb){_0x3a9b1a[_0xebca('0x62')](_0x45bfeb['id']+0x15b38);});_0x473f6e(_0x3a9b1a);});}else{return db['UserProfileResource'][_0xebca('0x65')]({'where':{'sectionId':_0x2753d0['id']},'raw':!![]})['then'](function(_0x5b0a3f){_0x5b0a3f['forEach'](function(_0x50e73f){_0x3a9b1a['push'](_0x50e73f['resourceId']+0x15b38);});_0x473f6e(_0x3a9b1a);});}}catch(_0x1ff1c4){_0x22ce9f(_0x1ff1c4);}});}exports[_0xebca('0x6f')]=function(_0x13549e,_0x392548){return db['UserProfile'][_0xebca('0x4f')]({'where':{'id':_0x13549e[_0xebca('0x4d')]['id']}})['then'](handleEntityNotFound(_0x392548,null))[_0xebca('0x2c')](function(_0x233277){if(_0x233277){return db[_0xebca('0x58')][_0xebca('0x59')](function(_0x5deb12){return db[_0xebca('0x5a')][_0xebca('0x65')]({'where':{'userProfileId':_0x13549e[_0xebca('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0xebca('0x2c')](function(_0x15f219){if(_0x15f219){return db['UserProfileSection'][_0xebca('0x60')]({'where':{'userProfileId':_0x13549e[_0xebca('0x4d')]['id'],'id':_[_0xebca('0x33')](_0x15f219,function(_0x42b9f7){return _0x42b9f7['id'];})},'transaction':_0x5deb12});}})['then'](function(_0x5dbd74){var _0x4ad141=_['map'](_0x13549e[_0xebca('0x55')],function(_0x3bae4a){_0x3bae4a[_0xebca('0x5d')]=_0x13549e[_0xebca('0x4d')]['id'];return _0x3bae4a;});return db[_0xebca('0x5a')]['bulkCreate'](_0x4ad141,{'raw':!![],'transaction':_0x5deb12});})[_0xebca('0x2c')](function(_0x3562c7){var _0x4d5f9a=_[_0xebca('0x45')](_[_0xebca('0x33')](_0x3562c7,function(_0x38664b){return _0x38664b[_0xebca('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x4d5f9a){return db[_0xebca('0x5a')][_0xebca('0x65')]({'where':{'userProfileId':_0x13549e['params']['id'],'sectionId':_[_0xebca('0x33')](_0x4d5f9a,function(_0x1aa9ed){return _0x1aa9ed[_0xebca('0x68')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xebca('0x2c')](function(_0x28638f){var _0x464ca5=_['map'](_0x13549e['body'],function(_0x427773){_0x427773[_0xebca('0x5d')]=_0x13549e[_0xebca('0x4d')]['id'];return _0x427773;});return db[_0xebca('0x5f')]['bulkCreate'](_0x464ca5,{'raw':!![],'transaction':_0x5deb12});});}})[_0xebca('0x4b')](handleError(_0x392548,null));});}})[_0xebca('0x2c')](function(_0x48b536){var _0xd34351=_['map'](_0x48b536,function(_0x2af181){return _0x2af181[_0xebca('0x52')]({'plain':!![]});});})['then'](respondWithResult(_0x392548,null))[_0xebca('0x4b')](handleError(_0x392548,null));};exports[_0xebca('0x70')]=function(_0x2333f2,_0x5e14cb,_0x5dd3aa){return db[_0xebca('0x34')][_0xebca('0x4f')]({'where':{'id':_0x2333f2[_0xebca('0x4d')]['id']}})[_0xebca('0x2c')](handleEntityNotFound(_0x5e14cb,null))['then'](function(_0x14d411){if(_0x14d411){return _0x14d411[_0xebca('0x70')](_0x2333f2[_0xebca('0x39')][_0xebca('0x63')]);}})[_0xebca('0x2c')](respondWithStatusCode(_0x5e14cb,null))[_0xebca('0x4b')](handleError(_0x5e14cb,null));};exports[_0xebca('0x71')]=function(_0x211073,_0x49e5a6){var _0x44defa={};if(!_0x211073['query'][_0xebca('0x72')])throw new Error(_0xebca('0x73'));if(!_0x211073[_0xebca('0x39')][_0xebca('0x41')](_0xebca('0x42'))){_0x44defa['limit']=qs[_0xebca('0x25')](_0x211073['query'][_0xebca('0x25')]);_0x44defa[_0xebca('0x22')]=qs[_0xebca('0x22')](_0x211073[_0xebca('0x39')][_0xebca('0x22')]);}return db[_0xebca('0x34')][_0xebca('0x4f')]({'where':{'id':_0x211073[_0xebca('0x4d')]['id']}})[_0xebca('0x2c')](function(_0x354fad){if(!_0x354fad)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x211073['params']['id']);return db[_0xebca('0x34')][_0xebca('0x71')](_0x211073);})[_0xebca('0x2c')](respondWithFilteredResult(_0x49e5a6,_0x44defa))[_0xebca('0x4b')](handleError(_0x49e5a6,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9c7c480..6c99388 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 _0x8aad=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3b990a,_0x57610f){var _0x6b3a5f=function(_0x3b0a7b){while(--_0x3b0a7b){_0x3b990a['push'](_0x3b990a['shift']());}};_0x6b3a5f(++_0x57610f);}(_0x8aad,0x146));var _0xd8aa=function(_0x2b3706,_0x418b2b){_0x2b3706=_0x2b3706-0x0;var _0x494571=_0x8aad[_0x2b3706];return _0x494571;};'use strict';var EventEmitter=require(_0xd8aa('0x0'));var UserProfile=require(_0xd8aa('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd8aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd8aa('0x3'),'afterDestroy':_0xd8aa('0x4')};function emitEvent(_0x5f2e0a){return function(_0x4a4235,_0x401aef,_0x59804a){UserProfileEvents['emit'](_0x5f2e0a+':'+_0x4a4235['id'],_0x4a4235);UserProfileEvents[_0xd8aa('0x5')](_0x5f2e0a,_0x4a4235);_0x59804a(null);};}for(var e in events){if(events[_0xd8aa('0x6')](e)){var event=events[e];UserProfile[_0xd8aa('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x77a9=['hasOwnProperty','events','UserProfile','save','update','remove','emit'];(function(_0x5aeeec,_0x4286da){var _0x4fe257=function(_0x4a4f53){while(--_0x4a4f53){_0x5aeeec['push'](_0x5aeeec['shift']());}};_0x4fe257(++_0x4286da);}(_0x77a9,0x19e));var _0x977a=function(_0x13f0e1,_0xd6af){_0x13f0e1=_0x13f0e1-0x0;var _0x589f26=_0x77a9[_0x13f0e1];return _0x589f26;};'use strict';var EventEmitter=require(_0x977a('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x977a('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x977a('0x2'),'afterUpdate':_0x977a('0x3'),'afterDestroy':_0x977a('0x4')};function emitEvent(_0x368664){return function(_0x520cd7,_0x318fc8,_0xb755){UserProfileEvents[_0x977a('0x5')](_0x368664+':'+_0x520cd7['id'],_0x520cd7);UserProfileEvents[_0x977a('0x5')](_0x368664,_0x520cd7);_0xb755(null);};}for(var e in events){if(events[_0x977a('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1feaad8..f410a2f 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 _0xe05a=['admin','user','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','Schedule','Sound','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','InteractionId','ui.createdAt','from','_interactions','ui.UserId\x20=\x20?','sequelize','toString','define','UserProfile','user_profiles','query','raw','section','mergeResources','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','key','foreignKey','forEach','default','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','include','Tag','color','tag','ThroughTags','Agents','openTabs','true','dataValues','sms','fax','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','model','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareOdbc','squarerecordings','parentSections','name','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','User','agent','Telephones','membername','role','telephone','VoiceQueues','queue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','Users'];(function(_0x10644f,_0x39f5fc){var _0x3fcaa0=function(_0x261f80){while(--_0x261f80){_0x10644f['push'](_0x10644f['shift']());}};_0x3fcaa0(++_0x39f5fc);}(_0xe05a,0x128));var _0xae05=function(_0x1a940f,_0x2ae9dd){_0x1a940f=_0x1a940f-0x0;var _0xbb78ce=_0xe05a[_0x1a940f];return _0xbb78ce;};'use strict';var _=require(_0xae05('0x0'));var attributes=require(_0xae05('0x1'));var qs=require(_0xae05('0x2'));var squel=require(_0xae05('0x3'));module[_0xae05('0x4')]=function(_0x4deddf){var _0x2b6ee9=_0x4deddf[_0xae05('0x5')];function _0x1768f2(_0x2e125b,_0x3249d7){return new Promise(function(_0x5e8c7d,_0x8a8827){if(!_0x3249d7)return _0x5e8c7d(null);var _0xa04531=_0x3249d7['filter']?{[_0x3249d7[_0xae05('0x6')][_0xae05('0x7')]]:_0x3249d7['filter'][_0xae05('0x8')]}:undefined;return _0x2b6ee9[_0x2e125b][_0xae05('0x9')]({'where':_0xa04531,'raw':!![]})[_0xae05('0xa')](function(_0x254c64){_0x3249d7[_0xae05('0xb')]=_[_0xae05('0xc')](_0x254c64,'id');_0x5e8c7d(_0x3249d7);})['catch'](function(_0x3793c0){_0x8a8827(_0x3793c0);});});}function _0x55c9fa(_0x4173e5,_0x57fa09){return new Promise(function(_0xf478b1,_0x5407fc){var _0x484225=_0x4173e5[_0xae05('0x6')]?{[_0x4173e5[_0xae05('0x6')][_0xae05('0x7')]]:_0x4173e5[_0xae05('0x6')][_0xae05('0x8')]}:undefined;return _0x2b6ee9[_0x4173e5[_0xae05('0xd')]]['findAll']({'where':_0x484225,'raw':!![]})[_0xae05('0xa')](function(_0x53ec55){_0x57fa09['associatedResources']=_[_0xae05('0xc')](_0x53ec55,function(_0x4fe76f){return _0x4fe76f['name'];});_0xf478b1(_0x57fa09);})[_0xae05('0xe')](function(_0x51d6cd){_0x5407fc(_0x51d6cd);});});}function _0x4a4f1f(_0x581590,_0x57901c,_0x4c077a){if(!_0x57901c)return Promise[_0xae05('0xf')](null);return new Promise(function(_0x38878d,_0xafc70d){return _0x2b6ee9[_0xae05('0x10')][_0xae05('0x9')]({'where':{'sectionId':_0x57901c['id']},'raw':!![]})[_0xae05('0xa')](function(_0x4dc6ce){if(_0x581590[_0xae05('0x7')]&&_0x581590[_0xae05('0x7')]!=='id'){_0x57901c[_0xae05('0xb')]=_[_0xae05('0xc')](_0x4dc6ce,function(_0x54c9a9){return _0x54c9a9[_0x581590[_0xae05('0x7')]];});}else{if(_0x4c077a===_0xae05('0x11')){_0x57901c['associatedResources']=_[_0xae05('0xc')](_0x4dc6ce,function(_0xf880ba){return{'id':_0xf880ba[_0xae05('0x12')],'type':_0xf880ba[_0xae05('0x13')]};});}else{_0x57901c[_0xae05('0xb')]=_['map'](_0x4dc6ce,function(_0x338db0){return _0x338db0[_0xae05('0x12')];});}}_0x38878d(_0x57901c);})[_0xae05('0xe')](function(_0x298509){_0xafc70d(_0x298509);});});}function _0x548ebe(_0x3c797b,_0x5d8ecb){var _0x1641dc={'parentSections':[]};switch(_0x3c797b[_0xae05('0x14')]()){case _0xae05('0x15'):_0x1641dc['childModel']='SquareProject';break;case'odbc':_0x1641dc[_0xae05('0x16')]=_0xae05('0x17');break;case _0xae05('0x18'):_0x1641dc[_0xae05('0x16')]='SquareRecording';_0x1641dc[_0xae05('0x19')]=[{'name':'SquareProjects','field':_0xae05('0x1a'),'foreignKey':_0xae05('0x1b')}];break;case'projects':_0x1641dc[_0xae05('0x16')]=_0xae05('0x1c');break;case _0xae05('0x1d'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x1e');_0x1641dc['parentSections']=[{'name':_0xae05('0x1f'),'field':'id','foreignKey':_0xae05('0x20')}];break;case _0xae05('0x21'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x22');break;case _0xae05('0x23'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x24');break;case _0xae05('0x25'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x26');break;case _0xae05('0x27'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x28');break;case'chatwebsites':_0x1641dc[_0xae05('0x16')]=_0xae05('0x29');break;case'faxqueues':_0x1641dc[_0xae05('0x16')]=_0xae05('0x2a');break;case _0xae05('0x2b'):_0x1641dc[_0xae05('0x16')]='FaxAccount';break;case _0xae05('0x2c'):case _0xae05('0x2d'):case'outboundroutes':_0x1641dc[_0xae05('0x16')]=_0xae05('0x2e');break;case _0xae05('0x2f'):_0x1641dc['childModel']=_0xae05('0x30');break;case _0xae05('0x31'):_0x1641dc['childModel']=_0xae05('0x32');break;case _0xae05('0x33'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x34');_0x1641dc[_0xae05('0x19')]=[{'name':'Agents','field':_0xae05('0x1a'),'foreignKey':'membername','model':_0xae05('0x35'),'filter':{'field':'role','value':[_0xae05('0x36')]}},{'name':_0xae05('0x37'),'field':_0xae05('0x1a'),'foreignKey':_0xae05('0x38'),'model':_0xae05('0x35'),'filter':{'field':_0xae05('0x39'),'value':[_0xae05('0x3a')]}},{'name':_0xae05('0x3b'),'field':_0xae05('0x1a'),'foreignKey':_0xae05('0x3c'),'model':'VoiceQueue','filter':{'field':_0xae05('0x13'),'value':[_0xae05('0x3d')]}},{'name':_0xae05('0x3e'),'field':_0xae05('0x1a'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xae05('0x3f')]}}];break;case'musiconholds':_0x1641dc[_0xae05('0x16')]=_0xae05('0x40');break;case _0xae05('0x41'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x42');break;case _0xae05('0x43'):_0x1641dc[_0xae05('0x16')]='VoicePrefix';break;case _0xae05('0x44'):_0x1641dc[_0xae05('0x16')]='Campaign';break;case _0xae05('0x45'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x46');break;case _0xae05('0x47'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x48');break;case'mailsubstatuses':_0x1641dc['childModel']=_0xae05('0x49');break;case _0xae05('0x4a'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x4b');break;case _0xae05('0x4c'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x4d');break;case _0xae05('0x4e'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x4f');break;case _0xae05('0x50'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x51');break;case _0xae05('0x52'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x53');break;case _0xae05('0x54'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x55');break;case _0xae05('0x56'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x57');break;case _0xae05('0x58'):case _0xae05('0x59'):_0x1641dc[_0xae05('0x16')]='VoiceQueue';if(_0x5d8ecb){_0x1641dc[_0xae05('0x19')]=[{'name':_0xae05('0x3b')},{'name':_0xae05('0x3e')}];}break;case _0xae05('0x5a'):case'agents':case'telephones':_0x1641dc[_0xae05('0x16')]='User';if(_0x5d8ecb){_0x1641dc[_0xae05('0x19')]=[{'name':_0xae05('0x5b'),'filter':{'field':_0xae05('0x39'),'value':[_0xae05('0x5c'),_0xae05('0x5d')]},'ignore':!![]},{'name':'Agents'},{'name':_0xae05('0x37')}];}break;case'zendeskaccounts':_0x1641dc[_0xae05('0x16')]=_0xae05('0x5e');break;case _0xae05('0x5f'):_0x1641dc[_0xae05('0x16')]='SalesforceAccount';break;case _0xae05('0x60'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x61');break;case _0xae05('0x62'):_0x1641dc[_0xae05('0x16')]='SugarcrmAccount';break;case'deskaccounts':_0x1641dc[_0xae05('0x16')]=_0xae05('0x63');break;case _0xae05('0x64'):_0x1641dc['childModel']=_0xae05('0x65');break;case _0xae05('0x66'):_0x1641dc['childModel']='User';break;case _0xae05('0x67'):_0x1641dc['childModel']=_0xae05('0x68');break;case _0xae05('0x69'):_0x1641dc['childModel']=_0xae05('0x6a');break;case _0xae05('0x6b'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x6c');break;case _0xae05('0x6d'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x6e');break;case'pauses':_0x1641dc[_0xae05('0x16')]=_0xae05('0x6f');break;case'scheduler':_0x1641dc['childModel']=_0xae05('0x70');break;case'sounds':_0x1641dc[_0xae05('0x16')]=_0xae05('0x71');break;case'tags':_0x1641dc['childModel']='Tag';break;case'templates':_0x1641dc['childModel']=_0xae05('0x72');break;case _0xae05('0x73'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x74');break;case _0xae05('0x75'):_0x1641dc['childModel']='Trunk';break;case _0xae05('0x76'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x77');break;case _0xae05('0x78'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x79');break;case'extractedreports':_0x1641dc[_0xae05('0x16')]=_0xae05('0x11');_0x1641dc[_0xae05('0x19')]=[{'name':_0xae05('0x7a'),'field':'id','foreignKey':_0xae05('0x7b')}];break;case _0xae05('0x7c'):_0x1641dc[_0xae05('0x16')]=_0xae05('0x7d');break;}return _0x1641dc;}function _0x1d90d8(_0x4ae682,_0x57ff07){var _0x11ee75=_0x4ae682[_0xae05('0x7e')](0x0)[_0xae05('0x7f')]()+_0x4ae682[_0xae05('0x80')](0x1);var _0x414861={'type':_0x2b6ee9[_0xae05('0x81')]['QueryTypes'][_0xae05('0x82')],'raw':!![]};return new Promise(function(_0x586b4d,_0xe5ab9d){var _0x32dae2=squel[_0xae05('0x83')]()[_0xae05('0x7')]('ui.'+_0x11ee75+_0xae05('0x84'),'id')[_0xae05('0x7')](_0xae05('0x85'))[_0xae05('0x86')]('user_has_'+_0x4ae682+_0xae05('0x87'),'ui')['where'](_0xae05('0x88'),_0x57ff07['id']);return _0x2b6ee9[_0xae05('0x89')]['query'](_0x32dae2[_0xae05('0x8a')](),_0x414861)[_0xae05('0xa')](function(_0x50d59b){_0x57ff07[_0x11ee75+'OpenTabs']=_0x50d59b;_0x586b4d(_0x50d59b);})['catch'](function(_0x139c67){_0xe5ab9d(_0x139c67);});});}return _0x4deddf[_0xae05('0x8b')](_0xae05('0x8c'),attributes,{'tableName':_0xae05('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1a0831){var _0x4280de={'raw':_0x1a0831[_0xae05('0x8e')][_0xae05('0x8f')],'where':{}};var _0x1693b5={};var _0x4d065d={'count':0x0,'rows':[]};var _0x342eba=_0x1a0831['query'][_0xae05('0x90')];var _0x7374e=_0x1a0831[_0xae05('0x8e')][_0xae05('0x91')]||![];var _0x21a683=_0x548ebe(_0x342eba,_0x7374e);if(!_0x21a683[_0xae05('0x16')])throw new Error('Invalid\x20section\x20\x27'+_0x342eba+'\x27');var _0x4b29a1=[{'name':_0x342eba}];if(!_[_0xae05('0x92')](_0x21a683[_0xae05('0x19')]))_0x4b29a1=_0x21a683[_0xae05('0x19')];var _0x5d9c56=[];for(var _0x491911=0x0;_0x491911<_0x4b29a1[_0xae05('0x93')];_0x491911++){_0x5d9c56[_0xae05('0x94')](_0x2b6ee9['UserProfileSection'][_0xae05('0x95')]({'where':{'userProfileId':_0x1a0831[_0xae05('0x96')]['id'],'name':_0x4b29a1[_0x491911]['name']},'raw':!![]}));}return Promise[_0xae05('0x97')](_0x5d9c56)[_0xae05('0xa')](function(_0x2271a1){var _0x1ba6a3=_['filter'](_0x2271a1,function(_0x280227){return _0x280227?_0x280227:undefined;});var _0x5d058c=_[_0xae05('0x6')](_0x4b29a1,[_0xae05('0x98'),!![]]);var _0x3e774c=_[_0xae05('0x92')](_0x1ba6a3)&&_[_0xae05('0x92')](_0x5d058c)?null:_[_0xae05('0x99')](_0x5d058c,_0x1ba6a3);if(!_0x3e774c)return null;var _0x609345=[];for(var _0x3ac200=0x0;_0x3ac200<_0x3e774c['length'];_0x3ac200++){var _0x5a6417=_[_0xae05('0x95')](_0x4b29a1,function(_0x10afca){return _0x3e774c[_0x3ac200]?_0x10afca[_0xae05('0x1a')]===_0x3e774c[_0x3ac200][_0xae05('0x1a')]:null;});if(_0x5a6417){if(_0x3e774c[_0x3ac200][_0xae05('0x98')]){_0x609345[_0xae05('0x94')](_0x1768f2(_0x21a683[_0xae05('0x16')],_0x3e774c[_0x3ac200]));}else{if(!_0x3e774c[_0x3ac200][_0xae05('0x9a')]){_0x609345[_0xae05('0x94')](_0x4a4f1f(_0x5a6417,_0x3e774c[_0x3ac200],_0x21a683['childModel']));}else{if(_0x5a6417[_0xae05('0xd')]){_0x609345[_0xae05('0x94')](_0x55c9fa(_0x5a6417,_0x3e774c[_0x3ac200]));}}}}}return Promise['all'](_0x609345);})[_0xae05('0xa')](function(_0x5e085b){var _0x9d509f=_0x5e085b;var _0x379df9=null;if(_0x9d509f){_0x379df9=_0x9d509f[_0xae05('0x93')]===0x1?_0x9d509f[0x0]:null;}if(!_0x379df9&&!_0x9d509f)return _0x4d065d;var _0x26c020=_0x2b6ee9[_0x21a683[_0xae05('0x16')]][_0xae05('0x9b')];_0x1693b5['model']=_[_0xae05('0x9c')](_0x26c020);_0x1693b5[_0xae05('0x8e')]=_[_0xae05('0x9c')](_0x1a0831['query']);_0x1693b5[_0xae05('0x9d')]=_[_0xae05('0x9e')](_0x1693b5[_0xae05('0xd')],_0x1693b5[_0xae05('0x8e')]);_0x4280de[_0xae05('0x9f')]=_[_0xae05('0x9e')](_0x1693b5[_0xae05('0xd')],qs[_0xae05('0xa0')](_0x1a0831['query'][_0xae05('0xa0')]));_0x4280de[_0xae05('0x9f')]=_0x4280de[_0xae05('0x9f')]['length']?_0x4280de[_0xae05('0x9f')]:_0x1693b5['model'];if(!_0x1a0831[_0xae05('0x8e')][_0xae05('0xa1')](_0xae05('0xa2'))){_0x4280de['limit']=qs[_0xae05('0xa3')](_0x1a0831[_0xae05('0x8e')][_0xae05('0xa3')]);_0x4280de[_0xae05('0xa4')]=qs['offset'](_0x1a0831[_0xae05('0x8e')]['offset']);}_0x4280de[_0xae05('0xa5')]=qs[_0xae05('0xa6')](_0x1a0831['query'][_0xae05('0xa6')]);_0x4280de[_0xae05('0xa7')]=qs[_0xae05('0x9d')](_[_0xae05('0xa8')](_0x1a0831[_0xae05('0x8e')],_0x1693b5[_0xae05('0x9d')]));if(_0x1a0831[_0xae05('0x8e')][_0xae05('0x6')]){_0x4280de[_0xae05('0xa7')]=_[_0xae05('0xa9')](_0x4280de['where'],{'$or':_[_0xae05('0xc')](_0x26c020,function(_0x23117e){if(_0x23117e[_0xae05('0x13')][_0xae05('0xaa')]!=='VIRTUAL'){var _0x160866={};_0x160866[_0x23117e[_0xae05('0x7')]]={'$like':'%'+_0x1a0831[_0xae05('0x8e')]['filter']+'%'};return _0x160866;}})});}var _0x355737=[];var _0x2f8f6c=null;var _0x5ce7d1={};if(_0x379df9){_0x2f8f6c=_[_0xae05('0x95')](_0x4b29a1,['name',_0x379df9[_0xae05('0x1a')]]);if(_0x2f8f6c[_0xae05('0x7')]){_0x5ce7d1={};if(_0x21a683[_0xae05('0x16')]===_0xae05('0x11')){_0x5ce7d1[_0x2f8f6c[_0xae05('0xab')]]=_[_0xae05('0xc')](_0x379df9[_0xae05('0xb')],'id');}else{_0x5ce7d1[_0x2f8f6c[_0xae05('0xab')]]=_0x379df9[_0xae05('0xb')];}_0x355737[_0xae05('0x94')](_0x5ce7d1);}else{_0x4280de[_0xae05('0xa7')]['id']=_0x379df9['associatedResources'];}}else{for(var _0x58bb8c=0x0;_0x58bb8c<_0x9d509f['length'];_0x58bb8c++){_0x2f8f6c=_[_0xae05('0x95')](_0x4b29a1,[_0xae05('0x1a'),_0x9d509f[_0x58bb8c][_0xae05('0x1a')]]);if(_0x2f8f6c[_0xae05('0x7')]){_0x5ce7d1={};_0x5ce7d1[_0x2f8f6c[_0xae05('0xab')]]=_0x9d509f[_0x58bb8c][_0xae05('0xb')];_0x355737[_0xae05('0x94')](_0x5ce7d1);}else{if(!_0x4280de['where']['id'])_0x4280de[_0xae05('0xa7')]['id']=[];_0x9d509f[_0x58bb8c][_0xae05('0xb')][_0xae05('0xac')](function(_0xaed293){_0x4280de[_0xae05('0xa7')]['id'][_0xae05('0x94')](_0xaed293);});}}}if(!_[_0xae05('0x92')](_0x355737)){_0x4280de[_0xae05('0xa7')]=_[_0xae05('0xa9')](_0x4280de[_0xae05('0xa7')],{'$and':{'$or':_0x355737}});}_0x4280de=_['merge']({},_0x4280de,_0x1a0831['options']);if(_0x379df9&&!_0x379df9[_0xae05('0x9a')]&&_0x21a683['childModel']===_0xae05('0x11')){if(_0x1a0831['query']['includeAll']){_0x4280de['include']=[{'all':!![]}];}return _0x2b6ee9[_0x21a683['childModel']]['findAll'](_0x4280de)[_0xae05('0xa')](function(_0x1ad45b){var _0x325cb6=[];_0x1ad45b['forEach'](function(_0x57aed1){var _0x132959;switch(_0x57aed1['reportType']){case _0xae05('0xad'):_0x132959=_['find'](_0x379df9[_0xae05('0xb')],function(_0x461f1f){return _0x461f1f['id']===_0x57aed1['reportId']&&_0x461f1f[_0xae05('0x13')]===_0xae05('0xae');});break;case'custom':_0x132959=_[_0xae05('0x95')](_0x379df9[_0xae05('0xb')],function(_0xfed334){return _0xfed334['id']===_0x57aed1[_0xae05('0x7b')]&&_0xfed334[_0xae05('0x13')]===_0xae05('0xaf');});break;}if(_0x132959)_0x325cb6[_0xae05('0x94')](_0x57aed1);});_0x4d065d[_0xae05('0xb0')]=_0x325cb6['length'];_0x4d065d[_0xae05('0xb1')]=_0x325cb6;return _0x4d065d;});}else{if(!_[_0xae05('0x92')](_0x1a0831[_0xae05('0x8e')][_0xae05('0xb2')])){_0x4280de['where']['id']=_0x4280de[_0xae05('0xa7')]['id']?_['intersection'](_0x4280de[_0xae05('0xa7')]['id'],_0x1a0831['query']['ids']):_0x1a0831[_0xae05('0x8e')]['ids'];if(_0x1a0831[_0xae05('0x8e')][_0xae05('0xb3')]){_0x4280de['order']=_0x1a0831[_0xae05('0x8e')][_0xae05('0xb3')];}}if(_0x1a0831[_0xae05('0x8e')][_0xae05('0xb4')]){_0x4280de[_0xae05('0xa7')]=_[_0xae05('0xa9')](_0x4280de[_0xae05('0xa7')],{'$and':_0x1a0831[_0xae05('0x8e')][_0xae05('0xb4')]});}return _0x2b6ee9[_0x21a683[_0xae05('0x16')]][_0xae05('0xb0')]({'where':_0x4280de[_0xae05('0xa7')]})[_0xae05('0xa')](function(_0x4529f6){_0x4d065d[_0xae05('0xb0')]=_0x4529f6;if(_0x1a0831[_0xae05('0x8e')][_0xae05('0xb5')]){if(_0x21a683[_0xae05('0x16')]===_0xae05('0x1e')){_0x4280de[_0xae05('0xb6')]=[{'model':_0x2b6ee9[_0xae05('0xb7')],'as':'Tags','attributes':['id','name',_0xae05('0xb8')],'required':_0x1a0831[_0xae05('0x8e')][_0xae05('0xb9')]?!![]:![]},{'model':_0x2b6ee9[_0xae05('0xb7')],'as':_0xae05('0xba'),'attributes':['id',_0xae05('0x1a'),'color'],'through':_0x1a0831[_0xae05('0x8e')][_0xae05('0xb9')]?{'attributes':[],'where':{'TagId':_0x1a0831[_0xae05('0x8e')]['tag']||undefined}}:{},'required':_0x1a0831[_0xae05('0x8e')][_0xae05('0xb9')]?!![]:![]}];}else{_0x4280de[_0xae05('0xb6')]=[{'all':!![]}];}}return _0x2b6ee9[_0x21a683[_0xae05('0x16')]][_0xae05('0x9')](_0x4280de);})['then'](function(_0x5e40ae){_0x4d065d[_0xae05('0xb1')]=_0x5e40ae;if(_0x342eba===_0xae05('0xbb')&&_0x1a0831[_0xae05('0x8e')][_0xae05('0xbc')]===_0xae05('0xbd')){var _0x3aa7e6=[];for(var _0x19a561=0x0;_0x19a561<_0x4d065d[_0xae05('0xb1')][_0xae05('0x93')];_0x19a561++){_0x3aa7e6[_0xae05('0x94')](_0x1d90d8('chat',_0x4d065d[_0xae05('0xb1')][_0x19a561][_0xae05('0xbe')]));_0x3aa7e6['push'](_0x1d90d8(_0xae05('0xbf'),_0x4d065d[_0xae05('0xb1')][_0x19a561][_0xae05('0xbe')]));_0x3aa7e6[_0xae05('0x94')](_0x1d90d8(_0xae05('0xc0'),_0x4d065d['rows'][_0x19a561][_0xae05('0xbe')]));_0x3aa7e6['push'](_0x1d90d8('mail',_0x4d065d[_0xae05('0xb1')][_0x19a561]['dataValues']));_0x3aa7e6[_0xae05('0x94')](_0x1d90d8(_0xae05('0xc1'),_0x4d065d[_0xae05('0xb1')][_0x19a561][_0xae05('0xbe')]));_0x3aa7e6[_0xae05('0x94')](_0x1d90d8('whatsapp',_0x4d065d[_0xae05('0xb1')][_0x19a561][_0xae05('0xbe')]));}return Promise[_0xae05('0x97')](_0x3aa7e6)[_0xae05('0xa')](function(){return _0x4d065d;});}return _0x4d065d;});}});}}});}; \ No newline at end of file +var _0x92ae=['toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','type','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','sounds','Sound','tags','Tag','templates','Template','Trigger','Trunk','variables','plugins','Plugin','extractedreports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','select','ui.','user_has_','where','query','OpenTabs','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','rawAttributes','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','default','DefaultReports','reportId','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','include','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','findAll','then','associatedResources','value','model','map','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId'];(function(_0x4b8ab1,_0x563850){var _0x2abd65=function(_0x5cc08d){while(--_0x5cc08d){_0x4b8ab1['push'](_0x4b8ab1['shift']());}};_0x2abd65(++_0x563850);}(_0x92ae,0x16a));var _0xe92a=function(_0x2ef107,_0x31f797){_0x2ef107=_0x2ef107-0x0;var _0x45b2db=_0x92ae[_0x2ef107];return _0x45b2db;};'use strict';var _=require(_0xe92a('0x0'));var attributes=require(_0xe92a('0x1'));var qs=require(_0xe92a('0x2'));var squel=require('squel');module[_0xe92a('0x3')]=function(_0xc618c0){var _0x2a3800=_0xc618c0['models'];function _0x322870(_0xdbb474,_0x5c0034){return new Promise(function(_0x3a794f,_0xf31220){if(!_0x5c0034)return _0x3a794f(null);var _0x52dbb5=_0x5c0034['filter']?{[_0x5c0034[_0xe92a('0x4')][_0xe92a('0x5')]]:_0x5c0034[_0xe92a('0x4')]['value']}:undefined;return _0x2a3800[_0xdbb474][_0xe92a('0x6')]({'where':_0x52dbb5,'raw':!![]})[_0xe92a('0x7')](function(_0x9f9b4f){_0x5c0034[_0xe92a('0x8')]=_['map'](_0x9f9b4f,'id');_0x3a794f(_0x5c0034);})['catch'](function(_0x13adf4){_0xf31220(_0x13adf4);});});}function _0x101460(_0x28272e,_0x430f9a){return new Promise(function(_0x37e2ba,_0x282e04){var _0x4d542d=_0x28272e[_0xe92a('0x4')]?{[_0x28272e[_0xe92a('0x4')][_0xe92a('0x5')]]:_0x28272e[_0xe92a('0x4')][_0xe92a('0x9')]}:undefined;return _0x2a3800[_0x28272e[_0xe92a('0xa')]][_0xe92a('0x6')]({'where':_0x4d542d,'raw':!![]})[_0xe92a('0x7')](function(_0x43054f){_0x430f9a[_0xe92a('0x8')]=_[_0xe92a('0xb')](_0x43054f,function(_0x40d3f5){return _0x40d3f5[_0xe92a('0xc')];});_0x37e2ba(_0x430f9a);})[_0xe92a('0xd')](function(_0x2808ff){_0x282e04(_0x2808ff);});});}function _0x572bc7(_0x1aec5b,_0x44e1c7,_0x46f529){if(!_0x44e1c7)return Promise[_0xe92a('0xe')](null);return new Promise(function(_0xde06e5,_0x4c7c11){return _0x2a3800[_0xe92a('0xf')][_0xe92a('0x6')]({'where':{'sectionId':_0x44e1c7['id']},'raw':!![]})[_0xe92a('0x7')](function(_0x40b837){if(_0x1aec5b[_0xe92a('0x5')]&&_0x1aec5b[_0xe92a('0x5')]!=='id'){_0x44e1c7[_0xe92a('0x8')]=_[_0xe92a('0xb')](_0x40b837,function(_0x146388){return _0x146388[_0x1aec5b[_0xe92a('0x5')]];});}else{if(_0x46f529===_0xe92a('0x10')){_0x44e1c7[_0xe92a('0x8')]=_[_0xe92a('0xb')](_0x40b837,function(_0x19a0e3){return{'id':_0x19a0e3[_0xe92a('0x11')],'type':_0x19a0e3['type']};});}else{_0x44e1c7['associatedResources']=_[_0xe92a('0xb')](_0x40b837,function(_0x508876){return _0x508876[_0xe92a('0x11')];});}}_0xde06e5(_0x44e1c7);})['catch'](function(_0x1df170){_0x4c7c11(_0x1df170);});});}function _0x4c072e(_0x5946e4,_0x4764e0){var _0x309204={'parentSections':[]};switch(_0x5946e4[_0xe92a('0x12')]()){case _0xe92a('0x13'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x15');break;case'odbc':_0x309204[_0xe92a('0x14')]=_0xe92a('0x16');break;case _0xe92a('0x17'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x18');_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x1a'),'field':_0xe92a('0xc'),'foreignKey':'projectName'}];break;case _0xe92a('0x1b'):_0x309204['childModel']='JscriptyProject';break;case _0xe92a('0x1c'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x1d');_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0xe92a('0x1f'):_0x309204['childModel']=_0xe92a('0x20');break;case _0xe92a('0x21'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x22');break;case _0xe92a('0x23'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x24');break;case _0xe92a('0x25'):_0x309204['childModel']=_0xe92a('0x26');break;case'chatwebsites':_0x309204[_0xe92a('0x14')]=_0xe92a('0x27');break;case _0xe92a('0x28'):_0x309204[_0xe92a('0x14')]='FaxQueue';break;case _0xe92a('0x29'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x2a');break;case _0xe92a('0x2b'):case _0xe92a('0x2c'):case _0xe92a('0x2d'):_0x309204['childModel']=_0xe92a('0x2e');break;case _0xe92a('0x2f'):_0x309204[_0xe92a('0x14')]='VoiceContext';break;case'voicemails':_0x309204['childModel']=_0xe92a('0x30');break;case _0xe92a('0x31'):_0x309204[_0xe92a('0x14')]='VoiceRecording';_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x32'),'field':_0xe92a('0xc'),'foreignKey':_0xe92a('0x33'),'model':'User','filter':{'field':_0xe92a('0x34'),'value':[_0xe92a('0x35')]}},{'name':_0xe92a('0x36'),'field':'name','foreignKey':_0xe92a('0x33'),'model':_0xe92a('0x37'),'filter':{'field':'role','value':[_0xe92a('0x38')]}},{'name':_0xe92a('0x39'),'field':_0xe92a('0xc'),'foreignKey':_0xe92a('0x3a'),'model':'VoiceQueue','filter':{'field':_0xe92a('0x3b'),'value':[_0xe92a('0x3c')]}},{'name':_0xe92a('0x3d'),'field':_0xe92a('0xc'),'foreignKey':_0xe92a('0x3a'),'model':_0xe92a('0x3e'),'filter':{'field':'type','value':[_0xe92a('0x3f')]}}];break;case _0xe92a('0x40'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x41');break;case _0xe92a('0x42'):_0x309204['childModel']='VoiceChanSpy';break;case _0xe92a('0x43'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x44');break;case _0xe92a('0x45'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x46');break;case _0xe92a('0x47'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x48');break;case'mailaccounts':_0x309204[_0xe92a('0x14')]=_0xe92a('0x49');break;case _0xe92a('0x4a'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x4b');break;case'openchannelqueues':_0x309204[_0xe92a('0x14')]=_0xe92a('0x4c');break;case _0xe92a('0x4d'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x4e');break;case _0xe92a('0x4f'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x50');break;case _0xe92a('0x51'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x52');break;case _0xe92a('0x53'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x54');break;case _0xe92a('0x55'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x56');break;case'teams':_0x309204['childModel']=_0xe92a('0x57');break;case'voicequeues':case'queuecampaigns':_0x309204[_0xe92a('0x14')]=_0xe92a('0x3e');if(_0x4764e0){_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x39')},{'name':_0xe92a('0x3d')}];}break;case _0xe92a('0x58'):case _0xe92a('0x59'):case _0xe92a('0x5a'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x37');if(_0x4764e0){_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x5b'),'filter':{'field':_0xe92a('0x34'),'value':[_0xe92a('0x5c'),_0xe92a('0x5d')]},'ignore':!![]},{'name':_0xe92a('0x32')},{'name':_0xe92a('0x36')}];}break;case _0xe92a('0x5e'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x5f');break;case _0xe92a('0x60'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x61');break;case _0xe92a('0x62'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x63');break;case'sugarcrmaccounts':_0x309204[_0xe92a('0x14')]=_0xe92a('0x64');break;case'deskaccounts':_0x309204[_0xe92a('0x14')]=_0xe92a('0x65');break;case _0xe92a('0x66'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x67');break;case _0xe92a('0x68'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x37');break;case'cannedanswers':_0x309204[_0xe92a('0x14')]=_0xe92a('0x69');break;case _0xe92a('0x6a'):_0x309204['childModel']=_0xe92a('0x6b');break;case _0xe92a('0x6c'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x6d');break;case'intervals':_0x309204[_0xe92a('0x14')]='Interval';break;case _0xe92a('0x6e'):_0x309204['childModel']='Pause';break;case'scheduler':_0x309204[_0xe92a('0x14')]='Schedule';break;case _0xe92a('0x6f'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x70');break;case _0xe92a('0x71'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x72');break;case _0xe92a('0x73'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x74');break;case'triggers':_0x309204[_0xe92a('0x14')]=_0xe92a('0x75');break;case'trunks':_0x309204[_0xe92a('0x14')]=_0xe92a('0x76');break;case _0xe92a('0x77'):_0x309204[_0xe92a('0x14')]='Variable';break;case _0xe92a('0x78'):_0x309204['childModel']=_0xe92a('0x79');break;case _0xe92a('0x7a'):_0x309204[_0xe92a('0x14')]='AnalyticExtractedReport';_0x309204[_0xe92a('0x19')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xe92a('0x7b'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x7c');break;}return _0x309204;}function _0x52b730(_0x43519d,_0x5c2ca2){var _0x13d238=_0x43519d[_0xe92a('0x7d')](0x0)[_0xe92a('0x7e')]()+_0x43519d[_0xe92a('0x7f')](0x1);var _0x10c5a2={'type':_0x2a3800[_0xe92a('0x80')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x1b6c21,_0x262904){var _0x36a09f=squel[_0xe92a('0x81')]()[_0xe92a('0x5')](_0xe92a('0x82')+_0x13d238+'InteractionId','id')[_0xe92a('0x5')]('ui.createdAt')['from'](_0xe92a('0x83')+_0x43519d+'_interactions','ui')[_0xe92a('0x84')]('ui.UserId\x20=\x20?',_0x5c2ca2['id']);return _0x2a3800['sequelize'][_0xe92a('0x85')](_0x36a09f['toString'](),_0x10c5a2)[_0xe92a('0x7')](function(_0x1c1f12){_0x5c2ca2[_0x13d238+_0xe92a('0x86')]=_0x1c1f12;_0x1b6c21(_0x1c1f12);})['catch'](function(_0x33f5c4){_0x262904(_0x33f5c4);});});}return _0xc618c0['define']('UserProfile',attributes,{'tableName':_0xe92a('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x396d66){var _0x2d4a50={'raw':_0x396d66['query'][_0xe92a('0x88')],'where':{}};var _0x149226={};var _0x22012c={'count':0x0,'rows':[]};var _0x33a293=_0x396d66['query'][_0xe92a('0x89')];var _0x571b0c=_0x396d66[_0xe92a('0x85')][_0xe92a('0x8a')]||![];var _0x5e0014=_0x4c072e(_0x33a293,_0x571b0c);if(!_0x5e0014[_0xe92a('0x14')])throw new Error(_0xe92a('0x8b')+_0x33a293+'\x27');var _0x5610a8=[{'name':_0x33a293}];if(!_[_0xe92a('0x8c')](_0x5e0014[_0xe92a('0x19')]))_0x5610a8=_0x5e0014[_0xe92a('0x19')];var _0x3bf9c1=[];for(var _0x4a1025=0x0;_0x4a1025<_0x5610a8[_0xe92a('0x8d')];_0x4a1025++){_0x3bf9c1[_0xe92a('0x8e')](_0x2a3800[_0xe92a('0x8f')][_0xe92a('0x90')]({'where':{'userProfileId':_0x396d66[_0xe92a('0x91')]['id'],'name':_0x5610a8[_0x4a1025][_0xe92a('0xc')]},'raw':!![]}));}return Promise[_0xe92a('0x92')](_0x3bf9c1)[_0xe92a('0x7')](function(_0x1188fd){var _0x5f1c18=_[_0xe92a('0x4')](_0x1188fd,function(_0x1768e6){return _0x1768e6?_0x1768e6:undefined;});var _0x4c8c37=_[_0xe92a('0x4')](_0x5610a8,[_0xe92a('0x93'),!![]]);var _0x561613=_[_0xe92a('0x8c')](_0x5f1c18)&&_['isEmpty'](_0x4c8c37)?null:_['union'](_0x4c8c37,_0x5f1c18);if(!_0x561613)return null;var _0x5bd1f9=[];for(var _0x2182cc=0x0;_0x2182cc<_0x561613[_0xe92a('0x8d')];_0x2182cc++){var _0x49b368=_[_0xe92a('0x90')](_0x5610a8,function(_0x59c392){return _0x561613[_0x2182cc]?_0x59c392[_0xe92a('0xc')]===_0x561613[_0x2182cc][_0xe92a('0xc')]:null;});if(_0x49b368){if(_0x561613[_0x2182cc][_0xe92a('0x93')]){_0x5bd1f9[_0xe92a('0x8e')](_0x322870(_0x5e0014[_0xe92a('0x14')],_0x561613[_0x2182cc]));}else{if(!_0x561613[_0x2182cc][_0xe92a('0x94')]){_0x5bd1f9[_0xe92a('0x8e')](_0x572bc7(_0x49b368,_0x561613[_0x2182cc],_0x5e0014[_0xe92a('0x14')]));}else{if(_0x49b368['model']){_0x5bd1f9[_0xe92a('0x8e')](_0x101460(_0x49b368,_0x561613[_0x2182cc]));}}}}}return Promise['all'](_0x5bd1f9);})[_0xe92a('0x7')](function(_0x308a8f){var _0x48ba65=_0x308a8f;var _0x5a9e45=null;if(_0x48ba65){_0x5a9e45=_0x48ba65[_0xe92a('0x8d')]===0x1?_0x48ba65[0x0]:null;}if(!_0x5a9e45&&!_0x48ba65)return _0x22012c;var _0x1bab3a=_0x2a3800[_0x5e0014['childModel']][_0xe92a('0x95')];_0x149226[_0xe92a('0xa')]=_['keys'](_0x1bab3a);_0x149226[_0xe92a('0x85')]=_['keys'](_0x396d66[_0xe92a('0x85')]);_0x149226['filters']=_[_0xe92a('0x96')](_0x149226[_0xe92a('0xa')],_0x149226[_0xe92a('0x85')]);_0x2d4a50[_0xe92a('0x97')]=_[_0xe92a('0x96')](_0x149226[_0xe92a('0xa')],qs['fields'](_0x396d66['query'][_0xe92a('0x98')]));_0x2d4a50[_0xe92a('0x97')]=_0x2d4a50['attributes'][_0xe92a('0x8d')]?_0x2d4a50[_0xe92a('0x97')]:_0x149226[_0xe92a('0xa')];if(!_0x396d66[_0xe92a('0x85')][_0xe92a('0x99')](_0xe92a('0x9a'))){_0x2d4a50['limit']=qs[_0xe92a('0x9b')](_0x396d66[_0xe92a('0x85')]['limit']);_0x2d4a50[_0xe92a('0x9c')]=qs[_0xe92a('0x9c')](_0x396d66[_0xe92a('0x85')][_0xe92a('0x9c')]);}_0x2d4a50['order']=qs[_0xe92a('0x9d')](_0x396d66[_0xe92a('0x85')][_0xe92a('0x9d')]);_0x2d4a50[_0xe92a('0x84')]=qs[_0xe92a('0x9e')](_[_0xe92a('0x9f')](_0x396d66[_0xe92a('0x85')],_0x149226[_0xe92a('0x9e')]));if(_0x396d66[_0xe92a('0x85')][_0xe92a('0x4')]){_0x2d4a50[_0xe92a('0x84')]=_[_0xe92a('0xa0')](_0x2d4a50[_0xe92a('0x84')],{'$or':_['map'](_0x1bab3a,function(_0x1c9e80){if(_0x1c9e80['type'][_0xe92a('0xa1')]!==_0xe92a('0xa2')){var _0xd3792b={};_0xd3792b[_0x1c9e80[_0xe92a('0x5')]]={'$like':'%'+_0x396d66[_0xe92a('0x85')][_0xe92a('0x4')]+'%'};return _0xd3792b;}})});}var _0x36c355=[];var _0x360c21=null;var _0x1b0632={};if(_0x5a9e45){_0x360c21=_[_0xe92a('0x90')](_0x5610a8,[_0xe92a('0xc'),_0x5a9e45[_0xe92a('0xc')]]);if(_0x360c21[_0xe92a('0x5')]){_0x1b0632={};if(_0x5e0014['childModel']===_0xe92a('0x10')){_0x1b0632[_0x360c21['foreignKey']]=_[_0xe92a('0xb')](_0x5a9e45['associatedResources'],'id');}else{_0x1b0632[_0x360c21[_0xe92a('0xa3')]]=_0x5a9e45[_0xe92a('0x8')];}_0x36c355['push'](_0x1b0632);}else{_0x2d4a50[_0xe92a('0x84')]['id']=_0x5a9e45[_0xe92a('0x8')];}}else{for(var _0x1d6cee=0x0;_0x1d6cee<_0x48ba65[_0xe92a('0x8d')];_0x1d6cee++){_0x360c21=_['find'](_0x5610a8,[_0xe92a('0xc'),_0x48ba65[_0x1d6cee][_0xe92a('0xc')]]);if(_0x360c21['field']){_0x1b0632={};_0x1b0632[_0x360c21['foreignKey']]=_0x48ba65[_0x1d6cee]['associatedResources'];_0x36c355['push'](_0x1b0632);}else{if(!_0x2d4a50[_0xe92a('0x84')]['id'])_0x2d4a50[_0xe92a('0x84')]['id']=[];_0x48ba65[_0x1d6cee]['associatedResources'][_0xe92a('0xa4')](function(_0x2995a5){_0x2d4a50[_0xe92a('0x84')]['id'][_0xe92a('0x8e')](_0x2995a5);});}}}if(!_[_0xe92a('0x8c')](_0x36c355)){_0x2d4a50['where']=_[_0xe92a('0xa0')](_0x2d4a50[_0xe92a('0x84')],{'$and':{'$or':_0x36c355}});}_0x2d4a50=_['merge']({},_0x2d4a50,_0x396d66[_0xe92a('0xa5')]);if(_0x5a9e45&&!_0x5a9e45[_0xe92a('0x94')]&&_0x5e0014[_0xe92a('0x14')]===_0xe92a('0x10')){if(_0x396d66['query'][_0xe92a('0xa6')]){_0x2d4a50['include']=[{'all':!![]}];}return _0x2a3800[_0x5e0014['childModel']]['findAll'](_0x2d4a50)[_0xe92a('0x7')](function(_0x2c09bd){var _0x300506=[];_0x2c09bd[_0xe92a('0xa4')](function(_0x34ed33){var _0x5c6fc6;switch(_0x34ed33[_0xe92a('0xa7')]){case _0xe92a('0xa8'):_0x5c6fc6=_[_0xe92a('0x90')](_0x5a9e45[_0xe92a('0x8')],function(_0x7993d2){return _0x7993d2['id']===_0x34ed33['reportId']&&_0x7993d2[_0xe92a('0x3b')]===_0xe92a('0xa9');});break;case'custom':_0x5c6fc6=_[_0xe92a('0x90')](_0x5a9e45[_0xe92a('0x8')],function(_0x4eb725){return _0x4eb725['id']===_0x34ed33[_0xe92a('0xaa')]&&_0x4eb725[_0xe92a('0x3b')]===_0xe92a('0xab');});break;}if(_0x5c6fc6)_0x300506[_0xe92a('0x8e')](_0x34ed33);});_0x22012c[_0xe92a('0xac')]=_0x300506[_0xe92a('0x8d')];_0x22012c[_0xe92a('0xad')]=_0x300506;return _0x22012c;});}else{if(!_[_0xe92a('0x8c')](_0x396d66['query']['ids'])){_0x2d4a50[_0xe92a('0x84')]['id']=_0x2d4a50[_0xe92a('0x84')]['id']?_[_0xe92a('0x96')](_0x2d4a50[_0xe92a('0x84')]['id'],_0x396d66[_0xe92a('0x85')][_0xe92a('0xae')]):_0x396d66[_0xe92a('0x85')]['ids'];if(_0x396d66[_0xe92a('0x85')][_0xe92a('0xaf')]){_0x2d4a50[_0xe92a('0xb0')]=_0x396d66[_0xe92a('0x85')][_0xe92a('0xaf')];}}if(_0x396d66['query'][_0xe92a('0xb1')]){_0x2d4a50[_0xe92a('0x84')]=_['merge'](_0x2d4a50[_0xe92a('0x84')],{'$and':_0x396d66['query'][_0xe92a('0xb1')]});}return _0x2a3800[_0x5e0014[_0xe92a('0x14')]][_0xe92a('0xac')]({'where':_0x2d4a50[_0xe92a('0x84')]})[_0xe92a('0x7')](function(_0x4a6ef5){_0x22012c['count']=_0x4a6ef5;if(_0x396d66['query'][_0xe92a('0xa6')]){if(_0x5e0014['childModel']===_0xe92a('0x1d')){_0x2d4a50[_0xe92a('0xb2')]=[{'model':_0x2a3800['Tag'],'as':'Tags','attributes':['id','name',_0xe92a('0xb3')],'required':_0x396d66[_0xe92a('0x85')][_0xe92a('0xb4')]?!![]:![]},{'model':_0x2a3800[_0xe92a('0x72')],'as':_0xe92a('0xb5'),'attributes':['id','name',_0xe92a('0xb3')],'through':_0x396d66[_0xe92a('0x85')][_0xe92a('0xb4')]?{'attributes':[],'where':{'TagId':_0x396d66[_0xe92a('0x85')][_0xe92a('0xb4')]||undefined}}:{},'required':_0x396d66['query']['tag']?!![]:![]}];}else{_0x2d4a50[_0xe92a('0xb2')]=[{'all':!![]}];}}return _0x2a3800[_0x5e0014[_0xe92a('0x14')]]['findAll'](_0x2d4a50);})[_0xe92a('0x7')](function(_0x3b25ac){_0x22012c['rows']=_0x3b25ac;if(_0x33a293==='Agents'&&_0x396d66[_0xe92a('0x85')][_0xe92a('0xb6')]===_0xe92a('0xb7')){var _0x519883=[];for(var _0x515879=0x0;_0x515879<_0x22012c[_0xe92a('0xad')][_0xe92a('0x8d')];_0x515879++){_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xb8'),_0x22012c['rows'][_0x515879][_0xe92a('0xb9')]));_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xba'),_0x22012c['rows'][_0x515879][_0xe92a('0xb9')]));_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xbb'),_0x22012c[_0xe92a('0xad')][_0x515879][_0xe92a('0xb9')]));_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xbc'),_0x22012c['rows'][_0x515879][_0xe92a('0xb9')]));_0x519883['push'](_0x52b730('openchannel',_0x22012c['rows'][_0x515879][_0xe92a('0xb9')]));_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xbd'),_0x22012c[_0xe92a('0xad')][_0x515879]['dataValues']));}return Promise[_0xe92a('0x92')](_0x519883)[_0xe92a('0x7')](function(){return _0x22012c;});}return _0x22012c;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 8fa39f1..677bb87 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 _0x002d=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x002d,0xca));var _0xd002=function(_0x253dcf,_0x5e12e5){_0x253dcf=_0x253dcf-0x0;var _0x231701=_0x002d[_0x253dcf];return _0x231701;};'use strict';var _=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var moment=require(_0xd002('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd002('0x3'));var db=require(_0xd002('0x4'))['db'];var utils=require(_0xd002('0x5'));var logger=require(_0xd002('0x6'))(_0xd002('0x7'));var config=require(_0xd002('0x8'));var jayson=require(_0xd002('0x9'));var client=jayson[_0xd002('0xa')][_0xd002('0xb')]({'port':0x232a});config[_0xd002('0xc')]=_[_0xd002('0xd')](config[_0xd002('0xc')],{'host':_0xd002('0xe'),'port':0x18eb});var socket=require(_0xd002('0xf'))(new Redis(config[_0xd002('0xc')]));require(_0xd002('0x10'))[_0xd002('0x11')](socket);function respondWithRpcPromise(_0x4a6621,_0x55d14a,_0x269cfe){return new BPromise(function(_0x3e283b,_0x2be09b){return client['request'](_0x4a6621,_0x269cfe)[_0xd002('0x12')](function(_0x12dad3){logger[_0xd002('0x13')](_0xd002('0x14'),_0x55d14a,_0xd002('0x15'));logger[_0xd002('0x16')](_0xd002('0x17'),_0x55d14a,_0xd002('0x15'),JSON[_0xd002('0x18')](_0x12dad3));if(_0x12dad3[_0xd002('0x19')]){if(_0x12dad3[_0xd002('0x19')][_0xd002('0x1a')]===0x1f4){logger[_0xd002('0x19')](_0xd002('0x14'),_0x55d14a,_0x12dad3['error']['message']);return _0x2be09b(_0x12dad3['error'][_0xd002('0x1b')]);}logger['error'](_0xd002('0x14'),_0x55d14a,_0x12dad3[_0xd002('0x19')][_0xd002('0x1b')]);return _0x3e283b(_0x12dad3[_0xd002('0x19')][_0xd002('0x1b')]);}else{logger[_0xd002('0x13')](_0xd002('0x14'),_0x55d14a,'request\x20sent');_0x3e283b(_0x12dad3[_0xd002('0x1c')][_0xd002('0x1b')]);}})[_0xd002('0x1d')](function(_0x3b1725){logger[_0xd002('0x19')]('UserProfile,\x20%s,\x20%s',_0x55d14a,_0x3b1725);_0x2be09b(_0x3b1725);});});} \ No newline at end of file +var _0x176c=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird'];(function(_0xc9cbe4,_0x33416e){var _0x3ade3e=function(_0x269378){while(--_0x269378){_0xc9cbe4['push'](_0xc9cbe4['shift']());}};_0x3ade3e(++_0x33416e);}(_0x176c,0x134));var _0xc176=function(_0x51bc7f,_0x4410b7){_0x51bc7f=_0x51bc7f-0x0;var _0x38e034=_0x176c[_0x51bc7f];return _0x38e034;};'use strict';var _=require(_0xc176('0x0'));var util=require(_0xc176('0x1'));var moment=require(_0xc176('0x2'));var BPromise=require(_0xc176('0x3'));var rs=require(_0xc176('0x4'));var fs=require('fs');var Redis=require(_0xc176('0x5'));var db=require(_0xc176('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc176('0x7'))(_0xc176('0x8'));var config=require('../../config/environment');var jayson=require(_0xc176('0x9'));var client=jayson[_0xc176('0xa')][_0xc176('0xb')]({'port':0x232a});config['redis']=_[_0xc176('0xc')](config[_0xc176('0xd')],{'host':_0xc176('0xe'),'port':0x18eb});var socket=require(_0xc176('0xf'))(new Redis(config[_0xc176('0xd')]));require('./userProfile.socket')[_0xc176('0x10')](socket);function respondWithRpcPromise(_0x1486c9,_0x2f95eb,_0x48186c){return new BPromise(function(_0x3e7997,_0x208607){return client[_0xc176('0x11')](_0x1486c9,_0x48186c)[_0xc176('0x12')](function(_0x420bf8){logger[_0xc176('0x13')](_0xc176('0x14'),_0x2f95eb,_0xc176('0x15'));logger['debug'](_0xc176('0x16'),_0x2f95eb,_0xc176('0x15'),JSON[_0xc176('0x17')](_0x420bf8));if(_0x420bf8[_0xc176('0x18')]){if(_0x420bf8[_0xc176('0x18')]['code']===0x1f4){logger[_0xc176('0x18')](_0xc176('0x14'),_0x2f95eb,_0x420bf8[_0xc176('0x18')]['message']);return _0x208607(_0x420bf8[_0xc176('0x18')]['message']);}logger[_0xc176('0x18')](_0xc176('0x14'),_0x2f95eb,_0x420bf8['error'][_0xc176('0x19')]);return _0x3e7997(_0x420bf8[_0xc176('0x18')][_0xc176('0x19')]);}else{logger[_0xc176('0x13')](_0xc176('0x14'),_0x2f95eb,_0xc176('0x15'));_0x3e7997(_0x420bf8['result'][_0xc176('0x19')]);}})['catch'](function(_0x20228b){logger[_0xc176('0x18')](_0xc176('0x14'),_0x2f95eb,_0x20228b);_0x208607(_0x20228b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 27ea5ff..e937e1a 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 _0x6b1e=['save','update','register','length','userProfile:','./userProfile.events'];(function(_0x541095,_0x582b30){var _0x5a2c40=function(_0xb7650f){while(--_0xb7650f){_0x541095['push'](_0x541095['shift']());}};_0x5a2c40(++_0x582b30);}(_0x6b1e,0x167));var _0xe6b1=function(_0xe255e6,_0x29b41f){_0xe255e6=_0xe255e6-0x0;var _0x24e584=_0x6b1e[_0xe255e6];return _0x24e584;};'use strict';var UserProfileEvents=require(_0xe6b1('0x0'));var events=[_0xe6b1('0x1'),'remove',_0xe6b1('0x2')];function createListener(_0x34ce58,_0x536b0f){return function(_0xa46350){_0x536b0f['emit'](_0x34ce58,_0xa46350);};}function removeListener(_0x53baa6,_0x444eb0){return function(){UserProfileEvents['removeListener'](_0x53baa6,_0x444eb0);};}exports[_0xe6b1('0x3')]=function(_0x499d52){for(var _0x48fde7=0x0,_0x5c9467=events[_0xe6b1('0x4')];_0x48fde7<_0x5c9467;_0x48fde7++){var _0x38ac30=events[_0x48fde7];var _0x424c7f=createListener(_0xe6b1('0x5')+_0x38ac30,_0x499d52);UserProfileEvents['on'](_0x38ac30,_0x424c7f);}}; \ No newline at end of file +var _0x91a6=['remove','update','removeListener','register','userProfile:','./userProfile.events'];(function(_0xf5bbc2,_0x49e6c5){var _0x3d9a7b=function(_0x2c5e32){while(--_0x2c5e32){_0xf5bbc2['push'](_0xf5bbc2['shift']());}};_0x3d9a7b(++_0x49e6c5);}(_0x91a6,0x137));var _0x691a=function(_0x442023,_0x3230a0){_0x442023=_0x442023-0x0;var _0x2ed554=_0x91a6[_0x442023];return _0x2ed554;};'use strict';var UserProfileEvents=require(_0x691a('0x0'));var events=['save',_0x691a('0x1'),_0x691a('0x2')];function createListener(_0x2a924d,_0x586ebb){return function(_0x3f51a8){_0x586ebb['emit'](_0x2a924d,_0x3f51a8);};}function removeListener(_0x576bfe,_0x54f666){return function(){UserProfileEvents[_0x691a('0x3')](_0x576bfe,_0x54f666);};}exports[_0x691a('0x4')]=function(_0x18b039){for(var _0x58e8b9=0x0,_0x1535e2=events['length'];_0x58e8b9<_0x1535e2;_0x58e8b9++){var _0x3fc4e6=events[_0x58e8b9];var _0x46fec1=createListener(_0x691a('0x5')+_0x3fc4e6,_0x18b039);UserProfileEvents['on'](_0x3fc4e6,_0x46fec1);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 1395cd6..dfc163e 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 _0x7a07=['get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller'];(function(_0x4c59c0,_0x5a34be){var _0x5bc19c=function(_0x4a8dd7){while(--_0x4a8dd7){_0x4c59c0['push'](_0x4c59c0['shift']());}};_0x5bc19c(++_0x5a34be);}(_0x7a07,0x16d));var _0x77a0=function(_0x357ef2,_0x515f16){_0x357ef2=_0x357ef2-0x0;var _0x285585=_0x7a07[_0x357ef2];return _0x285585;};'use strict';var multer=require(_0x77a0('0x0'));var util=require(_0x77a0('0x1'));var path=require(_0x77a0('0x2'));var timeout=require(_0x77a0('0x3'));var express=require(_0x77a0('0x4'));var router=express['Router']();var fs_extra=require(_0x77a0('0x5'));var auth=require(_0x77a0('0x6'));var interaction=require(_0x77a0('0x7'));var config=require('../../config/environment');var controller=require(_0x77a0('0x8'));router[_0x77a0('0x9')]('/',auth['isAuthenticated'](),controller[_0x77a0('0xa')]);router[_0x77a0('0x9')](_0x77a0('0xb'),auth[_0x77a0('0xc')](),controller[_0x77a0('0xd')]);router[_0x77a0('0x9')](_0x77a0('0xe'),auth[_0x77a0('0xc')](),controller[_0x77a0('0xf')]);router[_0x77a0('0x10')]('/',auth[_0x77a0('0xc')](),controller['create']);router[_0x77a0('0x11')](_0x77a0('0xe'),auth['isAuthenticated'](),controller[_0x77a0('0x12')]);router[_0x77a0('0x13')]('/:id',auth[_0x77a0('0xc')](),controller[_0x77a0('0x14')]);module[_0x77a0('0x15')]=router; \ No newline at end of file +var _0x93b5=['fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','express','Router'];(function(_0x43cb87,_0x432cb3){var _0x9258ac=function(_0xe4f10c){while(--_0xe4f10c){_0x43cb87['push'](_0x43cb87['shift']());}};_0x9258ac(++_0x432cb3);}(_0x93b5,0x178));var _0x593b=function(_0x28d94c,_0xf00efc){_0x28d94c=_0x28d94c-0x0;var _0x28a247=_0x93b5[_0x28d94c];return _0x28a247;};'use strict';var multer=require(_0x593b('0x0'));var util=require(_0x593b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x593b('0x2'));var router=express[_0x593b('0x3')]();var fs_extra=require(_0x593b('0x4'));var auth=require(_0x593b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x593b('0x6'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0x593b('0x7')](),controller[_0x593b('0x8')]);router[_0x593b('0x9')](_0x593b('0xa'),auth[_0x593b('0x7')](),controller['describe']);router['get'](_0x593b('0xb'),auth['isAuthenticated'](),controller[_0x593b('0xc')]);router[_0x593b('0xd')]('/',auth[_0x593b('0x7')](),controller[_0x593b('0xe')]);router[_0x593b('0xf')]('/:id',auth[_0x593b('0x7')](),controller['update']);router[_0x593b('0x10')](_0x593b('0xb'),auth['isAuthenticated'](),controller[_0x593b('0x11')]);module[_0x593b('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8fef021..7c3c910 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 _0xe878=['INTEGER','exports','STRING'];(function(_0x5b1042,_0x21f757){var _0x28485d=function(_0xecfefd){while(--_0xecfefd){_0x5b1042['push'](_0x5b1042['shift']());}};_0x28485d(++_0x21f757);}(_0xe878,0x1c6));var _0x8e87=function(_0x24a737,_0x3ff299){_0x24a737=_0x24a737-0x0;var _0x37b618=_0xe878[_0x24a737];return _0x37b618;};'use strict';var Sequelize=require('sequelize');module[_0x8e87('0x0')]={'name':{'type':Sequelize[_0x8e87('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8e87('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8e87('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4da2=['sequelize','exports','STRING','INTEGER'];(function(_0x3cd9e4,_0x5d8877){var _0x577565=function(_0x214155){while(--_0x214155){_0x3cd9e4['push'](_0x3cd9e4['shift']());}};_0x577565(++_0x5d8877);}(_0x4da2,0x110));var _0x24da=function(_0x1304a2,_0x55068a){_0x1304a2=_0x1304a2-0x0;var _0x1ec731=_0x4da2[_0x1304a2];return _0x1ec731;};'use strict';var Sequelize=require(_0x24da('0x0'));module[_0x24da('0x1')]={'name':{'type':Sequelize[_0x24da('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x24da('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x24da('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 17e28bf..9f20435 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0x6343,0x168));var _0x3634=function(_0x53f7c1,_0x41f3e4){_0x53f7c1=_0x53f7c1-0x0;var _0x44bac9=_0x6343[_0x53f7c1];return _0x44bac9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file +var _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','UserProfileResource','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x8abfd8,_0x3d1f70){var _0x290976=function(_0x5e34c4){while(--_0x5e34c4){_0x8abfd8['push'](_0x8abfd8['shift']());}};_0x290976(++_0x3d1f70);}(_0x7096,0x10c));var _0x6709=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7096[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['UserProfileResource'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['UserProfileResource'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['UserProfileResource']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['UserProfileResource'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 88cfdd3..74a033a 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 _0x8248=['rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','moment','bluebird','path'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x8248,0x1e5));var _0x8824=function(_0x5f31f6,_0x83e4f3){_0x5f31f6=_0x5f31f6-0x0;var _0x5acc4b=_0x8248[_0x5f31f6];return _0x5acc4b;};'use strict';var _=require('lodash');var util=require(_0x8824('0x0'));var logger=require(_0x8824('0x1'))('api');var moment=require(_0x8824('0x2'));var BPromise=require(_0x8824('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8824('0x4'));var rimraf=require(_0x8824('0x5'));var config=require(_0x8824('0x6'));var attributes=require(_0x8824('0x7'));module[_0x8824('0x8')]=function(_0x547473,_0x32f573){return _0x547473['define'](_0x8824('0x9'),attributes,{'tableName':_0x8824('0xa'),'paranoid':![],'indexes':[{'name':_0x8824('0xb'),'fields':[_0x8824('0xc'),_0x8824('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa18c=['user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','moment','bluebird','request-promise','rimraf','./userProfileResource.attributes'];(function(_0x4f64b9,_0x4d0e57){var _0x1cf549=function(_0x45c1ea){while(--_0x45c1ea){_0x4f64b9['push'](_0x4f64b9['shift']());}};_0x1cf549(++_0x4d0e57);}(_0xa18c,0x1f3));var _0xca18=function(_0x4d3a31,_0x18c868){_0x4d3a31=_0x4d3a31-0x0;var _0x665019=_0xa18c[_0x4d3a31];return _0x665019;};'use strict';var _=require('lodash');var util=require(_0xca18('0x0'));var logger=require(_0xca18('0x1'))('api');var moment=require(_0xca18('0x2'));var BPromise=require(_0xca18('0x3'));var rp=require(_0xca18('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca18('0x5'));var config=require('../../config/environment');var attributes=require(_0xca18('0x6'));module['exports']=function(_0x316f66,_0x2ab201){return _0x316f66['define']('UserProfileResource',attributes,{'tableName':_0xca18('0x7'),'paranoid':![],'indexes':[{'name':_0xca18('0x8'),'fields':[_0xca18('0x9'),_0xca18('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b528151..8f7cbe1 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 _0x5cb0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x1d2c2e,_0x34a46b){var _0x19c339=function(_0x52ef8b){while(--_0x52ef8b){_0x1d2c2e['push'](_0x1d2c2e['shift']());}};_0x19c339(++_0x34a46b);}(_0x5cb0,0xb6));var _0x05cb=function(_0x52c759,_0x5ae52b){_0x52c759=_0x52c759-0x0;var _0x296cf9=_0x5cb0[_0x52c759];return _0x296cf9;};'use strict';var _=require(_0x05cb('0x0'));var util=require(_0x05cb('0x1'));var moment=require('moment');var BPromise=require(_0x05cb('0x2'));var rs=require(_0x05cb('0x3'));var fs=require('fs');var Redis=require(_0x05cb('0x4'));var db=require(_0x05cb('0x5'))['db'];var utils=require(_0x05cb('0x6'));var logger=require('../../config/logger')(_0x05cb('0x7'));var config=require(_0x05cb('0x8'));var jayson=require(_0x05cb('0x9'));var client=jayson['client'][_0x05cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f18fe,_0x473197,_0xaf9410){return new BPromise(function(_0x56f986,_0x439241){return client[_0x05cb('0xb')](_0x3f18fe,_0xaf9410)[_0x05cb('0xc')](function(_0x60ce73){logger[_0x05cb('0xd')](_0x05cb('0xe'),_0x473197,_0x05cb('0xf'));logger[_0x05cb('0x10')](_0x05cb('0x11'),_0x473197,_0x05cb('0xf'),JSON['stringify'](_0x60ce73));if(_0x60ce73[_0x05cb('0x12')]){if(_0x60ce73[_0x05cb('0x12')][_0x05cb('0x13')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x473197,_0x60ce73[_0x05cb('0x12')]['message']);return _0x439241(_0x60ce73[_0x05cb('0x12')][_0x05cb('0x14')]);}logger[_0x05cb('0x12')](_0x05cb('0xe'),_0x473197,_0x60ce73[_0x05cb('0x12')][_0x05cb('0x14')]);return _0x56f986(_0x60ce73[_0x05cb('0x12')][_0x05cb('0x14')]);}else{logger[_0x05cb('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x473197,_0x05cb('0xf'));_0x56f986(_0x60ce73[_0x05cb('0x15')][_0x05cb('0x14')]);}})[_0x05cb('0x16')](function(_0x369ddc){logger[_0x05cb('0x12')](_0x05cb('0xe'),_0x473197,_0x369ddc);_0x439241(_0x369ddc);});});} \ No newline at end of file +var _0x0335=['request\x20sent','stringify','error','code','message','catch','lodash','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x4515dd,_0x436dad){var _0x3d49b5=function(_0x19fe92){while(--_0x19fe92){_0x4515dd['push'](_0x4515dd['shift']());}};_0x3d49b5(++_0x436dad);}(_0x0335,0x1c8));var _0x5033=function(_0x52193c,_0x16ab99){_0x52193c=_0x52193c-0x0;var _0x293ef1=_0x0335[_0x52193c];return _0x293ef1;};'use strict';var _=require(_0x5033('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5033('0x1'));var logger=require('../../config/logger')(_0x5033('0x2'));var config=require(_0x5033('0x3'));var jayson=require(_0x5033('0x4'));var client=jayson[_0x5033('0x5')][_0x5033('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5d09ac,_0x4e8e3c,_0x521409){return new BPromise(function(_0x595bcd,_0x4654fb){return client[_0x5033('0x7')](_0x5d09ac,_0x521409)['then'](function(_0x9cffa5){logger[_0x5033('0x8')](_0x5033('0x9'),_0x4e8e3c,'request\x20sent');logger[_0x5033('0xa')](_0x5033('0xb'),_0x4e8e3c,_0x5033('0xc'),JSON[_0x5033('0xd')](_0x9cffa5));if(_0x9cffa5['error']){if(_0x9cffa5[_0x5033('0xe')][_0x5033('0xf')]===0x1f4){logger[_0x5033('0xe')](_0x5033('0x9'),_0x4e8e3c,_0x9cffa5[_0x5033('0xe')][_0x5033('0x10')]);return _0x4654fb(_0x9cffa5[_0x5033('0xe')][_0x5033('0x10')]);}logger[_0x5033('0xe')](_0x5033('0x9'),_0x4e8e3c,_0x9cffa5[_0x5033('0xe')][_0x5033('0x10')]);return _0x595bcd(_0x9cffa5[_0x5033('0xe')][_0x5033('0x10')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x4e8e3c,_0x5033('0xc'));_0x595bcd(_0x9cffa5['result'][_0x5033('0x10')]);}})[_0x5033('0x11')](function(_0xa75f58){logger[_0x5033('0xe')](_0x5033('0x9'),_0x4e8e3c,_0xa75f58);_0x4654fb(_0xa75f58);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 5e87751..50e342c 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 _0x7338=['put','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','/describe','describe','show','post'];(function(_0x2b9a36,_0x3acb06){var _0x484b16=function(_0x2ec6dc){while(--_0x2ec6dc){_0x2b9a36['push'](_0x2b9a36['shift']());}};_0x484b16(++_0x3acb06);}(_0x7338,0x82));var _0x8733=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x7338[_0x220f3f];return _0x1f170e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8733('0x0'));var timeout=require(_0x8733('0x1'));var express=require(_0x8733('0x2'));var router=express[_0x8733('0x3')]();var fs_extra=require(_0x8733('0x4'));var auth=require(_0x8733('0x5'));var interaction=require(_0x8733('0x6'));var config=require('../../config/environment');var controller=require(_0x8733('0x7'));router[_0x8733('0x8')]('/',auth[_0x8733('0x9')](),controller['index']);router['get'](_0x8733('0xa'),auth['isAuthenticated'](),controller[_0x8733('0xb')]);router['get']('/:id',auth[_0x8733('0x9')](),controller[_0x8733('0xc')]);router[_0x8733('0xd')]('/',auth[_0x8733('0x9')](),controller['create']);router[_0x8733('0xe')](_0x8733('0xf'),auth[_0x8733('0x9')](),controller['update']);router[_0x8733('0x10')]('/:id',auth[_0x8733('0x9')](),controller['destroy']);module[_0x8733('0x11')]=router; \ No newline at end of file +var _0x55c5=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated','get','/describe','describe','/:id','update','delete','destroy'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x55c5,0xc3));var _0x555c=function(_0x2deac4,_0xc27a2b){_0x2deac4=_0x2deac4-0x0;var _0x1c0bda=_0x55c5[_0x2deac4];return _0x1c0bda;};'use strict';var multer=require(_0x555c('0x0'));var util=require(_0x555c('0x1'));var path=require('path');var timeout=require(_0x555c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x555c('0x3'));var auth=require(_0x555c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x555c('0x5'));var controller=require(_0x555c('0x6'));router['get']('/',auth[_0x555c('0x7')](),controller['index']);router[_0x555c('0x8')](_0x555c('0x9'),auth[_0x555c('0x7')](),controller[_0x555c('0xa')]);router['get'](_0x555c('0xb'),auth[_0x555c('0x7')](),controller['show']);router['post']('/',auth[_0x555c('0x7')](),controller['create']);router['put']('/:id',auth[_0x555c('0x7')](),controller[_0x555c('0xc')]);router[_0x555c('0xd')](_0x555c('0xb'),auth[_0x555c('0x7')](),controller[_0x555c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 461f528..5753ac8 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 _0xb78e=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x408314,_0x11682e){var _0x1af4ab=function(_0x284557){while(--_0x284557){_0x408314['push'](_0x408314['shift']());}};_0x1af4ab(++_0x11682e);}(_0xb78e,0x1c9));var _0xeb78=function(_0x3741e3,_0x3c3312){_0x3741e3=_0x3741e3-0x0;var _0x43c8e6=_0xb78e[_0x3741e3];return _0x43c8e6;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb78('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb78('0x2')],'set':function(_0x308d12){this[_0xeb78('0x5')](_0xeb78('0x6'),_0x308d12?_0x308d12['join'](''):[]);},'get':function(){return this[_0xeb78('0x7')](_0xeb78('0x6'))?this[_0xeb78('0x7')](_0xeb78('0x6'))[_0xeb78('0x8')](''):[];}}}; \ No newline at end of file +var _0x4e81=['join','getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x4e81,0x1bc));var _0x14e8=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x4e81[_0x4d35f3];return _0x382fea;};'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 905e947..1ad304f 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 _0xcc4a=['order','sort','where','filters','pick','filter','merge','options','UserProfileSection','includeAll','include','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x17326c,_0x1cf33d){var _0x61041b=function(_0x17eece){while(--_0x17eece){_0x17326c['push'](_0x17326c['shift']());}};_0x61041b(++_0x1cf33d);}(_0xcc4a,0xa9));var _0xacc4=function(_0x2ffbd6,_0x5317dd){_0x2ffbd6=_0x2ffbd6-0x0;var _0x2c1f61=_0xcc4a[_0x2ffbd6];return _0x2c1f61;};'use strict';var emlformat=require(_0xacc4('0x0'));var rimraf=require(_0xacc4('0x1'));var zipdir=require(_0xacc4('0x2'));var jsonpatch=require(_0xacc4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xacc4('0x4'));var util=require(_0xacc4('0x5'));var path=require(_0xacc4('0x6'));var sox=require(_0xacc4('0x7'));var csv=require(_0xacc4('0x8'));var ejs=require(_0xacc4('0x9'));var fs=require('fs');var fs_extra=require(_0xacc4('0xa'));var _=require(_0xacc4('0xb'));var squel=require(_0xacc4('0xc'));var crypto=require(_0xacc4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xacc4('0xe'));var toCsv=require(_0xacc4('0x8'));var querystring=require(_0xacc4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xacc4('0x10'));var qs=require(_0xacc4('0x11'));var as=require(_0xacc4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacc4('0x13'))('api');var utils=require(_0xacc4('0x14'));var config=require(_0xacc4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xacc4('0x16'))['db'];function respondWithStatusCode(_0x2f8c92,_0x5c36ba){_0x5c36ba=_0x5c36ba||0xcc;return function(_0x1bec79){if(_0x1bec79){return _0x2f8c92['sendStatus'](_0x5c36ba);}return _0x2f8c92[_0xacc4('0x17')](_0x5c36ba)[_0xacc4('0x18')]();};}function respondWithResult(_0x59543a,_0x101b3d){_0x101b3d=_0x101b3d||0xc8;return function(_0x20fa2e){if(_0x20fa2e){return _0x59543a[_0xacc4('0x17')](_0x101b3d)[_0xacc4('0x19')](_0x20fa2e);}};}function respondWithFilteredResult(_0x30083d,_0x5ad171){return function(_0x3a2fce){if(_0x3a2fce){var _0x141973=typeof _0x5ad171[_0xacc4('0x1a')]===_0xacc4('0x1b')&&typeof _0x5ad171[_0xacc4('0x1c')]===_0xacc4('0x1b');var _0x2d0a86=_0x3a2fce[_0xacc4('0x1d')];var _0x29fbb8=_0x141973?0x0:_0x5ad171[_0xacc4('0x1a')];var _0x36597b=_0x141973?_0x3a2fce['count']:_0x5ad171[_0xacc4('0x1a')]+_0x5ad171[_0xacc4('0x1c')];var _0x6992e9;if(_0x36597b>=_0x2d0a86){_0x36597b=_0x2d0a86;_0x6992e9=0xc8;}else{_0x6992e9=0xce;}_0x30083d[_0xacc4('0x17')](_0x6992e9);return _0x30083d[_0xacc4('0x1e')]('Content-Range',_0x29fbb8+'-'+_0x36597b+'/'+_0x2d0a86)[_0xacc4('0x19')](_0x3a2fce);}return null;};}function patchUpdates(_0x51dec4){return function(_0x3a6984){try{jsonpatch[_0xacc4('0x1f')](_0x3a6984,_0x51dec4,!![]);}catch(_0x917c6a){return BPromise[_0xacc4('0x20')](_0x917c6a);}return _0x3a6984['save']();};}function saveUpdates(_0x435574,_0x4eec97){return function(_0x578cb2){if(_0x578cb2){return _0x578cb2[_0xacc4('0x21')](_0x435574)['then'](function(_0x3e6bc0){return _0x3e6bc0;});}return null;};}function removeEntity(_0x3203c8,_0x418ca8){return function(_0x376a90){if(_0x376a90){return _0x376a90[_0xacc4('0x22')]()[_0xacc4('0x23')](function(){_0x3203c8['status'](0xcc)[_0xacc4('0x18')]();});}};}function handleEntityNotFound(_0x383c1c,_0x394e5c){return function(_0x3a3fd3){if(!_0x3a3fd3){_0x383c1c[_0xacc4('0x24')](0x194);}return _0x3a3fd3;};}function handleError(_0x15668f,_0x4e2f09){_0x4e2f09=_0x4e2f09||0x1f4;return function(_0x523931){logger[_0xacc4('0x25')](_0x523931[_0xacc4('0x26')]);if(_0x523931[_0xacc4('0x27')]){delete _0x523931[_0xacc4('0x27')];}_0x15668f[_0xacc4('0x17')](_0x4e2f09)[_0xacc4('0x28')](_0x523931);};}exports[_0xacc4('0x29')]=function(_0x45375f,_0x46296b){var _0x43e982={},_0x12c479={},_0x598417={'count':0x0,'rows':[]};var _0x234d35=_[_0xacc4('0x2a')](db['UserProfileSection'][_0xacc4('0x2b')],function(_0x2156bd){return{'name':_0x2156bd[_0xacc4('0x2c')],'type':_0x2156bd[_0xacc4('0x2d')][_0xacc4('0x2e')]};});_0x12c479[_0xacc4('0x2f')]=_['map'](_0x234d35,_0xacc4('0x27'));_0x12c479[_0xacc4('0x30')]=_[_0xacc4('0x31')](_0x45375f[_0xacc4('0x30')]);_0x12c479['filters']=_[_0xacc4('0x32')](_0x12c479[_0xacc4('0x2f')],_0x12c479[_0xacc4('0x30')]);_0x43e982[_0xacc4('0x33')]=_[_0xacc4('0x32')](_0x12c479['model'],qs[_0xacc4('0x34')](_0x45375f[_0xacc4('0x30')][_0xacc4('0x34')]));_0x43e982[_0xacc4('0x33')]=_0x43e982[_0xacc4('0x33')][_0xacc4('0x35')]?_0x43e982[_0xacc4('0x33')]:_0x12c479[_0xacc4('0x2f')];if(!_0x45375f[_0xacc4('0x30')][_0xacc4('0x36')](_0xacc4('0x37'))){_0x43e982['limit']=qs[_0xacc4('0x1c')](_0x45375f[_0xacc4('0x30')][_0xacc4('0x1c')]);_0x43e982['offset']=qs[_0xacc4('0x1a')](_0x45375f[_0xacc4('0x30')][_0xacc4('0x1a')]);}_0x43e982[_0xacc4('0x38')]=qs['sort'](_0x45375f[_0xacc4('0x30')][_0xacc4('0x39')]);_0x43e982[_0xacc4('0x3a')]=qs[_0xacc4('0x3b')](_[_0xacc4('0x3c')](_0x45375f[_0xacc4('0x30')],_0x12c479[_0xacc4('0x3b')]),_0x234d35);if(_0x45375f['query'][_0xacc4('0x3d')]){_0x43e982[_0xacc4('0x3a')]=_[_0xacc4('0x3e')](_0x43e982['where'],{'$or':_[_0xacc4('0x2a')](_0x234d35,function(_0x335e2f){if(_0x335e2f['type']!=='VIRTUAL'){var _0x3ab7b6={};_0x3ab7b6[_0x335e2f[_0xacc4('0x27')]]={'$like':'%'+_0x45375f[_0xacc4('0x30')][_0xacc4('0x3d')]+'%'};return _0x3ab7b6;}})});}_0x43e982=_[_0xacc4('0x3e')]({},_0x43e982,_0x45375f[_0xacc4('0x3f')]);var _0x43434e={'where':_0x43e982[_0xacc4('0x3a')]};return db[_0xacc4('0x40')][_0xacc4('0x1d')](_0x43434e)[_0xacc4('0x23')](function(_0x27853b){_0x598417[_0xacc4('0x1d')]=_0x27853b;if(_0x45375f[_0xacc4('0x30')][_0xacc4('0x41')]){_0x43e982[_0xacc4('0x42')]=[{'all':!![]}];}return db[_0xacc4('0x40')]['findAll'](_0x43e982);})[_0xacc4('0x23')](function(_0x288276){_0x598417[_0xacc4('0x43')]=_0x288276;return _0x598417;})[_0xacc4('0x23')](respondWithFilteredResult(_0x46296b,_0x43e982))['catch'](handleError(_0x46296b,null));};exports[_0xacc4('0x44')]=function(_0x4289ef,_0xf8033f){var _0x1e6e26={'raw':![],'where':{'id':_0x4289ef[_0xacc4('0x45')]['id']}},_0x309a77={};_0x309a77[_0xacc4('0x2f')]=_[_0xacc4('0x31')](db[_0xacc4('0x40')][_0xacc4('0x2b')]);_0x309a77[_0xacc4('0x30')]=_['keys'](_0x4289ef[_0xacc4('0x30')]);_0x309a77['filters']=_[_0xacc4('0x32')](_0x309a77['model'],_0x309a77['query']);_0x1e6e26[_0xacc4('0x33')]=_[_0xacc4('0x32')](_0x309a77[_0xacc4('0x2f')],qs[_0xacc4('0x34')](_0x4289ef[_0xacc4('0x30')][_0xacc4('0x34')]));_0x1e6e26[_0xacc4('0x33')]=_0x1e6e26[_0xacc4('0x33')][_0xacc4('0x35')]?_0x1e6e26[_0xacc4('0x33')]:_0x309a77[_0xacc4('0x2f')];if(_0x4289ef[_0xacc4('0x30')][_0xacc4('0x41')]){_0x1e6e26[_0xacc4('0x42')]=[{'all':!![]}];}_0x1e6e26=_['merge']({},_0x1e6e26,_0x4289ef[_0xacc4('0x3f')]);return db[_0xacc4('0x40')]['find'](_0x1e6e26)[_0xacc4('0x23')](handleEntityNotFound(_0xf8033f,null))['then'](respondWithResult(_0xf8033f,null))[_0xacc4('0x46')](handleError(_0xf8033f,null));};exports['create']=function(_0x39d12b,_0x356ff6){return db['UserProfileSection'][_0xacc4('0x47')](_0x39d12b[_0xacc4('0x48')],{})[_0xacc4('0x23')](respondWithResult(_0x356ff6,0xc9))[_0xacc4('0x46')](handleError(_0x356ff6,null));};exports[_0xacc4('0x21')]=function(_0x64557a,_0xb4a855){if(_0x64557a[_0xacc4('0x48')]['id']){delete _0x64557a['body']['id'];}return db[_0xacc4('0x40')][_0xacc4('0x49')]({'where':{'id':_0x64557a[_0xacc4('0x45')]['id']}})[_0xacc4('0x23')](handleEntityNotFound(_0xb4a855,null))[_0xacc4('0x23')](saveUpdates(_0x64557a[_0xacc4('0x48')],null))['then'](respondWithResult(_0xb4a855,null))[_0xacc4('0x46')](handleError(_0xb4a855,null));};exports['destroy']=function(_0x1d52e8,_0x269c78){return db[_0xacc4('0x40')]['find']({'where':{'id':_0x1d52e8[_0xacc4('0x45')]['id']}})[_0xacc4('0x23')](handleEntityNotFound(_0x269c78,null))['then'](removeEntity(_0x269c78,null))[_0xacc4('0x46')](handleError(_0x269c78,null));};exports[_0xacc4('0x4a')]=function(_0x380c29,_0x22df34){return db[_0xacc4('0x40')]['describe']()[_0xacc4('0x23')](respondWithResult(_0x22df34,null))[_0xacc4('0x46')](handleError(_0x22df34,null));}; \ No newline at end of file +var _0xecc8=['create','body','catch','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','show','params','find'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0xecc8,0x1d3));var _0x8ecc=function(_0x3bdd9d,_0x3094eb){_0x3bdd9d=_0x3bdd9d-0x0;var _0x4ce3ae=_0xecc8[_0x3bdd9d];return _0x4ce3ae;};'use strict';var emlformat=require(_0x8ecc('0x0'));var rimraf=require(_0x8ecc('0x1'));var zipdir=require(_0x8ecc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ecc('0x3'));var moment=require(_0x8ecc('0x4'));var BPromise=require(_0x8ecc('0x5'));var Mustache=require('mustache');var util=require(_0x8ecc('0x6'));var path=require(_0x8ecc('0x7'));var sox=require(_0x8ecc('0x8'));var csv=require('to-csv');var ejs=require(_0x8ecc('0x9'));var fs=require('fs');var fs_extra=require(_0x8ecc('0xa'));var _=require(_0x8ecc('0xb'));var squel=require('squel');var crypto=require(_0x8ecc('0xc'));var jsforce=require(_0x8ecc('0xd'));var deskjs=require(_0x8ecc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ecc('0xf'));var Redis=require(_0x8ecc('0x10'));var authService=require(_0x8ecc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8ecc('0x12'));var hardwareService=require(_0x8ecc('0x13'));var logger=require(_0x8ecc('0x14'))(_0x8ecc('0x15'));var utils=require(_0x8ecc('0x16'));var config=require(_0x8ecc('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ecc('0x18'))['db'];function respondWithStatusCode(_0x558f62,_0x49cee9){_0x49cee9=_0x49cee9||0xcc;return function(_0x238615){if(_0x238615){return _0x558f62[_0x8ecc('0x19')](_0x49cee9);}return _0x558f62[_0x8ecc('0x1a')](_0x49cee9)[_0x8ecc('0x1b')]();};}function respondWithResult(_0x547bf1,_0xafb41f){_0xafb41f=_0xafb41f||0xc8;return function(_0x4f700e){if(_0x4f700e){return _0x547bf1[_0x8ecc('0x1a')](_0xafb41f)[_0x8ecc('0x1c')](_0x4f700e);}};}function respondWithFilteredResult(_0x7a02af,_0x38fbb2){return function(_0x587024){if(_0x587024){var _0x130f55=typeof _0x38fbb2[_0x8ecc('0x1d')]===_0x8ecc('0x1e')&&typeof _0x38fbb2[_0x8ecc('0x1f')]===_0x8ecc('0x1e');var _0x44875b=_0x587024[_0x8ecc('0x20')];var _0x3eed85=_0x130f55?0x0:_0x38fbb2['offset'];var _0x540a79=_0x130f55?_0x587024[_0x8ecc('0x20')]:_0x38fbb2[_0x8ecc('0x1d')]+_0x38fbb2[_0x8ecc('0x1f')];var _0x16021f;if(_0x540a79>=_0x44875b){_0x540a79=_0x44875b;_0x16021f=0xc8;}else{_0x16021f=0xce;}_0x7a02af[_0x8ecc('0x1a')](_0x16021f);return _0x7a02af[_0x8ecc('0x21')](_0x8ecc('0x22'),_0x3eed85+'-'+_0x540a79+'/'+_0x44875b)[_0x8ecc('0x1c')](_0x587024);}return null;};}function patchUpdates(_0x114fd1){return function(_0x20f549){try{jsonpatch[_0x8ecc('0x23')](_0x20f549,_0x114fd1,!![]);}catch(_0x56af60){return BPromise[_0x8ecc('0x24')](_0x56af60);}return _0x20f549[_0x8ecc('0x25')]();};}function saveUpdates(_0xc54df1,_0x2ebdec){return function(_0x48d954){if(_0x48d954){return _0x48d954['update'](_0xc54df1)[_0x8ecc('0x26')](function(_0xaddd9d){return _0xaddd9d;});}return null;};}function removeEntity(_0x235646,_0x3a740f){return function(_0x4b566b){if(_0x4b566b){return _0x4b566b[_0x8ecc('0x27')]()[_0x8ecc('0x26')](function(){_0x235646['status'](0xcc)[_0x8ecc('0x1b')]();});}};}function handleEntityNotFound(_0x1f3a6f,_0x118ce6){return function(_0xec08a0){if(!_0xec08a0){_0x1f3a6f['sendStatus'](0x194);}return _0xec08a0;};}function handleError(_0x2d3625,_0x1d3bcc){_0x1d3bcc=_0x1d3bcc||0x1f4;return function(_0x2fe380){logger['error'](_0x2fe380[_0x8ecc('0x28')]);if(_0x2fe380[_0x8ecc('0x29')]){delete _0x2fe380['name'];}_0x2d3625[_0x8ecc('0x1a')](_0x1d3bcc)[_0x8ecc('0x2a')](_0x2fe380);};}exports[_0x8ecc('0x2b')]=function(_0x497918,_0x11000e){var _0x36a128={},_0x3503e8={},_0x498bfe={'count':0x0,'rows':[]};var _0x345e95=_[_0x8ecc('0x2c')](db['UserProfileSection'][_0x8ecc('0x2d')],function(_0x2a0048){return{'name':_0x2a0048[_0x8ecc('0x2e')],'type':_0x2a0048['type'][_0x8ecc('0x2f')]};});_0x3503e8['model']=_[_0x8ecc('0x2c')](_0x345e95,_0x8ecc('0x29'));_0x3503e8[_0x8ecc('0x30')]=_[_0x8ecc('0x31')](_0x497918['query']);_0x3503e8['filters']=_[_0x8ecc('0x32')](_0x3503e8[_0x8ecc('0x33')],_0x3503e8['query']);_0x36a128[_0x8ecc('0x34')]=_[_0x8ecc('0x32')](_0x3503e8[_0x8ecc('0x33')],qs[_0x8ecc('0x35')](_0x497918[_0x8ecc('0x30')][_0x8ecc('0x35')]));_0x36a128[_0x8ecc('0x34')]=_0x36a128['attributes'][_0x8ecc('0x36')]?_0x36a128[_0x8ecc('0x34')]:_0x3503e8[_0x8ecc('0x33')];if(!_0x497918[_0x8ecc('0x30')]['hasOwnProperty'](_0x8ecc('0x37'))){_0x36a128[_0x8ecc('0x1f')]=qs['limit'](_0x497918[_0x8ecc('0x30')][_0x8ecc('0x1f')]);_0x36a128[_0x8ecc('0x1d')]=qs[_0x8ecc('0x1d')](_0x497918[_0x8ecc('0x30')][_0x8ecc('0x1d')]);}_0x36a128['order']=qs[_0x8ecc('0x38')](_0x497918[_0x8ecc('0x30')]['sort']);_0x36a128[_0x8ecc('0x39')]=qs[_0x8ecc('0x3a')](_[_0x8ecc('0x3b')](_0x497918[_0x8ecc('0x30')],_0x3503e8[_0x8ecc('0x3a')]),_0x345e95);if(_0x497918[_0x8ecc('0x30')][_0x8ecc('0x3c')]){_0x36a128['where']=_[_0x8ecc('0x3d')](_0x36a128[_0x8ecc('0x39')],{'$or':_[_0x8ecc('0x2c')](_0x345e95,function(_0x4ae9b9){if(_0x4ae9b9['type']!==_0x8ecc('0x3e')){var _0x5bcfa3={};_0x5bcfa3[_0x4ae9b9[_0x8ecc('0x29')]]={'$like':'%'+_0x497918[_0x8ecc('0x30')][_0x8ecc('0x3c')]+'%'};return _0x5bcfa3;}})});}_0x36a128=_[_0x8ecc('0x3d')]({},_0x36a128,_0x497918[_0x8ecc('0x3f')]);var _0xa39ae6={'where':_0x36a128[_0x8ecc('0x39')]};return db[_0x8ecc('0x40')][_0x8ecc('0x20')](_0xa39ae6)[_0x8ecc('0x26')](function(_0x2d4cc0){_0x498bfe[_0x8ecc('0x20')]=_0x2d4cc0;if(_0x497918['query'][_0x8ecc('0x41')]){_0x36a128[_0x8ecc('0x42')]=[{'all':!![]}];}return db[_0x8ecc('0x40')][_0x8ecc('0x43')](_0x36a128);})['then'](function(_0x3d69ee){_0x498bfe[_0x8ecc('0x44')]=_0x3d69ee;return _0x498bfe;})[_0x8ecc('0x26')](respondWithFilteredResult(_0x11000e,_0x36a128))['catch'](handleError(_0x11000e,null));};exports[_0x8ecc('0x45')]=function(_0x5310af,_0x37f40f){var _0x467539={'raw':![],'where':{'id':_0x5310af[_0x8ecc('0x46')]['id']}},_0x468712={};_0x468712['model']=_[_0x8ecc('0x31')](db[_0x8ecc('0x40')][_0x8ecc('0x2d')]);_0x468712[_0x8ecc('0x30')]=_[_0x8ecc('0x31')](_0x5310af['query']);_0x468712[_0x8ecc('0x3a')]=_[_0x8ecc('0x32')](_0x468712[_0x8ecc('0x33')],_0x468712[_0x8ecc('0x30')]);_0x467539['attributes']=_[_0x8ecc('0x32')](_0x468712[_0x8ecc('0x33')],qs['fields'](_0x5310af['query'][_0x8ecc('0x35')]));_0x467539[_0x8ecc('0x34')]=_0x467539[_0x8ecc('0x34')][_0x8ecc('0x36')]?_0x467539[_0x8ecc('0x34')]:_0x468712['model'];if(_0x5310af[_0x8ecc('0x30')][_0x8ecc('0x41')]){_0x467539['include']=[{'all':!![]}];}_0x467539=_[_0x8ecc('0x3d')]({},_0x467539,_0x5310af[_0x8ecc('0x3f')]);return db['UserProfileSection'][_0x8ecc('0x47')](_0x467539)[_0x8ecc('0x26')](handleEntityNotFound(_0x37f40f,null))[_0x8ecc('0x26')](respondWithResult(_0x37f40f,null))['catch'](handleError(_0x37f40f,null));};exports[_0x8ecc('0x48')]=function(_0x3fd113,_0x49a910){return db['UserProfileSection']['create'](_0x3fd113[_0x8ecc('0x49')],{})[_0x8ecc('0x26')](respondWithResult(_0x49a910,0xc9))[_0x8ecc('0x4a')](handleError(_0x49a910,null));};exports[_0x8ecc('0x4b')]=function(_0x5393f1,_0x4eadd1){if(_0x5393f1[_0x8ecc('0x49')]['id']){delete _0x5393f1['body']['id'];}return db[_0x8ecc('0x40')][_0x8ecc('0x47')]({'where':{'id':_0x5393f1[_0x8ecc('0x46')]['id']}})[_0x8ecc('0x26')](handleEntityNotFound(_0x4eadd1,null))[_0x8ecc('0x26')](saveUpdates(_0x5393f1['body'],null))[_0x8ecc('0x26')](respondWithResult(_0x4eadd1,null))[_0x8ecc('0x4a')](handleError(_0x4eadd1,null));};exports[_0x8ecc('0x27')]=function(_0x732917,_0x4cc83d){return db[_0x8ecc('0x40')][_0x8ecc('0x47')]({'where':{'id':_0x732917['params']['id']}})['then'](handleEntityNotFound(_0x4cc83d,null))['then'](removeEntity(_0x4cc83d,null))['catch'](handleError(_0x4cc83d,null));};exports[_0x8ecc('0x4c')]=function(_0x838bf2,_0x6db289){return db[_0x8ecc('0x40')][_0x8ecc('0x4c')]()[_0x8ecc('0x26')](respondWithResult(_0x6db289,null))[_0x8ecc('0x4a')](handleError(_0x6db289,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index af64dcd..03acd92 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 _0xe384=['rimraf','../../config/environment','exports','define','compositeIndex','sectionId','userProfileId','util','moment','bluebird','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe384,0x10f));var _0x4e38=function(_0x31dca8,_0xf1040a){_0x31dca8=_0x31dca8-0x0;var _0x3a7b54=_0xe384[_0x31dca8];return _0x3a7b54;};'use strict';var _=require('lodash');var util=require(_0x4e38('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4e38('0x1'));var BPromise=require(_0x4e38('0x2'));var rp=require(_0x4e38('0x3'));var fs=require('fs');var path=require(_0x4e38('0x4'));var rimraf=require(_0x4e38('0x5'));var config=require(_0x4e38('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x4e38('0x7')]=function(_0x45dd5a,_0x211984){return _0x45dd5a[_0x4e38('0x8')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x4e38('0x9'),'fields':[_0x4e38('0xa'),_0x4e38('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68a9=['../../config/logger','api','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util'];(function(_0x932f2c,_0x236d8c){var _0x5652be=function(_0x4b2944){while(--_0x4b2944){_0x932f2c['push'](_0x932f2c['shift']());}};_0x5652be(++_0x236d8c);}(_0x68a9,0x106));var _0x968a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x68a9[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x968a('0x0'));var util=require(_0x968a('0x1'));var logger=require(_0x968a('0x2'))(_0x968a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x968a('0x4'));var attributes=require(_0x968a('0x5'));module[_0x968a('0x6')]=function(_0x1d2b24,_0x4e7307){return _0x1d2b24['define'](_0x968a('0x7'),attributes,{'tableName':_0x968a('0x8'),'paranoid':![],'indexes':[{'name':_0x968a('0x9'),'fields':['sectionId',_0x968a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index fb81bc8..9595faf 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 _0x3c89=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x5129e1,_0x4baf70){var _0x58b34e=function(_0x4fd2f7){while(--_0x4fd2f7){_0x5129e1['push'](_0x5129e1['shift']());}};_0x58b34e(++_0x4baf70);}(_0x3c89,0xf2));var _0x93c8=function(_0x207738,_0x18dcfa){_0x207738=_0x207738-0x0;var _0xda3f57=_0x3c89[_0x207738];return _0xda3f57;};'use strict';var _=require(_0x93c8('0x0'));var util=require('util');var moment=require(_0x93c8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93c8('0x2'));var db=require(_0x93c8('0x3'))['db'];var utils=require(_0x93c8('0x4'));var logger=require(_0x93c8('0x5'))(_0x93c8('0x6'));var config=require(_0x93c8('0x7'));var jayson=require(_0x93c8('0x8'));var client=jayson[_0x93c8('0x9')][_0x93c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x581e40,_0x5cf31a,_0x690e0f){return new BPromise(function(_0x4125f0,_0x16cd29){return client[_0x93c8('0xb')](_0x581e40,_0x690e0f)[_0x93c8('0xc')](function(_0x18f23e){logger[_0x93c8('0xd')](_0x93c8('0xe'),_0x5cf31a,_0x93c8('0xf'));logger[_0x93c8('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5cf31a,_0x93c8('0xf'),JSON[_0x93c8('0x11')](_0x18f23e));if(_0x18f23e[_0x93c8('0x12')]){if(_0x18f23e[_0x93c8('0x12')][_0x93c8('0x13')]===0x1f4){logger[_0x93c8('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x5cf31a,_0x18f23e[_0x93c8('0x12')][_0x93c8('0x14')]);return _0x16cd29(_0x18f23e[_0x93c8('0x12')][_0x93c8('0x14')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5cf31a,_0x18f23e[_0x93c8('0x12')][_0x93c8('0x14')]);return _0x4125f0(_0x18f23e['error'][_0x93c8('0x14')]);}else{logger[_0x93c8('0xd')](_0x93c8('0xe'),_0x5cf31a,'request\x20sent');_0x4125f0(_0x18f23e['result'][_0x93c8('0x14')]);}})[_0x93c8('0x15')](function(_0x58e20f){logger[_0x93c8('0x12')](_0x93c8('0xe'),_0x5cf31a,_0x58e20f);_0x16cd29(_0x58e20f);});});} \ No newline at end of file +var _0xde5f=['request','then','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x45507e,_0x296ae3){var _0x33860a=function(_0x12ea55){while(--_0x12ea55){_0x45507e['push'](_0x45507e['shift']());}};_0x33860a(++_0x296ae3);}(_0xde5f,0x1df));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfde5('0x0'));var util=require('util');var moment=require(_0xfde5('0x1'));var BPromise=require(_0xfde5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfde5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfde5('0x4'))('rpc');var config=require(_0xfde5('0x5'));var jayson=require(_0xfde5('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52b300,_0x30171e,_0x2e5cee){return new BPromise(function(_0x7cf2ed,_0x465fb9){return client[_0xfde5('0x7')](_0x52b300,_0x2e5cee)[_0xfde5('0x8')](function(_0x553297){logger['info'](_0xfde5('0x9'),_0x30171e,'request\x20sent');logger['debug'](_0xfde5('0xa'),_0x30171e,_0xfde5('0xb'),JSON[_0xfde5('0xc')](_0x553297));if(_0x553297[_0xfde5('0xd')]){if(_0x553297[_0xfde5('0xd')]['code']===0x1f4){logger['error'](_0xfde5('0x9'),_0x30171e,_0x553297['error'][_0xfde5('0xe')]);return _0x465fb9(_0x553297[_0xfde5('0xd')]['message']);}logger[_0xfde5('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x30171e,_0x553297[_0xfde5('0xd')][_0xfde5('0xe')]);return _0x7cf2ed(_0x553297['error'][_0xfde5('0xe')]);}else{logger[_0xfde5('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x30171e,'request\x20sent');_0x7cf2ed(_0x553297[_0xfde5('0x10')][_0xfde5('0xe')]);}})[_0xfde5('0x11')](function(_0x32b204){logger[_0xfde5('0xd')](_0xfde5('0x9'),_0x30171e,_0x32b204);_0x465fb9(_0x32b204);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index fd94967..bbdf23b 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x580409,_0x11a6e8){var _0x126a85=function(_0x1ff8a5){while(--_0x1ff8a5){_0x580409['push'](_0x580409['shift']());}};_0x126a85(++_0x11a6e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x57b221,_0xd1f651){var _0x3dc429=function(_0x41cee6){while(--_0x41cee6){_0x57b221['push'](_0x57b221['shift']());}};_0x3dc429(++_0xd1f651);}(_0xe706,0xa3));var _0x6e70=function(_0x400b6c,_0x4a6139){_0x400b6c=_0x400b6c-0x0;var _0x4c4e3e=_0xe706[_0x400b6c];return _0x4c4e3e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 4d0da42..e956340 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 _0xe75a=['sequelize','exports'];(function(_0x926384,_0x3ae459){var _0x5308b2=function(_0xf5e0b1){while(--_0xf5e0b1){_0x926384['push'](_0x926384['shift']());}};_0x5308b2(++_0x3ae459);}(_0xe75a,0x1de));var _0xae75=function(_0x6eb02d,_0x20bdf5){_0x6eb02d=_0x6eb02d-0x0;var _0xb756de=_0xe75a[_0x6eb02d];return _0xb756de;};'use strict';var Sequelize=require(_0xae75('0x0'));module[_0xae75('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xac1d=['INTEGER','sequelize','exports'];(function(_0x25c4e2,_0x4c4805){var _0x59cafe=function(_0x47f29b){while(--_0x47f29b){_0x25c4e2['push'](_0x25c4e2['shift']());}};_0x59cafe(++_0x4c4805);}(_0xac1d,0xfd));var _0xdac1=function(_0x2716bc,_0x6865f9){_0x2716bc=_0x2716bc-0x0;var _0x4785fd=_0xac1d[_0x2716bc];return _0x4785fd;};'use strict';var Sequelize=require(_0xdac1('0x0'));module[_0xdac1('0x1')]={'penalty':{'type':Sequelize[_0xdac1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index d058d4c..0d314c0 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x356a11,_0x5151c2){var _0x238da2=function(_0x231505){while(--_0x231505){_0x356a11['push'](_0x356a11['shift']());}};_0x238da2(++_0x5151c2);}(_0x1a37,0xb4));var _0x71a3=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x1a37[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./userSmsQueue.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['lodash','moment','bluebird','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0xc0213d,_0x4a3b1d){var _0x1a93c4=function(_0xc683f3){while(--_0xc683f3){_0xc0213d['push'](_0xc0213d['shift']());}};_0x1a93c4(++_0x4a3b1d);}(_0x2675,0x75));var _0x5267=function(_0x2f01bb,_0x26386a){_0x2f01bb=_0x2f01bb-0x0;var _0x2b7635=_0x2675[_0x2f01bb];return _0x2b7635;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 5aa0ea8..5b8d57e 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 _0x953a=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4411ae,_0x202bbb){var _0x5c9635=function(_0x5cf5ea){while(--_0x5cf5ea){_0x4411ae['push'](_0x4411ae['shift']());}};_0x5c9635(++_0x202bbb);}(_0x953a,0x103));var _0xa953=function(_0x163f45,_0x2606ee){_0x163f45=_0x163f45-0x0;var _0x100682=_0x953a[_0x163f45];return _0x100682;};'use strict';var _=require('lodash');var util=require(_0xa953('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa953('0x1'));var fs=require('fs');var Redis=require(_0xa953('0x2'));var db=require(_0xa953('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa953('0x4'))(_0xa953('0x5'));var config=require('../../config/environment');var jayson=require(_0xa953('0x6'));var client=jayson[_0xa953('0x7')][_0xa953('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3313a0,_0x4aa10d,_0x372d88){return new BPromise(function(_0x2a7f81,_0x148b07){return client[_0xa953('0x9')](_0x3313a0,_0x372d88)[_0xa953('0xa')](function(_0x456f7f){logger[_0xa953('0xb')](_0xa953('0xc'),_0x4aa10d,_0xa953('0xd'));logger[_0xa953('0xe')](_0xa953('0xf'),_0x4aa10d,_0xa953('0xd'),JSON[_0xa953('0x10')](_0x456f7f));if(_0x456f7f[_0xa953('0x11')]){if(_0x456f7f[_0xa953('0x11')]['code']===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4aa10d,_0x456f7f['error'][_0xa953('0x12')]);return _0x148b07(_0x456f7f['error'][_0xa953('0x12')]);}logger['error'](_0xa953('0xc'),_0x4aa10d,_0x456f7f[_0xa953('0x11')][_0xa953('0x12')]);return _0x2a7f81(_0x456f7f['error'][_0xa953('0x12')]);}else{logger[_0xa953('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x4aa10d,_0xa953('0xd'));_0x2a7f81(_0x456f7f[_0xa953('0x13')]['message']);}})[_0xa953('0x14')](function(_0x299b82){logger[_0xa953('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x4aa10d,_0x299b82);_0x148b07(_0x299b82);});});} \ No newline at end of file +var _0xf453=['jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4ed6c7,_0x2e6803){var _0x112d0c=function(_0x188c4f){while(--_0x188c4f){_0x4ed6c7['push'](_0x4ed6c7['shift']());}};_0x112d0c(++_0x2e6803);}(_0xf453,0x15e));var _0x3f45=function(_0x3b0397,_0x3d3688){_0x3b0397=_0x3b0397-0x0;var _0x568809=_0xf453[_0x3b0397];return _0x568809;};'use strict';var _=require('lodash');var util=require(_0x3f45('0x0'));var moment=require(_0x3f45('0x1'));var BPromise=require(_0x3f45('0x2'));var rs=require(_0x3f45('0x3'));var fs=require('fs');var Redis=require(_0x3f45('0x4'));var db=require(_0x3f45('0x5'))['db'];var utils=require(_0x3f45('0x6'));var logger=require(_0x3f45('0x7'))(_0x3f45('0x8'));var config=require(_0x3f45('0x9'));var jayson=require(_0x3f45('0xa'));var client=jayson[_0x3f45('0xb')][_0x3f45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22eb75,_0x196737,_0x3a0ebb){return new BPromise(function(_0xfdd5c0,_0x35111b){return client['request'](_0x22eb75,_0x3a0ebb)[_0x3f45('0xd')](function(_0x26910c){logger[_0x3f45('0xe')](_0x3f45('0xf'),_0x196737,_0x3f45('0x10'));logger[_0x3f45('0x11')](_0x3f45('0x12'),_0x196737,_0x3f45('0x10'),JSON[_0x3f45('0x13')](_0x26910c));if(_0x26910c[_0x3f45('0x14')]){if(_0x26910c[_0x3f45('0x14')]['code']===0x1f4){logger['error'](_0x3f45('0xf'),_0x196737,_0x26910c[_0x3f45('0x14')][_0x3f45('0x15')]);return _0x35111b(_0x26910c[_0x3f45('0x14')][_0x3f45('0x15')]);}logger[_0x3f45('0x14')](_0x3f45('0xf'),_0x196737,_0x26910c[_0x3f45('0x14')][_0x3f45('0x15')]);return _0xfdd5c0(_0x26910c[_0x3f45('0x14')]['message']);}else{logger['info'](_0x3f45('0xf'),_0x196737,_0x3f45('0x10'));_0xfdd5c0(_0x26910c[_0x3f45('0x16')]['message']);}})[_0x3f45('0x17')](function(_0x4aafc8){logger[_0x3f45('0x14')](_0x3f45('0xf'),_0x196737,_0x4aafc8);_0x35111b(_0x4aafc8);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 08a292b..083d72e 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 _0xb917=['INTEGER','sequelize','exports'];(function(_0x154524,_0x2527dc){var _0x22da87=function(_0x54be11){while(--_0x54be11){_0x154524['push'](_0x154524['shift']());}};_0x22da87(++_0x2527dc);}(_0xb917,0x1e1));var _0x7b91=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb917[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7b91('0x0'));module[_0x7b91('0x1')]={'UserId':{'type':Sequelize[_0x7b91('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x7b91('0x2')]}}; \ No newline at end of file +var _0x9231=['exports','INTEGER','sequelize'];(function(_0x34bcd6,_0x561fd2){var _0x52358c=function(_0x2a556f){while(--_0x2a556f){_0x34bcd6['push'](_0x34bcd6['shift']());}};_0x52358c(++_0x561fd2);}(_0x9231,0xb0));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1923('0x0'));module[_0x1923('0x1')]={'UserId':{'type':Sequelize[_0x1923('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1923('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 46b90ab..9b85f68 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(_0x734c51,_0x5914d3){var _0xe618df=function(_0x50fd94){while(--_0x50fd94){_0x734c51['push'](_0x734c51['shift']());}};_0xe618df(++_0x5914d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x5d4044,_0x580583){var _0x24b2aa=function(_0xf902b0){while(--_0xf902b0){_0x5d4044['push'](_0x5d4044['shift']());}};_0x24b2aa(++_0x580583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 8388475..f535d27 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xaec478,_0x1703e7){var _0x301e3f=function(_0x22fd25){while(--_0x22fd25){_0xaec478['push'](_0xaec478['shift']());}};_0x301e3f(++_0x1703e7);}(_0x70e0,0x17b));var _0x070e=function(_0x41082e,_0x2888d9){_0x41082e=_0x41082e-0x0;var _0x3bebd4=_0x70e0[_0x41082e];return _0x3bebd4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x8caffa,_0x4563bf){var _0xa53cd2=function(_0x51127d){while(--_0x51127d){_0x8caffa['push'](_0x8caffa['shift']());}};_0xa53cd2(++_0x4563bf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0xcb91[_0x2af053];return _0x4b4001;};'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 7b9d6d2..64bd260 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 _0x9f39=['sequelize','INTEGER'];(function(_0x2c70fc,_0x2864fe){var _0x3eccf4=function(_0x35de2c){while(--_0x35de2c){_0x2c70fc['push'](_0x2c70fc['shift']());}};_0x3eccf4(++_0x2864fe);}(_0x9f39,0x152));var _0x99f3=function(_0x1008bc,_0x193921){_0x1008bc=_0x1008bc-0x0;var _0x551839=_0x9f39[_0x1008bc];return _0x551839;};'use strict';var Sequelize=require(_0x99f3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x99f3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xde79=['sequelize'];(function(_0xef4214,_0x5a5bdf){var _0x20f448=function(_0x296e2c){while(--_0x296e2c){_0xef4214['push'](_0xef4214['shift']());}};_0x20f448(++_0x5a5bdf);}(_0xde79,0x10d));var _0x9de7=function(_0x4f62eb,_0x24418f){_0x4f62eb=_0x4f62eb-0x0;var _0x86bf70=_0xde79[_0x4f62eb];return _0x86bf70;};'use strict';var Sequelize=require(_0x9de7('0x0'));module['exports']={'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 3e9cbdc..2efd29a 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 _0x9cd1=['moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','util','../../config/logger'];(function(_0xa4acec,_0x257925){var _0x84718e=function(_0x5c66ed){while(--_0x5c66ed){_0xa4acec['push'](_0xa4acec['shift']());}};_0x84718e(++_0x257925);}(_0x9cd1,0xf0));var _0x19cd=function(_0x42c6d6,_0xe9ff7a){_0x42c6d6=_0x42c6d6-0x0;var _0x2057b8=_0x9cd1[_0x42c6d6];return _0x2057b8;};'use strict';var _=require('lodash');var util=require(_0x19cd('0x0'));var logger=require(_0x19cd('0x1'))('api');var moment=require(_0x19cd('0x2'));var BPromise=require(_0x19cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19cd('0x4'));var rimraf=require(_0x19cd('0x5'));var config=require(_0x19cd('0x6'));var attributes=require(_0x19cd('0x7'));module[_0x19cd('0x8')]=function(_0x3fbb1b,_0x56402f){return _0x3fbb1b['define'](_0x19cd('0x9'),attributes,{'tableName':_0x19cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e63=['define','UserVoiceQueue','user_has_voice_queues','util','api','bluebird','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x26f96a,_0x13636a){var _0x2b3b20=function(_0x170d5f){while(--_0x170d5f){_0x26f96a['push'](_0x26f96a['shift']());}};_0x2b3b20(++_0x13636a);}(_0x7e63,0x9c));var _0x37e6=function(_0x340c7b,_0x3b229e){_0x340c7b=_0x340c7b-0x0;var _0x8f8a3b=_0x7e63[_0x340c7b];return _0x8f8a3b;};'use strict';var _=require('lodash');var util=require(_0x37e6('0x0'));var logger=require('../../config/logger')(_0x37e6('0x1'));var moment=require('moment');var BPromise=require(_0x37e6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x37e6('0x3'));var attributes=require(_0x37e6('0x4'));module[_0x37e6('0x5')]=function(_0x49b07c,_0x16c91c){return _0x49b07c[_0x37e6('0x6')](_0x37e6('0x7'),attributes,{'tableName':_0x37e6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5aae4a0..ca0f038 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 _0x0c00=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x47743d,_0x57306d){var _0x35ad4f=function(_0x21209){while(--_0x21209){_0x47743d['push'](_0x47743d['shift']());}};_0x35ad4f(++_0x57306d);}(_0x0c00,0xb4));var _0x00c0=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0c00[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x00c0('0x0'));var util=require(_0x00c0('0x1'));var moment=require('moment');var BPromise=require(_0x00c0('0x2'));var rs=require(_0x00c0('0x3'));var fs=require('fs');var Redis=require(_0x00c0('0x4'));var db=require(_0x00c0('0x5'))['db'];var utils=require(_0x00c0('0x6'));var logger=require(_0x00c0('0x7'))('rpc');var config=require(_0x00c0('0x8'));var jayson=require(_0x00c0('0x9'));var client=jayson[_0x00c0('0xa')][_0x00c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3667e9,_0x41967d,_0x4c1f4a){return new BPromise(function(_0xd3d64,_0x2ae7f0){return client[_0x00c0('0xc')](_0x3667e9,_0x4c1f4a)[_0x00c0('0xd')](function(_0x267422){logger[_0x00c0('0xe')](_0x00c0('0xf'),_0x41967d,_0x00c0('0x10'));logger[_0x00c0('0x11')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x41967d,_0x00c0('0x10'),JSON[_0x00c0('0x12')](_0x267422));if(_0x267422[_0x00c0('0x13')]){if(_0x267422[_0x00c0('0x13')]['code']===0x1f4){logger['error'](_0x00c0('0xf'),_0x41967d,_0x267422[_0x00c0('0x13')][_0x00c0('0x14')]);return _0x2ae7f0(_0x267422[_0x00c0('0x13')][_0x00c0('0x14')]);}logger[_0x00c0('0x13')](_0x00c0('0xf'),_0x41967d,_0x267422[_0x00c0('0x13')][_0x00c0('0x14')]);return _0xd3d64(_0x267422[_0x00c0('0x13')][_0x00c0('0x14')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x41967d,_0x00c0('0x10'));_0xd3d64(_0x267422[_0x00c0('0x15')][_0x00c0('0x14')]);}})[_0x00c0('0x16')](function(_0x260864){logger[_0x00c0('0x13')](_0x00c0('0xf'),_0x41967d,_0x260864);_0x2ae7f0(_0x260864);});});} \ No newline at end of file +var _0x8242=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4dc0c8,_0x48d51f){var _0x26bf81=function(_0x1093f6){while(--_0x1093f6){_0x4dc0c8['push'](_0x4dc0c8['shift']());}};_0x26bf81(++_0x48d51f);}(_0x8242,0x147));var _0x2824=function(_0x27d47d,_0x40d84c){_0x27d47d=_0x27d47d-0x0;var _0x12561d=_0x8242[_0x27d47d];return _0x12561d;};'use strict';var _=require(_0x2824('0x0'));var util=require(_0x2824('0x1'));var moment=require(_0x2824('0x2'));var BPromise=require(_0x2824('0x3'));var rs=require(_0x2824('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2824('0x5'))['db'];var utils=require(_0x2824('0x6'));var logger=require('../../config/logger')(_0x2824('0x7'));var config=require(_0x2824('0x8'));var jayson=require(_0x2824('0x9'));var client=jayson[_0x2824('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x100b55,_0x3910b8,_0x344ca9){return new BPromise(function(_0xe35a60,_0x20d483){return client['request'](_0x100b55,_0x344ca9)[_0x2824('0xb')](function(_0x15ed9f){logger[_0x2824('0xc')](_0x2824('0xd'),_0x3910b8,'request\x20sent');logger[_0x2824('0xe')](_0x2824('0xf'),_0x3910b8,_0x2824('0x10'),JSON[_0x2824('0x11')](_0x15ed9f));if(_0x15ed9f[_0x2824('0x12')]){if(_0x15ed9f[_0x2824('0x12')][_0x2824('0x13')]===0x1f4){logger[_0x2824('0x12')](_0x2824('0xd'),_0x3910b8,_0x15ed9f['error'][_0x2824('0x14')]);return _0x20d483(_0x15ed9f[_0x2824('0x12')][_0x2824('0x14')]);}logger[_0x2824('0x12')](_0x2824('0xd'),_0x3910b8,_0x15ed9f[_0x2824('0x12')][_0x2824('0x14')]);return _0xe35a60(_0x15ed9f[_0x2824('0x12')][_0x2824('0x14')]);}else{logger[_0x2824('0xc')](_0x2824('0xd'),_0x3910b8,_0x2824('0x10'));_0xe35a60(_0x15ed9f['result'][_0x2824('0x14')]);}})[_0x2824('0x15')](function(_0x4facee){logger[_0x2824('0x12')](_0x2824('0xd'),_0x3910b8,_0x4facee);_0x20d483(_0x4facee);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 83d79c1..05059d5 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x11a604,_0x559daf){var _0xe79a7b=function(_0x345239){while(--_0x345239){_0x11a604['push'](_0x11a604['shift']());}};_0xe79a7b(++_0x559daf);}(_0x70e0,0x17b));var _0x070e=function(_0x1a3d8a,_0x1aed6a){_0x1a3d8a=_0x1a3d8a-0x0;var _0x20df9d=_0x70e0[_0x1a3d8a];return _0x20df9d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x105c5a,_0x6286cb){var _0x5d0999=function(_0x420458){while(--_0x420458){_0x105c5a['push'](_0x105c5a['shift']());}};_0x5d0999(++_0x6286cb);}(_0xe706,0xa3));var _0x6e70=function(_0x31d03c,_0x158cef){_0x31d03c=_0x31d03c-0x0;var _0x420e61=_0xe706[_0x31d03c];return _0x420e61;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 4710dc3..0065e23 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 _0x3178=['INTEGER','sequelize','exports','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x4a56f1,_0x27dbb7){var _0x1f909c=function(_0x436c4b){while(--_0x436c4b){_0x4a56f1['push'](_0x4a56f1['shift']());}};_0x1f909c(++_0x27dbb7);}(_0x3178,0x7f));var _0x8317=function(_0x34a602,_0x2c0a1b){_0x34a602=_0x34a602-0x0;var _0x6c20ec=_0x3178[_0x34a602];return _0x6c20ec;};'use strict';var Sequelize=require(_0x8317('0x0'));module[_0x8317('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8317('0x2')},'membername':{'type':Sequelize[_0x8317('0x3')],'allowNull':![],'comment':_0x8317('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8317('0x3')],'allowNull':![],'unique':_0x8317('0x4'),'comment':_0x8317('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8317('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0x8317('0x3')],'allowNull':![],'unique':_0x8317('0x4'),'comment':_0x8317('0x2')},'penalty':{'type':Sequelize[_0x8317('0x5')](0xb),'defaultValue':0x0,'comment':_0x8317('0x2')},'paused':{'type':Sequelize[_0x8317('0x5')](0xb),'defaultValue':0x0,'comment':_0x8317('0x2')}}; \ No newline at end of file +var _0xa027=['STRING','queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2f3fcf,_0x2e18a5){var _0x21bb1e=function(_0x8ced9){while(--_0x8ced9){_0x2f3fcf['push'](_0x2f3fcf['shift']());}};_0x21bb1e(++_0x2e18a5);}(_0xa027,0x1dd));var _0x7a02=function(_0x11ec98,_0x3495c1){_0x11ec98=_0x11ec98-0x0;var _0x5ae891=_0xa027[_0x11ec98];return _0x5ae891;};'use strict';var Sequelize=require(_0x7a02('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7a02('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7a02('0x2')},'membername':{'type':Sequelize[_0x7a02('0x3')],'allowNull':![],'comment':_0x7a02('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7a02('0x3')],'allowNull':![],'unique':_0x7a02('0x4'),'comment':_0x7a02('0x2')},'VoiceQueueId':{'type':Sequelize[_0x7a02('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7a02('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x7a02('0x1')](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 cc21b82..57767d2 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 _0x0186=['emit','hasOwnProperty','exports','events','UserVoiceQueueRt','save','update'];(function(_0x369e8d,_0x42ad4e){var _0x30e513=function(_0xf248cc){while(--_0xf248cc){_0x369e8d['push'](_0x369e8d['shift']());}};_0x30e513(++_0x42ad4e);}(_0x0186,0x15a));var _0x6018=function(_0x2b5fda,_0x2f2cc2){_0x2b5fda=_0x2b5fda-0x0;var _0x3d17db=_0x0186[_0x2b5fda];return _0x3d17db;};'use strict';var EventEmitter=require(_0x6018('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x6018('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6018('0x2'),'afterUpdate':_0x6018('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cfec9){return function(_0x31217b,_0x543d59,_0x42f3f4){UserVoiceQueueRtEvents[_0x6018('0x4')](_0x3cfec9+':'+_0x31217b['id'],_0x31217b);UserVoiceQueueRtEvents[_0x6018('0x4')](_0x3cfec9,_0x31217b);_0x42f3f4(null);};}for(var e in events){if(events[_0x6018('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x6018('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x82be=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x14ccc9,_0x286523){var _0x33358b=function(_0x2d0bb8){while(--_0x2d0bb8){_0x14ccc9['push'](_0x14ccc9['shift']());}};_0x33358b(++_0x286523);}(_0x82be,0x156));var _0xe82b=function(_0x4cbe14,_0x9972b3){_0x4cbe14=_0x4cbe14-0x0;var _0x22cf00=_0x82be[_0x4cbe14];return _0x22cf00;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xe82b('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe82b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe82b('0x2'),'afterDestroy':_0xe82b('0x3')};function emitEvent(_0x1367b1){return function(_0x5ece62,_0x5b0680,_0x5d4fb4){UserVoiceQueueRtEvents[_0xe82b('0x4')](_0x1367b1+':'+_0x5ece62['id'],_0x5ece62);UserVoiceQueueRtEvents[_0xe82b('0x4')](_0x1367b1,_0x5ece62);_0x5d4fb4(null);};}for(var e in events){if(events[_0xe82b('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xe82b('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 48b33ff..99fdeeb 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 _0xa2d2=['define','UserVoiceQueueRt','user_has_voice_queues_rt','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x1bbfd8,_0x4c8511){var _0x4bf75a=function(_0x3c9fb0){while(--_0x3c9fb0){_0x1bbfd8['push'](_0x1bbfd8['shift']());}};_0x4bf75a(++_0x4c8511);}(_0xa2d2,0x6f));var _0x2a2d=function(_0x150490,_0x794fbf){_0x150490=_0x150490-0x0;var _0x1fffd7=_0xa2d2[_0x150490];return _0x1fffd7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2a2d('0x0'));var moment=require(_0x2a2d('0x1'));var BPromise=require(_0x2a2d('0x2'));var rp=require(_0x2a2d('0x3'));var fs=require('fs');var path=require(_0x2a2d('0x4'));var rimraf=require(_0x2a2d('0x5'));var config=require(_0x2a2d('0x6'));var attributes=require(_0x2a2d('0x7'));module[_0x2a2d('0x8')]=function(_0x9a2bc7,_0x8bc704){return _0x9a2bc7[_0x2a2d('0x9')](_0x2a2d('0xa'),attributes,{'tableName':_0x2a2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe752=['request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1d6e3d,_0x51b0c5){var _0x27d1e4=function(_0x37d6c4){while(--_0x37d6c4){_0x1d6e3d['push'](_0x1d6e3d['shift']());}};_0x27d1e4(++_0x51b0c5);}(_0xe752,0x1e5));var _0x2e75=function(_0x4e797b,_0x146e30){_0x4e797b=_0x4e797b-0x0;var _0x2fddf3=_0xe752[_0x4e797b];return _0x2fddf3;};'use strict';var _=require(_0x2e75('0x0'));var util=require('util');var logger=require(_0x2e75('0x1'))(_0x2e75('0x2'));var moment=require(_0x2e75('0x3'));var BPromise=require(_0x2e75('0x4'));var rp=require(_0x2e75('0x5'));var fs=require('fs');var path=require(_0x2e75('0x6'));var rimraf=require(_0x2e75('0x7'));var config=require(_0x2e75('0x8'));var attributes=require(_0x2e75('0x9'));module[_0x2e75('0xa')]=function(_0x463986,_0x4f406a){return _0x463986[_0x2e75('0xb')](_0x2e75('0xc'),attributes,{'tableName':_0x2e75('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index b5ee237..6c74103 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 _0xe968=['COUNT','debug','lodash','util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xe968,0x182));var _0x8e96=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe968[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x8e96('0x0'));var util=require(_0x8e96('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e96('0x2'));var fs=require('fs');var Redis=require(_0x8e96('0x3'));var db=require(_0x8e96('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e96('0x5'));var config=require('../../config/environment');var jayson=require(_0x8e96('0x6'));var client=jayson[_0x8e96('0x7')][_0x8e96('0x8')]({'port':0x232a});config[_0x8e96('0x9')]=_[_0x8e96('0xa')](config[_0x8e96('0x9')],{'host':_0x8e96('0xb'),'port':0x18eb});var socket=require(_0x8e96('0xc'))(new Redis(config[_0x8e96('0x9')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x4e1cb3,_0x3bdd24,_0x565ae0){return new BPromise(function(_0x256918,_0x323e6e){return client['request'](_0x4e1cb3,_0x565ae0)[_0x8e96('0xd')](function(_0x4228d2){logger[_0x8e96('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3bdd24,_0x8e96('0xf'));logger['debug'](_0x8e96('0x10'),_0x3bdd24,'request\x20sent',JSON[_0x8e96('0x11')](_0x4228d2));if(_0x4228d2[_0x8e96('0x12')]){if(_0x4228d2['error'][_0x8e96('0x13')]===0x1f4){logger[_0x8e96('0x12')](_0x8e96('0x14'),_0x3bdd24,_0x4228d2['error'][_0x8e96('0x15')]);return _0x323e6e(_0x4228d2['error'][_0x8e96('0x15')]);}logger[_0x8e96('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3bdd24,_0x4228d2[_0x8e96('0x12')][_0x8e96('0x15')]);return _0x256918(_0x4228d2[_0x8e96('0x12')][_0x8e96('0x15')]);}else{logger[_0x8e96('0xe')](_0x8e96('0x14'),_0x3bdd24,_0x8e96('0xf'));_0x256918(_0x4228d2[_0x8e96('0x16')]['message']);}})[_0x8e96('0x17')](function(_0x642930){logger[_0x8e96('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3bdd24,_0x642930);_0x323e6e(_0x642930);});});}exports[_0x8e96('0x18')]=function(_0x3f8c0f){var _0x54abca=this;return new Promise(function(_0x4968a6,_0x1b3d88){return db[_0x8e96('0x19')][_0x8e96('0x1a')]({'raw':_0x3f8c0f[_0x8e96('0x1b')]?_0x3f8c0f[_0x8e96('0x1b')][_0x8e96('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f8c0f['options']?_0x3f8c0f[_0x8e96('0x1b')]['where']||null:null,'attributes':[[db[_0x8e96('0x1d')]['fn'](_0x8e96('0x1e'),db[_0x8e96('0x1d')]['fn']('IF',db[_0x8e96('0x1d')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})['then'](function(_0x17dfce){logger['info'](_0x8e96('0x18'),_0x3f8c0f);logger[_0x8e96('0x1f')](_0x8e96('0x18'),_0x3f8c0f,JSON[_0x8e96('0x11')](_0x17dfce));_0x4968a6(_0x17dfce);})[_0x8e96('0x17')](function(_0x3d0a24){logger[_0x8e96('0x12')](_0x8e96('0x18'),_0x3d0a24[_0x8e96('0x15')],_0x3f8c0f);_0x1b3d88(_0x54abca['error'](0x1f4,_0x3d0a24[_0x8e96('0x15')]));});});}; \ No newline at end of file +var _0x0307=['localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','raw','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x30d719,_0x22729b){var _0x21358e=function(_0x9c8042){while(--_0x9c8042){_0x30d719['push'](_0x30d719['shift']());}};_0x21358e(++_0x22729b);}(_0x0307,0x129));var _0x7030=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x0307[_0x1e6db3];return _0x1de886;};'use strict';var _=require(_0x7030('0x0'));var util=require(_0x7030('0x1'));var moment=require(_0x7030('0x2'));var BPromise=require(_0x7030('0x3'));var rs=require(_0x7030('0x4'));var fs=require('fs');var Redis=require(_0x7030('0x5'));var db=require(_0x7030('0x6'))['db'];var utils=require(_0x7030('0x7'));var logger=require('../../config/logger')(_0x7030('0x8'));var config=require(_0x7030('0x9'));var jayson=require(_0x7030('0xa'));var client=jayson[_0x7030('0xb')][_0x7030('0xc')]({'port':0x232a});config['redis']=_[_0x7030('0xd')](config[_0x7030('0xe')],{'host':_0x7030('0xf'),'port':0x18eb});var socket=require(_0x7030('0x10'))(new Redis(config[_0x7030('0xe')]));require(_0x7030('0x11'))[_0x7030('0x12')](socket);function respondWithRpcPromise(_0x23472a,_0x219d4b,_0x329c2e){return new BPromise(function(_0x26902b,_0x19c636){return client['request'](_0x23472a,_0x329c2e)[_0x7030('0x13')](function(_0x3d5e78){logger[_0x7030('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x219d4b,_0x7030('0x15'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x219d4b,_0x7030('0x15'),JSON[_0x7030('0x16')](_0x3d5e78));if(_0x3d5e78[_0x7030('0x17')]){if(_0x3d5e78[_0x7030('0x17')][_0x7030('0x18')]===0x1f4){logger[_0x7030('0x17')](_0x7030('0x19'),_0x219d4b,_0x3d5e78[_0x7030('0x17')]['message']);return _0x19c636(_0x3d5e78[_0x7030('0x17')][_0x7030('0x1a')]);}logger[_0x7030('0x17')](_0x7030('0x19'),_0x219d4b,_0x3d5e78['error'][_0x7030('0x1a')]);return _0x26902b(_0x3d5e78['error'][_0x7030('0x1a')]);}else{logger[_0x7030('0x14')](_0x7030('0x19'),_0x219d4b,_0x7030('0x15'));_0x26902b(_0x3d5e78[_0x7030('0x1b')][_0x7030('0x1a')]);}})[_0x7030('0x1c')](function(_0x3d13e7){logger['error'](_0x7030('0x19'),_0x219d4b,_0x3d13e7);_0x19c636(_0x3d13e7);});});}exports[_0x7030('0x1d')]=function(_0x66a481){var _0x12728c=this;return new Promise(function(_0x42d385,_0x50fb9f){return db[_0x7030('0x1e')]['findAll']({'raw':_0x66a481['options']?_0x66a481['options'][_0x7030('0x1f')]===undefined?!![]:![]:!![],'where':_0x66a481[_0x7030('0x20')]?_0x66a481[_0x7030('0x20')][_0x7030('0x21')]||null:null,'attributes':[[db[_0x7030('0x22')]['fn'](_0x7030('0x23'),db['sequelize']['fn']('IF',db[_0x7030('0x22')]['literal'](_0x7030('0x24')))),_0x7030('0x25')]]})[_0x7030('0x13')](function(_0x331b9d){logger[_0x7030('0x14')]('GetVoiceQueueRtPauses',_0x66a481);logger[_0x7030('0x26')](_0x7030('0x1d'),_0x66a481,JSON[_0x7030('0x16')](_0x331b9d));_0x42d385(_0x331b9d);})[_0x7030('0x1c')](function(_0x267d03){logger[_0x7030('0x17')]('GetVoiceQueueRtPauses',_0x267d03[_0x7030('0x1a')],_0x66a481);_0x50fb9f(_0x12728c[_0x7030('0x17')](0x1f4,_0x267d03[_0x7030('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index fd5ea46..ddffe9a 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 _0x29eb=['remove','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x2a1832,_0x2149a0){var _0x51f72e=function(_0x206dc1){while(--_0x206dc1){_0x2a1832['push'](_0x2a1832['shift']());}};_0x51f72e(++_0x2149a0);}(_0x29eb,0x1c5));var _0xb29e=function(_0x2f15fe,_0x20749d){_0x2f15fe=_0x2f15fe-0x0;var _0x13f917=_0x29eb[_0x2f15fe];return _0x13f917;};'use strict';var UserVoiceQueueRtEvents=require(_0xb29e('0x0'));var events=[_0xb29e('0x1'),_0xb29e('0x2'),'update'];function createListener(_0x194ba3,_0x443c9c){return function(_0xbacdd6){_0x443c9c['emit'](_0x194ba3,_0xbacdd6);};}function removeListener(_0x29356f,_0x4c648e){return function(){UserVoiceQueueRtEvents[_0xb29e('0x3')](_0x29356f,_0x4c648e);};}exports[_0xb29e('0x4')]=function(_0x3426f3){for(var _0x2e216f=0x0,_0x4dde31=events[_0xb29e('0x5')];_0x2e216f<_0x4dde31;_0x2e216f++){var _0x5bf1ae=events[_0x2e216f];var _0x1995ab=createListener(_0xb29e('0x6')+_0x5bf1ae,_0x3426f3);UserVoiceQueueRtEvents['on'](_0x5bf1ae,_0x1995ab);}}; \ No newline at end of file +var _0xafc4=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0xafc4,0x69));var _0x4afc=function(_0x72e9e8,_0x1758fe){_0x72e9e8=_0x72e9e8-0x0;var _0x2b6157=_0xafc4[_0x72e9e8];return _0x2b6157;};'use strict';var UserVoiceQueueRtEvents=require(_0x4afc('0x0'));var events=['save',_0x4afc('0x1'),'update'];function createListener(_0x10aede,_0x11789f){return function(_0x20e443){_0x11789f[_0x4afc('0x2')](_0x10aede,_0x20e443);};}function removeListener(_0x4d9dbd,_0x49f417){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4d9dbd,_0x49f417);};}exports[_0x4afc('0x3')]=function(_0x471d45){for(var _0x16953b=0x0,_0x1bb281=events[_0x4afc('0x4')];_0x16953b<_0x1bb281;_0x16953b++){var _0xaf053d=events[_0x16953b];var _0x5e1e29=createListener(_0x4afc('0x5')+_0xaf053d,_0x471d45);UserVoiceQueueRtEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3e86f00..bb13c8d 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(_0x59ef57,_0x3c2021){var _0x4b0784=function(_0x37e8e2){while(--_0x37e8e2){_0x59ef57['push'](_0x59ef57['shift']());}};_0x4b0784(++_0x3c2021);}(_0xe706,0xa3));var _0x6e70=function(_0xf7ff4,_0x543a19){_0xf7ff4=_0xf7ff4-0x0;var _0x554e6a=_0xe706[_0xf7ff4];return _0x554e6a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3651cc,_0x56f14f){var _0x470f8e=function(_0x501e4b){while(--_0x501e4b){_0x3651cc['push'](_0x3651cc['shift']());}};_0x470f8e(++_0x56f14f);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 5a56daf..7efee9a 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 _0xaa21=['INTEGER'];(function(_0x101076,_0x5c8f3f){var _0x2d873d=function(_0xac9f4f){while(--_0xac9f4f){_0x101076['push'](_0x101076['shift']());}};_0x2d873d(++_0x5c8f3f);}(_0xaa21,0x17e));var _0x1aa2=function(_0x312e07,_0x4b0626){_0x312e07=_0x312e07-0x0;var _0xed31a4=_0xaa21[_0x312e07];return _0xed31a4;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x1aa2('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb2f4=['exports','INTEGER','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb2f4,0x14f));var _0x4b2f=function(_0x41e3e5,_0x441240){_0x41e3e5=_0x41e3e5-0x0;var _0x4b5b5c=_0xb2f4[_0x41e3e5];return _0x4b5b5c;};'use strict';var Sequelize=require(_0x4b2f('0x0'));module[_0x4b2f('0x1')]={'penalty':{'type':Sequelize[_0x4b2f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 165418e..813b3ad 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 _0x5dcf=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','lodash'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x5dcf,0x154));var _0xf5dc=function(_0x1cc0a0,_0x29319d){_0x1cc0a0=_0x1cc0a0-0x0;var _0x43e0b5=_0x5dcf[_0x1cc0a0];return _0x43e0b5;};'use strict';var _=require(_0xf5dc('0x0'));var util=require(_0xf5dc('0x1'));var logger=require(_0xf5dc('0x2'))(_0xf5dc('0x3'));var moment=require(_0xf5dc('0x4'));var BPromise=require(_0xf5dc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5dc('0x6'));var rimraf=require(_0xf5dc('0x7'));var config=require(_0xf5dc('0x8'));var attributes=require(_0xf5dc('0x9'));module['exports']=function(_0x41a477,_0x48ab2d){return _0x41a477[_0xf5dc('0xa')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2806=['user_has_whatsapp_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x1a0c59,_0x3b4dcc){var _0xed67c9=function(_0x247698){while(--_0x247698){_0x1a0c59['push'](_0x1a0c59['shift']());}};_0xed67c9(++_0x3b4dcc);}(_0x2806,0x15d));var _0x6280=function(_0x1c3c53,_0x299fb4){_0x1c3c53=_0x1c3c53-0x0;var _0x5263cf=_0x2806[_0x1c3c53];return _0x5263cf;};'use strict';var _=require(_0x6280('0x0'));var util=require(_0x6280('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6280('0x2'));var BPromise=require(_0x6280('0x3'));var rp=require(_0x6280('0x4'));var fs=require('fs');var path=require(_0x6280('0x5'));var rimraf=require(_0x6280('0x6'));var config=require('../../config/environment');var attributes=require(_0x6280('0x7'));module[_0x6280('0x8')]=function(_0x4c9eca,_0x186360){return _0x4c9eca[_0x6280('0x9')](_0x6280('0xa'),attributes,{'tableName':_0x6280('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 267d1b7..159ab3d 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 _0xabc7=['code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0xabc7,0x194));var _0x7abc=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xabc7[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x7abc('0x0'));var util=require(_0x7abc('0x1'));var moment=require('moment');var BPromise=require(_0x7abc('0x2'));var rs=require(_0x7abc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7abc('0x4'))['db'];var utils=require(_0x7abc('0x5'));var logger=require(_0x7abc('0x6'))('rpc');var config=require(_0x7abc('0x7'));var jayson=require(_0x7abc('0x8'));var client=jayson['client'][_0x7abc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50c3ac,_0x288bd5,_0x18e5d6){return new BPromise(function(_0x76bfc7,_0x256126){return client['request'](_0x50c3ac,_0x18e5d6)['then'](function(_0x1def9f){logger[_0x7abc('0xa')](_0x7abc('0xb'),_0x288bd5,'request\x20sent');logger[_0x7abc('0xc')](_0x7abc('0xd'),_0x288bd5,'request\x20sent',JSON[_0x7abc('0xe')](_0x1def9f));if(_0x1def9f[_0x7abc('0xf')]){if(_0x1def9f['error'][_0x7abc('0x10')]===0x1f4){logger[_0x7abc('0xf')](_0x7abc('0xb'),_0x288bd5,_0x1def9f[_0x7abc('0xf')][_0x7abc('0x11')]);return _0x256126(_0x1def9f[_0x7abc('0xf')]['message']);}logger['error'](_0x7abc('0xb'),_0x288bd5,_0x1def9f[_0x7abc('0xf')][_0x7abc('0x11')]);return _0x76bfc7(_0x1def9f['error'][_0x7abc('0x11')]);}else{logger[_0x7abc('0xa')](_0x7abc('0xb'),_0x288bd5,_0x7abc('0x12'));_0x76bfc7(_0x1def9f[_0x7abc('0x13')][_0x7abc('0x11')]);}})[_0x7abc('0x14')](function(_0x15f7a1){logger[_0x7abc('0xf')](_0x7abc('0xb'),_0x288bd5,_0x15f7a1);_0x256126(_0x15f7a1);});});} \ No newline at end of file +var _0x16fd=['http','request','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x15896a,_0x926834){var _0x1094b8=function(_0x3cf061){while(--_0x3cf061){_0x15896a['push'](_0x15896a['shift']());}};_0x1094b8(++_0x926834);}(_0x16fd,0x12a));var _0xd16f=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x16fd[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xd16f('0x0'));var util=require('util');var moment=require(_0xd16f('0x1'));var BPromise=require(_0xd16f('0x2'));var rs=require(_0xd16f('0x3'));var fs=require('fs');var Redis=require(_0xd16f('0x4'));var db=require(_0xd16f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd16f('0x6'))('rpc');var config=require(_0xd16f('0x7'));var jayson=require(_0xd16f('0x8'));var client=jayson[_0xd16f('0x9')][_0xd16f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7142c2,_0x29b133,_0x103da8){return new BPromise(function(_0x816eeb,_0x25bf54){return client[_0xd16f('0xb')](_0x7142c2,_0x103da8)['then'](function(_0x58663d){logger[_0xd16f('0xc')](_0xd16f('0xd'),_0x29b133,'request\x20sent');logger[_0xd16f('0xe')](_0xd16f('0xf'),_0x29b133,'request\x20sent',JSON[_0xd16f('0x10')](_0x58663d));if(_0x58663d[_0xd16f('0x11')]){if(_0x58663d[_0xd16f('0x11')]['code']===0x1f4){logger['error'](_0xd16f('0xd'),_0x29b133,_0x58663d[_0xd16f('0x11')]['message']);return _0x25bf54(_0x58663d[_0xd16f('0x11')][_0xd16f('0x12')]);}logger[_0xd16f('0x11')](_0xd16f('0xd'),_0x29b133,_0x58663d[_0xd16f('0x11')]['message']);return _0x816eeb(_0x58663d['error'][_0xd16f('0x12')]);}else{logger['info'](_0xd16f('0xd'),_0x29b133,_0xd16f('0x13'));_0x816eeb(_0x58663d[_0xd16f('0x14')]['message']);}})[_0xd16f('0x15')](function(_0x302423){logger[_0xd16f('0x11')](_0xd16f('0xd'),_0x29b133,_0x302423);_0x25bf54(_0x302423);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e1da854..5dae479 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 _0x534d=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x627b1b,_0x462114){var _0x2fd022=function(_0x2059c5){while(--_0x2059c5){_0x627b1b['push'](_0x627b1b['shift']());}};_0x2fd022(++_0x462114);}(_0x534d,0x79));var _0xd534=function(_0x40c4ac,_0x4d700d){_0x40c4ac=_0x40c4ac-0x0;var _0x5bd8c0=_0x534d[_0x40c4ac];return _0x5bd8c0;};'use strict';var multer=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var path=require(_0xd534('0x2'));var timeout=require(_0xd534('0x3'));var express=require(_0xd534('0x4'));var router=express[_0xd534('0x5')]();var fs_extra=require(_0xd534('0x6'));var auth=require(_0xd534('0x7'));var interaction=require(_0xd534('0x8'));var config=require(_0xd534('0x9'));var controller=require(_0xd534('0xa'));router[_0xd534('0xb')]('/',auth[_0xd534('0xc')](),controller[_0xd534('0xd')]);router[_0xd534('0xb')](_0xd534('0xe'),auth[_0xd534('0xc')](),controller[_0xd534('0xf')]);router[_0xd534('0x10')]('/',auth['isAuthenticated'](),controller[_0xd534('0x11')]);router[_0xd534('0x12')](_0xd534('0xe'),auth[_0xd534('0xc')](),controller[_0xd534('0x13')]);router['delete'](_0xd534('0xe'),auth[_0xd534('0xc')](),controller[_0xd534('0x14')]);module[_0xd534('0x15')]=router; \ No newline at end of file +var _0xe2cc=['get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x207c72,_0x142ea1){var _0x2ba9a7=function(_0x1b27a9){while(--_0x1b27a9){_0x207c72['push'](_0x207c72['shift']());}};_0x2ba9a7(++_0x142ea1);}(_0xe2cc,0x69));var _0xce2c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe2cc[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xce2c('0x2'));var router=express[_0xce2c('0x3')]();var fs_extra=require(_0xce2c('0x4'));var auth=require(_0xce2c('0x5'));var interaction=require(_0xce2c('0x6'));var config=require(_0xce2c('0x7'));var controller=require(_0xce2c('0x8'));router[_0xce2c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xce2c('0x9')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0xc')]);router[_0xce2c('0xd')]('/',auth[_0xce2c('0xb')](),controller['create']);router[_0xce2c('0xe')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0xf')]);router[_0xce2c('0x10')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0x11')]);module[_0xce2c('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 896a46d..6e5ccbb 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 _0xa82a=['exports','STRING','name','sequelize'];(function(_0x4b3069,_0x2872df){var _0x152d6a=function(_0x2019ee){while(--_0x2019ee){_0x4b3069['push'](_0x4b3069['shift']());}};_0x152d6a(++_0x2872df);}(_0xa82a,0x1e7));var _0xaa82=function(_0xc3e2c,_0x2b733d){_0xc3e2c=_0xc3e2c-0x0;var _0x2cc4f1=_0xa82a[_0xc3e2c];return _0x2cc4f1;};'use strict';var Sequelize=require(_0xaa82('0x0'));module[_0xaa82('0x1')]={'name':{'type':Sequelize[_0xaa82('0x2')],'unique':_0xaa82('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaa82('0x2')]}}; \ No newline at end of file +var _0x9d8c=['sequelize','STRING','name'];(function(_0x24fca1,_0x41eef3){var _0x25da57=function(_0x31a460){while(--_0x31a460){_0x24fca1['push'](_0x24fca1['shift']());}};_0x25da57(++_0x41eef3);}(_0x9d8c,0x162));var _0xc9d8=function(_0x54854d,_0x51d4f4){_0x54854d=_0x54854d-0x0;var _0x37a908=_0x9d8c[_0x54854d];return _0x37a908;};'use strict';var Sequelize=require(_0xc9d8('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9d8('0x1')],'unique':_0xc9d8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc9d8('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index dca5b82..0a8c4bb 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 _0x4dcc=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','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','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','Variables','sendStatus','error','stack','name','index','map','Variable','rawAttributes','fieldName','key','model','query'];(function(_0xd4cd2e,_0x40b14e){var _0x508357=function(_0x5db810){while(--_0x5db810){_0xd4cd2e['push'](_0xd4cd2e['shift']());}};_0x508357(++_0x40b14e);}(_0x4dcc,0x1bb));var _0xc4dc=function(_0x487d0a,_0x1b7cb4){_0x487d0a=_0x487d0a-0x0;var _0x3d740c=_0x4dcc[_0x487d0a];return _0x3d740c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4dc('0x0'));var zipdir=require(_0xc4dc('0x1'));var jsonpatch=require(_0xc4dc('0x2'));var rp=require('request-promise');var moment=require(_0xc4dc('0x3'));var BPromise=require(_0xc4dc('0x4'));var Mustache=require(_0xc4dc('0x5'));var util=require(_0xc4dc('0x6'));var path=require('path');var sox=require(_0xc4dc('0x7'));var csv=require(_0xc4dc('0x8'));var ejs=require(_0xc4dc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4dc('0xa'));var squel=require('squel');var crypto=require(_0xc4dc('0xb'));var jsforce=require(_0xc4dc('0xc'));var deskjs=require(_0xc4dc('0xd'));var toCsv=require(_0xc4dc('0x8'));var querystring=require('querystring');var Papa=require(_0xc4dc('0xe'));var Redis=require(_0xc4dc('0xf'));var authService=require(_0xc4dc('0x10'));var qs=require(_0xc4dc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4dc('0x12'));var logger=require(_0xc4dc('0x13'))(_0xc4dc('0x14'));var utils=require(_0xc4dc('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc4dc('0x16'))['db'];function respondWithStatusCode(_0x855ccb,_0x488651){_0x488651=_0x488651||0xcc;return function(_0x64e8d5){if(_0x64e8d5){return _0x855ccb['sendStatus'](_0x488651);}return _0x855ccb['status'](_0x488651)[_0xc4dc('0x17')]();};}function respondWithResult(_0x1ef052,_0x5e8879){_0x5e8879=_0x5e8879||0xc8;return function(_0x45d749){if(_0x45d749){return _0x1ef052[_0xc4dc('0x18')](_0x5e8879)['json'](_0x45d749);}};}function respondWithFilteredResult(_0x1aab75,_0x244f1e){return function(_0x50b3c3){if(_0x50b3c3){var _0x1f8257=typeof _0x244f1e[_0xc4dc('0x19')]===_0xc4dc('0x1a')&&typeof _0x244f1e[_0xc4dc('0x1b')]==='undefined';var _0x71bfc5=_0x50b3c3[_0xc4dc('0x1c')];var _0x3d546b=_0x1f8257?0x0:_0x244f1e[_0xc4dc('0x19')];var _0x1478c9=_0x1f8257?_0x50b3c3[_0xc4dc('0x1c')]:_0x244f1e[_0xc4dc('0x19')]+_0x244f1e[_0xc4dc('0x1b')];var _0x5cb243;if(_0x1478c9>=_0x71bfc5){_0x1478c9=_0x71bfc5;_0x5cb243=0xc8;}else{_0x5cb243=0xce;}_0x1aab75[_0xc4dc('0x18')](_0x5cb243);return _0x1aab75[_0xc4dc('0x1d')](_0xc4dc('0x1e'),_0x3d546b+'-'+_0x1478c9+'/'+_0x71bfc5)[_0xc4dc('0x1f')](_0x50b3c3);}return null;};}function patchUpdates(_0x373eb2){return function(_0x5616ef){try{jsonpatch['apply'](_0x5616ef,_0x373eb2,!![]);}catch(_0x4a7676){return BPromise[_0xc4dc('0x20')](_0x4a7676);}return _0x5616ef['save']();};}function saveUpdates(_0x5172a9,_0x54ea63){return function(_0x182ed7){if(_0x182ed7){return _0x182ed7[_0xc4dc('0x21')](_0x5172a9)[_0xc4dc('0x22')](function(_0x5aebeb){return _0x5aebeb;});}return null;};}function removeEntity(_0x21aeb5,_0x7724a4){return function(_0x35577c){if(_0x35577c){return _0x35577c['destroy']()[_0xc4dc('0x22')](function(){var _0x1f5ba5=_0x35577c[_0xc4dc('0x23')]({'plain':!![]});var _0x5af7f5=_0xc4dc('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5af7f5,'resourceId':_0x1f5ba5['id']}})[_0xc4dc('0x22')](function(){return _0x35577c;});})[_0xc4dc('0x22')](function(){_0x21aeb5[_0xc4dc('0x18')](0xcc)[_0xc4dc('0x17')]();});}};}function handleEntityNotFound(_0x51b300,_0x42619e){return function(_0x1f1f5e){if(!_0x1f1f5e){_0x51b300[_0xc4dc('0x25')](0x194);}return _0x1f1f5e;};}function handleError(_0x41e6c6,_0x10c423){_0x10c423=_0x10c423||0x1f4;return function(_0xcc3ea2){logger[_0xc4dc('0x26')](_0xcc3ea2[_0xc4dc('0x27')]);if(_0xcc3ea2['name']){delete _0xcc3ea2[_0xc4dc('0x28')];}_0x41e6c6[_0xc4dc('0x18')](_0x10c423)['send'](_0xcc3ea2);};}exports[_0xc4dc('0x29')]=function(_0xea4d80,_0x137a59){var _0x599ef9={},_0x2f7a01={},_0x157c0a={'count':0x0,'rows':[]};var _0x4c48f8=_[_0xc4dc('0x2a')](db[_0xc4dc('0x2b')][_0xc4dc('0x2c')],function(_0x17118a){return{'name':_0x17118a[_0xc4dc('0x2d')],'type':_0x17118a['type'][_0xc4dc('0x2e')]};});_0x2f7a01[_0xc4dc('0x2f')]=_[_0xc4dc('0x2a')](_0x4c48f8,_0xc4dc('0x28'));_0x2f7a01[_0xc4dc('0x30')]=_['keys'](_0xea4d80[_0xc4dc('0x30')]);_0x2f7a01[_0xc4dc('0x31')]=_[_0xc4dc('0x32')](_0x2f7a01[_0xc4dc('0x2f')],_0x2f7a01[_0xc4dc('0x30')]);_0x599ef9[_0xc4dc('0x33')]=_[_0xc4dc('0x32')](_0x2f7a01['model'],qs[_0xc4dc('0x34')](_0xea4d80['query']['fields']));_0x599ef9[_0xc4dc('0x33')]=_0x599ef9[_0xc4dc('0x33')][_0xc4dc('0x35')]?_0x599ef9[_0xc4dc('0x33')]:_0x2f7a01['model'];if(!_0xea4d80[_0xc4dc('0x30')][_0xc4dc('0x36')](_0xc4dc('0x37'))){_0x599ef9[_0xc4dc('0x1b')]=qs[_0xc4dc('0x1b')](_0xea4d80['query'][_0xc4dc('0x1b')]);_0x599ef9[_0xc4dc('0x19')]=qs[_0xc4dc('0x19')](_0xea4d80[_0xc4dc('0x30')]['offset']);}_0x599ef9[_0xc4dc('0x38')]=qs[_0xc4dc('0x39')](_0xea4d80['query']['sort']);_0x599ef9[_0xc4dc('0x3a')]=qs[_0xc4dc('0x31')](_['pick'](_0xea4d80['query'],_0x2f7a01['filters']),_0x4c48f8);if(_0xea4d80[_0xc4dc('0x30')]['filter']){_0x599ef9[_0xc4dc('0x3a')]=_[_0xc4dc('0x3b')](_0x599ef9[_0xc4dc('0x3a')],{'$or':_[_0xc4dc('0x2a')](_0x4c48f8,function(_0x2134a4){if(_0x2134a4[_0xc4dc('0x3c')]!=='VIRTUAL'){var _0x33f2f7={};_0x33f2f7[_0x2134a4[_0xc4dc('0x28')]]={'$like':'%'+_0xea4d80[_0xc4dc('0x30')][_0xc4dc('0x3d')]+'%'};return _0x33f2f7;}})});}_0x599ef9=_['merge']({},_0x599ef9,_0xea4d80[_0xc4dc('0x3e')]);var _0x18bab5={'where':_0x599ef9[_0xc4dc('0x3a')]};return db['Variable'][_0xc4dc('0x1c')](_0x18bab5)[_0xc4dc('0x22')](function(_0x1bbb68){_0x157c0a[_0xc4dc('0x1c')]=_0x1bbb68;if(_0xea4d80[_0xc4dc('0x30')][_0xc4dc('0x3f')]){_0x599ef9[_0xc4dc('0x40')]=[{'all':!![]}];}return db[_0xc4dc('0x2b')][_0xc4dc('0x41')](_0x599ef9);})[_0xc4dc('0x22')](function(_0x46e834){_0x157c0a[_0xc4dc('0x42')]=_0x46e834;return _0x157c0a;})[_0xc4dc('0x22')](respondWithFilteredResult(_0x137a59,_0x599ef9))[_0xc4dc('0x43')](handleError(_0x137a59,null));};exports[_0xc4dc('0x44')]=function(_0xf29ef9,_0x4ee081){var _0x1afef4={'raw':!![],'where':{'id':_0xf29ef9[_0xc4dc('0x45')]['id']}},_0x384e1e={};_0x384e1e[_0xc4dc('0x2f')]=_[_0xc4dc('0x46')](db[_0xc4dc('0x2b')]['rawAttributes']);_0x384e1e[_0xc4dc('0x30')]=_[_0xc4dc('0x46')](_0xf29ef9['query']);_0x384e1e[_0xc4dc('0x31')]=_[_0xc4dc('0x32')](_0x384e1e[_0xc4dc('0x2f')],_0x384e1e[_0xc4dc('0x30')]);_0x1afef4[_0xc4dc('0x33')]=_['intersection'](_0x384e1e[_0xc4dc('0x2f')],qs['fields'](_0xf29ef9[_0xc4dc('0x30')]['fields']));_0x1afef4[_0xc4dc('0x33')]=_0x1afef4[_0xc4dc('0x33')]['length']?_0x1afef4['attributes']:_0x384e1e[_0xc4dc('0x2f')];if(_0xf29ef9['query'][_0xc4dc('0x3f')]){_0x1afef4[_0xc4dc('0x40')]=[{'all':!![]}];}_0x1afef4=_['merge']({},_0x1afef4,_0xf29ef9[_0xc4dc('0x3e')]);return db['Variable'][_0xc4dc('0x47')](_0x1afef4)[_0xc4dc('0x22')](handleEntityNotFound(_0x4ee081,null))[_0xc4dc('0x22')](respondWithResult(_0x4ee081,null))[_0xc4dc('0x43')](handleError(_0x4ee081,null));};exports['create']=function(_0x362113,_0x24eb34){return db['Variable'][_0xc4dc('0x48')](_0x362113[_0xc4dc('0x49')],{})['then'](function(_0x3f6c05){var _0x1bddb5=_0x362113[_0xc4dc('0x4a')][_0xc4dc('0x23')]({'plain':!![]});if(!_0x1bddb5)throw new Error(_0xc4dc('0x4b'));if(_0x1bddb5[_0xc4dc('0x4c')]===_0xc4dc('0x4a')){var _0x4cb4ba=_0x3f6c05[_0xc4dc('0x23')]({'plain':!![]});var _0x15ae42='Variables';return db[_0xc4dc('0x4d')]['find']({'where':{'name':_0x15ae42,'userProfileId':_0x1bddb5[_0xc4dc('0x4e')]},'raw':!![]})[_0xc4dc('0x22')](function(_0x5dd302){if(_0x5dd302&&_0x5dd302[_0xc4dc('0x4f')]===0x0){return db[_0xc4dc('0x50')][_0xc4dc('0x48')]({'name':_0x4cb4ba[_0xc4dc('0x28')],'resourceId':_0x4cb4ba['id'],'type':_0x5dd302[_0xc4dc('0x28')],'sectionId':_0x5dd302['id']},{})['then'](function(){return _0x3f6c05;});}else{return _0x3f6c05;}})[_0xc4dc('0x43')](function(_0x19c6bb){logger[_0xc4dc('0x26')](_0xc4dc('0x51'),_0x19c6bb);throw _0x19c6bb;});}return _0x3f6c05;})[_0xc4dc('0x22')](respondWithResult(_0x24eb34,0xc9))[_0xc4dc('0x43')](handleError(_0x24eb34,null));};exports[_0xc4dc('0x21')]=function(_0x44ef62,_0x29e5b7){if(_0x44ef62[_0xc4dc('0x49')]['id']){delete _0x44ef62[_0xc4dc('0x49')]['id'];}return db[_0xc4dc('0x2b')][_0xc4dc('0x47')]({'where':{'id':_0x44ef62['params']['id']}})['then'](handleEntityNotFound(_0x29e5b7,null))['then'](saveUpdates(_0x44ef62[_0xc4dc('0x49')],null))[_0xc4dc('0x22')](respondWithResult(_0x29e5b7,null))[_0xc4dc('0x43')](handleError(_0x29e5b7,null));};exports['destroy']=function(_0x5b3e87,_0xa28b77){return db[_0xc4dc('0x2b')][_0xc4dc('0x47')]({'where':{'id':_0x5b3e87[_0xc4dc('0x45')]['id']}})['then'](handleEntityNotFound(_0xa28b77,null))[_0xc4dc('0x22')](removeEntity(_0xa28b77,null))[_0xc4dc('0x43')](handleError(_0xa28b77,null));}; \ No newline at end of file +var _0xaa33=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find'];(function(_0x334e45,_0x41f016){var _0x25ddb0=function(_0x2718d1){while(--_0x2718d1){_0x334e45['push'](_0x334e45['shift']());}};_0x25ddb0(++_0x41f016);}(_0xaa33,0x151));var _0x3aa3=function(_0x46aaa9,_0x31bdfc){_0x46aaa9=_0x46aaa9-0x0;var _0x369d38=_0xaa33[_0x46aaa9];return _0x369d38;};'use strict';var emlformat=require(_0x3aa3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3aa3('0x1'));var rp=require(_0x3aa3('0x2'));var moment=require(_0x3aa3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3aa3('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x3aa3('0x5'));var ejs=require(_0x3aa3('0x6'));var fs=require('fs');var fs_extra=require(_0x3aa3('0x7'));var _=require(_0x3aa3('0x8'));var squel=require(_0x3aa3('0x9'));var crypto=require(_0x3aa3('0xa'));var jsforce=require(_0x3aa3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3aa3('0x5'));var querystring=require('querystring');var Papa=require(_0x3aa3('0xc'));var Redis=require(_0x3aa3('0xd'));var authService=require(_0x3aa3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3aa3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3aa3('0x10'))(_0x3aa3('0x11'));var utils=require(_0x3aa3('0x12'));var config=require(_0x3aa3('0x13'));var licenseUtil=require(_0x3aa3('0x14'));var db=require(_0x3aa3('0x15'))['db'];function respondWithStatusCode(_0x40e36b,_0x4380d3){_0x4380d3=_0x4380d3||0xcc;return function(_0x4d6cf0){if(_0x4d6cf0){return _0x40e36b[_0x3aa3('0x16')](_0x4380d3);}return _0x40e36b['status'](_0x4380d3)[_0x3aa3('0x17')]();};}function respondWithResult(_0x3be2c0,_0x29a5b1){_0x29a5b1=_0x29a5b1||0xc8;return function(_0x5f380f){if(_0x5f380f){return _0x3be2c0[_0x3aa3('0x18')](_0x29a5b1)['json'](_0x5f380f);}};}function respondWithFilteredResult(_0x13a5af,_0x207326){return function(_0x2c2f92){if(_0x2c2f92){var _0x1a5e2e=typeof _0x207326[_0x3aa3('0x19')]===_0x3aa3('0x1a')&&typeof _0x207326[_0x3aa3('0x1b')]===_0x3aa3('0x1a');var _0x1dfa31=_0x2c2f92[_0x3aa3('0x1c')];var _0x387214=_0x1a5e2e?0x0:_0x207326['offset'];var _0x1c2f09=_0x1a5e2e?_0x2c2f92[_0x3aa3('0x1c')]:_0x207326[_0x3aa3('0x19')]+_0x207326[_0x3aa3('0x1b')];var _0x2824f8;if(_0x1c2f09>=_0x1dfa31){_0x1c2f09=_0x1dfa31;_0x2824f8=0xc8;}else{_0x2824f8=0xce;}_0x13a5af[_0x3aa3('0x18')](_0x2824f8);return _0x13a5af[_0x3aa3('0x1d')](_0x3aa3('0x1e'),_0x387214+'-'+_0x1c2f09+'/'+_0x1dfa31)['json'](_0x2c2f92);}return null;};}function patchUpdates(_0x4be357){return function(_0x526289){try{jsonpatch[_0x3aa3('0x1f')](_0x526289,_0x4be357,!![]);}catch(_0x5c13a9){return BPromise[_0x3aa3('0x20')](_0x5c13a9);}return _0x526289[_0x3aa3('0x21')]();};}function saveUpdates(_0x30dac7,_0x4329a6){return function(_0x2b95b8){if(_0x2b95b8){return _0x2b95b8[_0x3aa3('0x22')](_0x30dac7)['then'](function(_0x2204fe){return _0x2204fe;});}return null;};}function removeEntity(_0x55c379,_0x55cdf9){return function(_0x11c2da){if(_0x11c2da){return _0x11c2da[_0x3aa3('0x23')]()[_0x3aa3('0x24')](function(){var _0x2232a9=_0x11c2da[_0x3aa3('0x25')]({'plain':!![]});var _0x51da56=_0x3aa3('0x26');return db[_0x3aa3('0x27')]['destroy']({'where':{'type':_0x51da56,'resourceId':_0x2232a9['id']}})[_0x3aa3('0x24')](function(){return _0x11c2da;});})['then'](function(){_0x55c379[_0x3aa3('0x18')](0xcc)[_0x3aa3('0x17')]();});}};}function handleEntityNotFound(_0x4743c7,_0x31d5a7){return function(_0x53dd6d){if(!_0x53dd6d){_0x4743c7['sendStatus'](0x194);}return _0x53dd6d;};}function handleError(_0x5f5d3a,_0x84ed9e){_0x84ed9e=_0x84ed9e||0x1f4;return function(_0x21a119){logger[_0x3aa3('0x28')](_0x21a119[_0x3aa3('0x29')]);if(_0x21a119[_0x3aa3('0x2a')]){delete _0x21a119['name'];}_0x5f5d3a[_0x3aa3('0x18')](_0x84ed9e)[_0x3aa3('0x2b')](_0x21a119);};}exports[_0x3aa3('0x2c')]=function(_0x5eafaf,_0x32eeb9){var _0x247080={},_0x324e27={},_0x2a05af={'count':0x0,'rows':[]};var _0x319202=_[_0x3aa3('0x2d')](db[_0x3aa3('0x2e')][_0x3aa3('0x2f')],function(_0x5a9206){return{'name':_0x5a9206['fieldName'],'type':_0x5a9206[_0x3aa3('0x30')][_0x3aa3('0x31')]};});_0x324e27[_0x3aa3('0x32')]=_[_0x3aa3('0x2d')](_0x319202,'name');_0x324e27[_0x3aa3('0x33')]=_[_0x3aa3('0x34')](_0x5eafaf[_0x3aa3('0x33')]);_0x324e27['filters']=_[_0x3aa3('0x35')](_0x324e27['model'],_0x324e27[_0x3aa3('0x33')]);_0x247080[_0x3aa3('0x36')]=_[_0x3aa3('0x35')](_0x324e27['model'],qs['fields'](_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x37')]));_0x247080[_0x3aa3('0x36')]=_0x247080[_0x3aa3('0x36')]['length']?_0x247080[_0x3aa3('0x36')]:_0x324e27[_0x3aa3('0x32')];if(!_0x5eafaf[_0x3aa3('0x33')]['hasOwnProperty'](_0x3aa3('0x38'))){_0x247080['limit']=qs[_0x3aa3('0x1b')](_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x1b')]);_0x247080[_0x3aa3('0x19')]=qs[_0x3aa3('0x19')](_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x19')]);}_0x247080[_0x3aa3('0x39')]=qs[_0x3aa3('0x3a')](_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x3a')]);_0x247080[_0x3aa3('0x3b')]=qs[_0x3aa3('0x3c')](_[_0x3aa3('0x3d')](_0x5eafaf[_0x3aa3('0x33')],_0x324e27[_0x3aa3('0x3c')]),_0x319202);if(_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x3e')]){_0x247080[_0x3aa3('0x3b')]=_[_0x3aa3('0x3f')](_0x247080[_0x3aa3('0x3b')],{'$or':_[_0x3aa3('0x2d')](_0x319202,function(_0x2e7400){if(_0x2e7400[_0x3aa3('0x30')]!=='VIRTUAL'){var _0x4f1f8f={};_0x4f1f8f[_0x2e7400[_0x3aa3('0x2a')]]={'$like':'%'+_0x5eafaf[_0x3aa3('0x33')]['filter']+'%'};return _0x4f1f8f;}})});}_0x247080=_[_0x3aa3('0x3f')]({},_0x247080,_0x5eafaf[_0x3aa3('0x40')]);var _0x46279e={'where':_0x247080[_0x3aa3('0x3b')]};return db[_0x3aa3('0x2e')]['count'](_0x46279e)[_0x3aa3('0x24')](function(_0x1096fe){_0x2a05af['count']=_0x1096fe;if(_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x41')]){_0x247080[_0x3aa3('0x42')]=[{'all':!![]}];}return db[_0x3aa3('0x2e')][_0x3aa3('0x43')](_0x247080);})[_0x3aa3('0x24')](function(_0x27949a){_0x2a05af[_0x3aa3('0x44')]=_0x27949a;return _0x2a05af;})[_0x3aa3('0x24')](respondWithFilteredResult(_0x32eeb9,_0x247080))[_0x3aa3('0x45')](handleError(_0x32eeb9,null));};exports['show']=function(_0x208735,_0x5924b5){var _0x396c0d={'raw':!![],'where':{'id':_0x208735[_0x3aa3('0x46')]['id']}},_0x297a09={};_0x297a09[_0x3aa3('0x32')]=_[_0x3aa3('0x34')](db[_0x3aa3('0x2e')]['rawAttributes']);_0x297a09[_0x3aa3('0x33')]=_['keys'](_0x208735[_0x3aa3('0x33')]);_0x297a09[_0x3aa3('0x3c')]=_['intersection'](_0x297a09['model'],_0x297a09[_0x3aa3('0x33')]);_0x396c0d[_0x3aa3('0x36')]=_[_0x3aa3('0x35')](_0x297a09['model'],qs[_0x3aa3('0x37')](_0x208735[_0x3aa3('0x33')][_0x3aa3('0x37')]));_0x396c0d[_0x3aa3('0x36')]=_0x396c0d[_0x3aa3('0x36')][_0x3aa3('0x47')]?_0x396c0d['attributes']:_0x297a09[_0x3aa3('0x32')];if(_0x208735[_0x3aa3('0x33')]['includeAll']){_0x396c0d[_0x3aa3('0x42')]=[{'all':!![]}];}_0x396c0d=_['merge']({},_0x396c0d,_0x208735[_0x3aa3('0x40')]);return db[_0x3aa3('0x2e')][_0x3aa3('0x48')](_0x396c0d)[_0x3aa3('0x24')](handleEntityNotFound(_0x5924b5,null))[_0x3aa3('0x24')](respondWithResult(_0x5924b5,null))[_0x3aa3('0x45')](handleError(_0x5924b5,null));};exports[_0x3aa3('0x49')]=function(_0x75d1ed,_0x13add2){return db['Variable'][_0x3aa3('0x49')](_0x75d1ed['body'],{})[_0x3aa3('0x24')](function(_0x55a0e0){var _0x159d68=_0x75d1ed[_0x3aa3('0x4a')][_0x3aa3('0x25')]({'plain':!![]});if(!_0x159d68)throw new Error(_0x3aa3('0x4b'));if(_0x159d68[_0x3aa3('0x4c')]===_0x3aa3('0x4a')){var _0x55a4ef=_0x55a0e0[_0x3aa3('0x25')]({'plain':!![]});var _0x371236=_0x3aa3('0x26');return db[_0x3aa3('0x4d')][_0x3aa3('0x48')]({'where':{'name':_0x371236,'userProfileId':_0x159d68[_0x3aa3('0x4e')]},'raw':!![]})['then'](function(_0x1c3087){if(_0x1c3087&&_0x1c3087[_0x3aa3('0x4f')]===0x0){return db[_0x3aa3('0x27')][_0x3aa3('0x49')]({'name':_0x55a4ef[_0x3aa3('0x2a')],'resourceId':_0x55a4ef['id'],'type':_0x1c3087[_0x3aa3('0x2a')],'sectionId':_0x1c3087['id']},{})['then'](function(){return _0x55a0e0;});}else{return _0x55a0e0;}})[_0x3aa3('0x45')](function(_0x528830){logger[_0x3aa3('0x28')](_0x3aa3('0x50'),_0x528830);throw _0x528830;});}return _0x55a0e0;})[_0x3aa3('0x24')](respondWithResult(_0x13add2,0xc9))[_0x3aa3('0x45')](handleError(_0x13add2,null));};exports[_0x3aa3('0x22')]=function(_0x23912d,_0x50121d){if(_0x23912d[_0x3aa3('0x51')]['id']){delete _0x23912d['body']['id'];}return db[_0x3aa3('0x2e')]['find']({'where':{'id':_0x23912d[_0x3aa3('0x46')]['id']}})[_0x3aa3('0x24')](handleEntityNotFound(_0x50121d,null))[_0x3aa3('0x24')](saveUpdates(_0x23912d[_0x3aa3('0x51')],null))[_0x3aa3('0x24')](respondWithResult(_0x50121d,null))['catch'](handleError(_0x50121d,null));};exports[_0x3aa3('0x23')]=function(_0x3f4aa9,_0x5e2f0e){return db[_0x3aa3('0x2e')][_0x3aa3('0x48')]({'where':{'id':_0x3f4aa9['params']['id']}})[_0x3aa3('0x24')](handleEntityNotFound(_0x5e2f0e,null))['then'](removeEntity(_0x5e2f0e,null))['catch'](handleError(_0x5e2f0e,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index ce41307..0cf1a3d 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 _0x5ca0=['util','api','request-promise','path','rimraf','../../config/environment','exports','define','Variable','tools_variables'];(function(_0x4d9898,_0x182198){var _0x1611f3=function(_0x337ba0){while(--_0x337ba0){_0x4d9898['push'](_0x4d9898['shift']());}};_0x1611f3(++_0x182198);}(_0x5ca0,0x15e));var _0x05ca=function(_0x587a9f,_0x366c87){_0x587a9f=_0x587a9f-0x0;var _0x38fa2d=_0x5ca0[_0x587a9f];return _0x38fa2d;};'use strict';var _=require('lodash');var util=require(_0x05ca('0x0'));var logger=require('../../config/logger')(_0x05ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x05ca('0x2'));var fs=require('fs');var path=require(_0x05ca('0x3'));var rimraf=require(_0x05ca('0x4'));var config=require(_0x05ca('0x5'));var attributes=require('./variable.attributes');module[_0x05ca('0x6')]=function(_0x436b9e,_0x5aca0d){return _0x436b9e[_0x05ca('0x7')](_0x05ca('0x8'),attributes,{'tableName':_0x05ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd7=['exports','define','Variable','tools_variables','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./variable.attributes'];(function(_0x2c4ac7,_0x448e8c){var _0x5e0b27=function(_0x223edc){while(--_0x223edc){_0x2c4ac7['push'](_0x2c4ac7['shift']());}};_0x5e0b27(++_0x448e8c);}(_0x7bd7,0x7d));var _0x77bd=function(_0x22b788,_0x476d0e){_0x22b788=_0x22b788-0x0;var _0x171d02=_0x7bd7[_0x22b788];return _0x171d02;};'use strict';var _=require('lodash');var util=require(_0x77bd('0x0'));var logger=require(_0x77bd('0x1'))(_0x77bd('0x2'));var moment=require('moment');var BPromise=require(_0x77bd('0x3'));var rp=require(_0x77bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x77bd('0x5'));var attributes=require(_0x77bd('0x6'));module[_0x77bd('0x7')]=function(_0xee565b,_0x47bda6){return _0xee565b[_0x77bd('0x8')](_0x77bd('0x9'),attributes,{'tableName':_0x77bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index af925d4..59b1822 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 _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x22c250,_0x4fbc3c){var _0x249589=function(_0x4ec136){while(--_0x4ec136){_0x22c250['push'](_0x22c250['shift']());}};_0x249589(++_0x4fbc3c);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x4b84[_0x5751e6];return _0x4199e4;};'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')]('Variable,\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')]('Variable,\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);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file +var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x2f036c,_0x136898){var _0x496781=function(_0x11ffaf){while(--_0x11ffaf){_0x2f036c['push'](_0x2f036c['shift']());}};_0x496781(++_0x136898);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3601f2,_0x34af7a){_0x3601f2=_0x3601f2-0x0;var _0xb360a3=_0x7fbe[_0x3601f2];return _0xb360a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 36eb0fd..2702b08 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 _0x2eb2=['/pull','pull','restart','/migrations','migrations','exports','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset'];(function(_0x250769,_0x5d795c){var _0x510a25=function(_0x143624){while(--_0x143624){_0x250769['push'](_0x250769['shift']());}};_0x510a25(++_0x5d795c);}(_0x2eb2,0x1aa));var _0x22eb=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x2eb2[_0x2cf2e9];return _0xd3670d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x22eb('0x0'));var controller=require(_0x22eb('0x1'));router['get']('/',controller['index']);router[_0x22eb('0x2')](_0x22eb('0x3'),auth[_0x22eb('0x4')](),auth[_0x22eb('0x5')](),controller[_0x22eb('0x6')]);router['get'](_0x22eb('0x7'),auth[_0x22eb('0x4')](),auth[_0x22eb('0x5')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x2')](_0x22eb('0x9'),auth['isAuthenticated'](),auth[_0x22eb('0x5')](),controller[_0x22eb('0xa')]);router['get']('/restart',auth['isAuthenticated'](),controller[_0x22eb('0xb')]);router[_0x22eb('0x2')](_0x22eb('0xc'),controller[_0x22eb('0xd')]);module[_0x22eb('0xe')]=router; \ No newline at end of file +var _0x0305=['/pull','pull','restart','/migrations','express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset'];(function(_0x56bb91,_0x57108e){var _0x302fc0=function(_0x144c88){while(--_0x144c88){_0x56bb91['push'](_0x56bb91['shift']());}};_0x302fc0(++_0x57108e);}(_0x0305,0x146));var _0x5030=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x0305[_0x1d558c];return _0x15767d;};'use strict';var express=require(_0x5030('0x0'));var router=express[_0x5030('0x1')]();var auth=require(_0x5030('0x2'));var controller=require('./version.controller');router[_0x5030('0x3')]('/',controller[_0x5030('0x4')]);router[_0x5030('0x3')](_0x5030('0x5'),auth[_0x5030('0x6')](),auth[_0x5030('0x7')](),controller['fetch']);router[_0x5030('0x3')](_0x5030('0x8'),auth[_0x5030('0x6')](),auth[_0x5030('0x7')](),controller[_0x5030('0x9')]);router[_0x5030('0x3')](_0x5030('0xa'),auth[_0x5030('0x6')](),auth[_0x5030('0x7')](),controller[_0x5030('0xb')]);router['get']('/restart',auth[_0x5030('0x6')](),controller[_0x5030('0xc')]);router['get'](_0x5030('0xd'),controller['migrations']);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index c28c6aa..033e4fb 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 _0x03fb=['.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','query','latest','tags','exports','status','fetch','origin','master','error','info','git\x20fetch','json','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace'];(function(_0x436da0,_0x209460){var _0x29eba5=function(_0x5b1d9c){while(--_0x5b1d9c){_0x436da0['push'](_0x436da0['shift']());}};_0x29eba5(++_0x209460);}(_0x03fb,0x7b));var _0xb03f=function(_0x1ed54c,_0xe6599b){_0x1ed54c=_0x1ed54c-0x0;var _0x3ca3c1=_0x03fb[_0x1ed54c];return _0x3ca3c1;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0xb03f('0x0'));var pkginfo=require(_0xb03f('0x1'))(module,_0xb03f('0x2'));var compareVersions=require(_0xb03f('0x3'));var exec=require(_0xb03f('0x4'))[_0xb03f('0x5')];var db=require(_0xb03f('0x6'))['db'];var config=require(_0xb03f('0x7'));var pm2=require(_0xb03f('0x8'));var logger=require(_0xb03f('0x9'))(_0xb03f('0xa'));var git=require('simple-git')(config[_0xb03f('0xb')]);exports[_0xb03f('0xc')]=function(_0x4db5b7,_0x100612){var _0x235bef={'current':module['exports'][_0xb03f('0x2')],'phonebar':0x2};if(_0x4db5b7[_0xb03f('0xd')]&&_0x4db5b7[_0xb03f('0xd')][_0xb03f('0xe')]){return git['fetch']()[_0xb03f('0xf')](function(_0x1183f2,_0x356a9c){_0x235bef[_0xb03f('0xe')]=(_0x1183f2?module[_0xb03f('0x10')]['version']:_0x356a9c[_0xb03f('0xe')])||'2.0.0';return _0x100612[_0xb03f('0x11')](0xc8)['json'](_0x235bef);});}else{return _0x100612[_0xb03f('0x11')](0xc8)['json'](_0x235bef);}};exports[_0xb03f('0x12')]=function(_0x30456e,_0x49dfdd){return git['fetch']([_0xb03f('0x13'),_0xb03f('0x14')],function(_0x573cf9){if(_0x573cf9){logger[_0xb03f('0x15')](_0x573cf9);return _0x49dfdd[_0xb03f('0x11')](0x1f4)['json'](_0x573cf9);}logger[_0xb03f('0x16')](_0xb03f('0x17'));return _0x49dfdd[_0xb03f('0x11')](0xc8)[_0xb03f('0x18')]({'output':_0xb03f('0x19')});});};exports[_0xb03f('0x1a')]=function(_0x14b1cc,_0x3e4c95){return git['reset']([_0xb03f('0x1b'),_0xb03f('0x1c')],function(_0xfdf476){if(_0xfdf476){logger[_0xb03f('0x15')](_0xfdf476);return _0x3e4c95[_0xb03f('0x11')](0x1f4)['json'](_0xfdf476);}logger[_0xb03f('0x16')](_0xb03f('0x1d'));return _0x3e4c95[_0xb03f('0x11')](0xc8)['json']({'output':_0xb03f('0x1e')});});};exports[_0xb03f('0x1f')]=function(_0x1fb8b1,_0x4ae6bf){exec('npm\x20install\x20--production',function(_0x2e8295,_0x343b35,_0xd48cdf){logger[_0xb03f('0x16')](_0x343b35);logger[_0xb03f('0x16')](_0xd48cdf);if(_0x2e8295){logger[_0xb03f('0x15')](_0x2e8295);return _0x4ae6bf['status'](0x1f4)[_0xb03f('0x18')](_0x2e8295);}return _0x4ae6bf[_0xb03f('0x11')](0xc8)[_0xb03f('0x18')]({'output':_0x343b35});});};exports['restart']=function(_0x49f610,_0x378345){return pm2[_0xb03f('0x20')](_0xb03f('0x21'))['then'](function(_0x19ee68){logger['info']('pm2\x20restart\x20motion\x20%s',_0x19ee68);return _0x378345[_0xb03f('0x11')](0xc8)[_0xb03f('0x18')]({'output':_0xb03f('0x22')});})[_0xb03f('0x23')](function(_0x2ada6f){logger[_0xb03f('0x15')](_0x2ada6f);return _0x378345['status'](0x1f4)[_0xb03f('0x18')](_0x2ada6f);});};exports[_0xb03f('0x24')]=function(_0x316e31,_0x3bae29){var _0x4de60f=fs[_0xb03f('0x25')](path[_0xb03f('0x26')](config[_0xb03f('0xb')],_0xb03f('0x27'),_0xb03f('0x24')));var _0x481808=[];for(var _0x3d257c=0x0;_0x3d257c<_0x4de60f[_0xb03f('0x28')];_0x3d257c++){var _0xe1ca44=_0x4de60f[_0x3d257c][_0xb03f('0x29')](_0xb03f('0x2a'),'');if(compareVersions(module[_0xb03f('0x10')]['version'],_0xe1ca44)===-0x1){_0x481808[_0xb03f('0x2b')](_0xe1ca44);}}if(_0x481808[_0xb03f('0x28')]){var _0x525400=_0x481808[_0xb03f('0x2c')](compareVersions);var _0xc48f44=new Umzug({'storage':_0xb03f('0x2d'),'storageOptions':{'model':db[_0xb03f('0x2e')],'modelName':_0xb03f('0x2e'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0xb03f('0x2f')](),db[_0xb03f('0x2d')][_0xb03f('0x30')],function(){throw new Error(_0xb03f('0x31'));}],'path':path['join'](config[_0xb03f('0xb')],'server',_0xb03f('0x24')),'pattern':/\.js$/}});_0xc48f44['up']({'migrations':_[_0xb03f('0x32')](_0x525400,function(_0x45b05c){return _0x45b05c+'.js';})})['then'](function(){return _0x3bae29[_0xb03f('0x11')](0xc8)[_0xb03f('0x18')]({'output':_0xb03f('0x33')+module[_0xb03f('0x10')][_0xb03f('0x2')]+'\x20to\x20'+_[_0xb03f('0x34')](_0x525400),'migrations':_[_0xb03f('0x26')](_0x525400)});})[_0xb03f('0x23')](function(_0x3b7c0d){if(_0x3b7c0d instanceof db[_0xb03f('0x2d')][_0xb03f('0x35')]){return _0x3bae29['status'](0xc8)['json']({'output':_0xb03f('0x36')});}else{return _0x3bae29[_0xb03f('0x11')](0x1f4)['json'](_0x3b7c0d);}});}else{return _0x3bae29[_0xb03f('0x11')](0xc8)[_0xb03f('0x18')]({'output':_0xb03f('0x36')});}}; \ No newline at end of file +var _0x8752=['root','server','migrations','length','replace','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','version','query','tags','latest','exports','2.0.0','status','json','fetch','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join'];(function(_0x117eff,_0x60754e){var _0x2d3f43=function(_0x2cd12a){while(--_0x2cd12a){_0x117eff['push'](_0x117eff['shift']());}};_0x2d3f43(++_0x60754e);}(_0x8752,0x7b));var _0x2875=function(_0x209846,_0xa89356){_0x209846=_0x209846-0x0;var _0x38c236=_0x8752[_0x209846];return _0x38c236;};'use strict';var Umzug=require(_0x2875('0x0'));var path=require(_0x2875('0x1'));var fs=require('fs');var _=require(_0x2875('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x2875('0x3'));var exec=require(_0x2875('0x4'))[_0x2875('0x5')];var db=require(_0x2875('0x6'))['db'];var config=require(_0x2875('0x7'));var pm2=require(_0x2875('0x8'));var logger=require(_0x2875('0x9'))(_0x2875('0xa'));var git=require(_0x2875('0xb'))(config['root']);exports[_0x2875('0xc')]=function(_0x55bf20,_0x2f2d99){var _0x354156={'current':module['exports'][_0x2875('0xd')],'phonebar':0x2};if(_0x55bf20['query']&&_0x55bf20[_0x2875('0xe')]['latest']){return git['fetch']()[_0x2875('0xf')](function(_0x570a9d,_0xb49cb){_0x354156[_0x2875('0x10')]=(_0x570a9d?module[_0x2875('0x11')]['version']:_0xb49cb[_0x2875('0x10')])||_0x2875('0x12');return _0x2f2d99['status'](0xc8)['json'](_0x354156);});}else{return _0x2f2d99[_0x2875('0x13')](0xc8)[_0x2875('0x14')](_0x354156);}};exports[_0x2875('0x15')]=function(_0x55e093,_0x48168a){return git[_0x2875('0x15')](['origin',_0x2875('0x16')],function(_0xb2158f){if(_0xb2158f){logger[_0x2875('0x17')](_0xb2158f);return _0x48168a[_0x2875('0x13')](0x1f4)[_0x2875('0x14')](_0xb2158f);}logger[_0x2875('0x18')](_0x2875('0x19'));return _0x48168a['status'](0xc8)[_0x2875('0x14')]({'output':_0x2875('0x1a')});});};exports['reset']=function(_0x17f472,_0x25e6a8){return git[_0x2875('0x1b')]([_0x2875('0x1c'),'FETCH_HEAD'],function(_0x5c29ca){if(_0x5c29ca){logger[_0x2875('0x17')](_0x5c29ca);return _0x25e6a8[_0x2875('0x13')](0x1f4)['json'](_0x5c29ca);}logger[_0x2875('0x18')](_0x2875('0x1d'));return _0x25e6a8[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':'git\x20reset\x20--hard'});});};exports[_0x2875('0x1e')]=function(_0x52c607,_0xca6ad7){exec('npm\x20install\x20--production',function(_0x23ac82,_0x264e70,_0x17f62c){logger[_0x2875('0x18')](_0x264e70);logger[_0x2875('0x18')](_0x17f62c);if(_0x23ac82){logger[_0x2875('0x17')](_0x23ac82);return _0xca6ad7[_0x2875('0x13')](0x1f4)[_0x2875('0x14')](_0x23ac82);}return _0xca6ad7[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':_0x264e70});});};exports[_0x2875('0x1f')]=function(_0x21bcc3,_0x5eaa37){return pm2['restart'](_0x2875('0x20'))[_0x2875('0x21')](function(_0x30da24){logger[_0x2875('0x18')](_0x2875('0x22'),_0x30da24);return _0x5eaa37['status'](0xc8)[_0x2875('0x14')]({'output':_0x2875('0x23')});})[_0x2875('0x24')](function(_0x808c72){logger[_0x2875('0x17')](_0x808c72);return _0x5eaa37['status'](0x1f4)[_0x2875('0x14')](_0x808c72);});};exports['migrations']=function(_0x39e04f,_0x3baa8e){var _0x21cfb5=fs[_0x2875('0x25')](path[_0x2875('0x26')](config[_0x2875('0x27')],_0x2875('0x28'),_0x2875('0x29')));var _0x3a30de=[];for(var _0x361463=0x0;_0x361463<_0x21cfb5[_0x2875('0x2a')];_0x361463++){var _0x122036=_0x21cfb5[_0x361463][_0x2875('0x2b')]('.js','');if(compareVersions(module[_0x2875('0x11')][_0x2875('0xd')],_0x122036)===-0x1){_0x3a30de['push'](_0x122036);}}if(_0x3a30de[_0x2875('0x2a')]){var _0x2b34b9=_0x3a30de[_0x2875('0x2c')](compareVersions);var _0x5cfdcc=new Umzug({'storage':_0x2875('0x2d'),'storageOptions':{'model':db[_0x2875('0x2e')],'modelName':_0x2875('0x2e'),'columnName':_0x2875('0xd')},'migrations':{'params':[db[_0x2875('0x2d')][_0x2875('0x2f')](),db[_0x2875('0x2d')][_0x2875('0x30')],function(){throw new Error(_0x2875('0x31'));}],'path':path[_0x2875('0x26')](config[_0x2875('0x27')],_0x2875('0x28'),_0x2875('0x29')),'pattern':/\.js$/}});_0x5cfdcc['up']({'migrations':_['map'](_0x2b34b9,function(_0x3f7bc4){return _0x3f7bc4+'.js';})})[_0x2875('0x21')](function(){return _0x3baa8e[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':_0x2875('0x32')+module['exports']['version']+'\x20to\x20'+_[_0x2875('0x33')](_0x2b34b9),'migrations':_[_0x2875('0x26')](_0x2b34b9)});})[_0x2875('0x24')](function(_0x42a1a9){if(_0x42a1a9 instanceof db[_0x2875('0x2d')][_0x2875('0x34')]){return _0x3baa8e[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x3baa8e[_0x2875('0x13')](0x1f4)[_0x2875('0x14')](_0x42a1a9);}});}else{return _0x3baa8e[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':_0x2875('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d9e65bd..108230d 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 _0x7b3b=['create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xd41e13,_0x5db603){var _0x309bb9=function(_0x5ac215){while(--_0x5ac215){_0xd41e13['push'](_0xd41e13['shift']());}};_0x309bb9(++_0x5db603);}(_0x7b3b,0x117));var _0xb7b3=function(_0x3f6309,_0xd216fd){_0x3f6309=_0x3f6309-0x0;var _0x41ba77=_0x7b3b[_0x3f6309];return _0x41ba77;};'use strict';var multer=require(_0xb7b3('0x0'));var util=require(_0xb7b3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb7b3('0x2'));var router=express[_0xb7b3('0x3')]();var fs_extra=require(_0xb7b3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb7b3('0x5'));var config=require('../../config/environment');var controller=require(_0xb7b3('0x6'));router[_0xb7b3('0x7')]('/',auth[_0xb7b3('0x8')](),controller[_0xb7b3('0x9')]);router['get'](_0xb7b3('0xa'),auth[_0xb7b3('0x8')](),controller[_0xb7b3('0xb')]);router[_0xb7b3('0x7')](_0xb7b3('0xc'),auth[_0xb7b3('0x8')](),controller[_0xb7b3('0xd')]);router[_0xb7b3('0xe')]('/',auth['isAuthenticated'](),controller[_0xb7b3('0xf')]);router[_0xb7b3('0x10')](_0xb7b3('0xc'),auth['isAuthenticated'](),controller[_0xb7b3('0x11')]);router[_0xb7b3('0x12')](_0xb7b3('0xc'),auth['isAuthenticated'](),controller[_0xb7b3('0x13')]);module[_0xb7b3('0x14')]=router; \ No newline at end of file +var _0xd8fd=['put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x3f73bb,_0x5254a2){var _0x2dcc50=function(_0x467cd5){while(--_0x467cd5){_0x3f73bb['push'](_0x3f73bb['shift']());}};_0x2dcc50(++_0x5254a2);}(_0xd8fd,0x16c));var _0xdd8f=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xd8fd[_0x35af23];return _0x340506;};'use strict';var multer=require(_0xdd8f('0x0'));var util=require(_0xdd8f('0x1'));var path=require('path');var timeout=require(_0xdd8f('0x2'));var express=require(_0xdd8f('0x3'));var router=express[_0xdd8f('0x4')]();var fs_extra=require(_0xdd8f('0x5'));var auth=require(_0xdd8f('0x6'));var interaction=require(_0xdd8f('0x7'));var config=require(_0xdd8f('0x8'));var controller=require(_0xdd8f('0x9'));router[_0xdd8f('0xa')]('/',auth[_0xdd8f('0xb')](),controller['index']);router[_0xdd8f('0xa')](_0xdd8f('0xc'),auth['isAuthenticated'](),controller[_0xdd8f('0xd')]);router[_0xdd8f('0xa')](_0xdd8f('0xe'),auth[_0xdd8f('0xb')](),controller[_0xdd8f('0xf')]);router['post']('/',auth[_0xdd8f('0xb')](),controller['create']);router[_0xdd8f('0x10')](_0xdd8f('0xe'),auth[_0xdd8f('0xb')](),controller['update']);router[_0xdd8f('0x11')](_0xdd8f('0xe'),auth[_0xdd8f('0xb')](),controller[_0xdd8f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 100d94e..24a639a 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 _0xa486=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa486,0x17d));var _0x6a48=function(_0x19da9d,_0x2a0474){_0x19da9d=_0x19da9d-0x0;var _0x4137de=_0xa486[_0x19da9d];return _0x4137de;};'use strict';var Sequelize=require(_0x6a48('0x0'));module['exports']={'type':{'type':Sequelize[_0x6a48('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6a48('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6a48('0x1')]},'interface':{'type':Sequelize[_0x6a48('0x1')]},'membername':{'type':Sequelize[_0x6a48('0x1')]},'agentcalledAt':{'type':Sequelize[_0x6a48('0x2')]},'agentconnectAt':{'type':Sequelize[_0x6a48('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x6a48('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x6a48('0x2')]},'agentdumpAt':{'type':Sequelize[_0x6a48('0x2')]},'holdtime':{'type':Sequelize[_0x6a48('0x3')]},'agentcomplete':{'type':Sequelize[_0x6a48('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6a48('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6a48('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6a48('0x3')]},'agentacw':{'type':Sequelize[_0x6a48('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6a48('0x3')]},'reason':{'type':Sequelize[_0x6a48('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6a48('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6a48('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6a48('0x1')]},'connectedlinename':{'type':Sequelize[_0x6a48('0x1')]},'language':{'type':Sequelize[_0x6a48('0x1')]},'accountcode':{'type':Sequelize[_0x6a48('0x1')]},'context':{'type':Sequelize[_0x6a48('0x1')]},'exten':{'type':Sequelize[_0x6a48('0x1')]},'priority':{'type':Sequelize[_0x6a48('0x1')]},'destchannel':{'type':Sequelize[_0x6a48('0x1')]},'destchannelstate':{'type':Sequelize[_0x6a48('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6a48('0x1')]},'destcalleridnum':{'type':Sequelize[_0x6a48('0x1')]},'destcalleridname':{'type':Sequelize[_0x6a48('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x6a48('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x6a48('0x1')]},'destlanguage':{'type':Sequelize[_0x6a48('0x1')]},'destaccountcode':{'type':Sequelize[_0x6a48('0x1')]},'destcontext':{'type':Sequelize[_0x6a48('0x1')]},'destexten':{'type':Sequelize[_0x6a48('0x1')]},'destpriority':{'type':Sequelize[_0x6a48('0x1')]},'destuniqueid':{'type':Sequelize[_0x6a48('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6a48('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x6a48('0x1')]},'transfer':{'type':Sequelize[_0x6a48('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6a48('0x1')],'comment':_0x6a48('0x5')},'transferexten':{'type':Sequelize[_0x6a48('0x1')]},'transferuniqueid':{'type':Sequelize[_0x6a48('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x94e6=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94e6,0x194));var _0x694e=function(_0x8e7c55,_0x5870d1){_0x8e7c55=_0x8e7c55-0x0;var _0x2f4e2b=_0x94e6[_0x8e7c55];return _0x2f4e2b;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'type':{'type':Sequelize[_0x694e('0x1')]},'uniqueid':{'type':Sequelize[_0x694e('0x1')]},'calleridnum':{'type':Sequelize[_0x694e('0x1')]},'calleridname':{'type':Sequelize[_0x694e('0x1')]},'queue':{'type':Sequelize[_0x694e('0x1')]},'interface':{'type':Sequelize[_0x694e('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x694e('0x2')]},'agentconnectAt':{'type':Sequelize[_0x694e('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x694e('0x2')]},'holdtime':{'type':Sequelize[_0x694e('0x3')]},'agentcomplete':{'type':Sequelize[_0x694e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x694e('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x694e('0x1')]},'channel':{'type':Sequelize[_0x694e('0x1')]},'channelstate':{'type':Sequelize[_0x694e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x694e('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x694e('0x1')]},'language':{'type':Sequelize[_0x694e('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x694e('0x1')]},'exten':{'type':Sequelize[_0x694e('0x1')]},'priority':{'type':Sequelize[_0x694e('0x1')]},'destchannel':{'type':Sequelize[_0x694e('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x694e('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x694e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x694e('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x694e('0x1')]},'destlanguage':{'type':Sequelize[_0x694e('0x1')]},'destaccountcode':{'type':Sequelize[_0x694e('0x1')]},'destcontext':{'type':Sequelize[_0x694e('0x1')]},'destexten':{'type':Sequelize[_0x694e('0x1')]},'destpriority':{'type':Sequelize[_0x694e('0x1')]},'destuniqueid':{'type':Sequelize[_0x694e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x694e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x694e('0x1')]},'transfer':{'type':Sequelize[_0x694e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x694e('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x694e('0x1')]},'transferuniqueid':{'type':Sequelize[_0x694e('0x1')]},'agententerreason':{'type':Sequelize[_0x694e('0x3')],'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 a80e502..86e44f9 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(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 74fe7f7..882f322 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 _0xae1c=['VoiceAgentReport','report_agent','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define'];(function(_0x1d71b3,_0xe9adc9){var _0x1dd9d5=function(_0x209316){while(--_0x209316){_0x1d71b3['push'](_0x1d71b3['shift']());}};_0x1dd9d5(++_0xe9adc9);}(_0xae1c,0xff));var _0xcae1=function(_0x5e6434,_0x52ab7b){_0x5e6434=_0x5e6434-0x0;var _0x111321=_0xae1c[_0x5e6434];return _0x111321;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcae1('0x0'));var BPromise=require(_0xcae1('0x1'));var rp=require(_0xcae1('0x2'));var fs=require('fs');var path=require(_0xcae1('0x3'));var rimraf=require(_0xcae1('0x4'));var config=require(_0xcae1('0x5'));var attributes=require(_0xcae1('0x6'));module[_0xcae1('0x7')]=function(_0x3513e5,_0x40fcec){return _0x3513e5[_0xcae1('0x8')](_0xcae1('0x9'),attributes,{'tableName':_0xcae1('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a5a=['moment','bluebird','path','rimraf','../../config/environment','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api'];(function(_0x11304d,_0x4352b5){var _0x4475f2=function(_0x4c78f8){while(--_0x4c78f8){_0x11304d['push'](_0x11304d['shift']());}};_0x4475f2(++_0x4352b5);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x518392,_0x25ac70){_0x518392=_0x518392-0x0;var _0x344e59=_0x5a5a[_0x518392];return _0x344e59;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var logger=require(_0xa5a5('0x1'))(_0xa5a5('0x2'));var moment=require(_0xa5a5('0x3'));var BPromise=require(_0xa5a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a5('0x5'));var rimraf=require(_0xa5a5('0x6'));var config=require(_0xa5a5('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x43943d,_0x1fe96d){return _0x43943d['define'](_0xa5a5('0x8'),attributes,{'tableName':_0xa5a5('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa5a5('0xa'),_0xa5a5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 26082f7..edb62f1 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 _0xc307=['http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','create','body','options','debug','UpdateVoiceAgentReport','VoiceAgentReport','update','raw','attributes','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1439d7,_0x53e51f){var _0x54b7a8=function(_0x1abf3d){while(--_0x1abf3d){_0x1439d7['push'](_0x1439d7['shift']());}};_0x54b7a8(++_0x53e51f);}(_0xc307,0x1c8));var _0x7c30=function(_0x50aa86,_0x478c92){_0x50aa86=_0x50aa86-0x0;var _0x148b1f=_0xc307[_0x50aa86];return _0x148b1f;};'use strict';var _=require('lodash');var util=require(_0x7c30('0x0'));var moment=require(_0x7c30('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c30('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c30('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c30('0x4'))(_0x7c30('0x5'));var config=require(_0x7c30('0x6'));var jayson=require(_0x7c30('0x7'));var client=jayson[_0x7c30('0x8')][_0x7c30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x544ca9,_0x242438,_0x4c1633){return new BPromise(function(_0x4399d4,_0x306b56){return client['request'](_0x544ca9,_0x4c1633)[_0x7c30('0xa')](function(_0x11eb94){logger['info'](_0x7c30('0xb'),_0x242438,_0x7c30('0xc'));logger['debug'](_0x7c30('0xd'),_0x242438,_0x7c30('0xc'),JSON[_0x7c30('0xe')](_0x11eb94));if(_0x11eb94[_0x7c30('0xf')]){if(_0x11eb94[_0x7c30('0xf')][_0x7c30('0x10')]===0x1f4){logger[_0x7c30('0xf')](_0x7c30('0xb'),_0x242438,_0x11eb94[_0x7c30('0xf')][_0x7c30('0x11')]);return _0x306b56(_0x11eb94[_0x7c30('0xf')][_0x7c30('0x11')]);}logger['error'](_0x7c30('0xb'),_0x242438,_0x11eb94[_0x7c30('0xf')][_0x7c30('0x11')]);return _0x4399d4(_0x11eb94['error']['message']);}else{logger[_0x7c30('0x12')](_0x7c30('0xb'),_0x242438,_0x7c30('0xc'));_0x4399d4(_0x11eb94[_0x7c30('0x13')][_0x7c30('0x11')]);}})[_0x7c30('0x14')](function(_0x2749a4){logger[_0x7c30('0xf')](_0x7c30('0xb'),_0x242438,_0x2749a4);_0x306b56(_0x2749a4);});});}exports[_0x7c30('0x15')]=function(_0x192b6b){var _0x592dcc=this;return new Promise(function(_0x205ec3,_0x50d029){return db['VoiceAgentReport'][_0x7c30('0x16')](_0x192b6b[_0x7c30('0x17')],{'raw':_0x192b6b[_0x7c30('0x18')]?_0x192b6b[_0x7c30('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7c30('0xa')](function(_0x401a22){logger[_0x7c30('0x12')](_0x7c30('0x15'),_0x192b6b);logger[_0x7c30('0x19')](_0x7c30('0x15'),_0x192b6b,JSON[_0x7c30('0xe')](_0x401a22));_0x205ec3(_0x401a22);})[_0x7c30('0x14')](function(_0x5f5025){logger[_0x7c30('0xf')](_0x7c30('0x15'),_0x5f5025[_0x7c30('0x11')],_0x192b6b);_0x50d029(_0x592dcc[_0x7c30('0xf')](0x1f4,_0x5f5025[_0x7c30('0x11')]));});});};exports[_0x7c30('0x1a')]=function(_0x1b24c3){var _0x3a9484=this;return new Promise(function(_0x2f86ef,_0x36676f){return db[_0x7c30('0x1b')][_0x7c30('0x1c')](_0x1b24c3[_0x7c30('0x17')],{'raw':_0x1b24c3[_0x7c30('0x18')]?_0x1b24c3[_0x7c30('0x18')][_0x7c30('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b24c3['options']?_0x1b24c3[_0x7c30('0x18')]['where']||null:null,'attributes':_0x1b24c3[_0x7c30('0x18')]?_0x1b24c3[_0x7c30('0x18')][_0x7c30('0x1e')]||null:null,'limit':_0x1b24c3[_0x7c30('0x18')]?_0x1b24c3[_0x7c30('0x18')]['limit']||null:null})[_0x7c30('0xa')](function(_0x1e92b8){logger[_0x7c30('0x12')]('UpdateVoiceAgentReport',_0x1b24c3);logger[_0x7c30('0x19')](_0x7c30('0x1a'),_0x1b24c3,JSON[_0x7c30('0xe')](_0x1e92b8));_0x2f86ef(_0x1e92b8);})['catch'](function(_0x711bbb){logger['error'](_0x7c30('0x1a'),_0x711bbb[_0x7c30('0x11')],_0x1b24c3);_0x36676f(_0x3a9484[_0x7c30('0xf')](0x1f4,_0x711bbb[_0x7c30('0x11')]));});});}; \ No newline at end of file +var _0xf8f8=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','update','where','limit','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x30de5b,_0x49babb){var _0x532561=function(_0x179f1a){while(--_0x179f1a){_0x30de5b['push'](_0x30de5b['shift']());}};_0x532561(++_0x49babb);}(_0xf8f8,0x1b1));var _0x8f8f=function(_0x483cb8,_0x2ff5ba){_0x483cb8=_0x483cb8-0x0;var _0x4f8a19=_0xf8f8[_0x483cb8];return _0x4f8a19;};'use strict';var _=require(_0x8f8f('0x0'));var util=require(_0x8f8f('0x1'));var moment=require(_0x8f8f('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f8f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8f8f('0x4'))(_0x8f8f('0x5'));var config=require(_0x8f8f('0x6'));var jayson=require(_0x8f8f('0x7'));var client=jayson[_0x8f8f('0x8')][_0x8f8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb204,_0x2fd9c1,_0x4d0733){return new BPromise(function(_0x424fe2,_0x588abc){return client['request'](_0x2eb204,_0x4d0733)[_0x8f8f('0xa')](function(_0x1e0f99){logger[_0x8f8f('0xb')](_0x8f8f('0xc'),_0x2fd9c1,_0x8f8f('0xd'));logger[_0x8f8f('0xe')](_0x8f8f('0xf'),_0x2fd9c1,_0x8f8f('0xd'),JSON[_0x8f8f('0x10')](_0x1e0f99));if(_0x1e0f99[_0x8f8f('0x11')]){if(_0x1e0f99[_0x8f8f('0x11')][_0x8f8f('0x12')]===0x1f4){logger['error'](_0x8f8f('0xc'),_0x2fd9c1,_0x1e0f99['error'][_0x8f8f('0x13')]);return _0x588abc(_0x1e0f99['error'][_0x8f8f('0x13')]);}logger[_0x8f8f('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x2fd9c1,_0x1e0f99[_0x8f8f('0x11')][_0x8f8f('0x13')]);return _0x424fe2(_0x1e0f99[_0x8f8f('0x11')]['message']);}else{logger[_0x8f8f('0xb')](_0x8f8f('0xc'),_0x2fd9c1,'request\x20sent');_0x424fe2(_0x1e0f99[_0x8f8f('0x14')][_0x8f8f('0x13')]);}})['catch'](function(_0xc71572){logger['error'](_0x8f8f('0xc'),_0x2fd9c1,_0xc71572);_0x588abc(_0xc71572);});});}exports[_0x8f8f('0x15')]=function(_0x19bd39){var _0x300994=this;return new Promise(function(_0x5daf23,_0x454ef6){return db[_0x8f8f('0x16')][_0x8f8f('0x17')](_0x19bd39[_0x8f8f('0x18')],{'raw':_0x19bd39[_0x8f8f('0x19')]?_0x19bd39['options'][_0x8f8f('0x1a')]===undefined?!![]:![]:!![]})[_0x8f8f('0xa')](function(_0x1c994d){logger[_0x8f8f('0xb')](_0x8f8f('0x15'),_0x19bd39);logger[_0x8f8f('0xe')](_0x8f8f('0x15'),_0x19bd39,JSON[_0x8f8f('0x10')](_0x1c994d));_0x5daf23(_0x1c994d);})[_0x8f8f('0x1b')](function(_0x47ce1c){logger[_0x8f8f('0x11')]('CreateVoiceAgentReport',_0x47ce1c[_0x8f8f('0x13')],_0x19bd39);_0x454ef6(_0x300994['error'](0x1f4,_0x47ce1c[_0x8f8f('0x13')]));});});};exports[_0x8f8f('0x1c')]=function(_0x3c2962){var _0xabcc3d=this;return new Promise(function(_0x151489,_0x2451a0){return db[_0x8f8f('0x16')][_0x8f8f('0x1d')](_0x3c2962[_0x8f8f('0x18')],{'raw':_0x3c2962[_0x8f8f('0x19')]?_0x3c2962[_0x8f8f('0x19')][_0x8f8f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c2962['options']?_0x3c2962[_0x8f8f('0x19')][_0x8f8f('0x1e')]||null:null,'attributes':_0x3c2962[_0x8f8f('0x19')]?_0x3c2962[_0x8f8f('0x19')]['attributes']||null:null,'limit':_0x3c2962[_0x8f8f('0x19')]?_0x3c2962['options'][_0x8f8f('0x1f')]||null:null})[_0x8f8f('0xa')](function(_0x504613){logger[_0x8f8f('0xb')](_0x8f8f('0x1c'),_0x3c2962);logger['debug'](_0x8f8f('0x1c'),_0x3c2962,JSON[_0x8f8f('0x10')](_0x504613));_0x151489(_0x504613);})[_0x8f8f('0x1b')](function(_0x141202){logger[_0x8f8f('0x11')](_0x8f8f('0x1c'),_0x141202['message'],_0x3c2962);_0x2451a0(_0xabcc3d['error'](0x1f4,_0x141202[_0x8f8f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 9e37def..003c17b 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(_0x457402,_0x396df5){var _0x23e76d=function(_0x145810){while(--_0x145810){_0x457402['push'](_0x457402['shift']());}};_0x23e76d(++_0x396df5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0x5fc3[_0x13992d];return _0x3d15bf;};'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 _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x1ab15b,_0x8d1762){var _0xa4d038=function(_0x323679){while(--_0x323679){_0x1ab15b['push'](_0x1ab15b['shift']());}};_0xa4d038(++_0x8d1762);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5a3b09,_0x24a4a3){_0x5a3b09=_0x5a3b09-0x0;var _0x46298a=_0xd0bb[_0x5a3b09];return _0x46298a;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 90591f9..6f7762a 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 _0xdb2b=['inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound'];(function(_0x46811d,_0x44df36){var _0x36e67c=function(_0x17299b){while(--_0x17299b){_0x46811d['push'](_0x46811d['shift']());}};_0x36e67c(++_0x44df36);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x1062e3,_0x49349e){_0x1062e3=_0x1062e3-0x0;var _0x92e616=_0xdb2b[_0x1062e3];return _0x92e616;};'use strict';var Sequelize=require(_0xbdb2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbdb2('0x1')]},'type':{'type':Sequelize[_0xbdb2('0x2')](_0xbdb2('0x3'),_0xbdb2('0x4'),_0xbdb2('0x5'),_0xbdb2('0x6'),_0xbdb2('0x7'),_0xbdb2('0x8'))},'tag':{'type':Sequelize[_0xbdb2('0x1')]},'accountcode':{'type':Sequelize[_0xbdb2('0x1')]},'source':{'type':Sequelize[_0xbdb2('0x1')]},'destination':{'type':Sequelize[_0xbdb2('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbdb2('0x1')]},'destinationchannel':{'type':Sequelize[_0xbdb2('0x1')]},'lastapplication':{'type':Sequelize[_0xbdb2('0x1')]},'lastdata':{'type':Sequelize[_0xbdb2('0x9')]},'starttime':{'type':Sequelize[_0xbdb2('0xa')]},'systemanswertime':{'type':Sequelize[_0xbdb2('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbdb2('0xa')]},'duration':{'type':Sequelize[_0xbdb2('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xbdb2('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbdb2('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xbdb2('0x1')]},'userDisposition':{'type':Sequelize[_0xbdb2('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xbdb2('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbdb2('0x1')]},'prefix':{'type':Sequelize[_0xbdb2('0x1')]},'routeid':{'type':Sequelize[_0xbdb2('0xb')]},'sipcallid':{'type':Sequelize[_0xbdb2('0x1')]}}; \ No newline at end of file +var _0x5bd4=['outbound-fax','STRING','DATE','INTEGER','sequelize','exports','inbound','outbound','inbound-fax'];(function(_0x12bdac,_0x435c03){var _0x3a4e49=function(_0xf8865d){while(--_0xf8865d){_0x12bdac['push'](_0x12bdac['shift']());}};_0x3a4e49(++_0x435c03);}(_0x5bd4,0x163));var _0x45bd=function(_0x28765a,_0x5241c0){_0x28765a=_0x28765a-0x0;var _0x399b2c=_0x5bd4[_0x28765a];return _0x399b2c;};'use strict';var Sequelize=require(_0x45bd('0x0'));module[_0x45bd('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x45bd('0x2'),'internal',_0x45bd('0x3'),_0x45bd('0x4'),_0x45bd('0x5'),'dialer')},'tag':{'type':Sequelize[_0x45bd('0x6')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x45bd('0x6')]},'destination':{'type':Sequelize[_0x45bd('0x6')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x45bd('0x6')]},'channel':{'type':Sequelize[_0x45bd('0x6')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x45bd('0x7')]},'systemanswertime':{'type':Sequelize[_0x45bd('0x7')]},'answertime':{'type':Sequelize[_0x45bd('0x7')]},'endtime':{'type':Sequelize[_0x45bd('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x45bd('0x8')]},'mohtime':{'type':Sequelize[_0x45bd('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x45bd('0x6')]},'amaflags':{'type':Sequelize[_0x45bd('0x6')]},'userfield':{'type':Sequelize[_0x45bd('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x45bd('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x45bd('0x6')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x45bd('0x8')]},'sipcallid':{'type':Sequelize[_0x45bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8eb00bc..dac6883 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 _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(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0xadb5,0xad));var _0x5adb=function(_0x42ba08,_0x1d90a5){_0x42ba08=_0x42ba08-0x0;var _0x29977a=_0xadb5[_0x42ba08];return _0x29977a;};'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 +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(_0x575b98,_0x3e312c){var _0x51ad93=function(_0x565956){while(--_0x565956){_0x575b98['push'](_0x575b98['shift']());}};_0x51ad93(++_0x3e312c);}(_0x0b0e,0x187));var _0xe0b0=function(_0xf33afd,_0x2363b6){_0xf33afd=_0xf33afd-0x0;var _0x5f432a=_0x0b0e[_0xf33afd];return _0x5f432a;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 466a326..7387a36 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 _0x92d4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3c13ae,_0x531f44){var _0x38411c=function(_0x187f91){while(--_0x187f91){_0x3c13ae['push'](_0x3c13ae['shift']());}};_0x38411c(++_0x531f44);}(_0x92d4,0x6c));var _0x492d=function(_0x5840fb,_0x478054){_0x5840fb=_0x5840fb-0x0;var _0x407e5b=_0x92d4[_0x5840fb];return _0x407e5b;};'use strict';var _=require(_0x492d('0x0'));var util=require(_0x492d('0x1'));var logger=require(_0x492d('0x2'))(_0x492d('0x3'));var moment=require(_0x492d('0x4'));var BPromise=require(_0x492d('0x5'));var rp=require(_0x492d('0x6'));var fs=require('fs');var path=require(_0x492d('0x7'));var rimraf=require(_0x492d('0x8'));var config=require(_0x492d('0x9'));var attributes=require(_0x492d('0xa'));module['exports']=function(_0x12981d,_0x558cb3){return _0x12981d['define'](_0x492d('0xb'),attributes,{'tableName':_0x492d('0xc'),'paranoid':![],'indexes':[{'fields':[_0x492d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb64=['../../config/environment','exports','define','VoiceCallReport','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f4223,_0x5540a8){var _0x546de7=function(_0x201fdf){while(--_0x201fdf){_0x2f4223['push'](_0x2f4223['shift']());}};_0x546de7(++_0x5540a8);}(_0xcb64,0x179));var _0x4cb6=function(_0x403908,_0xa870c9){_0x403908=_0x403908-0x0;var _0x4a630b=_0xcb64[_0x403908];return _0x4a630b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4cb6('0x0'))(_0x4cb6('0x1'));var moment=require(_0x4cb6('0x2'));var BPromise=require(_0x4cb6('0x3'));var rp=require(_0x4cb6('0x4'));var fs=require('fs');var path=require(_0x4cb6('0x5'));var rimraf=require(_0x4cb6('0x6'));var config=require(_0x4cb6('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x4cb6('0x8')]=function(_0x146086,_0x196a6c){return _0x146086[_0x4cb6('0x9')](_0x4cb6('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4cb6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index aac85da..ca40b0b 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 _0xeeaf=['result','catch','findAll','raw','options','where','attributes','limit','include','model','map','then','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','body','stringify','update','UpdateVoiceCallReport','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceCallReport,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent'];(function(_0xf1c96c,_0x116265){var _0x23632a=function(_0x2e7301){while(--_0x2e7301){_0xf1c96c['push'](_0xf1c96c['shift']());}};_0x23632a(++_0x116265);}(_0xeeaf,0x1b6));var _0xfeea=function(_0x448654,_0x5d8357){_0x448654=_0x448654-0x0;var _0x5a7b3d=_0xeeaf[_0x448654];return _0x5a7b3d;};'use strict';var _=require(_0xfeea('0x0'));var util=require('util');var moment=require(_0xfeea('0x1'));var BPromise=require(_0xfeea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfeea('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfeea('0x4'))(_0xfeea('0x5'));var config=require(_0xfeea('0x6'));var jayson=require(_0xfeea('0x7'));var client=jayson[_0xfeea('0x8')][_0xfeea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x439d40,_0x1dbff0,_0x298462){return new BPromise(function(_0x2c0b2c,_0x3f16ed){return client[_0xfeea('0xa')](_0x439d40,_0x298462)['then'](function(_0x1620a9){logger['info'](_0xfeea('0xb'),_0x1dbff0,'request\x20sent');logger[_0xfeea('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1dbff0,'request\x20sent',JSON['stringify'](_0x1620a9));if(_0x1620a9[_0xfeea('0xd')]){if(_0x1620a9[_0xfeea('0xd')][_0xfeea('0xe')]===0x1f4){logger['error'](_0xfeea('0xb'),_0x1dbff0,_0x1620a9[_0xfeea('0xd')][_0xfeea('0xf')]);return _0x3f16ed(_0x1620a9[_0xfeea('0xd')][_0xfeea('0xf')]);}logger[_0xfeea('0xd')](_0xfeea('0xb'),_0x1dbff0,_0x1620a9[_0xfeea('0xd')]['message']);return _0x2c0b2c(_0x1620a9[_0xfeea('0xd')][_0xfeea('0xf')]);}else{logger[_0xfeea('0x10')](_0xfeea('0xb'),_0x1dbff0,_0xfeea('0x11'));_0x2c0b2c(_0x1620a9[_0xfeea('0x12')][_0xfeea('0xf')]);}})[_0xfeea('0x13')](function(_0x1e0d05){logger[_0xfeea('0xd')](_0xfeea('0xb'),_0x1dbff0,_0x1e0d05);_0x3f16ed(_0x1e0d05);});});}exports['GetVoiceCallReport']=function(_0x1f16c1){var _0x37f7d9=this;return new Promise(function(_0x5bc374,_0x1d4903){return db['VoiceCallReport'][_0xfeea('0x14')]({'raw':_0x1f16c1['options']?_0x1f16c1['options'][_0xfeea('0x15')]===undefined?!![]:![]:!![],'where':_0x1f16c1[_0xfeea('0x16')]?_0x1f16c1[_0xfeea('0x16')][_0xfeea('0x17')]||null:null,'attributes':_0x1f16c1[_0xfeea('0x16')]?_0x1f16c1['options'][_0xfeea('0x18')]||null:null,'limit':_0x1f16c1['options']?_0x1f16c1[_0xfeea('0x16')][_0xfeea('0x19')]||null:null,'include':_0x1f16c1['options']?_0x1f16c1[_0xfeea('0x16')][_0xfeea('0x1a')]?_['map'](_0x1f16c1[_0xfeea('0x16')][_0xfeea('0x1a')],function(_0x6b5ec5){return{'model':db[_0x6b5ec5[_0xfeea('0x1b')]],'as':_0x6b5ec5['as'],'attributes':_0x6b5ec5[_0xfeea('0x18')],'include':_0x6b5ec5['include']?_[_0xfeea('0x1c')](_0x6b5ec5[_0xfeea('0x1a')],function(_0x4f0c42){return{'model':db[_0x4f0c42['model']],'as':_0x4f0c42['as'],'attributes':_0x4f0c42[_0xfeea('0x18')],'include':_0x4f0c42[_0xfeea('0x1a')]?_['map'](_0x4f0c42[_0xfeea('0x1a')],function(_0x29a98e){return{'model':db[_0x29a98e[_0xfeea('0x1b')]],'as':_0x29a98e['as'],'attributes':_0x29a98e['attributes']};}):[]};}):[]};}):[]:[]})[_0xfeea('0x1d')](function(_0x5c86a2){logger['info'](_0xfeea('0x1e'),_0x1f16c1);logger['debug'](_0xfeea('0x1e'),_0x1f16c1,JSON['stringify'](_0x5c86a2));_0x5bc374(_0x5c86a2);})[_0xfeea('0x13')](function(_0x1d4e7d){logger[_0xfeea('0xd')]('GetVoiceCallReport',_0x1d4e7d[_0xfeea('0xf')],_0x1f16c1);_0x1d4903(_0x37f7d9[_0xfeea('0xd')](0x1f4,_0x1d4e7d[_0xfeea('0xf')]));});});};exports[_0xfeea('0x1f')]=function(_0x124f6d){var _0xd5eea7=this;return new Promise(function(_0x58fdad,_0x4bbe83){return db[_0xfeea('0x20')][_0xfeea('0x21')](_0x124f6d[_0xfeea('0x22')],{'raw':_0x124f6d['options']?_0x124f6d['options'][_0xfeea('0x15')]===undefined?!![]:![]:!![]})[_0xfeea('0x1d')](function(_0xaa7e39){logger[_0xfeea('0x10')](_0xfeea('0x1f'),_0x124f6d);logger[_0xfeea('0xc')]('CreateVoiceCallReport',_0x124f6d,JSON[_0xfeea('0x23')](_0xaa7e39));_0x58fdad(_0xaa7e39);})[_0xfeea('0x13')](function(_0x512717){logger[_0xfeea('0xd')](_0xfeea('0x1f'),_0x512717['message'],_0x124f6d);_0x4bbe83(_0xd5eea7[_0xfeea('0xd')](0x1f4,_0x512717[_0xfeea('0xf')]));});});};exports['UpdateVoiceCallReport']=function(_0x5f1a40){var _0x1225f1=this;return new Promise(function(_0x2251d3,_0x3ec495){return db[_0xfeea('0x20')][_0xfeea('0x24')](_0x5f1a40[_0xfeea('0x22')],{'raw':_0x5f1a40[_0xfeea('0x16')]?_0x5f1a40[_0xfeea('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f1a40[_0xfeea('0x16')]?_0x5f1a40[_0xfeea('0x16')][_0xfeea('0x17')]||null:null,'attributes':_0x5f1a40[_0xfeea('0x16')]?_0x5f1a40[_0xfeea('0x16')]['attributes']||null:null,'limit':_0x5f1a40['options']?_0x5f1a40['options']['limit']||null:null})['then'](function(_0x4fdd6b){logger[_0xfeea('0x10')](_0xfeea('0x25'),_0x5f1a40);logger[_0xfeea('0xc')](_0xfeea('0x25'),_0x5f1a40,JSON['stringify'](_0x4fdd6b));_0x2251d3(_0x4fdd6b);})['catch'](function(_0x3dc3e4){logger[_0xfeea('0xd')](_0xfeea('0x25'),_0x3dc3e4[_0xfeea('0xf')],_0x5f1a40);_0x3ec495(_0x1225f1['error'](0x1f4,_0x3dc3e4['message']));});});}; \ No newline at end of file +var _0x0497=['UpdateVoiceCallReport','update','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','stringify','CreateVoiceCallReport','create','body'];(function(_0x23883f,_0x4d5e01){var _0x318173=function(_0x246987){while(--_0x246987){_0x23883f['push'](_0x23883f['shift']());}};_0x318173(++_0x4d5e01);}(_0x0497,0x1af));var _0x7049=function(_0x139db3,_0x22a5bf){_0x139db3=_0x139db3-0x0;var _0xde6ed7=_0x0497[_0x139db3];return _0xde6ed7;};'use strict';var _=require(_0x7049('0x0'));var util=require(_0x7049('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7049('0x2'));var fs=require('fs');var Redis=require(_0x7049('0x3'));var db=require(_0x7049('0x4'))['db'];var utils=require(_0x7049('0x5'));var logger=require(_0x7049('0x6'))(_0x7049('0x7'));var config=require(_0x7049('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7049('0x9')][_0x7049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x69b6ca,_0x1f14b4,_0x400311){return new BPromise(function(_0x4727a2,_0x46c9f9){return client[_0x7049('0xb')](_0x69b6ca,_0x400311)[_0x7049('0xc')](function(_0xa454ee){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x1f14b4,_0x7049('0xd'));logger[_0x7049('0xe')](_0x7049('0xf'),_0x1f14b4,_0x7049('0xd'),JSON['stringify'](_0xa454ee));if(_0xa454ee['error']){if(_0xa454ee[_0x7049('0x10')]['code']===0x1f4){logger['error'](_0x7049('0x11'),_0x1f14b4,_0xa454ee[_0x7049('0x10')][_0x7049('0x12')]);return _0x46c9f9(_0xa454ee['error'][_0x7049('0x12')]);}logger[_0x7049('0x10')](_0x7049('0x11'),_0x1f14b4,_0xa454ee[_0x7049('0x10')][_0x7049('0x12')]);return _0x4727a2(_0xa454ee[_0x7049('0x10')][_0x7049('0x12')]);}else{logger[_0x7049('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x1f14b4,_0x7049('0xd'));_0x4727a2(_0xa454ee[_0x7049('0x14')]['message']);}})[_0x7049('0x15')](function(_0x3e4068){logger[_0x7049('0x10')](_0x7049('0x11'),_0x1f14b4,_0x3e4068);_0x46c9f9(_0x3e4068);});});}exports[_0x7049('0x16')]=function(_0x1aaf9e){var _0x58a562=this;return new Promise(function(_0x473622,_0xd4116f){return db[_0x7049('0x17')][_0x7049('0x18')]({'raw':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e[_0x7049('0x19')][_0x7049('0x1a')]===undefined?!![]:![]:!![],'where':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e[_0x7049('0x19')][_0x7049('0x1b')]||null:null,'attributes':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e['options'][_0x7049('0x1c')]||null:null,'limit':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e[_0x7049('0x19')][_0x7049('0x1d')]||null:null,'include':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e['options']['include']?_[_0x7049('0x1e')](_0x1aaf9e['options']['include'],function(_0x635ab1){return{'model':db[_0x635ab1['model']],'as':_0x635ab1['as'],'attributes':_0x635ab1[_0x7049('0x1c')],'include':_0x635ab1[_0x7049('0x1f')]?_['map'](_0x635ab1[_0x7049('0x1f')],function(_0x5e8077){return{'model':db[_0x5e8077['model']],'as':_0x5e8077['as'],'attributes':_0x5e8077[_0x7049('0x1c')],'include':_0x5e8077[_0x7049('0x1f')]?_['map'](_0x5e8077[_0x7049('0x1f')],function(_0x4a95d4){return{'model':db[_0x4a95d4[_0x7049('0x20')]],'as':_0x4a95d4['as'],'attributes':_0x4a95d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7049('0xc')](function(_0x2a886f){logger[_0x7049('0x13')](_0x7049('0x16'),_0x1aaf9e);logger[_0x7049('0xe')](_0x7049('0x16'),_0x1aaf9e,JSON[_0x7049('0x21')](_0x2a886f));_0x473622(_0x2a886f);})[_0x7049('0x15')](function(_0x4a123f){logger[_0x7049('0x10')]('GetVoiceCallReport',_0x4a123f['message'],_0x1aaf9e);_0xd4116f(_0x58a562['error'](0x1f4,_0x4a123f['message']));});});};exports[_0x7049('0x22')]=function(_0x24f97){var _0x1178ca=this;return new Promise(function(_0x2777f0,_0x2d8521){return db['VoiceCallReport'][_0x7049('0x23')](_0x24f97[_0x7049('0x24')],{'raw':_0x24f97[_0x7049('0x19')]?_0x24f97[_0x7049('0x19')][_0x7049('0x1a')]===undefined?!![]:![]:!![]})[_0x7049('0xc')](function(_0x434eaf){logger[_0x7049('0x13')]('CreateVoiceCallReport',_0x24f97);logger[_0x7049('0xe')](_0x7049('0x22'),_0x24f97,JSON[_0x7049('0x21')](_0x434eaf));_0x2777f0(_0x434eaf);})[_0x7049('0x15')](function(_0x125ed1){logger[_0x7049('0x10')]('CreateVoiceCallReport',_0x125ed1[_0x7049('0x12')],_0x24f97);_0x2d8521(_0x1178ca[_0x7049('0x10')](0x1f4,_0x125ed1[_0x7049('0x12')]));});});};exports[_0x7049('0x25')]=function(_0x49d981){var _0x25e173=this;return new Promise(function(_0x2643b6,_0x5c5f7b){return db[_0x7049('0x17')][_0x7049('0x26')](_0x49d981['body'],{'raw':_0x49d981[_0x7049('0x19')]?_0x49d981[_0x7049('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49d981['options']?_0x49d981[_0x7049('0x19')][_0x7049('0x1b')]||null:null,'attributes':_0x49d981['options']?_0x49d981[_0x7049('0x19')]['attributes']||null:null,'limit':_0x49d981['options']?_0x49d981[_0x7049('0x19')][_0x7049('0x1d')]||null:null})[_0x7049('0xc')](function(_0x2d6c28){logger[_0x7049('0x13')](_0x7049('0x25'),_0x49d981);logger[_0x7049('0xe')](_0x7049('0x25'),_0x49d981,JSON[_0x7049('0x21')](_0x2d6c28));_0x2643b6(_0x2d6c28);})[_0x7049('0x15')](function(_0x891225){logger[_0x7049('0x10')](_0x7049('0x25'),_0x891225[_0x7049('0x12')],_0x49d981);_0x5c5f7b(_0x25e173['error'](0x1f4,_0x891225[_0x7049('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index acc8b08..03ec6b9 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 _0xfdd1=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','post','isAuthenticated','create','delete','/:id','destroy'];(function(_0x1d9214,_0x39b7e5){var _0x35a973=function(_0x4dc751){while(--_0x4dc751){_0x1d9214['push'](_0x1d9214['shift']());}};_0x35a973(++_0x39b7e5);}(_0xfdd1,0xab));var _0x1fdd=function(_0x38a162,_0x4396b2){_0x38a162=_0x38a162-0x0;var _0x1f622b=_0xfdd1[_0x38a162];return _0x1f622b;};'use strict';var multer=require(_0x1fdd('0x0'));var util=require(_0x1fdd('0x1'));var path=require(_0x1fdd('0x2'));var timeout=require(_0x1fdd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1fdd('0x4'));var auth=require(_0x1fdd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1fdd('0x6'));var controller=require(_0x1fdd('0x7'));router[_0x1fdd('0x8')]('/',auth['isAuthenticated'](),controller[_0x1fdd('0x9')]);router[_0x1fdd('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1fdd('0xa')]('/',auth[_0x1fdd('0xb')](),controller[_0x1fdd('0xc')]);router['put']('/:id',auth[_0x1fdd('0xb')](),controller['update']);router[_0x1fdd('0xd')](_0x1fdd('0xe'),auth[_0x1fdd('0xb')](),controller[_0x1fdd('0xf')]);module[_0x1fdd('0x10')]=router; \ No newline at end of file +var _0x27f0=['update','delete','exports','multer','util','fs-extra','../../components/interaction/service','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','create'];(function(_0x53a34c,_0x25cffd){var _0x3dda74=function(_0x559ccd){while(--_0x559ccd){_0x53a34c['push'](_0x53a34c['shift']());}};_0x3dda74(++_0x25cffd);}(_0x27f0,0x137));var _0x027f=function(_0x4a94cf,_0x4756c1){_0x4a94cf=_0x4a94cf-0x0;var _0x41bcf4=_0x27f0[_0x4a94cf];return _0x41bcf4;};'use strict';var multer=require(_0x027f('0x0'));var util=require(_0x027f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x027f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x027f('0x3'));var config=require('../../config/environment');var controller=require(_0x027f('0x4'));router[_0x027f('0x5')]('/',auth['isAuthenticated'](),controller[_0x027f('0x6')]);router['get'](_0x027f('0x7'),auth[_0x027f('0x8')](),controller[_0x027f('0x9')]);router['post']('/',auth[_0x027f('0x8')](),controller[_0x027f('0xa')]);router['put']('/:id',auth[_0x027f('0x8')](),controller[_0x027f('0xb')]);router[_0x027f('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x027f('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 134911b..c70a057 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 _0xd030=['getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','options'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0xd030,0xb3));var _0x0d03=function(_0x3a8cec,_0x193cee){_0x3a8cec=_0x3a8cec-0x0;var _0x2c2509=_0xd030[_0x3a8cec];return _0x2c2509;};'use strict';var Sequelize=require(_0x0d03('0x0'));module['exports']={'name':{'type':Sequelize[_0x0d03('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x0d03('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2cb080){this[_0x0d03('0x3')](_0x0d03('0x4'),_0x2cb080?_0x2cb080['join'](''):[]);},'get':function(){return this['getDataValue'](_0x0d03('0x4'))?this[_0x0d03('0x5')](_0x0d03('0x4'))[_0x0d03('0x6')](''):[];}},'auth':{'type':Sequelize[_0x0d03('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x0d03('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0d03('0x1')]},'description':{'type':Sequelize[_0x0d03('0x1')]}}; \ No newline at end of file +var _0x830d=['name','options','getDataValue','split','BOOLEAN','STRING','sequelize','exports'];(function(_0x61ca0c,_0x555ec8){var _0x5e6bcf=function(_0x4873f4){while(--_0x4873f4){_0x61ca0c['push'](_0x61ca0c['shift']());}};_0x5e6bcf(++_0x555ec8);}(_0x830d,0x1a6));var _0xd830=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x830d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd830('0x0'));module[_0xd830('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xd830('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x3e6be9){this['setDataValue'](_0xd830('0x3'),_0x3e6be9?_0x3e6be9['join'](''):[]);},'get':function(){return this[_0xd830('0x4')](_0xd830('0x3'))?this[_0xd830('0x4')](_0xd830('0x3'))[_0xd830('0x5')](''):[];}},'auth':{'type':Sequelize[_0xd830('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xd830('0x7')]},'record':{'type':Sequelize[_0xd830('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd830('0x7')]},'description':{'type':Sequelize[_0xd830('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b282825..423c01d 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 _0x2392=['update','then','destroy','get','ChanSpies','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','catch','params','keys','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply'];(function(_0x3768e4,_0x446f5e){var _0x38645f=function(_0x342889){while(--_0x342889){_0x3768e4['push'](_0x3768e4['shift']());}};_0x38645f(++_0x446f5e);}(_0x2392,0xd0));var _0x2239=function(_0x528f40,_0x384220){_0x528f40=_0x528f40-0x0;var _0x3951a9=_0x2392[_0x528f40];return _0x3951a9;};'use strict';var emlformat=require(_0x2239('0x0'));var rimraf=require(_0x2239('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2239('0x2'));var rp=require(_0x2239('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2239('0x4'));var util=require(_0x2239('0x5'));var path=require(_0x2239('0x6'));var sox=require(_0x2239('0x7'));var csv=require(_0x2239('0x8'));var ejs=require(_0x2239('0x9'));var fs=require('fs');var fs_extra=require(_0x2239('0xa'));var _=require(_0x2239('0xb'));var squel=require(_0x2239('0xc'));var crypto=require(_0x2239('0xd'));var jsforce=require(_0x2239('0xe'));var deskjs=require(_0x2239('0xf'));var toCsv=require(_0x2239('0x8'));var querystring=require('querystring');var Papa=require(_0x2239('0x10'));var Redis=require(_0x2239('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2239('0x12'));var hardwareService=require(_0x2239('0x13'));var logger=require(_0x2239('0x14'))(_0x2239('0x15'));var utils=require(_0x2239('0x16'));var config=require(_0x2239('0x17'));var licenseUtil=require(_0x2239('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4702dd,_0x3cee95){_0x3cee95=_0x3cee95||0xcc;return function(_0x4af7b7){if(_0x4af7b7){return _0x4702dd[_0x2239('0x19')](_0x3cee95);}return _0x4702dd[_0x2239('0x1a')](_0x3cee95)[_0x2239('0x1b')]();};}function respondWithResult(_0x3338b0,_0x5165dc){_0x5165dc=_0x5165dc||0xc8;return function(_0x367c82){if(_0x367c82){return _0x3338b0['status'](_0x5165dc)[_0x2239('0x1c')](_0x367c82);}};}function respondWithFilteredResult(_0x163e09,_0x4236da){return function(_0x472ce2){if(_0x472ce2){var _0x4f23ce=typeof _0x4236da[_0x2239('0x1d')]===_0x2239('0x1e')&&typeof _0x4236da['limit']===_0x2239('0x1e');var _0x4f218a=_0x472ce2[_0x2239('0x1f')];var _0x558138=_0x4f23ce?0x0:_0x4236da[_0x2239('0x1d')];var _0x594f20=_0x4f23ce?_0x472ce2[_0x2239('0x1f')]:_0x4236da[_0x2239('0x1d')]+_0x4236da[_0x2239('0x20')];var _0x3d8fd9;if(_0x594f20>=_0x4f218a){_0x594f20=_0x4f218a;_0x3d8fd9=0xc8;}else{_0x3d8fd9=0xce;}_0x163e09['status'](_0x3d8fd9);return _0x163e09[_0x2239('0x21')]('Content-Range',_0x558138+'-'+_0x594f20+'/'+_0x4f218a)[_0x2239('0x1c')](_0x472ce2);}return null;};}function patchUpdates(_0x4917cb){return function(_0x174bf7){try{jsonpatch[_0x2239('0x22')](_0x174bf7,_0x4917cb,!![]);}catch(_0x2c2d74){return BPromise['reject'](_0x2c2d74);}return _0x174bf7['save']();};}function saveUpdates(_0x2b2000,_0x521079){return function(_0x2f625d){if(_0x2f625d){return _0x2f625d[_0x2239('0x23')](_0x2b2000)[_0x2239('0x24')](function(_0x407581){return _0x407581;});}return null;};}function removeEntity(_0x54af84,_0x1f1f49){return function(_0x12133e){if(_0x12133e){return _0x12133e[_0x2239('0x25')]()[_0x2239('0x24')](function(){var _0x5c0fa7=_0x12133e[_0x2239('0x26')]({'plain':!![]});var _0x44e671=_0x2239('0x27');return db['UserProfileResource'][_0x2239('0x25')]({'where':{'type':_0x44e671,'resourceId':_0x5c0fa7['id']}})[_0x2239('0x24')](function(){return _0x12133e;});})[_0x2239('0x24')](function(){_0x54af84[_0x2239('0x1a')](0xcc)[_0x2239('0x1b')]();});}};}function handleEntityNotFound(_0x1937ee,_0xcb6711){return function(_0x4f4135){if(!_0x4f4135){_0x1937ee['sendStatus'](0x194);}return _0x4f4135;};}function handleError(_0x4a970a,_0x587ebc){_0x587ebc=_0x587ebc||0x1f4;return function(_0x576ac9){logger[_0x2239('0x28')](_0x576ac9[_0x2239('0x29')]);if(_0x576ac9[_0x2239('0x2a')]){delete _0x576ac9[_0x2239('0x2a')];}_0x4a970a['status'](_0x587ebc)[_0x2239('0x2b')](_0x576ac9);};}exports[_0x2239('0x2c')]=function(_0x3e164a,_0x23fab8){var _0xbf989f={},_0xac6fe8={},_0x26f3f2={'count':0x0,'rows':[]};var _0x5a9cdf=_[_0x2239('0x2d')](db[_0x2239('0x2e')][_0x2239('0x2f')],function(_0x3cc74c){return{'name':_0x3cc74c[_0x2239('0x30')],'type':_0x3cc74c['type'][_0x2239('0x31')]};});_0xac6fe8[_0x2239('0x32')]=_['map'](_0x5a9cdf,'name');_0xac6fe8['query']=_['keys'](_0x3e164a['query']);_0xac6fe8[_0x2239('0x33')]=_[_0x2239('0x34')](_0xac6fe8[_0x2239('0x32')],_0xac6fe8[_0x2239('0x35')]);_0xbf989f[_0x2239('0x36')]=_['intersection'](_0xac6fe8[_0x2239('0x32')],qs[_0x2239('0x37')](_0x3e164a[_0x2239('0x35')]['fields']));_0xbf989f[_0x2239('0x36')]=_0xbf989f[_0x2239('0x36')][_0x2239('0x38')]?_0xbf989f['attributes']:_0xac6fe8['model'];if(!_0x3e164a['query'][_0x2239('0x39')](_0x2239('0x3a'))){_0xbf989f[_0x2239('0x20')]=qs['limit'](_0x3e164a['query'][_0x2239('0x20')]);_0xbf989f['offset']=qs[_0x2239('0x1d')](_0x3e164a[_0x2239('0x35')][_0x2239('0x1d')]);}_0xbf989f[_0x2239('0x3b')]=qs['sort'](_0x3e164a[_0x2239('0x35')][_0x2239('0x3c')]);_0xbf989f[_0x2239('0x3d')]=qs[_0x2239('0x33')](_[_0x2239('0x3e')](_0x3e164a[_0x2239('0x35')],_0xac6fe8[_0x2239('0x33')]),_0x5a9cdf);if(_0x3e164a[_0x2239('0x35')]['filter']){_0xbf989f[_0x2239('0x3d')]=_[_0x2239('0x3f')](_0xbf989f[_0x2239('0x3d')],{'$or':_[_0x2239('0x2d')](_0x5a9cdf,function(_0x45136b){if(_0x45136b[_0x2239('0x40')]!==_0x2239('0x41')){var _0x1c55ef={};_0x1c55ef[_0x45136b[_0x2239('0x2a')]]={'$like':'%'+_0x3e164a[_0x2239('0x35')]['filter']+'%'};return _0x1c55ef;}})});}_0xbf989f=_[_0x2239('0x3f')]({},_0xbf989f,_0x3e164a[_0x2239('0x42')]);var _0x16304d={'where':_0xbf989f[_0x2239('0x3d')]};return db['VoiceChanSpy']['count'](_0x16304d)[_0x2239('0x24')](function(_0x546862){_0x26f3f2[_0x2239('0x1f')]=_0x546862;if(_0x3e164a['query'][_0x2239('0x43')]){_0xbf989f[_0x2239('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0xbf989f);})['then'](function(_0x4242c2){_0x26f3f2['rows']=_0x4242c2;return _0x26f3f2;})[_0x2239('0x24')](respondWithFilteredResult(_0x23fab8,_0xbf989f))[_0x2239('0x45')](handleError(_0x23fab8,null));};exports['show']=function(_0x2a2a6a,_0x1f9aa1){var _0x153449={'raw':![],'where':{'id':_0x2a2a6a[_0x2239('0x46')]['id']}},_0x1f6288={};_0x1f6288[_0x2239('0x32')]=_[_0x2239('0x47')](db[_0x2239('0x2e')][_0x2239('0x2f')]);_0x1f6288['query']=_[_0x2239('0x47')](_0x2a2a6a['query']);_0x1f6288[_0x2239('0x33')]=_['intersection'](_0x1f6288[_0x2239('0x32')],_0x1f6288[_0x2239('0x35')]);_0x153449['attributes']=_[_0x2239('0x34')](_0x1f6288['model'],qs[_0x2239('0x37')](_0x2a2a6a[_0x2239('0x35')][_0x2239('0x37')]));_0x153449['attributes']=_0x153449['attributes']['length']?_0x153449[_0x2239('0x36')]:_0x1f6288[_0x2239('0x32')];if(_0x2a2a6a[_0x2239('0x35')][_0x2239('0x43')]){_0x153449[_0x2239('0x44')]=[{'all':!![]}];}_0x153449=_[_0x2239('0x3f')]({},_0x153449,_0x2a2a6a['options']);return db[_0x2239('0x2e')][_0x2239('0x48')](_0x153449)[_0x2239('0x24')](handleEntityNotFound(_0x1f9aa1,null))['then'](respondWithResult(_0x1f9aa1,null))[_0x2239('0x45')](handleError(_0x1f9aa1,null));};exports['create']=function(_0x4a9c3c,_0x410bc6){return db[_0x2239('0x2e')][_0x2239('0x49')](_0x4a9c3c[_0x2239('0x4a')],{})[_0x2239('0x24')](function(_0x51bcad){var _0xba071b=_0x4a9c3c[_0x2239('0x4b')]['get']({'plain':!![]});if(!_0xba071b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xba071b['role']===_0x2239('0x4b')){var _0x51f5d3=_0x51bcad[_0x2239('0x26')]({'plain':!![]});var _0x4b674b=_0x2239('0x27');return db[_0x2239('0x4c')][_0x2239('0x48')]({'where':{'name':_0x4b674b,'userProfileId':_0xba071b[_0x2239('0x4d')]},'raw':!![]})['then'](function(_0x509651){if(_0x509651&&_0x509651[_0x2239('0x4e')]===0x0){return db[_0x2239('0x4f')][_0x2239('0x49')]({'name':_0x51f5d3[_0x2239('0x2a')],'resourceId':_0x51f5d3['id'],'type':_0x509651[_0x2239('0x2a')],'sectionId':_0x509651['id']},{})['then'](function(){return _0x51bcad;});}else{return _0x51bcad;}})[_0x2239('0x45')](function(_0x430c56){logger[_0x2239('0x28')](_0x2239('0x50'),_0x430c56);throw _0x430c56;});}return _0x51bcad;})[_0x2239('0x24')](respondWithResult(_0x410bc6,0xc9))['catch'](handleError(_0x410bc6,null));};exports[_0x2239('0x23')]=function(_0x2286f6,_0x4bf50f){if(_0x2286f6[_0x2239('0x4a')]['id']){delete _0x2286f6[_0x2239('0x4a')]['id'];}return db['VoiceChanSpy'][_0x2239('0x48')]({'where':{'id':_0x2286f6[_0x2239('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bf50f,null))[_0x2239('0x24')](saveUpdates(_0x2286f6[_0x2239('0x4a')],null))['then'](respondWithResult(_0x4bf50f,null))[_0x2239('0x45')](handleError(_0x4bf50f,null));};exports[_0x2239('0x25')]=function(_0x3ef97,_0x1ffbb6){return db[_0x2239('0x2e')][_0x2239('0x48')]({'where':{'id':_0x3ef97[_0x2239('0x46')]['id']}})[_0x2239('0x24')](handleEntityNotFound(_0x1ffbb6,null))[_0x2239('0x24')](removeEntity(_0x1ffbb6,null))[_0x2239('0x45')](handleError(_0x1ffbb6,null));}; \ No newline at end of file +var _0x4b6c=['params','fields','include','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','ChanSpies','end','error','name','map','VoiceChanSpy','fieldName','type','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x1f574f,_0xf4a4c6){var _0x5ce3e5=function(_0x2b77f5){while(--_0x2b77f5){_0x1f574f['push'](_0x1f574f['shift']());}};_0x5ce3e5(++_0xf4a4c6);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc4b6('0x0'));var rimraf=require(_0xc4b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4b6('0x2'));var rp=require(_0xc4b6('0x3'));var moment=require(_0xc4b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc4b6('0x5'));var util=require(_0xc4b6('0x6'));var path=require(_0xc4b6('0x7'));var sox=require('sox');var csv=require(_0xc4b6('0x8'));var ejs=require(_0xc4b6('0x9'));var fs=require('fs');var fs_extra=require(_0xc4b6('0xa'));var _=require(_0xc4b6('0xb'));var squel=require('squel');var crypto=require(_0xc4b6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4b6('0x8'));var querystring=require(_0xc4b6('0xd'));var Papa=require(_0xc4b6('0xe'));var Redis=require(_0xc4b6('0xf'));var authService=require(_0xc4b6('0x10'));var qs=require(_0xc4b6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4b6('0x12'));var logger=require(_0xc4b6('0x13'))('api');var utils=require(_0xc4b6('0x14'));var config=require(_0xc4b6('0x15'));var licenseUtil=require(_0xc4b6('0x16'));var db=require(_0xc4b6('0x17'))['db'];function respondWithStatusCode(_0x286a5a,_0xd6208e){_0xd6208e=_0xd6208e||0xcc;return function(_0xf2a30e){if(_0xf2a30e){return _0x286a5a[_0xc4b6('0x18')](_0xd6208e);}return _0x286a5a[_0xc4b6('0x19')](_0xd6208e)['end']();};}function respondWithResult(_0x21ee35,_0x2b7aab){_0x2b7aab=_0x2b7aab||0xc8;return function(_0x5d9008){if(_0x5d9008){return _0x21ee35[_0xc4b6('0x19')](_0x2b7aab)['json'](_0x5d9008);}};}function respondWithFilteredResult(_0x41be8d,_0x408652){return function(_0x20c517){if(_0x20c517){var _0x23144b=typeof _0x408652['offset']==='undefined'&&typeof _0x408652[_0xc4b6('0x1a')]===_0xc4b6('0x1b');var _0x403f94=_0x20c517[_0xc4b6('0x1c')];var _0x220dfd=_0x23144b?0x0:_0x408652[_0xc4b6('0x1d')];var _0x471bf8=_0x23144b?_0x20c517[_0xc4b6('0x1c')]:_0x408652[_0xc4b6('0x1d')]+_0x408652[_0xc4b6('0x1a')];var _0x5c1f92;if(_0x471bf8>=_0x403f94){_0x471bf8=_0x403f94;_0x5c1f92=0xc8;}else{_0x5c1f92=0xce;}_0x41be8d[_0xc4b6('0x19')](_0x5c1f92);return _0x41be8d['set'](_0xc4b6('0x1e'),_0x220dfd+'-'+_0x471bf8+'/'+_0x403f94)[_0xc4b6('0x1f')](_0x20c517);}return null;};}function patchUpdates(_0x44618b){return function(_0x15a3de){try{jsonpatch[_0xc4b6('0x20')](_0x15a3de,_0x44618b,!![]);}catch(_0x2f207d){return BPromise[_0xc4b6('0x21')](_0x2f207d);}return _0x15a3de[_0xc4b6('0x22')]();};}function saveUpdates(_0x51090f,_0x8fcdde){return function(_0x41fedf){if(_0x41fedf){return _0x41fedf[_0xc4b6('0x23')](_0x51090f)[_0xc4b6('0x24')](function(_0x24592a){return _0x24592a;});}return null;};}function removeEntity(_0x214801,_0x2c2d35){return function(_0x81b146){if(_0x81b146){return _0x81b146[_0xc4b6('0x25')]()['then'](function(){var _0x5a6eff=_0x81b146['get']({'plain':!![]});var _0x392b0f=_0xc4b6('0x26');return db['UserProfileResource'][_0xc4b6('0x25')]({'where':{'type':_0x392b0f,'resourceId':_0x5a6eff['id']}})[_0xc4b6('0x24')](function(){return _0x81b146;});})['then'](function(){_0x214801[_0xc4b6('0x19')](0xcc)[_0xc4b6('0x27')]();});}};}function handleEntityNotFound(_0x1ce21c,_0x3340f3){return function(_0x1ee8d3){if(!_0x1ee8d3){_0x1ce21c[_0xc4b6('0x18')](0x194);}return _0x1ee8d3;};}function handleError(_0x1a1432,_0x391f5b){_0x391f5b=_0x391f5b||0x1f4;return function(_0x31a9de){logger[_0xc4b6('0x28')](_0x31a9de['stack']);if(_0x31a9de[_0xc4b6('0x29')]){delete _0x31a9de[_0xc4b6('0x29')];}_0x1a1432[_0xc4b6('0x19')](_0x391f5b)['send'](_0x31a9de);};}exports['index']=function(_0x1fbdc0,_0x4ef594){var _0x3ec5c1={},_0x1bf9a6={},_0x1e8135={'count':0x0,'rows':[]};var _0x5b5298=_[_0xc4b6('0x2a')](db[_0xc4b6('0x2b')]['rawAttributes'],function(_0x403b43){return{'name':_0x403b43[_0xc4b6('0x2c')],'type':_0x403b43[_0xc4b6('0x2d')]['key']};});_0x1bf9a6['model']=_[_0xc4b6('0x2a')](_0x5b5298,_0xc4b6('0x29'));_0x1bf9a6['query']=_[_0xc4b6('0x2e')](_0x1fbdc0['query']);_0x1bf9a6[_0xc4b6('0x2f')]=_[_0xc4b6('0x30')](_0x1bf9a6[_0xc4b6('0x31')],_0x1bf9a6[_0xc4b6('0x32')]);_0x3ec5c1[_0xc4b6('0x33')]=_[_0xc4b6('0x30')](_0x1bf9a6[_0xc4b6('0x31')],qs['fields'](_0x1fbdc0['query']['fields']));_0x3ec5c1[_0xc4b6('0x33')]=_0x3ec5c1[_0xc4b6('0x33')][_0xc4b6('0x34')]?_0x3ec5c1[_0xc4b6('0x33')]:_0x1bf9a6['model'];if(!_0x1fbdc0['query'][_0xc4b6('0x35')](_0xc4b6('0x36'))){_0x3ec5c1[_0xc4b6('0x1a')]=qs[_0xc4b6('0x1a')](_0x1fbdc0[_0xc4b6('0x32')][_0xc4b6('0x1a')]);_0x3ec5c1[_0xc4b6('0x1d')]=qs['offset'](_0x1fbdc0[_0xc4b6('0x32')][_0xc4b6('0x1d')]);}_0x3ec5c1['order']=qs[_0xc4b6('0x37')](_0x1fbdc0[_0xc4b6('0x32')][_0xc4b6('0x37')]);_0x3ec5c1[_0xc4b6('0x38')]=qs[_0xc4b6('0x2f')](_[_0xc4b6('0x39')](_0x1fbdc0[_0xc4b6('0x32')],_0x1bf9a6[_0xc4b6('0x2f')]),_0x5b5298);if(_0x1fbdc0[_0xc4b6('0x32')]['filter']){_0x3ec5c1[_0xc4b6('0x38')]=_['merge'](_0x3ec5c1[_0xc4b6('0x38')],{'$or':_[_0xc4b6('0x2a')](_0x5b5298,function(_0x3c975b){if(_0x3c975b['type']!==_0xc4b6('0x3a')){var _0x4594e5={};_0x4594e5[_0x3c975b[_0xc4b6('0x29')]]={'$like':'%'+_0x1fbdc0[_0xc4b6('0x32')]['filter']+'%'};return _0x4594e5;}})});}_0x3ec5c1=_['merge']({},_0x3ec5c1,_0x1fbdc0[_0xc4b6('0x3b')]);var _0x379656={'where':_0x3ec5c1[_0xc4b6('0x38')]};return db[_0xc4b6('0x2b')][_0xc4b6('0x1c')](_0x379656)['then'](function(_0x3ec107){_0x1e8135['count']=_0x3ec107;if(_0x1fbdc0['query'][_0xc4b6('0x3c')]){_0x3ec5c1['include']=[{'all':!![]}];}return db[_0xc4b6('0x2b')][_0xc4b6('0x3d')](_0x3ec5c1);})[_0xc4b6('0x24')](function(_0x555acf){_0x1e8135[_0xc4b6('0x3e')]=_0x555acf;return _0x1e8135;})[_0xc4b6('0x24')](respondWithFilteredResult(_0x4ef594,_0x3ec5c1))[_0xc4b6('0x3f')](handleError(_0x4ef594,null));};exports[_0xc4b6('0x40')]=function(_0x26b362,_0x4265f4){var _0x5584af={'raw':![],'where':{'id':_0x26b362[_0xc4b6('0x41')]['id']}},_0x5aaea2={};_0x5aaea2[_0xc4b6('0x31')]=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x5aaea2[_0xc4b6('0x32')]=_[_0xc4b6('0x2e')](_0x26b362[_0xc4b6('0x32')]);_0x5aaea2[_0xc4b6('0x2f')]=_[_0xc4b6('0x30')](_0x5aaea2[_0xc4b6('0x31')],_0x5aaea2[_0xc4b6('0x32')]);_0x5584af['attributes']=_[_0xc4b6('0x30')](_0x5aaea2[_0xc4b6('0x31')],qs[_0xc4b6('0x42')](_0x26b362[_0xc4b6('0x32')][_0xc4b6('0x42')]));_0x5584af[_0xc4b6('0x33')]=_0x5584af[_0xc4b6('0x33')]['length']?_0x5584af['attributes']:_0x5aaea2[_0xc4b6('0x31')];if(_0x26b362[_0xc4b6('0x32')][_0xc4b6('0x3c')]){_0x5584af[_0xc4b6('0x43')]=[{'all':!![]}];}_0x5584af=_['merge']({},_0x5584af,_0x26b362[_0xc4b6('0x3b')]);return db[_0xc4b6('0x2b')][_0xc4b6('0x44')](_0x5584af)[_0xc4b6('0x24')](handleEntityNotFound(_0x4265f4,null))['then'](respondWithResult(_0x4265f4,null))[_0xc4b6('0x3f')](handleError(_0x4265f4,null));};exports['create']=function(_0x1b66b5,_0x2f272f){return db['VoiceChanSpy'][_0xc4b6('0x45')](_0x1b66b5['body'],{})[_0xc4b6('0x24')](function(_0x1cd03f){var _0x28d6f6=_0x1b66b5[_0xc4b6('0x46')][_0xc4b6('0x47')]({'plain':!![]});if(!_0x28d6f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28d6f6[_0xc4b6('0x48')]===_0xc4b6('0x46')){var _0x444b8b=_0x1cd03f[_0xc4b6('0x47')]({'plain':!![]});var _0x3e94df=_0xc4b6('0x26');return db[_0xc4b6('0x49')][_0xc4b6('0x44')]({'where':{'name':_0x3e94df,'userProfileId':_0x28d6f6[_0xc4b6('0x4a')]},'raw':!![]})['then'](function(_0x273c58){if(_0x273c58&&_0x273c58[_0xc4b6('0x4b')]===0x0){return db[_0xc4b6('0x4c')][_0xc4b6('0x45')]({'name':_0x444b8b[_0xc4b6('0x29')],'resourceId':_0x444b8b['id'],'type':_0x273c58[_0xc4b6('0x29')],'sectionId':_0x273c58['id']},{})[_0xc4b6('0x24')](function(){return _0x1cd03f;});}else{return _0x1cd03f;}})[_0xc4b6('0x3f')](function(_0x56d6d7){logger['error'](_0xc4b6('0x4d'),_0x56d6d7);throw _0x56d6d7;});}return _0x1cd03f;})[_0xc4b6('0x24')](respondWithResult(_0x2f272f,0xc9))['catch'](handleError(_0x2f272f,null));};exports[_0xc4b6('0x23')]=function(_0x290cd4,_0xed498b){if(_0x290cd4[_0xc4b6('0x4e')]['id']){delete _0x290cd4[_0xc4b6('0x4e')]['id'];}return db['VoiceChanSpy'][_0xc4b6('0x44')]({'where':{'id':_0x290cd4[_0xc4b6('0x41')]['id']}})['then'](handleEntityNotFound(_0xed498b,null))[_0xc4b6('0x24')](saveUpdates(_0x290cd4[_0xc4b6('0x4e')],null))['then'](respondWithResult(_0xed498b,null))['catch'](handleError(_0xed498b,null));};exports[_0xc4b6('0x25')]=function(_0x5a04f7,_0x4d0bd3){return db[_0xc4b6('0x2b')][_0xc4b6('0x44')]({'where':{'id':_0x5a04f7['params']['id']}})[_0xc4b6('0x24')](handleEntityNotFound(_0x4d0bd3,null))[_0xc4b6('0x24')](removeEntity(_0x4d0bd3,null))['catch'](handleError(_0x4d0bd3,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4b7a8b5..99be694 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 _0x9095=['bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','Set','CDR(type)=%s','chanspy','record','push','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension'];(function(_0x434a01,_0x25989d){var _0x43d9f8=function(_0x3ec6c1){while(--_0x3ec6c1){_0x434a01['push'](_0x434a01['shift']());}};_0x43d9f8(++_0x25989d);}(_0x9095,0x1f0));var _0x5909=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x9095[_0x22b68a];return _0x1ac67a;};'use strict';var _=require(_0x5909('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x5909('0x1'));var getUserApplications=function(_0x43200c,_0x10aba7,_0x535a99){var _0xdd7f42=0x1;var _0x808860=[];var _0xcaed28={'context':_0x10aba7[_0x5909('0x2')]||_0x5909('0x3'),'exten':util[_0x5909('0x4')]('%s%s',_0x43200c[_0x5909('0x5')],_0x535a99),'type':_0x5909('0x6'),'isApp':![],'ChanSpyId':_0x43200c['id'],'UserId':_0x10aba7['id']};_0x808860['push'](_['merge']({'app':_0x5909('0x7'),'appdata':util[_0x5909('0x4')](_0x5909('0x8'),_0x5909('0x9')),'priority':_0xdd7f42++},_0xcaed28));if(_0x43200c[_0x5909('0xa')]){_0x808860[_0x5909('0xb')](_[_0x5909('0xc')]({'app':_0x5909('0xd'),'appdata':util[_0x5909('0x4')](_0x5909('0xe'),_0x43200c[_0x5909('0xf')]),'priority':_0xdd7f42++},_0xcaed28));}if(_0x43200c[_0x5909('0x10')]){_0x808860['push'](_[_0x5909('0xc')]({'app':'Authenticate','appdata':_0x43200c[_0x5909('0x11')],'priority':_0xdd7f42++},_0xcaed28));}_0x808860[_0x5909('0xb')](_['merge']({'app':'ChanSpy','appdata':util[_0x5909('0x4')]('SIP/%s,%s',_0x10aba7[_0x5909('0x12')],_0x43200c[_0x5909('0x13')]?_0x43200c['options'][_0x5909('0x14')](''):''),'priority':_0xdd7f42++},_0xcaed28));if(_0x43200c[_0x5909('0xa')]){_0x808860[_0x5909('0xb')](_[_0x5909('0xc')]({'app':_0x5909('0x15'),'priority':_0xdd7f42++},_0xcaed28));}return _0x808860;};var getChanSpyApplications=function(_0x27551b,_0x4b5d87){var _0x3dfa3c=[];for(var _0x2ca8e6=0x0,_0x4a8090=0x1;_0x2ca8e6<_0x4b5d87[_0x5909('0x16')];_0x2ca8e6++,_0x4a8090=0x1){_0x3dfa3c=_0x3dfa3c[_0x5909('0x17')](getUserApplications(_0x27551b,_0x4b5d87[_0x2ca8e6],_0x4b5d87[_0x2ca8e6][_0x5909('0x18')]));if(_0x4b5d87[_0x2ca8e6][_0x5909('0x18')]!=_0x4b5d87[_0x2ca8e6][_0x5909('0x12')]){_0x3dfa3c=_0x3dfa3c['concat'](getUserApplications(_0x27551b,_0x4b5d87[_0x2ca8e6],_0x4b5d87[_0x2ca8e6][_0x5909('0x12')]));}}return _0x3dfa3c;};var getChanSpyPromise=function(_0x1ed912,_0x58689b){return new BPromise(function(_0x5ddaf4,_0x3cfba4){return _0x1ed912[_0x5909('0x19')][_0x5909('0x1a')]({'attributes':['id','name','internal'],'where':{'role':_0x5909('0x1b'),'chanspy':!![]},'raw':!![]})[_0x5909('0x1c')](function(_0x3b7dcf){if(_0x3b7dcf){return _0x5ddaf4(getChanSpyApplications(_0x58689b,_0x3b7dcf));}return _0x5ddaf4([]);})[_0x5909('0x1d')](function(_0x268b24){_0x3cfba4(_0x268b24);});});};module[_0x5909('0x1e')]=function(_0x4be2fe,_0x2076a3){var _0x4f786b=_0x4be2fe[_0x5909('0x1f')];return _0x4be2fe[_0x5909('0x20')](_0x5909('0x21'),attributes,{'tableName':_0x5909('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x404456,_0x4fdf01,_0x4f8c97){return getChanSpyPromise(_0x4f786b,_0x404456)[_0x5909('0x1c')](function(_0x5dac1d){if(_0x5dac1d&&_0x5dac1d['length']){return _0x4f786b[_0x5909('0x23')][_0x5909('0x24')](_0x5dac1d);}})[_0x5909('0x1c')](function(){_0x4f8c97();})['catch'](function(_0x55dd84){_0x4f8c97(_0x55dd84);});},'afterUpdate':function(_0x3f7052,_0x1c57a5,_0x22ea71){return _0x4f786b[_0x5909('0x23')][_0x5909('0x25')]({'where':{'ChanSpyId':_0x3f7052['id']}})[_0x5909('0x1c')](function(){return getChanSpyPromise(_0x4f786b,_0x3f7052);})[_0x5909('0x1c')](function(_0x5675f7){if(_0x5675f7&&_0x5675f7[_0x5909('0x16')]){return _0x4f786b[_0x5909('0x23')]['bulkCreate'](_0x5675f7);}})['then'](function(){_0x22ea71();})[_0x5909('0x1d')](function(_0x4320eb){_0x22ea71(_0x4320eb);});},'afterDestroy':function(_0x3be939,_0x399404,_0x1e3e3d){return _0x4f786b[_0x5909('0x23')][_0x5909('0x25')]({'where':{'ChanSpyId':_0x3be939['id']}})[_0x5909('0x1c')](function(){_0x1e3e3d();})[_0x5909('0x1d')](function(_0x34ba76){_0x1e3e3d(_0x34ba76);});}}});}; \ No newline at end of file +var _0xa8a6=['MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record'];(function(_0xe81457,_0xf64918){var _0x346607=function(_0xea90b1){while(--_0xea90b1){_0xe81457['push'](_0xe81457['shift']());}};_0x346607(++_0xf64918);}(_0xa8a6,0xd5));var _0x6a8a=function(_0x1f4ff3,_0x48e8e5){_0x1f4ff3=_0x1f4ff3-0x0;var _0x4d017f=_0xa8a6[_0x1f4ff3];return _0x4d017f;};'use strict';var _=require(_0x6a8a('0x0'));var util=require(_0x6a8a('0x1'));var BPromise=require(_0x6a8a('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3fc6a8,_0x47dc1d,_0x4ddc25){var _0x469ca1=0x1;var _0x16a9f8=[];var _0x19bf40={'context':_0x47dc1d[_0x6a8a('0x3')]||_0x6a8a('0x4'),'exten':util[_0x6a8a('0x5')](_0x6a8a('0x6'),_0x3fc6a8[_0x6a8a('0x7')],_0x4ddc25),'type':_0x6a8a('0x8'),'isApp':![],'ChanSpyId':_0x3fc6a8['id'],'UserId':_0x47dc1d['id']};_0x16a9f8[_0x6a8a('0x9')](_[_0x6a8a('0xa')]({'app':_0x6a8a('0xb'),'appdata':util[_0x6a8a('0x5')](_0x6a8a('0xc'),_0x6a8a('0xd')),'priority':_0x469ca1++},_0x19bf40));if(_0x3fc6a8[_0x6a8a('0xe')]){_0x16a9f8[_0x6a8a('0x9')](_[_0x6a8a('0xa')]({'app':_0x6a8a('0xf'),'appdata':util[_0x6a8a('0x5')](_0x6a8a('0x10'),_0x3fc6a8[_0x6a8a('0x11')]),'priority':_0x469ca1++},_0x19bf40));}if(_0x3fc6a8['auth']){_0x16a9f8[_0x6a8a('0x9')](_['merge']({'app':'Authenticate','appdata':_0x3fc6a8[_0x6a8a('0x12')],'priority':_0x469ca1++},_0x19bf40));}_0x16a9f8['push'](_[_0x6a8a('0xa')]({'app':'ChanSpy','appdata':util['format'](_0x6a8a('0x13'),_0x47dc1d['name'],_0x3fc6a8['options']?_0x3fc6a8[_0x6a8a('0x14')][_0x6a8a('0x15')](''):''),'priority':_0x469ca1++},_0x19bf40));if(_0x3fc6a8[_0x6a8a('0xe')]){_0x16a9f8[_0x6a8a('0x9')](_[_0x6a8a('0xa')]({'app':_0x6a8a('0x16'),'priority':_0x469ca1++},_0x19bf40));}return _0x16a9f8;};var getChanSpyApplications=function(_0x32c976,_0x5a40e2){var _0xcccaf6=[];for(var _0x5dcb22=0x0,_0x40fb42=0x1;_0x5dcb22<_0x5a40e2[_0x6a8a('0x17')];_0x5dcb22++,_0x40fb42=0x1){_0xcccaf6=_0xcccaf6[_0x6a8a('0x18')](getUserApplications(_0x32c976,_0x5a40e2[_0x5dcb22],_0x5a40e2[_0x5dcb22][_0x6a8a('0x19')]));if(_0x5a40e2[_0x5dcb22][_0x6a8a('0x19')]!=_0x5a40e2[_0x5dcb22][_0x6a8a('0x1a')]){_0xcccaf6=_0xcccaf6[_0x6a8a('0x18')](getUserApplications(_0x32c976,_0x5a40e2[_0x5dcb22],_0x5a40e2[_0x5dcb22][_0x6a8a('0x1a')]));}}return _0xcccaf6;};var getChanSpyPromise=function(_0x2b4b21,_0x55de2e){return new BPromise(function(_0x5ec39e,_0x109231){return _0x2b4b21[_0x6a8a('0x1b')]['findAll']({'attributes':['id','name','internal'],'where':{'role':_0x6a8a('0x1c'),'chanspy':!![]},'raw':!![]})[_0x6a8a('0x1d')](function(_0x20c0d0){if(_0x20c0d0){return _0x5ec39e(getChanSpyApplications(_0x55de2e,_0x20c0d0));}return _0x5ec39e([]);})[_0x6a8a('0x1e')](function(_0x410318){_0x109231(_0x410318);});});};module[_0x6a8a('0x1f')]=function(_0x56deb0,_0x469235){var _0x413c90=_0x56deb0[_0x6a8a('0x20')];return _0x56deb0[_0x6a8a('0x21')]('VoiceChanSpy',attributes,{'tableName':_0x6a8a('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x478334,_0x5cab07,_0x1663b9){return getChanSpyPromise(_0x413c90,_0x478334)['then'](function(_0x2a5749){if(_0x2a5749&&_0x2a5749[_0x6a8a('0x17')]){return _0x413c90[_0x6a8a('0x23')][_0x6a8a('0x24')](_0x2a5749);}})[_0x6a8a('0x1d')](function(){_0x1663b9();})[_0x6a8a('0x1e')](function(_0x4c7dd2){_0x1663b9(_0x4c7dd2);});},'afterUpdate':function(_0x14a724,_0x18832a,_0x2725b7){return _0x413c90[_0x6a8a('0x23')]['destroy']({'where':{'ChanSpyId':_0x14a724['id']}})[_0x6a8a('0x1d')](function(){return getChanSpyPromise(_0x413c90,_0x14a724);})[_0x6a8a('0x1d')](function(_0x25a7b9){if(_0x25a7b9&&_0x25a7b9['length']){return _0x413c90[_0x6a8a('0x23')][_0x6a8a('0x24')](_0x25a7b9);}})[_0x6a8a('0x1d')](function(){_0x2725b7();})[_0x6a8a('0x1e')](function(_0x341c01){_0x2725b7(_0x341c01);});},'afterDestroy':function(_0xf8b2f8,_0x3764f6,_0x207b90){return _0x413c90[_0x6a8a('0x23')][_0x6a8a('0x25')]({'where':{'ChanSpyId':_0xf8b2f8['id']}})[_0x6a8a('0x1d')](function(){_0x207b90();})[_0x6a8a('0x1e')](function(_0x18ed22){_0x207b90(_0x18ed22);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 3de7770..235d379 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 _0x2f68=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug'];(function(_0x4e639c,_0x1f97e0){var _0x5e9f4d=function(_0x3e93b3){while(--_0x3e93b3){_0x4e639c['push'](_0x4e639c['shift']());}};_0x5e9f4d(++_0x1f97e0);}(_0x2f68,0x9a));var _0x82f6=function(_0x1c85d2,_0x19177b){_0x1c85d2=_0x1c85d2-0x0;var _0x4a3b90=_0x2f68[_0x1c85d2];return _0x4a3b90;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});} \ No newline at end of file +var _0x765e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x765e,0x131));var _0xe765=function(_0xca1007,_0x320874){_0xca1007=_0xca1007-0x0;var _0x2e871e=_0x765e[_0xca1007];return _0x2e871e;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var moment=require(_0xe765('0x2'));var BPromise=require(_0xe765('0x3'));var rs=require(_0xe765('0x4'));var fs=require('fs');var Redis=require(_0xe765('0x5'));var db=require(_0xe765('0x6'))['db'];var utils=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var jayson=require(_0xe765('0xb'));var client=jayson[_0xe765('0xc')][_0xe765('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdd89e7,_0x504542,_0x35d891){return new BPromise(function(_0x28e955,_0x27b0f4){return client[_0xe765('0xe')](_0xdd89e7,_0x35d891)[_0xe765('0xf')](function(_0x41801f){logger[_0xe765('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x504542,_0xe765('0x11'));logger[_0xe765('0x12')](_0xe765('0x13'),_0x504542,'request\x20sent',JSON[_0xe765('0x14')](_0x41801f));if(_0x41801f['error']){if(_0x41801f['error']['code']===0x1f4){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x27b0f4(_0x41801f[_0xe765('0x15')]['message']);}logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x28e955(_0x41801f[_0xe765('0x15')]['message']);}else{logger['info'](_0xe765('0x16'),_0x504542,_0xe765('0x11'));_0x28e955(_0x41801f[_0xe765('0x18')]['message']);}})[_0xe765('0x19')](function(_0x36aca3){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x36aca3);_0x27b0f4(_0x36aca3);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 0ed5d85..5be6a6a 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 _0x9344=['update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','isAuthenticated','get','/:id','show','post','create','put'];(function(_0x78f35e,_0x14f71f){var _0x445627=function(_0x3db789){while(--_0x3db789){_0x78f35e['push'](_0x78f35e['shift']());}};_0x445627(++_0x14f71f);}(_0x9344,0xc8));var _0x4934=function(_0x3160b1,_0x1af397){_0x3160b1=_0x3160b1-0x0;var _0x5242c9=_0x9344[_0x3160b1];return _0x5242c9;};'use strict';var multer=require('multer');var util=require(_0x4934('0x0'));var path=require(_0x4934('0x1'));var timeout=require(_0x4934('0x2'));var express=require(_0x4934('0x3'));var router=express[_0x4934('0x4')]();var fs_extra=require(_0x4934('0x5'));var auth=require(_0x4934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4934('0x7'));var controller=require(_0x4934('0x8'));router['get']('/',auth[_0x4934('0x9')](),controller['index']);router[_0x4934('0xa')](_0x4934('0xb'),auth['isAuthenticated'](),controller[_0x4934('0xc')]);router[_0x4934('0xd')]('/',auth['isAuthenticated'](),controller[_0x4934('0xe')]);router[_0x4934('0xf')](_0x4934('0xb'),auth[_0x4934('0x9')](),controller[_0x4934('0x10')]);router[_0x4934('0x11')]('/:id',auth[_0x4934('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd0b2=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','destroy'];(function(_0x4b5c41,_0x1e8c22){var _0x45df0d=function(_0x25ebb6){while(--_0x25ebb6){_0x4b5c41['push'](_0x4b5c41['shift']());}};_0x45df0d(++_0x1e8c22);}(_0xd0b2,0x1a0));var _0x2d0b=function(_0xcbb5c0,_0x48ea1a){_0xcbb5c0=_0xcbb5c0-0x0;var _0x24f193=_0xd0b2[_0xcbb5c0];return _0x24f193;};'use strict';var multer=require(_0x2d0b('0x0'));var util=require(_0x2d0b('0x1'));var path=require(_0x2d0b('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d0b('0x3'));var router=express[_0x2d0b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2d0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2d0b('0x6'));var controller=require(_0x2d0b('0x7'));router[_0x2d0b('0x8')]('/',auth[_0x2d0b('0x9')](),controller[_0x2d0b('0xa')]);router[_0x2d0b('0x8')](_0x2d0b('0xb'),auth['isAuthenticated'](),controller[_0x2d0b('0xc')]);router[_0x2d0b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d0b('0xe')](_0x2d0b('0xb'),auth[_0x2d0b('0x9')](),controller['update']);router['delete'](_0x2d0b('0xb'),auth[_0x2d0b('0x9')](),controller[_0x2d0b('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 4354a48..b74e360 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 _0x77b7=['sequelize','STRING','name'];(function(_0x1f5a63,_0x511504){var _0x30bb7a=function(_0x476310){while(--_0x476310){_0x1f5a63['push'](_0x1f5a63['shift']());}};_0x30bb7a(++_0x511504);}(_0x77b7,0x72));var _0x777b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x77b7[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x777b('0x0'));module['exports']={'name':{'type':Sequelize[_0x777b('0x1')],'unique':_0x777b('0x2')},'description':{'type':Sequelize[_0x777b('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2a3a=['sequelize','STRING','name'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2a3a,0x14a));var _0xa2a3=function(_0x48cde1,_0x530178){_0x48cde1=_0x48cde1-0x0;var _0x2d623f=_0x2a3a[_0x48cde1];return _0x2d623f;};'use strict';var Sequelize=require(_0xa2a3('0x0'));module['exports']={'name':{'type':Sequelize[_0xa2a3('0x1')],'unique':_0xa2a3('0x2')},'description':{'type':Sequelize[_0xa2a3('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 92273d1..347acf4 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 _0xf350=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','map','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','merge','find','create','findAll','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','get','role','user','UserProfileSection','userProfileId','update','body','server/files/templates/context.ejs','readFileSync','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','destroy','then','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf350,0x94));var _0x0f35=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf350[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x0f35('0x0'));var rimraf=require(_0x0f35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0f35('0x2'));var moment=require(_0x0f35('0x3'));var BPromise=require(_0x0f35('0x4'));var Mustache=require('mustache');var util=require(_0x0f35('0x5'));var path=require(_0x0f35('0x6'));var sox=require('sox');var csv=require(_0x0f35('0x7'));var ejs=require(_0x0f35('0x8'));var fs=require('fs');var fs_extra=require(_0x0f35('0x9'));var _=require(_0x0f35('0xa'));var squel=require(_0x0f35('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f35('0xc'));var toCsv=require(_0x0f35('0x7'));var querystring=require('querystring');var Papa=require(_0x0f35('0xd'));var Redis=require('ioredis');var authService=require(_0x0f35('0xe'));var qs=require(_0x0f35('0xf'));var as=require(_0x0f35('0x10'));var hardwareService=require(_0x0f35('0x11'));var logger=require(_0x0f35('0x12'))(_0x0f35('0x13'));var utils=require(_0x0f35('0x14'));var config=require(_0x0f35('0x15'));var licenseUtil=require(_0x0f35('0x16'));var db=require(_0x0f35('0x17'))['db'];var jayson=require(_0x0f35('0x18'));var client=jayson[_0x0f35('0x19')][_0x0f35('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x599c9c,_0x46c176,_0x3007e8,_0x276aed){return new BPromise(function(_0x1594d6,_0x3c8218){var _0x25f262=_0x276aed||client;return _0x25f262['request'](_0x599c9c,_0x3007e8)['then'](function(_0x21d90f){logger[_0x0f35('0x1b')](_0x0f35('0x1c'),_0x46c176,'request\x20sent');logger['debug'](_0x0f35('0x1d'),_0x46c176,_0x0f35('0x1e'),JSON[_0x0f35('0x1f')](_0x21d90f));if(_0x21d90f[_0x0f35('0x20')]){if(_0x21d90f[_0x0f35('0x20')][_0x0f35('0x21')]===0x1f4){logger['error'](_0x0f35('0x1c'),_0x46c176,_0x21d90f[_0x0f35('0x20')]['message']);return _0x3c8218(_0x21d90f[_0x0f35('0x20')][_0x0f35('0x22')]);}logger[_0x0f35('0x20')](_0x0f35('0x1c'),_0x46c176,_0x21d90f[_0x0f35('0x20')][_0x0f35('0x22')]);return _0x1594d6(_0x21d90f[_0x0f35('0x20')][_0x0f35('0x22')]);}else{logger[_0x0f35('0x1b')](_0x0f35('0x1c'),_0x46c176,_0x0f35('0x1e'));_0x1594d6(_0x21d90f[_0x0f35('0x23')][_0x0f35('0x22')]);}})[_0x0f35('0x24')](function(_0x228cb6){logger[_0x0f35('0x20')](_0x0f35('0x1c'),_0x46c176,_0x228cb6);_0x3c8218(_0x228cb6);});});}function respondWithStatusCode(_0x520cbd,_0x335407){_0x335407=_0x335407||0xcc;return function(_0x41f3a9){if(_0x41f3a9){return _0x520cbd[_0x0f35('0x25')](_0x335407);}return _0x520cbd[_0x0f35('0x26')](_0x335407)[_0x0f35('0x27')]();};}function respondWithResult(_0x1a6c73,_0x58c0fe){_0x58c0fe=_0x58c0fe||0xc8;return function(_0x5c5fcb){if(_0x5c5fcb){return _0x1a6c73[_0x0f35('0x26')](_0x58c0fe)[_0x0f35('0x28')](_0x5c5fcb);}};}function respondWithFilteredResult(_0x32bc19,_0x45eda9){return function(_0x333e0b){if(_0x333e0b){var _0x4736f7=typeof _0x45eda9[_0x0f35('0x29')]===_0x0f35('0x2a')&&typeof _0x45eda9['limit']===_0x0f35('0x2a');var _0x1bbe2d=_0x333e0b['count'];var _0x580f5b=_0x4736f7?0x0:_0x45eda9['offset'];var _0x54ebd6=_0x4736f7?_0x333e0b[_0x0f35('0x2b')]:_0x45eda9[_0x0f35('0x29')]+_0x45eda9['limit'];var _0x4aef9b;if(_0x54ebd6>=_0x1bbe2d){_0x54ebd6=_0x1bbe2d;_0x4aef9b=0xc8;}else{_0x4aef9b=0xce;}_0x32bc19['status'](_0x4aef9b);return _0x32bc19[_0x0f35('0x2c')](_0x0f35('0x2d'),_0x580f5b+'-'+_0x54ebd6+'/'+_0x1bbe2d)[_0x0f35('0x28')](_0x333e0b);}return null;};}function patchUpdates(_0x5f1f15){return function(_0x231285){try{jsonpatch['apply'](_0x231285,_0x5f1f15,!![]);}catch(_0x3d9c94){return BPromise[_0x0f35('0x2e')](_0x3d9c94);}return _0x231285['save']();};}function saveUpdates(_0x12a8f0,_0x1c436d){return function(_0x5790f7){if(_0x5790f7){return _0x5790f7['update'](_0x12a8f0)['then'](function(_0x5d16ba){return _0x5d16ba;});}return null;};}function removeEntity(_0x49751c,_0x382dd0){return function(_0x5c9cf5){if(_0x5c9cf5){return _0x5c9cf5[_0x0f35('0x2f')]()[_0x0f35('0x30')](function(){var _0x4ccdb9=_0x5c9cf5['get']({'plain':!![]});var _0x5a2b90=_0x0f35('0x31');return db[_0x0f35('0x32')][_0x0f35('0x2f')]({'where':{'type':_0x5a2b90,'resourceId':_0x4ccdb9['id']}})[_0x0f35('0x30')](function(){return _0x5c9cf5;});})[_0x0f35('0x30')](function(){_0x49751c[_0x0f35('0x26')](0xcc)[_0x0f35('0x27')]();});}};}function handleEntityNotFound(_0xf31ae0,_0xb1524f){return function(_0x2f89c4){if(!_0x2f89c4){_0xf31ae0['sendStatus'](0x194);}return _0x2f89c4;};}function handleError(_0x2ffbba,_0x8a12ca){_0x8a12ca=_0x8a12ca||0x1f4;return function(_0x4140f9){logger[_0x0f35('0x20')](_0x4140f9[_0x0f35('0x33')]);if(_0x4140f9['name']){delete _0x4140f9[_0x0f35('0x34')];}_0x2ffbba[_0x0f35('0x26')](_0x8a12ca)[_0x0f35('0x35')](_0x4140f9);};}exports[_0x0f35('0x36')]=function(_0x3fec59,_0x251879){var _0x46f489={},_0x4f7adc={},_0x41c7fe={'count':0x0,'rows':[]};var _0x57d0e2=_['map'](db[_0x0f35('0x37')]['rawAttributes'],function(_0x3f956f){return{'name':_0x3f956f[_0x0f35('0x38')],'type':_0x3f956f[_0x0f35('0x39')][_0x0f35('0x3a')]};});_0x4f7adc[_0x0f35('0x3b')]=_['map'](_0x57d0e2,_0x0f35('0x34'));_0x4f7adc[_0x0f35('0x3c')]=_[_0x0f35('0x3d')](_0x3fec59['query']);_0x4f7adc[_0x0f35('0x3e')]=_[_0x0f35('0x3f')](_0x4f7adc[_0x0f35('0x3b')],_0x4f7adc[_0x0f35('0x3c')]);_0x46f489['attributes']=_[_0x0f35('0x3f')](_0x4f7adc[_0x0f35('0x3b')],qs[_0x0f35('0x40')](_0x3fec59[_0x0f35('0x3c')][_0x0f35('0x40')]));_0x46f489[_0x0f35('0x41')]=_0x46f489['attributes'][_0x0f35('0x42')]?_0x46f489[_0x0f35('0x41')]:_0x4f7adc[_0x0f35('0x3b')];if(!_0x3fec59[_0x0f35('0x3c')][_0x0f35('0x43')](_0x0f35('0x44'))){_0x46f489[_0x0f35('0x45')]=qs[_0x0f35('0x45')](_0x3fec59[_0x0f35('0x3c')][_0x0f35('0x45')]);_0x46f489[_0x0f35('0x29')]=qs['offset'](_0x3fec59[_0x0f35('0x3c')][_0x0f35('0x29')]);}_0x46f489['order']=qs[_0x0f35('0x46')](_0x3fec59[_0x0f35('0x3c')][_0x0f35('0x46')]);_0x46f489['where']=qs[_0x0f35('0x3e')](_[_0x0f35('0x47')](_0x3fec59[_0x0f35('0x3c')],_0x4f7adc['filters']),_0x57d0e2);if(_0x3fec59[_0x0f35('0x3c')][_0x0f35('0x48')]){_0x46f489[_0x0f35('0x49')]=_['merge'](_0x46f489[_0x0f35('0x49')],{'$or':_[_0x0f35('0x4a')](_0x57d0e2,function(_0x51ca68){if(_0x51ca68[_0x0f35('0x39')]!==_0x0f35('0x4b')){var _0x1d3a93={};_0x1d3a93[_0x51ca68[_0x0f35('0x34')]]={'$like':'%'+_0x3fec59['query'][_0x0f35('0x48')]+'%'};return _0x1d3a93;}})});}_0x46f489=_['merge']({},_0x46f489,_0x3fec59[_0x0f35('0x4c')]);var _0x4fd26f={'where':_0x46f489[_0x0f35('0x49')]};return db['VoiceContext'][_0x0f35('0x2b')](_0x4fd26f)[_0x0f35('0x30')](function(_0x2e0880){_0x41c7fe['count']=_0x2e0880;if(_0x3fec59[_0x0f35('0x3c')][_0x0f35('0x4d')]){_0x46f489['include']=[{'all':!![]}];}return db[_0x0f35('0x37')]['findAll'](_0x46f489);})[_0x0f35('0x30')](function(_0x6075ce){_0x41c7fe[_0x0f35('0x4e')]=_0x6075ce;return _0x41c7fe;})['then'](respondWithFilteredResult(_0x251879,_0x46f489))[_0x0f35('0x24')](handleError(_0x251879,null));};exports[_0x0f35('0x4f')]=function(_0x54343d,_0x25c5a6){var _0x2e2e4d={'raw':![],'where':{'id':_0x54343d[_0x0f35('0x50')]['id']}},_0x35e0d2={};_0x35e0d2[_0x0f35('0x3b')]=_['keys'](db['VoiceContext'][_0x0f35('0x51')]);_0x35e0d2[_0x0f35('0x3c')]=_['keys'](_0x54343d[_0x0f35('0x3c')]);_0x35e0d2['filters']=_['intersection'](_0x35e0d2['model'],_0x35e0d2[_0x0f35('0x3c')]);_0x2e2e4d[_0x0f35('0x41')]=_[_0x0f35('0x3f')](_0x35e0d2['model'],qs[_0x0f35('0x40')](_0x54343d[_0x0f35('0x3c')][_0x0f35('0x40')]));_0x2e2e4d['attributes']=_0x2e2e4d['attributes']['length']?_0x2e2e4d[_0x0f35('0x41')]:_0x35e0d2[_0x0f35('0x3b')];if(_0x54343d[_0x0f35('0x3c')][_0x0f35('0x4d')]){_0x2e2e4d['include']=[{'all':!![]}];}_0x2e2e4d=_[_0x0f35('0x52')]({},_0x2e2e4d,_0x54343d[_0x0f35('0x4c')]);return db[_0x0f35('0x37')][_0x0f35('0x53')](_0x2e2e4d)[_0x0f35('0x30')](handleEntityNotFound(_0x25c5a6,null))[_0x0f35('0x30')](respondWithResult(_0x25c5a6,null))[_0x0f35('0x24')](handleError(_0x25c5a6,null));};exports[_0x0f35('0x54')]=function(_0x4a151e,_0x211624,_0x3ae283){var _0x75973b;return db[_0x0f35('0x37')][_0x0f35('0x54')](_0x4a151e['body'],{'raw':!![]})[_0x0f35('0x30')](function(_0x2204d3){_0x75973b=_0x2204d3;return db[_0x0f35('0x37')][_0x0f35('0x55')]({'raw':!![]});})[_0x0f35('0x30')](function(_0x39c527){var _0x192f79=fs['readFileSync'](path[_0x0f35('0x56')](config[_0x0f35('0x57')],'server/files/templates/context.ejs'),_0x0f35('0x58'));var _0x44d4d6=ejs[_0x0f35('0x59')](_0x192f79,{'contexts':_0x39c527||[]});fs[_0x0f35('0x5a')](_0x0f35('0x5b'),_0x44d4d6);})['then'](function(){return respondWithRpcPromise(_0x0f35('0x5c'),_0x0f35('0x54'),{'module':_0x0f35('0x5d')});})[_0x0f35('0x30')](function(){var _0x214374=_0x4a151e['user'][_0x0f35('0x5e')]({'plain':!![]});if(!_0x214374)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x214374[_0x0f35('0x5f')]===_0x0f35('0x60')){var _0x4aa100=_0x75973b[_0x0f35('0x5e')]({'plain':!![]});return db[_0x0f35('0x61')]['find']({'where':{'name':'Contexts','userProfileId':_0x214374[_0x0f35('0x62')]},'raw':!![]})['then'](function(_0x3ae941){if(_0x3ae941&&_0x3ae941['autoAssociation']===0x0){return db[_0x0f35('0x32')][_0x0f35('0x54')]({'name':_0x4aa100['name'],'resourceId':_0x4aa100['id'],'type':_0x3ae941[_0x0f35('0x34')],'sectionId':_0x3ae941['id']},{})[_0x0f35('0x30')](function(){return _0x75973b;});}else{return _0x75973b;}})['catch'](function(_0x3d3ab2){logger[_0x0f35('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d3ab2);throw _0x3d3ab2;});}return _0x75973b;})[_0x0f35('0x30')](respondWithResult(_0x211624,0xc9))[_0x0f35('0x24')](handleError(_0x211624,null));};exports[_0x0f35('0x63')]=function(_0x28ac58,_0x5a24cd,_0x5b2d1e){var _0x5106b3;return db[_0x0f35('0x37')][_0x0f35('0x53')]({'where':{'id':_0x28ac58['params']['id']}})[_0x0f35('0x30')](handleEntityNotFound(_0x5a24cd,null))[_0x0f35('0x30')](saveUpdates(_0x28ac58[_0x0f35('0x64')],null))[_0x0f35('0x30')](function(_0x56ad79){if(_0x56ad79){_0x5106b3=_0x56ad79;return db[_0x0f35('0x37')][_0x0f35('0x55')]({'raw':!![]});}})[_0x0f35('0x30')](function(_0x35bd2b){var _0x36222b=fs['readFileSync'](path[_0x0f35('0x56')](config['root'],_0x0f35('0x65')),_0x0f35('0x58'));var _0x233b3f=ejs[_0x0f35('0x59')](_0x36222b,{'contexts':_0x35bd2b||[]});fs[_0x0f35('0x5a')](_0x0f35('0x5b'),_0x233b3f);})['then'](function(){return respondWithRpcPromise('Reload',_0x0f35('0x63'),{'module':'chan_sip.so'});})['then'](function(){return _0x5106b3;})[_0x0f35('0x30')](respondWithResult(_0x5a24cd,null))[_0x0f35('0x24')](handleError(_0x5a24cd,null));};exports[_0x0f35('0x2f')]=function(_0x1bebc4,_0x14927f,_0x337cbc){var _0xbdaec2;return db[_0x0f35('0x37')][_0x0f35('0x53')]({'where':{'id':_0x1bebc4[_0x0f35('0x50')]['id']}})[_0x0f35('0x30')](handleEntityNotFound(_0x14927f,null))[_0x0f35('0x30')](removeEntity(_0x14927f,null))[_0x0f35('0x30')](function(){return db[_0x0f35('0x37')][_0x0f35('0x55')]({'raw':!![]});})[_0x0f35('0x30')](function(_0x532556){var _0x1883bc=fs[_0x0f35('0x66')](path[_0x0f35('0x56')](config[_0x0f35('0x57')],'server/files/templates/context.ejs'),_0x0f35('0x58'));var _0x3480d1=ejs[_0x0f35('0x59')](_0x1883bc,{'contexts':_0x532556});fs[_0x0f35('0x5a')](_0x0f35('0x5b'),_0x3480d1);return respondWithRpcPromise(_0x0f35('0x5c'),_0x0f35('0x2f'),{'module':'chan_sip.so'});})[_0x0f35('0x24')](handleError(_0x14927f,null));}; \ No newline at end of file +var _0xaedd=['key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','create','readFileSync','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','render','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','../../mysqldb','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','offset','limit','undefined','count','status','set','json','apply','update','then','destroy','get','Contexts','stack','name','send','VoiceContext','rawAttributes','fieldName','type'];(function(_0x5eed5a,_0x24b098){var _0x268827=function(_0x425e03){while(--_0x425e03){_0x5eed5a['push'](_0x5eed5a['shift']());}};_0x268827(++_0x24b098);}(_0xaedd,0x93));var _0xdaed=function(_0x30c750,_0x4e5eb8){_0x30c750=_0x30c750-0x0;var _0x3d3584=_0xaedd[_0x30c750];return _0x3d3584;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdaed('0x0'));var zipdir=require(_0xdaed('0x1'));var jsonpatch=require(_0xdaed('0x2'));var rp=require(_0xdaed('0x3'));var moment=require(_0xdaed('0x4'));var BPromise=require(_0xdaed('0x5'));var Mustache=require(_0xdaed('0x6'));var util=require('util');var path=require(_0xdaed('0x7'));var sox=require(_0xdaed('0x8'));var csv=require(_0xdaed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdaed('0xa'));var _=require(_0xdaed('0xb'));var squel=require(_0xdaed('0xc'));var crypto=require(_0xdaed('0xd'));var jsforce=require(_0xdaed('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdaed('0xf'));var Papa=require(_0xdaed('0x10'));var Redis=require('ioredis');var authService=require(_0xdaed('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdaed('0x12'));var hardwareService=require(_0xdaed('0x13'));var logger=require(_0xdaed('0x14'))(_0xdaed('0x15'));var utils=require(_0xdaed('0x16'));var config=require(_0xdaed('0x17'));var licenseUtil=require(_0xdaed('0x18'));var db=require(_0xdaed('0x19'))['db'];var jayson=require(_0xdaed('0x1a'));var client=jayson[_0xdaed('0x1b')][_0xdaed('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x312c85,_0x29e9c8,_0x2e8818,_0x565aee){return new BPromise(function(_0x262bdb,_0x9d7cae){var _0x18c36c=_0x565aee||client;return _0x18c36c['request'](_0x312c85,_0x2e8818)['then'](function(_0x4d2bc1){logger[_0xdaed('0x1d')](_0xdaed('0x1e'),_0x29e9c8,_0xdaed('0x1f'));logger['debug'](_0xdaed('0x20'),_0x29e9c8,_0xdaed('0x1f'),JSON[_0xdaed('0x21')](_0x4d2bc1));if(_0x4d2bc1[_0xdaed('0x22')]){if(_0x4d2bc1[_0xdaed('0x22')][_0xdaed('0x23')]===0x1f4){logger[_0xdaed('0x22')](_0xdaed('0x1e'),_0x29e9c8,_0x4d2bc1[_0xdaed('0x22')]['message']);return _0x9d7cae(_0x4d2bc1[_0xdaed('0x22')]['message']);}logger[_0xdaed('0x22')](_0xdaed('0x1e'),_0x29e9c8,_0x4d2bc1[_0xdaed('0x22')][_0xdaed('0x24')]);return _0x262bdb(_0x4d2bc1[_0xdaed('0x22')][_0xdaed('0x24')]);}else{logger[_0xdaed('0x1d')](_0xdaed('0x1e'),_0x29e9c8,_0xdaed('0x1f'));_0x262bdb(_0x4d2bc1[_0xdaed('0x25')][_0xdaed('0x24')]);}})[_0xdaed('0x26')](function(_0x8ab571){logger[_0xdaed('0x22')](_0xdaed('0x1e'),_0x29e9c8,_0x8ab571);_0x9d7cae(_0x8ab571);});});}function respondWithStatusCode(_0x401b97,_0x290b30){_0x290b30=_0x290b30||0xcc;return function(_0x669783){if(_0x669783){return _0x401b97[_0xdaed('0x27')](_0x290b30);}return _0x401b97['status'](_0x290b30)[_0xdaed('0x28')]();};}function respondWithResult(_0x5f421f,_0x5b06ce){_0x5b06ce=_0x5b06ce||0xc8;return function(_0x395448){if(_0x395448){return _0x5f421f['status'](_0x5b06ce)['json'](_0x395448);}};}function respondWithFilteredResult(_0x4d5f79,_0x1fe5ea){return function(_0x1e2eda){if(_0x1e2eda){var _0xeb9af2=typeof _0x1fe5ea[_0xdaed('0x29')]==='undefined'&&typeof _0x1fe5ea[_0xdaed('0x2a')]===_0xdaed('0x2b');var _0x1f593c=_0x1e2eda[_0xdaed('0x2c')];var _0x30d203=_0xeb9af2?0x0:_0x1fe5ea[_0xdaed('0x29')];var _0x405a11=_0xeb9af2?_0x1e2eda[_0xdaed('0x2c')]:_0x1fe5ea[_0xdaed('0x29')]+_0x1fe5ea[_0xdaed('0x2a')];var _0x12b58a;if(_0x405a11>=_0x1f593c){_0x405a11=_0x1f593c;_0x12b58a=0xc8;}else{_0x12b58a=0xce;}_0x4d5f79[_0xdaed('0x2d')](_0x12b58a);return _0x4d5f79[_0xdaed('0x2e')]('Content-Range',_0x30d203+'-'+_0x405a11+'/'+_0x1f593c)[_0xdaed('0x2f')](_0x1e2eda);}return null;};}function patchUpdates(_0x57a654){return function(_0x49c9a5){try{jsonpatch[_0xdaed('0x30')](_0x49c9a5,_0x57a654,!![]);}catch(_0x48868f){return BPromise['reject'](_0x48868f);}return _0x49c9a5['save']();};}function saveUpdates(_0x237f40,_0x23ff82){return function(_0x534dad){if(_0x534dad){return _0x534dad[_0xdaed('0x31')](_0x237f40)[_0xdaed('0x32')](function(_0xf03707){return _0xf03707;});}return null;};}function removeEntity(_0x4b3430,_0x2431af){return function(_0x3e9cb2){if(_0x3e9cb2){return _0x3e9cb2[_0xdaed('0x33')]()[_0xdaed('0x32')](function(){var _0x2e34a2=_0x3e9cb2[_0xdaed('0x34')]({'plain':!![]});var _0x736ccb=_0xdaed('0x35');return db['UserProfileResource'][_0xdaed('0x33')]({'where':{'type':_0x736ccb,'resourceId':_0x2e34a2['id']}})[_0xdaed('0x32')](function(){return _0x3e9cb2;});})['then'](function(){_0x4b3430[_0xdaed('0x2d')](0xcc)[_0xdaed('0x28')]();});}};}function handleEntityNotFound(_0x1f0084,_0x254427){return function(_0x26ba21){if(!_0x26ba21){_0x1f0084[_0xdaed('0x27')](0x194);}return _0x26ba21;};}function handleError(_0x59dd98,_0x57e928){_0x57e928=_0x57e928||0x1f4;return function(_0x12b9b7){logger['error'](_0x12b9b7[_0xdaed('0x36')]);if(_0x12b9b7[_0xdaed('0x37')]){delete _0x12b9b7[_0xdaed('0x37')];}_0x59dd98['status'](_0x57e928)[_0xdaed('0x38')](_0x12b9b7);};}exports['index']=function(_0x3bc4bf,_0x15388c){var _0x2482b3={},_0x19e137={},_0x4c39ca={'count':0x0,'rows':[]};var _0x32148c=_['map'](db[_0xdaed('0x39')][_0xdaed('0x3a')],function(_0xac05e8){return{'name':_0xac05e8[_0xdaed('0x3b')],'type':_0xac05e8[_0xdaed('0x3c')][_0xdaed('0x3d')]};});_0x19e137['model']=_['map'](_0x32148c,_0xdaed('0x37'));_0x19e137[_0xdaed('0x3e')]=_[_0xdaed('0x3f')](_0x3bc4bf[_0xdaed('0x3e')]);_0x19e137[_0xdaed('0x40')]=_[_0xdaed('0x41')](_0x19e137['model'],_0x19e137[_0xdaed('0x3e')]);_0x2482b3['attributes']=_[_0xdaed('0x41')](_0x19e137[_0xdaed('0x42')],qs['fields'](_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x43')]));_0x2482b3[_0xdaed('0x44')]=_0x2482b3[_0xdaed('0x44')]['length']?_0x2482b3[_0xdaed('0x44')]:_0x19e137[_0xdaed('0x42')];if(!_0x3bc4bf[_0xdaed('0x3e')]['hasOwnProperty'](_0xdaed('0x45'))){_0x2482b3[_0xdaed('0x2a')]=qs['limit'](_0x3bc4bf[_0xdaed('0x3e')]['limit']);_0x2482b3[_0xdaed('0x29')]=qs[_0xdaed('0x29')](_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x29')]);}_0x2482b3[_0xdaed('0x46')]=qs[_0xdaed('0x47')](_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x47')]);_0x2482b3[_0xdaed('0x48')]=qs[_0xdaed('0x40')](_[_0xdaed('0x49')](_0x3bc4bf[_0xdaed('0x3e')],_0x19e137['filters']),_0x32148c);if(_0x3bc4bf['query'][_0xdaed('0x4a')]){_0x2482b3['where']=_['merge'](_0x2482b3[_0xdaed('0x48')],{'$or':_[_0xdaed('0x4b')](_0x32148c,function(_0x13b25a){if(_0x13b25a[_0xdaed('0x3c')]!==_0xdaed('0x4c')){var _0x2446f0={};_0x2446f0[_0x13b25a['name']]={'$like':'%'+_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x4a')]+'%'};return _0x2446f0;}})});}_0x2482b3=_[_0xdaed('0x4d')]({},_0x2482b3,_0x3bc4bf[_0xdaed('0x4e')]);var _0x2ffa3e={'where':_0x2482b3[_0xdaed('0x48')]};return db[_0xdaed('0x39')][_0xdaed('0x2c')](_0x2ffa3e)[_0xdaed('0x32')](function(_0x209f63){_0x4c39ca[_0xdaed('0x2c')]=_0x209f63;if(_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x4f')]){_0x2482b3[_0xdaed('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0xdaed('0x51')](_0x2482b3);})[_0xdaed('0x32')](function(_0x179b81){_0x4c39ca[_0xdaed('0x52')]=_0x179b81;return _0x4c39ca;})['then'](respondWithFilteredResult(_0x15388c,_0x2482b3))[_0xdaed('0x26')](handleError(_0x15388c,null));};exports['show']=function(_0x24283b,_0x25dd24){var _0x5190fc={'raw':![],'where':{'id':_0x24283b[_0xdaed('0x53')]['id']}},_0x231549={};_0x231549[_0xdaed('0x42')]=_[_0xdaed('0x3f')](db[_0xdaed('0x39')][_0xdaed('0x3a')]);_0x231549[_0xdaed('0x3e')]=_[_0xdaed('0x3f')](_0x24283b[_0xdaed('0x3e')]);_0x231549[_0xdaed('0x40')]=_['intersection'](_0x231549['model'],_0x231549[_0xdaed('0x3e')]);_0x5190fc[_0xdaed('0x44')]=_[_0xdaed('0x41')](_0x231549['model'],qs['fields'](_0x24283b['query']['fields']));_0x5190fc[_0xdaed('0x44')]=_0x5190fc[_0xdaed('0x44')]['length']?_0x5190fc[_0xdaed('0x44')]:_0x231549[_0xdaed('0x42')];if(_0x24283b[_0xdaed('0x3e')][_0xdaed('0x4f')]){_0x5190fc[_0xdaed('0x50')]=[{'all':!![]}];}_0x5190fc=_[_0xdaed('0x4d')]({},_0x5190fc,_0x24283b[_0xdaed('0x4e')]);return db[_0xdaed('0x39')][_0xdaed('0x54')](_0x5190fc)['then'](handleEntityNotFound(_0x25dd24,null))['then'](respondWithResult(_0x25dd24,null))[_0xdaed('0x26')](handleError(_0x25dd24,null));};exports['create']=function(_0x5cb0ce,_0x3372d4,_0x25b8b9){var _0x51a05e;return db[_0xdaed('0x39')][_0xdaed('0x55')](_0x5cb0ce['body'],{'raw':!![]})[_0xdaed('0x32')](function(_0x254e25){_0x51a05e=_0x254e25;return db['VoiceContext'][_0xdaed('0x51')]({'raw':!![]});})[_0xdaed('0x32')](function(_0x430e99){var _0x6eff42=fs[_0xdaed('0x56')](path['join'](config[_0xdaed('0x57')],_0xdaed('0x58')),_0xdaed('0x59'));var _0x33437a=ejs['render'](_0x6eff42,{'contexts':_0x430e99||[]});fs[_0xdaed('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x33437a);})[_0xdaed('0x32')](function(){return respondWithRpcPromise(_0xdaed('0x5b'),_0xdaed('0x55'),{'module':_0xdaed('0x5c')});})[_0xdaed('0x32')](function(){var _0x3b7bfa=_0x5cb0ce['user']['get']({'plain':!![]});if(!_0x3b7bfa)throw new Error(_0xdaed('0x5d'));if(_0x3b7bfa[_0xdaed('0x5e')]==='user'){var _0x2717ad=_0x51a05e['get']({'plain':!![]});return db[_0xdaed('0x5f')][_0xdaed('0x54')]({'where':{'name':_0xdaed('0x35'),'userProfileId':_0x3b7bfa[_0xdaed('0x60')]},'raw':!![]})[_0xdaed('0x32')](function(_0x5e56b0){if(_0x5e56b0&&_0x5e56b0[_0xdaed('0x61')]===0x0){return db[_0xdaed('0x62')][_0xdaed('0x55')]({'name':_0x2717ad['name'],'resourceId':_0x2717ad['id'],'type':_0x5e56b0[_0xdaed('0x37')],'sectionId':_0x5e56b0['id']},{})[_0xdaed('0x32')](function(){return _0x51a05e;});}else{return _0x51a05e;}})['catch'](function(_0x23230b){logger[_0xdaed('0x22')](_0xdaed('0x63'),_0x23230b);throw _0x23230b;});}return _0x51a05e;})['then'](respondWithResult(_0x3372d4,0xc9))['catch'](handleError(_0x3372d4,null));};exports[_0xdaed('0x31')]=function(_0x509a2a,_0x558d54,_0x1274b7){var _0x22be0a;return db['VoiceContext'][_0xdaed('0x54')]({'where':{'id':_0x509a2a[_0xdaed('0x53')]['id']}})[_0xdaed('0x32')](handleEntityNotFound(_0x558d54,null))[_0xdaed('0x32')](saveUpdates(_0x509a2a[_0xdaed('0x64')],null))['then'](function(_0x22a727){if(_0x22a727){_0x22be0a=_0x22a727;return db['VoiceContext'][_0xdaed('0x51')]({'raw':!![]});}})['then'](function(_0x3cb080){var _0x357b29=fs[_0xdaed('0x56')](path[_0xdaed('0x65')](config['root'],_0xdaed('0x58')),_0xdaed('0x59'));var _0x201a6d=ejs[_0xdaed('0x66')](_0x357b29,{'contexts':_0x3cb080||[]});fs['writeFileSync'](_0xdaed('0x67'),_0x201a6d);})['then'](function(){return respondWithRpcPromise(_0xdaed('0x5b'),_0xdaed('0x31'),{'module':'chan_sip.so'});})[_0xdaed('0x32')](function(){return _0x22be0a;})[_0xdaed('0x32')](respondWithResult(_0x558d54,null))['catch'](handleError(_0x558d54,null));};exports[_0xdaed('0x33')]=function(_0x3d6bcf,_0x4aa86a,_0x1efd5c){var _0x347aa2;return db['VoiceContext']['find']({'where':{'id':_0x3d6bcf[_0xdaed('0x53')]['id']}})['then'](handleEntityNotFound(_0x4aa86a,null))[_0xdaed('0x32')](removeEntity(_0x4aa86a,null))[_0xdaed('0x32')](function(){return db[_0xdaed('0x39')][_0xdaed('0x51')]({'raw':!![]});})[_0xdaed('0x32')](function(_0x5dfa12){var _0x1299eb=fs['readFileSync'](path[_0xdaed('0x65')](config[_0xdaed('0x57')],_0xdaed('0x58')),'utf8');var _0x41892b=ejs[_0xdaed('0x66')](_0x1299eb,{'contexts':_0x5dfa12});fs[_0xdaed('0x5a')](_0xdaed('0x67'),_0x41892b);return respondWithRpcPromise('Reload',_0xdaed('0x33'),{'module':'chan_sip.so'});})[_0xdaed('0x26')](handleError(_0x4aa86a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6278cad..029f800 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 _0xc6a2=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x49d280,_0x33d68f){var _0x25274a=function(_0x8ace90){while(--_0x8ace90){_0x49d280['push'](_0x49d280['shift']());}};_0x25274a(++_0x33d68f);}(_0xc6a2,0x69));var _0x2c6a=function(_0x3fc0cd,_0x275a5e){_0x3fc0cd=_0x3fc0cd-0x0;var _0x33c236=_0xc6a2[_0x3fc0cd];return _0x33c236;};'use strict';var _=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var logger=require('../../config/logger')(_0x2c6a('0x2'));var moment=require(_0x2c6a('0x3'));var BPromise=require(_0x2c6a('0x4'));var rp=require(_0x2c6a('0x5'));var fs=require('fs');var path=require(_0x2c6a('0x6'));var rimraf=require(_0x2c6a('0x7'));var config=require(_0x2c6a('0x8'));var attributes=require(_0x2c6a('0x9'));module[_0x2c6a('0xa')]=function(_0x3c7e44,_0x4559d8){return _0x3c7e44[_0x2c6a('0xb')](_0x2c6a('0xc'),attributes,{'tableName':_0x2c6a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa16=['./voiceContext.attributes','define','VoiceContext','voice_contexts','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x44e2ab,_0x27f72c){var _0x4a0849=function(_0x490b69){while(--_0x490b69){_0x44e2ab['push'](_0x44e2ab['shift']());}};_0x4a0849(++_0x27f72c);}(_0xfa16,0x12d));var _0x6fa1=function(_0x12ef58,_0x56813c){_0x12ef58=_0x12ef58-0x0;var _0x7c9db0=_0xfa16[_0x12ef58];return _0x7c9db0;};'use strict';var _=require('lodash');var util=require(_0x6fa1('0x0'));var logger=require('../../config/logger')(_0x6fa1('0x1'));var moment=require(_0x6fa1('0x2'));var BPromise=require(_0x6fa1('0x3'));var rp=require(_0x6fa1('0x4'));var fs=require('fs');var path=require(_0x6fa1('0x5'));var rimraf=require(_0x6fa1('0x6'));var config=require('../../config/environment');var attributes=require(_0x6fa1('0x7'));module['exports']=function(_0x34b8aa,_0xcbb5b3){return _0x34b8aa[_0x6fa1('0x8')](_0x6fa1('0x9'),attributes,{'tableName':_0x6fa1('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 aa28f77..050b76f 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 _0x152f=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message'];(function(_0x4a133d,_0x3b4141){var _0x58b4e9=function(_0xa55812){while(--_0xa55812){_0x4a133d['push'](_0x4a133d['shift']());}};_0x58b4e9(++_0x3b4141);}(_0x152f,0x144));var _0xf152=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x152f[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xf152('0x0'));var util=require(_0xf152('0x1'));var moment=require(_0xf152('0x2'));var BPromise=require(_0xf152('0x3'));var rs=require(_0xf152('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf152('0x5'))['db'];var utils=require(_0xf152('0x6'));var logger=require(_0xf152('0x7'))(_0xf152('0x8'));var config=require('../../config/environment');var jayson=require(_0xf152('0x9'));var client=jayson['client'][_0xf152('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x504fb6,_0x36498a,_0x5ec158){return new BPromise(function(_0x5206b3,_0x3190e3){return client[_0xf152('0xb')](_0x504fb6,_0x5ec158)['then'](function(_0x133f44){logger[_0xf152('0xc')]('VoiceContext,\x20%s,\x20%s',_0x36498a,_0xf152('0xd'));logger[_0xf152('0xe')](_0xf152('0xf'),_0x36498a,_0xf152('0xd'),JSON[_0xf152('0x10')](_0x133f44));if(_0x133f44[_0xf152('0x11')]){if(_0x133f44[_0xf152('0x11')][_0xf152('0x12')]===0x1f4){logger[_0xf152('0x11')](_0xf152('0x13'),_0x36498a,_0x133f44[_0xf152('0x11')][_0xf152('0x14')]);return _0x3190e3(_0x133f44[_0xf152('0x11')][_0xf152('0x14')]);}logger['error'](_0xf152('0x13'),_0x36498a,_0x133f44[_0xf152('0x11')]['message']);return _0x5206b3(_0x133f44[_0xf152('0x11')][_0xf152('0x14')]);}else{logger[_0xf152('0xc')]('VoiceContext,\x20%s,\x20%s',_0x36498a,_0xf152('0xd'));_0x5206b3(_0x133f44[_0xf152('0x15')]['message']);}})[_0xf152('0x16')](function(_0x29bad9){logger[_0xf152('0x11')](_0xf152('0x13'),_0x36498a,_0x29bad9);_0x3190e3(_0x29bad9);});});} \ No newline at end of file +var _0x7184=['error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e206b,_0x42548b){var _0x2755cc=function(_0x518f34){while(--_0x518f34){_0x2e206b['push'](_0x2e206b['shift']());}};_0x2755cc(++_0x42548b);}(_0x7184,0xd5));var _0x4718=function(_0x1f5048,_0x35594a){_0x1f5048=_0x1f5048-0x0;var _0x4f17fd=_0x7184[_0x1f5048];return _0x4f17fd;};'use strict';var _=require(_0x4718('0x0'));var util=require(_0x4718('0x1'));var moment=require('moment');var BPromise=require(_0x4718('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4718('0x3'));var db=require(_0x4718('0x4'))['db'];var utils=require(_0x4718('0x5'));var logger=require(_0x4718('0x6'))(_0x4718('0x7'));var config=require('../../config/environment');var jayson=require(_0x4718('0x8'));var client=jayson[_0x4718('0x9')][_0x4718('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594c73,_0x5bf1ea,_0x4b808b){return new BPromise(function(_0x22f6ab,_0x40e5a9){return client['request'](_0x594c73,_0x4b808b)[_0x4718('0xb')](function(_0x9c2ebe){logger[_0x4718('0xc')](_0x4718('0xd'),_0x5bf1ea,_0x4718('0xe'));logger[_0x4718('0xf')](_0x4718('0x10'),_0x5bf1ea,'request\x20sent',JSON[_0x4718('0x11')](_0x9c2ebe));if(_0x9c2ebe[_0x4718('0x12')]){if(_0x9c2ebe[_0x4718('0x12')]['code']===0x1f4){logger['error'](_0x4718('0xd'),_0x5bf1ea,_0x9c2ebe[_0x4718('0x12')]['message']);return _0x40e5a9(_0x9c2ebe[_0x4718('0x12')][_0x4718('0x13')]);}logger[_0x4718('0x12')]('VoiceContext,\x20%s,\x20%s',_0x5bf1ea,_0x9c2ebe[_0x4718('0x12')][_0x4718('0x13')]);return _0x22f6ab(_0x9c2ebe['error'][_0x4718('0x13')]);}else{logger[_0x4718('0xc')]('VoiceContext,\x20%s,\x20%s',_0x5bf1ea,_0x4718('0xe'));_0x22f6ab(_0x9c2ebe['result'][_0x4718('0x13')]);}})[_0x4718('0x14')](function(_0x3f25d5){logger['error'](_0x4718('0xd'),_0x5bf1ea,_0x3f25d5);_0x40e5a9(_0x3f25d5);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9c91e1d..e81621a 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 _0xd691=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x415eea,_0x323fe7){var _0x120bb9=function(_0x7973b2){while(--_0x7973b2){_0x415eea['push'](_0x415eea['shift']());}};_0x120bb9(++_0x323fe7);}(_0xd691,0xe6));var _0x1d69=function(_0x15797a,_0x16274f){_0x15797a=_0x15797a-0x0;var _0x3e2618=_0xd691[_0x15797a];return _0x3e2618;};'use strict';var multer=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var path=require(_0x1d69('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d69('0x3'));var router=express[_0x1d69('0x4')]();var fs_extra=require(_0x1d69('0x5'));var auth=require(_0x1d69('0x6'));var interaction=require(_0x1d69('0x7'));var config=require(_0x1d69('0x8'));var controller=require(_0x1d69('0x9'));router[_0x1d69('0xa')]('/',auth[_0x1d69('0xb')](),controller[_0x1d69('0xc')]);router['get']('/describe',auth[_0x1d69('0xb')](),controller['describe']);router[_0x1d69('0xa')](_0x1d69('0xd'),auth[_0x1d69('0xb')](),controller[_0x1d69('0xe')]);router['post']('/',auth[_0x1d69('0xb')](),controller[_0x1d69('0xf')]);router[_0x1d69('0x10')](_0x1d69('0xd'),auth[_0x1d69('0xb')](),controller['update']);router['delete'](_0x1d69('0xd'),auth[_0x1d69('0xb')](),controller[_0x1d69('0x11')]);module[_0x1d69('0x12')]=router; \ No newline at end of file +var _0xad95=['multer','util','path','Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','describe','create','put','update','/:id','destroy','exports'];(function(_0x515a76,_0x145b39){var _0x4ea72b=function(_0x3684ad){while(--_0x3684ad){_0x515a76['push'](_0x515a76['shift']());}};_0x4ea72b(++_0x145b39);}(_0xad95,0x70));var _0x5ad9=function(_0x235a64,_0x3f61b6){_0x235a64=_0x235a64-0x0;var _0x212cc0=_0xad95[_0x235a64];return _0x212cc0;};'use strict';var multer=require(_0x5ad9('0x0'));var util=require(_0x5ad9('0x1'));var path=require(_0x5ad9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5ad9('0x3')]();var fs_extra=require(_0x5ad9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ad9('0x5'));var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5ad9('0x6')](_0x5ad9('0x7'),auth[_0x5ad9('0x8')](),controller[_0x5ad9('0x9')]);router[_0x5ad9('0x6')]('/:id',auth[_0x5ad9('0x8')](),controller['show']);router['post']('/',auth[_0x5ad9('0x8')](),controller[_0x5ad9('0xa')]);router[_0x5ad9('0xb')]('/:id',auth[_0x5ad9('0x8')](),controller[_0x5ad9('0xc')]);router['delete'](_0x5ad9('0xd'),auth[_0x5ad9('0x8')](),controller[_0x5ad9('0xe')]);module[_0x5ad9('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 91974bc..0c2e764 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 _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x595076,_0x42ae11){var _0x2b418d=function(_0x28c5e4){while(--_0x28c5e4){_0x595076['push'](_0x595076['shift']());}};_0x2b418d(++_0x42ae11);}(_0x6aa7,0x178));var _0x76aa=function(_0x18f69f,_0x216d28){_0x18f69f=_0x18f69f-0x0;var _0x227a9e=_0x6aa7[_0x18f69f];return _0x227a9e;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x4115b4,_0x121c42){var _0x28a416=function(_0x20219b){while(--_0x20219b){_0x4115b4['push'](_0x4115b4['shift']());}};_0x28a416(++_0x121c42);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x24ca[_0x3792e6];return _0x441e44;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 0f2b6de..f7708d3 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 _0xc5a9=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','create','body','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xc5a9,0xd2));var _0x9c5a=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xc5a9[_0x2a67fe];return _0x57e726;};'use strict';var emlformat=require(_0x9c5a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9c5a('0x1'));var rp=require(_0x9c5a('0x2'));var moment=require(_0x9c5a('0x3'));var BPromise=require(_0x9c5a('0x4'));var Mustache=require(_0x9c5a('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9c5a('0x6'));var ejs=require(_0x9c5a('0x7'));var fs=require('fs');var fs_extra=require(_0x9c5a('0x8'));var _=require(_0x9c5a('0x9'));var squel=require(_0x9c5a('0xa'));var crypto=require(_0x9c5a('0xb'));var jsforce=require(_0x9c5a('0xc'));var deskjs=require(_0x9c5a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c5a('0xe'));var Redis=require(_0x9c5a('0xf'));var authService=require(_0x9c5a('0x10'));var qs=require(_0x9c5a('0x11'));var as=require(_0x9c5a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c5a('0x13'));var db=require(_0x9c5a('0x14'))['db'];function respondWithStatusCode(_0x16bb03,_0x41db7d){_0x41db7d=_0x41db7d||0xcc;return function(_0xc05b61){if(_0xc05b61){return _0x16bb03[_0x9c5a('0x15')](_0x41db7d);}return _0x16bb03[_0x9c5a('0x16')](_0x41db7d)[_0x9c5a('0x17')]();};}function respondWithResult(_0x1e1309,_0x27c949){_0x27c949=_0x27c949||0xc8;return function(_0x4d2b98){if(_0x4d2b98){return _0x1e1309['status'](_0x27c949)['json'](_0x4d2b98);}};}function respondWithFilteredResult(_0x1ffbe8,_0x4fc2a2){return function(_0x253293){if(_0x253293){var _0x53450a=typeof _0x4fc2a2[_0x9c5a('0x18')]===_0x9c5a('0x19')&&typeof _0x4fc2a2['limit']===_0x9c5a('0x19');var _0x4fe65e=_0x253293[_0x9c5a('0x1a')];var _0x1a87fb=_0x53450a?0x0:_0x4fc2a2[_0x9c5a('0x18')];var _0x566c11=_0x53450a?_0x253293[_0x9c5a('0x1a')]:_0x4fc2a2['offset']+_0x4fc2a2[_0x9c5a('0x1b')];var _0x73fbae;if(_0x566c11>=_0x4fe65e){_0x566c11=_0x4fe65e;_0x73fbae=0xc8;}else{_0x73fbae=0xce;}_0x1ffbe8['status'](_0x73fbae);return _0x1ffbe8[_0x9c5a('0x1c')](_0x9c5a('0x1d'),_0x1a87fb+'-'+_0x566c11+'/'+_0x4fe65e)[_0x9c5a('0x1e')](_0x253293);}return null;};}function patchUpdates(_0x194ca4){return function(_0x44f1a){try{jsonpatch[_0x9c5a('0x1f')](_0x44f1a,_0x194ca4,!![]);}catch(_0x325afd){return BPromise[_0x9c5a('0x20')](_0x325afd);}return _0x44f1a[_0x9c5a('0x21')]();};}function saveUpdates(_0x573975,_0x46efa0){return function(_0x4c51df){if(_0x4c51df){return _0x4c51df[_0x9c5a('0x22')](_0x573975)['then'](function(_0x21b0b7){return _0x21b0b7;});}return null;};}function removeEntity(_0x2c9070,_0x12f3ca){return function(_0x4e7a73){if(_0x4e7a73){return _0x4e7a73[_0x9c5a('0x23')]()['then'](function(){_0x2c9070['status'](0xcc)[_0x9c5a('0x17')]();});}};}function handleEntityNotFound(_0x582f96,_0x4cad53){return function(_0x58b3ea){if(!_0x58b3ea){_0x582f96[_0x9c5a('0x15')](0x194);}return _0x58b3ea;};}function handleError(_0x4c3450,_0xe5a311){_0xe5a311=_0xe5a311||0x1f4;return function(_0x4c45b8){logger[_0x9c5a('0x24')](_0x4c45b8[_0x9c5a('0x25')]);if(_0x4c45b8[_0x9c5a('0x26')]){delete _0x4c45b8[_0x9c5a('0x26')];}_0x4c3450['status'](_0xe5a311)[_0x9c5a('0x27')](_0x4c45b8);};}exports[_0x9c5a('0x28')]=function(_0x33f708,_0x4a3db7){var _0x51df3f={},_0xfe932f={},_0x3dd321={'count':0x0,'rows':[]};var _0x17acb8=_['map'](db[_0x9c5a('0x29')][_0x9c5a('0x2a')],function(_0x391fd8){return{'name':_0x391fd8[_0x9c5a('0x2b')],'type':_0x391fd8[_0x9c5a('0x2c')]['key']};});_0xfe932f[_0x9c5a('0x2d')]=_[_0x9c5a('0x2e')](_0x17acb8,_0x9c5a('0x26'));_0xfe932f['query']=_[_0x9c5a('0x2f')](_0x33f708[_0x9c5a('0x30')]);_0xfe932f[_0x9c5a('0x31')]=_['intersection'](_0xfe932f['model'],_0xfe932f[_0x9c5a('0x30')]);_0x51df3f['attributes']=_[_0x9c5a('0x32')](_0xfe932f[_0x9c5a('0x2d')],qs['fields'](_0x33f708[_0x9c5a('0x30')][_0x9c5a('0x33')]));_0x51df3f['attributes']=_0x51df3f[_0x9c5a('0x34')][_0x9c5a('0x35')]?_0x51df3f[_0x9c5a('0x34')]:_0xfe932f[_0x9c5a('0x2d')];if(!_0x33f708[_0x9c5a('0x30')][_0x9c5a('0x36')](_0x9c5a('0x37'))){_0x51df3f[_0x9c5a('0x1b')]=qs[_0x9c5a('0x1b')](_0x33f708[_0x9c5a('0x30')]['limit']);_0x51df3f[_0x9c5a('0x18')]=qs[_0x9c5a('0x18')](_0x33f708[_0x9c5a('0x30')][_0x9c5a('0x18')]);}_0x51df3f[_0x9c5a('0x38')]=qs[_0x9c5a('0x39')](_0x33f708[_0x9c5a('0x30')][_0x9c5a('0x39')]);_0x51df3f[_0x9c5a('0x3a')]=qs[_0x9c5a('0x31')](_[_0x9c5a('0x3b')](_0x33f708['query'],_0xfe932f[_0x9c5a('0x31')]),_0x17acb8);if(_0x33f708[_0x9c5a('0x30')][_0x9c5a('0x3c')]){_0x51df3f['where']=_[_0x9c5a('0x3d')](_0x51df3f[_0x9c5a('0x3a')],{'$or':_['map'](_0x17acb8,function(_0x2cfa7d){if(_0x2cfa7d[_0x9c5a('0x2c')]!==_0x9c5a('0x3e')){var _0x164fee={};_0x164fee[_0x2cfa7d[_0x9c5a('0x26')]]={'$like':'%'+_0x33f708[_0x9c5a('0x30')][_0x9c5a('0x3c')]+'%'};return _0x164fee;}})});}_0x51df3f=_['merge']({},_0x51df3f,_0x33f708[_0x9c5a('0x3f')]);var _0x5e3a84={'where':_0x51df3f[_0x9c5a('0x3a')]};return db['VoiceDialReport'][_0x9c5a('0x1a')](_0x5e3a84)[_0x9c5a('0x40')](function(_0x507561){_0x3dd321[_0x9c5a('0x1a')]=_0x507561;if(_0x33f708[_0x9c5a('0x30')][_0x9c5a('0x41')]){_0x51df3f[_0x9c5a('0x42')]=[{'all':!![]}];}return db[_0x9c5a('0x29')][_0x9c5a('0x43')](_0x51df3f);})[_0x9c5a('0x40')](function(_0x1d4583){_0x3dd321[_0x9c5a('0x44')]=_0x1d4583;return _0x3dd321;})[_0x9c5a('0x40')](respondWithFilteredResult(_0x4a3db7,_0x51df3f))['catch'](handleError(_0x4a3db7,null));};exports[_0x9c5a('0x45')]=function(_0x49329f,_0x27b6d4){var _0x1e6152={'raw':!![],'where':{'id':_0x49329f[_0x9c5a('0x46')]['id']}},_0x449810={};_0x449810['model']=_[_0x9c5a('0x2f')](db[_0x9c5a('0x29')]['rawAttributes']);_0x449810[_0x9c5a('0x30')]=_[_0x9c5a('0x2f')](_0x49329f[_0x9c5a('0x30')]);_0x449810[_0x9c5a('0x31')]=_['intersection'](_0x449810[_0x9c5a('0x2d')],_0x449810['query']);_0x1e6152[_0x9c5a('0x34')]=_['intersection'](_0x449810[_0x9c5a('0x2d')],qs[_0x9c5a('0x33')](_0x49329f[_0x9c5a('0x30')]['fields']));_0x1e6152[_0x9c5a('0x34')]=_0x1e6152[_0x9c5a('0x34')][_0x9c5a('0x35')]?_0x1e6152[_0x9c5a('0x34')]:_0x449810['model'];if(_0x49329f[_0x9c5a('0x30')][_0x9c5a('0x41')]){_0x1e6152[_0x9c5a('0x42')]=[{'all':!![]}];}_0x1e6152=_['merge']({},_0x1e6152,_0x49329f[_0x9c5a('0x3f')]);return db[_0x9c5a('0x29')][_0x9c5a('0x47')](_0x1e6152)[_0x9c5a('0x40')](handleEntityNotFound(_0x27b6d4,null))[_0x9c5a('0x40')](respondWithResult(_0x27b6d4,null))['catch'](handleError(_0x27b6d4,null));};exports['create']=function(_0x1c07fc,_0x498ea8){return db[_0x9c5a('0x29')][_0x9c5a('0x48')](_0x1c07fc[_0x9c5a('0x49')],{})[_0x9c5a('0x40')](respondWithResult(_0x498ea8,0xc9))[_0x9c5a('0x4a')](handleError(_0x498ea8,null));};exports[_0x9c5a('0x22')]=function(_0xc47e57,_0x3dd5a1){if(_0xc47e57[_0x9c5a('0x49')]['id']){delete _0xc47e57[_0x9c5a('0x49')]['id'];}return db[_0x9c5a('0x29')]['find']({'where':{'id':_0xc47e57['params']['id']}})[_0x9c5a('0x40')](handleEntityNotFound(_0x3dd5a1,null))[_0x9c5a('0x40')](saveUpdates(_0xc47e57['body'],null))[_0x9c5a('0x40')](respondWithResult(_0x3dd5a1,null))[_0x9c5a('0x4a')](handleError(_0x3dd5a1,null));};exports[_0x9c5a('0x23')]=function(_0x4a98f0,_0x9e1b2b){return db[_0x9c5a('0x29')][_0x9c5a('0x47')]({'where':{'id':_0x4a98f0[_0x9c5a('0x46')]['id']}})[_0x9c5a('0x40')](handleEntityNotFound(_0x9e1b2b,null))[_0x9c5a('0x40')](removeEntity(_0x9e1b2b,null))['catch'](handleError(_0x9e1b2b,null));};exports['describe']=function(_0x7430a0,_0x4179c2){return db[_0x9c5a('0x29')]['describe']()[_0x9c5a('0x40')](respondWithResult(_0x4179c2,null))[_0x9c5a('0x4a')](handleError(_0x4179c2,null));}; \ No newline at end of file +var _0x2b87=['catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows'];(function(_0x3b5632,_0x3a0a3b){var _0x23a64e=function(_0x4ca252){while(--_0x4ca252){_0x3b5632['push'](_0x3b5632['shift']());}};_0x23a64e(++_0x3a0a3b);}(_0x2b87,0x18f));var _0x72b8=function(_0x28fb62,_0x4c3548){_0x28fb62=_0x28fb62-0x0;var _0x1f7e81=_0x2b87[_0x28fb62];return _0x1f7e81;};'use strict';var emlformat=require(_0x72b8('0x0'));var rimraf=require(_0x72b8('0x1'));var zipdir=require(_0x72b8('0x2'));var jsonpatch=require(_0x72b8('0x3'));var rp=require(_0x72b8('0x4'));var moment=require(_0x72b8('0x5'));var BPromise=require(_0x72b8('0x6'));var Mustache=require('mustache');var util=require(_0x72b8('0x7'));var path=require(_0x72b8('0x8'));var sox=require('sox');var csv=require(_0x72b8('0x9'));var ejs=require(_0x72b8('0xa'));var fs=require('fs');var fs_extra=require(_0x72b8('0xb'));var _=require(_0x72b8('0xc'));var squel=require(_0x72b8('0xd'));var crypto=require(_0x72b8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x72b8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x72b8('0x10'));var Redis=require(_0x72b8('0x11'));var authService=require(_0x72b8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x72b8('0x13'));var hardwareService=require(_0x72b8('0x14'));var logger=require('../../config/logger')(_0x72b8('0x15'));var utils=require(_0x72b8('0x16'));var config=require(_0x72b8('0x17'));var licenseUtil=require(_0x72b8('0x18'));var db=require(_0x72b8('0x19'))['db'];function respondWithStatusCode(_0x3b7f91,_0x55cb32){_0x55cb32=_0x55cb32||0xcc;return function(_0x1c0881){if(_0x1c0881){return _0x3b7f91[_0x72b8('0x1a')](_0x55cb32);}return _0x3b7f91['status'](_0x55cb32)[_0x72b8('0x1b')]();};}function respondWithResult(_0x2c9650,_0x2be0d7){_0x2be0d7=_0x2be0d7||0xc8;return function(_0x4e6c94){if(_0x4e6c94){return _0x2c9650[_0x72b8('0x1c')](_0x2be0d7)[_0x72b8('0x1d')](_0x4e6c94);}};}function respondWithFilteredResult(_0x3def83,_0x13e2f7){return function(_0x1b497c){if(_0x1b497c){var _0x4435e1=typeof _0x13e2f7[_0x72b8('0x1e')]===_0x72b8('0x1f')&&typeof _0x13e2f7['limit']===_0x72b8('0x1f');var _0x50e21d=_0x1b497c[_0x72b8('0x20')];var _0x8c91a4=_0x4435e1?0x0:_0x13e2f7[_0x72b8('0x1e')];var _0x1c14d1=_0x4435e1?_0x1b497c['count']:_0x13e2f7[_0x72b8('0x1e')]+_0x13e2f7[_0x72b8('0x21')];var _0x588df2;if(_0x1c14d1>=_0x50e21d){_0x1c14d1=_0x50e21d;_0x588df2=0xc8;}else{_0x588df2=0xce;}_0x3def83[_0x72b8('0x1c')](_0x588df2);return _0x3def83['set'](_0x72b8('0x22'),_0x8c91a4+'-'+_0x1c14d1+'/'+_0x50e21d)['json'](_0x1b497c);}return null;};}function patchUpdates(_0x38fd15){return function(_0x2b911e){try{jsonpatch[_0x72b8('0x23')](_0x2b911e,_0x38fd15,!![]);}catch(_0x153e74){return BPromise[_0x72b8('0x24')](_0x153e74);}return _0x2b911e[_0x72b8('0x25')]();};}function saveUpdates(_0x4438e5,_0x31f077){return function(_0x314bef){if(_0x314bef){return _0x314bef[_0x72b8('0x26')](_0x4438e5)['then'](function(_0x36f5c0){return _0x36f5c0;});}return null;};}function removeEntity(_0x2a7f7e,_0x18ad7d){return function(_0x589209){if(_0x589209){return _0x589209['destroy']()[_0x72b8('0x27')](function(){_0x2a7f7e[_0x72b8('0x1c')](0xcc)[_0x72b8('0x1b')]();});}};}function handleEntityNotFound(_0x1520b4,_0x3df34c){return function(_0x604f14){if(!_0x604f14){_0x1520b4[_0x72b8('0x1a')](0x194);}return _0x604f14;};}function handleError(_0x274fbf,_0x8ff206){_0x8ff206=_0x8ff206||0x1f4;return function(_0x8abf0b){logger['error'](_0x8abf0b[_0x72b8('0x28')]);if(_0x8abf0b[_0x72b8('0x29')]){delete _0x8abf0b[_0x72b8('0x29')];}_0x274fbf[_0x72b8('0x1c')](_0x8ff206)[_0x72b8('0x2a')](_0x8abf0b);};}exports[_0x72b8('0x2b')]=function(_0x3bac0b,_0x4e1d0b){var _0x1bcdfb={},_0x367d2c={},_0x4cf6c8={'count':0x0,'rows':[]};var _0x23f31=_[_0x72b8('0x2c')](db[_0x72b8('0x2d')][_0x72b8('0x2e')],function(_0x487dc7){return{'name':_0x487dc7[_0x72b8('0x2f')],'type':_0x487dc7[_0x72b8('0x30')][_0x72b8('0x31')]};});_0x367d2c[_0x72b8('0x32')]=_[_0x72b8('0x2c')](_0x23f31,'name');_0x367d2c[_0x72b8('0x33')]=_['keys'](_0x3bac0b[_0x72b8('0x33')]);_0x367d2c[_0x72b8('0x34')]=_[_0x72b8('0x35')](_0x367d2c['model'],_0x367d2c[_0x72b8('0x33')]);_0x1bcdfb[_0x72b8('0x36')]=_['intersection'](_0x367d2c[_0x72b8('0x32')],qs[_0x72b8('0x37')](_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x37')]));_0x1bcdfb['attributes']=_0x1bcdfb[_0x72b8('0x36')][_0x72b8('0x38')]?_0x1bcdfb[_0x72b8('0x36')]:_0x367d2c['model'];if(!_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x39')](_0x72b8('0x3a'))){_0x1bcdfb[_0x72b8('0x21')]=qs[_0x72b8('0x21')](_0x3bac0b['query']['limit']);_0x1bcdfb[_0x72b8('0x1e')]=qs[_0x72b8('0x1e')](_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x1e')]);}_0x1bcdfb[_0x72b8('0x3b')]=qs[_0x72b8('0x3c')](_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x3c')]);_0x1bcdfb[_0x72b8('0x3d')]=qs[_0x72b8('0x34')](_[_0x72b8('0x3e')](_0x3bac0b['query'],_0x367d2c[_0x72b8('0x34')]),_0x23f31);if(_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x3f')]){_0x1bcdfb[_0x72b8('0x3d')]=_['merge'](_0x1bcdfb[_0x72b8('0x3d')],{'$or':_[_0x72b8('0x2c')](_0x23f31,function(_0x588a3a){if(_0x588a3a[_0x72b8('0x30')]!==_0x72b8('0x40')){var _0x28b2e8={};_0x28b2e8[_0x588a3a[_0x72b8('0x29')]]={'$like':'%'+_0x3bac0b['query'][_0x72b8('0x3f')]+'%'};return _0x28b2e8;}})});}_0x1bcdfb=_[_0x72b8('0x41')]({},_0x1bcdfb,_0x3bac0b['options']);var _0x1b4793={'where':_0x1bcdfb['where']};return db[_0x72b8('0x2d')][_0x72b8('0x20')](_0x1b4793)[_0x72b8('0x27')](function(_0x2a0ebc){_0x4cf6c8[_0x72b8('0x20')]=_0x2a0ebc;if(_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x42')]){_0x1bcdfb[_0x72b8('0x43')]=[{'all':!![]}];}return db[_0x72b8('0x2d')]['findAll'](_0x1bcdfb);})['then'](function(_0x3d128c){_0x4cf6c8[_0x72b8('0x44')]=_0x3d128c;return _0x4cf6c8;})[_0x72b8('0x27')](respondWithFilteredResult(_0x4e1d0b,_0x1bcdfb))[_0x72b8('0x45')](handleError(_0x4e1d0b,null));};exports[_0x72b8('0x46')]=function(_0x3be04b,_0x5e1fbf){var _0x4b3637={'raw':!![],'where':{'id':_0x3be04b[_0x72b8('0x47')]['id']}},_0x41c257={};_0x41c257['model']=_[_0x72b8('0x48')](db['VoiceDialReport'][_0x72b8('0x2e')]);_0x41c257[_0x72b8('0x33')]=_[_0x72b8('0x48')](_0x3be04b[_0x72b8('0x33')]);_0x41c257[_0x72b8('0x34')]=_[_0x72b8('0x35')](_0x41c257[_0x72b8('0x32')],_0x41c257['query']);_0x4b3637['attributes']=_[_0x72b8('0x35')](_0x41c257[_0x72b8('0x32')],qs[_0x72b8('0x37')](_0x3be04b[_0x72b8('0x33')]['fields']));_0x4b3637[_0x72b8('0x36')]=_0x4b3637[_0x72b8('0x36')]['length']?_0x4b3637[_0x72b8('0x36')]:_0x41c257[_0x72b8('0x32')];if(_0x3be04b[_0x72b8('0x33')][_0x72b8('0x42')]){_0x4b3637[_0x72b8('0x43')]=[{'all':!![]}];}_0x4b3637=_[_0x72b8('0x41')]({},_0x4b3637,_0x3be04b[_0x72b8('0x49')]);return db[_0x72b8('0x2d')][_0x72b8('0x4a')](_0x4b3637)['then'](handleEntityNotFound(_0x5e1fbf,null))[_0x72b8('0x27')](respondWithResult(_0x5e1fbf,null))[_0x72b8('0x45')](handleError(_0x5e1fbf,null));};exports[_0x72b8('0x4b')]=function(_0x5436d7,_0x4f9149){return db[_0x72b8('0x2d')]['create'](_0x5436d7[_0x72b8('0x4c')],{})[_0x72b8('0x27')](respondWithResult(_0x4f9149,0xc9))[_0x72b8('0x45')](handleError(_0x4f9149,null));};exports[_0x72b8('0x26')]=function(_0x20ebe4,_0x3439ba){if(_0x20ebe4[_0x72b8('0x4c')]['id']){delete _0x20ebe4[_0x72b8('0x4c')]['id'];}return db[_0x72b8('0x2d')][_0x72b8('0x4a')]({'where':{'id':_0x20ebe4[_0x72b8('0x47')]['id']}})[_0x72b8('0x27')](handleEntityNotFound(_0x3439ba,null))[_0x72b8('0x27')](saveUpdates(_0x20ebe4[_0x72b8('0x4c')],null))[_0x72b8('0x27')](respondWithResult(_0x3439ba,null))[_0x72b8('0x45')](handleError(_0x3439ba,null));};exports['destroy']=function(_0x2111cd,_0x477578){return db['VoiceDialReport']['find']({'where':{'id':_0x2111cd['params']['id']}})[_0x72b8('0x27')](handleEntityNotFound(_0x477578,null))['then'](removeEntity(_0x477578,null))['catch'](handleError(_0x477578,null));};exports[_0x72b8('0x4d')]=function(_0x4461b0,_0x447d30){return db['VoiceDialReport']['describe']()[_0x72b8('0x27')](respondWithResult(_0x447d30,null))[_0x72b8('0x45')](handleError(_0x447d30,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index e947c79..905ac29 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 _0x4044=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x4044,0xcb));var _0x4404=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4044[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x4404('0x0'));var util=require(_0x4404('0x1'));var logger=require(_0x4404('0x2'))(_0x4404('0x3'));var moment=require(_0x4404('0x4'));var BPromise=require(_0x4404('0x5'));var rp=require(_0x4404('0x6'));var fs=require('fs');var path=require(_0x4404('0x7'));var rimraf=require(_0x4404('0x8'));var config=require(_0x4404('0x9'));var attributes=require(_0x4404('0xa'));module[_0x4404('0xb')]=function(_0x53cef4,_0x4f8263){return _0x53cef4[_0x4404('0xc')](_0x4404('0xd'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x4404('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62dd=['moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0x317db3,_0xef2070){var _0x593f60=function(_0x519672){while(--_0x519672){_0x317db3['push'](_0x317db3['shift']());}};_0x593f60(++_0xef2070);}(_0x62dd,0x6c));var _0xd62d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x62dd[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd62d('0x0'));var util=require(_0xd62d('0x1'));var logger=require(_0xd62d('0x2'))(_0xd62d('0x3'));var moment=require(_0xd62d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd62d('0x5'));var fs=require('fs');var path=require(_0xd62d('0x6'));var rimraf=require(_0xd62d('0x7'));var config=require(_0xd62d('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0xd62d('0x9')]=function(_0x5326fa,_0x11adaf){return _0x5326fa[_0xd62d('0xa')](_0xd62d('0xb'),attributes,{'tableName':_0xd62d('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd62d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 2814cdc..be5af6c 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 _0x10a2=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','limit','UpdateVoiceDialReport','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1d5a14,_0x113dc2){var _0x50faf0=function(_0x35f1d8){while(--_0x35f1d8){_0x1d5a14['push'](_0x1d5a14['shift']());}};_0x50faf0(++_0x113dc2);}(_0x10a2,0x134));var _0x210a=function(_0x3f9ece,_0xe2b4d2){_0x3f9ece=_0x3f9ece-0x0;var _0x4f0c13=_0x10a2[_0x3f9ece];return _0x4f0c13;};'use strict';var _=require('lodash');var util=require(_0x210a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x210a('0x1'));var db=require(_0x210a('0x2'))['db'];var utils=require(_0x210a('0x3'));var logger=require('../../config/logger')(_0x210a('0x4'));var config=require(_0x210a('0x5'));var jayson=require(_0x210a('0x6'));var client=jayson[_0x210a('0x7')][_0x210a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1944fb,_0x5ee866,_0x50399c){return new BPromise(function(_0x59170d,_0x3cfc8f){return client[_0x210a('0x9')](_0x1944fb,_0x50399c)[_0x210a('0xa')](function(_0x5ebe7b){logger[_0x210a('0xb')](_0x210a('0xc'),_0x5ee866,_0x210a('0xd'));logger[_0x210a('0xe')](_0x210a('0xf'),_0x5ee866,_0x210a('0xd'),JSON[_0x210a('0x10')](_0x5ebe7b));if(_0x5ebe7b[_0x210a('0x11')]){if(_0x5ebe7b[_0x210a('0x11')][_0x210a('0x12')]===0x1f4){logger[_0x210a('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x5ee866,_0x5ebe7b[_0x210a('0x11')]['message']);return _0x3cfc8f(_0x5ebe7b['error'][_0x210a('0x13')]);}logger[_0x210a('0x11')](_0x210a('0xc'),_0x5ee866,_0x5ebe7b[_0x210a('0x11')][_0x210a('0x13')]);return _0x59170d(_0x5ebe7b[_0x210a('0x11')]['message']);}else{logger['info'](_0x210a('0xc'),_0x5ee866,_0x210a('0xd'));_0x59170d(_0x5ebe7b['result'][_0x210a('0x13')]);}})[_0x210a('0x14')](function(_0x2c6e39){logger[_0x210a('0x11')](_0x210a('0xc'),_0x5ee866,_0x2c6e39);_0x3cfc8f(_0x2c6e39);});});}exports[_0x210a('0x15')]=function(_0x33e56e){var _0x5dd233=this;return new Promise(function(_0x421a1a,_0x299acc){return db[_0x210a('0x16')][_0x210a('0x17')](_0x33e56e[_0x210a('0x18')],{'raw':_0x33e56e[_0x210a('0x19')]?_0x33e56e[_0x210a('0x19')][_0x210a('0x1a')]===undefined?!![]:![]:!![]})[_0x210a('0xa')](function(_0x2a817b){logger[_0x210a('0xb')](_0x210a('0x15'),_0x33e56e);logger['debug'](_0x210a('0x15'),_0x33e56e,JSON[_0x210a('0x10')](_0x2a817b));_0x421a1a(_0x2a817b);})['catch'](function(_0x50afd9){logger[_0x210a('0x11')](_0x210a('0x15'),_0x50afd9['message'],_0x33e56e);_0x299acc(_0x5dd233[_0x210a('0x11')](0x1f4,_0x50afd9[_0x210a('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x7ccdd1){var _0x4b7f6a=this;return new Promise(function(_0x7836eb,_0x35e8f8){return db[_0x210a('0x16')]['update'](_0x7ccdd1[_0x210a('0x18')],{'raw':_0x7ccdd1[_0x210a('0x19')]?_0x7ccdd1[_0x210a('0x19')][_0x210a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7ccdd1[_0x210a('0x19')]?_0x7ccdd1['options']['where']||null:null,'attributes':_0x7ccdd1[_0x210a('0x19')]?_0x7ccdd1['options']['attributes']||null:null,'limit':_0x7ccdd1[_0x210a('0x19')]?_0x7ccdd1[_0x210a('0x19')][_0x210a('0x1b')]||null:null})['then'](function(_0x434f4e){logger[_0x210a('0xb')](_0x210a('0x1c'),_0x7ccdd1);logger[_0x210a('0xe')](_0x210a('0x1c'),_0x7ccdd1,JSON[_0x210a('0x10')](_0x434f4e));_0x7836eb(_0x434f4e);})[_0x210a('0x14')](function(_0x4299de){logger['error'](_0x210a('0x1c'),_0x4299de[_0x210a('0x13')],_0x7ccdd1);_0x35e8f8(_0x4b7f6a[_0x210a('0x11')](0x1f4,_0x4299de[_0x210a('0x13')]));});});}; \ No newline at end of file +var _0xa05d=['jayson/promise','client','http','request','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceDialReport,\x20%s,\x20%s','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','debug','stringify','UpdateVoiceDialReport','update','where','attributes','limit','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x36f797,_0x351603){var _0x44ba30=function(_0x32eb10){while(--_0x32eb10){_0x36f797['push'](_0x36f797['shift']());}};_0x44ba30(++_0x351603);}(_0xa05d,0x1e2));var _0xda05=function(_0x60b6fe,_0x49603b){_0x60b6fe=_0x60b6fe-0x0;var _0xdc9604=_0xa05d[_0x60b6fe];return _0xdc9604;};'use strict';var _=require('lodash');var util=require(_0xda05('0x0'));var moment=require(_0xda05('0x1'));var BPromise=require(_0xda05('0x2'));var rs=require(_0xda05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda05('0x4'))['db'];var utils=require(_0xda05('0x5'));var logger=require(_0xda05('0x6'))(_0xda05('0x7'));var config=require('../../config/environment');var jayson=require(_0xda05('0x8'));var client=jayson[_0xda05('0x9')][_0xda05('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13c218,_0x3a197b,_0x4e3843){return new BPromise(function(_0x29a671,_0x5e65f2){return client[_0xda05('0xb')](_0x13c218,_0x4e3843)['then'](function(_0x41badf){logger[_0xda05('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x3a197b,_0xda05('0xd'));logger['debug'](_0xda05('0xe'),_0x3a197b,_0xda05('0xd'),JSON['stringify'](_0x41badf));if(_0x41badf[_0xda05('0xf')]){if(_0x41badf[_0xda05('0xf')][_0xda05('0x10')]===0x1f4){logger[_0xda05('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x3a197b,_0x41badf[_0xda05('0xf')][_0xda05('0x11')]);return _0x5e65f2(_0x41badf[_0xda05('0xf')]['message']);}logger[_0xda05('0xf')](_0xda05('0x12'),_0x3a197b,_0x41badf[_0xda05('0xf')][_0xda05('0x11')]);return _0x29a671(_0x41badf[_0xda05('0xf')][_0xda05('0x11')]);}else{logger[_0xda05('0xc')](_0xda05('0x12'),_0x3a197b,'request\x20sent');_0x29a671(_0x41badf[_0xda05('0x13')][_0xda05('0x11')]);}})['catch'](function(_0x1bb466){logger[_0xda05('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x3a197b,_0x1bb466);_0x5e65f2(_0x1bb466);});});}exports[_0xda05('0x14')]=function(_0x48fcdd){var _0x5a3b1e=this;return new Promise(function(_0x16badf,_0x4ba54d){return db[_0xda05('0x15')][_0xda05('0x16')](_0x48fcdd[_0xda05('0x17')],{'raw':_0x48fcdd[_0xda05('0x18')]?_0x48fcdd[_0xda05('0x18')][_0xda05('0x19')]===undefined?!![]:![]:!![]})[_0xda05('0x1a')](function(_0x56789a){logger[_0xda05('0xc')](_0xda05('0x14'),_0x48fcdd);logger[_0xda05('0x1b')](_0xda05('0x14'),_0x48fcdd,JSON[_0xda05('0x1c')](_0x56789a));_0x16badf(_0x56789a);})['catch'](function(_0x1b80d1){logger[_0xda05('0xf')](_0xda05('0x14'),_0x1b80d1[_0xda05('0x11')],_0x48fcdd);_0x4ba54d(_0x5a3b1e[_0xda05('0xf')](0x1f4,_0x1b80d1[_0xda05('0x11')]));});});};exports[_0xda05('0x1d')]=function(_0x428838){var _0xe20480=this;return new Promise(function(_0x2f9159,_0x1c10b3){return db[_0xda05('0x15')][_0xda05('0x1e')](_0x428838[_0xda05('0x17')],{'raw':_0x428838[_0xda05('0x18')]?_0x428838[_0xda05('0x18')][_0xda05('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x428838[_0xda05('0x18')]?_0x428838[_0xda05('0x18')][_0xda05('0x1f')]||null:null,'attributes':_0x428838[_0xda05('0x18')]?_0x428838[_0xda05('0x18')][_0xda05('0x20')]||null:null,'limit':_0x428838[_0xda05('0x18')]?_0x428838[_0xda05('0x18')][_0xda05('0x21')]||null:null})['then'](function(_0x114467){logger[_0xda05('0xc')]('UpdateVoiceDialReport',_0x428838);logger[_0xda05('0x1b')](_0xda05('0x1d'),_0x428838,JSON['stringify'](_0x114467));_0x2f9159(_0x114467);})[_0xda05('0x22')](function(_0x48f4d9){logger[_0xda05('0xf')](_0xda05('0x1d'),_0x48f4d9[_0xda05('0x11')],_0x428838);_0x1c10b3(_0xe20480[_0xda05('0xf')](0x1f4,_0x48f4d9[_0xda05('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index d8fa853..09b9c1e 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 _0x7c9d=['../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','put','update','delete','exports','multer','path','express','Router'];(function(_0x49ca92,_0x445884){var _0xfa3a4d=function(_0x3bbe68){while(--_0x3bbe68){_0x49ca92['push'](_0x49ca92['shift']());}};_0xfa3a4d(++_0x445884);}(_0x7c9d,0xfb));var _0xd7c9=function(_0x2832a8,_0x43424a){_0x2832a8=_0x2832a8-0x0;var _0x5b53cb=_0x7c9d[_0x2832a8];return _0x5b53cb;};'use strict';var multer=require(_0xd7c9('0x0'));var util=require('util');var path=require(_0xd7c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd7c9('0x2'));var router=express[_0xd7c9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd7c9('0x4'));var config=require('../../config/environment');var controller=require(_0xd7c9('0x5'));router[_0xd7c9('0x6')]('/',auth[_0xd7c9('0x7')](),controller[_0xd7c9('0x8')]);router[_0xd7c9('0x6')](_0xd7c9('0x9'),auth[_0xd7c9('0x7')](),controller[_0xd7c9('0xa')]);router['post']('/',auth[_0xd7c9('0x7')](),controller[_0xd7c9('0xb')]);router[_0xd7c9('0xc')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xd7c9('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xd7c9('0xe')]);router[_0xd7c9('0xf')](_0xd7c9('0x9'),auth[_0xd7c9('0x7')](),controller['destroy']);module[_0xd7c9('0x10')]=router; \ No newline at end of file +var _0x90ec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','show','create','post','/:id/applications','addApplications','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x310ee0,_0x1c5d46){var _0x2aae43=function(_0x15dabd){while(--_0x15dabd){_0x310ee0['push'](_0x310ee0['shift']());}};_0x2aae43(++_0x1c5d46);}(_0x90ec,0x1de));var _0xc90e=function(_0x16a2fc,_0x3de2f6){_0x16a2fc=_0x16a2fc-0x0;var _0x19ec71=_0x90ec[_0x16a2fc];return _0x19ec71;};'use strict';var multer=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var path=require(_0xc90e('0x2'));var timeout=require(_0xc90e('0x3'));var express=require('express');var router=express[_0xc90e('0x4')]();var fs_extra=require(_0xc90e('0x5'));var auth=require(_0xc90e('0x6'));var interaction=require(_0xc90e('0x7'));var config=require(_0xc90e('0x8'));var controller=require(_0xc90e('0x9'));router['get']('/',auth[_0xc90e('0xa')](),controller[_0xc90e('0xb')]);router['get']('/:id',auth[_0xc90e('0xa')](),controller[_0xc90e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc90e('0xd')]);router[_0xc90e('0xe')](_0xc90e('0xf'),auth[_0xc90e('0xa')](),controller[_0xc90e('0x10')]);router[_0xc90e('0x11')](_0xc90e('0x12'),auth[_0xc90e('0xa')](),controller[_0xc90e('0x13')]);router[_0xc90e('0x14')](_0xc90e('0x12'),auth[_0xc90e('0xa')](),controller['destroy']);module[_0xc90e('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 135eac4..25b80f6 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 _0x75ec=['STRING','NoOp','ENUM','inbound','internal','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','VIRTUAL','getDataValue','exten','sequelize','exports'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0x75ec,0x1de));var _0xc75e=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x75ec[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0xc75e('0x0'));module[_0xc75e('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xc75e('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xc75e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc75e('0x3')},'appdata':{'type':Sequelize[_0xc75e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc75e('0x4')](_0xc75e('0x5'),'outbound',_0xc75e('0x6'),'inbound-fax',_0xc75e('0x7'),'system',_0xc75e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xc75e('0x2')]},'interval':{'type':Sequelize[_0xc75e('0x2')],'allowNull':![],'defaultValue':_0xc75e('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xc75e('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc75e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc75e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xc75e('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc75e('0xb')]},'recordingFormat':{'type':Sequelize[_0xc75e('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xc75e('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc75e('0xc')],'get':function(_0x40f8a9){return this[_0xc75e('0xd')](_0xc75e('0xe'));}},'alias':{'type':Sequelize[_0xc75e('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0b81=['system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','compositeIndex','STRING','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b81,0x91));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x10b8('0x0'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x10b8('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x10b8('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x10b8('0x0')},'tag':{'type':Sequelize[_0x10b8('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x10b8('0x1')],'allowNull':![],'defaultValue':_0x10b8('0x2')},'appdata':{'type':Sequelize[_0x10b8('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x10b8('0x3'),_0x10b8('0x4'),_0x10b8('0x5'),_0x10b8('0x6'),_0x10b8('0x7'),_0x10b8('0x8'),_0x10b8('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x10b8('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x10b8('0xa')},'IntervalId':{'type':Sequelize[_0x10b8('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x10b8('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x10b8('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x10b8('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x10b8('0xb')]},'recordingFormat':{'type':Sequelize[_0x10b8('0x1')],'defaultValue':_0x10b8('0xd')},'answer':{'type':Sequelize[_0x10b8('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x10b8('0xe')],'get':function(_0x29084a){return this[_0x10b8('0xf')](_0x10b8('0x10'));}},'alias':{'type':Sequelize[_0x10b8('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0b18907..5f4c590 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 _0x4455=['OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','error','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','body','outbound','startsWith','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','undefined','limit','offset','count','status','set','json','destroy','then','InboundRoutes','inbound'];(function(_0x1e338c,_0x1b29de){var _0x539c74=function(_0x419d23){while(--_0x419d23){_0x1e338c['push'](_0x1e338c['shift']());}};_0x539c74(++_0x1b29de);}(_0x4455,0x15a));var _0x5445=function(_0x21b75c,_0x5871f2){_0x21b75c=_0x21b75c-0x0;var _0x16ad4b=_0x4455[_0x21b75c];return _0x16ad4b;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x5445('0x0'));var logger=require('../../config/logger')(_0x5445('0x1'));var config=require(_0x5445('0x2'));var db=require(_0x5445('0x3'))['db'];config[_0x5445('0x4')]=_[_0x5445('0x5')](config[_0x5445('0x4')],{'host':_0x5445('0x6'),'port':0x18eb});var socket=require(_0x5445('0x7'))(new Redis(config[_0x5445('0x4')]));require(_0x5445('0x8'))[_0x5445('0x9')](socket);function respondWithStatusCode(_0x255287,_0x3abe83){_0x3abe83=_0x3abe83||0xcc;return function(_0x37921d){if(_0x37921d){return _0x255287[_0x5445('0xa')](_0x3abe83);}return _0x255287['status'](_0x3abe83)['end']();};}function respondWithResult(_0x14c437,_0x5bb2ea){_0x5bb2ea=_0x5bb2ea||0xc8;return function(_0x5d7af9){if(_0x5d7af9){return _0x14c437['status'](_0x5bb2ea)['json'](_0x5d7af9);}};}function respondWithFilteredResult(_0xde0dcf,_0x52a700){return function(_0xee743e){if(_0xee743e){var _0x18cef6=typeof _0x52a700['offset']===_0x5445('0xb')&&typeof _0x52a700[_0x5445('0xc')]===_0x5445('0xb');var _0x2798bc=_0xee743e['count'];var _0x48bccb=_0x18cef6?0x0:_0x52a700[_0x5445('0xd')];var _0x58ab0b=_0x18cef6?_0xee743e[_0x5445('0xe')]:_0x52a700[_0x5445('0xd')]+_0x52a700[_0x5445('0xc')];var _0x279941;if(_0x58ab0b>=_0x2798bc){_0x58ab0b=_0x2798bc;_0x279941=0xc8;}else{_0x279941=0xce;}_0xde0dcf[_0x5445('0xf')](_0x279941);return _0xde0dcf[_0x5445('0x10')]('Content-Range',_0x48bccb+'-'+_0x58ab0b+'/'+_0x2798bc)[_0x5445('0x11')](_0xee743e);}return null;};}function removeEntity(_0x4518a2){return function(_0x11ba8e){if(_0x11ba8e){return _0x11ba8e[_0x5445('0x12')]()[_0x5445('0x13')](function(){var _0x2456c1=_0x11ba8e['get']({'plain':!![]});var _0x1ca80e=[{'name':_0x5445('0x14'),'value':_0x5445('0x15'),'ignore':![]},{'name':_0x5445('0x16'),'value':'outbound','ignore':![]},{'name':_0x5445('0x17'),'value':_0x5445('0x18'),'ignore':![]}];var _0x520653=_(_0x1ca80e)[_0x5445('0x19')](_0x5445('0x1a'))[_0x5445('0x1b')]('value')[_0x5445('0x1c')]();if(_[_0x5445('0x1d')](_0x520653,_0x2456c1[_0x5445('0x1e')])){return;}var _0x5a4453=_[_0x5445('0x1f')](_0x1ca80e,[_0x5445('0x1c'),_0x2456c1[_0x5445('0x1e')]])[_0x5445('0x20')];return db['UserProfileResource']['destroy']({'where':{'type':_0x5a4453,'resourceId':_0x2456c1['id']}})[_0x5445('0x13')](function(){return _0x11ba8e;});})[_0x5445('0x13')](function(){_0x4518a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a9cb1){return function(_0x15c1b3){if(!_0x15c1b3){_0x1a9cb1['sendStatus'](0x194);}return _0x15c1b3;};}function handleError(_0x355295,_0x39a10b){_0x39a10b=_0x39a10b||0x1f4;return function(_0x57020f){logger[_0x5445('0x21')](_0x57020f['stack']);if(_0x57020f['name']){delete _0x57020f[_0x5445('0x20')];}_0x355295[_0x5445('0xf')](_0x39a10b)[_0x5445('0x22')](_0x57020f);};}exports[_0x5445('0x23')]=function(_0x19433e,_0x38f8d5){var _0x4d86f5={},_0x8d648f={},_0x9cc12a={'count':0x0,'rows':[]};var _0x5e2e3b=_[_0x5445('0x1b')](db[_0x5445('0x24')][_0x5445('0x25')],function(_0x30246d){return{'name':_0x30246d[_0x5445('0x26')],'type':_0x30246d[_0x5445('0x1e')][_0x5445('0x27')]};});_0x8d648f[_0x5445('0x28')]=_['map'](_0x5e2e3b,_0x5445('0x20'));_0x8d648f[_0x5445('0x29')]=_[_0x5445('0x2a')](_0x19433e[_0x5445('0x29')]);_0x8d648f[_0x5445('0x2b')]=_['intersection'](_0x8d648f[_0x5445('0x28')],_0x8d648f[_0x5445('0x29')]);_0x4d86f5[_0x5445('0x2c')]=_[_0x5445('0x2d')](_0x8d648f[_0x5445('0x28')],qs[_0x5445('0x2e')](_0x19433e[_0x5445('0x29')][_0x5445('0x2e')]));_0x4d86f5['attributes']=_0x4d86f5[_0x5445('0x2c')][_0x5445('0x2f')]?_0x4d86f5[_0x5445('0x2c')]:_0x8d648f[_0x5445('0x28')];if(!_0x19433e[_0x5445('0x29')]['hasOwnProperty']('nolimit')){_0x4d86f5['limit']=qs[_0x5445('0xc')](_0x19433e[_0x5445('0x29')][_0x5445('0xc')]);_0x4d86f5[_0x5445('0xd')]=qs[_0x5445('0xd')](_0x19433e[_0x5445('0x29')][_0x5445('0xd')]);}_0x4d86f5[_0x5445('0x30')]=qs['sort'](_0x19433e[_0x5445('0x29')][_0x5445('0x31')]);_0x4d86f5[_0x5445('0x32')]=qs[_0x5445('0x2b')](_[_0x5445('0x33')](_0x19433e['query'],_0x8d648f[_0x5445('0x2b')]),_0x5e2e3b);if(_0x19433e['query'][_0x5445('0x19')]){_0x4d86f5[_0x5445('0x32')]=_[_0x5445('0x34')](_0x4d86f5['where'],{'$or':_[_0x5445('0x1b')](_0x5e2e3b,function(_0x2b0dd1){if(_0x2b0dd1[_0x5445('0x1e')]!==_0x5445('0x35')){var _0x2d867b={};_0x2d867b[_0x2b0dd1[_0x5445('0x20')]]={'$like':'%'+_0x19433e['query'][_0x5445('0x19')]+'%'};return _0x2d867b;}})});}_0x4d86f5=_['merge']({},_0x4d86f5,_0x19433e[_0x5445('0x36')]);var _0x92b7a6={'where':_0x4d86f5['where']};return db[_0x5445('0x24')][_0x5445('0xe')](_0x92b7a6)[_0x5445('0x13')](function(_0xc01598){_0x9cc12a[_0x5445('0xe')]=_0xc01598;if(_0x19433e['query']['includeAll']){_0x4d86f5[_0x5445('0x37')]=[{'all':!![]}];}return db[_0x5445('0x24')][_0x5445('0x38')](_0x4d86f5);})['then'](function(_0x77f9b){_0x9cc12a[_0x5445('0x39')]=_0x77f9b;return _0x9cc12a;})[_0x5445('0x13')](respondWithFilteredResult(_0x38f8d5,_0x4d86f5))[_0x5445('0x3a')](handleError(_0x38f8d5,null));};exports[_0x5445('0x3b')]=function(_0xb62aef,_0xaed558){var _0x1057a5={'raw':![],'where':{'id':_0xb62aef[_0x5445('0x3c')]['id']}},_0x14c5a1={};_0x14c5a1[_0x5445('0x28')]=_[_0x5445('0x2a')](db[_0x5445('0x24')][_0x5445('0x25')]);_0x14c5a1[_0x5445('0x29')]=_[_0x5445('0x2a')](_0xb62aef[_0x5445('0x29')]);_0x14c5a1[_0x5445('0x2b')]=_[_0x5445('0x2d')](_0x14c5a1[_0x5445('0x28')],_0x14c5a1[_0x5445('0x29')]);_0x1057a5[_0x5445('0x2c')]=_[_0x5445('0x2d')](_0x14c5a1[_0x5445('0x28')],qs[_0x5445('0x2e')](_0xb62aef[_0x5445('0x29')]['fields']));_0x1057a5[_0x5445('0x2c')]=_0x1057a5['attributes']['length']?_0x1057a5['attributes']:_0x14c5a1[_0x5445('0x28')];if(_0xb62aef[_0x5445('0x29')][_0x5445('0x3d')]){_0x1057a5[_0x5445('0x37')]=[{'all':!![]}];}_0x1057a5=_[_0x5445('0x34')]({},_0x1057a5,_0xb62aef[_0x5445('0x36')]);return db[_0x5445('0x24')]['find'](_0x1057a5)['then'](handleEntityNotFound(_0xaed558,null))[_0x5445('0x13')](respondWithResult(_0xaed558,null))[_0x5445('0x3a')](handleError(_0xaed558,null));};exports['destroy']=function(_0x2023e2,_0x4c6259){return db[_0x5445('0x24')]['find']({'where':{'id':_0x2023e2[_0x5445('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4c6259,null))[_0x5445('0x13')](removeEntity(_0x4c6259,null))[_0x5445('0x3a')](handleError(_0x4c6259,null));};exports['create']=function(_0x221b0b,_0xced5f6){if(_0x221b0b[_0x5445('0x3e')][_0x5445('0x1e')]===_0x5445('0x3f')&&!_[_0x5445('0x40')](_0x221b0b[_0x5445('0x3e')][_0x5445('0x41')],'_')){_0x221b0b[_0x5445('0x3e')][_0x5445('0x41')]='_'[_0x5445('0x42')](_0x221b0b[_0x5445('0x3e')]['exten']);}return db['VoiceExtension'][_0x5445('0x43')](_0x221b0b['body'],{'raw':![]})[_0x5445('0x13')](function(_0xdf9f4e){var _0x30c169=_0x221b0b[_0x5445('0x44')][_0x5445('0x45')]({'plain':!![]});if(!_0x30c169)throw new Error(_0x5445('0x46'));if(_0x30c169[_0x5445('0x47')]==='user'){var _0x386a1e=_0xdf9f4e[_0x5445('0x45')]({'plain':!![]});var _0x25cf9d=[{'name':_0x5445('0x14'),'value':_0x5445('0x15')},{'name':'OutboundRoutes','value':_0x5445('0x3f')},{'name':_0x5445('0x17'),'value':'internal'}];var _0x19be9e=_['find'](_0x25cf9d,['value',_0x386a1e[_0x5445('0x1e')]])['name'];return db['UserProfileSection'][_0x5445('0x1f')]({'where':{'name':_0x19be9e,'userProfileId':_0x30c169[_0x5445('0x48')]},'raw':!![]})[_0x5445('0x13')](function(_0x171702){if(_0x171702&&_0x171702[_0x5445('0x49')]===0x0){return db['UserProfileResource'][_0x5445('0x43')]({'name':_0x386a1e[_0x5445('0x20')],'resourceId':_0x386a1e['id'],'type':_0x171702[_0x5445('0x20')],'sectionId':_0x171702['id']},{})[_0x5445('0x13')](function(){return _0xdf9f4e;});}else{return _0xdf9f4e;}})[_0x5445('0x3a')](function(_0x505de9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x505de9);throw _0x505de9;});}return _0xdf9f4e;})['then'](respondWithResult(_0xced5f6,0xc9))[_0x5445('0x3a')](handleError(_0xced5f6,null));};exports[_0x5445('0x4a')]=function(_0x5bc254,_0x180a64){if(_0x5bc254[_0x5445('0x3e')]['id']){delete _0x5bc254[_0x5445('0x3e')]['id'];}return db[_0x5445('0x24')][_0x5445('0x1f')]({'where':{'id':_0x5bc254[_0x5445('0x3c')]['id']}})[_0x5445('0x13')](handleEntityNotFound(_0x180a64,null))['then'](function(_0x4998b0){if(_0x4998b0){return db[_0x5445('0x24')][_0x5445('0x4a')](_['pick'](_0x5bc254[_0x5445('0x3e')],[_0x5445('0x41'),'context',_0x5445('0x4b'),_0x5445('0x4c'),_0x5445('0x4d'),_0x5445('0x4e'),_0x5445('0x4f')]),{'where':{'context':_0x4998b0[_0x5445('0x50')],'exten':_0x4998b0[_0x5445('0x41')]},'individualHooks':!![]})[_0x5445('0x13')](function(_0x9b4d34){return _0x9b4d34;});}return null;})[_0x5445('0x13')](respondWithStatusCode(_0x180a64,null))['catch'](handleError(_0x180a64,null));};exports[_0x5445('0x51')]=function(_0x4ae5e3,_0x5193be){var _0x33335c=_0x4ae5e3[_0x5445('0x3c')]['id'];var _0x41cb81=_0x4ae5e3[_0x5445('0x3e')];var _0x28a7db=0xc8;var _0xa411d8=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x5445('0x52')][_0x5445('0x53')]['ISOLATION_LEVELS'][_0x5445('0x54')]},function(_0x202ef1){return db[_0x5445('0x24')][_0x5445('0x55')]({'where':{'id':_0x33335c},'transaction':_0x202ef1})[_0x5445('0x13')](function(_0x3dfe8e){if(_0x3dfe8e){return db['VoiceExtension'][_0x5445('0x12')]({'where':{'VoiceExtensionId':_0x33335c},'transaction':_0x202ef1})[_0x5445('0x13')](function(){var _0x124823=_[_0x5445('0x1b')](_0x41cb81,function(_0x338fea){_0x338fea[_0x5445('0x56')]=_0x33335c;_0x338fea['isApp']=!![];return _0x338fea;});return _0x3dfe8e[_0x5445('0x57')](_0x124823);})[_0x5445('0x13')](function(_0x444f81){return db[_0x5445('0x24')][_0x5445('0x58')](_0x444f81,{'transaction':_0x202ef1});});}else{_0x28a7db=0x194;_0xa411d8=[];}});})[_0x5445('0x13')](function(){if(_0x28a7db!==0x194){return db[_0x5445('0x24')][_0x5445('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x33335c},'order':_0x5445('0x5a')})['then'](function(_0x3b6fd6){_0xa411d8=_0x3b6fd6;});}})[_0x5445('0x3a')](function(_0xf2a6e6){_0x28a7db=0x1f4;logger[_0x5445('0x21')](_0xf2a6e6['stack']);if(_0xf2a6e6[_0x5445('0x20')]){delete _0xf2a6e6[_0x5445('0x20')];}_0xa411d8=_0xf2a6e6;})[_0x5445('0x5b')](function(){if(_0xa411d8===null){_0x5193be[_0x5445('0xa')](_0x28a7db);}else{if(_0x28a7db===0x1f4){_0x5193be[_0x5445('0xf')](_0x28a7db)[_0x5445('0x22')](_0xa411d8);}else{_0x5193be[_0x5445('0xf')](_0x28a7db)[_0x5445('0x11')](_0xa411d8);}}});}; \ No newline at end of file +var _0x2411=['Content-Range','destroy','get','OutboundRoutes','InternalRoutes','internal','filter','map','includes','type','find','value','then','error','name','send','index','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','VoiceExtension','rows','catch','show','params','body','outbound','startsWith','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','InboundRoutes','inbound','userProfileId','autoAssociation','update','pick','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x413db7,_0x4d51c5){var _0x3cb526=function(_0xdfee5d){while(--_0xdfee5d){_0x413db7['push'](_0x413db7['shift']());}};_0x3cb526(++_0x4d51c5);}(_0x2411,0x158));var _0x1241=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x2411[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0x1241('0x0'));var Redis=require(_0x1241('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x1241('0x2'))['db'];config[_0x1241('0x3')]=_[_0x1241('0x4')](config[_0x1241('0x3')],{'host':_0x1241('0x5'),'port':0x18eb});var socket=require(_0x1241('0x6'))(new Redis(config[_0x1241('0x3')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x3b104e,_0x3ed8f9){_0x3ed8f9=_0x3ed8f9||0xcc;return function(_0x3dcb2e){if(_0x3dcb2e){return _0x3b104e[_0x1241('0x7')](_0x3ed8f9);}return _0x3b104e[_0x1241('0x8')](_0x3ed8f9)[_0x1241('0x9')]();};}function respondWithResult(_0x3fa96f,_0xcf6e05){_0xcf6e05=_0xcf6e05||0xc8;return function(_0x17ae9e){if(_0x17ae9e){return _0x3fa96f['status'](_0xcf6e05)[_0x1241('0xa')](_0x17ae9e);}};}function respondWithFilteredResult(_0x4e7077,_0x2fc6a5){return function(_0x43c11d){if(_0x43c11d){var _0x4deb16=typeof _0x2fc6a5[_0x1241('0xb')]===_0x1241('0xc')&&typeof _0x2fc6a5[_0x1241('0xd')]===_0x1241('0xc');var _0x2ee959=_0x43c11d['count'];var _0xf419d=_0x4deb16?0x0:_0x2fc6a5['offset'];var _0x18e4dc=_0x4deb16?_0x43c11d[_0x1241('0xe')]:_0x2fc6a5['offset']+_0x2fc6a5['limit'];var _0xc1b507;if(_0x18e4dc>=_0x2ee959){_0x18e4dc=_0x2ee959;_0xc1b507=0xc8;}else{_0xc1b507=0xce;}_0x4e7077[_0x1241('0x8')](_0xc1b507);return _0x4e7077[_0x1241('0xf')](_0x1241('0x10'),_0xf419d+'-'+_0x18e4dc+'/'+_0x2ee959)[_0x1241('0xa')](_0x43c11d);}return null;};}function removeEntity(_0x2e7ddb){return function(_0x179b72){if(_0x179b72){return _0x179b72[_0x1241('0x11')]()['then'](function(){var _0x26c59e=_0x179b72[_0x1241('0x12')]({'plain':!![]});var _0x54719a=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x1241('0x13'),'value':'outbound','ignore':![]},{'name':_0x1241('0x14'),'value':_0x1241('0x15'),'ignore':![]}];var _0x146b24=_(_0x54719a)[_0x1241('0x16')]('ignore')[_0x1241('0x17')]('value')['value']();if(_[_0x1241('0x18')](_0x146b24,_0x26c59e[_0x1241('0x19')])){return;}var _0x4a43a6=_[_0x1241('0x1a')](_0x54719a,[_0x1241('0x1b'),_0x26c59e[_0x1241('0x19')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x4a43a6,'resourceId':_0x26c59e['id']}})['then'](function(){return _0x179b72;});})[_0x1241('0x1c')](function(){_0x2e7ddb[_0x1241('0x8')](0xcc)[_0x1241('0x9')]();});}};}function handleEntityNotFound(_0x1e48da){return function(_0x1e6d53){if(!_0x1e6d53){_0x1e48da['sendStatus'](0x194);}return _0x1e6d53;};}function handleError(_0x134799,_0x4a98a8){_0x4a98a8=_0x4a98a8||0x1f4;return function(_0x3ff713){logger[_0x1241('0x1d')](_0x3ff713['stack']);if(_0x3ff713[_0x1241('0x1e')]){delete _0x3ff713[_0x1241('0x1e')];}_0x134799['status'](_0x4a98a8)[_0x1241('0x1f')](_0x3ff713);};}exports[_0x1241('0x20')]=function(_0x3891a7,_0x36e77e){var _0x1e7a47={},_0x5af266={},_0x420a8b={'count':0x0,'rows':[]};var _0x57eba6=_[_0x1241('0x17')](db['VoiceExtension'][_0x1241('0x21')],function(_0x1394e1){return{'name':_0x1394e1['fieldName'],'type':_0x1394e1[_0x1241('0x19')][_0x1241('0x22')]};});_0x5af266[_0x1241('0x23')]=_[_0x1241('0x17')](_0x57eba6,_0x1241('0x1e'));_0x5af266['query']=_[_0x1241('0x24')](_0x3891a7[_0x1241('0x25')]);_0x5af266[_0x1241('0x26')]=_[_0x1241('0x27')](_0x5af266[_0x1241('0x23')],_0x5af266['query']);_0x1e7a47[_0x1241('0x28')]=_[_0x1241('0x27')](_0x5af266[_0x1241('0x23')],qs[_0x1241('0x29')](_0x3891a7[_0x1241('0x25')][_0x1241('0x29')]));_0x1e7a47[_0x1241('0x28')]=_0x1e7a47[_0x1241('0x28')][_0x1241('0x2a')]?_0x1e7a47[_0x1241('0x28')]:_0x5af266[_0x1241('0x23')];if(!_0x3891a7['query'][_0x1241('0x2b')](_0x1241('0x2c'))){_0x1e7a47[_0x1241('0xd')]=qs[_0x1241('0xd')](_0x3891a7['query'][_0x1241('0xd')]);_0x1e7a47[_0x1241('0xb')]=qs['offset'](_0x3891a7[_0x1241('0x25')]['offset']);}_0x1e7a47[_0x1241('0x2d')]=qs[_0x1241('0x2e')](_0x3891a7[_0x1241('0x25')][_0x1241('0x2e')]);_0x1e7a47[_0x1241('0x2f')]=qs[_0x1241('0x26')](_['pick'](_0x3891a7[_0x1241('0x25')],_0x5af266['filters']),_0x57eba6);if(_0x3891a7[_0x1241('0x25')][_0x1241('0x16')]){_0x1e7a47['where']=_[_0x1241('0x30')](_0x1e7a47[_0x1241('0x2f')],{'$or':_[_0x1241('0x17')](_0x57eba6,function(_0x470638){if(_0x470638[_0x1241('0x19')]!==_0x1241('0x31')){var _0x415ef6={};_0x415ef6[_0x470638[_0x1241('0x1e')]]={'$like':'%'+_0x3891a7[_0x1241('0x25')]['filter']+'%'};return _0x415ef6;}})});}_0x1e7a47=_[_0x1241('0x30')]({},_0x1e7a47,_0x3891a7[_0x1241('0x32')]);var _0x2a63a5={'where':_0x1e7a47['where']};return db['VoiceExtension'][_0x1241('0xe')](_0x2a63a5)[_0x1241('0x1c')](function(_0x2c598f){_0x420a8b[_0x1241('0xe')]=_0x2c598f;if(_0x3891a7[_0x1241('0x25')][_0x1241('0x33')]){_0x1e7a47[_0x1241('0x34')]=[{'all':!![]}];}return db[_0x1241('0x35')]['findAll'](_0x1e7a47);})[_0x1241('0x1c')](function(_0x2bb290){_0x420a8b[_0x1241('0x36')]=_0x2bb290;return _0x420a8b;})['then'](respondWithFilteredResult(_0x36e77e,_0x1e7a47))[_0x1241('0x37')](handleError(_0x36e77e,null));};exports[_0x1241('0x38')]=function(_0xc5456,_0x554889){var _0x931635={'raw':![],'where':{'id':_0xc5456[_0x1241('0x39')]['id']}},_0x1f4bd0={};_0x1f4bd0['model']=_['keys'](db['VoiceExtension'][_0x1241('0x21')]);_0x1f4bd0[_0x1241('0x25')]=_[_0x1241('0x24')](_0xc5456[_0x1241('0x25')]);_0x1f4bd0[_0x1241('0x26')]=_['intersection'](_0x1f4bd0[_0x1241('0x23')],_0x1f4bd0[_0x1241('0x25')]);_0x931635['attributes']=_['intersection'](_0x1f4bd0[_0x1241('0x23')],qs['fields'](_0xc5456[_0x1241('0x25')][_0x1241('0x29')]));_0x931635[_0x1241('0x28')]=_0x931635[_0x1241('0x28')][_0x1241('0x2a')]?_0x931635['attributes']:_0x1f4bd0[_0x1241('0x23')];if(_0xc5456[_0x1241('0x25')][_0x1241('0x33')]){_0x931635['include']=[{'all':!![]}];}_0x931635=_['merge']({},_0x931635,_0xc5456[_0x1241('0x32')]);return db[_0x1241('0x35')][_0x1241('0x1a')](_0x931635)[_0x1241('0x1c')](handleEntityNotFound(_0x554889,null))[_0x1241('0x1c')](respondWithResult(_0x554889,null))[_0x1241('0x37')](handleError(_0x554889,null));};exports['destroy']=function(_0x276117,_0x4710b2){return db[_0x1241('0x35')]['find']({'where':{'id':_0x276117[_0x1241('0x39')]['id']}})['then'](handleEntityNotFound(_0x4710b2,null))[_0x1241('0x1c')](removeEntity(_0x4710b2,null))[_0x1241('0x37')](handleError(_0x4710b2,null));};exports['create']=function(_0x5540ec,_0x5aef02){if(_0x5540ec[_0x1241('0x3a')][_0x1241('0x19')]===_0x1241('0x3b')&&!_[_0x1241('0x3c')](_0x5540ec[_0x1241('0x3a')][_0x1241('0x3d')],'_')){_0x5540ec[_0x1241('0x3a')]['exten']='_'[_0x1241('0x3e')](_0x5540ec[_0x1241('0x3a')][_0x1241('0x3d')]);}return db[_0x1241('0x35')][_0x1241('0x3f')](_0x5540ec[_0x1241('0x3a')],{'raw':![]})[_0x1241('0x1c')](function(_0x4c1006){var _0x342232=_0x5540ec['user'][_0x1241('0x12')]({'plain':!![]});if(!_0x342232)throw new Error(_0x1241('0x40'));if(_0x342232['role']===_0x1241('0x41')){var _0x174ab9=_0x4c1006[_0x1241('0x12')]({'plain':!![]});var _0x595bb6=[{'name':_0x1241('0x42'),'value':_0x1241('0x43')},{'name':_0x1241('0x13'),'value':'outbound'},{'name':_0x1241('0x14'),'value':_0x1241('0x15')}];var _0x1489b1=_[_0x1241('0x1a')](_0x595bb6,[_0x1241('0x1b'),_0x174ab9[_0x1241('0x19')]])[_0x1241('0x1e')];return db['UserProfileSection'][_0x1241('0x1a')]({'where':{'name':_0x1489b1,'userProfileId':_0x342232[_0x1241('0x44')]},'raw':!![]})[_0x1241('0x1c')](function(_0x39a112){if(_0x39a112&&_0x39a112[_0x1241('0x45')]===0x0){return db['UserProfileResource'][_0x1241('0x3f')]({'name':_0x174ab9[_0x1241('0x1e')],'resourceId':_0x174ab9['id'],'type':_0x39a112[_0x1241('0x1e')],'sectionId':_0x39a112['id']},{})[_0x1241('0x1c')](function(){return _0x4c1006;});}else{return _0x4c1006;}})['catch'](function(_0x17c076){logger[_0x1241('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17c076);throw _0x17c076;});}return _0x4c1006;})[_0x1241('0x1c')](respondWithResult(_0x5aef02,0xc9))[_0x1241('0x37')](handleError(_0x5aef02,null));};exports['update']=function(_0x2dafdf,_0x319953){if(_0x2dafdf[_0x1241('0x3a')]['id']){delete _0x2dafdf['body']['id'];}return db[_0x1241('0x35')][_0x1241('0x1a')]({'where':{'id':_0x2dafdf[_0x1241('0x39')]['id']}})[_0x1241('0x1c')](handleEntityNotFound(_0x319953,null))[_0x1241('0x1c')](function(_0x1fb819){if(_0x1fb819){return db['VoiceExtension'][_0x1241('0x46')](_[_0x1241('0x47')](_0x2dafdf[_0x1241('0x3a')],[_0x1241('0x3d'),_0x1241('0x48'),_0x1241('0x49'),_0x1241('0x4a'),'cutdigits',_0x1241('0x4b'),_0x1241('0x4c')]),{'where':{'context':_0x1fb819[_0x1241('0x48')],'exten':_0x1fb819[_0x1241('0x3d')]},'individualHooks':!![]})[_0x1241('0x1c')](function(_0x2dd9f7){return _0x2dd9f7;});}return null;})[_0x1241('0x1c')](respondWithStatusCode(_0x319953,null))['catch'](handleError(_0x319953,null));};exports[_0x1241('0x4d')]=function(_0xf5a8a8,_0x16e5f8){var _0x52a883=_0xf5a8a8[_0x1241('0x39')]['id'];var _0x5ac430=_0xf5a8a8[_0x1241('0x3a')];var _0x343704=0xc8;var _0x313365=null;return db[_0x1241('0x4e')][_0x1241('0x4f')]({'isolationLevel':db[_0x1241('0x4e')][_0x1241('0x50')]['ISOLATION_LEVELS'][_0x1241('0x51')]},function(_0x3ecef7){return db[_0x1241('0x35')][_0x1241('0x52')]({'where':{'id':_0x52a883},'transaction':_0x3ecef7})[_0x1241('0x1c')](function(_0x224b58){if(_0x224b58){return db[_0x1241('0x35')][_0x1241('0x11')]({'where':{'VoiceExtensionId':_0x52a883},'transaction':_0x3ecef7})[_0x1241('0x1c')](function(){var _0x3c00cf=_[_0x1241('0x17')](_0x5ac430,function(_0x180500){_0x180500[_0x1241('0x53')]=_0x52a883;_0x180500['isApp']=!![];return _0x180500;});return _0x224b58[_0x1241('0x54')](_0x3c00cf);})['then'](function(_0x40b458){return db[_0x1241('0x35')][_0x1241('0x55')](_0x40b458,{'transaction':_0x3ecef7});});}else{_0x343704=0x194;_0x313365=[];}});})[_0x1241('0x1c')](function(){if(_0x343704!==0x194){return db[_0x1241('0x35')][_0x1241('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x52a883},'order':_0x1241('0x57')})[_0x1241('0x1c')](function(_0x4e4253){_0x313365=_0x4e4253;});}})['catch'](function(_0x4b5e0a){_0x343704=0x1f4;logger[_0x1241('0x1d')](_0x4b5e0a[_0x1241('0x58')]);if(_0x4b5e0a[_0x1241('0x1e')]){delete _0x4b5e0a[_0x1241('0x1e')];}_0x313365=_0x4b5e0a;})[_0x1241('0x59')](function(){if(_0x313365===null){_0x16e5f8[_0x1241('0x7')](_0x343704);}else{if(_0x343704===0x1f4){_0x16e5f8['status'](_0x343704)['send'](_0x313365);}else{_0x16e5f8[_0x1241('0x8')](_0x343704)['json'](_0x313365);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 5fcc9c8..ebc9775 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 _0x67ee=['events','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xd90262,_0x14586f){var _0x1ddcaf=function(_0x19699a){while(--_0x19699a){_0xd90262['push'](_0xd90262['shift']());}};_0x1ddcaf(++_0x14586f);}(_0x67ee,0x10e));var _0xe67e=function(_0x5cf2dd,_0x180e5a){_0x5cf2dd=_0x5cf2dd-0x0;var _0x3573c8=_0x67ee[_0x5cf2dd];return _0x3573c8;};'use strict';var EventEmitter=require(_0xe67e('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xe67e('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe67e('0x2')](0x0);var events={'afterCreate':_0xe67e('0x3'),'afterUpdate':_0xe67e('0x4'),'afterDestroy':_0xe67e('0x5')};function emitEvent(_0x184080){return function(_0x51550c,_0x5e1021,_0x8b1cb3){VoiceExtensionEvents['emit'](_0x184080+':'+_0x51550c['id'],_0x51550c);VoiceExtensionEvents[_0xe67e('0x6')](_0x184080,_0x51550c);_0x8b1cb3(null);};}for(var e in events){if(events[_0xe67e('0x7')](e)){var event=events[e];VoiceExtension[_0xe67e('0x8')](e,emitEvent(event));}}module[_0xe67e('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3e6c=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension'];(function(_0x17ee38,_0x5bdff4){var _0x439a4e=function(_0x2c6e2b){while(--_0x2c6e2b){_0x17ee38['push'](_0x17ee38['shift']());}};_0x439a4e(++_0x5bdff4);}(_0x3e6c,0x1ad));var _0xc3e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e6c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc3e6('0x0'));var VoiceExtension=require(_0xc3e6('0x1'))['db'][_0xc3e6('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc3e6('0x3'),'afterUpdate':_0xc3e6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36ef4a){return function(_0x5d250f,_0x2e294e,_0x590740){VoiceExtensionEvents['emit'](_0x36ef4a+':'+_0x5d250f['id'],_0x5d250f);VoiceExtensionEvents[_0xc3e6('0x5')](_0x36ef4a,_0x5d250f);_0x590740(null);};}for(var e in events){if(events[_0xc3e6('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xc3e6('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 7d6983e..322a273 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 _0xd493=['IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','priority','last','define','voice_extensions','concat','Hangup','lodash','exports','models','CDR(type)=','type','context','exten','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','options','url','name','param','split','prefix','phone','SIP','join','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval'];(function(_0x28d5fa,_0x1119c4){var _0x44cc54=function(_0x812b97){while(--_0x812b97){_0x28d5fa['push'](_0x28d5fa['shift']());}};_0x44cc54(++_0x1119c4);}(_0xd493,0x1bd));var _0x3d49=function(_0x4e7d5d,_0x1a3ceb){_0x4e7d5d=_0x4e7d5d-0x0;var _0x5f1719=_0xd493[_0x4e7d5d];return _0x5f1719;};'use strict';var _=require(_0x3d49('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x3d49('0x1')]=function(_0x14193e){var _0x55cb43=_0x14193e[_0x3d49('0x2')];function _0x4a877d(_0x58dce8){var _0x439989=0x2;var _0xab52eb=[{'type':_0x58dce8['type'],'app':'Set','appdata':_0x3d49('0x3')+_0x58dce8[_0x3d49('0x4')],'context':_0x58dce8[_0x3d49('0x5')],'exten':_0x58dce8[_0x3d49('0x6')],'priority':_0x439989++,'VoiceExtensionId':_0x58dce8['id']},{'type':_0x58dce8['type'],'app':_0x58dce8[_0x3d49('0x7')]?_0x3d49('0x8'):_0x3d49('0x9'),'appdata':_0x58dce8[_0x3d49('0x7')]?_0x3d49('0xa')+_0x58dce8[_0x3d49('0x7')]:_0x3d49('0xb'),'context':_0x58dce8[_0x3d49('0x5')],'exten':_0x58dce8[_0x3d49('0x6')],'priority':_0x439989++,'VoiceExtensionId':_0x58dce8['id']}];if(_0x58dce8[_0x3d49('0x4')]==='inbound'){_0xab52eb[_0x3d49('0xc')]({'type':'inbound','app':_0x3d49('0x8'),'appdata':_0x3d49('0xd')+_0x58dce8['id'],'context':_0x58dce8[_0x3d49('0x5')],'exten':_0x58dce8[_0x3d49('0x6')],'priority':_0x439989++,'VoiceExtensionId':_0x58dce8['id']});}_0xab52eb[_0x3d49('0xc')]({'type':_0x58dce8[_0x3d49('0x4')],'app':_0x3d49('0x8'),'appdata':_0x3d49('0xe'),'context':_0x58dce8[_0x3d49('0x5')],'exten':_0x58dce8[_0x3d49('0x6')],'priority':_0x439989++,'VoiceExtensionId':_0x58dce8['id']},{'type':_0x58dce8[_0x3d49('0x4')],'app':_0x3d49('0x8'),'appdata':_0x3d49('0xf'),'context':_0x58dce8['context'],'exten':_0x58dce8[_0x3d49('0x6')],'priority':_0x439989++,'VoiceExtensionId':_0x58dce8['id']},{'type':_0x58dce8[_0x3d49('0x4')],'app':_0x3d49('0x8'),'appdata':_0x3d49('0x10'),'context':_0x58dce8[_0x3d49('0x5')],'exten':_0x58dce8[_0x3d49('0x6')],'priority':_0x439989++,'VoiceExtensionId':_0x58dce8['id']});return _0xab52eb;}function _0x296b8d(_0x30f01c){var _0x7126d5=0x2;var _0x55c868=[{'type':_0x3d49('0x11'),'app':_0x3d49('0x8'),'appdata':_0x3d49('0x12'),'context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c['exten'],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':_0x3d49('0x11'),'app':_0x30f01c[_0x3d49('0x7')]?_0x3d49('0x8'):'NoOp','appdata':_0x30f01c[_0x3d49('0x7')]?'CDR(routeAlias)='+_0x30f01c['alias']:_0x3d49('0xb'),'context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c[_0x3d49('0x6')],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':_0x3d49('0x11'),'app':_0x3d49('0x8'),'appdata':_0x3d49('0x13')+(_0x30f01c['cutdigits']?_0x3d49('0x14')+_0x30f01c[_0x3d49('0x15')]+'}':_0x3d49('0x16')),'context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c[_0x3d49('0x6')],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':'outbound','app':_0x3d49('0x8'),'appdata':_0x3d49('0xd')+_0x30f01c['id'],'context':_0x30f01c['context'],'exten':_0x30f01c['exten'],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':_0x3d49('0x11'),'app':_0x3d49('0x17'),'appdata':_0x3d49('0x18')+(_0x7126d5+0x2)+_0x3d49('0x19')+(_0x7126d5+0x1)+')','context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c[_0x3d49('0x6')],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':'outbound','app':_0x3d49('0x8'),'appdata':_0x30f01c['cutdigits']?_0x3d49('0x1a')+_0x30f01c['cutdigits']+'}':_0x3d49('0x1b'),'context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c['exten'],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':_0x3d49('0x11'),'app':_0x3d49('0x8'),'appdata':_0x3d49('0xe'),'context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c[_0x3d49('0x6')],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':_0x3d49('0x11'),'app':_0x3d49('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c[_0x3d49('0x6')],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':_0x3d49('0x11'),'app':_0x3d49('0x8'),'appdata':_0x3d49('0x10'),'context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c[_0x3d49('0x6')],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':_0x3d49('0x11'),'app':_0x3d49('0x8'),'appdata':_0x3d49('0x1c')+_0x30f01c['id'],'context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c[_0x3d49('0x6')],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']}];if(_0x30f01c['hasOwnProperty'](_0x3d49('0x1d'))&&_0x30f01c[_0x3d49('0x1d')]!==_0x3d49('0x1e')){_0x55c868['push']({'type':_0x3d49('0x11'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x30f01c['context'],'exten':_0x30f01c['exten'],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']},{'type':_0x3d49('0x11'),'app':_0x3d49('0x8'),'appdata':_0x3d49('0x1f')+_0x30f01c[_0x3d49('0x1d')]||'wav','context':_0x30f01c[_0x3d49('0x5')],'exten':_0x30f01c[_0x3d49('0x6')],'priority':_0x7126d5++,'VoiceExtensionId':_0x30f01c['id']});}return _0x55c868;}function _0x239a6b(_0x509f6f,_0x49ac01){var _0x25c426=[{'name':_0x3d49('0x20'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x3d49('0x21'),'param':0x2},{'name':_0x3d49('0x22'),'param':0x3}];var _0x47085f={};var _0xeaa04e=_0x49ac01['split'](',');var _0x31593b=[];for(var _0x502b83=0x0;_0x502b83<_0x25c426['length'];_0x502b83++){switch(_0x25c426[_0x502b83][_0x3d49('0x23')]){case'trunk':_0x47085f[_0x3d49('0x20')]=_0xeaa04e[_0x25c426[_0x502b83][_0x3d49('0x24')]][_0x3d49('0x25')]('/')[0x1];_0x47085f['phone']=_0xeaa04e[_0x25c426[_0x502b83]['param']][_0x3d49('0x25')]('/')[0x2];_0x47085f[_0x3d49('0x26')]=_0x47085f[_0x3d49('0x27')]?_0x47085f[_0x3d49('0x27')]['split']('$')[0x0]:undefined;_0x47085f[_0x3d49('0x27')]=_0x509f6f[_0x3d49('0x15')]?(_0x47085f[_0x3d49('0x26')]||'')+_0x3d49('0x14')+_0x509f6f[_0x3d49('0x15')]+'}':(_0x47085f[_0x3d49('0x26')]||'')+_0x3d49('0x16');_0x31593b[_0x25c426[_0x502b83][_0x3d49('0x24')]]=[_0x3d49('0x28'),_0x47085f[_0x3d49('0x20')],_0x47085f['phone']][_0x3d49('0x29')]('/');break;case _0x3d49('0x21'):_0x47085f[_0x3d49('0x21')]=_0xeaa04e[_0x25c426[_0x502b83][_0x3d49('0x24')]];if(_0x509f6f['recordingFormat']!==_0x3d49('0x1e')){if(_0x47085f[_0x3d49('0x21')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x47085f[_0x3d49('0x21')]+=_0x3d49('0x2a');}}else{_0x47085f[_0x3d49('0x21')]=_0x47085f[_0x3d49('0x21')]['replace'](_0x3d49('0x2a'),'');}_0x31593b[_0x25c426[_0x502b83][_0x3d49('0x24')]]=_0x47085f[_0x3d49('0x21')];break;default:_0x31593b[_0x25c426[_0x502b83][_0x3d49('0x24')]]=_0xeaa04e[_0x25c426[_0x502b83][_0x3d49('0x24')]];}}return _0x31593b['join'](',');}function _0x4d68f1(_0x49bd6a,_0x215dfa,_0x53c06a){return new Promise(function(_0x5776b6,_0x14007d){var _0x11629a=[];if(_[_0x3d49('0x2b')](_0x215dfa))return _0x5776b6(_0x11629a);_0x55cb43[_0x3d49('0x2c')][_0x3d49('0x2d')]({'attributes':['id',_0x3d49('0x2e'),_0x3d49('0x2f')],'raw':!![]})[_0x3d49('0x30')](function(_0xe2d6a5){for(var _0x26a5c2=0x0,_0x59d5f4=0x0;_0x26a5c2<_0x215dfa[_0x3d49('0x31')];_0x26a5c2++,_0x59d5f4=0x0){var _0xff64ba=_0x215dfa[_0x26a5c2];var _0x392215=[];var _0x1df8ad=[];delete _0xff64ba['id'];if(_0xff64ba[_0x3d49('0x2e')]!==_0x3d49('0x32')){_0xff64ba[_0x3d49('0x33')]=[_0xff64ba[_0x3d49('0x2e')]];}else{_0xff64ba['intervals']=_0xff64ba[_0x3d49('0x2f')]?_[_0x3d49('0x34')](_[_0x3d49('0x35')](_0xe2d6a5,{'IntervalId':_0xff64ba['IntervalId']}),_0x3d49('0x2e')):[];}_0xff64ba[_0x3d49('0x5')]=_0x49bd6a['context'];_0xff64ba[_0x3d49('0x6')]=_0x49bd6a[_0x3d49('0x6')];if(_0xff64ba['type'])_0xff64ba[_0x3d49('0x4')]=_0xff64ba[_0x3d49('0x4')][_0x3d49('0x36')]();if(_0x49bd6a[_0x3d49('0x4')]===_0x3d49('0x11')){if(_0xff64ba[_0x3d49('0x37')](_0x3d49('0x38'))&&_0xff64ba[_0x3d49('0x38')]&&_0xff64ba[_0x3d49('0x38')]!=='--'){_0x392215['push']({'type':_0xff64ba['type'][_0x3d49('0x36')](),'app':_0x3d49('0x8'),'appdata':_0x3d49('0x39')+_0xff64ba[_0x3d49('0x38')],'context':_0x49bd6a[_0x3d49('0x5')],'exten':_0x49bd6a['exten'],'priority':_0xff64ba[_0x3d49('0x33')]['length']+_0x53c06a+_0x59d5f4++,'VoiceExtensionId':_0x49bd6a['id']});}_0x392215[_0x3d49('0xc')]({'type':_0xff64ba[_0x3d49('0x4')][_0x3d49('0x36')](),'app':_0x3d49('0x17'),'appdata':_0x3d49('0x3a')+(_0xff64ba[_0x3d49('0x3b')]?_0x3d49('0x3c')+_0xff64ba[_0x3d49('0x3b')]+')':_0x3d49('0x3d')),'context':_0x49bd6a['context'],'exten':_0x49bd6a[_0x3d49('0x6')],'priority':_0xff64ba[_0x3d49('0x33')][_0x3d49('0x31')]+_0x53c06a+_0x59d5f4++,'VoiceExtensionId':_0x49bd6a['id']});}else{if(_0xff64ba[_0x3d49('0x37')](_0x3d49('0x3e'))){if([_0x3d49('0x3f'),_0x3d49('0x40')][_0x3d49('0x41')](_0xff64ba[_0x3d49('0x42')][_0x3d49('0x36')]())&&_0xff64ba[_0x3d49('0x43')]!==_0x3d49('0x44')){if(_0xff64ba[_0x3d49('0x3e')]){_0x392215[_0x3d49('0xc')]({'type':_0xff64ba['type'][_0x3d49('0x36')](),'app':_0x3d49('0x17'),'appdata':_0x3d49('0x45'),'context':_0x49bd6a[_0x3d49('0x5')],'exten':_0x49bd6a[_0x3d49('0x6')],'priority':_0xff64ba[_0x3d49('0x33')]['length']+_0x53c06a+_0x59d5f4++,'VoiceExtensionId':_0x49bd6a['id']});_0x392215[_0x3d49('0xc')]({'type':_0xff64ba[_0x3d49('0x4')][_0x3d49('0x36')](),'app':_0x3d49('0x8'),'appdata':_0x3d49('0x46'),'context':_0x49bd6a[_0x3d49('0x5')],'exten':_0x49bd6a[_0x3d49('0x6')],'priority':_0xff64ba[_0x3d49('0x33')][_0x3d49('0x31')]+_0x53c06a+_0x59d5f4++,'VoiceExtensionId':_0x49bd6a['id']});}else{_0x392215[_0x3d49('0xc')]({'type':_0xff64ba[_0x3d49('0x4')]['toLowerCase'](),'app':_0x3d49('0x17'),'appdata':_0x3d49('0x47'),'context':_0x49bd6a[_0x3d49('0x5')],'exten':_0x49bd6a['exten'],'priority':_0xff64ba[_0x3d49('0x33')][_0x3d49('0x31')]+_0x53c06a+_0x59d5f4++,'VoiceExtensionId':_0x49bd6a['id']});_0x392215[_0x3d49('0xc')]({'type':_0xff64ba[_0x3d49('0x4')][_0x3d49('0x36')](),'app':_0x3d49('0x8'),'appdata':_0x3d49('0x48'),'context':_0x49bd6a[_0x3d49('0x5')],'exten':_0x49bd6a[_0x3d49('0x6')],'priority':_0xff64ba[_0x3d49('0x33')][_0x3d49('0x31')]+_0x53c06a+_0x59d5f4++,'VoiceExtensionId':_0x49bd6a['id']});}}}}for(var _0x4ab50e=0x0;_0x4ab50e<_0xff64ba[_0x3d49('0x33')]['length'];_0x4ab50e++){var _0x43a1b6=_0x53c06a+_0xff64ba['intervals'][_0x3d49('0x31')];var _0x89c85a=_0x4ab50e===_0xff64ba[_0x3d49('0x33')]['length']-0x1?_0x53c06a+_0x392215[_0x3d49('0x31')]+_0x1df8ad[_0x3d49('0x31')]+0x2:_0x53c06a+_0x4ab50e+0x1;_0x392215['splice'](_0x4ab50e,0x0,{'type':_0x49bd6a['type'],'app':'GotoIfTime','appdata':_0xff64ba[_0x3d49('0x33')][_0x4ab50e]+'?'+_0x49bd6a[_0x3d49('0x5')]+_0x3d49('0x49')+_0x43a1b6+':'+_0x49bd6a['context']+_0x3d49('0x49')+_0x89c85a,'exten':_0x49bd6a[_0x3d49('0x6')],'context':_0x49bd6a['context'],'priority':_0x53c06a+_0x4ab50e,'VoiceExtensionId':_0x49bd6a['id']});}if(_0xff64ba[_0x3d49('0x43')]===_0x3d49('0x4a'))_0xff64ba['appdata']=_0x239a6b(_0x49bd6a,_0xff64ba[_0x3d49('0x4b')]);_0xff64ba[_0x3d49('0x4c')]=_0x392215['length']?_[_0x3d49('0x4d')](_0x392215)[_0x3d49('0x4c')]+0x1:_0x53c06a;_0x11629a=_['concat'](_0x11629a,_0x392215,[_0xff64ba],_0x1df8ad);_0x53c06a=_['last'](_0x11629a)[_0x3d49('0x4c')]+0x1;}return _0x5776b6(_0x11629a);})['catch'](function(_0x538078){_0x14007d(_0x538078);});});}return _0x14193e[_0x3d49('0x4e')]('VoiceExtension',attributes,{'tableName':_0x3d49('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x305d05){var _0x1fba20=this['get']({'plain':!![]});var _0x218e9e=_0x1fba20[_0x3d49('0x4')]===_0x3d49('0x11')?_0x296b8d(_0x1fba20):_0x4a877d(_0x1fba20);return _0x4d68f1(_0x1fba20,_0x305d05,_[_0x3d49('0x4d')](_0x218e9e)['priority']+0x1)[_0x3d49('0x30')](function(_0x372e2b){var _0x1d5d22=_[_0x3d49('0x50')](_0x218e9e,_0x372e2b);_0x1d5d22[_0x3d49('0xc')]({'type':_0x1fba20[_0x3d49('0x4')],'app':_0x3d49('0x51'),'exten':_0x1fba20[_0x3d49('0x6')],'context':_0x1fba20[_0x3d49('0x5')],'priority':_[_0x3d49('0x4d')](_0x1d5d22)[_0x3d49('0x4c')]+0x1,'VoiceExtensionId':_0x1fba20['id']});return _0x1d5d22;});}}});}; \ No newline at end of file +var _0x993f=['replace','join','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','intervals','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','appType','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','prefix','phone','SIP','indexOf','U(xcally-mixmonitor-context)'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x993f,0x129));var _0xf993=function(_0x4652ec,_0x2e9e0e){_0x4652ec=_0x4652ec-0x0;var _0x3467bd=_0x993f[_0x4652ec];return _0x3467bd;};'use strict';var _=require(_0xf993('0x0'));var attributes=require(_0xf993('0x1'));module[_0xf993('0x2')]=function(_0x15faa9){var _0x4dee67=_0x15faa9[_0xf993('0x3')];function _0x28c80d(_0x5797f2){var _0x29789c=0x2;var _0xd9d594=[{'type':_0x5797f2[_0xf993('0x4')],'app':_0xf993('0x5'),'appdata':_0xf993('0x6')+_0x5797f2[_0xf993('0x4')],'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2[_0xf993('0x8')],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']},{'type':_0x5797f2[_0xf993('0x4')],'app':_0x5797f2[_0xf993('0x9')]?_0xf993('0x5'):_0xf993('0xa'),'appdata':_0x5797f2['alias']?_0xf993('0xb')+_0x5797f2[_0xf993('0x9')]:'No\x20alias\x20set','context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2[_0xf993('0x8')],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']}];if(_0x5797f2[_0xf993('0x4')]===_0xf993('0xc')){_0xd9d594['push']({'type':_0xf993('0xc'),'app':'Set','appdata':_0xf993('0xd')+_0x5797f2['id'],'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2['exten'],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']});}_0xd9d594[_0xf993('0xe')]({'type':_0x5797f2['type'],'app':_0xf993('0x5'),'appdata':_0xf993('0xf'),'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2['exten'],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']},{'type':_0x5797f2[_0xf993('0x4')],'app':_0xf993('0x5'),'appdata':_0xf993('0x10'),'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2[_0xf993('0x8')],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']},{'type':_0x5797f2[_0xf993('0x4')],'app':'Set','appdata':_0xf993('0x11'),'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2[_0xf993('0x8')],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']});return _0xd9d594;}function _0x577adb(_0x51ecc5){var _0x5d69e1=0x2;var _0x10a30f=[{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x13'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0x51ecc5[_0xf993('0x9')]?_0xf993('0x5'):_0xf993('0xa'),'appdata':_0x51ecc5[_0xf993('0x9')]?_0xf993('0xb')+_0x51ecc5[_0xf993('0x9')]:_0xf993('0x14'),'context':_0x51ecc5['context'],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x15')+(_0x51ecc5['cutdigits']?_0xf993('0x16')+_0x51ecc5[_0xf993('0x17')]+'}':_0xf993('0x18')),'context':_0x51ecc5['context'],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':'outbound','app':_0xf993('0x5'),'appdata':_0xf993('0xd')+_0x51ecc5['id'],'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':'ExecIf','appdata':_0xf993('0x19')+(_0x5d69e1+0x2)+_0xf993('0x1a')+(_0x5d69e1+0x1)+')','context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5['exten'],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':'Set','appdata':_0x51ecc5['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x51ecc5['cutdigits']+'}':_0xf993('0x1b'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5['exten'],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':'Set','appdata':_0xf993('0x10'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5['exten'],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x11'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x1c')+_0x51ecc5['id'],'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5['exten'],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']}];if(_0x51ecc5[_0xf993('0x1d')](_0xf993('0x1e'))&&_0x51ecc5['recordingFormat']!==_0xf993('0x1f')){_0x10a30f[_0xf993('0xe')]({'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x20'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':'outbound','app':_0xf993('0x5'),'appdata':_0xf993('0x21')+_0x51ecc5[_0xf993('0x1e')]||'wav','context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']});}return _0x10a30f;}function _0x3c621f(_0x3126ac,_0x3322c3){var _0x3894cd=[{'name':_0xf993('0x22'),'param':0x0},{'name':_0xf993('0x23'),'param':0x1},{'name':_0xf993('0x24'),'param':0x2},{'name':_0xf993('0x25'),'param':0x3}];var _0x5915e7={};var _0x2dea5d=_0x3322c3[_0xf993('0x26')](',');var _0x49a932=[];for(var _0x37970f=0x0;_0x37970f<_0x3894cd[_0xf993('0x27')];_0x37970f++){switch(_0x3894cd[_0x37970f][_0xf993('0x28')]){case _0xf993('0x22'):_0x5915e7[_0xf993('0x22')]=_0x2dea5d[_0x3894cd[_0x37970f][_0xf993('0x29')]]['split']('/')[0x1];_0x5915e7['phone']=_0x2dea5d[_0x3894cd[_0x37970f]['param']][_0xf993('0x26')]('/')[0x2];_0x5915e7[_0xf993('0x2a')]=_0x5915e7[_0xf993('0x2b')]?_0x5915e7[_0xf993('0x2b')]['split']('$')[0x0]:undefined;_0x5915e7[_0xf993('0x2b')]=_0x3126ac[_0xf993('0x17')]?(_0x5915e7[_0xf993('0x2a')]||'')+'${EXTEN:'+_0x3126ac[_0xf993('0x17')]+'}':(_0x5915e7[_0xf993('0x2a')]||'')+_0xf993('0x18');_0x49a932[_0x3894cd[_0x37970f][_0xf993('0x29')]]=[_0xf993('0x2c'),_0x5915e7[_0xf993('0x22')],_0x5915e7[_0xf993('0x2b')]]['join']('/');break;case _0xf993('0x24'):_0x5915e7[_0xf993('0x24')]=_0x2dea5d[_0x3894cd[_0x37970f][_0xf993('0x29')]];if(_0x3126ac['recordingFormat']!==_0xf993('0x1f')){if(_0x5915e7[_0xf993('0x24')][_0xf993('0x2d')](_0xf993('0x2e'))<0x0){_0x5915e7[_0xf993('0x24')]+=_0xf993('0x2e');}}else{_0x5915e7[_0xf993('0x24')]=_0x5915e7[_0xf993('0x24')][_0xf993('0x2f')](_0xf993('0x2e'),'');}_0x49a932[_0x3894cd[_0x37970f][_0xf993('0x29')]]=_0x5915e7[_0xf993('0x24')];break;default:_0x49a932[_0x3894cd[_0x37970f]['param']]=_0x2dea5d[_0x3894cd[_0x37970f][_0xf993('0x29')]];}}return _0x49a932[_0xf993('0x30')](',');}function _0x38582d(_0x551d62,_0x2bec69,_0xb1475a){return new Promise(function(_0x5279ef,_0x42d01c){var _0x2be9f8=[];if(_[_0xf993('0x31')](_0x2bec69))return _0x5279ef(_0x2be9f8);_0x4dee67['Interval'][_0xf993('0x32')]({'attributes':['id',_0xf993('0x33'),_0xf993('0x34')],'raw':!![]})[_0xf993('0x35')](function(_0x421774){for(var _0x2219f4=0x0,_0x272d24=0x0;_0x2219f4<_0x2bec69['length'];_0x2219f4++,_0x272d24=0x0){var _0x35d768=_0x2bec69[_0x2219f4];var _0x3f78e1=[];var _0x1ef4bd=[];delete _0x35d768['id'];if(_0x35d768[_0xf993('0x33')]!==_0xf993('0x36')){_0x35d768['intervals']=[_0x35d768[_0xf993('0x33')]];}else{_0x35d768['intervals']=_0x35d768[_0xf993('0x34')]?_[_0xf993('0x37')](_[_0xf993('0x38')](_0x421774,{'IntervalId':_0x35d768[_0xf993('0x34')]}),_0xf993('0x33')):[];}_0x35d768[_0xf993('0x7')]=_0x551d62[_0xf993('0x7')];_0x35d768['exten']=_0x551d62[_0xf993('0x8')];if(_0x35d768[_0xf993('0x4')])_0x35d768[_0xf993('0x4')]=_0x35d768[_0xf993('0x4')][_0xf993('0x39')]();if(_0x551d62['type']===_0xf993('0x12')){if(_0x35d768[_0xf993('0x1d')](_0xf993('0x3a'))&&_0x35d768['tag']&&_0x35d768['tag']!=='--'){_0x3f78e1[_0xf993('0xe')]({'type':_0x35d768[_0xf993('0x4')]['toLowerCase'](),'app':_0xf993('0x5'),'appdata':_0xf993('0x3b')+_0x35d768[_0xf993('0x3a')],'context':_0x551d62[_0xf993('0x7')],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});}_0x3f78e1[_0xf993('0xe')]({'type':_0x35d768[_0xf993('0x4')][_0xf993('0x39')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x35d768[_0xf993('0x3d')]?_0xf993('0x3e')+_0x35d768['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x551d62[_0xf993('0x7')],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});}else{if(_0x35d768[_0xf993('0x1d')](_0xf993('0x3f'))){if([_0xf993('0x40'),_0xf993('0x41')][_0xf993('0x42')](_0x35d768['app'][_0xf993('0x39')]())&&_0x35d768[_0xf993('0x43')]!==_0xf993('0x44')){if(_0x35d768[_0xf993('0x3f')]){_0x3f78e1[_0xf993('0xe')]({'type':_0x35d768[_0xf993('0x4')][_0xf993('0x39')](),'app':_0xf993('0x45'),'appdata':_0xf993('0x46'),'context':_0x551d62['context'],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});_0x3f78e1['push']({'type':_0x35d768[_0xf993('0x4')][_0xf993('0x39')](),'app':_0xf993('0x5'),'appdata':_0xf993('0x47'),'context':_0x551d62[_0xf993('0x7')],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});}else{_0x3f78e1['push']({'type':_0x35d768['type'][_0xf993('0x39')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x551d62['context'],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')]['length']+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});_0x3f78e1['push']({'type':_0x35d768[_0xf993('0x4')][_0xf993('0x39')](),'app':_0xf993('0x5'),'appdata':_0xf993('0x48'),'context':_0x551d62[_0xf993('0x7')],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});}}}}for(var _0x43336c=0x0;_0x43336c<_0x35d768[_0xf993('0x3c')][_0xf993('0x27')];_0x43336c++){var _0x4c3325=_0xb1475a+_0x35d768[_0xf993('0x3c')][_0xf993('0x27')];var _0x1fe12e=_0x43336c===_0x35d768[_0xf993('0x3c')]['length']-0x1?_0xb1475a+_0x3f78e1[_0xf993('0x27')]+_0x1ef4bd[_0xf993('0x27')]+0x2:_0xb1475a+_0x43336c+0x1;_0x3f78e1[_0xf993('0x49')](_0x43336c,0x0,{'type':_0x551d62['type'],'app':_0xf993('0x4a'),'appdata':_0x35d768['intervals'][_0x43336c]+'?'+_0x551d62[_0xf993('0x7')]+_0xf993('0x4b')+_0x4c3325+':'+_0x551d62[_0xf993('0x7')]+',${EXTEN},'+_0x1fe12e,'exten':_0x551d62[_0xf993('0x8')],'context':_0x551d62[_0xf993('0x7')],'priority':_0xb1475a+_0x43336c,'VoiceExtensionId':_0x551d62['id']});}if(_0x35d768['appType']==='outboundDial')_0x35d768[_0xf993('0x4c')]=_0x3c621f(_0x551d62,_0x35d768[_0xf993('0x4c')]);_0x35d768[_0xf993('0x4d')]=_0x3f78e1[_0xf993('0x27')]?_[_0xf993('0x4e')](_0x3f78e1)[_0xf993('0x4d')]+0x1:_0xb1475a;_0x2be9f8=_[_0xf993('0x4f')](_0x2be9f8,_0x3f78e1,[_0x35d768],_0x1ef4bd);_0xb1475a=_[_0xf993('0x4e')](_0x2be9f8)[_0xf993('0x4d')]+0x1;}return _0x5279ef(_0x2be9f8);})[_0xf993('0x50')](function(_0x4831a4){_0x42d01c(_0x4831a4);});});}return _0x15faa9[_0xf993('0x51')](_0xf993('0x52'),attributes,{'tableName':_0xf993('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2f8116){var _0x318a2f=this[_0xf993('0x54')]({'plain':!![]});var _0x2a96dd=_0x318a2f[_0xf993('0x4')]===_0xf993('0x12')?_0x577adb(_0x318a2f):_0x28c80d(_0x318a2f);return _0x38582d(_0x318a2f,_0x2f8116,_[_0xf993('0x4e')](_0x2a96dd)[_0xf993('0x4d')]+0x1)[_0xf993('0x35')](function(_0x24046d){var _0x256955=_[_0xf993('0x4f')](_0x2a96dd,_0x24046d);_0x256955[_0xf993('0xe')]({'type':_0x318a2f['type'],'app':_0xf993('0x55'),'exten':_0x318a2f[_0xf993('0x8')],'context':_0x318a2f['context'],'priority':_[_0xf993('0x4e')](_0x256955)[_0xf993('0x4d')]+0x1,'VoiceExtensionId':_0x318a2f['id']});return _0x256955;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8e73dc5..630e852 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 _0xd69e=['./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../config/environment','http','redis','defaults','socket.io-emitter'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd69e,0xa0));var _0xed69=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd69e[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xed69('0x0'));var util=require(_0xed69('0x1'));var moment=require(_0xed69('0x2'));var BPromise=require('bluebird');var rs=require(_0xed69('0x3'));var fs=require('fs');var Redis=require(_0xed69('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xed69('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed69('0x6')]({'port':0x232a});config[_0xed69('0x7')]=_[_0xed69('0x8')](config[_0xed69('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xed69('0x9'))(new Redis(config['redis']));require(_0xed69('0xa'))[_0xed69('0xb')](socket);function respondWithRpcPromise(_0x47da53,_0x2dc08a,_0x1eb1f8){return new BPromise(function(_0x4ebc85,_0x51e609){return client['request'](_0x47da53,_0x1eb1f8)[_0xed69('0xc')](function(_0x218c3c){logger['info'](_0xed69('0xd'),_0x2dc08a,'request\x20sent');logger[_0xed69('0xe')](_0xed69('0xf'),_0x2dc08a,_0xed69('0x10'),JSON['stringify'](_0x218c3c));if(_0x218c3c['error']){if(_0x218c3c[_0xed69('0x11')][_0xed69('0x12')]===0x1f4){logger[_0xed69('0x11')](_0xed69('0xd'),_0x2dc08a,_0x218c3c[_0xed69('0x11')]['message']);return _0x51e609(_0x218c3c[_0xed69('0x11')][_0xed69('0x13')]);}logger[_0xed69('0x11')](_0xed69('0xd'),_0x2dc08a,_0x218c3c[_0xed69('0x11')][_0xed69('0x13')]);return _0x4ebc85(_0x218c3c[_0xed69('0x11')][_0xed69('0x13')]);}else{logger[_0xed69('0x14')](_0xed69('0xd'),_0x2dc08a,'request\x20sent');_0x4ebc85(_0x218c3c['result']['message']);}})[_0xed69('0x15')](function(_0x2cd704){logger[_0xed69('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x2dc08a,_0x2cd704);_0x51e609(_0x2cd704);});});}exports[_0xed69('0x16')]=function(_0x11c1fc){var _0x589f07=this;return new Promise(function(_0x3ed869,_0x10285d){return db[_0xed69('0x17')][_0xed69('0x18')]({'raw':_0x11c1fc['options']?_0x11c1fc[_0xed69('0x19')][_0xed69('0x1a')]===undefined?!![]:![]:!![],'where':_0x11c1fc['options']?_0x11c1fc[_0xed69('0x19')][_0xed69('0x1b')]||null:null,'attributes':_0x11c1fc[_0xed69('0x19')]?_0x11c1fc[_0xed69('0x19')][_0xed69('0x1c')]||null:null,'limit':_0x11c1fc[_0xed69('0x19')]?_0x11c1fc['options'][_0xed69('0x1d')]||null:null,'include':_0x11c1fc[_0xed69('0x19')]?_0x11c1fc[_0xed69('0x19')][_0xed69('0x1e')]?_[_0xed69('0x1f')](_0x11c1fc[_0xed69('0x19')][_0xed69('0x1e')],function(_0x1e34c8){return{'model':db[_0x1e34c8[_0xed69('0x20')]],'as':_0x1e34c8['as'],'attributes':_0x1e34c8[_0xed69('0x1c')],'include':_0x1e34c8[_0xed69('0x1e')]?_['map'](_0x1e34c8['include'],function(_0x383a83){return{'model':db[_0x383a83[_0xed69('0x20')]],'as':_0x383a83['as'],'attributes':_0x383a83[_0xed69('0x1c')],'include':_0x383a83[_0xed69('0x1e')]?_[_0xed69('0x1f')](_0x383a83[_0xed69('0x1e')],function(_0x5b6ee3){return{'model':db[_0x5b6ee3[_0xed69('0x20')]],'as':_0x5b6ee3['as'],'attributes':_0x5b6ee3[_0xed69('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xed69('0xc')](function(_0x582fdc){logger['info'](_0xed69('0x16'),_0x11c1fc);logger['debug'](_0xed69('0x16'),_0x11c1fc,JSON[_0xed69('0x21')](_0x582fdc));_0x3ed869(_0x582fdc);})[_0xed69('0x15')](function(_0x1f4e54){logger[_0xed69('0x11')](_0xed69('0x16'),_0x1f4e54[_0xed69('0x13')],_0x11c1fc);_0x10285d(_0x589f07['error'](0x1f4,_0x1f4e54[_0xed69('0x13')]));});});}; \ No newline at end of file +var _0x9120=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceExtension','findAll','raw','options','where','attributes','include','model','GetVoiceExtension','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent'];(function(_0x3144b3,_0x45f961){var _0x2517a9=function(_0x15af07){while(--_0x15af07){_0x3144b3['push'](_0x3144b3['shift']());}};_0x2517a9(++_0x45f961);}(_0x9120,0x1b3));var _0x0912=function(_0x1b6a84,_0x5d43e0){_0x1b6a84=_0x1b6a84-0x0;var _0x181fed=_0x9120[_0x1b6a84];return _0x181fed;};'use strict';var _=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var moment=require(_0x0912('0x2'));var BPromise=require(_0x0912('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0912('0x4'))['db'];var utils=require(_0x0912('0x5'));var logger=require(_0x0912('0x6'))(_0x0912('0x7'));var config=require(_0x0912('0x8'));var jayson=require(_0x0912('0x9'));var client=jayson['client'][_0x0912('0xa')]({'port':0x232a});config[_0x0912('0xb')]=_[_0x0912('0xc')](config['redis'],{'host':_0x0912('0xd'),'port':0x18eb});var socket=require(_0x0912('0xe'))(new Redis(config[_0x0912('0xb')]));require(_0x0912('0xf'))[_0x0912('0x10')](socket);function respondWithRpcPromise(_0x5468d4,_0x1aa7d2,_0x6581e6){return new BPromise(function(_0x1141a5,_0x32af1a){return client['request'](_0x5468d4,_0x6581e6)[_0x0912('0x11')](function(_0x50448d){logger[_0x0912('0x12')](_0x0912('0x13'),_0x1aa7d2,_0x0912('0x14'));logger[_0x0912('0x15')](_0x0912('0x16'),_0x1aa7d2,_0x0912('0x14'),JSON[_0x0912('0x17')](_0x50448d));if(_0x50448d[_0x0912('0x18')]){if(_0x50448d[_0x0912('0x18')][_0x0912('0x19')]===0x1f4){logger[_0x0912('0x18')](_0x0912('0x13'),_0x1aa7d2,_0x50448d[_0x0912('0x18')][_0x0912('0x1a')]);return _0x32af1a(_0x50448d[_0x0912('0x18')]['message']);}logger['error'](_0x0912('0x13'),_0x1aa7d2,_0x50448d['error'][_0x0912('0x1a')]);return _0x1141a5(_0x50448d['error'][_0x0912('0x1a')]);}else{logger['info'](_0x0912('0x13'),_0x1aa7d2,'request\x20sent');_0x1141a5(_0x50448d[_0x0912('0x1b')]['message']);}})[_0x0912('0x1c')](function(_0x56e6e2){logger['error'](_0x0912('0x13'),_0x1aa7d2,_0x56e6e2);_0x32af1a(_0x56e6e2);});});}exports['GetVoiceExtension']=function(_0x2ddcb7){var _0x1da565=this;return new Promise(function(_0x4b1e07,_0x106008){return db[_0x0912('0x1d')][_0x0912('0x1e')]({'raw':_0x2ddcb7['options']?_0x2ddcb7['options'][_0x0912('0x1f')]===undefined?!![]:![]:!![],'where':_0x2ddcb7[_0x0912('0x20')]?_0x2ddcb7[_0x0912('0x20')][_0x0912('0x21')]||null:null,'attributes':_0x2ddcb7[_0x0912('0x20')]?_0x2ddcb7[_0x0912('0x20')][_0x0912('0x22')]||null:null,'limit':_0x2ddcb7[_0x0912('0x20')]?_0x2ddcb7[_0x0912('0x20')]['limit']||null:null,'include':_0x2ddcb7[_0x0912('0x20')]?_0x2ddcb7[_0x0912('0x20')][_0x0912('0x23')]?_['map'](_0x2ddcb7['options'][_0x0912('0x23')],function(_0x53d673){return{'model':db[_0x53d673['model']],'as':_0x53d673['as'],'attributes':_0x53d673[_0x0912('0x22')],'include':_0x53d673[_0x0912('0x23')]?_['map'](_0x53d673[_0x0912('0x23')],function(_0x305831){return{'model':db[_0x305831[_0x0912('0x24')]],'as':_0x305831['as'],'attributes':_0x305831[_0x0912('0x22')],'include':_0x305831[_0x0912('0x23')]?_['map'](_0x305831[_0x0912('0x23')],function(_0x1d6c87){return{'model':db[_0x1d6c87['model']],'as':_0x1d6c87['as'],'attributes':_0x1d6c87[_0x0912('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0912('0x11')](function(_0x2ce714){logger['info'](_0x0912('0x25'),_0x2ddcb7);logger[_0x0912('0x15')](_0x0912('0x25'),_0x2ddcb7,JSON[_0x0912('0x17')](_0x2ce714));_0x4b1e07(_0x2ce714);})['catch'](function(_0x448fa3){logger[_0x0912('0x18')](_0x0912('0x25'),_0x448fa3[_0x0912('0x1a')],_0x2ddcb7);_0x106008(_0x1da565[_0x0912('0x18')](0x1f4,_0x448fa3[_0x0912('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index e5bc894..814caaf 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x4e8efd,_0x46bc20){var _0x31e442=function(_0x4c6c00){while(--_0x4c6c00){_0x4e8efd['push'](_0x4e8efd['shift']());}};_0x31e442(++_0x46bc20);}(_0xe14b,0x93));var _0xbe14=function(_0x307eca,_0x1aebf0){_0x307eca=_0x307eca-0x0;var _0x5956a6=_0xe14b[_0x307eca];return _0x5956a6;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x2f396d,_0x453314){var _0x20ac04=function(_0x1d5e27){while(--_0x1d5e27){_0x2f396d['push'](_0x2f396d['shift']());}};_0x20ac04(++_0x453314);}(_0xabce,0x103));var _0xeabc=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xabce[_0x411add];return _0x238242;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 0a707f4..77dbb59 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 _0x430c=['isAuthenticated','show','/:id/messages','getMessages','post','put','update','destroy','exports','multer','connect-timeout','express','Router','./voiceMail.controller','get','index','/:id'];(function(_0x4a68ad,_0x4f9637){var _0x233716=function(_0x30ff4b){while(--_0x30ff4b){_0x4a68ad['push'](_0x4a68ad['shift']());}};_0x233716(++_0x4f9637);}(_0x430c,0x1a1));var _0xc430=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0x430c[_0x24618a];return _0x2e3d64;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0xc')]('/',auth[_0xc430('0x8')](),controller['create']);router[_0xc430('0xd')](_0xc430('0x7'),auth['isAuthenticated'](),controller[_0xc430('0xe')]);router['delete'](_0xc430('0x7'),auth['isAuthenticated'](),controller[_0xc430('0xf')]);module[_0xc430('0x10')]=router; \ No newline at end of file +var _0x8ace=['isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x232715,_0x4bd63e){_0x232715=_0x232715-0x0;var _0x1e6090=_0x8ace[_0x232715];return _0x1e6090;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['show']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0x13')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x14')]);router[_0xe8ac('0x15')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x16')]);module[_0xe8ac('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 468280e..ab93c3c 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 _0x0344=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','STRING','contest_mailbox','setDataValue','string','trim','central'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x0344,0x1d9));var _0x4034=function(_0x51cb81,_0x53a62f){_0x51cb81=_0x51cb81-0x0;var _0x40cf7f=_0x0344[_0x51cb81];return _0x40cf7f;};'use strict';var Sequelize=require(_0x4034('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x4034('0x1')]},'context':{'type':Sequelize[_0x4034('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x4034('0x1')],'defaultValue':'','allowNull':![],'unique':_0x4034('0x2')},'password':{'type':Sequelize[_0x4034('0x1')]},'fullname':{'type':Sequelize[_0x4034('0x1')]},'email':{'type':Sequelize[_0x4034('0x1')],'validate':{'isEmail':!![]},'set':function(_0x688afd){this[_0x4034('0x3')]('email',typeof _0x688afd===_0x4034('0x4')&&_0x688afd[_0x4034('0x5')]()?_0x688afd[_0x4034('0x5')]():null);}},'pager':{'type':Sequelize[_0x4034('0x1')]},'tz':{'type':Sequelize[_0x4034('0x1')],'defaultValue':_0x4034('0x6')},'attach':{'type':Sequelize[_0x4034('0x7')](_0x4034('0x8'),'no'),'defaultValue':_0x4034('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4034('0x7')](_0x4034('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x4034('0x1')]},'callback':{'type':Sequelize[_0x4034('0x1')]},'review':{'type':Sequelize[_0x4034('0x7')](_0x4034('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4034('0x7')](_0x4034('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x4034('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4034('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4034('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x4034('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4034('0x7')](_0x4034('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x4034('0x8'),'no'),'defaultValue':_0x4034('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4034('0x7')](_0x4034('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4034('0x7')](_0x4034('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4034('0x7')](_0x4034('0x8'),'no'),'defaultValue':_0x4034('0x8'),'allowNull':![]},'stamp':{'type':_0x4034('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x4034('0x1')]},'maxsecs':{'type':Sequelize[_0x4034('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4034('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4034('0xc')],'get':function(){return this[_0x4034('0xd')]('fullname')+_0x4034('0xe')+this['getDataValue'](_0x4034('0xf'));}}}; \ No newline at end of file +var _0x9903=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20'];(function(_0x56fd9f,_0x68e47f){var _0x267160=function(_0x2b9aab){while(--_0x2b9aab){_0x56fd9f['push'](_0x56fd9f['shift']());}};_0x267160(++_0x68e47f);}(_0x9903,0x11d));var _0x3990=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9903[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3990('0x0')]={'customer_id':{'type':Sequelize[_0x3990('0x1')]},'context':{'type':Sequelize[_0x3990('0x1')],'defaultValue':_0x3990('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3990('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3990('0x3')},'password':{'type':Sequelize[_0x3990('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3990('0x1')],'validate':{'isEmail':!![]},'set':function(_0x308955){this[_0x3990('0x4')]('email',typeof _0x308955===_0x3990('0x5')&&_0x308955['trim']()?_0x308955[_0x3990('0x6')]():null);}},'pager':{'type':Sequelize[_0x3990('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':_0x3990('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3990('0x7')]('yes','no'),'defaultValue':_0x3990('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3990('0x1')]},'callback':{'type':Sequelize[_0x3990('0x1')]},'review':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3990('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3990('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':_0x3990('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3990('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':_0x3990('0x8'),'allowNull':![]},'stamp':{'type':_0x3990('0xa')},'emailsubject':{'type':Sequelize[_0x3990('0x1')]},'emailbody':{'type':Sequelize[_0x3990('0x1')]},'maxsecs':{'type':Sequelize[_0x3990('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3990('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3990('0xc')](_0x3990('0xd'))+_0x3990('0xe')+this[_0x3990('0xc')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index beac91e..ec80585 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 _0x065e=['findOne','VoiceMailMessage','findAndCountAll','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','VoiceMail','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages'];(function(_0x607e26,_0x3fa4f7){var _0x43f797=function(_0x20b4cf){while(--_0x20b4cf){_0x607e26['push'](_0x607e26['shift']());}};_0x43f797(++_0x3fa4f7);}(_0x065e,0x1a7));var _0xe065=function(_0x5c63bc,_0x51c676){_0x5c63bc=_0x5c63bc-0x0;var _0x62604=_0x065e[_0x5c63bc];return _0x62604;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x16')](_0xf5ab44);}return _0x13b697[_0xe065('0x17')](_0xf5ab44)[_0xe065('0x18')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x17')](_0x29297b)[_0xe065('0x19')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=typeof _0xc5ef4f[_0xe065('0x1a')]==='undefined'&&typeof _0xc5ef4f[_0xe065('0x1b')]===_0xe065('0x1c');var _0x54d260=_0x434e07[_0xe065('0x1d')];var _0x1d2f7a=_0x352206?0x0:_0xc5ef4f[_0xe065('0x1a')];var _0x14c97c=_0x352206?_0x434e07[_0xe065('0x1d')]:_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')];var _0x5000e1;if(_0x14c97c>=_0x54d260){_0x14c97c=_0x54d260;_0x5000e1=0xc8;}else{_0x5000e1=0xce;}_0x15d365[_0xe065('0x17')](_0x5000e1);return _0x15d365['set'](_0xe065('0x1e'),_0x1d2f7a+'-'+_0x14c97c+'/'+_0x54d260)[_0xe065('0x19')](_0x434e07);}return null;};}function patchUpdates(_0x55f55c){return function(_0x1c6567){try{jsonpatch['apply'](_0x1c6567,_0x55f55c,!![]);}catch(_0xe26e9b){return BPromise[_0xe065('0x1f')](_0xe26e9b);}return _0x1c6567[_0xe065('0x20')]();};}function saveUpdates(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x21')](_0x110556)[_0xe065('0x22')](function(_0x1c5dd9){return _0x1c5dd9;});}return null;};}function removeEntity(_0x5081a3,_0x7208af){return function(_0x43b712){if(_0x43b712){return _0x43b712[_0xe065('0x23')]()[_0xe065('0x22')](function(){var _0x5e8b60=_0x43b712['get']({'plain':!![]});var _0x164965='Voicemails';return db[_0xe065('0x24')][_0xe065('0x23')]({'where':{'type':_0x164965,'resourceId':_0x5e8b60['id']}})[_0xe065('0x22')](function(){return _0x43b712;});})[_0xe065('0x22')](function(){_0x5081a3[_0xe065('0x17')](0xcc)[_0xe065('0x18')]();});}};}function handleEntityNotFound(_0x3b1caf,_0x26a159){return function(_0x52cd9c){if(!_0x52cd9c){_0x3b1caf['sendStatus'](0x194);}return _0x52cd9c;};}function handleError(_0x14de01,_0x10e6ba){_0x10e6ba=_0x10e6ba||0x1f4;return function(_0x23aee9){logger[_0xe065('0x25')](_0x23aee9['stack']);if(_0x23aee9[_0xe065('0x26')]){delete _0x23aee9['name'];}_0x14de01['status'](_0x10e6ba)[_0xe065('0x27')](_0x23aee9);};}exports[_0xe065('0x28')]=function(_0x2aa766,_0x5b8523){var _0x883747={},_0x59b915={},_0x12679d={'count':0x0,'rows':[]};var _0x46db7e=_[_0xe065('0x29')](db[_0xe065('0x2a')]['rawAttributes'],function(_0x3f02b2){return{'name':_0x3f02b2['fieldName'],'type':_0x3f02b2[_0xe065('0x2b')][_0xe065('0x2c')]};});_0x59b915['model']=_[_0xe065('0x29')](_0x46db7e,'name');_0x59b915[_0xe065('0x2d')]=_['keys'](_0x2aa766[_0xe065('0x2d')]);_0x59b915[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],_0x59b915['query']);_0x883747[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x32')]));_0x883747['attributes']=_0x883747[_0xe065('0x31')][_0xe065('0x33')]?_0x883747['attributes']:_0x59b915[_0xe065('0x30')];if(!_0x2aa766[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0x883747[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x2aa766[_0xe065('0x2d')]['limit']);_0x883747[_0xe065('0x1a')]=qs['offset'](_0x2aa766[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x883747[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x37')]);_0x883747['where']=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x2aa766[_0xe065('0x2d')],_0x59b915['filters']),_0x46db7e);if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]){_0x883747[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x883747[_0xe065('0x3a')],{'$or':_['map'](_0x46db7e,function(_0x341740){if(_0x341740[_0xe065('0x2b')]!=='VIRTUAL'){var _0x236e75={};_0x236e75[_0x341740['name']]={'$like':'%'+_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x236e75;}})});}_0x883747=_['merge']({},_0x883747,_0x2aa766[_0xe065('0x3c')]);var _0x20c881={'where':_0x883747['where']};return db[_0xe065('0x2a')][_0xe065('0x1d')](_0x20c881)[_0xe065('0x22')](function(_0x44a3f6){_0x12679d[_0xe065('0x1d')]=_0x44a3f6;if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x3d')]){_0x883747[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x2a')][_0xe065('0x3f')](_0x883747);})[_0xe065('0x22')](function(_0x4364c3){_0x12679d[_0xe065('0x40')]=_0x4364c3;return _0x12679d;})['then'](respondWithFilteredResult(_0x5b8523,_0x883747))['catch'](handleError(_0x5b8523,null));};exports[_0xe065('0x41')]=function(_0x2bf092,_0x5ee4ec){var _0x3ba838={'raw':!![],'where':{'id':_0x2bf092[_0xe065('0x42')]['id']}},_0x448044={};_0x448044[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x448044[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x2bf092['query']);_0x448044[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],_0x448044['query']);_0x3ba838[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2bf092['query'][_0xe065('0x32')]));_0x3ba838[_0xe065('0x31')]=_0x3ba838[_0xe065('0x31')][_0xe065('0x33')]?_0x3ba838[_0xe065('0x31')]:_0x448044[_0xe065('0x30')];if(_0x2bf092[_0xe065('0x2d')]['includeAll']){_0x3ba838[_0xe065('0x3e')]=[{'all':!![]}];}_0x3ba838=_[_0xe065('0x3b')]({},_0x3ba838,_0x2bf092[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x3ba838)[_0xe065('0x22')](handleEntityNotFound(_0x5ee4ec,null))[_0xe065('0x22')](respondWithResult(_0x5ee4ec,null))['catch'](handleError(_0x5ee4ec,null));};exports[_0xe065('0x46')]=function(_0x5a2360,_0x45fe1f){return db[_0xe065('0x2a')][_0xe065('0x46')](_0x5a2360['body'],{})[_0xe065('0x22')](function(_0x16898c){var _0x3ab70d=_0x5a2360[_0xe065('0x47')][_0xe065('0x48')]({'plain':!![]});if(!_0x3ab70d)throw new Error(_0xe065('0x49'));if(_0x3ab70d[_0xe065('0x4a')]===_0xe065('0x47')){var _0x3095c8=_0x16898c[_0xe065('0x48')]({'plain':!![]});var _0x3f91a2=_0xe065('0x4b');return db[_0xe065('0x4c')]['find']({'where':{'name':_0x3f91a2,'userProfileId':_0x3ab70d['userProfileId']},'raw':!![]})['then'](function(_0x23ba0b){if(_0x23ba0b&&_0x23ba0b['autoAssociation']===0x0){return db[_0xe065('0x24')][_0xe065('0x46')]({'name':_0x3095c8[_0xe065('0x26')],'resourceId':_0x3095c8['id'],'type':_0x23ba0b['name'],'sectionId':_0x23ba0b['id']},{})[_0xe065('0x22')](function(){return _0x16898c;});}else{return _0x16898c;}})[_0xe065('0x4d')](function(_0x5cce78){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x5cce78);throw _0x5cce78;});}return _0x16898c;})[_0xe065('0x22')](respondWithResult(_0x45fe1f,0xc9))[_0xe065('0x4d')](handleError(_0x45fe1f,null));};exports[_0xe065('0x21')]=function(_0x1ea568,_0xe77af6){if(_0x1ea568[_0xe065('0x4f')]['id']){delete _0x1ea568[_0xe065('0x4f')]['id'];}return db[_0xe065('0x2a')]['find']({'where':{'id':_0x1ea568[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xe77af6,null))[_0xe065('0x22')](saveUpdates(_0x1ea568[_0xe065('0x4f')],null))['then'](respondWithResult(_0xe77af6,null))[_0xe065('0x4d')](handleError(_0xe77af6,null));};exports[_0xe065('0x23')]=function(_0x21884d,_0xb1fca1){return db['VoiceMail'][_0xe065('0x45')]({'where':{'id':_0x21884d[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xb1fca1,null))['then'](removeEntity(_0xb1fca1,null))[_0xe065('0x4d')](handleError(_0xb1fca1,null));};exports[_0xe065('0x50')]=function(_0x18b43e,_0x1f782f,_0x2d13ab){return db[_0xe065('0x2a')][_0xe065('0x51')]({'where':{'id':_0x18b43e[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x1f782f,null))['then'](function(_0x2accad){var _0x550c37;var _0x44edf0={},_0x24fc1c={};_0x24fc1c[_0xe065('0x30')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x24fc1c[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x18b43e[_0xe065('0x2d')]);_0x24fc1c[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x24fc1c[_0xe065('0x30')],_0x24fc1c[_0xe065('0x2d')]);_0x44edf0[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x24fc1c[_0xe065('0x30')],qs[_0xe065('0x32')](_0x18b43e['query']['fields']));_0x44edf0[_0xe065('0x31')]=_0x44edf0[_0xe065('0x31')]['length']?_0x44edf0[_0xe065('0x31')]:_0x24fc1c['model'];if(!_0x18b43e['query'][_0xe065('0x34')](_0xe065('0x35'))){_0x44edf0[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x18b43e[_0xe065('0x2d')][_0xe065('0x1b')]);_0x44edf0[_0xe065('0x1a')]=qs['offset'](_0x18b43e[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x44edf0[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x18b43e[_0xe065('0x2d')]['sort']);_0x44edf0[_0xe065('0x3a')]=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x18b43e[_0xe065('0x2d')],_0x24fc1c[_0xe065('0x2e')]));if(_0x18b43e[_0xe065('0x2d')]['filter']){_0x44edf0['where']=_['merge'](_0x44edf0['where'],{'$or':_['map'](_0x44edf0[_0xe065('0x31')],function(_0x45b033){var _0x1733b4={};_0x1733b4[_0x45b033]={'$like':'%'+_0x18b43e[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x1733b4;})});}_0x44edf0[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x44edf0[_0xe065('0x3a')],{'mailboxuser':_0x2accad['mailbox']});_0x44edf0=_['merge']({},_0x44edf0,_0x18b43e[_0xe065('0x3c')]);return db[_0xe065('0x52')][_0xe065('0x53')](_0x44edf0)['then'](respondWithFilteredResult(_0x1f782f,_0x44edf0));})[_0xe065('0x4d')](handleError(_0x1f782f,null));}; \ No newline at end of file +var _0xefda=['sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','VoiceMailMessage','mailbox','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3d829d,_0x5af899){var _0x318701=function(_0x30e7cd){while(--_0x30e7cd){_0x3d829d['push'](_0x3d829d['shift']());}};_0x318701(++_0x5af899);}(_0xefda,0x96));var _0xaefd=function(_0x2dd2f1,_0x299119){_0x2dd2f1=_0x2dd2f1-0x0;var _0xcd378f=_0xefda[_0x2dd2f1];return _0xcd378f;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];function respondWithStatusCode(_0x382983,_0x2a310c){_0x2a310c=_0x2a310c||0xcc;return function(_0x4b2b5c){if(_0x4b2b5c){return _0x382983[_0xaefd('0x18')](_0x2a310c);}return _0x382983['status'](_0x2a310c)[_0xaefd('0x19')]();};}function respondWithResult(_0x1725af,_0x9dfdf6){_0x9dfdf6=_0x9dfdf6||0xc8;return function(_0x43b82a){if(_0x43b82a){return _0x1725af['status'](_0x9dfdf6)[_0xaefd('0x1a')](_0x43b82a);}};}function respondWithFilteredResult(_0x13492c,_0x41f345){return function(_0x411701){if(_0x411701){var _0x10ee28=typeof _0x41f345[_0xaefd('0x1b')]===_0xaefd('0x1c')&&typeof _0x41f345[_0xaefd('0x1d')]==='undefined';var _0x9d9c29=_0x411701[_0xaefd('0x1e')];var _0x9748f4=_0x10ee28?0x0:_0x41f345[_0xaefd('0x1b')];var _0x2db61b=_0x10ee28?_0x411701[_0xaefd('0x1e')]:_0x41f345['offset']+_0x41f345[_0xaefd('0x1d')];var _0x182f9a;if(_0x2db61b>=_0x9d9c29){_0x2db61b=_0x9d9c29;_0x182f9a=0xc8;}else{_0x182f9a=0xce;}_0x13492c[_0xaefd('0x1f')](_0x182f9a);return _0x13492c[_0xaefd('0x20')](_0xaefd('0x21'),_0x9748f4+'-'+_0x2db61b+'/'+_0x9d9c29)[_0xaefd('0x1a')](_0x411701);}return null;};}function patchUpdates(_0x5282ed){return function(_0x463d48){try{jsonpatch[_0xaefd('0x22')](_0x463d48,_0x5282ed,!![]);}catch(_0x2dcdd8){return BPromise[_0xaefd('0x23')](_0x2dcdd8);}return _0x463d48[_0xaefd('0x24')]();};}function saveUpdates(_0x577fb7,_0x479486){return function(_0x5b9967){if(_0x5b9967){return _0x5b9967[_0xaefd('0x25')](_0x577fb7)[_0xaefd('0x26')](function(_0x313a6f){return _0x313a6f;});}return null;};}function removeEntity(_0x5a44ed,_0x23060f){return function(_0x4cd9b2){if(_0x4cd9b2){return _0x4cd9b2[_0xaefd('0x27')]()[_0xaefd('0x26')](function(){var _0x1a05eb=_0x4cd9b2['get']({'plain':!![]});var _0x435413=_0xaefd('0x28');return db[_0xaefd('0x29')][_0xaefd('0x27')]({'where':{'type':_0x435413,'resourceId':_0x1a05eb['id']}})[_0xaefd('0x26')](function(){return _0x4cd9b2;});})['then'](function(){_0x5a44ed[_0xaefd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x810bf,_0x16f10f){return function(_0x5470bd){if(!_0x5470bd){_0x810bf[_0xaefd('0x18')](0x194);}return _0x5470bd;};}function handleError(_0x2a8fa8,_0x521839){_0x521839=_0x521839||0x1f4;return function(_0xbeb1b8){logger[_0xaefd('0x2a')](_0xbeb1b8[_0xaefd('0x2b')]);if(_0xbeb1b8['name']){delete _0xbeb1b8[_0xaefd('0x2c')];}_0x2a8fa8['status'](_0x521839)[_0xaefd('0x2d')](_0xbeb1b8);};}exports['index']=function(_0x4a1acb,_0x1d89c4){var _0x1b470c={},_0x4a032d={},_0x578378={'count':0x0,'rows':[]};var _0x4ee0c1=_[_0xaefd('0x2e')](db[_0xaefd('0x2f')]['rawAttributes'],function(_0x5503d0){return{'name':_0x5503d0[_0xaefd('0x30')],'type':_0x5503d0[_0xaefd('0x31')][_0xaefd('0x32')]};});_0x4a032d[_0xaefd('0x33')]=_['map'](_0x4ee0c1,_0xaefd('0x2c'));_0x4a032d[_0xaefd('0x34')]=_[_0xaefd('0x35')](_0x4a1acb[_0xaefd('0x34')]);_0x4a032d[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x4a032d[_0xaefd('0x33')],_0x4a032d[_0xaefd('0x34')]);_0x1b470c[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x4a032d[_0xaefd('0x33')],qs[_0xaefd('0x39')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x39')]));_0x1b470c[_0xaefd('0x38')]=_0x1b470c[_0xaefd('0x38')]['length']?_0x1b470c[_0xaefd('0x38')]:_0x4a032d[_0xaefd('0x33')];if(!_0x4a1acb[_0xaefd('0x34')]['hasOwnProperty'](_0xaefd('0x3a'))){_0x1b470c['limit']=qs[_0xaefd('0x1d')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x1d')]);_0x1b470c[_0xaefd('0x1b')]=qs[_0xaefd('0x1b')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x1b')]);}_0x1b470c[_0xaefd('0x3b')]=qs[_0xaefd('0x3c')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x3c')]);_0x1b470c[_0xaefd('0x3d')]=qs[_0xaefd('0x36')](_[_0xaefd('0x3e')](_0x4a1acb['query'],_0x4a032d[_0xaefd('0x36')]),_0x4ee0c1);if(_0x4a1acb['query'][_0xaefd('0x3f')]){_0x1b470c[_0xaefd('0x3d')]=_[_0xaefd('0x40')](_0x1b470c[_0xaefd('0x3d')],{'$or':_[_0xaefd('0x2e')](_0x4ee0c1,function(_0x3c9331){if(_0x3c9331[_0xaefd('0x31')]!==_0xaefd('0x41')){var _0x3c7022={};_0x3c7022[_0x3c9331[_0xaefd('0x2c')]]={'$like':'%'+_0x4a1acb['query'][_0xaefd('0x3f')]+'%'};return _0x3c7022;}})});}_0x1b470c=_[_0xaefd('0x40')]({},_0x1b470c,_0x4a1acb['options']);var _0x427f00={'where':_0x1b470c[_0xaefd('0x3d')]};return db[_0xaefd('0x2f')]['count'](_0x427f00)['then'](function(_0x43b6a6){_0x578378[_0xaefd('0x1e')]=_0x43b6a6;if(_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x42')]){_0x1b470c[_0xaefd('0x43')]=[{'all':!![]}];}return db[_0xaefd('0x2f')][_0xaefd('0x44')](_0x1b470c);})[_0xaefd('0x26')](function(_0x48a7af){_0x578378[_0xaefd('0x45')]=_0x48a7af;return _0x578378;})[_0xaefd('0x26')](respondWithFilteredResult(_0x1d89c4,_0x1b470c))[_0xaefd('0x46')](handleError(_0x1d89c4,null));};exports[_0xaefd('0x47')]=function(_0x20d5fd,_0x197f3f){var _0x3633ec={'raw':!![],'where':{'id':_0x20d5fd['params']['id']}},_0x1f4a15={};_0x1f4a15['model']=_[_0xaefd('0x35')](db[_0xaefd('0x2f')]['rawAttributes']);_0x1f4a15['query']=_[_0xaefd('0x35')](_0x20d5fd[_0xaefd('0x34')]);_0x1f4a15[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x1f4a15[_0xaefd('0x33')],_0x1f4a15[_0xaefd('0x34')]);_0x3633ec[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x1f4a15[_0xaefd('0x33')],qs['fields'](_0x20d5fd[_0xaefd('0x34')][_0xaefd('0x39')]));_0x3633ec[_0xaefd('0x38')]=_0x3633ec[_0xaefd('0x38')][_0xaefd('0x48')]?_0x3633ec[_0xaefd('0x38')]:_0x1f4a15[_0xaefd('0x33')];if(_0x20d5fd['query'][_0xaefd('0x42')]){_0x3633ec['include']=[{'all':!![]}];}_0x3633ec=_[_0xaefd('0x40')]({},_0x3633ec,_0x20d5fd[_0xaefd('0x49')]);return db[_0xaefd('0x2f')][_0xaefd('0x4a')](_0x3633ec)['then'](handleEntityNotFound(_0x197f3f,null))['then'](respondWithResult(_0x197f3f,null))[_0xaefd('0x46')](handleError(_0x197f3f,null));};exports[_0xaefd('0x4b')]=function(_0x179b8b,_0x4eeb56){return db[_0xaefd('0x2f')][_0xaefd('0x4b')](_0x179b8b['body'],{})[_0xaefd('0x26')](function(_0xf2783d){var _0x3c6a3e=_0x179b8b[_0xaefd('0x4c')][_0xaefd('0x4d')]({'plain':!![]});if(!_0x3c6a3e)throw new Error(_0xaefd('0x4e'));if(_0x3c6a3e[_0xaefd('0x4f')]===_0xaefd('0x4c')){var _0x4dc674=_0xf2783d['get']({'plain':!![]});var _0x1406b8=_0xaefd('0x28');return db['UserProfileSection'][_0xaefd('0x4a')]({'where':{'name':_0x1406b8,'userProfileId':_0x3c6a3e['userProfileId']},'raw':!![]})[_0xaefd('0x26')](function(_0x47296d){if(_0x47296d&&_0x47296d[_0xaefd('0x50')]===0x0){return db[_0xaefd('0x29')][_0xaefd('0x4b')]({'name':_0x4dc674[_0xaefd('0x2c')],'resourceId':_0x4dc674['id'],'type':_0x47296d['name'],'sectionId':_0x47296d['id']},{})['then'](function(){return _0xf2783d;});}else{return _0xf2783d;}})[_0xaefd('0x46')](function(_0x338823){logger['error'](_0xaefd('0x51'),_0x338823);throw _0x338823;});}return _0xf2783d;})[_0xaefd('0x26')](respondWithResult(_0x4eeb56,0xc9))[_0xaefd('0x46')](handleError(_0x4eeb56,null));};exports[_0xaefd('0x25')]=function(_0x4a883b,_0x583caa){if(_0x4a883b[_0xaefd('0x52')]['id']){delete _0x4a883b[_0xaefd('0x52')]['id'];}return db[_0xaefd('0x2f')][_0xaefd('0x4a')]({'where':{'id':_0x4a883b[_0xaefd('0x53')]['id']}})['then'](handleEntityNotFound(_0x583caa,null))[_0xaefd('0x26')](saveUpdates(_0x4a883b[_0xaefd('0x52')],null))['then'](respondWithResult(_0x583caa,null))[_0xaefd('0x46')](handleError(_0x583caa,null));};exports[_0xaefd('0x27')]=function(_0x5f2925,_0x108e35){return db[_0xaefd('0x2f')][_0xaefd('0x4a')]({'where':{'id':_0x5f2925['params']['id']}})[_0xaefd('0x26')](handleEntityNotFound(_0x108e35,null))[_0xaefd('0x26')](removeEntity(_0x108e35,null))['catch'](handleError(_0x108e35,null));};exports[_0xaefd('0x54')]=function(_0x21b65c,_0x14b472,_0x2dd1ee){return db['VoiceMail']['findOne']({'where':{'id':_0x21b65c[_0xaefd('0x53')]['id']}})[_0xaefd('0x26')](handleEntityNotFound(_0x14b472,null))[_0xaefd('0x26')](function(_0x3e1673){var _0x4189c4;var _0x8ab9e7={},_0x314660={};_0x314660[_0xaefd('0x33')]=_[_0xaefd('0x35')](db[_0xaefd('0x55')]['rawAttributes']);_0x314660['query']=_[_0xaefd('0x35')](_0x21b65c[_0xaefd('0x34')]);_0x314660[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x314660['model'],_0x314660[_0xaefd('0x34')]);_0x8ab9e7[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x314660[_0xaefd('0x33')],qs[_0xaefd('0x39')](_0x21b65c[_0xaefd('0x34')][_0xaefd('0x39')]));_0x8ab9e7[_0xaefd('0x38')]=_0x8ab9e7['attributes'][_0xaefd('0x48')]?_0x8ab9e7[_0xaefd('0x38')]:_0x314660[_0xaefd('0x33')];if(!_0x21b65c[_0xaefd('0x34')]['hasOwnProperty'](_0xaefd('0x3a'))){_0x8ab9e7['limit']=qs[_0xaefd('0x1d')](_0x21b65c[_0xaefd('0x34')]['limit']);_0x8ab9e7['offset']=qs[_0xaefd('0x1b')](_0x21b65c['query']['offset']);}_0x8ab9e7['order']=qs[_0xaefd('0x3c')](_0x21b65c[_0xaefd('0x34')][_0xaefd('0x3c')]);_0x8ab9e7[_0xaefd('0x3d')]=qs[_0xaefd('0x36')](_[_0xaefd('0x3e')](_0x21b65c['query'],_0x314660['filters']));if(_0x21b65c['query']['filter']){_0x8ab9e7[_0xaefd('0x3d')]=_['merge'](_0x8ab9e7[_0xaefd('0x3d')],{'$or':_['map'](_0x8ab9e7[_0xaefd('0x38')],function(_0x32dc0d){var _0x416241={};_0x416241[_0x32dc0d]={'$like':'%'+_0x21b65c[_0xaefd('0x34')][_0xaefd('0x3f')]+'%'};return _0x416241;})});}_0x8ab9e7[_0xaefd('0x3d')]=_[_0xaefd('0x40')](_0x8ab9e7['where'],{'mailboxuser':_0x3e1673[_0xaefd('0x56')]});_0x8ab9e7=_[_0xaefd('0x40')]({},_0x8ab9e7,_0x21b65c[_0xaefd('0x49')]);return db[_0xaefd('0x55')]['findAndCountAll'](_0x8ab9e7)[_0xaefd('0x26')](respondWithFilteredResult(_0x14b472,_0x8ab9e7));})['catch'](handleError(_0x14b472,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3289125..dfb370b 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 _0xd307=['bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api'];(function(_0x23932e,_0xae3c98){var _0x32bf41=function(_0x6d12f){while(--_0x6d12f){_0x23932e['push'](_0x23932e['shift']());}};_0x32bf41(++_0xae3c98);}(_0xd307,0x1bc));var _0x7d30=function(_0x1a5c86,_0x355ac0){_0x1a5c86=_0x1a5c86-0x0;var _0x96f889=_0xd307[_0x1a5c86];return _0x96f889;};'use strict';var _=require(_0x7d30('0x0'));var util=require(_0x7d30('0x1'));var logger=require(_0x7d30('0x2'))(_0x7d30('0x3'));var moment=require('moment');var BPromise=require(_0x7d30('0x4'));var rp=require(_0x7d30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d30('0x6'));var config=require(_0x7d30('0x7'));var attributes=require(_0x7d30('0x8'));module[_0x7d30('0x9')]=function(_0x2bd5a7,_0x5d6b11){return _0x2bd5a7[_0x7d30('0xa')](_0x7d30('0xb'),attributes,{'tableName':_0x7d30('0xc'),'paranoid':![],'indexes':[{'name':_0x7d30('0xd'),'fields':[_0x7d30('0xe'),_0x7d30('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf86=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger'];(function(_0x58fbb0,_0xe497b5){var _0x1783d2=function(_0x5554a8){while(--_0x5554a8){_0x58fbb0['push'](_0x58fbb0['shift']());}};_0x1783d2(++_0xe497b5);}(_0xcf86,0x7e));var _0x6cf8=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xcf86[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x6cf8('0x0'));var util=require('util');var logger=require(_0x6cf8('0x1'))(_0x6cf8('0x2'));var moment=require(_0x6cf8('0x3'));var BPromise=require(_0x6cf8('0x4'));var rp=require(_0x6cf8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf8('0x6'));var config=require(_0x6cf8('0x7'));var attributes=require(_0x6cf8('0x8'));module[_0x6cf8('0x9')]=function(_0x11b737,_0xa3540e){return _0x11b737[_0x6cf8('0xa')](_0x6cf8('0xb'),attributes,{'tableName':_0x6cf8('0xc'),'paranoid':![],'indexes':[{'name':_0x6cf8('0xd'),'fields':[_0x6cf8('0xe'),_0x6cf8('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index b58f31a..c4a1e8a 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 _0x0850=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0xd49b9f,_0x57700d){var _0x13c507=function(_0x302e90){while(--_0x302e90){_0xd49b9f['push'](_0xd49b9f['shift']());}};_0x13c507(++_0x57700d);}(_0x0850,0x1c0));var _0x0085=function(_0x16c6a3,_0x1e5867){_0x16c6a3=_0x16c6a3-0x0;var _0x1cc69c=_0x0850[_0x16c6a3];return _0x1cc69c;};'use strict';var _=require(_0x0085('0x0'));var util=require(_0x0085('0x1'));var moment=require(_0x0085('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0085('0x3'))['db'];var utils=require(_0x0085('0x4'));var logger=require(_0x0085('0x5'))(_0x0085('0x6'));var config=require(_0x0085('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0085('0x8')][_0x0085('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20d08c,_0x30863b,_0x1a3c27){return new BPromise(function(_0x185c2d,_0x1d3e9b){return client['request'](_0x20d08c,_0x1a3c27)[_0x0085('0xa')](function(_0x3deccb){logger[_0x0085('0xb')](_0x0085('0xc'),_0x30863b,_0x0085('0xd'));logger[_0x0085('0xe')](_0x0085('0xf'),_0x30863b,_0x0085('0xd'),JSON[_0x0085('0x10')](_0x3deccb));if(_0x3deccb['error']){if(_0x3deccb['error'][_0x0085('0x11')]===0x1f4){logger[_0x0085('0x12')](_0x0085('0xc'),_0x30863b,_0x3deccb[_0x0085('0x12')][_0x0085('0x13')]);return _0x1d3e9b(_0x3deccb[_0x0085('0x12')]['message']);}logger[_0x0085('0x12')](_0x0085('0xc'),_0x30863b,_0x3deccb[_0x0085('0x12')][_0x0085('0x13')]);return _0x185c2d(_0x3deccb['error'][_0x0085('0x13')]);}else{logger[_0x0085('0xb')](_0x0085('0xc'),_0x30863b,_0x0085('0xd'));_0x185c2d(_0x3deccb['result'][_0x0085('0x13')]);}})[_0x0085('0x14')](function(_0x6b6452){logger['error'](_0x0085('0xc'),_0x30863b,_0x6b6452);_0x1d3e9b(_0x6b6452);});});} \ No newline at end of file +var _0x078a=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x58ab93,_0x49027d){var _0x273a3d=function(_0x4c8e9b){while(--_0x4c8e9b){_0x58ab93['push'](_0x58ab93['shift']());}};_0x273a3d(++_0x49027d);}(_0x078a,0x7d));var _0xa078=function(_0x550eb1,_0x3aabbd){_0x550eb1=_0x550eb1-0x0;var _0xf971de=_0x078a[_0x550eb1];return _0xf971de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa078('0x0'));var BPromise=require(_0xa078('0x1'));var rs=require(_0xa078('0x2'));var fs=require('fs');var Redis=require(_0xa078('0x3'));var db=require(_0xa078('0x4'))['db'];var utils=require(_0xa078('0x5'));var logger=require(_0xa078('0x6'))(_0xa078('0x7'));var config=require(_0xa078('0x8'));var jayson=require(_0xa078('0x9'));var client=jayson['client'][_0xa078('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3abe2e,_0x4c7b06,_0x4074a9){return new BPromise(function(_0x1710d8,_0x1101e7){return client[_0xa078('0xb')](_0x3abe2e,_0x4074a9)[_0xa078('0xc')](function(_0x3f8071){logger[_0xa078('0xd')](_0xa078('0xe'),_0x4c7b06,_0xa078('0xf'));logger[_0xa078('0x10')](_0xa078('0x11'),_0x4c7b06,'request\x20sent',JSON[_0xa078('0x12')](_0x3f8071));if(_0x3f8071[_0xa078('0x13')]){if(_0x3f8071[_0xa078('0x13')]['code']===0x1f4){logger[_0xa078('0x13')]('VoiceMail,\x20%s,\x20%s',_0x4c7b06,_0x3f8071[_0xa078('0x13')][_0xa078('0x14')]);return _0x1101e7(_0x3f8071[_0xa078('0x13')]['message']);}logger[_0xa078('0x13')](_0xa078('0xe'),_0x4c7b06,_0x3f8071[_0xa078('0x13')][_0xa078('0x14')]);return _0x1710d8(_0x3f8071[_0xa078('0x13')][_0xa078('0x14')]);}else{logger[_0xa078('0xd')](_0xa078('0xe'),_0x4c7b06,_0xa078('0xf'));_0x1710d8(_0x3f8071[_0xa078('0x15')][_0xa078('0x14')]);}})['catch'](function(_0x34bf7a){logger[_0xa078('0x13')]('VoiceMail,\x20%s,\x20%s',_0x4c7b06,_0x34bf7a);_0x1101e7(_0x34bf7a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index a4eb29c..287c0b7 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 _0x38bd=['/:id/download','download','post','create','put','update','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x38bd,0xa7));var _0xd38b=function(_0x421480,_0x1210a5){_0x421480=_0x421480-0x0;var _0x141d1c=_0x38bd[_0x421480];return _0x141d1c;};'use strict';var multer=require('multer');var util=require(_0xd38b('0x0'));var path=require('path');var timeout=require(_0xd38b('0x1'));var express=require('express');var router=express[_0xd38b('0x2')]();var fs_extra=require(_0xd38b('0x3'));var auth=require(_0xd38b('0x4'));var interaction=require(_0xd38b('0x5'));var config=require(_0xd38b('0x6'));var controller=require(_0xd38b('0x7'));router[_0xd38b('0x8')]('/',auth[_0xd38b('0x9')](),controller[_0xd38b('0xa')]);router[_0xd38b('0x8')](_0xd38b('0xb'),auth[_0xd38b('0x9')](),controller[_0xd38b('0xc')]);router['get'](_0xd38b('0xd'),auth[_0xd38b('0x9')](),controller[_0xd38b('0xe')]);router[_0xd38b('0xf')]('/',auth['isAuthenticated'](),controller[_0xd38b('0x10')]);router[_0xd38b('0x11')](_0xd38b('0xb'),auth[_0xd38b('0x9')](),controller[_0xd38b('0x12')]);router['delete'](_0xd38b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd38b('0x13')]=router; \ No newline at end of file +var _0x25bd=['post','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x10b581,_0x1365d9){var _0x460038=function(_0x4f2023){while(--_0x4f2023){_0x10b581['push'](_0x10b581['shift']());}};_0x460038(++_0x1365d9);}(_0x25bd,0x134));var _0xd25b=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x25bd[_0x256b72];return _0x2183e3;};'use strict';var multer=require(_0xd25b('0x0'));var util=require(_0xd25b('0x1'));var path=require(_0xd25b('0x2'));var timeout=require(_0xd25b('0x3'));var express=require('express');var router=express[_0xd25b('0x4')]();var fs_extra=require(_0xd25b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd25b('0x6'));var config=require('../../config/environment');var controller=require(_0xd25b('0x7'));router[_0xd25b('0x8')]('/',auth[_0xd25b('0x9')](),controller[_0xd25b('0xa')]);router[_0xd25b('0x8')](_0xd25b('0xb'),auth[_0xd25b('0x9')](),controller[_0xd25b('0xc')]);router['get'](_0xd25b('0xd'),auth[_0xd25b('0x9')](),controller[_0xd25b('0xe')]);router[_0xd25b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd25b('0x10')](_0xd25b('0xb'),auth[_0xd25b('0x9')](),controller['update']);router[_0xd25b('0x11')](_0xd25b('0xb'),auth[_0xd25b('0x9')](),controller['destroy']);module[_0xd25b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 4928936..357a8b9 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 _0x6cb8=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0x6cb8,0x1d8));var _0x86cb=function(_0x2cbc47,_0x2daf86){_0x2cbc47=_0x2cbc47-0x0;var _0x2b429e=_0x6cb8[_0x2cbc47];return _0x2b429e;};'use strict';var Sequelize=require('sequelize');module[_0x86cb('0x0')]={'name':{'type':Sequelize[_0x86cb('0x1')],'get':function(_0x27cba4){return this[_0x86cb('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x86cb('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x86cb('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x86cb('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x86cb('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x86cb('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x86cb('0x5')](_0x86cb('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x86cb('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x86cb('0x7'),'defaultValue':Sequelize[_0x86cb('0x8')](_0x86cb('0x9'))}}; \ No newline at end of file +var _0xf38f=['exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0xf38f,0x1e3));var _0xff38=function(_0x295df8,_0x1f9924){_0x295df8=_0x295df8-0x0;var _0x1c4b61=_0xf38f[_0x295df8];return _0x1c4b61;};'use strict';var Sequelize=require('sequelize');module[_0xff38('0x0')]={'name':{'type':Sequelize[_0xff38('0x1')],'get':function(_0x1a0de2){return this[_0xff38('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xff38('0x4')](_0xff38('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'stamp':{'type':_0xff38('0x6'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b52cf5a..5b056e1 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 _0xd81b=['ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceMailMessage','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','recording','Sequelize'];(function(_0xe2684e,_0x457bd7){var _0x4e4668=function(_0x49131c){while(--_0x49131c){_0xe2684e['push'](_0xe2684e['shift']());}};_0x4e4668(++_0x457bd7);}(_0xd81b,0x1a1));var _0xbd81=function(_0xf51edd,_0x194dac){_0xf51edd=_0xf51edd-0x0;var _0x28800b=_0xd81b[_0xf51edd];return _0x28800b;};'use strict';var emlformat=require(_0xbd81('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbd81('0x1'));var rp=require(_0xbd81('0x2'));var moment=require(_0xbd81('0x3'));var BPromise=require(_0xbd81('0x4'));var Mustache=require('mustache');var util=require(_0xbd81('0x5'));var path=require(_0xbd81('0x6'));var sox=require(_0xbd81('0x7'));var csv=require(_0xbd81('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd81('0x9'));var _=require(_0xbd81('0xa'));var squel=require(_0xbd81('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd81('0xc'));var deskjs=require(_0xbd81('0xd'));var toCsv=require(_0xbd81('0x8'));var querystring=require(_0xbd81('0xe'));var Papa=require('papaparse');var Redis=require(_0xbd81('0xf'));var authService=require(_0xbd81('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbd81('0x11'));var hardwareService=require(_0xbd81('0x12'));var logger=require(_0xbd81('0x13'))('api');var utils=require(_0xbd81('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd81('0x15'));var db=require(_0xbd81('0x16'))['db'];function respondWithStatusCode(_0x2a20ea,_0x5253f6){_0x5253f6=_0x5253f6||0xcc;return function(_0x12124a){if(_0x12124a){return _0x2a20ea[_0xbd81('0x17')](_0x5253f6);}return _0x2a20ea[_0xbd81('0x18')](_0x5253f6)[_0xbd81('0x19')]();};}function respondWithResult(_0x161726,_0x4f1fff){_0x4f1fff=_0x4f1fff||0xc8;return function(_0x56b196){if(_0x56b196){return _0x161726[_0xbd81('0x18')](_0x4f1fff)[_0xbd81('0x1a')](_0x56b196);}};}function respondWithFilteredResult(_0x13feab,_0x21eb3d){return function(_0x3adbb0){if(_0x3adbb0){var _0x5d2540=typeof _0x21eb3d[_0xbd81('0x1b')]===_0xbd81('0x1c')&&typeof _0x21eb3d['limit']===_0xbd81('0x1c');var _0x409403=_0x3adbb0[_0xbd81('0x1d')];var _0x37ac3b=_0x5d2540?0x0:_0x21eb3d[_0xbd81('0x1b')];var _0xa39c1e=_0x5d2540?_0x3adbb0['count']:_0x21eb3d[_0xbd81('0x1b')]+_0x21eb3d[_0xbd81('0x1e')];var _0x50d71a;if(_0xa39c1e>=_0x409403){_0xa39c1e=_0x409403;_0x50d71a=0xc8;}else{_0x50d71a=0xce;}_0x13feab[_0xbd81('0x18')](_0x50d71a);return _0x13feab[_0xbd81('0x1f')]('Content-Range',_0x37ac3b+'-'+_0xa39c1e+'/'+_0x409403)['json'](_0x3adbb0);}return null;};}function patchUpdates(_0x4bb475){return function(_0x4aa177){try{jsonpatch[_0xbd81('0x20')](_0x4aa177,_0x4bb475,!![]);}catch(_0x25616d){return BPromise[_0xbd81('0x21')](_0x25616d);}return _0x4aa177['save']();};}function saveUpdates(_0x270c10,_0x1dcd83){return function(_0x3d9614){if(_0x3d9614){return _0x3d9614[_0xbd81('0x22')](_0x270c10)[_0xbd81('0x23')](function(_0x5a4cb5){return _0x5a4cb5;});}return null;};}function removeEntity(_0x27b97f,_0x3fc36e){return function(_0x16d970){if(_0x16d970){return _0x16d970[_0xbd81('0x24')]()[_0xbd81('0x23')](function(){_0x27b97f[_0xbd81('0x18')](0xcc)[_0xbd81('0x19')]();});}};}function handleEntityNotFound(_0x20d790,_0x4a9f86){return function(_0x32b8c2){if(!_0x32b8c2){_0x20d790[_0xbd81('0x17')](0x194);}return _0x32b8c2;};}function handleError(_0x209587,_0x18cdaa){_0x18cdaa=_0x18cdaa||0x1f4;return function(_0x228961){logger['error'](_0x228961[_0xbd81('0x25')]);if(_0x228961[_0xbd81('0x26')]){delete _0x228961[_0xbd81('0x26')];}_0x209587[_0xbd81('0x18')](_0x18cdaa)[_0xbd81('0x27')](_0x228961);};}exports[_0xbd81('0x28')]=function(_0x11b0fe,_0x5e9888){var _0x5722b0={},_0x5c6476={},_0x4eb1cb={'count':0x0,'rows':[]};var _0x3d0ef9=_[_0xbd81('0x29')](db[_0xbd81('0x2a')]['rawAttributes'],function(_0x4facd4){return{'name':_0x4facd4['fieldName'],'type':_0x4facd4[_0xbd81('0x2b')][_0xbd81('0x2c')]};});_0x5c6476[_0xbd81('0x2d')]=_[_0xbd81('0x2e')](_[_0xbd81('0x29')](_0x3d0ef9,_0xbd81('0x26')),[_0xbd81('0x26')]);_0x5c6476[_0xbd81('0x2f')]=_[_0xbd81('0x30')](_0x11b0fe[_0xbd81('0x2f')]);_0x5c6476[_0xbd81('0x31')]=_[_0xbd81('0x32')](_0x5c6476[_0xbd81('0x2d')],_0x5c6476[_0xbd81('0x2f')]);_0x5722b0[_0xbd81('0x33')]=_[_0xbd81('0x32')](_0x5c6476[_0xbd81('0x2d')],qs[_0xbd81('0x34')](_0x11b0fe[_0xbd81('0x2f')][_0xbd81('0x34')]));_0x5722b0[_0xbd81('0x33')]=_0x5722b0[_0xbd81('0x33')][_0xbd81('0x35')]?_0x5722b0[_0xbd81('0x33')]:_0x5c6476['model'];if(!_0x11b0fe[_0xbd81('0x2f')][_0xbd81('0x36')](_0xbd81('0x37'))){_0x5722b0[_0xbd81('0x1e')]=qs[_0xbd81('0x1e')](_0x11b0fe[_0xbd81('0x2f')][_0xbd81('0x1e')]);_0x5722b0[_0xbd81('0x1b')]=qs['offset'](_0x11b0fe[_0xbd81('0x2f')]['offset']);}_0x5722b0[_0xbd81('0x38')]=qs[_0xbd81('0x39')](_0x11b0fe[_0xbd81('0x2f')][_0xbd81('0x39')]);_0x5722b0[_0xbd81('0x3a')]=qs[_0xbd81('0x31')](_[_0xbd81('0x3b')](_0x11b0fe['query'],_0x5c6476['filters']),_0x3d0ef9);if(_0x11b0fe['query'][_0xbd81('0x3c')]){_0x5722b0['where']=_['merge'](_0x5722b0[_0xbd81('0x3a')],{'$or':_['map'](_0x3d0ef9,function(_0x11311e){if(_0x11311e['type']!=='VIRTUAL'){var _0x3ca01f={};_0x3ca01f[_0x11311e[_0xbd81('0x26')]]={'$like':'%'+_0x11b0fe[_0xbd81('0x2f')][_0xbd81('0x3c')]+'%'};return _0x3ca01f;}})});}_0x5722b0=_[_0xbd81('0x3d')]({},_0x5722b0,_0x11b0fe[_0xbd81('0x3e')]);var _0x2e6f6b={'where':_0x5722b0[_0xbd81('0x3a')]};return db[_0xbd81('0x2a')][_0xbd81('0x1d')](_0x2e6f6b)[_0xbd81('0x23')](function(_0x1acc12){_0x4eb1cb[_0xbd81('0x1d')]=_0x1acc12;if(_0x11b0fe[_0xbd81('0x2f')][_0xbd81('0x3f')]){_0x5722b0[_0xbd81('0x40')]=[{'all':!![]}];}return db[_0xbd81('0x2a')]['findAll'](_0x5722b0);})[_0xbd81('0x23')](function(_0x2164d8){_0x4eb1cb[_0xbd81('0x41')]=_0x2164d8;return _0x4eb1cb;})[_0xbd81('0x23')](respondWithFilteredResult(_0x5e9888,_0x5722b0))[_0xbd81('0x42')](handleError(_0x5e9888,null));};exports[_0xbd81('0x43')]=function(_0x33e711,_0x5c5a38){var _0x26dff2={'raw':!![],'where':{'id':_0x33e711['params']['id']}},_0x33aa2d={};_0x33aa2d[_0xbd81('0x2d')]=_[_0xbd81('0x30')](db[_0xbd81('0x2a')][_0xbd81('0x44')]);_0x33aa2d['query']=_[_0xbd81('0x30')](_0x33e711[_0xbd81('0x2f')]);_0x33aa2d['filters']=_['intersection'](_0x33aa2d[_0xbd81('0x2d')],_0x33aa2d[_0xbd81('0x2f')]);_0x26dff2[_0xbd81('0x33')]=_[_0xbd81('0x32')](_0x33aa2d['model'],qs[_0xbd81('0x34')](_0x33e711['query'][_0xbd81('0x34')]));_0x26dff2[_0xbd81('0x33')]=_0x26dff2[_0xbd81('0x33')][_0xbd81('0x35')]?_0x26dff2[_0xbd81('0x33')]:_0x33aa2d[_0xbd81('0x2d')];if(_0x33e711[_0xbd81('0x2f')]['includeAll']){_0x26dff2[_0xbd81('0x40')]=[{'all':!![]}];}_0x26dff2=_[_0xbd81('0x3d')]({},_0x26dff2,_0x33e711['options']);return db[_0xbd81('0x2a')][_0xbd81('0x45')](_0x26dff2)['then'](handleEntityNotFound(_0x5c5a38,null))[_0xbd81('0x23')](respondWithResult(_0x5c5a38,null))[_0xbd81('0x42')](handleError(_0x5c5a38,null));};exports[_0xbd81('0x46')]=function(_0x36462e,_0x10444b){return db['VoiceMailMessage'][_0xbd81('0x46')](_0x36462e[_0xbd81('0x47')],{})[_0xbd81('0x23')](respondWithResult(_0x10444b,0xc9))[_0xbd81('0x42')](handleError(_0x10444b,null));};exports['update']=function(_0xbfab29,_0x147ad6){if(_0xbfab29[_0xbd81('0x47')]['id']){delete _0xbfab29[_0xbd81('0x47')]['id'];}return db[_0xbd81('0x2a')][_0xbd81('0x45')]({'where':{'id':_0xbfab29['params']['id']}})[_0xbd81('0x23')](handleEntityNotFound(_0x147ad6,null))[_0xbd81('0x23')](saveUpdates(_0xbfab29['body'],null))[_0xbd81('0x23')](respondWithResult(_0x147ad6,null))[_0xbd81('0x42')](handleError(_0x147ad6,null));};exports[_0xbd81('0x24')]=function(_0x2b63c8,_0x431ba8){return db[_0xbd81('0x2a')][_0xbd81('0x45')]({'where':{'id':_0x2b63c8[_0xbd81('0x48')]['id']}})['then'](handleEntityNotFound(_0x431ba8,null))[_0xbd81('0x23')](removeEntity(_0x431ba8,null))[_0xbd81('0x42')](handleError(_0x431ba8,null));};exports['download']=function(_0x426e08,_0x3b77de,_0x1e7cf4){return db[_0xbd81('0x2a')][_0xbd81('0x45')]({'where':{'id':_0x426e08[_0xbd81('0x48')]['id']},'attributes':['id','recording','msg_id']})[_0xbd81('0x23')](handleEntityNotFound(_0x3b77de,null))[_0xbd81('0x23')](function(_0x9897cc){if(_0x9897cc){if(!_0x9897cc[_0xbd81('0x49')]){throw new db[(_0xbd81('0x4a'))][(_0xbd81('0x4b'))](_0xbd81('0x4c'));}var _0x21c9d8={'Content-Type':_0xbd81('0x4d'),'Content-Disposition':_0xbd81('0x4e')};if(_0x9897cc[_0xbd81('0x4f')]){_0x21c9d8[_0xbd81('0x50')]=_0xbd81('0x51')+_0x9897cc[_0xbd81('0x4f')]+'.wav\x22';}_0x3b77de[_0xbd81('0x1f')](_0x21c9d8);return _0x3b77de[_0xbd81('0x27')](new Buffer(_0x9897cc[_0xbd81('0x49')]));}})[_0xbd81('0x42')](handleError(_0x3b77de,null));}; \ No newline at end of file +var _0xd00a=['send','index','VoiceMailMessage','fieldName','type','key','model','differenceBy','map','keys','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','findAll','catch','show','params','rawAttributes','find','create','body','download','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','recording','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','then','name'];(function(_0x3785e4,_0x21136f){var _0x4a211f=function(_0x36a28e){while(--_0x36a28e){_0x3785e4['push'](_0x3785e4['shift']());}};_0x4a211f(++_0x21136f);}(_0xd00a,0x16c));var _0xad00=function(_0x3ef2b3,_0x1ca524){_0x3ef2b3=_0x3ef2b3-0x0;var _0xe7016d=_0xd00a[_0x3ef2b3];return _0xe7016d;};'use strict';var emlformat=require(_0xad00('0x0'));var rimraf=require(_0xad00('0x1'));var zipdir=require(_0xad00('0x2'));var jsonpatch=require(_0xad00('0x3'));var rp=require(_0xad00('0x4'));var moment=require('moment');var BPromise=require(_0xad00('0x5'));var Mustache=require(_0xad00('0x6'));var util=require(_0xad00('0x7'));var path=require(_0xad00('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xad00('0x9'));var fs=require('fs');var fs_extra=require(_0xad00('0xa'));var _=require(_0xad00('0xb'));var squel=require(_0xad00('0xc'));var crypto=require(_0xad00('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xad00('0xe'));var toCsv=require(_0xad00('0xf'));var querystring=require('querystring');var Papa=require(_0xad00('0x10'));var Redis=require(_0xad00('0x11'));var authService=require(_0xad00('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xad00('0x13'));var hardwareService=require(_0xad00('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xad00('0x15'));var config=require(_0xad00('0x16'));var licenseUtil=require(_0xad00('0x17'));var db=require(_0xad00('0x18'))['db'];function respondWithStatusCode(_0x3f79f1,_0x4068f3){_0x4068f3=_0x4068f3||0xcc;return function(_0x371f2d){if(_0x371f2d){return _0x3f79f1[_0xad00('0x19')](_0x4068f3);}return _0x3f79f1[_0xad00('0x1a')](_0x4068f3)[_0xad00('0x1b')]();};}function respondWithResult(_0x1412d0,_0x202b80){_0x202b80=_0x202b80||0xc8;return function(_0x72f4a7){if(_0x72f4a7){return _0x1412d0[_0xad00('0x1a')](_0x202b80)[_0xad00('0x1c')](_0x72f4a7);}};}function respondWithFilteredResult(_0x3c6705,_0x4fdc2d){return function(_0xaf8d70){if(_0xaf8d70){var _0x1e469d=typeof _0x4fdc2d['offset']===_0xad00('0x1d')&&typeof _0x4fdc2d[_0xad00('0x1e')]===_0xad00('0x1d');var _0x2169d2=_0xaf8d70['count'];var _0x447e16=_0x1e469d?0x0:_0x4fdc2d[_0xad00('0x1f')];var _0x26b319=_0x1e469d?_0xaf8d70[_0xad00('0x20')]:_0x4fdc2d[_0xad00('0x1f')]+_0x4fdc2d['limit'];var _0x35f87e;if(_0x26b319>=_0x2169d2){_0x26b319=_0x2169d2;_0x35f87e=0xc8;}else{_0x35f87e=0xce;}_0x3c6705[_0xad00('0x1a')](_0x35f87e);return _0x3c6705[_0xad00('0x21')](_0xad00('0x22'),_0x447e16+'-'+_0x26b319+'/'+_0x2169d2)['json'](_0xaf8d70);}return null;};}function patchUpdates(_0x40ab09){return function(_0x2ebb55){try{jsonpatch[_0xad00('0x23')](_0x2ebb55,_0x40ab09,!![]);}catch(_0x4605a6){return BPromise[_0xad00('0x24')](_0x4605a6);}return _0x2ebb55[_0xad00('0x25')]();};}function saveUpdates(_0x2748a6,_0x5d7f5b){return function(_0x399d7c){if(_0x399d7c){return _0x399d7c['update'](_0x2748a6)['then'](function(_0x3f7f03){return _0x3f7f03;});}return null;};}function removeEntity(_0x695612,_0x25c3b3){return function(_0x13dd98){if(_0x13dd98){return _0x13dd98[_0xad00('0x26')]()[_0xad00('0x27')](function(){_0x695612[_0xad00('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f132f,_0x5f1cf8){return function(_0x329a2e){if(!_0x329a2e){_0x3f132f['sendStatus'](0x194);}return _0x329a2e;};}function handleError(_0x535757,_0x330b88){_0x330b88=_0x330b88||0x1f4;return function(_0x2c3b48){logger['error'](_0x2c3b48['stack']);if(_0x2c3b48['name']){delete _0x2c3b48[_0xad00('0x28')];}_0x535757['status'](_0x330b88)[_0xad00('0x29')](_0x2c3b48);};}exports[_0xad00('0x2a')]=function(_0x1c3576,_0xc93254){var _0x249ffa={},_0x230974={},_0x468d91={'count':0x0,'rows':[]};var _0x51d30d=_['map'](db[_0xad00('0x2b')]['rawAttributes'],function(_0x170c78){return{'name':_0x170c78[_0xad00('0x2c')],'type':_0x170c78[_0xad00('0x2d')][_0xad00('0x2e')]};});_0x230974[_0xad00('0x2f')]=_[_0xad00('0x30')](_[_0xad00('0x31')](_0x51d30d,_0xad00('0x28')),[_0xad00('0x28')]);_0x230974['query']=_[_0xad00('0x32')](_0x1c3576[_0xad00('0x33')]);_0x230974['filters']=_[_0xad00('0x34')](_0x230974['model'],_0x230974[_0xad00('0x33')]);_0x249ffa[_0xad00('0x35')]=_[_0xad00('0x34')](_0x230974[_0xad00('0x2f')],qs[_0xad00('0x36')](_0x1c3576[_0xad00('0x33')]['fields']));_0x249ffa[_0xad00('0x35')]=_0x249ffa['attributes']['length']?_0x249ffa['attributes']:_0x230974[_0xad00('0x2f')];if(!_0x1c3576[_0xad00('0x33')]['hasOwnProperty'](_0xad00('0x37'))){_0x249ffa['limit']=qs[_0xad00('0x1e')](_0x1c3576[_0xad00('0x33')][_0xad00('0x1e')]);_0x249ffa[_0xad00('0x1f')]=qs[_0xad00('0x1f')](_0x1c3576[_0xad00('0x33')][_0xad00('0x1f')]);}_0x249ffa[_0xad00('0x38')]=qs[_0xad00('0x39')](_0x1c3576[_0xad00('0x33')][_0xad00('0x39')]);_0x249ffa['where']=qs[_0xad00('0x3a')](_[_0xad00('0x3b')](_0x1c3576['query'],_0x230974[_0xad00('0x3a')]),_0x51d30d);if(_0x1c3576[_0xad00('0x33')][_0xad00('0x3c')]){_0x249ffa[_0xad00('0x3d')]=_[_0xad00('0x3e')](_0x249ffa[_0xad00('0x3d')],{'$or':_[_0xad00('0x31')](_0x51d30d,function(_0x12c8be){if(_0x12c8be[_0xad00('0x2d')]!=='VIRTUAL'){var _0xb72afa={};_0xb72afa[_0x12c8be[_0xad00('0x28')]]={'$like':'%'+_0x1c3576[_0xad00('0x33')][_0xad00('0x3c')]+'%'};return _0xb72afa;}})});}_0x249ffa=_[_0xad00('0x3e')]({},_0x249ffa,_0x1c3576['options']);var _0x35cd74={'where':_0x249ffa[_0xad00('0x3d')]};return db['VoiceMailMessage'][_0xad00('0x20')](_0x35cd74)[_0xad00('0x27')](function(_0x2b1cd5){_0x468d91[_0xad00('0x20')]=_0x2b1cd5;if(_0x1c3576[_0xad00('0x33')][_0xad00('0x3f')]){_0x249ffa['include']=[{'all':!![]}];}return db[_0xad00('0x2b')][_0xad00('0x40')](_0x249ffa);})['then'](function(_0x358aaa){_0x468d91['rows']=_0x358aaa;return _0x468d91;})[_0xad00('0x27')](respondWithFilteredResult(_0xc93254,_0x249ffa))[_0xad00('0x41')](handleError(_0xc93254,null));};exports[_0xad00('0x42')]=function(_0x54a566,_0x2af109){var _0xb8242b={'raw':!![],'where':{'id':_0x54a566[_0xad00('0x43')]['id']}},_0x2c1c6b={};_0x2c1c6b[_0xad00('0x2f')]=_[_0xad00('0x32')](db['VoiceMailMessage'][_0xad00('0x44')]);_0x2c1c6b[_0xad00('0x33')]=_[_0xad00('0x32')](_0x54a566[_0xad00('0x33')]);_0x2c1c6b[_0xad00('0x3a')]=_[_0xad00('0x34')](_0x2c1c6b['model'],_0x2c1c6b[_0xad00('0x33')]);_0xb8242b[_0xad00('0x35')]=_[_0xad00('0x34')](_0x2c1c6b[_0xad00('0x2f')],qs['fields'](_0x54a566[_0xad00('0x33')][_0xad00('0x36')]));_0xb8242b[_0xad00('0x35')]=_0xb8242b[_0xad00('0x35')]['length']?_0xb8242b[_0xad00('0x35')]:_0x2c1c6b[_0xad00('0x2f')];if(_0x54a566[_0xad00('0x33')][_0xad00('0x3f')]){_0xb8242b['include']=[{'all':!![]}];}_0xb8242b=_['merge']({},_0xb8242b,_0x54a566['options']);return db[_0xad00('0x2b')][_0xad00('0x45')](_0xb8242b)[_0xad00('0x27')](handleEntityNotFound(_0x2af109,null))[_0xad00('0x27')](respondWithResult(_0x2af109,null))[_0xad00('0x41')](handleError(_0x2af109,null));};exports[_0xad00('0x46')]=function(_0x24660c,_0x1a235d){return db[_0xad00('0x2b')][_0xad00('0x46')](_0x24660c[_0xad00('0x47')],{})[_0xad00('0x27')](respondWithResult(_0x1a235d,0xc9))[_0xad00('0x41')](handleError(_0x1a235d,null));};exports['update']=function(_0x43757b,_0x4fd80c){if(_0x43757b[_0xad00('0x47')]['id']){delete _0x43757b['body']['id'];}return db[_0xad00('0x2b')][_0xad00('0x45')]({'where':{'id':_0x43757b[_0xad00('0x43')]['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x4fd80c,null))[_0xad00('0x27')](saveUpdates(_0x43757b[_0xad00('0x47')],null))[_0xad00('0x27')](respondWithResult(_0x4fd80c,null))[_0xad00('0x41')](handleError(_0x4fd80c,null));};exports[_0xad00('0x26')]=function(_0x315333,_0x3df85b){return db[_0xad00('0x2b')]['find']({'where':{'id':_0x315333[_0xad00('0x43')]['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x3df85b,null))[_0xad00('0x27')](removeEntity(_0x3df85b,null))[_0xad00('0x41')](handleError(_0x3df85b,null));};exports[_0xad00('0x48')]=function(_0x2b66d2,_0x5937b8,_0x529447){return db['VoiceMailMessage']['find']({'where':{'id':_0x2b66d2['params']['id']},'attributes':['id','recording',_0xad00('0x49')]})[_0xad00('0x27')](handleEntityNotFound(_0x5937b8,null))[_0xad00('0x27')](function(_0x27dd55){if(_0x27dd55){if(!_0x27dd55['recording']){throw new db['Sequelize'][(_0xad00('0x4a'))](_0xad00('0x4b'));}var _0x56263c={'Content-Type':_0xad00('0x4c'),'Content-Disposition':_0xad00('0x4d')};if(_0x27dd55[_0xad00('0x49')]){_0x56263c[_0xad00('0x4e')]=_0xad00('0x4f')+_0x27dd55[_0xad00('0x49')]+'.wav\x22';}_0x5937b8[_0xad00('0x21')](_0x56263c);return _0x5937b8[_0xad00('0x29')](new Buffer(_0x27dd55[_0xad00('0x50')]));}})[_0xad00('0x41')](handleError(_0x5937b8,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2f26b3b..f92cfdd 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 _0xd756=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMailMessage.attributes'];(function(_0x182bc7,_0x5fe9d7){var _0x4316ea=function(_0x235802){while(--_0x235802){_0x182bc7['push'](_0x182bc7['shift']());}};_0x4316ea(++_0x5fe9d7);}(_0xd756,0x67));var _0x6d75=function(_0x47382c,_0x943f0b){_0x47382c=_0x47382c-0x0;var _0x1ef790=_0xd756[_0x47382c];return _0x1ef790;};'use strict';var _=require(_0x6d75('0x0'));var util=require(_0x6d75('0x1'));var logger=require(_0x6d75('0x2'))(_0x6d75('0x3'));var moment=require(_0x6d75('0x4'));var BPromise=require(_0x6d75('0x5'));var rp=require(_0x6d75('0x6'));var fs=require('fs');var path=require(_0x6d75('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d75('0x8'));module[_0x6d75('0x9')]=function(_0x5e84b6,_0x98a92a){return _0x5e84b6[_0x6d75('0xa')](_0x6d75('0xb'),attributes,{'tableName':_0x6d75('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x6d75('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf90f=['lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0xf90f,0x1ef));var _0xff90=function(_0x691c1c,_0x1507b1){_0x691c1c=_0x691c1c-0x0;var _0x22eed4=_0xf90f[_0x691c1c];return _0x22eed4;};'use strict';var _=require(_0xff90('0x0'));var util=require(_0xff90('0x1'));var logger=require(_0xff90('0x2'))('api');var moment=require('moment');var BPromise=require(_0xff90('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xff90('0x4'));var config=require(_0xff90('0x5'));var attributes=require(_0xff90('0x6'));module[_0xff90('0x7')]=function(_0x26691a,_0xaa2da8){return _0x26691a[_0xff90('0x8')]('VoiceMailMessage',attributes,{'tableName':_0xff90('0x9'),'paranoid':![],'indexes':[{'name':_0xff90('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 008593c..8c936ba 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 _0xb3ef=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0xb3ef,0x166));var _0xfb3e=function(_0x4d7a29,_0x464577){_0x4d7a29=_0x4d7a29-0x0;var _0x4f8ae7=_0xb3ef[_0x4d7a29];return _0x4f8ae7;};'use strict';var _=require(_0xfb3e('0x0'));var util=require(_0xfb3e('0x1'));var moment=require(_0xfb3e('0x2'));var BPromise=require(_0xfb3e('0x3'));var rs=require(_0xfb3e('0x4'));var fs=require('fs');var Redis=require(_0xfb3e('0x5'));var db=require(_0xfb3e('0x6'))['db'];var utils=require(_0xfb3e('0x7'));var logger=require(_0xfb3e('0x8'))(_0xfb3e('0x9'));var config=require(_0xfb3e('0xa'));var jayson=require(_0xfb3e('0xb'));var client=jayson[_0xfb3e('0xc')][_0xfb3e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1eafdd,_0x1c6965,_0x4b0e1a){return new BPromise(function(_0x5ed870,_0x2cd35f){return client[_0xfb3e('0xe')](_0x1eafdd,_0x4b0e1a)['then'](function(_0xc0a56){logger[_0xfb3e('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x1c6965,_0xfb3e('0x10'));logger[_0xfb3e('0x11')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1c6965,_0xfb3e('0x10'),JSON['stringify'](_0xc0a56));if(_0xc0a56[_0xfb3e('0x12')]){if(_0xc0a56[_0xfb3e('0x12')][_0xfb3e('0x13')]===0x1f4){logger[_0xfb3e('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x1c6965,_0xc0a56[_0xfb3e('0x12')][_0xfb3e('0x14')]);return _0x2cd35f(_0xc0a56[_0xfb3e('0x12')][_0xfb3e('0x14')]);}logger[_0xfb3e('0x12')](_0xfb3e('0x15'),_0x1c6965,_0xc0a56[_0xfb3e('0x12')]['message']);return _0x5ed870(_0xc0a56[_0xfb3e('0x12')]['message']);}else{logger[_0xfb3e('0xf')](_0xfb3e('0x15'),_0x1c6965,_0xfb3e('0x10'));_0x5ed870(_0xc0a56[_0xfb3e('0x16')]['message']);}})[_0xfb3e('0x17')](function(_0x4f0571){logger['error'](_0xfb3e('0x15'),_0x1c6965,_0x4f0571);_0x2cd35f(_0x4f0571);});});} \ No newline at end of file +var _0xe169=['catch','VoiceMailMessage,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result'];(function(_0x241841,_0x17ceba){var _0x2d57ea=function(_0x953ed){while(--_0x953ed){_0x241841['push'](_0x241841['shift']());}};_0x2d57ea(++_0x17ceba);}(_0xe169,0x11a));var _0x9e16=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe169[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x9e16('0x0'));var util=require(_0x9e16('0x1'));var moment=require('moment');var BPromise=require(_0x9e16('0x2'));var rs=require(_0x9e16('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e16('0x4'))['db'];var utils=require(_0x9e16('0x5'));var logger=require(_0x9e16('0x6'))(_0x9e16('0x7'));var config=require(_0x9e16('0x8'));var jayson=require(_0x9e16('0x9'));var client=jayson[_0x9e16('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5789df,_0x26c0bf,_0x11db8d){return new BPromise(function(_0x20d498,_0xe8c0df){return client[_0x9e16('0xb')](_0x5789df,_0x11db8d)['then'](function(_0x1b794b){logger[_0x9e16('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x26c0bf,'request\x20sent');logger['debug'](_0x9e16('0xd'),_0x26c0bf,'request\x20sent',JSON['stringify'](_0x1b794b));if(_0x1b794b[_0x9e16('0xe')]){if(_0x1b794b[_0x9e16('0xe')]['code']===0x1f4){logger[_0x9e16('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x26c0bf,_0x1b794b[_0x9e16('0xe')]['message']);return _0xe8c0df(_0x1b794b[_0x9e16('0xe')][_0x9e16('0xf')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x26c0bf,_0x1b794b[_0x9e16('0xe')]['message']);return _0x20d498(_0x1b794b[_0x9e16('0xe')]['message']);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x26c0bf,_0x9e16('0x10'));_0x20d498(_0x1b794b[_0x9e16('0x11')]['message']);}})[_0x9e16('0x12')](function(_0x5bae62){logger[_0x9e16('0xe')](_0x9e16('0x13'),_0x26c0bf,_0x5bae62);_0xe8c0df(_0x5bae62);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5c33089..efbfd08 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 _0x9d4d=['post','/:id/sounds','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','getSounds','create'];(function(_0x373827,_0x32efc8){var _0x30deee=function(_0x8abffd){while(--_0x8abffd){_0x373827['push'](_0x373827['shift']());}};_0x30deee(++_0x32efc8);}(_0x9d4d,0x14b));var _0xd9d4=function(_0x5d3805,_0x4e0ec5){_0x5d3805=_0x5d3805-0x0;var _0xeff499=_0x9d4d[_0x5d3805];return _0xeff499;};'use strict';var multer=require(_0xd9d4('0x0'));var util=require(_0xd9d4('0x1'));var path=require('path');var timeout=require(_0xd9d4('0x2'));var express=require(_0xd9d4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd9d4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd9d4('0x5'));var controller=require(_0xd9d4('0x6'));router[_0xd9d4('0x7')]('/',auth['isAuthenticated'](),controller[_0xd9d4('0x8')]);router[_0xd9d4('0x7')](_0xd9d4('0x9'),auth[_0xd9d4('0xa')](),controller[_0xd9d4('0xb')]);router[_0xd9d4('0x7')]('/:id/sounds',auth[_0xd9d4('0xa')](),controller[_0xd9d4('0xc')]);router['post']('/',auth[_0xd9d4('0xa')](),controller[_0xd9d4('0xd')]);router[_0xd9d4('0xe')](_0xd9d4('0xf'),auth[_0xd9d4('0xa')](),controller['addSound']);router[_0xd9d4('0x10')](_0xd9d4('0x9'),auth[_0xd9d4('0xa')](),controller[_0xd9d4('0x11')]);router[_0xd9d4('0x12')](_0xd9d4('0x9'),auth[_0xd9d4('0xa')](),controller[_0xd9d4('0x13')]);router['delete'](_0xd9d4('0x14'),auth[_0xd9d4('0xa')](),controller[_0xd9d4('0x15')]);module[_0xd9d4('0x16')]=router; \ No newline at end of file +var _0xb7bf=['delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','getSounds','post','create','/:id/sounds','addSound','put','update'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0xb7bf,0x131));var _0xfb7b=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xb7bf[_0x288f5e];return _0x476cc9;};'use strict';var multer=require(_0xfb7b('0x0'));var util=require(_0xfb7b('0x1'));var path=require(_0xfb7b('0x2'));var timeout=require(_0xfb7b('0x3'));var express=require(_0xfb7b('0x4'));var router=express[_0xfb7b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb7b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb7b('0x7'));var controller=require(_0xfb7b('0x8'));router[_0xfb7b('0x9')]('/',auth[_0xfb7b('0xa')](),controller[_0xfb7b('0xb')]);router[_0xfb7b('0x9')](_0xfb7b('0xc'),auth[_0xfb7b('0xa')](),controller['show']);router[_0xfb7b('0x9')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xfb7b('0xd')]);router[_0xfb7b('0xe')]('/',auth['isAuthenticated'](),controller[_0xfb7b('0xf')]);router[_0xfb7b('0xe')](_0xfb7b('0x10'),auth[_0xfb7b('0xa')](),controller[_0xfb7b('0x11')]);router[_0xfb7b('0x12')](_0xfb7b('0xc'),auth[_0xfb7b('0xa')](),controller[_0xfb7b('0x13')]);router[_0xfb7b('0x14')]('/:id',auth[_0xfb7b('0xa')](),controller[_0xfb7b('0x15')]);router[_0xfb7b('0x14')](_0xfb7b('0x16'),auth[_0xfb7b('0xa')](),controller[_0xfb7b('0x17')]);module[_0xfb7b('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 1136f60..855ea2c 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 _0x379c=['custom','mp3nb','quietmp3nb','files','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM'];(function(_0x3da385,_0x4def34){var _0x465e46=function(_0x4730cf){while(--_0x4730cf){_0x3da385['push'](_0x3da385['shift']());}};_0x465e46(++_0x4def34);}(_0x379c,0xb6));var _0xc379=function(_0x49ecae,_0x4a3d84){_0x49ecae=_0x49ecae-0x0;var _0x4f9644=_0x379c[_0x49ecae];return _0x4f9644;};'use strict';var Sequelize=require(_0xc379('0x0'));module[_0xc379('0x1')]={'name':{'type':Sequelize[_0xc379('0x2')],'allowNull':![],'unique':_0xc379('0x3')},'mode':{'type':Sequelize[_0xc379('0x4')](_0xc379('0x5'),'files',_0xc379('0x6'),_0xc379('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0xc379('0x8')},'directory':{'type':Sequelize[_0xc379('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xc379('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc379('0x2')],'allowNull':!![],'defaultValue':_0xc379('0x9')},'format':{'type':Sequelize[_0xc379('0x2')],'allowNull':!![]},'stamp':{'type':_0xc379('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa385=['quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa385,0x94));var _0x5a38=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xa385[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0x5a38('0x0'));module[_0x5a38('0x1')]={'name':{'type':Sequelize[_0x5a38('0x2')],'allowNull':![],'unique':_0x5a38('0x3')},'mode':{'type':Sequelize[_0x5a38('0x4')](_0x5a38('0x5'),_0x5a38('0x6'),_0x5a38('0x7'),_0x5a38('0x8'),_0x5a38('0x9'),_0x5a38('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x5a38('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5a38('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5a38('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5a38('0xb')},'format':{'type':Sequelize[_0x5a38('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x5a38('0xc')],'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 a701f71..b55a96d 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 _0x582a=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','mode','files','directory','join','root','server/files/moh','0777','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','converted_format','symlinkSync','Sequelize','findOne','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce'];(function(_0x167715,_0x4575df){var _0x2e9da2=function(_0x3e9fe0){while(--_0x3e9fe0){_0x167715['push'](_0x167715['shift']());}};_0x2e9da2(++_0x4575df);}(_0x582a,0xdd));var _0xa582=function(_0x5a8981,_0x12fe84){_0x5a8981=_0x5a8981-0x0;var _0x4a3592=_0x582a[_0x5a8981];return _0x4a3592;};'use strict';var emlformat=require(_0xa582('0x0'));var rimraf=require(_0xa582('0x1'));var zipdir=require(_0xa582('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa582('0x3'));var moment=require(_0xa582('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa582('0x5'));var util=require(_0xa582('0x6'));var path=require(_0xa582('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa582('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa582('0x9'));var squel=require(_0xa582('0xa'));var crypto=require(_0xa582('0xb'));var jsforce=require(_0xa582('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa582('0xd'));var querystring=require(_0xa582('0xe'));var Papa=require(_0xa582('0xf'));var Redis=require(_0xa582('0x10'));var authService=require(_0xa582('0x11'));var qs=require(_0xa582('0x12'));var as=require(_0xa582('0x13'));var hardwareService=require(_0xa582('0x14'));var logger=require(_0xa582('0x15'))(_0xa582('0x16'));var utils=require(_0xa582('0x17'));var config=require(_0xa582('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa582('0x19'))['db'];function respondWithStatusCode(_0x1b76d3,_0x31f6c4){_0x31f6c4=_0x31f6c4||0xcc;return function(_0x1a28d9){if(_0x1a28d9){return _0x1b76d3['sendStatus'](_0x31f6c4);}return _0x1b76d3[_0xa582('0x1a')](_0x31f6c4)[_0xa582('0x1b')]();};}function respondWithResult(_0x2c296f,_0x5a0363){_0x5a0363=_0x5a0363||0xc8;return function(_0x3c5930){if(_0x3c5930){return _0x2c296f['status'](_0x5a0363)[_0xa582('0x1c')](_0x3c5930);}};}function respondWithFilteredResult(_0x32484c,_0x499b03){return function(_0x5b5c28){if(_0x5b5c28){var _0x17815a=typeof _0x499b03['offset']==='undefined'&&typeof _0x499b03['limit']===_0xa582('0x1d');var _0xbb771e=_0x5b5c28[_0xa582('0x1e')];var _0x4f1e9b=_0x17815a?0x0:_0x499b03['offset'];var _0x266541=_0x17815a?_0x5b5c28[_0xa582('0x1e')]:_0x499b03['offset']+_0x499b03[_0xa582('0x1f')];var _0x2ba891;if(_0x266541>=_0xbb771e){_0x266541=_0xbb771e;_0x2ba891=0xc8;}else{_0x2ba891=0xce;}_0x32484c[_0xa582('0x1a')](_0x2ba891);return _0x32484c[_0xa582('0x20')](_0xa582('0x21'),_0x4f1e9b+'-'+_0x266541+'/'+_0xbb771e)[_0xa582('0x1c')](_0x5b5c28);}return null;};}function patchUpdates(_0x35e30e){return function(_0x13c150){try{jsonpatch[_0xa582('0x22')](_0x13c150,_0x35e30e,!![]);}catch(_0x3ab2a7){return BPromise[_0xa582('0x23')](_0x3ab2a7);}return _0x13c150['save']();};}function saveUpdates(_0x304514,_0x285bfd){return function(_0x42c48b){if(_0x42c48b){return _0x42c48b[_0xa582('0x24')](_0x304514)[_0xa582('0x25')](function(_0x201845){return _0x201845;});}return null;};}function removeEntity(_0x28a950,_0x148277){return function(_0x5f577a){if(_0x5f577a){return _0x5f577a[_0xa582('0x26')]()[_0xa582('0x25')](function(){var _0x163a4c=_0x5f577a[_0xa582('0x27')]({'plain':!![]});var _0x43d86c=_0xa582('0x28');return db[_0xa582('0x29')]['destroy']({'where':{'type':_0x43d86c,'resourceId':_0x163a4c['id']}})[_0xa582('0x25')](function(){return _0x5f577a;});})[_0xa582('0x25')](function(){_0x28a950['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30e075,_0x13bb50){return function(_0x315171){if(!_0x315171){_0x30e075[_0xa582('0x2a')](0x194);}return _0x315171;};}function handleError(_0x30db2f,_0x34ca86){_0x34ca86=_0x34ca86||0x1f4;return function(_0x346dbc){logger['error'](_0x346dbc[_0xa582('0x2b')]);if(_0x346dbc[_0xa582('0x2c')]){delete _0x346dbc[_0xa582('0x2c')];}_0x30db2f[_0xa582('0x1a')](_0x34ca86)[_0xa582('0x2d')](_0x346dbc);};}exports[_0xa582('0x2e')]=function(_0x15179d,_0x165a39){var _0x306cf7={},_0x1fcfca={},_0x22e032={'count':0x0,'rows':[]};var _0x1ef7bd=_[_0xa582('0x2f')](db[_0xa582('0x30')][_0xa582('0x31')],function(_0x3a753f){return{'name':_0x3a753f['fieldName'],'type':_0x3a753f[_0xa582('0x32')][_0xa582('0x33')]};});_0x1fcfca[_0xa582('0x34')]=_[_0xa582('0x2f')](_0x1ef7bd,_0xa582('0x2c'));_0x1fcfca[_0xa582('0x35')]=_['keys'](_0x15179d[_0xa582('0x35')]);_0x1fcfca['filters']=_[_0xa582('0x36')](_0x1fcfca[_0xa582('0x34')],_0x1fcfca[_0xa582('0x35')]);_0x306cf7['attributes']=_[_0xa582('0x36')](_0x1fcfca[_0xa582('0x34')],qs[_0xa582('0x37')](_0x15179d[_0xa582('0x35')][_0xa582('0x37')]));_0x306cf7[_0xa582('0x38')]=_0x306cf7[_0xa582('0x38')][_0xa582('0x39')]?_0x306cf7[_0xa582('0x38')]:_0x1fcfca[_0xa582('0x34')];if(!_0x15179d[_0xa582('0x35')][_0xa582('0x3a')](_0xa582('0x3b'))){_0x306cf7['limit']=qs['limit'](_0x15179d['query'][_0xa582('0x1f')]);_0x306cf7['offset']=qs[_0xa582('0x3c')](_0x15179d[_0xa582('0x35')][_0xa582('0x3c')]);}_0x306cf7[_0xa582('0x3d')]=qs['sort'](_0x15179d[_0xa582('0x35')][_0xa582('0x3e')]);delete _0x15179d['query'][_0xa582('0x3e')];_0x306cf7[_0xa582('0x3f')]=qs[_0xa582('0x40')](_[_0xa582('0x41')](_0x15179d[_0xa582('0x35')],_0x1fcfca[_0xa582('0x40')]),_0x1ef7bd);if(_0x15179d[_0xa582('0x35')][_0xa582('0x42')]){_0x306cf7[_0xa582('0x3f')]=_[_0xa582('0x43')](_0x306cf7[_0xa582('0x3f')],{'$or':_[_0xa582('0x2f')](_0x1ef7bd,function(_0x31f2fe){if(_0x31f2fe[_0xa582('0x32')]!==_0xa582('0x44')){var _0x24ae0b={};_0x24ae0b[_0x31f2fe[_0xa582('0x2c')]]={'$like':'%'+_0x15179d[_0xa582('0x35')][_0xa582('0x42')]+'%'};return _0x24ae0b;}})});}_0x306cf7=_[_0xa582('0x43')]({},_0x306cf7,_0x15179d[_0xa582('0x45')]);var _0x20d2fc={'where':_0x306cf7[_0xa582('0x3f')]};return db[_0xa582('0x30')][_0xa582('0x1e')](_0x20d2fc)[_0xa582('0x25')](function(_0x2a0c2b){_0x22e032['count']=_0x2a0c2b;if(_0x15179d[_0xa582('0x35')][_0xa582('0x46')]){_0x306cf7[_0xa582('0x47')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xa582('0x48')](_0x306cf7);})[_0xa582('0x25')](function(_0x294844){_0x22e032[_0xa582('0x49')]=_0x294844;return _0x22e032;})['then'](respondWithFilteredResult(_0x165a39,_0x306cf7))[_0xa582('0x4a')](handleError(_0x165a39,null));};exports[_0xa582('0x4b')]=function(_0xfffecb,_0x28def5){var _0x3fdf38={'raw':![],'where':{'id':_0xfffecb[_0xa582('0x4c')]['id']}},_0x35d30c={};_0x35d30c[_0xa582('0x34')]=_[_0xa582('0x4d')](db[_0xa582('0x30')][_0xa582('0x31')]);_0x35d30c[_0xa582('0x35')]=_[_0xa582('0x4d')](_0xfffecb['query']);_0x35d30c[_0xa582('0x40')]=_[_0xa582('0x36')](_0x35d30c[_0xa582('0x34')],_0x35d30c[_0xa582('0x35')]);_0x3fdf38[_0xa582('0x38')]=_[_0xa582('0x36')](_0x35d30c[_0xa582('0x34')],qs[_0xa582('0x37')](_0xfffecb[_0xa582('0x35')][_0xa582('0x37')]));_0x3fdf38[_0xa582('0x38')]=_0x3fdf38[_0xa582('0x38')]['length']?_0x3fdf38['attributes']:_0x35d30c[_0xa582('0x34')];if(_0xfffecb['query']['includeAll']){_0x3fdf38[_0xa582('0x47')]=[{'all':!![]}];}_0x3fdf38=_[_0xa582('0x43')]({},_0x3fdf38,_0xfffecb[_0xa582('0x45')]);return db['VoiceMusicOnHold'][_0xa582('0x4e')](_0x3fdf38)[_0xa582('0x25')](handleEntityNotFound(_0x28def5,null))[_0xa582('0x25')](respondWithResult(_0x28def5,null))[_0xa582('0x4a')](handleError(_0x28def5,null));};exports[_0xa582('0x24')]=function(_0x330d5e,_0x1a0b68){if(_0x330d5e[_0xa582('0x4f')]['id']){delete _0x330d5e[_0xa582('0x4f')]['id'];}return db[_0xa582('0x30')]['find']({'where':{'id':_0x330d5e[_0xa582('0x4c')]['id']}})[_0xa582('0x25')](handleEntityNotFound(_0x1a0b68,null))[_0xa582('0x25')](saveUpdates(_0x330d5e[_0xa582('0x4f')],null))['then'](respondWithResult(_0x1a0b68,null))[_0xa582('0x4a')](handleError(_0x1a0b68,null));};exports[_0xa582('0x50')]=function(_0x5f28bb,_0x4d689c,_0x5112cd){return db['sequelize']['transaction'](function(_0x26d910){if(_0x5f28bb[_0xa582('0x4f')][_0xa582('0x51')]===_0xa582('0x52')){_0x5f28bb['body'][_0xa582('0x53')]=path[_0xa582('0x54')](config[_0xa582('0x55')],_0xa582('0x56'),_0x5f28bb[_0xa582('0x4f')][_0xa582('0x2c')]);}return db[_0xa582('0x30')][_0xa582('0x50')](_0x5f28bb[_0xa582('0x4f')],{'transaction':_0x26d910})['then'](function(_0x36043f){if(_0x5f28bb[_0xa582('0x4f')][_0xa582('0x51')]===_0xa582('0x52')){fs['mkdirSync'](_0x36043f['directory'],parseInt(_0xa582('0x57'),0x8));}var _0x102d3d=_0x5f28bb[_0xa582('0x58')][_0xa582('0x27')]({'plain':!![]});if(!_0x102d3d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x102d3d['role']===_0xa582('0x58')){var _0x5be0ac=_0x36043f[_0xa582('0x27')]({'plain':!![]});return db[_0xa582('0x59')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x102d3d[_0xa582('0x5a')]},'raw':!![]})['then'](function(_0x4f3b85){if(_0x4f3b85&&_0x4f3b85[_0xa582('0x5b')]===0x0){return db['UserProfileResource'][_0xa582('0x50')]({'name':_0x5be0ac[_0xa582('0x2c')],'resourceId':_0x5be0ac['id'],'type':_0x4f3b85['name'],'sectionId':_0x4f3b85['id']},{})[_0xa582('0x25')](function(){return _0x36043f;});}else{return _0x36043f;}})[_0xa582('0x4a')](function(_0x8f619f){logger[_0xa582('0x5c')](_0xa582('0x5d'),_0x8f619f);});}return _0x36043f;});})[_0xa582('0x25')](respondWithResult(_0x4d689c,0xc9))[_0xa582('0x4a')](handleError(_0x4d689c,null));};exports[_0xa582('0x26')]=function(_0x439592,_0x419e8b,_0x1922d6){var _0xadcdfa;return db[_0xa582('0x30')][_0xa582('0x4e')]({'where':{'id':_0x439592['params']['id']}})[_0xa582('0x25')](function(_0x3f7474){if(_0x3f7474){return db[_0xa582('0x5e')][_0xa582('0x5f')](function(_0x10a53e){return _0x3f7474['destroy']({'transaction':_0x10a53e,'raw':!![]})[_0xa582('0x25')](function(_0x42cd30){if(_0x42cd30['directory']){fs['readdirSync'](_0x42cd30['directory'])[_0xa582('0x60')](function(_0x4e3fe4){fs[_0xa582('0x61')](path['join'](_0x42cd30[_0xa582('0x53')],_0x4e3fe4));});fs[_0xa582('0x62')](_0x42cd30[_0xa582('0x53')]);}return _0x42cd30;});})[_0xa582('0x4a')](function(_0x1e34e0){throw new db['Sequelize'][(_0xa582('0x63'))](_0x1e34e0[_0xa582('0x64')]);});}})['then'](handleEntityNotFound(_0x419e8b,null))[_0xa582('0x25')](removeEntity(_0x419e8b,null))[_0xa582('0x4a')](handleError(_0x419e8b,null));};exports[_0xa582('0x65')]=function(_0x5647d7,_0x1a768d,_0x2a903b){return db['sequelize'][_0xa582('0x5f')](function(_0x2177b6){var _0x542025;return db['VoiceMusicOnHold'][_0xa582('0x4e')]({'where':{'id':_0x5647d7[_0xa582('0x4c')]['id']}})[_0xa582('0x25')](function(_0xfa86ab){if(_0xfa86ab){_0x542025=_0xfa86ab;return _0xfa86ab[_0xa582('0x65')](_0x5647d7[_0xa582('0x4f')]['id'],{'transaction':_0x2177b6});}})[_0xa582('0x25')](function(_0x33f0d4){if(_0x33f0d4){return db[_0xa582('0x66')]['findOne']({'where':{'id':_0x5647d7[_0xa582('0x4f')]['id']},'attributes':['id',_0xa582('0x2c'),'save_name','converted_format',_0xa582('0x67')],'raw':!![]});}})[_0xa582('0x25')](function(_0x29a86e){if(_0x29a86e){var _0x588d62=path['join'](config[_0xa582('0x55')],_0xa582('0x68'),util[_0xa582('0x69')](_0xa582('0x6a'),path[_0xa582('0x6b')](_0x29a86e[_0xa582('0x6c')],path[_0xa582('0x6d')](_0x29a86e[_0xa582('0x6c')])),_0x29a86e['converted_format']));var _0x354c5a=path['join'](config[_0xa582('0x55')],_0xa582('0x56'),_0x542025['name'],util[_0xa582('0x69')](_0xa582('0x6a'),_0x29a86e[_0xa582('0x2c')],_0x29a86e[_0xa582('0x6e')]));fs[_0xa582('0x6f')](_0x588d62,_0x354c5a);return _0x29a86e;}})[_0xa582('0x4a')](function(_0x378ea5){throw new db[(_0xa582('0x70'))]['ValidationError'](_0x378ea5[_0xa582('0x64')]);});})[_0xa582('0x25')](handleEntityNotFound(_0x1a768d,null))[_0xa582('0x25')](respondWithResult(_0x1a768d,0xc9))[_0xa582('0x4a')](handleError(_0x1a768d,null));};exports['removeSound']=function(_0x39764d,_0x22d827,_0x3658da){return db['sequelize'][_0xa582('0x5f')](function(_0x29b990){var _0x1fd686;return db[_0xa582('0x30')][_0xa582('0x71')]({'where':{'id':_0x39764d['params']['id']}})[_0xa582('0x25')](handleEntityNotFound(_0x22d827,null))['then'](function(_0x34a316){if(_0x34a316){_0x1fd686=_0x34a316;return _0x34a316[_0xa582('0x72')](_0x39764d[_0xa582('0x4c')][_0xa582('0x73')]);}})['then'](function(_0x418f99){if(_0x418f99){return db[_0xa582('0x66')][_0xa582('0x71')]({'where':{'id':_0x39764d[_0xa582('0x4c')][_0xa582('0x73')]},'attributes':['id',_0xa582('0x2c'),_0xa582('0x6c'),_0xa582('0x6e'),'createdAt'],'raw':!![]});}})[_0xa582('0x25')](function(_0x334163){if(_0x334163){fs[_0xa582('0x61')](path[_0xa582('0x54')](_0x1fd686['directory'],util[_0xa582('0x69')]('%s.%s',_0x334163[_0xa582('0x2c')],_0x334163[_0xa582('0x6e')])));return _0x334163;}})[_0xa582('0x4a')](function(_0x12e47f){throw new db[(_0xa582('0x70'))]['ValidationError'](_0x12e47f['message']);});})['then'](handleEntityNotFound(_0x22d827,null))[_0xa582('0x25')](respondWithStatusCode(_0x22d827,0xcc))[_0xa582('0x4a')](handleError(_0x22d827,null));};exports[_0xa582('0x74')]=function(_0x5d68ea,_0x219d64,_0x1099d3){var _0x584cee={};var _0x36158a={};var _0x35e99f;var _0x5333fd;return db[_0xa582('0x30')][_0xa582('0x71')]({'where':{'id':_0x5d68ea[_0xa582('0x4c')]['id']}})[_0xa582('0x25')](handleEntityNotFound(_0x219d64,null))[_0xa582('0x25')](function(_0x135531){if(_0x135531){_0x35e99f=_0x135531;_0x36158a[_0xa582('0x34')]=_[_0xa582('0x4d')](db[_0xa582('0x66')][_0xa582('0x31')]);_0x36158a[_0xa582('0x35')]=_['keys'](_0x5d68ea[_0xa582('0x35')]);_0x36158a['filters']=_[_0xa582('0x36')](_0x36158a[_0xa582('0x34')],_0x36158a[_0xa582('0x35')]);_0x584cee[_0xa582('0x38')]=_['intersection'](_0x36158a['model'],qs[_0xa582('0x37')](_0x5d68ea[_0xa582('0x35')][_0xa582('0x37')]));_0x584cee['attributes']=_0x584cee[_0xa582('0x38')][_0xa582('0x39')]?_0x584cee['attributes']:_0x36158a[_0xa582('0x34')];_0x584cee['order']=qs[_0xa582('0x3e')](_0x5d68ea['query'][_0xa582('0x3e')]);_0x584cee[_0xa582('0x3f')]=qs[_0xa582('0x40')](_['pick'](_0x5d68ea['query'],_0x36158a['filters']));if(_0x5d68ea[_0xa582('0x35')][_0xa582('0x42')]){_0x584cee[_0xa582('0x3f')]=_[_0xa582('0x43')](_0x584cee[_0xa582('0x3f')],{'$or':_[_0xa582('0x2f')](_0x584cee[_0xa582('0x38')],function(_0x4579e5){var _0x543e95={};_0x543e95[_0x4579e5]={'$like':'%'+_0x5d68ea[_0xa582('0x35')][_0xa582('0x42')]+'%'};return _0x543e95;})});}_0x584cee=_[_0xa582('0x43')]({},_0x584cee,_0x5d68ea[_0xa582('0x45')]);return _0x35e99f[_0xa582('0x74')](_0x584cee);}})[_0xa582('0x25')](function(_0x39225d){if(_0x39225d){_0x5333fd=_0x39225d['length'];if(!_0x5d68ea[_0xa582('0x35')]['hasOwnProperty'](_0xa582('0x3b'))){_0x584cee[_0xa582('0x1f')]=qs[_0xa582('0x1f')](_0x5d68ea[_0xa582('0x35')]['limit']);_0x584cee[_0xa582('0x3c')]=qs[_0xa582('0x3c')](_0x5d68ea[_0xa582('0x35')][_0xa582('0x3c')]);}return _0x35e99f[_0xa582('0x74')](_0x584cee);}})['then'](function(_0x187705){if(_0x187705){return _0x187705?{'count':_0x5333fd,'rows':_0x187705}:null;}})[_0xa582('0x25')](respondWithResult(_0x219d64,null))[_0xa582('0x4a')](handleError(_0x219d64,null));}; \ No newline at end of file +var _0xd6b5=['nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','params','options','find','body','create','sequelize','transaction','mode','directory','join','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','root','%s.%s','symlinkSync','removeSound','findOne','id2','unlinkSync','ValidationError','getSounds','length','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0xd6b5,0x103));var _0x5d6b=function(_0xd4b628,_0x1d653f){_0xd4b628=_0xd4b628-0x0;var _0x41b47f=_0xd6b5[_0xd4b628];return _0x41b47f;};'use strict';var emlformat=require(_0x5d6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d6b('0x1'));var jsonpatch=require(_0x5d6b('0x2'));var rp=require(_0x5d6b('0x3'));var moment=require(_0x5d6b('0x4'));var BPromise=require(_0x5d6b('0x5'));var Mustache=require(_0x5d6b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5d6b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d6b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5d6b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5d6b('0x7'));var querystring=require('querystring');var Papa=require(_0x5d6b('0xa'));var Redis=require('ioredis');var authService=require(_0x5d6b('0xb'));var qs=require(_0x5d6b('0xc'));var as=require(_0x5d6b('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5d6b('0xe'));var utils=require(_0x5d6b('0xf'));var config=require(_0x5d6b('0x10'));var licenseUtil=require(_0x5d6b('0x11'));var db=require(_0x5d6b('0x12'))['db'];function respondWithStatusCode(_0x5ec548,_0x1ba37f){_0x1ba37f=_0x1ba37f||0xcc;return function(_0x55331e){if(_0x55331e){return _0x5ec548[_0x5d6b('0x13')](_0x1ba37f);}return _0x5ec548['status'](_0x1ba37f)[_0x5d6b('0x14')]();};}function respondWithResult(_0x1a7725,_0x27c6e8){_0x27c6e8=_0x27c6e8||0xc8;return function(_0xe1e057){if(_0xe1e057){return _0x1a7725['status'](_0x27c6e8)[_0x5d6b('0x15')](_0xe1e057);}};}function respondWithFilteredResult(_0x473d81,_0x3f5ad1){return function(_0x406726){if(_0x406726){var _0x28069c=typeof _0x3f5ad1[_0x5d6b('0x16')]===_0x5d6b('0x17')&&typeof _0x3f5ad1[_0x5d6b('0x18')]===_0x5d6b('0x17');var _0x380595=_0x406726[_0x5d6b('0x19')];var _0x4798f5=_0x28069c?0x0:_0x3f5ad1[_0x5d6b('0x16')];var _0x477479=_0x28069c?_0x406726['count']:_0x3f5ad1[_0x5d6b('0x16')]+_0x3f5ad1[_0x5d6b('0x18')];var _0x341930;if(_0x477479>=_0x380595){_0x477479=_0x380595;_0x341930=0xc8;}else{_0x341930=0xce;}_0x473d81[_0x5d6b('0x1a')](_0x341930);return _0x473d81[_0x5d6b('0x1b')](_0x5d6b('0x1c'),_0x4798f5+'-'+_0x477479+'/'+_0x380595)[_0x5d6b('0x15')](_0x406726);}return null;};}function patchUpdates(_0x3955c4){return function(_0x144d3c){try{jsonpatch['apply'](_0x144d3c,_0x3955c4,!![]);}catch(_0x5af19d){return BPromise[_0x5d6b('0x1d')](_0x5af19d);}return _0x144d3c[_0x5d6b('0x1e')]();};}function saveUpdates(_0x5d9986,_0x3b98ff){return function(_0x3f42b8){if(_0x3f42b8){return _0x3f42b8[_0x5d6b('0x1f')](_0x5d9986)['then'](function(_0x236af8){return _0x236af8;});}return null;};}function removeEntity(_0x24d352,_0x5a94eb){return function(_0x7202b8){if(_0x7202b8){return _0x7202b8[_0x5d6b('0x20')]()[_0x5d6b('0x21')](function(){var _0x4388dd=_0x7202b8[_0x5d6b('0x22')]({'plain':!![]});var _0x4cbaea=_0x5d6b('0x23');return db[_0x5d6b('0x24')][_0x5d6b('0x20')]({'where':{'type':_0x4cbaea,'resourceId':_0x4388dd['id']}})[_0x5d6b('0x21')](function(){return _0x7202b8;});})[_0x5d6b('0x21')](function(){_0x24d352['status'](0xcc)[_0x5d6b('0x14')]();});}};}function handleEntityNotFound(_0xf18915,_0x79fd86){return function(_0x508ca5){if(!_0x508ca5){_0xf18915[_0x5d6b('0x13')](0x194);}return _0x508ca5;};}function handleError(_0x4520fc,_0x448e89){_0x448e89=_0x448e89||0x1f4;return function(_0x49f0f9){logger['error'](_0x49f0f9[_0x5d6b('0x25')]);if(_0x49f0f9[_0x5d6b('0x26')]){delete _0x49f0f9[_0x5d6b('0x26')];}_0x4520fc[_0x5d6b('0x1a')](_0x448e89)[_0x5d6b('0x27')](_0x49f0f9);};}exports['index']=function(_0x27805d,_0x479971){var _0x9973df={},_0x280144={},_0x21156d={'count':0x0,'rows':[]};var _0x43441a=_[_0x5d6b('0x28')](db[_0x5d6b('0x29')][_0x5d6b('0x2a')],function(_0x17ea8e){return{'name':_0x17ea8e[_0x5d6b('0x2b')],'type':_0x17ea8e[_0x5d6b('0x2c')][_0x5d6b('0x2d')]};});_0x280144[_0x5d6b('0x2e')]=_[_0x5d6b('0x28')](_0x43441a,'name');_0x280144['query']=_[_0x5d6b('0x2f')](_0x27805d[_0x5d6b('0x30')]);_0x280144[_0x5d6b('0x31')]=_[_0x5d6b('0x32')](_0x280144[_0x5d6b('0x2e')],_0x280144[_0x5d6b('0x30')]);_0x9973df['attributes']=_[_0x5d6b('0x32')](_0x280144[_0x5d6b('0x2e')],qs['fields'](_0x27805d['query'][_0x5d6b('0x33')]));_0x9973df['attributes']=_0x9973df[_0x5d6b('0x34')]['length']?_0x9973df[_0x5d6b('0x34')]:_0x280144[_0x5d6b('0x2e')];if(!_0x27805d[_0x5d6b('0x30')]['hasOwnProperty'](_0x5d6b('0x35'))){_0x9973df[_0x5d6b('0x18')]=qs[_0x5d6b('0x18')](_0x27805d[_0x5d6b('0x30')]['limit']);_0x9973df[_0x5d6b('0x16')]=qs[_0x5d6b('0x16')](_0x27805d[_0x5d6b('0x30')][_0x5d6b('0x16')]);}_0x9973df[_0x5d6b('0x36')]=qs[_0x5d6b('0x37')](_0x27805d['query']['sort']);delete _0x27805d[_0x5d6b('0x30')]['sort'];_0x9973df[_0x5d6b('0x38')]=qs[_0x5d6b('0x31')](_[_0x5d6b('0x39')](_0x27805d[_0x5d6b('0x30')],_0x280144[_0x5d6b('0x31')]),_0x43441a);if(_0x27805d['query'][_0x5d6b('0x3a')]){_0x9973df[_0x5d6b('0x38')]=_[_0x5d6b('0x3b')](_0x9973df[_0x5d6b('0x38')],{'$or':_[_0x5d6b('0x28')](_0x43441a,function(_0x8b37f7){if(_0x8b37f7[_0x5d6b('0x2c')]!=='VIRTUAL'){var _0x9911f8={};_0x9911f8[_0x8b37f7[_0x5d6b('0x26')]]={'$like':'%'+_0x27805d['query']['filter']+'%'};return _0x9911f8;}})});}_0x9973df=_[_0x5d6b('0x3b')]({},_0x9973df,_0x27805d['options']);var _0x533d59={'where':_0x9973df['where']};return db[_0x5d6b('0x29')][_0x5d6b('0x19')](_0x533d59)['then'](function(_0x1db4d9){_0x21156d[_0x5d6b('0x19')]=_0x1db4d9;if(_0x27805d['query'][_0x5d6b('0x3c')]){_0x9973df['include']=[{'all':!![]}];}return db[_0x5d6b('0x29')][_0x5d6b('0x3d')](_0x9973df);})['then'](function(_0x19e016){_0x21156d[_0x5d6b('0x3e')]=_0x19e016;return _0x21156d;})[_0x5d6b('0x21')](respondWithFilteredResult(_0x479971,_0x9973df))[_0x5d6b('0x3f')](handleError(_0x479971,null));};exports['show']=function(_0x4b5e2f,_0x5d3d3a){var _0x1f8089={'raw':![],'where':{'id':_0x4b5e2f[_0x5d6b('0x40')]['id']}},_0x269918={};_0x269918[_0x5d6b('0x2e')]=_[_0x5d6b('0x2f')](db['VoiceMusicOnHold']['rawAttributes']);_0x269918[_0x5d6b('0x30')]=_[_0x5d6b('0x2f')](_0x4b5e2f[_0x5d6b('0x30')]);_0x269918[_0x5d6b('0x31')]=_['intersection'](_0x269918[_0x5d6b('0x2e')],_0x269918['query']);_0x1f8089[_0x5d6b('0x34')]=_['intersection'](_0x269918[_0x5d6b('0x2e')],qs['fields'](_0x4b5e2f[_0x5d6b('0x30')]['fields']));_0x1f8089[_0x5d6b('0x34')]=_0x1f8089[_0x5d6b('0x34')]['length']?_0x1f8089[_0x5d6b('0x34')]:_0x269918[_0x5d6b('0x2e')];if(_0x4b5e2f[_0x5d6b('0x30')][_0x5d6b('0x3c')]){_0x1f8089['include']=[{'all':!![]}];}_0x1f8089=_['merge']({},_0x1f8089,_0x4b5e2f[_0x5d6b('0x41')]);return db[_0x5d6b('0x29')][_0x5d6b('0x42')](_0x1f8089)[_0x5d6b('0x21')](handleEntityNotFound(_0x5d3d3a,null))[_0x5d6b('0x21')](respondWithResult(_0x5d3d3a,null))['catch'](handleError(_0x5d3d3a,null));};exports[_0x5d6b('0x1f')]=function(_0x19c7ab,_0x45d3db){if(_0x19c7ab[_0x5d6b('0x43')]['id']){delete _0x19c7ab[_0x5d6b('0x43')]['id'];}return db[_0x5d6b('0x29')][_0x5d6b('0x42')]({'where':{'id':_0x19c7ab[_0x5d6b('0x40')]['id']}})[_0x5d6b('0x21')](handleEntityNotFound(_0x45d3db,null))['then'](saveUpdates(_0x19c7ab[_0x5d6b('0x43')],null))[_0x5d6b('0x21')](respondWithResult(_0x45d3db,null))[_0x5d6b('0x3f')](handleError(_0x45d3db,null));};exports[_0x5d6b('0x44')]=function(_0x85232,_0x17d6d5,_0x51ac12){return db[_0x5d6b('0x45')][_0x5d6b('0x46')](function(_0xd6bfdb){if(_0x85232[_0x5d6b('0x43')][_0x5d6b('0x47')]==='files'){_0x85232[_0x5d6b('0x43')][_0x5d6b('0x48')]=path[_0x5d6b('0x49')](config['root'],_0x5d6b('0x4a'),_0x85232['body'][_0x5d6b('0x26')]);}return db['VoiceMusicOnHold'][_0x5d6b('0x44')](_0x85232['body'],{'transaction':_0xd6bfdb})[_0x5d6b('0x21')](function(_0x417a36){if(_0x85232[_0x5d6b('0x43')][_0x5d6b('0x47')]==='files'){fs[_0x5d6b('0x4b')](_0x417a36[_0x5d6b('0x48')],parseInt(_0x5d6b('0x4c'),0x8));}var _0x264bd9=_0x85232['user'][_0x5d6b('0x22')]({'plain':!![]});if(!_0x264bd9)throw new Error(_0x5d6b('0x4d'));if(_0x264bd9[_0x5d6b('0x4e')]==='user'){var _0x1b85f2=_0x417a36[_0x5d6b('0x22')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x264bd9['userProfileId']},'raw':!![]})[_0x5d6b('0x21')](function(_0x12a429){if(_0x12a429&&_0x12a429[_0x5d6b('0x4f')]===0x0){return db[_0x5d6b('0x24')][_0x5d6b('0x44')]({'name':_0x1b85f2[_0x5d6b('0x26')],'resourceId':_0x1b85f2['id'],'type':_0x12a429['name'],'sectionId':_0x12a429['id']},{})[_0x5d6b('0x21')](function(){return _0x417a36;});}else{return _0x417a36;}})[_0x5d6b('0x3f')](function(_0x47d4d0){logger[_0x5d6b('0x50')](_0x5d6b('0x51'),_0x47d4d0);});}return _0x417a36;});})[_0x5d6b('0x21')](respondWithResult(_0x17d6d5,0xc9))['catch'](handleError(_0x17d6d5,null));};exports[_0x5d6b('0x20')]=function(_0x4cb876,_0x252bcb,_0x245200){var _0x3f87fd;return db[_0x5d6b('0x29')][_0x5d6b('0x42')]({'where':{'id':_0x4cb876[_0x5d6b('0x40')]['id']}})[_0x5d6b('0x21')](function(_0x473c2e){if(_0x473c2e){return db[_0x5d6b('0x45')][_0x5d6b('0x46')](function(_0xf27758){return _0x473c2e['destroy']({'transaction':_0xf27758,'raw':!![]})[_0x5d6b('0x21')](function(_0x1b4d56){if(_0x1b4d56[_0x5d6b('0x48')]){fs[_0x5d6b('0x52')](_0x1b4d56[_0x5d6b('0x48')])[_0x5d6b('0x53')](function(_0x1e78bd){fs['unlinkSync'](path[_0x5d6b('0x49')](_0x1b4d56[_0x5d6b('0x48')],_0x1e78bd));});fs[_0x5d6b('0x54')](_0x1b4d56['directory']);}return _0x1b4d56;});})[_0x5d6b('0x3f')](function(_0x374a99){throw new db[(_0x5d6b('0x55'))]['ValidationError'](_0x374a99[_0x5d6b('0x56')]);});}})[_0x5d6b('0x21')](handleEntityNotFound(_0x252bcb,null))['then'](removeEntity(_0x252bcb,null))[_0x5d6b('0x3f')](handleError(_0x252bcb,null));};exports['addSound']=function(_0x3d3acb,_0x34e9c5,_0x1a722b){return db[_0x5d6b('0x45')][_0x5d6b('0x46')](function(_0x3d9e33){var _0x480d6a;return db['VoiceMusicOnHold'][_0x5d6b('0x42')]({'where':{'id':_0x3d3acb[_0x5d6b('0x40')]['id']}})[_0x5d6b('0x21')](function(_0x13e892){if(_0x13e892){_0x480d6a=_0x13e892;return _0x13e892[_0x5d6b('0x57')](_0x3d3acb[_0x5d6b('0x43')]['id'],{'transaction':_0x3d9e33});}})['then'](function(_0x196e9c){if(_0x196e9c){return db[_0x5d6b('0x58')]['findOne']({'where':{'id':_0x3d3acb[_0x5d6b('0x43')]['id']},'attributes':['id','name',_0x5d6b('0x59'),_0x5d6b('0x5a'),_0x5d6b('0x5b')],'raw':!![]});}})[_0x5d6b('0x21')](function(_0x54aab2){if(_0x54aab2){var _0x19d33a=path[_0x5d6b('0x49')](config['root'],_0x5d6b('0x5c'),util[_0x5d6b('0x5d')]('%s.%s',path['basename'](_0x54aab2[_0x5d6b('0x59')],path['extname'](_0x54aab2[_0x5d6b('0x59')])),_0x54aab2[_0x5d6b('0x5a')]));var _0x4f5db4=path['join'](config[_0x5d6b('0x5e')],_0x5d6b('0x4a'),_0x480d6a[_0x5d6b('0x26')],util[_0x5d6b('0x5d')](_0x5d6b('0x5f'),_0x54aab2[_0x5d6b('0x26')],_0x54aab2[_0x5d6b('0x5a')]));fs[_0x5d6b('0x60')](_0x19d33a,_0x4f5db4);return _0x54aab2;}})[_0x5d6b('0x3f')](function(_0x171e6c){throw new db[(_0x5d6b('0x55'))]['ValidationError'](_0x171e6c[_0x5d6b('0x56')]);});})['then'](handleEntityNotFound(_0x34e9c5,null))['then'](respondWithResult(_0x34e9c5,0xc9))[_0x5d6b('0x3f')](handleError(_0x34e9c5,null));};exports[_0x5d6b('0x61')]=function(_0x28bc25,_0xec4612,_0xaf949e){return db[_0x5d6b('0x45')]['transaction'](function(_0x41a109){var _0x4319cf;return db[_0x5d6b('0x29')][_0x5d6b('0x62')]({'where':{'id':_0x28bc25[_0x5d6b('0x40')]['id']}})['then'](handleEntityNotFound(_0xec4612,null))[_0x5d6b('0x21')](function(_0x408020){if(_0x408020){_0x4319cf=_0x408020;return _0x408020[_0x5d6b('0x61')](_0x28bc25[_0x5d6b('0x40')][_0x5d6b('0x63')]);}})[_0x5d6b('0x21')](function(_0x4bbff7){if(_0x4bbff7){return db[_0x5d6b('0x58')][_0x5d6b('0x62')]({'where':{'id':_0x28bc25[_0x5d6b('0x40')][_0x5d6b('0x63')]},'attributes':['id',_0x5d6b('0x26'),_0x5d6b('0x59'),_0x5d6b('0x5a'),_0x5d6b('0x5b')],'raw':!![]});}})['then'](function(_0x4421d1){if(_0x4421d1){fs[_0x5d6b('0x64')](path[_0x5d6b('0x49')](_0x4319cf[_0x5d6b('0x48')],util[_0x5d6b('0x5d')](_0x5d6b('0x5f'),_0x4421d1[_0x5d6b('0x26')],_0x4421d1[_0x5d6b('0x5a')])));return _0x4421d1;}})[_0x5d6b('0x3f')](function(_0x411520){throw new db[(_0x5d6b('0x55'))][(_0x5d6b('0x65'))](_0x411520[_0x5d6b('0x56')]);});})['then'](handleEntityNotFound(_0xec4612,null))[_0x5d6b('0x21')](respondWithStatusCode(_0xec4612,0xcc))[_0x5d6b('0x3f')](handleError(_0xec4612,null));};exports[_0x5d6b('0x66')]=function(_0xaa136f,_0x2b5831,_0x446bfa){var _0x4217ec={};var _0x37c755={};var _0x13c8bb;var _0x2aad66;return db[_0x5d6b('0x29')][_0x5d6b('0x62')]({'where':{'id':_0xaa136f['params']['id']}})['then'](handleEntityNotFound(_0x2b5831,null))['then'](function(_0x3d8a6c){if(_0x3d8a6c){_0x13c8bb=_0x3d8a6c;_0x37c755[_0x5d6b('0x2e')]=_['keys'](db[_0x5d6b('0x58')]['rawAttributes']);_0x37c755['query']=_[_0x5d6b('0x2f')](_0xaa136f['query']);_0x37c755['filters']=_['intersection'](_0x37c755[_0x5d6b('0x2e')],_0x37c755['query']);_0x4217ec[_0x5d6b('0x34')]=_['intersection'](_0x37c755[_0x5d6b('0x2e')],qs[_0x5d6b('0x33')](_0xaa136f[_0x5d6b('0x30')][_0x5d6b('0x33')]));_0x4217ec[_0x5d6b('0x34')]=_0x4217ec[_0x5d6b('0x34')][_0x5d6b('0x67')]?_0x4217ec[_0x5d6b('0x34')]:_0x37c755[_0x5d6b('0x2e')];_0x4217ec[_0x5d6b('0x36')]=qs[_0x5d6b('0x37')](_0xaa136f['query'][_0x5d6b('0x37')]);_0x4217ec['where']=qs['filters'](_['pick'](_0xaa136f[_0x5d6b('0x30')],_0x37c755[_0x5d6b('0x31')]));if(_0xaa136f[_0x5d6b('0x30')][_0x5d6b('0x3a')]){_0x4217ec[_0x5d6b('0x38')]=_[_0x5d6b('0x3b')](_0x4217ec[_0x5d6b('0x38')],{'$or':_['map'](_0x4217ec[_0x5d6b('0x34')],function(_0x4d1e7a){var _0x343801={};_0x343801[_0x4d1e7a]={'$like':'%'+_0xaa136f[_0x5d6b('0x30')]['filter']+'%'};return _0x343801;})});}_0x4217ec=_[_0x5d6b('0x3b')]({},_0x4217ec,_0xaa136f[_0x5d6b('0x41')]);return _0x13c8bb[_0x5d6b('0x66')](_0x4217ec);}})[_0x5d6b('0x21')](function(_0x25b358){if(_0x25b358){_0x2aad66=_0x25b358[_0x5d6b('0x67')];if(!_0xaa136f['query']['hasOwnProperty'](_0x5d6b('0x35'))){_0x4217ec[_0x5d6b('0x18')]=qs[_0x5d6b('0x18')](_0xaa136f[_0x5d6b('0x30')][_0x5d6b('0x18')]);_0x4217ec[_0x5d6b('0x16')]=qs[_0x5d6b('0x16')](_0xaa136f[_0x5d6b('0x30')][_0x5d6b('0x16')]);}return _0x13c8bb[_0x5d6b('0x66')](_0x4217ec);}})[_0x5d6b('0x21')](function(_0x544674){if(_0x544674){return _0x544674?{'count':_0x2aad66,'rows':_0x544674}:null;}})[_0x5d6b('0x21')](respondWithResult(_0x2b5831,null))[_0x5d6b('0x3f')](handleError(_0x2b5831,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2ae0a32..fe69566 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 _0xddec=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xddec,0x1ce));var _0xcdde=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xddec[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xcdde('0x0'));var util=require(_0xcdde('0x1'));var logger=require('../../config/logger')(_0xcdde('0x2'));var moment=require(_0xcdde('0x3'));var BPromise=require(_0xcdde('0x4'));var rp=require(_0xcdde('0x5'));var fs=require('fs');var path=require(_0xcdde('0x6'));var rimraf=require(_0xcdde('0x7'));var config=require(_0xcdde('0x8'));var attributes=require(_0xcdde('0x9'));module['exports']=function(_0x4cadc5,_0xad01d6){return _0x4cadc5[_0xcdde('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0xcdde('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','util','../../config/logger','api'];(function(_0x2c90c1,_0x446eda){var _0xcb55d4=function(_0x30e230){while(--_0x30e230){_0x2c90c1['push'](_0x2c90c1['shift']());}};_0xcb55d4(++_0x446eda);}(_0x777c,0x1c3));var _0xc777=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x777c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc777('0x0'));var util=require(_0xc777('0x1'));var logger=require(_0xc777('0x2'))(_0xc777('0x3'));var moment=require(_0xc777('0x4'));var BPromise=require(_0xc777('0x5'));var rp=require(_0xc777('0x6'));var fs=require('fs');var path=require(_0xc777('0x7'));var rimraf=require(_0xc777('0x8'));var config=require(_0xc777('0x9'));var attributes=require(_0xc777('0xa'));module[_0xc777('0xb')]=function(_0x4d9cb1,_0x28fa46){return _0x4d9cb1['define'](_0xc777('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index d64620f..4c6aa52 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x48c800,_0x50778e){var _0x5a7bbd=function(_0x3031ff){while(--_0x3031ff){_0x48c800['push'](_0x48c800['shift']());}};_0x5a7bbd(++_0x50778e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xcb91[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x4372c4,_0x501602){var _0x4b9b12=function(_0x15fdf5){while(--_0x15fdf5){_0x4372c4['push'](_0x4372c4['shift']());}};_0x4b9b12(++_0x501602);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xcb91[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b208eba..a64a9df 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 _0xc9b9=['path','connect-timeout','express','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','getAgents','/:id/teams','post','/:id/users','addTeams','delete','destroy','removeAgents','removeTeams','exports'];(function(_0x19420d,_0xbc4303){var _0x1de2d1=function(_0xd6dcd5){while(--_0xd6dcd5){_0x19420d['push'](_0x19420d['shift']());}};_0x1de2d1(++_0xbc4303);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x45b29d,_0x44ce43){_0x45b29d=_0x45b29d-0x0;var _0x32d74=_0xc9b9[_0x45b29d];return _0x32d74;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9c9b('0x0'));var timeout=require(_0x9c9b('0x1'));var express=require(_0x9c9b('0x2'));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(_0x9c9b('0x3'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9c9b('0x4')]);router[_0x9c9b('0x5')](_0x9c9b('0x6'),auth[_0x9c9b('0x7')](),controller[_0x9c9b('0x8')]);router['get'](_0x9c9b('0x9'),auth[_0x9c9b('0x7')](),controller[_0x9c9b('0xa')]);router[_0x9c9b('0x5')]('/:id/users',auth[_0x9c9b('0x7')](),controller[_0x9c9b('0xb')]);router['get'](_0x9c9b('0xc'),auth[_0x9c9b('0x7')](),controller['getTeams']);router['post']('/',auth[_0x9c9b('0x7')](),controller['create']);router[_0x9c9b('0xd')](_0x9c9b('0xe'),auth['isAuthenticated'](),controller['addAgents']);router['post']('/:id/teams',auth[_0x9c9b('0x7')](),controller[_0x9c9b('0xf')]);router['put'](_0x9c9b('0x9'),auth[_0x9c9b('0x7')](),controller['update']);router[_0x9c9b('0x10')](_0x9c9b('0x9'),auth[_0x9c9b('0x7')](),controller[_0x9c9b('0x11')]);router[_0x9c9b('0x10')](_0x9c9b('0xe'),auth[_0x9c9b('0x7')](),controller[_0x9c9b('0x12')]);router[_0x9c9b('0x10')]('/:id/teams',auth[_0x9c9b('0x7')](),controller[_0x9c9b('0x13')]);module[_0x9c9b('0x14')]=router; \ No newline at end of file +var _0xb258=['addAgents','put','/:id','update','delete','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','show','/:id/users','getAgents','/:id/teams','post','create'];(function(_0x4bc3a0,_0x38862c){var _0x3fe34b=function(_0x2bfa4e){while(--_0x2bfa4e){_0x4bc3a0['push'](_0x4bc3a0['shift']());}};_0x3fe34b(++_0x38862c);}(_0xb258,0x12b));var _0x8b25=function(_0x7062f6,_0xc78f87){_0x7062f6=_0x7062f6-0x0;var _0x392def=_0xb258[_0x7062f6];return _0x392def;};'use strict';var multer=require(_0x8b25('0x0'));var util=require('util');var path=require(_0x8b25('0x1'));var timeout=require(_0x8b25('0x2'));var express=require('express');var router=express[_0x8b25('0x3')]();var fs_extra=require(_0x8b25('0x4'));var auth=require(_0x8b25('0x5'));var interaction=require(_0x8b25('0x6'));var config=require(_0x8b25('0x7'));var controller=require(_0x8b25('0x8'));router['get']('/',auth[_0x8b25('0x9')](),controller[_0x8b25('0xa')]);router[_0x8b25('0xb')](_0x8b25('0xc'),auth['isAuthenticated'](),controller[_0x8b25('0xd')]);router[_0x8b25('0xb')]('/:id',auth[_0x8b25('0x9')](),controller[_0x8b25('0xe')]);router[_0x8b25('0xb')](_0x8b25('0xf'),auth['isAuthenticated'](),controller[_0x8b25('0x10')]);router[_0x8b25('0xb')](_0x8b25('0x11'),auth[_0x8b25('0x9')](),controller['getTeams']);router[_0x8b25('0x12')]('/',auth[_0x8b25('0x9')](),controller[_0x8b25('0x13')]);router['post'](_0x8b25('0xf'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x14')]);router[_0x8b25('0x12')]('/:id/teams',auth[_0x8b25('0x9')](),controller['addTeams']);router[_0x8b25('0x15')](_0x8b25('0x16'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x17')]);router[_0x8b25('0x18')](_0x8b25('0x16'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x19')]);router[_0x8b25('0x18')](_0x8b25('0xf'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x1a')]);router[_0x8b25('0x18')](_0x8b25('0x11'),auth['isAuthenticated'](),controller[_0x8b25('0x1b')]);module[_0x8b25('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 51fba3f..8574040 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 _0xb8f2=['STRING','sequelize','exports','name','VIRTUAL','system-','getDataValue'];(function(_0x4e9ce1,_0x59beed){var _0x5d19cf=function(_0x14af09){while(--_0x14af09){_0x4e9ce1['push'](_0x4e9ce1['shift']());}};_0x5d19cf(++_0x59beed);}(_0xb8f2,0x104));var _0x2b8f=function(_0x4f9449,_0x44f559){_0x4f9449=_0x4f9449-0x0;var _0x5d1884=_0xb8f2[_0x4f9449];return _0x5d1884;};'use strict';var Sequelize=require(_0x2b8f('0x0'));module[_0x2b8f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2b8f('0x2')},'prefix':{'type':Sequelize[_0x2b8f('0x3')],'get':function(_0x27aeb9){return _0x2b8f('0x4')+this[_0x2b8f('0x5')](_0x2b8f('0x2'))+'-';}},'description':{'type':Sequelize[_0x2b8f('0x6')]},'callerIdAll':{'type':Sequelize[_0x2b8f('0x6')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xcc46=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x263d88,_0x5cd913){var _0x212585=function(_0x2dccc4){while(--_0x2dccc4){_0x263d88['push'](_0x263d88['shift']());}};_0x212585(++_0x5cd913);}(_0xcc46,0xa5));var _0x6cc4=function(_0x10d386,_0x101138){_0x10d386=_0x10d386-0x0;var _0x45a236=_0xcc46[_0x10d386];return _0x45a236;};'use strict';var Sequelize=require(_0x6cc4('0x0'));module[_0x6cc4('0x1')]={'name':{'type':Sequelize[_0x6cc4('0x2')],'allowNull':![],'unique':_0x6cc4('0x3')},'prefix':{'type':Sequelize[_0x6cc4('0x4')],'get':function(_0x5b3022){return _0x6cc4('0x5')+this[_0x6cc4('0x6')](_0x6cc4('0x3'))+'-';}},'description':{'type':Sequelize[_0x6cc4('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x6cc4('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 96fda4d..be60d88 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 _0x4213=['limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','name','index','map','VoicePrefix','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','find','catch','describe','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','type','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','CDR(prefix)=','callerIdAll','Set','${EXTEN:','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','nolimit','Team','order','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','offset','undefined'];(function(_0x3ea538,_0x34be34){var _0x10f15a=function(_0x1335a5){while(--_0x1335a5){_0x3ea538['push'](_0x3ea538['shift']());}};_0x10f15a(++_0x34be34);}(_0x4213,0x77));var _0x3421=function(_0x4716aa,_0x427bd8){_0x4716aa=_0x4716aa-0x0;var _0x37e331=_0x4213[_0x4716aa];return _0x37e331;};'use strict';var emlformat=require(_0x3421('0x0'));var rimraf=require(_0x3421('0x1'));var zipdir=require(_0x3421('0x2'));var jsonpatch=require(_0x3421('0x3'));var rp=require(_0x3421('0x4'));var moment=require(_0x3421('0x5'));var BPromise=require(_0x3421('0x6'));var Mustache=require('mustache');var util=require(_0x3421('0x7'));var path=require('path');var sox=require(_0x3421('0x8'));var csv=require(_0x3421('0x9'));var ejs=require(_0x3421('0xa'));var fs=require('fs');var fs_extra=require(_0x3421('0xb'));var _=require('lodash');var squel=require(_0x3421('0xc'));var crypto=require(_0x3421('0xd'));var jsforce=require(_0x3421('0xe'));var deskjs=require(_0x3421('0xf'));var toCsv=require(_0x3421('0x9'));var querystring=require('querystring');var Papa=require(_0x3421('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3421('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3421('0x12'));var logger=require(_0x3421('0x13'))(_0x3421('0x14'));var utils=require(_0x3421('0x15'));var config=require(_0x3421('0x16'));var licenseUtil=require(_0x3421('0x17'));var db=require(_0x3421('0x18'))['db'];config['redis']=_[_0x3421('0x19')](config[_0x3421('0x1a')],{'host':_0x3421('0x1b'),'port':0x18eb});var socket=require(_0x3421('0x1c'))(new Redis(config[_0x3421('0x1a')]));require(_0x3421('0x1d'))[_0x3421('0x1e')](socket);function respondWithStatusCode(_0x59ea4a,_0xafd9e0){_0xafd9e0=_0xafd9e0||0xcc;return function(_0x4b5f43){if(_0x4b5f43){return _0x59ea4a[_0x3421('0x1f')](_0xafd9e0);}return _0x59ea4a[_0x3421('0x20')](_0xafd9e0)['end']();};}function respondWithResult(_0x1e33ab,_0x4c6f7b){_0x4c6f7b=_0x4c6f7b||0xc8;return function(_0x16bc8f){if(_0x16bc8f){return _0x1e33ab[_0x3421('0x20')](_0x4c6f7b)['json'](_0x16bc8f);}};}function respondWithFilteredResult(_0x3584d6,_0x3dec08){return function(_0x130d3c){if(_0x130d3c){var _0x104cc5=typeof _0x3dec08[_0x3421('0x21')]===_0x3421('0x22')&&typeof _0x3dec08[_0x3421('0x23')]===_0x3421('0x22');var _0x197b83=_0x130d3c[_0x3421('0x24')];var _0x538a8b=_0x104cc5?0x0:_0x3dec08['offset'];var _0x420114=_0x104cc5?_0x130d3c['count']:_0x3dec08['offset']+_0x3dec08['limit'];var _0x33155b;if(_0x420114>=_0x197b83){_0x420114=_0x197b83;_0x33155b=0xc8;}else{_0x33155b=0xce;}_0x3584d6[_0x3421('0x20')](_0x33155b);return _0x3584d6[_0x3421('0x25')](_0x3421('0x26'),_0x538a8b+'-'+_0x420114+'/'+_0x197b83)[_0x3421('0x27')](_0x130d3c);}return null;};}function patchUpdates(_0x39bed4){return function(_0x3df305){try{jsonpatch[_0x3421('0x28')](_0x3df305,_0x39bed4,!![]);}catch(_0xb9af5f){return BPromise[_0x3421('0x29')](_0xb9af5f);}return _0x3df305['save']();};}function saveUpdates(_0x57a4af,_0x494423){return function(_0x3fef90){if(_0x3fef90){return _0x3fef90[_0x3421('0x2a')](_0x57a4af)[_0x3421('0x2b')](function(_0x5bc28a){return _0x5bc28a;});}return null;};}function removeEntity(_0x506af4,_0x1b65d0){return function(_0x5b53b6){if(_0x5b53b6){return _0x5b53b6[_0x3421('0x2c')]()['then'](function(){var _0x15e73c=_0x5b53b6[_0x3421('0x2d')]({'plain':!![]});var _0x36d75f=_0x3421('0x2e');return db[_0x3421('0x2f')]['destroy']({'where':{'type':_0x36d75f,'resourceId':_0x15e73c['id']}})[_0x3421('0x2b')](function(){return _0x5b53b6;});})['then'](function(){_0x506af4['status'](0xcc)[_0x3421('0x30')]();});}};}function handleEntityNotFound(_0x5aa96b,_0x5074a2){return function(_0xb4eaf4){if(!_0xb4eaf4){_0x5aa96b['sendStatus'](0x194);}return _0xb4eaf4;};}function handleError(_0x20abc7,_0x5bcd19){_0x5bcd19=_0x5bcd19||0x1f4;return function(_0xc7f9fb){logger[_0x3421('0x31')](_0xc7f9fb['stack']);if(_0xc7f9fb[_0x3421('0x32')]){delete _0xc7f9fb[_0x3421('0x32')];}_0x20abc7[_0x3421('0x20')](_0x5bcd19)['send'](_0xc7f9fb);};}exports[_0x3421('0x33')]=function(_0x50d61b,_0x2b5af4){var _0xf0039={},_0x1045ab={},_0x841e08={'count':0x0,'rows':[]};var _0x3875c6=_[_0x3421('0x34')](db[_0x3421('0x35')][_0x3421('0x36')],function(_0x94559a){return{'name':_0x94559a[_0x3421('0x37')],'type':_0x94559a['type']['key']};});_0x1045ab[_0x3421('0x38')]=_[_0x3421('0x34')](_0x3875c6,'name');_0x1045ab[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x50d61b[_0x3421('0x39')]);_0x1045ab[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x1045ab['model'],_0x1045ab[_0x3421('0x39')]);_0xf0039[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x1045ab['model'],qs[_0x3421('0x3e')](_0x50d61b['query'][_0x3421('0x3e')]));_0xf0039[_0x3421('0x3d')]=_0xf0039[_0x3421('0x3d')][_0x3421('0x3f')]?_0xf0039[_0x3421('0x3d')]:_0x1045ab[_0x3421('0x38')];if(!_0x50d61b[_0x3421('0x39')]['hasOwnProperty']('nolimit')){_0xf0039['limit']=qs[_0x3421('0x23')](_0x50d61b['query']['limit']);_0xf0039[_0x3421('0x21')]=qs['offset'](_0x50d61b[_0x3421('0x39')][_0x3421('0x21')]);}_0xf0039['order']=qs[_0x3421('0x40')](_0x50d61b[_0x3421('0x39')][_0x3421('0x40')]);_0xf0039[_0x3421('0x41')]=qs['filters'](_[_0x3421('0x42')](_0x50d61b[_0x3421('0x39')],_0x1045ab[_0x3421('0x3b')]),_0x3875c6);if(_0x50d61b[_0x3421('0x39')][_0x3421('0x43')]){_0xf0039['where']=_[_0x3421('0x44')](_0xf0039[_0x3421('0x41')],{'$or':_['map'](_0x3875c6,function(_0x15551c){if(_0x15551c['type']!=='VIRTUAL'){var _0x486ce8={};_0x486ce8[_0x15551c[_0x3421('0x32')]]={'$like':'%'+_0x50d61b[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x486ce8;}})});}_0xf0039=_[_0x3421('0x44')]({},_0xf0039,_0x50d61b[_0x3421('0x45')]);var _0x417d6e={'where':_0xf0039[_0x3421('0x41')]};return db[_0x3421('0x35')][_0x3421('0x24')](_0x417d6e)[_0x3421('0x2b')](function(_0x3b9d15){_0x841e08[_0x3421('0x24')]=_0x3b9d15;if(_0x50d61b[_0x3421('0x39')][_0x3421('0x46')]){_0xf0039['include']=[{'all':!![]}];}return db[_0x3421('0x35')][_0x3421('0x47')](_0xf0039);})[_0x3421('0x2b')](function(_0x4466be){_0x841e08['rows']=_0x4466be;return _0x841e08;})[_0x3421('0x2b')](respondWithFilteredResult(_0x2b5af4,_0xf0039))['catch'](handleError(_0x2b5af4,null));};exports[_0x3421('0x48')]=function(_0x248f84,_0x669cfd){var _0x176aef={'raw':![],'where':{'id':_0x248f84[_0x3421('0x49')]['id']}},_0x2f9a84={};_0x2f9a84[_0x3421('0x38')]=_[_0x3421('0x3a')](db[_0x3421('0x35')][_0x3421('0x36')]);_0x2f9a84[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x248f84[_0x3421('0x39')]);_0x2f9a84['filters']=_[_0x3421('0x3c')](_0x2f9a84['model'],_0x2f9a84[_0x3421('0x39')]);_0x176aef[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x2f9a84[_0x3421('0x38')],qs[_0x3421('0x3e')](_0x248f84[_0x3421('0x39')][_0x3421('0x3e')]));_0x176aef[_0x3421('0x3d')]=_0x176aef[_0x3421('0x3d')][_0x3421('0x3f')]?_0x176aef['attributes']:_0x2f9a84[_0x3421('0x38')];if(_0x248f84[_0x3421('0x39')][_0x3421('0x46')]){_0x176aef['include']=[{'all':!![]}];}_0x176aef=_['merge']({},_0x176aef,_0x248f84[_0x3421('0x45')]);return db[_0x3421('0x35')][_0x3421('0x4a')](_0x176aef)['then'](handleEntityNotFound(_0x669cfd,null))[_0x3421('0x2b')](respondWithResult(_0x669cfd,null))[_0x3421('0x4b')](handleError(_0x669cfd,null));};exports[_0x3421('0x2c')]=function(_0x356376,_0x57554a){return db[_0x3421('0x35')][_0x3421('0x4a')]({'where':{'id':_0x356376[_0x3421('0x49')]['id']}})['then'](handleEntityNotFound(_0x57554a,null))['then'](removeEntity(_0x57554a,null))['catch'](handleError(_0x57554a,null));};exports[_0x3421('0x4c')]=function(_0x1021f8,_0x5a9ccf){return db['VoicePrefix'][_0x3421('0x4c')]()[_0x3421('0x2b')](respondWithResult(_0x5a9ccf,null))[_0x3421('0x4b')](handleError(_0x5a9ccf,null));};exports[_0x3421('0x4d')]=function(_0x127835,_0x4987e3){var _0x27d284;return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x2f9ce1){return db['VoicePrefix'][_0x3421('0x4d')](_0x127835[_0x3421('0x50')],{'transaction':_0x2f9ce1})[_0x3421('0x2b')](function(_0x48a967){_0x27d284=_0x48a967[_0x3421('0x2d')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x27d284[_0x3421('0x51')]},'raw':!![]})['then'](function(_0x4e33a0){return createVoicePrefixExtensions(_0x27d284,_0x4e33a0,_0x2f9ce1);});});})[_0x3421('0x2b')](function(){var _0x12bd9a=_0x127835['user'][_0x3421('0x2d')]({'plain':!![]});if(!_0x12bd9a)throw new Error(_0x3421('0x52'));if(_0x12bd9a[_0x3421('0x53')]===_0x3421('0x54')){var _0x1c73b9=_0x27d284;return db[_0x3421('0x55')][_0x3421('0x4a')]({'where':{'name':_0x3421('0x2e'),'userProfileId':_0x12bd9a[_0x3421('0x56')]},'raw':!![]})['then'](function(_0x1e4add){if(_0x1e4add&&_0x1e4add[_0x3421('0x57')]===0x0){return db['UserProfileResource'][_0x3421('0x4d')]({'name':_0x1c73b9[_0x3421('0x32')],'resourceId':_0x1c73b9['id'],'type':_0x1e4add[_0x3421('0x32')],'sectionId':_0x1e4add['id']},{})['then'](function(){return _0x27d284;});}else{return _0x27d284;}})[_0x3421('0x4b')](function(_0x27085d){logger[_0x3421('0x31')](_0x3421('0x58'),_0x27085d);throw _0x27085d;});}return _0x27d284;})[_0x3421('0x2b')](respondWithResult(_0x4987e3,null))[_0x3421('0x4b')](handleError(_0x4987e3,null));};function Extension(_0x333b86,_0x3254aa,_0x31fd9b,_0x279b44){this[_0x3421('0x59')]=_0x3421('0x5a');this[_0x3421('0x5b')]=_0x333b86;this[_0x3421('0x5c')]=_0x31fd9b;this[_0x3421('0x5d')]='system';this[_0x3421('0x5e')]=_0x3421('0x5f');this[_0x3421('0x60')]=_0x3254aa;this[_0x3421('0x61')]=_0x279b44;}function createVoicePrefixExtensions(_0x1813c9,_0x25a641,_0x32c9a7){return new BPromise(function(_0x374a6a,_0x5d6488){var _0x379673=new Extension(formatPrefixName(_0x1813c9['prefix']),0x1,_0x3421('0x62'),_0x3421('0x63'));_0x379673[_0x3421('0x64')]=_0x1813c9['id'];return db[_0x3421('0x65')]['create'](_0x379673,{'transaction':_0x32c9a7})[_0x3421('0x2b')](function(_0x21e11b){var _0x9def45=_0x21e11b[_0x3421('0x2d')]({'plain':!![]});var _0x9e649=_[_0x3421('0x34')](addVoicePrefixExtensions(_0x1813c9,_0x25a641),function(_0x5e6c4d){_0x5e6c4d[_0x3421('0x51')]=_0x9def45['id'];_0x5e6c4d[_0x3421('0x64')]=_0x1813c9['id'];return _0x5e6c4d;});return db[_0x3421('0x65')][_0x3421('0x66')](_0x9e649,{'transaction':_0x32c9a7})[_0x3421('0x2b')](function(_0x1ba5e1){if(!_0x1ba5e1){return _0x5d6488(_0x3421('0x67'));}else{return _0x374a6a(_0x1ba5e1);}})[_0x3421('0x4b')](function(_0x4edb4e){return _0x5d6488(_0x4edb4e);});});;});};function addVoicePrefixExtensions(_0xfbdb57,_0x46717b){var _0x200958=[];var _0x40ae83=formatPrefixName(_0xfbdb57[_0x3421('0x68')]);_0x200958['push'](new Extension(_0x40ae83,0x2,'Set',_0x3421('0x69')+_0xfbdb57[_0x3421('0x32')]));if(_0xfbdb57[_0x3421('0x6a')]){_0x200958['push'](new Extension(_0x40ae83,0x3,_0x3421('0x6b'),'PREFIX-CALLERIDALL='+_0xfbdb57[_0x3421('0x6a')]));}else{_0x200958['push'](new Extension(_0x40ae83,0x3,'NoOp','No\x20callerid\x20available'));}_0x200958['push'](new Extension(_0x40ae83,0x4,'goto',_0x46717b[_0x3421('0x59')]+','+_0x3421('0x6c')+(0x8+_0xfbdb57[_0x3421('0x32')][_0x3421('0x3f')])+'}'+','+0x1));return _0x200958;}function formatPrefixName(_0xa05828){var _0x3ccb08='_';for(var _0x231067=0x0;_0x231067<_0xa05828[_0x3421('0x3f')];_0x231067++){if(_0xa05828[_0x3421('0x6d')](_0x231067)=='-'){_0x3ccb08+=_0xa05828[_0x3421('0x6d')](_0x231067);}else{_0x3ccb08+='['+_0xa05828['charAt'](_0x231067)+']';}}_0x3ccb08+='.';return _0x3ccb08;}exports[_0x3421('0x2a')]=function(_0x4dce60,_0x252b28,_0x41e5f8){var _0x40e0a6=_0x4dce60[_0x3421('0x50')];_0x40e0a6[_0x3421('0x68')]=_0x3421('0x6e')+_0x40e0a6[_0x3421('0x32')]+'-';return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x5c74a8){return db[_0x3421('0x35')][_0x3421('0x2a')](_0x40e0a6,{'where':{'id':_0x40e0a6['id']},'transaction':_0x5c74a8})[_0x3421('0x2b')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x40e0a6['id']},'transaction':_0x5c74a8})['then'](function(){return db['VoiceExtension'][_0x3421('0x4a')]({'where':{'id':_0x40e0a6['VoiceExtensionId']},'raw':!![]})[_0x3421('0x2b')](function(_0x8aee05){return createVoicePrefixExtensions(_0x40e0a6,_0x8aee05,_0x5c74a8);});});});})[_0x3421('0x2b')](function(){return db[_0x3421('0x35')]['findById'](_0x40e0a6['id']);})[_0x3421('0x2b')](respondWithResult(_0x252b28,null))[_0x3421('0x4b')](handleError(_0x252b28,null));};exports[_0x3421('0x6f')]=function(_0xfb8c60,_0x151eaf,_0x4177cc){return db['VoicePrefix'][_0x3421('0x4a')]({'where':{'id':_0xfb8c60[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x151eaf,null))[_0x3421('0x2b')](function(_0x37e6d8){if(_0x37e6d8){return _0x37e6d8[_0x3421('0x6f')](_0xfb8c60[_0x3421('0x50')]['ids'],_['omit'](_0xfb8c60[_0x3421('0x50')],[_0x3421('0x70'),'id'])||{})[_0x3421('0x71')](function(_0x5d04c6){for(var _0x2dac40=0x0;_0x2dac40<_0xfb8c60['body'][_0x3421('0x70')]['length'];_0x2dac40+=0x1){socket[_0x3421('0x72')](_0x3421('0x73'),{'UserId':Number(_0xfb8c60[_0x3421('0x50')][_0x3421('0x70')][_0x2dac40]),'VoicePrefixId':Number(_0xfb8c60[_0x3421('0x49')]['id'])});}return _0x5d04c6;});}})[_0x3421('0x2b')](respondWithResult(_0x151eaf,null))[_0x3421('0x4b')](handleError(_0x151eaf,null));};exports[_0x3421('0x74')]=function(_0x3f1df5,_0x37ca80,_0x427013){return db[_0x3421('0x35')]['find']({'where':{'id':_0x3f1df5[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x37ca80,null))[_0x3421('0x2b')](function(_0x387d09){if(_0x387d09){return _0x387d09[_0x3421('0x74')](_0x3f1df5[_0x3421('0x39')][_0x3421('0x70')])[_0x3421('0x2b')](function(){if(_['isArray'](_0x3f1df5[_0x3421('0x39')]['ids'])){for(var _0x4d92ed=0x0;_0x4d92ed<_0x3f1df5['query'][_0x3421('0x70')][_0x3421('0x3f')];_0x4d92ed+=0x1){socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':Number(_0x3f1df5['query'][_0x3421('0x70')][_0x4d92ed]),'VoicePrefixId':Number(_0x3f1df5[_0x3421('0x49')]['id'])});}}else{socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':Number(_0x3f1df5[_0x3421('0x39')][_0x3421('0x70')]),'VoicePrefixId':Number(_0x3f1df5[_0x3421('0x49')]['id'])});}});}})[_0x3421('0x2b')](respondWithStatusCode(_0x37ca80,null))[_0x3421('0x4b')](handleError(_0x37ca80,null));};exports[_0x3421('0x76')]=function(_0x19e35d,_0x414218,_0x1d65ba){var _0x170340={};var _0x456644={};var _0x355f47;var _0x826d7c;return db['VoicePrefix']['findOne']({'where':{'id':_0x19e35d[_0x3421('0x49')]['id']}})['then'](handleEntityNotFound(_0x414218,null))[_0x3421('0x2b')](function(_0x2fd442){if(_0x2fd442){_0x355f47=_0x2fd442;_0x456644['model']=_[_0x3421('0x3a')](db[_0x3421('0x77')][_0x3421('0x36')]);_0x456644[_0x3421('0x39')]=_[_0x3421('0x3a')](_0x19e35d[_0x3421('0x39')]);_0x456644[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x456644[_0x3421('0x38')],_0x456644[_0x3421('0x39')]);_0x170340[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x456644[_0x3421('0x38')],qs['fields'](_0x19e35d[_0x3421('0x39')]['fields']));_0x170340[_0x3421('0x3d')]=_0x170340[_0x3421('0x3d')]['length']?_0x170340[_0x3421('0x3d')]:_0x456644['model'];_0x170340['order']=qs[_0x3421('0x40')](_0x19e35d[_0x3421('0x39')][_0x3421('0x40')]);_0x170340['where']=qs[_0x3421('0x3b')](_[_0x3421('0x42')](_0x19e35d[_0x3421('0x39')],_0x456644['filters']));if(_0x19e35d['query'][_0x3421('0x43')]){_0x170340[_0x3421('0x41')]=_[_0x3421('0x44')](_0x170340[_0x3421('0x41')],{'$or':_['map'](_0x170340[_0x3421('0x3d')],function(_0x1fcd4b){var _0x298afc={};_0x298afc[_0x1fcd4b]={'$like':'%'+_0x19e35d[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x298afc;})});}_0x170340=_[_0x3421('0x44')]({},_0x170340,_0x19e35d[_0x3421('0x45')]);return _0x355f47[_0x3421('0x76')](_0x170340);}})['then'](function(_0x27967d){if(_0x27967d){_0x826d7c=_0x27967d[_0x3421('0x3f')];if(!_0x19e35d['query']['hasOwnProperty'](_0x3421('0x78'))){_0x170340[_0x3421('0x23')]=qs[_0x3421('0x23')](_0x19e35d[_0x3421('0x39')][_0x3421('0x23')]);_0x170340['offset']=qs['offset'](_0x19e35d[_0x3421('0x39')]['offset']);}return _0x355f47['getAgents'](_0x170340);}})[_0x3421('0x2b')](function(_0x1a5b7c){if(_0x1a5b7c){return _0x1a5b7c?{'count':_0x826d7c,'rows':_0x1a5b7c}:null;}})[_0x3421('0x2b')](respondWithResult(_0x414218,null))[_0x3421('0x4b')](handleError(_0x414218,null));};exports['getTeams']=function(_0x595f0a,_0x335331,_0x5a922d){var _0x5af9c9={};var _0x1fb48f={};var _0x3fc2b6;var _0x4289f3;return db['VoicePrefix']['findOne']({'where':{'id':_0x595f0a['params']['id']}})[_0x3421('0x2b')](handleEntityNotFound(_0x335331,null))[_0x3421('0x2b')](function(_0x176b12){if(_0x176b12){_0x3fc2b6=_0x176b12;_0x1fb48f[_0x3421('0x38')]=_[_0x3421('0x3a')](db[_0x3421('0x79')][_0x3421('0x36')]);_0x1fb48f['query']=_[_0x3421('0x3a')](_0x595f0a[_0x3421('0x39')]);_0x1fb48f[_0x3421('0x3b')]=_[_0x3421('0x3c')](_0x1fb48f[_0x3421('0x38')],_0x1fb48f[_0x3421('0x39')]);_0x5af9c9[_0x3421('0x3d')]=_[_0x3421('0x3c')](_0x1fb48f[_0x3421('0x38')],qs['fields'](_0x595f0a['query'][_0x3421('0x3e')]));_0x5af9c9['attributes']=_0x5af9c9[_0x3421('0x3d')]['length']?_0x5af9c9[_0x3421('0x3d')]:_0x1fb48f[_0x3421('0x38')];_0x5af9c9[_0x3421('0x7a')]=qs[_0x3421('0x40')](_0x595f0a[_0x3421('0x39')]['sort']);_0x5af9c9['where']=qs[_0x3421('0x3b')](_[_0x3421('0x42')](_0x595f0a[_0x3421('0x39')],_0x1fb48f[_0x3421('0x3b')]));if(_0x595f0a['query'][_0x3421('0x43')]){_0x5af9c9[_0x3421('0x41')]=_[_0x3421('0x44')](_0x5af9c9[_0x3421('0x41')],{'$or':_[_0x3421('0x34')](_0x5af9c9[_0x3421('0x3d')],function(_0x31095c){var _0x4c3058={};_0x4c3058[_0x31095c]={'$like':'%'+_0x595f0a[_0x3421('0x39')][_0x3421('0x43')]+'%'};return _0x4c3058;})});}_0x5af9c9=_['merge']({},_0x5af9c9,_0x595f0a[_0x3421('0x45')]);return _0x3fc2b6[_0x3421('0x7b')](_0x5af9c9);}})[_0x3421('0x2b')](function(_0x58b3e4){if(_0x58b3e4){_0x4289f3=_0x58b3e4[_0x3421('0x3f')];if(!_0x595f0a[_0x3421('0x39')]['hasOwnProperty'](_0x3421('0x78'))){_0x5af9c9[_0x3421('0x23')]=qs[_0x3421('0x23')](_0x595f0a[_0x3421('0x39')][_0x3421('0x23')]);_0x5af9c9[_0x3421('0x21')]=qs[_0x3421('0x21')](_0x595f0a[_0x3421('0x39')]['offset']);}return _0x3fc2b6[_0x3421('0x7b')](_0x5af9c9);}})['then'](function(_0x5aaa8a){if(_0x5aaa8a){return _0x5aaa8a?{'count':_0x4289f3,'rows':_0x5aaa8a}:null;}})[_0x3421('0x2b')](respondWithResult(_0x335331,null))[_0x3421('0x4b')](handleError(_0x335331,null));};exports[_0x3421('0x7c')]=function(_0x2c62d7,_0x5cbf21,_0x25c6a0){var _0x44e166=_0x2c62d7[_0x3421('0x50')][_0x3421('0x70')];var _0x13b03f;return db[_0x3421('0x79')][_0x3421('0x47')]({'where':{'id':_0x44e166},'attributes':['id'],'include':[{'model':db[_0x3421('0x77')],'as':_0x3421('0x7d'),'attributes':['id',_0x3421('0x32'),_0x3421('0x7e'),_0x3421('0x7f'),_0x3421('0x80')],'raw':!![]}]})[_0x3421('0x2b')](function(_0x1cde5f){if(_0x1cde5f){_0x13b03f=_0x1cde5f;var _0x1ddc33=_[_0x3421('0x81')](_0x1cde5f,function(_0x34f980){var _0x7d7398=_0x34f980[_0x3421('0x2d')]({'plain':!![]});return _0x7d7398[_0x3421('0x7d')];});return db['VoicePrefix']['find']({'where':{'id':_0x2c62d7[_0x3421('0x49')]['id']}})[_0x3421('0x2b')](function(_0x1a7038){return db[_0x3421('0x4e')]['transaction'](function(_0x18f27a){return _0x1a7038[_0x3421('0x7c')](_0x44e166,{'transaction':_0x18f27a})['then'](function(){return BPromise[_0x3421('0x82')](_0x13b03f,function(_0x2eb3f4){return db[_0x3421('0x83')]['upsert']({'TeamId':_0x2eb3f4['id'],'VoicePrefixId':_0x2c62d7[_0x3421('0x49')]['id']},{'transaction':_0x18f27a});});})['then'](function(){return BPromise[_0x3421('0x82')](_0x1ddc33,function(_0x3f6f2c){return db[_0x3421('0x84')][_0x3421('0x85')]({'where':{'UserId':_0x3f6f2c['id'],'VoicePrefixId':_0x2c62d7[_0x3421('0x49')]['id']},'transaction':_0x18f27a});});})[_0x3421('0x2b')](function(){_0x1ddc33[_0x3421('0x86')](function(_0x50607f){socket[_0x3421('0x72')]('userVoicePrefix:save',{'UserId':_0x50607f['id'],'VoicePrefixId':_0x1a7038['id']});});});});});}})['then'](respondWithStatusCode(_0x5cbf21,null))[_0x3421('0x4b')](handleError(_0x5cbf21,null));};exports[_0x3421('0x87')]=function(_0x4a85d1,_0x1b48e1,_0x4c357e){return db[_0x3421('0x79')][_0x3421('0x47')]({'where':{'id':_0x4a85d1[_0x3421('0x39')][_0x3421('0x70')]},'attributes':['id'],'include':[{'model':db[_0x3421('0x77')],'as':_0x3421('0x7d'),'attributes':['id'],'raw':!![]}]})[_0x3421('0x2b')](handleEntityNotFound(_0x1b48e1,null))[_0x3421('0x2b')](function(_0x2f38ec){var _0x11f294=_[_0x3421('0x34')](_0x2f38ec,'id');var _0x2d7330=[];var _0x5bf9a4=[];var _0x36868f=squel['select']();_0x36868f['field'](_0x3421('0x88'))[_0x3421('0x89')](_0x3421('0x8a'),'tq')[_0x3421('0x8b')]('user_has_teams','ut',_0x3421('0x8c'))[_0x3421('0x41')]('VoicePrefixId\x20=\x20?',_0x4a85d1[_0x3421('0x49')]['id']);for(var _0x4a933a=0x0;_0x4a933a<_0x2f38ec[_0x3421('0x3f')];_0x4a933a+=0x1){let _0x2defcb=_0x2f38ec[_0x4a933a];for(var _0x16735e=0x0;_0x16735e<_0x2defcb['Agents'][_0x3421('0x3f')];_0x16735e+=0x1){let _0x303df7=_0x2defcb[_0x3421('0x7d')][_0x16735e];var _0x1d8163=_0x36868f[_0x3421('0x8d')]();_0x1d8163[_0x3421('0x41')](_0x3421('0x8e'),_0x303df7['id']);_0x5bf9a4[_0x3421('0x8f')](db['sequelize'][_0x3421('0x39')](_0x1d8163[_0x3421('0x90')](),{'type':db[_0x3421('0x4e')][_0x3421('0x91')][_0x3421('0x92')]})[_0x3421('0x2b')](function(_0x3a5346){if(_0x3a5346['length']===0x1){return _0x303df7['id'];}else{var _0x3f64d0=_[_0x3421('0x93')](_['map'](_0x3a5346,'TeamId'),function(_0x4aa261){return _[_0x3421('0x94')](_0x11f294,_0x4aa261);});if(_0x3f64d0){return _0x303df7['id'];}}}));}}return BPromise[_0x3421('0x95')](_0x5bf9a4)['then'](function(_0x256976){_0x2d7330=_(_0x2d7330)[_0x3421('0x96')](_0x256976)[_0x3421('0x97')]()[_0x3421('0x98')]();return db[_0x3421('0x35')][_0x3421('0x4a')]({'where':{'id':_0x4a85d1[_0x3421('0x49')]['id']}})['then'](function(_0x224e26){return db[_0x3421('0x4e')][_0x3421('0x4f')](function(_0x1e2a67){return _0x224e26[_0x3421('0x87')](_0x4a85d1[_0x3421('0x39')]['ids'],{'transaction':_0x1e2a67})[_0x3421('0x2b')](function(){if(!_[_0x3421('0x99')](_0x2d7330)){return _0x224e26['removeAgents'](_0x2d7330,{'transaction':_0x1e2a67});}})[_0x3421('0x2b')](function(){_0x2d7330[_0x3421('0x86')](function(_0x25cc13){socket[_0x3421('0x72')](_0x3421('0x75'),{'UserId':_0x25cc13,'VoicePrefixId':_0x224e26['id']});});});});});});})[_0x3421('0x2b')](respondWithStatusCode(_0x1b48e1,null))[_0x3421('0x4b')](handleError(_0x1b48e1,null));}; \ No newline at end of file +var _0xd7d1=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','intersection','describe','create','sequelize','VoiceExtension','VoiceExtensionId','user','role','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Agents','online','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','Team','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','VoicePrefixes','destroy','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x2da421,_0x4d3ba5){var _0x42a20b=function(_0x10415f){while(--_0x10415f){_0x2da421['push'](_0x2da421['shift']());}};_0x42a20b(++_0x4d3ba5);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x33575e,_0x181154){_0x33575e=_0x33575e-0x0;var _0x367cf3=_0xd7d1[_0x33575e];return _0x367cf3;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];config[_0x1d7d('0x1c')]=_['defaults'](config['redis'],{'host':_0x1d7d('0x1d'),'port':0x18eb});var socket=require(_0x1d7d('0x1e'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1d7d('0x1f')](socket);function respondWithStatusCode(_0x334e78,_0xe10fdd){_0xe10fdd=_0xe10fdd||0xcc;return function(_0x183fc6){if(_0x183fc6){return _0x334e78[_0x1d7d('0x20')](_0xe10fdd);}return _0x334e78['status'](_0xe10fdd)[_0x1d7d('0x21')]();};}function respondWithResult(_0x1de6cc,_0x51cbca){_0x51cbca=_0x51cbca||0xc8;return function(_0xb90a8c){if(_0xb90a8c){return _0x1de6cc[_0x1d7d('0x22')](_0x51cbca)[_0x1d7d('0x23')](_0xb90a8c);}};}function respondWithFilteredResult(_0x47826a,_0x40db4d){return function(_0x4db4f2){if(_0x4db4f2){var _0x664e3f=typeof _0x40db4d[_0x1d7d('0x24')]==='undefined'&&typeof _0x40db4d['limit']===_0x1d7d('0x25');var _0x1a5101=_0x4db4f2[_0x1d7d('0x26')];var _0x396802=_0x664e3f?0x0:_0x40db4d[_0x1d7d('0x24')];var _0x275d3c=_0x664e3f?_0x4db4f2['count']:_0x40db4d[_0x1d7d('0x24')]+_0x40db4d[_0x1d7d('0x27')];var _0x3a93d0;if(_0x275d3c>=_0x1a5101){_0x275d3c=_0x1a5101;_0x3a93d0=0xc8;}else{_0x3a93d0=0xce;}_0x47826a['status'](_0x3a93d0);return _0x47826a[_0x1d7d('0x28')](_0x1d7d('0x29'),_0x396802+'-'+_0x275d3c+'/'+_0x1a5101)['json'](_0x4db4f2);}return null;};}function patchUpdates(_0x5950bd){return function(_0x1dcaf2){try{jsonpatch[_0x1d7d('0x2a')](_0x1dcaf2,_0x5950bd,!![]);}catch(_0x3d631f){return BPromise['reject'](_0x3d631f);}return _0x1dcaf2[_0x1d7d('0x2b')]();};}function saveUpdates(_0x106376,_0x2d4c0c){return function(_0x21e59){if(_0x21e59){return _0x21e59['update'](_0x106376)[_0x1d7d('0x2c')](function(_0x151198){return _0x151198;});}return null;};}function removeEntity(_0x5c8257,_0x57bbd8){return function(_0x301e5c){if(_0x301e5c){return _0x301e5c['destroy']()[_0x1d7d('0x2c')](function(){var _0x2d4de4=_0x301e5c[_0x1d7d('0x2d')]({'plain':!![]});var _0x22c40d=_0x1d7d('0x2e');return db['UserProfileResource'][_0x1d7d('0x2f')]({'where':{'type':_0x22c40d,'resourceId':_0x2d4de4['id']}})[_0x1d7d('0x2c')](function(){return _0x301e5c;});})[_0x1d7d('0x2c')](function(){_0x5c8257['status'](0xcc)[_0x1d7d('0x21')]();});}};}function handleEntityNotFound(_0x1a935a,_0x23ad85){return function(_0x482367){if(!_0x482367){_0x1a935a['sendStatus'](0x194);}return _0x482367;};}function handleError(_0x53e25c,_0x189a6a){_0x189a6a=_0x189a6a||0x1f4;return function(_0x329f56){logger['error'](_0x329f56[_0x1d7d('0x30')]);if(_0x329f56[_0x1d7d('0x31')]){delete _0x329f56[_0x1d7d('0x31')];}_0x53e25c[_0x1d7d('0x22')](_0x189a6a)[_0x1d7d('0x32')](_0x329f56);};}exports[_0x1d7d('0x33')]=function(_0x452293,_0x803dc9){var _0xd701e1={},_0x456b56={},_0x5b2209={'count':0x0,'rows':[]};var _0x57c22e=_[_0x1d7d('0x34')](db[_0x1d7d('0x35')][_0x1d7d('0x36')],function(_0x40318f){return{'name':_0x40318f[_0x1d7d('0x37')],'type':_0x40318f[_0x1d7d('0x38')][_0x1d7d('0x39')]};});_0x456b56[_0x1d7d('0x3a')]=_[_0x1d7d('0x34')](_0x57c22e,'name');_0x456b56[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x452293[_0x1d7d('0x3b')]);_0x456b56[_0x1d7d('0x3d')]=_['intersection'](_0x456b56['model'],_0x456b56[_0x1d7d('0x3b')]);_0xd701e1[_0x1d7d('0x3e')]=_['intersection'](_0x456b56[_0x1d7d('0x3a')],qs[_0x1d7d('0x3f')](_0x452293['query']['fields']));_0xd701e1[_0x1d7d('0x3e')]=_0xd701e1[_0x1d7d('0x3e')][_0x1d7d('0x40')]?_0xd701e1[_0x1d7d('0x3e')]:_0x456b56[_0x1d7d('0x3a')];if(!_0x452293[_0x1d7d('0x3b')][_0x1d7d('0x41')](_0x1d7d('0x42'))){_0xd701e1[_0x1d7d('0x27')]=qs[_0x1d7d('0x27')](_0x452293['query']['limit']);_0xd701e1['offset']=qs['offset'](_0x452293[_0x1d7d('0x3b')]['offset']);}_0xd701e1[_0x1d7d('0x43')]=qs[_0x1d7d('0x44')](_0x452293[_0x1d7d('0x3b')]['sort']);_0xd701e1[_0x1d7d('0x45')]=qs[_0x1d7d('0x3d')](_[_0x1d7d('0x46')](_0x452293['query'],_0x456b56[_0x1d7d('0x3d')]),_0x57c22e);if(_0x452293[_0x1d7d('0x3b')][_0x1d7d('0x47')]){_0xd701e1[_0x1d7d('0x45')]=_['merge'](_0xd701e1[_0x1d7d('0x45')],{'$or':_[_0x1d7d('0x34')](_0x57c22e,function(_0x4239fa){if(_0x4239fa[_0x1d7d('0x38')]!=='VIRTUAL'){var _0x14a6b3={};_0x14a6b3[_0x4239fa['name']]={'$like':'%'+_0x452293[_0x1d7d('0x3b')][_0x1d7d('0x47')]+'%'};return _0x14a6b3;}})});}_0xd701e1=_[_0x1d7d('0x48')]({},_0xd701e1,_0x452293[_0x1d7d('0x49')]);var _0xf667a1={'where':_0xd701e1['where']};return db['VoicePrefix'][_0x1d7d('0x26')](_0xf667a1)[_0x1d7d('0x2c')](function(_0x1637fc){_0x5b2209['count']=_0x1637fc;if(_0x452293['query'][_0x1d7d('0x4a')]){_0xd701e1['include']=[{'all':!![]}];}return db[_0x1d7d('0x35')][_0x1d7d('0x4b')](_0xd701e1);})[_0x1d7d('0x2c')](function(_0x21394c){_0x5b2209[_0x1d7d('0x4c')]=_0x21394c;return _0x5b2209;})[_0x1d7d('0x2c')](respondWithFilteredResult(_0x803dc9,_0xd701e1))[_0x1d7d('0x4d')](handleError(_0x803dc9,null));};exports['show']=function(_0x3ccd44,_0x8b0c22){var _0x49de57={'raw':![],'where':{'id':_0x3ccd44[_0x1d7d('0x4e')]['id']}},_0x17c68b={};_0x17c68b[_0x1d7d('0x3a')]=_[_0x1d7d('0x3c')](db[_0x1d7d('0x35')][_0x1d7d('0x36')]);_0x17c68b[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x3ccd44[_0x1d7d('0x3b')]);_0x17c68b[_0x1d7d('0x3d')]=_[_0x1d7d('0x4f')](_0x17c68b[_0x1d7d('0x3a')],_0x17c68b['query']);_0x49de57[_0x1d7d('0x3e')]=_['intersection'](_0x17c68b[_0x1d7d('0x3a')],qs['fields'](_0x3ccd44[_0x1d7d('0x3b')][_0x1d7d('0x3f')]));_0x49de57[_0x1d7d('0x3e')]=_0x49de57[_0x1d7d('0x3e')]['length']?_0x49de57[_0x1d7d('0x3e')]:_0x17c68b['model'];if(_0x3ccd44['query'][_0x1d7d('0x4a')]){_0x49de57['include']=[{'all':!![]}];}_0x49de57=_['merge']({},_0x49de57,_0x3ccd44[_0x1d7d('0x49')]);return db[_0x1d7d('0x35')]['find'](_0x49de57)[_0x1d7d('0x2c')](handleEntityNotFound(_0x8b0c22,null))[_0x1d7d('0x2c')](respondWithResult(_0x8b0c22,null))['catch'](handleError(_0x8b0c22,null));};exports[_0x1d7d('0x2f')]=function(_0x2b9faa,_0xa64dbe){return db[_0x1d7d('0x35')]['find']({'where':{'id':_0x2b9faa['params']['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0xa64dbe,null))[_0x1d7d('0x2c')](removeEntity(_0xa64dbe,null))[_0x1d7d('0x4d')](handleError(_0xa64dbe,null));};exports[_0x1d7d('0x50')]=function(_0x3cc5b7,_0x550c9f){return db[_0x1d7d('0x35')][_0x1d7d('0x50')]()[_0x1d7d('0x2c')](respondWithResult(_0x550c9f,null))[_0x1d7d('0x4d')](handleError(_0x550c9f,null));};exports[_0x1d7d('0x51')]=function(_0x42a103,_0x276e7e){var _0x296e7c;return db[_0x1d7d('0x52')]['transaction'](function(_0x3e7c4c){return db[_0x1d7d('0x35')][_0x1d7d('0x51')](_0x42a103['body'],{'transaction':_0x3e7c4c})['then'](function(_0x1d3f54){_0x296e7c=_0x1d3f54[_0x1d7d('0x2d')]({'plain':!![]});return db[_0x1d7d('0x53')]['find']({'where':{'id':_0x296e7c[_0x1d7d('0x54')]},'raw':!![]})[_0x1d7d('0x2c')](function(_0x5eff64){return createVoicePrefixExtensions(_0x296e7c,_0x5eff64,_0x3e7c4c);});});})[_0x1d7d('0x2c')](function(){var _0x2cf508=_0x42a103[_0x1d7d('0x55')][_0x1d7d('0x2d')]({'plain':!![]});if(!_0x2cf508)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cf508[_0x1d7d('0x56')]===_0x1d7d('0x55')){var _0x4ba6ec=_0x296e7c;return db['UserProfileSection'][_0x1d7d('0x57')]({'where':{'name':_0x1d7d('0x2e'),'userProfileId':_0x2cf508['userProfileId']},'raw':!![]})['then'](function(_0x155ef4){if(_0x155ef4&&_0x155ef4[_0x1d7d('0x58')]===0x0){return db[_0x1d7d('0x59')][_0x1d7d('0x51')]({'name':_0x4ba6ec['name'],'resourceId':_0x4ba6ec['id'],'type':_0x155ef4[_0x1d7d('0x31')],'sectionId':_0x155ef4['id']},{})['then'](function(){return _0x296e7c;});}else{return _0x296e7c;}})[_0x1d7d('0x4d')](function(_0x1b1d9e){logger[_0x1d7d('0x5a')](_0x1d7d('0x5b'),_0x1b1d9e);throw _0x1b1d9e;});}return _0x296e7c;})['then'](respondWithResult(_0x276e7e,null))[_0x1d7d('0x4d')](handleError(_0x276e7e,null));};function Extension(_0x1ea966,_0x193135,_0x226509,_0x28ec14){this[_0x1d7d('0x5c')]=_0x1d7d('0x5d');this[_0x1d7d('0x5e')]=_0x1ea966;this[_0x1d7d('0x5f')]=_0x226509;this[_0x1d7d('0x38')]=_0x1d7d('0x60');this[_0x1d7d('0x61')]=_0x1d7d('0x62');this[_0x1d7d('0x63')]=_0x193135;this[_0x1d7d('0x64')]=_0x28ec14;}function createVoicePrefixExtensions(_0x520d3c,_0x2279c5,_0x566d27){return new BPromise(function(_0x1c9fe7,_0x1e3853){var _0x1c698c=new Extension(formatPrefixName(_0x520d3c[_0x1d7d('0x65')]),0x1,_0x1d7d('0x66'),_0x1d7d('0x67'));_0x1c698c['VoicePrefixId']=_0x520d3c['id'];return db[_0x1d7d('0x53')][_0x1d7d('0x51')](_0x1c698c,{'transaction':_0x566d27})['then'](function(_0x2c6d03){var _0x5ed678=_0x2c6d03[_0x1d7d('0x2d')]({'plain':!![]});var _0x119e76=_[_0x1d7d('0x34')](addVoicePrefixExtensions(_0x520d3c,_0x2279c5),function(_0x283f77){_0x283f77[_0x1d7d('0x54')]=_0x5ed678['id'];_0x283f77[_0x1d7d('0x68')]=_0x520d3c['id'];return _0x283f77;});return db['VoiceExtension'][_0x1d7d('0x69')](_0x119e76,{'transaction':_0x566d27})[_0x1d7d('0x2c')](function(_0x4d69cc){if(!_0x4d69cc){return _0x1e3853(_0x1d7d('0x6a'));}else{return _0x1c9fe7(_0x4d69cc);}})[_0x1d7d('0x4d')](function(_0x3c8a65){return _0x1e3853(_0x3c8a65);});});;});};function addVoicePrefixExtensions(_0x4bc7b8,_0x3b3975){var _0xe5c3ba=[];var _0x1038ae=formatPrefixName(_0x4bc7b8[_0x1d7d('0x65')]);_0xe5c3ba['push'](new Extension(_0x1038ae,0x2,_0x1d7d('0x6b'),_0x1d7d('0x6c')+_0x4bc7b8[_0x1d7d('0x31')]));if(_0x4bc7b8[_0x1d7d('0x6d')]){_0xe5c3ba[_0x1d7d('0x6e')](new Extension(_0x1038ae,0x3,'Set',_0x1d7d('0x6f')+_0x4bc7b8[_0x1d7d('0x6d')]));}else{_0xe5c3ba['push'](new Extension(_0x1038ae,0x3,_0x1d7d('0x66'),_0x1d7d('0x70')));}_0xe5c3ba[_0x1d7d('0x6e')](new Extension(_0x1038ae,0x4,_0x1d7d('0x71'),_0x3b3975['context']+','+_0x1d7d('0x72')+(0x8+_0x4bc7b8['name'][_0x1d7d('0x40')])+'}'+','+0x1));return _0xe5c3ba;}function formatPrefixName(_0x138fc2){var _0x30dc64='_';for(var _0x5e1172=0x0;_0x5e1172<_0x138fc2[_0x1d7d('0x40')];_0x5e1172++){if(_0x138fc2[_0x1d7d('0x73')](_0x5e1172)=='-'){_0x30dc64+=_0x138fc2[_0x1d7d('0x73')](_0x5e1172);}else{_0x30dc64+='['+_0x138fc2['charAt'](_0x5e1172)+']';}}_0x30dc64+='.';return _0x30dc64;}exports[_0x1d7d('0x74')]=function(_0x47c1d5,_0x6e9ee6,_0x2a413b){var _0x131c8e=_0x47c1d5[_0x1d7d('0x75')];_0x131c8e[_0x1d7d('0x65')]=_0x1d7d('0x76')+_0x131c8e[_0x1d7d('0x31')]+'-';return db[_0x1d7d('0x52')][_0x1d7d('0x77')](function(_0x347877){return db[_0x1d7d('0x35')]['update'](_0x131c8e,{'where':{'id':_0x131c8e['id']},'transaction':_0x347877})['then'](function(){return db[_0x1d7d('0x53')][_0x1d7d('0x2f')]({'where':{'VoicePrefixId':_0x131c8e['id']},'transaction':_0x347877})[_0x1d7d('0x2c')](function(){return db['VoiceExtension'][_0x1d7d('0x57')]({'where':{'id':_0x131c8e['VoiceExtensionId']},'raw':!![]})[_0x1d7d('0x2c')](function(_0x33e656){return createVoicePrefixExtensions(_0x131c8e,_0x33e656,_0x347877);});});});})['then'](function(){return db[_0x1d7d('0x35')][_0x1d7d('0x78')](_0x131c8e['id']);})['then'](respondWithResult(_0x6e9ee6,null))[_0x1d7d('0x4d')](handleError(_0x6e9ee6,null));};exports[_0x1d7d('0x79')]=function(_0xc9b467,_0x50a21e,_0x47dc25){return db[_0x1d7d('0x35')][_0x1d7d('0x57')]({'where':{'id':_0xc9b467['params']['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0x50a21e,null))[_0x1d7d('0x2c')](function(_0x268046){if(_0x268046){return _0x268046[_0x1d7d('0x79')](_0xc9b467['body'][_0x1d7d('0x7a')],_[_0x1d7d('0x7b')](_0xc9b467[_0x1d7d('0x75')],[_0x1d7d('0x7a'),'id'])||{})[_0x1d7d('0x7c')](function(_0x38bddd){for(var _0x42a83c=0x0;_0x42a83c<_0xc9b467[_0x1d7d('0x75')][_0x1d7d('0x7a')][_0x1d7d('0x40')];_0x42a83c+=0x1){socket[_0x1d7d('0x7d')](_0x1d7d('0x7e'),{'UserId':Number(_0xc9b467[_0x1d7d('0x75')]['ids'][_0x42a83c]),'VoicePrefixId':Number(_0xc9b467[_0x1d7d('0x4e')]['id'])});}return _0x38bddd;});}})[_0x1d7d('0x2c')](respondWithResult(_0x50a21e,null))['catch'](handleError(_0x50a21e,null));};exports[_0x1d7d('0x7f')]=function(_0x2e4373,_0x5d1a0e,_0x5b61c1){return db['VoicePrefix'][_0x1d7d('0x57')]({'where':{'id':_0x2e4373[_0x1d7d('0x4e')]['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0x5d1a0e,null))[_0x1d7d('0x2c')](function(_0x4db998){if(_0x4db998){return _0x4db998[_0x1d7d('0x7f')](_0x2e4373[_0x1d7d('0x3b')][_0x1d7d('0x7a')])[_0x1d7d('0x2c')](function(){if(_['isArray'](_0x2e4373[_0x1d7d('0x3b')][_0x1d7d('0x7a')])){for(var _0x135910=0x0;_0x135910<_0x2e4373[_0x1d7d('0x3b')][_0x1d7d('0x7a')][_0x1d7d('0x40')];_0x135910+=0x1){socket['emit'](_0x1d7d('0x80'),{'UserId':Number(_0x2e4373[_0x1d7d('0x3b')]['ids'][_0x135910]),'VoicePrefixId':Number(_0x2e4373[_0x1d7d('0x4e')]['id'])});}}else{socket[_0x1d7d('0x7d')](_0x1d7d('0x80'),{'UserId':Number(_0x2e4373['query'][_0x1d7d('0x7a')]),'VoicePrefixId':Number(_0x2e4373['params']['id'])});}});}})[_0x1d7d('0x2c')](respondWithStatusCode(_0x5d1a0e,null))[_0x1d7d('0x4d')](handleError(_0x5d1a0e,null));};exports['getAgents']=function(_0x122483,_0x3390ab,_0xe381ff){var _0xc3c42f={};var _0x20b275={};var _0xb6519f;var _0x17ba85;return db[_0x1d7d('0x35')][_0x1d7d('0x81')]({'where':{'id':_0x122483[_0x1d7d('0x4e')]['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0x3390ab,null))[_0x1d7d('0x2c')](function(_0x4e635a){if(_0x4e635a){_0xb6519f=_0x4e635a;_0x20b275['model']=_[_0x1d7d('0x3c')](db[_0x1d7d('0x82')][_0x1d7d('0x36')]);_0x20b275[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x122483[_0x1d7d('0x3b')]);_0x20b275[_0x1d7d('0x3d')]=_[_0x1d7d('0x4f')](_0x20b275[_0x1d7d('0x3a')],_0x20b275[_0x1d7d('0x3b')]);_0xc3c42f[_0x1d7d('0x3e')]=_[_0x1d7d('0x4f')](_0x20b275['model'],qs[_0x1d7d('0x3f')](_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x3f')]));_0xc3c42f[_0x1d7d('0x3e')]=_0xc3c42f['attributes'][_0x1d7d('0x40')]?_0xc3c42f[_0x1d7d('0x3e')]:_0x20b275[_0x1d7d('0x3a')];_0xc3c42f[_0x1d7d('0x43')]=qs['sort'](_0x122483['query']['sort']);_0xc3c42f['where']=qs[_0x1d7d('0x3d')](_[_0x1d7d('0x46')](_0x122483['query'],_0x20b275['filters']));if(_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x47')]){_0xc3c42f[_0x1d7d('0x45')]=_[_0x1d7d('0x48')](_0xc3c42f[_0x1d7d('0x45')],{'$or':_[_0x1d7d('0x34')](_0xc3c42f[_0x1d7d('0x3e')],function(_0x35020c){var _0x2f2a28={};_0x2f2a28[_0x35020c]={'$like':'%'+_0x122483[_0x1d7d('0x3b')]['filter']+'%'};return _0x2f2a28;})});}_0xc3c42f=_[_0x1d7d('0x48')]({},_0xc3c42f,_0x122483['options']);return _0xb6519f[_0x1d7d('0x83')](_0xc3c42f);}})[_0x1d7d('0x2c')](function(_0x29186b){if(_0x29186b){_0x17ba85=_0x29186b['length'];if(!_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x41')](_0x1d7d('0x42'))){_0xc3c42f[_0x1d7d('0x27')]=qs[_0x1d7d('0x27')](_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x27')]);_0xc3c42f[_0x1d7d('0x24')]=qs[_0x1d7d('0x24')](_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x24')]);}return _0xb6519f[_0x1d7d('0x83')](_0xc3c42f);}})[_0x1d7d('0x2c')](function(_0xd6c7ad){if(_0xd6c7ad){return _0xd6c7ad?{'count':_0x17ba85,'rows':_0xd6c7ad}:null;}})[_0x1d7d('0x2c')](respondWithResult(_0x3390ab,null))[_0x1d7d('0x4d')](handleError(_0x3390ab,null));};exports[_0x1d7d('0x84')]=function(_0x2aac19,_0x37ba0e,_0x443c53){var _0x689a17={};var _0x65407b={};var _0xecfc39;var _0x4fac26;return db[_0x1d7d('0x35')][_0x1d7d('0x81')]({'where':{'id':_0x2aac19[_0x1d7d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x37ba0e,null))[_0x1d7d('0x2c')](function(_0x589609){if(_0x589609){_0xecfc39=_0x589609;_0x65407b['model']=_['keys'](db['Team'][_0x1d7d('0x36')]);_0x65407b[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x2aac19['query']);_0x65407b[_0x1d7d('0x3d')]=_['intersection'](_0x65407b[_0x1d7d('0x3a')],_0x65407b[_0x1d7d('0x3b')]);_0x689a17[_0x1d7d('0x3e')]=_[_0x1d7d('0x4f')](_0x65407b[_0x1d7d('0x3a')],qs[_0x1d7d('0x3f')](_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x3f')]));_0x689a17[_0x1d7d('0x3e')]=_0x689a17[_0x1d7d('0x3e')][_0x1d7d('0x40')]?_0x689a17['attributes']:_0x65407b[_0x1d7d('0x3a')];_0x689a17[_0x1d7d('0x43')]=qs[_0x1d7d('0x44')](_0x2aac19['query'][_0x1d7d('0x44')]);_0x689a17[_0x1d7d('0x45')]=qs[_0x1d7d('0x3d')](_['pick'](_0x2aac19['query'],_0x65407b[_0x1d7d('0x3d')]));if(_0x2aac19['query'][_0x1d7d('0x47')]){_0x689a17[_0x1d7d('0x45')]=_['merge'](_0x689a17[_0x1d7d('0x45')],{'$or':_[_0x1d7d('0x34')](_0x689a17['attributes'],function(_0x3cfd3d){var _0xd0d1b5={};_0xd0d1b5[_0x3cfd3d]={'$like':'%'+_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x47')]+'%'};return _0xd0d1b5;})});}_0x689a17=_['merge']({},_0x689a17,_0x2aac19['options']);return _0xecfc39[_0x1d7d('0x84')](_0x689a17);}})[_0x1d7d('0x2c')](function(_0x3c257c){if(_0x3c257c){_0x4fac26=_0x3c257c[_0x1d7d('0x40')];if(!_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x41')](_0x1d7d('0x42'))){_0x689a17[_0x1d7d('0x27')]=qs[_0x1d7d('0x27')](_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x27')]);_0x689a17[_0x1d7d('0x24')]=qs[_0x1d7d('0x24')](_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x24')]);}return _0xecfc39[_0x1d7d('0x84')](_0x689a17);}})[_0x1d7d('0x2c')](function(_0x1c1ace){if(_0x1c1ace){return _0x1c1ace?{'count':_0x4fac26,'rows':_0x1c1ace}:null;}})['then'](respondWithResult(_0x37ba0e,null))[_0x1d7d('0x4d')](handleError(_0x37ba0e,null));};exports[_0x1d7d('0x85')]=function(_0x16ce51,_0x20b99d,_0x5ca824){var _0x4096cf=_0x16ce51[_0x1d7d('0x75')][_0x1d7d('0x7a')];var _0x1d1a34;return db['Team'][_0x1d7d('0x4b')]({'where':{'id':_0x4096cf},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1d7d('0x86'),'attributes':['id',_0x1d7d('0x31'),_0x1d7d('0x87'),'voicePause',_0x1d7d('0x88')],'raw':!![]}]})['then'](function(_0x341e74){if(_0x341e74){_0x1d1a34=_0x341e74;var _0x1c1077=_[_0x1d7d('0x89')](_0x341e74,function(_0x466208){var _0x4bbdc8=_0x466208[_0x1d7d('0x2d')]({'plain':!![]});return _0x4bbdc8['Agents'];});return db[_0x1d7d('0x35')][_0x1d7d('0x57')]({'where':{'id':_0x16ce51['params']['id']}})[_0x1d7d('0x2c')](function(_0x3dc8ee){return db[_0x1d7d('0x52')][_0x1d7d('0x77')](function(_0x4dca1d){return _0x3dc8ee['addTeams'](_0x4096cf,{'transaction':_0x4dca1d})['then'](function(){return BPromise[_0x1d7d('0x8a')](_0x1d1a34,function(_0x3ae715){return db[_0x1d7d('0x8b')][_0x1d7d('0x8c')]({'TeamId':_0x3ae715['id'],'VoicePrefixId':_0x16ce51[_0x1d7d('0x4e')]['id']},{'transaction':_0x4dca1d});});})['then'](function(){return BPromise[_0x1d7d('0x8a')](_0x1c1077,function(_0x41874){return db[_0x1d7d('0x8d')][_0x1d7d('0x8e')]({'where':{'UserId':_0x41874['id'],'VoicePrefixId':_0x16ce51['params']['id']},'transaction':_0x4dca1d});});})['then'](function(){_0x1c1077[_0x1d7d('0x8f')](function(_0x21995f){socket[_0x1d7d('0x7d')](_0x1d7d('0x7e'),{'UserId':_0x21995f['id'],'VoicePrefixId':_0x3dc8ee['id']});});});});});}})[_0x1d7d('0x2c')](respondWithStatusCode(_0x20b99d,null))[_0x1d7d('0x4d')](handleError(_0x20b99d,null));};exports['removeTeams']=function(_0x37863c,_0x5cf31f,_0x42893a){return db[_0x1d7d('0x90')]['findAll']({'where':{'id':_0x37863c[_0x1d7d('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1d7d('0x82')],'as':_0x1d7d('0x86'),'attributes':['id'],'raw':!![]}]})[_0x1d7d('0x2c')](handleEntityNotFound(_0x5cf31f,null))[_0x1d7d('0x2c')](function(_0xa5c124){var _0x481997=_[_0x1d7d('0x34')](_0xa5c124,'id');var _0x572be9=[];var _0x303d6f=[];var _0x5bf0de=squel['select']();_0x5bf0de[_0x1d7d('0x91')](_0x1d7d('0x92'))[_0x1d7d('0x93')](_0x1d7d('0x94'),'tq')[_0x1d7d('0x95')](_0x1d7d('0x96'),'ut',_0x1d7d('0x97'))[_0x1d7d('0x45')](_0x1d7d('0x98'),_0x37863c[_0x1d7d('0x4e')]['id']);for(var _0x3e94d6=0x0;_0x3e94d6<_0xa5c124[_0x1d7d('0x40')];_0x3e94d6+=0x1){let _0x5a05a3=_0xa5c124[_0x3e94d6];for(var _0x542ae6=0x0;_0x542ae6<_0x5a05a3[_0x1d7d('0x86')]['length'];_0x542ae6+=0x1){let _0x43ee13=_0x5a05a3['Agents'][_0x542ae6];var _0x489649=_0x5bf0de[_0x1d7d('0x99')]();_0x489649[_0x1d7d('0x45')](_0x1d7d('0x9a'),_0x43ee13['id']);_0x303d6f[_0x1d7d('0x6e')](db[_0x1d7d('0x52')][_0x1d7d('0x3b')](_0x489649[_0x1d7d('0x9b')](),{'type':db[_0x1d7d('0x52')][_0x1d7d('0x9c')]['SELECT']})['then'](function(_0x38cde1){if(_0x38cde1['length']===0x1){return _0x43ee13['id'];}else{var _0x3d863b=_[_0x1d7d('0x9d')](_[_0x1d7d('0x34')](_0x38cde1,_0x1d7d('0x9e')),function(_0x10b561){return _[_0x1d7d('0x9f')](_0x481997,_0x10b561);});if(_0x3d863b){return _0x43ee13['id'];}}}));}}return BPromise[_0x1d7d('0xa0')](_0x303d6f)[_0x1d7d('0x2c')](function(_0x2dfb5c){_0x572be9=_(_0x572be9)[_0x1d7d('0xa1')](_0x2dfb5c)[_0x1d7d('0xa2')]()[_0x1d7d('0xa3')]();return db['VoicePrefix']['find']({'where':{'id':_0x37863c[_0x1d7d('0x4e')]['id']}})[_0x1d7d('0x2c')](function(_0xfd4b25){return db['sequelize']['transaction'](function(_0x19a53b){return _0xfd4b25[_0x1d7d('0xa4')](_0x37863c['query'][_0x1d7d('0x7a')],{'transaction':_0x19a53b})['then'](function(){if(!_[_0x1d7d('0xa5')](_0x572be9)){return _0xfd4b25['removeAgents'](_0x572be9,{'transaction':_0x19a53b});}})[_0x1d7d('0x2c')](function(){_0x572be9[_0x1d7d('0x8f')](function(_0x44f307){socket[_0x1d7d('0x7d')](_0x1d7d('0x80'),{'UserId':_0x44f307,'VoicePrefixId':_0xfd4b25['id']});});});});});});})[_0x1d7d('0x2c')](respondWithStatusCode(_0x5cf31f,null))[_0x1d7d('0x4d')](handleError(_0x5cf31f,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3dfd503..6c4f81f 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 _0xd656=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','VoicePrefix'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xd656,0xa6));var _0x6d65=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd656[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x6d65('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x6d65('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6d65('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d65('0x3'),'afterDestroy':_0x6d65('0x4')};function emitEvent(_0x140456){return function(_0x513d7d,_0x160315,_0x3ce961){VoicePrefixEvents[_0x6d65('0x5')](_0x140456+':'+_0x513d7d['id'],_0x513d7d);VoicePrefixEvents[_0x6d65('0x5')](_0x140456,_0x513d7d);_0x3ce961(null);};}for(var e in events){if(events[_0x6d65('0x6')](e)){var event=events[e];VoicePrefix[_0x6d65('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x4354=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x12ab4d,_0x3ad65d){var _0x1d21e6=function(_0x13bf4b){while(--_0x13bf4b){_0x12ab4d['push'](_0x12ab4d['shift']());}};_0x1d21e6(++_0x3ad65d);}(_0x4354,0xd5));var _0x4435=function(_0x1e1a30,_0x24fdcc){_0x1e1a30=_0x1e1a30-0x0;var _0x163e9e=_0x4354[_0x1e1a30];return _0x163e9e;};'use strict';var EventEmitter=require(_0x4435('0x0'));var VoicePrefix=require(_0x4435('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4435('0x2'),'afterUpdate':_0x4435('0x3'),'afterDestroy':_0x4435('0x4')};function emitEvent(_0x508904){return function(_0x5ca1cc,_0xa8adab,_0x4449f7){VoicePrefixEvents[_0x4435('0x5')](_0x508904+':'+_0x5ca1cc['id'],_0x5ca1cc);VoicePrefixEvents[_0x4435('0x5')](_0x508904,_0x5ca1cc);_0x4449f7(null);};}for(var e in events){if(events[_0x4435('0x6')](e)){var event=events[e];VoicePrefix[_0x4435('0x7')](e,emitEvent(event));}}module[_0x4435('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 9a04384..013aec3 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 _0x7f68=['api','moment','bluebird','request-promise','path','../../config/environment','define','voice_prefixes','lodash','util','../../config/logger'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7f68,0xce));var _0x87f6=function(_0xf95114,_0x3a96dc){_0xf95114=_0xf95114-0x0;var _0x1d135c=_0x7f68[_0xf95114];return _0x1d135c;};'use strict';var _=require(_0x87f6('0x0'));var util=require(_0x87f6('0x1'));var logger=require(_0x87f6('0x2'))(_0x87f6('0x3'));var moment=require(_0x87f6('0x4'));var BPromise=require(_0x87f6('0x5'));var rp=require(_0x87f6('0x6'));var fs=require('fs');var path=require(_0x87f6('0x7'));var rimraf=require('rimraf');var config=require(_0x87f6('0x8'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x1f4b85,_0x3fa2a1){return _0x1f4b85[_0x87f6('0x9')]('VoicePrefix',attributes,{'tableName':_0x87f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73c1=['./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3e311c,_0x462325){var _0x295852=function(_0x2a37d4){while(--_0x2a37d4){_0x3e311c['push'](_0x3e311c['shift']());}};_0x295852(++_0x462325);}(_0x73c1,0x126));var _0x173c=function(_0x219def,_0x43b89b){_0x219def=_0x219def-0x0;var _0x265f81=_0x73c1[_0x219def];return _0x265f81;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x173c('0x0'))(_0x173c('0x1'));var moment=require(_0x173c('0x2'));var BPromise=require('bluebird');var rp=require(_0x173c('0x3'));var fs=require('fs');var path=require(_0x173c('0x4'));var rimraf=require(_0x173c('0x5'));var config=require('../../config/environment');var attributes=require(_0x173c('0x6'));module[_0x173c('0x7')]=function(_0x390ced,_0x128999){return _0x390ced['define'](_0x173c('0x8'),attributes,{'tableName':_0x173c('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 6c2a51f..e76a259 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 _0xa899=['error','message','VoicePrefix,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voicePrefix.socket','request','then','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','code'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xa899,0x155));var _0x9a89=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0xa899[_0x2e53e1];return _0x3a23de;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var moment=require(_0x9a89('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a89('0x3'));var fs=require('fs');var Redis=require(_0x9a89('0x4'));var db=require(_0x9a89('0x5'))['db'];var utils=require(_0x9a89('0x6'));var logger=require(_0x9a89('0x7'))(_0x9a89('0x8'));var config=require(_0x9a89('0x9'));var jayson=require(_0x9a89('0xa'));var client=jayson[_0x9a89('0xb')][_0x9a89('0xc')]({'port':0x232a});config[_0x9a89('0xd')]=_[_0x9a89('0xe')](config[_0x9a89('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a89('0xd')]));require(_0x9a89('0xf'))['register'](socket);function respondWithRpcPromise(_0xccf078,_0x4f487d,_0x111d99){return new BPromise(function(_0x2a9e30,_0x401680){return client[_0x9a89('0x10')](_0xccf078,_0x111d99)[_0x9a89('0x11')](function(_0xc61526){logger[_0x9a89('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x4f487d,'request\x20sent');logger[_0x9a89('0x13')](_0x9a89('0x14'),_0x4f487d,_0x9a89('0x15'),JSON['stringify'](_0xc61526));if(_0xc61526['error']){if(_0xc61526['error'][_0x9a89('0x16')]===0x1f4){logger[_0x9a89('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4f487d,_0xc61526[_0x9a89('0x17')][_0x9a89('0x18')]);return _0x401680(_0xc61526[_0x9a89('0x17')][_0x9a89('0x18')]);}logger['error'](_0x9a89('0x19'),_0x4f487d,_0xc61526[_0x9a89('0x17')]['message']);return _0x2a9e30(_0xc61526['error'][_0x9a89('0x18')]);}else{logger['info'](_0x9a89('0x19'),_0x4f487d,_0x9a89('0x15'));_0x2a9e30(_0xc61526['result'][_0x9a89('0x18')]);}})['catch'](function(_0x2d648f){logger[_0x9a89('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4f487d,_0x2d648f);_0x401680(_0x2d648f);});});} \ No newline at end of file +var _0x4dcb=['request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x586459,_0x2e107b){var _0x4381c2=function(_0xd0fd3b){while(--_0xd0fd3b){_0x586459['push'](_0x586459['shift']());}};_0x4381c2(++_0x2e107b);}(_0x4dcb,0x186));var _0xb4dc=function(_0x18f509,_0x3ca231){_0x18f509=_0x18f509-0x0;var _0x55c15a=_0x4dcb[_0x18f509];return _0x55c15a;};'use strict';var _=require('lodash');var util=require(_0xb4dc('0x0'));var moment=require(_0xb4dc('0x1'));var BPromise=require(_0xb4dc('0x2'));var rs=require(_0xb4dc('0x3'));var fs=require('fs');var Redis=require(_0xb4dc('0x4'));var db=require(_0xb4dc('0x5'))['db'];var utils=require(_0xb4dc('0x6'));var logger=require(_0xb4dc('0x7'))(_0xb4dc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb4dc('0x9')]['http']({'port':0x232a});config[_0xb4dc('0xa')]=_[_0xb4dc('0xb')](config[_0xb4dc('0xa')],{'host':_0xb4dc('0xc'),'port':0x18eb});var socket=require(_0xb4dc('0xd'))(new Redis(config[_0xb4dc('0xa')]));require('./voicePrefix.socket')[_0xb4dc('0xe')](socket);function respondWithRpcPromise(_0x43e354,_0x9b7f60,_0x1a1872){return new BPromise(function(_0x3fd9ec,_0x27a1bb){return client[_0xb4dc('0xf')](_0x43e354,_0x1a1872)[_0xb4dc('0x10')](function(_0x2746b0){logger[_0xb4dc('0x11')](_0xb4dc('0x12'),_0x9b7f60,_0xb4dc('0x13'));logger[_0xb4dc('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x9b7f60,_0xb4dc('0x13'),JSON[_0xb4dc('0x15')](_0x2746b0));if(_0x2746b0[_0xb4dc('0x16')]){if(_0x2746b0[_0xb4dc('0x16')][_0xb4dc('0x17')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x9b7f60,_0x2746b0[_0xb4dc('0x16')][_0xb4dc('0x18')]);return _0x27a1bb(_0x2746b0[_0xb4dc('0x16')][_0xb4dc('0x18')]);}logger[_0xb4dc('0x16')](_0xb4dc('0x12'),_0x9b7f60,_0x2746b0['error']['message']);return _0x3fd9ec(_0x2746b0[_0xb4dc('0x16')][_0xb4dc('0x18')]);}else{logger[_0xb4dc('0x11')](_0xb4dc('0x12'),_0x9b7f60,_0xb4dc('0x13'));_0x3fd9ec(_0x2746b0[_0xb4dc('0x19')][_0xb4dc('0x18')]);}})[_0xb4dc('0x1a')](function(_0x2040cb){logger[_0xb4dc('0x16')](_0xb4dc('0x12'),_0x9b7f60,_0x2040cb);_0x27a1bb(_0x2040cb);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c77a2b0..0084b35 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 _0x7834=['voicePrefix:','./voicePrefix.events','update','emit','removeListener','register'];(function(_0xa58076,_0x5a16a4){var _0x318015=function(_0x457df6){while(--_0x457df6){_0xa58076['push'](_0xa58076['shift']());}};_0x318015(++_0x5a16a4);}(_0x7834,0x13f));var _0x4783=function(_0x36fe63,_0x13af61){_0x36fe63=_0x36fe63-0x0;var _0x33841c=_0x7834[_0x36fe63];return _0x33841c;};'use strict';var VoicePrefixEvents=require(_0x4783('0x0'));var events=['save','remove',_0x4783('0x1')];function createListener(_0x51b60a,_0x15dbb4){return function(_0x30c3ee){_0x15dbb4[_0x4783('0x2')](_0x51b60a,_0x30c3ee);};}function removeListener(_0x2ebef6,_0x29566c){return function(){VoicePrefixEvents[_0x4783('0x3')](_0x2ebef6,_0x29566c);};}exports[_0x4783('0x4')]=function(_0x49114c){for(var _0x1cb674=0x0,_0xf8c030=events['length'];_0x1cb674<_0xf8c030;_0x1cb674++){var _0x2dcf46=events[_0x1cb674];var _0x16c83e=createListener(_0x4783('0x5')+_0x2dcf46,_0x49114c);VoicePrefixEvents['on'](_0x2dcf46,_0x16c83e);}}; \ No newline at end of file +var _0x94dc=['register','voicePrefix:','./voicePrefix.events','remove','removeListener'];(function(_0x1181d8,_0x49abfb){var _0x407233=function(_0x5eea5d){while(--_0x5eea5d){_0x1181d8['push'](_0x1181d8['shift']());}};_0x407233(++_0x49abfb);}(_0x94dc,0xb1));var _0xc94d=function(_0x5ac272,_0x2b8183){_0x5ac272=_0x5ac272-0x0;var _0x555a17=_0x94dc[_0x5ac272];return _0x555a17;};'use strict';var VoicePrefixEvents=require(_0xc94d('0x0'));var events=['save',_0xc94d('0x1'),'update'];function createListener(_0x1645b0,_0x1b2070){return function(_0x40e7d8){_0x1b2070['emit'](_0x1645b0,_0x40e7d8);};}function removeListener(_0x306706,_0x41d4ec){return function(){VoicePrefixEvents[_0xc94d('0x2')](_0x306706,_0x41d4ec);};}exports[_0xc94d('0x3')]=function(_0x3c0601){for(var _0x344188=0x0,_0xb7275c=events['length'];_0x344188<_0xb7275c;_0x344188++){var _0x2f9757=events[_0x344188];var _0xbe5904=createListener(_0xc94d('0x4')+_0x2f9757,_0x3c0601);VoicePrefixEvents['on'](_0x2f9757,_0xbe5904);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d8ba6ab..9b573cc 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(_0x1b3c40,_0x48cc44){var _0x54a769=function(_0x13fbe5){while(--_0x13fbe5){_0x1b3c40['push'](_0x1b3c40['shift']());}};_0x54a769(++_0x48cc44);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0xb06221,_0x3b47da){var _0x542c06=function(_0x5cd5ff){while(--_0x5cd5ff){_0xb06221['push'](_0xb06221['shift']());}};_0x542c06(++_0x3b47da);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 bbd7f96..314d0a9 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 _0x5ec9=['ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','INTEGER','yes','once','TEXT','periodic_announce','join','joinempty','leavewhenempty','BOOLEAN','wrapuptime','preview','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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)','#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\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','ENUM','inbound','outbound','STRING','default','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered'];(function(_0x5bd9d0,_0x358a63){var _0x4a1649=function(_0x5e4bac){while(--_0x5e4bac){_0x5bd9d0['push'](_0x5bd9d0['shift']());}};_0x4a1649(++_0x358a63);}(_0x5ec9,0x126));var _0x95ec=function(_0x753c33,_0x592175){_0x753c33=_0x753c33-0x0;var _0xb25268=_0x5ec9[_0x753c33];return _0xb25268;};'use strict';var Sequelize=require('sequelize');module[_0x95ec('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x95ec('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x3'),_0x95ec('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':_0x95ec('0x6')},'announce':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x95ec('0x7'),_0x95ec('0x8'),_0x95ec('0x9'),_0x95ec('0xa'),_0x95ec('0xb'),_0x95ec('0xc'),_0x95ec('0xd')),'allowNull':![],'defaultValue':_0x95ec('0xe'),'set':function(_0x4eda9c){this[_0x95ec('0xf')](_0x95ec('0x10'),_0x4eda9c?_0x4eda9c:_0x95ec('0xa'));},'get':function(){var _0x3ae772=this[_0x95ec('0x11')](_0x95ec('0x12'));var _0x189f08=this[_0x95ec('0x11')](_0x95ec('0x13'));var _0x1b1c2e=this[_0x95ec('0x11')](_0x95ec('0x10'));if(_0x3ae772===_0x95ec('0x3')){return _0x1b1c2e;}if(_0x189f08===_0x95ec('0x14')&&_0x1b1c2e===_0x95ec('0xa')||_0x189f08===_0x95ec('0x14')&&_0x1b1c2e===_0x95ec('0x15')){return _0x1b1c2e;}if(_0x189f08==='progressive'||_0x189f08==='predictive'||_0x189f08==='power'){return _0x1b1c2e;}return null;}},'servicelevel':{'type':Sequelize[_0x95ec('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x95ec('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x95ec('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x95ec('0x5')]},'weight':{'type':Sequelize[_0x95ec('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x95ec('0x2')]('yes','no'),'defaultValue':_0x95ec('0x17')},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x95ec('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x95ec('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x95ec('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x95ec('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x95ec('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x95ec('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[_0x95ec('0x2')](_0x95ec('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x17'),'no'),'defaultValue':_0x95ec('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x95ec('0x17'),'no',_0x95ec('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x95ec('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x95ec('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x95ec('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x95ec('0x5')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x95ec('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x95ec('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x95ec('0x5')]},'queue_less_than':{'type':Sequelize[_0x95ec('0x5')]},'periodic_announce':{'type':Sequelize[_0x95ec('0x19')],'set':function(_0x1b42cd){this[_0x95ec('0xf')](_0x95ec('0x1a'),_0x1b42cd?_0x1b42cd[_0x95ec('0x1b')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x95ec('0x11')](_0x95ec('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':_0x95ec('0x17'),'set':function(_0x267751){this['setDataValue'](_0x95ec('0x1c'),_0x267751?_0x267751[_0x95ec('0x1b')](','):undefined);},'get':function(){return this[_0x95ec('0x11')](_0x95ec('0x1c'))?this[_0x95ec('0x11')](_0x95ec('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':'no','set':function(_0x1ba0e6){this[_0x95ec('0xf')](_0x95ec('0x1d'),_0x1ba0e6?_0x1ba0e6[_0x95ec('0x1b')](','):undefined);},'get':function(){return this[_0x95ec('0x11')]('leavewhenempty')?this[_0x95ec('0x11')](_0x95ec('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x95ec('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x95ec('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x95ec('0x5')]},'description':{'type':Sequelize[_0x95ec('0x5')]},'acw':{'type':Sequelize[_0x95ec('0x1e')],'defaultValue':0x0,'set':function(_0x5eca15){this['setDataValue']('acw',_0x5eca15);if(_0x5eca15){if(this['getDataValue'](_0x95ec('0x1f'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x95ec('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x20'),_0x95ec('0x21'),_0x95ec('0x22'),'predictive',_0x95ec('0x14')),'defaultValue':'progressive','comment':_0x95ec('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x95ec('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x95ec('0x16')](0x4)[_0x95ec('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x95ec('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x95ec('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x26'),'dropRate'),'defaultValue':_0x95ec('0x27'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x95ec('0x28')](0x2)[_0x95ec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x95ec('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x95ec('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x95ec('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x95ec('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x95ec('0x2a'),'comment':_0x95ec('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x95ec('0x16')](0x3)[_0x95ec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x95ec('0x2c')},'dialQueueProject':{'type':Sequelize[_0x95ec('0x5')],'comment':_0x95ec('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x95ec('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x95ec('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95ec('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x95ec('0x16')](0x3)[_0x95ec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x95ec('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x95ec('0x16')](0x5)[_0x95ec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x95ec('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x95ec('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x95ec('0x16')](0x5)[_0x95ec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95ec('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x95ec('0x16')](0x3)[_0x95ec('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x95ec('0x32')},'dialTimezone':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':_0x95ec('0x33')},'dialPrefix':{'type':Sequelize[_0x95ec('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x95ec('0x2')](_0x95ec('0x34'),_0x95ec('0x35'),_0x95ec('0x36')),'defaultValue':_0x95ec('0x34')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x95ec('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x95ec('0x16')](0x9)[_0x95ec('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x95ec('0x38')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x95ec('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x95ec('0x16')](0x9)[_0x95ec('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x95ec('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x95ec('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x95ec('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x95ec('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x95ec('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x95ec('0x16')](0x9)[_0x95ec('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x95ec('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x95ec('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x95ec('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x95ec('0x16')](0x9)[_0x95ec('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x95ec('0x16')](0x5)[_0x95ec('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x95ec('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0x95ec('0x1e')],'defaultValue':0x0,'comment':_0x95ec('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x95ec('0x2')]('DESC',_0x95ec('0x40')),'defaultValue':_0x95ec('0x41')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x95ec('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x95ec('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x95ec('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x95ec('0x16')](0x3)[_0x95ec('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x95ec('0x42')},'dialCutDigit':{'type':Sequelize[_0x95ec('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x95ec('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x95ec('0x16')](0x3)[_0x95ec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x95ec('0x16')](0x5)[_0x95ec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95ec('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x95ec('0x16')](0x3)[_0x95ec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x95ec('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x95ec('0x16')](0x5)[_0x95ec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x95ec('0x16')](0x5)[_0x95ec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95ec('0x46')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x95ec('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x95ec('0x16')](0x5)[_0x95ec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x95ec('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x95ec('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x95ec('0x16')](0x5)[_0x95ec('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95ec('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x95ec('0x16')],'allowNull':!![],'comment':_0x95ec('0x49')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x95ec('0x4a'),'set':function(_0x57a410){if(!_0x57a410)this[_0x95ec('0xf')](_0x95ec('0x4b'),null);this['setDataValue'](_0x95ec('0x4c'),_0x57a410);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x95ec('0x16')](0x3)[_0x95ec('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x95ec('0x16')](0x3)[_0x95ec('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x95ec('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x95ec('0x16')](0x3)[_0x95ec('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x95ec('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x95fe=['#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','rrmemory','rrordered','strategy','getDataValue','type','dialMethod','booked','progressive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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\x20Initial\x20Silence'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x95fe,0x15e));var _0xe95f=function(_0x556b1d,_0xa0f67e){_0x556b1d=_0x556b1d-0x0;var _0x346381=_0x95fe[_0x556b1d];return _0x346381;};'use strict';var Sequelize=require(_0xe95f('0x0'));module[_0xe95f('0x1')]={'name':{'type':Sequelize[_0xe95f('0x2')],'allowNull':![],'unique':_0xe95f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x5'),_0xe95f('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':_0xe95f('0x7')},'announce':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xe95f('0x4')]('rr','ringall',_0xe95f('0x8'),_0xe95f('0x9'),'random',_0xe95f('0xa'),'linear','wrandom',_0xe95f('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x330c60){this['setDataValue'](_0xe95f('0xc'),_0x330c60?_0x330c60:_0xe95f('0xa'));},'get':function(){var _0x5e9874=this[_0xe95f('0xd')](_0xe95f('0xe'));var _0x18f9e=this[_0xe95f('0xd')](_0xe95f('0xf'));var _0x23586d=this['getDataValue'](_0xe95f('0xc'));if(_0x5e9874===_0xe95f('0x5')){return _0x23586d;}if(_0x18f9e===_0xe95f('0x10')&&_0x23586d===_0xe95f('0xa')||_0x18f9e===_0xe95f('0x10')&&_0x23586d==='roundrobin'){return _0x23586d;}if(_0x18f9e===_0xe95f('0x11')||_0x18f9e==='predictive'||_0x18f9e===_0xe95f('0x12')){return _0x23586d;}return null;}},'servicelevel':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe95f('0x13')](0xb)},'timeout':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe95f('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xe95f('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no',_0xe95f('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xe95f('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xe95f('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xe95f('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe95f('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe95f('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe95f('0x4')]('yes','no'),'defaultValue':_0xe95f('0x14')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0xe95f('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0xe95f('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe95f('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe95f('0x2')]},'queue_youarenext':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe95f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe95f('0x2')]},'queue_quantity1':{'type':Sequelize[_0xe95f('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xe95f('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xe95f('0x17')],'set':function(_0x152d1b){this[_0xe95f('0x18')](_0xe95f('0x19'),_0x152d1b?_0x152d1b[_0xe95f('0x1a')](','):[]);},'get':function(){return this[_0xe95f('0xd')](_0xe95f('0x19'))?this[_0xe95f('0xd')]('periodic_announce')[_0xe95f('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':'yes','set':function(_0x118407){this[_0xe95f('0x18')]('joinempty',_0x118407?_0x118407['join'](','):undefined);},'get':function(){return this['getDataValue'](_0xe95f('0x1c'))?this[_0xe95f('0xd')]('joinempty')[_0xe95f('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':'no','set':function(_0x3429e8){this[_0xe95f('0x18')]('leavewhenempty',_0x3429e8?_0x3429e8[_0xe95f('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xe95f('0x1d'))?this[_0xe95f('0xd')](_0xe95f('0x1d'))[_0xe95f('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe95f('0x2')]},'description':{'type':Sequelize[_0xe95f('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x550e02){this[_0xe95f('0x18')](_0xe95f('0x1e'),_0x550e02);if(_0x550e02){if(this['getDataValue'](_0xe95f('0x1f'))<0x2){this[_0xe95f('0x18')](_0xe95f('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe95f('0x20')},'dialMethod':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x21'),_0xe95f('0x11'),_0xe95f('0x12'),_0xe95f('0x22'),_0xe95f('0x10')),'defaultValue':_0xe95f('0x11'),'comment':_0xe95f('0x23')},'dialLimitChannel':{'type':Sequelize[_0xe95f('0x13')](0x4)[_0xe95f('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xe95f('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe95f('0x25')},'dialPowerLevel':{'type':Sequelize[_0xe95f('0x26')](0x2)[_0xe95f('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe95f('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xe95f('0x28'),'dropRate'),'defaultValue':_0xe95f('0x29'),'comment':_0xe95f('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe95f('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xe95f('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xe95f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':_0xe95f('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x2e')},'dialQueueProject':{'type':Sequelize[_0xe95f('0x2')],'comment':_0xe95f('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'comment':_0xe95f('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe95f('0x34')},'dialTimezone':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':_0xe95f('0x35')},'dialPrefix':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x36'),_0xe95f('0x37'),_0xe95f('0x38')),'defaultValue':_0xe95f('0x36')},'dialAMDActive':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':0x0,'comment':_0xe95f('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe95f('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe95f('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe95f('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe95f('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xe95f('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe95f('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe95f('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe95f('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe95f('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe95f('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x43'),_0xe95f('0x44')),'defaultValue':_0xe95f('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe95f('0x45')},'dialCutDigit':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe95f('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xe95f('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':![],'comment':_0xe95f('0x4f'),'set':function(_0x34eaaf){if(!_0x34eaaf)this[_0xe95f('0x18')](_0xe95f('0x50'),null);this[_0xe95f('0x18')](_0xe95f('0x51'),_0x34eaaf);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe95f('0x13')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xe95f('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe95f('0x13')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9cce355..4b97870 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 _0x9206=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','VoiceQueue','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','nolimit','sort','filters','where','options','includeAll','include','findAll','rows','catch','show','length','merge','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','createdAt','updatedAt','omit','update','getHoppers','findOne','CmHopper','hasOwnProperty','order','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','interface','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_voice_queues','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','userVoiceQueue:remove','addAgents','spread','isEmpty','removeAgents','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','all','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','join','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x503946,_0x4bfc24){var _0x40ee19=function(_0x4c382e){while(--_0x4c382e){_0x503946['push'](_0x503946['shift']());}};_0x40ee19(++_0x4bfc24);}(_0x9206,0x176));var _0x6920=function(_0x154bd1,_0x5a050c){_0x154bd1=_0x154bd1-0x0;var _0x39d685=_0x9206[_0x154bd1];return _0x39d685;};'use strict';var emlformat=require(_0x6920('0x0'));var rimraf=require(_0x6920('0x1'));var zipdir=require(_0x6920('0x2'));var jsonpatch=require(_0x6920('0x3'));var rp=require(_0x6920('0x4'));var moment=require(_0x6920('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6920('0x6'));var path=require(_0x6920('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6920('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6920('0x9'));var squel=require(_0x6920('0xa'));var crypto=require(_0x6920('0xb'));var jsforce=require(_0x6920('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6920('0xd'));var Papa=require(_0x6920('0xe'));var Redis=require(_0x6920('0xf'));var authService=require(_0x6920('0x10'));var qs=require(_0x6920('0x11'));var as=require(_0x6920('0x12'));var hardwareService=require(_0x6920('0x13'));var logger=require(_0x6920('0x14'))(_0x6920('0x15'));var utils=require(_0x6920('0x16'));var config=require(_0x6920('0x17'));var licenseUtil=require(_0x6920('0x18'));var db=require(_0x6920('0x19'))['db'];config['redis']=_['defaults'](config[_0x6920('0x1a')],{'host':_0x6920('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6920('0x1a')]));require(_0x6920('0x1c'))[_0x6920('0x1d')](socket);function respondWithStatusCode(_0x2c3a35,_0x17c6e9){_0x17c6e9=_0x17c6e9||0xcc;return function(_0x4b39c4){if(_0x4b39c4){return _0x2c3a35[_0x6920('0x1e')](_0x17c6e9);}return _0x2c3a35[_0x6920('0x1f')](_0x17c6e9)[_0x6920('0x20')]();};}function respondWithResult(_0xa64034,_0x289b73){_0x289b73=_0x289b73||0xc8;return function(_0x3e94ee){if(_0x3e94ee){return _0xa64034[_0x6920('0x1f')](_0x289b73)[_0x6920('0x21')](_0x3e94ee);}};}function respondWithFilteredResult(_0x11ce91,_0x2d04e7){return function(_0x462500){if(_0x462500){var _0x3d0059=typeof _0x2d04e7[_0x6920('0x22')]===_0x6920('0x23')&&typeof _0x2d04e7[_0x6920('0x24')]==='undefined';var _0x3a0c0c=_0x462500[_0x6920('0x25')];var _0x377e25=_0x3d0059?0x0:_0x2d04e7[_0x6920('0x22')];var _0xf4b5bd=_0x3d0059?_0x462500[_0x6920('0x25')]:_0x2d04e7[_0x6920('0x22')]+_0x2d04e7[_0x6920('0x24')];var _0xaf93ba;if(_0xf4b5bd>=_0x3a0c0c){_0xf4b5bd=_0x3a0c0c;_0xaf93ba=0xc8;}else{_0xaf93ba=0xce;}_0x11ce91[_0x6920('0x1f')](_0xaf93ba);return _0x11ce91[_0x6920('0x26')](_0x6920('0x27'),_0x377e25+'-'+_0xf4b5bd+'/'+_0x3a0c0c)[_0x6920('0x21')](_0x462500);}return null;};}function patchUpdates(_0x2dd788){return function(_0x1f68c5){try{jsonpatch[_0x6920('0x28')](_0x1f68c5,_0x2dd788,!![]);}catch(_0x1ae686){return BPromise[_0x6920('0x29')](_0x1ae686);}return _0x1f68c5[_0x6920('0x2a')]();};}function saveUpdates(_0x258986,_0x51cb24){return function(_0x1996f1){if(_0x1996f1){return _0x1996f1['update'](_0x258986)[_0x6920('0x2b')](function(_0x4dd08b){return _0x4dd08b;});}return null;};}function removeEntity(_0x72316a,_0x32a6ae){return function(_0x23e4cd){if(_0x23e4cd){return _0x23e4cd[_0x6920('0x2c')]()['then'](function(){var _0x1cab00=_0x23e4cd[_0x6920('0x2d')]({'plain':!![]});var _0x305129=[{'name':_0x6920('0x2e'),'value':_0x6920('0x2f'),'ignore':![]},{'name':_0x6920('0x30'),'value':_0x6920('0x31'),'ignore':![]}];var _0x38d0f6=_(_0x305129)[_0x6920('0x32')](_0x6920('0x33'))[_0x6920('0x34')](_0x6920('0x35'))['value']();if(_[_0x6920('0x36')](_0x38d0f6,_0x1cab00['type'])){return;}var _0x411ea2=_['find'](_0x305129,[_0x6920('0x35'),_0x1cab00[_0x6920('0x37')]])['name'];return db[_0x6920('0x38')][_0x6920('0x2c')]({'where':{'type':_0x411ea2,'resourceId':_0x1cab00['id']}})[_0x6920('0x2b')](function(){return _0x23e4cd;});})['then'](function(){_0x72316a['status'](0xcc)[_0x6920('0x20')]();});}};}function handleEntityNotFound(_0x5bb636,_0x59506b){return function(_0xc2807c){if(!_0xc2807c){_0x5bb636[_0x6920('0x1e')](0x194);}return _0xc2807c;};}function handleError(_0x8b95ba,_0x7155e5){_0x7155e5=_0x7155e5||0x1f4;return function(_0x86aa6f){logger[_0x6920('0x39')](_0x86aa6f[_0x6920('0x3a')]);if(_0x86aa6f['name']){delete _0x86aa6f[_0x6920('0x3b')];}_0x8b95ba['status'](_0x7155e5)[_0x6920('0x3c')](_0x86aa6f);};}exports['index']=function(_0x495b5b,_0x5d1ac3){var _0x155b3a={},_0x1d4426={},_0xcfe1bf={'count':0x0,'rows':[]};var _0x54af8a=_[_0x6920('0x34')](db[_0x6920('0x3d')][_0x6920('0x3e')],function(_0x33acf7){return{'name':_0x33acf7[_0x6920('0x3f')],'type':_0x33acf7[_0x6920('0x37')][_0x6920('0x40')]};});_0x1d4426['model']=_[_0x6920('0x34')](_0x54af8a,'name');_0x1d4426[_0x6920('0x41')]=_[_0x6920('0x42')](_0x495b5b[_0x6920('0x41')]);_0x1d4426['filters']=_[_0x6920('0x43')](_0x1d4426[_0x6920('0x44')],_0x1d4426[_0x6920('0x41')]);_0x155b3a[_0x6920('0x45')]=_['intersection'](_0x1d4426[_0x6920('0x44')],qs[_0x6920('0x46')](_0x495b5b['query']['fields']));_0x155b3a[_0x6920('0x45')]=_0x155b3a[_0x6920('0x45')]['length']?_0x155b3a[_0x6920('0x45')]:_0x1d4426[_0x6920('0x44')];if(!_0x495b5b['query']['hasOwnProperty'](_0x6920('0x47'))){_0x155b3a[_0x6920('0x24')]=qs[_0x6920('0x24')](_0x495b5b[_0x6920('0x41')][_0x6920('0x24')]);_0x155b3a['offset']=qs['offset'](_0x495b5b['query'][_0x6920('0x22')]);}_0x155b3a['order']=qs['sort'](_0x495b5b[_0x6920('0x41')][_0x6920('0x48')]);_0x155b3a['where']=qs[_0x6920('0x49')](_['pick'](_0x495b5b[_0x6920('0x41')],_0x1d4426[_0x6920('0x49')]),_0x54af8a);if(_0x495b5b[_0x6920('0x41')][_0x6920('0x32')]){_0x155b3a[_0x6920('0x4a')]=_['merge'](_0x155b3a['where'],{'$or':_[_0x6920('0x34')](_0x54af8a,function(_0x56508c){if(_0x56508c['type']!=='VIRTUAL'){var _0x520cd1={};_0x520cd1[_0x56508c[_0x6920('0x3b')]]={'$like':'%'+_0x495b5b[_0x6920('0x41')][_0x6920('0x32')]+'%'};return _0x520cd1;}})});}_0x155b3a=_['merge']({},_0x155b3a,_0x495b5b[_0x6920('0x4b')]);var _0x29306b={'where':_0x155b3a[_0x6920('0x4a')]};return db[_0x6920('0x3d')][_0x6920('0x25')](_0x29306b)[_0x6920('0x2b')](function(_0x4b487c){_0xcfe1bf[_0x6920('0x25')]=_0x4b487c;if(_0x495b5b[_0x6920('0x41')][_0x6920('0x4c')]){_0x155b3a[_0x6920('0x4d')]=[{'all':!![]}];}return db[_0x6920('0x3d')][_0x6920('0x4e')](_0x155b3a);})[_0x6920('0x2b')](function(_0x22a8bb){_0xcfe1bf[_0x6920('0x4f')]=_0x22a8bb;return _0xcfe1bf;})[_0x6920('0x2b')](respondWithFilteredResult(_0x5d1ac3,_0x155b3a))[_0x6920('0x50')](handleError(_0x5d1ac3,null));};exports[_0x6920('0x51')]=function(_0x552a81,_0x1d50f7){var _0x383c6d={'raw':![],'where':{'id':_0x552a81['params']['id']}},_0x571aed={};_0x571aed[_0x6920('0x44')]=_[_0x6920('0x42')](db[_0x6920('0x3d')][_0x6920('0x3e')]);_0x571aed[_0x6920('0x41')]=_['keys'](_0x552a81[_0x6920('0x41')]);_0x571aed[_0x6920('0x49')]=_[_0x6920('0x43')](_0x571aed['model'],_0x571aed['query']);_0x383c6d[_0x6920('0x45')]=_[_0x6920('0x43')](_0x571aed[_0x6920('0x44')],qs[_0x6920('0x46')](_0x552a81['query'][_0x6920('0x46')]));_0x383c6d[_0x6920('0x45')]=_0x383c6d[_0x6920('0x45')][_0x6920('0x52')]?_0x383c6d[_0x6920('0x45')]:_0x571aed['model'];if(_0x552a81[_0x6920('0x41')][_0x6920('0x4c')]){_0x383c6d[_0x6920('0x4d')]=[{'all':!![]}];}_0x383c6d=_[_0x6920('0x53')]({},_0x383c6d,_0x552a81[_0x6920('0x4b')]);return db[_0x6920('0x3d')][_0x6920('0x54')](_0x383c6d)[_0x6920('0x2b')](handleEntityNotFound(_0x1d50f7,null))[_0x6920('0x2b')](respondWithResult(_0x1d50f7,null))[_0x6920('0x50')](handleError(_0x1d50f7,null));};exports['create']=function(_0x2557c0,_0x303247){return db[_0x6920('0x3d')][_0x6920('0x55')](_0x2557c0[_0x6920('0x56')],{})[_0x6920('0x2b')](function(_0xf7412b){var _0x5f27e7=_0x2557c0[_0x6920('0x57')][_0x6920('0x2d')]({'plain':!![]});if(!_0x5f27e7)throw new Error(_0x6920('0x58'));if(_0x5f27e7[_0x6920('0x59')]==='user'){var _0x52e62e=_0xf7412b['get']({'plain':!![]});var _0x2e0a39=[{'name':_0x6920('0x2e'),'value':_0x6920('0x2f')},{'name':'QueueCampaigns','value':_0x6920('0x31')}];var _0x12c261=_[_0x6920('0x54')](_0x2e0a39,[_0x6920('0x35'),_0x52e62e[_0x6920('0x37')]])[_0x6920('0x3b')];return db[_0x6920('0x5a')]['find']({'where':{'name':_0x12c261,'userProfileId':_0x5f27e7[_0x6920('0x5b')]},'raw':!![]})[_0x6920('0x2b')](function(_0x4a8664){if(_0x4a8664&&_0x4a8664[_0x6920('0x5c')]===0x0){return db[_0x6920('0x38')][_0x6920('0x55')]({'name':_0x52e62e[_0x6920('0x3b')],'resourceId':_0x52e62e['id'],'type':_0x4a8664[_0x6920('0x3b')],'sectionId':_0x4a8664['id']},{})['then'](function(){return _0xf7412b;});}else{return _0xf7412b;}})[_0x6920('0x50')](function(_0x10bde8){logger['error'](_0x6920('0x5d'),_0x10bde8);throw _0x10bde8;});}return _0xf7412b;})[_0x6920('0x2b')](respondWithResult(_0x303247,0xc9))['catch'](handleError(_0x303247,null));};exports['clone']=function(_0x4483ac,_0x24cfbe){var _0x56cedc={'where':{'id':_0x4483ac[_0x6920('0x5e')]['id']}},_0x1489c4={};_0x1489c4[_0x6920('0x44')]=_[_0x6920('0x42')](db[_0x6920('0x3d')][_0x6920('0x3e')]);_0x56cedc[_0x6920('0x45')]=_['intersection'](_0x1489c4[_0x6920('0x44')],qs[_0x6920('0x46')](_0x4483ac[_0x6920('0x41')][_0x6920('0x46')]));_0x56cedc[_0x6920('0x45')]=_0x56cedc[_0x6920('0x45')][_0x6920('0x52')]?_0x56cedc[_0x6920('0x45')]:_0x1489c4[_0x6920('0x44')];if(_0x4483ac['query'][_0x6920('0x4c')]){_0x56cedc[_0x6920('0x4d')]=[{'all':!![]}];}_0x56cedc=_[_0x6920('0x53')]({},_0x56cedc,_0x4483ac[_0x6920('0x4b')]);return db['VoiceQueue'][_0x6920('0x54')](_0x56cedc)[_0x6920('0x2b')](handleEntityNotFound(_0x24cfbe,null))[_0x6920('0x2b')](function(_0x231f4c){if(_0x231f4c){var _0x4248bb=_0x231f4c[_0x6920('0x2d')]({'plain':!![]});_0x4248bb=qs['omit'](_0x4248bb,['id',_0x6920('0x5f'),_0x6920('0x60')]);_0x4483ac['body']=_[_0x6920('0x61')](_0x4483ac[_0x6920('0x56')],['id',_0x6920('0x5f'),_0x6920('0x60')]);return db[_0x6920('0x3d')][_0x6920('0x55')](_[_0x6920('0x53')](_0x4248bb,_0x4483ac[_0x6920('0x56')]),{'include':_0x4483ac[_0x6920('0x41')][_0x6920('0x4c')]?[{'all':!![]}]:undefined})[_0x6920('0x2b')](function(_0xe389f2){var _0x15b24d=_0x4483ac[_0x6920('0x57')]['get']({'plain':!![]});if(!_0x15b24d)throw new Error(_0x6920('0x58'));if(_0x15b24d[_0x6920('0x59')]===_0x6920('0x57')){var _0x4bc290=_0xe389f2[_0x6920('0x2d')]({'plain':!![]});var _0x42508f=[{'name':_0x6920('0x2e'),'value':_0x6920('0x2f')},{'name':_0x6920('0x30'),'value':'outbound'}];var _0xc12b4c=_[_0x6920('0x54')](_0x42508f,[_0x6920('0x35'),_0x4bc290['type']])[_0x6920('0x3b')];return db['UserProfileSection']['find']({'where':{'name':_0xc12b4c,'userProfileId':_0x15b24d[_0x6920('0x5b')]},'raw':!![]})['then'](function(_0x194fa3){if(_0x194fa3&&_0x194fa3[_0x6920('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x4bc290[_0x6920('0x3b')],'resourceId':_0x4bc290['id'],'type':_0x194fa3[_0x6920('0x3b')],'sectionId':_0x194fa3['id']},{})[_0x6920('0x2b')](function(){return _0xe389f2;});}else{return _0xe389f2;}})[_0x6920('0x50')](function(_0x3a2175){logger[_0x6920('0x39')](_0x6920('0x5d'),_0x3a2175);throw _0x3a2175;});}return _0xe389f2;});}})[_0x6920('0x2b')](respondWithResult(_0x24cfbe,0xc9))[_0x6920('0x50')](handleError(_0x24cfbe,null));};exports[_0x6920('0x62')]=function(_0x4a1228,_0x4f11b1){if(_0x4a1228[_0x6920('0x56')]['id']){delete _0x4a1228[_0x6920('0x56')]['id'];}return db['VoiceQueue'][_0x6920('0x54')]({'where':{'id':_0x4a1228['params']['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x4f11b1,null))[_0x6920('0x2b')](saveUpdates(_0x4a1228[_0x6920('0x56')],null))[_0x6920('0x2b')](respondWithResult(_0x4f11b1,null))[_0x6920('0x50')](handleError(_0x4f11b1,null));};exports['destroy']=function(_0x568ca4,_0x4b80e9){return db['VoiceQueue'][_0x6920('0x54')]({'where':{'id':_0x568ca4[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x4b80e9,null))[_0x6920('0x2b')](removeEntity(_0x4b80e9,null))['catch'](handleError(_0x4b80e9,null));};exports[_0x6920('0x63')]=function(_0x3e7446,_0x160b6a,_0x17f172){var _0x3f2497={'raw':![],'where':{}};var _0x89a443={};var _0x18be21={'count':0x0,'rows':[]};return db[_0x6920('0x3d')][_0x6920('0x64')]({'where':{'id':_0x3e7446[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x160b6a,null))[_0x6920('0x2b')](function(_0x58e4be){if(_0x58e4be){_0x89a443[_0x6920('0x44')]=_[_0x6920('0x42')](db[_0x6920('0x65')]['rawAttributes']);_0x89a443[_0x6920('0x41')]=_[_0x6920('0x42')](_0x3e7446[_0x6920('0x41')]);_0x89a443[_0x6920('0x49')]=_[_0x6920('0x43')](_0x89a443['model'],_0x89a443[_0x6920('0x41')]);_0x3f2497[_0x6920('0x45')]=_[_0x6920('0x43')](_0x89a443[_0x6920('0x44')],qs['fields'](_0x3e7446[_0x6920('0x41')][_0x6920('0x46')]));_0x3f2497['attributes']=_0x3f2497[_0x6920('0x45')][_0x6920('0x52')]?_0x3f2497['attributes']:_0x89a443[_0x6920('0x44')];if(!_0x3e7446['query'][_0x6920('0x66')](_0x6920('0x47'))){_0x3f2497[_0x6920('0x24')]=qs[_0x6920('0x24')](_0x3e7446[_0x6920('0x41')][_0x6920('0x24')]);_0x3f2497['offset']=qs[_0x6920('0x22')](_0x3e7446[_0x6920('0x41')][_0x6920('0x22')]);}_0x3f2497[_0x6920('0x67')]=qs[_0x6920('0x48')](_0x3e7446[_0x6920('0x41')][_0x6920('0x48')]);_0x3f2497[_0x6920('0x4a')]=qs['filters'](_[_0x6920('0x68')](_0x3e7446['query'],_0x89a443[_0x6920('0x49')]));_0x3f2497[_0x6920('0x4a')][_0x6920('0x69')]=_0x58e4be['id'];if(_0x3e7446['query']['filter']){_0x3f2497['where']=_[_0x6920('0x53')](_0x3f2497['where'],{'$or':_['map'](_0x3f2497['attributes'],function(_0x30e537){var _0x37817f={};_0x37817f[_0x30e537]={'$like':'%'+_0x3e7446[_0x6920('0x41')][_0x6920('0x32')]+'%'};return _0x37817f;})});}_0x3f2497=_[_0x6920('0x53')]({},_0x3f2497,_0x3e7446['options']);return db[_0x6920('0x65')][_0x6920('0x25')]({'where':_0x3f2497[_0x6920('0x4a')]})['then'](function(_0xe1ed18){_0x18be21[_0x6920('0x25')]=_0xe1ed18;if(_0x3e7446['query']['includeAll']){_0x3f2497[_0x6920('0x4d')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3f2497);})[_0x6920('0x2b')](function(_0x349fb5){_0x18be21[_0x6920('0x4f')]=_0x349fb5;return _0x18be21;});}})[_0x6920('0x2b')](respondWithFilteredResult(_0x160b6a,_0x3f2497))['catch'](handleError(_0x160b6a,null));};exports[_0x6920('0x6a')]=function(_0x1d53d4,_0x4e2d4c,_0x1f78df){var _0x30e9f3={'raw':!![],'where':{}};var _0x4d8071={};var _0xfe89f4={'count':0x0,'rows':[]};return db[_0x6920('0x3d')][_0x6920('0x64')]({'where':{'id':_0x1d53d4[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x4e2d4c,null))[_0x6920('0x2b')](function(_0x190aa7){if(_0x190aa7){_0x4d8071[_0x6920('0x44')]=_[_0x6920('0x42')](db[_0x6920('0x6b')][_0x6920('0x3e')]);_0x4d8071[_0x6920('0x41')]=_[_0x6920('0x42')](_0x1d53d4[_0x6920('0x41')]);_0x4d8071[_0x6920('0x49')]=_['intersection'](_0x4d8071[_0x6920('0x44')],_0x4d8071[_0x6920('0x41')]);_0x30e9f3[_0x6920('0x45')]=_['intersection'](_0x4d8071['model'],qs[_0x6920('0x46')](_0x1d53d4['query'][_0x6920('0x46')]));_0x30e9f3[_0x6920('0x45')]=_0x30e9f3[_0x6920('0x45')][_0x6920('0x52')]?_0x30e9f3['attributes']:_0x4d8071[_0x6920('0x44')];if(!_0x1d53d4[_0x6920('0x41')][_0x6920('0x66')](_0x6920('0x47'))){_0x30e9f3['limit']=qs['limit'](_0x1d53d4[_0x6920('0x41')]['limit']);_0x30e9f3[_0x6920('0x22')]=qs[_0x6920('0x22')](_0x1d53d4[_0x6920('0x41')][_0x6920('0x22')]);}_0x30e9f3[_0x6920('0x67')]=qs[_0x6920('0x48')](_0x1d53d4['query'][_0x6920('0x48')]);_0x30e9f3[_0x6920('0x4a')]=qs[_0x6920('0x49')](_[_0x6920('0x68')](_0x1d53d4[_0x6920('0x41')],_0x4d8071[_0x6920('0x49')]));_0x30e9f3['where']['VoiceQueueId']=_0x190aa7['id'];if(_0x1d53d4[_0x6920('0x41')][_0x6920('0x32')]){_0x30e9f3[_0x6920('0x4a')]=_[_0x6920('0x53')](_0x30e9f3[_0x6920('0x4a')],{'$or':_[_0x6920('0x34')](_0x30e9f3[_0x6920('0x45')],function(_0xa01fc9){var _0x2644ef={};_0x2644ef[_0xa01fc9]={'$like':'%'+_0x1d53d4['query'][_0x6920('0x32')]+'%'};return _0x2644ef;})});}_0x30e9f3=_['merge']({},_0x30e9f3,_0x1d53d4['options']);return db[_0x6920('0x6b')][_0x6920('0x25')]({'where':_0x30e9f3[_0x6920('0x4a')]})['then'](function(_0x2dc2e4){_0xfe89f4[_0x6920('0x25')]=_0x2dc2e4;if(_0x1d53d4['query'][_0x6920('0x4c')]){_0x30e9f3['include']=[{'all':!![]}];}return db[_0x6920('0x6b')]['findAll'](_0x30e9f3);})['then'](function(_0x461a87){_0xfe89f4[_0x6920('0x4f')]=_0x461a87;return _0xfe89f4;});}})[_0x6920('0x2b')](respondWithFilteredResult(_0x4e2d4c,_0x30e9f3))[_0x6920('0x50')](handleError(_0x4e2d4c,null));};exports[_0x6920('0x6c')]=function(_0x5560cf,_0x3915e1,_0x56f766){var _0x2f9c4f={'raw':!![],'where':{}};var _0x50fed3={};var _0x2f3b73={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x5560cf[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x3915e1,null))[_0x6920('0x2b')](function(_0x447854){if(_0x447854){_0x50fed3[_0x6920('0x44')]=_[_0x6920('0x42')](db[_0x6920('0x6d')][_0x6920('0x3e')]);_0x50fed3['query']=_[_0x6920('0x42')](_0x5560cf[_0x6920('0x41')]);_0x50fed3[_0x6920('0x49')]=_[_0x6920('0x43')](_0x50fed3['model'],_0x50fed3[_0x6920('0x41')]);_0x2f9c4f[_0x6920('0x45')]=_[_0x6920('0x43')](_0x50fed3[_0x6920('0x44')],qs['fields'](_0x5560cf[_0x6920('0x41')][_0x6920('0x46')]));_0x2f9c4f[_0x6920('0x45')]=_0x2f9c4f[_0x6920('0x45')][_0x6920('0x52')]?_0x2f9c4f[_0x6920('0x45')]:_0x50fed3['model'];if(!_0x5560cf['query'][_0x6920('0x66')](_0x6920('0x47'))){_0x2f9c4f[_0x6920('0x24')]=qs[_0x6920('0x24')](_0x5560cf[_0x6920('0x41')]['limit']);_0x2f9c4f[_0x6920('0x22')]=qs[_0x6920('0x22')](_0x5560cf[_0x6920('0x41')][_0x6920('0x22')]);}_0x2f9c4f['order']=qs[_0x6920('0x48')](_0x5560cf[_0x6920('0x41')][_0x6920('0x48')]);_0x2f9c4f['where']=qs[_0x6920('0x49')](_[_0x6920('0x68')](_0x5560cf['query'],_0x50fed3[_0x6920('0x49')]));_0x2f9c4f['where'][_0x6920('0x69')]=_0x447854['id'];if(_0x5560cf['query'][_0x6920('0x32')]){_0x2f9c4f[_0x6920('0x4a')]=_['merge'](_0x2f9c4f['where'],{'$or':_[_0x6920('0x34')](_0x2f9c4f[_0x6920('0x45')],function(_0x263fed){var _0x2dffa3={};_0x2dffa3[_0x263fed]={'$like':'%'+_0x5560cf[_0x6920('0x41')]['filter']+'%'};return _0x2dffa3;})});}_0x2f9c4f=_[_0x6920('0x53')]({},_0x2f9c4f,_0x5560cf[_0x6920('0x4b')]);return db[_0x6920('0x6d')][_0x6920('0x25')]({'where':_0x2f9c4f[_0x6920('0x4a')]})[_0x6920('0x2b')](function(_0x3196bc){_0x2f3b73['count']=_0x3196bc;if(_0x5560cf[_0x6920('0x41')][_0x6920('0x4c')]){_0x2f9c4f['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x6920('0x4e')](_0x2f9c4f);})[_0x6920('0x2b')](function(_0x2da154){_0x2f3b73[_0x6920('0x4f')]=_0x2da154;return _0x2f3b73;});}})[_0x6920('0x2b')](respondWithFilteredResult(_0x3915e1,_0x2f9c4f))[_0x6920('0x50')](handleError(_0x3915e1,null));};exports[_0x6920('0x6e')]=function(_0x4ed45a,_0x1c3791,_0xf64e8f){var _0x53112f={'raw':!![],'where':{}};var _0x1dd8e4={};var _0x2b0ba0={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6920('0x64')]({'where':{'id':_0x4ed45a[_0x6920('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1c3791,null))[_0x6920('0x2b')](function(_0x331205){if(_0x331205){_0x1dd8e4[_0x6920('0x44')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x1dd8e4[_0x6920('0x41')]=_['keys'](_0x4ed45a[_0x6920('0x41')]);_0x1dd8e4['filters']=_['intersection'](_0x1dd8e4[_0x6920('0x44')],_0x1dd8e4['query']);_0x53112f['attributes']=_[_0x6920('0x43')](_0x1dd8e4[_0x6920('0x44')],qs[_0x6920('0x46')](_0x4ed45a['query'][_0x6920('0x46')]));_0x53112f[_0x6920('0x45')]=_0x53112f[_0x6920('0x45')][_0x6920('0x52')]?_0x53112f['attributes']:_0x1dd8e4[_0x6920('0x44')];if(!_0x4ed45a[_0x6920('0x41')]['hasOwnProperty'](_0x6920('0x47'))){_0x53112f['limit']=qs[_0x6920('0x24')](_0x4ed45a[_0x6920('0x41')]['limit']);_0x53112f[_0x6920('0x22')]=qs['offset'](_0x4ed45a[_0x6920('0x41')][_0x6920('0x22')]);}_0x53112f[_0x6920('0x67')]=qs[_0x6920('0x48')](_0x4ed45a[_0x6920('0x41')][_0x6920('0x48')]);_0x53112f['where']=qs[_0x6920('0x49')](_[_0x6920('0x68')](_0x4ed45a[_0x6920('0x41')],_0x1dd8e4[_0x6920('0x49')]));_0x53112f[_0x6920('0x4a')][_0x6920('0x69')]=_0x331205['id'];if(_0x4ed45a[_0x6920('0x41')][_0x6920('0x32')]){_0x53112f[_0x6920('0x4a')]=_['merge'](_0x53112f['where'],{'$or':_[_0x6920('0x34')](_0x53112f[_0x6920('0x45')],function(_0x182b29){var _0x377ed0={};_0x377ed0[_0x182b29]={'$like':'%'+_0x4ed45a[_0x6920('0x41')][_0x6920('0x32')]+'%'};return _0x377ed0;})});}_0x53112f=_['merge']({},_0x53112f,_0x4ed45a['options']);return db[_0x6920('0x6f')][_0x6920('0x25')]({'where':_0x53112f[_0x6920('0x4a')]})[_0x6920('0x2b')](function(_0x2233d5){_0x2b0ba0['count']=_0x2233d5;if(_0x4ed45a[_0x6920('0x41')][_0x6920('0x4c')]){_0x53112f[_0x6920('0x4d')]=[{'all':!![]}];}return db[_0x6920('0x6f')][_0x6920('0x4e')](_0x53112f);})[_0x6920('0x2b')](function(_0x2a70fd){_0x2b0ba0['rows']=_0x2a70fd;return _0x2b0ba0;});}})[_0x6920('0x2b')](respondWithFilteredResult(_0x1c3791,_0x53112f))['catch'](handleError(_0x1c3791,null));};exports['getTeams']=function(_0xa267d9,_0x3f6a1f,_0x4dd9fd){var _0x4e618e={};var _0x2977b2={};var _0xcff624;var _0x4f971c;return db[_0x6920('0x3d')][_0x6920('0x64')]({'where':{'id':_0xa267d9[_0x6920('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3f6a1f,null))[_0x6920('0x2b')](function(_0x2d4b51){if(_0x2d4b51){_0xcff624=_0x2d4b51;_0x2977b2[_0x6920('0x44')]=_['keys'](db[_0x6920('0x70')][_0x6920('0x3e')]);_0x2977b2[_0x6920('0x41')]=_[_0x6920('0x42')](_0xa267d9['query']);_0x2977b2['filters']=_['intersection'](_0x2977b2[_0x6920('0x44')],_0x2977b2[_0x6920('0x41')]);_0x4e618e[_0x6920('0x45')]=_['intersection'](_0x2977b2[_0x6920('0x44')],qs[_0x6920('0x46')](_0xa267d9['query'][_0x6920('0x46')]));_0x4e618e[_0x6920('0x45')]=_0x4e618e['attributes'][_0x6920('0x52')]?_0x4e618e[_0x6920('0x45')]:_0x2977b2['model'];_0x4e618e[_0x6920('0x67')]=qs[_0x6920('0x48')](_0xa267d9[_0x6920('0x41')][_0x6920('0x48')]);_0x4e618e['where']=qs['filters'](_['pick'](_0xa267d9[_0x6920('0x41')],_0x2977b2[_0x6920('0x49')]));if(_0xa267d9[_0x6920('0x41')][_0x6920('0x32')]){_0x4e618e[_0x6920('0x4a')]=_['merge'](_0x4e618e[_0x6920('0x4a')],{'$or':_[_0x6920('0x34')](_0x4e618e[_0x6920('0x45')],function(_0x21b32a){var _0x453124={};_0x453124[_0x21b32a]={'$like':'%'+_0xa267d9[_0x6920('0x41')][_0x6920('0x32')]+'%'};return _0x453124;})});}_0x4e618e=_[_0x6920('0x53')]({},_0x4e618e,_0xa267d9[_0x6920('0x4b')]);return _0xcff624['getTeams'](_0x4e618e);}})['then'](function(_0x5542b2){if(_0x5542b2){_0x4f971c=_0x5542b2[_0x6920('0x52')];if(!_0xa267d9[_0x6920('0x41')]['hasOwnProperty']('nolimit')){_0x4e618e[_0x6920('0x24')]=qs[_0x6920('0x24')](_0xa267d9[_0x6920('0x41')][_0x6920('0x24')]);_0x4e618e[_0x6920('0x22')]=qs[_0x6920('0x22')](_0xa267d9[_0x6920('0x41')][_0x6920('0x22')]);}return _0xcff624[_0x6920('0x71')](_0x4e618e);}})[_0x6920('0x2b')](function(_0x53df6c){if(_0x53df6c){return _0x53df6c?{'count':_0x4f971c,'rows':_0x53df6c}:null;}})[_0x6920('0x2b')](respondWithResult(_0x3f6a1f,null))[_0x6920('0x50')](handleError(_0x3f6a1f,null));};exports[_0x6920('0x72')]=function(_0x1a7eeb,_0x108b41,_0x2af942){var _0x1c1d3d=_0x1a7eeb[_0x6920('0x56')]['teams'];var _0x23dd81=_['map'](_0x1c1d3d,'id');return db[_0x6920('0x70')][_0x6920('0x4e')]({'where':{'id':_0x23dd81},'attributes':['id'],'include':[{'model':db[_0x6920('0x73')],'as':_0x6920('0x74'),'attributes':['id',_0x6920('0x3b'),_0x6920('0x75'),_0x6920('0x76'),'interface'],'raw':!![]}]})[_0x6920('0x2b')](function(_0x21108d){if(_0x21108d){var _0x3be9d0=_[_0x6920('0x77')](_0x21108d,function(_0x235378){var _0x28c7e2=_0x235378[_0x6920('0x2d')]({'plain':!![]});_0x28c7e2[_0x6920('0x74')][_0x6920('0x78')](function(_0x4adca7){_0x4adca7[_0x6920('0x79')]=_[_0x6920('0x54')](_0x1c1d3d,{'id':_0x28c7e2['id']})[_0x6920('0x79')];});return _0x28c7e2[_0x6920('0x74')];});return db[_0x6920('0x3d')]['find']({'where':{'id':_0x1a7eeb[_0x6920('0x5e')]['id']}})['then'](function(_0x19ba78){return db[_0x6920('0x7a')][_0x6920('0x7b')](function(_0x174a3c){return _0x19ba78['addTeams'](_0x23dd81,{'transaction':_0x174a3c})[_0x6920('0x2b')](function(){return BPromise[_0x6920('0x7c')](_0x1c1d3d,function(_0x1e9c8f){return db[_0x6920('0x7d')][_0x6920('0x7e')]({'TeamId':_0x1e9c8f['id'],'VoiceQueueId':_0x1a7eeb[_0x6920('0x5e')]['id'],'penalty':_0x1e9c8f['penalty']},{'transaction':_0x174a3c});});})[_0x6920('0x2b')](function(){return BPromise['each'](_0x3be9d0,function(_0x153f64){return db[_0x6920('0x7f')][_0x6920('0x80')]({'where':{'UserId':_0x153f64['id'],'VoiceQueueId':_0x1a7eeb[_0x6920('0x5e')]['id']},'defaults':{'penalty':_0x153f64[_0x6920('0x79')]},'transaction':_0x174a3c});});})[_0x6920('0x2b')](function(){return BPromise[_0x6920('0x7c')](_[_0x6920('0x32')](_0x3be9d0,{'online':!![]}),function(_0xbeee5a){return db[_0x6920('0x81')][_0x6920('0x7e')]({'membername':_0xbeee5a[_0x6920('0x3b')],'UserId':_0xbeee5a['id'],'queue_name':_0x19ba78['name'],'VoiceQueueId':_0x19ba78['id'],'interface':_[_0x6920('0x82')](_0xbeee5a['interface'])?util[_0x6920('0x83')](_0x6920('0x84'),_0xbeee5a[_0x6920('0x3b')]):_0xbeee5a[_0x6920('0x85')],'paused':_0xbeee5a[_0x6920('0x76')]||![],'penalty':_0xbeee5a[_0x6920('0x79')]},{'transaction':_0x174a3c});});})[_0x6920('0x2b')](function(){_0x3be9d0[_0x6920('0x78')](function(_0x3c2077){socket[_0x6920('0x86')](_0x6920('0x87'),{'UserId':_0x3c2077['id'],'VoiceQueueId':_0x19ba78['id']});});});});});}})[_0x6920('0x2b')](respondWithStatusCode(_0x108b41,null))[_0x6920('0x50')](handleError(_0x108b41,null));};exports[_0x6920('0x88')]=function(_0x527be7,_0x2399eb,_0x934f1){return db[_0x6920('0x70')][_0x6920('0x4e')]({'where':{'id':_0x527be7[_0x6920('0x41')][_0x6920('0x89')]},'attributes':['id'],'include':[{'model':db[_0x6920('0x73')],'as':_0x6920('0x74'),'attributes':['id'],'raw':!![]}]})[_0x6920('0x2b')](handleEntityNotFound(_0x2399eb,null))[_0x6920('0x2b')](function(_0x35bedf){var _0x6d6d6a=_[_0x6920('0x34')](_0x35bedf,'id');var _0xad2cec=[];var _0x47eac6=[];var _0x568136=squel[_0x6920('0x8a')]();_0x568136['field'](_0x6920('0x8b'))[_0x6920('0x8c')](_0x6920('0x8d'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6920('0x4a')](_0x6920('0x8e'),_0x527be7['params']['id']);for(var _0x1e2eb7=0x0;_0x1e2eb7<_0x35bedf[_0x6920('0x52')];_0x1e2eb7+=0x1){let _0x1f22fa=_0x35bedf[_0x1e2eb7];for(var _0x364ab5=0x0;_0x364ab5<_0x1f22fa['Agents'][_0x6920('0x52')];_0x364ab5+=0x1){let _0x2b59fe=_0x1f22fa[_0x6920('0x74')][_0x364ab5];var _0x1d58e3=_0x568136['clone']();_0x1d58e3[_0x6920('0x4a')](_0x6920('0x8f'),_0x2b59fe['id']);_0x47eac6[_0x6920('0x90')](db['sequelize']['query'](_0x1d58e3[_0x6920('0x91')](),{'type':db[_0x6920('0x7a')]['QueryTypes'][_0x6920('0x92')]})[_0x6920('0x2b')](function(_0x352fa6){if(_0x352fa6[_0x6920('0x52')]===0x1){return _0x2b59fe['id'];}else{var _0x1d9130=_[_0x6920('0x93')](_['map'](_0x352fa6,_0x6920('0x94')),function(_0x5e8112){return _['includes'](_0x6d6d6a,_0x5e8112);});if(_0x1d9130){return _0x2b59fe['id'];}}}));}}return BPromise['all'](_0x47eac6)[_0x6920('0x2b')](function(_0x5cd70d){_0xad2cec=_(_0xad2cec)[_0x6920('0x95')](_0x5cd70d)['compact']()[_0x6920('0x35')]();return db[_0x6920('0x3d')]['find']({'where':{'id':_0x527be7[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](function(_0x2bfa3b){return db[_0x6920('0x7a')]['transaction'](function(_0x4b8880){return _0x2bfa3b[_0x6920('0x88')](_0x527be7[_0x6920('0x41')]['ids'],{'transaction':_0x4b8880})[_0x6920('0x2b')](function(){if(!_['isEmpty'](_0xad2cec)){return _0x2bfa3b['removeAgents'](_0xad2cec,{'transaction':_0x4b8880})['then'](function(){return db[_0x6920('0x81')]['destroy']({'where':{'VoiceQueueId':_0x527be7[_0x6920('0x5e')]['id'],'UserId':_0xad2cec},'transaction':_0x4b8880});});}})[_0x6920('0x2b')](function(){_0xad2cec['forEach'](function(_0x20b344){socket[_0x6920('0x86')](_0x6920('0x96'),{'UserId':_0x20b344,'VoiceQueueId':_0x2bfa3b['id']});});});});});});})[_0x6920('0x2b')](respondWithStatusCode(_0x2399eb,null))[_0x6920('0x50')](handleError(_0x2399eb,null));};exports[_0x6920('0x97')]=function(_0x25e21f,_0x566740,_0x3b079d){var _0x2b0389,_0x1680b6;return db[_0x6920('0x3d')][_0x6920('0x54')]({'where':{'id':_0x25e21f[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x566740,null))['then'](function(_0x214948){if(_0x214948){_0x1680b6=_0x214948;return _0x214948['addAgents'](_0x25e21f['body'][_0x6920('0x89')],_[_0x6920('0x61')](_0x25e21f[_0x6920('0x56')],['ids','id'])||{})[_0x6920('0x98')](function(_0x60feef){for(var _0x3e936c=0x0;_0x3e936c<_0x25e21f[_0x6920('0x56')]['ids']['length'];_0x3e936c+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x25e21f['body']['ids'][_0x3e936c]),'VoiceQueueId':Number(_0x25e21f[_0x6920('0x5e')]['id'])});}return _0x60feef;});}})[_0x6920('0x2b')](function(_0x452c9d){_0x2b0389=_0x452c9d||[];if(_0x1680b6){return db['User'][_0x6920('0x4e')]({'where':{'id':_0x25e21f['body']['ids']},'attributes':['id',_0x6920('0x3b'),'online',_0x6920('0x76'),_0x6920('0x85')],'raw':!![]});}})[_0x6920('0x2b')](function(_0x5e5958){if(!_[_0x6920('0x99')](_0x5e5958)){var _0x3d6de1=[];for(var _0x248e07=0x0;_0x248e07<_0x5e5958['length'];_0x248e07++){if(_0x5e5958[_0x248e07][_0x6920('0x75')]){_0x3d6de1[_0x6920('0x90')](db['UserVoiceQueueRt'][_0x6920('0x7e')]({'membername':_0x5e5958[_0x248e07][_0x6920('0x3b')],'UserId':_0x5e5958[_0x248e07]['id'],'queue_name':_0x1680b6[_0x6920('0x3b')],'VoiceQueueId':_0x1680b6['id'],'interface':_[_0x6920('0x82')](_0x5e5958[_0x248e07]['interface'])?util[_0x6920('0x83')](_0x6920('0x84'),_0x5e5958[_0x248e07][_0x6920('0x3b')]):_0x5e5958[_0x248e07]['interface'],'paused':_0x5e5958[_0x248e07][_0x6920('0x76')]||![],'penalty':_0x25e21f[_0x6920('0x56')]['penalty']||0x0}));}}return BPromise['all'](_0x3d6de1);}})[_0x6920('0x2b')](function(){return _0x2b0389;})[_0x6920('0x2b')](respondWithResult(_0x566740,null))['catch'](handleError(_0x566740,null));};exports['removeAgents']=function(_0x3b0c97,_0x41b0c9,_0x15dfc0){return db[_0x6920('0x3d')][_0x6920('0x54')]({'where':{'id':_0x3b0c97[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x41b0c9,null))['then'](function(_0x5e0330){if(_0x5e0330){return _0x5e0330[_0x6920('0x9a')](_0x3b0c97['query'][_0x6920('0x89')])['then'](function(){if(_[_0x6920('0x9b')](_0x3b0c97[_0x6920('0x41')][_0x6920('0x89')])){for(var _0x1b1d78=0x0;_0x1b1d78<_0x3b0c97[_0x6920('0x41')][_0x6920('0x89')][_0x6920('0x52')];_0x1b1d78+=0x1){socket[_0x6920('0x86')](_0x6920('0x96'),{'UserId':Number(_0x3b0c97[_0x6920('0x41')][_0x6920('0x89')][_0x1b1d78]),'VoiceQueueId':Number(_0x3b0c97[_0x6920('0x5e')]['id'])});}}else{socket[_0x6920('0x86')](_0x6920('0x96'),{'UserId':Number(_0x3b0c97['query'][_0x6920('0x89')]),'VoiceQueueId':Number(_0x3b0c97['params']['id'])});}});}})[_0x6920('0x2b')](function(_0x3dd656){return db['UserVoiceQueueRt'][_0x6920('0x2c')]({'where':{'VoiceQueueId':_0x3b0c97[_0x6920('0x5e')]['id'],'UserId':_0x3b0c97['query'][_0x6920('0x89')]}})[_0x6920('0x2b')](function(){return _0x3dd656;});})[_0x6920('0x2b')](respondWithStatusCode(_0x41b0c9,null))[_0x6920('0x50')](handleError(_0x41b0c9,null));};exports[_0x6920('0x9c')]=function(_0x392cda,_0x195573,_0x3e5b14){var _0xc70f40={};var _0x326f96={};var _0x138c2f;var _0x18ba6f;return db[_0x6920('0x3d')][_0x6920('0x64')]({'where':{'id':_0x392cda[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x195573,null))['then'](function(_0x2ee98a){if(_0x2ee98a){_0x138c2f=_0x2ee98a;_0x326f96[_0x6920('0x44')]=_['keys'](db['User'][_0x6920('0x3e')]);_0x326f96['query']=_[_0x6920('0x42')](_0x392cda[_0x6920('0x41')]);_0x326f96['filters']=_[_0x6920('0x43')](_0x326f96[_0x6920('0x44')],_0x326f96[_0x6920('0x41')]);_0xc70f40[_0x6920('0x45')]=_[_0x6920('0x43')](_0x326f96[_0x6920('0x44')],qs[_0x6920('0x46')](_0x392cda[_0x6920('0x41')]['fields']));_0xc70f40['attributes']=_0xc70f40[_0x6920('0x45')][_0x6920('0x52')]?_0xc70f40[_0x6920('0x45')]:_0x326f96[_0x6920('0x44')];_0xc70f40['order']=qs['sort'](_0x392cda[_0x6920('0x41')]['sort']);_0xc70f40[_0x6920('0x4a')]=qs[_0x6920('0x49')](_[_0x6920('0x68')](_0x392cda[_0x6920('0x41')],_0x326f96[_0x6920('0x49')]));if(_0x392cda[_0x6920('0x41')][_0x6920('0x32')]){_0xc70f40[_0x6920('0x4a')]=_[_0x6920('0x53')](_0xc70f40[_0x6920('0x4a')],{'$or':_[_0x6920('0x34')](_0xc70f40[_0x6920('0x45')],function(_0x515a50){var _0x2627b6={};_0x2627b6[_0x515a50]={'$like':'%'+_0x392cda['query']['filter']+'%'};return _0x2627b6;})});}_0xc70f40=_['merge']({},_0xc70f40,_0x392cda['options']);return _0x138c2f[_0x6920('0x9c')](_0xc70f40);}})[_0x6920('0x2b')](function(_0x31f372){if(_0x31f372){_0x18ba6f=_0x31f372[_0x6920('0x52')];if(!_0x392cda[_0x6920('0x41')][_0x6920('0x66')](_0x6920('0x47'))){_0xc70f40[_0x6920('0x24')]=qs[_0x6920('0x24')](_0x392cda[_0x6920('0x41')][_0x6920('0x24')]);_0xc70f40[_0x6920('0x22')]=qs['offset'](_0x392cda[_0x6920('0x41')][_0x6920('0x22')]);}return _0x138c2f['getAgents'](_0xc70f40);}})[_0x6920('0x2b')](function(_0x4708a6){if(_0x4708a6){return _0x4708a6?{'count':_0x18ba6f,'rows':_0x4708a6}:null;}})[_0x6920('0x2b')](respondWithResult(_0x195573,null))[_0x6920('0x50')](handleError(_0x195573,null));};exports['getMembers']=function(_0xca4fdd,_0xf0742f,_0x195592){var _0x5917b4={};var _0x316244={};var _0x13b47a;var _0x7d9ee5;return db[_0x6920('0x3d')][_0x6920('0x64')]({'where':{'id':_0xca4fdd[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0xf0742f,null))[_0x6920('0x2b')](function(_0xf9f273){if(_0xf9f273){_0x13b47a=_0xf9f273;_0x316244['model']=_[_0x6920('0x42')](db['UserVoiceQueueRt']['rawAttributes']);_0x316244[_0x6920('0x41')]=_[_0x6920('0x42')](_0xca4fdd[_0x6920('0x41')]);_0x316244[_0x6920('0x49')]=_[_0x6920('0x43')](_0x316244['model'],_0x316244['query']);_0x5917b4[_0x6920('0x45')]=_['intersection'](_0x316244['model'],qs['fields'](_0xca4fdd[_0x6920('0x41')][_0x6920('0x46')]));_0x5917b4['attributes']=_0x5917b4[_0x6920('0x45')][_0x6920('0x52')]?_0x5917b4[_0x6920('0x45')]:_0x316244[_0x6920('0x44')];_0x5917b4[_0x6920('0x67')]=qs[_0x6920('0x48')](_0xca4fdd[_0x6920('0x41')]['sort']);_0x5917b4[_0x6920('0x4a')]=qs['filters'](_[_0x6920('0x68')](_0xca4fdd[_0x6920('0x41')],_0x316244['filters']));if(_0xca4fdd['query'][_0x6920('0x32')]){_0x5917b4['where']=_[_0x6920('0x53')](_0x5917b4[_0x6920('0x4a')],{'$or':_[_0x6920('0x34')](_0x5917b4[_0x6920('0x45')],function(_0xc2646){var _0x3a6673={};_0x3a6673[_0xc2646]={'$like':'%'+_0xca4fdd['query'][_0x6920('0x32')]+'%'};return _0x3a6673;})});}_0x5917b4=_[_0x6920('0x53')]({},_0x5917b4,_0xca4fdd[_0x6920('0x4b')]);return _0x13b47a[_0x6920('0x9d')](_0x5917b4);}})[_0x6920('0x2b')](function(_0xe4f8c3){if(_0xe4f8c3){_0x7d9ee5=_0xe4f8c3['length'];if(!_0xca4fdd['query'][_0x6920('0x66')](_0x6920('0x47'))){_0x5917b4[_0x6920('0x24')]=qs[_0x6920('0x24')](_0xca4fdd['query'][_0x6920('0x24')]);_0x5917b4['offset']=qs['offset'](_0xca4fdd['query'][_0x6920('0x22')]);}return _0x13b47a[_0x6920('0x9d')](_0x5917b4);}})[_0x6920('0x2b')](function(_0x3a482b){return _0x3a482b?{'count':_0x7d9ee5,'rows':_0x3a482b}:null;})[_0x6920('0x2b')](respondWithResult(_0xf0742f,null))[_0x6920('0x50')](handleError(_0xf0742f,null));};exports[_0x6920('0x9e')]=function(_0x435479,_0x5e2d04,_0x587266){var _0x5926ed={};var _0x1b59da={};var _0x4d66c3;var _0x536f40;return db[_0x6920('0x3d')][_0x6920('0x64')]({'where':{'id':_0x435479[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x5e2d04,null))[_0x6920('0x2b')](function(_0x36a755){if(_0x36a755){_0x4d66c3=_0x36a755;_0x1b59da[_0x6920('0x44')]=_['keys'](db['CmList'][_0x6920('0x3e')]);_0x1b59da[_0x6920('0x41')]=_['keys'](_0x435479['query']);_0x1b59da[_0x6920('0x49')]=_[_0x6920('0x43')](_0x1b59da[_0x6920('0x44')],_0x1b59da[_0x6920('0x41')]);_0x5926ed[_0x6920('0x45')]=_[_0x6920('0x43')](_0x1b59da[_0x6920('0x44')],qs[_0x6920('0x46')](_0x435479[_0x6920('0x41')]['fields']));_0x5926ed[_0x6920('0x45')]=_0x5926ed[_0x6920('0x45')][_0x6920('0x52')]?_0x5926ed['attributes']:_0x1b59da[_0x6920('0x44')];_0x5926ed[_0x6920('0x67')]=qs[_0x6920('0x48')](_0x435479[_0x6920('0x41')][_0x6920('0x48')]);_0x5926ed[_0x6920('0x4a')]=qs[_0x6920('0x49')](_['pick'](_0x435479[_0x6920('0x41')],_0x1b59da[_0x6920('0x49')]));if(_0x435479[_0x6920('0x41')][_0x6920('0x32')]){_0x5926ed[_0x6920('0x4a')]=_[_0x6920('0x53')](_0x5926ed[_0x6920('0x4a')],{'$or':_[_0x6920('0x34')](_0x5926ed[_0x6920('0x45')],function(_0xa964cd){var _0xcf5946={};_0xcf5946[_0xa964cd]={'$like':'%'+_0x435479[_0x6920('0x41')]['filter']+'%'};return _0xcf5946;})});}_0x5926ed=_['merge']({},_0x5926ed,_0x435479[_0x6920('0x4b')]);return _0x4d66c3[_0x6920('0x9e')](_0x5926ed);}})[_0x6920('0x2b')](function(_0x5f0893){if(_0x5f0893){_0x536f40=_0x5f0893[_0x6920('0x52')];if(!_0x435479[_0x6920('0x41')][_0x6920('0x66')]('nolimit')){_0x5926ed[_0x6920('0x24')]=qs['limit'](_0x435479['query']['limit']);_0x5926ed[_0x6920('0x22')]=qs[_0x6920('0x22')](_0x435479[_0x6920('0x41')][_0x6920('0x22')]);}return _0x4d66c3['getLists'](_0x5926ed);}})[_0x6920('0x2b')](function(_0x36287b){if(_0x36287b){return _0x36287b?{'count':_0x536f40,'rows':_0x36287b}:null;}})[_0x6920('0x2b')](respondWithResult(_0x5e2d04,null))[_0x6920('0x50')](handleError(_0x5e2d04,null));};exports[_0x6920('0x9f')]=function(_0x4b40b9,_0x426fcf,_0x118e8f){var _0x284eac=moment()[_0x6920('0x83')]('YYYY-MM-DD\x20HH:mm:ss');var _0xbd34d2,_0x1c9012;return db['VoiceQueue'][_0x6920('0x54')]({'where':{'id':_0x4b40b9[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x426fcf,null))['then'](function(_0x4f2c8b){if(_0x4f2c8b){_0x1c9012=_0x4f2c8b;return _0x4f2c8b[_0x6920('0x9f')](_0x4b40b9['body']['ids'],_['omit'](_0x4b40b9[_0x6920('0x56')],['ids','id'])||{});}return null;})[_0x6920('0x98')](function(_0x1df35b){var _0x217256;_0xbd34d2=_0x1df35b||[];var _0x229852=[];if(_0x1df35b){for(var _0x3a9982=0x0;_0x3a9982<_0x1df35b[_0x6920('0x52')];_0x3a9982+=0x1){var _0x7bf194=_0x1df35b[_0x3a9982][_0x6920('0x2d')]({'plain':!![]});_0x1c9012[_0x6920('0xa0')]=_0x4b40b9[_0x6920('0x56')]['dialCheckDuplicateType']?_0x4b40b9[_0x6920('0x56')][_0x6920('0xa0')]:_0x1c9012['dialCheckDuplicateType'];switch(_0x1c9012[_0x6920('0xa0')]){case _0x6920('0xa1'):_0x217256=squel[_0x6920('0xa2')]()[_0x6920('0xa3')](_0x6920('0xa4'))[_0x6920('0xa5')]([_0x6920('0xa6'),_0x6920('0xa7'),_0x6920('0xa8'),'ListId','VoiceQueueId',_0x6920('0x5f'),_0x6920('0x60')],squel[_0x6920('0x8a')]()[_0x6920('0xa9')](_0x6920('0xa6'),_0x6920('0xa6'))[_0x6920('0xa9')]('\x27'+_0x284eac+'\x27',_0x6920('0xa7'))[_0x6920('0xa9')]('id','ContactId')['field'](_0x7bf194[_0x6920('0xaa')]['toString'](),_0x6920('0xab'))['field'](_0x4b40b9['params']['id']['toString'](),_0x6920('0x69'))[_0x6920('0xa9')]('\x27'+_0x284eac+'\x27',_0x6920('0x5f'))[_0x6920('0xa9')]('\x27'+_0x284eac+'\x27',_0x6920('0x60'))['from'](_0x6920('0xac'))[_0x6920('0x4a')](_0x6920('0xad'))[_0x6920('0x4a')](_0x6920('0xae'),_0x7bf194[_0x6920('0xaa')][_0x6920('0x91')]())['where'](_0x6920('0xaf'))[_0x6920('0x4a')](_0x6920('0xb0'),squel[_0x6920('0x8a')]()[_0x6920('0xa9')](_0x6920('0xb1'))['from'](_0x6920('0xb2'))[_0x6920('0x4a')](_0x6920('0x8e'),_0x4b40b9[_0x6920('0x5e')]['id'][_0x6920('0x91')]()))['where'](_0x6920('0xb0'),squel['select']()[_0x6920('0xa9')](_0x6920('0xb3'))[_0x6920('0x8c')](_0x6920('0xa4'))[_0x6920('0x4a')](_0x6920('0x8e'),_0x4b40b9[_0x6920('0x5e')]['id'][_0x6920('0x91')]())))[_0x6920('0x91')]();break;case _0x6920('0xb4'):_0x217256=squel[_0x6920('0xa2')]()[_0x6920('0xa3')]('cm_hopper')[_0x6920('0xa5')](['phone',_0x6920('0xa7'),_0x6920('0xa8'),_0x6920('0xab'),'VoiceQueueId',_0x6920('0x5f'),_0x6920('0x60')],squel[_0x6920('0x8a')]()[_0x6920('0xa9')](_0x6920('0xa6'),_0x6920('0xa6'))[_0x6920('0xa9')]('\x27'+_0x284eac+'\x27',_0x6920('0xa7'))[_0x6920('0xa9')]('id','ContactId')[_0x6920('0xa9')](_0x7bf194[_0x6920('0xaa')][_0x6920('0x91')](),'ListId')['field'](_0x4b40b9['params']['id'][_0x6920('0x91')](),_0x6920('0x69'))['field']('\x27'+_0x284eac+'\x27',_0x6920('0x5f'))[_0x6920('0xa9')]('\x27'+_0x284eac+'\x27',_0x6920('0x60'))[_0x6920('0x8c')](_0x6920('0xac'))[_0x6920('0x4a')](_0x6920('0xad'))['where'](_0x6920('0xae'),_0x7bf194['CmListId']['toString']())[_0x6920('0x4a')](_0x6920('0xaf'))[_0x6920('0x4a')](_0x6920('0xb0'),squel['select']()[_0x6920('0xa9')](_0x6920('0xb3'))[_0x6920('0x8c')](_0x6920('0xa4'))[_0x6920('0x4a')](_0x6920('0x8e'),_0x4b40b9[_0x6920('0x5e')]['id'][_0x6920('0x91')]())))['toString']();break;default:_0x217256=squel['insert']()['into']('cm_hopper')[_0x6920('0xa5')]([_0x6920('0xa6'),_0x6920('0xa7'),_0x6920('0xa8'),_0x6920('0xab'),_0x6920('0x69'),_0x6920('0x5f'),_0x6920('0x60')],squel['select']()['field'](_0x6920('0xa6'),_0x6920('0xa6'))['field']('\x27'+_0x284eac+'\x27','scheduledAt')['field']('id',_0x6920('0xa8'))['field'](_0x7bf194['CmListId'][_0x6920('0x91')](),_0x6920('0xab'))[_0x6920('0xa9')](_0x4b40b9['params']['id']['toString'](),_0x6920('0x69'))[_0x6920('0xa9')]('\x27'+_0x284eac+'\x27','createdAt')[_0x6920('0xa9')]('\x27'+_0x284eac+'\x27','updatedAt')[_0x6920('0x8c')](_0x6920('0xac'))['where']('deletedAt\x20IS\x20NULL')[_0x6920('0x4a')](_0x6920('0xae'),_0x7bf194['CmListId']['toString']())[_0x6920('0x4a')](_0x6920('0xaf')))[_0x6920('0x91')]();}_0x229852['push'](db[_0x6920('0x7a')][_0x6920('0x41')](_0x217256));}return BPromise[_0x6920('0xb5')](_0x229852);}})[_0x6920('0x2b')](function(){var _0x1331a5=[];var _0x32912f=squel[_0x6920('0xa2')]()[_0x6920('0xa3')](_0x6920('0xb6'))[_0x6920('0xa5')]([_0x6920('0xb7'),_0x6920('0xa6'),_0x6920('0xb8'),_0x6920('0x5f'),_0x6920('0x60')],squel[_0x6920('0x8a')]()[_0x6920('0xa9')](_0x6920('0xb9'))[_0x6920('0xa9')]('ci.item')[_0x6920('0xa9')]('ci.OrderBy+1')[_0x6920('0xa9')]('\x27'+_0x284eac+'\x27','createdAt')['field']('\x27'+_0x284eac+'\x27',_0x6920('0x60'))[_0x6920('0x8c')]('cm_contact_has_items','ci')[_0x6920('0xba')](_0x6920('0xa4'),'h',_0x6920('0xbb'))['where']('h.scheduledat=?',_0x284eac)['where'](_0x6920('0xbc'),_0x6920('0xbd')))['toString']();_0x1331a5[_0x6920('0x90')](db[_0x6920('0x7a')][_0x6920('0x41')](_0x32912f));return BPromise[_0x6920('0xb5')](_0x1331a5);})[_0x6920('0x2b')](function(){return _0xbd34d2;})[_0x6920('0x2b')](respondWithResult(_0x426fcf,null))[_0x6920('0x50')](handleError(_0x426fcf,null));};exports['removeLists']=function(_0xf0165c,_0x95302c,_0x2f5c07){return db[_0x6920('0x3d')][_0x6920('0x54')]({'where':{'id':_0xf0165c[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x95302c,null))[_0x6920('0x2b')](function(_0x9e3ca9){if(_0x9e3ca9){return _0x9e3ca9[_0x6920('0xbe')](_0xf0165c[_0x6920('0x41')]['ids']);}})[_0x6920('0x2b')](function(_0x13960b){if(_0x13960b){return db[_0x6920('0x65')]['destroy']({'where':{'ListId':_0xf0165c[_0x6920('0x41')][_0x6920('0x89')],'VoiceQueueId':_0xf0165c[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](function(){return _0x13960b;});}})[_0x6920('0x2b')](respondWithStatusCode(_0x95302c,null))[_0x6920('0x50')](handleError(_0x95302c,null));};exports[_0x6920('0xbf')]=function(_0x5e3625,_0x3857ec,_0x29b987){var _0x21914d={};var _0x2a5201={};var _0x24af5a;var _0x24a559;return db[_0x6920('0x3d')][_0x6920('0x64')]({'where':{'id':_0x5e3625[_0x6920('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3857ec,null))[_0x6920('0x2b')](function(_0x10ae03){if(_0x10ae03){_0x24af5a=_0x10ae03;_0x2a5201['model']=_[_0x6920('0x42')](db[_0x6920('0xc0')][_0x6920('0x3e')]);_0x2a5201[_0x6920('0x41')]=_['keys'](_0x5e3625[_0x6920('0x41')]);_0x2a5201[_0x6920('0x49')]=_['intersection'](_0x2a5201[_0x6920('0x44')],_0x2a5201[_0x6920('0x41')]);_0x21914d[_0x6920('0x45')]=_[_0x6920('0x43')](_0x2a5201['model'],qs[_0x6920('0x46')](_0x5e3625[_0x6920('0x41')][_0x6920('0x46')]));_0x21914d['attributes']=_0x21914d[_0x6920('0x45')][_0x6920('0x52')]?_0x21914d[_0x6920('0x45')]:_0x2a5201[_0x6920('0x44')];_0x21914d[_0x6920('0x67')]=qs[_0x6920('0x48')](_0x5e3625['query'][_0x6920('0x48')]);_0x21914d[_0x6920('0x4a')]=qs[_0x6920('0x49')](_[_0x6920('0x68')](_0x5e3625[_0x6920('0x41')],_0x2a5201[_0x6920('0x49')]));if(_0x5e3625[_0x6920('0x41')][_0x6920('0x32')]){_0x21914d['where']=_[_0x6920('0x53')](_0x21914d[_0x6920('0x4a')],{'$or':_[_0x6920('0x34')](_0x21914d[_0x6920('0x45')],function(_0x58bd1f){var _0x30cb4d={};_0x30cb4d[_0x58bd1f]={'$like':'%'+_0x5e3625[_0x6920('0x41')]['filter']+'%'};return _0x30cb4d;})});}_0x21914d=_[_0x6920('0x53')]({},_0x21914d,_0x5e3625[_0x6920('0x4b')]);return _0x24af5a[_0x6920('0xbf')](_0x21914d);}})[_0x6920('0x2b')](function(_0x1b29c7){if(_0x1b29c7){_0x24a559=_0x1b29c7[_0x6920('0x52')];if(!_0x5e3625[_0x6920('0x41')][_0x6920('0x66')](_0x6920('0x47'))){_0x21914d[_0x6920('0x24')]=qs['limit'](_0x5e3625[_0x6920('0x41')]['limit']);_0x21914d[_0x6920('0x22')]=qs['offset'](_0x5e3625[_0x6920('0x41')]['offset']);}return _0x24af5a[_0x6920('0xbf')](_0x21914d);}})[_0x6920('0x2b')](function(_0x2e59ad){if(_0x2e59ad){return _0x2e59ad?{'count':_0x24a559,'rows':_0x2e59ad}:null;}})[_0x6920('0x2b')](respondWithResult(_0x3857ec,null))[_0x6920('0x50')](handleError(_0x3857ec,null));};exports[_0x6920('0xc1')]=function(_0x134524,_0x42aa96,_0x100d6a){var _0x8558f,_0xd1745f;return db[_0x6920('0x3d')][_0x6920('0x54')]({'where':{'id':_0x134524[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x42aa96,null))[_0x6920('0x2b')](function(_0x5abcc8){if(_0x5abcc8){_0xd1745f=_0x5abcc8;return _0x5abcc8[_0x6920('0xc1')](_0x134524[_0x6920('0x56')][_0x6920('0x89')],_[_0x6920('0x61')](_0x134524['body'],[_0x6920('0x89'),'id'])||{});}return null;})[_0x6920('0x98')](function(_0x5d7184){var _0x3a019c;_0x8558f=_0x5d7184||[];var _0x65febb=[];if(_0x5d7184){for(var _0x1e1608=0x0;_0x1e1608<_0x5d7184[_0x6920('0x52')];_0x1e1608+=0x1){var _0x40a6a4=_0x5d7184[_0x1e1608]['get']({'plain':!![]});_0x3a019c=squel['insert']()['into'](_0x6920('0xc2'))[_0x6920('0xa5')](['phone',_0x6920('0xa8'),_0x6920('0xab'),'VoiceQueueId',_0x6920('0x5f'),'updatedAt'],squel[_0x6920('0x8a')]()[_0x6920('0xa9')]('phone','phone')[_0x6920('0xa9')]('id',_0x6920('0xa8'))['field'](_0x40a6a4[_0x6920('0xaa')][_0x6920('0x91')](),_0x6920('0xab'))[_0x6920('0xa9')](_0x134524[_0x6920('0x5e')]['id'][_0x6920('0x91')](),'VoiceQueueId')['field'](_0x6920('0xc3'),_0x6920('0x5f'))['field']('NOW()',_0x6920('0x60'))[_0x6920('0x8c')](_0x6920('0xac'))[_0x6920('0x4a')](_0x6920('0xad'))[_0x6920('0x4a')](_0x6920('0xae'),_0x40a6a4[_0x6920('0xaa')][_0x6920('0x91')]())['where'](_0x6920('0xaf')))['toString']();_0x65febb[_0x6920('0x90')](db['sequelize'][_0x6920('0x41')](_0x3a019c));}return BPromise['all'](_0x65febb);}})[_0x6920('0x2b')](function(){return _0x8558f;})[_0x6920('0x2b')](respondWithResult(_0x42aa96,null))[_0x6920('0x50')](handleError(_0x42aa96,null));};exports[_0x6920('0xc4')]=function(_0x175ecd,_0x1bf8f1,_0x2ff08f){return db['VoiceQueue'][_0x6920('0x54')]({'where':{'id':_0x175ecd[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0x1bf8f1,null))[_0x6920('0x2b')](function(_0x20b6ac){if(_0x20b6ac){return _0x20b6ac[_0x6920('0xc4')](_0x175ecd[_0x6920('0x41')]['ids']);}})[_0x6920('0x2b')](function(_0x278029){if(_0x278029){return db['CmHopperBlack'][_0x6920('0x2c')]({'where':{'ListId':_0x175ecd[_0x6920('0x41')][_0x6920('0x89')],'VoiceQueueId':_0x175ecd[_0x6920('0x5e')]['id']}})[_0x6920('0x2b')](function(){return _0x278029;});}})[_0x6920('0x2b')](respondWithStatusCode(_0x1bf8f1,null))[_0x6920('0x50')](handleError(_0x1bf8f1,null));}; \ No newline at end of file +var _0xf1c6=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','VoiceQueue','includeAll','findAll','rows','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','rawAttributes','include','omit','updatedAt','body','createdAt','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','nolimit','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','transaction','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','emit','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','removeAgents','userVoiceQueue:remove','addAgents','userVoiceQueue:save','isEmpty','upsert','format','all','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','./voiceQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','then','error','stack','send','index','fieldName','key'];(function(_0x503048,_0x30af72){var _0x3eeb5b=function(_0xae09ae){while(--_0xae09ae){_0x503048['push'](_0x503048['shift']());}};_0x3eeb5b(++_0x30af72);}(_0xf1c6,0x145));var _0x6f1c=function(_0x5395fe,_0x887fa4){_0x5395fe=_0x5395fe-0x0;var _0x4bab55=_0xf1c6[_0x5395fe];return _0x4bab55;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f1c('0x0'));var jsonpatch=require(_0x6f1c('0x1'));var rp=require(_0x6f1c('0x2'));var moment=require(_0x6f1c('0x3'));var BPromise=require(_0x6f1c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f1c('0x5'));var sox=require('sox');var csv=require(_0x6f1c('0x6'));var ejs=require(_0x6f1c('0x7'));var fs=require('fs');var fs_extra=require(_0x6f1c('0x8'));var _=require('lodash');var squel=require(_0x6f1c('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f1c('0xa'));var deskjs=require(_0x6f1c('0xb'));var toCsv=require(_0x6f1c('0x6'));var querystring=require('querystring');var Papa=require(_0x6f1c('0xc'));var Redis=require('ioredis');var authService=require(_0x6f1c('0xd'));var qs=require(_0x6f1c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f1c('0xf'));var logger=require(_0x6f1c('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f1c('0x11'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f1c('0x12')]));require(_0x6f1c('0x13'))[_0x6f1c('0x14')](socket);function respondWithStatusCode(_0x5549d1,_0x82203a){_0x82203a=_0x82203a||0xcc;return function(_0x238c62){if(_0x238c62){return _0x5549d1[_0x6f1c('0x15')](_0x82203a);}return _0x5549d1['status'](_0x82203a)[_0x6f1c('0x16')]();};}function respondWithResult(_0x210abb,_0x5515fa){_0x5515fa=_0x5515fa||0xc8;return function(_0x28fc5f){if(_0x28fc5f){return _0x210abb[_0x6f1c('0x17')](_0x5515fa)[_0x6f1c('0x18')](_0x28fc5f);}};}function respondWithFilteredResult(_0x6e2d39,_0x3c3e21){return function(_0x16d2bb){if(_0x16d2bb){var _0x491151=typeof _0x3c3e21[_0x6f1c('0x19')]===_0x6f1c('0x1a')&&typeof _0x3c3e21[_0x6f1c('0x1b')]===_0x6f1c('0x1a');var _0x20c2bb=_0x16d2bb[_0x6f1c('0x1c')];var _0x4dbb3f=_0x491151?0x0:_0x3c3e21['offset'];var _0x58c2d8=_0x491151?_0x16d2bb[_0x6f1c('0x1c')]:_0x3c3e21['offset']+_0x3c3e21[_0x6f1c('0x1b')];var _0x4f6637;if(_0x58c2d8>=_0x20c2bb){_0x58c2d8=_0x20c2bb;_0x4f6637=0xc8;}else{_0x4f6637=0xce;}_0x6e2d39[_0x6f1c('0x17')](_0x4f6637);return _0x6e2d39[_0x6f1c('0x1d')](_0x6f1c('0x1e'),_0x4dbb3f+'-'+_0x58c2d8+'/'+_0x20c2bb)[_0x6f1c('0x18')](_0x16d2bb);}return null;};}function patchUpdates(_0x2ed8f1){return function(_0x3a082c){try{jsonpatch[_0x6f1c('0x1f')](_0x3a082c,_0x2ed8f1,!![]);}catch(_0x35934b){return BPromise[_0x6f1c('0x20')](_0x35934b);}return _0x3a082c[_0x6f1c('0x21')]();};}function saveUpdates(_0x130bae,_0x2da230){return function(_0x388416){if(_0x388416){return _0x388416[_0x6f1c('0x22')](_0x130bae)['then'](function(_0x2a3b6a){return _0x2a3b6a;});}return null;};}function removeEntity(_0x2b29af,_0x4a8fc1){return function(_0x3c0dd1){if(_0x3c0dd1){return _0x3c0dd1[_0x6f1c('0x23')]()['then'](function(){var _0x59931c=_0x3c0dd1['get']({'plain':!![]});var _0x500e36=[{'name':_0x6f1c('0x24'),'value':_0x6f1c('0x25'),'ignore':![]},{'name':_0x6f1c('0x26'),'value':_0x6f1c('0x27'),'ignore':![]}];var _0x29b952=_(_0x500e36)[_0x6f1c('0x28')](_0x6f1c('0x29'))[_0x6f1c('0x2a')](_0x6f1c('0x2b'))[_0x6f1c('0x2b')]();if(_[_0x6f1c('0x2c')](_0x29b952,_0x59931c[_0x6f1c('0x2d')])){return;}var _0x4ca3cc=_['find'](_0x500e36,[_0x6f1c('0x2b'),_0x59931c[_0x6f1c('0x2d')]])[_0x6f1c('0x2e')];return db[_0x6f1c('0x2f')][_0x6f1c('0x23')]({'where':{'type':_0x4ca3cc,'resourceId':_0x59931c['id']}})['then'](function(){return _0x3c0dd1;});})[_0x6f1c('0x30')](function(){_0x2b29af['status'](0xcc)[_0x6f1c('0x16')]();});}};}function handleEntityNotFound(_0x48c5f4,_0x23b575){return function(_0x16045d){if(!_0x16045d){_0x48c5f4[_0x6f1c('0x15')](0x194);}return _0x16045d;};}function handleError(_0x14d3cf,_0x2c7bad){_0x2c7bad=_0x2c7bad||0x1f4;return function(_0x1c8619){logger[_0x6f1c('0x31')](_0x1c8619[_0x6f1c('0x32')]);if(_0x1c8619[_0x6f1c('0x2e')]){delete _0x1c8619[_0x6f1c('0x2e')];}_0x14d3cf['status'](_0x2c7bad)[_0x6f1c('0x33')](_0x1c8619);};}exports[_0x6f1c('0x34')]=function(_0x1e5e4f,_0x5d7a33){var _0x317df4={},_0x1609e3={},_0x454507={'count':0x0,'rows':[]};var _0x326f85=_[_0x6f1c('0x2a')](db['VoiceQueue']['rawAttributes'],function(_0x4aa4af){return{'name':_0x4aa4af[_0x6f1c('0x35')],'type':_0x4aa4af[_0x6f1c('0x2d')][_0x6f1c('0x36')]};});_0x1609e3[_0x6f1c('0x37')]=_[_0x6f1c('0x2a')](_0x326f85,_0x6f1c('0x2e'));_0x1609e3[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x1e5e4f[_0x6f1c('0x38')]);_0x1609e3[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x1609e3[_0x6f1c('0x37')],_0x1609e3[_0x6f1c('0x38')]);_0x317df4[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x1609e3['model'],qs['fields'](_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x317df4[_0x6f1c('0x3c')]=_0x317df4[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x317df4[_0x6f1c('0x3c')]:_0x1609e3[_0x6f1c('0x37')];if(!_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x3f')]('nolimit')){_0x317df4[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x1b')]);_0x317df4['offset']=qs[_0x6f1c('0x19')](_0x1e5e4f['query'][_0x6f1c('0x19')]);}_0x317df4[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x317df4[_0x6f1c('0x42')]=qs[_0x6f1c('0x3a')](_[_0x6f1c('0x43')](_0x1e5e4f[_0x6f1c('0x38')],_0x1609e3[_0x6f1c('0x3a')]),_0x326f85);if(_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x28')]){_0x317df4['where']=_[_0x6f1c('0x44')](_0x317df4[_0x6f1c('0x42')],{'$or':_['map'](_0x326f85,function(_0x30b5d0){if(_0x30b5d0[_0x6f1c('0x2d')]!==_0x6f1c('0x45')){var _0x682523={};_0x682523[_0x30b5d0[_0x6f1c('0x2e')]]={'$like':'%'+_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x682523;}})});}_0x317df4=_['merge']({},_0x317df4,_0x1e5e4f[_0x6f1c('0x46')]);var _0x486bd5={'where':_0x317df4[_0x6f1c('0x42')]};return db[_0x6f1c('0x47')][_0x6f1c('0x1c')](_0x486bd5)[_0x6f1c('0x30')](function(_0x200596){_0x454507['count']=_0x200596;if(_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x48')]){_0x317df4['include']=[{'all':!![]}];}return db[_0x6f1c('0x47')][_0x6f1c('0x49')](_0x317df4);})[_0x6f1c('0x30')](function(_0x491fdd){_0x454507[_0x6f1c('0x4a')]=_0x491fdd;return _0x454507;})[_0x6f1c('0x30')](respondWithFilteredResult(_0x5d7a33,_0x317df4))[_0x6f1c('0x4b')](handleError(_0x5d7a33,null));};exports[_0x6f1c('0x4c')]=function(_0x18d103,_0x4453b0){var _0x434274={'raw':![],'where':{'id':_0x18d103['params']['id']}},_0x2f8841={};_0x2f8841[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x47')]['rawAttributes']);_0x2f8841[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x18d103[_0x6f1c('0x38')]);_0x2f8841['filters']=_[_0x6f1c('0x3b')](_0x2f8841[_0x6f1c('0x37')],_0x2f8841[_0x6f1c('0x38')]);_0x434274[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x2f8841[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x18d103[_0x6f1c('0x38')]['fields']));_0x434274[_0x6f1c('0x3c')]=_0x434274[_0x6f1c('0x3c')]['length']?_0x434274[_0x6f1c('0x3c')]:_0x2f8841[_0x6f1c('0x37')];if(_0x18d103['query']['includeAll']){_0x434274['include']=[{'all':!![]}];}_0x434274=_[_0x6f1c('0x44')]({},_0x434274,_0x18d103['options']);return db['VoiceQueue'][_0x6f1c('0x4d')](_0x434274)[_0x6f1c('0x30')](handleEntityNotFound(_0x4453b0,null))['then'](respondWithResult(_0x4453b0,null))[_0x6f1c('0x4b')](handleError(_0x4453b0,null));};exports[_0x6f1c('0x4e')]=function(_0x39b67c,_0x4f7fb1){return db[_0x6f1c('0x47')][_0x6f1c('0x4e')](_0x39b67c['body'],{})[_0x6f1c('0x30')](function(_0x4efe57){var _0x410903=_0x39b67c[_0x6f1c('0x4f')][_0x6f1c('0x50')]({'plain':!![]});if(!_0x410903)throw new Error(_0x6f1c('0x51'));if(_0x410903[_0x6f1c('0x52')]===_0x6f1c('0x4f')){var _0x480934=_0x4efe57['get']({'plain':!![]});var _0x4fe6e3=[{'name':_0x6f1c('0x24'),'value':_0x6f1c('0x25')},{'name':'QueueCampaigns','value':_0x6f1c('0x27')}];var _0x5052b8=_[_0x6f1c('0x4d')](_0x4fe6e3,['value',_0x480934[_0x6f1c('0x2d')]])[_0x6f1c('0x2e')];return db[_0x6f1c('0x53')][_0x6f1c('0x4d')]({'where':{'name':_0x5052b8,'userProfileId':_0x410903[_0x6f1c('0x54')]},'raw':!![]})[_0x6f1c('0x30')](function(_0x1f51b4){if(_0x1f51b4&&_0x1f51b4[_0x6f1c('0x55')]===0x0){return db[_0x6f1c('0x2f')][_0x6f1c('0x4e')]({'name':_0x480934[_0x6f1c('0x2e')],'resourceId':_0x480934['id'],'type':_0x1f51b4['name'],'sectionId':_0x1f51b4['id']},{})[_0x6f1c('0x30')](function(){return _0x4efe57;});}else{return _0x4efe57;}})['catch'](function(_0x761896){logger['error'](_0x6f1c('0x56'),_0x761896);throw _0x761896;});}return _0x4efe57;})[_0x6f1c('0x30')](respondWithResult(_0x4f7fb1,0xc9))['catch'](handleError(_0x4f7fb1,null));};exports[_0x6f1c('0x57')]=function(_0x197b3d,_0x4a236f){var _0x4c1c7e={'where':{'id':_0x197b3d[_0x6f1c('0x58')]['id']}},_0x1ba3e8={};_0x1ba3e8[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x47')][_0x6f1c('0x59')]);_0x4c1c7e[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x1ba3e8[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x197b3d['query'][_0x6f1c('0x3d')]));_0x4c1c7e[_0x6f1c('0x3c')]=_0x4c1c7e['attributes']['length']?_0x4c1c7e[_0x6f1c('0x3c')]:_0x1ba3e8[_0x6f1c('0x37')];if(_0x197b3d['query'][_0x6f1c('0x48')]){_0x4c1c7e[_0x6f1c('0x5a')]=[{'all':!![]}];}_0x4c1c7e=_[_0x6f1c('0x44')]({},_0x4c1c7e,_0x197b3d[_0x6f1c('0x46')]);return db[_0x6f1c('0x47')][_0x6f1c('0x4d')](_0x4c1c7e)[_0x6f1c('0x30')](handleEntityNotFound(_0x4a236f,null))['then'](function(_0xc11cdf){if(_0xc11cdf){var _0x233e42=_0xc11cdf['get']({'plain':!![]});_0x233e42=qs[_0x6f1c('0x5b')](_0x233e42,['id','createdAt',_0x6f1c('0x5c')]);_0x197b3d[_0x6f1c('0x5d')]=_['omit'](_0x197b3d[_0x6f1c('0x5d')],['id',_0x6f1c('0x5e'),_0x6f1c('0x5c')]);return db['VoiceQueue'][_0x6f1c('0x4e')](_[_0x6f1c('0x44')](_0x233e42,_0x197b3d[_0x6f1c('0x5d')]),{'include':_0x197b3d[_0x6f1c('0x38')][_0x6f1c('0x48')]?[{'all':!![]}]:undefined})[_0x6f1c('0x30')](function(_0xb34928){var _0x51ae01=_0x197b3d[_0x6f1c('0x4f')][_0x6f1c('0x50')]({'plain':!![]});if(!_0x51ae01)throw new Error(_0x6f1c('0x51'));if(_0x51ae01['role']===_0x6f1c('0x4f')){var _0x2c50ab=_0xb34928['get']({'plain':!![]});var _0x753f9f=[{'name':_0x6f1c('0x24'),'value':_0x6f1c('0x25')},{'name':_0x6f1c('0x26'),'value':_0x6f1c('0x27')}];var _0x4bd3e3=_['find'](_0x753f9f,[_0x6f1c('0x2b'),_0x2c50ab['type']])['name'];return db[_0x6f1c('0x53')]['find']({'where':{'name':_0x4bd3e3,'userProfileId':_0x51ae01[_0x6f1c('0x54')]},'raw':!![]})[_0x6f1c('0x30')](function(_0x34395b){if(_0x34395b&&_0x34395b[_0x6f1c('0x55')]===0x0){return db[_0x6f1c('0x2f')][_0x6f1c('0x4e')]({'name':_0x2c50ab[_0x6f1c('0x2e')],'resourceId':_0x2c50ab['id'],'type':_0x34395b[_0x6f1c('0x2e')],'sectionId':_0x34395b['id']},{})[_0x6f1c('0x30')](function(){return _0xb34928;});}else{return _0xb34928;}})[_0x6f1c('0x4b')](function(_0x5d1416){logger[_0x6f1c('0x31')](_0x6f1c('0x56'),_0x5d1416);throw _0x5d1416;});}return _0xb34928;});}})[_0x6f1c('0x30')](respondWithResult(_0x4a236f,0xc9))['catch'](handleError(_0x4a236f,null));};exports[_0x6f1c('0x22')]=function(_0x2427c5,_0x112865){if(_0x2427c5[_0x6f1c('0x5d')]['id']){delete _0x2427c5[_0x6f1c('0x5d')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x2427c5['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x112865,null))['then'](saveUpdates(_0x2427c5[_0x6f1c('0x5d')],null))[_0x6f1c('0x30')](respondWithResult(_0x112865,null))[_0x6f1c('0x4b')](handleError(_0x112865,null));};exports[_0x6f1c('0x23')]=function(_0x4805c9,_0x2cfae1){return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x4805c9['params']['id']}})['then'](handleEntityNotFound(_0x2cfae1,null))[_0x6f1c('0x30')](removeEntity(_0x2cfae1,null))['catch'](handleError(_0x2cfae1,null));};exports[_0x6f1c('0x5f')]=function(_0x1d05bb,_0x46bf09,_0x114299){var _0x3034fe={'raw':![],'where':{}};var _0x92cb8c={};var _0x115c7b={'count':0x0,'rows':[]};return db[_0x6f1c('0x47')][_0x6f1c('0x60')]({'where':{'id':_0x1d05bb[_0x6f1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x46bf09,null))['then'](function(_0x16b758){if(_0x16b758){_0x92cb8c[_0x6f1c('0x37')]=_['keys'](db['CmHopper'][_0x6f1c('0x59')]);_0x92cb8c[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x1d05bb[_0x6f1c('0x38')]);_0x92cb8c[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x92cb8c[_0x6f1c('0x37')],_0x92cb8c[_0x6f1c('0x38')]);_0x3034fe[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x92cb8c[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x1d05bb['query'][_0x6f1c('0x3d')]));_0x3034fe[_0x6f1c('0x3c')]=_0x3034fe[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x3034fe[_0x6f1c('0x3c')]:_0x92cb8c['model'];if(!_0x1d05bb[_0x6f1c('0x38')]['hasOwnProperty']('nolimit')){_0x3034fe[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x1d05bb[_0x6f1c('0x38')][_0x6f1c('0x1b')]);_0x3034fe[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x1d05bb[_0x6f1c('0x38')]['offset']);}_0x3034fe[_0x6f1c('0x40')]=qs['sort'](_0x1d05bb[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x3034fe['where']=qs[_0x6f1c('0x3a')](_[_0x6f1c('0x43')](_0x1d05bb[_0x6f1c('0x38')],_0x92cb8c[_0x6f1c('0x3a')]));_0x3034fe[_0x6f1c('0x42')][_0x6f1c('0x61')]=_0x16b758['id'];if(_0x1d05bb[_0x6f1c('0x38')]['filter']){_0x3034fe[_0x6f1c('0x42')]=_['merge'](_0x3034fe['where'],{'$or':_['map'](_0x3034fe[_0x6f1c('0x3c')],function(_0x49afcd){var _0x287007={};_0x287007[_0x49afcd]={'$like':'%'+_0x1d05bb['query'][_0x6f1c('0x28')]+'%'};return _0x287007;})});}_0x3034fe=_[_0x6f1c('0x44')]({},_0x3034fe,_0x1d05bb[_0x6f1c('0x46')]);return db['CmHopper'][_0x6f1c('0x1c')]({'where':_0x3034fe[_0x6f1c('0x42')]})[_0x6f1c('0x30')](function(_0x4909e9){_0x115c7b[_0x6f1c('0x1c')]=_0x4909e9;if(_0x1d05bb['query'][_0x6f1c('0x48')]){_0x3034fe['include']=[{'all':!![]}];}return db[_0x6f1c('0x62')][_0x6f1c('0x49')](_0x3034fe);})[_0x6f1c('0x30')](function(_0x2c21f9){_0x115c7b[_0x6f1c('0x4a')]=_0x2c21f9;return _0x115c7b;});}})[_0x6f1c('0x30')](respondWithFilteredResult(_0x46bf09,_0x3034fe))[_0x6f1c('0x4b')](handleError(_0x46bf09,null));};exports[_0x6f1c('0x63')]=function(_0x40f43f,_0x35dec3,_0x427b2b){var _0x342047={'raw':!![],'where':{}};var _0x5898dd={};var _0x55a654={'count':0x0,'rows':[]};return db[_0x6f1c('0x47')]['findOne']({'where':{'id':_0x40f43f['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x35dec3,null))['then'](function(_0x4a449a){if(_0x4a449a){_0x5898dd[_0x6f1c('0x37')]=_['keys'](db[_0x6f1c('0x64')]['rawAttributes']);_0x5898dd[_0x6f1c('0x38')]=_['keys'](_0x40f43f[_0x6f1c('0x38')]);_0x5898dd[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x5898dd['model'],_0x5898dd[_0x6f1c('0x38')]);_0x342047[_0x6f1c('0x3c')]=_['intersection'](_0x5898dd[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x342047[_0x6f1c('0x3c')]=_0x342047[_0x6f1c('0x3c')]['length']?_0x342047[_0x6f1c('0x3c')]:_0x5898dd['model'];if(!_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x3f')]('nolimit')){_0x342047['limit']=qs['limit'](_0x40f43f[_0x6f1c('0x38')]['limit']);_0x342047[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x40f43f['query']['offset']);}_0x342047[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x342047['where']=qs[_0x6f1c('0x3a')](_['pick'](_0x40f43f[_0x6f1c('0x38')],_0x5898dd[_0x6f1c('0x3a')]));_0x342047['where']['VoiceQueueId']=_0x4a449a['id'];if(_0x40f43f['query'][_0x6f1c('0x28')]){_0x342047[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0x342047['where'],{'$or':_[_0x6f1c('0x2a')](_0x342047['attributes'],function(_0x64cc2e){var _0x513515={};_0x513515[_0x64cc2e]={'$like':'%'+_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x513515;})});}_0x342047=_['merge']({},_0x342047,_0x40f43f[_0x6f1c('0x46')]);return db['CmHopperHistory'][_0x6f1c('0x1c')]({'where':_0x342047['where']})[_0x6f1c('0x30')](function(_0x34a038){_0x55a654['count']=_0x34a038;if(_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x48')]){_0x342047[_0x6f1c('0x5a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6f1c('0x49')](_0x342047);})[_0x6f1c('0x30')](function(_0x1f8354){_0x55a654[_0x6f1c('0x4a')]=_0x1f8354;return _0x55a654;});}})[_0x6f1c('0x30')](respondWithFilteredResult(_0x35dec3,_0x342047))['catch'](handleError(_0x35dec3,null));};exports['getHopperFinals']=function(_0x4b5eeb,_0x1496b0,_0x9a7cfc){var _0xbc5e6e={'raw':!![],'where':{}};var _0x428c1f={};var _0x5e6ad2={'count':0x0,'rows':[]};return db[_0x6f1c('0x47')][_0x6f1c('0x60')]({'where':{'id':_0x4b5eeb[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x1496b0,null))[_0x6f1c('0x30')](function(_0x4384e9){if(_0x4384e9){_0x428c1f['model']=_[_0x6f1c('0x39')](db[_0x6f1c('0x65')]['rawAttributes']);_0x428c1f[_0x6f1c('0x38')]=_['keys'](_0x4b5eeb[_0x6f1c('0x38')]);_0x428c1f['filters']=_[_0x6f1c('0x3b')](_0x428c1f[_0x6f1c('0x37')],_0x428c1f[_0x6f1c('0x38')]);_0xbc5e6e[_0x6f1c('0x3c')]=_['intersection'](_0x428c1f[_0x6f1c('0x37')],qs['fields'](_0x4b5eeb['query'][_0x6f1c('0x3d')]));_0xbc5e6e[_0x6f1c('0x3c')]=_0xbc5e6e[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0xbc5e6e['attributes']:_0x428c1f['model'];if(!_0x4b5eeb[_0x6f1c('0x38')][_0x6f1c('0x3f')]('nolimit')){_0xbc5e6e['limit']=qs[_0x6f1c('0x1b')](_0x4b5eeb[_0x6f1c('0x38')]['limit']);_0xbc5e6e[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x4b5eeb[_0x6f1c('0x38')][_0x6f1c('0x19')]);}_0xbc5e6e['order']=qs[_0x6f1c('0x41')](_0x4b5eeb[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0xbc5e6e['where']=qs['filters'](_[_0x6f1c('0x43')](_0x4b5eeb[_0x6f1c('0x38')],_0x428c1f[_0x6f1c('0x3a')]));_0xbc5e6e['where'][_0x6f1c('0x61')]=_0x4384e9['id'];if(_0x4b5eeb['query'][_0x6f1c('0x28')]){_0xbc5e6e[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0xbc5e6e[_0x6f1c('0x42')],{'$or':_[_0x6f1c('0x2a')](_0xbc5e6e[_0x6f1c('0x3c')],function(_0x50b6c3){var _0x50a5f2={};_0x50a5f2[_0x50b6c3]={'$like':'%'+_0x4b5eeb['query'][_0x6f1c('0x28')]+'%'};return _0x50a5f2;})});}_0xbc5e6e=_[_0x6f1c('0x44')]({},_0xbc5e6e,_0x4b5eeb[_0x6f1c('0x46')]);return db[_0x6f1c('0x65')][_0x6f1c('0x1c')]({'where':_0xbc5e6e[_0x6f1c('0x42')]})[_0x6f1c('0x30')](function(_0x58c7b7){_0x5e6ad2['count']=_0x58c7b7;if(_0x4b5eeb[_0x6f1c('0x38')][_0x6f1c('0x48')]){_0xbc5e6e['include']=[{'all':!![]}];}return db[_0x6f1c('0x65')][_0x6f1c('0x49')](_0xbc5e6e);})[_0x6f1c('0x30')](function(_0xd15eba){_0x5e6ad2['rows']=_0xd15eba;return _0x5e6ad2;});}})[_0x6f1c('0x30')](respondWithFilteredResult(_0x1496b0,_0xbc5e6e))[_0x6f1c('0x4b')](handleError(_0x1496b0,null));};exports[_0x6f1c('0x66')]=function(_0x19d68b,_0x100bd3,_0x1bdb0f){var _0x44e89d={'raw':!![],'where':{}};var _0x1f0c6b={};var _0x57ca7f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x19d68b[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x100bd3,null))[_0x6f1c('0x30')](function(_0x2d405d){if(_0x2d405d){_0x1f0c6b[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x67')][_0x6f1c('0x59')]);_0x1f0c6b['query']=_['keys'](_0x19d68b[_0x6f1c('0x38')]);_0x1f0c6b[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x1f0c6b[_0x6f1c('0x37')],_0x1f0c6b[_0x6f1c('0x38')]);_0x44e89d[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x1f0c6b[_0x6f1c('0x37')],qs['fields'](_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x44e89d[_0x6f1c('0x3c')]=_0x44e89d[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x44e89d[_0x6f1c('0x3c')]:_0x1f0c6b[_0x6f1c('0x37')];if(!_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x44e89d[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x1b')]);_0x44e89d[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x19')]);}_0x44e89d['order']=qs[_0x6f1c('0x41')](_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x44e89d[_0x6f1c('0x42')]=qs[_0x6f1c('0x3a')](_['pick'](_0x19d68b[_0x6f1c('0x38')],_0x1f0c6b[_0x6f1c('0x3a')]));_0x44e89d[_0x6f1c('0x42')]['VoiceQueueId']=_0x2d405d['id'];if(_0x19d68b[_0x6f1c('0x38')]['filter']){_0x44e89d[_0x6f1c('0x42')]=_['merge'](_0x44e89d[_0x6f1c('0x42')],{'$or':_['map'](_0x44e89d[_0x6f1c('0x3c')],function(_0x35ff82){var _0x1bdf67={};_0x1bdf67[_0x35ff82]={'$like':'%'+_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x1bdf67;})});}_0x44e89d=_[_0x6f1c('0x44')]({},_0x44e89d,_0x19d68b[_0x6f1c('0x46')]);return db[_0x6f1c('0x67')][_0x6f1c('0x1c')]({'where':_0x44e89d[_0x6f1c('0x42')]})[_0x6f1c('0x30')](function(_0xfef5b1){_0x57ca7f[_0x6f1c('0x1c')]=_0xfef5b1;if(_0x19d68b['query'][_0x6f1c('0x48')]){_0x44e89d[_0x6f1c('0x5a')]=[{'all':!![]}];}return db[_0x6f1c('0x67')][_0x6f1c('0x49')](_0x44e89d);})[_0x6f1c('0x30')](function(_0x5cce63){_0x57ca7f[_0x6f1c('0x4a')]=_0x5cce63;return _0x57ca7f;});}})[_0x6f1c('0x30')](respondWithFilteredResult(_0x100bd3,_0x44e89d))[_0x6f1c('0x4b')](handleError(_0x100bd3,null));};exports[_0x6f1c('0x69')]=function(_0x4de2ea,_0x31f061,_0x48e056){var _0x59cf5c={};var _0x531394={};var _0xfbb84b;var _0x4ea59c;return db['VoiceQueue'][_0x6f1c('0x60')]({'where':{'id':_0x4de2ea['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x31f061,null))[_0x6f1c('0x30')](function(_0x577d0e){if(_0x577d0e){_0xfbb84b=_0x577d0e;_0x531394[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x6a')][_0x6f1c('0x59')]);_0x531394['query']=_[_0x6f1c('0x39')](_0x4de2ea[_0x6f1c('0x38')]);_0x531394[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x531394[_0x6f1c('0x37')],_0x531394[_0x6f1c('0x38')]);_0x59cf5c[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x531394[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x4de2ea['query'][_0x6f1c('0x3d')]));_0x59cf5c[_0x6f1c('0x3c')]=_0x59cf5c['attributes'][_0x6f1c('0x3e')]?_0x59cf5c[_0x6f1c('0x3c')]:_0x531394[_0x6f1c('0x37')];_0x59cf5c[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0x4de2ea['query'][_0x6f1c('0x41')]);_0x59cf5c[_0x6f1c('0x42')]=qs[_0x6f1c('0x3a')](_[_0x6f1c('0x43')](_0x4de2ea[_0x6f1c('0x38')],_0x531394[_0x6f1c('0x3a')]));if(_0x4de2ea[_0x6f1c('0x38')][_0x6f1c('0x28')]){_0x59cf5c[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0x59cf5c[_0x6f1c('0x42')],{'$or':_[_0x6f1c('0x2a')](_0x59cf5c[_0x6f1c('0x3c')],function(_0x2e302e){var _0x353526={};_0x353526[_0x2e302e]={'$like':'%'+_0x4de2ea[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x353526;})});}_0x59cf5c=_['merge']({},_0x59cf5c,_0x4de2ea['options']);return _0xfbb84b[_0x6f1c('0x69')](_0x59cf5c);}})[_0x6f1c('0x30')](function(_0x4248fe){if(_0x4248fe){_0x4ea59c=_0x4248fe[_0x6f1c('0x3e')];if(!_0x4de2ea['query'][_0x6f1c('0x3f')]('nolimit')){_0x59cf5c['limit']=qs['limit'](_0x4de2ea['query']['limit']);_0x59cf5c['offset']=qs['offset'](_0x4de2ea[_0x6f1c('0x38')][_0x6f1c('0x19')]);}return _0xfbb84b[_0x6f1c('0x69')](_0x59cf5c);}})['then'](function(_0x3db0ad){if(_0x3db0ad){return _0x3db0ad?{'count':_0x4ea59c,'rows':_0x3db0ad}:null;}})[_0x6f1c('0x30')](respondWithResult(_0x31f061,null))[_0x6f1c('0x4b')](handleError(_0x31f061,null));};exports[_0x6f1c('0x6b')]=function(_0x2fcd7b,_0x43b068,_0x4ea6a6){var _0x4befd0=_0x2fcd7b[_0x6f1c('0x5d')][_0x6f1c('0x6c')];var _0x3306b9=_[_0x6f1c('0x2a')](_0x4befd0,'id');return db[_0x6f1c('0x6a')][_0x6f1c('0x49')]({'where':{'id':_0x3306b9},'attributes':['id'],'include':[{'model':db[_0x6f1c('0x6d')],'as':'Agents','attributes':['id',_0x6f1c('0x2e'),_0x6f1c('0x6e'),_0x6f1c('0x6f'),_0x6f1c('0x70')],'raw':!![]}]})[_0x6f1c('0x30')](function(_0x24ef0b){if(_0x24ef0b){var _0x57e2ea=_[_0x6f1c('0x71')](_0x24ef0b,function(_0x557c14){var _0x19368f=_0x557c14[_0x6f1c('0x50')]({'plain':!![]});_0x19368f[_0x6f1c('0x72')][_0x6f1c('0x73')](function(_0x2ee82d){_0x2ee82d['penalty']=_['find'](_0x4befd0,{'id':_0x19368f['id']})[_0x6f1c('0x74')];});return _0x19368f['Agents'];});return db[_0x6f1c('0x47')]['find']({'where':{'id':_0x2fcd7b[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](function(_0x5d06d9){return db['sequelize'][_0x6f1c('0x75')](function(_0x58e187){return _0x5d06d9[_0x6f1c('0x6b')](_0x3306b9,{'transaction':_0x58e187})[_0x6f1c('0x30')](function(){return BPromise[_0x6f1c('0x76')](_0x4befd0,function(_0x13dd68){return db[_0x6f1c('0x77')]['upsert']({'TeamId':_0x13dd68['id'],'VoiceQueueId':_0x2fcd7b[_0x6f1c('0x58')]['id'],'penalty':_0x13dd68[_0x6f1c('0x74')]},{'transaction':_0x58e187});});})[_0x6f1c('0x30')](function(){return BPromise[_0x6f1c('0x76')](_0x57e2ea,function(_0x4bad66){return db['UserVoiceQueue'][_0x6f1c('0x78')]({'where':{'UserId':_0x4bad66['id'],'VoiceQueueId':_0x2fcd7b[_0x6f1c('0x58')]['id']},'defaults':{'penalty':_0x4bad66[_0x6f1c('0x74')]},'transaction':_0x58e187});});})['then'](function(){return BPromise[_0x6f1c('0x76')](_[_0x6f1c('0x28')](_0x57e2ea,{'online':!![]}),function(_0x52727d){return db[_0x6f1c('0x79')]['upsert']({'membername':_0x52727d[_0x6f1c('0x2e')],'UserId':_0x52727d['id'],'queue_name':_0x5d06d9[_0x6f1c('0x2e')],'VoiceQueueId':_0x5d06d9['id'],'interface':_[_0x6f1c('0x7a')](_0x52727d[_0x6f1c('0x70')])?util['format'](_0x6f1c('0x7b'),_0x52727d[_0x6f1c('0x2e')]):_0x52727d[_0x6f1c('0x70')],'paused':_0x52727d[_0x6f1c('0x6f')]||![],'penalty':_0x52727d[_0x6f1c('0x74')]},{'transaction':_0x58e187});});})['then'](function(){_0x57e2ea[_0x6f1c('0x73')](function(_0x12d39c){socket[_0x6f1c('0x7c')]('userVoiceQueue:save',{'UserId':_0x12d39c['id'],'VoiceQueueId':_0x5d06d9['id']});});});});});}})['then'](respondWithStatusCode(_0x43b068,null))[_0x6f1c('0x4b')](handleError(_0x43b068,null));};exports[_0x6f1c('0x7d')]=function(_0x22721d,_0x465ec8,_0x1e3d9b){return db[_0x6f1c('0x6a')]['findAll']({'where':{'id':_0x22721d[_0x6f1c('0x38')][_0x6f1c('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x6f1c('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6f1c('0x30')](handleEntityNotFound(_0x465ec8,null))[_0x6f1c('0x30')](function(_0x1f2580){var _0x33cb05=_[_0x6f1c('0x2a')](_0x1f2580,'id');var _0x3d2590=[];var _0x44c4f3=[];var _0x32642f=squel['select']();_0x32642f[_0x6f1c('0x7f')](_0x6f1c('0x80'))[_0x6f1c('0x81')](_0x6f1c('0x82'),'tq')[_0x6f1c('0x83')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6f1c('0x84'),_0x22721d[_0x6f1c('0x58')]['id']);for(var _0x5705b9=0x0;_0x5705b9<_0x1f2580[_0x6f1c('0x3e')];_0x5705b9+=0x1){let _0x4c64d4=_0x1f2580[_0x5705b9];for(var _0x9079ef=0x0;_0x9079ef<_0x4c64d4[_0x6f1c('0x72')][_0x6f1c('0x3e')];_0x9079ef+=0x1){let _0x59c873=_0x4c64d4[_0x6f1c('0x72')][_0x9079ef];var _0x109a99=_0x32642f[_0x6f1c('0x57')]();_0x109a99[_0x6f1c('0x42')](_0x6f1c('0x85'),_0x59c873['id']);_0x44c4f3[_0x6f1c('0x86')](db[_0x6f1c('0x87')]['query'](_0x109a99[_0x6f1c('0x88')](),{'type':db[_0x6f1c('0x87')]['QueryTypes'][_0x6f1c('0x89')]})[_0x6f1c('0x30')](function(_0x5c33e0){if(_0x5c33e0[_0x6f1c('0x3e')]===0x1){return _0x59c873['id'];}else{var _0x59106b=_[_0x6f1c('0x8a')](_[_0x6f1c('0x2a')](_0x5c33e0,_0x6f1c('0x8b')),function(_0x1e9294){return _[_0x6f1c('0x2c')](_0x33cb05,_0x1e9294);});if(_0x59106b){return _0x59c873['id'];}}}));}}return BPromise['all'](_0x44c4f3)[_0x6f1c('0x30')](function(_0x35d408){_0x3d2590=_(_0x3d2590)['union'](_0x35d408)['compact']()[_0x6f1c('0x2b')]();return db['VoiceQueue'][_0x6f1c('0x4d')]({'where':{'id':_0x22721d[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](function(_0x439561){return db[_0x6f1c('0x87')][_0x6f1c('0x75')](function(_0x5edffb){return _0x439561[_0x6f1c('0x7d')](_0x22721d[_0x6f1c('0x38')][_0x6f1c('0x7e')],{'transaction':_0x5edffb})[_0x6f1c('0x30')](function(){if(!_['isEmpty'](_0x3d2590)){return _0x439561[_0x6f1c('0x8c')](_0x3d2590,{'transaction':_0x5edffb})[_0x6f1c('0x30')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x22721d[_0x6f1c('0x58')]['id'],'UserId':_0x3d2590},'transaction':_0x5edffb});});}})[_0x6f1c('0x30')](function(){_0x3d2590[_0x6f1c('0x73')](function(_0x525349){socket[_0x6f1c('0x7c')](_0x6f1c('0x8d'),{'UserId':_0x525349,'VoiceQueueId':_0x439561['id']});});});});});});})['then'](respondWithStatusCode(_0x465ec8,null))[_0x6f1c('0x4b')](handleError(_0x465ec8,null));};exports[_0x6f1c('0x8e')]=function(_0x312cd5,_0xf2eb69,_0x4a893f){var _0x3c7e20,_0x320d9e;return db['VoiceQueue'][_0x6f1c('0x4d')]({'where':{'id':_0x312cd5[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0xf2eb69,null))['then'](function(_0x1f0b6e){if(_0x1f0b6e){_0x320d9e=_0x1f0b6e;return _0x1f0b6e[_0x6f1c('0x8e')](_0x312cd5[_0x6f1c('0x5d')][_0x6f1c('0x7e')],_[_0x6f1c('0x5b')](_0x312cd5[_0x6f1c('0x5d')],['ids','id'])||{})['spread'](function(_0x1e98db){for(var _0x104a64=0x0;_0x104a64<_0x312cd5[_0x6f1c('0x5d')][_0x6f1c('0x7e')][_0x6f1c('0x3e')];_0x104a64+=0x1){socket['emit'](_0x6f1c('0x8f'),{'UserId':Number(_0x312cd5[_0x6f1c('0x5d')]['ids'][_0x104a64]),'VoiceQueueId':Number(_0x312cd5['params']['id'])});}return _0x1e98db;});}})[_0x6f1c('0x30')](function(_0x537b5f){_0x3c7e20=_0x537b5f||[];if(_0x320d9e){return db[_0x6f1c('0x6d')][_0x6f1c('0x49')]({'where':{'id':_0x312cd5[_0x6f1c('0x5d')][_0x6f1c('0x7e')]},'attributes':['id',_0x6f1c('0x2e'),_0x6f1c('0x6e'),'voicePause',_0x6f1c('0x70')],'raw':!![]});}})[_0x6f1c('0x30')](function(_0x5b83ba){if(!_[_0x6f1c('0x90')](_0x5b83ba)){var _0x4cf246=[];for(var _0x10b75b=0x0;_0x10b75b<_0x5b83ba[_0x6f1c('0x3e')];_0x10b75b++){if(_0x5b83ba[_0x10b75b][_0x6f1c('0x6e')]){_0x4cf246[_0x6f1c('0x86')](db[_0x6f1c('0x79')][_0x6f1c('0x91')]({'membername':_0x5b83ba[_0x10b75b][_0x6f1c('0x2e')],'UserId':_0x5b83ba[_0x10b75b]['id'],'queue_name':_0x320d9e[_0x6f1c('0x2e')],'VoiceQueueId':_0x320d9e['id'],'interface':_[_0x6f1c('0x7a')](_0x5b83ba[_0x10b75b][_0x6f1c('0x70')])?util[_0x6f1c('0x92')](_0x6f1c('0x7b'),_0x5b83ba[_0x10b75b][_0x6f1c('0x2e')]):_0x5b83ba[_0x10b75b][_0x6f1c('0x70')],'paused':_0x5b83ba[_0x10b75b]['voicePause']||![],'penalty':_0x312cd5['body'][_0x6f1c('0x74')]||0x0}));}}return BPromise[_0x6f1c('0x93')](_0x4cf246);}})[_0x6f1c('0x30')](function(){return _0x3c7e20;})['then'](respondWithResult(_0xf2eb69,null))[_0x6f1c('0x4b')](handleError(_0xf2eb69,null));};exports[_0x6f1c('0x8c')]=function(_0x13d93b,_0x48ebef,_0x5cb835){return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x13d93b[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x48ebef,null))[_0x6f1c('0x30')](function(_0x368cc2){if(_0x368cc2){return _0x368cc2[_0x6f1c('0x8c')](_0x13d93b[_0x6f1c('0x38')]['ids'])['then'](function(){if(_['isArray'](_0x13d93b[_0x6f1c('0x38')][_0x6f1c('0x7e')])){for(var _0x720a5=0x0;_0x720a5<_0x13d93b[_0x6f1c('0x38')]['ids']['length'];_0x720a5+=0x1){socket['emit'](_0x6f1c('0x8d'),{'UserId':Number(_0x13d93b['query']['ids'][_0x720a5]),'VoiceQueueId':Number(_0x13d93b[_0x6f1c('0x58')]['id'])});}}else{socket[_0x6f1c('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x13d93b['query'][_0x6f1c('0x7e')]),'VoiceQueueId':Number(_0x13d93b[_0x6f1c('0x58')]['id'])});}});}})[_0x6f1c('0x30')](function(_0x3b834f){return db['UserVoiceQueueRt'][_0x6f1c('0x23')]({'where':{'VoiceQueueId':_0x13d93b[_0x6f1c('0x58')]['id'],'UserId':_0x13d93b[_0x6f1c('0x38')]['ids']}})[_0x6f1c('0x30')](function(){return _0x3b834f;});})[_0x6f1c('0x30')](respondWithStatusCode(_0x48ebef,null))['catch'](handleError(_0x48ebef,null));};exports[_0x6f1c('0x94')]=function(_0x366fe8,_0x2e2ba7,_0x54c44b){var _0x2948f8={};var _0x450a81={};var _0x15af61;var _0x5e9408;return db['VoiceQueue']['findOne']({'where':{'id':_0x366fe8[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x2e2ba7,null))[_0x6f1c('0x30')](function(_0x46daad){if(_0x46daad){_0x15af61=_0x46daad;_0x450a81[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x6d')][_0x6f1c('0x59')]);_0x450a81[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x366fe8[_0x6f1c('0x38')]);_0x450a81[_0x6f1c('0x3a')]=_['intersection'](_0x450a81[_0x6f1c('0x37')],_0x450a81[_0x6f1c('0x38')]);_0x2948f8[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x450a81[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x2948f8[_0x6f1c('0x3c')]=_0x2948f8[_0x6f1c('0x3c')]['length']?_0x2948f8[_0x6f1c('0x3c')]:_0x450a81[_0x6f1c('0x37')];_0x2948f8['order']=qs[_0x6f1c('0x41')](_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x2948f8[_0x6f1c('0x42')]=qs['filters'](_[_0x6f1c('0x43')](_0x366fe8[_0x6f1c('0x38')],_0x450a81['filters']));if(_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x28')]){_0x2948f8[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0x2948f8['where'],{'$or':_[_0x6f1c('0x2a')](_0x2948f8[_0x6f1c('0x3c')],function(_0x5c09ec){var _0x33a01e={};_0x33a01e[_0x5c09ec]={'$like':'%'+_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x33a01e;})});}_0x2948f8=_[_0x6f1c('0x44')]({},_0x2948f8,_0x366fe8[_0x6f1c('0x46')]);return _0x15af61[_0x6f1c('0x94')](_0x2948f8);}})[_0x6f1c('0x30')](function(_0x1dcb6e){if(_0x1dcb6e){_0x5e9408=_0x1dcb6e[_0x6f1c('0x3e')];if(!_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x2948f8['limit']=qs[_0x6f1c('0x1b')](_0x366fe8['query'][_0x6f1c('0x1b')]);_0x2948f8['offset']=qs[_0x6f1c('0x19')](_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x19')]);}return _0x15af61[_0x6f1c('0x94')](_0x2948f8);}})[_0x6f1c('0x30')](function(_0x2f6c74){if(_0x2f6c74){return _0x2f6c74?{'count':_0x5e9408,'rows':_0x2f6c74}:null;}})['then'](respondWithResult(_0x2e2ba7,null))[_0x6f1c('0x4b')](handleError(_0x2e2ba7,null));};exports['getMembers']=function(_0x55a1be,_0x44f923,_0x260d8a){var _0x134a19={};var _0x18558b={};var _0x5eea62;var _0x1aee7b;return db[_0x6f1c('0x47')][_0x6f1c('0x60')]({'where':{'id':_0x55a1be['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x44f923,null))[_0x6f1c('0x30')](function(_0x548e26){if(_0x548e26){_0x5eea62=_0x548e26;_0x18558b[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x79')][_0x6f1c('0x59')]);_0x18558b[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x55a1be[_0x6f1c('0x38')]);_0x18558b['filters']=_[_0x6f1c('0x3b')](_0x18558b[_0x6f1c('0x37')],_0x18558b[_0x6f1c('0x38')]);_0x134a19[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x18558b['model'],qs[_0x6f1c('0x3d')](_0x55a1be[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x134a19[_0x6f1c('0x3c')]=_0x134a19[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x134a19[_0x6f1c('0x3c')]:_0x18558b[_0x6f1c('0x37')];_0x134a19[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0x55a1be[_0x6f1c('0x38')]['sort']);_0x134a19['where']=qs[_0x6f1c('0x3a')](_[_0x6f1c('0x43')](_0x55a1be[_0x6f1c('0x38')],_0x18558b[_0x6f1c('0x3a')]));if(_0x55a1be['query'][_0x6f1c('0x28')]){_0x134a19[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0x134a19[_0x6f1c('0x42')],{'$or':_[_0x6f1c('0x2a')](_0x134a19[_0x6f1c('0x3c')],function(_0xfb4c41){var _0x5724c0={};_0x5724c0[_0xfb4c41]={'$like':'%'+_0x55a1be[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x5724c0;})});}_0x134a19=_[_0x6f1c('0x44')]({},_0x134a19,_0x55a1be[_0x6f1c('0x46')]);return _0x5eea62[_0x6f1c('0x95')](_0x134a19);}})[_0x6f1c('0x30')](function(_0x4e622f){if(_0x4e622f){_0x1aee7b=_0x4e622f['length'];if(!_0x55a1be[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x134a19[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x55a1be['query'][_0x6f1c('0x1b')]);_0x134a19[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x55a1be[_0x6f1c('0x38')]['offset']);}return _0x5eea62[_0x6f1c('0x95')](_0x134a19);}})[_0x6f1c('0x30')](function(_0x27a771){return _0x27a771?{'count':_0x1aee7b,'rows':_0x27a771}:null;})[_0x6f1c('0x30')](respondWithResult(_0x44f923,null))[_0x6f1c('0x4b')](handleError(_0x44f923,null));};exports['getLists']=function(_0x2a4c68,_0x3cad4f,_0x3b9469){var _0x37f9d5={};var _0x54141c={};var _0x4977b8;var _0x9bf532;return db[_0x6f1c('0x47')]['findOne']({'where':{'id':_0x2a4c68[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x3cad4f,null))[_0x6f1c('0x30')](function(_0xbada51){if(_0xbada51){_0x4977b8=_0xbada51;_0x54141c[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x96')][_0x6f1c('0x59')]);_0x54141c[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x2a4c68[_0x6f1c('0x38')]);_0x54141c[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x54141c[_0x6f1c('0x37')],_0x54141c[_0x6f1c('0x38')]);_0x37f9d5[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x54141c['model'],qs[_0x6f1c('0x3d')](_0x2a4c68[_0x6f1c('0x38')]['fields']));_0x37f9d5['attributes']=_0x37f9d5[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x37f9d5[_0x6f1c('0x3c')]:_0x54141c['model'];_0x37f9d5['order']=qs[_0x6f1c('0x41')](_0x2a4c68[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x37f9d5[_0x6f1c('0x42')]=qs['filters'](_['pick'](_0x2a4c68[_0x6f1c('0x38')],_0x54141c[_0x6f1c('0x3a')]));if(_0x2a4c68['query']['filter']){_0x37f9d5['where']=_['merge'](_0x37f9d5[_0x6f1c('0x42')],{'$or':_['map'](_0x37f9d5[_0x6f1c('0x3c')],function(_0x2a3ab1){var _0x452e23={};_0x452e23[_0x2a3ab1]={'$like':'%'+_0x2a4c68[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x452e23;})});}_0x37f9d5=_[_0x6f1c('0x44')]({},_0x37f9d5,_0x2a4c68[_0x6f1c('0x46')]);return _0x4977b8[_0x6f1c('0x97')](_0x37f9d5);}})[_0x6f1c('0x30')](function(_0x2b8e5e){if(_0x2b8e5e){_0x9bf532=_0x2b8e5e[_0x6f1c('0x3e')];if(!_0x2a4c68[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x37f9d5[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x2a4c68['query'][_0x6f1c('0x1b')]);_0x37f9d5[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x2a4c68[_0x6f1c('0x38')][_0x6f1c('0x19')]);}return _0x4977b8[_0x6f1c('0x97')](_0x37f9d5);}})['then'](function(_0x404b5e){if(_0x404b5e){return _0x404b5e?{'count':_0x9bf532,'rows':_0x404b5e}:null;}})[_0x6f1c('0x30')](respondWithResult(_0x3cad4f,null))['catch'](handleError(_0x3cad4f,null));};exports[_0x6f1c('0x98')]=function(_0x281727,_0x1013ea,_0x2bc173){var _0x1a32dc=moment()['format'](_0x6f1c('0x99'));var _0x13f856,_0x37cb3d;return db[_0x6f1c('0x47')]['find']({'where':{'id':_0x281727['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x1013ea,null))['then'](function(_0x554696){if(_0x554696){_0x37cb3d=_0x554696;return _0x554696[_0x6f1c('0x98')](_0x281727['body']['ids'],_['omit'](_0x281727[_0x6f1c('0x5d')],[_0x6f1c('0x7e'),'id'])||{});}return null;})[_0x6f1c('0x9a')](function(_0x30f7b9){var _0x183c3b;_0x13f856=_0x30f7b9||[];var _0x2106af=[];if(_0x30f7b9){for(var _0x3f894f=0x0;_0x3f894f<_0x30f7b9[_0x6f1c('0x3e')];_0x3f894f+=0x1){var _0x11004b=_0x30f7b9[_0x3f894f][_0x6f1c('0x50')]({'plain':!![]});_0x37cb3d[_0x6f1c('0x9b')]=_0x281727['body'][_0x6f1c('0x9b')]?_0x281727[_0x6f1c('0x5d')][_0x6f1c('0x9b')]:_0x37cb3d['dialCheckDuplicateType'];switch(_0x37cb3d[_0x6f1c('0x9b')]){case _0x6f1c('0x9c'):_0x183c3b=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')](_0x6f1c('0x9f'))[_0x6f1c('0xa0')]([_0x6f1c('0xa1'),_0x6f1c('0xa2'),_0x6f1c('0xa3'),_0x6f1c('0xa4'),_0x6f1c('0x61'),_0x6f1c('0x5e'),_0x6f1c('0x5c')],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xa1'),_0x6f1c('0xa1'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0xa2'))[_0x6f1c('0x7f')]('id','ContactId')['field'](_0x11004b['CmListId'][_0x6f1c('0x88')](),'ListId')[_0x6f1c('0x7f')](_0x281727[_0x6f1c('0x58')]['id'][_0x6f1c('0x88')](),_0x6f1c('0x61'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5e'))['field']('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5c'))['from'](_0x6f1c('0xa6'))[_0x6f1c('0x42')](_0x6f1c('0xa7'))[_0x6f1c('0x42')](_0x6f1c('0xa8'),_0x11004b[_0x6f1c('0xa9')][_0x6f1c('0x88')]())['where'](_0x6f1c('0xaa'))['where'](_0x6f1c('0xab'),squel[_0x6f1c('0xa5')]()['field'](_0x6f1c('0xac'))[_0x6f1c('0x81')]('cm_hopper_final')['where'](_0x6f1c('0x84'),_0x281727['params']['id']['toString']()))['where'](_0x6f1c('0xab'),squel['select']()[_0x6f1c('0x7f')](_0x6f1c('0xad'))[_0x6f1c('0x81')](_0x6f1c('0x9f'))[_0x6f1c('0x42')](_0x6f1c('0x84'),_0x281727[_0x6f1c('0x58')]['id']['toString']())))[_0x6f1c('0x88')]();break;case _0x6f1c('0xae'):_0x183c3b=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')]('cm_hopper')[_0x6f1c('0xa0')]([_0x6f1c('0xa1'),_0x6f1c('0xa2'),_0x6f1c('0xa3'),_0x6f1c('0xa4'),'VoiceQueueId',_0x6f1c('0x5e'),_0x6f1c('0x5c')],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xa1'),_0x6f1c('0xa1'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0xa2'))[_0x6f1c('0x7f')]('id',_0x6f1c('0xa3'))['field'](_0x11004b[_0x6f1c('0xa9')]['toString'](),_0x6f1c('0xa4'))['field'](_0x281727['params']['id'][_0x6f1c('0x88')](),_0x6f1c('0x61'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5e'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5c'))[_0x6f1c('0x81')](_0x6f1c('0xa6'))[_0x6f1c('0x42')](_0x6f1c('0xa7'))[_0x6f1c('0x42')](_0x6f1c('0xa8'),_0x11004b[_0x6f1c('0xa9')][_0x6f1c('0x88')]())[_0x6f1c('0x42')](_0x6f1c('0xaa'))['where'](_0x6f1c('0xab'),squel['select']()[_0x6f1c('0x7f')](_0x6f1c('0xad'))[_0x6f1c('0x81')](_0x6f1c('0x9f'))[_0x6f1c('0x42')]('VoiceQueueId\x20=\x20?',_0x281727[_0x6f1c('0x58')]['id'][_0x6f1c('0x88')]())))[_0x6f1c('0x88')]();break;default:_0x183c3b=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')](_0x6f1c('0x9f'))[_0x6f1c('0xa0')](['phone',_0x6f1c('0xa2'),_0x6f1c('0xa3'),_0x6f1c('0xa4'),_0x6f1c('0x61'),'createdAt','updatedAt'],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xa1'),'phone')[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0xa2'))[_0x6f1c('0x7f')]('id','ContactId')['field'](_0x11004b['CmListId'][_0x6f1c('0x88')](),_0x6f1c('0xa4'))[_0x6f1c('0x7f')](_0x281727[_0x6f1c('0x58')]['id'][_0x6f1c('0x88')](),'VoiceQueueId')[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5e'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5c'))[_0x6f1c('0x81')](_0x6f1c('0xa6'))[_0x6f1c('0x42')](_0x6f1c('0xa7'))['where'](_0x6f1c('0xa8'),_0x11004b['CmListId']['toString']())[_0x6f1c('0x42')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x2106af[_0x6f1c('0x86')](db['sequelize']['query'](_0x183c3b));}return BPromise[_0x6f1c('0x93')](_0x2106af);}})[_0x6f1c('0x30')](function(){var _0x390ea4=[];var _0x41c282=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')]('cm_hopper_additional_phones')[_0x6f1c('0xa0')]([_0x6f1c('0xaf'),_0x6f1c('0xa1'),_0x6f1c('0xb0'),'createdAt',_0x6f1c('0x5c')],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xb1'))['field'](_0x6f1c('0xb2'))[_0x6f1c('0x7f')](_0x6f1c('0xb3'))['field']('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5e'))['field']('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5c'))[_0x6f1c('0x81')](_0x6f1c('0xb4'),'ci')[_0x6f1c('0x83')](_0x6f1c('0x9f'),'h',_0x6f1c('0xb5'))[_0x6f1c('0x42')](_0x6f1c('0xb6'),_0x1a32dc)[_0x6f1c('0x42')](_0x6f1c('0xb7'),_0x6f1c('0xb8')))[_0x6f1c('0x88')]();_0x390ea4[_0x6f1c('0x86')](db['sequelize'][_0x6f1c('0x38')](_0x41c282));return BPromise[_0x6f1c('0x93')](_0x390ea4);})[_0x6f1c('0x30')](function(){return _0x13f856;})[_0x6f1c('0x30')](respondWithResult(_0x1013ea,null))[_0x6f1c('0x4b')](handleError(_0x1013ea,null));};exports['removeLists']=function(_0x3556ab,_0x546a6c,_0x5c1b6f){return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x3556ab['params']['id']}})['then'](handleEntityNotFound(_0x546a6c,null))['then'](function(_0x1d75f5){if(_0x1d75f5){return _0x1d75f5['removeLists'](_0x3556ab[_0x6f1c('0x38')][_0x6f1c('0x7e')]);}})[_0x6f1c('0x30')](function(_0x1c982f){if(_0x1c982f){return db[_0x6f1c('0x62')][_0x6f1c('0x23')]({'where':{'ListId':_0x3556ab[_0x6f1c('0x38')][_0x6f1c('0x7e')],'VoiceQueueId':_0x3556ab[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](function(){return _0x1c982f;});}})[_0x6f1c('0x30')](respondWithStatusCode(_0x546a6c,null))['catch'](handleError(_0x546a6c,null));};exports['getBlackLists']=function(_0x4f3ec3,_0x22d6d5,_0x20943c){var _0x3a941b={};var _0x44b2bf={};var _0x537741;var _0x307138;return db[_0x6f1c('0x47')][_0x6f1c('0x60')]({'where':{'id':_0x4f3ec3[_0x6f1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x22d6d5,null))[_0x6f1c('0x30')](function(_0x2a1e8d){if(_0x2a1e8d){_0x537741=_0x2a1e8d;_0x44b2bf['model']=_[_0x6f1c('0x39')](db[_0x6f1c('0x96')][_0x6f1c('0x59')]);_0x44b2bf[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x4f3ec3[_0x6f1c('0x38')]);_0x44b2bf['filters']=_[_0x6f1c('0x3b')](_0x44b2bf['model'],_0x44b2bf[_0x6f1c('0x38')]);_0x3a941b['attributes']=_['intersection'](_0x44b2bf['model'],qs[_0x6f1c('0x3d')](_0x4f3ec3[_0x6f1c('0x38')]['fields']));_0x3a941b[_0x6f1c('0x3c')]=_0x3a941b['attributes'][_0x6f1c('0x3e')]?_0x3a941b['attributes']:_0x44b2bf[_0x6f1c('0x37')];_0x3a941b[_0x6f1c('0x40')]=qs['sort'](_0x4f3ec3[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x3a941b['where']=qs[_0x6f1c('0x3a')](_['pick'](_0x4f3ec3[_0x6f1c('0x38')],_0x44b2bf[_0x6f1c('0x3a')]));if(_0x4f3ec3[_0x6f1c('0x38')][_0x6f1c('0x28')]){_0x3a941b['where']=_[_0x6f1c('0x44')](_0x3a941b[_0x6f1c('0x42')],{'$or':_[_0x6f1c('0x2a')](_0x3a941b[_0x6f1c('0x3c')],function(_0x11fd25){var _0x161970={};_0x161970[_0x11fd25]={'$like':'%'+_0x4f3ec3['query']['filter']+'%'};return _0x161970;})});}_0x3a941b=_['merge']({},_0x3a941b,_0x4f3ec3[_0x6f1c('0x46')]);return _0x537741['getBlackLists'](_0x3a941b);}})[_0x6f1c('0x30')](function(_0x39f4a2){if(_0x39f4a2){_0x307138=_0x39f4a2['length'];if(!_0x4f3ec3[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x3a941b[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x4f3ec3[_0x6f1c('0x38')][_0x6f1c('0x1b')]);_0x3a941b[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x4f3ec3[_0x6f1c('0x38')]['offset']);}return _0x537741[_0x6f1c('0xb9')](_0x3a941b);}})['then'](function(_0x3b9f2a){if(_0x3b9f2a){return _0x3b9f2a?{'count':_0x307138,'rows':_0x3b9f2a}:null;}})[_0x6f1c('0x30')](respondWithResult(_0x22d6d5,null))[_0x6f1c('0x4b')](handleError(_0x22d6d5,null));};exports['addBlackLists']=function(_0x16ac91,_0x1352cb,_0x5d7bce){var _0x17b890,_0x3bedbf;return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x16ac91[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x1352cb,null))[_0x6f1c('0x30')](function(_0x52238f){if(_0x52238f){_0x3bedbf=_0x52238f;return _0x52238f[_0x6f1c('0xba')](_0x16ac91['body'][_0x6f1c('0x7e')],_[_0x6f1c('0x5b')](_0x16ac91[_0x6f1c('0x5d')],[_0x6f1c('0x7e'),'id'])||{});}return null;})[_0x6f1c('0x9a')](function(_0x595fc1){var _0x27d2cc;_0x17b890=_0x595fc1||[];var _0x3e0da3=[];if(_0x595fc1){for(var _0x295802=0x0;_0x295802<_0x595fc1['length'];_0x295802+=0x1){var _0x294674=_0x595fc1[_0x295802][_0x6f1c('0x50')]({'plain':!![]});_0x27d2cc=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')](_0x6f1c('0xbb'))[_0x6f1c('0xa0')]([_0x6f1c('0xa1'),_0x6f1c('0xa3'),_0x6f1c('0xa4'),'VoiceQueueId',_0x6f1c('0x5e'),_0x6f1c('0x5c')],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xa1'),'phone')[_0x6f1c('0x7f')]('id',_0x6f1c('0xa3'))[_0x6f1c('0x7f')](_0x294674[_0x6f1c('0xa9')][_0x6f1c('0x88')](),_0x6f1c('0xa4'))[_0x6f1c('0x7f')](_0x16ac91[_0x6f1c('0x58')]['id'][_0x6f1c('0x88')](),_0x6f1c('0x61'))['field'](_0x6f1c('0xbc'),_0x6f1c('0x5e'))[_0x6f1c('0x7f')](_0x6f1c('0xbc'),_0x6f1c('0x5c'))['from'](_0x6f1c('0xa6'))[_0x6f1c('0x42')](_0x6f1c('0xa7'))[_0x6f1c('0x42')](_0x6f1c('0xa8'),_0x294674['CmListId'][_0x6f1c('0x88')]())[_0x6f1c('0x42')](_0x6f1c('0xaa')))[_0x6f1c('0x88')]();_0x3e0da3[_0x6f1c('0x86')](db[_0x6f1c('0x87')][_0x6f1c('0x38')](_0x27d2cc));}return BPromise['all'](_0x3e0da3);}})[_0x6f1c('0x30')](function(){return _0x17b890;})['then'](respondWithResult(_0x1352cb,null))[_0x6f1c('0x4b')](handleError(_0x1352cb,null));};exports[_0x6f1c('0xbd')]=function(_0x201eb1,_0x402b28,_0x27017a){return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x201eb1[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x402b28,null))[_0x6f1c('0x30')](function(_0x326ea8){if(_0x326ea8){return _0x326ea8[_0x6f1c('0xbd')](_0x201eb1['query'][_0x6f1c('0x7e')]);}})[_0x6f1c('0x30')](function(_0x462c0f){if(_0x462c0f){return db[_0x6f1c('0x67')]['destroy']({'where':{'ListId':_0x201eb1['query'][_0x6f1c('0x7e')],'VoiceQueueId':_0x201eb1['params']['id']}})[_0x6f1c('0x30')](function(){return _0x462c0f;});}})[_0x6f1c('0x30')](respondWithStatusCode(_0x402b28,null))[_0x6f1c('0x4b')](handleError(_0x402b28,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index b6f08a5..33d27b6 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 _0xd6bd=['emit','exports','events','VoiceQueue','setMaxListeners','update','remove'];(function(_0x51da98,_0x56c0d8){var _0x324051=function(_0x5916f4){while(--_0x5916f4){_0x51da98['push'](_0x51da98['shift']());}};_0x324051(++_0x56c0d8);}(_0xd6bd,0x175));var _0xdd6b=function(_0x36b9a6,_0x264956){_0x36b9a6=_0x36b9a6-0x0;var _0x3177a9=_0xd6bd[_0x36b9a6];return _0x3177a9;};'use strict';var EventEmitter=require(_0xdd6b('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xdd6b('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xdd6b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd6b('0x3'),'afterDestroy':_0xdd6b('0x4')};function emitEvent(_0x49eda5){return function(_0x2aa746,_0x82b146,_0x45c08a){VoiceQueueEvents[_0xdd6b('0x5')](_0x49eda5+':'+_0x2aa746['id'],_0x2aa746);VoiceQueueEvents[_0xdd6b('0x5')](_0x49eda5,_0x2aa746);_0x45c08a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xdd6b('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xc834=['hook','events','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2bc5a0,_0x119ece){var _0x2fedfe=function(_0x3a98c2){while(--_0x3a98c2){_0x2bc5a0['push'](_0x2bc5a0['shift']());}};_0x2fedfe(++_0x119ece);}(_0xc834,0xcc));var _0x4c83=function(_0x2361c5,_0x149033){_0x2361c5=_0x2361c5-0x0;var _0x4a09b4=_0xc834[_0x2361c5];return _0x4a09b4;};'use strict';var EventEmitter=require(_0x4c83('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4c83('0x1')](0x0);var events={'afterCreate':_0x4c83('0x2'),'afterUpdate':_0x4c83('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4166c5){return function(_0x3efed8,_0x25eacd,_0x1870b2){VoiceQueueEvents[_0x4c83('0x4')](_0x4166c5+':'+_0x3efed8['id'],_0x3efed8);VoiceQueueEvents['emit'](_0x4166c5,_0x3efed8);_0x1870b2(null);};}for(var e in events){if(events[_0x4c83('0x5')](e)){var event=events[e];VoiceQueue[_0x4c83('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 79db585..f1fc766 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x53bb79,_0x3cf3be){var _0x4ea549=function(_0x4d5dc2){while(--_0x4d5dc2){_0x53bb79['push'](_0x53bb79['shift']());}};_0x4ea549(++_0x3cf3be);}(_0xedd9,0xfc));var _0x9edd=function(_0xea046b,_0xe5834e){_0xea046b=_0xea046b-0x0;var _0x481a80=_0xedd9[_0xea046b];return _0x481a80;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x519af7,_0xe60ec1){var _0x16f903=function(_0x309186){while(--_0x309186){_0x519af7['push'](_0x519af7['shift']());}};_0x16f903(++_0xe60ec1);}(_0x34e8,0x12c));var _0x834e=function(_0x4651e7,_0x420769){_0x4651e7=_0x4651e7-0x0;var _0x52b7e0=_0x34e8[_0x4651e7];return _0x52b7e0;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index dd9cf51..8c19391 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 _0x6679=['model','find','raw','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','where','limit','include','map','attributes'];(function(_0x174283,_0x3fd836){var _0x139f1a=function(_0xfe1f95){while(--_0xfe1f95){_0x174283['push'](_0x174283['shift']());}};_0x139f1a(++_0x3fd836);}(_0x6679,0x1df));var _0x9667=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x6679[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x9667('0x0'));var util=require('util');var moment=require(_0x9667('0x1'));var BPromise=require(_0x9667('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9667('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9667('0x4'));var config=require(_0x9667('0x5'));var jayson=require(_0x9667('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x9667('0x7')]=_[_0x9667('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9667('0x9'))(new Redis(config[_0x9667('0x7')]));require('./voiceQueue.socket')[_0x9667('0xa')](socket);function respondWithRpcPromise(_0x11ba45,_0x54a69b,_0x3feb3c){return new BPromise(function(_0x8c53bf,_0x4da50b){return client[_0x9667('0xb')](_0x11ba45,_0x3feb3c)[_0x9667('0xc')](function(_0x3ee881){logger[_0x9667('0xd')](_0x9667('0xe'),_0x54a69b,_0x9667('0xf'));logger[_0x9667('0x10')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x54a69b,'request\x20sent',JSON[_0x9667('0x11')](_0x3ee881));if(_0x3ee881['error']){if(_0x3ee881[_0x9667('0x12')][_0x9667('0x13')]===0x1f4){logger[_0x9667('0x12')](_0x9667('0xe'),_0x54a69b,_0x3ee881[_0x9667('0x12')][_0x9667('0x14')]);return _0x4da50b(_0x3ee881[_0x9667('0x12')][_0x9667('0x14')]);}logger[_0x9667('0x12')](_0x9667('0xe'),_0x54a69b,_0x3ee881[_0x9667('0x12')][_0x9667('0x14')]);return _0x8c53bf(_0x3ee881['error'][_0x9667('0x14')]);}else{logger['info'](_0x9667('0xe'),_0x54a69b,_0x9667('0xf'));_0x8c53bf(_0x3ee881[_0x9667('0x15')]['message']);}})[_0x9667('0x16')](function(_0x1396fa){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x54a69b,_0x1396fa);_0x4da50b(_0x1396fa);});});}exports[_0x9667('0x17')]=function(_0x28faa7){var _0x4b2d29=this;return new Promise(function(_0x24851f,_0x15519e){return db[_0x9667('0x18')]['findAll']({'raw':_0x28faa7[_0x9667('0x19')]?_0x28faa7['options']['raw']===undefined?!![]:![]:!![],'where':_0x28faa7[_0x9667('0x19')]?_0x28faa7['options'][_0x9667('0x1a')]||null:null,'attributes':_0x28faa7[_0x9667('0x19')]?_0x28faa7[_0x9667('0x19')]['attributes']||null:null,'limit':_0x28faa7[_0x9667('0x19')]?_0x28faa7['options'][_0x9667('0x1b')]||null:null,'include':_0x28faa7[_0x9667('0x19')]?_0x28faa7[_0x9667('0x19')][_0x9667('0x1c')]?_[_0x9667('0x1d')](_0x28faa7[_0x9667('0x19')][_0x9667('0x1c')],function(_0x16a29f){return{'model':db[_0x16a29f['model']],'as':_0x16a29f['as'],'attributes':_0x16a29f[_0x9667('0x1e')],'include':_0x16a29f['include']?_[_0x9667('0x1d')](_0x16a29f[_0x9667('0x1c')],function(_0x59c2bc){return{'model':db[_0x59c2bc[_0x9667('0x1f')]],'as':_0x59c2bc['as'],'attributes':_0x59c2bc[_0x9667('0x1e')],'include':_0x59c2bc[_0x9667('0x1c')]?_[_0x9667('0x1d')](_0x59c2bc[_0x9667('0x1c')],function(_0x37b5fe){return{'model':db[_0x37b5fe['model']],'as':_0x37b5fe['as'],'attributes':_0x37b5fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x9667('0xc')](function(_0x3c837b){logger[_0x9667('0xd')](_0x9667('0x17'),_0x28faa7);logger[_0x9667('0x10')](_0x9667('0x17'),_0x28faa7,JSON[_0x9667('0x11')](_0x3c837b));_0x24851f(_0x3c837b);})[_0x9667('0x16')](function(_0x5a140e){logger[_0x9667('0x12')](_0x9667('0x17'),_0x5a140e[_0x9667('0x14')],_0x28faa7);_0x15519e(_0x4b2d29[_0x9667('0x12')](0x1f4,_0x5a140e['message']));});});};exports['ShowVoiceQueue']=function(_0xbfd29d){var _0x17b97a=this;return new Promise(function(_0x4a8007,_0x480df7){return db[_0x9667('0x18')][_0x9667('0x20')]({'raw':_0xbfd29d['options']?_0xbfd29d[_0x9667('0x19')][_0x9667('0x21')]===undefined?!![]:![]:!![],'where':_0xbfd29d['options']?_0xbfd29d[_0x9667('0x19')][_0x9667('0x1a')]||null:null,'attributes':_0xbfd29d['options']?_0xbfd29d[_0x9667('0x19')][_0x9667('0x1e')]||null:null,'include':_0xbfd29d[_0x9667('0x19')]?_0xbfd29d['options']['include']?_[_0x9667('0x1d')](_0xbfd29d[_0x9667('0x19')][_0x9667('0x1c')],function(_0x228e0d){return{'model':db[_0x228e0d['model']],'as':_0x228e0d['as'],'attributes':_0x228e0d[_0x9667('0x1e')],'include':_0x228e0d[_0x9667('0x1c')]?_[_0x9667('0x1d')](_0x228e0d['include'],function(_0x2e18fd){return{'model':db[_0x2e18fd[_0x9667('0x1f')]],'as':_0x2e18fd['as'],'attributes':_0x2e18fd[_0x9667('0x1e')],'include':_0x2e18fd[_0x9667('0x1c')]?_[_0x9667('0x1d')](_0x2e18fd[_0x9667('0x1c')],function(_0x10b158){return{'model':db[_0x10b158['model']],'as':_0x10b158['as'],'attributes':_0x10b158['attributes']};}):[]};}):[]};}):[]:[]})[_0x9667('0xc')](function(_0x560736){logger[_0x9667('0xd')]('ShowVoiceQueue',_0xbfd29d);logger[_0x9667('0x10')]('ShowVoiceQueue',_0xbfd29d,JSON[_0x9667('0x11')](_0x560736));_0x4a8007(_0x560736);})['catch'](function(_0x2355b7){logger[_0x9667('0x12')]('ShowVoiceQueue',_0x2355b7[_0x9667('0x14')],_0xbfd29d);_0x480df7(_0x17b97a[_0x9667('0x12')](0x1f4,_0x2355b7['message']));});});}; \ No newline at end of file +var _0xc2f1=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','include','map','model','attributes','debug','ShowVoiceQueue','raw','lodash','moment','bluebird','../../mysqldb'];(function(_0x1fd547,_0x34945){var _0x49578e=function(_0x3b9114){while(--_0x3b9114){_0x1fd547['push'](_0x1fd547['shift']());}};_0x49578e(++_0x34945);}(_0xc2f1,0x1a9));var _0x1c2f=function(_0x401292,_0x3536ce){_0x401292=_0x401292-0x0;var _0x4c2c92=_0xc2f1[_0x401292];return _0x4c2c92;};'use strict';var _=require(_0x1c2f('0x0'));var util=require('util');var moment=require(_0x1c2f('0x1'));var BPromise=require(_0x1c2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c2f('0x3'))['db'];var utils=require(_0x1c2f('0x4'));var logger=require(_0x1c2f('0x5'))(_0x1c2f('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c2f('0x7'));var client=jayson[_0x1c2f('0x8')][_0x1c2f('0x9')]({'port':0x232a});config[_0x1c2f('0xa')]=_[_0x1c2f('0xb')](config[_0x1c2f('0xa')],{'host':_0x1c2f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1c2f('0xd'))[_0x1c2f('0xe')](socket);function respondWithRpcPromise(_0x28a468,_0x41768d,_0x1af485){return new BPromise(function(_0x45b889,_0x1639d4){return client[_0x1c2f('0xf')](_0x28a468,_0x1af485)[_0x1c2f('0x10')](function(_0x46e967){logger['info'](_0x1c2f('0x11'),_0x41768d,'request\x20sent');logger['debug'](_0x1c2f('0x12'),_0x41768d,_0x1c2f('0x13'),JSON[_0x1c2f('0x14')](_0x46e967));if(_0x46e967[_0x1c2f('0x15')]){if(_0x46e967[_0x1c2f('0x15')]['code']===0x1f4){logger[_0x1c2f('0x15')](_0x1c2f('0x11'),_0x41768d,_0x46e967[_0x1c2f('0x15')]['message']);return _0x1639d4(_0x46e967[_0x1c2f('0x15')][_0x1c2f('0x16')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x41768d,_0x46e967['error']['message']);return _0x45b889(_0x46e967[_0x1c2f('0x15')][_0x1c2f('0x16')]);}else{logger[_0x1c2f('0x17')](_0x1c2f('0x11'),_0x41768d,_0x1c2f('0x13'));_0x45b889(_0x46e967[_0x1c2f('0x18')][_0x1c2f('0x16')]);}})[_0x1c2f('0x19')](function(_0x4f90d9){logger[_0x1c2f('0x15')](_0x1c2f('0x11'),_0x41768d,_0x4f90d9);_0x1639d4(_0x4f90d9);});});}exports[_0x1c2f('0x1a')]=function(_0x194371){var _0x1ef671=this;return new Promise(function(_0x54ead5,_0x587444){return db[_0x1c2f('0x1b')][_0x1c2f('0x1c')]({'raw':_0x194371[_0x1c2f('0x1d')]?_0x194371[_0x1c2f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x194371[_0x1c2f('0x1d')]?_0x194371[_0x1c2f('0x1d')][_0x1c2f('0x1e')]||null:null,'attributes':_0x194371[_0x1c2f('0x1d')]?_0x194371[_0x1c2f('0x1d')]['attributes']||null:null,'limit':_0x194371[_0x1c2f('0x1d')]?_0x194371['options'][_0x1c2f('0x1f')]||null:null,'include':_0x194371[_0x1c2f('0x1d')]?_0x194371[_0x1c2f('0x1d')][_0x1c2f('0x20')]?_[_0x1c2f('0x21')](_0x194371['options'][_0x1c2f('0x20')],function(_0x2d0497){return{'model':db[_0x2d0497[_0x1c2f('0x22')]],'as':_0x2d0497['as'],'attributes':_0x2d0497[_0x1c2f('0x23')],'include':_0x2d0497[_0x1c2f('0x20')]?_[_0x1c2f('0x21')](_0x2d0497['include'],function(_0xdaa658){return{'model':db[_0xdaa658['model']],'as':_0xdaa658['as'],'attributes':_0xdaa658['attributes'],'include':_0xdaa658[_0x1c2f('0x20')]?_[_0x1c2f('0x21')](_0xdaa658[_0x1c2f('0x20')],function(_0x3e8071){return{'model':db[_0x3e8071[_0x1c2f('0x22')]],'as':_0x3e8071['as'],'attributes':_0x3e8071[_0x1c2f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1c2f('0x10')](function(_0xacfb0){logger['info'](_0x1c2f('0x1a'),_0x194371);logger[_0x1c2f('0x24')](_0x1c2f('0x1a'),_0x194371,JSON[_0x1c2f('0x14')](_0xacfb0));_0x54ead5(_0xacfb0);})['catch'](function(_0x5bb949){logger[_0x1c2f('0x15')]('GetVoiceQueue',_0x5bb949[_0x1c2f('0x16')],_0x194371);_0x587444(_0x1ef671['error'](0x1f4,_0x5bb949[_0x1c2f('0x16')]));});});};exports[_0x1c2f('0x25')]=function(_0x407a0b){var _0x3bc466=this;return new Promise(function(_0x28ee2c,_0x3276f9){return db[_0x1c2f('0x1b')]['find']({'raw':_0x407a0b[_0x1c2f('0x1d')]?_0x407a0b[_0x1c2f('0x1d')][_0x1c2f('0x26')]===undefined?!![]:![]:!![],'where':_0x407a0b[_0x1c2f('0x1d')]?_0x407a0b[_0x1c2f('0x1d')][_0x1c2f('0x1e')]||null:null,'attributes':_0x407a0b[_0x1c2f('0x1d')]?_0x407a0b[_0x1c2f('0x1d')][_0x1c2f('0x23')]||null:null,'include':_0x407a0b[_0x1c2f('0x1d')]?_0x407a0b[_0x1c2f('0x1d')]['include']?_[_0x1c2f('0x21')](_0x407a0b[_0x1c2f('0x1d')][_0x1c2f('0x20')],function(_0x12420b){return{'model':db[_0x12420b[_0x1c2f('0x22')]],'as':_0x12420b['as'],'attributes':_0x12420b[_0x1c2f('0x23')],'include':_0x12420b[_0x1c2f('0x20')]?_['map'](_0x12420b[_0x1c2f('0x20')],function(_0x30b9a6){return{'model':db[_0x30b9a6[_0x1c2f('0x22')]],'as':_0x30b9a6['as'],'attributes':_0x30b9a6[_0x1c2f('0x23')],'include':_0x30b9a6['include']?_[_0x1c2f('0x21')](_0x30b9a6[_0x1c2f('0x20')],function(_0x1411a8){return{'model':db[_0x1411a8['model']],'as':_0x1411a8['as'],'attributes':_0x1411a8[_0x1c2f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1c2f('0x10')](function(_0x3e46cf){logger[_0x1c2f('0x17')]('ShowVoiceQueue',_0x407a0b);logger[_0x1c2f('0x24')](_0x1c2f('0x25'),_0x407a0b,JSON[_0x1c2f('0x14')](_0x3e46cf));_0x28ee2c(_0x3e46cf);})[_0x1c2f('0x19')](function(_0xb6a3e0){logger[_0x1c2f('0x15')](_0x1c2f('0x25'),_0xb6a3e0['message'],_0x407a0b);_0x3276f9(_0x3bc466[_0x1c2f('0x15')](0x1f4,_0xb6a3e0[_0x1c2f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 42e5829..802dd1c 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 _0x2f19=['save','remove','update','emit','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2f19,0x67));var _0x92f1=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0x2f19[_0x1b8f5a];return _0x594189;};'use strict';var VoiceQueueEvents=require(_0x92f1('0x0'));var events=[_0x92f1('0x1'),_0x92f1('0x2'),_0x92f1('0x3')];function createListener(_0x4b34a5,_0x5611dd){return function(_0x984427){_0x5611dd[_0x92f1('0x4')](_0x4b34a5,_0x984427);};}function removeListener(_0x3a5b99,_0x50b74d){return function(){VoiceQueueEvents['removeListener'](_0x3a5b99,_0x50b74d);};}exports[_0x92f1('0x5')]=function(_0x35ba34){for(var _0x512812=0x0,_0x576263=events[_0x92f1('0x6')];_0x512812<_0x576263;_0x512812++){var _0x5119f0=events[_0x512812];var _0x3fe170=createListener(_0x92f1('0x7')+_0x5119f0,_0x35ba34);VoiceQueueEvents['on'](_0x5119f0,_0x3fe170);}}; \ No newline at end of file +var _0xaf2a=['length','voiceQueue:','./voiceQueue.events','save','emit','removeListener','register'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaf2a,0x1d7));var _0xaaf2=function(_0x11a1c8,_0xf0822){_0x11a1c8=_0x11a1c8-0x0;var _0x2067f0=_0xaf2a[_0x11a1c8];return _0x2067f0;};'use strict';var VoiceQueueEvents=require(_0xaaf2('0x0'));var events=[_0xaaf2('0x1'),'remove','update'];function createListener(_0x4d01dd,_0x46a1ef){return function(_0x45bf09){_0x46a1ef[_0xaaf2('0x2')](_0x4d01dd,_0x45bf09);};}function removeListener(_0x113555,_0x453121){return function(){VoiceQueueEvents[_0xaaf2('0x3')](_0x113555,_0x453121);};}exports[_0xaaf2('0x4')]=function(_0xdc7f5b){for(var _0x13197c=0x0,_0x395a69=events[_0xaaf2('0x5')];_0x13197c<_0x395a69;_0x13197c++){var _0x3582f8=events[_0x13197c];var _0x2e4eb0=createListener(_0xaaf2('0x6')+_0x3582f8,_0xdc7f5b);VoiceQueueEvents['on'](_0x3582f8,_0x2e4eb0);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 75081c0..ce717e6 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 _0xecd6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','describe','/index','isAuthenticated','getVoiceQueuesReport','/:id','show','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xecd6,0xd1));var _0x6ecd=function(_0x1373ca,_0x5bc71e){_0x1373ca=_0x1373ca-0x0;var _0x3d8634=_0xecd6[_0x1373ca];return _0x3d8634;};'use strict';var multer=require(_0x6ecd('0x0'));var util=require(_0x6ecd('0x1'));var path=require(_0x6ecd('0x2'));var timeout=require(_0x6ecd('0x3'));var express=require(_0x6ecd('0x4'));var router=express[_0x6ecd('0x5')]();var fs_extra=require(_0x6ecd('0x6'));var auth=require(_0x6ecd('0x7'));var interaction=require(_0x6ecd('0x8'));var config=require(_0x6ecd('0x9'));var controller=require(_0x6ecd('0xa'));router[_0x6ecd('0xb')]('/',auth['isAuthenticated'](),controller[_0x6ecd('0xc')]);router[_0x6ecd('0xb')](_0x6ecd('0xd'),auth['isAuthenticated'](),controller[_0x6ecd('0xe')]);router[_0x6ecd('0xb')](_0x6ecd('0xf'),auth[_0x6ecd('0x10')](),controller[_0x6ecd('0x11')]);router['get'](_0x6ecd('0x12'),auth[_0x6ecd('0x10')](),controller[_0x6ecd('0x13')]);router['post']('/',auth[_0x6ecd('0x10')](),controller[_0x6ecd('0x14')]);router[_0x6ecd('0x15')](_0x6ecd('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x6ecd('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6ecd('0x17')]=router; \ No newline at end of file +var _0xe509=['getVoiceQueuesReport','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x2e3a2c,_0x52ae45){var _0x1939b5=function(_0x3f0a4b){while(--_0x3f0a4b){_0x2e3a2c['push'](_0x2e3a2c['shift']());}};_0x1939b5(++_0x52ae45);}(_0xe509,0x184));var _0x9e50=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0xe509[_0x4ed1d4];return _0x28e363;};'use strict';var multer=require('multer');var util=require(_0x9e50('0x0'));var path=require(_0x9e50('0x1'));var timeout=require(_0x9e50('0x2'));var express=require(_0x9e50('0x3'));var router=express[_0x9e50('0x4')]();var fs_extra=require(_0x9e50('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9e50('0x6'));var config=require(_0x9e50('0x7'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x9e50('0x8')](),controller[_0x9e50('0x9')]);router[_0x9e50('0xa')]('/describe',auth[_0x9e50('0x8')](),controller['describe']);router[_0x9e50('0xa')]('/index',auth[_0x9e50('0x8')](),controller[_0x9e50('0xb')]);router[_0x9e50('0xa')](_0x9e50('0xc'),auth[_0x9e50('0x8')](),controller[_0x9e50('0xd')]);router['post']('/',auth[_0x9e50('0x8')](),controller[_0x9e50('0xe')]);router[_0x9e50('0xf')](_0x9e50('0xc'),auth[_0x9e50('0x8')](),controller['update']);router[_0x9e50('0x10')](_0x9e50('0xc'),auth['isAuthenticated'](),controller[_0x9e50('0x11')]);module[_0x9e50('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 977aa65..358eac9 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 _0xe352=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0xe352,0x196));var _0x2e35=function(_0x108d8f,_0x586ad6){_0x108d8f=_0x108d8f-0x0;var _0x2fd8d1=_0xe352[_0x108d8f];return _0x2fd8d1;};'use strict';var Sequelize=require(_0x2e35('0x0'));var moment=require(_0x2e35('0x1'));module[_0x2e35('0x2')]={'type':{'type':Sequelize[_0x2e35('0x3')]},'uniqueid':{'type':Sequelize[_0x2e35('0x3')]},'calleridnum':{'type':Sequelize[_0x2e35('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2e35('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x2e35('0x4')],'set':function(_0x5f317b){var _0x2cf040=moment(_0x5f317b);var _0x5ed882=moment(this[_0x2e35('0x5')](_0x2e35('0x6')))[_0x2e35('0x7')](_0x2e35('0x8'));var _0x3b7a98=_0x2cf040[_0x2e35('0x9')](_0x5ed882,_0x2e35('0xa'));this[_0x2e35('0xb')]('queuecallerleaveAt',_0x5f317b);this[_0x2e35('0xb')](_0x2e35('0xc'),_0x3b7a98||null);}},'position':{'type':Sequelize[_0x2e35('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x2e35('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2e35('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x2e35('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2e35('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x2e35('0x3')],'comment':_0x2e35('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x2e35('0x3')]},'connectedlinenum':{'type':Sequelize[_0x2e35('0x3')]},'connectedlinename':{'type':Sequelize[_0x2e35('0x3')]},'accountcode':{'type':Sequelize[_0x2e35('0x3')]},'context':{'type':Sequelize[_0x2e35('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2e35('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2e35('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2e35('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2e35('0x3')]},'transfer':{'type':Sequelize[_0x2e35('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2e35('0x3')],'comment':_0x2e35('0x10')},'transferexten':{'type':Sequelize[_0x2e35('0x3')]},'transferuniqueid':{'type':Sequelize[_0x2e35('0x3')]},'disposition':{'type':Sequelize[_0x2e35('0x3')]},'secondDisposition':{'type':Sequelize[_0x2e35('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2e35('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc3f7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0xc3f7,0x13c));var _0x7c3f=function(_0x122354,_0x5bba72){_0x122354=_0x122354-0x0;var _0xb68790=_0xc3f7[_0x122354];return _0xb68790;};'use strict';var Sequelize=require(_0x7c3f('0x0'));var moment=require('moment');module[_0x7c3f('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7c3f('0x2')]},'calleridnum':{'type':Sequelize[_0x7c3f('0x2')]},'calleridname':{'type':Sequelize[_0x7c3f('0x2')]},'queue':{'type':Sequelize[_0x7c3f('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x7c3f('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7c3f('0x3')],'set':function(_0xb5e5ac){var _0x525e94=moment(_0xb5e5ac);var _0x3f199f=moment(this[_0x7c3f('0x4')]('queuecallerjoinAt'))['format'](_0x7c3f('0x5'));var _0x152ce1=_0x525e94[_0x7c3f('0x6')](_0x3f199f,_0x7c3f('0x7'));this[_0x7c3f('0x8')](_0x7c3f('0x9'),_0xb5e5ac);this[_0x7c3f('0x8')](_0x7c3f('0xa'),_0x152ce1||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7c3f('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7c3f('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7c3f('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7c3f('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7c3f('0x2')],'comment':_0x7c3f('0xd')},'originalposition':{'type':Sequelize[_0x7c3f('0xb')]},'channel':{'type':Sequelize[_0x7c3f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7c3f('0x2')]},'connectedlinename':{'type':Sequelize[_0x7c3f('0x2')]},'accountcode':{'type':Sequelize[_0x7c3f('0x2')]},'context':{'type':Sequelize[_0x7c3f('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7c3f('0x2')]},'holdtime':{'type':Sequelize[_0x7c3f('0xb')]},'mohtime':{'type':Sequelize[_0x7c3f('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7c3f('0x2')]},'transfer':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7c3f('0x2')],'comment':_0x7c3f('0xe')},'transferexten':{'type':Sequelize[_0x7c3f('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7c3f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7c3f('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7c3f('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index e052304..747b520 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 _0xcff3=['hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','getVoiceQueuesReport','order','pick','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','VoiceQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length'];(function(_0x2c416a,_0x732630){var _0x4218d5=function(_0x436357){while(--_0x436357){_0x2c416a['push'](_0x2c416a['shift']());}};_0x4218d5(++_0x732630);}(_0xcff3,0x199));var _0x3cff=function(_0x4d95db,_0x28b7e9){_0x4d95db=_0x4d95db-0x0;var _0x1cc484=_0xcff3[_0x4d95db];return _0x1cc484;};'use strict';var emlformat=require(_0x3cff('0x0'));var rimraf=require(_0x3cff('0x1'));var zipdir=require(_0x3cff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3cff('0x3'));var moment=require('moment');var BPromise=require(_0x3cff('0x4'));var Mustache=require(_0x3cff('0x5'));var util=require(_0x3cff('0x6'));var path=require(_0x3cff('0x7'));var sox=require(_0x3cff('0x8'));var csv=require(_0x3cff('0x9'));var ejs=require(_0x3cff('0xa'));var fs=require('fs');var fs_extra=require(_0x3cff('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3cff('0xc'));var jsforce=require(_0x3cff('0xd'));var deskjs=require(_0x3cff('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3cff('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3cff('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cff('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3cff('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3cff('0x13'))['db'];config[_0x3cff('0x14')]=_[_0x3cff('0x15')](config['redis'],{'host':_0x3cff('0x16'),'port':0x18eb});var socket=require(_0x3cff('0x17'))(new Redis(config[_0x3cff('0x14')]));require(_0x3cff('0x18'))[_0x3cff('0x19')](socket);function respondWithStatusCode(_0xef92bf,_0x120d97){_0x120d97=_0x120d97||0xcc;return function(_0x40ca47){if(_0x40ca47){return _0xef92bf[_0x3cff('0x1a')](_0x120d97);}return _0xef92bf[_0x3cff('0x1b')](_0x120d97)[_0x3cff('0x1c')]();};}function respondWithResult(_0x39bc20,_0x23ee68){_0x23ee68=_0x23ee68||0xc8;return function(_0x39af8b){if(_0x39af8b){return _0x39bc20[_0x3cff('0x1b')](_0x23ee68)['json'](_0x39af8b);}};}function respondWithFilteredResult(_0x42d58c,_0x3e319e){return function(_0xb8b0af){if(_0xb8b0af){var _0x2da213=typeof _0x3e319e[_0x3cff('0x1d')]==='undefined'&&typeof _0x3e319e[_0x3cff('0x1e')]==='undefined';var _0x1418ee=_0xb8b0af['count'];var _0x196e65=_0x2da213?0x0:_0x3e319e['offset'];var _0xbb4373=_0x2da213?_0xb8b0af['count']:_0x3e319e[_0x3cff('0x1d')]+_0x3e319e[_0x3cff('0x1e')];var _0x4f74ad;if(_0xbb4373>=_0x1418ee){_0xbb4373=_0x1418ee;_0x4f74ad=0xc8;}else{_0x4f74ad=0xce;}_0x42d58c['status'](_0x4f74ad);return _0x42d58c[_0x3cff('0x1f')](_0x3cff('0x20'),_0x196e65+'-'+_0xbb4373+'/'+_0x1418ee)['json'](_0xb8b0af);}return null;};}function patchUpdates(_0x337087){return function(_0x3e44c2){try{jsonpatch[_0x3cff('0x21')](_0x3e44c2,_0x337087,!![]);}catch(_0x27c165){return BPromise[_0x3cff('0x22')](_0x27c165);}return _0x3e44c2['save']();};}function saveUpdates(_0x21e627,_0x394fda){return function(_0x3ee54c){if(_0x3ee54c){return _0x3ee54c[_0x3cff('0x23')](_0x21e627)['then'](function(_0x4bbbda){return _0x4bbbda;});}return null;};}function removeEntity(_0x3d47fa,_0x349a85){return function(_0x551c4d){if(_0x551c4d){return _0x551c4d[_0x3cff('0x24')]()[_0x3cff('0x25')](function(){_0x3d47fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b57a,_0x4bb65f){return function(_0x47c128){if(!_0x47c128){_0x25b57a[_0x3cff('0x1a')](0x194);}return _0x47c128;};}function handleError(_0xce27b8,_0x44d752){_0x44d752=_0x44d752||0x1f4;return function(_0x5e67b2){logger[_0x3cff('0x26')](_0x5e67b2['stack']);if(_0x5e67b2[_0x3cff('0x27')]){delete _0x5e67b2[_0x3cff('0x27')];}_0xce27b8[_0x3cff('0x1b')](_0x44d752)[_0x3cff('0x28')](_0x5e67b2);};}exports[_0x3cff('0x29')]=function(_0x54615e,_0x496482){var _0x3f5f42={},_0x13f623={},_0x5dbfe0={'count':0x0,'rows':[]};var _0x5cdfa3=_[_0x3cff('0x2a')](db[_0x3cff('0x2b')][_0x3cff('0x2c')],function(_0x2afe7d){return{'name':_0x2afe7d['fieldName'],'type':_0x2afe7d[_0x3cff('0x2d')]['key']};});_0x13f623[_0x3cff('0x2e')]=_[_0x3cff('0x2a')](_0x5cdfa3,_0x3cff('0x27'));_0x13f623[_0x3cff('0x2f')]=_[_0x3cff('0x30')](_0x54615e['query']);_0x13f623['filters']=_[_0x3cff('0x31')](_0x13f623[_0x3cff('0x2e')],_0x13f623[_0x3cff('0x2f')]);_0x3f5f42[_0x3cff('0x32')]=_[_0x3cff('0x31')](_0x13f623[_0x3cff('0x2e')],qs[_0x3cff('0x33')](_0x54615e[_0x3cff('0x2f')][_0x3cff('0x33')]));_0x3f5f42[_0x3cff('0x32')]=_0x3f5f42['attributes'][_0x3cff('0x34')]?_0x3f5f42[_0x3cff('0x32')]:_0x13f623[_0x3cff('0x2e')];if(!_0x54615e[_0x3cff('0x2f')][_0x3cff('0x35')](_0x3cff('0x36'))){_0x3f5f42[_0x3cff('0x1e')]=qs[_0x3cff('0x1e')](_0x54615e['query'][_0x3cff('0x1e')]);_0x3f5f42['offset']=qs['offset'](_0x54615e[_0x3cff('0x2f')][_0x3cff('0x1d')]);}_0x3f5f42['order']=qs[_0x3cff('0x37')](_0x54615e[_0x3cff('0x2f')]['sort']);_0x3f5f42[_0x3cff('0x38')]=qs[_0x3cff('0x39')](_['pick'](_0x54615e[_0x3cff('0x2f')],_0x13f623['filters']),_0x5cdfa3);if(_0x54615e['query'][_0x3cff('0x3a')]){_0x3f5f42[_0x3cff('0x38')]=_['merge'](_0x3f5f42[_0x3cff('0x38')],{'$or':_[_0x3cff('0x2a')](_0x5cdfa3,function(_0x54c16e){if(_0x54c16e['type']!==_0x3cff('0x3b')){var _0x36bbbc={};_0x36bbbc[_0x54c16e[_0x3cff('0x27')]]={'$like':'%'+_0x54615e[_0x3cff('0x2f')][_0x3cff('0x3a')]+'%'};return _0x36bbbc;}})});}_0x3f5f42=_['merge']({},_0x3f5f42,_0x54615e[_0x3cff('0x3c')]);var _0x52fd6e={'where':_0x3f5f42[_0x3cff('0x38')]};return db[_0x3cff('0x2b')][_0x3cff('0x3d')](_0x52fd6e)[_0x3cff('0x25')](function(_0x2acccc){_0x5dbfe0[_0x3cff('0x3d')]=_0x2acccc;if(_0x54615e[_0x3cff('0x2f')][_0x3cff('0x3e')]){_0x3f5f42[_0x3cff('0x3f')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x3cff('0x40')](_0x3f5f42);})[_0x3cff('0x25')](function(_0x64983a){_0x5dbfe0[_0x3cff('0x41')]=_0x64983a;return _0x5dbfe0;})[_0x3cff('0x25')](respondWithFilteredResult(_0x496482,_0x3f5f42))[_0x3cff('0x42')](handleError(_0x496482,null));};exports[_0x3cff('0x43')]=function(_0x4dbac3,_0x3cc425){var _0x516cfe={'raw':![],'where':{'id':_0x4dbac3[_0x3cff('0x44')]['id']}},_0x5c806a={};_0x5c806a[_0x3cff('0x2e')]=_[_0x3cff('0x30')](db['VoiceQueueReport'][_0x3cff('0x2c')]);_0x5c806a[_0x3cff('0x2f')]=_[_0x3cff('0x30')](_0x4dbac3[_0x3cff('0x2f')]);_0x5c806a[_0x3cff('0x39')]=_[_0x3cff('0x31')](_0x5c806a['model'],_0x5c806a['query']);_0x516cfe['attributes']=_[_0x3cff('0x31')](_0x5c806a[_0x3cff('0x2e')],qs['fields'](_0x4dbac3[_0x3cff('0x2f')][_0x3cff('0x33')]));_0x516cfe[_0x3cff('0x32')]=_0x516cfe['attributes'][_0x3cff('0x34')]?_0x516cfe['attributes']:_0x5c806a['model'];if(_0x4dbac3[_0x3cff('0x2f')][_0x3cff('0x3e')]){_0x516cfe[_0x3cff('0x3f')]=[{'all':!![]}];}_0x516cfe=_[_0x3cff('0x45')]({},_0x516cfe,_0x4dbac3[_0x3cff('0x3c')]);return db['VoiceQueueReport'][_0x3cff('0x46')](_0x516cfe)[_0x3cff('0x25')](handleEntityNotFound(_0x3cc425,null))[_0x3cff('0x25')](respondWithResult(_0x3cc425,null))['catch'](handleError(_0x3cc425,null));};exports[_0x3cff('0x47')]=function(_0x3be7ab,_0x465e26){return db[_0x3cff('0x2b')][_0x3cff('0x47')](_0x3be7ab[_0x3cff('0x48')],{})[_0x3cff('0x25')](respondWithResult(_0x465e26,0xc9))[_0x3cff('0x42')](handleError(_0x465e26,null));};exports[_0x3cff('0x23')]=function(_0x54a254,_0x4fa8d7){if(_0x54a254[_0x3cff('0x48')]['id']){delete _0x54a254[_0x3cff('0x48')]['id'];}return db[_0x3cff('0x2b')][_0x3cff('0x46')]({'where':{'id':_0x54a254[_0x3cff('0x44')]['id']}})[_0x3cff('0x25')](handleEntityNotFound(_0x4fa8d7,null))['then'](saveUpdates(_0x54a254[_0x3cff('0x48')],null))[_0x3cff('0x25')](respondWithResult(_0x4fa8d7,null))['catch'](handleError(_0x4fa8d7,null));};exports[_0x3cff('0x24')]=function(_0x58b178,_0x269ba2){return db['VoiceQueueReport']['find']({'where':{'id':_0x58b178[_0x3cff('0x44')]['id']}})['then'](handleEntityNotFound(_0x269ba2,null))[_0x3cff('0x25')](removeEntity(_0x269ba2,null))['catch'](handleError(_0x269ba2,null));};exports['describe']=function(_0x2be295,_0x572747){return db[_0x3cff('0x2b')][_0x3cff('0x49')]()[_0x3cff('0x25')](respondWithResult(_0x572747,null))[_0x3cff('0x42')](handleError(_0x572747,null));};exports[_0x3cff('0x4a')]=function(_0x4ddbb0,_0x10db3c){var _0x16504a={},_0x19f917={},_0x5ba398={'count':0x0,'rows':[]};_0x19f917[_0x3cff('0x2e')]=_[_0x3cff('0x30')](db['VoiceQueueReport'][_0x3cff('0x2c')]);_0x19f917[_0x3cff('0x2f')]=_[_0x3cff('0x30')](_0x4ddbb0['query']);_0x19f917[_0x3cff('0x39')]=_[_0x3cff('0x31')](_0x19f917[_0x3cff('0x2e')],_0x19f917['query']);_0x16504a['attributes']=_[_0x3cff('0x31')](_0x19f917[_0x3cff('0x2e')],qs[_0x3cff('0x33')](_0x4ddbb0[_0x3cff('0x2f')][_0x3cff('0x33')]));_0x16504a[_0x3cff('0x32')]=_0x16504a[_0x3cff('0x32')][_0x3cff('0x34')]?_0x16504a[_0x3cff('0x32')]:_0x19f917[_0x3cff('0x2e')];if(!_0x4ddbb0[_0x3cff('0x2f')][_0x3cff('0x35')](_0x3cff('0x36'))){_0x16504a[_0x3cff('0x1e')]=qs[_0x3cff('0x1e')](_0x4ddbb0[_0x3cff('0x2f')][_0x3cff('0x1e')]);_0x16504a[_0x3cff('0x1d')]=qs[_0x3cff('0x1d')](_0x4ddbb0['query'][_0x3cff('0x1d')]);}_0x16504a[_0x3cff('0x4b')]=qs[_0x3cff('0x37')](_0x4ddbb0[_0x3cff('0x2f')][_0x3cff('0x37')]);_0x16504a[_0x3cff('0x38')]=qs[_0x3cff('0x39')](_[_0x3cff('0x4c')](_0x4ddbb0['query'],_0x19f917[_0x3cff('0x39')]));if(_0x4ddbb0[_0x3cff('0x2f')][_0x3cff('0x3a')]){_0x16504a['where']=_[_0x3cff('0x45')](_0x16504a[_0x3cff('0x38')],{'$or':_[_0x3cff('0x2a')](_0x16504a['attributes'],function(_0x518436){var _0x410076={};_0x410076[_0x518436]={'$like':'%'+_0x4ddbb0[_0x3cff('0x2f')]['filter']+'%'};return _0x410076;})});}_0x16504a=_[_0x3cff('0x45')]({},_0x16504a,_0x4ddbb0[_0x3cff('0x3c')]);var _0x9951f0={'where':_0x16504a[_0x3cff('0x38')]};return db['VoiceQueueReport']['count'](_0x9951f0)[_0x3cff('0x25')](function(_0x477f79){_0x5ba398[_0x3cff('0x3d')]=_0x477f79;if(_0x4ddbb0[_0x3cff('0x2f')][_0x3cff('0x3e')]){_0x16504a[_0x3cff('0x3f')]=[{'all':!![]}];}return db[_0x3cff('0x2b')][_0x3cff('0x40')](_0x16504a);})[_0x3cff('0x25')](function(_0x35a454){_0x5ba398[_0x3cff('0x41')]=_0x35a454;return _0x5ba398;})[_0x3cff('0x25')](respondWithFilteredResult(_0x10db3c,_0x16504a,'getVoiceQueuesReport'))[_0x3cff('0x42')](handleError(_0x10db3c,null,_0x3cff('0x4a')));}; \ No newline at end of file +var _0x5d09=['util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','findAll','rows','catch','include','find','create','body','params','getVoiceQueuesReport','rimraf','zip-dir','request-promise','bluebird'];(function(_0xb6802,_0x657198){var _0xc796c5=function(_0x7126b6){while(--_0x7126b6){_0xb6802['push'](_0xb6802['shift']());}};_0xc796c5(++_0x657198);}(_0x5d09,0x9c));var _0x95d0=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0x5d09[_0x4bc428];return _0x3ca37f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95d0('0x0'));var zipdir=require(_0x95d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95d0('0x2'));var moment=require('moment');var BPromise=require(_0x95d0('0x3'));var Mustache=require('mustache');var util=require(_0x95d0('0x4'));var path=require(_0x95d0('0x5'));var sox=require(_0x95d0('0x6'));var csv=require(_0x95d0('0x7'));var ejs=require(_0x95d0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95d0('0x9'));var squel=require('squel');var crypto=require(_0x95d0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x95d0('0xb'));var toCsv=require(_0x95d0('0x7'));var querystring=require(_0x95d0('0xc'));var Papa=require('papaparse');var Redis=require(_0x95d0('0xd'));var authService=require(_0x95d0('0xe'));var qs=require(_0x95d0('0xf'));var as=require(_0x95d0('0x10'));var hardwareService=require(_0x95d0('0x11'));var logger=require(_0x95d0('0x12'))(_0x95d0('0x13'));var utils=require(_0x95d0('0x14'));var config=require(_0x95d0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x95d0('0x16'))['db'];config[_0x95d0('0x17')]=_[_0x95d0('0x18')](config[_0x95d0('0x17')],{'host':_0x95d0('0x19'),'port':0x18eb});var socket=require(_0x95d0('0x1a'))(new Redis(config[_0x95d0('0x17')]));require('./voiceQueueReport.socket')[_0x95d0('0x1b')](socket);function respondWithStatusCode(_0x32ab35,_0x29d613){_0x29d613=_0x29d613||0xcc;return function(_0x17f459){if(_0x17f459){return _0x32ab35['sendStatus'](_0x29d613);}return _0x32ab35[_0x95d0('0x1c')](_0x29d613)['end']();};}function respondWithResult(_0x353d6b,_0x4d8e9a){_0x4d8e9a=_0x4d8e9a||0xc8;return function(_0x5e05a1){if(_0x5e05a1){return _0x353d6b['status'](_0x4d8e9a)[_0x95d0('0x1d')](_0x5e05a1);}};}function respondWithFilteredResult(_0x115c61,_0x5c15df){return function(_0xe54ff0){if(_0xe54ff0){var _0x470d0c=typeof _0x5c15df[_0x95d0('0x1e')]===_0x95d0('0x1f')&&typeof _0x5c15df['limit']===_0x95d0('0x1f');var _0xb05510=_0xe54ff0[_0x95d0('0x20')];var _0x86f4e=_0x470d0c?0x0:_0x5c15df['offset'];var _0x24c887=_0x470d0c?_0xe54ff0[_0x95d0('0x20')]:_0x5c15df['offset']+_0x5c15df[_0x95d0('0x21')];var _0x550fab;if(_0x24c887>=_0xb05510){_0x24c887=_0xb05510;_0x550fab=0xc8;}else{_0x550fab=0xce;}_0x115c61[_0x95d0('0x1c')](_0x550fab);return _0x115c61[_0x95d0('0x22')](_0x95d0('0x23'),_0x86f4e+'-'+_0x24c887+'/'+_0xb05510)[_0x95d0('0x1d')](_0xe54ff0);}return null;};}function patchUpdates(_0x15cc39){return function(_0x57d6d8){try{jsonpatch[_0x95d0('0x24')](_0x57d6d8,_0x15cc39,!![]);}catch(_0x46d048){return BPromise[_0x95d0('0x25')](_0x46d048);}return _0x57d6d8[_0x95d0('0x26')]();};}function saveUpdates(_0x23f0a4,_0x3edaa7){return function(_0x2c1dbc){if(_0x2c1dbc){return _0x2c1dbc[_0x95d0('0x27')](_0x23f0a4)[_0x95d0('0x28')](function(_0x29cfcb){return _0x29cfcb;});}return null;};}function removeEntity(_0xc124a7,_0x531909){return function(_0x300322){if(_0x300322){return _0x300322[_0x95d0('0x29')]()[_0x95d0('0x28')](function(){_0xc124a7[_0x95d0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x411b90,_0x18f34e){return function(_0x25c615){if(!_0x25c615){_0x411b90[_0x95d0('0x2a')](0x194);}return _0x25c615;};}function handleError(_0x3c1ba7,_0x464625){_0x464625=_0x464625||0x1f4;return function(_0x329830){logger[_0x95d0('0x2b')](_0x329830[_0x95d0('0x2c')]);if(_0x329830['name']){delete _0x329830[_0x95d0('0x2d')];}_0x3c1ba7[_0x95d0('0x1c')](_0x464625)[_0x95d0('0x2e')](_0x329830);};}exports[_0x95d0('0x2f')]=function(_0xfc5c7a,_0x14ecc7){var _0x436aee={},_0x5913a0={},_0x1d135e={'count':0x0,'rows':[]};var _0x36d2e3=_[_0x95d0('0x30')](db[_0x95d0('0x31')][_0x95d0('0x32')],function(_0x438778){return{'name':_0x438778[_0x95d0('0x33')],'type':_0x438778[_0x95d0('0x34')][_0x95d0('0x35')]};});_0x5913a0['model']=_[_0x95d0('0x30')](_0x36d2e3,_0x95d0('0x2d'));_0x5913a0[_0x95d0('0x36')]=_[_0x95d0('0x37')](_0xfc5c7a[_0x95d0('0x36')]);_0x5913a0[_0x95d0('0x38')]=_[_0x95d0('0x39')](_0x5913a0[_0x95d0('0x3a')],_0x5913a0['query']);_0x436aee[_0x95d0('0x3b')]=_[_0x95d0('0x39')](_0x5913a0[_0x95d0('0x3a')],qs[_0x95d0('0x3c')](_0xfc5c7a['query'][_0x95d0('0x3c')]));_0x436aee[_0x95d0('0x3b')]=_0x436aee[_0x95d0('0x3b')][_0x95d0('0x3d')]?_0x436aee[_0x95d0('0x3b')]:_0x5913a0[_0x95d0('0x3a')];if(!_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x3e')](_0x95d0('0x3f'))){_0x436aee['limit']=qs[_0x95d0('0x21')](_0xfc5c7a[_0x95d0('0x36')]['limit']);_0x436aee[_0x95d0('0x1e')]=qs[_0x95d0('0x1e')](_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x1e')]);}_0x436aee[_0x95d0('0x40')]=qs['sort'](_0xfc5c7a['query']['sort']);_0x436aee[_0x95d0('0x41')]=qs[_0x95d0('0x38')](_[_0x95d0('0x42')](_0xfc5c7a[_0x95d0('0x36')],_0x5913a0[_0x95d0('0x38')]),_0x36d2e3);if(_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x43')]){_0x436aee['where']=_[_0x95d0('0x44')](_0x436aee[_0x95d0('0x41')],{'$or':_[_0x95d0('0x30')](_0x36d2e3,function(_0x51f2ba){if(_0x51f2ba[_0x95d0('0x34')]!=='VIRTUAL'){var _0x3a8151={};_0x3a8151[_0x51f2ba[_0x95d0('0x2d')]]={'$like':'%'+_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x43')]+'%'};return _0x3a8151;}})});}_0x436aee=_[_0x95d0('0x44')]({},_0x436aee,_0xfc5c7a[_0x95d0('0x45')]);var _0x82550e={'where':_0x436aee[_0x95d0('0x41')]};return db[_0x95d0('0x31')][_0x95d0('0x20')](_0x82550e)[_0x95d0('0x28')](function(_0x3b5225){_0x1d135e[_0x95d0('0x20')]=_0x3b5225;if(_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x46')]){_0x436aee['include']=[{'all':!![]}];}return db[_0x95d0('0x31')][_0x95d0('0x47')](_0x436aee);})[_0x95d0('0x28')](function(_0xaa437a){_0x1d135e[_0x95d0('0x48')]=_0xaa437a;return _0x1d135e;})[_0x95d0('0x28')](respondWithFilteredResult(_0x14ecc7,_0x436aee))[_0x95d0('0x49')](handleError(_0x14ecc7,null));};exports['show']=function(_0x4a55d3,_0x57f3c1){var _0xe4cbf3={'raw':![],'where':{'id':_0x4a55d3['params']['id']}},_0x19c71e={};_0x19c71e[_0x95d0('0x3a')]=_[_0x95d0('0x37')](db['VoiceQueueReport'][_0x95d0('0x32')]);_0x19c71e[_0x95d0('0x36')]=_['keys'](_0x4a55d3[_0x95d0('0x36')]);_0x19c71e['filters']=_[_0x95d0('0x39')](_0x19c71e[_0x95d0('0x3a')],_0x19c71e[_0x95d0('0x36')]);_0xe4cbf3[_0x95d0('0x3b')]=_[_0x95d0('0x39')](_0x19c71e['model'],qs[_0x95d0('0x3c')](_0x4a55d3[_0x95d0('0x36')][_0x95d0('0x3c')]));_0xe4cbf3[_0x95d0('0x3b')]=_0xe4cbf3[_0x95d0('0x3b')][_0x95d0('0x3d')]?_0xe4cbf3[_0x95d0('0x3b')]:_0x19c71e[_0x95d0('0x3a')];if(_0x4a55d3[_0x95d0('0x36')][_0x95d0('0x46')]){_0xe4cbf3[_0x95d0('0x4a')]=[{'all':!![]}];}_0xe4cbf3=_['merge']({},_0xe4cbf3,_0x4a55d3[_0x95d0('0x45')]);return db[_0x95d0('0x31')][_0x95d0('0x4b')](_0xe4cbf3)[_0x95d0('0x28')](handleEntityNotFound(_0x57f3c1,null))[_0x95d0('0x28')](respondWithResult(_0x57f3c1,null))[_0x95d0('0x49')](handleError(_0x57f3c1,null));};exports[_0x95d0('0x4c')]=function(_0x247f1f,_0x1325af){return db[_0x95d0('0x31')][_0x95d0('0x4c')](_0x247f1f[_0x95d0('0x4d')],{})[_0x95d0('0x28')](respondWithResult(_0x1325af,0xc9))[_0x95d0('0x49')](handleError(_0x1325af,null));};exports[_0x95d0('0x27')]=function(_0x58d916,_0x21b253){if(_0x58d916['body']['id']){delete _0x58d916[_0x95d0('0x4d')]['id'];}return db[_0x95d0('0x31')][_0x95d0('0x4b')]({'where':{'id':_0x58d916[_0x95d0('0x4e')]['id']}})[_0x95d0('0x28')](handleEntityNotFound(_0x21b253,null))[_0x95d0('0x28')](saveUpdates(_0x58d916[_0x95d0('0x4d')],null))[_0x95d0('0x28')](respondWithResult(_0x21b253,null))[_0x95d0('0x49')](handleError(_0x21b253,null));};exports[_0x95d0('0x29')]=function(_0x36a9e2,_0x512f2d){return db[_0x95d0('0x31')][_0x95d0('0x4b')]({'where':{'id':_0x36a9e2['params']['id']}})['then'](handleEntityNotFound(_0x512f2d,null))[_0x95d0('0x28')](removeEntity(_0x512f2d,null))[_0x95d0('0x49')](handleError(_0x512f2d,null));};exports['describe']=function(_0x26dfe9,_0xc42282){return db[_0x95d0('0x31')]['describe']()[_0x95d0('0x28')](respondWithResult(_0xc42282,null))['catch'](handleError(_0xc42282,null));};exports[_0x95d0('0x4f')]=function(_0x5aef16,_0x484ffb){var _0x41dcb3={},_0x49345a={},_0x22fdf4={'count':0x0,'rows':[]};_0x49345a[_0x95d0('0x3a')]=_[_0x95d0('0x37')](db[_0x95d0('0x31')]['rawAttributes']);_0x49345a['query']=_[_0x95d0('0x37')](_0x5aef16[_0x95d0('0x36')]);_0x49345a[_0x95d0('0x38')]=_[_0x95d0('0x39')](_0x49345a[_0x95d0('0x3a')],_0x49345a[_0x95d0('0x36')]);_0x41dcb3['attributes']=_[_0x95d0('0x39')](_0x49345a[_0x95d0('0x3a')],qs['fields'](_0x5aef16[_0x95d0('0x36')]['fields']));_0x41dcb3['attributes']=_0x41dcb3[_0x95d0('0x3b')]['length']?_0x41dcb3['attributes']:_0x49345a[_0x95d0('0x3a')];if(!_0x5aef16['query']['hasOwnProperty'](_0x95d0('0x3f'))){_0x41dcb3[_0x95d0('0x21')]=qs[_0x95d0('0x21')](_0x5aef16[_0x95d0('0x36')][_0x95d0('0x21')]);_0x41dcb3[_0x95d0('0x1e')]=qs['offset'](_0x5aef16[_0x95d0('0x36')][_0x95d0('0x1e')]);}_0x41dcb3[_0x95d0('0x40')]=qs['sort'](_0x5aef16[_0x95d0('0x36')]['sort']);_0x41dcb3['where']=qs['filters'](_[_0x95d0('0x42')](_0x5aef16[_0x95d0('0x36')],_0x49345a[_0x95d0('0x38')]));if(_0x5aef16[_0x95d0('0x36')][_0x95d0('0x43')]){_0x41dcb3[_0x95d0('0x41')]=_['merge'](_0x41dcb3[_0x95d0('0x41')],{'$or':_[_0x95d0('0x30')](_0x41dcb3[_0x95d0('0x3b')],function(_0x4b0413){var _0x451a1f={};_0x451a1f[_0x4b0413]={'$like':'%'+_0x5aef16[_0x95d0('0x36')][_0x95d0('0x43')]+'%'};return _0x451a1f;})});}_0x41dcb3=_[_0x95d0('0x44')]({},_0x41dcb3,_0x5aef16[_0x95d0('0x45')]);var _0x37c84b={'where':_0x41dcb3[_0x95d0('0x41')]};return db[_0x95d0('0x31')]['count'](_0x37c84b)[_0x95d0('0x28')](function(_0x1e5ddb){_0x22fdf4[_0x95d0('0x20')]=_0x1e5ddb;if(_0x5aef16['query']['includeAll']){_0x41dcb3['include']=[{'all':!![]}];}return db[_0x95d0('0x31')]['findAll'](_0x41dcb3);})[_0x95d0('0x28')](function(_0xeb4550){_0x22fdf4[_0x95d0('0x48')]=_0xeb4550;return _0x22fdf4;})[_0x95d0('0x28')](respondWithFilteredResult(_0x484ffb,_0x41dcb3,_0x95d0('0x4f')))['catch'](handleError(_0x484ffb,null,_0x95d0('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 747ef7c..11ab958 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 _0xe2ac=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1f9a22,_0x136ec1){var _0x489f0e=function(_0xa8a809){while(--_0xa8a809){_0x1f9a22['push'](_0x1f9a22['shift']());}};_0x489f0e(++_0x136ec1);}(_0xe2ac,0x1de));var _0xce2a=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xe2ac[_0x5c3ae9];return _0x3f5950;};'use strict';var EventEmitter=require(_0xce2a('0x0'));var VoiceQueueReport=require(_0xce2a('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce2a('0x2'),'afterUpdate':_0xce2a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2e6378){return function(_0x35b7db,_0x589439,_0x1265d4){VoiceQueueReportEvents[_0xce2a('0x4')](_0x2e6378+':'+_0x35b7db['id'],_0x35b7db);VoiceQueueReportEvents[_0xce2a('0x4')](_0x2e6378,_0x35b7db);_0x1265d4(null);};}for(var e in events){if(events[_0xce2a('0x5')](e)){var event=events[e];VoiceQueueReport[_0xce2a('0x6')](e,emitEvent(event));}}module[_0xce2a('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x582f=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x488b82,_0x3893ef){var _0x5c43dd=function(_0x1f5a98){while(--_0x1f5a98){_0x488b82['push'](_0x488b82['shift']());}};_0x5c43dd(++_0x3893ef);}(_0x582f,0x15d));var _0xf582=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x582f[_0x462999];return _0x4b1366;};'use strict';var EventEmitter=require(_0xf582('0x0'));var VoiceQueueReport=require(_0xf582('0x1'))['db'][_0xf582('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf582('0x3')](0x0);var events={'afterCreate':_0xf582('0x4'),'afterUpdate':_0xf582('0x5'),'afterDestroy':_0xf582('0x6')};function emitEvent(_0x52a13f){return function(_0x51b7e6,_0x4bb7cd,_0x438723){VoiceQueueReportEvents['emit'](_0x52a13f+':'+_0x51b7e6['id'],_0x51b7e6);VoiceQueueReportEvents[_0xf582('0x7')](_0x52a13f,_0x51b7e6);_0x438723(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xf582('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 d479aaf..24370dd 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 _0x59a3=['../../config/environment','./voiceQueueReport.attributes','define','report_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x59a3,0x123));var _0x359a=function(_0x3ced7c,_0x160993){_0x3ced7c=_0x3ced7c-0x0;var _0x55f590=_0x59a3[_0x3ced7c];return _0x55f590;};'use strict';var _=require(_0x359a('0x0'));var util=require(_0x359a('0x1'));var logger=require(_0x359a('0x2'))('api');var moment=require(_0x359a('0x3'));var BPromise=require(_0x359a('0x4'));var rp=require(_0x359a('0x5'));var fs=require('fs');var path=require(_0x359a('0x6'));var rimraf=require(_0x359a('0x7'));var config=require(_0x359a('0x8'));var attributes=require(_0x359a('0x9'));module['exports']=function(_0x170ef,_0x15083b){return _0x170ef[_0x359a('0xa')]('VoiceQueueReport',attributes,{'tableName':_0x359a('0xb'),'paranoid':![],'indexes':[{'fields':[_0x359a('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xff47=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport'];(function(_0x5f0034,_0x1bf6d0){var _0x35a7ea=function(_0x39332f){while(--_0x39332f){_0x5f0034['push'](_0x5f0034['shift']());}};_0x35a7ea(++_0x1bf6d0);}(_0xff47,0x1f4));var _0x7ff4=function(_0x443bdd,_0x517654){_0x443bdd=_0x443bdd-0x0;var _0x3a1e48=_0xff47[_0x443bdd];return _0x3a1e48;};'use strict';var _=require(_0x7ff4('0x0'));var util=require(_0x7ff4('0x1'));var logger=require('../../config/logger')(_0x7ff4('0x2'));var moment=require('moment');var BPromise=require(_0x7ff4('0x3'));var rp=require(_0x7ff4('0x4'));var fs=require('fs');var path=require(_0x7ff4('0x5'));var rimraf=require(_0x7ff4('0x6'));var config=require(_0x7ff4('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0x7ff4('0x8')]=function(_0x5b0db7,_0x326859){return _0x5b0db7['define'](_0x7ff4('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 28c44da..961c192 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 _0x895b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','map','include','model','CreateVoiceQueueReport','create','body','update','limit','UpdateVoiceQueueReport','lodash','util'];(function(_0x1ebee8,_0x5846bc){var _0x857047=function(_0xbfe794){while(--_0xbfe794){_0x1ebee8['push'](_0x1ebee8['shift']());}};_0x857047(++_0x5846bc);}(_0x895b,0x132));var _0xb895=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x895b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb895('0x0'));var util=require(_0xb895('0x1'));var moment=require('moment');var BPromise=require(_0xb895('0x2'));var rs=require(_0xb895('0x3'));var fs=require('fs');var Redis=require(_0xb895('0x4'));var db=require(_0xb895('0x5'))['db'];var utils=require(_0xb895('0x6'));var logger=require(_0xb895('0x7'))(_0xb895('0x8'));var config=require(_0xb895('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb895('0xa')]['http']({'port':0x232a});config[_0xb895('0xb')]=_[_0xb895('0xc')](config['redis'],{'host':_0xb895('0xd'),'port':0x18eb});var socket=require(_0xb895('0xe'))(new Redis(config[_0xb895('0xb')]));require(_0xb895('0xf'))[_0xb895('0x10')](socket);function respondWithRpcPromise(_0x5b903f,_0x1c5317,_0x264407){return new BPromise(function(_0x56bb3d,_0x377f7f){return client[_0xb895('0x11')](_0x5b903f,_0x264407)[_0xb895('0x12')](function(_0x2ce7b1){logger['info'](_0xb895('0x13'),_0x1c5317,_0xb895('0x14'));logger[_0xb895('0x15')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1c5317,_0xb895('0x14'),JSON[_0xb895('0x16')](_0x2ce7b1));if(_0x2ce7b1[_0xb895('0x17')]){if(_0x2ce7b1['error']['code']===0x1f4){logger[_0xb895('0x17')](_0xb895('0x13'),_0x1c5317,_0x2ce7b1[_0xb895('0x17')]['message']);return _0x377f7f(_0x2ce7b1[_0xb895('0x17')][_0xb895('0x18')]);}logger[_0xb895('0x17')](_0xb895('0x13'),_0x1c5317,_0x2ce7b1[_0xb895('0x17')]['message']);return _0x56bb3d(_0x2ce7b1[_0xb895('0x17')][_0xb895('0x18')]);}else{logger[_0xb895('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x1c5317,_0xb895('0x14'));_0x56bb3d(_0x2ce7b1[_0xb895('0x1a')][_0xb895('0x18')]);}})[_0xb895('0x1b')](function(_0x18153b){logger[_0xb895('0x17')](_0xb895('0x13'),_0x1c5317,_0x18153b);_0x377f7f(_0x18153b);});});}exports[_0xb895('0x1c')]=function(_0x528997){var _0xffaf8c=this;return new Promise(function(_0x2f1139,_0x4e3724){return db[_0xb895('0x1d')][_0xb895('0x1e')]({'raw':_0x528997[_0xb895('0x1f')]?_0x528997['options'][_0xb895('0x20')]===undefined?!![]:![]:!![],'where':_0x528997[_0xb895('0x1f')]?_0x528997[_0xb895('0x1f')][_0xb895('0x21')]||null:null,'attributes':_0x528997[_0xb895('0x1f')]?_0x528997[_0xb895('0x1f')][_0xb895('0x22')]||null:null,'limit':_0x528997[_0xb895('0x1f')]?_0x528997[_0xb895('0x1f')]['limit']||null:null,'include':_0x528997['options']?_0x528997[_0xb895('0x1f')]['include']?_[_0xb895('0x23')](_0x528997[_0xb895('0x1f')][_0xb895('0x24')],function(_0x194681){return{'model':db[_0x194681[_0xb895('0x25')]],'as':_0x194681['as'],'attributes':_0x194681['attributes'],'include':_0x194681[_0xb895('0x24')]?_['map'](_0x194681[_0xb895('0x24')],function(_0x59abdf){return{'model':db[_0x59abdf[_0xb895('0x25')]],'as':_0x59abdf['as'],'attributes':_0x59abdf['attributes'],'include':_0x59abdf[_0xb895('0x24')]?_[_0xb895('0x23')](_0x59abdf[_0xb895('0x24')],function(_0x8c2825){return{'model':db[_0x8c2825['model']],'as':_0x8c2825['as'],'attributes':_0x8c2825[_0xb895('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb895('0x12')](function(_0x51e406){logger[_0xb895('0x19')](_0xb895('0x1c'),_0x528997);logger[_0xb895('0x15')](_0xb895('0x1c'),_0x528997,JSON[_0xb895('0x16')](_0x51e406));_0x2f1139(_0x51e406);})['catch'](function(_0x211186){logger[_0xb895('0x17')](_0xb895('0x1c'),_0x211186[_0xb895('0x18')],_0x528997);_0x4e3724(_0xffaf8c[_0xb895('0x17')](0x1f4,_0x211186['message']));});});};exports[_0xb895('0x26')]=function(_0xf34f81){var _0x44b11a=this;return new Promise(function(_0x27031c,_0x4a143d){return db[_0xb895('0x1d')][_0xb895('0x27')](_0xf34f81[_0xb895('0x28')],{'raw':_0xf34f81[_0xb895('0x1f')]?_0xf34f81[_0xb895('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xb895('0x12')](function(_0x2d02e0){logger[_0xb895('0x19')](_0xb895('0x26'),_0xf34f81);logger[_0xb895('0x15')]('CreateVoiceQueueReport',_0xf34f81,JSON[_0xb895('0x16')](_0x2d02e0));_0x27031c(_0x2d02e0);})[_0xb895('0x1b')](function(_0x1e7518){logger[_0xb895('0x17')](_0xb895('0x26'),_0x1e7518[_0xb895('0x18')],_0xf34f81);_0x4a143d(_0x44b11a['error'](0x1f4,_0x1e7518[_0xb895('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x37d58a){var _0x2c10ed=this;return new Promise(function(_0x2ee548,_0x246b15){return db['VoiceQueueReport'][_0xb895('0x29')](_0x37d58a['body'],{'raw':_0x37d58a[_0xb895('0x1f')]?_0x37d58a[_0xb895('0x1f')][_0xb895('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37d58a[_0xb895('0x1f')]?_0x37d58a[_0xb895('0x1f')][_0xb895('0x21')]||null:null,'attributes':_0x37d58a['options']?_0x37d58a['options'][_0xb895('0x22')]||null:null,'limit':_0x37d58a[_0xb895('0x1f')]?_0x37d58a['options'][_0xb895('0x2a')]||null:null})[_0xb895('0x12')](function(_0x2ac654){logger[_0xb895('0x19')](_0xb895('0x2b'),_0x37d58a);logger['debug'](_0xb895('0x2b'),_0x37d58a,JSON[_0xb895('0x16')](_0x2ac654));_0x2ee548(_0x2ac654);})['catch'](function(_0x226629){logger[_0xb895('0x17')](_0xb895('0x2b'),_0x226629['message'],_0x37d58a);_0x246b15(_0x2c10ed[_0xb895('0x17')](0x1f4,_0x226629['message']));});});}; \ No newline at end of file +var _0x5427=['raw','options','limit','map','include','model','attributes','CreateVoiceQueueReport','body','catch','UpdateVoiceQueueReport','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','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','GetVoiceQueueReport','VoiceQueueReport','findAll'];(function(_0x57c1a9,_0x2f5b60){var _0x1072ec=function(_0x58d22f){while(--_0x58d22f){_0x57c1a9['push'](_0x57c1a9['shift']());}};_0x1072ec(++_0x2f5b60);}(_0x5427,0xe3));var _0x7542=function(_0x539373,_0xeb40a7){_0x539373=_0x539373-0x0;var _0x35182a=_0x5427[_0x539373];return _0x35182a;};'use strict';var _=require(_0x7542('0x0'));var util=require(_0x7542('0x1'));var moment=require(_0x7542('0x2'));var BPromise=require('bluebird');var rs=require(_0x7542('0x3'));var fs=require('fs');var Redis=require(_0x7542('0x4'));var db=require(_0x7542('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7542('0x6'))(_0x7542('0x7'));var config=require(_0x7542('0x8'));var jayson=require(_0x7542('0x9'));var client=jayson['client'][_0x7542('0xa')]({'port':0x232a});config[_0x7542('0xb')]=_['defaults'](config['redis'],{'host':_0x7542('0xc'),'port':0x18eb});var socket=require(_0x7542('0xd'))(new Redis(config[_0x7542('0xb')]));require(_0x7542('0xe'))[_0x7542('0xf')](socket);function respondWithRpcPromise(_0x480d8d,_0x2516ef,_0x230ec8){return new BPromise(function(_0x479371,_0x2b9201){return client[_0x7542('0x10')](_0x480d8d,_0x230ec8)[_0x7542('0x11')](function(_0x5ab460){logger[_0x7542('0x12')](_0x7542('0x13'),_0x2516ef,_0x7542('0x14'));logger[_0x7542('0x15')](_0x7542('0x16'),_0x2516ef,_0x7542('0x14'),JSON[_0x7542('0x17')](_0x5ab460));if(_0x5ab460[_0x7542('0x18')]){if(_0x5ab460[_0x7542('0x18')][_0x7542('0x19')]===0x1f4){logger[_0x7542('0x18')](_0x7542('0x13'),_0x2516ef,_0x5ab460[_0x7542('0x18')][_0x7542('0x1a')]);return _0x2b9201(_0x5ab460[_0x7542('0x18')][_0x7542('0x1a')]);}logger[_0x7542('0x18')](_0x7542('0x13'),_0x2516ef,_0x5ab460['error'][_0x7542('0x1a')]);return _0x479371(_0x5ab460[_0x7542('0x18')]['message']);}else{logger[_0x7542('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x2516ef,_0x7542('0x14'));_0x479371(_0x5ab460[_0x7542('0x1b')]['message']);}})['catch'](function(_0x4fad40){logger[_0x7542('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x2516ef,_0x4fad40);_0x2b9201(_0x4fad40);});});}exports[_0x7542('0x1c')]=function(_0x30b557){var _0x29d8de=this;return new Promise(function(_0x47a1a6,_0x2c0846){return db[_0x7542('0x1d')][_0x7542('0x1e')]({'raw':_0x30b557['options']?_0x30b557['options'][_0x7542('0x1f')]===undefined?!![]:![]:!![],'where':_0x30b557[_0x7542('0x20')]?_0x30b557[_0x7542('0x20')]['where']||null:null,'attributes':_0x30b557[_0x7542('0x20')]?_0x30b557[_0x7542('0x20')]['attributes']||null:null,'limit':_0x30b557[_0x7542('0x20')]?_0x30b557[_0x7542('0x20')][_0x7542('0x21')]||null:null,'include':_0x30b557[_0x7542('0x20')]?_0x30b557[_0x7542('0x20')]['include']?_[_0x7542('0x22')](_0x30b557['options'][_0x7542('0x23')],function(_0x4ad8f1){return{'model':db[_0x4ad8f1[_0x7542('0x24')]],'as':_0x4ad8f1['as'],'attributes':_0x4ad8f1[_0x7542('0x25')],'include':_0x4ad8f1[_0x7542('0x23')]?_['map'](_0x4ad8f1[_0x7542('0x23')],function(_0x33bddb){return{'model':db[_0x33bddb[_0x7542('0x24')]],'as':_0x33bddb['as'],'attributes':_0x33bddb[_0x7542('0x25')],'include':_0x33bddb['include']?_['map'](_0x33bddb['include'],function(_0x3c3139){return{'model':db[_0x3c3139[_0x7542('0x24')]],'as':_0x3c3139['as'],'attributes':_0x3c3139[_0x7542('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7542('0x11')](function(_0x2e5ac3){logger[_0x7542('0x12')](_0x7542('0x1c'),_0x30b557);logger['debug'](_0x7542('0x1c'),_0x30b557,JSON['stringify'](_0x2e5ac3));_0x47a1a6(_0x2e5ac3);})['catch'](function(_0x556778){logger[_0x7542('0x18')](_0x7542('0x1c'),_0x556778[_0x7542('0x1a')],_0x30b557);_0x2c0846(_0x29d8de['error'](0x1f4,_0x556778[_0x7542('0x1a')]));});});};exports[_0x7542('0x26')]=function(_0x3bea2d){var _0x39ae21=this;return new Promise(function(_0xe77532,_0x245696){return db[_0x7542('0x1d')]['create'](_0x3bea2d[_0x7542('0x27')],{'raw':_0x3bea2d['options']?_0x3bea2d[_0x7542('0x20')][_0x7542('0x1f')]===undefined?!![]:![]:!![]})[_0x7542('0x11')](function(_0x511070){logger[_0x7542('0x12')](_0x7542('0x26'),_0x3bea2d);logger[_0x7542('0x15')](_0x7542('0x26'),_0x3bea2d,JSON[_0x7542('0x17')](_0x511070));_0xe77532(_0x511070);})[_0x7542('0x28')](function(_0x3a6591){logger[_0x7542('0x18')]('CreateVoiceQueueReport',_0x3a6591[_0x7542('0x1a')],_0x3bea2d);_0x245696(_0x39ae21[_0x7542('0x18')](0x1f4,_0x3a6591[_0x7542('0x1a')]));});});};exports[_0x7542('0x29')]=function(_0x18b9b9){var _0x4163d1=this;return new Promise(function(_0x456398,_0x249b2d){return db['VoiceQueueReport']['update'](_0x18b9b9[_0x7542('0x27')],{'raw':_0x18b9b9[_0x7542('0x20')]?_0x18b9b9['options'][_0x7542('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18b9b9[_0x7542('0x20')]?_0x18b9b9[_0x7542('0x20')][_0x7542('0x2a')]||null:null,'attributes':_0x18b9b9[_0x7542('0x20')]?_0x18b9b9[_0x7542('0x20')][_0x7542('0x25')]||null:null,'limit':_0x18b9b9[_0x7542('0x20')]?_0x18b9b9['options'][_0x7542('0x21')]||null:null})[_0x7542('0x11')](function(_0x43042e){logger[_0x7542('0x12')](_0x7542('0x29'),_0x18b9b9);logger[_0x7542('0x15')]('UpdateVoiceQueueReport',_0x18b9b9,JSON[_0x7542('0x17')](_0x43042e));_0x456398(_0x43042e);})[_0x7542('0x28')](function(_0x4a4ea9){logger[_0x7542('0x18')](_0x7542('0x29'),_0x4a4ea9[_0x7542('0x1a')],_0x18b9b9);_0x249b2d(_0x4163d1[_0x7542('0x18')](0x1f4,_0x4a4ea9[_0x7542('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 4ab1b63..16a133a 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 _0xcb3a=['register','length','voiceQueueReport:','./voiceQueueReport.events','update','emit'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0xcb3a,0x1d7));var _0xacb3=function(_0x2bb69a,_0x457be3){_0x2bb69a=_0x2bb69a-0x0;var _0x226dea=_0xcb3a[_0x2bb69a];return _0x226dea;};'use strict';var VoiceQueueReportEvents=require(_0xacb3('0x0'));var events=['save','remove',_0xacb3('0x1')];function createListener(_0x5a95fb,_0xa7b083){return function(_0x1299c1){_0xa7b083[_0xacb3('0x2')](_0x5a95fb,_0x1299c1);};}function removeListener(_0x14f3e3,_0x15b71d){return function(){VoiceQueueReportEvents['removeListener'](_0x14f3e3,_0x15b71d);};}exports[_0xacb3('0x3')]=function(_0x1cf521){for(var _0xa9c481=0x0,_0x4cb19d=events[_0xacb3('0x4')];_0xa9c481<_0x4cb19d;_0xa9c481++){var _0x3c0669=events[_0xa9c481];var _0x4382cc=createListener(_0xacb3('0x5')+_0x3c0669,_0x1cf521);VoiceQueueReportEvents['on'](_0x3c0669,_0x4382cc);}}; \ No newline at end of file +var _0x4f29=['emit','removeListener','register','length','voiceQueueReport:','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f29,0xfd));var _0x94f2=function(_0x2aabc5,_0x552f4e){_0x2aabc5=_0x2aabc5-0x0;var _0x160bb6=_0x4f29[_0x2aabc5];return _0x160bb6;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x94f2('0x0'),_0x94f2('0x1'),_0x94f2('0x2')];function createListener(_0x2a6804,_0xc16ee3){return function(_0x36e06e){_0xc16ee3[_0x94f2('0x3')](_0x2a6804,_0x36e06e);};}function removeListener(_0x2a6535,_0x106798){return function(){VoiceQueueReportEvents[_0x94f2('0x4')](_0x2a6535,_0x106798);};}exports[_0x94f2('0x5')]=function(_0x493302){for(var _0x5e9216=0x0,_0xe14ba5=events[_0x94f2('0x6')];_0x5e9216<_0xe14ba5;_0x5e9216++){var _0x1d1910=events[_0x5e9216];var _0x224a93=createListener(_0x94f2('0x7')+_0x1d1910,_0x493302);VoiceQueueReportEvents['on'](_0x1d1910,_0x224a93);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index f1de1fb..37eb526 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 _0xface=['util','connect-timeout','express','Router','fs-extra','./voiceQueuesLog.controller','get','isAuthenticated','index','show','create','/:id','update','delete','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xface,0x12c));var _0xefac=function(_0x501572,_0x1baccc){_0x501572=_0x501572-0x0;var _0x1490f5=_0xface[_0x501572];return _0x1490f5;};'use strict';var multer=require('multer');var util=require(_0xefac('0x0'));var path=require('path');var timeout=require(_0xefac('0x1'));var express=require(_0xefac('0x2'));var router=express[_0xefac('0x3')]();var fs_extra=require(_0xefac('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xefac('0x5'));router[_0xefac('0x6')]('/',auth[_0xefac('0x7')](),controller[_0xefac('0x8')]);router['get']('/:id',auth[_0xefac('0x7')](),controller[_0xefac('0x9')]);router['post']('/',auth[_0xefac('0x7')](),controller[_0xefac('0xa')]);router['put'](_0xefac('0xb'),auth['isAuthenticated'](),controller[_0xefac('0xc')]);router[_0xefac('0xd')](_0xefac('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xefac('0xe')]=router; \ No newline at end of file +var _0x8ba3=['../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0xac635d,_0x2dd837){var _0x3c5d71=function(_0xd3a108){while(--_0xd3a108){_0xac635d['push'](_0xac635d['shift']());}};_0x3c5d71(++_0x2dd837);}(_0x8ba3,0x1b0));var _0x38ba=function(_0x43e788,_0x4264c1){_0x43e788=_0x43e788-0x0;var _0x4332c0=_0x8ba3[_0x43e788];return _0x4332c0;};'use strict';var multer=require('multer');var util=require(_0x38ba('0x0'));var path=require(_0x38ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x38ba('0x2'));var router=express[_0x38ba('0x3')]();var fs_extra=require(_0x38ba('0x4'));var auth=require(_0x38ba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x38ba('0x6'));var controller=require(_0x38ba('0x7'));router['get']('/',auth[_0x38ba('0x8')](),controller['index']);router[_0x38ba('0x9')](_0x38ba('0xa'),auth[_0x38ba('0x8')](),controller[_0x38ba('0xb')]);router[_0x38ba('0xc')]('/',auth['isAuthenticated'](),controller[_0x38ba('0xd')]);router[_0x38ba('0xe')](_0x38ba('0xa'),auth[_0x38ba('0x8')](),controller[_0x38ba('0xf')]);router[_0x38ba('0x10')](_0x38ba('0xa'),auth[_0x38ba('0x8')](),controller[_0x38ba('0x11')]);module[_0x38ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index ad8f368..f22354c 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 _0x164f=['moment','exports','STRING','DATE','format'];(function(_0x5a9c51,_0x3f98a7){var _0x555c6c=function(_0x498a16){while(--_0x498a16){_0x5a9c51['push'](_0x5a9c51['shift']());}};_0x555c6c(++_0x3f98a7);}(_0x164f,0x186));var _0xf164=function(_0x3b4a17,_0x4af882){_0x3b4a17=_0x3b4a17-0x0;var _0x1e02c4=_0x164f[_0x3b4a17];return _0x1e02c4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf164('0x0'));module[_0xf164('0x1')]={'time':{'type':Sequelize[_0xf164('0x2')]},'callid':{'type':Sequelize[_0xf164('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf164('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf164('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf164('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf164('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf164('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf164('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf164('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf164('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xf164('0x3')],'allowNull':![],'defaultValue':moment()[_0xf164('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x4316=['DATE','format','sequelize','moment','exports','STRING'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x4316,0x1ee));var _0x6431=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4316[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6431('0x0'));var moment=require(_0x6431('0x1'));module[_0x6431('0x2')]={'time':{'type':Sequelize[_0x6431('0x3')]},'callid':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6431('0x4')],'allowNull':![],'defaultValue':moment()[_0x6431('0x5')]('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 75752cf..621b7aa 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 _0x6a29=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','fast-json-patch','request-promise','moment','path','sox','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','error','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0x6a29,0x1a4));var _0x96a2=function(_0x199fea,_0x90c9a){_0x199fea=_0x199fea-0x0;var _0x2b3552=_0x6a29[_0x199fea];return _0x2b3552;};'use strict';var emlformat=require(_0x96a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x96a2('0x1'));var rp=require(_0x96a2('0x2'));var moment=require(_0x96a2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x96a2('0x4'));var sox=require(_0x96a2('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96a2('0x6'));var squel=require(_0x96a2('0x7'));var crypto=require(_0x96a2('0x8'));var jsforce=require(_0x96a2('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x96a2('0xa'));var querystring=require('querystring');var Papa=require(_0x96a2('0xb'));var Redis=require(_0x96a2('0xc'));var authService=require(_0x96a2('0xd'));var qs=require(_0x96a2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96a2('0xf'));var logger=require('../../config/logger')(_0x96a2('0x10'));var utils=require('../../config/utils');var config=require(_0x96a2('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3136d2,_0x193c8d){_0x193c8d=_0x193c8d||0xcc;return function(_0x29eec3){if(_0x29eec3){return _0x3136d2[_0x96a2('0x12')](_0x193c8d);}return _0x3136d2[_0x96a2('0x13')](_0x193c8d)[_0x96a2('0x14')]();};}function respondWithResult(_0x1d32c7,_0x8be002){_0x8be002=_0x8be002||0xc8;return function(_0x47c75e){if(_0x47c75e){return _0x1d32c7['status'](_0x8be002)[_0x96a2('0x15')](_0x47c75e);}};}function respondWithFilteredResult(_0x54e510,_0x5e842a){return function(_0x1702c3){if(_0x1702c3){var _0x71e8cb=typeof _0x5e842a[_0x96a2('0x16')]==='undefined'&&typeof _0x5e842a[_0x96a2('0x17')]===_0x96a2('0x18');var _0x1fa118=_0x1702c3['count'];var _0x2803a3=_0x71e8cb?0x0:_0x5e842a[_0x96a2('0x16')];var _0x5178ef=_0x71e8cb?_0x1702c3[_0x96a2('0x19')]:_0x5e842a[_0x96a2('0x16')]+_0x5e842a[_0x96a2('0x17')];var _0x1d75c0;if(_0x5178ef>=_0x1fa118){_0x5178ef=_0x1fa118;_0x1d75c0=0xc8;}else{_0x1d75c0=0xce;}_0x54e510[_0x96a2('0x13')](_0x1d75c0);return _0x54e510[_0x96a2('0x1a')](_0x96a2('0x1b'),_0x2803a3+'-'+_0x5178ef+'/'+_0x1fa118)['json'](_0x1702c3);}return null;};}function patchUpdates(_0x26aa64){return function(_0x2fa83e){try{jsonpatch['apply'](_0x2fa83e,_0x26aa64,!![]);}catch(_0x3b5c14){return BPromise[_0x96a2('0x1c')](_0x3b5c14);}return _0x2fa83e['save']();};}function saveUpdates(_0x3ce630,_0x1d0c5a){return function(_0x47f1b9){if(_0x47f1b9){return _0x47f1b9[_0x96a2('0x1d')](_0x3ce630)[_0x96a2('0x1e')](function(_0x5b49f5){return _0x5b49f5;});}return null;};}function removeEntity(_0x70c6aa,_0x4bb29c){return function(_0x4d03d5){if(_0x4d03d5){return _0x4d03d5[_0x96a2('0x1f')]()[_0x96a2('0x1e')](function(){_0x70c6aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19efcc,_0x3076b6){return function(_0x46611a){if(!_0x46611a){_0x19efcc[_0x96a2('0x12')](0x194);}return _0x46611a;};}function handleError(_0x1ef442,_0x2633b9){_0x2633b9=_0x2633b9||0x1f4;return function(_0x31fd6b){logger[_0x96a2('0x20')](_0x31fd6b['stack']);if(_0x31fd6b[_0x96a2('0x21')]){delete _0x31fd6b[_0x96a2('0x21')];}_0x1ef442[_0x96a2('0x13')](_0x2633b9)[_0x96a2('0x22')](_0x31fd6b);};}exports['index']=function(_0x3aeae4,_0x22447a){var _0x2c3984={},_0x16c383={},_0x5670eb={'count':0x0,'rows':[]};var _0x5c37f5=_[_0x96a2('0x23')](db[_0x96a2('0x24')][_0x96a2('0x25')],function(_0x203380){return{'name':_0x203380[_0x96a2('0x26')],'type':_0x203380[_0x96a2('0x27')][_0x96a2('0x28')]};});_0x16c383[_0x96a2('0x29')]=_[_0x96a2('0x23')](_0x5c37f5,_0x96a2('0x21'));_0x16c383[_0x96a2('0x2a')]=_[_0x96a2('0x2b')](_0x3aeae4[_0x96a2('0x2a')]);_0x16c383[_0x96a2('0x2c')]=_[_0x96a2('0x2d')](_0x16c383[_0x96a2('0x29')],_0x16c383[_0x96a2('0x2a')]);_0x2c3984[_0x96a2('0x2e')]=_['intersection'](_0x16c383[_0x96a2('0x29')],qs[_0x96a2('0x2f')](_0x3aeae4[_0x96a2('0x2a')][_0x96a2('0x2f')]));_0x2c3984[_0x96a2('0x2e')]=_0x2c3984['attributes'][_0x96a2('0x30')]?_0x2c3984['attributes']:_0x16c383[_0x96a2('0x29')];if(!_0x3aeae4['query'][_0x96a2('0x31')](_0x96a2('0x32'))){_0x2c3984['limit']=qs[_0x96a2('0x17')](_0x3aeae4[_0x96a2('0x2a')][_0x96a2('0x17')]);_0x2c3984[_0x96a2('0x16')]=qs[_0x96a2('0x16')](_0x3aeae4[_0x96a2('0x2a')][_0x96a2('0x16')]);}_0x2c3984['order']=qs[_0x96a2('0x33')](_0x3aeae4[_0x96a2('0x2a')][_0x96a2('0x33')]);_0x2c3984[_0x96a2('0x34')]=qs['filters'](_[_0x96a2('0x35')](_0x3aeae4[_0x96a2('0x2a')],_0x16c383[_0x96a2('0x2c')]),_0x5c37f5);if(_0x3aeae4[_0x96a2('0x2a')][_0x96a2('0x36')]){_0x2c3984['where']=_[_0x96a2('0x37')](_0x2c3984['where'],{'$or':_[_0x96a2('0x23')](_0x5c37f5,function(_0x5a3022){if(_0x5a3022[_0x96a2('0x27')]!==_0x96a2('0x38')){var _0x2e17fe={};_0x2e17fe[_0x5a3022[_0x96a2('0x21')]]={'$like':'%'+_0x3aeae4[_0x96a2('0x2a')]['filter']+'%'};return _0x2e17fe;}})});}_0x2c3984=_['merge']({},_0x2c3984,_0x3aeae4[_0x96a2('0x39')]);var _0x1d27b7={'where':_0x2c3984[_0x96a2('0x34')]};return db[_0x96a2('0x24')][_0x96a2('0x19')](_0x1d27b7)[_0x96a2('0x1e')](function(_0x203afd){_0x5670eb[_0x96a2('0x19')]=_0x203afd;if(_0x3aeae4[_0x96a2('0x2a')]['includeAll']){_0x2c3984[_0x96a2('0x3a')]=[{'all':!![]}];}return db[_0x96a2('0x24')][_0x96a2('0x3b')](_0x2c3984);})[_0x96a2('0x1e')](function(_0x5e3595){_0x5670eb[_0x96a2('0x3c')]=_0x5e3595;return _0x5670eb;})[_0x96a2('0x1e')](respondWithFilteredResult(_0x22447a,_0x2c3984))[_0x96a2('0x3d')](handleError(_0x22447a,null));};exports['show']=function(_0x1fd220,_0xe5bd22){var _0x1698d8={'raw':!![],'where':{'id':_0x1fd220[_0x96a2('0x3e')]['id']}},_0x1a4502={};_0x1a4502[_0x96a2('0x29')]=_[_0x96a2('0x2b')](db[_0x96a2('0x24')]['rawAttributes']);_0x1a4502[_0x96a2('0x2a')]=_[_0x96a2('0x2b')](_0x1fd220['query']);_0x1a4502[_0x96a2('0x2c')]=_['intersection'](_0x1a4502['model'],_0x1a4502[_0x96a2('0x2a')]);_0x1698d8['attributes']=_['intersection'](_0x1a4502[_0x96a2('0x29')],qs['fields'](_0x1fd220['query'][_0x96a2('0x2f')]));_0x1698d8[_0x96a2('0x2e')]=_0x1698d8[_0x96a2('0x2e')]['length']?_0x1698d8['attributes']:_0x1a4502[_0x96a2('0x29')];if(_0x1fd220['query'][_0x96a2('0x3f')]){_0x1698d8[_0x96a2('0x3a')]=[{'all':!![]}];}_0x1698d8=_[_0x96a2('0x37')]({},_0x1698d8,_0x1fd220[_0x96a2('0x39')]);return db[_0x96a2('0x24')][_0x96a2('0x40')](_0x1698d8)[_0x96a2('0x1e')](handleEntityNotFound(_0xe5bd22,null))[_0x96a2('0x1e')](respondWithResult(_0xe5bd22,null))['catch'](handleError(_0xe5bd22,null));};exports[_0x96a2('0x41')]=function(_0xa3ea80,_0x1cec70){return db['VoiceQueuesLog'][_0x96a2('0x41')](_0xa3ea80[_0x96a2('0x42')],{})[_0x96a2('0x1e')](respondWithResult(_0x1cec70,0xc9))[_0x96a2('0x3d')](handleError(_0x1cec70,null));};exports[_0x96a2('0x1d')]=function(_0x5f16f2,_0x1b2a5f){if(_0x5f16f2['body']['id']){delete _0x5f16f2[_0x96a2('0x42')]['id'];}return db[_0x96a2('0x24')]['find']({'where':{'id':_0x5f16f2[_0x96a2('0x3e')]['id']}})[_0x96a2('0x1e')](handleEntityNotFound(_0x1b2a5f,null))[_0x96a2('0x1e')](saveUpdates(_0x5f16f2[_0x96a2('0x42')],null))[_0x96a2('0x1e')](respondWithResult(_0x1b2a5f,null))[_0x96a2('0x3d')](handleError(_0x1b2a5f,null));};exports[_0x96a2('0x1f')]=function(_0x153f9e,_0xcae193){return db[_0x96a2('0x24')][_0x96a2('0x40')]({'where':{'id':_0x153f9e[_0x96a2('0x3e')]['id']}})[_0x96a2('0x1e')](handleEntityNotFound(_0xcae193,null))[_0x96a2('0x1e')](removeEntity(_0xcae193,null))['catch'](handleError(_0xcae193,null));}; \ No newline at end of file +var _0x8bd5=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x537f42,_0x2a15a4){var _0x466f2d=function(_0x45e072){while(--_0x45e072){_0x537f42['push'](_0x537f42['shift']());}};_0x466f2d(++_0x2a15a4);}(_0x8bd5,0xea));var _0x58bd=function(_0x59657d,_0x51226c){_0x59657d=_0x59657d-0x0;var _0xf19e2e=_0x8bd5[_0x59657d];return _0xf19e2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58bd('0x0'));var zipdir=require(_0x58bd('0x1'));var jsonpatch=require(_0x58bd('0x2'));var rp=require(_0x58bd('0x3'));var moment=require(_0x58bd('0x4'));var BPromise=require(_0x58bd('0x5'));var Mustache=require(_0x58bd('0x6'));var util=require('util');var path=require(_0x58bd('0x7'));var sox=require('sox');var csv=require(_0x58bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58bd('0x9'));var squel=require(_0x58bd('0xa'));var crypto=require('crypto');var jsforce=require(_0x58bd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x58bd('0x8'));var querystring=require(_0x58bd('0xc'));var Papa=require('papaparse');var Redis=require(_0x58bd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x58bd('0xe'));var as=require(_0x58bd('0xf'));var hardwareService=require(_0x58bd('0x10'));var logger=require('../../config/logger')(_0x58bd('0x11'));var utils=require('../../config/utils');var config=require(_0x58bd('0x12'));var licenseUtil=require(_0x58bd('0x13'));var db=require(_0x58bd('0x14'))['db'];function respondWithStatusCode(_0x510686,_0xf54e9a){_0xf54e9a=_0xf54e9a||0xcc;return function(_0xdbe09){if(_0xdbe09){return _0x510686[_0x58bd('0x15')](_0xf54e9a);}return _0x510686[_0x58bd('0x16')](_0xf54e9a)[_0x58bd('0x17')]();};}function respondWithResult(_0x594c5b,_0x4c9154){_0x4c9154=_0x4c9154||0xc8;return function(_0x461800){if(_0x461800){return _0x594c5b[_0x58bd('0x16')](_0x4c9154)[_0x58bd('0x18')](_0x461800);}};}function respondWithFilteredResult(_0x4ac677,_0x22e30f){return function(_0x31f431){if(_0x31f431){var _0xcc61e=typeof _0x22e30f['offset']===_0x58bd('0x19')&&typeof _0x22e30f[_0x58bd('0x1a')]===_0x58bd('0x19');var _0x4b5aba=_0x31f431[_0x58bd('0x1b')];var _0x363047=_0xcc61e?0x0:_0x22e30f[_0x58bd('0x1c')];var _0x1b54ca=_0xcc61e?_0x31f431['count']:_0x22e30f[_0x58bd('0x1c')]+_0x22e30f[_0x58bd('0x1a')];var _0x17ec38;if(_0x1b54ca>=_0x4b5aba){_0x1b54ca=_0x4b5aba;_0x17ec38=0xc8;}else{_0x17ec38=0xce;}_0x4ac677[_0x58bd('0x16')](_0x17ec38);return _0x4ac677[_0x58bd('0x1d')]('Content-Range',_0x363047+'-'+_0x1b54ca+'/'+_0x4b5aba)[_0x58bd('0x18')](_0x31f431);}return null;};}function patchUpdates(_0x55dc95){return function(_0x377143){try{jsonpatch[_0x58bd('0x1e')](_0x377143,_0x55dc95,!![]);}catch(_0x12821e){return BPromise[_0x58bd('0x1f')](_0x12821e);}return _0x377143[_0x58bd('0x20')]();};}function saveUpdates(_0x49996a,_0x4e7d97){return function(_0x5e2408){if(_0x5e2408){return _0x5e2408[_0x58bd('0x21')](_0x49996a)[_0x58bd('0x22')](function(_0x2ccab3){return _0x2ccab3;});}return null;};}function removeEntity(_0x380fa2,_0x1aba03){return function(_0x2f2a07){if(_0x2f2a07){return _0x2f2a07['destroy']()[_0x58bd('0x22')](function(){_0x380fa2[_0x58bd('0x16')](0xcc)[_0x58bd('0x17')]();});}};}function handleEntityNotFound(_0x396fd8,_0x5d7107){return function(_0x5b967c){if(!_0x5b967c){_0x396fd8[_0x58bd('0x15')](0x194);}return _0x5b967c;};}function handleError(_0x4382be,_0xcad31a){_0xcad31a=_0xcad31a||0x1f4;return function(_0x45b895){logger['error'](_0x45b895[_0x58bd('0x23')]);if(_0x45b895[_0x58bd('0x24')]){delete _0x45b895[_0x58bd('0x24')];}_0x4382be[_0x58bd('0x16')](_0xcad31a)[_0x58bd('0x25')](_0x45b895);};}exports['index']=function(_0x330d98,_0x2cf4ce){var _0x305e91={},_0x4aa50d={},_0x5237c1={'count':0x0,'rows':[]};var _0x2a8a06=_[_0x58bd('0x26')](db[_0x58bd('0x27')][_0x58bd('0x28')],function(_0x2cb96e){return{'name':_0x2cb96e[_0x58bd('0x29')],'type':_0x2cb96e[_0x58bd('0x2a')][_0x58bd('0x2b')]};});_0x4aa50d[_0x58bd('0x2c')]=_[_0x58bd('0x26')](_0x2a8a06,_0x58bd('0x24'));_0x4aa50d[_0x58bd('0x2d')]=_[_0x58bd('0x2e')](_0x330d98[_0x58bd('0x2d')]);_0x4aa50d[_0x58bd('0x2f')]=_[_0x58bd('0x30')](_0x4aa50d[_0x58bd('0x2c')],_0x4aa50d[_0x58bd('0x2d')]);_0x305e91[_0x58bd('0x31')]=_[_0x58bd('0x30')](_0x4aa50d['model'],qs[_0x58bd('0x32')](_0x330d98[_0x58bd('0x2d')]['fields']));_0x305e91[_0x58bd('0x31')]=_0x305e91[_0x58bd('0x31')][_0x58bd('0x33')]?_0x305e91[_0x58bd('0x31')]:_0x4aa50d[_0x58bd('0x2c')];if(!_0x330d98['query'][_0x58bd('0x34')](_0x58bd('0x35'))){_0x305e91[_0x58bd('0x1a')]=qs[_0x58bd('0x1a')](_0x330d98[_0x58bd('0x2d')][_0x58bd('0x1a')]);_0x305e91[_0x58bd('0x1c')]=qs[_0x58bd('0x1c')](_0x330d98[_0x58bd('0x2d')][_0x58bd('0x1c')]);}_0x305e91['order']=qs[_0x58bd('0x36')](_0x330d98['query'][_0x58bd('0x36')]);_0x305e91[_0x58bd('0x37')]=qs[_0x58bd('0x2f')](_[_0x58bd('0x38')](_0x330d98[_0x58bd('0x2d')],_0x4aa50d['filters']),_0x2a8a06);if(_0x330d98[_0x58bd('0x2d')][_0x58bd('0x39')]){_0x305e91[_0x58bd('0x37')]=_[_0x58bd('0x3a')](_0x305e91[_0x58bd('0x37')],{'$or':_[_0x58bd('0x26')](_0x2a8a06,function(_0x47d602){if(_0x47d602[_0x58bd('0x2a')]!==_0x58bd('0x3b')){var _0x483c31={};_0x483c31[_0x47d602[_0x58bd('0x24')]]={'$like':'%'+_0x330d98['query'][_0x58bd('0x39')]+'%'};return _0x483c31;}})});}_0x305e91=_[_0x58bd('0x3a')]({},_0x305e91,_0x330d98['options']);var _0x2f0f97={'where':_0x305e91[_0x58bd('0x37')]};return db[_0x58bd('0x27')][_0x58bd('0x1b')](_0x2f0f97)[_0x58bd('0x22')](function(_0x1a6a00){_0x5237c1['count']=_0x1a6a00;if(_0x330d98['query'][_0x58bd('0x3c')]){_0x305e91['include']=[{'all':!![]}];}return db[_0x58bd('0x27')][_0x58bd('0x3d')](_0x305e91);})[_0x58bd('0x22')](function(_0x1dc220){_0x5237c1[_0x58bd('0x3e')]=_0x1dc220;return _0x5237c1;})[_0x58bd('0x22')](respondWithFilteredResult(_0x2cf4ce,_0x305e91))[_0x58bd('0x3f')](handleError(_0x2cf4ce,null));};exports['show']=function(_0x385811,_0x2c255b){var _0x40b889={'raw':!![],'where':{'id':_0x385811[_0x58bd('0x40')]['id']}},_0x15cb0c={};_0x15cb0c[_0x58bd('0x2c')]=_['keys'](db[_0x58bd('0x27')][_0x58bd('0x28')]);_0x15cb0c['query']=_[_0x58bd('0x2e')](_0x385811[_0x58bd('0x2d')]);_0x15cb0c[_0x58bd('0x2f')]=_[_0x58bd('0x30')](_0x15cb0c[_0x58bd('0x2c')],_0x15cb0c[_0x58bd('0x2d')]);_0x40b889[_0x58bd('0x31')]=_[_0x58bd('0x30')](_0x15cb0c[_0x58bd('0x2c')],qs['fields'](_0x385811['query'][_0x58bd('0x32')]));_0x40b889[_0x58bd('0x31')]=_0x40b889[_0x58bd('0x31')][_0x58bd('0x33')]?_0x40b889[_0x58bd('0x31')]:_0x15cb0c['model'];if(_0x385811['query'][_0x58bd('0x3c')]){_0x40b889[_0x58bd('0x41')]=[{'all':!![]}];}_0x40b889=_[_0x58bd('0x3a')]({},_0x40b889,_0x385811[_0x58bd('0x42')]);return db['VoiceQueuesLog'][_0x58bd('0x43')](_0x40b889)[_0x58bd('0x22')](handleEntityNotFound(_0x2c255b,null))[_0x58bd('0x22')](respondWithResult(_0x2c255b,null))[_0x58bd('0x3f')](handleError(_0x2c255b,null));};exports[_0x58bd('0x44')]=function(_0x485193,_0x1b381a){return db['VoiceQueuesLog']['create'](_0x485193[_0x58bd('0x45')],{})[_0x58bd('0x22')](respondWithResult(_0x1b381a,0xc9))[_0x58bd('0x3f')](handleError(_0x1b381a,null));};exports['update']=function(_0x123f3c,_0x1498a1){if(_0x123f3c['body']['id']){delete _0x123f3c['body']['id'];}return db[_0x58bd('0x27')]['find']({'where':{'id':_0x123f3c[_0x58bd('0x40')]['id']}})[_0x58bd('0x22')](handleEntityNotFound(_0x1498a1,null))['then'](saveUpdates(_0x123f3c[_0x58bd('0x45')],null))[_0x58bd('0x22')](respondWithResult(_0x1498a1,null))[_0x58bd('0x3f')](handleError(_0x1498a1,null));};exports[_0x58bd('0x46')]=function(_0x15c85b,_0x1bc029){return db[_0x58bd('0x27')][_0x58bd('0x43')]({'where':{'id':_0x15c85b[_0x58bd('0x40')]['id']}})[_0x58bd('0x22')](handleEntityNotFound(_0x1bc029,null))[_0x58bd('0x22')](removeEntity(_0x1bc029,null))[_0x58bd('0x3f')](handleError(_0x1bc029,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c699689..d728a2f 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 _0x8ff5=['path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x58557d,_0x53da2e){var _0x3c6034=function(_0x3931f8){while(--_0x3931f8){_0x58557d['push'](_0x58557d['shift']());}};_0x3c6034(++_0x53da2e);}(_0x8ff5,0x78));var _0x58ff=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x8ff5[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x58ff('0x0'));var util=require(_0x58ff('0x1'));var logger=require(_0x58ff('0x2'))(_0x58ff('0x3'));var moment=require(_0x58ff('0x4'));var BPromise=require(_0x58ff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58ff('0x6'));var rimraf=require(_0x58ff('0x7'));var config=require('../../config/environment');var attributes=require(_0x58ff('0x8'));module[_0x58ff('0x9')]=function(_0x52ff98,_0x425959){return _0x52ff98[_0x58ff('0xa')](_0x58ff('0xb'),attributes,{'tableName':_0x58ff('0xc'),'paranoid':![],'indexes':[{'name':_0x58ff('0xd'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x8b9d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','event_dtm','event','dtm'];(function(_0x3a9569,_0x17f5a5){var _0x104532=function(_0x2de986){while(--_0x2de986){_0x3a9569['push'](_0x3a9569['shift']());}};_0x104532(++_0x17f5a5);}(_0x8b9d,0x1ee));var _0xd8b9=function(_0xcfcdcb,_0x335750){_0xcfcdcb=_0xcfcdcb-0x0;var _0x55b9da=_0x8b9d[_0xcfcdcb];return _0x55b9da;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd8b9('0x0'))(_0xd8b9('0x1'));var moment=require(_0xd8b9('0x2'));var BPromise=require(_0xd8b9('0x3'));var rp=require(_0xd8b9('0x4'));var fs=require('fs');var path=require(_0xd8b9('0x5'));var rimraf=require(_0xd8b9('0x6'));var config=require(_0xd8b9('0x7'));var attributes=require(_0xd8b9('0x8'));module['exports']=function(_0x99cfe7,_0x45335b){return _0x99cfe7['define'](_0xd8b9('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xd8b9('0xa'),'fields':[_0xd8b9('0xb'),_0xd8b9('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a531964..dc32aa2 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 _0xb49e=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb49e,0x84));var _0xeb49=function(_0x492532,_0x5aedd2){_0x492532=_0x492532-0x0;var _0x258d3d=_0xb49e[_0x492532];return _0x258d3d;};'use strict';var _=require(_0xeb49('0x0'));var util=require(_0xeb49('0x1'));var moment=require(_0xeb49('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb49('0x3'));var fs=require('fs');var Redis=require(_0xeb49('0x4'));var db=require(_0xeb49('0x5'))['db'];var utils=require(_0xeb49('0x6'));var logger=require(_0xeb49('0x7'))(_0xeb49('0x8'));var config=require(_0xeb49('0x9'));var jayson=require(_0xeb49('0xa'));var client=jayson[_0xeb49('0xb')][_0xeb49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a6e30,_0x366b45,_0x12973c){return new BPromise(function(_0x331ea9,_0x4c66a0){return client[_0xeb49('0xd')](_0x1a6e30,_0x12973c)[_0xeb49('0xe')](function(_0x120b5f){logger[_0xeb49('0xf')](_0xeb49('0x10'),_0x366b45,_0xeb49('0x11'));logger[_0xeb49('0x12')](_0xeb49('0x13'),_0x366b45,_0xeb49('0x11'),JSON[_0xeb49('0x14')](_0x120b5f));if(_0x120b5f[_0xeb49('0x15')]){if(_0x120b5f[_0xeb49('0x15')][_0xeb49('0x16')]===0x1f4){logger[_0xeb49('0x15')](_0xeb49('0x10'),_0x366b45,_0x120b5f[_0xeb49('0x15')][_0xeb49('0x17')]);return _0x4c66a0(_0x120b5f['error'][_0xeb49('0x17')]);}logger[_0xeb49('0x15')]('VoiceQueuesLog,\x20%s,\x20%s',_0x366b45,_0x120b5f['error'][_0xeb49('0x17')]);return _0x331ea9(_0x120b5f[_0xeb49('0x15')][_0xeb49('0x17')]);}else{logger[_0xeb49('0xf')](_0xeb49('0x10'),_0x366b45,_0xeb49('0x11'));_0x331ea9(_0x120b5f[_0xeb49('0x18')]['message']);}})[_0xeb49('0x19')](function(_0x1ea69f){logger[_0xeb49('0x15')]('VoiceQueuesLog,\x20%s,\x20%s',_0x366b45,_0x1ea69f);_0x4c66a0(_0x1ea69f);});});} \ No newline at end of file +var _0x5262=['rpc','../../config/environment','jayson/promise','client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2fbaf5,_0x18f3f1){var _0x3596a3=function(_0x2e1d47){while(--_0x2e1d47){_0x2fbaf5['push'](_0x2fbaf5['shift']());}};_0x3596a3(++_0x18f3f1);}(_0x5262,0xc2));var _0x2526=function(_0x24edaf,_0x4b8020){_0x24edaf=_0x24edaf-0x0;var _0x1a3bf8=_0x5262[_0x24edaf];return _0x1a3bf8;};'use strict';var _=require(_0x2526('0x0'));var util=require(_0x2526('0x1'));var moment=require(_0x2526('0x2'));var BPromise=require(_0x2526('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2526('0x4'));var db=require(_0x2526('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2526('0x6'));var config=require(_0x2526('0x7'));var jayson=require(_0x2526('0x8'));var client=jayson[_0x2526('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd090c2,_0x3f9c89,_0xba0c8f){return new BPromise(function(_0x46c5c4,_0x246b29){return client['request'](_0xd090c2,_0xba0c8f)[_0x2526('0xa')](function(_0x58dbbf){logger[_0x2526('0xb')](_0x2526('0xc'),_0x3f9c89,_0x2526('0xd'));logger[_0x2526('0xe')](_0x2526('0xf'),_0x3f9c89,_0x2526('0xd'),JSON[_0x2526('0x10')](_0x58dbbf));if(_0x58dbbf['error']){if(_0x58dbbf[_0x2526('0x11')][_0x2526('0x12')]===0x1f4){logger[_0x2526('0x11')](_0x2526('0xc'),_0x3f9c89,_0x58dbbf[_0x2526('0x11')][_0x2526('0x13')]);return _0x246b29(_0x58dbbf['error']['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3f9c89,_0x58dbbf[_0x2526('0x11')][_0x2526('0x13')]);return _0x46c5c4(_0x58dbbf[_0x2526('0x11')][_0x2526('0x13')]);}else{logger[_0x2526('0xb')](_0x2526('0xc'),_0x3f9c89,_0x2526('0xd'));_0x46c5c4(_0x58dbbf['result']['message']);}})['catch'](function(_0x21353f){logger[_0x2526('0x11')](_0x2526('0xc'),_0x3f9c89,_0x21353f);_0x246b29(_0x21353f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 9654738..0bc5b73 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 _0xb6c8=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','isAuthenticated','describe','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','multer','path'];(function(_0x3cb391,_0x471df5){var _0x50fabf=function(_0x5e93d2){while(--_0x5e93d2){_0x3cb391['push'](_0x3cb391['shift']());}};_0x50fabf(++_0x471df5);}(_0xb6c8,0x6a));var _0x8b6c=function(_0x101c99,_0x27a8ed){_0x101c99=_0x101c99-0x0;var _0x250a4e=_0xb6c8[_0x101c99];return _0x250a4e;};'use strict';var multer=require(_0x8b6c('0x0'));var util=require('util');var path=require(_0x8b6c('0x1'));var timeout=require(_0x8b6c('0x2'));var express=require(_0x8b6c('0x3'));var router=express[_0x8b6c('0x4')]();var fs_extra=require(_0x8b6c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b6c('0x6'));var config=require(_0x8b6c('0x7'));var controller=require(_0x8b6c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b6c('0x9')]);router[_0x8b6c('0xa')]('/describe',auth[_0x8b6c('0xb')](),controller[_0x8b6c('0xc')]);router[_0x8b6c('0xa')]('/:id',auth[_0x8b6c('0xb')](),controller[_0x8b6c('0xd')]);router[_0x8b6c('0xa')](_0x8b6c('0xe'),auth[_0x8b6c('0xb')](),controller['download']);router[_0x8b6c('0xa')](_0x8b6c('0xf'),controller[_0x8b6c('0x10')]);router[_0x8b6c('0xa')](_0x8b6c('0x11'),auth[_0x8b6c('0xb')](),controller[_0x8b6c('0x12')]);router[_0x8b6c('0x13')]('/',auth['isAuthenticated'](),controller[_0x8b6c('0x14')]);router['post']('/:id/transcribe',auth[_0x8b6c('0xb')](),controller[_0x8b6c('0x15')]);router[_0x8b6c('0x16')](_0x8b6c('0x17'),auth['isAuthenticated'](),controller[_0x8b6c('0x18')]);router[_0x8b6c('0x19')](_0x8b6c('0x17'),auth[_0x8b6c('0xb')](),controller[_0x8b6c('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x93d7=['describe','/:id','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe'];(function(_0x58836a,_0x2fd615){var _0x5ac6ab=function(_0x479298){while(--_0x479298){_0x58836a['push'](_0x58836a['shift']());}};_0x5ac6ab(++_0x2fd615);}(_0x93d7,0x153));var _0x793d=function(_0x5c1b79,_0x201f89){_0x5c1b79=_0x5c1b79-0x0;var _0x2ba6c1=_0x93d7[_0x5c1b79];return _0x2ba6c1;};'use strict';var multer=require('multer');var util=require(_0x793d('0x0'));var path=require(_0x793d('0x1'));var timeout=require(_0x793d('0x2'));var express=require(_0x793d('0x3'));var router=express[_0x793d('0x4')]();var fs_extra=require(_0x793d('0x5'));var auth=require(_0x793d('0x6'));var interaction=require(_0x793d('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x793d('0x8')]('/',auth[_0x793d('0x9')](),controller['index']);router[_0x793d('0x8')](_0x793d('0xa'),auth['isAuthenticated'](),controller[_0x793d('0xb')]);router[_0x793d('0x8')](_0x793d('0xc'),auth[_0x793d('0x9')](),controller['show']);router[_0x793d('0x8')](_0x793d('0xd'),auth[_0x793d('0x9')](),controller[_0x793d('0xe')]);router[_0x793d('0x8')](_0x793d('0xf'),controller['downloads']);router[_0x793d('0x8')](_0x793d('0x10'),auth[_0x793d('0x9')](),controller[_0x793d('0x11')]);router[_0x793d('0x12')]('/',auth['isAuthenticated'](),controller[_0x793d('0x13')]);router[_0x793d('0x12')]('/:id/transcribe',auth[_0x793d('0x9')](),controller[_0x793d('0x14')]);router[_0x793d('0x15')](_0x793d('0xc'),auth['isAuthenticated'](),controller[_0x793d('0x16')]);router[_0x793d('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x793d('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 6c6af90..98adfa3 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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 adcbf00..05bb139 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 _0x008d=['index','map','VoiceRecording','rawAttributes','fieldName','type','model','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','include','rows','catch','params','length','create','body','describe','download','../../components/encryptor','uniqueid','find','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','destroy','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','startTranscriptionJob','basename','readFileSync','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','stack','name','send'];(function(_0x583ca0,_0x22a723){var _0x57f884=function(_0x185844){while(--_0x185844){_0x583ca0['push'](_0x583ca0['shift']());}};_0x57f884(++_0x22a723);}(_0x008d,0x6b));var _0xd008=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x008d[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xd008('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd008('0x1'));var jsonpatch=require(_0xd008('0x2'));var rp=require(_0xd008('0x3'));var moment=require(_0xd008('0x4'));var BPromise=require(_0xd008('0x5'));var Mustache=require(_0xd008('0x6'));var util=require('util');var path=require(_0xd008('0x7'));var sox=require(_0xd008('0x8'));var csv=require(_0xd008('0x9'));var ejs=require(_0xd008('0xa'));var fs=require('fs');var fs_extra=require(_0xd008('0xb'));var _=require(_0xd008('0xc'));var squel=require(_0xd008('0xd'));var crypto=require(_0xd008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd008('0xf'));var toCsv=require(_0xd008('0x9'));var querystring=require(_0xd008('0x10'));var Papa=require(_0xd008('0x11'));var AWS=require('aws-sdk');var uuidv4=require(_0xd008('0x12'));var Redis=require(_0xd008('0x13'));var authService=require(_0xd008('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd008('0x15'));var hardwareService=require(_0xd008('0x16'));var logger=require(_0xd008('0x17'))(_0xd008('0x18'));var utils=require('../../config/utils');var config=require(_0xd008('0x19'));var licenseUtil=require(_0xd008('0x1a'));var db=require(_0xd008('0x1b'))['db'];function respondWithStatusCode(_0xb501bc,_0x112740){_0x112740=_0x112740||0xcc;return function(_0x5aa2a1){if(_0x5aa2a1){return _0xb501bc[_0xd008('0x1c')](_0x112740);}return _0xb501bc['status'](_0x112740)[_0xd008('0x1d')]();};}function respondWithResult(_0x3cbbf0,_0x3785b5){_0x3785b5=_0x3785b5||0xc8;return function(_0x13b270){if(_0x13b270){return _0x3cbbf0[_0xd008('0x1e')](_0x3785b5)[_0xd008('0x1f')](_0x13b270);}};}function respondWithFilteredResult(_0x353e48,_0x27d58e){return function(_0x38ef74){if(_0x38ef74){var _0x2674d3=typeof _0x27d58e['offset']===_0xd008('0x20')&&typeof _0x27d58e[_0xd008('0x21')]===_0xd008('0x20');var _0x3ede9e=_0x38ef74[_0xd008('0x22')];var _0x669c5=_0x2674d3?0x0:_0x27d58e[_0xd008('0x23')];var _0x570996=_0x2674d3?_0x38ef74['count']:_0x27d58e[_0xd008('0x23')]+_0x27d58e[_0xd008('0x21')];var _0x555437;if(_0x570996>=_0x3ede9e){_0x570996=_0x3ede9e;_0x555437=0xc8;}else{_0x555437=0xce;}_0x353e48[_0xd008('0x1e')](_0x555437);return _0x353e48['set'](_0xd008('0x24'),_0x669c5+'-'+_0x570996+'/'+_0x3ede9e)[_0xd008('0x1f')](_0x38ef74);}return null;};}function patchUpdates(_0x5ed83b){return function(_0x298453){try{jsonpatch['apply'](_0x298453,_0x5ed83b,!![]);}catch(_0x44f3f7){return BPromise[_0xd008('0x25')](_0x44f3f7);}return _0x298453[_0xd008('0x26')]();};}function saveUpdates(_0x3b67f6,_0x179df5){return function(_0x5d8046){if(_0x5d8046){return _0x5d8046[_0xd008('0x27')](_0x3b67f6)[_0xd008('0x28')](function(_0x140bce){return _0x140bce;});}return null;};}function removeEntity(_0x4ec645,_0x345f5e){return function(_0x19c77e){if(_0x19c77e){return _0x19c77e['destroy']()[_0xd008('0x28')](function(){_0x4ec645[_0xd008('0x1e')](0xcc)[_0xd008('0x1d')]();});}};}function handleEntityNotFound(_0x38dafd,_0x56a0b){return function(_0x3fad34){if(!_0x3fad34){_0x38dafd[_0xd008('0x1c')](0x194);}return _0x3fad34;};}function handleError(_0x44c4ce,_0x5d7a3f){_0x5d7a3f=_0x5d7a3f||0x1f4;return function(_0x1c9add){logger['error'](_0x1c9add[_0xd008('0x29')]);if(_0x1c9add[_0xd008('0x2a')]){delete _0x1c9add[_0xd008('0x2a')];}_0x44c4ce[_0xd008('0x1e')](_0x5d7a3f)[_0xd008('0x2b')](_0x1c9add);};}exports[_0xd008('0x2c')]=function(_0x2b8b60,_0x17224c){var _0x3f7620={},_0x39947c={},_0x178ef2={'count':0x0,'rows':[]};var _0x5946b0=_[_0xd008('0x2d')](db[_0xd008('0x2e')][_0xd008('0x2f')],function(_0x58dac1){return{'name':_0x58dac1[_0xd008('0x30')],'type':_0x58dac1[_0xd008('0x31')]['key']};});_0x39947c[_0xd008('0x32')]=_['differenceBy'](_['map'](_0x5946b0,_0xd008('0x2a')),[_0xd008('0x33')]);_0x39947c[_0xd008('0x34')]=_[_0xd008('0x35')](_0x2b8b60[_0xd008('0x34')]);_0x39947c['filters']=_[_0xd008('0x36')](_0x39947c[_0xd008('0x32')],_0x39947c[_0xd008('0x34')]);_0x3f7620[_0xd008('0x37')]=_[_0xd008('0x36')](_0x39947c[_0xd008('0x32')],qs[_0xd008('0x38')](_0x2b8b60[_0xd008('0x34')][_0xd008('0x38')]));_0x3f7620[_0xd008('0x37')]=_0x3f7620[_0xd008('0x37')]['length']?_0x3f7620[_0xd008('0x37')]:_0x39947c[_0xd008('0x32')];if(!_0x2b8b60['query'][_0xd008('0x39')](_0xd008('0x3a'))){_0x3f7620[_0xd008('0x21')]=qs['limit'](_0x2b8b60[_0xd008('0x34')][_0xd008('0x21')]);_0x3f7620[_0xd008('0x23')]=qs[_0xd008('0x23')](_0x2b8b60[_0xd008('0x34')]['offset']);}_0x3f7620[_0xd008('0x3b')]=qs[_0xd008('0x3c')](_0x2b8b60[_0xd008('0x34')]['sort']);_0x3f7620[_0xd008('0x3d')]=qs[_0xd008('0x3e')](_[_0xd008('0x3f')](_0x2b8b60[_0xd008('0x34')],_0x39947c['filters']),_0x5946b0);if(_0x2b8b60[_0xd008('0x34')]['filter']){_0x3f7620['where']=_[_0xd008('0x40')](_0x3f7620[_0xd008('0x3d')],{'$or':_[_0xd008('0x2d')](_0x5946b0,function(_0x1b1895){if(_0x1b1895[_0xd008('0x31')]!=='VIRTUAL'){var _0x3779fe={};_0x3779fe[_0x1b1895[_0xd008('0x2a')]]={'$like':'%'+_0x2b8b60['query'][_0xd008('0x41')]+'%'};return _0x3779fe;}})});}_0x3f7620=_[_0xd008('0x40')]({},_0x3f7620,_0x2b8b60[_0xd008('0x42')]);var _0x221317={'where':_0x3f7620[_0xd008('0x3d')]};return db['VoiceRecording']['count'](_0x221317)[_0xd008('0x28')](function(_0x5dc3d3){_0x178ef2[_0xd008('0x22')]=_0x5dc3d3;if(_0x2b8b60['query']['includeAll']){_0x3f7620[_0xd008('0x43')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x3f7620);})['then'](function(_0x59b24c){_0x178ef2[_0xd008('0x44')]=_0x59b24c;return _0x178ef2;})['then'](respondWithFilteredResult(_0x17224c,_0x3f7620))[_0xd008('0x45')](handleError(_0x17224c,null));};exports['show']=function(_0x484abf,_0x354471){var _0xe95a85={'raw':![],'where':{'id':_0x484abf[_0xd008('0x46')]['id']}},_0x26dd95={};_0x26dd95[_0xd008('0x32')]=_[_0xd008('0x35')](db[_0xd008('0x2e')][_0xd008('0x2f')]);_0x26dd95[_0xd008('0x34')]=_[_0xd008('0x35')](_0x484abf['query']);_0x26dd95[_0xd008('0x3e')]=_[_0xd008('0x36')](_0x26dd95[_0xd008('0x32')],_0x26dd95['query']);_0xe95a85[_0xd008('0x37')]=_[_0xd008('0x36')](_0x26dd95['model'],qs['fields'](_0x484abf[_0xd008('0x34')]['fields']));_0xe95a85[_0xd008('0x37')]=_0xe95a85[_0xd008('0x37')][_0xd008('0x47')]?_0xe95a85[_0xd008('0x37')]:_0x26dd95[_0xd008('0x32')];if(_0x484abf['query']['includeAll']){_0xe95a85[_0xd008('0x43')]=[{'all':!![]}];}_0xe95a85=_['merge']({},_0xe95a85,_0x484abf[_0xd008('0x42')]);return db[_0xd008('0x2e')]['find'](_0xe95a85)[_0xd008('0x28')](handleEntityNotFound(_0x354471,null))[_0xd008('0x28')](respondWithResult(_0x354471,null))[_0xd008('0x45')](handleError(_0x354471,null));};exports[_0xd008('0x48')]=function(_0x5c1929,_0x5a7791){return db[_0xd008('0x2e')][_0xd008('0x48')](_0x5c1929[_0xd008('0x49')],{})['then'](respondWithResult(_0x5a7791,0xc9))['catch'](handleError(_0x5a7791,null));};exports['update']=function(_0x41362c,_0x2d1c48){if(_0x41362c['body']['id']){delete _0x41362c['body']['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x41362c[_0xd008('0x46')]['id']}})[_0xd008('0x28')](handleEntityNotFound(_0x2d1c48,null))[_0xd008('0x28')](saveUpdates(_0x41362c[_0xd008('0x49')],null))[_0xd008('0x28')](respondWithResult(_0x2d1c48,null))['catch'](handleError(_0x2d1c48,null));};exports[_0xd008('0x4a')]=function(_0x5e8a2d,_0x4a3dc2){return db['VoiceRecording'][_0xd008('0x4a')]()[_0xd008('0x28')](respondWithResult(_0x4a3dc2,null))['catch'](handleError(_0x4a3dc2,null));};exports[_0xd008('0x4b')]=function(_0x4fe00a,_0x3b1ab0,_0x6f2df9){var _0x531cce=require(_0xd008('0x4c'));var _0x224946=![];var _0x54df52={};if(_0x4fe00a['query']['type']&&_0x4fe00a[_0xd008('0x34')][_0xd008('0x31')]===_0xd008('0x4d')){_0x54df52[_0xd008('0x4d')]=_0x4fe00a[_0xd008('0x46')]['id'];}else{_0x54df52['id']=_0x4fe00a[_0xd008('0x46')]['id'];}return db[_0xd008('0x2e')][_0xd008('0x4e')]({'where':_0x54df52,'attributes':['id',_0xd008('0x4f')],'raw':!![]})[_0xd008('0x28')](handleEntityNotFound(_0x3b1ab0,null))[_0xd008('0x28')](function(_0x1024d7){if(_0x1024d7){var _0x4fada4=_0x1024d7['value'];var _0x2da8d0=util['format'](_0xd008('0x50'),_0x4fada4);if(fs[_0xd008('0x51')](_0x2da8d0)){_0x224946=!![];return _0x531cce[_0xd008('0x52')](_0x2da8d0,_0x4fada4,config[_0xd008('0x53')][_0xd008('0x54')])['then'](function(){return _0x1024d7;});}return _0x1024d7;}})[_0xd008('0x28')](function(_0x1e81f9){if(_0x1e81f9){var _0x75714=_0x1e81f9['value'];if(!fs['existsSync'](_0x75714)){throw new db[(_0xd008('0x55'))]['ValidationError'](_0xd008('0x56'));}if(_0x1e81f9[_0xd008('0x57')]){return _0x3b1ab0[_0xd008('0x4b')](_0x75714,_0x1e81f9['filename']+path[_0xd008('0x58')](_0x75714),function(){if(_0x224946){fs[_0xd008('0x59')](_0x75714);}});}else{return _0x3b1ab0[_0xd008('0x4b')](_0x75714,function(_0x5e6df3){if(_0x224946){fs['unlink'](_0x75714);}});}}})[_0xd008('0x45')](function(_0x2cac5f){if(_0x2cac5f[_0xd008('0x5a')]===_0xd008('0x56')){_0x3b1ab0[_0xd008('0x1e')](0x194)[_0xd008('0x2b')](_0xd008('0x5b'));}else{return handleError(_0x3b1ab0,null);}});};exports[_0xd008('0x5c')]=function(_0xe7b676,_0x57c342,_0x302ad3){var _0x6eef7d=require('../../components/encryptor');var _0x545127=![];var _0x1521e4={'$and':[db[_0xd008('0x5d')][_0xd008('0x3d')](db['sequelize']['fn'](_0xd008('0x5e'),db['sequelize'][_0xd008('0x5f')](_0xd008('0x4d'))),_0xe7b676['query']['token'])]};if(_0xe7b676[_0xd008('0x34')][_0xd008('0x31')]&&_0xe7b676['query']['type']===_0xd008('0x4d')){_0x1521e4[_0xd008('0x60')][_0xd008('0x61')]({'uniqueid':_0xe7b676[_0xd008('0x46')]['id']});}else{_0x1521e4[_0xd008('0x60')][_0xd008('0x61')]({'id':_0xe7b676[_0xd008('0x46')]['id']});}return db[_0xd008('0x2e')][_0xd008('0x4e')]({'where':_0x1521e4,'attributes':['id',_0xd008('0x4f')],'raw':!![]})[_0xd008('0x28')](handleEntityNotFound(_0x57c342,null))[_0xd008('0x28')](function(_0x1585c7){if(_0x1585c7){var _0x36c2b9=util[_0xd008('0x33')](_0xd008('0x50'),_0x1585c7[_0xd008('0x4f')]);if(fs[_0xd008('0x51')](_0x36c2b9)){_0x545127=!![];return _0x6eef7d['decryptFile'](_0x36c2b9,_0x1585c7[_0xd008('0x4f')],config[_0xd008('0x53')]['recording'])['then'](function(){return _0x1585c7;});}return _0x1585c7;}})[_0xd008('0x28')](function(_0x24003d){if(_0x24003d){if(!fs[_0xd008('0x51')](_0x24003d[_0xd008('0x4f')])){throw new db[(_0xd008('0x55'))]['ValidationError'](_0xd008('0x56'));}if(_0x24003d[_0xd008('0x57')]){return _0x57c342['download'](_0x24003d[_0xd008('0x4f')],_0x24003d[_0xd008('0x57')]+path[_0xd008('0x58')](_0x24003d['value']),function(){if(_0x545127){fs['unlink'](_0x24003d[_0xd008('0x4f')]);}});}else{return _0x57c342[_0xd008('0x4b')](_0x24003d[_0xd008('0x4f')],function(_0x5a13ff){if(_0x545127){fs[_0xd008('0x59')](_0x24003d[_0xd008('0x4f')]);}});}}})['catch'](handleError(_0x57c342,null));};exports[_0xd008('0x62')]=function(_0x465eb4,_0x2da2a8){return db[_0xd008('0x2e')][_0xd008('0x4e')]({'where':{'id':_0x465eb4[_0xd008('0x46')]['id']}})[_0xd008('0x28')](function(_0x3ba6f1){if(_[_0xd008('0x63')](_0x3ba6f1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3ba6f1;})[_0xd008('0x28')](function(_0x346615){var _0x74809d=_0x346615[_0xd008('0x4f')];logger[_0xd008('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x74809d);if(!_[_0xd008('0x63')](_0x346615[_0xd008('0x4f')])&&fs[_0xd008('0x51')](_0x74809d)){logger['info'](_0xd008('0x65')+_0x74809d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd008('0x66')](_0x74809d);}_0x74809d=_0x74809d+_0xd008('0x67');if(!_[_0xd008('0x63')](_0x346615[_0xd008('0x4f')])&&fs[_0xd008('0x51')](_0x74809d)){logger['info']('File:\x20\x22'+_0x74809d+_0xd008('0x68'));fs[_0xd008('0x66')](_0x74809d);}return _0x346615;})[_0xd008('0x28')](function(_0x550329){if(!_0x550329)throw new InternalError();return _0x550329['destroy']();})[_0xd008('0x28')](function(){_0x2da2a8['status'](0xcc)[_0xd008('0x1d')]();})['catch'](handleError(_0x2da2a8,null));};function getBucketslist(_0x2b7f0f,_0xd3945c,_0x21bf00){return new Promise(function(_0x34f4ee,_0x237032){var _0x1386a9=new AWS['S3']({'accessKeyId':_0xd3945c,'secretAccessKey':_0x2b7f0f,'region':_0x21bf00});_0x1386a9[_0xd008('0x69')]({},function(_0x11a9af,_0x15b3ed){if(_0x11a9af){return _0x237032(_0x11a9af);}else{return _0x34f4ee(_0x15b3ed);}});});}function createBucket(_0x3dae39,_0x55d717,_0x324606,_0x39ebe6){return new Promise(function(_0x5e86c6,_0x42dae9){var _0x1db69d=new AWS['S3']({'accessKeyId':_0x55d717,'secretAccessKey':_0x3dae39,'region':_0x324606});_0x1db69d[_0xd008('0x6a')]({'Bucket':_0x39ebe6},function(_0x51b1a4,_0x5a545b){if(_0x51b1a4){return _0x42dae9(_0x51b1a4);}else{return _0x5e86c6(_0x5a545b);}});});}function uploadFile(_0x5062f2,_0x42d10c,_0x141e3e,_0x2f4db3,_0x195d02,_0x1088c9){return new Promise(function(_0x563e60,_0x5768b3){var _0x12c456=new AWS['S3']({'accessKeyId':_0x42d10c,'secretAccessKey':_0x5062f2,'region':_0x141e3e});_0x12c456['upload']({'Bucket':_0x2f4db3,'Key':_0x195d02,'Body':_0x1088c9},function(_0x2d82c0,_0x1bb6b5){if(_0x2d82c0){return _0x5768b3(_0x2d82c0);}else{return _0x563e60(_0x1bb6b5);}});});}function startTranscribe(_0xd2296e,_0x27e656,_0x1355d4,_0x37c287,_0xb6e21,_0xb2a881){return new Promise(function(_0xd2e63,_0x3590d2){var _0x57cdf1=new AWS['TranscribeService']({'accessKeyId':_0x27e656,'secretAccessKey':_0xd2296e,'region':_0x1355d4});_0x57cdf1[_0xd008('0x6b')]({'TranscriptionJobName':_0x37c287,'LanguageCode':_0xb6e21,'Media':{'MediaFileUri':_0xb2a881}},function(_0x37396a,_0x3b4efe){if(_0x37396a){return _0x3590d2(_0x37396a);}else{return _0xd2e63(_0x3b4efe);}});});}function transcribe(_0x16d689,_0x1dfee0,_0x2ab64c,_0x5c1e8f,_0x8433ca,_0x2b83c7,_0x300fd9){return new Promise(function(_0x51880a,_0x4e79c8){var _0x400adb={};logger[_0xd008('0x64')](util[_0xd008('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x16d689,_0x8433ca));return uploadFile(_0x1dfee0,_0x2ab64c,_0x5c1e8f,_0x8433ca,path[_0xd008('0x6c')](_0x2b83c7),fs[_0xd008('0x6d')](_0x2b83c7))['then'](function(_0x18da05){logger[_0xd008('0x64')](util[_0xd008('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x16d689,_0x8433ca,_0x18da05['Location']));_0x400adb[_0xd008('0x6e')]=_0x18da05[_0xd008('0x6f')];_0x400adb[_0xd008('0x70')]=_0x18da05[_0xd008('0x71')];logger['info'](util[_0xd008('0x33')](_0xd008('0x72'),_0x16d689));return startTranscribe(_0x1dfee0,_0x2ab64c,_0x5c1e8f,uuidv4(),_0x300fd9,_0x18da05[_0xd008('0x71')]);})[_0xd008('0x28')](function(_0x1f7176){logger[_0xd008('0x64')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x16d689,_0x1f7176[_0xd008('0x73')][_0xd008('0x74')]));_0x400adb[_0xd008('0x75')]=_0x1f7176['TranscriptionJob']['TranscriptionJobName'];_0x400adb[_0xd008('0x76')]=_0x1f7176[_0xd008('0x73')][_0xd008('0x77')];return _0x51880a(_0x400adb);})[_0xd008('0x45')](function(_0x57ae7e){return _0x4e79c8(_0x57ae7e);});});}exports['runTranscribe']=function(_0x10ed0b,_0x54bc59,_0x34874c){var _0xc68b06;var _0x31b83d;var _0xe7733a;var _0xce7cbb=require(_0xd008('0x4c'));return db[_0xd008('0x2e')][_0xd008('0x78')]({'where':{'id':_0x10ed0b['params']['id']}})['then'](function(_0x44ab7c){if(_0x44ab7c){var _0x152bfd=util[_0xd008('0x33')](_0xd008('0x50'),_0x44ab7c[_0xd008('0x4f')]);if(fs[_0xd008('0x51')](_0x152bfd)){cypher=!![];return _0xce7cbb['decryptFile'](_0x152bfd,_0x44ab7c['value'],config[_0xd008('0x53')][_0xd008('0x54')])[_0xd008('0x28')](function(){return _0x44ab7c;});}return _0x44ab7c;}})['then'](function(_0x5cbcb2){if(!_0x5cbcb2){throw new db[(_0xd008('0x55'))][(_0xd008('0x79'))](_0xd008('0x7a'));}_0x31b83d=_0x5cbcb2;return db[_0xd008('0x7b')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x54bc59,null))['then'](function(_0x4ece6d){if(_0x4ece6d){_0xc68b06=_0x4ece6d;if(!_0xc68b06[_0xd008('0x7c')]||!_0xc68b06['transcribeAccountId']||!_0xc68b06[_0xd008('0x7d')]||!_0xc68b06['language']||!_0xc68b06['bucket']){throw new db['Sequelize'][(_0xd008('0x79'))](_0xd008('0x7e'));}if(_0x10ed0b[_0xd008('0x49')]['runSentiment']&&(!_0xc68b06[_0xd008('0x7f')]||!_0xc68b06[_0xd008('0x80')]||!_0xc68b06[_0xd008('0x81')]||!_0xc68b06['language']||!_0xc68b06['bucket'])){throw new db[(_0xd008('0x55'))][(_0xd008('0x79'))](_0xd008('0x82'));}return db[_0xd008('0x83')][_0xd008('0x78')]({'where':{'id':_0xc68b06['transcribeAccountId']}});}})[_0xd008('0x28')](function(_0x27f2da){if(!_0x27f2da){throw new db[(_0xd008('0x55'))][(_0xd008('0x79'))](_0xd008('0x84'));}if(!_0x27f2da[_0xd008('0x85')]||!_0x27f2da['data2']){throw new db[(_0xd008('0x55'))][(_0xd008('0x79'))](_0xd008('0x86'));}_0xe7733a=_0x27f2da;return getBucketslist(_0xe7733a['data1'],_0xe7733a[_0xd008('0x87')],_0xc68b06[_0xd008('0x7d')]);})[_0xd008('0x28')](function(_0x22ffa0){if(_0x22ffa0&&_0x22ffa0[_0xd008('0x88')]){var _0x44765b=_[_0xd008('0x4e')](_0x22ffa0[_0xd008('0x88')],function(_0x2c3f41){return _0x2c3f41['Name']===_0xc68b06[_0xd008('0x6e')];});if(!_0x44765b){logger[_0xd008('0x64')](util[_0xd008('0x33')](_0xd008('0x89'),_0x10ed0b[_0xd008('0x46')]['id'],_0xc68b06[_0xd008('0x6e')]));return createBucket(_0xe7733a[_0xd008('0x85')],_0xe7733a[_0xd008('0x87')],_0xc68b06[_0xd008('0x7d')],_0xc68b06[_0xd008('0x6e')]);}logger[_0xd008('0x64')](util[_0xd008('0x33')](_0xd008('0x8a'),_0x10ed0b[_0xd008('0x46')]['id'],_0xc68b06[_0xd008('0x6e')]));return;}})[_0xd008('0x28')](function(_0x28b68b){if(_0x31b83d[_0xd008('0x76')]==='NEW'){return transcribe(_0x10ed0b[_0xd008('0x46')]['id'],_0xe7733a[_0xd008('0x85')],_0xe7733a['data2'],_0xc68b06['transcribeRegion'],_0xc68b06[_0xd008('0x6e')],_0x31b83d[_0xd008('0x4f')],_0xc68b06[_0xd008('0x8b')]);}else{logger[_0xd008('0x64')](util['format'](_0xd008('0x8c'),_0x10ed0b[_0xd008('0x46')]['id']));return{'transcribeStatus':_0xd008('0x8d')};}})[_0xd008('0x28')](function(_0x41eb0e){if(_0x41eb0e){_0x41eb0e[_0xd008('0x8e')]=_0x10ed0b[_0xd008('0x49')][_0xd008('0x8f')];return _0x31b83d[_0xd008('0x90')](_0x41eb0e);}})['then'](respondWithResult(_0x54bc59,null))['catch'](handleError(_0x54bc59,null));};function writeFile(_0x1f04bb,_0x2b4365){return new Promise(function(_0x4e2372,_0x2315fc){fs[_0xd008('0x91')](_0x2b4365,_0x1f04bb,function(_0x501df4,_0x1ac974){if(_0x501df4){return _0x2315fc(_0x501df4);}else{return _0x4e2372(_0x1ac974);}});});}exports[_0xd008('0x92')]=function(_0xeccdb4,_0x38d56b,_0x570d31){return db[_0xd008('0x2e')][_0xd008('0x78')]({'where':{'id':_0xeccdb4[_0xd008('0x46')]['id']}})['then'](handleEntityNotFound(_0x38d56b))[_0xd008('0x28')](function(_0x5b6dce){if(_0x5b6dce&&_0x5b6dce[_0xd008('0x93')]){var _0x206f1e=_0x5b6dce[_0xd008('0x93')];var _0x51b1da=config[_0xd008('0x94')]+'/server/files/transcribes/transcribe_'+_0x5b6dce['id']+_0xd008('0x95');if(fs[_0xd008('0x51')](_0x51b1da)){return _0x51b1da;}return writeFile(_0x206f1e,_0x51b1da)['then'](function(){return _0x51b1da;});}else{throw new db[(_0xd008('0x55'))]['ValidationError'](_0xd008('0x96'));}})[_0xd008('0x28')](function(_0x5b6102){return _0x38d56b[_0xd008('0x4b')](_0x5b6102);})[_0xd008('0x45')](handleError(_0x38d56b));}; \ No newline at end of file +var _0x8ea5=['destroy','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','keys','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','options','rows','catch','show','params','length','includeAll','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','col','$and','push','format','secrets'];(function(_0x3b12be,_0x276d47){var _0xe27d37=function(_0x44883c){while(--_0x44883c){_0x3b12be['push'](_0x3b12be['shift']());}};_0xe27d37(++_0x276d47);}(_0x8ea5,0xd7));var _0x58ea=function(_0xd5115f,_0x4a4775){_0xd5115f=_0xd5115f-0x0;var _0x5d230d=_0x8ea5[_0xd5115f];return _0x5d230d;};'use strict';var emlformat=require(_0x58ea('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x58ea('0x1'));var moment=require(_0x58ea('0x2'));var BPromise=require(_0x58ea('0x3'));var Mustache=require(_0x58ea('0x4'));var util=require(_0x58ea('0x5'));var path=require(_0x58ea('0x6'));var sox=require(_0x58ea('0x7'));var csv=require(_0x58ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58ea('0x9'));var _=require(_0x58ea('0xa'));var squel=require(_0x58ea('0xb'));var crypto=require('crypto');var jsforce=require(_0x58ea('0xc'));var deskjs=require(_0x58ea('0xd'));var toCsv=require('to-csv');var querystring=require(_0x58ea('0xe'));var Papa=require('papaparse');var AWS=require(_0x58ea('0xf'));var uuidv4=require(_0x58ea('0x10'));var Redis=require(_0x58ea('0x11'));var authService=require(_0x58ea('0x12'));var qs=require(_0x58ea('0x13'));var as=require(_0x58ea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x58ea('0x15'));var utils=require(_0x58ea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x58ea('0x17'));var db=require(_0x58ea('0x18'))['db'];function respondWithStatusCode(_0xf9fec5,_0x45fbfa){_0x45fbfa=_0x45fbfa||0xcc;return function(_0x3156c9){if(_0x3156c9){return _0xf9fec5['sendStatus'](_0x45fbfa);}return _0xf9fec5[_0x58ea('0x19')](_0x45fbfa)[_0x58ea('0x1a')]();};}function respondWithResult(_0x3c1268,_0x53a156){_0x53a156=_0x53a156||0xc8;return function(_0x2a2390){if(_0x2a2390){return _0x3c1268[_0x58ea('0x19')](_0x53a156)[_0x58ea('0x1b')](_0x2a2390);}};}function respondWithFilteredResult(_0x5c5e72,_0xbf6c44){return function(_0x2e4709){if(_0x2e4709){var _0x47b8df=typeof _0xbf6c44[_0x58ea('0x1c')]===_0x58ea('0x1d')&&typeof _0xbf6c44[_0x58ea('0x1e')]===_0x58ea('0x1d');var _0x3f25b0=_0x2e4709[_0x58ea('0x1f')];var _0x158a8c=_0x47b8df?0x0:_0xbf6c44[_0x58ea('0x1c')];var _0x259fb8=_0x47b8df?_0x2e4709['count']:_0xbf6c44[_0x58ea('0x1c')]+_0xbf6c44[_0x58ea('0x1e')];var _0x5dec22;if(_0x259fb8>=_0x3f25b0){_0x259fb8=_0x3f25b0;_0x5dec22=0xc8;}else{_0x5dec22=0xce;}_0x5c5e72[_0x58ea('0x19')](_0x5dec22);return _0x5c5e72[_0x58ea('0x20')](_0x58ea('0x21'),_0x158a8c+'-'+_0x259fb8+'/'+_0x3f25b0)['json'](_0x2e4709);}return null;};}function patchUpdates(_0x28c32a){return function(_0x5a2cb5){try{jsonpatch[_0x58ea('0x22')](_0x5a2cb5,_0x28c32a,!![]);}catch(_0x5ce72d){return BPromise[_0x58ea('0x23')](_0x5ce72d);}return _0x5a2cb5[_0x58ea('0x24')]();};}function saveUpdates(_0x56fd17,_0x441e9c){return function(_0x20ec3e){if(_0x20ec3e){return _0x20ec3e[_0x58ea('0x25')](_0x56fd17)[_0x58ea('0x26')](function(_0x49d743){return _0x49d743;});}return null;};}function removeEntity(_0x232ed1,_0x4158cf){return function(_0x53a49a){if(_0x53a49a){return _0x53a49a['destroy']()[_0x58ea('0x26')](function(){_0x232ed1['status'](0xcc)[_0x58ea('0x1a')]();});}};}function handleEntityNotFound(_0x3bd11a,_0x588b0f){return function(_0x26f745){if(!_0x26f745){_0x3bd11a[_0x58ea('0x27')](0x194);}return _0x26f745;};}function handleError(_0x2e130d,_0x2393b0){_0x2393b0=_0x2393b0||0x1f4;return function(_0x15b1c9){logger[_0x58ea('0x28')](_0x15b1c9[_0x58ea('0x29')]);if(_0x15b1c9[_0x58ea('0x2a')]){delete _0x15b1c9[_0x58ea('0x2a')];}_0x2e130d[_0x58ea('0x19')](_0x2393b0)[_0x58ea('0x2b')](_0x15b1c9);};}exports[_0x58ea('0x2c')]=function(_0x39d9ed,_0x554806){var _0x20fa6b={},_0x3b17ec={},_0x5e0d72={'count':0x0,'rows':[]};var _0x2b0611=_[_0x58ea('0x2d')](db[_0x58ea('0x2e')][_0x58ea('0x2f')],function(_0x1f653){return{'name':_0x1f653[_0x58ea('0x30')],'type':_0x1f653[_0x58ea('0x31')]['key']};});_0x3b17ec[_0x58ea('0x32')]=_[_0x58ea('0x33')](_[_0x58ea('0x2d')](_0x2b0611,_0x58ea('0x2a')),['format']);_0x3b17ec['query']=_[_0x58ea('0x34')](_0x39d9ed['query']);_0x3b17ec['filters']=_[_0x58ea('0x35')](_0x3b17ec[_0x58ea('0x32')],_0x3b17ec[_0x58ea('0x36')]);_0x20fa6b[_0x58ea('0x37')]=_[_0x58ea('0x35')](_0x3b17ec[_0x58ea('0x32')],qs[_0x58ea('0x38')](_0x39d9ed[_0x58ea('0x36')]['fields']));_0x20fa6b[_0x58ea('0x37')]=_0x20fa6b[_0x58ea('0x37')]['length']?_0x20fa6b[_0x58ea('0x37')]:_0x3b17ec['model'];if(!_0x39d9ed[_0x58ea('0x36')]['hasOwnProperty'](_0x58ea('0x39'))){_0x20fa6b['limit']=qs[_0x58ea('0x1e')](_0x39d9ed['query'][_0x58ea('0x1e')]);_0x20fa6b['offset']=qs[_0x58ea('0x1c')](_0x39d9ed[_0x58ea('0x36')][_0x58ea('0x1c')]);}_0x20fa6b[_0x58ea('0x3a')]=qs[_0x58ea('0x3b')](_0x39d9ed[_0x58ea('0x36')]['sort']);_0x20fa6b[_0x58ea('0x3c')]=qs['filters'](_[_0x58ea('0x3d')](_0x39d9ed['query'],_0x3b17ec[_0x58ea('0x3e')]),_0x2b0611);if(_0x39d9ed[_0x58ea('0x36')][_0x58ea('0x3f')]){_0x20fa6b[_0x58ea('0x3c')]=_[_0x58ea('0x40')](_0x20fa6b['where'],{'$or':_[_0x58ea('0x2d')](_0x2b0611,function(_0x4b4784){if(_0x4b4784[_0x58ea('0x31')]!=='VIRTUAL'){var _0x11fb6f={};_0x11fb6f[_0x4b4784[_0x58ea('0x2a')]]={'$like':'%'+_0x39d9ed[_0x58ea('0x36')]['filter']+'%'};return _0x11fb6f;}})});}_0x20fa6b=_[_0x58ea('0x40')]({},_0x20fa6b,_0x39d9ed[_0x58ea('0x41')]);var _0x338fae={'where':_0x20fa6b['where']};return db['VoiceRecording'][_0x58ea('0x1f')](_0x338fae)[_0x58ea('0x26')](function(_0x342d84){_0x5e0d72['count']=_0x342d84;if(_0x39d9ed[_0x58ea('0x36')]['includeAll']){_0x20fa6b['include']=[{'all':!![]}];}return db[_0x58ea('0x2e')]['findAll'](_0x20fa6b);})[_0x58ea('0x26')](function(_0x542abf){_0x5e0d72[_0x58ea('0x42')]=_0x542abf;return _0x5e0d72;})[_0x58ea('0x26')](respondWithFilteredResult(_0x554806,_0x20fa6b))[_0x58ea('0x43')](handleError(_0x554806,null));};exports[_0x58ea('0x44')]=function(_0x29c7cf,_0x2b89d0){var _0x5a53eb={'raw':![],'where':{'id':_0x29c7cf[_0x58ea('0x45')]['id']}},_0x3b1c5e={};_0x3b1c5e[_0x58ea('0x32')]=_[_0x58ea('0x34')](db[_0x58ea('0x2e')][_0x58ea('0x2f')]);_0x3b1c5e[_0x58ea('0x36')]=_['keys'](_0x29c7cf['query']);_0x3b1c5e[_0x58ea('0x3e')]=_['intersection'](_0x3b1c5e[_0x58ea('0x32')],_0x3b1c5e['query']);_0x5a53eb[_0x58ea('0x37')]=_['intersection'](_0x3b1c5e[_0x58ea('0x32')],qs['fields'](_0x29c7cf['query'][_0x58ea('0x38')]));_0x5a53eb[_0x58ea('0x37')]=_0x5a53eb['attributes'][_0x58ea('0x46')]?_0x5a53eb['attributes']:_0x3b1c5e['model'];if(_0x29c7cf[_0x58ea('0x36')][_0x58ea('0x47')]){_0x5a53eb[_0x58ea('0x48')]=[{'all':!![]}];}_0x5a53eb=_[_0x58ea('0x40')]({},_0x5a53eb,_0x29c7cf[_0x58ea('0x41')]);return db[_0x58ea('0x2e')][_0x58ea('0x49')](_0x5a53eb)['then'](handleEntityNotFound(_0x2b89d0,null))['then'](respondWithResult(_0x2b89d0,null))['catch'](handleError(_0x2b89d0,null));};exports[_0x58ea('0x4a')]=function(_0x36c197,_0x4d1085){return db['VoiceRecording']['create'](_0x36c197['body'],{})['then'](respondWithResult(_0x4d1085,0xc9))['catch'](handleError(_0x4d1085,null));};exports[_0x58ea('0x25')]=function(_0x4c3495,_0x170e43){if(_0x4c3495[_0x58ea('0x4b')]['id']){delete _0x4c3495[_0x58ea('0x4b')]['id'];}return db[_0x58ea('0x2e')][_0x58ea('0x49')]({'where':{'id':_0x4c3495[_0x58ea('0x45')]['id']}})[_0x58ea('0x26')](handleEntityNotFound(_0x170e43,null))[_0x58ea('0x26')](saveUpdates(_0x4c3495[_0x58ea('0x4b')],null))[_0x58ea('0x26')](respondWithResult(_0x170e43,null))[_0x58ea('0x43')](handleError(_0x170e43,null));};exports['describe']=function(_0x57c340,_0x3bbfbb){return db['VoiceRecording'][_0x58ea('0x4c')]()['then'](respondWithResult(_0x3bbfbb,null))[_0x58ea('0x43')](handleError(_0x3bbfbb,null));};exports[_0x58ea('0x4d')]=function(_0x29a2ef,_0x3fc6e2,_0x3c61a4){var _0x473881=require(_0x58ea('0x4e'));var _0x3abe5d=![];var _0x2665ee={};if(_0x29a2ef[_0x58ea('0x36')][_0x58ea('0x31')]&&_0x29a2ef[_0x58ea('0x36')]['type']===_0x58ea('0x4f')){_0x2665ee[_0x58ea('0x4f')]=_0x29a2ef[_0x58ea('0x45')]['id'];}else{_0x2665ee['id']=_0x29a2ef[_0x58ea('0x45')]['id'];}return db[_0x58ea('0x2e')][_0x58ea('0x49')]({'where':_0x2665ee,'attributes':['id',_0x58ea('0x50')],'raw':!![]})[_0x58ea('0x26')](handleEntityNotFound(_0x3fc6e2,null))[_0x58ea('0x26')](function(_0x146b59){if(_0x146b59){var _0x3a64c7=_0x146b59[_0x58ea('0x50')];var _0x4924ed=util['format'](_0x58ea('0x51'),_0x3a64c7);if(fs[_0x58ea('0x52')](_0x4924ed)){_0x3abe5d=!![];return _0x473881[_0x58ea('0x53')](_0x4924ed,_0x3a64c7,config['secrets'][_0x58ea('0x54')])[_0x58ea('0x26')](function(){return _0x146b59;});}return _0x146b59;}})[_0x58ea('0x26')](function(_0x2254a8){if(_0x2254a8){var _0x44dda2=_0x2254a8[_0x58ea('0x50')];if(!fs['existsSync'](_0x44dda2)){throw new db['Sequelize'][(_0x58ea('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x2254a8[_0x58ea('0x56')]){return _0x3fc6e2[_0x58ea('0x4d')](_0x44dda2,_0x2254a8['filename']+path[_0x58ea('0x57')](_0x44dda2),function(){if(_0x3abe5d){fs[_0x58ea('0x58')](_0x44dda2);}});}else{return _0x3fc6e2['download'](_0x44dda2,function(_0x1e9981){if(_0x3abe5d){fs[_0x58ea('0x58')](_0x44dda2);}});}}})[_0x58ea('0x43')](function(_0x5f3e12){if(_0x5f3e12[_0x58ea('0x59')]===_0x58ea('0x5a')){_0x3fc6e2[_0x58ea('0x19')](0x194)[_0x58ea('0x2b')]('Not\x20found');}else{return handleError(_0x3fc6e2,null);}});};exports[_0x58ea('0x5b')]=function(_0x1380b7,_0x1f929e,_0x5dad5a){var _0x56ec36=require('../../components/encryptor');var _0x4c61e7=![];var _0x565ad7={'$and':[db[_0x58ea('0x5c')]['where'](db['sequelize']['fn'](_0x58ea('0x5d'),db[_0x58ea('0x5c')][_0x58ea('0x5e')](_0x58ea('0x4f'))),_0x1380b7[_0x58ea('0x36')]['token'])]};if(_0x1380b7[_0x58ea('0x36')]['type']&&_0x1380b7[_0x58ea('0x36')]['type']===_0x58ea('0x4f')){_0x565ad7[_0x58ea('0x5f')][_0x58ea('0x60')]({'uniqueid':_0x1380b7['params']['id']});}else{_0x565ad7[_0x58ea('0x5f')]['push']({'id':_0x1380b7[_0x58ea('0x45')]['id']});}return db[_0x58ea('0x2e')][_0x58ea('0x49')]({'where':_0x565ad7,'attributes':['id',_0x58ea('0x50')],'raw':!![]})[_0x58ea('0x26')](handleEntityNotFound(_0x1f929e,null))[_0x58ea('0x26')](function(_0xdbf52){if(_0xdbf52){var _0x2f02f3=util[_0x58ea('0x61')](_0x58ea('0x51'),_0xdbf52[_0x58ea('0x50')]);if(fs[_0x58ea('0x52')](_0x2f02f3)){_0x4c61e7=!![];return _0x56ec36['decryptFile'](_0x2f02f3,_0xdbf52[_0x58ea('0x50')],config[_0x58ea('0x62')][_0x58ea('0x54')])['then'](function(){return _0xdbf52;});}return _0xdbf52;}})[_0x58ea('0x26')](function(_0x11e699){if(_0x11e699){if(!fs['existsSync'](_0x11e699['value'])){throw new db['Sequelize'][(_0x58ea('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x11e699[_0x58ea('0x56')]){return _0x1f929e[_0x58ea('0x4d')](_0x11e699[_0x58ea('0x50')],_0x11e699[_0x58ea('0x56')]+path[_0x58ea('0x57')](_0x11e699[_0x58ea('0x50')]),function(){if(_0x4c61e7){fs[_0x58ea('0x58')](_0x11e699[_0x58ea('0x50')]);}});}else{return _0x1f929e['download'](_0x11e699[_0x58ea('0x50')],function(_0x39cb73){if(_0x4c61e7){fs['unlink'](_0x11e699['value']);}});}}})[_0x58ea('0x43')](handleError(_0x1f929e,null));};exports[_0x58ea('0x63')]=function(_0x27aa13,_0x360d4d){return db[_0x58ea('0x2e')][_0x58ea('0x49')]({'where':{'id':_0x27aa13['params']['id']}})['then'](function(_0x37ff9f){if(_[_0x58ea('0x64')](_0x37ff9f)){throw new ReferenceError(_0x58ea('0x65'));}return _0x37ff9f;})[_0x58ea('0x26')](function(_0x1efe03){var _0x8ae70b=_0x1efe03['value'];logger[_0x58ea('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x8ae70b);if(!_[_0x58ea('0x64')](_0x1efe03[_0x58ea('0x50')])&&fs[_0x58ea('0x52')](_0x8ae70b)){logger[_0x58ea('0x66')]('File:\x20\x22'+_0x8ae70b+_0x58ea('0x67'));fs[_0x58ea('0x68')](_0x8ae70b);}_0x8ae70b=_0x8ae70b+_0x58ea('0x69');if(!_[_0x58ea('0x64')](_0x1efe03[_0x58ea('0x50')])&&fs[_0x58ea('0x52')](_0x8ae70b)){logger[_0x58ea('0x66')](_0x58ea('0x6a')+_0x8ae70b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x8ae70b);}return _0x1efe03;})['then'](function(_0x242b79){if(!_0x242b79)throw new InternalError();return _0x242b79['destroy']();})[_0x58ea('0x26')](function(){_0x360d4d[_0x58ea('0x19')](0xcc)[_0x58ea('0x1a')]();})[_0x58ea('0x43')](handleError(_0x360d4d,null));};function getBucketslist(_0x567655,_0x56c782,_0x17aa2a){return new Promise(function(_0x57e10f,_0xb24e81){var _0x325789=new AWS['S3']({'accessKeyId':_0x56c782,'secretAccessKey':_0x567655,'region':_0x17aa2a});_0x325789[_0x58ea('0x6b')]({},function(_0x45cbdf,_0x48a651){if(_0x45cbdf){return _0xb24e81(_0x45cbdf);}else{return _0x57e10f(_0x48a651);}});});}function createBucket(_0x2aa20f,_0x148d5e,_0x69f88b,_0x367e74){return new Promise(function(_0x23af95,_0x4db5da){var _0x40213a=new AWS['S3']({'accessKeyId':_0x148d5e,'secretAccessKey':_0x2aa20f,'region':_0x69f88b});_0x40213a[_0x58ea('0x6c')]({'Bucket':_0x367e74},function(_0x5f212e,_0x592017){if(_0x5f212e){return _0x4db5da(_0x5f212e);}else{return _0x23af95(_0x592017);}});});}function uploadFile(_0x1b2fd4,_0x2a9567,_0x2f163a,_0x35b139,_0x1889cb,_0x4b4f9b){return new Promise(function(_0x213a14,_0x2ce473){var _0x1d50b2=new AWS['S3']({'accessKeyId':_0x2a9567,'secretAccessKey':_0x1b2fd4,'region':_0x2f163a});_0x1d50b2[_0x58ea('0x6d')]({'Bucket':_0x35b139,'Key':_0x1889cb,'Body':_0x4b4f9b},function(_0x3988a0,_0x5d6e5b){if(_0x3988a0){return _0x2ce473(_0x3988a0);}else{return _0x213a14(_0x5d6e5b);}});});}function startTranscribe(_0x5d270a,_0x4e93a9,_0xb52b3b,_0x15b4fc,_0x390898,_0x55e20a){return new Promise(function(_0xad939,_0x2004a9){var _0x472a46=new AWS[(_0x58ea('0x6e'))]({'accessKeyId':_0x4e93a9,'secretAccessKey':_0x5d270a,'region':_0xb52b3b});_0x472a46[_0x58ea('0x6f')]({'TranscriptionJobName':_0x15b4fc,'LanguageCode':_0x390898,'Media':{'MediaFileUri':_0x55e20a}},function(_0x39b242,_0xf7b27c){if(_0x39b242){return _0x2004a9(_0x39b242);}else{return _0xad939(_0xf7b27c);}});});}function transcribe(_0xe7076b,_0x40aa7c,_0x43780f,_0x1beb25,_0x3f0765,_0x119f5d,_0x304e9b){return new Promise(function(_0x4e3ba4,_0x1abde2){var _0x469efc={};logger['info'](util[_0x58ea('0x61')](_0x58ea('0x70'),_0xe7076b,_0x3f0765));return uploadFile(_0x40aa7c,_0x43780f,_0x1beb25,_0x3f0765,path[_0x58ea('0x71')](_0x119f5d),fs['readFileSync'](_0x119f5d))['then'](function(_0x16577d){logger['info'](util[_0x58ea('0x61')](_0x58ea('0x72'),_0xe7076b,_0x3f0765,_0x16577d[_0x58ea('0x73')]));_0x469efc['bucket']=_0x16577d[_0x58ea('0x74')];_0x469efc[_0x58ea('0x75')]=_0x16577d[_0x58ea('0x73')];logger['info'](util[_0x58ea('0x61')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xe7076b));return startTranscribe(_0x40aa7c,_0x43780f,_0x1beb25,uuidv4(),_0x304e9b,_0x16577d['Location']);})[_0x58ea('0x26')](function(_0x56be47){logger[_0x58ea('0x66')](util['format'](_0x58ea('0x76'),_0xe7076b,_0x56be47[_0x58ea('0x77')][_0x58ea('0x78')]));_0x469efc[_0x58ea('0x79')]=_0x56be47[_0x58ea('0x77')]['TranscriptionJobName'];_0x469efc[_0x58ea('0x7a')]=_0x56be47[_0x58ea('0x77')][_0x58ea('0x7b')];return _0x4e3ba4(_0x469efc);})[_0x58ea('0x43')](function(_0x5c95e1){return _0x1abde2(_0x5c95e1);});});}exports[_0x58ea('0x7c')]=function(_0x9f7294,_0x1cecd3,_0x1de269){var _0x5ddfa2;var _0x5d9a1d;var _0x2d8783;var _0x1df94f=require('../../components/encryptor');return db['VoiceRecording'][_0x58ea('0x7d')]({'where':{'id':_0x9f7294[_0x58ea('0x45')]['id']}})[_0x58ea('0x26')](function(_0x9b1c82){if(_0x9b1c82){var _0x2123c1=util[_0x58ea('0x61')](_0x58ea('0x51'),_0x9b1c82[_0x58ea('0x50')]);if(fs['existsSync'](_0x2123c1)){cypher=!![];return _0x1df94f[_0x58ea('0x53')](_0x2123c1,_0x9b1c82[_0x58ea('0x50')],config[_0x58ea('0x62')][_0x58ea('0x54')])['then'](function(){return _0x9b1c82;});}return _0x9b1c82;}})[_0x58ea('0x26')](function(_0x51f509){if(!_0x51f509){throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x7f'));}_0x5d9a1d=_0x51f509;return db[_0x58ea('0x80')][_0x58ea('0x7d')]({'where':{'id':0x1}});})[_0x58ea('0x26')](handleEntityNotFound(_0x1cecd3,null))[_0x58ea('0x26')](function(_0xcaf4a2){if(_0xcaf4a2){_0x5ddfa2=_0xcaf4a2;if(!_0x5ddfa2['transcribe']||!_0x5ddfa2[_0x58ea('0x81')]||!_0x5ddfa2[_0x58ea('0x82')]||!_0x5ddfa2[_0x58ea('0x83')]||!_0x5ddfa2[_0x58ea('0x84')]){throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x85'));}if(_0x9f7294[_0x58ea('0x4b')][_0x58ea('0x86')]&&(!_0x5ddfa2[_0x58ea('0x87')]||!_0x5ddfa2[_0x58ea('0x88')]||!_0x5ddfa2[_0x58ea('0x89')]||!_0x5ddfa2[_0x58ea('0x83')]||!_0x5ddfa2[_0x58ea('0x84')])){throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x8a'));}return db[_0x58ea('0x8b')]['findOne']({'where':{'id':_0x5ddfa2[_0x58ea('0x81')]}});}})['then'](function(_0x278e38){if(!_0x278e38){throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x8c'));}if(!_0x278e38[_0x58ea('0x8d')]||!_0x278e38['data2']){throw new db[(_0x58ea('0x7e'))]['ValidationError'](_0x58ea('0x8e'));}_0x2d8783=_0x278e38;return getBucketslist(_0x2d8783[_0x58ea('0x8d')],_0x2d8783[_0x58ea('0x8f')],_0x5ddfa2[_0x58ea('0x82')]);})['then'](function(_0x44ed1b){if(_0x44ed1b&&_0x44ed1b['Buckets']){var _0x1e22b0=_[_0x58ea('0x49')](_0x44ed1b[_0x58ea('0x90')],function(_0x2bcacd){return _0x2bcacd[_0x58ea('0x91')]===_0x5ddfa2['bucket'];});if(!_0x1e22b0){logger[_0x58ea('0x66')](util[_0x58ea('0x61')](_0x58ea('0x92'),_0x9f7294[_0x58ea('0x45')]['id'],_0x5ddfa2[_0x58ea('0x84')]));return createBucket(_0x2d8783[_0x58ea('0x8d')],_0x2d8783[_0x58ea('0x8f')],_0x5ddfa2[_0x58ea('0x82')],_0x5ddfa2[_0x58ea('0x84')]);}logger['info'](util[_0x58ea('0x61')](_0x58ea('0x93'),_0x9f7294[_0x58ea('0x45')]['id'],_0x5ddfa2[_0x58ea('0x84')]));return;}})[_0x58ea('0x26')](function(_0x44dc68){if(_0x5d9a1d[_0x58ea('0x7a')]===_0x58ea('0x94')){return transcribe(_0x9f7294[_0x58ea('0x45')]['id'],_0x2d8783[_0x58ea('0x8d')],_0x2d8783[_0x58ea('0x8f')],_0x5ddfa2[_0x58ea('0x82')],_0x5ddfa2[_0x58ea('0x84')],_0x5d9a1d[_0x58ea('0x50')],_0x5ddfa2[_0x58ea('0x83')]);}else{logger[_0x58ea('0x66')](util[_0x58ea('0x61')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x9f7294[_0x58ea('0x45')]['id']));return{'transcribeStatus':_0x58ea('0x95')};}})[_0x58ea('0x26')](function(_0x5cef9e){if(_0x5cef9e){_0x5cef9e['tempSentiment']=_0x9f7294['body'][_0x58ea('0x86')];return _0x5d9a1d[_0x58ea('0x96')](_0x5cef9e);}})[_0x58ea('0x26')](respondWithResult(_0x1cecd3,null))[_0x58ea('0x43')](handleError(_0x1cecd3,null));};function writeFile(_0x2dd30a,_0x141a43){return new Promise(function(_0x1fce9b,_0x147a27){fs[_0x58ea('0x97')](_0x141a43,_0x2dd30a,function(_0x55a391,_0x554029){if(_0x55a391){return _0x147a27(_0x55a391);}else{return _0x1fce9b(_0x554029);}});});}exports[_0x58ea('0x98')]=function(_0x263f8a,_0x4599de,_0x4ccd57){return db[_0x58ea('0x2e')][_0x58ea('0x7d')]({'where':{'id':_0x263f8a['params']['id']}})[_0x58ea('0x26')](handleEntityNotFound(_0x4599de))[_0x58ea('0x26')](function(_0x5e9cb4){if(_0x5e9cb4&&_0x5e9cb4[_0x58ea('0x99')]){var _0x5e4c27=_0x5e9cb4[_0x58ea('0x99')];var _0x1f553e=config['root']+_0x58ea('0x9a')+_0x5e9cb4['id']+_0x58ea('0x9b');if(fs['existsSync'](_0x1f553e)){return _0x1f553e;}return writeFile(_0x5e4c27,_0x1f553e)['then'](function(){return _0x1f553e;});}else{throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x9c'));}})[_0x58ea('0x26')](function(_0x4482e4){return _0x4599de[_0x58ea('0x4d')](_0x4482e4);})[_0x58ea('0x43')](handleError(_0x4599de));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3539aae..5b3b0bf 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 _0x55e0=['./voiceRecording.attributes','exports','voice_recordings','uniqueid','transcribeStatus'];(function(_0x556e63,_0x16abaf){var _0x1f18a9=function(_0xd80b8){while(--_0xd80b8){_0x556e63['push'](_0x556e63['shift']());}};_0x1f18a9(++_0x16abaf);}(_0x55e0,0xdc));var _0x055e=function(_0x284e36,_0x5385e4){_0x284e36=_0x284e36-0x0;var _0x51e50f=_0x55e0[_0x284e36];return _0x51e50f;};'use strict';var attributes=require(_0x055e('0x0'));module[_0x055e('0x1')]=function(_0x2e09a6,_0x414740){return _0x2e09a6['define']('VoiceRecording',attributes,{'tableName':_0x055e('0x2'),'paranoid':![],'indexes':[{'name':_0x055e('0x3'),'fields':[_0x055e('0x3')]},{'name':_0x055e('0x4'),'fields':[_0x055e('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d15=['transcribeStatus','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x20834a,_0x471f90){var _0x33da2d=function(_0x22a346){while(--_0x22a346){_0x20834a['push'](_0x20834a['shift']());}};_0x33da2d(++_0x471f90);}(_0x3d15,0x127));var _0x53d1=function(_0x8ae5f9,_0x49ff8c){_0x8ae5f9=_0x8ae5f9-0x0;var _0x181054=_0x3d15[_0x8ae5f9];return _0x181054;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x53d1('0x0')]=function(_0x24e0fe,_0x5ed61d){return _0x24e0fe[_0x53d1('0x1')](_0x53d1('0x2'),attributes,{'tableName':_0x53d1('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x53d1('0x4')]},{'name':_0x53d1('0x5'),'fields':[_0x53d1('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 1e379ac..a3a8995 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 _0x8ace=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','attributes','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','body','callRecordingEncryption','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x5a75e7,_0x3ad506){_0x5a75e7=_0x5a75e7-0x0;var _0x15c695=_0x8ace[_0x5a75e7];return _0x15c695;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var BPromise=require(_0xe8ac('0x3'));var rs=require(_0xe8ac('0x4'));var fs=require('fs');var Redis=require(_0xe8ac('0x5'));var db=require(_0xe8ac('0x6'))['db'];var utils=require(_0xe8ac('0x7'));var logger=require(_0xe8ac('0x8'))(_0xe8ac('0x9'));var config=require(_0xe8ac('0xa'));var jayson=require(_0xe8ac('0xb'));var client=jayson[_0xe8ac('0xc')][_0xe8ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4eb087,_0x2d56f0,_0x1357ed){return new BPromise(function(_0x4f9233,_0x5c83e1){return client[_0xe8ac('0xe')](_0x4eb087,_0x1357ed)['then'](function(_0x1b5467){logger[_0xe8ac('0xf')](_0xe8ac('0x10'),_0x2d56f0,_0xe8ac('0x11'));logger[_0xe8ac('0x12')](_0xe8ac('0x13'),_0x2d56f0,'request\x20sent',JSON[_0xe8ac('0x14')](_0x1b5467));if(_0x1b5467[_0xe8ac('0x15')]){if(_0x1b5467[_0xe8ac('0x15')]['code']===0x1f4){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467['error'][_0xe8ac('0x16')]);return _0x5c83e1(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);return _0x4f9233(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}else{logger[_0xe8ac('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x2d56f0,_0xe8ac('0x11'));_0x4f9233(_0x1b5467[_0xe8ac('0x17')]['message']);}})[_0xe8ac('0x18')](function(_0x3a7939){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x3a7939);_0x5c83e1(_0x3a7939);});});}exports[_0xe8ac('0x19')]=function(_0x36759c){var _0x4892d0=this;return new Promise(function(_0x59df3d,_0x5f3433){return db[_0xe8ac('0x1a')][_0xe8ac('0x1b')](_0x36759c['body'],{'raw':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1e')]||null:null,'attributes':_0x36759c[_0xe8ac('0x1c')]?_0x36759c[_0xe8ac('0x1c')][_0xe8ac('0x1f')]||null:null,'limit':_0x36759c['options']?_0x36759c[_0xe8ac('0x1c')]['limit']||null:null})[_0xe8ac('0x20')](function(_0x3933d2){logger[_0xe8ac('0xf')](_0xe8ac('0x19'),_0x36759c);logger[_0xe8ac('0x12')](_0xe8ac('0x19'),_0x36759c,JSON[_0xe8ac('0x14')](_0x3933d2));_0x59df3d(_0x3933d2);})['catch'](function(_0x1c3ea4){logger[_0xe8ac('0x15')](_0xe8ac('0x19'),_0x1c3ea4[_0xe8ac('0x16')],_0x36759c);_0x5f3433(_0x4892d0[_0xe8ac('0x15')](0x1f4,_0x1c3ea4[_0xe8ac('0x16')]));});});};exports[_0xe8ac('0x21')]=function(_0x3e3fc2){var _0x44b07c=this;return new Promise(function(_0x562e44,_0x5a1b69){var _0x346dcb=require(_0xe8ac('0x22'));var _0x59512c;return db[_0xe8ac('0x23')][_0xe8ac('0x24')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1f1e44){_0x59512c=_0x1f1e44;return db[_0xe8ac('0x1a')][_0xe8ac('0x25')](_0x3e3fc2[_0xe8ac('0x26')]);})[_0xe8ac('0x20')](function(_0x41ffe8){if(_0x59512c[_0xe8ac('0x27')]&&fs['existsSync'](_0x41ffe8[_0xe8ac('0x28')])){var _0x5459e5=util[_0xe8ac('0x29')]('%s.cypher',_0x41ffe8['value']);return _0x346dcb['encryptFile'](_0x41ffe8['value'],_0x5459e5,config[_0xe8ac('0x2a')][_0xe8ac('0x2b')])[_0xe8ac('0x20')](function(){fs[_0xe8ac('0x2c')](_0x41ffe8[_0xe8ac('0x28')]);logger[_0xe8ac('0xf')](_0xe8ac('0x2d'));return _0x41ffe8;});}return _0x41ffe8;})['then'](function(_0x1cacb0){logger['info']('CreateVoiceRecording',_0x3e3fc2);logger['debug'](_0xe8ac('0x21'),_0x3e3fc2,JSON[_0xe8ac('0x14')](_0x1cacb0));_0x562e44(_0x1cacb0);})[_0xe8ac('0x18')](function(_0x56feff){logger['error'](_0xe8ac('0x21'),_0x56feff[_0xe8ac('0x16')],_0x3e3fc2);_0x5a1b69(_0x44b07c[_0xe8ac('0x15')](0x1f4,_0x56feff[_0xe8ac('0x16')]));});});}; \ No newline at end of file +var _0x5f66=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','UpdateVoiceRecording','update','raw','options','where','attributes','../../components/encryptor','findOne','callRecordingEncryption','body','existsSync','value','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','bluebird'];(function(_0x1f8f47,_0xb1a3d8){var _0x5c56de=function(_0x37e34a){while(--_0x37e34a){_0x1f8f47['push'](_0x1f8f47['shift']());}};_0x5c56de(++_0xb1a3d8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['VoiceRecording'][_0x65f6('0x16')](_0x1f974c['body'],{'raw':_0x1f974c['options']?_0x1f974c['options'][_0x65f6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f974c[_0x65f6('0x18')]?_0x1f974c['options'][_0x65f6('0x19')]||null:null,'attributes':_0x1f974c[_0x65f6('0x18')]?_0x1f974c[_0x65f6('0x18')][_0x65f6('0x1a')]||null:null,'limit':_0x1f974c[_0x65f6('0x18')]?_0x1f974c[_0x65f6('0x18')]['limit']||null:null})[_0x65f6('0xa')](function(_0x4bb39e){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')]('UpdateVoiceRecording',_0x1f974c,JSON[_0x65f6('0xf')](_0x4bb39e));_0x18380e(_0x4bb39e);})[_0x65f6('0x14')](function(_0x2317ce){logger[_0x65f6('0x12')]('UpdateVoiceRecording',_0x2317ce[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x2317ce[_0x65f6('0x11')]));});});};exports['CreateVoiceRecording']=function(_0x5cb131){var _0x4fde2f=this;return new Promise(function(_0x29abdb,_0x16cde8){var _0x4b2292=require(_0x65f6('0x1b'));var _0x28f710;return db['Setting'][_0x65f6('0x1c')]({'attributes':['id',_0x65f6('0x1d')],'where':{'id':0x1},'raw':!![]})[_0x65f6('0xa')](function(_0x559330){_0x28f710=_0x559330;return db['VoiceRecording']['create'](_0x5cb131[_0x65f6('0x1e')]);})[_0x65f6('0xa')](function(_0x4344b3){if(_0x28f710[_0x65f6('0x1d')]&&fs[_0x65f6('0x1f')](_0x4344b3[_0x65f6('0x20')])){var _0x144e55=util['format']('%s.cypher',_0x4344b3[_0x65f6('0x20')]);return _0x4b2292[_0x65f6('0x21')](_0x4344b3['value'],_0x144e55,config['secrets'][_0x65f6('0x22')])[_0x65f6('0xa')](function(){fs[_0x65f6('0x23')](_0x4344b3[_0x65f6('0x20')]);logger[_0x65f6('0x13')](_0x65f6('0x24'));return _0x4344b3;});}return _0x4344b3;})['then'](function(_0x103265){logger[_0x65f6('0x13')](_0x65f6('0x25'),_0x5cb131);logger['debug'](_0x65f6('0x25'),_0x5cb131,JSON[_0x65f6('0xf')](_0x103265));_0x29abdb(_0x103265);})[_0x65f6('0x14')](function(_0x45510a){logger[_0x65f6('0x12')](_0x65f6('0x25'),_0x45510a['message'],_0x5cb131);_0x16cde8(_0x4fde2f[_0x65f6('0x12')](0x1f4,_0x45510a[_0x65f6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index b46e0da..4272f94 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 _0x6ee9=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x39f2a8,_0x42b848){var _0x2fba76=function(_0x3bb996){while(--_0x3bb996){_0x39f2a8['push'](_0x39f2a8['shift']());}};_0x2fba76(++_0x42b848);}(_0x6ee9,0x15c));var _0x96ee=function(_0x4fb74c,_0x32ab4a){_0x4fb74c=_0x4fb74c-0x0;var _0x1400f2=_0x6ee9[_0x4fb74c];return _0x1400f2;};'use strict';var multer=require(_0x96ee('0x0'));var util=require(_0x96ee('0x1'));var path=require(_0x96ee('0x2'));var timeout=require(_0x96ee('0x3'));var express=require(_0x96ee('0x4'));var router=express['Router']();var fs_extra=require(_0x96ee('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96ee('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x96ee('0x7')]('/',auth[_0x96ee('0x8')](),controller['index']);router[_0x96ee('0x7')](_0x96ee('0x9'),auth[_0x96ee('0x8')](),controller[_0x96ee('0xa')]);router['get'](_0x96ee('0xb'),auth['isAuthenticated'](),controller[_0x96ee('0xc')]);router[_0x96ee('0xd')]('/',auth[_0x96ee('0x8')](),controller[_0x96ee('0xe')]);router[_0x96ee('0xf')](_0x96ee('0xb'),auth[_0x96ee('0x8')](),controller[_0x96ee('0x10')]);router[_0x96ee('0x11')]('/:id',auth[_0x96ee('0x8')](),controller[_0x96ee('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4048=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','/:id','post'];(function(_0x4695e2,_0x3d5f15){var _0x160563=function(_0x5df0a2){while(--_0x5df0a2){_0x4695e2['push'](_0x4695e2['shift']());}};_0x160563(++_0x3d5f15);}(_0x4048,0x69));var _0x8404=function(_0x290601,_0x21d1c9){_0x290601=_0x290601-0x0;var _0x23dc9f=_0x4048[_0x290601];return _0x23dc9f;};'use strict';var multer=require(_0x8404('0x0'));var util=require(_0x8404('0x1'));var path=require(_0x8404('0x2'));var timeout=require(_0x8404('0x3'));var express=require(_0x8404('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8404('0x5'));var interaction=require(_0x8404('0x6'));var config=require(_0x8404('0x7'));var controller=require(_0x8404('0x8'));router[_0x8404('0x9')]('/',auth['isAuthenticated'](),controller[_0x8404('0xa')]);router[_0x8404('0x9')](_0x8404('0xb'),auth[_0x8404('0xc')](),controller['describe']);router[_0x8404('0x9')](_0x8404('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8404('0xe')]('/',auth[_0x8404('0xc')](),controller['create']);router[_0x8404('0xf')](_0x8404('0xd'),auth[_0x8404('0xc')](),controller[_0x8404('0x10')]);router[_0x8404('0x11')](_0x8404('0xd'),auth[_0x8404('0xc')](),controller[_0x8404('0x12')]);module[_0x8404('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 9e5b54b..ce64934 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 _0x8493=['moment','exports','blind','attended','STRING','ENUM','Yes','sequelize'];(function(_0xf1603b,_0x257c11){var _0x298fab=function(_0x5a96fd){while(--_0x5a96fd){_0xf1603b['push'](_0xf1603b['shift']());}};_0x298fab(++_0x257c11);}(_0x8493,0x1df));var _0x3849=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x8493[_0x5af97c];return _0x3472ae;};'use strict';var Sequelize=require(_0x3849('0x0'));var moment=require(_0x3849('0x1'));module[_0x3849('0x2')]={'type':{'type':Sequelize['ENUM'](_0x3849('0x3'),_0x3849('0x4'))},'result':{'type':Sequelize[_0x3849('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x3849('0x5')]},'transferercalleridname':{'type':Sequelize[_0x3849('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x3849('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x3849('0x5')]},'transferercontext':{'type':Sequelize[_0x3849('0x5')]},'transfererexten':{'type':Sequelize[_0x3849('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x3849('0x5')]},'transfereechannel':{'type':Sequelize[_0x3849('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x3849('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x3849('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3849('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3849('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x3849('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x3849('0x5')]},'isexternal':{'type':Sequelize[_0x3849('0x6')](_0x3849('0x7'),'No')},'context':{'type':Sequelize[_0x3849('0x5')]},'extension':{'type':Sequelize[_0x3849('0x5')]}}; \ No newline at end of file +var _0xa053=['ENUM','blind','attended','STRING','sequelize','moment'];(function(_0x1a6469,_0x3509da){var _0x1d4e68=function(_0x2d2abd){while(--_0x2d2abd){_0x1a6469['push'](_0x1a6469['shift']());}};_0x1d4e68(++_0x3509da);}(_0xa053,0xee));var _0x3a05=function(_0x58f255,_0xebaa22){_0x58f255=_0x58f255-0x0;var _0x23fbe5=_0xa053[_0x58f255];return _0x23fbe5;};'use strict';var Sequelize=require(_0x3a05('0x0'));var moment=require(_0x3a05('0x1'));module['exports']={'type':{'type':Sequelize[_0x3a05('0x2')](_0x3a05('0x3'),_0x3a05('0x4'))},'result':{'type':Sequelize[_0x3a05('0x5')]},'transfererchannel':{'type':Sequelize[_0x3a05('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x3a05('0x5')]},'transferercalleridname':{'type':Sequelize[_0x3a05('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3a05('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x3a05('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x3a05('0x5')]},'transfereechannel':{'type':Sequelize[_0x3a05('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x3a05('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x3a05('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3a05('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3a05('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x3a05('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x3a05('0x5')]},'isexternal':{'type':Sequelize[_0x3a05('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3a05('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ba16da7..9c81fa5 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 _0x1c62=['then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','Content-Range','reject','save','update','destroy'];(function(_0x163395,_0x2e3464){var _0x804441=function(_0x677470){while(--_0x677470){_0x163395['push'](_0x163395['shift']());}};_0x804441(++_0x2e3464);}(_0x1c62,0x73));var _0x21c6=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x1c62[_0x5c883f];return _0x4210cc;};'use strict';var emlformat=require(_0x21c6('0x0'));var rimraf=require(_0x21c6('0x1'));var zipdir=require(_0x21c6('0x2'));var jsonpatch=require(_0x21c6('0x3'));var rp=require(_0x21c6('0x4'));var moment=require(_0x21c6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x21c6('0x6'));var sox=require('sox');var csv=require(_0x21c6('0x7'));var ejs=require(_0x21c6('0x8'));var fs=require('fs');var fs_extra=require(_0x21c6('0x9'));var _=require(_0x21c6('0xa'));var squel=require(_0x21c6('0xb'));var crypto=require(_0x21c6('0xc'));var jsforce=require(_0x21c6('0xd'));var deskjs=require(_0x21c6('0xe'));var toCsv=require(_0x21c6('0x7'));var querystring=require(_0x21c6('0xf'));var Papa=require(_0x21c6('0x10'));var Redis=require('ioredis');var authService=require(_0x21c6('0x11'));var qs=require(_0x21c6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21c6('0x13'));var logger=require('../../config/logger')(_0x21c6('0x14'));var utils=require(_0x21c6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x21c6('0x16'));var db=require(_0x21c6('0x17'))['db'];function respondWithStatusCode(_0x46ccfb,_0x1aecb8){_0x1aecb8=_0x1aecb8||0xcc;return function(_0x1249be){if(_0x1249be){return _0x46ccfb[_0x21c6('0x18')](_0x1aecb8);}return _0x46ccfb['status'](_0x1aecb8)[_0x21c6('0x19')]();};}function respondWithResult(_0xbcddc3,_0x543a27){_0x543a27=_0x543a27||0xc8;return function(_0x3af830){if(_0x3af830){return _0xbcddc3[_0x21c6('0x1a')](_0x543a27)[_0x21c6('0x1b')](_0x3af830);}};}function respondWithFilteredResult(_0x150434,_0x2bea4e){return function(_0x24b4d2){if(_0x24b4d2){var _0x19f78e=typeof _0x2bea4e[_0x21c6('0x1c')]==='undefined'&&typeof _0x2bea4e['limit']==='undefined';var _0x5e0f20=_0x24b4d2[_0x21c6('0x1d')];var _0x556c4d=_0x19f78e?0x0:_0x2bea4e[_0x21c6('0x1c')];var _0x41da6e=_0x19f78e?_0x24b4d2[_0x21c6('0x1d')]:_0x2bea4e[_0x21c6('0x1c')]+_0x2bea4e[_0x21c6('0x1e')];var _0x281efa;if(_0x41da6e>=_0x5e0f20){_0x41da6e=_0x5e0f20;_0x281efa=0xc8;}else{_0x281efa=0xce;}_0x150434[_0x21c6('0x1a')](_0x281efa);return _0x150434[_0x21c6('0x1f')](_0x21c6('0x20'),_0x556c4d+'-'+_0x41da6e+'/'+_0x5e0f20)[_0x21c6('0x1b')](_0x24b4d2);}return null;};}function patchUpdates(_0x5517cd){return function(_0x4d8208){try{jsonpatch['apply'](_0x4d8208,_0x5517cd,!![]);}catch(_0x23df7f){return BPromise[_0x21c6('0x21')](_0x23df7f);}return _0x4d8208[_0x21c6('0x22')]();};}function saveUpdates(_0x100963,_0x1a3c25){return function(_0x19442a){if(_0x19442a){return _0x19442a[_0x21c6('0x23')](_0x100963)['then'](function(_0x20d1c8){return _0x20d1c8;});}return null;};}function removeEntity(_0x3f1c25,_0x2024d0){return function(_0x4aca9e){if(_0x4aca9e){return _0x4aca9e[_0x21c6('0x24')]()[_0x21c6('0x25')](function(){_0x3f1c25[_0x21c6('0x1a')](0xcc)[_0x21c6('0x19')]();});}};}function handleEntityNotFound(_0x4b4f48,_0xebbeab){return function(_0x5525fc){if(!_0x5525fc){_0x4b4f48['sendStatus'](0x194);}return _0x5525fc;};}function handleError(_0x5c93b0,_0x18ec33){_0x18ec33=_0x18ec33||0x1f4;return function(_0x13448d){logger[_0x21c6('0x26')](_0x13448d['stack']);if(_0x13448d[_0x21c6('0x27')]){delete _0x13448d[_0x21c6('0x27')];}_0x5c93b0[_0x21c6('0x1a')](_0x18ec33)[_0x21c6('0x28')](_0x13448d);};}exports['index']=function(_0x25b133,_0x5a67ff){var _0x3764d7={},_0x27b44f={},_0x3e782b={'count':0x0,'rows':[]};var _0x250b92=_[_0x21c6('0x29')](db['VoiceTransferReport'][_0x21c6('0x2a')],function(_0xe7ee2){return{'name':_0xe7ee2[_0x21c6('0x2b')],'type':_0xe7ee2[_0x21c6('0x2c')][_0x21c6('0x2d')]};});_0x27b44f[_0x21c6('0x2e')]=_[_0x21c6('0x29')](_0x250b92,'name');_0x27b44f[_0x21c6('0x2f')]=_[_0x21c6('0x30')](_0x25b133[_0x21c6('0x2f')]);_0x27b44f[_0x21c6('0x31')]=_[_0x21c6('0x32')](_0x27b44f[_0x21c6('0x2e')],_0x27b44f['query']);_0x3764d7['attributes']=_['intersection'](_0x27b44f[_0x21c6('0x2e')],qs[_0x21c6('0x33')](_0x25b133[_0x21c6('0x2f')][_0x21c6('0x33')]));_0x3764d7[_0x21c6('0x34')]=_0x3764d7['attributes'][_0x21c6('0x35')]?_0x3764d7['attributes']:_0x27b44f[_0x21c6('0x2e')];if(!_0x25b133[_0x21c6('0x2f')][_0x21c6('0x36')](_0x21c6('0x37'))){_0x3764d7[_0x21c6('0x1e')]=qs[_0x21c6('0x1e')](_0x25b133[_0x21c6('0x2f')][_0x21c6('0x1e')]);_0x3764d7['offset']=qs[_0x21c6('0x1c')](_0x25b133[_0x21c6('0x2f')]['offset']);}_0x3764d7[_0x21c6('0x38')]=qs[_0x21c6('0x39')](_0x25b133['query'][_0x21c6('0x39')]);_0x3764d7[_0x21c6('0x3a')]=qs['filters'](_[_0x21c6('0x3b')](_0x25b133[_0x21c6('0x2f')],_0x27b44f[_0x21c6('0x31')]),_0x250b92);if(_0x25b133[_0x21c6('0x2f')][_0x21c6('0x3c')]){_0x3764d7[_0x21c6('0x3a')]=_[_0x21c6('0x3d')](_0x3764d7[_0x21c6('0x3a')],{'$or':_[_0x21c6('0x29')](_0x250b92,function(_0x68db7e){if(_0x68db7e['type']!==_0x21c6('0x3e')){var _0x42f649={};_0x42f649[_0x68db7e[_0x21c6('0x27')]]={'$like':'%'+_0x25b133[_0x21c6('0x2f')]['filter']+'%'};return _0x42f649;}})});}_0x3764d7=_[_0x21c6('0x3d')]({},_0x3764d7,_0x25b133[_0x21c6('0x3f')]);var _0x4bf638={'where':_0x3764d7[_0x21c6('0x3a')]};return db[_0x21c6('0x40')]['count'](_0x4bf638)['then'](function(_0x3d90a7){_0x3e782b['count']=_0x3d90a7;if(_0x25b133['query'][_0x21c6('0x41')]){_0x3764d7[_0x21c6('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x21c6('0x43')](_0x3764d7);})[_0x21c6('0x25')](function(_0x572d56){_0x3e782b[_0x21c6('0x44')]=_0x572d56;return _0x3e782b;})['then'](respondWithFilteredResult(_0x5a67ff,_0x3764d7))['catch'](handleError(_0x5a67ff,null));};exports[_0x21c6('0x45')]=function(_0x27edb9,_0x3fb6e3){var _0x5eb0d1={'raw':!![],'where':{'id':_0x27edb9[_0x21c6('0x46')]['id']}},_0x499e03={};_0x499e03[_0x21c6('0x2e')]=_[_0x21c6('0x30')](db[_0x21c6('0x40')][_0x21c6('0x2a')]);_0x499e03[_0x21c6('0x2f')]=_['keys'](_0x27edb9[_0x21c6('0x2f')]);_0x499e03[_0x21c6('0x31')]=_['intersection'](_0x499e03[_0x21c6('0x2e')],_0x499e03['query']);_0x5eb0d1[_0x21c6('0x34')]=_[_0x21c6('0x32')](_0x499e03[_0x21c6('0x2e')],qs[_0x21c6('0x33')](_0x27edb9[_0x21c6('0x2f')]['fields']));_0x5eb0d1['attributes']=_0x5eb0d1['attributes'][_0x21c6('0x35')]?_0x5eb0d1['attributes']:_0x499e03[_0x21c6('0x2e')];if(_0x27edb9[_0x21c6('0x2f')][_0x21c6('0x41')]){_0x5eb0d1['include']=[{'all':!![]}];}_0x5eb0d1=_['merge']({},_0x5eb0d1,_0x27edb9[_0x21c6('0x3f')]);return db[_0x21c6('0x40')]['find'](_0x5eb0d1)[_0x21c6('0x25')](handleEntityNotFound(_0x3fb6e3,null))[_0x21c6('0x25')](respondWithResult(_0x3fb6e3,null))[_0x21c6('0x47')](handleError(_0x3fb6e3,null));};exports[_0x21c6('0x48')]=function(_0x266682,_0x2717d5){return db[_0x21c6('0x40')][_0x21c6('0x48')](_0x266682['body'],{})['then'](respondWithResult(_0x2717d5,0xc9))[_0x21c6('0x47')](handleError(_0x2717d5,null));};exports['update']=function(_0x516059,_0x196603){if(_0x516059[_0x21c6('0x49')]['id']){delete _0x516059['body']['id'];}return db[_0x21c6('0x40')][_0x21c6('0x4a')]({'where':{'id':_0x516059[_0x21c6('0x46')]['id']}})[_0x21c6('0x25')](handleEntityNotFound(_0x196603,null))['then'](saveUpdates(_0x516059['body'],null))[_0x21c6('0x25')](respondWithResult(_0x196603,null))[_0x21c6('0x47')](handleError(_0x196603,null));};exports['destroy']=function(_0x595b17,_0x55be04){return db['VoiceTransferReport']['find']({'where':{'id':_0x595b17[_0x21c6('0x46')]['id']}})[_0x21c6('0x25')](handleEntityNotFound(_0x55be04,null))[_0x21c6('0x25')](removeEntity(_0x55be04,null))[_0x21c6('0x47')](handleError(_0x55be04,null));};exports[_0x21c6('0x4b')]=function(_0x1ede83,_0x5dc11d){return db['VoiceTransferReport']['describe']()[_0x21c6('0x25')](respondWithResult(_0x5dc11d,null))['catch'](handleError(_0x5dc11d,null));}; \ No newline at end of file +var _0x4ecf=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','findAll','rows','catch','show','find','update','body','params','fast-json-patch','request-promise','moment','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection'];(function(_0x46d79a,_0x3a4d5b){var _0x30aa0e=function(_0x528065){while(--_0x528065){_0x46d79a['push'](_0x46d79a['shift']());}};_0x30aa0e(++_0x3a4d5b);}(_0x4ecf,0xe6));var _0xf4ec=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4ecf[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf4ec('0x0'));var rp=require(_0xf4ec('0x1'));var moment=require(_0xf4ec('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf4ec('0x3'));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(_0xf4ec('0x4'));var crypto=require(_0xf4ec('0x5'));var jsforce=require(_0xf4ec('0x6'));var deskjs=require(_0xf4ec('0x7'));var toCsv=require(_0xf4ec('0x8'));var querystring=require('querystring');var Papa=require(_0xf4ec('0x9'));var Redis=require(_0xf4ec('0xa'));var authService=require(_0xf4ec('0xb'));var qs=require(_0xf4ec('0xc'));var as=require(_0xf4ec('0xd'));var hardwareService=require(_0xf4ec('0xe'));var logger=require(_0xf4ec('0xf'))(_0xf4ec('0x10'));var utils=require(_0xf4ec('0x11'));var config=require(_0xf4ec('0x12'));var licenseUtil=require(_0xf4ec('0x13'));var db=require(_0xf4ec('0x14'))['db'];function respondWithStatusCode(_0xc80233,_0x543b07){_0x543b07=_0x543b07||0xcc;return function(_0x1d851b){if(_0x1d851b){return _0xc80233[_0xf4ec('0x15')](_0x543b07);}return _0xc80233[_0xf4ec('0x16')](_0x543b07)['end']();};}function respondWithResult(_0x50c980,_0xdc92ff){_0xdc92ff=_0xdc92ff||0xc8;return function(_0x21347e){if(_0x21347e){return _0x50c980[_0xf4ec('0x16')](_0xdc92ff)[_0xf4ec('0x17')](_0x21347e);}};}function respondWithFilteredResult(_0x2e7ec3,_0x33625c){return function(_0x188c0f){if(_0x188c0f){var _0x247c67=typeof _0x33625c[_0xf4ec('0x18')]===_0xf4ec('0x19')&&typeof _0x33625c[_0xf4ec('0x1a')]==='undefined';var _0x346de3=_0x188c0f[_0xf4ec('0x1b')];var _0x5bc9ad=_0x247c67?0x0:_0x33625c[_0xf4ec('0x18')];var _0x256971=_0x247c67?_0x188c0f['count']:_0x33625c[_0xf4ec('0x18')]+_0x33625c[_0xf4ec('0x1a')];var _0xb2dd1c;if(_0x256971>=_0x346de3){_0x256971=_0x346de3;_0xb2dd1c=0xc8;}else{_0xb2dd1c=0xce;}_0x2e7ec3[_0xf4ec('0x16')](_0xb2dd1c);return _0x2e7ec3['set'](_0xf4ec('0x1c'),_0x5bc9ad+'-'+_0x256971+'/'+_0x346de3)['json'](_0x188c0f);}return null;};}function patchUpdates(_0x46c490){return function(_0x2de30f){try{jsonpatch['apply'](_0x2de30f,_0x46c490,!![]);}catch(_0x33954e){return BPromise[_0xf4ec('0x1d')](_0x33954e);}return _0x2de30f[_0xf4ec('0x1e')]();};}function saveUpdates(_0x20c274,_0x366895){return function(_0x50578a){if(_0x50578a){return _0x50578a['update'](_0x20c274)[_0xf4ec('0x1f')](function(_0x33b0bf){return _0x33b0bf;});}return null;};}function removeEntity(_0x5b6d95,_0x8d853a){return function(_0x3dc474){if(_0x3dc474){return _0x3dc474[_0xf4ec('0x20')]()[_0xf4ec('0x1f')](function(){_0x5b6d95[_0xf4ec('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd74a,_0x4b427b){return function(_0x3928ee){if(!_0x3928ee){_0x3cd74a[_0xf4ec('0x15')](0x194);}return _0x3928ee;};}function handleError(_0x1547c0,_0x2e7f8b){_0x2e7f8b=_0x2e7f8b||0x1f4;return function(_0x2c88a6){logger['error'](_0x2c88a6['stack']);if(_0x2c88a6['name']){delete _0x2c88a6['name'];}_0x1547c0['status'](_0x2e7f8b)[_0xf4ec('0x21')](_0x2c88a6);};}exports[_0xf4ec('0x22')]=function(_0xad403d,_0x375363){var _0x1324e1={},_0x39913c={},_0x18bf82={'count':0x0,'rows':[]};var _0x2753f3=_[_0xf4ec('0x23')](db['VoiceTransferReport'][_0xf4ec('0x24')],function(_0x112084){return{'name':_0x112084[_0xf4ec('0x25')],'type':_0x112084[_0xf4ec('0x26')][_0xf4ec('0x27')]};});_0x39913c[_0xf4ec('0x28')]=_['map'](_0x2753f3,_0xf4ec('0x29'));_0x39913c[_0xf4ec('0x2a')]=_[_0xf4ec('0x2b')](_0xad403d[_0xf4ec('0x2a')]);_0x39913c[_0xf4ec('0x2c')]=_[_0xf4ec('0x2d')](_0x39913c[_0xf4ec('0x28')],_0x39913c['query']);_0x1324e1[_0xf4ec('0x2e')]=_[_0xf4ec('0x2d')](_0x39913c[_0xf4ec('0x28')],qs['fields'](_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x2f')]));_0x1324e1[_0xf4ec('0x2e')]=_0x1324e1['attributes'][_0xf4ec('0x30')]?_0x1324e1[_0xf4ec('0x2e')]:_0x39913c[_0xf4ec('0x28')];if(!_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x31')](_0xf4ec('0x32'))){_0x1324e1['limit']=qs[_0xf4ec('0x1a')](_0xad403d['query'][_0xf4ec('0x1a')]);_0x1324e1['offset']=qs['offset'](_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x18')]);}_0x1324e1[_0xf4ec('0x33')]=qs[_0xf4ec('0x34')](_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x34')]);_0x1324e1[_0xf4ec('0x35')]=qs[_0xf4ec('0x2c')](_[_0xf4ec('0x36')](_0xad403d[_0xf4ec('0x2a')],_0x39913c[_0xf4ec('0x2c')]),_0x2753f3);if(_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x37')]){_0x1324e1[_0xf4ec('0x35')]=_[_0xf4ec('0x38')](_0x1324e1[_0xf4ec('0x35')],{'$or':_[_0xf4ec('0x23')](_0x2753f3,function(_0xb376f0){if(_0xb376f0[_0xf4ec('0x26')]!==_0xf4ec('0x39')){var _0x801f0c={};_0x801f0c[_0xb376f0[_0xf4ec('0x29')]]={'$like':'%'+_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x37')]+'%'};return _0x801f0c;}})});}_0x1324e1=_[_0xf4ec('0x38')]({},_0x1324e1,_0xad403d[_0xf4ec('0x3a')]);var _0x16fe64={'where':_0x1324e1[_0xf4ec('0x35')]};return db[_0xf4ec('0x3b')]['count'](_0x16fe64)[_0xf4ec('0x1f')](function(_0x145e1b){_0x18bf82[_0xf4ec('0x1b')]=_0x145e1b;if(_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x3c')]){_0x1324e1['include']=[{'all':!![]}];}return db[_0xf4ec('0x3b')][_0xf4ec('0x3d')](_0x1324e1);})[_0xf4ec('0x1f')](function(_0x3e7681){_0x18bf82[_0xf4ec('0x3e')]=_0x3e7681;return _0x18bf82;})[_0xf4ec('0x1f')](respondWithFilteredResult(_0x375363,_0x1324e1))[_0xf4ec('0x3f')](handleError(_0x375363,null));};exports[_0xf4ec('0x40')]=function(_0x1827a4,_0x2b2515){var _0x1b9880={'raw':!![],'where':{'id':_0x1827a4['params']['id']}},_0x43a793={};_0x43a793['model']=_[_0xf4ec('0x2b')](db[_0xf4ec('0x3b')][_0xf4ec('0x24')]);_0x43a793[_0xf4ec('0x2a')]=_[_0xf4ec('0x2b')](_0x1827a4['query']);_0x43a793[_0xf4ec('0x2c')]=_['intersection'](_0x43a793[_0xf4ec('0x28')],_0x43a793[_0xf4ec('0x2a')]);_0x1b9880[_0xf4ec('0x2e')]=_[_0xf4ec('0x2d')](_0x43a793['model'],qs['fields'](_0x1827a4[_0xf4ec('0x2a')][_0xf4ec('0x2f')]));_0x1b9880[_0xf4ec('0x2e')]=_0x1b9880[_0xf4ec('0x2e')][_0xf4ec('0x30')]?_0x1b9880['attributes']:_0x43a793['model'];if(_0x1827a4[_0xf4ec('0x2a')][_0xf4ec('0x3c')]){_0x1b9880['include']=[{'all':!![]}];}_0x1b9880=_['merge']({},_0x1b9880,_0x1827a4[_0xf4ec('0x3a')]);return db[_0xf4ec('0x3b')][_0xf4ec('0x41')](_0x1b9880)['then'](handleEntityNotFound(_0x2b2515,null))[_0xf4ec('0x1f')](respondWithResult(_0x2b2515,null))[_0xf4ec('0x3f')](handleError(_0x2b2515,null));};exports['create']=function(_0x2d8ff7,_0x1a046a){return db['VoiceTransferReport']['create'](_0x2d8ff7['body'],{})[_0xf4ec('0x1f')](respondWithResult(_0x1a046a,0xc9))[_0xf4ec('0x3f')](handleError(_0x1a046a,null));};exports[_0xf4ec('0x42')]=function(_0x24479a,_0x2631ec){if(_0x24479a['body']['id']){delete _0x24479a[_0xf4ec('0x43')]['id'];}return db['VoiceTransferReport'][_0xf4ec('0x41')]({'where':{'id':_0x24479a[_0xf4ec('0x44')]['id']}})[_0xf4ec('0x1f')](handleEntityNotFound(_0x2631ec,null))[_0xf4ec('0x1f')](saveUpdates(_0x24479a[_0xf4ec('0x43')],null))[_0xf4ec('0x1f')](respondWithResult(_0x2631ec,null))['catch'](handleError(_0x2631ec,null));};exports[_0xf4ec('0x20')]=function(_0x3e3708,_0x17c269){return db[_0xf4ec('0x3b')][_0xf4ec('0x41')]({'where':{'id':_0x3e3708[_0xf4ec('0x44')]['id']}})[_0xf4ec('0x1f')](handleEntityNotFound(_0x17c269,null))['then'](removeEntity(_0x17c269,null))[_0xf4ec('0x3f')](handleError(_0x17c269,null));};exports['describe']=function(_0x303c1f,_0x260209){return db[_0xf4ec('0x3b')]['describe']()[_0xf4ec('0x1f')](respondWithResult(_0x260209,null))['catch'](handleError(_0x260209,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 87e4c1a..53db744 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 _0xb995=['../../config/environment','define','report_call_transfer','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2ed507,_0x15b536){var _0x363175=function(_0x3735df){while(--_0x3735df){_0x2ed507['push'](_0x2ed507['shift']());}};_0x363175(++_0x15b536);}(_0xb995,0xf3));var _0x5b99=function(_0x249143,_0x54bdb6){_0x249143=_0x249143-0x0;var _0xd3f33=_0xb995[_0x249143];return _0xd3f33;};'use strict';var _=require(_0x5b99('0x0'));var util=require(_0x5b99('0x1'));var logger=require('../../config/logger')(_0x5b99('0x2'));var moment=require('moment');var BPromise=require(_0x5b99('0x3'));var rp=require(_0x5b99('0x4'));var fs=require('fs');var path=require(_0x5b99('0x5'));var rimraf=require(_0x5b99('0x6'));var config=require(_0x5b99('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x2f4be5,_0x560750){return _0x2f4be5[_0x5b99('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x5b99('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc296=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0xc296,0x1c3));var _0x6c29=function(_0x161d0c,_0x337272){_0x161d0c=_0x161d0c-0x0;var _0x53518f=_0xc296[_0x161d0c];return _0x53518f;};'use strict';var _=require(_0x6c29('0x0'));var util=require(_0x6c29('0x1'));var logger=require(_0x6c29('0x2'))(_0x6c29('0x3'));var moment=require(_0x6c29('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c29('0x5'));var rimraf=require(_0x6c29('0x6'));var config=require(_0x6c29('0x7'));var attributes=require(_0x6c29('0x8'));module['exports']=function(_0x368817,_0xbddb8c){return _0x368817[_0x6c29('0x9')](_0x6c29('0xa'),attributes,{'tableName':_0x6c29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 8e18252..a0a0d91 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 _0x7ed6=['options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','VoiceTransferReport,\x20%s,\x20%s','info','result','CreateVoiceTransferReport','VoiceTransferReport','create'];(function(_0x3e4295,_0x3ebdd7){var _0x57f4ac=function(_0xbe15a6){while(--_0xbe15a6){_0x3e4295['push'](_0x3e4295['shift']());}};_0x57f4ac(++_0x3ebdd7);}(_0x7ed6,0xab));var _0x67ed=function(_0x21b41e,_0x2e16f2){_0x21b41e=_0x21b41e-0x0;var _0x49ca2d=_0x7ed6[_0x21b41e];return _0x49ca2d;};'use strict';var _=require(_0x67ed('0x0'));var util=require('util');var moment=require(_0x67ed('0x1'));var BPromise=require(_0x67ed('0x2'));var rs=require(_0x67ed('0x3'));var fs=require('fs');var Redis=require(_0x67ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x67ed('0x5'));var logger=require('../../config/logger')(_0x67ed('0x6'));var config=require(_0x67ed('0x7'));var jayson=require(_0x67ed('0x8'));var client=jayson['client'][_0x67ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4df5e7,_0x273520,_0x4d2eea){return new BPromise(function(_0x4584e3,_0x186044){return client[_0x67ed('0xa')](_0x4df5e7,_0x4d2eea)[_0x67ed('0xb')](function(_0x1fd11c){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x273520,_0x67ed('0xc'));logger[_0x67ed('0xd')](_0x67ed('0xe'),_0x273520,_0x67ed('0xc'),JSON[_0x67ed('0xf')](_0x1fd11c));if(_0x1fd11c['error']){if(_0x1fd11c['error'][_0x67ed('0x10')]===0x1f4){logger[_0x67ed('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x273520,_0x1fd11c[_0x67ed('0x11')][_0x67ed('0x12')]);return _0x186044(_0x1fd11c['error'][_0x67ed('0x12')]);}logger[_0x67ed('0x11')](_0x67ed('0x13'),_0x273520,_0x1fd11c[_0x67ed('0x11')][_0x67ed('0x12')]);return _0x4584e3(_0x1fd11c[_0x67ed('0x11')][_0x67ed('0x12')]);}else{logger[_0x67ed('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x273520,_0x67ed('0xc'));_0x4584e3(_0x1fd11c[_0x67ed('0x15')]['message']);}})['catch'](function(_0x45f55e){logger[_0x67ed('0x11')](_0x67ed('0x13'),_0x273520,_0x45f55e);_0x186044(_0x45f55e);});});}exports[_0x67ed('0x16')]=function(_0x3716b3){var _0x47b491=this;return new Promise(function(_0x459a44,_0x34cac8){return db[_0x67ed('0x17')][_0x67ed('0x18')](_0x3716b3['body'],{'raw':_0x3716b3[_0x67ed('0x19')]?_0x3716b3[_0x67ed('0x19')][_0x67ed('0x1a')]===undefined?!![]:![]:!![]})[_0x67ed('0xb')](function(_0x386ce7){logger[_0x67ed('0x14')](_0x67ed('0x16'),_0x3716b3);logger['debug'](_0x67ed('0x16'),_0x3716b3,JSON[_0x67ed('0xf')](_0x386ce7));_0x459a44(_0x386ce7);})[_0x67ed('0x1b')](function(_0x42cf78){logger[_0x67ed('0x11')]('CreateVoiceTransferReport',_0x42cf78[_0x67ed('0x12')],_0x3716b3);_0x34cac8(_0x47b491['error'](0x1f4,_0x42cf78['message']));});});}; \ No newline at end of file +var _0xbc12=['jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','bluebird','ioredis','../../config/logger','../../config/environment'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xbc12,0x19a));var _0x2bc1=function(_0x221246,_0x168ceb){_0x221246=_0x221246-0x0;var _0x13e1ea=_0xbc12[_0x221246];return _0x13e1ea;};'use strict';var _=require(_0x2bc1('0x0'));var util=require(_0x2bc1('0x1'));var moment=require('moment');var BPromise=require(_0x2bc1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bc1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2bc1('0x4'))('rpc');var config=require(_0x2bc1('0x5'));var jayson=require(_0x2bc1('0x6'));var client=jayson['client'][_0x2bc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fa9ae,_0x252781,_0xfa384b){return new BPromise(function(_0x461f77,_0x2485dc){return client[_0x2bc1('0x8')](_0x3fa9ae,_0xfa384b)[_0x2bc1('0x9')](function(_0x27ccf2){logger[_0x2bc1('0xa')](_0x2bc1('0xb'),_0x252781,_0x2bc1('0xc'));logger[_0x2bc1('0xd')](_0x2bc1('0xe'),_0x252781,_0x2bc1('0xc'),JSON[_0x2bc1('0xf')](_0x27ccf2));if(_0x27ccf2[_0x2bc1('0x10')]){if(_0x27ccf2[_0x2bc1('0x10')][_0x2bc1('0x11')]===0x1f4){logger[_0x2bc1('0x10')](_0x2bc1('0xb'),_0x252781,_0x27ccf2['error'][_0x2bc1('0x12')]);return _0x2485dc(_0x27ccf2['error'][_0x2bc1('0x12')]);}logger[_0x2bc1('0x10')](_0x2bc1('0xb'),_0x252781,_0x27ccf2[_0x2bc1('0x10')][_0x2bc1('0x12')]);return _0x461f77(_0x27ccf2[_0x2bc1('0x10')][_0x2bc1('0x12')]);}else{logger['info'](_0x2bc1('0xb'),_0x252781,_0x2bc1('0xc'));_0x461f77(_0x27ccf2['result'][_0x2bc1('0x12')]);}})[_0x2bc1('0x13')](function(_0x5b1bfd){logger[_0x2bc1('0x10')](_0x2bc1('0xb'),_0x252781,_0x5b1bfd);_0x2485dc(_0x5b1bfd);});});}exports[_0x2bc1('0x14')]=function(_0x42a57c){var _0x14afc9=this;return new Promise(function(_0x3b8128,_0x33e24b){return db[_0x2bc1('0x15')][_0x2bc1('0x16')](_0x42a57c[_0x2bc1('0x17')],{'raw':_0x42a57c['options']?_0x42a57c[_0x2bc1('0x18')][_0x2bc1('0x19')]===undefined?!![]:![]:!![]})[_0x2bc1('0x9')](function(_0x2e97f0){logger[_0x2bc1('0xa')](_0x2bc1('0x14'),_0x42a57c);logger['debug'](_0x2bc1('0x14'),_0x42a57c,JSON[_0x2bc1('0xf')](_0x2e97f0));_0x3b8128(_0x2e97f0);})[_0x2bc1('0x13')](function(_0x5b595f){logger[_0x2bc1('0x10')]('CreateVoiceTransferReport',_0x5b595f[_0x2bc1('0x12')],_0x42a57c);_0x33e24b(_0x14afc9[_0x2bc1('0x10')](0x1f4,_0x5b595f[_0x2bc1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c9e21e1..608852f 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 _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x70e0,0x17b));var _0x070e=function(_0x38a330,_0x2ac95e){_0x38a330=_0x38a330-0x0;var _0x2ecd14=_0x70e0[_0x38a330];return _0x2ecd14;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x750a=['Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x5bf18d,_0x264c55){var _0x1d6cc0=function(_0x2d69d9){while(--_0x2d69d9){_0x5bf18d['push'](_0x5bf18d['shift']());}};_0x1d6cc0(++_0x264c55);}(_0x750a,0x140));var _0xa750=function(_0x4eeb05,_0xd22898){_0x4eeb05=_0x4eeb05-0x0;var _0x313626=_0x750a[_0x4eeb05];return _0x313626;};'use strict';var express=require('express');var router=express[_0xa750('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xa750('0x1')](_0xa750('0x2'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x5')]);router[_0xa750('0x1')](_0xa750('0x6'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x7')]);router[_0xa750('0x1')](_0xa750('0x8'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xa750('0x1')]('/hold',auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller['hold']);router[_0xa750('0x1')](_0xa750('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xa750('0xa')]);router['post'](_0xa750('0xb'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller[_0xa750('0xc')]);router[_0xa750('0x1')](_0xa750('0xd'),auth['isAuthenticated'](),auth[_0xa750('0x4')](),controller[_0xa750('0xe')]);module[_0xa750('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 9afd6a9..0829061 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 _0x0f9f=['hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','name','status','send','NotFound','then','code','message','result','catch','User','agent','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate\x20fired:','body','length','json','userId','callNumber','callerId','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','validate','webbar:answer','answer\x20executed!'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x49c69c,_0x2e6150){_0x49c69c=_0x49c69c-0x0;var _0x55cdd2=_0x0f9f[_0x49c69c];return _0x55cdd2;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf0f9('0x0'));var db=require(_0xf0f9('0x1'))['db'];var config=require(_0xf0f9('0x2'));var util=require('util');var BPromise=require(_0xf0f9('0x3'));var jayson=require(_0xf0f9('0x4'));var amiClient=jayson[_0xf0f9('0x5')][_0xf0f9('0x6')]({'port':0x232a});var logger=require(_0xf0f9('0x7'))(_0xf0f9('0x8'));var Redis=require(_0xf0f9('0x9'));config[_0xf0f9('0xa')]=_[_0xf0f9('0xb')](config[_0xf0f9('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf0f9('0xc'))(new Redis(config[_0xf0f9('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'callNumber':{'type':_0xf0f9('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xf0f9('0xf')},'callbackUrl':{'type':_0xf0f9('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':[!![],_0xf0f9('0x10')]},'transferNumber':{'type':'string','required':[!![],_0xf0f9('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf0f9('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf0f9('0xd'),'required':[!![],_0xf0f9('0xe')]}});function emit(_0x2f5bec,_0x2f75da,_0x16a928){logger[_0xf0f9('0x12')](_0x2f5bec,_0x2f75da,JSON[_0xf0f9('0x13')](_0x16a928));io['to'](_0x2f5bec)['emit'](_0x2f75da,_0x16a928);}function handleError(_0x526fff){return function(_0x350a48){console[_0xf0f9('0x14')]('handleError:',_0x350a48,_0x350a48 instanceof RangeError);logger[_0xf0f9('0x15')](_0x350a48['stack']);if(_0x350a48 instanceof RangeError){if(_0x350a48['name']){delete _0x350a48[_0xf0f9('0x16')];}_0x526fff[_0xf0f9('0x17')](0x194)[_0xf0f9('0x18')](_0x350a48);}else{if(_0x350a48[_0xf0f9('0x16')]){delete _0x350a48[_0xf0f9('0x16')];}_0x526fff['status'](0x1f4)['send'](_0x350a48);}};}function checkError(){return function(_0x5294ac){if(!_0x5294ac){throw new RangeError(_0xf0f9('0x19'));}return _0x5294ac;};}function respondWithRpcPromise(_0x1c8c39,_0x126ba7){return new BPromise(function(_0x5d87a9,_0x4a8726){var _0x209cd4=amiClient;return _0x209cd4['request'](_0x1c8c39,_0x126ba7)[_0xf0f9('0x1a')](function(_0x414f87){if(_0x414f87[_0xf0f9('0x15')]){if(_0x414f87['error'][_0xf0f9('0x1b')]===0x1f4){return _0x4a8726(_0x414f87[_0xf0f9('0x15')][_0xf0f9('0x1c')]);}return _0x5d87a9(_0x414f87['error'][_0xf0f9('0x1c')]);}else{_0x5d87a9(_0x414f87[_0xf0f9('0x1d')]);}})[_0xf0f9('0x1e')](function(_0x185e1e){_0x4a8726(_0x185e1e);});});}function getAgent(_0x16f639){return db[_0xf0f9('0x1f')]['findOne']({'where':{'id':_0x16f639,'role':_0xf0f9('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x1288e0,_0x30e85c){return new BPromise(function(_0x519a46,_0x4b75b2){var _0x119793=respondWithRpcPromise('VoiceChannels');var _0x2121b8=getAgent(_0x1288e0);Promise[_0xf0f9('0x21')]([_0x119793,_0x2121b8])[_0xf0f9('0x1a')](function(_0x353502){var _0x3ec658=_0x353502[0x0];var _0x39cd34=_0x353502[0x1];var _0x1377ed=_[_0xf0f9('0x22')](_0x3ec658[_0xf0f9('0x23')],function(_0x4e4e08){return _0x4e4e08[_0xf0f9('0x24')]==_0x39cd34['id']&&_0x4e4e08[_0xf0f9('0x25')]==_0x30e85c;});if(_0x1377ed['length']==0x1){_0x519a46(_0x39cd34);}else{_0x4b75b2(new RangeError('sessionId\x20'+_0x30e85c+_0xf0f9('0x26')));}});});}exports['originate']=function(_0x483a8c,_0x14f3cb){logger['info'](_0xf0f9('0x27'),_0x483a8c[_0xf0f9('0x28')]);var _0x5305e0=originateValidation['validate'](_0x483a8c[_0xf0f9('0x28')]);if(_0x5305e0[_0xf0f9('0x29')]>0x0){return _0x14f3cb[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x5305e0);}var _0x278192=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x30bc8e=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2c')];var _0x2a7648=_0x483a8c[_0xf0f9('0x28')][_0xf0f9('0x2d')];var _0x5a8b35=_0x483a8c[_0xf0f9('0x28')]['callbackUrl'];return getAgent(_0x278192)[_0xf0f9('0x1a')](function(_0x44c9ed){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x44c9ed[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x44c9ed['name']),'webbar:originate',{'callNumber':_0x30bc8e,'callerId':_0x2a7648,'callbackUrl':_0x5a8b35});return _0x14f3cb[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x31')});})[_0xf0f9('0x1e')](handleError(_0x14f3cb));};exports[_0xf0f9('0x32')]=function(_0x4ac1d2,_0x2b9d56){logger[_0xf0f9('0x12')](_0xf0f9('0x33'),_0x4ac1d2[_0xf0f9('0x28')]);var _0x32a248=hangupValidation['validate'](_0x4ac1d2[_0xf0f9('0x28')]);if(_0x32a248[_0xf0f9('0x29')]>0x0){return _0x2b9d56[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x32a248);}var _0x7cf75a=_0x4ac1d2[_0xf0f9('0x28')]['userId'];var _0x3a0f27=_0x4ac1d2[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x7cf75a)['then'](function(_0x3b52e3){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x3b52e3[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x3b52e3[_0xf0f9('0x16')]),_0xf0f9('0x34'),{'sessionId':_0x3a0f27});return _0x2b9d56[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x35')});})[_0xf0f9('0x1e')](handleError(_0x2b9d56));};exports[_0xf0f9('0x36')]=function(_0x5153b5,_0x4ff1f0){logger[_0xf0f9('0x12')]('answer\x20fired:',_0x5153b5['body']);var _0x4e8234=answerValidation[_0xf0f9('0x37')](_0x5153b5[_0xf0f9('0x28')]);if(_0x4e8234[_0xf0f9('0x29')]>0x0){return _0x4ff1f0[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x4e8234);}var _0xfef8ad=_0x5153b5[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x1a3a6b=_0x5153b5['body'][_0xf0f9('0x25')];return getAgent(_0xfef8ad)[_0xf0f9('0x1a')](function(_0x434fc1){logger['info'](_0xf0f9('0x2e'),_0x434fc1[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')]('user:%s',_0x434fc1[_0xf0f9('0x16')]),_0xf0f9('0x38'),{'sessionId':_0x1a3a6b});return _0x4ff1f0['status'](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x39')});})[_0xf0f9('0x1e')](handleError(_0x4ff1f0));};exports[_0xf0f9('0x3a')]=function(_0x4be16e,_0x35bcf8){logger[_0xf0f9('0x12')](_0xf0f9('0x3b'),_0x4be16e[_0xf0f9('0x28')]);var _0x226bda=holdValidation[_0xf0f9('0x37')](_0x4be16e['body']);if(_0x226bda[_0xf0f9('0x29')]>0x0){return _0x35bcf8['status'](0x190)[_0xf0f9('0x2a')](_0x226bda);}var _0x38956b=_0x4be16e[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x44b00d=_0x4be16e[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x38956b)[_0xf0f9('0x1a')](function(_0x1f47fa){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0x1f47fa[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x1f47fa[_0xf0f9('0x16')]),_0xf0f9('0x3c'),{'sessionId':_0x44b00d});return _0x35bcf8[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x3d')});})[_0xf0f9('0x1e')](handleError(_0x35bcf8));};exports[_0xf0f9('0x3e')]=function(_0x40711c,_0x3db0b2){logger[_0xf0f9('0x12')]('unhold\x20fired:',_0x40711c['body']);var _0x2eb8b4=unholdValidation['validate'](_0x40711c[_0xf0f9('0x28')]);if(_0x2eb8b4[_0xf0f9('0x29')]>0x0){return _0x3db0b2[_0xf0f9('0x17')](0x190)['json'](_0x2eb8b4);}var _0x2b2604=_0x40711c['body'][_0xf0f9('0x2b')];var _0x603804=_0x40711c[_0xf0f9('0x28')][_0xf0f9('0x25')];return getAgent(_0x2b2604)[_0xf0f9('0x1a')](function(_0x593b54){logger[_0xf0f9('0x12')]('entityFound:',_0x593b54[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0x593b54[_0xf0f9('0x16')]),_0xf0f9('0x3f'),{'sessionId':_0x603804});return _0x3db0b2['status'](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x40')});})[_0xf0f9('0x1e')](handleError(_0x3db0b2));};exports[_0xf0f9('0x41')]=function(_0x1dbc9d,_0x2a8aae){logger[_0xf0f9('0x12')](_0xf0f9('0x42'),_0x2a8aae[_0xf0f9('0x28')]);var _0x406b45=callsValidation[_0xf0f9('0x37')](_0x1dbc9d[_0xf0f9('0x28')]);if(_0x406b45[_0xf0f9('0x29')]>0x0){return _0x2a8aae[_0xf0f9('0x17')](0x190)['json'](_0x406b45);}var _0x329b59=_0x1dbc9d[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x59d7bd=respondWithRpcPromise(_0xf0f9('0x43'));var _0x32f641=getAgent(_0x329b59);return Promise[_0xf0f9('0x21')]([_0x59d7bd,_0x32f641])[_0xf0f9('0x1a')](function(_0x6979f){var _0x586022=_0x6979f[0x0];var _0x3b1d45=_0x6979f[0x1];var _0x838550=_[_0xf0f9('0x22')](_0x586022[_0xf0f9('0x23')],function(_0x2807f9){return _0x2807f9[_0xf0f9('0x24')]==_0x3b1d45['id'];});return _0x2a8aae[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'count':_0x838550[_0xf0f9('0x29')],'rows':_0x838550});})[_0xf0f9('0x1e')](handleError(_0x2a8aae));};exports['conference']=function(_0x3777ae,_0x3fa078){logger['info'](_0xf0f9('0x44'),_0x3777ae['body']);var _0x3ac206=conferenceValidation[_0xf0f9('0x37')](_0x3777ae[_0xf0f9('0x28')]);if(_0x3ac206['length']>0x0){return _0x3fa078[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x3ac206);}var _0x28879c=_0x3777ae[_0xf0f9('0x28')][_0xf0f9('0x2b')];return getAgent(_0x28879c)[_0xf0f9('0x1a')](function(_0xdb0e6c){logger[_0xf0f9('0x12')](_0xf0f9('0x2e'),_0xdb0e6c[_0xf0f9('0x16')]);emit(util[_0xf0f9('0x2f')](_0xf0f9('0x30'),_0xdb0e6c['name']),_0xf0f9('0x45'));return _0x3fa078[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':_0xf0f9('0x46')});})['catch'](handleError(_0x3fa078));};exports[_0xf0f9('0x47')]=function(_0xb29b92,_0xb47567){logger['info'](_0xf0f9('0x48'),_0xb29b92[_0xf0f9('0x28')]);var _0x56e467=transferValidation[_0xf0f9('0x37')](_0xb29b92[_0xf0f9('0x28')]);if(_0x56e467['length']>0x0){return _0xb47567[_0xf0f9('0x17')](0x190)[_0xf0f9('0x2a')](_0x56e467);}var _0x3d1542=_0xb29b92[_0xf0f9('0x28')][_0xf0f9('0x2b')];var _0x16564d=_0xb29b92[_0xf0f9('0x28')]['sessionId'];var _0x392ffa=_0xb29b92[_0xf0f9('0x28')]['transferNumber'];return getAgent(_0x3d1542)[_0xf0f9('0x1a')](function(_0x539ac6){logger['info'](_0xf0f9('0x2e'),_0x539ac6[_0xf0f9('0x16')]);emit(util['format'](_0xf0f9('0x30'),_0x539ac6['name']),_0xf0f9('0x49'),{'sessionId':_0x16564d,'transferNumber':_0x392ffa});return _0xb47567[_0xf0f9('0x17')](0xc8)[_0xf0f9('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0xf0f9('0x1e')](handleError(_0xb47567));}; \ No newline at end of file +var _0x6f7f=['client','../../config/logger','webbarapi','ioredis','defaults','localhost','socket.io-emitter','redis','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','stack','name','status','send','request','then','error','message','result','User','findOne','agent','VoiceChannels','all','rows','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','webbar:hangup','answer','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird'];(function(_0x34d478,_0x4e5042){var _0x27aff3=function(_0x1ae6b9){while(--_0x1ae6b9){_0x34d478['push'](_0x34d478['shift']());}};_0x27aff3(++_0x4e5042);}(_0x6f7f,0x177));var _0xf6f7=function(_0x2b69f1,_0x3635c5){_0x2b69f1=_0x2b69f1-0x0;var _0x2b1387=_0x6f7f[_0x2b69f1];return _0x2b1387;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf6f7('0x0'));var db=require(_0xf6f7('0x1'))['db'];var config=require(_0xf6f7('0x2'));var util=require(_0xf6f7('0x3'));var BPromise=require(_0xf6f7('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xf6f7('0x5')]['http']({'port':0x232a});var logger=require(_0xf6f7('0x6'))(_0xf6f7('0x7'));var Redis=require(_0xf6f7('0x8'));config['redis']=_[_0xf6f7('0x9')](config['redis'],{'host':_0xf6f7('0xa'),'port':0x18eb});var io=require(_0xf6f7('0xb'))(new Redis(config[_0xf6f7('0xc')]));var Schema=require(_0xf6f7('0xd'));var originateValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],_0xf6f7('0xf')]},'callNumber':{'type':'string','required':[!![],_0xf6f7('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf6f7('0xf')]},'sessionId':{'type':_0xf6f7('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],_0xf6f7('0xf')]},'sessionId':{'type':_0xf6f7('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0xf6f7('0x12')]},'transferNumber':{'type':_0xf6f7('0x11'),'required':[!![],_0xf6f7('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf6f7('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf6f7('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],_0xf6f7('0xf')]}});function emit(_0x2758c0,_0x16cde1,_0x4b8eb2){logger[_0xf6f7('0x14')](_0x2758c0,_0x16cde1,JSON[_0xf6f7('0x15')](_0x4b8eb2));io['to'](_0x2758c0)['emit'](_0x16cde1,_0x4b8eb2);}function handleError(_0x2e5fa3){return function(_0x438e3d){console[_0xf6f7('0x16')](_0xf6f7('0x17'),_0x438e3d,_0x438e3d instanceof RangeError);logger['error'](_0x438e3d[_0xf6f7('0x18')]);if(_0x438e3d instanceof RangeError){if(_0x438e3d[_0xf6f7('0x19')]){delete _0x438e3d['name'];}_0x2e5fa3[_0xf6f7('0x1a')](0x194)[_0xf6f7('0x1b')](_0x438e3d);}else{if(_0x438e3d[_0xf6f7('0x19')]){delete _0x438e3d[_0xf6f7('0x19')];}_0x2e5fa3[_0xf6f7('0x1a')](0x1f4)[_0xf6f7('0x1b')](_0x438e3d);}};}function checkError(){return function(_0x3ec9c4){if(!_0x3ec9c4){throw new RangeError('NotFound');}return _0x3ec9c4;};}function respondWithRpcPromise(_0x138c7e,_0x5b6d3f){return new BPromise(function(_0x58ca0f,_0x66e5e4){var _0x532ee4=amiClient;return _0x532ee4[_0xf6f7('0x1c')](_0x138c7e,_0x5b6d3f)[_0xf6f7('0x1d')](function(_0x50b550){if(_0x50b550[_0xf6f7('0x1e')]){if(_0x50b550['error']['code']===0x1f4){return _0x66e5e4(_0x50b550[_0xf6f7('0x1e')][_0xf6f7('0x1f')]);}return _0x58ca0f(_0x50b550[_0xf6f7('0x1e')][_0xf6f7('0x1f')]);}else{_0x58ca0f(_0x50b550[_0xf6f7('0x20')]);}})['catch'](function(_0x4c1ecd){_0x66e5e4(_0x4c1ecd);});});}function getAgent(_0x3fecc1){return db[_0xf6f7('0x21')][_0xf6f7('0x22')]({'where':{'id':_0x3fecc1,'role':_0xf6f7('0x23')}})[_0xf6f7('0x1d')](checkError());}function getAgentCheckSession(_0x2c93c8,_0x4b6e82){return new BPromise(function(_0x49dd11,_0x2c545c){var _0x3a6f6a=respondWithRpcPromise(_0xf6f7('0x24'));var _0x35a384=getAgent(_0x2c93c8);Promise[_0xf6f7('0x25')]([_0x3a6f6a,_0x35a384])[_0xf6f7('0x1d')](function(_0x4b3100){var _0x47f9ef=_0x4b3100[0x0];var _0x4bd86c=_0x4b3100[0x1];var _0x3bd11b=_['filter'](_0x47f9ef[_0xf6f7('0x26')],function(_0x35b586){return _0x35b586['UserId']==_0x4bd86c['id']&&_0x35b586['sessionId']==_0x4b6e82;});if(_0x3bd11b[_0xf6f7('0x27')]==0x1){_0x49dd11(_0x4bd86c);}else{_0x2c545c(new RangeError(_0xf6f7('0x28')+_0x4b6e82+_0xf6f7('0x29')));}});});}exports['originate']=function(_0x2fcb7c,_0x505b20){logger[_0xf6f7('0x14')](_0xf6f7('0x2a'),_0x2fcb7c[_0xf6f7('0x2b')]);var _0x2f2178=originateValidation[_0xf6f7('0xd')](_0x2fcb7c[_0xf6f7('0x2b')]);if(_0x2f2178[_0xf6f7('0x27')]>0x0){return _0x505b20[_0xf6f7('0x1a')](0x190)[_0xf6f7('0x2c')](_0x2f2178);}var _0x174730=_0x2fcb7c[_0xf6f7('0x2b')][_0xf6f7('0x2d')];var _0x5883e3=_0x2fcb7c[_0xf6f7('0x2b')]['callNumber'];var _0x1feb3a=_0x2fcb7c[_0xf6f7('0x2b')][_0xf6f7('0x2e')];var _0x16404d=_0x2fcb7c[_0xf6f7('0x2b')][_0xf6f7('0x2f')];return getAgent(_0x174730)[_0xf6f7('0x1d')](function(_0x16522e){logger[_0xf6f7('0x14')]('entityFound:',_0x16522e['name']);emit(util[_0xf6f7('0x30')](_0xf6f7('0x31'),_0x16522e[_0xf6f7('0x19')]),_0xf6f7('0x32'),{'callNumber':_0x5883e3,'callerId':_0x1feb3a,'callbackUrl':_0x16404d});return _0x505b20[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x33')});})[_0xf6f7('0x34')](handleError(_0x505b20));};exports[_0xf6f7('0x35')]=function(_0x27be8a,_0x332da0){logger[_0xf6f7('0x14')](_0xf6f7('0x36'),_0x27be8a[_0xf6f7('0x2b')]);var _0x12488c=hangupValidation[_0xf6f7('0xd')](_0x27be8a['body']);if(_0x12488c['length']>0x0){return _0x332da0[_0xf6f7('0x1a')](0x190)[_0xf6f7('0x2c')](_0x12488c);}var _0x9dde0a=_0x27be8a[_0xf6f7('0x2b')][_0xf6f7('0x2d')];var _0x2759fd=_0x27be8a['body'][_0xf6f7('0x37')];return getAgent(_0x9dde0a)[_0xf6f7('0x1d')](function(_0x14e4ee){logger[_0xf6f7('0x14')]('entityFound:',_0x14e4ee['name']);emit(util[_0xf6f7('0x30')]('user:%s',_0x14e4ee['name']),_0xf6f7('0x38'),{'sessionId':_0x2759fd});return _0x332da0[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':'hangup\x20executed!'});})[_0xf6f7('0x34')](handleError(_0x332da0));};exports[_0xf6f7('0x39')]=function(_0x3717a0,_0x417716){logger['info'](_0xf6f7('0x3a'),_0x3717a0[_0xf6f7('0x2b')]);var _0x49bfca=answerValidation['validate'](_0x3717a0[_0xf6f7('0x2b')]);if(_0x49bfca['length']>0x0){return _0x417716[_0xf6f7('0x1a')](0x190)['json'](_0x49bfca);}var _0x4c168a=_0x3717a0['body'][_0xf6f7('0x2d')];var _0x2bc188=_0x3717a0[_0xf6f7('0x2b')][_0xf6f7('0x37')];return getAgent(_0x4c168a)['then'](function(_0x8206f8){logger['info'](_0xf6f7('0x3b'),_0x8206f8['name']);emit(util['format'](_0xf6f7('0x31'),_0x8206f8[_0xf6f7('0x19')]),_0xf6f7('0x3c'),{'sessionId':_0x2bc188});return _0x417716['status'](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x3d')});})['catch'](handleError(_0x417716));};exports['hold']=function(_0x1d687c,_0x585d70){logger[_0xf6f7('0x14')]('hold\x20fired:',_0x1d687c['body']);var _0xdd039d=holdValidation['validate'](_0x1d687c[_0xf6f7('0x2b')]);if(_0xdd039d['length']>0x0){return _0x585d70[_0xf6f7('0x1a')](0x190)['json'](_0xdd039d);}var _0x4afd83=_0x1d687c[_0xf6f7('0x2b')][_0xf6f7('0x2d')];var _0x2b1a0c=_0x1d687c[_0xf6f7('0x2b')][_0xf6f7('0x37')];return getAgent(_0x4afd83)[_0xf6f7('0x1d')](function(_0x1d944a){logger[_0xf6f7('0x14')](_0xf6f7('0x3b'),_0x1d944a[_0xf6f7('0x19')]);emit(util[_0xf6f7('0x30')](_0xf6f7('0x31'),_0x1d944a['name']),_0xf6f7('0x3e'),{'sessionId':_0x2b1a0c});return _0x585d70['status'](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x3f')});})[_0xf6f7('0x34')](handleError(_0x585d70));};exports['unhold']=function(_0x142cb4,_0x1cc654){logger[_0xf6f7('0x14')](_0xf6f7('0x40'),_0x142cb4[_0xf6f7('0x2b')]);var _0x54228d=unholdValidation[_0xf6f7('0xd')](_0x142cb4['body']);if(_0x54228d[_0xf6f7('0x27')]>0x0){return _0x1cc654[_0xf6f7('0x1a')](0x190)[_0xf6f7('0x2c')](_0x54228d);}var _0x5f19f2=_0x142cb4['body'][_0xf6f7('0x2d')];var _0x21c3e8=_0x142cb4[_0xf6f7('0x2b')]['sessionId'];return getAgent(_0x5f19f2)[_0xf6f7('0x1d')](function(_0x240ce5){logger[_0xf6f7('0x14')](_0xf6f7('0x3b'),_0x240ce5[_0xf6f7('0x19')]);emit(util[_0xf6f7('0x30')]('user:%s',_0x240ce5[_0xf6f7('0x19')]),_0xf6f7('0x41'),{'sessionId':_0x21c3e8});return _0x1cc654['status'](0xc8)['json']({'error':![],'message':_0xf6f7('0x42')});})[_0xf6f7('0x34')](handleError(_0x1cc654));};exports['calls']=function(_0x208507,_0x5878ff){logger[_0xf6f7('0x14')](_0xf6f7('0x43'),_0x5878ff[_0xf6f7('0x2b')]);var _0xe674ca=callsValidation[_0xf6f7('0xd')](_0x208507[_0xf6f7('0x2b')]);if(_0xe674ca[_0xf6f7('0x27')]>0x0){return _0x5878ff[_0xf6f7('0x1a')](0x190)['json'](_0xe674ca);}var _0x56aad4=_0x208507['body'][_0xf6f7('0x2d')];var _0x2a2fdb=respondWithRpcPromise(_0xf6f7('0x24'));var _0x2986e0=getAgent(_0x56aad4);return Promise['all']([_0x2a2fdb,_0x2986e0])[_0xf6f7('0x1d')](function(_0x4e6415){var _0x117ec1=_0x4e6415[0x0];var _0x10a570=_0x4e6415[0x1];var _0x8065df=_[_0xf6f7('0x44')](_0x117ec1['rows'],function(_0x1e43c4){return _0x1e43c4[_0xf6f7('0x45')]==_0x10a570['id'];});return _0x5878ff[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'count':_0x8065df[_0xf6f7('0x27')],'rows':_0x8065df});})[_0xf6f7('0x34')](handleError(_0x5878ff));};exports[_0xf6f7('0x46')]=function(_0x48d456,_0x4ee370){logger['info'](_0xf6f7('0x47'),_0x48d456[_0xf6f7('0x2b')]);var _0xbc6c20=conferenceValidation[_0xf6f7('0xd')](_0x48d456[_0xf6f7('0x2b')]);if(_0xbc6c20[_0xf6f7('0x27')]>0x0){return _0x4ee370[_0xf6f7('0x1a')](0x190)['json'](_0xbc6c20);}var _0x4a8602=_0x48d456[_0xf6f7('0x2b')][_0xf6f7('0x2d')];return getAgent(_0x4a8602)['then'](function(_0x100e14){logger['info']('entityFound:',_0x100e14[_0xf6f7('0x19')]);emit(util[_0xf6f7('0x30')](_0xf6f7('0x31'),_0x100e14[_0xf6f7('0x19')]),_0xf6f7('0x48'));return _0x4ee370[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x49')});})[_0xf6f7('0x34')](handleError(_0x4ee370));};exports[_0xf6f7('0x4a')]=function(_0x161bb2,_0x12a8e1){logger[_0xf6f7('0x14')]('transfer\x20fired:',_0x161bb2['body']);var _0x7ce53f=transferValidation['validate'](_0x161bb2[_0xf6f7('0x2b')]);if(_0x7ce53f[_0xf6f7('0x27')]>0x0){return _0x12a8e1[_0xf6f7('0x1a')](0x190)['json'](_0x7ce53f);}var _0x1e078d=_0x161bb2[_0xf6f7('0x2b')][_0xf6f7('0x2d')];var _0x188a9a=_0x161bb2['body'][_0xf6f7('0x37')];var _0x350f64=_0x161bb2['body']['transferNumber'];return getAgent(_0x1e078d)[_0xf6f7('0x1d')](function(_0x4a8a51){logger['info'](_0xf6f7('0x3b'),_0x4a8a51['name']);emit(util[_0xf6f7('0x30')](_0xf6f7('0x31'),_0x4a8a51[_0xf6f7('0x19')]),'webbar:transfer',{'sessionId':_0x188a9a,'transferNumber':_0x350f64});return _0x12a8e1[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x4b')});})['catch'](handleError(_0x12a8e1));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8cec78c..48eea44 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 _0x1a37=['get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','addApplications','notify','/:id/send','send','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x1a37[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./whatsappAccount.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x71a3('0xe')]);router[_0x71a3('0xa')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x10')]);router[_0x71a3('0xa')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x12')]);router[_0x71a3('0xa')](_0x71a3('0x13'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x14')]);router[_0x71a3('0x15')]('/',auth[_0x71a3('0xd')](),controller[_0x71a3('0x16')]);router[_0x71a3('0x15')](_0x71a3('0xf'),auth['isAuthenticated'](),controller[_0x71a3('0x17')]);router[_0x71a3('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x71a3('0x18')]);router[_0x71a3('0x15')](_0x71a3('0x19'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1a')]);router[_0x71a3('0x15')]('/:id/applications',auth[_0x71a3('0xd')](),controller[_0x71a3('0x1b')]);router['post']('/:id/notify',controller[_0x71a3('0x1c')]);router[_0x71a3('0x15')](_0x71a3('0x1d'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1e')]);router['put'](_0x71a3('0x1f'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x20')]);router[_0x71a3('0x21')](_0x71a3('0x1f'),auth['isAuthenticated'](),controller[_0x71a3('0x22')]);router['delete'](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x23')]);router[_0x71a3('0x21')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['removeAnswers']);router[_0x71a3('0x21')](_0x71a3('0x19'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x24')]);module[_0x71a3('0x25')]=router; \ No newline at end of file +var _0x33af=['getAnswers','/:id/users','/:id/applications','post','create','addDisposition','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions'];(function(_0x146995,_0x456d3e){var _0x3039eb=function(_0x5659dd){while(--_0x5659dd){_0x146995['push'](_0x146995['shift']());}};_0x3039eb(++_0x456d3e);}(_0x33af,0xec));var _0xf33a=function(_0x39d9ec,_0x4ed6e5){_0x39d9ec=_0x39d9ec-0x0;var _0x499ff0=_0x33af[_0x39d9ec];return _0x499ff0;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/canned_answers',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x8')](_0xf33a('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xf33a('0x13')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x13')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x13')]('/:id/canned_answers',auth[_0xf33a('0xb')](),controller['addAnswer']);router[_0xf33a('0x13')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x16')]);router[_0xf33a('0x13')]('/:id/applications',auth[_0xf33a('0xb')](),controller[_0xf33a('0x17')]);router[_0xf33a('0x13')](_0xf33a('0x18'),controller['notify']);router[_0xf33a('0x13')](_0xf33a('0x19'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x1b')](_0xf33a('0x1c'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1d')]);router[_0xf33a('0x1e')](_0xf33a('0x1c'),auth['isAuthenticated'](),controller[_0xf33a('0x1f')]);router[_0xf33a('0x1e')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x20')]);router['delete'](_0xf33a('0x21'),auth['isAuthenticated'](),controller[_0xf33a('0x22')]);router[_0xf33a('0x1e')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 0ab4f4d..ddf5198 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 _0xccf3=['sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','twilio'];(function(_0x1ca4cc,_0x402c23){var _0x108010=function(_0x4c5082){while(--_0x4c5082){_0x1ca4cc['push'](_0x1ca4cc['shift']());}};_0x108010(++_0x402c23);}(_0xccf3,0x132));var _0x3ccf=function(_0x580347,_0x844ba6){_0x580347=_0x580347-0x0;var _0x2492b8=_0xccf3[_0x580347];return _0x2492b8;};'use strict';var Sequelize=require(_0x3ccf('0x0'));var rs=require('randomstring');module[_0x3ccf('0x1')]={'name':{'type':Sequelize[_0x3ccf('0x2')],'unique':_0x3ccf('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x3ccf('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x3ccf('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3ccf('0x4')]();}},'phone':{'type':Sequelize[_0x3ccf('0x2')]},'type':{'type':Sequelize['ENUM'](_0x3ccf('0x5'),_0x3ccf('0x6'))},'accountSid':{'type':Sequelize[_0x3ccf('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3ccf('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3ccf('0x7');}},'notificationSound':{'type':Sequelize[_0x3ccf('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3ccf('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3ccf('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3ccf('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3ccf('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3ccf('0x9')],'comment':_0x3ccf('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x3ccf('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3aa0cf){if(!_0x3aa0cf){this['setDataValue'](_0x3ccf('0xb'),null);}this['setDataValue'](_0x3ccf('0xc'),_0x3aa0cf);}},'description':{'type':Sequelize[_0x3ccf('0x2')]}}; \ No newline at end of file +var _0x91ff=['STRING','name','generate','ENUM','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91ff,0xd0));var _0xf91f=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x91ff[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0xf91f('0x0'));var rs=require(_0xf91f('0x1'));module['exports']={'name':{'type':Sequelize[_0xf91f('0x2')],'unique':_0xf91f('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf91f('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xf91f('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf91f('0x4')]();}},'phone':{'type':Sequelize[_0xf91f('0x2')]},'type':{'type':Sequelize[_0xf91f('0x5')]('twilio',_0xf91f('0x6'))},'accountSid':{'type':Sequelize[_0xf91f('0x2')]},'baseUrl':{'type':Sequelize[_0xf91f('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf91f('0x7');}},'notificationSound':{'type':Sequelize[_0xf91f('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf91f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf91f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf91f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf91f('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf91f('0xa'),'set':function(_0x47b53d){if(!_0x47b53d){this['setDataValue'](_0xf91f('0xb'),null);}this[_0xf91f('0xc')](_0xf91f('0xd'),_0x47b53d);}},'description':{'type':Sequelize[_0xf91f('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ddf83d8..7579a09 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 _0x8344=['update','get','end','name','send','index','map','WhatsappAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','keys','includeAll','user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','body','find','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','addAnswer','CannedAnswer','getAnswers','nolimit','pick','removeAnswers','ids','addAgents','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','Transaction','READ_COMMITTED','WhatsappApplication','destroy','bulkCreate','findAndCountAll','priority','stack','getApplications','notify','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','Applications','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','list','omit','Contacts','WhatsappInteraction','interaction','created','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','Messages','dataValues','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save'];(function(_0x3c749e,_0x4b7c88){var _0x4195c3=function(_0x314bb9){while(--_0x314bb9){_0x3c749e['push'](_0x3c749e['shift']());}};_0x4195c3(++_0x4b7c88);}(_0x8344,0x8f));var _0x4834=function(_0x43e7a6,_0x188b82){_0x43e7a6=_0x43e7a6-0x0;var _0x24b017=_0x8344[_0x43e7a6];return _0x24b017;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4834('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4834('0x1'));var BPromise=require(_0x4834('0x2'));var Mustache=require(_0x4834('0x3'));var util=require(_0x4834('0x4'));var path=require(_0x4834('0x5'));var sox=require(_0x4834('0x6'));var csv=require(_0x4834('0x7'));var ejs=require(_0x4834('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4834('0x9'));var squel=require('squel');var crypto=require(_0x4834('0xa'));var jsforce=require(_0x4834('0xb'));var deskjs=require(_0x4834('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4834('0xd'));var Redis=require('ioredis');var authService=require(_0x4834('0xe'));var qs=require(_0x4834('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4834('0x10'));var logger=require(_0x4834('0x11'))(_0x4834('0x12'));var utils=require(_0x4834('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4834('0x14'));var db=require('../../mysqldb')['db'];config[_0x4834('0x15')]=_[_0x4834('0x16')](config['redis'],{'host':_0x4834('0x17'),'port':0x18eb});var socket=require(_0x4834('0x18'))(new Redis(config[_0x4834('0x15')]));require(_0x4834('0x19'))[_0x4834('0x1a')](socket);var jayson=require(_0x4834('0x1b'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1d1f54,_0x1d7738,_0x2c1341,_0x5d4b66){return new BPromise(function(_0x190492,_0x3cf8d1){var _0x5ddc62=_0x5d4b66||client;return _0x5ddc62[_0x4834('0x1c')](_0x1d1f54,_0x2c1341)[_0x4834('0x1d')](function(_0x1b6069){logger['info'](_0x4834('0x1e'),_0x1d7738,_0x4834('0x1f'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1d7738,_0x4834('0x1f'),JSON[_0x4834('0x20')](_0x1b6069));if(_0x1b6069[_0x4834('0x21')]){if(_0x1b6069[_0x4834('0x21')][_0x4834('0x22')]===0x1f4){logger[_0x4834('0x21')](_0x4834('0x1e'),_0x1d7738,_0x1b6069[_0x4834('0x21')][_0x4834('0x23')]);return _0x3cf8d1(_0x1b6069[_0x4834('0x21')]['message']);}logger[_0x4834('0x21')](_0x4834('0x1e'),_0x1d7738,_0x1b6069[_0x4834('0x21')][_0x4834('0x23')]);return _0x190492(_0x1b6069[_0x4834('0x21')][_0x4834('0x23')]);}else{logger[_0x4834('0x24')](_0x4834('0x1e'),_0x1d7738,_0x4834('0x1f'));_0x190492(_0x1b6069[_0x4834('0x25')][_0x4834('0x23')]);}})[_0x4834('0x26')](function(_0x28b852){logger[_0x4834('0x21')](_0x4834('0x1e'),_0x1d7738,_0x28b852);_0x3cf8d1(_0x28b852);});});}function respondWithStatusCode(_0xe0ed7c,_0x56b72c){_0x56b72c=_0x56b72c||0xcc;return function(_0x26ff1a){if(_0x26ff1a){return _0xe0ed7c[_0x4834('0x27')](_0x56b72c);}return _0xe0ed7c['status'](_0x56b72c)['end']();};}function respondWithResult(_0x3327c6,_0x2ebe34){_0x2ebe34=_0x2ebe34||0xc8;return function(_0x39188e){if(_0x39188e){return _0x3327c6[_0x4834('0x28')](_0x2ebe34)[_0x4834('0x29')](_0x39188e);}};}function respondWithFilteredResult(_0x4abd17,_0x137fd9){return function(_0x3edb83){if(_0x3edb83){var _0x38b5b1=typeof _0x137fd9[_0x4834('0x2a')]===_0x4834('0x2b')&&typeof _0x137fd9[_0x4834('0x2c')]===_0x4834('0x2b');var _0x230138=_0x3edb83[_0x4834('0x2d')];var _0x5d6f1a=_0x38b5b1?0x0:_0x137fd9['offset'];var _0x567246=_0x38b5b1?_0x3edb83[_0x4834('0x2d')]:_0x137fd9[_0x4834('0x2a')]+_0x137fd9[_0x4834('0x2c')];var _0x27f906;if(_0x567246>=_0x230138){_0x567246=_0x230138;_0x27f906=0xc8;}else{_0x27f906=0xce;}_0x4abd17['status'](_0x27f906);return _0x4abd17[_0x4834('0x2e')](_0x4834('0x2f'),_0x5d6f1a+'-'+_0x567246+'/'+_0x230138)[_0x4834('0x29')](_0x3edb83);}return null;};}function patchUpdates(_0x57586d){return function(_0x4202e2){try{jsonpatch['apply'](_0x4202e2,_0x57586d,!![]);}catch(_0x1e3433){return BPromise['reject'](_0x1e3433);}return _0x4202e2[_0x4834('0x30')]();};}function saveUpdates(_0x1bfabe,_0x5602f5){return function(_0x4ef6ec){if(_0x4ef6ec){return _0x4ef6ec[_0x4834('0x31')](_0x1bfabe)[_0x4834('0x1d')](function(_0x2f401a){return _0x2f401a;});}return null;};}function removeEntity(_0x22c2e1,_0x1a39b2){return function(_0xa20563){if(_0xa20563){return _0xa20563['destroy']()[_0x4834('0x1d')](function(){var _0x19297f=_0xa20563[_0x4834('0x32')]({'plain':!![]});var _0x5c0c27='WhatsappAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x5c0c27,'resourceId':_0x19297f['id']}})[_0x4834('0x1d')](function(){return _0xa20563;});})[_0x4834('0x1d')](function(){_0x22c2e1[_0x4834('0x28')](0xcc)[_0x4834('0x33')]();});}};}function handleEntityNotFound(_0x23599e,_0x49fb9){return function(_0x1ffbdc){if(!_0x1ffbdc){_0x23599e['sendStatus'](0x194);}return _0x1ffbdc;};}function handleError(_0x4cce0f,_0xd2dfc1){_0xd2dfc1=_0xd2dfc1||0x1f4;return function(_0x234e5f){logger['error'](_0x234e5f['stack']);if(_0x234e5f['name']){delete _0x234e5f[_0x4834('0x34')];}_0x4cce0f['status'](_0xd2dfc1)[_0x4834('0x35')](_0x234e5f);};}exports[_0x4834('0x36')]=function(_0x2ca7e5,_0x453c07){var _0x3ebb1b={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2db3fd={},_0xb9ebe4={'count':0x0,'rows':[]};var _0x1ae1b4=_[_0x4834('0x37')](db[_0x4834('0x38')]['rawAttributes'],function(_0x18aa6c){return{'name':_0x18aa6c[_0x4834('0x39')],'type':_0x18aa6c[_0x4834('0x3a')][_0x4834('0x3b')]};});_0x2db3fd[_0x4834('0x3c')]=_[_0x4834('0x37')](_0x1ae1b4,_0x4834('0x34'));_0x2db3fd[_0x4834('0x3d')]=_['keys'](_0x2ca7e5[_0x4834('0x3d')]);_0x2db3fd[_0x4834('0x3e')]=_[_0x4834('0x3f')](_0x2db3fd['model'],_0x2db3fd['query']);_0x3ebb1b[_0x4834('0x40')]=_['intersection'](_0x2db3fd['model'],qs[_0x4834('0x41')](_0x2ca7e5['query'][_0x4834('0x41')]));_0x3ebb1b[_0x4834('0x40')]=_0x3ebb1b['attributes'][_0x4834('0x42')]?_0x3ebb1b[_0x4834('0x40')]:_0x2db3fd['model'];if(!_0x2ca7e5[_0x4834('0x3d')][_0x4834('0x43')]('nolimit')){_0x3ebb1b['limit']=qs[_0x4834('0x2c')](_0x2ca7e5[_0x4834('0x3d')][_0x4834('0x2c')]);_0x3ebb1b[_0x4834('0x2a')]=qs[_0x4834('0x2a')](_0x2ca7e5[_0x4834('0x3d')]['offset']);}_0x3ebb1b[_0x4834('0x44')]=qs[_0x4834('0x45')](_0x2ca7e5['query'][_0x4834('0x45')]);_0x3ebb1b[_0x4834('0x46')]=qs[_0x4834('0x3e')](_['pick'](_0x2ca7e5['query'],_0x2db3fd[_0x4834('0x3e')]),_0x1ae1b4);if(_0x2ca7e5[_0x4834('0x3d')][_0x4834('0x47')]){_0x3ebb1b[_0x4834('0x46')]=_[_0x4834('0x48')](_0x3ebb1b['where'],{'$or':_[_0x4834('0x37')](_0x1ae1b4,function(_0x1cc0cd){if(_0x1cc0cd['type']!==_0x4834('0x49')){var _0x4b3fa3={};_0x4b3fa3[_0x1cc0cd[_0x4834('0x34')]]={'$like':'%'+_0x2ca7e5[_0x4834('0x3d')]['filter']+'%'};return _0x4b3fa3;}})});}_0x3ebb1b=_[_0x4834('0x48')]({},_0x3ebb1b,_0x2ca7e5[_0x4834('0x4a')]);var _0x312d8b={'where':_0x3ebb1b['where']};return db['WhatsappAccount'][_0x4834('0x2d')](_0x312d8b)['then'](function(_0x26ce1e){_0xb9ebe4[_0x4834('0x2d')]=_0x26ce1e;if(_0x2ca7e5[_0x4834('0x3d')]['includeAll']){_0x3ebb1b[_0x4834('0x4b')]=[{'all':!![]}];}return db[_0x4834('0x38')][_0x4834('0x4c')](_0x3ebb1b);})['then'](function(_0x3cc3f3){_0xb9ebe4[_0x4834('0x4d')]=_0x3cc3f3;return _0xb9ebe4;})[_0x4834('0x1d')](respondWithFilteredResult(_0x453c07,_0x3ebb1b))[_0x4834('0x26')](handleError(_0x453c07,null));};exports[_0x4834('0x4e')]=function(_0x70dfd5,_0x4a5225){var _0x5187e3={'raw':![],'where':{'id':_0x70dfd5[_0x4834('0x4f')]['id']},'include':[{'model':db[_0x4834('0x50')],'as':_0x4834('0x51')}]},_0x13a1db={};_0x13a1db[_0x4834('0x3c')]=_[_0x4834('0x52')](db[_0x4834('0x38')]['rawAttributes']);_0x13a1db[_0x4834('0x3d')]=_[_0x4834('0x52')](_0x70dfd5['query']);_0x13a1db['filters']=_[_0x4834('0x3f')](_0x13a1db[_0x4834('0x3c')],_0x13a1db[_0x4834('0x3d')]);_0x5187e3[_0x4834('0x40')]=_[_0x4834('0x3f')](_0x13a1db[_0x4834('0x3c')],qs[_0x4834('0x41')](_0x70dfd5[_0x4834('0x3d')][_0x4834('0x41')]));_0x5187e3[_0x4834('0x40')]=_0x5187e3['attributes'][_0x4834('0x42')]?_0x5187e3[_0x4834('0x40')]:_0x13a1db[_0x4834('0x3c')];if(_0x70dfd5[_0x4834('0x3d')][_0x4834('0x53')]){_0x5187e3[_0x4834('0x4b')]=[{'all':!![]}];}_0x5187e3=_[_0x4834('0x48')]({},_0x5187e3,_0x70dfd5[_0x4834('0x4a')]);return db[_0x4834('0x38')]['find'](_0x5187e3)[_0x4834('0x1d')](handleEntityNotFound(_0x4a5225,null))['then'](respondWithResult(_0x4a5225,null))[_0x4834('0x26')](handleError(_0x4a5225,null));};exports['create']=function(_0x3ded1e,_0x124926){return db['WhatsappAccount']['create'](_0x3ded1e['body'],{})[_0x4834('0x1d')](function(_0x406a3e){var _0x361dc0=_0x3ded1e[_0x4834('0x54')]['get']({'plain':!![]});if(!_0x361dc0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x361dc0[_0x4834('0x55')]==='user'){var _0x142329=_0x406a3e[_0x4834('0x32')]({'plain':!![]});var _0x4c6905=_0x4834('0x56');return db[_0x4834('0x57')]['find']({'where':{'name':_0x4c6905,'userProfileId':_0x361dc0[_0x4834('0x58')]},'raw':!![]})[_0x4834('0x1d')](function(_0x4aa191){if(_0x4aa191&&_0x4aa191[_0x4834('0x59')]===0x0){return db[_0x4834('0x5a')][_0x4834('0x5b')]({'name':_0x142329['name'],'resourceId':_0x142329['id'],'type':_0x4aa191['name'],'sectionId':_0x4aa191['id']},{})[_0x4834('0x1d')](function(){return _0x406a3e;});}else{return _0x406a3e;}})[_0x4834('0x26')](function(_0x324639){logger[_0x4834('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x324639);throw _0x324639;});}return _0x406a3e;})['then'](respondWithResult(_0x124926,0xc9))[_0x4834('0x26')](handleError(_0x124926,null));};exports[_0x4834('0x31')]=function(_0x32340e,_0xff5147){if(_0x32340e[_0x4834('0x5c')]['id']){delete _0x32340e[_0x4834('0x5c')]['id'];}return db[_0x4834('0x38')]['find']({'where':{'id':_0x32340e[_0x4834('0x4f')]['id']},'include':[{'model':db[_0x4834('0x50')],'as':_0x4834('0x51')}]})[_0x4834('0x1d')](handleEntityNotFound(_0xff5147,null))[_0x4834('0x1d')](saveUpdates(_0x32340e[_0x4834('0x5c')],null))[_0x4834('0x1d')](respondWithResult(_0xff5147,null))[_0x4834('0x26')](handleError(_0xff5147,null));};exports['destroy']=function(_0x557a4d,_0x605376){return db[_0x4834('0x38')][_0x4834('0x5d')]({'where':{'id':_0x557a4d[_0x4834('0x4f')]['id']}})[_0x4834('0x1d')](handleEntityNotFound(_0x605376,null))[_0x4834('0x1d')](removeEntity(_0x605376,null))['catch'](handleError(_0x605376,null));};exports[_0x4834('0x5e')]=function(_0x32f09e,_0x508f0f){return db[_0x4834('0x38')]['describe']()[_0x4834('0x1d')](respondWithResult(_0x508f0f,null))[_0x4834('0x26')](handleError(_0x508f0f,null));};exports[_0x4834('0x5f')]=function(_0x37eccb,_0x164037,_0x2da34e){if(_0x37eccb[_0x4834('0x5c')]['id']){delete _0x37eccb[_0x4834('0x5c')]['id'];}return db[_0x4834('0x38')][_0x4834('0x5d')]({'where':{'id':_0x37eccb[_0x4834('0x4f')]['id']}})['then'](handleEntityNotFound(_0x164037,null))[_0x4834('0x1d')](function(_0xb1d908){if(_0xb1d908){_0x37eccb[_0x4834('0x5c')][_0x4834('0x60')]=_0xb1d908['id'];return db[_0x4834('0x61')]['create'](_0x37eccb[_0x4834('0x5c')]);}})[_0x4834('0x1d')](respondWithResult(_0x164037,null))[_0x4834('0x26')](handleError(_0x164037,null));};exports[_0x4834('0x62')]=function(_0x21991,_0x1d511a,_0x24a400){var _0x2858b3={'raw':![],'where':{}};var _0x1286ec={};var _0x22c621={'count':0x0,'rows':[]};return db[_0x4834('0x38')][_0x4834('0x63')]({'where':{'id':_0x21991['params']['id']}})[_0x4834('0x1d')](handleEntityNotFound(_0x1d511a,null))['then'](function(_0x524121){if(_0x524121){_0x1286ec[_0x4834('0x3c')]=_[_0x4834('0x52')](db['Disposition'][_0x4834('0x64')]);_0x1286ec['query']=_[_0x4834('0x52')](_0x21991[_0x4834('0x3d')]);_0x1286ec['filters']=_[_0x4834('0x3f')](_0x1286ec[_0x4834('0x3c')],_0x1286ec['query']);_0x2858b3[_0x4834('0x40')]=_['intersection'](_0x1286ec[_0x4834('0x3c')],qs['fields'](_0x21991['query'][_0x4834('0x41')]));_0x2858b3[_0x4834('0x40')]=_0x2858b3[_0x4834('0x40')]['length']?_0x2858b3['attributes']:_0x1286ec['model'];if(!_0x21991['query']['hasOwnProperty']('nolimit')){_0x2858b3[_0x4834('0x2c')]=qs[_0x4834('0x2c')](_0x21991['query'][_0x4834('0x2c')]);_0x2858b3['offset']=qs[_0x4834('0x2a')](_0x21991[_0x4834('0x3d')][_0x4834('0x2a')]);}_0x2858b3[_0x4834('0x44')]=qs[_0x4834('0x45')](_0x21991['query']['sort']);_0x2858b3[_0x4834('0x46')]=qs['filters'](_['pick'](_0x21991['query'],_0x1286ec[_0x4834('0x3e')]));_0x2858b3[_0x4834('0x46')][_0x4834('0x60')]=_0x524121['id'];if(_0x21991[_0x4834('0x3d')][_0x4834('0x47')]){_0x2858b3['where']=_[_0x4834('0x48')](_0x2858b3['where'],{'$or':_[_0x4834('0x37')](_0x2858b3[_0x4834('0x40')],function(_0x57b98b){var _0x8f85d9={};_0x8f85d9[_0x57b98b]={'$like':'%'+_0x21991[_0x4834('0x3d')][_0x4834('0x47')]+'%'};return _0x8f85d9;})});}_0x2858b3=_[_0x4834('0x48')]({},_0x2858b3,_0x21991['options']);return db['Disposition'][_0x4834('0x2d')]({'where':_0x2858b3[_0x4834('0x46')]})[_0x4834('0x1d')](function(_0x36aab7){_0x22c621[_0x4834('0x2d')]=_0x36aab7;if(_0x21991[_0x4834('0x3d')][_0x4834('0x53')]){_0x2858b3[_0x4834('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0x4834('0x4c')](_0x2858b3);})[_0x4834('0x1d')](function(_0x2976a6){_0x22c621[_0x4834('0x4d')]=_0x2976a6;return _0x22c621;});}})['then'](respondWithFilteredResult(_0x1d511a,_0x2858b3))[_0x4834('0x26')](handleError(_0x1d511a,null));};exports[_0x4834('0x65')]=function(_0x1cddea,_0x39f8ff,_0x25bae3){return db[_0x4834('0x38')][_0x4834('0x5d')]({'where':{'id':_0x1cddea['params']['id']}})[_0x4834('0x1d')](handleEntityNotFound(_0x39f8ff,null))[_0x4834('0x1d')](function(_0x58ebe0){if(_0x58ebe0){return _0x58ebe0[_0x4834('0x65')](_0x1cddea['query']['ids']);}})[_0x4834('0x1d')](respondWithStatusCode(_0x39f8ff,null))[_0x4834('0x26')](handleError(_0x39f8ff,null));};exports[_0x4834('0x66')]=function(_0x26ef47,_0xb0650e,_0x137dc3){if(_0x26ef47[_0x4834('0x5c')]['id']){delete _0x26ef47[_0x4834('0x5c')]['id'];}return db[_0x4834('0x38')]['find']({'where':{'id':_0x26ef47['params']['id']}})[_0x4834('0x1d')](handleEntityNotFound(_0xb0650e,null))[_0x4834('0x1d')](function(_0x59c850){if(_0x59c850){_0x26ef47[_0x4834('0x5c')][_0x4834('0x60')]=_0x59c850['id'];return db[_0x4834('0x67')]['create'](_0x26ef47[_0x4834('0x5c')]);}})[_0x4834('0x1d')](respondWithResult(_0xb0650e,null))[_0x4834('0x26')](handleError(_0xb0650e,null));};exports[_0x4834('0x68')]=function(_0xc2322c,_0x23b772,_0x250c92){var _0x3bb447={'raw':![],'where':{}};var _0x5d5c51={};var _0x3c0623={'count':0x0,'rows':[]};return db[_0x4834('0x38')]['findOne']({'where':{'id':_0xc2322c[_0x4834('0x4f')]['id']}})['then'](handleEntityNotFound(_0x23b772,null))['then'](function(_0x289e82){if(_0x289e82){_0x5d5c51[_0x4834('0x3c')]=_[_0x4834('0x52')](db[_0x4834('0x67')][_0x4834('0x64')]);_0x5d5c51[_0x4834('0x3d')]=_[_0x4834('0x52')](_0xc2322c['query']);_0x5d5c51[_0x4834('0x3e')]=_[_0x4834('0x3f')](_0x5d5c51[_0x4834('0x3c')],_0x5d5c51[_0x4834('0x3d')]);_0x3bb447[_0x4834('0x40')]=_[_0x4834('0x3f')](_0x5d5c51['model'],qs[_0x4834('0x41')](_0xc2322c[_0x4834('0x3d')][_0x4834('0x41')]));_0x3bb447[_0x4834('0x40')]=_0x3bb447[_0x4834('0x40')]['length']?_0x3bb447[_0x4834('0x40')]:_0x5d5c51[_0x4834('0x3c')];if(!_0xc2322c[_0x4834('0x3d')][_0x4834('0x43')](_0x4834('0x69'))){_0x3bb447[_0x4834('0x2c')]=qs['limit'](_0xc2322c['query'][_0x4834('0x2c')]);_0x3bb447[_0x4834('0x2a')]=qs[_0x4834('0x2a')](_0xc2322c[_0x4834('0x3d')]['offset']);}_0x3bb447[_0x4834('0x44')]=qs[_0x4834('0x45')](_0xc2322c['query']['sort']);_0x3bb447[_0x4834('0x46')]=qs[_0x4834('0x3e')](_[_0x4834('0x6a')](_0xc2322c[_0x4834('0x3d')],_0x5d5c51[_0x4834('0x3e')]));_0x3bb447[_0x4834('0x46')][_0x4834('0x60')]=_0x289e82['id'];if(_0xc2322c[_0x4834('0x3d')]['filter']){_0x3bb447[_0x4834('0x46')]=_[_0x4834('0x48')](_0x3bb447['where'],{'$or':_[_0x4834('0x37')](_0x3bb447[_0x4834('0x40')],function(_0x4c6f08){var _0x45cb4f={};_0x45cb4f[_0x4c6f08]={'$like':'%'+_0xc2322c['query'][_0x4834('0x47')]+'%'};return _0x45cb4f;})});}_0x3bb447=_[_0x4834('0x48')]({},_0x3bb447,_0xc2322c[_0x4834('0x4a')]);return db[_0x4834('0x67')][_0x4834('0x2d')]({'where':_0x3bb447[_0x4834('0x46')]})['then'](function(_0x1bc778){_0x3c0623[_0x4834('0x2d')]=_0x1bc778;if(_0xc2322c[_0x4834('0x3d')][_0x4834('0x53')]){_0x3bb447['include']=[{'all':!![]}];}return db[_0x4834('0x67')]['findAll'](_0x3bb447);})[_0x4834('0x1d')](function(_0x27d1ae){_0x3c0623[_0x4834('0x4d')]=_0x27d1ae;return _0x3c0623;});}})[_0x4834('0x1d')](respondWithFilteredResult(_0x23b772,_0x3bb447))[_0x4834('0x26')](handleError(_0x23b772,null));};exports[_0x4834('0x6b')]=function(_0x4ecb06,_0xc81e4f,_0x4484f4){return db[_0x4834('0x38')][_0x4834('0x5d')]({'where':{'id':_0x4ecb06[_0x4834('0x4f')]['id']}})[_0x4834('0x1d')](handleEntityNotFound(_0xc81e4f,null))[_0x4834('0x1d')](function(_0x330abb){if(_0x330abb){return _0x330abb[_0x4834('0x6b')](_0x4ecb06[_0x4834('0x3d')][_0x4834('0x6c')]);}})[_0x4834('0x1d')](respondWithStatusCode(_0xc81e4f,null))[_0x4834('0x26')](handleError(_0xc81e4f,null));};exports[_0x4834('0x6d')]=function(_0x4e4272,_0x93a2e6,_0x8851bf){return db['WhatsappAccount'][_0x4834('0x5d')]({'where':{'id':_0x4e4272[_0x4834('0x4f')]['id']}})[_0x4834('0x1d')](handleEntityNotFound(_0x93a2e6,null))[_0x4834('0x1d')](function(_0x36fb91){if(_0x36fb91){return _0x36fb91[_0x4834('0x6d')](_0x4e4272[_0x4834('0x5c')][_0x4834('0x6c')],_['omit'](_0x4e4272[_0x4834('0x5c')],[_0x4834('0x6c'),'id'])||{})[_0x4834('0x6e')](function(_0x4369bc){for(var _0x3e0f72=0x0;_0x3e0f72<_0x4e4272['body']['ids'][_0x4834('0x42')];_0x3e0f72+=0x1){socket[_0x4834('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x4e4272[_0x4834('0x5c')][_0x4834('0x6c')][_0x3e0f72]),'WhatsappAccountId':Number(_0x4e4272['params']['id'])});}return _0x4369bc;});}})[_0x4834('0x1d')](respondWithResult(_0x93a2e6,null))[_0x4834('0x26')](handleError(_0x93a2e6,null));};exports['removeAgents']=function(_0x389020,_0x10b061,_0x14ef17){return db[_0x4834('0x38')]['find']({'where':{'id':_0x389020[_0x4834('0x4f')]['id']}})[_0x4834('0x1d')](handleEntityNotFound(_0x10b061,null))[_0x4834('0x1d')](function(_0x2b3bd4){if(_0x2b3bd4){return _0x2b3bd4[_0x4834('0x70')](_0x389020[_0x4834('0x3d')][_0x4834('0x6c')])[_0x4834('0x1d')](function(){if(_[_0x4834('0x71')](_0x389020[_0x4834('0x3d')]['ids'])){for(var _0x5e5fa1=0x0;_0x5e5fa1<_0x389020[_0x4834('0x3d')][_0x4834('0x6c')][_0x4834('0x42')];_0x5e5fa1+=0x1){socket[_0x4834('0x6f')](_0x4834('0x72'),{'UserId':Number(_0x389020['query'][_0x4834('0x6c')][_0x5e5fa1]),'WhatsappAccountId':Number(_0x389020[_0x4834('0x4f')]['id'])});}}else{socket[_0x4834('0x6f')](_0x4834('0x72'),{'UserId':Number(_0x389020[_0x4834('0x3d')]['ids']),'WhatsappAccountId':Number(_0x389020[_0x4834('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x10b061,null))[_0x4834('0x26')](handleError(_0x10b061,null));};exports['getAgents']=function(_0x2a0c17,_0x540648,_0xefa8d6){var _0x372e91={};var _0x33e134={};var _0x1ccb50;var _0x132c1e;return db[_0x4834('0x38')][_0x4834('0x63')]({'where':{'id':_0x2a0c17[_0x4834('0x4f')]['id']}})[_0x4834('0x1d')](handleEntityNotFound(_0x540648,null))[_0x4834('0x1d')](function(_0x2ff4fd){if(_0x2ff4fd){_0x1ccb50=_0x2ff4fd;_0x33e134[_0x4834('0x3c')]=_[_0x4834('0x52')](db['User'][_0x4834('0x64')]);_0x33e134[_0x4834('0x3d')]=_[_0x4834('0x52')](_0x2a0c17[_0x4834('0x3d')]);_0x33e134[_0x4834('0x3e')]=_[_0x4834('0x3f')](_0x33e134[_0x4834('0x3c')],_0x33e134[_0x4834('0x3d')]);_0x372e91['attributes']=_[_0x4834('0x3f')](_0x33e134['model'],qs['fields'](_0x2a0c17[_0x4834('0x3d')][_0x4834('0x41')]));_0x372e91['attributes']=_0x372e91[_0x4834('0x40')][_0x4834('0x42')]?_0x372e91['attributes']:_0x33e134[_0x4834('0x3c')];_0x372e91[_0x4834('0x44')]=qs[_0x4834('0x45')](_0x2a0c17[_0x4834('0x3d')]['sort']);_0x372e91[_0x4834('0x46')]=qs['filters'](_[_0x4834('0x6a')](_0x2a0c17['query'],_0x33e134[_0x4834('0x3e')]));if(_0x2a0c17['query'][_0x4834('0x47')]){_0x372e91[_0x4834('0x46')]=_[_0x4834('0x48')](_0x372e91[_0x4834('0x46')],{'$or':_[_0x4834('0x37')](_0x372e91[_0x4834('0x40')],function(_0x12aa6d){var _0x2f3de8={};_0x2f3de8[_0x12aa6d]={'$like':'%'+_0x2a0c17[_0x4834('0x3d')]['filter']+'%'};return _0x2f3de8;})});}_0x372e91=_[_0x4834('0x48')]({},_0x372e91,_0x2a0c17[_0x4834('0x4a')]);return _0x1ccb50[_0x4834('0x73')](_0x372e91);}})[_0x4834('0x1d')](function(_0x50e2ea){if(_0x50e2ea){_0x132c1e=_0x50e2ea['length'];if(!_0x2a0c17[_0x4834('0x3d')][_0x4834('0x43')](_0x4834('0x69'))){_0x372e91['limit']=qs['limit'](_0x2a0c17['query'][_0x4834('0x2c')]);_0x372e91[_0x4834('0x2a')]=qs[_0x4834('0x2a')](_0x2a0c17[_0x4834('0x3d')]['offset']);}return _0x1ccb50[_0x4834('0x73')](_0x372e91);}})[_0x4834('0x1d')](function(_0x57b2a1){if(_0x57b2a1){return _0x57b2a1?{'count':_0x132c1e,'rows':_0x57b2a1}:null;}})[_0x4834('0x1d')](respondWithResult(_0x540648,null))['catch'](handleError(_0x540648,null));};exports[_0x4834('0x74')]=function(_0x5b11f7,_0x3f9bf4){var _0x2ea835=_0x5b11f7[_0x4834('0x4f')]['id'];var _0x5a245d=_0x5b11f7['body'];var _0x2f6000=0xc8;var _0xa6a1a5=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x4834('0x75')][_0x4834('0x76')]['ISOLATION_LEVELS'][_0x4834('0x77')]},function(_0x5dc7dd){return db[_0x4834('0x38')][_0x4834('0x63')]({'where':{'id':_0x2ea835},'transaction':_0x5dc7dd})['then'](function(_0x27ceda){if(_0x27ceda){return db[_0x4834('0x78')][_0x4834('0x79')]({'where':{'WhatsappAccountId':_0x2ea835},'transaction':_0x5dc7dd})[_0x4834('0x1d')](function(){var _0xed7088=_[_0x4834('0x37')](_0x5a245d,function(_0x3a702f){_0x3a702f[_0x4834('0x60')]=_0x2ea835;return _0x3a702f;});return db['WhatsappApplication'][_0x4834('0x7a')](_0xed7088,{'transaction':_0x5dc7dd});});}else{_0x2f6000=0x194;_0xa6a1a5=[];}});})[_0x4834('0x1d')](function(){if(_0x2f6000!==0x194){return db[_0x4834('0x78')][_0x4834('0x7b')]({'where':{'WhatsappAccountId':_0x2ea835},'order':_0x4834('0x7c')})[_0x4834('0x1d')](function(_0x4a1776){_0xa6a1a5=_0x4a1776;});}})[_0x4834('0x26')](function(_0x12a005){_0x2f6000=0x1f4;logger[_0x4834('0x21')](_0x12a005[_0x4834('0x7d')]);if(_0x12a005[_0x4834('0x34')]){delete _0x12a005['name'];}_0xa6a1a5=_0x12a005;})['finally'](function(){if(_0xa6a1a5===null){_0x3f9bf4[_0x4834('0x27')](_0x2f6000);}else{if(_0x2f6000===0x1f4){_0x3f9bf4[_0x4834('0x28')](_0x2f6000)[_0x4834('0x35')](_0xa6a1a5);}else{_0x3f9bf4[_0x4834('0x28')](_0x2f6000)[_0x4834('0x29')](_0xa6a1a5);}}});};exports[_0x4834('0x7e')]=function(_0x3ec254,_0x1c8f68,_0x46b2e7){var _0x466340={};var _0x485359={};var _0x57594c;var _0x4e478e;return db[_0x4834('0x38')][_0x4834('0x63')]({'where':{'id':_0x3ec254[_0x4834('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1c8f68,null))[_0x4834('0x1d')](function(_0x57acb9){if(_0x57acb9){_0x57594c=_0x57acb9;_0x485359[_0x4834('0x3c')]=_[_0x4834('0x52')](db[_0x4834('0x78')][_0x4834('0x64')]);_0x485359[_0x4834('0x3d')]=_[_0x4834('0x52')](_0x3ec254['query']);_0x485359[_0x4834('0x3e')]=_['intersection'](_0x485359[_0x4834('0x3c')],_0x485359[_0x4834('0x3d')]);_0x466340[_0x4834('0x40')]=_[_0x4834('0x3f')](_0x485359['model'],qs[_0x4834('0x41')](_0x3ec254[_0x4834('0x3d')]['fields']));_0x466340[_0x4834('0x40')]=_0x466340['attributes'][_0x4834('0x42')]?_0x466340[_0x4834('0x40')]:_0x485359[_0x4834('0x3c')];_0x466340[_0x4834('0x44')]=qs[_0x4834('0x45')](_0x3ec254[_0x4834('0x3d')][_0x4834('0x45')]);_0x466340[_0x4834('0x46')]=qs[_0x4834('0x3e')](_[_0x4834('0x6a')](_0x3ec254[_0x4834('0x3d')],_0x485359[_0x4834('0x3e')]));if(_0x3ec254[_0x4834('0x3d')]['filter']){_0x466340[_0x4834('0x46')]=_['merge'](_0x466340[_0x4834('0x46')],{'$or':_[_0x4834('0x37')](_0x466340[_0x4834('0x40')],function(_0x27f440){var _0x23a7cc={};_0x23a7cc[_0x27f440]={'$like':'%'+_0x3ec254[_0x4834('0x3d')][_0x4834('0x47')]+'%'};return _0x23a7cc;})});}_0x466340=_[_0x4834('0x48')]({},_0x466340,_0x3ec254[_0x4834('0x4a')]);return _0x57594c[_0x4834('0x7e')](_0x466340);}})[_0x4834('0x1d')](function(_0x4667c3){if(_0x4667c3){_0x4e478e=_0x4667c3['length'];if(!_0x3ec254[_0x4834('0x3d')][_0x4834('0x43')](_0x4834('0x69'))){_0x466340[_0x4834('0x2c')]=qs[_0x4834('0x2c')](_0x3ec254[_0x4834('0x3d')][_0x4834('0x2c')]);_0x466340[_0x4834('0x2a')]=qs[_0x4834('0x2a')](_0x3ec254['query']['offset']);}return _0x57594c[_0x4834('0x7e')](_0x466340);}})['then'](function(_0x3fbdc2){if(_0x3fbdc2){return _0x3fbdc2?{'count':_0x4e478e,'rows':_0x3fbdc2}:null;}})[_0x4834('0x1d')](respondWithResult(_0x1c8f68,null))[_0x4834('0x26')](handleError(_0x1c8f68,null));};exports[_0x4834('0x7f')]=function(_0x340de7,_0x1fb087,_0x5e121e){var _0x3ce1e1={'channel':'whatsapp'};var _0x383bb7=[];var _0x312e30=[];var _0x3a79bc={};return db[_0x4834('0x38')][_0x4834('0x5d')]({'where':{'id':_0x340de7[_0x4834('0x4f')]['id']},'include':[{'model':db[_0x4834('0x78')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x1fb087,null))[_0x4834('0x1d')](function(_0x19e884){_0x3ce1e1[_0x4834('0x80')]=_0x19e884;if(_0x3ce1e1[_0x4834('0x80')]&&_0x3ce1e1[_0x4834('0x80')][_0x4834('0x3a')]===_0x4834('0x81')&&_0x340de7['body'][_0x4834('0x82')]){if(_0x340de7[_0x4834('0x5c')][_0x4834('0x82')][_0x4834('0x42')]===0x0)return;if(_0x340de7['body'][_0x4834('0x82')][0x0][_0x4834('0x83')]!==_0x4834('0x84'))return;return db[_0x4834('0x85')][_0x4834('0x31')]({'read':!![],'readAt':_0x340de7[_0x4834('0x5c')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x340de7[_0x4834('0x5c')][_0x4834('0x82')][0x0][_0x4834('0x86')]},'individualHooks':!![]})[_0x4834('0x1d')](function(_0x63d5e){return _0x1fb087[_0x4834('0x28')](0xc8)['json'](_0x63d5e);});}_0x3ce1e1[_0x4834('0x87')]=_['orderBy'](_0x19e884[_0x4834('0x88')],[_0x4834('0x7c')],['asc']);if(_0x3ce1e1['account'][_0x4834('0x88')]){delete _0x3ce1e1[_0x4834('0x80')][_0x4834('0x88')];}return db[_0x4834('0x89')][_0x4834('0x5e')]()[_0x4834('0x1d')](function(_0x28b2f6){if(!_0x28b2f6){throw new db[(_0x4834('0x8a'))]['ValidationError'](_0x4834('0x8b'));}_0x383bb7=_['difference'](_[_0x4834('0x52')](_0x28b2f6),[_0x4834('0x8c'),_0x4834('0x8d')]);_0x312e30=_[_0x4834('0x8e')](_['keys'](_0x28b2f6),['createdAt',_0x4834('0x8d'),_0x4834('0x8f'),'ListId']);_0x3ce1e1[_0x4834('0x5c')]={'mapKey':_0x4834('0x90')};if(_0x3ce1e1[_0x4834('0x80')]&&_0x3ce1e1[_0x4834('0x80')][_0x4834('0x3a')]===_0x4834('0x91')){_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x92')]=_0x340de7[_0x4834('0x5c')][_0x4834('0x93')][_0x4834('0x94')](_0x4834('0x95'),'');_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x5c')]=_0x340de7['body'][_0x4834('0x96')];_0x3ce1e1['body'][_0x4834('0x97')]=_0x340de7[_0x4834('0x5c')][_0x4834('0x98')];}if(_0x3ce1e1[_0x4834('0x80')]&&_0x3ce1e1[_0x4834('0x80')][_0x4834('0x3a')]==='sinch'){_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x92')]=_0x340de7[_0x4834('0x5c')][_0x4834('0x99')][0x0][_0x4834('0x92')];_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x5c')]=_0x340de7[_0x4834('0x5c')][_0x4834('0x99')][0x0][_0x4834('0x23')][_0x4834('0x5c')];_0x3ce1e1[_0x4834('0x5c')]['messageId']=_0x340de7[_0x4834('0x5c')][_0x4834('0x99')][0x0][_0x4834('0x86')];}if(_0x3ce1e1[_0x4834('0x5c')]['id']){delete _0x3ce1e1[_0x4834('0x5c')]['id'];}if(_[_0x4834('0x9a')](_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x92')])){throw new db[(_0x4834('0x8a'))][(_0x4834('0x9b'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x5c')])||_0x3ce1e1[_0x4834('0x5c')]['body']===''){throw new db[(_0x4834('0x8a'))][(_0x4834('0x9b'))](_0x4834('0x9c'));}if(_['isNil'](_0x3ce1e1[_0x4834('0x5c')]['mapKey'])){throw new db[(_0x4834('0x8a'))][(_0x4834('0x9b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x312e30);}if(!_[_0x4834('0x9d')](_0x312e30,_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x9e')])){throw new db[(_0x4834('0x8a'))]['ValidationError'](_0x4834('0x9f')+_0x312e30);}_0x3a79bc[_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x9e')]]=_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x92')];return db[_0x4834('0xa0')]['find']({'where':{'id':_0x3ce1e1[_0x4834('0x80')][_0x4834('0xa1')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3a79bc,'limit':0x1,'order':[[_0x4834('0x8d'),'DESC']]}]});})[_0x4834('0x1d')](handleEntityNotFound(_0x1fb087,null))[_0x4834('0x1d')](function(_0x10176c){if(_0x10176c){_0x3ce1e1[_0x4834('0xa2')]=_[_0x4834('0xa3')](_0x10176c,[_0x4834('0xa4')]);if(_0x10176c[_0x4834('0xa4')][_0x4834('0x42')]){return _0x10176c['Contacts'][0x0];}var _0x335430=_[_0x4834('0x16')](_0x3ce1e1[_0x4834('0x5c')],{'firstName':_0x3ce1e1[_0x4834('0x5c')]['from'],'ListId':_0x10176c['id']});_0x335430[_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x9e')]]=_0x3ce1e1['body'][_0x4834('0x92')];return db[_0x4834('0x89')][_0x4834('0x5b')](_0x335430,{'fields':_0x383bb7,'raw':!![]});}})['then'](handleEntityNotFound(_0x1fb087,null))[_0x4834('0x1d')](function(_0x21c8c4){if(_0x21c8c4){_0x3ce1e1['contact']=_0x21c8c4;var _0x180676={'ContactId':_0x21c8c4['id'],'phone':_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x92')],'WhatsappAccountId':_0x340de7[_0x4834('0x4f')]['id']};var _0x399694={'ContactId':_0x21c8c4['id'],'WhatsappAccountId':_0x340de7['params']['id'],'closed':![]};return db[_0x4834('0xa5')][_0x4834('0x5d')]({'where':_0x399694})[_0x4834('0x1d')](function(_0x263cb8){if(_0x263cb8){return[_0x263cb8,![]];}return db[_0x4834('0xa5')][_0x4834('0x5b')](_0x180676)[_0x4834('0x1d')](function(_0x3f759d){return[_0x3f759d,!![]];});});}})[_0x4834('0x6e')](function(_0x22cce2,_0x4f809e){_0x3ce1e1[_0x4834('0xa6')]=_0x22cce2[_0x4834('0x32')]({'plain':!![]});_0x3ce1e1[_0x4834('0xa6')][_0x4834('0xa7')]=![];if(_0x4f809e){if(_0x3ce1e1[_0x4834('0x80')]['autoclose']){_0x3ce1e1['applications'][_0x4834('0xa8')]({'id':0x0,'priority':_0x3ce1e1['applications'][_0x4834('0x42')]+0x1,'app':'close','appdata':_0x4834('0xa9'),'interval':_0x4834('0xaa')});}_0x3ce1e1[_0x4834('0xa6')][_0x4834('0xa7')]=!![];}return db[_0x4834('0x85')][_0x4834('0x5b')]({'phone':_0x3ce1e1['body'][_0x4834('0x92')],'messageId':_0x3ce1e1[_0x4834('0x5c')]['messageId'],'body':_0x3ce1e1[_0x4834('0x5c')][_0x4834('0x5c')],'WhatsappAccountId':_0x340de7[_0x4834('0x4f')]['id'],'WhatsappInteractionId':_0x22cce2['id'],'direction':'in','ContactId':_0x22cce2[_0x4834('0xab')],'AttachmentId':_0x3ce1e1[_0x4834('0x5c')][_0x4834('0xac')]});})[_0x4834('0x1d')](function(_0x2e65d3){_0x3ce1e1[_0x4834('0x23')]=_0x2e65d3;if(_0x3ce1e1['interaction'][_0x4834('0xad')]){return db[_0x4834('0xae')][_0x4834('0x5d')]({'attributes':['id',_0x4834('0x34')],'where':{'id':_0x3ce1e1['interaction'][_0x4834('0xad')]}})['then'](function(_0x13f829){if(_0x13f829){_0x3ce1e1[_0x4834('0x87')][_0x4834('0xaf')]({'id':0x0,'priority':0x0,'app':_0x4834('0xb0'),'appdata':_0x13f829['name']+','+(_0x3ce1e1[_0x4834('0x80')][_0x4834('0xb1')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4834('0xb2'),_0x4834('0xb3'),_0x3ce1e1);});}return respondWithRpcPromise(_0x4834('0xb2'),'startRouting',_0x3ce1e1);})[_0x4834('0x1d')](function(_0x21801b){if(_0x21801b){var _0x49bb85=0xc8;var _0x20668e=_0x4834('0xb4');logger[_0x4834('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x20668e,_0x49bb85,_0x4834('0xb5'));logger[_0x4834('0xb6')](_0x4834('0xb7'),_0x20668e,_0x49bb85,_0x4834('0xb5'),JSON[_0x4834('0x20')](_0x21801b));if(_0x3ce1e1['account'][_0x4834('0x3a')]===_0x4834('0x91')){return _0x1fb087[_0x4834('0x28')](_0x49bb85)[_0x4834('0x2e')](_0x4834('0xb8'),_0x4834('0xb9'))['send'](_0x4834('0xba'));}else{return _0x1fb087['status'](_0x49bb85)[_0x4834('0x29')](_0x21801b);}}});})[_0x4834('0x26')](handleError(_0x1fb087,null));};exports['send']=function(_0x4a8b43,_0x23059b,_0x13cc05){var _0x58f05c,_0x2577b5,_0x53ade2;if(_[_0x4834('0x9a')](_0x4a8b43[_0x4834('0x5c')][_0x4834('0x5c')])||_0x4a8b43[_0x4834('0x5c')][_0x4834('0x5c')]===''){throw new db[(_0x4834('0x8a'))][(_0x4834('0x9b'))](_0x4834('0x9c'));}if(_[_0x4834('0x9a')](_0x4a8b43[_0x4834('0x5c')]['to'])){throw new db[(_0x4834('0x8a'))][(_0x4834('0x9b'))](_0x4834('0xbb'));}_0x58f05c=_0x4a8b43[_0x4834('0x5c')]['to'];return db['WhatsappAccount'][_0x4834('0x5d')]({'where':{'id':_0x4a8b43[_0x4834('0x4f')]['id']},'include':[{'model':db[_0x4834('0xa0')],'as':'List','include':[{'model':db['CmContact'],'as':_0x4834('0xa4'),'where':{'mobile':_0x58f05c},'limit':0x1,'order':[['updatedAt',_0x4834('0xbc')]]}]}]})[_0x4834('0x1d')](handleEntityNotFound(_0x23059b,null))['then'](function(_0x397bd4){if(_0x397bd4&&_0x397bd4[_0x4834('0xbd')]){_0x2577b5=_0x397bd4[_0x4834('0x32')]({'plain':!![]});if(_0x2577b5[_0x4834('0xbd')]&&_0x2577b5[_0x4834('0xbd')][_0x4834('0xa4')][_0x4834('0x42')]){return _0x2577b5[_0x4834('0xbd')][_0x4834('0xa4')][0x0];}return db[_0x4834('0x89')][_0x4834('0x5b')](_[_0x4834('0x16')](_0x4a8b43[_0x4834('0x5c')],{'firstName':_0x58f05c,'mobile':_0x58f05c,'phone':_0x58f05c,'ListId':_0x2577b5[_0x4834('0xa1')]}));}})[_0x4834('0x1d')](handleEntityNotFound(_0x23059b,null))[_0x4834('0x1d')](function(_0x53efa4){if(_0x53efa4){_0x53ade2=_0x53efa4;return db['WhatsappInteraction'][_0x4834('0x5d')]({'where':{'ContactId':_0x53ade2['id'],'closed':![],'WhatsappAccountId':_0x2577b5['id']}})['then'](function(_0x5371df){if(_0x5371df){return[_0x5371df,![]];}return db[_0x4834('0xa5')][_0x4834('0x5b')]({'UserId':_0x4a8b43[_0x4834('0x54')]['id'],'ContactId':_0x53ade2['id'],'WhatsappAccountId':_0x2577b5['id'],'phone':_0x58f05c,'firstMsgDirection':'out','Messages':[_[_0x4834('0x48')](_0x4a8b43[_0x4834('0x5c')],{'read':![],'body':_0x4a8b43[_0x4834('0x5c')][_0x4834('0x5c')],'phone':_0x58f05c,'WhatsappAccountId':_0x2577b5['id'],'UserId':_0x4a8b43[_0x4834('0x54')]['id'],'ContactId':_0x53ade2['id']})]},{'include':[{'model':db[_0x4834('0x85')],'as':_0x4834('0xbe')}]})[_0x4834('0x1d')](function(_0x41d38d){return[_0x41d38d,!![]];});});}})['spread'](function(_0x22fa9d,_0x325fe2){if(_0x325fe2){return _0x22fa9d;}return db['WhatsappMessage'][_0x4834('0x5b')](_[_0x4834('0x48')](_0x4a8b43[_0x4834('0x5c')],{'read':![],'body':_0x4a8b43[_0x4834('0x5c')]['body'],'phone':_0x58f05c,'WhatsappAccountId':_0x2577b5['id'],'WhatsappInteractionId':_0x22fa9d['id'],'UserId':_0x4a8b43[_0x4834('0x54')]['id'],'ContactId':_0x53ade2['id']}))['then'](function(_0x196931){_0x22fa9d[_0x4834('0xbf')]['Messages']=[];_0x22fa9d[_0x4834('0xbf')][_0x4834('0xbe')][_0x4834('0xa8')](_0x196931[_0x4834('0xbf')]);return _0x22fa9d;});})[_0x4834('0x1d')](respondWithResult(_0x23059b,null))[_0x4834('0x26')](handleError(_0x23059b,null));}; \ No newline at end of file +var _0x90aa=['create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','body','describe','addDisposition','WhatsappAccountId','Disposition','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','account','sinch','statuses','state','read','applications','Applications','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','Body','messageId','MessageSid','notifications','message_id','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','push','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','get','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x90aa,0x12b));var _0xa90a=function(_0x1da919,_0x329d3c){_0x1da919=_0x1da919-0x0;var _0x58aca7=_0x90aa[_0x1da919];return _0x58aca7;};'use strict';var emlformat=require(_0xa90a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa90a('0x1'));var jsonpatch=require(_0xa90a('0x2'));var rp=require(_0xa90a('0x3'));var moment=require('moment');var BPromise=require(_0xa90a('0x4'));var Mustache=require(_0xa90a('0x5'));var util=require(_0xa90a('0x6'));var path=require(_0xa90a('0x7'));var sox=require(_0xa90a('0x8'));var csv=require(_0xa90a('0x9'));var ejs=require(_0xa90a('0xa'));var fs=require('fs');var fs_extra=require(_0xa90a('0xb'));var _=require('lodash');var squel=require(_0xa90a('0xc'));var crypto=require(_0xa90a('0xd'));var jsforce=require(_0xa90a('0xe'));var deskjs=require(_0xa90a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa90a('0x10'));var Papa=require(_0xa90a('0x11'));var Redis=require(_0xa90a('0x12'));var authService=require(_0xa90a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa90a('0x14'));var hardwareService=require(_0xa90a('0x15'));var logger=require(_0xa90a('0x16'))(_0xa90a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa90a('0x18'))['db'];config[_0xa90a('0x19')]=_[_0xa90a('0x1a')](config['redis'],{'host':_0xa90a('0x1b'),'port':0x18eb});var socket=require(_0xa90a('0x1c'))(new Redis(config[_0xa90a('0x19')]));require(_0xa90a('0x1d'))[_0xa90a('0x1e')](socket);var jayson=require(_0xa90a('0x1f'));var client=jayson['client'][_0xa90a('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1e739b,_0x3cf5c6,_0x2cd99d,_0x5e4a32){return new BPromise(function(_0x570646,_0x3c9dd9){var _0x239f23=_0x5e4a32||client;return _0x239f23[_0xa90a('0x21')](_0x1e739b,_0x2cd99d)['then'](function(_0x2a474f){logger['info'](_0xa90a('0x22'),_0x3cf5c6,_0xa90a('0x23'));logger[_0xa90a('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3cf5c6,'request\x20sent',JSON[_0xa90a('0x25')](_0x2a474f));if(_0x2a474f[_0xa90a('0x26')]){if(_0x2a474f[_0xa90a('0x26')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3cf5c6,_0x2a474f[_0xa90a('0x26')][_0xa90a('0x27')]);return _0x3c9dd9(_0x2a474f['error'][_0xa90a('0x27')]);}logger[_0xa90a('0x26')](_0xa90a('0x22'),_0x3cf5c6,_0x2a474f[_0xa90a('0x26')][_0xa90a('0x27')]);return _0x570646(_0x2a474f[_0xa90a('0x26')][_0xa90a('0x27')]);}else{logger[_0xa90a('0x28')](_0xa90a('0x22'),_0x3cf5c6,_0xa90a('0x23'));_0x570646(_0x2a474f[_0xa90a('0x29')][_0xa90a('0x27')]);}})[_0xa90a('0x2a')](function(_0x50abf6){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3cf5c6,_0x50abf6);_0x3c9dd9(_0x50abf6);});});}function respondWithStatusCode(_0x296cbd,_0x370f8a){_0x370f8a=_0x370f8a||0xcc;return function(_0x2d3ab2){if(_0x2d3ab2){return _0x296cbd[_0xa90a('0x2b')](_0x370f8a);}return _0x296cbd[_0xa90a('0x2c')](_0x370f8a)[_0xa90a('0x2d')]();};}function respondWithResult(_0x372b53,_0x41c85c){_0x41c85c=_0x41c85c||0xc8;return function(_0x3102ff){if(_0x3102ff){return _0x372b53[_0xa90a('0x2c')](_0x41c85c)['json'](_0x3102ff);}};}function respondWithFilteredResult(_0x55983f,_0x3a6213){return function(_0x1b4d16){if(_0x1b4d16){var _0x190783=typeof _0x3a6213[_0xa90a('0x2e')]==='undefined'&&typeof _0x3a6213[_0xa90a('0x2f')]===_0xa90a('0x30');var _0x36a7a6=_0x1b4d16[_0xa90a('0x31')];var _0x3c871f=_0x190783?0x0:_0x3a6213[_0xa90a('0x2e')];var _0x130ac6=_0x190783?_0x1b4d16[_0xa90a('0x31')]:_0x3a6213[_0xa90a('0x2e')]+_0x3a6213['limit'];var _0x518fa3;if(_0x130ac6>=_0x36a7a6){_0x130ac6=_0x36a7a6;_0x518fa3=0xc8;}else{_0x518fa3=0xce;}_0x55983f[_0xa90a('0x2c')](_0x518fa3);return _0x55983f[_0xa90a('0x32')]('Content-Range',_0x3c871f+'-'+_0x130ac6+'/'+_0x36a7a6)[_0xa90a('0x33')](_0x1b4d16);}return null;};}function patchUpdates(_0xafc7cc){return function(_0xe60271){try{jsonpatch[_0xa90a('0x34')](_0xe60271,_0xafc7cc,!![]);}catch(_0x5089f4){return BPromise[_0xa90a('0x35')](_0x5089f4);}return _0xe60271[_0xa90a('0x36')]();};}function saveUpdates(_0x1d7d01,_0x504325){return function(_0x5cf73f){if(_0x5cf73f){return _0x5cf73f[_0xa90a('0x37')](_0x1d7d01)[_0xa90a('0x38')](function(_0x3ac6fa){return _0x3ac6fa;});}return null;};}function removeEntity(_0x34e409,_0x514d07){return function(_0x49335e){if(_0x49335e){return _0x49335e['destroy']()['then'](function(){var _0x1f657b=_0x49335e[_0xa90a('0x39')]({'plain':!![]});var _0x285242='WhatsappAccounts';return db['UserProfileResource'][_0xa90a('0x3a')]({'where':{'type':_0x285242,'resourceId':_0x1f657b['id']}})[_0xa90a('0x38')](function(){return _0x49335e;});})[_0xa90a('0x38')](function(){_0x34e409[_0xa90a('0x2c')](0xcc)[_0xa90a('0x2d')]();});}};}function handleEntityNotFound(_0x3d08d3,_0x362d14){return function(_0x35d725){if(!_0x35d725){_0x3d08d3[_0xa90a('0x2b')](0x194);}return _0x35d725;};}function handleError(_0x307315,_0x32c69e){_0x32c69e=_0x32c69e||0x1f4;return function(_0x30a69e){logger['error'](_0x30a69e[_0xa90a('0x3b')]);if(_0x30a69e['name']){delete _0x30a69e[_0xa90a('0x3c')];}_0x307315[_0xa90a('0x2c')](_0x32c69e)[_0xa90a('0x3d')](_0x30a69e);};}exports[_0xa90a('0x3e')]=function(_0x109021,_0x188144){var _0x161806={'include':[{'model':db[_0xa90a('0x3f')],'as':_0xa90a('0x40')}]},_0x2deaf2={},_0x2c765b={'count':0x0,'rows':[]};var _0x1e3671=_[_0xa90a('0x41')](db[_0xa90a('0x42')]['rawAttributes'],function(_0x33cf49){return{'name':_0x33cf49[_0xa90a('0x43')],'type':_0x33cf49[_0xa90a('0x44')][_0xa90a('0x45')]};});_0x2deaf2['model']=_[_0xa90a('0x41')](_0x1e3671,_0xa90a('0x3c'));_0x2deaf2[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x109021[_0xa90a('0x46')]);_0x2deaf2['filters']=_[_0xa90a('0x48')](_0x2deaf2['model'],_0x2deaf2[_0xa90a('0x46')]);_0x161806[_0xa90a('0x49')]=_[_0xa90a('0x48')](_0x2deaf2[_0xa90a('0x4a')],qs[_0xa90a('0x4b')](_0x109021[_0xa90a('0x46')][_0xa90a('0x4b')]));_0x161806[_0xa90a('0x49')]=_0x161806[_0xa90a('0x49')]['length']?_0x161806[_0xa90a('0x49')]:_0x2deaf2[_0xa90a('0x4a')];if(!_0x109021['query'][_0xa90a('0x4c')](_0xa90a('0x4d'))){_0x161806[_0xa90a('0x2f')]=qs[_0xa90a('0x2f')](_0x109021['query']['limit']);_0x161806[_0xa90a('0x2e')]=qs[_0xa90a('0x2e')](_0x109021['query'][_0xa90a('0x2e')]);}_0x161806[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x109021[_0xa90a('0x46')]['sort']);_0x161806[_0xa90a('0x50')]=qs[_0xa90a('0x51')](_[_0xa90a('0x52')](_0x109021[_0xa90a('0x46')],_0x2deaf2['filters']),_0x1e3671);if(_0x109021[_0xa90a('0x46')]['filter']){_0x161806['where']=_[_0xa90a('0x53')](_0x161806['where'],{'$or':_[_0xa90a('0x41')](_0x1e3671,function(_0x3b332d){if(_0x3b332d[_0xa90a('0x44')]!==_0xa90a('0x54')){var _0x5c78db={};_0x5c78db[_0x3b332d['name']]={'$like':'%'+_0x109021[_0xa90a('0x46')][_0xa90a('0x55')]+'%'};return _0x5c78db;}})});}_0x161806=_['merge']({},_0x161806,_0x109021[_0xa90a('0x56')]);var _0x231871={'where':_0x161806[_0xa90a('0x50')]};return db[_0xa90a('0x42')][_0xa90a('0x31')](_0x231871)[_0xa90a('0x38')](function(_0x2411f6){_0x2c765b[_0xa90a('0x31')]=_0x2411f6;if(_0x109021[_0xa90a('0x46')][_0xa90a('0x57')]){_0x161806[_0xa90a('0x58')]=[{'all':!![]}];}return db[_0xa90a('0x42')][_0xa90a('0x59')](_0x161806);})['then'](function(_0x3800df){_0x2c765b[_0xa90a('0x5a')]=_0x3800df;return _0x2c765b;})[_0xa90a('0x38')](respondWithFilteredResult(_0x188144,_0x161806))[_0xa90a('0x2a')](handleError(_0x188144,null));};exports[_0xa90a('0x5b')]=function(_0x34e594,_0x4cbe31){var _0x2ba008={'raw':![],'where':{'id':_0x34e594[_0xa90a('0x5c')]['id']},'include':[{'model':db[_0xa90a('0x3f')],'as':_0xa90a('0x40')}]},_0x5eefd4={};_0x5eefd4[_0xa90a('0x4a')]=_['keys'](db[_0xa90a('0x42')][_0xa90a('0x5d')]);_0x5eefd4[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x34e594[_0xa90a('0x46')]);_0x5eefd4[_0xa90a('0x51')]=_['intersection'](_0x5eefd4[_0xa90a('0x4a')],_0x5eefd4[_0xa90a('0x46')]);_0x2ba008[_0xa90a('0x49')]=_[_0xa90a('0x48')](_0x5eefd4[_0xa90a('0x4a')],qs['fields'](_0x34e594['query'][_0xa90a('0x4b')]));_0x2ba008['attributes']=_0x2ba008[_0xa90a('0x49')]['length']?_0x2ba008['attributes']:_0x5eefd4['model'];if(_0x34e594[_0xa90a('0x46')][_0xa90a('0x57')]){_0x2ba008[_0xa90a('0x58')]=[{'all':!![]}];}_0x2ba008=_[_0xa90a('0x53')]({},_0x2ba008,_0x34e594[_0xa90a('0x56')]);return db['WhatsappAccount'][_0xa90a('0x5e')](_0x2ba008)[_0xa90a('0x38')](handleEntityNotFound(_0x4cbe31,null))[_0xa90a('0x38')](respondWithResult(_0x4cbe31,null))[_0xa90a('0x2a')](handleError(_0x4cbe31,null));};exports[_0xa90a('0x5f')]=function(_0xbf7c4b,_0x546f79){return db['WhatsappAccount']['create'](_0xbf7c4b['body'],{})[_0xa90a('0x38')](function(_0x7e7cd9){var _0x1239e0=_0xbf7c4b['user']['get']({'plain':!![]});if(!_0x1239e0)throw new Error(_0xa90a('0x60'));if(_0x1239e0[_0xa90a('0x61')]===_0xa90a('0x62')){var _0x511197=_0x7e7cd9[_0xa90a('0x39')]({'plain':!![]});var _0x438eb8='WhatsappAccounts';return db[_0xa90a('0x63')][_0xa90a('0x5e')]({'where':{'name':_0x438eb8,'userProfileId':_0x1239e0['userProfileId']},'raw':!![]})[_0xa90a('0x38')](function(_0x2b28b2){if(_0x2b28b2&&_0x2b28b2[_0xa90a('0x64')]===0x0){return db[_0xa90a('0x65')][_0xa90a('0x5f')]({'name':_0x511197['name'],'resourceId':_0x511197['id'],'type':_0x2b28b2[_0xa90a('0x3c')],'sectionId':_0x2b28b2['id']},{})[_0xa90a('0x38')](function(){return _0x7e7cd9;});}else{return _0x7e7cd9;}})['catch'](function(_0x4042bb){logger[_0xa90a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4042bb);throw _0x4042bb;});}return _0x7e7cd9;})[_0xa90a('0x38')](respondWithResult(_0x546f79,0xc9))['catch'](handleError(_0x546f79,null));};exports[_0xa90a('0x37')]=function(_0x1ce3bf,_0x569c98){if(_0x1ce3bf[_0xa90a('0x66')]['id']){delete _0x1ce3bf[_0xa90a('0x66')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1ce3bf['params']['id']},'include':[{'model':db[_0xa90a('0x3f')],'as':_0xa90a('0x40')}]})[_0xa90a('0x38')](handleEntityNotFound(_0x569c98,null))[_0xa90a('0x38')](saveUpdates(_0x1ce3bf[_0xa90a('0x66')],null))[_0xa90a('0x38')](respondWithResult(_0x569c98,null))[_0xa90a('0x2a')](handleError(_0x569c98,null));};exports[_0xa90a('0x3a')]=function(_0x50b1d3,_0xc321e8){return db[_0xa90a('0x42')]['find']({'where':{'id':_0x50b1d3[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0xc321e8,null))[_0xa90a('0x38')](removeEntity(_0xc321e8,null))[_0xa90a('0x2a')](handleError(_0xc321e8,null));};exports['describe']=function(_0x19312b,_0x57eddf){return db[_0xa90a('0x42')][_0xa90a('0x67')]()['then'](respondWithResult(_0x57eddf,null))[_0xa90a('0x2a')](handleError(_0x57eddf,null));};exports[_0xa90a('0x68')]=function(_0xe8d931,_0x491090,_0x415d77){if(_0xe8d931[_0xa90a('0x66')]['id']){delete _0xe8d931[_0xa90a('0x66')]['id'];}return db['WhatsappAccount'][_0xa90a('0x5e')]({'where':{'id':_0xe8d931['params']['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x491090,null))[_0xa90a('0x38')](function(_0x441ba6){if(_0x441ba6){_0xe8d931[_0xa90a('0x66')][_0xa90a('0x69')]=_0x441ba6['id'];return db[_0xa90a('0x6a')]['create'](_0xe8d931[_0xa90a('0x66')]);}})[_0xa90a('0x38')](respondWithResult(_0x491090,null))[_0xa90a('0x2a')](handleError(_0x491090,null));};exports['getDispositions']=function(_0x4737a9,_0x4f2c28,_0x3b82aa){var _0x3f92f5={'raw':![],'where':{}};var _0x3daecd={};var _0xfb99b={'count':0x0,'rows':[]};return db[_0xa90a('0x42')][_0xa90a('0x6b')]({'where':{'id':_0x4737a9[_0xa90a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4f2c28,null))[_0xa90a('0x38')](function(_0x322165){if(_0x322165){_0x3daecd[_0xa90a('0x4a')]=_['keys'](db['Disposition'][_0xa90a('0x5d')]);_0x3daecd[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x4737a9[_0xa90a('0x46')]);_0x3daecd[_0xa90a('0x51')]=_['intersection'](_0x3daecd[_0xa90a('0x4a')],_0x3daecd[_0xa90a('0x46')]);_0x3f92f5['attributes']=_[_0xa90a('0x48')](_0x3daecd[_0xa90a('0x4a')],qs[_0xa90a('0x4b')](_0x4737a9[_0xa90a('0x46')][_0xa90a('0x4b')]));_0x3f92f5[_0xa90a('0x49')]=_0x3f92f5[_0xa90a('0x49')][_0xa90a('0x6c')]?_0x3f92f5[_0xa90a('0x49')]:_0x3daecd[_0xa90a('0x4a')];if(!_0x4737a9['query']['hasOwnProperty'](_0xa90a('0x4d'))){_0x3f92f5[_0xa90a('0x2f')]=qs[_0xa90a('0x2f')](_0x4737a9[_0xa90a('0x46')][_0xa90a('0x2f')]);_0x3f92f5[_0xa90a('0x2e')]=qs[_0xa90a('0x2e')](_0x4737a9[_0xa90a('0x46')][_0xa90a('0x2e')]);}_0x3f92f5[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x4737a9[_0xa90a('0x46')]['sort']);_0x3f92f5[_0xa90a('0x50')]=qs['filters'](_[_0xa90a('0x52')](_0x4737a9[_0xa90a('0x46')],_0x3daecd[_0xa90a('0x51')]));_0x3f92f5[_0xa90a('0x50')][_0xa90a('0x69')]=_0x322165['id'];if(_0x4737a9['query'][_0xa90a('0x55')]){_0x3f92f5[_0xa90a('0x50')]=_[_0xa90a('0x53')](_0x3f92f5[_0xa90a('0x50')],{'$or':_[_0xa90a('0x41')](_0x3f92f5[_0xa90a('0x49')],function(_0x2af4b9){var _0x5e2975={};_0x5e2975[_0x2af4b9]={'$like':'%'+_0x4737a9[_0xa90a('0x46')]['filter']+'%'};return _0x5e2975;})});}_0x3f92f5=_['merge']({},_0x3f92f5,_0x4737a9[_0xa90a('0x56')]);return db[_0xa90a('0x6a')][_0xa90a('0x31')]({'where':_0x3f92f5[_0xa90a('0x50')]})['then'](function(_0x2cc936){_0xfb99b['count']=_0x2cc936;if(_0x4737a9[_0xa90a('0x46')][_0xa90a('0x57')]){_0x3f92f5[_0xa90a('0x58')]=[{'all':!![]}];}return db['Disposition'][_0xa90a('0x59')](_0x3f92f5);})[_0xa90a('0x38')](function(_0x53dd0c){_0xfb99b[_0xa90a('0x5a')]=_0x53dd0c;return _0xfb99b;});}})[_0xa90a('0x38')](respondWithFilteredResult(_0x4f2c28,_0x3f92f5))[_0xa90a('0x2a')](handleError(_0x4f2c28,null));};exports['removeDispositions']=function(_0xefd06f,_0x316eee,_0x44d213){return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0xefd06f[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x316eee,null))[_0xa90a('0x38')](function(_0x2bd0e7){if(_0x2bd0e7){return _0x2bd0e7[_0xa90a('0x6d')](_0xefd06f[_0xa90a('0x46')][_0xa90a('0x6e')]);}})['then'](respondWithStatusCode(_0x316eee,null))[_0xa90a('0x2a')](handleError(_0x316eee,null));};exports[_0xa90a('0x6f')]=function(_0x1c9c20,_0x50556c,_0x1ebd16){if(_0x1c9c20['body']['id']){delete _0x1c9c20['body']['id'];}return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0x1c9c20['params']['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x50556c,null))[_0xa90a('0x38')](function(_0x1b9aaf){if(_0x1b9aaf){_0x1c9c20[_0xa90a('0x66')]['WhatsappAccountId']=_0x1b9aaf['id'];return db[_0xa90a('0x70')][_0xa90a('0x5f')](_0x1c9c20['body']);}})[_0xa90a('0x38')](respondWithResult(_0x50556c,null))[_0xa90a('0x2a')](handleError(_0x50556c,null));};exports[_0xa90a('0x71')]=function(_0x140e61,_0x716a8c,_0x212045){var _0x5ba8a2={'raw':![],'where':{}};var _0x2607fd={};var _0x26bc4b={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xa90a('0x6b')]({'where':{'id':_0x140e61['params']['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x716a8c,null))[_0xa90a('0x38')](function(_0x1ad01c){if(_0x1ad01c){_0x2607fd['model']=_[_0xa90a('0x47')](db[_0xa90a('0x70')][_0xa90a('0x5d')]);_0x2607fd[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x140e61[_0xa90a('0x46')]);_0x2607fd[_0xa90a('0x51')]=_[_0xa90a('0x48')](_0x2607fd[_0xa90a('0x4a')],_0x2607fd['query']);_0x5ba8a2['attributes']=_['intersection'](_0x2607fd['model'],qs['fields'](_0x140e61[_0xa90a('0x46')][_0xa90a('0x4b')]));_0x5ba8a2[_0xa90a('0x49')]=_0x5ba8a2[_0xa90a('0x49')][_0xa90a('0x6c')]?_0x5ba8a2[_0xa90a('0x49')]:_0x2607fd[_0xa90a('0x4a')];if(!_0x140e61[_0xa90a('0x46')][_0xa90a('0x4c')](_0xa90a('0x4d'))){_0x5ba8a2[_0xa90a('0x2f')]=qs['limit'](_0x140e61[_0xa90a('0x46')][_0xa90a('0x2f')]);_0x5ba8a2['offset']=qs['offset'](_0x140e61['query']['offset']);}_0x5ba8a2[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x140e61[_0xa90a('0x46')][_0xa90a('0x4f')]);_0x5ba8a2[_0xa90a('0x50')]=qs[_0xa90a('0x51')](_[_0xa90a('0x52')](_0x140e61[_0xa90a('0x46')],_0x2607fd[_0xa90a('0x51')]));_0x5ba8a2[_0xa90a('0x50')][_0xa90a('0x69')]=_0x1ad01c['id'];if(_0x140e61[_0xa90a('0x46')][_0xa90a('0x55')]){_0x5ba8a2['where']=_[_0xa90a('0x53')](_0x5ba8a2[_0xa90a('0x50')],{'$or':_[_0xa90a('0x41')](_0x5ba8a2['attributes'],function(_0x5e6b00){var _0x2dc87c={};_0x2dc87c[_0x5e6b00]={'$like':'%'+_0x140e61[_0xa90a('0x46')]['filter']+'%'};return _0x2dc87c;})});}_0x5ba8a2=_[_0xa90a('0x53')]({},_0x5ba8a2,_0x140e61['options']);return db[_0xa90a('0x70')][_0xa90a('0x31')]({'where':_0x5ba8a2[_0xa90a('0x50')]})[_0xa90a('0x38')](function(_0x213a2e){_0x26bc4b['count']=_0x213a2e;if(_0x140e61['query'][_0xa90a('0x57')]){_0x5ba8a2['include']=[{'all':!![]}];}return db[_0xa90a('0x70')][_0xa90a('0x59')](_0x5ba8a2);})[_0xa90a('0x38')](function(_0x33fa82){_0x26bc4b['rows']=_0x33fa82;return _0x26bc4b;});}})[_0xa90a('0x38')](respondWithFilteredResult(_0x716a8c,_0x5ba8a2))['catch'](handleError(_0x716a8c,null));};exports[_0xa90a('0x72')]=function(_0x79ca36,_0xdbf475,_0x28ce71){return db[_0xa90a('0x42')]['find']({'where':{'id':_0x79ca36[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0xdbf475,null))[_0xa90a('0x38')](function(_0x26cd53){if(_0x26cd53){return _0x26cd53['removeAnswers'](_0x79ca36[_0xa90a('0x46')][_0xa90a('0x6e')]);}})[_0xa90a('0x38')](respondWithStatusCode(_0xdbf475,null))[_0xa90a('0x2a')](handleError(_0xdbf475,null));};exports[_0xa90a('0x73')]=function(_0x13fea9,_0x1c7756,_0x535202){return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0x13fea9[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x1c7756,null))[_0xa90a('0x38')](function(_0x420f11){if(_0x420f11){return _0x420f11[_0xa90a('0x73')](_0x13fea9[_0xa90a('0x66')][_0xa90a('0x6e')],_[_0xa90a('0x74')](_0x13fea9[_0xa90a('0x66')],[_0xa90a('0x6e'),'id'])||{})['spread'](function(_0x4eb95e){for(var _0x4b7674=0x0;_0x4b7674<_0x13fea9[_0xa90a('0x66')][_0xa90a('0x6e')][_0xa90a('0x6c')];_0x4b7674+=0x1){socket[_0xa90a('0x75')](_0xa90a('0x76'),{'UserId':Number(_0x13fea9[_0xa90a('0x66')][_0xa90a('0x6e')][_0x4b7674]),'WhatsappAccountId':Number(_0x13fea9[_0xa90a('0x5c')]['id'])});}return _0x4eb95e;});}})[_0xa90a('0x38')](respondWithResult(_0x1c7756,null))[_0xa90a('0x2a')](handleError(_0x1c7756,null));};exports[_0xa90a('0x77')]=function(_0x2b8f84,_0xfa0f24,_0x131070){return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0x2b8f84[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0xfa0f24,null))[_0xa90a('0x38')](function(_0x124f7d){if(_0x124f7d){return _0x124f7d[_0xa90a('0x77')](_0x2b8f84[_0xa90a('0x46')][_0xa90a('0x6e')])[_0xa90a('0x38')](function(){if(_['isArray'](_0x2b8f84[_0xa90a('0x46')]['ids'])){for(var _0x495826=0x0;_0x495826<_0x2b8f84[_0xa90a('0x46')][_0xa90a('0x6e')]['length'];_0x495826+=0x1){socket[_0xa90a('0x75')](_0xa90a('0x78'),{'UserId':Number(_0x2b8f84[_0xa90a('0x46')][_0xa90a('0x6e')][_0x495826]),'WhatsappAccountId':Number(_0x2b8f84[_0xa90a('0x5c')]['id'])});}}else{socket[_0xa90a('0x75')](_0xa90a('0x78'),{'UserId':Number(_0x2b8f84[_0xa90a('0x46')]['ids']),'WhatsappAccountId':Number(_0x2b8f84[_0xa90a('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0xfa0f24,null))['catch'](handleError(_0xfa0f24,null));};exports[_0xa90a('0x79')]=function(_0x1eb694,_0x50e920,_0x5487de){var _0x2c44f5={};var _0x2b5cc7={};var _0x1c6269;var _0x1a20ce;return db['WhatsappAccount'][_0xa90a('0x6b')]({'where':{'id':_0x1eb694[_0xa90a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x50e920,null))[_0xa90a('0x38')](function(_0x1dfc89){if(_0x1dfc89){_0x1c6269=_0x1dfc89;_0x2b5cc7['model']=_[_0xa90a('0x47')](db[_0xa90a('0x7a')][_0xa90a('0x5d')]);_0x2b5cc7[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x1eb694[_0xa90a('0x46')]);_0x2b5cc7[_0xa90a('0x51')]=_[_0xa90a('0x48')](_0x2b5cc7[_0xa90a('0x4a')],_0x2b5cc7[_0xa90a('0x46')]);_0x2c44f5['attributes']=_[_0xa90a('0x48')](_0x2b5cc7['model'],qs[_0xa90a('0x4b')](_0x1eb694[_0xa90a('0x46')][_0xa90a('0x4b')]));_0x2c44f5[_0xa90a('0x49')]=_0x2c44f5[_0xa90a('0x49')][_0xa90a('0x6c')]?_0x2c44f5[_0xa90a('0x49')]:_0x2b5cc7['model'];_0x2c44f5[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x1eb694[_0xa90a('0x46')][_0xa90a('0x4f')]);_0x2c44f5[_0xa90a('0x50')]=qs[_0xa90a('0x51')](_[_0xa90a('0x52')](_0x1eb694[_0xa90a('0x46')],_0x2b5cc7[_0xa90a('0x51')]));if(_0x1eb694['query'][_0xa90a('0x55')]){_0x2c44f5[_0xa90a('0x50')]=_[_0xa90a('0x53')](_0x2c44f5[_0xa90a('0x50')],{'$or':_[_0xa90a('0x41')](_0x2c44f5[_0xa90a('0x49')],function(_0x471a9c){var _0x23046d={};_0x23046d[_0x471a9c]={'$like':'%'+_0x1eb694['query'][_0xa90a('0x55')]+'%'};return _0x23046d;})});}_0x2c44f5=_['merge']({},_0x2c44f5,_0x1eb694['options']);return _0x1c6269[_0xa90a('0x79')](_0x2c44f5);}})[_0xa90a('0x38')](function(_0x450a1e){if(_0x450a1e){_0x1a20ce=_0x450a1e['length'];if(!_0x1eb694['query']['hasOwnProperty']('nolimit')){_0x2c44f5[_0xa90a('0x2f')]=qs[_0xa90a('0x2f')](_0x1eb694['query'][_0xa90a('0x2f')]);_0x2c44f5[_0xa90a('0x2e')]=qs[_0xa90a('0x2e')](_0x1eb694[_0xa90a('0x46')][_0xa90a('0x2e')]);}return _0x1c6269[_0xa90a('0x79')](_0x2c44f5);}})[_0xa90a('0x38')](function(_0x53da77){if(_0x53da77){return _0x53da77?{'count':_0x1a20ce,'rows':_0x53da77}:null;}})['then'](respondWithResult(_0x50e920,null))[_0xa90a('0x2a')](handleError(_0x50e920,null));};exports[_0xa90a('0x7b')]=function(_0x380069,_0x349100){var _0x11e6be=_0x380069['params']['id'];var _0x2cb3dd=_0x380069['body'];var _0x51a793=0xc8;var _0x3c52b2=null;return db[_0xa90a('0x7c')][_0xa90a('0x7d')]({'isolationLevel':db[_0xa90a('0x7c')][_0xa90a('0x7e')][_0xa90a('0x7f')][_0xa90a('0x80')]},function(_0x450873){return db[_0xa90a('0x42')]['findOne']({'where':{'id':_0x11e6be},'transaction':_0x450873})[_0xa90a('0x38')](function(_0x37374d){if(_0x37374d){return db[_0xa90a('0x81')][_0xa90a('0x3a')]({'where':{'WhatsappAccountId':_0x11e6be},'transaction':_0x450873})['then'](function(){var _0x1e9723=_[_0xa90a('0x41')](_0x2cb3dd,function(_0x1f64f1){_0x1f64f1[_0xa90a('0x69')]=_0x11e6be;return _0x1f64f1;});return db[_0xa90a('0x81')][_0xa90a('0x82')](_0x1e9723,{'transaction':_0x450873});});}else{_0x51a793=0x194;_0x3c52b2=[];}});})[_0xa90a('0x38')](function(){if(_0x51a793!==0x194){return db[_0xa90a('0x81')][_0xa90a('0x83')]({'where':{'WhatsappAccountId':_0x11e6be},'order':'priority'})[_0xa90a('0x38')](function(_0x3a7a41){_0x3c52b2=_0x3a7a41;});}})[_0xa90a('0x2a')](function(_0x3bd702){_0x51a793=0x1f4;logger['error'](_0x3bd702[_0xa90a('0x3b')]);if(_0x3bd702[_0xa90a('0x3c')]){delete _0x3bd702[_0xa90a('0x3c')];}_0x3c52b2=_0x3bd702;})[_0xa90a('0x84')](function(){if(_0x3c52b2===null){_0x349100[_0xa90a('0x2b')](_0x51a793);}else{if(_0x51a793===0x1f4){_0x349100[_0xa90a('0x2c')](_0x51a793)[_0xa90a('0x3d')](_0x3c52b2);}else{_0x349100[_0xa90a('0x2c')](_0x51a793)['json'](_0x3c52b2);}}});};exports[_0xa90a('0x85')]=function(_0x3181ff,_0x3a3c1b,_0x39f40c){var _0x1a211b={};var _0x2322a4={};var _0x3dc982;var _0x33febc;return db[_0xa90a('0x42')][_0xa90a('0x6b')]({'where':{'id':_0x3181ff[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x3a3c1b,null))[_0xa90a('0x38')](function(_0x4d8130){if(_0x4d8130){_0x3dc982=_0x4d8130;_0x2322a4[_0xa90a('0x4a')]=_[_0xa90a('0x47')](db[_0xa90a('0x81')]['rawAttributes']);_0x2322a4[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x3181ff[_0xa90a('0x46')]);_0x2322a4[_0xa90a('0x51')]=_[_0xa90a('0x48')](_0x2322a4['model'],_0x2322a4[_0xa90a('0x46')]);_0x1a211b[_0xa90a('0x49')]=_[_0xa90a('0x48')](_0x2322a4['model'],qs[_0xa90a('0x4b')](_0x3181ff['query'][_0xa90a('0x4b')]));_0x1a211b[_0xa90a('0x49')]=_0x1a211b[_0xa90a('0x49')][_0xa90a('0x6c')]?_0x1a211b[_0xa90a('0x49')]:_0x2322a4[_0xa90a('0x4a')];_0x1a211b[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x3181ff[_0xa90a('0x46')]['sort']);_0x1a211b[_0xa90a('0x50')]=qs['filters'](_[_0xa90a('0x52')](_0x3181ff[_0xa90a('0x46')],_0x2322a4[_0xa90a('0x51')]));if(_0x3181ff[_0xa90a('0x46')][_0xa90a('0x55')]){_0x1a211b['where']=_['merge'](_0x1a211b['where'],{'$or':_[_0xa90a('0x41')](_0x1a211b[_0xa90a('0x49')],function(_0x4737ca){var _0x52f0d2={};_0x52f0d2[_0x4737ca]={'$like':'%'+_0x3181ff[_0xa90a('0x46')][_0xa90a('0x55')]+'%'};return _0x52f0d2;})});}_0x1a211b=_['merge']({},_0x1a211b,_0x3181ff[_0xa90a('0x56')]);return _0x3dc982['getApplications'](_0x1a211b);}})[_0xa90a('0x38')](function(_0x39d682){if(_0x39d682){_0x33febc=_0x39d682[_0xa90a('0x6c')];if(!_0x3181ff['query'][_0xa90a('0x4c')](_0xa90a('0x4d'))){_0x1a211b[_0xa90a('0x2f')]=qs[_0xa90a('0x2f')](_0x3181ff['query'][_0xa90a('0x2f')]);_0x1a211b[_0xa90a('0x2e')]=qs['offset'](_0x3181ff[_0xa90a('0x46')][_0xa90a('0x2e')]);}return _0x3dc982['getApplications'](_0x1a211b);}})[_0xa90a('0x38')](function(_0x362b98){if(_0x362b98){return _0x362b98?{'count':_0x33febc,'rows':_0x362b98}:null;}})[_0xa90a('0x38')](respondWithResult(_0x3a3c1b,null))[_0xa90a('0x2a')](handleError(_0x3a3c1b,null));};exports[_0xa90a('0x86')]=function(_0x51c354,_0x1a5d92,_0x47d53b){var _0x378364={'channel':'whatsapp'};var _0x4dadc0=[];var _0x38dcd8=[];var _0x425fed={};return db['WhatsappAccount'][_0xa90a('0x5e')]({'where':{'id':_0x51c354[_0xa90a('0x5c')]['id']},'include':[{'model':db[_0xa90a('0x81')],'as':'Applications'}]})[_0xa90a('0x38')](handleEntityNotFound(_0x1a5d92,null))[_0xa90a('0x38')](function(_0x46ae2e){_0x378364['account']=_0x46ae2e;if(_0x378364[_0xa90a('0x87')]&&_0x378364[_0xa90a('0x87')][_0xa90a('0x44')]===_0xa90a('0x88')&&_0x51c354[_0xa90a('0x66')][_0xa90a('0x89')]){if(_0x51c354[_0xa90a('0x66')]['statuses'][_0xa90a('0x6c')]===0x0)return;if(_0x51c354['body'][_0xa90a('0x89')][0x0][_0xa90a('0x8a')]!==_0xa90a('0x8b'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x51c354[_0xa90a('0x66')][_0xa90a('0x89')][0x0]['timestamp']},{'where':{'messageId':_0x51c354[_0xa90a('0x66')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xa90a('0x38')](function(_0x368591){return _0x1a5d92[_0xa90a('0x2c')](0xc8)[_0xa90a('0x33')](_0x368591);});}_0x378364[_0xa90a('0x8c')]=_['orderBy'](_0x46ae2e[_0xa90a('0x8d')],[_0xa90a('0x8e')],[_0xa90a('0x8f')]);if(_0x378364['account'][_0xa90a('0x8d')]){delete _0x378364[_0xa90a('0x87')][_0xa90a('0x8d')];}return db[_0xa90a('0x90')][_0xa90a('0x67')]()[_0xa90a('0x38')](function(_0x5896f2){if(!_0x5896f2){throw new db[(_0xa90a('0x91'))][(_0xa90a('0x92'))]('no\x20available\x20attributes');}_0x4dadc0=_[_0xa90a('0x93')](_[_0xa90a('0x47')](_0x5896f2),[_0xa90a('0x94'),_0xa90a('0x95')]);_0x38dcd8=_['difference'](_['keys'](_0x5896f2),[_0xa90a('0x94'),'updatedAt',_0xa90a('0x96'),_0xa90a('0x97')]);_0x378364[_0xa90a('0x66')]={'mapKey':_0xa90a('0x98')};if(_0x378364[_0xa90a('0x87')]&&_0x378364['account'][_0xa90a('0x44')]==='twilio'){_0x378364['body'][_0xa90a('0x99')]=_0x51c354[_0xa90a('0x66')][_0xa90a('0x9a')][_0xa90a('0x9b')]('whatsapp:','');_0x378364[_0xa90a('0x66')]['body']=_0x51c354['body'][_0xa90a('0x9c')];_0x378364[_0xa90a('0x66')][_0xa90a('0x9d')]=_0x51c354[_0xa90a('0x66')][_0xa90a('0x9e')];}if(_0x378364['account']&&_0x378364['account'][_0xa90a('0x44')]===_0xa90a('0x88')){_0x378364[_0xa90a('0x66')][_0xa90a('0x99')]=_0x51c354[_0xa90a('0x66')][_0xa90a('0x9f')][0x0]['from'];_0x378364[_0xa90a('0x66')]['body']=_0x51c354[_0xa90a('0x66')][_0xa90a('0x9f')][0x0][_0xa90a('0x27')][_0xa90a('0x66')];_0x378364['body']['messageId']=_0x51c354['body'][_0xa90a('0x9f')][0x0][_0xa90a('0xa0')];}if(_0x378364[_0xa90a('0x66')]['id']){delete _0x378364['body']['id'];}if(_[_0xa90a('0xa1')](_0x378364[_0xa90a('0x66')][_0xa90a('0x99')])){throw new db[(_0xa90a('0x91'))][(_0xa90a('0x92'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x378364['body'][_0xa90a('0x66')])||_0x378364[_0xa90a('0x66')][_0xa90a('0x66')]===''){throw new db[(_0xa90a('0x91'))][(_0xa90a('0x92'))](_0xa90a('0xa2'));}if(_[_0xa90a('0xa1')](_0x378364[_0xa90a('0x66')][_0xa90a('0xa3')])){throw new db['Sequelize'][(_0xa90a('0x92'))](_0xa90a('0xa4')+_0x38dcd8);}if(!_[_0xa90a('0xa5')](_0x38dcd8,_0x378364[_0xa90a('0x66')]['mapKey'])){throw new db[(_0xa90a('0x91'))][(_0xa90a('0x92'))](_0xa90a('0xa6')+_0x38dcd8);}_0x425fed[_0x378364[_0xa90a('0x66')][_0xa90a('0xa3')]]=_0x378364[_0xa90a('0x66')][_0xa90a('0x99')];return db['CmList'][_0xa90a('0x5e')]({'where':{'id':_0x378364[_0xa90a('0x87')][_0xa90a('0x97')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x425fed,'limit':0x1,'order':[[_0xa90a('0x95'),_0xa90a('0xa7')]]}]});})[_0xa90a('0x38')](handleEntityNotFound(_0x1a5d92,null))[_0xa90a('0x38')](function(_0x2b4218){if(_0x2b4218){_0x378364[_0xa90a('0xa8')]=_[_0xa90a('0x74')](_0x2b4218,[_0xa90a('0xa9')]);if(_0x2b4218[_0xa90a('0xa9')][_0xa90a('0x6c')]){return _0x2b4218[_0xa90a('0xa9')][0x0];}var _0x250244=_[_0xa90a('0x1a')](_0x378364[_0xa90a('0x66')],{'firstName':_0x378364[_0xa90a('0x66')][_0xa90a('0x99')],'ListId':_0x2b4218['id']});_0x250244[_0x378364[_0xa90a('0x66')][_0xa90a('0xa3')]]=_0x378364['body'][_0xa90a('0x99')];return db['CmContact']['create'](_0x250244,{'fields':_0x4dadc0,'raw':!![]});}})[_0xa90a('0x38')](handleEntityNotFound(_0x1a5d92,null))[_0xa90a('0x38')](function(_0x4c3660){if(_0x4c3660){_0x378364[_0xa90a('0xaa')]=_0x4c3660;var _0x13daac={'ContactId':_0x4c3660['id'],'phone':_0x378364[_0xa90a('0x66')]['from'],'WhatsappAccountId':_0x51c354[_0xa90a('0x5c')]['id']};var _0x416c31={'ContactId':_0x4c3660['id'],'WhatsappAccountId':_0x51c354[_0xa90a('0x5c')]['id'],'closed':![]};return db[_0xa90a('0xab')][_0xa90a('0x5e')]({'where':_0x416c31})[_0xa90a('0x38')](function(_0x53d004){if(_0x53d004){return[_0x53d004,![]];}return db[_0xa90a('0xab')][_0xa90a('0x5f')](_0x13daac)[_0xa90a('0x38')](function(_0x2b05f1){return[_0x2b05f1,!![]];});});}})['spread'](function(_0x411f62,_0x369aae){_0x378364[_0xa90a('0xac')]=_0x411f62[_0xa90a('0x39')]({'plain':!![]});_0x378364[_0xa90a('0xac')][_0xa90a('0xad')]=![];if(_0x369aae){if(_0x378364['account']['autoclose']){_0x378364[_0xa90a('0x8c')][_0xa90a('0xae')]({'id':0x0,'priority':_0x378364[_0xa90a('0x8c')]['length']+0x1,'app':'close','appdata':_0xa90a('0xaf'),'interval':_0xa90a('0xb0')});}_0x378364[_0xa90a('0xac')][_0xa90a('0xad')]=!![];}return db[_0xa90a('0xb1')][_0xa90a('0x5f')]({'phone':_0x378364[_0xa90a('0x66')][_0xa90a('0x99')],'messageId':_0x378364[_0xa90a('0x66')][_0xa90a('0x9d')],'body':_0x378364[_0xa90a('0x66')]['body'],'WhatsappAccountId':_0x51c354['params']['id'],'WhatsappInteractionId':_0x411f62['id'],'direction':'in','ContactId':_0x411f62[_0xa90a('0xb2')],'AttachmentId':_0x378364[_0xa90a('0x66')][_0xa90a('0xb3')]});})[_0xa90a('0x38')](function(_0x3af4a3){_0x378364[_0xa90a('0x27')]=_0x3af4a3;if(_0x378364[_0xa90a('0xac')]['UserId']){return db['User'][_0xa90a('0x5e')]({'attributes':['id',_0xa90a('0x3c')],'where':{'id':_0x378364[_0xa90a('0xac')]['UserId']}})[_0xa90a('0x38')](function(_0x4159f6){if(_0x4159f6){_0x378364['applications'][_0xa90a('0xb4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4159f6['name']+','+(_0x378364[_0xa90a('0x87')][_0xa90a('0xb5')]||0xa),'interval':_0xa90a('0xb0')});}return respondWithRpcPromise(_0xa90a('0xb6'),_0xa90a('0xb7'),_0x378364);});}return respondWithRpcPromise('Start',_0xa90a('0xb7'),_0x378364);})['then'](function(_0x83a099){if(_0x83a099){var _0x69bcbb=0xc8;var _0x4aa497=_0xa90a('0xb8');logger['info'](_0xa90a('0xb9'),_0x4aa497,_0x69bcbb,_0xa90a('0xba'));logger['debug'](_0xa90a('0xbb'),_0x4aa497,_0x69bcbb,_0xa90a('0xba'),JSON[_0xa90a('0x25')](_0x83a099));if(_0x378364[_0xa90a('0x87')]['type']===_0xa90a('0xbc')){return _0x1a5d92[_0xa90a('0x2c')](_0x69bcbb)[_0xa90a('0x32')](_0xa90a('0xbd'),_0xa90a('0xbe'))[_0xa90a('0x3d')](_0xa90a('0xbf'));}else{return _0x1a5d92['status'](_0x69bcbb)[_0xa90a('0x33')](_0x83a099);}}});})[_0xa90a('0x2a')](handleError(_0x1a5d92,null));};exports[_0xa90a('0x3d')]=function(_0x4a521b,_0xbf572c,_0x544800){var _0x28e097,_0x3e365d,_0x3f2bfa;if(_[_0xa90a('0xa1')](_0x4a521b['body'][_0xa90a('0x66')])||_0x4a521b[_0xa90a('0x66')][_0xa90a('0x66')]===''){throw new db[(_0xa90a('0x91'))]['ValidationError'](_0xa90a('0xa2'));}if(_[_0xa90a('0xa1')](_0x4a521b[_0xa90a('0x66')]['to'])){throw new db['Sequelize'][(_0xa90a('0x92'))](_0xa90a('0xc0'));}_0x28e097=_0x4a521b[_0xa90a('0x66')]['to'];return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0x4a521b[_0xa90a('0x5c')]['id']},'include':[{'model':db[_0xa90a('0xc1')],'as':_0xa90a('0xc2'),'include':[{'model':db[_0xa90a('0x90')],'as':'Contacts','where':{'mobile':_0x28e097},'limit':0x1,'order':[[_0xa90a('0x95'),_0xa90a('0xa7')]]}]}]})[_0xa90a('0x38')](handleEntityNotFound(_0xbf572c,null))[_0xa90a('0x38')](function(_0x1e936b){if(_0x1e936b&&_0x1e936b['List']){_0x3e365d=_0x1e936b[_0xa90a('0x39')]({'plain':!![]});if(_0x3e365d[_0xa90a('0xc2')]&&_0x3e365d['List'][_0xa90a('0xa9')][_0xa90a('0x6c')]){return _0x3e365d[_0xa90a('0xc2')]['Contacts'][0x0];}return db[_0xa90a('0x90')][_0xa90a('0x5f')](_['defaults'](_0x4a521b[_0xa90a('0x66')],{'firstName':_0x28e097,'mobile':_0x28e097,'phone':_0x28e097,'ListId':_0x3e365d['ListId']}));}})[_0xa90a('0x38')](handleEntityNotFound(_0xbf572c,null))[_0xa90a('0x38')](function(_0x10afae){if(_0x10afae){_0x3f2bfa=_0x10afae;return db['WhatsappInteraction'][_0xa90a('0x5e')]({'where':{'ContactId':_0x3f2bfa['id'],'closed':![],'WhatsappAccountId':_0x3e365d['id']}})[_0xa90a('0x38')](function(_0x4f2875){if(_0x4f2875){return[_0x4f2875,![]];}return db[_0xa90a('0xab')]['create']({'UserId':_0x4a521b[_0xa90a('0x62')]['id'],'ContactId':_0x3f2bfa['id'],'WhatsappAccountId':_0x3e365d['id'],'phone':_0x28e097,'firstMsgDirection':'out','Messages':[_[_0xa90a('0x53')](_0x4a521b[_0xa90a('0x66')],{'read':![],'body':_0x4a521b[_0xa90a('0x66')][_0xa90a('0x66')],'phone':_0x28e097,'WhatsappAccountId':_0x3e365d['id'],'UserId':_0x4a521b[_0xa90a('0x62')]['id'],'ContactId':_0x3f2bfa['id']})]},{'include':[{'model':db[_0xa90a('0xb1')],'as':_0xa90a('0xc3')}]})[_0xa90a('0x38')](function(_0x223365){return[_0x223365,!![]];});});}})['spread'](function(_0x6d991f,_0x594553){if(_0x594553){return _0x6d991f;}return db[_0xa90a('0xb1')][_0xa90a('0x5f')](_[_0xa90a('0x53')](_0x4a521b[_0xa90a('0x66')],{'read':![],'body':_0x4a521b[_0xa90a('0x66')][_0xa90a('0x66')],'phone':_0x28e097,'WhatsappAccountId':_0x3e365d['id'],'WhatsappInteractionId':_0x6d991f['id'],'UserId':_0x4a521b[_0xa90a('0x62')]['id'],'ContactId':_0x3f2bfa['id']}))[_0xa90a('0x38')](function(_0x5e6d0f){_0x6d991f[_0xa90a('0xc4')][_0xa90a('0xc3')]=[];_0x6d991f[_0xa90a('0xc4')][_0xa90a('0xc3')][_0xa90a('0xae')](_0x5e6d0f[_0xa90a('0xc4')]);return _0x6d991f;});})[_0xa90a('0x38')](respondWithResult(_0xbf572c,null))[_0xa90a('0x2a')](handleError(_0xbf572c,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 9bc400c..ac3309f 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 _0xdcb5=['setMaxListeners','update','emit','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x300277,_0x318be1){var _0x1ac119=function(_0x587f27){while(--_0x587f27){_0x300277['push'](_0x300277['shift']());}};_0x1ac119(++_0x318be1);}(_0xdcb5,0x1a5));var _0x5dcb=function(_0x51b975,_0x572e38){_0x51b975=_0x51b975-0x0;var _0x573df9=_0xdcb5[_0x51b975];return _0x573df9;};'use strict';var EventEmitter=require(_0x5dcb('0x0'));var WhatsappAccount=require(_0x5dcb('0x1'))['db'][_0x5dcb('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5dcb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5dcb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c5f39){return function(_0x51586a,_0x5f2bc9,_0x4ebf59){WhatsappAccountEvents[_0x5dcb('0x5')](_0x1c5f39+':'+_0x51586a['id'],_0x51586a);WhatsappAccountEvents[_0x5dcb('0x5')](_0x1c5f39,_0x51586a);_0x4ebf59(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x5dcb('0x6')](e,emitEvent(event));}}module[_0x5dcb('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x597a=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x56a424,_0x2188ad){var _0x30700a=function(_0x4c8346){while(--_0x4c8346){_0x56a424['push'](_0x56a424['shift']());}};_0x30700a(++_0x2188ad);}(_0x597a,0xb1));var _0xa597=function(_0xed95eb,_0x2132e1){_0xed95eb=_0xed95eb-0x0;var _0x292cd7=_0x597a[_0xed95eb];return _0x292cd7;};'use strict';var EventEmitter=require(_0xa597('0x0'));var WhatsappAccount=require(_0xa597('0x1'))['db'][_0xa597('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa597('0x3')](0x0);var events={'afterCreate':_0xa597('0x4'),'afterUpdate':'update','afterDestroy':_0xa597('0x5')};function emitEvent(_0x3cadcb){return function(_0x506286,_0x2ccdb0,_0x34148f){WhatsappAccountEvents['emit'](_0x3cadcb+':'+_0x506286['id'],_0x506286);WhatsappAccountEvents[_0xa597('0x6')](_0x3cadcb,_0x506286);_0x34148f(null);};}for(var e in events){if(events[_0xa597('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xa597('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 c9bb61b..5e3bce8 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 _0xc2bb=['rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','moment'];(function(_0x37d7f5,_0x478e72){var _0x582bc7=function(_0x33448f){while(--_0x33448f){_0x37d7f5['push'](_0x37d7f5['shift']());}};_0x582bc7(++_0x478e72);}(_0xc2bb,0x1a4));var _0xbc2b=function(_0x179fd7,_0x298f8a){_0x179fd7=_0x179fd7-0x0;var _0x5a13bd=_0xc2bb[_0x179fd7];return _0x5a13bd;};'use strict';var _=require(_0xbc2b('0x0'));var util=require(_0xbc2b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbc2b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc2b('0x3'));var config=require(_0xbc2b('0x4'));var attributes=require(_0xbc2b('0x5'));module['exports']=function(_0x1295f1,_0x54f41b){return _0x1295f1[_0xbc2b('0x6')](_0xbc2b('0x7'),attributes,{'tableName':_0xbc2b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081b=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','bluebird','request-promise'];(function(_0x200e06,_0x2b73a9){var _0x3ed1f3=function(_0x584d95){while(--_0x584d95){_0x200e06['push'](_0x200e06['shift']());}};_0x3ed1f3(++_0x2b73a9);}(_0x081b,0x125));var _0xb081=function(_0x454f8f,_0xdbbcc3){_0x454f8f=_0x454f8f-0x0;var _0x46ba15=_0x081b[_0x454f8f];return _0x46ba15;};'use strict';var _=require(_0xb081('0x0'));var util=require(_0xb081('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb081('0x2'));var rp=require(_0xb081('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb081('0x4'));var config=require(_0xb081('0x5'));var attributes=require(_0xb081('0x6'));module[_0xb081('0x7')]=function(_0x583858,_0x487178){return _0x583858[_0xb081('0x8')](_0xb081('0x9'),attributes,{'tableName':_0xb081('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 281d04a..09b6d9c 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 _0xc900=['map','model','include','debug','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes'];(function(_0x5e5d40,_0x39a90f){var _0x47b8eb=function(_0x54ecb9){while(--_0x54ecb9){_0x5e5d40['push'](_0x5e5d40['shift']());}};_0x47b8eb(++_0x39a90f);}(_0xc900,0xb3));var _0x0c90=function(_0x5335da,_0x2db61d){_0x5335da=_0x5335da-0x0;var _0x5ab15b=_0xc900[_0x5335da];return _0x5ab15b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});config[_0x0c90('0xa')]=_['defaults'](config[_0x0c90('0xa')],{'host':_0x0c90('0xb'),'port':0x18eb});var socket=require(_0x0c90('0xc'))(new Redis(config[_0x0c90('0xa')]));require(_0x0c90('0xd'))[_0x0c90('0xe')](socket);function respondWithRpcPromise(_0x313ce9,_0x18d9fd,_0x3e0df6){return new BPromise(function(_0x34456e,_0x10daeb){return client[_0x0c90('0xf')](_0x313ce9,_0x3e0df6)[_0x0c90('0x10')](function(_0x57917b){logger[_0x0c90('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x18d9fd,_0x0c90('0x12'));logger['debug'](_0x0c90('0x13'),_0x18d9fd,_0x0c90('0x12'),JSON[_0x0c90('0x14')](_0x57917b));if(_0x57917b[_0x0c90('0x15')]){if(_0x57917b[_0x0c90('0x15')]['code']===0x1f4){logger[_0x0c90('0x15')](_0x0c90('0x16'),_0x18d9fd,_0x57917b['error'][_0x0c90('0x17')]);return _0x10daeb(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x18d9fd,_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);return _0x34456e(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}else{logger[_0x0c90('0x11')](_0x0c90('0x16'),_0x18d9fd,_0x0c90('0x12'));_0x34456e(_0x57917b['result'][_0x0c90('0x17')]);}})[_0x0c90('0x18')](function(_0x462d49){logger[_0x0c90('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x18d9fd,_0x462d49);_0x10daeb(_0x462d49);});});}exports[_0x0c90('0x19')]=function(_0xd129ca){var _0x143047=this;return new Promise(function(_0x1241a9,_0x315932){return db[_0x0c90('0x1a')]['find']({'raw':_0xd129ca[_0x0c90('0x1b')]?_0xd129ca['options'][_0x0c90('0x1c')]===undefined?!![]:![]:!![],'where':_0xd129ca[_0x0c90('0x1b')]?_0xd129ca['options'][_0x0c90('0x1d')]||null:null,'attributes':_0xd129ca[_0x0c90('0x1b')]?_0xd129ca[_0x0c90('0x1b')][_0x0c90('0x1e')]||null:null,'include':_0xd129ca[_0x0c90('0x1b')]?_0xd129ca[_0x0c90('0x1b')]['include']?_[_0x0c90('0x1f')](_0xd129ca[_0x0c90('0x1b')]['include'],function(_0x54316b){return{'model':db[_0x54316b[_0x0c90('0x20')]],'as':_0x54316b['as'],'attributes':_0x54316b[_0x0c90('0x1e')],'include':_0x54316b[_0x0c90('0x21')]?_[_0x0c90('0x1f')](_0x54316b['include'],function(_0x2dfa14){return{'model':db[_0x2dfa14[_0x0c90('0x20')]],'as':_0x2dfa14['as'],'attributes':_0x2dfa14[_0x0c90('0x1e')],'include':_0x2dfa14[_0x0c90('0x21')]?_[_0x0c90('0x1f')](_0x2dfa14[_0x0c90('0x21')],function(_0x492028){return{'model':db[_0x492028[_0x0c90('0x20')]],'as':_0x492028['as'],'attributes':_0x492028[_0x0c90('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0c90('0x10')](function(_0x13b377){logger['info']('ShowWhatsappAccount',_0xd129ca);logger[_0x0c90('0x22')](_0x0c90('0x19'),_0xd129ca,JSON[_0x0c90('0x14')](_0x13b377));_0x1241a9(_0x13b377);})[_0x0c90('0x18')](function(_0x119e09){logger['error'](_0x0c90('0x19'),_0x119e09[_0x0c90('0x17')],_0xd129ca);_0x315932(_0x143047[_0x0c90('0x15')](0x1f4,_0x119e09['message']));});});}; \ No newline at end of file +var _0xaeea=['client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x34288e,_0xd85134){var _0xd78212=function(_0x279c4c){while(--_0x279c4c){_0x34288e['push'](_0x34288e['shift']());}};_0xd78212(++_0xd85134);}(_0xaeea,0x1bf));var _0xaaee=function(_0x203d1e,_0xe2a68f){_0x203d1e=_0x203d1e-0x0;var _0x588291=_0xaeea[_0x203d1e];return _0x588291;};'use strict';var _=require('lodash');var util=require(_0xaaee('0x0'));var moment=require(_0xaaee('0x1'));var BPromise=require(_0xaaee('0x2'));var rs=require(_0xaaee('0x3'));var fs=require('fs');var Redis=require(_0xaaee('0x4'));var db=require(_0xaaee('0x5'))['db'];var utils=require(_0xaaee('0x6'));var logger=require('../../config/logger')(_0xaaee('0x7'));var config=require('../../config/environment');var jayson=require(_0xaaee('0x8'));var client=jayson[_0xaaee('0x9')]['http']({'port':0x232a});config[_0xaaee('0xa')]=_[_0xaaee('0xb')](config['redis'],{'host':_0xaaee('0xc'),'port':0x18eb});var socket=require(_0xaaee('0xd'))(new Redis(config[_0xaaee('0xa')]));require(_0xaaee('0xe'))[_0xaaee('0xf')](socket);function respondWithRpcPromise(_0x521806,_0x5b08ff,_0x2a651d){return new BPromise(function(_0x567bbc,_0x191cb7){return client[_0xaaee('0x10')](_0x521806,_0x2a651d)[_0xaaee('0x11')](function(_0x5ca2a1){logger[_0xaaee('0x12')](_0xaaee('0x13'),_0x5b08ff,_0xaaee('0x14'));logger[_0xaaee('0x15')](_0xaaee('0x16'),_0x5b08ff,_0xaaee('0x14'),JSON[_0xaaee('0x17')](_0x5ca2a1));if(_0x5ca2a1['error']){if(_0x5ca2a1[_0xaaee('0x18')][_0xaaee('0x19')]===0x1f4){logger[_0xaaee('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x5b08ff,_0x5ca2a1[_0xaaee('0x18')][_0xaaee('0x1a')]);return _0x191cb7(_0x5ca2a1[_0xaaee('0x18')][_0xaaee('0x1a')]);}logger['error'](_0xaaee('0x13'),_0x5b08ff,_0x5ca2a1['error'][_0xaaee('0x1a')]);return _0x567bbc(_0x5ca2a1[_0xaaee('0x18')][_0xaaee('0x1a')]);}else{logger['info'](_0xaaee('0x13'),_0x5b08ff,_0xaaee('0x14'));_0x567bbc(_0x5ca2a1[_0xaaee('0x1b')][_0xaaee('0x1a')]);}})[_0xaaee('0x1c')](function(_0x96c51f){logger[_0xaaee('0x18')](_0xaaee('0x13'),_0x5b08ff,_0x96c51f);_0x191cb7(_0x96c51f);});});}exports[_0xaaee('0x1d')]=function(_0x1d4b2e){var _0x2ce472=this;return new Promise(function(_0x4788f7,_0x2680a7){return db[_0xaaee('0x1e')][_0xaaee('0x1f')]({'raw':_0x1d4b2e[_0xaaee('0x20')]?_0x1d4b2e[_0xaaee('0x20')][_0xaaee('0x21')]===undefined?!![]:![]:!![],'where':_0x1d4b2e['options']?_0x1d4b2e[_0xaaee('0x20')]['where']||null:null,'attributes':_0x1d4b2e[_0xaaee('0x20')]?_0x1d4b2e[_0xaaee('0x20')][_0xaaee('0x22')]||null:null,'include':_0x1d4b2e['options']?_0x1d4b2e[_0xaaee('0x20')][_0xaaee('0x23')]?_[_0xaaee('0x24')](_0x1d4b2e[_0xaaee('0x20')][_0xaaee('0x23')],function(_0x15850b){return{'model':db[_0x15850b[_0xaaee('0x25')]],'as':_0x15850b['as'],'attributes':_0x15850b['attributes'],'include':_0x15850b[_0xaaee('0x23')]?_[_0xaaee('0x24')](_0x15850b['include'],function(_0x1b7b73){return{'model':db[_0x1b7b73['model']],'as':_0x1b7b73['as'],'attributes':_0x1b7b73[_0xaaee('0x22')],'include':_0x1b7b73[_0xaaee('0x23')]?_[_0xaaee('0x24')](_0x1b7b73[_0xaaee('0x23')],function(_0x2e230f){return{'model':db[_0x2e230f[_0xaaee('0x25')]],'as':_0x2e230f['as'],'attributes':_0x2e230f[_0xaaee('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27a272){logger['info'](_0xaaee('0x1d'),_0x1d4b2e);logger[_0xaaee('0x15')](_0xaaee('0x1d'),_0x1d4b2e,JSON['stringify'](_0x27a272));_0x4788f7(_0x27a272);})[_0xaaee('0x1c')](function(_0x28f88a){logger[_0xaaee('0x18')]('ShowWhatsappAccount',_0x28f88a[_0xaaee('0x1a')],_0x1d4b2e);_0x2680a7(_0x2ce472[_0xaaee('0x18')](0x1f4,_0x28f88a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 37c7e88..157044d 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 _0x8c7f=['whatsappAccount:','save','remove','emit','removeListener','register','length'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x8c7f,0x9b));var _0xf8c7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8c7f[_0xa464c9];return _0x3d73c4;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xf8c7('0x0'),_0xf8c7('0x1'),'update'];function createListener(_0x56f022,_0x582474){return function(_0x3d0570){_0x582474[_0xf8c7('0x2')](_0x56f022,_0x3d0570);};}function removeListener(_0x4e684c,_0x3a6459){return function(){WhatsappAccountEvents[_0xf8c7('0x3')](_0x4e684c,_0x3a6459);};}exports[_0xf8c7('0x4')]=function(_0x2d08f4){for(var _0x567abb=0x0,_0x2f4339=events[_0xf8c7('0x5')];_0x567abb<_0x2f4339;_0x567abb++){var _0x33bf48=events[_0x567abb];var _0xbfd32c=createListener(_0xf8c7('0x6')+_0x33bf48,_0x2d08f4);WhatsappAccountEvents['on'](_0x33bf48,_0xbfd32c);}}; \ No newline at end of file +var _0x9652=['register','whatsappAccount:','./whatsappAccount.events','update','removeListener'];(function(_0x26742c,_0xe241ee){var _0x4d9df4=function(_0x5bf307){while(--_0x5bf307){_0x26742c['push'](_0x26742c['shift']());}};_0x4d9df4(++_0xe241ee);}(_0x9652,0x151));var _0x2965=function(_0x23c217,_0x3aee12){_0x23c217=_0x23c217-0x0;var _0x53fcf8=_0x9652[_0x23c217];return _0x53fcf8;};'use strict';var WhatsappAccountEvents=require(_0x2965('0x0'));var events=['save','remove',_0x2965('0x1')];function createListener(_0x16a646,_0x9e9115){return function(_0x386806){_0x9e9115['emit'](_0x16a646,_0x386806);};}function removeListener(_0xeb300e,_0x54481f){return function(){WhatsappAccountEvents[_0x2965('0x2')](_0xeb300e,_0x54481f);};}exports[_0x2965('0x3')]=function(_0x59e471){for(var _0x383b82=0x0,_0x246780=events['length'];_0x383b82<_0x246780;_0x383b82++){var _0x18932c=events[_0x383b82];var _0xd261d0=createListener(_0x2965('0x4')+_0x18932c,_0x59e471);WhatsappAccountEvents['on'](_0x18932c,_0xd261d0);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index c332d5c..93627fe 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 _0x2f3a=['index','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x60ae51,_0x2efeec){var _0x4bcec8=function(_0x18fcba){while(--_0x18fcba){_0x60ae51['push'](_0x60ae51['shift']());}};_0x4bcec8(++_0x2efeec);}(_0x2f3a,0x134));var _0xa2f3=function(_0x3ef883,_0xa223e4){_0x3ef883=_0x3ef883-0x0;var _0x4dbfd1=_0x2f3a[_0x3ef883];return _0x4dbfd1;};'use strict';var multer=require(_0xa2f3('0x0'));var util=require(_0xa2f3('0x1'));var path=require(_0xa2f3('0x2'));var timeout=require(_0xa2f3('0x3'));var express=require(_0xa2f3('0x4'));var router=express[_0xa2f3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa2f3('0x6'));var interaction=require(_0xa2f3('0x7'));var config=require(_0xa2f3('0x8'));var controller=require(_0xa2f3('0x9'));router[_0xa2f3('0xa')]('/',auth[_0xa2f3('0xb')](),controller[_0xa2f3('0xc')]);router['get'](_0xa2f3('0xd'),auth[_0xa2f3('0xb')](),controller[_0xa2f3('0xe')]);router[_0xa2f3('0xf')]('/',auth[_0xa2f3('0xb')](),controller['create']);router[_0xa2f3('0x10')](_0xa2f3('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa2f3('0x11')](_0xa2f3('0xd'),auth['isAuthenticated'](),controller[_0xa2f3('0x12')]);module[_0xa2f3('0x13')]=router; \ No newline at end of file +var _0xd2b8=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy'];(function(_0x3ab094,_0x4d101e){var _0x18eaa2=function(_0x4e4cb5){while(--_0x4e4cb5){_0x3ab094['push'](_0x3ab094['shift']());}};_0x18eaa2(++_0x4d101e);}(_0xd2b8,0x1c9));var _0x8d2b=function(_0xc28ffa,_0x6827dd){_0xc28ffa=_0xc28ffa-0x0;var _0xaf3a5=_0xd2b8[_0xc28ffa];return _0xaf3a5;};'use strict';var multer=require(_0x8d2b('0x0'));var util=require(_0x8d2b('0x1'));var path=require(_0x8d2b('0x2'));var timeout=require(_0x8d2b('0x3'));var express=require('express');var router=express[_0x8d2b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8d2b('0x5'));var interaction=require(_0x8d2b('0x6'));var config=require(_0x8d2b('0x7'));var controller=require(_0x8d2b('0x8'));router[_0x8d2b('0x9')]('/',auth[_0x8d2b('0xa')](),controller[_0x8d2b('0xb')]);router['get'](_0x8d2b('0xc'),auth['isAuthenticated'](),controller[_0x8d2b('0xd')]);router[_0x8d2b('0xe')]('/',auth[_0x8d2b('0xa')](),controller[_0x8d2b('0xf')]);router['put'](_0x8d2b('0xc'),auth[_0x8d2b('0xa')](),controller['update']);router[_0x8d2b('0x10')](_0x8d2b('0xc'),auth['isAuthenticated'](),controller[_0x8d2b('0x11')]);module[_0x8d2b('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 1e5fe31..b256a73 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 _0xce97=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xce97,0x1b9));var _0x7ce9=function(_0x46cd42,_0x2e5f56){_0x46cd42=_0x46cd42-0x0;var _0x4c47c1=_0xce97[_0x46cd42];return _0x4c47c1;};'use strict';var Sequelize=require('sequelize');module[_0x7ce9('0x0')]={'priority':{'type':Sequelize[_0x7ce9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7ce9('0x2')],'allowNull':![],'defaultValue':_0x7ce9('0x3')},'appdata':{'type':Sequelize[_0x7ce9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7ce9('0x5')}}; \ No newline at end of file +var _0x8842=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8842,0x1ea));var _0x2884=function(_0x49fffd,_0x534844){_0x49fffd=_0x49fffd-0x0;var _0x4c90ed=_0x8842[_0x49fffd];return _0x4c90ed;};'use strict';var Sequelize=require(_0x2884('0x0'));module[_0x2884('0x1')]={'priority':{'type':Sequelize[_0x2884('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2884('0x3')],'allowNull':![],'defaultValue':_0x2884('0x4')},'appdata':{'type':Sequelize[_0x2884('0x5')]()},'description':{'type':Sequelize[_0x2884('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2884('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 5b975be..1806e81 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 _0x505d=['options','includeAll','include','findAll','rows','catch','show','params','WhatsappApplication','keys','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x505d,0x93));var _0xd505=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x505d[_0x16629d];return _0x56ccee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd505('0x0'));var jsonpatch=require(_0xd505('0x1'));var rp=require(_0xd505('0x2'));var moment=require(_0xd505('0x3'));var BPromise=require(_0xd505('0x4'));var Mustache=require('mustache');var util=require(_0xd505('0x5'));var path=require(_0xd505('0x6'));var sox=require(_0xd505('0x7'));var csv=require(_0xd505('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd505('0x9'));var _=require('lodash');var squel=require(_0xd505('0xa'));var crypto=require(_0xd505('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd505('0xc'));var toCsv=require(_0xd505('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd505('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd505('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd505('0xf'));var logger=require('../../config/logger')(_0xd505('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd505('0x11'))['db'];function respondWithStatusCode(_0x52eafa,_0x477f1b){_0x477f1b=_0x477f1b||0xcc;return function(_0x2a292e){if(_0x2a292e){return _0x52eafa['sendStatus'](_0x477f1b);}return _0x52eafa['status'](_0x477f1b)[_0xd505('0x12')]();};}function respondWithResult(_0x39cd89,_0x5d8433){_0x5d8433=_0x5d8433||0xc8;return function(_0x29d0ad){if(_0x29d0ad){return _0x39cd89[_0xd505('0x13')](_0x5d8433)[_0xd505('0x14')](_0x29d0ad);}};}function respondWithFilteredResult(_0x366df6,_0x1052da){return function(_0x20088a){if(_0x20088a){var _0x50e8d2=typeof _0x1052da[_0xd505('0x15')]===_0xd505('0x16')&&typeof _0x1052da[_0xd505('0x17')]==='undefined';var _0x244126=_0x20088a['count'];var _0x561c71=_0x50e8d2?0x0:_0x1052da[_0xd505('0x15')];var _0x52401f=_0x50e8d2?_0x20088a[_0xd505('0x18')]:_0x1052da[_0xd505('0x15')]+_0x1052da[_0xd505('0x17')];var _0x8d42e4;if(_0x52401f>=_0x244126){_0x52401f=_0x244126;_0x8d42e4=0xc8;}else{_0x8d42e4=0xce;}_0x366df6[_0xd505('0x13')](_0x8d42e4);return _0x366df6['set'](_0xd505('0x19'),_0x561c71+'-'+_0x52401f+'/'+_0x244126)[_0xd505('0x14')](_0x20088a);}return null;};}function patchUpdates(_0x5229d2){return function(_0x5ccf7e){try{jsonpatch['apply'](_0x5ccf7e,_0x5229d2,!![]);}catch(_0x24acdb){return BPromise[_0xd505('0x1a')](_0x24acdb);}return _0x5ccf7e['save']();};}function saveUpdates(_0x24c9d6,_0x570d6a){return function(_0x5bdd88){if(_0x5bdd88){return _0x5bdd88[_0xd505('0x1b')](_0x24c9d6)[_0xd505('0x1c')](function(_0x574a7c){return _0x574a7c;});}return null;};}function removeEntity(_0x4118c5,_0x50ebfa){return function(_0x4e885b){if(_0x4e885b){return _0x4e885b[_0xd505('0x1d')]()[_0xd505('0x1c')](function(){_0x4118c5[_0xd505('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f1839,_0x404784){return function(_0x5e4317){if(!_0x5e4317){_0x4f1839['sendStatus'](0x194);}return _0x5e4317;};}function handleError(_0xe66be4,_0x16be66){_0x16be66=_0x16be66||0x1f4;return function(_0xeb2af1){logger[_0xd505('0x1e')](_0xeb2af1[_0xd505('0x1f')]);if(_0xeb2af1[_0xd505('0x20')]){delete _0xeb2af1[_0xd505('0x20')];}_0xe66be4['status'](_0x16be66)[_0xd505('0x21')](_0xeb2af1);};}exports[_0xd505('0x22')]=function(_0x311533,_0x3a58d4){var _0x5894b2={},_0x2d8d67={},_0x38867e={'count':0x0,'rows':[]};var _0x5db0da=_['map'](db['WhatsappApplication'][_0xd505('0x23')],function(_0x3effd7){return{'name':_0x3effd7[_0xd505('0x24')],'type':_0x3effd7['type'][_0xd505('0x25')]};});_0x2d8d67['model']=_[_0xd505('0x26')](_0x5db0da,_0xd505('0x20'));_0x2d8d67[_0xd505('0x27')]=_['keys'](_0x311533[_0xd505('0x27')]);_0x2d8d67[_0xd505('0x28')]=_['intersection'](_0x2d8d67[_0xd505('0x29')],_0x2d8d67[_0xd505('0x27')]);_0x5894b2[_0xd505('0x2a')]=_[_0xd505('0x2b')](_0x2d8d67['model'],qs['fields'](_0x311533[_0xd505('0x27')][_0xd505('0x2c')]));_0x5894b2[_0xd505('0x2a')]=_0x5894b2[_0xd505('0x2a')][_0xd505('0x2d')]?_0x5894b2[_0xd505('0x2a')]:_0x2d8d67['model'];if(!_0x311533[_0xd505('0x27')]['hasOwnProperty'](_0xd505('0x2e'))){_0x5894b2['limit']=qs[_0xd505('0x17')](_0x311533[_0xd505('0x27')][_0xd505('0x17')]);_0x5894b2[_0xd505('0x15')]=qs[_0xd505('0x15')](_0x311533[_0xd505('0x27')][_0xd505('0x15')]);}_0x5894b2[_0xd505('0x2f')]=qs['sort'](_0x311533['query'][_0xd505('0x30')]);_0x5894b2[_0xd505('0x31')]=qs[_0xd505('0x28')](_['pick'](_0x311533[_0xd505('0x27')],_0x2d8d67[_0xd505('0x28')]),_0x5db0da);if(_0x311533[_0xd505('0x27')][_0xd505('0x32')]){_0x5894b2[_0xd505('0x31')]=_[_0xd505('0x33')](_0x5894b2[_0xd505('0x31')],{'$or':_[_0xd505('0x26')](_0x5db0da,function(_0x57228d){if(_0x57228d[_0xd505('0x34')]!==_0xd505('0x35')){var _0x2dd461={};_0x2dd461[_0x57228d['name']]={'$like':'%'+_0x311533[_0xd505('0x27')][_0xd505('0x32')]+'%'};return _0x2dd461;}})});}_0x5894b2=_['merge']({},_0x5894b2,_0x311533[_0xd505('0x36')]);var _0x146b4c={'where':_0x5894b2[_0xd505('0x31')]};return db['WhatsappApplication'][_0xd505('0x18')](_0x146b4c)[_0xd505('0x1c')](function(_0xff0027){_0x38867e[_0xd505('0x18')]=_0xff0027;if(_0x311533[_0xd505('0x27')][_0xd505('0x37')]){_0x5894b2[_0xd505('0x38')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xd505('0x39')](_0x5894b2);})[_0xd505('0x1c')](function(_0x58cd22){_0x38867e[_0xd505('0x3a')]=_0x58cd22;return _0x38867e;})[_0xd505('0x1c')](respondWithFilteredResult(_0x3a58d4,_0x5894b2))[_0xd505('0x3b')](handleError(_0x3a58d4,null));};exports[_0xd505('0x3c')]=function(_0x96ee7,_0x32849d){var _0x55d9ef={'raw':!![],'where':{'id':_0x96ee7[_0xd505('0x3d')]['id']}},_0x530113={};_0x530113[_0xd505('0x29')]=_['keys'](db[_0xd505('0x3e')][_0xd505('0x23')]);_0x530113['query']=_[_0xd505('0x3f')](_0x96ee7[_0xd505('0x27')]);_0x530113[_0xd505('0x28')]=_[_0xd505('0x2b')](_0x530113[_0xd505('0x29')],_0x530113[_0xd505('0x27')]);_0x55d9ef[_0xd505('0x2a')]=_[_0xd505('0x2b')](_0x530113['model'],qs[_0xd505('0x2c')](_0x96ee7[_0xd505('0x27')][_0xd505('0x2c')]));_0x55d9ef[_0xd505('0x2a')]=_0x55d9ef[_0xd505('0x2a')][_0xd505('0x2d')]?_0x55d9ef['attributes']:_0x530113['model'];if(_0x96ee7['query']['includeAll']){_0x55d9ef[_0xd505('0x38')]=[{'all':!![]}];}_0x55d9ef=_[_0xd505('0x33')]({},_0x55d9ef,_0x96ee7['options']);return db[_0xd505('0x3e')][_0xd505('0x40')](_0x55d9ef)[_0xd505('0x1c')](handleEntityNotFound(_0x32849d,null))['then'](respondWithResult(_0x32849d,null))['catch'](handleError(_0x32849d,null));};exports[_0xd505('0x41')]=function(_0x2c62a9,_0x4b66ee){return db['WhatsappApplication']['create'](_0x2c62a9[_0xd505('0x42')],{})['then'](respondWithResult(_0x4b66ee,0xc9))[_0xd505('0x3b')](handleError(_0x4b66ee,null));};exports[_0xd505('0x1b')]=function(_0x1d8f7f,_0x16212e){if(_0x1d8f7f[_0xd505('0x42')]['id']){delete _0x1d8f7f[_0xd505('0x42')]['id'];}return db[_0xd505('0x3e')]['find']({'where':{'id':_0x1d8f7f[_0xd505('0x3d')]['id']}})[_0xd505('0x1c')](handleEntityNotFound(_0x16212e,null))[_0xd505('0x1c')](saveUpdates(_0x1d8f7f['body'],null))[_0xd505('0x1c')](respondWithResult(_0x16212e,null))['catch'](handleError(_0x16212e,null));};exports[_0xd505('0x1d')]=function(_0x18a0cb,_0x19cd38){return db['WhatsappApplication'][_0xd505('0x40')]({'where':{'id':_0x18a0cb['params']['id']}})[_0xd505('0x1c')](handleEntityNotFound(_0x19cd38,null))[_0xd505('0x1c')](removeEntity(_0x19cd38,null))[_0xd505('0x3b')](handleError(_0x19cd38,null));}; \ No newline at end of file +var _0xd6f9=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','catch','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xd6f9[_0x2f3848];return _0x102668;};'use strict';var emlformat=require(_0x9d6f('0x0'));var rimraf=require(_0x9d6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d6f('0x2'));var moment=require(_0x9d6f('0x3'));var BPromise=require(_0x9d6f('0x4'));var Mustache=require(_0x9d6f('0x5'));var util=require('util');var path=require(_0x9d6f('0x6'));var sox=require(_0x9d6f('0x7'));var csv=require(_0x9d6f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d6f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9d6f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9d6f('0xb'));var toCsv=require(_0x9d6f('0x8'));var querystring=require(_0x9d6f('0xc'));var Papa=require(_0x9d6f('0xd'));var Redis=require(_0x9d6f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d6f('0xf'));var logger=require(_0x9d6f('0x10'))(_0x9d6f('0x11'));var utils=require(_0x9d6f('0x12'));var config=require(_0x9d6f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d6f('0x14'))['db'];function respondWithStatusCode(_0x736008,_0x29ce37){_0x29ce37=_0x29ce37||0xcc;return function(_0x2e19a5){if(_0x2e19a5){return _0x736008[_0x9d6f('0x15')](_0x29ce37);}return _0x736008['status'](_0x29ce37)[_0x9d6f('0x16')]();};}function respondWithResult(_0x2da36f,_0x34e8dd){_0x34e8dd=_0x34e8dd||0xc8;return function(_0x3916f1){if(_0x3916f1){return _0x2da36f[_0x9d6f('0x17')](_0x34e8dd)['json'](_0x3916f1);}};}function respondWithFilteredResult(_0x149557,_0x2f927a){return function(_0x41546b){if(_0x41546b){var _0x509713=typeof _0x2f927a['offset']===_0x9d6f('0x18')&&typeof _0x2f927a[_0x9d6f('0x19')]===_0x9d6f('0x18');var _0x251ce5=_0x41546b['count'];var _0x433555=_0x509713?0x0:_0x2f927a[_0x9d6f('0x1a')];var _0x556ac7=_0x509713?_0x41546b[_0x9d6f('0x1b')]:_0x2f927a[_0x9d6f('0x1a')]+_0x2f927a[_0x9d6f('0x19')];var _0x4e9598;if(_0x556ac7>=_0x251ce5){_0x556ac7=_0x251ce5;_0x4e9598=0xc8;}else{_0x4e9598=0xce;}_0x149557[_0x9d6f('0x17')](_0x4e9598);return _0x149557[_0x9d6f('0x1c')](_0x9d6f('0x1d'),_0x433555+'-'+_0x556ac7+'/'+_0x251ce5)['json'](_0x41546b);}return null;};}function patchUpdates(_0x3ce2ca){return function(_0x339b40){try{jsonpatch[_0x9d6f('0x1e')](_0x339b40,_0x3ce2ca,!![]);}catch(_0x9fa1b5){return BPromise[_0x9d6f('0x1f')](_0x9fa1b5);}return _0x339b40['save']();};}function saveUpdates(_0x770eab,_0x312de5){return function(_0x3e9ad3){if(_0x3e9ad3){return _0x3e9ad3[_0x9d6f('0x20')](_0x770eab)['then'](function(_0x16175d){return _0x16175d;});}return null;};}function removeEntity(_0x21f538,_0x367d48){return function(_0x2a13dc){if(_0x2a13dc){return _0x2a13dc[_0x9d6f('0x21')]()[_0x9d6f('0x22')](function(){_0x21f538[_0x9d6f('0x17')](0xcc)[_0x9d6f('0x16')]();});}};}function handleEntityNotFound(_0x6d51d8,_0x10ec7a){return function(_0x233c17){if(!_0x233c17){_0x6d51d8['sendStatus'](0x194);}return _0x233c17;};}function handleError(_0x6b51a5,_0x44aee2){_0x44aee2=_0x44aee2||0x1f4;return function(_0x3c2714){logger['error'](_0x3c2714[_0x9d6f('0x23')]);if(_0x3c2714['name']){delete _0x3c2714[_0x9d6f('0x24')];}_0x6b51a5[_0x9d6f('0x17')](_0x44aee2)[_0x9d6f('0x25')](_0x3c2714);};}exports[_0x9d6f('0x26')]=function(_0x4b25a5,_0x4f343e){var _0x51ade6={},_0x545b0c={},_0x162126={'count':0x0,'rows':[]};var _0x410c8c=_[_0x9d6f('0x27')](db[_0x9d6f('0x28')][_0x9d6f('0x29')],function(_0x489185){return{'name':_0x489185[_0x9d6f('0x2a')],'type':_0x489185[_0x9d6f('0x2b')][_0x9d6f('0x2c')]};});_0x545b0c[_0x9d6f('0x2d')]=_[_0x9d6f('0x27')](_0x410c8c,_0x9d6f('0x24'));_0x545b0c[_0x9d6f('0x2e')]=_[_0x9d6f('0x2f')](_0x4b25a5[_0x9d6f('0x2e')]);_0x545b0c[_0x9d6f('0x30')]=_[_0x9d6f('0x31')](_0x545b0c[_0x9d6f('0x2d')],_0x545b0c[_0x9d6f('0x2e')]);_0x51ade6[_0x9d6f('0x32')]=_['intersection'](_0x545b0c[_0x9d6f('0x2d')],qs['fields'](_0x4b25a5['query'][_0x9d6f('0x33')]));_0x51ade6[_0x9d6f('0x32')]=_0x51ade6[_0x9d6f('0x32')][_0x9d6f('0x34')]?_0x51ade6[_0x9d6f('0x32')]:_0x545b0c[_0x9d6f('0x2d')];if(!_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x35')](_0x9d6f('0x36'))){_0x51ade6[_0x9d6f('0x19')]=qs[_0x9d6f('0x19')](_0x4b25a5[_0x9d6f('0x2e')]['limit']);_0x51ade6[_0x9d6f('0x1a')]=qs[_0x9d6f('0x1a')](_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x1a')]);}_0x51ade6[_0x9d6f('0x37')]=qs[_0x9d6f('0x38')](_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x38')]);_0x51ade6['where']=qs[_0x9d6f('0x30')](_[_0x9d6f('0x39')](_0x4b25a5['query'],_0x545b0c[_0x9d6f('0x30')]),_0x410c8c);if(_0x4b25a5['query'][_0x9d6f('0x3a')]){_0x51ade6[_0x9d6f('0x3b')]=_['merge'](_0x51ade6[_0x9d6f('0x3b')],{'$or':_[_0x9d6f('0x27')](_0x410c8c,function(_0x39ad4b){if(_0x39ad4b['type']!==_0x9d6f('0x3c')){var _0x54c8dc={};_0x54c8dc[_0x39ad4b[_0x9d6f('0x24')]]={'$like':'%'+_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x3a')]+'%'};return _0x54c8dc;}})});}_0x51ade6=_[_0x9d6f('0x3d')]({},_0x51ade6,_0x4b25a5[_0x9d6f('0x3e')]);var _0x1d6c08={'where':_0x51ade6['where']};return db[_0x9d6f('0x28')][_0x9d6f('0x1b')](_0x1d6c08)['then'](function(_0x2fb805){_0x162126[_0x9d6f('0x1b')]=_0x2fb805;if(_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x3f')]){_0x51ade6[_0x9d6f('0x40')]=[{'all':!![]}];}return db[_0x9d6f('0x28')][_0x9d6f('0x41')](_0x51ade6);})[_0x9d6f('0x22')](function(_0x3a19f8){_0x162126[_0x9d6f('0x42')]=_0x3a19f8;return _0x162126;})[_0x9d6f('0x22')](respondWithFilteredResult(_0x4f343e,_0x51ade6))['catch'](handleError(_0x4f343e,null));};exports['show']=function(_0x254703,_0x4992cd){var _0x175b80={'raw':!![],'where':{'id':_0x254703[_0x9d6f('0x43')]['id']}},_0x5602f9={};_0x5602f9['model']=_[_0x9d6f('0x2f')](db['WhatsappApplication'][_0x9d6f('0x29')]);_0x5602f9['query']=_['keys'](_0x254703['query']);_0x5602f9[_0x9d6f('0x30')]=_[_0x9d6f('0x31')](_0x5602f9['model'],_0x5602f9[_0x9d6f('0x2e')]);_0x175b80[_0x9d6f('0x32')]=_['intersection'](_0x5602f9[_0x9d6f('0x2d')],qs[_0x9d6f('0x33')](_0x254703[_0x9d6f('0x2e')][_0x9d6f('0x33')]));_0x175b80[_0x9d6f('0x32')]=_0x175b80['attributes'][_0x9d6f('0x34')]?_0x175b80[_0x9d6f('0x32')]:_0x5602f9[_0x9d6f('0x2d')];if(_0x254703[_0x9d6f('0x2e')][_0x9d6f('0x3f')]){_0x175b80[_0x9d6f('0x40')]=[{'all':!![]}];}_0x175b80=_[_0x9d6f('0x3d')]({},_0x175b80,_0x254703[_0x9d6f('0x3e')]);return db[_0x9d6f('0x28')]['find'](_0x175b80)[_0x9d6f('0x22')](handleEntityNotFound(_0x4992cd,null))[_0x9d6f('0x22')](respondWithResult(_0x4992cd,null))[_0x9d6f('0x44')](handleError(_0x4992cd,null));};exports[_0x9d6f('0x45')]=function(_0x17ca02,_0x12611c){return db['WhatsappApplication'][_0x9d6f('0x45')](_0x17ca02[_0x9d6f('0x46')],{})[_0x9d6f('0x22')](respondWithResult(_0x12611c,0xc9))['catch'](handleError(_0x12611c,null));};exports['update']=function(_0x42c209,_0x4ef463){if(_0x42c209[_0x9d6f('0x46')]['id']){delete _0x42c209[_0x9d6f('0x46')]['id'];}return db[_0x9d6f('0x28')][_0x9d6f('0x47')]({'where':{'id':_0x42c209[_0x9d6f('0x43')]['id']}})[_0x9d6f('0x22')](handleEntityNotFound(_0x4ef463,null))[_0x9d6f('0x22')](saveUpdates(_0x42c209[_0x9d6f('0x46')],null))[_0x9d6f('0x22')](respondWithResult(_0x4ef463,null))[_0x9d6f('0x44')](handleError(_0x4ef463,null));};exports[_0x9d6f('0x21')]=function(_0x388d31,_0x40842a){return db[_0x9d6f('0x28')][_0x9d6f('0x47')]({'where':{'id':_0x388d31[_0x9d6f('0x43')]['id']}})[_0x9d6f('0x22')](handleEntityNotFound(_0x40842a,null))[_0x9d6f('0x22')](removeEntity(_0x40842a,null))[_0x9d6f('0x44')](handleError(_0x40842a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e1e98a3..e3178a8 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 _0x7579=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','whatsapp_applications'];(function(_0x38f9ec,_0x430eae){var _0x47c433=function(_0x37e340){while(--_0x37e340){_0x38f9ec['push'](_0x38f9ec['shift']());}};_0x47c433(++_0x430eae);}(_0x7579,0x1e2));var _0x9757=function(_0x1c8498,_0x38fd62){_0x1c8498=_0x1c8498-0x0;var _0x4be50b=_0x7579[_0x1c8498];return _0x4be50b;};'use strict';var _=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var logger=require(_0x9757('0x2'))(_0x9757('0x3'));var moment=require(_0x9757('0x4'));var BPromise=require(_0x9757('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9757('0x6'));var rimraf=require(_0x9757('0x7'));var config=require(_0x9757('0x8'));var attributes=require(_0x9757('0x9'));module['exports']=function(_0x2aede4,_0x80e411){return _0x2aede4[_0x9757('0xa')]('WhatsappApplication',attributes,{'tableName':_0x9757('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9757('0xc')});}; \ No newline at end of file +var _0x3ee5=['define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x128815,_0x294754){_0x128815=_0x128815-0x0;var _0x271bf9=_0x3ee5[_0x128815];return _0x271bf9;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var logger=require(_0x53ee('0x1'))('api');var moment=require(_0x53ee('0x2'));var BPromise=require(_0x53ee('0x3'));var rp=require(_0x53ee('0x4'));var fs=require('fs');var path=require(_0x53ee('0x5'));var rimraf=require(_0x53ee('0x6'));var config=require(_0x53ee('0x7'));var attributes=require(_0x53ee('0x8'));module[_0x53ee('0x9')]=function(_0x343bbb,_0x16ad68){return _0x343bbb[_0x53ee('0xa')]('WhatsappApplication',attributes,{'tableName':_0x53ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x53ee('0xc'),'collate':_0x53ee('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a3b1dde..884b3eb 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x7bae[_0x5416db];return _0x243e35;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file +var _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x783834,_0x38c810){var _0x22055f=function(_0x6a6998){while(--_0x6a6998){_0x783834['push'](_0x783834['shift']());}};_0x22055f(++_0x38c810);}(_0x2d17,0x17e));var _0x72d1=function(_0x2bf5df,_0x39eefa){_0x2bf5df=_0x2bf5df-0x0;var _0x56dd38=_0x2d17[_0x2bf5df];return _0x56dd38;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 7a0faa4..b9735d6 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 _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/messages','/:id/download','download','create','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','multer'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0x7da7,0x10d));var _0x77da=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x7da7[_0x15b380];return _0x232c5c;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x77da('0x7')]('/',auth[_0x77da('0x8')](),controller['index']);router[_0x77da('0x7')]('/describe',auth[_0x77da('0x8')](),controller[_0x77da('0x9')]);router[_0x77da('0x7')](_0x77da('0xa'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0x7')](_0x77da('0xb'),auth[_0x77da('0x8')](),controller['getMessages']);router[_0x77da('0x7')](_0x77da('0xc'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);router['post']('/',auth[_0x77da('0x8')](),controller[_0x77da('0xe')]);router[_0x77da('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x77da('0x10')]);router[_0x77da('0xf')]('/:id/tags',auth[_0x77da('0x8')](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x13')),controller['addTags']);router[_0x77da('0x14')]('/:id',auth[_0x77da('0x8')](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x15')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x77da('0x11')](_0x77da('0x12'),_0x77da('0x16')),controller[_0x77da('0x17')]);router[_0x77da('0x18')](_0x77da('0x19'),auth[_0x77da('0x8')](),controller[_0x77da('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x3831=['whatsappinteraction:destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','delete'];(function(_0x1599fd,_0x40b96d){var _0x3a81b6=function(_0x292fdd){while(--_0x292fdd){_0x1599fd['push'](_0x1599fd['shift']());}};_0x3a81b6(++_0x40b96d);}(_0x3831,0x14c));var _0x1383=function(_0x49225d,_0x312d6c){_0x49225d=_0x49225d-0x0;var _0x2c228f=_0x3831[_0x49225d];return _0x2c228f;};'use strict';var multer=require(_0x1383('0x0'));var util=require('util');var path=require(_0x1383('0x1'));var timeout=require(_0x1383('0x2'));var express=require(_0x1383('0x3'));var router=express[_0x1383('0x4')]();var fs_extra=require(_0x1383('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1383('0x6'));var config=require('../../config/environment');var controller=require(_0x1383('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1383('0x8')]('/describe',auth[_0x1383('0x9')](),controller[_0x1383('0xa')]);router[_0x1383('0x8')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0xc')]);router[_0x1383('0x8')](_0x1383('0xd'),auth['isAuthenticated'](),controller[_0x1383('0xe')]);router[_0x1383('0x8')](_0x1383('0xf'),auth[_0x1383('0x9')](),controller[_0x1383('0x10')]);router['post']('/',auth[_0x1383('0x9')](),controller[_0x1383('0x11')]);router[_0x1383('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1383('0x13')]);router[_0x1383('0x12')](_0x1383('0x14'),auth[_0x1383('0x9')](),interaction[_0x1383('0x15')](_0x1383('0x16'),_0x1383('0x17')),controller[_0x1383('0x18')]);router['put'](_0x1383('0xb'),auth[_0x1383('0x9')](),interaction[_0x1383('0x15')](_0x1383('0x16'),_0x1383('0x19')),controller[_0x1383('0x1a')]);router[_0x1383('0x1b')]('/:id',auth['isAuthenticated'](),interaction[_0x1383('0x15')]('whatsapp',_0x1383('0x1c')),controller['destroy']);router['delete']('/:id/tags',auth[_0x1383('0x9')](),controller['removeTags']);module[_0x1383('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 7d688c0..83147a1 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 _0x0c42=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3ab50e,_0x47e224){var _0x2be961=function(_0xe92d85){while(--_0xe92d85){_0x3ab50e['push'](_0x3ab50e['shift']());}};_0x2be961(++_0x47e224);}(_0x0c42,0x191));var _0x20c4=function(_0x3bf2cb,_0x50cbe9){_0x3bf2cb=_0x3bf2cb-0x0;var _0x5abedd=_0x0c42[_0x3bf2cb];return _0x5abedd;};'use strict';var Sequelize=require(_0x20c4('0x0'));var moment=require(_0x20c4('0x1'));module[_0x20c4('0x2')]={'closed':{'type':Sequelize[_0x20c4('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x20c4('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x20c4('0x5')]},'note':{'type':Sequelize[_0x20c4('0x5')]},'phone':{'type':Sequelize[_0x20c4('0x5')]},'read1stAt':{'type':Sequelize[_0x20c4('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x20c4('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x20c4('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x20c4('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1224=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1224,0x10d));var _0x4122=function(_0x4547d5,_0x91d898){_0x4547d5=_0x4547d5-0x0;var _0x81ad1f=_0x1224[_0x4547d5];return _0x81ad1f;};'use strict';var Sequelize=require(_0x4122('0x0'));var moment=require(_0x4122('0x1'));module[_0x4122('0x2')]={'closed':{'type':Sequelize[_0x4122('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4122('0x4')]},'disposition':{'type':Sequelize[_0x4122('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4122('0x5')]},'note':{'type':Sequelize[_0x4122('0x5')]},'phone':{'type':Sequelize[_0x4122('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4122('0x6')]('in',_0x4122('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4122('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4122('0x6')]('in',_0x4122('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4122('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b5b672b..a310b55 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 _0xfa68=['basename','System','lastName','out','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','log','err','unlinkSync','rimraf','moment','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','localhost','redis','./whatsappInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','params','model','keys','filters','attributes','fields','length','includeAll','merge','options','create','body','find','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','include','rows','setTags','spread','Tag','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','User','push','CmContact','Contact','firstName','Attachment','direction','read','Owner','fullname','get','mkdirSync','Whatsapp','Account','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','existsSync','pipe','createWriteStream'];(function(_0x2883d7,_0x27b5a1){var _0x57312a=function(_0x5ab377){while(--_0x5ab377){_0x2883d7['push'](_0x2883d7['shift']());}};_0x57312a(++_0x27b5a1);}(_0xfa68,0x10b));var _0x8fa6=function(_0x21d1f2,_0x16342b){_0x21d1f2=_0x21d1f2-0x0;var _0x2f6b31=_0xfa68[_0x21d1f2];return _0x2f6b31;};'use strict';var rimraf=require(_0x8fa6('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8fa6('0x1'));var BPromise=require('bluebird');var util=require(_0x8fa6('0x2'));var path=require(_0x8fa6('0x3'));var ejs=require(_0x8fa6('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x8fa6('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x8fa6('0x6'));var pdf=require(_0x8fa6('0x7'));var logger=require('../../config/logger')(_0x8fa6('0x8'));var config=require(_0x8fa6('0x9'));var db=require(_0x8fa6('0xa'))['db'];config['redis']=_[_0x8fa6('0xb')](config['redis'],{'host':_0x8fa6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8fa6('0xd')]));require(_0x8fa6('0xe'))[_0x8fa6('0xf')](socket);function respondWithStatusCode(_0x1d7a3c,_0x2d41c4){_0x2d41c4=_0x2d41c4||0xcc;return function(_0x10a6b9){if(_0x10a6b9){return _0x1d7a3c['sendStatus'](_0x2d41c4);}return _0x1d7a3c[_0x8fa6('0x10')](_0x2d41c4)[_0x8fa6('0x11')]();};}function respondWithResult(_0xd09087,_0x45fa59){_0x45fa59=_0x45fa59||0xc8;return function(_0x2daed4){if(_0x2daed4){return _0xd09087['status'](_0x45fa59)[_0x8fa6('0x12')](_0x2daed4);}};}function respondWithFilteredResult(_0x11a519,_0x33e625){return function(_0x129055){if(_0x129055){var _0x4f5fb9=typeof _0x33e625[_0x8fa6('0x13')]===_0x8fa6('0x14')&&typeof _0x33e625[_0x8fa6('0x15')]==='undefined';var _0x529854=_0x129055[_0x8fa6('0x16')];var _0x395ec8=_0x4f5fb9?0x0:_0x33e625[_0x8fa6('0x13')];var _0x2a3a6a=_0x4f5fb9?_0x129055[_0x8fa6('0x16')]:_0x33e625[_0x8fa6('0x13')]+_0x33e625[_0x8fa6('0x15')];var _0x299be8;if(_0x2a3a6a>=_0x529854){_0x2a3a6a=_0x529854;_0x299be8=0xc8;}else{_0x299be8=0xce;}_0x11a519[_0x8fa6('0x10')](_0x299be8);return _0x11a519[_0x8fa6('0x17')](_0x8fa6('0x18'),_0x395ec8+'-'+_0x2a3a6a+'/'+_0x529854)['json'](_0x129055);}return null;};}function saveUpdates(_0x532556){return function(_0x3a43b8){if(_0x3a43b8){return _0x3a43b8[_0x8fa6('0x19')](_0x532556)[_0x8fa6('0x1a')](function(_0x2b5047){return _0x2b5047;});}return null;};}function removeEntity(_0x35f9f8){return function(_0x327e26){if(_0x327e26){return _0x327e26[_0x8fa6('0x1b')]()[_0x8fa6('0x1a')](function(){_0x35f9f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d9d9){return function(_0x364959){if(!_0x364959){_0x46d9d9[_0x8fa6('0x1c')](0x194);}return _0x364959;};}function handleError(_0x4933f9,_0x22ecd4){_0x22ecd4=_0x22ecd4||0x1f4;return function(_0x4b05ef){logger[_0x8fa6('0x1d')](_0x4b05ef[_0x8fa6('0x1e')]);if(_0x4b05ef[_0x8fa6('0x1f')]){delete _0x4b05ef['name'];}_0x4933f9[_0x8fa6('0x10')](_0x22ecd4)[_0x8fa6('0x20')](_0x4b05ef);};}exports[_0x8fa6('0x21')]=function(_0x1e21e7,_0x3e66e0){var _0x2affb1={};var _0x5d9155=_[_0x8fa6('0x22')](db[_0x8fa6('0x23')][_0x8fa6('0x24')],function(_0x4cae2e){return{'name':_0x4cae2e[_0x8fa6('0x25')],'type':_0x4cae2e[_0x8fa6('0x26')][_0x8fa6('0x27')]};});_0x2affb1=qs[_0x8fa6('0x28')](_0x5d9155,_0x1e21e7);return interaction[_0x8fa6('0x29')]('whatsapp',_0x1e21e7[_0x8fa6('0x2a')],_0x1e21e7[_0x8fa6('0x2b')],_0x2affb1,_0x5d9155)['then'](respondWithFilteredResult(_0x3e66e0,_0x2affb1))[_0x8fa6('0x2c')](handleError(_0x3e66e0,null));};exports['show']=function(_0x5bf6a9,_0x13a987){var _0x7b9f7f={'raw':![],'where':{'id':_0x5bf6a9[_0x8fa6('0x2d')]['id']}},_0x3b4496={};_0x3b4496[_0x8fa6('0x2e')]=_['keys'](db[_0x8fa6('0x23')][_0x8fa6('0x24')]);_0x3b4496['query']=_[_0x8fa6('0x2f')](_0x5bf6a9[_0x8fa6('0x2a')]);_0x3b4496[_0x8fa6('0x30')]=_['intersection'](_0x3b4496[_0x8fa6('0x2e')],_0x3b4496[_0x8fa6('0x2a')]);_0x7b9f7f[_0x8fa6('0x31')]=_['intersection'](_0x3b4496[_0x8fa6('0x2e')],qs[_0x8fa6('0x32')](_0x5bf6a9[_0x8fa6('0x2a')][_0x8fa6('0x32')]));_0x7b9f7f[_0x8fa6('0x31')]=_0x7b9f7f[_0x8fa6('0x31')][_0x8fa6('0x33')]?_0x7b9f7f[_0x8fa6('0x31')]:_0x3b4496[_0x8fa6('0x2e')];if(_0x5bf6a9[_0x8fa6('0x2a')][_0x8fa6('0x34')]){_0x7b9f7f['include']=[{'all':!![]}];}_0x7b9f7f=_[_0x8fa6('0x35')]({},_0x7b9f7f,_0x5bf6a9[_0x8fa6('0x36')]);return db[_0x8fa6('0x23')]['find'](_0x7b9f7f)[_0x8fa6('0x1a')](handleEntityNotFound(_0x13a987,null))[_0x8fa6('0x1a')](respondWithResult(_0x13a987,null))[_0x8fa6('0x2c')](handleError(_0x13a987,null));};exports[_0x8fa6('0x37')]=function(_0x19f5e5,_0x3564c7){return db[_0x8fa6('0x23')][_0x8fa6('0x37')](_0x19f5e5[_0x8fa6('0x38')],{})[_0x8fa6('0x1a')](respondWithResult(_0x3564c7,0xc9))[_0x8fa6('0x2c')](handleError(_0x3564c7,null));};exports[_0x8fa6('0x19')]=function(_0x41ae65,_0x42d3f5){if(_0x41ae65[_0x8fa6('0x38')]['id']){delete _0x41ae65['body']['id'];}return db[_0x8fa6('0x23')][_0x8fa6('0x39')]({'where':{'id':_0x41ae65[_0x8fa6('0x2d')]['id']}})[_0x8fa6('0x1a')](handleEntityNotFound(_0x42d3f5,null))['then'](saveUpdates(_0x41ae65[_0x8fa6('0x38')],null))['then'](respondWithResult(_0x42d3f5,null))['catch'](handleError(_0x42d3f5,null));};exports['destroy']=function(_0x4d1940,_0x48970d){return db[_0x8fa6('0x23')][_0x8fa6('0x39')]({'where':{'id':_0x4d1940[_0x8fa6('0x2d')]['id']}})[_0x8fa6('0x1a')](handleEntityNotFound(_0x48970d,null))[_0x8fa6('0x1a')](removeEntity(_0x48970d,null))[_0x8fa6('0x2c')](handleError(_0x48970d,null));};exports['describe']=function(_0xa12396,_0xd61016){return db['WhatsappInteraction'][_0x8fa6('0x3a')]()['then'](respondWithResult(_0xd61016,null))[_0x8fa6('0x2c')](handleError(_0xd61016,null));};exports[_0x8fa6('0x3b')]=function(_0x254fb1,_0x26349f){return db[_0x8fa6('0x3c')][_0x8fa6('0x39')]({'where':{'id':_0x254fb1[_0x8fa6('0x2d')]['id']}})[_0x8fa6('0x1a')](handleEntityNotFound(_0x26349f,null))[_0x8fa6('0x1a')](function(_0x55cb4e){if(_0x55cb4e){return _0x55cb4e[_0x8fa6('0x3b')](_0x254fb1[_0x8fa6('0x38')]['ids'],_[_0x8fa6('0x3d')](_0x254fb1[_0x8fa6('0x38')],[_0x8fa6('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x26349f,null))[_0x8fa6('0x2c')](handleError(_0x26349f,null));};exports[_0x8fa6('0x3f')]=function(_0x4cfbd6,_0x18370e){var _0x3249a8={'raw':![],'where':{}};var _0x1303dc={};var _0x3fe019={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x8fa6('0x40')]({'where':{'id':_0x4cfbd6[_0x8fa6('0x2d')]['id']}})['then'](handleEntityNotFound(_0x18370e,null))[_0x8fa6('0x1a')](function(_0x4b3f13){if(_0x4b3f13){_0x1303dc[_0x8fa6('0x2e')]=_['keys'](db[_0x8fa6('0x3c')][_0x8fa6('0x24')]);_0x1303dc['query']=_[_0x8fa6('0x2f')](_0x4cfbd6[_0x8fa6('0x2a')]);_0x1303dc['filters']=_[_0x8fa6('0x41')](_0x1303dc['model'],_0x1303dc[_0x8fa6('0x2a')]);_0x3249a8[_0x8fa6('0x31')]=_[_0x8fa6('0x41')](_0x1303dc[_0x8fa6('0x2e')],qs['fields'](_0x4cfbd6[_0x8fa6('0x2a')][_0x8fa6('0x32')]));_0x3249a8[_0x8fa6('0x31')]=_0x3249a8['attributes'][_0x8fa6('0x33')]?_0x3249a8[_0x8fa6('0x31')]:_0x1303dc[_0x8fa6('0x2e')];if(!_0x4cfbd6[_0x8fa6('0x2a')][_0x8fa6('0x42')](_0x8fa6('0x43'))){_0x3249a8[_0x8fa6('0x15')]=qs[_0x8fa6('0x15')](_0x4cfbd6[_0x8fa6('0x2a')]['limit']);_0x3249a8[_0x8fa6('0x13')]=qs[_0x8fa6('0x13')](_0x4cfbd6[_0x8fa6('0x2a')]['offset']);}_0x3249a8[_0x8fa6('0x44')]=qs[_0x8fa6('0x45')](_0x4cfbd6[_0x8fa6('0x2a')]['sort']);_0x3249a8[_0x8fa6('0x46')]=qs[_0x8fa6('0x30')](_['pick'](_0x4cfbd6[_0x8fa6('0x2a')],_0x1303dc[_0x8fa6('0x30')]));_0x3249a8[_0x8fa6('0x46')][_0x8fa6('0x47')]=_0x4b3f13['id'];if(_0x4cfbd6[_0x8fa6('0x2a')][_0x8fa6('0x48')]){_0x3249a8[_0x8fa6('0x46')]=_[_0x8fa6('0x35')](_0x3249a8[_0x8fa6('0x46')],{'$or':_[_0x8fa6('0x22')](_0x3249a8[_0x8fa6('0x31')],function(_0x12f3c8){var _0x59c4f7={};_0x59c4f7[_0x12f3c8]={'$like':'%'+_0x4cfbd6[_0x8fa6('0x2a')][_0x8fa6('0x48')]+'%'};return _0x59c4f7;})});}if(_0x4cfbd6['query'][_0x8fa6('0x49')]){var _0x273dcc=_0x4cfbd6[_0x8fa6('0x2a')][_0x8fa6('0x49')][_0x8fa6('0x4a')](',');var _0x58d3b8={};_0x58d3b8[_0x273dcc[0x0]]={'$gte':moment(_0x273dcc[0x1])[_0x8fa6('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3249a8[_0x8fa6('0x46')]=_[_0x8fa6('0x35')](_0x3249a8[_0x8fa6('0x46')],_0x58d3b8);}_0x3249a8=_['merge']({},_0x3249a8,_0x4cfbd6[_0x8fa6('0x36')]);return db[_0x8fa6('0x3c')][_0x8fa6('0x16')]({'where':_0x3249a8[_0x8fa6('0x46')]})[_0x8fa6('0x1a')](function(_0x1017fd){_0x3fe019[_0x8fa6('0x16')]=_0x1017fd;if(_0x4cfbd6['query']['includeAll']){_0x3249a8[_0x8fa6('0x4c')]=[{'all':!![]}];}return db[_0x8fa6('0x3c')][_0x8fa6('0x29')](_0x3249a8);})[_0x8fa6('0x1a')](function(_0x5cd614){_0x3fe019[_0x8fa6('0x4d')]=_0x5cd614;return _0x3fe019;});}})['then'](respondWithFilteredResult(_0x18370e,_0x3249a8))[_0x8fa6('0x2c')](handleError(_0x18370e,null));};exports['addTags']=function(_0x3ee08d,_0x3da303){return db[_0x8fa6('0x23')]['find']({'where':{'id':_0x3ee08d['params']['id']}})[_0x8fa6('0x1a')](handleEntityNotFound(_0x3da303,null))[_0x8fa6('0x1a')](function(_0x394777){if(_0x394777){return _0x394777[_0x8fa6('0x4e')](_0x3ee08d[_0x8fa6('0x38')][_0x8fa6('0x3e')],_['omit'](_0x3ee08d['body'],['ids','id'])||{})[_0x8fa6('0x4f')](function(){return db[_0x8fa6('0x50')][_0x8fa6('0x29')]({'attributes':['id',_0x8fa6('0x1f'),'color'],'where':{'id':_0x3ee08d['body'][_0x8fa6('0x3e')]}});})[_0x8fa6('0x1a')](function(_0x29bdba){socket[_0x8fa6('0x51')]('whatsappInteractionTags:save',{'id':Number(_0x3ee08d['params']['id']),'tags':_0x29bdba||[]});return{'id':Number(_0x3ee08d[_0x8fa6('0x2d')]['id']),'tags':_0x29bdba||[]};});}})['then'](respondWithResult(_0x3da303,null))[_0x8fa6('0x2c')](handleError(_0x3da303,null));};exports[_0x8fa6('0x52')]=function(_0x48389c,_0x1b40dd){return db[_0x8fa6('0x23')]['find']({'where':{'id':_0x48389c['params']['id']}})[_0x8fa6('0x1a')](handleEntityNotFound(_0x1b40dd,null))['then'](function(_0x59147a){if(_0x59147a){return _0x59147a[_0x8fa6('0x52')](_0x48389c[_0x8fa6('0x2a')][_0x8fa6('0x3e')]);}})[_0x8fa6('0x1a')](respondWithStatusCode(_0x1b40dd,null))[_0x8fa6('0x2c')](handleError(_0x1b40dd,null));};exports[_0x8fa6('0x53')]=function(_0x48636b,_0x5d7bba){var _0x1b71ea=moment()[_0x8fa6('0x54')]()[_0x8fa6('0x55')]();var _0x17b323=path[_0x8fa6('0x56')](config[_0x8fa6('0x57')],_0x8fa6('0x58'),_0x8fa6('0x59'),_0x8fa6('0x5a'));var _0x43ee3c=path[_0x8fa6('0x56')](config[_0x8fa6('0x57')],'server','files',_0x8fa6('0x5b'));var _0x18fbad=path[_0x8fa6('0x56')](_0x17b323,_0x1b71ea);var _0x2d8400=util[_0x8fa6('0x4b')]('transcript-%d-%s.zip',_0x48636b[_0x8fa6('0x2d')]['id'],_0x1b71ea);var _0x19443a=path['join'](_0x17b323,_0x2d8400);var _0x29fb9a=[];_0x29fb9a['push']({'model':db[_0x8fa6('0x5c')],'as':_0x8fa6('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x29fb9a[_0x8fa6('0x5d')]({'model':db[_0x8fa6('0x5e')],'as':_0x8fa6('0x5f'),'attributes':['id',_0x8fa6('0x60'),'lastName'],'raw':!![]});if(_0x48636b[_0x8fa6('0x2a')][_0x8fa6('0x5b')]){_0x29fb9a[_0x8fa6('0x5d')]({'model':db[_0x8fa6('0x61')],'as':_0x8fa6('0x61'),'raw':!![]});}var _0x581b06=[{'model':db[_0x8fa6('0x3c')],'as':'Messages','attributes':['id',_0x8fa6('0x38'),'createdAt',_0x8fa6('0x62'),'secret',_0x8fa6('0x63')],'include':_0x29fb9a}];_0x581b06[_0x8fa6('0x5d')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x8fa6('0x1f')]});_0x581b06[_0x8fa6('0x5d')]({'model':db[_0x8fa6('0x5c')],'as':_0x8fa6('0x64'),'attributes':['id',_0x8fa6('0x65')]});return db[_0x8fa6('0x23')][_0x8fa6('0x39')]({'where':{'id':_0x48636b[_0x8fa6('0x2d')]['id']},'include':_0x581b06})[_0x8fa6('0x1a')](handleEntityNotFound(_0x5d7bba,null))['then'](function(_0x48205d){if(_0x48205d){var _0x60a2e0=_0x48205d[_0x8fa6('0x66')]({'plain':!![]});fs[_0x8fa6('0x67')](_0x18fbad);var _0x3668c2={'channel':_0x8fa6('0x68'),'account':_0x60a2e0[_0x8fa6('0x69')][_0x8fa6('0x1f')],'agent':_0x60a2e0['Owner']?_0x60a2e0[_0x8fa6('0x64')]['fullname']:_0x8fa6('0x6a'),'createdAt':moment(_0x60a2e0[_0x8fa6('0x6b')])[_0x8fa6('0x4b')](_0x8fa6('0x6c'))[_0x8fa6('0x55')](),'closedAt':_0x60a2e0['closed']?moment(_0x60a2e0[_0x8fa6('0x6d')])[_0x8fa6('0x4b')](_0x8fa6('0x6c'))[_0x8fa6('0x55')]():'','disposition':_0x60a2e0[_0x8fa6('0x6e')],'messages':_(_0x60a2e0['Messages'])[_0x8fa6('0x48')]({'secret':![]})[_0x8fa6('0x22')](function(_0x59bcff){if(_0x59bcff[_0x8fa6('0x61')]){var _0x3e8209=path[_0x8fa6('0x56')](_0x43ee3c,_0x59bcff[_0x8fa6('0x61')]['basename']);if(fs[_0x8fa6('0x6f')](_0x3e8209)){fs['createReadStream'](_0x3e8209)[_0x8fa6('0x70')](fs[_0x8fa6('0x71')](path[_0x8fa6('0x56')](_0x18fbad,_0x59bcff[_0x8fa6('0x61')][_0x8fa6('0x72')])));}}return{'date':moment(_0x59bcff['createdAt'])[_0x8fa6('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x59bcff[_0x8fa6('0x62')]==='out'?_0x59bcff[_0x8fa6('0x5c')]?_0x59bcff['User'][_0x8fa6('0x65')]:_0x8fa6('0x73'):_0x59bcff[_0x8fa6('0x5f')][_0x8fa6('0x60')]+(_0x59bcff[_0x8fa6('0x5f')][_0x8fa6('0x74')]?'\x20'+_0x59bcff[_0x8fa6('0x5f')]['lastName']:''),'body':_0x59bcff[_0x8fa6('0x61')]?_0x59bcff[_0x8fa6('0x61')]['basename']:_0x59bcff[_0x8fa6('0x38')],'direction':_0x59bcff['direction']===_0x8fa6('0x75')?'A':'C','secret':_0x59bcff[_0x8fa6('0x76')],'read':_0x59bcff['read'],'attachment':_0x59bcff['Attachment']};})[_0x8fa6('0x77')]()};return ejs[_0x8fa6('0x78')](path[_0x8fa6('0x56')](config[_0x8fa6('0x57')],_0x8fa6('0x58'),_0x8fa6('0x79'),_0x8fa6('0x7a')),{'interaction':_0x3668c2})['then'](function(_0x4818ff){var _0x258159=path['join'](_0x18fbad,_0x8fa6('0x7b')+_0x60a2e0['id']+'-'+_0x1b71ea+'.pdf');var _0x36804c={'path':_0x258159,'channel':_0x8fa6('0x68'),'interactionId':_0x60a2e0['id']};return pdf['createPdfFromHTML'](_0x4818ff,_0x36804c);})['then'](function(){return new BPromise(function(_0x52ffc2,_0x557ac9){zipdir(_0x18fbad,{'saveTo':_0x19443a},function(_0x228eaa,_0x36b323){if(_0x228eaa)return _0x557ac9(_0x228eaa);return _0x52ffc2(_0x36b323);});})[_0x8fa6('0x1a')](function(){return new BPromise(function(_0x22d840,_0x11371d){rimraf(_0x18fbad,function(_0x2261fb){if(_0x2261fb)_0x11371d(_0x2261fb);return _0x22d840();});});})['then'](function(){return _0x5d7bba[_0x8fa6('0x53')](_0x19443a,_0x2d8400,function(_0x5df24f){if(_0x5df24f){console[_0x8fa6('0x7c')](_0x8fa6('0x7d'),_0x5df24f);}else{fs[_0x8fa6('0x7e')](_0x19443a);}});});});}else{return _0x5d7bba['sendStatus'](0xc8);}})['catch'](handleError(_0x5d7bba,null));}; \ No newline at end of file +var _0x0f8d=['out','System','value','renderFile','views','downloadInteraction.ejs','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','defaults','localhost','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','error','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName','key','findAll','whatsapp','query','user','show','model','keys','filters','intersection','attributes','fields','includeAll','include','options','catch','create','update','body','find','params','destroy','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','pick','where','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','spread','color','emit','removeTags','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','Contact','firstName','lastName','Attachment','Messages','secret','read','WhatsappAccount','Owner','fullname','get','mkdirSync','Whatsapp','Account','N.A.','createdAt','toString','closed','closedAt','disposition','basename','direction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f8d,0x185));var _0xd0f8=function(_0x71e017,_0x550bc2){_0x71e017=_0x71e017-0x0;var _0x24fe13=_0x0f8d[_0x71e017];return _0x24fe13;};'use strict';var rimraf=require(_0xd0f8('0x0'));var zipdir=require(_0xd0f8('0x1'));var moment=require(_0xd0f8('0x2'));var BPromise=require('bluebird');var util=require(_0xd0f8('0x3'));var path=require(_0xd0f8('0x4'));var ejs=require(_0xd0f8('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd0f8('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xd0f8('0x7'));var pdf=require(_0xd0f8('0x8'));var logger=require(_0xd0f8('0x9'))(_0xd0f8('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd0f8('0xb')]=_[_0xd0f8('0xc')](config['redis'],{'host':_0xd0f8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd0f8('0xb')]));require(_0xd0f8('0xe'))['register'](socket);function respondWithStatusCode(_0x9537a5,_0x137971){_0x137971=_0x137971||0xcc;return function(_0x1d7941){if(_0x1d7941){return _0x9537a5[_0xd0f8('0xf')](_0x137971);}return _0x9537a5[_0xd0f8('0x10')](_0x137971)[_0xd0f8('0x11')]();};}function respondWithResult(_0x5204ba,_0x5c5da2){_0x5c5da2=_0x5c5da2||0xc8;return function(_0x3de794){if(_0x3de794){return _0x5204ba[_0xd0f8('0x10')](_0x5c5da2)[_0xd0f8('0x12')](_0x3de794);}};}function respondWithFilteredResult(_0x54f7e8,_0x336f42){return function(_0x261092){if(_0x261092){var _0x321281=typeof _0x336f42[_0xd0f8('0x13')]===_0xd0f8('0x14')&&typeof _0x336f42['limit']===_0xd0f8('0x14');var _0x22d53e=_0x261092[_0xd0f8('0x15')];var _0x37f18e=_0x321281?0x0:_0x336f42[_0xd0f8('0x13')];var _0x36c1ca=_0x321281?_0x261092[_0xd0f8('0x15')]:_0x336f42[_0xd0f8('0x13')]+_0x336f42[_0xd0f8('0x16')];var _0x530767;if(_0x36c1ca>=_0x22d53e){_0x36c1ca=_0x22d53e;_0x530767=0xc8;}else{_0x530767=0xce;}_0x54f7e8[_0xd0f8('0x10')](_0x530767);return _0x54f7e8[_0xd0f8('0x17')](_0xd0f8('0x18'),_0x37f18e+'-'+_0x36c1ca+'/'+_0x22d53e)[_0xd0f8('0x12')](_0x261092);}return null;};}function saveUpdates(_0xe0c06b){return function(_0x45ef96){if(_0x45ef96){return _0x45ef96['update'](_0xe0c06b)[_0xd0f8('0x19')](function(_0x21b65c){return _0x21b65c;});}return null;};}function removeEntity(_0x1c0dc6){return function(_0x4f46d4){if(_0x4f46d4){return _0x4f46d4['destroy']()[_0xd0f8('0x19')](function(){_0x1c0dc6[_0xd0f8('0x10')](0xcc)[_0xd0f8('0x11')]();});}};}function handleEntityNotFound(_0x26f8d3){return function(_0x76e7c1){if(!_0x76e7c1){_0x26f8d3[_0xd0f8('0xf')](0x194);}return _0x76e7c1;};}function handleError(_0x54d7e0,_0x30bb25){_0x30bb25=_0x30bb25||0x1f4;return function(_0x2d632d){logger[_0xd0f8('0x1a')](_0x2d632d[_0xd0f8('0x1b')]);if(_0x2d632d[_0xd0f8('0x1c')]){delete _0x2d632d[_0xd0f8('0x1c')];}_0x54d7e0[_0xd0f8('0x10')](_0x30bb25)[_0xd0f8('0x1d')](_0x2d632d);};}exports[_0xd0f8('0x1e')]=function(_0x2d44d2,_0x3af6f5){var _0x151a09={};var _0x181f12=_['map'](db[_0xd0f8('0x1f')][_0xd0f8('0x20')],function(_0x1c8c28){return{'name':_0x1c8c28[_0xd0f8('0x21')],'type':_0x1c8c28['type'][_0xd0f8('0x22')]};});_0x151a09=qs['getOptions'](_0x181f12,_0x2d44d2);return interaction[_0xd0f8('0x23')](_0xd0f8('0x24'),_0x2d44d2[_0xd0f8('0x25')],_0x2d44d2[_0xd0f8('0x26')],_0x151a09,_0x181f12)[_0xd0f8('0x19')](respondWithFilteredResult(_0x3af6f5,_0x151a09))['catch'](handleError(_0x3af6f5,null));};exports[_0xd0f8('0x27')]=function(_0x45730a,_0x571b5f){var _0xea46cf={'raw':![],'where':{'id':_0x45730a['params']['id']}},_0x5c9ced={};_0x5c9ced[_0xd0f8('0x28')]=_[_0xd0f8('0x29')](db[_0xd0f8('0x1f')][_0xd0f8('0x20')]);_0x5c9ced[_0xd0f8('0x25')]=_['keys'](_0x45730a[_0xd0f8('0x25')]);_0x5c9ced[_0xd0f8('0x2a')]=_[_0xd0f8('0x2b')](_0x5c9ced['model'],_0x5c9ced[_0xd0f8('0x25')]);_0xea46cf[_0xd0f8('0x2c')]=_['intersection'](_0x5c9ced[_0xd0f8('0x28')],qs[_0xd0f8('0x2d')](_0x45730a['query'][_0xd0f8('0x2d')]));_0xea46cf[_0xd0f8('0x2c')]=_0xea46cf[_0xd0f8('0x2c')]['length']?_0xea46cf[_0xd0f8('0x2c')]:_0x5c9ced[_0xd0f8('0x28')];if(_0x45730a[_0xd0f8('0x25')][_0xd0f8('0x2e')]){_0xea46cf[_0xd0f8('0x2f')]=[{'all':!![]}];}_0xea46cf=_['merge']({},_0xea46cf,_0x45730a[_0xd0f8('0x30')]);return db[_0xd0f8('0x1f')]['find'](_0xea46cf)[_0xd0f8('0x19')](handleEntityNotFound(_0x571b5f,null))[_0xd0f8('0x19')](respondWithResult(_0x571b5f,null))[_0xd0f8('0x31')](handleError(_0x571b5f,null));};exports[_0xd0f8('0x32')]=function(_0x5763f8,_0x1926f8){return db[_0xd0f8('0x1f')][_0xd0f8('0x32')](_0x5763f8['body'],{})[_0xd0f8('0x19')](respondWithResult(_0x1926f8,0xc9))[_0xd0f8('0x31')](handleError(_0x1926f8,null));};exports[_0xd0f8('0x33')]=function(_0x2ab265,_0x17c2ee){if(_0x2ab265['body']['id']){delete _0x2ab265[_0xd0f8('0x34')]['id'];}return db['WhatsappInteraction'][_0xd0f8('0x35')]({'where':{'id':_0x2ab265[_0xd0f8('0x36')]['id']}})[_0xd0f8('0x19')](handleEntityNotFound(_0x17c2ee,null))[_0xd0f8('0x19')](saveUpdates(_0x2ab265['body'],null))[_0xd0f8('0x19')](respondWithResult(_0x17c2ee,null))[_0xd0f8('0x31')](handleError(_0x17c2ee,null));};exports[_0xd0f8('0x37')]=function(_0x9f3f9d,_0x160ce8){return db[_0xd0f8('0x1f')]['find']({'where':{'id':_0x9f3f9d[_0xd0f8('0x36')]['id']}})[_0xd0f8('0x19')](handleEntityNotFound(_0x160ce8,null))[_0xd0f8('0x19')](removeEntity(_0x160ce8,null))['catch'](handleError(_0x160ce8,null));};exports[_0xd0f8('0x38')]=function(_0x2f2b43,_0x3d933c){return db['WhatsappInteraction'][_0xd0f8('0x38')]()[_0xd0f8('0x19')](respondWithResult(_0x3d933c,null))[_0xd0f8('0x31')](handleError(_0x3d933c,null));};exports[_0xd0f8('0x39')]=function(_0xd1306,_0x46d281){return db[_0xd0f8('0x3a')][_0xd0f8('0x35')]({'where':{'id':_0xd1306[_0xd0f8('0x36')]['id']}})['then'](handleEntityNotFound(_0x46d281,null))['then'](function(_0x4aeb3d){if(_0x4aeb3d){return _0x4aeb3d['addMessage'](_0xd1306[_0xd0f8('0x34')]['ids'],_[_0xd0f8('0x3b')](_0xd1306[_0xd0f8('0x34')],[_0xd0f8('0x3c'),'id'])||{});}})[_0xd0f8('0x19')](respondWithResult(_0x46d281,null))[_0xd0f8('0x31')](handleError(_0x46d281,null));};exports[_0xd0f8('0x3d')]=function(_0x39a461,_0x24ee18){var _0x5ec608={'raw':![],'where':{}};var _0x55d933={};var _0x42d8fa={'count':0x0,'rows':[]};return db[_0xd0f8('0x1f')][_0xd0f8('0x3e')]({'where':{'id':_0x39a461[_0xd0f8('0x36')]['id']}})[_0xd0f8('0x19')](handleEntityNotFound(_0x24ee18,null))[_0xd0f8('0x19')](function(_0x4c7251){if(_0x4c7251){_0x55d933[_0xd0f8('0x28')]=_[_0xd0f8('0x29')](db[_0xd0f8('0x3a')][_0xd0f8('0x20')]);_0x55d933['query']=_[_0xd0f8('0x29')](_0x39a461[_0xd0f8('0x25')]);_0x55d933[_0xd0f8('0x2a')]=_[_0xd0f8('0x2b')](_0x55d933[_0xd0f8('0x28')],_0x55d933[_0xd0f8('0x25')]);_0x5ec608[_0xd0f8('0x2c')]=_[_0xd0f8('0x2b')](_0x55d933[_0xd0f8('0x28')],qs[_0xd0f8('0x2d')](_0x39a461['query'][_0xd0f8('0x2d')]));_0x5ec608['attributes']=_0x5ec608[_0xd0f8('0x2c')][_0xd0f8('0x3f')]?_0x5ec608[_0xd0f8('0x2c')]:_0x55d933['model'];if(!_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x40')](_0xd0f8('0x41'))){_0x5ec608['limit']=qs[_0xd0f8('0x16')](_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x16')]);_0x5ec608[_0xd0f8('0x13')]=qs['offset'](_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x13')]);}_0x5ec608[_0xd0f8('0x42')]=qs[_0xd0f8('0x43')](_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x43')]);_0x5ec608['where']=qs[_0xd0f8('0x2a')](_[_0xd0f8('0x44')](_0x39a461[_0xd0f8('0x25')],_0x55d933[_0xd0f8('0x2a')]));_0x5ec608['where']['WhatsappInteractionId']=_0x4c7251['id'];if(_0x39a461[_0xd0f8('0x25')]['filter']){_0x5ec608[_0xd0f8('0x45')]=_['merge'](_0x5ec608['where'],{'$or':_[_0xd0f8('0x46')](_0x5ec608[_0xd0f8('0x2c')],function(_0x402993){var _0x3b069c={};_0x3b069c[_0x402993]={'$like':'%'+_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x47')]+'%'};return _0x3b069c;})});}if(_0x39a461['query'][_0xd0f8('0x48')]){var _0x2ba4a4=_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x48')][_0xd0f8('0x49')](',');var _0x2b031b={};_0x2b031b[_0x2ba4a4[0x0]]={'$gte':moment(_0x2ba4a4[0x1])[_0xd0f8('0x4a')](_0xd0f8('0x4b'))};_0x5ec608[_0xd0f8('0x45')]=_[_0xd0f8('0x4c')](_0x5ec608[_0xd0f8('0x45')],_0x2b031b);}_0x5ec608=_['merge']({},_0x5ec608,_0x39a461[_0xd0f8('0x30')]);return db[_0xd0f8('0x3a')][_0xd0f8('0x15')]({'where':_0x5ec608['where']})[_0xd0f8('0x19')](function(_0x452b4f){_0x42d8fa['count']=_0x452b4f;if(_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x2e')]){_0x5ec608['include']=[{'all':!![]}];}return db[_0xd0f8('0x3a')][_0xd0f8('0x23')](_0x5ec608);})['then'](function(_0x434227){_0x42d8fa[_0xd0f8('0x4d')]=_0x434227;return _0x42d8fa;});}})[_0xd0f8('0x19')](respondWithFilteredResult(_0x24ee18,_0x5ec608))[_0xd0f8('0x31')](handleError(_0x24ee18,null));};exports[_0xd0f8('0x4e')]=function(_0x3d6132,_0x1e7517){return db[_0xd0f8('0x1f')][_0xd0f8('0x35')]({'where':{'id':_0x3d6132[_0xd0f8('0x36')]['id']}})['then'](handleEntityNotFound(_0x1e7517,null))['then'](function(_0x4e282f){if(_0x4e282f){return _0x4e282f['setTags'](_0x3d6132[_0xd0f8('0x34')][_0xd0f8('0x3c')],_[_0xd0f8('0x3b')](_0x3d6132[_0xd0f8('0x34')],[_0xd0f8('0x3c'),'id'])||{})[_0xd0f8('0x4f')](function(){return db['Tag'][_0xd0f8('0x23')]({'attributes':['id',_0xd0f8('0x1c'),_0xd0f8('0x50')],'where':{'id':_0x3d6132[_0xd0f8('0x34')]['ids']}});})[_0xd0f8('0x19')](function(_0x5d5e19){socket[_0xd0f8('0x51')]('whatsappInteractionTags:save',{'id':Number(_0x3d6132[_0xd0f8('0x36')]['id']),'tags':_0x5d5e19||[]});return{'id':Number(_0x3d6132[_0xd0f8('0x36')]['id']),'tags':_0x5d5e19||[]};});}})[_0xd0f8('0x19')](respondWithResult(_0x1e7517,null))[_0xd0f8('0x31')](handleError(_0x1e7517,null));};exports['removeTags']=function(_0x12c6fd,_0x2aeb06){return db[_0xd0f8('0x1f')][_0xd0f8('0x35')]({'where':{'id':_0x12c6fd['params']['id']}})['then'](handleEntityNotFound(_0x2aeb06,null))[_0xd0f8('0x19')](function(_0x28eef9){if(_0x28eef9){return _0x28eef9[_0xd0f8('0x52')](_0x12c6fd[_0xd0f8('0x25')][_0xd0f8('0x3c')]);}})[_0xd0f8('0x19')](respondWithStatusCode(_0x2aeb06,null))[_0xd0f8('0x31')](handleError(_0x2aeb06,null));};exports['download']=function(_0x1b50da,_0x1ced5a){var _0x3d29a1=moment()[_0xd0f8('0x53')]()['toString']();var _0xd30ff9=path[_0xd0f8('0x54')](config[_0xd0f8('0x55')],_0xd0f8('0x56'),'files',_0xd0f8('0x57'));var _0x4dd16d=path['join'](config['root'],_0xd0f8('0x56'),_0xd0f8('0x58'),_0xd0f8('0x59'));var _0x1aca75=path[_0xd0f8('0x54')](_0xd30ff9,_0x3d29a1);var _0x413330=util[_0xd0f8('0x4a')](_0xd0f8('0x5a'),_0x1b50da['params']['id'],_0x3d29a1);var _0x3ab0d8=path['join'](_0xd30ff9,_0x413330);var _0x24f4d0=[];_0x24f4d0[_0xd0f8('0x5b')]({'model':db[_0xd0f8('0x5c')],'as':_0xd0f8('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x24f4d0['push']({'model':db['CmContact'],'as':_0xd0f8('0x5d'),'attributes':['id',_0xd0f8('0x5e'),_0xd0f8('0x5f')],'raw':!![]});if(_0x1b50da['query'][_0xd0f8('0x59')]){_0x24f4d0['push']({'model':db[_0xd0f8('0x60')],'as':'Attachment','raw':!![]});}var _0x1a2645=[{'model':db[_0xd0f8('0x3a')],'as':_0xd0f8('0x61'),'attributes':['id',_0xd0f8('0x34'),'createdAt','direction',_0xd0f8('0x62'),_0xd0f8('0x63')],'include':_0x24f4d0}];_0x1a2645[_0xd0f8('0x5b')]({'model':db[_0xd0f8('0x64')],'as':'Account','attributes':['id',_0xd0f8('0x1c')]});_0x1a2645[_0xd0f8('0x5b')]({'model':db[_0xd0f8('0x5c')],'as':_0xd0f8('0x65'),'attributes':['id',_0xd0f8('0x66')]});return db[_0xd0f8('0x1f')]['find']({'where':{'id':_0x1b50da['params']['id']},'include':_0x1a2645})[_0xd0f8('0x19')](handleEntityNotFound(_0x1ced5a,null))['then'](function(_0x298477){if(_0x298477){var _0x509460=_0x298477[_0xd0f8('0x67')]({'plain':!![]});fs[_0xd0f8('0x68')](_0x1aca75);var _0x51c80f={'channel':_0xd0f8('0x69'),'account':_0x509460[_0xd0f8('0x6a')][_0xd0f8('0x1c')],'agent':_0x509460[_0xd0f8('0x65')]?_0x509460[_0xd0f8('0x65')]['fullname']:_0xd0f8('0x6b'),'createdAt':moment(_0x509460[_0xd0f8('0x6c')])[_0xd0f8('0x4a')](_0xd0f8('0x4b'))[_0xd0f8('0x6d')](),'closedAt':_0x509460[_0xd0f8('0x6e')]?moment(_0x509460[_0xd0f8('0x6f')])[_0xd0f8('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x509460[_0xd0f8('0x70')],'messages':_(_0x509460[_0xd0f8('0x61')])[_0xd0f8('0x47')]({'secret':![]})[_0xd0f8('0x46')](function(_0x2a18f9){if(_0x2a18f9[_0xd0f8('0x60')]){var _0x577aa7=path['join'](_0x4dd16d,_0x2a18f9[_0xd0f8('0x60')][_0xd0f8('0x71')]);if(fs['existsSync'](_0x577aa7)){fs['createReadStream'](_0x577aa7)['pipe'](fs['createWriteStream'](path[_0xd0f8('0x54')](_0x1aca75,_0x2a18f9[_0xd0f8('0x60')][_0xd0f8('0x71')])));}}return{'date':moment(_0x2a18f9['createdAt'])[_0xd0f8('0x4a')](_0xd0f8('0x4b'))[_0xd0f8('0x6d')](),'sender':_0x2a18f9[_0xd0f8('0x72')]===_0xd0f8('0x73')?_0x2a18f9[_0xd0f8('0x5c')]?_0x2a18f9['User'][_0xd0f8('0x66')]:_0xd0f8('0x74'):_0x2a18f9[_0xd0f8('0x5d')][_0xd0f8('0x5e')]+(_0x2a18f9['Contact'][_0xd0f8('0x5f')]?'\x20'+_0x2a18f9['Contact']['lastName']:''),'body':_0x2a18f9[_0xd0f8('0x60')]?_0x2a18f9[_0xd0f8('0x60')][_0xd0f8('0x71')]:_0x2a18f9[_0xd0f8('0x34')],'direction':_0x2a18f9[_0xd0f8('0x72')]===_0xd0f8('0x73')?'A':'C','secret':_0x2a18f9['secret'],'read':_0x2a18f9['read'],'attachment':_0x2a18f9[_0xd0f8('0x60')]};})[_0xd0f8('0x75')]()};return ejs[_0xd0f8('0x76')](path['join'](config[_0xd0f8('0x55')],_0xd0f8('0x56'),_0xd0f8('0x77'),_0xd0f8('0x78')),{'interaction':_0x51c80f})['then'](function(_0x38f9b2){var _0x529880=path[_0xd0f8('0x54')](_0x1aca75,'transcript-'+_0x509460['id']+'-'+_0x3d29a1+_0xd0f8('0x79'));var _0x24a84d={'path':_0x529880,'channel':_0xd0f8('0x69'),'interactionId':_0x509460['id']};return pdf['createPdfFromHTML'](_0x38f9b2,_0x24a84d);})[_0xd0f8('0x19')](function(){return new BPromise(function(_0x2df3d2,_0x558887){zipdir(_0x1aca75,{'saveTo':_0x3ab0d8},function(_0x2c8177,_0x2670a8){if(_0x2c8177)return _0x558887(_0x2c8177);return _0x2df3d2(_0x2670a8);});})['then'](function(){return new BPromise(function(_0x45f94b,_0x26bc86){rimraf(_0x1aca75,function(_0xbe524c){if(_0xbe524c)_0x26bc86(_0xbe524c);return _0x45f94b();});});})['then'](function(){return _0x1ced5a[_0xd0f8('0x7a')](_0x3ab0d8,_0x413330,function(_0x3e384b){if(_0x3e384b){console[_0xd0f8('0x7b')](_0xd0f8('0x7c'),_0x3e384b);}else{fs[_0xd0f8('0x7d')](_0x3ab0d8);}});});});}else{return _0x1ced5a[_0xd0f8('0xf')](0xc8);}})[_0xd0f8('0x31')](handleError(_0x1ced5a,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ec4becc..3a53ef5 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 _0x851a=['then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x5bf030,_0x13d0d3){var _0x23a7c7=function(_0x164c1d){while(--_0x164c1d){_0x5bf030['push'](_0x5bf030['shift']());}};_0x23a7c7(++_0x13d0d3);}(_0x851a,0x19b));var _0xa851=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x851a[_0x1589dd];return _0x1bddd1;};'use strict';var EventEmitter=require(_0xa851('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xa851('0x1')];var WhatsappMessage=require(_0xa851('0x2'))['db'][_0xa851('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa851('0x4')](0x0);var events={'afterCreate':_0xa851('0x5'),'afterUpdate':_0xa851('0x6'),'afterDestroy':_0xa851('0x7')};function emitEvent(_0x3f317d){return function(_0x4a10c8,_0xdd4995,_0x57a7c4){_0x4a10c8[_0xa851('0x8')]({'attributes':['id'],'raw':!![]})[_0xa851('0x9')](function(_0x2f1f42){_0x4a10c8['setDataValue'](_0xa851('0xa'),_0x2f1f42[_0xa851('0xb')](function(_0x1334a1){return{'id':_0x1334a1['id']};}));return WhatsappMessage[_0xa851('0xc')]({'where':{'WhatsappInteractionId':_0x4a10c8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x393900){_0x4a10c8[_0xa851('0xd')]('unreadMessages',_0x393900[_0xa851('0xe')]);WhatsappInteractionEvents[_0xa851('0xf')](_0x3f317d+':'+_0x4a10c8['id'],_0x4a10c8);WhatsappInteractionEvents[_0xa851('0xf')](_0x3f317d,_0x4a10c8);_0x57a7c4(null);})[_0xa851('0x10')](_0x57a7c4(null));};}for(var e in events){if(events[_0xa851('0x11')](e)){var event=events[e];WhatsappInteraction[_0xa851('0x12')](e,emitEvent(event));}}module[_0xa851('0x13')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc6d8=['unreadMessages','length','emit','catch','hook','events','WhatsappInteraction','WhatsappMessage','save','getUsers','then','Users','map','setDataValue'];(function(_0x45ac7c,_0x40fba8){var _0x246346=function(_0xce4bba){while(--_0xce4bba){_0x45ac7c['push'](_0x45ac7c['shift']());}};_0x246346(++_0x40fba8);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x50b66d,_0x11c61c){_0x50b66d=_0x50b66d-0x0;var _0x41aa8e=_0xc6d8[_0x50b66d];return _0x41aa8e;};'use strict';var EventEmitter=require(_0x8c6d('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x8c6d('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x8c6d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c6d('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x352b8c){return function(_0xdff6f,_0x17781d,_0x4f5e8f){_0xdff6f[_0x8c6d('0x4')]({'attributes':['id'],'raw':!![]})[_0x8c6d('0x5')](function(_0x98cae4){_0xdff6f['setDataValue'](_0x8c6d('0x6'),_0x98cae4[_0x8c6d('0x7')](function(_0x16d4b2){return{'id':_0x16d4b2['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xdff6f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c6d('0x5')](function(_0x1ec65c){_0xdff6f[_0x8c6d('0x8')](_0x8c6d('0x9'),_0x1ec65c[_0x8c6d('0xa')]);WhatsappInteractionEvents[_0x8c6d('0xb')](_0x352b8c+':'+_0xdff6f['id'],_0xdff6f);WhatsappInteractionEvents[_0x8c6d('0xb')](_0x352b8c,_0xdff6f);_0x4f5e8f(null);})[_0x8c6d('0xc')](_0x4f5e8f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x8c6d('0xd')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2191f0f..54ed48c 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 _0x6dda=['exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x6dda,0x13b));var _0xa6dd=function(_0x1900df,_0x329ebf){_0x1900df=_0x1900df-0x0;var _0x416107=_0x6dda[_0x1900df];return _0x416107;};'use strict';var _=require(_0xa6dd('0x0'));var util=require('util');var logger=require(_0xa6dd('0x1'))(_0xa6dd('0x2'));var moment=require(_0xa6dd('0x3'));var BPromise=require(_0xa6dd('0x4'));var rp=require(_0xa6dd('0x5'));var fs=require('fs');var path=require(_0xa6dd('0x6'));var rimraf=require(_0xa6dd('0x7'));var config=require(_0xa6dd('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0xa6dd('0x9')]=function(_0x990de2,_0x1fd077){return _0x990de2[_0xa6dd('0xa')](_0xa6dd('0xb'),attributes,{'tableName':_0xa6dd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e84a9,_0x1e0813,_0x2e1d07){if(_0x2e84a9[_0xa6dd('0xd')](_0xa6dd('0xe'))){_0x2e84a9[_0xa6dd('0xf')]=moment()[_0xa6dd('0x10')](_0xa6dd('0x11'));}_0x2e1d07(null,_0x2e84a9);}}});}; \ No newline at end of file +var _0xe0e2=['../../config/logger','moment','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x206d65,_0x547606){var _0x43aac0=function(_0x28f506){while(--_0x28f506){_0x206d65['push'](_0x206d65['shift']());}};_0x43aac0(++_0x547606);}(_0xe0e2,0x197));var _0x2e0e=function(_0x30c133,_0x20e3bd){_0x30c133=_0x30c133-0x0;var _0x38a446=_0xe0e2[_0x30c133];return _0x38a446;};'use strict';var _=require('lodash');var util=require(_0x2e0e('0x0'));var logger=require(_0x2e0e('0x1'))('api');var moment=require(_0x2e0e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e0e('0x3'));var config=require('../../config/environment');var attributes=require(_0x2e0e('0x4'));module[_0x2e0e('0x5')]=function(_0x170902,_0x3723c1){return _0x170902[_0x2e0e('0x6')](_0x2e0e('0x7'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30d545,_0x4be999,_0x433173){if(_0x30d545[_0x2e0e('0x8')](_0x2e0e('0x9'))){_0x30d545[_0x2e0e('0xa')]=moment()['format'](_0x2e0e('0xb'));}_0x433173(null,_0x30d545);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 928886f..4582e68 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 _0xbe5a=['info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','find','ids','omit','spread','AddTags','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then'];(function(_0xd8768,_0x3fedcb){var _0x46228f=function(_0x65a836){while(--_0x65a836){_0xd8768['push'](_0xd8768['shift']());}};_0x46228f(++_0x3fedcb);}(_0xbe5a,0x1a8));var _0xabe5=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xbe5a[_0x35da42];return _0x370035;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xabe5('0x0'));var BPromise=require('bluebird');var rs=require(_0xabe5('0x1'));var fs=require('fs');var Redis=require(_0xabe5('0x2'));var db=require(_0xabe5('0x3'))['db'];var utils=require(_0xabe5('0x4'));var logger=require(_0xabe5('0x5'))(_0xabe5('0x6'));var config=require(_0xabe5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xabe5('0x8')]['http']({'port':0x232a});config[_0xabe5('0x9')]=_['defaults'](config[_0xabe5('0x9')],{'host':_0xabe5('0xa'),'port':0x18eb});var socket=require(_0xabe5('0xb'))(new Redis(config[_0xabe5('0x9')]));require(_0xabe5('0xc'))[_0xabe5('0xd')](socket);function respondWithRpcPromise(_0x49898d,_0x46c8ab,_0x41cc86){return new BPromise(function(_0x31aa5d,_0x4b560e){return client[_0xabe5('0xe')](_0x49898d,_0x41cc86)[_0xabe5('0xf')](function(_0x5c0ca8){logger[_0xabe5('0x10')](_0xabe5('0x11'),_0x46c8ab,_0xabe5('0x12'));logger[_0xabe5('0x13')](_0xabe5('0x14'),_0x46c8ab,'request\x20sent',JSON[_0xabe5('0x15')](_0x5c0ca8));if(_0x5c0ca8['error']){if(_0x5c0ca8['error'][_0xabe5('0x16')]===0x1f4){logger[_0xabe5('0x17')](_0xabe5('0x11'),_0x46c8ab,_0x5c0ca8['error'][_0xabe5('0x18')]);return _0x4b560e(_0x5c0ca8['error']['message']);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x46c8ab,_0x5c0ca8[_0xabe5('0x17')][_0xabe5('0x18')]);return _0x31aa5d(_0x5c0ca8[_0xabe5('0x17')][_0xabe5('0x18')]);}else{logger[_0xabe5('0x10')](_0xabe5('0x11'),_0x46c8ab,_0xabe5('0x12'));_0x31aa5d(_0x5c0ca8[_0xabe5('0x19')]['message']);}})['catch'](function(_0x5f598f){logger[_0xabe5('0x17')](_0xabe5('0x11'),_0x46c8ab,_0x5f598f);_0x4b560e(_0x5f598f);});});}exports[_0xabe5('0x1a')]=function(_0x3ba5c1){var _0x493e10=this;return new Promise(function(_0x4f4b51,_0x246d5a){return db[_0xabe5('0x1b')]['update'](_0x3ba5c1[_0xabe5('0x1c')],{'raw':_0x3ba5c1[_0xabe5('0x1d')]?_0x3ba5c1['options'][_0xabe5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ba5c1[_0xabe5('0x1d')]?_0x3ba5c1['options'][_0xabe5('0x1f')]||null:null,'attributes':_0x3ba5c1[_0xabe5('0x1d')]?_0x3ba5c1[_0xabe5('0x1d')][_0xabe5('0x20')]||null:null,'limit':_0x3ba5c1[_0xabe5('0x1d')]?_0x3ba5c1[_0xabe5('0x1d')][_0xabe5('0x21')]||null:null})[_0xabe5('0xf')](function(_0x753557){logger['info'](_0xabe5('0x1a'),_0x3ba5c1);logger[_0xabe5('0x13')]('UpdateWhatsappInteraction',_0x3ba5c1,JSON['stringify'](_0x753557));_0x4f4b51(_0x753557);})['catch'](function(_0x14b7e2){logger[_0xabe5('0x17')](_0xabe5('0x1a'),_0x14b7e2[_0xabe5('0x18')],_0x3ba5c1);_0x246d5a(_0x493e10['error'](0x1f4,_0x14b7e2[_0xabe5('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x241f18){return new Promise(function(_0x3c26f6,_0x2f56e4){return db['WhatsappInteraction'][_0xabe5('0x22')]({'where':_0x241f18[_0xabe5('0x1d')]?_0x241f18[_0xabe5('0x1d')][_0xabe5('0x1f')]||null:null})['then'](function(_0x542c2b){if(_0x542c2b){return _0x542c2b['addTags'](_0x241f18['body'][_0xabe5('0x23')],_[_0xabe5('0x24')](_0x241f18[_0xabe5('0x1c')],[_0xabe5('0x23'),'id'])||{});}})[_0xabe5('0x25')](function(_0x227c27){logger[_0xabe5('0x10')](_0xabe5('0x26'),_0x241f18);logger[_0xabe5('0x13')](_0xabe5('0x26'),_0x241f18,JSON['stringify'](_0x227c27));_0x3c26f6(_0x227c27);})[_0xabe5('0x27')](function(_0x476c38){logger[_0xabe5('0x17')](_0xabe5('0x26'),_0x476c38[_0xabe5('0x18')],_0x241f18);_0x2f56e4(_this[_0xabe5('0x17')](0x1f4,_0x476c38[_0xabe5('0x18')]));});});}; \ No newline at end of file +var _0x6fa7=['randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','attributes','AddTagsToWhatsappInteraction','find','where','addTags','omit','AddTags','lodash','util','moment','bluebird'];(function(_0x4579fc,_0x387af1){var _0x4a8bf1=function(_0x34e362){while(--_0x34e362){_0x4579fc['push'](_0x4579fc['shift']());}};_0x4a8bf1(++_0x387af1);}(_0x6fa7,0xe6));var _0x76fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fa7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76fa('0x0'));var util=require(_0x76fa('0x1'));var moment=require(_0x76fa('0x2'));var BPromise=require(_0x76fa('0x3'));var rs=require(_0x76fa('0x4'));var fs=require('fs');var Redis=require(_0x76fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x76fa('0x6'));var logger=require(_0x76fa('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76fa('0x8')][_0x76fa('0x9')]({'port':0x232a});config[_0x76fa('0xa')]=_[_0x76fa('0xb')](config[_0x76fa('0xa')],{'host':_0x76fa('0xc'),'port':0x18eb});var socket=require(_0x76fa('0xd'))(new Redis(config[_0x76fa('0xa')]));require(_0x76fa('0xe'))[_0x76fa('0xf')](socket);function respondWithRpcPromise(_0x5d1c87,_0x4f357b,_0x18ec74){return new BPromise(function(_0x23d476,_0x3f341b){return client[_0x76fa('0x10')](_0x5d1c87,_0x18ec74)[_0x76fa('0x11')](function(_0x13163b){logger[_0x76fa('0x12')](_0x76fa('0x13'),_0x4f357b,_0x76fa('0x14'));logger[_0x76fa('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4f357b,'request\x20sent',JSON[_0x76fa('0x16')](_0x13163b));if(_0x13163b[_0x76fa('0x17')]){if(_0x13163b[_0x76fa('0x17')][_0x76fa('0x18')]===0x1f4){logger['error'](_0x76fa('0x13'),_0x4f357b,_0x13163b[_0x76fa('0x17')][_0x76fa('0x19')]);return _0x3f341b(_0x13163b[_0x76fa('0x17')][_0x76fa('0x19')]);}logger[_0x76fa('0x17')](_0x76fa('0x13'),_0x4f357b,_0x13163b['error'][_0x76fa('0x19')]);return _0x23d476(_0x13163b[_0x76fa('0x17')]['message']);}else{logger[_0x76fa('0x12')](_0x76fa('0x13'),_0x4f357b,_0x76fa('0x14'));_0x23d476(_0x13163b['result'][_0x76fa('0x19')]);}})[_0x76fa('0x1a')](function(_0x3c58ca){logger[_0x76fa('0x17')](_0x76fa('0x13'),_0x4f357b,_0x3c58ca);_0x3f341b(_0x3c58ca);});});}exports[_0x76fa('0x1b')]=function(_0x652406){var _0x46fd17=this;return new Promise(function(_0x47e11b,_0x12719c){return db[_0x76fa('0x1c')][_0x76fa('0x1d')](_0x652406[_0x76fa('0x1e')],{'raw':_0x652406[_0x76fa('0x1f')]?_0x652406[_0x76fa('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x652406['options']?_0x652406['options']['where']||null:null,'attributes':_0x652406[_0x76fa('0x1f')]?_0x652406[_0x76fa('0x1f')][_0x76fa('0x20')]||null:null,'limit':_0x652406[_0x76fa('0x1f')]?_0x652406[_0x76fa('0x1f')]['limit']||null:null})[_0x76fa('0x11')](function(_0x301df1){logger[_0x76fa('0x12')](_0x76fa('0x1b'),_0x652406);logger[_0x76fa('0x15')]('UpdateWhatsappInteraction',_0x652406,JSON[_0x76fa('0x16')](_0x301df1));_0x47e11b(_0x301df1);})[_0x76fa('0x1a')](function(_0x116b41){logger['error']('UpdateWhatsappInteraction',_0x116b41['message'],_0x652406);_0x12719c(_0x46fd17['error'](0x1f4,_0x116b41[_0x76fa('0x19')]));});});};exports[_0x76fa('0x21')]=function(_0x407ef3){return new Promise(function(_0x30b84d,_0x2f854f){return db[_0x76fa('0x1c')][_0x76fa('0x22')]({'where':_0x407ef3[_0x76fa('0x1f')]?_0x407ef3[_0x76fa('0x1f')][_0x76fa('0x23')]||null:null})[_0x76fa('0x11')](function(_0x291629){if(_0x291629){return _0x291629[_0x76fa('0x24')](_0x407ef3[_0x76fa('0x1e')]['ids'],_[_0x76fa('0x25')](_0x407ef3['body'],['ids','id'])||{});}})['spread'](function(_0x34d79f){logger[_0x76fa('0x12')](_0x76fa('0x26'),_0x407ef3);logger[_0x76fa('0x15')](_0x76fa('0x26'),_0x407ef3,JSON[_0x76fa('0x16')](_0x34d79f));_0x30b84d(_0x34d79f);})['catch'](function(_0x527f3f){logger[_0x76fa('0x17')](_0x76fa('0x26'),_0x527f3f['message'],_0x407ef3);_0x2f854f(_this[_0x76fa('0x17')](0x1f4,_0x527f3f[_0x76fa('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b089c96..c53331b 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 _0x42f1=['register','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','removeListener'];(function(_0x4f1add,_0x13aae0){var _0x324504=function(_0xc2922f){while(--_0xc2922f){_0x4f1add['push'](_0x4f1add['shift']());}};_0x324504(++_0x13aae0);}(_0x42f1,0x1f3));var _0x142f=function(_0x5dd77b,_0x39a535){_0x5dd77b=_0x5dd77b-0x0;var _0xd7942f=_0x42f1[_0x5dd77b];return _0xd7942f;};'use strict';var WhatsappInteractionEvents=require(_0x142f('0x0'));var events=[_0x142f('0x1'),_0x142f('0x2'),_0x142f('0x3')];function createListener(_0x5911e5,_0x12d37c){return function(_0x3a79b3){_0x12d37c['emit'](_0x5911e5,_0x3a79b3);};}function removeListener(_0x5be9f3,_0x2f943e){return function(){WhatsappInteractionEvents[_0x142f('0x4')](_0x5be9f3,_0x2f943e);};}exports[_0x142f('0x5')]=function(_0xd53cfa){for(var _0x16f450=0x0,_0x50ee26=events['length'];_0x16f450<_0x50ee26;_0x16f450++){var _0x42fb0d=events[_0x16f450];var _0x206e2f=createListener(_0x142f('0x6')+_0x42fb0d,_0xd53cfa);WhatsappInteractionEvents['on'](_0x42fb0d,_0x206e2f);}}; \ No newline at end of file +var _0x8f30=['emit','removeListener','whatsappInteraction:','save','remove','update'];(function(_0x10cdea,_0x2facc0){var _0x46b383=function(_0x3ce52d){while(--_0x3ce52d){_0x10cdea['push'](_0x10cdea['shift']());}};_0x46b383(++_0x2facc0);}(_0x8f30,0x189));var _0x08f3=function(_0x50d21a,_0x1c252c){_0x50d21a=_0x50d21a-0x0;var _0xca50c7=_0x8f30[_0x50d21a];return _0xca50c7;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x08f3('0x0'),_0x08f3('0x1'),_0x08f3('0x2')];function createListener(_0x31f310,_0xd0cae2){return function(_0x5b10de){_0xd0cae2[_0x08f3('0x3')](_0x31f310,_0x5b10de);};}function removeListener(_0x5c42da,_0x239832){return function(){WhatsappInteractionEvents[_0x08f3('0x4')](_0x5c42da,_0x239832);};}exports['register']=function(_0xf9054e){for(var _0x43301e=0x0,_0xd43b1=events['length'];_0x43301e<_0xd43b1;_0x43301e++){var _0x2af205=events[_0x43301e];var _0x4dd5b3=createListener(_0x08f3('0x5')+_0x2af205,_0xf9054e);WhatsappInteractionEvents['on'](_0x2af205,_0x4dd5b3);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 518c495..483f58a 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 _0x7786=['status','put','/:id','/:id/accept','accept','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','show','post','whatsapp','whatsappmessage:create','/:id/status'];(function(_0x5767f9,_0x38ea6a){var _0x58c7b3=function(_0x4cbf57){while(--_0x4cbf57){_0x5767f9['push'](_0x5767f9['shift']());}};_0x58c7b3(++_0x38ea6a);}(_0x7786,0x14c));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6778('0x0'));var util=require(_0x6778('0x1'));var path=require(_0x6778('0x2'));var timeout=require(_0x6778('0x3'));var express=require(_0x6778('0x4'));var router=express['Router']();var fs_extra=require(_0x6778('0x5'));var auth=require(_0x6778('0x6'));var interaction=require(_0x6778('0x7'));var config=require(_0x6778('0x8'));var controller=require(_0x6778('0x9'));router[_0x6778('0xa')]('/',auth[_0x6778('0xb')](),controller[_0x6778('0xc')]);router['get']('/describe',auth[_0x6778('0xb')](),controller[_0x6778('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6778('0xe')]);router[_0x6778('0xf')]('/',auth[_0x6778('0xb')](),interaction['tracked'](_0x6778('0x10'),_0x6778('0x11')),controller['create']);router[_0x6778('0xf')](_0x6778('0x12'),controller[_0x6778('0x13')]);router[_0x6778('0x14')](_0x6778('0x15'),auth[_0x6778('0xb')](),controller['update']);router[_0x6778('0x14')](_0x6778('0x16'),auth['isAuthenticated'](),controller[_0x6778('0x17')]);router[_0x6778('0x14')]('/:id/reject',auth[_0x6778('0xb')](),controller[_0x6778('0x18')]);router[_0x6778('0x19')](_0x6778('0x15'),auth[_0x6778('0xb')](),controller[_0x6778('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xadc9=['/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xadc9,0x14a));var _0x9adc=function(_0x9264dc,_0x3432ac){_0x9264dc=_0x9264dc-0x0;var _0x4ac434=_0xadc9[_0x9264dc];return _0x4ac434;};'use strict';var multer=require(_0x9adc('0x0'));var util=require(_0x9adc('0x1'));var path=require(_0x9adc('0x2'));var timeout=require(_0x9adc('0x3'));var express=require(_0x9adc('0x4'));var router=express[_0x9adc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9adc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9adc('0x7'));router[_0x9adc('0x8')]('/',auth[_0x9adc('0x9')](),controller[_0x9adc('0xa')]);router[_0x9adc('0x8')](_0x9adc('0xb'),auth[_0x9adc('0x9')](),controller[_0x9adc('0xc')]);router[_0x9adc('0x8')]('/:id',auth[_0x9adc('0x9')](),controller['show']);router[_0x9adc('0xd')]('/',auth[_0x9adc('0x9')](),interaction['tracked'](_0x9adc('0xe'),_0x9adc('0xf')),controller[_0x9adc('0x10')]);router['post'](_0x9adc('0x11'),controller[_0x9adc('0x12')]);router[_0x9adc('0x13')](_0x9adc('0x14'),auth['isAuthenticated'](),controller['update']);router['put'](_0x9adc('0x15'),auth[_0x9adc('0x9')](),controller[_0x9adc('0x16')]);router[_0x9adc('0x13')](_0x9adc('0x17'),auth['isAuthenticated'](),controller[_0x9adc('0x18')]);router['delete']('/:id',auth[_0x9adc('0x9')](),controller[_0x9adc('0x19')]);module[_0x9adc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index ea2a5e3..cb1446b 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 _0xc254=['out','STRING','DATE','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc254,0x1ed));var _0x4c25=function(_0x2bbd2d,_0x37c3c4){_0x2bbd2d=_0x2bbd2d-0x0;var _0x257dc9=_0xc254[_0x2bbd2d];return _0x257dc9;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x4c25('0x0')](_0x4c25('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x4c25('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4c25('0x3')]('in',_0x4c25('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x4c25('0x5')]},'readAt':{'type':Sequelize[_0x4c25('0x6')]},'secret':{'type':Sequelize[_0x4c25('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4c25('0x5')]},'providerResponse':{'type':Sequelize[_0x4c25('0x0')]}}; \ No newline at end of file +var _0x3649=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4ad30c,_0x34f4d3){var _0x15d68e=function(_0x265ac6){while(--_0x265ac6){_0x4ad30c['push'](_0x4ad30c['shift']());}};_0x15d68e(++_0x34f4d3);}(_0x3649,0x1d1));var _0x9364=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3649[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x9364('0x0'));module[_0x9364('0x1')]={'body':{'type':Sequelize[_0x9364('0x2')](_0x9364('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9364('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9364('0x5')]('in',_0x9364('0x6')),'defaultValue':_0x9364('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9364('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9364('0x7')]},'providerResponse':{'type':Sequelize[_0x9364('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index af70578..2159304 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 _0x221d=['WhatsappMessage','includeAll','findAll','catch','show','keys','find','create','body','params','destroy','describe','whatsapp-interactions','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteractionId','isNil','read1stAt','format','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','fullname','event','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','options'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x221d,0x14a));var _0xd221=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x221d[_0xd13a88];return _0x1c993c;};'use strict';var emlformat=require(_0xd221('0x0'));var rimraf=require(_0xd221('0x1'));var zipdir=require(_0xd221('0x2'));var jsonpatch=require(_0xd221('0x3'));var rp=require(_0xd221('0x4'));var moment=require(_0xd221('0x5'));var BPromise=require(_0xd221('0x6'));var Mustache=require(_0xd221('0x7'));var util=require('util');var path=require(_0xd221('0x8'));var sox=require(_0xd221('0x9'));var csv=require(_0xd221('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd221('0xb'));var _=require(_0xd221('0xc'));var squel=require(_0xd221('0xd'));var crypto=require(_0xd221('0xe'));var jsforce=require(_0xd221('0xf'));var deskjs=require(_0xd221('0x10'));var toCsv=require(_0xd221('0xa'));var querystring=require(_0xd221('0x11'));var Papa=require(_0xd221('0x12'));var Redis=require(_0xd221('0x13'));var authService=require(_0xd221('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd221('0x15'))(_0xd221('0x16'));var utils=require('../../config/utils');var config=require(_0xd221('0x17'));var licenseUtil=require(_0xd221('0x18'));var db=require(_0xd221('0x19'))['db'];config[_0xd221('0x1a')]=_[_0xd221('0x1b')](config[_0xd221('0x1a')],{'host':_0xd221('0x1c'),'port':0x18eb});var socket=require(_0xd221('0x1d'))(new Redis(config[_0xd221('0x1a')]));require('./whatsappMessage.socket')[_0xd221('0x1e')](socket);var jayson=require(_0xd221('0x1f'));var client=jayson['client'][_0xd221('0x20')]({'port':0x232c});var client9002=jayson[_0xd221('0x21')][_0xd221('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4c3bb8,_0x14ccc9,_0x4fc1fb,_0x4e57f6){return new BPromise(function(_0x58d1b9,_0x1f8c85){var _0x2e7ac3=_0x4e57f6||client;return _0x2e7ac3[_0xd221('0x22')](_0x4c3bb8,_0x4fc1fb)[_0xd221('0x23')](function(_0xca11c1){logger[_0xd221('0x24')](_0xd221('0x25'),_0x14ccc9,_0xd221('0x26'));logger[_0xd221('0x27')](_0xd221('0x28'),_0x14ccc9,'request\x20sent',JSON[_0xd221('0x29')](_0xca11c1));if(_0xca11c1[_0xd221('0x2a')]){if(_0xca11c1[_0xd221('0x2a')][_0xd221('0x2b')]===0x1f4){logger['error'](_0xd221('0x25'),_0x14ccc9,_0xca11c1[_0xd221('0x2a')]['message']);return _0x1f8c85(_0xca11c1[_0xd221('0x2a')]['message']);}logger[_0xd221('0x2a')](_0xd221('0x25'),_0x14ccc9,_0xca11c1[_0xd221('0x2a')]['message']);return _0x58d1b9(_0xca11c1[_0xd221('0x2a')][_0xd221('0x2c')]);}else{logger[_0xd221('0x24')](_0xd221('0x25'),_0x14ccc9,_0xd221('0x26'));_0x58d1b9(_0xca11c1[_0xd221('0x2d')]['message']);}})['catch'](function(_0x2859a9){logger[_0xd221('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x14ccc9,_0x2859a9);_0x1f8c85(_0x2859a9);});});}function respondWithStatusCode(_0x2f32e6,_0x123459){_0x123459=_0x123459||0xcc;return function(_0x21fe33){if(_0x21fe33){return _0x2f32e6[_0xd221('0x2e')](_0x123459);}return _0x2f32e6[_0xd221('0x2f')](_0x123459)[_0xd221('0x30')]();};}function respondWithResult(_0x5a5be5,_0x301cf6){_0x301cf6=_0x301cf6||0xc8;return function(_0xaa0746){if(_0xaa0746){return _0x5a5be5[_0xd221('0x2f')](_0x301cf6)[_0xd221('0x31')](_0xaa0746);}};}function respondWithFilteredResult(_0x45b3e1,_0x33ccd9){return function(_0x31cc8c){if(_0x31cc8c){var _0x434f72=typeof _0x33ccd9['offset']===_0xd221('0x32')&&typeof _0x33ccd9['limit']===_0xd221('0x32');var _0x473638=_0x31cc8c[_0xd221('0x33')];var _0x2ba458=_0x434f72?0x0:_0x33ccd9[_0xd221('0x34')];var _0x12ac2d=_0x434f72?_0x31cc8c[_0xd221('0x33')]:_0x33ccd9[_0xd221('0x34')]+_0x33ccd9[_0xd221('0x35')];var _0x743329;if(_0x12ac2d>=_0x473638){_0x12ac2d=_0x473638;_0x743329=0xc8;}else{_0x743329=0xce;}_0x45b3e1[_0xd221('0x2f')](_0x743329);return _0x45b3e1[_0xd221('0x36')](_0xd221('0x37'),_0x2ba458+'-'+_0x12ac2d+'/'+_0x473638)[_0xd221('0x31')](_0x31cc8c);}return null;};}function patchUpdates(_0x4a3012){return function(_0x21f674){try{jsonpatch[_0xd221('0x38')](_0x21f674,_0x4a3012,!![]);}catch(_0x2f1190){return BPromise[_0xd221('0x39')](_0x2f1190);}return _0x21f674['save']();};}function saveUpdates(_0x4983a6,_0xeeef8e){return function(_0x1ca438){if(_0x1ca438){return _0x1ca438[_0xd221('0x3a')](_0x4983a6)['then'](function(_0x178710){return _0x178710;});}return null;};}function removeEntity(_0x6436fc,_0x3d84b7){return function(_0x240f1f){if(_0x240f1f){return _0x240f1f['destroy']()['then'](function(){_0x6436fc[_0xd221('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29a2d5,_0x1a4855){return function(_0x4179a3){if(!_0x4179a3){_0x29a2d5[_0xd221('0x2e')](0x194);}return _0x4179a3;};}function handleError(_0x4db07b,_0x325f5c){_0x325f5c=_0x325f5c||0x1f4;return function(_0x194166){logger['error'](_0x194166['stack']);if(_0x194166[_0xd221('0x3b')]){delete _0x194166[_0xd221('0x3b')];}_0x4db07b[_0xd221('0x2f')](_0x325f5c)[_0xd221('0x3c')](_0x194166);};}exports[_0xd221('0x3d')]=function(_0x24d898,_0x4ef0b2){var _0x5854c9={},_0x55db25={},_0x1ffdf7={'count':0x0,'rows':[]};var _0x442057=_['map'](db['WhatsappMessage'][_0xd221('0x3e')],function(_0x56ddcd){return{'name':_0x56ddcd[_0xd221('0x3f')],'type':_0x56ddcd[_0xd221('0x40')][_0xd221('0x41')]};});_0x55db25[_0xd221('0x42')]=_[_0xd221('0x43')](_0x442057,'name');_0x55db25[_0xd221('0x44')]=_['keys'](_0x24d898[_0xd221('0x44')]);_0x55db25[_0xd221('0x45')]=_[_0xd221('0x46')](_0x55db25[_0xd221('0x42')],_0x55db25[_0xd221('0x44')]);_0x5854c9[_0xd221('0x47')]=_[_0xd221('0x46')](_0x55db25[_0xd221('0x42')],qs[_0xd221('0x48')](_0x24d898[_0xd221('0x44')][_0xd221('0x48')]));_0x5854c9[_0xd221('0x47')]=_0x5854c9[_0xd221('0x47')][_0xd221('0x49')]?_0x5854c9[_0xd221('0x47')]:_0x55db25['model'];if(!_0x24d898[_0xd221('0x44')]['hasOwnProperty'](_0xd221('0x4a'))){_0x5854c9[_0xd221('0x35')]=qs[_0xd221('0x35')](_0x24d898['query'][_0xd221('0x35')]);_0x5854c9['offset']=qs['offset'](_0x24d898[_0xd221('0x44')][_0xd221('0x34')]);}_0x5854c9[_0xd221('0x4b')]=qs['sort'](_0x24d898[_0xd221('0x44')][_0xd221('0x4c')]);_0x5854c9[_0xd221('0x4d')]=qs[_0xd221('0x45')](_[_0xd221('0x4e')](_0x24d898[_0xd221('0x44')],_0x55db25[_0xd221('0x45')]),_0x442057);if(_0x24d898['query'][_0xd221('0x4f')]){_0x5854c9[_0xd221('0x4d')]=_['merge'](_0x5854c9[_0xd221('0x4d')],{'$or':_[_0xd221('0x43')](_0x442057,function(_0x362cef){if(_0x362cef[_0xd221('0x40')]!=='VIRTUAL'){var _0x5d0a8b={};_0x5d0a8b[_0x362cef[_0xd221('0x3b')]]={'$like':'%'+_0x24d898[_0xd221('0x44')]['filter']+'%'};return _0x5d0a8b;}})});}_0x5854c9=_['merge']({},_0x5854c9,_0x24d898[_0xd221('0x50')]);var _0x4f21b8={'where':_0x5854c9[_0xd221('0x4d')]};return db[_0xd221('0x51')][_0xd221('0x33')](_0x4f21b8)[_0xd221('0x23')](function(_0x110ccb){_0x1ffdf7[_0xd221('0x33')]=_0x110ccb;if(_0x24d898['query'][_0xd221('0x52')]){_0x5854c9['include']=[{'all':!![]}];}return db[_0xd221('0x51')][_0xd221('0x53')](_0x5854c9);})['then'](function(_0x2a7d2c){_0x1ffdf7['rows']=_0x2a7d2c;return _0x1ffdf7;})[_0xd221('0x23')](respondWithFilteredResult(_0x4ef0b2,_0x5854c9))[_0xd221('0x54')](handleError(_0x4ef0b2,null));};exports[_0xd221('0x55')]=function(_0x10b367,_0x1f4f3a){var _0x38745a={'raw':!![],'where':{'id':_0x10b367['params']['id']}},_0x5cc861={};_0x5cc861[_0xd221('0x42')]=_[_0xd221('0x56')](db[_0xd221('0x51')]['rawAttributes']);_0x5cc861[_0xd221('0x44')]=_['keys'](_0x10b367[_0xd221('0x44')]);_0x5cc861['filters']=_['intersection'](_0x5cc861['model'],_0x5cc861['query']);_0x38745a['attributes']=_[_0xd221('0x46')](_0x5cc861[_0xd221('0x42')],qs[_0xd221('0x48')](_0x10b367[_0xd221('0x44')][_0xd221('0x48')]));_0x38745a[_0xd221('0x47')]=_0x38745a[_0xd221('0x47')][_0xd221('0x49')]?_0x38745a[_0xd221('0x47')]:_0x5cc861['model'];if(_0x10b367[_0xd221('0x44')][_0xd221('0x52')]){_0x38745a['include']=[{'all':!![]}];}_0x38745a=_['merge']({},_0x38745a,_0x10b367['options']);return db[_0xd221('0x51')][_0xd221('0x57')](_0x38745a)[_0xd221('0x23')](handleEntityNotFound(_0x1f4f3a,null))[_0xd221('0x23')](respondWithResult(_0x1f4f3a,null))['catch'](handleError(_0x1f4f3a,null));};exports[_0xd221('0x58')]=function(_0x471be1,_0x3b191d){return db[_0xd221('0x51')][_0xd221('0x58')](_0x471be1['body'],{})[_0xd221('0x23')](respondWithResult(_0x3b191d,0xc9))[_0xd221('0x54')](handleError(_0x3b191d,null));};exports[_0xd221('0x3a')]=function(_0x1f9010,_0x5375fa){if(_0x1f9010['body']['id']){delete _0x1f9010[_0xd221('0x59')]['id'];}return db[_0xd221('0x51')][_0xd221('0x57')]({'where':{'id':_0x1f9010[_0xd221('0x5a')]['id']}})[_0xd221('0x23')](handleEntityNotFound(_0x5375fa,null))[_0xd221('0x23')](saveUpdates(_0x1f9010[_0xd221('0x59')],null))[_0xd221('0x23')](respondWithResult(_0x5375fa,null))[_0xd221('0x54')](handleError(_0x5375fa,null));};exports[_0xd221('0x5b')]=function(_0x51b46f,_0x2a1259){return db[_0xd221('0x51')][_0xd221('0x57')]({'where':{'id':_0x51b46f[_0xd221('0x5a')]['id']}})[_0xd221('0x23')](handleEntityNotFound(_0x2a1259,null))[_0xd221('0x23')](removeEntity(_0x2a1259,null))['catch'](handleError(_0x2a1259,null));};exports[_0xd221('0x5c')]=function(_0x185747,_0x1b9c02){return db[_0xd221('0x51')][_0xd221('0x5c')]()[_0xd221('0x23')](respondWithResult(_0x1b9c02,null))[_0xd221('0x54')](handleError(_0x1b9c02,null));};var interaction_log=require('../../config/logger')(_0xd221('0x5d'));exports[_0xd221('0x5e')]=function(_0x3505ec,_0x4af300,_0x4697b6){var _0x25fe88={'agent':{},'channel':_0xd221('0x5f')};if(_0x3505ec[_0xd221('0x59')]['id']){delete _0x3505ec[_0xd221('0x59')]['id'];}_0x3505ec[_0xd221('0x59')][_0xd221('0x60')]=!![];_0x3505ec[_0xd221('0x59')]['readAt']=moment()['format'](_0xd221('0x61'));_0x3505ec[_0xd221('0x59')][_0xd221('0x62')]=_0x3505ec['body'][_0xd221('0x62')]||_0x3505ec['user']['id'];_0x25fe88[_0xd221('0x63')]['id']=_0x3505ec['body'][_0xd221('0x62')];return db[_0xd221('0x51')][_0xd221('0x57')]({'where':{'id':_0x3505ec[_0xd221('0x5a')]['id'],'UserId':null}})[_0xd221('0x23')](handleEntityNotFound(_0x4af300,null))[_0xd221('0x23')](saveUpdates(_0x3505ec[_0xd221('0x59')],null))[_0xd221('0x23')](function(_0x4dba4e){if(_0x4dba4e){_0x25fe88[_0xd221('0x2c')]=_0x4dba4e['get']({'plain':!![]});return db['WhatsappInteraction'][_0xd221('0x57')]({'where':{'id':_0x4dba4e[_0xd221('0x64')]}});}return null;})[_0xd221('0x23')](handleEntityNotFound(_0x4af300,null))[_0xd221('0x23')](function(_0x1c3f5c){if(_0x1c3f5c){return _0x1c3f5c['update']({'UserId':_0x3505ec[_0xd221('0x59')][_0xd221('0x62')],'read1stAt':_[_0xd221('0x65')](_0x1c3f5c[_0xd221('0x66')])?moment()[_0xd221('0x67')](_0xd221('0x61')):undefined});}return null;})[_0xd221('0x23')](function(_0x9e6387){if(_0x9e6387){_0x25fe88[_0xd221('0x68')]=_0x9e6387[_0xd221('0x69')]({'plain':!![]});interaction_log[_0xd221('0x24')](_0xd221('0x6a'),_0x3505ec[_0xd221('0x6b')]['id'],_0x3505ec['user'][_0xd221('0x3b')],_0x3505ec[_0xd221('0x6b')][_0xd221('0x6c')],_0x25fe88[_0xd221('0x68')]['id'],_0x3505ec['body']?JSON[_0xd221('0x29')](_0x3505ec['body']):_0xd221('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x25fe88);}return null;})['then'](function(_0x512016){var _0x2339de=_0xd221('0x6e')+_0x512016[_0xd221('0x2c')]['ContactId'];return db[_0xd221('0x6f')][_0xd221('0x44')](_0x2339de,{'type':db['Sequelize'][_0xd221('0x70')][_0xd221('0x71')],'raw':!![]})[_0xd221('0x23')](function(_0x2a62a3){return _0x2a62a3;});})[_0xd221('0x23')](function(_0x1fafca){if(_0x1fafca){_0x25fe88['message'][_0xd221('0x72')]=_0x1fafca[0x0];if(!_0x3505ec[_0xd221('0x59')]['UserId'])return;return db[_0xd221('0x73')][_0xd221('0x57')]({'where':{'id':_0x3505ec[_0xd221('0x59')][_0xd221('0x62')],'role':_0xd221('0x63')},'attributes':['id',_0xd221('0x3b'),'fullname',_0xd221('0x74'),_0xd221('0x75')],'raw':!![]});}return null;})['then'](function(_0x32cf5c){if(!_0x32cf5c)return null;_0x25fe88[_0xd221('0x2c')][_0xd221('0x63')]=_0x32cf5c;return _0x25fe88;})[_0xd221('0x23')](function(_0x18ae87){if(_0x18ae87){if(_0x3505ec[_0xd221('0x59')][_0xd221('0x76')]){_0x25fe88[_0xd221('0x2c')]['interface']=util['format'](_0xd221('0x77'),_0x3505ec[_0xd221('0x6b')][_0xd221('0x3b')]);_0x25fe88['message'][_0xd221('0x78')]=_0x25fe88[_0xd221('0x78')];_0x25fe88['message'][_0xd221('0x79')]=_0x25fe88['channel'];_0x25fe88[_0xd221('0x2c')]['event']='accept';return respondWithRpcPromise(_0xd221('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x25fe88[_0xd221('0x2c')]},client9002)[_0xd221('0x23')](function(){return _0x25fe88;});}return _0x25fe88;}return null;})['then'](respondWithResult(_0x4af300,null))[_0xd221('0x54')](handleError(_0x4af300,null));};var interaction_log=require(_0xd221('0x15'))(_0xd221('0x5d'));exports['reject']=function(_0x5c9c9c,_0x39d842,_0x571998){var _0x1a97e2={'agent':{},'channel':_0xd221('0x5f')};if(_0x5c9c9c[_0xd221('0x59')]['id']){delete _0x5c9c9c[_0xd221('0x59')]['id'];}_0x5c9c9c[_0xd221('0x59')][_0xd221('0x62')]=_0x5c9c9c[_0xd221('0x59')][_0xd221('0x62')]||_0x5c9c9c[_0xd221('0x6b')]['id'];_0x1a97e2[_0xd221('0x63')]['id']=_0x5c9c9c[_0xd221('0x59')][_0xd221('0x62')];return db[_0xd221('0x51')][_0xd221('0x57')]({'where':{'id':_0x5c9c9c[_0xd221('0x5a')]['id'],'UserId':null}})[_0xd221('0x23')](handleEntityNotFound(_0x39d842,null))[_0xd221('0x23')](function(_0x275b30){if(_0x275b30){_0x1a97e2[_0xd221('0x2c')]=_0x275b30[_0xd221('0x69')]({'plain':!![]});return db[_0xd221('0x7b')][_0xd221('0x57')]({'where':{'id':_0x275b30[_0xd221('0x64')]}});}return null;})[_0xd221('0x23')](handleEntityNotFound(_0x39d842,null))['then'](function(_0x3aefa0){if(_0x3aefa0){_0x1a97e2[_0xd221('0x68')]=_0x3aefa0[_0xd221('0x69')]({'plain':!![]});interaction_log['info'](_0xd221('0x7c'),_0x5c9c9c[_0xd221('0x6b')]['id'],_0x5c9c9c[_0xd221('0x6b')][_0xd221('0x3b')],_0x5c9c9c['user'][_0xd221('0x6c')],_0x1a97e2[_0xd221('0x68')]['id'],_0x5c9c9c['body']?JSON[_0xd221('0x29')](_0x5c9c9c[_0xd221('0x59')]):_0xd221('0x6d'));return respondWithRpcPromise(_0xd221('0x7d'),'rejectMessage',_0x1a97e2);}return null;})[_0xd221('0x23')](function(_0x4b5bba){var _0x56e973=_0xd221('0x6e')+_0x4b5bba[_0xd221('0x2c')][_0xd221('0x7e')];return db[_0xd221('0x6f')][_0xd221('0x44')](_0x56e973,{'type':db['Sequelize'][_0xd221('0x70')]['SELECT'],'raw':!![]})[_0xd221('0x23')](function(_0x28e6bf){return _0x28e6bf;});})['then'](function(_0x5d238f){if(_0x5d238f){_0x1a97e2['message'][_0xd221('0x72')]=_0x5d238f[0x0];if(!_0x5c9c9c[_0xd221('0x59')][_0xd221('0x62')])return;return db['User'][_0xd221('0x57')]({'where':{'id':_0x5c9c9c[_0xd221('0x59')][_0xd221('0x62')],'role':'agent'},'attributes':['id',_0xd221('0x3b'),_0xd221('0x7f'),_0xd221('0x74'),'internal'],'raw':!![]});}return null;})[_0xd221('0x23')](function(_0x182d42){if(!_0x182d42)return null;_0x1a97e2[_0xd221('0x2c')][_0xd221('0x63')]=_0x182d42;return _0x1a97e2;})['then'](function(_0x26b630){if(_0x26b630){_0x26b630[_0xd221('0x2c')]['interface']=util[_0xd221('0x67')](_0xd221('0x77'),_0x5c9c9c[_0xd221('0x6b')][_0xd221('0x3b')]);_0x26b630[_0xd221('0x2c')][_0xd221('0x78')]=_0x1a97e2[_0xd221('0x78')];_0x26b630[_0xd221('0x2c')][_0xd221('0x79')]=_0x1a97e2[_0xd221('0x78')];_0x26b630[_0xd221('0x2c')][_0xd221('0x80')]='reject';respondWithRpcPromise(_0xd221('0x7a'),_0xd221('0x7a'),{'event':'rejectmessage','message':_0x26b630[_0xd221('0x2c')]},client9002);return _0x1a97e2;}return null;})[_0xd221('0x23')](respondWithResult(_0x39d842,null))[_0xd221('0x54')](handleError(_0x39d842,null));};exports[_0xd221('0x2f')]=function(_0x430ce8,_0x2abeab,_0xe09c9e){if(_0x430ce8[_0xd221('0x59')]['id']){delete _0x430ce8[_0xd221('0x59')]['id'];}var _0x198919;return db[_0xd221('0x51')][_0xd221('0x57')]({'where':{'id':_0x430ce8[_0xd221('0x5a')]['id']}})[_0xd221('0x23')](handleEntityNotFound(_0x2abeab,null))[_0xd221('0x23')](function(_0x15650a){if(_0x15650a){_0x198919=_0x15650a;return db[_0xd221('0x81')]['find']({'where':{'id':_0x15650a[_0xd221('0x82')]}});}})[_0xd221('0x23')](handleEntityNotFound(_0x2abeab,null))[_0xd221('0x23')](function(_0x793aa2){if(_0x793aa2){logger['debug'](_0xd221('0x83'),_0xd221('0x2f'),_0xd221('0x84'),_0x793aa2[_0xd221('0x40')],util['inspect'](_0x430ce8[_0xd221('0x59')],{'showHidden':![],'depth':null}));switch(_0x793aa2[_0xd221('0x40')]){case _0xd221('0x85'):if(_0x430ce8[_0xd221('0x59')][_0xd221('0x86')]&&_0x430ce8['body'][_0xd221('0x86')]===_0x198919['messageId']&&_0x430ce8['body'][_0xd221('0x87')]&&_0x430ce8[_0xd221('0x59')][_0xd221('0x87')]===_0xd221('0x60')){return _0x198919[_0xd221('0x3a')]({'read':!![]});}else{logger[_0xd221('0x2a')](_0xd221('0x88'),'status',_0xd221('0x85'),util['inspect'](_0x430ce8[_0xd221('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x198919;}})['then'](respondWithResult(_0x2abeab,null))[_0xd221('0x54')](handleError(_0x2abeab,null));}; \ No newline at end of file +var _0x4907=['defaults','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','WhatsappMessage','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','ContactId','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis'];(function(_0x22ce71,_0x228464){var _0xcd9503=function(_0x1aa6e2){while(--_0x1aa6e2){_0x22ce71['push'](_0x22ce71['shift']());}};_0xcd9503(++_0x228464);}(_0x4907,0x191));var _0x7490=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4907[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7490('0x0'));var rimraf=require(_0x7490('0x1'));var zipdir=require(_0x7490('0x2'));var jsonpatch=require(_0x7490('0x3'));var rp=require('request-promise');var moment=require(_0x7490('0x4'));var BPromise=require(_0x7490('0x5'));var Mustache=require(_0x7490('0x6'));var util=require(_0x7490('0x7'));var path=require('path');var sox=require(_0x7490('0x8'));var csv=require(_0x7490('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7490('0xa'));var crypto=require(_0x7490('0xb'));var jsforce=require(_0x7490('0xc'));var deskjs=require(_0x7490('0xd'));var toCsv=require(_0x7490('0x9'));var querystring=require(_0x7490('0xe'));var Papa=require(_0x7490('0xf'));var Redis=require(_0x7490('0x10'));var authService=require(_0x7490('0x11'));var qs=require(_0x7490('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7490('0x13'));var logger=require(_0x7490('0x14'))(_0x7490('0x15'));var utils=require('../../config/utils');var config=require(_0x7490('0x16'));var licenseUtil=require(_0x7490('0x17'));var db=require('../../mysqldb')['db'];config[_0x7490('0x18')]=_[_0x7490('0x19')](config[_0x7490('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7490('0x18')]));require(_0x7490('0x1a'))[_0x7490('0x1b')](socket);var jayson=require(_0x7490('0x1c'));var client=jayson[_0x7490('0x1d')][_0x7490('0x1e')]({'port':0x232c});var client9002=jayson[_0x7490('0x1d')][_0x7490('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x307b1c,_0x1edba8,_0x365ccf,_0x5936f3){return new BPromise(function(_0x5c5c3f,_0xc6de42){var _0x41bb9a=_0x5936f3||client;return _0x41bb9a[_0x7490('0x1f')](_0x307b1c,_0x365ccf)[_0x7490('0x20')](function(_0xc8c288){logger[_0x7490('0x21')](_0x7490('0x22'),_0x1edba8,'request\x20sent');logger['debug'](_0x7490('0x23'),_0x1edba8,_0x7490('0x24'),JSON[_0x7490('0x25')](_0xc8c288));if(_0xc8c288[_0x7490('0x26')]){if(_0xc8c288['error'][_0x7490('0x27')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1edba8,_0xc8c288[_0x7490('0x26')][_0x7490('0x28')]);return _0xc6de42(_0xc8c288['error'][_0x7490('0x28')]);}logger['error'](_0x7490('0x22'),_0x1edba8,_0xc8c288['error'][_0x7490('0x28')]);return _0x5c5c3f(_0xc8c288['error'][_0x7490('0x28')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1edba8,'request\x20sent');_0x5c5c3f(_0xc8c288['result'][_0x7490('0x28')]);}})[_0x7490('0x29')](function(_0x15383d){logger[_0x7490('0x26')](_0x7490('0x22'),_0x1edba8,_0x15383d);_0xc6de42(_0x15383d);});});}function respondWithStatusCode(_0x96cb9f,_0x533741){_0x533741=_0x533741||0xcc;return function(_0x2cc64c){if(_0x2cc64c){return _0x96cb9f[_0x7490('0x2a')](_0x533741);}return _0x96cb9f['status'](_0x533741)['end']();};}function respondWithResult(_0x461049,_0x100f8c){_0x100f8c=_0x100f8c||0xc8;return function(_0x4c8d87){if(_0x4c8d87){return _0x461049[_0x7490('0x2b')](_0x100f8c)[_0x7490('0x2c')](_0x4c8d87);}};}function respondWithFilteredResult(_0x578d1b,_0x592259){return function(_0x460bba){if(_0x460bba){var _0x1c79cd=typeof _0x592259[_0x7490('0x2d')]===_0x7490('0x2e')&&typeof _0x592259[_0x7490('0x2f')]===_0x7490('0x2e');var _0x322b83=_0x460bba[_0x7490('0x30')];var _0x39a47d=_0x1c79cd?0x0:_0x592259[_0x7490('0x2d')];var _0x14103e=_0x1c79cd?_0x460bba['count']:_0x592259[_0x7490('0x2d')]+_0x592259[_0x7490('0x2f')];var _0x2b82d2;if(_0x14103e>=_0x322b83){_0x14103e=_0x322b83;_0x2b82d2=0xc8;}else{_0x2b82d2=0xce;}_0x578d1b['status'](_0x2b82d2);return _0x578d1b[_0x7490('0x31')](_0x7490('0x32'),_0x39a47d+'-'+_0x14103e+'/'+_0x322b83)['json'](_0x460bba);}return null;};}function patchUpdates(_0x265be5){return function(_0x83735f){try{jsonpatch[_0x7490('0x33')](_0x83735f,_0x265be5,!![]);}catch(_0x4cbe1d){return BPromise[_0x7490('0x34')](_0x4cbe1d);}return _0x83735f['save']();};}function saveUpdates(_0x254d37,_0x23ab66){return function(_0x4fccd2){if(_0x4fccd2){return _0x4fccd2[_0x7490('0x35')](_0x254d37)[_0x7490('0x20')](function(_0x91d4ad){return _0x91d4ad;});}return null;};}function removeEntity(_0xaf3f32,_0x3a615a){return function(_0x156a40){if(_0x156a40){return _0x156a40[_0x7490('0x36')]()['then'](function(){_0xaf3f32[_0x7490('0x2b')](0xcc)[_0x7490('0x37')]();});}};}function handleEntityNotFound(_0x5eb6cb,_0x425e95){return function(_0x25e44f){if(!_0x25e44f){_0x5eb6cb[_0x7490('0x2a')](0x194);}return _0x25e44f;};}function handleError(_0x55b4a4,_0x36fd4e){_0x36fd4e=_0x36fd4e||0x1f4;return function(_0x428b1c){logger['error'](_0x428b1c[_0x7490('0x38')]);if(_0x428b1c[_0x7490('0x39')]){delete _0x428b1c[_0x7490('0x39')];}_0x55b4a4[_0x7490('0x2b')](_0x36fd4e)[_0x7490('0x3a')](_0x428b1c);};}exports[_0x7490('0x3b')]=function(_0x2d836c,_0x108115){var _0x5483d7={},_0x2e4733={},_0x3b1398={'count':0x0,'rows':[]};var _0x176abd=_[_0x7490('0x3c')](db[_0x7490('0x3d')]['rawAttributes'],function(_0x4fd850){return{'name':_0x4fd850['fieldName'],'type':_0x4fd850['type'][_0x7490('0x3e')]};});_0x2e4733[_0x7490('0x3f')]=_['map'](_0x176abd,_0x7490('0x39'));_0x2e4733[_0x7490('0x40')]=_[_0x7490('0x41')](_0x2d836c[_0x7490('0x40')]);_0x2e4733[_0x7490('0x42')]=_['intersection'](_0x2e4733[_0x7490('0x3f')],_0x2e4733[_0x7490('0x40')]);_0x5483d7[_0x7490('0x43')]=_[_0x7490('0x44')](_0x2e4733[_0x7490('0x3f')],qs[_0x7490('0x45')](_0x2d836c[_0x7490('0x40')][_0x7490('0x45')]));_0x5483d7[_0x7490('0x43')]=_0x5483d7[_0x7490('0x43')][_0x7490('0x46')]?_0x5483d7[_0x7490('0x43')]:_0x2e4733[_0x7490('0x3f')];if(!_0x2d836c['query'][_0x7490('0x47')](_0x7490('0x48'))){_0x5483d7[_0x7490('0x2f')]=qs[_0x7490('0x2f')](_0x2d836c[_0x7490('0x40')][_0x7490('0x2f')]);_0x5483d7[_0x7490('0x2d')]=qs['offset'](_0x2d836c[_0x7490('0x40')]['offset']);}_0x5483d7['order']=qs['sort'](_0x2d836c['query'][_0x7490('0x49')]);_0x5483d7[_0x7490('0x4a')]=qs[_0x7490('0x42')](_[_0x7490('0x4b')](_0x2d836c[_0x7490('0x40')],_0x2e4733[_0x7490('0x42')]),_0x176abd);if(_0x2d836c[_0x7490('0x40')][_0x7490('0x4c')]){_0x5483d7[_0x7490('0x4a')]=_['merge'](_0x5483d7[_0x7490('0x4a')],{'$or':_[_0x7490('0x3c')](_0x176abd,function(_0x26c425){if(_0x26c425['type']!=='VIRTUAL'){var _0x3b8e0b={};_0x3b8e0b[_0x26c425[_0x7490('0x39')]]={'$like':'%'+_0x2d836c['query'][_0x7490('0x4c')]+'%'};return _0x3b8e0b;}})});}_0x5483d7=_[_0x7490('0x4d')]({},_0x5483d7,_0x2d836c[_0x7490('0x4e')]);var _0x4bba78={'where':_0x5483d7['where']};return db[_0x7490('0x3d')][_0x7490('0x30')](_0x4bba78)['then'](function(_0xec5d92){_0x3b1398[_0x7490('0x30')]=_0xec5d92;if(_0x2d836c[_0x7490('0x40')][_0x7490('0x4f')]){_0x5483d7[_0x7490('0x50')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x7490('0x51')](_0x5483d7);})[_0x7490('0x20')](function(_0x248ed5){_0x3b1398[_0x7490('0x52')]=_0x248ed5;return _0x3b1398;})['then'](respondWithFilteredResult(_0x108115,_0x5483d7))[_0x7490('0x29')](handleError(_0x108115,null));};exports[_0x7490('0x53')]=function(_0x38d075,_0x20f80e){var _0x414b9a={'raw':!![],'where':{'id':_0x38d075[_0x7490('0x54')]['id']}},_0x166293={};_0x166293[_0x7490('0x3f')]=_[_0x7490('0x41')](db[_0x7490('0x3d')][_0x7490('0x55')]);_0x166293['query']=_['keys'](_0x38d075[_0x7490('0x40')]);_0x166293['filters']=_[_0x7490('0x44')](_0x166293[_0x7490('0x3f')],_0x166293[_0x7490('0x40')]);_0x414b9a[_0x7490('0x43')]=_[_0x7490('0x44')](_0x166293[_0x7490('0x3f')],qs[_0x7490('0x45')](_0x38d075[_0x7490('0x40')][_0x7490('0x45')]));_0x414b9a[_0x7490('0x43')]=_0x414b9a[_0x7490('0x43')][_0x7490('0x46')]?_0x414b9a[_0x7490('0x43')]:_0x166293[_0x7490('0x3f')];if(_0x38d075['query']['includeAll']){_0x414b9a[_0x7490('0x50')]=[{'all':!![]}];}_0x414b9a=_[_0x7490('0x4d')]({},_0x414b9a,_0x38d075[_0x7490('0x4e')]);return db[_0x7490('0x3d')][_0x7490('0x56')](_0x414b9a)[_0x7490('0x20')](handleEntityNotFound(_0x20f80e,null))[_0x7490('0x20')](respondWithResult(_0x20f80e,null))[_0x7490('0x29')](handleError(_0x20f80e,null));};exports[_0x7490('0x57')]=function(_0x39d36a,_0x4561b1){return db[_0x7490('0x3d')][_0x7490('0x57')](_0x39d36a[_0x7490('0x58')],{})[_0x7490('0x20')](respondWithResult(_0x4561b1,0xc9))[_0x7490('0x29')](handleError(_0x4561b1,null));};exports[_0x7490('0x35')]=function(_0x321716,_0x1a68df){if(_0x321716[_0x7490('0x58')]['id']){delete _0x321716['body']['id'];}return db[_0x7490('0x3d')][_0x7490('0x56')]({'where':{'id':_0x321716[_0x7490('0x54')]['id']}})['then'](handleEntityNotFound(_0x1a68df,null))[_0x7490('0x20')](saveUpdates(_0x321716[_0x7490('0x58')],null))[_0x7490('0x20')](respondWithResult(_0x1a68df,null))[_0x7490('0x29')](handleError(_0x1a68df,null));};exports[_0x7490('0x36')]=function(_0x373963,_0x5dc99c){return db['WhatsappMessage']['find']({'where':{'id':_0x373963['params']['id']}})['then'](handleEntityNotFound(_0x5dc99c,null))['then'](removeEntity(_0x5dc99c,null))[_0x7490('0x29')](handleError(_0x5dc99c,null));};exports[_0x7490('0x59')]=function(_0x4b7c60,_0x4aa082){return db['WhatsappMessage']['describe']()[_0x7490('0x20')](respondWithResult(_0x4aa082,null))['catch'](handleError(_0x4aa082,null));};var interaction_log=require(_0x7490('0x14'))(_0x7490('0x5a'));exports[_0x7490('0x5b')]=function(_0x2dd828,_0x407ba3,_0x16ac9d){var _0xcca523={'agent':{},'channel':'whatsapp'};if(_0x2dd828[_0x7490('0x58')]['id']){delete _0x2dd828['body']['id'];}_0x2dd828[_0x7490('0x58')][_0x7490('0x5c')]=!![];_0x2dd828['body'][_0x7490('0x5d')]=moment()[_0x7490('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2dd828['body']['UserId']=_0x2dd828[_0x7490('0x58')][_0x7490('0x5f')]||_0x2dd828[_0x7490('0x60')]['id'];_0xcca523['agent']['id']=_0x2dd828[_0x7490('0x58')][_0x7490('0x5f')];return db[_0x7490('0x3d')][_0x7490('0x56')]({'where':{'id':_0x2dd828[_0x7490('0x54')]['id'],'UserId':null}})[_0x7490('0x20')](handleEntityNotFound(_0x407ba3,null))[_0x7490('0x20')](saveUpdates(_0x2dd828[_0x7490('0x58')],null))['then'](function(_0x4b1b59){if(_0x4b1b59){_0xcca523['message']=_0x4b1b59[_0x7490('0x61')]({'plain':!![]});return db[_0x7490('0x62')][_0x7490('0x56')]({'where':{'id':_0x4b1b59[_0x7490('0x63')]}});}return null;})[_0x7490('0x20')](handleEntityNotFound(_0x407ba3,null))[_0x7490('0x20')](function(_0x31a594){if(_0x31a594){return _0x31a594[_0x7490('0x35')]({'UserId':_0x2dd828[_0x7490('0x58')][_0x7490('0x5f')],'read1stAt':_[_0x7490('0x64')](_0x31a594[_0x7490('0x65')])?moment()['format'](_0x7490('0x66')):undefined});}return null;})[_0x7490('0x20')](function(_0x4e0599){if(_0x4e0599){_0xcca523[_0x7490('0x67')]=_0x4e0599[_0x7490('0x61')]({'plain':!![]});interaction_log[_0x7490('0x21')](_0x7490('0x68'),_0x2dd828[_0x7490('0x60')]['id'],_0x2dd828[_0x7490('0x60')][_0x7490('0x39')],_0x2dd828[_0x7490('0x60')]['role'],_0xcca523['interaction']['id'],_0x2dd828[_0x7490('0x58')]?JSON[_0x7490('0x25')](_0x2dd828[_0x7490('0x58')]):_0x7490('0x69'));return respondWithRpcPromise(_0x7490('0x6a'),'acceptMessage',_0xcca523);}return null;})[_0x7490('0x20')](function(_0x1b768a){var _0x377198='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1b768a[_0x7490('0x28')][_0x7490('0x6b')];return db['sequelize'][_0x7490('0x40')](_0x377198,{'type':db[_0x7490('0x6c')]['QueryTypes'][_0x7490('0x6d')],'raw':!![]})[_0x7490('0x20')](function(_0x1ee519){return _0x1ee519;});})[_0x7490('0x20')](function(_0x1973f2){if(_0x1973f2){_0xcca523['message'][_0x7490('0x6e')]=_0x1973f2[0x0];if(!_0x2dd828[_0x7490('0x58')]['UserId'])return;return db[_0x7490('0x6f')]['find']({'where':{'id':_0x2dd828[_0x7490('0x58')][_0x7490('0x5f')],'role':_0x7490('0x70')},'attributes':['id','name',_0x7490('0x71'),_0x7490('0x72'),_0x7490('0x73')],'raw':!![]});}return null;})[_0x7490('0x20')](function(_0x1f696e){if(!_0x1f696e)return null;_0xcca523['message'][_0x7490('0x70')]=_0x1f696e;return _0xcca523;})[_0x7490('0x20')](function(_0x3a963a){if(_0x3a963a){if(_0x2dd828['body'][_0x7490('0x74')]){_0xcca523['message'][_0x7490('0x75')]=util['format'](_0x7490('0x76'),_0x2dd828[_0x7490('0x60')][_0x7490('0x39')]);_0xcca523['message'][_0x7490('0x77')]=_0xcca523['channel'];_0xcca523[_0x7490('0x28')][_0x7490('0x78')]=_0xcca523[_0x7490('0x77')];_0xcca523[_0x7490('0x28')][_0x7490('0x79')]=_0x7490('0x5b');return respondWithRpcPromise(_0x7490('0x7a'),_0x7490('0x7a'),{'event':'acceptmessage','message':_0xcca523[_0x7490('0x28')]},client9002)[_0x7490('0x20')](function(){return _0xcca523;});}return _0xcca523;}return null;})[_0x7490('0x20')](respondWithResult(_0x407ba3,null))[_0x7490('0x29')](handleError(_0x407ba3,null));};var interaction_log=require(_0x7490('0x14'))('whatsapp-interactions');exports['reject']=function(_0x3a5e78,_0x700ac3,_0x47ed4c){var _0x2852b6={'agent':{},'channel':_0x7490('0x7b')};if(_0x3a5e78[_0x7490('0x58')]['id']){delete _0x3a5e78[_0x7490('0x58')]['id'];}_0x3a5e78['body'][_0x7490('0x5f')]=_0x3a5e78['body']['UserId']||_0x3a5e78[_0x7490('0x60')]['id'];_0x2852b6[_0x7490('0x70')]['id']=_0x3a5e78[_0x7490('0x58')][_0x7490('0x5f')];return db[_0x7490('0x3d')][_0x7490('0x56')]({'where':{'id':_0x3a5e78[_0x7490('0x54')]['id'],'UserId':null}})[_0x7490('0x20')](handleEntityNotFound(_0x700ac3,null))[_0x7490('0x20')](function(_0x210e05){if(_0x210e05){_0x2852b6[_0x7490('0x28')]=_0x210e05['get']({'plain':!![]});return db[_0x7490('0x62')][_0x7490('0x56')]({'where':{'id':_0x210e05['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x700ac3,null))['then'](function(_0x416ed7){if(_0x416ed7){_0x2852b6[_0x7490('0x67')]=_0x416ed7[_0x7490('0x61')]({'plain':!![]});interaction_log[_0x7490('0x21')](_0x7490('0x7c'),_0x3a5e78[_0x7490('0x60')]['id'],_0x3a5e78[_0x7490('0x60')]['name'],_0x3a5e78[_0x7490('0x60')][_0x7490('0x7d')],_0x2852b6[_0x7490('0x67')]['id'],_0x3a5e78[_0x7490('0x58')]?JSON['stringify'](_0x3a5e78[_0x7490('0x58')]):_0x7490('0x69'));return respondWithRpcPromise(_0x7490('0x7e'),_0x7490('0x7f'),_0x2852b6);}return null;})['then'](function(_0x32db3c){var _0x2fd1c5=_0x7490('0x80')+_0x32db3c[_0x7490('0x28')][_0x7490('0x6b')];return db[_0x7490('0x81')]['query'](_0x2fd1c5,{'type':db['Sequelize'][_0x7490('0x82')]['SELECT'],'raw':!![]})[_0x7490('0x20')](function(_0x5ac8ad){return _0x5ac8ad;});})['then'](function(_0x457764){if(_0x457764){_0x2852b6[_0x7490('0x28')][_0x7490('0x6e')]=_0x457764[0x0];if(!_0x3a5e78['body']['UserId'])return;return db[_0x7490('0x6f')][_0x7490('0x56')]({'where':{'id':_0x3a5e78[_0x7490('0x58')][_0x7490('0x5f')],'role':'agent'},'attributes':['id',_0x7490('0x39'),_0x7490('0x71'),_0x7490('0x72'),_0x7490('0x73')],'raw':!![]});}return null;})[_0x7490('0x20')](function(_0x599bf5){if(!_0x599bf5)return null;_0x2852b6[_0x7490('0x28')][_0x7490('0x70')]=_0x599bf5;return _0x2852b6;})[_0x7490('0x20')](function(_0xd1e7dd){if(_0xd1e7dd){_0xd1e7dd[_0x7490('0x28')][_0x7490('0x75')]=util[_0x7490('0x5e')]('SIP/%s',_0x3a5e78[_0x7490('0x60')][_0x7490('0x39')]);_0xd1e7dd['message'][_0x7490('0x77')]=_0x2852b6[_0x7490('0x77')];_0xd1e7dd['message'][_0x7490('0x78')]=_0x2852b6[_0x7490('0x77')];_0xd1e7dd[_0x7490('0x28')][_0x7490('0x79')]=_0x7490('0x34');respondWithRpcPromise('EventManager',_0x7490('0x7a'),{'event':_0x7490('0x83'),'message':_0xd1e7dd[_0x7490('0x28')]},client9002);return _0x2852b6;}return null;})[_0x7490('0x20')](respondWithResult(_0x700ac3,null))['catch'](handleError(_0x700ac3,null));};exports['status']=function(_0x39e9ac,_0x5e1e5d,_0x18d77d){if(_0x39e9ac[_0x7490('0x58')]['id']){delete _0x39e9ac[_0x7490('0x58')]['id'];}var _0x232332;return db[_0x7490('0x3d')]['find']({'where':{'id':_0x39e9ac[_0x7490('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e1e5d,null))['then'](function(_0x166857){if(_0x166857){_0x232332=_0x166857;return db[_0x7490('0x84')][_0x7490('0x56')]({'where':{'id':_0x166857[_0x7490('0x85')]}});}})['then'](handleEntityNotFound(_0x5e1e5d,null))[_0x7490('0x20')](function(_0x24dca1){if(_0x24dca1){logger[_0x7490('0x86')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x7490('0x2b'),_0x7490('0x87'),_0x24dca1[_0x7490('0x88')],util[_0x7490('0x89')](_0x39e9ac[_0x7490('0x58')],{'showHidden':![],'depth':null}));switch(_0x24dca1['type']){case _0x7490('0x8a'):if(_0x39e9ac[_0x7490('0x58')]['MessageSid']&&_0x39e9ac[_0x7490('0x58')][_0x7490('0x8b')]===_0x232332['messageId']&&_0x39e9ac['body']['MessageStatus']&&_0x39e9ac[_0x7490('0x58')][_0x7490('0x8c')]===_0x7490('0x5c')){return _0x232332[_0x7490('0x35')]({'read':!![]});}else{logger[_0x7490('0x26')](_0x7490('0x8d'),_0x7490('0x2b'),'twilio',util[_0x7490('0x89')](_0x39e9ac[_0x7490('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x232332;}})[_0x7490('0x20')](respondWithResult(_0x5e1e5d,null))['catch'](handleError(_0x5e1e5d,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 97c08f3..c76a28b 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 _0x6324=['hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','emit'];(function(_0x4ecefd,_0x270199){var _0x5c5978=function(_0x1f0d0b){while(--_0x1f0d0b){_0x4ecefd['push'](_0x4ecefd['shift']());}};_0x5c5978(++_0x270199);}(_0x6324,0x142));var _0x4632=function(_0x30a956,_0x11222e){_0x30a956=_0x30a956-0x0;var _0x2ac17d=_0x6324[_0x30a956];return _0x2ac17d;};'use strict';var EventEmitter=require(_0x4632('0x0'));var WhatsappMessage=require(_0x4632('0x1'))['db'][_0x4632('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4632('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4632('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3bea40){return function(_0x54c200,_0x13b218,_0x592e39){WhatsappMessageEvents[_0x4632('0x5')](_0x3bea40+':'+_0x54c200['id'],_0x54c200);WhatsappMessageEvents[_0x4632('0x5')](_0x3bea40,_0x54c200);_0x592e39(null);};}for(var e in events){if(events[_0x4632('0x6')](e)){var event=events[e];WhatsappMessage[_0x4632('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xc29b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','save','update'];(function(_0x4f485f,_0x1db0f7){var _0x1e998e=function(_0x14066c){while(--_0x14066c){_0x4f485f['push'](_0x4f485f['shift']());}};_0x1e998e(++_0x1db0f7);}(_0xc29b,0x12d));var _0xbc29=function(_0x57d7d3,_0xd490a9){_0x57d7d3=_0x57d7d3-0x0;var _0x2ad9b2=_0xc29b[_0x57d7d3];return _0x2ad9b2;};'use strict';var EventEmitter=require(_0xbc29('0x0'));var WhatsappMessage=require(_0xbc29('0x1'))['db'][_0xbc29('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbc29('0x3'),'afterUpdate':_0xbc29('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3032cb){return function(_0x294a45,_0x217922,_0xa365e8){WhatsappMessageEvents[_0xbc29('0x5')](_0x3032cb+':'+_0x294a45['id'],_0x294a45);WhatsappMessageEvents[_0xbc29('0x5')](_0x3032cb,_0x294a45);_0xa365e8(null);};}for(var e in events){if(events[_0xbc29('0x6')](e)){var event=events[e];WhatsappMessage[_0xbc29('0x7')](e,emitEvent(event));}}module[_0xbc29('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 8939101..a6ba5ef 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 _0xa049=['err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','secret','WhatsappAccount','then','type','twilio','accountSid','authToken','phone','create','/api/whatsapp/messages/','/status?token=','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','message_id'];(function(_0x307195,_0x275b0c){var _0x16c4f4=function(_0x83c0c1){while(--_0x83c0c1){_0x307195['push'](_0x307195['shift']());}};_0x16c4f4(++_0x275b0c);}(_0xa049,0x136));var _0x9a04=function(_0x3d09c7,_0x3ff87d){_0x3d09c7=_0x3d09c7-0x0;var _0x43db15=_0xa049[_0x3d09c7];return _0x43db15;};'use strict';var _=require('lodash');var util=require(_0x9a04('0x0'));var logger=require(_0x9a04('0x1'))(_0x9a04('0x2'));var moment=require(_0x9a04('0x3'));var BPromise=require(_0x9a04('0x4'));var rp=require(_0x9a04('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x9a04('0x6'));var rimraf=require(_0x9a04('0x7'));var config=require(_0x9a04('0x8'));var attributes=require(_0x9a04('0x9'));module[_0x9a04('0xa')]=function(_0x15d14a,_0x473f53){return _0x15d14a[_0x9a04('0xb')](_0x9a04('0xc'),attributes,{'tableName':_0x9a04('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9a04('0xe')]},{'name':_0x9a04('0xf'),'fields':[_0x9a04('0x10')],'type':_0x9a04('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e5780,_0x36d779,_0x337f7f){var _0x2f233d=_0x15d14a[_0x9a04('0x12')];var _0x3e7652=_0x3e5780[_0x9a04('0x13')]({'plain':!![]});if(_0x3e7652[_0x9a04('0x14')]['toLowerCase']()==='in'||_0x3e7652[_0x9a04('0x14')][_0x9a04('0x15')]()===_0x9a04('0x16')&&!_0x3e7652['secret']&&!_[_0x9a04('0x17')](_0x3e7652[_0x9a04('0x18')])){_0x2f233d[_0x9a04('0x19')][_0x9a04('0x1a')]({'where':{'id':_0x3e7652[_0x9a04('0x1b')]}})['then'](function(_0x11ddfb){if(_0x11ddfb){_0x11ddfb[_0x9a04('0x1c')]({'lastMsgAt':_0x3e7652[_0x9a04('0x1d')],'lastMsgDirection':_0x3e7652[_0x9a04('0x14')][_0x9a04('0x15')]()});}})['catch'](function(_0x1c2c66){console['error'](_0x1c2c66);});}if(_0x3e7652[_0x9a04('0x14')]==='out'&&!_0x3e7652[_0x9a04('0x1e')]){var _0x525bad;_0x2f233d[_0x9a04('0x1f')]['find']({'where':{'id':_0x3e7652['WhatsappAccountId']},'raw':!![]})[_0x9a04('0x20')](function(_0x2f4901){_0x525bad=_0x2f4901;if(_0x525bad&&_0x525bad[_0x9a04('0x21')]){switch(_0x525bad[_0x9a04('0x21')]){case _0x9a04('0x22'):var _0x57b027=require(_0x9a04('0x22'));if(_0x525bad[_0x9a04('0x23')]&&_0x525bad[_0x9a04('0x24')]&&_0x525bad[_0x9a04('0x25')]){var _0x13007d=new _0x57b027(_0x525bad[_0x9a04('0x23')],_0x525bad['authToken']);_0x13007d['messages'][_0x9a04('0x26')]({'body':_0x3e7652[_0x9a04('0x10')],'to':'whatsapp:'+_0x3e7652['phone'],'from':'whatsapp:'+_0x525bad['phone'],'statusCallback':_0x525bad['remote']+_0x9a04('0x27')+_0x3e7652['id']+_0x9a04('0x28')+_0x525bad['token']})[_0x9a04('0x20')](function(_0x42c998){if(_0x42c998['sid']){return _0x3e5780[_0x9a04('0x1c')]({'messageId':_0x42c998[_0x9a04('0x29')]});}})[_0x9a04('0x2a')](function(_0x43f7ae){logger[_0x9a04('0x2b')](_0x9a04('0x2c'),_0x9a04('0x2d'),_0x9a04('0x22'),util[_0x9a04('0x2e')](_0x43f7ae,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x9a04('0x2d'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x9a04('0x2f'):var _0x23f7e7=_0x525bad[_0x9a04('0x23')];var _0xf1de5=_0x525bad[_0x9a04('0x24')];var _0x51c41d=_0x525bad[_0x9a04('0x30')]+_0x9a04('0x31')+_0x23f7e7+_0x9a04('0x32');var _0x274be9={'to':[_0x3e7652[_0x9a04('0x25')]],'message':{'type':_0x9a04('0x33'),'text':_0x3e7652['body']}};var _0x27821a={'method':_0x9a04('0x34'),'uri':_0x51c41d,'headers':{'Authorization':_0x9a04('0x35')+_0xf1de5,'Content-Type':'application/json'},'body':_0x274be9,'json':!![]};rp(_0x27821a)['then'](function(_0x1aadb4){if(_0x1aadb4[_0x9a04('0x36')][0x0][_0x9a04('0x37')]){return _0x3e5780[_0x9a04('0x1c')]({'messageId':_0x1aadb4['statuses'][0x0][_0x9a04('0x37')]});}})[_0x9a04('0x2a')](function(_0x587f41){logger[_0x9a04('0x38')](_0x9a04('0x39'),_0x587f41);});break;}}})[_0x9a04('0x3a')](function(){_0x337f7f();});}else{_0x337f7f();}}},'charset':_0x9a04('0x3b'),'collate':_0x9a04('0x3c')});}; \ No newline at end of file +var _0xebe0=['UserId','WhatsappInteraction','then','createdAt','error','WhatsappAccount','find','WhatsappAccountId','twilio','accountSid','authToken','phone','create','body','whatsapp:','remote','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','catch','err','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','direction','toLowerCase','out','secret','isNil'];(function(_0x697a85,_0x238db2){var _0x4a6ba9=function(_0x4e70b7){while(--_0x4e70b7){_0x697a85['push'](_0x697a85['shift']());}};_0x4a6ba9(++_0x238db2);}(_0xebe0,0x16f));var _0x0ebe=function(_0x65ae52,_0x4d7408){_0x65ae52=_0x65ae52-0x0;var _0xfbd161=_0xebe0[_0x65ae52];return _0xfbd161;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0ebe('0x0'))('api');var moment=require(_0x0ebe('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x0ebe('0x2'));var fs=require('fs');var path=require(_0x0ebe('0x3'));var rimraf=require(_0x0ebe('0x4'));var config=require(_0x0ebe('0x5'));var attributes=require(_0x0ebe('0x6'));module[_0x0ebe('0x7')]=function(_0x37c327,_0x355735){return _0x37c327[_0x0ebe('0x8')]('WhatsappMessage',attributes,{'tableName':_0x0ebe('0x9'),'paranoid':![],'indexes':[{'name':_0x0ebe('0xa'),'fields':[_0x0ebe('0xa')]},{'name':_0x0ebe('0xb'),'fields':['body'],'type':_0x0ebe('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f7380,_0x2628d3,_0xdf91b8){var _0x54dcd0=_0x37c327['models'];var _0x407a3e=_0x4f7380['get']({'plain':!![]});if(_0x407a3e[_0x0ebe('0xd')]['toLowerCase']()==='in'||_0x407a3e[_0x0ebe('0xd')][_0x0ebe('0xe')]()===_0x0ebe('0xf')&&!_0x407a3e[_0x0ebe('0x10')]&&!_[_0x0ebe('0x11')](_0x407a3e[_0x0ebe('0x12')])){_0x54dcd0[_0x0ebe('0x13')]['findOne']({'where':{'id':_0x407a3e['WhatsappInteractionId']}})[_0x0ebe('0x14')](function(_0x503e8f){if(_0x503e8f){_0x503e8f['update']({'lastMsgAt':_0x407a3e[_0x0ebe('0x15')],'lastMsgDirection':_0x407a3e[_0x0ebe('0xd')][_0x0ebe('0xe')]()});}})['catch'](function(_0x34717c){console[_0x0ebe('0x16')](_0x34717c);});}if(_0x407a3e[_0x0ebe('0xd')]===_0x0ebe('0xf')&&!_0x407a3e[_0x0ebe('0x10')]){var _0x260792;_0x54dcd0[_0x0ebe('0x17')][_0x0ebe('0x18')]({'where':{'id':_0x407a3e[_0x0ebe('0x19')]},'raw':!![]})['then'](function(_0x44b6f8){_0x260792=_0x44b6f8;if(_0x260792&&_0x260792['type']){switch(_0x260792['type']){case _0x0ebe('0x1a'):var _0x33e605=require(_0x0ebe('0x1a'));if(_0x260792[_0x0ebe('0x1b')]&&_0x260792[_0x0ebe('0x1c')]&&_0x260792[_0x0ebe('0x1d')]){var _0x5122d9=new _0x33e605(_0x260792['accountSid'],_0x260792[_0x0ebe('0x1c')]);_0x5122d9['messages'][_0x0ebe('0x1e')]({'body':_0x407a3e[_0x0ebe('0x1f')],'to':_0x0ebe('0x20')+_0x407a3e[_0x0ebe('0x1d')],'from':_0x0ebe('0x20')+_0x260792['phone'],'statusCallback':_0x260792[_0x0ebe('0x21')]+'/api/whatsapp/messages/'+_0x407a3e['id']+'/status?token='+_0x260792[_0x0ebe('0x22')]})[_0x0ebe('0x14')](function(_0x429059){if(_0x429059[_0x0ebe('0x23')]){return _0x4f7380[_0x0ebe('0x24')]({'messageId':_0x429059[_0x0ebe('0x23')]});}})['catch'](function(_0x122b24){logger[_0x0ebe('0x16')](_0x0ebe('0x25'),_0x0ebe('0x26'),_0x0ebe('0x1a'),util['inspect'](_0x122b24,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0ebe('0x25'),_0x0ebe('0x26'),'twilio',_0x0ebe('0x27'));}break;case _0x0ebe('0x28'):var _0x48489f=_0x260792[_0x0ebe('0x1b')];var _0xe3492c=_0x260792[_0x0ebe('0x1c')];var _0x590a45=_0x260792[_0x0ebe('0x29')]+_0x0ebe('0x2a')+_0x48489f+_0x0ebe('0x2b');var _0x3750a2={'to':[_0x407a3e[_0x0ebe('0x1d')]],'message':{'type':_0x0ebe('0x2c'),'text':_0x407a3e[_0x0ebe('0x1f')]}};var _0xc84917={'method':_0x0ebe('0x2d'),'uri':_0x590a45,'headers':{'Authorization':_0x0ebe('0x2e')+_0xe3492c,'Content-Type':_0x0ebe('0x2f')},'body':_0x3750a2,'json':!![]};rp(_0xc84917)[_0x0ebe('0x14')](function(_0x490ead){if(_0x490ead[_0x0ebe('0x30')][0x0]['message_id']){return _0x4f7380[_0x0ebe('0x24')]({'messageId':_0x490ead[_0x0ebe('0x30')][0x0][_0x0ebe('0x31')]});}})[_0x0ebe('0x32')](function(_0x42ec11){logger[_0x0ebe('0x33')]('WhatsappMessage,\x20%s',_0x42ec11);});break;}}})[_0x0ebe('0x34')](function(){_0xdf91b8();});}else{_0xdf91b8();}}},'charset':_0x0ebe('0x35'),'collate':_0x0ebe('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index d3c5ea0..0bd14ac 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 _0x56cc=['WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','then','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56cc,0xcf));var _0xc56c=function(_0x3f3c44,_0x3f032f){_0x3f3c44=_0x3f3c44-0x0;var _0x122fff=_0x56cc[_0x3f3c44];return _0x122fff;};'use strict';var _=require(_0xc56c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc56c('0x1'));var rs=require(_0xc56c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc56c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc56c('0x4'))(_0xc56c('0x5'));var config=require(_0xc56c('0x6'));var jayson=require(_0xc56c('0x7'));var client=jayson[_0xc56c('0x8')][_0xc56c('0x9')]({'port':0x232a});config['redis']=_[_0xc56c('0xa')](config[_0xc56c('0xb')],{'host':_0xc56c('0xc'),'port':0x18eb});var socket=require(_0xc56c('0xd'))(new Redis(config['redis']));require(_0xc56c('0xe'))['register'](socket);function respondWithRpcPromise(_0x5df330,_0x373c1e,_0x401f59){return new BPromise(function(_0x3ef8d4,_0x4c6a4f){return client[_0xc56c('0xf')](_0x5df330,_0x401f59)['then'](function(_0x8fd485){logger[_0xc56c('0x10')](_0xc56c('0x11'),_0x373c1e,'request\x20sent');logger['debug'](_0xc56c('0x12'),_0x373c1e,_0xc56c('0x13'),JSON['stringify'](_0x8fd485));if(_0x8fd485['error']){if(_0x8fd485['error'][_0xc56c('0x14')]===0x1f4){logger[_0xc56c('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x373c1e,_0x8fd485[_0xc56c('0x15')][_0xc56c('0x16')]);return _0x4c6a4f(_0x8fd485[_0xc56c('0x15')]['message']);}logger[_0xc56c('0x15')](_0xc56c('0x11'),_0x373c1e,_0x8fd485[_0xc56c('0x15')][_0xc56c('0x16')]);return _0x3ef8d4(_0x8fd485[_0xc56c('0x15')][_0xc56c('0x16')]);}else{logger[_0xc56c('0x10')](_0xc56c('0x11'),_0x373c1e,_0xc56c('0x13'));_0x3ef8d4(_0x8fd485[_0xc56c('0x17')][_0xc56c('0x16')]);}})[_0xc56c('0x18')](function(_0x5915e4){logger[_0xc56c('0x15')](_0xc56c('0x11'),_0x373c1e,_0x5915e4);_0x4c6a4f(_0x5915e4);});});}exports[_0xc56c('0x19')]=function(_0x102edf){var _0x49b2cf=this;return new Promise(function(_0x3929cb,_0x31de0a){return db[_0xc56c('0x1a')][_0xc56c('0x1b')](_0x102edf['body'],{'raw':_0x102edf[_0xc56c('0x1c')]?_0x102edf[_0xc56c('0x1c')][_0xc56c('0x1d')]===undefined?!![]:![]:!![]})[_0xc56c('0x1e')](function(_0x2b7260){logger[_0xc56c('0x10')](_0xc56c('0x19'),_0x102edf);logger[_0xc56c('0x1f')]('CreateWhatsappMessage',_0x102edf,JSON['stringify'](_0x2b7260));_0x3929cb(_0x2b7260);})['catch'](function(_0x2dceee){logger[_0xc56c('0x15')]('CreateWhatsappMessage',_0x2dceee['message'],_0x102edf);_0x31de0a(_0x49b2cf[_0xc56c('0x15')](0x1f4,_0x2dceee[_0xc56c('0x16')]));});});}; \ No newline at end of file +var _0x6899=['debug','stringify','error','message','request\x20sent','result','catch','WhatsappMessage','create','body','options','raw','then','CreateWhatsappMessage','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6899,0x8e));var _0x9689=function(_0x546b3a,_0x5a4628){_0x546b3a=_0x546b3a-0x0;var _0x1a6e0b=_0x6899[_0x546b3a];return _0x1a6e0b;};'use strict';var _=require('lodash');var util=require(_0x9689('0x0'));var moment=require('moment');var BPromise=require(_0x9689('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9689('0x2'));var db=require(_0x9689('0x3'))['db'];var utils=require(_0x9689('0x4'));var logger=require(_0x9689('0x5'))(_0x9689('0x6'));var config=require(_0x9689('0x7'));var jayson=require(_0x9689('0x8'));var client=jayson[_0x9689('0x9')][_0x9689('0xa')]({'port':0x232a});config[_0x9689('0xb')]=_['defaults'](config[_0x9689('0xb')],{'host':_0x9689('0xc'),'port':0x18eb});var socket=require(_0x9689('0xd'))(new Redis(config[_0x9689('0xb')]));require(_0x9689('0xe'))[_0x9689('0xf')](socket);function respondWithRpcPromise(_0x21fbd3,_0x36557b,_0x2b98c7){return new BPromise(function(_0xa07d58,_0x557fba){return client['request'](_0x21fbd3,_0x2b98c7)['then'](function(_0x5e58d9){logger[_0x9689('0x10')](_0x9689('0x11'),_0x36557b,'request\x20sent');logger[_0x9689('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x36557b,'request\x20sent',JSON[_0x9689('0x13')](_0x5e58d9));if(_0x5e58d9[_0x9689('0x14')]){if(_0x5e58d9[_0x9689('0x14')]['code']===0x1f4){logger[_0x9689('0x14')](_0x9689('0x11'),_0x36557b,_0x5e58d9[_0x9689('0x14')][_0x9689('0x15')]);return _0x557fba(_0x5e58d9[_0x9689('0x14')][_0x9689('0x15')]);}logger[_0x9689('0x14')](_0x9689('0x11'),_0x36557b,_0x5e58d9['error'][_0x9689('0x15')]);return _0xa07d58(_0x5e58d9['error'][_0x9689('0x15')]);}else{logger[_0x9689('0x10')](_0x9689('0x11'),_0x36557b,_0x9689('0x16'));_0xa07d58(_0x5e58d9[_0x9689('0x17')][_0x9689('0x15')]);}})[_0x9689('0x18')](function(_0xc8c1a7){logger[_0x9689('0x14')](_0x9689('0x11'),_0x36557b,_0xc8c1a7);_0x557fba(_0xc8c1a7);});});}exports['CreateWhatsappMessage']=function(_0x359bf5){var _0x2d3dc0=this;return new Promise(function(_0x26541a,_0x42a43f){return db[_0x9689('0x19')][_0x9689('0x1a')](_0x359bf5[_0x9689('0x1b')],{'raw':_0x359bf5[_0x9689('0x1c')]?_0x359bf5['options'][_0x9689('0x1d')]===undefined?!![]:![]:!![]})[_0x9689('0x1e')](function(_0x182680){logger[_0x9689('0x10')]('CreateWhatsappMessage',_0x359bf5);logger[_0x9689('0x12')]('CreateWhatsappMessage',_0x359bf5,JSON['stringify'](_0x182680));_0x26541a(_0x182680);})[_0x9689('0x18')](function(_0x3cb2fd){logger[_0x9689('0x14')](_0x9689('0x1f'),_0x3cb2fd[_0x9689('0x15')],_0x359bf5);_0x42a43f(_0x2d3dc0[_0x9689('0x14')](0x1f4,_0x3cb2fd[_0x9689('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index cf44c4e..ca76aef 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 _0xd524=['removeListener','register','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xd524,0x1db));var _0x4d52=function(_0x481a24,_0x3b8945){_0x481a24=_0x481a24-0x0;var _0x38d627=_0xd524[_0x481a24];return _0x38d627;};'use strict';var WhatsappMessageEvents=require(_0x4d52('0x0'));var events=[_0x4d52('0x1'),_0x4d52('0x2'),_0x4d52('0x3')];function createListener(_0x16c133,_0x4638cb){return function(_0x2a0155){_0x4638cb[_0x4d52('0x4')](_0x16c133,_0x2a0155);};}function removeListener(_0x11aba5,_0x11d9f3){return function(){WhatsappMessageEvents[_0x4d52('0x5')](_0x11aba5,_0x11d9f3);};}exports[_0x4d52('0x6')]=function(_0x5343ad){for(var _0xc3c9b0=0x0,_0x3d240f=events['length'];_0xc3c9b0<_0x3d240f;_0xc3c9b0++){var _0x439010=events[_0xc3c9b0];var _0x22983c=createListener(_0x4d52('0x7')+_0x439010,_0x5343ad);WhatsappMessageEvents['on'](_0x439010,_0x22983c);}}; \ No newline at end of file +var _0x8b28=['emit','register','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x5be1d9,_0x423b37){var _0x3ef483=function(_0x325a82){while(--_0x325a82){_0x5be1d9['push'](_0x5be1d9['shift']());}};_0x3ef483(++_0x423b37);}(_0x8b28,0x161));var _0x88b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b28[_0x14add3];return _0x4a174f;};'use strict';var WhatsappMessageEvents=require(_0x88b2('0x0'));var events=[_0x88b2('0x1'),_0x88b2('0x2'),_0x88b2('0x3')];function createListener(_0x4f9a17,_0x1b2545){return function(_0x2565cb){_0x1b2545[_0x88b2('0x4')](_0x4f9a17,_0x2565cb);};}function removeListener(_0x3517f4,_0x345326){return function(){WhatsappMessageEvents['removeListener'](_0x3517f4,_0x345326);};}exports[_0x88b2('0x5')]=function(_0xf88e23){for(var _0x3e8fa1=0x0,_0x39f31f=events['length'];_0x3e8fa1<_0x39f31f;_0x3e8fa1++){var _0x5418f5=events[_0x3e8fa1];var _0x2a3598=createListener(_0x88b2('0x6')+_0x5418f5,_0xf88e23);WhatsappMessageEvents['on'](_0x5418f5,_0x2a3598);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 77560c7..202dab5 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 _0x00e7=['destroy','removeTeams','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','delete'];(function(_0xbf8760,_0x1d106b){var _0x25f0ed=function(_0x3c3b59){while(--_0x3c3b59){_0xbf8760['push'](_0xbf8760['shift']());}};_0x25f0ed(++_0x1d106b);}(_0x00e7,0xca));var _0x700e=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x00e7[_0x270adf];return _0x29eda9;};'use strict';var multer=require(_0x700e('0x0'));var util=require(_0x700e('0x1'));var path=require('path');var timeout=require(_0x700e('0x2'));var express=require(_0x700e('0x3'));var router=express['Router']();var fs_extra=require(_0x700e('0x4'));var auth=require(_0x700e('0x5'));var interaction=require(_0x700e('0x6'));var config=require(_0x700e('0x7'));var controller=require('./whatsappQueue.controller');router[_0x700e('0x8')]('/',auth[_0x700e('0x9')](),controller['index']);router[_0x700e('0x8')]('/describe',auth[_0x700e('0x9')](),controller[_0x700e('0xa')]);router['get'](_0x700e('0xb'),auth[_0x700e('0x9')](),controller[_0x700e('0xc')]);router[_0x700e('0x8')](_0x700e('0xd'),auth[_0x700e('0x9')](),controller['getMembers']);router['get'](_0x700e('0xe'),auth[_0x700e('0x9')](),controller[_0x700e('0xf')]);router[_0x700e('0x8')](_0x700e('0x10'),auth[_0x700e('0x9')](),controller[_0x700e('0x11')]);router[_0x700e('0x12')]('/',auth[_0x700e('0x9')](),controller['create']);router[_0x700e('0x12')](_0x700e('0xe'),auth[_0x700e('0x9')](),controller[_0x700e('0x13')]);router[_0x700e('0x12')](_0x700e('0x10'),auth[_0x700e('0x9')](),controller['addAgents']);router[_0x700e('0x14')]('/:id',auth[_0x700e('0x9')](),controller[_0x700e('0x15')]);router[_0x700e('0x16')]('/:id',auth[_0x700e('0x9')](),controller[_0x700e('0x17')]);router[_0x700e('0x16')](_0x700e('0xe'),auth['isAuthenticated'](),controller[_0x700e('0x18')]);router[_0x700e('0x16')](_0x700e('0x10'),auth[_0x700e('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf058=['addAgents','put','/:id','delete','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','/describe','describe','show','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xf058,0xbb));var _0x8f05=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf058[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8f05('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8f05('0x1'));var express=require(_0x8f05('0x2'));var router=express[_0x8f05('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8f05('0x4'));var interaction=require(_0x8f05('0x5'));var config=require(_0x8f05('0x6'));var controller=require(_0x8f05('0x7'));router['get']('/',auth[_0x8f05('0x8')](),controller[_0x8f05('0x9')]);router['get'](_0x8f05('0xa'),auth[_0x8f05('0x8')](),controller[_0x8f05('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8f05('0xc')]);router[_0x8f05('0xd')](_0x8f05('0xe'),auth[_0x8f05('0x8')](),controller[_0x8f05('0xf')]);router[_0x8f05('0xd')](_0x8f05('0x10'),auth[_0x8f05('0x8')](),controller[_0x8f05('0x11')]);router['get'](_0x8f05('0x12'),auth[_0x8f05('0x8')](),controller[_0x8f05('0x13')]);router[_0x8f05('0x14')]('/',auth['isAuthenticated'](),controller[_0x8f05('0x15')]);router[_0x8f05('0x14')](_0x8f05('0x10'),auth['isAuthenticated'](),controller[_0x8f05('0x16')]);router[_0x8f05('0x14')](_0x8f05('0x12'),auth[_0x8f05('0x8')](),controller[_0x8f05('0x17')]);router[_0x8f05('0x18')](_0x8f05('0x19'),auth[_0x8f05('0x8')](),controller['update']);router[_0x8f05('0x1a')](_0x8f05('0x19'),auth['isAuthenticated'](),controller['destroy']);router[_0x8f05('0x1a')]('/:id/teams',auth[_0x8f05('0x8')](),controller[_0x8f05('0x1b')]);router[_0x8f05('0x1a')](_0x8f05('0x12'),auth[_0x8f05('0x8')](),controller[_0x8f05('0x1c')]);module[_0x8f05('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3d7535e..0eb33e7 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 _0x2285=['INTEGER','ENUM','beepall','roundrobin','exports','STRING','name'];(function(_0x5699dd,_0x1d1244){var _0xb60868=function(_0x141966){while(--_0x141966){_0x5699dd['push'](_0x5699dd['shift']());}};_0xb60868(++_0x1d1244);}(_0x2285,0x177));var _0x5228=function(_0x5bf9ae,_0x4eb807){_0x5bf9ae=_0x5bf9ae-0x0;var _0x39e0b2=_0x2285[_0x5bf9ae];return _0x39e0b2;};'use strict';var Sequelize=require('sequelize');module[_0x5228('0x0')]={'name':{'type':Sequelize[_0x5228('0x1')],'unique':_0x5228('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5228('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5228('0x4')]('rrmemory',_0x5228('0x5'),_0x5228('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7a72=['roundrobin','exports','STRING','INTEGER','rrmemory'];(function(_0x3190d2,_0x1c4114){var _0x12a9a6=function(_0x14f2bf){while(--_0x14f2bf){_0x3190d2['push'](_0x3190d2['shift']());}};_0x12a9a6(++_0x1c4114);}(_0x7a72,0x1be));var _0x27a7=function(_0x469c92,_0x1e3542){_0x469c92=_0x469c92-0x0;var _0x9dbf5=_0x7a72[_0x469c92];return _0x9dbf5;};'use strict';var Sequelize=require('sequelize');module[_0x27a7('0x0')]={'name':{'type':Sequelize[_0x27a7('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x27a7('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x27a7('0x3'),'beepall',_0x27a7('0x4'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b7cc2d8..292451b 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 _0xed19=['find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','removeTeams','Team','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','ids','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','WhatsappQueues','destroy','then','stack','name','map','WhatsappQueue','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','user','get','role','UserProfileSection'];(function(_0x366d92,_0x28e34c){var _0x22c349=function(_0x36372f){while(--_0x36372f){_0x366d92['push'](_0x366d92['shift']());}};_0x22c349(++_0x28e34c);}(_0xed19,0xc8));var _0x9ed1=function(_0x3bb571,_0x32cfb7){_0x3bb571=_0x3bb571-0x0;var _0x54ff33=_0xed19[_0x3bb571];return _0x54ff33;};'use strict';var emlformat=require(_0x9ed1('0x0'));var rimraf=require(_0x9ed1('0x1'));var zipdir=require(_0x9ed1('0x2'));var jsonpatch=require(_0x9ed1('0x3'));var rp=require('request-promise');var moment=require(_0x9ed1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ed1('0x5'));var util=require(_0x9ed1('0x6'));var path=require(_0x9ed1('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('lodash');var squel=require(_0x9ed1('0x8'));var crypto=require(_0x9ed1('0x9'));var jsforce=require(_0x9ed1('0xa'));var deskjs=require(_0x9ed1('0xb'));var toCsv=require(_0x9ed1('0xc'));var querystring=require(_0x9ed1('0xd'));var Papa=require('papaparse');var Redis=require(_0x9ed1('0xe'));var authService=require(_0x9ed1('0xf'));var qs=require(_0x9ed1('0x10'));var as=require(_0x9ed1('0x11'));var hardwareService=require(_0x9ed1('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9ed1('0x13'));var licenseUtil=require(_0x9ed1('0x14'));var db=require(_0x9ed1('0x15'))['db'];config[_0x9ed1('0x16')]=_[_0x9ed1('0x17')](config['redis'],{'host':_0x9ed1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ed1('0x16')]));require(_0x9ed1('0x19'))[_0x9ed1('0x1a')](socket);function respondWithStatusCode(_0x3f302c,_0x5fda98){_0x5fda98=_0x5fda98||0xcc;return function(_0x4c3d9b){if(_0x4c3d9b){return _0x3f302c[_0x9ed1('0x1b')](_0x5fda98);}return _0x3f302c[_0x9ed1('0x1c')](_0x5fda98)[_0x9ed1('0x1d')]();};}function respondWithResult(_0x2315ab,_0xd10eff){_0xd10eff=_0xd10eff||0xc8;return function(_0x244907){if(_0x244907){return _0x2315ab['status'](_0xd10eff)[_0x9ed1('0x1e')](_0x244907);}};}function respondWithFilteredResult(_0x4f606b,_0xce10fe){return function(_0x1e83d2){if(_0x1e83d2){var _0x3b1c18=typeof _0xce10fe[_0x9ed1('0x1f')]==='undefined'&&typeof _0xce10fe['limit']===_0x9ed1('0x20');var _0x729d60=_0x1e83d2[_0x9ed1('0x21')];var _0x2fd7af=_0x3b1c18?0x0:_0xce10fe[_0x9ed1('0x1f')];var _0x2b3ee2=_0x3b1c18?_0x1e83d2[_0x9ed1('0x21')]:_0xce10fe[_0x9ed1('0x1f')]+_0xce10fe[_0x9ed1('0x22')];var _0xe669ae;if(_0x2b3ee2>=_0x729d60){_0x2b3ee2=_0x729d60;_0xe669ae=0xc8;}else{_0xe669ae=0xce;}_0x4f606b[_0x9ed1('0x1c')](_0xe669ae);return _0x4f606b[_0x9ed1('0x23')](_0x9ed1('0x24'),_0x2fd7af+'-'+_0x2b3ee2+'/'+_0x729d60)['json'](_0x1e83d2);}return null;};}function patchUpdates(_0x3a1b2f){return function(_0x3483cb){try{jsonpatch[_0x9ed1('0x25')](_0x3483cb,_0x3a1b2f,!![]);}catch(_0x20c12b){return BPromise[_0x9ed1('0x26')](_0x20c12b);}return _0x3483cb['save']();};}function saveUpdates(_0x27ccbe,_0x462ee7){return function(_0x51c6ec){if(_0x51c6ec){return _0x51c6ec[_0x9ed1('0x27')](_0x27ccbe)['then'](function(_0x4bb06f){return _0x4bb06f;});}return null;};}function removeEntity(_0x394b68,_0x3a4ded){return function(_0x5699ae){if(_0x5699ae){return _0x5699ae['destroy']()['then'](function(){var _0x363178=_0x5699ae['get']({'plain':!![]});var _0x34b8f1=_0x9ed1('0x28');return db['UserProfileResource'][_0x9ed1('0x29')]({'where':{'type':_0x34b8f1,'resourceId':_0x363178['id']}})['then'](function(){return _0x5699ae;});})[_0x9ed1('0x2a')](function(){_0x394b68[_0x9ed1('0x1c')](0xcc)[_0x9ed1('0x1d')]();});}};}function handleEntityNotFound(_0x318df2,_0x208623){return function(_0x1de570){if(!_0x1de570){_0x318df2[_0x9ed1('0x1b')](0x194);}return _0x1de570;};}function handleError(_0x1a7b4b,_0x185454){_0x185454=_0x185454||0x1f4;return function(_0x45f347){logger['error'](_0x45f347[_0x9ed1('0x2b')]);if(_0x45f347[_0x9ed1('0x2c')]){delete _0x45f347[_0x9ed1('0x2c')];}_0x1a7b4b[_0x9ed1('0x1c')](_0x185454)['send'](_0x45f347);};}exports['index']=function(_0x230469,_0x2fadc6){var _0x38fefe={},_0x414a1b={},_0x1ca36f={'count':0x0,'rows':[]};var _0x190507=_[_0x9ed1('0x2d')](db[_0x9ed1('0x2e')][_0x9ed1('0x2f')],function(_0x55e946){return{'name':_0x55e946['fieldName'],'type':_0x55e946[_0x9ed1('0x30')][_0x9ed1('0x31')]};});_0x414a1b[_0x9ed1('0x32')]=_[_0x9ed1('0x2d')](_0x190507,_0x9ed1('0x2c'));_0x414a1b[_0x9ed1('0x33')]=_[_0x9ed1('0x34')](_0x230469['query']);_0x414a1b[_0x9ed1('0x35')]=_['intersection'](_0x414a1b[_0x9ed1('0x32')],_0x414a1b[_0x9ed1('0x33')]);_0x38fefe[_0x9ed1('0x36')]=_[_0x9ed1('0x37')](_0x414a1b[_0x9ed1('0x32')],qs[_0x9ed1('0x38')](_0x230469[_0x9ed1('0x33')][_0x9ed1('0x38')]));_0x38fefe['attributes']=_0x38fefe[_0x9ed1('0x36')][_0x9ed1('0x39')]?_0x38fefe[_0x9ed1('0x36')]:_0x414a1b[_0x9ed1('0x32')];if(!_0x230469[_0x9ed1('0x33')]['hasOwnProperty'](_0x9ed1('0x3a'))){_0x38fefe['limit']=qs[_0x9ed1('0x22')](_0x230469[_0x9ed1('0x33')][_0x9ed1('0x22')]);_0x38fefe[_0x9ed1('0x1f')]=qs[_0x9ed1('0x1f')](_0x230469[_0x9ed1('0x33')][_0x9ed1('0x1f')]);}_0x38fefe[_0x9ed1('0x3b')]=qs[_0x9ed1('0x3c')](_0x230469[_0x9ed1('0x33')][_0x9ed1('0x3c')]);_0x38fefe[_0x9ed1('0x3d')]=qs[_0x9ed1('0x35')](_[_0x9ed1('0x3e')](_0x230469[_0x9ed1('0x33')],_0x414a1b['filters']),_0x190507);if(_0x230469[_0x9ed1('0x33')][_0x9ed1('0x3f')]){_0x38fefe[_0x9ed1('0x3d')]=_[_0x9ed1('0x40')](_0x38fefe[_0x9ed1('0x3d')],{'$or':_[_0x9ed1('0x2d')](_0x190507,function(_0x347e05){if(_0x347e05['type']!==_0x9ed1('0x41')){var _0x16cefb={};_0x16cefb[_0x347e05['name']]={'$like':'%'+_0x230469[_0x9ed1('0x33')][_0x9ed1('0x3f')]+'%'};return _0x16cefb;}})});}_0x38fefe=_['merge']({},_0x38fefe,_0x230469[_0x9ed1('0x42')]);var _0x56286b={'where':_0x38fefe[_0x9ed1('0x3d')]};return db[_0x9ed1('0x2e')][_0x9ed1('0x21')](_0x56286b)[_0x9ed1('0x2a')](function(_0x4ae343){_0x1ca36f[_0x9ed1('0x21')]=_0x4ae343;if(_0x230469[_0x9ed1('0x33')][_0x9ed1('0x43')]){_0x38fefe[_0x9ed1('0x44')]=[{'all':!![]}];}return db[_0x9ed1('0x2e')]['findAll'](_0x38fefe);})[_0x9ed1('0x2a')](function(_0x599a51){_0x1ca36f[_0x9ed1('0x45')]=_0x599a51;return _0x1ca36f;})[_0x9ed1('0x2a')](respondWithFilteredResult(_0x2fadc6,_0x38fefe))[_0x9ed1('0x46')](handleError(_0x2fadc6,null));};exports[_0x9ed1('0x47')]=function(_0x1ab3c0,_0x5c76e6){var _0x42e032={'raw':!![],'where':{'id':_0x1ab3c0['params']['id']}},_0x366375={};_0x366375[_0x9ed1('0x32')]=_[_0x9ed1('0x34')](db[_0x9ed1('0x2e')]['rawAttributes']);_0x366375['query']=_[_0x9ed1('0x34')](_0x1ab3c0[_0x9ed1('0x33')]);_0x366375['filters']=_[_0x9ed1('0x37')](_0x366375[_0x9ed1('0x32')],_0x366375['query']);_0x42e032[_0x9ed1('0x36')]=_[_0x9ed1('0x37')](_0x366375[_0x9ed1('0x32')],qs['fields'](_0x1ab3c0[_0x9ed1('0x33')][_0x9ed1('0x38')]));_0x42e032['attributes']=_0x42e032[_0x9ed1('0x36')][_0x9ed1('0x39')]?_0x42e032[_0x9ed1('0x36')]:_0x366375['model'];if(_0x1ab3c0['query'][_0x9ed1('0x43')]){_0x42e032[_0x9ed1('0x44')]=[{'all':!![]}];}_0x42e032=_[_0x9ed1('0x40')]({},_0x42e032,_0x1ab3c0['options']);return db[_0x9ed1('0x2e')]['find'](_0x42e032)[_0x9ed1('0x2a')](handleEntityNotFound(_0x5c76e6,null))['then'](respondWithResult(_0x5c76e6,null))[_0x9ed1('0x46')](handleError(_0x5c76e6,null));};exports[_0x9ed1('0x48')]=function(_0x1bfe52,_0x5ae704){return db['WhatsappQueue']['create'](_0x1bfe52[_0x9ed1('0x49')],{})[_0x9ed1('0x2a')](function(_0x264331){var _0x10dabe=_0x1bfe52[_0x9ed1('0x4a')][_0x9ed1('0x4b')]({'plain':!![]});if(!_0x10dabe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10dabe[_0x9ed1('0x4c')]===_0x9ed1('0x4a')){var _0x45b711=_0x264331[_0x9ed1('0x4b')]({'plain':!![]});var _0x24d5e6=_0x9ed1('0x28');return db[_0x9ed1('0x4d')][_0x9ed1('0x4e')]({'where':{'name':_0x24d5e6,'userProfileId':_0x10dabe[_0x9ed1('0x4f')]},'raw':!![]})[_0x9ed1('0x2a')](function(_0xa0a5e2){if(_0xa0a5e2&&_0xa0a5e2[_0x9ed1('0x50')]===0x0){return db['UserProfileResource'][_0x9ed1('0x48')]({'name':_0x45b711[_0x9ed1('0x2c')],'resourceId':_0x45b711['id'],'type':_0xa0a5e2[_0x9ed1('0x2c')],'sectionId':_0xa0a5e2['id']},{})[_0x9ed1('0x2a')](function(){return _0x264331;});}else{return _0x264331;}})['catch'](function(_0x5d401d){logger[_0x9ed1('0x51')](_0x9ed1('0x52'),_0x5d401d);throw _0x5d401d;});}return _0x264331;})[_0x9ed1('0x2a')](respondWithResult(_0x5ae704,0xc9))[_0x9ed1('0x46')](handleError(_0x5ae704,null));};exports[_0x9ed1('0x27')]=function(_0x43be37,_0x540c9a){if(_0x43be37['body']['id']){delete _0x43be37['body']['id'];}return db[_0x9ed1('0x2e')][_0x9ed1('0x4e')]({'where':{'id':_0x43be37[_0x9ed1('0x53')]['id']}})['then'](handleEntityNotFound(_0x540c9a,null))['then'](saveUpdates(_0x43be37['body'],null))[_0x9ed1('0x2a')](respondWithResult(_0x540c9a,null))[_0x9ed1('0x46')](handleError(_0x540c9a,null));};exports['destroy']=function(_0x38077d,_0x297e93){return db[_0x9ed1('0x2e')]['find']({'where':{'id':_0x38077d[_0x9ed1('0x53')]['id']}})[_0x9ed1('0x2a')](handleEntityNotFound(_0x297e93,null))[_0x9ed1('0x2a')](removeEntity(_0x297e93,null))[_0x9ed1('0x46')](handleError(_0x297e93,null));};exports[_0x9ed1('0x54')]=function(_0x38ca4d,_0x5ce726){return db[_0x9ed1('0x2e')]['describe']()[_0x9ed1('0x2a')](respondWithResult(_0x5ce726,null))['catch'](handleError(_0x5ce726,null));};exports['getMembers']=function(_0xbe8048,_0x1b31c6,_0x372a0f){var _0x5d5ec3={'raw':!![],'where':{}},_0x1f179c={},_0x5db8c5;return db[_0x9ed1('0x2e')][_0x9ed1('0x55')]({'where':{'id':_0xbe8048[_0x9ed1('0x53')]['id']}})[_0x9ed1('0x2a')](handleEntityNotFound(_0x1b31c6,null))[_0x9ed1('0x2a')](function(_0x5ee811){if(_0x5ee811){_0x5db8c5=_0x5ee811['get']({'plain':!![]});_0x1f179c[_0x9ed1('0x32')]=_['keys'](db[_0x9ed1('0x56')][_0x9ed1('0x2f')]);_0x1f179c[_0x9ed1('0x33')]=_[_0x9ed1('0x34')](_0xbe8048['query']);_0x1f179c[_0x9ed1('0x35')]=_[_0x9ed1('0x37')](_0x1f179c[_0x9ed1('0x32')],_0x1f179c['query']);_0x5d5ec3['attributes']=_['intersection'](_0x1f179c[_0x9ed1('0x32')],qs[_0x9ed1('0x38')](_0xbe8048[_0x9ed1('0x33')][_0x9ed1('0x38')]));_0x5d5ec3[_0x9ed1('0x36')]=_0x5d5ec3[_0x9ed1('0x36')][_0x9ed1('0x39')]?_0x5d5ec3['attributes']:_0x1f179c['model'];if(!_0xbe8048[_0x9ed1('0x33')][_0x9ed1('0x57')](_0x9ed1('0x3a'))){_0x5d5ec3[_0x9ed1('0x22')]=qs[_0x9ed1('0x22')](_0xbe8048['query'][_0x9ed1('0x22')]);_0x5d5ec3['offset']=qs[_0x9ed1('0x1f')](_0xbe8048[_0x9ed1('0x33')][_0x9ed1('0x1f')]);}_0x5d5ec3[_0x9ed1('0x3b')]=qs[_0x9ed1('0x3c')](_0xbe8048[_0x9ed1('0x33')][_0x9ed1('0x3c')]);_0x5d5ec3[_0x9ed1('0x3d')]=qs[_0x9ed1('0x35')](_[_0x9ed1('0x3e')](_0xbe8048[_0x9ed1('0x33')],_0x1f179c['filters']));_0x5d5ec3['where'][_0x9ed1('0x58')]=_0x5ee811['id'];if(_0xbe8048['query'][_0x9ed1('0x3f')]){_0x5d5ec3[_0x9ed1('0x3d')]=_['merge'](_0x5d5ec3[_0x9ed1('0x3d')],{'$or':_['map'](_0x5d5ec3[_0x9ed1('0x36')],function(_0x23cfe4){var _0x468dea={};_0x468dea[_0x23cfe4]={'$like':'%'+_0xbe8048[_0x9ed1('0x33')][_0x9ed1('0x3f')]+'%'};return _0x468dea;})});}_0x5d5ec3=_[_0x9ed1('0x40')]({},_0x5d5ec3,_0xbe8048[_0x9ed1('0x42')]);return db[_0x9ed1('0x56')]['findAll'](_0x5d5ec3);}})[_0x9ed1('0x2a')](function(_0x5e0d4b){if(_0x5e0d4b){return db[_0x9ed1('0x59')]['findAndCountAll']({'where':{'id':_[_0x9ed1('0x2d')](_0x5e0d4b,_0x9ed1('0x5a')),'role':_0x9ed1('0x5b')},'attributes':['id',_0x9ed1('0x2c'),_0x9ed1('0x5c'),_0x9ed1('0x5d'),_0x9ed1('0x5e')]});}})[_0x9ed1('0x2a')](function(_0x1b5019){if(_0x1b5019){return{'count':_0x1b5019['count'],'rows':_[_0x9ed1('0x2d')](_0x1b5019[_0x9ed1('0x45')],function(_0x4142d5){return{'membername':_0x4142d5[_0x9ed1('0x2c')],'UserId':_0x4142d5['id'],'queue_name':_0x5db8c5['name'],'WhatsappQueueId':_0x5db8c5['id'],'interface':util[_0x9ed1('0x5f')](_0x9ed1('0x60'),_0x9ed1('0x61'),_0x4142d5[_0x9ed1('0x2c')]),'penalty':0x0,'paused':_0x4142d5[_0x9ed1('0x5c')],'createdAt':_0x4142d5[_0x9ed1('0x5e')],'updatedAt':_0x4142d5[_0x9ed1('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9ed1('0x2a')](respondWithFilteredResult(_0x1b31c6,_0x5d5ec3))[_0x9ed1('0x46')](handleError(_0x1b31c6,null));};exports['getTeams']=function(_0x53cd50,_0x3b40a1,_0x1e7dc8){var _0x1f5e9d={};var _0x498731={};var _0xe498e9;var _0x3aec0a;return db[_0x9ed1('0x2e')][_0x9ed1('0x55')]({'where':{'id':_0x53cd50[_0x9ed1('0x53')]['id']}})[_0x9ed1('0x2a')](handleEntityNotFound(_0x3b40a1,null))[_0x9ed1('0x2a')](function(_0x3c2b02){if(_0x3c2b02){_0xe498e9=_0x3c2b02;_0x498731[_0x9ed1('0x32')]=_[_0x9ed1('0x34')](db['Team'][_0x9ed1('0x2f')]);_0x498731[_0x9ed1('0x33')]=_[_0x9ed1('0x34')](_0x53cd50[_0x9ed1('0x33')]);_0x498731[_0x9ed1('0x35')]=_['intersection'](_0x498731[_0x9ed1('0x32')],_0x498731['query']);_0x1f5e9d['attributes']=_[_0x9ed1('0x37')](_0x498731[_0x9ed1('0x32')],qs[_0x9ed1('0x38')](_0x53cd50['query'][_0x9ed1('0x38')]));_0x1f5e9d[_0x9ed1('0x36')]=_0x1f5e9d[_0x9ed1('0x36')][_0x9ed1('0x39')]?_0x1f5e9d[_0x9ed1('0x36')]:_0x498731[_0x9ed1('0x32')];_0x1f5e9d[_0x9ed1('0x3b')]=qs['sort'](_0x53cd50[_0x9ed1('0x33')][_0x9ed1('0x3c')]);_0x1f5e9d[_0x9ed1('0x3d')]=qs[_0x9ed1('0x35')](_[_0x9ed1('0x3e')](_0x53cd50[_0x9ed1('0x33')],_0x498731[_0x9ed1('0x35')]));if(_0x53cd50['query'][_0x9ed1('0x3f')]){_0x1f5e9d[_0x9ed1('0x3d')]=_[_0x9ed1('0x40')](_0x1f5e9d[_0x9ed1('0x3d')],{'$or':_[_0x9ed1('0x2d')](_0x1f5e9d['attributes'],function(_0x41e64d){var _0x28b44c={};_0x28b44c[_0x41e64d]={'$like':'%'+_0x53cd50[_0x9ed1('0x33')][_0x9ed1('0x3f')]+'%'};return _0x28b44c;})});}_0x1f5e9d=_[_0x9ed1('0x40')]({},_0x1f5e9d,_0x53cd50['options']);return _0xe498e9[_0x9ed1('0x62')](_0x1f5e9d);}})[_0x9ed1('0x2a')](function(_0x2e81b4){if(_0x2e81b4){_0x3aec0a=_0x2e81b4[_0x9ed1('0x39')];if(!_0x53cd50['query'][_0x9ed1('0x57')]('nolimit')){_0x1f5e9d[_0x9ed1('0x22')]=qs[_0x9ed1('0x22')](_0x53cd50[_0x9ed1('0x33')][_0x9ed1('0x22')]);_0x1f5e9d[_0x9ed1('0x1f')]=qs[_0x9ed1('0x1f')](_0x53cd50[_0x9ed1('0x33')][_0x9ed1('0x1f')]);}return _0xe498e9['getTeams'](_0x1f5e9d);}})[_0x9ed1('0x2a')](function(_0x217787){if(_0x217787){return _0x217787?{'count':_0x3aec0a,'rows':_0x217787}:null;}})[_0x9ed1('0x2a')](respondWithResult(_0x3b40a1,null))['catch'](handleError(_0x3b40a1,null));};exports[_0x9ed1('0x63')]=function(_0x398455,_0x22e2b5,_0x5df96f){var _0x3429c1=_0x398455[_0x9ed1('0x49')]['ids'];return db['Team']['findAll']({'where':{'id':_0x3429c1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9ed1('0x64'),'attributes':['id',_0x9ed1('0x2c'),_0x9ed1('0x65'),_0x9ed1('0x66'),_0x9ed1('0x67')],'raw':!![]}]})[_0x9ed1('0x2a')](function(_0x27d909){if(_0x27d909){var _0xa96b05=_['flatMap'](_0x27d909,function(_0x5a711a){var _0x5b6dd0=_0x5a711a[_0x9ed1('0x4b')]({'plain':!![]});return _0x5b6dd0['Agents'];});return db[_0x9ed1('0x2e')][_0x9ed1('0x4e')]({'where':{'id':_0x398455[_0x9ed1('0x53')]['id']}})[_0x9ed1('0x2a')](function(_0x177aba){return db[_0x9ed1('0x68')][_0x9ed1('0x69')](function(_0xcee8bb){return _0x177aba['addTeams'](_0x3429c1,{'transaction':_0xcee8bb})[_0x9ed1('0x2a')](function(){return BPromise[_0x9ed1('0x6a')](_0xa96b05,function(_0x4550e4){return db[_0x9ed1('0x56')]['findOrCreate']({'where':{'UserId':_0x4550e4['id'],'WhatsappQueueId':_0x398455[_0x9ed1('0x53')]['id']},'transaction':_0xcee8bb});});})[_0x9ed1('0x2a')](function(){_0xa96b05[_0x9ed1('0x6b')](function(_0x5757dc){socket[_0x9ed1('0x6c')]('userWhatsappQueue:save',{'UserId':_0x5757dc['id'],'WhatsappQueueId':_0x177aba['id']});});});});});}})[_0x9ed1('0x2a')](respondWithStatusCode(_0x22e2b5,null))[_0x9ed1('0x46')](handleError(_0x22e2b5,null));};exports[_0x9ed1('0x6d')]=function(_0x75a6ee,_0x45f4c7,_0x54cccc){return db[_0x9ed1('0x6e')]['findAll']({'where':{'id':_0x75a6ee[_0x9ed1('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9ed1('0x59')],'as':_0x9ed1('0x64'),'attributes':['id'],'raw':!![]}]})[_0x9ed1('0x2a')](handleEntityNotFound(_0x45f4c7,null))['then'](function(_0x4c9292){var _0x46e0b1=_[_0x9ed1('0x2d')](_0x4c9292,'id');var _0xd30e65=[];var _0x274cd0=[];var _0x595bfb=squel['select']();_0x595bfb[_0x9ed1('0x6f')](_0x9ed1('0x70'))[_0x9ed1('0x71')](_0x9ed1('0x72'),'tq')['join'](_0x9ed1('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9ed1('0x3d')](_0x9ed1('0x74'),_0x75a6ee[_0x9ed1('0x53')]['id']);for(var _0x298108=0x0;_0x298108<_0x4c9292['length'];_0x298108+=0x1){let _0x29150c=_0x4c9292[_0x298108];for(var _0x19a9fc=0x0;_0x19a9fc<_0x29150c[_0x9ed1('0x64')]['length'];_0x19a9fc+=0x1){let _0x1c9ed4=_0x29150c['Agents'][_0x19a9fc];var _0x1d7895=_0x595bfb[_0x9ed1('0x75')]();_0x1d7895[_0x9ed1('0x3d')](_0x9ed1('0x76'),_0x1c9ed4['id']);_0x274cd0[_0x9ed1('0x77')](db[_0x9ed1('0x68')][_0x9ed1('0x33')](_0x1d7895[_0x9ed1('0x78')](),{'type':db[_0x9ed1('0x68')][_0x9ed1('0x79')][_0x9ed1('0x7a')]})[_0x9ed1('0x2a')](function(_0x1180b3){if(_0x1180b3[_0x9ed1('0x39')]===0x1){return _0x1c9ed4['id'];}else{var _0x2deee2=_[_0x9ed1('0x7b')](_[_0x9ed1('0x2d')](_0x1180b3,_0x9ed1('0x7c')),function(_0x3f1aab){return _['includes'](_0x46e0b1,_0x3f1aab);});if(_0x2deee2){return _0x1c9ed4['id'];}}}));}}return BPromise[_0x9ed1('0x7d')](_0x274cd0)[_0x9ed1('0x2a')](function(_0x524329){_0xd30e65=_(_0xd30e65)[_0x9ed1('0x7e')](_0x524329)[_0x9ed1('0x7f')]()[_0x9ed1('0x80')]();return db[_0x9ed1('0x2e')][_0x9ed1('0x4e')]({'where':{'id':_0x75a6ee[_0x9ed1('0x53')]['id']}})[_0x9ed1('0x2a')](function(_0x405457){return db[_0x9ed1('0x68')]['transaction'](function(_0x36fae0){return _0x405457[_0x9ed1('0x6d')](_0x75a6ee[_0x9ed1('0x33')][_0x9ed1('0x81')],{'transaction':_0x36fae0})['then'](function(){if(!_[_0x9ed1('0x82')](_0xd30e65)){return _0x405457['removeAgents'](_0xd30e65,{'transaction':_0x36fae0});}})['then'](function(){_0xd30e65[_0x9ed1('0x6b')](function(_0x494ef0){socket[_0x9ed1('0x6c')](_0x9ed1('0x83'),{'UserId':_0x494ef0,'WhatsappQueueId':_0x405457['id']});});});});});});})['then'](respondWithStatusCode(_0x45f4c7,null))[_0x9ed1('0x46')](handleError(_0x45f4c7,null));};exports[_0x9ed1('0x84')]=function(_0x19ebba,_0x429376,_0x4127fc){return db[_0x9ed1('0x2e')][_0x9ed1('0x4e')]({'where':{'id':_0x19ebba[_0x9ed1('0x53')]['id']}})['then'](handleEntityNotFound(_0x429376,null))['then'](function(_0x19a79d){if(_0x19a79d){return _0x19a79d[_0x9ed1('0x84')](_0x19ebba['body'][_0x9ed1('0x81')],_[_0x9ed1('0x85')](_0x19ebba['body'],[_0x9ed1('0x81'),'id'])||{})[_0x9ed1('0x86')](function(_0x4d3724){for(var _0x280c49=0x0;_0x280c49<_0x19ebba['body'][_0x9ed1('0x81')][_0x9ed1('0x39')];_0x280c49+=0x1){socket[_0x9ed1('0x6c')](_0x9ed1('0x87'),{'UserId':Number(_0x19ebba[_0x9ed1('0x49')][_0x9ed1('0x81')][_0x280c49]),'WhatsappQueueId':Number(_0x19ebba[_0x9ed1('0x53')]['id'])});}return _0x4d3724;});}})[_0x9ed1('0x2a')](respondWithResult(_0x429376,null))[_0x9ed1('0x46')](handleError(_0x429376,null));};exports[_0x9ed1('0x88')]=function(_0x3d05f5,_0x447675,_0x27d3f0){return db[_0x9ed1('0x2e')][_0x9ed1('0x4e')]({'where':{'id':_0x3d05f5[_0x9ed1('0x53')]['id']}})[_0x9ed1('0x2a')](handleEntityNotFound(_0x447675,null))[_0x9ed1('0x2a')](function(_0x530b23){if(_0x530b23){return _0x530b23[_0x9ed1('0x88')](_0x3d05f5[_0x9ed1('0x33')][_0x9ed1('0x81')])[_0x9ed1('0x2a')](function(){if(_[_0x9ed1('0x89')](_0x3d05f5[_0x9ed1('0x33')][_0x9ed1('0x81')])){for(var _0x59501f=0x0;_0x59501f<_0x3d05f5[_0x9ed1('0x33')][_0x9ed1('0x81')][_0x9ed1('0x39')];_0x59501f+=0x1){socket[_0x9ed1('0x6c')](_0x9ed1('0x83'),{'UserId':Number(_0x3d05f5[_0x9ed1('0x33')][_0x9ed1('0x81')][_0x59501f]),'WhatsappQueueId':Number(_0x3d05f5[_0x9ed1('0x53')]['id'])});}}else{socket[_0x9ed1('0x6c')](_0x9ed1('0x83'),{'UserId':Number(_0x3d05f5[_0x9ed1('0x33')][_0x9ed1('0x81')]),'WhatsappQueueId':Number(_0x3d05f5[_0x9ed1('0x53')]['id'])});}});}})[_0x9ed1('0x2a')](respondWithStatusCode(_0x447675,null))[_0x9ed1('0x46')](handleError(_0x447675,null));};exports[_0x9ed1('0x8a')]=function(_0x1808f9,_0xb2eeaf,_0x2d6506){var _0x2ee64e={};var _0xfbdf14={};var _0x54de99;var _0x26c559;return db['WhatsappQueue'][_0x9ed1('0x55')]({'where':{'id':_0x1808f9[_0x9ed1('0x53')]['id']}})[_0x9ed1('0x2a')](handleEntityNotFound(_0xb2eeaf,null))[_0x9ed1('0x2a')](function(_0x25ea49){if(_0x25ea49){_0x54de99=_0x25ea49;_0xfbdf14[_0x9ed1('0x32')]=_[_0x9ed1('0x34')](db['User'][_0x9ed1('0x2f')]);_0xfbdf14[_0x9ed1('0x33')]=_[_0x9ed1('0x34')](_0x1808f9['query']);_0xfbdf14['filters']=_[_0x9ed1('0x37')](_0xfbdf14['model'],_0xfbdf14[_0x9ed1('0x33')]);_0x2ee64e[_0x9ed1('0x36')]=_['intersection'](_0xfbdf14[_0x9ed1('0x32')],qs[_0x9ed1('0x38')](_0x1808f9[_0x9ed1('0x33')][_0x9ed1('0x38')]));_0x2ee64e['attributes']=_0x2ee64e['attributes'][_0x9ed1('0x39')]?_0x2ee64e[_0x9ed1('0x36')]:_0xfbdf14['model'];_0x2ee64e[_0x9ed1('0x3b')]=qs[_0x9ed1('0x3c')](_0x1808f9[_0x9ed1('0x33')][_0x9ed1('0x3c')]);_0x2ee64e[_0x9ed1('0x3d')]=qs[_0x9ed1('0x35')](_['pick'](_0x1808f9['query'],_0xfbdf14['filters']));if(_0x1808f9[_0x9ed1('0x33')][_0x9ed1('0x3f')]){_0x2ee64e[_0x9ed1('0x3d')]=_['merge'](_0x2ee64e['where'],{'$or':_[_0x9ed1('0x2d')](_0x2ee64e[_0x9ed1('0x36')],function(_0x46caa2){var _0x36948d={};_0x36948d[_0x46caa2]={'$like':'%'+_0x1808f9[_0x9ed1('0x33')][_0x9ed1('0x3f')]+'%'};return _0x36948d;})});}_0x2ee64e=_[_0x9ed1('0x40')]({},_0x2ee64e,_0x1808f9['options']);return _0x54de99[_0x9ed1('0x8a')](_0x2ee64e);}})[_0x9ed1('0x2a')](function(_0x3cc231){if(_0x3cc231){_0x26c559=_0x3cc231[_0x9ed1('0x39')];if(!_0x1808f9['query'][_0x9ed1('0x57')](_0x9ed1('0x3a'))){_0x2ee64e[_0x9ed1('0x22')]=qs['limit'](_0x1808f9[_0x9ed1('0x33')]['limit']);_0x2ee64e['offset']=qs[_0x9ed1('0x1f')](_0x1808f9[_0x9ed1('0x33')]['offset']);}return _0x54de99[_0x9ed1('0x8a')](_0x2ee64e);}})['then'](function(_0x2815a6){if(_0x2815a6){return _0x2815a6?{'count':_0x26c559,'rows':_0x2815a6}:null;}})[_0x9ed1('0x2a')](respondWithResult(_0xb2eeaf,null))['catch'](handleError(_0xb2eeaf,null));}; \ No newline at end of file +var _0x56d1=['merge','VIRTUAL','filter','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','getMembers','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','options','Agents','online','interface','flatMap','transaction','addTeams','each','forEach','emit','removeTeams','ids','select','field','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','every','TeamId','includes','all','compact','value','removeAgents','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','WhatsappQueues','destroy','status','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x56d1,0x14b));var _0x156d=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x56d1[_0x21bfab];return _0x4db318;};'use strict';var emlformat=require(_0x156d('0x0'));var rimraf=require(_0x156d('0x1'));var zipdir=require(_0x156d('0x2'));var jsonpatch=require(_0x156d('0x3'));var rp=require('request-promise');var moment=require(_0x156d('0x4'));var BPromise=require(_0x156d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x156d('0x6'));var sox=require(_0x156d('0x7'));var csv=require(_0x156d('0x8'));var ejs=require(_0x156d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x156d('0xa'));var squel=require(_0x156d('0xb'));var crypto=require('crypto');var jsforce=require(_0x156d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x156d('0x8'));var querystring=require('querystring');var Papa=require(_0x156d('0xd'));var Redis=require('ioredis');var authService=require(_0x156d('0xe'));var qs=require(_0x156d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x156d('0x10'))(_0x156d('0x11'));var utils=require(_0x156d('0x12'));var config=require(_0x156d('0x13'));var licenseUtil=require(_0x156d('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x156d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x156d('0x16'))(new Redis(config[_0x156d('0x15')]));require(_0x156d('0x17'))[_0x156d('0x18')](socket);function respondWithStatusCode(_0x153aa3,_0xf61e9a){_0xf61e9a=_0xf61e9a||0xcc;return function(_0x58d58d){if(_0x58d58d){return _0x153aa3[_0x156d('0x19')](_0xf61e9a);}return _0x153aa3['status'](_0xf61e9a)[_0x156d('0x1a')]();};}function respondWithResult(_0x20b201,_0xdfefc7){_0xdfefc7=_0xdfefc7||0xc8;return function(_0x1ba3c9){if(_0x1ba3c9){return _0x20b201['status'](_0xdfefc7)[_0x156d('0x1b')](_0x1ba3c9);}};}function respondWithFilteredResult(_0x13f83,_0xcebe16){return function(_0x4b99e7){if(_0x4b99e7){var _0xb565ee=typeof _0xcebe16[_0x156d('0x1c')]===_0x156d('0x1d')&&typeof _0xcebe16[_0x156d('0x1e')]===_0x156d('0x1d');var _0xbbd78=_0x4b99e7[_0x156d('0x1f')];var _0x7cc950=_0xb565ee?0x0:_0xcebe16[_0x156d('0x1c')];var _0x8f9d45=_0xb565ee?_0x4b99e7[_0x156d('0x1f')]:_0xcebe16[_0x156d('0x1c')]+_0xcebe16[_0x156d('0x1e')];var _0x58cfb3;if(_0x8f9d45>=_0xbbd78){_0x8f9d45=_0xbbd78;_0x58cfb3=0xc8;}else{_0x58cfb3=0xce;}_0x13f83['status'](_0x58cfb3);return _0x13f83['set'](_0x156d('0x20'),_0x7cc950+'-'+_0x8f9d45+'/'+_0xbbd78)[_0x156d('0x1b')](_0x4b99e7);}return null;};}function patchUpdates(_0x23557e){return function(_0x40594f){try{jsonpatch[_0x156d('0x21')](_0x40594f,_0x23557e,!![]);}catch(_0x32d14f){return BPromise[_0x156d('0x22')](_0x32d14f);}return _0x40594f[_0x156d('0x23')]();};}function saveUpdates(_0x325c40,_0xde223){return function(_0x5e540f){if(_0x5e540f){return _0x5e540f[_0x156d('0x24')](_0x325c40)[_0x156d('0x25')](function(_0x4c6507){return _0x4c6507;});}return null;};}function removeEntity(_0xa04363,_0x257d2c){return function(_0x1f3285){if(_0x1f3285){return _0x1f3285['destroy']()[_0x156d('0x25')](function(){var _0x6d2e14=_0x1f3285[_0x156d('0x26')]({'plain':!![]});var _0x46a6e8=_0x156d('0x27');return db['UserProfileResource'][_0x156d('0x28')]({'where':{'type':_0x46a6e8,'resourceId':_0x6d2e14['id']}})[_0x156d('0x25')](function(){return _0x1f3285;});})[_0x156d('0x25')](function(){_0xa04363[_0x156d('0x29')](0xcc)[_0x156d('0x1a')]();});}};}function handleEntityNotFound(_0x49d55f,_0x4078b9){return function(_0xc520d2){if(!_0xc520d2){_0x49d55f[_0x156d('0x19')](0x194);}return _0xc520d2;};}function handleError(_0x305e1b,_0x5d5dc1){_0x5d5dc1=_0x5d5dc1||0x1f4;return function(_0x23b1f9){logger[_0x156d('0x2a')](_0x23b1f9[_0x156d('0x2b')]);if(_0x23b1f9[_0x156d('0x2c')]){delete _0x23b1f9['name'];}_0x305e1b[_0x156d('0x29')](_0x5d5dc1)[_0x156d('0x2d')](_0x23b1f9);};}exports[_0x156d('0x2e')]=function(_0x4c96b1,_0x166067){var _0x2515e9={},_0x200715={},_0x3ef7f9={'count':0x0,'rows':[]};var _0xbb1ca=_[_0x156d('0x2f')](db['WhatsappQueue'][_0x156d('0x30')],function(_0x43e44b){return{'name':_0x43e44b[_0x156d('0x31')],'type':_0x43e44b[_0x156d('0x32')]['key']};});_0x200715['model']=_[_0x156d('0x2f')](_0xbb1ca,_0x156d('0x2c'));_0x200715[_0x156d('0x33')]=_[_0x156d('0x34')](_0x4c96b1[_0x156d('0x33')]);_0x200715[_0x156d('0x35')]=_[_0x156d('0x36')](_0x200715[_0x156d('0x37')],_0x200715['query']);_0x2515e9[_0x156d('0x38')]=_[_0x156d('0x36')](_0x200715[_0x156d('0x37')],qs[_0x156d('0x39')](_0x4c96b1[_0x156d('0x33')][_0x156d('0x39')]));_0x2515e9[_0x156d('0x38')]=_0x2515e9['attributes'][_0x156d('0x3a')]?_0x2515e9[_0x156d('0x38')]:_0x200715['model'];if(!_0x4c96b1[_0x156d('0x33')][_0x156d('0x3b')](_0x156d('0x3c'))){_0x2515e9['limit']=qs[_0x156d('0x1e')](_0x4c96b1[_0x156d('0x33')][_0x156d('0x1e')]);_0x2515e9[_0x156d('0x1c')]=qs[_0x156d('0x1c')](_0x4c96b1[_0x156d('0x33')][_0x156d('0x1c')]);}_0x2515e9[_0x156d('0x3d')]=qs[_0x156d('0x3e')](_0x4c96b1[_0x156d('0x33')][_0x156d('0x3e')]);_0x2515e9[_0x156d('0x3f')]=qs[_0x156d('0x35')](_[_0x156d('0x40')](_0x4c96b1[_0x156d('0x33')],_0x200715['filters']),_0xbb1ca);if(_0x4c96b1[_0x156d('0x33')]['filter']){_0x2515e9[_0x156d('0x3f')]=_[_0x156d('0x41')](_0x2515e9['where'],{'$or':_[_0x156d('0x2f')](_0xbb1ca,function(_0x30dc2b){if(_0x30dc2b[_0x156d('0x32')]!==_0x156d('0x42')){var _0xe36bc2={};_0xe36bc2[_0x30dc2b['name']]={'$like':'%'+_0x4c96b1[_0x156d('0x33')][_0x156d('0x43')]+'%'};return _0xe36bc2;}})});}_0x2515e9=_[_0x156d('0x41')]({},_0x2515e9,_0x4c96b1['options']);var _0xa835be={'where':_0x2515e9['where']};return db[_0x156d('0x44')]['count'](_0xa835be)[_0x156d('0x25')](function(_0x34997f){_0x3ef7f9['count']=_0x34997f;if(_0x4c96b1[_0x156d('0x33')][_0x156d('0x45')]){_0x2515e9[_0x156d('0x46')]=[{'all':!![]}];}return db[_0x156d('0x44')][_0x156d('0x47')](_0x2515e9);})[_0x156d('0x25')](function(_0x4c792e){_0x3ef7f9[_0x156d('0x48')]=_0x4c792e;return _0x3ef7f9;})[_0x156d('0x25')](respondWithFilteredResult(_0x166067,_0x2515e9))[_0x156d('0x49')](handleError(_0x166067,null));};exports[_0x156d('0x4a')]=function(_0x9e5bf2,_0x4203a1){var _0x5d60d2={'raw':!![],'where':{'id':_0x9e5bf2[_0x156d('0x4b')]['id']}},_0x1c9b85={};_0x1c9b85['model']=_[_0x156d('0x34')](db[_0x156d('0x44')][_0x156d('0x30')]);_0x1c9b85[_0x156d('0x33')]=_[_0x156d('0x34')](_0x9e5bf2['query']);_0x1c9b85[_0x156d('0x35')]=_[_0x156d('0x36')](_0x1c9b85[_0x156d('0x37')],_0x1c9b85[_0x156d('0x33')]);_0x5d60d2[_0x156d('0x38')]=_[_0x156d('0x36')](_0x1c9b85[_0x156d('0x37')],qs[_0x156d('0x39')](_0x9e5bf2['query'][_0x156d('0x39')]));_0x5d60d2[_0x156d('0x38')]=_0x5d60d2[_0x156d('0x38')][_0x156d('0x3a')]?_0x5d60d2[_0x156d('0x38')]:_0x1c9b85[_0x156d('0x37')];if(_0x9e5bf2[_0x156d('0x33')][_0x156d('0x45')]){_0x5d60d2[_0x156d('0x46')]=[{'all':!![]}];}_0x5d60d2=_['merge']({},_0x5d60d2,_0x9e5bf2['options']);return db[_0x156d('0x44')][_0x156d('0x4c')](_0x5d60d2)[_0x156d('0x25')](handleEntityNotFound(_0x4203a1,null))[_0x156d('0x25')](respondWithResult(_0x4203a1,null))[_0x156d('0x49')](handleError(_0x4203a1,null));};exports[_0x156d('0x4d')]=function(_0x48cc8c,_0x1ba6a2){return db[_0x156d('0x44')][_0x156d('0x4d')](_0x48cc8c[_0x156d('0x4e')],{})[_0x156d('0x25')](function(_0x5e8289){var _0x2144ff=_0x48cc8c['user'][_0x156d('0x26')]({'plain':!![]});if(!_0x2144ff)throw new Error(_0x156d('0x4f'));if(_0x2144ff[_0x156d('0x50')]==='user'){var _0x58527b=_0x5e8289[_0x156d('0x26')]({'plain':!![]});var _0x492310=_0x156d('0x27');return db[_0x156d('0x51')][_0x156d('0x4c')]({'where':{'name':_0x492310,'userProfileId':_0x2144ff[_0x156d('0x52')]},'raw':!![]})[_0x156d('0x25')](function(_0x428995){if(_0x428995&&_0x428995['autoAssociation']===0x0){return db['UserProfileResource'][_0x156d('0x4d')]({'name':_0x58527b[_0x156d('0x2c')],'resourceId':_0x58527b['id'],'type':_0x428995['name'],'sectionId':_0x428995['id']},{})[_0x156d('0x25')](function(){return _0x5e8289;});}else{return _0x5e8289;}})[_0x156d('0x49')](function(_0x27a643){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27a643);throw _0x27a643;});}return _0x5e8289;})[_0x156d('0x25')](respondWithResult(_0x1ba6a2,0xc9))[_0x156d('0x49')](handleError(_0x1ba6a2,null));};exports['update']=function(_0x27e610,_0x40aa33){if(_0x27e610['body']['id']){delete _0x27e610[_0x156d('0x4e')]['id'];}return db['WhatsappQueue'][_0x156d('0x4c')]({'where':{'id':_0x27e610[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x40aa33,null))['then'](saveUpdates(_0x27e610[_0x156d('0x4e')],null))[_0x156d('0x25')](respondWithResult(_0x40aa33,null))['catch'](handleError(_0x40aa33,null));};exports[_0x156d('0x28')]=function(_0x3cb166,_0x4b5685){return db[_0x156d('0x44')][_0x156d('0x4c')]({'where':{'id':_0x3cb166[_0x156d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b5685,null))[_0x156d('0x25')](removeEntity(_0x4b5685,null))['catch'](handleError(_0x4b5685,null));};exports[_0x156d('0x53')]=function(_0x417cea,_0xe6ac0a){return db[_0x156d('0x44')][_0x156d('0x53')]()['then'](respondWithResult(_0xe6ac0a,null))[_0x156d('0x49')](handleError(_0xe6ac0a,null));};exports[_0x156d('0x54')]=function(_0x17e578,_0x32b00e,_0x177ccf){var _0x39c29f={'raw':!![],'where':{}},_0x78547c={},_0x4ad4b9;return db[_0x156d('0x44')]['findOne']({'where':{'id':_0x17e578[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x32b00e,null))[_0x156d('0x25')](function(_0x5731f6){if(_0x5731f6){_0x4ad4b9=_0x5731f6['get']({'plain':!![]});_0x78547c[_0x156d('0x37')]=_['keys'](db['UserWhatsappQueue'][_0x156d('0x30')]);_0x78547c['query']=_[_0x156d('0x34')](_0x17e578[_0x156d('0x33')]);_0x78547c['filters']=_[_0x156d('0x36')](_0x78547c[_0x156d('0x37')],_0x78547c[_0x156d('0x33')]);_0x39c29f['attributes']=_[_0x156d('0x36')](_0x78547c['model'],qs[_0x156d('0x39')](_0x17e578[_0x156d('0x33')][_0x156d('0x39')]));_0x39c29f[_0x156d('0x38')]=_0x39c29f[_0x156d('0x38')][_0x156d('0x3a')]?_0x39c29f['attributes']:_0x78547c[_0x156d('0x37')];if(!_0x17e578[_0x156d('0x33')][_0x156d('0x3b')]('nolimit')){_0x39c29f['limit']=qs[_0x156d('0x1e')](_0x17e578[_0x156d('0x33')]['limit']);_0x39c29f[_0x156d('0x1c')]=qs[_0x156d('0x1c')](_0x17e578[_0x156d('0x33')][_0x156d('0x1c')]);}_0x39c29f[_0x156d('0x3d')]=qs[_0x156d('0x3e')](_0x17e578['query'][_0x156d('0x3e')]);_0x39c29f['where']=qs[_0x156d('0x35')](_[_0x156d('0x40')](_0x17e578[_0x156d('0x33')],_0x78547c[_0x156d('0x35')]));_0x39c29f['where'][_0x156d('0x55')]=_0x5731f6['id'];if(_0x17e578['query'][_0x156d('0x43')]){_0x39c29f[_0x156d('0x3f')]=_[_0x156d('0x41')](_0x39c29f[_0x156d('0x3f')],{'$or':_[_0x156d('0x2f')](_0x39c29f[_0x156d('0x38')],function(_0x1d7779){var _0x2a8173={};_0x2a8173[_0x1d7779]={'$like':'%'+_0x17e578[_0x156d('0x33')][_0x156d('0x43')]+'%'};return _0x2a8173;})});}_0x39c29f=_[_0x156d('0x41')]({},_0x39c29f,_0x17e578['options']);return db[_0x156d('0x56')][_0x156d('0x47')](_0x39c29f);}})[_0x156d('0x25')](function(_0x190e97){if(_0x190e97){return db[_0x156d('0x57')][_0x156d('0x58')]({'where':{'id':_[_0x156d('0x2f')](_0x190e97,'UserId'),'role':_0x156d('0x59')},'attributes':['id','name',_0x156d('0x5a'),_0x156d('0x5b'),_0x156d('0x5c')]});}})[_0x156d('0x25')](function(_0x3b7e42){if(_0x3b7e42){return{'count':_0x3b7e42[_0x156d('0x1f')],'rows':_[_0x156d('0x2f')](_0x3b7e42[_0x156d('0x48')],function(_0x3c555a){return{'membername':_0x3c555a[_0x156d('0x2c')],'UserId':_0x3c555a['id'],'queue_name':_0x4ad4b9[_0x156d('0x2c')],'WhatsappQueueId':_0x4ad4b9['id'],'interface':util['format'](_0x156d('0x5d'),_0x156d('0x5e'),_0x3c555a['name']),'penalty':0x0,'paused':_0x3c555a[_0x156d('0x5a')],'createdAt':_0x3c555a[_0x156d('0x5c')],'updatedAt':_0x3c555a[_0x156d('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x156d('0x25')](respondWithFilteredResult(_0x32b00e,_0x39c29f))['catch'](handleError(_0x32b00e,null));};exports[_0x156d('0x5f')]=function(_0x3f1003,_0x30916d,_0x341760){var _0x536446={};var _0x5e4f51={};var _0x519009;var _0x341959;return db[_0x156d('0x44')][_0x156d('0x60')]({'where':{'id':_0x3f1003[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x30916d,null))[_0x156d('0x25')](function(_0x46cdef){if(_0x46cdef){_0x519009=_0x46cdef;_0x5e4f51[_0x156d('0x37')]=_[_0x156d('0x34')](db[_0x156d('0x61')][_0x156d('0x30')]);_0x5e4f51[_0x156d('0x33')]=_[_0x156d('0x34')](_0x3f1003[_0x156d('0x33')]);_0x5e4f51['filters']=_[_0x156d('0x36')](_0x5e4f51['model'],_0x5e4f51[_0x156d('0x33')]);_0x536446[_0x156d('0x38')]=_[_0x156d('0x36')](_0x5e4f51[_0x156d('0x37')],qs[_0x156d('0x39')](_0x3f1003['query'][_0x156d('0x39')]));_0x536446['attributes']=_0x536446['attributes'][_0x156d('0x3a')]?_0x536446[_0x156d('0x38')]:_0x5e4f51[_0x156d('0x37')];_0x536446[_0x156d('0x3d')]=qs[_0x156d('0x3e')](_0x3f1003['query'][_0x156d('0x3e')]);_0x536446[_0x156d('0x3f')]=qs[_0x156d('0x35')](_[_0x156d('0x40')](_0x3f1003[_0x156d('0x33')],_0x5e4f51[_0x156d('0x35')]));if(_0x3f1003[_0x156d('0x33')][_0x156d('0x43')]){_0x536446[_0x156d('0x3f')]=_[_0x156d('0x41')](_0x536446[_0x156d('0x3f')],{'$or':_[_0x156d('0x2f')](_0x536446[_0x156d('0x38')],function(_0x132f86){var _0x500806={};_0x500806[_0x132f86]={'$like':'%'+_0x3f1003['query'][_0x156d('0x43')]+'%'};return _0x500806;})});}_0x536446=_[_0x156d('0x41')]({},_0x536446,_0x3f1003[_0x156d('0x62')]);return _0x519009['getTeams'](_0x536446);}})[_0x156d('0x25')](function(_0x1fae60){if(_0x1fae60){_0x341959=_0x1fae60[_0x156d('0x3a')];if(!_0x3f1003[_0x156d('0x33')]['hasOwnProperty'](_0x156d('0x3c'))){_0x536446[_0x156d('0x1e')]=qs[_0x156d('0x1e')](_0x3f1003[_0x156d('0x33')][_0x156d('0x1e')]);_0x536446[_0x156d('0x1c')]=qs[_0x156d('0x1c')](_0x3f1003['query'][_0x156d('0x1c')]);}return _0x519009[_0x156d('0x5f')](_0x536446);}})['then'](function(_0x274f94){if(_0x274f94){return _0x274f94?{'count':_0x341959,'rows':_0x274f94}:null;}})[_0x156d('0x25')](respondWithResult(_0x30916d,null))[_0x156d('0x49')](handleError(_0x30916d,null));};exports['addTeams']=function(_0x200817,_0x3aded6,_0x5e22ab){var _0x5c58be=_0x200817[_0x156d('0x4e')]['ids'];return db[_0x156d('0x61')][_0x156d('0x47')]({'where':{'id':_0x5c58be},'attributes':['id'],'include':[{'model':db['User'],'as':_0x156d('0x63'),'attributes':['id',_0x156d('0x2c'),_0x156d('0x64'),'voicePause',_0x156d('0x65')],'raw':!![]}]})[_0x156d('0x25')](function(_0x2fcb8e){if(_0x2fcb8e){var _0x1ccae=_[_0x156d('0x66')](_0x2fcb8e,function(_0x44df0e){var _0x19b020=_0x44df0e[_0x156d('0x26')]({'plain':!![]});return _0x19b020[_0x156d('0x63')];});return db['WhatsappQueue']['find']({'where':{'id':_0x200817[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](function(_0x1fc18e){return db['sequelize'][_0x156d('0x67')](function(_0x2d0c84){return _0x1fc18e[_0x156d('0x68')](_0x5c58be,{'transaction':_0x2d0c84})[_0x156d('0x25')](function(){return BPromise[_0x156d('0x69')](_0x1ccae,function(_0x3adaf8){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x3adaf8['id'],'WhatsappQueueId':_0x200817[_0x156d('0x4b')]['id']},'transaction':_0x2d0c84});});})[_0x156d('0x25')](function(){_0x1ccae[_0x156d('0x6a')](function(_0x44194c){socket[_0x156d('0x6b')]('userWhatsappQueue:save',{'UserId':_0x44194c['id'],'WhatsappQueueId':_0x1fc18e['id']});});});});});}})[_0x156d('0x25')](respondWithStatusCode(_0x3aded6,null))[_0x156d('0x49')](handleError(_0x3aded6,null));};exports[_0x156d('0x6c')]=function(_0x3655fe,_0x3cfeff,_0x20a363){return db[_0x156d('0x61')]['findAll']({'where':{'id':_0x3655fe[_0x156d('0x33')][_0x156d('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x156d('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3cfeff,null))[_0x156d('0x25')](function(_0x26abc2){var _0x4eb985=_[_0x156d('0x2f')](_0x26abc2,'id');var _0x4136ea=[];var _0x39b667=[];var _0x114f7b=squel[_0x156d('0x6e')]();_0x114f7b[_0x156d('0x6f')]('tq.TeamId')[_0x156d('0x70')](_0x156d('0x71'),'tq')['join'](_0x156d('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x156d('0x3f')](_0x156d('0x73'),_0x3655fe[_0x156d('0x4b')]['id']);for(var _0xe3740d=0x0;_0xe3740d<_0x26abc2[_0x156d('0x3a')];_0xe3740d+=0x1){let _0x19fd48=_0x26abc2[_0xe3740d];for(var _0x256bb7=0x0;_0x256bb7<_0x19fd48[_0x156d('0x63')][_0x156d('0x3a')];_0x256bb7+=0x1){let _0x2ec3fa=_0x19fd48[_0x156d('0x63')][_0x256bb7];var _0x194aae=_0x114f7b['clone']();_0x194aae[_0x156d('0x3f')](_0x156d('0x74'),_0x2ec3fa['id']);_0x39b667[_0x156d('0x75')](db['sequelize'][_0x156d('0x33')](_0x194aae[_0x156d('0x76')](),{'type':db[_0x156d('0x77')]['QueryTypes']['SELECT']})[_0x156d('0x25')](function(_0x2a8c15){if(_0x2a8c15['length']===0x1){return _0x2ec3fa['id'];}else{var _0x10cddc=_[_0x156d('0x78')](_[_0x156d('0x2f')](_0x2a8c15,_0x156d('0x79')),function(_0x349fd8){return _[_0x156d('0x7a')](_0x4eb985,_0x349fd8);});if(_0x10cddc){return _0x2ec3fa['id'];}}}));}}return BPromise[_0x156d('0x7b')](_0x39b667)[_0x156d('0x25')](function(_0x3136cc){_0x4136ea=_(_0x4136ea)['union'](_0x3136cc)[_0x156d('0x7c')]()[_0x156d('0x7d')]();return db['WhatsappQueue'][_0x156d('0x4c')]({'where':{'id':_0x3655fe[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](function(_0x3e70cd){return db[_0x156d('0x77')][_0x156d('0x67')](function(_0x5933cd){return _0x3e70cd[_0x156d('0x6c')](_0x3655fe[_0x156d('0x33')][_0x156d('0x6d')],{'transaction':_0x5933cd})[_0x156d('0x25')](function(){if(!_['isEmpty'](_0x4136ea)){return _0x3e70cd[_0x156d('0x7e')](_0x4136ea,{'transaction':_0x5933cd});}})[_0x156d('0x25')](function(){_0x4136ea[_0x156d('0x6a')](function(_0x25ba70){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x25ba70,'WhatsappQueueId':_0x3e70cd['id']});});});});});});})[_0x156d('0x25')](respondWithStatusCode(_0x3cfeff,null))[_0x156d('0x49')](handleError(_0x3cfeff,null));};exports['addAgents']=function(_0x37ee12,_0x5eacae,_0x8f3f43){return db[_0x156d('0x44')]['find']({'where':{'id':_0x37ee12[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x5eacae,null))[_0x156d('0x25')](function(_0x56d35f){if(_0x56d35f){return _0x56d35f['addAgents'](_0x37ee12['body'][_0x156d('0x6d')],_['omit'](_0x37ee12[_0x156d('0x4e')],['ids','id'])||{})[_0x156d('0x7f')](function(_0xe2786){for(var _0x68f116=0x0;_0x68f116<_0x37ee12['body'][_0x156d('0x6d')][_0x156d('0x3a')];_0x68f116+=0x1){socket[_0x156d('0x6b')](_0x156d('0x80'),{'UserId':Number(_0x37ee12[_0x156d('0x4e')]['ids'][_0x68f116]),'WhatsappQueueId':Number(_0x37ee12[_0x156d('0x4b')]['id'])});}return _0xe2786;});}})[_0x156d('0x25')](respondWithResult(_0x5eacae,null))[_0x156d('0x49')](handleError(_0x5eacae,null));};exports[_0x156d('0x7e')]=function(_0x21de07,_0xc6e6fa,_0x28841d){return db['WhatsappQueue'][_0x156d('0x4c')]({'where':{'id':_0x21de07[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0xc6e6fa,null))[_0x156d('0x25')](function(_0x10aade){if(_0x10aade){return _0x10aade['removeAgents'](_0x21de07[_0x156d('0x33')][_0x156d('0x6d')])[_0x156d('0x25')](function(){if(_[_0x156d('0x81')](_0x21de07[_0x156d('0x33')][_0x156d('0x6d')])){for(var _0x5d2fac=0x0;_0x5d2fac<_0x21de07[_0x156d('0x33')][_0x156d('0x6d')][_0x156d('0x3a')];_0x5d2fac+=0x1){socket[_0x156d('0x6b')](_0x156d('0x82'),{'UserId':Number(_0x21de07[_0x156d('0x33')][_0x156d('0x6d')][_0x5d2fac]),'WhatsappQueueId':Number(_0x21de07[_0x156d('0x4b')]['id'])});}}else{socket[_0x156d('0x6b')](_0x156d('0x82'),{'UserId':Number(_0x21de07['query'][_0x156d('0x6d')]),'WhatsappQueueId':Number(_0x21de07[_0x156d('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0xc6e6fa,null))[_0x156d('0x49')](handleError(_0xc6e6fa,null));};exports[_0x156d('0x83')]=function(_0x48f9aa,_0x41da4a,_0x5f5126){var _0x28e046={};var _0x1c74ce={};var _0x1fc567;var _0x45b53b;return db['WhatsappQueue']['findOne']({'where':{'id':_0x48f9aa[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x41da4a,null))[_0x156d('0x25')](function(_0x42f517){if(_0x42f517){_0x1fc567=_0x42f517;_0x1c74ce[_0x156d('0x37')]=_[_0x156d('0x34')](db[_0x156d('0x57')][_0x156d('0x30')]);_0x1c74ce[_0x156d('0x33')]=_['keys'](_0x48f9aa['query']);_0x1c74ce[_0x156d('0x35')]=_[_0x156d('0x36')](_0x1c74ce[_0x156d('0x37')],_0x1c74ce[_0x156d('0x33')]);_0x28e046[_0x156d('0x38')]=_[_0x156d('0x36')](_0x1c74ce[_0x156d('0x37')],qs['fields'](_0x48f9aa[_0x156d('0x33')][_0x156d('0x39')]));_0x28e046[_0x156d('0x38')]=_0x28e046[_0x156d('0x38')]['length']?_0x28e046[_0x156d('0x38')]:_0x1c74ce[_0x156d('0x37')];_0x28e046[_0x156d('0x3d')]=qs[_0x156d('0x3e')](_0x48f9aa['query'][_0x156d('0x3e')]);_0x28e046[_0x156d('0x3f')]=qs[_0x156d('0x35')](_[_0x156d('0x40')](_0x48f9aa[_0x156d('0x33')],_0x1c74ce[_0x156d('0x35')]));if(_0x48f9aa[_0x156d('0x33')][_0x156d('0x43')]){_0x28e046['where']=_[_0x156d('0x41')](_0x28e046['where'],{'$or':_[_0x156d('0x2f')](_0x28e046[_0x156d('0x38')],function(_0xde90e0){var _0x7027fa={};_0x7027fa[_0xde90e0]={'$like':'%'+_0x48f9aa['query'][_0x156d('0x43')]+'%'};return _0x7027fa;})});}_0x28e046=_[_0x156d('0x41')]({},_0x28e046,_0x48f9aa[_0x156d('0x62')]);return _0x1fc567[_0x156d('0x83')](_0x28e046);}})['then'](function(_0x25caf1){if(_0x25caf1){_0x45b53b=_0x25caf1[_0x156d('0x3a')];if(!_0x48f9aa[_0x156d('0x33')][_0x156d('0x3b')]('nolimit')){_0x28e046[_0x156d('0x1e')]=qs[_0x156d('0x1e')](_0x48f9aa['query'][_0x156d('0x1e')]);_0x28e046[_0x156d('0x1c')]=qs[_0x156d('0x1c')](_0x48f9aa[_0x156d('0x33')][_0x156d('0x1c')]);}return _0x1fc567[_0x156d('0x83')](_0x28e046);}})[_0x156d('0x25')](function(_0x5c7330){if(_0x5c7330){return _0x5c7330?{'count':_0x45b53b,'rows':_0x5c7330}:null;}})[_0x156d('0x25')](respondWithResult(_0x41da4a,null))['catch'](handleError(_0x41da4a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 50e0f34..229e482 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 _0x0875=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xe6bbe2,_0x4eeae3){var _0x1414f3=function(_0x3aef68){while(--_0x3aef68){_0xe6bbe2['push'](_0xe6bbe2['shift']());}};_0x1414f3(++_0x4eeae3);}(_0x0875,0x170));var _0x5087=function(_0x57e57e,_0x5aa90e){_0x57e57e=_0x57e57e-0x0;var _0x34bc10=_0x0875[_0x57e57e];return _0x34bc10;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x5087('0x0'))['db'][_0x5087('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5087('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5087('0x3'),'afterDestroy':_0x5087('0x4')};function emitEvent(_0x1387e7){return function(_0x54cf17,_0x47c080,_0x484242){WhatsappQueueEvents[_0x5087('0x5')](_0x1387e7+':'+_0x54cf17['id'],_0x54cf17);WhatsappQueueEvents[_0x5087('0x5')](_0x1387e7,_0x54cf17);_0x484242(null);};}for(var e in events){if(events[_0x5087('0x6')](e)){var event=events[e];WhatsappQueue[_0x5087('0x7')](e,emitEvent(event));}}module[_0x5087('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x06a4=['events','WhatsappQueue','setMaxListeners','save','update','remove','hook','exports'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0x06a4,0xf0));var _0x406a=function(_0xd60031,_0x5efb93){_0xd60031=_0xd60031-0x0;var _0x43d00a=_0x06a4[_0xd60031];return _0x43d00a;};'use strict';var EventEmitter=require(_0x406a('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x406a('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x406a('0x2')](0x0);var events={'afterCreate':_0x406a('0x3'),'afterUpdate':_0x406a('0x4'),'afterDestroy':_0x406a('0x5')};function emitEvent(_0x100ca2){return function(_0x3ed74a,_0x1886fd,_0x49335c){WhatsappQueueEvents['emit'](_0x100ca2+':'+_0x3ed74a['id'],_0x3ed74a);WhatsappQueueEvents['emit'](_0x100ca2,_0x3ed74a);_0x49335c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x406a('0x6')](e,emitEvent(event));}}module[_0x406a('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index cec324d..cdeac2e 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 _0x2a71=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xbcbad2,_0x57c30e){var _0x34ecd5=function(_0xec2f2f){while(--_0xec2f2f){_0xbcbad2['push'](_0xbcbad2['shift']());}};_0x34ecd5(++_0x57c30e);}(_0x2a71,0x1e2));var _0x12a7=function(_0x41f745,_0x4b5c4a){_0x41f745=_0x41f745-0x0;var _0x2cbbcb=_0x2a71[_0x41f745];return _0x2cbbcb;};'use strict';var _=require(_0x12a7('0x0'));var util=require(_0x12a7('0x1'));var logger=require(_0x12a7('0x2'))('api');var moment=require(_0x12a7('0x3'));var BPromise=require(_0x12a7('0x4'));var rp=require(_0x12a7('0x5'));var fs=require('fs');var path=require(_0x12a7('0x6'));var rimraf=require(_0x12a7('0x7'));var config=require(_0x12a7('0x8'));var attributes=require(_0x12a7('0x9'));module[_0x12a7('0xa')]=function(_0x289446,_0x1bb0e8){return _0x289446[_0x12a7('0xb')](_0x12a7('0xc'),attributes,{'tableName':_0x12a7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e7b=['lodash','util','../../config/logger','bluebird','path','./whatsappQueue.attributes','define','WhatsappQueue'];(function(_0x38c8f5,_0x37e7b9){var _0xcd1ec2=function(_0x45d22a){while(--_0x45d22a){_0x38c8f5['push'](_0x38c8f5['shift']());}};_0xcd1ec2(++_0x37e7b9);}(_0x0e7b,0x158));var _0xb0e7=function(_0x126d0d,_0x447c7f){_0x126d0d=_0x126d0d-0x0;var _0x14c01f=_0x0e7b[_0x126d0d];return _0x14c01f;};'use strict';var _=require(_0xb0e7('0x0'));var util=require(_0xb0e7('0x1'));var logger=require(_0xb0e7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb0e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0e7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb0e7('0x5'));module['exports']=function(_0x1e4f47,_0x202a42){return _0x1e4f47[_0xb0e7('0x6')](_0xb0e7('0x7'),attributes,{'tableName':'whatsapp_queues','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 b70c6d3..d84230d 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 _0xf3c5=['http','redis','./whatsappQueue.socket','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a7868,_0x48d785){var _0x529fa3=function(_0x3a3882){while(--_0x3a3882){_0x4a7868['push'](_0x4a7868['shift']());}};_0x529fa3(++_0x48d785);}(_0xf3c5,0x6a));var _0x5f3c=function(_0x151762,_0x17691f){_0x151762=_0x151762-0x0;var _0x27f596=_0xf3c5[_0x151762];return _0x27f596;};'use strict';var _=require(_0x5f3c('0x0'));var util=require(_0x5f3c('0x1'));var moment=require('moment');var BPromise=require(_0x5f3c('0x2'));var rs=require(_0x5f3c('0x3'));var fs=require('fs');var Redis=require(_0x5f3c('0x4'));var db=require(_0x5f3c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f3c('0x6'))(_0x5f3c('0x7'));var config=require(_0x5f3c('0x8'));var jayson=require(_0x5f3c('0x9'));var client=jayson[_0x5f3c('0xa')][_0x5f3c('0xb')]({'port':0x232a});config[_0x5f3c('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f3c('0xc')]));require(_0x5f3c('0xd'))['register'](socket);function respondWithRpcPromise(_0x58eff1,_0x3e78cc,_0x3e68cd){return new BPromise(function(_0x2ad6e1,_0x5e567e){return client[_0x5f3c('0xe')](_0x58eff1,_0x3e68cd)['then'](function(_0x79ba67){logger[_0x5f3c('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x3e78cc,_0x5f3c('0x10'));logger[_0x5f3c('0x11')](_0x5f3c('0x12'),_0x3e78cc,_0x5f3c('0x10'),JSON[_0x5f3c('0x13')](_0x79ba67));if(_0x79ba67[_0x5f3c('0x14')]){if(_0x79ba67[_0x5f3c('0x14')][_0x5f3c('0x15')]===0x1f4){logger[_0x5f3c('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x3e78cc,_0x79ba67[_0x5f3c('0x14')][_0x5f3c('0x16')]);return _0x5e567e(_0x79ba67[_0x5f3c('0x14')][_0x5f3c('0x16')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x3e78cc,_0x79ba67[_0x5f3c('0x14')][_0x5f3c('0x16')]);return _0x2ad6e1(_0x79ba67[_0x5f3c('0x14')][_0x5f3c('0x16')]);}else{logger['info'](_0x5f3c('0x17'),_0x3e78cc,'request\x20sent');_0x2ad6e1(_0x79ba67[_0x5f3c('0x18')][_0x5f3c('0x16')]);}})['catch'](function(_0x62f4fb){logger[_0x5f3c('0x14')](_0x5f3c('0x17'),_0x3e78cc,_0x62f4fb);_0x5e567e(_0x62f4fb);});});}exports[_0x5f3c('0x19')]=function(_0xaf2255){var _0x3719ba=this;return new Promise(function(_0x3e2e65,_0x5ce9ea){return db[_0x5f3c('0x1a')][_0x5f3c('0x1b')]({'raw':_0xaf2255[_0x5f3c('0x1c')]?_0xaf2255[_0x5f3c('0x1c')][_0x5f3c('0x1d')]===undefined?!![]:![]:!![],'where':_0xaf2255[_0x5f3c('0x1c')]?_0xaf2255[_0x5f3c('0x1c')][_0x5f3c('0x1e')]||null:null,'attributes':_0xaf2255['options']?_0xaf2255[_0x5f3c('0x1c')][_0x5f3c('0x1f')]||null:null,'limit':_0xaf2255[_0x5f3c('0x1c')]?_0xaf2255['options'][_0x5f3c('0x20')]||null:null,'include':_0xaf2255[_0x5f3c('0x1c')]?_0xaf2255['options'][_0x5f3c('0x21')]?_[_0x5f3c('0x22')](_0xaf2255['options']['include'],function(_0x5bca08){return{'model':db[_0x5bca08[_0x5f3c('0x23')]],'as':_0x5bca08['as'],'attributes':_0x5bca08[_0x5f3c('0x1f')],'include':_0x5bca08['include']?_[_0x5f3c('0x22')](_0x5bca08[_0x5f3c('0x21')],function(_0x2cf12f){return{'model':db[_0x2cf12f[_0x5f3c('0x23')]],'as':_0x2cf12f['as'],'attributes':_0x2cf12f[_0x5f3c('0x1f')],'include':_0x2cf12f[_0x5f3c('0x21')]?_[_0x5f3c('0x22')](_0x2cf12f[_0x5f3c('0x21')],function(_0x5e48a3){return{'model':db[_0x5e48a3[_0x5f3c('0x23')]],'as':_0x5e48a3['as'],'attributes':_0x5e48a3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x39d441){logger[_0x5f3c('0xf')]('GetWhatsappQueue',_0xaf2255);logger[_0x5f3c('0x11')]('GetWhatsappQueue',_0xaf2255,JSON[_0x5f3c('0x13')](_0x39d441));_0x3e2e65(_0x39d441);})['catch'](function(_0x3965ed){logger['error'](_0x5f3c('0x19'),_0x3965ed[_0x5f3c('0x16')],_0xaf2255);_0x5ce9ea(_0x3719ba['error'](0x1f4,_0x3965ed[_0x5f3c('0x16')]));});});};exports[_0x5f3c('0x24')]=function(_0x3249c8){var _0x44040b=this;return new Promise(function(_0x2896ed,_0x2fd9eb){return db[_0x5f3c('0x1a')][_0x5f3c('0x25')]({'raw':_0x3249c8[_0x5f3c('0x1c')]?_0x3249c8['options']['raw']===undefined?!![]:![]:!![],'where':_0x3249c8['options']?_0x3249c8[_0x5f3c('0x1c')]['where']||null:null,'attributes':_0x3249c8[_0x5f3c('0x1c')]?_0x3249c8[_0x5f3c('0x1c')]['attributes']||null:null,'include':_0x3249c8[_0x5f3c('0x1c')]?_0x3249c8['options'][_0x5f3c('0x21')]?_[_0x5f3c('0x22')](_0x3249c8[_0x5f3c('0x1c')][_0x5f3c('0x21')],function(_0x23d577){return{'model':db[_0x23d577[_0x5f3c('0x23')]],'as':_0x23d577['as'],'attributes':_0x23d577[_0x5f3c('0x1f')],'include':_0x23d577[_0x5f3c('0x21')]?_[_0x5f3c('0x22')](_0x23d577[_0x5f3c('0x21')],function(_0x1bb3d6){return{'model':db[_0x1bb3d6[_0x5f3c('0x23')]],'as':_0x1bb3d6['as'],'attributes':_0x1bb3d6[_0x5f3c('0x1f')],'include':_0x1bb3d6['include']?_[_0x5f3c('0x22')](_0x1bb3d6[_0x5f3c('0x21')],function(_0x481861){return{'model':db[_0x481861[_0x5f3c('0x23')]],'as':_0x481861['as'],'attributes':_0x481861['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf780cd){logger[_0x5f3c('0xf')]('ShowWhatsappQueue',_0x3249c8);logger[_0x5f3c('0x11')](_0x5f3c('0x24'),_0x3249c8,JSON[_0x5f3c('0x13')](_0xf780cd));_0x2896ed(_0xf780cd);})[_0x5f3c('0x26')](function(_0x5d00b4){logger[_0x5f3c('0x14')]('ShowWhatsappQueue',_0x5d00b4['message'],_0x3249c8);_0x2fd9eb(_0x44040b['error'](0x1f4,_0x5d00b4['message']));});});}; \ No newline at end of file +var _0x8da5=['WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','debug','stringify','ShowWhatsappQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','localhost','redis','./whatsappQueue.socket','register','request','then','info'];(function(_0x5a5099,_0xeb4601){var _0x5ea330=function(_0x24e1b5){while(--_0x24e1b5){_0x5a5099['push'](_0x5a5099['shift']());}};_0x5ea330(++_0xeb4601);}(_0x8da5,0x1a6));var _0x58da=function(_0x71a826,_0x3095d2){_0x71a826=_0x71a826-0x0;var _0x1af7f9=_0x8da5[_0x71a826];return _0x1af7f9;};'use strict';var _=require(_0x58da('0x0'));var util=require(_0x58da('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x58da('0x2'));var fs=require('fs');var Redis=require(_0x58da('0x3'));var db=require(_0x58da('0x4'))['db'];var utils=require(_0x58da('0x5'));var logger=require(_0x58da('0x6'))(_0x58da('0x7'));var config=require('../../config/environment');var jayson=require(_0x58da('0x8'));var client=jayson['client'][_0x58da('0x9')]({'port':0x232a});config['redis']=_[_0x58da('0xa')](config['redis'],{'host':_0x58da('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58da('0xc')]));require(_0x58da('0xd'))[_0x58da('0xe')](socket);function respondWithRpcPromise(_0x116aa8,_0x2249d2,_0x1a6bd4){return new BPromise(function(_0x4c8cae,_0x4f15ce){return client[_0x58da('0xf')](_0x116aa8,_0x1a6bd4)[_0x58da('0x10')](function(_0x553534){logger[_0x58da('0x11')](_0x58da('0x12'),_0x2249d2,_0x58da('0x13'));logger['debug'](_0x58da('0x14'),_0x2249d2,_0x58da('0x13'),JSON['stringify'](_0x553534));if(_0x553534[_0x58da('0x15')]){if(_0x553534[_0x58da('0x15')][_0x58da('0x16')]===0x1f4){logger[_0x58da('0x15')](_0x58da('0x12'),_0x2249d2,_0x553534[_0x58da('0x15')][_0x58da('0x17')]);return _0x4f15ce(_0x553534[_0x58da('0x15')][_0x58da('0x17')]);}logger[_0x58da('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x2249d2,_0x553534['error'][_0x58da('0x17')]);return _0x4c8cae(_0x553534['error'][_0x58da('0x17')]);}else{logger['info'](_0x58da('0x12'),_0x2249d2,_0x58da('0x13'));_0x4c8cae(_0x553534[_0x58da('0x18')]['message']);}})[_0x58da('0x19')](function(_0x125129){logger[_0x58da('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x2249d2,_0x125129);_0x4f15ce(_0x125129);});});}exports['GetWhatsappQueue']=function(_0x3d29e0){var _0x4bfc65=this;return new Promise(function(_0xbdf388,_0x2c3964){return db[_0x58da('0x1a')][_0x58da('0x1b')]({'raw':_0x3d29e0[_0x58da('0x1c')]?_0x3d29e0['options'][_0x58da('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d29e0[_0x58da('0x1c')]?_0x3d29e0[_0x58da('0x1c')][_0x58da('0x1e')]||null:null,'attributes':_0x3d29e0[_0x58da('0x1c')]?_0x3d29e0[_0x58da('0x1c')][_0x58da('0x1f')]||null:null,'limit':_0x3d29e0['options']?_0x3d29e0['options'][_0x58da('0x20')]||null:null,'include':_0x3d29e0[_0x58da('0x1c')]?_0x3d29e0[_0x58da('0x1c')][_0x58da('0x21')]?_[_0x58da('0x22')](_0x3d29e0[_0x58da('0x1c')][_0x58da('0x21')],function(_0x1b5c2e){return{'model':db[_0x1b5c2e[_0x58da('0x23')]],'as':_0x1b5c2e['as'],'attributes':_0x1b5c2e['attributes'],'include':_0x1b5c2e[_0x58da('0x21')]?_[_0x58da('0x22')](_0x1b5c2e[_0x58da('0x21')],function(_0x35e4ee){return{'model':db[_0x35e4ee[_0x58da('0x23')]],'as':_0x35e4ee['as'],'attributes':_0x35e4ee[_0x58da('0x1f')],'include':_0x35e4ee['include']?_[_0x58da('0x22')](_0x35e4ee['include'],function(_0x57c803){return{'model':db[_0x57c803[_0x58da('0x23')]],'as':_0x57c803['as'],'attributes':_0x57c803['attributes']};}):[]};}):[]};}):[]:[]})[_0x58da('0x10')](function(_0x17ebd6){logger['info'](_0x58da('0x24'),_0x3d29e0);logger[_0x58da('0x25')]('GetWhatsappQueue',_0x3d29e0,JSON[_0x58da('0x26')](_0x17ebd6));_0xbdf388(_0x17ebd6);})[_0x58da('0x19')](function(_0x1a8e0e){logger[_0x58da('0x15')](_0x58da('0x24'),_0x1a8e0e[_0x58da('0x17')],_0x3d29e0);_0x2c3964(_0x4bfc65['error'](0x1f4,_0x1a8e0e[_0x58da('0x17')]));});});};exports[_0x58da('0x27')]=function(_0x25bf05){var _0x3f873b=this;return new Promise(function(_0x3a8d6f,_0x14af7f){return db[_0x58da('0x1a')]['find']({'raw':_0x25bf05['options']?_0x25bf05['options']['raw']===undefined?!![]:![]:!![],'where':_0x25bf05[_0x58da('0x1c')]?_0x25bf05[_0x58da('0x1c')]['where']||null:null,'attributes':_0x25bf05[_0x58da('0x1c')]?_0x25bf05['options'][_0x58da('0x1f')]||null:null,'include':_0x25bf05[_0x58da('0x1c')]?_0x25bf05[_0x58da('0x1c')]['include']?_[_0x58da('0x22')](_0x25bf05[_0x58da('0x1c')][_0x58da('0x21')],function(_0x4aef16){return{'model':db[_0x4aef16['model']],'as':_0x4aef16['as'],'attributes':_0x4aef16[_0x58da('0x1f')],'include':_0x4aef16[_0x58da('0x21')]?_[_0x58da('0x22')](_0x4aef16['include'],function(_0x416d03){return{'model':db[_0x416d03[_0x58da('0x23')]],'as':_0x416d03['as'],'attributes':_0x416d03[_0x58da('0x1f')],'include':_0x416d03['include']?_['map'](_0x416d03['include'],function(_0x2c2075){return{'model':db[_0x2c2075[_0x58da('0x23')]],'as':_0x2c2075['as'],'attributes':_0x2c2075[_0x58da('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x58da('0x10')](function(_0x3538e6){logger[_0x58da('0x11')](_0x58da('0x27'),_0x25bf05);logger['debug'](_0x58da('0x27'),_0x25bf05,JSON[_0x58da('0x26')](_0x3538e6));_0x3a8d6f(_0x3538e6);})[_0x58da('0x19')](function(_0x76a745){logger['error'](_0x58da('0x27'),_0x76a745[_0x58da('0x17')],_0x25bf05);_0x14af7f(_0x3f873b[_0x58da('0x15')](0x1f4,_0x76a745[_0x58da('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8d4dda2..567747e 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 _0xe5b5=['length','whatsappQueue:','emit','removeListener','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe5b5,0x165));var _0x5e5b=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0xe5b5[_0xd13a88];return _0x1c993c;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save','remove','update'];function createListener(_0x7dfe25,_0x27315e){return function(_0x56ab18){_0x27315e[_0x5e5b('0x0')](_0x7dfe25,_0x56ab18);};}function removeListener(_0x635241,_0x21a550){return function(){WhatsappQueueEvents[_0x5e5b('0x1')](_0x635241,_0x21a550);};}exports[_0x5e5b('0x2')]=function(_0x2f8d18){for(var _0x10ca7b=0x0,_0x5c2625=events[_0x5e5b('0x3')];_0x10ca7b<_0x5c2625;_0x10ca7b++){var _0x4e9dba=events[_0x10ca7b];var _0x339bcf=createListener(_0x5e5b('0x4')+_0x4e9dba,_0x2f8d18);WhatsappQueueEvents['on'](_0x4e9dba,_0x339bcf);}}; \ No newline at end of file +var _0x44f1=['update','removeListener','register','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0xc3a63e,_0x20074e){var _0x39dc4a=function(_0x45c90f){while(--_0x45c90f){_0xc3a63e['push'](_0xc3a63e['shift']());}};_0x39dc4a(++_0x20074e);}(_0x44f1,0x1bd));var _0x144f=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x44f1[_0x2a6809];return _0x11c371;};'use strict';var WhatsappQueueEvents=require(_0x144f('0x0'));var events=[_0x144f('0x1'),_0x144f('0x2'),_0x144f('0x3')];function createListener(_0x2c1a8e,_0x1bad81){return function(_0x101f48){_0x1bad81['emit'](_0x2c1a8e,_0x101f48);};}function removeListener(_0x14591d,_0xcc3dd2){return function(){WhatsappQueueEvents[_0x144f('0x4')](_0x14591d,_0xcc3dd2);};}exports[_0x144f('0x5')]=function(_0xa75e31){for(var _0x5d547d=0x0,_0x59f5ce=events['length'];_0x5d547d<_0x59f5ce;_0x5d547d++){var _0x299f0a=events[_0x5d547d];var _0x4836df=createListener(_0x144f('0x6')+_0x299f0a,_0xa75e31);WhatsappQueueEvents['on'](_0x299f0a,_0x4836df);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 9f3dc1c..052f2e3 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 _0x6a53=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x6a53,0x1ef));var _0x36a5=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x6a53[_0x16337a];return _0x422365;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x36a5('0x0'));var timeout=require(_0x36a5('0x1'));var express=require(_0x36a5('0x2'));var router=express[_0x36a5('0x3')]();var fs_extra=require(_0x36a5('0x4'));var auth=require(_0x36a5('0x5'));var interaction=require(_0x36a5('0x6'));var config=require(_0x36a5('0x7'));var controller=require(_0x36a5('0x8'));router[_0x36a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x36a5('0xa')]);router['get'](_0x36a5('0xb'),auth[_0x36a5('0xc')](),controller[_0x36a5('0xd')]);router[_0x36a5('0x9')](_0x36a5('0xe'),auth[_0x36a5('0xc')](),controller['show']);router['post']('/',auth[_0x36a5('0xc')](),controller[_0x36a5('0xf')]);router[_0x36a5('0x10')](_0x36a5('0xe'),auth[_0x36a5('0xc')](),controller[_0x36a5('0x11')]);router[_0x36a5('0x12')](_0x36a5('0xe'),auth[_0x36a5('0xc')](),controller['destroy']);module[_0x36a5('0x13')]=router; \ No newline at end of file +var _0xcb2c=['put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x314454,_0x4ccb32){var _0x2717b3=function(_0x588813){while(--_0x588813){_0x314454['push'](_0x314454['shift']());}};_0x2717b3(++_0x4ccb32);}(_0xcb2c,0x17a));var _0xccb2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xcb2c[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xccb2('0x0'));var util=require(_0xccb2('0x1'));var path=require(_0xccb2('0x2'));var timeout=require(_0xccb2('0x3'));var express=require(_0xccb2('0x4'));var router=express['Router']();var fs_extra=require(_0xccb2('0x5'));var auth=require(_0xccb2('0x6'));var interaction=require(_0xccb2('0x7'));var config=require(_0xccb2('0x8'));var controller=require(_0xccb2('0x9'));router[_0xccb2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xccb2('0xa')](_0xccb2('0xb'),auth[_0xccb2('0xc')](),controller[_0xccb2('0xd')]);router[_0xccb2('0xa')](_0xccb2('0xe'),auth[_0xccb2('0xc')](),controller[_0xccb2('0xf')]);router[_0xccb2('0x10')]('/',auth[_0xccb2('0xc')](),controller[_0xccb2('0x11')]);router[_0xccb2('0x12')]('/:id',auth[_0xccb2('0xc')](),controller[_0xccb2('0x13')]);router[_0xccb2('0x14')](_0xccb2('0xe'),auth[_0xccb2('0xc')](),controller['destroy']);module[_0xccb2('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5f1e647..41f0658 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(_0x474359,_0x5674e1){var _0x2b779a=function(_0x30310e){while(--_0x30310e){_0x474359['push'](_0x474359['shift']());}};_0x2b779a(++_0x5674e1);}(_0x7a54,0x106));var _0x47a5=function(_0x332610,_0x33eb7d){_0x332610=_0x332610-0x0;var _0x56aa8d=_0x7a54[_0x332610];return _0x56aa8d;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x14d91b,_0x549b40){var _0x2c4d52=function(_0xd06c83){while(--_0xd06c83){_0x14d91b['push'](_0x14d91b['shift']());}};_0x2c4d52(++_0x549b40);}(_0x7a54,0x106));var _0x47a5=function(_0x2fb791,_0x50a455){_0x2fb791=_0x2fb791-0x0;var _0x108dff=_0x7a54[_0x2fb791];return _0x108dff;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 728ad65..8b034b3 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 _0xa902=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../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','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x2782ca,_0x541f51){var _0x315641=function(_0x1077a6){while(--_0x1077a6){_0x2782ca['push'](_0x2782ca['shift']());}};_0x315641(++_0x541f51);}(_0xa902,0x8d));var _0x2a90=function(_0x11ecf4,_0x3742dd){_0x11ecf4=_0x11ecf4-0x0;var _0x552b7c=_0xa902[_0x11ecf4];return _0x552b7c;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['WhatsappQueueReport'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['WhatsappQueueReport'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['WhatsappQueueReport'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));};exports[_0x2a90('0x4a')]=function(_0x48d3bc,_0x265769){return db['WhatsappQueueReport']['describe']()[_0x2a90('0x25')](respondWithResult(_0x265769,null))[_0x2a90('0x43')](handleError(_0x265769,null));}; \ No newline at end of file +var _0x8603=['fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes'];(function(_0x84fd21,_0x10fc28){var _0x53fd29=function(_0x1b9116){while(--_0x1b9116){_0x84fd21['push'](_0x84fd21['shift']());}};_0x53fd29(++_0x10fc28);}(_0x8603,0x190));var _0x3860=function(_0x2b2998,_0xc35385){_0x2b2998=_0x2b2998-0x0;var _0x491cec=_0x8603[_0x2b2998];return _0x491cec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];function respondWithStatusCode(_0x8ad61d,_0x2428f6){_0x2428f6=_0x2428f6||0xcc;return function(_0x1ea619){if(_0x1ea619){return _0x8ad61d[_0x3860('0x15')](_0x2428f6);}return _0x8ad61d[_0x3860('0x16')](_0x2428f6)[_0x3860('0x17')]();};}function respondWithResult(_0x12b23b,_0x465d8d){_0x465d8d=_0x465d8d||0xc8;return function(_0x46264d){if(_0x46264d){return _0x12b23b['status'](_0x465d8d)[_0x3860('0x18')](_0x46264d);}};}function respondWithFilteredResult(_0x21eaf1,_0x122e40){return function(_0x37d9ab){if(_0x37d9ab){var _0x1055b3=typeof _0x122e40[_0x3860('0x19')]===_0x3860('0x1a')&&typeof _0x122e40[_0x3860('0x1b')]===_0x3860('0x1a');var _0x3c0d91=_0x37d9ab[_0x3860('0x1c')];var _0x45b799=_0x1055b3?0x0:_0x122e40['offset'];var _0x4863bd=_0x1055b3?_0x37d9ab[_0x3860('0x1c')]:_0x122e40[_0x3860('0x19')]+_0x122e40[_0x3860('0x1b')];var _0x53fc63;if(_0x4863bd>=_0x3c0d91){_0x4863bd=_0x3c0d91;_0x53fc63=0xc8;}else{_0x53fc63=0xce;}_0x21eaf1[_0x3860('0x16')](_0x53fc63);return _0x21eaf1[_0x3860('0x1d')](_0x3860('0x1e'),_0x45b799+'-'+_0x4863bd+'/'+_0x3c0d91)[_0x3860('0x18')](_0x37d9ab);}return null;};}function patchUpdates(_0x20a5b0){return function(_0x45081f){try{jsonpatch[_0x3860('0x1f')](_0x45081f,_0x20a5b0,!![]);}catch(_0x1f8891){return BPromise[_0x3860('0x20')](_0x1f8891);}return _0x45081f[_0x3860('0x21')]();};}function saveUpdates(_0xacd57f,_0x2e0b6e){return function(_0x280ea9){if(_0x280ea9){return _0x280ea9[_0x3860('0x22')](_0xacd57f)[_0x3860('0x23')](function(_0x564efd){return _0x564efd;});}return null;};}function removeEntity(_0xfc10a5,_0x133093){return function(_0x2b91f2){if(_0x2b91f2){return _0x2b91f2[_0x3860('0x24')]()[_0x3860('0x23')](function(){_0xfc10a5['status'](0xcc)[_0x3860('0x17')]();});}};}function handleEntityNotFound(_0x568515,_0x577750){return function(_0xfa9705){if(!_0xfa9705){_0x568515[_0x3860('0x15')](0x194);}return _0xfa9705;};}function handleError(_0x54b5ec,_0x4d9a90){_0x4d9a90=_0x4d9a90||0x1f4;return function(_0x5f42d5){logger[_0x3860('0x25')](_0x5f42d5[_0x3860('0x26')]);if(_0x5f42d5[_0x3860('0x27')]){delete _0x5f42d5[_0x3860('0x27')];}_0x54b5ec[_0x3860('0x16')](_0x4d9a90)[_0x3860('0x28')](_0x5f42d5);};}exports['index']=function(_0x4c4314,_0x389bd0){var _0x1f1809={},_0x5a9af2={},_0x2551f4={'count':0x0,'rows':[]};var _0x3d5143=_[_0x3860('0x29')](db[_0x3860('0x2a')][_0x3860('0x2b')],function(_0x4bbae9){return{'name':_0x4bbae9[_0x3860('0x2c')],'type':_0x4bbae9[_0x3860('0x2d')][_0x3860('0x2e')]};});_0x5a9af2['model']=_[_0x3860('0x29')](_0x3d5143,'name');_0x5a9af2[_0x3860('0x2f')]=_['keys'](_0x4c4314[_0x3860('0x2f')]);_0x5a9af2[_0x3860('0x30')]=_[_0x3860('0x31')](_0x5a9af2['model'],_0x5a9af2[_0x3860('0x2f')]);_0x1f1809[_0x3860('0x32')]=_['intersection'](_0x5a9af2[_0x3860('0x33')],qs['fields'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x34')]));_0x1f1809[_0x3860('0x32')]=_0x1f1809[_0x3860('0x32')][_0x3860('0x35')]?_0x1f1809[_0x3860('0x32')]:_0x5a9af2[_0x3860('0x33')];if(!_0x4c4314['query'][_0x3860('0x36')](_0x3860('0x37'))){_0x1f1809['limit']=qs[_0x3860('0x1b')](_0x4c4314[_0x3860('0x2f')][_0x3860('0x1b')]);_0x1f1809['offset']=qs['offset'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x19')]);}_0x1f1809[_0x3860('0x38')]=qs[_0x3860('0x39')](_0x4c4314['query']['sort']);_0x1f1809[_0x3860('0x3a')]=qs[_0x3860('0x30')](_[_0x3860('0x3b')](_0x4c4314[_0x3860('0x2f')],_0x5a9af2[_0x3860('0x30')]),_0x3d5143);if(_0x4c4314['query'][_0x3860('0x3c')]){_0x1f1809[_0x3860('0x3a')]=_['merge'](_0x1f1809['where'],{'$or':_[_0x3860('0x29')](_0x3d5143,function(_0x148914){if(_0x148914[_0x3860('0x2d')]!==_0x3860('0x3d')){var _0x2b35b2={};_0x2b35b2[_0x148914['name']]={'$like':'%'+_0x4c4314[_0x3860('0x2f')]['filter']+'%'};return _0x2b35b2;}})});}_0x1f1809=_[_0x3860('0x3e')]({},_0x1f1809,_0x4c4314[_0x3860('0x3f')]);var _0x53d443={'where':_0x1f1809[_0x3860('0x3a')]};return db[_0x3860('0x2a')]['count'](_0x53d443)[_0x3860('0x23')](function(_0xc7d34d){_0x2551f4[_0x3860('0x1c')]=_0xc7d34d;if(_0x4c4314[_0x3860('0x2f')]['includeAll']){_0x1f1809[_0x3860('0x40')]=[{'all':!![]}];}return db[_0x3860('0x2a')][_0x3860('0x41')](_0x1f1809);})['then'](function(_0x3a87e5){_0x2551f4['rows']=_0x3a87e5;return _0x2551f4;})[_0x3860('0x23')](respondWithFilteredResult(_0x389bd0,_0x1f1809))[_0x3860('0x42')](handleError(_0x389bd0,null));};exports[_0x3860('0x43')]=function(_0x3f613f,_0x2220c8){var _0x3f4216={'raw':!![],'where':{'id':_0x3f613f[_0x3860('0x44')]['id']}},_0x4e0a44={};_0x4e0a44[_0x3860('0x33')]=_['keys'](db['WhatsappQueueReport'][_0x3860('0x2b')]);_0x4e0a44[_0x3860('0x2f')]=_['keys'](_0x3f613f[_0x3860('0x2f')]);_0x4e0a44[_0x3860('0x30')]=_['intersection'](_0x4e0a44[_0x3860('0x33')],_0x4e0a44[_0x3860('0x2f')]);_0x3f4216[_0x3860('0x32')]=_[_0x3860('0x31')](_0x4e0a44[_0x3860('0x33')],qs[_0x3860('0x34')](_0x3f613f[_0x3860('0x2f')][_0x3860('0x34')]));_0x3f4216[_0x3860('0x32')]=_0x3f4216[_0x3860('0x32')][_0x3860('0x35')]?_0x3f4216[_0x3860('0x32')]:_0x4e0a44[_0x3860('0x33')];if(_0x3f613f['query'][_0x3860('0x45')]){_0x3f4216['include']=[{'all':!![]}];}_0x3f4216=_[_0x3860('0x3e')]({},_0x3f4216,_0x3f613f[_0x3860('0x3f')]);return db[_0x3860('0x2a')][_0x3860('0x46')](_0x3f4216)[_0x3860('0x23')](handleEntityNotFound(_0x2220c8,null))[_0x3860('0x23')](respondWithResult(_0x2220c8,null))[_0x3860('0x42')](handleError(_0x2220c8,null));};exports[_0x3860('0x47')]=function(_0x5a91b2,_0x3cd575){return db[_0x3860('0x2a')][_0x3860('0x47')](_0x5a91b2['body'],{})[_0x3860('0x23')](respondWithResult(_0x3cd575,0xc9))[_0x3860('0x42')](handleError(_0x3cd575,null));};exports[_0x3860('0x22')]=function(_0x3dc957,_0x5ed2db){if(_0x3dc957['body']['id']){delete _0x3dc957[_0x3860('0x48')]['id'];}return db['WhatsappQueueReport'][_0x3860('0x46')]({'where':{'id':_0x3dc957[_0x3860('0x44')]['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x5ed2db,null))['then'](saveUpdates(_0x3dc957[_0x3860('0x48')],null))['then'](respondWithResult(_0x5ed2db,null))[_0x3860('0x42')](handleError(_0x5ed2db,null));};exports['destroy']=function(_0xf9edb4,_0x25d22f){return db[_0x3860('0x2a')]['find']({'where':{'id':_0xf9edb4['params']['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x25d22f,null))[_0x3860('0x23')](removeEntity(_0x25d22f,null))['catch'](handleError(_0x25d22f,null));};exports[_0x3860('0x49')]=function(_0x58237e,_0x3b3bfe){return db[_0x3860('0x2a')][_0x3860('0x49')]()[_0x3860('0x23')](respondWithResult(_0x3b3bfe,null))[_0x3860('0x42')](handleError(_0x3b3bfe,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1353202..0ebba1e 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 _0x0157=['report_whatsapp_queue','uniqueid','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport'];(function(_0x5d4219,_0x1b754c){var _0x6dc16=function(_0x324718){while(--_0x324718){_0x5d4219['push'](_0x5d4219['shift']());}};_0x6dc16(++_0x1b754c);}(_0x0157,0xd3));var _0x7015=function(_0x28d5c2,_0x4b67ee){_0x28d5c2=_0x28d5c2-0x0;var _0x18a7c6=_0x0157[_0x28d5c2];return _0x18a7c6;};'use strict';var _=require('lodash');var util=require(_0x7015('0x0'));var logger=require(_0x7015('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7015('0x2'));var rp=require(_0x7015('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7015('0x4'));var config=require(_0x7015('0x5'));var attributes=require(_0x7015('0x6'));module[_0x7015('0x7')]=function(_0x421db3,_0x444ded){return _0x421db3['define'](_0x7015('0x8'),attributes,{'tableName':_0x7015('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7015('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x586c=['path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','request-promise'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x586c,0xbe));var _0xc586=function(_0x23d50e,_0x378059){_0x23d50e=_0x23d50e-0x0;var _0x1ce88f=_0x586c[_0x23d50e];return _0x1ce88f;};'use strict';var _=require(_0xc586('0x0'));var util=require('util');var logger=require(_0xc586('0x1'))(_0xc586('0x2'));var moment=require(_0xc586('0x3'));var BPromise=require('bluebird');var rp=require(_0xc586('0x4'));var fs=require('fs');var path=require(_0xc586('0x5'));var rimraf=require('rimraf');var config=require(_0xc586('0x6'));var attributes=require(_0xc586('0x7'));module[_0xc586('0x8')]=function(_0x3850f4,_0x326a22){return _0x3850f4[_0xc586('0x9')](_0xc586('0xa'),attributes,{'tableName':_0xc586('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc586('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 5fc94d4..6dfcff8 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 _0xa033=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','debug','stringify','UpdateWhatsappQueueReport'];(function(_0x1a1cea,_0x38d164){var _0x3461bb=function(_0x300015){while(--_0x300015){_0x1a1cea['push'](_0x1a1cea['shift']());}};_0x3461bb(++_0x38d164);}(_0xa033,0x1ca));var _0x3a03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa033[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a03('0x0'));var util=require(_0x3a03('0x1'));var moment=require(_0x3a03('0x2'));var BPromise=require(_0x3a03('0x3'));var rs=require(_0x3a03('0x4'));var fs=require('fs');var Redis=require(_0x3a03('0x5'));var db=require(_0x3a03('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a03('0x7'));var config=require(_0x3a03('0x8'));var jayson=require(_0x3a03('0x9'));var client=jayson[_0x3a03('0xa')][_0x3a03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c6eb8,_0x322884,_0x43057f){return new BPromise(function(_0x286ce5,_0x8b4052){return client[_0x3a03('0xc')](_0x2c6eb8,_0x43057f)[_0x3a03('0xd')](function(_0x179c91){logger[_0x3a03('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x322884,_0x3a03('0xf'));logger['debug'](_0x3a03('0x10'),_0x322884,_0x3a03('0xf'),JSON['stringify'](_0x179c91));if(_0x179c91[_0x3a03('0x11')]){if(_0x179c91['error'][_0x3a03('0x12')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x322884,_0x179c91[_0x3a03('0x11')][_0x3a03('0x13')]);return _0x8b4052(_0x179c91[_0x3a03('0x11')]['message']);}logger[_0x3a03('0x11')](_0x3a03('0x14'),_0x322884,_0x179c91[_0x3a03('0x11')][_0x3a03('0x13')]);return _0x286ce5(_0x179c91['error'][_0x3a03('0x13')]);}else{logger['info'](_0x3a03('0x14'),_0x322884,_0x3a03('0xf'));_0x286ce5(_0x179c91[_0x3a03('0x15')][_0x3a03('0x13')]);}})[_0x3a03('0x16')](function(_0x3dcb19){logger[_0x3a03('0x11')](_0x3a03('0x14'),_0x322884,_0x3dcb19);_0x8b4052(_0x3dcb19);});});}exports[_0x3a03('0x17')]=function(_0x3e29d){var _0x240d4b=this;return new Promise(function(_0x45e013,_0x37751a){return db[_0x3a03('0x18')][_0x3a03('0x19')](_0x3e29d[_0x3a03('0x1a')],{'raw':_0x3e29d[_0x3a03('0x1b')]?_0x3e29d[_0x3a03('0x1b')][_0x3a03('0x1c')]===undefined?!![]:![]:!![]})[_0x3a03('0xd')](function(_0x1157e9){logger[_0x3a03('0xe')](_0x3a03('0x17'),_0x3e29d);logger[_0x3a03('0x1d')](_0x3a03('0x17'),_0x3e29d,JSON[_0x3a03('0x1e')](_0x1157e9));_0x45e013(_0x1157e9);})[_0x3a03('0x16')](function(_0xb9ebad){logger[_0x3a03('0x11')](_0x3a03('0x17'),_0xb9ebad[_0x3a03('0x13')],_0x3e29d);_0x37751a(_0x240d4b[_0x3a03('0x11')](0x1f4,_0xb9ebad[_0x3a03('0x13')]));});});};exports[_0x3a03('0x1f')]=function(_0x682970){var _0x1acbba=this;return new Promise(function(_0x5eee3c,_0x3358c9){return db['WhatsappQueueReport']['update'](_0x682970['body'],{'raw':_0x682970[_0x3a03('0x1b')]?_0x682970[_0x3a03('0x1b')][_0x3a03('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x682970['options']?_0x682970[_0x3a03('0x1b')][_0x3a03('0x20')]||null:null,'attributes':_0x682970[_0x3a03('0x1b')]?_0x682970['options'][_0x3a03('0x21')]||null:null,'limit':_0x682970[_0x3a03('0x1b')]?_0x682970[_0x3a03('0x1b')][_0x3a03('0x22')]||null:null})['then'](function(_0x3dff3e){logger[_0x3a03('0xe')](_0x3a03('0x1f'),_0x682970);logger['debug'](_0x3a03('0x1f'),_0x682970,JSON[_0x3a03('0x1e')](_0x3dff3e));_0x5eee3c(_0x3dff3e);})[_0x3a03('0x16')](function(_0x4b4686){logger[_0x3a03('0x11')]('UpdateWhatsappQueueReport',_0x4b4686['message'],_0x682970);_0x3358c9(_0x1acbba['error'](0x1f4,_0x4b4686[_0x3a03('0x13')]));});});}; \ No newline at end of file +var _0x7138=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','UpdateWhatsappQueueReport','options','where','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4d451d,_0x3e6852){var _0x59b2a8=function(_0x1562bd){while(--_0x1562bd){_0x4d451d['push'](_0x4d451d['shift']());}};_0x59b2a8(++_0x3e6852);}(_0x7138,0x7a));var _0x8713=function(_0x51b7c5,_0x218969){_0x51b7c5=_0x51b7c5-0x0;var _0x3355d7=_0x7138[_0x51b7c5];return _0x3355d7;};'use strict';var _=require(_0x8713('0x0'));var util=require(_0x8713('0x1'));var moment=require(_0x8713('0x2'));var BPromise=require(_0x8713('0x3'));var rs=require(_0x8713('0x4'));var fs=require('fs');var Redis=require(_0x8713('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8713('0x6'));var logger=require(_0x8713('0x7'))(_0x8713('0x8'));var config=require(_0x8713('0x9'));var jayson=require(_0x8713('0xa'));var client=jayson['client'][_0x8713('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f4ad3,_0x477d55,_0x22e3ad){return new BPromise(function(_0x3c76f4,_0x4c2e3d){return client['request'](_0x4f4ad3,_0x22e3ad)['then'](function(_0x5e7781){logger[_0x8713('0xc')](_0x8713('0xd'),_0x477d55,_0x8713('0xe'));logger[_0x8713('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x477d55,'request\x20sent',JSON[_0x8713('0x10')](_0x5e7781));if(_0x5e7781[_0x8713('0x11')]){if(_0x5e7781['error'][_0x8713('0x12')]===0x1f4){logger['error'](_0x8713('0xd'),_0x477d55,_0x5e7781['error'][_0x8713('0x13')]);return _0x4c2e3d(_0x5e7781[_0x8713('0x11')][_0x8713('0x13')]);}logger[_0x8713('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x477d55,_0x5e7781[_0x8713('0x11')]['message']);return _0x3c76f4(_0x5e7781['error'][_0x8713('0x13')]);}else{logger[_0x8713('0xc')](_0x8713('0xd'),_0x477d55,_0x8713('0xe'));_0x3c76f4(_0x5e7781[_0x8713('0x14')][_0x8713('0x13')]);}})[_0x8713('0x15')](function(_0x44b16c){logger[_0x8713('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x477d55,_0x44b16c);_0x4c2e3d(_0x44b16c);});});}exports[_0x8713('0x16')]=function(_0x30080c){var _0x36bef3=this;return new Promise(function(_0x38157c,_0x5a1576){return db[_0x8713('0x17')][_0x8713('0x18')](_0x30080c[_0x8713('0x19')],{'raw':_0x30080c['options']?_0x30080c['options'][_0x8713('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3cf542){logger[_0x8713('0xc')]('CreateWhatsappQueueReport',_0x30080c);logger['debug'](_0x8713('0x16'),_0x30080c,JSON[_0x8713('0x10')](_0x3cf542));_0x38157c(_0x3cf542);})[_0x8713('0x15')](function(_0x388dc4){logger[_0x8713('0x11')](_0x8713('0x16'),_0x388dc4[_0x8713('0x13')],_0x30080c);_0x5a1576(_0x36bef3[_0x8713('0x11')](0x1f4,_0x388dc4[_0x8713('0x13')]));});});};exports[_0x8713('0x1b')]=function(_0x15153e){var _0x6e4451=this;return new Promise(function(_0x2eee89,_0x2bf1f6){return db[_0x8713('0x17')]['update'](_0x15153e[_0x8713('0x19')],{'raw':_0x15153e[_0x8713('0x1c')]?_0x15153e[_0x8713('0x1c')][_0x8713('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15153e[_0x8713('0x1c')]?_0x15153e[_0x8713('0x1c')][_0x8713('0x1d')]||null:null,'attributes':_0x15153e[_0x8713('0x1c')]?_0x15153e[_0x8713('0x1c')][_0x8713('0x1e')]||null:null,'limit':_0x15153e['options']?_0x15153e['options']['limit']||null:null})[_0x8713('0x1f')](function(_0x123056){logger[_0x8713('0xc')](_0x8713('0x1b'),_0x15153e);logger[_0x8713('0xf')](_0x8713('0x1b'),_0x15153e,JSON[_0x8713('0x10')](_0x123056));_0x2eee89(_0x123056);})[_0x8713('0x15')](function(_0x648482){logger[_0x8713('0x11')](_0x8713('0x1b'),_0x648482['message'],_0x15153e);_0x2bf1f6(_0x6e4451[_0x8713('0x11')](0x1f4,_0x648482[_0x8713('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 21c3c8a..d880a90 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 _0x2cfb=['./whatsappTransferReport.controller','get','index','/describe','describe','isAuthenticated','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x396289,_0x4df0e5){var _0x114669=function(_0x2e3f82){while(--_0x2e3f82){_0x396289['push'](_0x396289['shift']());}};_0x114669(++_0x4df0e5);}(_0x2cfb,0x1f0));var _0xb2cf=function(_0x2972cf,_0x343fde){_0x2972cf=_0x2972cf-0x0;var _0x4c173f=_0x2cfb[_0x2972cf];return _0x4c173f;};'use strict';var multer=require(_0xb2cf('0x0'));var util=require(_0xb2cf('0x1'));var path=require(_0xb2cf('0x2'));var timeout=require(_0xb2cf('0x3'));var express=require('express');var router=express[_0xb2cf('0x4')]();var fs_extra=require(_0xb2cf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb2cf('0x6'));var config=require(_0xb2cf('0x7'));var controller=require(_0xb2cf('0x8'));router[_0xb2cf('0x9')]('/',auth['isAuthenticated'](),controller[_0xb2cf('0xa')]);router['get'](_0xb2cf('0xb'),auth['isAuthenticated'](),controller[_0xb2cf('0xc')]);router['get']('/:id',auth[_0xb2cf('0xd')](),controller[_0xb2cf('0xe')]);router[_0xb2cf('0xf')]('/',auth[_0xb2cf('0xd')](),controller[_0xb2cf('0x10')]);router[_0xb2cf('0x11')](_0xb2cf('0x12'),auth[_0xb2cf('0xd')](),controller['update']);router['delete'](_0xb2cf('0x12'),auth[_0xb2cf('0xd')](),controller[_0xb2cf('0x13')]);module[_0xb2cf('0x14')]=router; \ No newline at end of file +var _0x139b=['../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ff9a7,_0x376098){var _0x6c817c=function(_0x2652fa){while(--_0x2652fa){_0x1ff9a7['push'](_0x1ff9a7['shift']());}};_0x6c817c(++_0x376098);}(_0x139b,0x10d));var _0xb139=function(_0x577062,_0x2e7e84){_0x577062=_0x577062-0x0;var _0x1b9a84=_0x139b[_0x577062];return _0x1b9a84;};'use strict';var multer=require('multer');var util=require(_0xb139('0x0'));var path=require('path');var timeout=require(_0xb139('0x1'));var express=require(_0xb139('0x2'));var router=express[_0xb139('0x3')]();var fs_extra=require(_0xb139('0x4'));var auth=require(_0xb139('0x5'));var interaction=require(_0xb139('0x6'));var config=require(_0xb139('0x7'));var controller=require(_0xb139('0x8'));router[_0xb139('0x9')]('/',auth['isAuthenticated'](),controller[_0xb139('0xa')]);router[_0xb139('0x9')](_0xb139('0xb'),auth[_0xb139('0xc')](),controller[_0xb139('0xd')]);router[_0xb139('0x9')](_0xb139('0xe'),auth['isAuthenticated'](),controller[_0xb139('0xf')]);router[_0xb139('0x10')]('/',auth[_0xb139('0xc')](),controller[_0xb139('0x11')]);router[_0xb139('0x12')](_0xb139('0xe'),auth[_0xb139('0xc')](),controller[_0xb139('0x13')]);router[_0xb139('0x14')](_0xb139('0xe'),auth[_0xb139('0xc')](),controller[_0xb139('0x15')]);module[_0xb139('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2c63ca8..44953c4 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 _0xb299=['ENUM','account','agent','queue','DATE','sequelize','STRING'];(function(_0x51c09e,_0x58f899){var _0x4ac052=function(_0x2a8fd4){while(--_0x2a8fd4){_0x51c09e['push'](_0x51c09e['shift']());}};_0x4ac052(++_0x58f899);}(_0xb299,0x19b));var _0x9b29=function(_0x3284d9,_0x3cc4c7){_0x3284d9=_0x3284d9-0x0;var _0x45bc75=_0xb299[_0x3284d9];return _0x45bc75;};'use strict';var Sequelize=require(_0x9b29('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9b29('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9b29('0x2')](_0x9b29('0x3'),_0x9b29('0x4'),_0x9b29('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x9b29('0x6')]}}; \ No newline at end of file +var _0x8286=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x3f7623,_0x28d9e2){var _0x512a9d=function(_0x385b82){while(--_0x385b82){_0x3f7623['push'](_0x3f7623['shift']());}};_0x512a9d(++_0x28d9e2);}(_0x8286,0x66));var _0x6828=function(_0x151c98,_0x8efee0){_0x151c98=_0x151c98-0x0;var _0x272953=_0x8286[_0x151c98];return _0x272953;};'use strict';var Sequelize=require(_0x6828('0x0'));module[_0x6828('0x1')]={'uniqueid':{'type':Sequelize[_0x6828('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6828('0x3')](_0x6828('0x4'),_0x6828('0x5'),_0x6828('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6828('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c304601..b84473a 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 _0xe2d7=['WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','options','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index'];(function(_0x1b4737,_0x3caa41){var _0x1acabb=function(_0x3512c7){while(--_0x3512c7){_0x1b4737['push'](_0x1b4737['shift']());}};_0x1acabb(++_0x3caa41);}(_0xe2d7,0x112));var _0x7e2d=function(_0x1ed443,_0xae65a6){_0x1ed443=_0x1ed443-0x0;var _0x5c9a6f=_0xe2d7[_0x1ed443];return _0x5c9a6f;};'use strict';var emlformat=require(_0x7e2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e2d('0x1'));var jsonpatch=require(_0x7e2d('0x2'));var rp=require(_0x7e2d('0x3'));var moment=require(_0x7e2d('0x4'));var BPromise=require(_0x7e2d('0x5'));var Mustache=require(_0x7e2d('0x6'));var util=require(_0x7e2d('0x7'));var path=require('path');var sox=require(_0x7e2d('0x8'));var csv=require(_0x7e2d('0x9'));var ejs=require(_0x7e2d('0xa'));var fs=require('fs');var fs_extra=require(_0x7e2d('0xb'));var _=require(_0x7e2d('0xc'));var squel=require(_0x7e2d('0xd'));var crypto=require('crypto');var jsforce=require(_0x7e2d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7e2d('0x9'));var querystring=require(_0x7e2d('0xf'));var Papa=require(_0x7e2d('0x10'));var Redis=require(_0x7e2d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7e2d('0x12'));var as=require(_0x7e2d('0x13'));var hardwareService=require(_0x7e2d('0x14'));var logger=require(_0x7e2d('0x15'))(_0x7e2d('0x16'));var utils=require(_0x7e2d('0x17'));var config=require(_0x7e2d('0x18'));var licenseUtil=require(_0x7e2d('0x19'));var db=require(_0x7e2d('0x1a'))['db'];function respondWithStatusCode(_0x42093f,_0x132f8a){_0x132f8a=_0x132f8a||0xcc;return function(_0x2d4817){if(_0x2d4817){return _0x42093f[_0x7e2d('0x1b')](_0x132f8a);}return _0x42093f[_0x7e2d('0x1c')](_0x132f8a)[_0x7e2d('0x1d')]();};}function respondWithResult(_0x524e49,_0x54ca77){_0x54ca77=_0x54ca77||0xc8;return function(_0x1c55d7){if(_0x1c55d7){return _0x524e49[_0x7e2d('0x1c')](_0x54ca77)[_0x7e2d('0x1e')](_0x1c55d7);}};}function respondWithFilteredResult(_0x3ae04b,_0x3ecd4f){return function(_0x13c1b3){if(_0x13c1b3){var _0x28cc4c=typeof _0x3ecd4f[_0x7e2d('0x1f')]===_0x7e2d('0x20')&&typeof _0x3ecd4f[_0x7e2d('0x21')]==='undefined';var _0x23c7a9=_0x13c1b3[_0x7e2d('0x22')];var _0x5ef401=_0x28cc4c?0x0:_0x3ecd4f[_0x7e2d('0x1f')];var _0x5f41b3=_0x28cc4c?_0x13c1b3['count']:_0x3ecd4f[_0x7e2d('0x1f')]+_0x3ecd4f['limit'];var _0x176c2c;if(_0x5f41b3>=_0x23c7a9){_0x5f41b3=_0x23c7a9;_0x176c2c=0xc8;}else{_0x176c2c=0xce;}_0x3ae04b['status'](_0x176c2c);return _0x3ae04b[_0x7e2d('0x23')](_0x7e2d('0x24'),_0x5ef401+'-'+_0x5f41b3+'/'+_0x23c7a9)[_0x7e2d('0x1e')](_0x13c1b3);}return null;};}function patchUpdates(_0xb54606){return function(_0x459dd0){try{jsonpatch[_0x7e2d('0x25')](_0x459dd0,_0xb54606,!![]);}catch(_0x4ca51f){return BPromise[_0x7e2d('0x26')](_0x4ca51f);}return _0x459dd0['save']();};}function saveUpdates(_0xe9d454,_0x472643){return function(_0x365198){if(_0x365198){return _0x365198[_0x7e2d('0x27')](_0xe9d454)[_0x7e2d('0x28')](function(_0x37b249){return _0x37b249;});}return null;};}function removeEntity(_0x2cfb4d,_0x3253c1){return function(_0x4a9f8a){if(_0x4a9f8a){return _0x4a9f8a[_0x7e2d('0x29')]()[_0x7e2d('0x28')](function(){_0x2cfb4d['status'](0xcc)[_0x7e2d('0x1d')]();});}};}function handleEntityNotFound(_0x44aa5c,_0x18d420){return function(_0x5a18f3){if(!_0x5a18f3){_0x44aa5c[_0x7e2d('0x1b')](0x194);}return _0x5a18f3;};}function handleError(_0x4dc9e8,_0x584964){_0x584964=_0x584964||0x1f4;return function(_0x574680){logger[_0x7e2d('0x2a')](_0x574680[_0x7e2d('0x2b')]);if(_0x574680['name']){delete _0x574680['name'];}_0x4dc9e8[_0x7e2d('0x1c')](_0x584964)[_0x7e2d('0x2c')](_0x574680);};}exports[_0x7e2d('0x2d')]=function(_0x5ceb8d,_0x40b623){var _0x33495a={},_0x3d6bcc={},_0x23b89f={'count':0x0,'rows':[]};var _0x1526a4=_['map'](db[_0x7e2d('0x2e')][_0x7e2d('0x2f')],function(_0x1388eb){return{'name':_0x1388eb[_0x7e2d('0x30')],'type':_0x1388eb[_0x7e2d('0x31')][_0x7e2d('0x32')]};});_0x3d6bcc[_0x7e2d('0x33')]=_[_0x7e2d('0x34')](_0x1526a4,_0x7e2d('0x35'));_0x3d6bcc[_0x7e2d('0x36')]=_[_0x7e2d('0x37')](_0x5ceb8d['query']);_0x3d6bcc[_0x7e2d('0x38')]=_[_0x7e2d('0x39')](_0x3d6bcc[_0x7e2d('0x33')],_0x3d6bcc[_0x7e2d('0x36')]);_0x33495a[_0x7e2d('0x3a')]=_[_0x7e2d('0x39')](_0x3d6bcc[_0x7e2d('0x33')],qs[_0x7e2d('0x3b')](_0x5ceb8d['query'][_0x7e2d('0x3b')]));_0x33495a[_0x7e2d('0x3a')]=_0x33495a[_0x7e2d('0x3a')][_0x7e2d('0x3c')]?_0x33495a[_0x7e2d('0x3a')]:_0x3d6bcc[_0x7e2d('0x33')];if(!_0x5ceb8d[_0x7e2d('0x36')][_0x7e2d('0x3d')](_0x7e2d('0x3e'))){_0x33495a[_0x7e2d('0x21')]=qs['limit'](_0x5ceb8d[_0x7e2d('0x36')][_0x7e2d('0x21')]);_0x33495a[_0x7e2d('0x1f')]=qs[_0x7e2d('0x1f')](_0x5ceb8d[_0x7e2d('0x36')][_0x7e2d('0x1f')]);}_0x33495a[_0x7e2d('0x3f')]=qs[_0x7e2d('0x40')](_0x5ceb8d[_0x7e2d('0x36')][_0x7e2d('0x40')]);_0x33495a[_0x7e2d('0x41')]=qs['filters'](_['pick'](_0x5ceb8d[_0x7e2d('0x36')],_0x3d6bcc['filters']),_0x1526a4);if(_0x5ceb8d[_0x7e2d('0x36')][_0x7e2d('0x42')]){_0x33495a['where']=_['merge'](_0x33495a['where'],{'$or':_[_0x7e2d('0x34')](_0x1526a4,function(_0x2c7e9b){if(_0x2c7e9b[_0x7e2d('0x31')]!==_0x7e2d('0x43')){var _0x39ad15={};_0x39ad15[_0x2c7e9b[_0x7e2d('0x35')]]={'$like':'%'+_0x5ceb8d[_0x7e2d('0x36')][_0x7e2d('0x42')]+'%'};return _0x39ad15;}})});}_0x33495a=_[_0x7e2d('0x44')]({},_0x33495a,_0x5ceb8d['options']);var _0x484502={'where':_0x33495a['where']};return db[_0x7e2d('0x2e')][_0x7e2d('0x22')](_0x484502)[_0x7e2d('0x28')](function(_0x2fed08){_0x23b89f[_0x7e2d('0x22')]=_0x2fed08;if(_0x5ceb8d['query'][_0x7e2d('0x45')]){_0x33495a[_0x7e2d('0x46')]=[{'all':!![]}];}return db[_0x7e2d('0x2e')][_0x7e2d('0x47')](_0x33495a);})[_0x7e2d('0x28')](function(_0xcd7585){_0x23b89f[_0x7e2d('0x48')]=_0xcd7585;return _0x23b89f;})['then'](respondWithFilteredResult(_0x40b623,_0x33495a))['catch'](handleError(_0x40b623,null));};exports['show']=function(_0x110a10,_0x3c4403){var _0x312c74={'raw':!![],'where':{'id':_0x110a10[_0x7e2d('0x49')]['id']}},_0x48f864={};_0x48f864[_0x7e2d('0x33')]=_[_0x7e2d('0x37')](db[_0x7e2d('0x2e')][_0x7e2d('0x2f')]);_0x48f864['query']=_[_0x7e2d('0x37')](_0x110a10[_0x7e2d('0x36')]);_0x48f864[_0x7e2d('0x38')]=_[_0x7e2d('0x39')](_0x48f864['model'],_0x48f864['query']);_0x312c74['attributes']=_[_0x7e2d('0x39')](_0x48f864[_0x7e2d('0x33')],qs[_0x7e2d('0x3b')](_0x110a10[_0x7e2d('0x36')][_0x7e2d('0x3b')]));_0x312c74[_0x7e2d('0x3a')]=_0x312c74[_0x7e2d('0x3a')]['length']?_0x312c74[_0x7e2d('0x3a')]:_0x48f864[_0x7e2d('0x33')];if(_0x110a10[_0x7e2d('0x36')][_0x7e2d('0x45')]){_0x312c74['include']=[{'all':!![]}];}_0x312c74=_['merge']({},_0x312c74,_0x110a10[_0x7e2d('0x4a')]);return db[_0x7e2d('0x2e')]['find'](_0x312c74)[_0x7e2d('0x28')](handleEntityNotFound(_0x3c4403,null))[_0x7e2d('0x28')](respondWithResult(_0x3c4403,null))[_0x7e2d('0x4b')](handleError(_0x3c4403,null));};exports[_0x7e2d('0x4c')]=function(_0x27e5da,_0xe7dedc){return db[_0x7e2d('0x2e')]['create'](_0x27e5da[_0x7e2d('0x4d')],{})['then'](respondWithResult(_0xe7dedc,0xc9))[_0x7e2d('0x4b')](handleError(_0xe7dedc,null));};exports[_0x7e2d('0x27')]=function(_0x475b7e,_0x3ff826){if(_0x475b7e[_0x7e2d('0x4d')]['id']){delete _0x475b7e['body']['id'];}return db[_0x7e2d('0x2e')][_0x7e2d('0x4e')]({'where':{'id':_0x475b7e[_0x7e2d('0x49')]['id']}})[_0x7e2d('0x28')](handleEntityNotFound(_0x3ff826,null))[_0x7e2d('0x28')](saveUpdates(_0x475b7e[_0x7e2d('0x4d')],null))[_0x7e2d('0x28')](respondWithResult(_0x3ff826,null))[_0x7e2d('0x4b')](handleError(_0x3ff826,null));};exports[_0x7e2d('0x29')]=function(_0x26c3df,_0x21beb6){return db[_0x7e2d('0x2e')][_0x7e2d('0x4e')]({'where':{'id':_0x26c3df[_0x7e2d('0x49')]['id']}})[_0x7e2d('0x28')](handleEntityNotFound(_0x21beb6,null))[_0x7e2d('0x28')](removeEntity(_0x21beb6,null))['catch'](handleError(_0x21beb6,null));};exports[_0x7e2d('0x4f')]=function(_0x21caf7,_0x113028){return db[_0x7e2d('0x2e')][_0x7e2d('0x4f')]()[_0x7e2d('0x28')](respondWithResult(_0x113028,null))[_0x7e2d('0x4b')](handleError(_0x113028,null));}; \ No newline at end of file +var _0xd6ed=['update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','WhatsappTransferReport','findAll','show','options','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x423035,_0x51ddeb){var _0x3645fc=function(_0x2205f8){while(--_0x2205f8){_0x423035['push'](_0x423035['shift']());}};_0x3645fc(++_0x51ddeb);}(_0xd6ed,0x1aa));var _0xdd6e=function(_0x103976,_0xba3169){_0x103976=_0x103976-0x0;var _0x3bb94e=_0xd6ed[_0x103976];return _0x3bb94e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd6e('0x0'));var zipdir=require(_0xdd6e('0x1'));var jsonpatch=require(_0xdd6e('0x2'));var rp=require(_0xdd6e('0x3'));var moment=require(_0xdd6e('0x4'));var BPromise=require(_0xdd6e('0x5'));var Mustache=require(_0xdd6e('0x6'));var util=require(_0xdd6e('0x7'));var path=require(_0xdd6e('0x8'));var sox=require(_0xdd6e('0x9'));var csv=require(_0xdd6e('0xa'));var ejs=require(_0xdd6e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdd6e('0xc'));var crypto=require(_0xdd6e('0xd'));var jsforce=require(_0xdd6e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdd6e('0xf'));var Papa=require('papaparse');var Redis=require(_0xdd6e('0x10'));var authService=require(_0xdd6e('0x11'));var qs=require(_0xdd6e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd6e('0x13'));var logger=require(_0xdd6e('0x14'))(_0xdd6e('0x15'));var utils=require(_0xdd6e('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdd6e('0x17'))['db'];function respondWithStatusCode(_0x510ea4,_0x5a0eaf){_0x5a0eaf=_0x5a0eaf||0xcc;return function(_0xf200){if(_0xf200){return _0x510ea4[_0xdd6e('0x18')](_0x5a0eaf);}return _0x510ea4[_0xdd6e('0x19')](_0x5a0eaf)[_0xdd6e('0x1a')]();};}function respondWithResult(_0x554906,_0x9e2bda){_0x9e2bda=_0x9e2bda||0xc8;return function(_0x2483f8){if(_0x2483f8){return _0x554906[_0xdd6e('0x19')](_0x9e2bda)[_0xdd6e('0x1b')](_0x2483f8);}};}function respondWithFilteredResult(_0xf899,_0x41b6ad){return function(_0x40728a){if(_0x40728a){var _0x36c0c8=typeof _0x41b6ad['offset']===_0xdd6e('0x1c')&&typeof _0x41b6ad['limit']===_0xdd6e('0x1c');var _0x14b01f=_0x40728a[_0xdd6e('0x1d')];var _0x527c7b=_0x36c0c8?0x0:_0x41b6ad[_0xdd6e('0x1e')];var _0x6bb629=_0x36c0c8?_0x40728a[_0xdd6e('0x1d')]:_0x41b6ad['offset']+_0x41b6ad[_0xdd6e('0x1f')];var _0x32b2d6;if(_0x6bb629>=_0x14b01f){_0x6bb629=_0x14b01f;_0x32b2d6=0xc8;}else{_0x32b2d6=0xce;}_0xf899['status'](_0x32b2d6);return _0xf899[_0xdd6e('0x20')](_0xdd6e('0x21'),_0x527c7b+'-'+_0x6bb629+'/'+_0x14b01f)[_0xdd6e('0x1b')](_0x40728a);}return null;};}function patchUpdates(_0xa24f09){return function(_0x57bc30){try{jsonpatch[_0xdd6e('0x22')](_0x57bc30,_0xa24f09,!![]);}catch(_0x2e3f47){return BPromise[_0xdd6e('0x23')](_0x2e3f47);}return _0x57bc30['save']();};}function saveUpdates(_0x3c2376,_0xf4f6d4){return function(_0x5ac8fe){if(_0x5ac8fe){return _0x5ac8fe[_0xdd6e('0x24')](_0x3c2376)[_0xdd6e('0x25')](function(_0x3b088e){return _0x3b088e;});}return null;};}function removeEntity(_0x4e72e1,_0x2e9174){return function(_0x2a3447){if(_0x2a3447){return _0x2a3447[_0xdd6e('0x26')]()[_0xdd6e('0x25')](function(){_0x4e72e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f380f,_0x37ffc0){return function(_0x2e7702){if(!_0x2e7702){_0x4f380f['sendStatus'](0x194);}return _0x2e7702;};}function handleError(_0x54b679,_0x8bb9cf){_0x8bb9cf=_0x8bb9cf||0x1f4;return function(_0x2c2ef5){logger[_0xdd6e('0x27')](_0x2c2ef5[_0xdd6e('0x28')]);if(_0x2c2ef5[_0xdd6e('0x29')]){delete _0x2c2ef5[_0xdd6e('0x29')];}_0x54b679['status'](_0x8bb9cf)[_0xdd6e('0x2a')](_0x2c2ef5);};}exports[_0xdd6e('0x2b')]=function(_0x51a68b,_0x48cc63){var _0x554fee={},_0x5a895f={},_0x53ed4b={'count':0x0,'rows':[]};var _0x43f3f9=_[_0xdd6e('0x2c')](db['WhatsappTransferReport'][_0xdd6e('0x2d')],function(_0x53cb1e){return{'name':_0x53cb1e['fieldName'],'type':_0x53cb1e['type'][_0xdd6e('0x2e')]};});_0x5a895f['model']=_[_0xdd6e('0x2c')](_0x43f3f9,_0xdd6e('0x29'));_0x5a895f['query']=_[_0xdd6e('0x2f')](_0x51a68b['query']);_0x5a895f[_0xdd6e('0x30')]=_[_0xdd6e('0x31')](_0x5a895f[_0xdd6e('0x32')],_0x5a895f[_0xdd6e('0x33')]);_0x554fee[_0xdd6e('0x34')]=_['intersection'](_0x5a895f['model'],qs[_0xdd6e('0x35')](_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x35')]));_0x554fee['attributes']=_0x554fee[_0xdd6e('0x34')][_0xdd6e('0x36')]?_0x554fee[_0xdd6e('0x34')]:_0x5a895f[_0xdd6e('0x32')];if(!_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x37')](_0xdd6e('0x38'))){_0x554fee['limit']=qs['limit'](_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x1f')]);_0x554fee[_0xdd6e('0x1e')]=qs['offset'](_0x51a68b[_0xdd6e('0x33')]['offset']);}_0x554fee[_0xdd6e('0x39')]=qs['sort'](_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x3a')]);_0x554fee[_0xdd6e('0x3b')]=qs[_0xdd6e('0x30')](_[_0xdd6e('0x3c')](_0x51a68b[_0xdd6e('0x33')],_0x5a895f[_0xdd6e('0x30')]),_0x43f3f9);if(_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x3d')]){_0x554fee[_0xdd6e('0x3b')]=_[_0xdd6e('0x3e')](_0x554fee[_0xdd6e('0x3b')],{'$or':_[_0xdd6e('0x2c')](_0x43f3f9,function(_0x503f91){if(_0x503f91[_0xdd6e('0x3f')]!==_0xdd6e('0x40')){var _0x28f5f0={};_0x28f5f0[_0x503f91[_0xdd6e('0x29')]]={'$like':'%'+_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x3d')]+'%'};return _0x28f5f0;}})});}_0x554fee=_[_0xdd6e('0x3e')]({},_0x554fee,_0x51a68b['options']);var _0x2f7b66={'where':_0x554fee[_0xdd6e('0x3b')]};return db['WhatsappTransferReport'][_0xdd6e('0x1d')](_0x2f7b66)[_0xdd6e('0x25')](function(_0x18bf02){_0x53ed4b[_0xdd6e('0x1d')]=_0x18bf02;if(_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x41')]){_0x554fee[_0xdd6e('0x42')]=[{'all':!![]}];}return db[_0xdd6e('0x43')][_0xdd6e('0x44')](_0x554fee);})[_0xdd6e('0x25')](function(_0xb93fd1){_0x53ed4b['rows']=_0xb93fd1;return _0x53ed4b;})['then'](respondWithFilteredResult(_0x48cc63,_0x554fee))['catch'](handleError(_0x48cc63,null));};exports[_0xdd6e('0x45')]=function(_0x41c86a,_0x58c4b3){var _0x4381be={'raw':!![],'where':{'id':_0x41c86a['params']['id']}},_0x5a5a78={};_0x5a5a78[_0xdd6e('0x32')]=_['keys'](db[_0xdd6e('0x43')][_0xdd6e('0x2d')]);_0x5a5a78[_0xdd6e('0x33')]=_[_0xdd6e('0x2f')](_0x41c86a['query']);_0x5a5a78[_0xdd6e('0x30')]=_['intersection'](_0x5a5a78['model'],_0x5a5a78[_0xdd6e('0x33')]);_0x4381be[_0xdd6e('0x34')]=_[_0xdd6e('0x31')](_0x5a5a78[_0xdd6e('0x32')],qs['fields'](_0x41c86a[_0xdd6e('0x33')][_0xdd6e('0x35')]));_0x4381be['attributes']=_0x4381be[_0xdd6e('0x34')][_0xdd6e('0x36')]?_0x4381be[_0xdd6e('0x34')]:_0x5a5a78[_0xdd6e('0x32')];if(_0x41c86a[_0xdd6e('0x33')]['includeAll']){_0x4381be[_0xdd6e('0x42')]=[{'all':!![]}];}_0x4381be=_[_0xdd6e('0x3e')]({},_0x4381be,_0x41c86a[_0xdd6e('0x46')]);return db[_0xdd6e('0x43')][_0xdd6e('0x47')](_0x4381be)[_0xdd6e('0x25')](handleEntityNotFound(_0x58c4b3,null))[_0xdd6e('0x25')](respondWithResult(_0x58c4b3,null))[_0xdd6e('0x48')](handleError(_0x58c4b3,null));};exports['create']=function(_0x10a211,_0x5ba453){return db[_0xdd6e('0x43')][_0xdd6e('0x49')](_0x10a211[_0xdd6e('0x4a')],{})[_0xdd6e('0x25')](respondWithResult(_0x5ba453,0xc9))[_0xdd6e('0x48')](handleError(_0x5ba453,null));};exports[_0xdd6e('0x24')]=function(_0x3f3d07,_0x15d913){if(_0x3f3d07[_0xdd6e('0x4a')]['id']){delete _0x3f3d07[_0xdd6e('0x4a')]['id'];}return db[_0xdd6e('0x43')][_0xdd6e('0x47')]({'where':{'id':_0x3f3d07[_0xdd6e('0x4b')]['id']}})[_0xdd6e('0x25')](handleEntityNotFound(_0x15d913,null))[_0xdd6e('0x25')](saveUpdates(_0x3f3d07[_0xdd6e('0x4a')],null))['then'](respondWithResult(_0x15d913,null))[_0xdd6e('0x48')](handleError(_0x15d913,null));};exports['destroy']=function(_0x5d605f,_0x52963f){return db[_0xdd6e('0x43')]['find']({'where':{'id':_0x5d605f[_0xdd6e('0x4b')]['id']}})[_0xdd6e('0x25')](handleEntityNotFound(_0x52963f,null))[_0xdd6e('0x25')](removeEntity(_0x52963f,null))[_0xdd6e('0x48')](handleError(_0x52963f,null));};exports[_0xdd6e('0x4c')]=function(_0x4c3a66,_0x55354c){return db[_0xdd6e('0x43')][_0xdd6e('0x4c')]()[_0xdd6e('0x25')](respondWithResult(_0x55354c,null))['catch'](handleError(_0x55354c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 546711b..061225d 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 _0xb73b=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb73b,0x8a));var _0xbb73=function(_0x4ff975,_0x3b078f){_0x4ff975=_0x4ff975-0x0;var _0x1767b1=_0xb73b[_0x4ff975];return _0x1767b1;};'use strict';var _=require(_0xbb73('0x0'));var util=require(_0xbb73('0x1'));var logger=require(_0xbb73('0x2'))(_0xbb73('0x3'));var moment=require(_0xbb73('0x4'));var BPromise=require(_0xbb73('0x5'));var rp=require(_0xbb73('0x6'));var fs=require('fs');var path=require(_0xbb73('0x7'));var rimraf=require('rimraf');var config=require(_0xbb73('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0xbb73('0x9')]=function(_0xcc4a2,_0x223260){return _0xcc4a2[_0xbb73('0xa')](_0xbb73('0xb'),attributes,{'tableName':_0xbb73('0xc'),'paranoid':![],'indexes':[{'name':_0xbb73('0xd'),'fields':[_0xbb73('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2704=['uniqueid','lodash','util','../../config/logger','request-promise','rimraf','./whatsappTransferReport.attributes','define','report_whatsapp_transfer'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x2704,0x118));var _0x4270=function(_0x6b1c9e,_0x322a1){_0x6b1c9e=_0x6b1c9e-0x0;var _0x4fb0d5=_0x2704[_0x6b1c9e];return _0x4fb0d5;};'use strict';var _=require(_0x4270('0x0'));var util=require(_0x4270('0x1'));var logger=require(_0x4270('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4270('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4270('0x4'));var config=require('../../config/environment');var attributes=require(_0x4270('0x5'));module['exports']=function(_0x32835d,_0x34e7c4){return _0x32835d[_0x4270('0x6')]('WhatsappTransferReport',attributes,{'tableName':_0x4270('0x7'),'paranoid':![],'indexes':[{'name':_0x4270('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 4a0ac8c..dac7205 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 _0x5322=['jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x56ac6a,_0x35ed04){var _0x169575=function(_0x1c5694){while(--_0x1c5694){_0x56ac6a['push'](_0x56ac6a['shift']());}};_0x169575(++_0x35ed04);}(_0x5322,0xff));var _0x2532=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x5322[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require(_0x2532('0x0'));var util=require(_0x2532('0x1'));var moment=require(_0x2532('0x2'));var BPromise=require('bluebird');var rs=require(_0x2532('0x3'));var fs=require('fs');var Redis=require(_0x2532('0x4'));var db=require(_0x2532('0x5'))['db'];var utils=require(_0x2532('0x6'));var logger=require('../../config/logger')(_0x2532('0x7'));var config=require(_0x2532('0x8'));var jayson=require(_0x2532('0x9'));var client=jayson[_0x2532('0xa')][_0x2532('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x374131,_0x57bce6,_0x2589f8){return new BPromise(function(_0x18eae3,_0x1290e6){return client[_0x2532('0xc')](_0x374131,_0x2589f8)[_0x2532('0xd')](function(_0x11488a){logger['info'](_0x2532('0xe'),_0x57bce6,_0x2532('0xf'));logger[_0x2532('0x10')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x57bce6,_0x2532('0xf'),JSON[_0x2532('0x11')](_0x11488a));if(_0x11488a[_0x2532('0x12')]){if(_0x11488a[_0x2532('0x12')][_0x2532('0x13')]===0x1f4){logger[_0x2532('0x12')](_0x2532('0xe'),_0x57bce6,_0x11488a[_0x2532('0x12')][_0x2532('0x14')]);return _0x1290e6(_0x11488a[_0x2532('0x12')][_0x2532('0x14')]);}logger[_0x2532('0x12')](_0x2532('0xe'),_0x57bce6,_0x11488a[_0x2532('0x12')][_0x2532('0x14')]);return _0x18eae3(_0x11488a['error'][_0x2532('0x14')]);}else{logger[_0x2532('0x15')](_0x2532('0xe'),_0x57bce6,'request\x20sent');_0x18eae3(_0x11488a[_0x2532('0x16')][_0x2532('0x14')]);}})[_0x2532('0x17')](function(_0xe0f10c){logger['error'](_0x2532('0xe'),_0x57bce6,_0xe0f10c);_0x1290e6(_0xe0f10c);});});} \ No newline at end of file +var _0xc208=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1b28ff,_0x2f6364){var _0x369ba3=function(_0x688258){while(--_0x688258){_0x1b28ff['push'](_0x1b28ff['shift']());}};_0x369ba3(++_0x2f6364);}(_0xc208,0x125));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x8c20('0x0'));var moment=require(_0x8c20('0x1'));var BPromise=require(_0x8c20('0x2'));var rs=require(_0x8c20('0x3'));var fs=require('fs');var Redis=require(_0x8c20('0x4'));var db=require(_0x8c20('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c20('0x6'))(_0x8c20('0x7'));var config=require(_0x8c20('0x8'));var jayson=require(_0x8c20('0x9'));var client=jayson[_0x8c20('0xa')][_0x8c20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30eeab,_0x44629d,_0x4ca7bf){return new BPromise(function(_0x364962,_0x6887be){return client[_0x8c20('0xc')](_0x30eeab,_0x4ca7bf)[_0x8c20('0xd')](function(_0x20a8eb){logger[_0x8c20('0xe')](_0x8c20('0xf'),_0x44629d,_0x8c20('0x10'));logger[_0x8c20('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x44629d,_0x8c20('0x10'),JSON['stringify'](_0x20a8eb));if(_0x20a8eb['error']){if(_0x20a8eb[_0x8c20('0x12')][_0x8c20('0x13')]===0x1f4){logger[_0x8c20('0x12')](_0x8c20('0xf'),_0x44629d,_0x20a8eb[_0x8c20('0x12')][_0x8c20('0x14')]);return _0x6887be(_0x20a8eb['error']['message']);}logger[_0x8c20('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x44629d,_0x20a8eb[_0x8c20('0x12')][_0x8c20('0x14')]);return _0x364962(_0x20a8eb[_0x8c20('0x12')][_0x8c20('0x14')]);}else{logger['info'](_0x8c20('0xf'),_0x44629d,_0x8c20('0x10'));_0x364962(_0x20a8eb[_0x8c20('0x15')][_0x8c20('0x14')]);}})['catch'](function(_0x5036df){logger['error'](_0x8c20('0xf'),_0x44629d,_0x5036df);_0x6887be(_0x5036df);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2af4fdf..2c7a2a3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71ad=['App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./config/environment','./config/logger','./config/pm2','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','map','pm2_env','online','name','join','None'];(function(_0x2d31b2,_0x1cf49d){var _0x5328be=function(_0x4dbe9c){while(--_0x4dbe9c){_0x2d31b2['push'](_0x2d31b2['shift']());}};_0x5328be(++_0x1cf49d);}(_0x71ad,0xee));var _0xd71a=function(_0x449729,_0x4a58f6){_0x449729=_0x449729-0x0;var _0x4bc766=_0x71ad[_0x449729];return _0x4bc766;};'use strict';var _=require(_0xd71a('0x0'));var db=require(_0xd71a('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xd71a('0x2'));var rpc=require('./rpc');var config=require(_0xd71a('0x3'));var logger=require(_0xd71a('0x4'))('app');var pm2=require(_0xd71a('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xd71a('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xd71a('0x7'));var provider=require(_0xd71a('0x8'));function main(){return db[_0xd71a('0x9')][_0xd71a('0xa')]()[_0xd71a('0xb')](function(){if(config[_0xd71a('0xc')]){return seedDb[_0xd71a('0xd')]();}})['then'](function(){return checkLicense[_0xd71a('0xd')]();})['then'](function(){return rpc['listen']();})[_0xd71a('0xb')](function(_0x38af93){logger[_0xd71a('0xe')](_0x38af93);return chat[_0xd71a('0xf')]();})[_0xd71a('0xb')](function(){return whatsapp[_0xd71a('0xf')]();})[_0xd71a('0xb')](function(){return schedule[_0xd71a('0xf')]();})[_0xd71a('0xb')](function(){return transcribe[_0xd71a('0xf')]();})['then'](function(){return provider[_0xd71a('0xf')]();})[_0xd71a('0xb')](function(_0x3bdeea){logger[_0xd71a('0xe')](_0x3bdeea);return pm2[_0xd71a('0xf')](pm2Config);})[_0xd71a('0xb')](function(_0x10c0de){var _0x188886=_0x10c0de[_0xd71a('0x10')](function(_0xfdcc6d){return typeof _0xfdcc6d[_0xd71a('0x11')]===_0xd71a('0x12')&&_0xfdcc6d[_0xd71a('0x11')]>=0x0;});if(_0x188886[_0xd71a('0x13')]>0x0){throw new Error(_0x188886[_0xd71a('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xd71a('0x14')](_0x188886,function(_0x21334d){return'\x22'+_0x21334d[_0xd71a('0x15')]['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0xd71a('0x14')](_[_0xd71a('0x10')](_0x10c0de,{'status':_0xd71a('0x16')}),_0xd71a('0x17'))[_0xd71a('0x18')]());logger[_0xd71a('0xe')]('Offline\x20apps:',_[_0xd71a('0x14')](_[_0xd71a('0x10')](_0x10c0de,function(_0x4f1eb7){return _0x4f1eb7['status']!==_0xd71a('0x16');}),_0xd71a('0x17'))[_0xd71a('0x18')]()||_0xd71a('0x19'));console['log'](_0xd71a('0x1a'));})[_0xd71a('0x1b')](function(_0x192b76){console[_0xd71a('0x1c')](_0xd71a('0x1d'),_0x192b76);logger[_0xd71a('0x1e')](_0xd71a('0x1f'),_0x192b76);process[_0xd71a('0x20')](0x1);});}main(); \ No newline at end of file +var _0x5a52=['pm2_env','name','Online\x20apps:','map','join','Offline\x20apps:','status','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x4d7f6a,_0x5e0f44){var _0x3a019a=function(_0x4c9642){while(--_0x4c9642){_0x4d7f6a['push'](_0x4d7f6a['shift']());}};_0x3a019a(++_0x5e0f44);}(_0x5a52,0x18d));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x25a5('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0x25a5('0x1'));var config=require(_0x25a5('0x2'));var logger=require(_0x25a5('0x3'))(_0x25a5('0x4'));var pm2=require(_0x25a5('0x5'));var pm2Config=require(_0x25a5('0x6'));var schedule=require(_0x25a5('0x7'));var chat=require(_0x25a5('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x25a5('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x25a5('0xa')][_0x25a5('0xb')]()[_0x25a5('0xc')](function(){if(config[_0x25a5('0xd')]){return seedDb[_0x25a5('0xe')]();}})[_0x25a5('0xc')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x25a5('0xf')]();})[_0x25a5('0xc')](function(_0x107e85){logger[_0x25a5('0x10')](_0x107e85);return chat[_0x25a5('0x11')]();})[_0x25a5('0xc')](function(){return whatsapp[_0x25a5('0x11')]();})[_0x25a5('0xc')](function(){return schedule['start']();})[_0x25a5('0xc')](function(){return transcribe[_0x25a5('0x11')]();})[_0x25a5('0xc')](function(){return provider['start']();})[_0x25a5('0xc')](function(_0x4a6a9a){logger[_0x25a5('0x10')](_0x4a6a9a);return pm2[_0x25a5('0x11')](pm2Config);})[_0x25a5('0xc')](function(_0x47d1d1){var _0x4c5f3a=_0x47d1d1[_0x25a5('0x12')](function(_0x5e1590){return typeof _0x5e1590[_0x25a5('0x13')]===_0x25a5('0x14')&&_0x5e1590[_0x25a5('0x13')]>=0x0;});if(_0x4c5f3a[_0x25a5('0x15')]>0x0){throw new Error(_0x4c5f3a['length']+_0x25a5('0x16')+_['map'](_0x4c5f3a,function(_0x5f257b){return'\x22'+_0x5f257b[_0x25a5('0x17')][_0x25a5('0x18')]+'\x22';}));}logger[_0x25a5('0x10')](_0x25a5('0x19'),_[_0x25a5('0x1a')](_['filter'](_0x47d1d1,{'status':'online'}),_0x25a5('0x18'))[_0x25a5('0x1b')]());logger[_0x25a5('0x10')](_0x25a5('0x1c'),_[_0x25a5('0x1a')](_[_0x25a5('0x12')](_0x47d1d1,function(_0x514c59){return _0x514c59[_0x25a5('0x1d')]!=='online';}),'name')[_0x25a5('0x1b')]()||'None');console[_0x25a5('0x1e')](_0x25a5('0x1f'));})['catch'](function(_0x312d01){console[_0x25a5('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x312d01);logger[_0x25a5('0x20')](_0x25a5('0x21'),_0x312d01);process[_0x25a5('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 66fe8c5..e6c6a65 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 _0x55ca=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','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~!@#$%^&-_=+[{]}.','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.','splice','unshift','encryptString','join','promisify','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','catch','query','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken'];(function(_0x2415a1,_0x2b3109){var _0x2577ce=function(_0x178749){while(--_0x178749){_0x2415a1['push'](_0x2415a1['shift']());}};_0x2577ce(++_0x2b3109);}(_0x55ca,0x126));var _0xa55c=function(_0x274208,_0x3182ff){_0x274208=_0x274208-0x0;var _0x209164=_0x55ca[_0x274208];return _0x209164;};'use strict';var db=require(_0xa55c('0x0'))['db'];var config=require(_0xa55c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa55c('0x2'));var jwt=require(_0xa55c('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa55c('0x4'));var basicAuth=require(_0xa55c('0x5'));var crypto=require(_0xa55c('0x6'));var BPromise=require(_0xa55c('0x7'));var util=require(_0xa55c('0x8'));var moment=require(_0xa55c('0x9'));var validateJwt=expressJwt({'secret':config[_0xa55c('0xa')]['session']});var userAttributes=['id',_0xa55c('0xb'),_0xa55c('0xc'),'name',_0xa55c('0xd'),_0xa55c('0xe'),'userpic','permissions',_0xa55c('0xf'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x13'),_0xa55c('0x14'),_0xa55c('0x15'),_0xa55c('0x16'),_0xa55c('0x17'),_0xa55c('0x18'),'lastPauseAt','crudPermissions',_0xa55c('0x19'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xa55c('0x1a'),_0xa55c('0x1b'),_0xa55c('0x1c'),_0xa55c('0x1d'),_0xa55c('0x1e'),_0xa55c('0x1f'),'phoneBarPrefixRequired',_0xa55c('0x20'),_0xa55c('0x21'),_0xa55c('0x22'),_0xa55c('0x23'),_0xa55c('0x24'),_0xa55c('0x25'),_0xa55c('0x26'),_0xa55c('0x27'),_0xa55c('0x28'),'downloadOmnichannelInteractions',_0xa55c('0x29'),_0xa55c('0x2a'),_0xa55c('0x2b'),_0xa55c('0x2c'),_0xa55c('0x2d'),_0xa55c('0x2e'),'emailAutoanswerDelay','smsAutoanswer',_0xa55c('0x2f'),_0xa55c('0x30'),_0xa55c('0x31'),'faxAutoanswer',_0xa55c('0x32'),_0xa55c('0x33'),'whatsappAutoanswerDelay'];exports[_0xa55c('0x34')]=function(){return this[_0xa55c('0x35')](!![])[_0xa55c('0x36')](function(_0x1965f1,_0x234372,_0x49ed04){if(_0x1965f1[_0xa55c('0x37')]){_0x49ed04();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1965f1['params']['id']},'attributes':['id',_0xa55c('0x38'),'disposition'],'raw':!![]})[_0xa55c('0x39')](function(_0x190757){if(_0x190757&&_0x190757[_0xa55c('0x38')]){return _0x234372[_0xa55c('0x3a')](_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?0x195:0x193)[_0xa55c('0x3d')]({'message':_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?_0xa55c('0x3e'):_0xa55c('0x3f')});}else{_0x49ed04();}})['catch'](function(_0x430d55){_0x49ed04(_0x430d55);});}});};exports[_0xa55c('0x35')]=function isAuthenticated(_0x1c9f6b){return compose()[_0xa55c('0x36')](function(_0x5d940d,_0x1377b0,_0x22f6b6){var _0x1b8388;if(_0x5d940d[_0xa55c('0x40')][_0xa55c('0x41')]){if(_[_0xa55c('0x42')](_0x5d940d['headers'][_0xa55c('0x41')],'Basic')){var _0x35c9c2=basicAuth(_0x5d940d);db[_0xa55c('0x43')][_0xa55c('0x44')]({'where':{'name':_0x35c9c2[_0xa55c('0x45')]}})['then'](function(_0x3d28fb){if(!_0x3d28fb||!_0x3d28fb[_0xa55c('0x46')](_0x35c9c2[_0xa55c('0x47')])){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x48')});}_0x5d940d[_0xa55c('0x37')]={'id':_0x3d28fb['id']};_0x22f6b6();})[_0xa55c('0x49')](function(_0x2808e9){_0x22f6b6(_0x2808e9);});}else if(_[_0xa55c('0x42')](_0x5d940d[_0xa55c('0x40')]['authorization'],'Bearer')){validateJwt(_0x5d940d,_0x1377b0,_0x22f6b6);}else{if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')]){try{var _0x2e9623={'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};verifyJwt(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')],_0x2e9623)[_0xa55c('0x39')](function(_0x3959e3){return db['User']['find']({'where':{'id':_0x3959e3['sub']}})[_0xa55c('0x39')](function(_0x18e00e){_0x1b8388=_0x18e00e;return db[_0xa55c('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0xa55c('0x4e'),'blockDuration'],'raw':!![]});})[_0xa55c('0x39')](function(_0x4ad813){if(!_0x1b8388||!_[_0xa55c('0x4f')](_0x1b8388[_0xa55c('0x50')],_0x3959e3[_0xa55c('0x51')])){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x52')});}if(_0x1b8388['disabled']){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b8388['blocked']){if(_0x4ad813[_0xa55c('0x53')]>0x0){if(moment(_0x1b8388['blockedAt'])[_0xa55c('0x54')](_0x4ad813[_0xa55c('0x53')],'minutes')>moment()){return _0x1377b0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});}}_0x5d940d[_0xa55c('0x37')]={'id':_0x1b8388['id']};_0x22f6b6();});})[_0xa55c('0x49')](function(){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});});}catch(_0x77d623){_0x22f6b6(_0x77d623);}}else if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':_0xa55c('0x56')});}})['use'](function(_0x386e34,_0x5ee63d,_0x57a972){if(_0x386e34[_0xa55c('0x37')]){db[_0xa55c('0x43')]['find']({'where':{'id':_0x386e34[_0xa55c('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5f25f7){if(!_0x5f25f7){return _0x5ee63d[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x57')});}_0x386e34['user']=_0x5f25f7;_0x57a972();})[_0xa55c('0x49')](function(_0xd5a006){_0x57a972(_0xd5a006);});}else if(_0x1c9f6b){_0x57a972();}else{return _0x5ee63d['status'](0x194)[_0xa55c('0x3d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa55c('0x58')]=function canUpdate(){return compose()[_0xa55c('0x36')](function(_0x5be43f,_0x66d1de,_0x1dae70){return licenseUtil['getLicense']()[_0xa55c('0x39')](function(_0x187e09){if(_0x187e09[_0xa55c('0x59')]){_0x1dae70();}else{return _0x66d1de['status'](0x193)[_0xa55c('0x3d')]({'message':'Forbidden'});}})[_0xa55c('0x49')](function(_0x3a8af4){_0x1dae70(_0x3a8af4);});});};exports[_0xa55c('0x5a')]=function isWebrtcLicence(){return compose()['use'](function(_0x41eab1,_0x106adb,_0x592429){return licenseUtil[_0xa55c('0x5b')]()[_0xa55c('0x39')](function(_0x5d5cf6){if(_0x5d5cf6[_0xa55c('0x5c')]){_0x592429();}else{return _0x106adb[_0xa55c('0x3a')](0x193)['json']({'message':_0xa55c('0x5d')});}})[_0xa55c('0x49')](function(_0x219a68){_0x592429(_0x219a68);});});};exports[_0xa55c('0x5e')]=function(_0x564cb3,_0x143989,_0x58a7ea){_0x564cb3[_0xa55c('0x5e')]=!![];return _0x58a7ea();};exports[_0xa55c('0x5f')]=function signToken(_0x194a79){return signJwt(_0x194a79);};exports['setTokenCookie']=function(_0x39bd3d,_0x250b00){if(!_0x39bd3d['user']){return _0x250b00[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x60')});}var _0xcd78c5={'payload':{'id':_0x39bd3d[_0xa55c('0x37')]['id'],'role':_0x39bd3d[_0xa55c('0x37')][_0xa55c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcd78c5)[_0xa55c('0x39')](function(_0x3c147b){_0x250b00[_0xa55c('0x61')]('motion.token',_0x3c147b);_0x250b00[_0xa55c('0x62')](_0xa55c('0x63'));})[_0xa55c('0x49')](function(_0x4f73b6){return _0x250b00[_0xa55c('0x3a')](0x1f4)[_0xa55c('0x64')](_0x4f73b6);});};exports['retrieveApiKey']=function(_0x21b760){if(_['isNil'](_0x21b760[_0xa55c('0x50')])||_[_0xa55c('0x65')](_0x21b760[_0xa55c('0x66')])){return null;}else{return createJwt(_0x21b760);}};exports[_0xa55c('0x67')]=function(_0x2ecf79){_0x2ecf79['apiKeyNonce']=generateNonce();_0x2ecf79[_0xa55c('0x66')]=generateIssuedAt();return createJwt(_0x2ecf79);};exports[_0xa55c('0x68')]=function(_0x4b85cc,_0x3929a6){var _0x2291e0=_0x4b85cc[_0xa55c('0x4a')][_0xa55c('0x4b')];if(_0x2291e0){var _0x50176b={'nonce':_0x3929a6['apiKeyNonce'],'iat':_0x3929a6[_0xa55c('0x66')],'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};return verifyJwt(_0x2291e0,_0x50176b)[_0xa55c('0x39')](function(){return generateApiKey(_0x3929a6);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa55c('0x69')]=function(_0x5ce463){var _0x2742e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2742e4[_0xa55c('0x6a')](_0x5ce463))throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0xa55c('0x6d'));return;};exports['validatePasswordHistory']=function(_0x1cb73b,_0x54f776,_0x23f67f){var _0x157afe=encryptor[_0xa55c('0x6e')](_0x54f776)[_0xa55c('0x6f')](',');for(var _0x19aaf5=0x0;_0x19aaf5<_0x23f67f;_0x19aaf5++){if(!_0x157afe[_0x19aaf5])break;if(_0x1cb73b[_0xa55c('0x70')]()===_0x157afe[_0x19aaf5][_0xa55c('0x70')]()){var _0x53e2be=util[_0xa55c('0x71')](_0xa55c('0x72'),_0x23f67f);if(_0x23f67f===0x1){_0x53e2be=_0xa55c('0x73');}throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0x53e2be);}}return;};exports['updatePasswordsHistory']=function(_0xa72718,_0x3cd40d){var _0x28bac4=_0x3cd40d?encryptor[_0xa55c('0x6e')](_0x3cd40d)[_0xa55c('0x6f')](','):[];if(_0x28bac4['length']===0x5){_0x28bac4[_0xa55c('0x74')](-0x1,0x1);}_0x28bac4[_0xa55c('0x75')](_0xa72718);return encryptor[_0xa55c('0x76')](_0x28bac4[_0xa55c('0x77')](','));};function signJwt(_0x3ba56d){var _0x480dfc=BPromise[_0xa55c('0x78')](jwt['sign'],{'context':jwt});var _0x2e482a=_0x3ba56d['secret']||config[_0xa55c('0xa')]['session'];return new BPromise(function(_0x34edc5,_0x1333da){_0x480dfc(_0x3ba56d[_0xa55c('0x79')],_0x2e482a,_0x3ba56d[_0xa55c('0x7a')])[_0xa55c('0x39')](function(_0x3a5a52){_0x34edc5(_0x3a5a52);})[_0xa55c('0x49')](function(_0x2f2226){_0x1333da(_0x2f2226);});});}function verifyJwt(_0x14b515,_0x1acf50,_0x51c736){var _0x150a07=BPromise[_0xa55c('0x78')](jwt['verify'],{'context':jwt});var _0x18b928=_0x51c736||config[_0xa55c('0xa')][_0xa55c('0x7b')];return new BPromise(function(_0x9fe234,_0x1b8b06){_0x150a07(_0x14b515,_0x18b928,_0x1acf50)[_0xa55c('0x39')](function(_0x3cef1f){_0x9fe234(_0x3cef1f);})[_0xa55c('0x49')](function(_0x47de0a){_0x1b8b06(_0x47de0a);});});}function generateNonce(){return crypto[_0xa55c('0x7c')](0x10)[_0xa55c('0x7d')](_0xa55c('0x7e'));}function generateIssuedAt(){return Math[_0xa55c('0x7f')](Date[_0xa55c('0x80')]()/0x3e8)[_0xa55c('0x7d')]();}function createJwt(_0x2f1237){var _0x4249c1={'payload':{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237['apiKeyNonce']},'options':{'algorithm':_0xa55c('0x81'),'subject':_0x2f1237['id'][_0xa55c('0x7d')](),'issuer':hardwareConf[_0xa55c('0x4c')](),'audience':hardwareConf[_0xa55c('0x4c')]()}};return signJwt(_0x4249c1)[_0xa55c('0x39')](function(_0x10e711){return{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237[_0xa55c('0x50')],'token':_0x10e711};});} \ No newline at end of file +var _0x008c=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','sign','session','payload','options','promisify','verify','randomBytes','hex','floor','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','name','userpic','permissions','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','smsAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','unmanaged','json','headers','startsWith','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','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~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x008c,0x188));var _0xc008=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x008c[_0x13ff53];return _0x290228;};'use strict';var db=require(_0xc008('0x0'))['db'];var config=require(_0xc008('0x1'));var hardwareConf=require(_0xc008('0x2'));var licenseUtil=require(_0xc008('0x3'));var encryptor=require(_0xc008('0x4'));var _=require('lodash');var jwt=require(_0xc008('0x5'));var expressJwt=require(_0xc008('0x6'));var compose=require(_0xc008('0x7'));var basicAuth=require(_0xc008('0x8'));var crypto=require(_0xc008('0x9'));var BPromise=require(_0xc008('0xa'));var util=require(_0xc008('0xb'));var moment=require(_0xc008('0xc'));var validateJwt=expressJwt({'secret':config[_0xc008('0xd')]['session']});var userAttributes=['id',_0xc008('0xe'),'fullname',_0xc008('0xf'),'internal','email',_0xc008('0x10'),_0xc008('0x11'),'md5secret','voicePause','chatPause',_0xc008('0x12'),_0xc008('0x13'),'smsPause',_0xc008('0x14'),_0xc008('0x15'),_0xc008('0x16'),_0xc008('0x17'),_0xc008('0x18'),_0xc008('0x19'),_0xc008('0x1a'),'passwordResetAt','alias',_0xc008('0x1b'),'phoneBarAutoAnswerDelay',_0xc008('0x1c'),_0xc008('0x1d'),_0xc008('0x1e'),_0xc008('0x1f'),_0xc008('0x20'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0xc008('0x21'),_0xc008('0x22'),_0xc008('0x23'),_0xc008('0x24'),'settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0xc008('0x25'),_0xc008('0x26'),'selectRecallMeCampaign',_0xc008('0x27'),'chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer',_0xc008('0x28'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0xc008('0x29')];exports[_0xc008('0x2a')]=function(){return this[_0xc008('0x2b')](!![])[_0xc008('0x2c')](function(_0x11cc75,_0x110128,_0x4f43e2){if(_0x11cc75[_0xc008('0x2d')]){_0x4f43e2();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x11cc75[_0xc008('0x2e')]['id']},'attributes':['id',_0xc008('0x2f'),_0xc008('0x30')],'raw':!![]})[_0xc008('0x31')](function(_0x5410f5){if(_0x5410f5&&_0x5410f5['closed']){return _0x110128['status'](_0x5410f5[_0xc008('0x30')]===_0xc008('0x32')?0x195:0x193)[_0xc008('0x33')]({'message':_0x5410f5[_0xc008('0x30')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x4f43e2();}})['catch'](function(_0x4caaf4){_0x4f43e2(_0x4caaf4);});}});};exports[_0xc008('0x2b')]=function isAuthenticated(_0x29ba43){return compose()[_0xc008('0x2c')](function(_0x529961,_0x24c14c,_0x32390d){var _0x209591;if(_0x529961[_0xc008('0x34')]['authorization']){if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],'Basic')){var _0x539766=basicAuth(_0x529961);db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'name':_0x539766[_0xc008('0xf')]}})[_0xc008('0x31')](function(_0x1de04b){if(!_0x1de04b||!_0x1de04b[_0xc008('0x38')](_0x539766[_0xc008('0x39')])){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x3b')});}_0x529961[_0xc008('0x2d')]={'id':_0x1de04b['id']};_0x32390d();})[_0xc008('0x3c')](function(_0x596ee8){_0x32390d(_0x596ee8);});}else if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],_0xc008('0x3d'))){validateJwt(_0x529961,_0x24c14c,_0x32390d);}else{if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}}}else if(_0x529961[_0xc008('0x3f')][_0xc008('0x40')]){try{var _0x7cfbc5={'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};verifyJwt(_0x529961['query'][_0xc008('0x40')],_0x7cfbc5)[_0xc008('0x31')](function(_0x459df4){return db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x459df4[_0xc008('0x42')]}})[_0xc008('0x31')](function(_0x5d0e06){_0x209591=_0x5d0e06;return db[_0xc008('0x43')][_0xc008('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc008('0x45')],'raw':!![]});})[_0xc008('0x31')](function(_0x5e38d5){if(!_0x209591||!_[_0xc008('0x46')](_0x209591[_0xc008('0x47')],_0x459df4[_0xc008('0x48')])){return _0x24c14c['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x209591[_0xc008('0x49')]){return _0x24c14c['status'](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}if(_0x209591[_0xc008('0x4b')]){if(_0x5e38d5[_0xc008('0x45')]>0x0){if(moment(_0x209591[_0xc008('0x4c')])[_0xc008('0x4d')](_0x5e38d5[_0xc008('0x45')],_0xc008('0x4e'))>moment()){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}else{return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}_0x529961['user']={'id':_0x209591['id']};_0x32390d();});})[_0xc008('0x3c')](function(){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});});}catch(_0x49a16d){_0x32390d(_0x49a16d);}}else if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}})[_0xc008('0x2c')](function(_0x2d142d,_0x5706bb,_0x398cdd){if(_0x2d142d[_0xc008('0x2d')]){db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x2d142d[_0xc008('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0xf4cc4b){if(!_0xf4cc4b){return _0x5706bb[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x4f')});}_0x2d142d['user']=_0xf4cc4b;_0x398cdd();})[_0xc008('0x3c')](function(_0xe37446){_0x398cdd(_0xe37446);});}else if(_0x29ba43){_0x398cdd();}else{return _0x5706bb[_0xc008('0x3a')](0x194)['json']({'message':_0xc008('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xc008('0x2c')](function(_0x5d3a72,_0x46fa8f,_0x213014){return licenseUtil['getLicense']()[_0xc008('0x31')](function(_0x24ba0f){if(_0x24ba0f[_0xc008('0x51')]){_0x213014();}else{return _0x46fa8f['status'](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x44fc5d){_0x213014(_0x44fc5d);});});};exports[_0xc008('0x53')]=function isWebrtcLicence(){return compose()[_0xc008('0x2c')](function(_0x59ca2b,_0x47cafa,_0x5283a8){return licenseUtil[_0xc008('0x54')]()[_0xc008('0x31')](function(_0x103a83){if(_0x103a83[_0xc008('0x55')]){_0x5283a8();}else{return _0x47cafa[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x572593){_0x5283a8(_0x572593);});});};exports['isMiddleware']=function(_0x516e43,_0x2d5a49,_0x2651cf){_0x516e43[_0xc008('0x56')]=!![];return _0x2651cf();};exports['signToken']=function signToken(_0x28bc33){return signJwt(_0x28bc33);};exports[_0xc008('0x57')]=function(_0x17ab1a,_0x1c2c50){if(!_0x17ab1a[_0xc008('0x2d')]){return _0x1c2c50[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x58')});}var _0x3fd7d9={'payload':{'id':_0x17ab1a[_0xc008('0x2d')]['id'],'role':_0x17ab1a['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3fd7d9)[_0xc008('0x31')](function(_0x51cb14){_0x1c2c50[_0xc008('0x59')](_0xc008('0x5a'),_0x51cb14);_0x1c2c50[_0xc008('0x5b')]('/dashboards/general');})[_0xc008('0x3c')](function(_0x32b435){return _0x1c2c50[_0xc008('0x3a')](0x1f4)[_0xc008('0x5c')](_0x32b435);});};exports[_0xc008('0x5d')]=function(_0x51105f){if(_[_0xc008('0x5e')](_0x51105f[_0xc008('0x47')])||_['isNil'](_0x51105f[_0xc008('0x5f')])){return null;}else{return createJwt(_0x51105f);}};exports[_0xc008('0x60')]=function(_0x5b5fbf){_0x5b5fbf['apiKeyNonce']=generateNonce();_0x5b5fbf[_0xc008('0x5f')]=generateIssuedAt();return createJwt(_0x5b5fbf);};exports[_0xc008('0x61')]=function(_0x20947b,_0x30d0aa){var _0x14b6a0=_0x20947b['query']['apikey'];if(_0x14b6a0){var _0x34b72a={'nonce':_0x30d0aa['apiKeyNonce'],'iat':_0x30d0aa[_0xc008('0x5f')],'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};return verifyJwt(_0x14b6a0,_0x34b72a)[_0xc008('0x31')](function(){return generateApiKey(_0x30d0aa);});}else{throw{'message':_0xc008('0x62')};}};exports[_0xc008('0x63')]=function(_0x49d8b0){var _0x2ea742=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2ea742[_0xc008('0x64')](_0x49d8b0))throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0xc008('0x67'));return;};exports['validatePasswordHistory']=function(_0x41fae3,_0x4fdab4,_0x535e6e){var _0x5dbfca=encryptor[_0xc008('0x68')](_0x4fdab4)[_0xc008('0x69')](',');for(var _0x5dfb69=0x0;_0x5dfb69<_0x535e6e;_0x5dfb69++){if(!_0x5dbfca[_0x5dfb69])break;if(_0x41fae3['toLowerCase']()===_0x5dbfca[_0x5dfb69][_0xc008('0x6a')]()){var _0x2d8361=util[_0xc008('0x6b')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x535e6e);if(_0x535e6e===0x1){_0x2d8361=_0xc008('0x6c');}throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0x2d8361);}}return;};exports[_0xc008('0x6d')]=function(_0x5baff1,_0x4022dd){var _0x4eaa6d=_0x4022dd?encryptor[_0xc008('0x68')](_0x4022dd)[_0xc008('0x69')](','):[];if(_0x4eaa6d[_0xc008('0x6e')]===0x5){_0x4eaa6d[_0xc008('0x6f')](-0x1,0x1);}_0x4eaa6d[_0xc008('0x70')](_0x5baff1);return encryptor[_0xc008('0x71')](_0x4eaa6d['join'](','));};function signJwt(_0x375e71){var _0x570001=BPromise['promisify'](jwt[_0xc008('0x72')],{'context':jwt});var _0x30aa1e=_0x375e71['secret']||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x3e373e,_0x4517c0){_0x570001(_0x375e71[_0xc008('0x74')],_0x30aa1e,_0x375e71[_0xc008('0x75')])[_0xc008('0x31')](function(_0x57ce9a){_0x3e373e(_0x57ce9a);})[_0xc008('0x3c')](function(_0x462e1e){_0x4517c0(_0x462e1e);});});}function verifyJwt(_0x3bfb15,_0x2a60e6,_0xb3ca0f){var _0x167425=BPromise[_0xc008('0x76')](jwt[_0xc008('0x77')],{'context':jwt});var _0xbc430a=_0xb3ca0f||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x2b5eb6,_0x131b81){_0x167425(_0x3bfb15,_0xbc430a,_0x2a60e6)[_0xc008('0x31')](function(_0x4e0251){_0x2b5eb6(_0x4e0251);})[_0xc008('0x3c')](function(_0x2e5467){_0x131b81(_0x2e5467);});});}function generateNonce(){return crypto[_0xc008('0x78')](0x10)['toString'](_0xc008('0x79'));}function generateIssuedAt(){return Math[_0xc008('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x1a03fd){var _0x2a4c2b={'payload':{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd[_0xc008('0x47')]},'options':{'algorithm':_0xc008('0x7b'),'subject':_0x1a03fd['id'][_0xc008('0x7c')](),'issuer':hardwareConf[_0xc008('0x41')](),'audience':hardwareConf[_0xc008('0x41')]()}};return signJwt(_0x2a4c2b)[_0xc008('0x31')](function(_0x1b059b){return{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd['apiKeyNonce'],'token':_0x1b059b};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index ad32edc..b11e4fa 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['tags','skip','tag','count','getFilteredContacts','catch','CmContact','keys','cf_','map','findOne','all','length','type','lodash','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause'];(function(_0xf23b1d,_0x2bcf6c){var _0x38c6d7=function(_0x798320){while(--_0x798320){_0xf23b1d['push'](_0xf23b1d['shift']());}};_0x38c6d7(++_0x2bcf6c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32358b,_0x5c7c35){_0x32358b=_0x32358b-0x0;var _0x58c21d=_0x0b0e[_0x32358b];return _0x58c21d;};'use strict';var _=require(_0xe0b0('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xe0b0('0x1'))['db'];exports['findAll']=function(_0x7e5a8a,_0xdf715e,_0x3b5e2b,_0x25153a){var _0x28040c={'count':0x0,'rows':[]};var _0x38a058=sqlUtils[_0xe0b0('0x2')](_0xdf715e,_0x7e5a8a);if(_0x38a058){return Promise[_0xe0b0('0x3')](_0x28040c);}var _0x30e20d=sqlUtils[_0xe0b0('0x4')]();var _0x219b1c={};var _0x5cf9cc=![];var _0x50be7f=![];return Promise[_0xe0b0('0x3')]()[_0xe0b0('0x5')](function(){if(_0x7e5a8a[_0xe0b0('0x6')]){return sqlUtils[_0xe0b0('0x7')](_0x7e5a8a['search'],_0x25153a);}else{return sqlUtils[_0xe0b0('0x8')](_0x7e5a8a,_0x25153a);}})[_0xe0b0('0x5')](function(_0x553d4f){_0x30e20d[_0xe0b0('0x9')](_0x553d4f[_0xe0b0('0xa')]);_0x30e20d['where'](_0x553d4f[_0xe0b0('0xb')]);_0x30e20d[_0xe0b0('0x9')](_0x553d4f[_0xe0b0('0xc')]);_0x30e20d['where'](_0x553d4f[_0xe0b0('0xd')][_0xe0b0('0xe')]);_0x219b1c=_0x553d4f[_0xe0b0('0xf')];_0x50be7f=_0x553d4f[_0xe0b0('0xd')][_0xe0b0('0x10')];return sqlUtils['checkListsRestrictions'](_0xdf715e,_0x7e5a8a,_0x50be7f);})[_0xe0b0('0x5')](function(_0x154de6){_0x30e20d[_0xe0b0('0x9')](_0x154de6);var _0x24babd=_0x7e5a8a[_0xe0b0('0x6')]?_0x219b1c['ids']:_0x7e5a8a[_0xe0b0('0x11')];_0x5cf9cc=_0x24babd?!![]:![];return sqlUtils['countFilteredContacts'](_0x30e20d,_0x24babd);})[_0xe0b0('0x5')](function(_0xadee6e){_0x28040c['count']=_0xadee6e;if(_0x28040c[_0xe0b0('0x12')]===0x0){return;}return sqlUtils['buildContactsQuery'](_0x30e20d,_0x7e5a8a[_0xe0b0('0xb')],_0x3b5e2b,_0x5cf9cc,_0x219b1c[_0xe0b0('0xe')],_0x50be7f);})['then'](function(_0x54a3eb){if(!_0x54a3eb){return[];}return sqlUtils[_0xe0b0('0x13')](_0x54a3eb,_0x7e5a8a,_0x3b5e2b);})['then'](function(_0x4df8da){_0x28040c['rows']=_0x4df8da;return _0x28040c;})[_0xe0b0('0x14')](function(_0x50fa4a){throw _0x50fa4a;});};exports['describe']=function(){var _0x10cde1={};var _0x59dff5=[];return db[_0xe0b0('0x15')]['describe']()[_0xe0b0('0x5')](function(_0x1cd7c4){_0x10cde1=_0x1cd7c4;var _0x3e10b3=Object[_0xe0b0('0x16')](_0x10cde1)[_0xe0b0('0xc')](function(_0x58b804){return _['startsWith'](_0x58b804,_0xe0b0('0x17'))?_0x58b804:undefined;});var _0x5512bb=_0x3e10b3[_0xe0b0('0x18')](function(_0x31b5f8){return db['CmCustomField'][_0xe0b0('0x19')]({'where':{'id':_0x31b5f8['slice'](0x3)},'raw':!![]});});return Promise[_0xe0b0('0x1a')](_0x5512bb);})['then'](function(_0x28586d){for(var _0x576352=0x0;_0x576352<_0x28586d[_0xe0b0('0x1b')];_0x576352++){if(_0x28586d[_0x576352]){var _0x4de537=_0xe0b0('0x17')+_0x28586d[_0x576352]['id'];_0x10cde1[_0x4de537]['fieldType']=_0x28586d[_0x576352][_0xe0b0('0x1c')];}}_0x59dff5=_['map'](Object[_0xe0b0('0x16')](_0x10cde1),function(_0x3c3bc2){return{'name':_0x3c3bc2,'type':_0x10cde1[_0x3c3bc2][_0xe0b0('0x1c')]};});return _0x59dff5;})[_0xe0b0('0x14')](function(_0x3ec2){throw _0x3ec2;});}; \ No newline at end of file +var _0x757a=['findOne','slice','fieldType','keys','type','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','tags','checkListsRestrictions','ids','tag','countFilteredContacts','count','clause','rows','catch','describe','startsWith','cf_','map','CmCustomField'];(function(_0x1972f4,_0x1231ff){var _0x42159b=function(_0x1f9d6f){while(--_0x1f9d6f){_0x1972f4['push'](_0x1972f4['shift']());}};_0x42159b(++_0x1231ff);}(_0x757a,0xde));var _0xa757=function(_0x11b5d0,_0x560684){_0x11b5d0=_0x11b5d0-0x0;var _0x10644d=_0x757a[_0x11b5d0];return _0x10644d;};'use strict';var _=require('lodash');var sqlUtils=require(_0xa757('0x0'));var db=require(_0xa757('0x1'))['db'];exports['findAll']=function(_0x5c03c3,_0x5709ed,_0x32be3b,_0x1721c6){var _0x1c2932={'count':0x0,'rows':[]};var _0x453d07=sqlUtils[_0xa757('0x2')](_0x5709ed,_0x5c03c3);if(_0x453d07){return Promise[_0xa757('0x3')](_0x1c2932);}var _0x5edca8=sqlUtils[_0xa757('0x4')]();var _0x4343b6={};var _0x53be0e=![];var _0x2930fa=![];return Promise[_0xa757('0x3')]()[_0xa757('0x5')](function(){if(_0x5c03c3[_0xa757('0x6')]){return sqlUtils[_0xa757('0x7')](_0x5c03c3['search'],_0x1721c6);}else{return sqlUtils[_0xa757('0x8')](_0x5c03c3,_0x1721c6);}})[_0xa757('0x5')](function(_0x32f0ec){_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xa')]);_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xb')]);_0x5edca8['where'](_0x32f0ec['filter']);_0x5edca8['where'](_0x32f0ec['user']['clause']);_0x4343b6=_0x32f0ec[_0xa757('0xc')];_0x2930fa=_0x32f0ec['user']['skip'];return sqlUtils[_0xa757('0xd')](_0x5709ed,_0x5c03c3,_0x2930fa);})['then'](function(_0x481508){_0x5edca8[_0xa757('0x9')](_0x481508);var _0x1b670e=_0x5c03c3[_0xa757('0x6')]?_0x4343b6[_0xa757('0xe')]:_0x5c03c3[_0xa757('0xf')];_0x53be0e=_0x1b670e?!![]:![];return sqlUtils[_0xa757('0x10')](_0x5edca8,_0x1b670e);})[_0xa757('0x5')](function(_0x2f7947){_0x1c2932[_0xa757('0x11')]=_0x2f7947;if(_0x1c2932[_0xa757('0x11')]===0x0){return;}return sqlUtils['buildContactsQuery'](_0x5edca8,_0x5c03c3[_0xa757('0xb')],_0x32be3b,_0x53be0e,_0x4343b6[_0xa757('0x12')],_0x2930fa);})[_0xa757('0x5')](function(_0x4d9f58){if(!_0x4d9f58){return[];}return sqlUtils['getFilteredContacts'](_0x4d9f58,_0x5c03c3,_0x32be3b);})[_0xa757('0x5')](function(_0x468d45){_0x1c2932[_0xa757('0x13')]=_0x468d45;return _0x1c2932;})[_0xa757('0x14')](function(_0x27f4ba){throw _0x27f4ba;});};exports[_0xa757('0x15')]=function(){var _0x4bd137={};var _0x58954=[];return db['CmContact'][_0xa757('0x15')]()[_0xa757('0x5')](function(_0x14014c){_0x4bd137=_0x14014c;var _0x2c9ec6=Object['keys'](_0x4bd137)['filter'](function(_0x40ec48){return _[_0xa757('0x16')](_0x40ec48,_0xa757('0x17'))?_0x40ec48:undefined;});var _0x8d121f=_0x2c9ec6[_0xa757('0x18')](function(_0x40562f){return db[_0xa757('0x19')][_0xa757('0x1a')]({'where':{'id':_0x40562f[_0xa757('0x1b')](0x3)},'raw':!![]});});return Promise['all'](_0x8d121f);})[_0xa757('0x5')](function(_0x59e9d4){for(var _0x422e9e=0x0;_0x422e9e<_0x59e9d4['length'];_0x422e9e++){if(_0x59e9d4[_0x422e9e]){var _0x40551d=_0xa757('0x17')+_0x59e9d4[_0x422e9e]['id'];_0x4bd137[_0x40551d][_0xa757('0x1c')]=_0x59e9d4[_0x422e9e]['type'];}}_0x58954=_[_0xa757('0x18')](Object[_0xa757('0x1d')](_0x4bd137),function(_0x471e84){return{'name':_0x471e84,'type':_0x4bd137[_0x471e84][_0xa757('0x1e')]};});return _0x58954;})['catch'](function(_0x449a7d){throw _0x449a7d;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 008bb4b..9cb3196 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde18=['search','getLists','c.id','limit','offset','group','order','DESC','subqry.','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','query','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','lastName','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','default','value','start','end','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','some','name','length','c.ListId\x20IN\x20?','concat','Contact','resolve','fields','tag','then','filter'];(function(_0x3741cb,_0x243aed){var _0x235ba2=function(_0x474be8){while(--_0x474be8){_0x3741cb['push'](_0x3741cb['shift']());}};_0x235ba2(++_0x243aed);}(_0xde18,0x1c9));var _0x8de1=function(_0x4cedd2,_0x243494){_0x4cedd2=_0x4cedd2-0x0;var _0x328ace=_0xde18[_0x4cedd2];return _0x328ace;};'use strict';var _=require(_0x8de1('0x0'));var squel=require(_0x8de1('0x1'));var as=require(_0x8de1('0x2'));var qs=require(_0x8de1('0x3'));var utils=require(_0x8de1('0x4'));var db=require(_0x8de1('0x5'))['db'];function skipContactsQuery(_0x5707ef,_0x4cc9a8){var _0x44b4bb=![];if(_0x5707ef[_0x8de1('0x6')]===_0x8de1('0x7')&&!_0x4cc9a8['search']&&!_0x4cc9a8[_0x8de1('0x8')]&&_0x4cc9a8[_0x8de1('0x9')]!==_0x8de1('0xa')){_0x44b4bb=!![];}return _0x44b4bb;}function getContactsSubquery(){return squel[_0x8de1('0xb')]()[_0x8de1('0xc')](_0x8de1('0xd'),'c')[_0x8de1('0xe')](_0x8de1('0xf'));}function applyJoinClauses(_0x493f05,_0x36fba9){var _0x1a9e58=_0x36fba9?'c':_0x8de1('0x10');_0x493f05[_0x8de1('0x11')](_0x8de1('0x12'),'uc',_0x8de1('0x13')+_0x1a9e58+_0x8de1('0x14'))[_0x8de1('0x11')](_0x8de1('0x15'),'ct',_0x8de1('0x16')+_0x1a9e58+_0x8de1('0x14'))[_0x8de1('0x11')]('tools_tags','t',_0x8de1('0x17'));return _0x493f05;}function addFieldsToQuery(_0x1f42df,_0x48c6d5,_0x578834,_0x4a4166,_0xc2a6d5){var _0x4d2ca8=_0xc2a6d5?'c':_0x8de1('0x10');if(!_0x48c6d5){_0x48c6d5=['id','firstName',_0x8de1('0x18'),'phone',_0x8de1('0x19'),_0x8de1('0x1a'),_0x8de1('0x1b'),'ListId',_0x8de1('0x1c'),_0x8de1('0x1d'),_0x8de1('0x1e'),_0x8de1('0x1f'),_0x8de1('0x20')];}else if(!_0x48c6d5['includes']('id')){_0x48c6d5[_0x8de1('0x21')]('id');}var _0x514268=_0x578834&&_0xc2a6d5||!_0x578834&&!_0xc2a6d5;if(_0x4a4166){_0x514268=_0x4a4166&&_0xc2a6d5||!_0x4a4166&&!_0xc2a6d5;}_0x48c6d5[_0x8de1('0x22')](function(_0x4fe945){if(_0x4fe945===_0x8de1('0x20')){if(_0x514268){_0x1f42df['field'](_0x8de1('0x23'),_0x4fe945);}else if(_0x578834||_0x4a4166){_0x1f42df[_0x8de1('0x24')](_0x4d2ca8+'.'+_0x4fe945);}}else{_0x1f42df['field'](_0x4d2ca8+'.'+_0x4fe945);}});return _0x1f42df;}function getSqlClauses(){var _0x47c18d={'default':squel[_0x8de1('0x25')](),'fields':squel[_0x8de1('0x25')](),'filter':squel[_0x8de1('0x25')](),'tags':{'clause':squel[_0x8de1('0x25')](),'ids':null},'user':{'clause':squel[_0x8de1('0x25')](),'skip':![]}};return _0x47c18d;}function parseTagParameter(_0x26039d){var _0x3bca96=squel['expr']();if(_0x26039d){var _0x3ebc64=utils['getSelectedTags'](_0x26039d);_0x3ebc64[_0x8de1('0x22')](function(_0x5dfb7f){_0x3bca96['or'](_0x8de1('0x26'),'%,'+_0x5dfb7f+',%');});}return _0x3bca96;}function parseSearchFilter(_0x3f2361){var _0x4a50e9=squel[_0x8de1('0x25')]();if(_0x3f2361){var _0x39deab=_0x3f2361[_0x8de1('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x39deab[_0x8de1('0x28')]('\x20')['length']>0x1){_0x4a50e9['or'](_0x8de1('0x29'),qs['getFullTextValue'](_0x39deab),null);}else{if(qs[_0x8de1('0x2a')](_0x39deab)){_0x4a50e9['or'](_0x8de1('0x2b'),_0x39deab+'%');_0x4a50e9['or']('c.phone\x20LIKE\x20?',_0x39deab+'%');_0x4a50e9['or'](_0x8de1('0x2c'),_0x39deab+'%');_0x4a50e9['or'](_0x8de1('0x2d'),_0x39deab+'%');}else if(qs[_0x8de1('0x2e')](_0x39deab)){_0x4a50e9['or'](_0x8de1('0x2f'),_0x39deab+'%');}else{_0x4a50e9['or'](_0x8de1('0x30'),'%'+_0x39deab+'%');_0x4a50e9['or']('c.lastName\x20LIKE\x20?','%'+_0x39deab+'%');_0x4a50e9['or'](_0x8de1('0x2f'),'%'+_0x39deab+'%');}}}return _0x4a50e9;}function parseAdvancedSearchFilter(_0x51e7ac,_0x22d295){var _0x34595e=getSqlClauses();var _0x4a3da6=as[_0x8de1('0x31')](_0x51e7ac);var _0x5142ee=_0x4a3da6[_0x8de1('0x32')];for(var _0x4d40e9=0x0;_0x4d40e9<_0x4a3da6[_0x8de1('0x33')]['length'];_0x4d40e9++){var _0x15a612=_0x4a3da6['conditions'][_0x4d40e9];var _0x144f8a='c';var _0x3cc74a=_['find'](_0x22d295,['name',_0x15a612[_0x8de1('0x24')]]);if(_0x3cc74a){if(_0x15a612[_0x8de1('0x24')]===_0x8de1('0x34')||_0x3cc74a[_0x8de1('0x35')]===_0x8de1('0x36')){_0x15a612[_0x8de1('0x37')]=_0x8de1('0x38');}var _0x159b1d=as[_0x8de1('0x39')](_0x144f8a,_0x3cc74a['type'],_0x15a612);_0x34595e[_0x8de1('0x3a')][_0x5142ee](_0x159b1d['text'],_0x159b1d[_0x8de1('0x3b')][_0x8de1('0x3c')],_0x159b1d[_0x8de1('0x3b')][_0x8de1('0x3d')]);}else{if(_0x15a612['field']===_0x8de1('0x3e')){var _0x18fdb3=_0x15a612[_0x8de1('0x3b')][_0x8de1('0x28')](',')[_0x8de1('0x3f')](function(_0x2aad39){return Number(_0x2aad39);});var _0x4524c4=parseTagParameter(_0x18fdb3);_0x34595e[_0x8de1('0x40')][_0x8de1('0x41')][_0x8de1('0x42')](_0x4524c4);_0x34595e[_0x8de1('0x40')][_0x8de1('0x43')]=_0x18fdb3;}else if(_0x15a612[_0x8de1('0x24')]===_0x8de1('0x44')){_0x34595e[_0x8de1('0x45')]['clause'][_0x8de1('0x42')](_0x8de1('0x46'),_0x15a612['value']);_0x34595e['user'][_0x8de1('0x47')]=!![];}}}return _0x34595e;}function parseModelFields(_0x51dd46,_0x5d0983){var _0x223672=squel[_0x8de1('0x25')]();var _0x331ce4=_(_0x51dd46)['keys']()[_0x8de1('0x3f')](function(_0x21db6e){return _[_0x8de1('0x48')](_0x5d0983,[_0x8de1('0x49'),_0x21db6e])?_0x21db6e:undefined;})['compact']()[_0x8de1('0x3b')]();if(_0x51dd46['Contact']){_0x331ce4[_0x8de1('0x21')]('Contact');}if(_0x331ce4[_0x8de1('0x4a')]>0x0){_0x331ce4[_0x8de1('0x22')](function(_0x4f447b){if(_0x4f447b==='ListId'){_0x223672[_0x8de1('0x42')](_0x8de1('0x4b'),[][_0x8de1('0x4c')](_0x51dd46[_0x4f447b]));}else if(_0x4f447b===_0x8de1('0x4d')){var _0x1366ea='%'+_0x51dd46[_0x4f447b]+'%';_0x223672['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x1366ea);}else{_0x223672[_0x8de1('0x42')]('c.'+_0x4f447b+'\x20=\x20?',_0x51dd46[_0x4f447b]);}});}return _0x223672;}function parseQueryParameters(_0x122bc7,_0x56e104){var _0x57efb9=getSqlClauses();return Promise[_0x8de1('0x4e')]()['then'](function(){return parseModelFields(_0x122bc7,_0x56e104);})['then'](function(_0x3732de){_0x57efb9[_0x8de1('0x4f')][_0x8de1('0x42')](_0x3732de);return parseTagParameter(_0x122bc7[_0x8de1('0x50')]);})[_0x8de1('0x51')](function(_0x35af68){_0x57efb9['tags'][_0x8de1('0x41')]['and'](_0x35af68);return parseSearchFilter(_0x122bc7[_0x8de1('0x52')]);})[_0x8de1('0x51')](function(_0x941991){_0x57efb9['filter']=_0x941991;return _0x57efb9;});}function checkListsRestrictions(_0x433106,_0x4a6df7,_0xea5db3){var _0x464283=squel[_0x8de1('0x25')]();return Promise[_0x8de1('0x4e')]()['then'](function(){if(_0x4a6df7[_0x8de1('0x53')]&&_0x433106[_0x8de1('0x6')]===_0x8de1('0x7')&&!_0xea5db3){return _0x433106[_0x8de1('0x54')]({'attributes':['id'],'raw':!![]});}})[_0x8de1('0x51')](function(_0x39cbdc){if(_0x39cbdc){if(_0x39cbdc[_0x8de1('0x4a')]===0x0){_0x464283[_0x8de1('0x42')]('c.ListId\x20IS\x20NULL');}else{_0x464283[_0x8de1('0x42')](_0x8de1('0x4b'),_[_0x8de1('0x3f')](_0x39cbdc,'id'));}}})[_0x8de1('0x51')](function(){return _0x464283;});}function buildContactsQuery(_0x363897,_0x278b22,_0x493d9a,_0x1f9f1d,_0x5cbd3a,_0x525ad8){if(_0x278b22){_0x278b22=_0x493d9a['attributes'];}_0x363897=addFieldsToQuery(_0x363897,_0x278b22,_0x1f9f1d,_0x525ad8,!![]);var _0x2ccde4=squel['select']();_0x2ccde4=addFieldsToQuery(_0x2ccde4,_0x278b22,_0x1f9f1d,_0x525ad8,![]);if(_0x1f9f1d||_0x525ad8){_0x363897=applyJoinClauses(_0x363897,!![]);_0x363897['group'](_0x8de1('0x55'));if(_0x493d9a[_0x8de1('0x56')]){_0x2ccde4[_0x8de1('0x56')](_0x493d9a[_0x8de1('0x56')]);}if(_0x493d9a['offset']){_0x2ccde4[_0x8de1('0x57')](_0x493d9a['offset']);}}else{_0x2ccde4=applyJoinClauses(_0x2ccde4,![]);_0x2ccde4[_0x8de1('0x58')]('subqry.id');if(_0x493d9a[_0x8de1('0x56')]){_0x363897[_0x8de1('0x56')](_0x493d9a[_0x8de1('0x56')]);}if(_0x493d9a[_0x8de1('0x57')]){_0x363897[_0x8de1('0x57')](_0x493d9a[_0x8de1('0x57')]);}}_0x2ccde4['having'](_0x5cbd3a);if(_0x493d9a[_0x8de1('0x59')]){_0x493d9a[_0x8de1('0x59')][_0x8de1('0x22')](function(_0x3d79fe){_0x363897['order']('c.'+_0x3d79fe[0x0],_0x3d79fe[0x1]===_0x8de1('0x5a')?![]:!![]);_0x2ccde4[_0x8de1('0x59')](_0x8de1('0x5b')+_0x3d79fe[0x0],_0x3d79fe[0x1]===_0x8de1('0x5a')?![]:!![]);});}_0x2ccde4[_0x8de1('0xc')](_0x363897,_0x8de1('0x10'));return _0x2ccde4;}function getFilteredContacts(_0x50ee92){var _0x186c3f=[];return db[_0x8de1('0x3e')]['findAll']({'attributes':['id',_0x8de1('0x49'),_0x8de1('0x5c')],'raw':!![]})[_0x8de1('0x51')](function(_0x489d1a){_0x186c3f=_[_0x8de1('0x5d')](_0x489d1a,'id');var _0x54aca2={'type':db['Sequelize'][_0x8de1('0x5e')][_0x8de1('0x5f')],'model':db[_0x8de1('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x8de1('0x61')]['query'](_0x50ee92[_0x8de1('0x62')](),_0x54aca2);})[_0x8de1('0x51')](function(_0x5340b3){_0x5340b3[_0x8de1('0x22')](function(_0xb0d6e4){if(_0xb0d6e4[_0x8de1('0x20')]){_0xb0d6e4[_0x8de1('0x63')]=[];_0xb0d6e4[_0x8de1('0x20')][_0x8de1('0x28')](',')[_0x8de1('0x22')](function(_0x136c49){_0xb0d6e4['Tags'][_0x8de1('0x21')](_0x186c3f[_0x136c49]);});}delete _0xb0d6e4[_0x8de1('0x20')];});return _0x5340b3;});}function countFilteredContacts(_0x3d0bcc,_0x57b1a){var _0x174a8f=_0x3d0bcc[_0x8de1('0x64')]();_0x174a8f[_0x8de1('0x24')](_0x8de1('0x65'));_0x174a8f=applyJoinClauses(_0x174a8f,!![]);_0x3d0bcc[_0x8de1('0x58')](_0x8de1('0x55'));var _0x17f61f=utils[_0x8de1('0x66')](_0x57b1a);if(!_[_0x8de1('0x67')](_0x17f61f)){_0x174a8f[_0x8de1('0xe')](_0x8de1('0x68'),_0x17f61f);}var _0x41d223={'type':db[_0x8de1('0x69')][_0x8de1('0x5e')][_0x8de1('0x5f')],'raw':!![]};return db[_0x8de1('0x61')][_0x8de1('0x6a')](_0x174a8f[_0x8de1('0x62')](),_0x41d223)[_0x8de1('0x51')](function(_0x3ba995){return _0x3ba995[0x0][_0x8de1('0x65')];});}module[_0x8de1('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xd86c=['CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','default','text','value','Tag','tags','clause','and','user','uc.UserId\x20=\x20?','keys','some','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','then','fields','filter','resolve','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','DESC','order','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','Tags','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','query','toString','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','search','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','ListId','CompanyId','createdAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags'];(function(_0x215f2e,_0x1ca853){var _0x53f1da=function(_0x29157e){while(--_0x29157e){_0x215f2e['push'](_0x215f2e['shift']());}};_0x53f1da(++_0x1ca853);}(_0xd86c,0x1ef));var _0xcd86=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0xd86c[_0x3aeb36];return _0xa2ef21;};'use strict';var _=require(_0xcd86('0x0'));var squel=require(_0xcd86('0x1'));var as=require(_0xcd86('0x2'));var qs=require('../parsers/qs');var utils=require(_0xcd86('0x3'));var db=require(_0xcd86('0x4'))['db'];function skipContactsQuery(_0x570595,_0x29c059){var _0x4a4b3e=![];if(_0x570595[_0xcd86('0x5')]==='agent'&&!_0x29c059[_0xcd86('0x6')]&&!_0x29c059['ListId']&&_0x29c059[_0xcd86('0x7')]!==_0xcd86('0x8')){_0x4a4b3e=!![];}return _0x4a4b3e;}function getContactsSubquery(){return squel[_0xcd86('0x9')]()[_0xcd86('0xa')](_0xcd86('0xb'),'c')[_0xcd86('0xc')](_0xcd86('0xd'));}function applyJoinClauses(_0x29ad91,_0x1c4e5f){var _0x5a3b83=_0x1c4e5f?'c':_0xcd86('0xe');_0x29ad91[_0xcd86('0xf')](_0xcd86('0x10'),'uc','uc.CmContactId\x20=\x20'+_0x5a3b83+_0xcd86('0x11'))[_0xcd86('0xf')](_0xcd86('0x12'),'ct','ct.CmContactId\x20=\x20'+_0x5a3b83+_0xcd86('0x11'))[_0xcd86('0xf')](_0xcd86('0x13'),'t',_0xcd86('0x14'));return _0x29ad91;}function addFieldsToQuery(_0x5232de,_0x51d16a,_0x3cd1bc,_0x14ac9e,_0x4ef3f3){var _0x1a89ce=_0x4ef3f3?'c':_0xcd86('0xe');if(!_0x51d16a){_0x51d16a=['id',_0xcd86('0x15'),'lastName',_0xcd86('0x16'),'mobile','fax','email',_0xcd86('0x17'),_0xcd86('0x18'),_0xcd86('0x19'),'updatedAt',_0xcd86('0x1a'),_0xcd86('0x1b')];}else if(!_0x51d16a[_0xcd86('0x1c')]('id')){_0x51d16a[_0xcd86('0x1d')]('id');}var _0x1b4f7e=_0x3cd1bc&&_0x4ef3f3||!_0x3cd1bc&&!_0x4ef3f3;if(_0x14ac9e){_0x1b4f7e=_0x14ac9e&&_0x4ef3f3||!_0x14ac9e&&!_0x4ef3f3;}_0x51d16a[_0xcd86('0x1e')](function(_0x1564ec){if(_0x1564ec===_0xcd86('0x1b')){if(_0x1b4f7e){_0x5232de['field'](_0xcd86('0x1f'),_0x1564ec);}else if(_0x3cd1bc||_0x14ac9e){_0x5232de[_0xcd86('0x20')](_0x1a89ce+'.'+_0x1564ec);}}else{_0x5232de[_0xcd86('0x20')](_0x1a89ce+'.'+_0x1564ec);}});return _0x5232de;}function getSqlClauses(){var _0x30aca5={'default':squel[_0xcd86('0x21')](),'fields':squel[_0xcd86('0x21')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xcd86('0x21')](),'ids':null},'user':{'clause':squel[_0xcd86('0x21')](),'skip':![]}};return _0x30aca5;}function parseTagParameter(_0x3451e5){var _0x291911=squel[_0xcd86('0x21')]();if(_0x3451e5){var _0x95c82c=utils[_0xcd86('0x22')](_0x3451e5);_0x95c82c[_0xcd86('0x1e')](function(_0x5230d8){_0x291911['or'](_0xcd86('0x23'),'%,'+_0x5230d8+',%');});}return _0x291911;}function parseSearchFilter(_0x3d010b){var _0x10acfb=squel[_0xcd86('0x21')]();if(_0x3d010b){var _0x5b7f22=_0x3d010b[_0xcd86('0x24')]('\x5c','\x5c\x5c')[_0xcd86('0x24')](/'/g,'\x27\x27');if(_0x5b7f22[_0xcd86('0x25')]('\x20')[_0xcd86('0x26')]>0x1){_0x10acfb['or'](_0xcd86('0x27'),qs[_0xcd86('0x28')](_0x5b7f22),null);}else{if(qs['isNumeric'](_0x5b7f22)){_0x10acfb['or'](_0xcd86('0x29'),_0x5b7f22+'%');_0x10acfb['or'](_0xcd86('0x2a'),_0x5b7f22+'%');_0x10acfb['or'](_0xcd86('0x2b'),_0x5b7f22+'%');_0x10acfb['or'](_0xcd86('0x2c'),_0x5b7f22+'%');}else if(qs[_0xcd86('0x2d')](_0x5b7f22)){_0x10acfb['or'](_0xcd86('0x2e'),_0x5b7f22+'%');}else{_0x10acfb['or'](_0xcd86('0x2f'),'%'+_0x5b7f22+'%');_0x10acfb['or'](_0xcd86('0x30'),'%'+_0x5b7f22+'%');_0x10acfb['or']('c.email\x20LIKE\x20?','%'+_0x5b7f22+'%');}}}return _0x10acfb;}function parseAdvancedSearchFilter(_0x5b0de2,_0x4bca44){var _0x5394bc=getSqlClauses();var _0x584c1f=as[_0xcd86('0x31')](_0x5b0de2);var _0x14acca=_0x584c1f['sqlOperator'];for(var _0x39e6fd=0x0;_0x39e6fd<_0x584c1f[_0xcd86('0x32')][_0xcd86('0x26')];_0x39e6fd++){var _0x3c9bd0=_0x584c1f['conditions'][_0x39e6fd];var _0x1e6638='c';var _0xb7a9ef=_[_0xcd86('0x33')](_0x4bca44,[_0xcd86('0x34'),_0x3c9bd0[_0xcd86('0x20')]]);if(_0xb7a9ef){if(_0x3c9bd0[_0xcd86('0x20')]===_0xcd86('0x35')||_0xb7a9ef[_0xcd86('0x36')]===_0xcd86('0x37')){_0x3c9bd0[_0xcd86('0x38')]=_0xcd86('0x39');}var _0x49b01b=as['buildExpression'](_0x1e6638,_0xb7a9ef[_0xcd86('0x3a')],_0x3c9bd0);_0x5394bc[_0xcd86('0x3b')][_0x14acca](_0x49b01b[_0xcd86('0x3c')],_0x49b01b['value']['start'],_0x49b01b[_0xcd86('0x3d')]['end']);}else{if(_0x3c9bd0[_0xcd86('0x20')]===_0xcd86('0x3e')){var _0x227de8=_0x3c9bd0[_0xcd86('0x3d')][_0xcd86('0x25')](',')['map'](function(_0x1dc21d){return Number(_0x1dc21d);});var _0x5708dd=parseTagParameter(_0x227de8);_0x5394bc[_0xcd86('0x3f')][_0xcd86('0x40')][_0xcd86('0x41')](_0x5708dd);_0x5394bc['tags']['ids']=_0x227de8;}else if(_0x3c9bd0[_0xcd86('0x20')]==='User'){_0x5394bc[_0xcd86('0x42')][_0xcd86('0x40')][_0xcd86('0x41')](_0xcd86('0x43'),_0x3c9bd0[_0xcd86('0x3d')]);_0x5394bc[_0xcd86('0x42')]['skip']=!![];}}}return _0x5394bc;}function parseModelFields(_0x28ea70,_0x176b8d){var _0x4ce070=squel[_0xcd86('0x21')]();var _0x4e1229=_(_0x28ea70)[_0xcd86('0x44')]()['map'](function(_0xddf358){return _[_0xcd86('0x45')](_0x176b8d,['name',_0xddf358])?_0xddf358:undefined;})['compact']()['value']();if(_0x28ea70['Contact']){_0x4e1229['push'](_0xcd86('0x46'));}if(_0x4e1229['length']>0x0){_0x4e1229['forEach'](function(_0x3eeace){if(_0x3eeace===_0xcd86('0x17')){_0x4ce070[_0xcd86('0x41')](_0xcd86('0x47'),[][_0xcd86('0x48')](_0x28ea70[_0x3eeace]));}else if(_0x3eeace===_0xcd86('0x46')){var _0x368e9d='%'+_0x28ea70[_0x3eeace]+'%';_0x4ce070[_0xcd86('0x41')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x368e9d);}else{_0x4ce070['and']('c.'+_0x3eeace+_0xcd86('0x49'),_0x28ea70[_0x3eeace]);}});}return _0x4ce070;}function parseQueryParameters(_0x1581a6,_0x175997){var _0xf7373=getSqlClauses();return Promise['resolve']()[_0xcd86('0x4a')](function(){return parseModelFields(_0x1581a6,_0x175997);})[_0xcd86('0x4a')](function(_0x45667c){_0xf7373[_0xcd86('0x4b')][_0xcd86('0x41')](_0x45667c);return parseTagParameter(_0x1581a6['tag']);})[_0xcd86('0x4a')](function(_0x3d1833){_0xf7373['tags']['clause']['and'](_0x3d1833);return parseSearchFilter(_0x1581a6[_0xcd86('0x4c')]);})['then'](function(_0x10227b){_0xf7373['filter']=_0x10227b;return _0xf7373;});}function checkListsRestrictions(_0x5edcb9,_0x1197a1,_0x46222f){var _0x38a054=squel[_0xcd86('0x21')]();return Promise[_0xcd86('0x4d')]()[_0xcd86('0x4a')](function(){if(_0x1197a1[_0xcd86('0x6')]&&_0x5edcb9[_0xcd86('0x5')]===_0xcd86('0x4e')&&!_0x46222f){return _0x5edcb9[_0xcd86('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0xcd86('0x4a')](function(_0x4fbc8a){if(_0x4fbc8a){if(_0x4fbc8a[_0xcd86('0x26')]===0x0){_0x38a054[_0xcd86('0x41')](_0xcd86('0x50'));}else{_0x38a054[_0xcd86('0x41')](_0xcd86('0x47'),_['map'](_0x4fbc8a,'id'));}}})['then'](function(){return _0x38a054;});}function buildContactsQuery(_0x19b54c,_0x27dba6,_0x13bcca,_0x6463e6,_0x122b42,_0x594329){if(_0x27dba6){_0x27dba6=_0x13bcca[_0xcd86('0x51')];}_0x19b54c=addFieldsToQuery(_0x19b54c,_0x27dba6,_0x6463e6,_0x594329,!![]);var _0x264b14=squel['select']();_0x264b14=addFieldsToQuery(_0x264b14,_0x27dba6,_0x6463e6,_0x594329,![]);if(_0x6463e6||_0x594329){_0x19b54c=applyJoinClauses(_0x19b54c,!![]);_0x19b54c[_0xcd86('0x52')]('c.id');if(_0x13bcca[_0xcd86('0x53')]){_0x264b14[_0xcd86('0x53')](_0x13bcca[_0xcd86('0x53')]);}if(_0x13bcca[_0xcd86('0x54')]){_0x264b14[_0xcd86('0x54')](_0x13bcca[_0xcd86('0x54')]);}}else{_0x264b14=applyJoinClauses(_0x264b14,![]);_0x264b14[_0xcd86('0x52')](_0xcd86('0x55'));if(_0x13bcca[_0xcd86('0x53')]){_0x19b54c[_0xcd86('0x53')](_0x13bcca[_0xcd86('0x53')]);}if(_0x13bcca[_0xcd86('0x54')]){_0x19b54c[_0xcd86('0x54')](_0x13bcca['offset']);}}_0x264b14['having'](_0x122b42);if(_0x13bcca['order']){_0x13bcca['order']['forEach'](function(_0x2bf824){_0x19b54c['order']('c.'+_0x2bf824[0x0],_0x2bf824[0x1]===_0xcd86('0x56')?![]:!![]);_0x264b14[_0xcd86('0x57')](_0xcd86('0x58')+_0x2bf824[0x0],_0x2bf824[0x1]===_0xcd86('0x56')?![]:!![]);});}_0x264b14[_0xcd86('0xa')](_0x19b54c,_0xcd86('0xe'));return _0x264b14;}function getFilteredContacts(_0x2e3c02){var _0x2f4cb9=[];return db['Tag'][_0xcd86('0x59')]({'attributes':['id','name',_0xcd86('0x5a')],'raw':!![]})[_0xcd86('0x4a')](function(_0x2c7c41){_0x2f4cb9=_[_0xcd86('0x5b')](_0x2c7c41,'id');var _0x5075ef={'type':db[_0xcd86('0x5c')][_0xcd86('0x5d')][_0xcd86('0x5e')],'model':db[_0xcd86('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xcd86('0x60')]['query'](_0x2e3c02['toString'](),_0x5075ef);})[_0xcd86('0x4a')](function(_0x596fec){_0x596fec[_0xcd86('0x1e')](function(_0xf6f0f){if(_0xf6f0f[_0xcd86('0x1b')]){_0xf6f0f[_0xcd86('0x61')]=[];_0xf6f0f['TagIds'][_0xcd86('0x25')](',')[_0xcd86('0x1e')](function(_0x2a4c33){_0xf6f0f[_0xcd86('0x61')]['push'](_0x2f4cb9[_0x2a4c33]);});}delete _0xf6f0f[_0xcd86('0x1b')];});return _0x596fec;});}function countFilteredContacts(_0x22b837,_0x30ec9e){var _0x21d18d=_0x22b837[_0xcd86('0x62')]();_0x21d18d[_0xcd86('0x20')](_0xcd86('0x63'));_0x21d18d=applyJoinClauses(_0x21d18d,!![]);_0x22b837[_0xcd86('0x52')](_0xcd86('0x64'));var _0x39ff74=utils[_0xcd86('0x22')](_0x30ec9e);if(!_[_0xcd86('0x65')](_0x39ff74)){_0x21d18d['where'](_0xcd86('0x66'),_0x39ff74);}var _0x4d176c={'type':db[_0xcd86('0x5c')][_0xcd86('0x5d')]['SELECT'],'raw':!![]};return db[_0xcd86('0x60')][_0xcd86('0x67')](_0x21d18d[_0xcd86('0x68')](),_0x4d176c)[_0xcd86('0x4a')](function(_0x16393b){return _0x16393b[0x0][_0xcd86('0x63')];});}module[_0xcd86('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9796fa8..8956c8e 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 _0xe4eb=['createReadStream','createDecipher','data','encryptString','secret','createCipher','utf8','base64','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','algorithm','encrypt','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','createWriteStream','update','binary','write','end','final','close','unlink','decryptFile'];(function(_0x1c138f,_0x4554ff){var _0x1e92d7=function(_0x52c6ee){while(--_0x52c6ee){_0x1c138f['push'](_0x1c138f['shift']());}};_0x1e92d7(++_0x4554ff);}(_0xe4eb,0x1cf));var _0xbe4e=function(_0x315d21,_0x336633){_0x315d21=_0x315d21-0x0;var _0x22710f=_0xe4eb[_0x315d21];return _0x22710f;};'use strict';var crypto=require(_0xbe4e('0x0'));var fs=require('fs');var BPromise=require(_0xbe4e('0x1'));var _=require(_0xbe4e('0x2'));var config=require(_0xbe4e('0x3'));var logger=require(_0xbe4e('0x4'))(_0xbe4e('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xbe4e('0x6')][_0xbe4e('0x7')],'algorithm':_0xbe4e('0x8')};const fileOptions={'algorithm':_0xbe4e('0x9')};if(config['encrypt']&&config['encrypt'][_0xbe4e('0xa')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xbe4e('0xa')]);if(isSupported){fileOptions['algorithm']=config[_0xbe4e('0xb')][_0xbe4e('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xbe4e('0xc')](',\x20');logger['error'](config[_0xbe4e('0xb')][_0xbe4e('0xa')],_0xbe4e('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x943296){return AES_SUPPORTED_RX[_0xbe4e('0xe')](_0x943296);}function getSupportedCiphers(){return crypto[_0xbe4e('0xf')]()[_0xbe4e('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x45dbc0){return getSupportedCiphers()['indexOf'](_0x45dbc0)>-0x1;}function combineOptions(_0x525b8b){var _0x39f34b={};for(var _0x43b1cc in fileOptions){if(fileOptions[_0xbe4e('0x11')](_0x43b1cc)){_0x39f34b[_0x43b1cc]=fileOptions[_0x43b1cc];}}if(_0x525b8b){for(var _0x31edb5 in _0x525b8b){if(_0x525b8b[_0xbe4e('0x11')](_0x31edb5)){_0x39f34b[_0x31edb5]=_0x525b8b[_0x31edb5];}}}return _0x39f34b;}exports['encryptFile']=function(_0x5b784f,_0x1fb015,_0x491a11,_0x1c05b5){return new BPromise(function(_0x5bb311,_0x942dd2){_0x1c05b5=combineOptions(_0x1c05b5);var _0x5bb487=new Buffer(_0x491a11);var _0x1cd033=fs['createReadStream'](_0x5b784f);var _0x527311=fs[_0xbe4e('0x12')](_0x1fb015);var _0x59a1c0=crypto['createCipher'](_0x1c05b5[_0xbe4e('0xa')],_0x5bb487);_0x1cd033['on']('data',function(_0x5c14b4){var _0x48708c=new Buffer(_0x59a1c0[_0xbe4e('0x13')](_0x5c14b4),_0xbe4e('0x14'));_0x527311[_0xbe4e('0x15')](_0x48708c);});_0x1cd033['on'](_0xbe4e('0x16'),function(){try{var _0xefe3fb=new Buffer(_0x59a1c0[_0xbe4e('0x17')](_0xbe4e('0x14')),_0xbe4e('0x14'));_0x527311[_0xbe4e('0x15')](_0xefe3fb);_0x527311[_0xbe4e('0x16')]();_0x527311['on'](_0xbe4e('0x18'),function(){return _0x5bb311(_0x1fb015);});}catch(_0x171073){fs[_0xbe4e('0x19')](_0x1fb015);return _0x942dd2(_0x171073);}});});};exports[_0xbe4e('0x1a')]=function(_0x4e1365,_0x3c5363,_0xafe3f0,_0x30a0cd){return new BPromise(function(_0x171c98,_0x277690){_0x30a0cd=combineOptions(_0x30a0cd);var _0x7f37c4=new Buffer(_0xafe3f0);var _0x4139bd=fs[_0xbe4e('0x1b')](_0x4e1365);var _0x45e08a=fs[_0xbe4e('0x12')](_0x3c5363);var _0xb7fdbb=crypto[_0xbe4e('0x1c')](_0x30a0cd['algorithm'],_0x7f37c4);_0x4139bd['on'](_0xbe4e('0x1d'),function(_0x3aef4c){var _0x4a7dde=new Buffer(_0xb7fdbb[_0xbe4e('0x13')](_0x3aef4c),_0xbe4e('0x14'));_0x45e08a[_0xbe4e('0x15')](_0x4a7dde);});_0x4139bd['on'](_0xbe4e('0x16'),function(){try{var _0x3ca770=new Buffer(_0xb7fdbb['final'](_0xbe4e('0x14')),_0xbe4e('0x14'));_0x45e08a[_0xbe4e('0x15')](_0x3ca770);_0x45e08a['end']();_0x45e08a['on'](_0xbe4e('0x18'),function(){return _0x171c98(_0x3c5363);});}catch(_0x1793ac){fs['unlink'](_0x3c5363);return _0x277690(_0x1793ac);}});});};exports[_0xbe4e('0x1e')]=function(_0x222bb9,_0x1ed10a,_0x5c6962){var _0x45e33c=_0x5c6962||stringOptions[_0xbe4e('0xa')];var _0x4cc3fe=_0x1ed10a||stringOptions[_0xbe4e('0x1f')];var _0x45f34c=crypto[_0xbe4e('0x20')](_0x45e33c,_0x4cc3fe);var _0x4e4f58=_0x45f34c[_0xbe4e('0x13')](_0x222bb9,_0xbe4e('0x21'),_0xbe4e('0x22'));_0x4e4f58+=_0x45f34c[_0xbe4e('0x17')](_0xbe4e('0x22'));return _0x4e4f58;};exports['decryptString']=function(_0x2f4254,_0x473f8f,_0x401ef2){var _0x5ba6f0=_0x401ef2||stringOptions[_0xbe4e('0xa')];var _0x766af4=_0x473f8f||stringOptions[_0xbe4e('0x1f')];var _0x200a87=crypto[_0xbe4e('0x1c')](_0x5ba6f0,_0x766af4);var _0x1c2c75=_0x200a87[_0xbe4e('0x13')](_0x2f4254,_0xbe4e('0x22'),'utf8');_0x1c2c75+=_0x200a87['final']('utf8');return _0x1c2c75;}; \ No newline at end of file +var _0xe2e0=['binary','final','secret','createCipher','utf8','base64','decryptString','createDecipher','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','end','write','close','unlink','decryptFile','createReadStream'];(function(_0x5d9b2e,_0x25ce00){var _0x59a14c=function(_0x5c365f){while(--_0x5c365f){_0x5d9b2e['push'](_0x5d9b2e['shift']());}};_0x59a14c(++_0x25ce00);}(_0xe2e0,0x166));var _0x0e2e=function(_0x5bc3fc,_0x54db61){_0x5bc3fc=_0x5bc3fc-0x0;var _0x1253d0=_0xe2e0[_0x5bc3fc];return _0x1253d0;};'use strict';var crypto=require(_0x0e2e('0x0'));var fs=require('fs');var BPromise=require(_0x0e2e('0x1'));var _=require(_0x0e2e('0x2'));var config=require(_0x0e2e('0x3'));var logger=require(_0x0e2e('0x4'))(_0x0e2e('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0e2e('0x6')][_0x0e2e('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x0e2e('0x8')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0x0e2e('0x9')]);if(isSupported){fileOptions[_0x0e2e('0x9')]=config[_0x0e2e('0x8')][_0x0e2e('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0e2e('0xa')](',\x20');logger[_0x0e2e('0xb')](config['encrypt']['algorithm'],_0x0e2e('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x5d35ed){return AES_SUPPORTED_RX[_0x0e2e('0xd')](_0x5d35ed);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x0e2e('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x38e73c){return getSupportedCiphers()[_0x0e2e('0xf')](_0x38e73c)>-0x1;}function combineOptions(_0x1921d1){var _0x387c93={};for(var _0x196fb0 in fileOptions){if(fileOptions[_0x0e2e('0x10')](_0x196fb0)){_0x387c93[_0x196fb0]=fileOptions[_0x196fb0];}}if(_0x1921d1){for(var _0x33e545 in _0x1921d1){if(_0x1921d1[_0x0e2e('0x10')](_0x33e545)){_0x387c93[_0x33e545]=_0x1921d1[_0x33e545];}}}return _0x387c93;}exports[_0x0e2e('0x11')]=function(_0x5b9b19,_0x3d299c,_0x37febe,_0x35943e){return new BPromise(function(_0x5bbacf,_0x37d5fd){_0x35943e=combineOptions(_0x35943e);var _0x1aa067=new Buffer(_0x37febe);var _0x3b69e0=fs['createReadStream'](_0x5b9b19);var _0x3b7313=fs[_0x0e2e('0x12')](_0x3d299c);var _0x457a82=crypto['createCipher'](_0x35943e[_0x0e2e('0x9')],_0x1aa067);_0x3b69e0['on'](_0x0e2e('0x13'),function(_0x2ca2d3){var _0x44be5c=new Buffer(_0x457a82[_0x0e2e('0x14')](_0x2ca2d3),'binary');_0x3b7313['write'](_0x44be5c);});_0x3b69e0['on'](_0x0e2e('0x15'),function(){try{var _0x302664=new Buffer(_0x457a82['final']('binary'),'binary');_0x3b7313[_0x0e2e('0x16')](_0x302664);_0x3b7313[_0x0e2e('0x15')]();_0x3b7313['on'](_0x0e2e('0x17'),function(){return _0x5bbacf(_0x3d299c);});}catch(_0x1cf7ef){fs[_0x0e2e('0x18')](_0x3d299c);return _0x37d5fd(_0x1cf7ef);}});});};exports[_0x0e2e('0x19')]=function(_0x24b9b0,_0x4c0a09,_0x1ae857,_0x53ec69){return new BPromise(function(_0x909b5d,_0x517cb0){_0x53ec69=combineOptions(_0x53ec69);var _0x351fdb=new Buffer(_0x1ae857);var _0x206764=fs[_0x0e2e('0x1a')](_0x24b9b0);var _0x79b713=fs['createWriteStream'](_0x4c0a09);var _0x3b80c4=crypto['createDecipher'](_0x53ec69[_0x0e2e('0x9')],_0x351fdb);_0x206764['on'](_0x0e2e('0x13'),function(_0x230955){var _0x4d9bd9=new Buffer(_0x3b80c4[_0x0e2e('0x14')](_0x230955),_0x0e2e('0x1b'));_0x79b713[_0x0e2e('0x16')](_0x4d9bd9);});_0x206764['on'](_0x0e2e('0x15'),function(){try{var _0x3c2847=new Buffer(_0x3b80c4[_0x0e2e('0x1c')]('binary'),_0x0e2e('0x1b'));_0x79b713[_0x0e2e('0x16')](_0x3c2847);_0x79b713[_0x0e2e('0x15')]();_0x79b713['on']('close',function(){return _0x909b5d(_0x4c0a09);});}catch(_0x1c7ad3){fs['unlink'](_0x4c0a09);return _0x517cb0(_0x1c7ad3);}});});};exports['encryptString']=function(_0x2dede0,_0x1b0b8b,_0x9dbf2){var _0xd18d6c=_0x9dbf2||stringOptions[_0x0e2e('0x9')];var _0x496764=_0x1b0b8b||stringOptions[_0x0e2e('0x1d')];var _0x3324fa=crypto[_0x0e2e('0x1e')](_0xd18d6c,_0x496764);var _0x2078ab=_0x3324fa[_0x0e2e('0x14')](_0x2dede0,_0x0e2e('0x1f'),_0x0e2e('0x20'));_0x2078ab+=_0x3324fa['final']('base64');return _0x2078ab;};exports[_0x0e2e('0x21')]=function(_0xa4108e,_0x4faa96,_0x406926){var _0xf39380=_0x406926||stringOptions[_0x0e2e('0x9')];var _0x3f6632=_0x4faa96||stringOptions[_0x0e2e('0x1d')];var _0x350862=crypto[_0x0e2e('0x22')](_0xf39380,_0x3f6632);var _0x4cee54=_0x350862['update'](_0xa4108e,_0x0e2e('0x20'),_0x0e2e('0x1f'));_0x4cee54+=_0x350862[_0x0e2e('0x1c')](_0x0e2e('0x1f'));return _0x4cee54;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0f5f406..c4255f7 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 _0x4969=['zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','finally','exit','util','path','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip'];(function(_0x33ca52,_0x1a73c3){var _0x4b2f63=function(_0x58ca13){while(--_0x58ca13){_0x33ca52['push'](_0x33ca52['shift']());}};_0x4b2f63(++_0x1a73c3);}(_0x4969,0xc8));var _0x9496=function(_0x5abb00,_0x342d70){_0x5abb00=_0x5abb00-0x0;var _0xf9b854=_0x4969[_0x5abb00];return _0xf9b854;};'use strict';var util=require(_0x9496('0x0'));var path=require(_0x9496('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x9496('0x2'));var db=require(_0x9496('0x3'))['db'];var dbH=require('../../mysqldb')[_0x9496('0x4')];var logger=require(_0x9496('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9496('0x6')][0x3];var PATH=process[_0x9496('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x58cc30,_0x395582){var _0xf88d55={'status':_0x58cc30};var _0x4f0bc0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x395582){_0xf88d55[_0x9496('0x7')]=_0x395582;}return db[_0x9496('0x8')][_0x9496('0x9')](_0xf88d55,_0x4f0bc0);}function main(){var _0x1dafb7=0x1388;var _0x5a3d30;logger['info'](util[_0x9496('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9496('0xb')));return db['Setting'][_0x9496('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9496('0xd'),_0x9496('0xe')]})[_0x9496('0xf')](function(_0x4201bc){if(_0x4201bc){_0x5a3d30=_0x4201bc;_0x1dafb7=_0x5a3d30[_0x9496('0xe')]||0x1388;}})[_0x9496('0xf')](function(){return dbH[_0x9496('0x10')][_0x9496('0x11')](util[_0x9496('0xa')](_0x9496('0x12'),QUERY),{'type':dbH['sequelize'][_0x9496('0x13')][_0x9496('0x14')]});})[_0x9496('0xf')](function(_0x4bc667){if(!_0x4bc667[0x0]['num']){return analyticExtractedReport(_0x9496('0x15'));}var _0x4ee625=[];var _0x2fe790=0x0;if(_0x5a3d30[_0x9496('0xd')]){if(_0x4bc667&&_0x4bc667['length']){var _0x5b6d4f=_[_0x9496('0x16')](_0x4bc667[0x0][_0x9496('0x17')]/_0x1dafb7);var _0x478a8b=Number[_0x9496('0x18')](_0x4bc667[0x0][_0x9496('0x17')]/_0x1dafb7)?_0x4bc667[0x0][_0x9496('0x17')]%_0x1dafb7:0x0;_0x5b6d4f[_0x9496('0x19')](function(_0x89fbdb){if(_0x89fbdb>0x0){_0x2fe790+=_0x1dafb7;}_0x4ee625[_0x9496('0x1a')](dbH['sequelize']['query'](util['format'](_0x9496('0x1b'),QUERY,_0x1dafb7,_0x2fe790),{'type':dbH[_0x9496('0x10')][_0x9496('0x13')][_0x9496('0x14')]}));});if(_0x478a8b>0x0){_0x2fe790+=_0x1dafb7;_0x4ee625['push'](dbH['sequelize'][_0x9496('0x11')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x478a8b,_0x2fe790),{'type':dbH['sequelize'][_0x9496('0x13')][_0x9496('0x14')]}));}}}else{_0x4ee625[_0x9496('0x1a')](dbH['sequelize'][_0x9496('0x11')](QUERY,{'type':dbH[_0x9496('0x10')][_0x9496('0x13')]['SELECT']}));}var _0x1fd2e2=path[_0x9496('0x1c')](PATH);var _0x240c74=path[_0x9496('0x1d')](PATH,_0x9496('0x1e'));var _0x58df94=_0x5a3d30['split']&&_0x4ee625[_0x9496('0x1f')]>0x1;var _0x6d8a27=[];if(!fs[_0x9496('0x20')](path[_0x9496('0x21')](_0x1fd2e2,_0x240c74))&&_0x58df94){fs[_0x9496('0x22')](path['join'](_0x1fd2e2,_0x240c74));}return BPromise['each'](_0x4ee625,function(_0x1ef0eb){_0x6d8a27['push'](_0x1ef0eb);})[_0x9496('0xf')](function(){for(var _0x1cbaca=0x0;_0x1cbaca<_0x6d8a27[_0x9496('0x1f')];_0x1cbaca+=0x1){var _0x3e453e;var _0x58e4eb=_0x6d8a27[_0x1cbaca];if(_0x58df94){_0x3e453e=path[_0x9496('0x21')](_0x1fd2e2,_0x240c74,util[_0x9496('0xa')](_0x9496('0x23'),_0x240c74,_0x1cbaca,_0x9496('0x24')));}else{_0x3e453e=path[_0x9496('0x21')](_0x1fd2e2,util[_0x9496('0xa')](_0x9496('0x25'),_0x240c74,_0x9496('0x24')));}fs[_0x9496('0x26')](_0x3e453e,csv(_0x58e4eb));}})[_0x9496('0xf')](function(){if(_0x58df94){return new Promise(function(_0x5103de){zipdir(path[_0x9496('0x21')](_0x1fd2e2,_0x240c74),{'saveTo':path[_0x9496('0x21')](_0x1fd2e2,util[_0x9496('0xa')]('%s.%s',_0x240c74,_0x9496('0x27')))},function(_0x5ab0da,_0x4a8fc7){rimraf(path['join'](_0x1fd2e2,_0x240c74),function(){});_0x5103de(_0x9496('0x28'));});});}})['then'](function(){logger[_0x9496('0x29')](util[_0x9496('0xa')](_0x9496('0x2a'),EXTRACTED_REPORT_ID,_0x9496('0xb')));return analyticExtractedReport(_0x9496('0x2b'),_0x58df94?util['format'](_0x9496('0x25'),_0x240c74,_0x58df94?_0x9496('0x27'):_0x9496('0x24')):null);});})[_0x9496('0x2c')](function(_0x25328e){logger[_0x9496('0x29')](util[_0x9496('0xa')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9496('0xb')),util['inspect'](_0x25328e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9496('0x2d'));})[_0x9496('0x2e')](function(){process[_0x9496('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x49f4=['zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','query','sequelize','QueryTypes','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x49f4,0x177));var _0x449f=function(_0x11aee5,_0x27fa94){_0x11aee5=_0x11aee5-0x0;var _0x2e8c9d=_0x49f4[_0x11aee5];return _0x2e8c9d;};'use strict';var util=require(_0x449f('0x0'));var path=require(_0x449f('0x1'));var _=require(_0x449f('0x2'));var csv=require(_0x449f('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x449f('0x4'));var rimraf=require(_0x449f('0x5'));var db=require(_0x449f('0x6'))['db'];var dbH=require(_0x449f('0x6'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d7140,_0x11d2d6){var _0x35f15f={'status':_0x4d7140};var _0x145df1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11d2d6){_0x35f15f[_0x449f('0x7')]=_0x11d2d6;}return db[_0x449f('0x8')][_0x449f('0x9')](_0x35f15f,_0x145df1);}function main(){var _0xc12551=0x1388;var _0x4f9219;logger[_0x449f('0xa')](util[_0x449f('0xb')](_0x449f('0xc'),EXTRACTED_REPORT_ID,_0x449f('0xd')));return db[_0x449f('0xe')][_0x449f('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x449f('0x10'),'splitSizeCsv']})[_0x449f('0x11')](function(_0x517792){if(_0x517792){_0x4f9219=_0x517792;_0xc12551=_0x4f9219[_0x449f('0x12')]||0x1388;}})[_0x449f('0x11')](function(){return dbH['sequelize'][_0x449f('0x13')](util[_0x449f('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x449f('0x14')][_0x449f('0x15')]['SELECT']});})[_0x449f('0x11')](function(_0x3d74ab){if(!_0x3d74ab[0x0][_0x449f('0x16')]){return analyticExtractedReport('Empty');}var _0x1a8a7c=[];var _0x1294f6=0x0;if(_0x4f9219[_0x449f('0x10')]){if(_0x3d74ab&&_0x3d74ab[_0x449f('0x17')]){var _0xf61f01=_[_0x449f('0x18')](_0x3d74ab[0x0][_0x449f('0x16')]/_0xc12551);var _0x1c8e02=Number[_0x449f('0x19')](_0x3d74ab[0x0][_0x449f('0x16')]/_0xc12551)?_0x3d74ab[0x0]['num']%_0xc12551:0x0;_0xf61f01[_0x449f('0x1a')](function(_0x3afffc){if(_0x3afffc>0x0){_0x1294f6+=_0xc12551;}_0x1a8a7c[_0x449f('0x1b')](dbH[_0x449f('0x14')][_0x449f('0x13')](util[_0x449f('0xb')](_0x449f('0x1c'),QUERY,_0xc12551,_0x1294f6),{'type':dbH[_0x449f('0x14')][_0x449f('0x15')][_0x449f('0x1d')]}));});if(_0x1c8e02>0x0){_0x1294f6+=_0xc12551;_0x1a8a7c[_0x449f('0x1b')](dbH[_0x449f('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1c8e02,_0x1294f6),{'type':dbH[_0x449f('0x14')][_0x449f('0x15')]['SELECT']}));}}}else{_0x1a8a7c['push'](dbH[_0x449f('0x14')][_0x449f('0x13')](QUERY,{'type':dbH[_0x449f('0x14')][_0x449f('0x15')][_0x449f('0x1d')]}));}var _0xecc74b=path[_0x449f('0x1e')](PATH);var _0xc85ef8=path[_0x449f('0x1f')](PATH,_0x449f('0x20'));var _0xfa87e9=_0x4f9219['split']&&_0x1a8a7c[_0x449f('0x17')]>0x1;var _0x42f518=[];if(!fs['existsSync'](path[_0x449f('0x21')](_0xecc74b,_0xc85ef8))&&_0xfa87e9){fs[_0x449f('0x22')](path[_0x449f('0x21')](_0xecc74b,_0xc85ef8));}return BPromise[_0x449f('0x23')](_0x1a8a7c,function(_0x4e4028){_0x42f518[_0x449f('0x1b')](_0x4e4028);})[_0x449f('0x11')](function(){for(var _0x18cfb6=0x0;_0x18cfb6<_0x42f518[_0x449f('0x17')];_0x18cfb6+=0x1){var _0x2052a4;var _0x4da86a=_0x42f518[_0x18cfb6];if(_0xfa87e9){_0x2052a4=path['join'](_0xecc74b,_0xc85ef8,util['format'](_0x449f('0x24'),_0xc85ef8,_0x18cfb6,_0x449f('0x25')));}else{_0x2052a4=path[_0x449f('0x21')](_0xecc74b,util[_0x449f('0xb')](_0x449f('0x26'),_0xc85ef8,_0x449f('0x25')));}fs['writeFileSync'](_0x2052a4,csv(_0x4da86a));}})['then'](function(){if(_0xfa87e9){return new Promise(function(_0x577fa0){zipdir(path[_0x449f('0x21')](_0xecc74b,_0xc85ef8),{'saveTo':path[_0x449f('0x21')](_0xecc74b,util[_0x449f('0xb')](_0x449f('0x26'),_0xc85ef8,_0x449f('0x27')))},function(_0x404687,_0x372ed2){rimraf(path[_0x449f('0x21')](_0xecc74b,_0xc85ef8),function(){});_0x577fa0(_0x449f('0x28'));});});}})[_0x449f('0x11')](function(){logger[_0x449f('0xa')](util[_0x449f('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x449f('0x29'),_0xfa87e9?util['format']('%s.%s',_0xc85ef8,_0xfa87e9?_0x449f('0x27'):'csv'):null);});})[_0x449f('0x2a')](function(_0x2dbf52){logger['info'](util[_0x449f('0xb')](_0x449f('0x2b'),EXTRACTED_REPORT_ID,_0x449f('0xd')),util[_0x449f('0x2c')](_0x2dbf52,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x449f('0x2d'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 2e0802e..0a1aa73 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 _0xbda8=['createPdfFromHTML','lodash','path','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','toString','value','length','auto','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','margin','landscape','footer','Arial','black','right','Setting','split','then','range','num','sequelize','query','QueryTypes','SELECT','dirname','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','all','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xbda8,0xad));var _0x8bda=function(_0x1c85f4,_0x3c94b6){_0x1c85f4=_0x1c85f4-0x0;var _0x43d94b=_0xbda8[_0x1c85f4];return _0x43d94b;};'use strict';var _=require(_0x8bda('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x8bda('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x8bda('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x8bda('0x3'));var rimraf=require(_0x8bda('0x4'));var JSDOM=require(_0x8bda('0x5'))[_0x8bda('0x6')];var window=new JSDOM('')[_0x8bda('0x7')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0x8bda('0x8'))[_0x8bda('0x9')];var logger=require(_0x8bda('0xa'))(_0x8bda('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x8bda('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x8bda('0xc')][0x5];var FORMAT=_0x8bda('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4dc394,_0x2be4a6){var _0x24d861={'status':_0x4dc394};var _0x5d0414={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2be4a6){_0x24d861[_0x8bda('0xe')]=_0x2be4a6;}return db[_0x8bda('0xf')][_0x8bda('0x10')](_0x24d861,_0x5d0414);}function getHeaders(_0xe4052b){return _[_0x8bda('0x11')](_0xe4052b,function(_0x1a1736){return{'text':_0x1a1736,'style':'tableHeader'};});}function getRows(_0x23d68d,_0x34840f){return _[_0x8bda('0x11')](_0x34840f,function(_0x58854c){return _(_0x58854c)['pick'](_0x23d68d)[_0x8bda('0x11')](function(_0x161abc){return _0x161abc?_[_0x8bda('0x12')](_0x161abc):'';})[_0x8bda('0x13')]();});}function createTable(_0xb25563,_0x43631b){var _0x253c8e={'widths':_['fill'](Array(_0xb25563[_0x8bda('0x14')]),0x91),'heights':function(_0x17a10f){return _0x17a10f===0x0?_0x8bda('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x125e0e=getHeaders(_0xb25563);_0x253c8e[_0x8bda('0x16')][_0x8bda('0x17')](_0x125e0e);var _0x3bfe1b=getRows(_0xb25563,_0x43631b);_0x253c8e['body']=_0x253c8e['body'][_0x8bda('0x18')](_0x3bfe1b);return _0x253c8e;}function createTables(_0x30ae14){var _0x2d1dd8=[];var _0x3d54d3=_['chunk'](Object[_0x8bda('0x19')](_0x30ae14[0x0]),0x5);_0x3d54d3[_0x8bda('0x1a')](function(_0x1c4641){_0x2d1dd8[_0x8bda('0x17')](createTable(_0x1c4641,_0x30ae14));});return _0x2d1dd8;}function getPDFDocDefinition(_0x34a144){var _0x42ec93=util[_0x8bda('0x1b')](_0x8bda('0x1c'),NAME,EXTRACTED_REPORT[_0x8bda('0x1d')],moment(EXTRACTED_REPORT[_0x8bda('0x1e')])[_0x8bda('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x8bda('0x1f')])[_0x8bda('0x1b')](FORMAT));var _0x3d62c3=[];for(var _0x60860a=0x0;_0x60860a<_0x34a144[_0x8bda('0x14')];_0x60860a++){var _0x371419=[];if(_0x60860a===0x0){_0x371419[_0x8bda('0x17')]({'text':_0x42ec93,'style':_0x8bda('0x20')});}var _0x216ab3={'table':_0x34a144[_0x60860a]};if(_0x60860a>0x0){_0x216ab3[_0x8bda('0x21')]='before';_0x216ab3[_0x8bda('0x22')]=[0x0,0x46,0x0,0x0];}_0x371419[_0x8bda('0x17')](_0x216ab3);_0x3d62c3[_0x8bda('0x17')](_0x371419);}return{'pageSize':'A4','pageOrientation':_0x8bda('0x23'),'content':_0x3d62c3,'footer':function(_0x153cd3,_0x3421e9){return{'text':_0x153cd3['toString']()+'\x20/\x20'+_0x3421e9,'style':_0x8bda('0x24')};},'defaultStyle':{'font':_0x8bda('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8bda('0x26')},'footer':{'alignment':_0x8bda('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5f100e){var _0x5d148d=0x1388;var _0x444ad3;if(!_0x5f100e[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0x8bda('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8bda('0x29'),'splitSizePdf']})[_0x8bda('0x2a')](function(_0xe184c2){if(_0xe184c2){_0x444ad3=_0xe184c2;_0x5d148d=_0x444ad3['splitSizePdf']||0x3e8;}})[_0x8bda('0x2a')](function(){var _0x26bf08=[];var _0x47b15c=0x0;if(_0x444ad3[_0x8bda('0x29')]){if(_0x5f100e&&_0x5f100e[_0x8bda('0x14')]){var _0x5527a6=_[_0x8bda('0x2b')](_0x5f100e[0x0][_0x8bda('0x2c')]/_0x5d148d);var _0x28ee42=Number['isInteger'](_0x5f100e[0x0]['num']/_0x5d148d)?_0x5f100e[0x0][_0x8bda('0x2c')]%_0x5d148d:0x0;_0x5527a6[_0x8bda('0x1a')](function(_0x5bbc92){if(_0x5bbc92>0x0){_0x47b15c+=_0x5d148d;}_0x26bf08[_0x8bda('0x17')](dbH[_0x8bda('0x2d')][_0x8bda('0x2e')](util[_0x8bda('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5d148d,_0x47b15c),{'type':dbH[_0x8bda('0x2d')][_0x8bda('0x2f')]['SELECT']}));});if(_0x28ee42>0x0){_0x47b15c+=_0x5d148d;_0x26bf08[_0x8bda('0x17')](dbH[_0x8bda('0x2d')][_0x8bda('0x2e')](util[_0x8bda('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x28ee42,_0x47b15c),{'type':dbH[_0x8bda('0x2d')][_0x8bda('0x2f')][_0x8bda('0x30')]}));}}}else{_0x26bf08[_0x8bda('0x17')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x8bda('0x2d')][_0x8bda('0x2f')]['SELECT']}));}var _0x16e997=path[_0x8bda('0x31')](PATH);var _0x13b394=path['basename'](PATH,_0x8bda('0x32'));var _0x5af1ce=_0x444ad3[_0x8bda('0x29')]&&_0x26bf08[_0x8bda('0x14')]>0x1;var _0x115cc9=[];if(!fs[_0x8bda('0x33')](path[_0x8bda('0x34')](_0x16e997,_0x13b394))&&_0x5af1ce){fs[_0x8bda('0x35')](path['join'](_0x16e997,_0x13b394));}return BPromise['each'](_0x26bf08,function(_0x5e802e){_0x115cc9['push'](_0x5e802e);})['then'](function(){var _0x53bc22=[];for(var _0x13a4ac=0x0;_0x13a4ac<_0x115cc9[_0x8bda('0x14')];_0x13a4ac+=0x1){var _0x1d2ab2=_0x115cc9[_0x13a4ac];var _0x46863b=createTables(_[_0x8bda('0x36')](_0x1d2ab2));var _0x574bc0;var _0x369cbc=getPDFDocDefinition(_0x46863b);var _0x5d05e9=getPDFPrinter();var _0x309792=_0x5d05e9[_0x8bda('0x37')](_0x369cbc);if(_0x5af1ce){_0x574bc0=path[_0x8bda('0x34')](_0x16e997,_0x13b394,util[_0x8bda('0x1b')]('%s%d.%s',_0x13b394,_0x13a4ac,'pdf'));}else{_0x574bc0=path['join'](_0x16e997,util[_0x8bda('0x1b')]('%s.%s',_0x13b394,'pdf'));}_0x53bc22[_0x8bda('0x17')](writePDFDocument(_0x309792,_0x574bc0));}return Promise[_0x8bda('0x38')](_0x53bc22);})[_0x8bda('0x2a')](function(){if(_0x5af1ce){return new Promise(function(_0x2670e3){zipdir(path[_0x8bda('0x34')](_0x16e997,_0x13b394),{'saveTo':path[_0x8bda('0x34')](_0x16e997,util[_0x8bda('0x1b')](_0x8bda('0x39'),_0x13b394,'zip'))},function(){rimraf(path[_0x8bda('0x34')](_0x16e997,_0x13b394),function(){});_0x2670e3('zip\x20finished');});});}})[_0x8bda('0x2a')](function(){if(!_0x5af1ce)return;rimraf(path[_0x8bda('0x34')](_0x16e997,_0x13b394),function(){});})[_0x8bda('0x2a')](function(){logger[_0x8bda('0x3a')](util['format'](_0x8bda('0x3b'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x5af1ce?util[_0x8bda('0x1b')](_0x8bda('0x39'),_0x13b394,_0x5af1ce?_0x8bda('0x3c'):_0x8bda('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8bda('0x3a')](util[_0x8bda('0x1b')](_0x8bda('0x3e'),EXTRACTED_REPORT_ID,_0x8bda('0x3f')));return db['AnalyticExtractedReport'][_0x8bda('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8bda('0x2a')](function(_0x790299){EXTRACTED_REPORT=_0x790299;return dbH[_0x8bda('0x2d')][_0x8bda('0x2e')](util['format'](_0x8bda('0x41'),QUERY),{'type':dbH[_0x8bda('0x2d')]['QueryTypes'][_0x8bda('0x30')]});})[_0x8bda('0x2a')](extractReport)[_0x8bda('0x42')](function(_0x1c3143){logger[_0x8bda('0x3a')](util[_0x8bda('0x1b')](_0x8bda('0x43'),EXTRACTED_REPORT_ID,_0x8bda('0x3f')),util[_0x8bda('0x44')](_0x1c3143,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8bda('0x45'));})[_0x8bda('0x46')](function(){process[_0x8bda('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3b9e09=new PdfPrinter({'Arial':{'normal':__dirname+_0x8bda('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x8bda('0x49')}});return _0x3b9e09;}function getPDFDocDefinitionFromHTML(_0x508366,_0x57dcbb){var _0xb9fd51=util[_0x8bda('0x1b')](_0x8bda('0x4a'),_0x57dcbb[_0x8bda('0x4b')],_0x57dcbb[_0x8bda('0x4c')]);var _0x16db8a=moment()[_0x8bda('0x1b')](_0x8bda('0x4d'))['toString']();var _0x55102c=htmlToPdfmake(_0x508366,{'window':window,'tableAutoSize':!![]});return{'content':[_0x55102c],'defaultStyle':{'font':_0x8bda('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8bda('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8bda('0x4e')}},'header':function(){return[{'text':_0x8bda('0x4f'),'style':_0x8bda('0x20')}];},'footer':function(_0x46ef00,_0x19120a){return[{'text':util[_0x8bda('0x1b')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0xb9fd51,_0x46ef00,_0x19120a,_0x16db8a),'style':_0x8bda('0x24')}];}};}function writePDFDocument(_0x440a8d,_0x11e509){return new Promise(function(_0x42d2cd,_0x1618cc){var _0x83d2da=_0x440a8d[_0x8bda('0x50')](fs[_0x8bda('0x51')](_0x11e509));_0x83d2da['on'](_0x8bda('0x52'),function(){_0x42d2cd(_0x8bda('0x52'));});_0x83d2da['on'](_0x8bda('0x53'),function(_0x12b43a){_0x1618cc(_0x12b43a);});_0x440a8d[_0x8bda('0x54')]();});}exports[_0x8bda('0x55')]=function(_0x2145e9,_0x12f063){var _0x5dc076=getPDFPrinter();var _0x51bb50=getPDFDocDefinitionFromHTML(_0x2145e9,_0x12f063);var _0x204c2f=_0x5dc076[_0x8bda('0x37')](_0x51bb50);return writePDFDocument(_0x204c2f,_0x12f063[_0x8bda('0x1')])[_0x8bda('0x42')](function(_0xafb74b){throw _0xafb74b;});}; \ No newline at end of file +var _0x9f9a=['Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','end','util','moment','html-to-pdfmake','zip-dir','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','value','length','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','before','margin','toString','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','center'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9f9a,0xb3));var _0xa9f9=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x9f9a[_0x5d7227];return _0x15ac55;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xa9f9('0x0'));var path=require('path');var moment=require(_0xa9f9('0x1'));var htmlToPdfmake=require(_0xa9f9('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xa9f9('0x3'));var rimraf=require('rimraf');var JSDOM=require(_0xa9f9('0x4'))['JSDOM'];var window=new JSDOM('')[_0xa9f9('0x5')];var BPromise=require(_0xa9f9('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0xa9f9('0x7'))[_0xa9f9('0x8')];var logger=require(_0xa9f9('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa9f9('0xa')][0x2]);var QUERY=process[_0xa9f9('0xa')][0x3];var PATH=process[_0xa9f9('0xa')][0x4];var NAME=process[_0xa9f9('0xa')][0x5];var FORMAT=_0xa9f9('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3778b7,_0x48979c){var _0x1f0a86={'status':_0x3778b7};var _0x4e10f7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x48979c){_0x1f0a86['savename']=_0x48979c;}return db[_0xa9f9('0xc')][_0xa9f9('0xd')](_0x1f0a86,_0x4e10f7);}function getHeaders(_0x1a855d){return _[_0xa9f9('0xe')](_0x1a855d,function(_0xf13ece){return{'text':_0xf13ece,'style':_0xa9f9('0xf')};});}function getRows(_0x5db5ac,_0x2bdd58){return _[_0xa9f9('0xe')](_0x2bdd58,function(_0x1d1adc){return _(_0x1d1adc)[_0xa9f9('0x10')](_0x5db5ac)[_0xa9f9('0xe')](function(_0x50c8b8){return _0x50c8b8?_['toString'](_0x50c8b8):'';})[_0xa9f9('0x11')]();});}function createTable(_0x4e4a94,_0x15dc51){var _0x545af1={'widths':_['fill'](Array(_0x4e4a94[_0xa9f9('0x12')]),0x91),'heights':function(_0x12c8d6){return _0x12c8d6===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x751cb=getHeaders(_0x4e4a94);_0x545af1[_0xa9f9('0x13')][_0xa9f9('0x14')](_0x751cb);var _0x2edd69=getRows(_0x4e4a94,_0x15dc51);_0x545af1[_0xa9f9('0x13')]=_0x545af1['body'][_0xa9f9('0x15')](_0x2edd69);return _0x545af1;}function createTables(_0x2c5e75){var _0x54a686=[];var _0x19679f=_[_0xa9f9('0x16')](Object[_0xa9f9('0x17')](_0x2c5e75[0x0]),0x5);_0x19679f[_0xa9f9('0x18')](function(_0xfdbb60){_0x54a686['push'](createTable(_0xfdbb60,_0x2c5e75));});return _0x54a686;}function getPDFDocDefinition(_0x59f33b){var _0x5f5915=util[_0xa9f9('0x19')](_0xa9f9('0x1a'),NAME,EXTRACTED_REPORT[_0xa9f9('0x1b')],moment(EXTRACTED_REPORT[_0xa9f9('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xa9f9('0x1d')])['format'](FORMAT));var _0x12ef8c=[];for(var _0x4725e5=0x0;_0x4725e5<_0x59f33b['length'];_0x4725e5++){var _0x5c6e57=[];if(_0x4725e5===0x0){_0x5c6e57['push']({'text':_0x5f5915,'style':_0xa9f9('0x1e')});}var _0xa02d6f={'table':_0x59f33b[_0x4725e5]};if(_0x4725e5>0x0){_0xa02d6f['pageBreak']=_0xa9f9('0x1f');_0xa02d6f[_0xa9f9('0x20')]=[0x0,0x46,0x0,0x0];}_0x5c6e57['push'](_0xa02d6f);_0x12ef8c[_0xa9f9('0x14')](_0x5c6e57);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x12ef8c,'footer':function(_0x519a93,_0x18f1ce){return{'text':_0x519a93[_0xa9f9('0x21')]()+'\x20/\x20'+_0x18f1ce,'style':_0xa9f9('0x22')};},'defaultStyle':{'font':_0xa9f9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa9f9('0x24')},'footer':{'alignment':_0xa9f9('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4193c7){var _0x15584d=0x1388;var _0x2d9f59;if(!_0x4193c7[0x0][_0xa9f9('0x26')]){return analyticExtractedReport(_0xa9f9('0x27'));}return db[_0xa9f9('0x28')][_0xa9f9('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa9f9('0x2a'),_0xa9f9('0x2b')]})[_0xa9f9('0x2c')](function(_0xf2cffc){if(_0xf2cffc){_0x2d9f59=_0xf2cffc;_0x15584d=_0x2d9f59[_0xa9f9('0x2b')]||0x3e8;}})[_0xa9f9('0x2c')](function(){var _0x5b55e3=[];var _0x303b5f=0x0;if(_0x2d9f59[_0xa9f9('0x2a')]){if(_0x4193c7&&_0x4193c7[_0xa9f9('0x12')]){var _0x2b7b8f=_[_0xa9f9('0x2d')](_0x4193c7[0x0][_0xa9f9('0x26')]/_0x15584d);var _0x2a5d5c=Number[_0xa9f9('0x2e')](_0x4193c7[0x0][_0xa9f9('0x26')]/_0x15584d)?_0x4193c7[0x0][_0xa9f9('0x26')]%_0x15584d:0x0;_0x2b7b8f['forEach'](function(_0x3d7c38){if(_0x3d7c38>0x0){_0x303b5f+=_0x15584d;}_0x5b55e3[_0xa9f9('0x14')](dbH[_0xa9f9('0x2f')][_0xa9f9('0x30')](util[_0xa9f9('0x19')](_0xa9f9('0x31'),QUERY,_0x15584d,_0x303b5f),{'type':dbH['sequelize'][_0xa9f9('0x32')][_0xa9f9('0x33')]}));});if(_0x2a5d5c>0x0){_0x303b5f+=_0x15584d;_0x5b55e3[_0xa9f9('0x14')](dbH['sequelize'][_0xa9f9('0x30')](util[_0xa9f9('0x19')](_0xa9f9('0x31'),QUERY,_0x2a5d5c,_0x303b5f),{'type':dbH[_0xa9f9('0x2f')][_0xa9f9('0x32')]['SELECT']}));}}}else{_0x5b55e3['push'](dbH[_0xa9f9('0x2f')][_0xa9f9('0x30')](QUERY,{'type':dbH[_0xa9f9('0x2f')][_0xa9f9('0x32')][_0xa9f9('0x33')]}));}var _0x42bae6=path['dirname'](PATH);var _0x2d6488=path[_0xa9f9('0x34')](PATH,_0xa9f9('0x35'));var _0x47a2a6=_0x2d9f59[_0xa9f9('0x2a')]&&_0x5b55e3[_0xa9f9('0x12')]>0x1;var _0x383d2a=[];if(!fs[_0xa9f9('0x36')](path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488))&&_0x47a2a6){fs[_0xa9f9('0x38')](path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488));}return BPromise[_0xa9f9('0x39')](_0x5b55e3,function(_0x3755f1){_0x383d2a[_0xa9f9('0x14')](_0x3755f1);})[_0xa9f9('0x2c')](function(){var _0x4b8dbf=[];for(var _0x4a455b=0x0;_0x4a455b<_0x383d2a[_0xa9f9('0x12')];_0x4a455b+=0x1){var _0x427711=_0x383d2a[_0x4a455b];var _0x1be7ce=createTables(_[_0xa9f9('0x3a')](_0x427711));var _0x15e9a7;var _0x5798dd=getPDFDocDefinition(_0x1be7ce);var _0x39b1f3=getPDFPrinter();var _0x274365=_0x39b1f3[_0xa9f9('0x3b')](_0x5798dd);if(_0x47a2a6){_0x15e9a7=path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488,util[_0xa9f9('0x19')](_0xa9f9('0x3c'),_0x2d6488,_0x4a455b,_0xa9f9('0x3d')));}else{_0x15e9a7=path[_0xa9f9('0x37')](_0x42bae6,util[_0xa9f9('0x19')](_0xa9f9('0x3e'),_0x2d6488,_0xa9f9('0x3d')));}_0x4b8dbf[_0xa9f9('0x14')](writePDFDocument(_0x274365,_0x15e9a7));}return Promise[_0xa9f9('0x3f')](_0x4b8dbf);})[_0xa9f9('0x2c')](function(){if(_0x47a2a6){return new Promise(function(_0x2ea587){zipdir(path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488),{'saveTo':path['join'](_0x42bae6,util[_0xa9f9('0x19')](_0xa9f9('0x3e'),_0x2d6488,_0xa9f9('0x40')))},function(){rimraf(path['join'](_0x42bae6,_0x2d6488),function(){});_0x2ea587(_0xa9f9('0x41'));});});}})[_0xa9f9('0x2c')](function(){if(!_0x47a2a6)return;rimraf(path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488),function(){});})[_0xa9f9('0x2c')](function(){logger[_0xa9f9('0x42')](util[_0xa9f9('0x19')](_0xa9f9('0x43'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xa9f9('0x44'),_0x47a2a6?util[_0xa9f9('0x19')]('%s.%s',_0x2d6488,_0x47a2a6?_0xa9f9('0x40'):_0xa9f9('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa9f9('0x42')](util[_0xa9f9('0x19')](_0xa9f9('0x45'),EXTRACTED_REPORT_ID,_0xa9f9('0x46')));return db[_0xa9f9('0xc')][_0xa9f9('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa9f9('0x2c')](function(_0x1095f8){EXTRACTED_REPORT=_0x1095f8;return dbH[_0xa9f9('0x2f')][_0xa9f9('0x30')](util[_0xa9f9('0x19')](_0xa9f9('0x48'),QUERY),{'type':dbH['sequelize'][_0xa9f9('0x32')][_0xa9f9('0x33')]});})[_0xa9f9('0x2c')](extractReport)[_0xa9f9('0x49')](function(_0x36b34f){logger[_0xa9f9('0x42')](util[_0xa9f9('0x19')](_0xa9f9('0x4a'),EXTRACTED_REPORT_ID,_0xa9f9('0x46')),util['inspect'](_0x36b34f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa9f9('0x4b')](function(){process[_0xa9f9('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5b232e=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xa9f9('0x4d'),'italics':__dirname+_0xa9f9('0x4e'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x5b232e;}function getPDFDocDefinitionFromHTML(_0x107c10,_0xd120a0){var _0x4f8192=util[_0xa9f9('0x19')](_0xa9f9('0x4f'),_0xd120a0['channel'],_0xd120a0[_0xa9f9('0x50')]);var _0x11a5b8=moment()[_0xa9f9('0x19')]('YYYY-MM-DD')[_0xa9f9('0x21')]();var _0x1e8179=htmlToPdfmake(_0x107c10,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1e8179],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa9f9('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa9f9('0x51')}},'header':function(){return[{'text':_0xa9f9('0x52'),'style':'header'}];},'footer':function(_0x19fdad,_0x5d0ae3){return[{'text':util[_0xa9f9('0x19')](_0xa9f9('0x53'),_0x4f8192,_0x19fdad,_0x5d0ae3,_0x11a5b8),'style':_0xa9f9('0x22')}];}};}function writePDFDocument(_0x195f44,_0x1f876f){return new Promise(function(_0x44d355,_0x21bbd6){var _0x1bcdc1=_0x195f44['pipe'](fs[_0xa9f9('0x54')](_0x1f876f));_0x1bcdc1['on'](_0xa9f9('0x55'),function(){_0x44d355('finish');});_0x1bcdc1['on']('error',function(_0x7ac7d3){_0x21bbd6(_0x7ac7d3);});_0x195f44[_0xa9f9('0x56')]();});}exports['createPdfFromHTML']=function(_0xc53407,_0x2ecf0c){var _0x272a15=getPDFPrinter();var _0xa89d54=getPDFDocDefinitionFromHTML(_0xc53407,_0x2ecf0c);var _0xec269=_0x272a15['createPdfKitDocument'](_0xa89d54);return writePDFDocument(_0xec269,_0x2ecf0c['path'])['catch'](function(_0x428319){throw _0x428319;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d9b8898..afac2ef 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 _0xdf65=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','Failed','finally','exit','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','info'];(function(_0xbd0dcd,_0x1e9231){var _0x271a9e=function(_0x4dd3cb){while(--_0x4dd3cb){_0xbd0dcd['push'](_0xbd0dcd['shift']());}};_0x271a9e(++_0x1e9231);}(_0xdf65,0x6e));var _0x5df6=function(_0x1abdde,_0x200a7e){_0x1abdde=_0x1abdde-0x0;var _0x112a5a=_0xdf65[_0x1abdde];return _0x112a5a;};'use strict';var util=require('util');var path=require('path');var _=require(_0x5df6('0x0'));var fs=require('fs');var json2xls=require(_0x5df6('0x1'));var BPromise=require('bluebird');var zipdir=require(_0x5df6('0x2'));var rimraf=require(_0x5df6('0x3'));var db=require(_0x5df6('0x4'))['db'];var dbH=require('../../mysqldb')[_0x5df6('0x5')];var logger=require(_0x5df6('0x6'))(_0x5df6('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x5df6('0x8')][0x2]);var QUERY=process[_0x5df6('0x8')][0x3];var PATH=process[_0x5df6('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x38a6a8,_0x11e92d){var _0x205182={'status':_0x38a6a8};var _0x4d5fff={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11e92d){_0x205182['savename']=_0x11e92d;}return db[_0x5df6('0x9')][_0x5df6('0xa')](_0x205182,_0x4d5fff);}function main(){var _0x466759=0x1388;var _0x3ec257;logger['info'](util[_0x5df6('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x5df6('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5df6('0xd'),_0x5df6('0xe')]})['then'](function(_0x38dc63){if(_0x38dc63){_0x3ec257=_0x38dc63;_0x466759=_0x3ec257[_0x5df6('0xe')]||0x1388;}})[_0x5df6('0xf')](function(){return dbH[_0x5df6('0x10')][_0x5df6('0x11')](util[_0x5df6('0xb')](_0x5df6('0x12'),QUERY),{'type':dbH[_0x5df6('0x10')][_0x5df6('0x13')][_0x5df6('0x14')]});})[_0x5df6('0xf')](function(_0x357028){if(!_0x357028[0x0][_0x5df6('0x15')]){return analyticExtractedReport(_0x5df6('0x16'));}var _0x1e2dcf=[];var _0x52fc11=0x0;if(_0x3ec257[_0x5df6('0xd')]){if(_0x357028&&_0x357028[_0x5df6('0x17')]){var _0x1ec801=_[_0x5df6('0x18')](_0x357028[0x0][_0x5df6('0x15')]/_0x466759);var _0x3f0768=Number[_0x5df6('0x19')](_0x357028[0x0][_0x5df6('0x15')]/_0x466759)?_0x357028[0x0][_0x5df6('0x15')]%_0x466759:0x0;_0x1ec801[_0x5df6('0x1a')](function(_0x29ab31){if(_0x29ab31>0x0){_0x52fc11+=_0x466759;}_0x1e2dcf[_0x5df6('0x1b')](dbH[_0x5df6('0x10')]['query'](util[_0x5df6('0xb')](_0x5df6('0x1c'),QUERY,_0x466759,_0x52fc11),{'type':dbH[_0x5df6('0x10')][_0x5df6('0x13')][_0x5df6('0x14')]}));});if(_0x3f0768>0x0){_0x52fc11+=_0x466759;_0x1e2dcf['push'](dbH[_0x5df6('0x10')]['query'](util[_0x5df6('0xb')](_0x5df6('0x1c'),QUERY,_0x3f0768,_0x52fc11),{'type':dbH[_0x5df6('0x10')][_0x5df6('0x13')][_0x5df6('0x14')]}));}}}else{_0x1e2dcf[_0x5df6('0x1b')](dbH[_0x5df6('0x10')][_0x5df6('0x11')](QUERY,{'type':dbH[_0x5df6('0x10')][_0x5df6('0x13')][_0x5df6('0x14')]}));}var _0x6fee24=path[_0x5df6('0x1d')](PATH);var _0x5f28c2=path[_0x5df6('0x1e')](PATH,_0x5df6('0x1f'));var _0x1cc801=_0x3ec257[_0x5df6('0xd')]&&_0x1e2dcf['length']>0x1;var _0x24f8f0=[];if(!fs[_0x5df6('0x20')](path[_0x5df6('0x21')](_0x6fee24,_0x5f28c2))&&_0x1cc801){fs[_0x5df6('0x22')](path[_0x5df6('0x21')](_0x6fee24,_0x5f28c2));}return BPromise[_0x5df6('0x23')](_0x1e2dcf,function(_0x1d496d){_0x24f8f0[_0x5df6('0x1b')](_0x1d496d);})[_0x5df6('0xf')](function(){for(var _0x1f8298=0x0;_0x1f8298<_0x24f8f0[_0x5df6('0x17')];_0x1f8298+=0x1){var _0x46e5c5;var _0x5021ee=_0x24f8f0[_0x1f8298];if(_0x1cc801){_0x46e5c5=path[_0x5df6('0x21')](_0x6fee24,_0x5f28c2,util[_0x5df6('0xb')](_0x5df6('0x24'),_0x5f28c2,_0x1f8298,_0x5df6('0x25')));}else{_0x46e5c5=path[_0x5df6('0x21')](_0x6fee24,util[_0x5df6('0xb')](_0x5df6('0x26'),_0x5f28c2,_0x5df6('0x25')));}fs[_0x5df6('0x27')](_0x46e5c5,json2xls(_0x5021ee),_0x5df6('0x28'));}})[_0x5df6('0xf')](function(){if(_0x1cc801){return new Promise(function(_0x4b75f6){zipdir(path[_0x5df6('0x21')](_0x6fee24,_0x5f28c2),{'saveTo':path[_0x5df6('0x21')](_0x6fee24,util[_0x5df6('0xb')]('%s.%s',_0x5f28c2,_0x5df6('0x29')))},function(_0x2596e2,_0x5a8274){rimraf(path[_0x5df6('0x21')](_0x6fee24,_0x5f28c2),function(){});_0x4b75f6(_0x5df6('0x2a'));});});}})[_0x5df6('0xf')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x5df6('0x2b'),_0x1cc801?util['format'](_0x5df6('0x26'),_0x5f28c2,_0x1cc801?_0x5df6('0x29'):_0x5df6('0x25')):null);});})[_0x5df6('0x2c')](function(_0x5c2212){logger[_0x5df6('0x2d')](util['format'](_0x5df6('0x2e'),EXTRACTED_REPORT_ID,_0x5df6('0x2f')),util[_0x5df6('0x30')](_0x5c2212,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5df6('0x31'));})[_0x5df6('0x32')](function(){process[_0x5df6('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb5a4=['isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','XLSX','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','length','range','num'];(function(_0x19da4d,_0x260981){var _0xc71c77=function(_0x4edb82){while(--_0x4edb82){_0x19da4d['push'](_0x19da4d['shift']());}};_0xc71c77(++_0x260981);}(_0xb5a4,0x17d));var _0x4b5a=function(_0x445562,_0x34806c){_0x445562=_0x445562-0x0;var _0x55cb1e=_0xb5a4[_0x445562];return _0x55cb1e;};'use strict';var util=require('util');var path=require(_0x4b5a('0x0'));var _=require(_0x4b5a('0x1'));var fs=require('fs');var json2xls=require(_0x4b5a('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x4b5a('0x3'));var rimraf=require(_0x4b5a('0x4'));var db=require(_0x4b5a('0x5'))['db'];var dbH=require(_0x4b5a('0x5'))[_0x4b5a('0x6')];var logger=require(_0x4b5a('0x7'))(_0x4b5a('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x4b5a('0x9')][0x2]);var QUERY=process[_0x4b5a('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b3d11,_0xa18b37){var _0x6be522={'status':_0x2b3d11};var _0x30fada={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa18b37){_0x6be522[_0x4b5a('0xa')]=_0xa18b37;}return db[_0x4b5a('0xb')][_0x4b5a('0xc')](_0x6be522,_0x30fada);}function main(){var _0x10e9ac=0x1388;var _0x5b8213;logger[_0x4b5a('0xd')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4b5a('0xe')));return db['Setting'][_0x4b5a('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4b5a('0x10'),_0x4b5a('0x11')]})['then'](function(_0x4f7256){if(_0x4f7256){_0x5b8213=_0x4f7256;_0x10e9ac=_0x5b8213[_0x4b5a('0x11')]||0x1388;}})[_0x4b5a('0x12')](function(){return dbH[_0x4b5a('0x13')][_0x4b5a('0x14')](util[_0x4b5a('0x15')](_0x4b5a('0x16'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x4b5a('0x17')]});})[_0x4b5a('0x12')](function(_0x307876){if(!_0x307876[0x0]['num']){return analyticExtractedReport('Empty');}var _0x240552=[];var _0x4fc505=0x0;if(_0x5b8213[_0x4b5a('0x10')]){if(_0x307876&&_0x307876[_0x4b5a('0x18')]){var _0x4f95e2=_[_0x4b5a('0x19')](_0x307876[0x0][_0x4b5a('0x1a')]/_0x10e9ac);var _0x1b1840=Number[_0x4b5a('0x1b')](_0x307876[0x0][_0x4b5a('0x1a')]/_0x10e9ac)?_0x307876[0x0]['num']%_0x10e9ac:0x0;_0x4f95e2['forEach'](function(_0x5b9415){if(_0x5b9415>0x0){_0x4fc505+=_0x10e9ac;}_0x240552[_0x4b5a('0x1c')](dbH[_0x4b5a('0x13')][_0x4b5a('0x14')](util[_0x4b5a('0x15')](_0x4b5a('0x1d'),QUERY,_0x10e9ac,_0x4fc505),{'type':dbH['sequelize'][_0x4b5a('0x1e')][_0x4b5a('0x17')]}));});if(_0x1b1840>0x0){_0x4fc505+=_0x10e9ac;_0x240552[_0x4b5a('0x1c')](dbH[_0x4b5a('0x13')]['query'](util[_0x4b5a('0x15')](_0x4b5a('0x1d'),QUERY,_0x1b1840,_0x4fc505),{'type':dbH[_0x4b5a('0x13')]['QueryTypes'][_0x4b5a('0x17')]}));}}}else{_0x240552[_0x4b5a('0x1c')](dbH[_0x4b5a('0x13')][_0x4b5a('0x14')](QUERY,{'type':dbH[_0x4b5a('0x13')]['QueryTypes'][_0x4b5a('0x17')]}));}var _0x9bcf2=path[_0x4b5a('0x1f')](PATH);var _0x5b4da9=path[_0x4b5a('0x20')](PATH,_0x4b5a('0x21'));var _0x49887a=_0x5b8213[_0x4b5a('0x10')]&&_0x240552[_0x4b5a('0x18')]>0x1;var _0x561f0f=[];if(!fs[_0x4b5a('0x22')](path[_0x4b5a('0x23')](_0x9bcf2,_0x5b4da9))&&_0x49887a){fs[_0x4b5a('0x24')](path[_0x4b5a('0x23')](_0x9bcf2,_0x5b4da9));}return BPromise[_0x4b5a('0x25')](_0x240552,function(_0x245054){_0x561f0f['push'](_0x245054);})['then'](function(){for(var _0x41ba9e=0x0;_0x41ba9e<_0x561f0f[_0x4b5a('0x18')];_0x41ba9e+=0x1){var _0x3b2ba5;var _0x51c187=_0x561f0f[_0x41ba9e];if(_0x49887a){_0x3b2ba5=path['join'](_0x9bcf2,_0x5b4da9,util[_0x4b5a('0x15')](_0x4b5a('0x26'),_0x5b4da9,_0x41ba9e,_0x4b5a('0x27')));}else{_0x3b2ba5=path['join'](_0x9bcf2,util['format']('%s.%s',_0x5b4da9,_0x4b5a('0x27')));}fs[_0x4b5a('0x28')](_0x3b2ba5,json2xls(_0x51c187),_0x4b5a('0x29'));}})[_0x4b5a('0x12')](function(){if(_0x49887a){return new Promise(function(_0x2f9507){zipdir(path[_0x4b5a('0x23')](_0x9bcf2,_0x5b4da9),{'saveTo':path[_0x4b5a('0x23')](_0x9bcf2,util[_0x4b5a('0x15')]('%s.%s',_0x5b4da9,_0x4b5a('0x2a')))},function(_0x2a0d84,_0x16e7a8){rimraf(path[_0x4b5a('0x23')](_0x9bcf2,_0x5b4da9),function(){});_0x2f9507(_0x4b5a('0x2b'));});});}})[_0x4b5a('0x12')](function(){logger[_0x4b5a('0xd')](util[_0x4b5a('0x15')](_0x4b5a('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x4b5a('0x2d'),_0x49887a?util[_0x4b5a('0x15')](_0x4b5a('0x2e'),_0x5b4da9,_0x49887a?'zip':'xlsx'):null);});})[_0x4b5a('0x2f')](function(_0x5b38a0){logger['info'](util[_0x4b5a('0x15')](_0x4b5a('0x30'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x5b38a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4b5a('0x31')](function(){process[_0x4b5a('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 e892886..9ae792d 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 _0x5173=['appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','catch','rewrite','util','Interval','then','models','VoiceExtension','findAll','IntervalId','uniq','map','exten','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','length','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase'];(function(_0x30bdff,_0x308063){var _0x1e7ca9=function(_0x1a6e16){while(--_0x1a6e16){_0x30bdff['push'](_0x30bdff['shift']());}};_0x1e7ca9(++_0x308063);}(_0x5173,0x9a));var _0x3517=function(_0x7106f,_0x3198a8){_0x7106f=_0x7106f-0x0;var _0x4eb56a=_0x5173[_0x7106f];return _0x4eb56a;};'use strict';var _=require('lodash');var util=require(_0x3517('0x0'));function rewrite(_0x42a62,_0x3e78f3){var _0x239d9c=this;return _0x42a62['models'][_0x3517('0x1')]['findAll']({'raw':!![]})[_0x3517('0x2')](function(_0x3c69b0){_0x239d9c['intervals']=_0x3c69b0;return _0x42a62[_0x3517('0x3')][_0x3517('0x4')][_0x3517('0x5')]({'where':{'IntervalId':_0x3e78f3[_0x3517('0x6')]},'raw':!![]});})[_0x3517('0x2')](function(_0x13353a){return _0x42a62['models'][_0x3517('0x4')]['findAll']({'where':{'exten':{'$in':_[_0x3517('0x7')](_[_0x3517('0x8')](_0x13353a,_0x3517('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x3517('0x2')](function(_0x5d6d7c){var _0x42c85b=_[_0x3517('0xa')](_0x5d6d7c,{'priority':'1'});var _0x4044bd=_[_0x3517('0xa')](_0x5d6d7c,{'isApp':0x1});var _0x1fa08f=_[_0x3517('0xb')](_0x4044bd,'exten');var _0x493848=[_0x3517('0xc'),'playback'];var _0xb9c3df=[];var _0x566a00=[];for(var _0x2a6e41 in _0x1fa08f){if(_0x1fa08f[_0x3517('0xd')](_0x2a6e41)){_0x239d9c[_0x3517('0xe')]=0x2;_0x239d9c[_0x3517('0xf')]=[];_0x239d9c[_0x3517('0x10')]=_['find'](_0x42c85b,{'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')]});_0x239d9c['extensions'][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':_0x3517('0x13'),'appdata':util[_0x3517('0x14')](_0x3517('0x15'),_0x1fa08f[_0x2a6e41][0x0]['type']),'context':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x16')],'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')],'priority':_0x239d9c[_0x3517('0xe')]++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});if(_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')]===_0x3517('0x18')){_0x239d9c[_0x3517('0xf')][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':_0x3517('0x13'),'appdata':_0x3517('0x19')+_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')],'context':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x16')],'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')],'priority':_0x239d9c[_0x3517('0xe')]++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0]['VoiceExtensionId']});}else if(_0x1fa08f[_0x2a6e41][0x0]['type']===_0x3517('0x1a')){if(_0x239d9c['extension']){_0x239d9c[_0x3517('0xf')][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':_0x3517('0x13'),'appdata':_0x3517('0x1b')+(_0x239d9c['extension'][_0x3517('0x1c')]?_0x3517('0x1d')+_0x239d9c[_0x3517('0x10')][_0x3517('0x1c')]+'}':'${EXTEN}'),'context':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x16')],'exten':_0x1fa08f[_0x2a6e41][0x0]['exten'],'priority':_0x239d9c[_0x3517('0xe')]++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});}_0x239d9c[_0x3517('0xf')]['push']({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':'Set','appdata':_0x3517('0x19')+_0x1fa08f[_0x2a6e41][0x0]['VoiceExtensionId'],'context':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x16')],'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')],'priority':_0x239d9c['priority']++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0]['VoiceExtensionId']});var _0x1d218e=_0x239d9c[_0x3517('0xe')]++;_0x239d9c[_0x3517('0xf')]['push']({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':'ExecIf','appdata':_0x3517('0x1e')+(_0x1d218e+0x2)+_0x3517('0x1f')+(_0x1d218e+0x1)+')','context':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x16')],'exten':_0x1fa08f[_0x2a6e41][0x0]['exten'],'priority':_0x1d218e,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});if(_0x239d9c[_0x3517('0x10')]){_0x239d9c[_0x3517('0xf')][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':_0x3517('0x13'),'appdata':_0x239d9c['extension'][_0x3517('0x1c')]?_0x3517('0x20')+_0x239d9c[_0x3517('0x10')]['cutdigits']+'}':_0x3517('0x21'),'context':_0x1fa08f[_0x2a6e41][0x0]['context'],'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')],'priority':_0x239d9c[_0x3517('0xe')]++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});}_0x239d9c[_0x3517('0xf')][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0]['type'],'app':_0x3517('0x13'),'appdata':_0x3517('0x22')+_0x1fa08f[_0x2a6e41][0x0]['VoiceExtensionId'],'context':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x16')],'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')],'priority':_0x239d9c['priority']++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});if(_0x239d9c['extension']&&_0x239d9c['extension'][_0x3517('0xd')](_0x3517('0x23'))&&_0x239d9c['extension'][_0x3517('0x23')]!==_0x3517('0x24')){_0x239d9c[_0x3517('0xf')][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':'Set','appdata':_0x3517('0x25'),'context':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x16')],'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')],'priority':_0x239d9c[_0x3517('0xe')]++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0]['VoiceExtensionId']});_0x239d9c[_0x3517('0xf')][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':_0x3517('0x13'),'appdata':_0x3517('0x26')+_0x239d9c[_0x3517('0x10')][_0x3517('0x23')]||_0x3517('0x27'),'context':_0x1fa08f[_0x2a6e41][0x0]['context'],'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')],'priority':_0x239d9c[_0x3517('0xe')]++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});}}_0x239d9c[_0x3517('0xf')][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':_0x3517('0x13'),'appdata':_0x3517('0x28'),'context':_0x1fa08f[_0x2a6e41][0x0]['context'],'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')],'priority':_0x239d9c[_0x3517('0xe')]++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});_0x239d9c[_0x3517('0xf')][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':_0x3517('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x16')],'exten':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x9')],'priority':_0x239d9c[_0x3517('0xe')]++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0]['VoiceExtensionId']});_0x239d9c['extensions'][_0x3517('0x11')]({'type':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x12')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1fa08f[_0x2a6e41][0x0]['context'],'exten':_0x1fa08f[_0x2a6e41][0x0]['exten'],'priority':_0x239d9c[_0x3517('0xe')]++,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});for(var _0x2b0893=0x0,_0xffed4e=0x0;_0x2b0893<_0x1fa08f[_0x2a6e41][_0x3517('0x29')];_0x2b0893+=0x1,_0xffed4e=0x0){var _0x2f6cbf=_0x1fa08f[_0x2a6e41][_0x2b0893];if(_0x2f6cbf[_0x3517('0x12')]){_0x2f6cbf[_0x3517('0x12')]=_0x2f6cbf[_0x3517('0x12')]['toLowerCase']();}var _0x14cf19=[];var _0x4d61ca=[];delete _0x2f6cbf['id'];delete _0x2f6cbf[_0x3517('0x2a')];delete _0x2f6cbf[_0x3517('0x2b')];var _0x4c29f8=_0x2f6cbf[_0x3517('0x2c')]!==_0x3517('0x2d')?[_0x2f6cbf['interval']]:_0x2f6cbf['IntervalId']?_[_0x3517('0x8')](_['filter'](_0x239d9c[_0x3517('0x2e')],{'IntervalId':_0x2f6cbf[_0x3517('0x6')]}),_0x3517('0x2c')):[];if(_0x2f6cbf[_0x3517('0xd')](_0x3517('0x2f'))){if(_0x2f6cbf[_0x3517('0x2f')]&&_0x2f6cbf[_0x3517('0x2f')]!=='--'){_0x14cf19[_0x3517('0x11')]({'type':_0x2f6cbf[_0x3517('0x12')],'app':'Set','appdata':_0x3517('0x30')+_0x2f6cbf[_0x3517('0x2f')],'context':_0x2f6cbf['context'],'exten':_0x2f6cbf[_0x3517('0x9')],'priority':_0x4c29f8[_0x3517('0x29')]+_0x239d9c[_0x3517('0xe')]+_0xffed4e++,'VoiceExtensionId':_0x2f6cbf['VoiceExtensionId']});}}if(_0x2f6cbf['type']===_0x3517('0x1a')&&_0x2f6cbf['hasOwnProperty'](_0x3517('0x31'))){if(_0x2f6cbf[_0x3517('0x31')]){_0x14cf19['push']({'type':_0x2f6cbf['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2f6cbf[_0x3517('0x31')]+')','context':_0x2f6cbf[_0x3517('0x16')],'exten':_0x2f6cbf['exten'],'priority':_0x4c29f8[_0x3517('0x29')]+_0x239d9c[_0x3517('0xe')]+_0xffed4e++,'VoiceExtensionId':_0x2f6cbf[_0x3517('0x17')]});}else{_0x14cf19[_0x3517('0x11')]({'type':_0x2f6cbf[_0x3517('0x12')],'app':_0x3517('0x32'),'appdata':_0x3517('0x33'),'context':_0x2f6cbf[_0x3517('0x16')],'exten':_0x2f6cbf[_0x3517('0x9')],'priority':_0x4c29f8[_0x3517('0x29')]+_0x239d9c[_0x3517('0xe')]+_0xffed4e++,'VoiceExtensionId':_0x2f6cbf[_0x3517('0x17')]});}}if(_0x2f6cbf[_0x3517('0xd')](_0x3517('0x34'))){if(_0x493848[_0x3517('0x35')](_0x2f6cbf[_0x3517('0x36')][_0x3517('0x37')]())>=0x0&&_0x2f6cbf[_0x3517('0x38')]!==_0x3517('0x39')){if(_0x2f6cbf[_0x3517('0x34')]){_0x14cf19['push']({'type':_0x2f6cbf['type'],'app':_0x3517('0x32'),'appdata':_0x3517('0x3a'),'context':_0x2f6cbf[_0x3517('0x16')],'exten':_0x2f6cbf[_0x3517('0x9')],'priority':_0x4c29f8[_0x3517('0x29')]+_0x239d9c['priority']+_0xffed4e++,'VoiceExtensionId':_0x2f6cbf['VoiceExtensionId']});_0x14cf19[_0x3517('0x11')]({'type':_0x2f6cbf['type'],'app':_0x3517('0x13'),'appdata':_0x3517('0x3b'),'context':_0x2f6cbf[_0x3517('0x16')],'exten':_0x2f6cbf[_0x3517('0x9')],'priority':_0x4c29f8[_0x3517('0x29')]+_0x239d9c[_0x3517('0xe')]+_0xffed4e++,'VoiceExtensionId':_0x2f6cbf['VoiceExtensionId']});}else{_0x14cf19[_0x3517('0x11')]({'type':_0x2f6cbf['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2f6cbf[_0x3517('0x16')],'exten':_0x2f6cbf[_0x3517('0x9')],'priority':_0x4c29f8[_0x3517('0x29')]+_0x239d9c[_0x3517('0xe')]+_0xffed4e++,'VoiceExtensionId':_0x2f6cbf[_0x3517('0x17')]});_0x14cf19[_0x3517('0x11')]({'type':_0x2f6cbf[_0x3517('0x12')],'app':_0x3517('0x13'),'appdata':_0x3517('0x3c'),'context':_0x2f6cbf[_0x3517('0x16')],'exten':_0x2f6cbf['exten'],'priority':_0x4c29f8[_0x3517('0x29')]+_0x239d9c[_0x3517('0xe')]+_0xffed4e++,'VoiceExtensionId':_0x2f6cbf[_0x3517('0x17')]});}}}for(var _0x2c1fc3=0x0;_0x2c1fc3<_0x4c29f8[_0x3517('0x29')];_0x2c1fc3+=0x1){var _0x568b9a=_0x239d9c[_0x3517('0xe')]+_0x4c29f8[_0x3517('0x29')];var _0x45d32e=_0x2c1fc3===_0x4c29f8[_0x3517('0x29')]-0x1?_0x239d9c[_0x3517('0xe')]+_0x14cf19[_0x3517('0x29')]+_0x4d61ca[_0x3517('0x29')]+0x2:_0x239d9c[_0x3517('0xe')]+_0x2c1fc3+0x1;_0x14cf19[_0x3517('0x3d')](_0x2c1fc3,0x0,{'type':_0x2f6cbf[_0x3517('0x12')],'app':_0x3517('0x3e'),'appdata':_0x4c29f8[_0x2c1fc3]+'?'+_0x2f6cbf[_0x3517('0x16')]+_0x3517('0x3f')+_0x568b9a+':'+_0x2f6cbf[_0x3517('0x16')]+_0x3517('0x3f')+_0x45d32e,'exten':_0x2f6cbf['exten'],'context':_0x2f6cbf['context'],'priority':_0x239d9c[_0x3517('0xe')]+_0x2c1fc3,'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});}_0x2f6cbf[_0x3517('0xe')]=_0x14cf19[_0x3517('0x29')]?_[_0x3517('0x40')](_0x14cf19)['priority']+0x1:_0x239d9c[_0x3517('0xe')];_0x239d9c[_0x3517('0xe')]=(_0x4d61ca[_0x3517('0x29')]?_[_0x3517('0x40')](_0x4d61ca)[_0x3517('0xe')]:_0x2f6cbf[_0x3517('0xe')])+0x1;_0x239d9c[_0x3517('0xf')]=_[_0x3517('0x41')](_0x239d9c[_0x3517('0xf')],_0x14cf19,[_0x2f6cbf],_0x4d61ca);}_0x239d9c[_0x3517('0xf')]['push']({'type':_0x1fa08f[_0x2a6e41][0x0]['type'],'app':'Hangup','exten':_0x1fa08f[_0x2a6e41][0x0]['exten'],'context':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x16')],'priority':_0x239d9c[_0x3517('0xe')],'VoiceExtensionId':_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]});_0xb9c3df['push'](_0x1fa08f[_0x2a6e41][0x0][_0x3517('0x17')]);_0x566a00=_[_0x3517('0x41')](_0x566a00,_0x239d9c['extensions']);}}return _0x42a62[_0x3517('0x42')](function(_0x1201b3){return _0x42a62[_0x3517('0x3')][_0x3517('0x4')][_0x3517('0x43')]({'where':{'VoiceExtensionId':{'$in':_0xb9c3df}},'transaction':_0x1201b3})['then'](function(_0x2fc75c){return _0x42a62['models'][_0x3517('0x4')]['bulkCreate'](_['sortBy'](_0x566a00,'priority'),{'transaction':_0x1201b3});});});})[_0x3517('0x44')](function(_0x1f8e4e){console['error'](_0x1f8e4e);});}exports[_0x3517('0x45')]=rewrite; \ No newline at end of file +var _0x4eb1=['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)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','error','rewrite','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','priority','extension','extensions','Set','format','type','VoiceExtensionId','CDR(routeid)=','context','outbound','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid='];(function(_0x5abe2d,_0x2e77fa){var _0x14d094=function(_0x441c92){while(--_0x441c92){_0x5abe2d['push'](_0x5abe2d['shift']());}};_0x14d094(++_0x2e77fa);}(_0x4eb1,0xa5));var _0x14eb=function(_0x2745ac,_0x293a2a){_0x2745ac=_0x2745ac-0x0;var _0x1d9d0e=_0x4eb1[_0x2745ac];return _0x1d9d0e;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x3285f9,_0x15297a){var _0x20ae0d=this;return _0x3285f9['models']['Interval'][_0x14eb('0x0')]({'raw':!![]})[_0x14eb('0x1')](function(_0x1852b1){_0x20ae0d[_0x14eb('0x2')]=_0x1852b1;return _0x3285f9[_0x14eb('0x3')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x15297a[_0x14eb('0x4')]},'raw':!![]});})[_0x14eb('0x1')](function(_0x24b56d){return _0x3285f9[_0x14eb('0x3')][_0x14eb('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x14eb('0x6')](_['map'](_0x24b56d,_0x14eb('0x7')))}},'order':[{'raw':_0x14eb('0x8')}],'raw':!![]});})['then'](function(_0x3d6ef4){var _0x9ca2cb=_[_0x14eb('0x9')](_0x3d6ef4,{'priority':'1'});var _0x53fa6f=_[_0x14eb('0x9')](_0x3d6ef4,{'isApp':0x1});var _0xe0b66f=_[_0x14eb('0xa')](_0x53fa6f,_0x14eb('0x7'));var _0x558992=['queue','playback'];var _0x2fd189=[];var _0xa1dd38=[];for(var _0x2f74d3 in _0xe0b66f){if(_0xe0b66f[_0x14eb('0xb')](_0x2f74d3)){_0x20ae0d[_0x14eb('0xc')]=0x2;_0x20ae0d['extensions']=[];_0x20ae0d[_0x14eb('0xd')]=_['find'](_0x9ca2cb,{'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')]});_0x20ae0d[_0x14eb('0xe')]['push']({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0xf'),'appdata':util[_0x14eb('0x10')]('CDR(type)=%s',_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')]),'context':_0xe0b66f[_0x2f74d3][0x0]['context'],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});if(_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')]==='inbound'){_0x20ae0d['extensions']['push']({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':'Set','appdata':_0x14eb('0x13')+_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')],'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});}else if(_0xe0b66f[_0x2f74d3][0x0]['type']===_0x14eb('0x15')){if(_0x20ae0d[_0x14eb('0xd')]){_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x17')+(_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x18')]?_0x14eb('0x19')+_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x18')]+'}':_0x14eb('0x1a')),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0]['VoiceExtensionId']});}_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':'Set','appdata':_0x14eb('0x13')+_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')],'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0]['exten'],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0]['VoiceExtensionId']});var _0x3973a1=_0x20ae0d[_0x14eb('0xc')]++;_0x20ae0d['extensions'][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0x1b'),'appdata':_0x14eb('0x1c')+(_0x3973a1+0x2)+_0x14eb('0x1d')+(_0x3973a1+0x1)+')','context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x3973a1,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});if(_0x20ae0d[_0x14eb('0xd')]){_0x20ae0d['extensions'][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0xf'),'appdata':_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x18')]?_0x14eb('0x1e')+_0x20ae0d['extension'][_0x14eb('0x18')]+'}':_0x14eb('0x1f'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0]['VoiceExtensionId']});}_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x20')+_0xe0b66f[_0x2f74d3][0x0]['VoiceExtensionId'],'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0]['exten'],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});if(_0x20ae0d[_0x14eb('0xd')]&&_0x20ae0d['extension'][_0x14eb('0xb')](_0x14eb('0x21'))&&_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x21')]!==_0x14eb('0x22')){_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x23'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x24')+_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x21')]||_0x14eb('0x25'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});}}_0x20ae0d[_0x14eb('0xe')]['push']({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x26'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});_0x20ae0d[_0x14eb('0xe')]['push']({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x27'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x28'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d['priority']++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});for(var _0x29198d=0x0,_0x1848eb=0x0;_0x29198d<_0xe0b66f[_0x2f74d3][_0x14eb('0x29')];_0x29198d+=0x1,_0x1848eb=0x0){var _0x16c346=_0xe0b66f[_0x2f74d3][_0x29198d];if(_0x16c346[_0x14eb('0x11')]){_0x16c346['type']=_0x16c346[_0x14eb('0x11')][_0x14eb('0x2a')]();}var _0x27063a=[];var _0xda5059=[];delete _0x16c346['id'];delete _0x16c346[_0x14eb('0x2b')];delete _0x16c346[_0x14eb('0x2c')];var _0x15a60c=_0x16c346[_0x14eb('0x2d')]!=='*,*,*,*'?[_0x16c346[_0x14eb('0x2d')]]:_0x16c346[_0x14eb('0x4')]?_['map'](_[_0x14eb('0x9')](_0x20ae0d[_0x14eb('0x2')],{'IntervalId':_0x16c346[_0x14eb('0x4')]}),_0x14eb('0x2d')):[];if(_0x16c346[_0x14eb('0xb')](_0x14eb('0x2e'))){if(_0x16c346[_0x14eb('0x2e')]&&_0x16c346[_0x14eb('0x2e')]!=='--'){_0x27063a[_0x14eb('0x16')]({'type':_0x16c346[_0x14eb('0x11')],'app':'Set','appdata':_0x14eb('0x2f')+_0x16c346['tag'],'context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346['exten'],'priority':_0x15a60c['length']+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346['VoiceExtensionId']});}}if(_0x16c346[_0x14eb('0x11')]===_0x14eb('0x15')&&_0x16c346[_0x14eb('0xb')](_0x14eb('0x30'))){if(_0x16c346[_0x14eb('0x30')]){_0x27063a[_0x14eb('0x16')]({'type':_0x16c346[_0x14eb('0x11')],'app':_0x14eb('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x16c346[_0x14eb('0x30')]+')','context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c[_0x14eb('0x29')]+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346[_0x14eb('0x12')]});}else{_0x27063a[_0x14eb('0x16')]({'type':_0x16c346[_0x14eb('0x11')],'app':'ExecIf','appdata':_0x14eb('0x31'),'context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c[_0x14eb('0x29')]+_0x20ae0d['priority']+_0x1848eb++,'VoiceExtensionId':_0x16c346[_0x14eb('0x12')]});}}if(_0x16c346[_0x14eb('0xb')](_0x14eb('0x32'))){if(_0x558992[_0x14eb('0x33')](_0x16c346[_0x14eb('0x34')]['toLowerCase']())>=0x0&&_0x16c346[_0x14eb('0x35')]!==_0x14eb('0x36')){if(_0x16c346[_0x14eb('0x32')]){_0x27063a[_0x14eb('0x16')]({'type':_0x16c346['type'],'app':_0x14eb('0x1b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x16c346['context'],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c[_0x14eb('0x29')]+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346['VoiceExtensionId']});_0x27063a['push']({'type':_0x16c346[_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x37'),'context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c['length']+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346[_0x14eb('0x12')]});}else{_0x27063a[_0x14eb('0x16')]({'type':_0x16c346['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c['length']+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346[_0x14eb('0x12')]});_0x27063a[_0x14eb('0x16')]({'type':_0x16c346[_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x38'),'context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c[_0x14eb('0x29')]+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346['VoiceExtensionId']});}}}for(var _0x3247bb=0x0;_0x3247bb<_0x15a60c[_0x14eb('0x29')];_0x3247bb+=0x1){var _0x1f9c4d=_0x20ae0d[_0x14eb('0xc')]+_0x15a60c[_0x14eb('0x29')];var _0x4c8dee=_0x3247bb===_0x15a60c[_0x14eb('0x29')]-0x1?_0x20ae0d[_0x14eb('0xc')]+_0x27063a[_0x14eb('0x29')]+_0xda5059[_0x14eb('0x29')]+0x2:_0x20ae0d[_0x14eb('0xc')]+_0x3247bb+0x1;_0x27063a['splice'](_0x3247bb,0x0,{'type':_0x16c346[_0x14eb('0x11')],'app':'GotoIfTime','appdata':_0x15a60c[_0x3247bb]+'?'+_0x16c346[_0x14eb('0x14')]+_0x14eb('0x39')+_0x1f9c4d+':'+_0x16c346[_0x14eb('0x14')]+',${EXTEN},'+_0x4c8dee,'exten':_0x16c346['exten'],'context':_0x16c346[_0x14eb('0x14')],'priority':_0x20ae0d[_0x14eb('0xc')]+_0x3247bb,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});}_0x16c346[_0x14eb('0xc')]=_0x27063a[_0x14eb('0x29')]?_[_0x14eb('0x3a')](_0x27063a)['priority']+0x1:_0x20ae0d['priority'];_0x20ae0d[_0x14eb('0xc')]=(_0xda5059[_0x14eb('0x29')]?_[_0x14eb('0x3a')](_0xda5059)[_0x14eb('0xc')]:_0x16c346['priority'])+0x1;_0x20ae0d[_0x14eb('0xe')]=_[_0x14eb('0x3b')](_0x20ae0d[_0x14eb('0xe')],_0x27063a,[_0x16c346],_0xda5059);}_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0x3c'),'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'priority':_0x20ae0d[_0x14eb('0xc')],'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});_0x2fd189[_0x14eb('0x16')](_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]);_0xa1dd38=_[_0x14eb('0x3b')](_0xa1dd38,_0x20ae0d[_0x14eb('0xe')]);}}return _0x3285f9[_0x14eb('0x3d')](function(_0x2bbc62){return _0x3285f9['models'][_0x14eb('0x5')][_0x14eb('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x2fd189}},'transaction':_0x2bbc62})[_0x14eb('0x1')](function(_0x2fce72){return _0x3285f9['models'][_0x14eb('0x5')]['bulkCreate'](_[_0x14eb('0x3f')](_0xa1dd38,_0x14eb('0xc')),{'transaction':_0x2bbc62});});});})['catch'](function(_0x5a5af8){console[_0x14eb('0x40')](_0x5a5af8);});}exports[_0x14eb('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ae48f19..d8a3b4d 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 _0x618b=['where','phone\x20IS\x20NOT\x20NULL','insert','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','outbound','all','Campaign','Lists','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','finally','resume','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','pause','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','duplicate','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','NOW()','ContactId','ListId','from','cm_contacts','ListId\x20=\x20?','toString'];(function(_0x548089,_0x3d9aec){var _0x36ba08=function(_0x432e90){while(--_0x432e90){_0x548089['push'](_0x548089['shift']());}};_0x36ba08(++_0x3d9aec);}(_0x618b,0x95));var _0xb618=function(_0x4ea756,_0x41b54b){_0x4ea756=_0x4ea756-0x0;var _0x1faa00=_0x618b[_0x4ea756];return _0x1faa00;};'use strict';var BPromise=require(_0xb618('0x0'));var util=require(_0xb618('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xb618('0x2'));var Papa=require(_0xb618('0x3'));var Redis=require(_0xb618('0x4'));var db=require(_0xb618('0x5'))['db'];var config=require(_0xb618('0x6'));var logger=require(_0xb618('0x7'))(_0xb618('0x8'));config[_0xb618('0x9')]=_['defaults'](config[_0xb618('0x9')],{'host':_0xb618('0xa'),'port':0x18eb});var socket=require(_0xb618('0xb'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0xb618('0xc')](socket);try{if(!process[_0xb618('0xd')][0x2]||process['argv'][0x2]===_0xb618('0xe')||process['argv'][0x2]===_0xb618('0xf')){throw new Error(_0xb618('0x10'));}var FILEPATH=process[_0xb618('0xd')][0x2];if(!process['argv'][0x3]||process[_0xb618('0xd')][0x3]===_0xb618('0xe')||process[_0xb618('0xd')][0x3]==='null'||!process[_0xb618('0xd')][0x4]||process['argv'][0x4]===_0xb618('0xe')||process[_0xb618('0xd')][0x4]==='null'){throw new Error(_0xb618('0x11'));}var FIELDS=_[_0xb618('0x12')](process[_0xb618('0xd')][0x3][_0xb618('0x13')](','),process[_0xb618('0xd')][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0xb618('0xe')||process['argv'][0x5]===_0xb618('0xf')){throw new Error(_0xb618('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xb618('0xd')][0x6]!==_0xb618('0xe')&&process['argv'][0x6]!=='null'?process[_0xb618('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xb618('0xd')][0x7]!==_0xb618('0xe')&&process[_0xb618('0xd')][0x7]!==_0xb618('0xf')?process[_0xb618('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xb618('0xd')][0x8]===_0xb618('0xe')||process[_0xb618('0xd')][0x8]===_0xb618('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x1a1737){logger['error'](_0x1a1737);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(_0x14ed7f,_0x4e5e6e,_0xad234,_0x3c0984){var _0x37b00c={'message':_0x4e5e6e};_0x37b00c[_0x14ed7f]=!![];if(_0xad234){_0x37b00c[_0xb618('0x15')]=_0xad234;}if(_0x3c0984){_0x37b00c[_0xb618('0x16')]=_0x3c0984;}return _0x37b00c;}function isEmail(_0x3fb485){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))*$/[_0xb618('0x17')](_0x3fb485);}function checkRow(_0x488469,_0x2aab93,_0x4b7974){return new BPromise(function(_0x3c4e7d,_0x36f0b5){if(_[_0xb618('0x18')](_0x488469)){return _0x36f0b5(handleCheckRowError(_0xb618('0x19'),_0xb618('0x1a'),null,_0x4b7974));}if(_0x488469['errors']&&_0x488469[_0xb618('0x1b')][_0xb618('0x1c')]){var _0x498de3=_['map'](_0x488469['errors'],_0xb618('0x1d'))[_0xb618('0x1e')](';');return _0x36f0b5(handleCheckRowError(_0xb618('0x19'),_0x498de3,null,_0x4b7974));}var _0x3ee69c={};for(var _0x487aad in FIELDS){if(FIELDS[_0xb618('0x1f')](_0x487aad)&&FIELDS[_0x487aad]){_0x3ee69c[_0x487aad]=_0x488469[_0xb618('0x20')][0x0][FIELDS[_0x487aad]]||_0x488469[_0xb618('0x20')][0x0]['\ufeff'+FIELDS[_0x487aad]];}}if(!_0x3ee69c[_0xb618('0x21')]){return _0x36f0b5(handleCheckRowError('error',_0xb618('0x22'),null,_0x4b7974));}if(!_0x3ee69c[_0xb618('0x23')]){return _0x36f0b5(handleCheckRowError(_0xb618('0x19'),'phone\x20not\x20specified!',null,_0x4b7974));}if(_0x3ee69c['birthDate']){var _0x4233d8=moment(_0x3ee69c['birthDate'],_0xb618('0x24'));if(!_0x4233d8[_0xb618('0x25')]()){return _0x36f0b5(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4b7974));}}if(_0x3ee69c[_0xb618('0x26')]){if(!isEmail(_0x3ee69c[_0xb618('0x26')])){return _0x36f0b5(handleCheckRowError(_0xb618('0x19'),_0xb618('0x27'),null,_0x4b7974));}}_0x3ee69c['ListId']=LISTID;_0x3ee69c['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb618('0x1c')]&&_0x2aab93){var _0x3ee917={};for(var _0x471815=0x0,_0x3d4335=DUPLICATES[_0xb618('0x1c')];_0x471815<_0x3d4335;_0x471815+=0x1){_0x3ee917[DUPLICATES[_0x471815]]=_0x3ee69c[DUPLICATES[_0x471815]];}var _0x4b8fa6=_['find'](_0x2aab93,_0x3ee917);if(_0x4b8fa6){return _0x36f0b5(handleCheckRowError(_0xb618('0x28'),'Duplicate\x20Contact',_0x4b8fa6,_0x4b7974));}}return db[_0xb618('0x29')][_0xb618('0x2a')](_0x3ee69c,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3ee69c)})[_0xb618('0x2b')](function(_0x38bd71){if(DUPLICATES&&DUPLICATES['length']&&_0x2aab93){_0x2aab93[_0xb618('0x2c')](_[_0xb618('0x2d')](_0x3ee69c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x38bd71['id'];return _0x3c4e7d();})[_0xb618('0x2e')](function(_0x2a10c5){return _0x36f0b5(handleCheckRowError(_0xb618('0x19'),_0xb618('0x2f')+(_0x2a10c5[_0xb618('0x1d')]||JSON[_0xb618('0x30')](_0x2a10c5)),null,_0x4b7974));});});}function checkHopper(){function _0x5482f7(){return function(_0x2b70c2){logger[_0xb618('0x19')](_0xb618('0x31'),_0xb618('0x32'),util[_0xb618('0x33')](_0x2b70c2,{'showHidden':![],'depth':null}));};}var _0x4b4de0=function(_0x1a1e3b,_0x428864){var _0x44aab9=squel['insert']()[_0xb618('0x34')](_0xb618('0x35'))[_0xb618('0x36')](['phone',_0xb618('0x37'),'ContactId','ListId',_0x428864,_0xb618('0x38'),_0xb618('0x39')],squel[_0xb618('0x3a')]()['field']('phone',_0xb618('0x23'))[_0xb618('0x3b')](_0xb618('0x3c'),'scheduledAt')[_0xb618('0x3b')]('id',_0xb618('0x3d'))[_0xb618('0x3b')](LISTID['toString'](),_0xb618('0x3e'))['field'](_0x1a1e3b['id']['toString'](),_0x428864)['field'](_0xb618('0x3c'),_0xb618('0x38'))[_0xb618('0x3b')]('NOW()',_0xb618('0x39'))[_0xb618('0x3f')](_0xb618('0x40'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xb618('0x41'),LISTID[_0xb618('0x42')]())[_0xb618('0x43')](_0xb618('0x44'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xb618('0x3a')]()[_0xb618('0x3b')](_0xb618('0x23'))[_0xb618('0x3f')](_0xb618('0x35'))['where'](_0x428864+'\x20=\x20?',_0x1a1e3b['id']['toString']())))['toString']();return _0x44aab9;};var _0x174e15=function(_0x24459b,_0x510427){var _0x38b7cf=squel[_0xb618('0x45')]()[_0xb618('0x34')](_0xb618('0x35'))[_0xb618('0x36')]([_0xb618('0x23'),_0xb618('0x37'),_0xb618('0x3d'),_0xb618('0x3e'),_0x510427,_0xb618('0x38'),_0xb618('0x39')],squel['select']()['field'](_0xb618('0x23'),_0xb618('0x23'))['field'](_0xb618('0x3c'),_0xb618('0x37'))[_0xb618('0x3b')]('id',_0xb618('0x3d'))[_0xb618('0x3b')](LISTID['toString'](),'ListId')['field'](_0x24459b['id'][_0xb618('0x42')](),_0x510427)['field'](_0xb618('0x3c'),_0xb618('0x38'))['field'](_0xb618('0x3c'),_0xb618('0x39'))[_0xb618('0x3f')]('cm_contacts')['where'](_0xb618('0x46'))['where'](_0xb618('0x41'),LISTID[_0xb618('0x42')]())[_0xb618('0x43')](_0xb618('0x47'),squel[_0xb618('0x48')](hopperContacts))[_0xb618('0x43')](_0xb618('0x44'))[_0xb618('0x43')](_0xb618('0x49'),squel[_0xb618('0x3a')]()[_0xb618('0x3b')](_0xb618('0x4a'))[_0xb618('0x3f')]('cm_hopper_final')['where'](_0x510427+_0xb618('0x4b'),_0x24459b['id'][_0xb618('0x42')]()))[_0xb618('0x43')](_0xb618('0x49'),squel[_0xb618('0x3a')]()[_0xb618('0x3b')](_0xb618('0x23'))[_0xb618('0x3f')](_0xb618('0x35'))[_0xb618('0x43')](_0x510427+_0xb618('0x4b'),_0x24459b['id']['toString']())))[_0xb618('0x42')]();return _0x38b7cf;};function _0x1c3b8a(_0x2a0505,_0x42bfd4){var _0x5af4e7=squel[_0xb618('0x45')]()[_0xb618('0x34')](_0xb618('0x35'))[_0xb618('0x36')](['phone','scheduledAt',_0xb618('0x3d'),_0xb618('0x3e'),_0x42bfd4,_0xb618('0x38'),_0xb618('0x39')],squel[_0xb618('0x3a')]()[_0xb618('0x3b')](_0xb618('0x23'),_0xb618('0x23'))[_0xb618('0x3b')](_0xb618('0x3c'),'scheduledAt')['field']('id',_0xb618('0x3d'))['field'](LISTID[_0xb618('0x42')](),_0xb618('0x3e'))[_0xb618('0x3b')](_0x2a0505['id']['toString'](),_0x42bfd4)[_0xb618('0x3b')](_0xb618('0x3c'),_0xb618('0x38'))[_0xb618('0x3b')](_0xb618('0x3c'),_0xb618('0x39'))[_0xb618('0x3f')](_0xb618('0x40'))[_0xb618('0x43')](_0xb618('0x46'))[_0xb618('0x43')](_0xb618('0x41'),LISTID['toString']())[_0xb618('0x43')](_0xb618('0x47'),squel['str'](hopperContacts))[_0xb618('0x43')](_0xb618('0x44')))[_0xb618('0x42')]();return _0x5af4e7;}function _0x5b4da6(_0x36a8f5,_0x3fe3e1){var _0x204694=squel['insert']()[_0xb618('0x34')](_0xb618('0x4c'))[_0xb618('0x36')](['phone',_0xb618('0x3d'),'ListId',_0x3fe3e1,_0xb618('0x38'),_0xb618('0x39')],squel[_0xb618('0x3a')]()[_0xb618('0x3b')](_0xb618('0x23'),_0xb618('0x23'))['field']('id','ContactId')[_0xb618('0x3b')](LISTID['toString'](),_0xb618('0x3e'))[_0xb618('0x3b')](_0x36a8f5['id'][_0xb618('0x42')](),_0x3fe3e1)[_0xb618('0x3b')](_0xb618('0x3c'),_0xb618('0x38'))[_0xb618('0x3b')](_0xb618('0x3c'),_0xb618('0x39'))[_0xb618('0x3f')](_0xb618('0x40'))[_0xb618('0x43')](_0xb618('0x46'))[_0xb618('0x43')](_0xb618('0x41'),LISTID[_0xb618('0x42')]())['where']('id\x20IN\x20?',squel[_0xb618('0x48')](hopperContacts))[_0xb618('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0xb618('0x42')]();return _0x204694;}return db[_0xb618('0x4d')][_0xb618('0x4e')]({'where':{'type':'outbound'},'attributes':['id',_0xb618('0x4f')],'include':[{'model':db[_0xb618('0x50')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x42d47a){var _0xbc2054=[];if(_0x42d47a){var _0xd6250d;for(var _0x56c611=0x0,_0x52738d;_0x56c611<_0x42d47a['length'];_0x56c611+=0x1){_0x52738d=_0x42d47a[_0x56c611][_0xb618('0x51')]({'plain':!![]});switch(_0x52738d[_0xb618('0x4f')]){case _0xb618('0x52'):_0xbc2054['push'](db[_0xb618('0x53')][_0xb618('0x54')](_0x174e15(_0x52738d,_0xb618('0x55')))['then'](function(){})['catch'](_0x5482f7()));break;case _0xb618('0x56'):_0xbc2054[_0xb618('0x2c')](db['sequelize'][_0xb618('0x54')](_0x4b4de0(_0x52738d,'VoiceQueueId'))[_0xb618('0x2b')](function(){})[_0xb618('0x2e')](_0x5482f7()));break;default:_0xbc2054['push'](db[_0xb618('0x53')][_0xb618('0x54')](_0x1c3b8a(_0x52738d,'VoiceQueueId'))[_0xb618('0x2b')](function(){})[_0xb618('0x2e')](_0x5482f7()));}}}return _0xbc2054;})['all']()['then'](function(){return db[_0xb618('0x4d')][_0xb618('0x4e')]({'where':{'type':_0xb618('0x57')},'attributes':['id'],'include':[{'model':db[_0xb618('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xb618('0x2b')](function(_0x164f16){var _0x46e306=[];if(_0x164f16){var _0x56e8f7;for(var _0x4e0f2e=0x0,_0x5179ea;_0x4e0f2e<_0x164f16[_0xb618('0x1c')];_0x4e0f2e+=0x1){_0x5179ea=_0x164f16[_0x4e0f2e][_0xb618('0x51')]({'plain':!![]});_0x46e306[_0xb618('0x2c')](db[_0xb618('0x53')]['query'](_0x5b4da6(_0x5179ea,_0xb618('0x55')))['then'](function(){})[_0xb618('0x2e')](_0x5482f7()));}}return _0x46e306;})[_0xb618('0x58')]();})[_0xb618('0x2b')](function(){return db[_0xb618('0x59')]['findAll']({'attributes':['id',_0xb618('0x4f')],'include':[{'model':db[_0xb618('0x50')],'as':_0xb618('0x5a'),'where':{'id':LISTID}}]})[_0xb618('0x2b')](function(_0x436995){var _0x430e12=[];if(_0x436995){for(var _0xbc7e95=0x0,_0x3dd206;_0xbc7e95<_0x436995['length'];_0xbc7e95+=0x1){_0x3dd206=_0x436995[_0xbc7e95][_0xb618('0x51')]({'plain':!![]});switch(_0x3dd206[_0xb618('0x4f')]){case _0xb618('0x52'):_0x430e12['push'](db[_0xb618('0x53')][_0xb618('0x54')](_0x174e15(_0x3dd206,_0xb618('0x5b')))['then'](function(){})[_0xb618('0x2e')](_0x5482f7()));break;case _0xb618('0x56'):_0x430e12['push'](db[_0xb618('0x53')][_0xb618('0x54')](_0x4b4de0(_0x3dd206,'CampaignId'))[_0xb618('0x2b')](function(){})[_0xb618('0x2e')](_0x5482f7()));break;default:_0x430e12[_0xb618('0x2c')](db[_0xb618('0x53')][_0xb618('0x54')](_0x1c3b8a(_0x3dd206,_0xb618('0x5b')))[_0xb618('0x2b')](function(){})[_0xb618('0x2e')](_0x5482f7()));}}}return _0x430e12;})['all']();})[_0xb618('0x2b')](function(){return db[_0xb618('0x59')][_0xb618('0x4e')]({'attributes':['id'],'include':[{'model':db[_0xb618('0x50')],'as':_0xb618('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x1a862c){var _0x578b8e=[];if(_0x1a862c){for(var _0x290327=0x0,_0x42a535;_0x290327<_0x1a862c[_0xb618('0x1c')];_0x290327+=0x1){_0x42a535=_0x1a862c[_0x290327][_0xb618('0x51')]({'plain':!![]});_0x578b8e['push'](db[_0xb618('0x53')][_0xb618('0x54')](_0x5b4da6(_0x42a535,_0xb618('0x5b')))[_0xb618('0x2b')](function(){})[_0xb618('0x2e')](_0x5482f7()));}}return _0x578b8e;})[_0xb618('0x58')]();})[_0xb618('0x2e')](function(_0x2ee77f){logger[_0xb618('0x19')](_0xb618('0x5d'),'generalCheckHopper',_0x2ee77f['message']);});}var processPromises=function(_0x38a42c){return BPromise[_0xb618('0x58')](promises)[_0xb618('0x2b')](function(_0x434f16){})[_0xb618('0x2e')](function(_0x2a8f2f){logger[_0xb618('0x19')]('Error\x20processing\x20rows\x20block:',JSON[_0xb618('0x30')](_0x2a8f2f));})[_0xb618('0x5e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x38a42c){return _0x38a42c[_0xb618('0x5f')]();}});};var endCsv=function(){return BPromise[_0xb618('0x60')]()[_0xb618('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0xb618('0x2b')](function(){socket[_0xb618('0x61')](_0xb618('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb618('0x63')](FILEPATH);}catch(_0x3fae72){logger[_0xb618('0x19')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xb618('0x30')](_0x3fae72));}finally{process[_0xb618('0x64')](0x0);}});};process['on'](_0xb618('0x65'),function(){logger['info'](_0xb618('0x66'));endCsv();});function main(){return BPromise[_0xb618('0x60')]()[_0xb618('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xb618('0x13')](',');return db[_0xb618('0x29')][_0xb618('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x25e27e){var _0x3872dd=fs[_0xb618('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3872dd,{'header':!![],'skipEmptyLines':!![],'step':function(_0x332da4,_0x9a86b5){total+=0x1;var _0x2cd65b=total;promises[_0xb618('0x2c')](checkRow(_0x332da4,_0x25e27e,_0x2cd65b)[_0xb618('0x2b')](function(){success+=0x1;})[_0xb618('0x2e')](function(_0x209741){if(_0x209741['error']){errors+=0x1;delete _0x209741[_0xb618('0x19')];}else if(_0x209741[_0xb618('0x28')]){duplicates+=0x1;delete _0x209741[_0xb618('0x28')];}rows[_0xb618('0x2c')](_0x209741);}));if(total%0xc8===0x0){_0x9a86b5[_0xb618('0x68')]();return processPromises(_0x9a86b5);}},'complete':function(){return processPromises()['then'](function(){logger[_0xb618('0x69')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x34f060,_0x3a1d6d){logger[_0xb618('0x69')](_0xb618('0x6a'),JSON[_0xb618('0x30')](_0x34f060));endCsv();}});})[_0xb618('0x2e')](function(_0x350c01){logger[_0xb618('0x19')](_0xb618('0x6b'),JSON[_0xb618('0x30')](_0x350c01));});}main(); \ No newline at end of file +var _0x2fc7=['sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','CampaignId','generalCheckHopper','finally','contact:csv_','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','split','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','contact','index','test','isNil','errors','length','map','message','join','error','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','NOW()','toString','createdAt','updatedAt','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','cm_hopper_final','into','cm_contacts','str','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always'];(function(_0x5bff30,_0x40a7a4){var _0xf51b20=function(_0x3e5833){while(--_0x3e5833){_0x5bff30['push'](_0x5bff30['shift']());}};_0xf51b20(++_0x40a7a4);}(_0x2fc7,0x167));var _0x72fc=function(_0x451240,_0x4f7681){_0x451240=_0x451240-0x0;var _0x378de5=_0x2fc7[_0x451240];return _0x378de5;};'use strict';var BPromise=require(_0x72fc('0x0'));var util=require(_0x72fc('0x1'));var _=require(_0x72fc('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x72fc('0x3'));var Redis=require('ioredis');var db=require(_0x72fc('0x4'))['db'];var config=require(_0x72fc('0x5'));var logger=require(_0x72fc('0x6'))('api');config[_0x72fc('0x7')]=_[_0x72fc('0x8')](config[_0x72fc('0x7')],{'host':_0x72fc('0x9'),'port':0x18eb});var socket=require(_0x72fc('0xa'))(new Redis(config['redis']));require(_0x72fc('0xb'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x72fc('0xc')][0x2]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x2]===_0x72fc('0xe')){throw new Error(_0x72fc('0xf'));}var FILEPATH=process[_0x72fc('0xc')][0x2];if(!process[_0x72fc('0xc')][0x3]||process[_0x72fc('0xc')][0x3]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x3]==='null'||!process[_0x72fc('0xc')][0x4]||process[_0x72fc('0xc')][0x4]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x4]===_0x72fc('0xe')){throw new Error(_0x72fc('0x10'));}var FIELDS=_[_0x72fc('0x11')](process[_0x72fc('0xc')][0x3]['split'](','),process[_0x72fc('0xc')][0x4]['split'](','));if(!process[_0x72fc('0xc')][0x5]||process['argv'][0x5]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x72fc('0xc')][0x5];var COMPANYID=process[_0x72fc('0xc')][0x6]&&process[_0x72fc('0xc')][0x6]!==_0x72fc('0xd')&&process[_0x72fc('0xc')][0x6]!==_0x72fc('0xe')?process[_0x72fc('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x72fc('0xc')][0x7]!==_0x72fc('0xd')&&process['argv'][0x7]!==_0x72fc('0xe')?process[_0x72fc('0xc')][0x7]:null;if(!process[_0x72fc('0xc')][0x8]||process['argv'][0x8]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x8]===_0x72fc('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x72fc('0xc')][0x8];}catch(_0x3d55e3){logger['error'](_0x3d55e3);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(_0xff1410,_0x29c15e,_0x57b8ee,_0x1d7698){var _0x4cfe5a={'message':_0x29c15e};_0x4cfe5a[_0xff1410]=!![];if(_0x57b8ee){_0x4cfe5a[_0x72fc('0x12')]=_0x57b8ee;}if(_0x1d7698){_0x4cfe5a[_0x72fc('0x13')]=_0x1d7698;}return _0x4cfe5a;}function isEmail(_0x2c1226){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))*$/[_0x72fc('0x14')](_0x2c1226);}function checkRow(_0x24cb71,_0x29c062,_0x1b6afa){return new BPromise(function(_0x34e818,_0x20ce53){if(_[_0x72fc('0x15')](_0x24cb71)){return _0x20ce53(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x1b6afa));}if(_0x24cb71['errors']&&_0x24cb71[_0x72fc('0x16')][_0x72fc('0x17')]){var _0x39b783=_[_0x72fc('0x18')](_0x24cb71[_0x72fc('0x16')],_0x72fc('0x19'))[_0x72fc('0x1a')](';');return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x39b783,null,_0x1b6afa));}var _0xd103d7={};for(var _0x3de02 in FIELDS){if(FIELDS[_0x72fc('0x1c')](_0x3de02)&&FIELDS[_0x3de02]){_0xd103d7[_0x3de02]=_0x24cb71[_0x72fc('0x1d')][0x0][FIELDS[_0x3de02]]||_0x24cb71[_0x72fc('0x1d')][0x0]['\ufeff'+FIELDS[_0x3de02]];}}if(!_0xd103d7[_0x72fc('0x1e')]){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x72fc('0x1f'),null,_0x1b6afa));}if(!_0xd103d7[_0x72fc('0x20')]){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x72fc('0x21'),null,_0x1b6afa));}if(_0xd103d7[_0x72fc('0x22')]){var _0x4329c6=moment(_0xd103d7[_0x72fc('0x22')],_0x72fc('0x23'));if(!_0x4329c6[_0x72fc('0x24')]()){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x72fc('0x25'),null,_0x1b6afa));}}if(_0xd103d7[_0x72fc('0x26')]){if(!isEmail(_0xd103d7['email'])){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),'email\x20format\x20is\x20not\x20valid!',null,_0x1b6afa));}}_0xd103d7[_0x72fc('0x27')]=LISTID;_0xd103d7[_0x72fc('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x29c062){var _0x57945d={};for(var _0x48693e=0x0,_0x459464=DUPLICATES[_0x72fc('0x17')];_0x48693e<_0x459464;_0x48693e+=0x1){_0x57945d[DUPLICATES[_0x48693e]]=_0xd103d7[DUPLICATES[_0x48693e]];}var _0x37e263=_[_0x72fc('0x29')](_0x29c062,_0x57945d);if(_0x37e263){return _0x20ce53(handleCheckRowError(_0x72fc('0x2a'),_0x72fc('0x2b'),_0x37e263,_0x1b6afa));}}return db['CmContact'][_0x72fc('0x2c')](_0xd103d7,{'raw':!![],'hooks':![],'fields':_[_0x72fc('0x2d')](_0xd103d7)})[_0x72fc('0x2e')](function(_0x182f7d){if(DUPLICATES&&DUPLICATES[_0x72fc('0x17')]&&_0x29c062){_0x29c062[_0x72fc('0x2f')](_[_0x72fc('0x30')](_0xd103d7,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x182f7d['id'];return _0x34e818();})[_0x72fc('0x31')](function(_0x208e08){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x72fc('0x32')+(_0x208e08[_0x72fc('0x19')]||JSON[_0x72fc('0x33')](_0x208e08)),null,_0x1b6afa));});});}function checkHopper(){function _0x2b08dd(){return function(_0x5b70a0){logger[_0x72fc('0x1b')]('cmContact',_0x72fc('0x34'),util[_0x72fc('0x35')](_0x5b70a0,{'showHidden':![],'depth':null}));};}var _0x2f06f4=function(_0x3d86bb,_0x503978){var _0x1b8d22=squel[_0x72fc('0x36')]()['into'](_0x72fc('0x37'))[_0x72fc('0x38')]([_0x72fc('0x20'),_0x72fc('0x39'),_0x72fc('0x3a'),_0x72fc('0x27'),_0x503978,'createdAt','updatedAt'],squel[_0x72fc('0x3b')]()[_0x72fc('0x3c')](_0x72fc('0x20'),_0x72fc('0x20'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x39'))[_0x72fc('0x3c')]('id',_0x72fc('0x3a'))[_0x72fc('0x3c')](LISTID['toString'](),_0x72fc('0x27'))[_0x72fc('0x3c')](_0x3d86bb['id'][_0x72fc('0x3e')](),_0x503978)[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x3f'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x40'))['from']('cm_contacts')[_0x72fc('0x41')]('deletedAt\x20IS\x20NULL')[_0x72fc('0x41')](_0x72fc('0x42'),LISTID[_0x72fc('0x3e')]())[_0x72fc('0x41')](_0x72fc('0x43'))['where'](_0x72fc('0x44'),squel[_0x72fc('0x3b')]()[_0x72fc('0x3c')](_0x72fc('0x20'))[_0x72fc('0x45')](_0x72fc('0x37'))[_0x72fc('0x41')](_0x503978+_0x72fc('0x46'),_0x3d86bb['id'][_0x72fc('0x3e')]())))[_0x72fc('0x3e')]();return _0x1b8d22;};var _0x4f6d3c=function(_0x456b41,_0x47d60e){var _0x3e6471=squel[_0x72fc('0x36')]()['into'](_0x72fc('0x37'))[_0x72fc('0x38')]([_0x72fc('0x20'),_0x72fc('0x39'),_0x72fc('0x3a'),_0x72fc('0x27'),_0x47d60e,_0x72fc('0x3f'),'updatedAt'],squel[_0x72fc('0x3b')]()[_0x72fc('0x3c')](_0x72fc('0x20'),_0x72fc('0x20'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x39'))[_0x72fc('0x3c')]('id',_0x72fc('0x3a'))[_0x72fc('0x3c')](LISTID[_0x72fc('0x3e')](),_0x72fc('0x27'))[_0x72fc('0x3c')](_0x456b41['id'][_0x72fc('0x3e')](),_0x47d60e)[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x3f'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x40'))[_0x72fc('0x45')]('cm_contacts')[_0x72fc('0x41')](_0x72fc('0x47'))[_0x72fc('0x41')](_0x72fc('0x42'),LISTID[_0x72fc('0x3e')]())[_0x72fc('0x41')](_0x72fc('0x48'),squel['str'](hopperContacts))[_0x72fc('0x41')](_0x72fc('0x43'))[_0x72fc('0x41')](_0x72fc('0x44'),squel[_0x72fc('0x3b')]()[_0x72fc('0x3c')]('calleridnum')[_0x72fc('0x45')](_0x72fc('0x49'))[_0x72fc('0x41')](_0x47d60e+_0x72fc('0x46'),_0x456b41['id']['toString']()))[_0x72fc('0x41')](_0x72fc('0x44'),squel[_0x72fc('0x3b')]()['field'](_0x72fc('0x20'))[_0x72fc('0x45')]('cm_hopper')['where'](_0x47d60e+_0x72fc('0x46'),_0x456b41['id'][_0x72fc('0x3e')]())))[_0x72fc('0x3e')]();return _0x3e6471;};function _0xba9573(_0x2f96e0,_0xfd0b30){var _0x338619=squel[_0x72fc('0x36')]()[_0x72fc('0x4a')]('cm_hopper')[_0x72fc('0x38')]([_0x72fc('0x20'),'scheduledAt','ContactId','ListId',_0xfd0b30,'createdAt',_0x72fc('0x40')],squel[_0x72fc('0x3b')]()['field'](_0x72fc('0x20'),'phone')['field']('NOW()',_0x72fc('0x39'))[_0x72fc('0x3c')]('id','ContactId')[_0x72fc('0x3c')](LISTID['toString'](),'ListId')[_0x72fc('0x3c')](_0x2f96e0['id'][_0x72fc('0x3e')](),_0xfd0b30)[_0x72fc('0x3c')](_0x72fc('0x3d'),'createdAt')[_0x72fc('0x3c')]('NOW()',_0x72fc('0x40'))['from'](_0x72fc('0x4b'))[_0x72fc('0x41')](_0x72fc('0x47'))[_0x72fc('0x41')]('ListId\x20=\x20?',LISTID['toString']())[_0x72fc('0x41')](_0x72fc('0x48'),squel['str'](hopperContacts))[_0x72fc('0x41')](_0x72fc('0x43')))[_0x72fc('0x3e')]();return _0x338619;}function _0x3ecb50(_0x5b51c7,_0x29e61f){var _0x4bd88b=squel[_0x72fc('0x36')]()[_0x72fc('0x4a')]('cm_hopper_black')[_0x72fc('0x38')]([_0x72fc('0x20'),_0x72fc('0x3a'),'ListId',_0x29e61f,_0x72fc('0x3f'),_0x72fc('0x40')],squel['select']()[_0x72fc('0x3c')](_0x72fc('0x20'),_0x72fc('0x20'))[_0x72fc('0x3c')]('id','ContactId')[_0x72fc('0x3c')](LISTID['toString'](),_0x72fc('0x27'))[_0x72fc('0x3c')](_0x5b51c7['id'][_0x72fc('0x3e')](),_0x29e61f)['field'](_0x72fc('0x3d'),_0x72fc('0x3f'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x40'))[_0x72fc('0x45')](_0x72fc('0x4b'))[_0x72fc('0x41')]('deletedAt\x20IS\x20NULL')['where'](_0x72fc('0x42'),LISTID[_0x72fc('0x3e')]())[_0x72fc('0x41')](_0x72fc('0x48'),squel[_0x72fc('0x4c')](hopperContacts))[_0x72fc('0x41')](_0x72fc('0x43')))[_0x72fc('0x3e')]();return _0x4bd88b;}return db[_0x72fc('0x4d')][_0x72fc('0x4e')]({'where':{'type':_0x72fc('0x4f')},'attributes':['id',_0x72fc('0x50')],'include':[{'model':db[_0x72fc('0x51')],'as':_0x72fc('0x52'),'where':{'id':LISTID}}]})[_0x72fc('0x2e')](function(_0x1421a4){var _0x139cff=[];if(_0x1421a4){var _0x4c814e;for(var _0x48c1ce=0x0,_0x160bb8;_0x48c1ce<_0x1421a4[_0x72fc('0x17')];_0x48c1ce+=0x1){_0x160bb8=_0x1421a4[_0x48c1ce][_0x72fc('0x53')]({'plain':!![]});switch(_0x160bb8['dialCheckDuplicateType']){case _0x72fc('0x54'):_0x139cff[_0x72fc('0x2f')](db[_0x72fc('0x55')][_0x72fc('0x56')](_0x4f6d3c(_0x160bb8,_0x72fc('0x57')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));break;case _0x72fc('0x58'):_0x139cff[_0x72fc('0x2f')](db[_0x72fc('0x55')][_0x72fc('0x56')](_0x2f06f4(_0x160bb8,_0x72fc('0x57')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));break;default:_0x139cff[_0x72fc('0x2f')](db['sequelize']['query'](_0xba9573(_0x160bb8,_0x72fc('0x57')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));}}}return _0x139cff;})[_0x72fc('0x59')]()[_0x72fc('0x2e')](function(){return db[_0x72fc('0x4d')]['findAll']({'where':{'type':_0x72fc('0x4f')},'attributes':['id'],'include':[{'model':db[_0x72fc('0x51')],'as':_0x72fc('0x5a'),'where':{'id':LISTID}}]})[_0x72fc('0x2e')](function(_0x120826){var _0x37008a=[];if(_0x120826){var _0xc7d291;for(var _0x1a29d3=0x0,_0x15f8dd;_0x1a29d3<_0x120826[_0x72fc('0x17')];_0x1a29d3+=0x1){_0x15f8dd=_0x120826[_0x1a29d3][_0x72fc('0x53')]({'plain':!![]});_0x37008a['push'](db[_0x72fc('0x55')]['query'](_0x3ecb50(_0x15f8dd,_0x72fc('0x57')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));}}return _0x37008a;})[_0x72fc('0x59')]();})[_0x72fc('0x2e')](function(){return db[_0x72fc('0x5b')][_0x72fc('0x4e')]({'attributes':['id',_0x72fc('0x50')],'include':[{'model':db[_0x72fc('0x51')],'as':_0x72fc('0x52'),'where':{'id':LISTID}}]})[_0x72fc('0x2e')](function(_0x22de2e){var _0x24189d=[];if(_0x22de2e){for(var _0x42aafe=0x0,_0x583aef;_0x42aafe<_0x22de2e['length'];_0x42aafe+=0x1){_0x583aef=_0x22de2e[_0x42aafe][_0x72fc('0x53')]({'plain':!![]});switch(_0x583aef[_0x72fc('0x50')]){case _0x72fc('0x54'):_0x24189d[_0x72fc('0x2f')](db['sequelize'][_0x72fc('0x56')](_0x4f6d3c(_0x583aef,_0x72fc('0x5c')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));break;case'onlyIfOpen':_0x24189d['push'](db[_0x72fc('0x55')][_0x72fc('0x56')](_0x2f06f4(_0x583aef,'CampaignId'))['then'](function(){})['catch'](_0x2b08dd()));break;default:_0x24189d[_0x72fc('0x2f')](db[_0x72fc('0x55')][_0x72fc('0x56')](_0xba9573(_0x583aef,_0x72fc('0x5c')))[_0x72fc('0x2e')](function(){})['catch'](_0x2b08dd()));}}}return _0x24189d;})['all']();})[_0x72fc('0x2e')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0x72fc('0x51')],'as':_0x72fc('0x5a'),'where':{'id':LISTID}}]})[_0x72fc('0x2e')](function(_0x19589f){var _0x4fdea9=[];if(_0x19589f){for(var _0x2dc61b=0x0,_0x2fe143;_0x2dc61b<_0x19589f[_0x72fc('0x17')];_0x2dc61b+=0x1){_0x2fe143=_0x19589f[_0x2dc61b]['get']({'plain':!![]});_0x4fdea9[_0x72fc('0x2f')](db[_0x72fc('0x55')]['query'](_0x3ecb50(_0x2fe143,_0x72fc('0x5c')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));}}return _0x4fdea9;})[_0x72fc('0x59')]();})[_0x72fc('0x31')](function(_0xbf15fd){logger[_0x72fc('0x1b')]('cmContact,\x20%s,\x20%s',_0x72fc('0x5d'),_0xbf15fd['message']);});}var processPromises=function(_0xb1ceb8){return BPromise[_0x72fc('0x59')](promises)[_0x72fc('0x2e')](function(_0x50de74){})['catch'](function(_0x3805e8){logger[_0x72fc('0x1b')]('Error\x20processing\x20rows\x20block:',JSON[_0x72fc('0x33')](_0x3805e8));})[_0x72fc('0x5e')](function(){socket['emit'](_0x72fc('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xb1ceb8){return _0xb1ceb8['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x72fc('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x72fc('0x2e')](function(){socket[_0x72fc('0x60')](_0x72fc('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x72fc('0x61')](FILEPATH);}catch(_0x6eece6){logger['error'](_0x72fc('0x62'),JSON[_0x72fc('0x33')](_0x6eece6));}finally{process[_0x72fc('0x63')](0x0);}});};process['on'](_0x72fc('0x64'),function(){logger[_0x72fc('0x65')](_0x72fc('0x66'));endCsv();});function main(){return BPromise[_0x72fc('0x67')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x72fc('0x68')](',');return db[_0x72fc('0x69')][_0x72fc('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x72fc('0x2e')](function(_0x5602d3){var _0x538332=fs[_0x72fc('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x72fc('0x6b')](_0x538332,{'header':!![],'skipEmptyLines':!![],'step':function(_0xd83396,_0xe65ed6){total+=0x1;var _0x194710=total;promises[_0x72fc('0x2f')](checkRow(_0xd83396,_0x5602d3,_0x194710)[_0x72fc('0x2e')](function(){success+=0x1;})[_0x72fc('0x31')](function(_0x5b0ffa){if(_0x5b0ffa['error']){errors+=0x1;delete _0x5b0ffa[_0x72fc('0x1b')];}else if(_0x5b0ffa[_0x72fc('0x2a')]){duplicates+=0x1;delete _0x5b0ffa[_0x72fc('0x2a')];}rows[_0x72fc('0x2f')](_0x5b0ffa);}));if(total%0xc8===0x0){_0xe65ed6[_0x72fc('0x6c')]();return processPromises(_0xe65ed6);}},'complete':function(){return processPromises()[_0x72fc('0x2e')](function(){logger[_0x72fc('0x65')](_0x72fc('0x6d'));endCsv();});},'error':function(_0x442081,_0x3bc49c){logger['info'](_0x72fc('0x6e'),JSON[_0x72fc('0x33')](_0x442081));endCsv();}});})[_0x72fc('0x31')](function(_0x1267c7){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x72fc('0x33')](_0x1267c7));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 40a32bf..410d1ba 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 _0x2e82=['toString','cm_contacts.id','cm_hopper_black','ContactId','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','query','spread','catch','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','stringify','send','start','binding','root','.csv','includes','header','name','writeFileSync','parse','createReadStream','data','find','_description','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email','email\x20wrong\x20format','dateOfBirth','firstName','\x20not\x20specified','hasOwnProperty','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','DROP\x20TABLE\x20','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','campaigns_has_cm_lists','finish','affectedRows','unlink','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22'];(function(_0x24dfae,_0x1fd133){var _0x161968=function(_0x48e09f){while(--_0x48e09f){_0x24dfae['push'](_0x24dfae['shift']());}};_0x161968(++_0x1fd133);}(_0x2e82,0x70));var _0x22e8=function(_0x3bd78a,_0x4579b8){_0x3bd78a=_0x3bd78a-0x0;var _0x285abc=_0x2e82[_0x3bd78a];return _0x285abc;};'use strict';var fs=require('fs');var path=require(_0x22e8('0x0'));var _=require('lodash');var Papa=require(_0x22e8('0x1'));var util=require(_0x22e8('0x2'));var BPromise=require(_0x22e8('0x3'));var moment=require(_0x22e8('0x4'));var squel=require(_0x22e8('0x5'));var Redis=require(_0x22e8('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x22e8('0x7'));var logger=require(_0x22e8('0x8'))(_0x22e8('0x9'));config[_0x22e8('0xa')]=_[_0x22e8('0xb')](config[_0x22e8('0xa')],{'host':_0x22e8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x22e8('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x22e8('0xd')](_0x22e8('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x22e8('0xe'));function isEmail(_0x1cc686){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))*$/[_0x22e8('0xf')](_0x1cc686);}function selectNotIn(_0x3332f6,_0x566c3d,_0x336fe9,_0x7cac6b,_0x351a39){return squel[_0x22e8('0x10')]()[_0x22e8('0x11')]('phone')[_0x22e8('0x12')](_0x7cac6b)[_0x22e8('0x13')](_0x566c3d,null,_0x566c3d+_0x22e8('0x14')+_0x7cac6b+'.'+_0x336fe9)[_0x22e8('0x15')](_0x7cac6b+'.'+_0x336fe9+'\x20=\x20'+_0x3332f6+'.'+_0x336fe9)[_0x22e8('0x15')](_0x566c3d+_0x22e8('0x16')+_0x351a39[_0x22e8('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x581279,_0x545185){promisesAdditionalPhones=[];return db['CmContact'][_0x22e8('0x17')]({'raw':!![],'attributes':['id',_0x22e8('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x22e8('0x19')](function(_0x11c92a){if(_0x11c92a!==null){var _0x36cae7=[];for(var _0x4b0e87=0x0;_0x4b0e87<_0x11c92a[_0x22e8('0x1a')];_0x4b0e87++){var _0x437e58=_0x11c92a[_0x4b0e87];_0x36cae7[_0x22e8('0x1b')](insertAdditionalPhones(_0x437e58));}}Promise[_0x22e8('0x1c')](_0x36cae7)[_0x22e8('0x19')](function(){_0x581279({'val':0x1});});});});}function insertAdditionalPhones(_0x49ef3a){return new Promise(function(_0x13d9c3,_0x1d8938){var _0x2c7fd1=_0x49ef3a[_0x22e8('0x18')];var _0x2e8270=_0x2c7fd1[_0x22e8('0x1d')](';');var _0x4fdc41=[];orderBy=0x0;for(var _0x1c33be=0x0;_0x1c33be<_0x2e8270[_0x22e8('0x1a')];_0x1c33be++){_0x4fdc41[_0x22e8('0x1b')](splitAdditionalPhone(_0x49ef3a['id'],_0x2e8270[_0x1c33be]));}Promise['all'](_0x4fdc41)[_0x22e8('0x19')](function(){_0x13d9c3({'val':_0x2e8270[_0x22e8('0x1a')]});});});}function splitAdditionalPhone(_0x2a5c00,_0x408afe){return new Promise(function(_0x6fe5d5,_0x44b253){var _0x7c6ddc=_0x408afe[_0x22e8('0x1d')](':');var _0x1b670c=_0x7c6ddc[0x0];var _0x1a51e9=_0x7c6ddc[0x1];if(!_[_0x22e8('0x1e')](_0x1a51e9)){var _0x362dbe=_0x1a51e9[_0x22e8('0x1d')]('|');var _0x349b71=[];for(var _0x12accb=0x0;_0x12accb<_0x362dbe[_0x22e8('0x1a')];_0x12accb++){if(_0x362dbe[_0x12accb]!==''){var _0x4d44e5=_[_0x22e8('0x1f')](promisesAdditionalPhones,{'contactId':_0x2a5c00,'phone':_0x362dbe[_0x12accb]});if(_0x4d44e5[_0x22e8('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x22e8('0x1b')]({'contactId':_0x2a5c00,'contactTypeId':_0x1b670c,'phone':_0x362dbe[_0x12accb],'orderBy':orderBy});}}}_0x6fe5d5({'ok':0x1});}else _0x6fe5d5({'res':0x0});});}function createAdditionalPhone(_0x3cca1,_0x460439,_0x13f467,_0x17bf62){var _0x3cbd54='';var _0x1e91c7='';var _0x3ccdbc=_0x13f467[_0x22e8('0x1d')]('§');_0x3cbd54=_0x3ccdbc[0x0];if(_0x3ccdbc['length']==0x2)_0x1e91c7=_0x3ccdbc[0x1];return new Promise(function(_0x566f91,_0x3a90cf){return db[_0x22e8('0x20')][_0x22e8('0x21')]({'where':{'CmContactId':_0x3cca1,'item':_0x3cbd54}})['then'](function(_0x285dd7){if(_0x285dd7){return db['CmContactHasItem']['update']({'ItemTypeId':_0x460439,'description':_0x1e91c7,'OrderBy':_0x17bf62},{'where':{'CmContactId':_0x3cca1,'item':_0x3cbd54}})[_0x22e8('0x19')](function(_0x1f50e1){_0x566f91({'res':'updated'});});}else{return db[_0x22e8('0x20')]['create']({'CmContactId':_0x3cca1,'item':_0x3cbd54,'description':_0x1e91c7,'ItemTypeId':_0x460439,'OrderBy':_0x17bf62,'ItemClass':'PHONE'})['then'](function(_0x1032b9){_0x566f91({'res':_0x22e8('0x22')});});}});});}function insertCmHopper(_0x40ab21,_0x1a3fca,_0x4c9964,_0x39ffcb,_0x1480db){var _0x2c6a07=[_0x22e8('0x23'),_0x22e8('0x24'),'cm_contacts.id',_0x22e8('0x25'),_0x1a3fca+'.'+_0x39ffcb,_0x22e8('0x26'),_0x22e8('0x27'),_0x22e8('0x28'),_0x22e8('0x29'),'\x22'+_0x1480db+'\x22'];return squel[_0x22e8('0x2a')]()[_0x22e8('0x2b')](_0x22e8('0x2c'))[_0x22e8('0x2d')]([_0x22e8('0x2e'),'scheduledat','ContactId',_0x22e8('0x2f'),_0x39ffcb,_0x22e8('0x30'),_0x22e8('0x31'),_0x22e8('0x32'),_0x22e8('0x33'),'recallme'],squel[_0x22e8('0x10')]()[_0x22e8('0x34')](_0x2c6a07)['from'](_0x1a3fca)['join'](_0x22e8('0x35'),null,_0x22e8('0x36')+_0x1a3fca+_0x22e8('0x37'))[_0x22e8('0x13')](_0x4c9964,null,_0x4c9964+_0x22e8('0x14')+_0x1a3fca+'.'+_0x39ffcb)['where'](_0x1a3fca+'.CmListId\x20=\x20?',_0x40ab21)[_0x22e8('0x15')](_0x22e8('0x38'),NOW)[_0x22e8('0x15')](_0x22e8('0x39'),selectNotIn(_0x1a3fca,_0x4c9964,_0x39ffcb,'cm_hopper',[_0x22e8('0x3a'),_0x22e8('0x3b')]))[_0x22e8('0x15')](_0x22e8('0x39'),selectNotIn(_0x1a3fca,_0x4c9964,_0x39ffcb,_0x22e8('0x2c'),[_0x22e8('0x3a')])))[_0x22e8('0x3c')]();}function insertCmHopperBlack(_0x11dece,_0x558a21,_0x44ca5d,_0x47b396){var _0x32415c=[_0x22e8('0x23'),_0x22e8('0x3d'),_0x22e8('0x25'),_0x558a21+'.'+_0x47b396,_0x22e8('0x26'),'cm_contacts.updatedAt'];return squel[_0x22e8('0x2a')]()[_0x22e8('0x2b')](_0x22e8('0x3e'))[_0x22e8('0x2d')]([_0x22e8('0x2e'),_0x22e8('0x3f'),_0x22e8('0x2f'),_0x47b396,_0x22e8('0x30'),_0x22e8('0x31')],squel[_0x22e8('0x10')]()[_0x22e8('0x34')](_0x32415c)[_0x22e8('0x12')](_0x558a21)[_0x22e8('0x13')](_0x22e8('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x558a21+_0x22e8('0x37'))[_0x22e8('0x13')](_0x44ca5d,null,_0x44ca5d+_0x22e8('0x14')+_0x558a21+'.'+_0x47b396)[_0x22e8('0x15')](_0x558a21+_0x22e8('0x40'),_0x11dece)[_0x22e8('0x15')](_0x22e8('0x38'),NOW)[_0x22e8('0x15')](_0x22e8('0x39'),squel[_0x22e8('0x10')]()['field']('phone')['from']('cm_hopper_black')[_0x22e8('0x15')](_0x22e8('0x41'),_0x11dece)[_0x22e8('0x15')](_0x47b396+_0x22e8('0x42')+_0x558a21+'.'+_0x47b396)))['toString']();}function insertTzCmHopper(_0x2cee6c,_0x4f1e18,_0xe4fd1b,_0x3e2bf5,_0x2ebc4a,_0x3305ed){var _0x5849b9=[_0x22e8('0x23'),_0x22e8('0x43')+_0x3305ed+_0x22e8('0x44'),_0x22e8('0x3d'),_0x22e8('0x25'),_0x4f1e18+'.'+_0x3e2bf5,_0x22e8('0x26'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x2ebc4a+'\x22'];var _0xe0d6fe=squel[_0x22e8('0x2a')]()[_0x22e8('0x2b')](_0x22e8('0x2c'))[_0x22e8('0x2d')](['phone',_0x22e8('0x45'),'ContactId',_0x22e8('0x2f'),_0x3e2bf5,_0x22e8('0x30'),'updatedAt','priority',_0x22e8('0x33'),_0x22e8('0x46')],squel['select']()[_0x22e8('0x34')](_0x5849b9)[_0x22e8('0x12')](_0x4f1e18)[_0x22e8('0x13')]('cm_contacts',null,_0x22e8('0x36')+_0x4f1e18+_0x22e8('0x37'))['join'](_0xe4fd1b,null,_0xe4fd1b+_0x22e8('0x14')+_0x4f1e18+'.'+_0x3e2bf5)[_0x22e8('0x13')](_0x3305ed,null,_0x3305ed+_0x22e8('0x14')+_0x4f1e18+'.'+_0x3e2bf5)[_0x22e8('0x15')](_0x4f1e18+_0x22e8('0x40'),_0x2cee6c)[_0x22e8('0x15')](_0x22e8('0x38'),NOW)[_0x22e8('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f1e18,_0xe4fd1b,_0x3e2bf5,_0x22e8('0x2c'),[_0x22e8('0x3a'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f1e18,_0xe4fd1b,_0x3e2bf5,_0x22e8('0x2c'),[_0x22e8('0x3a')])))[_0x22e8('0x3c')]();return _0xe0d6fe;}function insertTzCmHopperBlack(_0x13fac4,_0x488c2c,_0x15ef0c,_0x33f94d){var _0x339cdd=[_0x22e8('0x23'),_0x22e8('0x3d'),_0x22e8('0x25'),_0x488c2c+'.'+_0x33f94d,_0x22e8('0x26'),_0x22e8('0x27')];return squel[_0x22e8('0x2a')]()[_0x22e8('0x2b')](_0x22e8('0x3e'))[_0x22e8('0x2d')]([_0x22e8('0x2e'),_0x22e8('0x3f'),_0x22e8('0x2f'),_0x33f94d,_0x22e8('0x30'),_0x22e8('0x31')],squel[_0x22e8('0x10')]()[_0x22e8('0x34')](_0x339cdd)[_0x22e8('0x12')](_0x488c2c)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x488c2c+_0x22e8('0x37'))[_0x22e8('0x13')](_0x15ef0c,null,_0x15ef0c+_0x22e8('0x14')+_0x488c2c+'.'+_0x33f94d)['where'](_0x488c2c+_0x22e8('0x40'),_0x13fac4)[_0x22e8('0x15')](_0x22e8('0x38'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x22e8('0x11')](_0x22e8('0x2e'))[_0x22e8('0x12')](_0x22e8('0x3e'))[_0x22e8('0x15')](_0x22e8('0x41'),_0x13fac4)[_0x22e8('0x15')](_0x33f94d+_0x22e8('0x42')+_0x488c2c+'.'+_0x33f94d)))[_0x22e8('0x3c')]();}function insertCmHopperAdditionalPhones(_0x37c54f){var _0x10e1c9=[_0x22e8('0x47'),_0x22e8('0x48'),_0x22e8('0x49'),_0x22e8('0x4a'),'cm_contact_has_items.updatedAt'];return squel[_0x22e8('0x2a')]()[_0x22e8('0x2b')]('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0x22e8('0x2e'),'OrderBy',_0x22e8('0x30'),_0x22e8('0x31')],squel['select']()[_0x22e8('0x34')](_0x10e1c9)[_0x22e8('0x12')]('cm_hopper')[_0x22e8('0x13')](_0x22e8('0x35'),null,_0x22e8('0x4b'))['join'](_0x22e8('0x4c'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x22e8('0x15')](_0x22e8('0x4d'),_0x37c54f)[_0x22e8('0x15')](_0x22e8('0x38'),NOW))['toString']();}function insertCmContact(_0x45c0ff,_0x50b4e5,_0x4e61c4,_0x592b8f){var _0xbc23a=_[_0x22e8('0x4e')](_[_0x22e8('0x4f')](_0x592b8f),['ListId','CompanyId',_0x22e8('0x30'),_0x22e8('0x31')]);return squel[_0x22e8('0x2a')]()[_0x22e8('0x2b')](_0x22e8('0x35'))[_0x22e8('0x2d')](_0xbc23a,squel[_0x22e8('0x10')]()[_0x22e8('0x34')](_0xbc23a)[_0x22e8('0x12')](_0x50b4e5)[_0x22e8('0x15')]('('+_0x4e61c4[_0x22e8('0x13')](',')+_0x22e8('0x50'),squel[_0x22e8('0x10')]()[_0x22e8('0x34')](_0x4e61c4)[_0x22e8('0x12')](_0x22e8('0x35'))[_0x22e8('0x15')](_0x22e8('0x41'),_0x45c0ff)[_0x22e8('0x15')](_0x22e8('0x51')))[_0x22e8('0x15')](_0x22e8('0x52'),squel['select']()['field'](_0x22e8('0x53'),_0x22e8('0x54'))[_0x22e8('0x12')](_0x50b4e5)[_0x22e8('0x55')](_0x4e61c4[_0x22e8('0x13')](','))))['toString']();}function handleStop(){logger[_0x22e8('0x56')](_0x22e8('0x57'));stopped=!![];}function handleUncaughtException(_0x4c05e9){logger[_0x22e8('0x58')](_0x4c05e9[_0x22e8('0x59')]);process[_0x22e8('0x5a')](0x1);}function handleError(_0x4085a0,_0x271c41){stats[_0x22e8('0x5b')][_0x22e8('0x1b')]({'name':_0x271c41[_0x22e8('0x5c')],'message':_0x271c41[_0x22e8('0x59')],'row':_0x4085a0});}function handleQuery(_0x3fb0eb){logger[_0x22e8('0x56')](_0x3fb0eb);return db['sequelize'][_0x22e8('0x5d')](_0x3fb0eb)[_0x22e8('0x5e')](function(_0x381310){results[_0x22e8('0x1b')](_0x381310);})[_0x22e8('0x5f')](function(_0x126e33){logger['error'](_0x126e33[_0x22e8('0x59')]);});}function updateTzCampaigns(_0x1a4588){return new Promise(function(_0x7ad23d,_0x590988){var _0x41a632=squel[_0x22e8('0x10')]()['fields'](['campaigns.id',_0x22e8('0x60')])[_0x22e8('0x12')](_0x22e8('0x61'))[_0x22e8('0x13')]('campaigns_has_cm_lists',null,_0x22e8('0x62'))['where'](_0x22e8('0x63')+_0x1a4588);db[_0x22e8('0x64')][_0x22e8('0x5d')](_0x41a632['toString']())['spread'](function(_0x5a9185){var _0x19f20a=[];for(var _0x1f8f01=0x0;_0x1f8f01<_0x5a9185[_0x22e8('0x1a')];_0x1f8f01++){_0x19f20a[_0x22e8('0x1b')](getTimezoneData(_0x5a9185[_0x1f8f01],tmp_campaigns));}BPromise['all'](_0x19f20a)[_0x22e8('0x19')](function(){_0x7ad23d({'val':0x1});});})[_0x22e8('0x5f')](function(_0xbd39b7){logger[_0x22e8('0x58')](_0xbd39b7[_0x22e8('0x59')]);_0x7ad23d({'val':0x0});});});}function updateTzVoiceQueues(_0x40ca97){return new Promise(function(_0x45c175,_0x3828ac){var _0x3c1544=squel[_0x22e8('0x10')]()[_0x22e8('0x34')](['voice_queues.id',_0x22e8('0x65')])[_0x22e8('0x12')](_0x22e8('0x66'))[_0x22e8('0x13')]('voice_queues_has_cm_lists',null,_0x22e8('0x67'))[_0x22e8('0x15')](_0x22e8('0x68')+_0x40ca97);db['sequelize'][_0x22e8('0x5d')](_0x3c1544[_0x22e8('0x3c')]())[_0x22e8('0x5e')](function(_0x294e9a){var _0x2c2d0f=[];for(var _0x5e0ed1=0x0;_0x5e0ed1<_0x294e9a[_0x22e8('0x1a')];_0x5e0ed1++){_0x2c2d0f[_0x22e8('0x1b')](getTimezoneData(_0x294e9a[_0x5e0ed1],tmp_voice_queues));}BPromise[_0x22e8('0x1c')](_0x2c2d0f)[_0x22e8('0x19')](function(){_0x45c175({'val':0x1});});})[_0x22e8('0x5f')](function(_0x5a53d4){logger[_0x22e8('0x58')](_0x5a53d4[_0x22e8('0x59')]);_0x45c175({'val':0x0});});});}function getTimezoneData(_0x340fbd,_0x1ed58b){return new Promise(function(_0x32ecae,_0x3ce909){var _0x23b10d=shared[_0x22e8('0x69')];var _0x267543=_0x23b10d[_0x340fbd[_0x22e8('0x6a')]];if(_[_0x22e8('0x1e')](_0x267543)){_0x32ecae({'ret':0x1});}else{var _0x394db8=_0x267543[_0x22e8('0x6b')];var _0x4d28c4=squel[_0x22e8('0x2a')]()[_0x22e8('0x2b')](_0x1ed58b)[_0x22e8('0x6c')]('id',_0x340fbd['id'])[_0x22e8('0x6c')](_0x22e8('0x6d'),_0x394db8)[_0x22e8('0x6c')](_0x22e8('0x6a'),_0x340fbd['dialTimezone'])[_0x22e8('0x3c')]();return db[_0x22e8('0x64')][_0x22e8('0x5d')](_0x4d28c4)[_0x22e8('0x5e')](function(_0x3111d3){_0x32ecae({'ret':0x1});})[_0x22e8('0x5f')](function(_0x3284b8){logger[_0x22e8('0x58')](_0x3284b8[_0x22e8('0x59')]);_0x3ce909({'ret':0x1});});}});}function handleTZQuery(_0x1ead1b){logger['info'](_0x1ead1b);return db[_0x22e8('0x64')][_0x22e8('0x5d')](_0x1ead1b)[_0x22e8('0x5e')](function(_0x466d59){})['catch'](function(_0x8f9a6c){logger[_0x22e8('0x58')](_0x8f9a6c[_0x22e8('0x59')]);});}function main(_0x4e31a7,_0x4608dc,_0x370b60,_0x4e4ce1){logger[_0x22e8('0x56')]('main',_0x4e31a7,JSON[_0x22e8('0x6e')](_0x4608dc));process[_0x22e8('0x6f')](_0x22e8('0x70'));var _0x4200a0=_0x4608dc[_0x22e8('0x71')];var _0x126f2d=_['clone'](_0x4200a0);var _0x108bba=_0x4608dc['socket_timestamp'];var _0x589dfd=path[_0x22e8('0x13')](config[_0x22e8('0x72')],'server/files/tmp',_0x108bba+_0x22e8('0x73'));hasTZ=_[_0x22e8('0x4f')](_0x4200a0)[_0x22e8('0x74')](_0x22e8('0x6a'));var _0x5d8cdc=_['keys'](_0x4200a0)['join']();logger['info'](_0x22e8('0x75'),_0x5d8cdc);db['ContactItemType'][_0x22e8('0x17')]({'raw':!![],'attributes':['id',_0x22e8('0x76')]})[_0x22e8('0x19')](function(_0x1ba736){for(var _0x322efd=0x0;_0x322efd<_0x1ba736[_0x22e8('0x1a')];_0x322efd++){if(_0x1ba736[_0x322efd]['name']in _0x4200a0){contactItemTypes['push'](_0x1ba736[_0x322efd]);delete _0x126f2d[_0x1ba736[_0x322efd][_0x22e8('0x76')]];hasAdditionalPhones=!![];}for(var _0x5d24e1 in _0x4200a0){if(_0x1ba736[_0x322efd][_0x22e8('0x76')]+'_description'===_0x5d24e1){phoneDescriptions['push']({'itemTypeId':_0x1ba736[_0x322efd]['id'],'description':_0x5d24e1});delete _0x126f2d[_0x5d24e1];}}}if(hasAdditionalPhones)_0x126f2d['AdditionalPhones']='';var _0x366867=_[_0x22e8('0x4f')](_0x126f2d)[_0x22e8('0x13')]();logger[_0x22e8('0x56')](_0x22e8('0x75'),_0x366867);fs[_0x22e8('0x77')](_0x589dfd,_0x366867+'\x0a');Papa[_0x22e8('0x78')](fs[_0x22e8('0x79')](_0x4e31a7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x116aa2,_0x594a1d){try{for(var _0xe8cb9b=0x0,_0x507ac4=[];_0xe8cb9b<_0x116aa2['data'][_0x22e8('0x1a')];_0xe8cb9b++){stats['rows']+=0x1;if(_0x116aa2[_0x22e8('0x5b')][_0xe8cb9b]){handleError(_0x116aa2[_0x22e8('0x7a')][_0xe8cb9b],_0x116aa2[_0x22e8('0x5b')][_0xe8cb9b]);}else{var _0x21c1a6=[];var _0x5931b6=[];var _0x1fe97e={};for(var _0x1ed433 in _0x4200a0){let _0x2c89c0=contactItemTypes[_0x22e8('0x7b')](_0x44a8d6=>_0x44a8d6[_0x22e8('0x76')]===_0x1ed433);let _0x1f935a=contactItemTypes[_0x22e8('0x7b')](_0x21b7e3=>_0x21b7e3['name']+_0x22e8('0x7c')===_0x1ed433);if(_[_0x22e8('0x1e')](_0x2c89c0)&&_['isNil'](_0x1f935a)){if(_0x4200a0['hasOwnProperty'](_0x1ed433)){if(_0x116aa2['data'][_0xe8cb9b][_0x4200a0[_0x1ed433]]){var _0x1b5f19=_[_0x22e8('0x7d')](_0x116aa2['data'][_0xe8cb9b][_0x4200a0[_0x1ed433]][_0x22e8('0x7e')](/"/g,'\x27'));switch(_0x1ed433){case'scheduledat':var _0x484194=moment(_0x1b5f19,_0x22e8('0xe'),!![]);if(_0x484194[_0x22e8('0x7f')]()){_0x507ac4[_0x22e8('0x1b')]('\x22'+_0x1b5f19+'\x22');}else{_0x21c1a6[_0x22e8('0x1b')](_0x22e8('0x80'));}break;case _0x22e8('0x32'):var _0x20c3ea=parseInt(_0x1b5f19);_0x1b5f19=_[_0x22e8('0x81')](_0x20c3ea)||_0x20c3ea<0x0||_0x20c3ea>0x4?_0x4e4ce1?0x3:0x2:_0x20c3ea;_0x507ac4[_0x22e8('0x1b')]('\x22'+_0x1b5f19+'\x22');break;case _0x22e8('0x33'):var _0x403356=parseInt(_0x1b5f19);if(_['isNumber'](_0x403356)&&_[_0x22e8('0x74')](_0x370b60,_0x403356)){_0x507ac4[_0x22e8('0x1b')]('\x22'+_0x403356+'\x22');}else{_0x21c1a6[_0x22e8('0x1b')]('agent\x20not\x20exists');}break;case _0x22e8('0x82'):if(isEmail(_0x1b5f19)){_0x507ac4['push']('\x22'+_0x1b5f19+'\x22');}else{_0x21c1a6['push'](_0x22e8('0x83'));}break;case _0x22e8('0x84'):var _0x1b8f1e=moment(_0x1b5f19,'YYYY-MM-DD',!![]);if(_0x1b8f1e['isValid']()){_0x507ac4['push']('\x22'+_0x1b5f19+'\x22');}else{_0x21c1a6[_0x22e8('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x455766=shared[_0x22e8('0x69')];var _0x2daf0c=_0x455766[_0x1b5f19];if(!_[_0x22e8('0x1e')](_0x2daf0c)){var _0x27e509=_0x2daf0c['utcOffset'];_0x507ac4[_0x22e8('0x1b')]('\x22'+_0x1b5f19+'\x22');_0x507ac4[_0x22e8('0x1b')]('\x22'+_0x27e509+'\x22');}break;default:_0x507ac4['push']('\x22'+_0x1b5f19+'\x22');}}else{switch(_0x1ed433){case _0x22e8('0x85'):case'phone':_0x21c1a6[_0x22e8('0x1b')](_0x1ed433+_0x22e8('0x86'));break;default:_0x507ac4['push']('\x22\x22');}}}}else{var _0x298fba='';if(!_[_0x22e8('0x1e')](_0x2c89c0)){if(!_0x1fe97e[_0x22e8('0x87')](_0x2c89c0['id'])){if(!_[_0x22e8('0x1e')](_0x116aa2[_0x22e8('0x7a')][_0xe8cb9b][_0x4200a0[_0x1ed433]])){var _0x1b5f19=_[_0x22e8('0x7d')](_0x116aa2['data'][_0xe8cb9b][_0x4200a0[_0x1ed433]][_0x22e8('0x7e')](/"/g,'\x27'));var _0x2c724c=phoneDescriptions[_0x22e8('0x7b')](_0x134e3b=>_0x134e3b['itemTypeId']===_0x2c89c0['id']);if(!_[_0x22e8('0x1e')](_0x2c724c)){var _0x572588=_[_0x22e8('0x7d')](_0x116aa2[_0x22e8('0x7a')][_0xe8cb9b][_0x4200a0[_0x2c724c['description']]]['replace'](/"/g,'\x27'));if(!_[_0x22e8('0x1e')](_0x572588))_0x1b5f19=_0x1b5f19+'§'+_0x572588;}if(_0x298fba=='')_0x298fba=_0x1b5f19;else _0x298fba+='|'+_0x1b5f19;}_0x5931b6['push'](_0x2c89c0['id']+':'+_0x298fba);_0x1fe97e[_0x2c89c0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x507ac4[_0x22e8('0x1b')]('\x22'+_0x5931b6['join'](';')+'\x22');}if(_0x21c1a6[_0x22e8('0x1a')]){handleError(_0x116aa2[_0x22e8('0x7a')][_0xe8cb9b],{'code':_0x22e8('0x88'),'message':_0x21c1a6[_0x22e8('0x13')]()});}else{fs[_0x22e8('0x89')](_0x589dfd,_0x507ac4[_0x22e8('0x13')]()+'\x0a');}_0x507ac4=[];}if(!(stats['rows']%0xc8)){socket[_0x22e8('0x8a')](_0x22e8('0x8b')+_0x108bba,stats);stats['errors']=[];}}if(stopped){logger[_0x22e8('0x56')]('Abort\x20parser');_0x594a1d[_0x22e8('0x8c')]();}}catch(_0x5bb1ab){handleError(_0x116aa2[_0x22e8('0x7a')][_0xe8cb9b],{'code':_0x22e8('0x8d'),'message':_0x5bb1ab['message']});logger[_0x22e8('0x58')]('step',_0x5bb1ab[_0x22e8('0x59')]);}},'complete':function(){try{var _0x5c3360=[];var _0xf36950=[];var _0x409ec9='cm_contacts';if(_0x4608dc[_0x22e8('0x8e')]&&_0x4608dc[_0x22e8('0x8e')][_0x22e8('0x1a')]){_0x409ec9=_0x22e8('0x8f')+_0x108bba;_0x5c3360[_0x22e8('0x1b')](_0x22e8('0x90')+_0x409ec9+_0x22e8('0x91'));}tmp_campaigns='campaigns_'+_0x108bba;tmp_voice_queues=_0x22e8('0x92')+_0x108bba;_0xf36950['push']('CREATE\x20TABLE\x20'+tmp_campaigns+_0x22e8('0x93'));_0xf36950['push'](_0x22e8('0x90')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x22e8('0x94')](_0xf36950,handleTZQuery)[_0x22e8('0x19')](function(_0x4e6e15){updateTzCampaigns(_0x4608dc['ListId'])[_0x22e8('0x19')](function(_0x339bed){updateTzVoiceQueues(_0x4608dc[_0x22e8('0x2f')])[_0x22e8('0x19')](function(_0x382d2f){if(hasTZ)_0x366867=_0x366867[_0x22e8('0x7e')](_0x22e8('0x6a'),'dialTimezone,utcOffset');var _0x189815=util[_0x22e8('0xd')](_0x22e8('0x95'),_0x589dfd,_0x409ec9,_0x366867,_0x4608dc[_0x22e8('0x2f')],_0x4608dc[_0x22e8('0x96')]||null,NOW,NOW);if(_['isNil'](_0x4200a0[_0x22e8('0x45')])){_0x189815+=',\x20scheduledAt\x20=\x20NOW()';}_0x5c3360[_0x22e8('0x1b')](_0x189815);if(_0x4608dc[_0x22e8('0x8e')]&&_0x4608dc[_0x22e8('0x8e')]['length']){_0x5c3360[_0x22e8('0x1b')](insertCmContact(_0x4608dc['ListId'],_0x409ec9,_0x4608dc[_0x22e8('0x8e')],_0x4200a0));_0x5c3360[_0x22e8('0x1b')](_0x22e8('0x97')+_0x409ec9+';');}BPromise['each'](_0x5c3360,handleQuery)['then'](function(_0x2de806){BPromise[_0x22e8('0x1c')]([handleAdditionalPhones()])[_0x22e8('0x19')](function(){_0x5c3360=[];for(var _0x283c86=0x0;_0x283c86\x20\x20');}var _0x4a9652=path[_0x22e8('0x13')](config[_0x22e8('0x72')],'server/files/tmp',process[_0x22e8('0xa4')][0x2]);if(!fs[_0x22e8('0xa5')](_0x4a9652)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x25a6b0={};try{_0x25a6b0=JSON[_0x22e8('0x78')](process[_0x22e8('0xa4')][0x3]);if(!_0x25a6b0[_0x22e8('0x71')]){throw new Error(_0x22e8('0xa6'));}if(!_0x25a6b0[_0x22e8('0x71')][_0x22e8('0x2e')]){throw new Error(_0x22e8('0xa7'));}if(!_0x25a6b0[_0x22e8('0x71')][_0x22e8('0x85')]){throw new Error('firstName\x20is\x20mandatory');}var _0x22270e=0x0;if(_0x25a6b0[_0x22e8('0x71')][_0x22e8('0x33')]){_0x22270e=0x1;}if(!_0x25a6b0[_0x22e8('0x2f')]){throw new Error(_0x22e8('0xa8'));}}catch(_0x4451d9){throw new Error(_0x22e8('0xa9'));}var _0x1ecc85=[];try{_0x1ecc85=_['map'](JSON['parse'](process[_0x22e8('0xa4')][0x4]),'id');}catch(_0x56f5f2){logger[_0x22e8('0x56')](_0x22e8('0xaa'));}main(_0x4a9652,_0x25a6b0,_0x1ecc85,_0x22270e);}validate();process['on'](_0x22e8('0xab'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x5777=['from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','then','length','push','AdditionalPhones','split','filter','findOne','CmContactHasItem','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','scheduledat','cm_contacts.createdAt\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','MIN(id)','group','Received\x20SIGINT','error','message','exit','errors','code','info','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','voice_queues.id','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','all','timezones','utcOffset','set','offset','dialTimezone','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','keys','includes','header','name','parse','createReadStream','rows','data','find','_description','isNil','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment/shared','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field'];(function(_0x1fab69,_0x279ffd){var _0x1d8b67=function(_0x42ee2e){while(--_0x42ee2e){_0x1fab69['push'](_0x1fab69['shift']());}};_0x1d8b67(++_0x279ffd);}(_0x5777,0x15e));var _0x7577=function(_0x36e009,_0x2a869d){_0x36e009=_0x36e009-0x0;var _0x447dff=_0x5777[_0x36e009];return _0x447dff;};'use strict';var fs=require('fs');var path=require(_0x7577('0x0'));var _=require(_0x7577('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x7577('0x2'));var moment=require('moment');var squel=require(_0x7577('0x3'));var Redis=require(_0x7577('0x4'));var db=require(_0x7577('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0x7577('0x6'));var logger=require('../../../config/logger')('import');config[_0x7577('0x7')]=_[_0x7577('0x8')](config[_0x7577('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7577('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7577('0x9')](_0x7577('0xa'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7577('0x9')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x287076){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))*$/[_0x7577('0xb')](_0x287076);}function selectNotIn(_0x54896a,_0x2a8601,_0x5d67f9,_0x228877,_0x14b299){return squel[_0x7577('0xc')]()[_0x7577('0xd')]('phone')[_0x7577('0xe')](_0x228877)[_0x7577('0xf')](_0x2a8601,null,_0x2a8601+'.id\x20=\x20'+_0x228877+'.'+_0x5d67f9)[_0x7577('0x10')](_0x228877+'.'+_0x5d67f9+_0x7577('0x11')+_0x54896a+'.'+_0x5d67f9)[_0x7577('0x10')](_0x2a8601+_0x7577('0x12')+_0x14b299['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3bbb15,_0x2fcf81){promisesAdditionalPhones=[];return db['CmContact'][_0x7577('0x13')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7577('0x14')](function(_0x437328){if(_0x437328!==null){var _0x2d487c=[];for(var _0x4492a6=0x0;_0x4492a6<_0x437328[_0x7577('0x15')];_0x4492a6++){var _0x42aee8=_0x437328[_0x4492a6];_0x2d487c[_0x7577('0x16')](insertAdditionalPhones(_0x42aee8));}}Promise['all'](_0x2d487c)[_0x7577('0x14')](function(){_0x3bbb15({'val':0x1});});});});}function insertAdditionalPhones(_0x35bd4d){return new Promise(function(_0x34bbdb,_0x265df3){var _0x4eb2f6=_0x35bd4d[_0x7577('0x17')];var _0x48fd93=_0x4eb2f6[_0x7577('0x18')](';');var _0x5ba1a0=[];orderBy=0x0;for(var _0xee0714=0x0;_0xee0714<_0x48fd93[_0x7577('0x15')];_0xee0714++){_0x5ba1a0['push'](splitAdditionalPhone(_0x35bd4d['id'],_0x48fd93[_0xee0714]));}Promise['all'](_0x5ba1a0)[_0x7577('0x14')](function(){_0x34bbdb({'val':_0x48fd93[_0x7577('0x15')]});});});}function splitAdditionalPhone(_0x4a0cd7,_0xb345b6){return new Promise(function(_0x1af48a,_0xf052dc){var _0x261dab=_0xb345b6[_0x7577('0x18')](':');var _0x26e34d=_0x261dab[0x0];var _0x506044=_0x261dab[0x1];if(!_['isNil'](_0x506044)){var _0xece08=_0x506044['split']('|');var _0x566db5=[];for(var _0x1559ec=0x0;_0x1559ec<_0xece08['length'];_0x1559ec++){if(_0xece08[_0x1559ec]!==''){var _0xe13d21=_[_0x7577('0x19')](promisesAdditionalPhones,{'contactId':_0x4a0cd7,'phone':_0xece08[_0x1559ec]});if(_0xe13d21[_0x7577('0x15')]==0x0){orderBy++;promisesAdditionalPhones[_0x7577('0x16')]({'contactId':_0x4a0cd7,'contactTypeId':_0x26e34d,'phone':_0xece08[_0x1559ec],'orderBy':orderBy});}}}_0x1af48a({'ok':0x1});}else _0x1af48a({'res':0x0});});}function createAdditionalPhone(_0x5ae70e,_0x2dec0c,_0x610f99,_0x2004aa){var _0x349113='';var _0x5d42bc='';var _0x11f9cc=_0x610f99[_0x7577('0x18')]('§');_0x349113=_0x11f9cc[0x0];if(_0x11f9cc[_0x7577('0x15')]==0x2)_0x5d42bc=_0x11f9cc[0x1];return new Promise(function(_0xa90b51,_0x426573){return db['CmContactHasItem'][_0x7577('0x1a')]({'where':{'CmContactId':_0x5ae70e,'item':_0x349113}})[_0x7577('0x14')](function(_0x28aaa3){if(_0x28aaa3){return db[_0x7577('0x1b')]['update']({'ItemTypeId':_0x2dec0c,'description':_0x5d42bc,'OrderBy':_0x2004aa},{'where':{'CmContactId':_0x5ae70e,'item':_0x349113}})[_0x7577('0x14')](function(_0x398a2c){_0xa90b51({'res':'updated'});});}else{return db[_0x7577('0x1b')]['create']({'CmContactId':_0x5ae70e,'item':_0x349113,'description':_0x5d42bc,'ItemTypeId':_0x2dec0c,'OrderBy':_0x2004aa,'ItemClass':'PHONE'})[_0x7577('0x14')](function(_0xd47c7f){_0xa90b51({'res':_0x7577('0x1c')});});}});});}function insertCmHopper(_0x2dd367,_0x4a435b,_0x1bb8ec,_0x38ae4f,_0x5e4426){var _0x252804=[_0x7577('0x1d'),_0x7577('0x1e'),_0x7577('0x1f'),_0x7577('0x20'),_0x4a435b+'.'+_0x38ae4f,_0x7577('0x21'),_0x7577('0x22'),_0x7577('0x23'),'cm_contacts.UserId','\x22'+_0x5e4426+'\x22'];return squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x7577('0x26'))[_0x7577('0x27')]([_0x7577('0x28'),'scheduledat',_0x7577('0x29'),_0x7577('0x2a'),_0x38ae4f,_0x7577('0x2b'),_0x7577('0x2c'),_0x7577('0x2d'),_0x7577('0x2e'),_0x7577('0x2f')],squel[_0x7577('0xc')]()[_0x7577('0x30')](_0x252804)['from'](_0x4a435b)['join'](_0x7577('0x31'),null,_0x7577('0x32')+_0x4a435b+_0x7577('0x33'))[_0x7577('0xf')](_0x1bb8ec,null,_0x1bb8ec+_0x7577('0x34')+_0x4a435b+'.'+_0x38ae4f)['where'](_0x4a435b+_0x7577('0x35'),_0x2dd367)[_0x7577('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x7577('0x36'),selectNotIn(_0x4a435b,_0x1bb8ec,_0x38ae4f,'cm_hopper',[_0x7577('0x37'),_0x7577('0x38')]))[_0x7577('0x10')](_0x7577('0x36'),selectNotIn(_0x4a435b,_0x1bb8ec,_0x38ae4f,_0x7577('0x26'),[_0x7577('0x37')])))[_0x7577('0x39')]();}function insertCmHopperBlack(_0x188f32,_0x2b0311,_0x41aae1,_0x32980c){var _0x4fb7eb=[_0x7577('0x1d'),_0x7577('0x1f'),_0x7577('0x20'),_0x2b0311+'.'+_0x32980c,_0x7577('0x21'),_0x7577('0x22')];return squel['insert']()[_0x7577('0x25')]('cm_hopper_black')['fromQuery']([_0x7577('0x28'),_0x7577('0x29'),_0x7577('0x2a'),_0x32980c,'createdAt',_0x7577('0x2c')],squel[_0x7577('0xc')]()['fields'](_0x4fb7eb)['from'](_0x2b0311)[_0x7577('0xf')](_0x7577('0x31'),null,_0x7577('0x32')+_0x2b0311+_0x7577('0x33'))[_0x7577('0xf')](_0x41aae1,null,_0x41aae1+_0x7577('0x34')+_0x2b0311+'.'+_0x32980c)['where'](_0x2b0311+'.CmListId\x20=\x20?',_0x188f32)[_0x7577('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7577('0x10')](_0x7577('0x36'),squel[_0x7577('0xc')]()['field'](_0x7577('0x28'))[_0x7577('0xe')](_0x7577('0x3a'))[_0x7577('0x10')]('ListId\x20=\x20?',_0x188f32)[_0x7577('0x10')](_0x32980c+_0x7577('0x11')+_0x2b0311+'.'+_0x32980c)))[_0x7577('0x39')]();}function insertTzCmHopper(_0x54dcbb,_0xe3efcb,_0x4b16c9,_0x48096b,_0x351f6e,_0x40423c){var _0x127e08=['cm_contacts.phone',_0x7577('0x3b')+_0x40423c+'.offset-cm_contacts.utcOffset\x20minute)',_0x7577('0x1f'),_0x7577('0x20'),_0xe3efcb+'.'+_0x48096b,_0x7577('0x21'),_0x7577('0x22'),_0x7577('0x23'),'cm_contacts.UserId','\x22'+_0x351f6e+'\x22'];var _0x5aa9d8=squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x7577('0x26'))[_0x7577('0x27')]([_0x7577('0x28'),_0x7577('0x3c'),_0x7577('0x29'),'ListId',_0x48096b,_0x7577('0x2b'),'updatedAt',_0x7577('0x2d'),_0x7577('0x2e'),'recallme'],squel[_0x7577('0xc')]()[_0x7577('0x30')](_0x127e08)[_0x7577('0xe')](_0xe3efcb)[_0x7577('0xf')]('cm_contacts',null,_0x7577('0x32')+_0xe3efcb+'.CmListId')[_0x7577('0xf')](_0x4b16c9,null,_0x4b16c9+_0x7577('0x34')+_0xe3efcb+'.'+_0x48096b)[_0x7577('0xf')](_0x40423c,null,_0x40423c+'.id\x20=\x20'+_0xe3efcb+'.'+_0x48096b)[_0x7577('0x10')](_0xe3efcb+_0x7577('0x35'),_0x54dcbb)[_0x7577('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7577('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xe3efcb,_0x4b16c9,_0x48096b,'cm_hopper',['\x22always\x22',_0x7577('0x38')]))[_0x7577('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xe3efcb,_0x4b16c9,_0x48096b,_0x7577('0x26'),[_0x7577('0x37')])))[_0x7577('0x39')]();return _0x5aa9d8;}function insertTzCmHopperBlack(_0x36003d,_0x15c0c2,_0x1c9c05,_0x468aa5){var _0x180624=[_0x7577('0x1d'),_0x7577('0x1f'),_0x7577('0x20'),_0x15c0c2+'.'+_0x468aa5,_0x7577('0x21'),_0x7577('0x22')];return squel[_0x7577('0x24')]()['into'](_0x7577('0x3a'))[_0x7577('0x27')]([_0x7577('0x28'),_0x7577('0x29'),_0x7577('0x2a'),_0x468aa5,'createdAt',_0x7577('0x2c')],squel[_0x7577('0xc')]()['fields'](_0x180624)[_0x7577('0xe')](_0x15c0c2)[_0x7577('0xf')](_0x7577('0x31'),null,_0x7577('0x32')+_0x15c0c2+_0x7577('0x33'))['join'](_0x1c9c05,null,_0x1c9c05+_0x7577('0x34')+_0x15c0c2+'.'+_0x468aa5)[_0x7577('0x10')](_0x15c0c2+_0x7577('0x35'),_0x36003d)['where'](_0x7577('0x3d'),NOW)['where'](_0x7577('0x36'),squel[_0x7577('0xc')]()['field'](_0x7577('0x28'))[_0x7577('0xe')](_0x7577('0x3a'))[_0x7577('0x10')]('ListId\x20=\x20?',_0x36003d)[_0x7577('0x10')](_0x468aa5+_0x7577('0x11')+_0x15c0c2+'.'+_0x468aa5)))[_0x7577('0x39')]();}function insertCmHopperAdditionalPhones(_0x25c133){var _0x1b5a81=[_0x7577('0x3e'),_0x7577('0x3f'),'cm_contact_has_items.OrderBy',_0x7577('0x40'),_0x7577('0x41')];return squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x7577('0x42'))['fromQuery']([_0x7577('0x43'),_0x7577('0x28'),_0x7577('0x44'),_0x7577('0x2b'),'updatedAt'],squel[_0x7577('0xc')]()[_0x7577('0x30')](_0x1b5a81)['from']('cm_hopper')['join'](_0x7577('0x31'),null,_0x7577('0x45'))['join'](_0x7577('0x46'),null,_0x7577('0x47'))['where'](_0x7577('0x48'),_0x25c133)[_0x7577('0x10')](_0x7577('0x3d'),NOW))['toString']();}function insertCmContact(_0x3b0ef2,_0x2ec341,_0x53c509,_0x13ed2d){var _0x1ec5c0=_[_0x7577('0x49')](_['keys'](_0x13ed2d),[_0x7577('0x2a'),_0x7577('0x4a'),_0x7577('0x2b'),_0x7577('0x2c')]);return squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x7577('0x31'))['fromQuery'](_0x1ec5c0,squel['select']()[_0x7577('0x30')](_0x1ec5c0)[_0x7577('0xe')](_0x2ec341)['where']('('+_0x53c509['join'](',')+_0x7577('0x4b'),squel[_0x7577('0xc')]()[_0x7577('0x30')](_0x53c509)['from'](_0x7577('0x31'))['where'](_0x7577('0x4c'),_0x3b0ef2)[_0x7577('0x10')]('deletedAt\x20IS\x20NULL'))[_0x7577('0x10')]('id\x20IN\x20?',squel[_0x7577('0xc')]()[_0x7577('0xd')](_0x7577('0x4d'),'min_id')['from'](_0x2ec341)[_0x7577('0x4e')](_0x53c509[_0x7577('0xf')](','))))[_0x7577('0x39')]();}function handleStop(){logger['info'](_0x7577('0x4f'));stopped=!![];}function handleUncaughtException(_0x55e82e){logger[_0x7577('0x50')](_0x55e82e[_0x7577('0x51')]);process[_0x7577('0x52')](0x1);}function handleError(_0x1cdb04,_0x6d3093){stats[_0x7577('0x53')][_0x7577('0x16')]({'name':_0x6d3093[_0x7577('0x54')],'message':_0x6d3093[_0x7577('0x51')],'row':_0x1cdb04});}function handleQuery(_0x3c2dd7){logger[_0x7577('0x55')](_0x3c2dd7);return db['sequelize']['query'](_0x3c2dd7)[_0x7577('0x56')](function(_0x2a293c){results[_0x7577('0x16')](_0x2a293c);})[_0x7577('0x57')](function(_0x21074a){logger['error'](_0x21074a[_0x7577('0x51')]);});}function updateTzCampaigns(_0x51b0ce){return new Promise(function(_0x726cff,_0x8d062c){var _0x1ad4a5=squel['select']()[_0x7577('0x30')]([_0x7577('0x58'),_0x7577('0x59')])[_0x7577('0xe')](_0x7577('0x5a'))[_0x7577('0xf')](_0x7577('0x5b'),null,_0x7577('0x5c'))['where'](_0x7577('0x5d')+_0x51b0ce);db[_0x7577('0x5e')][_0x7577('0x5f')](_0x1ad4a5['toString']())[_0x7577('0x56')](function(_0x3b9523){var _0x4ab8d9=[];for(var _0x4ed6fa=0x0;_0x4ed6fa<_0x3b9523[_0x7577('0x15')];_0x4ed6fa++){_0x4ab8d9[_0x7577('0x16')](getTimezoneData(_0x3b9523[_0x4ed6fa],tmp_campaigns));}BPromise['all'](_0x4ab8d9)[_0x7577('0x14')](function(){_0x726cff({'val':0x1});});})[_0x7577('0x57')](function(_0x64e3a1){logger[_0x7577('0x50')](_0x64e3a1[_0x7577('0x51')]);_0x726cff({'val':0x0});});});}function updateTzVoiceQueues(_0x309758){return new Promise(function(_0x398b1c,_0x18f526){var _0x643df8=squel['select']()['fields']([_0x7577('0x60'),'voice_queues.dialTimezone'])['from'](_0x7577('0x61'))[_0x7577('0xf')]('voice_queues_has_cm_lists',null,_0x7577('0x62'))[_0x7577('0x10')](_0x7577('0x63')+_0x309758);db[_0x7577('0x5e')][_0x7577('0x5f')](_0x643df8[_0x7577('0x39')]())[_0x7577('0x56')](function(_0x1f614a){var _0x794b70=[];for(var _0x17369b=0x0;_0x17369b<_0x1f614a[_0x7577('0x15')];_0x17369b++){_0x794b70['push'](getTimezoneData(_0x1f614a[_0x17369b],tmp_voice_queues));}BPromise[_0x7577('0x64')](_0x794b70)[_0x7577('0x14')](function(){_0x398b1c({'val':0x1});});})[_0x7577('0x57')](function(_0x57b348){logger[_0x7577('0x50')](_0x57b348[_0x7577('0x51')]);_0x398b1c({'val':0x0});});});}function getTimezoneData(_0x5c791d,_0x389642){return new Promise(function(_0x1df380,_0x539716){var _0x45c8f=shared[_0x7577('0x65')];var _0x471202=_0x45c8f[_0x5c791d['dialTimezone']];if(_['isNil'](_0x471202)){_0x1df380({'ret':0x1});}else{var _0x2b3dcd=_0x471202[_0x7577('0x66')];var _0x24f26f=squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x389642)[_0x7577('0x67')]('id',_0x5c791d['id'])[_0x7577('0x67')](_0x7577('0x68'),_0x2b3dcd)[_0x7577('0x67')](_0x7577('0x69'),_0x5c791d['dialTimezone'])[_0x7577('0x39')]();return db['sequelize'][_0x7577('0x5f')](_0x24f26f)[_0x7577('0x56')](function(_0x3ca534){_0x1df380({'ret':0x1});})[_0x7577('0x57')](function(_0x5463bd){logger[_0x7577('0x50')](_0x5463bd['message']);_0x539716({'ret':0x1});});}});}function handleTZQuery(_0xcf3b2c){logger['info'](_0xcf3b2c);return db[_0x7577('0x5e')][_0x7577('0x5f')](_0xcf3b2c)[_0x7577('0x56')](function(_0x543df1){})[_0x7577('0x57')](function(_0x6f0c13){logger[_0x7577('0x50')](_0x6f0c13['message']);});}function main(_0x2146b7,_0xcb3862,_0x2bb041,_0x54b9ee){logger[_0x7577('0x55')](_0x7577('0x6a'),_0x2146b7,JSON[_0x7577('0x6b')](_0xcb3862));process[_0x7577('0x6c')](_0x7577('0x6d'));var _0x5dda19=_0xcb3862[_0x7577('0x6e')];var _0x3ad449=_[_0x7577('0x6f')](_0x5dda19);var _0x3088cb=_0xcb3862['socket_timestamp'];var _0x3e9bf9=path[_0x7577('0xf')](config[_0x7577('0x70')],_0x7577('0x71'),_0x3088cb+_0x7577('0x72'));hasTZ=_[_0x7577('0x73')](_0x5dda19)[_0x7577('0x74')](_0x7577('0x69'));var _0x5e0303=_[_0x7577('0x73')](_0x5dda19)[_0x7577('0xf')]();logger[_0x7577('0x55')](_0x7577('0x75'),_0x5e0303);db['ContactItemType'][_0x7577('0x13')]({'raw':!![],'attributes':['id','name']})[_0x7577('0x14')](function(_0x131875){for(var _0x406e58=0x0;_0x406e58<_0x131875[_0x7577('0x15')];_0x406e58++){if(_0x131875[_0x406e58]['name']in _0x5dda19){contactItemTypes[_0x7577('0x16')](_0x131875[_0x406e58]);delete _0x3ad449[_0x131875[_0x406e58]['name']];hasAdditionalPhones=!![];}for(var _0x33b3ca in _0x5dda19){if(_0x131875[_0x406e58][_0x7577('0x76')]+'_description'===_0x33b3ca){phoneDescriptions[_0x7577('0x16')]({'itemTypeId':_0x131875[_0x406e58]['id'],'description':_0x33b3ca});delete _0x3ad449[_0x33b3ca];}}}if(hasAdditionalPhones)_0x3ad449[_0x7577('0x17')]='';var _0x5ed0f4=_['keys'](_0x3ad449)[_0x7577('0xf')]();logger[_0x7577('0x55')](_0x7577('0x75'),_0x5ed0f4);fs['writeFileSync'](_0x3e9bf9,_0x5ed0f4+'\x0a');Papa[_0x7577('0x77')](fs[_0x7577('0x78')](_0x2146b7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30b85d,_0x6c8018){try{for(var _0x2da792=0x0,_0x2f5174=[];_0x2da792<_0x30b85d['data'][_0x7577('0x15')];_0x2da792++){stats[_0x7577('0x79')]+=0x1;if(_0x30b85d[_0x7577('0x53')][_0x2da792]){handleError(_0x30b85d[_0x7577('0x7a')][_0x2da792],_0x30b85d['errors'][_0x2da792]);}else{var _0x29ff44=[];var _0x27168e=[];var _0x34fa7a={};for(var _0x2e25f0 in _0x5dda19){let _0x468dc6=contactItemTypes[_0x7577('0x7b')](_0x42843c=>_0x42843c[_0x7577('0x76')]===_0x2e25f0);let _0x153146=contactItemTypes[_0x7577('0x7b')](_0x4544db=>_0x4544db['name']+_0x7577('0x7c')===_0x2e25f0);if(_['isNil'](_0x468dc6)&&_[_0x7577('0x7d')](_0x153146)){if(_0x5dda19[_0x7577('0x7e')](_0x2e25f0)){if(_0x30b85d[_0x7577('0x7a')][_0x2da792][_0x5dda19[_0x2e25f0]]){var _0xc4609c=_[_0x7577('0x7f')](_0x30b85d['data'][_0x2da792][_0x5dda19[_0x2e25f0]][_0x7577('0x80')](/"/g,'\x27'));switch(_0x2e25f0){case'scheduledat':var _0x192cc7=moment(_0xc4609c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x192cc7['isValid']()){_0x2f5174[_0x7577('0x16')]('\x22'+_0xc4609c+'\x22');}else{_0x29ff44['push'](_0x7577('0x81'));}break;case'priority':var _0xc480be=parseInt(_0xc4609c);_0xc4609c=_[_0x7577('0x82')](_0xc480be)||_0xc480be<0x0||_0xc480be>0x4?_0x54b9ee?0x3:0x2:_0xc480be;_0x2f5174[_0x7577('0x16')]('\x22'+_0xc4609c+'\x22');break;case _0x7577('0x2e'):var _0xa2a0a0=parseInt(_0xc4609c);if(_[_0x7577('0x83')](_0xa2a0a0)&&_[_0x7577('0x74')](_0x2bb041,_0xa2a0a0)){_0x2f5174['push']('\x22'+_0xa2a0a0+'\x22');}else{_0x29ff44[_0x7577('0x16')]('agent\x20not\x20exists');}break;case _0x7577('0x84'):if(isEmail(_0xc4609c)){_0x2f5174['push']('\x22'+_0xc4609c+'\x22');}else{_0x29ff44[_0x7577('0x16')](_0x7577('0x85'));}break;case _0x7577('0x86'):var _0x48932b=moment(_0xc4609c,_0x7577('0x87'),!![]);if(_0x48932b[_0x7577('0x88')]()){_0x2f5174['push']('\x22'+_0xc4609c+'\x22');}else{_0x29ff44[_0x7577('0x16')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x7577('0x69'):var _0x5395fd=shared[_0x7577('0x65')];var _0x1dff77=_0x5395fd[_0xc4609c];if(!_[_0x7577('0x7d')](_0x1dff77)){var _0x1f6173=_0x1dff77['utcOffset'];_0x2f5174[_0x7577('0x16')]('\x22'+_0xc4609c+'\x22');_0x2f5174[_0x7577('0x16')]('\x22'+_0x1f6173+'\x22');}break;default:_0x2f5174['push']('\x22'+_0xc4609c+'\x22');}}else{switch(_0x2e25f0){case _0x7577('0x89'):case'phone':_0x29ff44[_0x7577('0x16')](_0x2e25f0+_0x7577('0x8a'));break;default:_0x2f5174[_0x7577('0x16')]('\x22\x22');}}}}else{var _0x433e62='';if(!_[_0x7577('0x7d')](_0x468dc6)){if(!_0x34fa7a[_0x7577('0x7e')](_0x468dc6['id'])){if(!_[_0x7577('0x7d')](_0x30b85d[_0x7577('0x7a')][_0x2da792][_0x5dda19[_0x2e25f0]])){var _0xc4609c=_[_0x7577('0x7f')](_0x30b85d[_0x7577('0x7a')][_0x2da792][_0x5dda19[_0x2e25f0]][_0x7577('0x80')](/"/g,'\x27'));var _0x28dd5a=phoneDescriptions[_0x7577('0x7b')](_0x4442f1=>_0x4442f1[_0x7577('0x8b')]===_0x468dc6['id']);if(!_[_0x7577('0x7d')](_0x28dd5a)){var _0x343b6b=_[_0x7577('0x7f')](_0x30b85d['data'][_0x2da792][_0x5dda19[_0x28dd5a[_0x7577('0x8c')]]][_0x7577('0x80')](/"/g,'\x27'));if(!_[_0x7577('0x7d')](_0x343b6b))_0xc4609c=_0xc4609c+'§'+_0x343b6b;}if(_0x433e62=='')_0x433e62=_0xc4609c;else _0x433e62+='|'+_0xc4609c;}_0x27168e['push'](_0x468dc6['id']+':'+_0x433e62);_0x34fa7a[_0x468dc6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2f5174[_0x7577('0x16')]('\x22'+_0x27168e['join'](';')+'\x22');}if(_0x29ff44[_0x7577('0x15')]){handleError(_0x30b85d[_0x7577('0x7a')][_0x2da792],{'code':_0x7577('0x8d'),'message':_0x29ff44['join']()});}else{fs[_0x7577('0x8e')](_0x3e9bf9,_0x2f5174[_0x7577('0xf')]()+'\x0a');}_0x2f5174=[];}if(!(stats[_0x7577('0x79')]%0xc8)){socket[_0x7577('0x8f')]('contact:import:'+_0x3088cb,stats);stats['errors']=[];}}if(stopped){logger[_0x7577('0x55')](_0x7577('0x90'));_0x6c8018[_0x7577('0x91')]();}}catch(_0x468e1a){handleError(_0x30b85d[_0x7577('0x7a')][_0x2da792],{'code':_0x7577('0x92'),'message':_0x468e1a[_0x7577('0x51')]});logger['error'](_0x7577('0x93'),_0x468e1a['message']);}},'complete':function(){try{var _0x43a094=[];var _0x2cf52c=[];var _0x3604c3=_0x7577('0x31');if(_0xcb3862[_0x7577('0x94')]&&_0xcb3862[_0x7577('0x94')][_0x7577('0x15')]){_0x3604c3=_0x7577('0x95')+_0x3088cb;_0x43a094['push'](_0x7577('0x96')+_0x3604c3+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x7577('0x97')+_0x3088cb;tmp_voice_queues=_0x7577('0x98')+_0x3088cb;_0x2cf52c['push'](_0x7577('0x96')+tmp_campaigns+_0x7577('0x99'));_0x2cf52c[_0x7577('0x16')](_0x7577('0x96')+tmp_voice_queues+_0x7577('0x99'));BPromise[_0x7577('0x9a')](_0x2cf52c,handleTZQuery)[_0x7577('0x14')](function(_0x5cd3aa){updateTzCampaigns(_0xcb3862['ListId'])[_0x7577('0x14')](function(_0x110427){updateTzVoiceQueues(_0xcb3862['ListId'])['then'](function(_0x569a05){if(hasTZ)_0x5ed0f4=_0x5ed0f4['replace'](_0x7577('0x69'),_0x7577('0x9b'));var _0x20274d=util[_0x7577('0x9')](_0x7577('0x9c'),_0x3e9bf9,_0x3604c3,_0x5ed0f4,_0xcb3862['ListId'],_0xcb3862[_0x7577('0x4a')]||null,NOW,NOW);if(_[_0x7577('0x7d')](_0x5dda19['scheduledat'])){_0x20274d+=_0x7577('0x9d');}_0x43a094[_0x7577('0x16')](_0x20274d);if(_0xcb3862[_0x7577('0x94')]&&_0xcb3862[_0x7577('0x94')][_0x7577('0x15')]){_0x43a094[_0x7577('0x16')](insertCmContact(_0xcb3862['ListId'],_0x3604c3,_0xcb3862[_0x7577('0x94')],_0x5dda19));_0x43a094['push'](_0x7577('0x9e')+_0x3604c3+';');}BPromise[_0x7577('0x9a')](_0x43a094,handleQuery)[_0x7577('0x14')](function(_0x5530f5){BPromise['all']([handleAdditionalPhones()])[_0x7577('0x14')](function(){_0x43a094=[];for(var _0x261c9f=0x0;_0x261c9f\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','where','\x20=\x20','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','message','split','length','CmContactHasItem','findOne','create','PHONE','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt'];(function(_0x4e586a,_0x1ed058){var _0x32139c=function(_0x31d77e){while(--_0x31d77e){_0x4e586a['push'](_0x4e586a['shift']());}};_0x32139c(++_0x1ed058);}(_0x4e52,0x6e));var _0x24e5=function(_0x5a673d,_0x105505){_0x5a673d=_0x5a673d-0x0;var _0x56e9d1=_0x4e52[_0x5a673d];return _0x56e9d1;};'use strict';var fs=require('fs');var path=require(_0x24e5('0x0'));var _=require(_0x24e5('0x1'));var Papa=require(_0x24e5('0x2'));var util=require(_0x24e5('0x3'));var BPromise=require(_0x24e5('0x4'));var moment=require('moment');var squel=require(_0x24e5('0x5'));var Redis=require(_0x24e5('0x6'));var db=require(_0x24e5('0x7'))['db'];var config=require(_0x24e5('0x8'));var logger=require('../../../config/logger')(_0x24e5('0x9'));config[_0x24e5('0xa')]=_['defaults'](config[_0x24e5('0xa')],{'host':_0x24e5('0xb'),'port':0x18eb});var socket=require(_0x24e5('0xc'))(new Redis(config[_0x24e5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x24e5('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x24e5('0xe')+moment()[_0x24e5('0xd')](_0x24e5('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xa54104){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))*$/[_0x24e5('0x10')](_0xa54104);}function selectNotIn(_0x592e36,_0x4936b2,_0x29618d,_0x8bf265,_0x7e294a){return squel[_0x24e5('0x11')]()[_0x24e5('0x12')](_0x24e5('0x13'))[_0x24e5('0x14')](_0x8bf265)[_0x24e5('0x15')](_0x4936b2,null,_0x4936b2+'.id\x20=\x20'+_0x8bf265+'.'+_0x29618d)[_0x24e5('0x16')](_0x8bf265+'.'+_0x29618d+_0x24e5('0x17')+_0x592e36+'.'+_0x29618d)[_0x24e5('0x16')](_0x4936b2+'.dialCheckDuplicateType\x20IN\x20('+_0x7e294a[_0x24e5('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5594de,_0x1f2841){promisesAdditionalPhones=[];promisesContact=[];return db[_0x24e5('0x18')][_0x24e5('0x19')](_0x24e5('0x1a')+tempTableName)[_0x24e5('0x1b')](function(_0x4d0a39){if(_0x4d0a39!==null){var _0x480887=[];for(var _0x1c1a6b=0x0;_0x1c1a6b<_0x4d0a39['length'];_0x1c1a6b++){var _0x23c492=_0x4d0a39[_0x1c1a6b];if(!_[_0x24e5('0x1c')](_0x23c492['phone'])){if(!_[_0x24e5('0x1c')](_0x23c492[_0x24e5('0x1d')]))_0x480887[_0x24e5('0x1e')](insertAdditionalPhones(_0x23c492));promisesContact[_0x24e5('0x1e')]({'contact':_0x23c492});}}}Promise[_0x24e5('0x1f')](_0x480887)[_0x24e5('0x20')](function(){_0x5594de({'val':0x1});});})[_0x24e5('0x21')](function(_0x9a007f){logger['error'](_0x9a007f[_0x24e5('0x22')]);});});}function insertAdditionalPhones(_0x1d307e){return new Promise(function(_0x461fb1,_0x20fdaa){var _0x67ee8=_0x1d307e[_0x24e5('0x1d')];if(_[_0x24e5('0x1c')](_0x67ee8))_0x20fdaa({'val':0x0});else{var _0xce344e=_0x67ee8[_0x24e5('0x23')](';');var _0x102157=[];orderBy=0x0;for(var _0x3625f7=0x0;_0x3625f7<_0xce344e[_0x24e5('0x24')];_0x3625f7++){_0x102157[_0x24e5('0x1e')](splitAdditionalPhone(_0x1d307e['id'],_0xce344e[_0x3625f7]));}Promise[_0x24e5('0x1f')](_0x102157)['then'](function(){_0x461fb1({'val':_0xce344e[_0x24e5('0x24')]});});}});}function splitAdditionalPhone(_0x22e3aa,_0x4d567a){return new Promise(function(_0x19e1cd,_0x48703f){var _0x4ac163=_0x4d567a['split'](':');var _0x4a7415=_0x4ac163[0x0];var _0x4160f1=_0x4ac163[0x1];if(_0x4160f1!==''){var _0x12d1ac=_0x4160f1[_0x24e5('0x23')]('|');var _0x30693a=[];for(var _0x5d186f=0x0;_0x5d186f<_0x12d1ac[_0x24e5('0x24')];_0x5d186f++){if(_0x12d1ac[_0x5d186f]!==''){var _0x3d7e02=_['filter'](promisesAdditionalPhones,{'contactId':_0x22e3aa,'phone':_0x12d1ac[_0x5d186f]});if(_0x3d7e02[_0x24e5('0x24')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x22e3aa,'contactTypeId':_0x4a7415,'phone':_0x12d1ac[_0x5d186f],'orderBy':orderBy});}}}_0x19e1cd({'ok':0x1});}else _0x19e1cd({'res':0x0});});}function createAdditionalPhone(_0x295639,_0x45ea8e,_0x2a81ff,_0x28214c){var _0x1a3874='';var _0x41e977='';var _0x2882db=_0x2a81ff[_0x24e5('0x23')]('§');_0x1a3874=_0x2882db[0x0];if(_0x2882db[_0x24e5('0x24')]==0x2)_0x41e977=_0x2882db[0x1];return new Promise(function(_0x31b51b,_0x33325e){return db[_0x24e5('0x25')][_0x24e5('0x26')]({'where':{'CmContactId':_0x295639,'item':_0x1a3874}})['then'](function(_0x3f4430){if(_0x3f4430){return db[_0x24e5('0x25')]['update']({'ItemTypeId':_0x45ea8e,'description':_0x41e977,'OrderBy':_0x28214c},{'where':{'CmContactId':_0x295639,'item':_0x1a3874}})[_0x24e5('0x20')](function(_0x1794c5){_0x31b51b({'res':'updated'});});}else{return db[_0x24e5('0x25')][_0x24e5('0x27')]({'CmContactId':_0x295639,'item':_0x1a3874,'ItemTypeId':_0x45ea8e,'description':_0x41e977,'OrderBy':_0x28214c,'ItemClass':_0x24e5('0x28')})[_0x24e5('0x20')](function(_0x13a945){_0x31b51b({'res':'inserted'});});}});});}function updateContact(_0x213990){return new Promise(function(_0x3d903b,_0x26f5c5){var _0x9c2de6=_0x213990['id'];delete _0x213990['id'];return db['CmContact'][_0x24e5('0x29')](_0x213990,{'where':{'id':_0x9c2de6}})[_0x24e5('0x20')](function(_0x5e945d){updatedRows+=0x1;return db[_0x24e5('0x2a')][_0x24e5('0x29')]({'phone':_0x213990[_0x24e5('0x13')]},{'where':{'ContactId':_0x9c2de6}})[_0x24e5('0x20')](function(_0x470e90){_0x3d903b({'ret':'OK'});});});});}function insertCmHopper(_0x4d6674,_0x50ba56,_0x2814df,_0x17bb54,_0x48a829){var _0x5aafd9=[_0x24e5('0x2b'),_0x24e5('0x2c'),_0x24e5('0x2d'),_0x24e5('0x2e'),_0x50ba56+'.'+_0x17bb54,_0x24e5('0x2f'),_0x24e5('0x30'),_0x24e5('0x31'),_0x24e5('0x32'),'\x22'+_0x48a829+'\x22'];return squel['insert']()['into'](_0x24e5('0x33'))[_0x24e5('0x34')](['phone','scheduledat',_0x24e5('0x35'),'ListId',_0x17bb54,'createdAt',_0x24e5('0x36'),'priority','UserId',_0x24e5('0x37')],squel['select']()['fields'](_0x5aafd9)[_0x24e5('0x14')](_0x50ba56)['join'](_0x24e5('0x38'),null,_0x24e5('0x39')+_0x50ba56+_0x24e5('0x3a'))[_0x24e5('0x15')](_0x2814df,null,_0x2814df+_0x24e5('0x3b')+_0x50ba56+'.'+_0x17bb54)[_0x24e5('0x16')](_0x50ba56+_0x24e5('0x3c'),_0x4d6674)['where'](_0x24e5('0x3d'),NOW)['where'](_0x24e5('0x3e'),selectNotIn(_0x50ba56,_0x2814df,_0x17bb54,_0x24e5('0x33'),['\x22always\x22',_0x24e5('0x3f')]))[_0x24e5('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x50ba56,_0x2814df,_0x17bb54,'cm_hopper',[_0x24e5('0x40')])))[_0x24e5('0x41')]();}function insertCmHopperBlack(_0x5ba17e,_0x3d5513,_0x8a0f1e,_0x394e6e){var _0x2058ba=[_0x24e5('0x2b'),_0x24e5('0x2d'),'cm_contacts.ListId',_0x3d5513+'.'+_0x394e6e,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x24e5('0x42')]()[_0x24e5('0x43')]('cm_hopper_black')[_0x24e5('0x34')]([_0x24e5('0x13'),_0x24e5('0x35'),_0x24e5('0x44'),_0x394e6e,_0x24e5('0x45'),_0x24e5('0x36')],squel[_0x24e5('0x11')]()[_0x24e5('0x46')](_0x2058ba)[_0x24e5('0x14')](_0x3d5513)[_0x24e5('0x15')](_0x24e5('0x38'),null,_0x24e5('0x39')+_0x3d5513+_0x24e5('0x3a'))[_0x24e5('0x15')](_0x8a0f1e,null,_0x8a0f1e+'.id\x20=\x20'+_0x3d5513+'.'+_0x394e6e)[_0x24e5('0x16')](_0x3d5513+'.CmListId\x20=\x20?',_0x5ba17e)['where'](_0x24e5('0x3d'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x24e5('0x11')]()['field']('phone')[_0x24e5('0x14')](_0x24e5('0x47'))['where'](_0x24e5('0x48'),_0x5ba17e)[_0x24e5('0x16')](_0x394e6e+_0x24e5('0x49'),_0x3d5513+'.'+_0x394e6e)))[_0x24e5('0x41')]();}function insertCmHopperAdditionalPhones(_0xee2517){var _0x4a4dc7=[_0x24e5('0x4a'),_0x24e5('0x4b'),_0x24e5('0x4c'),_0x24e5('0x4d'),_0x24e5('0x4e')];return squel[_0x24e5('0x42')]()[_0x24e5('0x43')](_0x24e5('0x4f'))[_0x24e5('0x34')]([_0x24e5('0x50'),_0x24e5('0x13'),_0x24e5('0x51'),'createdAt','updatedAt'],squel[_0x24e5('0x11')]()[_0x24e5('0x46')](_0x4a4dc7)[_0x24e5('0x14')](_0x24e5('0x33'))[_0x24e5('0x15')](_0x24e5('0x38'),null,_0x24e5('0x52'))[_0x24e5('0x15')](_0x24e5('0x53'),null,_0x24e5('0x54'))['where'](_0x24e5('0x55'),_0xee2517)[_0x24e5('0x16')](_0x24e5('0x3d'),NOW))[_0x24e5('0x41')]();}function insertCmContact(_0x5c0d48,_0x20f552,_0x4870a3,_0x488fba){var _0x33b880=_['concat'](_[_0x24e5('0x56')](_0x488fba),[_0x24e5('0x44'),_0x24e5('0x57'),_0x24e5('0x45'),'updatedAt']);return squel[_0x24e5('0x42')]()['into']('cm_contacts')[_0x24e5('0x34')](_0x33b880,squel['select']()[_0x24e5('0x46')](_0x33b880)['from'](_0x20f552)[_0x24e5('0x16')]('('+_0x4870a3[_0x24e5('0x15')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x24e5('0x46')](_0x4870a3)[_0x24e5('0x14')]('cm_contacts')[_0x24e5('0x16')](_0x24e5('0x48'),_0x5c0d48))[_0x24e5('0x16')](_0x24e5('0x58'),squel[_0x24e5('0x11')]()[_0x24e5('0x12')]('MIN(id)',_0x24e5('0x59'))[_0x24e5('0x14')](_0x20f552)['group'](_0x4870a3['join'](','))))['toString']();}function handleStop(){logger[_0x24e5('0x5a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x11cd58){logger[_0x24e5('0x5b')](_0x11cd58[_0x24e5('0x22')]);process['exit'](0x1);}function handleError(_0x39e919,_0x7217e5){stats['errors'][_0x24e5('0x1e')]({'name':_0x7217e5[_0x24e5('0x5c')],'message':_0x7217e5['message'],'row':_0x39e919});}function handleQuery(_0x32d317){logger[_0x24e5('0x5a')](_0x32d317);return db[_0x24e5('0x18')][_0x24e5('0x19')](_0x32d317)[_0x24e5('0x1b')](function(_0x441b70){results[_0x24e5('0x1e')](_0x441b70);})[_0x24e5('0x21')](function(_0x467dce){logger[_0x24e5('0x5b')](_0x467dce[_0x24e5('0x22')]);});}function main(_0x10c768,_0x56ff1c,_0x1efd85,_0x686aa5){logger[_0x24e5('0x5a')]('main',_0x10c768,JSON['stringify'](_0x56ff1c));process[_0x24e5('0x5d')](_0x24e5('0x5e'));var _0x5f4623=_0x56ff1c[_0x24e5('0x5f')];var _0x238651=_[_0x24e5('0x60')](_0x5f4623);var _0x4f180d=_0x56ff1c[_0x24e5('0x61')];var _0x4e8ea8=path[_0x24e5('0x15')](config[_0x24e5('0x62')],_0x24e5('0x63'),_0x4f180d+_0x24e5('0x64'));logger[_0x24e5('0x5a')](_0x24e5('0x65'),_0x56ff1c);db['ContactItemType'][_0x24e5('0x66')]({'raw':!![],'attributes':['id',_0x24e5('0x67')]})[_0x24e5('0x20')](function(_0x1fddd0){for(var _0x315100=0x0;_0x315100<_0x1fddd0[_0x24e5('0x24')];_0x315100++){if(_0x1fddd0[_0x315100]['name']in _0x5f4623){contactItemTypes[_0x24e5('0x1e')](_0x1fddd0[_0x315100]);delete _0x238651[_0x1fddd0[_0x315100][_0x24e5('0x67')]];hasAdditionalPhones=!![];}for(var _0x27c879 in _0x5f4623){if(_0x1fddd0[_0x315100][_0x24e5('0x67')]+'_description'===_0x27c879){phoneDescriptions[_0x24e5('0x1e')]({'itemTypeId':_0x1fddd0[_0x315100]['id'],'description':_0x27c879});delete _0x238651[_0x27c879];}}}if(hasAdditionalPhones)_0x238651['AdditionalPhones']='';var _0x21f6d7=_[_0x24e5('0x56')](_0x238651)[_0x24e5('0x15')]();logger[_0x24e5('0x5a')](_0x24e5('0x68'),_0x21f6d7);fs[_0x24e5('0x69')](_0x4e8ea8,_0x21f6d7+'\x0a');Papa[_0x24e5('0x6a')](fs['createReadStream'](_0x10c768),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5acf08,_0x2d6b9d){try{for(var _0x35864b=0x0,_0x1e66ad=[];_0x35864b<_0x5acf08[_0x24e5('0x6b')][_0x24e5('0x24')];_0x35864b++){stats[_0x24e5('0x6c')]+=0x1;if(_0x5acf08['errors'][_0x35864b]){handleError(_0x5acf08[_0x24e5('0x6b')][_0x35864b],_0x5acf08['errors'][_0x35864b]);}else{var _0x3ff91e=[];var _0x3d143d=[];var _0x167737={};for(var _0x5b4da2 in _0x5f4623){let _0x464ed9=contactItemTypes['find'](_0x4363c2=>_0x4363c2[_0x24e5('0x67')]===_0x5b4da2);let _0x547107=contactItemTypes['find'](_0x5c7b72=>_0x5c7b72[_0x24e5('0x67')]+_0x24e5('0x6d')===_0x5b4da2);if(_[_0x24e5('0x1c')](_0x464ed9)&&_[_0x24e5('0x1c')](_0x547107)){if(_0x5f4623[_0x24e5('0x6e')](_0x5b4da2)){if(_0x5acf08[_0x24e5('0x6b')][_0x35864b][_0x5f4623[_0x5b4da2]]){var _0x30539f=_['trim'](_0x5acf08['data'][_0x35864b][_0x5f4623[_0x5b4da2]][_0x24e5('0x6f')](/"/g,'\x27'));switch(_0x5b4da2){case _0x24e5('0x70'):var _0x56cf38=moment(_0x30539f,_0x24e5('0x71'),!![]);if(_0x56cf38[_0x24e5('0x72')]()){_0x1e66ad[_0x24e5('0x1e')]('\x22'+_0x30539f+'\x22');}else{_0x3ff91e['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x24e5('0x73'):var _0xad7410=parseInt(_0x30539f);_0x30539f=_[_0x24e5('0x74')](_0xad7410)||_0xad7410<0x0||_0xad7410>0x4?_0x686aa5?0x3:0x2:_0xad7410;_0x1e66ad[_0x24e5('0x1e')]('\x22'+_0x30539f+'\x22');break;case _0x24e5('0x75'):var _0x2ddc90=parseInt(_0x30539f);if(_[_0x24e5('0x76')](_0x2ddc90)&&_[_0x24e5('0x77')](_0x1efd85,_0x2ddc90)){_0x1e66ad[_0x24e5('0x1e')]('\x22'+_0x2ddc90+'\x22');}else{_0x3ff91e[_0x24e5('0x1e')]('agent\x20not\x20exists');}break;case _0x24e5('0x78'):if(isEmail(_0x30539f)){_0x1e66ad[_0x24e5('0x1e')]('\x22'+_0x30539f+'\x22');}else{_0x3ff91e['push']('email\x20wrong\x20format');}break;case _0x24e5('0x79'):var _0x4c35a6=moment(_0x30539f,'YYYY-MM-DD',!![]);if(_0x4c35a6[_0x24e5('0x72')]()){_0x1e66ad[_0x24e5('0x1e')]('\x22'+_0x30539f+'\x22');}else{_0x3ff91e[_0x24e5('0x1e')](_0x24e5('0x7a'));}break;default:_0x1e66ad[_0x24e5('0x1e')]('\x22'+_0x30539f+'\x22');}}else{switch(_0x5b4da2){case _0x24e5('0x7b'):case _0x24e5('0x13'):_0x3ff91e[_0x24e5('0x1e')](_0x5b4da2+'\x20not\x20specified');break;default:_0x1e66ad[_0x24e5('0x1e')]('\x22\x22');}}}}else{var _0xcf4e0a='';if(!_['isNil'](_0x464ed9)){if(!_0x167737[_0x24e5('0x6e')](_0x464ed9['id'])){for(var _0x121999=0x0;_0x121999<_0x5f4623[_0x5b4da2][_0x24e5('0x24')];_0x121999++){var _0x30539f=_['trim'](_0x5acf08['data'][_0x35864b][_0x5f4623[_0x5b4da2][_0x121999]][_0x24e5('0x6f')](/"/g,'\x27'));var _0x33f6d8=phoneDescriptions[_0x24e5('0x7c')](_0x8d816c=>_0x8d816c[_0x24e5('0x7d')]===_0x464ed9['id']);if(!_[_0x24e5('0x1c')](_0x33f6d8)){var _0x5cfce0=_['trim'](_0x5acf08['data'][_0x35864b][_0x5f4623[_0x33f6d8[_0x24e5('0x7e')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x24e5('0x1c')](_0x5cfce0))_0x30539f=_0x30539f+'§'+_0x5cfce0;}if(_0xcf4e0a=='')_0xcf4e0a=_0x30539f;else _0xcf4e0a+='|'+_0x30539f;}_0x3d143d['push'](_0x464ed9['id']+':'+_0xcf4e0a);_0x167737[_0x464ed9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1e66ad[_0x24e5('0x1e')]('\x22'+_0x3d143d[_0x24e5('0x15')](';')+'\x22');}if(_0x3ff91e[_0x24e5('0x24')]){handleError(_0x5acf08[_0x24e5('0x6b')][_0x35864b],{'code':_0x24e5('0x7f'),'message':_0x3ff91e[_0x24e5('0x15')]()});}else{fs[_0x24e5('0x80')](_0x4e8ea8,_0x1e66ad[_0x24e5('0x15')]()+'\x0a');}_0x1e66ad=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x4f180d,stats);stats['errors']=[];}}if(stopped){logger[_0x24e5('0x5a')](_0x24e5('0x81'));_0x2d6b9d[_0x24e5('0x82')]();}}catch(_0x297846){handleError(_0x5acf08['data'][_0x35864b],{'code':_0x24e5('0x83'),'message':_0x297846[_0x24e5('0x22')]});logger[_0x24e5('0x5b')](_0x24e5('0x84'),_0x297846[_0x24e5('0x22')]);}},'complete':function(){try{var _0x1aeff7=[];var _0x3758fb=tempTableName;_0x1aeff7['push'](_0x24e5('0x85')+_0x3758fb+_0x24e5('0x86'));logger['info'](_0x24e5('0x87'),contactItemTypes[_0x24e5('0x24')]);var _0x3dabb5=util['format'](_0x24e5('0x88'),_0x4e8ea8,_0x3758fb,_0x21f6d7,_0x56ff1c[_0x24e5('0x44')],_0x56ff1c[_0x24e5('0x57')]||null,NOW,NOW);if(_['isNil'](_0x5f4623[_0x24e5('0x70')])){_0x3dabb5+=',\x20scheduledAt\x20=\x20NOW()';}_0x1aeff7[_0x24e5('0x1e')](_0x3dabb5);BPromise['each'](_0x1aeff7,handleQuery)[_0x24e5('0x20')](function(_0x5ca58b){BPromise['all']([handleAdditionalPhones()])[_0x24e5('0x20')](function(){_0x1aeff7=[];for(var _0x45e12f=0x0;_0x45e12f\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','YYYYMMDDHHmmss','test','select','phone','.id\x20=\x20','where'];(function(_0x1a90fd,_0x5042e4){var _0x49b5a0=function(_0x31500e){while(--_0x31500e){_0x1a90fd['push'](_0x1a90fd['shift']());}};_0x49b5a0(++_0x5042e4);}(_0x3c8e,0x89));var _0xe3c8=function(_0xee30ad,_0xd6f640){_0xee30ad=_0xee30ad-0x0;var _0x5c32bc=_0x3c8e[_0xee30ad];return _0x5c32bc;};'use strict';var fs=require('fs');var path=require(_0xe3c8('0x0'));var _=require(_0xe3c8('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xe3c8('0x2'));var moment=require(_0xe3c8('0x3'));var squel=require(_0xe3c8('0x4'));var Redis=require('ioredis');var db=require(_0xe3c8('0x5'))['db'];var config=require(_0xe3c8('0x6'));var logger=require(_0xe3c8('0x7'))(_0xe3c8('0x8'));config['redis']=_[_0xe3c8('0x9')](config[_0xe3c8('0xa')],{'host':_0xe3c8('0xb'),'port':0x18eb});var socket=require(_0xe3c8('0xc'))(new Redis(config[_0xe3c8('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xe3c8('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0xe3c8('0xe')](_0xe3c8('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1ec873){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))*$/[_0xe3c8('0x10')](_0x1ec873);}function selectNotIn(_0x50e959,_0x2eb76d,_0x216f2a,_0x273b36,_0x4c24b6){return squel[_0xe3c8('0x11')]()['field'](_0xe3c8('0x12'))['from'](_0x273b36)['join'](_0x2eb76d,null,_0x2eb76d+_0xe3c8('0x13')+_0x273b36+'.'+_0x216f2a)[_0xe3c8('0x14')](_0x273b36+'.'+_0x216f2a+_0xe3c8('0x15')+_0x50e959+'.'+_0x216f2a)['where'](_0x2eb76d+_0xe3c8('0x16')+_0x4c24b6[_0xe3c8('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x45c7c3,_0x1b3615){promisesAdditionalPhones=[];promisesContact=[];return db[_0xe3c8('0x18')][_0xe3c8('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0xe3c8('0x1a')](function(_0x138dc8){if(_0x138dc8!==null){var _0x599149=[];for(var _0x7b146b=0x0;_0x7b146b<_0x138dc8[_0xe3c8('0x1b')];_0x7b146b++){var _0x17e26c=_0x138dc8[_0x7b146b];if(!_['isNil'](_0x17e26c[_0xe3c8('0x12')])){if(!_[_0xe3c8('0x1c')](_0x17e26c[_0xe3c8('0x1d')]))_0x599149[_0xe3c8('0x1e')](insertAdditionalPhones(_0x17e26c));promisesContact[_0xe3c8('0x1e')]({'contact':_0x17e26c});}}}Promise[_0xe3c8('0x1f')](_0x599149)[_0xe3c8('0x20')](function(){_0x45c7c3({'val':0x1});});})['catch'](function(_0x2a073d){logger[_0xe3c8('0x21')](_0x2a073d[_0xe3c8('0x22')]);});});}function insertAdditionalPhones(_0x44f4eb){return new Promise(function(_0x3692c7,_0x2fd61e){var _0x4907ed=_0x44f4eb[_0xe3c8('0x1d')];if(_[_0xe3c8('0x1c')](_0x4907ed))_0x2fd61e({'val':0x0});else{var _0x499665=_0x4907ed[_0xe3c8('0x23')](';');var _0x44bf1d=[];orderBy=0x0;for(var _0x5396ea=0x0;_0x5396ea<_0x499665[_0xe3c8('0x1b')];_0x5396ea++){_0x44bf1d[_0xe3c8('0x1e')](splitAdditionalPhone(_0x44f4eb['id'],_0x499665[_0x5396ea]));}Promise['all'](_0x44bf1d)[_0xe3c8('0x20')](function(){_0x3692c7({'val':_0x499665[_0xe3c8('0x1b')]});});}});}function splitAdditionalPhone(_0x2558b8,_0x33ee35){return new Promise(function(_0x1f5bf8,_0x4ddae1){var _0x1665c6=_0x33ee35['split'](':');var _0x4a0cfb=_0x1665c6[0x0];var _0x4b9fa5=_0x1665c6[0x1];if(_0x4b9fa5!==''){var _0xf2f111=_0x4b9fa5['split']('|');var _0x350134=[];for(var _0x27887a=0x0;_0x27887a<_0xf2f111['length'];_0x27887a++){if(_0xf2f111[_0x27887a]!==''){var _0x2e02bf=_['filter'](promisesAdditionalPhones,{'contactId':_0x2558b8,'phone':_0xf2f111[_0x27887a]});if(_0x2e02bf[_0xe3c8('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xe3c8('0x1e')]({'contactId':_0x2558b8,'contactTypeId':_0x4a0cfb,'phone':_0xf2f111[_0x27887a],'orderBy':orderBy});}}}_0x1f5bf8({'ok':0x1});}else _0x1f5bf8({'res':0x0});});}function createAdditionalPhone(_0xb4187b,_0x3e375b,_0xca96ed,_0x182d57){var _0x9d9e45='';var _0x497448='';var _0x56b742=_0xca96ed[_0xe3c8('0x23')]('§');_0x9d9e45=_0x56b742[0x0];if(_0x56b742[_0xe3c8('0x1b')]==0x2)_0x497448=_0x56b742[0x1];return new Promise(function(_0x40d365,_0x564b86){return db[_0xe3c8('0x24')][_0xe3c8('0x25')]({'where':{'CmContactId':_0xb4187b,'item':_0x9d9e45}})[_0xe3c8('0x20')](function(_0x1d5da7){if(_0x1d5da7){return db['CmContactHasItem'][_0xe3c8('0x26')]({'ItemTypeId':_0x3e375b,'description':_0x497448,'OrderBy':_0x182d57},{'where':{'CmContactId':_0xb4187b,'item':_0x9d9e45}})['then'](function(_0x364fa3){_0x40d365({'res':_0xe3c8('0x27')});});}else{return db[_0xe3c8('0x24')][_0xe3c8('0x28')]({'CmContactId':_0xb4187b,'item':_0x9d9e45,'ItemTypeId':_0x3e375b,'description':_0x497448,'OrderBy':_0x182d57,'ItemClass':'PHONE'})[_0xe3c8('0x20')](function(_0xb0e545){_0x40d365({'res':_0xe3c8('0x29')});});}});});}function updateContact(_0x4bfd46){return new Promise(function(_0x309dc2,_0x2a2cc8){var _0x111fd6=_0x4bfd46['id'];delete _0x4bfd46['id'];return db[_0xe3c8('0x2a')][_0xe3c8('0x26')](_0x4bfd46,{'where':{'id':_0x111fd6}})[_0xe3c8('0x20')](function(_0x5411a3){updatedRows+=0x1;return db[_0xe3c8('0x2b')]['update']({'phone':_0x4bfd46[_0xe3c8('0x12')]},{'where':{'ContactId':_0x111fd6}})[_0xe3c8('0x20')](function(_0x1e9912){_0x309dc2({'ret':'OK'});});});});}function insertCmHopper(_0xf4cea5,_0x179faa,_0x13333a,_0x973a85,_0x212bb9){var _0x553991=[_0xe3c8('0x2c'),'cm_contacts.scheduledat','cm_contacts.id',_0xe3c8('0x2d'),_0x179faa+'.'+_0x973a85,_0xe3c8('0x2e'),_0xe3c8('0x2f'),_0xe3c8('0x30'),'cm_contacts.UserId','\x22'+_0x212bb9+'\x22'];return squel[_0xe3c8('0x31')]()['into'](_0xe3c8('0x32'))[_0xe3c8('0x33')]([_0xe3c8('0x12'),_0xe3c8('0x34'),_0xe3c8('0x35'),_0xe3c8('0x36'),_0x973a85,_0xe3c8('0x37'),_0xe3c8('0x38'),_0xe3c8('0x39'),_0xe3c8('0x3a'),_0xe3c8('0x3b')],squel['select']()['fields'](_0x553991)[_0xe3c8('0x3c')](_0x179faa)[_0xe3c8('0x17')](_0xe3c8('0x3d'),null,_0xe3c8('0x3e')+_0x179faa+'.CmListId')[_0xe3c8('0x17')](_0x13333a,null,_0x13333a+'.id\x20=\x20'+_0x179faa+'.'+_0x973a85)[_0xe3c8('0x14')](_0x179faa+_0xe3c8('0x3f'),_0xf4cea5)[_0xe3c8('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe3c8('0x14')](_0xe3c8('0x40'),selectNotIn(_0x179faa,_0x13333a,_0x973a85,_0xe3c8('0x32'),[_0xe3c8('0x41'),_0xe3c8('0x42')]))[_0xe3c8('0x14')](_0xe3c8('0x40'),selectNotIn(_0x179faa,_0x13333a,_0x973a85,'cm_hopper',['\x22always\x22'])))[_0xe3c8('0x43')]();}function insertCmHopperBlack(_0x52e813,_0x30f63c,_0x2bd33f,_0x440858){var _0x152210=[_0xe3c8('0x2c'),_0xe3c8('0x44'),'cm_contacts.ListId',_0x30f63c+'.'+_0x440858,_0xe3c8('0x2e'),_0xe3c8('0x2f')];return squel[_0xe3c8('0x31')]()[_0xe3c8('0x45')]('cm_hopper_black')['fromQuery'](['phone','ContactId',_0xe3c8('0x36'),_0x440858,_0xe3c8('0x37'),_0xe3c8('0x38')],squel['select']()['fields'](_0x152210)[_0xe3c8('0x3c')](_0x30f63c)[_0xe3c8('0x17')](_0xe3c8('0x3d'),null,_0xe3c8('0x3e')+_0x30f63c+_0xe3c8('0x46'))[_0xe3c8('0x17')](_0x2bd33f,null,_0x2bd33f+_0xe3c8('0x13')+_0x30f63c+'.'+_0x440858)['where'](_0x30f63c+_0xe3c8('0x3f'),_0x52e813)[_0xe3c8('0x14')](_0xe3c8('0x47'),NOW)[_0xe3c8('0x14')](_0xe3c8('0x40'),squel[_0xe3c8('0x11')]()['field'](_0xe3c8('0x12'))[_0xe3c8('0x3c')]('cm_hopper_black')['where'](_0xe3c8('0x48'),_0x52e813)[_0xe3c8('0x14')](_0x440858+'\x20=\x20?',_0x30f63c+'.'+_0x440858)))[_0xe3c8('0x43')]();}function insertCmHopperAdditionalPhones(_0x344d39){var _0x5138b3=[_0xe3c8('0x49'),_0xe3c8('0x4a'),_0xe3c8('0x4b'),_0xe3c8('0x4c'),_0xe3c8('0x4d')];return squel[_0xe3c8('0x31')]()[_0xe3c8('0x45')]('cm_hopper_additional_phones')['fromQuery']([_0xe3c8('0x4e'),_0xe3c8('0x12'),_0xe3c8('0x4f'),_0xe3c8('0x37'),_0xe3c8('0x38')],squel['select']()[_0xe3c8('0x50')](_0x5138b3)[_0xe3c8('0x3c')](_0xe3c8('0x32'))[_0xe3c8('0x17')](_0xe3c8('0x3d'),null,_0xe3c8('0x51'))['join'](_0xe3c8('0x52'),null,_0xe3c8('0x53'))[_0xe3c8('0x14')](_0xe3c8('0x54'),_0x344d39)[_0xe3c8('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x3cbe3a,_0x1dc73d,_0x408e07,_0x331833){var _0x4183fe=_[_0xe3c8('0x55')](_[_0xe3c8('0x56')](_0x331833),[_0xe3c8('0x36'),_0xe3c8('0x57'),'createdAt',_0xe3c8('0x38')]);return squel[_0xe3c8('0x31')]()[_0xe3c8('0x45')]('cm_contacts')['fromQuery'](_0x4183fe,squel['select']()[_0xe3c8('0x50')](_0x4183fe)[_0xe3c8('0x3c')](_0x1dc73d)['where']('('+_0x408e07[_0xe3c8('0x17')](',')+_0xe3c8('0x58'),squel['select']()['fields'](_0x408e07)['from']('cm_contacts')['where'](_0xe3c8('0x48'),_0x3cbe3a))['where'](_0xe3c8('0x59'),squel[_0xe3c8('0x11')]()[_0xe3c8('0x5a')](_0xe3c8('0x5b'),_0xe3c8('0x5c'))[_0xe3c8('0x3c')](_0x1dc73d)[_0xe3c8('0x5d')](_0x408e07['join'](','))))[_0xe3c8('0x43')]();}function handleStop(){logger[_0xe3c8('0x5e')](_0xe3c8('0x5f'));stopped=!![];}function handleUncaughtException(_0xdb2ac1){logger['error'](_0xdb2ac1[_0xe3c8('0x22')]);process[_0xe3c8('0x60')](0x1);}function handleError(_0x1d0df,_0x27091c){stats[_0xe3c8('0x61')]['push']({'name':_0x27091c['code'],'message':_0x27091c[_0xe3c8('0x22')],'row':_0x1d0df});}function handleQuery(_0x283941){logger[_0xe3c8('0x5e')](_0x283941);return db['sequelize'][_0xe3c8('0x19')](_0x283941)[_0xe3c8('0x1a')](function(_0x2d427f){results['push'](_0x2d427f);})[_0xe3c8('0x62')](function(_0x5f58cb){logger[_0xe3c8('0x21')](_0x5f58cb[_0xe3c8('0x22')]);});}function main(_0x126072,_0x32df08,_0x573c16,_0xed36ec){logger[_0xe3c8('0x5e')](_0xe3c8('0x63'),_0x126072,JSON[_0xe3c8('0x64')](_0x32df08));process[_0xe3c8('0x65')](_0xe3c8('0x66'));var _0x311a89=_0x32df08['binding'];var _0x6cccd0=_[_0xe3c8('0x67')](_0x311a89);var _0x142df3=_0x32df08[_0xe3c8('0x68')];var _0x2679d1=path['join'](config[_0xe3c8('0x69')],_0xe3c8('0x6a'),_0x142df3+_0xe3c8('0x6b'));logger[_0xe3c8('0x5e')]('body',_0x32df08);db[_0xe3c8('0x6c')][_0xe3c8('0x6d')]({'raw':!![],'attributes':['id',_0xe3c8('0x6e')]})[_0xe3c8('0x20')](function(_0x21ac27){for(var _0xa5f2c9=0x0;_0xa5f2c9<_0x21ac27[_0xe3c8('0x1b')];_0xa5f2c9++){if(_0x21ac27[_0xa5f2c9]['name']in _0x311a89){contactItemTypes[_0xe3c8('0x1e')](_0x21ac27[_0xa5f2c9]);delete _0x6cccd0[_0x21ac27[_0xa5f2c9][_0xe3c8('0x6e')]];hasAdditionalPhones=!![];}for(var _0x526947 in _0x311a89){if(_0x21ac27[_0xa5f2c9][_0xe3c8('0x6e')]+_0xe3c8('0x6f')===_0x526947){phoneDescriptions['push']({'itemTypeId':_0x21ac27[_0xa5f2c9]['id'],'description':_0x526947});delete _0x6cccd0[_0x526947];}}}if(hasAdditionalPhones)_0x6cccd0[_0xe3c8('0x1d')]='';var _0x965bc3=_['keys'](_0x6cccd0)[_0xe3c8('0x17')]();logger[_0xe3c8('0x5e')](_0xe3c8('0x70'),_0x965bc3);fs[_0xe3c8('0x71')](_0x2679d1,_0x965bc3+'\x0a');Papa['parse'](fs[_0xe3c8('0x72')](_0x126072),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4cf3da,_0x3a589c){try{for(var _0x22323a=0x0,_0x181bf0=[];_0x22323a<_0x4cf3da[_0xe3c8('0x73')]['length'];_0x22323a++){stats[_0xe3c8('0x74')]+=0x1;if(_0x4cf3da[_0xe3c8('0x61')][_0x22323a]){handleError(_0x4cf3da['data'][_0x22323a],_0x4cf3da[_0xe3c8('0x61')][_0x22323a]);}else{var _0x2ba998=[];var _0x4ae73f=[];var _0x390b5d={};for(var _0x15247a in _0x311a89){let _0x41cae0=contactItemTypes['find'](_0x5f63d4=>_0x5f63d4['name']===_0x15247a);let _0x484da2=contactItemTypes[_0xe3c8('0x75')](_0x3114f9=>_0x3114f9[_0xe3c8('0x6e')]+'_description'===_0x15247a);if(_[_0xe3c8('0x1c')](_0x41cae0)&&_[_0xe3c8('0x1c')](_0x484da2)){if(_0x311a89[_0xe3c8('0x76')](_0x15247a)){if(_0x4cf3da['data'][_0x22323a][_0x311a89[_0x15247a]]){var _0x32db65=_[_0xe3c8('0x77')](_0x4cf3da[_0xe3c8('0x73')][_0x22323a][_0x311a89[_0x15247a]]['replace'](/"/g,'\x27'));switch(_0x15247a){case _0xe3c8('0x34'):var _0x58b517=moment(_0x32db65,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x58b517[_0xe3c8('0x78')]()){_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x32db65+'\x22');}else{_0x2ba998[_0xe3c8('0x1e')](_0xe3c8('0x79'));}break;case _0xe3c8('0x39'):var _0x110b4d=parseInt(_0x32db65);_0x32db65=_[_0xe3c8('0x7a')](_0x110b4d)||_0x110b4d<0x0||_0x110b4d>0x4?_0xed36ec?0x3:0x2:_0x110b4d;_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x32db65+'\x22');break;case _0xe3c8('0x3a'):var _0x4bd818=parseInt(_0x32db65);if(_[_0xe3c8('0x7b')](_0x4bd818)&&_['includes'](_0x573c16,_0x4bd818)){_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x4bd818+'\x22');}else{_0x2ba998[_0xe3c8('0x1e')](_0xe3c8('0x7c'));}break;case'email':if(isEmail(_0x32db65)){_0x181bf0['push']('\x22'+_0x32db65+'\x22');}else{_0x2ba998[_0xe3c8('0x1e')](_0xe3c8('0x7d'));}break;case _0xe3c8('0x7e'):var _0x390fe7=moment(_0x32db65,_0xe3c8('0x7f'),!![]);if(_0x390fe7[_0xe3c8('0x78')]()){_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x32db65+'\x22');}else{_0x2ba998['push'](_0xe3c8('0x80'));}break;default:_0x181bf0['push']('\x22'+_0x32db65+'\x22');}}else{switch(_0x15247a){case'firstName':case'phone':_0x2ba998['push'](_0x15247a+_0xe3c8('0x81'));break;default:_0x181bf0[_0xe3c8('0x1e')]('\x22\x22');}}}}else{var _0x1beeae='';if(!_[_0xe3c8('0x1c')](_0x41cae0)){if(!_0x390b5d[_0xe3c8('0x76')](_0x41cae0['id'])){for(var _0x477dd0=0x0;_0x477dd0<_0x311a89[_0x15247a][_0xe3c8('0x1b')];_0x477dd0++){var _0x32db65=_[_0xe3c8('0x77')](_0x4cf3da[_0xe3c8('0x73')][_0x22323a][_0x311a89[_0x15247a][_0x477dd0]][_0xe3c8('0x82')](/"/g,'\x27'));var _0x2d0eca=phoneDescriptions[_0xe3c8('0x75')](_0x563f74=>_0x563f74['itemTypeId']===_0x41cae0['id']);if(!_[_0xe3c8('0x1c')](_0x2d0eca)){var _0x45c724=_[_0xe3c8('0x77')](_0x4cf3da[_0xe3c8('0x73')][_0x22323a][_0x311a89[_0x2d0eca[_0xe3c8('0x83')]][0x0]][_0xe3c8('0x82')](/"/g,'\x27'));if(!_[_0xe3c8('0x1c')](_0x45c724))_0x32db65=_0x32db65+'§'+_0x45c724;}if(_0x1beeae=='')_0x1beeae=_0x32db65;else _0x1beeae+='|'+_0x32db65;}_0x4ae73f[_0xe3c8('0x1e')](_0x41cae0['id']+':'+_0x1beeae);_0x390b5d[_0x41cae0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x4ae73f[_0xe3c8('0x17')](';')+'\x22');}if(_0x2ba998['length']){handleError(_0x4cf3da[_0xe3c8('0x73')][_0x22323a],{'code':_0xe3c8('0x84'),'message':_0x2ba998[_0xe3c8('0x17')]()});}else{fs[_0xe3c8('0x85')](_0x2679d1,_0x181bf0[_0xe3c8('0x17')]()+'\x0a');}_0x181bf0=[];}if(!(stats['rows']%0xc8)){socket[_0xe3c8('0x86')](_0xe3c8('0x87')+_0x142df3,stats);stats['errors']=[];}}if(stopped){logger[_0xe3c8('0x5e')](_0xe3c8('0x88'));_0x3a589c[_0xe3c8('0x89')]();}}catch(_0x221aa0){handleError(_0x4cf3da[_0xe3c8('0x73')][_0x22323a],{'code':_0xe3c8('0x8a'),'message':_0x221aa0[_0xe3c8('0x22')]});logger[_0xe3c8('0x21')]('step',_0x221aa0['message']);}},'complete':function(){try{var _0x3a7408=[];var _0x3a89ef=tempTableName;_0x3a7408['push']('CREATE\x20TABLE\x20'+_0x3a89ef+_0xe3c8('0x8b'));logger[_0xe3c8('0x5e')]('CIS\x20len',contactItemTypes[_0xe3c8('0x1b')]);var _0x612af5=util[_0xe3c8('0xe')](_0xe3c8('0x8c'),_0x2679d1,_0x3a89ef,_0x965bc3,_0x32df08['ListId'],_0x32df08['CompanyId']||null,NOW,NOW);if(_[_0xe3c8('0x1c')](_0x311a89[_0xe3c8('0x34')])){_0x612af5+=_0xe3c8('0x8d');}_0x3a7408[_0xe3c8('0x1e')](_0x612af5);BPromise[_0xe3c8('0x8e')](_0x3a7408,handleQuery)[_0xe3c8('0x20')](function(_0x5253a4){BPromise[_0xe3c8('0x1f')]([handleAdditionalPhones()])[_0xe3c8('0x20')](function(){_0x3a7408=[];for(var _0x5061b4=0x0;_0x5061b4\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','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit'];(function(_0xffb2d9,_0x487c5a){var _0x8160bb=function(_0x172a72){while(--_0x172a72){_0xffb2d9['push'](_0xffb2d9['shift']());}};_0x8160bb(++_0x487c5a);}(_0xaf93,0x151));var _0x3af9=function(_0x2096b2,_0x53c8bd){_0x2096b2=_0x2096b2-0x0;var _0x540b16=_0xaf93[_0x2096b2];return _0x540b16;};'use strict';var _=require(_0x3af9('0x0'));var squel=require(_0x3af9('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require(_0x3af9('0x2'))[_0x3af9('0x3')];var utils=require('./utils');var db=require(_0x3af9('0x4'))['db'];function skipInteractionsQuery(_0x44ae6e,_0x5add3,_0x189013){var _0x1cbec3=![];var _0x1ad446=utils[_0x3af9('0x5')](_0x44ae6e);if(_0x5add3['role']===_0x3af9('0x6')&&!_0x189013['search']&&!_0x189013[_0x1ad446]){_0x1cbec3=!![];}return _0x1cbec3;}function getTagsQuery(){return squel[_0x3af9('0x7')]()['field']('id')['field'](_0x3af9('0x8'))['field']('color')[_0x3af9('0x9')](_0x3af9('0xa'));}function getUsersQuery(_0x42b89a,_0x17ad50){var _0x507254=utils[_0x3af9('0xb')](_0x42b89a);var _0x412af3=_0x3af9('0xc')+_0x42b89a+_0x3af9('0xd');var _0x17a888=squel[_0x3af9('0x7')]()[_0x3af9('0xe')](_0x3af9('0xf'))['field'](_0x3af9('0x10'))['field'](_0x3af9('0x11')+_0x507254)[_0x3af9('0x9')](_0x412af3,'ui')[_0x3af9('0x12')]('users','u',_0x3af9('0x13'));if(_0x17ad50[_0x3af9('0x14')]>0x0){_0x17a888[_0x3af9('0x15')]('ui.'+_0x507254+_0x3af9('0x16'),_[_0x3af9('0x17')](_0x17ad50,'id'));}return _0x17a888;}function getInteractionsQuery(_0xa92aa4){var _0x29dc4b=utils['getInteractionsTables'](_0xa92aa4);var _0x1d3410=utils[_0x3af9('0x5')](_0xa92aa4);var _0x298135=utils[_0x3af9('0xb')](_0xa92aa4);return squel[_0x3af9('0x7')]()['from'](_0x29dc4b[_0x3af9('0x18')],'i')[_0x3af9('0x12')](_0x3af9('0x19'),'c',_0x3af9('0x1a'))[_0x3af9('0x12')]('users','o',_0x3af9('0x1b'))[_0x3af9('0x12')](_0x29dc4b[_0x3af9('0x1c')],'a',_0x3af9('0x1d')+_0x1d3410)[_0x3af9('0x12')](_0x29dc4b[_0x3af9('0x1e')],'me','me.'+_0x298135+'\x20=\x20i.id')[_0x3af9('0x12')](_0x29dc4b['interactionsTags'],'it','it.'+_0x298135+_0x3af9('0x1f'))['left_join'](_0x3af9('0xa'),'t',_0x3af9('0x20'));}function getSqlClauses(){var _0x4b5a5c={'body':squel['expr'](),'contact':squel['expr'](),'default':squel[_0x3af9('0x21')](),'fields':squel[_0x3af9('0x21')](),'filter':squel[_0x3af9('0x21')](),'read':squel[_0x3af9('0x21')](),'tags':{'clause':squel[_0x3af9('0x21')](),'ids':null},'user':squel[_0x3af9('0x21')]()};return _0x4b5a5c;}function parseTagParameter(_0x3a3bbb){var _0x22d269=squel['expr']();if(_0x3a3bbb){var _0x24ed9b=utils[_0x3af9('0x22')](_0x3a3bbb);_0x24ed9b['forEach'](function(_0x177650){_0x22d269['or'](_0x3af9('0x23'),'%,'+_0x177650+',%');});}return _0x22d269;}function parseReadParameter(_0x19643f){var _0xf8840='';if(_0x19643f){_0xf8840=_0x3af9('0x24');if(_0x19643f==='1'){_0xf8840=_0xf8840['replace'](_0x3af9('0x25'),'=');}else{_0xf8840=_0xf8840[_0x3af9('0x26')](_0x3af9('0x25'),'>');}}return _0xf8840;}function parseSearchFilter(_0x512b90,_0x4f5024){var _0x1a4932=squel[_0x3af9('0x21')]();if(_0x4f5024){var _0x8867c6=_0x4f5024['replace']('\x5c','\x5c\x5c')[_0x3af9('0x26')](/'/g,'\x27\x27');if(qs[_0x3af9('0x27')](_0x8867c6)){_0x1a4932['or'](_0x3af9('0x28'),_0x8867c6+'%');if(['sms',_0x3af9('0x29')][_0x3af9('0x2a')](_0x512b90)){_0x1a4932['or'](_0x3af9('0x2b'),_0x8867c6+'%');}else if(_0x512b90==='fax'){_0x1a4932['or'](_0x3af9('0x2c'),_0x8867c6+'%');}else if(_0x512b90===_0x3af9('0x2d')){_0x1a4932['or'](_0x3af9('0x2e'),_0x8867c6+'%');}}else if(_0x512b90==='mail'&&qs[_0x3af9('0x2f')](_0x8867c6)){_0x1a4932['or'](_0x3af9('0x30'),_0x8867c6+'%');}else{if(_0x512b90==='mail'){_0x1a4932['or'](_0x3af9('0x31'),qs['getFullTextValue'](_0x8867c6))['or'](_0x3af9('0x32'),qs['getFullTextValue'](_0x8867c6));}else{if(_0x512b90!=='fax'){_0x1a4932['or'](_0x3af9('0x33'),qs['getFullTextValue'](_0x8867c6));}_0x1a4932['or'](_0x3af9('0x34'),_0x8867c6+'%');}}}return _0x1a4932;}function parseAdvancedSearchFilter(_0x310fe9,_0x6f9be5){var _0x4dfdb3=getSqlClauses();var _0x5410f3=as[_0x3af9('0x35')](_0x310fe9);var _0x1bc341=_0x5410f3['sqlOperator'];for(var _0x58d019=0x0;_0x58d019<_0x5410f3[_0x3af9('0x36')]['length'];_0x58d019++){var _0xe17a30=_0x5410f3[_0x3af9('0x36')][_0x58d019];var _0x47db73='i';var _0x554566=_[_0x3af9('0x37')](_0x6f9be5,[_0x3af9('0x8'),_0xe17a30[_0x3af9('0xe')]]);if(_0x554566){var _0x30a6af=as[_0x3af9('0x38')](_0x47db73,_0x554566['type'],_0xe17a30);_0x4dfdb3['default'][_0x1bc341](_0x30a6af[_0x3af9('0x39')],_0x30a6af[_0x3af9('0x3a')][_0x3af9('0x3b')],_0x30a6af[_0x3af9('0x3a')]['end']);}else{switch(_0xe17a30['field']){case _0x3af9('0x3c'):var _0x245c77=parseReadParameter(_0xe17a30[_0x3af9('0x3a')]);_0x4dfdb3['read'][_0x3af9('0x3d')](_0x245c77);break;case _0x3af9('0x3e'):if(_0xe17a30[_0x3af9('0x3f')]==='$substring'){if(_0xe17a30[_0x3af9('0x3a')]['split']('\x20')[_0x3af9('0x14')]>0x1){_0x4dfdb3[_0x3af9('0x40')][_0x1bc341](_0x3af9('0x41'),qs[_0x3af9('0x42')](_0xe17a30[_0x3af9('0x3a')]),null);}else{var _0x18a75c='%'+_0xe17a30[_0x3af9('0x3a')]+'%';_0x4dfdb3[_0x3af9('0x40')][_0x1bc341](_0x3af9('0x43'),_0x18a75c,_0x18a75c,_0x18a75c);}}else{_0x554566=_[_0x3af9('0x37')](_0x6f9be5,[_0x3af9('0x8'),'ContactId']);_0xe17a30[_0x3af9('0xe')]=_0x3af9('0x44');_0x30a6af=as[_0x3af9('0x38')](_0x47db73,_0x554566[_0x3af9('0x45')],_0xe17a30);_0x4dfdb3[_0x3af9('0x40')][_0x1bc341](_0x30a6af[_0x3af9('0x39')],_0x30a6af[_0x3af9('0x3a')][_0x3af9('0x3b')],_0x30a6af[_0x3af9('0x3a')][_0x3af9('0x46')]);}break;case _0x3af9('0x47'):var _0x1f7d8a=_0xe17a30['value']['split'](',')[_0x3af9('0x17')](function(_0x1daea4){return Number(_0x1daea4);});var _0x36e982=parseTagParameter(_0x1f7d8a);_0x4dfdb3[_0x3af9('0x48')][_0x3af9('0x49')][_0x3af9('0x3d')](_0x36e982);_0x4dfdb3[_0x3af9('0x48')][_0x3af9('0x4a')]=_0x1f7d8a;break;case _0x3af9('0x4b'):if(_0xe17a30[_0x3af9('0x3f')]===_0x3af9('0x4c')){_0x4dfdb3[_0x3af9('0x4d')][_0x1bc341](_0x3af9('0x4e'),'%'+_0xe17a30['value']+'%',null);}else{_0x554566=_[_0x3af9('0x37')](_0x6f9be5,[_0x3af9('0x8'),_0x3af9('0x4f')]);_0xe17a30[_0x3af9('0xe')]='UserId';_0x30a6af=as['buildExpression'](_0x47db73,_0x554566[_0x3af9('0x45')],_0xe17a30);_0x4dfdb3['user'][_0x1bc341](_0x30a6af[_0x3af9('0x39')],_0x30a6af[_0x3af9('0x3a')][_0x3af9('0x3b')],_0x30a6af[_0x3af9('0x3a')]['end']);}break;case _0x3af9('0x50'):case _0x3af9('0x51'):_0x30a6af=as[_0x3af9('0x38')]('me',null,_0xe17a30);_0x4dfdb3['body'][_0x1bc341](_0x30a6af['text'],_0x30a6af[_0x3af9('0x3a')]['start'],_0x30a6af['value']['end']);break;}}}return _0x4dfdb3;}function parseModelFields(_0x19bd47,_0x3bc784,_0x8ba5d3){var _0x42b78e=utils[_0x3af9('0x5')](_0x19bd47);var _0x45ca84=squel[_0x3af9('0x21')]();var _0x48377b=_(_0x3bc784)[_0x3af9('0x52')]()[_0x3af9('0x17')](function(_0x38c943){return _[_0x3af9('0x53')](_0x8ba5d3,[_0x3af9('0x8'),_0x38c943])?_0x38c943:undefined;})[_0x3af9('0x54')]()['value']();if(_0x48377b[_0x3af9('0x14')]>0x0){_0x48377b[_0x3af9('0x55')](function(_0x1cbfc7){if(_0x1cbfc7===_0x42b78e){_0x45ca84[_0x3af9('0x3d')]('i.'+_0x42b78e+'\x20IN\x20?',[][_0x3af9('0x56')](_0x3bc784[_0x1cbfc7]));}else if(_0x1cbfc7===_0x3af9('0x57')){var _0x2e55f2=JSON[_0x3af9('0x58')](_0x3bc784[_0x1cbfc7])['$gte'];var _0x1f19ee=JSON[_0x3af9('0x58')](_0x3bc784[_0x1cbfc7])[_0x3af9('0x59')];_0x45ca84[_0x3af9('0x3d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2e55f2,_0x1f19ee);}else{if(_0x3bc784[_0x1cbfc7]==='null'){_0x45ca84[_0x3af9('0x3d')]('i.'+_0x1cbfc7+_0x3af9('0x5a'));}else{_0x45ca84[_0x3af9('0x3d')]('i.'+_0x1cbfc7+_0x3af9('0x5b'),_0x3bc784[_0x1cbfc7]);}}});}return _0x45ca84;}function parseQueryParameters(_0x3f087a,_0x268820,_0x3d757b){var _0x364e44=getSqlClauses();return Promise[_0x3af9('0x5c')]()[_0x3af9('0x5d')](function(){return parseModelFields(_0x3f087a,_0x268820,_0x3d757b);})[_0x3af9('0x5d')](function(_0x589747){_0x364e44[_0x3af9('0x5e')][_0x3af9('0x3d')](_0x589747);return parseReadParameter(_0x268820['read']);})['then'](function(_0x296101){_0x364e44['read'][_0x3af9('0x3d')](_0x296101);return parseTagParameter(_0x268820[_0x3af9('0x5f')]);})['then'](function(_0x5870f5){_0x364e44[_0x3af9('0x48')][_0x3af9('0x49')][_0x3af9('0x3d')](_0x5870f5);return parseSearchFilter(_0x3f087a,_0x268820[_0x3af9('0x60')]);})['then'](function(_0x3ed77e){_0x364e44['filter']=_0x3ed77e;return _0x364e44;});}function checkAccountsRestrictions(_0x180a32,_0x3e630,_0x391c9e){var _0x58b2ff=utils[_0x3af9('0x5')](_0x180a32);var _0x1d6c31=_0x3af9('0x61')+_[_0x3af9('0x62')](_0x180a32)+(_0x180a32==='chat'?_0x3af9('0x63'):_0x3af9('0x64'));var _0x1f0d5e=squel[_0x3af9('0x21')]();return Promise[_0x3af9('0x5c')]()[_0x3af9('0x5d')](function(){if(_0x391c9e[_0x3af9('0x65')]&&_0x3e630['role']===_0x3af9('0x6')){return _0x3e630[_0x1d6c31]({'attributes':['id'],'raw':!![]});}})[_0x3af9('0x5d')](function(_0x28e8fb){if(_0x28e8fb){if(_0x28e8fb[_0x3af9('0x14')]===0x0){_0x1f0d5e[_0x3af9('0x3d')]('i.'+_0x58b2ff+'\x20IS\x20NULL');}else{_0x1f0d5e[_0x3af9('0x3d')]('i.'+_0x58b2ff+_0x3af9('0x16'),_[_0x3af9('0x17')](_0x28e8fb,'id'));}}else if(!_0x391c9e[_0x58b2ff]){_0x1f0d5e[_0x3af9('0x3d')]('i.'+_0x58b2ff+_0x3af9('0x66'));}})[_0x3af9('0x5d')](function(){return _0x1f0d5e;});}function getClosedOrderClause(_0x35674b,_0x129712){var _0x40051e='';var _0x2e6e85=['i.thirdDisposition',_0x3af9('0x67'),_0x3af9('0x68')];if(_0x35674b===_0x3af9('0x69')){_0x2e6e85[_0x3af9('0x6a')]('i.substatus');}if(_0x129712[_0x3af9('0x6b')]==='0'&&_0x35674b===_0x3af9('0x69')){_0x40051e=_0x3af9('0x6c');}else{if(_0x129712[_0x3af9('0x6b')]==='1'){_0x2e6e85[_0x3af9('0x6d')]();}_0x40051e=_0x3af9('0x6e')+_0x2e6e85[_0x3af9('0x6f')](',\x20')+')';}return _0x40051e;}function getFilteredInteractions(_0x54c07c,_0x1d9d19,_0x5d7376,_0x30d746){var _0x1a3f20=utils[_0x3af9('0xb')](_0x54c07c);var _0x22cf37=_[_0x3af9('0x62')](_0x54c07c)+_0x3af9('0x70');var _0x50c934=[];var _0x1ef413=getTagsQuery();var _0x498081={'type':db[_0x3af9('0x71')][_0x3af9('0x72')][_0x3af9('0x73')],'raw':!![]};var _0x3e88eb=[];var _0x5e2287=[];return db[_0x3af9('0x74')][_0x3af9('0x75')](_0x1ef413[_0x3af9('0x76')](),_0x498081)[_0x3af9('0x5d')](function(_0x1a7f88){_0x50c934=_[_0x3af9('0x77')](_0x1a7f88,'id');_0x498081=_[_0x3af9('0x78')](_0x498081,{'model':db[_0x22cf37],'mapToModel':!![],'nest':!![]});if(_0x5d7376[_0x3af9('0x5e')]){_0x30d746[_0x3af9('0x79')][_0x3af9('0x55')](function(_0x4831a3){_0x1d9d19[_0x3af9('0xe')]('i.'+_0x4831a3);});}else{_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x7a'),_0x3af9('0x3c'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x7b'),_0x3af9('0x7c'));_0x1d9d19['field'](_0x3af9('0x7d'),_0x3af9('0x7e'));if(_0x54c07c===_0x3af9('0x69')){_0x1d9d19['field'](_0x3af9('0x7f'),_0x3af9('0x80'));_0x1d9d19[_0x3af9('0xe')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3af9('0x81'));_0x1d9d19[_0x3af9('0xe')]('i.id');_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x82'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x83'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x84'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x85'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x86'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x87'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x88'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x89'));_0x1d9d19['field'](_0x3af9('0x68'));_0x1d9d19[_0x3af9('0xe')]('i.secondDisposition');_0x1d9d19[_0x3af9('0xe')]('i.thirdDisposition');_0x1d9d19['field'](_0x3af9('0x6c'));_0x1d9d19[_0x3af9('0xe')]('i.to');_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x8a'));_0x1d9d19[_0x3af9('0xe')]('i.MailAccountId');_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x8b'));}else if(_0x54c07c===_0x3af9('0x2d')){_0x1d9d19[_0x3af9('0xe')]('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',_0x3af9('0x81'));}else{_0x1d9d19['field'](_0x3af9('0x8c'),_0x3af9('0x81'));}if(_0x54c07c!=='mail'){_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x8d'));}_0x1d9d19['field'](_0x3af9('0x8e'),_0x3af9('0x8f'));_0x1d9d19['field'](_0x3af9('0x90'),'Contact.lastName');_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x91'),_0x3af9('0x92'));_0x1d9d19[_0x3af9('0xe')]('c.phone',_0x3af9('0x93'));_0x1d9d19['field'](_0x3af9('0x94'),_0x3af9('0x95'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x96'),'Contact.fax');_0x1d9d19[_0x3af9('0xe')]('o.fullname',_0x3af9('0x97'));_0x1d9d19[_0x3af9('0xe')]('o.internal',_0x3af9('0x98'));_0x1d9d19[_0x3af9('0xe')](_0x3af9('0x99'),'TagIds');}if(_0x30d746[_0x3af9('0x9a')]){_0x1d9d19[_0x3af9('0x9a')](_0x30d746[_0x3af9('0x9a')]);}if(_0x30d746[_0x3af9('0x9b')]){_0x1d9d19['offset'](_0x30d746[_0x3af9('0x9b')]);}return db[_0x3af9('0x74')][_0x3af9('0x75')](_0x1d9d19[_0x3af9('0x76')](),_0x498081);})[_0x3af9('0x5d')](function(_0x23801f){_0x3e88eb=_0x23801f;var _0x56215a=getUsersQuery(_0x54c07c,_0x3e88eb);return db[_0x3af9('0x74')][_0x3af9('0x75')](_0x56215a[_0x3af9('0x76')](),_0x498081);})[_0x3af9('0x5d')](function(_0x1ad416){_0x5e2287=_[_0x3af9('0x9c')](_0x1ad416,_0x1a3f20);if(_0x54c07c==='mail'){return db['Setting'][_0x3af9('0x9d')]({'attributes':[_0x3af9('0x9e')],'raw':!![]});}})[_0x3af9('0x5d')](function(_0xe9bbbd){var _0x5dca1e=_0xe9bbbd?_0xe9bbbd[_0x3af9('0x9e')]:undefined;var _0x4f4573=_0x3e88eb[_0x3af9('0x17')](function(_0x4128ed){return updateInteraction(_0x4128ed,_0x50c934,_0x5e2287,_0x5dca1e);});return Promise[_0x3af9('0x9f')](_0x4f4573);});}function countFilteredInteractions(_0x4e910e,_0x20788e){var _0x2344a8=_0x4e910e[_0x3af9('0xa0')]();_0x2344a8[_0x3af9('0xe')](_0x3af9('0xa1'));_0x2344a8[_0x3af9('0xe')](_0x3af9('0x7a'),_0x3af9('0x3c'));var _0x27c280=utils['getSelectedTags'](_0x20788e);if(!_[_0x3af9('0xa2')](_0x27c280)){_0x2344a8[_0x3af9('0x15')]('t.id\x20IN\x20?',_0x27c280);}var _0xf5ff9c={'type':db[_0x3af9('0x71')][_0x3af9('0x72')][_0x3af9('0x73')],'raw':!![]};return db[_0x3af9('0x74')][_0x3af9('0x75')](_0x2344a8[_0x3af9('0x76')](),_0xf5ff9c);}module[_0x3af9('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x19ea=['ContactId','start','end','Tag','split','tags','clause','ids','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','user','body','keys','map','some','compact','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','filter','get','capitalize','chat','Websites','Accounts','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','SELECT','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','mail','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','buildExpression','type','text','value','unreadMessages','read','and','Contact','$substring','contact','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?'];(function(_0x501ded,_0x54ec7f){var _0x377b89=function(_0x47a6a0){while(--_0x47a6a0){_0x501ded['push'](_0x501ded['shift']());}};_0x377b89(++_0x54ec7f);}(_0x19ea,0xfe));var _0xa19e=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0x19ea[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require(_0xa19e('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0xa19e('0x1'));var updateInteraction=require('./update-interaction')[_0xa19e('0x2')];var utils=require(_0xa19e('0x3'));var db=require(_0xa19e('0x4'))['db'];function skipInteractionsQuery(_0x4d323a,_0x4a6556,_0x1fac51){var _0x2a8e2c=![];var _0x29fe52=utils[_0xa19e('0x5')](_0x4d323a);if(_0x4a6556[_0xa19e('0x6')]===_0xa19e('0x7')&&!_0x1fac51[_0xa19e('0x8')]&&!_0x1fac51[_0x29fe52]){_0x2a8e2c=!![];}return _0x2a8e2c;}function getTagsQuery(){return squel[_0xa19e('0x9')]()[_0xa19e('0xa')]('id')[_0xa19e('0xa')](_0xa19e('0xb'))['field'](_0xa19e('0xc'))[_0xa19e('0xd')](_0xa19e('0xe'));}function getUsersQuery(_0x8e307b,_0x54bf8c){var _0x13818d=utils[_0xa19e('0xf')](_0x8e307b);var _0xfb8dbf='user_has_'+_0x8e307b+_0xa19e('0x10');var _0x1d63b6=squel[_0xa19e('0x9')]()[_0xa19e('0xa')](_0xa19e('0x11'))['field'](_0xa19e('0x12'))[_0xa19e('0xa')](_0xa19e('0x13')+_0x13818d)[_0xa19e('0xd')](_0xfb8dbf,'ui')[_0xa19e('0x14')](_0xa19e('0x15'),'u',_0xa19e('0x16'));if(_0x54bf8c[_0xa19e('0x17')]>0x0){_0x1d63b6[_0xa19e('0x18')](_0xa19e('0x13')+_0x13818d+_0xa19e('0x19'),_['map'](_0x54bf8c,'id'));}return _0x1d63b6;}function getInteractionsQuery(_0x28fd37){var _0x34066a=utils[_0xa19e('0x1a')](_0x28fd37);var _0x256819=utils[_0xa19e('0x5')](_0x28fd37);var _0x38e398=utils[_0xa19e('0xf')](_0x28fd37);return squel['select']()[_0xa19e('0xd')](_0x34066a['interactions'],'i')[_0xa19e('0x14')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa19e('0x14')](_0xa19e('0x15'),'o','o.id\x20=\x20i.UserId')[_0xa19e('0x14')](_0x34066a[_0xa19e('0x1b')],'a',_0xa19e('0x1c')+_0x256819)[_0xa19e('0x14')](_0x34066a['messages'],'me',_0xa19e('0x1d')+_0x38e398+_0xa19e('0x1e'))[_0xa19e('0x14')](_0x34066a[_0xa19e('0x1f')],'it',_0xa19e('0x20')+_0x38e398+_0xa19e('0x1e'))[_0xa19e('0x14')](_0xa19e('0xe'),'t',_0xa19e('0x21'));}function getSqlClauses(){var _0x536386={'body':squel[_0xa19e('0x22')](),'contact':squel[_0xa19e('0x22')](),'default':squel['expr'](),'fields':squel[_0xa19e('0x22')](),'filter':squel[_0xa19e('0x22')](),'read':squel['expr'](),'tags':{'clause':squel[_0xa19e('0x22')](),'ids':null},'user':squel[_0xa19e('0x22')]()};return _0x536386;}function parseTagParameter(_0x5d5559){var _0x40dc1c=squel[_0xa19e('0x22')]();if(_0x5d5559){var _0x2bd823=utils[_0xa19e('0x23')](_0x5d5559);_0x2bd823[_0xa19e('0x24')](function(_0x180407){_0x40dc1c['or'](_0xa19e('0x25'),'%,'+_0x180407+',%');});}return _0x40dc1c;}function parseReadParameter(_0x3f5ac6){var _0x18c96f='';if(_0x3f5ac6){_0x18c96f=_0xa19e('0x26');if(_0x3f5ac6==='1'){_0x18c96f=_0x18c96f[_0xa19e('0x27')](_0xa19e('0x28'),'=');}else{_0x18c96f=_0x18c96f[_0xa19e('0x27')](_0xa19e('0x28'),'>');}}return _0x18c96f;}function parseSearchFilter(_0xdf0b20,_0x4613c3){var _0x16bcd5=squel[_0xa19e('0x22')]();if(_0x4613c3){var _0x3dcd74=_0x4613c3[_0xa19e('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xa19e('0x29')](_0x3dcd74)){_0x16bcd5['or'](_0xa19e('0x2a'),_0x3dcd74+'%');if([_0xa19e('0x2b'),_0xa19e('0x2c')][_0xa19e('0x2d')](_0xdf0b20)){_0x16bcd5['or'](_0xa19e('0x2e'),_0x3dcd74+'%');}else if(_0xdf0b20==='fax'){_0x16bcd5['or'](_0xa19e('0x2f'),_0x3dcd74+'%');}else if(_0xdf0b20===_0xa19e('0x30')){_0x16bcd5['or']('i.from\x20LIKE\x20?',_0x3dcd74+'%');}}else if(_0xdf0b20===_0xa19e('0x31')&&qs['isEmail'](_0x3dcd74)){_0x16bcd5['or']('c.email\x20LIKE\x20?',_0x3dcd74+'%');}else{if(_0xdf0b20===_0xa19e('0x31')){_0x16bcd5['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3dcd74))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa19e('0x32')](_0x3dcd74));}else{if(_0xdf0b20!==_0xa19e('0x33')){_0x16bcd5['or'](_0xa19e('0x34'),qs['getFullTextValue'](_0x3dcd74));}_0x16bcd5['or'](_0xa19e('0x35'),_0x3dcd74+'%');}}}return _0x16bcd5;}function parseAdvancedSearchFilter(_0x3f959c,_0x1f9af3){var _0x288a41=getSqlClauses();var _0xf857e7=as[_0xa19e('0x36')](_0x3f959c);var _0x53899a=_0xf857e7[_0xa19e('0x37')];for(var _0x434081=0x0;_0x434081<_0xf857e7['conditions'][_0xa19e('0x17')];_0x434081++){var _0x12b20a=_0xf857e7[_0xa19e('0x38')][_0x434081];var _0x5824c5='i';var _0x4bf11f=_[_0xa19e('0x39')](_0x1f9af3,['name',_0x12b20a[_0xa19e('0xa')]]);if(_0x4bf11f){var _0x13b2f8=as[_0xa19e('0x3a')](_0x5824c5,_0x4bf11f[_0xa19e('0x3b')],_0x12b20a);_0x288a41['default'][_0x53899a](_0x13b2f8[_0xa19e('0x3c')],_0x13b2f8[_0xa19e('0x3d')]['start'],_0x13b2f8[_0xa19e('0x3d')]['end']);}else{switch(_0x12b20a[_0xa19e('0xa')]){case _0xa19e('0x3e'):var _0x209424=parseReadParameter(_0x12b20a['value']);_0x288a41[_0xa19e('0x3f')][_0xa19e('0x40')](_0x209424);break;case _0xa19e('0x41'):if(_0x12b20a['operator']===_0xa19e('0x42')){if(_0x12b20a[_0xa19e('0x3d')]['split']('\x20')['length']>0x1){_0x288a41[_0xa19e('0x43')][_0x53899a](_0xa19e('0x44'),qs['getFullTextValue'](_0x12b20a[_0xa19e('0x3d')]),null);}else{var _0x2d43b4='%'+_0x12b20a['value']+'%';_0x288a41[_0xa19e('0x43')][_0x53899a](_0xa19e('0x45'),_0x2d43b4,_0x2d43b4,_0x2d43b4);}}else{_0x4bf11f=_[_0xa19e('0x39')](_0x1f9af3,[_0xa19e('0xb'),_0xa19e('0x46')]);_0x12b20a['field']=_0xa19e('0x46');_0x13b2f8=as[_0xa19e('0x3a')](_0x5824c5,_0x4bf11f[_0xa19e('0x3b')],_0x12b20a);_0x288a41[_0xa19e('0x43')][_0x53899a](_0x13b2f8[_0xa19e('0x3c')],_0x13b2f8['value'][_0xa19e('0x47')],_0x13b2f8['value'][_0xa19e('0x48')]);}break;case _0xa19e('0x49'):var _0x5d493c=_0x12b20a[_0xa19e('0x3d')][_0xa19e('0x4a')](',')['map'](function(_0x41d7ae){return Number(_0x41d7ae);});var _0x5b58b1=parseTagParameter(_0x5d493c);_0x288a41[_0xa19e('0x4b')][_0xa19e('0x4c')][_0xa19e('0x40')](_0x5b58b1);_0x288a41[_0xa19e('0x4b')][_0xa19e('0x4d')]=_0x5d493c;break;case _0xa19e('0x4e'):if(_0x12b20a[_0xa19e('0x4f')]===_0xa19e('0x42')){_0x288a41['user'][_0x53899a](_0xa19e('0x50'),'%'+_0x12b20a[_0xa19e('0x3d')]+'%',null);}else{_0x4bf11f=_['find'](_0x1f9af3,['name',_0xa19e('0x51')]);_0x12b20a[_0xa19e('0xa')]=_0xa19e('0x51');_0x13b2f8=as['buildExpression'](_0x5824c5,_0x4bf11f[_0xa19e('0x3b')],_0x12b20a);_0x288a41[_0xa19e('0x52')][_0x53899a](_0x13b2f8['text'],_0x13b2f8[_0xa19e('0x3d')][_0xa19e('0x47')],_0x13b2f8[_0xa19e('0x3d')]['end']);}break;case _0xa19e('0x53'):case'plainBody':_0x13b2f8=as[_0xa19e('0x3a')]('me',null,_0x12b20a);_0x288a41[_0xa19e('0x53')][_0x53899a](_0x13b2f8[_0xa19e('0x3c')],_0x13b2f8[_0xa19e('0x3d')][_0xa19e('0x47')],_0x13b2f8['value'][_0xa19e('0x48')]);break;}}}return _0x288a41;}function parseModelFields(_0x4c90fe,_0x4779d8,_0x5d2e5f){var _0x17e36e=utils[_0xa19e('0x5')](_0x4c90fe);var _0x2db3b2=squel[_0xa19e('0x22')]();var _0x538c9a=_(_0x4779d8)[_0xa19e('0x54')]()[_0xa19e('0x55')](function(_0x427214){return _[_0xa19e('0x56')](_0x5d2e5f,['name',_0x427214])?_0x427214:undefined;})[_0xa19e('0x57')]()['value']();if(_0x538c9a[_0xa19e('0x17')]>0x0){_0x538c9a[_0xa19e('0x24')](function(_0x3309ec){if(_0x3309ec===_0x17e36e){_0x2db3b2['and']('i.'+_0x17e36e+_0xa19e('0x19'),[][_0xa19e('0x58')](_0x4779d8[_0x3309ec]));}else if(_0x3309ec==='createdAt'){var _0x101576=JSON[_0xa19e('0x59')](_0x4779d8[_0x3309ec])[_0xa19e('0x5a')];var _0x3f8751=JSON['parse'](_0x4779d8[_0x3309ec])['$lte'];_0x2db3b2[_0xa19e('0x40')](_0xa19e('0x5b'),_0x101576,_0x3f8751);}else{if(_0x4779d8[_0x3309ec]==='null'){_0x2db3b2[_0xa19e('0x40')]('i.'+_0x3309ec+_0xa19e('0x5c'));}else{_0x2db3b2['and']('i.'+_0x3309ec+_0xa19e('0x5d'),_0x4779d8[_0x3309ec]);}}});}return _0x2db3b2;}function parseQueryParameters(_0x68e0d1,_0x44a946,_0x22890b){var _0x3cc870=getSqlClauses();return Promise[_0xa19e('0x5e')]()[_0xa19e('0x5f')](function(){return parseModelFields(_0x68e0d1,_0x44a946,_0x22890b);})[_0xa19e('0x5f')](function(_0x9008e4){_0x3cc870[_0xa19e('0x60')][_0xa19e('0x40')](_0x9008e4);return parseReadParameter(_0x44a946['read']);})['then'](function(_0x2f37b0){_0x3cc870[_0xa19e('0x3f')][_0xa19e('0x40')](_0x2f37b0);return parseTagParameter(_0x44a946['tag']);})['then'](function(_0x51b2cc){_0x3cc870[_0xa19e('0x4b')]['clause'][_0xa19e('0x40')](_0x51b2cc);return parseSearchFilter(_0x68e0d1,_0x44a946[_0xa19e('0x61')]);})[_0xa19e('0x5f')](function(_0xdf2b29){_0x3cc870['filter']=_0xdf2b29;return _0x3cc870;});}function checkAccountsRestrictions(_0x966a23,_0xe4bb66,_0x437292){var _0xfe4a4=utils[_0xa19e('0x5')](_0x966a23);var _0x12064e=_0xa19e('0x62')+_[_0xa19e('0x63')](_0x966a23)+(_0x966a23===_0xa19e('0x64')?_0xa19e('0x65'):_0xa19e('0x66'));var _0xae7dbc=squel[_0xa19e('0x22')]();return Promise[_0xa19e('0x5e')]()[_0xa19e('0x5f')](function(){if(_0x437292[_0xa19e('0x8')]&&_0xe4bb66[_0xa19e('0x6')]==='agent'){return _0xe4bb66[_0x12064e]({'attributes':['id'],'raw':!![]});}})[_0xa19e('0x5f')](function(_0x3cf325){if(_0x3cf325){if(_0x3cf325['length']===0x0){_0xae7dbc[_0xa19e('0x40')]('i.'+_0xfe4a4+'\x20IS\x20NULL');}else{_0xae7dbc['and']('i.'+_0xfe4a4+_0xa19e('0x19'),_[_0xa19e('0x55')](_0x3cf325,'id'));}}else if(!_0x437292[_0xfe4a4]){_0xae7dbc[_0xa19e('0x40')]('i.'+_0xfe4a4+'\x20IS\x20NOT\x20NULL');}})[_0xa19e('0x5f')](function(){return _0xae7dbc;});}function getClosedOrderClause(_0x4ad542,_0x462a4e){var _0x5afd28='';var _0x423d57=[_0xa19e('0x67'),_0xa19e('0x68'),_0xa19e('0x69')];if(_0x4ad542===_0xa19e('0x31')){_0x423d57['unshift'](_0xa19e('0x6a'));}if(_0x462a4e['closed']==='0'&&_0x4ad542===_0xa19e('0x31')){_0x5afd28=_0xa19e('0x6a');}else{if(_0x462a4e[_0xa19e('0x6b')]==='1'){_0x423d57[_0xa19e('0x6c')]();}_0x5afd28=_0xa19e('0x6d')+_0x423d57[_0xa19e('0x6e')](',\x20')+')';}return _0x5afd28;}function getFilteredInteractions(_0x9d442b,_0x331b17,_0x340df1,_0x3f6bf7){var _0x307a5d=utils[_0xa19e('0xf')](_0x9d442b);var _0x481e43=_[_0xa19e('0x63')](_0x9d442b)+_0xa19e('0x6f');var _0x5ca466=[];var _0x4195c9=getTagsQuery();var _0x53a806={'type':db[_0xa19e('0x70')]['QueryTypes'][_0xa19e('0x71')],'raw':!![]};var _0x45f260=[];var _0x52159a=[];return db[_0xa19e('0x72')]['query'](_0x4195c9[_0xa19e('0x73')](),_0x53a806)[_0xa19e('0x5f')](function(_0x14da59){_0x5ca466=_[_0xa19e('0x74')](_0x14da59,'id');_0x53a806=_[_0xa19e('0x75')](_0x53a806,{'model':db[_0x481e43],'mapToModel':!![],'nest':!![]});if(_0x340df1[_0xa19e('0x60')]){_0x3f6bf7['attributes'][_0xa19e('0x24')](function(_0x45e5f6){_0x331b17[_0xa19e('0xa')]('i.'+_0x45e5f6);});}else{_0x331b17['field'](_0xa19e('0x76'),_0xa19e('0x3e'));_0x331b17[_0xa19e('0xa')]('a.key',_0xa19e('0x77'));_0x331b17[_0xa19e('0xa')]('a.mandatoryDisposition',_0xa19e('0x78'));if(_0x9d442b===_0xa19e('0x31')){_0x331b17[_0xa19e('0xa')]('a.email',_0xa19e('0x79'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x7a'),_0xa19e('0x7b'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x7c'));_0x331b17[_0xa19e('0xa')]('i.createdAt');_0x331b17[_0xa19e('0xa')](_0xa19e('0x7d'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x7e'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x7f'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x80'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x81'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x82'));_0x331b17[_0xa19e('0xa')]('i.subject');_0x331b17[_0xa19e('0xa')](_0xa19e('0x69'));_0x331b17['field'](_0xa19e('0x68'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x67'));_0x331b17['field'](_0xa19e('0x6a'));_0x331b17['field']('i.to');_0x331b17['field'](_0xa19e('0x83'));_0x331b17['field'](_0xa19e('0x84'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x85'));}else if(_0x9d442b==='openchannel'){_0x331b17[_0xa19e('0xa')](_0xa19e('0x86'),_0xa19e('0x7b'));}else{_0x331b17[_0xa19e('0xa')](_0xa19e('0x87'),_0xa19e('0x7b'));}if(_0x9d442b!==_0xa19e('0x31')){_0x331b17[_0xa19e('0xa')]('i.*');}_0x331b17[_0xa19e('0xa')]('c.firstName',_0xa19e('0x88'));_0x331b17['field'](_0xa19e('0x89'),_0xa19e('0x8a'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x8b'),_0xa19e('0x8c'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x8d'),'Contact.phone');_0x331b17[_0xa19e('0xa')](_0xa19e('0x8e'),_0xa19e('0x8f'));_0x331b17[_0xa19e('0xa')]('c.fax',_0xa19e('0x90'));_0x331b17['field']('o.fullname','Owner.fullname');_0x331b17[_0xa19e('0xa')](_0xa19e('0x91'),_0xa19e('0x92'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x93'),_0xa19e('0x94'));}if(_0x3f6bf7['limit']){_0x331b17[_0xa19e('0x95')](_0x3f6bf7['limit']);}if(_0x3f6bf7[_0xa19e('0x96')]){_0x331b17['offset'](_0x3f6bf7['offset']);}return db['sequelize'][_0xa19e('0x97')](_0x331b17[_0xa19e('0x73')](),_0x53a806);})[_0xa19e('0x5f')](function(_0x29177c){_0x45f260=_0x29177c;var _0x45ae6d=getUsersQuery(_0x9d442b,_0x45f260);return db[_0xa19e('0x72')][_0xa19e('0x97')](_0x45ae6d[_0xa19e('0x73')](),_0x53a806);})[_0xa19e('0x5f')](function(_0x23cefa){_0x52159a=_[_0xa19e('0x98')](_0x23cefa,_0x307a5d);if(_0x9d442b===_0xa19e('0x31')){return db['Setting'][_0xa19e('0x99')]({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x444a6e){var _0x23b6d9=_0x444a6e?_0x444a6e[_0xa19e('0x9a')]:undefined;var _0x3f2610=_0x45f260[_0xa19e('0x55')](function(_0x2ce237){return updateInteraction(_0x2ce237,_0x5ca466,_0x52159a,_0x23b6d9);});return Promise[_0xa19e('0x9b')](_0x3f2610);});}function countFilteredInteractions(_0x1c77d4,_0x52e038){var _0xc1d84e=_0x1c77d4[_0xa19e('0x9c')]();_0xc1d84e['field'](_0xa19e('0x9d'));_0xc1d84e[_0xa19e('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x12cb29=utils[_0xa19e('0x23')](_0x52e038);if(!_[_0xa19e('0x9e')](_0x12cb29)){_0xc1d84e[_0xa19e('0x18')](_0xa19e('0x9f'),_0x12cb29);}var _0x195f22={'type':db[_0xa19e('0x70')][_0xa19e('0xa0')][_0xa19e('0x71')],'raw':!![]};return db[_0xa19e('0x72')][_0xa19e('0x97')](_0xc1d84e[_0xa19e('0x73')](),_0x195f22);}module[_0xa19e('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 6ce0f05..2ccab34 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa901=['trimStart','plainBody','catch','then','Users','TagIds','Tags','lodash','../../mysqldb','map','split','push','waiting','talking','abandoned','total','closed','UserId','answered','unmanaged','MailMessage','findOne','out','-id','lastMsgText'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0xa901,0x84));var _0x1a90=function(_0x214525,_0x5d595c){_0x214525=_0x214525-0x0;var _0x292ccf=_0xa901[_0x214525];return _0x292ccf;};'use strict';var _=require(_0x1a90('0x0'));var db=require(_0x1a90('0x1'))['db'];function getInteractionUsers(_0x3bdf94,_0x257368){return new Promise(function(_0x3e4371,_0x5cc819){try{var _0x39bbf0=[];if(_0x257368[_0x3bdf94]){_0x39bbf0=_0x257368[_0x3bdf94][_0x1a90('0x2')](function(_0x11be6a){return{'id':_0x11be6a['id'],'fullname':_0x11be6a['fullname']};});}return _0x3e4371(_0x39bbf0);}catch(_0x36c433){_0x5cc819(_0x36c433);}});}function getInteractionTags(_0x3e2351,_0x3b6612){var _0x64f948=[];if(_0x3e2351){_0x3e2351[_0x1a90('0x3')](',')['forEach'](function(_0x2bfa59){_0x64f948[_0x1a90('0x4')](_0x3b6612[_0x2bfa59]);});}return _0x64f948;}function updateWaitingCounter(_0x46864e){if(_0x46864e[_0x1a90('0x5')]){_0x46864e[_0x1a90('0x5')]-=0x1;}}function updateInteractionCounters(_0x2112b2){_0x2112b2['waiting']=0x0;_0x2112b2[_0x1a90('0x6')]=0x0;_0x2112b2['answered']=0x0;_0x2112b2['unmanaged']=0x0;_0x2112b2[_0x1a90('0x7')]=0x0;_0x2112b2[_0x1a90('0x8')]=0x0;if(_0x2112b2[_0x1a90('0x9')]){if(_0x2112b2['disposition']===_0x1a90('0x7')){_0x2112b2['abandoned']+=0x1;updateWaitingCounter(_0x2112b2);}if(_0x2112b2[_0x1a90('0xa')]){_0x2112b2[_0x1a90('0xb')]+=0x1;if(_0x2112b2[_0x1a90('0x6')]){_0x2112b2['talking']-=0x1;}}else{if(_0x2112b2['disposition']){_0x2112b2[_0x1a90('0xc')]+=0x1;updateWaitingCounter(_0x2112b2);}}}else{if(!_0x2112b2[_0x1a90('0xa')]){_0x2112b2[_0x1a90('0x5')]+=0x1;}if(_0x2112b2[_0x1a90('0xa')]){_0x2112b2[_0x1a90('0x6')]+=0x1;updateWaitingCounter(_0x2112b2);}}_0x2112b2[_0x1a90('0x8')]+=0x1;return _0x2112b2;}function getLastMessageText(_0x55544c){return db[_0x1a90('0xd')][_0x1a90('0xe')]({'where':{'$and':[{'MailInteractionId':_0x55544c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1a90('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x1a90('0x10'),'raw':!![]})['then'](function(_0x567dd5){if(_0x567dd5&&_0x567dd5['plainBody']){_0x55544c[_0x1a90('0x11')]=_[_0x1a90('0x12')](_0x567dd5[_0x1a90('0x13')]);}return _0x55544c;})[_0x1a90('0x14')](function(_0x2d3de3){throw _0x2d3de3;});}exports['updateInteraction']=function(_0x2f12c6,_0x3f164b,_0x1c70cd,_0x365592){return new Promise(function(_0x151500,_0xa65878){return getInteractionUsers(_0x2f12c6['id'],_0x1c70cd)[_0x1a90('0x15')](function(_0x41fa20){_0x2f12c6[_0x1a90('0x16')]=_0x41fa20;return getInteractionTags(_0x2f12c6[_0x1a90('0x17')],_0x3f164b);})['then'](function(_0x1ba5a9){_0x2f12c6[_0x1a90('0x18')]=_0x1ba5a9;delete _0x2f12c6[_0x1a90('0x17')];return updateInteractionCounters(_0x2f12c6);})[_0x1a90('0x15')](function(_0x5bd4c4){if(_0x365592){return getLastMessageText(_0x5bd4c4);}else{return _0x5bd4c4;}})[_0x1a90('0x15')](function(_0x1ac550){_0x151500(_0x1ac550);})[_0x1a90('0x14')](function(_0x574058){_0xa65878(_0x574058);});});}; \ No newline at end of file +var _0xebf0=['updateInteraction','Users','TagIds','Tags','map','fullname','split','push','waiting','talking','answered','unmanaged','total','abandoned','disposition','UserId','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xebf0,0x117));var _0x0ebf=function(_0x4fed8a,_0x532e54){_0x4fed8a=_0x4fed8a-0x0;var _0x83600c=_0xebf0[_0x4fed8a];return _0x83600c;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x1d8986,_0x176e6e){return new Promise(function(_0x344556,_0x1c809a){try{var _0x653650=[];if(_0x176e6e[_0x1d8986]){_0x653650=_0x176e6e[_0x1d8986][_0x0ebf('0x0')](function(_0x39a05e){return{'id':_0x39a05e['id'],'fullname':_0x39a05e[_0x0ebf('0x1')]};});}return _0x344556(_0x653650);}catch(_0x53c389){_0x1c809a(_0x53c389);}});}function getInteractionTags(_0x489384,_0x29d28f){var _0x9dea4a=[];if(_0x489384){_0x489384[_0x0ebf('0x2')](',')['forEach'](function(_0x1410af){_0x9dea4a[_0x0ebf('0x3')](_0x29d28f[_0x1410af]);});}return _0x9dea4a;}function updateWaitingCounter(_0x3f9c17){if(_0x3f9c17[_0x0ebf('0x4')]){_0x3f9c17['waiting']-=0x1;}}function updateInteractionCounters(_0x1a9af0){_0x1a9af0[_0x0ebf('0x4')]=0x0;_0x1a9af0[_0x0ebf('0x5')]=0x0;_0x1a9af0[_0x0ebf('0x6')]=0x0;_0x1a9af0[_0x0ebf('0x7')]=0x0;_0x1a9af0['abandoned']=0x0;_0x1a9af0[_0x0ebf('0x8')]=0x0;if(_0x1a9af0['closed']){if(_0x1a9af0['disposition']===_0x0ebf('0x9')){_0x1a9af0[_0x0ebf('0x9')]+=0x1;updateWaitingCounter(_0x1a9af0);}if(_0x1a9af0['UserId']){_0x1a9af0[_0x0ebf('0x6')]+=0x1;if(_0x1a9af0[_0x0ebf('0x5')]){_0x1a9af0['talking']-=0x1;}}else{if(_0x1a9af0[_0x0ebf('0xa')]){_0x1a9af0[_0x0ebf('0x7')]+=0x1;updateWaitingCounter(_0x1a9af0);}}}else{if(!_0x1a9af0['UserId']){_0x1a9af0[_0x0ebf('0x4')]+=0x1;}if(_0x1a9af0[_0x0ebf('0xb')]){_0x1a9af0[_0x0ebf('0x5')]+=0x1;updateWaitingCounter(_0x1a9af0);}}_0x1a9af0[_0x0ebf('0x8')]+=0x1;return _0x1a9af0;}function getLastMessageText(_0x1d9f63){return db[_0x0ebf('0xc')][_0x0ebf('0xd')]({'where':{'$and':[{'MailInteractionId':_0x1d9f63['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0ebf('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0ebf('0xf')],'order':_0x0ebf('0x10'),'raw':!![]})[_0x0ebf('0x11')](function(_0x21822b){if(_0x21822b&&_0x21822b['plainBody']){_0x1d9f63[_0x0ebf('0x12')]=_[_0x0ebf('0x13')](_0x21822b[_0x0ebf('0xf')]);}return _0x1d9f63;})[_0x0ebf('0x14')](function(_0x4d0182){throw _0x4d0182;});}exports[_0x0ebf('0x15')]=function(_0xb1f4fe,_0x324e2f,_0x439798,_0x4ff986){return new Promise(function(_0x209a5c,_0xe7b802){return getInteractionUsers(_0xb1f4fe['id'],_0x439798)[_0x0ebf('0x11')](function(_0x42bd16){_0xb1f4fe[_0x0ebf('0x16')]=_0x42bd16;return getInteractionTags(_0xb1f4fe[_0x0ebf('0x17')],_0x324e2f);})[_0x0ebf('0x11')](function(_0x249a97){_0xb1f4fe[_0x0ebf('0x18')]=_0x249a97;delete _0xb1f4fe[_0x0ebf('0x17')];return updateInteractionCounters(_0xb1f4fe);})['then'](function(_0x48499b){if(_0x4ff986){return getLastMessageText(_0x48499b);}else{return _0x48499b;}})[_0x0ebf('0x11')](function(_0x5b2cd5){_0x209a5c(_0x5b2cd5);})[_0x0ebf('0x14')](function(_0x505c64){_0xe7b802(_0x505c64);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index f9505d1..597c2a6 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8158=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','lodash','../../mysqldb','mail-interactions','../../config/logger','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','InteractionId','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray'];(function(_0x30af8c,_0x577577){var _0x3c209d=function(_0x2473c5){while(--_0x2473c5){_0x30af8c['push'](_0x30af8c['shift']());}};_0x3c209d(++_0x577577);}(_0x8158,0x109));var _0x8815=function(_0x293eb4,_0x10b418){_0x293eb4=_0x293eb4-0x0;var _0x3e5914=_0x8158[_0x293eb4];return _0x3e5914;};'use strict';var _=require(_0x8815('0x0'));var db=require(_0x8815('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require('../../config/logger')(_0x8815('0x2')),'fax':require(_0x8815('0x3'))(_0x8815('0x4')),'sms':require(_0x8815('0x3'))(_0x8815('0x5')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0x8815('0x3'))(_0x8815('0x6'))};function getAccountFK(_0x12e8b1){return _[_0x8815('0x7')](_0x12e8b1)+(_0x12e8b1==='chat'?'Website':'Account')+'Id';}function getInteractionFK(_0x4d3fe6){return _['capitalize'](_0x4d3fe6)+_0x8815('0x8');}function getInteractionId(_0x5e376c,_0x14c69d,_0x4d39ed){if(_0x5e376c&&_0x5e376c[_['upperFirst'](_0x4d39ed)+'InteractionId']){return _0x5e376c[_['upperFirst'](_0x4d39ed)+_0x8815('0x8')];}else if(_0x5e376c&&_0x5e376c['id']){return _0x5e376c['id'];}else if(_0x14c69d&&_0x14c69d['id']){return _0x14c69d['id'];}else{return'unknown';}}function getInteractionsTables(_0xad1ce0){return{'accounts':_0xad1ce0+'_'+(_0xad1ce0==='chat'?_0x8815('0x9'):_0x8815('0xa')),'interactions':_0xad1ce0+_0x8815('0xb'),'interactionsTags':_0xad1ce0+_0x8815('0xc'),'messages':_0xad1ce0+'_messages','userInteractions':_0x8815('0xd')+_0xad1ce0+_0x8815('0xb')};}function getSelectedTags(_0x5fdce3){var _0x4b2979=[];if(_0x5fdce3){_0x4b2979=Array[_0x8815('0xe')](_0x5fdce3)?_0x5fdce3:[_0x5fdce3];}return _0x4b2979;}function log(_0xb081fd,_0xc0aca4,_0x3b6845,_0x528a97,_0x29660f,_0x4530ba){loggers[_0x29660f['toLowerCase']()][_0xb081fd](_0x8815('0xf'),_0x4530ba[_0x8815('0x10')](),_0xc0aca4?_0xc0aca4['id']:null,_0xc0aca4?_0xc0aca4[_0x8815('0x11')]:null,_0xc0aca4?_0xc0aca4[_0x8815('0x12')]:null,getInteractionId(_0x3b6845,_0x528a97,_0x29660f),_0x3b6845?JSON[_0x8815('0x13')](_0x3b6845):_0x8815('0x14'));}function updateUser(_0x3e3349,_0x2372a7,_0x4ac644,_0x3c1016,_0x13d011){db[_['upperFirst'](_0x3c1016)+_0x8815('0x15')][_0x8815('0x16')]({'where':{'id':getInteractionId(_0x2372a7,_0x4ac644,_0x3c1016)}})[_0x8815('0x17')](function(_0x2e0165){if(_0x2e0165){return _0x2e0165[_0x8815('0x18')]({'UserId':_0x3e3349?_0x3e3349['id']:null});}})[_0x8815('0x17')](function(_0x7b2951){if(_0x7b2951){log(_0x8815('0x19'),_0x3e3349,_0x2372a7,_0x4ac644,_0x3c1016,_0x13d011);}})[_0x8815('0x1a')](function(){log(_0x8815('0x1b'),_0x3e3349,_0x2372a7,_0x4ac644,_0x3c1016,_0x13d011);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x7f35=['unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','Interaction','findOne','then','update','catch','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7f35,0x81));var _0x57f3=function(_0x1b72f6,_0x5358cc){_0x1b72f6=_0x1b72f6-0x0;var _0x195bdc=_0x7f35[_0x1b72f6];return _0x195bdc;};'use strict';var _=require('lodash');var db=require(_0x57f3('0x0'))['db'];var loggers={'openchannel':require(_0x57f3('0x1'))(_0x57f3('0x2')),'mail':require(_0x57f3('0x1'))(_0x57f3('0x3')),'fax':require(_0x57f3('0x1'))('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x57f3('0x1'))('chat-interactions'),'whatsapp':require(_0x57f3('0x1'))(_0x57f3('0x4'))};function getAccountFK(_0x3a94b9){return _[_0x57f3('0x5')](_0x3a94b9)+(_0x3a94b9===_0x57f3('0x6')?_0x57f3('0x7'):_0x57f3('0x8'))+'Id';}function getInteractionFK(_0x245a74){return _['capitalize'](_0x245a74)+_0x57f3('0x9');}function getInteractionId(_0x545ac0,_0xade76e,_0x2e74d0){if(_0x545ac0&&_0x545ac0[_['upperFirst'](_0x2e74d0)+_0x57f3('0x9')]){return _0x545ac0[_[_0x57f3('0xa')](_0x2e74d0)+_0x57f3('0x9')];}else if(_0x545ac0&&_0x545ac0['id']){return _0x545ac0['id'];}else if(_0xade76e&&_0xade76e['id']){return _0xade76e['id'];}else{return _0x57f3('0xb');}}function getInteractionsTables(_0x54ed38){return{'accounts':_0x54ed38+'_'+(_0x54ed38===_0x57f3('0x6')?_0x57f3('0xc'):_0x57f3('0xd')),'interactions':_0x54ed38+_0x57f3('0xe'),'interactionsTags':_0x54ed38+_0x57f3('0xf'),'messages':_0x54ed38+_0x57f3('0x10'),'userInteractions':_0x57f3('0x11')+_0x54ed38+_0x57f3('0xe')};}function getSelectedTags(_0x125542){var _0x209eb9=[];if(_0x125542){_0x209eb9=Array[_0x57f3('0x12')](_0x125542)?_0x125542:[_0x125542];}return _0x209eb9;}function log(_0x1ee06,_0x2b6062,_0x40a218,_0x45641a,_0x317233,_0x287881){loggers[_0x317233[_0x57f3('0x13')]()][_0x1ee06](_0x57f3('0x14'),_0x287881[_0x57f3('0x15')](),_0x2b6062?_0x2b6062['id']:null,_0x2b6062?_0x2b6062['name']:null,_0x2b6062?_0x2b6062[_0x57f3('0x16')]:null,getInteractionId(_0x40a218,_0x45641a,_0x317233),_0x40a218?JSON['stringify'](_0x40a218):'null');}function updateUser(_0x5e9cd4,_0xda3be6,_0x45df14,_0x44c3cf,_0x2fb6e0){db[_['upperFirst'](_0x44c3cf)+_0x57f3('0x17')][_0x57f3('0x18')]({'where':{'id':getInteractionId(_0xda3be6,_0x45df14,_0x44c3cf)}})[_0x57f3('0x19')](function(_0x5e9ff3){if(_0x5e9ff3){return _0x5e9ff3[_0x57f3('0x1a')]({'UserId':_0x5e9cd4?_0x5e9cd4['id']:null});}})['then'](function(_0x5a5eac){if(_0x5a5eac){log('info',_0x5e9cd4,_0xda3be6,_0x45df14,_0x44c3cf,_0x2fb6e0);}})[_0x57f3('0x1b')](function(){log('error',_0x5e9cd4,_0xda3be6,_0x45df14,_0x44c3cf,_0x2fb6e0);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index c4aa871..8c25eb9 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 _0x1571=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status'];(function(_0x4d578e,_0x2a820d){var _0x33948e=function(_0x51227b){while(--_0x51227b){_0x4d578e['push'](_0x4d578e['shift']());}};_0x33948e(++_0x2a820d);}(_0x1571,0x1d7));var _0x1157=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x1571[_0x2e3107];return _0x833d69;};'use strict';var crypto=require('crypto');var util=require(_0x1157('0x0'));var compose=require(_0x1157('0x1'));var db=require(_0x1157('0x2'))['db'];var config=require(_0x1157('0x3'));function getValueFromLicense(_0x17bb2d,_0x281cb1){if(_0x17bb2d&&_0x281cb1){if(_0x281cb1[_0x1157('0x4')]&&_0x281cb1[_0x1157('0x5')]){var _0x1b6c48=_0x281cb1['data1'];var _0x21850e=_0x281cb1[_0x1157('0x5')];var _0x523325=_0x1b6c48[_0x1157('0x6')]('-')[0x4];var _0x3d222b=_0x1b6c48['split']('-')[0x0];var _0x3d0550=crypto[_0x1157('0x7')](_0x1157('0x8'),util[_0x1157('0x9')](_0x1157('0xa'),_0x523325,_0x1b6c48,_0x3d222b));var _0x15250d=_0x3d0550['update'](_0x21850e,_0x1157('0xb'),_0x1157('0xc'));_0x15250d+=_0x3d0550[_0x1157('0xd')](_0x1157('0xc'));var _0x36c99c=JSON[_0x1157('0xe')](_0x15250d);return _0x36c99c[_0x1157('0xf')](_0x17bb2d)?_0x36c99c[_0x17bb2d]:null;}}return null;}function isLimit(_0x2af1b2,_0x276d05,_0x4e0e68,_0x181187){var _0x5e28be=_0x276d05;return compose()[_0x1157('0x10')](function(_0x5f3afc,_0x29da09,_0x35a531){return db[_0x1157('0x11')][_0x1157('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x1157('0x13')](function(_0x5c3767){var _0x118846=getValueFromLicense(_0x2af1b2,_0x5c3767);return _0x118846?_0x118846:_0x5e28be;})[_0x1157('0x13')](function(_0xddd4f6){_0x5e28be=_0xddd4f6;return _0x4e0e68[_0x1157('0x14')](_0x181187);})[_0x1157('0x13')](function(_0xae188f){if(_0xae188f>=_0x5e28be){return _0x29da09[_0x1157('0x15')](0x193)['json']({'message':util[_0x1157('0x9')](_0x1157('0x16'),_0x2af1b2)});}_0x35a531();})[_0x1157('0x17')](function(_0x268e46){_0x35a531(_0x268e46);});});}function isUserLimit(){return isLimit(_0x1157('0x18'),0x1,db[_0x1157('0x19')],{'where':{'$or':[{'role':_0x1157('0x1a')},{'role':_0x1157('0x1b')}]}});}exports[_0x1157('0x1c')]=isUserLimit; \ No newline at end of file +var _0x4e86=['License','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','use'];(function(_0x5a64eb,_0x286782){var _0x3ad930=function(_0x36a52f){while(--_0x36a52f){_0x5a64eb['push'](_0x5a64eb['shift']());}};_0x3ad930(++_0x286782);}(_0x4e86,0x111));var _0x64e8=function(_0x4e5a48,_0x17e904){_0x4e5a48=_0x4e5a48-0x0;var _0x31baef=_0x4e86[_0x4e5a48];return _0x31baef;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x64e8('0x0'));var db=require(_0x64e8('0x1'))['db'];var config=require(_0x64e8('0x2'));function getValueFromLicense(_0x36fd33,_0x32a24a){if(_0x36fd33&&_0x32a24a){if(_0x32a24a[_0x64e8('0x3')]&&_0x32a24a[_0x64e8('0x4')]){var _0x285400=_0x32a24a['data1'];var _0x379abb=_0x32a24a[_0x64e8('0x4')];var _0x59d0a1=_0x285400[_0x64e8('0x5')]('-')[0x4];var _0x53b88e=_0x285400[_0x64e8('0x5')]('-')[0x0];var _0x30e9e2=crypto[_0x64e8('0x6')](_0x64e8('0x7'),util[_0x64e8('0x8')](_0x64e8('0x9'),_0x59d0a1,_0x285400,_0x53b88e));var _0x11f49c=_0x30e9e2[_0x64e8('0xa')](_0x379abb,_0x64e8('0xb'),'utf8');_0x11f49c+=_0x30e9e2[_0x64e8('0xc')](_0x64e8('0xd'));var _0x47f58d=JSON['parse'](_0x11f49c);return _0x47f58d['hasOwnProperty'](_0x36fd33)?_0x47f58d[_0x36fd33]:null;}}return null;}function isLimit(_0x12559b,_0x4dbe13,_0x3fd07c,_0x1a9b83){var _0xa5c663=_0x4dbe13;return compose()[_0x64e8('0xe')](function(_0x45a58e,_0x4f71b6,_0x328991){return db[_0x64e8('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x64e8('0x10')](function(_0x2f54bb){var _0x577f0e=getValueFromLicense(_0x12559b,_0x2f54bb);return _0x577f0e?_0x577f0e:_0xa5c663;})[_0x64e8('0x10')](function(_0x5542c4){_0xa5c663=_0x5542c4;return _0x3fd07c['count'](_0x1a9b83);})['then'](function(_0x2a3240){if(_0x2a3240>=_0xa5c663){return _0x4f71b6['status'](0x193)[_0x64e8('0x11')]({'message':util[_0x64e8('0x8')](_0x64e8('0x12'),_0x12559b)});}_0x328991();})[_0x64e8('0x13')](function(_0x27603e){_0x328991(_0x27603e);});});}function isUserLimit(){return isLimit(_0x64e8('0x14'),0x1,db[_0x64e8('0x15')],{'where':{'$or':[{'role':_0x64e8('0x16')},{'role':'user'}]}});}exports[_0x64e8('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4c4fb25..cb59ae9 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 _0x6252=['shift','filter','indexOf','map','conditions','push','DATE','operator','$between','value','includes','$gt','$lte','days','YYYY-MM-DD','castTo','text','field','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','format','utcOffset','add','hours','lodash','moment','parseSearch','sqlOperator','[$or]','replace','split','slice','forEach'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x6252,0xbf));var _0x2625=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x6252[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x2625('0x0'));var moment=require(_0x2625('0x1'));exports[_0x2625('0x2')]=function(_0x51a596){var _0x42c36f={'conditions':[]};_0x42c36f[_0x2625('0x3')]=_['startsWith'](_0x51a596,_0x2625('0x4'))?'or':'and';var _0x208dea=_0x51a596[_0x2625('0x5')]('[$and]','')[_0x2625('0x5')](_0x2625('0x4'),'')['split']('||');for(var _0x26fc1f=0x0;_0x26fc1f<_0x208dea['length'];_0x26fc1f++){var _0x31181b=_0x208dea[_0x26fc1f][_0x2625('0x6')](':=');var _0x26028b=_0x31181b[0x0];var _0x3d91e6=_0x31181b[_0x2625('0x7')](0x1);_0x3d91e6[_0x2625('0x8')](function(_0x2bf731){var _0x3cb34c=_0x2bf731['split']('[')[_0x2625('0x9')]();var _0x2d6f9c=_0x2bf731['match'](/\[(.*?)\]/g);_0x2d6f9c[_0x2625('0x8')](function(_0x1f63b0){var _0x51f93a=_0x1f63b0[_0x2625('0x6')]('[')[_0x2625('0xa')](function(_0x2cd985){return _0x2cd985[_0x2625('0xb')](']')>-0x1;})[_0x2625('0xc')](function(_0x35cfca){return _0x35cfca['split'](']')[0x0];})[0x0];_0x42c36f[_0x2625('0xd')][_0x2625('0xe')]({'field':_0x26028b,'operator':_0x3cb34c,'value':_0x51f93a});});});}return _0x42c36f;};exports['buildExpression']=function(_0x1deb5f,_0x5e2d5e,_0x156b7e){var _0x462d00={};if(_0x5e2d5e===_0x2625('0xf')){if(_0x156b7e[_0x2625('0x10')]==='$eq'){_0x156b7e[_0x2625('0x10')]=_0x2625('0x11');_0x156b7e[_0x2625('0x12')]+=','+_0x156b7e['value'];}else if(_[_0x2625('0x13')]([_0x2625('0x14'),_0x2625('0x15')],_0x156b7e[_0x2625('0x10')])){_0x156b7e[_0x2625('0x12')]=moment(_0x156b7e[_0x2625('0x12')])['add'](0x1,_0x2625('0x16'))['format'](_0x2625('0x17'));}}if(_0x156b7e[_0x2625('0x18')]){_0x5e2d5e=_0x156b7e[_0x2625('0x18')];_0x462d00[_0x2625('0x19')]='CAST('+_0x1deb5f+'.'+_0x156b7e[_0x2625('0x1a')]+'\x20AS\x20'+_0x156b7e[_0x2625('0x18')]+')\x20'+parseOperator(_0x156b7e['operator']);}else{_0x462d00[_0x2625('0x19')]=_0x1deb5f+'.'+_0x156b7e[_0x2625('0x1a')]+'\x20'+parseOperator(_0x156b7e[_0x2625('0x10')]);}if(_[_0x2625('0x13')](['$ne',_0x2625('0x1b')],_0x156b7e[_0x2625('0x10')]))_0x462d00[_0x2625('0x19')]='('+_0x462d00[_0x2625('0x19')]+_0x2625('0x1c')+_0x1deb5f+'.'+_0x156b7e[_0x2625('0x1a')]+_0x2625('0x1d');_0x462d00[_0x2625('0x12')]=parseValue(_0x5e2d5e,_0x156b7e[_0x2625('0x10')],_0x156b7e['value']);return _0x462d00;};function parseOperator(_0x32e9a9){var _0x2bc69c;switch(_0x32e9a9){case'$in':_0x2bc69c=_0x2625('0x1e');break;case'$notIn':_0x2bc69c=_0x2625('0x1f');break;case _0x2625('0x20'):_0x2bc69c=_0x2625('0x21');break;case'$ne':_0x2bc69c=_0x2625('0x22');break;case _0x2625('0x23'):case'$startsWith':case _0x2625('0x24'):_0x2bc69c=_0x2625('0x25');break;case _0x2625('0x26'):_0x2bc69c='<\x20?';break;case'$gt':_0x2bc69c=_0x2625('0x27');break;case _0x2625('0x15'):_0x2bc69c=_0x2625('0x28');break;case _0x2625('0x29'):_0x2bc69c='>=\x20?';break;case _0x2625('0x11'):_0x2bc69c=_0x2625('0x2a');break;}return _0x2bc69c;}function parseValue(_0x1406b9,_0x4d708d,_0x6c9e1d){var _0x4e9a40={'start':undefined,'end':undefined};switch(_0x4d708d){case _0x2625('0x2b'):case _0x2625('0x1b'):_0x4e9a40[_0x2625('0x2c')]=_0x6c9e1d['split'](',');break;case'$substring':_0x4e9a40[_0x2625('0x2c')]='%'+_0x6c9e1d+'%';break;case _0x2625('0x2d'):_0x4e9a40['start']=_0x6c9e1d+'%';break;case _0x2625('0x24'):_0x4e9a40[_0x2625('0x2c')]='%'+_0x6c9e1d;break;case'$between':var _0x41c341=_0x6c9e1d['split'](',');var _0x6c9e1d=_0x41c341['shift']();var _0x314f4a=_0x41c341['pop']();if(_0x1406b9==='DATE'){_0x6c9e1d=moment(_0x6c9e1d)['utcOffset'](0x0,!![])[_0x2625('0x2e')]();_0x314f4a=moment(_0x314f4a)[_0x2625('0x2f')](0x0,!![])[_0x2625('0x30')](0x17,_0x2625('0x31'))[_0x2625('0x30')](0x3b,'minutes')['add'](0x3b,'seconds')[_0x2625('0x2e')]();}_0x4e9a40={'start':_0x6c9e1d,'end':_0x314f4a};break;default:_0x4e9a40[_0x2625('0x2c')]=_0x6c9e1d;break;}return _0x4e9a40;} \ No newline at end of file +var _0xdf72=['minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','shift','match','forEach','filter','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','YYYY-MM-DD','CAST(','field','\x20AS\x20','castTo','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','>=\x20?','$substring','start','$endsWith','utcOffset','format'];(function(_0x296098,_0x43125e){var _0x341dc2=function(_0x15712a){while(--_0x15712a){_0x296098['push'](_0x296098['shift']());}};_0x341dc2(++_0x43125e);}(_0xdf72,0x1ba));var _0x2df7=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xdf72[_0x59d0cc];return _0x2ae79f;};'use strict';var _=require(_0x2df7('0x0'));var moment=require(_0x2df7('0x1'));exports[_0x2df7('0x2')]=function(_0xbd9bd5){var _0x10ac54={'conditions':[]};_0x10ac54[_0x2df7('0x3')]=_[_0x2df7('0x4')](_0xbd9bd5,_0x2df7('0x5'))?'or':_0x2df7('0x6');var _0x437f1c=_0xbd9bd5[_0x2df7('0x7')](_0x2df7('0x8'),'')[_0x2df7('0x7')](_0x2df7('0x5'),'')['split']('||');for(var _0x26d4fa=0x0;_0x26d4fa<_0x437f1c[_0x2df7('0x9')];_0x26d4fa++){var _0x5e5ffe=_0x437f1c[_0x26d4fa][_0x2df7('0xa')](':=');var _0x38e066=_0x5e5ffe[0x0];var _0x383456=_0x5e5ffe[_0x2df7('0xb')](0x1);_0x383456['forEach'](function(_0x6f0e86){var _0x164505=_0x6f0e86[_0x2df7('0xa')]('[')[_0x2df7('0xc')]();var _0x1bba13=_0x6f0e86[_0x2df7('0xd')](/\[(.*?)\]/g);_0x1bba13[_0x2df7('0xe')](function(_0x2ac9b0){var _0x196201=_0x2ac9b0[_0x2df7('0xa')]('[')[_0x2df7('0xf')](function(_0x2570ac){return _0x2570ac['indexOf'](']')>-0x1;})['map'](function(_0x4cfe9e){return _0x4cfe9e[_0x2df7('0xa')](']')[0x0];})[0x0];_0x10ac54[_0x2df7('0x10')]['push']({'field':_0x38e066,'operator':_0x164505,'value':_0x196201});});});}return _0x10ac54;};exports[_0x2df7('0x11')]=function(_0x306a97,_0x2af410,_0x4ca158){var _0xd8ad6b={};if(_0x2af410===_0x2df7('0x12')){if(_0x4ca158[_0x2df7('0x13')]===_0x2df7('0x14')){_0x4ca158[_0x2df7('0x13')]=_0x2df7('0x15');_0x4ca158[_0x2df7('0x16')]+=','+_0x4ca158[_0x2df7('0x16')];}else if(_[_0x2df7('0x17')]([_0x2df7('0x18'),'$lte'],_0x4ca158['operator'])){_0x4ca158[_0x2df7('0x16')]=moment(_0x4ca158[_0x2df7('0x16')])[_0x2df7('0x19')](0x1,_0x2df7('0x1a'))['format'](_0x2df7('0x1b'));}}if(_0x4ca158['castTo']){_0x2af410=_0x4ca158['castTo'];_0xd8ad6b['text']=_0x2df7('0x1c')+_0x306a97+'.'+_0x4ca158[_0x2df7('0x1d')]+_0x2df7('0x1e')+_0x4ca158[_0x2df7('0x1f')]+')\x20'+parseOperator(_0x4ca158[_0x2df7('0x13')]);}else{_0xd8ad6b[_0x2df7('0x20')]=_0x306a97+'.'+_0x4ca158[_0x2df7('0x1d')]+'\x20'+parseOperator(_0x4ca158[_0x2df7('0x13')]);}if(_['includes']([_0x2df7('0x21'),_0x2df7('0x22')],_0x4ca158[_0x2df7('0x13')]))_0xd8ad6b['text']='('+_0xd8ad6b[_0x2df7('0x20')]+_0x2df7('0x23')+_0x306a97+'.'+_0x4ca158['field']+_0x2df7('0x24');_0xd8ad6b[_0x2df7('0x16')]=parseValue(_0x2af410,_0x4ca158[_0x2df7('0x13')],_0x4ca158[_0x2df7('0x16')]);return _0xd8ad6b;};function parseOperator(_0x3bebd6){var _0x462008;switch(_0x3bebd6){case _0x2df7('0x25'):_0x462008=_0x2df7('0x26');break;case _0x2df7('0x22'):_0x462008='NOT\x20IN\x20?';break;case'$eq':_0x462008=_0x2df7('0x27');break;case _0x2df7('0x21'):_0x462008='<>\x20?';break;case'$substring':case _0x2df7('0x28'):case'$endsWith':_0x462008=_0x2df7('0x29');break;case _0x2df7('0x2a'):_0x462008=_0x2df7('0x2b');break;case _0x2df7('0x18'):_0x462008=_0x2df7('0x2c');break;case _0x2df7('0x2d'):_0x462008=_0x2df7('0x2e');break;case'$gte':_0x462008=_0x2df7('0x2f');break;case _0x2df7('0x15'):_0x462008='BETWEEN\x20?\x20AND\x20?';break;}return _0x462008;}function parseValue(_0x96ffd9,_0x493f74,_0x14ce8e){var _0x5adf59={'start':undefined,'end':undefined};switch(_0x493f74){case _0x2df7('0x25'):case _0x2df7('0x22'):_0x5adf59['start']=_0x14ce8e[_0x2df7('0xa')](',');break;case _0x2df7('0x30'):_0x5adf59[_0x2df7('0x31')]='%'+_0x14ce8e+'%';break;case'$startsWith':_0x5adf59[_0x2df7('0x31')]=_0x14ce8e+'%';break;case _0x2df7('0x32'):_0x5adf59[_0x2df7('0x31')]='%'+_0x14ce8e;break;case'$between':var _0x4dce06=_0x14ce8e[_0x2df7('0xa')](',');var _0x14ce8e=_0x4dce06[_0x2df7('0xc')]();var _0x12aaf0=_0x4dce06['pop']();if(_0x96ffd9==='DATE'){_0x14ce8e=moment(_0x14ce8e)[_0x2df7('0x33')](0x0,!![])[_0x2df7('0x34')]();_0x12aaf0=moment(_0x12aaf0)['utcOffset'](0x0,!![])[_0x2df7('0x19')](0x17,'hours')[_0x2df7('0x19')](0x3b,_0x2df7('0x35'))['add'](0x3b,_0x2df7('0x36'))[_0x2df7('0x34')]();}_0x5adf59={'start':_0x14ce8e,'end':_0x12aaf0};break;default:_0x5adf59[_0x2df7('0x31')]=_0x14ce8e;break;}return _0x5adf59;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 958ceaf..3ae1bdc 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 _0x814b=['unset','hasOwnProperty','match','^[+]?[0-9]*$','replace','push','join','query','$id','model','attributes','offset','where','filter','object','VIRTUAL','lower','merge','options','lodash','sequelize','moment','keys','includes','fields','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','sort','map','indexOf','cast','col','priority','unsigned','substr','DESC','ASC','omit','length','isObject','isString'];(function(_0x21a386,_0x3b6417){var _0x32f656=function(_0x223f06){while(--_0x223f06){_0x21a386['push'](_0x21a386['shift']());}};_0x32f656(++_0x3b6417);}(_0x814b,0x1a2));var _0xb814=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x814b[_0xb1cf84];return _0x4bad2e;};'use strict';var _=require(_0xb814('0x0'));var sequelize=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2f4ece){var _0xfbb64b=['ne'];try{var _0x477725=JSON['parse'](_0x2f4ece);var _0x38c21a=Object[_0xb814('0x3')](_0x477725)[0x0];return _0xfbb64b[_0xb814('0x4')](_0x38c21a);}catch(_0x4237bc){return![];}}function getOperatorValue(_0x44931c){var _0x322a70=JSON['parse'](_0x44931c);var _0x3b0829=Object[_0xb814('0x3')](_0x322a70)[0x0];var _0x5c8539=_0x322a70[_0x3b0829];return{['$'+_0x3b0829]:_0x5c8539};}exports[_0xb814('0x5')]=function(_0x2913a6){var _0x186d5a=null;if(_0x2913a6){_0x186d5a=_0x2913a6[_0xb814('0x6')](',');}return _0x186d5a;};exports[_0xb814('0x7')]=function(_0x21d4a5,_0x1086f8){var _0x19aad8={};if(!_[_0xb814('0x8')](_0x21d4a5)){_[_0xb814('0x9')](_0x21d4a5,function(_0x10e4a6,_0x4b5f14){try{if(_0x1086f8){var _0x43dfe6=_['find'](_0x1086f8,{'name':_0x4b5f14})||{};if(hasSequelizeOperator(_0x10e4a6)){_0x19aad8[_0x4b5f14]=getOperatorValue(_0x10e4a6);}else if(_0x43dfe6[_0xb814('0xa')]===_0xb814('0xb')&&_[_0xb814('0xc')](_0x10e4a6)){var _0x2cc46b=JSON[_0xb814('0xd')](_0x10e4a6);var _0x3bde14={'$gte':moment(moment(_0x2cc46b[_0xb814('0xe')])[_0xb814('0xf')](_0xb814('0x10')))[_0xb814('0x11')]()[_0xb814('0xf')](),'$lte':moment(moment(_0x2cc46b[_0xb814('0x12')])[_0xb814('0xf')](_0xb814('0x10')))[_0xb814('0x11')]()[_0xb814('0x13')](0x1,'s')[_0xb814('0xf')]()};_0x19aad8[_0x4b5f14]=_0x3bde14;}else if(_0x43dfe6[_0xb814('0x14')]===_0xb814('0x15')){_0x19aad8[_0x4b5f14]=_0x10e4a6;}else{_0x19aad8[_0x4b5f14]=_[_0xb814('0x16')](_0x10e4a6)?_0x10e4a6:JSON[_0xb814('0xd')](_0x10e4a6);}}else{_0x19aad8[_0x4b5f14]=_['isArray'](_0x10e4a6)?_0x10e4a6:JSON[_0xb814('0xd')](_0x10e4a6);}}catch(_0x55ba16){_0x19aad8[_0x4b5f14]=_0x10e4a6[_0xb814('0x6')](',');}});}return _0x19aad8;};exports[_0xb814('0x17')]=function(_0x4c3007){_0x4c3007=parseInt(_0x4c3007,0xa);if(!_0x4c3007||_0x4c3007<0x0){_0x4c3007=LIMIT_VALUE;}return _0x4c3007;};exports['offset']=function(_0x55d63c){_0x55d63c=parseInt(_0x55d63c,0xa);if(!_0x55d63c||_0x55d63c<0x0){_0x55d63c=0x0;}return _0x55d63c;};exports[_0xb814('0x18')]=function(_0x4d5276){var _0x57c128,_0xb684ea=null;if(_0x4d5276){_0x57c128=_0x4d5276[_0xb814('0x6')](',');_0xb684ea=_[_0xb814('0x19')](_0x57c128,function(_0x4e139e){if(_0x4e139e[_0xb814('0x1a')]('-')===0x0){return[_0x4e139e==='priority'?sequelize[_0xb814('0x1b')](sequelize[_0xb814('0x1c')](_0xb814('0x1d')),_0xb814('0x1e')):_0x4e139e[_0xb814('0x1f')](0x1),_0xb814('0x20')];}else{return[_0x4e139e===_0xb814('0x1d')?sequelize['cast'](sequelize[_0xb814('0x1c')]('priority'),_0xb814('0x1e')):_0x4e139e,_0xb814('0x21')];}});}return _0xb684ea;};exports[_0xb814('0x22')]=function(_0x208927,_0x1c8a2e){if(_[_0xb814('0x8')](_0x208927)){return _0x208927;}if(_[_0xb814('0x16')](_0x208927)){for(var _0x5755ea=0x0;_0x5755ea<_0x208927[_0xb814('0x23')];_0x5755ea+=0x1){_0x208927[_0x5755ea]=this[_0xb814('0x22')](_0x208927[_0x5755ea],_0x1c8a2e);}return _0x208927;}if(!_[_0xb814('0x24')](_0x208927)){return _0x208927;}if(_[_0xb814('0x25')](_0x1c8a2e)){_0x1c8a2e=[_0x1c8a2e];}if(!_[_0xb814('0x16')](_0x1c8a2e)){return _0x208927;}for(var _0x1d5965=0x0;_0x1d5965<_0x1c8a2e[_0xb814('0x23')];_0x1d5965+=0x1){_[_0xb814('0x26')](_0x208927,_0x1c8a2e[_0x1d5965]);}for(var _0x5a6291 in _0x208927){if(_0x208927[_0xb814('0x27')](_0x5a6291)){_0x208927[_0x5a6291]=this[_0xb814('0x22')](_0x208927[_0x5a6291],_0x1c8a2e);}}return _0x208927;};exports['isNumeric']=function(_0x9008b2){return _0x9008b2[_0xb814('0x28')](RegExp(_0xb814('0x29')))?!![]:![];};exports['isEmail']=function(_0x20577b){return _0x20577b[_0xb814('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x338a28){var _0x526610=[];_0x338a28[_0xb814('0x6')](/[ ,]+/)['forEach'](function(_0x4cfc58){_0x4cfc58=_0x4cfc58[_0xb814('0x2a')](/([^:]")"+/g,'$1');_0x4cfc58='+'+_0x4cfc58+'*';var _0x4a4f27=/[ `!@#$%^&*()_\-?~]/;if(_0x4cfc58[_0xb814('0x28')](_0x4a4f27))_0x4cfc58='\x22'+_0x4cfc58+'\x22';_0x526610[_0xb814('0x2b')](_0x4cfc58);});return _0x526610[_0xb814('0x2c')]('\x20');};exports['getOptions']=function(_0x51d5ae,_0x26d3a9,_0x336e2b){var _0x523566={},_0x2c8943={};if(_0x26d3a9[_0xb814('0x2d')][_0xb814('0x2e')]){_0x26d3a9[_0xb814('0x2d')]['id']=_0x26d3a9[_0xb814('0x2d')][_0xb814('0x2e')];delete _0x26d3a9[_0xb814('0x2d')]['$id'];}_0x523566[_0xb814('0x2f')]=_[_0xb814('0x19')](_0x51d5ae,_0xb814('0x14'));_0x523566[_0xb814('0x2d')]=_[_0xb814('0x3')](_0x26d3a9['query']);_0x523566[_0xb814('0x7')]=_['intersection'](_0x523566[_0xb814('0x2f')],_0x523566[_0xb814('0x2d')]);_0x2c8943[_0xb814('0x30')]=_['intersection'](_0x523566[_0xb814('0x2f')],this[_0xb814('0x5')](_0x26d3a9['query'][_0xb814('0x5')]));_0x2c8943[_0xb814('0x30')]=_0x2c8943[_0xb814('0x30')][_0xb814('0x23')]?_0x2c8943[_0xb814('0x30')]:_0x523566[_0xb814('0x2f')];if(!_0x26d3a9['query'][_0xb814('0x27')]('nolimit')){_0x2c8943[_0xb814('0x17')]=this['limit'](_0x26d3a9[_0xb814('0x2d')]['limit']);_0x2c8943[_0xb814('0x31')]=this[_0xb814('0x31')](_0x26d3a9['query']['offset']);}_0x2c8943['order']=this['sort'](_0x26d3a9[_0xb814('0x2d')][_0xb814('0x18')]);_0x2c8943[_0xb814('0x32')]=this[_0xb814('0x7')](_['pick'](_0x26d3a9['query'],_0x523566[_0xb814('0x7')]),_0x51d5ae);if(_0x26d3a9['query'][_0xb814('0x33')]){var _0x1098eb=_0x51d5ae;var _0x178823=_0x26d3a9[_0xb814('0x2d')][_0xb814('0x33')];if(typeof _0x178823===_0xb814('0x34')){_0x1098eb=_[_0xb814('0x33')](_0x51d5ae,function(_0x28b2b4){return _[_0xb814('0x4')](_0x178823['columns'],_0x28b2b4['name']);});_0x178823=_0x178823['value'];}_0x2c8943[_0xb814('0x32')]=_['merge'](_0x2c8943[_0xb814('0x32')],{'$or':_['map'](_0x1098eb,function(_0x411723){if(_0x411723[_0xb814('0xa')]!==_0xb814('0x35')){if(_0x336e2b){return sequelize[_0xb814('0x32')](sequelize['fn']('lower',sequelize[_0xb814('0x1c')](_0x411723[_0xb814('0x14')])),{'$like':sequelize['fn'](_0xb814('0x36'),'%'+_0x26d3a9[_0xb814('0x2d')][_0xb814('0x33')]+'%')});}else{var _0x450a08={};_0x450a08[_0x411723['name']]={'$like':'%'+_0x26d3a9[_0xb814('0x2d')][_0xb814('0x33')]+'%'};return _0x450a08;}}})});}_0x2c8943=_[_0xb814('0x37')]({},_0x2c8943,_0x26d3a9[_0xb814('0x38')]);return _0x2c8943;}; \ No newline at end of file +var _0xf2ca=['isArray','split','limit','offset','sort','map','indexOf','priority','cast','unsigned','substr','col','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','getOptions','query','$id','model','attributes','nolimit','order','where','pick','filter','object','value','VIRTUAL','lower','merge','options','lodash','sequelize','moment','parse','keys','includes','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid'];(function(_0x58271e,_0x307e00){var _0x4605e9=function(_0x32ac57){while(--_0x32ac57){_0x58271e['push'](_0x58271e['shift']());}};_0x4605e9(++_0x307e00);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3564d6,_0x37d1cb){_0x3564d6=_0x3564d6-0x0;var _0x1f2267=_0xf2ca[_0x3564d6];return _0x1f2267;};'use strict';var _=require(_0xaf2c('0x0'));var sequelize=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x598667){var _0xbb7f52=['ne'];try{var _0x2102e2=JSON[_0xaf2c('0x3')](_0x598667);var _0x219511=Object[_0xaf2c('0x4')](_0x2102e2)[0x0];return _0xbb7f52[_0xaf2c('0x5')](_0x219511);}catch(_0x5b8c81){return![];}}function getOperatorValue(_0x1fd101){var _0x100d17=JSON[_0xaf2c('0x3')](_0x1fd101);var _0x1f9531=Object['keys'](_0x100d17)[0x0];var _0x37fedd=_0x100d17[_0x1f9531];return{['$'+_0x1f9531]:_0x37fedd};}exports[_0xaf2c('0x6')]=function(_0x4a7397){var _0x2a011d=null;if(_0x4a7397){_0x2a011d=_0x4a7397['split'](',');}return _0x2a011d;};exports[_0xaf2c('0x7')]=function(_0x4a0064,_0x2f5099){var _0x144a7a={};if(!_[_0xaf2c('0x8')](_0x4a0064)){_[_0xaf2c('0x9')](_0x4a0064,function(_0x5ad9b0,_0x4adc8c){try{if(_0x2f5099){var _0x2c0d88=_[_0xaf2c('0xa')](_0x2f5099,{'name':_0x4adc8c})||{};if(hasSequelizeOperator(_0x5ad9b0)){_0x144a7a[_0x4adc8c]=getOperatorValue(_0x5ad9b0);}else if(_0x2c0d88[_0xaf2c('0xb')]===_0xaf2c('0xc')&&_[_0xaf2c('0xd')](_0x5ad9b0)){var _0x59a59b=JSON['parse'](_0x5ad9b0);var _0x15ccb4={'$gte':moment(moment(_0x59a59b[_0xaf2c('0xe')])[_0xaf2c('0xf')](_0xaf2c('0x10')))[_0xaf2c('0x11')]()[_0xaf2c('0xf')](),'$lte':moment(moment(_0x59a59b[_0xaf2c('0x12')])[_0xaf2c('0xf')](_0xaf2c('0x10')))[_0xaf2c('0x11')]()[_0xaf2c('0x13')](0x1,'s')[_0xaf2c('0xf')]()};_0x144a7a[_0x4adc8c]=_0x15ccb4;}else if(_0x2c0d88[_0xaf2c('0x14')]===_0xaf2c('0x15')){_0x144a7a[_0x4adc8c]=_0x5ad9b0;}else{_0x144a7a[_0x4adc8c]=_[_0xaf2c('0x16')](_0x5ad9b0)?_0x5ad9b0:JSON['parse'](_0x5ad9b0);}}else{_0x144a7a[_0x4adc8c]=_[_0xaf2c('0x16')](_0x5ad9b0)?_0x5ad9b0:JSON['parse'](_0x5ad9b0);}}catch(_0x278a28){_0x144a7a[_0x4adc8c]=_0x5ad9b0[_0xaf2c('0x17')](',');}});}return _0x144a7a;};exports[_0xaf2c('0x18')]=function(_0x578492){_0x578492=parseInt(_0x578492,0xa);if(!_0x578492||_0x578492<0x0){_0x578492=LIMIT_VALUE;}return _0x578492;};exports[_0xaf2c('0x19')]=function(_0x297bcd){_0x297bcd=parseInt(_0x297bcd,0xa);if(!_0x297bcd||_0x297bcd<0x0){_0x297bcd=0x0;}return _0x297bcd;};exports[_0xaf2c('0x1a')]=function(_0x20000b){var _0x3f977c,_0x1b7f07=null;if(_0x20000b){_0x3f977c=_0x20000b['split'](',');_0x1b7f07=_[_0xaf2c('0x1b')](_0x3f977c,function(_0x164bcb){if(_0x164bcb[_0xaf2c('0x1c')]('-')===0x0){return[_0x164bcb===_0xaf2c('0x1d')?sequelize[_0xaf2c('0x1e')](sequelize['col'](_0xaf2c('0x1d')),_0xaf2c('0x1f')):_0x164bcb[_0xaf2c('0x20')](0x1),'DESC'];}else{return[_0x164bcb==='priority'?sequelize[_0xaf2c('0x1e')](sequelize[_0xaf2c('0x21')](_0xaf2c('0x1d')),_0xaf2c('0x1f')):_0x164bcb,'ASC'];}});}return _0x1b7f07;};exports[_0xaf2c('0x22')]=function(_0xf1a7cf,_0x3a0145){if(_[_0xaf2c('0x8')](_0xf1a7cf)){return _0xf1a7cf;}if(_[_0xaf2c('0x16')](_0xf1a7cf)){for(var _0xff396f=0x0;_0xff396f<_0xf1a7cf[_0xaf2c('0x23')];_0xff396f+=0x1){_0xf1a7cf[_0xff396f]=this['omit'](_0xf1a7cf[_0xff396f],_0x3a0145);}return _0xf1a7cf;}if(!_[_0xaf2c('0x24')](_0xf1a7cf)){return _0xf1a7cf;}if(_[_0xaf2c('0x25')](_0x3a0145)){_0x3a0145=[_0x3a0145];}if(!_[_0xaf2c('0x16')](_0x3a0145)){return _0xf1a7cf;}for(var _0x410536=0x0;_0x410536<_0x3a0145['length'];_0x410536+=0x1){_[_0xaf2c('0x26')](_0xf1a7cf,_0x3a0145[_0x410536]);}for(var _0x589d47 in _0xf1a7cf){if(_0xf1a7cf[_0xaf2c('0x27')](_0x589d47)){_0xf1a7cf[_0x589d47]=this[_0xaf2c('0x22')](_0xf1a7cf[_0x589d47],_0x3a0145);}}return _0xf1a7cf;};exports[_0xaf2c('0x28')]=function(_0x5d685a){return _0x5d685a[_0xaf2c('0x29')](RegExp(_0xaf2c('0x2a')))?!![]:![];};exports[_0xaf2c('0x2b')]=function(_0x4a96d2){return _0x4a96d2[_0xaf2c('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0xaf2c('0x2c')]=function(_0x42e2a5){var _0x19364e=[];_0x42e2a5['split'](/[ ,]+/)[_0xaf2c('0x2d')](function(_0x4072ff){_0x4072ff=_0x4072ff[_0xaf2c('0x2e')](/([^:]")"+/g,'$1');_0x4072ff='+'+_0x4072ff+'*';var _0x51a49c=/[ `!@#$%^&*()_\-?~]/;if(_0x4072ff['match'](_0x51a49c))_0x4072ff='\x22'+_0x4072ff+'\x22';_0x19364e[_0xaf2c('0x2f')](_0x4072ff);});return _0x19364e['join']('\x20');};exports[_0xaf2c('0x30')]=function(_0x5e7247,_0x337cea,_0x1e4de2){var _0x4ffbb9={},_0x1408e3={};if(_0x337cea[_0xaf2c('0x31')]['$id']){_0x337cea[_0xaf2c('0x31')]['id']=_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x32')];delete _0x337cea[_0xaf2c('0x31')][_0xaf2c('0x32')];}_0x4ffbb9[_0xaf2c('0x33')]=_['map'](_0x5e7247,_0xaf2c('0x14'));_0x4ffbb9['query']=_[_0xaf2c('0x4')](_0x337cea['query']);_0x4ffbb9[_0xaf2c('0x7')]=_['intersection'](_0x4ffbb9[_0xaf2c('0x33')],_0x4ffbb9['query']);_0x1408e3[_0xaf2c('0x34')]=_['intersection'](_0x4ffbb9[_0xaf2c('0x33')],this[_0xaf2c('0x6')](_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x6')]));_0x1408e3[_0xaf2c('0x34')]=_0x1408e3['attributes']['length']?_0x1408e3[_0xaf2c('0x34')]:_0x4ffbb9[_0xaf2c('0x33')];if(!_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x27')](_0xaf2c('0x35'))){_0x1408e3[_0xaf2c('0x18')]=this['limit'](_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x18')]);_0x1408e3['offset']=this[_0xaf2c('0x19')](_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x19')]);}_0x1408e3[_0xaf2c('0x36')]=this[_0xaf2c('0x1a')](_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x1a')]);_0x1408e3[_0xaf2c('0x37')]=this[_0xaf2c('0x7')](_[_0xaf2c('0x38')](_0x337cea[_0xaf2c('0x31')],_0x4ffbb9[_0xaf2c('0x7')]),_0x5e7247);if(_0x337cea[_0xaf2c('0x31')]['filter']){var _0x54a953=_0x5e7247;var _0x4db7d0=_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x39')];if(typeof _0x4db7d0===_0xaf2c('0x3a')){_0x54a953=_[_0xaf2c('0x39')](_0x5e7247,function(_0x715f39){return _[_0xaf2c('0x5')](_0x4db7d0['columns'],_0x715f39[_0xaf2c('0x14')]);});_0x4db7d0=_0x4db7d0[_0xaf2c('0x3b')];}_0x1408e3[_0xaf2c('0x37')]=_['merge'](_0x1408e3['where'],{'$or':_[_0xaf2c('0x1b')](_0x54a953,function(_0x4f8440){if(_0x4f8440[_0xaf2c('0xb')]!==_0xaf2c('0x3c')){if(_0x1e4de2){return sequelize[_0xaf2c('0x37')](sequelize['fn'](_0xaf2c('0x3d'),sequelize['col'](_0x4f8440[_0xaf2c('0x14')])),{'$like':sequelize['fn']('lower','%'+_0x337cea[_0xaf2c('0x31')][_0xaf2c('0x39')]+'%')});}else{var _0x58bd9b={};_0x58bd9b[_0x4f8440[_0xaf2c('0x14')]]={'$like':'%'+_0x337cea['query'][_0xaf2c('0x39')]+'%'};return _0x58bd9b;}}})});}_0x1408e3=_[_0xaf2c('0x3e')]({},_0x1408e3,_0x337cea[_0xaf2c('0x3f')]);return _0x1408e3;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 29e9dda..3a7e76b 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99f0=['Queue','map','findOne','all','flatten','uniq','value','getAgentIdsByQueues','includes','User','fullname','pauseType','merge','globalStatus','getSortedAgentsIdsByStatus','split','startsWith','DESC','ASC','internal','substring','indexOf','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','faxStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','unknown','unavailable','isNil','voiceStatus','idle','pause','every','chatStatus','smsStatus','whatsappStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray'];(function(_0x3a5581,_0x8f7656){var _0x469741=function(_0x3d4e03){while(--_0x3d4e03){_0x3a5581['push'](_0x3a5581['shift']());}};_0x469741(++_0x8f7656);}(_0x99f0,0xea));var _0x099f=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x99f0[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x099f('0x0'));var jayson=require(_0x099f('0x1'));var db=require(_0x099f('0x2'))['db'];var amiClient=jayson[_0x099f('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x099f('0x3')][_0x099f('0x4')]({'port':0x232c});function isAgentPaused(_0x5062be,_0x4c8329){var _0x5e5500=[_0x5062be[_0x099f('0x5')],_0x5062be[_0x099f('0x6')],_0x5062be[_0x099f('0x7')],_0x5062be[_0x099f('0x8')],_0x5062be[_0x099f('0x9')],_0x5062be[_0x099f('0xa')],_0x5062be[_0x099f('0xb')]];if(!_0x4c8329)return _['every'](_0x5e5500);var _0x139e23=_[_0x099f('0xc')](_0x5e5500);return _0x139e23[_0x099f('0xd')]>0x0&&_0x139e23['length']<_0x5e5500['length']?!![]:![];}function isIdle(_0x6f9506){return _0x6f9506==='idle'||_0x6f9506===_0x099f('0xe')||_0x6f9506===_0x099f('0xf')||_0x6f9506==='ringing'||_[_0x099f('0x10')](_0x6f9506);}function isAgentIdle(_0x99921c){if(_0x99921c[_0x099f('0x11')]!==_0x099f('0x12')&&_0x99921c[_0x099f('0xa')]){_0x99921c[_0x099f('0x11')]=_0x099f('0x13');return![];}return _[_0x099f('0x14')]([_0x99921c[_0x099f('0x15')],_0x99921c['faxStatus'],_0x99921c['mailStatus'],_0x99921c['openchannelStatus'],_0x99921c[_0x099f('0x16')],_0x99921c[_0x099f('0x11')],_0x99921c[_0x099f('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x099f('0x18')]('Agents',{})[_0x099f('0x19')](function(_0x1e87e3){if(_0x1e87e3[_0x099f('0x1a')]){throw new Error(_0x099f('0x1b'));}var _0x26a008=_0x1e87e3[_0x099f('0x1c')];return routingClient[_0x099f('0x18')](_0x099f('0x1d'),{})['then'](function(_0x499570){if(_0x499570[_0x099f('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x1dd7ab=_0x499570[_0x099f('0x1c')];return _['merge']({},_0x26a008,_0x1dd7ab);});})[_0x099f('0x1e')](function(_0x30de5f){throw _0x30de5f;});}exports[_0x099f('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x253ba3){var _0x7dcaef='unknown';if(isAgentPaused(_0x253ba3))_0x7dcaef=_0x099f('0x13');else if(isAgentPaused(_0x253ba3,!![]))_0x7dcaef=_0x099f('0x20');else if(isAgentIdle(_0x253ba3))_0x7dcaef=_0x099f('0x12');else _0x7dcaef=_0x099f('0x21');return _0x7dcaef;}exports[_0x099f('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x1832e7,_0x5755f9){var _0x527ebe=_[_0x099f('0x23')](_0x1832e7)?_0x1832e7:[_0x1832e7];var _0x572017=_['startCase'](_0x5755f9)+_0x099f('0x24');var _0x13f4a8=_[_0x099f('0x25')](_0x527ebe,function(_0x3cb6ae){return db[_0x572017][_0x099f('0x26')]({'where':{'id':_0x3cb6ae}})[_0x099f('0x19')](function(_0x5bba84){if(!_0x5bba84)return[];return _0x5bba84['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x099f('0x27')](_0x13f4a8)[_0x099f('0x19')](function(_0x408cc3){var _0x4cd4ea=_(_0x408cc3)[_0x099f('0x28')]()[_0x099f('0x25')]('id')[_0x099f('0x29')]()[_0x099f('0x2a')]();return _0x4cd4ea;});}exports[_0x099f('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1aa0aa,_0x4cd3d6,_0x2e05d0){try{if(_0x4cd3d6[_0x099f('0xd')]>0x0){_0x1aa0aa=_0x1aa0aa['filter'](function(_0x1c51a9){return _0x4cd3d6[_0x099f('0x2c')](_0x1c51a9['id']);});}var _0x3ff0e8=_0x1aa0aa[_0x099f('0xc')](function(_0x1c38b5){var _0x5334d6=_0x099f('0x21');if(isAgentIdle(_0x1c38b5)){_0x5334d6=_0x099f('0x12');}return _0x5334d6===_0x2e05d0;});return _[_0x099f('0x25')](_0x3ff0e8,'id');}catch(_0x412f8c){throw _0x412f8c;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2f9746,_0x2b9511,_0x5140ed){return Promise['resolve']()[_0x099f('0x19')](function(){if(_0x2b9511[_0x099f('0xd')]>0x0){_0x2f9746=_0x2f9746[_0x099f('0xc')](function(_0x316434){return _0x2b9511[_0x099f('0x2c')](_0x316434['id']);});}return _0x2f9746;})[_0x099f('0x19')](function(){return db[_0x099f('0x2d')]['findAll']({'attributes':['id','name',_0x099f('0x2e'),_0x099f('0x5'),_0x099f('0x6'),_0x099f('0x7'),'openchannelPause',_0x099f('0x9'),_0x099f('0xa'),'whatsappPause',_0x099f('0x2f')],'where':{'id':{'$in':_[_0x099f('0x25')](_0x2f9746,'id')}},'raw':!![]});})[_0x099f('0x19')](function(_0x2ce411){return _0x2ce411[_0x099f('0x25')](function(_0x1740ab){var _0x152c9a=_['find'](_0x2f9746,['id',_0x1740ab['id']]);var _0x2f8981=filterAgentAttributes(_0x152c9a);_[_0x099f('0x30')](_0x1740ab,_0x2f8981);_0x1740ab[_0x099f('0x31')]=getAgentStatus(_0x1740ab);return _0x1740ab;});})['then'](function(_0x128adc){var _0x581a60=sortAgentsByStatus(_0x128adc,_0x5140ed);return _['map'](_0x581a60,'id');})['catch'](function(_0x34d61b){throw _0x34d61b;});}exports[_0x099f('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1768fe){var _0x1c130e={'fields':[],'order':null};var _0xad21fb=_0x1768fe[_0x099f('0x33')](',');_0x1c130e['fields']=_[_0x099f('0xc')](_0xad21fb,function(_0x29ec4f){if(!_0x29ec4f['includes']('globalStatus')){return!![];}_0x1c130e['order']=_[_0x099f('0x34')](_0x29ec4f,'-')?_0x099f('0x35'):_0x099f('0x36');return![];});return _0x1c130e;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x134be9){if(_0x134be9[_0x099f('0x2c')](_0x099f('0x2e'))&&!_0x134be9['includes'](_0x099f('0x37'))){var _0x351939=_0x134be9[_0x099f('0x38')](0x0,_0x134be9[_0x099f('0x39')](_0x099f('0x2e')));_0x134be9+=','+_0x351939+_0x099f('0x37');}return _0x134be9;}exports[_0x099f('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0xf85eb1,_0x3e2a71){var _0x4653e2=_0xf85eb1['sort'](function(_0x13067e,_0x40713b){if(_0x13067e['globalStatus']===_0x40713b[_0x099f('0x31')]){if(_0x13067e[_0x099f('0x31')]===_0x099f('0x13')){if(_0x3e2a71===_0x099f('0x35')){return(_0x13067e[_0x099f('0x2f')]||'')<(_0x40713b[_0x099f('0x2f')]||'')||_0x13067e[_0x099f('0x2e')][_0x099f('0x3b')]()>_0x40713b['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x13067e[_0x099f('0x2f')]||'')<(_0x40713b[_0x099f('0x2f')]||'')||_0x13067e[_0x099f('0x2e')][_0x099f('0x3b')]()>_0x40713b[_0x099f('0x2e')][_0x099f('0x3b')]()?-0x1:0x1;}}else{if(_0x3e2a71===_0x099f('0x35')){return _0x13067e[_0x099f('0x2e')][_0x099f('0x3b')]()<_0x40713b['fullname'][_0x099f('0x3b')]()?0x1:-0x1;}else{return _0x13067e[_0x099f('0x2e')][_0x099f('0x3b')]()<_0x40713b[_0x099f('0x2e')][_0x099f('0x3b')]()?-0x1:0x1;}}}else{if(_0x3e2a71===_0x099f('0x35')){return _0x13067e[_0x099f('0x31')]<_0x40713b[_0x099f('0x31')]?0x1:-0x1;}else{return _0x13067e[_0x099f('0x31')]<_0x40713b[_0x099f('0x31')]?-0x1:0x1;}}});return _0x4653e2;}exports[_0x099f('0x3c')]=sortAgentsByStatus;function filterAgentAttributes(_0x3d89ee){var _0x19b044=[_0x099f('0x3d'),_0x099f('0x3e'),_0x099f('0x3f'),_0x099f('0x40'),_0x099f('0x2f'),_0x099f('0x40'),_0x099f('0x37'),'address',_0x099f('0x5'),_0x099f('0x8'),'mailPause','smsPause','whatsappPause','faxPause',_0x099f('0xa'),_0x099f('0x41'),_0x099f('0x42'),_0x099f('0x43'),'smsCapacity',_0x099f('0x44'),_0x099f('0x45'),_0x099f('0x46'),'openchannelCurrentCapacity',_0x099f('0x47'),_0x099f('0x48'),_0x099f('0x49'),_0x099f('0x4a'),_0x099f('0x15'),_0x099f('0x4b'),_0x099f('0x4c'),_0x099f('0x16'),_0x099f('0x17'),_0x099f('0x4d'),_0x099f('0x11'),_0x099f('0x4e'),'openchannelStatusTime',_0x099f('0x4f'),_0x099f('0x50'),_0x099f('0x51'),_0x099f('0x52'),_0x099f('0x53'),_0x099f('0x54'),'destconnectedlinenum',_0x099f('0x55'),_0x099f('0x56'),'phoneBarEnableAutomaticScreenRecording',_0x099f('0x57')];var _0x239dbc=[_0x099f('0x5'),'openchannelPause',_0x099f('0x7'),_0x099f('0x9'),_0x099f('0xb'),_0x099f('0x6'),'voicePause',_0x099f('0x3e')];var _0x203668=_(_0x3d89ee)['omit'](_0x239dbc)[_0x099f('0x58')](_0x19b044)[_0x099f('0x2a')]();return _0x203668;}exports[_0x099f('0x59')]=filterAgentAttributes; \ No newline at end of file +var _0x1326=['every','length','unknown','unavailable','ringing','idle','voiceStatus','pause','chatStatus','faxStatus','mailStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','Queue','map','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','fullname','chatPause','mailPause','pauseType','find','merge','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableAutomaticScreenRecording','../../mysqldb','client','http','faxPause','openchannelPause','smsPause','voicePause','whatsappPause'];(function(_0x2c5435,_0x1bbff8){var _0x1f7ffe=function(_0x5c6ac3){while(--_0x5c6ac3){_0x2c5435['push'](_0x2c5435['shift']());}};_0x1f7ffe(++_0x1bbff8);}(_0x1326,0x150));var _0x6132=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x1326[_0xd299c3];return _0x376574;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require(_0x6132('0x0'))['db'];var amiClient=jayson[_0x6132('0x1')][_0x6132('0x2')]({'port':0x232a});var routingClient=jayson[_0x6132('0x1')]['http']({'port':0x232c});function isAgentPaused(_0x3b9dae,_0x4b05c4){var _0x354ea6=[_0x3b9dae['chatPause'],_0x3b9dae[_0x6132('0x3')],_0x3b9dae['mailPause'],_0x3b9dae[_0x6132('0x4')],_0x3b9dae[_0x6132('0x5')],_0x3b9dae[_0x6132('0x6')],_0x3b9dae[_0x6132('0x7')]];if(!_0x4b05c4)return _[_0x6132('0x8')](_0x354ea6);var _0x349e93=_['filter'](_0x354ea6);return _0x349e93['length']>0x0&&_0x349e93[_0x6132('0x9')]<_0x354ea6[_0x6132('0x9')]?!![]:![];}function isIdle(_0x18e1ee){return _0x18e1ee==='idle'||_0x18e1ee===_0x6132('0xa')||_0x18e1ee===_0x6132('0xb')||_0x18e1ee===_0x6132('0xc')||_['isNil'](_0x18e1ee);}function isAgentIdle(_0x2fc476){if(_0x2fc476['voiceStatus']!==_0x6132('0xd')&&_0x2fc476[_0x6132('0x6')]){_0x2fc476[_0x6132('0xe')]=_0x6132('0xf');return![];}return _[_0x6132('0x8')]([_0x2fc476[_0x6132('0x10')],_0x2fc476[_0x6132('0x11')],_0x2fc476[_0x6132('0x12')],_0x2fc476['openchannelStatus'],_0x2fc476[_0x6132('0x13')],_0x2fc476[_0x6132('0xe')],_0x2fc476['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x6132('0x14')](_0x6132('0x15'),{})[_0x6132('0x16')](function(_0x110ea1){if(_0x110ea1[_0x6132('0x17')]){throw new Error(_0x6132('0x18'));}var _0x52db33=_0x110ea1[_0x6132('0x19')];return routingClient['request']('Agents',{})[_0x6132('0x16')](function(_0x29425c){if(_0x29425c[_0x6132('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4f8c5d=_0x29425c[_0x6132('0x19')];return _['merge']({},_0x52db33,_0x4f8c5d);});})[_0x6132('0x1a')](function(_0x48df11){throw _0x48df11;});}exports[_0x6132('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x58028b){var _0x40bc58=_0x6132('0xa');if(isAgentPaused(_0x58028b))_0x40bc58='pause';else if(isAgentPaused(_0x58028b,!![]))_0x40bc58=_0x6132('0x1c');else if(isAgentIdle(_0x58028b))_0x40bc58='idle';else _0x40bc58=_0x6132('0x1d');return _0x40bc58;}exports[_0x6132('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x23ead8,_0x14e2b3){var _0x45cf4b=_[_0x6132('0x1f')](_0x23ead8)?_0x23ead8:[_0x23ead8];var _0x5d1a15=_['startCase'](_0x14e2b3)+_0x6132('0x20');var _0xd643e1=_[_0x6132('0x21')](_0x45cf4b,function(_0x29051b){return db[_0x5d1a15]['findOne']({'where':{'id':_0x29051b}})[_0x6132('0x16')](function(_0x28d5cb){if(!_0x28d5cb)return[];return _0x28d5cb['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0xd643e1)[_0x6132('0x16')](function(_0x1c5e30){var _0x1b8ed0=_(_0x1c5e30)[_0x6132('0x22')]()[_0x6132('0x21')]('id')[_0x6132('0x23')]()[_0x6132('0x24')]();return _0x1b8ed0;});}exports[_0x6132('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1e5f63,_0x1766c,_0x20d4bc){try{if(_0x1766c[_0x6132('0x9')]>0x0){_0x1e5f63=_0x1e5f63[_0x6132('0x26')](function(_0x39e28b){return _0x1766c[_0x6132('0x27')](_0x39e28b['id']);});}var _0x523540=_0x1e5f63[_0x6132('0x26')](function(_0x1e2c3d){var _0xbd6818=_0x6132('0x1d');if(isAgentIdle(_0x1e2c3d)){_0xbd6818=_0x6132('0xd');}return _0xbd6818===_0x20d4bc;});return _['map'](_0x523540,'id');}catch(_0x2a7ac6){throw _0x2a7ac6;}}exports[_0x6132('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1b0438,_0x5c0f46,_0x1f361a){return Promise[_0x6132('0x29')]()[_0x6132('0x16')](function(){if(_0x5c0f46[_0x6132('0x9')]>0x0){_0x1b0438=_0x1b0438['filter'](function(_0x5e1b36){return _0x5c0f46[_0x6132('0x27')](_0x5e1b36['id']);});}return _0x1b0438;})['then'](function(){return db[_0x6132('0x2a')][_0x6132('0x2b')]({'attributes':['id','name',_0x6132('0x2c'),_0x6132('0x2d'),_0x6132('0x3'),_0x6132('0x2e'),_0x6132('0x4'),'smsPause',_0x6132('0x6'),_0x6132('0x7'),_0x6132('0x2f')],'where':{'id':{'$in':_[_0x6132('0x21')](_0x1b0438,'id')}},'raw':!![]});})[_0x6132('0x16')](function(_0x2388da){return _0x2388da['map'](function(_0x263650){var _0x44f3d1=_[_0x6132('0x30')](_0x1b0438,['id',_0x263650['id']]);var _0x3d2cd3=filterAgentAttributes(_0x44f3d1);_[_0x6132('0x31')](_0x263650,_0x3d2cd3);_0x263650['globalStatus']=getAgentStatus(_0x263650);return _0x263650;});})[_0x6132('0x16')](function(_0x33e51b){var _0x5307dd=sortAgentsByStatus(_0x33e51b,_0x1f361a);return _[_0x6132('0x21')](_0x5307dd,'id');})[_0x6132('0x1a')](function(_0x360d5c){throw _0x360d5c;});}exports[_0x6132('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x574947){var _0x358de8={'fields':[],'order':null};var _0x5e8aa2=_0x574947[_0x6132('0x33')](',');_0x358de8[_0x6132('0x34')]=_[_0x6132('0x26')](_0x5e8aa2,function(_0x1d050d){if(!_0x1d050d[_0x6132('0x27')](_0x6132('0x35'))){return!![];}_0x358de8[_0x6132('0x36')]=_[_0x6132('0x37')](_0x1d050d,'-')?_0x6132('0x38'):_0x6132('0x39');return![];});return _0x358de8;}exports[_0x6132('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x1fa127){if(_0x1fa127[_0x6132('0x27')](_0x6132('0x2c'))&&!_0x1fa127[_0x6132('0x27')](_0x6132('0x3b'))){var _0x3b3b80=_0x1fa127['substring'](0x0,_0x1fa127['indexOf']('fullname'));_0x1fa127+=','+_0x3b3b80+_0x6132('0x3b');}return _0x1fa127;}exports[_0x6132('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x5669b1,_0x2a398a){var _0x581787=_0x5669b1['sort'](function(_0x37b927,_0x492f31){if(_0x37b927[_0x6132('0x35')]===_0x492f31['globalStatus']){if(_0x37b927[_0x6132('0x35')]===_0x6132('0xf')){if(_0x2a398a===_0x6132('0x38')){return(_0x37b927[_0x6132('0x2f')]||'')<(_0x492f31[_0x6132('0x2f')]||'')||_0x37b927[_0x6132('0x2c')][_0x6132('0x3d')]()>_0x492f31[_0x6132('0x2c')]['toLowerCase']()?0x1:-0x1;}else{return(_0x37b927[_0x6132('0x2f')]||'')<(_0x492f31[_0x6132('0x2f')]||'')||_0x37b927['fullname'][_0x6132('0x3d')]()>_0x492f31[_0x6132('0x2c')][_0x6132('0x3d')]()?-0x1:0x1;}}else{if(_0x2a398a===_0x6132('0x38')){return _0x37b927[_0x6132('0x2c')][_0x6132('0x3d')]()<_0x492f31[_0x6132('0x2c')][_0x6132('0x3d')]()?0x1:-0x1;}else{return _0x37b927[_0x6132('0x2c')]['toLowerCase']()<_0x492f31[_0x6132('0x2c')][_0x6132('0x3d')]()?-0x1:0x1;}}}else{if(_0x2a398a===_0x6132('0x38')){return _0x37b927['globalStatus']<_0x492f31['globalStatus']?0x1:-0x1;}else{return _0x37b927[_0x6132('0x35')]<_0x492f31[_0x6132('0x35')]?-0x1:0x1;}}});return _0x581787;}exports[_0x6132('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x2e667d){var _0x508519=[_0x6132('0x3f'),_0x6132('0x40'),_0x6132('0x41'),_0x6132('0x42'),_0x6132('0x2f'),_0x6132('0x42'),'internal',_0x6132('0x43'),'chatPause',_0x6132('0x4'),_0x6132('0x2e'),_0x6132('0x5'),_0x6132('0x7'),_0x6132('0x3'),_0x6132('0x6'),_0x6132('0x44'),_0x6132('0x45'),_0x6132('0x46'),_0x6132('0x47'),_0x6132('0x48'),'faxCapacity',_0x6132('0x49'),_0x6132('0x4a'),_0x6132('0x4b'),'smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity',_0x6132('0x10'),_0x6132('0x4c'),_0x6132('0x12'),_0x6132('0x13'),'whatsappStatus',_0x6132('0x11'),_0x6132('0xe'),_0x6132('0x4d'),_0x6132('0x4e'),_0x6132('0x4f'),_0x6132('0x50'),_0x6132('0x51'),_0x6132('0x52'),'voiceStatusTime',_0x6132('0x53'),'destconnectedlinenum',_0x6132('0x54'),'phoneBarEnableScreenRecordingByAgent',_0x6132('0x55'),'routealias'];var _0xd7c778=['chatPause',_0x6132('0x4'),_0x6132('0x2e'),_0x6132('0x5'),_0x6132('0x7'),_0x6132('0x3'),_0x6132('0x6'),_0x6132('0x40')];var _0x3d8b25=_(_0x2e667d)['omit'](_0xd7c778)['pick'](_0x508519)['value']();return _0x3d8b25;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 7922868..c87bac4 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4a1ec0,_0x26287b){var _0x49ab91=function(_0x206584){while(--_0x206584){_0x4a1ec0['push'](_0x4a1ec0['shift']());}};_0x49ab91(++_0x26287b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 57920f8..e48d71e 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 _0x51d0=['length','family','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','hex','getUuid','platform','licenseToken','win32','utf8','replace','hostname','macAddress','ipAddress','digest','substring','bimedia-machine-uuid','child_process','execSync','orderBy','keys'];(function(_0x332ddf,_0x1ed1b5){var _0x4798a9=function(_0x313ebf){while(--_0x313ebf){_0x332ddf['push'](_0x332ddf['shift']());}};_0x4798a9(++_0x1ed1b5);}(_0x51d0,0x1bb));var _0x051d=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x51d0[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x051d('0x0'));var exec=require(_0x051d('0x1'))[_0x051d('0x2')];var config=require('../environment');function getInterfaces(){var _0x238e14=[];var _0x460b61=os['networkInterfaces']();var _0x45e55e=_[_0x051d('0x3')](_[_0x051d('0x4')](_0x460b61));for(var _0x3fce58=0x0;_0x3fce58<_0x45e55e[_0x051d('0x5')];_0x3fce58++){var _0x1c67b4=_0x460b61[_0x45e55e[_0x3fce58]]['filter'](function(_0x4a1dc3){return _0x4a1dc3[_0x051d('0x6')]===_0x051d('0x7')&&_0x4a1dc3['internal']===![];});_0x238e14=_0x238e14['concat'](_0x1c67b4);}return _0x238e14;}function getFirstInterface(){var _0x215e21=_[_0x051d('0x8')](getInterfaces());return{'macAddress':_0x215e21&&_0x215e21[_0x051d('0x9')]?_0x215e21[_0x051d('0x9')]:_0x051d('0xa'),'ipAddress':_0x215e21&&_0x215e21[_0x051d('0xb')]?_0x215e21[_0x051d('0xb')]:_0x051d('0xc')};}exports[_0x051d('0xd')]=getFirstInterface;function getCPUhash(){var _0x47c6f2=_['orderBy'](os[_0x051d('0xe')]()[_0x051d('0xf')](function(_0x2d5181){return _0x2d5181[_0x051d('0x10')];}))[_0x051d('0x11')](':');return crypto[_0x051d('0x12')](_0x051d('0x13'))['update'](_0x47c6f2)['digest'](_0x051d('0x14'));}exports[_0x051d('0x15')]=function(){var _0x22737f=os[_0x051d('0x16')]();var _0x46babf=/[0-9a-f-]{36}/;if(config[_0x051d('0x17')]&&_0x46babf['test'](config[_0x051d('0x17')])){return config[_0x051d('0x17')];}else if(_0x22737f===_0x051d('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x051d('0x19')})[_0x051d('0x1a')]('\x0d\x0a','');}else{var _0x1509ac=getFirstInterface();var _0x154bd4=getCPUhash();var _0x5d57a5=_0x154bd4+'|'+os[_0x051d('0x1b')]()+'|'+_0x1509ac[_0x051d('0x1c')]+'|'+_0x1509ac[_0x051d('0x1d')];var _0x3b49f7=crypto[_0x051d('0x12')](_0x051d('0x13'))['update'](_0x5d57a5)[_0x051d('0x1e')](_0x051d('0x14'));return _0x3b49f7['substring'](0x0,0x8)+'-'+_0x3b49f7[_0x051d('0x1f')](0x8,0xc)+'-'+_0x3b49f7['substring'](0xc,0x10)+'-'+_0x3b49f7['substring'](0x10,0x14)+'-'+_0x3b49f7['substring'](0x14);}}; \ No newline at end of file +var _0x026b=['replace','hostname','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','getFirstInterface','cpus','map','join','createHash','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x026b,0x1ef));var _0xb026=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x026b[_0x193e28];return _0x20ef59;};'use strict';var _=require(_0xb026('0x0'));var os=require('os');var crypto=require(_0xb026('0x1'));var machine=require(_0xb026('0x2'));var exec=require(_0xb026('0x3'))[_0xb026('0x4')];var config=require('../environment');function getInterfaces(){var _0x1763ab=[];var _0x57fdb8=os[_0xb026('0x5')]();var _0x99b839=_['orderBy'](_[_0xb026('0x6')](_0x57fdb8));for(var _0x34bb9f=0x0;_0x34bb9f<_0x99b839[_0xb026('0x7')];_0x34bb9f++){var _0x4e2e67=_0x57fdb8[_0x99b839[_0x34bb9f]][_0xb026('0x8')](function(_0xade454){return _0xade454[_0xb026('0x9')]===_0xb026('0xa')&&_0xade454[_0xb026('0xb')]===![];});_0x1763ab=_0x1763ab['concat'](_0x4e2e67);}return _0x1763ab;}function getFirstInterface(){var _0xce15df=_[_0xb026('0xc')](getInterfaces());return{'macAddress':_0xce15df&&_0xce15df[_0xb026('0xd')]?_0xce15df[_0xb026('0xd')]:_0xb026('0xe'),'ipAddress':_0xce15df&&_0xce15df['address']?_0xce15df['address']:'127.0.0.1'};}exports[_0xb026('0xf')]=getFirstInterface;function getCPUhash(){var _0x599aa7=_['orderBy'](os[_0xb026('0x10')]()[_0xb026('0x11')](function(_0x2308d1){return _0x2308d1['model'];}))[_0xb026('0x12')](':');return crypto[_0xb026('0x13')]('md5')[_0xb026('0x14')](_0x599aa7)[_0xb026('0x15')](_0xb026('0x16'));}exports[_0xb026('0x17')]=function(){var _0x559dcd=os[_0xb026('0x18')]();var _0x4b18b8=/[0-9a-f-]{36}/;if(config[_0xb026('0x19')]&&_0x4b18b8[_0xb026('0x1a')](config['licenseToken'])){return config[_0xb026('0x19')];}else if(_0x559dcd===_0xb026('0x1b')){return exec(_0xb026('0x1c'),{'encoding':_0xb026('0x1d')})[_0xb026('0x1e')]('\x0d\x0a','');}else{var _0x454088=getFirstInterface();var _0x50fe61=getCPUhash();var _0x3cbeac=_0x50fe61+'|'+os[_0xb026('0x1f')]()+'|'+_0x454088['macAddress']+'|'+_0x454088[_0xb026('0x20')];var _0x13fbde=crypto[_0xb026('0x13')](_0xb026('0x21'))[_0xb026('0x14')](_0x3cbeac)['digest'](_0xb026('0x16'));return _0x13fbde[_0xb026('0x22')](0x0,0x8)+'-'+_0x13fbde[_0xb026('0x22')](0x8,0xc)+'-'+_0x13fbde[_0xb026('0x22')](0xc,0x10)+'-'+_0x13fbde['substring'](0x10,0x14)+'-'+_0x13fbde[_0xb026('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index bdbe47b..82ccc84 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 _0xff6f=['moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','https://www.xcallymotion.com','exports','format','GET','catch','get','data1','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','then','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util'];(function(_0x2f1172,_0x5f5b26){var _0x58e374=function(_0x1a61fa){while(--_0x1a61fa){_0x2f1172['push'](_0x2f1172['shift']());}};_0x58e374(++_0x5f5b26);}(_0xff6f,0xf5));var _0xfff6=function(_0x1078bc,_0x115563){_0x1078bc=_0x1078bc-0x0;var _0x57d2dd=_0xff6f[_0x1078bc];return _0x57d2dd;};'use strict';var util=require(_0xfff6('0x0'));var moment=require(_0xfff6('0x1'));var rp=require(_0xfff6('0x2'));var BPromise=require(_0xfff6('0x3'));var pkginfo=require(_0xfff6('0x4'))(module,_0xfff6('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xfff6('0x6'));var hardware=require(_0xfff6('0x7'));var logger=require('../logger')('license');var HOST=_0xfff6('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3a28f6){return new BPromise(function(_0x2ac2b8,_0x1780dd){var _0x51d90f=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x3a28f6,module[_0xfff6('0x9')][_0xfff6('0x5')]);if(oldToken){_0x51d90f=util[_0xfff6('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x3a28f6,module['exports'][_0xfff6('0x5')],oldToken);}var _0x443253={'uri':_0x51d90f,'method':_0xfff6('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x443253)['then'](function(_0x56b514){_0x2ac2b8(_0x56b514);})[_0xfff6('0xc')](function(_0x522c27){_0x1780dd(_0x522c27);});});}function manageLicense(_0x443aed,_0x4c72e2){var _0x501261=_0x4c72e2[_0xfff6('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x501261[_0xfff6('0xe')]!==_0x443aed&&!_0x501261[_0xfff6('0xf')]){oldToken=_0x501261['data1'];}httpRequest(_0x443aed)['then'](function(_0x57d8df){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x57d8df[_0xfff6('0x10')]){isOldTokenSent=![];if(!_0x501261[_0xfff6('0x11')]&&_0x501261[_0xfff6('0x11')]!=_0x57d8df[_0xfff6('0x11')]||_0x501261[_0xfff6('0x11')]&&_0x501261['data2']){logger['info'](_0xfff6('0x12'));}if(_0x501261['license']&&!_0x501261[_0xfff6('0xf')]&&_0x501261[_0xfff6('0x11')]!=_0x57d8df[_0xfff6('0x11')]){logger[_0xfff6('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x501261[_0xfff6('0x11')]&&!_0x501261['data2']&&_0x501261[_0xfff6('0x11')]==_0x57d8df['license']){return _0x4c72e2;}return _0x4c72e2['update']({'data1':_0x443aed,'data2':null,'license':_0x57d8df[_0xfff6('0x11')]});}else{if(_0x57d8df[_0xfff6('0x11')]||_0x501261[_0xfff6('0x11')]){if(!_0x501261[_0xfff6('0xf')]){if(_0x501261[_0xfff6('0xe')]==_0x443aed){GRAY_PERIOD_REASON=_0xfff6('0x14');logger[_0xfff6('0x13')](_0xfff6('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xfff6('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x501261[_0xfff6('0xe')],_0x443aed);}logger[_0xfff6('0x13')](_0xfff6('0x16'),GRAY_PERIOD_REASON[_0xfff6('0x17')](),moment()[_0xfff6('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x4c72e2[_0xfff6('0x18')]({'data2':encryptor[_0xfff6('0x19')](moment()[_0xfff6('0xa')](_0xfff6('0x1a')))});}else{if(moment()[_0xfff6('0x1b')](encryptor[_0xfff6('0x1c')](_0x501261[_0xfff6('0xf')]),_0xfff6('0x1d'))>DAYS){logger['info'](_0xfff6('0x1e'),moment()[_0xfff6('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4c72e2['update']({'data1':_0x443aed,'data2':null,'license':null});}}}else{if(_0x501261[_0xfff6('0xe')]!=_0x443aed){logger[_0xfff6('0x13')](_0xfff6('0x1f'),_0x501261[_0xfff6('0xe')],_0x443aed);return _0x4c72e2[_0xfff6('0x18')]({'data1':_0x443aed,'data2':null,'license':null});}}}return _0x4c72e2;})[_0xfff6('0x20')](function(_0x5164c6){_0x4c72e2=_0x5164c6;})[_0xfff6('0xc')](function(_0x56212a){logger[_0xfff6('0x21')](_0x56212a[_0xfff6('0x22')]);})[_0xfff6('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xfff6('0x24')](),_0x4c72e2);},TIME);});}function defaultLicense(){var _0x36b8ad=hardware['getUuid']();if(_0x36b8ad){return db[_0xfff6('0x25')][_0xfff6('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x36b8ad}})['spread'](function(_0x11646d,_0x26873a){logger[_0xfff6('0x13')](_0xfff6('0x27'),_0x36b8ad);manageLicense(_0x36b8ad,_0x11646d);})[_0xfff6('0xc')](function(_0x1ced18){logger['error'](_0x1ced18[_0xfff6('0x22')]);});}}exports[_0xfff6('0x28')]=defaultLicense; \ No newline at end of file +var _0xca3f=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xca3f,0x1ea));var _0xfca3=function(_0x3f8353,_0x493caa){_0x3f8353=_0x3f8353-0x0;var _0x513881=_0xca3f[_0x3f8353];return _0x513881;};'use strict';var util=require(_0xfca3('0x0'));var moment=require(_0xfca3('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0xfca3('0x2'))(module,_0xfca3('0x3'));var db=require(_0xfca3('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xfca3('0x5'));var logger=require(_0xfca3('0x6'))(_0xfca3('0x7'));var HOST=_0xfca3('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x34cae2){return new BPromise(function(_0x2f3467,_0x289e40){var _0x13b005=util[_0xfca3('0x9')](_0xfca3('0xa'),HOST,_0x34cae2,module[_0xfca3('0xb')][_0xfca3('0x3')]);if(oldToken){_0x13b005=util[_0xfca3('0x9')](_0xfca3('0xc'),HOST,_0x34cae2,module[_0xfca3('0xb')][_0xfca3('0x3')],oldToken);}var _0x82e8b0={'uri':_0x13b005,'method':_0xfca3('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x82e8b0)['then'](function(_0x2aa3a9){_0x2f3467(_0x2aa3a9);})[_0xfca3('0xe')](function(_0x1b3c7c){_0x289e40(_0x1b3c7c);});});}function manageLicense(_0x146f19,_0x20dc16){var _0x8bacd3=_0x20dc16[_0xfca3('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x8bacd3[_0xfca3('0x10')]!==_0x146f19&&!_0x8bacd3[_0xfca3('0x11')]){oldToken=_0x8bacd3['data1'];}httpRequest(_0x146f19)[_0xfca3('0x12')](function(_0x1e9295){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1e9295[_0xfca3('0x13')]){isOldTokenSent=![];if(!_0x8bacd3[_0xfca3('0x7')]&&_0x8bacd3[_0xfca3('0x7')]!=_0x1e9295[_0xfca3('0x7')]||_0x8bacd3[_0xfca3('0x7')]&&_0x8bacd3[_0xfca3('0x11')]){logger[_0xfca3('0x14')](_0xfca3('0x15'));}if(_0x8bacd3['license']&&!_0x8bacd3[_0xfca3('0x11')]&&_0x8bacd3['license']!=_0x1e9295[_0xfca3('0x7')]){logger[_0xfca3('0x14')](_0xfca3('0x16'));}if(_0x8bacd3[_0xfca3('0x7')]&&!_0x8bacd3[_0xfca3('0x11')]&&_0x8bacd3[_0xfca3('0x7')]==_0x1e9295[_0xfca3('0x7')]){return _0x20dc16;}return _0x20dc16[_0xfca3('0x17')]({'data1':_0x146f19,'data2':null,'license':_0x1e9295[_0xfca3('0x7')]});}else{if(_0x1e9295[_0xfca3('0x7')]||_0x8bacd3[_0xfca3('0x7')]){if(!_0x8bacd3[_0xfca3('0x11')]){if(_0x8bacd3[_0xfca3('0x10')]==_0x146f19){GRAY_PERIOD_REASON=_0xfca3('0x18');logger[_0xfca3('0x14')](_0xfca3('0x19'));}else{GRAY_PERIOD_REASON=_0xfca3('0x1a');logger[_0xfca3('0x14')](_0xfca3('0x1b'),_0x8bacd3[_0xfca3('0x10')],_0x146f19);}logger[_0xfca3('0x14')](_0xfca3('0x1c'),GRAY_PERIOD_REASON[_0xfca3('0x1d')](),moment()[_0xfca3('0x9')](_0xfca3('0x1e')));return _0x20dc16[_0xfca3('0x17')]({'data2':encryptor['encryptString'](moment()[_0xfca3('0x9')](_0xfca3('0x1e')))});}else{if(moment()[_0xfca3('0x1f')](encryptor[_0xfca3('0x20')](_0x8bacd3[_0xfca3('0x11')]),_0xfca3('0x21'))>DAYS){logger[_0xfca3('0x14')](_0xfca3('0x22'),moment()[_0xfca3('0x9')](_0xfca3('0x1e')));isOldTokenSent=![];return _0x20dc16[_0xfca3('0x17')]({'data1':_0x146f19,'data2':null,'license':null});}}}else{if(_0x8bacd3[_0xfca3('0x10')]!=_0x146f19){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x8bacd3[_0xfca3('0x10')],_0x146f19);return _0x20dc16['update']({'data1':_0x146f19,'data2':null,'license':null});}}}return _0x20dc16;})['then'](function(_0x3c50a2){_0x20dc16=_0x3c50a2;})['catch'](function(_0x1b8de7){logger[_0xfca3('0x23')](_0x1b8de7[_0xfca3('0x24')]);})[_0xfca3('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0xfca3('0x26')](),_0x20dc16);},TIME);});}function defaultLicense(){var _0x38878c=hardware[_0xfca3('0x26')]();if(_0x38878c){return db[_0xfca3('0x27')][_0xfca3('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x38878c}})['spread'](function(_0x186b94,_0x83c507){logger[_0xfca3('0x14')](_0xfca3('0x29'),_0x38878c);manageLicense(_0x38878c,_0x186b94);})['catch'](function(_0x364864){logger[_0xfca3('0x23')](_0x364864[_0xfca3('0x24')]);});}}exports[_0xfca3('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 3eef669..4def367 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 _0x6afe=['catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','findAll','sequelize','COUNT','col','count','role','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','License','defaults','then'];(function(_0x4ae2fb,_0x1c1c67){var _0x4f5268=function(_0x11236b){while(--_0x11236b){_0x4ae2fb['push'](_0x4ae2fb['shift']());}};_0x4f5268(++_0x1c1c67);}(_0x6afe,0x177));var _0xe6af=function(_0xb6b285,_0x596e01){_0xb6b285=_0xb6b285-0x0;var _0x11393c=_0x6afe[_0xb6b285];return _0x11393c;};'use strict';var util=require(_0xe6af('0x0'));var _=require(_0xe6af('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0xe6af('0x2'));var encryptor=require(_0xe6af('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe6af('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xe6af('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe6af('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xe6af('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x404be9){return new BPromise(function(_0x10499f,_0x3426d5){return db[_0xe6af('0x6')]['find'](_[_0xe6af('0x7')](_0x404be9,{'raw':!![],'where':{'id':0x1}}))[_0xe6af('0x8')](function(_0x114d59){return checkLicense(_0x114d59,null);})[_0xe6af('0x8')](function(_0x480a90){_0x10499f(_0x480a90);return;})[_0xe6af('0x9')](function(_0x16e347){_0x3426d5(_0x16e347);});});}function checkLicense(_0x169692,_0x379c66){if(!_0x169692){demoLicense['uuid']=_0x169692[_0xe6af('0xa')];return demoLicense;}try{var _0x3f0917=_0x379c66||_0x169692[_0xe6af('0xb')];if(_[_0xe6af('0xc')](_0x3f0917)){throw new Error(_0xe6af('0xd'));}var _0x5f1576=_0x169692[_0xe6af('0xa')];var _0x31c360=_0x169692[_0xe6af('0xe')];var _0x4984e3=_0x5f1576[_0xe6af('0xf')]('-')[0x4];var _0x4ea3d9=_0x5f1576[_0xe6af('0xf')]('-')[0x0];var _0x4bd3ee=encryptor[_0xe6af('0x10')](_0x3f0917,util[_0xe6af('0x11')](_0xe6af('0x12'),_0x4984e3,_0x5f1576,_0x4ea3d9));var _0x3cc92b=JSON[_0xe6af('0x13')](_0x4bd3ee);_0x3cc92b[_0xe6af('0x14')]=![];_0x3cc92b[_0xe6af('0x15')]=_0x5f1576;_0x3cc92b[_0xe6af('0x16')]=hardware[_0xe6af('0x5')]();if(_0x31c360){var _0x5dd9e1=encryptor[_0xe6af('0x10')](_0x31c360);_0x3cc92b[_0xe6af('0x17')]=_0x5dd9e1;_0x3cc92b[_0xe6af('0x18')]=moment(_0x5dd9e1)[_0xe6af('0x19')](0x7,_0xe6af('0x1a'))['format']();_0x3cc92b[_0xe6af('0x1b')]=_0x3cc92b[_0xe6af('0x15')]!=_0x3cc92b[_0xe6af('0x16')]?_0xe6af('0x1c'):_0xe6af('0x1d');}return _0x3cc92b;}catch(_0x2e759a){breakingLicense['uuid']=_0x169692[_0xe6af('0xa')];breakingLicense['message']=_0x2e759a[_0xe6af('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4d4f6a,_0x4fdb57){getLicense()['then'](function(_0x2959de){return db['User'][_0xe6af('0x1f')]({'attributes':['role',[db[_0xe6af('0x20')]['fn'](_0xe6af('0x21'),db[_0xe6af('0x20')][_0xe6af('0x22')]('role')),_0xe6af('0x23')]],'group':_0xe6af('0x24'),'where':{'role':{'$or':[_0xe6af('0x25'),_0xe6af('0x26'),_0xe6af('0x27')]}},'raw':!![]})[_0xe6af('0x8')](function(_0x921ecd){var _0x28133e={'user':_0x2959de[_0xe6af('0x28')]||0x0,'telephone':_0x2959de[_0xe6af('0x29')]||0x0};_0x921ecd[_0xe6af('0x2a')](function(_0x23edbf){var _0x151f55=_0x23edbf[_0xe6af('0x24')]===_0xe6af('0x25')?_0xe6af('0x26'):_0x23edbf['role'];_0x28133e[_0x151f55]-=_0x23edbf[_0xe6af('0x23')];if(_0x28133e[_0x151f55]<0x0)_0x28133e[_0x151f55]=0x0;});_0x4d4f6a(_0x28133e);return;});})[_0xe6af('0x9')](function(_0x4e3bed){_0x4fdb57(_0x4e3bed);});});}function checkUserLimits(_0x555184){return new BPromise(function(_0x722000,_0x592b5f){getLimits()[_0xe6af('0x8')](function(_0x13e83a){var _0x3e18d7=_[_0xe6af('0x2b')](_[_0xe6af('0x2c')](_0x555184,'role'),['admin',_0xe6af('0x26'),_0xe6af('0x27')]);var _0x51d5e3=(_0x3e18d7['admin']||0x0)+(_0x3e18d7[_0xe6af('0x26')]||0x0);var _0x3b7e40=_0x3e18d7['telephone']||0x0;if(_0x51d5e3>_0x13e83a[_0xe6af('0x26')])return _0x592b5f(_0xe6af('0x2d'));if(_0x3b7e40>_0x13e83a[_0xe6af('0x27')])return _0x592b5f(_0xe6af('0x2e'));return _0x722000();})[_0xe6af('0x9')](function(_0x331b1b){_0x592b5f(_0x331b1b);});});}module[_0xe6af('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5a68=['changed','message','User','findAll','sequelize','COUNT','col','role','admin','telephone','users','telephones','user','count','catch','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','grayReason'];(function(_0xf9b9e5,_0x5df420){var _0x4b591e=function(_0x502eaa){while(--_0x502eaa){_0xf9b9e5['push'](_0xf9b9e5['shift']());}};_0x4b591e(++_0x5df420);}(_0x5a68,0x126));var _0x85a6=function(_0xa11497,_0x3714a5){_0xa11497=_0xa11497-0x0;var _0x1bbe80=_0x5a68[_0xa11497];return _0x1bbe80;};'use strict';var util=require(_0x85a6('0x0'));var _=require(_0x85a6('0x1'));var moment=require('moment');var BPromise=require(_0x85a6('0x2'));var hardware=require(_0x85a6('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x85a6('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x85a6('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x85a6('0x6'),'machineUuid':hardware[_0x85a6('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x85a6('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x85a6('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x8e4bf1){return new BPromise(function(_0x41c8ea,_0x126337){return db[_0x85a6('0x8')][_0x85a6('0x9')](_['defaults'](_0x8e4bf1,{'raw':!![],'where':{'id':0x1}}))[_0x85a6('0xa')](function(_0x59da92){return checkLicense(_0x59da92,null);})['then'](function(_0x3272a1){_0x41c8ea(_0x3272a1);return;})['catch'](function(_0x12fc08){_0x126337(_0x12fc08);});});}function checkLicense(_0x128d09,_0x37e5f3){if(!_0x128d09){demoLicense['uuid']=_0x128d09['data1'];return demoLicense;}try{var _0x1ba532=_0x37e5f3||_0x128d09[_0x85a6('0xb')];if(_[_0x85a6('0xc')](_0x1ba532)){throw new Error(_0x85a6('0xd'));}var _0x1f2474=_0x128d09[_0x85a6('0xe')];var _0xbe043c=_0x128d09[_0x85a6('0xf')];var _0x548d14=_0x1f2474[_0x85a6('0x10')]('-')[0x4];var _0x36161a=_0x1f2474['split']('-')[0x0];var _0x1f1804=encryptor[_0x85a6('0x11')](_0x1ba532,util[_0x85a6('0x12')](_0x85a6('0x13'),_0x548d14,_0x1f2474,_0x36161a));var _0xe3503d=JSON[_0x85a6('0x14')](_0x1f1804);_0xe3503d[_0x85a6('0x15')]=![];_0xe3503d[_0x85a6('0x16')]=_0x1f2474;_0xe3503d[_0x85a6('0x17')]=hardware[_0x85a6('0x7')]();if(_0xbe043c){var _0x7ebd19=encryptor['decryptString'](_0xbe043c);_0xe3503d[_0x85a6('0x18')]=_0x7ebd19;_0xe3503d[_0x85a6('0x19')]=moment(_0x7ebd19)[_0x85a6('0x1a')](0x7,'days')['format']();_0xe3503d[_0x85a6('0x1b')]=_0xe3503d[_0x85a6('0x16')]!=_0xe3503d[_0x85a6('0x17')]?_0x85a6('0x1c'):'disabled';}return _0xe3503d;}catch(_0x55525e){breakingLicense[_0x85a6('0x16')]=_0x128d09[_0x85a6('0xe')];breakingLicense['message']=_0x55525e[_0x85a6('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x45c870,_0x56fba0){getLicense()[_0x85a6('0xa')](function(_0x452014){return db[_0x85a6('0x1e')][_0x85a6('0x1f')]({'attributes':['role',[db[_0x85a6('0x20')]['fn'](_0x85a6('0x21'),db['sequelize'][_0x85a6('0x22')](_0x85a6('0x23'))),'count']],'group':_0x85a6('0x23'),'where':{'role':{'$or':[_0x85a6('0x24'),'user',_0x85a6('0x25')]}},'raw':!![]})[_0x85a6('0xa')](function(_0x316c5e){var _0x575d9b={'user':_0x452014[_0x85a6('0x26')]||0x0,'telephone':_0x452014[_0x85a6('0x27')]||0x0};_0x316c5e['forEach'](function(_0x4b10c9){var _0x4f083f=_0x4b10c9[_0x85a6('0x23')]===_0x85a6('0x24')?_0x85a6('0x28'):_0x4b10c9[_0x85a6('0x23')];_0x575d9b[_0x4f083f]-=_0x4b10c9[_0x85a6('0x29')];if(_0x575d9b[_0x4f083f]<0x0)_0x575d9b[_0x4f083f]=0x0;});_0x45c870(_0x575d9b);return;});})[_0x85a6('0x2a')](function(_0x254b79){_0x56fba0(_0x254b79);});});}function checkUserLimits(_0x3a7ccd){return new BPromise(function(_0x365d71,_0x276dbc){getLimits()[_0x85a6('0xa')](function(_0x4f7bcd){var _0x12aeb7=_[_0x85a6('0x2b')](_[_0x85a6('0x2c')](_0x3a7ccd,_0x85a6('0x23')),[_0x85a6('0x24'),_0x85a6('0x28'),_0x85a6('0x25')]);var _0x5c817e=(_0x12aeb7['admin']||0x0)+(_0x12aeb7[_0x85a6('0x28')]||0x0);var _0x2b9e2b=_0x12aeb7[_0x85a6('0x25')]||0x0;if(_0x5c817e>_0x4f7bcd[_0x85a6('0x28')])return _0x276dbc('License\x20limit\x20reached\x20for\x20users');if(_0x2b9e2b>_0x4f7bcd[_0x85a6('0x25')])return _0x276dbc(_0x85a6('0x2d'));return _0x365d71();})[_0x85a6('0x2a')](function(_0x4dfcb9){_0x276dbc(_0x4dfcb9);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index c517e7d..7b89563 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 _0xb10b=['app-id','secret','exports','myappanuglar-secret'];(function(_0x289bb3,_0xe32a54){var _0x557f0e=function(_0x111bc0){while(--_0x111bc0){_0x289bb3['push'](_0x289bb3['shift']());}};_0x557f0e(++_0xe32a54);}(_0xb10b,0x12a));var _0xbb10=function(_0x1eabe2,_0x24666c){_0x1eabe2=_0x1eabe2-0x0;var _0x39adc0=_0xb10b[_0x1eabe2];return _0x39adc0;};'use strict';module[_0xbb10('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xbb10('0x1'),'GOOGLE_ID':_0xbb10('0x2'),'GOOGLE_SECRET':_0xbb10('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xdb28=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0xe58f62,_0x42b6df){var _0x316a14=function(_0x3f9d02){while(--_0x3f9d02){_0xe58f62['push'](_0xe58f62['shift']());}};_0x316a14(++_0x42b6df);}(_0xdb28,0x106));var _0x8db2=function(_0x278824,_0x5f2ffc){_0x278824=_0x278824-0x0;var _0x550575=_0xdb28[_0x278824];return _0x550575;};'use strict';module[_0x8db2('0x0')]={'DOMAIN':_0x8db2('0x1'),'SESSION_SECRET':_0x8db2('0x2'),'GOOGLE_ID':_0x8db2('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8a09e60..609b3f2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c56=['exports','../utils/loggers','fileLogger'];(function(_0x14f80d,_0x3a99aa){var _0x4a25ea=function(_0x5953e2){while(--_0x5953e2){_0x14f80d['push'](_0x14f80d['shift']());}};_0x4a25ea(++_0x3a99aa);}(_0x7c56,0x121));var _0x67c5=function(_0x25dd76,_0x298285){_0x25dd76=_0x25dd76-0x0;var _0x1fef55=_0x7c56[_0x25dd76];return _0x1fef55;};'use strict';var fileLogger=require(_0x67c5('0x0'))[_0x67c5('0x1')];module[_0x67c5('0x2')]=fileLogger; \ No newline at end of file +var _0x4681=['fileLogger'];(function(_0x248706,_0x5bc444){var _0x42191b=function(_0x302fd6){while(--_0x302fd6){_0x248706['push'](_0x248706['shift']());}};_0x42191b(++_0x5bc444);}(_0x4681,0x76));var _0x1468=function(_0x295baf,_0xd3abfa){_0x295baf=_0x295baf-0x0;var _0xccdd10=_0x4681[_0x295baf];return _0xccdd10;};'use strict';var fileLogger=require('../utils/loggers')[_0x1468('0x0')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index eb1e209..3cd4fc5 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 _0x80b1=['xdr','../../services/xdr/index.js','path','express','join','ami','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x4953c9,_0x24591d){var _0x263a5e=function(_0x4181bf){while(--_0x4181bf){_0x4953c9['push'](_0x4953c9['shift']());}};_0x263a5e(++_0x24591d);}(_0x80b1,0x146));var _0x180b=function(_0x51fec4,_0xa952b0){_0x51fec4=_0x51fec4-0x0;var _0x31eac1=_0x80b1[_0x51fec4];return _0x31eac1;};'use strict';var path=require(_0x180b('0x0'));var os=require('os');var config={'apps':[{'name':_0x180b('0x1'),'script':path[_0x180b('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x180b('0x3'),'script':path[_0x180b('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x180b('0x4'),'script':path[_0x180b('0x2')](__dirname,_0x180b('0x5'))},{'name':_0x180b('0x6'),'script':path[_0x180b('0x2')](__dirname,_0x180b('0x7'))},{'name':_0x180b('0x8'),'script':path['join'](__dirname,_0x180b('0x9'))},{'name':_0x180b('0xa'),'script':path[_0x180b('0x2')](__dirname,_0x180b('0xb'))}]};module['exports']=config; \ No newline at end of file +var _0x5d3f=['path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x44c37f,_0x185917){var _0x2c0d33=function(_0xd87bcf){while(--_0xd87bcf){_0x44c37f['push'](_0x44c37f['shift']());}};_0x2c0d33(++_0x185917);}(_0x5d3f,0x144));var _0xf5d3=function(_0x5859db,_0xf843a3){_0x5859db=_0x5859db-0x0;var _0x67c069=_0x5d3f[_0x5859db];return _0x67c069;};'use strict';var path=require(_0xf5d3('0x0'));var os=require('os');var config={'apps':[{'name':_0xf5d3('0x1'),'script':path[_0xf5d3('0x2')](__dirname,_0xf5d3('0x3'))},{'name':_0xf5d3('0x4'),'script':path[_0xf5d3('0x2')](__dirname,_0xf5d3('0x5'))},{'name':'agi','script':path[_0xf5d3('0x2')](__dirname,_0xf5d3('0x6'))},{'name':_0xf5d3('0x7'),'script':path[_0xf5d3('0x2')](__dirname,_0xf5d3('0x8'))},{'name':_0xf5d3('0x9'),'script':path['join'](__dirname,_0xf5d3('0xa'))},{'name':_0xf5d3('0xb'),'script':path[_0xf5d3('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c8a4f38..2b71c36 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 _0xa9c2=['restart','list','describe','delete','dump','saved','bluebird','start','then','disconnect','stop'];(function(_0x353856,_0x5ce89d){var _0xa58048=function(_0x2cc6a9){while(--_0x2cc6a9){_0x353856['push'](_0x353856['shift']());}};_0xa58048(++_0x5ce89d);}(_0xa9c2,0xa0));var _0x2a9c=function(_0x5c06c0,_0x3a515f){_0x5c06c0=_0x5c06c0-0x0;var _0x1723c1=_0xa9c2[_0x5c06c0];return _0x1723c1;};'use strict';var pm2=require('pm2');var BPromise=require(_0x2a9c('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x5a4fc6,_0x1f6d84){return pm2['connect'](function(_0x4ef0e1){if(_0x4ef0e1){return _0x1f6d84(_0x4ef0e1);}return _0x5a4fc6('connected');});});};exports[_0x2a9c('0x1')]=function(_0x5924f0){return connect()[_0x2a9c('0x2')](function(){return new BPromise(function(_0x11ddd2,_0x495bc3){return pm2[_0x2a9c('0x1')](_0x5924f0,function(_0x2a74d8,_0x5b75e1){if(_0x2a74d8){return _0x495bc3(_0x2a74d8);}pm2[_0x2a9c('0x3')]();return _0x11ddd2(_0x5b75e1);});});});};exports[_0x2a9c('0x4')]=function(_0x142f9a){return connect()[_0x2a9c('0x2')](function(){return new BPromise(function(_0x59c8be,_0x285294){return pm2['stop'](_0x142f9a,function(_0x2e5ad2,_0x5c8ed8){if(_0x2e5ad2){return _0x285294(_0x2e5ad2);}pm2[_0x2a9c('0x3')]();return _0x59c8be(_0x5c8ed8);});});});};exports[_0x2a9c('0x5')]=function(_0x597936){return connect()[_0x2a9c('0x2')](function(){return new BPromise(function(_0x2ef8e9,_0x3106c7){return pm2[_0x2a9c('0x5')](_0x597936,function(_0x1e4979,_0x1b404c){if(_0x1e4979){return _0x3106c7(_0x1e4979);}pm2[_0x2a9c('0x3')]();return _0x2ef8e9(_0x1b404c);});});});};exports[_0x2a9c('0x6')]=function(){return connect()['then'](function(){return new BPromise(function(_0x42eab7,_0x2cafbd){return pm2[_0x2a9c('0x6')](function(_0x107539,_0x456377){if(_0x107539){return _0x2cafbd(_0x107539);}pm2['disconnect']();return _0x42eab7(_0x456377);});});});};exports[_0x2a9c('0x7')]=function(_0x16c48b){return connect()[_0x2a9c('0x2')](function(){return new BPromise(function(_0x24bab7,_0x5ca605){return pm2[_0x2a9c('0x7')](_0x16c48b,function(_0x4256ff,_0xe12501){if(_0x4256ff){return _0x5ca605(_0x4256ff);}pm2[_0x2a9c('0x3')]();return _0x24bab7(_0xe12501);});});});};exports[_0x2a9c('0x8')]=function(_0x598dce){return connect()[_0x2a9c('0x2')](function(){return new BPromise(function(_0x11c93d,_0x488d6b){return pm2[_0x2a9c('0x8')](_0x598dce,function(_0x169778,_0x324661){if(_0x169778){return _0x488d6b(_0x169778);}pm2[_0x2a9c('0x3')]();return _0x11c93d(_0x324661);});});});};exports[_0x2a9c('0x9')]=function(){return connect()[_0x2a9c('0x2')](function(){return new BPromise(function(_0x4218fe,_0x28cdf0){return pm2[_0x2a9c('0x9')](function(_0x59dbb6){if(_0x59dbb6){return _0x28cdf0(_0x59dbb6);}return _0x4218fe(_0x2a9c('0xa'));});});});}; \ No newline at end of file +var _0x2f3a=['restart','list','describe','delete','dump','saved','bluebird','./config','connect','connected','start','then','disconnect'];(function(_0x52c5e9,_0xd5fab7){var _0x21b5d7=function(_0x5eadd2){while(--_0x5eadd2){_0x52c5e9['push'](_0x52c5e9['shift']());}};_0x21b5d7(++_0xd5fab7);}(_0x2f3a,0x117));var _0xa2f3=function(_0x25b676,_0x73e863){_0x25b676=_0x25b676-0x0;var _0x4f0374=_0x2f3a[_0x25b676];return _0x4f0374;};'use strict';var pm2=require('pm2');var BPromise=require(_0xa2f3('0x0'));var config=require(_0xa2f3('0x1'));function connect(){return new BPromise(function(_0x3bb97a,_0x1682bc){return pm2[_0xa2f3('0x2')](function(_0x198add){if(_0x198add){return _0x1682bc(_0x198add);}return _0x3bb97a(_0xa2f3('0x3'));});});};exports[_0xa2f3('0x4')]=function(_0x3ceb91){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x9ea5b3,_0x334ee8){return pm2[_0xa2f3('0x4')](_0x3ceb91,function(_0xefaa00,_0xb7ef3a){if(_0xefaa00){return _0x334ee8(_0xefaa00);}pm2['disconnect']();return _0x9ea5b3(_0xb7ef3a);});});});};exports['stop']=function(_0x3967c4){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x131732,_0x1a95a2){return pm2['stop'](_0x3967c4,function(_0x8b405a,_0x1efe94){if(_0x8b405a){return _0x1a95a2(_0x8b405a);}pm2[_0xa2f3('0x6')]();return _0x131732(_0x1efe94);});});});};exports[_0xa2f3('0x7')]=function(_0x11df75){return connect()['then'](function(){return new BPromise(function(_0x320baf,_0x12298d){return pm2['restart'](_0x11df75,function(_0x4cdf4f,_0x3e4c27){if(_0x4cdf4f){return _0x12298d(_0x4cdf4f);}pm2[_0xa2f3('0x6')]();return _0x320baf(_0x3e4c27);});});});};exports[_0xa2f3('0x8')]=function(){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x52adb7,_0x2d24e8){return pm2[_0xa2f3('0x8')](function(_0x15e508,_0x2555a1){if(_0x15e508){return _0x2d24e8(_0x15e508);}pm2[_0xa2f3('0x6')]();return _0x52adb7(_0x2555a1);});});});};exports['describe']=function(_0x5a4ccf){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x13d64d,_0x3dbfbc){return pm2[_0xa2f3('0x9')](_0x5a4ccf,function(_0x4b5b47,_0x5b073a){if(_0x4b5b47){return _0x3dbfbc(_0x4b5b47);}pm2['disconnect']();return _0x13d64d(_0x5b073a);});});});};exports[_0xa2f3('0xa')]=function(_0x5e06b3){return connect()['then'](function(){return new BPromise(function(_0x200691,_0x3fe39a){return pm2['delete'](_0x5e06b3,function(_0x49da3c,_0x4da5f3){if(_0x49da3c){return _0x3fe39a(_0x49da3c);}pm2['disconnect']();return _0x200691(_0x4da5f3);});});});};exports[_0xa2f3('0xb')]=function(){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x25fd91,_0x2826e2){return pm2['dump'](function(_0x11c7a9){if(_0x11c7a9){return _0x2826e2(_0x11c7a9);}return _0x25fd91(_0xa2f3('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 29b317f..62512f6 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 _0xe74d=['minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','then','info','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xe74d,0x6d));var _0xde74=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0xe74d[_0x406696];return _0x10e35c;};'use strict';var _=require('lodash');var moment=require(_0xde74('0x0'));var Redis=require('ioredis');var util=require(_0xde74('0x1'));var config=require(_0xde74('0x2'));var db=require(_0xde74('0x3'))['db'];var logger=require(_0xde74('0x4'))(_0xde74('0x5'));config[_0xde74('0x6')]=_[_0xde74('0x7')](config[_0xde74('0x6')],{'host':_0xde74('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xde74('0x6')]));function closeInteractions(){var _0x2711e7=0x0;var _0x3b17c8=[];return db['Setting'][_0xde74('0x9')]({'raw':!![],'attributes':['id',_0xde74('0xa')],'where':{'id':0x1}})['then'](function(_0x2d8a1a){_0x2711e7=_0x2d8a1a[_0xde74('0xa')];if(_0x2711e7){return db[_0xde74('0xb')][_0xde74('0xc')]({'raw':!![],'attributes':['id',_0xde74('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xde74('0xe')](_0x2d8a1a[_0xde74('0xa')],_0xde74('0xf'))}}});}else{return[];}})['then'](function(_0x5dc4fd){if(_0x5dc4fd&&_0x5dc4fd[_0xde74('0x10')]){_0x3b17c8=_[_0xde74('0x11')](_0x5dc4fd||[],'id');logger['info'](_0xde74('0x12'),_0x3b17c8[_0xde74('0x13')]());return db[_0xde74('0xb')][_0xde74('0x14')]({'closeReason':_0xde74('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xde74('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3b17c8}});}})[_0xde74('0x17')](function(){if(_0x3b17c8&&_0x3b17c8['length']){logger[_0xde74('0x18')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3b17c8['join']());for(var _0x1a72df=0x0;_0x1a72df<_0x3b17c8[_0xde74('0x10')];_0x1a72df++){io[_0xde74('0x19')](_0xde74('0x1a'),{'id':_0x3b17c8[_0x1a72df],'closed':!![]});}}})['catch'](function(_0x4366ff){logger[_0xde74('0x1b')](_0xde74('0x1c'),_0x4366ff?util[_0xde74('0x1d')](_0x4366ff,{'showHidden':![],'depth':null}):'');});}exports[_0xde74('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x98ce=['lastMsgAt','minutes','length','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll'];(function(_0x4bd963,_0x2681e4){var _0x26e68a=function(_0x62eeaf){while(--_0x62eeaf){_0x4bd963['push'](_0x4bd963['shift']());}};_0x26e68a(++_0x2681e4);}(_0x98ce,0x99));var _0xe98c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x98ce[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0xe98c('0x0'));var Redis=require(_0xe98c('0x1'));var util=require(_0xe98c('0x2'));var config=require(_0xe98c('0x3'));var db=require(_0xe98c('0x4'))['db'];var logger=require(_0xe98c('0x5'))(_0xe98c('0x6'));config[_0xe98c('0x7')]=_[_0xe98c('0x8')](config[_0xe98c('0x7')],{'host':_0xe98c('0x9'),'port':0x18eb});var io=require(_0xe98c('0xa'))(new Redis(config[_0xe98c('0x7')]));function closeInteractions(){var _0x5dd005=0x0;var _0x1a81dd=[];return db[_0xe98c('0xb')][_0xe98c('0xc')]({'raw':!![],'attributes':['id',_0xe98c('0xd')],'where':{'id':0x1}})[_0xe98c('0xe')](function(_0x32b6cf){_0x5dd005=_0x32b6cf[_0xe98c('0xd')];if(_0x5dd005){return db[_0xe98c('0xf')][_0xe98c('0x10')]({'raw':!![],'attributes':['id',_0xe98c('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x32b6cf[_0xe98c('0xd')],_0xe98c('0x12'))}}});}else{return[];}})[_0xe98c('0xe')](function(_0x21814f){if(_0x21814f&&_0x21814f[_0xe98c('0x13')]){_0x1a81dd=_['map'](_0x21814f||[],'id');logger[_0xe98c('0x14')]('[CHAT]\x20Interactions\x20to\x20close:',_0x1a81dd[_0xe98c('0x15')]());return db[_0xe98c('0xf')][_0xe98c('0x16')]({'closeReason':_0xe98c('0x17'),'disposition':_0xe98c('0x18'),'closed':!![],'closedAt':moment()[_0xe98c('0x19')](_0xe98c('0x1a'))},{'where':{'id':_0x1a81dd}});}})[_0xe98c('0xe')](function(){if(_0x1a81dd&&_0x1a81dd['length']){logger[_0xe98c('0x14')](_0xe98c('0x1b'),_0x1a81dd['join']());for(var _0x2e2d8c=0x0;_0x2e2d8c<_0x1a81dd[_0xe98c('0x13')];_0x2e2d8c++){io['emit'](_0xe98c('0x1c'),{'id':_0x1a81dd[_0x2e2d8c],'closed':!![]});}}})[_0xe98c('0x1d')](function(_0x27282f){logger[_0xe98c('0x1e')](_0xe98c('0x1f'),_0x27282f?util[_0xe98c('0x20')](_0x27282f,{'showHidden':![],'depth':null}):'');});}exports[_0xe98c('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 438683b..684f4f9 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf233=['exports','startAllRefreshIntervals'];(function(_0xd251bf,_0x43e96c){var _0x42a83c=function(_0x56309b){while(--_0x56309b){_0xd251bf['push'](_0xd251bf['shift']());}};_0x42a83c(++_0x43e96c);}(_0xf233,0x147));var _0x3f23=function(_0x42aa34,_0x53c9ba){_0x42aa34=_0x42aa34-0x0;var _0x2f854b=_0xf233[_0x42aa34];return _0x2f854b;};'use strict';function start(){var _0x3678fb=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x3678fb[_0x3f23('0x0')]();}module[_0x3f23('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x9ee1=['startAllRefreshIntervals','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9ee1,0xaa));var _0x19ee=function(_0x10d6ca,_0x265cfe){_0x10d6ca=_0x10d6ca-0x0;var _0x44cfe1=_0x9ee1[_0x10d6ca];return _0x44cfe1;};'use strict';function start(){var _0x1e5c08=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x1e5c08[_0x19ee('0x0')]();}module[_0x19ee('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index a805d31..4fe5919 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 _0xc0c5=['text','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','Smtp','CloudProvider','keys','map','toString','difference','intersection','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','add','start','stop','isBetween','startAt','endAt','update','update\x20cron','run','util','path','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','format','\x22%s\x22\x20<%s>','user','email','Report\x20%s\x20last\x20%s\x20%s','name','../../files/reports','savename','%s.%s','zip','join','existsSync','status','Sent','attachments','message'];(function(_0x145880,_0x1365aa){var _0xd2f1c2=function(_0x5f44d8){while(--_0x5f44d8){_0x145880['push'](_0x145880['shift']());}};_0xd2f1c2(++_0x1365aa);}(_0xc0c5,0x126));var _0x5c0c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xc0c5[_0x1ac595];return _0x455fff;};'use strict';var fs=require('fs');var util=require(_0x5c0c('0x0'));var path=require(_0x5c0c('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x5c0c('0x2'));var jayson=require(_0x5c0c('0x3'));var BPromise=require('bluebird');var logger=require(_0x5c0c('0x4'))(_0x5c0c('0x5'));var db=require(_0x5c0c('0x6'))['db'];var analyticCustomReportController=require(_0x5c0c('0x7'));var analyticDefaultReportController=require(_0x5c0c('0x8'));var client=jayson[_0x5c0c('0x9')][_0x5c0c('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xeec9ed,_0x1503eb){return function(){logger[_0x5c0c('0xb')](_0x5c0c('0xc'),_0xeec9ed['email']);var _0x9fef49=!![];var _0x4e45bf=_0xeec9ed[_0x5c0c('0xd')]['getSmtpOptions']();var _0x44879a={'account':_0x4e45bf,'message':{'from':util[_0x5c0c('0xe')](_0x5c0c('0xf'),_0xeec9ed['MailAccount']['name'],_0xeec9ed[_0x5c0c('0xd')]['email']||_0xeec9ed['MailAccount']['Smtp'][_0x5c0c('0x10')]),'to':_0xeec9ed[_0x5c0c('0x11')],'cc':_0xeec9ed['cc'],'bcc':_0xeec9ed['bcc'],'subject':util[_0x5c0c('0xe')](_0x5c0c('0x12'),_0x1503eb[_0x5c0c('0x13')],_0xeec9ed['subtractNumber'],_0xeec9ed['subtractUnit'])}};var _0x53f967=path['join'](__dirname,_0x5c0c('0x14'));var _0x2479c8=_0x1503eb[_0x5c0c('0x15')];var _0x1237b5=util['format'](_0x5c0c('0x16'),path['basename'](_0x1503eb['savename'],path['extname'](_0x1503eb[_0x5c0c('0x15')])),_0x5c0c('0x17'));var _0x3ab056=path[_0x5c0c('0x18')](_0x53f967,_0x2479c8);var _0x37f32c=path['join'](_0x53f967,_0x1237b5);if(fs[_0x5c0c('0x19')](_0x3ab056)){_0x1503eb[_0x5c0c('0x1a')]=_0x5c0c('0x1b');_0x44879a['message'][_0x5c0c('0x1c')]=[{'filename':_0x2479c8,'path':_0x3ab056}];_0x44879a[_0x5c0c('0x1d')][_0x5c0c('0x1e')]=util[_0x5c0c('0xe')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x5c0c('0x1f')](_0x1503eb,null,0x2));}else if(fs[_0x5c0c('0x19')](_0x37f32c)){_0x1503eb[_0x5c0c('0x1a')]=_0x5c0c('0x1b');_0x44879a[_0x5c0c('0x1d')]['attachments']=[{'filename':_0x1237b5,'path':_0x37f32c}];}else{_0x44879a[_0x5c0c('0x1d')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xeec9ed[_0x5c0c('0x20')]){_0x9fef49=![];logger[_0x5c0c('0xb')](_0x5c0c('0x21'));}}if(_0x9fef49){return client[_0x5c0c('0x22')](_0x5c0c('0x23'),_0x44879a)[_0x5c0c('0x24')](function(_0x4f2907){if(_0x4f2907[_0x5c0c('0x25')]){return logger[_0x5c0c('0x25')](_0x5c0c('0x26'),JSON[_0x5c0c('0x1f')](_0x4f2907));}return logger[_0x5c0c('0xb')](_0x5c0c('0x27'));})[_0x5c0c('0x28')](function(_0x857c9a){return logger[_0x5c0c('0x25')]('error\x20mail',JSON[_0x5c0c('0x1f')](_0x857c9a));});}};}function handleError(){return function(_0x309979){return logger['error'](JSON['stringify'](_0x309979));};}function handleResult(_0x379b0f){return function(_0x17fcb1){logger[_0x5c0c('0xb')]('data',JSON[_0x5c0c('0x1f')](_0x17fcb1));if(_0x379b0f[_0x5c0c('0xd')]&&_0x379b0f[_0x5c0c('0xd')]['Smtp']&&!_[_0x5c0c('0x29')](_0x379b0f['email'])){setTimeout(handleSendEmail(_0x379b0f,_0x17fcb1),0x3c*0x3e8);}};}function handleJob(_0x20b537){return function(){try{if(_[_0x5c0c('0x29')](_0x20b537[_0x5c0c('0x2a')])){return logger[_0x5c0c('0xb')](_0x5c0c('0x2b'));}if(_[_0x5c0c('0x29')](_0x20b537[_0x5c0c('0x2c')])){return logger[_0x5c0c('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x13bda1={'startDate':moment()[_0x5c0c('0x2d')](_0x20b537['subtractNumber'],_0x20b537[_0x5c0c('0x2c')])[_0x5c0c('0xe')](_0x5c0c('0x2e')),'endDate':moment()[_0x5c0c('0xe')](_0x5c0c('0x2e')),'type':_0x5c0c('0x2f'),'output':_0x20b537[_0x5c0c('0x30')],'name':_0x20b537[_0x5c0c('0x13')]};if(!_[_0x5c0c('0x29')](_0x20b537[_0x5c0c('0x31')])){logger[_0x5c0c('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x20b537[_0x5c0c('0x31')]);return analyticDefaultReportController[_0x5c0c('0x32')]({'id':_0x20b537[_0x5c0c('0x31')]},_0x13bda1)[_0x5c0c('0x24')](handleResult(_0x20b537))[_0x5c0c('0x28')](handleError());}if(!_[_0x5c0c('0x29')](_0x20b537[_0x5c0c('0x33')])){logger[_0x5c0c('0xb')](_0x5c0c('0x34'),_0x20b537[_0x5c0c('0x33')]);return analyticCustomReportController[_0x5c0c('0x32')]({'id':_0x20b537['CustomReportId']},_0x13bda1)['then'](handleResult(_0x20b537))[_0x5c0c('0x28')](handleError());}}catch(_0x3ad810){logger[_0x5c0c('0x25')](JSON[_0x5c0c('0x1f')](_0x3ad810));}return logger[_0x5c0c('0xb')]('no\x20report\x20id');};}function getJobs(_0x3ddd75){var _0x22a18b={};if(_0x3ddd75){_0x22a18b['id']=_0x3ddd75;}return db[_0x5c0c('0x35')][_0x5c0c('0x36')]({'where':_0x22a18b,'include':[{'model':db[_0x5c0c('0xd')],'attributes':['id','name',_0x5c0c('0x11')],'include':[{'model':db[_0x5c0c('0x37')],'as':_0x5c0c('0x38'),'include':[{'model':db[_0x5c0c('0x39')],'as':_0x5c0c('0x39')}]}]}]})['then'](function(_0x22635d){var _0x39dc89=_[_0x5c0c('0x3a')](manager['jobs']);var _0x30bc09=_[_0x5c0c('0x3b')](_0x22635d,function(_0x4c0c6e){return _0x4c0c6e['id'][_0x5c0c('0x3c')]();});var _0x58fd37=_['keyBy'](_0x22635d,function(_0x566252){return _0x566252['id'][_0x5c0c('0x3c')]();});var _0x3160ed=_0x3ddd75?_0x30bc09:_[_0x5c0c('0x3d')](_0x30bc09,_0x39dc89);var _0x435d64=_[_0x5c0c('0x3e')](_0x30bc09,_0x39dc89);var _0x169a3a=_['difference'](_0x39dc89,_0x30bc09);var _0x1a2018;var _0x3df1b4;for(_0x1a2018=0x0;_0x1a2018<_0x169a3a['length']&&!_0x3ddd75;_0x1a2018+=0x1){_0x3df1b4=_0x169a3a[_0x1a2018][_0x5c0c('0x3c')]();if(manager['exists'](_0x3df1b4)){manager['stop'](_0x3df1b4);manager[_0x5c0c('0x3f')](_0x3df1b4);logger[_0x5c0c('0xb')](_0x5c0c('0x40'),_0x3df1b4);}}logger[_0x5c0c('0xb')](_0x5c0c('0x41'),JSON['stringify'](_0x3160ed));for(_0x1a2018=0x0;_0x1a2018<_0x3160ed[_0x5c0c('0x42')];_0x1a2018+=0x1){_0x3df1b4=_0x3160ed[_0x1a2018][_0x5c0c('0x3c')]();logger[_0x5c0c('0xb')](_0x5c0c('0x43'),_0x3df1b4);if(_0x3ddd75){logger[_0x5c0c('0xb')](_0x5c0c('0x44'),_0x3ddd75);logger[_0x5c0c('0xb')](JSON[_0x5c0c('0x1f')](_0x58fd37[_0x3df1b4]));BPromise[_0x5c0c('0x45')]()[_0x5c0c('0x24')](handleJob(_0x58fd37[_0x3df1b4]));logger['info'](_0x5c0c('0x46'),_0x58fd37[_0x3df1b4]['name'],_0x58fd37[_0x3df1b4][_0x5c0c('0x47')]);}else if(_0x58fd37[_0x3df1b4]['cron']&&_0x58fd37[_0x3df1b4]['active']&&moment()['isBetween'](_0x58fd37[_0x3df1b4]['startAt'],_0x58fd37[_0x3df1b4]['endAt'])){manager[_0x5c0c('0x48')](_0x3df1b4,_0x58fd37[_0x3df1b4][_0x5c0c('0x47')],handleJob(_0x58fd37[_0x3df1b4]));manager[_0x5c0c('0x49')](_0x3df1b4);logger[_0x5c0c('0xb')]('add\x20cron',_0x58fd37[_0x3df1b4][_0x5c0c('0x13')],_0x58fd37[_0x3df1b4][_0x5c0c('0x47')]);}else if(manager['exists'](_0x3df1b4)){manager[_0x5c0c('0x4a')](_0x3df1b4);manager[_0x5c0c('0x3f')](_0x3df1b4);logger[_0x5c0c('0xb')]('stop\x20cron',_0x58fd37[_0x3df1b4][_0x5c0c('0x13')],_0x58fd37[_0x3df1b4]['cron']);}}for(_0x1a2018=0x0,_0x3df1b4;_0x1a2018<_0x435d64[_0x5c0c('0x42')]&&!_0x3ddd75;_0x1a2018+=0x1){_0x3df1b4=_0x435d64[_0x1a2018]['toString']();if(manager['exists'](_0x3df1b4)){if(_0x58fd37[_0x3df1b4][_0x5c0c('0x47')]&&_0x58fd37[_0x3df1b4]['active']&&moment()[_0x5c0c('0x4b')](_0x58fd37[_0x3df1b4][_0x5c0c('0x4c')],_0x58fd37[_0x3df1b4][_0x5c0c('0x4d')])){manager[_0x5c0c('0x4e')](_0x3df1b4,_0x58fd37[_0x3df1b4][_0x5c0c('0x47')],handleJob(_0x58fd37[_0x3df1b4]));logger['info'](_0x5c0c('0x4f'),_0x58fd37[_0x3df1b4][_0x5c0c('0x13')],_0x58fd37[_0x3df1b4][_0x5c0c('0x47')]);}else{manager[_0x5c0c('0x4a')](_0x3df1b4);manager[_0x5c0c('0x3f')](_0x3df1b4);logger[_0x5c0c('0xb')]('stop\x20cron',_0x58fd37[_0x3df1b4][_0x5c0c('0x13')],_0x58fd37[_0x3df1b4][_0x5c0c('0x47')]);}}}})[_0x5c0c('0x28')](function(_0x369ff6){logger[_0x5c0c('0x25')](JSON[_0x5c0c('0x1f')](_0x369ff6));});}exports[_0x5c0c('0x50')]=function(_0x1e19be){return getJobs(_0x1e19be);};exports[_0x5c0c('0x49')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xeee9=['email','MailAccount','format','name','Smtp','bcc','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','deleteJob','stop\x20cron','update\x20cron','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to'];(function(_0x49ea8f,_0xd3f62c){var _0x314374=function(_0x5328a1){while(--_0x5328a1){_0x49ea8f['push'](_0x49ea8f['shift']());}};_0x314374(++_0xd3f62c);}(_0xeee9,0x1f0));var _0x9eee=function(_0x211543,_0x254f24){_0x211543=_0x211543-0x0;var _0x11a997=_0xeee9[_0x211543];return _0x11a997;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x9eee('0x0'));var _=require(_0x9eee('0x1'));var moment=require(_0x9eee('0x2'));var CronJobManager=require(_0x9eee('0x3'));var jayson=require(_0x9eee('0x4'));var BPromise=require(_0x9eee('0x5'));var logger=require(_0x9eee('0x6'))(_0x9eee('0x7'));var db=require(_0x9eee('0x8'))['db'];var analyticCustomReportController=require(_0x9eee('0x9'));var analyticDefaultReportController=require(_0x9eee('0xa'));var client=jayson[_0x9eee('0xb')][_0x9eee('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x55de23,_0x2bc09e){return function(){logger['info'](_0x9eee('0xd'),_0x55de23[_0x9eee('0xe')]);var _0x1c3034=!![];var _0x39aa04=_0x55de23[_0x9eee('0xf')]['getSmtpOptions']();var _0x56a55a={'account':_0x39aa04,'message':{'from':util[_0x9eee('0x10')]('\x22%s\x22\x20<%s>',_0x55de23[_0x9eee('0xf')][_0x9eee('0x11')],_0x55de23[_0x9eee('0xf')][_0x9eee('0xe')]||_0x55de23[_0x9eee('0xf')][_0x9eee('0x12')]['user']),'to':_0x55de23['email'],'cc':_0x55de23['cc'],'bcc':_0x55de23[_0x9eee('0x13')],'subject':util[_0x9eee('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x2bc09e[_0x9eee('0x11')],_0x55de23['subtractNumber'],_0x55de23['subtractUnit'])}};var _0xe2b2c4=path['join'](__dirname,_0x9eee('0x14'));var _0xf0e13b=_0x2bc09e[_0x9eee('0x15')];var _0x1327e8=util['format'](_0x9eee('0x16'),path['basename'](_0x2bc09e['savename'],path[_0x9eee('0x17')](_0x2bc09e['savename'])),_0x9eee('0x18'));var _0x32aab3=path[_0x9eee('0x19')](_0xe2b2c4,_0xf0e13b);var _0x35d20f=path[_0x9eee('0x19')](_0xe2b2c4,_0x1327e8);if(fs[_0x9eee('0x1a')](_0x32aab3)){_0x2bc09e[_0x9eee('0x1b')]='Sent';_0x56a55a[_0x9eee('0x1c')][_0x9eee('0x1d')]=[{'filename':_0xf0e13b,'path':_0x32aab3}];_0x56a55a[_0x9eee('0x1c')]['text']=util[_0x9eee('0x10')](_0x9eee('0x1e'),JSON[_0x9eee('0x1f')](_0x2bc09e,null,0x2));}else if(fs['existsSync'](_0x35d20f)){_0x2bc09e[_0x9eee('0x1b')]=_0x9eee('0x20');_0x56a55a['message'][_0x9eee('0x1d')]=[{'filename':_0x1327e8,'path':_0x35d20f}];}else{_0x56a55a['message'][_0x9eee('0x21')]=_0x9eee('0x22');if(!_0x55de23[_0x9eee('0x23')]){_0x1c3034=![];logger[_0x9eee('0x24')](_0x9eee('0x25'));}}if(_0x1c3034){return client['request']('SendMail',_0x56a55a)['then'](function(_0x21e5a3){if(_0x21e5a3[_0x9eee('0x26')]){return logger['error'](_0x9eee('0x27'),JSON[_0x9eee('0x1f')](_0x21e5a3));}return logger['info'](_0x9eee('0x28'));})[_0x9eee('0x29')](function(_0x4f4597){return logger[_0x9eee('0x26')]('error\x20mail',JSON[_0x9eee('0x1f')](_0x4f4597));});}};}function handleError(){return function(_0x22cc71){return logger[_0x9eee('0x26')](JSON[_0x9eee('0x1f')](_0x22cc71));};}function handleResult(_0x27e224){return function(_0x1b1cef){logger[_0x9eee('0x24')](_0x9eee('0x2a'),JSON[_0x9eee('0x1f')](_0x1b1cef));if(_0x27e224[_0x9eee('0xf')]&&_0x27e224[_0x9eee('0xf')][_0x9eee('0x12')]&&!_[_0x9eee('0x2b')](_0x27e224[_0x9eee('0xe')])){setTimeout(handleSendEmail(_0x27e224,_0x1b1cef),0x3c*0x3e8);}};}function handleJob(_0x34348b){return function(){try{if(_[_0x9eee('0x2b')](_0x34348b[_0x9eee('0x2c')])){return logger[_0x9eee('0x24')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x9eee('0x2b')](_0x34348b['subtractUnit'])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x1256b4={'startDate':moment()[_0x9eee('0x2d')](_0x34348b[_0x9eee('0x2c')],_0x34348b['subtractUnit'])[_0x9eee('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x9eee('0x10')](_0x9eee('0x2e')),'type':_0x9eee('0x2f'),'output':_0x34348b[_0x9eee('0x30')],'name':_0x34348b[_0x9eee('0x11')]};if(!_[_0x9eee('0x2b')](_0x34348b[_0x9eee('0x31')])){logger[_0x9eee('0x24')](_0x9eee('0x32'),_0x34348b[_0x9eee('0x31')]);return analyticDefaultReportController[_0x9eee('0x33')]({'id':_0x34348b[_0x9eee('0x31')]},_0x1256b4)[_0x9eee('0x34')](handleResult(_0x34348b))[_0x9eee('0x29')](handleError());}if(!_['isNil'](_0x34348b[_0x9eee('0x35')])){logger[_0x9eee('0x24')](_0x9eee('0x36'),_0x34348b[_0x9eee('0x35')]);return analyticCustomReportController['runReport']({'id':_0x34348b['CustomReportId']},_0x1256b4)[_0x9eee('0x34')](handleResult(_0x34348b))[_0x9eee('0x29')](handleError());}}catch(_0x4561bd){logger[_0x9eee('0x26')](JSON[_0x9eee('0x1f')](_0x4561bd));}return logger['info'](_0x9eee('0x37'));};}function getJobs(_0xff7c9){var _0x5e24ff={};if(_0xff7c9){_0x5e24ff['id']=_0xff7c9;}return db[_0x9eee('0x38')][_0x9eee('0x39')]({'where':_0x5e24ff,'include':[{'model':db[_0x9eee('0xf')],'attributes':['id',_0x9eee('0x11'),_0x9eee('0xe')],'include':[{'model':db['MailServerOut'],'as':_0x9eee('0x12'),'include':[{'model':db['CloudProvider'],'as':_0x9eee('0x3a')}]}]}]})[_0x9eee('0x34')](function(_0x32591f){var _0xccba53=_[_0x9eee('0x3b')](manager[_0x9eee('0x3c')]);var _0x1f4669=_[_0x9eee('0x3d')](_0x32591f,function(_0x2bce9a){return _0x2bce9a['id'][_0x9eee('0x3e')]();});var _0x525c76=_[_0x9eee('0x3f')](_0x32591f,function(_0x4785ae){return _0x4785ae['id']['toString']();});var _0x29e654=_0xff7c9?_0x1f4669:_[_0x9eee('0x40')](_0x1f4669,_0xccba53);var _0x282cd7=_[_0x9eee('0x41')](_0x1f4669,_0xccba53);var _0x39ddad=_[_0x9eee('0x40')](_0xccba53,_0x1f4669);var _0x2f936a;var _0x2ece02;for(_0x2f936a=0x0;_0x2f936a<_0x39ddad[_0x9eee('0x42')]&&!_0xff7c9;_0x2f936a+=0x1){_0x2ece02=_0x39ddad[_0x2f936a][_0x9eee('0x3e')]();if(manager[_0x9eee('0x43')](_0x2ece02)){manager[_0x9eee('0x44')](_0x2ece02);manager['deleteJob'](_0x2ece02);logger[_0x9eee('0x24')](_0x9eee('0x45'),_0x2ece02);}}logger['info'](_0x9eee('0x46'),JSON['stringify'](_0x29e654));for(_0x2f936a=0x0;_0x2f936a<_0x29e654[_0x9eee('0x42')];_0x2f936a+=0x1){_0x2ece02=_0x29e654[_0x2f936a][_0x9eee('0x3e')]();logger[_0x9eee('0x24')](_0x9eee('0x47'),_0x2ece02);if(_0xff7c9){logger[_0x9eee('0x24')](_0x9eee('0x48'),_0xff7c9);logger[_0x9eee('0x24')](JSON[_0x9eee('0x1f')](_0x525c76[_0x2ece02]));BPromise[_0x9eee('0x49')]()[_0x9eee('0x34')](handleJob(_0x525c76[_0x2ece02]));logger['info'](_0x9eee('0x4a'),_0x525c76[_0x2ece02]['name'],_0x525c76[_0x2ece02][_0x9eee('0x4b')]);}else if(_0x525c76[_0x2ece02][_0x9eee('0x4b')]&&_0x525c76[_0x2ece02][_0x9eee('0x4c')]&&moment()[_0x9eee('0x4d')](_0x525c76[_0x2ece02][_0x9eee('0x4e')],_0x525c76[_0x2ece02][_0x9eee('0x4f')])){manager[_0x9eee('0x50')](_0x2ece02,_0x525c76[_0x2ece02]['cron'],handleJob(_0x525c76[_0x2ece02]));manager[_0x9eee('0x51')](_0x2ece02);logger[_0x9eee('0x24')]('add\x20cron',_0x525c76[_0x2ece02]['name'],_0x525c76[_0x2ece02][_0x9eee('0x4b')]);}else if(manager[_0x9eee('0x43')](_0x2ece02)){manager['stop'](_0x2ece02);manager[_0x9eee('0x52')](_0x2ece02);logger['info'](_0x9eee('0x53'),_0x525c76[_0x2ece02][_0x9eee('0x11')],_0x525c76[_0x2ece02][_0x9eee('0x4b')]);}}for(_0x2f936a=0x0,_0x2ece02;_0x2f936a<_0x282cd7['length']&&!_0xff7c9;_0x2f936a+=0x1){_0x2ece02=_0x282cd7[_0x2f936a][_0x9eee('0x3e')]();if(manager['exists'](_0x2ece02)){if(_0x525c76[_0x2ece02][_0x9eee('0x4b')]&&_0x525c76[_0x2ece02][_0x9eee('0x4c')]&&moment()[_0x9eee('0x4d')](_0x525c76[_0x2ece02]['startAt'],_0x525c76[_0x2ece02][_0x9eee('0x4f')])){manager['update'](_0x2ece02,_0x525c76[_0x2ece02]['cron'],handleJob(_0x525c76[_0x2ece02]));logger[_0x9eee('0x24')](_0x9eee('0x54'),_0x525c76[_0x2ece02][_0x9eee('0x11')],_0x525c76[_0x2ece02]['cron']);}else{manager[_0x9eee('0x44')](_0x2ece02);manager[_0x9eee('0x52')](_0x2ece02);logger['info'](_0x9eee('0x53'),_0x525c76[_0x2ece02][_0x9eee('0x11')],_0x525c76[_0x2ece02][_0x9eee('0x4b')]);}}}})['catch'](function(_0x1a2727){logger[_0x9eee('0x26')](JSON[_0x9eee('0x1f')](_0x1a2727));});}exports['run']=function(_0x2c0f0e){return getJobs(_0x2c0f0e);};exports['start']=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 0a5a0da..8bdb969 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 _0xc0d6=['results','transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','Positive','Neutral','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','all','catch','start','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded'];(function(_0x588514,_0x4f924b){var _0x247db2=function(_0x22c5b2){while(--_0x22c5b2){_0x588514['push'](_0x588514['shift']());}};_0x247db2(++_0x4f924b);}(_0xc0d6,0x1ce));var _0x6c0d=function(_0x256a25,_0x1302ed){_0x256a25=_0x256a25-0x0;var _0x28535c=_0xc0d6[_0x256a25];return _0x28535c;};var _=require('lodash');var AWS=require(_0x6c0d('0x0'));var rp=require('request-promise');var util=require(_0x6c0d('0x1'));var BPromise=require(_0x6c0d('0x2'));var db=require(_0x6c0d('0x3'))['db'];var logger=require(_0x6c0d('0x4'))(_0x6c0d('0x5'));function getTranscriptionJob(_0x21857a,_0xfc2a1c,_0x15ed87,_0x12c563){return new Promise(function(_0x32cbb6,_0x4caa83){var _0x4d7a9c=new AWS['TranscribeService']({'accessKeyId':_0xfc2a1c,'secretAccessKey':_0x21857a,'region':_0x15ed87});_0x4d7a9c[_0x6c0d('0x6')]({'TranscriptionJobName':_0x12c563},function(_0x266f0c,_0x2fdd21){if(_0x266f0c){return _0x4caa83(_0x266f0c);}else{return _0x32cbb6(_0x2fdd21);}});});}function sentiment(_0x16f430,_0x34ae4b,_0x4fc042,_0x2cf1e3,_0x32bce0){return new Promise(function(_0x514775,_0x3e5300){var _0x1132df=new AWS['Comprehend']({'accessKeyId':_0x34ae4b,'secretAccessKey':_0x16f430,'region':_0x4fc042});_0x1132df['detectSentiment']({'Text':_0x2cf1e3,'LanguageCode':_0x32bce0['substring'](0x0,0x2)},function(_0x73ae4d,_0x206d1d){if(_0x73ae4d){return _0x3e5300(_0x73ae4d);}else{return _0x514775(_0x206d1d);}});});}function checkTranscribeJob(_0x2d5a09,_0x2b1648,_0x595a86){var _0x577815;return new BPromise(function(_0x23d509,_0x4c7ed4){logger[_0x6c0d('0x7')](util[_0x6c0d('0x8')](_0x6c0d('0x9'),_0x2d5a09['id'],_0x2d5a09['transcribeName']));return getTranscriptionJob(_0x595a86[_0x6c0d('0xa')],_0x595a86[_0x6c0d('0xb')],_0x2b1648['transcribeRegion'],_0x2d5a09['transcribeName'])['then'](function(_0x274d2b){logger[_0x6c0d('0x7')](util[_0x6c0d('0x8')](_0x6c0d('0xc'),_0x2d5a09['id'],_0x2d5a09['transcribeName'],_0x274d2b['TranscriptionJob'][_0x6c0d('0xd')]));if(!_0x2d5a09[_0x6c0d('0xe')]){switch(_0x274d2b[_0x6c0d('0xf')][_0x6c0d('0xd')]){case _0x6c0d('0x10'):var _0x16dfa5={'transcribeStatus':_0x274d2b[_0x6c0d('0xf')][_0x6c0d('0xd')],'fileUri':_0x274d2b['TranscriptionJob'][_0x6c0d('0x11')][_0x6c0d('0x12')]};logger[_0x6c0d('0x7')](util[_0x6c0d('0x8')](_0x6c0d('0x13'),_0x2d5a09['id']));return rp({'uri':_0x274d2b['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})['then'](function(_0xf6eeb6){logger[_0x6c0d('0x7')](util['format'](_0x6c0d('0x14'),_0x2d5a09['id']));if(_0xf6eeb6&&_0xf6eeb6[_0x6c0d('0x15')]&&_0xf6eeb6[_0x6c0d('0x15')][_0x6c0d('0x16')]&&_0xf6eeb6['results']['transcripts'][_0x6c0d('0x17')]){_0x16dfa5[_0x6c0d('0xe')]='';for(var _0x109b65=0x0;_0x109b65<_0xf6eeb6['results'][_0x6c0d('0x16')]['length'];_0x109b65++){_0x16dfa5[_0x6c0d('0xe')]+=_0xf6eeb6[_0x6c0d('0x15')][_0x6c0d('0x16')][_0x109b65][_0x6c0d('0x18')]+'';}}return _0x2d5a09[_0x6c0d('0x19')](_0x16dfa5);})[_0x6c0d('0x1a')](function(){logger[_0x6c0d('0x7')](util[_0x6c0d('0x8')](_0x6c0d('0x1b'),_0x2d5a09['id']));if(!_0x2d5a09[_0x6c0d('0x1c')]){throw new db['Sequelize'][(_0x6c0d('0x1d'))](_0x6c0d('0x1e'));}if(!_0x2b1648[_0x6c0d('0x1f')]||!_0x2b1648[_0x6c0d('0x20')]||!_0x2b1648[_0x6c0d('0x21')]||!_0x2b1648[_0x6c0d('0x22')]||!_0x2b1648[_0x6c0d('0x23')]){throw new db[(_0x6c0d('0x24'))][(_0x6c0d('0x1d'))](_0x6c0d('0x25'));}if(!_0x16dfa5[_0x6c0d('0xe')]){throw new Error(_0x6c0d('0x26'));}if(_0x2b1648[_0x6c0d('0x20')]===_0x595a86['id']){return _0x595a86;}else{return db[_0x6c0d('0x27')]['findOne']({'where':{'id':_settings[_0x6c0d('0x20')]}});}})['then'](function(_0x242246){if(!_0x242246){throw new db[(_0x6c0d('0x24'))]['ValidationError'](_0x6c0d('0x28'));}if(!_0x242246[_0x6c0d('0xa')]||!_0x242246[_0x6c0d('0xb')]){throw new db[(_0x6c0d('0x24'))][(_0x6c0d('0x1d'))](_0x6c0d('0x29'));}_0x577815=_0x242246;logger[_0x6c0d('0x7')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2d5a09['id']));return sentiment(_0x577815[_0x6c0d('0xa')],_0x577815[_0x6c0d('0xb')],_0x2b1648['sentimentRegion'],_0x16dfa5[_0x6c0d('0xe')],_0x2b1648[_0x6c0d('0x22')]);})[_0x6c0d('0x1a')](function(_0x22a89a){logger[_0x6c0d('0x7')](util[_0x6c0d('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2d5a09['id']));return _0x2d5a09[_0x6c0d('0x19')]({'sentiment':_0x22a89a[_0x6c0d('0x2a')],'sPositive':_0x22a89a[_0x6c0d('0x2b')]['Positive'],'sNegative':_0x22a89a[_0x6c0d('0x2b')][_0x6c0d('0x2c')],'sMixed':_0x22a89a[_0x6c0d('0x2b')][_0x6c0d('0x2d')],'sNeutral':_0x22a89a[_0x6c0d('0x2b')]['Neutral']});})[_0x6c0d('0x1a')](function(){logger[_0x6c0d('0x7')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2d5a09['id']));_0x23d509();});case _0x6c0d('0x2e'):return _0x2d5a09[_0x6c0d('0x19')]({'transcribeStatus':_0x6c0d('0x2e'),'failureReason':_0x274d2b[_0x6c0d('0xf')][_0x6c0d('0x2f')]})[_0x6c0d('0x1a')](function(){logger[_0x6c0d('0x7')](util[_0x6c0d('0x8')](_0x6c0d('0x1b'),_0x2d5a09['id']));_0x23d509();});default:logger['info'](util[_0x6c0d('0x8')](_0x6c0d('0x30'),_0x2d5a09['id']));break;}}else{return BPromise[_0x6c0d('0x31')]()[_0x6c0d('0x1a')](function(){if(!_0x2d5a09[_0x6c0d('0x1c')]){throw new db[(_0x6c0d('0x24'))][(_0x6c0d('0x1d'))](_0x6c0d('0x1e'));}if(!_0x2b1648['sentiment']||!_0x2b1648[_0x6c0d('0x20')]||!_0x2b1648[_0x6c0d('0x21')]||!_0x2b1648[_0x6c0d('0x22')]||!_0x2b1648[_0x6c0d('0x23')]){throw new db[(_0x6c0d('0x24'))][(_0x6c0d('0x1d'))](_0x6c0d('0x25'));}if(!_0x2d5a09['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x2b1648[_0x6c0d('0x20')]===_0x595a86['id']){return _0x595a86;}else{return db[_0x6c0d('0x27')][_0x6c0d('0x32')]({'where':{'id':_settings[_0x6c0d('0x20')]}});}})[_0x6c0d('0x1a')](function(_0x183803){if(!_0x183803){throw new db['Sequelize'][(_0x6c0d('0x1d'))](_0x6c0d('0x28'));}if(!_0x183803[_0x6c0d('0xa')]||!_0x183803[_0x6c0d('0xb')]){throw new db[(_0x6c0d('0x24'))][(_0x6c0d('0x1d'))](_0x6c0d('0x29'));}_0x577815=_0x183803;logger[_0x6c0d('0x7')](util[_0x6c0d('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2d5a09['id']));return sentiment(_0x577815[_0x6c0d('0xa')],_0x577815[_0x6c0d('0xb')],_0x2b1648[_0x6c0d('0x21')],_0x2d5a09[_0x6c0d('0xe')],_0x2b1648['language']);})[_0x6c0d('0x1a')](function(_0x4c67e0){logger[_0x6c0d('0x7')](util[_0x6c0d('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2d5a09['id']));return _0x2d5a09[_0x6c0d('0x19')]({'sentiment':_0x4c67e0['Sentiment'],'sPositive':_0x4c67e0[_0x6c0d('0x2b')][_0x6c0d('0x33')],'sNegative':_0x4c67e0[_0x6c0d('0x2b')][_0x6c0d('0x2c')],'sMixed':_0x4c67e0['SentimentScore']['Mixed'],'sNeutral':_0x4c67e0['SentimentScore'][_0x6c0d('0x34')],'transcribeStatus':_0x6c0d('0x10')});})[_0x6c0d('0x1a')](function(){logger[_0x6c0d('0x7')](util[_0x6c0d('0x8')](_0x6c0d('0x1b'),_0x2d5a09['id']));_0x23d509();});}})['catch'](function(_0x1dadee){if(_0x1dadee){if(!_0x1dadee['name']||_0x1dadee[_0x6c0d('0x35')]!==_0x6c0d('0x36')){logger[_0x6c0d('0x37')](util[_0x6c0d('0x8')](_0x6c0d('0x38'),_0x2d5a09['id']),util[_0x6c0d('0x39')](_0x1dadee,{'showHidden':![],'depth':null}));}}_0x23d509();});});}function checkTranscribe(){var _0x322aa1;var _0xc555b3;var _0x27baf5;return db[_0x6c0d('0x3a')]['findAll']({'where':{'transcribeStatus':_0x6c0d('0x3b')}})[_0x6c0d('0x1a')](function(_0x5a96ac){if(!_0x5a96ac||!_0x5a96ac['length']){throw new db[(_0x6c0d('0x24'))][(_0x6c0d('0x1d'))](_0x6c0d('0x3c'));}_0x322aa1=_0x5a96ac;return db[_0x6c0d('0x3d')][_0x6c0d('0x32')]({'where':{'id':0x1}});})[_0x6c0d('0x1a')](function(_0x2a4028){if(!_0x2a4028){throw new db[(_0x6c0d('0x24'))][(_0x6c0d('0x1d'))](_0x6c0d('0x3e'));}_0xc555b3=_0x2a4028;if(!_0xc555b3['transcribe']||!_0xc555b3[_0x6c0d('0x3f')]||!_0xc555b3[_0x6c0d('0x40')]||!_0xc555b3[_0x6c0d('0x22')]||!_0xc555b3[_0x6c0d('0x23')]){throw new db[(_0x6c0d('0x24'))][(_0x6c0d('0x1d'))](_0x6c0d('0x41'));}return db[_0x6c0d('0x27')][_0x6c0d('0x32')]({'where':{'id':_0xc555b3[_0x6c0d('0x3f')]}});})[_0x6c0d('0x1a')](function(_0x35b00f){if(!_0x35b00f){throw new db['Sequelize'][(_0x6c0d('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x35b00f[_0x6c0d('0xa')]||!_0x35b00f[_0x6c0d('0xb')]){throw new db[(_0x6c0d('0x24'))][(_0x6c0d('0x1d'))](_0x6c0d('0x29'));}_0x27baf5=_0x35b00f;var _0xdb62c9=[];_0x322aa1['forEach'](function(_0x5a6f7e){_0xdb62c9['push'](checkTranscribeJob(_0x5a6f7e,_0xc555b3,_0x27baf5));});return BPromise[_0x6c0d('0x42')](_0xdb62c9);})[_0x6c0d('0x43')](function(_0xbc6585){if(_0xbc6585){if(!_0xbc6585[_0x6c0d('0x35')]||_0xbc6585[_0x6c0d('0x35')]!==_0x6c0d('0x36')){logger['error'](util[_0x6c0d('0x39')](_0xbc6585,{'showHidden':![],'depth':null}));}}});}exports[_0x6c0d('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x77f1=['sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','Sentiment','Neutral','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','CloudProvider','push','start','aws-sdk','request-promise','util','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','format','[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','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment'];(function(_0x4d3fac,_0x1598b2){var _0x202e79=function(_0x37656a){while(--_0x37656a){_0x4d3fac['push'](_0x4d3fac['shift']());}};_0x202e79(++_0x1598b2);}(_0x77f1,0x1dd));var _0x177f=function(_0x900b63,_0x58019b){_0x900b63=_0x900b63-0x0;var _0x232f3b=_0x77f1[_0x900b63];return _0x232f3b;};var _=require('lodash');var AWS=require(_0x177f('0x0'));var rp=require(_0x177f('0x1'));var util=require(_0x177f('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x177f('0x3'));function getTranscriptionJob(_0x139df2,_0x57dc73,_0x68cb6a,_0x22c85f){return new Promise(function(_0x31c4de,_0x3f30a3){var _0x1bd6b3=new AWS['TranscribeService']({'accessKeyId':_0x57dc73,'secretAccessKey':_0x139df2,'region':_0x68cb6a});_0x1bd6b3[_0x177f('0x4')]({'TranscriptionJobName':_0x22c85f},function(_0xbbdec1,_0x480125){if(_0xbbdec1){return _0x3f30a3(_0xbbdec1);}else{return _0x31c4de(_0x480125);}});});}function sentiment(_0xba9371,_0x51a488,_0x2652b4,_0x4e1bab,_0x2050c2){return new Promise(function(_0x38989d,_0x47ccab){var _0x42d6d2=new AWS[(_0x177f('0x5'))]({'accessKeyId':_0x51a488,'secretAccessKey':_0xba9371,'region':_0x2652b4});_0x42d6d2[_0x177f('0x6')]({'Text':_0x4e1bab,'LanguageCode':_0x2050c2[_0x177f('0x7')](0x0,0x2)},function(_0x233919,_0x46e4d0){if(_0x233919){return _0x47ccab(_0x233919);}else{return _0x38989d(_0x46e4d0);}});});}function checkTranscribeJob(_0x35e9f3,_0x224550,_0x564f48){var _0x2d1299;return new BPromise(function(_0xb74829,_0x3e4b5e){logger[_0x177f('0x8')](util['format'](_0x177f('0x9'),_0x35e9f3['id'],_0x35e9f3[_0x177f('0xa')]));return getTranscriptionJob(_0x564f48[_0x177f('0xb')],_0x564f48['data2'],_0x224550['transcribeRegion'],_0x35e9f3[_0x177f('0xa')])[_0x177f('0xc')](function(_0x457d8b){logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0xe'),_0x35e9f3['id'],_0x35e9f3[_0x177f('0xa')],_0x457d8b[_0x177f('0xf')][_0x177f('0x10')]));if(!_0x35e9f3[_0x177f('0x11')]){switch(_0x457d8b['TranscriptionJob'][_0x177f('0x10')]){case _0x177f('0x12'):var _0x4d1c1e={'transcribeStatus':_0x457d8b[_0x177f('0xf')][_0x177f('0x10')],'fileUri':_0x457d8b[_0x177f('0xf')][_0x177f('0x13')][_0x177f('0x14')]};logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x15'),_0x35e9f3['id']));return rp({'uri':_0x457d8b[_0x177f('0xf')][_0x177f('0x13')]['TranscriptFileUri'],'json':!![]})[_0x177f('0xc')](function(_0xac2388){logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x16'),_0x35e9f3['id']));if(_0xac2388&&_0xac2388[_0x177f('0x17')]&&_0xac2388[_0x177f('0x17')]['transcripts']&&_0xac2388['results'][_0x177f('0x18')][_0x177f('0x19')]){_0x4d1c1e[_0x177f('0x11')]='';for(var _0x240211=0x0;_0x240211<_0xac2388[_0x177f('0x17')][_0x177f('0x18')]['length'];_0x240211++){_0x4d1c1e[_0x177f('0x11')]+=_0xac2388[_0x177f('0x17')][_0x177f('0x18')][_0x240211][_0x177f('0x1a')]+'';}}return _0x35e9f3[_0x177f('0x1b')](_0x4d1c1e);})[_0x177f('0xc')](function(){logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x1c'),_0x35e9f3['id']));if(!_0x35e9f3[_0x177f('0x1d')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x20'));}if(!_0x224550[_0x177f('0x21')]||!_0x224550[_0x177f('0x22')]||!_0x224550['sentimentRegion']||!_0x224550[_0x177f('0x23')]||!_0x224550[_0x177f('0x24')]){throw new db['Sequelize'][(_0x177f('0x1f'))](_0x177f('0x25'));}if(!_0x4d1c1e['fileText']){throw new Error(_0x177f('0x26'));}if(_0x224550[_0x177f('0x22')]===_0x564f48['id']){return _0x564f48;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2f66e0){if(!_0x2f66e0){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x27'));}if(!_0x2f66e0[_0x177f('0xb')]||!_0x2f66e0[_0x177f('0x28')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x29'));}_0x2d1299=_0x2f66e0;logger[_0x177f('0x8')](util['format'](_0x177f('0x2a'),_0x35e9f3['id']));return sentiment(_0x2d1299[_0x177f('0xb')],_0x2d1299['data2'],_0x224550[_0x177f('0x2b')],_0x4d1c1e[_0x177f('0x11')],_0x224550['language']);})['then'](function(_0x3261df){logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x2c'),_0x35e9f3['id']));return _0x35e9f3['update']({'sentiment':_0x3261df['Sentiment'],'sPositive':_0x3261df[_0x177f('0x2d')][_0x177f('0x2e')],'sNegative':_0x3261df[_0x177f('0x2d')][_0x177f('0x2f')],'sMixed':_0x3261df[_0x177f('0x2d')][_0x177f('0x30')],'sNeutral':_0x3261df[_0x177f('0x2d')]['Neutral']});})[_0x177f('0xc')](function(){logger['info'](util[_0x177f('0xd')](_0x177f('0x1c'),_0x35e9f3['id']));_0xb74829();});case'FAILED':return _0x35e9f3[_0x177f('0x1b')]({'transcribeStatus':_0x177f('0x31'),'failureReason':_0x457d8b[_0x177f('0xf')][_0x177f('0x32')]})['then'](function(){logger['info'](util['format'](_0x177f('0x1c'),_0x35e9f3['id']));_0xb74829();});default:logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x33'),_0x35e9f3['id']));break;}}else{return BPromise[_0x177f('0x34')]()[_0x177f('0xc')](function(){if(!_0x35e9f3[_0x177f('0x1d')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x20'));}if(!_0x224550[_0x177f('0x21')]||!_0x224550['sentimentAccountId']||!_0x224550[_0x177f('0x2b')]||!_0x224550[_0x177f('0x23')]||!_0x224550[_0x177f('0x24')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x25'));}if(!_0x35e9f3[_0x177f('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x224550[_0x177f('0x22')]===_0x564f48['id']){return _0x564f48;}else{return db['CloudProvider'][_0x177f('0x35')]({'where':{'id':_settings[_0x177f('0x22')]}});}})['then'](function(_0x2ea504){if(!_0x2ea504){throw new db[(_0x177f('0x1e'))]['ValidationError'](_0x177f('0x27'));}if(!_0x2ea504['data1']||!_0x2ea504['data2']){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x29'));}_0x2d1299=_0x2ea504;logger['info'](util[_0x177f('0xd')](_0x177f('0x2a'),_0x35e9f3['id']));return sentiment(_0x2d1299[_0x177f('0xb')],_0x2d1299[_0x177f('0x28')],_0x224550['sentimentRegion'],_0x35e9f3[_0x177f('0x11')],_0x224550[_0x177f('0x23')]);})['then'](function(_0x10adbf){logger['info'](util[_0x177f('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x35e9f3['id']));return _0x35e9f3[_0x177f('0x1b')]({'sentiment':_0x10adbf[_0x177f('0x36')],'sPositive':_0x10adbf[_0x177f('0x2d')][_0x177f('0x2e')],'sNegative':_0x10adbf[_0x177f('0x2d')]['Negative'],'sMixed':_0x10adbf[_0x177f('0x2d')][_0x177f('0x30')],'sNeutral':_0x10adbf[_0x177f('0x2d')][_0x177f('0x37')],'transcribeStatus':'COMPLETED'});})[_0x177f('0xc')](function(){logger[_0x177f('0x8')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x35e9f3['id']));_0xb74829();});}})[_0x177f('0x38')](function(_0x881083){if(_0x881083){if(!_0x881083[_0x177f('0x39')]||_0x881083['name']!==_0x177f('0x3a')){logger[_0x177f('0x3b')](util[_0x177f('0xd')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x35e9f3['id']),util[_0x177f('0x3c')](_0x881083,{'showHidden':![],'depth':null}));}}_0xb74829();});});}function checkTranscribe(){var _0x13a292;var _0x4e639d;var _0x32dfaa;return db[_0x177f('0x3d')][_0x177f('0x3e')]({'where':{'transcribeStatus':_0x177f('0x3f')}})[_0x177f('0xc')](function(_0x3839ff){if(!_0x3839ff||!_0x3839ff[_0x177f('0x19')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x40'));}_0x13a292=_0x3839ff;return db[_0x177f('0x41')][_0x177f('0x35')]({'where':{'id':0x1}});})[_0x177f('0xc')](function(_0x2249ef){if(!_0x2249ef){throw new db['Sequelize']['ValidationError'](_0x177f('0x42'));}_0x4e639d=_0x2249ef;if(!_0x4e639d[_0x177f('0x3')]||!_0x4e639d[_0x177f('0x43')]||!_0x4e639d[_0x177f('0x44')]||!_0x4e639d['language']||!_0x4e639d[_0x177f('0x24')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x45'));}return db[_0x177f('0x46')][_0x177f('0x35')]({'where':{'id':_0x4e639d[_0x177f('0x43')]}});})[_0x177f('0xc')](function(_0x24bca6){if(!_0x24bca6){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x27'));}if(!_0x24bca6[_0x177f('0xb')]||!_0x24bca6[_0x177f('0x28')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x32dfaa=_0x24bca6;var _0x424904=[];_0x13a292['forEach'](function(_0x25cd3f){_0x424904[_0x177f('0x47')](checkTranscribeJob(_0x25cd3f,_0x4e639d,_0x32dfaa));});return BPromise['all'](_0x424904);})['catch'](function(_0x4d5864){if(_0x4d5864){if(!_0x4d5864[_0x177f('0x39')]||_0x4d5864['name']!==_0x177f('0x3a')){logger['error'](util['inspect'](_0x4d5864,{'showHidden':![],'depth':null}));}}});}exports[_0x177f('0x48')]=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 e42693e..996cd78 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 _0x2ba7=['inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions'];(function(_0x1155ef,_0x4a77ea){var _0x1d6614=function(_0x5a46d3){while(--_0x5a46d3){_0x1155ef['push'](_0x1155ef['shift']());}};_0x1d6614(++_0x4a77ea);}(_0x2ba7,0xe9));var _0x72ba=function(_0x3ddd7a,_0x37d533){_0x3ddd7a=_0x3ddd7a-0x0;var _0x3461c2=_0x2ba7[_0x3ddd7a];return _0x3461c2;};'use strict';var _=require(_0x72ba('0x0'));var moment=require(_0x72ba('0x1'));var Redis=require(_0x72ba('0x2'));var util=require(_0x72ba('0x3'));var config=require(_0x72ba('0x4'));var db=require(_0x72ba('0x5'))['db'];var logger=require(_0x72ba('0x6'))(_0x72ba('0x7'));config[_0x72ba('0x8')]=_['defaults'](config[_0x72ba('0x8')],{'host':_0x72ba('0x9'),'port':0x18eb});var io=require(_0x72ba('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x15a964=[];return db[_0x72ba('0xb')][_0x72ba('0xc')]({'raw':!![],'attributes':['id',_0x72ba('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x72ba('0xe')](0x18,_0x72ba('0xf'))}}})[_0x72ba('0x10')](function(_0x6b1a9){if(_0x6b1a9&&_0x6b1a9[_0x72ba('0x11')]){_0x15a964=_[_0x72ba('0x12')](_0x6b1a9||[],'id');logger[_0x72ba('0x13')](_0x72ba('0x14'),_0x15a964[_0x72ba('0x15')]());return db['WhatsappInteraction'][_0x72ba('0x16')]({'closeReason':'system','disposition':_0x72ba('0x17'),'closed':!![],'closedAt':moment()[_0x72ba('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x15a964}});}})[_0x72ba('0x10')](function(){if(_0x15a964&&_0x15a964[_0x72ba('0x11')]){logger['info'](_0x72ba('0x19'),_0x15a964[_0x72ba('0x15')]());for(var _0x3313f1=0x0;_0x3313f1<_0x15a964[_0x72ba('0x11')];_0x3313f1++){io[_0x72ba('0x1a')](_0x72ba('0x1b'),{'id':_0x15a964[_0x3313f1],'closed':!![]});}}})[_0x72ba('0x1c')](function(_0x115a37){logger[_0x72ba('0x1d')](_0x72ba('0x1e'),_0x115a37?util[_0x72ba('0x1f')](_0x115a37,{'showHidden':![],'depth':null}):'');});}exports[_0x72ba('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x654f=['lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll'];(function(_0x289c9f,_0x5b8e19){var _0x29d99a=function(_0x4effcf){while(--_0x4effcf){_0x289c9f['push'](_0x289c9f['shift']());}};_0x29d99a(++_0x5b8e19);}(_0x654f,0x16d));var _0xf654=function(_0x49ce55,_0x96d941){_0x49ce55=_0x49ce55-0x0;var _0x5c6ad0=_0x654f[_0x49ce55];return _0x5c6ad0;};'use strict';var _=require('lodash');var moment=require(_0xf654('0x0'));var Redis=require(_0xf654('0x1'));var util=require(_0xf654('0x2'));var config=require(_0xf654('0x3'));var db=require(_0xf654('0x4'))['db'];var logger=require(_0xf654('0x5'))('schedule');config[_0xf654('0x6')]=_[_0xf654('0x7')](config['redis'],{'host':_0xf654('0x8'),'port':0x18eb});var io=require(_0xf654('0x9'))(new Redis(config[_0xf654('0x6')]));function closeInteractions(){var _0x192141=[];return db[_0xf654('0xa')][_0xf654('0xb')]({'raw':!![],'attributes':['id',_0xf654('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xf654('0xd'))}}})[_0xf654('0xe')](function(_0xaae61){if(_0xaae61&&_0xaae61[_0xf654('0xf')]){_0x192141=_[_0xf654('0x10')](_0xaae61||[],'id');logger[_0xf654('0x11')](_0xf654('0x12'),_0x192141[_0xf654('0x13')]());return db[_0xf654('0xa')][_0xf654('0x14')]({'closeReason':'system','disposition':_0xf654('0x15'),'closed':!![],'closedAt':moment()['format'](_0xf654('0x16'))},{'where':{'id':_0x192141}});}})[_0xf654('0xe')](function(){if(_0x192141&&_0x192141['length']){logger[_0xf654('0x11')](_0xf654('0x17'),_0x192141[_0xf654('0x13')]());for(var _0x281dce=0x0;_0x281dce<_0x192141['length'];_0x281dce++){io[_0xf654('0x18')]('whatsappInteraction:update',{'id':_0x192141[_0x281dce],'closed':!![]});}}})[_0xf654('0x19')](function(_0xb27bce){logger[_0xf654('0x1a')](_0xf654('0x1b'),_0xb27bce?util[_0xf654('0x1c')](_0xb27bce,{'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 4a0c761..871b074 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb0d=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','hopper2','util','../mysqldb'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xbb0d,0x17a));var _0xdbb0=function(_0x43ee01,_0x434a22){_0x43ee01=_0x43ee01-0x0;var _0x44b8e5=_0xbb0d[_0x43ee01];return _0x44b8e5;};'use strict';var util=require(_0xdbb0('0x0'));var db=require(_0xdbb0('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xdbb0('0x2')]({'id':i,'firstName':_0xdbb0('0x3')+i,'lastName':_0xdbb0('0x4')+i,'phone':0xf879fb460+i,'email':_0xdbb0('0x5')+i+_0xdbb0('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xdbb0('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xdbb0('0x7')](),'updatedAt':Date[_0xdbb0('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xdbb0('0x2')]({'id':i,'firstName':_0xdbb0('0x3')+i,'lastName':_0xdbb0('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xdbb0('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xdbb0('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xdbb0('0x7')](),'updatedAt':Date[_0xdbb0('0x7')]()});}db[_0xdbb0('0x8')]['destroy']({'where':{}})[_0xdbb0('0x9')](function(){return db['CmContact'][_0xdbb0('0xa')](contacts);})[_0xdbb0('0x9')](function(){console[_0xdbb0('0xb')](_0xdbb0('0xc'),_0xdbb0('0xd'));return db[_0xdbb0('0xe')][_0xdbb0('0xf')]({'where':{}});})['then'](function(){return db[_0xdbb0('0xe')][_0xdbb0('0xa')](hopper);})[_0xdbb0('0x9')](function(){console[_0xdbb0('0xb')](_0xdbb0('0xc'),_0xdbb0('0x10'));return db['CmContact']['bulkCreate'](contacts2);})[_0xdbb0('0x9')](function(){console['log']('finished\x20populating',_0xdbb0('0x11'));return db[_0xdbb0('0xe')]['bulkCreate'](hopper2);})[_0xdbb0('0x9')](function(){console[_0xdbb0('0xb')]('finished\x20populating',_0xdbb0('0x12'));})['catch'](function(_0x58a131){console[_0xdbb0('0xb')](_0x58a131);}); \ No newline at end of file +var _0x4a40=['catch','util','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','CmContact','then','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','bulkCreate'];(function(_0x218581,_0x377be8){var _0x2688d2=function(_0x436c37){while(--_0x436c37){_0x218581['push'](_0x218581['shift']());}};_0x2688d2(++_0x377be8);}(_0x4a40,0x188));var _0x04a4=function(_0x46f76e,_0x5b923b){_0x46f76e=_0x46f76e-0x0;var _0x426ce4=_0x4a40[_0x46f76e];return _0x426ce4;};'use strict';var util=require(_0x04a4('0x0'));var db=require(_0x04a4('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x04a4('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x04a4('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x04a4('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x04a4('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x04a4('0x5')](),'updatedAt':Date[_0x04a4('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x04a4('0x2')]({'id':i,'firstName':_0x04a4('0x6')+i,'lastName':_0x04a4('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x04a4('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x04a4('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x04a4('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x04a4('0x5')]()});}db[_0x04a4('0x7')]['destroy']({'where':{}})[_0x04a4('0x8')](function(){return db[_0x04a4('0x7')]['bulkCreate'](contacts);})['then'](function(){console[_0x04a4('0x9')](_0x04a4('0xa'),_0x04a4('0xb'));return db[_0x04a4('0xc')]['destroy']({'where':{}});})['then'](function(){return db[_0x04a4('0xc')]['bulkCreate'](hopper);})[_0x04a4('0x8')](function(){console['log'](_0x04a4('0xa'),_0x04a4('0xd'));return db[_0x04a4('0x7')]['bulkCreate'](contacts2);})[_0x04a4('0x8')](function(){console[_0x04a4('0x9')](_0x04a4('0xa'),_0x04a4('0xe'));return db['CmHopper'][_0x04a4('0xf')](hopper2);})[_0x04a4('0x8')](function(){console[_0x04a4('0x9')](_0x04a4('0xa'),'hopper2');})[_0x04a4('0x10')](function(_0xb7055a){console[_0x04a4('0x9')](_0xb7055a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 31932d3..d3a7238 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd33=['ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xbd33,0x145));var _0x3bd3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbd33[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x3bd3('0x0'));var db=require(_0x3bd3('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3bd3('0x2')]({'name':util[_0x3bd3('0x3')](_0x3bd3('0x4'),_0x3bd3('0x5'),i),'fullname':util[_0x3bd3('0x3')]('%s%s','agent',i),'email':util['format'](_0x3bd3('0x6'),_0x3bd3('0x5'),i),'role':'agent','password':_0x3bd3('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x3bd3('0x8'),'ws',_0x3bd3('0x9')],'disallow':[_0x3bd3('0xa')],'allow':[_0x3bd3('0xb')],'defaultuser':util[_0x3bd3('0x3')]('%s%s',_0x3bd3('0x5'),i),'encryption':_0x3bd3('0xc'),'avpf':'yes','force_avp':_0x3bd3('0xc'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x3bd3('0xd'),'dtlssetup':_0x3bd3('0xe'),'callerid':util['format'](_0x3bd3('0xf'),util[_0x3bd3('0x3')](_0x3bd3('0x4'),_0x3bd3('0x5'),i),0xfa0+i)});}db['User'][_0x3bd3('0x10')](users)[_0x3bd3('0x11')](function(){console[_0x3bd3('0x12')](_0x3bd3('0x13'));})[_0x3bd3('0x14')](function(_0x3d1ac7){console['log'](_0x3d1ac7);}); \ No newline at end of file +var _0xa263=['ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','add\x20user','log','util','../mysqldb','push','format','agent','%s%s@xcally.com','password','udp','wss','all'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xa263,0x170));var _0x3a26=function(_0x1bd860,_0x5dc850){_0x1bd860=_0x1bd860-0x0;var _0x3bd65c=_0xa263[_0x1bd860];return _0x3bd65c;};'use strict';var util=require(_0x3a26('0x0'));var db=require(_0x3a26('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3a26('0x2')]({'name':util[_0x3a26('0x3')]('%s%s',_0x3a26('0x4'),i),'fullname':util[_0x3a26('0x3')]('%s%s',_0x3a26('0x4'),i),'email':util[_0x3a26('0x3')](_0x3a26('0x5'),_0x3a26('0x4'),i),'role':_0x3a26('0x4'),'password':_0x3a26('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x3a26('0x7'),'ws',_0x3a26('0x8')],'disallow':[_0x3a26('0x9')],'allow':[_0x3a26('0xa')],'defaultuser':util[_0x3a26('0x3')](_0x3a26('0xb'),_0x3a26('0x4'),i),'encryption':_0x3a26('0xc'),'avpf':_0x3a26('0xc'),'force_avp':_0x3a26('0xc'),'icesupport':_0x3a26('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x3a26('0xd'),'dtlsprivatekey':_0x3a26('0xe'),'dtlssetup':_0x3a26('0xf'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x3a26('0xb'),'agent',i),0xfa0+i)});}db[_0x3a26('0x10')][_0x3a26('0x11')](users)[_0x3a26('0x12')](function(){console['log'](_0x3a26('0x13'));})['catch'](function(_0x1927d3){console[_0x3a26('0x14')](_0x1927d3);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index bc730a9..ef7a4a4 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f83=['user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','util','bluebird','./environment','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','resourceId','map','format','%s:queue:%s','user:%s','query','find','userProfileId','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','ChatQueue','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions'];(function(_0x316e8b,_0x59710b){var _0x25edbf=function(_0x1b80d4){while(--_0x1b80d4){_0x316e8b['push'](_0x316e8b['shift']());}};_0x25edbf(++_0x59710b);}(_0x6f83,0x72));var _0x36f8=function(_0xa6084d,_0x3607b8){_0xa6084d=_0xa6084d-0x0;var _0x12738e=_0x6f83[_0xa6084d];return _0x12738e;};'use strict';var _=require('lodash');var util=require(_0x36f8('0x0'));var BPromise=require(_0x36f8('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x36f8('0x2'));var queryQueues={'attributes':['id',_0x36f8('0x3')],'include':[{'as':_0x36f8('0x4'),'model':db[_0x36f8('0x5')],'attributes':['id',_0x36f8('0x3'),_0x36f8('0x6')],'raw':!![],'where':{'role':_0x36f8('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x36f8('0x3')],'where':{'role':_0x36f8('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x36f8('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x36f8('0x3')],'where':{'role':_0x36f8('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x36f8('0x3'),_0x36f8('0x9')],'where':{'type':_0x36f8('0xa')}};function getAssociatedResources(_0x2c9c6f,_0x496f32,_0x48c7b2){return db['UserProfileSection'][_0x36f8('0xb')]({'where':{'name':_0x2c9c6f,'userProfileId':_0x496f32},'raw':!![]})[_0x36f8('0xc')](function(_0x29a8f8){if(_0x29a8f8){if(_0x29a8f8[_0x36f8('0xd')]){switch(_0x2c9c6f){case _0x36f8('0xe'):case _0x36f8('0xf'):case _0x36f8('0x10'):case _0x36f8('0x11'):case _0x36f8('0x12'):case'OpenchannelQueues':case _0x36f8('0x13'):return db[_0x48c7b2][_0x36f8('0x14')](queryQueues);case _0x36f8('0x15'):return db[_0x48c7b2][_0x36f8('0x14')](queryTelephones);case'Trunks':return db[_0x48c7b2][_0x36f8('0x14')](queryTrunks);case _0x36f8('0x16'):return db[_0x48c7b2][_0x36f8('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x36f8('0x14')]({'attributes':[_0x36f8('0x17')],'where':{'sectionId':_0x29a8f8['id']},'raw':!![]})[_0x36f8('0xc')](function(_0x5048e0){if(_0x5048e0){var _0x429efc={'where':{'id':_[_0x36f8('0x18')](_0x5048e0,_0x36f8('0x17'))},'raw':!![]};switch(_0x48c7b2){case _0x36f8('0x5'):_0x429efc['where']['role']=_0x36f8('0x8');break;case'Campaign':_0x429efc['where'][_0x36f8('0x9')]=_0x36f8('0xa');break;}return db[_0x48c7b2]['findAll'](_0x429efc);}else{return[];}});}}else{return[];}})[_0x36f8('0xc')](function(_0x320be2){return _0x320be2;});}function joinOrLeaveQueues(_0x290e63,_0x337cbb,_0x19d6ce,_0x1086ce){_0x290e63[_0x337cbb](util[_0x36f8('0x19')](_0x36f8('0x1a'),_0x19d6ce,_0x1086ce[_0x36f8('0x3')]));if(_0x1086ce[_0x36f8('0x4')]){for(var _0x26fc64=0x0;_0x26fc64<_0x1086ce[_0x36f8('0x4')]['length'];_0x26fc64+=0x1){_0x290e63[_0x337cbb](util[_0x36f8('0x19')](_0x36f8('0x1b'),_0x1086ce[_0x36f8('0x4')][_0x26fc64]['name']));}}}function joinOrLeave(_0x3917f1,_0x52b5ac,_0x362eae){var _0x206075;if(_0x3917f1['handshake'][_0x36f8('0x1c')]['id']){db['User'][_0x36f8('0x1d')]({'attributes':['id',_0x36f8('0x3'),_0x36f8('0x6'),_0x36f8('0x1e')],'where':{'id':_0x3917f1[_0x36f8('0x1f')][_0x36f8('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x36f8('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x36f8('0x21')],'as':_0x36f8('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x36f8('0x23')],'as':_0x36f8('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x36f8('0x25')],'as':_0x36f8('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x36f8('0x27')],'as':_0x36f8('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x36f8('0x29'),'attributes':['id'],'raw':!![]}]})[_0x36f8('0xc')](function(_0x3f01a6){if(_0x3f01a6){_0x206075=_0x3f01a6;_0x3917f1[_0x52b5ac](util[_0x36f8('0x19')](_0x36f8('0x1b'),_0x3f01a6[_0x36f8('0x3')]));var _0x4fedf6=[];switch(_0x3f01a6[_0x36f8('0x6')]){case _0x36f8('0x2a'):_0x3917f1[_0x52b5ac](_0x36f8('0x2b'));_0x3917f1[_0x52b5ac](_0x36f8('0x2c'));if(queryQueues[_0x36f8('0x2d')](_0x36f8('0x2e'))){delete queryQueues[_0x36f8('0x2e')];}_0x4fedf6[_0x36f8('0x2f')](db[_0x36f8('0x30')][_0x36f8('0x14')](queryQueues));_0x4fedf6[_0x36f8('0x2f')](db['ChatQueue']['findAll'](queryQueues));_0x4fedf6['push'](db[_0x36f8('0x31')][_0x36f8('0x14')](queryQueues));_0x4fedf6[_0x36f8('0x2f')](db['SmsQueue'][_0x36f8('0x14')](queryQueues));_0x4fedf6[_0x36f8('0x2f')](db[_0x36f8('0x32')][_0x36f8('0x14')](queryQueues));_0x4fedf6[_0x36f8('0x2f')](db[_0x36f8('0x33')][_0x36f8('0x14')](queryQueues));_0x4fedf6[_0x36f8('0x2f')](db[_0x36f8('0x34')][_0x36f8('0x14')](queryQueues));_0x4fedf6['push'](db[_0x36f8('0x5')][_0x36f8('0x14')](queryTelephones));_0x4fedf6[_0x36f8('0x2f')](db[_0x36f8('0x35')][_0x36f8('0x14')](queryTrunks));_0x4fedf6['push'](db[_0x36f8('0x36')][_0x36f8('0x14')](queryCampaigns));_0x4fedf6[_0x36f8('0x2f')](db['User'][_0x36f8('0x14')](queryAgents));break;case _0x36f8('0x37'):_0x3917f1[_0x52b5ac](_0x36f8('0x2b'));_0x3917f1[_0x52b5ac](_0x36f8('0x2c'));_0x4fedf6['push'](getAssociatedResources('VoiceQueues',_0x3f01a6[_0x36f8('0x1e')],_0x36f8('0x30')));_0x4fedf6[_0x36f8('0x2f')](getAssociatedResources(_0x36f8('0xf'),_0x3f01a6[_0x36f8('0x1e')],_0x36f8('0x38')));_0x4fedf6[_0x36f8('0x2f')](getAssociatedResources('FaxQueues',_0x3f01a6[_0x36f8('0x1e')],'FaxQueue'));_0x4fedf6[_0x36f8('0x2f')](getAssociatedResources(_0x36f8('0x11'),_0x3f01a6[_0x36f8('0x1e')],'SmsQueue'));_0x4fedf6['push'](getAssociatedResources(_0x36f8('0x12'),_0x3f01a6[_0x36f8('0x1e')],_0x36f8('0x32')));_0x4fedf6[_0x36f8('0x2f')](getAssociatedResources(_0x36f8('0x39'),_0x3f01a6[_0x36f8('0x1e')],_0x36f8('0x33')));_0x4fedf6[_0x36f8('0x2f')](getAssociatedResources(_0x36f8('0x13'),_0x3f01a6[_0x36f8('0x1e')],'WhatsappQueue'));_0x4fedf6[_0x36f8('0x2f')](getAssociatedResources(_0x36f8('0x15'),_0x3f01a6[_0x36f8('0x1e')],_0x36f8('0x5')));_0x4fedf6[_0x36f8('0x2f')](getAssociatedResources('Trunks',_0x3f01a6[_0x36f8('0x1e')],_0x36f8('0x35')));_0x4fedf6[_0x36f8('0x2f')](getAssociatedResources('IvrCampaigns',_0x3f01a6[_0x36f8('0x1e')],_0x36f8('0x36')));_0x4fedf6[_0x36f8('0x2f')](db[_0x36f8('0x5')][_0x36f8('0x14')](queryAgents));break;case'agent':_0x3917f1[_0x52b5ac](_0x36f8('0x2b'));_0x3917f1[_0x52b5ac](_0x36f8('0x2c'));_0x4fedf6[_0x36f8('0x2f')](_0x3f01a6[_0x36f8('0x3a')]({'attributes':['id',_0x36f8('0x3')]}));_0x4fedf6[_0x36f8('0x2f')](_0x3f01a6[_0x36f8('0x3b')]({'attributes':['id',_0x36f8('0x3')]}));_0x4fedf6['push'](_0x3f01a6[_0x36f8('0x3c')]({'attributes':['id','name']}));_0x4fedf6[_0x36f8('0x2f')](_0x3f01a6[_0x36f8('0x3d')]({'attributes':['id','name']}));_0x4fedf6[_0x36f8('0x2f')](_0x3f01a6[_0x36f8('0x3e')]({'attributes':['id','name']}));_0x4fedf6['push'](_0x3f01a6[_0x36f8('0x3f')]({'attributes':['id',_0x36f8('0x3')]}));_0x4fedf6[_0x36f8('0x2f')](_0x3f01a6[_0x36f8('0x40')]({'attributes':['id',_0x36f8('0x3')]}));break;}return BPromise['all'](_0x4fedf6);}})['then'](function(_0x116a18){if(_0x116a18&&_0x116a18[_0x36f8('0x41')]){for(var _0x142ec2=0x0;_0x142ec2<_0x116a18[_0x36f8('0x41')];_0x142ec2+=0x1){for(var _0x3925c7=0x0;_0x3925c7<_0x116a18[_0x142ec2]['length'];_0x3925c7+=0x1){switch(_0x142ec2){case 0x0:joinOrLeaveQueues(_0x3917f1,_0x52b5ac,'voice',_0x116a18[_0x142ec2][_0x3925c7]);break;case 0x1:joinOrLeaveQueues(_0x3917f1,_0x52b5ac,_0x36f8('0x42'),_0x116a18[_0x142ec2][_0x3925c7]);break;case 0x2:joinOrLeaveQueues(_0x3917f1,_0x52b5ac,_0x36f8('0x43'),_0x116a18[_0x142ec2][_0x3925c7]);break;case 0x3:joinOrLeaveQueues(_0x3917f1,_0x52b5ac,_0x36f8('0x44'),_0x116a18[_0x142ec2][_0x3925c7]);break;case 0x4:joinOrLeaveQueues(_0x3917f1,_0x52b5ac,_0x36f8('0x45'),_0x116a18[_0x142ec2][_0x3925c7]);break;case 0x5:joinOrLeaveQueues(_0x3917f1,_0x52b5ac,_0x36f8('0x46'),_0x116a18[_0x142ec2][_0x3925c7]);break;case 0x6:joinOrLeaveQueues(_0x3917f1,_0x52b5ac,'whatsapp',_0x116a18[_0x142ec2][_0x3925c7]);break;case 0x7:if(_0x206075[_0x36f8('0x6')]!=='agent')_0x3917f1[_0x52b5ac](util[_0x36f8('0x19')](_0x36f8('0x47'),_0x116a18[_0x142ec2][_0x3925c7][_0x36f8('0x3')]));break;case 0x8:if(_0x206075['role']!==_0x36f8('0x7'))_0x3917f1[_0x52b5ac](util[_0x36f8('0x19')](_0x36f8('0x48'),_0x116a18[_0x142ec2][_0x3925c7][_0x36f8('0x3')]));break;case 0x9:if(_0x206075[_0x36f8('0x6')]!=='agent')_0x3917f1[_0x52b5ac](util[_0x36f8('0x19')]('campaign:%s:%s',_0x116a18[_0x142ec2][_0x3925c7]['type'],_0x116a18[_0x142ec2][_0x3925c7]['name']));break;case 0xa:_0x3917f1[_0x52b5ac](util[_0x36f8('0x19')](_0x36f8('0x1b'),_0x116a18[_0x142ec2][_0x3925c7][_0x36f8('0x3')]));break;}}}}})[_0x36f8('0xc')](function(){if(_0x52b5ac===_0x36f8('0x49')){var _0x52ad3a=_['map'](_0x206075[_0x36f8('0x20')],'id');return _0x206075[_0x36f8('0x4a')](_0x52ad3a)[_0x36f8('0xc')](function(){for(var _0x1af88d=0x0;_0x1af88d<_0x52ad3a['length'];_0x1af88d+=0x1){_0x362eae['emit'](_0x36f8('0x4b'),{'ChatInteractionId':Number(_0x52ad3a[_0x1af88d]),'UserId':Number(_0x206075['id'])});}});}})['then'](function(){if(_0x52b5ac===_0x36f8('0x49')){var _0x38aecc=_['map'](_0x206075[_0x36f8('0x22')],'id');return _0x206075['removeMailInteractions'](_0x38aecc)['then'](function(){for(var _0x34a2f5=0x0;_0x34a2f5<_0x38aecc['length'];_0x34a2f5+=0x1){_0x362eae[_0x36f8('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x38aecc[_0x34a2f5]),'UserId':Number(_0x206075['id'])});}});}})[_0x36f8('0xc')](function(){if(_0x52b5ac===_0x36f8('0x49')){var _0x2c0e9b=_['map'](_0x206075[_0x36f8('0x24')],'id');return _0x206075[_0x36f8('0x4d')](_0x2c0e9b)[_0x36f8('0xc')](function(){for(var _0x5eeb0e=0x0;_0x5eeb0e<_0x2c0e9b[_0x36f8('0x41')];_0x5eeb0e+=0x1){_0x362eae['emit'](_0x36f8('0x4e'),{'FaxInteractionId':Number(_0x2c0e9b[_0x5eeb0e]),'UserId':Number(_0x206075['id'])});}});}})[_0x36f8('0xc')](function(){if(_0x52b5ac===_0x36f8('0x49')){var _0x3e275a=_[_0x36f8('0x18')](_0x206075[_0x36f8('0x26')],'id');return _0x206075[_0x36f8('0x4f')](_0x3e275a)[_0x36f8('0xc')](function(){for(var _0x272d66=0x0;_0x272d66<_0x3e275a[_0x36f8('0x41')];_0x272d66+=0x1){_0x362eae[_0x36f8('0x4c')](_0x36f8('0x50'),{'SmsInteractionId':Number(_0x3e275a[_0x272d66]),'UserId':Number(_0x206075['id'])});}});}})[_0x36f8('0xc')](function(){if(_0x52b5ac===_0x36f8('0x49')){var _0x97feac=_[_0x36f8('0x18')](_0x206075['OpenchannelInteractions'],'id');return _0x206075[_0x36f8('0x51')](_0x97feac)['then'](function(){for(var _0x505e4=0x0;_0x505e4<_0x97feac[_0x36f8('0x41')];_0x505e4+=0x1){_0x362eae[_0x36f8('0x4c')](_0x36f8('0x52'),{'OpenchannelInteractionId':Number(_0x97feac[_0x505e4]),'UserId':Number(_0x206075['id'])});}});}})[_0x36f8('0xc')](function(){if(_0x52b5ac===_0x36f8('0x49')){var _0x65b81c=_[_0x36f8('0x18')](_0x206075[_0x36f8('0x29')],'id');return _0x206075[_0x36f8('0x53')](_0x65b81c)['then'](function(){for(var _0x40bcb7=0x0;_0x40bcb7<_0x65b81c[_0x36f8('0x41')];_0x40bcb7+=0x1){_0x362eae[_0x36f8('0x4c')](_0x36f8('0x54'),{'WhatsappInteractionId':Number(_0x65b81c[_0x40bcb7]),'UserId':Number(_0x206075['id'])});}});}})[_0x36f8('0x55')](function(_0x122ef3){_0x3917f1[_0x36f8('0x56')](_0x122ef3);});}}function onDisconnect(_0x16cc7a,_0x5d3edd){joinOrLeave(_0x16cc7a,_0x36f8('0x49'),_0x5d3edd);}function onConnect(_0x10ca57){joinOrLeave(_0x10ca57,'join');}exports[_0x36f8('0x57')]=function(_0x1c8713){_0x1c8713['on'](_0x36f8('0x58'),function(_0x3fe1e2){_0x3fe1e2[_0x36f8('0x59')](0x0);_0x3fe1e2[_0x36f8('0x5a')]=_0x3fe1e2[_0x36f8('0x5b')][_0x36f8('0x58')][_0x36f8('0x5c')]+':'+_0x3fe1e2['request'][_0x36f8('0x58')]['remotePort'];_0x3fe1e2[_0x36f8('0x5d')]=new Date();_0x3fe1e2[_0x36f8('0x56')]=function(_0x947aae){console[_0x36f8('0x56')](_0x36f8('0x5e')+_0x3fe1e2['nsp']['name']+'['+_0x3fe1e2['address']+']',_0x947aae);};_0x3fe1e2['on'](_0x36f8('0x5f'),function(){onDisconnect(_0x3fe1e2,_0x1c8713);_0x3fe1e2['log'](_0x36f8('0x60'));});onConnect(_0x3fe1e2);_0x3fe1e2[_0x36f8('0x56')]('CONNECTED');});}; \ No newline at end of file +var _0x3fce=['then','where','role','ivr','%s:queue:%s','format','user:%s','handshake','query','find','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','FaxQueues','FaxQueue','Trunks','Campaign','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','length','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','telephone','agent','type','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource'];(function(_0xe92833,_0x514fc7){var _0x69b9a0=function(_0x2b0068){while(--_0x2b0068){_0xe92833['push'](_0xe92833['shift']());}};_0x69b9a0(++_0x514fc7);}(_0x3fce,0x121));var _0xe3fc=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x3fce[_0x3efe87];return _0x56a4cc;};'use strict';var _=require('lodash');var util=require(_0xe3fc('0x0'));var BPromise=require(_0xe3fc('0x1'));var db=require(_0xe3fc('0x2'))['db'];var config=require(_0xe3fc('0x3'));var queryQueues={'attributes':['id',_0xe3fc('0x4')],'include':[{'as':_0xe3fc('0x5'),'model':db[_0xe3fc('0x6')],'attributes':['id','name','role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe3fc('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe3fc('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe3fc('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xe3fc('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0xeada2b,_0x43ec3c,_0x1bb7be){return db[_0xe3fc('0xa')][_0xe3fc('0xb')]({'where':{'name':_0xeada2b,'userProfileId':_0x43ec3c},'raw':!![]})['then'](function(_0x52b9ee){if(_0x52b9ee){if(_0x52b9ee[_0xe3fc('0xc')]){switch(_0xeada2b){case _0xe3fc('0xd'):case _0xe3fc('0xe'):case'FaxQueues':case _0xe3fc('0xf'):case _0xe3fc('0x10'):case _0xe3fc('0x11'):case _0xe3fc('0x12'):return db[_0x1bb7be][_0xe3fc('0x13')](queryQueues);case _0xe3fc('0x14'):return db[_0x1bb7be][_0xe3fc('0x13')](queryTelephones);case'Trunks':return db[_0x1bb7be][_0xe3fc('0x13')](queryTrunks);case _0xe3fc('0x15'):return db[_0x1bb7be]['findAll'](queryCampaigns);}}else{return db[_0xe3fc('0x16')][_0xe3fc('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x52b9ee['id']},'raw':!![]})[_0xe3fc('0x17')](function(_0x25852e){if(_0x25852e){var _0x4b6256={'where':{'id':_['map'](_0x25852e,'resourceId')},'raw':!![]};switch(_0x1bb7be){case _0xe3fc('0x6'):_0x4b6256[_0xe3fc('0x18')][_0xe3fc('0x19')]='telephone';break;case'Campaign':_0x4b6256[_0xe3fc('0x18')]['type']=_0xe3fc('0x1a');break;}return db[_0x1bb7be][_0xe3fc('0x13')](_0x4b6256);}else{return[];}});}}else{return[];}})[_0xe3fc('0x17')](function(_0x51c7f2){return _0x51c7f2;});}function joinOrLeaveQueues(_0x57a0f4,_0x42140f,_0x107abb,_0x16b914){_0x57a0f4[_0x42140f](util['format'](_0xe3fc('0x1b'),_0x107abb,_0x16b914[_0xe3fc('0x4')]));if(_0x16b914['Agents']){for(var _0x457bb1=0x0;_0x457bb1<_0x16b914[_0xe3fc('0x5')]['length'];_0x457bb1+=0x1){_0x57a0f4[_0x42140f](util[_0xe3fc('0x1c')](_0xe3fc('0x1d'),_0x16b914[_0xe3fc('0x5')][_0x457bb1]['name']));}}}function joinOrLeave(_0x4ac172,_0x2194f8,_0x4f4134){var _0x55ea5e;if(_0x4ac172[_0xe3fc('0x1e')][_0xe3fc('0x1f')]['id']){db[_0xe3fc('0x6')][_0xe3fc('0x20')]({'attributes':['id','name',_0xe3fc('0x19'),'userProfileId'],'where':{'id':_0x4ac172['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe3fc('0x21')],'as':_0xe3fc('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xe3fc('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xe3fc('0x24')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe3fc('0x25')],'as':_0xe3fc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe3fc('0x27')],'as':_0xe3fc('0x28'),'attributes':['id'],'raw':!![]}]})[_0xe3fc('0x17')](function(_0x21ccdd){if(_0x21ccdd){_0x55ea5e=_0x21ccdd;_0x4ac172[_0x2194f8](util[_0xe3fc('0x1c')](_0xe3fc('0x1d'),_0x21ccdd[_0xe3fc('0x4')]));var _0xbb0f17=[];switch(_0x21ccdd[_0xe3fc('0x19')]){case _0xe3fc('0x29'):_0x4ac172[_0x2194f8](_0xe3fc('0x2a'));_0x4ac172[_0x2194f8](_0xe3fc('0x2b'));if(queryQueues[_0xe3fc('0x2c')](_0xe3fc('0x2d'))){delete queryQueues['include'];}_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x2f')][_0xe3fc('0x13')](queryQueues));_0xbb0f17['push'](db[_0xe3fc('0x30')][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db['FaxQueue'][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x31')][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x32')]['findAll'](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x33')][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x34')][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x6')][_0xe3fc('0x13')](queryTelephones));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x35')][_0xe3fc('0x13')](queryTrunks));_0xbb0f17[_0xe3fc('0x2e')](db['Campaign']['findAll'](queryCampaigns));_0xbb0f17['push'](db[_0xe3fc('0x6')][_0xe3fc('0x13')](queryAgents));break;case _0xe3fc('0x36'):_0x4ac172[_0x2194f8](_0xe3fc('0x2a'));_0x4ac172[_0x2194f8](_0xe3fc('0x2b'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0xd'),_0x21ccdd[_0xe3fc('0x37')],'VoiceQueue'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0xe'),_0x21ccdd['userProfileId'],_0xe3fc('0x30')));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x38'),_0x21ccdd[_0xe3fc('0x37')],_0xe3fc('0x39')));_0xbb0f17['push'](getAssociatedResources(_0xe3fc('0xf'),_0x21ccdd['userProfileId'],'SmsQueue'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x10'),_0x21ccdd['userProfileId'],_0xe3fc('0x32')));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x11'),_0x21ccdd[_0xe3fc('0x37')],_0xe3fc('0x33')));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources('WhatsappQueues',_0x21ccdd[_0xe3fc('0x37')],_0xe3fc('0x34')));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x14'),_0x21ccdd[_0xe3fc('0x37')],'User'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x3a'),_0x21ccdd[_0xe3fc('0x37')],'Trunk'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources('IvrCampaigns',_0x21ccdd[_0xe3fc('0x37')],_0xe3fc('0x3b')));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x6')][_0xe3fc('0x13')](queryAgents));break;case'agent':_0x4ac172[_0x2194f8](_0xe3fc('0x2a'));_0x4ac172[_0x2194f8](_0xe3fc('0x2b'));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd[_0xe3fc('0x3c')]({'attributes':['id',_0xe3fc('0x4')]}));_0xbb0f17['push'](_0x21ccdd[_0xe3fc('0x3d')]({'attributes':['id','name']}));_0xbb0f17['push'](_0x21ccdd['getFaxQueues']({'attributes':['id',_0xe3fc('0x4')]}));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd[_0xe3fc('0x3e')]({'attributes':['id',_0xe3fc('0x4')]}));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd[_0xe3fc('0x3f')]({'attributes':['id','name']}));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd['getOpenchannelQueues']({'attributes':['id',_0xe3fc('0x4')]}));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd[_0xe3fc('0x40')]({'attributes':['id',_0xe3fc('0x4')]}));break;}return BPromise['all'](_0xbb0f17);}})[_0xe3fc('0x17')](function(_0x72f328){if(_0x72f328&&_0x72f328[_0xe3fc('0x41')]){for(var _0x331fd4=0x0;_0x331fd4<_0x72f328[_0xe3fc('0x41')];_0x331fd4+=0x1){for(var _0x20459f=0x0;_0x20459f<_0x72f328[_0x331fd4]['length'];_0x20459f+=0x1){switch(_0x331fd4){case 0x0:joinOrLeaveQueues(_0x4ac172,_0x2194f8,'voice',_0x72f328[_0x331fd4][_0x20459f]);break;case 0x1:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x42'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x2:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x43'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x3:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x44'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x4:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x45'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x5:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x46'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x6:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x47'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x7:if(_0x55ea5e['role']!==_0xe3fc('0x8'))_0x4ac172[_0x2194f8](util['format'](_0xe3fc('0x48'),_0x72f328[_0x331fd4][_0x20459f]['name']));break;case 0x8:if(_0x55ea5e['role']!=='agent')_0x4ac172[_0x2194f8](util[_0xe3fc('0x1c')](_0xe3fc('0x49'),_0x72f328[_0x331fd4][_0x20459f]['name']));break;case 0x9:if(_0x55ea5e[_0xe3fc('0x19')]!=='agent')_0x4ac172[_0x2194f8](util[_0xe3fc('0x1c')](_0xe3fc('0x4a'),_0x72f328[_0x331fd4][_0x20459f][_0xe3fc('0x9')],_0x72f328[_0x331fd4][_0x20459f][_0xe3fc('0x4')]));break;case 0xa:_0x4ac172[_0x2194f8](util[_0xe3fc('0x1c')](_0xe3fc('0x1d'),_0x72f328[_0x331fd4][_0x20459f]['name']));break;}}}}})['then'](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x1ca515=_[_0xe3fc('0x4c')](_0x55ea5e[_0xe3fc('0x4d')],'id');return _0x55ea5e[_0xe3fc('0x4e')](_0x1ca515)[_0xe3fc('0x17')](function(){for(var _0x305506=0x0;_0x305506<_0x1ca515['length'];_0x305506+=0x1){_0x4f4134[_0xe3fc('0x4f')](_0xe3fc('0x50'),{'ChatInteractionId':Number(_0x1ca515[_0x305506]),'UserId':Number(_0x55ea5e['id'])});}});}})[_0xe3fc('0x17')](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x5bcd1c=_['map'](_0x55ea5e['MailInteractions'],'id');return _0x55ea5e[_0xe3fc('0x51')](_0x5bcd1c)[_0xe3fc('0x17')](function(){for(var _0x2321fd=0x0;_0x2321fd<_0x5bcd1c[_0xe3fc('0x41')];_0x2321fd+=0x1){_0x4f4134[_0xe3fc('0x4f')](_0xe3fc('0x52'),{'MailInteractionId':Number(_0x5bcd1c[_0x2321fd]),'UserId':Number(_0x55ea5e['id'])});}});}})[_0xe3fc('0x17')](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x189ae9=_[_0xe3fc('0x4c')](_0x55ea5e[_0xe3fc('0x23')],'id');return _0x55ea5e[_0xe3fc('0x53')](_0x189ae9)[_0xe3fc('0x17')](function(){for(var _0x5c7d4a=0x0;_0x5c7d4a<_0x189ae9['length'];_0x5c7d4a+=0x1){_0x4f4134['emit'](_0xe3fc('0x54'),{'FaxInteractionId':Number(_0x189ae9[_0x5c7d4a]),'UserId':Number(_0x55ea5e['id'])});}});}})[_0xe3fc('0x17')](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x4e5eb8=_['map'](_0x55ea5e[_0xe3fc('0x55')],'id');return _0x55ea5e[_0xe3fc('0x56')](_0x4e5eb8)[_0xe3fc('0x17')](function(){for(var _0x47be07=0x0;_0x47be07<_0x4e5eb8['length'];_0x47be07+=0x1){_0x4f4134['emit'](_0xe3fc('0x57'),{'SmsInteractionId':Number(_0x4e5eb8[_0x47be07]),'UserId':Number(_0x55ea5e['id'])});}});}})['then'](function(){if(_0x2194f8==='leave'){var _0x3020fb=_['map'](_0x55ea5e['OpenchannelInteractions'],'id');return _0x55ea5e['removeOpenchannelInteractions'](_0x3020fb)[_0xe3fc('0x17')](function(){for(var _0x7c7c99=0x0;_0x7c7c99<_0x3020fb[_0xe3fc('0x41')];_0x7c7c99+=0x1){_0x4f4134[_0xe3fc('0x4f')](_0xe3fc('0x58'),{'OpenchannelInteractionId':Number(_0x3020fb[_0x7c7c99]),'UserId':Number(_0x55ea5e['id'])});}});}})['then'](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x34585a=_['map'](_0x55ea5e[_0xe3fc('0x28')],'id');return _0x55ea5e[_0xe3fc('0x59')](_0x34585a)[_0xe3fc('0x17')](function(){for(var _0x474550=0x0;_0x474550<_0x34585a[_0xe3fc('0x41')];_0x474550+=0x1){_0x4f4134[_0xe3fc('0x4f')](_0xe3fc('0x5a'),{'WhatsappInteractionId':Number(_0x34585a[_0x474550]),'UserId':Number(_0x55ea5e['id'])});}});}})[_0xe3fc('0x5b')](function(_0x3dbf21){_0x4ac172[_0xe3fc('0x5c')](_0x3dbf21);});}}function onDisconnect(_0x8d1312,_0xd08412){joinOrLeave(_0x8d1312,_0xe3fc('0x4b'),_0xd08412);}function onConnect(_0x25f7bb){joinOrLeave(_0x25f7bb,_0xe3fc('0x5d'));}exports[_0xe3fc('0x5e')]=function(_0x460c7b){_0x460c7b['on'](_0xe3fc('0x5f'),function(_0x216dd3){_0x216dd3['setMaxListeners'](0x0);_0x216dd3[_0xe3fc('0x60')]=_0x216dd3[_0xe3fc('0x61')][_0xe3fc('0x5f')]['remoteAddress']+':'+_0x216dd3[_0xe3fc('0x61')]['connection'][_0xe3fc('0x62')];_0x216dd3['connectedAt']=new Date();_0x216dd3['log']=function(_0x45f3b7){console[_0xe3fc('0x5c')](_0xe3fc('0x63')+_0x216dd3[_0xe3fc('0x64')]['name']+'['+_0x216dd3[_0xe3fc('0x60')]+']',_0x45f3b7);};_0x216dd3['on'](_0xe3fc('0x65'),function(){onDisconnect(_0x216dd3,_0x460c7b);_0x216dd3[_0xe3fc('0x5c')](_0xe3fc('0x66'));});onConnect(_0x216dd3);_0x216dd3[_0xe3fc('0x5c')](_0xe3fc('0x67'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 5b45b67..a33dc35 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 _0x07a0=['newmessage','ChatOfflineMessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','error','code','get','direction','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','SIP/%s','agent','channel','incomingmessage','outgoingmessage','catch','AfterCreateMessage','motionChannel','event','offlineMessage','opened','undefined','format','Trigger,\x20%s','AfterCreate','changed','closed','substatus','AfterUpdate','User','name','fullname','email','internal','default','length','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07a0,0x8e));var _0x007a=function(_0x33367b,_0x5bd4ae){_0x33367b=_0x33367b-0x0;var _0x1a7f42=_0x07a0[_0x33367b];return _0x1a7f42;};'use strict';var util=require(_0x007a('0x0'));var db=require(_0x007a('0x1'))['db'];var jayson=require(_0x007a('0x2'));var logger=require(_0x007a('0x3'))(_0x007a('0x4'));var client=jayson[_0x007a('0x5')][_0x007a('0x6')]({'port':0x232a});var triggers=[{'channel':_0x007a('0x7'),'model':'ChatInteraction','event':_0x007a('0x8'),'condition':_0x007a('0x9'),'callback':afterCreate},{'channel':_0x007a('0x7'),'model':_0x007a('0xa'),'event':_0x007a('0xb'),'condition':_0x007a('0xc'),'callback':afterUpdate},{'channel':_0x007a('0x7'),'model':_0x007a('0xd'),'event':_0x007a('0x8'),'condition':_0x007a('0xe'),'callback':afterCreateMessage},{'channel':_0x007a('0x7'),'model':_0x007a('0xf'),'event':'afterCreate','condition':_0x007a('0xe'),'callback':afterCreateOfflineMessage},{'channel':_0x007a('0x10'),'model':_0x007a('0x11'),'event':_0x007a('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x007a('0x10'),'model':_0x007a('0x11'),'event':'afterUpdate','condition':_0x007a('0xc'),'callback':afterUpdate},{'channel':_0x007a('0x10'),'model':'SmsMessage','event':_0x007a('0x8'),'condition':_0x007a('0xe'),'callback':afterCreateMessage},{'channel':_0x007a('0x12'),'model':_0x007a('0x13'),'event':'afterCreate','condition':_0x007a('0x9'),'callback':afterCreate},{'channel':_0x007a('0x12'),'model':_0x007a('0x13'),'event':_0x007a('0xb'),'condition':_0x007a('0xc'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x007a('0x14'),'event':'afterCreate','condition':_0x007a('0xe'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x007a('0x15'),'event':_0x007a('0x8'),'condition':_0x007a('0x9'),'callback':afterCreate},{'channel':_0x007a('0x16'),'model':_0x007a('0x15'),'event':_0x007a('0xb'),'condition':_0x007a('0xc'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x007a('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x007a('0x17'),'model':_0x007a('0x18'),'event':_0x007a('0x8'),'condition':_0x007a('0x9'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0x007a('0xb'),'condition':_0x007a('0xc'),'callback':afterUpdate},{'channel':_0x007a('0x17'),'model':_0x007a('0x19'),'event':_0x007a('0x8'),'condition':_0x007a('0xe'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x007a('0x1a'),'event':'afterCreate','condition':_0x007a('0x9'),'callback':afterCreate},{'channel':_0x007a('0x1b'),'model':_0x007a('0x1a'),'event':'afterUpdate','condition':_0x007a('0xc'),'callback':afterUpdate},{'channel':_0x007a('0x1b'),'model':_0x007a('0x1c'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x19c377){return client[_0x007a('0x1d')](_0x007a('0x1e'),_0x19c377)[_0x007a('0x1f')](function(_0x1f3e37){logger['info']('Trigger,\x20%s','EventManager',_0x1f3e37);if(_0x1f3e37['error']){if(_0x1f3e37[_0x007a('0x20')][_0x007a('0x21')]===0x1f4){logger[_0x007a('0x20')]('Trigger,\x20%s','EventManager',_0x1f3e37[_0x007a('0x20')]);}}})['catch'](function(_0x2601b7){logger['error']('Trigger,\x20%s',_0x007a('0x1e'),_0x2601b7);});}function afterCreateMessage(_0x20abce){return function(_0x5a22b6){_0x5a22b6=_0x5a22b6[_0x007a('0x22')]({'plain':!![]});_0x5a22b6['channel']=_0x20abce;_0x5a22b6['motionChannel']=_0x20abce;_0x5a22b6['event']=_0x5a22b6[_0x007a('0x23')];Promise[_0x007a('0x24')]()[_0x007a('0x1f')](function(){if(typeof _0x5a22b6['ContactId']==='undefined')return null;var _0x4a3e6c=_0x007a('0x25')+_0x5a22b6[_0x007a('0x26')];return db[_0x007a('0x27')][_0x007a('0x28')](_0x4a3e6c,{'type':db[_0x007a('0x29')][_0x007a('0x2a')][_0x007a('0x2b')],'raw':!![]});})[_0x007a('0x1f')](function(_0x28aa97){if(_0x28aa97){_0x5a22b6[_0x007a('0x2c')]=_0x28aa97[0x0];}if(typeof _0x5a22b6[_0x007a('0x2d')]==='undefined')return;return getAgent(_0x5a22b6['UserId']);})[_0x007a('0x1f')](function(_0x1f6e5e){if(_0x1f6e5e){_0x5a22b6[_0x007a('0x2e')]=util['format'](_0x007a('0x2f'),_0x1f6e5e['name']);_0x5a22b6[_0x007a('0x30')]=_0x1f6e5e;_0x5a22b6[_0x007a('0x31')]=_0x20abce;return request({'event':_0x007a('0x32'),'message':_0x5a22b6});}else{return request({'event':_0x007a('0x33'),'message':_0x5a22b6});}})[_0x007a('0x34')](function(_0x51fb32){logger[_0x007a('0x20')]('Trigger,\x20%s',_0x007a('0x35'),_0x51fb32);});};}function afterCreateOfflineMessage(_0x235752){return function(_0x4d4c58){_0x4d4c58=_0x4d4c58[_0x007a('0x22')]({'plain':!![]});_0x4d4c58[_0x007a('0x31')]=_0x235752;_0x4d4c58[_0x007a('0x36')]=_0x235752;_0x4d4c58[_0x007a('0x37')]=_0x007a('0x38');return request({'event':_0x4d4c58[_0x007a('0x37')],'message':_0x4d4c58});};}function afterCreate(_0x52dab4,_0x4c315d){return function(_0x86ba15){_0x86ba15=_0x86ba15[_0x007a('0x22')]({'plain':!![]});_0x86ba15['channel']=_0x52dab4;_0x86ba15[_0x007a('0x36')]=_0x52dab4;_0x86ba15['event']=_0x007a('0x39');Promise[_0x007a('0x24')]()[_0x007a('0x1f')](function(){var _0x245b12='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x86ba15[_0x007a('0x26')];return db[_0x007a('0x27')]['query'](_0x245b12,{'type':db[_0x007a('0x29')][_0x007a('0x2a')][_0x007a('0x2b')],'raw':!![]});})[_0x007a('0x1f')](function(_0x1a5917){if(_0x1a5917){_0x86ba15[_0x007a('0x2c')]=_0x1a5917[0x0];}if(typeof _0x86ba15[_0x007a('0x2d')]===_0x007a('0x3a'))return;return getAgent(_0x86ba15[_0x007a('0x2d')]);})[_0x007a('0x1f')](function(_0x5552b0){if(_0x5552b0){_0x86ba15[_0x007a('0x2e')]=util[_0x007a('0x3b')](_0x007a('0x2f'),_0x5552b0['name']);_0x86ba15[_0x007a('0x30')]=_0x5552b0;}return request({'event':_0x4c315d,'message':_0x86ba15});})[_0x007a('0x34')](function(_0x2ceb3f){logger['error'](_0x007a('0x3c'),_0x007a('0x3d'),_0x2ceb3f);});};}function afterUpdate(_0x3ac5dd){return function(_0x4a08e4){var _0x37bd95=_0x4a08e4[_0x007a('0x3e')](_0x007a('0x3f'))&&_0x4a08e4['closed'];var _0x5ee893=_0x4a08e4['changed'](_0x007a('0x40'));if(_0x37bd95||_0x5ee893){var _0xba0e13=_0x37bd95?'closedinteraction':_0x007a('0x40');var _0x26db1e=_0x4a08e4[_0x007a('0x22')]({'plain':!![]});_0x26db1e[_0x007a('0x31')]=_0x3ac5dd;_0x26db1e['motionChannel']=_0x3ac5dd;_0x26db1e[_0x007a('0x37')]=_0x37bd95?_0x007a('0x3f'):_0x007a('0x40');var _0x474cb9=_0x007a('0x25')+_0x26db1e['ContactId'];return db['sequelize'][_0x007a('0x28')](_0x474cb9,{'type':db[_0x007a('0x29')][_0x007a('0x2a')][_0x007a('0x2b')],'raw':!![]})[_0x007a('0x1f')](function(_0x34f198){if(_0x34f198){_0x26db1e['contact']=_0x34f198[0x0];}if(typeof _0x26db1e['UserId']===_0x007a('0x3a'))return;return getAgent(_0x26db1e['UserId']);})[_0x007a('0x1f')](function(_0x2a1074){if(_0x2a1074){_0x26db1e[_0x007a('0x2e')]=util[_0x007a('0x3b')](_0x007a('0x2f'),_0x2a1074['name']);_0x26db1e[_0x007a('0x30')]=_0x2a1074;}return request({'event':_0xba0e13,'message':_0x26db1e});})[_0x007a('0x34')](function(_0x1d801f){logger[_0x007a('0x20')](_0x007a('0x3c'),_0x007a('0x41'),_0x1d801f);});}};}function getAgent(_0x2c717a){return db[_0x007a('0x42')]['find']({'where':{'id':_0x2c717a},'attributes':['id',_0x007a('0x43'),_0x007a('0x44'),_0x007a('0x45'),_0x007a('0x46')],'raw':!![]})[_0x007a('0x1f')](function(_0x426487){return _0x426487;});}exports[_0x007a('0x47')]=function(){for(var _0x3d54d0=0x0;_0x3d54d0=_0x424359[_0x4ede('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x6841d3(_0x3c6a03);})[_0x4ede('0x14')](function(_0x5eedb6){_0x206089(_0x5eedb6);});});}; \ No newline at end of file +var _0x7fcf=['voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','updateAttributes','getLicense','role','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb'];(function(_0x3510f5,_0x3661e1){var _0x492558=function(_0x2d1db1){while(--_0x2d1db1){_0x3510f5['push'](_0x3510f5['shift']());}};_0x492558(++_0x3661e1);}(_0x7fcf,0x87));var _0xf7fc=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x7fcf[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xf7fc('0x0'));var BPromise=require(_0xf7fc('0x1'));var db=require(_0xf7fc('0x2'))['db'];var util=require('./license/util');var channels=[_0xf7fc('0x3'),_0xf7fc('0x4'),_0xf7fc('0x5'),_0xf7fc('0x6'),_0xf7fc('0x7'),_0xf7fc('0x8'),_0xf7fc('0x9')];exports[_0xf7fc('0xa')]=function(){return channels;};exports[_0xf7fc('0xb')]=function(_0x89e0cb){_0x89e0cb=_0x89e0cb['toLowerCase']();return _[_0xf7fc('0xc')](channels,_0x89e0cb);};exports[_0xf7fc('0xd')]=function(_0x51909e,_0xb936af,_0x3da998,_0x485c91){var _0x1d0d98={'loginAttempts':_0xb936af,'blocked':_0x3da998};if(!_[_0xf7fc('0xe')](_0x485c91)){_0x1d0d98['blockedAt']=_0x485c91;}return _0x51909e[_0xf7fc('0xf')](_0x1d0d98);};exports[_0xf7fc('0x10')]=function(_0x33f604){return new BPromise(function(_0x5aa53f,_0x3917a0){var _0x3ea825=0x0;if(_0x33f604[_0xf7fc('0x11')]!=='agent'){_0x5aa53f(_0x33f604);}db[_0xf7fc('0x12')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x33f604['id']}}})[_0xf7fc('0x13')](function(_0x40906b){_0x3ea825=_0x40906b;return util[_0xf7fc('0x10')]();})[_0xf7fc('0x13')](function(_0x5d66cb){if(_0x5d66cb&&_0x5d66cb[_0xf7fc('0x14')]&&_0x3ea825>=_0x5d66cb[_0xf7fc('0x14')]){throw Error(_0xf7fc('0x15'));}_0x5aa53f(_0x33f604);})[_0xf7fc('0x16')](function(_0x4ebe33){_0x3917a0(_0x4ebe33);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 753cc21..a6c5682 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['exports','../config/logger','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','OutOfInterval','error','stack','send'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9bde,0xe1));var _0xe9bd=function(_0xf24cf7,_0x5639cc){_0xf24cf7=_0xf24cf7-0x0;var _0x37de35=_0x9bde[_0xf24cf7];return _0x37de35;};'use strict';var util=require('util');var logger=require(_0xe9bd('0x0'))('api');var APIError=function(_0xc79e0b,_0x4c63ca){this[_0xe9bd('0x1')]=_0xc79e0b||_0xe9bd('0x2');this[_0xe9bd('0x3')]=_0x4c63ca||_0xe9bd('0x4');util[_0xe9bd('0x5')](APIError,Error);};var APIBadRequestError=function(_0x1a4d14){this[_0xe9bd('0x1')]=_0x1a4d14||'Bad\x20Request';this[_0xe9bd('0x3')]=_0xe9bd('0x6');util[_0xe9bd('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xa66ae2){this[_0xe9bd('0x1')]=_0xa66ae2||_0xe9bd('0x7');this[_0xe9bd('0x3')]=_0xe9bd('0x8');util[_0xe9bd('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x45c7ba){switch(_0x45c7ba){case'Bad\x20Request':return 0x190;case'Forbidden',_0xe9bd('0x9'):return 0x193;case _0xe9bd('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x2601ac){return function(_0x581ab9){logger[_0xe9bd('0xa')](_0x581ab9[_0xe9bd('0xb')]);var _0x3339f9=getStatusCode(_0x581ab9[_0xe9bd('0x3')]);if(_0x581ab9['name'])delete _0x581ab9[_0xe9bd('0x3')];return _0x2601ac['status'](_0x3339f9)[_0xe9bd('0xc')](_0x581ab9);};}module[_0xe9bd('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xb688=['status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','Error','inherits','name','Entity\x20not\x20found','Not\x20Found','Bad\x20Request','Forbidden','OutOfInterval','error','stack'];(function(_0xee12a3,_0x4d2c79){var _0x41a6a2=function(_0x1dbf98){while(--_0x1dbf98){_0xee12a3['push'](_0xee12a3['shift']());}};_0x41a6a2(++_0x4d2c79);}(_0xb688,0xcf));var _0x8b68=function(_0xbd3d68,_0x3e470a){_0xbd3d68=_0xbd3d68-0x0;var _0x31bc93=_0xb688[_0xbd3d68];return _0x31bc93;};'use strict';var util=require('util');var logger=require(_0x8b68('0x0'))(_0x8b68('0x1'));var APIError=function(_0x266285,_0x1080e8){this[_0x8b68('0x2')]=_0x266285||_0x8b68('0x3');this['name']=_0x1080e8||_0x8b68('0x4');util[_0x8b68('0x5')](APIError,Error);};var APIBadRequestError=function(_0x30f33d){this[_0x8b68('0x2')]=_0x30f33d||'Bad\x20Request';this[_0x8b68('0x6')]='Bad\x20Request';util[_0x8b68('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x2bbffd){this[_0x8b68('0x2')]=_0x2bbffd||_0x8b68('0x7');this[_0x8b68('0x6')]=_0x8b68('0x8');util[_0x8b68('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x21d944){switch(_0x21d944){case _0x8b68('0x9'):return 0x190;case _0x8b68('0xa'),_0x8b68('0xb'):return 0x193;case _0x8b68('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x2a852a){return function(_0x502727){logger[_0x8b68('0xc')](_0x502727[_0x8b68('0xd')]);var _0x5e76c=getStatusCode(_0x502727[_0x8b68('0x6')]);if(_0x502727[_0x8b68('0x6')])delete _0x502727[_0x8b68('0x6')];return _0x2a852a[_0x8b68('0xe')](_0x5e76c)[_0x8b68('0xf')](_0x502727);};}module[_0x8b68('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 0a0227f..f7005f0 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x049e=['json','send','exports','status','render'];(function(_0x32f9e5,_0x429238){var _0x39d10b=function(_0x31e7ab){while(--_0x31e7ab){_0x32f9e5['push'](_0x32f9e5['shift']());}};_0x39d10b(++_0x429238);}(_0x049e,0x16a));var _0xe049=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x049e[_0x468b0f];return _0x3e74d9;};'use strict';module[_0xe049('0x0')][0x194]=function pageNotFound(_0x12806c,_0x5efb24){var _0x30ed85='404';var _0x155cb3=0x194;var _0x13cc6a={'status':_0x155cb3};_0x5efb24[_0xe049('0x1')](_0x13cc6a[_0xe049('0x1')]);_0x5efb24[_0xe049('0x2')](_0x30ed85,{},function(_0x50c6dc,_0x352aa6){if(_0x50c6dc){return _0x5efb24[_0xe049('0x1')](_0x13cc6a[_0xe049('0x1')])[_0xe049('0x3')](_0x13cc6a);}_0x5efb24[_0xe049('0x4')](_0x352aa6);});}; \ No newline at end of file +var _0xe495=['render','json','exports','status'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xe495,0xfe));var _0x5e49=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xe495[_0x42bdad];return _0x122626;};'use strict';module[_0x5e49('0x0')][0x194]=function pageNotFound(_0x4e0de7,_0x2f241b){var _0x35d3b0='404';var _0xdf0a7a=0x194;var _0x31ddfe={'status':_0xdf0a7a};_0x2f241b[_0x5e49('0x1')](_0x31ddfe['status']);_0x2f241b[_0x5e49('0x2')](_0x35d3b0,{},function(_0xb36bc1,_0x1a76d8){if(_0xb36bc1){return _0x2f241b[_0x5e49('0x1')](_0x31ddfe[_0x5e49('0x1')])[_0x5e49('0x3')](_0x31ddfe);}_0x2f241b['send'](_0x1a76d8);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5409856..04c470e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02a3=['../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueue','ChatQueues','FaxQueue','SmsQueue','SmsQueues','UserSmsQueue','OpenchannelQueue','UserOpenchannelQueue','WhatsappQueues','UserWhatsappQueue','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailServerIn','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','CannedAnswer','Answers','Messages','Interactions','List','ListId','TemplateId','Agents','Teams','MailInteractionId','Contact','Owner','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','IntervalId','TagId','Items','FaxAccountId','FaxInteraction','Exntensions','FaxApplication','FaxInteractionId','fax_interaction_has_tags','ThroughTags','UserFaxQueue','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','user_has_chat_websites','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Website','CompanyId','Phones','CmContactId','JscriptySessions','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','CmHopperBlack','All','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','ParentId','ChatApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','DescriptionId','Subject','Description','Field','FieldId','Variable','SugarcrmAccount','SugarcrmConfiguration','VariableId','DeskAccount','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','user_has_square_projects','team_has_mail_queues','MailQueues','FaxQueues','OpenchannelQueues','team_has_whatsapp_queues','TeamVoicePrefix','HopperBlacks','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToQueue','FromChatWebsiteId','FromAgent','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToAgent','ToFaxQueueId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','voice_queues_has_cm_lists','cm_user_has_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','lodash','jstz','determine','sequelize','xcall','127.0.0.1','name','utf8','sequelizeHistory','defaultsDeep','motion2','xC@LL1234','utf8mb4','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField'];(function(_0x3a25cc,_0x1c256d){var _0x27b28a=function(_0x2ee339){while(--_0x2ee339){_0x3a25cc['push'](_0x3a25cc['shift']());}};_0x27b28a(++_0x1c256d);}(_0x02a3,0x160));var _0x302a=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x02a3[_0x36884e];return _0x1cc367;};'use strict';var config=require(_0x302a('0x0'));var Sequelize=require('sequelize');var _=require(_0x302a('0x1'));var jstz=require(_0x302a('0x2'));var timezone=jstz[_0x302a('0x3')]();config[_0x302a('0x4')]=_['defaultsDeep'](config[_0x302a('0x4')],{'database':'motion2','username':_0x302a('0x5'),'password':'xC@LL1234','options':{'host':_0x302a('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x302a('0x7')](),'define':{'charset':_0x302a('0x8'),'collate':'utf8_general_ci'}}});config[_0x302a('0x9')]=_[_0x302a('0xa')](config['sequelizeHistory'],{'database':_0x302a('0xb'),'username':_0x302a('0x5'),'password':_0x302a('0xc'),'options':{'host':_0x302a('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x302a('0xd')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x302a('0x8'),'collate':_0x302a('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x302a('0xf')],config[_0x302a('0x4')][_0x302a('0x10')],config[_0x302a('0x4')][_0x302a('0x11')],config[_0x302a('0x4')][_0x302a('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x302a('0x9')][_0x302a('0xf')],config[_0x302a('0x9')][_0x302a('0x10')],config[_0x302a('0x9')][_0x302a('0x11')],config['sequelizeHistory'][_0x302a('0x12')])};db[_0x302a('0x13')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x15'));db[_0x302a('0x16')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x17'));db[_0x302a('0x18')]=db[_0x302a('0x4')]['import'](_0x302a('0x19'));db[_0x302a('0x1a')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0x302a('0x1b')]=db[_0x302a('0x4')]['import'](_0x302a('0x1c'));db[_0x302a('0x1d')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x1e'));db[_0x302a('0x1f')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x20'));db['ScreenRecording']=db[_0x302a('0x4')]['import']('../api/screenRecording/screenRecording.model');db[_0x302a('0x21')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x22'));db['VoiceMailMessage']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x23'));db[_0x302a('0x24')]=db[_0x302a('0x4')]['import'](_0x302a('0x25'));db[_0x302a('0x26')]=db[_0x302a('0x4')]['import'](_0x302a('0x27'));db[_0x302a('0x28')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x29'));db[_0x302a('0x2a')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x2b'));db[_0x302a('0x2c')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/memberReport/memberReport.model');db[_0x302a('0x2d')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x2e'));db[_0x302a('0x2f')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x30'));db[_0x302a('0x31')]=db[_0x302a('0x4')]['import'](_0x302a('0x32'));db[_0x302a('0x33')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x34'));db[_0x302a('0x35')]=db['sequelize'][_0x302a('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0x302a('0x36')]=db[_0x302a('0x4')]['import'](_0x302a('0x37'));db['UserFaxQueue']=db[_0x302a('0x4')]['import'](_0x302a('0x38'));db['UserSmsQueue']=db['sequelize'][_0x302a('0x14')](_0x302a('0x39'));db['UserOpenchannelQueue']=db['sequelize'][_0x302a('0x14')](_0x302a('0x3a'));db['UserWhatsappQueue']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x302a('0x3b')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x3c'));db[_0x302a('0x3d')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x3e'));db[_0x302a('0x3f')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x40'));db[_0x302a('0x41')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x42'));db[_0x302a('0x43')]=db[_0x302a('0x4')]['import'](_0x302a('0x44'));db[_0x302a('0x45')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x46'));db[_0x302a('0x47')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x48'));db[_0x302a('0x49')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x4a'));db[_0x302a('0x4b')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x4c'));db[_0x302a('0x4d')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x4e'));db[_0x302a('0x4f')]=db['sequelize']['import'](_0x302a('0x50'));db['FaxApplication']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0x302a('0x51')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x52'));db['FaxQueue']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/faxQueue/faxQueue.model');db[_0x302a('0x53')]=db['sequelize'][_0x302a('0x14')]('../api/faxQueueReport/faxQueueReport.model');db[_0x302a('0x54')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x55'));db[_0x302a('0x56')]=db[_0x302a('0x4')]['import'](_0x302a('0x57'));db[_0x302a('0x58')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x59'));db[_0x302a('0x5a')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x5b'));db['SmsQueue']=db[_0x302a('0x4')]['import'](_0x302a('0x5c'));db[_0x302a('0x5d')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/openchannelAccount/openchannelAccount.model');db[_0x302a('0x5e')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x5f'));db[_0x302a('0x60')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x61'));db[_0x302a('0x62')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db['sequelize'][_0x302a('0x14')](_0x302a('0x63'));db[_0x302a('0x64')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x65'));db['OpenchannelQueueReport']=db[_0x302a('0x4')]['import'](_0x302a('0x66'));db[_0x302a('0x67')]=db[_0x302a('0x4')]['import']('../api/chatApplication/chatApplication.model');db[_0x302a('0x68')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x69'));db[_0x302a('0x6a')]=db['sequelize'][_0x302a('0x14')]('../api/chatMessage/chatMessage.model');db[_0x302a('0x6b')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x6c'));db['ChatQueue']=db['sequelize']['import']('../api/chatQueue/chatQueue.model');db[_0x302a('0x6d')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x6e'));db['ChatProactiveAction']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x6f'));db[_0x302a('0x70')]=db[_0x302a('0x4')]['import'](_0x302a('0x71'));db[_0x302a('0x72')]=db[_0x302a('0x4')]['import']('../api/cmContact/cmContact.model');db[_0x302a('0x73')]=db['sequelize']['import'](_0x302a('0x74'));db['CmHopperBlack']=db[_0x302a('0x4')]['import'](_0x302a('0x75'));db[_0x302a('0x76')]=db[_0x302a('0x4')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x302a('0x77')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x78'));db[_0x302a('0x79')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x7a'));db[_0x302a('0x7b')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x7c'));db[_0x302a('0x7d')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x7e'));db[_0x302a('0x7f')]=db['sequelize'][_0x302a('0x14')]('../api/automation/automation.model');db['CannedAnswer']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0x302a('0x80')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x81'));db[_0x302a('0x82')]=db['sequelize'][_0x302a('0x14')]('../api/condition/condition.model');db[_0x302a('0x83')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x84'));db[_0x302a('0x85')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x86'));db[_0x302a('0x87')]=db[_0x302a('0x4')]['import'](_0x302a('0x88'));db[_0x302a('0x89')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x8a'));db[_0x302a('0x8b')]=db['sequelize']['import']('../api/schedule/schedule.model');db[_0x302a('0x8c')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/sound/sound.model');db[_0x302a('0x8d')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/tag/tag.model');db[_0x302a('0x8e')]=db[_0x302a('0x4')]['import'](_0x302a('0x8f'));db[_0x302a('0x90')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x91'));db[_0x302a('0x92')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x302a('0x93')]=db['sequelize'][_0x302a('0x14')]('../api/template/template.model');db[_0x302a('0x94')]=db['sequelize']['import'](_0x302a('0x95'));db['Variable']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x96'));db['Integration']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x97'));db[_0x302a('0x98')]=db['sequelize'][_0x302a('0x14')](_0x302a('0x99'));db['AnalyticCustomReport']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x9a'));db[_0x302a('0x9b')]=db['sequelize']['import'](_0x302a('0x9c'));db['AnalyticExtractedReport']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x9d'));db[_0x302a('0x9e')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x9f'));db['AnalyticFieldReport']=db[_0x302a('0x4')]['import'](_0x302a('0xa0'));db['AnalyticTreeReport']=db['sequelize'][_0x302a('0x14')](_0x302a('0xa1'));db[_0x302a('0xa2')]=db['sequelize'][_0x302a('0x14')](_0x302a('0xa3'));db[_0x302a('0xa4')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xa5'));db['SalesforceField']=db['sequelize'][_0x302a('0x14')](_0x302a('0xa6'));db['SugarcrmAccount']=db['sequelize'][_0x302a('0x14')](_0x302a('0xa7'));db['SugarcrmConfiguration']=db[_0x302a('0x4')]['import'](_0x302a('0xa8'));db[_0x302a('0xa9')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xaa'));db['DeskAccount']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db['sequelize']['import'](_0x302a('0xab'));db[_0x302a('0xac')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xad'));db[_0x302a('0xae')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xaf'));db[_0x302a('0xb0')]=db['sequelize'][_0x302a('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x302a('0x4')]['import'](_0x302a('0xb1'));db[_0x302a('0xb2')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xb3'));db[_0x302a('0xb4')]=db['sequelize'][_0x302a('0x14')](_0x302a('0xb5'));db[_0x302a('0xb6')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xb7'));db[_0x302a('0xb8')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xb9'));db[_0x302a('0xba')]=db['sequelize'][_0x302a('0x14')](_0x302a('0xbb'));db[_0x302a('0xbc')]=db['sequelize'][_0x302a('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x302a('0xbd')]=db['sequelize'][_0x302a('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x302a('0xbe')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x302a('0xbf')]=db[_0x302a('0x4')]['import'](_0x302a('0xc0'));db[_0x302a('0xc1')]=db['sequelize'][_0x302a('0x14')](_0x302a('0xc2'));db['ServicenowConfiguration']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x302a('0xc3')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0x302a('0xc4')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xc5'));db[_0x302a('0xc6')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xc7'));db['Dynamics365Field']=db['sequelize']['import'](_0x302a('0xc8'));db['FreshsalesAccount']=db[_0x302a('0x4')]['import'](_0x302a('0xc9'));db['FreshsalesConfiguration']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x302a('0xca')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xcb'));db[_0x302a('0xcc')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x97'));db[_0x302a('0xcd')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xce'));db[_0x302a('0xcf')]=db[_0x302a('0x4')]['import'](_0x302a('0xd0'));db['ChatInternalMessage']=db[_0x302a('0x4')]['import'](_0x302a('0xd1'));db[_0x302a('0xd2')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xd3'));db[_0x302a('0xd4')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x302a('0xd5')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x302a('0xd6')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xd7'));db[_0x302a('0xd8')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xd9'));db[_0x302a('0xda')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0x302a('0xdb')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xdc'));db[_0x302a('0xdd')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xde'));db[_0x302a('0xdf')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xe0'));db[_0x302a('0xe1')]=db['sequelize'][_0x302a('0x14')]('../api/squareProject/squareProject.model');db[_0x302a('0xe2')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xe3'));db['SquareMessage']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xe4'));db[_0x302a('0xe5')]=db[_0x302a('0x4')][_0x302a('0x14')]('../api/team/team.model');db['License']=db[_0x302a('0x4')]['import'](_0x302a('0xe6'));db[_0x302a('0xe7')]=db['sequelize'][_0x302a('0x14')](_0x302a('0xe8'));db[_0x302a('0xe9')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xea'));db[_0x302a('0xeb')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xec'));db[_0x302a('0xed')]=db[_0x302a('0x4')]['import'](_0x302a('0xee'));db['MailTransferReport']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xef'));db[_0x302a('0xf0')]=db['sequelize'][_0x302a('0x14')](_0x302a('0xf1'));db[_0x302a('0xf2')]=db['sequelize']['import'](_0x302a('0xf3'));db[_0x302a('0xf4')]=db['sequelize'][_0x302a('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xf5'));db[_0x302a('0xf6')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xf7'));db[_0x302a('0xf8')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xf9'));db['UserProfile']=db[_0x302a('0x4')]['import'](_0x302a('0xfa'));db[_0x302a('0xfb')]=db[_0x302a('0x4')]['import'](_0x302a('0xfc'));db[_0x302a('0xfd')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0xfe'));db[_0x302a('0xff')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x100'));db['WhatsappAccount']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x101'));db[_0x302a('0x102')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x103'));db[_0x302a('0x104')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x105'));db['WhatsappMessage']=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x106'));db[_0x302a('0x107')]=db[_0x302a('0x4')]['import'](_0x302a('0x108'));db['WhatsappTransferReport']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x302a('0x109')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x10a'));db['CloudProvider']=db['sequelize'][_0x302a('0x14')](_0x302a('0x10b'));db[_0x302a('0x10c')]=db['sequelize'][_0x302a('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x302a('0x4')][_0x302a('0x14')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x302a('0x10d')]=db[_0x302a('0x4')][_0x302a('0x14')](_0x302a('0x10e'));db[_0x302a('0x10f')]=db[_0x302a('0x4')]['import'](_0x302a('0x110'));db['User'][_0x302a('0x111')](db[_0x302a('0x21')],{'as':'VoiceMail','onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x13')][_0x302a('0x111')](db[_0x302a('0x10f')],{'as':_0x302a('0x114'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x13')][_0x302a('0x115')](db[_0x302a('0x1f')],{'as':_0x302a('0x116'),'foreignKey':'UserId'});db['User'][_0x302a('0x115')](db[_0x302a('0x31')],{'as':_0x302a('0x117'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x13')][_0x302a('0x115')](db[_0x302a('0x1a')],{'as':_0x302a('0x118'),'onDelete':_0x302a('0x112'),'hooks':!![]});db[_0x302a('0x13')]['hasMany'](db[_0x302a('0x76')],{'as':_0x302a('0x119'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x13')][_0x302a('0x115')](db[_0x302a('0x77')],{'as':_0x302a('0x11a'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x13')][_0x302a('0x115')](db[_0x302a('0x79')],{'as':_0x302a('0x79'),'foreignKey':'UserId'});db[_0x302a('0x13')][_0x302a('0x115')](db[_0x302a('0x60')],{'as':_0x302a('0x11b'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x13')][_0x302a('0x115')](db[_0x302a('0x68')],{'as':_0x302a('0x11c'),'foreignKey':'UserId'});db[_0x302a('0x13')][_0x302a('0x115')](db[_0x302a('0x58')],{'as':_0x302a('0x11d'),'foreignKey':_0x302a('0x113')});db['User'][_0x302a('0x115')](db['FaxInteraction'],{'as':_0x302a('0x11e'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x13')][_0x302a('0x115')](db[_0x302a('0x43')],{'as':_0x302a('0x11f'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x13')][_0x302a('0x115')](db[_0x302a('0x104')],{'as':_0x302a('0x120'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x13')][_0x302a('0x115')](db['UserNotification'],{'as':_0x302a('0x121'),'foreignKey':'SenderId'});db[_0x302a('0x13')][_0x302a('0x122')](db[_0x302a('0x123')],{'as':_0x302a('0x123'),'foreignKey':_0x302a('0x124')});db['User'][_0x302a('0x125')](db[_0x302a('0x6d')],{'as':_0x302a('0x126'),'through':_0x302a('0x127')});db['User'][_0x302a('0x125')](db['CmContact'],{'as':_0x302a('0x128'),'through':'cm_user_has_contacts'});db['User'][_0x302a('0x125')](db[_0x302a('0xf6')],{'as':_0x302a('0x129'),'through':'cm_user_has_lists'});db[_0x302a('0x13')][_0x302a('0x125')](db['Team'],{'through':_0x302a('0x12a')});db['User'][_0x302a('0x125')](db[_0x302a('0x43')],{'as':_0x302a('0x11f'),'through':_0x302a('0x12b')});db['User'][_0x302a('0x125')](db[_0x302a('0x68')],{'as':_0x302a('0x11c'),'through':'user_has_chat_interactions'});db[_0x302a('0x13')][_0x302a('0x125')](db['FaxInteraction'],{'as':_0x302a('0x11e'),'through':_0x302a('0x12c')});db['User']['belongsToMany'](db[_0x302a('0x58')],{'as':'SmsInteractions','through':_0x302a('0x12d')});db[_0x302a('0x13')][_0x302a('0x125')](db[_0x302a('0x60')],{'as':_0x302a('0x11b'),'through':'user_has_openchannel_interactions'});db[_0x302a('0x13')][_0x302a('0x125')](db[_0x302a('0x104')],{'as':_0x302a('0x120'),'through':_0x302a('0x12e')});db[_0x302a('0x13')][_0x302a('0x125')](db[_0x302a('0x1d')],{'as':_0x302a('0x12f'),'through':_0x302a('0x33'),'required':![]});db[_0x302a('0x13')][_0x302a('0x125')](db[_0x302a('0xf8')],{'as':_0x302a('0x130'),'through':_0x302a('0x10d'),'required':![]});db[_0x302a('0x13')][_0x302a('0x125')](db[_0x302a('0x3f')],{'as':'MailQueues','through':_0x302a('0x36'),'required':![]});db[_0x302a('0x13')][_0x302a('0x125')](db[_0x302a('0x131')],{'as':_0x302a('0x132'),'through':_0x302a('0x35'),'required':![],'hooks':!![]});db[_0x302a('0x13')][_0x302a('0x125')](db[_0x302a('0x133')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x302a('0x13')]['belongsToMany'](db[_0x302a('0x134')],{'as':_0x302a('0x135'),'through':_0x302a('0x136'),'required':![]});db['User'][_0x302a('0x125')](db[_0x302a('0x137')],{'as':'OpenchannelQueues','through':_0x302a('0x138'),'required':![]});db[_0x302a('0x13')][_0x302a('0x125')](db[_0x302a('0x109')],{'as':_0x302a('0x139'),'through':_0x302a('0x13a'),'required':![]});db['User'][_0x302a('0x125')](db[_0x302a('0xf6')],{'through':'cm_user_has_lists'});db[_0x302a('0x13')]['belongsToMany'](db['ChatWebsite'],{'as':_0x302a('0x13b'),'through':'user_has_chat_websites'});db['User']['belongsToMany'](db[_0x302a('0x4f')],{'as':_0x302a('0x13c'),'through':_0x302a('0x13d')});db[_0x302a('0x13')][_0x302a('0x125')](db[_0x302a('0x3d')],{'as':_0x302a('0x13e'),'through':_0x302a('0x13f')});db['User'][_0x302a('0x125')](db['OpenchannelAccount'],{'as':_0x302a('0x140'),'through':_0x302a('0x141')});db[_0x302a('0x13')]['belongsToMany'](db[_0x302a('0x54')],{'as':'SmsAccounts','through':_0x302a('0x142')});db['User'][_0x302a('0x125')](db[_0x302a('0x143')],{'as':_0x302a('0x144'),'through':_0x302a('0x145')});db[_0x302a('0x13')][_0x302a('0x125')](db['SquareProject'],{'as':_0x302a('0x146'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0x302a('0x115')](db[_0x302a('0x1a')],{'as':_0x302a('0x147'),'onDelete':'cascade','foreignKey':_0x302a('0x148')});db['VoiceContext']['hasMany'](db[_0x302a('0x1a')],{'onDelete':_0x302a('0x112')});db[_0x302a('0x1a')][_0x302a('0x115')](db[_0x302a('0x1a')],{'as':_0x302a('0x149'),'onDelete':'cascade'});db['VoiceMusicOnHold']['belongsToMany'](db[_0x302a('0x8c')],{'as':_0x302a('0x14a'),'through':_0x302a('0x14b')});db[_0x302a('0x1d')][_0x302a('0x115')](db[_0x302a('0x31')],{'as':_0x302a('0x14c'),'foreignKey':_0x302a('0x14d')});db[_0x302a('0x1d')]['hasMany'](db[_0x302a('0x73')],{'as':_0x302a('0x14e'),'foreignKey':'VoiceQueueId'});db[_0x302a('0x1d')][_0x302a('0x115')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x302a('0x14d')});db[_0x302a('0x1d')][_0x302a('0x115')](db[_0x302a('0x77')],{'as':_0x302a('0x14f'),'foreignKey':_0x302a('0x14d')});db['VoiceQueue'][_0x302a('0x115')](db['ReportAgentPreview'],{'as':_0x302a('0x79'),'foreignKey':_0x302a('0x14d')});db[_0x302a('0x1d')]['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x302a('0x14d')});db[_0x302a('0x1d')][_0x302a('0x115')](db[_0x302a('0xd5')],{'as':'JscriptySessions','foreignKey':_0x302a('0x14d')});db[_0x302a('0x1d')][_0x302a('0x122')](db[_0x302a('0x2d')],{'as':_0x302a('0x2d'),'foreignKey':_0x302a('0x150')});db[_0x302a('0x1d')][_0x302a('0x122')](db['Trunk'],{'as':_0x302a('0x151'),'foreignKey':_0x302a('0x152')});db[_0x302a('0x1d')]['belongsTo'](db[_0x302a('0x83')],{'as':_0x302a('0x83'),'foreignKey':'IntervalId'});db[_0x302a('0x1d')]['belongsTo'](db[_0x302a('0x85')],{'as':_0x302a('0x153'),'foreignKey':_0x302a('0x154')});db[_0x302a('0x1d')][_0x302a('0x125')](db[_0x302a('0xf6')],{'as':_0x302a('0x129'),'through':'voice_queues_has_cm_lists'});db[_0x302a('0x1d')][_0x302a('0x125')](db['User'],{'as':'Agents','through':_0x302a('0x33')});db[_0x302a('0x1d')][_0x302a('0x125')](db[_0x302a('0xe5')],{'as':'Teams','through':_0x302a('0x10c')});db[_0x302a('0x1d')][_0x302a('0x125')](db[_0x302a('0xf6')],{'as':'BlackLists','through':_0x302a('0x155')});db[_0x302a('0x1f')][_0x302a('0x122')](db[_0x302a('0x13')],{'as':_0x302a('0x13'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x156')][_0x302a('0x122')](db['User'],{'as':_0x302a('0x13'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x21')][_0x302a('0x115')](db[_0x302a('0x157')],{'as':'Messages','onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x158'),'sourceKey':_0x302a('0x159')});db['VoiceMailMessage'][_0x302a('0x122')](db['VoiceMail'],{'foreignKey':_0x302a('0x158'),'targetKey':_0x302a('0x159')});db['VoiceCallReport'][_0x302a('0x115')](db[_0x302a('0x2a')],{'as':_0x302a('0x15a'),'foreignKey':_0x302a('0x15b'),'constraints':![]});db[_0x302a('0x24')][_0x302a('0x115')](db[_0x302a('0x28')],{'as':_0x302a('0x15c'),'foreignKey':'uniqueid','constraints':![]});db[_0x302a('0x24')][_0x302a('0x122')](db[_0x302a('0x13')],{'as':'User','foreignKey':_0x302a('0x113')});db[_0x302a('0x24')][_0x302a('0x122')](db[_0x302a('0x72')],{'as':'Contact','foreignKey':_0x302a('0x15d')});db[_0x302a('0x15e')][_0x302a('0x122')](db[_0x302a('0x3d')],{'as':_0x302a('0x3d'),'foreignKey':_0x302a('0x15f')});db[_0x302a('0x15e')][_0x302a('0x122')](db[_0x302a('0x160')],{'as':_0x302a('0x160'),'foreignKey':_0x302a('0x161'),'onDelete':_0x302a('0x162')});db[_0x302a('0x3b')][_0x302a('0x122')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x302a('0x3b')]['belongsTo'](db[_0x302a('0x160')],{'as':_0x302a('0x160'),'foreignKey':_0x302a('0x161'),'onDelete':_0x302a('0x162')});db[_0x302a('0x3d')][_0x302a('0x111')](db[_0x302a('0x15e')],{'as':_0x302a('0x163'),'onDelete':'cascade'});db[_0x302a('0x3d')][_0x302a('0x111')](db['MailServerOut'],{'as':_0x302a('0x164'),'onDelete':_0x302a('0x112')});db[_0x302a('0x3d')][_0x302a('0x115')](db['Disposition'],{'as':_0x302a('0x165'),'foreignKey':_0x302a('0x15f'),'onDelete':_0x302a('0x112')});db[_0x302a('0x3d')][_0x302a('0x115')](db[_0x302a('0x166')],{'as':_0x302a('0x167'),'foreignKey':'MailAccountId'});db[_0x302a('0x3d')]['hasMany'](db['MailMessage'],{'as':_0x302a('0x168'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x302a('0x115')](db['MailInteraction'],{'as':_0x302a('0x169')});db[_0x302a('0x3d')]['hasMany'](db[_0x302a('0x47')],{'as':'Applications'});db['MailAccount']['belongsTo'](db['CmList'],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0x3d')]['belongsTo'](db['Template'],{'as':'Template','foreignKey':_0x302a('0x16c')});db[_0x302a('0x3d')]['belongsTo'](db[_0x302a('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x302a('0x154')});db[_0x302a('0x3d')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':_0x302a('0x13f')});db[_0x302a('0x3f')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':'Agents','through':_0x302a('0x36')});db[_0x302a('0x3f')][_0x302a('0x125')](db[_0x302a('0xe5')],{'through':'team_has_mail_queues','as':_0x302a('0x16e')});db[_0x302a('0x43')]['hasMany'](db[_0x302a('0x45')],{'as':'Messages','onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x16f')});db[_0x302a('0x43')][_0x302a('0x122')](db[_0x302a('0x3d')],{'as':'Account','foreignKey':_0x302a('0x15f')});db[_0x302a('0x43')][_0x302a('0x122')](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db[_0x302a('0x43')][_0x302a('0x122')](db['User'],{'as':_0x302a('0x171'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x43')]['belongsToMany'](db[_0x302a('0x8d')],{'through':_0x302a('0x172'),'as':_0x302a('0x173')});db[_0x302a('0x43')][_0x302a('0x125')](db[_0x302a('0x8d')],{'through':_0x302a('0x172'),'as':'ThroughTags'});db[_0x302a('0x43')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x174'),'through':_0x302a('0x12b'),'foreignKey':_0x302a('0x16f')});db[_0x302a('0x45')][_0x302a('0x115')](db[_0x302a('0xeb')],{'as':_0x302a('0x175'),'onDelete':_0x302a('0x112')});db[_0x302a('0x45')][_0x302a('0x122')](db[_0x302a('0x13')],{'as':'User'});db[_0x302a('0x45')][_0x302a('0x122')](db[_0x302a('0x72')],{'onDelete':_0x302a('0x112'),'as':_0x302a('0x170')});db[_0x302a('0x45')]['belongsTo'](db[_0x302a('0x43')],{'as':_0x302a('0x176'),'foreignKey':'MailInteractionId'});db[_0x302a('0x45')][_0x302a('0x122')](db[_0x302a('0x3d')],{'as':_0x302a('0x177'),'foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db[_0x302a('0x64')],{'as':_0x302a('0x64'),'foreignKey':_0x302a('0x178')});db['MailMessage']['belongsTo'](db[_0x302a('0x6b')],{'as':_0x302a('0x6b'),'foreignKey':_0x302a('0x179')});db[_0x302a('0x47')][_0x302a('0x122')](db['User'],{'onDelete':'restrict'});db[_0x302a('0x47')]['belongsTo'](db[_0x302a('0x3f')],{'onDelete':_0x302a('0x162')});db[_0x302a('0x47')][_0x302a('0x122')](db[_0x302a('0x3d')],{'onDelete':_0x302a('0x162')});db['MailApplication']['belongsTo'](db[_0x302a('0x83')],{'onDelete':_0x302a('0x162'),'foreignKey':_0x302a('0x17a')});db['MailApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x302a('0x17b')});db[_0x302a('0x49')][_0x302a('0x122')](db[_0x302a('0x3d')],{});db['MailQueueReport'][_0x302a('0x122')](db['CmList'],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db['MailQueueReport'][_0x302a('0x122')](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db['MailQueueReport']['belongsTo'](db[_0x302a('0x43')],{});db['MailQueueReport'][_0x302a('0x122')](db[_0x302a('0x45')],{});db['MailQueueReport']['belongsTo'](db['User'],{});db[_0x302a('0x49')][_0x302a('0x122')](db[_0x302a('0x3f')],{});db[_0x302a('0x4b')]['hasMany'](db[_0x302a('0x4d')],{'as':_0x302a('0x17c'),'onDelete':_0x302a('0x112')});db[_0x302a('0x4f')][_0x302a('0x115')](db['Disposition'],{'as':_0x302a('0x165'),'foreignKey':_0x302a('0x17d'),'onDelete':_0x302a('0x112')});db[_0x302a('0x4f')]['hasMany'](db[_0x302a('0x166')],{'as':_0x302a('0x167'),'foreignKey':'FaxAccountId'});db[_0x302a('0x4f')][_0x302a('0x115')](db[_0x302a('0x17e')],{'as':_0x302a('0x169')});db[_0x302a('0x4f')][_0x302a('0x115')](db['FaxApplication'],{'as':_0x302a('0x149')});db[_0x302a('0x4f')][_0x302a('0x115')](db[_0x302a('0x1a')],{'as':_0x302a('0x17f'),'onDelete':'cascade'});db[_0x302a('0x4f')][_0x302a('0x115')](db[_0x302a('0x51')],{'as':_0x302a('0x168')});db[_0x302a('0x4f')][_0x302a('0x122')](db['Trunk'],{'as':_0x302a('0x2d')});db[_0x302a('0x4f')][_0x302a('0x122')](db[_0x302a('0xf6')],{'as':_0x302a('0x16a'),'foreignKey':'ListId'});db['FaxAccount'][_0x302a('0x122')](db[_0x302a('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0x302a('0x154')});db[_0x302a('0x4f')][_0x302a('0x125')](db['User'],{'as':'Agents','through':_0x302a('0x13d')});db[_0x302a('0x180')][_0x302a('0x122')](db['User'],{'onDelete':'restrict'});db[_0x302a('0x180')]['belongsTo'](db[_0x302a('0x133')],{'onDelete':_0x302a('0x162')});db[_0x302a('0x180')][_0x302a('0x122')](db[_0x302a('0x4f')],{'onDelete':_0x302a('0x162')});db[_0x302a('0x180')][_0x302a('0x122')](db[_0x302a('0x8d')],{'onDelete':_0x302a('0x162'),'foreignKey':'TagId'});db['FaxInteraction'][_0x302a('0x115')](db[_0x302a('0x51')],{'as':_0x302a('0x168'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x181')});db[_0x302a('0x17e')]['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':_0x302a('0x17d')});db[_0x302a('0x17e')][_0x302a('0x122')](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db['FaxInteraction'][_0x302a('0x122')](db[_0x302a('0x13')],{'as':_0x302a('0x171'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x17e')][_0x302a('0x125')](db[_0x302a('0x8d')],{'through':_0x302a('0x182'),'as':_0x302a('0x173')});db[_0x302a('0x17e')][_0x302a('0x125')](db[_0x302a('0x8d')],{'through':_0x302a('0x182'),'as':_0x302a('0x183')});db[_0x302a('0x17e')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x174'),'through':_0x302a('0x12c'),'foreignKey':_0x302a('0x181')});db[_0x302a('0x51')][_0x302a('0x122')](db[_0x302a('0x13')],{'onDelete':_0x302a('0x112'),'as':_0x302a('0x13')});db[_0x302a('0x51')][_0x302a('0x122')](db[_0x302a('0x17e')],{'as':_0x302a('0x176'),'foreignKey':_0x302a('0x181')});db[_0x302a('0x51')][_0x302a('0x122')](db[_0x302a('0x72')],{'onDelete':_0x302a('0x112'),'as':_0x302a('0x170')});db['FaxMessage'][_0x302a('0x122')](db['Attachment'],{'as':_0x302a('0xeb'),'foreignKey':'AttachmentId'});db[_0x302a('0x51')][_0x302a('0x122')](db[_0x302a('0x4f')],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x17d')});db['FaxQueue'][_0x302a('0x125')](db[_0x302a('0x13')],{'as':'Agents','through':_0x302a('0x184')});db['FaxQueue'][_0x302a('0x125')](db['Team'],{'through':'team_has_fax_queues','as':_0x302a('0x16e')});db[_0x302a('0x53')][_0x302a('0x122')](db[_0x302a('0x4f')],{});db[_0x302a('0x53')][_0x302a('0x122')](db['CmList'],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0x53')]['belongsTo'](db[_0x302a('0x72')],{'as':'Contact','foreignKey':_0x302a('0x15d')});db[_0x302a('0x53')][_0x302a('0x122')](db[_0x302a('0x17e')],{});db[_0x302a('0x53')][_0x302a('0x122')](db['FaxMessage'],{});db['FaxQueueReport'][_0x302a('0x122')](db[_0x302a('0x13')],{});db[_0x302a('0x53')]['belongsTo'](db[_0x302a('0x133')],{});db['SmsAccount']['hasMany'](db[_0x302a('0x80')],{'as':_0x302a('0x165'),'foreignKey':_0x302a('0x185'),'onDelete':_0x302a('0x112')});db[_0x302a('0x54')][_0x302a('0x115')](db[_0x302a('0x166')],{'as':_0x302a('0x167'),'foreignKey':_0x302a('0x185')});db[_0x302a('0x54')][_0x302a('0x115')](db[_0x302a('0x5a')],{'as':_0x302a('0x168'),'foreignKey':_0x302a('0x185')});db['SmsAccount'][_0x302a('0x115')](db[_0x302a('0x58')],{'as':_0x302a('0x169')});db[_0x302a('0x54')][_0x302a('0x115')](db[_0x302a('0x56')],{'as':_0x302a('0x149')});db[_0x302a('0x54')]['belongsTo'](db[_0x302a('0xf6')],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0x54')][_0x302a('0x122')](db[_0x302a('0x85')],{'as':_0x302a('0x153'),'foreignKey':_0x302a('0x154')});db['SmsAccount']['belongsToMany'](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':'user_has_sms_accounts'});db[_0x302a('0x56')]['belongsTo'](db[_0x302a('0x13')],{'onDelete':_0x302a('0x162')});db[_0x302a('0x56')][_0x302a('0x122')](db[_0x302a('0x134')],{'onDelete':'restrict'});db[_0x302a('0x56')][_0x302a('0x122')](db[_0x302a('0x54')],{'onDelete':_0x302a('0x162')});db[_0x302a('0x56')][_0x302a('0x122')](db['Interval'],{'onDelete':_0x302a('0x162'),'foreignKey':_0x302a('0x17a')});db[_0x302a('0x56')][_0x302a('0x122')](db[_0x302a('0x8d')],{'onDelete':'restrict','foreignKey':_0x302a('0x17b')});db[_0x302a('0x58')][_0x302a('0x115')](db[_0x302a('0x5a')],{'as':_0x302a('0x168'),'onDelete':'cascade','foreignKey':_0x302a('0x186')});db[_0x302a('0x58')]['belongsTo'](db[_0x302a('0x54')],{'as':_0x302a('0x177'),'foreignKey':'SmsAccountId'});db[_0x302a('0x58')][_0x302a('0x122')](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':'ContactId'});db['SmsInteraction'][_0x302a('0x122')](db[_0x302a('0x13')],{'as':_0x302a('0x171'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x58')][_0x302a('0x125')](db[_0x302a('0x8d')],{'through':_0x302a('0x187'),'as':'Tags'});db[_0x302a('0x58')][_0x302a('0x125')](db['Tag'],{'through':_0x302a('0x187'),'as':'ThroughTags'});db[_0x302a('0x58')]['belongsToMany'](db[_0x302a('0x13')],{'as':_0x302a('0x174'),'through':_0x302a('0x12d'),'foreignKey':_0x302a('0x186')});db[_0x302a('0x5a')]['belongsTo'](db[_0x302a('0x13')],{'as':_0x302a('0x13')});db[_0x302a('0x5a')][_0x302a('0x122')](db[_0x302a('0x72')],{'onDelete':_0x302a('0x112'),'as':_0x302a('0x170')});db[_0x302a('0x5a')][_0x302a('0x122')](db['SmsInteraction'],{'onDelete':_0x302a('0x112'),'as':'Interaction','foreignKey':_0x302a('0x186')});db[_0x302a('0x5a')][_0x302a('0x122')](db[_0x302a('0x54')],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x185')});db[_0x302a('0x134')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':'UserSmsQueue','foreignKey':_0x302a('0x188')});db[_0x302a('0x134')][_0x302a('0x125')](db[_0x302a('0xe5')],{'through':_0x302a('0x189'),'as':_0x302a('0x16e')});db[_0x302a('0x5d')][_0x302a('0x115')](db[_0x302a('0x80')],{'as':_0x302a('0x165'),'foreignKey':_0x302a('0x18a'),'onDelete':_0x302a('0x112')});db[_0x302a('0x5d')][_0x302a('0x115')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x302a('0x18a')});db[_0x302a('0x5d')][_0x302a('0x115')](db['OpenchannelInteraction'],{'as':_0x302a('0x169'),'foreignKey':_0x302a('0x18a')});db['OpenchannelAccount'][_0x302a('0x115')](db[_0x302a('0x62')],{'as':'Messages','foreignKey':_0x302a('0x18a')});db[_0x302a('0x5d')][_0x302a('0x115')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x302a('0x18a')});db[_0x302a('0x5d')][_0x302a('0x122')](db['CmList'],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db['OpenchannelAccount'][_0x302a('0x122')](db[_0x302a('0x85')],{'as':_0x302a('0x153'),'foreignKey':_0x302a('0x154')});db['OpenchannelAccount'][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':_0x302a('0x141')});db[_0x302a('0x5e')][_0x302a('0x122')](db[_0x302a('0x13')],{'onDelete':'restrict'});db[_0x302a('0x5e')]['belongsTo'](db[_0x302a('0x137')],{'onDelete':'restrict','foreignKey':_0x302a('0x18b')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x302a('0x18a')});db[_0x302a('0x5e')][_0x302a('0x122')](db[_0x302a('0x83')],{'onDelete':_0x302a('0x162'),'foreignKey':'IntervalId'});db[_0x302a('0x5e')][_0x302a('0x122')](db[_0x302a('0x8d')],{'onDelete':_0x302a('0x162'),'foreignKey':_0x302a('0x17b')});db['OpenchannelInteraction'][_0x302a('0x115')](db[_0x302a('0x62')],{'as':_0x302a('0x168'),'onDelete':'cascade','foreignKey':_0x302a('0x18c')});db[_0x302a('0x60')][_0x302a('0x122')](db[_0x302a('0x5d')],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x18a')});db['OpenchannelInteraction'][_0x302a('0x122')](db['CmContact'],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db['OpenchannelInteraction'][_0x302a('0x122')](db[_0x302a('0x13')],{'as':_0x302a('0x171'),'foreignKey':'UserId'});db[_0x302a('0x60')][_0x302a('0x125')](db['Tag'],{'through':_0x302a('0x18d'),'as':_0x302a('0x173')});db['OpenchannelInteraction']['belongsToMany'](db[_0x302a('0x8d')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x302a('0x60')][_0x302a('0x125')](db['User'],{'as':_0x302a('0x174'),'through':_0x302a('0x18e'),'foreignKey':_0x302a('0x18c')});db[_0x302a('0x62')]['belongsTo'](db[_0x302a('0x13')],{'onDelete':_0x302a('0x112'),'as':_0x302a('0x13')});db[_0x302a('0x62')]['belongsTo'](db[_0x302a('0x72')],{'onDelete':_0x302a('0x112'),'as':_0x302a('0x170')});db[_0x302a('0x62')][_0x302a('0x122')](db['OpenchannelInteraction'],{'onDelete':_0x302a('0x112'),'as':_0x302a('0x176'),'foreignKey':_0x302a('0x18c')});db[_0x302a('0x62')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x302a('0x18f')});db[_0x302a('0x62')][_0x302a('0x122')](db['OpenchannelAccount'],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x18a')});db[_0x302a('0x137')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':_0x302a('0x138'),'foreignKey':_0x302a('0x18b')});db['OpenchannelQueue']['belongsToMany'](db[_0x302a('0xe5')],{'through':_0x302a('0x190'),'as':_0x302a('0x16e')});db[_0x302a('0x64')][_0x302a('0x115')](db[_0x302a('0x80')],{'as':_0x302a('0x165'),'foreignKey':'ChatWebsiteId','onDelete':_0x302a('0x112')});db[_0x302a('0x64')][_0x302a('0x115')](db[_0x302a('0x166')],{'as':_0x302a('0x167'),'foreignKey':_0x302a('0x178')});db[_0x302a('0x64')][_0x302a('0x115')](db[_0x302a('0x191')],{'as':_0x302a('0x192')});db['ChatWebsite'][_0x302a('0x115')](db[_0x302a('0x68')],{'as':_0x302a('0x169')});db[_0x302a('0x64')]['hasMany'](db[_0x302a('0x67')],{'as':'Applications'});db[_0x302a('0x64')][_0x302a('0x115')](db[_0x302a('0x6a')],{'as':'Messages'});db['ChatWebsite'][_0x302a('0x122')](db['CmList'],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0x64')][_0x302a('0x122')](db[_0x302a('0x83')],{'as':_0x302a('0x83'),'foreignKey':_0x302a('0x17a')});db['ChatWebsite'][_0x302a('0x122')](db['MailAccount'],{'as':_0x302a('0x3d'),'foreignKey':'MailAccountId'});db['ChatWebsite'][_0x302a('0x122')](db[_0x302a('0x85')],{'as':_0x302a('0x153'),'foreignKey':_0x302a('0x154')});db['ChatWebsite']['belongsToMany'](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':_0x302a('0x193')});db[_0x302a('0x194')]['belongsTo'](db[_0x302a('0x5d')],{});db[_0x302a('0x194')][_0x302a('0x122')](db[_0x302a('0xf6')],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0x194')]['belongsTo'](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db[_0x302a('0x194')]['belongsTo'](db[_0x302a('0x60')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelMessage'],{});db[_0x302a('0x194')]['belongsTo'](db[_0x302a('0x13')],{});db[_0x302a('0x194')][_0x302a('0x122')](db[_0x302a('0x137')],{});db['ChatApplication'][_0x302a('0x122')](db[_0x302a('0x13')],{'as':_0x302a('0x195'),'foreignKey':_0x302a('0x113'),'onDelete':_0x302a('0x162')});db[_0x302a('0x67')][_0x302a('0x122')](db[_0x302a('0x131')],{'as':_0x302a('0x196'),'foreignKey':_0x302a('0x197'),'onDelete':_0x302a('0x162')});db[_0x302a('0x67')]['belongsTo'](db[_0x302a('0x64')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x302a('0x67')][_0x302a('0x122')](db[_0x302a('0x8d')],{'onDelete':_0x302a('0x162'),'foreignKey':_0x302a('0x17b')});db[_0x302a('0x68')][_0x302a('0x115')](db[_0x302a('0x6a')],{'as':_0x302a('0x168'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x198')});db['ChatInteraction']['belongsTo'](db[_0x302a('0x64')],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x178')});db[_0x302a('0x68')][_0x302a('0x122')](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':'ContactId'});db[_0x302a('0x68')][_0x302a('0x122')](db['User'],{'as':_0x302a('0x171'),'foreignKey':'UserId'});db[_0x302a('0x68')]['belongsToMany'](db['Tag'],{'through':_0x302a('0x199'),'as':_0x302a('0x173')});db[_0x302a('0x68')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x302a('0x183')});db[_0x302a('0x68')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':'Users','through':_0x302a('0x19a'),'foreignKey':_0x302a('0x198')});db['ChatMessage'][_0x302a('0x122')](db[_0x302a('0x13')],{'onDelete':'cascade','as':_0x302a('0x13')});db[_0x302a('0x6a')][_0x302a('0x122')](db['CmContact'],{'onDelete':_0x302a('0x112'),'as':'Contact','foreignKey':'ContactId'});db[_0x302a('0x6a')]['belongsTo'](db[_0x302a('0x68')],{'onDelete':_0x302a('0x112'),'as':'Interaction','foreignKey':_0x302a('0x198')});db[_0x302a('0x6a')][_0x302a('0x122')](db['Attachment'],{'as':'Attachment','foreignKey':_0x302a('0x18f')});db[_0x302a('0x6a')][_0x302a('0x122')](db['ChatWebsite'],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x178')});db[_0x302a('0x6b')]['hasMany'](db['Attachment'],{'as':'Attachments','foreignKey':_0x302a('0x179'),'onDelete':_0x302a('0x112'),'hooks':!![]});db[_0x302a('0x6b')][_0x302a('0x122')](db['CmContact'],{'onDelete':_0x302a('0x112'),'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db['ChatOfflineMessage'][_0x302a('0x122')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x302a('0x131')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':_0x302a('0x35'),'hooks':!![]});db[_0x302a('0x131')][_0x302a('0x125')](db['Team'],{'through':_0x302a('0x19b'),'as':'Teams'});db['ChatGroup']['hasMany'](db[_0x302a('0x19c')],{'as':_0x302a('0x168'),'foreignKey':_0x302a('0x19d'),'onDelete':_0x302a('0x112')});db['ChatGroup'][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x14c'),'through':_0x302a('0x127')});db[_0x302a('0x191')][_0x302a('0x122')](db['ChatWebsite'],{'as':_0x302a('0x19e'),'foreignKey':_0x302a('0x178')});db[_0x302a('0x70')]['hasMany'](db[_0x302a('0x72')],{'as':_0x302a('0x128'),'foreignKey':_0x302a('0x19f')});db[_0x302a('0x72')]['hasMany'](db[_0x302a('0x90')],{'as':_0x302a('0x1a0'),'foreignKey':_0x302a('0x1a1')});db[_0x302a('0x72')][_0x302a('0x115')](db[_0x302a('0x73')],{'as':_0x302a('0x14e'),'foreignKey':'ContactId'});db[_0x302a('0x72')][_0x302a('0x115')](db[_0x302a('0x76')],{'as':'HopperFinals','foreignKey':_0x302a('0x15d')});db[_0x302a('0x72')][_0x302a('0x115')](db['CmHopperHistory'],{'as':_0x302a('0x14f'),'foreignKey':_0x302a('0x15d')});db['CmContact'][_0x302a('0x115')](db[_0x302a('0x79')],{'as':_0x302a('0x79'),'foreignKey':_0x302a('0x15d')});db[_0x302a('0x72')][_0x302a('0x115')](db['JscriptySessionReport'],{'as':_0x302a('0x1a2'),'foreignKey':_0x302a('0x15d')});db[_0x302a('0x72')][_0x302a('0x115')](db[_0x302a('0x60')],{'as':_0x302a('0x11b'),'foreignKey':_0x302a('0x15d'),'onDelete':_0x302a('0x162')});db[_0x302a('0x72')][_0x302a('0x115')](db[_0x302a('0x68')],{'as':_0x302a('0x11c'),'foreignKey':_0x302a('0x15d'),'onDelete':_0x302a('0x162')});db[_0x302a('0x72')][_0x302a('0x115')](db[_0x302a('0x58')],{'as':_0x302a('0x11d'),'foreignKey':_0x302a('0x15d'),'onDelete':_0x302a('0x162')});db[_0x302a('0x72')]['hasMany'](db[_0x302a('0x17e')],{'as':_0x302a('0x11e'),'foreignKey':'ContactId','onDelete':_0x302a('0x162')});db['CmContact'][_0x302a('0x115')](db[_0x302a('0x43')],{'as':_0x302a('0x11f'),'foreignKey':_0x302a('0x15d'),'onDelete':'restrict'});db['CmContact'][_0x302a('0x122')](db[_0x302a('0x70')],{'as':_0x302a('0x1a3'),'foreignKey':_0x302a('0x19f')});db[_0x302a('0x72')][_0x302a('0x122')](db[_0x302a('0xf6')],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b'),'onDelete':_0x302a('0x112')});db[_0x302a('0x72')][_0x302a('0x125')](db['User'],{'as':'Users','through':_0x302a('0x1a4')});db['CmContact'][_0x302a('0x125')](db[_0x302a('0x8d')],{'as':_0x302a('0x173'),'through':_0x302a('0x1a5')});db[_0x302a('0x72')][_0x302a('0x125')](db['Tag'],{'through':_0x302a('0x1a5'),'as':'ThroughTags'});db[_0x302a('0x73')][_0x302a('0x115')](db['CmHopperAdditionalPhone'],{'as':_0x302a('0x1a6'),'foreignKey':_0x302a('0x1a7')});db[_0x302a('0x73')][_0x302a('0x122')](db['CmContact'],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d'),'onDelete':_0x302a('0x112')});db[_0x302a('0x73')][_0x302a('0x122')](db['CmList'],{'as':'List','foreignKey':_0x302a('0x16b'),'onDelete':_0x302a('0x112')});db[_0x302a('0x73')][_0x302a('0x122')](db[_0x302a('0x13')],{'as':_0x302a('0x195'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x73')]['belongsTo'](db[_0x302a('0x1d')],{'as':_0x302a('0x196'),'foreignKey':_0x302a('0x14d'),'onDelete':'cascade'});db[_0x302a('0x73')][_0x302a('0x122')](db[_0x302a('0xe7')],{'as':'Campaign','foreignKey':_0x302a('0x1a8'),'onDelete':_0x302a('0x112')});db[_0x302a('0x73')]['belongsTo'](db[_0x302a('0x13')],{'as':_0x302a('0x171'),'foreignKey':_0x302a('0x1a9')});db['CmHopperBlack'][_0x302a('0x122')](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d'),'onDelete':_0x302a('0x112')});db[_0x302a('0x1aa')]['belongsTo'](db[_0x302a('0xf6')],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b'),'onDelete':'cascade'});db[_0x302a('0x1aa')][_0x302a('0x122')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x302a('0x14d'),'onDelete':_0x302a('0x112')});db[_0x302a('0x1aa')][_0x302a('0x122')](db['Campaign'],{'as':'Campaign','foreignKey':_0x302a('0x1a8'),'onDelete':'cascade'});db[_0x302a('0x7f')]['hasMany'](db[_0x302a('0x82')],{'as':{'plural':_0x302a('0x1ab'),'singular':_0x302a('0x1ac')},'foreignKey':_0x302a('0x1ad'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x302a('0x115')](db['Condition'],{'as':{'plural':_0x302a('0x1ae'),'singular':'OneAny'},'foreignKey':_0x302a('0x1af'),'onDelete':_0x302a('0x112'),'hooks':!![]});db[_0x302a('0x7f')][_0x302a('0x115')](db[_0x302a('0x7d')],{'as':_0x302a('0x1b0'),'foreignKey':'AutomationId','onDelete':_0x302a('0x112'),'hooks':!![]});db[_0x302a('0x80')][_0x302a('0x115')](db[_0x302a('0x80')],{'as':_0x302a('0x165'),'foreignKey':_0x302a('0x1b1'),'onDelete':_0x302a('0x112')});db[_0x302a('0x83')][_0x302a('0x115')](db['Interval'],{'as':'Intervals','foreignKey':_0x302a('0x17a'),'onDelete':_0x302a('0x112'),'hooks':!![],'required':![]});db[_0x302a('0x83')][_0x302a('0x115')](db[_0x302a('0x1a')],{'as':_0x302a('0x118'),'foreignKey':'IntervalId','onDelete':_0x302a('0x162')});db[_0x302a('0x83')][_0x302a('0x115')](db[_0x302a('0x47')],{'as':'MailApplications','foreignKey':'IntervalId'});db['Interval'][_0x302a('0x115')](db[_0x302a('0x67')],{'as':_0x302a('0x1b2'),'foreignKey':_0x302a('0x17a')});db[_0x302a('0x83')][_0x302a('0x115')](db[_0x302a('0x180')],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0x302a('0x115')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x302a('0x8b')][_0x302a('0x122')](db[_0x302a('0x3d')],{});db['Schedule'][_0x302a('0x122')](db[_0x302a('0x9b')],{'foreignKey':_0x302a('0x1b3')});db['Schedule'][_0x302a('0x122')](db[_0x302a('0x1b4')],{'foreignKey':_0x302a('0x1b5')});db[_0x302a('0x8c')][_0x302a('0x125')](db[_0x302a('0x1b')],{'as':_0x302a('0x1b6'),'through':_0x302a('0x14b'),'onDelete':_0x302a('0x162')});db['Tag'][_0x302a('0x125')](db['CmContact'],{'through':_0x302a('0x1a5')});db[_0x302a('0x8d')][_0x302a('0x125')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x302a('0x8d')][_0x302a('0x125')](db['MailInteraction'],{'through':_0x302a('0x172')});db[_0x302a('0x8d')]['belongsToMany'](db[_0x302a('0x58')],{'through':_0x302a('0x187')});db[_0x302a('0x8d')][_0x302a('0x125')](db[_0x302a('0x17e')],{'through':'fax_interaction_has_tags'});db['Tag'][_0x302a('0x125')](db[_0x302a('0x60')],{'through':_0x302a('0x18d')});db[_0x302a('0x8d')][_0x302a('0x125')](db[_0x302a('0x104')],{'through':_0x302a('0x1b7')});db[_0x302a('0x90')]['belongsTo'](db['ContactItemType'],{'as':'ItemType','foreignKey':_0x302a('0x1b8')});db[_0x302a('0x92')]['belongsTo'](db[_0x302a('0x73')],{'as':'Hopper','foreignKey':_0x302a('0x1a7')});db['CmContactHasItem']['belongsTo'](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x1a1')});db[_0x302a('0x94')]['hasMany'](db[_0x302a('0x82')],{'as':{'plural':_0x302a('0x1b9'),'singular':'AllCondition'},'foreignKey':_0x302a('0x1ba'),'onDelete':_0x302a('0x112'),'hooks':!![]});db[_0x302a('0x94')][_0x302a('0x115')](db[_0x302a('0x82')],{'as':{'plural':_0x302a('0x1bb'),'singular':_0x302a('0x1bc')},'foreignKey':_0x302a('0x1bd'),'onDelete':_0x302a('0x112'),'hooks':!![]});db[_0x302a('0x94')]['hasMany'](db[_0x302a('0x7d')],{'as':_0x302a('0x1b0'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x302a('0x1b4')]['hasMany'](db[_0x302a('0x1be')],{'as':_0x302a('0x1bf'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1b5'),'hooks':!![]});db[_0x302a('0x9b')][_0x302a('0x115')](db['AnalyticFieldReport'],{'as':_0x302a('0x1bf'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x302a('0x9e')][_0x302a('0x115')](db[_0x302a('0x1be')],{'as':'Fields','onDelete':_0x302a('0x112'),'foreignKey':'MetricId'});db[_0x302a('0x1be')][_0x302a('0x122')](db[_0x302a('0x9e')],{'foreignKey':_0x302a('0x1c0')});db[_0x302a('0xa2')][_0x302a('0x115')](db['SalesforceConfiguration'],{'as':_0x302a('0x1c1'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c2')});db[_0x302a('0xa4')][_0x302a('0x115')](db['SalesforceField'],{'as':_0x302a('0x1c3'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c4')});db[_0x302a('0xa4')][_0x302a('0x115')](db[_0x302a('0x1c5')],{'as':_0x302a('0x1c6'),'onDelete':'cascade','foreignKey':_0x302a('0x1c7')});db[_0x302a('0xa4')]['hasMany'](db[_0x302a('0x1c5')],{'as':_0x302a('0x1bf'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x302a('0xa4')][_0x302a('0x122')](db[_0x302a('0xa2')],{'as':'Account','foreignKey':_0x302a('0x1c2')});db[_0x302a('0x1c5')][_0x302a('0x115')](db[_0x302a('0x1c5')],{'as':_0x302a('0x1c8'),'foreignKey':_0x302a('0x1c4')});db[_0x302a('0x1c5')]['hasMany'](db['SalesforceField'],{'as':_0x302a('0x1c9'),'foreignKey':_0x302a('0x1c7')});db['SalesforceField'][_0x302a('0x115')](db[_0x302a('0x1c5')],{'as':_0x302a('0x1ca'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0x1c5')]['belongsTo'](db[_0x302a('0x1cc')],{'as':_0x302a('0x1cc'),'foreignKey':'VariableId'});db[_0x302a('0x1cd')][_0x302a('0x115')](db['SugarcrmConfiguration'],{'as':_0x302a('0x1c1'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c2')});db[_0x302a('0x1ce')][_0x302a('0x115')](db[_0x302a('0xa9')],{'as':'Subjects','onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c4')});db['SugarcrmConfiguration'][_0x302a('0x115')](db[_0x302a('0xa9')],{'as':_0x302a('0x1c6'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0x1ce')]['hasMany'](db[_0x302a('0xa9')],{'as':'Fields','onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1cb')});db['SugarcrmConfiguration'][_0x302a('0x122')](db['SugarcrmAccount'],{'as':_0x302a('0x177'),'foreignKey':'AccountId'});db[_0x302a('0xa9')][_0x302a('0x115')](db[_0x302a('0xa9')],{'as':_0x302a('0x1c8'),'foreignKey':_0x302a('0x1c4')});db[_0x302a('0xa9')]['hasMany'](db[_0x302a('0xa9')],{'as':'Description','foreignKey':_0x302a('0x1c7')});db[_0x302a('0xa9')][_0x302a('0x115')](db[_0x302a('0xa9')],{'as':_0x302a('0x1ca'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0xa9')][_0x302a('0x122')](db[_0x302a('0x1cc')],{'as':_0x302a('0x1cc'),'foreignKey':_0x302a('0x1cf')});db[_0x302a('0x1d0')][_0x302a('0x115')](db[_0x302a('0x1d1')],{'as':_0x302a('0x1c1'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c2')});db[_0x302a('0x1d1')][_0x302a('0x115')](db[_0x302a('0xac')],{'as':_0x302a('0x1c3'),'onDelete':'cascade','foreignKey':_0x302a('0x1c4')});db[_0x302a('0x1d1')][_0x302a('0x115')](db['DeskField'],{'as':_0x302a('0x1c6'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0x1d1')][_0x302a('0x115')](db['DeskField'],{'as':_0x302a('0x1bf'),'onDelete':_0x302a('0x112'),'foreignKey':'FieldId'});db[_0x302a('0x1d1')][_0x302a('0x122')](db[_0x302a('0x1d0')],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x1c2')});db[_0x302a('0x1d1')][_0x302a('0x125')](db[_0x302a('0x8d')],{'through':_0x302a('0x1d2')});db[_0x302a('0xac')]['hasMany'](db[_0x302a('0xac')],{'as':'Subject','foreignKey':_0x302a('0x1c4')});db[_0x302a('0xac')]['hasMany'](db[_0x302a('0xac')],{'as':_0x302a('0x1c9'),'foreignKey':_0x302a('0x1c7')});db['DeskField'][_0x302a('0x115')](db[_0x302a('0xac')],{'as':_0x302a('0x1ca'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0xac')]['belongsTo'](db[_0x302a('0x1cc')],{'as':'Variable','foreignKey':_0x302a('0x1cf')});db[_0x302a('0xae')][_0x302a('0x115')](db[_0x302a('0xb0')],{'as':_0x302a('0x1c1'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c2')});db[_0x302a('0xb0')][_0x302a('0x115')](db[_0x302a('0x1d3')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x302a('0x1c4')});db[_0x302a('0xb0')][_0x302a('0x115')](db[_0x302a('0x1d3')],{'as':_0x302a('0x1c6'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0xb0')][_0x302a('0x115')](db[_0x302a('0x1d3')],{'as':_0x302a('0x1bf'),'onDelete':'cascade','foreignKey':_0x302a('0x1cb')});db[_0x302a('0xb0')][_0x302a('0x122')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x302a('0x1c2')});db['ZohoField'][_0x302a('0x115')](db[_0x302a('0x1d3')],{'as':_0x302a('0x1c8'),'foreignKey':'SubjectId'});db['ZohoField'][_0x302a('0x115')](db[_0x302a('0x1d3')],{'as':_0x302a('0x1c9'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0x1d3')][_0x302a('0x115')](db['ZohoField'],{'as':_0x302a('0x1ca'),'foreignKey':'FieldId'});db[_0x302a('0x1d3')]['belongsTo'](db['Variable'],{'as':_0x302a('0x1cc'),'foreignKey':'VariableId'});db[_0x302a('0xb2')]['hasMany'](db[_0x302a('0xb4')],{'as':_0x302a('0x1c1'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x302a('0xb4')][_0x302a('0x115')](db[_0x302a('0xb6')],{'as':'Subjects','foreignKey':_0x302a('0x1c4')});db[_0x302a('0xb4')]['hasMany'](db['ZendeskField'],{'as':_0x302a('0x1c6'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x302a('0x1bf'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0xb4')][_0x302a('0x122')](db['ZendeskAccount'],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x1c2')});db['ZendeskConfiguration'][_0x302a('0x125')](db[_0x302a('0x8d')],{'through':_0x302a('0x1d4')});db[_0x302a('0xb6')]['hasMany'](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x302a('0xb6')]['hasMany'](db[_0x302a('0xb6')],{'as':_0x302a('0x1c9'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0xb6')][_0x302a('0x115')](db[_0x302a('0xb6')],{'as':'Field','foreignKey':_0x302a('0x1cb')});db['ZendeskField'][_0x302a('0x122')](db[_0x302a('0x1cc')],{'as':'Variable','foreignKey':_0x302a('0x1cf')});db[_0x302a('0xb8')][_0x302a('0x115')](db['FreshdeskConfiguration'],{'as':_0x302a('0x1c1'),'onDelete':'cascade','foreignKey':_0x302a('0x1c2')});db[_0x302a('0xba')][_0x302a('0x115')](db[_0x302a('0xbc')],{'as':_0x302a('0x1c3'),'onDelete':'cascade','foreignKey':_0x302a('0x1c4')});db[_0x302a('0xba')][_0x302a('0x115')](db[_0x302a('0xbc')],{'as':_0x302a('0x1c6'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0xba')][_0x302a('0x115')](db[_0x302a('0xbc')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x302a('0x1cb')});db[_0x302a('0xba')][_0x302a('0x122')](db[_0x302a('0xb8')],{'as':_0x302a('0x177'),'foreignKey':'AccountId'});db[_0x302a('0xba')]['belongsToMany'](db[_0x302a('0x8d')],{'through':_0x302a('0x1d5')});db[_0x302a('0xbc')]['hasMany'](db[_0x302a('0xbc')],{'as':_0x302a('0x1c8'),'foreignKey':_0x302a('0x1c4')});db[_0x302a('0xbc')][_0x302a('0x115')](db[_0x302a('0xbc')],{'as':_0x302a('0x1c9'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0xbc')][_0x302a('0x115')](db[_0x302a('0xbc')],{'as':_0x302a('0x1ca'),'foreignKey':'FieldId'});db[_0x302a('0xbc')][_0x302a('0x122')](db[_0x302a('0x1cc')],{'as':_0x302a('0x1cc'),'foreignKey':_0x302a('0x1cf')});db['VtigerAccount'][_0x302a('0x115')](db[_0x302a('0xbe')],{'as':_0x302a('0x1c1'),'onDelete':_0x302a('0x112'),'foreignKey':'AccountId'});db[_0x302a('0xbe')][_0x302a('0x115')](db[_0x302a('0xbf')],{'as':_0x302a('0x1c3'),'foreignKey':_0x302a('0x1c4')});db[_0x302a('0xbe')][_0x302a('0x115')](db[_0x302a('0xbf')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x302a('0xbe')]['hasMany'](db[_0x302a('0xbf')],{'as':_0x302a('0x1bf'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0xbe')][_0x302a('0x122')](db['VtigerAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x302a('0xbf')][_0x302a('0x115')](db['VtigerField'],{'as':_0x302a('0x1c8'),'foreignKey':_0x302a('0x1c4')});db[_0x302a('0xbf')][_0x302a('0x115')](db[_0x302a('0xbf')],{'as':_0x302a('0x1c9'),'foreignKey':'DescriptionId'});db[_0x302a('0xbf')][_0x302a('0x115')](db[_0x302a('0xbf')],{'as':_0x302a('0x1ca'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0xbf')][_0x302a('0x122')](db[_0x302a('0x1cc')],{'as':'Variable','foreignKey':_0x302a('0x1cf')});db[_0x302a('0xc1')][_0x302a('0x115')](db[_0x302a('0x1d6')],{'as':_0x302a('0x1c1'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c2')});db[_0x302a('0x1d6')][_0x302a('0x115')](db[_0x302a('0xc3')],{'as':_0x302a('0x1c3'),'foreignKey':_0x302a('0x1c4')});db['ServicenowConfiguration']['hasMany'](db[_0x302a('0xc3')],{'as':_0x302a('0x1c6'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0x1d6')]['hasMany'](db[_0x302a('0xc3')],{'as':_0x302a('0x1bf'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0x1d6')][_0x302a('0x122')](db['ServicenowAccount'],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x1c2')});db['ServicenowField']['hasMany'](db[_0x302a('0xc3')],{'as':_0x302a('0x1c8'),'foreignKey':_0x302a('0x1c4')});db['ServicenowField'][_0x302a('0x115')](db[_0x302a('0xc3')],{'as':_0x302a('0x1c9'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0xc3')][_0x302a('0x115')](db[_0x302a('0xc3')],{'as':_0x302a('0x1ca'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0xc3')]['belongsTo'](db['Variable'],{'as':_0x302a('0x1cc'),'foreignKey':_0x302a('0x1cf')});db[_0x302a('0xc4')][_0x302a('0x115')](db[_0x302a('0xc6')],{'as':'Configurations','onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c2')});db['Dynamics365Account']['belongsTo'](db[_0x302a('0x160')],{'as':'CloudProvider','foreignKey':_0x302a('0x161')});db[_0x302a('0xc6')][_0x302a('0x115')](db['Dynamics365Field'],{'as':_0x302a('0x1c3'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c4')});db[_0x302a('0xc6')]['hasMany'](db[_0x302a('0x1d7')],{'as':'Descriptions','onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0xc6')][_0x302a('0x115')](db[_0x302a('0x1d7')],{'as':_0x302a('0x1bf'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1cb')});db['Dynamics365Configuration']['belongsTo'](db[_0x302a('0xc4')],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x1c2')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x302a('0x1c4')});db[_0x302a('0x1d7')][_0x302a('0x115')](db['Dynamics365Field'],{'as':_0x302a('0x1c9'),'foreignKey':_0x302a('0x1c7')});db['Dynamics365Field'][_0x302a('0x115')](db[_0x302a('0x1d7')],{'as':_0x302a('0x1ca'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0x1d7')]['belongsTo'](db[_0x302a('0x1cc')],{'as':_0x302a('0x1cc'),'foreignKey':_0x302a('0x1cf')});db[_0x302a('0x1d8')][_0x302a('0x115')](db[_0x302a('0x1d9')],{'as':_0x302a('0x1c1'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1c2')});db[_0x302a('0x1d9')][_0x302a('0x115')](db[_0x302a('0xca')],{'as':_0x302a('0x1c3'),'foreignKey':_0x302a('0x1c4')});db[_0x302a('0x1d9')][_0x302a('0x115')](db[_0x302a('0xca')],{'as':_0x302a('0x1c6'),'foreignKey':_0x302a('0x1c7')});db[_0x302a('0x1d9')][_0x302a('0x115')](db['FreshsalesField'],{'as':_0x302a('0x1bf'),'foreignKey':_0x302a('0x1cb')});db[_0x302a('0x1d9')]['belongsTo'](db[_0x302a('0x1d8')],{'as':_0x302a('0x177'),'foreignKey':'AccountId'});db[_0x302a('0xca')][_0x302a('0x115')](db[_0x302a('0xca')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x302a('0xca')][_0x302a('0x115')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x302a('0x1c7')});db[_0x302a('0xca')]['hasMany'](db[_0x302a('0xca')],{'as':_0x302a('0x1ca'),'foreignKey':'FieldId'});db[_0x302a('0xca')][_0x302a('0x122')](db[_0x302a('0x1cc')],{'as':'Variable','foreignKey':_0x302a('0x1cf')});db[_0x302a('0xcf')][_0x302a('0x122')](db[_0x302a('0x64')],{});db['ChatQueueReport'][_0x302a('0x122')](db[_0x302a('0xf6')],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0xcf')]['belongsTo'](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db[_0x302a('0xcf')][_0x302a('0x122')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x302a('0x122')](db[_0x302a('0x6a')],{});db[_0x302a('0xcf')][_0x302a('0x122')](db[_0x302a('0x13')],{});db[_0x302a('0xcf')]['belongsTo'](db[_0x302a('0x131')],{});db['ChatInternalMessage'][_0x302a('0x122')](db['User'],{'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x1da')});db[_0x302a('0x19c')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0x302a('0x1db')});db[_0x302a('0xd5')]['hasMany'](db[_0x302a('0xd4')],{'foreignKey':_0x302a('0x1dc'),'onDelete':_0x302a('0x112')});db['JscriptySessionReport']['hasMany'](db[_0x302a('0xd2')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x302a('0xd6')][_0x302a('0x122')](db[_0x302a('0x54')],{});db[_0x302a('0xd6')][_0x302a('0x122')](db[_0x302a('0xf6')],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0xd6')]['belongsTo'](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db[_0x302a('0xd6')][_0x302a('0x122')](db[_0x302a('0x58')],{});db[_0x302a('0xd6')]['belongsTo'](db[_0x302a('0x5a')],{});db[_0x302a('0xd6')][_0x302a('0x122')](db[_0x302a('0x13')],{});db[_0x302a('0xd6')][_0x302a('0x122')](db['SmsQueue'],{});db[_0x302a('0xdb')][_0x302a('0x115')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0x302a('0xd4')],{'foreignKey':_0x302a('0x1dd')});db[_0x302a('0xdb')]['hasMany'](db[_0x302a('0xd2')],{'foreignKey':_0x302a('0x1dd')});db[_0x302a('0xe1')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x174'),'through':_0x302a('0x1de')});db[_0x302a('0xe5')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':'Agents','through':_0x302a('0x12a')});db['Team'][_0x302a('0x125')](db[_0x302a('0x1d')],{'through':_0x302a('0x10c'),'as':_0x302a('0x12f')});db['Team'][_0x302a('0x125')](db[_0x302a('0x3f')],{'through':_0x302a('0x1df'),'as':_0x302a('0x1e0')});db[_0x302a('0xe5')][_0x302a('0x125')](db[_0x302a('0x131')],{'through':'team_has_chat_queues','as':'ChatQueues'});db['Team'][_0x302a('0x125')](db[_0x302a('0x133')],{'through':'team_has_fax_queues','as':_0x302a('0x1e1')});db[_0x302a('0xe5')]['belongsToMany'](db['SmsQueue'],{'through':_0x302a('0x189'),'as':_0x302a('0x135')});db[_0x302a('0xe5')][_0x302a('0x125')](db[_0x302a('0x137')],{'through':_0x302a('0x190'),'as':_0x302a('0x1e2')});db[_0x302a('0xe5')][_0x302a('0x125')](db[_0x302a('0x109')],{'through':_0x302a('0x1e3'),'as':'WhatsappQueues'});db['Team'][_0x302a('0x125')](db['VoicePrefix'],{'through':_0x302a('0x1e4'),'as':'VoicePrefixes'});db[_0x302a('0xe7')][_0x302a('0x115')](db['CmHopper'],{'as':_0x302a('0x14e'),'foreignKey':_0x302a('0x1a8')});db[_0x302a('0xe7')]['hasMany'](db[_0x302a('0x76')],{'as':_0x302a('0x119'),'foreignKey':_0x302a('0x1a8')});db['Campaign'][_0x302a('0x115')](db[_0x302a('0x77')],{'as':_0x302a('0x14f'),'foreignKey':_0x302a('0x1a8')});db[_0x302a('0xe7')]['hasMany'](db['CmHopperBlack'],{'as':_0x302a('0x1e5'),'foreignKey':_0x302a('0x1a8')});db['Campaign'][_0x302a('0x122')](db[_0x302a('0x2d')],{'as':_0x302a('0x2d'),'foreignKey':_0x302a('0x150')});db[_0x302a('0xe7')][_0x302a('0x122')](db[_0x302a('0x2d')],{'as':_0x302a('0x151'),'foreignKey':_0x302a('0x152')});db['Campaign']['belongsTo'](db['Interval'],{'as':_0x302a('0x83'),'foreignKey':_0x302a('0x17a')});db['Campaign'][_0x302a('0x122')](db['SquareProject'],{'as':_0x302a('0xe1'),'foreignKey':'SquareProjectId'});db[_0x302a('0xe7')][_0x302a('0x125')](db[_0x302a('0xf6')],{'as':_0x302a('0x129'),'through':_0x302a('0x1e6')});db['Campaign']['belongsToMany'](db[_0x302a('0xf6')],{'as':'BlackLists','through':_0x302a('0x1e7')});db[_0x302a('0xeb')]['belongsTo'](db[_0x302a('0x6b')],{'as':_0x302a('0x6b'),'foreignKey':_0x302a('0x179')});db[_0x302a('0x1e8')][_0x302a('0x122')](db[_0x302a('0x45')],{});db[_0x302a('0x1e8')][_0x302a('0x122')](db[_0x302a('0x43')],{});db[_0x302a('0x1e8')][_0x302a('0x122')](db[_0x302a('0x3d')],{'foreignKey':_0x302a('0x1e9'),'as':_0x302a('0x1ea')});db[_0x302a('0x1e8')][_0x302a('0x122')](db[_0x302a('0x13')],{'foreignKey':_0x302a('0x1eb'),'as':'FromAgent'});db[_0x302a('0x1e8')][_0x302a('0x122')](db[_0x302a('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db['MailTransferReport']['belongsTo'](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x302a('0x1ec')});db[_0x302a('0x1e8')]['belongsTo'](db[_0x302a('0x3d')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x302a('0xf0')][_0x302a('0x122')](db['ChatMessage'],{});db[_0x302a('0xf0')][_0x302a('0x122')](db['ChatInteraction'],{});db[_0x302a('0xf0')][_0x302a('0x122')](db[_0x302a('0x64')],{'foreignKey':_0x302a('0x1ed'),'as':_0x302a('0x1ea')});db[_0x302a('0xf0')]['belongsTo'](db[_0x302a('0x13')],{'foreignKey':'FromUserId','as':_0x302a('0x1ee')});db['ChatTransferReport'][_0x302a('0x122')](db['User'],{'foreignKey':_0x302a('0x1ef'),'as':'ToAgent'});db[_0x302a('0xf0')][_0x302a('0x122')](db[_0x302a('0x131')],{'foreignKey':_0x302a('0x1f0'),'as':'ToQueue'});db[_0x302a('0xf0')][_0x302a('0x122')](db[_0x302a('0x64')],{'foreignKey':_0x302a('0x1f1'),'as':'ToAccount'});db[_0x302a('0xf2')][_0x302a('0x122')](db[_0x302a('0x51')],{});db[_0x302a('0xf2')][_0x302a('0x122')](db['FaxInteraction'],{});db[_0x302a('0xf2')][_0x302a('0x122')](db['FaxAccount'],{'foreignKey':_0x302a('0x1f2'),'as':_0x302a('0x1ea')});db['FaxTransferReport'][_0x302a('0x122')](db[_0x302a('0x13')],{'foreignKey':_0x302a('0x1eb'),'as':_0x302a('0x1ee')});db[_0x302a('0xf2')]['belongsTo'](db[_0x302a('0x13')],{'foreignKey':_0x302a('0x1ef'),'as':_0x302a('0x1f3')});db['FaxTransferReport'][_0x302a('0x122')](db[_0x302a('0x133')],{'foreignKey':_0x302a('0x1f4'),'as':_0x302a('0x1ec')});db['FaxTransferReport']['belongsTo'](db[_0x302a('0x4f')],{'foreignKey':_0x302a('0x1f5'),'as':_0x302a('0x1f6')});db[_0x302a('0xf4')][_0x302a('0x122')](db[_0x302a('0x62')],{});db[_0x302a('0xf4')][_0x302a('0x122')](db[_0x302a('0x60')],{});db[_0x302a('0xf4')][_0x302a('0x122')](db['OpenchannelAccount'],{'foreignKey':_0x302a('0x1f7'),'as':_0x302a('0x1ea')});db[_0x302a('0xf4')][_0x302a('0x122')](db[_0x302a('0x13')],{'foreignKey':_0x302a('0x1eb'),'as':_0x302a('0x1ee')});db[_0x302a('0xf4')][_0x302a('0x122')](db[_0x302a('0x13')],{'foreignKey':_0x302a('0x1ef'),'as':_0x302a('0x1f3')});db[_0x302a('0xf4')][_0x302a('0x122')](db[_0x302a('0x137')],{'foreignKey':_0x302a('0x1f8'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x302a('0x122')](db[_0x302a('0x5d')],{'foreignKey':_0x302a('0x1f9'),'as':_0x302a('0x1f6')});db[_0x302a('0x1fa')]['belongsTo'](db[_0x302a('0x5a')],{});db[_0x302a('0x1fa')][_0x302a('0x122')](db['SmsInteraction'],{});db[_0x302a('0x1fa')][_0x302a('0x122')](db[_0x302a('0x54')],{'foreignKey':_0x302a('0x1fb'),'as':_0x302a('0x1ea')});db[_0x302a('0x1fa')][_0x302a('0x122')](db[_0x302a('0x13')],{'foreignKey':_0x302a('0x1eb'),'as':_0x302a('0x1ee')});db[_0x302a('0x1fa')][_0x302a('0x122')](db[_0x302a('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db['SmsTransferReport'][_0x302a('0x122')](db[_0x302a('0x134')],{'foreignKey':_0x302a('0x1fc'),'as':_0x302a('0x1ec')});db[_0x302a('0x1fa')][_0x302a('0x122')](db[_0x302a('0x54')],{'foreignKey':_0x302a('0x1fd'),'as':_0x302a('0x1f6')});db[_0x302a('0xf6')]['hasMany'](db['Disposition'],{'as':_0x302a('0x165'),'foreignKey':_0x302a('0x16b'),'onDelete':_0x302a('0x112')});db[_0x302a('0xf6')]['hasMany'](db[_0x302a('0x7b')],{'as':_0x302a('0x1fe'),'foreignKey':_0x302a('0x16b')});db['CmList']['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0xf6')][_0x302a('0x115')](db[_0x302a('0x76')],{'as':'HopperFinals','foreignKey':_0x302a('0x16b')});db[_0x302a('0xf6')]['hasMany'](db[_0x302a('0x77')],{'as':_0x302a('0x11a'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0xf6')][_0x302a('0x115')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x302a('0x16b')});db['CmList'][_0x302a('0x125')](db[_0x302a('0x1d')],{'as':'Queues','through':_0x302a('0x1ff')});db[_0x302a('0xf6')][_0x302a('0x125')](db['User'],{'as':_0x302a('0x16d'),'through':_0x302a('0x200')});db['VoicePrefix']['hasMany'](db[_0x302a('0x1a')],{'as':_0x302a('0x118'),'onDelete':_0x302a('0x112')});db['VoicePrefix'][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':_0x302a('0x10d')});db[_0x302a('0xf8')][_0x302a('0x125')](db['Team'],{'through':'TeamVoicePrefix','as':'Teams'});db[_0x302a('0x123')][_0x302a('0x115')](db[_0x302a('0x13')],{'as':_0x302a('0x174'),'foreignKey':_0x302a('0x124')});db[_0x302a('0x123')][_0x302a('0x115')](db[_0x302a('0xfb')],{'as':_0x302a('0x201'),'foreignKey':'userProfileId','onDelete':_0x302a('0x112')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x302a('0x202'),'foreignKey':_0x302a('0x203'),'onDelete':_0x302a('0x112')});db[_0x302a('0x143')][_0x302a('0x115')](db['Disposition'],{'as':_0x302a('0x165'),'foreignKey':_0x302a('0x204'),'onDelete':_0x302a('0x112')});db[_0x302a('0x143')]['hasMany'](db[_0x302a('0x166')],{'as':_0x302a('0x167'),'foreignKey':_0x302a('0x204')});db[_0x302a('0x143')]['hasMany'](db[_0x302a('0x205')],{'as':_0x302a('0x168'),'foreignKey':_0x302a('0x204')});db[_0x302a('0x143')][_0x302a('0x115')](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x302a('0x143')][_0x302a('0x115')](db['WhatsappApplication'],{'as':_0x302a('0x149')});db[_0x302a('0x143')]['belongsTo'](db['CmList'],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db[_0x302a('0x143')][_0x302a('0x122')](db['Pause'],{'as':_0x302a('0x153'),'foreignKey':_0x302a('0x154')});db[_0x302a('0x143')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':_0x302a('0x145')});db[_0x302a('0x102')][_0x302a('0x122')](db['User'],{'onDelete':_0x302a('0x162')});db[_0x302a('0x102')][_0x302a('0x122')](db[_0x302a('0x109')],{'onDelete':'restrict'});db[_0x302a('0x102')]['belongsTo'](db[_0x302a('0x143')],{'onDelete':_0x302a('0x162')});db[_0x302a('0x102')][_0x302a('0x122')](db[_0x302a('0x83')],{'onDelete':_0x302a('0x162'),'foreignKey':_0x302a('0x17a')});db[_0x302a('0x102')][_0x302a('0x122')](db[_0x302a('0x8d')],{'onDelete':_0x302a('0x162'),'foreignKey':'TagId'});db[_0x302a('0x104')][_0x302a('0x115')](db['WhatsappMessage'],{'as':_0x302a('0x168'),'onDelete':_0x302a('0x112'),'foreignKey':_0x302a('0x206')});db[_0x302a('0x104')][_0x302a('0x122')](db[_0x302a('0x143')],{'as':_0x302a('0x177'),'foreignKey':_0x302a('0x204')});db[_0x302a('0x104')][_0x302a('0x122')](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db[_0x302a('0x104')][_0x302a('0x122')](db['User'],{'as':_0x302a('0x171'),'foreignKey':_0x302a('0x113')});db[_0x302a('0x104')][_0x302a('0x125')](db[_0x302a('0x8d')],{'through':_0x302a('0x1b7'),'as':_0x302a('0x173')});db['WhatsappInteraction'][_0x302a('0x125')](db[_0x302a('0x8d')],{'through':'whatsapp_interaction_has_tags','as':_0x302a('0x183')});db['WhatsappInteraction'][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x174'),'through':_0x302a('0x12e'),'foreignKey':_0x302a('0x206')});db[_0x302a('0x205')][_0x302a('0x122')](db[_0x302a('0x13')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db[_0x302a('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0x302a('0x205')]['belongsTo'](db[_0x302a('0x104')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x302a('0x206')});db['WhatsappMessage'][_0x302a('0x122')](db[_0x302a('0x143')],{'as':_0x302a('0x177'),'foreignKey':'WhatsappAccountId'});db[_0x302a('0x107')]['belongsTo'](db[_0x302a('0x143')],{});db[_0x302a('0x107')]['belongsTo'](db['CmList'],{'as':_0x302a('0x16a'),'foreignKey':_0x302a('0x16b')});db['WhatsappQueueReport'][_0x302a('0x122')](db[_0x302a('0x72')],{'as':_0x302a('0x170'),'foreignKey':_0x302a('0x15d')});db[_0x302a('0x107')][_0x302a('0x122')](db[_0x302a('0x104')],{});db[_0x302a('0x107')][_0x302a('0x122')](db[_0x302a('0x109')],{});db['WhatsappQueueReport'][_0x302a('0x122')](db[_0x302a('0x205')],{});db[_0x302a('0x107')]['belongsTo'](db[_0x302a('0x13')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x302a('0x205')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x302a('0x104')],{});db[_0x302a('0x207')][_0x302a('0x122')](db[_0x302a('0x143')],{'foreignKey':_0x302a('0x208'),'as':_0x302a('0x1ea')});db[_0x302a('0x207')]['belongsTo'](db[_0x302a('0x143')],{'foreignKey':'ToWhatsappAccountId','as':_0x302a('0x1f6')});db[_0x302a('0x207')][_0x302a('0x122')](db[_0x302a('0x109')],{'foreignKey':_0x302a('0x209'),'as':_0x302a('0x1ec')});db[_0x302a('0x207')][_0x302a('0x122')](db[_0x302a('0x13')],{'foreignKey':_0x302a('0x1eb'),'as':_0x302a('0x1ee')});db['WhatsappTransferReport'][_0x302a('0x122')](db[_0x302a('0x13')],{'foreignKey':'ToUserId','as':_0x302a('0x1f3')});db[_0x302a('0x109')][_0x302a('0x125')](db[_0x302a('0x13')],{'as':_0x302a('0x16d'),'through':_0x302a('0x13a'),'foreignKey':_0x302a('0x20a')});db[_0x302a('0x109')]['belongsToMany'](db[_0x302a('0xe5')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0x302a('0x10f')][_0x302a('0x122')](db[_0x302a('0x13')],{'as':_0x302a('0x20b'),'foreignKey':_0x302a('0x113'),'onDelete':'cascade','hooks':!![]});db[_0x302a('0x160')][_0x302a('0x111')](db[_0x302a('0xc4')],{'as':_0x302a('0xc4'),'onDelete':_0x302a('0x162')});db['CloudProvider'][_0x302a('0x111')](db['MailServerIn'],{'as':_0x302a('0x163'),'onDelete':_0x302a('0x162')});db[_0x302a('0x160')][_0x302a('0x111')](db['MailServerOut'],{'as':_0x302a('0x164'),'onDelete':_0x302a('0x162')});module[_0x302a('0x20c')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x7a38=['../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','userSetting','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','ChatInteraction','ChatInteractions','FaxInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','OpenchannelInteractions','user_has_openchannel_interactions','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','moh_has_sounds','Members','Hoppers','HopperHistories','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','CloudProviderId','restrict','Imap','Smtp','Answers','Interactions','ListId','TemplateId','mandatoryDispositionPauseId','Agents','MailMessage','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','List','Dashboard','Dispositions','FaxAccountId','FaxApplication','FaxMessage','FaxInteractionId','Account','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsApplication','TagId','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatMessage','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CmCompany','Contacts','CmContactId','FaxInteractions','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','Intervals','ChatApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemTypeId','Hopper','AllConditions','TriggerAllId','Trigger','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','MetricId','Configurations','AccountId','SalesforceConfiguration','SubjectId','Descriptions','DescriptionId','Fields','Subject','Description','Field','VariableId','Subjects','FieldId','DeskAccount','int_desk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','Dynamics365Field','FromId','ToId','SessionId','JscriptyProject','ProjectId','user_has_teams','VoiceQueues','team_has_mail_queues','team_has_whatsapp_queues','VoicePrefix','TrunkId','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromUserId','FromAgent','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToUserId','ToChatQueueId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToQueue','ToSmsAccountId','CustomFields','HopperHistory','Queues','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','motion2','xcall','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','database','username','options','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model'];(function(_0x2a3d53,_0x473811){var _0x26921b=function(_0x2787dd){while(--_0x2787dd){_0x2a3d53['push'](_0x2a3d53['shift']());}};_0x26921b(++_0x473811);}(_0x7a38,0x1f0));var _0x87a3=function(_0x2b22e4,_0x26b1a8){_0x2b22e4=_0x2b22e4-0x0;var _0x15f1d1=_0x7a38[_0x2b22e4];return _0x15f1d1;};'use strict';var config=require(_0x87a3('0x0'));var Sequelize=require(_0x87a3('0x1'));var _=require(_0x87a3('0x2'));var jstz=require(_0x87a3('0x3'));var timezone=jstz['determine']();config[_0x87a3('0x1')]=_['defaultsDeep'](config[_0x87a3('0x1')],{'database':_0x87a3('0x4'),'username':_0x87a3('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x87a3('0x6'),'dialectOptions':{'charset':_0x87a3('0x7')},'logging':![],'timezone':timezone[_0x87a3('0x8')](),'define':{'charset':_0x87a3('0x9'),'collate':_0x87a3('0xa')}}});config[_0x87a3('0xb')]=_['defaultsDeep'](config[_0x87a3('0xb')],{'database':_0x87a3('0x4'),'username':'xcall','password':_0x87a3('0xc'),'options':{'host':_0x87a3('0xd'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x87a3('0x7')},'logging':![],'timezone':timezone[_0x87a3('0x8')](),'define':{'charset':_0x87a3('0x9'),'collate':_0x87a3('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x87a3('0xe')],config['sequelize']['username'],config['sequelize']['password'],config[_0x87a3('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x87a3('0xb')][_0x87a3('0xe')],config['sequelizeHistory'][_0x87a3('0xf')],config[_0x87a3('0xb')]['password'],config['sequelizeHistory'][_0x87a3('0x10')])};db['User']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x12'));db['VoiceChanSpy']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x13'));db[_0x87a3('0x14')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x15'));db['VoiceMusicOnHold']=db[_0x87a3('0x1')]['import'](_0x87a3('0x16'));db[_0x87a3('0x17')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x18'));db[_0x87a3('0x19')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x87a3('0x1a')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x1b'));db[_0x87a3('0x1c')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x1d'));db['VoiceMailMessage']=db['sequelize']['import'](_0x87a3('0x1e'));db['VoiceCallReport']=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x1f'));db[_0x87a3('0x20')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x21'));db[_0x87a3('0x22')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x23'));db['MemberReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x24'));db[_0x87a3('0x25')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x26'));db[_0x87a3('0x27')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x28'));db['UserVoiceQueueRt']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x29'));db[_0x87a3('0x2a')]=db[_0x87a3('0x1')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x87a3('0x2b')]=db[_0x87a3('0x1')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x87a3('0x2c')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/userMailQueue/userMailQueue.model');db[_0x87a3('0x2d')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x2e'));db[_0x87a3('0x2f')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x30'));db[_0x87a3('0x31')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x32'));db[_0x87a3('0x33')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x34'));db['MailServerOut']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x35'));db[_0x87a3('0x36')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/mailAccount/mailAccount.model');db[_0x87a3('0x37')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x38'));db[_0x87a3('0x39')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x3a'));db[_0x87a3('0x3b')]=db['sequelize']['import'](_0x87a3('0x3c'));db['MailMessage']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x3d'));db[_0x87a3('0x3e')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x3f'));db[_0x87a3('0x40')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x41'));db['Dashboard']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x42'));db[_0x87a3('0x43')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x44'));db[_0x87a3('0x45')]=db['sequelize']['import'](_0x87a3('0x46'));db['FaxApplication']=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db['sequelize']['import'](_0x87a3('0x47'));db['FaxMessage']=db['sequelize']['import'](_0x87a3('0x48'));db[_0x87a3('0x49')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x4a'));db[_0x87a3('0x4b')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x4c'));db[_0x87a3('0x4d')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize'][_0x87a3('0x11')]('../api/smsApplication/smsApplication.model');db[_0x87a3('0x4e')]=db[_0x87a3('0x1')]['import']('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x87a3('0x1')]['import'](_0x87a3('0x4f'));db[_0x87a3('0x50')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x51'));db['OpenchannelAccount']=db[_0x87a3('0x1')]['import'](_0x87a3('0x52'));db[_0x87a3('0x53')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x54'));db[_0x87a3('0x55')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x56'));db[_0x87a3('0x57')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x58'));db[_0x87a3('0x59')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x5a'));db[_0x87a3('0x5b')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x5c'));db['OpenchannelQueueReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x5d'));db[_0x87a3('0x5e')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x5f'));db['ChatInteraction']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x60'));db['ChatMessage']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x61'));db[_0x87a3('0x62')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x63'));db[_0x87a3('0x64')]=db['sequelize'][_0x87a3('0x11')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db['sequelize']['import'](_0x87a3('0x65'));db[_0x87a3('0x66')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x67'));db['CmCompany']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x68'));db[_0x87a3('0x69')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x6a'));db[_0x87a3('0x6b')]=db['sequelize'][_0x87a3('0x11')]('../api/cmHopper/cmHopper.model');db[_0x87a3('0x6c')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x6d'));db[_0x87a3('0x6e')]=db['sequelize']['import'](_0x87a3('0x6f'));db[_0x87a3('0x70')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x71'));db[_0x87a3('0x72')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x73'));db[_0x87a3('0x74')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0x87a3('0x75')]=db[_0x87a3('0x1')]['import']('../api/action/action.model');db[_0x87a3('0x76')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x77'));db[_0x87a3('0x78')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x79'));db[_0x87a3('0x7a')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x7b'));db[_0x87a3('0x7c')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x7d'));db[_0x87a3('0x7e')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/interval/interval.model');db[_0x87a3('0x7f')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x80'));db[_0x87a3('0x81')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x82'));db[_0x87a3('0x83')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x84'));db['Schedule']=db[_0x87a3('0x1')]['import'](_0x87a3('0x85'));db[_0x87a3('0x86')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x87'));db[_0x87a3('0x88')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x89'));db['ContactItemType']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x8a'));db[_0x87a3('0x8b')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x8c'));db['CmHopperAdditionalPhone']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x8d'));db[_0x87a3('0x8e')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x8f'));db['Trigger']=db['sequelize'][_0x87a3('0x11')]('../api/trigger/trigger.model');db[_0x87a3('0x90')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x91'));db[_0x87a3('0x92')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x93'));db['IntegrationReport']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x94'));db['AnalyticCustomReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x95'));db[_0x87a3('0x96')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x97'));db[_0x87a3('0x98')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x99'));db[_0x87a3('0x9a')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x9b'));db[_0x87a3('0x9c')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x9d'));db['AnalyticTreeReport']=db[_0x87a3('0x1')]['import'](_0x87a3('0x9e'));db[_0x87a3('0x9f')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xa0'));db[_0x87a3('0xa1')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xa2'));db[_0x87a3('0xa3')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xa4'));db[_0x87a3('0xa5')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xa6'));db[_0x87a3('0xa7')]=db['sequelize']['import'](_0x87a3('0xa8'));db['DeskAccount']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xa9'));db[_0x87a3('0xaa')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xab'));db[_0x87a3('0xac')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xad'));db[_0x87a3('0xae')]=db['sequelize'][_0x87a3('0x11')]('../api/intZohoAccount/intZohoAccount.model');db[_0x87a3('0xaf')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xb0'));db[_0x87a3('0xb1')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xb2'));db[_0x87a3('0xb3')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xb4'));db[_0x87a3('0xb5')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xb6'));db[_0x87a3('0xb7')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xb8'));db[_0x87a3('0xb9')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xba'));db['FreshdeskConfiguration']=db[_0x87a3('0x1')]['import'](_0x87a3('0xbb'));db['FreshdeskField']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xbc'));db[_0x87a3('0xbd')]=db[_0x87a3('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x87a3('0xbe')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xbf'));db[_0x87a3('0xc0')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0x87a3('0xc1')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xc2'));db[_0x87a3('0xc3')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xc4'));db[_0x87a3('0xc5')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/intServicenowField/intServicenowField.model');db[_0x87a3('0xc6')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xc7'));db[_0x87a3('0xc8')]=db[_0x87a3('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xc9'));db[_0x87a3('0xca')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xcb'));db[_0x87a3('0xcc')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xcd'));db[_0x87a3('0xce')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xcf'));db[_0x87a3('0x92')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x93'));db['Network']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xd0'));db[_0x87a3('0xd1')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xd2'));db[_0x87a3('0xd3')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xd4'));db[_0x87a3('0xd5')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xd6'));db[_0x87a3('0xd7')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xd8'));db[_0x87a3('0xd9')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x87a3('0xda')]=db['sequelize'][_0x87a3('0x11')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xdb'));db[_0x87a3('0xdc')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xdd'));db['JscriptyProject']=db[_0x87a3('0x1')]['import'](_0x87a3('0xde'));db[_0x87a3('0xdf')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xe0'));db[_0x87a3('0xe1')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xe2'));db[_0x87a3('0xe3')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xe4'));db['SquareRecording']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xe5'));db[_0x87a3('0xe6')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xe7'));db[_0x87a3('0xe8')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/team/team.model');db[_0x87a3('0xe9')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xea'));db[_0x87a3('0xeb')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/campaign/campaign.model');db[_0x87a3('0xec')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xed'));db[_0x87a3('0xee')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xef'));db[_0x87a3('0xf0')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xf1'));db[_0x87a3('0xf2')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xf3'));db[_0x87a3('0xf4')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xf5'));db['FaxTransferReport']=db['sequelize']['import'](_0x87a3('0xf6'));db['OpenchannelTransferReport']=db['sequelize']['import'](_0x87a3('0xf7'));db[_0x87a3('0xf8')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0x87a3('0xf9')]=db['sequelize']['import'](_0x87a3('0xfa'));db['VoicePrefix']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xfb'));db[_0x87a3('0xfc')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xfd'));db[_0x87a3('0xfe')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xff'));db[_0x87a3('0x100')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x101'));db[_0x87a3('0x102')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x103'));db['WhatsappAccount']=db['sequelize']['import'](_0x87a3('0x104'));db[_0x87a3('0x105')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/whatsappApplication/whatsappApplication.model');db[_0x87a3('0x106')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x107'));db[_0x87a3('0x108')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x109'));db[_0x87a3('0x10a')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x10b'));db[_0x87a3('0x10c')]=db[_0x87a3('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x87a3('0x10d')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x10e'));db[_0x87a3('0x10f')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x110'));db[_0x87a3('0x111')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x112'));db[_0x87a3('0x113')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x114'));db['UserVoicePrefix']=db[_0x87a3('0x1')]['import'](_0x87a3('0x115'));db[_0x87a3('0x116')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x117'));db[_0x87a3('0x118')][_0x87a3('0x119')](db[_0x87a3('0x1c')],{'as':_0x87a3('0x1c'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x11b')});db['User'][_0x87a3('0x119')](db[_0x87a3('0x116')],{'as':_0x87a3('0x11c'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x11b')});db['User'][_0x87a3('0x11d')](db[_0x87a3('0x19')],{'as':_0x87a3('0x11e'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x11f')],{'as':_0x87a3('0x120'),'foreignKey':'UserId'});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'as':_0x87a3('0x122'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db[_0x87a3('0x118')]['hasMany'](db[_0x87a3('0x6e')],{'as':_0x87a3('0x123'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x72')],{'as':'ReportAgentPreview','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x55')],{'as':'OpenchannelInteractions','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')]['hasMany'](db[_0x87a3('0x124')],{'as':_0x87a3('0x125'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x4e')],{'as':'SmsInteractions','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x126')],{'as':'FaxInteractions','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x127'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x106')],{'as':_0x87a3('0x128'),'foreignKey':'UserId'});db['User'][_0x87a3('0x11d')](db[_0x87a3('0x102')],{'as':_0x87a3('0x129'),'foreignKey':_0x87a3('0x12a')});db['User'][_0x87a3('0x12b')](db[_0x87a3('0xfc')],{'as':'UserProfile','foreignKey':_0x87a3('0x12c')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x12e')],{'as':_0x87a3('0x12f'),'through':_0x87a3('0x130')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x69')],{'as':'Contacts','through':_0x87a3('0x131')});db['User']['belongsToMany'](db[_0x87a3('0xf9')],{'as':_0x87a3('0x132'),'through':_0x87a3('0x133')});db['User']['belongsToMany'](db[_0x87a3('0xe8')],{'through':'user_has_teams'});db['User'][_0x87a3('0x12d')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x127'),'through':_0x87a3('0x134')});db['User'][_0x87a3('0x12d')](db[_0x87a3('0x124')],{'as':_0x87a3('0x125'),'through':_0x87a3('0x135')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x126')],{'as':'FaxInteractions','through':_0x87a3('0x136')});db['User']['belongsToMany'](db['SmsInteraction'],{'as':_0x87a3('0x137'),'through':'user_has_sms_interactions'});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x55')],{'as':_0x87a3('0x138'),'through':_0x87a3('0x139')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x106')],{'as':_0x87a3('0x128'),'through':'user_has_whatsapp_interactions'});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x17')],{'as':'VoiceQueues','through':_0x87a3('0x2a'),'required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db['VoicePrefix'],{'as':_0x87a3('0x13a'),'through':_0x87a3('0x13b'),'required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x37')],{'as':_0x87a3('0x13c'),'through':_0x87a3('0x2c'),'required':![]});db['User'][_0x87a3('0x12d')](db[_0x87a3('0x64')],{'as':_0x87a3('0x13d'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x87a3('0x118')]['belongsToMany'](db['FaxQueue'],{'as':_0x87a3('0x13e'),'through':_0x87a3('0x2d'),'required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x50')],{'as':_0x87a3('0x13f'),'through':'UserSmsQueue','required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x59')],{'as':_0x87a3('0x140'),'through':_0x87a3('0x2f'),'required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x10d')],{'as':_0x87a3('0x141'),'through':_0x87a3('0x31'),'required':![]});db['User']['belongsToMany'](db[_0x87a3('0xf9')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x87a3('0x142')});db['User'][_0x87a3('0x12d')](db[_0x87a3('0x45')],{'as':_0x87a3('0x143'),'through':_0x87a3('0x144')});db[_0x87a3('0x118')]['belongsToMany'](db[_0x87a3('0x36')],{'as':_0x87a3('0x145'),'through':_0x87a3('0x146')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x147')],{'as':_0x87a3('0x148'),'through':'user_has_openchannel_accounts'});db[_0x87a3('0x118')]['belongsToMany'](db[_0x87a3('0x4d')],{'as':'SmsAccounts','through':_0x87a3('0x149')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x14a')],{'as':_0x87a3('0x14b'),'through':_0x87a3('0x14c')});db[_0x87a3('0x118')]['belongsToMany'](db[_0x87a3('0xe3')],{'as':_0x87a3('0x14d'),'through':_0x87a3('0x14e')});db[_0x87a3('0x14f')][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'as':_0x87a3('0x150'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x151')});db['VoiceContext'][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x121')][_0x87a3('0x11d')](db['VoiceExtension'],{'as':_0x87a3('0x152'),'onDelete':'cascade'});db[_0x87a3('0x153')]['belongsToMany'](db[_0x87a3('0x86')],{'as':'Sounds','through':_0x87a3('0x154')});db[_0x87a3('0x17')][_0x87a3('0x11d')](db[_0x87a3('0x11f')],{'as':_0x87a3('0x155'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x87a3('0x6b')],{'as':_0x87a3('0x156'),'foreignKey':'VoiceQueueId'});db[_0x87a3('0x17')][_0x87a3('0x11d')](db['CmHopperFinal'],{'as':_0x87a3('0x123'),'foreignKey':'VoiceQueueId'});db[_0x87a3('0x17')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':_0x87a3('0x157'),'foreignKey':_0x87a3('0x158')});db[_0x87a3('0x17')][_0x87a3('0x11d')](db[_0x87a3('0x72')],{'as':_0x87a3('0x72'),'foreignKey':_0x87a3('0x158')});db[_0x87a3('0x17')][_0x87a3('0x11d')](db[_0x87a3('0x6c')],{'as':_0x87a3('0x159'),'foreignKey':'VoiceQueueId'});db[_0x87a3('0x17')]['hasMany'](db[_0x87a3('0xd9')],{'as':_0x87a3('0x15a'),'foreignKey':_0x87a3('0x158')});db[_0x87a3('0x17')][_0x87a3('0x12b')](db['Trunk'],{'as':_0x87a3('0x25'),'foreignKey':'TrunkId'});db[_0x87a3('0x17')][_0x87a3('0x12b')](db[_0x87a3('0x25')],{'as':_0x87a3('0x15b'),'foreignKey':_0x87a3('0x15c')});db[_0x87a3('0x17')]['belongsTo'](db['Interval'],{'as':_0x87a3('0x7e'),'foreignKey':_0x87a3('0x15d')});db[_0x87a3('0x17')][_0x87a3('0x12b')](db[_0x87a3('0x7f')],{'as':_0x87a3('0x15e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x87a3('0x17')][_0x87a3('0x12d')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x132'),'through':_0x87a3('0x15f')});db[_0x87a3('0x17')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':'Agents','through':_0x87a3('0x2a')});db[_0x87a3('0x17')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'as':_0x87a3('0x160'),'through':_0x87a3('0x111')});db[_0x87a3('0x17')][_0x87a3('0x12d')](db['CmList'],{'as':_0x87a3('0x161'),'through':_0x87a3('0x162')});db[_0x87a3('0x19')]['belongsTo'](db[_0x87a3('0x118')],{'as':_0x87a3('0x118'),'foreignKey':_0x87a3('0x11b')});db['ScreenRecording'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x118'),'foreignKey':'UserId'});db[_0x87a3('0x1c')][_0x87a3('0x11d')](db['VoiceMailMessage'],{'as':_0x87a3('0x163'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x164'),'sourceKey':_0x87a3('0x165')});db[_0x87a3('0x166')][_0x87a3('0x12b')](db[_0x87a3('0x1c')],{'foreignKey':_0x87a3('0x164'),'targetKey':_0x87a3('0x165')});db[_0x87a3('0x167')][_0x87a3('0x11d')](db[_0x87a3('0x22')],{'as':_0x87a3('0x168'),'foreignKey':_0x87a3('0x169'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x87a3('0x20')],{'as':_0x87a3('0x16a'),'foreignKey':_0x87a3('0x169'),'constraints':![]});db[_0x87a3('0x167')]['belongsTo'](db[_0x87a3('0x118')],{'as':'User','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x167')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x33')]['belongsTo'](db[_0x87a3('0x36')],{'as':_0x87a3('0x36'),'foreignKey':'MailAccountId'});db[_0x87a3('0x33')][_0x87a3('0x12b')](db[_0x87a3('0x10f')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':'restrict'});db['MailServerOut'][_0x87a3('0x12b')](db[_0x87a3('0x36')],{'as':_0x87a3('0x36'),'foreignKey':_0x87a3('0x16d')});db[_0x87a3('0x16e')]['belongsTo'](db[_0x87a3('0x10f')],{'as':_0x87a3('0x10f'),'foreignKey':_0x87a3('0x16f'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x36')][_0x87a3('0x119')](db[_0x87a3('0x33')],{'as':_0x87a3('0x171'),'onDelete':'cascade'});db[_0x87a3('0x36')][_0x87a3('0x119')](db[_0x87a3('0x16e')],{'as':_0x87a3('0x172'),'onDelete':'cascade'});db[_0x87a3('0x36')][_0x87a3('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x87a3('0x16d'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x36')][_0x87a3('0x11d')](db['CannedAnswer'],{'as':_0x87a3('0x173'),'foreignKey':_0x87a3('0x16d')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':_0x87a3('0x163'),'foreignKey':_0x87a3('0x16d')});db[_0x87a3('0x36')][_0x87a3('0x11d')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x174')});db[_0x87a3('0x36')][_0x87a3('0x11d')](db[_0x87a3('0x3e')],{'as':_0x87a3('0x152')});db[_0x87a3('0x36')][_0x87a3('0x12b')](db['CmList'],{'as':'List','foreignKey':_0x87a3('0x175')});db[_0x87a3('0x36')]['belongsTo'](db[_0x87a3('0x8e')],{'as':_0x87a3('0x8e'),'foreignKey':_0x87a3('0x176')});db[_0x87a3('0x36')][_0x87a3('0x12b')](db[_0x87a3('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0x87a3('0x177')});db[_0x87a3('0x36')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x146')});db[_0x87a3('0x37')]['belongsToMany'](db['User'],{'as':_0x87a3('0x178'),'through':_0x87a3('0x2c')});db[_0x87a3('0x37')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':'team_has_mail_queues','as':_0x87a3('0x160')});db[_0x87a3('0x3b')][_0x87a3('0x11d')](db[_0x87a3('0x179')],{'as':_0x87a3('0x163'),'onDelete':'cascade','foreignKey':_0x87a3('0x17a')});db[_0x87a3('0x3b')][_0x87a3('0x12b')](db['MailAccount'],{'as':'Account','foreignKey':_0x87a3('0x16d')});db[_0x87a3('0x3b')]['belongsTo'](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db['MailInteraction'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x3b')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x17c'),'as':_0x87a3('0x17d')});db[_0x87a3('0x3b')]['belongsToMany'](db[_0x87a3('0x88')],{'through':_0x87a3('0x17c'),'as':_0x87a3('0x17e')});db[_0x87a3('0x3b')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':'Users','through':_0x87a3('0x134'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x87a3('0x11d')](db[_0x87a3('0xee')],{'as':_0x87a3('0x17f'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x179')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x118')});db[_0x87a3('0x179')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b')});db[_0x87a3('0x179')][_0x87a3('0x12b')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x180'),'foreignKey':_0x87a3('0x17a')});db[_0x87a3('0x179')][_0x87a3('0x12b')](db[_0x87a3('0x36')],{'as':'Account','foreignKey':_0x87a3('0x16d')});db[_0x87a3('0x179')]['belongsTo'](db[_0x87a3('0x5b')],{'as':_0x87a3('0x5b'),'foreignKey':_0x87a3('0x181')});db[_0x87a3('0x179')]['belongsTo'](db[_0x87a3('0x62')],{'as':'ChatOfflineMessage','foreignKey':_0x87a3('0x182')});db['MailApplication']['belongsTo'](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db['MailApplication'][_0x87a3('0x12b')](db[_0x87a3('0x37')],{'onDelete':'restrict'});db[_0x87a3('0x3e')][_0x87a3('0x12b')](db['MailAccount'],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x3e')][_0x87a3('0x12b')](db[_0x87a3('0x7e')],{'onDelete':'restrict','foreignKey':_0x87a3('0x15d')});db[_0x87a3('0x3e')][_0x87a3('0x12b')](db['Tag'],{'onDelete':_0x87a3('0x170'),'foreignKey':'TagId'});db[_0x87a3('0x40')]['belongsTo'](db[_0x87a3('0x36')],{});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':'ListId'});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0x3b')],{});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0x179')],{});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{});db[_0x87a3('0x40')]['belongsTo'](db[_0x87a3('0x37')],{});db[_0x87a3('0x184')][_0x87a3('0x11d')](db[_0x87a3('0x43')],{'as':'Items','onDelete':'cascade'});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x7a')],{'as':_0x87a3('0x185'),'foreignKey':_0x87a3('0x186'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x78')],{'as':_0x87a3('0x173'),'foreignKey':'FaxAccountId'});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x126')],{'as':_0x87a3('0x174')});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x187')],{'as':'Applications'});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'as':'Exntensions','onDelete':_0x87a3('0x11a')});db[_0x87a3('0x45')][_0x87a3('0x11d')](db['FaxMessage'],{'as':'Messages'});db[_0x87a3('0x45')][_0x87a3('0x12b')](db[_0x87a3('0x25')],{'as':_0x87a3('0x25')});db['FaxAccount']['belongsTo'](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':'ListId'});db[_0x87a3('0x45')][_0x87a3('0x12b')](db[_0x87a3('0x7f')],{'as':_0x87a3('0x15e'),'foreignKey':_0x87a3('0x177')});db[_0x87a3('0x45')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x144')});db['FaxApplication']['belongsTo'](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db['FaxApplication'][_0x87a3('0x12b')](db[_0x87a3('0x49')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x187')]['belongsTo'](db['FaxAccount'],{'onDelete':_0x87a3('0x170')});db['FaxApplication'][_0x87a3('0x12b')](db[_0x87a3('0x88')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x87a3('0x126')][_0x87a3('0x11d')](db[_0x87a3('0x188')],{'as':_0x87a3('0x163'),'onDelete':'cascade','foreignKey':_0x87a3('0x189')});db[_0x87a3('0x126')][_0x87a3('0x12b')](db[_0x87a3('0x45')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x186')});db[_0x87a3('0x126')]['belongsTo'](db[_0x87a3('0x69')],{'as':'Contact','foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x126')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x126')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x18b'),'as':_0x87a3('0x17d')});db[_0x87a3('0x126')][_0x87a3('0x12d')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x87a3('0x17e')});db['FaxInteraction']['belongsToMany'](db['User'],{'as':_0x87a3('0x18c'),'through':'user_has_fax_interactions','foreignKey':_0x87a3('0x189')});db['FaxMessage']['belongsTo'](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x118')});db[_0x87a3('0x188')][_0x87a3('0x12b')](db['FaxInteraction'],{'as':_0x87a3('0x180'),'foreignKey':_0x87a3('0x189')});db['FaxMessage'][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b')});db[_0x87a3('0x188')]['belongsTo'](db[_0x87a3('0xee')],{'as':_0x87a3('0xee'),'foreignKey':_0x87a3('0x18d')});db['FaxMessage']['belongsTo'](db['FaxAccount'],{'as':_0x87a3('0x18a'),'foreignKey':'FaxAccountId'});db[_0x87a3('0x49')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x2d')});db[_0x87a3('0x49')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':_0x87a3('0x18e'),'as':'Teams'});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db[_0x87a3('0x45')],{});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db['CmContact'],{'as':'Contact','foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db[_0x87a3('0x126')],{});db[_0x87a3('0x4b')]['belongsTo'](db['FaxMessage'],{});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db['User'],{});db[_0x87a3('0x4b')]['belongsTo'](db[_0x87a3('0x49')],{});db[_0x87a3('0x4d')][_0x87a3('0x11d')](db[_0x87a3('0x7a')],{'as':'Dispositions','foreignKey':_0x87a3('0x18f'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x4d')][_0x87a3('0x11d')](db[_0x87a3('0x78')],{'as':_0x87a3('0x173'),'foreignKey':_0x87a3('0x18f')});db[_0x87a3('0x4d')][_0x87a3('0x11d')](db[_0x87a3('0x190')],{'as':'Messages','foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0x87a3('0x4e')],{'as':_0x87a3('0x174')});db[_0x87a3('0x4d')]['hasMany'](db[_0x87a3('0x191')],{'as':_0x87a3('0x152')});db[_0x87a3('0x4d')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':'List','foreignKey':_0x87a3('0x175')});db[_0x87a3('0x4d')]['belongsTo'](db[_0x87a3('0x7f')],{'as':_0x87a3('0x15e'),'foreignKey':_0x87a3('0x177')});db[_0x87a3('0x4d')]['belongsToMany'](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':'user_has_sms_accounts'});db[_0x87a3('0x191')]['belongsTo'](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x191')]['belongsTo'](db[_0x87a3('0x50')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x191')][_0x87a3('0x12b')](db[_0x87a3('0x4d')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x191')]['belongsTo'](db['Interval'],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x15d')});db['SmsApplication'][_0x87a3('0x12b')](db['Tag'],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x192')});db[_0x87a3('0x4e')][_0x87a3('0x11d')](db[_0x87a3('0x190')],{'as':_0x87a3('0x163'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x193')});db[_0x87a3('0x4e')]['belongsTo'](db['SmsAccount'],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x18f')});db[_0x87a3('0x4e')]['belongsTo'](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x4e')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x4e')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x194'),'as':_0x87a3('0x17d')});db[_0x87a3('0x4e')]['belongsToMany'](db[_0x87a3('0x88')],{'through':'sms_interaction_has_tags','as':_0x87a3('0x17e')});db[_0x87a3('0x4e')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x18c'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x87a3('0x118')],{'as':_0x87a3('0x118')});db[_0x87a3('0x190')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':'Contact'});db[_0x87a3('0x190')][_0x87a3('0x12b')](db[_0x87a3('0x4e')],{'onDelete':_0x87a3('0x11a'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x87a3('0x190')][_0x87a3('0x12b')](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x87a3('0x50')]['belongsToMany'](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x195'),'foreignKey':_0x87a3('0x196')});db['SmsQueue'][_0x87a3('0x12d')](db['Team'],{'through':_0x87a3('0x197'),'as':_0x87a3('0x160')});db[_0x87a3('0x147')][_0x87a3('0x11d')](db['Disposition'],{'as':_0x87a3('0x185'),'foreignKey':_0x87a3('0x198'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x147')][_0x87a3('0x11d')](db[_0x87a3('0x78')],{'as':_0x87a3('0x173'),'foreignKey':'OpenchannelAccountId'});db[_0x87a3('0x147')][_0x87a3('0x11d')](db[_0x87a3('0x55')],{'as':_0x87a3('0x174'),'foreignKey':_0x87a3('0x198')});db[_0x87a3('0x147')][_0x87a3('0x11d')](db['OpenchannelMessage'],{'as':_0x87a3('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x87a3('0x147')]['hasMany'](db[_0x87a3('0x53')],{'as':_0x87a3('0x152'),'foreignKey':_0x87a3('0x198')});db[_0x87a3('0x147')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0x147')][_0x87a3('0x12b')](db['Pause'],{'as':_0x87a3('0x15e'),'foreignKey':_0x87a3('0x177')});db[_0x87a3('0x147')][_0x87a3('0x12d')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x53')][_0x87a3('0x12b')](db['OpenchannelQueue'],{'onDelete':_0x87a3('0x170'),'foreignKey':'OpenchannelQueueId'});db[_0x87a3('0x53')][_0x87a3('0x12b')](db['OpenchannelAccount'],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x198')});db['OpenchannelApplication'][_0x87a3('0x12b')](db[_0x87a3('0x7e')],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x15d')});db[_0x87a3('0x53')][_0x87a3('0x12b')](db[_0x87a3('0x88')],{'onDelete':_0x87a3('0x170'),'foreignKey':'TagId'});db[_0x87a3('0x55')][_0x87a3('0x11d')](db[_0x87a3('0x57')],{'as':_0x87a3('0x163'),'onDelete':'cascade','foreignKey':_0x87a3('0x199')});db[_0x87a3('0x55')][_0x87a3('0x12b')](db[_0x87a3('0x147')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x55')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x55')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x19a'),'as':_0x87a3('0x17d')});db[_0x87a3('0x55')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x19a'),'as':'ThroughTags'});db[_0x87a3('0x55')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x18c'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x118')});db[_0x87a3('0x57')][_0x87a3('0x12b')](db['CmContact'],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b')});db[_0x87a3('0x57')]['belongsTo'](db[_0x87a3('0x55')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x180'),'foreignKey':_0x87a3('0x199')});db['OpenchannelMessage']['belongsTo'](db[_0x87a3('0xee')],{'as':_0x87a3('0xee'),'foreignKey':_0x87a3('0x18d')});db[_0x87a3('0x57')][_0x87a3('0x12b')](db[_0x87a3('0x147')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x198')});db[_0x87a3('0x59')]['belongsToMany'](db[_0x87a3('0x118')],{'as':'Agents','through':_0x87a3('0x2f'),'foreignKey':_0x87a3('0x19b')});db['OpenchannelQueue']['belongsToMany'](db[_0x87a3('0xe8')],{'through':_0x87a3('0x19c'),'as':_0x87a3('0x160')});db['ChatWebsite'][_0x87a3('0x11d')](db[_0x87a3('0x7a')],{'as':_0x87a3('0x185'),'foreignKey':_0x87a3('0x181'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x5b')][_0x87a3('0x11d')](db[_0x87a3('0x78')],{'as':_0x87a3('0x173'),'foreignKey':_0x87a3('0x181')});db[_0x87a3('0x5b')][_0x87a3('0x11d')](db[_0x87a3('0x66')],{'as':_0x87a3('0x19d')});db[_0x87a3('0x5b')][_0x87a3('0x11d')](db['ChatInteraction'],{'as':_0x87a3('0x174')});db['ChatWebsite'][_0x87a3('0x11d')](db[_0x87a3('0x5e')],{'as':_0x87a3('0x152')});db[_0x87a3('0x5b')][_0x87a3('0x11d')](db[_0x87a3('0x19e')],{'as':_0x87a3('0x163')});db[_0x87a3('0x5b')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':'List','foreignKey':_0x87a3('0x175')});db[_0x87a3('0x5b')][_0x87a3('0x12b')](db['Interval'],{'as':_0x87a3('0x7e'),'foreignKey':_0x87a3('0x15d')});db['ChatWebsite'][_0x87a3('0x12b')](db['MailAccount'],{'as':_0x87a3('0x36'),'foreignKey':'MailAccountId'});db['ChatWebsite']['belongsTo'](db[_0x87a3('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x87a3('0x5b')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x142')});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db[_0x87a3('0x147')],{});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db['CmList'],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':'ContactId'});db[_0x87a3('0x19f')]['belongsTo'](db[_0x87a3('0x55')],{});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db[_0x87a3('0x57')],{});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{});db[_0x87a3('0x19f')]['belongsTo'](db[_0x87a3('0x59')],{});db['ChatApplication'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x1a0'),'foreignKey':'UserId','onDelete':_0x87a3('0x170')});db['ChatApplication'][_0x87a3('0x12b')](db[_0x87a3('0x64')],{'as':_0x87a3('0x1a1'),'foreignKey':_0x87a3('0x1a2'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x5e')][_0x87a3('0x12b')](db[_0x87a3('0x5b')],{'as':'Website','foreignKey':_0x87a3('0x181'),'onDelete':_0x87a3('0x170')});db['ChatApplication']['belongsTo'](db[_0x87a3('0x88')],{'onDelete':_0x87a3('0x170'),'foreignKey':'TagId'});db['ChatInteraction'][_0x87a3('0x11d')](db[_0x87a3('0x19e')],{'as':_0x87a3('0x163'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1a3')});db['ChatInteraction'][_0x87a3('0x12b')](db['ChatWebsite'],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x181')});db['ChatInteraction'][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':'Contact','foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x124')]['belongsTo'](db[_0x87a3('0x118')],{'as':'Owner','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x124')]['belongsToMany'](db[_0x87a3('0x88')],{'through':_0x87a3('0x1a4'),'as':_0x87a3('0x17d')});db[_0x87a3('0x124')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x1a4'),'as':_0x87a3('0x17e')});db[_0x87a3('0x124')]['belongsToMany'](db[_0x87a3('0x118')],{'as':_0x87a3('0x18c'),'through':_0x87a3('0x135'),'foreignKey':'ChatInteractionId'});db[_0x87a3('0x19e')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x118')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b'),'foreignKey':'ContactId'});db[_0x87a3('0x19e')][_0x87a3('0x12b')](db[_0x87a3('0x124')],{'onDelete':'cascade','as':_0x87a3('0x180'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x87a3('0x12b')](db[_0x87a3('0xee')],{'as':_0x87a3('0xee'),'foreignKey':_0x87a3('0x18d')});db[_0x87a3('0x19e')]['belongsTo'](db[_0x87a3('0x5b')],{'as':'Account','foreignKey':_0x87a3('0x181')});db[_0x87a3('0x62')][_0x87a3('0x11d')](db[_0x87a3('0xee')],{'as':_0x87a3('0x17f'),'foreignKey':_0x87a3('0x182'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db[_0x87a3('0x62')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x62')][_0x87a3('0x12b')](db[_0x87a3('0x5b')],{'as':_0x87a3('0x18a'),'foreignKey':'ChatWebsiteId'});db[_0x87a3('0x64')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x2b'),'hooks':!![]});db[_0x87a3('0x64')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':_0x87a3('0x1a5'),'as':'Teams'});db[_0x87a3('0x12e')]['hasMany'](db[_0x87a3('0xd3')],{'as':_0x87a3('0x163'),'foreignKey':_0x87a3('0x1a6'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x12e')][_0x87a3('0x12d')](db['User'],{'as':_0x87a3('0x155'),'through':'chat_group_has_users'});db[_0x87a3('0x66')]['belongsTo'](db[_0x87a3('0x5b')],{'as':_0x87a3('0x1a7'),'foreignKey':_0x87a3('0x181')});db[_0x87a3('0x1a8')]['hasMany'](db[_0x87a3('0x69')],{'as':_0x87a3('0x1a9'),'foreignKey':'CompanyId'});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x8b')],{'as':'Phones','foreignKey':_0x87a3('0x1aa')});db['CmContact'][_0x87a3('0x11d')](db[_0x87a3('0x6b')],{'as':_0x87a3('0x156'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x69')]['hasMany'](db[_0x87a3('0x6e')],{'as':_0x87a3('0x123'),'foreignKey':'ContactId'});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':_0x87a3('0x157'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db['ReportAgentPreview'],{'as':_0x87a3('0x72'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0xd9')],{'as':'JscriptySessions','foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x55')],{'as':_0x87a3('0x138'),'foreignKey':_0x87a3('0x16c'),'onDelete':'restrict'});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x124')],{'as':_0x87a3('0x125'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x4e')],{'as':_0x87a3('0x137'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x126')],{'as':_0x87a3('0x1ab'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x170')});db['CmContact'][_0x87a3('0x11d')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x127'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x170')});db['CmContact'][_0x87a3('0x12b')](db[_0x87a3('0x1a8')],{'as':_0x87a3('0x1ac'),'foreignKey':'CompanyId'});db[_0x87a3('0x69')]['belongsTo'](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':'ListId','onDelete':'cascade'});db['CmContact'][_0x87a3('0x12d')](db['User'],{'as':'Users','through':_0x87a3('0x131')});db[_0x87a3('0x69')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'as':'Tags','through':_0x87a3('0x1ad')});db[_0x87a3('0x69')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x1ad'),'as':_0x87a3('0x17e')});db[_0x87a3('0x6b')][_0x87a3('0x11d')](db[_0x87a3('0x1ae')],{'as':_0x87a3('0x1af'),'foreignKey':_0x87a3('0x1b0')});db[_0x87a3('0x6b')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6b')][_0x87a3('0x12b')](db['CmList'],{'as':'List','foreignKey':_0x87a3('0x175'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6b')]['belongsTo'](db[_0x87a3('0x118')],{'as':_0x87a3('0x1a0'),'foreignKey':'UserId'});db[_0x87a3('0x6b')][_0x87a3('0x12b')](db[_0x87a3('0x17')],{'as':_0x87a3('0x1a1'),'foreignKey':_0x87a3('0x158'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6b')][_0x87a3('0x12b')](db[_0x87a3('0xeb')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6b')]['belongsTo'](db[_0x87a3('0x118')],{'as':'Owner','foreignKey':_0x87a3('0x1b1')});db[_0x87a3('0x6c')][_0x87a3('0x12b')](db['CmContact'],{'as':_0x87a3('0x16b'),'foreignKey':'ContactId','onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6c')]['belongsTo'](db['CmList'],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175'),'onDelete':'cascade'});db[_0x87a3('0x6c')]['belongsTo'](db[_0x87a3('0x17')],{'as':_0x87a3('0x1a1'),'foreignKey':'VoiceQueueId','onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6c')][_0x87a3('0x12b')](db[_0x87a3('0xeb')],{'as':_0x87a3('0xeb'),'foreignKey':_0x87a3('0x1b2'),'onDelete':'cascade'});db[_0x87a3('0x76')][_0x87a3('0x11d')](db[_0x87a3('0x7c')],{'as':{'plural':_0x87a3('0x1b3'),'singular':_0x87a3('0x1b4')},'foreignKey':_0x87a3('0x1b5'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db[_0x87a3('0x76')][_0x87a3('0x11d')](db['Condition'],{'as':{'plural':_0x87a3('0x1b6'),'singular':_0x87a3('0x1b7')},'foreignKey':_0x87a3('0x1b8'),'onDelete':'cascade','hooks':!![]});db[_0x87a3('0x76')][_0x87a3('0x11d')](db[_0x87a3('0x75')],{'as':_0x87a3('0x1b9'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x87a3('0x7a')][_0x87a3('0x11d')](db[_0x87a3('0x7a')],{'as':_0x87a3('0x185'),'foreignKey':'ParentId','onDelete':_0x87a3('0x11a')});db['Interval']['hasMany'](db[_0x87a3('0x7e')],{'as':_0x87a3('0x1ba'),'foreignKey':_0x87a3('0x15d'),'onDelete':_0x87a3('0x11a'),'hooks':!![],'required':![]});db[_0x87a3('0x7e')]['hasMany'](db[_0x87a3('0x121')],{'as':_0x87a3('0x122'),'foreignKey':_0x87a3('0x15d'),'onDelete':'restrict'});db[_0x87a3('0x7e')][_0x87a3('0x11d')](db[_0x87a3('0x3e')],{'as':'MailApplications','foreignKey':'IntervalId'});db['Interval'][_0x87a3('0x11d')](db[_0x87a3('0x5e')],{'as':_0x87a3('0x1bb'),'foreignKey':'IntervalId'});db[_0x87a3('0x7e')]['hasMany'](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0x87a3('0x15d')});db['Interval'][_0x87a3('0x11d')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x87a3('0x15d')});db['Schedule'][_0x87a3('0x12b')](db['MailAccount'],{});db[_0x87a3('0x1bc')]['belongsTo'](db[_0x87a3('0x96')],{'foreignKey':_0x87a3('0x1bd')});db['Schedule'][_0x87a3('0x12b')](db[_0x87a3('0x1be')],{'foreignKey':_0x87a3('0x1bf')});db[_0x87a3('0x86')][_0x87a3('0x12d')](db[_0x87a3('0x153')],{'as':_0x87a3('0x1c0'),'through':'moh_has_sounds','onDelete':_0x87a3('0x170')});db[_0x87a3('0x88')]['belongsToMany'](db[_0x87a3('0x69')],{'through':_0x87a3('0x1ad')});db['Tag'][_0x87a3('0x12d')](db[_0x87a3('0x124')],{'through':'chat_interaction_has_tags'});db[_0x87a3('0x88')][_0x87a3('0x12d')](db['MailInteraction'],{'through':_0x87a3('0x17c')});db['Tag'][_0x87a3('0x12d')](db[_0x87a3('0x4e')],{'through':'sms_interaction_has_tags'});db[_0x87a3('0x88')][_0x87a3('0x12d')](db[_0x87a3('0x126')],{'through':_0x87a3('0x18b')});db[_0x87a3('0x88')][_0x87a3('0x12d')](db[_0x87a3('0x55')],{'through':'openchannel_interaction_has_tags'});db[_0x87a3('0x88')]['belongsToMany'](db[_0x87a3('0x106')],{'through':_0x87a3('0x1c1')});db[_0x87a3('0x8b')][_0x87a3('0x12b')](db[_0x87a3('0x1c2')],{'as':'ItemType','foreignKey':_0x87a3('0x1c3')});db[_0x87a3('0x1ae')][_0x87a3('0x12b')](db['CmHopper'],{'as':_0x87a3('0x1c4'),'foreignKey':_0x87a3('0x1b0')});db['CmContactHasItem']['belongsTo'](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':'CmContactId'});db['Trigger'][_0x87a3('0x11d')](db[_0x87a3('0x7c')],{'as':{'plural':_0x87a3('0x1c5'),'singular':'AllCondition'},'foreignKey':_0x87a3('0x1c6'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db[_0x87a3('0x1c7')][_0x87a3('0x11d')](db[_0x87a3('0x7c')],{'as':{'plural':_0x87a3('0x1c8'),'singular':_0x87a3('0x1c9')},'foreignKey':_0x87a3('0x1ca'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db['Trigger'][_0x87a3('0x11d')](db[_0x87a3('0x75')],{'as':_0x87a3('0x1b9'),'foreignKey':_0x87a3('0x1cb'),'onDelete':'cascade','hooks':!![]});db[_0x87a3('0x1be')]['hasMany'](db[_0x87a3('0x9c')],{'as':'Fields','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1bf'),'hooks':!![]});db[_0x87a3('0x96')][_0x87a3('0x11d')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x87a3('0x11a'),'foreignKey':'DefaultReportId'});db[_0x87a3('0x9a')][_0x87a3('0x11d')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x87a3('0x11a'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x87a3('0x12b')](db[_0x87a3('0x9a')],{'foreignKey':_0x87a3('0x1cc')});db[_0x87a3('0x9f')][_0x87a3('0x11d')](db['SalesforceConfiguration'],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0x1cf')][_0x87a3('0x11d')](db[_0x87a3('0xa1')],{'as':'Subjects','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0x1cf')][_0x87a3('0x11d')](db[_0x87a3('0xa1')],{'as':_0x87a3('0x1d1'),'onDelete':'cascade','foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0x1cf')]['hasMany'](db[_0x87a3('0xa1')],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':'FieldId'});db[_0x87a3('0x1cf')][_0x87a3('0x12b')](db[_0x87a3('0x9f')],{'as':'Account','foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xa1')][_0x87a3('0x11d')](db['SalesforceField'],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db['SalesforceField'][_0x87a3('0x11d')](db[_0x87a3('0xa1')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xa1')][_0x87a3('0x11d')](db[_0x87a3('0xa1')],{'as':_0x87a3('0x1d6'),'foreignKey':'FieldId'});db[_0x87a3('0xa1')][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':'Variable','foreignKey':_0x87a3('0x1d7')});db['SugarcrmAccount'][_0x87a3('0x11d')](db[_0x87a3('0xa5')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xa5')]['hasMany'](db[_0x87a3('0xa7')],{'as':_0x87a3('0x1d8'),'onDelete':'cascade','foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xa5')]['hasMany'](db[_0x87a3('0xa7')],{'as':_0x87a3('0x1d1'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d2')});db['SugarcrmConfiguration'][_0x87a3('0x11d')](db['SugarcrmField'],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d9')});db['SugarcrmConfiguration'][_0x87a3('0x12b')](db[_0x87a3('0xa3')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xa7')]['hasMany'](db[_0x87a3('0xa7')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xa7')]['hasMany'](db[_0x87a3('0xa7')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xa7')][_0x87a3('0x11d')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x87a3('0xa7')]['belongsTo'](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':'VariableId'});db[_0x87a3('0x1da')][_0x87a3('0x11d')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db['DeskConfiguration'][_0x87a3('0x11d')](db[_0x87a3('0xac')],{'as':_0x87a3('0x1d8'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d0')});db['DeskConfiguration'][_0x87a3('0x11d')](db[_0x87a3('0xac')],{'as':'Descriptions','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xaa')][_0x87a3('0x11d')](db['DeskField'],{'as':_0x87a3('0x1d3'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x87a3('0xaa')][_0x87a3('0x12b')](db[_0x87a3('0x1da')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xaa')][_0x87a3('0x12d')](db['Tag'],{'through':_0x87a3('0x1db')});db[_0x87a3('0xac')][_0x87a3('0x11d')](db['DeskField'],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db['DeskField']['hasMany'](db[_0x87a3('0xac')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xac')][_0x87a3('0x11d')](db[_0x87a3('0xac')],{'as':_0x87a3('0x1d6'),'foreignKey':'FieldId'});db['DeskField']['belongsTo'](db[_0x87a3('0x90')],{'as':'Variable','foreignKey':_0x87a3('0x1d7')});db[_0x87a3('0xae')][_0x87a3('0x11d')](db['ZohoConfiguration'],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xaf')][_0x87a3('0x11d')](db['ZohoField'],{'as':_0x87a3('0x1d8'),'onDelete':_0x87a3('0x11a'),'foreignKey':'SubjectId'});db[_0x87a3('0xaf')][_0x87a3('0x11d')](db[_0x87a3('0xb1')],{'as':_0x87a3('0x1d1'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xaf')][_0x87a3('0x11d')](db[_0x87a3('0xb1')],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d9')});db['ZohoConfiguration']['belongsTo'](db[_0x87a3('0xae')],{'as':'Account','foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xb1')][_0x87a3('0x11d')](db[_0x87a3('0xb1')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db['ZohoField'][_0x87a3('0x11d')](db[_0x87a3('0xb1')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db['ZohoField'][_0x87a3('0x11d')](db['ZohoField'],{'as':'Field','foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xb1')]['belongsTo'](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':'VariableId'});db[_0x87a3('0xb3')][_0x87a3('0x11d')](db[_0x87a3('0xb5')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xb5')][_0x87a3('0x11d')](db[_0x87a3('0xb7')],{'as':_0x87a3('0x1d8'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x87a3('0x11d')](db[_0x87a3('0xb7')],{'as':_0x87a3('0x1d1'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xb5')]['hasMany'](db['ZendeskField'],{'as':'Fields','foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xb5')]['belongsTo'](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xb5')][_0x87a3('0x12d')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x87a3('0xb7')][_0x87a3('0x11d')](db[_0x87a3('0xb7')],{'as':_0x87a3('0x1d4'),'foreignKey':'SubjectId'});db['ZendeskField']['hasMany'](db[_0x87a3('0xb7')],{'as':_0x87a3('0x1d5'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x87a3('0x11d')](db['ZendeskField'],{'as':_0x87a3('0x1d6'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xb7')][_0x87a3('0x12b')](db['Variable'],{'as':_0x87a3('0x90'),'foreignKey':_0x87a3('0x1d7')});db['FreshdeskAccount']['hasMany'](db[_0x87a3('0x1dc')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0x1dc')][_0x87a3('0x11d')](db[_0x87a3('0x1dd')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0x1dc')][_0x87a3('0x11d')](db[_0x87a3('0x1dd')],{'as':_0x87a3('0x1d1'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0x1dc')][_0x87a3('0x11d')](db['FreshdeskField'],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0x1dc')][_0x87a3('0x12b')](db[_0x87a3('0xb9')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0x1dc')]['belongsToMany'](db[_0x87a3('0x88')],{'through':_0x87a3('0x1de')});db['FreshdeskField'][_0x87a3('0x11d')](db[_0x87a3('0x1dd')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0x1dd')][_0x87a3('0x11d')](db['FreshdeskField'],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x87a3('0x1d6'),'foreignKey':_0x87a3('0x1d9')});db['FreshdeskField'][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':_0x87a3('0x1d7')});db[_0x87a3('0xbd')][_0x87a3('0x11d')](db[_0x87a3('0xbe')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xbe')][_0x87a3('0x11d')](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d8'),'foreignKey':'SubjectId'});db[_0x87a3('0xbe')][_0x87a3('0x11d')](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d1'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xbe')][_0x87a3('0x11d')](db['VtigerField'],{'as':_0x87a3('0x1d3'),'foreignKey':_0x87a3('0x1d9')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xc0')]['hasMany'](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d4'),'foreignKey':'SubjectId'});db['VtigerField'][_0x87a3('0x11d')](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xc0')][_0x87a3('0x11d')](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d6'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xc0')][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':_0x87a3('0x1d7')});db[_0x87a3('0xc1')][_0x87a3('0x11d')](db[_0x87a3('0xc3')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':'AccountId'});db[_0x87a3('0xc3')][_0x87a3('0x11d')](db['ServicenowField'],{'as':_0x87a3('0x1d8'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x87a3('0x11d')](db['ServicenowField'],{'as':_0x87a3('0x1d1'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xc3')]['hasMany'](db[_0x87a3('0xc5')],{'as':'Fields','foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xc3')]['belongsTo'](db[_0x87a3('0xc1')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xc5')][_0x87a3('0x11d')](db[_0x87a3('0xc5')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xc5')][_0x87a3('0x11d')](db['ServicenowField'],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db['ServicenowField']['hasMany'](db[_0x87a3('0xc5')],{'as':_0x87a3('0x1d6'),'foreignKey':'FieldId'});db['ServicenowField'][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':'Variable','foreignKey':_0x87a3('0x1d7')});db['Dynamics365Account'][_0x87a3('0x11d')](db[_0x87a3('0xc8')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db['Dynamics365Account']['belongsTo'](db['CloudProvider'],{'as':_0x87a3('0x10f'),'foreignKey':'CloudProviderId'});db[_0x87a3('0xc8')][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d8'),'onDelete':_0x87a3('0x11a'),'foreignKey':'SubjectId'});db[_0x87a3('0xc8')][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d1'),'onDelete':_0x87a3('0x11a'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xc8')][_0x87a3('0x12b')](db[_0x87a3('0xc6')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0x1df')][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':'Subject','foreignKey':'SubjectId'});db['Dynamics365Field'][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0x1df')]['hasMany'](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d6'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0x1df')][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':_0x87a3('0x1d7')});db[_0x87a3('0xca')][_0x87a3('0x11d')](db[_0x87a3('0xcc')],{'as':_0x87a3('0x1cd'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x87a3('0xcc')][_0x87a3('0x11d')](db[_0x87a3('0xce')],{'as':_0x87a3('0x1d8'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xcc')][_0x87a3('0x11d')](db[_0x87a3('0xce')],{'as':_0x87a3('0x1d1'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xcc')][_0x87a3('0x11d')](db[_0x87a3('0xce')],{'as':_0x87a3('0x1d3'),'foreignKey':_0x87a3('0x1d9')});db['FreshsalesConfiguration']['belongsTo'](db[_0x87a3('0xca')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xce')][_0x87a3('0x11d')](db[_0x87a3('0xce')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xce')][_0x87a3('0x11d')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x87a3('0x1d2')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x87a3('0x1d6'),'foreignKey':'FieldId'});db[_0x87a3('0xce')]['belongsTo'](db['Variable'],{'as':_0x87a3('0x90'),'foreignKey':'VariableId'});db[_0x87a3('0xd1')][_0x87a3('0x12b')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xd1')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0xd1')]['belongsTo'](db[_0x87a3('0x124')],{});db[_0x87a3('0xd1')]['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport']['belongsTo'](db[_0x87a3('0x118')],{});db[_0x87a3('0xd1')]['belongsTo'](db[_0x87a3('0x64')],{});db[_0x87a3('0xd3')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':'cascade','foreignKey':_0x87a3('0x1e0')});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0x87a3('0x1e1')});db['JscriptySessionReport'][_0x87a3('0x11d')](db['JscriptyQuestionReport'],{'foreignKey':_0x87a3('0x1e2'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0xd9')][_0x87a3('0x11d')](db[_0x87a3('0xd5')],{'foreignKey':_0x87a3('0x1e2'),'onDelete':_0x87a3('0x11a')});db['SmsQueueReport'][_0x87a3('0x12b')](db[_0x87a3('0x4d')],{});db[_0x87a3('0xda')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xda')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0xda')]['belongsTo'](db[_0x87a3('0x4e')],{});db[_0x87a3('0xda')][_0x87a3('0x12b')](db[_0x87a3('0x190')],{});db[_0x87a3('0xda')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{});db[_0x87a3('0xda')]['belongsTo'](db[_0x87a3('0x50')],{});db[_0x87a3('0x1e3')]['hasMany'](db[_0x87a3('0xd9')],{'foreignKey':_0x87a3('0x1e4')});db['JscriptyProject'][_0x87a3('0x11d')](db[_0x87a3('0xd7')],{'foreignKey':_0x87a3('0x1e4')});db[_0x87a3('0x1e3')][_0x87a3('0x11d')](db[_0x87a3('0xd5')],{'foreignKey':_0x87a3('0x1e4')});db[_0x87a3('0xe3')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x18c'),'through':_0x87a3('0x14e')});db['Team'][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x1e5')});db[_0x87a3('0xe8')][_0x87a3('0x12d')](db[_0x87a3('0x17')],{'through':_0x87a3('0x111'),'as':_0x87a3('0x1e6')});db[_0x87a3('0xe8')]['belongsToMany'](db[_0x87a3('0x37')],{'through':_0x87a3('0x1e7'),'as':_0x87a3('0x13c')});db[_0x87a3('0xe8')][_0x87a3('0x12d')](db[_0x87a3('0x64')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x87a3('0xe8')]['belongsToMany'](db['FaxQueue'],{'through':_0x87a3('0x18e'),'as':'FaxQueues'});db[_0x87a3('0xe8')]['belongsToMany'](db[_0x87a3('0x50')],{'through':_0x87a3('0x197'),'as':_0x87a3('0x13f')});db[_0x87a3('0xe8')][_0x87a3('0x12d')](db['OpenchannelQueue'],{'through':_0x87a3('0x19c'),'as':'OpenchannelQueues'});db[_0x87a3('0xe8')][_0x87a3('0x12d')](db[_0x87a3('0x10d')],{'through':_0x87a3('0x1e8'),'as':_0x87a3('0x141')});db['Team'][_0x87a3('0x12d')](db[_0x87a3('0x1e9')],{'through':_0x87a3('0x113'),'as':_0x87a3('0x13a')});db[_0x87a3('0xeb')]['hasMany'](db[_0x87a3('0x6b')],{'as':_0x87a3('0x156'),'foreignKey':_0x87a3('0x1b2')});db['Campaign'][_0x87a3('0x11d')](db['CmHopperFinal'],{'as':_0x87a3('0x123'),'foreignKey':_0x87a3('0x1b2')});db[_0x87a3('0xeb')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':_0x87a3('0x157'),'foreignKey':_0x87a3('0x1b2')});db[_0x87a3('0xeb')][_0x87a3('0x11d')](db[_0x87a3('0x6c')],{'as':_0x87a3('0x159'),'foreignKey':_0x87a3('0x1b2')});db[_0x87a3('0xeb')][_0x87a3('0x12b')](db[_0x87a3('0x25')],{'as':_0x87a3('0x25'),'foreignKey':_0x87a3('0x1ea')});db[_0x87a3('0xeb')]['belongsTo'](db[_0x87a3('0x25')],{'as':_0x87a3('0x15b'),'foreignKey':_0x87a3('0x15c')});db[_0x87a3('0xeb')][_0x87a3('0x12b')](db['Interval'],{'as':_0x87a3('0x7e'),'foreignKey':_0x87a3('0x15d')});db[_0x87a3('0xeb')][_0x87a3('0x12b')](db[_0x87a3('0xe3')],{'as':_0x87a3('0xe3'),'foreignKey':_0x87a3('0x1eb')});db[_0x87a3('0xeb')][_0x87a3('0x12d')](db['CmList'],{'as':_0x87a3('0x132'),'through':_0x87a3('0x1ec')});db[_0x87a3('0xeb')]['belongsToMany'](db[_0x87a3('0xf9')],{'as':_0x87a3('0x161'),'through':'campaigns_has_cm_blacklists'});db[_0x87a3('0xee')][_0x87a3('0x12b')](db[_0x87a3('0x62')],{'as':'ChatOfflineMessage','foreignKey':_0x87a3('0x182')});db['MailTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x179')],{});db['MailTransferReport'][_0x87a3('0x12b')](db['MailInteraction'],{});db['MailTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x36')],{'foreignKey':_0x87a3('0x1ed'),'as':'FromAccount'});db[_0x87a3('0xf2')]['belongsTo'](db['User'],{'foreignKey':_0x87a3('0x1ee'),'as':_0x87a3('0x1ef')});db['MailTransferReport']['belongsTo'](db[_0x87a3('0x118')],{'foreignKey':'ToUserId','as':_0x87a3('0x1f0')});db['MailTransferReport']['belongsTo'](db[_0x87a3('0x37')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x36')],{'foreignKey':_0x87a3('0x1f1'),'as':_0x87a3('0x1f2')});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db['ChatMessage'],{});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db[_0x87a3('0x124')],{});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db['ChatWebsite'],{'foreignKey':_0x87a3('0x1f3'),'as':_0x87a3('0x1f4')});db['ChatTransferReport']['belongsTo'](db[_0x87a3('0x118')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1f5'),'as':_0x87a3('0x1f0')});db[_0x87a3('0xf4')]['belongsTo'](db[_0x87a3('0x64')],{'foreignKey':_0x87a3('0x1f6'),'as':'ToQueue'});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x87a3('0x1f2')});db[_0x87a3('0x1f7')][_0x87a3('0x12b')](db[_0x87a3('0x188')],{});db['FaxTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x126')],{});db['FaxTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x45')],{'foreignKey':_0x87a3('0x1f8'),'as':_0x87a3('0x1f4')});db[_0x87a3('0x1f7')]['belongsTo'](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1ee'),'as':'FromAgent'});db[_0x87a3('0x1f7')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1f5'),'as':_0x87a3('0x1f0')});db[_0x87a3('0x1f7')][_0x87a3('0x12b')](db[_0x87a3('0x49')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0x87a3('0x1f7')][_0x87a3('0x12b')](db[_0x87a3('0x45')],{'foreignKey':_0x87a3('0x1f9'),'as':_0x87a3('0x1f2')});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db[_0x87a3('0x57')],{});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db[_0x87a3('0x55')],{});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db['OpenchannelAccount'],{'foreignKey':_0x87a3('0x1fb'),'as':_0x87a3('0x1f4')});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1f5'),'as':_0x87a3('0x1f0')});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db['OpenchannelQueue'],{'foreignKey':_0x87a3('0x1fc'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x87a3('0x12b')](db['OpenchannelAccount'],{'foreignKey':_0x87a3('0x1fd'),'as':_0x87a3('0x1f2')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db['SmsMessage'],{});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db[_0x87a3('0x4e')],{});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db[_0x87a3('0x4d')],{'foreignKey':_0x87a3('0x1fe'),'as':_0x87a3('0x1f4')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db['User'],{'foreignKey':_0x87a3('0x1ee'),'as':_0x87a3('0x1ef')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':'ToUserId','as':_0x87a3('0x1f0')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db['SmsQueue'],{'foreignKey':_0x87a3('0x1ff'),'as':_0x87a3('0x200')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db[_0x87a3('0x4d')],{'foreignKey':_0x87a3('0x201'),'as':_0x87a3('0x1f2')});db[_0x87a3('0xf9')]['hasMany'](db['Disposition'],{'as':_0x87a3('0x185'),'foreignKey':_0x87a3('0x175'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0xf9')][_0x87a3('0x11d')](db['CmCustomField'],{'as':_0x87a3('0x202'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xf9')][_0x87a3('0x11d')](db[_0x87a3('0x69')],{'as':_0x87a3('0x1a9'),'onDelete':_0x87a3('0x11a'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x87a3('0x6e')],{'as':'HopperFinals','foreignKey':_0x87a3('0x175')});db[_0x87a3('0xf9')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':_0x87a3('0x203'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xf9')][_0x87a3('0x11d')](db[_0x87a3('0x72')],{'as':_0x87a3('0x72'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xf9')][_0x87a3('0x12d')](db[_0x87a3('0x17')],{'as':_0x87a3('0x204'),'through':'voice_queues_has_cm_lists'});db[_0x87a3('0xf9')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x133')});db[_0x87a3('0x1e9')][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'as':_0x87a3('0x122'),'onDelete':_0x87a3('0x11a')});db['VoicePrefix']['belongsToMany'](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x13b')});db[_0x87a3('0x1e9')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':_0x87a3('0x113'),'as':'Teams'});db['UserProfile'][_0x87a3('0x11d')](db['User'],{'as':_0x87a3('0x18c'),'foreignKey':'userProfileId'});db[_0x87a3('0xfc')][_0x87a3('0x11d')](db[_0x87a3('0xfe')],{'as':'UserProfileSections','foreignKey':_0x87a3('0x12c'),'onDelete':'cascade'});db[_0x87a3('0xfe')][_0x87a3('0x11d')](db[_0x87a3('0x100')],{'as':'Resources','foreignKey':_0x87a3('0x205'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x14a')]['hasMany'](db[_0x87a3('0x7a')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x87a3('0x11a')});db['WhatsappAccount']['hasMany'](db['CannedAnswer'],{'as':_0x87a3('0x173'),'foreignKey':_0x87a3('0x206')});db['WhatsappAccount'][_0x87a3('0x11d')](db[_0x87a3('0x108')],{'as':'Messages','foreignKey':_0x87a3('0x206')});db['WhatsappAccount'][_0x87a3('0x11d')](db[_0x87a3('0x106')],{'as':_0x87a3('0x174')});db['WhatsappAccount'][_0x87a3('0x11d')](db[_0x87a3('0x105')],{'as':'Applications'});db[_0x87a3('0x14a')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0x87a3('0x14a')]['belongsTo'](db[_0x87a3('0x7f')],{'as':_0x87a3('0x15e'),'foreignKey':_0x87a3('0x177')});db[_0x87a3('0x14a')][_0x87a3('0x12d')](db['User'],{'as':_0x87a3('0x178'),'through':_0x87a3('0x14c')});db[_0x87a3('0x105')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x105')]['belongsTo'](db[_0x87a3('0x10d')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x105')][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x105')][_0x87a3('0x12b')](db[_0x87a3('0x7e')],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x15d')});db['WhatsappApplication'][_0x87a3('0x12b')](db['Tag'],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x192')});db['WhatsappInteraction']['hasMany'](db[_0x87a3('0x108')],{'as':'Messages','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x207')});db['WhatsappInteraction'][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x206')});db[_0x87a3('0x106')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0x87a3('0x106')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db['WhatsappInteraction']['belongsToMany'](db[_0x87a3('0x88')],{'through':_0x87a3('0x1c1'),'as':_0x87a3('0x17d')});db[_0x87a3('0x106')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x1c1'),'as':_0x87a3('0x17e')});db[_0x87a3('0x106')]['belongsToMany'](db[_0x87a3('0x118')],{'as':'Users','through':_0x87a3('0x208'),'foreignKey':_0x87a3('0x207')});db[_0x87a3('0x108')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x118')});db['WhatsappMessage']['belongsTo'](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b')});db[_0x87a3('0x108')][_0x87a3('0x12b')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x87a3('0x180'),'foreignKey':_0x87a3('0x207')});db[_0x87a3('0x108')][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x206')});db[_0x87a3('0x10a')][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{});db[_0x87a3('0x10a')][_0x87a3('0x12b')](db['CmList'],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0x10a')]['belongsTo'](db[_0x87a3('0x69')],{'as':'Contact','foreignKey':_0x87a3('0x16c')});db['WhatsappQueueReport'][_0x87a3('0x12b')](db[_0x87a3('0x106')],{});db[_0x87a3('0x10a')]['belongsTo'](db[_0x87a3('0x10d')],{});db[_0x87a3('0x10a')][_0x87a3('0x12b')](db[_0x87a3('0x108')],{});db[_0x87a3('0x10a')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{});db['WhatsappTransferReport'][_0x87a3('0x12b')](db['WhatsappMessage'],{});db[_0x87a3('0x10c')][_0x87a3('0x12b')](db[_0x87a3('0x106')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x87a3('0x209'),'as':_0x87a3('0x1f4')});db['WhatsappTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{'foreignKey':_0x87a3('0x20a'),'as':_0x87a3('0x1f2')});db['WhatsappTransferReport'][_0x87a3('0x12b')](db['WhatsappQueue'],{'foreignKey':_0x87a3('0x20b'),'as':'ToQueue'});db[_0x87a3('0x10c')][_0x87a3('0x12b')](db['User'],{'foreignKey':_0x87a3('0x1ee'),'as':_0x87a3('0x1ef')});db[_0x87a3('0x10c')]['belongsTo'](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1f5'),'as':_0x87a3('0x1f0')});db['WhatsappQueue'][_0x87a3('0x12d')](db['User'],{'as':_0x87a3('0x178'),'through':_0x87a3('0x31'),'foreignKey':_0x87a3('0x20c')});db[_0x87a3('0x10d')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':_0x87a3('0x1e8'),'as':_0x87a3('0x160')});db[_0x87a3('0x116')]['belongsTo'](db[_0x87a3('0x118')],{'as':_0x87a3('0x20d'),'foreignKey':_0x87a3('0x11b'),'onDelete':'cascade','hooks':!![]});db[_0x87a3('0x10f')]['hasOne'](db[_0x87a3('0xc6')],{'as':_0x87a3('0xc6'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x10f')]['hasOne'](db[_0x87a3('0x33')],{'as':'Imap','onDelete':'restrict'});db[_0x87a3('0x10f')][_0x87a3('0x119')](db[_0x87a3('0x16e')],{'as':_0x87a3('0x172'),'onDelete':_0x87a3('0x170')});module[_0x87a3('0x20e')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index cfaf8cf..cf5032b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80e9=['./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/jscripty/answers/reports','/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/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/voice/chanspy','./api/voiceChanSpy','use','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./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/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations'];(function(_0x37a505,_0x319129){var _0x5d094e=function(_0x5b78ea){while(--_0x5b78ea){_0x37a505['push'](_0x37a505['shift']());}};_0x5d094e(++_0x319129);}(_0x80e9,0x6c));var _0x980e=function(_0x4a6160,_0x4b24cb){_0x4a6160=_0x4a6160-0x0;var _0xb599e2=_0x80e9[_0x4a6160];return _0xb599e2;};'use strict';var path=require(_0x980e('0x0'));var express=require(_0x980e('0x1'));var errors=require(_0x980e('0x2'));var config=require(_0x980e('0x3'));var setupLoggers=require(_0x980e('0x4'))[_0x980e('0x5')];var clientSideLogs=require(_0x980e('0x6'));exports[_0x980e('0x7')]=function(_0x7384b4){return setupLoggers(_0x7384b4)[_0x980e('0x8')](function(){_0x7384b4['use']('/api/users',require('./api/user'));_0x7384b4['use'](_0x980e('0x9'),require(_0x980e('0xa')));_0x7384b4[_0x980e('0xb')]('/api/voice/contexts',require(_0x980e('0xc')));_0x7384b4[_0x980e('0xb')](_0x980e('0xd'),require(_0x980e('0xe')));_0x7384b4[_0x980e('0xb')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x7384b4[_0x980e('0xb')]('/api/voice/queues',require(_0x980e('0xf')));_0x7384b4[_0x980e('0xb')](_0x980e('0x10'),require(_0x980e('0x11')));_0x7384b4[_0x980e('0xb')]('/api/screen/recordings',require(_0x980e('0x12')));_0x7384b4[_0x980e('0xb')](_0x980e('0x13'),require(_0x980e('0x14')));_0x7384b4[_0x980e('0xb')](_0x980e('0x15'),require(_0x980e('0x16')));_0x7384b4['use'](_0x980e('0x17'),require('./api/voiceCallReport'));_0x7384b4['use']('/api/voice/dials/reports',require(_0x980e('0x18')));_0x7384b4['use'](_0x980e('0x19'),require(_0x980e('0x1a')));_0x7384b4[_0x980e('0xb')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x7384b4[_0x980e('0xb')](_0x980e('0x1b'),require(_0x980e('0x1c')));_0x7384b4['use'](_0x980e('0x1d'),require('./api/trunk'));_0x7384b4[_0x980e('0xb')](_0x980e('0x1e'),require(_0x980e('0x1f')));_0x7384b4['use'](_0x980e('0x20'),require(_0x980e('0x21')));_0x7384b4[_0x980e('0xb')](_0x980e('0x22'),require(_0x980e('0x23')));_0x7384b4[_0x980e('0xb')](_0x980e('0x24'),require(_0x980e('0x25')));_0x7384b4[_0x980e('0xb')](_0x980e('0x26'),require('./api/mailSubstatus'));_0x7384b4[_0x980e('0xb')](_0x980e('0x27'),require('./api/mailInteraction'));_0x7384b4[_0x980e('0xb')](_0x980e('0x28'),require(_0x980e('0x29')));_0x7384b4[_0x980e('0xb')]('/api/mail/applications',require(_0x980e('0x2a')));_0x7384b4['use']('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x7384b4[_0x980e('0xb')](_0x980e('0x2b'),require(_0x980e('0x2c')));_0x7384b4[_0x980e('0xb')]('/api/dashboards/items',require('./api/dashboardItem'));_0x7384b4[_0x980e('0xb')](_0x980e('0x2d'),require(_0x980e('0x2e')));_0x7384b4[_0x980e('0xb')](_0x980e('0x2f'),require(_0x980e('0x30')));_0x7384b4['use']('/api/fax/interactions',require(_0x980e('0x31')));_0x7384b4[_0x980e('0xb')]('/api/fax/messages',require(_0x980e('0x32')));_0x7384b4['use'](_0x980e('0x33'),require(_0x980e('0x34')));_0x7384b4[_0x980e('0xb')](_0x980e('0x35'),require(_0x980e('0x36')));_0x7384b4[_0x980e('0xb')](_0x980e('0x37'),require(_0x980e('0x38')));_0x7384b4[_0x980e('0xb')](_0x980e('0x39'),require(_0x980e('0x3a')));_0x7384b4[_0x980e('0xb')](_0x980e('0x3b'),require(_0x980e('0x3c')));_0x7384b4[_0x980e('0xb')](_0x980e('0x3d'),require(_0x980e('0x3e')));_0x7384b4[_0x980e('0xb')](_0x980e('0x3f'),require('./api/smsQueue'));_0x7384b4[_0x980e('0xb')]('/api/openchannel/accounts',require(_0x980e('0x40')));_0x7384b4[_0x980e('0xb')](_0x980e('0x41'),require(_0x980e('0x42')));_0x7384b4['use'](_0x980e('0x43'),require(_0x980e('0x44')));_0x7384b4[_0x980e('0xb')](_0x980e('0x45'),require(_0x980e('0x46')));_0x7384b4[_0x980e('0xb')]('/api/openchannel/queues',require(_0x980e('0x47')));_0x7384b4[_0x980e('0xb')](_0x980e('0x48'),require(_0x980e('0x49')));_0x7384b4[_0x980e('0xb')](_0x980e('0x4a'),require(_0x980e('0x4b')));_0x7384b4['use'](_0x980e('0x4c'),require(_0x980e('0x4d')));_0x7384b4[_0x980e('0xb')](_0x980e('0x4e'),require('./api/chatInteraction'));_0x7384b4[_0x980e('0xb')](_0x980e('0x4f'),require(_0x980e('0x50')));_0x7384b4['use']('/api/chat/offline_messages',require(_0x980e('0x51')));_0x7384b4[_0x980e('0xb')](_0x980e('0x52'),require('./api/chatQueue'));_0x7384b4[_0x980e('0xb')](_0x980e('0x53'),require(_0x980e('0x54')));_0x7384b4[_0x980e('0xb')](_0x980e('0x55'),require(_0x980e('0x56')));_0x7384b4['use']('/api/cm/companies',require('./api/cmCompany'));_0x7384b4[_0x980e('0xb')](_0x980e('0x57'),require(_0x980e('0x58')));_0x7384b4[_0x980e('0xb')](_0x980e('0x59'),require(_0x980e('0x5a')));_0x7384b4[_0x980e('0xb')](_0x980e('0x5b'),require('./api/cmHopperBlack'));_0x7384b4[_0x980e('0xb')](_0x980e('0x5c'),require('./api/cmHopperFinal'));_0x7384b4[_0x980e('0xb')](_0x980e('0x5d'),require(_0x980e('0x5e')));_0x7384b4[_0x980e('0xb')](_0x980e('0x5f'),require(_0x980e('0x60')));_0x7384b4[_0x980e('0xb')]('/api/actions',require('./api/action'));_0x7384b4[_0x980e('0xb')](_0x980e('0x61'),require('./api/automation'));_0x7384b4[_0x980e('0xb')]('/api/canned_answers',require(_0x980e('0x62')));_0x7384b4[_0x980e('0xb')](_0x980e('0x63'),require(_0x980e('0x64')));_0x7384b4[_0x980e('0xb')](_0x980e('0x65'),require(_0x980e('0x66')));_0x7384b4[_0x980e('0xb')](_0x980e('0x67'),require('./api/interval'));_0x7384b4[_0x980e('0xb')](_0x980e('0x68'),require(_0x980e('0x69')));_0x7384b4[_0x980e('0xb')](_0x980e('0x6a'),require(_0x980e('0x6b')));_0x7384b4[_0x980e('0xb')](_0x980e('0x6c'),require(_0x980e('0x6d')));_0x7384b4['use'](_0x980e('0x6e'),require(_0x980e('0x6f')));_0x7384b4['use'](_0x980e('0x70'),require(_0x980e('0x71')));_0x7384b4[_0x980e('0xb')](_0x980e('0x72'),require(_0x980e('0x73')));_0x7384b4['use'](_0x980e('0x74'),require(_0x980e('0x75')));_0x7384b4[_0x980e('0xb')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x7384b4[_0x980e('0xb')](_0x980e('0x76'),require('./api/cmHopperAdditionalPhone'));_0x7384b4[_0x980e('0xb')]('/api/templates',require(_0x980e('0x77')));_0x7384b4[_0x980e('0xb')](_0x980e('0x78'),require(_0x980e('0x79')));_0x7384b4[_0x980e('0xb')](_0x980e('0x7a'),require(_0x980e('0x7b')));_0x7384b4[_0x980e('0xb')](_0x980e('0x7c'),require(_0x980e('0x7d')));_0x7384b4[_0x980e('0xb')](_0x980e('0x7e'),require(_0x980e('0x7f')));_0x7384b4[_0x980e('0xb')](_0x980e('0x80'),require(_0x980e('0x81')));_0x7384b4['use']('/api/analytics/default_reports',require(_0x980e('0x82')));_0x7384b4['use']('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x7384b4['use'](_0x980e('0x83'),require(_0x980e('0x84')));_0x7384b4['use']('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x7384b4[_0x980e('0xb')](_0x980e('0x85'),require('./api/analyticTreeReport'));_0x7384b4[_0x980e('0xb')]('/api/integrations/salesforce/accounts',require(_0x980e('0x86')));_0x7384b4[_0x980e('0xb')](_0x980e('0x87'),require('./api/intSalesforceConfiguration'));_0x7384b4[_0x980e('0xb')](_0x980e('0x88'),require(_0x980e('0x89')));_0x7384b4[_0x980e('0xb')](_0x980e('0x8a'),require(_0x980e('0x8b')));_0x7384b4[_0x980e('0xb')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x7384b4[_0x980e('0xb')](_0x980e('0x8c'),require(_0x980e('0x8d')));_0x7384b4['use'](_0x980e('0x8e'),require(_0x980e('0x8f')));_0x7384b4['use'](_0x980e('0x90'),require(_0x980e('0x91')));_0x7384b4[_0x980e('0xb')](_0x980e('0x92'),require(_0x980e('0x93')));_0x7384b4[_0x980e('0xb')](_0x980e('0x94'),require('./api/intZohoAccount'));_0x7384b4[_0x980e('0xb')](_0x980e('0x95'),require(_0x980e('0x96')));_0x7384b4[_0x980e('0xb')](_0x980e('0x97'),require('./api/intZohoField'));_0x7384b4[_0x980e('0xb')](_0x980e('0x98'),require(_0x980e('0x99')));_0x7384b4[_0x980e('0xb')](_0x980e('0x9a'),require(_0x980e('0x9b')));_0x7384b4['use'](_0x980e('0x9c'),require(_0x980e('0x9d')));_0x7384b4[_0x980e('0xb')](_0x980e('0x9e'),require(_0x980e('0x9f')));_0x7384b4['use'](_0x980e('0xa0'),require(_0x980e('0xa1')));_0x7384b4[_0x980e('0xb')](_0x980e('0xa2'),require('./api/intFreshdeskField'));_0x7384b4['use'](_0x980e('0xa3'),require(_0x980e('0xa4')));_0x7384b4['use'](_0x980e('0xa5'),require(_0x980e('0xa6')));_0x7384b4[_0x980e('0xb')](_0x980e('0xa7'),require('./api/intVtigerField'));_0x7384b4[_0x980e('0xb')](_0x980e('0xa8'),require(_0x980e('0xa9')));_0x7384b4[_0x980e('0xb')](_0x980e('0xaa'),require(_0x980e('0xab')));_0x7384b4[_0x980e('0xb')](_0x980e('0xac'),require('./api/intServicenowField'));_0x7384b4['use'](_0x980e('0xad'),require(_0x980e('0xae')));_0x7384b4[_0x980e('0xb')]('/api/integrations/dynamics365/configurations',require(_0x980e('0xaf')));_0x7384b4[_0x980e('0xb')]('/api/integrations/dynamics365/fields',require(_0x980e('0xb0')));_0x7384b4[_0x980e('0xb')](_0x980e('0xb1'),require('./api/intFreshsalesAccount'));_0x7384b4[_0x980e('0xb')](_0x980e('0xb2'),require(_0x980e('0xb3')));_0x7384b4[_0x980e('0xb')]('/api/integrations/freshsales/fields',require(_0x980e('0xb4')));_0x7384b4[_0x980e('0xb')](_0x980e('0xb5'),require(_0x980e('0xb6')));_0x7384b4[_0x980e('0xb')](_0x980e('0xb7'),require('./api/chatQueueReport'));_0x7384b4[_0x980e('0xb')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x7384b4[_0x980e('0xb')](_0x980e('0xb8'),require('./api/jscriptyAnswerReport'));_0x7384b4[_0x980e('0xb')](_0x980e('0xb9'),require(_0x980e('0xba')));_0x7384b4[_0x980e('0xb')](_0x980e('0xbb'),require(_0x980e('0xbc')));_0x7384b4[_0x980e('0xb')](_0x980e('0xbd'),require(_0x980e('0xbe')));_0x7384b4['use'](_0x980e('0xbf'),require(_0x980e('0xc0')));_0x7384b4[_0x980e('0xb')](_0x980e('0xc1'),require(_0x980e('0xc2')));_0x7384b4['use'](_0x980e('0xc3'),require(_0x980e('0xc4')));_0x7384b4[_0x980e('0xb')](_0x980e('0xc5'),require(_0x980e('0xc6')));_0x7384b4['use'](_0x980e('0xc7'),require('./api/squareOdbc'));_0x7384b4['use'](_0x980e('0xc8'),require(_0x980e('0xc9')));_0x7384b4[_0x980e('0xb')](_0x980e('0xca'),require(_0x980e('0xcb')));_0x7384b4[_0x980e('0xb')](_0x980e('0xcc'),require(_0x980e('0xcd')));_0x7384b4[_0x980e('0xb')](_0x980e('0xce'),require(_0x980e('0xcf')));_0x7384b4[_0x980e('0xb')](_0x980e('0xd0'),require(_0x980e('0xd1')));_0x7384b4['use']('/api/campaigns',require(_0x980e('0xd2')));_0x7384b4[_0x980e('0xb')](_0x980e('0xd3'),require('./api/migration'));_0x7384b4['use']('/api/attachments',require('./api/attachment'));_0x7384b4[_0x980e('0xb')](_0x980e('0xd4'),require('./api/plugin'));_0x7384b4[_0x980e('0xb')](_0x980e('0xd5'),require(_0x980e('0xd6')));_0x7384b4[_0x980e('0xb')](_0x980e('0xd7'),require(_0x980e('0xd8')));_0x7384b4[_0x980e('0xb')](_0x980e('0xd9'),require(_0x980e('0xda')));_0x7384b4['use'](_0x980e('0xdb'),require(_0x980e('0xdc')));_0x7384b4[_0x980e('0xb')]('/api/sms/reports/transfer',require(_0x980e('0xdd')));_0x7384b4['use'](_0x980e('0xde'),require(_0x980e('0xdf')));_0x7384b4['use']('/api/voice/prefixes',require(_0x980e('0xe0')));_0x7384b4[_0x980e('0xb')](_0x980e('0xe1'),require(_0x980e('0xe2')));_0x7384b4['use'](_0x980e('0xe3'),require(_0x980e('0xe4')));_0x7384b4['use'](_0x980e('0xe5'),require('./api/userProfileResource'));_0x7384b4[_0x980e('0xb')](_0x980e('0xe6'),require(_0x980e('0xe7')));_0x7384b4['use'](_0x980e('0xe8'),require(_0x980e('0xe9')));_0x7384b4[_0x980e('0xb')](_0x980e('0xea'),require(_0x980e('0xeb')));_0x7384b4['use']('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x7384b4[_0x980e('0xb')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x7384b4['use'](_0x980e('0xec'),require(_0x980e('0xed')));_0x7384b4[_0x980e('0xb')](_0x980e('0xee'),require(_0x980e('0xef')));_0x7384b4[_0x980e('0xb')](_0x980e('0xf0'),require(_0x980e('0xf1')));_0x7384b4['use']('/api/cloudProviders',require(_0x980e('0xf2')));_0x7384b4[_0x980e('0xb')]('/api/realtime',require('./api/realtime'));_0x7384b4['use']('/api/user-settings',require('./api/user-setting'));_0x7384b4[_0x980e('0xb')](_0x980e('0xf3'),require(_0x980e('0xf4')));_0x7384b4[_0x980e('0xb')](_0x980e('0xf5'),require(_0x980e('0xf6')));_0x7384b4[_0x980e('0xb')](_0x980e('0xf7'),require(_0x980e('0xf8')));_0x7384b4[_0x980e('0xb')](_0x980e('0xf9'),require(_0x980e('0xfa')));_0x7384b4[_0x980e('0xb')](_0x980e('0xfb'),require(_0x980e('0xfc')));_0x7384b4[_0x980e('0xb')]('/api/version',require('./api/version'));_0x7384b4['use']('/api/system',require(_0x980e('0xfd')));_0x7384b4[_0x980e('0xb')](_0x980e('0xfe'),require(_0x980e('0xff')));_0x7384b4['use']('/api/webbar',require(_0x980e('0x100')));_0x7384b4[_0x980e('0xb')](_0x980e('0x101'),clientSideLogs);_0x7384b4[_0x980e('0xb')](_0x980e('0x102'),express[_0x980e('0x103')](path[_0x980e('0x104')](config[_0x980e('0x105')],_0x980e('0x102'))));_0x7384b4[_0x980e('0xb')](_0x980e('0x106'),express['static'](path['join'](config[_0x980e('0x105')],_0x980e('0x106'))));_0x7384b4[_0x980e('0xb')](_0x980e('0x107'),express[_0x980e('0x103')](path['join'](config[_0x980e('0x105')],_0x980e('0x107'))));_0x7384b4['use'](_0x980e('0x108'),express[_0x980e('0x103')](path['join'](config[_0x980e('0x105')],_0x980e('0x109'),'3.0.0')));_0x7384b4[_0x980e('0xb')](_0x980e('0x10a'),express[_0x980e('0x103')](path[_0x980e('0x104')](config[_0x980e('0x105')],_0x980e('0x10b'))));_0x7384b4[_0x980e('0x10c')](_0x980e('0x10d'))[_0x980e('0x10e')](errors[0x194]);_0x7384b4[_0x980e('0x10c')]('/*')[_0x980e('0x10e')](function(_0x50a972,_0x5ecfc5){_0x5ecfc5[_0x980e('0x10f')](path[_0x980e('0x110')](_0x7384b4['get']('appPath')+_0x980e('0x111')));});return _0x7384b4;});}; \ No newline at end of file +var _0xe6be=['./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesField','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/attachments','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/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/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','/demo','root','/snippet','snippet','3.0.0','route','get','sendFile','resolve','appPath','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','use','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/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','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations'];(function(_0x51afc4,_0x4e02df){var _0x64fbda=function(_0x455b52){while(--_0x455b52){_0x51afc4['push'](_0x51afc4['shift']());}};_0x64fbda(++_0x4e02df);}(_0xe6be,0x189));var _0xee6b=function(_0x5f360d,_0x343ec2){_0x5f360d=_0x5f360d-0x0;var _0x4690cd=_0xe6be[_0x5f360d];return _0x4690cd;};'use strict';var path=require('path');var express=require(_0xee6b('0x0'));var errors=require(_0xee6b('0x1'));var config=require(_0xee6b('0x2'));var setupLoggers=require(_0xee6b('0x3'))[_0xee6b('0x4')];var clientSideLogs=require(_0xee6b('0x5'));exports[_0xee6b('0x6')]=function(_0xe64950){return setupLoggers(_0xe64950)[_0xee6b('0x7')](function(){_0xe64950['use'](_0xee6b('0x8'),require(_0xee6b('0x9')));_0xe64950['use'](_0xee6b('0xa'),require(_0xee6b('0xb')));_0xe64950[_0xee6b('0xc')]('/api/voice/contexts',require(_0xee6b('0xd')));_0xe64950['use']('/api/voice/extensions',require(_0xee6b('0xe')));_0xe64950['use'](_0xee6b('0xf'),require(_0xee6b('0x10')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x11'),require(_0xee6b('0x12')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x13'),require('./api/voiceRecording'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x14'),require(_0xee6b('0x15')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x16'),require(_0xee6b('0x17')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x18'),require(_0xee6b('0x19')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x1a'),require(_0xee6b('0x1b')));_0xe64950['use'](_0xee6b('0x1c'),require('./api/voiceDialReport'));_0xe64950[_0xee6b('0xc')]('/api/voice/agents/reports',require(_0xee6b('0x1d')));_0xe64950[_0xee6b('0xc')]('/api/voice/queues/reports',require(_0xee6b('0x1e')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x1f'),require(_0xee6b('0x20')));_0xe64950['use'](_0xee6b('0x21'),require(_0xee6b('0x22')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x23'),require(_0xee6b('0x24')));_0xe64950['use'](_0xee6b('0x25'),require(_0xee6b('0x26')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x27'),require('./api/mailAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x28'),require('./api/mailQueue'));_0xe64950['use'](_0xee6b('0x29'),require(_0xee6b('0x2a')));_0xe64950['use']('/api/mail/interactions',require('./api/mailInteraction'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x2b'),require('./api/mailMessage'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x2c'),require(_0xee6b('0x2d')));_0xe64950[_0xee6b('0xc')]('/api/mail/reports/queue',require(_0xee6b('0x2e')));_0xe64950[_0xee6b('0xc')]('/api/dashboards',require(_0xee6b('0x2f')));_0xe64950[_0xee6b('0xc')]('/api/dashboards/items',require(_0xee6b('0x30')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x31'),require('./api/faxAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x32'),require(_0xee6b('0x33')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x34'),require(_0xee6b('0x35')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x36'),require(_0xee6b('0x37')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x38'),require(_0xee6b('0x39')));_0xe64950[_0xee6b('0xc')]('/api/fax/reports/queue',require(_0xee6b('0x3a')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x3b'),require('./api/smsAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x3c'),require('./api/smsApplication'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x3d'),require(_0xee6b('0x3e')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x3f'),require(_0xee6b('0x40')));_0xe64950['use'](_0xee6b('0x41'),require(_0xee6b('0x42')));_0xe64950['use'](_0xee6b('0x43'),require(_0xee6b('0x44')));_0xe64950[_0xee6b('0xc')]('/api/openchannel/applications',require(_0xee6b('0x45')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x46'),require(_0xee6b('0x47')));_0xe64950[_0xee6b('0xc')]('/api/openchannel/messages',require(_0xee6b('0x48')));_0xe64950[_0xee6b('0xc')]('/api/openchannel/queues',require(_0xee6b('0x49')));_0xe64950[_0xee6b('0xc')]('/api/chat/websites',require(_0xee6b('0x4a')));_0xe64950['use'](_0xee6b('0x4b'),require(_0xee6b('0x4c')));_0xe64950['use'](_0xee6b('0x4d'),require(_0xee6b('0x4e')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x4f'),require('./api/chatInteraction'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x50'),require(_0xee6b('0x51')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x52'),require(_0xee6b('0x53')));_0xe64950['use'](_0xee6b('0x54'),require('./api/chatQueue'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x55'),require(_0xee6b('0x56')));_0xe64950[_0xee6b('0xc')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0xe64950['use'](_0xee6b('0x57'),require(_0xee6b('0x58')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x59'),require(_0xee6b('0x5a')));_0xe64950[_0xee6b('0xc')]('/api/cm/hopper',require(_0xee6b('0x5b')));_0xe64950[_0xee6b('0xc')]('/api/cm/hopper_black',require(_0xee6b('0x5c')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x5d'),require(_0xee6b('0x5e')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x5f'),require(_0xee6b('0x60')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x61'),require(_0xee6b('0x62')));_0xe64950['use'](_0xee6b('0x63'),require('./api/action'));_0xe64950[_0xee6b('0xc')]('/api/automations',require(_0xee6b('0x64')));_0xe64950['use'](_0xee6b('0x65'),require(_0xee6b('0x66')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x67'),require(_0xee6b('0x68')));_0xe64950['use']('/api/conditions',require(_0xee6b('0x69')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x6a'),require(_0xee6b('0x6b')));_0xe64950[_0xee6b('0xc')]('/api/pauses',require(_0xee6b('0x6c')));_0xe64950['use']('/api/cdr',require(_0xee6b('0x6d')));_0xe64950['use'](_0xee6b('0x6e'),require(_0xee6b('0x6f')));_0xe64950[_0xee6b('0xc')]('/api/schedules',require(_0xee6b('0x70')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x71'),require('./api/sound'));_0xe64950['use'](_0xee6b('0x72'),require(_0xee6b('0x73')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x74'),require(_0xee6b('0x75')));_0xe64950[_0xee6b('0xc')]('/api/cm_contact_has_items',require(_0xee6b('0x76')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x77'),require(_0xee6b('0x78')));_0xe64950[_0xee6b('0xc')]('/api/templates',require(_0xee6b('0x79')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x7a'),require(_0xee6b('0x7b')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x7c'),require(_0xee6b('0x7d')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x7e'),require(_0xee6b('0x7f')));_0xe64950[_0xee6b('0xc')]('/api/integrations/reports',require(_0xee6b('0x80')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x81'),require(_0xee6b('0x82')));_0xe64950[_0xee6b('0xc')]('/api/analytics/default_reports',require(_0xee6b('0x83')));_0xe64950[_0xee6b('0xc')]('/api/analytics/extracted_reports',require(_0xee6b('0x84')));_0xe64950[_0xee6b('0xc')]('/api/analytics/metrics',require(_0xee6b('0x85')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x86'),require('./api/analyticFieldReport'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x87'),require('./api/analyticTreeReport'));_0xe64950[_0xee6b('0xc')]('/api/integrations/salesforce/accounts',require(_0xee6b('0x88')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x89'),require('./api/intSalesforceConfiguration'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x8a'),require(_0xee6b('0x8b')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x8c'),require(_0xee6b('0x8d')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x8e'),require(_0xee6b('0x8f')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x90'),require(_0xee6b('0x91')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x92'),require(_0xee6b('0x93')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x94'),require('./api/intDeskConfiguration'));_0xe64950[_0xee6b('0xc')]('/api/integrations/desk/fields',require(_0xee6b('0x95')));_0xe64950[_0xee6b('0xc')]('/api/integrations/zoho/accounts',require(_0xee6b('0x96')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x97'),require(_0xee6b('0x98')));_0xe64950[_0xee6b('0xc')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0xe64950[_0xee6b('0xc')]('/api/integrations/zendesk/accounts',require(_0xee6b('0x99')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x9a'),require(_0xee6b('0x9b')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x9c'),require('./api/intZendeskField'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x9d'),require(_0xee6b('0x9e')));_0xe64950[_0xee6b('0xc')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x9f'),require(_0xee6b('0xa0')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xa1'),require('./api/intVtigerAccount'));_0xe64950[_0xee6b('0xc')]('/api/integrations/vtiger/configurations',require(_0xee6b('0xa2')));_0xe64950[_0xee6b('0xc')]('/api/integrations/vtiger/fields',require(_0xee6b('0xa3')));_0xe64950['use'](_0xee6b('0xa4'),require('./api/intServicenowAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xa5'),require(_0xee6b('0xa6')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xa7'),require(_0xee6b('0xa8')));_0xe64950['use'](_0xee6b('0xa9'),require('./api/intDynamics365Account'));_0xe64950['use']('/api/integrations/dynamics365/configurations',require(_0xee6b('0xaa')));_0xe64950[_0xee6b('0xc')]('/api/integrations/dynamics365/fields',require(_0xee6b('0xab')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xac'),require('./api/intFreshsalesAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xad'),require('./api/intFreshsalesConfiguration'));_0xe64950[_0xee6b('0xc')]('/api/integrations/freshsales/fields',require(_0xee6b('0xae')));_0xe64950[_0xee6b('0xc')]('/api/networks',require(_0xee6b('0xaf')));_0xe64950[_0xee6b('0xc')]('/api/chat/reports/queue',require(_0xee6b('0xb0')));_0xe64950[_0xee6b('0xc')]('/api/chat/internal/messages',require(_0xee6b('0xb1')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xb2'),require('./api/jscriptyAnswerReport'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xb3'),require('./api/jscriptyQuestionReport'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xb4'),require('./api/jscriptySessionReport'));_0xe64950['use'](_0xee6b('0xb5'),require(_0xee6b('0xb6')));_0xe64950['use']('/api/square/reports',require(_0xee6b('0xb7')));_0xe64950[_0xee6b('0xc')]('/api/square/details/reports',require('./api/squareReportDetail'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xb8'),require(_0xee6b('0xb9')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xba'),require('./api/setting'));_0xe64950[_0xee6b('0xc')]('/api/square/odbc',require(_0xee6b('0xbb')));_0xe64950['use'](_0xee6b('0xbc'),require(_0xee6b('0xbd')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xbe'),require('./api/squareRecording'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xbf'),require(_0xee6b('0xc0')));_0xe64950['use'](_0xee6b('0xc1'),require(_0xee6b('0xc2')));_0xe64950['use'](_0xee6b('0xc3'),require(_0xee6b('0xc4')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xc5'),require(_0xee6b('0xc6')));_0xe64950[_0xee6b('0xc')]('/api/migrations',require('./api/migration'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xc7'),require('./api/attachment'));_0xe64950[_0xee6b('0xc')]('/api/plugins',require(_0xee6b('0xc8')));_0xe64950['use']('/api/mail/reports/transfer',require(_0xee6b('0xc9')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xca'),require(_0xee6b('0xcb')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xcc'),require(_0xee6b('0xcd')));_0xe64950['use'](_0xee6b('0xce'),require(_0xee6b('0xcf')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xd0'),require('./api/smsTransferReport'));_0xe64950[_0xee6b('0xc')]('/api/cm/lists',require(_0xee6b('0xd1')));_0xe64950[_0xee6b('0xc')]('/api/voice/prefixes',require(_0xee6b('0xd2')));_0xe64950[_0xee6b('0xc')]('/api/userProfiles',require('./api/userProfile'));_0xe64950['use'](_0xee6b('0xd3'),require(_0xee6b('0xd4')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xd5'),require(_0xee6b('0xd6')));_0xe64950['use'](_0xee6b('0xd7'),require(_0xee6b('0xd8')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xd9'),require(_0xee6b('0xda')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xdb'),require(_0xee6b('0xdc')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xdd'),require(_0xee6b('0xde')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xdf'),require(_0xee6b('0xe0')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xe1'),require(_0xee6b('0xe2')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xe3'),require(_0xee6b('0xe4')));_0xe64950['use'](_0xee6b('0xe5'),require(_0xee6b('0xe6')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xe7'),require(_0xee6b('0xe8')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xe9'),require(_0xee6b('0xea')));_0xe64950['use'](_0xee6b('0xeb'),require(_0xee6b('0xec')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xed'),require(_0xee6b('0xee')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xef'),require(_0xee6b('0xf0')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xf1'),require(_0xee6b('0xf2')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xf3'),require('./api/jira'));_0xe64950['use'](_0xee6b('0xf4'),require(_0xee6b('0xf5')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xf6'),require(_0xee6b('0xf7')));_0xe64950[_0xee6b('0xc')]('/api/system',require(_0xee6b('0xf8')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xf9'),require(_0xee6b('0xfa')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xfb'),require(_0xee6b('0xfc')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xfd'),clientSideLogs);_0xe64950['use'](_0xee6b('0xfe'),express[_0xee6b('0xff')](path[_0xee6b('0x100')](config['root'],_0xee6b('0xfe'))));_0xe64950['use']('/www',express['static'](path[_0xee6b('0x100')](config['root'],_0xee6b('0x101'))));_0xe64950[_0xee6b('0xc')](_0xee6b('0x102'),express[_0xee6b('0xff')](path[_0xee6b('0x100')](config[_0xee6b('0x103')],_0xee6b('0x102'))));_0xe64950[_0xee6b('0xc')](_0xee6b('0x104'),express[_0xee6b('0xff')](path[_0xee6b('0x100')](config[_0xee6b('0x103')],_0xee6b('0x105'),_0xee6b('0x106'))));_0xe64950['use']('/plugins',express['static'](path[_0xee6b('0x100')](config[_0xee6b('0x103')],'/server/files/plugins')));_0xe64950[_0xee6b('0x107')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xee6b('0x108')](errors[0x194]);_0xe64950[_0xee6b('0x107')]('/*')[_0xee6b('0x108')](function(_0x18abb7,_0x1fc4a6){_0x1fc4a6[_0xee6b('0x109')](path[_0xee6b('0x10a')](_0xe64950['get'](_0xee6b('0x10b'))+'/index.html'));});return _0xe64950;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 57730e4..92a306b 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5556=['../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.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/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../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/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc'];(function(_0x14b7a2,_0x2ab4e2){var _0x37aa51=function(_0x3f3fec){while(--_0x3f3fec){_0x14b7a2['push'](_0x14b7a2['shift']());}};_0x37aa51(++_0x2ab4e2);}(_0x5556,0x138));var _0x6555=function(_0x4142b1,_0x1119af){_0x4142b1=_0x4142b1-0x0;var _0x346210=_0x5556[_0x4142b1];return _0x346210;};'use strict';var jayson=require(_0x6555('0x0'));var _=require(_0x6555('0x1'));var config=require(_0x6555('0x2'));exports['listen']=function(){return new Promise(function(_0x5b1fd5,_0x4e97a7){var _0x196c54={};_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/user/user.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x4')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x5')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x6')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x7')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x8')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x9')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/memberReport/memberReport.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/trunk/trunk.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0xa')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0xb')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/mailAccount/mailAccount.rpc'));_0x196c54=_['merge'](_0x196c54,require(_0x6555('0xc')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0xd')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0xe')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/mailApplication/mailApplication.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0xf')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x10')));_0x196c54=_['merge'](_0x196c54,require(_0x6555('0x11')));_0x196c54=_['merge'](_0x196c54,require(_0x6555('0x12')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/faxMessage/faxMessage.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x13')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x14')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x15')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x16')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x17')));_0x196c54=_['merge'](_0x196c54,require(_0x6555('0x18')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x19')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x1a')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x1b')));_0x196c54=_['merge'](_0x196c54,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/chatInteraction/chatInteraction.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x1c')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x1d')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x1e')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x1f')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x20')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x21')));_0x196c54=_['merge'](_0x196c54,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x22')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x23')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x24')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x25')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x26')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x27')));_0x196c54=_['merge'](_0x196c54,require(_0x6555('0x28')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x29')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x2a')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x2b')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x2c')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x2d')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x2e')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x2f')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x30')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x31')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x32')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x33')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x34')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x35')));_0x196c54=_['merge'](_0x196c54,require('../api/squareRecording/squareRecording.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x36')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x37')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/attachment/attachment.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/plugin/plugin.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x196c54=_['merge'](_0x196c54,require(_0x6555('0x38')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x39')));_0x196c54=_[_0x6555('0x3')](_0x196c54,require(_0x6555('0x3a')));var _0x5b9b1b=jayson[_0x6555('0x3b')](_0x196c54)[_0x6555('0x3c')]();var _0x241b3f=config[_0x6555('0x3d')]['port']||config['port']+0x1;var _0xb06e28=config['rpc']['ip']||'localhost';_0x5b9b1b['on'](_0x6555('0x3e'),function(_0x5efe91){return _0x4e97a7(_0x5efe91);});_0x5b9b1b['listen'](_0x241b3f,_0xb06e28,function(){console[_0x6555('0x3f')](_0x6555('0x40'),_0xb06e28,_0x241b3f);require(_0x6555('0x41'))[_0x6555('0x42')]();return _0x5b1fd5('RPC\x20listening\x20on\x20'+_0xb06e28+':'+_0x241b3f);});});}; \ No newline at end of file +var _0xb383=['../api/voiceRecording/voiceRecording.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc'];(function(_0x302408,_0x30de19){var _0x1679e0=function(_0x420796){while(--_0x420796){_0x302408['push'](_0x302408['shift']());}};_0x1679e0(++_0x30de19);}(_0xb383,0x87));var _0x3b38=function(_0x14eb81,_0x40bbdb){_0x14eb81=_0x14eb81-0x0;var _0x336b05=_0xb383[_0x14eb81];return _0x336b05;};'use strict';var jayson=require(_0x3b38('0x0'));var _=require(_0x3b38('0x1'));var config=require('../config/environment');exports[_0x3b38('0x2')]=function(){return new Promise(function(_0x5f1ae0,_0x40589d){var _0x3e856b={};_0x3e856b=_['merge'](_0x3e856b,require('../api/user/user.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x4')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/voiceQueue/voiceQueue.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x5')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x6')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x7')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x8')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x9')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0xa')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0xb')));_0x3e856b=_['merge'](_0x3e856b,require('../api/mailServerIn/mailServerIn.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0xc')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0xd')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0xe')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0xf')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x10')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x11')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/faxAccount/faxAccount.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x12')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x13')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x14')));_0x3e856b=_['merge'](_0x3e856b,require('../api/faxQueue/faxQueue.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x15')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/smsInteraction/smsInteraction.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x16')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x17')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x18')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x19')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x1a')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x1b')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x1c')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/chatInteraction/chatInteraction.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x1d')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/chatQueue/chatQueue.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x1e')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x1f')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x20')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x21')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x22')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x23')));_0x3e856b=_['merge'](_0x3e856b,require('../api/sound/sound.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x24')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x25')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x26')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x27')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x28')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x29')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x2a')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x2b')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x2c')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x2d')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x2e')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x2f')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x30')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x31')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x32')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x33')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x34')));_0x3e856b=_['merge'](_0x3e856b,require('../api/squareOdbc/squareOdbc.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x35')));_0x3e856b=_['merge'](_0x3e856b,require('../api/squareRecording/squareRecording.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x36')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x37')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x38')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x39')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x3a')));_0x3e856b=_['merge'](_0x3e856b,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x3b')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x3c')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x3d')));var _0x46681a=jayson['server'](_0x3e856b)[_0x3b38('0x3e')]();var _0x5c8774=config[_0x3b38('0x3f')][_0x3b38('0x40')]||config['port']+0x1;var _0xc0bf58=config[_0x3b38('0x3f')]['ip']||_0x3b38('0x41');_0x46681a['on'](_0x3b38('0x42'),function(_0x279282){return _0x40589d(_0x279282);});_0x46681a[_0x3b38('0x2')](_0x5c8774,_0xc0bf58,function(){console[_0x3b38('0x43')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0xc0bf58,_0x5c8774);require('../config/triggers')[_0x3b38('0x44')]();return _0x5f1ae0(_0x3b38('0x45')+_0xc0bf58+':'+_0x5c8774);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 5115394..8b7a25a 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 _0x9a55=['wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','line','toLowerCase','hangup','emit','substring','520-Invalid','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','command','write','inherits','sendRequest','sync','ANSWER','getData','beep','format','NO\x20MESSAGE','prototype','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI'];(function(_0x3a351d,_0x5bb577){var _0x370d12=function(_0x45d07a){while(--_0x45d07a){_0x3a351d['push'](_0x3a351d['shift']());}};_0x370d12(++_0x5bb577);}(_0x9a55,0xe2));var _0x59a5=function(_0x5cac07,_0x2c7376){_0x5cac07=_0x5cac07-0x0;var _0x3e7521=_0x9a55[_0x5cac07];return _0x3e7521;};'use strict';var util=require(_0x59a5('0x0'));var _=require('lodash');var EventEmitter=require(_0x59a5('0x1'))[_0x59a5('0x2')];var AGIReply=require(_0x59a5('0x3'));var AGIError=require('./error');function AGIChannel(_0x19812d){var _0x5856df=this,_0x55e665=new AGIReply(),_0x1a360b=![],_0x4d8e03={};EventEmitter[_0x59a5('0x4')](_0x5856df);_0x19812d[_0x59a5('0x5')](_0x59a5('0x6'));_0x19812d[_0x59a5('0x7')](0x8*0x3c*0x3c*0x3e8);_0x55e665[_0x59a5('0x5')]('utf8');_0x55e665['on']('headers',function(_0x299dfa){for(var _0x481be7 in _0x299dfa){_0x5856df[_0x481be7]=_0x299dfa[_0x481be7];}_0x5856df['emit']('ready');});_0x55e665['on'](_0x59a5('0x8'),function(_0x528959){if(_0x528959[_0x59a5('0x9')]()==_0x59a5('0xa')){_0x5856df[_0x59a5('0xb')](_0x59a5('0xa'));return;}if(_0x528959[_0x59a5('0xc')](0x0,0xb)==_0x59a5('0xd')){_0x1a360b=!![];}if(_0x1a360b){_0x4d8e03['rx']+=_0x528959+'\x0a';if(_0x528959['search']('520\x20End\x20of\x20proper')!=-0x1){_0x1a360b=![];}}else{_0x4d8e03['rx']=_0x528959;}if(_0x1a360b){return;}if(typeof _0x4d8e03['cb']==_0x59a5('0xe')){var _0x427a03=_0x4d8e03['rx'][_0x59a5('0xc')](0x0,0x3),_0x72199=null,_0x324a86=null;_0x427a03=parseInt(_0x427a03);if(isNaN(_0x427a03)){_0x4d8e03['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x59a5('0xf')});return;}if(_0x427a03!=0xc8){_0x4d8e03['cb'](null,{'code':_0x427a03,'result':-0x1,'extra':'KO'});return;}_0x72199=_0x4d8e03['rx'][_0x59a5('0xc')](0x4)[_0x59a5('0x10')]('result=','');if(_0x72199[_0x59a5('0x11')]('\x20')!=-0x1){_0x72199=_0x72199[_0x59a5('0x12')](0x0,_0x72199[_0x59a5('0x11')]('\x20'));}if(_[_0x59a5('0x13')](_0x72199,'-1')){_0x72199=parseInt(_0x72199);}_0x324a86=_0x4d8e03['rx'][_0x59a5('0x14')]('\x20');if(_0x324a86[_0x59a5('0x15')]==0x3){_0x324a86=_0x324a86[0x2][_0x59a5('0xc')](0x1,_0x324a86[0x2][_0x59a5('0x15')]-0x1);}else if(_0x324a86[_0x59a5('0x15')]>0x3){var _0x58c0a9=/\((.+)\)/;var _0x3497ac=_0x4d8e03['rx'][_0x59a5('0x16')](_0x58c0a9);if(_0x3497ac){_0x324a86=_0x3497ac[0x1];}else{_0x324a86=null;}}else{_0x324a86=null;}_0x4d8e03['cb'](null,{'code':_0x427a03,'result':_0x72199,'extra':_0x324a86});}});_0x19812d['on'](_0x59a5('0x17'),function(_0x44ef9a){_0x5856df['emit'](_0x59a5('0x17'),new AGIError(_0x59a5('0x18'),_0x44ef9a[_0x59a5('0x19')]));});_0x19812d['on'](_0x59a5('0x1a'),function(){_0x5856df[_0x59a5('0xb')]('close',new AGIError(_0x59a5('0x1b')));});_0x19812d['on'](_0x59a5('0x1c'),function(){_0x5856df[_0x59a5('0xb')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x19812d[_0x59a5('0x1d')]();});_0x19812d['pipe'](_0x55e665);this[_0x59a5('0x1e')]=function(_0x2c7b16,_0x2ab3e1){var _0x2c7b16=_0x2c7b16||'',_0x2ab3e1=typeof _0x2ab3e1==_0x59a5('0xe')?_0x2ab3e1:new Function();_0x4d8e03={'tx':_0x2c7b16,'rx':'','cb':_0x2ab3e1};_0x19812d[_0x59a5('0x1f')](_0x2c7b16+'\x0a');},this[_0x59a5('0x1a')]=function(){_0x19812d[_0x59a5('0x1d')]();};}util[_0x59a5('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x59a5('0x21')]=function(_0x71ae61){return this[_0x59a5('0x1e')][_0x59a5('0x22')](this,_0x71ae61);};AGIChannel['prototype']['answer']=function(){return this[_0x59a5('0x21')](_0x59a5('0x23'));};AGIChannel['prototype'][_0x59a5('0x24')]=function(_0x4e43cd,_0x2f4aa3,_0x464722){_0x4e43cd=_0x4e43cd===undefined?_0x59a5('0x25'):_0x4e43cd;_0x2f4aa3=_0x2f4aa3===undefined?'5':_0x2f4aa3;_0x464722=_0x464722===undefined?'1':_0x464722;return this[_0x59a5('0x21')](util[_0x59a5('0x26')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x4e43cd,_0x2f4aa3*0x3e8,_0x464722));};AGIChannel['prototype']['noop']=function(_0x456049){_0x456049=_0x456049||_0x59a5('0x27');return this['sendRequest'](util['format']('VERBOSE\x20\x22%s\x22',_0x456049));};AGIChannel[_0x59a5('0x28')][_0x59a5('0x29')]=function(_0x549718,_0x39da62){if(_[_0x59a5('0x2a')](_0x39da62)){return this[_0x59a5('0x21')](util[_0x59a5('0x26')](_0x59a5('0x2b'),_0x549718,_0x39da62[_0x59a5('0x2c')](',')));}return this[_0x59a5('0x21')](util['format'](_0x59a5('0x2b'),_0x549718,_0x39da62));};AGIChannel[_0x59a5('0x28')][_0x59a5('0x2d')]=function(_0x56c35f){return this['sendRequest'](util[_0x59a5('0x26')](_0x59a5('0x2e'),_0x56c35f));};AGIChannel[_0x59a5('0x28')][_0x59a5('0x2f')]=function(_0x176435){return this[_0x59a5('0x21')](util[_0x59a5('0x26')]('SET\x20EXTENSION\x20%s',_0x176435));};AGIChannel[_0x59a5('0x28')]['setPriority']=function(_0x3f4df5){return this[_0x59a5('0x21')](util['format'](_0x59a5('0x30'),_0x3f4df5));};AGIChannel[_0x59a5('0x28')]['hangup']=function(){return this[_0x59a5('0x21')](_0x59a5('0x31'));};AGIChannel[_0x59a5('0x28')][_0x59a5('0x32')]=function(_0x32154a,_0x1c78b8){var _0x584962=_[_0x59a5('0x33')](_0x1c78b8)||_[_0x59a5('0x34')](_0x1c78b8)?_0x1c78b8[_0x59a5('0x35')]():_0x1c78b8;return this[_0x59a5('0x21')](util['format'](_0x59a5('0x36'),_0x32154a,_0x584962?_0x584962[_0x59a5('0x35')]()[_0x59a5('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x59a5('0x28')]['sayNumber']=function(_0x4219d2,_0x3639dc){return this[_0x59a5('0x21')](util[_0x59a5('0x26')](_0x59a5('0x37'),_0x4219d2,_0x3639dc));};AGIChannel['prototype'][_0x59a5('0x38')]=function(_0x36afce,_0xab0cfa){return this['sendRequest'](util[_0x59a5('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x36afce,_0xab0cfa));};AGIChannel[_0x59a5('0x28')][_0x59a5('0x39')]=function(_0x4afb12,_0x2b7848){return this[_0x59a5('0x21')](util[_0x59a5('0x26')](_0x59a5('0x3a'),_0x4afb12,_0x2b7848));};AGIChannel[_0x59a5('0x28')][_0x59a5('0x3b')]=function(_0x3d45d3,_0x1fd9c8,_0x2766ce){_0x1fd9c8=_0x1fd9c8||this[_0x59a5('0x3c')];_0x2766ce=_0x2766ce||0x1;this[_0x59a5('0x2d')](_0x3d45d3);this[_0x59a5('0x2f')](_0x1fd9c8);this['setPriority'](_0x2766ce);return this[_0x59a5('0x3d')](util[_0x59a5('0x26')]('GOTO\x20%s\x20%s\x20%s',_0x3d45d3,_0x1fd9c8,_0x2766ce));};AGIChannel[_0x59a5('0x28')][_0x59a5('0x3e')]=function(_0x5169e3){return this['sendRequest'](util[_0x59a5('0x26')](_0x59a5('0x3f'),_0x5169e3));};AGIChannel[_0x59a5('0x28')][_0x59a5('0x40')]=function(_0x2c8830,_0x36d08b,_0xb2993,_0x57fb0e,_0x7d826,_0x469070){_0x36d08b=_0x36d08b||'wav';_0xb2993=_0xb2993||'';_0x57fb0e=_0x57fb0e===undefined?-0x1:_0x57fb0e==='-1'?-0x1:_0x57fb0e*0x3e8;_0x7d826=_0x7d826===undefined?'':'s='+_0x7d826;_0x469070=_0x469070?_0x59a5('0x41'):'';return this[_0x59a5('0x21')](util[_0x59a5('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x2c8830,_0x36d08b,_0xb2993,_0x57fb0e,_0x469070,_0x7d826));};AGIChannel['prototype'][_0x59a5('0x42')]=function(_0x34060b,_0xa5cd67){_0xa5cd67=_0xa5cd67||'';return this[_0x59a5('0x21')](util[_0x59a5('0x26')](_0x59a5('0x43'),_0x34060b,_0xa5cd67));};AGIChannel[_0x59a5('0x28')][_0x59a5('0x44')]=function(_0x56867a){return this['exec'](_0x59a5('0x45'),_0x56867a);};AGIChannel[_0x59a5('0x28')][_0x59a5('0x46')]=function(_0x5cf228){return this[_0x59a5('0x29')](_0x59a5('0x47'),_0x5cf228);};AGIChannel[_0x59a5('0x28')][_0x59a5('0x17')]=function(_0x4eb213,_0x8dab8e){this[_0x59a5('0x3d')](util[_0x59a5('0x26')](_0x59a5('0x48'),_0x4eb213['id'],_0x4eb213[_0x59a5('0x49')],_0x8dab8e));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x157f=['./reply','./error','call','setEncoding','utf8','emit','substring','520-Invalid','function','no\x20code','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sync','answer','sendRequest','ANSWER','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','hangup','HANGUP','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','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','exec','AGI','wait','WAIT','label','util','lodash','EventEmitter'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x157f,0xd2));var _0xf157=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x157f[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0xf157('0x0'));var _=require(_0xf157('0x1'));var EventEmitter=require('events')[_0xf157('0x2')];var AGIReply=require(_0xf157('0x3'));var AGIError=require(_0xf157('0x4'));function AGIChannel(_0x5b15b4){var _0x19d725=this,_0x6920cf=new AGIReply(),_0x34a187=![],_0x248c09={};EventEmitter[_0xf157('0x5')](_0x19d725);_0x5b15b4[_0xf157('0x6')]('utf8');_0x5b15b4['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x6920cf[_0xf157('0x6')](_0xf157('0x7'));_0x6920cf['on']('headers',function(_0x1e0f37){for(var _0x5e58de in _0x1e0f37){_0x19d725[_0x5e58de]=_0x1e0f37[_0x5e58de];}_0x19d725[_0xf157('0x8')]('ready');});_0x6920cf['on']('line',function(_0x1b8e0e){if(_0x1b8e0e['toLowerCase']()=='hangup'){_0x19d725[_0xf157('0x8')]('hangup');return;}if(_0x1b8e0e[_0xf157('0x9')](0x0,0xb)==_0xf157('0xa')){_0x34a187=!![];}if(_0x34a187){_0x248c09['rx']+=_0x1b8e0e+'\x0a';if(_0x1b8e0e['search']('520\x20End\x20of\x20proper')!=-0x1){_0x34a187=![];}}else{_0x248c09['rx']=_0x1b8e0e;}if(_0x34a187){return;}if(typeof _0x248c09['cb']==_0xf157('0xb')){var _0x635f07=_0x248c09['rx']['substring'](0x0,0x3),_0x3202f1=null,_0x576406=null;_0x635f07=parseInt(_0x635f07);if(isNaN(_0x635f07)){_0x248c09['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xf157('0xc')});return;}if(_0x635f07!=0xc8){_0x248c09['cb'](null,{'code':_0x635f07,'result':-0x1,'extra':'KO'});return;}_0x3202f1=_0x248c09['rx']['substring'](0x4)['replace'](_0xf157('0xd'),'');if(_0x3202f1['indexOf']('\x20')!=-0x1){_0x3202f1=_0x3202f1[_0xf157('0xe')](0x0,_0x3202f1[_0xf157('0xf')]('\x20'));}if(_[_0xf157('0x10')](_0x3202f1,'-1')){_0x3202f1=parseInt(_0x3202f1);}_0x576406=_0x248c09['rx'][_0xf157('0x11')]('\x20');if(_0x576406['length']==0x3){_0x576406=_0x576406[0x2][_0xf157('0x9')](0x1,_0x576406[0x2][_0xf157('0x12')]-0x1);}else if(_0x576406['length']>0x3){var _0x4eb791=/\((.+)\)/;var _0x40f54a=_0x248c09['rx'][_0xf157('0x13')](_0x4eb791);if(_0x40f54a){_0x576406=_0x40f54a[0x1];}else{_0x576406=null;}}else{_0x576406=null;}_0x248c09['cb'](null,{'code':_0x635f07,'result':_0x3202f1,'extra':_0x576406});}});_0x5b15b4['on'](_0xf157('0x14'),function(_0x22c3bb){_0x19d725[_0xf157('0x8')]('error',new AGIError(_0xf157('0x15'),_0x22c3bb[_0xf157('0x16')]));});_0x5b15b4['on'](_0xf157('0x17'),function(){_0x19d725['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x5b15b4['on']('timeout',function(){_0x19d725[_0xf157('0x8')]('timeout',new AGIError(_0xf157('0x18')));_0x5b15b4[_0xf157('0x19')]();});_0x5b15b4[_0xf157('0x1a')](_0x6920cf);this[_0xf157('0x1b')]=function(_0xb923a8,_0x5f2741){var _0xb923a8=_0xb923a8||'',_0x5f2741=typeof _0x5f2741==_0xf157('0xb')?_0x5f2741:new Function();_0x248c09={'tx':_0xb923a8,'rx':'','cb':_0x5f2741};_0x5b15b4[_0xf157('0x1c')](_0xb923a8+'\x0a');},this[_0xf157('0x17')]=function(){_0x5b15b4[_0xf157('0x19')]();};}util[_0xf157('0x1d')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0xca3935){return this[_0xf157('0x1b')][_0xf157('0x1e')](this,_0xca3935);};AGIChannel['prototype'][_0xf157('0x1f')]=function(){return this[_0xf157('0x20')](_0xf157('0x21'));};AGIChannel[_0xf157('0x22')][_0xf157('0x23')]=function(_0x2d4307,_0x571497,_0x69da8a){_0x2d4307=_0x2d4307===undefined?_0xf157('0x24'):_0x2d4307;_0x571497=_0x571497===undefined?'5':_0x571497;_0x69da8a=_0x69da8a===undefined?'1':_0x69da8a;return this['sendRequest'](util[_0xf157('0x25')](_0xf157('0x26'),_0x2d4307,_0x571497*0x3e8,_0x69da8a));};AGIChannel[_0xf157('0x22')][_0xf157('0x27')]=function(_0x127040){_0x127040=_0x127040||'NO\x20MESSAGE';return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x28'),_0x127040));};AGIChannel[_0xf157('0x22')]['exec']=function(_0x2163a2,_0x5300ec){if(_[_0xf157('0x29')](_0x5300ec)){return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x2a'),_0x2163a2,_0x5300ec[_0xf157('0x2b')](',')));}return this['sendRequest'](util[_0xf157('0x25')]('EXEC\x20%s\x20%s',_0x2163a2,_0x5300ec));};AGIChannel[_0xf157('0x22')][_0xf157('0x2c')]=function(_0x1bab79){return this[_0xf157('0x20')](util['format']('SET\x20CONTEXT\x20%s',_0x1bab79));};AGIChannel['prototype'][_0xf157('0x2d')]=function(_0x3c4478){return this[_0xf157('0x20')](util['format'](_0xf157('0x2e'),_0x3c4478));};AGIChannel['prototype']['setPriority']=function(_0x5cb727){return this[_0xf157('0x20')](util[_0xf157('0x25')]('SET\x20PRIORITY\x20%s',_0x5cb727));};AGIChannel[_0xf157('0x22')][_0xf157('0x2f')]=function(){return this[_0xf157('0x20')](_0xf157('0x30'));};AGIChannel[_0xf157('0x22')]['setVariable']=function(_0x418381,_0x13f701){var _0x371b9e=_['isBoolean'](_0x13f701)||_['isNumber'](_0x13f701)?_0x13f701[_0xf157('0x31')]():_0x13f701;return this[_0xf157('0x20')](util['format'](_0xf157('0x32'),_0x418381,_0x371b9e?_0x371b9e[_0xf157('0x31')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xf157('0x22')][_0xf157('0x33')]=function(_0x3be27e,_0x592b96){return this[_0xf157('0x20')](util['format'](_0xf157('0x34'),_0x3be27e,_0x592b96));};AGIChannel['prototype'][_0xf157('0x35')]=function(_0x293fdf,_0x5320b3){return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x36'),_0x293fdf,_0x5320b3));};AGIChannel[_0xf157('0x22')]['sayPhonetic']=function(_0x3c3e4e,_0x4779e9){return this['sendRequest'](util[_0xf157('0x25')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x3c3e4e,_0x4779e9));};AGIChannel[_0xf157('0x22')]['continueAt']=function(_0x1444e2,_0x24eab0,_0x1bc449){_0x24eab0=_0x24eab0||this[_0xf157('0x37')];_0x1bc449=_0x1bc449||0x1;this[_0xf157('0x2c')](_0x1444e2);this[_0xf157('0x2d')](_0x24eab0);this[_0xf157('0x38')](_0x1bc449);return this['noop'](util[_0xf157('0x25')](_0xf157('0x39'),_0x1444e2,_0x24eab0,_0x1bc449));};AGIChannel[_0xf157('0x22')][_0xf157('0x3a')]=function(_0x53cd2f){return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x3b'),_0x53cd2f));};AGIChannel[_0xf157('0x22')][_0xf157('0x3c')]=function(_0x4a64c4,_0x47ce4e,_0x2d85c0,_0x3546ab,_0x4409af,_0x3ff6f6){_0x47ce4e=_0x47ce4e||_0xf157('0x3d');_0x2d85c0=_0x2d85c0||'';_0x3546ab=_0x3546ab===undefined?-0x1:_0x3546ab==='-1'?-0x1:_0x3546ab*0x3e8;_0x4409af=_0x4409af===undefined?'':'s='+_0x4409af;_0x3ff6f6=_0x3ff6f6?'BEEP':'';return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x3e'),_0x4a64c4,_0x47ce4e,_0x2d85c0,_0x3546ab,_0x3ff6f6,_0x4409af));};AGIChannel[_0xf157('0x22')][_0xf157('0x3f')]=function(_0x55c69a,_0x37a1ac){_0x37a1ac=_0x37a1ac||'';return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x40'),_0x55c69a,_0x37a1ac));};AGIChannel['prototype'][_0xf157('0x41')]=function(_0x1b8cd8){return this[_0xf157('0x42')](_0xf157('0x43'),_0x1b8cd8);};AGIChannel[_0xf157('0x22')][_0xf157('0x44')]=function(_0xdf739b){return this[_0xf157('0x42')](_0xf157('0x45'),_0xdf739b);};AGIChannel[_0xf157('0x22')][_0xf157('0x14')]=function(_0x20731a,_0x371137){this['noop'](util[_0xf157('0x25')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x20731a['id'],_0x20731a[_0xf157('0x46')],_0x371137));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 7bffd65..33f214b 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 _0xbb98=['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.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','name','exports','util','Undefined\x20error.'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbb98,0xfd));var _0x8bb9=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xbb98[_0x2132a3];return _0x21890c;};'use strict';var util=require(_0x8bb9('0x0'));var error={'E_AGI_UNDEFINED':_0x8bb9('0x1'),'E_AGI_ARGUMENT_PORT':_0x8bb9('0x2'),'E_AGI_SERVER_ERROR':_0x8bb9('0x3'),'E_AGI_SERVER_CLOSE':_0x8bb9('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x8bb9('0x5'),'E_AGI_SOCKET_ERROR':_0x8bb9('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x8bb9('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8bb9('0x8'),'E_AGI_IVR_ENTRY':_0x8bb9('0x9')};function AGIError(_0x34aee4){var _0x34aee4=_0x34aee4||null,_0x39c872=_0x39c872||[],_0x45e651=0x1,_0x1f28b5='';if(!error[_0x34aee4]){_0x34aee4='E_AGI_UNDEFINED';}_0x39c872[_0x8bb9('0xa')](error[_0x34aee4]);while(arguments[_0x45e651]){_0x39c872[_0x8bb9('0xa')](arguments[_0x45e651]);_0x45e651++;}_0x1f28b5=util[_0x8bb9('0xb')]['apply'](util,_0x39c872);this[_0x8bb9('0xc')]=_0x1f28b5;this[_0x8bb9('0xd')]=_0x34aee4;}module[_0x8bb9('0xe')]=AGIError; \ No newline at end of file +var _0x466d=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x359995,_0x1d13d0){var _0x2d90c0=function(_0x1d005f){while(--_0x1d005f){_0x359995['push'](_0x359995['shift']());}};_0x2d90c0(++_0x1d13d0);}(_0x466d,0x182));var _0xd466=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x466d[_0xf2662b];return _0x257dc7;};'use strict';var util=require(_0xd466('0x0'));var error={'E_AGI_UNDEFINED':_0xd466('0x1'),'E_AGI_ARGUMENT_PORT':_0xd466('0x2'),'E_AGI_SERVER_ERROR':_0xd466('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xd466('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xd466('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xd466('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xd466('0x7'),'E_AGI_COMMAND_EMPTY':_0xd466('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd466('0x9'),'E_AGI_IVR_ENTRY':_0xd466('0xa')};function AGIError(_0x20e4ef){var _0x20e4ef=_0x20e4ef||null,_0x171ea5=_0x171ea5||[],_0x5b59ed=0x1,_0x52cd5d='';if(!error[_0x20e4ef]){_0x20e4ef='E_AGI_UNDEFINED';}_0x171ea5[_0xd466('0xb')](error[_0x20e4ef]);while(arguments[_0x5b59ed]){_0x171ea5['push'](arguments[_0x5b59ed]);_0x5b59ed++;}_0x52cd5d=util['format'][_0xd466('0xc')](util,_0x171ea5);this['message']=_0x52cd5d;this[_0xd466('0xd')]=_0x20e4ef;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 1e57d28..68344c7 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2b8=['../../config/environment','redis','defaults','emit','error','E_AGI_SERVER_ERROR','message','agi','projectUpdate','events','EventEmitter','ioredis','./error'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xa2b8,0x134));var _0x8a2b=function(_0x10f095,_0x3a17f7){_0x10f095=_0x10f095-0x0;var _0x477873=_0xa2b8[_0x10f095];return _0x477873;};'use strict';var _=require('lodash');var EventEmitter=require(_0x8a2b('0x0'))[_0x8a2b('0x1')];var Redis=require(_0x8a2b('0x2'));var AGIError=require(_0x8a2b('0x3'));var config=require(_0x8a2b('0x4'));config[_0x8a2b('0x5')]=_[_0x8a2b('0x6')](config[_0x8a2b('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x8a2b('0x5')]);sub['subscribe']('agi',function(_0x2c5261){if(_0x2c5261)return eventEmitter[_0x8a2b('0x7')](_0x8a2b('0x8'),new AGIError(_0x8a2b('0x9'),_0x2c5261));});sub['on'](_0x8a2b('0xa'),function(_0x33d2bc,_0x479eab){if(_0x33d2bc!==_0x8a2b('0xb'))return;try{var _0x276c7f=JSON['parse'](_0x479eab);eventEmitter['emit'](_0x8a2b('0xc'),_0x276c7f);}catch(_0x4c5d1c){eventEmitter[_0x8a2b('0x7')](_0x8a2b('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x4c5d1c));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x1635=['error','E_AGI_SERVER_ERROR','projectUpdate','emit','lodash','events','ioredis','./error','redis','localhost','subscribe','agi'];(function(_0x3ef535,_0x38b557){var _0x318b35=function(_0xb44489){while(--_0xb44489){_0x3ef535['push'](_0x3ef535['shift']());}};_0x318b35(++_0x38b557);}(_0x1635,0xe8));var _0x5163=function(_0x52704a,_0x1c46aa){_0x52704a=_0x52704a-0x0;var _0x77f14c=_0x1635[_0x52704a];return _0x77f14c;};'use strict';var _=require(_0x5163('0x0'));var EventEmitter=require(_0x5163('0x1'))['EventEmitter'];var Redis=require(_0x5163('0x2'));var AGIError=require(_0x5163('0x3'));var config=require('../../config/environment');config['redis']=_['defaults'](config[_0x5163('0x4')],{'host':_0x5163('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x5163('0x4')]);sub[_0x5163('0x6')](_0x5163('0x7'),function(_0xed4295){if(_0xed4295)return eventEmitter['emit'](_0x5163('0x8'),new AGIError(_0x5163('0x9'),_0xed4295));});sub['on']('message',function(_0x657de0,_0x519505){if(_0x657de0!==_0x5163('0x7'))return;try{var _0x2b5e8f=JSON['parse'](_0x519505);eventEmitter['emit'](_0x5163('0xa'),_0x2b5e8f);}catch(_0x1a97ab){eventEmitter[_0x5163('0xb')](_0x5163('0x8'),new AGIError(_0x5163('0x9'),_0x1a97ab));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5e579a2..1246370 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 _0xa341=['getdigits','getsecretdigits','vertices','addVertex','edges','prototype','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','default','invalid','includes','condition\x20not\x20found','exports','lodash','../../../config/logger','menu'];(function(_0xeeb6dd,_0x3e5f7b){var _0x95d347=function(_0x48de04){while(--_0x48de04){_0xeeb6dd['push'](_0xeeb6dd['shift']());}};_0x95d347(++_0x3e5f7b);}(_0xa341,0xed));var _0x1a34=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa341[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1a34('0x0'));var logger=require(_0x1a34('0x1'))('agi');var verticesWithRetry=[_0x1a34('0x2'),_0x1a34('0x3'),_0x1a34('0x4')];var Graph=function(){this[_0x1a34('0x5')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph['prototype'][_0x1a34('0x6')]=function(_0x62f26e){this[_0x1a34('0x5')][_0x62f26e['id']]=_0x62f26e;this[_0x1a34('0x7')][_0x62f26e['id']]=[];};Graph[_0x1a34('0x8')][_0x1a34('0x9')]=function(_0x1cf7b8,_0x4985b7,_0x2ad47b){this['edges'][_0x1cf7b8][_0x1a34('0xa')]({'target':_0x4985b7,'condition':_0x2ad47b});this['numberOfEdges']+=0x1;};Graph[_0x1a34('0x8')][_0x1a34('0xb')]=function(){return _['size'](this[_0x1a34('0x5')]);};Graph[_0x1a34('0x8')][_0x1a34('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x1a34('0x8')][_0x1a34('0xd')]=function(_0x4bab17){return this[_0x1a34('0x5')][_0x4bab17];};Graph[_0x1a34('0x8')][_0x1a34('0xe')]=function(_0x3a2041,_0x23be03){if(!this[_0x1a34('0x5')][_0x3a2041]){return logger[_0x1a34('0xf')](_0x1a34('0x10'));}var _0x4d8486=_0x23be03(this['vertices'][_0x3a2041]);if(!_0x4d8486){return logger[_0x1a34('0xf')](_0x1a34('0x11'));}if(this[_0x1a34('0x7')][_0x3a2041]['length']===0x0){return logger[_0x1a34('0xf')](_0x1a34('0x12'));}for(var _0x5435f5=0x0,_0x302693=[],_0xace731=![];_0x5435f5\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','find','production','handleUnpublished','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s'];(function(_0x570dce,_0x55a02e){var _0x20f0f9=function(_0x4da3a9){while(--_0x4da3a9){_0x570dce['push'](_0x570dce['shift']());}};_0x20f0f9(++_0x55a02e);}(_0xab91,0xba));var _0x1ab9=function(_0x2b6854,_0xf09496){_0x2b6854=_0x2b6854-0x0;var _0x3a17df=_0xab91[_0x2b6854];return _0x3a17df;};'use strict';var _=require(_0x1ab9('0x0'));var syncho=require(_0x1ab9('0x1'));var util=require(_0x1ab9('0x2'));var config=require(_0x1ab9('0x3'));var logger=require(_0x1ab9('0x4'))('agi');var utilLicense=require(_0x1ab9('0x5'));var rpc=require(_0x1ab9('0x6'));var Project=require(_0x1ab9('0x7'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0x1ab9('0x8')]=_[_0x1ab9('0x9')](config['agi'],{'ip':_0x1ab9('0xa'),'port':0x11dd});AGIEmitter['on'](_0x1ab9('0xb'),projectUpdateHandler);function connectionHandler(_0x5c8b35){process[_0x1ab9('0xc')](function(){syncho(function(){try{setChannelVariables(_0x5c8b35);agiHandler(_0x5c8b35);}catch(_0x44964d){logger['error'](_0x44964d[_0x1ab9('0xd')]);}});});}function projectUpdateHandler(_0x805731){try{var _0x39faf0=_['findIndex'](projects,['id',_0x805731['id']]);if(_0x39faf0>-0x1){if(_0x805731[_0x1ab9('0xe')]===!![]){projects[_0x1ab9('0xf')](_0x39faf0,0x1);}else{projects[_0x39faf0]=_0x805731;}}else{projects[_0x1ab9('0x10')](_0x805731);}}catch(_0x4e7e0c){logger[_0x1ab9('0x11')](_0x4e7e0c['stack']);}}function listeningHandler(){console[_0x1ab9('0x12')](_0x1ab9('0x13'),config[_0x1ab9('0x8')][_0x1ab9('0x14')]);logger[_0x1ab9('0x15')](util[_0x1ab9('0x16')](_0x1ab9('0x17'),config[_0x1ab9('0x8')]['ip'],config[_0x1ab9('0x8')][_0x1ab9('0x14')]));}function errorHandler(_0x21ec19){if(_0x21ec19&&_0x21ec19[_0x1ab9('0x18')]&&_0x21ec19[_0x1ab9('0x19')]){logger[_0x1ab9('0x11')](util['format'](_0x1ab9('0x1a'),_0x21ec19['name'],_0x21ec19['message']));}else{logger[_0x1ab9('0x11')](util[_0x1ab9('0x16')](_0x1ab9('0x1b'),_0x21ec19[_0x1ab9('0xd')]));}}function closeHandler(){logger[_0x1ab9('0x15')](util[_0x1ab9('0x16')](_0x1ab9('0x1c'),this[_0x1ab9('0x1d')],this['calleridname'],this[_0x1ab9('0x1e')],this[_0x1ab9('0x1f')],this[_0x1ab9('0x20')]));try{createSquareReport(this);}catch(_0xf036b9){logger[_0x1ab9('0x11')](_0xf036b9['stack']);}}function timeoutHandler(){logger['info'](util['format'](_0x1ab9('0x21'),this[_0x1ab9('0x1d')],this[_0x1ab9('0x22')],this[_0x1ab9('0x1e')],this['dnid'],this[_0x1ab9('0x20')]));}function hangupHandler(){logger['info'](util[_0x1ab9('0x16')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1ab9('0x1d')],this[_0x1ab9('0x22')],this[_0x1ab9('0x1e')],this[_0x1ab9('0x1f')],this[_0x1ab9('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0x5c6acf,_0x41a19){rpc[_0x1ab9('0x23')](_0x5c6acf)[_0x1ab9('0x24')](function(_0x3f650d){if(_0x41a19){_0x41a19(null,_0x3f650d);}})['catch'](function(_0x2f121){if(_0x41a19){_0x41a19(null,_0x2f121);}});}function setChannelVariables(_0xab356a){for(var _0x4aa494 in _0xab356a){if(_0xab356a[_0x1ab9('0x25')](_0x4aa494)){if(_0x4aa494[_0x1ab9('0x26')](_0x1ab9('0x27'))===0x0){_0xab356a[_0x4aa494[_0x1ab9('0x28')](0x4)]=_0xab356a[_0x4aa494];delete _0xab356a[_0x4aa494];}}}}function agiHandler(_0x3a62b6){logger[_0x1ab9('0x29')](_0x1ab9('0x2a'),JSON[_0x1ab9('0x2b')](_0x3a62b6,null,0x2));logger[_0x1ab9('0x15')](util[_0x1ab9('0x16')](_0x1ab9('0x2c'),_0x3a62b6[_0x1ab9('0x1d')],_0x3a62b6[_0x1ab9('0x22')],_0x3a62b6[_0x1ab9('0x1e')],_0x3a62b6['dnid'],_0x3a62b6['uniqueid']));_0x3a62b6['on'](_0x1ab9('0x11'),errorHandler);_0x3a62b6['on'](_0x1ab9('0x2d'),closeHandler);_0x3a62b6['on'](_0x1ab9('0x2e'),timeoutHandler);_0x3a62b6[_0x1ab9('0x2f')]=![];_0x3a62b6['on']('hangup',hangupHandler);var _0x478afe=_[_0x1ab9('0x30')](projects,[_0x1ab9('0x18'),_0x3a62b6[_0x1ab9('0x1d')]]);if(!_0x478afe)return Project['handleNotFound'](_0x3a62b6);if(!_0x478afe[_0x1ab9('0x31')])return Project[_0x1ab9('0x32')](_0x3a62b6);return Project['initialize'](_0x478afe,_0x3a62b6);}function main(){var _0x4b9f91;return utilLicense[_0x1ab9('0x33')]()[_0x1ab9('0x24')](function(_0x2580e3){if(!_0x2580e3)return;if(_0x2580e3['voice']){if(_0x2580e3[_0x1ab9('0x34')]&&_0x2580e3[_0x1ab9('0x34')]>0x0){logger[_0x1ab9('0x15')](util[_0x1ab9('0x16')](_0x1ab9('0x35'),_0x2580e3[_0x1ab9('0x34')]));_0x4b9f91=_0x2580e3[_0x1ab9('0x34')];}else{logger['info'](_0x1ab9('0x36'));}}else{logger[_0x1ab9('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4b9f91=-0x1;}})[_0x1ab9('0x24')](function(){return Project['getAll']();})[_0x1ab9('0x24')](function(_0x10d950){projects=_0x10d950;return;})[_0x1ab9('0x37')](function(_0x3e49e3){logger[_0x1ab9('0x11')](_0x1ab9('0x38'),_0x3e49e3[_0x1ab9('0xd')]);})['finally'](function(){var _0x30d57c=require(_0x1ab9('0x39'))(config[_0x1ab9('0x8')][_0x1ab9('0x14')],config['agi']['ip'],_0x4b9f91);_0x30d57c['on']('error',errorHandler);_0x30d57c['on'](_0x1ab9('0x3a'),listeningHandler);_0x30d57c['on'](_0x1ab9('0x3b'),connectionHandler);_0x30d57c['on'](_0x1ab9('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0xaecb=['deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','close','handleNotFound','handleUnpublished','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','syncho','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','error','stack','findIndex'];(function(_0x4655bf,_0x7daea2){var _0x4a5344=function(_0x5a74ee){while(--_0x5a74ee){_0x4655bf['push'](_0x4655bf['shift']());}};_0x4a5344(++_0x7daea2);}(_0xaecb,0x1f2));var _0xbaec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaecb[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var syncho=require(_0xbaec('0x0'));var util=require('util');var config=require('../../config/environment');var logger=require('../../config/logger')(_0xbaec('0x1'));var utilLicense=require(_0xbaec('0x2'));var rpc=require(_0xbaec('0x3'));var Project=require(_0xbaec('0x4'));var AGIEmitter=require(_0xbaec('0x5'))[_0xbaec('0x6')];var projects=[];config[_0xbaec('0x1')]=_[_0xbaec('0x7')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xbaec('0x8'),projectUpdateHandler);function connectionHandler(_0x3ad86e){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x3ad86e);agiHandler(_0x3ad86e);}catch(_0x207db7){logger[_0xbaec('0x9')](_0x207db7[_0xbaec('0xa')]);}});});}function projectUpdateHandler(_0x1e25e0){try{var _0x132c75=_[_0xbaec('0xb')](projects,['id',_0x1e25e0['id']]);if(_0x132c75>-0x1){if(_0x1e25e0[_0xbaec('0xc')]===!![]){projects['splice'](_0x132c75,0x1);}else{projects[_0x132c75]=_0x1e25e0;}}else{projects[_0xbaec('0xd')](_0x1e25e0);}}catch(_0x1d1961){logger[_0xbaec('0x9')](_0x1d1961[_0xbaec('0xa')]);}}function listeningHandler(){console[_0xbaec('0xe')](_0xbaec('0xf'),config[_0xbaec('0x1')][_0xbaec('0x10')]);logger[_0xbaec('0x11')](util['format'](_0xbaec('0x12'),config['agi']['ip'],config[_0xbaec('0x1')]['port']));}function errorHandler(_0x434909){if(_0x434909&&_0x434909[_0xbaec('0x13')]&&_0x434909[_0xbaec('0x14')]){logger['error'](util[_0xbaec('0x15')](_0xbaec('0x16'),_0x434909[_0xbaec('0x13')],_0x434909[_0xbaec('0x14')]));}else{logger[_0xbaec('0x9')](util[_0xbaec('0x15')](_0xbaec('0x17'),_0x434909['stack']));}}function closeHandler(){logger[_0xbaec('0x11')](util[_0xbaec('0x15')](_0xbaec('0x18'),this[_0xbaec('0x19')],this[_0xbaec('0x1a')],this[_0xbaec('0x1b')],this['dnid'],this[_0xbaec('0x1c')]));try{createSquareReport(this);}catch(_0x4c7dcf){logger['error'](_0x4c7dcf[_0xbaec('0xa')]);}}function timeoutHandler(){logger[_0xbaec('0x11')](util[_0xbaec('0x15')](_0xbaec('0x1d'),this[_0xbaec('0x19')],this['calleridname'],this['callerid'],this['dnid'],this[_0xbaec('0x1c')]));}function hangupHandler(){logger['info'](util['format'](_0xbaec('0x1e'),this[_0xbaec('0x19')],this['calleridname'],this[_0xbaec('0x1b')],this['dnid'],this[_0xbaec('0x1c')]));this[_0xbaec('0x1f')]=!![];}function createSquareReport(_0x169c98,_0x30ac4b){rpc[_0xbaec('0x20')](_0x169c98)['then'](function(_0x3b04e5){if(_0x30ac4b){_0x30ac4b(null,_0x3b04e5);}})[_0xbaec('0x21')](function(_0x2964f9){if(_0x30ac4b){_0x30ac4b(null,_0x2964f9);}});}function setChannelVariables(_0x58bb07){for(var _0x4965ee in _0x58bb07){if(_0x58bb07[_0xbaec('0x22')](_0x4965ee)){if(_0x4965ee[_0xbaec('0x23')](_0xbaec('0x24'))===0x0){_0x58bb07[_0x4965ee[_0xbaec('0x25')](0x4)]=_0x58bb07[_0x4965ee];delete _0x58bb07[_0x4965ee];}}}}function agiHandler(_0x3452fe){logger['debug'](_0xbaec('0x26'),JSON[_0xbaec('0x27')](_0x3452fe,null,0x2));logger[_0xbaec('0x11')](util[_0xbaec('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3452fe['arg_1'],_0x3452fe[_0xbaec('0x1a')],_0x3452fe[_0xbaec('0x1b')],_0x3452fe['dnid'],_0x3452fe[_0xbaec('0x1c')]));_0x3452fe['on'](_0xbaec('0x9'),errorHandler);_0x3452fe['on'](_0xbaec('0x28'),closeHandler);_0x3452fe['on']('timeout',timeoutHandler);_0x3452fe['evtHangup']=![];_0x3452fe['on']('hangup',hangupHandler);var _0x4063a0=_['find'](projects,[_0xbaec('0x13'),_0x3452fe[_0xbaec('0x19')]]);if(!_0x4063a0)return Project[_0xbaec('0x29')](_0x3452fe);if(!_0x4063a0['production'])return Project[_0xbaec('0x2a')](_0x3452fe);return Project[_0xbaec('0x2b')](_0x4063a0,_0x3452fe);}function main(){var _0x19a6d2;return utilLicense['getLicense']()[_0xbaec('0x2c')](function(_0x30734a){if(!_0x30734a)return;if(_0x30734a[_0xbaec('0x2d')]){if(_0x30734a['callysquare']&&_0x30734a[_0xbaec('0x2e')]>0x0){logger['info'](util[_0xbaec('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x30734a[_0xbaec('0x2e')]));_0x19a6d2=_0x30734a[_0xbaec('0x2e')];}else{logger[_0xbaec('0x11')](_0xbaec('0x2f'));}}else{logger[_0xbaec('0x11')](_0xbaec('0x30'));_0x19a6d2=-0x1;}})[_0xbaec('0x2c')](function(){return Project[_0xbaec('0x31')]();})[_0xbaec('0x2c')](function(_0x17c7bf){projects=_0x17c7bf;return;})[_0xbaec('0x21')](function(_0x5479e0){logger[_0xbaec('0x9')]('[LICENSE]',_0x5479e0['stack']);})[_0xbaec('0x32')](function(){var _0x4d4472=require('./server')(config[_0xbaec('0x1')][_0xbaec('0x10')],config['agi']['ip'],_0x19a6d2);_0x4d4472['on'](_0xbaec('0x9'),errorHandler);_0x4d4472['on']('listening',listeningHandler);_0x4d4472['on']('connection',connectionHandler);_0x4d4472['on'](_0xbaec('0x28'),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 319c3cf..fc483ce 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 _0x4024=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message','catch'];(function(_0x12eaae,_0x1154f4){var _0x33c3f1=function(_0x519853){while(--_0x519853){_0x12eaae['push'](_0x12eaae['shift']());}};_0x33c3f1(++_0x1154f4);}(_0x4024,0x1c4));var _0x4402=function(_0x2923d0,_0x3956b0){_0x2923d0=_0x2923d0-0x0;var _0x21d645=_0x4024[_0x2923d0];return _0x21d645;};'use strict';var BPromise=require(_0x4402('0x0'));var jayson=require(_0x4402('0x1'));var client=jayson[_0x4402('0x2')][_0x4402('0x3')]({'port':0x232b});function request(_0x1dd9b3,_0x55b875){return new BPromise(function(_0x393719,_0x488f5c){return client[_0x4402('0x4')](_0x1dd9b3,_0x55b875)['then'](function(_0x1ad861){if(_0x1ad861[_0x4402('0x5')]){return _0x488f5c(_0x1ad861[_0x4402('0x5')][_0x4402('0x6')]);}else{return _0x393719(_0x1ad861['result']);}})[_0x4402('0x7')](function(_0x218163){return _0x488f5c(_0x218163);});});}exports[_0x4402('0x8')]=function(_0x3f0a81,_0x180e11){return request(_0x4402('0x9'),{'account':_0x3f0a81,'message':_0x180e11});}; \ No newline at end of file +var _0x3971=['jayson/promise','http','then','error','sendMailMessage','SendMail','bluebird'];(function(_0x2b4cd0,_0x457878){var _0x474616=function(_0x435315){while(--_0x435315){_0x2b4cd0['push'](_0x2b4cd0['shift']());}};_0x474616(++_0x457878);}(_0x3971,0x180));var _0x1397=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x3971[_0x210603];return _0x1bcb7d;};'use strict';var BPromise=require(_0x1397('0x0'));var jayson=require(_0x1397('0x1'));var client=jayson['client'][_0x1397('0x2')]({'port':0x232b});function request(_0x41af67,_0x2a375e){return new BPromise(function(_0x139f5f,_0x15f038){return client['request'](_0x41af67,_0x2a375e)[_0x1397('0x3')](function(_0x3bded0){if(_0x3bded0[_0x1397('0x4')]){return _0x15f038(_0x3bded0[_0x1397('0x4')]['message']);}else{return _0x139f5f(_0x3bded0['result']);}})['catch'](function(_0x17ff9b){return _0x15f038(_0x17ff9b);});});}exports[_0x1397('0x5')]=function(_0x2a06c3,_0x523d18){return request(_0x1397('0x6'),{'account':_0x2a06c3,'message':_0x523d18});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 473ccd6..7c98f6c 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbe9=['stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','error','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','clear','[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\x20found','continueAt','Project\x20%s\x20not\x20published','lodash','util','./rpc','./mailRpc','./graph','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','toJson','mxGraphModel','inspect','production','start','debug','root'];(function(_0x27e280,_0x25f2d6){var _0x511711=function(_0xf06d09){while(--_0xf06d09){_0x27e280['push'](_0x27e280['shift']());}};_0x511711(++_0x25f2d6);}(_0xcbe9,0x91));var _0x9cbe=function(_0x1d7648,_0xe1536b){_0x1d7648=_0x1d7648-0x0;var _0x37e287=_0xcbe9[_0x1d7648];return _0x37e287;};'use strict';var _=require(_0x9cbe('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require(_0x9cbe('0x1'));var logger=require('../../config/logger')('agi');var rpc=require(_0x9cbe('0x2'));var mailRpc=require(_0x9cbe('0x3'));var Graph=require(_0x9cbe('0x4'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9cbe('0x5')]()[_0x9cbe('0x6')](function(_0x5cfc68){logger['error'](_0x9cbe('0x7'),_0x5cfc68['stack']);return[];});}function addVertex(_0x886bf4,_0x16cd53,_0x8bce35){_0x16cd53[_0x9cbe('0x8')]=_0x8bce35;if(_0x16cd53[_0x9cbe('0x9')]('retry')){_0x16cd53[_0x9cbe('0xa')]=parseInt(_0x16cd53[_0x9cbe('0xb')],0xa);}_0x886bf4[_0x9cbe('0xc')](_[_0x9cbe('0xd')](_0x16cd53,_0x9cbe('0xe')));}function initGraph(_0x3e0ea9,_0x9215a9){var _0x8ffd18=new Graph();for(var _0x1c76b1 in _0x3e0ea9){if(_0x3e0ea9['hasOwnProperty'](_0x1c76b1)){if(_[_0x9cbe('0xf')](_0x3e0ea9[_0x1c76b1])){for(var _0x394afc=0x0;_0x394afc<_0x3e0ea9[_0x1c76b1][_0x9cbe('0x10')];_0x394afc+=0x1){addVertex(_0x8ffd18,_0x3e0ea9[_0x1c76b1][_0x394afc],_0x1c76b1);}}else{addVertex(_0x8ffd18,_0x3e0ea9[_0x1c76b1],_0x1c76b1);}}}for(var _0x1d2c93=0x0;_0x1d2c93<_0x9215a9[_0x9cbe('0x10')];_0x1d2c93+=0x1){if(_0x9215a9[_0x1d2c93][_0x9cbe('0x11')]&&_0x9215a9[_0x1d2c93][_0x9cbe('0x12')]){_0x8ffd18['addEdge'](_0x9215a9[_0x1d2c93][_0x9cbe('0x11')],_0x9215a9[_0x1d2c93][_0x9cbe('0x12')],_0x9215a9[_0x1d2c93]['value']);}}return _0x8ffd18;}function getRoot(_0x4fb3d4){return parser[_0x9cbe('0x13')](_0x4fb3d4,{'object':!![]})[_0x9cbe('0x14')]['root'];}function inspect(_0x5238a0){return util[_0x9cbe('0x15')](_0x5238a0,{'showHidden':![],'depth':null});}function initialize(_0x20b669,_0x15405c){var _0x13e9da=getRoot(_0x20b669[_0x9cbe('0x16')]);if(!_0x13e9da||!_0x13e9da[_0x9cbe('0x17')])return;var _0x2d67d7,_0x4af24a,_0x3eb20b;logger[_0x9cbe('0x18')](_0x9cbe('0x19'),JSON[_0x9cbe('0x1a')](_0x13e9da,null,0x2));_0x15405c['joinAt']=moment()[_0x9cbe('0x1b')](_0x9cbe('0x1c'));_0x2d67d7=initGraph(_['omit'](_0x13e9da,_0x9cbe('0xe')),_0x13e9da['mxCell']);_0x4af24a=new Vertices(_0x15405c,rpc,mailRpc);logger[_0x9cbe('0x1d')](util[_0x9cbe('0x1b')](_0x9cbe('0x1e'),_0x15405c[_0x9cbe('0x1f')],_0x15405c[_0x9cbe('0x20')],_0x15405c[_0x9cbe('0x21')],_0x15405c['dnid'],_0x15405c[_0x9cbe('0x22')]));_0x2d67d7[_0x9cbe('0x23')](_0x13e9da[_0x9cbe('0x17')]['id'],function(_0x21899f){try{_0x21899f=_0x4af24a['clear'](_0x21899f);logger[_0x9cbe('0x18')](_0x9cbe('0x24'),JSON[_0x9cbe('0x1a')](_0x21899f,null,0x2));if(_0x21899f[_0x9cbe('0x8')]==='gotoc'){logger[_0x9cbe('0x1d')](_0x9cbe('0x25'));_0x15405c[_0x9cbe('0x26')]=_0x21899f[_0x9cbe('0x26')]||_0x15405c['context'];_0x15405c[_0x9cbe('0x27')]=_0x21899f[_0x9cbe('0x27')];_0x15405c[_0x9cbe('0x28')]=_0x21899f['priority']?_0x21899f['priority']-0x1:0x1;return null;}else if(_0x21899f&&_0x4af24a[_0x21899f[_0x9cbe('0x8')]]){_0x3eb20b=_0x4af24a[_0x21899f[_0x9cbe('0x8')]](_0x21899f);logger[_0x9cbe('0x1d')](_0x9cbe('0x29'),JSON[_0x9cbe('0x1a')](_0x3eb20b,null,0x2));if(_0x3eb20b&&_0x3eb20b['code']===AGI_CODE_SUCCESS&&_0x3eb20b[_0x9cbe('0x2a')]!==AGI_RESULT_ERROR&&!_0x15405c['evtHangup']){logger[_0x9cbe('0x18')](_0x9cbe('0x29'),inspect(_0x3eb20b));return _[_0x9cbe('0x2b')](_0x3eb20b[_0x9cbe('0x2a')])?null:_0x3eb20b[_0x9cbe('0x2a')]['toString']();}else{logger[_0x9cbe('0x2c')]('response',inspect(_0x3eb20b));return null;}}else{logger[_0x9cbe('0x2c')](_0x9cbe('0x2d'));return null;}}catch(_0x164f51){logger['error'](_0x164f51[_0x9cbe('0x2e')]);return null;}});if(_0x13e9da[_0x9cbe('0x2f')]){logger[_0x9cbe('0x1d')](util[_0x9cbe('0x1b')](_0x9cbe('0x30'),_0x15405c[_0x9cbe('0x1f')],_0x15405c[_0x9cbe('0x20')],_0x15405c[_0x9cbe('0x21')],_0x15405c[_0x9cbe('0x31')],_0x15405c[_0x9cbe('0x22')]));_0x2d67d7[_0x9cbe('0x23')](_0x13e9da[_0x9cbe('0x2f')]['id'],function(_0x526e39){try{_0x526e39=_0x4af24a[_0x9cbe('0x32')](_0x526e39);logger[_0x9cbe('0x18')](_0x9cbe('0x24'),JSON[_0x9cbe('0x1a')](_0x526e39,null,0x2));if(_0x526e39&&_0x4af24a[_0x526e39[_0x9cbe('0x8')]]){_0x3eb20b=_0x4af24a[_0x526e39['agicommand']](_0x526e39);if(_0x3eb20b){logger[_0x9cbe('0x18')](_0x9cbe('0x29'),inspect(_0x3eb20b));return _[_0x9cbe('0x2b')](_0x3eb20b['result'])?null:_0x3eb20b['result']['toString']();}else{logger['error'](_0x9cbe('0x29'),inspect(_0x3eb20b));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0xc88984){logger[_0x9cbe('0x2c')](_0xc88984[_0x9cbe('0x2e')]);return null;}});}logger[_0x9cbe('0x1d')](util[_0x9cbe('0x1b')](_0x9cbe('0x33'),_0x15405c['arg_1'],_0x15405c[_0x9cbe('0x20')],_0x15405c[_0x9cbe('0x21')],_0x15405c[_0x9cbe('0x31')],_0x15405c[_0x9cbe('0x22')]));logger[_0x9cbe('0x1d')](util[_0x9cbe('0x1b')](_0x9cbe('0x34'),_0x15405c[_0x9cbe('0x26')],_0x15405c['extension'],parseInt(_0x15405c[_0x9cbe('0x28')],0xa)+0x1));_0x15405c['continueAt'](_0x15405c[_0x9cbe('0x26')],_0x15405c[_0x9cbe('0x27')],parseInt(_0x15405c[_0x9cbe('0x28')],0xa)+0x1);_0x15405c[_0x9cbe('0x35')]();}function handleNotFound(_0x3e71fa){logger['error'](util[_0x9cbe('0x1b')](_0x9cbe('0x36'),_0x3e71fa[_0x9cbe('0x1f')]));_0x3e71fa[_0x9cbe('0x37')](_0x3e71fa[_0x9cbe('0x26')],_0x3e71fa[_0x9cbe('0x27')],parseInt(_0x3e71fa[_0x9cbe('0x28')],0xa)+0x1);_0x3e71fa[_0x9cbe('0x35')]();}function handleUnpublished(_0x32564a){logger[_0x9cbe('0x2c')](util[_0x9cbe('0x1b')](_0x9cbe('0x38'),_0x32564a[_0x9cbe('0x1f')]));_0x32564a[_0x9cbe('0x37')](_0x32564a['context'],_0x32564a[_0x9cbe('0x27')],parseInt(_0x32564a['priority'],0xa)+0x1);_0x32564a[_0x9cbe('0x35')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x745f=['length','source','target','addEdge','value','toJson','mxGraphModel','root','production','start','stringify','joinAt','format','mxCell','info','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','vertex','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','isArray'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x745f,0x199));var _0xf745=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x745f[_0x1db481];return _0x3db95b;};'use strict';var _=require(_0xf745('0x0'));var moment=require(_0xf745('0x1'));var parser=require('xml2json');var util=require(_0xf745('0x2'));var logger=require(_0xf745('0x3'))(_0xf745('0x4'));var rpc=require(_0xf745('0x5'));var mailRpc=require(_0xf745('0x6'));var Graph=require(_0xf745('0x7'));var Vertices=require(_0xf745('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xf745('0x9')]()[_0xf745('0xa')](function(_0x4b7375){logger['error'](_0xf745('0xb'),_0x4b7375[_0xf745('0xc')]);return[];});}function addVertex(_0x46efbb,_0x13bf2a,_0x2bffb6){_0x13bf2a[_0xf745('0xd')]=_0x2bffb6;if(_0x13bf2a[_0xf745('0xe')](_0xf745('0xf'))){_0x13bf2a['maxRetry']=parseInt(_0x13bf2a['retry'],0xa);}_0x46efbb['addVertex'](_[_0xf745('0x10')](_0x13bf2a,'mxCell'));}function initGraph(_0x577e44,_0x3aabf6){var _0x3708ea=new Graph();for(var _0xc5402c in _0x577e44){if(_0x577e44[_0xf745('0xe')](_0xc5402c)){if(_[_0xf745('0x11')](_0x577e44[_0xc5402c])){for(var _0x547227=0x0;_0x547227<_0x577e44[_0xc5402c][_0xf745('0x12')];_0x547227+=0x1){addVertex(_0x3708ea,_0x577e44[_0xc5402c][_0x547227],_0xc5402c);}}else{addVertex(_0x3708ea,_0x577e44[_0xc5402c],_0xc5402c);}}}for(var _0x417629=0x0;_0x417629<_0x3aabf6['length'];_0x417629+=0x1){if(_0x3aabf6[_0x417629][_0xf745('0x13')]&&_0x3aabf6[_0x417629][_0xf745('0x14')]){_0x3708ea[_0xf745('0x15')](_0x3aabf6[_0x417629]['source'],_0x3aabf6[_0x417629][_0xf745('0x14')],_0x3aabf6[_0x417629][_0xf745('0x16')]);}}return _0x3708ea;}function getRoot(_0x168c14){return parser[_0xf745('0x17')](_0x168c14,{'object':!![]})[_0xf745('0x18')][_0xf745('0x19')];}function inspect(_0x1b1930){return util['inspect'](_0x1b1930,{'showHidden':![],'depth':null});}function initialize(_0x4895ba,_0x6e384b){var _0x4ac840=getRoot(_0x4895ba[_0xf745('0x1a')]);if(!_0x4ac840||!_0x4ac840[_0xf745('0x1b')])return;var _0x60420,_0x59b387,_0x3d4d30;logger['debug']('root',JSON[_0xf745('0x1c')](_0x4ac840,null,0x2));_0x6e384b[_0xf745('0x1d')]=moment()[_0xf745('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');_0x60420=initGraph(_['omit'](_0x4ac840,'mxCell'),_0x4ac840[_0xf745('0x1f')]);_0x59b387=new Vertices(_0x6e384b,rpc,mailRpc);logger[_0xf745('0x20')](util[_0xf745('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x6e384b[_0xf745('0x21')],_0x6e384b[_0xf745('0x22')],_0x6e384b[_0xf745('0x23')],_0x6e384b[_0xf745('0x24')],_0x6e384b[_0xf745('0x25')]));_0x60420[_0xf745('0x26')](_0x4ac840[_0xf745('0x1b')]['id'],function(_0x54e00e){try{_0x54e00e=_0x59b387[_0xf745('0x27')](_0x54e00e);logger[_0xf745('0x28')](_0xf745('0x29'),JSON[_0xf745('0x1c')](_0x54e00e,null,0x2));if(_0x54e00e['agicommand']==='gotoc'){logger[_0xf745('0x20')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x6e384b[_0xf745('0x2a')]=_0x54e00e[_0xf745('0x2a')]||_0x6e384b['context'];_0x6e384b[_0xf745('0x2b')]=_0x54e00e['extension'];_0x6e384b[_0xf745('0x2c')]=_0x54e00e[_0xf745('0x2c')]?_0x54e00e[_0xf745('0x2c')]-0x1:0x1;return null;}else if(_0x54e00e&&_0x59b387[_0x54e00e[_0xf745('0xd')]]){_0x3d4d30=_0x59b387[_0x54e00e[_0xf745('0xd')]](_0x54e00e);logger[_0xf745('0x20')](_0xf745('0x2d'),JSON[_0xf745('0x1c')](_0x3d4d30,null,0x2));if(_0x3d4d30&&_0x3d4d30[_0xf745('0x2e')]===AGI_CODE_SUCCESS&&_0x3d4d30[_0xf745('0x2f')]!==AGI_RESULT_ERROR&&!_0x6e384b[_0xf745('0x30')]){logger[_0xf745('0x28')]('response',inspect(_0x3d4d30));return _[_0xf745('0x31')](_0x3d4d30['result'])?null:_0x3d4d30['result'][_0xf745('0x32')]();}else{logger[_0xf745('0x33')]('response',inspect(_0x3d4d30));return null;}}else{logger[_0xf745('0x33')](_0xf745('0x34'));return null;}}catch(_0x353068){logger['error'](_0x353068[_0xf745('0xc')]);return null;}});if(_0x4ac840[_0xf745('0x35')]){logger[_0xf745('0x20')](util['format'](_0xf745('0x36'),_0x6e384b[_0xf745('0x21')],_0x6e384b[_0xf745('0x22')],_0x6e384b[_0xf745('0x23')],_0x6e384b['dnid'],_0x6e384b['uniqueid']));_0x60420['traverseBFS'](_0x4ac840[_0xf745('0x35')]['id'],function(_0x244af1){try{_0x244af1=_0x59b387[_0xf745('0x27')](_0x244af1);logger[_0xf745('0x28')](_0xf745('0x29'),JSON[_0xf745('0x1c')](_0x244af1,null,0x2));if(_0x244af1&&_0x59b387[_0x244af1[_0xf745('0xd')]]){_0x3d4d30=_0x59b387[_0x244af1[_0xf745('0xd')]](_0x244af1);if(_0x3d4d30){logger[_0xf745('0x28')](_0xf745('0x2d'),inspect(_0x3d4d30));return _['isUndefined'](_0x3d4d30[_0xf745('0x2f')])?null:_0x3d4d30[_0xf745('0x2f')][_0xf745('0x32')]();}else{logger['error'](_0xf745('0x2d'),inspect(_0x3d4d30));return null;}}else{logger[_0xf745('0x33')](_0xf745('0x34'));return null;}}catch(_0x3fefe0){logger['error'](_0x3fefe0[_0xf745('0xc')]);return null;}});}logger['info'](util[_0xf745('0x1e')](_0xf745('0x37'),_0x6e384b['arg_1'],_0x6e384b[_0xf745('0x22')],_0x6e384b[_0xf745('0x23')],_0x6e384b['dnid'],_0x6e384b[_0xf745('0x25')]));logger[_0xf745('0x20')](util[_0xf745('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x6e384b[_0xf745('0x2a')],_0x6e384b[_0xf745('0x2b')],parseInt(_0x6e384b[_0xf745('0x2c')],0xa)+0x1));_0x6e384b[_0xf745('0x38')](_0x6e384b[_0xf745('0x2a')],_0x6e384b['extension'],parseInt(_0x6e384b[_0xf745('0x2c')],0xa)+0x1);_0x6e384b[_0xf745('0x39')]();}function handleNotFound(_0x3045ce){logger[_0xf745('0x33')](util['format'](_0xf745('0x3a'),_0x3045ce[_0xf745('0x21')]));_0x3045ce['continueAt'](_0x3045ce[_0xf745('0x2a')],_0x3045ce[_0xf745('0x2b')],parseInt(_0x3045ce['priority'],0xa)+0x1);_0x3045ce['close']();}function handleUnpublished(_0x454f9c){logger[_0xf745('0x33')](util['format'](_0xf745('0x3b'),_0x454f9c[_0xf745('0x21')]));_0x454f9c['continueAt'](_0x454f9c[_0xf745('0x2a')],_0x454f9c[_0xf745('0x2b')],parseInt(_0x454f9c[_0xf745('0x2c')],0xa)+0x1);_0x454f9c[_0xf745('0x39')]();}module[_0xf745('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 9fdd7ac..c7baffd 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 _0x071d=['split','slice','trim','emit','Transform','call','_localBuffer','inherits','prototype','toString','_inBody','indexOf','substring','length'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x071d,0x82));var _0xd071=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0x071d[_0x479509];return _0x382da8;};'use strict';var util=require('util');var Transform=require('stream')[_0xd071('0x0')];function AGIReply(_0x160075){Transform[_0xd071('0x1')](this,_0x160075);this[_0xd071('0x2')]='';this['_inBody']=![];}util[_0xd071('0x3')](AGIReply,Transform);AGIReply[_0xd071('0x4')]['_transform']=function(_0x24df87,_0x476906,_0x187756){var _0x12025a='\x0a',_0x30216a=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x649f22=-0x1,_0x80236a=-0x1,_0x3f09fb='',_0x40c1cb=0x0,_0x3e4408='',_0x26ae52='';this[_0xd071('0x2')]+=_0x24df87[_0xd071('0x5')]();_0x3e4408=this[_0xd071('0x2')];if(!this[_0xd071('0x6')]){_0x40c1cb=0x0;while(_0x30216a[_0x40c1cb]){while((_0x80236a=_0x3e4408[_0xd071('0x7')](_0x30216a[_0x40c1cb]))!=-0x1){_0x3f09fb=_0x30216a[_0x40c1cb];_0x26ae52=_0x3e4408['substring'](0x0,_0x80236a);_0x3e4408=_0x3e4408[_0xd071('0x8')](_0x80236a+_0x3f09fb[_0xd071('0x9')]);var _0x311b60=_0x26ae52[_0xd071('0xa')](_0x12025a),_0xeeaba5=0x0,_0x211d41={},_0x2de8d4='',_0x5a1464='',_0x124fe8=-0x1;while(_0x311b60[_0xeeaba5]){_0x124fe8=_0x311b60[_0xeeaba5]['indexOf'](':');if(_0x124fe8!=-0x1){_0x2de8d4=_0x311b60[_0xeeaba5][_0xd071('0xb')](0x0,_0x124fe8)[_0xd071('0xc')]();_0x5a1464=_0x311b60[_0xeeaba5][_0xd071('0xb')](_0x124fe8+0x1)['trim']();if(_0x2de8d4[_0xd071('0x9')]>0x0){_0x211d41[_0x2de8d4]=_0x5a1464;}}else{}_0xeeaba5++;}this[_0xd071('0xd')]('headers',_0x211d41);this[_0xd071('0x6')]=!![];}_0x40c1cb++;}this[_0xd071('0x2')]=_0x3e4408;}else{while((_0x649f22=_0x3e4408[_0xd071('0x7')](_0x12025a))!=-0x1){_0x26ae52=_0x3e4408[_0xd071('0x8')](0x0,_0x649f22);this[_0xd071('0xd')]('line',_0x26ae52);_0x3e4408=_0x3e4408[_0xd071('0x8')](_0x649f22+_0x12025a['length']);}this['_localBuffer']=_0x3e4408;}_0x187756();};module['exports']=AGIReply; \ No newline at end of file +var _0x66f4=['slice','trim','length','emit','indexOf','line','exports','stream','call','_localBuffer','_inBody','_transform','toString','substring','split'];(function(_0x1f09fa,_0x3265ca){var _0x197c8d=function(_0x91c3b){while(--_0x91c3b){_0x1f09fa['push'](_0x1f09fa['shift']());}};_0x197c8d(++_0x3265ca);}(_0x66f4,0x7f));var _0x466f=function(_0x38fe19,_0x1785dc){_0x38fe19=_0x38fe19-0x0;var _0x34b138=_0x66f4[_0x38fe19];return _0x34b138;};'use strict';var util=require('util');var Transform=require(_0x466f('0x0'))['Transform'];function AGIReply(_0x4a4c10){Transform[_0x466f('0x1')](this,_0x4a4c10);this[_0x466f('0x2')]='';this[_0x466f('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x466f('0x4')]=function(_0x53caa9,_0x5388ae,_0x231b3c){var _0x941ea6='\x0a',_0x3e712c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x435b63=-0x1,_0x5224b2=-0x1,_0xb9c5be='',_0x161913=0x0,_0x502318='',_0x4b3c28='';this[_0x466f('0x2')]+=_0x53caa9[_0x466f('0x5')]();_0x502318=this[_0x466f('0x2')];if(!this[_0x466f('0x3')]){_0x161913=0x0;while(_0x3e712c[_0x161913]){while((_0x5224b2=_0x502318['indexOf'](_0x3e712c[_0x161913]))!=-0x1){_0xb9c5be=_0x3e712c[_0x161913];_0x4b3c28=_0x502318[_0x466f('0x6')](0x0,_0x5224b2);_0x502318=_0x502318[_0x466f('0x6')](_0x5224b2+_0xb9c5be['length']);var _0x32ff9c=_0x4b3c28[_0x466f('0x7')](_0x941ea6),_0x2b05bf=0x0,_0x4b742c={},_0x173b69='',_0x393ad3='',_0x4803e4=-0x1;while(_0x32ff9c[_0x2b05bf]){_0x4803e4=_0x32ff9c[_0x2b05bf]['indexOf'](':');if(_0x4803e4!=-0x1){_0x173b69=_0x32ff9c[_0x2b05bf][_0x466f('0x8')](0x0,_0x4803e4)[_0x466f('0x9')]();_0x393ad3=_0x32ff9c[_0x2b05bf]['slice'](_0x4803e4+0x1)['trim']();if(_0x173b69[_0x466f('0xa')]>0x0){_0x4b742c[_0x173b69]=_0x393ad3;}}else{}_0x2b05bf++;}this[_0x466f('0xb')]('headers',_0x4b742c);this[_0x466f('0x3')]=!![];}_0x161913++;}this['_localBuffer']=_0x502318;}else{while((_0x435b63=_0x502318[_0x466f('0xc')](_0x941ea6))!=-0x1){_0x4b3c28=_0x502318['substring'](0x0,_0x435b63);this[_0x466f('0xb')](_0x466f('0xd'),_0x4b3c28);_0x502318=_0x502318['substring'](_0x435b63+_0x941ea6[_0x466f('0xa')]);}this[_0x466f('0x2')]=_0x502318;}_0x231b3c();};module[_0x466f('0xe')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index d0d96fd..36ebdcf 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 _0x66fa=['then','error','message','result','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','Smtp','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','createSquareRecording','CreateSquareRecording','ShowCmHopper','ListId','ShowPause','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','lodash','moment','jayson/promise','request'];(function(_0x187266,_0x3f99df){var _0x1a83bc=function(_0x189626){while(--_0x189626){_0x187266['push'](_0x187266['shift']());}};_0x1a83bc(++_0x3f99df);}(_0x66fa,0x168));var _0xa66f=function(_0x348829,_0x56b56a){_0x348829=_0x348829-0x0;var _0x48b73b=_0x66fa[_0x348829];return _0x48b73b;};'use strict';var _=require(_0xa66f('0x0'));var moment=require(_0xa66f('0x1'));var jayson=require(_0xa66f('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x3dc747,_0x2325d7){return new Promise(function(_0x3aaeff,_0x2e663b){return client[_0xa66f('0x3')](_0x3dc747,_0x2325d7)[_0xa66f('0x4')](function(_0x342dd9){if(_0x342dd9[_0xa66f('0x5')]){return _0x2e663b(_0x342dd9[_0xa66f('0x5')][_0xa66f('0x6')]);}else{return _0x3aaeff(_0x342dd9[_0xa66f('0x7')]);}})['catch'](function(_0x1cf624){return _0x2e663b(_0x1cf624);});});}exports['getSquareProjects']=function(){return request(_0xa66f('0x8'),{'options':{'raw':![],'attributes':['id',_0xa66f('0x9'),'production']}});};exports[_0xa66f('0xa')]=function(_0x32dc03){return request(_0xa66f('0xb'),{'options':{'raw':![],'where':{'name':_0x32dc03},'attributes':[_0xa66f('0xc')]}});};exports[_0xa66f('0xd')]=function(_0x42f064){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x42f064},'include':[{'model':'MailServerOut','as':_0xa66f('0xe'),'include':[{'model':'CloudProvider','as':_0xa66f('0xf')}]}],'attributes':['id',_0xa66f('0x9'),_0xa66f('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x26030b){return request(_0xa66f('0xb'),{'options':{'where':{'id':_0x26030b},'attributes':['name']}});};exports[_0xa66f('0x11')]=function(_0x24423a){return request(_0xa66f('0x12'),{'options':{'where':{'id':_0x24423a},'attributes':[_0xa66f('0x9')]}});};exports['getVariableById']=function(_0x3795cb){return request(_0xa66f('0x13'),{'options':{'where':{'id':_0x3795cb},'attributes':['name']}});};exports[_0xa66f('0x14')]=function(_0x33270b){return request(_0xa66f('0x15'),{'options':{'where':{'id':_0x33270b},'attributes':[_0xa66f('0x16')]}});};exports[_0xa66f('0x17')]=function(_0x362988){return request('ShowUser',{'options':{'where':{'id':_0x362988},'attributes':['name']}});};exports[_0xa66f('0x18')]=function(_0x16648b){return request(_0xa66f('0x19'),{'options':{'where':{'phone':_0x16648b[_0xa66f('0x1a')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x1e448e){return request(_0xa66f('0x1b'),{'options':{'where':{'id':_0x1e448e},'attributes':['name']}});};exports[_0xa66f('0x1c')]=function(_0x4b4099){return request(_0xa66f('0x1d'),{'options':{'where':{'id':_0x4b4099},'attributes':[_0xa66f('0x1e')]}});};exports['getIntervalById']=function(_0x585208){return request(_0xa66f('0x1f'),{'options':{'raw':![],'where':{'id':_0x585208},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x535359){return request(_0xa66f('0x20'),{'options':{'where':{'id':_0x535359},'attributes':['id',_0xa66f('0x9')]}});};exports[_0xa66f('0x21')]=function(_0x4cfec6){return request(_0xa66f('0x22'),{'body':_0x4cfec6});};exports[_0xa66f('0x23')]=function(_0x5e8c5b){return request(_0xa66f('0x24'),{'body':_0x5e8c5b});};exports[_0xa66f('0x25')]=function(_0xf6f0b8){return request(_0xa66f('0x26'),{'body':_[_0xa66f('0x27')](_0xf6f0b8,{'project_name':_0xf6f0b8[_0xa66f('0x28')],'prev_project_name':_0xf6f0b8['arg_2']||'','is_subproject':_0xf6f0b8['arg_2']?!![]:![],'leaveAt':moment()[_0xa66f('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xa66f('0x2a')]=function(_0x278531){return request(_0xa66f('0x2b'),{'body':_0x278531});};exports['createSquareMessage']=function(_0x161f53){return request('CreateSquareMessage',{'body':_0x161f53});};exports['createCmContact']=function(_0x4c7b82){return request(_0xa66f('0x2c'),{'options':{'raw':![],'where':{'phone':_0x4c7b82['phone'],'ListId':_0x4c7b82[_0xa66f('0x2d')]}}})[_0xa66f('0x4')](function(_0x386c4d){if(_0x386c4d){return _0x386c4d;}return request('CreateCmContact',{'body':_0x4c7b82});});};exports['getPauseById']=function(_0x3ad042){return request(_0xa66f('0x2e'),{'options':{'where':{'id':_0x3ad042},'attributes':[_0xa66f('0x9')]}});};exports['agentLogin']=function(_0x46c525,_0x56116a){return request(_0xa66f('0x2f'),{'body':{'interface':_0x56116a},'options':{'where':_0x46c525}});};exports[_0xa66f('0x30')]=function(_0x342dde,_0x36525b,_0x2a1e6b){return request(_0xa66f('0x31'),{'body':{'type':_0x36525b,'uniqueid':_0x2a1e6b},'options':{'where':_0x342dde}});};exports['agentUnpause']=function(_0x3e5b98){return request(_0xa66f('0x32'),{'body':{},'options':{'where':_0x3e5b98}});};exports['agentLogout']=function(_0x1d37c2){return request(_0xa66f('0x33'),{'body':{},'options':{'where':_0x1d37c2}});}; \ No newline at end of file +var _0xc906=['arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentLogout','LogoutUser','lodash','moment','client','http','request','then','error','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','Interval','Intervals','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1'];(function(_0x162be7,_0x399cd5){var _0x58da4c=function(_0x4d5a49){while(--_0x4d5a49){_0x162be7['push'](_0x162be7['shift']());}};_0x58da4c(++_0x399cd5);}(_0xc906,0x1ad));var _0x6c90=function(_0x47fd38,_0x536b52){_0x47fd38=_0x47fd38-0x0;var _0x12321b=_0xc906[_0x47fd38];return _0x12321b;};'use strict';var _=require(_0x6c90('0x0'));var moment=require(_0x6c90('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x6c90('0x2')][_0x6c90('0x3')]({'port':0x2329});function request(_0xc65efc,_0x52d2ec){return new Promise(function(_0x3b57e1,_0x237d5d){return client[_0x6c90('0x4')](_0xc65efc,_0x52d2ec)[_0x6c90('0x5')](function(_0x114ba2){if(_0x114ba2[_0x6c90('0x6')]){return _0x237d5d(_0x114ba2['error']['message']);}else{return _0x3b57e1(_0x114ba2['result']);}})[_0x6c90('0x7')](function(_0x54d440){return _0x237d5d(_0x54d440);});});}exports[_0x6c90('0x8')]=function(){return request(_0x6c90('0x9'),{'options':{'raw':![],'attributes':['id',_0x6c90('0xa'),_0x6c90('0xb')]}});};exports[_0x6c90('0xc')]=function(_0x43e2bd){return request(_0x6c90('0xd'),{'options':{'raw':![],'where':{'name':_0x43e2bd},'attributes':[_0x6c90('0xb')]}});};exports[_0x6c90('0xe')]=function(_0x188ca0){return request(_0x6c90('0xf'),{'options':{'raw':![],'where':{'id':_0x188ca0},'include':[{'model':_0x6c90('0x10'),'as':_0x6c90('0x11'),'include':[{'model':_0x6c90('0x12'),'as':'CloudProvider'}]}],'attributes':['id','name',_0x6c90('0x13')],'smtp':!![]}});};exports[_0x6c90('0x14')]=function(_0xe093a5){return request(_0x6c90('0xd'),{'options':{'where':{'id':_0xe093a5},'attributes':[_0x6c90('0xa')]}});};exports[_0x6c90('0x15')]=function(_0x117da5){return request(_0x6c90('0x16'),{'options':{'where':{'id':_0x117da5},'attributes':[_0x6c90('0xa')]}});};exports[_0x6c90('0x17')]=function(_0x49e7ef){return request(_0x6c90('0x18'),{'options':{'where':{'id':_0x49e7ef},'attributes':[_0x6c90('0xa')]}});};exports[_0x6c90('0x19')]=function(_0x1c6143){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1c6143},'attributes':[_0x6c90('0x1a')]}});};exports[_0x6c90('0x1b')]=function(_0x5589ad){return request(_0x6c90('0x1c'),{'options':{'where':{'id':_0x5589ad},'attributes':[_0x6c90('0xa')]}});};exports[_0x6c90('0x1d')]=function(_0x424902){return request(_0x6c90('0x1e'),{'options':{'where':{'phone':_0x424902[_0x6c90('0x1f')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x9fc18e){return request(_0x6c90('0x20'),{'options':{'where':{'id':_0x9fc18e},'attributes':[_0x6c90('0xa')]}});};exports['getSoundById']=function(_0x5b772a){return request(_0x6c90('0x21'),{'options':{'where':{'id':_0x5b772a},'attributes':[_0x6c90('0x22')]}});};exports['getIntervalById']=function(_0x224115){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x224115},'include':[{'model':_0x6c90('0x23'),'as':_0x6c90('0x24')}]}});};exports['getSmsAccountById']=function(_0x137285){return request('ShowSmsAccount',{'options':{'where':{'id':_0x137285},'attributes':['id','name']}});};exports[_0x6c90('0x25')]=function(_0x59ba0e){return request(_0x6c90('0x26'),{'body':_0x59ba0e});};exports['createSquareDetailsReport']=function(_0xc3f320){return request(_0x6c90('0x27'),{'body':_0xc3f320});};exports[_0x6c90('0x28')]=function(_0x1ddc4){return request(_0x6c90('0x29'),{'body':_['merge'](_0x1ddc4,{'project_name':_0x1ddc4[_0x6c90('0x2a')],'prev_project_name':_0x1ddc4[_0x6c90('0x2b')]||'','is_subproject':_0x1ddc4['arg_2']?!![]:![],'leaveAt':moment()[_0x6c90('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x6c90('0x2d')]=function(_0x289cba){return request(_0x6c90('0x2e'),{'body':_0x289cba});};exports[_0x6c90('0x2f')]=function(_0x1dad84){return request('CreateSquareMessage',{'body':_0x1dad84});};exports[_0x6c90('0x30')]=function(_0x122246){return request(_0x6c90('0x31'),{'options':{'raw':![],'where':{'phone':_0x122246['phone'],'ListId':_0x122246[_0x6c90('0x32')]}}})[_0x6c90('0x5')](function(_0x18fb32){if(_0x18fb32){return _0x18fb32;}return request(_0x6c90('0x33'),{'body':_0x122246});});};exports[_0x6c90('0x34')]=function(_0x4ab78b){return request(_0x6c90('0x35'),{'options':{'where':{'id':_0x4ab78b},'attributes':['name']}});};exports[_0x6c90('0x36')]=function(_0x290b0d,_0x131a83){return request('LoginUser',{'body':{'interface':_0x131a83},'options':{'where':_0x290b0d}});};exports[_0x6c90('0x37')]=function(_0x3f9500,_0x238492,_0x5a1ef5){return request(_0x6c90('0x38'),{'body':{'type':_0x238492,'uniqueid':_0x5a1ef5},'options':{'where':_0x3f9500}});};exports['agentUnpause']=function(_0x3cac66){return request('UnpauseUser',{'body':{},'options':{'where':_0x3cac66}});};exports[_0x6c90('0x39')]=function(_0x56e5ca){return request(_0x6c90('0x3a'),{'body':{},'options':{'where':_0x56e5ca}});}; \ 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 03654d8..9fc4728 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 _0x7163=['./polly'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x7163,0x1ef));var _0x3716=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x7163[_0x5f519b];return _0x2461e2;};var polly=require(_0x3716('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xcbd3=['./lex','exports','./polly'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x258fac,_0x2654e7){_0x258fac=_0x258fac-0x0;var _0x295904=_0xcbd3[_0x258fac];return _0x295904;};var polly=require(_0x3cbd('0x0'));var lex=require(_0x3cbd('0x1'));module[_0x3cbd('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 89ff611..ed33311 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 _0xb43b=['./lib/api','exports'];(function(_0x116c04,_0x4963da){var _0x9e011d=function(_0x143880){while(--_0x143880){_0x116c04['push'](_0x116c04['shift']());}};_0x9e011d(++_0x4963da);}(_0xb43b,0x1b2));var _0xbb43=function(_0x24ec88,_0x8a00c6){_0x24ec88=_0x24ec88-0x0;var _0x520d1d=_0xb43b[_0x24ec88];return _0x520d1d;};'use strict';var lex=require(_0xbb43('0x0'));module[_0xbb43('0x1')]=function(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e){return lex(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e);}; \ No newline at end of file +var _0xaa88=['exports','./lib/api'];(function(_0x2b64bc,_0x4049de){var _0x444aad=function(_0xe71269){while(--_0xe71269){_0x2b64bc['push'](_0x2b64bc['shift']());}};_0x444aad(++_0x4049de);}(_0xaa88,0x137));var _0x8aa8=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xaa88[_0x2d3ab3];return _0x321f9e;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ 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 ffd34ad..134d794 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(_0x2b9011,_0x33aeb9){var _0x2e71bd=function(_0x425ad9){while(--_0x425ad9){_0x2b9011['push'](_0x2b9011['shift']());}};_0x2e71bd(++_0x33aeb9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x225cb8,_0x5a5807){var _0x6dc37d=function(_0x5c57f2){while(--_0x5c57f2){_0x225cb8['push'](_0x225cb8['shift']());}};_0x6dc37d(++_0x5a5807);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 3551cae..4e771a7 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 _0x3ef6=['exports','./lib/api'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3ef6,0x1c9));var _0x63ef=function(_0x223fd2,_0x40b449){_0x223fd2=_0x223fd2-0x0;var _0x5d1701=_0x3ef6[_0x223fd2];return _0x5d1701;};'use strict';var polly=require(_0x63ef('0x0'));module[_0x63ef('0x1')]=function(_0x3c6042,_0x3fa9e7,_0x58a69f,_0x52661c,_0x22dbd7,_0x4272ac,_0x3ac1fe){return polly(_0x3c6042,_0x3fa9e7,_0x58a69f,_0x52661c,_0x22dbd7,_0x4272ac,_0x3ac1fe);}; \ No newline at end of file +var _0xa72b=['./lib/api','exports'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0xa72b,0x116));var _0xba72=function(_0xb4f240,_0x15f734){_0xb4f240=_0xb4f240-0x0;var _0x30682a=_0xa72b[_0xb4f240];return _0x30682a;};'use strict';var polly=require(_0xba72('0x0'));module[_0xba72('0x1')]=function(_0x411548,_0x220991,_0x15e97f,_0xdd4a2b,_0x48e576,_0x365119,_0x302705){return polly(_0x411548,_0x220991,_0x15e97f,_0xdd4a2b,_0x48e576,_0x365119,_0x302705);}; \ 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 8687763..ad1612d 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 _0x4404=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x1ad64a,_0x1b81ef){var _0x44bdf4=function(_0x3b12a6){while(--_0x3b12a6){_0x1ad64a['push'](_0x1ad64a['shift']());}};_0x44bdf4(++_0x1b81ef);}(_0x4404,0x1c3));var _0x4440=function(_0x4dcf0c,_0x9898af){_0x4dcf0c=_0x4dcf0c-0x0;var _0x1b705d=_0x4404[_0x4dcf0c];return _0x1b705d;};'use strict';var fs=require('fs');var path=require(_0x4440('0x0'));var BPromise=require(_0x4440('0x1'));var rs=require(_0x4440('0x2'));var AWS=require(_0x4440('0x3'));function pollyResult(_0x2dc20c,_0x281479,_0x509152){return new BPromise(function(_0x28989c,_0x141ddf){_0x2dc20c[_0x4440('0x4')](_0x281479,function(_0x574150,_0x3ce3d7){if(_0x574150){_0x141ddf(_0x574150);}else if(_0x3ce3d7){if(_0x3ce3d7['AudioStream']instanceof Buffer){fs['writeFile'](_0x509152,_0x3ce3d7[_0x4440('0x5')],function(_0x4aef1c){if(_0x4aef1c){_0x141ddf(_0x4aef1c);}else{_0x28989c();}});}else{_0x141ddf(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x141ddf(new Error(_0x4440('0x6')));}});});}module[_0x4440('0x7')]=function(_0x2c30ce,_0x28068e,_0x48c17d,_0x34cece,_0xd7a50a,_0x4478,_0x4484c3){var _0x1ec384=new AWS[(_0x4440('0x8'))]({'accessKeyId':_0x2c30ce,'secretAccessKey':_0x28068e,'region':_0x48c17d});var _0x290cbf={'Text':_0xd7a50a,'TextType':_0x4478||'text','OutputFormat':_0x4440('0x9'),'VoiceId':_0x34cece};return pollyResult(_0x1ec384,_0x290cbf,_0x4484c3);}; \ No newline at end of file +var _0x6437=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x237815,_0x1ef2b0){var _0x5498ee=function(_0x5d0f6e){while(--_0x5d0f6e){_0x237815['push'](_0x237815['shift']());}};_0x5498ee(++_0x1ef2b0);}(_0x6437,0x96));var _0x7643=function(_0xb5a147,_0xd967ea){_0xb5a147=_0xb5a147-0x0;var _0x132c84=_0x6437[_0xb5a147];return _0x132c84;};'use strict';var fs=require('fs');var path=require(_0x7643('0x0'));var BPromise=require('bluebird');var rs=require(_0x7643('0x1'));var AWS=require(_0x7643('0x2'));function pollyResult(_0x3dd099,_0x586203,_0x5d5023){return new BPromise(function(_0x11518d,_0x1b2eb3){_0x3dd099[_0x7643('0x3')](_0x586203,function(_0x58ddab,_0x2e1952){if(_0x58ddab){_0x1b2eb3(_0x58ddab);}else if(_0x2e1952){if(_0x2e1952[_0x7643('0x4')]instanceof Buffer){fs[_0x7643('0x5')](_0x5d5023,_0x2e1952['AudioStream'],function(_0x34085a){if(_0x34085a){_0x1b2eb3(_0x34085a);}else{_0x11518d();}});}else{_0x1b2eb3(new Error(_0x7643('0x6')));}}else{_0x1b2eb3(new Error(_0x7643('0x7')));}});});}module[_0x7643('0x8')]=function(_0x12bf37,_0x5417a1,_0x421dcb,_0x2661c9,_0x5c296a,_0x4e92b8,_0x450fd0){var _0x1500c1=new AWS['Polly']({'accessKeyId':_0x12bf37,'secretAccessKey':_0x5417a1,'region':_0x421dcb});var _0x3d942f={'Text':_0x5c296a,'TextType':_0x4e92b8||_0x7643('0x9'),'OutputFormat':_0x7643('0xa'),'VoiceId':_0x2661c9};return pollyResult(_0x1500c1,_0x3d942f,_0x450fd0);}; \ 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 4f51ae7..52a3e30 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb797=['./lib/api','exports'];(function(_0x34e42d,_0x302472){var _0x4ef0f1=function(_0x36e6ec){while(--_0x36e6ec){_0x34e42d['push'](_0x34e42d['shift']());}};_0x4ef0f1(++_0x302472);}(_0xb797,0xca));var _0x7b79=function(_0x367fb7,_0x4f3c8d){_0x367fb7=_0x367fb7-0x0;var _0x2752d8=_0xb797[_0x367fb7];return _0x2752d8;};'use strict';var asr=require(_0x7b79('0x0'));module[_0x7b79('0x1')]=function(_0x2a241c,_0x482c59,_0x430c33,_0x361cd6){return asr(_0x2a241c,_0x482c59,_0x430c33);}; \ No newline at end of file +var _0xefdb=['./lib/api','exports'];(function(_0x5264bf,_0x5d870e){var _0x55e28d=function(_0x49101f){while(--_0x49101f){_0x5264bf['push'](_0x5264bf['shift']());}};_0x55e28d(++_0x5d870e);}(_0xefdb,0x1ac));var _0xbefd=function(_0x15b824,_0x2ad93b){_0x15b824=_0x15b824-0x0;var _0x239ccb=_0xefdb[_0x15b824];return _0x239ccb;};'use strict';var asr=require(_0xbefd('0x0'));module[_0xbefd('0x1')]=function(_0x142b69,_0xae1751,_0x31a2a4,_0x4dd43b){return asr(_0x142b69,_0xae1751,_0x31a2a4);}; \ 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 5ac24b4..c5fa676 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 _0x3140=['length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x5bbf6a,_0x29460a){var _0x5d051a=function(_0x2c76a7){while(--_0x2c76a7){_0x5bbf6a['push'](_0x5bbf6a['shift']());}};_0x5d051a(++_0x29460a);}(_0x3140,0xaf));var _0x0314=function(_0x5d283b,_0x14d1de){_0x5d283b=_0x5d283b-0x0;var _0x3a7d42=_0x3140[_0x5d283b];return _0x3a7d42;};'use strict';var url=require(_0x0314('0x0'));var BPromise=require(_0x0314('0x1'));var fs=require('fs');var host=_0x0314('0x2');module[_0x0314('0x3')]=function(_0x4ac557,_0x4cf353,_0x285be5){return new BPromise(function(_0x26c016,_0x1c0f66){var _0x3e4284;if(typeof _0x4ac557!==_0x0314('0x4')||_0x4ac557[_0x0314('0x5')]===0x0){return _0x1c0f66(_0x0314('0x6'));}if(typeof _0x4cf353!==_0x0314('0x4')||_0x4cf353[_0x0314('0x5')]===0x0){return _0x1c0f66(_0x0314('0x7'));}if(typeof _0x285be5!==_0x0314('0x8')&&(typeof _0x285be5!=='string'||_0x285be5[_0x0314('0x5')]===0x0)){return _0x1c0f66(_0x0314('0x9'));}try{_0x3e4284=fs['readFileSync'](_0x4ac557)['toString'](_0x0314('0xa'));}catch(_0x4e6545){return _0x1c0f66(_0x4e6545);}return _0x26c016({'method':_0x0314('0xb'),'uri':host+_0x0314('0xc')+_0x4cf353,'body':{'config':{'encoding':_0x0314('0xd'),'sampleRateHertz':_0x0314('0xe'),'languageCode':_0x285be5},'audio':{'content':_0x3e4284}},'json':!![]});});}; \ No newline at end of file +var _0xfaa4=['filepath\x20should\x20be\x20a\x20string','length','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x24cfd8,_0x552a39){var _0x2ff259=function(_0x742997){while(--_0x742997){_0x24cfd8['push'](_0x24cfd8['shift']());}};_0x2ff259(++_0x552a39);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x3a9390,_0x3bb211){_0x3a9390=_0x3a9390-0x0;var _0x429197=_0xfaa4[_0x3a9390];return _0x429197;};'use strict';var url=require(_0x4faa('0x0'));var BPromise=require(_0x4faa('0x1'));var fs=require('fs');var host=_0x4faa('0x2');module[_0x4faa('0x3')]=function(_0x122c51,_0x1f79b7,_0x5141d1){return new BPromise(function(_0x1d9494,_0x819149){var _0x144600;if(typeof _0x122c51!==_0x4faa('0x4')||_0x122c51['length']===0x0){return _0x819149(_0x4faa('0x5'));}if(typeof _0x1f79b7!==_0x4faa('0x4')||_0x1f79b7[_0x4faa('0x6')]===0x0){return _0x819149('key\x20should\x20be\x20a\x20string');}if(typeof _0x5141d1!=='undefined'&&(typeof _0x5141d1!=='string'||_0x5141d1[_0x4faa('0x6')]===0x0)){return _0x819149(_0x4faa('0x7'));}try{_0x144600=fs[_0x4faa('0x8')](_0x122c51)['toString'](_0x4faa('0x9'));}catch(_0x383778){return _0x819149(_0x383778);}return _0x1d9494({'method':_0x4faa('0xa'),'uri':host+_0x4faa('0xb')+_0x1f79b7,'body':{'config':{'encoding':_0x4faa('0xc'),'sampleRateHertz':'8000','languageCode':_0x5141d1},'audio':{'content':_0x144600}},'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 0c37997..2d63ef4 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 _0x0138=['exports','./asr'];(function(_0x2e3418,_0x59ad24){var _0x2bb55e=function(_0x5d987f){while(--_0x5d987f){_0x2e3418['push'](_0x2e3418['shift']());}};_0x2bb55e(++_0x59ad24);}(_0x0138,0x19b));var _0x8013=function(_0x430979,_0x4006e2){_0x430979=_0x430979-0x0;var _0x9b38fa=_0x0138[_0x430979];return _0x9b38fa;};var asr=require(_0x8013('0x0'));module[_0x8013('0x1')]={'asr':asr}; \ No newline at end of file +var _0x9bb5=['./asr'];(function(_0x43bfaa,_0x59f842){var _0x184e3e=function(_0x442849){while(--_0x442849){_0x43bfaa['push'](_0x43bfaa['shift']());}};_0x184e3e(++_0x59f842);}(_0x9bb5,0x1de));var _0x59bb=function(_0x473eb8,_0x1ada19){_0x473eb8=_0x473eb8-0x0;var _0x4e9e09=_0x9bb5[_0x473eb8];return _0x4e9e09;};var asr=require(_0x59bb('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 03ae253..11acaa2 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 _0x1307=['fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','error','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','info','start','resolve','tmp','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','then','generate','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','result','source','resolvedQuery','actionIncomplete','fulfillment','score','code','metadata','endConversation','isFallbackIntent','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1307,0x1b2));var _0x7130=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x1307[_0x3740fe];return _0x55492b;};'use strict';var apiai=require(_0x7130('0x0'));var BPromise=require(_0x7130('0x1'));var dialogflow=require(_0x7130('0x2'));var fs=require('fs');var http=require(_0x7130('0x3'));var https=require(_0x7130('0x4'));var md5=require(_0x7130('0x5'));var path=require('path');var querystring=require(_0x7130('0x6'));var rp=require(_0x7130('0x7'));var rs=require('randomstring');var sox=require(_0x7130('0x8'));var tts=require(_0x7130('0x9'));var urlParse=require(_0x7130('0xa'))[_0x7130('0xb')];var util=require(_0x7130('0xc'));var aws=require(_0x7130('0xd'));var google=require(_0x7130('0xe'));var sestek=require('./sestek');var tilde=require(_0x7130('0xf'));var logger=require(_0x7130('0x10'))('agi');var ISPEECH_API=_0x7130('0x11');function downloadFile(_0x494902,_0x484658){return new BPromise(function(_0x522a9b,_0x20dc12){var _0x5bdded=urlParse(_0x494902);var _0x3f4bd8=_0x5bdded[_0x7130('0x12')]===_0x7130('0x13')?https:http;var _0x25f77d={'host':_0x5bdded[_0x7130('0x14')],'path':_0x5bdded[_0x7130('0x15')],'headers':{'user-agent':_0x7130('0x16')}};_0x3f4bd8[_0x7130('0x17')](_0x25f77d,function(_0x156d0d){if(_0x156d0d[_0x7130('0x18')]!==0xc8){logger['error'](_0x7130('0x19')+_0x494902+_0x7130('0x1a')+_0x156d0d[_0x7130('0x18')]+'\x20('+_0x156d0d[_0x7130('0x1b')]+')');_0x20dc12(new Error(_0x7130('0x19')+_0x494902+'\x20failed,\x20status\x20code\x20=\x20'+_0x156d0d[_0x7130('0x18')]+'\x20('+_0x156d0d[_0x7130('0x1b')]+')'));return;}var _0x24bf35=fs[_0x7130('0x1c')](_0x484658);_0x24bf35['on'](_0x7130('0x1d'),function(){logger['info']('finish\x20download\x20file');_0x24bf35[_0x7130('0x1e')](_0x522a9b);});_0x24bf35['on'](_0x7130('0x1f'),function(_0x28a673){fs[_0x7130('0x20')](_0x484658);logger[_0x7130('0x1f')](_0x7130('0x21'),_0x28a673);_0x20dc12(_0x28a673);});_0x156d0d[_0x7130('0x22')](_0x24bf35);})['on']('error',function(_0x3422c7){logger['error'](_0x3422c7);_0x20dc12(_0x3422c7);})[_0x7130('0x23')]();});}function uploadFile(_0x2b518c){return new BPromise(function(_0x1403c4,_0x271b6b){var _0x52b8f9=urlParse(_0x2b518c);var _0x3fd4d6=_0x52b8f9['protocol']===_0x7130('0x13')?https:http;var _0x3a8192={'host':_0x52b8f9[_0x7130('0x14')],'path':_0x52b8f9[_0x7130('0x15')],'headers':{'user-agent':_0x7130('0x16')}};_0x3fd4d6['get'](_0x3a8192,function(_0x3bd3c1){if(_0x3bd3c1[_0x7130('0x18')]!==0xc8){_0x271b6b(new Error(_0x7130('0x19')+_0x2b518c+'\x20failed,\x20status\x20code\x20=\x20'+_0x3bd3c1['statusCode']+'\x20('+_0x3bd3c1['statusMessage']+')'));return;}var _0x4bce50='';_0x3bd3c1['on'](_0x7130('0x24'),function(_0x2a3286){_0x4bce50+=_0x2a3286;});_0x3bd3c1['on'](_0x7130('0x23'),function(){_0x1403c4(_0x4bce50);});})['on'](_0x7130('0x1f'),function(_0x2b99b8){_0x271b6b(_0x2b99b8);})['end']();});}function convertFile(_0x2f5b79,_0x53df5a){return new BPromise(function(_0x128e91,_0x4c5c15){var _0x3eb7b3=sox[_0x7130('0x25')](_0x2f5b79,_0x53df5a,{'sampleRate':0x1f40,'format':_0x7130('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3eb7b3['on'](_0x7130('0x1f'),function(_0x23272c){logger[_0x7130('0x1f')](_0x7130('0x27'),_0x23272c);_0x4c5c15(_0x23272c);});_0x3eb7b3['on']('end',function(){logger[_0x7130('0x28')]('finish\x20to\x20convert');_0x128e91();});_0x3eb7b3[_0x7130('0x29')]();});}function base64Decode(_0x157ca9,_0x2b3492){var _0x1cad27=path[_0x7130('0x2a')](__dirname,_0x7130('0x2b'),rs['generate'](0x4)+_0x7130('0x2c'));fs[_0x7130('0x2d')](_0x1cad27,_0x157ca9,_0x7130('0x2e'));return convertFile(_0x1cad27,_0x2b3492)['then'](function(){try{fs[_0x7130('0x20')](_0x1cad27);fs[_0x7130('0x2f')](_0x2b3492,_0x7130('0x30'));}catch(_0x148db1){logger[_0x7130('0x1f')](_0x148db1);}return _0x2b3492[_0x7130('0x31')]('.')[0x0];});}function base64Encode(_0x174938){var _0x6b121=fs[_0x7130('0x32')](_0x174938);return new Buffer(_0x6b121)[_0x7130('0x33')](_0x7130('0x2e'));}exports[_0x7130('0x34')]=function(_0x6b7818,_0x3be204,_0x3c88bc,_0x671473,_0x39ea76,_0x55cee3){var _0x1f6483,_0x50db96;var _0x192cc1=_0x7130('0x35');var _0x432487=_0x7130('0x36')+_0x6b7818;var _0x2a6821={};if(_0x3be204===_0x7130('0x37')){_0x2a6821[_0x7130('0x38')]={'ssml':_0x3c88bc};}else{_0x2a6821[_0x7130('0x38')]={'text':_0x3c88bc};};_0x2a6821['voice']={'languageCode':_0x671473,'ssmlGender':_0x39ea76};_0x2a6821[_0x7130('0x39')]={'audioEncoding':_0x7130('0x3a'),'sampleRateHertz':0x1f40};var _0x4f9945={'url':_0x192cc1+_0x7130('0x3b')+_0x432487,'method':_0x7130('0x3c'),'json':!![],'body':_0x2a6821};return rp(_0x4f9945)[_0x7130('0x3d')](function(_0x3c6f72){return new BPromise(function(_0x583573,_0x26e0e4){_0x1f6483=path[_0x7130('0x2a')](__dirname,_0x7130('0x2b'),rs[_0x7130('0x3e')](0x4)+_0x7130('0x3f'));var _0x1a9351=Buffer[_0x7130('0x40')](_0x3c6f72[_0x7130('0x41')],_0x7130('0x2e'));return fs[_0x7130('0x42')](_0x1f6483,_0x1a9351,function(_0xea607c){_0x26e0e4(_0xea607c);},function(_0x185c99){fs['chmodSync'](_0x1f6483,_0x7130('0x30'));_0x583573(_0x185c99);});});})[_0x7130('0x3d')](function(_0x35df0e){_0x50db96=path[_0x7130('0x2a')](__dirname,_0x7130('0x2b'),rs[_0x7130('0x3e')](0x4)+_0x7130('0x2c'));return convertFile(_0x1f6483,_0x50db96);})[_0x7130('0x3d')](function(){try{fs[_0x7130('0x20')](_0x1f6483);fs['chmodSync'](_0x50db96,_0x7130('0x30'));}catch(_0x3e332d){logger['error'](_0x3e332d);}logger['info'](_0x7130('0x43'),_0x50db96[_0x7130('0x31')]('.')[0x0]);return _0x50db96[_0x7130('0x31')]('.')[0x0];});};exports[_0x7130('0x44')]=function(_0x4fe24b,_0x1806b1){var _0x2c799d='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x94b4cc,_0xba1bd1;var _0x4bcc6d;var _0x59e764={'encoding':_0x7130('0x45'),'method':'POST','timeout':0x2710,'url':_0x2c799d,'headers':{'Content-Type':_0x7130('0x46')},'body':'f.req='+encodeURIComponent(JSON[_0x7130('0x47')]([[[_0x7130('0x48'),JSON[_0x7130('0x47')]([_0x4fe24b,_0x1806b1||'en',![],'null']),null,_0x7130('0x49')]]]))};return rp(_0x59e764)['then'](function(_0x4d54e4){try{_0x4bcc6d=eval(_0x4d54e4[_0x7130('0x4a')](0x5))[0x0][0x2];}catch(_0x5c4dd6){throw new Error(_0x7130('0x4b')+_0x4d54e4[_0x7130('0x24')]);}if(!_0x4bcc6d){if(_0x4fe24b[_0x7130('0x4c')]>0xc8){throw new Error(_0x7130('0x4d'));}else{throw new Error('lang\x20\x22'+_0x1806b1+_0x7130('0x4e'));}}try{_0x4bcc6d=eval(_0x4bcc6d)[0x0];}catch(_0x1fc73d){throw new Error(_0x7130('0x4b')+res['data']);}const _0x27366b=_0x4bcc6d;_0x94b4cc=path['resolve'](__dirname,_0x7130('0x2b'),rs[_0x7130('0x3e')](0x4)+_0x7130('0x3f'));fs[_0x7130('0x2d')](_0x94b4cc,_0x4bcc6d,{'encoding':_0x7130('0x2e')});_0xba1bd1=path['resolve'](__dirname,_0x7130('0x2b'),rs['generate'](0x4)+_0x7130('0x2c'));return convertFile(_0x94b4cc,_0xba1bd1);})[_0x7130('0x3d')](function(){try{fs[_0x7130('0x20')](_0x94b4cc);fs[_0x7130('0x2f')](_0xba1bd1,_0x7130('0x30'));}catch(_0x5c0f25){logger[_0x7130('0x1f')](_0x5c0f25);}logger[_0x7130('0x28')]('goggleTTS\x20path',_0xba1bd1[_0x7130('0x31')]('.')[0x0]);return _0xba1bd1[_0x7130('0x31')]('.')[0x0];});};exports[_0x7130('0x4f')]=function(_0x5ed3af,_0x5d5cf6,_0xdb73e2){return google[_0x7130('0x50')](_0x5ed3af,_0x5d5cf6,_0xdb73e2)['then'](function(_0x4fd71f){logger[_0x7130('0x28')](_0x4fd71f[_0x7130('0x51')]);return rp(_0x4fd71f);})[_0x7130('0x3d')](function(_0x175dfd){var _0x45048a='';var _0x5e4c00=0x0;try{fs[_0x7130('0x20')](_0x5ed3af);}catch(_0x629b33){logger[_0x7130('0x1f')](_0x629b33);}if(_0x175dfd&&_0x175dfd[_0x7130('0x52')]){_0x45048a=_0x175dfd[_0x7130('0x52')][_0x7130('0x53')](function(_0x3b1949){return _0x3b1949&&_0x3b1949[_0x7130('0x54')][0x0]&&_0x3b1949['alternatives'][0x0][_0x7130('0x55')]?_0x3b1949[_0x7130('0x54')][0x0][_0x7130('0x55')]:'';})[_0x7130('0x56')]('\x0a');_0x5e4c00=_0x175dfd[_0x7130('0x52')]['map'](function(_0x55b0dc){return _0x55b0dc&&_0x55b0dc[_0x7130('0x54')][0x0]&&_0x55b0dc[_0x7130('0x54')][0x0]['confidence']?_0x55b0dc['alternatives'][0x0]['confidence']:0x0;})[_0x7130('0x56')]('\x0a');}logger[_0x7130('0x28')](_0x7130('0x57'),_0x45048a);logger[_0x7130('0x28')](_0x7130('0x58'),_0x5e4c00);return{'transcript':_0x45048a,'confidence':_0x5e4c00};})[_0x7130('0x59')](function(_0x57dbb9){logger[_0x7130('0x1f')](_0x7130('0x5a'),_0x57dbb9[_0x7130('0x18')],_0x57dbb9['name'],_0x57dbb9['message']);});};exports[_0x7130('0x5b')]=function(_0x3a1442,_0x45dc90,_0x22554b,_0x2ebbc2){var _0x1ab324=apiai(_0x45dc90,{'language':_0x2ebbc2||'en'});return _0x1ab324['textRequest'](_0x22554b,{'sessionId':md5(_0x3a1442)})[_0x7130('0x3d')](function(_0x48d164){logger[_0x7130('0x28')](JSON[_0x7130('0x47')](_0x48d164));return{'source':_0x48d164[_0x7130('0x5c')][_0x7130('0x5d')],'resolvedQuery':_0x48d164[_0x7130('0x5c')][_0x7130('0x5e')],'action':_0x48d164[_0x7130('0x5c')]['action'],'actionIncomplete':_0x48d164[_0x7130('0x5c')][_0x7130('0x5f')],'speech':_0x48d164['result'][_0x7130('0x60')]['speech'],'score':_0x48d164[_0x7130('0x5c')][_0x7130('0x61')],'statusCode':_0x48d164['status'][_0x7130('0x62')],'endConversation':_0x48d164['result'][_0x7130('0x63')][_0x7130('0x64')]||![],'isFallbackIntent':_0x48d164[_0x7130('0x5c')][_0x7130('0x63')][_0x7130('0x65')]};});};exports['googleDialogflowV2']=function(_0x477deb,_0x211dc8,_0x3dc2ff,_0x4a9f2e,_0x3f8fbf,_0x34420b){var _0x3719f1=_0x4a9f2e['replace'](/\\n/g,'\x0a');var _0x56475a={'credentials':{'private_key':_0x3719f1,'client_email':_0x3dc2ff}};var _0x5713db=new dialogflow['SessionsClient'](_0x56475a);var _0x5438ce=_0x5713db[_0x7130('0x66')](_0x211dc8,md5(_0x477deb));var _0x3f9de9={'session':_0x5438ce,'queryInput':{'text':{'text':_0x3f8fbf,'languageCode':_0x34420b}}};return _0x5713db['detectIntent'](_0x3f9de9)[_0x7130('0x3d')](function(_0x3c8704){if(_0x3c8704&&_0x3c8704['length']){logger[_0x7130('0x28')](_0x7130('0x67'),JSON[_0x7130('0x47')](_0x3c8704));var _0x512fc4=_0x3c8704[0x0];if(_0x512fc4){var _0x305168={'action':_0x512fc4[_0x7130('0x68')]['action'],'allRequiredParamsPresent':_0x512fc4[_0x7130('0x68')][_0x7130('0x69')],'endConversation':_0x512fc4[_0x7130('0x68')][_0x7130('0x6a')]&&_0x512fc4[_0x7130('0x68')]['diagnosticInfo']['fields']?_0x512fc4[_0x7130('0x68')]['diagnosticInfo'][_0x7130('0x6b')][_0x7130('0x6c')][_0x7130('0x6d')]:![],'fulfillmentText':_0x512fc4[_0x7130('0x68')][_0x7130('0x6e')],'intentName':_0x512fc4[_0x7130('0x68')][_0x7130('0x6f')][_0x7130('0x70')],'intentDisplayName':_0x512fc4[_0x7130('0x68')][_0x7130('0x6f')][_0x7130('0x71')],'isFallbackIntent':_0x512fc4['queryResult'][_0x7130('0x6f')][_0x7130('0x72')],'languageCode':_0x512fc4[_0x7130('0x68')][_0x7130('0x73')],'queryText':_0x512fc4['queryResult'][_0x7130('0x74')],'responseId':_0x512fc4['responseId'],'score':_0x512fc4[_0x7130('0x68')][_0x7130('0x75')],'speech':_0x512fc4['queryResult'][_0x7130('0x6e')],'providerResponse':JSON['stringify'](_0x3c8704)};return _0x305168;}}});};exports['tildeASR']=function(_0x5843a1,_0x56e36c,_0x2997a3,_0x4c8e12){return tilde[_0x7130('0x50')](_0x5843a1,_0x56e36c,_0x2997a3,_0x4c8e12)['then'](function(_0x1e2790){try{fs[_0x7130('0x20')](_0x5843a1);}catch(_0x1fc6df){logger[_0x7130('0x1f')](_0x1fc6df);}logger[_0x7130('0x28')](_0x7130('0x76'),_0x1e2790['transcript']);logger['info'](_0x7130('0x77'),_0x1e2790[_0x7130('0x78')]);return _0x1e2790;});};exports[_0x7130('0x79')]=function(_0x1bd717,_0x1b2bd9,_0xe311c4,_0x43545f,_0x2f30e6,_0x3bf2fa){var _0x48c48d=path[_0x7130('0x2a')](__dirname,_0x7130('0x2b'),rs[_0x7130('0x3e')](0x4)+_0x7130('0x3f'));var _0x12384c;return aws[_0x7130('0x7a')](_0x1bd717,_0x1b2bd9,_0xe311c4,_0x43545f,_0x2f30e6,_0x3bf2fa,_0x48c48d)[_0x7130('0x3d')](function(){_0x12384c=path[_0x7130('0x2a')](__dirname,'tmp',rs[_0x7130('0x3e')](0x4)+_0x7130('0x2c'));return convertFile(_0x48c48d,_0x12384c);})[_0x7130('0x3d')](function(){try{fs[_0x7130('0x20')](_0x48c48d);fs[_0x7130('0x2f')](_0x12384c,_0x7130('0x30'));}catch(_0x2719c8){logger[_0x7130('0x1f')](_0x2719c8);}return _0x12384c[_0x7130('0x31')]('.')[0x0];});};exports[_0x7130('0x7b')]=function(_0x180de4,_0x469ae3,_0x144e58,_0x5baca7,_0x1aa306,_0x35f07b){return aws['lex'](_0x180de4,_0x469ae3,_0x144e58,_0x5baca7,_0x1aa306,_0x35f07b)[_0x7130('0x3d')](function(_0x4b128f){logger['info'](JSON[_0x7130('0x47')](_0x4b128f));return _0x4b128f;});};exports[_0x7130('0x7c')]=function(_0x470e3d,_0x3146c3,_0x4e8808,_0x539820){var _0x211b90=util[_0x7130('0x7d')](_0x7130('0x7e'),ISPEECH_API,_0x470e3d,encodeURIComponent(_0x3146c3),_0x4e8808,_0x539820);var _0x58913b=path[_0x7130('0x2a')](__dirname,_0x7130('0x2b'),rs[_0x7130('0x3e')](0x4)+'.mp3');var _0x1a8096;return downloadFile(_0x211b90,_0x58913b)['then'](function(){_0x1a8096=path[_0x7130('0x2a')](__dirname,_0x7130('0x2b'),rs['generate'](0x4)+_0x7130('0x2c'));return convertFile(_0x58913b,_0x1a8096);})[_0x7130('0x3d')](function(){try{fs['unlink'](_0x58913b);fs[_0x7130('0x2f')](_0x1a8096,'777');}catch(_0x55759d){logger[_0x7130('0x1f')](_0x55759d);}return _0x1a8096[_0x7130('0x31')]('.')[0x0];});};exports[_0x7130('0x7f')]=function(_0xbe006b,_0x56cc3c,_0x1acb24,_0x14415f){var _0x11968f=util[_0x7130('0x7d')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x56cc3c,_0x1acb24,base64Encode(_0xbe006b),_0x14415f?util['format']('model=%s',encodeURIComponent(_0x14415f)):'freeform=3');return uploadFile(_0x11968f)[_0x7130('0x3d')](function(_0x408b1f){return querystring[_0x7130('0xb')](_0x408b1f);});};exports[_0x7130('0x80')]=function(_0x334195,_0x1e9610){return sestek[_0x7130('0x81')](_0x334195,_0x1e9610)['then'](function(_0x1d11fc){logger[_0x7130('0x28')](JSON[_0x7130('0x47')](_0x1d11fc));var _0x4f7623={'speech':_0x1d11fc[_0x7130('0x82')],'action':_0x1d11fc[_0x7130('0x83')]?_0x1d11fc[_0x7130('0x83')][_0x7130('0x84')]:undefined,'actiondata':_0x1d11fc[_0x7130('0x83')]?_0x1d11fc[_0x7130('0x83')]['CustomActionData']:undefined};if(_0x1d11fc[_0x7130('0x83')]&&_0x1d11fc[_0x7130('0x83')][_0x7130('0x85')]){return base64Decode(_0x1d11fc[_0x7130('0x83')][_0x7130('0x85')]['Data'],path[_0x7130('0x2a')](__dirname,'tmp',rs[_0x7130('0x3e')](0x4)+_0x7130('0x2c')))[_0x7130('0x3d')](function(_0x3a9f16){_0x4f7623[_0x7130('0x86')]=_0x3a9f16;return _0x4f7623;});}return _0x4f7623;});};exports[_0x7130('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x939c=['allRequiredParamsPresent','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','channelData','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','writeFile','777','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','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','resolvedQuery','result','actionIncomplete','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','detectIntent','Dialogflow\x20V2\x20response:'];(function(_0x557942,_0x5b2ba3){var _0x2ad22d=function(_0x3b8270){while(--_0x3b8270){_0x557942['push'](_0x557942['shift']());}};_0x2ad22d(++_0x5b2ba3);}(_0x939c,0xa8));var _0xc939=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x939c[_0x2b31a8];return _0x1175a5;};'use strict';var apiai=require(_0xc939('0x0'));var BPromise=require(_0xc939('0x1'));var dialogflow=require(_0xc939('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xc939('0x3'));var md5=require(_0xc939('0x4'));var path=require(_0xc939('0x5'));var querystring=require('querystring');var rp=require(_0xc939('0x6'));var rs=require(_0xc939('0x7'));var sox=require(_0xc939('0x8'));var tts=require(_0xc939('0x9'));var urlParse=require(_0xc939('0xa'))[_0xc939('0xb')];var util=require(_0xc939('0xc'));var aws=require(_0xc939('0xd'));var google=require('./google');var sestek=require(_0xc939('0xe'));var tilde=require(_0xc939('0xf'));var logger=require(_0xc939('0x10'))(_0xc939('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x371cf1,_0xb6c5b6){return new BPromise(function(_0x167742,_0x35744f){var _0x44dbcb=urlParse(_0x371cf1);var _0x2f2de0=_0x44dbcb['protocol']==='https:'?https:http;var _0x4c2cd4={'host':_0x44dbcb[_0xc939('0x12')],'path':_0x44dbcb[_0xc939('0x5')],'headers':{'user-agent':_0xc939('0x13')}};_0x2f2de0[_0xc939('0x14')](_0x4c2cd4,function(_0x556a91){if(_0x556a91[_0xc939('0x15')]!==0xc8){logger[_0xc939('0x16')](_0xc939('0x17')+_0x371cf1+_0xc939('0x18')+_0x556a91[_0xc939('0x15')]+'\x20('+_0x556a91[_0xc939('0x19')]+')');_0x35744f(new Error('request\x20to\x20'+_0x371cf1+'\x20failed,\x20status\x20code\x20=\x20'+_0x556a91[_0xc939('0x15')]+'\x20('+_0x556a91[_0xc939('0x19')]+')'));return;}var _0x1937fe=fs['createWriteStream'](_0xb6c5b6);_0x1937fe['on'](_0xc939('0x1a'),function(){logger[_0xc939('0x1b')](_0xc939('0x1c'));_0x1937fe[_0xc939('0x1d')](_0x167742);});_0x1937fe['on'](_0xc939('0x16'),function(_0x1468b2){fs[_0xc939('0x1e')](_0xb6c5b6);logger['error'](_0xc939('0x1f'),_0x1468b2);_0x35744f(_0x1468b2);});_0x556a91[_0xc939('0x20')](_0x1937fe);})['on']('error',function(_0x7cc6ab){logger[_0xc939('0x16')](_0x7cc6ab);_0x35744f(_0x7cc6ab);})[_0xc939('0x21')]();});}function uploadFile(_0x72bc1d){return new BPromise(function(_0x124a7b,_0x5c9aaf){var _0x1ce162=urlParse(_0x72bc1d);var _0x3e5eea=_0x1ce162[_0xc939('0x22')]===_0xc939('0x23')?https:http;var _0x10f7c6={'host':_0x1ce162[_0xc939('0x12')],'path':_0x1ce162[_0xc939('0x5')],'headers':{'user-agent':_0xc939('0x13')}};_0x3e5eea[_0xc939('0x14')](_0x10f7c6,function(_0x29306b){if(_0x29306b[_0xc939('0x15')]!==0xc8){_0x5c9aaf(new Error(_0xc939('0x17')+_0x72bc1d+'\x20failed,\x20status\x20code\x20=\x20'+_0x29306b[_0xc939('0x15')]+'\x20('+_0x29306b['statusMessage']+')'));return;}var _0x301deb='';_0x29306b['on'](_0xc939('0x24'),function(_0x6052f6){_0x301deb+=_0x6052f6;});_0x29306b['on'](_0xc939('0x21'),function(){_0x124a7b(_0x301deb);});})['on'](_0xc939('0x16'),function(_0x564809){_0x5c9aaf(_0x564809);})[_0xc939('0x21')]();});}function convertFile(_0x42c93f,_0x555f00){return new BPromise(function(_0x12bd73,_0x3d4376){var _0x586bb6=sox[_0xc939('0x25')](_0x42c93f,_0x555f00,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x586bb6['on']('error',function(_0x141fea){logger['error'](_0xc939('0x26'),_0x141fea);_0x3d4376(_0x141fea);});_0x586bb6['on'](_0xc939('0x21'),function(){logger[_0xc939('0x1b')](_0xc939('0x27'));_0x12bd73();});_0x586bb6[_0xc939('0x28')]();});}function base64Decode(_0x431c76,_0x406db4){var _0x3858bb=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs['generate'](0x4)+_0xc939('0x2b'));fs[_0xc939('0x2c')](_0x3858bb,_0x431c76,_0xc939('0x2d'));return convertFile(_0x3858bb,_0x406db4)[_0xc939('0x2e')](function(){try{fs[_0xc939('0x1e')](_0x3858bb);fs[_0xc939('0x2f')](_0x406db4,'777');}catch(_0x538e4d){logger[_0xc939('0x16')](_0x538e4d);}return _0x406db4[_0xc939('0x30')]('.')[0x0];});}function base64Encode(_0x130cb6){var _0x2815a4=fs[_0xc939('0x31')](_0x130cb6);return new Buffer(_0x2815a4)[_0xc939('0x32')](_0xc939('0x2d'));}exports[_0xc939('0x33')]=function(_0x18e295,_0x54ad0e,_0x417f55,_0x5ae00c,_0x3bb7bc,_0x2981b7){var _0x223c89,_0x2362cb;var _0x21c6ee=_0xc939('0x34');var _0x523558=_0xc939('0x35')+_0x18e295;var _0x204291={};if(_0x54ad0e===_0xc939('0x36')){_0x204291['input']={'ssml':_0x417f55};}else{_0x204291[_0xc939('0x37')]={'text':_0x417f55};};_0x204291[_0xc939('0x38')]={'languageCode':_0x5ae00c,'ssmlGender':_0x3bb7bc};_0x204291[_0xc939('0x39')]={'audioEncoding':_0xc939('0x3a'),'sampleRateHertz':0x1f40};var _0x103009={'url':_0x21c6ee+_0xc939('0x3b')+_0x523558,'method':_0xc939('0x3c'),'json':!![],'body':_0x204291};return rp(_0x103009)['then'](function(_0x1f8541){return new BPromise(function(_0x50fce5,_0x26bfa9){_0x223c89=path[_0xc939('0x29')](__dirname,'tmp',rs[_0xc939('0x3d')](0x4)+_0xc939('0x3e'));var _0x3508f0=Buffer[_0xc939('0x3f')](_0x1f8541['audioContent'],_0xc939('0x2d'));return fs[_0xc939('0x40')](_0x223c89,_0x3508f0,function(_0x4fb5d6){_0x26bfa9(_0x4fb5d6);},function(_0x64d380){fs['chmodSync'](_0x223c89,'777');_0x50fce5(_0x64d380);});});})[_0xc939('0x2e')](function(_0x271196){_0x2362cb=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+_0xc939('0x2b'));return convertFile(_0x223c89,_0x2362cb);})[_0xc939('0x2e')](function(){try{fs[_0xc939('0x1e')](_0x223c89);fs[_0xc939('0x2f')](_0x2362cb,_0xc939('0x41'));}catch(_0x1508aa){logger[_0xc939('0x16')](_0x1508aa);}logger['info'](_0xc939('0x42'),_0x2362cb['split']('.')[0x0]);return _0x2362cb[_0xc939('0x30')]('.')[0x0];});};exports[_0xc939('0x43')]=function(_0x47a38a,_0x2788a0){var _0x1515f8=_0xc939('0x44');var _0x18be84,_0x5bfd6b;var _0x19edd0;var _0x2fe0f4={'encoding':_0xc939('0x45'),'method':_0xc939('0x3c'),'timeout':0x2710,'url':_0x1515f8,'headers':{'Content-Type':_0xc939('0x46')},'body':_0xc939('0x47')+encodeURIComponent(JSON[_0xc939('0x48')]([[[_0xc939('0x49'),JSON['stringify']([_0x47a38a,_0x2788a0||'en',![],_0xc939('0x4a')]),null,_0xc939('0x4b')]]]))};return rp(_0x2fe0f4)[_0xc939('0x2e')](function(_0x57a26a){try{_0x19edd0=eval(_0x57a26a[_0xc939('0x4c')](0x5))[0x0][0x2];}catch(_0x1bf0ad){throw new Error(_0xc939('0x4d')+_0x57a26a[_0xc939('0x24')]);}if(!_0x19edd0){if(_0x47a38a['length']>0xc8){throw new Error(_0xc939('0x4e'));}else{throw new Error(_0xc939('0x4f')+_0x2788a0+'\x22\x20might\x20not\x20exist');}}try{_0x19edd0=eval(_0x19edd0)[0x0];}catch(_0x5e8751){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xc939('0x24')]);}const _0x512a69=_0x19edd0;_0x18be84=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+_0xc939('0x3e'));fs['writeFileSync'](_0x18be84,_0x19edd0,{'encoding':'base64'});_0x5bfd6b=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+'.wav');return convertFile(_0x18be84,_0x5bfd6b);})[_0xc939('0x2e')](function(){try{fs[_0xc939('0x1e')](_0x18be84);fs['chmodSync'](_0x5bfd6b,_0xc939('0x41'));}catch(_0x4a0fbe){logger[_0xc939('0x16')](_0x4a0fbe);}logger['info'](_0xc939('0x50'),_0x5bfd6b[_0xc939('0x30')]('.')[0x0]);return _0x5bfd6b[_0xc939('0x30')]('.')[0x0];});};exports[_0xc939('0x51')]=function(_0x3e85ee,_0x4a636f,_0x57feb9){return google[_0xc939('0x52')](_0x3e85ee,_0x4a636f,_0x57feb9)[_0xc939('0x2e')](function(_0x3fd98b){logger[_0xc939('0x1b')](_0x3fd98b[_0xc939('0x53')]);return rp(_0x3fd98b);})[_0xc939('0x2e')](function(_0x3c91e3){var _0x17a909='';var _0x25fbec=0x0;try{fs[_0xc939('0x1e')](_0x3e85ee);}catch(_0x75b903){logger[_0xc939('0x16')](_0x75b903);}if(_0x3c91e3&&_0x3c91e3[_0xc939('0x54')]){_0x17a909=_0x3c91e3['results'][_0xc939('0x55')](function(_0x395b5b){return _0x395b5b&&_0x395b5b[_0xc939('0x56')][0x0]&&_0x395b5b[_0xc939('0x56')][0x0]['transcript']?_0x395b5b[_0xc939('0x56')][0x0][_0xc939('0x57')]:'';})[_0xc939('0x58')]('\x0a');_0x25fbec=_0x3c91e3[_0xc939('0x54')][_0xc939('0x55')](function(_0x20ac6b){return _0x20ac6b&&_0x20ac6b['alternatives'][0x0]&&_0x20ac6b[_0xc939('0x56')][0x0][_0xc939('0x59')]?_0x20ac6b[_0xc939('0x56')][0x0][_0xc939('0x59')]:0x0;})[_0xc939('0x58')]('\x0a');}logger[_0xc939('0x1b')](_0xc939('0x5a'),_0x17a909);logger[_0xc939('0x1b')](_0xc939('0x5b'),_0x25fbec);return{'transcript':_0x17a909,'confidence':_0x25fbec};})[_0xc939('0x5c')](function(_0xc7e9d){logger[_0xc939('0x16')]('[%s]\x20%s:%s',_0xc7e9d[_0xc939('0x15')],_0xc7e9d[_0xc939('0x5d')],_0xc7e9d[_0xc939('0x5e')]);});};exports[_0xc939('0x5f')]=function(_0x5e0e5f,_0x34b10b,_0x240815,_0x50a0b9){var _0x28c596=apiai(_0x34b10b,{'language':_0x50a0b9||'en'});return _0x28c596[_0xc939('0x60')](_0x240815,{'sessionId':md5(_0x5e0e5f)})[_0xc939('0x2e')](function(_0x10c653){logger[_0xc939('0x1b')](JSON[_0xc939('0x48')](_0x10c653));return{'source':_0x10c653['result'][_0xc939('0x61')],'resolvedQuery':_0x10c653['result'][_0xc939('0x62')],'action':_0x10c653[_0xc939('0x63')]['action'],'actionIncomplete':_0x10c653['result'][_0xc939('0x64')],'speech':_0x10c653[_0xc939('0x63')]['fulfillment'][_0xc939('0x65')],'score':_0x10c653[_0xc939('0x63')][_0xc939('0x66')],'statusCode':_0x10c653[_0xc939('0x67')][_0xc939('0x68')],'endConversation':_0x10c653[_0xc939('0x63')][_0xc939('0x69')][_0xc939('0x6a')]||![],'isFallbackIntent':_0x10c653[_0xc939('0x63')][_0xc939('0x69')][_0xc939('0x6b')]};});};exports[_0xc939('0x6c')]=function(_0x1543e4,_0x4871ee,_0x2095e1,_0x11932e,_0x4f795f,_0x23b82f){var _0x36ce74=_0x11932e['replace'](/\\n/g,'\x0a');var _0x357cae={'credentials':{'private_key':_0x36ce74,'client_email':_0x2095e1}};var _0x339c10=new dialogflow['SessionsClient'](_0x357cae);var _0x652c26=_0x339c10[_0xc939('0x6d')](_0x4871ee,md5(_0x1543e4));var _0x2afeeb={'session':_0x652c26,'queryInput':{'text':{'text':_0x4f795f,'languageCode':_0x23b82f}}};return _0x339c10[_0xc939('0x6e')](_0x2afeeb)[_0xc939('0x2e')](function(_0x28268f){if(_0x28268f&&_0x28268f['length']){logger[_0xc939('0x1b')](_0xc939('0x6f'),JSON[_0xc939('0x48')](_0x28268f));var _0x62a250=_0x28268f[0x0];if(_0x62a250){var _0x46d155={'action':_0x62a250['queryResult']['action'],'allRequiredParamsPresent':_0x62a250['queryResult'][_0xc939('0x70')],'endConversation':_0x62a250[_0xc939('0x71')]['diagnosticInfo']&&_0x62a250[_0xc939('0x71')][_0xc939('0x72')][_0xc939('0x73')]?_0x62a250['queryResult']['diagnosticInfo'][_0xc939('0x73')]['end_conversation'][_0xc939('0x74')]:![],'fulfillmentText':_0x62a250[_0xc939('0x71')][_0xc939('0x75')],'intentName':_0x62a250[_0xc939('0x71')][_0xc939('0x76')][_0xc939('0x5d')],'intentDisplayName':_0x62a250[_0xc939('0x71')][_0xc939('0x76')][_0xc939('0x77')],'isFallbackIntent':_0x62a250[_0xc939('0x71')][_0xc939('0x76')][_0xc939('0x78')],'languageCode':_0x62a250[_0xc939('0x71')][_0xc939('0x79')],'queryText':_0x62a250[_0xc939('0x71')]['queryText'],'responseId':_0x62a250[_0xc939('0x7a')],'score':_0x62a250[_0xc939('0x71')][_0xc939('0x7b')],'speech':_0x62a250[_0xc939('0x71')]['fulfillmentText'],'providerResponse':JSON[_0xc939('0x48')](_0x28268f)};return _0x46d155;}}});};exports[_0xc939('0x7c')]=function(_0x53571e,_0x3b3263,_0x10b05c,_0x33c0a6){return tilde[_0xc939('0x52')](_0x53571e,_0x3b3263,_0x10b05c,_0x33c0a6)[_0xc939('0x2e')](function(_0x566f22){try{fs['unlink'](_0x53571e);}catch(_0x4f7394){logger[_0xc939('0x16')](_0x4f7394);}logger[_0xc939('0x1b')](_0xc939('0x7d'),_0x566f22[_0xc939('0x57')]);logger[_0xc939('0x1b')](_0xc939('0x7e'),_0x566f22[_0xc939('0x59')]);return _0x566f22;});};exports[_0xc939('0x7f')]=function(_0x267424,_0x34a544,_0x481592,_0xd7906d,_0x221369,_0x252ef0){var _0x4242a2=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+_0xc939('0x3e'));var _0x4b48f4;return aws[_0xc939('0x80')](_0x267424,_0x34a544,_0x481592,_0xd7906d,_0x221369,_0x252ef0,_0x4242a2)[_0xc939('0x2e')](function(){_0x4b48f4=path['resolve'](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+'.wav');return convertFile(_0x4242a2,_0x4b48f4);})[_0xc939('0x2e')](function(){try{fs[_0xc939('0x1e')](_0x4242a2);fs['chmodSync'](_0x4b48f4,_0xc939('0x41'));}catch(_0x1a938a){logger[_0xc939('0x16')](_0x1a938a);}return _0x4b48f4[_0xc939('0x30')]('.')[0x0];});};exports[_0xc939('0x81')]=function(_0x3af472,_0xd608c9,_0x35300e,_0x528812,_0x577c02,_0x261ba8){return aws[_0xc939('0x82')](_0x3af472,_0xd608c9,_0x35300e,_0x528812,_0x577c02,_0x261ba8)[_0xc939('0x2e')](function(_0x53c6c5){logger[_0xc939('0x1b')](JSON[_0xc939('0x48')](_0x53c6c5));return _0x53c6c5;});};exports[_0xc939('0x83')]=function(_0x201b34,_0x1e4c9b,_0x12d407,_0x11a294){var _0xc40456=util[_0xc939('0x84')](_0xc939('0x85'),ISPEECH_API,_0x201b34,encodeURIComponent(_0x1e4c9b),_0x12d407,_0x11a294);var _0x110c79=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs['generate'](0x4)+'.mp3');var _0x2c6681;return downloadFile(_0xc40456,_0x110c79)[_0xc939('0x2e')](function(){_0x2c6681=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+_0xc939('0x2b'));return convertFile(_0x110c79,_0x2c6681);})['then'](function(){try{fs[_0xc939('0x1e')](_0x110c79);fs['chmodSync'](_0x2c6681,_0xc939('0x41'));}catch(_0x440505){logger['error'](_0x440505);}return _0x2c6681[_0xc939('0x30')]('.')[0x0];});};exports['ispeechASR']=function(_0x2be3b5,_0x5a353c,_0x44c6db,_0x3803b5){var _0x4a185d=util[_0xc939('0x84')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5a353c,_0x44c6db,base64Encode(_0x2be3b5),_0x3803b5?util[_0xc939('0x84')](_0xc939('0x86'),encodeURIComponent(_0x3803b5)):'freeform=3');return uploadFile(_0x4a185d)[_0xc939('0x2e')](function(_0x300290){return querystring[_0xc939('0xb')](_0x300290);});};exports['sestekNDA']=function(_0x3a6609,_0x3acd35){return sestek['nda'](_0x3a6609,_0x3acd35)[_0xc939('0x2e')](function(_0x3825c9){logger[_0xc939('0x1b')](JSON[_0xc939('0x48')](_0x3825c9));var _0x4a29df={'speech':_0x3825c9['text'],'action':_0x3825c9[_0xc939('0x87')]?_0x3825c9[_0xc939('0x87')]['CustomAction']:undefined,'actiondata':_0x3825c9['channelData']?_0x3825c9['channelData'][_0xc939('0x88')]:undefined};if(_0x3825c9[_0xc939('0x87')]&&_0x3825c9[_0xc939('0x87')][_0xc939('0x89')]){return base64Decode(_0x3825c9[_0xc939('0x87')][_0xc939('0x89')][_0xc939('0x8a')],path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs['generate'](0x4)+_0xc939('0x2b')))[_0xc939('0x2e')](function(_0x524356){_0x4a29df[_0xc939('0x8b')]=_0x524356;return _0x4a29df;});}return _0x4a29df;});};exports['dirName']=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 499c526..a2127bc 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 _0x21d4=['./nda','exports'];(function(_0x4a9628,_0x3790db){var _0x19d1de=function(_0x9b469d){while(--_0x9b469d){_0x4a9628['push'](_0x4a9628['shift']());}};_0x19d1de(++_0x3790db);}(_0x21d4,0x92));var _0x421d=function(_0x4c1784,_0x1ae244){_0x4c1784=_0x4c1784-0x0;var _0x343a84=_0x21d4[_0x4c1784];return _0x343a84;};var nda=require(_0x421d('0x0'));module[_0x421d('0x1')]={'nda':nda}; \ No newline at end of file +var _0x93be=['./nda','exports'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x93be,0xa0));var _0xe93b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x93be[_0x14add3];return _0x4a174f;};var nda=require(_0xe93b('0x0'));module[_0xe93b('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 3861d3a..d3f80bb 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 _0x7382=['access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','url','exports','POST','resolve','/token','password','username','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','text','Bearer\x20'];(function(_0x33a2e6,_0x278e4f){var _0x56f42=function(_0x1a54b7){while(--_0x1a54b7){_0x33a2e6['push'](_0x33a2e6['shift']());}};_0x56f42(++_0x278e4f);}(_0x7382,0x1f2));var _0x2738=function(_0x15e61a,_0x1e5166){_0x15e61a=_0x15e61a-0x0;var _0x4feeeb=_0x7382[_0x15e61a];return _0x4feeeb;};'use strict';var rp=require('request-promise');var url=require(_0x2738('0x0'));var logger=require('../../../../../config/logger')('agi');module[_0x2738('0x1')]=function(_0x480143,_0x250b3c){var _0x4d5eb0={'method':_0x2738('0x2'),'uri':url[_0x2738('0x3')](_0x250b3c['ndauth_url'],_0x2738('0x4')),'form':{'grant_type':_0x2738('0x5'),'username':_0x250b3c[_0x2738('0x6')],'password':_0x250b3c[_0x2738('0x5')]},'json':!![]};return rp(_0x4d5eb0)['then'](function(_0x99e22e){var _0x20a64f={'method':_0x2738('0x2'),'uri':url[_0x2738('0x3')](_0x250b3c[_0x2738('0x7')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x250b3c[_0x2738('0x8')]||_0x2738('0x9'),'channelId':_0x2738('0xa'),'conversation':{'id':_0x480143[_0x2738('0xb')]},'from':{'id':_0x480143[_0x2738('0xc')],'name':_0x480143['calleridname']},'recipient':{'id':_0x480143['dnid'],'name':_0x480143['extension']},'text':_0x250b3c[_0x2738('0xd')],'channelData':{}},'headers':{'Authorization':_0x2738('0xe')+_0x99e22e[_0x2738('0xf')]},'json':!![]};if(_0x250b3c[_0x2738('0x10')]){_0x20a64f[_0x2738('0x11')][_0x2738('0x12')][_0x2738('0x13')]=_0x250b3c[_0x2738('0x10')];}if(_0x250b3c[_0x2738('0x14')]=='1'){_0x20a64f[_0x2738('0x11')][_0x2738('0x12')][_0x2738('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x250b3c[_0x2738('0x16')]){_0x20a64f[_0x2738('0x11')]['channelData']['CustomAction']=_0x250b3c[_0x2738('0x16')];if(_0x250b3c[_0x2738('0x17')]){_0x20a64f[_0x2738('0x11')]['channelData'][_0x2738('0x18')]=_0x250b3c[_0x2738('0x17')];}}logger[_0x2738('0x19')](JSON[_0x2738('0x1a')](_0x20a64f));return rp(_0x20a64f);});}; \ No newline at end of file +var _0x0565=['resolve','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','Bearer\x20','channelData','project','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x0565,0xf2));var _0x5056=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0565[_0x47aa64];return _0x549c7a;};'use strict';var rp=require(_0x5056('0x0'));var url=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));module[_0x5056('0x4')]=function(_0x397289,_0xd4624d){var _0x300055={'method':_0x5056('0x5'),'uri':url[_0x5056('0x6')](_0xd4624d['ndauth_url'],_0x5056('0x7')),'form':{'grant_type':_0x5056('0x8'),'username':_0xd4624d[_0x5056('0x9')],'password':_0xd4624d[_0x5056('0x8')]},'json':!![]};return rp(_0x300055)['then'](function(_0x52b01f){var _0x38f74={'method':_0x5056('0x5'),'uri':url[_0x5056('0x6')](_0xd4624d[_0x5056('0xa')],_0x5056('0xb')),'body':{'type':_0xd4624d[_0x5056('0xc')]||_0x5056('0xd'),'channelId':_0x5056('0xe'),'conversation':{'id':_0x397289['uniqueid']},'from':{'id':_0x397289[_0x5056('0xf')],'name':_0x397289[_0x5056('0x10')]},'recipient':{'id':_0x397289[_0x5056('0x11')],'name':_0x397289['extension']},'text':_0xd4624d['text'],'channelData':{}},'headers':{'Authorization':_0x5056('0x12')+_0x52b01f['access_token']},'json':!![]};if(_0xd4624d['project']){_0x38f74['body'][_0x5056('0x13')]['ProjectName']=_0xd4624d[_0x5056('0x14')];}if(_0xd4624d[_0x5056('0x15')]=='1'){_0x38f74[_0x5056('0x16')]['channelData'][_0x5056('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5056('0x18')};}if(_0xd4624d[_0x5056('0x19')]){_0x38f74[_0x5056('0x16')][_0x5056('0x13')][_0x5056('0x1a')]=_0xd4624d['custom_action'];if(_0xd4624d[_0x5056('0x1b')]){_0x38f74['body'][_0x5056('0x13')][_0x5056('0x1c')]=_0xd4624d[_0x5056('0x1b')];}}logger[_0x5056('0x1d')](JSON[_0x5056('0x1e')](_0x38f74));return rp(_0x38f74);});}; \ 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 dcbfddd..eb26d1c 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 _0x88e3=['exports','./lib/api'];(function(_0x559822,_0x57ed58){var _0xa43db8=function(_0x41691e){while(--_0x41691e){_0x559822['push'](_0x559822['shift']());}};_0xa43db8(++_0x57ed58);}(_0x88e3,0x65));var _0x388e=function(_0x2c602e,_0x1d26f5){_0x2c602e=_0x2c602e-0x0;var _0x1a2650=_0x88e3[_0x2c602e];return _0x1a2650;};'use strict';var asr=require(_0x388e('0x0'));module[_0x388e('0x1')]=function(_0x2bab47,_0x2deee4,_0x4bdccb,_0x312578){return asr(_0x2bab47,_0x2deee4,_0x4bdccb,_0x312578);}; \ No newline at end of file +var _0x2c7e=['./lib/api'];(function(_0x51970b,_0x947e94){var _0x47db54=function(_0x5bab49){while(--_0x5bab49){_0x51970b['push'](_0x51970b['shift']());}};_0x47db54(++_0x947e94);}(_0x2c7e,0x73));var _0xe2c7=function(_0xd2c5bc,_0x50008a){_0xd2c5bc=_0xd2c5bc-0x0;var _0x5ae9fc=_0x2c7e[_0xd2c5bc];return _0x5ae9fc;};'use strict';var asr=require(_0xe2c7('0x0'));module['exports']=function(_0x3d73a1,_0x40202a,_0x578f2b,_0x1e1a70){return asr(_0x3d73a1,_0x40202a,_0x578f2b,_0x1e1a70);}; \ 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 716396c..46ac536 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 _0xe925=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','stringify','send','close','EOS','error','terminate','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','Success.'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe925,0x1e9));var _0x5e92=function(_0x13654e,_0x450089){_0x13654e=_0x13654e-0x0;var _0x1881ba=_0xe925[_0x13654e];return _0x1881ba;};'use strict';var BPromise=require(_0x5e92('0x0'));var _=require(_0x5e92('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5e92('0x2'));var crypto=require('crypto');var logger=require(_0x5e92('0x3'))(_0x5e92('0x4'));module[_0x5e92('0x5')]=function(_0x2e24ab,_0x58146c,_0x10c574,_0x182b97){return new BPromise(function(_0x1a133b,_0x25d8b6){logger[_0x5e92('0x6')](_0x5e92('0x7'),_0x182b97||_0x5e92('0x8'));var _0x51eaf2=new WebSocket(_0x182b97||_0x5e92('0x8'),{'perMessageDeflate':![]});var _0xc52202='';var _0x50e355='0';var _0x27eda6='1';var _0x50c2ff=_0x5e92('0x9');function _0x5163b6(_0x425e7e){var _0x4d55c7=crypto[_0x5e92('0xa')]('sha1');_0x4d55c7[_0x5e92('0xb')](_0x425e7e);return _0x4d55c7[_0x5e92('0xc')](_0x5e92('0xd'));}function _0x11c114(){try{logger[_0x5e92('0x6')](_0x5e92('0xe'));var _0x3b2cf4=moment()['unix']();var _0x525fc2=_0x5163b6(_0x3b2cf4+_0x58146c+_0x10c574);_0x51eaf2['send'](JSON[_0x5e92('0xf')]({'appID':_0x58146c,'timestamp':_0x3b2cf4,'appKey':_0x525fc2}));var _0x2dc823=fs['createReadStream'](_0x2e24ab);_0x2dc823['on']('data',function(_0x146a8a){_0x51eaf2[_0x5e92('0x10')](_0x146a8a);});_0x2dc823['on'](_0x5e92('0x11'),function(){_0x51eaf2[_0x5e92('0x10')](_0x5e92('0x12'));});}catch(_0xccc361){logger[_0x5e92('0x13')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0xccc361));_0x51eaf2[_0x5e92('0x14')]();}}function _0x532b8c(_0x178ff2){try{if(_0x178ff2){var _0x292540=JSON[_0x5e92('0x15')](_0x178ff2);switch(_0x292540[_0x5e92('0x16')]){case 0x0:if(_0x292540['result']){if(_0x292540['result'][_0x5e92('0x17')]){logger[_0x5e92('0x6')](_0x5e92('0x18'),JSON[_0x5e92('0xf')](_0x292540[_0x5e92('0x19')]['hypotheses']));_0xc52202=_0x292540['result'][_0x5e92('0x1a')][0x0][_0x5e92('0x1b')];_0x50e355=_0x292540[_0x5e92('0x19')][_0x5e92('0x1a')][0x0]['likelihood'];_0x27eda6='0';_0x50c2ff=_0x5e92('0x1c');_0x51eaf2[_0x5e92('0x14')]();}}break;case 0x1:logger[_0x5e92('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x27eda6='1';_0x50c2ff=_0x5e92('0x9');break;case 0x2:logger[_0x5e92('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x27eda6='2';_0x50c2ff=_0x5e92('0x1d');break;case 0x9:logger[_0x5e92('0x6')](_0x5e92('0x1e'));_0x27eda6='9';_0x50c2ff='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x5e92('0x6')](_0x5e92('0x1f'));_0x27eda6='10';_0x50c2ff=_0x5e92('0x1f');break;case 0xb:logger[_0x5e92('0x6')](_0x5e92('0x20'));_0x27eda6='11';_0x50c2ff=_0x5e92('0x20');}}}catch(_0x146f67){logger[_0x5e92('0x13')](_0x5e92('0x21'),JSON['stringify'](_0x146f67));_0x51eaf2[_0x5e92('0x14')]();}}function _0x52ecea(){logger[_0x5e92('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x1a133b({'transcript':_0xc52202,'confidence':_0x50e355,'status':_0x27eda6,'status_message':_0x50c2ff});}function _0x3802a8(_0x404da6){logger[_0x5e92('0x13')](_0x5e92('0x22'));if(!_[_0x5e92('0x23')](_0x404da6)){logger[_0x5e92('0x13')](_['isObject'](_0x404da6)?JSON[_0x5e92('0xf')](_0x404da6):_0x404da6);}}_0x51eaf2['on'](_0x5e92('0x24'),_0x11c114);_0x51eaf2['on']('message',_0x532b8c);_0x51eaf2['on'](_0x5e92('0x11'),_0x52ecea);_0x51eaf2['on']('error',_0x3802a8);});}; \ No newline at end of file +var _0x5836=['unix','send','stringify','createReadStream','close','Tilde\x20ASR\x20send\x20error','terminate','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','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.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5836,0xd1));var _0x6583=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0x5836[_0x2e58c7];return _0x26eb00;};'use strict';var BPromise=require(_0x6583('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6583('0x1'));var crypto=require(_0x6583('0x2'));var logger=require(_0x6583('0x3'))(_0x6583('0x4'));module['exports']=function(_0x372f82,_0x3b9a1c,_0x2cd3d7,_0xb3bcfb){return new BPromise(function(_0x1184b7,_0x5b312c){logger[_0x6583('0x5')](_0x6583('0x6'),_0xb3bcfb||_0x6583('0x7'));var _0x49d281=new WebSocket(_0xb3bcfb||_0x6583('0x7'),{'perMessageDeflate':![]});var _0x46f93d='';var _0x5c68ca='0';var _0x41d7='1';var _0x5daeae='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xb8f240(_0x3dfa99){var _0x4bd218=crypto['createHash'](_0x6583('0x8'));_0x4bd218[_0x6583('0x9')](_0x3dfa99);return _0x4bd218[_0x6583('0xa')](_0x6583('0xb'));}function _0x117da2(){try{logger[_0x6583('0x5')](_0x6583('0xc'));var _0x1ee142=moment()[_0x6583('0xd')]();var _0x5c62e7=_0xb8f240(_0x1ee142+_0x3b9a1c+_0x2cd3d7);_0x49d281[_0x6583('0xe')](JSON[_0x6583('0xf')]({'appID':_0x3b9a1c,'timestamp':_0x1ee142,'appKey':_0x5c62e7}));var _0x4a96bd=fs[_0x6583('0x10')](_0x372f82);_0x4a96bd['on']('data',function(_0x5517ba){_0x49d281[_0x6583('0xe')](_0x5517ba);});_0x4a96bd['on'](_0x6583('0x11'),function(){_0x49d281[_0x6583('0xe')]('EOS');});}catch(_0x2bb6a9){logger['error'](_0x6583('0x12'),JSON[_0x6583('0xf')](_0x2bb6a9));_0x49d281[_0x6583('0x13')]();}}function _0x4a471b(_0x1138a3){try{if(_0x1138a3){var _0x28bae0=JSON['parse'](_0x1138a3);switch(_0x28bae0[_0x6583('0x14')]){case 0x0:if(_0x28bae0[_0x6583('0x15')]){if(_0x28bae0[_0x6583('0x15')]['final']){logger['info'](_0x6583('0x16'),JSON[_0x6583('0xf')](_0x28bae0[_0x6583('0x15')][_0x6583('0x17')]));_0x46f93d=_0x28bae0[_0x6583('0x15')][_0x6583('0x17')][0x0]['transcript'];_0x5c68ca=_0x28bae0[_0x6583('0x15')][_0x6583('0x17')][0x0]['likelihood'];_0x41d7='0';_0x5daeae=_0x6583('0x18');_0x49d281[_0x6583('0x13')]();}}break;case 0x1:logger[_0x6583('0x5')](_0x6583('0x19'));_0x41d7='1';_0x5daeae=_0x6583('0x19');break;case 0x2:logger[_0x6583('0x5')](_0x6583('0x1a'));_0x41d7='2';_0x5daeae=_0x6583('0x1a');break;case 0x9:logger[_0x6583('0x5')](_0x6583('0x1b'));_0x41d7='9';_0x5daeae=_0x6583('0x1b');break;case 0xa:logger['info'](_0x6583('0x1c'));_0x41d7='10';_0x5daeae=_0x6583('0x1c');break;case 0xb:logger[_0x6583('0x5')](_0x6583('0x1d'));_0x41d7='11';_0x5daeae=_0x6583('0x1d');}}}catch(_0x261f8a){logger[_0x6583('0x1e')](_0x6583('0x1f'),JSON[_0x6583('0xf')](_0x261f8a));_0x49d281['terminate']();}}function _0x2dd4a6(){logger[_0x6583('0x5')](_0x6583('0x20'));_0x1184b7({'transcript':_0x46f93d,'confidence':_0x5c68ca,'status':_0x41d7,'status_message':_0x5daeae});}function _0x561f04(_0x256f42){logger[_0x6583('0x1e')](_0x6583('0x21'));if(!_[_0x6583('0x22')](_0x256f42)){logger[_0x6583('0x1e')](_[_0x6583('0x23')](_0x256f42)?JSON[_0x6583('0xf')](_0x256f42):_0x256f42);}}_0x49d281['on'](_0x6583('0x24'),_0x117da2);_0x49d281['on']('message',_0x4a471b);_0x49d281['on'](_0x6583('0x11'),_0x2dd4a6);_0x49d281['on'](_0x6583('0x1e'),_0x561f04);});}; \ 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 1ba843a..a284c5a 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 _0x2d75=['exports'];(function(_0x3f356d,_0x1bdb3d){var _0x54aff8=function(_0x1cb0f7){while(--_0x1cb0f7){_0x3f356d['push'](_0x3f356d['shift']());}};_0x54aff8(++_0x1bdb3d);}(_0x2d75,0x139));var _0x52d7=function(_0x5459b0,_0x4d2ef8){_0x5459b0=_0x5459b0-0x0;var _0x675a35=_0x2d75[_0x5459b0];return _0x675a35;};var asr=require('./asr');module[_0x52d7('0x0')]={'asr':asr}; \ No newline at end of file +var _0x121c=['./asr','exports'];(function(_0x4c3026,_0x682e15){var _0x42418c=function(_0x51425f){while(--_0x51425f){_0x4c3026['push'](_0x4c3026['shift']());}};_0x42418c(++_0x682e15);}(_0x121c,0x15c));var _0xc121=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x121c[_0x55abd9];return _0x3e5669;};var asr=require(_0xc121('0x0'));module[_0xc121('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 1dc5428..d6a2ee2 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x3a0863,_0x4cd5ef){var _0x85c557=function(_0x3011cb){while(--_0x3011cb){_0x3a0863['push'](_0x3a0863['shift']());}};_0x85c557(++_0x4cd5ef);}(_0xe706,0xa3));var _0x6e70=function(_0x3a2147,_0x536e69){_0x3a2147=_0x3a2147-0x0;var _0x158499=_0xe706[_0x3a2147];return _0x158499;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3bc6d2c..014c2fc 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 _0x823c=['aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','split','replaceAll','extra','getAndSetVariable','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','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','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','setVariable','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','generate','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','context','priority','gotoif','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','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','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','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','QUEUE','macro','gosub','position','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','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','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','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','unpause','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','channel','rpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','mailRpc','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','extension','accountcode','dnid','file','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentLogout','agentLogin','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex'];(function(_0x4be6f4,_0x385b23){var _0x3e9098=function(_0x17ff9a){while(--_0x17ff9a){_0x4be6f4['push'](_0x4be6f4['shift']());}};_0x3e9098(++_0x385b23);}(_0x823c,0x143));var _0xc823=function(_0x32a9ed,_0x225c13){_0x32a9ed=_0x32a9ed-0x0;var _0x15be6a=_0x823c[_0x32a9ed];return _0x15be6a;};'use strict';var fs=require('fs');var util=require(_0xc823('0x0'));var _=require('lodash');var sh=require(_0xc823('0x1'));var odbc=require(_0xc823('0x2'))();var rs=require(_0xc823('0x3'));var moment=require(_0xc823('0x4'));var Mustache=require(_0xc823('0x5'));var rp=require(_0xc823('0x6'));var logger=require('../../config/logger')(_0xc823('0x7'));var config=require(_0xc823('0x8'));var shared=require(_0xc823('0x9'));var scripts=require(_0xc823('0xa'));var FILES_PATH=_0xc823('0xb');var recursiveMapAttributes=['rawHeaders',_0xc823('0xc')];var verticesWithRetry=[_0xc823('0xd'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x4478fc,_0x39cc25,_0x53d48d){this[_0xc823('0xe')]=_0x4478fc;this[_0xc823('0xf')]=_0x39cc25;this['mailRpc']=_0x53d48d;};AGIVertices['prototype'][_0xc823('0x10')]=function(_0x172c92,_0x3435d6){this[_0xc823('0xf')][_0xc823('0x11')](_0x172c92)['then'](function(_0x3f33e9){_0x3435d6(null,_0x3f33e9?_0x3f33e9[_0xc823('0x12')]:![]);})[_0xc823('0x13')](function(_0x1546b9){_0x3435d6(_0x1546b9);});};AGIVertices[_0xc823('0x14')][_0xc823('0x15')]=function(_0x51ffdb,_0x1e4425){this[_0xc823('0xf')][_0xc823('0x16')](_0x51ffdb)[_0xc823('0x17')](function(_0x55b31d){_0x1e4425(null,_0x55b31d?_0x55b31d['name']:![]);})['catch'](function(_0x5bdfc9){_0x1e4425(_0x5bdfc9);});};AGIVertices[_0xc823('0x14')]['getSquareProject']=function(_0x366c31,_0x122510){this[_0xc823('0xf')][_0xc823('0x18')](_0x366c31)[_0xc823('0x17')](function(_0x1aca6d){_0x122510(null,_0x1aca6d?_0x1aca6d[_0xc823('0x12')]:![]);})['catch'](function(_0x42843e){_0x122510(_0x42843e);});};AGIVertices['prototype'][_0xc823('0x19')]=function(_0x3aa68f,_0x3d3ddb){this['rpc'][_0xc823('0x1a')](_0x3aa68f)[_0xc823('0x17')](function(_0x3a3fcd){_0x3d3ddb(null,_0x3a3fcd?_0x3a3fcd['dsn']:![]);})[_0xc823('0x13')](function(_0x325c8a){_0x3d3ddb(_0x325c8a);});};AGIVertices[_0xc823('0x14')][_0xc823('0x1b')]=function(_0x574c76,_0x414c86){this['rpc'][_0xc823('0x1c')](_0x574c76)['then'](function(_0x510460){_0x414c86(null,_0x510460?_0x510460[_0xc823('0x12')]:![]);})[_0xc823('0x13')](function(_0x52c941){_0x414c86(_0x52c941);});};AGIVertices[_0xc823('0x14')][_0xc823('0x1d')]=function(_0x451f7a,_0x265f92){this[_0xc823('0xf')][_0xc823('0x1e')](_0x451f7a)[_0xc823('0x17')](function(_0xb501ac){_0x265f92(null,_0xb501ac?_0xb501ac[_0xc823('0x12')]:![]);})[_0xc823('0x13')](function(_0x4e4bd4){_0x265f92(_0x4e4bd4);});};AGIVertices[_0xc823('0x14')]['getSound']=function(_0x54e956,_0x15ac97){var _0x21265a=this;this[_0xc823('0xf')][_0xc823('0x1f')](_0x54e956)[_0xc823('0x17')](function(_0x182fcf){_0x15ac97(null,_0x182fcf?_0x21265a[_0xc823('0x20')](_0x182fcf[_0xc823('0x21')]):![]);})[_0xc823('0x13')](function(_0xba0f46){_0x15ac97(_0xba0f46);});};AGIVertices[_0xc823('0x14')][_0xc823('0x22')]=function(_0x352b61,_0xda39a3){this[_0xc823('0xf')]['getMailAccountById'](_0x352b61)[_0xc823('0x17')](function(_0x34af84){_0xda39a3(null,_0x34af84?_0x34af84:![]);})[_0xc823('0x13')](function(_0x351c0b){_0xda39a3(_0x351c0b);});};AGIVertices[_0xc823('0x14')]['sendMailMessage']=function(_0x4e8312,_0x5c6921,_0x35ba13){this[_0xc823('0x23')][_0xc823('0x24')](_0x4e8312,_0x5c6921)[_0xc823('0x17')](function(){_0x35ba13(null);})['catch'](function(_0xc128c7){_0x35ba13(_0xc128c7);});};AGIVertices[_0xc823('0x14')][_0xc823('0x25')]=function(_0xd68524,_0x40fd2a){this[_0xc823('0xf')][_0xc823('0x26')](_0xd68524)[_0xc823('0x17')](function(_0xf69aea){if(_0xf69aea){if(_0xf69aea[_0xc823('0x27')]){_0x40fd2a(null,[_0xf69aea[_0xc823('0x28')]]);}else{_0x40fd2a(null,_[_0xc823('0x29')](_0xf69aea[_0xc823('0x2a')],'interval'));}}else{_0x40fd2a(null,![]);}})[_0xc823('0x13')](function(_0x3bb497){_0x40fd2a(_0x3bb497);});};AGIVertices[_0xc823('0x14')][_0xc823('0x20')]=function(_0x2b7273){return util[_0xc823('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x2b7273);};AGIVertices[_0xc823('0x14')][_0xc823('0x2c')]=function(_0x4b70e2,_0x2d18cd,_0x5f215f){odbc[_0xc823('0x2d')](_0x4b70e2,function(_0x970ceb){if(_0x970ceb){logger['error'](_0xc823('0x2e'),_0x970ceb);_0x5f215f(_0x970ceb);}else{logger[_0xc823('0x2f')](_0xc823('0x30'));odbc[_0xc823('0x31')](_0x2d18cd,function(_0x3a2977,_0x2c68fb){if(_0x3a2977){logger[_0xc823('0x2f')]('Error\x20executing\x20query\x20%s',_0x2d18cd);_0x5f215f(_0x3a2977);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x2d18cd);odbc[_0xc823('0x32')](function(_0x86b3e1){if(_0x86b3e1){logger[_0xc823('0x33')](_0xc823('0x34'),_0x86b3e1);}_0x5f215f(null,_0x2c68fb);});}});}});};AGIVertices[_0xc823('0x14')]['getSmsAccount']=function(_0xfef258,_0x28e575){this[_0xc823('0xf')][_0xc823('0x35')](_0xfef258)['then'](function(_0x51b38e){_0x28e575(null,_0x51b38e?_0x51b38e:![]);})['catch'](function(_0x3f72a4){_0x28e575(_0x3f72a4);});};AGIVertices[_0xc823('0x14')][_0xc823('0x36')]=function(_0x4d9ce7,_0x2ca48a){this['rpc'][_0xc823('0x36')](_0x4d9ce7)[_0xc823('0x17')](function(_0x3535b6){_0x2ca48a(null,_0x3535b6);})[_0xc823('0x13')](function(_0x337541){_0x2ca48a(_0x337541);});};AGIVertices[_0xc823('0x14')][_0xc823('0x37')]=function(_0x521e47,_0x1256b6,_0x4d2100){this[_0xc823('0xf')][_0xc823('0x37')]({'uniqueid':this[_0xc823('0xe')][_0xc823('0x38')],'node':_0x521e47[_0xc823('0x39')],'application':_0x521e47[_0xc823('0x3a')],'data':_0x1256b6||null,'project_name':this[_0xc823('0xe')][_0xc823('0x3b')],'callerid':this['channel'][_0xc823('0x3c')]})[_0xc823('0x17')](function(_0x58b784){if(_0x4d2100){_0x4d2100(null,_0x58b784);}})[_0xc823('0x13')](function(_0x4661e5){if(_0x4d2100){_0x4d2100(_0x4661e5);}});};AGIVertices[_0xc823('0x14')][_0xc823('0x3d')]=function(_0x2d6206,_0x336eea,_0x180f2e,_0x12a665){this[_0xc823('0xf')]['createSquareRecording']({'uniqueid':this[_0xc823('0xe')][_0xc823('0x38')],'callerid':this['channel'][_0xc823('0x3c')],'calleridname':this[_0xc823('0xe')]['calleridname'],'context':this[_0xc823('0xe')]['context'],'extension':this[_0xc823('0xe')][_0xc823('0x3e')],'priority':this['channel']['priority'],'accountcode':this[_0xc823('0xe')][_0xc823('0x3f')],'dnid':this[_0xc823('0xe')][_0xc823('0x40')],'projectName':this[_0xc823('0xe')][_0xc823('0x3b')],'saveName':_0x336eea,'filename':_0x2d6206[_0xc823('0x41')]||_0x336eea,'savePath':_0x180f2e})[_0xc823('0x17')](function(_0x4a134e){_0x12a665(null,_0x4a134e);})[_0xc823('0x13')](function(_0x26b20a){_0x12a665(_0x26b20a);});};AGIVertices['prototype']['createSquareMessage']=function(_0xffa480,_0x4db975,_0x491928,_0x5c3217,_0x4e1046){this['rpc']['createSquareMessage']({'uniqueid':this[_0xc823('0xe')]['uniqueid'],'body':_0xffa480,'direction':_0x4db975,'providerName':_0x491928,'providerResponse':_0x5c3217})['then'](function(_0x3683bd){if(_0x4e1046){_0x4e1046(null,_0x3683bd);}})['catch'](function(_0x33b4f8){if(_0x4e1046){_0x4e1046(_0x33b4f8);}});};AGIVertices[_0xc823('0x14')]['createCmContact']=function(_0x43ae9f,_0x1d960c){this[_0xc823('0xf')]['createCmContact']({'firstName':_['isEmpty'](_0x43ae9f[_0xc823('0x12')])||_[_0xc823('0x42')](_0x43ae9f['name'])?_0xc823('0x43')+Math[_0xc823('0x44')]():_0x43ae9f[_0xc823('0x12')],'lastName':_['isEmpty'](_0x43ae9f[_0xc823('0x45')])||_[_0xc823('0x42')](_0x43ae9f[_0xc823('0x45')])?null:_0x43ae9f[_0xc823('0x45')],'phone':_0x43ae9f[_0xc823('0x46')],'ListId':_0x43ae9f[_0xc823('0x47')],'scheduledat':_0x43ae9f[_0xc823('0x48')],'callbackUniqueid':this['channel'][_0xc823('0x38')],'tags':_0xc823('0x49'),'description':_0xc823('0x4a')+_0x43ae9f[_0xc823('0x48')][_0xc823('0x4b')](),'priority':_0x43ae9f[_0xc823('0x4c')]})[_0xc823('0x17')](function(_0x5e7527){_0x1d960c(null,_0x5e7527);})[_0xc823('0x13')](function(_0x2fd2df){_0x1d960c(_0x2fd2df);});};AGIVertices[_0xc823('0x14')][_0xc823('0x4d')]=function(_0x283515,_0x2d20fc){this['rpc'][_0xc823('0x4e')](_0x283515)['then'](function(_0x5dd8ad){_0x2d20fc(null,_0x5dd8ad?_0x5dd8ad['name']:![]);})[_0xc823('0x13')](function(_0x53bf45){_0x2d20fc(_0x53bf45);});};AGIVertices[_0xc823('0x14')]['agentPause']=function(_0x2244bd,_0x100447,_0x50fc62){var _0x2ae99e={'role':'agent'};_0x2ae99e[_0x2244bd]=this['channel'][_0xc823('0x3c')];this['rpc'][_0xc823('0x4f')](_0x2ae99e,_0x100447,this['channel'][_0xc823('0x38')])[_0xc823('0x17')](function(_0x4b40e5){_0x50fc62(null,_[_0xc823('0x42')](_0x4b40e5)?![]:!![]);})[_0xc823('0x13')](function(_0x34ade7){logger[_0xc823('0x33')](_0x34ade7);_0x50fc62(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x54d0b5,_0x4cb43e){var _0x2240de={'role':_0xc823('0x50')};_0x2240de[_0x54d0b5]=this[_0xc823('0xe')][_0xc823('0x3c')];this[_0xc823('0xf')]['agentUnpause'](_0x2240de)[_0xc823('0x17')](function(_0x4e4191){_0x4cb43e(null,_[_0xc823('0x42')](_0x4e4191)?![]:!![]);})[_0xc823('0x13')](function(_0x5efb1b){logger[_0xc823('0x33')](_0x5efb1b);_0x4cb43e(null,![]);});};AGIVertices['prototype'][_0xc823('0x51')]=function(_0x11d3a1,_0x110374){var _0x42f203={'role':'agent'};_0x42f203[_0x11d3a1]=this['channel']['callerid'];this['rpc']['agentLogout'](_0x42f203)[_0xc823('0x17')](function(_0x302720){_0x110374(null,_['isNil'](_0x302720)?![]:!![]);})['catch'](function(_0x2cbd33){logger[_0xc823('0x33')](_0x2cbd33);_0x110374(null,![]);});};AGIVertices[_0xc823('0x14')][_0xc823('0x52')]=function(_0x2b54bb,_0x3f0385){var _0x2b0bdf={'role':'agent'};_0x2b0bdf[_0x2b54bb]=this[_0xc823('0xe')][_0xc823('0x3c')];var _0x3589f6=_0x2b54bb!='internal'?util['format']('%s/%s@from-sip/n',_0xc823('0x53'),this[_0xc823('0xe')]['callerid']):undefined;this[_0xc823('0xf')][_0xc823('0x52')](_0x2b0bdf,_0x3589f6)[_0xc823('0x17')](function(_0x58919c){_0x3f0385(null,_['isNil'](_0x58919c)?![]:!![]);})[_0xc823('0x13')](function(_0x39bfb8){logger[_0xc823('0x33')](_0x39bfb8);_0x3f0385(null,![]);});};AGIVertices['prototype'][_0xc823('0x54')]=function(_0x147481,_0x47d3d2){sh[_0xc823('0x55')](_[_0xc823('0x56')](_0x147481),function(_0x505cce,_0x4eef42){var _0x4cd52c=_0x4eef42[_0xc823('0x57')](/(\r\n|\n|\r)/gm,'');_0x47d3d2(null,_0x4cd52c);});};AGIVertices[_0xc823('0x14')]['googleCloudTTS']=function(_0x2cd33a,_0x1f356c){scripts[_0xc823('0x58')](_0x2cd33a[_0xc823('0x59')],_0x2cd33a[_0xc823('0x5a')]||_0xc823('0x5b'),_0x2cd33a['text'],_0x2cd33a[_0xc823('0x5c')]||'en-US',_0x2cd33a['ssmlGender']||_0xc823('0x5d'),_0x2cd33a['audioEncoding']||_0xc823('0x5e'))[_0xc823('0x17')](function(_0x2e0774){_0x1f356c(null,_0x2e0774);})[_0xc823('0x13')](function(_0x1c198e){_0x1f356c(_0x1c198e);});};AGIVertices[_0xc823('0x14')][_0xc823('0x5f')]=function(_0x51f22a,_0x22f8f5){scripts[_0xc823('0x5f')](_0x51f22a[_0xc823('0x5b')],_0x51f22a[_0xc823('0x60')]||'en',0x1)[_0xc823('0x17')](function(_0x514138){_0x22f8f5(null,_0x514138);})[_0xc823('0x13')](function(_0x1e9439){_0x22f8f5(_0x1e9439);});};AGIVertices[_0xc823('0x14')][_0xc823('0x61')]=function(_0x42406b,_0x5d7b65){var _0x310f3e={'uri':_0x42406b[_0xc823('0x62')],'method':_0x42406b[_0xc823('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x42406b[_0xc823('0x64')])==='number'&&parseInt(_0x42406b[_0xc823('0x64')])>=0x1?parseInt(_0x42406b[_0xc823('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xc823('0x65')]([_0xc823('0x66'),_0xc823('0x67')],_0x310f3e[_0xc823('0x63')]['toUpperCase']())){try{_0x310f3e[_0xc823('0x68')]=_0x42406b['rawBody']?JSON[_0xc823('0x69')](_0x42406b[_0xc823('0xc')]):{};}catch(_0x1d4123){logger['error'](_0xc823('0x6a'),_0x1d4123);}}try{_0x310f3e[_0xc823('0x6b')]=_0x42406b[_0xc823('0x6c')]?JSON[_0xc823('0x69')](_0x42406b[_0xc823('0x6c')]):{};}catch(_0x308f04){logger[_0xc823('0x33')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x308f04);}if(_0x42406b[_0xc823('0x6d')]){try{var _0x280220=require(_0x42406b[_0xc823('0x6d')])[_0xc823('0x6e')](this,_0x310f3e);_0x310f3e[_0xc823('0x6f')]=Mustache[_0xc823('0x70')](_0x42406b[_0xc823('0x62')],_0x280220,{},['$$','$$']);if(_0x310f3e[_0xc823('0x6b')]){_0x310f3e[_0xc823('0x6b')]=JSON[_0xc823('0x69')](Mustache[_0xc823('0x70')](JSON[_0xc823('0x71')](_0x310f3e[_0xc823('0x6b')]),_0x280220,{},['$$','$$']));}if(_0x310f3e[_0xc823('0x68')]){_0x310f3e[_0xc823('0x68')]=JSON[_0xc823('0x69')](Mustache[_0xc823('0x70')](JSON[_0xc823('0x71')](_0x310f3e[_0xc823('0x68')]),_0x280220,{},['$$','$$']));}}catch(_0x473aa1){logger['error'](_0xc823('0x72'),_0x473aa1);}}rp(_0x310f3e)[_0xc823('0x17')](function(_0x28278c){var _0x1927ff={'statusCode':_0x28278c[_0xc823('0x73')]||0xc8,'statusMessage':_0x28278c[_0xc823('0x74')]||'OK','headers':_0x28278c['headers']||{},'body':_0x28278c[_0xc823('0x68')]||{}};_0x5d7b65(null,_0x1927ff);})[_0xc823('0x13')](function(_0x366d8e){var _0x3fa853={'statusCode':_0x366d8e[_0xc823('0x73')]||0x1f4,'statusMessage':_0x366d8e[_0xc823('0x75')]||_0xc823('0x76'),'headers':_0x366d8e['options'][_0xc823('0x6b')]||{},'body':_0x366d8e[_0xc823('0x77')][_0xc823('0x68')]||{}};_0x5d7b65(null,_0x3fa853);});};AGIVertices[_0xc823('0x14')][_0xc823('0x78')]=function(_0x22e758,_0x47d29e){scripts[_0xc823('0x78')](this[_0xc823('0xe')][_0xc823('0x38')],_0x22e758[_0xc823('0x79')],_0x22e758[_0xc823('0x5b')],_0x22e758[_0xc823('0x7a')]||'en')[_0xc823('0x17')](function(_0x5ef927){_0x47d29e(null,_0x5ef927);})['catch'](function(_0x5cf5f9){_0x47d29e(_0x5cf5f9);});};AGIVertices[_0xc823('0x14')]['googleDialogflowV2']=function(_0x35e1e2,_0x411a5d){scripts[_0xc823('0x7b')](this[_0xc823('0xe')]['uniqueid'],_0x35e1e2[_0xc823('0x7c')],_0x35e1e2[_0xc823('0x7d')],_0x35e1e2[_0xc823('0x7e')],_0x35e1e2[_0xc823('0x5b')],_0x35e1e2['dialogflowV2_language']||'en')[_0xc823('0x17')](function(_0x26c8f0){_0x411a5d(null,_0x26c8f0);})['catch'](function(_0x3fc59f){_0x411a5d(_0x3fc59f);});};AGIVertices['prototype'][_0xc823('0x7f')]=function(_0x57e306,_0x417a47){scripts[_0xc823('0x7f')](this[_0xc823('0xe')],_0x57e306)['then'](function(_0xb1e448){_0x417a47(null,_0xb1e448);})['catch'](function(_0x455df5){_0x417a47(_0x455df5);});};AGIVertices[_0xc823('0x14')][_0xc823('0x80')]=function(_0x1f998f,_0xdeaffc){scripts[_0xc823('0x80')](_0x1f998f[_0xc823('0x79')],_0x1f998f[_0xc823('0x5b')],_0x1f998f['ispeech_tts_language']||_0xc823('0x81'),_0x1f998f[_0xc823('0x82')])[_0xc823('0x17')](function(_0x1ec68a){_0xdeaffc(null,_0x1ec68a);})[_0xc823('0x13')](function(_0xeed288){_0xdeaffc(_0xeed288);});};AGIVertices[_0xc823('0x14')][_0xc823('0x83')]=function(_0x1e324b,_0x14bfd3,_0x5cceab){scripts[_0xc823('0x83')](_0x14bfd3,_0x1e324b[_0xc823('0x79')],_0x1e324b['ispeech_asr_language']||_0xc823('0x81'),this[_0xc823('0x84')](_0x1e324b[_0xc823('0x85')])?_0x1e324b[_0xc823('0x85')]:undefined)[_0xc823('0x17')](function(_0x18927e){_0x5cceab(null,_0x18927e);})['catch'](function(_0x596d87){_0x5cceab(_0x596d87);});};AGIVertices[_0xc823('0x14')][_0xc823('0x86')]=function(_0x39d74d,_0x283ddc){scripts['awsPolly'](_0x39d74d['aws_access_key_id'],_0x39d74d[_0xc823('0x87')],_0x39d74d[_0xc823('0x88')],_0x39d74d[_0xc823('0x89')]||_0xc823('0x8a'),_0x39d74d['text'],_0x39d74d[_0xc823('0x8b')]||_0xc823('0x5b'))['then'](function(_0xe59ea8){_0x283ddc(null,_0xe59ea8);})[_0xc823('0x13')](function(_0x433cd3){_0x283ddc(_0x433cd3);});};AGIVertices[_0xc823('0x14')]['awsLex']=function(_0x561a5b,_0x1d76bc){scripts[_0xc823('0x8c')](this[_0xc823('0xe')]['uniqueid'],_0x561a5b[_0xc823('0x8d')],_0x561a5b[_0xc823('0x87')],_0x561a5b[_0xc823('0x8e')],_0x561a5b[_0xc823('0x5b')],_0x561a5b[_0xc823('0x8f')])[_0xc823('0x17')](function(_0x1f0492){_0x1d76bc(null,_0x1f0492);})[_0xc823('0x13')](function(_0x5ae458){_0x1d76bc(_0x5ae458);});};AGIVertices[_0xc823('0x14')][_0xc823('0x90')]=function(_0xc0c51d,_0x4e8854,_0x208271){scripts[_0xc823('0x90')](_0x4e8854,_0xc0c51d[_0xc823('0x79')],_0xc0c51d['google_asr_language']||'en-US')[_0xc823('0x17')](function(_0x30f7da){_0x208271(null,_0x30f7da);})[_0xc823('0x13')](function(_0x3dd90e){_0x208271(_0x3dd90e);});};AGIVertices[_0xc823('0x14')][_0xc823('0x91')]=function(_0x1bbabc,_0x5a382f,_0xb41206){scripts[_0xc823('0x91')](_0x5a382f,_0x1bbabc['appid'],_0x1bbabc[_0xc823('0x92')],_0x1bbabc[_0xc823('0x6f')])['then'](function(_0x22256a){_0xb41206(null,_0x22256a);})[_0xc823('0x13')](function(_0x59d573){_0xb41206(_0x59d573);});};AGIVertices[_0xc823('0x14')][_0xc823('0x93')]=function(_0x34801b){var _0xee3f0a=_[_0xc823('0x65')](verticesWithRetry,_0x34801b['agicommand'])?_0x34801b:_[_0xc823('0x94')](_0x34801b);for(var _0x3ec3ba in _0xee3f0a){if(_0xee3f0a[_0xc823('0x95')](_0x3ec3ba)){if(_0xee3f0a[_0x3ec3ba]&&_[_0xc823('0x96')](_0xee3f0a[_0x3ec3ba])){if(_[_0xc823('0x65')](recursiveMapAttributes,_0x3ec3ba)){_0xee3f0a[_0x3ec3ba]=this[_0xc823('0x97')](_0xee3f0a[_0x3ec3ba]);}else{_0xee3f0a[_0x3ec3ba]=this['replaceAllVariables'](_0xee3f0a[_0x3ec3ba]);}}}}return _0xee3f0a;};AGIVertices[_0xc823('0x14')]['recursiveNodeIndex']=function(_0x5bfed8){for(var _0xbe9ded in _0x5bfed8){if(_0x5bfed8['hasOwnProperty'](_0xbe9ded)){if(_[_0xc823('0x98')](_0x5bfed8[_0xbe9ded])){this[_0xc823('0x99')](_0x5bfed8[_0xbe9ded]);}else if(_[_0xc823('0x9a')](_0x5bfed8[_0xbe9ded])){for(var _0x19bb62=0x0;_0x19bb62<_0x5bfed8[_0xbe9ded][_0xc823('0x9b')];_0x19bb62++){this[_0xc823('0x99')](_0x5bfed8[_0xbe9ded][_0x19bb62]);}}else if(_[_0xc823('0x96')](_0x5bfed8[_0xbe9ded])){_0x5bfed8[_0xbe9ded]=this[_0xc823('0x9c')](_0x5bfed8[_0xbe9ded]);}}}};AGIVertices[_0xc823('0x14')][_0xc823('0x9d')]=function(_0x2a727c,_0x33811d){for(var _0x1df16f in _0x2a727c){if(_0x2a727c[_0xc823('0x95')](_0x1df16f)){if(_['isPlainObject'](_0x2a727c[_0x1df16f])){if(!_['isEmpty'](_0x2a727c[_0x1df16f])){this[_0xc823('0x9d')](_0x2a727c[_0x1df16f],util[_0xc823('0x2b')](_0xc823('0x9e'),_0x33811d,_0x1df16f));}}else if(_[_0xc823('0x9a')](_0x2a727c[_0x1df16f])){for(var _0x2676f8=0x0;_0x2676f8<_0x2a727c[_0x1df16f][_0xc823('0x9b')];_0x2676f8++){this[_0xc823('0x9d')](_0x2a727c[_0x1df16f][_0x2676f8],util[_0xc823('0x2b')](_0xc823('0x9e'),_0x33811d,_0x1df16f+'['+_0x2676f8+']'));}}else{if(!_['isNil'](_0x2a727c[_0x1df16f])){this[_0xc823('0xe')]['setVariable'](util[_0xc823('0x2b')]('%s.%s',_0x33811d,_0x1df16f),_0x2a727c[_0x1df16f]);}}}}};AGIVertices[_0xc823('0x14')][_0xc823('0x97')]=function(_0x1f9934){try{var _0x115c12=JSON[_0xc823('0x69')](_0x1f9934);this['recursiveNodeIndex'](_0x115c12);return JSON[_0xc823('0x71')](_0x115c12);}catch(_0x1313e0){return this['replaceAllVariables'](_0x1f9934);}};AGIVertices['prototype'][_0xc823('0x9c')]=function(_0x2d9d6f){var _0x60be33=_0x2d9d6f[_0xc823('0x9f')]('{');for(var _0x5c92da=0x1;_0x5c92da<_0x60be33[_0xc823('0x9b')];_0x5c92da+=0x1){var _0x33140b=_0x60be33[_0x5c92da][_0xc823('0x9f')]('}');if(_0x33140b['length']>0x1){_0x2d9d6f=_0x2d9d6f[_0xc823('0xa0')]('{'+_0x33140b[0x0]+'}',this['channel'][_0xc823('0x10')](_0x33140b[0x0])[_0xc823('0xa1')]||_0x33140b[0x0]);}}if(_0x60be33['length']===0x1){return _0x2d9d6f[_0xc823('0x4b')]();}return this[_0xc823('0x9c')](_0x2d9d6f);};AGIVertices[_0xc823('0x14')][_0xc823('0xa2')]=function(_0x3a2c18,_0x210d12){var _0x5403ca=this[_0xc823('0xe')][_0xc823('0x10')](_0x3a2c18);if(_0x5403ca['result']===-0x1){return _0x5403ca;}logger['info'](util[_0xc823('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x210d12,_0x5403ca[_0xc823('0xa1')]));return this[_0xc823('0xe')]['setVariable'](_0x210d12,_0x5403ca[_0xc823('0xa1')]);};AGIVertices[_0xc823('0x14')][_0xc823('0x84')]=function(_0x6770b5){return _0x6770b5&&_0x6770b5!=='0'&&_0x6770b5!=='-1'&&_0x6770b5!=='';};AGIVertices['prototype'][_0xc823('0xa3')]=function(_0x15409d){this[_0xc823('0x37')][_0xc823('0x6e')](this,_0x15409d,'-');_0x15409d[_0xc823('0xa4')]=_0x15409d[_0xc823('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc823('0x14')]['mrcpsynth']=function(_0x47ed42){logger[_0xc823('0x2f')](util['format'](_0xc823('0xa5'),_0x47ed42[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x47ed42[_0xc823('0x5b')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xa7'));}var _0x5a615e='\x22'+_0x47ed42[_0xc823('0x5b')]+'\x22';if(this[_0xc823('0x84')](_0x47ed42['options'])){_0x5a615e+=','+_0x47ed42[_0xc823('0x77')];}var _0x2ec443=this['channel'][_0xc823('0x55')]('MRCPSynth',_0x5a615e);if(_0x2ec443[_0xc823('0xa8')]===-0x1){return _0x2ec443;}return this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0xa9'),_0x5a615e));};AGIVertices['prototype'][_0xc823('0xaa')]=function(_0x4ae0bd){logger['info'](util[_0xc823('0x2b')](_0xc823('0xab'),_0x4ae0bd[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x4ae0bd[_0xc823('0xac')])){return this[_0xc823('0xe')]['noop'](_0xc823('0xad'));}var _0x3832d5=_0x4ae0bd[_0xc823('0xac')];if(this[_0xc823('0x84')](_0x4ae0bd[_0xc823('0x77')])){_0x3832d5+=','+_0x4ae0bd[_0xc823('0x77')];}var _0x3ef0ff=this[_0xc823('0xe')][_0xc823('0x55')](_0xc823('0xae'),_0x3832d5);if(_0x3ef0ff[_0xc823('0xa8')]===-0x1){return _0x3ef0ff;}var _0x58a659=this[_0xc823('0xa2')]('RECOG_CONFIDENCE()',_0xc823('0xaf'));if(_0x58a659[_0xc823('0xa8')]===-0x1){return _0x58a659;}var _0x4e9763=this[_0xc823('0xa2')](_0xc823('0xb0'),_0xc823('0xb1'));if(_0x4e9763['result']===-0x1){return _0x4e9763;}var _0x55481b=this[_0xc823('0xa2')](_0xc823('0xb2'),_0xc823('0xb3'));if(_0x55481b['result']===-0x1){return _0x55481b;}return this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3832d5));};AGIVertices['prototype'][_0xc823('0x7')]=function(_0x33b4dc){logger[_0xc823('0x2f')](util['format'](_0xc823('0xb4'),_0x33b4dc[_0xc823('0x39')]));return this[_0xc823('0xe')]['agi']([_0x33b4dc[_0xc823('0xb5')],_0x33b4dc[_0xc823('0xb6')]]);};AGIVertices[_0xc823('0x14')][_0xc823('0xb7')]=function(_0x3ce7b1){logger[_0xc823('0x2f')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3ce7b1['label']));if(this[_0xc823('0x84')](_0x3ce7b1[_0xc823('0x64')])){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0xb8'),_0x3ce7b1[_0xc823('0x64')]));var _0x1315d6=this[_0xc823('0xe')][_0xc823('0xb9')](_0x3ce7b1[_0xc823('0x64')]);if(_0x1315d6[_0xc823('0xa8')]===-0x1){return _0x1315d6;}}return this['channel'][_0xc823('0xb7')]();};AGIVertices['prototype'][_0xc823('0x49')]=function(_0x115947){logger['info'](util[_0xc823('0x2b')](_0xc823('0xba'),_0x115947['label']));if(!this[_0xc823('0x84')](_0x115947[_0xc823('0x47')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x115947,_0xc823('0xbb'));}_0x115947[_0xc823('0x48')]=moment();if(this['isConfigured'](_0x115947[_0xc823('0xbc')])){_0x115947[_0xc823('0x48')]=moment()['add'](_0x115947['delay'],_0xc823('0xbd'));}if(!this[_0xc823('0x84')](_0x115947[_0xc823('0x4c')])){_0x115947[_0xc823('0x4c')]=0x2;}this[_0xc823('0xbe')][_0xc823('0x6e')](this,_0x115947);return this['channel'][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0xbf'),_0x115947['phone'],_0x115947[_0xc823('0x47')],_0x115947[_0xc823('0x48')]));};AGIVertices['prototype'][_0xc823('0xc0')]=function(_0x197a63){logger[_0xc823('0x2f')](util['format'](_0xc823('0xc1'),_0x197a63[_0xc823('0x39')]));var _0x564d2e=this[_0xc823('0xe')][_0xc823('0x55')](_0x197a63[_0xc823('0xc2')],_0x197a63[_0xc823('0x77')]);if(_0x564d2e['result']===-0x1){return _0x564d2e;}return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0xc3'),_0x197a63['application'],_0x197a63[_0xc823('0x77')]));};AGIVertices['prototype'][_0xc823('0xc4')]=function(_0x3a53f5){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0xc5'),_0x3a53f5[_0xc823('0x39')]));if(!this['isConfigured'](_0x3a53f5[_0xc823('0x5b')])){return this[_0xc823('0xe')]['noop'](_0xc823('0xa7'));}var _0x32e926='\x22'+_0x3a53f5[_0xc823('0x5b')]+'\x22';if(this['isConfigured'](_0x3a53f5[_0xc823('0x77')])){_0x32e926+=','+_0x3a53f5[_0xc823('0x77')];}var _0x2d1099=this['channel']['exec'](_0xc823('0xc6'),_0x32e926);if(_0x2d1099['result']===-0x1){return _0x2d1099;}return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x32e926));};AGIVertices['prototype'][_0xc823('0xc7')]=function(_0x5268cf){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0xc8'),_0x5268cf[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x5268cf[_0xc823('0x5b')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xa7'));}var _0x5dc2f3='\x22'+_0x5268cf[_0xc823('0x5b')]+'\x22';if(this[_0xc823('0x84')](_0x5268cf[_0xc823('0x77')])){_0x5dc2f3+=','+_0x5268cf['options'];}var _0x2c1162=this['channel'][_0xc823('0x55')](_0xc823('0xc6'),_0x5dc2f3);if(_0x2c1162[_0xc823('0xa8')]===-0x1){return _0x2c1162;}return this[_0xc823('0xe')][_0xc823('0xa6')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x5dc2f3));};AGIVertices[_0xc823('0x14')][_0xc823('0xc9')]=function(_0x4e371f){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0xca'),_0x4e371f[_0xc823('0x39')]));if(!this['isConfigured'](_0x4e371f[_0xc823('0xac')])){return this[_0xc823('0xe')]['noop'](_0xc823('0xad'));}var _0x1eb5d0=_0x4e371f[_0xc823('0xac')];if(this['isConfigured'](_0x4e371f['options'])){_0x1eb5d0+=','+_0x4e371f[_0xc823('0x77')];}var _0x780953=this['channel'][_0xc823('0x55')]('MRCPRecog',_0x1eb5d0);if(_0x780953[_0xc823('0xa8')]===-0x1){return _0x780953;}var _0xad9e9d=this[_0xc823('0xa2')](_0xc823('0xcb'),'LUMENVOX_ASR_CONFIDENCE');if(_0xad9e9d[_0xc823('0xa8')]===-0x1){return _0xad9e9d;}var _0x3e1483=this[_0xc823('0xa2')](_0xc823('0xb0'),_0xc823('0xcc'));if(_0x3e1483[_0xc823('0xa8')]===-0x1){return _0x3e1483;}var _0x237cb7=this[_0xc823('0xa2')](_0xc823('0xb2'),_0xc823('0xcd'));if(_0x237cb7[_0xc823('0xa8')]===-0x1){return _0x237cb7;}return this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1eb5d0));};AGIVertices[_0xc823('0x14')][_0xc823('0xce')]=function(_0x451f69){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x451f69['label']));if(!this[_0xc823('0x84')](_0x451f69[_0xc823('0xac')])){return this['channel'][_0xc823('0xa6')](_0xc823('0xad'));}var _0x31b0e5=_0x451f69[_0xc823('0xac')];if(this[_0xc823('0x84')](_0x451f69[_0xc823('0x77')])){_0x31b0e5+=','+_0x451f69[_0xc823('0x77')];}var _0x3bb9f6=this[_0xc823('0xe')]['exec'](_0xc823('0xae'),_0x31b0e5);if(_0x3bb9f6[_0xc823('0xa8')]===-0x1){return _0x3bb9f6;}var _0x13dc51=this['getAndSetVariable'](_0xc823('0xcb'),_0xc823('0xcf'));if(_0x13dc51[_0xc823('0xa8')]===-0x1){return _0x13dc51;}var _0xbd6ae6=this[_0xc823('0xa2')](_0xc823('0xb0'),_0xc823('0xd0'));if(_0xbd6ae6['result']===-0x1){return _0xbd6ae6;}var _0x23169a=this[_0xc823('0xa2')](_0xc823('0xb2'),_0xc823('0xd1'));if(_0x23169a['result']===-0x1){return _0x23169a;}return this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0xd2'),_0x31b0e5));};AGIVertices[_0xc823('0x14')]['database']=function(_0x4ae169){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0xd3'),_0x4ae169[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x4ae169[_0xc823('0xd4')])){return this[_0xc823('0xe')]['error'](_0x4ae169,_0xc823('0xd5'));}var _0x2b9990=this[_0xc823('0x19')][_0xc823('0x6e')](this,_0x4ae169[_0xc823('0xd4')]);if(!_0x2b9990){return this[_0xc823('0xe')][_0xc823('0x33')](_0x4ae169,_0xc823('0xd6'));}if(!this[_0xc823('0x84')](_0x4ae169[_0xc823('0x31')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x4ae169,_0xc823('0xd7'));}var _0x5f1dbd=_0x4ae169[_0xc823('0x31')][_0xc823('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0xd8'),_0x5f1dbd));var _0x143af7=this[_0xc823('0x2c')][_0xc823('0x6e')](this,_0x2b9990,_0x5f1dbd);this[_0xc823('0x37')][_0xc823('0x6e')](this,_0x4ae169,_0x5f1dbd);if(!this[_0xc823('0x84')](_0x4ae169[_0xc823('0xd9')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xda'));}var _0xbc1938=this['getVariable'][_0xc823('0x6e')](this,_0x4ae169[_0xc823('0xd9')]);if(!_0xbc1938){return this['channel'][_0xc823('0x33')](_0x4ae169,_0xc823('0xdb'));}var _0x22cfcb=this;_0x143af7['forEach'](function(_0x13f778,_0x3906e4){Object['keys'](_0x13f778)[_0xc823('0xdc')](function(_0x393c54){_0x22cfcb[_0xc823('0xe')][_0xc823('0xdd')](util['format'](_0xc823('0xde'),_0xbc1938,_0x3906e4,_0x393c54),_0x13f778[_0x393c54]);});});this[_0xc823('0xe')][_0xc823('0xdd')](util['format'](_0xc823('0xdf'),_0xbc1938),_0x143af7['length']);return this['channel'][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0xe0'),_0xbc1938));};AGIVertices[_0xc823('0x14')]['dial']=function(_0x26f630){logger[_0xc823('0xe1')](util[_0xc823('0x2b')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x26f630['label']));if(!this[_0xc823('0x84')](_0x26f630['sip_id'])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x26f630,_0xc823('0xe2'));}var _0x158bc0=this[_0xc823('0x1b')][_0xc823('0x6e')](this,_0x26f630[_0xc823('0xe3')]);if(!_0x158bc0){return this[_0xc823('0xe')][_0xc823('0x33')](_0x26f630,_0xc823('0xe4'));}var _0xc4e882=this['channel'][_0xc823('0x55')](_0xc823('0xe5'),[util[_0xc823('0x2b')](_0xc823('0xe6'),_0x158bc0),_0x26f630[_0xc823('0x64')],_0x26f630[_0xc823('0xe7')],_0x26f630[_0xc823('0x62')]]);if(_0xc4e882[_0xc823('0xa8')]===-0x1){return _0xc4e882;}return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0xe8'),_0xc823('0xe5')));};AGIVertices[_0xc823('0x14')][_0xc823('0xe9')]=function(_0x5244b8){logger['info'](util[_0xc823('0x2b')](_0xc823('0xea'),_0x5244b8['label']));if(!this[_0xc823('0x84')](_0x5244b8[_0xc823('0x79')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xeb'));}if(!this[_0xc823('0x84')](_0x5244b8['text'])){return this['channel'][_0xc823('0xa6')](_0xc823('0xa7'));}this[_0xc823('0xe')][_0xc823('0xec')]=!![];this[_0xc823('0x37')](_0x5244b8);this[_0xc823('0xed')](_0x5244b8[_0xc823('0x5b')],'in','','');this[_0xc823('0xe')][_0xc823('0xa6')](util['format'](_0xc823('0xee'),_0x5244b8['text']));var _0x441680=this[_0xc823('0x78')][_0xc823('0x6e')](this,_0x5244b8);if(_0x441680){for(var _0x403476 in _0x441680){if(_0x441680[_0xc823('0x95')](_0x403476)){this['channel'][_0xc823('0xdd')](util[_0xc823('0x2b')](_0xc823('0xef'),_0x403476[_0xc823('0xf0')]()),_0x441680[_0x403476]);}}this[_0xc823('0xed')](_0x441680[_0xc823('0xf1')],_0xc823('0xf2'),_0xc823('0xe9'),'');return this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')]('Dialogflow\x20Result\x20%s',_0x441680[_0xc823('0xf1')]));}return this[_0xc823('0xe')][_0xc823('0x33')](_0x5244b8,_0xc823('0xf3'));};AGIVertices[_0xc823('0x14')][_0xc823('0xf4')]=function(_0x36677e){logger['info'](util[_0xc823('0x2b')](_0xc823('0xf5'),_0x36677e[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x36677e[_0xc823('0x7c')])){return this[_0xc823('0xe')][_0xc823('0xa6')]('no\x20project_id\x20configured');}if(!this[_0xc823('0x84')](_0x36677e[_0xc823('0x7d')])){return this['channel'][_0xc823('0xa6')](_0xc823('0xf6'));}if(!this[_0xc823('0x84')](_0x36677e[_0xc823('0x7e')])){return this['channel'][_0xc823('0xa6')](_0xc823('0xf7'));}if(!this[_0xc823('0x84')](_0x36677e[_0xc823('0xf8')])){return this[_0xc823('0xe')]['noop'](_0xc823('0xf9'));}if(!this[_0xc823('0x84')](_0x36677e[_0xc823('0x5b')])){return this['channel']['noop'](_0xc823('0xa7'));}this[_0xc823('0xe')][_0xc823('0xec')]=!![];this[_0xc823('0x37')](_0x36677e);this[_0xc823('0xed')](_0x36677e[_0xc823('0x5b')],'in','','');this[_0xc823('0xe')][_0xc823('0xa6')](util['format'](_0xc823('0xfa'),_0x36677e[_0xc823('0x5b')]));var _0x895d38=this[_0xc823('0x7b')][_0xc823('0x6e')](this,_0x36677e);if(_0x895d38){for(var _0x94cb0d in _0x895d38){if(_0x895d38[_0xc823('0x95')](_0x94cb0d)){if(_0x94cb0d!==_0xc823('0xfb')){this[_0xc823('0xe')][_0xc823('0xdd')](util[_0xc823('0x2b')](_0xc823('0xef'),_0x94cb0d[_0xc823('0xf0')]()),_0x895d38[_0x94cb0d]);}}}this[_0xc823('0xed')](_0x895d38[_0xc823('0xf1')],_0xc823('0xf2'),_0xc823('0xf4'),_0x895d38[_0xc823('0xfb')]);return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0xfc'),_0x895d38['speech']));}return this['channel'][_0xc823('0x33')](_0x36677e,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xc823('0x14')]['sesteknda']=function(_0x17dd48){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x17dd48[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x17dd48['ndauth_url'])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xfd'));}if(!this[_0xc823('0x84')](_0x17dd48['username'])){return this['channel'][_0xc823('0xa6')]('no\x20username\x20configured');}if(!this[_0xc823('0x84')](_0x17dd48[_0xc823('0xfe')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xff'));}if(!this['isConfigured'](_0x17dd48['ndassistant_url'])){return this['channel'][_0xc823('0xa6')](_0xc823('0xa7'));}this['channel'][_0xc823('0xec')]=!![];this[_0xc823('0x37')](_0x17dd48);this['createSquareMessage'](_0x17dd48[_0xc823('0x5b')],'in','','');this['channel'][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x100'),_0x17dd48['text']));var _0x3efa12=this[_0xc823('0x7f')][_0xc823('0x6e')](this,_0x17dd48);if(_0x3efa12){for(var _0x55f7ae in _0x3efa12){if(_0x3efa12[_0xc823('0x95')](_0x55f7ae)){this[_0xc823('0xe')][_0xc823('0xdd')](util['format'](_0xc823('0x101'),_0x55f7ae[_0xc823('0xf0')]()),_0x3efa12[_0x55f7ae]);}}this[_0xc823('0xed')](_0x3efa12[_0xc823('0xf1')],'out',_0xc823('0x102'),'');if(_0x3efa12[_0xc823('0x103')]){this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0x104'),_0x3efa12['audiofile']));var _0xaa21d3=this[_0xc823('0xe')][_0xc823('0x105')](_0x3efa12[_0xc823('0x103')]);try{fs['unlink'](_0x3efa12['audiofile']+'.wav');}catch(_0xccace2){logger[_0xc823('0x33')](_0xccace2);}return _0xaa21d3;}else{return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x106'),_0x3efa12[_0xc823('0xf1')]));}}return this[_0xc823('0xe')]['error'](_0x17dd48,_0xc823('0x107'));};AGIVertices[_0xc823('0x14')][_0xc823('0x108')]=function(_0x380fe1){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x380fe1[_0xc823('0x39')]));return this['channel'][_0xc823('0xa6')]('end');};AGIVertices[_0xc823('0x14')][_0xc823('0x109')]=function(_0x1f1a02){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x1f1a02[_0xc823('0x39')]));var _0x18fa02='';if(_0x1f1a02[_0xc823('0x10a')]){if(!this[_0xc823('0x84')](_0x1f1a02[_0xc823('0x10a')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x1f1a02,'no\x20trunk\x20selected');}else{var _0x4816d8=parseInt(_0x1f1a02[_0xc823('0x10a')],0xa);if(isNaN(_0x4816d8)){_0x18fa02=_0x1f1a02[_0xc823('0x10a')];}else{_0x18fa02=this[_0xc823('0x1d')][_0xc823('0x6e')](this,_0x1f1a02[_0xc823('0x10a')]);if(!_0x18fa02){return this[_0xc823('0xe')][_0xc823('0x33')](_0x1f1a02,_0xc823('0x10b'));}}}}else if(_0x1f1a02[_0xc823('0x10c')]){_0x18fa02=_0x1f1a02[_0xc823('0x10c')];}else{return this[_0xc823('0xe')][_0xc823('0x33')](_0x1f1a02,'no\x20trunk\x20selected');}var _0x5dafa5=this['channel']['exec'](_0xc823('0xe5'),[util[_0xc823('0x2b')](_0xc823('0x10d'),_0x18fa02,_0x1f1a02['phone']),_0x1f1a02['timeout'],_0x1f1a02[_0xc823('0xe7')],_0x1f1a02[_0xc823('0x62')]]);if(_0x5dafa5[_0xc823('0xa8')]===-0x1){return _0x5dafa5;}return this['channel'][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0xe8'),'DIAL'));};AGIVertices[_0xc823('0x14')]['finally']=function(_0x539ac6){logger[_0xc823('0x2f')](util['format'](_0xc823('0x10e'),_0x539ac6[_0xc823('0x39')]));return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x10f'));};AGIVertices[_0xc823('0x14')][_0xc823('0x110')]=function(_0x128f3c){logger['info'](util[_0xc823('0x2b')](_0xc823('0x111'),_0x128f3c['label']));if(_0x128f3c[_0xc823('0xa4')]===0x0){return this[_0xc823('0xa3')](_0x128f3c);}_0x128f3c[_0xc823('0xa4')]-=0x1;if(!this[_0xc823('0x84')](_0x128f3c[_0xc823('0x112')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x128f3c,_0xc823('0x113'));}var _0x4e67e5=this[_0xc823('0x114')][_0xc823('0x6e')](this,_0x128f3c[_0xc823('0x112')]);if(!_0x4e67e5){return this[_0xc823('0xe')][_0xc823('0x33')](_0x128f3c,_0xc823('0x115'));}if(!this[_0xc823('0x84')](_0x128f3c[_0xc823('0xd9')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0xc823('0xda'));}var _0x2b01d8=this[_0xc823('0xe')][_0xc823('0x116')](_0x4e67e5,_0x128f3c[_0xc823('0x117')],_0x128f3c[_0xc823('0x118')]);var _0x55e449=_0x2b01d8[_0xc823('0xa8')]?_0x2b01d8[_0xc823('0xa8')]['toString']():'';logger['info'](_0xc823('0x119'),JSON[_0xc823('0x71')](_0x2b01d8));if(_0x2b01d8[_0xc823('0xa8')]===-0x1){this[_0xc823('0x37')][_0xc823('0x6e')](this,_0x128f3c,_0x55e449);return _0x2b01d8;}else if(_0x2b01d8[_0xc823('0xa1')]==='timeout'){_0x2b01d8[_0xc823('0xa8')]=_0x55e449[_0xc823('0x9b')]>=parseInt(_0x128f3c[_0xc823('0x11a')])?'x':'i';}else{_0x2b01d8['result']=_0x55e449[_0xc823('0x9b')]>=parseInt(_0x128f3c['mindigit'])&&_0x55e449[_0xc823('0x9b')]<=parseInt(_0x128f3c['maxdigit'])?'x':'i';}var _0x168dcf=this[_0xc823('0x10')][_0xc823('0x6e')](this,_0x128f3c[_0xc823('0xd9')]);if(!_0x168dcf){return this[_0xc823('0xe')][_0xc823('0x33')](_0x128f3c,_0xc823('0xdb'));}this[_0xc823('0xe')][_0xc823('0xdd')](_0x168dcf,_0x55e449);if(this[_0xc823('0x84')](_0x128f3c['hiddendigitsnum'])){var _0x4cb5b5=parseInt(_0x128f3c[_0xc823('0x11b')],0xa);var _0x2565cb=rs['generate']({'charset':'*','length':_0x4cb5b5});var _0x567c93=_0x55e449['length'];if(_0x567c93>0x0){if(_0x567c93>_0x4cb5b5){this['createSquareDetailsReport'][_0xc823('0x6e')](this,_0x128f3c,_0x128f3c[_0xc823('0x11c')]===_0xc823('0x11d')?_0x2565cb+_0x55e449['substr'](_0x4cb5b5):_0x55e449[_0xc823('0x11e')](0x0,_0x567c93-_0x4cb5b5)+_0x2565cb);}else{this[_0xc823('0x37')]['sync'](this,_0x128f3c,rs['generate']({'charset':'*','length':_0x567c93}));}}else{this[_0xc823('0x37')]['sync'](this,_0x128f3c,'');}}else{this[_0xc823('0x37')]['sync'](this,_0x128f3c,_0x55e449);}return _0x2b01d8;};AGIVertices[_0xc823('0x14')][_0xc823('0x11f')]=function(_0x1b473e){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x120'),_0x1b473e[_0xc823('0x39')]));return this[_0xc823('0x110')](_0x1b473e);};AGIVertices[_0xc823('0x14')]['goal']=function(_0x2e5e12){logger['info'](util[_0xc823('0x2b')](_0xc823('0x121'),_0x2e5e12[_0xc823('0x39')]));this[_0xc823('0x37')][_0xc823('0x6e')](this,_0x2e5e12,_0x2e5e12[_0xc823('0x122')]);return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')]('GOAL\x20%s',_0x2e5e12[_0xc823('0x122')]));};AGIVertices[_0xc823('0x14')][_0xc823('0x123')]=function(_0x17377f){logger[_0xc823('0x2f')](util['format'](_0xc823('0x124'),_0x17377f[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x17377f[_0xc823('0x8d')])||!this['isConfigured'](_0x17377f['aws_secret_access_key'])){return this[_0xc823('0xe')][_0xc823('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xc823('0x84')](_0x17377f[_0xc823('0x5b')])){return this['channel'][_0xc823('0xa6')](_0xc823('0xa7'));}this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x125'),_0x17377f[_0xc823('0x5b')]));var _0x17b052=this['awsPolly']['sync'](this,_0x17377f);if(_0x17b052){this[_0xc823('0xe')][_0xc823('0xa6')](util['format'](_0xc823('0x126'),_0x17b052));var _0x2007d4=this[_0xc823('0xe')][_0xc823('0x105')](_0x17b052);try{fs[_0xc823('0x127')](_0x17b052+_0xc823('0x128'));}catch(_0x42aa5f){logger['error'](_0x42aa5f);}return _0x2007d4;}return this[_0xc823('0xe')][_0xc823('0x33')](_0x17377f,_0xc823('0x129'));};AGIVertices[_0xc823('0x14')][_0xc823('0x12a')]=function(_0x243688){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x12b'),_0x243688['label']));if(!this[_0xc823('0x84')](_0x243688[_0xc823('0x8d')])||!this['isConfigured'](_0x243688['aws_secret_access_key'])){return this['channel']['noop'](_0xc823('0x12c'));}if(!this[_0xc823('0x84')](_0x243688['aws_bot_name'])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x12d'));}if(!this[_0xc823('0x84')](_0x243688[_0xc823('0x5b')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xa7'));}this[_0xc823('0xe')][_0xc823('0xec')]=!![];this[_0xc823('0x37')](_0x243688);this['createSquareMessage'](_0x243688[_0xc823('0x5b')],'in','','');this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x243688[_0xc823('0x5b')]));var _0x84a201=this['awsLex']['sync'](this,_0x243688);if(_0x84a201){for(var _0x2e3d55 in _0x84a201){if(_0x84a201[_0xc823('0x95')](_0x2e3d55)&&_[_0xc823('0x96')](_0x84a201[_0x2e3d55])){this[_0xc823('0xe')]['setVariable'](util[_0xc823('0x2b')](_0xc823('0x12e'),_0x2e3d55[_0xc823('0xf0')]()),_0x84a201[_0x2e3d55]);}}if(_[_0xc823('0x42')](_0x84a201['message'])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x12f'));}else{this['createSquareMessage'](_0x84a201[_0xc823('0x75')],_0xc823('0xf2'),_0xc823('0x130'),'');return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x131'),_0x84a201['message']));}}return this['channel'][_0xc823('0x33')](_0x243688,_0xc823('0x132'));};AGIVertices[_0xc823('0x14')]['googleasr']=function(_0x12355e){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x133'),_0x12355e[_0xc823('0x39')],_0x12355e[_0xc823('0x64')]));if(!this[_0xc823('0x84')](_0x12355e[_0xc823('0x79')])){return this[_0xc823('0xe')]['noop'](_0xc823('0xeb'));}var _0x4d3d0e=_0xc823('0x134');var _0x3ca1ef=util[_0xc823('0x2b')](_0xc823('0x135'),FILES_PATH,rs[_0xc823('0x136')](0x4));var _0x58ad23=util[_0xc823('0x2b')]('%s.%s',_0x3ca1ef,_0x4d3d0e);var _0x2eccd9=!![];if(_0x12355e[_0xc823('0x137')]==='NOBEEP'){_0x2eccd9=![];}var _0x38a564=this[_0xc823('0xe')][_0xc823('0x138')](_0x3ca1ef,_0x4d3d0e,_0x12355e[_0xc823('0x139')],_0x12355e['timeout'],undefined,_0x2eccd9);if(_0x38a564[_0xc823('0xa8')]!==-0x1){this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x13a'),_0x58ad23));var _0x4aaee9=this[_0xc823('0x90')][_0xc823('0x6e')](this,_0x12355e,_0x58ad23);if(_0x4aaee9){for(var _0x10f96e in _0x4aaee9){if(_0x4aaee9[_0xc823('0x95')](_0x10f96e)){this['channel']['setVariable'](util[_0xc823('0x2b')](_0xc823('0x13b'),_0x10f96e['toUpperCase']()),_0x4aaee9[_0x10f96e]);}}return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x13c'),JSON[_0xc823('0x71')](_0x4aaee9)));}}return _0x38a564;};AGIVertices[_0xc823('0x14')][_0xc823('0x13d')]=function(_0x26c1b2){logger['info'](util[_0xc823('0x2b')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x26c1b2[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x26c1b2['appid'])){return this['channel'][_0xc823('0xa6')](_0xc823('0x13e'));}if(!this[_0xc823('0x84')](_0x26c1b2[_0xc823('0x92')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x13f'));}var _0x52ecd1=_0xc823('0x134');var _0x1e54d3=util[_0xc823('0x2b')](_0xc823('0x135'),FILES_PATH,rs[_0xc823('0x136')](0x4));var _0x3a63cf=util[_0xc823('0x2b')](_0xc823('0x9e'),_0x1e54d3,_0x52ecd1);var _0x17af99=!![];if(_0x26c1b2[_0xc823('0x137')]===_0xc823('0x140')){_0x17af99=![];}var _0x75b287=this[_0xc823('0xe')][_0xc823('0x138')](_0x1e54d3,_0x52ecd1,_0x26c1b2[_0xc823('0x139')],_0x26c1b2[_0xc823('0x64')],undefined,_0x17af99);if(_0x75b287['result']!==-0x1){this[_0xc823('0xe')][_0xc823('0xa6')](util['format'](_0xc823('0x141'),_0x3a63cf));var _0x465b75=this[_0xc823('0x91')][_0xc823('0x6e')](this,_0x26c1b2,_0x3a63cf);if(_0x465b75){for(var _0x2721ca in _0x465b75){if(_0x465b75[_0xc823('0x95')](_0x2721ca)){this[_0xc823('0xe')][_0xc823('0xdd')](util[_0xc823('0x2b')](_0xc823('0x142'),_0x2721ca[_0xc823('0xf0')]()),_0x465b75[_0x2721ca]);}}return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x143'),JSON[_0xc823('0x71')](_0x465b75)));}}return _0x75b287;};AGIVertices[_0xc823('0x14')][_0xc823('0x144')]=function(_0x5cbe9a){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5cbe9a[_0xc823('0x39')]));return this[_0xc823('0xe')]['continueAt'](_0x5cbe9a[_0xc823('0x145')],_0x5cbe9a[_0xc823('0x3e')],_0x5cbe9a[_0xc823('0x146')]);};AGIVertices[_0xc823('0x14')][_0xc823('0x147')]=function(_0x410527){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x410527[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x410527[_0xc823('0x148')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x410527,'no\x20condition\x20configured');}try{var _0x1195a7=eval(_0x410527[_0xc823('0x148')])?_0xc823('0x149'):'false';this['channel'][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x14a'),_0x410527[_0xc823('0x148')],_0x1195a7));return{'code':0xc8,'result':_0x1195a7};}catch(_0x1776ec){return{'code':0xc8,'result':_0xc823('0x14b')};}};AGIVertices['prototype'][_0xc823('0x14c')]=function(_0x224fe5){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x224fe5[_0xc823('0x39')]));if(!this['isConfigured'](_0x224fe5['interval_id'])){return this['channel'][_0xc823('0x33')](_0x224fe5,_0xc823('0x14d'));}var _0x40bc38=this[_0xc823('0x25')][_0xc823('0x6e')](this,_0x224fe5[_0xc823('0x14e')]);if(!_0x40bc38){return this[_0xc823('0xe')][_0xc823('0x33')](_0x224fe5,_0xc823('0x14f'));}for(var _0x219f8c=0x0;_0x219f8c<_0x40bc38['length'];_0x219f8c+=0x1){var _0xb36105=this['channel'][_0xc823('0x10')](util['format'](_0xc823('0x150'),_0x40bc38[_0x219f8c]));if(_0xb36105['result']===-0x1){return _0xb36105;}logger['info'](util[_0xc823('0x2b')](_0xc823('0x151'),_0x40bc38[_0x219f8c],_0xb36105['extra']));if(_0xb36105[_0xc823('0xa1')]==='true'){logger[_0xc823('0x2f')](util['format'](_0xc823('0x151'),_0x40bc38[_0x219f8c],'true'));this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0x151'),_0x40bc38[_0x219f8c],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xc823('0x2b')](_0xc823('0x151'),_0x40bc38[_0x219f8c],_0xc823('0x14b')));this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x151'),_0x40bc38[_0x219f8c],_0xc823('0x14b')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xc823('0x14')][_0xc823('0x152')]=function(_0x49057e){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x49057e[_0xc823('0x39')]));return this[_0xc823('0xe')][_0xc823('0x152')]();};AGIVertices[_0xc823('0x14')][_0xc823('0x153')]=function(_0x27aa26){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x154'),_0x27aa26[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x27aa26['key'])){return this[_0xc823('0xe')]['noop'](_0xc823('0xeb'));}var _0x57cc57=_0xc823('0x134');var _0x382877=util['format'](_0xc823('0x135'),FILES_PATH,rs[_0xc823('0x136')](0x4));var _0x2924ed=util[_0xc823('0x2b')]('%s.%s',_0x382877,_0x57cc57);var _0x5538f2=!![];if(_0x27aa26[_0xc823('0x137')]==='NOBEEP'){_0x5538f2=![];}var _0x5e568f=this[_0xc823('0xe')]['recordFile'](_0x382877,_0x57cc57,_0x27aa26[_0xc823('0x139')],_0x27aa26['timeout'],undefined,_0x5538f2);if(_0x5e568f[_0xc823('0xa8')]!==-0x1){this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0x155'),_0x2924ed));var _0x2786fc=this[_0xc823('0x83')][_0xc823('0x6e')](this,_0x27aa26,_0x2924ed);if(_0x2786fc){for(var _0x4ba655 in _0x2786fc){if(_0x2786fc[_0xc823('0x95')](_0x4ba655)){this[_0xc823('0xe')][_0xc823('0xdd')](util[_0xc823('0x2b')](_0xc823('0x156'),_0x4ba655['toUpperCase']()),_0x2786fc[_0x4ba655]);}}return this['channel'][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x157'),JSON[_0xc823('0x71')](_0x2786fc)));}}return _0x5e568f;};AGIVertices[_0xc823('0x14')][_0xc823('0x158')]=function(_0x478fe7){logger[_0xc823('0x2f')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x478fe7[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x478fe7[_0xc823('0x79')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xeb'));}if(!this['isConfigured'](_0x478fe7['text'])){return this[_0xc823('0xe')]['noop']('no\x20text\x20configured');}this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x159'),_0x478fe7['text']));var _0x32db0d=this[_0xc823('0x80')][_0xc823('0x6e')](this,_0x478fe7);if(_0x32db0d){this['channel'][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x155'),_0x32db0d));var _0x4dc761=this[_0xc823('0xe')][_0xc823('0x105')](_0x32db0d,_0x478fe7[_0xc823('0x139')]);try{fs[_0xc823('0x127')](_0x32db0d+_0xc823('0x128'));}catch(_0x45a7df){logger[_0xc823('0x33')](_0x45a7df);}return _0x4dc761;}return this[_0xc823('0xe')][_0xc823('0x33')](_0x478fe7,_0xc823('0x15a'));};AGIVertices[_0xc823('0x14')]['login']=function(_0x88790c){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x88790c[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x88790c[_0xc823('0x15b')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x88790c,_0xc823('0x15c'));}logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x15d'),this[_0xc823('0xe')][_0xc823('0x3c')],_0x88790c[_0xc823('0x15b')]));var _0x53e750=this[_0xc823('0x52')][_0xc823('0x6e')](this,_0x88790c[_0xc823('0x15b')]);if(_0x53e750){logger['info'](util[_0xc823('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xc823('0x3c')],_0x88790c[_0xc823('0x15b')]));this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0x15e'),this[_0xc823('0xe')][_0xc823('0x3c')],_0x88790c['findBy']));return{'code':0xc8,'result':_0xc823('0x15f')};}else{logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x160'),this['channel'][_0xc823('0x3c')],_0x88790c['findBy']));this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xc823('0x3c')],_0x88790c[_0xc823('0x15b')]));return{'code':0xc8,'result':_0xc823('0x161')};}};AGIVertices[_0xc823('0x14')][_0xc823('0x162')]=function(_0x238ab5){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x163'),_0x238ab5[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x238ab5['findBy'])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x238ab5,_0xc823('0x15c'));}logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x15d'),this[_0xc823('0xe')]['callerid'],_0x238ab5['findBy']));var _0x55263f=this['agentLogout']['sync'](this,_0x238ab5[_0xc823('0x15b')]);if(_0x55263f){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc823('0xe')]['callerid'],_0x238ab5[_0xc823('0x15b')]));this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0x15e'),this[_0xc823('0xe')][_0xc823('0x3c')],_0x238ab5['findBy']));return{'code':0xc8,'result':_0xc823('0x15f')};}else{logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xc823('0x3c')],_0x238ab5['findBy']));this[_0xc823('0xe')][_0xc823('0xa6')](util['format'](_0xc823('0x160'),this[_0xc823('0xe')][_0xc823('0x3c')],_0x238ab5[_0xc823('0x15b')]));return{'code':0xc8,'result':_0xc823('0x161')};}};AGIVertices[_0xc823('0x14')][_0xc823('0x164')]=function(_0x371797){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x165'),_0x371797[_0xc823('0x39')]));if(!this['isConfigured'](_0x371797[_0xc823('0x166')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x371797,'no\x20operation\x20configured');}this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x167'),_0x371797[_0xc823('0x166')]));var _0x360c04=eval(_0x371797[_0xc823('0x166')]);if(!this[_0xc823('0x84')](_0x371797[_0xc823('0xd9')])){return this['channel'][_0xc823('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x16492e=this[_0xc823('0x10')][_0xc823('0x6e')](this,_0x371797[_0xc823('0xd9')]);if(!_0x16492e){return this[_0xc823('0xe')][_0xc823('0x33')](_0x371797,_0xc823('0xdb'));}if(_['isArray'](_0x360c04)){var _0x110279=this;_0x360c04['forEach'](function(_0x2243ff,_0x402fac){_0x110279['channel'][_0xc823('0xdd')](util[_0xc823('0x2b')](_0xc823('0x168'),_0x16492e,_0x402fac),_0x2243ff);});return this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0x169'),_0x16492e));}else{return this['channel'][_0xc823('0xdd')](_0x16492e,_0x360c04);}};AGIVertices[_0xc823('0x14')][_0xc823('0xd')]=function(_0x185c75){logger[_0xc823('0x2f')](util['format'](_0xc823('0x16a'),_0x185c75[_0xc823('0x39')]));if(_0x185c75['retry']===0x0){return this[_0xc823('0xa3')](_0x185c75);}_0x185c75[_0xc823('0xa4')]-=0x1;if(!this[_0xc823('0x84')](_0x185c75[_0xc823('0x112')])){return this['channel'][_0xc823('0x33')](_0x185c75,_0xc823('0x113'));}var _0x959dab=this['getSound'][_0xc823('0x6e')](this,_0x185c75[_0xc823('0x112')]);if(!_0x959dab){return this[_0xc823('0xe')]['error'](_0x185c75,_0xc823('0x115'));}var _0x1c79d3=this[_0xc823('0xe')]['getData'](_0x959dab,_0x185c75[_0xc823('0x117')],_0x185c75['digit']);var _0xa5c1f6=_0x1c79d3[_0xc823('0xa8')];if(_0x1c79d3[_0xc823('0xa8')]===-0x1){this[_0xc823('0x37')][_0xc823('0x6e')](this,_0x185c75,'-1');return _0x1c79d3;}else if(_0x1c79d3[_0xc823('0xa1')]===_0xc823('0x64')){_0x1c79d3[_0xc823('0xa8')]=_0x1c79d3[_0xc823('0xa8')][_0xc823('0x9b')]>0x0?_0x1c79d3['result']:'t';}else if(_['isEmpty'](_0x1c79d3[_0xc823('0xa8')])){_0x1c79d3['result']='#';_0xa5c1f6='#';}if(!this[_0xc823('0x84')](_0x185c75[_0xc823('0xd9')])){this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xda'));}else{var _0x454d42=this[_0xc823('0x10')]['sync'](this,_0x185c75[_0xc823('0xd9')]);if(!_0x454d42){return this[_0xc823('0xe')][_0xc823('0x33')](_0x185c75,_0xc823('0xdb'));}this[_0xc823('0xe')][_0xc823('0xdd')](_0x454d42,_0xa5c1f6);}this[_0xc823('0x37')][_0xc823('0x6e')](this,_0x185c75,_0xa5c1f6);return _0x1c79d3;};AGIVertices[_0xc823('0x14')][_0xc823('0xa6')]=function(_0xa142a6){logger['info'](util[_0xc823('0x2b')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xa142a6[_0xc823('0x39')]));return this[_0xc823('0xe')][_0xc823('0xa6')](_0xa142a6['output']||_0xa142a6[_0xc823('0x39')]);};AGIVertices['prototype'][_0xc823('0x16b')]=function(_0xead1d6){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x16c'),_0xead1d6['label']));if(!this[_0xc823('0x84')](_0xead1d6['findBy'])){return this[_0xc823('0xe')][_0xc823('0x33')](_0xead1d6,'no\x20find\x20by\x20configured');}logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xc823('0x3c')],_0xead1d6['findBy']));var _0x66bbf2=this[_0xc823('0x4d')]['sync'](this,_0xead1d6[_0xc823('0x16d')]);var _0x419ffc=this[_0xc823('0x4f')][_0xc823('0x6e')](this,_0xead1d6['findBy'],_0x66bbf2);if(_0x419ffc){logger['info'](util['format'](_0xc823('0x15e'),this[_0xc823('0xe')]['callerid'],_0xead1d6[_0xc823('0x15b')]));this[_0xc823('0xe')]['noop'](util['format'](_0xc823('0x15e'),this['channel']['callerid'],_0xead1d6[_0xc823('0x15b')]));return{'code':0xc8,'result':_0xc823('0x15f')};}else{logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x160'),this[_0xc823('0xe')]['callerid'],_0xead1d6[_0xc823('0x15b')]));this['channel'][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x15e'),this[_0xc823('0xe')][_0xc823('0x3c')],_0xead1d6[_0xc823('0x15b')]));return{'code':0xc8,'result':_0xc823('0x161')};}};AGIVertices['prototype'][_0xc823('0x16e')]=function(_0x58dadb){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x16f'),_0x58dadb[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x58dadb[_0xc823('0x112')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x58dadb,'no\x20file\x20audio\x20selected');}var _0x27fa4f=this['getSound']['sync'](this,_0x58dadb[_0xc823('0x112')]);if(!_0x27fa4f){return this[_0xc823('0xe')][_0xc823('0x33')](_0x58dadb,_0xc823('0x115'));}var _0x304a9d=this['channel'][_0xc823('0x55')](_0xc823('0x170'),[_0x27fa4f,_0x58dadb[_0xc823('0xe7')]]);if(_0x304a9d[_0xc823('0xa8')]===-0x1){return _0x304a9d;}return this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')](_0xc823('0xc3'),_0xc823('0x170'),_0x27fa4f));};AGIVertices['prototype'][_0xc823('0x171')]=function(_0x558e00){logger[_0xc823('0x2f')](util['format'](_0xc823('0x172'),_0x558e00[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x558e00[_0xc823('0x173')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x558e00,_0xc823('0x174'));}var _0x3b0981='';var _0xef05fa=parseInt(_0x558e00[_0xc823('0x173')],0xa);if(isNaN(_0xef05fa)){_0x3b0981=_0x558e00[_0xc823('0x173')];}else{_0x3b0981=this[_0xc823('0x15')]['sync'](this,_0x558e00['queue_id']);if(!_0x3b0981){return this['channel'][_0xc823('0x33')](_0x558e00,_0xc823('0x175'));}}var _0x5598c3='';if(this[_0xc823('0x84')](_0x558e00[_0xc823('0x112')])){var _0x5f4d25=this['getSound'][_0xc823('0x6e')](this,_0x558e00[_0xc823('0x112')]);if(_0x5f4d25){_0x5598c3=_0x5f4d25;}}this[_0xc823('0x37')]['sync'](this,_0x558e00,_0x3b0981);if(_0x558e00[_0xc823('0xe7')][_0xc823('0x176')]('x')<0x0){_0x558e00[_0xc823('0xe7')]+='x';}if(_0x558e00[_0xc823('0xe7')]['indexOf']('X')<0x0){_0x558e00[_0xc823('0xe7')]+='X';}this[_0xc823('0xe')][_0xc823('0xdd')](_0xc823('0x177'),_0x3b0981?_0x3b0981['toLowerCase']():'');var _0x5f57ff=this['channel'][_0xc823('0x55')](_0xc823('0x178'),[_0x3b0981,_0x558e00[_0xc823('0xe7')],_0x558e00[_0xc823('0x62')],_0x5598c3,_0x558e00[_0xc823('0x64')],_0x558e00[_0xc823('0x7')],_0x558e00[_0xc823('0x179')],_0x558e00[_0xc823('0x17a')],'',_0x558e00[_0xc823('0x17b')]]);if(_0x5f57ff['result']===-0x1){return _0x5f57ff;}return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0xc3'),_0xc823('0x178'),_0x3b0981));};AGIVertices[_0xc823('0x14')][_0xc823('0x17c')]=function(_0x7d4c06){logger['info'](util[_0xc823('0x2b')](_0xc823('0x17d'),_0x7d4c06[_0xc823('0x39')]));var _0x3ea614=_0x7d4c06[_0xc823('0x17e')]||_0xc823('0x134');var _0x6b5958=util['format'](_0xc823('0x17f'),this['channel'][_0xc823('0x38')],rs[_0xc823('0x136')](0x5));var _0x434ba0=util[_0xc823('0x2b')](_0xc823('0x180'),FILES_PATH,_0x6b5958,_0x3ea614);var _0x34a97d=util[_0xc823('0x2b')](_0xc823('0x135'),FILES_PATH,_0x6b5958);this[_0xc823('0x3d')][_0xc823('0x6e')](this,_0x7d4c06,_0x6b5958,_0x434ba0);this[_0xc823('0xe')][_0xc823('0xdd')](_0xc823('0x181'),_0x6b5958);logger[_0xc823('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x34a97d,_0x3ea614,_0x7d4c06[_0xc823('0x182')],_0x7d4c06[_0xc823('0x64')]);return this[_0xc823('0xe')][_0xc823('0x138')](_0x34a97d,_0x3ea614,_0x7d4c06['escape_digits'],_0x7d4c06[_0xc823('0x64')],undefined,!![]);};AGIVertices[_0xc823('0x14')][_0xc823('0x183')]=function(_0x3c4b47){logger['info'](util['format'](_0xc823('0x184'),_0x3c4b47[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x3c4b47['url'])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x185'));}var _0xca27d6=this['restAPI'][_0xc823('0x6e')](this,_0x3c4b47);logger['info'](util[_0xc823('0x2b')](_0xc823('0x186'),util[_0xc823('0x187')](_0xca27d6,{'showHidden':![],'depth':null})));if(!this[_0xc823('0x84')](_0x3c4b47['variable_id'])){return this['channel']['noop'](_0xc823('0x188'));}var _0x3ceeb5=this['getVariable'][_0xc823('0x6e')](this,_0x3c4b47[_0xc823('0xd9')]);if(!_0x3ceeb5){return this[_0xc823('0xe')][_0xc823('0x33')](_0x3c4b47,_0xc823('0xdb'));}this['channel'][_0xc823('0xdd')](util[_0xc823('0x2b')](_0xc823('0x189'),_0x3ceeb5),_0xca27d6[_0xc823('0x73')]?_0xca27d6[_0xc823('0x73')]:'200');this[_0xc823('0xe')][_0xc823('0xdd')](util[_0xc823('0x2b')](_0xc823('0x18a'),_0x3ceeb5),_0xca27d6[_0xc823('0x74')]?_0xca27d6[_0xc823('0x74')]:'OK');if(_0xca27d6[_0xc823('0x68')]){try{this[_0xc823('0x9d')](_0xca27d6[_0xc823('0x68')],_0x3ceeb5);}catch(_0x5864d){logger['error'](util[_0xc823('0x2b')](_0xc823('0x18b'),_0x3ceeb5));}}return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')]('variable\x20%s\x20set',_0x3ceeb5));};AGIVertices[_0xc823('0x14')][_0xc823('0x18c')]=function(_0x5f130a){logger['info'](util['format'](_0xc823('0x18d'),_0x5f130a[_0xc823('0x39')]));return this[_0xc823('0xe')]['sayDigits'](_0x5f130a[_0xc823('0x18e')][_0xc823('0x57')](/\s+/g,''),_0x5f130a[_0xc823('0x182')]);};AGIVertices[_0xc823('0x14')]['saynumber']=function(_0x1af9ac){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x18f'),_0x1af9ac[_0xc823('0x39')]));return this[_0xc823('0xe')][_0xc823('0x190')](_0x1af9ac[_0xc823('0x191')][_0xc823('0x57')](/\s+/g,''),_0x1af9ac['escape_digits']);};AGIVertices[_0xc823('0x14')][_0xc823('0x192')]=function(_0x491bef){logger['info'](util[_0xc823('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x491bef['label']));return this[_0xc823('0xe')][_0xc823('0x193')](_0x491bef[_0xc823('0x5b')],_0x491bef[_0xc823('0x182')]);};AGIVertices[_0xc823('0x14')][_0xc823('0x194')]=function(_0x434b3d){logger['info'](util[_0xc823('0x2b')](_0xc823('0x195'),_0x434b3d[_0xc823('0x39')]));if(!this['isConfigured'](_0x434b3d[_0xc823('0x196')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x197'));}var _0x5ba1b1=this[_0xc823('0x22')][_0xc823('0x6e')](this,_0x434b3d[_0xc823('0x196')]);if(!_0x5ba1b1||!_0x5ba1b1[_0xc823('0x198')]){return this[_0xc823('0xe')][_0xc823('0x33')](_0x434b3d,'no\x20mail\x20account\x20found');}var _0x1586e9={'from':util['format'](_0xc823('0x199'),_0x5ba1b1[_0xc823('0x12')],_0x5ba1b1[_0xc823('0x19a')]||_0x5ba1b1[_0xc823('0x198')][_0xc823('0x19b')]),'to':_0x434b3d['to']||'','cc':_0x434b3d['cc']||'','bcc':_0x434b3d[_0xc823('0x19c')]||'','subject':_0x434b3d[_0xc823('0x19d')],'html':_0x434b3d[_0xc823('0x5b')],'text':_0x434b3d[_0xc823('0x5b')]};if(this[_0xc823('0x84')](_0x434b3d['template_id'])){}logger['debug'](_0xc823('0x19e'),JSON[_0xc823('0x71')](_0x1586e9));this['createSquareDetailsReport'][_0xc823('0x6e')](this,_0x434b3d,_0x434b3d['account_id']);this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x19f'),_0x5ba1b1[_0xc823('0x12')]));this[_0xc823('0x24')]['sync'](this,_0x5ba1b1['smtpOptions'],_0x1586e9);return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x1a0'));};AGIVertices[_0xc823('0x14')][_0xc823('0x1a1')]=function(_0x303f66){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x303f66[_0xc823('0x39')]));return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x1a2'));};AGIVertices[_0xc823('0x14')][_0xc823('0x1a3')]=function(_0x1caad3){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x1a4'),_0x1caad3[_0xc823('0x39')]));if(!this['isConfigured'](_0x1caad3[_0xc823('0x1a5')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x1a6'));}var _0x5dbfd0=this[_0xc823('0x1a7')][_0xc823('0x6e')](this,_0x1caad3[_0xc823('0x1a5')]);if(!_0x5dbfd0){return this[_0xc823('0xe')]['error'](_0x1caad3,'no\x20sms\x20account\x20found');}var _0x988dff={'body':_0x1caad3[_0xc823('0x1a8')],'phone':_0x1caad3['to']||'','SmsAccountId':_0x5dbfd0['id']};logger[_0xc823('0xe1')](_0xc823('0x1a9'),JSON[_0xc823('0x71')](_0x988dff));this['createSquareDetailsReport'][_0xc823('0x6e')](this,_0x1caad3,_0x1caad3[_0xc823('0x1a5')]);this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5dbfd0[_0xc823('0x12')]));this[_0xc823('0x36')]['sync'](this,_0x988dff);return this[_0xc823('0xe')]['noop'](_0xc823('0x1aa'));};AGIVertices[_0xc823('0x14')][_0xc823('0x1ab')]=function(_0x3fa684){logger['info'](util[_0xc823('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x3fa684[_0xc823('0x39')]));if(!this[_0xc823('0x84')](_0x3fa684[_0xc823('0xd9')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x3fa684,'no\x20variable\x20selected');}var _0x3723f5=this[_0xc823('0x10')]['sync'](this,_0x3fa684[_0xc823('0xd9')]);if(!_0x3723f5){return this[_0xc823('0xe')][_0xc823('0x33')](_0x3fa684,'no\x20variable\x20found');}return this['channel'][_0xc823('0xdd')](_0x3723f5,_0x3fa684[_0xc823('0x1ac')]);};AGIVertices[_0xc823('0x14')][_0xc823('0x1ad')]=function(_0x454bf6){logger['info'](util[_0xc823('0x2b')](_0xc823('0x1ae'),_0x454bf6[_0xc823('0x39')]));this[_0xc823('0xe')][_0xc823('0xa6')]('START\x20CALLY\x20SQUARE');if(_0x454bf6[_0xc823('0xb7')]===_0xc823('0x1af')){this['channel']['noop']('Answer');return this['channel']['answer']();}return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0x1b0'));};AGIVertices[_0xc823('0x14')][_0xc823('0x1b1')]=function(_0x295e84){logger[_0xc823('0x2f')](util['format'](_0xc823('0x1b2'),_0x295e84[_0xc823('0x39')]));if(!this['isConfigured'](_0x295e84[_0xc823('0x1b3')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x295e84,_0xc823('0x1b4'));}var _0x20a987=this[_0xc823('0x1b5')][_0xc823('0x6e')](this,_0x295e84[_0xc823('0x1b3')]);if(!this['isConfigured'](_0x20a987)){return this[_0xc823('0xe')][_0xc823('0x33')](_0x295e84,util['format'](_0xc823('0x1b6'),_0x295e84[_0xc823('0x1b3')]));}if(_0x20a987===this[_0xc823('0xe')][_0xc823('0x3b')]){return this[_0xc823('0xe')][_0xc823('0x33')](_0x295e84,_0xc823('0x1b7'));}this[_0xc823('0x37')][_0xc823('0x6e')](this,_0x295e84,_0x20a987);var _0x129bc6=this[_0xc823('0xe')][_0xc823('0x55')](_0xc823('0x1b8'),util[_0xc823('0x2b')](_0xc823('0x1b9'),config['agi'][_0xc823('0x1ba')]||'127.0.0.1',_0x20a987,this[_0xc823('0xe')][_0xc823('0x3b')]));if(_0x129bc6[_0xc823('0xa8')]===-0x1){return _0x129bc6;}return this[_0xc823('0xe')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xc823('0x1b8'),_0x20a987));};AGIVertices[_0xc823('0x14')]['system']=function(_0x548ffd){logger[_0xc823('0x2f')](util['format'](_0xc823('0x1bb'),_0x548ffd['label']));var _0x2e3c44=this[_0xc823('0x54')][_0xc823('0x6e')](this,_0x548ffd[_0xc823('0xb5')]);this['createSquareDetailsReport']['sync'](this,_0x548ffd,_0x548ffd[_0xc823('0xb5')]);if(this[_0xc823('0x84')](_0x548ffd[_0xc823('0xd9')])){var _0xca1a22=this[_0xc823('0x10')]['sync'](this,_0x548ffd[_0xc823('0xd9')]);if(_0xca1a22){this[_0xc823('0xe')][_0xc823('0xdd')](_0xca1a22,_0x2e3c44);return this[_0xc823('0xe')]['noop'](util[_0xc823('0x2b')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x548ffd[_0xc823('0xb5')],_0xca1a22));}}return this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x1bc'),_0x548ffd[_0xc823('0xb5')]));};AGIVertices[_0xc823('0x14')][_0xc823('0x1bd')]=function(_0x23ca34){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x1be'),_0x23ca34[_0xc823('0x39')]));_0x23ca34[_0xc823('0x5b')]=_0x23ca34['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc823('0x84')](_0x23ca34['apiKey'])){return this['channel'][_0xc823('0xa6')](_0xc823('0x1bf'));}if(!this[_0xc823('0x84')](_0x23ca34[_0xc823('0x5b')])){return this['channel'][_0xc823('0xa6')](_0xc823('0xa7'));}this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x23ca34[_0xc823('0x5b')]));var _0x109a4c=this[_0xc823('0x58')][_0xc823('0x6e')](this,_0x23ca34);if(_0x109a4c){this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x1c0'),_0x109a4c));var _0x225fd5=this[_0xc823('0xe')][_0xc823('0x105')](_0x109a4c);try{fs[_0xc823('0x127')](_0x109a4c+'.wav');}catch(_0xd12c14){logger['error'](_0xd12c14);}return _0x225fd5;}return this['channel']['error'](_0x23ca34,_0xc823('0x1c1'));};AGIVertices[_0xc823('0x14')][_0xc823('0x1c2')]=function(_0x1973fe){logger[_0xc823('0x2f')](util[_0xc823('0x2b')](_0xc823('0x1c3'),_0x1973fe['label']));_0x1973fe[_0xc823('0x5b')]=_0x1973fe[_0xc823('0x5b')][_0xc823('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc823('0x84')](_0x1973fe[_0xc823('0x5b')])){return this[_0xc823('0xe')][_0xc823('0xa6')](_0xc823('0xa7'));}this['channel'][_0xc823('0xa6')](util['format'](_0xc823('0x1c4'),_0x1973fe[_0xc823('0x5b')]));var _0x588d89=this[_0xc823('0x5f')][_0xc823('0x6e')](this,_0x1973fe);if(_0x588d89){this[_0xc823('0xe')]['noop'](util['format'](_0xc823('0x1c5'),_0x588d89));var _0x53b8b3=this[_0xc823('0xe')][_0xc823('0x105')](_0x588d89);try{fs[_0xc823('0x127')](_0x588d89+_0xc823('0x128'));}catch(_0x194fab){logger[_0xc823('0x33')](_0x194fab);}return _0x53b8b3;}return this[_0xc823('0xe')][_0xc823('0x33')](_0x1973fe,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc823('0x14')][_0xc823('0x1c6')]=function(_0x5987ea){logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x5987ea['label']));if(!this[_0xc823('0x84')](_0x5987ea[_0xc823('0x15b')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x5987ea,_0xc823('0x15c'));}logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc823('0xe')][_0xc823('0x3c')],_0x5987ea[_0xc823('0x15b')]));var _0x279934=this[_0xc823('0x1c7')][_0xc823('0x6e')](this,_0x5987ea['findBy']);if(_0x279934){logger[_0xc823('0x2f')](util['format'](_0xc823('0x15e'),this[_0xc823('0xe')]['callerid'],_0x5987ea[_0xc823('0x15b')]));this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc823('0xe')][_0xc823('0x3c')],_0x5987ea[_0xc823('0x15b')]));return{'code':0xc8,'result':_0xc823('0x15f')};}else{logger[_0xc823('0x2f')](util[_0xc823('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc823('0xe')]['callerid'],_0x5987ea[_0xc823('0x15b')]));this[_0xc823('0xe')][_0xc823('0xa6')](util[_0xc823('0x2b')](_0xc823('0x160'),this[_0xc823('0xe')][_0xc823('0x3c')],_0x5987ea['findBy']));return{'code':0xc8,'result':_0xc823('0x161')};}};AGIVertices[_0xc823('0x14')][_0xc823('0x1c8')]=function(_0x180e82){logger[_0xc823('0x2f')](util['format'](_0xc823('0x1c9'),_0x180e82['label']));var _0x63178d=this[_0xc823('0xe')][_0xc823('0x55')](_0xc823('0x1ca'),[_0x180e82[_0xc823('0x1cb')],_0x180e82[_0xc823('0x77')]]);if(_0x63178d['result']===-0x1){return _0x63178d;}return this['channel']['noop'](util[_0xc823('0x2b')](_0xc823('0xc3'),'VOICEMAIL',_0x180e82['mailbox']));};AGIVertices[_0xc823('0x14')]['vswitch']=function(_0x14ffdd){logger['info'](util['format'](_0xc823('0x1cc'),_0x14ffdd['label']));if(!this[_0xc823('0x84')](_0x14ffdd[_0xc823('0xd9')])){return this[_0xc823('0xe')][_0xc823('0x33')](_0x14ffdd,_0xc823('0x1cd'));}var _0x1e4959=this['getVariable'][_0xc823('0x6e')](this,_0x14ffdd[_0xc823('0xd9')]);if(!_0x1e4959){return this[_0xc823('0xe')][_0xc823('0x33')](_0x14ffdd,_0xc823('0xdb'));}var _0x2cf6cd=this[_0xc823('0xe')][_0xc823('0x10')](_0x1e4959);return{'code':0xc8,'result':_0x2cf6cd[_0xc823('0xa1')]?_0x2cf6cd[_0xc823('0xa1')]:'-'};};String[_0xc823('0x14')][_0xc823('0xa0')]=function(_0x112214,_0x351a5e){return this[_0xc823('0x9f')](_0x112214)[_0xc823('0x1ce')](_0x351a5e);};module[_0xc823('0x1cf')]=AGIVertices; \ No newline at end of file +var _0x4c71=['%s.%s','setVariable','replaceObjectAllVariables','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','exec','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','toUpperCase','out','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','ndassistant_url','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','extension','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','sayphonetic','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','unlink','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','lodash','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','getVariable','getVariableById','then','catch','prototype','getVoiceQueue','getSquareProject','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agent','agentPause','error','agentUnpause','agentLogout','%s/%s@from-sip/n','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','google_tts_language','method','timeout','number','includes','POST','PUT','headers','parse','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','body','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult'];(function(_0x1c3fef,_0x4aba65){var _0xefba55=function(_0x467b84){while(--_0x467b84){_0x1c3fef['push'](_0x1c3fef['shift']());}};_0xefba55(++_0x4aba65);}(_0x4c71,0x12b));var _0x14c7=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4c71[_0x1928c9];return _0x51b5fb;};'use strict';var fs=require('fs');var util=require(_0x14c7('0x0'));var _=require(_0x14c7('0x1'));var sh=require('shelljs');var odbc=require(_0x14c7('0x2'))();var rs=require(_0x14c7('0x3'));var moment=require(_0x14c7('0x4'));var Mustache=require(_0x14c7('0x5'));var rp=require(_0x14c7('0x6'));var logger=require('../../config/logger')(_0x14c7('0x7'));var config=require(_0x14c7('0x8'));var shared=require(_0x14c7('0x9'));var scripts=require(_0x14c7('0xa'));var FILES_PATH=_0x14c7('0xb');var recursiveMapAttributes=['rawHeaders',_0x14c7('0xc')];var verticesWithRetry=[_0x14c7('0xd'),_0x14c7('0xe'),_0x14c7('0xf')];var AGIVertices=function(_0x2f19cc,_0x542adc,_0x350ef8){this['channel']=_0x2f19cc;this[_0x14c7('0x10')]=_0x542adc;this[_0x14c7('0x11')]=_0x350ef8;};AGIVertices['prototype'][_0x14c7('0x12')]=function(_0x47077e,_0x30aa3b){this[_0x14c7('0x10')][_0x14c7('0x13')](_0x47077e)[_0x14c7('0x14')](function(_0x53f5fa){_0x30aa3b(null,_0x53f5fa?_0x53f5fa['name']:![]);})[_0x14c7('0x15')](function(_0x651044){_0x30aa3b(_0x651044);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x17')]=function(_0x1199a1,_0x3e779f){this['rpc']['getVoiceQueueById'](_0x1199a1)[_0x14c7('0x14')](function(_0x34b078){_0x3e779f(null,_0x34b078?_0x34b078['name']:![]);})[_0x14c7('0x15')](function(_0x39c742){_0x3e779f(_0x39c742);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x18')]=function(_0x17e459,_0x2c8c03){this[_0x14c7('0x10')]['getSquareProjectById'](_0x17e459)[_0x14c7('0x14')](function(_0x76ee68){_0x2c8c03(null,_0x76ee68?_0x76ee68[_0x14c7('0x19')]:![]);})[_0x14c7('0x15')](function(_0x57d383){_0x2c8c03(_0x57d383);});};AGIVertices['prototype'][_0x14c7('0x1a')]=function(_0x3c6ab5,_0x44a561){this['rpc'][_0x14c7('0x1b')](_0x3c6ab5)[_0x14c7('0x14')](function(_0x2622b5){_0x44a561(null,_0x2622b5?_0x2622b5[_0x14c7('0x1c')]:![]);})['catch'](function(_0x5e1df1){_0x44a561(_0x5e1df1);});};AGIVertices['prototype'][_0x14c7('0x1d')]=function(_0x4944ad,_0x5be2e5){this[_0x14c7('0x10')][_0x14c7('0x1e')](_0x4944ad)[_0x14c7('0x14')](function(_0x1c914b){_0x5be2e5(null,_0x1c914b?_0x1c914b[_0x14c7('0x19')]:![]);})['catch'](function(_0x5d0f51){_0x5be2e5(_0x5d0f51);});};AGIVertices['prototype'][_0x14c7('0x1f')]=function(_0x1f24b4,_0x3ffc41){this[_0x14c7('0x10')][_0x14c7('0x20')](_0x1f24b4)[_0x14c7('0x14')](function(_0xb50129){_0x3ffc41(null,_0xb50129?_0xb50129['name']:![]);})[_0x14c7('0x15')](function(_0x21be43){_0x3ffc41(_0x21be43);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x21')]=function(_0x3b4344,_0x5a48e9){var _0x3dc18d=this;this[_0x14c7('0x10')][_0x14c7('0x22')](_0x3b4344)['then'](function(_0x576de4){_0x5a48e9(null,_0x576de4?_0x3dc18d['getSoundPath'](_0x576de4['save_name']):![]);})['catch'](function(_0x21656e){_0x5a48e9(_0x21656e);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x23')]=function(_0x2123b8,_0x58e5e7){this['rpc']['getMailAccountById'](_0x2123b8)[_0x14c7('0x14')](function(_0x235ee8){_0x58e5e7(null,_0x235ee8?_0x235ee8:![]);})[_0x14c7('0x15')](function(_0x8f1224){_0x58e5e7(_0x8f1224);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x24')]=function(_0x5a7f43,_0x14c55c,_0x2500f2){this[_0x14c7('0x11')]['sendMailMessage'](_0x5a7f43,_0x14c55c)['then'](function(){_0x2500f2(null);})[_0x14c7('0x15')](function(_0x286a65){_0x2500f2(_0x286a65);});};AGIVertices['prototype'][_0x14c7('0x25')]=function(_0x5957f4,_0xdfa924){this[_0x14c7('0x10')][_0x14c7('0x26')](_0x5957f4)[_0x14c7('0x14')](function(_0x19c8ba){if(_0x19c8ba){if(_0x19c8ba['IntervalId']){_0xdfa924(null,[_0x19c8ba[_0x14c7('0x27')]]);}else{_0xdfa924(null,_[_0x14c7('0x28')](_0x19c8ba[_0x14c7('0x29')],'interval'));}}else{_0xdfa924(null,![]);}})['catch'](function(_0x48d724){_0xdfa924(_0x48d724);});};AGIVertices[_0x14c7('0x16')]['getSoundPath']=function(_0x21caef){return util[_0x14c7('0x2a')](_0x14c7('0x2b'),FILES_PATH,_0x21caef);};AGIVertices[_0x14c7('0x16')]['getQueryOdbc']=function(_0x24252b,_0x330f41,_0x441d27){odbc[_0x14c7('0x2c')](_0x24252b,function(_0x5993c8){if(_0x5993c8){logger['error'](_0x14c7('0x2d'),_0x5993c8);_0x441d27(_0x5993c8);}else{logger[_0x14c7('0x2e')](_0x14c7('0x2f'));odbc[_0x14c7('0x30')](_0x330f41,function(_0x180275,_0x1d95f7){if(_0x180275){logger[_0x14c7('0x2e')]('Error\x20executing\x20query\x20%s',_0x330f41);_0x441d27(_0x180275);}else{logger[_0x14c7('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x330f41);odbc['close'](function(_0x3e43f8){if(_0x3e43f8){logger['error'](_0x14c7('0x31'),_0x3e43f8);}_0x441d27(null,_0x1d95f7);});}});}});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x32')]=function(_0x3224bc,_0x2226d2){this[_0x14c7('0x10')]['getSmsAccountById'](_0x3224bc)[_0x14c7('0x14')](function(_0x2690a6){_0x2226d2(null,_0x2690a6?_0x2690a6:![]);})[_0x14c7('0x15')](function(_0xce0c81){_0x2226d2(_0xce0c81);});};AGIVertices['prototype'][_0x14c7('0x33')]=function(_0x190b75,_0x128956){this['rpc'][_0x14c7('0x33')](_0x190b75)[_0x14c7('0x14')](function(_0x349729){_0x128956(null,_0x349729);})[_0x14c7('0x15')](function(_0x4a31e8){_0x128956(_0x4a31e8);});};AGIVertices[_0x14c7('0x16')]['createSquareDetailsReport']=function(_0x5246d6,_0x961bdf,_0x4e7320){this[_0x14c7('0x10')][_0x14c7('0x34')]({'uniqueid':this[_0x14c7('0x35')][_0x14c7('0x36')],'node':_0x5246d6[_0x14c7('0x37')],'application':_0x5246d6['agicommand'],'data':_0x961bdf||null,'project_name':this['channel'][_0x14c7('0x38')],'callerid':this[_0x14c7('0x35')][_0x14c7('0x39')]})[_0x14c7('0x14')](function(_0x1ece65){if(_0x4e7320){_0x4e7320(null,_0x1ece65);}})[_0x14c7('0x15')](function(_0xd0ac25){if(_0x4e7320){_0x4e7320(_0xd0ac25);}});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x3a')]=function(_0x576014,_0x3338ec,_0x4c0098,_0x2d0e17){this[_0x14c7('0x10')][_0x14c7('0x3a')]({'uniqueid':this[_0x14c7('0x35')][_0x14c7('0x36')],'callerid':this['channel']['callerid'],'calleridname':this['channel'][_0x14c7('0x3b')],'context':this['channel'][_0x14c7('0x3c')],'extension':this[_0x14c7('0x35')]['extension'],'priority':this[_0x14c7('0x35')][_0x14c7('0x3d')],'accountcode':this[_0x14c7('0x35')][_0x14c7('0x3e')],'dnid':this['channel'][_0x14c7('0x3f')],'projectName':this[_0x14c7('0x35')][_0x14c7('0x38')],'saveName':_0x3338ec,'filename':_0x576014[_0x14c7('0x40')]||_0x3338ec,'savePath':_0x4c0098})[_0x14c7('0x14')](function(_0x13c2dc){_0x2d0e17(null,_0x13c2dc);})['catch'](function(_0x439780){_0x2d0e17(_0x439780);});};AGIVertices[_0x14c7('0x16')]['createSquareMessage']=function(_0x2e3227,_0x459517,_0xe9da42,_0xa0accb,_0x1c41e0){this[_0x14c7('0x10')][_0x14c7('0x41')]({'uniqueid':this[_0x14c7('0x35')]['uniqueid'],'body':_0x2e3227,'direction':_0x459517,'providerName':_0xe9da42,'providerResponse':_0xa0accb})[_0x14c7('0x14')](function(_0x12762c){if(_0x1c41e0){_0x1c41e0(null,_0x12762c);}})[_0x14c7('0x15')](function(_0x2903d2){if(_0x1c41e0){_0x1c41e0(_0x2903d2);}});};AGIVertices[_0x14c7('0x16')]['createCmContact']=function(_0x5c84ef,_0x101be){this['rpc'][_0x14c7('0x42')]({'firstName':_['isEmpty'](_0x5c84ef['name'])||_[_0x14c7('0x43')](_0x5c84ef[_0x14c7('0x19')])?'callback_'+Math[_0x14c7('0x44')]():_0x5c84ef[_0x14c7('0x19')],'lastName':_[_0x14c7('0x45')](_0x5c84ef[_0x14c7('0x46')])||_[_0x14c7('0x43')](_0x5c84ef[_0x14c7('0x46')])?null:_0x5c84ef['lastName'],'phone':_0x5c84ef['phone'],'ListId':_0x5c84ef[_0x14c7('0x47')],'scheduledat':_0x5c84ef[_0x14c7('0x48')],'callbackUniqueid':this[_0x14c7('0x35')][_0x14c7('0x36')],'tags':'callback','description':_0x14c7('0x49')+_0x5c84ef[_0x14c7('0x48')][_0x14c7('0x4a')](),'priority':_0x5c84ef[_0x14c7('0x4b')]})['then'](function(_0xebd4b9){_0x101be(null,_0xebd4b9);})['catch'](function(_0x284fc9){_0x101be(_0x284fc9);});};AGIVertices[_0x14c7('0x16')]['getPause']=function(_0x5e5a87,_0x3d2194){this[_0x14c7('0x10')][_0x14c7('0x4c')](_0x5e5a87)[_0x14c7('0x14')](function(_0x17f2ad){_0x3d2194(null,_0x17f2ad?_0x17f2ad['name']:![]);})[_0x14c7('0x15')](function(_0x5d2f75){_0x3d2194(_0x5d2f75);});};AGIVertices['prototype']['agentPause']=function(_0x35d996,_0x574f1d,_0x59d81f){var _0x5158fc={'role':_0x14c7('0x4d')};_0x5158fc[_0x35d996]=this[_0x14c7('0x35')]['callerid'];this['rpc'][_0x14c7('0x4e')](_0x5158fc,_0x574f1d,this[_0x14c7('0x35')][_0x14c7('0x36')])[_0x14c7('0x14')](function(_0x28d673){_0x59d81f(null,_[_0x14c7('0x43')](_0x28d673)?![]:!![]);})['catch'](function(_0x1b58b7){logger[_0x14c7('0x4f')](_0x1b58b7);_0x59d81f(null,![]);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x50')]=function(_0x263276,_0x43303f){var _0x369e5e={'role':_0x14c7('0x4d')};_0x369e5e[_0x263276]=this[_0x14c7('0x35')]['callerid'];this[_0x14c7('0x10')][_0x14c7('0x50')](_0x369e5e)[_0x14c7('0x14')](function(_0x29fc3c){_0x43303f(null,_[_0x14c7('0x43')](_0x29fc3c)?![]:!![]);})[_0x14c7('0x15')](function(_0x1e6152){logger['error'](_0x1e6152);_0x43303f(null,![]);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x51')]=function(_0x2de9bf,_0x3fe7f3){var _0x3b552b={'role':'agent'};_0x3b552b[_0x2de9bf]=this[_0x14c7('0x35')][_0x14c7('0x39')];this['rpc'][_0x14c7('0x51')](_0x3b552b)[_0x14c7('0x14')](function(_0x52fb08){_0x3fe7f3(null,_[_0x14c7('0x43')](_0x52fb08)?![]:!![]);})[_0x14c7('0x15')](function(_0x49c38b){logger['error'](_0x49c38b);_0x3fe7f3(null,![]);});};AGIVertices[_0x14c7('0x16')]['agentLogin']=function(_0x56e23c,_0x5c6c4b){var _0x325928={'role':_0x14c7('0x4d')};_0x325928[_0x56e23c]=this[_0x14c7('0x35')][_0x14c7('0x39')];var _0x42462e=_0x56e23c!='internal'?util[_0x14c7('0x2a')](_0x14c7('0x52'),'LOCAL',this['channel'][_0x14c7('0x39')]):undefined;this[_0x14c7('0x10')][_0x14c7('0x53')](_0x325928,_0x42462e)[_0x14c7('0x14')](function(_0x5be9b0){_0x5c6c4b(null,_[_0x14c7('0x43')](_0x5be9b0)?![]:!![]);})[_0x14c7('0x15')](function(_0x12b5a5){logger['error'](_0x12b5a5);_0x5c6c4b(null,![]);});};AGIVertices['prototype'][_0x14c7('0x54')]=function(_0x39a48e,_0x28c640){sh['exec'](_[_0x14c7('0x55')](_0x39a48e),function(_0x217f5c,_0x313d01){var _0x5108ea=_0x313d01[_0x14c7('0x56')](/(\r\n|\n|\r)/gm,'');_0x28c640(null,_0x5108ea);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x1e59cc,_0x27d907){scripts[_0x14c7('0x57')](_0x1e59cc[_0x14c7('0x58')],_0x1e59cc[_0x14c7('0x59')]||'text',_0x1e59cc[_0x14c7('0x5a')],_0x1e59cc[_0x14c7('0x5b')]||_0x14c7('0x5c'),_0x1e59cc[_0x14c7('0x5d')]||_0x14c7('0x5e'),_0x1e59cc['audioEncoding']||'MP3')[_0x14c7('0x14')](function(_0x12f2f2){_0x27d907(null,_0x12f2f2);})[_0x14c7('0x15')](function(_0x519e4e){_0x27d907(_0x519e4e);});};AGIVertices[_0x14c7('0x16')]['googleTTS']=function(_0x527d3c,_0x968fc9){scripts['googleTTS'](_0x527d3c[_0x14c7('0x5a')],_0x527d3c[_0x14c7('0x5f')]||'en',0x1)[_0x14c7('0x14')](function(_0x535430){_0x968fc9(null,_0x535430);})[_0x14c7('0x15')](function(_0x435dba){_0x968fc9(_0x435dba);});};AGIVertices[_0x14c7('0x16')]['restAPI']=function(_0x5309ae,_0x5ed94d){var _0x5ee87c={'uri':_0x5309ae['url'],'method':_0x5309ae[_0x14c7('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5309ae[_0x14c7('0x61')])===_0x14c7('0x62')&&parseInt(_0x5309ae[_0x14c7('0x61')])>=0x1?parseInt(_0x5309ae['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x14c7('0x63')]([_0x14c7('0x64'),_0x14c7('0x65')],_0x5ee87c[_0x14c7('0x60')]['toUpperCase']())){try{_0x5ee87c['body']=_0x5309ae[_0x14c7('0xc')]?JSON['parse'](_0x5309ae[_0x14c7('0xc')]):{};}catch(_0x29d8d6){logger[_0x14c7('0x4f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x29d8d6);}}try{_0x5ee87c[_0x14c7('0x66')]=_0x5309ae['rawHeaders']?JSON[_0x14c7('0x67')](_0x5309ae[_0x14c7('0x68')]):{};}catch(_0x47b66b){logger[_0x14c7('0x4f')](_0x14c7('0x69'),_0x47b66b);}if(_0x5309ae[_0x14c7('0x6a')]){try{var _0x518543=require(_0x5309ae[_0x14c7('0x6a')])[_0x14c7('0x6b')](this,_0x5ee87c);_0x5ee87c[_0x14c7('0x6c')]=Mustache[_0x14c7('0x6d')](_0x5309ae[_0x14c7('0x6e')],_0x518543,{},['$$','$$']);if(_0x5ee87c[_0x14c7('0x66')]){_0x5ee87c[_0x14c7('0x66')]=JSON['parse'](Mustache['render'](JSON[_0x14c7('0x6f')](_0x5ee87c[_0x14c7('0x66')]),_0x518543,{},['$$','$$']));}if(_0x5ee87c[_0x14c7('0x70')]){_0x5ee87c[_0x14c7('0x70')]=JSON[_0x14c7('0x67')](Mustache['render'](JSON[_0x14c7('0x6f')](_0x5ee87c[_0x14c7('0x70')]),_0x518543,{},['$$','$$']));}}catch(_0x2fbe98){logger[_0x14c7('0x4f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2fbe98);}}rp(_0x5ee87c)[_0x14c7('0x14')](function(_0x371afe){var _0x4a0eee={'statusCode':_0x371afe['statusCode']||0xc8,'statusMessage':_0x371afe['statusMessage']||'OK','headers':_0x371afe[_0x14c7('0x66')]||{},'body':_0x371afe[_0x14c7('0x70')]||{}};_0x5ed94d(null,_0x4a0eee);})[_0x14c7('0x15')](function(_0x27fb70){var _0x28b598={'statusCode':_0x27fb70['statusCode']||0x1f4,'statusMessage':_0x27fb70[_0x14c7('0x71')]||_0x14c7('0x72'),'headers':_0x27fb70[_0x14c7('0x73')][_0x14c7('0x66')]||{},'body':_0x27fb70[_0x14c7('0x73')][_0x14c7('0x70')]||{}};_0x5ed94d(null,_0x28b598);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x74')]=function(_0x44275c,_0x18f857){scripts['googleDialogflow'](this[_0x14c7('0x35')][_0x14c7('0x36')],_0x44275c['key'],_0x44275c[_0x14c7('0x5a')],_0x44275c['dialogflow_language']||'en')[_0x14c7('0x14')](function(_0x5f2770){_0x18f857(null,_0x5f2770);})[_0x14c7('0x15')](function(_0x531279){_0x18f857(_0x531279);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x75')]=function(_0x1583ac,_0x285532){scripts[_0x14c7('0x75')](this[_0x14c7('0x35')][_0x14c7('0x36')],_0x1583ac[_0x14c7('0x76')],_0x1583ac[_0x14c7('0x77')],_0x1583ac[_0x14c7('0x78')],_0x1583ac['text'],_0x1583ac['dialogflowV2_language']||'en')[_0x14c7('0x14')](function(_0x1ec2c7){_0x285532(null,_0x1ec2c7);})[_0x14c7('0x15')](function(_0x5486fe){_0x285532(_0x5486fe);});};AGIVertices['prototype'][_0x14c7('0x79')]=function(_0xffb744,_0x360b79){scripts[_0x14c7('0x79')](this[_0x14c7('0x35')],_0xffb744)[_0x14c7('0x14')](function(_0x52c615){_0x360b79(null,_0x52c615);})['catch'](function(_0x3815e0){_0x360b79(_0x3815e0);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x7a')]=function(_0x160851,_0x43551c){scripts['ispeechTTS'](_0x160851[_0x14c7('0x7b')],_0x160851[_0x14c7('0x5a')],_0x160851[_0x14c7('0x7c')]||_0x14c7('0x5c'),_0x160851[_0x14c7('0x7d')])[_0x14c7('0x14')](function(_0x544be7){_0x43551c(null,_0x544be7);})['catch'](function(_0x537662){_0x43551c(_0x537662);});};AGIVertices['prototype'][_0x14c7('0x7e')]=function(_0x55d571,_0x2ec528,_0x56bccb){scripts[_0x14c7('0x7e')](_0x2ec528,_0x55d571[_0x14c7('0x7b')],_0x55d571[_0x14c7('0x7f')]||'en-US',this[_0x14c7('0x80')](_0x55d571['model'])?_0x55d571[_0x14c7('0x81')]:undefined)[_0x14c7('0x14')](function(_0x40f53e){_0x56bccb(null,_0x40f53e);})[_0x14c7('0x15')](function(_0x4b4051){_0x56bccb(_0x4b4051);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x82')]=function(_0x41d772,_0x55a8a1){scripts[_0x14c7('0x82')](_0x41d772['aws_access_key_id'],_0x41d772[_0x14c7('0x83')],_0x41d772[_0x14c7('0x84')],_0x41d772['aws_polly_voice']||_0x14c7('0x85'),_0x41d772['text'],_0x41d772['aws_text_type']||_0x14c7('0x5a'))[_0x14c7('0x14')](function(_0x4aeacb){_0x55a8a1(null,_0x4aeacb);})['catch'](function(_0x1c05c8){_0x55a8a1(_0x1c05c8);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x86')]=function(_0x2789c6,_0x3596c3){scripts[_0x14c7('0x86')](this['channel'][_0x14c7('0x36')],_0x2789c6['aws_access_key_id'],_0x2789c6[_0x14c7('0x83')],_0x2789c6[_0x14c7('0x87')],_0x2789c6[_0x14c7('0x5a')],_0x2789c6[_0x14c7('0x88')])[_0x14c7('0x14')](function(_0x485143){_0x3596c3(null,_0x485143);})['catch'](function(_0x3c0276){_0x3596c3(_0x3c0276);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x89')]=function(_0x10bf39,_0x3f5b51,_0x2e5a73){scripts[_0x14c7('0x89')](_0x3f5b51,_0x10bf39[_0x14c7('0x7b')],_0x10bf39[_0x14c7('0x8a')]||_0x14c7('0x5c'))[_0x14c7('0x14')](function(_0x122987){_0x2e5a73(null,_0x122987);})[_0x14c7('0x15')](function(_0x564033){_0x2e5a73(_0x564033);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x8b')]=function(_0x1e5e7c,_0x3e4725,_0x47908d){scripts['tildeASR'](_0x3e4725,_0x1e5e7c[_0x14c7('0x8c')],_0x1e5e7c['appsecret'],_0x1e5e7c[_0x14c7('0x6c')])[_0x14c7('0x14')](function(_0x4a047a){_0x47908d(null,_0x4a047a);})[_0x14c7('0x15')](function(_0x4adcfa){_0x47908d(_0x4adcfa);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x8d')]=function(_0x4eb152){var _0x1862d1=_[_0x14c7('0x63')](verticesWithRetry,_0x4eb152['agicommand'])?_0x4eb152:_[_0x14c7('0x8e')](_0x4eb152);for(var _0x1bd8c5 in _0x1862d1){if(_0x1862d1[_0x14c7('0x8f')](_0x1bd8c5)){if(_0x1862d1[_0x1bd8c5]&&_[_0x14c7('0x90')](_0x1862d1[_0x1bd8c5])){if(_['includes'](recursiveMapAttributes,_0x1bd8c5)){_0x1862d1[_0x1bd8c5]=this['replaceObjectAllVariables'](_0x1862d1[_0x1bd8c5]);}else{_0x1862d1[_0x1bd8c5]=this[_0x14c7('0x91')](_0x1862d1[_0x1bd8c5]);}}}}return _0x1862d1;};AGIVertices[_0x14c7('0x16')][_0x14c7('0x92')]=function(_0x35fbbc){for(var _0x5c3bba in _0x35fbbc){if(_0x35fbbc[_0x14c7('0x8f')](_0x5c3bba)){if(_[_0x14c7('0x93')](_0x35fbbc[_0x5c3bba])){this['recursiveNodeIndex'](_0x35fbbc[_0x5c3bba]);}else if(_[_0x14c7('0x94')](_0x35fbbc[_0x5c3bba])){for(var _0x113efb=0x0;_0x113efb<_0x35fbbc[_0x5c3bba][_0x14c7('0x95')];_0x113efb++){this[_0x14c7('0x92')](_0x35fbbc[_0x5c3bba][_0x113efb]);}}else if(_[_0x14c7('0x90')](_0x35fbbc[_0x5c3bba])){_0x35fbbc[_0x5c3bba]=this[_0x14c7('0x91')](_0x35fbbc[_0x5c3bba]);}}}};AGIVertices['prototype'][_0x14c7('0x96')]=function(_0xc56a5e,_0x22d857){for(var _0x51a42b in _0xc56a5e){if(_0xc56a5e[_0x14c7('0x8f')](_0x51a42b)){if(_['isPlainObject'](_0xc56a5e[_0x51a42b])){if(!_[_0x14c7('0x45')](_0xc56a5e[_0x51a42b])){this[_0x14c7('0x96')](_0xc56a5e[_0x51a42b],util['format'](_0x14c7('0x97'),_0x22d857,_0x51a42b));}}else if(_['isArray'](_0xc56a5e[_0x51a42b])){for(var _0x2e4d54=0x0;_0x2e4d54<_0xc56a5e[_0x51a42b]['length'];_0x2e4d54++){this[_0x14c7('0x96')](_0xc56a5e[_0x51a42b][_0x2e4d54],util[_0x14c7('0x2a')](_0x14c7('0x97'),_0x22d857,_0x51a42b+'['+_0x2e4d54+']'));}}else{if(!_[_0x14c7('0x43')](_0xc56a5e[_0x51a42b])){this[_0x14c7('0x35')][_0x14c7('0x98')](util['format'](_0x14c7('0x97'),_0x22d857,_0x51a42b),_0xc56a5e[_0x51a42b]);}}}}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x99')]=function(_0x38a50d){try{var _0xdb08c1=JSON['parse'](_0x38a50d);this[_0x14c7('0x92')](_0xdb08c1);return JSON['stringify'](_0xdb08c1);}catch(_0x50d218){return this[_0x14c7('0x91')](_0x38a50d);}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x91')]=function(_0x257302){var _0x2b56b8=_0x257302[_0x14c7('0x9a')]('{');for(var _0x518216=0x1;_0x518216<_0x2b56b8[_0x14c7('0x95')];_0x518216+=0x1){var _0x5ee66b=_0x2b56b8[_0x518216][_0x14c7('0x9a')]('}');if(_0x5ee66b[_0x14c7('0x95')]>0x1){_0x257302=_0x257302['replaceAll']('{'+_0x5ee66b[0x0]+'}',this[_0x14c7('0x35')][_0x14c7('0x12')](_0x5ee66b[0x0])[_0x14c7('0x9b')]||_0x5ee66b[0x0]);}}if(_0x2b56b8[_0x14c7('0x95')]===0x1){return _0x257302['toString']();}return this[_0x14c7('0x91')](_0x257302);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x9c')]=function(_0x453e0a,_0x427e80){var _0x13899b=this['channel'][_0x14c7('0x12')](_0x453e0a);if(_0x13899b[_0x14c7('0x9d')]===-0x1){return _0x13899b;}logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x9e'),_0x427e80,_0x13899b[_0x14c7('0x9b')]));return this[_0x14c7('0x35')]['setVariable'](_0x427e80,_0x13899b[_0x14c7('0x9b')]);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x80')]=function(_0x1ec46a){return _0x1ec46a&&_0x1ec46a!=='0'&&_0x1ec46a!=='-1'&&_0x1ec46a!=='';};AGIVertices[_0x14c7('0x16')][_0x14c7('0x9f')]=function(_0x35e218){this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x35e218,'-');_0x35e218[_0x14c7('0xa0')]=_0x35e218[_0x14c7('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x14c7('0x16')][_0x14c7('0xa1')]=function(_0x57963f){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xa2'),_0x57963f[_0x14c7('0x37')]));if(!this['isConfigured'](_0x57963f['text'])){return this[_0x14c7('0x35')]['noop'](_0x14c7('0xa3'));}var _0x5571a0='\x22'+_0x57963f[_0x14c7('0x5a')]+'\x22';if(this[_0x14c7('0x80')](_0x57963f['options'])){_0x5571a0+=','+_0x57963f['options'];}var _0x38304a=this[_0x14c7('0x35')]['exec'](_0x14c7('0xa4'),_0x5571a0);if(_0x38304a[_0x14c7('0x9d')]===-0x1){return _0x38304a;}return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xa6'),_0x5571a0));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xa7')]=function(_0x54b5d4){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xa8'),_0x54b5d4[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x54b5d4[_0x14c7('0xa9')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xaa'));}var _0xcee1b6=_0x54b5d4[_0x14c7('0xa9')];if(this['isConfigured'](_0x54b5d4[_0x14c7('0x73')])){_0xcee1b6+=','+_0x54b5d4['options'];}var _0x206f35=this['channel']['exec'](_0x14c7('0xab'),_0xcee1b6);if(_0x206f35[_0x14c7('0x9d')]===-0x1){return _0x206f35;}var _0x2c2f7e=this[_0x14c7('0x9c')](_0x14c7('0xac'),_0x14c7('0xad'));if(_0x2c2f7e['result']===-0x1){return _0x2c2f7e;}var _0x243b75=this[_0x14c7('0x9c')]('RECOG_INPUT()',_0x14c7('0xae'));if(_0x243b75['result']===-0x1){return _0x243b75;}var _0x48860a=this[_0x14c7('0x9c')](_0x14c7('0xaf'),_0x14c7('0xb0'));if(_0x48860a[_0x14c7('0x9d')]===-0x1){return _0x48860a;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0xcee1b6));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x7')]=function(_0x1568d1){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xb1'),_0x1568d1[_0x14c7('0x37')]));return this['channel'][_0x14c7('0x7')]([_0x1568d1[_0x14c7('0xb2')],_0x1568d1[_0x14c7('0xb3')]]);};AGIVertices['prototype']['answer']=function(_0x254c68){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x254c68['label']));if(this['isConfigured'](_0x254c68['timeout'])){logger['info'](util[_0x14c7('0x2a')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x254c68[_0x14c7('0x61')]));var _0x208dac=this[_0x14c7('0x35')]['wait'](_0x254c68[_0x14c7('0x61')]);if(_0x208dac[_0x14c7('0x9d')]===-0x1){return _0x208dac;}}return this[_0x14c7('0x35')][_0x14c7('0xb4')]();};AGIVertices[_0x14c7('0x16')][_0x14c7('0xb5')]=function(_0x59a7c6){logger[_0x14c7('0x2e')](util['format'](_0x14c7('0xb6'),_0x59a7c6[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x59a7c6['list_id'])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x59a7c6,_0x14c7('0xb7'));}_0x59a7c6['scheduledAt']=moment();if(this[_0x14c7('0x80')](_0x59a7c6['delay'])){_0x59a7c6['scheduledAt']=moment()[_0x14c7('0xb8')](_0x59a7c6['delay'],_0x14c7('0xb9'));}if(!this[_0x14c7('0x80')](_0x59a7c6[_0x14c7('0x4b')])){_0x59a7c6[_0x14c7('0x4b')]=0x2;}this['createCmContact']['sync'](this,_0x59a7c6);return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xba'),_0x59a7c6[_0x14c7('0xbb')],_0x59a7c6[_0x14c7('0x47')],_0x59a7c6[_0x14c7('0x48')]));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xbc')]=function(_0x38f870){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xbd'),_0x38f870[_0x14c7('0x37')]));var _0x18af69=this[_0x14c7('0x35')]['exec'](_0x38f870['application'],_0x38f870['options']);if(_0x18af69[_0x14c7('0x9d')]===-0x1){return _0x18af69;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xbe'),_0x38f870[_0x14c7('0xbf')],_0x38f870[_0x14c7('0x73')]));};AGIVertices[_0x14c7('0x16')]['lumenvoxtts']=function(_0x3c0d96){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xc0'),_0x3c0d96[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x3c0d96[_0x14c7('0x5a')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x56006f='\x22'+_0x3c0d96[_0x14c7('0x5a')]+'\x22';if(this['isConfigured'](_0x3c0d96[_0x14c7('0x73')])){_0x56006f+=','+_0x3c0d96['options'];}var _0x2c9d30=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0xa4'),_0x56006f);if(_0x2c9d30['result']===-0x1){return _0x2c9d30;}return this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')](_0x14c7('0xa6'),_0x56006f));};AGIVertices['prototype'][_0x14c7('0xc2')]=function(_0x35d344){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xc3'),_0x35d344[_0x14c7('0x37')]));if(!this['isConfigured'](_0x35d344[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}var _0x334f39='\x22'+_0x35d344[_0x14c7('0x5a')]+'\x22';if(this['isConfigured'](_0x35d344[_0x14c7('0x73')])){_0x334f39+=','+_0x35d344[_0x14c7('0x73')];}var _0x4047d2=this[_0x14c7('0x35')]['exec'](_0x14c7('0xa4'),_0x334f39);if(_0x4047d2[_0x14c7('0x9d')]===-0x1){return _0x4047d2;}return this['channel']['noop'](util[_0x14c7('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x334f39));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xc4')]=function(_0x321f5d){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xc5'),_0x321f5d[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x321f5d[_0x14c7('0xa9')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xaa'));}var _0x479a00=_0x321f5d['grammar'];if(this[_0x14c7('0x80')](_0x321f5d[_0x14c7('0x73')])){_0x479a00+=','+_0x321f5d[_0x14c7('0x73')];}var _0x374fb7=this['channel']['exec']('MRCPRecog',_0x479a00);if(_0x374fb7['result']===-0x1){return _0x374fb7;}var _0x420714=this[_0x14c7('0x9c')](_0x14c7('0xac'),'LUMENVOX_ASR_CONFIDENCE');if(_0x420714[_0x14c7('0x9d')]===-0x1){return _0x420714;}var _0x558cc3=this['getAndSetVariable'](_0x14c7('0xc6'),_0x14c7('0xc7'));if(_0x558cc3[_0x14c7('0x9d')]===-0x1){return _0x558cc3;}var _0x48155c=this[_0x14c7('0x9c')](_0x14c7('0xaf'),_0x14c7('0xc8'));if(_0x48155c[_0x14c7('0x9d')]===-0x1){return _0x48155c;}return this[_0x14c7('0x35')]['noop'](util['format'](_0x14c7('0xc9'),_0x479a00));};AGIVertices['prototype'][_0x14c7('0xca')]=function(_0x1e0be4){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xcb'),_0x1e0be4['label']));if(!this[_0x14c7('0x80')](_0x1e0be4[_0x14c7('0xa9')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xaa'));}var _0x2dbe7f=_0x1e0be4[_0x14c7('0xa9')];if(this[_0x14c7('0x80')](_0x1e0be4[_0x14c7('0x73')])){_0x2dbe7f+=','+_0x1e0be4[_0x14c7('0x73')];}var _0x3a8480=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0xab'),_0x2dbe7f);if(_0x3a8480[_0x14c7('0x9d')]===-0x1){return _0x3a8480;}var _0x484ba6=this[_0x14c7('0x9c')](_0x14c7('0xac'),_0x14c7('0xcc'));if(_0x484ba6['result']===-0x1){return _0x484ba6;}var _0x242246=this[_0x14c7('0x9c')](_0x14c7('0xc6'),_0x14c7('0xcd'));if(_0x242246[_0x14c7('0x9d')]===-0x1){return _0x242246;}var _0x29fc6c=this[_0x14c7('0x9c')](_0x14c7('0xaf'),_0x14c7('0xce'));if(_0x29fc6c[_0x14c7('0x9d')]===-0x1){return _0x29fc6c;}return this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2dbe7f));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xcf')]=function(_0x2a3bb6){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2a3bb6[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x2a3bb6[_0x14c7('0xd0')])){return this['channel'][_0x14c7('0x4f')](_0x2a3bb6,_0x14c7('0xd1'));}var _0x246f38=this['getSquareOdbc'][_0x14c7('0x6b')](this,_0x2a3bb6[_0x14c7('0xd0')]);if(!_0x246f38){return this['channel'][_0x14c7('0x4f')](_0x2a3bb6,_0x14c7('0xd2'));}if(!this[_0x14c7('0x80')](_0x2a3bb6[_0x14c7('0x30')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x2a3bb6,_0x14c7('0xd3'));}var _0x10f428=_0x2a3bb6['query'][_0x14c7('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xd4'),_0x10f428));var _0x29728e=this[_0x14c7('0xd5')][_0x14c7('0x6b')](this,_0x246f38,_0x10f428);this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x2a3bb6,_0x10f428);if(!this[_0x14c7('0x80')](_0x2a3bb6[_0x14c7('0xd6')])){return this['channel']['noop'](_0x14c7('0xd7'));}var _0xbfe3fc=this['getVariable'][_0x14c7('0x6b')](this,_0x2a3bb6[_0x14c7('0xd6')]);if(!_0xbfe3fc){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x2a3bb6,_0x14c7('0xd8'));}var _0x142283=this;_0x29728e[_0x14c7('0xd9')](function(_0x5eac1e,_0x1df714){Object[_0x14c7('0xda')](_0x5eac1e)[_0x14c7('0xd9')](function(_0x6efe7a){_0x142283['channel']['setVariable'](util[_0x14c7('0x2a')]('%s[%s][%s]',_0xbfe3fc,_0x1df714,_0x6efe7a),_0x5eac1e[_0x6efe7a]);});});this['channel']['setVariable'](util[_0x14c7('0x2a')]('%s_ROWS_COUNT',_0xbfe3fc),_0x29728e[_0x14c7('0x95')]);return this['channel']['noop'](util[_0x14c7('0x2a')]('variable\x20%s\x20set',_0xbfe3fc));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xdb')]=function(_0x205fa2){logger[_0x14c7('0xdc')](util[_0x14c7('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x205fa2[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x205fa2[_0x14c7('0xdd')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x205fa2,_0x14c7('0xde'));}var _0x5bc72d=this[_0x14c7('0x1d')][_0x14c7('0x6b')](this,_0x205fa2[_0x14c7('0xdd')]);if(!_0x5bc72d){return this[_0x14c7('0x35')]['error'](_0x205fa2,_0x14c7('0xdf'));}var _0x10c4e0=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0xe0'),[util[_0x14c7('0x2a')](_0x14c7('0xe1'),_0x5bc72d),_0x205fa2[_0x14c7('0x61')],_0x205fa2[_0x14c7('0xe2')],_0x205fa2['url']]);if(_0x10c4e0['result']===-0x1){return _0x10c4e0;}return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xe3'),_0x14c7('0xe0')));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xe4')]=function(_0x173eb9){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x173eb9[_0x14c7('0x37')]));if(!this['isConfigured'](_0x173eb9[_0x14c7('0x7b')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xe5'));}if(!this[_0x14c7('0x80')](_0x173eb9[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}this[_0x14c7('0x35')][_0x14c7('0xe6')]=!![];this[_0x14c7('0x34')](_0x173eb9);this[_0x14c7('0x41')](_0x173eb9[_0x14c7('0x5a')],'in','','');this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format']('Trying\x20Dialogflow:\x20%s',_0x173eb9[_0x14c7('0x5a')]));var _0x2fca0b=this[_0x14c7('0x74')][_0x14c7('0x6b')](this,_0x173eb9);if(_0x2fca0b){for(var _0x47b952 in _0x2fca0b){if(_0x2fca0b['hasOwnProperty'](_0x47b952)){this[_0x14c7('0x35')]['setVariable'](util[_0x14c7('0x2a')](_0x14c7('0xe7'),_0x47b952['toUpperCase']()),_0x2fca0b[_0x47b952]);}}this['createSquareMessage'](_0x2fca0b[_0x14c7('0xe8')],'out','dialogflow','');return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Dialogflow\x20Result\x20%s',_0x2fca0b[_0x14c7('0xe8')]));}return this['channel'][_0x14c7('0x4f')](_0x173eb9,_0x14c7('0xe9'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xea')]=function(_0x57a1be){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xeb'),_0x57a1be['label']));if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0x76')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xec'));}if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0x77')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xed'));}if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0x78')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20private_key\x20configured');}if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0xee')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xef'));}if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}this[_0x14c7('0x35')][_0x14c7('0xe6')]=!![];this['createSquareDetailsReport'](_0x57a1be);this['createSquareMessage'](_0x57a1be[_0x14c7('0x5a')],'in','','');this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xf0'),_0x57a1be[_0x14c7('0x5a')]));var _0x554229=this[_0x14c7('0x75')][_0x14c7('0x6b')](this,_0x57a1be);if(_0x554229){for(var _0x31c667 in _0x554229){if(_0x554229[_0x14c7('0x8f')](_0x31c667)){if(_0x31c667!==_0x14c7('0xf1')){this['channel'][_0x14c7('0x98')](util['format'](_0x14c7('0xe7'),_0x31c667[_0x14c7('0xf2')]()),_0x554229[_0x31c667]);}}}this[_0x14c7('0x41')](_0x554229[_0x14c7('0xe8')],_0x14c7('0xf3'),_0x14c7('0xea'),_0x554229[_0x14c7('0xf1')]);return this[_0x14c7('0x35')]['noop'](util['format']('DialogflowV2\x20Result\x20%s',_0x554229[_0x14c7('0xe8')]));}return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x57a1be,_0x14c7('0xf4'));};AGIVertices[_0x14c7('0x16')]['sesteknda']=function(_0x298a35){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xf5'),_0x298a35[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x298a35[_0x14c7('0xf6')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x298a35['username'])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x298a35['password'])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20password\x20configured');}if(!this[_0x14c7('0x80')](_0x298a35[_0x14c7('0xf7')])){return this[_0x14c7('0x35')]['noop']('no\x20text\x20configured');}this[_0x14c7('0x35')][_0x14c7('0xe6')]=!![];this['createSquareDetailsReport'](_0x298a35);this[_0x14c7('0x41')](_0x298a35[_0x14c7('0x5a')],'in','','');this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Trying\x20SestekNDA:\x20%s',_0x298a35['text']));var _0x5a6a0f=this[_0x14c7('0x79')][_0x14c7('0x6b')](this,_0x298a35);if(_0x5a6a0f){for(var _0x4dcbc0 in _0x5a6a0f){if(_0x5a6a0f[_0x14c7('0x8f')](_0x4dcbc0)){this[_0x14c7('0x35')][_0x14c7('0x98')](util['format'](_0x14c7('0xf8'),_0x4dcbc0[_0x14c7('0xf2')]()),_0x5a6a0f[_0x4dcbc0]);}}this[_0x14c7('0x41')](_0x5a6a0f['speech'],'out',_0x14c7('0xf9'),'');if(_0x5a6a0f['audiofile']){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5a6a0f[_0x14c7('0xfa')]));var _0x499634=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x5a6a0f['audiofile']);try{fs['unlink'](_0x5a6a0f['audiofile']+_0x14c7('0xfc'));}catch(_0x1a3e97){logger[_0x14c7('0x4f')](_0x1a3e97);}return _0x499634;}else{return this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')]('SestekNDA\x20Result\x20%s',_0x5a6a0f['speech']));}}return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x298a35,_0x14c7('0xfd'));};AGIVertices['prototype']['end']=function(_0x19e176){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x19e176['label']));return this[_0x14c7('0x35')]['noop']('end');};AGIVertices[_0x14c7('0x16')][_0x14c7('0xfe')]=function(_0x1d4871){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x1d4871[_0x14c7('0x37')]));var _0xe02662='';if(_0x1d4871[_0x14c7('0xff')]){if(!this[_0x14c7('0x80')](_0x1d4871[_0x14c7('0xff')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x1d4871,_0x14c7('0x100'));}else{var _0x8cd3ef=parseInt(_0x1d4871['trunk_id'],0xa);if(isNaN(_0x8cd3ef)){_0xe02662=_0x1d4871[_0x14c7('0xff')];}else{_0xe02662=this[_0x14c7('0x1f')][_0x14c7('0x6b')](this,_0x1d4871['trunk_id']);if(!_0xe02662){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x1d4871,_0x14c7('0x101'));}}}}else if(_0x1d4871[_0x14c7('0x102')]){_0xe02662=_0x1d4871[_0x14c7('0x102')];}else{return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x1d4871,_0x14c7('0x100'));}var _0x430494=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0xe0'),[util[_0x14c7('0x2a')](_0x14c7('0x103'),_0xe02662,_0x1d4871[_0x14c7('0xbb')]),_0x1d4871[_0x14c7('0x61')],_0x1d4871[_0x14c7('0xe2')],_0x1d4871['url']]);if(_0x430494[_0x14c7('0x9d')]===-0x1){return _0x430494;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Executed\x20command\x20%s',_0x14c7('0xe0')));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x104')]=function(_0x51469c){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x105'),_0x51469c[_0x14c7('0x37')]));return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x104'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xe')]=function(_0x51c9db){logger[_0x14c7('0x2e')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x51c9db[_0x14c7('0x37')]));if(_0x51c9db[_0x14c7('0xa0')]===0x0){return this[_0x14c7('0x9f')](_0x51c9db);}_0x51c9db[_0x14c7('0xa0')]-=0x1;if(!this[_0x14c7('0x80')](_0x51c9db[_0x14c7('0x106')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x51c9db,_0x14c7('0x107'));}var _0x3df6f9=this[_0x14c7('0x21')][_0x14c7('0x6b')](this,_0x51c9db[_0x14c7('0x106')]);if(!_0x3df6f9){return this['channel'][_0x14c7('0x4f')](_0x51c9db,_0x14c7('0x108'));}if(!this[_0x14c7('0x80')](_0x51c9db[_0x14c7('0xd6')])){return this['channel'][_0x14c7('0x4f')](_0x14c7('0xd7'));}var _0x144c10=this[_0x14c7('0x35')][_0x14c7('0x109')](_0x3df6f9,_0x51c9db[_0x14c7('0x10a')],_0x51c9db[_0x14c7('0x10b')]);var _0xefa7ff=_0x144c10['result']?_0x144c10[_0x14c7('0x9d')][_0x14c7('0x4a')]():'';logger[_0x14c7('0x2e')]('test',JSON[_0x14c7('0x6f')](_0x144c10));if(_0x144c10[_0x14c7('0x9d')]===-0x1){this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x51c9db,_0xefa7ff);return _0x144c10;}else if(_0x144c10['extra']===_0x14c7('0x61')){_0x144c10[_0x14c7('0x9d')]=_0xefa7ff[_0x14c7('0x95')]>=parseInt(_0x51c9db[_0x14c7('0x10c')])?'x':'i';}else{_0x144c10[_0x14c7('0x9d')]=_0xefa7ff['length']>=parseInt(_0x51c9db[_0x14c7('0x10c')])&&_0xefa7ff['length']<=parseInt(_0x51c9db['maxdigit'])?'x':'i';}var _0xc5d061=this['getVariable'][_0x14c7('0x6b')](this,_0x51c9db[_0x14c7('0xd6')]);if(!_0xc5d061){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x51c9db,'no\x20variable\x20found');}this[_0x14c7('0x35')]['setVariable'](_0xc5d061,_0xefa7ff);if(this[_0x14c7('0x80')](_0x51c9db['hiddendigitsnum'])){var _0x3ca830=parseInt(_0x51c9db[_0x14c7('0x10d')],0xa);var _0x5ae44d=rs[_0x14c7('0x10e')]({'charset':'*','length':_0x3ca830});var _0xd50e8f=_0xefa7ff['length'];if(_0xd50e8f>0x0){if(_0xd50e8f>_0x3ca830){this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x51c9db,_0x51c9db[_0x14c7('0x10f')]===_0x14c7('0x110')?_0x5ae44d+_0xefa7ff[_0x14c7('0x111')](_0x3ca830):_0xefa7ff[_0x14c7('0x111')](0x0,_0xd50e8f-_0x3ca830)+_0x5ae44d);}else{this['createSquareDetailsReport'][_0x14c7('0x6b')](this,_0x51c9db,rs[_0x14c7('0x10e')]({'charset':'*','length':_0xd50e8f}));}}else{this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x51c9db,'');}}else{this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x51c9db,_0xefa7ff);}return _0x144c10;};AGIVertices['prototype'][_0x14c7('0xf')]=function(_0x212a92){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x212a92['label']));return this['getdigits'](_0x212a92);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x112')]=function(_0x5973ae){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x113'),_0x5973ae[_0x14c7('0x37')]));this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x5973ae,_0x5973ae[_0x14c7('0x114')]);return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x115'),_0x5973ae[_0x14c7('0x114')]));};AGIVertices[_0x14c7('0x16')]['awspolly']=function(_0x43a5a5){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x116'),_0x43a5a5[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x43a5a5[_0x14c7('0x117')])||!this[_0x14c7('0x80')](_0x43a5a5[_0x14c7('0x83')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x118'));}if(!this[_0x14c7('0x80')](_0x43a5a5[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}this[_0x14c7('0x35')]['noop'](util['format'](_0x14c7('0x119'),_0x43a5a5['text']));var _0x59c14f=this[_0x14c7('0x82')][_0x14c7('0x6b')](this,_0x43a5a5);if(_0x59c14f){this['channel']['noop'](util[_0x14c7('0x2a')](_0x14c7('0x11a'),_0x59c14f));var _0x2aa434=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x59c14f);try{fs['unlink'](_0x59c14f+'.wav');}catch(_0x1e0f1b){logger['error'](_0x1e0f1b);}return _0x2aa434;}return this['channel']['error'](_0x43a5a5,_0x14c7('0x11b'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x11c')]=function(_0x53bc40){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x11d'),_0x53bc40[_0x14c7('0x37')]));if(!this['isConfigured'](_0x53bc40[_0x14c7('0x117')])||!this[_0x14c7('0x80')](_0x53bc40[_0x14c7('0x83')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x118'));}if(!this[_0x14c7('0x80')](_0x53bc40[_0x14c7('0x88')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x11e'));}if(!this[_0x14c7('0x80')](_0x53bc40[_0x14c7('0x5a')])){return this[_0x14c7('0x35')]['noop'](_0x14c7('0xa3'));}this[_0x14c7('0x35')][_0x14c7('0xe6')]=!![];this['createSquareDetailsReport'](_0x53bc40);this['createSquareMessage'](_0x53bc40[_0x14c7('0x5a')],'in','','');this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x11f'),_0x53bc40['text']));var _0x520ace=this[_0x14c7('0x86')]['sync'](this,_0x53bc40);if(_0x520ace){for(var _0x366c20 in _0x520ace){if(_0x520ace[_0x14c7('0x8f')](_0x366c20)&&_[_0x14c7('0x90')](_0x520ace[_0x366c20])){this[_0x14c7('0x35')][_0x14c7('0x98')](util['format'](_0x14c7('0x120'),_0x366c20[_0x14c7('0xf2')]()),_0x520ace[_0x366c20]);}}if(_[_0x14c7('0x43')](_0x520ace['message'])){return this[_0x14c7('0x35')]['noop'](_0x14c7('0x121'));}else{this[_0x14c7('0x41')](_0x520ace['message'],_0x14c7('0xf3'),'amazonlex','');return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x122'),_0x520ace[_0x14c7('0x71')]));}}return this['channel']['error'](_0x53bc40,_0x14c7('0x123'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x124')]=function(_0x40860d){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x125'),_0x40860d[_0x14c7('0x37')],_0x40860d['timeout']));if(!this[_0x14c7('0x80')](_0x40860d[_0x14c7('0x7b')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xe5'));}var _0x3a25ba=_0x14c7('0x126');var _0x28d91f=util[_0x14c7('0x2a')](_0x14c7('0x127'),FILES_PATH,rs['generate'](0x4));var _0x1c845e=util[_0x14c7('0x2a')](_0x14c7('0x97'),_0x28d91f,_0x3a25ba);var _0x4b59fa=!![];if(_0x40860d[_0x14c7('0x128')]===_0x14c7('0x129')){_0x4b59fa=![];}var _0x1489df=this[_0x14c7('0x35')][_0x14c7('0x12a')](_0x28d91f,_0x3a25ba,_0x40860d['intKey'],_0x40860d['timeout'],undefined,_0x4b59fa);if(_0x1489df[_0x14c7('0x9d')]!==-0x1){this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x12b'),_0x1c845e));var _0x56e6af=this['googleASR'][_0x14c7('0x6b')](this,_0x40860d,_0x1c845e);if(_0x56e6af){for(var _0x36b7b7 in _0x56e6af){if(_0x56e6af['hasOwnProperty'](_0x36b7b7)){this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')]('GOOGLE_ASR_%s',_0x36b7b7[_0x14c7('0xf2')]()),_0x56e6af[_0x36b7b7]);}}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x12c'),JSON[_0x14c7('0x6f')](_0x56e6af)));}}return _0x1489df;};AGIVertices[_0x14c7('0x16')][_0x14c7('0x12d')]=function(_0x47c2ee){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x12e'),_0x47c2ee[_0x14c7('0x37')]));if(!this['isConfigured'](_0x47c2ee[_0x14c7('0x8c')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0x12f'));}if(!this['isConfigured'](_0x47c2ee['appsecret'])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x130'));}var _0x420b8e='wav';var _0x3aa3e1=util[_0x14c7('0x2a')](_0x14c7('0x127'),FILES_PATH,rs['generate'](0x4));var _0x1c9f10=util[_0x14c7('0x2a')]('%s.%s',_0x3aa3e1,_0x420b8e);var _0x36a3fb=!![];if(_0x47c2ee[_0x14c7('0x128')]==='NOBEEP'){_0x36a3fb=![];}var _0x118740=this['channel']['recordFile'](_0x3aa3e1,_0x420b8e,_0x47c2ee[_0x14c7('0x131')],_0x47c2ee['timeout'],undefined,_0x36a3fb);if(_0x118740[_0x14c7('0x9d')]!==-0x1){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x132'),_0x1c9f10));var _0x12b90a=this['tildeASR'][_0x14c7('0x6b')](this,_0x47c2ee,_0x1c9f10);if(_0x12b90a){for(var _0x2f93d8 in _0x12b90a){if(_0x12b90a[_0x14c7('0x8f')](_0x2f93d8)){this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')]('TILDE_ASR_%s',_0x2f93d8[_0x14c7('0xf2')]()),_0x12b90a[_0x2f93d8]);}}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format'](_0x14c7('0x133'),JSON[_0x14c7('0x6f')](_0x12b90a)));}}return _0x118740;};AGIVertices[_0x14c7('0x16')]['gotoc']=function(_0x393598){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x393598[_0x14c7('0x37')]));return this['channel']['continueAt'](_0x393598[_0x14c7('0x3c')],_0x393598[_0x14c7('0x134')],_0x393598['priority']);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x135')]=function(_0xe8a6e3){logger[_0x14c7('0x2e')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xe8a6e3[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0xe8a6e3[_0x14c7('0x136')])){return this[_0x14c7('0x35')]['error'](_0xe8a6e3,_0x14c7('0x137'));}try{var _0x2a2e76=eval(_0xe8a6e3[_0x14c7('0x136')])?_0x14c7('0x138'):_0x14c7('0x139');this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x13a'),_0xe8a6e3[_0x14c7('0x136')],_0x2a2e76));return{'code':0xc8,'result':_0x2a2e76};}catch(_0x21dd54){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x13b')]=function(_0x704206){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x13c'),_0x704206[_0x14c7('0x37')]));if(!this['isConfigured'](_0x704206[_0x14c7('0x13d')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x704206,_0x14c7('0x13e'));}var _0x3c6093=this['getIntervals'][_0x14c7('0x6b')](this,_0x704206[_0x14c7('0x13d')]);if(!_0x3c6093){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x704206,_0x14c7('0x13f'));}for(var _0x715b5b=0x0;_0x715b5b<_0x3c6093[_0x14c7('0x95')];_0x715b5b+=0x1){var _0x384df1=this[_0x14c7('0x35')]['getVariable'](util[_0x14c7('0x2a')](_0x14c7('0x140'),_0x3c6093[_0x715b5b]));if(_0x384df1[_0x14c7('0x9d')]===-0x1){return _0x384df1;}logger[_0x14c7('0x2e')](util['format'](_0x14c7('0x141'),_0x3c6093[_0x715b5b],_0x384df1['extra']));if(_0x384df1[_0x14c7('0x9b')]==='true'){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x141'),_0x3c6093[_0x715b5b],_0x14c7('0x138')));this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')]('IFTIME\x20%s\x20%s',_0x3c6093[_0x715b5b],_0x14c7('0x138')));return{'code':0xc8,'result':_0x14c7('0x138')};}else{logger['info'](util[_0x14c7('0x2a')]('IFTIME\x20%s\x20%s',_0x3c6093[_0x715b5b],_0x14c7('0x139')));this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format']('IFTIME\x20%s\x20%s',_0x3c6093[_0x715b5b],'false'));}}return{'code':0xc8,'result':_0x14c7('0x139')};};AGIVertices[_0x14c7('0x16')][_0x14c7('0x142')]=function(_0x539b35){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x539b35[_0x14c7('0x37')]));return this['channel'][_0x14c7('0x142')]();};AGIVertices[_0x14c7('0x16')][_0x14c7('0x143')]=function(_0x38e48e){logger[_0x14c7('0x2e')](util['format'](_0x14c7('0x144'),_0x38e48e[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x38e48e[_0x14c7('0x7b')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20key\x20configured');}var _0x34c139=_0x14c7('0x126');var _0x2d4d48=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x14c7('0x10e')](0x4));var _0x565f19=util['format'](_0x14c7('0x97'),_0x2d4d48,_0x34c139);var _0x215d9f=!![];if(_0x38e48e[_0x14c7('0x128')]===_0x14c7('0x129')){_0x215d9f=![];}var _0x2b9b80=this[_0x14c7('0x35')][_0x14c7('0x12a')](_0x2d4d48,_0x34c139,_0x38e48e[_0x14c7('0x131')],_0x38e48e[_0x14c7('0x61')],undefined,_0x215d9f);if(_0x2b9b80[_0x14c7('0x9d')]!==-0x1){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('ispeech\x20%s\x20file\x20created',_0x565f19));var _0x26c4ed=this[_0x14c7('0x7e')][_0x14c7('0x6b')](this,_0x38e48e,_0x565f19);if(_0x26c4ed){for(var _0x141c55 in _0x26c4ed){if(_0x26c4ed['hasOwnProperty'](_0x141c55)){this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')](_0x14c7('0x145'),_0x141c55[_0x14c7('0xf2')]()),_0x26c4ed[_0x141c55]);}}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format'](_0x14c7('0x146'),JSON['stringify'](_0x26c4ed)));}}return _0x2b9b80;};AGIVertices[_0x14c7('0x16')][_0x14c7('0x147')]=function(_0x3c752f){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x148'),_0x3c752f[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x3c752f[_0x14c7('0x7b')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xe5'));}if(!this[_0x14c7('0x80')](_0x3c752f[_0x14c7('0x5a')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xa3'));}this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x149'),_0x3c752f[_0x14c7('0x5a')]));var _0x354df8=this['ispeechTTS'][_0x14c7('0x6b')](this,_0x3c752f);if(_0x354df8){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('ispeech\x20%s\x20file\x20created',_0x354df8));var _0x4440fa=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x354df8,_0x3c752f[_0x14c7('0x131')]);try{fs['unlink'](_0x354df8+_0x14c7('0xfc'));}catch(_0x49a43a){logger['error'](_0x49a43a);}return _0x4440fa;}return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x3c752f,_0x14c7('0x14a'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x14b')]=function(_0x562e3e){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x14c'),_0x562e3e[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x562e3e[_0x14c7('0x14d')])){return this[_0x14c7('0x35')]['error'](_0x562e3e,_0x14c7('0x14e'));}logger[_0x14c7('0x2e')](util['format'](_0x14c7('0x14f'),this['channel']['callerid'],_0x562e3e[_0x14c7('0x14d')]));var _0x4bd9ff=this[_0x14c7('0x53')][_0x14c7('0x6b')](this,_0x562e3e[_0x14c7('0x14d')]);if(_0x4bd9ff){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x562e3e[_0x14c7('0x14d')]));this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x562e3e['findBy']));return{'code':0xc8,'result':_0x14c7('0x151')};}else{logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')]['callerid'],_0x562e3e[_0x14c7('0x14d')]));this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x562e3e['findBy']));return{'code':0xc8,'result':_0x14c7('0x153')};}};AGIVertices[_0x14c7('0x16')]['logout']=function(_0x1f7bae){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x154'),_0x1f7bae['label']));if(!this[_0x14c7('0x80')](_0x1f7bae[_0x14c7('0x14d')])){return this['channel'][_0x14c7('0x4f')](_0x1f7bae,_0x14c7('0x14e'));}logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x14c7('0x39')],_0x1f7bae[_0x14c7('0x14d')]));var _0x1f7ab2=this[_0x14c7('0x51')][_0x14c7('0x6b')](this,_0x1f7bae[_0x14c7('0x14d')]);if(_0x1f7ab2){logger['info'](util[_0x14c7('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x14c7('0x35')][_0x14c7('0x39')],_0x1f7bae[_0x14c7('0x14d')]));this['channel'][_0x14c7('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x14c7('0x35')][_0x14c7('0x39')],_0x1f7bae['findBy']));return{'code':0xc8,'result':_0x14c7('0x151')};}else{logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')]['callerid'],_0x1f7bae[_0x14c7('0x14d')]));this['channel']['noop'](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x1f7bae[_0x14c7('0x14d')]));return{'code':0xc8,'result':_0x14c7('0x153')};}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x155')]=function(_0x292fa9){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x156'),_0x292fa9[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x292fa9['operation'])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x292fa9,_0x14c7('0x157'));}this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')](_0x14c7('0x158'),_0x292fa9[_0x14c7('0x159')]));var _0x157a5e=eval(_0x292fa9[_0x14c7('0x159')]);if(!this[_0x14c7('0x80')](_0x292fa9['variable_id'])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xd7'));}var _0x375969=this['getVariable']['sync'](this,_0x292fa9[_0x14c7('0xd6')]);if(!_0x375969){return this[_0x14c7('0x35')]['error'](_0x292fa9,_0x14c7('0xd8'));}if(_['isArray'](_0x157a5e)){var _0x9684fa=this;_0x157a5e[_0x14c7('0xd9')](function(_0x5ab457,_0x4d60d2){_0x9684fa[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')]('%s[%s]',_0x375969,_0x4d60d2),_0x5ab457);});return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x15a'),_0x375969));}else{return this[_0x14c7('0x35')][_0x14c7('0x98')](_0x375969,_0x157a5e);}};AGIVertices[_0x14c7('0x16')][_0x14c7('0xd')]=function(_0x140b8){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x140b8[_0x14c7('0x37')]));if(_0x140b8[_0x14c7('0xa0')]===0x0){return this['maxRetry'](_0x140b8);}_0x140b8[_0x14c7('0xa0')]-=0x1;if(!this[_0x14c7('0x80')](_0x140b8[_0x14c7('0x106')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x140b8,_0x14c7('0x107'));}var _0x3c18db=this[_0x14c7('0x21')][_0x14c7('0x6b')](this,_0x140b8[_0x14c7('0x106')]);if(!_0x3c18db){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x140b8,_0x14c7('0x108'));}var _0x46f179=this[_0x14c7('0x35')][_0x14c7('0x109')](_0x3c18db,_0x140b8[_0x14c7('0x10a')],_0x140b8[_0x14c7('0x15b')]);var _0x58fd60=_0x46f179[_0x14c7('0x9d')];if(_0x46f179[_0x14c7('0x9d')]===-0x1){this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x140b8,'-1');return _0x46f179;}else if(_0x46f179['extra']===_0x14c7('0x61')){_0x46f179[_0x14c7('0x9d')]=_0x46f179['result'][_0x14c7('0x95')]>0x0?_0x46f179[_0x14c7('0x9d')]:'t';}else if(_[_0x14c7('0x45')](_0x46f179[_0x14c7('0x9d')])){_0x46f179[_0x14c7('0x9d')]='#';_0x58fd60='#';}if(!this['isConfigured'](_0x140b8[_0x14c7('0xd6')])){this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xd7'));}else{var _0x243f8e=this[_0x14c7('0x12')][_0x14c7('0x6b')](this,_0x140b8[_0x14c7('0xd6')]);if(!_0x243f8e){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x140b8,'no\x20variable\x20found');}this['channel'][_0x14c7('0x98')](_0x243f8e,_0x58fd60);}this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x140b8,_0x58fd60);return _0x46f179;};AGIVertices['prototype'][_0x14c7('0xa5')]=function(_0x1dd1e3){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x15c'),_0x1dd1e3[_0x14c7('0x37')]));return this['channel'][_0x14c7('0xa5')](_0x1dd1e3[_0x14c7('0x15d')]||_0x1dd1e3[_0x14c7('0x37')]);};AGIVertices['prototype'][_0x14c7('0x15e')]=function(_0x2ae381){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x15f'),_0x2ae381[_0x14c7('0x37')]));if(!this['isConfigured'](_0x2ae381[_0x14c7('0x14d')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x2ae381,_0x14c7('0x14e'));}logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x14f'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x2ae381['findBy']));var _0x21f647=this['getPause'][_0x14c7('0x6b')](this,_0x2ae381[_0x14c7('0x160')]);var _0x4db31b=this[_0x14c7('0x4e')]['sync'](this,_0x2ae381['findBy'],_0x21f647);if(_0x4db31b){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x14c7('0x35')]['callerid'],_0x2ae381[_0x14c7('0x14d')]));this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x2ae381[_0x14c7('0x14d')]));return{'code':0xc8,'result':_0x14c7('0x151')};}else{logger['info'](util['format'](_0x14c7('0x152'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x2ae381['findBy']));this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x2ae381[_0x14c7('0x14d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x161')]=function(_0x231c08){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x162'),_0x231c08[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x231c08['file_id'])){return this['channel'][_0x14c7('0x4f')](_0x231c08,_0x14c7('0x107'));}var _0x54495e=this['getSound']['sync'](this,_0x231c08['file_id']);if(!_0x54495e){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x231c08,_0x14c7('0x108'));}var _0x35be01=this[_0x14c7('0x35')]['exec']('PLAYBACK',[_0x54495e,_0x231c08[_0x14c7('0xe2')]]);if(_0x35be01['result']===-0x1){return _0x35be01;}return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xbe'),_0x14c7('0x163'),_0x54495e));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x164')]=function(_0x4aa59f){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x165'),_0x4aa59f[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x4aa59f['queue_id'])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x4aa59f,'no\x20queue\x20selected');}var _0x47379f='';var _0x12d94b=parseInt(_0x4aa59f[_0x14c7('0x166')],0xa);if(isNaN(_0x12d94b)){_0x47379f=_0x4aa59f['queue_id'];}else{_0x47379f=this[_0x14c7('0x17')][_0x14c7('0x6b')](this,_0x4aa59f[_0x14c7('0x166')]);if(!_0x47379f){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x4aa59f,_0x14c7('0x167'));}}var _0x2c86c5='';if(this['isConfigured'](_0x4aa59f['file_id'])){var _0x452593=this['getSound'][_0x14c7('0x6b')](this,_0x4aa59f['file_id']);if(_0x452593){_0x2c86c5=_0x452593;}}this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x4aa59f,_0x47379f);if(_0x4aa59f[_0x14c7('0xe2')]['indexOf']('x')<0x0){_0x4aa59f[_0x14c7('0xe2')]+='x';}if(_0x4aa59f[_0x14c7('0xe2')][_0x14c7('0x168')]('X')<0x0){_0x4aa59f[_0x14c7('0xe2')]+='X';}this[_0x14c7('0x35')][_0x14c7('0x98')](_0x14c7('0x169'),_0x47379f?_0x47379f[_0x14c7('0x16a')]():'');var _0x3c457a=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0x16b'),[_0x47379f,_0x4aa59f[_0x14c7('0xe2')],_0x4aa59f['url'],_0x2c86c5,_0x4aa59f[_0x14c7('0x61')],_0x4aa59f[_0x14c7('0x7')],_0x4aa59f[_0x14c7('0x16c')],_0x4aa59f[_0x14c7('0x16d')],'',_0x4aa59f[_0x14c7('0x16e')]]);if(_0x3c457a['result']===-0x1){return _0x3c457a;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xbe'),_0x14c7('0x16b'),_0x47379f));};AGIVertices['prototype'][_0x14c7('0x16f')]=function(_0x4b0d1e){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x170'),_0x4b0d1e[_0x14c7('0x37')]));var _0x1e98c6=_0x4b0d1e[_0x14c7('0x171')]||_0x14c7('0x126');var _0x1fec9e=util[_0x14c7('0x2a')]('%s_%s',this[_0x14c7('0x35')][_0x14c7('0x36')],rs['generate'](0x5));var _0x212b0e=util[_0x14c7('0x2a')](_0x14c7('0x172'),FILES_PATH,_0x1fec9e,_0x1e98c6);var _0x269907=util[_0x14c7('0x2a')](_0x14c7('0x127'),FILES_PATH,_0x1fec9e);this['createSquareRecording']['sync'](this,_0x4b0d1e,_0x1fec9e,_0x212b0e);this['channel'][_0x14c7('0x98')]('RECORDING_SAVENAME',_0x1fec9e);logger[_0x14c7('0x2e')](_0x14c7('0x173'),_0x269907,_0x1e98c6,_0x4b0d1e[_0x14c7('0x174')],_0x4b0d1e[_0x14c7('0x61')]);return this[_0x14c7('0x35')][_0x14c7('0x12a')](_0x269907,_0x1e98c6,_0x4b0d1e['escape_digits'],_0x4b0d1e[_0x14c7('0x61')],undefined,!![]);};AGIVertices[_0x14c7('0x16')]['restapi']=function(_0x16e225){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x175'),_0x16e225[_0x14c7('0x37')]));if(!this['isConfigured'](_0x16e225[_0x14c7('0x6e')])){return this['channel']['noop'](_0x14c7('0x176'));}var _0x1f2da8=this[_0x14c7('0x177')][_0x14c7('0x6b')](this,_0x16e225);logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Response:',util[_0x14c7('0x178')](_0x1f2da8,{'showHidden':![],'depth':null})));if(!this[_0x14c7('0x80')](_0x16e225[_0x14c7('0xd6')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x179'));}var _0x1e675a=this['getVariable'][_0x14c7('0x6b')](this,_0x16e225[_0x14c7('0xd6')]);if(!_0x1e675a){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x16e225,_0x14c7('0xd8'));}this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')](_0x14c7('0x17a'),_0x1e675a),_0x1f2da8['statusCode']?_0x1f2da8[_0x14c7('0x17b')]:_0x14c7('0x17c'));this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')](_0x14c7('0x17d'),_0x1e675a),_0x1f2da8[_0x14c7('0x17e')]?_0x1f2da8[_0x14c7('0x17e')]:'OK');if(_0x1f2da8[_0x14c7('0x70')]){try{this['saveRestApiResult'](_0x1f2da8[_0x14c7('0x70')],_0x1e675a);}catch(_0x2e4d83){logger[_0x14c7('0x4f')](util[_0x14c7('0x2a')](_0x14c7('0x17f'),_0x1e675a));}}return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x180'),_0x1e675a));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x181')]=function(_0x54bf88){logger['info'](util['format'](_0x14c7('0x182'),_0x54bf88[_0x14c7('0x37')]));return this[_0x14c7('0x35')][_0x14c7('0x183')](_0x54bf88['digits']['replace'](/\s+/g,''),_0x54bf88[_0x14c7('0x174')]);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x184')]=function(_0x480866){logger['info'](util[_0x14c7('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x480866[_0x14c7('0x37')]));return this[_0x14c7('0x35')][_0x14c7('0x185')](_0x480866['number'][_0x14c7('0x56')](/\s+/g,''),_0x480866[_0x14c7('0x174')]);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x186')]=function(_0x44a5b2){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x44a5b2['label']));return this[_0x14c7('0x35')][_0x14c7('0x187')](_0x44a5b2['text'],_0x44a5b2[_0x14c7('0x174')]);};AGIVertices[_0x14c7('0x16')]['sendMail']=function(_0x557c62){logger[_0x14c7('0x2e')](util['format'](_0x14c7('0x188'),_0x557c62[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x557c62[_0x14c7('0x189')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x18a'));}var _0x3d5650=this[_0x14c7('0x23')][_0x14c7('0x6b')](this,_0x557c62[_0x14c7('0x189')]);if(!_0x3d5650||!_0x3d5650[_0x14c7('0x18b')]){return this[_0x14c7('0x35')]['error'](_0x557c62,'no\x20mail\x20account\x20found');}var _0x11b139={'from':util[_0x14c7('0x2a')](_0x14c7('0x18c'),_0x3d5650[_0x14c7('0x19')],_0x3d5650[_0x14c7('0x18d')]||_0x3d5650[_0x14c7('0x18b')][_0x14c7('0x18e')]),'to':_0x557c62['to']||'','cc':_0x557c62['cc']||'','bcc':_0x557c62['bcc']||'','subject':_0x557c62['subject'],'html':_0x557c62[_0x14c7('0x5a')],'text':_0x557c62['text']};if(this['isConfigured'](_0x557c62[_0x14c7('0x18f')])){}logger[_0x14c7('0xdc')](_0x14c7('0x190'),JSON[_0x14c7('0x6f')](_0x11b139));this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x557c62,_0x557c62[_0x14c7('0x189')]);this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x191'),_0x3d5650[_0x14c7('0x19')]));this['sendMailMessage']['sync'](this,_0x3d5650[_0x14c7('0x192')],_0x11b139);return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x193'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x194')]=function(_0x1b4039){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x195'),_0x1b4039['label']));return this['channel'][_0x14c7('0xa5')](_0x14c7('0x196'));};AGIVertices[_0x14c7('0x16')]['sendSMS']=function(_0x52783b){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x197'),_0x52783b[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x52783b[_0x14c7('0x198')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x199'));}var _0x185904=this[_0x14c7('0x32')][_0x14c7('0x6b')](this,_0x52783b[_0x14c7('0x198')]);if(!_0x185904){return this['channel'][_0x14c7('0x4f')](_0x52783b,_0x14c7('0x19a'));}var _0x502556={'body':_0x52783b[_0x14c7('0x19b')],'phone':_0x52783b['to']||'','SmsAccountId':_0x185904['id']};logger['debug'](_0x14c7('0x19c'),JSON[_0x14c7('0x6f')](_0x502556));this[_0x14c7('0x34')]['sync'](this,_0x52783b,_0x52783b[_0x14c7('0x198')]);this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x185904['name']));this['createSmsMessage'][_0x14c7('0x6b')](this,_0x502556);return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x19d'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x19e')]=function(_0x5edfc8){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x19f'),_0x5edfc8['label']));if(!this[_0x14c7('0x80')](_0x5edfc8['variable_id'])){return this[_0x14c7('0x35')]['error'](_0x5edfc8,_0x14c7('0x1a0'));}var _0x1b2248=this[_0x14c7('0x12')][_0x14c7('0x6b')](this,_0x5edfc8[_0x14c7('0xd6')]);if(!_0x1b2248){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x5edfc8,_0x14c7('0xd8'));}return this[_0x14c7('0x35')]['setVariable'](_0x1b2248,_0x5edfc8['variable_value']);};AGIVertices[_0x14c7('0x16')]['start']=function(_0x52405d){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1a1'),_0x52405d['label']));this[_0x14c7('0x35')][_0x14c7('0xa5')]('START\x20CALLY\x20SQUARE');if(_0x52405d[_0x14c7('0xb4')]===_0x14c7('0x1a2')){this['channel'][_0x14c7('0xa5')](_0x14c7('0x1a3'));return this[_0x14c7('0x35')]['answer']();}return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x1a4'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x1a5')]=function(_0x2a9d7f){logger[_0x14c7('0x2e')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2a9d7f['label']));if(!this[_0x14c7('0x80')](_0x2a9d7f['project_id'])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x2a9d7f,_0x14c7('0x1a6'));}var _0x317d0e=this[_0x14c7('0x18')][_0x14c7('0x6b')](this,_0x2a9d7f[_0x14c7('0x1a7')]);if(!this[_0x14c7('0x80')](_0x317d0e)){return this['channel'][_0x14c7('0x4f')](_0x2a9d7f,util[_0x14c7('0x2a')](_0x14c7('0x1a8'),_0x2a9d7f[_0x14c7('0x1a7')]));}if(_0x317d0e===this[_0x14c7('0x35')][_0x14c7('0x38')]){return this['channel'][_0x14c7('0x4f')](_0x2a9d7f,_0x14c7('0x1a9'));}this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x2a9d7f,_0x317d0e);var _0x2a94f6=this[_0x14c7('0x35')]['exec'](_0x14c7('0x1aa'),util[_0x14c7('0x2a')](_0x14c7('0x1ab'),config[_0x14c7('0x7')][_0x14c7('0x1ac')]||'127.0.0.1',_0x317d0e,this['channel'][_0x14c7('0x38')]));if(_0x2a94f6[_0x14c7('0x9d')]===-0x1){return _0x2a94f6;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format'](_0x14c7('0xbe'),_0x14c7('0x1aa'),_0x317d0e));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x1ad')]=function(_0x423cb9){logger['info'](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x423cb9['label']));var _0x5af163=this[_0x14c7('0x54')][_0x14c7('0x6b')](this,_0x423cb9[_0x14c7('0xb2')]);this['createSquareDetailsReport'][_0x14c7('0x6b')](this,_0x423cb9,_0x423cb9[_0x14c7('0xb2')]);if(this['isConfigured'](_0x423cb9[_0x14c7('0xd6')])){var _0x51f154=this[_0x14c7('0x12')][_0x14c7('0x6b')](this,_0x423cb9['variable_id']);if(_0x51f154){this['channel'][_0x14c7('0x98')](_0x51f154,_0x5af163);return this['channel']['noop'](util[_0x14c7('0x2a')](_0x14c7('0x1ae'),_0x423cb9[_0x14c7('0xb2')],_0x51f154));}}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x1af'),_0x423cb9[_0x14c7('0xb2')]));};AGIVertices['prototype'][_0x14c7('0x1b0')]=function(_0x38e74d){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1b1'),_0x38e74d['label']));_0x38e74d['text']=_0x38e74d[_0x14c7('0x5a')][_0x14c7('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x14c7('0x80')](_0x38e74d[_0x14c7('0x58')])){return this['channel'][_0x14c7('0xa5')]('no\x20apiKey\x20configured');}if(!this[_0x14c7('0x80')](_0x38e74d[_0x14c7('0x5a')])){return this[_0x14c7('0x35')]['noop']('no\x20text\x20configured');}this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')](_0x14c7('0x1b2'),_0x38e74d[_0x14c7('0x5a')]));var _0x5e272b=this[_0x14c7('0x57')][_0x14c7('0x6b')](this,_0x38e74d);if(_0x5e272b){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5e272b));var _0x38a1f9=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x5e272b);try{fs[_0x14c7('0x1b3')](_0x5e272b+_0x14c7('0xfc'));}catch(_0x473667){logger[_0x14c7('0x4f')](_0x473667);}return _0x38a1f9;}return this['channel'][_0x14c7('0x4f')](_0x38e74d,_0x14c7('0x1b4'));};AGIVertices[_0x14c7('0x16')]['tts']=function(_0x19271e){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1b5'),_0x19271e[_0x14c7('0x37')]));_0x19271e[_0x14c7('0x5a')]=_0x19271e[_0x14c7('0x5a')][_0x14c7('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x14c7('0x80')](_0x19271e[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x1b6'),_0x19271e['text']));var _0x375a94=this[_0x14c7('0x1b7')][_0x14c7('0x6b')](this,_0x19271e);if(_0x375a94){this[_0x14c7('0x35')]['noop'](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x375a94));var _0x5b87fe=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x375a94);try{fs['unlink'](_0x375a94+_0x14c7('0xfc'));}catch(_0x161c21){logger[_0x14c7('0x4f')](_0x161c21);}return _0x5b87fe;}return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x19271e,_0x14c7('0x1b8'));};AGIVertices[_0x14c7('0x16')]['unpause']=function(_0x12da5b){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1b9'),_0x12da5b['label']));if(!this[_0x14c7('0x80')](_0x12da5b[_0x14c7('0x14d')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x12da5b,_0x14c7('0x14e'));}logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x14f'),this[_0x14c7('0x35')]['callerid'],_0x12da5b[_0x14c7('0x14d')]));var _0x197a3f=this['agentUnpause'][_0x14c7('0x6b')](this,_0x12da5b[_0x14c7('0x14d')]);if(_0x197a3f){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x12da5b[_0x14c7('0x14d')]));this[_0x14c7('0x35')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x14c7('0x39')],_0x12da5b[_0x14c7('0x14d')]));return{'code':0xc8,'result':_0x14c7('0x151')};}else{logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x12da5b[_0x14c7('0x14d')]));this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x14c7('0x35')][_0x14c7('0x39')],_0x12da5b['findBy']));return{'code':0xc8,'result':_0x14c7('0x153')};}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x1ba')]=function(_0x12b4aa){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x12b4aa[_0x14c7('0x37')]));var _0x6fe6f9=this[_0x14c7('0x35')]['exec']('VOICEMAIL',[_0x12b4aa[_0x14c7('0x1bb')],_0x12b4aa['options']]);if(_0x6fe6f9['result']===-0x1){return _0x6fe6f9;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xbe'),_0x14c7('0x1bc'),_0x12b4aa[_0x14c7('0x1bb')]));};AGIVertices['prototype'][_0x14c7('0x1bd')]=function(_0x23180c){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1be'),_0x23180c[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x23180c[_0x14c7('0xd6')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x23180c,_0x14c7('0x1a0'));}var _0x440941=this['getVariable']['sync'](this,_0x23180c[_0x14c7('0xd6')]);if(!_0x440941){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x23180c,'no\x20variable\x20found');}var _0x5eac7b=this[_0x14c7('0x35')][_0x14c7('0x12')](_0x440941);return{'code':0xc8,'result':_0x5eac7b[_0x14c7('0x9b')]?_0x5eac7b[_0x14c7('0x9b')]:'-'};};String['prototype'][_0x14c7('0x1bf')]=function(_0x13499b,_0xa4d06d){return this[_0x14c7('0x9a')](_0x13499b)[_0x14c7('0x1c0')](_0xa4d06d);};module[_0x14c7('0x1c1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 83ec5c8..f7226c9 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 _0x0f21=['Action','QueuePause','then','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','acwTimeout','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','catch','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name'];(function(_0x3d7811,_0x59daeb){var _0x927cfa=function(_0x5ce736){while(--_0x5ce736){_0x3d7811['push'](_0x3d7811['shift']());}};_0x927cfa(++_0x59daeb);}(_0x0f21,0x194));var _0x10f2=function(_0x4461fd,_0x59d4a1){_0x4461fd=_0x4461fd-0x0;var _0x391048=_0x0f21[_0x4461fd];return _0x391048;};'use strict';var util=require(_0x10f2('0x0'));var _=require(_0x10f2('0x1'));var moment=require(_0x10f2('0x2'));var ami=require('../ami');var logger=require(_0x10f2('0x3'))(_0x10f2('0x4'));var RpcUser=require(_0x10f2('0x5'));var RpcVoiceAgentReport=require(_0x10f2('0x6'));function Acw(_0x325f23){this[_0x10f2('0x7')]=_0x325f23['voiceQueues'];this[_0x10f2('0x8')]=_0x325f23['agents'];this[_0x10f2('0x9')]=_0x325f23[_0x10f2('0x9')];this[_0x10f2('0xa')]={};ami['on'](_0x10f2('0xb'),this[_0x10f2('0xc')]['bind'](this));ami['on'](_0x10f2('0xd'),this[_0x10f2('0xe')][_0x10f2('0xf')](this));ami['on'](_0x10f2('0x10'),this['syncHangup'][_0x10f2('0xf')](this));ami['on'](_0x10f2('0x11'),this[_0x10f2('0x12')][_0x10f2('0xf')](this));ami['on'](_0x10f2('0x13'),this[_0x10f2('0x14')]['bind'](this));ami['on'](_0x10f2('0x15'),this[_0x10f2('0x16')][_0x10f2('0xf')](this));ami['on'](_0x10f2('0x17'),this[_0x10f2('0x18')][_0x10f2('0xf')](this));}function getDiff(_0x148b94){var _0x2ebdb3=moment()[_0x10f2('0x19')](0x0);var _0x305733=moment(_0x148b94)[_0x10f2('0x19')](0x0);return _0x2ebdb3[_0x10f2('0x1a')](_0x305733,_0x10f2('0x1b'));}Acw[_0x10f2('0x1c')][_0x10f2('0x1d')]=function(_0x5585fa){try{var _0x33ebb1=this;var _0x3a2e6d=this[_0x10f2('0xa')][_0x5585fa][_0x10f2('0x1e')];var _0x31e4c4=this[_0x10f2('0xa')][_0x5585fa][_0x10f2('0x1f')];var _0x31a421=this[_0x10f2('0x7')][_0x31e4c4];var _0x1c1384=![];var _0x7a3cdd=_0x10f2('0x20');if(_0x31a421[_0x10f2('0x21')]){if(_0x31a421[_0x10f2('0x22')]['name']){_0x1c1384=!![];_0x7a3cdd=_0x31a421[_0x10f2('0x22')][_0x10f2('0x23')];}}ami[_0x10f2('0x24')]({'action':_0x10f2('0x25'),'interface':_0x3a2e6d,'paused':!![],'reason':_0x7a3cdd})[_0x10f2('0x26')](function(_0x18fafa){if(_0x33ebb1[_0x10f2('0x8')][_0x3a2e6d]){return RpcUser['getAgent'](_0x33ebb1[_0x10f2('0x8')][_0x3a2e6d]['id'])[_0x10f2('0x26')](function(_0x1159ce){if(_0x1159ce&&!_0x1159ce['voicePause']){logger['info'](_0x10f2('0x27'),_0x5585fa,_0x3a2e6d,_0x31e4c4);var _0x113725=_0x33ebb1[_0x10f2('0xa')][_0x5585fa][_0x10f2('0x28')]&&_0x33ebb1[_0x10f2('0xa')][_0x5585fa][_0x10f2('0x29')]?_0x33ebb1[_0x10f2('0xa')][_0x5585fa][_0x10f2('0x29')]:_0x5585fa;return RpcUser[_0x10f2('0x2a')](_0x33ebb1[_0x10f2('0x8')][_0x3a2e6d],_0x7a3cdd,_0x113725)[_0x10f2('0x26')](function(_0x216325){if(!_0x1c1384){_0x33ebb1[_0x10f2('0x9')][_0x3a2e6d]={};logger[_0x10f2('0x2b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5585fa,_0x33ebb1[_0x10f2('0x7')][_0x31e4c4]['acwTimeout'],_0x3a2e6d,_0x31e4c4);_0x33ebb1['timers'][_0x3a2e6d][_0x10f2('0x2c')]=setTimeout(_0x33ebb1[_0x10f2('0x2d')][_0x10f2('0xf')](_0x33ebb1,_0x3a2e6d),_0x33ebb1[_0x10f2('0x7')][_0x31e4c4]['acwTimeout']*0x3e8);_0x33ebb1[_0x10f2('0x9')][_0x3a2e6d]['lastPauseAt']=moment()[_0x10f2('0x2e')](_0x10f2('0x2f'));_0x33ebb1[_0x10f2('0x9')][_0x3a2e6d]['uniqueid']=_0x5585fa;_0x33ebb1['timers'][_0x3a2e6d][_0x10f2('0x1f')]=_0x31e4c4;_0x33ebb1[_0x10f2('0x9')][_0x3a2e6d][_0x10f2('0x30')]=function(){var _0x416e23=getDiff(_0x33ebb1[_0x10f2('0x9')][_0x3a2e6d]['lastPauseAt']);clearTimeout(_0x33ebb1[_0x10f2('0x9')][_0x3a2e6d][_0x10f2('0x2c')]);_0x33ebb1[_0x10f2('0x9')][_0x3a2e6d][_0x10f2('0x2c')]=![];RpcVoiceAgentReport[_0x10f2('0x31')]({'acwtime':_0x416e23},_0x33ebb1[_0x10f2('0x9')][_0x3a2e6d][_0x10f2('0x32')],_0x3a2e6d)['then'](function(_0x2b0be4){logger[_0x10f2('0x2b')](_0x10f2('0x33'),_0x5585fa,_0x416e23,_0x2b0be4);})['catch'](function(_0x20aee2){logger[_0x10f2('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x5585fa,_0x20aee2);});delete _0x33ebb1['timers'][_0x3a2e6d];};}});}else{logger[_0x10f2('0x2b')](_0x10f2('0x35'),_0x5585fa,_0x3a2e6d,_0x31e4c4);}});}})['catch'](function(_0x1c05c7){logger[_0x10f2('0x34')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5585fa,_0x33ebb1[_0x10f2('0x7')][_0x31e4c4][_0x10f2('0x36')],_0x3a2e6d,_0x31e4c4);})[_0x10f2('0x37')](function(){delete _0x33ebb1[_0x10f2('0xa')][_0x5585fa];});}catch(_0x3a9470){logger[_0x10f2('0x34')](_0x10f2('0x38'),_0x3a9470[_0x10f2('0x39')]);}};Acw['prototype']['stopAcw']=function(_0x33f79e){try{var _0x3a548e=this;if(_0x3a548e[_0x10f2('0x9')][_0x33f79e]){_0x3a548e[_0x10f2('0x9')][_0x33f79e][_0x10f2('0x2c')]=![];var _0x1534ec=_0x3a548e['timers'][_0x33f79e]['uniqueid'];var _0x41d173=_0x3a548e[_0x10f2('0x9')][_0x33f79e][_0x10f2('0x1f')];var _0x8b4347=_0x3a548e[_0x10f2('0x7')][_0x41d173][_0x10f2('0x36')];logger[_0x10f2('0x2b')](_0x10f2('0x3a'),_0x1534ec,_0x33f79e);RpcUser[_0x10f2('0x3b')](this['agents'][_0x33f79e]);RpcVoiceAgentReport['update']({'acwtime':_0x8b4347,'agentacw':!![]},_0x1534ec,_0x33f79e)[_0x10f2('0x26')](function(_0x2b0826){logger[_0x10f2('0x2b')](_0x10f2('0x33'),_0x1534ec,_0x8b4347,_0x2b0826);})[_0x10f2('0x3c')](function(_0x133a80){logger['error'](_0x10f2('0x3d'),_0x1534ec,_0x133a80);});}else{logger[_0x10f2('0x34')](_0x10f2('0x3e'),_0x33f79e);if(_0x3a548e[_0x10f2('0x9')]){logger['info']('[ACW][TIMERS]',JSON[_0x10f2('0x3f')](_0x3a548e[_0x10f2('0x9')]));}}}catch(_0x531af7){logger['error'](_0x10f2('0x40'),_0x531af7[_0x10f2('0x39')]);}};Acw[_0x10f2('0x1c')][_0x10f2('0xc')]=function(_0x2f23c7){try{if(this['voiceQueues'][_0x2f23c7[_0x10f2('0x1f')]]&&(this['voiceQueues'][_0x2f23c7['queue']][_0x10f2('0x4')]||this[_0x10f2('0x7')][_0x2f23c7[_0x10f2('0x1f')]][_0x10f2('0x21')])){if(this[_0x10f2('0x8')][_0x2f23c7[_0x10f2('0x1e')]]){this[_0x10f2('0xa')][_0x2f23c7[_0x10f2('0x32')]]={'queue':_0x2f23c7[_0x10f2('0x1f')],'interface':_0x2f23c7[_0x10f2('0x1e')],'destlinkedid':_0x2f23c7[_0x10f2('0x29')]};}}}catch(_0x5b31fc){logger[_0x10f2('0x34')](_0x10f2('0x41'),_0x5b31fc['message']);}};Acw[_0x10f2('0x1c')]['syncAgentConnectPreview']=function(_0x1641d0){try{if(this[_0x10f2('0x7')][_0x1641d0[_0x10f2('0x1f')]]&&(this[_0x10f2('0x7')][_0x1641d0[_0x10f2('0x1f')]][_0x10f2('0x4')]||this[_0x10f2('0x7')][_0x1641d0[_0x10f2('0x1f')]][_0x10f2('0x21')])){if(this['agents'][_0x1641d0[_0x10f2('0x1e')]]){this[_0x10f2('0xa')][_0x1641d0['uniqueid']]={'queue':_0x1641d0['queue'],'interface':_0x1641d0[_0x10f2('0x1e')]};}}}catch(_0xb49cce){logger['error'](_0x10f2('0x42'),_0xb49cce[_0x10f2('0x39')]);}};Acw['prototype'][_0x10f2('0xe')]=function(_0x16d16e){try{if(this[_0x10f2('0xa')][_0x16d16e[_0x10f2('0x32')]]&&_[_0x10f2('0x43')](this[_0x10f2('0xa')][_0x16d16e[_0x10f2('0x32')]][_0x10f2('0x28')])){logger[_0x10f2('0x2b')](_0x10f2('0x44'),_0x16d16e[_0x10f2('0x32')]);this[_0x10f2('0x1d')](_0x16d16e[_0x10f2('0x32')]);}else if(this[_0x10f2('0xa')][_0x16d16e[_0x10f2('0x45')]]&&_[_0x10f2('0x43')](this[_0x10f2('0xa')][_0x16d16e['linkedid']][_0x10f2('0x28')])){logger['info'](_0x10f2('0x46'),_0x16d16e[_0x10f2('0x45')]);this[_0x10f2('0x1d')](_0x16d16e[_0x10f2('0x45')]);}}catch(_0x22c29b){logger[_0x10f2('0x34')]('[ACW][syncHangupRequest]\x20%s',_0x22c29b['message']);}};Acw[_0x10f2('0x1c')][_0x10f2('0x47')]=function(_0x42dc63){try{if(this[_0x10f2('0xa')][_0x42dc63[_0x10f2('0x32')]]&&this[_0x10f2('0xa')][_0x42dc63[_0x10f2('0x32')]][_0x10f2('0x28')]){logger[_0x10f2('0x2b')](_0x10f2('0x48'),_0x42dc63[_0x10f2('0x32')]);this['startAcw'](_0x42dc63[_0x10f2('0x32')]);}else if(this[_0x10f2('0xa')][_0x42dc63['linkedid']]&&this[_0x10f2('0xa')][_0x42dc63['linkedid']][_0x10f2('0x28')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x42dc63[_0x10f2('0x45')]);this[_0x10f2('0x1d')](_0x42dc63[_0x10f2('0x45')]);}}catch(_0x3c2cdf){logger[_0x10f2('0x34')](_0x10f2('0x49'),_0x3c2cdf[_0x10f2('0x39')]);}};Acw[_0x10f2('0x1c')][_0x10f2('0x14')]=function(_0x9c25c8){try{if(!_[_0x10f2('0x4a')](this[_0x10f2('0xa')][_0x9c25c8['transfereeuniqueid']])){this[_0x10f2('0x1d')](_0x9c25c8[_0x10f2('0x4b')]);if(this[_0x10f2('0xa')][_0x9c25c8[_0x10f2('0x4c')]]){this[_0x10f2('0xa')][_0x9c25c8[_0x10f2('0x4c')]][_0x10f2('0x28')]=!![];this[_0x10f2('0xa')][_0x9c25c8[_0x10f2('0x4d')]]=this[_0x10f2('0xa')][_0x9c25c8[_0x10f2('0x4c')]];delete this[_0x10f2('0xa')][_0x9c25c8[_0x10f2('0x4c')]];}}else if(!_[_0x10f2('0x4a')](this['channels'][_0x9c25c8[_0x10f2('0x4d')]])){this[_0x10f2('0x1d')](_0x9c25c8[_0x10f2('0x4d')]);if(this['channels'][_0x9c25c8[_0x10f2('0x4e')]]){this[_0x10f2('0xa')][_0x9c25c8['origtransfereruniqueid']][_0x10f2('0x28')]=!![];this['channels'][_0x9c25c8[_0x10f2('0x4b')]]=this['channels'][_0x9c25c8['origtransfereruniqueid']];delete this[_0x10f2('0xa')][_0x9c25c8['origtransfereruniqueid']];}}}catch(_0x2bd47b){logger[_0x10f2('0x34')]('[ACW][syncAttendedTransfer]\x20%s',_0x2bd47b[_0x10f2('0x39')]);}};Acw[_0x10f2('0x1c')]['syncBlindTransfer']=function(_0x2e817e){try{if(this['channels'][_0x2e817e[_0x10f2('0x4f')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x2e817e[_0x10f2('0x4f')]));this[_0x10f2('0x1d')](_0x2e817e[_0x10f2('0x4f')]);}else if(this[_0x10f2('0xa')][_0x2e817e['transfererlinkedid']]){logger[_0x10f2('0x2b')](_0x10f2('0x50'),JSON[_0x10f2('0x3f')](_0x2e817e['transfererlinkedid']));this[_0x10f2('0x1d')](_0x2e817e[_0x10f2('0x51')]);}}catch(_0x10fdea){logger[_0x10f2('0x34')](_0x10f2('0x52'),_0x10fdea['message']);}};Acw[_0x10f2('0x1c')][_0x10f2('0x12')]=function(_0x453dbc){try{if(this[_0x10f2('0x7')][_0x453dbc[_0x10f2('0x1f')]]&&this[_0x10f2('0x7')][_0x453dbc[_0x10f2('0x1f')]][_0x10f2('0x53')]==='all'){if(this[_0x10f2('0x8')][_0x453dbc['interface']]){logger['info'](_0x10f2('0x54'),_0x453dbc['uniqueid'],_0x453dbc[_0x10f2('0x1e')],_0x453dbc[_0x10f2('0x1f')]);return RpcUser[_0x10f2('0x2a')](this[_0x10f2('0x8')][_0x453dbc[_0x10f2('0x1e')]],_0x10f2('0x55'),_0x453dbc[_0x10f2('0x32')]);}}}catch(_0x12101d){logger[_0x10f2('0x34')](_0x10f2('0x56'),_0x12101d[_0x10f2('0x39')]);}};module[_0x10f2('0x57')]=Acw; \ No newline at end of file +var _0xca92=['transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','util','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','channels','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','info','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','destlinkedid','[ACW][syncAgentConnect]\x20%s','acw','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil'];(function(_0x3007c5,_0x34995c){var _0x44a200=function(_0x7356f6){while(--_0x7356f6){_0x3007c5['push'](_0x3007c5['shift']());}};_0x44a200(++_0x34995c);}(_0xca92,0x1c0));var _0x2ca9=function(_0x330ac6,_0x3adc83){_0x330ac6=_0x330ac6-0x0;var _0x59b845=_0xca92[_0x330ac6];return _0x59b845;};'use strict';var util=require(_0x2ca9('0x0'));var _=require(_0x2ca9('0x1'));var moment=require(_0x2ca9('0x2'));var ami=require('../ami');var logger=require(_0x2ca9('0x3'))('acw');var RpcUser=require(_0x2ca9('0x4'));var RpcVoiceAgentReport=require(_0x2ca9('0x5'));function Acw(_0x27c40){this[_0x2ca9('0x6')]=_0x27c40[_0x2ca9('0x6')];this[_0x2ca9('0x7')]=_0x27c40[_0x2ca9('0x7')];this[_0x2ca9('0x8')]=_0x27c40[_0x2ca9('0x8')];this['channels']={};ami['on'](_0x2ca9('0x9'),this[_0x2ca9('0xa')][_0x2ca9('0xb')](this));ami['on'](_0x2ca9('0xc'),this[_0x2ca9('0xd')]['bind'](this));ami['on'](_0x2ca9('0xe'),this['syncHangup'][_0x2ca9('0xb')](this));ami['on'](_0x2ca9('0xf'),this[_0x2ca9('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0x2ca9('0x11')][_0x2ca9('0xb')](this));ami['on'](_0x2ca9('0x12'),this[_0x2ca9('0x13')][_0x2ca9('0xb')](this));ami['on'](_0x2ca9('0x14'),this[_0x2ca9('0x15')]['bind'](this));}function getDiff(_0x5a76ed){var _0x5dd256=moment()[_0x2ca9('0x16')](0x0);var _0x20d918=moment(_0x5a76ed)[_0x2ca9('0x16')](0x0);return _0x5dd256[_0x2ca9('0x17')](_0x20d918,'seconds');}Acw['prototype']['startAcw']=function(_0x304730){try{var _0x3fa6d0=this;var _0xd20d15=this[_0x2ca9('0x18')][_0x304730]['interface'];var _0xbb5bad=this[_0x2ca9('0x18')][_0x304730][_0x2ca9('0x19')];var _0x239268=this[_0x2ca9('0x6')][_0xbb5bad];var _0x2628e9=![];var _0x39001e=_0x2ca9('0x1a');if(_0x239268[_0x2ca9('0x1b')]){if(_0x239268['mandatoryDispositionPause'][_0x2ca9('0x1c')]){_0x2628e9=!![];_0x39001e=_0x239268[_0x2ca9('0x1d')][_0x2ca9('0x1c')];}}ami[_0x2ca9('0x1e')]({'action':_0x2ca9('0x1f'),'interface':_0xd20d15,'paused':!![],'reason':_0x39001e})[_0x2ca9('0x20')](function(_0x13cf10){if(_0x3fa6d0[_0x2ca9('0x7')][_0xd20d15]){return RpcUser[_0x2ca9('0x21')](_0x3fa6d0['agents'][_0xd20d15]['id'])[_0x2ca9('0x20')](function(_0x1757c2){if(_0x1757c2&&!_0x1757c2[_0x2ca9('0x22')]){logger['info'](_0x2ca9('0x23'),_0x304730,_0xd20d15,_0xbb5bad);var _0x119af2=_0x3fa6d0[_0x2ca9('0x18')][_0x304730][_0x2ca9('0x24')]&&_0x3fa6d0[_0x2ca9('0x18')][_0x304730]['destlinkedid']?_0x3fa6d0[_0x2ca9('0x18')][_0x304730]['destlinkedid']:_0x304730;return RpcUser[_0x2ca9('0x25')](_0x3fa6d0[_0x2ca9('0x7')][_0xd20d15],_0x39001e,_0x119af2)[_0x2ca9('0x20')](function(_0x3f1eb){if(!_0x2628e9){_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15]={};logger[_0x2ca9('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x304730,_0x3fa6d0[_0x2ca9('0x6')][_0xbb5bad][_0x2ca9('0x27')],_0xd20d15,_0xbb5bad);_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15]['timer']=setTimeout(_0x3fa6d0['stopAcw'][_0x2ca9('0xb')](_0x3fa6d0,_0xd20d15),_0x3fa6d0[_0x2ca9('0x6')][_0xbb5bad][_0x2ca9('0x27')]*0x3e8);_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x28')]=moment()[_0x2ca9('0x29')](_0x2ca9('0x2a'));_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2b')]=_0x304730;_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15]['queue']=_0xbb5bad;_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2c')]=function(){var _0x37992d=getDiff(_0x3fa6d0['timers'][_0xd20d15][_0x2ca9('0x28')]);clearTimeout(_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2d')]);_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2d')]=![];RpcVoiceAgentReport[_0x2ca9('0x2e')]({'acwtime':_0x37992d},_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2b')],_0xd20d15)[_0x2ca9('0x20')](function(_0x96d685){logger[_0x2ca9('0x26')](_0x2ca9('0x2f'),_0x304730,_0x37992d,_0x96d685);})[_0x2ca9('0x30')](function(_0x3f0693){logger[_0x2ca9('0x31')](_0x2ca9('0x32'),_0x304730,_0x3f0693);});delete _0x3fa6d0[_0x2ca9('0x8')][_0xd20d15];};}});}else{logger['info'](_0x2ca9('0x33'),_0x304730,_0xd20d15,_0xbb5bad);}});}})['catch'](function(_0x16bcd6){logger[_0x2ca9('0x31')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x304730,_0x3fa6d0[_0x2ca9('0x6')][_0xbb5bad][_0x2ca9('0x27')],_0xd20d15,_0xbb5bad);})[_0x2ca9('0x34')](function(){delete _0x3fa6d0['channels'][_0x304730];});}catch(_0x50802f){logger['error'](_0x2ca9('0x35'),_0x50802f[_0x2ca9('0x36')]);}};Acw[_0x2ca9('0x37')]['stopAcw']=function(_0x200894){try{var _0x4dbc88=this;if(_0x4dbc88[_0x2ca9('0x8')][_0x200894]){_0x4dbc88['timers'][_0x200894][_0x2ca9('0x2d')]=![];var _0x1b2c74=_0x4dbc88['timers'][_0x200894]['uniqueid'];var _0x125821=_0x4dbc88[_0x2ca9('0x8')][_0x200894][_0x2ca9('0x19')];var _0x4d867a=_0x4dbc88[_0x2ca9('0x6')][_0x125821]['acwTimeout'];logger[_0x2ca9('0x26')](_0x2ca9('0x38'),_0x1b2c74,_0x200894);RpcUser['saveUnpause'](this[_0x2ca9('0x7')][_0x200894]);RpcVoiceAgentReport[_0x2ca9('0x2e')]({'acwtime':_0x4d867a,'agentacw':!![]},_0x1b2c74,_0x200894)[_0x2ca9('0x20')](function(_0x29c7cd){logger[_0x2ca9('0x26')](_0x2ca9('0x2f'),_0x1b2c74,_0x4d867a,_0x29c7cd);})['catch'](function(_0x13b126){logger[_0x2ca9('0x31')](_0x2ca9('0x32'),_0x1b2c74,_0x13b126);});}else{logger[_0x2ca9('0x31')](_0x2ca9('0x39'),_0x200894);if(_0x4dbc88[_0x2ca9('0x8')]){logger[_0x2ca9('0x26')]('[ACW][TIMERS]',JSON[_0x2ca9('0x3a')](_0x4dbc88[_0x2ca9('0x8')]));}}}catch(_0x445e2b){logger[_0x2ca9('0x31')](_0x2ca9('0x3b'),_0x445e2b['message']);}};Acw[_0x2ca9('0x37')][_0x2ca9('0xa')]=function(_0x498873){try{if(this[_0x2ca9('0x6')][_0x498873['queue']]&&(this[_0x2ca9('0x6')][_0x498873[_0x2ca9('0x19')]]['acw']||this[_0x2ca9('0x6')][_0x498873[_0x2ca9('0x19')]]['mandatoryDisposition'])){if(this['agents'][_0x498873[_0x2ca9('0x3c')]]){this[_0x2ca9('0x18')][_0x498873[_0x2ca9('0x2b')]]={'queue':_0x498873[_0x2ca9('0x19')],'interface':_0x498873[_0x2ca9('0x3c')],'destlinkedid':_0x498873[_0x2ca9('0x3d')]};}}}catch(_0x341a8d){logger['error'](_0x2ca9('0x3e'),_0x341a8d['message']);}};Acw[_0x2ca9('0x37')][_0x2ca9('0x15')]=function(_0x4c6bb0){try{if(this[_0x2ca9('0x6')][_0x4c6bb0[_0x2ca9('0x19')]]&&(this[_0x2ca9('0x6')][_0x4c6bb0[_0x2ca9('0x19')]][_0x2ca9('0x3f')]||this['voiceQueues'][_0x4c6bb0['queue']][_0x2ca9('0x1b')])){if(this[_0x2ca9('0x7')][_0x4c6bb0[_0x2ca9('0x3c')]]){this[_0x2ca9('0x18')][_0x4c6bb0[_0x2ca9('0x2b')]]={'queue':_0x4c6bb0[_0x2ca9('0x19')],'interface':_0x4c6bb0[_0x2ca9('0x3c')]};}}}catch(_0x25391c){logger[_0x2ca9('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x25391c[_0x2ca9('0x36')]);}};Acw['prototype']['syncHangupRequest']=function(_0x7220d4){try{if(this[_0x2ca9('0x18')][_0x7220d4[_0x2ca9('0x2b')]]&&_[_0x2ca9('0x40')](this[_0x2ca9('0x18')][_0x7220d4[_0x2ca9('0x2b')]][_0x2ca9('0x24')])){logger[_0x2ca9('0x26')](_0x2ca9('0x41'),_0x7220d4[_0x2ca9('0x2b')]);this['startAcw'](_0x7220d4[_0x2ca9('0x2b')]);}else if(this[_0x2ca9('0x18')][_0x7220d4[_0x2ca9('0x42')]]&&_[_0x2ca9('0x40')](this[_0x2ca9('0x18')][_0x7220d4[_0x2ca9('0x42')]][_0x2ca9('0x24')])){logger['info'](_0x2ca9('0x43'),_0x7220d4[_0x2ca9('0x42')]);this[_0x2ca9('0x44')](_0x7220d4[_0x2ca9('0x42')]);}}catch(_0x285f1a){logger[_0x2ca9('0x31')](_0x2ca9('0x45'),_0x285f1a[_0x2ca9('0x36')]);}};Acw[_0x2ca9('0x37')][_0x2ca9('0x46')]=function(_0x21eece){try{if(this['channels'][_0x21eece[_0x2ca9('0x2b')]]&&this[_0x2ca9('0x18')][_0x21eece[_0x2ca9('0x2b')]][_0x2ca9('0x24')]){logger['info'](_0x2ca9('0x47'),_0x21eece[_0x2ca9('0x2b')]);this[_0x2ca9('0x44')](_0x21eece[_0x2ca9('0x2b')]);}else if(this[_0x2ca9('0x18')][_0x21eece[_0x2ca9('0x42')]]&&this[_0x2ca9('0x18')][_0x21eece[_0x2ca9('0x42')]][_0x2ca9('0x24')]){logger[_0x2ca9('0x26')](_0x2ca9('0x48'),_0x21eece[_0x2ca9('0x42')]);this[_0x2ca9('0x44')](_0x21eece[_0x2ca9('0x42')]);}}catch(_0x191187){logger[_0x2ca9('0x31')]('[ACW][syncHangup]\x20%s',_0x191187[_0x2ca9('0x36')]);}};Acw[_0x2ca9('0x37')]['syncAttendedTransfer']=function(_0x21beda){try{if(!_[_0x2ca9('0x49')](this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4a')]])){this[_0x2ca9('0x44')](_0x21beda[_0x2ca9('0x4a')]);if(this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4b')]]){this['channels'][_0x21beda[_0x2ca9('0x4b')]][_0x2ca9('0x24')]=!![];this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4c')]]=this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4b')]];delete this['channels'][_0x21beda[_0x2ca9('0x4b')]];}}else if(!_[_0x2ca9('0x49')](this[_0x2ca9('0x18')][_0x21beda['transfertargetuniqueid']])){this['startAcw'](_0x21beda[_0x2ca9('0x4c')]);if(this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4d')]]){this['channels'][_0x21beda[_0x2ca9('0x4d')]]['attended']=!![];this['channels'][_0x21beda[_0x2ca9('0x4a')]]=this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4d')]];delete this['channels'][_0x21beda['origtransfereruniqueid']];}}}catch(_0x3333ad){logger['error'](_0x2ca9('0x4e'),_0x3333ad[_0x2ca9('0x36')]);}};Acw[_0x2ca9('0x37')][_0x2ca9('0x13')]=function(_0x501db6){try{if(this[_0x2ca9('0x18')][_0x501db6['transfereruniqueid']]){logger[_0x2ca9('0x26')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x2ca9('0x3a')](_0x501db6['transfereruniqueid']));this[_0x2ca9('0x44')](_0x501db6[_0x2ca9('0x4f')]);}else if(this[_0x2ca9('0x18')][_0x501db6[_0x2ca9('0x50')]]){logger[_0x2ca9('0x26')](_0x2ca9('0x51'),JSON[_0x2ca9('0x3a')](_0x501db6[_0x2ca9('0x50')]));this[_0x2ca9('0x44')](_0x501db6[_0x2ca9('0x50')]);}}catch(_0x2ab624){logger['error'](_0x2ca9('0x52'),_0x2ab624[_0x2ca9('0x36')]);}};Acw['prototype'][_0x2ca9('0x10')]=function(_0x2b3d68){try{if(this[_0x2ca9('0x6')][_0x2b3d68[_0x2ca9('0x19')]]&&this[_0x2ca9('0x6')][_0x2b3d68[_0x2ca9('0x19')]][_0x2ca9('0x53')]===_0x2ca9('0x54')){if(this[_0x2ca9('0x7')][_0x2b3d68[_0x2ca9('0x3c')]]){logger[_0x2ca9('0x26')](_0x2ca9('0x55'),_0x2b3d68['uniqueid'],_0x2b3d68['interface'],_0x2b3d68[_0x2ca9('0x19')]);return RpcUser['savePause'](this['agents'][_0x2b3d68['interface']],'Auto-Pause',_0x2b3d68[_0x2ca9('0x2b')]);}}}catch(_0x1a5c0e){logger[_0x2ca9('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1a5c0e[_0x2ca9('0x36')]);}};module[_0x2ca9('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ac5b8ee..92d1d17 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 _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x33dea8,_0xa59f51){var _0x1f4ab0=function(_0x4ec920){while(--_0x4ec920){_0x33dea8['push'](_0x33dea8['shift']());}};_0x1f4ab0(++_0xa59f51);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x7b36bb,_0x40db4f){var _0x248a91=function(_0x22a1db){while(--_0x22a1db){_0x7b36bb['push'](_0x7b36bb['shift']());}};_0x248a91(++_0x40db4f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x0b0e[_0x1147ab];return _0x55cb5a;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index a5112be..0a43be0 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x70e0,0x17b));var _0x070e=function(_0x290eab,_0x3a9885){_0x290eab=_0x290eab-0x0;var _0xd40914=_0x70e0[_0x290eab];return _0xd40914;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 0974766..c681358 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 _0x3391=['callbackat','recallme','originatecalleridnum','prototype','getCaller','dialCutDigit','exports','lodash','moment','isNil','string','voiceQueue','name','Contact','firstName','number','phone','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','callback','callbackuniqueid'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x3391,0x137));var _0x1339=function(_0x55b116,_0x2ad503){_0x55b116=_0x55b116-0x0;var _0x367621=_0x3391[_0x55b116];return _0x367621;};'use strict';var util=require('util');var _=require(_0x1339('0x0'));var moment=require(_0x1339('0x1'));function checkNameSurname(_0xd0fcd,_0x2b3378,_0x123c11){var _0x3589dd='';if(!_[_0x1339('0x2')](_0x2b3378)&&_0x1339('0x3')===typeof _0x2b3378){_0x3589dd+=_0x2b3378;}if(!_['isNil'](_0x123c11)&&_0x1339('0x3')===typeof _0x123c11){_0x3589dd+='\x20'+_0x123c11;}if(_0x3589dd!==''){return _0x3589dd;}return _0xd0fcd;}function Action(_0x34cc39,_0xa8a497,_0x16ec9f){this[_0x1339('0x4')]=_0x34cc39;this['uniqueid']=_0x16ec9f||undefined;this[_0x1339('0x5')]=checkNameSurname(_0xa8a497[_0x1339('0x6')]['phone'],_0xa8a497[_0x1339('0x6')][_0x1339('0x7')],_0xa8a497['Contact']['lastName']);this[_0x1339('0x8')]=_0xa8a497[_0x1339('0x9')];this['queue']=_0x34cc39[_0x1339('0x5')];this[_0x1339('0xa')]=_0xa8a497[_0x1339('0xa')]||![];this[_0x1339('0xb')]=_0x34cc39[_0x1339('0xb')];this['dialQueueTimeout']=_0x34cc39[_0x1339('0xc')]||0x3;this['scheduledat']=_0xa8a497['scheduledat'];this[_0x1339('0xd')]=_0xa8a497['countbusyretry'];this['countcongestionretry']=_0xa8a497[_0x1339('0xe')];this['countnoanswerretry']=_0xa8a497[_0x1339('0xf')];this[_0x1339('0x10')]=_0xa8a497[_0x1339('0x10')];this[_0x1339('0x11')]=_0xa8a497[_0x1339('0x11')];this[_0x1339('0x12')]=_0xa8a497[_0x1339('0x12')];this[_0x1339('0x13')]=_0xa8a497[_0x1339('0x13')];this[_0x1339('0x14')]=_0xa8a497[_0x1339('0x14')];this[_0x1339('0x15')]=_0xa8a497[_0x1339('0x15')];this[_0x1339('0x16')]=_0xa8a497[_0x1339('0x16')];this['UserId']=_0xa8a497[_0x1339('0x17')];this[_0x1339('0x18')]=_0xa8a497[_0x1339('0x18')];this['CampaignId']=_0xa8a497[_0x1339('0x19')];this[_0x1339('0x1a')]=_0xa8a497['id'];this['ContactFirstName']=_0xa8a497[_0x1339('0x6')][_0x1339('0x7')]||'';this[_0x1339('0x1b')]=moment()[_0x1339('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1339('0x1d')]=_0xa8a497[_0x1339('0x1d')];this[_0x1339('0x1e')]=_0xa8a497['callbackuniqueid'];this[_0x1339('0x1f')]=_0xa8a497[_0x1339('0x1f')];this[_0x1339('0x20')]=_0xa8a497[_0x1339('0x20')];this[_0x1339('0x21')]='';this['originatecalleridname']='';}Action[_0x1339('0x22')][_0x1339('0x23')]=function(){return util[_0x1339('0x1c')]('\x22%s\x22\x20<%s>',this[_0x1339('0x5')],this[_0x1339('0x4')][_0x1339('0x24')]>0x0?this[_0x1339('0x8')]['substring'](this['voiceQueue'][_0x1339('0x24')]):this[_0x1339('0x8')]);};Action[_0x1339('0x22')]['getQueue']=function(){return this['queue'];};module[_0x1339('0x25')]=Action; \ No newline at end of file +var _0x7932=['getQueue','exports','util','lodash','moment','string','isNil','voiceQueue','uniqueid','Contact','firstName','lastName','number','phone','queue','name','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring'];(function(_0x26275d,_0x38a44b){var _0x15377f=function(_0x15cc53){while(--_0x15cc53){_0x26275d['push'](_0x26275d['shift']());}};_0x15377f(++_0x38a44b);}(_0x7932,0x1ee));var _0x2793=function(_0x540615,_0x53224e){_0x540615=_0x540615-0x0;var _0x3be560=_0x7932[_0x540615];return _0x3be560;};'use strict';var util=require(_0x2793('0x0'));var _=require(_0x2793('0x1'));var moment=require(_0x2793('0x2'));function checkNameSurname(_0x3380f2,_0x29d98b,_0x4c357f){var _0x1437a2='';if(!_['isNil'](_0x29d98b)&&_0x2793('0x3')===typeof _0x29d98b){_0x1437a2+=_0x29d98b;}if(!_[_0x2793('0x4')](_0x4c357f)&&_0x2793('0x3')===typeof _0x4c357f){_0x1437a2+='\x20'+_0x4c357f;}if(_0x1437a2!==''){return _0x1437a2;}return _0x3380f2;}function Action(_0x35d713,_0x189dbc,_0xc6ac03){this[_0x2793('0x5')]=_0x35d713;this[_0x2793('0x6')]=_0xc6ac03||undefined;this['name']=checkNameSurname(_0x189dbc[_0x2793('0x7')]['phone'],_0x189dbc['Contact'][_0x2793('0x8')],_0x189dbc['Contact'][_0x2793('0x9')]);this[_0x2793('0xa')]=_0x189dbc[_0x2793('0xb')];this[_0x2793('0xc')]=_0x35d713[_0x2793('0xd')];this['active']=_0x189dbc['active']||![];this[_0x2793('0xe')]=_0x35d713[_0x2793('0xe')];this['dialQueueTimeout']=_0x35d713[_0x2793('0xf')]||0x3;this['scheduledat']=_0x189dbc['scheduledat'];this['countbusyretry']=_0x189dbc[_0x2793('0x10')];this[_0x2793('0x11')]=_0x189dbc[_0x2793('0x11')];this[_0x2793('0x12')]=_0x189dbc[_0x2793('0x12')];this[_0x2793('0x13')]=_0x189dbc[_0x2793('0x13')];this[_0x2793('0x14')]=_0x189dbc[_0x2793('0x14')];this[_0x2793('0x15')]=_0x189dbc[_0x2793('0x15')];this['countmachineretry']=_0x189dbc['countmachineretry'];this[_0x2793('0x16')]=_0x189dbc[_0x2793('0x16')];this[_0x2793('0x17')]=_0x189dbc[_0x2793('0x17')];this[_0x2793('0x18')]=_0x189dbc[_0x2793('0x18')];this[_0x2793('0x19')]=_0x189dbc[_0x2793('0x19')];this[_0x2793('0x1a')]=_0x189dbc[_0x2793('0x1a')];this[_0x2793('0x1b')]=_0x189dbc[_0x2793('0x1b')];this[_0x2793('0x1c')]=_0x189dbc['id'];this['ContactFirstName']=_0x189dbc[_0x2793('0x7')][_0x2793('0x8')]||'';this['starttime']=moment()[_0x2793('0x1d')](_0x2793('0x1e'));this[_0x2793('0x1f')]=_0x189dbc['callback'];this[_0x2793('0x20')]=_0x189dbc[_0x2793('0x20')];this['callbackat']=_0x189dbc[_0x2793('0x21')];this['recallme']=_0x189dbc['recallme'];this['originatecalleridnum']='';this[_0x2793('0x22')]='';}Action['prototype'][_0x2793('0x23')]=function(){return util['format'](_0x2793('0x24'),this[_0x2793('0xd')],this[_0x2793('0x5')][_0x2793('0x25')]>0x0?this[_0x2793('0xa')][_0x2793('0x26')](this[_0x2793('0x5')][_0x2793('0x25')]):this[_0x2793('0xa')]);};Action['prototype'][_0x2793('0x27')]=function(){return this['queue'];};module[_0x2793('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index e5b0192..698ee33 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 _0x83e0=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','holdtime','talktime','queue','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x3a41f1,_0xb42887){var _0xcf0d76=function(_0x4df2dd){while(--_0x4df2dd){_0x3a41f1['push'](_0x3a41f1['shift']());}};_0xcf0d76(++_0xb42887);}(_0x83e0,0x8f));var _0x083e=function(_0x1b9c27,_0x126fd0){_0x1b9c27=_0x1b9c27-0x0;var _0x34d9c3=_0x83e0[_0x1b9c27];return _0x34d9c3;};'use strict';var util=require(_0x083e('0x0'));var _=require(_0x083e('0x1'));var moment=require(_0x083e('0x2'));function getSeconds(_0x6c47c,_0x5c2e40){var _0x5480a8=moment(_0x6c47c)['milliseconds'](0x0);var _0x21672f=moment(_0x5c2e40)[_0x083e('0x3')](0x0);return _0x5480a8[_0x083e('0x4')](_0x21672f,_0x083e('0x5'));}function AgentComplete(_0x5d8372,_0xe687ee){this[_0x083e('0x6')]=0x4;this[_0x083e('0x7')]='Answer';this[_0x083e('0x8')]=_0x5d8372[_0x083e('0x8')];this['type']=_0x5d8372[_0x083e('0x9')];this[_0x083e('0xa')]=_0x5d8372[_0x083e('0x9')]===_0x083e('0xb')?'queue':_0x5d8372[_0x083e('0x9')];this['countbusyretry']=_0x5d8372[_0x083e('0xc')];this[_0x083e('0xd')]=_0x5d8372[_0x083e('0xd')];this[_0x083e('0xe')]=_0x5d8372[_0x083e('0xe')];this[_0x083e('0xf')]=_0x5d8372[_0x083e('0xc')]+_0x5d8372[_0x083e('0xd')]+_0x5d8372[_0x083e('0xe')]+_0x5d8372[_0x083e('0x10')]+_0x5d8372[_0x083e('0x11')]+_0x5d8372['countabandonedretry']+_0x5d8372[_0x083e('0x12')]+_0x5d8372[_0x083e('0x13')];this[_0x083e('0x10')]=_0x5d8372[_0x083e('0x10')];this[_0x083e('0x11')]=_0x5d8372[_0x083e('0x11')];this[_0x083e('0x14')]=_0x5d8372[_0x083e('0x14')];this[_0x083e('0x12')]=_0x5d8372[_0x083e('0x12')];this[_0x083e('0x13')]=_0x5d8372[_0x083e('0x13')];this[_0x083e('0x15')]=_0xe687ee[_0x083e('0x15')];this[_0x083e('0x16')]=_0x5d8372[_0x083e('0x17')];this[_0x083e('0x18')]=_0x5d8372['number'];this['starttime']=_0x5d8372[_0x083e('0x19')];this[_0x083e('0x1a')]=_0x5d8372[_0x083e('0x1a')];this[_0x083e('0x1b')]=_0x5d8372['answertime'];this[_0x083e('0x1c')]=moment()[_0x083e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x5d8372['responsetime'],_0x5d8372[_0x083e('0x19')]);this[_0x083e('0x1e')]=getSeconds(_0x5d8372[_0x083e('0x1b')],_0x5d8372[_0x083e('0x1a')]);this[_0x083e('0x1f')]=getSeconds(this[_0x083e('0x1c')],_0x5d8372[_0x083e('0x1b')]);this[_0x083e('0x20')]=_0xe687ee[_0x083e('0x20')];this['membername']=_0xe687ee[_0x083e('0x21')];this[_0x083e('0x22')]=_0xe687ee[_0x083e('0x22')];this['callback']=_0x5d8372['callback'];this[_0x083e('0x23')]=_0x5d8372[_0x083e('0x23')];this[_0x083e('0x24')]=_0x5d8372[_0x083e('0x24')];this['recallme']=_0x5d8372[_0x083e('0x25')];this[_0x083e('0x26')]=_0x5d8372[_0x083e('0x26')];this[_0x083e('0x27')]=_0x5d8372[_0x083e('0x27')];this[_0x083e('0x28')]=_0x5d8372[_0x083e('0x28')];this[_0x083e('0x29')]=_0x5d8372[_0x083e('0x29')];this[_0x083e('0x2a')]=_0x5d8372[_0x083e('0x2a')];this[_0x083e('0x2b')]=_0x5d8372['originatecalleridnum']||'';this[_0x083e('0x2c')]=_0x5d8372[_0x083e('0x2c')]||'';}module[_0x083e('0x2d')]=AgentComplete; \ No newline at end of file +var _0x2101=['YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format'];(function(_0x4d0729,_0x107590){var _0xe3c29f=function(_0x2774a0){while(--_0x2774a0){_0x4d0729['push'](_0x4d0729['shift']());}};_0xe3c29f(++_0x107590);}(_0x2101,0x12b));var _0x1210=function(_0x49a9de,_0x3f939c){_0x49a9de=_0x49a9de-0x0;var _0x45b020=_0x2101[_0x49a9de];return _0x45b020;};'use strict';var util=require(_0x1210('0x0'));var _=require(_0x1210('0x1'));var moment=require('moment');function getSeconds(_0xec4253,_0x3e1d93){var _0x2cb709=moment(_0xec4253)[_0x1210('0x2')](0x0);var _0x4e47a7=moment(_0x3e1d93)[_0x1210('0x2')](0x0);return _0x2cb709[_0x1210('0x3')](_0x4e47a7,_0x1210('0x4'));}function AgentComplete(_0x937c17,_0x50abc4){this[_0x1210('0x5')]=0x4;this[_0x1210('0x6')]=_0x1210('0x7');this['scheduledat']=_0x937c17[_0x1210('0x8')];this[_0x1210('0x9')]=_0x937c17[_0x1210('0x9')];this[_0x1210('0xa')]=_0x937c17[_0x1210('0x9')]==='outbound'?_0x1210('0xb'):_0x937c17[_0x1210('0x9')];this[_0x1210('0xc')]=_0x937c17['countbusyretry'];this[_0x1210('0xd')]=_0x937c17['countcongestionretry'];this['countnoanswerretry']=_0x937c17[_0x1210('0xe')];this[_0x1210('0xf')]=_0x937c17['countbusyretry']+_0x937c17[_0x1210('0xd')]+_0x937c17[_0x1210('0xe')]+_0x937c17[_0x1210('0x10')]+_0x937c17[_0x1210('0x11')]+_0x937c17[_0x1210('0x12')]+_0x937c17[_0x1210('0x13')]+_0x937c17[_0x1210('0x14')];this[_0x1210('0x10')]=_0x937c17[_0x1210('0x10')];this[_0x1210('0x11')]=_0x937c17[_0x1210('0x11')];this[_0x1210('0x12')]=_0x937c17[_0x1210('0x12')];this['countmachineretry']=_0x937c17[_0x1210('0x13')];this[_0x1210('0x14')]=_0x937c17[_0x1210('0x14')];this['uniqueid']=_0x50abc4[_0x1210('0x15')];this[_0x1210('0x16')]=_0x937c17['name'];this[_0x1210('0x17')]=_0x937c17[_0x1210('0x18')];this[_0x1210('0x19')]=_0x937c17['starttime'];this[_0x1210('0x1a')]=_0x937c17[_0x1210('0x1a')];this[_0x1210('0x1b')]=_0x937c17[_0x1210('0x1b')];this[_0x1210('0x1c')]=moment()[_0x1210('0x1d')](_0x1210('0x1e'));this[_0x1210('0x1f')]=getSeconds(_0x937c17[_0x1210('0x1a')],_0x937c17[_0x1210('0x19')]);this[_0x1210('0x20')]=getSeconds(_0x937c17[_0x1210('0x1b')],_0x937c17[_0x1210('0x1a')]);this[_0x1210('0x21')]=getSeconds(this[_0x1210('0x1c')],_0x937c17['answertime']);this['queue']=_0x50abc4[_0x1210('0xb')];this[_0x1210('0x22')]=_0x50abc4['membername'];this[_0x1210('0x23')]=_0x50abc4[_0x1210('0x23')];this[_0x1210('0x24')]=_0x937c17[_0x1210('0x24')];this['callbackuniqueid']=_0x937c17[_0x1210('0x25')];this[_0x1210('0x26')]=_0x937c17['callbackat'];this[_0x1210('0x27')]=_0x937c17['recallme'];this['ContactId']=_0x937c17[_0x1210('0x28')];this[_0x1210('0x29')]=_0x937c17[_0x1210('0x29')];this['UserId']=_0x937c17['UserId'];this[_0x1210('0x2a')]=_0x937c17[_0x1210('0x2a')];this[_0x1210('0x2b')]=_0x937c17[_0x1210('0x2b')];this['originatecalleridnum']=_0x937c17[_0x1210('0x2c')]||'';this['originatecalleridname']=_0x937c17[_0x1210('0x2d')]||'';}module[_0x1210('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 7ba4604..1a0c11b 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 _0xa23f=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','ringtime','holdtime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa23f,0x7c));var _0xfa23=function(_0x33ed2f,_0x32bf27){_0x33ed2f=_0x33ed2f-0x0;var _0x4d5b60=_0xa23f[_0x33ed2f];return _0x4d5b60;};'use strict';var util=require(_0xfa23('0x0'));var _=require(_0xfa23('0x1'));var moment=require('moment');function getSeconds(_0x48fd46,_0xb81edf){var _0x3f714c=moment(_0x48fd46)[_0xfa23('0x2')](0x0);var _0x3fe466=moment(_0xb81edf)['milliseconds'](0x0);return _0x3f714c[_0xfa23('0x3')](_0x3fe466,'seconds');}function Final(_0x210057){this[_0xfa23('0x4')]=_0x210057[_0xfa23('0x4')];this[_0xfa23('0x5')]=_0x210057['scheduledat'];this[_0xfa23('0x6')]=_0x210057['type'];this[_0xfa23('0x7')]=_0x210057[_0xfa23('0x6')]===_0xfa23('0x8')?_0xfa23('0x9'):_0x210057[_0xfa23('0x6')];this['countbusyretry']=_0x210057['countbusyretry'];this[_0xfa23('0xa')]=_0x210057['countcongestionretry'];this[_0xfa23('0xb')]=_0x210057['countnoanswerretry'];this[_0xfa23('0xc')]=_0x210057[_0xfa23('0xd')]+_0x210057[_0xfa23('0xa')]+_0x210057['countnoanswerretry']+_0x210057[_0xfa23('0xe')]+_0x210057[_0xfa23('0xf')]+_0x210057[_0xfa23('0x10')]+_0x210057['countmachineretry']+_0x210057['countagentrejectretry'];this[_0xfa23('0xe')]=_0x210057[_0xfa23('0xe')];this[_0xfa23('0xf')]=_0x210057[_0xfa23('0xf')];this['countabandonedretry']=_0x210057[_0xfa23('0x10')];this[_0xfa23('0x11')]=_0x210057[_0xfa23('0x11')];this[_0xfa23('0x12')]=_0x210057['countagentrejectretry'];this[_0xfa23('0x9')]=_0x210057[_0xfa23('0x9')];this[_0xfa23('0x13')]=_0x210057[_0xfa23('0x13')];this[_0xfa23('0x14')]=_0x210057['calleridnum'];this['starttime']=_0x210057['starttime'];this[_0xfa23('0x15')]=_0x210057[_0xfa23('0x15')];this['endtime']=_0x210057[_0xfa23('0x15')];this[_0xfa23('0x16')]=_0x210057[_0xfa23('0x16')]||0x0;this['holdtime']=_0x210057[_0xfa23('0x17')]||0x0;this[_0xfa23('0x18')]=_0x210057['talktime']||0x0;this[_0xfa23('0x19')]=_0x210057[_0xfa23('0x19')];this[_0xfa23('0x1a')]=_0x210057[_0xfa23('0x1a')];this[_0xfa23('0x1b')]=_0x210057[_0xfa23('0x1b')];this[_0xfa23('0x1c')]=_0x210057['recallme'];this[_0xfa23('0x1d')]=_0x210057[_0xfa23('0x1d')];this[_0xfa23('0x1e')]=_0x210057[_0xfa23('0x1e')];this['UserId']=_0x210057[_0xfa23('0x1f')];this['VoiceQueueId']=_0x210057[_0xfa23('0x20')];this[_0xfa23('0x21')]=_0x210057[_0xfa23('0x21')];this[_0xfa23('0x22')]=_0x210057[_0xfa23('0x22')]||'';this[_0xfa23('0x23')]=_0x210057[_0xfa23('0x23')]||'';}module[_0xfa23('0x24')]=Final; \ No newline at end of file +var _0xf767=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','ringtime','holdtime','talktime'];(function(_0xdf74fc,_0x109d17){var _0x56c061=function(_0x1cb85a){while(--_0x1cb85a){_0xdf74fc['push'](_0xdf74fc['shift']());}};_0x56c061(++_0x109d17);}(_0xf767,0x76));var _0x7f76=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xf767[_0x1dd532];return _0x3732aa;};'use strict';var util=require('util');var _=require(_0x7f76('0x0'));var moment=require(_0x7f76('0x1'));function getSeconds(_0x39149,_0x23f0c3){var _0x90398d=moment(_0x39149)['milliseconds'](0x0);var _0x396137=moment(_0x23f0c3)[_0x7f76('0x2')](0x0);return _0x90398d[_0x7f76('0x3')](_0x396137,_0x7f76('0x4'));}function Final(_0x5922e5){this[_0x7f76('0x5')]=_0x5922e5[_0x7f76('0x5')];this[_0x7f76('0x6')]=_0x5922e5[_0x7f76('0x6')];this[_0x7f76('0x7')]=_0x5922e5['type'];this[_0x7f76('0x8')]=_0x5922e5[_0x7f76('0x7')]===_0x7f76('0x9')?_0x7f76('0xa'):_0x5922e5['type'];this[_0x7f76('0xb')]=_0x5922e5['countbusyretry'];this[_0x7f76('0xc')]=_0x5922e5[_0x7f76('0xc')];this[_0x7f76('0xd')]=_0x5922e5[_0x7f76('0xd')];this[_0x7f76('0xe')]=_0x5922e5[_0x7f76('0xb')]+_0x5922e5['countcongestionretry']+_0x5922e5[_0x7f76('0xd')]+_0x5922e5[_0x7f76('0xf')]+_0x5922e5[_0x7f76('0x10')]+_0x5922e5[_0x7f76('0x11')]+_0x5922e5[_0x7f76('0x12')]+_0x5922e5['countagentrejectretry'];this[_0x7f76('0xf')]=_0x5922e5['countnosuchnumberretry'];this[_0x7f76('0x10')]=_0x5922e5[_0x7f76('0x10')];this['countabandonedretry']=_0x5922e5['countabandonedretry'];this['countmachineretry']=_0x5922e5[_0x7f76('0x12')];this[_0x7f76('0x13')]=_0x5922e5[_0x7f76('0x13')];this['queue']=_0x5922e5[_0x7f76('0xa')];this['calleridname']=_0x5922e5[_0x7f76('0x14')];this[_0x7f76('0x15')]=_0x5922e5[_0x7f76('0x15')];this['starttime']=_0x5922e5['starttime'];this['responsetime']=_0x5922e5['responsetime'];this['endtime']=_0x5922e5[_0x7f76('0x16')];this[_0x7f76('0x17')]=_0x5922e5[_0x7f76('0x17')]||0x0;this[_0x7f76('0x18')]=_0x5922e5['holdtime']||0x0;this[_0x7f76('0x19')]=_0x5922e5['talktime']||0x0;this[_0x7f76('0x1a')]=_0x5922e5[_0x7f76('0x1a')];this['callbackuniqueid']=_0x5922e5['callbackuniqueid'];this[_0x7f76('0x1b')]=_0x5922e5[_0x7f76('0x1b')];this['recallme']=_0x5922e5[_0x7f76('0x1c')];this['ContactId']=_0x5922e5[_0x7f76('0x1d')];this[_0x7f76('0x1e')]=_0x5922e5[_0x7f76('0x1e')];this[_0x7f76('0x1f')]=_0x5922e5[_0x7f76('0x1f')];this['VoiceQueueId']=_0x5922e5[_0x7f76('0x20')];this['CampaignId']=_0x5922e5['CampaignId'];this[_0x7f76('0x21')]=_0x5922e5[_0x7f76('0x21')]||'';this[_0x7f76('0x22')]=_0x5922e5['originatecalleridname']||'';}module[_0x7f76('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index e5697bb..4eb5a8f 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 _0x332a=['starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number'];(function(_0x586d05,_0x2bbb9b){var _0x38c0ed=function(_0x290b73){while(--_0x290b73){_0x586d05['push'](_0x586d05['shift']());}};_0x38c0ed(++_0x2bbb9b);}(_0x332a,0xba));var _0xa332=function(_0x16b148,_0x7ba829){_0x16b148=_0x16b148-0x0;var _0x552b68=_0x332a[_0x16b148];return _0x552b68;};'use strict';var util=require('util');var _=require(_0xa332('0x0'));var moment=require(_0xa332('0x1'));function getSeconds(_0x40d7c2,_0x37e7b2){var _0x283fbc=moment(_0x40d7c2)[_0xa332('0x2')](0x0);var _0xc1457b=moment(_0x37e7b2)[_0xa332('0x2')](0x0);return _0x283fbc['diff'](_0xc1457b,_0xa332('0x3'));}function Hangup(_0x390df8,_0x30be6c){this[_0xa332('0x4')]=0x4;this[_0xa332('0x5')]=_0xa332('0x6');this[_0xa332('0x7')]=_0x390df8[_0xa332('0x7')];this[_0xa332('0x8')]=_0x390df8[_0xa332('0x8')];this[_0xa332('0x9')]=_0x390df8[_0xa332('0x8')]===_0xa332('0xa')?_0xa332('0xb'):_0x390df8[_0xa332('0x8')];this[_0xa332('0xc')]=_0x390df8[_0xa332('0xc')];this['countcongestionretry']=_0x390df8[_0xa332('0xd')];this[_0xa332('0xe')]=_0x390df8[_0xa332('0xe')];this['countglobal']=_0x390df8[_0xa332('0xc')]+_0x390df8[_0xa332('0xd')]+_0x390df8[_0xa332('0xe')]+_0x390df8[_0xa332('0xf')]+_0x390df8[_0xa332('0x10')]+_0x390df8[_0xa332('0x11')]+_0x390df8[_0xa332('0x12')]+_0x390df8[_0xa332('0x13')];this[_0xa332('0xf')]=_0x390df8['countnosuchnumberretry'];this['countdropretry']=_0x390df8[_0xa332('0x10')];this[_0xa332('0x11')]=_0x390df8[_0xa332('0x11')];this[_0xa332('0x12')]=_0x390df8[_0xa332('0x12')];this[_0xa332('0x13')]=_0x390df8[_0xa332('0x13')];this[_0xa332('0x14')]=_0x30be6c[_0xa332('0x14')];this[_0xa332('0x15')]=_0x390df8[_0xa332('0x16')];this['calleridnum']=_0x390df8[_0xa332('0x17')];this[_0xa332('0x18')]=_0x390df8[_0xa332('0x18')];this[_0xa332('0x19')]=_0x390df8[_0xa332('0x19')];this['endtime']=moment()[_0xa332('0x1a')](_0xa332('0x1b'));this[_0xa332('0x1c')]=getSeconds(_0x390df8[_0xa332('0x19')],_0x390df8['starttime']);this['holdtime']=0x0;this[_0xa332('0x1d')]=getSeconds(this['endtime'],_0x390df8[_0xa332('0x19')]);this[_0xa332('0xb')]=_0x390df8[_0xa332('0xb')];this[_0xa332('0x1e')]='IVR';this[_0xa332('0x1f')]=_0x30be6c[_0xa332('0x20')];this['callback']=_0x390df8[_0xa332('0x21')];this['callbackuniqueid']=_0x390df8['callbackuniqueid'];this[_0xa332('0x22')]=_0x390df8[_0xa332('0x22')];this[_0xa332('0x23')]=_0x390df8[_0xa332('0x23')];this['ContactId']=_0x390df8[_0xa332('0x24')];this[_0xa332('0x25')]=_0x390df8[_0xa332('0x25')];this[_0xa332('0x26')]=_0x390df8[_0xa332('0x26')];this[_0xa332('0x27')]=_0x390df8[_0xa332('0x27')];this['CampaignId']=_0x390df8[_0xa332('0x28')];}module[_0xa332('0x29')]=Hangup; \ No newline at end of file +var _0x1fde=['membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1fde,0x186));var _0xe1fd=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x1fde[_0x382a62];return _0x490a25;};'use strict';var util=require('util');var _=require(_0xe1fd('0x0'));var moment=require(_0xe1fd('0x1'));function getSeconds(_0x32d53e,_0x313bac){var _0x3278cd=moment(_0x32d53e)['milliseconds'](0x0);var _0x545585=moment(_0x313bac)[_0xe1fd('0x2')](0x0);return _0x3278cd[_0xe1fd('0x3')](_0x545585,_0xe1fd('0x4'));}function Hangup(_0x3c6568,_0x4b7f0c){this['state']=0x4;this[_0xe1fd('0x5')]=_0xe1fd('0x6');this[_0xe1fd('0x7')]=_0x3c6568[_0xe1fd('0x7')];this[_0xe1fd('0x8')]=_0x3c6568[_0xe1fd('0x8')];this[_0xe1fd('0x9')]=_0x3c6568[_0xe1fd('0x8')]===_0xe1fd('0xa')?_0xe1fd('0xb'):_0x3c6568[_0xe1fd('0x8')];this[_0xe1fd('0xc')]=_0x3c6568['countbusyretry'];this[_0xe1fd('0xd')]=_0x3c6568[_0xe1fd('0xd')];this[_0xe1fd('0xe')]=_0x3c6568[_0xe1fd('0xe')];this[_0xe1fd('0xf')]=_0x3c6568[_0xe1fd('0xc')]+_0x3c6568[_0xe1fd('0xd')]+_0x3c6568[_0xe1fd('0xe')]+_0x3c6568[_0xe1fd('0x10')]+_0x3c6568[_0xe1fd('0x11')]+_0x3c6568[_0xe1fd('0x12')]+_0x3c6568[_0xe1fd('0x13')]+_0x3c6568[_0xe1fd('0x14')];this[_0xe1fd('0x10')]=_0x3c6568[_0xe1fd('0x10')];this[_0xe1fd('0x11')]=_0x3c6568['countdropretry'];this[_0xe1fd('0x12')]=_0x3c6568['countabandonedretry'];this[_0xe1fd('0x13')]=_0x3c6568[_0xe1fd('0x13')];this[_0xe1fd('0x14')]=_0x3c6568[_0xe1fd('0x14')];this['uniqueid']=_0x4b7f0c[_0xe1fd('0x15')];this[_0xe1fd('0x16')]=_0x3c6568[_0xe1fd('0x17')];this[_0xe1fd('0x18')]=_0x3c6568[_0xe1fd('0x19')];this['starttime']=_0x3c6568[_0xe1fd('0x1a')];this[_0xe1fd('0x1b')]=_0x3c6568[_0xe1fd('0x1b')];this[_0xe1fd('0x1c')]=moment()[_0xe1fd('0x1d')](_0xe1fd('0x1e'));this[_0xe1fd('0x1f')]=getSeconds(_0x3c6568[_0xe1fd('0x1b')],_0x3c6568[_0xe1fd('0x1a')]);this['holdtime']=0x0;this[_0xe1fd('0x20')]=getSeconds(this['endtime'],_0x3c6568['responsetime']);this['queue']=_0x3c6568[_0xe1fd('0xb')];this[_0xe1fd('0x21')]=_0xe1fd('0x22');this[_0xe1fd('0x23')]=_0x4b7f0c[_0xe1fd('0x24')];this[_0xe1fd('0x25')]=_0x3c6568[_0xe1fd('0x25')];this[_0xe1fd('0x26')]=_0x3c6568[_0xe1fd('0x26')];this[_0xe1fd('0x27')]=_0x3c6568[_0xe1fd('0x27')];this[_0xe1fd('0x28')]=_0x3c6568['recallme'];this['ContactId']=_0x3c6568[_0xe1fd('0x29')];this[_0xe1fd('0x2a')]=_0x3c6568[_0xe1fd('0x2a')];this[_0xe1fd('0x2b')]=_0x3c6568[_0xe1fd('0x2b')];this[_0xe1fd('0x2c')]=_0x3c6568[_0xe1fd('0x2c')];this[_0xe1fd('0x2d')]=_0x3c6568['CampaignId'];}module[_0xe1fd('0x2e')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 9ad0819..a06a0e3 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 _0x99b9=['countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x99b9,0x7d));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x999b('0x0'));function getSeconds(_0x2ac811,_0x4daffe){var _0xcd2f28=moment(_0x2ac811)[_0x999b('0x1')](0x0);var _0x3ed3b5=moment(_0x4daffe)[_0x999b('0x1')](0x0);return _0xcd2f28['diff'](_0x3ed3b5,_0x999b('0x2'));}function History(_0x25b246){this[_0x999b('0x3')]=_0x25b246[_0x999b('0x3')];this['scheduledat']=_0x25b246['scheduledat']||undefined;this[_0x999b('0x4')]=_0x25b246[_0x999b('0x4')];this[_0x999b('0x5')]=_0x25b246[_0x999b('0x4')]===_0x999b('0x6')?_0x999b('0x7'):_0x25b246[_0x999b('0x4')];this[_0x999b('0x8')]=_0x25b246[_0x999b('0x8')];this['countcongestionretry']=_0x25b246['countcongestionretry'];this[_0x999b('0x9')]=_0x25b246[_0x999b('0x9')];this['countglobal']=_0x25b246[_0x999b('0x8')]+_0x25b246[_0x999b('0xa')]+_0x25b246[_0x999b('0x9')]+_0x25b246[_0x999b('0xb')]+_0x25b246[_0x999b('0xc')]+_0x25b246['countabandonedretry']+_0x25b246[_0x999b('0xd')]+_0x25b246[_0x999b('0xe')];this[_0x999b('0xb')]=_0x25b246['countnosuchnumberretry'];this[_0x999b('0xc')]=_0x25b246[_0x999b('0xc')];this[_0x999b('0xf')]=_0x25b246[_0x999b('0xf')];this[_0x999b('0xd')]=_0x25b246[_0x999b('0xd')];this[_0x999b('0xe')]=_0x25b246[_0x999b('0xe')];this[_0x999b('0x7')]=_0x25b246[_0x999b('0x7')];this[_0x999b('0x10')]=_0x25b246[_0x999b('0x11')];this[_0x999b('0x12')]=_0x25b246[_0x999b('0x13')];this[_0x999b('0x14')]=_0x25b246[_0x999b('0x14')];this[_0x999b('0x15')]=_0x25b246[_0x999b('0x15')];this[_0x999b('0x16')]=_0x25b246[_0x999b('0x15')];this['ringtime']=getSeconds(_0x25b246[_0x999b('0x15')],_0x25b246[_0x999b('0x14')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x25b246[_0x999b('0x17')];this[_0x999b('0x18')]=_0x25b246[_0x999b('0x18')];this[_0x999b('0x19')]=_0x25b246[_0x999b('0x19')];this[_0x999b('0x1a')]=_0x25b246[_0x999b('0x1a')];this[_0x999b('0x1b')]=_0x25b246[_0x999b('0x1b')];this['ListId']=_0x25b246[_0x999b('0x1c')];this[_0x999b('0x1d')]=_0x25b246['UserId'];this[_0x999b('0x1e')]=_0x25b246[_0x999b('0x1e')];this[_0x999b('0x1f')]=_0x25b246[_0x999b('0x1f')];this[_0x999b('0x20')]=_0x25b246[_0x999b('0x20')]||'';this[_0x999b('0x21')]=_0x25b246[_0x999b('0x21')]||'';}module[_0x999b('0x22')]=History; \ No newline at end of file +var _0x7373=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x3079a8,_0x3cfa9b){var _0x121cdc=function(_0x5bdc61){while(--_0x5bdc61){_0x3079a8['push'](_0x3079a8['shift']());}};_0x121cdc(++_0x3cfa9b);}(_0x7373,0x182));var _0x3737=function(_0x378c46,_0x2bedfd){_0x378c46=_0x378c46-0x0;var _0x563cb5=_0x7373[_0x378c46];return _0x563cb5;};'use strict';var util=require(_0x3737('0x0'));var _=require(_0x3737('0x1'));var moment=require(_0x3737('0x2'));function getSeconds(_0x41be37,_0x4c356b){var _0x5c4ee7=moment(_0x41be37)[_0x3737('0x3')](0x0);var _0x5f2fae=moment(_0x4c356b)[_0x3737('0x3')](0x0);return _0x5c4ee7[_0x3737('0x4')](_0x5f2fae,_0x3737('0x5'));}function History(_0x12b08a){this['uniqueid']=_0x12b08a['uniqueid'];this[_0x3737('0x6')]=_0x12b08a[_0x3737('0x6')]||undefined;this['type']=_0x12b08a[_0x3737('0x7')];this[_0x3737('0x8')]=_0x12b08a[_0x3737('0x7')]===_0x3737('0x9')?_0x3737('0xa'):_0x12b08a[_0x3737('0x7')];this[_0x3737('0xb')]=_0x12b08a[_0x3737('0xb')];this['countcongestionretry']=_0x12b08a['countcongestionretry'];this[_0x3737('0xc')]=_0x12b08a[_0x3737('0xc')];this['countglobal']=_0x12b08a[_0x3737('0xb')]+_0x12b08a[_0x3737('0xd')]+_0x12b08a['countnoanswerretry']+_0x12b08a[_0x3737('0xe')]+_0x12b08a[_0x3737('0xf')]+_0x12b08a[_0x3737('0x10')]+_0x12b08a[_0x3737('0x11')]+_0x12b08a[_0x3737('0x12')];this['countnosuchnumberretry']=_0x12b08a[_0x3737('0xe')];this[_0x3737('0xf')]=_0x12b08a[_0x3737('0xf')];this[_0x3737('0x10')]=_0x12b08a['countabandonedretry'];this[_0x3737('0x11')]=_0x12b08a[_0x3737('0x11')];this[_0x3737('0x12')]=_0x12b08a[_0x3737('0x12')];this[_0x3737('0xa')]=_0x12b08a['queue'];this['calleridname']=_0x12b08a[_0x3737('0x13')];this['calleridnum']=_0x12b08a[_0x3737('0x14')];this[_0x3737('0x15')]=_0x12b08a[_0x3737('0x15')];this[_0x3737('0x16')]=_0x12b08a[_0x3737('0x16')];this[_0x3737('0x17')]=_0x12b08a[_0x3737('0x16')];this[_0x3737('0x18')]=getSeconds(_0x12b08a[_0x3737('0x16')],_0x12b08a[_0x3737('0x15')]);this[_0x3737('0x19')]=0x0;this[_0x3737('0x1a')]=0x0;this[_0x3737('0x1b')]=_0x12b08a[_0x3737('0x1b')];this[_0x3737('0x1c')]=_0x12b08a[_0x3737('0x1c')];this[_0x3737('0x1d')]=_0x12b08a[_0x3737('0x1d')];this[_0x3737('0x1e')]=_0x12b08a['recallme'];this['ContactId']=_0x12b08a[_0x3737('0x1f')];this[_0x3737('0x20')]=_0x12b08a['ListId'];this['UserId']=_0x12b08a[_0x3737('0x21')];this[_0x3737('0x22')]=_0x12b08a[_0x3737('0x22')];this['CampaignId']=_0x12b08a['CampaignId'];this['originatecalleridnum']=_0x12b08a[_0x3737('0x23')]||'';this[_0x3737('0x24')]=_0x12b08a[_0x3737('0x24')]||'';}module[_0x3737('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index c49fac4..7bbed89 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 _0x266f=['[getContactDialer2][Empty]','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','prototype','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','channel','catch','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','merge','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','status','unmonitored','saveInDb','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','uniqueid','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countglobal','amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialAMDActive','dialGlobalMaxRetry','add','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','droptime','dialQueueTimeout','dropreason','TIMEOUT','dialDropRetryFrequency','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','queueBooked','push','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','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','command','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','power','handlePower','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','Agent','user:%s','launchHandleIvr','handleIvr','dialGlobalInterval','checkIfTimeIntervals','checkDialMethod','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','reachable','user:dialPreviewRecallReminder','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','createdAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','variables','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','reason','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','outboundReCallsDay','dialRecallInQueue','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','ivrTotalCallsDays','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','RUNNING','[actionOriginate]\x20','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/setting','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','loopCampaigns','getSettings','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','diff','seconds','emit','outbound','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','stringify','type','ivr','format','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','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','handlePredictive','clearing\x20variable\x20handle\x20predictive','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','debug','inspect','error','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','contacts'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x266f,0x18f));var _0xf266=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x266f[_0x3bd52b];return _0x1e5b89;};'use strict';var util=require(_0xf266('0x0'));var _=require('lodash');var uuid=require(_0xf266('0x1'));var moment=require(_0xf266('0x2'));var rr=require('rr');var md5=require(_0xf266('0x3'));var Redis=require(_0xf266('0x4'));var ut=require(_0xf266('0x5'));var config=require('../../../config/environment/');var logger=require(_0xf266('0x6'))('dialer');var loggerBooked=require(_0xf266('0x6'))(_0xf266('0x7'));var loggerPredictive=require(_0xf266('0x6'))('predictive');var loggerPredictiveCalls=require(_0xf266('0x6'))(_0xf266('0x8'));var loggerSyncQueueSummary=require(_0xf266('0x6'))(_0xf266('0x9'));var ami=require(_0xf266('0xa'));config[_0xf266('0xb')]=_[_0xf266('0xc')](config['redis'],{'host':_0xf266('0xd'),'port':0x18eb});var io=require(_0xf266('0xe'))(new Redis(config[_0xf266('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xf266('0xf'));var cmHopperAdditionalPhone=require(_0xf266('0x10'));var cmHopperBlack=require(_0xf266('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xf266('0x12'));var Action=require(_0xf266('0x13'));var History=require('./history');var Final=require(_0xf266('0x14'));var AgentComplete=require(_0xf266('0x15'));var QueueCallerAbandon=require(_0xf266('0x16'));var Hangup=require(_0xf266('0x17'));var ipAgi=process[_0xf266('0x18')]['XCALLY_IP_AGI']||_0xf266('0x19');var strategy={'rrmemory':_0xf266('0x1a'),'roundrobin':_0xf266('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xf266('0x1c')]=function(_0xd9ba1a){this['tail']=this[_0xf266('0x1d')]?this['tail'][_0xf266('0x1e')](_0xd9ba1a):_0xd9ba1a();};function Dialer(_0x1e6bf8,_0x37a835){this[_0xf266('0x1f')]=new Sequence();this[_0xf266('0x20')]=_0x37a835;this[_0xf266('0x21')]=_0x1e6bf8[_0xf266('0x21')];this[_0xf266('0x22')]=_0x1e6bf8[_0xf266('0x22')];this[_0xf266('0x23')]=_0x1e6bf8[_0xf266('0x23')];this[_0xf266('0x24')]=_0x1e6bf8[_0xf266('0x24')];this[_0xf266('0x25')]=config[_0xf266('0x25')]||0x2;this[_0xf266('0x26')]={};this[_0xf266('0x27')]={};this[_0xf266('0x28')]={};this[_0xf266('0x29')]={};this[_0xf266('0x2a')]={};this['startPredictive']={};this['startProgressive']={};this[_0xf266('0x2b')]={};this['queueBooked']={};this[_0xf266('0x2c')]={};ami['on'](_0xf266('0x2d'),this[_0xf266('0x2e')]['bind'](this));ami['on'](_0xf266('0x2f'),this[_0xf266('0x30')][_0xf266('0x31')](this));ami['on'](_0xf266('0x32'),this[_0xf266('0x33')][_0xf266('0x31')](this));ami['on'](_0xf266('0x34'),this[_0xf266('0x35')][_0xf266('0x31')](this));ami['on'](_0xf266('0x36'),this[_0xf266('0x9')][_0xf266('0x31')](this));ami['on'](_0xf266('0x37'),this['syncQueueSummaryComplete'][_0xf266('0x31')](this));ami['on'](_0xf266('0x38'),this[_0xf266('0x39')][_0xf266('0x31')](this));ami['on']('newexten',this[_0xf266('0x3a')]['bind'](this));ami['on'](_0xf266('0x3b'),this[_0xf266('0x3c')]['bind'](this));ami['on']('queuemember',this[_0xf266('0x3d')]['bind'](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));this[_0xf266('0x3e')]();this['loopClearZombieChannels']();RpcSetting[_0xf266('0x3f')]()['then'](function(_0x2ccdac){previewRecallmeReminderInterval=_0x2ccdac['previewRecallmeReminderInterval'];});}function isNotNull(_0x8a07){return _0x8a07!==null&&!_[_0xf266('0x40')](_0x8a07);}function checkIsLoggedIn(_0x4d07e4,_0x5bcf82){return function(){if(_0x5bcf82<=0x0){_0x4d07e4[_0xf266('0x41')]=_0xf266('0x42');throw _0x4d07e4['name']+_0xf266('0x43');}};}function isActive(_0x4658fc){return _0x4658fc;}function checkIsActive(_0xc16d6,_0x1822a3){return function(){if(!isActive(_0x1822a3)){_0xc16d6['message']=_0xf266('0x44');throw _0xc16d6[_0xf266('0x45')]+_0xf266('0x46');}};}function checkInterval(_0x38b8b2){return function(){if(!isNotNull(_0x38b8b2[_0xf266('0x47')])){_0x38b8b2[_0xf266('0x41')]='INTERVAL_IS_NULL';throw _0x38b8b2['name']+_0xf266('0x48');}if(!isNotNull(_0x38b8b2[_0xf266('0x47')][_0xf266('0x49')])){_0x38b8b2[_0xf266('0x41')]=_0xf266('0x4a');throw _0x38b8b2[_0xf266('0x45')]+_0xf266('0x48');}if(!isNotNull(_[_0xf266('0x4b')](_0x38b8b2[_0xf266('0x47')]['Intervals']))){_0x38b8b2['message']='INTERVAL_IS_NULL';throw _0x38b8b2[_0xf266('0x45')]+_0xf266('0x48');}};}function msgResponse(_0x306820,_0x10d661,_0x5acd25){return{'action':_0x306820,'response':_0x10d661,'message':_0x5acd25,'stack':_0x5acd25};}function myreject(_0x20e938){return function(_0x1787c5){return _0x20e938(msgResponse(_0xf266('0x4c'),_0xf266('0x4d'),JSON['stringify'](_0x1787c5)));};}function getSeconds(_0xf44421,_0x21292b){var _0x549781=moment(_0xf44421)['milliseconds'](0x0);var _0x245ca2=moment(_0x21292b)['milliseconds'](0x0);return _0x549781[_0xf266('0x4e')](_0x245ca2,_0xf266('0x4f'));}function emit(_0x2ef7d8,_0x13dbc5,_0x55d61d){io['to'](_0x2ef7d8)[_0xf266('0x50')](_0x13dbc5,_0x55d61d);}function emitVoiceQueueSummary(_0x45bfbc){if(_0x45bfbc['type']===_0xf266('0x51')){var _0x157074={'id':_0x45bfbc['id'],'name':_0x45bfbc[_0xf266('0x45')],'strategy':_0x45bfbc[_0xf266('0x52')],'answered':_0x45bfbc[_0xf266('0x53')],'available':_0x45bfbc[_0xf266('0x54')],'loggedIn':_0x45bfbc[_0xf266('0x55')],'pTalking':_0x45bfbc['pTalking'],'sumBillable':_0x45bfbc['sumBillable'],'sumDuration':_0x45bfbc[_0xf266('0x56')],'sumHoldTime':_0x45bfbc[_0xf266('0x57')]||0x0,'talking':_0x45bfbc[_0xf266('0x58')],'total':_0x45bfbc[_0xf266('0x59')],'type':_0x45bfbc['type'],'unmanaged':_0x45bfbc[_0xf266('0x5a')],'abandoned':_0x45bfbc['abandoned'],'waiting':_0x45bfbc['waiting'],'loggedInDb':_0x45bfbc[_0xf266('0x5b')],'dialActive':_0x45bfbc[_0xf266('0x5c')],'dialMethod':_0x45bfbc[_0xf266('0x5d')],'dialOriginateCallerIdName':_0x45bfbc[_0xf266('0x5e')],'dialOriginateCallerIdNumber':_0x45bfbc['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x45bfbc[_0xf266('0x5f')],'dialPrefix':_0x45bfbc[_0xf266('0x60')],'outboundAnswerAgiCallsDay':_0x45bfbc['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x45bfbc[_0xf266('0x61')],'outboundBlacklistCallsDay':_0x45bfbc['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x45bfbc[_0xf266('0x62')],'outboundCongestionCallsDay':_0x45bfbc[_0xf266('0x63')],'outboundDropCallsDayACS':_0x45bfbc['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x45bfbc['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x45bfbc[_0xf266('0x64')],'outboundNoAnswerCallsDay':_0x45bfbc['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x45bfbc['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x45bfbc[_0xf266('0x65')],'outboundReCallsDay':_0x45bfbc['outboundReCallsDay'],'outboundRejectCallsDay':_0x45bfbc[_0xf266('0x66')],'outboundUnknownCallsDay':_0x45bfbc[_0xf266('0x67')],'predictiveIntervalAnsweredCalls':_0x45bfbc[_0xf266('0x68')],'predictiveIntervalAvgHoldtime':_0x45bfbc[_0xf266('0x69')],'predictiveIntervalAvgTalktime':_0x45bfbc[_0xf266('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x45bfbc['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x45bfbc[_0xf266('0x6b')],'predictiveIntervalErlangCalls':_0x45bfbc['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x45bfbc[_0xf266('0x6c')],'predictiveIntervalHitRate':_0x45bfbc['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x45bfbc['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x45bfbc[_0xf266('0x6d')],'predictiveIntervalAvailable':_0x45bfbc[_0xf266('0x6e')],'predictiveIntervalTotalCalls':_0x45bfbc[_0xf266('0x6f')],'message':_0x45bfbc[_0xf266('0x41')],'originated':_0x45bfbc[_0xf266('0x70')],'erlangCalls':_0x45bfbc[_0xf266('0x71')],'erlangCallToSecond':_0x45bfbc[_0xf266('0x72')],'erlangAbandonmentRate':_0x45bfbc[_0xf266('0x73')],'erlangBusyFactor':_0x45bfbc[_0xf266('0x74')],'startPredictive':_0x45bfbc[_0xf266('0x75')],'startProgressive':_0x45bfbc[_0xf266('0x76')]};if(_0x45bfbc[_0xf266('0x77')]){_0x157074[_0xf266('0x77')]={'id':_0x45bfbc[_0xf266('0x77')]['id'],'name':_0x45bfbc[_0xf266('0x77')][_0xf266('0x45')],'active':_0x45bfbc['Trunk'][_0xf266('0x78')],'callerid':_0x45bfbc['Trunk']['callerid']};}if(_0x45bfbc[_0xf266('0x47')]){_0x157074['Interval']={'id':_0x45bfbc['Interval']['id'],'name':_0x45bfbc[_0xf266('0x47')][_0xf266('0x45')]};}var _0x1c9514=md5(JSON[_0xf266('0x79')](_0x157074));if(_0x45bfbc[_0xf266('0x3')]!==_0x1c9514){_0x45bfbc[_0xf266('0x3')]=_0x1c9514;emit(util['format']('voice:queue:%s',_0x157074[_0xf266('0x45')]),'voice_queue:save',_0x157074);}}}function emitCampaignSummary(_0x585803){if(_0x585803[_0xf266('0x7a')]===_0xf266('0x7b')){emit(util[_0xf266('0x7c')](_0xf266('0x7d'),_0x585803[_0xf266('0x45')]),_0xf266('0x7e'),_0x585803);}}function checkGetDataPredictive(_0x17fcae){if(isNotNull(_0x17fcae)&&!_['isEmpty'](_0x17fcae)){loggerPredictive[_0xf266('0x7f')](_0xf266('0x80'));loggerPredictive[_0xf266('0x7f')](_0xf266('0x81'),_0x17fcae[_0xf266('0x6f')]);loggerPredictive[_0xf266('0x7f')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17fcae['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xf266('0x7f')](_0xf266('0x82'),_0x17fcae[_0xf266('0x6b')]);loggerPredictive[_0xf266('0x7f')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17fcae[_0xf266('0x83')]);loggerPredictive[_0xf266('0x7f')](_0xf266('0x84'),_0x17fcae[_0xf266('0x69')]);loggerPredictive['info'](_0xf266('0x85'),_0x17fcae[_0xf266('0x6a')]);loggerPredictive[_0xf266('0x7f')](_0xf266('0x86'));if(_0x17fcae[_0xf266('0x6f')]>0x0){if(!_['isUndefined'](_0x17fcae[_0xf266('0x6a')])&&_0x17fcae[_0xf266('0x6a')]>0x0){return!![];}loggerPredictive[_0xf266('0x7f')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xf266('0x40')](_0x17fcae['predictiveIntervalAvgHoldtime'])&&_0x17fcae[_0xf266('0x69')]>0x0){return!![];}loggerPredictive[_0xf266('0x7f')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xf266('0x7f')](_0xf266('0x87'));}}else{loggerPredictive[_0xf266('0x7f')](_0xf266('0x88'));}return![];}function mergeDataErlangB(_0x47955f){return function(_0x56661c){loggerPredictive['info'](_0xf266('0x89'));loggerPredictive[_0xf266('0x7f')](_0xf266('0x8a'),_0x56661c['erlangCalls']);loggerPredictive[_0xf266('0x7f')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x56661c[_0xf266('0x72')]);loggerPredictive[_0xf266('0x7f')](_0xf266('0x8b'),_0x56661c[_0xf266('0x73')]);loggerPredictive['info'](_0xf266('0x8c'),_0x56661c[_0xf266('0x74')]);loggerPredictive[_0xf266('0x7f')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x56661c[_0xf266('0x73')]);loggerPredictive[_0xf266('0x7f')]('---------------------------');_['merge'](_0x47955f,_0x56661c);};}function getDiff(_0x4caa61){var _0x36f2c5=moment()[_0xf266('0x8d')](0x0);var _0x482c5e=moment(_0x4caa61)[_0xf266('0x8d')](0x0);return _0x36f2c5[_0xf266('0x4e')](_0x482c5e,_0xf266('0x4f'));}function ifInterval(_0x4eae4e,_0x3dc967){if(_[_0xf266('0x40')](_0x3dc967)){return![];}return getDiff(_0x3dc967)<_0x4eae4e*0x3c;}function freeVariablesPredictive(_0x5e1b7d){if(isNotNull(_0x5e1b7d)){if(!_['isUndefined'](_0x5e1b7d['startProgressive'])){_0x5e1b7d['startProgressive']=undefined;loggerPredictive[_0xf266('0x7f')](_0x5e1b7d[_0xf266('0x45')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xf266('0x40')](_0x5e1b7d['startPredictive'])){_0x5e1b7d['startPredictive']=undefined;loggerPredictive['info'](_0x5e1b7d['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xf266('0x40')](_0x5e1b7d[_0xf266('0x8e')])){clearInterval(_0x5e1b7d['handlePredictive']);_0x5e1b7d['handlePredictive']=undefined;loggerPredictive['info'](_0x5e1b7d['name'],_0xf266('0x8f'));}}}function erlangb(_0x295ca2,_0x46aef6){if(_0x46aef6===0x0){return 0x0;}var _0x35f8fd=0x1;for(var _0x1962cf=0x1;_0x1962cf<=_0x46aef6;_0x1962cf+=0x1){_0x35f8fd=0x1+_0x35f8fd*_0x1962cf/_0x295ca2;}return 0x1/_0x35f8fd;}function isVoiceQueueOutbound(_0x386818){return _0x386818==='outbound';}function isNotPreview(_0x12ba0a){return _0x12ba0a!=='preview';}function isCampaignIvr(_0xbbf682){return _0xbbf682===_0xf266('0x7b');}function getCallerId(_0xf4cea5,_0x4eaa7c,_0x1f8ac1){if(!_[_0xf266('0x40')](_0x1f8ac1)&&typeof _0x1f8ac1==='string'&&!_[_0xf266('0x4b')](_0x1f8ac1)){if(!_['isUndefined'](_0x4eaa7c)&&typeof _0x4eaa7c==='string'&&!_['isEmpty'](_0x4eaa7c)){return util['format'](_0xf266('0x90'),_0x4eaa7c,_0x1f8ac1);}return util[_0xf266('0x7c')]('\x22%s\x22\x20<%s>',_0x1f8ac1,_0x1f8ac1);}if(!_[_0xf266('0x40')](_0xf4cea5)&&typeof _0xf4cea5===_0xf266('0x91')&&!_[_0xf266('0x4b')](_0xf4cea5)){return _0xf4cea5;}return _0xf266('0x92');}function loggerCatchQueueSummary(_0x7891b0,_0x4c5175){return function(_0x3e6ae6){freeVariablesPredictive(_0x4c5175);emitVoiceQueueSummary(_0x4c5175);emitCampaignSummary(_0x4c5175);loggerSyncQueueSummary[_0xf266('0x93')](_0x7891b0,util[_0xf266('0x94')](_0x3e6ae6,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5ab0a2,_0xdb7ff5){return function(_0xca8350){loggerPredictive[_0xf266('0x95')](_0xdb7ff5[_0xf266('0x45')],_0x5ab0a2);loggerPredictive['error'](_0xca8350['stack']);freeVariablesPredictive(_0xdb7ff5);};}function loggerCatch(_0x2d4076){return function(_0x55f10d){logger['error'](_0x2d4076,util[_0xf266('0x94')](_0x55f10d,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x50cbb7){return _0x50cbb7&&!_['isUndefined'](_0x50cbb7)&&_0x50cbb7[_0xf266('0x96')]>0x0;}function decremetOriginate(_0x42980b){if(!_[_0xf266('0x40')](_0x42980b)&&_0x42980b!==null){if(typeof _0x42980b['originated']!==_0xf266('0x97')){if(_0x42980b[_0xf266('0x70')]>0x0){_0x42980b[_0xf266('0x70')]-=0x1;}else{logger[_0xf266('0x95')](_0xf266('0x98'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x46195f,_0x408676,_0x42eca9){if(_0x408676>_0x42eca9){for(var _0x33ae18=0x0;_0x33ae18<_0x408676-_0x42eca9;_0x33ae18+=0x1){decremetOriginate(_0x46195f);}}}function loggerGetContactDialer(_0x394dcf,_0x257f5e,_0x5ed0d9){return function(_0x1b2657){checkContactLowerLimitOriginate(_0x257f5e,_0x5ed0d9,0x0);logger['error'](_0x394dcf,util['inspect'](_0x1b2657,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2f7640){return function(_0x5bf639){if(isNotNull(_0x5bf639)&&isNotNull(_0x5bf639[0x0])){if(_0x5bf639[0x0][_0xf266('0x99')]>0x0){_0x2f7640[_0xf266('0x41')]=_0xf266('0x9a');logger[_0xf266('0x7f')]('[getContactDialer2][ReScheduled]'+_0x2f7640[_0xf266('0x45')],_0x5bf639[0x0][_0xf266('0x99')],_0xf266('0x9b'));}else{_0x2f7640['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xf266('0x7f')](_0xf266('0x9c')+_0x2f7640[_0xf266('0x45')]);}}};}function notSendMessagesQueue(_0x4e11b2){if(_0x4e11b2['sendMessageOneNotActive']){freeVariablesPredictive(_0x4e11b2);if(_0x4e11b2['originated']===0x0&&_0x4e11b2[_0xf266('0x58')]===0x0&&_0x4e11b2['waiting']===0x0&&(_0x4e11b2[_0xf266('0x9d')]||0x0)===0x0){_0x4e11b2['sendMessageOneNotActive']=![];_0x4e11b2[_0xf266('0x54')]=0x0;_0x4e11b2[_0xf266('0x41')]=_0xf266('0x44');loggerSyncQueueSummary[_0xf266('0x93')](_0xf266('0x9e'),_0x4e11b2[_0xf266('0x45')],_0xf266('0x9f'));}else{_0x4e11b2[_0xf266('0x41')]=_0xf266('0xa0');loggerSyncQueueSummary[_0xf266('0x93')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4e11b2[_0xf266('0x45')],'is\x20disactive');}emitVoiceQueueSummary(_0x4e11b2);}}function notSendMessagesCampaign(_0x17d1fa){if(_0x17d1fa[_0xf266('0xa1')]){if(_0x17d1fa[_0xf266('0x70')]===0x0){_0x17d1fa[_0xf266('0xa1')]=![];_0x17d1fa[_0xf266('0x41')]=_0xf266('0x44');loggerSyncQueueSummary[_0xf266('0x93')](_0xf266('0xa2'),_0x17d1fa['name'],_0xf266('0x9f'));}else{_0x17d1fa[_0xf266('0x41')]=_0xf266('0xa0');loggerSyncQueueSummary[_0xf266('0x93')](_0xf266('0xa2'),_0x17d1fa[_0xf266('0x45')],'is\x20disactive');}emitCampaignSummary(_0x17d1fa);}}function createObjHistory(_0x4b40ec,_0x3e4b08,_0x3cf7b6,_0xebf226,_0x41d273){_0x4b40ec[_0xf266('0x41')]=_0x3cf7b6;var _0x3029f0=new Action(_0x4b40ec,_0x3e4b08);var _0x32f218=new History(_0x3029f0);_0x32f218[_0xf266('0xa3')]=_0xebf226;_0x32f218[_0xf266('0xa4')]=_0x41d273;_0x32f218[_0xf266('0xa5')]=_0x3029f0[_0xf266('0xa6')];return _0x32f218;}Dialer[_0xf266('0xa7')]['loopClearZombieChannels']=function(){var _0x24ae92=this;setInterval(function(){_0x24ae92[_0xf266('0xa8')](_0x24ae92[_0xf266('0x29')],_0xf266('0xa9'));_0x24ae92[_0xf266('0xa8')](_0x24ae92[_0xf266('0x27')],_0xf266('0xaa'));},0x32c8);};Dialer[_0xf266('0xa7')]['clearZombieChannels']=function(_0x31a69c,_0xe8aee4){var _0x1bacf0=this;for(var _0x39820a in _0x31a69c){if(typeof _0x31a69c[_0x39820a]!=='undefined'){this[_0xf266('0x1f')][_0xf266('0x1c')](function(){if(!_[_0xf266('0xab')](_0x31a69c[_0x39820a])){return ami[_0xf266('0xac')]({'action':'status','channel':_0x31a69c[_0x39820a][_0xf266('0xad')]})[_0xf266('0xae')](function(_0x2ec640){if(_0x2ec640[_0xf266('0x41')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x31a69c[_0x39820a]&&_0x31a69c[_0x39820a][_0xf266('0x7a')]!==_0xf266('0x7b')){_0x1bacf0[_0xf266('0xaf')](_0x1bacf0['voiceQueues'][_0x31a69c[_0x39820a]['queue']]);logger[_0xf266('0x95')](_0xf266('0xb0'),_0xe8aee4,_0x39820a,_0x31a69c[_0x39820a][_0xf266('0xb1')]);delete _0x31a69c[_0x39820a];}if(_0x31a69c[_0x39820a]&&_0x31a69c[_0x39820a][_0xf266('0x7a')]===_0xf266('0x7b')){_0x1bacf0[_0xf266('0xaf')](_0x1bacf0[_0xf266('0x22')][_0x31a69c[_0x39820a]['queue']]);logger[_0xf266('0x95')](_0xf266('0xb2'),_0xe8aee4,_0x39820a,_0x31a69c[_0x39820a]['queue']);delete _0x31a69c[_0x39820a];}},0x2328);}});}});}}};Dialer['prototype'][_0xf266('0xb3')]=function(_0x13e095){return Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](cmHopper['countReScheduled'](_0x13e095))[_0xf266('0xae')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype']['checkIsBlackList']=function(_0x2825e4){return Promise['resolve']()[_0xf266('0xb5')](cmHopperBlack[_0xf266('0xb6')](_0x2825e4))[_0xf266('0xae')](loggerCatch(_0xf266('0xb7')));};Dialer[_0xf266('0xa7')][_0xf266('0xb8')]=function(_0x26316b,_0x5e806e,_0x564276){return Promise['resolve']()[_0xf266('0xb5')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x26316b,_0x5e806e,_0x564276))[_0xf266('0xae')](loggerCatch(_0xf266('0xb9')));};Dialer[_0xf266('0xa7')][_0xf266('0xba')]=function(_0x42c0a1,_0x54c121,_0x336484){return Promise['resolve']()[_0xf266('0xb5')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x42c0a1,_0x54c121,_0x336484))[_0xf266('0xae')](loggerCatch(_0xf266('0xbb')));};Dialer[_0xf266('0xa7')]['checkIsBlackListIvr']=function(_0x549543){return Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](cmHopperBlack['checkIsBlackListIvr'](_0x549543))[_0xf266('0xae')](loggerCatch(_0xf266('0xbc')));};Dialer[_0xf266('0xa7')][_0xf266('0xbd')]=function(_0x2050f4){return Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](cmHopperHistory['avgHandleTime'](_0x2050f4))[_0xf266('0xae')](loggerCatch(_0xf266('0xbe')));};Dialer[_0xf266('0xa7')][_0xf266('0xbf')]=function(_0x20d1cf){return Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](cmHopper[_0xf266('0xbf')](_0x20d1cf))[_0xf266('0xae')](loggerCatch(_0xf266('0xc0')));};Dialer[_0xf266('0xa7')][_0xf266('0xc1')]=function(_0x1f23f6,_0x47aa71,_0x29b42d){return Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](cmHopper[_0xf266('0xc1')](_0x1f23f6,_0x47aa71,_0x29b42d))['catch'](loggerCatch(_0xf266('0xc2')));};Dialer['prototype'][_0xf266('0xc3')]=function(_0x9ae635,_0x6c66e7,_0xc4ab20,_0x25bf69,_0x43d28d){return Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](cmHopper[_0xf266('0xc3')](_0x9ae635,_0x6c66e7,_0xc4ab20,_0x25bf69))[_0xf266('0xae')](function(_0x4d4692){_0x43d28d[_0xf266('0xc4')]-=_0xc4ab20;_0x43d28d[_0xf266('0xc4')]=_0x43d28d['temp']>0x0?_0x43d28d[_0xf266('0xc4')]:0x0;loggerCatch(_0xf266('0xc5'))(_0x4d4692);});};Dialer[_0xf266('0xa7')][_0xf266('0xc6')]=function(_0x346909,_0x241dd9,_0x2be779,_0x126f3a){return Promise['resolve']()[_0xf266('0xb5')](cmHopper[_0xf266('0xc6')](_0x346909,_0x241dd9,_0x2be779))['catch'](function(_0x37f4e2){_0x126f3a[_0xf266('0xc4')]-=_0x241dd9;_0x126f3a[_0xf266('0xc4')]=_0x126f3a['temp']>0x0?_0x126f3a['temp']:0x0;loggerCatch(_0xf266('0xc7'))(_0x37f4e2);});};Dialer[_0xf266('0xa7')]['getVoiceQueueRtPauses']=function(_0x51369c){return Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](voiceQueueRt[_0xf266('0xc8')](_0x51369c))['catch'](loggerCatch(_0xf266('0xc9')));};Dialer[_0xf266('0xa7')][_0xf266('0xca')]=function(_0x5b29af){return Promise['resolve']()[_0xf266('0xb5')](cmHopper[_0xf266('0xca')](_0x5b29af))[_0xf266('0xae')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xf266('0xa7')][_0xf266('0xcb')]=function(_0x1652b9){return Promise['resolve']()[_0xf266('0xb5')](cmHopperHistory[_0xf266('0xcb')](_0x1652b9))[_0xf266('0xae')](loggerCatch(_0xf266('0xcc')));};Dialer['prototype'][_0xf266('0xaf')]=function(_0x4db366){if(!_[_0xf266('0x40')](_0x4db366)&&_0x4db366!==null){if(typeof _0x4db366[_0xf266('0x70')]!==_0xf266('0x97')){if(_0x4db366[_0xf266('0x70')]>0x0){_0x4db366['originated']-=0x1;}else{logger['error'](_0xf266('0xcd'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xf266('0xa7')][_0xf266('0xce')]=function(_0x439477,_0x22cd14){var _0x556e60=this;return function(_0x629178){_0x556e60[_0xf266('0xaf')](_0x22cd14);logger['error'](_0x439477,util['inspect'](_0x629178,{'showHidden':![],'depth':null}));};};Dialer[_0xf266('0xa7')][_0xf266('0xcf')]=function(_0x323b51,_0x5f4412,_0x4b7b57){var _0x5c98a6={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x5f4412);this['saveInDb'](_[_0xf266('0xd0')](_0x5c98a6,_[_0xf266('0xd1')](_0x4b7b57,[_0xf266('0xd2'),_0xf266('0xd3'),'UserId',_0xf266('0xd4'),_0xf266('0xd5')])),'[emptyContact][createHistory]',_0xf266('0xd6'));logger['error'](_0x323b51);};Dialer['prototype'][_0xf266('0xd7')]=function(_0x222afb){return _0x222afb==='Success';};Dialer[_0xf266('0xa7')][_0xf266('0xd8')]=function(_0x15df46){return!_['isUndefined'](_0x15df46)&&_0x15df46&&!_[_0xf266('0x40')](_0x15df46[_0xf266('0x45')])&&!_[_0xf266('0x40')](_0x15df46[_0xf266('0x78')])&&_0x15df46[_0xf266('0x78')]&&(this[_0xf266('0x24')][util[_0xf266('0x7c')](_0xf266('0xd9'),_0x15df46[_0xf266('0x45')])]['status']==='reachable'||this[_0xf266('0x24')][util['format'](_0xf266('0xd9'),_0x15df46[_0xf266('0x45')])][_0xf266('0xda')]===_0xf266('0xdb'));};Dialer[_0xf266('0xa7')][_0xf266('0xdc')]=function(_0x5b55ce,_0x554d74,_0x3184cb){this[_0xf266('0xcb')](_0x5b55ce)[_0xf266('0xae')](loggerCatch(_0x554d74));this[_0xf266('0xca')](_0x5b55ce)[_0xf266('0xae')](loggerCatch(_0x3184cb));};Dialer[_0xf266('0xa7')][_0xf266('0x3c')]=function(_0x3c2bb0){var _0x732b1e=this;var _0x45eb59=this[_0xf266('0x29')][_0x3c2bb0['uniqueid']];var _0x18c100;if(!_['isNil'](_0x3c2bb0)&&!_[_0xf266('0xab')](_0x3c2bb0[_0xf266('0xdd')])&&!_['isNil'](_0x3c2bb0['variable'][_0xf266('0xde')])&&_0x3c2bb0[_0xf266('0xdf')]===_0xf266('0xe0')&&_0x45eb59){if(_0x45eb59[_0xf266('0x7a')]!==_0xf266('0x7b')&&this[_0xf266('0x21')][_0x45eb59['queue']]['dialAMDActive']&&_0x3c2bb0[_0xf266('0xe1')]===_0xf266('0xe2')){delete this[_0xf266('0x29')][_0x3c2bb0[_0xf266('0xe3')]];this[_0xf266('0xaf')](this[_0xf266('0x21')][_0x45eb59['queue']]);this[_0xf266('0x21')][_0x45eb59[_0xf266('0xb1')]][_0xf266('0x61')]+=0x1;this[_0xf266('0x21')][_0x45eb59[_0xf266('0xb1')]][_0xf266('0xe4')]+=0x1;_0x18c100=new Hangup(_0x45eb59,_0x3c2bb0);_0x18c100[_0xf266('0xa3')]=0x12;_0x18c100[_0xf266('0xa4')]=_0xf266('0xe5');_0x18c100[_0xf266('0xe6')]=_0xf266('0xe7');ami[_0xf266('0x50')](_0xf266('0xe8'),ut['buildObj'](_0x18c100,'amd'));this[_0xf266('0xdc')](_0x18c100,_0xf266('0xe9'),_0xf266('0xea'));}if(_0x45eb59[_0xf266('0x7a')]!==_0xf266('0x7b')&&this[_0xf266('0x21')][_0x45eb59[_0xf266('0xb1')]]['dialAMDActive']&&_0x3c2bb0[_0xf266('0xe1')]===_0xf266('0xeb')){return new Promise(function(_0x4740be,_0x23775a){delete _0x732b1e['uniqueId'][_0x3c2bb0[_0xf266('0xe3')]];_0x732b1e[_0xf266('0xaf')](_0x732b1e[_0xf266('0x21')][_0x45eb59[_0xf266('0xb1')]]);_0x732b1e['voiceQueues'][_0x45eb59['queue']][_0xf266('0x61')]+=0x1;_0x732b1e[_0xf266('0x21')][_0x45eb59[_0xf266('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x53840f=_0x732b1e[_0xf266('0x21')][_0x45eb59[_0xf266('0xb1')]];var _0x5f5cf4=new Hangup(_0x45eb59,_0x3c2bb0);_0x5f5cf4[_0xf266('0xa3')]=0x13;_0x5f5cf4[_0xf266('0xa4')]=_0xf266('0xec');_0x5f5cf4[_0xf266('0xe6')]=_0xf266('0xe7');_0x5f5cf4['countmachineretry']+=0x1;_0x5f5cf4[_0xf266('0xed')]+=0x1;_0x5f5cf4[_0xf266('0xee')]=!![];ami[_0xf266('0x50')](_0xf266('0xe8'),ut[_0xf266('0xef')](_0x5f5cf4,_0xf266('0xee')));_0x732b1e[_0xf266('0xcb')](_0x5f5cf4)[_0xf266('0xae')](loggerCatch(_0xf266('0xf0')));if(_0x5f5cf4[_0xf266('0xf1')]+_0x5f5cf4[_0xf266('0xf2')]+_0x5f5cf4[_0xf266('0xf3')]+_0x5f5cf4[_0xf266('0xf4')]+_0x5f5cf4[_0xf266('0xf5')]+_0x5f5cf4[_0xf266('0xf6')]+_0x5f5cf4[_0xf266('0xf7')]+_0x5f5cf4[_0xf266('0xf8')]>=_0x53840f['dialGlobalMaxRetry']){_0x732b1e[_0xf266('0xf9')](_0x5f5cf4,_0x4740be,_0x23775a,_0xf266('0xfa'));}else{if(_0x5f5cf4['countmachineretry']>=_0x53840f[_0xf266('0xfb')]){_0x732b1e[_0xf266('0xfc')](_0x5f5cf4,_0x4740be,_0x23775a,'reason\x2019\x20machine....');}else{_0x732b1e[_0xf266('0xbf')]({'active':![],'countmachineretry':_0x5f5cf4[_0xf266('0xf7')],'scheduledat':moment()['add'](_0x53840f[_0xf266('0xfd')],_0xf266('0xfe'))['format'](_0xf266('0xff')),'ContactId':_0x5f5cf4[_0xf266('0xd2')],'ListId':_0x5f5cf4[_0xf266('0xd3')],'VoiceQueueId':_0x5f5cf4['VoiceQueueId']||undefined,'CampaignId':_0x5f5cf4[_0xf266('0xd5')]||undefined})[_0xf266('0xae')](loggerCatch(_0xf266('0x100')));_0x4740be({'reschedule':0x1});}}});}if(_0x45eb59[_0xf266('0x7a')]===_0xf266('0x7b')&&this[_0xf266('0x22')][_0x45eb59[_0xf266('0xb1')]]['dialAMDActive']&&_0x3c2bb0['value']===_0xf266('0xe2')){delete this[_0xf266('0x29')][_0x3c2bb0[_0xf266('0xe3')]];this[_0xf266('0xaf')](this[_0xf266('0x22')][_0x45eb59['queue']]);_0x18c100=new Hangup(_0x45eb59,_0x3c2bb0);_0x18c100[_0xf266('0xa3')]=0x12;_0x18c100[_0xf266('0xa4')]='HangupInAMD';_0x18c100[_0xf266('0xe6')]=_0xf266('0xe7');ami[_0xf266('0x50')]('custom:amd',ut[_0xf266('0xef')](_0x18c100,_0xf266('0xee')));this[_0xf266('0xdc')](_0x18c100,_0xf266('0x101'),_0xf266('0x102'));}if(_0x45eb59[_0xf266('0x7a')]===_0xf266('0x7b')&&this['campaigns'][_0x45eb59[_0xf266('0xb1')]][_0xf266('0x103')]&&_0x3c2bb0[_0xf266('0xe1')]===_0xf266('0xeb')){return new Promise(function(_0x2fcbff,_0x38bf87){delete _0x732b1e[_0xf266('0x29')][_0x3c2bb0['uniqueid']];_0x732b1e[_0xf266('0xaf')](_0x732b1e[_0xf266('0x22')][_0x45eb59[_0xf266('0xb1')]]);_0x732b1e[_0xf266('0x22')][_0x45eb59[_0xf266('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x732b1e[_0xf266('0x22')][_0x45eb59[_0xf266('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3c7133=_0x732b1e[_0xf266('0x22')][_0x45eb59[_0xf266('0xb1')]];var _0x229152=new Hangup(_0x45eb59,_0x3c2bb0);_0x229152['state']=0x13;_0x229152['statedesc']=_0xf266('0xec');_0x229152[_0xf266('0xe6')]='AMD';_0x229152['countmachineretry']+=0x1;_0x229152[_0xf266('0xed')]+=0x1;_0x229152[_0xf266('0xee')]=!![];ami['emit']('custom:amd',ut[_0xf266('0xef')](_0x229152,_0xf266('0xee')));_0x732b1e[_0xf266('0xcb')](_0x229152)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x229152[_0xf266('0xf1')]+_0x229152[_0xf266('0xf2')]+_0x229152[_0xf266('0xf3')]+_0x229152[_0xf266('0xf4')]+_0x229152[_0xf266('0xf5')]+_0x229152[_0xf266('0xf6')]+_0x229152['countmachineretry']+_0x229152['countagentrejectretry']>=_0x3c7133[_0xf266('0x104')]){_0x732b1e[_0xf266('0xf9')](_0x229152,_0x2fcbff,_0x38bf87,_0xf266('0xfa'));}else{if(_0x229152[_0xf266('0xf7')]>=_0x3c7133[_0xf266('0xfb')]){_0x732b1e[_0xf266('0xfc')](_0x229152,_0x2fcbff,_0x38bf87,'reason\x2019\x20machine....');}else{_0x732b1e[_0xf266('0xbf')]({'active':![],'countmachineretry':_0x229152[_0xf266('0xf7')],'scheduledat':moment()[_0xf266('0x105')](_0x3c7133[_0xf266('0xfd')],_0xf266('0xfe'))[_0xf266('0x7c')](_0xf266('0xff')),'ContactId':_0x229152[_0xf266('0xd2')],'ListId':_0x229152[_0xf266('0xd3')],'VoiceQueueId':_0x229152[_0xf266('0xd4')]||undefined,'CampaignId':_0x229152['CampaignId']||undefined})[_0xf266('0xae')](loggerCatch('[rescheduleContact][Machine]'));_0x2fcbff({'reschedule':0x1});}}});}}};Dialer[_0xf266('0xa7')][_0xf266('0x39')]=function(_0x1db80a){var _0x14506b=this[_0xf266('0x29')][_0x1db80a['uniqueid']];var _0x5490af;if(_0x14506b&&_0x14506b[_0xf266('0x7a')]===_0xf266('0x7b')){delete this[_0xf266('0x29')][_0x1db80a[_0xf266('0xe3')]];this['updateOriginated'](this['campaigns'][_0x14506b[_0xf266('0xb1')]]);this[_0xf266('0x22')][_0x14506b[_0xf266('0xb1')]][_0xf266('0x106')]+=0x1;_0x5490af=new Hangup(_0x14506b,_0x1db80a);this[_0xf266('0xcb')](_0x5490af)[_0xf266('0xae')](loggerCatch(_0xf266('0x107')));this['moveContactManagedDialer'](_0x5490af)[_0xf266('0xae')](loggerCatch(_0xf266('0x108')));}if(_0x14506b&&_0x14506b[_0xf266('0x7a')]!==_0xf266('0x7b')&&isNotNull(this[_0xf266('0x21')][_0x14506b[_0xf266('0xb1')]][_0xf266('0x109')])){delete this[_0xf266('0x29')][_0x1db80a[_0xf266('0xe3')]];this[_0xf266('0xaf')](this[_0xf266('0x21')][_0x14506b['queue']]);this['voiceQueues'][_0x14506b[_0xf266('0xb1')]][_0xf266('0x61')]+=0x1;this['voiceQueues'][_0x14506b[_0xf266('0xb1')]][_0xf266('0xe4')]+=0x1;_0x5490af=new Hangup(_0x14506b,_0x1db80a);_0x5490af[_0xf266('0xa3')]=0x10;_0x5490af['statedesc']='AnswerAGI';_0x5490af['membername']=_0xf266('0x10a');this[_0xf266('0xcb')](_0x5490af)['catch'](loggerCatch(_0xf266('0x107')));this[_0xf266('0xca')](_0x5490af)[_0xf266('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x14506b&&_0x14506b[_0xf266('0x7a')]!==_0xf266('0x7b')&&!isNotNull(this[_0xf266('0x21')][_0x14506b[_0xf266('0xb1')]][_0xf266('0x109')])){delete this['uniqueId'][_0x1db80a['uniqueid']];this['updateOriginated'](this[_0xf266('0x21')][_0x14506b[_0xf266('0xb1')]]);this[_0xf266('0x21')][_0x14506b[_0xf266('0xb1')]][_0xf266('0x67')]+=0x1;_0x5490af=new Hangup(_0x14506b,_0x1db80a);_0x5490af[_0xf266('0xa3')]=0xc;_0x5490af[_0xf266('0xa4')]=_0x1db80a[_0xf266('0x10b')];_0x5490af[_0xf266('0xe6')]=_0xf266('0x10c');this[_0xf266('0xcb')](_0x5490af)[_0xf266('0xae')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x5490af)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0xf266('0x35')]=function(_0x12ef7e){var _0x501bbc=this[_0xf266('0x29')][_0x12ef7e[_0xf266('0xe3')]];if(this['voiceQueues'][_0x12ef7e['queue']]){if(_0x501bbc&&_0x501bbc[_0xf266('0x7a')]!=='ivr'){delete this[_0xf266('0x29')][_0x12ef7e[_0xf266('0xe3')]];this[_0xf266('0x21')][_0x12ef7e[_0xf266('0xb1')]][_0xf266('0x61')]+=0x1;var _0xa2a1ba=new AgentComplete(_0x501bbc,_0x12ef7e);if(_0x12ef7e['reason']==='agent'){_0xa2a1ba[_0xf266('0x10d')]=this['voiceQueues'][_0x12ef7e['queue']][_0xf266('0x10e')]&&this[_0xf266('0x21')][_0x12ef7e[_0xf266('0xb1')]][_0xf266('0x10f')]?moment()[_0xf266('0x7c')](_0xf266('0xff')):undefined;}this[_0xf266('0xcb')](_0xa2a1ba)[_0xf266('0xae')](loggerCatch(_0xf266('0x110')));this['moveContactManagedDialer'](_0xa2a1ba)[_0xf266('0xae')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xf266('0xa7')][_0xf266('0x2e')]=function(_0x16d29f){if(this[_0xf266('0x21')][_0x16d29f[_0xf266('0xb1')]]){if(this[_0xf266('0x29')][_0x16d29f[_0xf266('0xe3')]]&&this[_0xf266('0x29')][_0x16d29f['uniqueid']][_0xf266('0x7a')]!=='ivr'){this['updateOriginated'](this[_0xf266('0x21')][_0x16d29f[_0xf266('0xb1')]]);this[_0xf266('0x29')][_0x16d29f['uniqueid']][_0xf266('0x111')]=moment()['format'](_0xf266('0xff'));}}};Dialer[_0xf266('0xa7')][_0xf266('0x112')]=function(_0x53e4ec,_0x41fc05){this[_0xf266('0xcb')](_0x53e4ec)[_0xf266('0xae')](loggerCatch(_0xf266('0x110')));if(_0x41fc05==0x0){this[_0xf266('0xca')](_0x53e4ec)[_0xf266('0xae')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0xf266('0x30')]=function(_0x229626){var _0x2a6e65=this[_0xf266('0x29')][_0x229626[_0xf266('0xe3')]];var _0x33d471=this;var _0x4cd565=![];var _0x144d57;var _0x305c18;if(this[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]]){if(_0x2a6e65&&_0x2a6e65[_0xf266('0x7a')]!==_0xf266('0x7b')){delete this['uniqueId'][_0x229626[_0xf266('0xe3')]];this[_0xf266('0xaf')](this[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]]);_0x2a6e65[_0xf266('0x113')]=moment()[_0xf266('0x7c')](_0xf266('0xff'));var _0x50b0e2=new QueueCallerAbandon(_0x2a6e65,_0x229626);if(getSeconds(_0x2a6e65[_0xf266('0x113')],_0x2a6e65['responsetime'])>=_0x2a6e65[_0xf266('0x114')]){this[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]][_0xf266('0x6b')]+=0x1;this[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]][_0xf266('0x64')]+=0x1;this[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]][_0xf266('0x6c')]+=0x1;_0x50b0e2[_0xf266('0xa3')]=0xa;_0x50b0e2['statedesc']='Drop';_0x50b0e2[_0xf266('0x115')]=_0xf266('0x116');_0x50b0e2['agiafterat']=this[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]][_0xf266('0x10e')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x50b0e2[_0xf266('0xf5')]+=0x1;_0x50b0e2[_0xf266('0xed')]+=0x1;_0x144d57=this['voiceQueues'][_0x229626['queue']][_0xf266('0x117')];_0x305c18=this[_0xf266('0x21')][_0x229626['queue']]['callAdditionalPhoneAfterMin'];_0x33d471['verifyAdditionalPhones'](_0x50b0e2,_0x50b0e2[_0xf266('0xa3')],_0x2a6e65[_0xf266('0x118')])[_0xf266('0xb5')](function(_0x4d0078){_0x4cd565=_0x4d0078[_0xf266('0x119')]==0x1;if(_0x50b0e2['countdropretry']>=_0x33d471[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]][_0xf266('0x11a')]){_0x33d471[_0xf266('0x112')](_0x50b0e2,_0x4d0078[_0xf266('0x119')]);}else{_0x33d471[_0xf266('0xbf')]({'active':![],'countdropretry':_0x50b0e2['countdropretry'],'scheduledat':moment()[_0xf266('0x105')](_0x33d471[_0xf266('0x21')][_0x229626['queue']]['dialDropRetryFrequency'],_0xf266('0xfe'))[_0xf266('0x7c')](_0xf266('0xff')),'ContactId':_0x2a6e65[_0xf266('0xd2')],'ListId':_0x2a6e65[_0xf266('0xd3')],'VoiceQueueId':_0x2a6e65[_0xf266('0xd4')]||undefined,'CampaignId':_0x2a6e65[_0xf266('0xd5')]||undefined})[_0xf266('0xae')](loggerCatch(_0xf266('0x11b')));var _0x272bad=new History(_0x50b0e2);_0x272bad[_0xf266('0xa3')]=0xa;_0x272bad['statedesc']='Drop';_0x272bad[_0xf266('0xa6')]=moment()[_0xf266('0x7c')](_0xf266('0xff'));_0x272bad[_0xf266('0xa5')]=_0x272bad['starttime'];_0x272bad[_0xf266('0x11c')]=_0x50b0e2[_0xf266('0x11c')];_0x272bad[_0xf266('0x11d')]=_0x50b0e2[_0xf266('0x11d')];_0x33d471['createHistory'](_0x272bad)['catch'](loggerCatch(_0xf266('0x11e')));}})['then'](function(){if(_0x4cd565)_0x33d471['swapAdditionalPhones'](_0x50b0e2,_0x144d57,_0x305c18)['then'](function(){return 0x1;});});}else{this[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x229626[_0xf266('0xb1')]][_0xf266('0x11f')]+=0x1;_0x50b0e2[_0xf266('0xa3')]=0xb;_0x50b0e2['statedesc']=_0xf266('0x120');_0x50b0e2[_0xf266('0x115')]='CALLEREXIT';_0x50b0e2[_0xf266('0xf6')]+=0x1;_0x50b0e2[_0xf266('0xed')]+=0x1;_0x144d57=this[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]][_0xf266('0x121')];_0x305c18=this[_0xf266('0x21')][_0x229626[_0xf266('0xb1')]][_0xf266('0x122')];_0x33d471[_0xf266('0xb8')](_0x50b0e2,_0x50b0e2[_0xf266('0xa3')],_0x2a6e65['voiceQueue'])['then'](function(_0x358389){if(_0x50b0e2[_0xf266('0xf6')]>=_0x33d471['voiceQueues'][_0x229626['queue']]['dialAbandonedMaxRetry']){_0x33d471[_0xf266('0x112')](_0x50b0e2,_0x358389['additional']);}else{_0x33d471[_0xf266('0xbf')]({'active':![],'countabandonedretry':_0x50b0e2[_0xf266('0xf6')],'scheduledat':moment()[_0xf266('0x105')](_0x33d471['voiceQueues'][_0x229626[_0xf266('0xb1')]][_0xf266('0x121')],'minutes')[_0xf266('0x7c')](_0xf266('0xff')),'ContactId':_0x2a6e65[_0xf266('0xd2')],'ListId':_0x2a6e65[_0xf266('0xd3')],'VoiceQueueId':_0x2a6e65[_0xf266('0xd4')]||undefined,'CampaignId':_0x2a6e65['CampaignId']||undefined})[_0xf266('0xae')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5ed42e=new History(_0x50b0e2);_0x5ed42e['state']=0xb;_0x5ed42e[_0xf266('0xa4')]='Abandoned';_0x5ed42e[_0xf266('0xa6')]=moment()['format'](_0xf266('0xff'));_0x5ed42e['endtime']=_0x5ed42e[_0xf266('0xa6')];_0x5ed42e[_0xf266('0x11c')]=_0x50b0e2[_0xf266('0x11c')];_0x5ed42e['calleridnum']=_0x50b0e2[_0xf266('0x11d')];_0x33d471['createHistory'](_0x5ed42e)['catch'](loggerCatch(_0xf266('0x123')));}})[_0xf266('0xb5')](function(){if(_0x4cd565)_0x33d471[_0xf266('0xba')](_0x50b0e2,_0x144d57,_0x305c18)[_0xf266('0xb5')](function(){return 0x1;});});}}}};Dialer[_0xf266('0xa7')][_0xf266('0x3a')]=function(_0x4bb6be){if(this['actions'][_0x4bb6be[_0xf266('0xe3')]]){this[_0xf266('0x27')][_0x4bb6be[_0xf266('0xe3')]]['channel']=_0x4bb6be['channel'];}if(this['uniqueId'][_0x4bb6be['uniqueid']]){this[_0xf266('0x29')][_0x4bb6be[_0xf266('0xe3')]]['channel']=_0x4bb6be[_0xf266('0xad')];}};Dialer[_0xf266('0xa7')][_0xf266('0x3d')]=function(_0x13e009){if(strategy[this[_0xf266('0x21')][this['actions'][_0x13e009[_0xf266('0x124')]][_0xf266('0xb1')]][_0xf266('0x52')]]===_0xf266('0x1b')){if(this['actions'][_0x13e009[_0xf266('0x124')]]&&_[_0xf266('0xab')](this[_0xf266('0x27')][_0x13e009[_0xf266('0x124')]][_0xf266('0x125')])&&_0x13e009[_0xf266('0xda')]==='1'&&_0x13e009[_0xf266('0x126')]==='0'){if(this[_0xf266('0x23')][_0x13e009[_0xf266('0x127')]]){if(!this['agents'][_0x13e009[_0xf266('0x127')]][_0xf266('0x125')]){this['agents'][_0x13e009['stateinterface']][_0xf266('0x125')]=!![];this[_0xf266('0x27')][_0x13e009['actionid']]['locked']=!![];this[_0xf266('0x27')][_0x13e009[_0xf266('0x124')]][_0xf266('0x127')]=_0x13e009['stateinterface'];}}}}else if((strategy[this[_0xf266('0x21')][this[_0xf266('0x27')][_0x13e009[_0xf266('0x124')]][_0xf266('0xb1')]]['strategy']]||_0xf266('0x1a'))===_0xf266('0x1a')){if(this[_0xf266('0x27')][_0x13e009[_0xf266('0x124')]]){if(this[_0xf266('0x23')][_0x13e009[_0xf266('0x127')]]){this[_0xf266('0x27')][_0x13e009['actionid']][_0xf266('0x127')]=_0x13e009[_0xf266('0x127')];if(_[_0xf266('0xab')](this[_0xf266('0x128')][this['actions'][_0x13e009[_0xf266('0x124')]][_0xf266('0xb1')]])){this[_0xf266('0x128')][this['actions'][_0x13e009['actionid']][_0xf266('0xb1')]]=[];}this[_0xf266('0x128')][this[_0xf266('0x27')][_0x13e009[_0xf266('0x124')]]['queue']][_0xf266('0x129')](_['merge'](_[_0xf266('0xd1')](this[_0xf266('0x27')][_0x13e009[_0xf266('0x124')]],[_0xf266('0x12a'),_0xf266('0x127')]),{'status':_0x13e009[_0xf266('0xda')],'paused':_0x13e009[_0xf266('0x126')]}));}}}};function unlockQueueStatus(_0x1511bb,_0x5cddfd){setTimeout(function(){if(_[_0xf266('0x40')](_0x1511bb['queueStatusComplete'])){loggerBooked['error'](_0xf266('0x12b'),_0x5cddfd);}_0x1511bb[_0xf266('0x12c')]=!![];loggerBooked['info'](_0xf266('0x12d'),_0x5cddfd,JSON[_0xf266('0x79')](_[_0xf266('0xd1')](_0x1511bb,[_0xf266('0x45'),_0xf266('0x12c')])));},0x1f3);}Dialer[_0xf266('0xa7')][_0xf266('0x12e')]=function(_0x249ce4){var _0x35278c=this;var _0x10b88a=_0x35278c[_0xf266('0x21')][_0x35278c[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]]['queue']];if(strategy[this[_0xf266('0x21')][this['actions'][_0x249ce4[_0xf266('0x124')]]['queue']][_0xf266('0x52')]]===_0xf266('0x1b')){if(this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]]&&this[_0xf266('0x27')][_0x249ce4['actionid']][_0xf266('0x127')]){this['preview'][_0xf266('0x12f')](this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]][_0xf266('0x12a')],this['actions'][_0x249ce4['actionid']][_0xf266('0x127')])['catch'](function(_0x5e0360){logger[_0xf266('0x95')](_0xf266('0x130'),util[_0xf266('0x94')](_0x5e0360,{'showHidden':![],'depth':null}));})['finally'](function(){_0x35278c[_0xf266('0xaf')](_0x35278c[_0xf266('0x21')][_0x35278c[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]]['queue']]);_0x35278c[_0xf266('0x23')][_0x35278c[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]][_0xf266('0x127')]][_0xf266('0x125')]=![];delete _0x35278c[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]];unlockQueueStatus(_0x10b88a);});}else{this[_0xf266('0xaf')](this[_0xf266('0x21')][this[_0xf266('0x27')][_0x249ce4['actionid']][_0xf266('0xb1')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x249ce4['actionid']][_0xf266('0xd2')],'ListId':this['actions'][_0x249ce4[_0xf266('0x124')]][_0xf266('0xd3')],'VoiceQueueId':this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]][_0xf266('0xd4')]||undefined,'CampaignId':this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]][_0xf266('0xd5')]||undefined})[_0xf266('0xae')](loggerCatch(_0xf266('0x131')));delete this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]];unlockQueueStatus(_0x10b88a);}}else if((strategy[this[_0xf266('0x21')][this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]]['queue']][_0xf266('0x52')]]||'rrmemory')===_0xf266('0x1a')){var _0x56aa5d;if(this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]]&&!_['isEmpty'](this[_0xf266('0x128')][this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]]['queue']])){if(this[_0xf266('0x2c')][_0x35278c['actions'][_0x249ce4[_0xf266('0x124')]][_0xf266('0xb1')]]){this[_0xf266('0x2c')][_0x35278c[_0xf266('0x27')][_0x249ce4['actionid']][_0xf266('0xb1')]]=this[_0xf266('0x2c')][this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]]['queue']]?this['queueBookedRR'][this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]]['queue']]:this[_0xf266('0x128')][this[_0xf266('0x27')][_0x249ce4['actionid']][_0xf266('0xb1')]]?this['queueBooked'][this[_0xf266('0x27')][_0x249ce4[_0xf266('0x124')]]['queue']][_0xf266('0x132')]||0x0:0x0;}this['queueBooked'][this[_0xf266('0x27')][_0x249ce4['actionid']]['queue']]['_rr']=this[_0xf266('0x2c')][this['actions'][_0x249ce4[_0xf266('0x124')]][_0xf266('0xb1')]];for(var _0xe0df0e=0x0;_0xe0df0e=0x0;})[_0xf266('0xae')](myreject(_0x365ccb)));}}else{_0x1e9506[_0xf266('0x129')](ami['Action']({'action':_0xf266('0x14b'),'command':util[_0xf266('0x7c')](_0xf266('0x146'),_0x3955bc,!_[_0xf266('0x40')](config[_0xf266('0x148')][_0x255135])?_0x255135:'')})['then'](function(_0x3b5697){return _0x3b5697[_0xf266('0x149')][_0xf266('0x14a')](_0xf266('0x14c'))>=0x0;})[_0xf266('0xae')](myreject(_0x365ccb)));}Promise[_0xf266('0x14d')](_0x1e9506)[_0xf266('0xb5')](function(_0x61fc42){var _0x5bfa34=_['some'](_0x61fc42);if(_0x5bfa34){return _0x381ac1(_0x5bfa34);}else{_0x490f61[_0xf266('0x41')]=_0x500d81?_0xf266('0x14e'):_0xf266('0x14f');return _0x365ccb(msgResponse(_0xf266('0x150'),_0xf266('0x140'),_0xf266('0x151')+_0x500d81+'\x20'+_0x5f5bd1+_0xf266('0x152')+util[_0xf266('0x94')](_0x3955bc,{'showHidden':![],'depth':null})+_0xf266('0x153')+_0x255135));}})['catch'](function(_0x4ab4ac){return _0x365ccb(msgResponse('ifTime','Failure',JSON[_0xf266('0x79')](_0x4ab4ac)));});});};Dialer[_0xf266('0xa7')]['checkDialMethod']=function(_0x4ac8ca){var _0x25e25c=this;return function(){switch(_0x4ac8ca[_0xf266('0x5d')]){case _0xf266('0x154'):freeVariablesPredictive(_0x4ac8ca);_0x25e25c['handlePower'](_0x4ac8ca,0x1);break;case _0xf266('0x155'):freeVariablesPredictive(_0x4ac8ca);_0x25e25c[_0xf266('0x156')](_0x4ac8ca,_0x4ac8ca[_0xf266('0x157')]);break;case _0xf266('0x158'):_0x25e25c[_0xf266('0x158')](_0x4ac8ca);break;case _0xf266('0x7'):freeVariablesPredictive(_0x4ac8ca);_0x25e25c['handlePower'](_0x4ac8ca,0x1);break;default:freeVariablesPredictive(_0x4ac8ca);logger[_0xf266('0x95')](_0xf266('0x159'),_0x4ac8ca[_0xf266('0x45')],_0xf266('0x15a'));}};};Dialer['prototype'][_0xf266('0x15b')]=function(_0x2c6364){return Promise[_0xf266('0xb4')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x2c6364['id'],previewRecallmeReminderInterval))[_0xf266('0xb5')](function(_0x4df5e7){for(var _0x592564=0x0;_0x592564<_0x4df5e7[_0xf266('0x96')];_0x592564++){var _0x2939ff=_0x4df5e7[_0x592564][_0xf266('0x15c')][_0xf266('0x45')];if(_0x2939ff)io['to'](util['format'](_0xf266('0x15d'),_0x2939ff))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x4df5e7[_0x592564]});}})[_0xf266('0xae')](function(){});};Dialer[_0xf266('0xa7')][_0xf266('0x15e')]=function(_0x4e3ac3){var _0x5db84c=this;return function(){_0x5db84c[_0xf266('0x15f')](_0x4e3ac3);};};Dialer[_0xf266('0xa7')]['syncQueueSummary']=function(_0x3971c1){var _0x251a8d=this;if(isNotPreview(_0x3971c1[_0xf266('0x5d')])){if(isVoiceQueueOutbound(_0x3971c1[_0xf266('0x7a')])&&isActive(_0x3971c1['dialActive'])){_0x3971c1[_0xf266('0xa1')]=!![];Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](checkIsLoggedIn(_0x3971c1,_0x3971c1[_0xf266('0x55')]))['then'](checkIsActive(_0x3971c1,_0x3971c1[_0xf266('0x5c')]))[_0xf266('0xb5')](checkInterval(_0x3971c1))[_0xf266('0xb5')](_0x251a8d['checkIsTrunkReachable'](_0x3971c1))['then'](_0x251a8d[_0xf266('0x13e')](_0x3971c1[_0xf266('0x160')],_0x3971c1['dialTimezone'],_0x3971c1[_0xf266('0x45')],_0x3971c1))[_0xf266('0xb5')](_0x251a8d[_0xf266('0x161')](_0x3971c1[_0xf266('0x47')],_0x3971c1['dialTimezone'],_0x3971c1[_0xf266('0x45')],_0x3971c1))['then'](_0x251a8d[_0xf266('0x162')](_0x3971c1))[_0xf266('0xae')](loggerCatchQueueSummary(_0xf266('0x163'),_0x3971c1));}else{notSendMessagesQueue(_0x3971c1);}}else{freeVariablesPredictive(_0x3971c1);}};Dialer['prototype'][_0xf266('0x164')]=_[_0xf266('0x165')](function(){var _0x597125=_[_0xf266('0x166')](this['voiceQueues'],function(_0x39f2ee){return _0x39f2ee[_0xf266('0x167')];});var _0x111f2d=_[_0xf266('0x166')](this[_0xf266('0x23')],function(_0xbc34cf){return _0xbc34cf[_0xf266('0x168')]&&_0xbc34cf[_0xf266('0xda')]===_0xf266('0x169');});if(_0x597125[_0xf266('0x96')]>0x0&&_0x111f2d[_0xf266('0x96')]>0x0){return Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x597125,'id'),previewRecallmeReminderInterval,_['map'](_0x111f2d,'id')))['then'](function(_0x126d93){for(var _0x19195a=0x0;_0x19195a<_0x126d93[_0xf266('0x96')];_0x19195a++){var _0x3eb22b=_0x126d93[_0x19195a][_0xf266('0x15c')]['name'];if(_0x3eb22b)io['to'](util[_0xf266('0x7c')](_0xf266('0x15d'),_0x3eb22b))[_0xf266('0x50')](_0xf266('0x16a'),{'hopper':_0x126d93[_0x19195a]});}})['catch'](function(_0x51e25b){logger[_0xf266('0x95')]('checkPreviewRecallReminder',_0x51e25b);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xf266('0x13a')]=function(){var _0x6d13ed=this;var _0x4ebcae;for(var _0x529db3 in this[_0xf266('0x22')]){if(typeof this[_0xf266('0x22')][_0x529db3]!==_0xf266('0x97')){_0x4ebcae=this[_0xf266('0x22')][_0x529db3];if(isCampaignIvr(_0x4ebcae[_0xf266('0x7a')])&&isActive(_0x4ebcae[_0xf266('0x78')])){_0x4ebcae[_0xf266('0xa1')]=!![];Promise[_0xf266('0xb4')]()[_0xf266('0xb5')](checkIsActive(_0x4ebcae,_0x4ebcae[_0xf266('0x78')]))[_0xf266('0xb5')](checkInterval(_0x4ebcae))[_0xf266('0xb5')](_0x6d13ed[_0xf266('0x13b')](_0x4ebcae))['then'](_0x6d13ed[_0xf266('0x13e')](_0x4ebcae[_0xf266('0x160')],_0x4ebcae[_0xf266('0x16b')],_0x4ebcae[_0xf266('0x45')],_0x4ebcae))[_0xf266('0xb5')](_0x6d13ed['checkIfTimeIntervals'](_0x4ebcae[_0xf266('0x47')],_0x4ebcae[_0xf266('0x16b')],_0x4ebcae['name'],_0x4ebcae))['then'](_0x6d13ed['launchHandleIvr'](_0x4ebcae))['catch'](loggerCatchQueueSummary(_0xf266('0x16c'),_0x4ebcae));}else{notSendMessagesCampaign(_0x4ebcae);}}}};function getCallerIdRandom(_0x18d610,_0x13165e){var _0x503751;var _0x4f4dbb;var _0x2d47c2;if(_0x13165e<=0x0){_0x13165e=0x1;}_0x503751=new RegExp(_0xf266('0x16d')+_0x13165e+'}$');_0x4f4dbb=Math[_0xf266('0x16e')](0xa,_0x13165e-0x1);_0x2d47c2=Math[_0xf266('0x16e')](0xa,_0x13165e)-0x1;return util['format']('%s',_['replace'](_0x18d610,_0x503751,_[_0xf266('0x16f')](_0x4f4dbb,_0x2d47c2)));}function extractCalleridName(_0x3c0235){var _0x18133c=_0x3c0235[_0xf266('0x170')](/"(.*?)"/);return _0x18133c?_0x18133c[0x1]:_0x3c0235;}Dialer['prototype'][_0xf266('0x171')]=function(_0x27a3b4,_0x44f1dd){var _0x48c0eb=this;var _0x416103=uuid['v4']();this['actions'][_0x416103]=new Action(_0x27a3b4,_0x44f1dd,_0x416103);return new Promise(function(_0x21a472,_0x29798f){if(_[_0xf266('0x40')](_0x27a3b4)&&typeof _0x27a3b4!=='object'){return _0x29798f(msgResponse(_0xf266('0x172'),'Failure',_0xf266('0x173')));}if(_['isUndefined'](_0x44f1dd[_0xf266('0x174')])||_0x44f1dd[_0xf266('0x174')]===null){return _0x29798f(msgResponse('originate','Failure','contact\x20is\x20undefine'));}var _0x3ba608={'XMD-CALLERID':_0x48c0eb[_0xf266('0x27')][_0x416103][_0xf266('0x175')](),'XMD-AGI':_0x27a3b4['dialQueueProject']?util[_0xf266('0x7c')](_0xf266('0x176'),ipAgi,_0x27a3b4[_0xf266('0x109')]):_0xf266('0x177'),'XMD-AGIAFTER':_0x27a3b4[_0xf266('0x10e')]?util[_0xf266('0x7c')](_0xf266('0x176'),ipAgi,_0x27a3b4[_0xf266('0x10e')]):'NONE','XMD-QUEUE':_0x27a3b4['type']==='outbound'?util[_0xf266('0x7c')](_0xf266('0x178'),_0x27a3b4['name'],_0x27a3b4[_0xf266('0x179')]||'',_0x27a3b4[_0xf266('0x10f')]?'c':'',_0x27a3b4['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x44f1dd[_0xf266('0xd2')],'XMD-CDRTYPE':_0xf266('0x17a'),'CALLERID(all)':_0x48c0eb[_0xf266('0x27')][_0x416103]['getCaller'](),'XMD-AMD':_0x27a3b4['dialAMDActive']?_0xf266('0x17b'):_0xf266('0x177'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x27a3b4[_0xf266('0x103')]){_0x3ba608['XMD-AMDINITIALSILENCE']=_0x27a3b4[_0xf266('0x17c')]||0x9c4;_0x3ba608[_0xf266('0x17d')]=_0x27a3b4[_0xf266('0x17e')]||0x5dc;_0x3ba608['XMD-AMDAFTERGREETINGSILENCE']=_0x27a3b4[_0xf266('0x17f')]||0x320;_0x3ba608['XMD-AMDTOTALANALYSISTIME']=_0x27a3b4[_0xf266('0x180')]||0x1388;_0x3ba608['XMD-AMDMINWORDLENGTH']=_0x27a3b4[_0xf266('0x181')]||0x64;_0x3ba608['XMD-AMDBETWEENWORDSSILENCE']=_0x27a3b4[_0xf266('0x182')]||0x32;_0x3ba608[_0xf266('0x183')]=_0x27a3b4[_0xf266('0x184')]||0x3;_0x3ba608[_0xf266('0x185')]=_0x27a3b4[_0xf266('0x186')]||0x100;_0x3ba608[_0xf266('0x187')]=_0x27a3b4[_0xf266('0x188')]||0x1388;}if(_0x27a3b4[_0xf266('0x7a')]===_0xf266('0x51')){_0x3ba608[_0xf266('0x189')]=_0x44f1dd[_0xf266('0xd4')];}else{_0x3ba608['XMD-CAMPAIGNID']=_0x44f1dd['CampaignId'];}for(var _0x35ff45 in _0x44f1dd[_0xf266('0x18a')]){if(typeof _0x44f1dd[_0xf266('0x18a')][_0x35ff45]!==_0xf266('0x97')){if(isNotNull(_0x44f1dd[_0xf266('0x18a')][_0x35ff45])&&_0x35ff45!=='id'&&_0x35ff45!=='tags'&&_0x35ff45!==_0xf266('0x18b')&&_0x35ff45!=='updatedAt'){_0x3ba608[util[_0xf266('0x7c')](_0xf266('0x18c'),_0xf266('0x18d'),_[_0xf266('0x18e')](_0x35ff45))]=_0x44f1dd['Contact'][_0x35ff45];}}}var _0x3bf39e=_0x48c0eb[_0xf266('0xd8')](_0x27a3b4[_0xf266('0x77')])?getCallerId(_0x27a3b4[_0xf266('0x77')][_0xf266('0x18f')],_0x27a3b4[_0xf266('0x5e')],_0x27a3b4[_0xf266('0x190')]>0x0?getCallerIdRandom(_0x27a3b4[_0xf266('0x191')],_0x27a3b4[_0xf266('0x190')]):_0x27a3b4['dialOriginateCallerIdNumber']):getCallerId(_[_0xf266('0xab')](_0x27a3b4[_0xf266('0x13c')])?_0x27a3b4['Trunk']['callerid']:_0x27a3b4['TrunkBackup'][_0xf266('0x18f')],_0x27a3b4[_0xf266('0x5e')],_0x27a3b4[_0xf266('0x190')]>0x0?getCallerIdRandom(_0x27a3b4[_0xf266('0x191')],_0x27a3b4[_0xf266('0x190')]):_0x27a3b4[_0xf266('0x191')]);if(_0x3bf39e){_0x3ba608['XMD-ORIGINATECALLERIDNAME']=_0x48c0eb[_0xf266('0x27')][_0x416103][_0xf266('0x192')]=extractCalleridName(_0x3bf39e);_0x3ba608['XMD-ORIGINATECALLERIDNUM']=_0x44f1dd[_0xf266('0x174')];}_0x27a3b4[_0xf266('0x193')]=_0x3ba608;return ami[_0xf266('0xac')]({'actionid':_0x416103,'action':_0xf266('0x172'),'channel':_0x48c0eb['isTrunkReachable'](_0x27a3b4['Trunk'])?util[_0xf266('0x7c')](_0xf266('0x194'),_0x27a3b4[_0xf266('0x77')][_0xf266('0x45')],isNotNull(_0x27a3b4[_0xf266('0x60')])?_0x27a3b4[_0xf266('0x60')][_0xf266('0x195')]()||'':'',_0x27a3b4['dialCutDigit']>0x0?_0x44f1dd[_0xf266('0x174')]['substring'](_0x27a3b4['dialCutDigit']):_0x44f1dd['phone']):util[_0xf266('0x7c')]('SIP/%s/%s%s',_[_0xf266('0xab')](_0x27a3b4[_0xf266('0x13c')])?_0x27a3b4[_0xf266('0x77')][_0xf266('0x45')]:_0x27a3b4[_0xf266('0x13c')]['name'],isNotNull(_0x27a3b4[_0xf266('0x60')])?_0x27a3b4[_0xf266('0x60')][_0xf266('0x195')]()||'':'',_0x27a3b4[_0xf266('0x196')]>0x0?_0x44f1dd[_0xf266('0x174')][_0xf266('0x197')](_0x27a3b4[_0xf266('0x196')]):_0x44f1dd[_0xf266('0x174')]),'callerid':_0x3bf39e,'Exten':'xcally-motion-dialer','Context':_0xf266('0x198'),'Priority':'1','variable':_0x3ba608,'timeout':(_0x27a3b4[_0xf266('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x416103})[_0xf266('0xb5')](function(_0x371df3){return _0x21a472(_0x371df3);})[_0xf266('0xae')](function(_0x175512){_0x27a3b4[_0xf266('0x65')]+=0x1;var _0x56deb2=new History(_0x48c0eb[_0xf266('0x27')][_0x416103]);logger[_0xf266('0x95')](util[_0xf266('0x7c')](_0xf266('0x199'),JSON['stringify'](_0x175512)));_0x56deb2['state']=0xe;_0x56deb2[_0xf266('0xa4')]=_0xf266('0x19a');_0x56deb2[_0xf266('0xa6')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x56deb2[_0xf266('0xa5')]=_0x56deb2['starttime'];_0x48c0eb['createHistory'](_0x56deb2)[_0xf266('0xae')](loggerCatch(_0xf266('0x19b')));_0x48c0eb[_0xf266('0xca')](_0x56deb2)[_0xf266('0xae')](loggerCatch('[originate][error]'))[_0xf266('0x1e')](function(){delete _0x48c0eb[_0xf266('0x27')][_0x416103];return _0x29798f(msgResponse(_0xf266('0x172'),_0xf266('0x4d'),_0xf266('0x19c')));});});});};Dialer[_0xf266('0xa7')][_0xf266('0x33')]=function(_0x1cc2ae){var _0x23ba05=this[_0xf266('0x27')][_0x1cc2ae[_0xf266('0x124')]];if(_0x23ba05){delete this[_0xf266('0x27')][_0x1cc2ae[_0xf266('0x124')]];_0x23ba05[_0xf266('0x19d')]=moment()[_0xf266('0x7c')](_0xf266('0xff'));var _0x498288=_0x23ba05[_0xf266('0x7a')]===_0xf266('0x7b')?this[_0xf266('0x22')][_0x23ba05[_0xf266('0xb1')]]:this[_0xf266('0x21')][_0x23ba05[_0xf266('0x19e')]()];if(!this[_0xf266('0xd7')](_0x1cc2ae[_0xf266('0x19f')])){this[_0xf266('0xaf')](_0x498288);return this[_0xf266('0x1a0')](_0x23ba05,_0x498288,_0x1cc2ae)[_0xf266('0xae')](loggerCatch(_0xf266('0x1a1')));}this[_0xf266('0x29')][_0x1cc2ae[_0xf266('0xe3')]]=_0x23ba05;}};Dialer[_0xf266('0xa7')][_0xf266('0x1a2')]=function(_0x23dd3f,_0xcf2dd2,_0x3f87bf){var _0x45b27a=new History(_0xcf2dd2);if(_0x45b27a[_0xf266('0xf1')]+_0x45b27a['countcongestionretry']+_0x45b27a[_0xf266('0xf3')]+_0x45b27a[_0xf266('0xf4')]+_0x45b27a[_0xf266('0xf5')]+_0x45b27a[_0xf266('0xf6')]+_0x45b27a[_0xf266('0xf7')]+_0x45b27a['countagentrejectretry']>=_0x3f87bf['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x23dd3f){case 0x3:if(_0x45b27a[_0xf266('0xf3')]>=_0x3f87bf[_0xf266('0x1a3')]-0x1){return!![];}this[_0xf266('0xbf')]({'active':![],'countnoanswerretry':_0x45b27a['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x3f87bf[_0xf266('0x1a4')],_0xf266('0xfe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45b27a[_0xf266('0xd2')],'ListId':_0x45b27a[_0xf266('0xd3')],'VoiceQueueId':_0x45b27a['VoiceQueueId']||undefined,'CampaignId':_0x45b27a['CampaignId']||undefined})[_0xf266('0xae')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x45b27a[_0xf266('0xf1')]>=_0x3f87bf[_0xf266('0x1a5')]-0x1){return!![];}this[_0xf266('0xbf')]({'active':![],'countbusyretry':_0x45b27a[_0xf266('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x3f87bf[_0xf266('0x1a6')],_0xf266('0xfe'))[_0xf266('0x7c')](_0xf266('0xff')),'ContactId':_0x45b27a[_0xf266('0xd2')],'ListId':_0x45b27a['ListId'],'VoiceQueueId':_0x45b27a[_0xf266('0xd4')]||undefined,'CampaignId':_0x45b27a['CampaignId']||undefined})[_0xf266('0xae')](loggerCatch(_0xf266('0x1a7')));break;case 0x8:if(_0x45b27a[_0xf266('0xf2')]>=_0x3f87bf[_0xf266('0x1a8')]-0x1){return!![];}this[_0xf266('0xbf')]({'active':![],'countcongestionretry':_0x45b27a[_0xf266('0xf2')]+=0x1,'scheduledat':moment()[_0xf266('0x105')](_0x3f87bf[_0xf266('0x1a9')],_0xf266('0xfe'))['format'](_0xf266('0xff')),'ContactId':_0x45b27a[_0xf266('0xd2')],'ListId':_0x45b27a[_0xf266('0xd3')],'VoiceQueueId':_0x45b27a['VoiceQueueId']||undefined,'CampaignId':_0x45b27a[_0xf266('0xd5')]||undefined})['catch'](loggerCatch(_0xf266('0x1aa')));break;case 0x0:if(_0x45b27a[_0xf266('0xf4')]>=_0x3f87bf[_0xf266('0x1ab')]-0x1){return!![];}else{this[_0xf266('0xbf')]({'active':![],'countnosuchnumberretry':_0x45b27a[_0xf266('0xf4')]+=0x1,'scheduledat':moment()[_0xf266('0x105')](_0x3f87bf[_0xf266('0x1ac')],_0xf266('0xfe'))[_0xf266('0x7c')](_0xf266('0xff')),'ContactId':_0x45b27a[_0xf266('0xd2')],'ListId':_0x45b27a[_0xf266('0xd3')],'VoiceQueueId':_0x45b27a[_0xf266('0xd4')]||undefined,'CampaignId':_0x45b27a[_0xf266('0xd5')]||undefined})['catch'](loggerCatch(_0xf266('0x1ad')));}break;case 0xa:if(_0x45b27a[_0xf266('0xf5')]>=_0x3f87bf['dialDropMaxRetry']-0x1){return!![];}this[_0xf266('0xbf')]({'active':![],'countdropretry':_0x45b27a['countdropretry']+=0x1,'scheduledat':moment()[_0xf266('0x105')](_0x3f87bf[_0xf266('0x117')],_0xf266('0xfe'))[_0xf266('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45b27a[_0xf266('0xd2')],'ListId':_0x45b27a[_0xf266('0xd3')],'VoiceQueueId':_0x45b27a[_0xf266('0xd4')]||undefined,'CampaignId':_0x45b27a[_0xf266('0xd5')]||undefined})['catch'](loggerCatch(_0xf266('0x11b')));break;case 0xb:if(_0x45b27a[_0xf266('0xf6')]>=_0x3f87bf[_0xf266('0x1ae')]-0x1){return!![];}this[_0xf266('0xbf')]({'active':![],'countabandonedretry':_0x45b27a[_0xf266('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x3f87bf['dialAbandonedRetryFrequency'],_0xf266('0xfe'))[_0xf266('0x7c')](_0xf266('0xff')),'ContactId':_0x45b27a[_0xf266('0xd2')],'ListId':_0x45b27a[_0xf266('0xd3')],'VoiceQueueId':_0x45b27a[_0xf266('0xd4')]||undefined,'CampaignId':_0x45b27a[_0xf266('0xd5')]||undefined})[_0xf266('0xae')](loggerCatch(_0xf266('0x1af')));break;case 0x13:if(_0x45b27a['countmachineretry']>=_0x3f87bf[_0xf266('0xfb')]-0x1){return!![];}this[_0xf266('0xbf')]({'active':![],'countmachineretry':_0x45b27a[_0xf266('0xf7')]+=0x1,'scheduledat':moment()[_0xf266('0x105')](_0x3f87bf[_0xf266('0xfd')],_0xf266('0xfe'))[_0xf266('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45b27a[_0xf266('0xd2')],'ListId':_0x45b27a[_0xf266('0xd3')],'VoiceQueueId':_0x45b27a[_0xf266('0xd4')]||undefined,'CampaignId':_0x45b27a[_0xf266('0xd5')]||undefined})[_0xf266('0xae')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x45b27a['countagentrejectretry']>=_0x3f87bf[_0xf266('0x1b0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x45b27a[_0xf266('0xf8')]+=0x1,'scheduledat':moment()[_0xf266('0x105')](_0x3f87bf['dialAgentRejectRetryFrequency'],_0xf266('0xfe'))[_0xf266('0x7c')](_0xf266('0xff')),'ContactId':_0x45b27a[_0xf266('0xd2')],'ListId':_0x45b27a[_0xf266('0xd3')],'VoiceQueueId':_0x45b27a[_0xf266('0xd4')]||undefined,'CampaignId':_0x45b27a['CampaignId']||undefined})['catch'](loggerCatch(_0xf266('0x1b1')));break;default:return!![];}};Dialer[_0xf266('0xa7')]['callProgressDetecting']=function(_0x1d740b,_0x2e8901,_0x2b1cb0){var _0x1a5c8a=this;var _0x48a138=new History(_0x1d740b);var _0x2e05eb=![];var _0x121515;var _0x1d7e8f;return new Promise(function(_0x91d8f8,_0x4b88a5){if(_[_0xf266('0x40')](_0x2e8901)&&typeof _0x2e8901!=='object'){return _0x4b88a5(msgResponse(_0xf266('0x1b2'),'Failure',_0xf266('0x1b3')));}if(_[_0xf266('0x40')](_0x2b1cb0)&&typeof _0x2b1cb0!==_0xf266('0x1b4')){return _0x4b88a5(msgResponse(_0xf266('0x1b2'),_0xf266('0x140'),'evt\x20is\x20undefine'));}_0x1a5c8a[_0xf266('0xb8')](_0x48a138,_0x2b1cb0[_0xf266('0x1b5')],_0x2e8901)[_0xf266('0xb5')](function(_0x447b06){if(_0x447b06[_0xf266('0x119')]==0x1)_0x2e05eb=!![];switch(_0x2b1cb0[_0xf266('0x1b5')]){case'0':_0x2e8901[_0xf266('0x1b6')]+=0x1;_0x48a138['state']=0x0;_0x48a138[_0xf266('0xa4')]='NoSuchNumber';_0x48a138['countnosuchnumberretry']+=0x1;_0x48a138[_0xf266('0xed')]+=0x1;ami[_0xf266('0x50')](_0xf266('0x1b7'),ut[_0xf266('0xef')](_0x1d740b,_0xf266('0x1b8')));_0x121515=_0x2e8901['dialNoSuchNumberRetryFrequency'];_0x1d7e8f=_0x2e8901[_0xf266('0x122')];_0x1a5c8a['createHistory'](_0x48a138)[_0xf266('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1a5c8a[_0xf266('0x1a2')](0x0,_0x1d740b,_0x2e8901)&&!_0x2e05eb){if(_0x48a138[_0xf266('0xf4')]>=_0x2e8901[_0xf266('0x1ab')]){_0x1a5c8a[_0xf266('0xfc')](_0x48a138,_0x91d8f8,_0x4b88a5,_0xf266('0x1b9'));}else{_0x1a5c8a[_0xf266('0xf9')](_0x48a138,_0x91d8f8,_0x4b88a5,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2e8901[_0xf266('0x1ba')]+=0x1;_0x48a138['state']=0x3;_0x48a138[_0xf266('0xa4')]=_0xf266('0x1bb');_0x48a138[_0xf266('0xf3')]+=0x1;_0x48a138[_0xf266('0xed')]+=0x1;var _0x1fb91b=ut[_0xf266('0x1bc')](_0x1d740b,_0x2e8901);ami['emit'](_0xf266('0x1bd'),_0x1fb91b);_0x121515=_0x2e8901[_0xf266('0x1a4')];_0x1d7e8f=_0x2e8901[_0xf266('0x122')];_0x1a5c8a['createHistory'](_0x48a138)['catch'](loggerCatch(_0xf266('0x1be')));if(_0x1a5c8a[_0xf266('0x1a2')](0x3,_0x1d740b,_0x2e8901)&&!_0x2e05eb){if(_0x48a138[_0xf266('0xf3')]>=_0x2e8901['dialNoAnswerMaxRetry']){_0x1a5c8a[_0xf266('0xfc')](_0x48a138,_0x91d8f8,_0x4b88a5,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1a5c8a[_0xf266('0xf9')](_0x48a138,_0x91d8f8,_0x4b88a5,_0xf266('0x1bf'));}}break;case'5':_0x2e8901['outboundBusyCallsDay']+=0x1;_0x48a138[_0xf266('0xa3')]=0x5;_0x48a138[_0xf266('0xa4')]=_0xf266('0x1c0');_0x48a138[_0xf266('0xf1')]+=0x1;_0x48a138[_0xf266('0xed')]+=0x1;ami[_0xf266('0x50')](_0xf266('0x1c1'),ut[_0xf266('0xef')](_0x1d740b,_0xf266('0x1c2')));_0x121515=_0x2e8901[_0xf266('0x1a6')];_0x1d7e8f=_0x2e8901['callAdditionalPhoneAfterMin'];_0x1a5c8a[_0xf266('0xcb')](_0x48a138)[_0xf266('0xae')](loggerCatch(_0xf266('0x1c3')));if(_0x1a5c8a[_0xf266('0x1a2')](0x5,_0x1d740b,_0x2e8901)&&!_0x2e05eb){if(_0x48a138[_0xf266('0xf1')]>=_0x2e8901[_0xf266('0x1a5')]){_0x1a5c8a['createStateFinal'](_0x48a138,_0x91d8f8,_0x4b88a5,_0xf266('0x1c4'));}else{_0x1a5c8a[_0xf266('0xf9')](_0x48a138,_0x91d8f8,_0x4b88a5,_0xf266('0x1c4'));}}break;case'8':_0x2e8901[_0xf266('0x63')]+=0x1;_0x48a138[_0xf266('0xa3')]=0x8;_0x48a138[_0xf266('0xa4')]=_0xf266('0x1c5');_0x48a138[_0xf266('0xf2')]+=0x1;_0x48a138['countglobal']+=0x1;_0x121515=_0x2e8901[_0xf266('0x1a9')];_0x1d7e8f=_0x2e8901[_0xf266('0x122')];ami[_0xf266('0x50')](_0xf266('0x1c6'),ut[_0xf266('0xef')](_0x1d740b,'congestion'));_0x1a5c8a[_0xf266('0xcb')](_0x48a138)[_0xf266('0xae')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1a5c8a[_0xf266('0x1a2')](0x8,_0x1d740b,_0x2e8901)&&!_0x2e05eb){if(_0x48a138[_0xf266('0xf2')]>=_0x2e8901[_0xf266('0x1a8')]){_0x1a5c8a[_0xf266('0xfc')](_0x48a138,_0x91d8f8,_0x4b88a5,'reason\x208\x20congestion');}else{_0x1a5c8a[_0xf266('0xf9')](_0x48a138,_0x91d8f8,_0x4b88a5,'reason\x208\x20congestion');}}break;case'11':_0x2e8901[_0xf266('0x1c7')]+=0x1;_0x48a138['state']=0xb;_0x48a138[_0xf266('0xa4')]=_0xf266('0x120');_0x48a138[_0xf266('0xf6')]+=0x1;_0x48a138[_0xf266('0xed')]+=0x1;_0x121515=_0x2e8901[_0xf266('0x121')];_0x1d7e8f=_0x2e8901[_0xf266('0x122')];_0x1a5c8a['createHistory'](_0x48a138)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x1a5c8a['checkRetriveMax'](0xb,_0x1d740b,_0x2e8901)&&!_0x2e05eb){if(_0x48a138[_0xf266('0xf6')]>=_0x2e8901['dialAbandonedMaxRetry']){_0x1a5c8a[_0xf266('0xfc')](_0x48a138,_0x91d8f8,_0x4b88a5,'reason\x2011\x20abandoned');}else{_0x1a5c8a[_0xf266('0xf9')](_0x48a138,_0x91d8f8,_0x4b88a5,_0xf266('0x1c8'));}}break;case'20':_0x2e8901[_0xf266('0x66')]+=0x1;_0x48a138[_0xf266('0xa3')]=0x14;_0x48a138[_0xf266('0xa4')]=_0xf266('0x1c9');_0x48a138[_0xf266('0xf8')]+=0x1;_0x48a138['countglobal']+=0x1;_0x121515=_0x2e8901[_0xf266('0x1ca')];_0x1d7e8f=_0x2e8901[_0xf266('0x122')];ami[_0xf266('0x50')](_0xf266('0x1cb'),ut['buildObj'](_0x1d740b,_0xf266('0x1cc')));_0x1a5c8a['createHistory'](_0x48a138)[_0xf266('0xae')](loggerCatch(_0xf266('0x1cd')));if(_0x1a5c8a[_0xf266('0x1a2')](0x14,_0x1d740b,_0x2e8901)&&!_0x2e05eb){if(_0x48a138['countagentrejectretry']>=_0x2e8901[_0xf266('0x1b0')]){_0x1a5c8a[_0xf266('0xfc')](_0x48a138,_0x91d8f8,_0x4b88a5,'reason\x2020\x20agentreject');}else{_0x1a5c8a['stateGlobal'](_0x48a138,_0x91d8f8,_0x4b88a5,_0xf266('0x1ce'));}}break;default:_0x2e8901[_0xf266('0x67')]+=0x1;_0x48a138[_0xf266('0xa3')]=0xc;_0x48a138[_0xf266('0xa4')]=_0x2b1cb0[_0xf266('0x1b5')];_0x121515=_0x2e8901[_0xf266('0x1ca')];_0x1d7e8f=_0x2e8901['callAdditionalPhoneAfterMin'];_0x1a5c8a[_0xf266('0xcb')](_0x48a138)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1a5c8a['checkRetriveMax'](_0x2b1cb0['reason'],_0x1d740b,_0x2e8901)&&!_0x2e05eb){if(_0x48a138[_0xf266('0xf1')]+_0x48a138[_0xf266('0xf2')]+_0x48a138['countnoanswerretry']+_0x48a138['countnosuchnumberretry']+_0x48a138[_0xf266('0xf5')]+_0x48a138[_0xf266('0xf6')]+_0x48a138['countmachineretry']+_0x48a138[_0xf266('0xf8')]>=_0x2e8901['dialGlobalMaxRetry']){_0x1a5c8a[_0xf266('0xf9')](_0x48a138,_0x91d8f8,_0x4b88a5,_0x2b1cb0[_0xf266('0x1b5')]);}else{_0x1a5c8a[_0xf266('0xfc')](_0x48a138,_0x91d8f8,_0x4b88a5,_0x2b1cb0[_0xf266('0x1b5')]);}}}})[_0xf266('0xb5')](function(){if(_0x2e05eb){_0x1a5c8a[_0xf266('0xba')](_0x48a138,_0x121515,_0x1d7e8f)['then'](function(){return _0x91d8f8(0x1);});}});});};Dialer[_0xf266('0xa7')][_0xf266('0xf9')]=function(_0x48f0aa,_0x228ff0,_0x116ef2,_0x4791a6){var _0xa0a034=new Final(_0x48f0aa);_0xa0a034[_0xf266('0xa3')]=0xf;_0xa0a034[_0xf266('0xa4')]='Global';this['createStateFinal'](_0xa0a034,_0x228ff0,_0x116ef2,_0x4791a6);};Dialer[_0xf266('0xa7')][_0xf266('0xfc')]=function(_0x207e4b,_0xc3af40,_0x87b7e8,_0x1cf048){this['moveContactManagedDialer'](_0x207e4b)[_0xf266('0xb5')](function(){return _0xc3af40(msgResponse(_0xf266('0x1b2'),_0xf266('0x1cf'),_0x1cf048));})[_0xf266('0xae')](function(){return _0x87b7e8(msgResponse(_0xf266('0x1d0'),'Failure',_0xf266('0x1d1')));});};Dialer[_0xf266('0xa7')][_0xf266('0x158')]=function(_0x502eb7){var _0x38882f=_0x502eb7[_0xf266('0x1d2')]/0x64;var _0x4dda57=_0x502eb7['outboundDropCallsDayTimeout']/(_0x502eb7['outboundDropCallsDayTimeout']+_0x502eb7[_0xf266('0x61')]);var _0x2584e2=Math['round'](_0x502eb7[_0xf266('0x6e')]*(_0x502eb7['predictiveIntervalMaxThreshold']/0x64));var _0xe07628=Math['round'](_0x502eb7[_0xf266('0x6e')]*(_0x502eb7[_0xf266('0x1d3')]/0x64));var _0x5dcbcb=_0x502eb7[_0xf266('0x54')]+_0x502eb7[_0xf266('0x58')];var _0x1cc5f1=Math['floor'](_0x502eb7[_0xf266('0x71')]*_0x502eb7[_0xf266('0x73')]*_0x502eb7[_0xf266('0x1d4')]*_0x502eb7[_0xf266('0x1d5')]);if(_[_0xf266('0x40')](_0x502eb7[_0xf266('0x76')])){if(!_['isUndefined'](_0x502eb7[_0xf266('0x75')])){_0x502eb7[_0xf266('0x75')]=undefined;loggerPredictive[_0xf266('0x95')](_0xf266('0x1d6'),_0xf266('0x1d7'));}if(!_[_0xf266('0x40')](_0x502eb7[_0xf266('0x8e')])){loggerPredictive[_0xf266('0x95')](_0xf266('0x1d6'),_0xf266('0x1d8'));clearInterval(_0x502eb7[_0xf266('0x8e')]);_0x502eb7[_0xf266('0x8e')]=undefined;}_0x502eb7[_0xf266('0x76')]=moment()[_0xf266('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf266('0x7f')](_0x502eb7['name'],_0xf266('0x1d9'),_0x502eb7[_0xf266('0x76')]);this['handlePower'](_0x502eb7,0x1);}else if(ifInterval(_0x502eb7[_0xf266('0x1da')],_0x502eb7['startProgressive'])){this[_0xf266('0x156')](_0x502eb7,0x1);loggerPredictiveCalls[_0xf266('0x7f')]('[startMethodPredictive][StartProgressive][Loop]',_0x502eb7[_0xf266('0x76')],_0x502eb7['name']);_0x502eb7[_0xf266('0x71')]=0x0;_0x502eb7[_0xf266('0x6c')]=0x0;}else if(_0x38882f<_0x4dda57&&_0x502eb7[_0xf266('0x1db')]===_0xf266('0x1dc')){freeVariablesPredictive(_0x502eb7);loggerPredictive[_0xf266('0x7f')](_0xf266('0x1dd'),_0xf266('0x1de'),_0x4dda57,_0xf266('0x76'),_0x502eb7[_0xf266('0x45')]);}else if(_0x1cc5f1<_0x502eb7[_0xf266('0x6c')]&&_0x502eb7[_0xf266('0x1db')]===_0xf266('0x1dc')){freeVariablesPredictive(_0x502eb7);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x1cc5f1,_0xf266('0x1df'),_0x502eb7['predictiveIntervalErlangCallsDroppedCalls'],_0xf266('0x76'),_0x502eb7[_0xf266('0x45')]);}else if(!ifInterval(_0x502eb7[_0xf266('0x1da')],_0x502eb7[_0xf266('0x76')])&&_[_0xf266('0x40')](_0x502eb7[_0xf266('0x75')])&&!_['isUndefined'](_0x502eb7[_0xf266('0x76')])){_0x502eb7['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x502eb7[_0xf266('0x45')],_0xf266('0x1e0'),_0x502eb7[_0xf266('0x75')]);this[_0xf266('0xbd')](_0x502eb7['dialPredictiveInterval'])[_0xf266('0xb5')](this[_0xf266('0x1e1')](_0x502eb7))[_0xf266('0xb5')](mergeDataErlangB(_0x502eb7))[_0xf266('0xb5')](this[_0xf266('0x1e2')](_0x502eb7))['catch'](loggerCatchPredictive(_0xf266('0x1e3'),_0x502eb7));}else if(!ifInterval(_0x502eb7[_0xf266('0x1da')],_0x502eb7[_0xf266('0x75')])){_0x502eb7[_0xf266('0x6c')]=0x0;_0x502eb7[_0xf266('0x75')]=moment()[_0xf266('0x7c')](_0xf266('0xff'));loggerPredictive[_0xf266('0x7f')](_0x502eb7[_0xf266('0x45')],_0xf266('0x1e4'),_0x502eb7[_0xf266('0x75')]);clearInterval(_0x502eb7['handlePredictive']);_0x502eb7['handlePredictive']=undefined;this[_0xf266('0xbd')](_0x502eb7[_0xf266('0x1da')])[_0xf266('0xb5')](this[_0xf266('0x1e1')](_0x502eb7))[_0xf266('0xb5')](mergeDataErlangB(_0x502eb7))['then'](this[_0xf266('0x1e2')](_0x502eb7))['catch'](loggerCatchPredictive(_0xf266('0x1e5'),_0x502eb7));}else if(_0x502eb7['predictiveIntervalAvailable']&&_0x5dcbcb<_0x502eb7['predictiveIntervalAvailable']-_0xe07628){freeVariablesPredictive(_0x502eb7);loggerPredictive[_0xf266('0x7f')](_0x502eb7[_0xf266('0x45')],_0xf266('0x1e6'),_0x5dcbcb,_0xf266('0x1e7'),_0x502eb7[_0xf266('0x6e')],'-',_0xe07628,'=',_0x502eb7[_0xf266('0x6e')]-_0xe07628,')');}else if(_0x502eb7[_0xf266('0x6e')]&&_0x5dcbcb>_0x502eb7[_0xf266('0x6e')]+_0x2584e2){freeVariablesPredictive(_0x502eb7);loggerPredictive['info'](_0x502eb7[_0xf266('0x45')],_0xf266('0x1e6'),_0x5dcbcb,_0xf266('0x1e8'),_0x502eb7[_0xf266('0x6e')],'+',_0x2584e2,'=',_0x502eb7['predictiveIntervalAvailable']+_0x2584e2,')');}};Dialer[_0xf266('0xa7')][_0xf266('0x1e1')]=function(_0x464b1f){var _0x278100=this;return function(_0x5f5daa){return new Promise(function(_0x5e7474,_0x592a63){_[_0xf266('0xd0')](_0x464b1f,_0x5f5daa[0x0]);if(checkGetDataPredictive(_0x5f5daa[0x0])){var _0x5c0ec7=_0x464b1f[_0xf266('0x6e')]=_0x464b1f['talking']+_0x464b1f['available'];var _0x3f50c9=_0x464b1f[_0xf266('0x1da')]*0x3c;var _0xf77fa2=_0x5f5daa[0x0]['predictiveIntervalAvgTalktime']+_0x5f5daa[0x0][_0xf266('0x69')];var _0x27c3b0=(_0x5f5daa[0x0]['predictiveIntervalAnsweredCalls']+_0x5f5daa[0x0][_0xf266('0x6b')]+_0x5f5daa[0x0][_0xf266('0x83')])/_0x5f5daa[0x0][_0xf266('0x6f')];_0x464b1f[_0xf266('0x1d4')]=_0x27c3b0>0x0?_0x27c3b0:0x1;switch(_0x464b1f[_0xf266('0x1db')]){case _0xf266('0x1dc'):var _0x236840=_0x464b1f[_0xf266('0x1d2')]/0x64;return _0x278100[_0xf266('0x1e9')](_0x5c0ec7,_0x3f50c9,_0xf77fa2,_0x27c3b0,_0x236840)[_0xf266('0xb5')](function(_0x3e6136){return _0x5e7474(_0x3e6136);});case _0xf266('0x1ea'):var _0x1fd28b=_0x464b1f[_0xf266('0x1d2')]/0x64;return _0x278100[_0xf266('0x1eb')](_0x5c0ec7,_0x3f50c9,_0xf77fa2,_0x27c3b0,_0x1fd28b)[_0xf266('0xb5')](function(_0x201539){return _0x5e7474(_0x201539);});default:return _0x592a63(msgResponse(_0xf266('0x1ec'),_0xf266('0x140'),_0xf266('0x1ed')));}}else{return _0x592a63(msgResponse(_0xf266('0x1ec'),_0xf266('0x140'),_0xf266('0x1ee')));}});};};Dialer[_0xf266('0xa7')][_0xf266('0x1ef')]=function(_0x36170d){var _0x162d0c=this;return function(_0x2cebec){return new Promise(function(_0x2e9126,_0x3486fa){_[_0xf266('0xd0')](_0x36170d,_0x2cebec[0x0]);if(checkGetDataPredictive(_0x2cebec[0x0])){loggerPredictive[_0xf266('0x7f')](JSON[_0xf266('0x79')](_0x2cebec[0x0]));if(_0x36170d[_0xf266('0x1db')]===_0xf266('0x1dc')){return _0x162d0c[_0xf266('0xc8')](_0x36170d['id'])[_0xf266('0xb5')](function(_0x3591f1){var _0x564fb6=_0x36170d['loggedIn']-_0x3591f1[0x0][_0xf266('0x1f0')];var _0x368148=_0x36170d[_0xf266('0x1da')]*0x3c;var _0xbaa278=_0x2cebec[0x0]['predictiveIntervalAvgTalktime']+_0x2cebec[0x0][_0xf266('0x69')];var _0x1aec34=(_0x2cebec[0x0][_0xf266('0x68')]+_0x2cebec[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2cebec[0x0][_0xf266('0x83')])/_0x2cebec[0x0][_0xf266('0x6f')];var _0x50134a=_0x36170d['dialPredictiveOptimizationPercentage']/0x64;_0x36170d[_0xf266('0x6d')]=_0x3591f1[0x0][_0xf266('0x1f0')]||0x0;_0x36170d[_0xf266('0x1d4')]=_0x1aec34>0x0?_0x1aec34:0x1;return _0x162d0c['abandonmentRate'](_0x564fb6,_0x368148,_0xbaa278,_0x1aec34,_0x50134a);})[_0xf266('0xb5')](function(_0x69e15e){return _0x2e9126(_0x69e15e);})[_0xf266('0xae')](function(_0x1f7dc3){return _0x3486fa(msgResponse(_0xf266('0x1f1'),_0xf266('0x140'),JSON[_0xf266('0x79')](_0x1f7dc3)));});}if(_0x36170d[_0xf266('0x1db')]==='agentBusyFactor'){return _0x162d0c[_0xf266('0xc8')](_0x36170d['id'])[_0xf266('0xb5')](function(_0x18122c){var _0x50ac8b=_0x36170d[_0xf266('0x55')]-_0x18122c[0x0][_0xf266('0x1f0')];var _0x5a590c=_0x36170d[_0xf266('0x1da')]*0x3c;var _0x185cfc=_0x2cebec[0x0][_0xf266('0x6a')]+_0x2cebec[0x0][_0xf266('0x69')];var _0x56d2b8=(_0x2cebec[0x0]['predictiveIntervalAnsweredCalls']+_0x2cebec[0x0][_0xf266('0x6b')]+_0x2cebec[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2cebec[0x0]['predictiveIntervalTotalCalls'];var _0x17db94=_0x36170d[_0xf266('0x1d2')]/0x64;_0x36170d['predictiveIntervalPauses']=_0x18122c[0x0][_0xf266('0x1f0')]||0x0;_0x36170d[_0xf266('0x1d4')]=_0x56d2b8>0x0?_0x56d2b8:0x1;return _0x162d0c[_0xf266('0x1eb')](_0x50ac8b,_0x5a590c,_0x185cfc,_0x56d2b8,_0x17db94);})[_0xf266('0xb5')](function(_0xa1b19f){return _0x2e9126(_0xa1b19f);})[_0xf266('0xae')](function(_0x298f51){return _0x3486fa(msgResponse(_0xf266('0x1f1'),'Failure',JSON[_0xf266('0x79')](_0x298f51)));});}}else{return _0x3486fa(msgResponse(_0xf266('0x1ec'),_0xf266('0x140'),_0xf266('0x1ee')));}});};};Dialer[_0xf266('0xa7')][_0xf266('0x1e2')]=function(_0x12e756){var _0x3dfd66=this;return function(){var _0x16251d=0x0;var _0x475a14=Math['floor'](_0x12e756[_0xf266('0x72')]*0x3e8);if(_0x475a14>0x0){_0x475a14=_0x475a14<0x64?0x64:_0x475a14;loggerPredictive['info'](_0x12e756[_0xf266('0x45')],_0xf266('0x1f2'),_0x475a14,_0xf266('0x8d'));_0x12e756[_0xf266('0x8e')]=setInterval(function(){_0x3dfd66[_0xf266('0x8e')](_0x12e756);loggerPredictiveCalls[_0xf266('0x7f')](_0xf266('0x1f3'),_0x16251d+=0x1);},_0x475a14);}else{loggerPredictive[_0xf266('0x7f')](_0x12e756[_0xf266('0x45')],_0xf266('0x1f4'));}};};Dialer['prototype']['checkContactBlack']=function(_0x3dce70,_0x6fbe27){var _0x1996e5=this;return function(_0x3654d8){if(_['isEmpty'](_0x3654d8)){if(_[_0xf266('0xab')](_0x6fbe27[_0xf266('0x1f5')])||!_0x6fbe27[_0xf266('0x1f6')]){if(_0x3dce70['dialMethod']===_0xf266('0x7')){_0x3dce70[_0xf266('0x12c')]=_[_0xf266('0x40')](_0x3dce70[_0xf266('0x12c')])?!![]:_0x3dce70[_0xf266('0x12c')];var _0xcfd30e=uuid['v4']();_0x1996e5['actions'][_0xcfd30e]=new Action(_0x3dce70,_0x6fbe27,_0xcfd30e);loggerBooked['info'](_0xf266('0x1f7'),_0xcfd30e,_0xf266('0x1f8'),JSON[_0xf266('0x79')](_0x3dce70[_0xf266('0x12c')]),'Queue:\x20',_0x3dce70[_0xf266('0x45')]);if(_0x3dce70[_0xf266('0x12c')]){_0x3dce70[_0xf266('0x12c')]=![];_0x1996e5[_0xf266('0x128')][_0x1996e5['actions'][_0xcfd30e][_0xf266('0xb1')]]=[];ami['Action']({'actionid':_0xcfd30e,'action':'queuestatus','queue':_0x3dce70[_0xf266('0x45')]})[_0xf266('0xae')](function(){_0x1996e5[_0xf266('0xaf')](_0x3dce70);_0x1996e5[_0xf266('0xbf')]({'active':![],'ContactId':_0x1996e5[_0xf266('0x27')][_0xcfd30e][_0xf266('0xd2')],'ListId':_0x1996e5['actions'][_0xcfd30e]['ListId'],'VoiceQueueId':_0x1996e5[_0xf266('0x27')][_0xcfd30e][_0xf266('0xd4')]||undefined,'CampaignId':_0x1996e5[_0xf266('0x27')][_0xcfd30e][_0xf266('0xd5')]||undefined})[_0xf266('0xae')](loggerCatch(_0xf266('0x1f9')));delete _0x1996e5[_0xf266('0x27')][_0xcfd30e];});}else{loggerBooked[_0xf266('0x7f')](_0xf266('0x1fa'),JSON[_0xf266('0x79')](_0x3dce70[_0xf266('0x12c')]),_0xf266('0x1fb'),_0x3dce70['name']);_0x1996e5[_0xf266('0xaf')](_0x3dce70);_0x1996e5[_0xf266('0xbf')]({'active':![],'ContactId':_0x1996e5['actions'][_0xcfd30e][_0xf266('0xd2')],'ListId':_0x1996e5[_0xf266('0x27')][_0xcfd30e]['ListId'],'VoiceQueueId':_0x1996e5[_0xf266('0x27')][_0xcfd30e][_0xf266('0xd4')]||undefined,'CampaignId':_0x1996e5[_0xf266('0x27')][_0xcfd30e][_0xf266('0xd5')]||undefined})[_0xf266('0xae')](loggerCatch(_0xf266('0x1f9')));delete _0x1996e5[_0xf266('0x27')][_0xcfd30e];}}else{return _0x1996e5[_0xf266('0x171')](_0x3dce70,_0x6fbe27);}}else{if(getDiff(_0x6fbe27[_0xf266('0x1fc')])<_0x3dce70[_0xf266('0x1fd')]*0x3c){if(_0x6fbe27[_0xf266('0x15c')]&&!_0x6fbe27[_0xf266('0x15c')]['voicePause']){_0x1996e5['preview']['run'](_0x6fbe27['id'])[_0xf266('0x1e')](function(){_0x1996e5[_0xf266('0xaf')](_0x3dce70);});}else{_0x1996e5[_0xf266('0xc1')]({'active':![]},_0x6fbe27['id'],0x1)[_0xf266('0x1e')](function(){_0x1996e5[_0xf266('0xaf')](_0x3dce70);});}}else{_0x3dce70[_0xf266('0x1fe')]+=0x1;_0x1996e5[_0xf266('0xaf')](_0x3dce70);if(_0x3dce70[_0xf266('0x1ff')]){_0x1996e5[_0xf266('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x6fbe27['ContactId'],'ListId':_0x6fbe27[_0xf266('0xd3')],'VoiceQueueId':_0x6fbe27[_0xf266('0xd4')]||undefined,'CampaignId':_0x6fbe27['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x1996e5[_0xf266('0xcb')](createObjHistory(_0x3dce70,_0x6fbe27,_0xf266('0x200'),0x17,'RecallInQueue'))[_0xf266('0xae')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x1996e5[_0xf266('0xdc')](createObjHistory(_0x3dce70,_0x6fbe27,_0xf266('0x201'),0x16,_0xf266('0x202')),_0xf266('0x203'),_0xf266('0x204'));}}}}else{_0x3dce70[_0xf266('0x205')]+=0x1;_0x1996e5[_0xf266('0xdc')](createObjHistory(_0x3dce70,_0x6fbe27,_0xf266('0x206'),0xd,_0xf266('0x207')),'[Originate][historyBlacklist]',_0xf266('0x208'));throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x10b372){var _0x4ecfe7=this;var _0x3be22e=_0x10b372[_0xf266('0x209')]-_0x10b372['originated']-_0x10b372[_0xf266('0xc4')];emitCampaignSummary(_0x10b372);if(_0x3be22e>0x0){if(_0x3be22e>this[_0xf266('0x25')]){_0x3be22e=this[_0xf266('0x25')];}_0x10b372[_0xf266('0xc4')]+=_0x3be22e;this[_0xf266('0xc6')](_0x10b372['id'],_0x3be22e,_0x10b372[_0xf266('0x20a')],_0x10b372)['then'](function(_0x1fff20){_0x10b372[_0xf266('0xc4')]-=_0x3be22e;_0x10b372[_0xf266('0xc4')]=_0x10b372[_0xf266('0xc4')]>0x0?_0x10b372[_0xf266('0xc4')]:0x0;if(!checkContactEmpty(_0x1fff20)){_0x10b372[_0xf266('0x41')]=_0xf266('0x20b');logger['info'](_0xf266('0x20c')+_0x10b372[_0xf266('0x45')]);}else{_0x10b372['originated']+=_0x1fff20[_0xf266('0x96')];_0x10b372['message']='RUNNING';for(var _0x82e594=0x0;_0x82e594<_0x1fff20['length'];_0x82e594+=0x1){_0x10b372[_0xf266('0x20d')]+=0x1;if(_[_0xf266('0xab')](_0x1fff20[_0x82e594])||_[_0xf266('0xab')](_0x1fff20[_0x82e594][_0xf266('0x18a')])||_[_0xf266('0xab')](_0x1fff20[_0x82e594]['phone'])){_0x4ecfe7['emptyContact']('[actionOriginate]\x20',_0x10b372,_0x1fff20[_0x82e594]);}else{_0x4ecfe7['checkIsBlackListIvr'](_[_0xf266('0xd1')](_0x1fff20[_0x82e594],['CampaignId',_0xf266('0x174')]))['then'](_0x4ecfe7[_0xf266('0x20e')](_0x10b372,_0x1fff20[_0x82e594]))[_0xf266('0xae')](_0x4ecfe7[_0xf266('0xce')](_0xf266('0x20f'),_0x10b372));}}}})[_0xf266('0xae')](loggerGetContactDialer(_0xf266('0x210'),_0x10b372,_0x3be22e));}};Dialer[_0xf266('0xa7')][_0xf266('0x156')]=function(_0x4319ef,_0x462f84){var _0x4225be=this;var _0x308d27=[];var _0x26b55e=_0x462f84>=0x1?_0x462f84:0x1;if(_0x4319ef[_0xf266('0x5d')]===_0xf266('0x7')){_0x26b55e=0x1;}var _0x2564a5=Math['floor'](_0x4319ef['available']*_0x26b55e)-_0x4319ef['originated']-_0x4319ef['temp'];emitVoiceQueueSummary(_0x4319ef);if(_0x4319ef['dialLimitQueue']>0x0){var _0xac6da=_0x4319ef['dialLimitQueue']-_0x4319ef[_0xf266('0x70')]-_0x4319ef[_0xf266('0x58')]-_0x4319ef['temp']-_0x4319ef[_0xf266('0x9d')];if(_0x2564a5>_0xac6da){_0x2564a5=_0xac6da;}}if(_0x2564a5>0x0){if(_0x4319ef[_0xf266('0x5d')]==='booked'){_0x2564a5=0x1;}if(_0x2564a5>this[_0xf266('0x25')]){_0x2564a5=this[_0xf266('0x25')];}_0x4319ef[_0xf266('0xc4')]+=_0x2564a5;for(var _0x1e9247 in this[_0xf266('0x23')]){if(typeof this[_0xf266('0x23')][_0x1e9247]!=='undefined'){if(this[_0xf266('0x23')][_0x1e9247]['state']===_0xf266('0x211')&&this[_0xf266('0x23')][_0x1e9247][_0xf266('0xda')]===_0xf266('0x169')){_0x308d27[_0xf266('0x129')](this[_0xf266('0x23')][_0x1e9247]['id']);}}}this[_0xf266('0xc3')](_0x4319ef['id'],_0x308d27,_0x2564a5,_0x4319ef['dialOrderByScheduledAt'],_0x4319ef)['then'](function(_0x3a15dc){_0x4319ef[_0xf266('0xc4')]-=_0x2564a5;_0x4319ef['temp']=_0x4319ef[_0xf266('0xc4')]>0x0?_0x4319ef[_0xf266('0xc4')]:0x0;if(!checkContactEmpty(_0x3a15dc)){_0x4225be[_0xf266('0xb3')](_0x4319ef)[_0xf266('0xb5')](sendMessageReschedule(_0x4319ef))[_0xf266('0xae')](loggerCatch('[countReScheduled]\x20'));}else{_0x4319ef[_0xf266('0x70')]+=_0x3a15dc[_0xf266('0x96')];_0x4319ef[_0xf266('0x41')]=_0x4319ef[_0xf266('0x5d')]==='booked'?_0xf266('0x17b'):_0xf266('0x212');for(var _0x5cf17a=0x0;_0x5cf17a<_0x3a15dc[_0xf266('0x96')];_0x5cf17a+=0x1){if(_['isNil'](_0x3a15dc[_0x5cf17a])||_['isNil'](_0x3a15dc[_0x5cf17a][_0xf266('0x18a')])||_[_0xf266('0xab')](_0x3a15dc[_0x5cf17a]['phone'])){_0x4225be[_0xf266('0xcf')](_0xf266('0x213'),_0x4319ef,_0x3a15dc[_0x5cf17a]);}else{_0x4225be[_0xf266('0xb6')](_[_0xf266('0xd1')](_0x3a15dc[_0x5cf17a],['VoiceQueueId',_0xf266('0x174')]))[_0xf266('0xb5')](_0x4225be['checkContactBlack'](_0x4319ef,_0x3a15dc[_0x5cf17a]))['catch'](_0x4225be[_0xf266('0xce')]('[actionOriginate]\x20',_0x4319ef));}}}})['catch'](loggerGetContactDialer(_0xf266('0x214'),_0x4319ef,_0x2564a5));}};Dialer[_0xf266('0xa7')][_0xf266('0x8e')]=function(_0x22c131){if(_0x22c131[_0xf266('0x215')]>0x0){var _0x1308d4=_0x22c131[_0xf266('0x215')]-_0x22c131[_0xf266('0x70')]-_0x22c131['talking'];if(_0x1308d4>0x0){this[_0xf266('0x216')](_0x22c131);}else{loggerPredictiveCalls[_0xf266('0x7f')](_0xf266('0x217'));}}else{this[_0xf266('0x216')](_0x22c131);}};Dialer[_0xf266('0xa7')]['tryOriginatePredictive']=function(_0x19ff64){var _0x5b9710=this;var _0x4c9cae=[];_0x19ff64[_0xf266('0x70')]+=0x1;for(var _0x5c83c4 in this[_0xf266('0x23')]){if(typeof this[_0xf266('0x23')][_0x5c83c4]!==_0xf266('0x97')){if(this[_0xf266('0x23')][_0x5c83c4][_0xf266('0xa3')]==='not_inuse'&&this[_0xf266('0x23')][_0x5c83c4][_0xf266('0xda')]===_0xf266('0x169')){_0x4c9cae[_0xf266('0x129')](this[_0xf266('0x23')][_0x5c83c4]['id']);}}}this[_0xf266('0xc3')](_0x19ff64['id'],_0x4c9cae,0x1,_0x19ff64['dialOrderByScheduledAt'],_0x19ff64)[_0xf266('0xb5')](function(_0x46c732){if(!checkContactEmpty(_0x46c732)){checkContactLowerLimitOriginate(_0x19ff64,0x1,0x0);_0x5b9710[_0xf266('0xb3')](_0x19ff64)[_0xf266('0xb5')](sendMessageReschedule(_0x19ff64))[_0xf266('0xae')](loggerCatch(_0xf266('0x218')));}else{_0x19ff64[_0xf266('0x41')]=_0xf266('0x212');if(_[_0xf266('0xab')](_0x46c732[0x0])||_[_0xf266('0xab')](_0x46c732[0x0][_0xf266('0x18a')])||_['isNil'](_0x46c732[0x0]['phone'])){_0x5b9710[_0xf266('0xcf')]('[actionOriginate]\x20',_0x19ff64,_0x46c732[0x0]);}else{_0x5b9710[_0xf266('0xb6')](_[_0xf266('0xd1')](_0x46c732[0x0],[_0xf266('0xd4'),_0xf266('0x174')]))[_0xf266('0xb5')](_0x5b9710['checkContactBlack'](_0x19ff64,_0x46c732[0x0]))[_0xf266('0xae')](_0x5b9710['loggerHandler']('[actionOriginatePredictive]\x20',_0x19ff64));}}})[_0xf266('0xae')](loggerGetContactDialer(_0xf266('0x219'),_0x19ff64,0x1));emitVoiceQueueSummary(_0x19ff64);};Dialer['prototype'][_0xf266('0x1e9')]=function(_0x1b9598,_0x481394,_0x266e4d,_0x2511c6,_0x57016b,_0x290871){loggerPredictive['info'](_0xf266('0x21a'));loggerPredictive[_0xf266('0x7f')]('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',_0x1b9598);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x481394);loggerPredictive[_0xf266('0x7f')]('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',_0x266e4d);loggerPredictive[_0xf266('0x7f')]('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',_0x2511c6);loggerPredictive[_0xf266('0x7f')](_0xf266('0x21b'),_0x57016b);loggerPredictive[_0xf266('0x7f')](_0xf266('0x86'));return new Promise(function(_0x246219,_0x4863b1){if(_0x1b9598<=0x0||isNaN(_0x1b9598)){return _0x4863b1(msgResponse(_0xf266('0x21c'),'Error',_0xf266('0x21d')+_0x1b9598));}if(_0x266e4d<=0x0||isNaN(_0x266e4d)){return _0x4863b1(msgResponse(_0xf266('0x21c'),_0xf266('0x4d'),_0xf266('0x21e')+_0x266e4d));}if(_0x2511c6<=0x0||isNaN(_0x2511c6)){return _0x4863b1(msgResponse('[abandonmentRate]',_0xf266('0x4d'),_0xf266('0x21f')+_0x2511c6));}if(_0x481394<=0x0||isNaN(_0x481394)){return _0x4863b1(msgResponse(_0xf266('0x21c'),_0xf266('0x4d'),_0xf266('0x220')+_0x481394));}if(_0x57016b<=0x0||isNaN(_0x57016b)){return _0x4863b1(msgResponse(_0xf266('0x21c'),'Error',_0xf266('0x221')+_0x57016b));}_0x290871=_0x290871||0x0;var _0x4e98fc=0x1/_0x266e4d;var _0x654a39=0x0;var _0x1d0902=0x0;var _0xd3dd35=0x0;var _0x20180f=0x0;for(var _0x54016a=0x0;_0xd3dd35<_0x57016b;_0x54016a+=0x1){_0x1d0902=_0x54016a/_0x481394;_0x654a39=(_0x2511c6*_0x1d0902+_0x290871)/_0x4e98fc;_0xd3dd35=erlangb(_0x654a39,_0x1b9598);_0x20180f=_0x654a39/_0x1b9598*(0x1-erlangb(_0x654a39,_0x1b9598));}return _0x246219({'erlangCalls':_0x54016a,'erlangCallToSecond':_0x481394/_0x54016a,'erlangAbandonmentRate':_0xd3dd35,'erlangBusyFactor':_0x20180f});});};Dialer['prototype']['busyFactor']=function(_0x37d983,_0x4e4d98,_0x4c3064,_0x29cb2c,_0xea3649,_0x4a2c5c){loggerPredictive[_0xf266('0x7f')](_0xf266('0x222'));loggerPredictive[_0xf266('0x7f')](_0xf266('0x223'),_0x37d983);loggerPredictive[_0xf266('0x7f')](_0xf266('0x224'),_0x4e4d98);loggerPredictive[_0xf266('0x7f')](_0xf266('0x225'),_0x4c3064);loggerPredictive['info'](_0xf266('0x226'),_0x29cb2c);loggerPredictive[_0xf266('0x7f')](_0xf266('0x227'),_0xea3649);loggerPredictive[_0xf266('0x7f')](_0xf266('0x86'));return new Promise(function(_0x5a8939,_0x3f270d){if(_0x37d983<=0x0||isNaN(_0x37d983)){return _0x3f270d(msgResponse(_0xf266('0x228'),_0xf266('0x4d'),_0xf266('0x21d')+_0x37d983));}if(_0x4c3064<=0x0||isNaN(_0x4c3064)){return _0x3f270d(msgResponse(_0xf266('0x228'),_0xf266('0x4d'),'Ts\x20=\x20'+_0x4c3064));}if(_0x29cb2c<=0x0||isNaN(_0x29cb2c)){return _0x3f270d(msgResponse(_0xf266('0x228'),'Error',_0xf266('0x21f')+_0x29cb2c));}if(_0x4e4d98<=0x0||isNaN(_0x4e4d98)){return _0x3f270d(msgResponse(_0xf266('0x228'),_0xf266('0x4d'),_0xf266('0x220')+_0x4e4d98));}if(_0xea3649<=0x0||isNaN(_0xea3649)){return _0x3f270d(msgResponse(_0xf266('0x228'),'Error',_0xf266('0x229')+_0xea3649));}_0x4a2c5c=_0x4a2c5c||0x0;var _0x586393=0x1/_0x4c3064;var _0x50ea61=0x0;var _0x154e3b=0x0;var _0x5675a2=0x0;var _0x41e59e=0x0;for(var _0x15ba6f=0x0;_0x41e59e<_0xea3649;_0x15ba6f+=0x1){_0x154e3b=_0x15ba6f/_0x4e4d98;_0x50ea61=(_0x29cb2c*_0x154e3b+_0x4a2c5c)/_0x586393;_0x5675a2=erlangb(_0x50ea61,_0x37d983);_0x41e59e=_0x50ea61/_0x37d983*(0x1-erlangb(_0x50ea61,_0x37d983));}return _0x5a8939({'erlangCalls':_0x15ba6f,'erlangCallToSecond':_0x4e4d98/_0x15ba6f,'erlangAbandonmentRate':_0x5675a2,'erlangBusyFactor':_0x41e59e});});};module[_0xf266('0x22a')]=Dialer; \ No newline at end of file +var _0xadb5=['outbound','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','xcally-motion-dialer','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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]','Umin\x20=\x20','exports','lodash','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','name','NOT_ACTIVE','Interval','Intervals','INTERVAL_IS_NULL','isEmpty','\x20INTERVAL_IS_NULL','[ifTime][Action]','stringify','milliseconds','diff','emit','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','-----\x20Stats\x20Predictive\x20---','info','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\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','merge','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','prototype','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','SIP/%s','unmonitored','saveInDb','moveContactManagedDialer','uniqueid','variable','exten','value','HANGUP','statedesc','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','MACHINE','Machine','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAMDActive','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','YYYY-MM-DD\x20HH:mm:ss','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','agiafterat','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','minutes','[rescheduleContact][Drop]','calleridnum','Abandoned','dropreason','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','actionid','paused','locked','stateinterface','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[booked][unlock3]','loopCampaigns','resetActiveCalls','syncCampaigns','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','push','command','interval','indexOf','iftime\x20%s,%s','timezones','content','true','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','launchHandleIvr','handleIvr','checkIfTime','dialTimezone','throttle','filter','online','reachable','map','user:dialPreviewRecallReminder','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xadb5,0xad));var _0x5adb=function(_0x589214,_0x1d0a79){_0x589214=_0x589214-0x0;var _0xc7ab12=_0xadb5[_0x589214];return _0xc7ab12;};'use strict';var util=require('util');var _=require(_0x5adb('0x0'));var uuid=require('uuid');var moment=require(_0x5adb('0x1'));var rr=require('rr');var md5=require(_0x5adb('0x2'));var Redis=require(_0x5adb('0x3'));var ut=require('../preview/util/util');var config=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var loggerBooked=require('../../../config/logger')(_0x5adb('0x7'));var loggerPredictive=require(_0x5adb('0x5'))(_0x5adb('0x8'));var loggerPredictiveCalls=require(_0x5adb('0x5'))(_0x5adb('0x9'));var loggerSyncQueueSummary=require(_0x5adb('0x5'))(_0x5adb('0xa'));var ami=require(_0x5adb('0xb'));config[_0x5adb('0xc')]=_[_0x5adb('0xd')](config[_0x5adb('0xc')],{'host':_0x5adb('0xe'),'port':0x18eb});var io=require(_0x5adb('0xf'))(new Redis(config[_0x5adb('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperAdditionalPhone=require(_0x5adb('0x10'));var cmHopperBlack=require(_0x5adb('0x11'));var voiceQueueRt=require(_0x5adb('0x12'));var RpcSetting=require('../rpc/setting');var Action=require(_0x5adb('0x13'));var History=require('./history');var Final=require(_0x5adb('0x14'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x5adb('0x15'));var Hangup=require(_0x5adb('0x16'));var ipAgi=process[_0x5adb('0x17')]['XCALLY_IP_AGI']||_0x5adb('0x18');var strategy={'rrmemory':_0x5adb('0x19'),'roundrobin':_0x5adb('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x5adb('0x1b')]=function(_0x518823){this[_0x5adb('0x1c')]=this[_0x5adb('0x1c')]?this[_0x5adb('0x1c')][_0x5adb('0x1d')](_0x518823):_0x518823();};function Dialer(_0x1c0f97,_0x39d24d){this[_0x5adb('0x1e')]=new Sequence();this[_0x5adb('0x1f')]=_0x39d24d;this[_0x5adb('0x20')]=_0x1c0f97['voiceQueues'];this[_0x5adb('0x21')]=_0x1c0f97['campaigns'];this[_0x5adb('0x22')]=_0x1c0f97['agents'];this[_0x5adb('0x23')]=_0x1c0f97['trunks'];this['maxNumberOriginate']=config[_0x5adb('0x24')]||0x2;this[_0x5adb('0x25')]={};this[_0x5adb('0x26')]={};this[_0x5adb('0x27')]={};this[_0x5adb('0x28')]={};this['optionPredictive']={};this[_0x5adb('0x29')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x5adb('0x2a')]={};this[_0x5adb('0x2b')]={};ami['on'](_0x5adb('0x2c'),this[_0x5adb('0x2d')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x2f'),this[_0x5adb('0x30')]['bind'](this));ami['on'](_0x5adb('0x31'),this[_0x5adb('0x32')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x33'),this[_0x5adb('0x34')]['bind'](this));ami['on'](_0x5adb('0x35'),this[_0x5adb('0xa')]['bind'](this));ami['on'](_0x5adb('0x36'),this[_0x5adb('0x37')][_0x5adb('0x2e')](this));ami['on']('hangup',this[_0x5adb('0x38')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x39'),this[_0x5adb('0x3a')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x3b'),this['syncVarSet']['bind'](this));ami['on']('queuemember',this[_0x5adb('0x3c')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x3d'),this[_0x5adb('0x3e')][_0x5adb('0x2e')](this));this['loopCampaigns']();this[_0x5adb('0x3f')]();RpcSetting[_0x5adb('0x40')]()[_0x5adb('0x41')](function(_0x3b1fed){previewRecallmeReminderInterval=_0x3b1fed[_0x5adb('0x42')];});}function isNotNull(_0x3145f2){return _0x3145f2!==null&&!_[_0x5adb('0x43')](_0x3145f2);}function checkIsLoggedIn(_0x28bf1f,_0x138bf6){return function(){if(_0x138bf6<=0x0){_0x28bf1f[_0x5adb('0x44')]='AGENTS_NOT_LOGGED';throw _0x28bf1f[_0x5adb('0x45')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x12424d){return _0x12424d;}function checkIsActive(_0x20cde6,_0x5d1441){return function(){if(!isActive(_0x5d1441)){_0x20cde6[_0x5adb('0x44')]=_0x5adb('0x46');throw _0x20cde6[_0x5adb('0x45')]+'\x20NOT\x20Active';}};}function checkInterval(_0x173789){return function(){if(!isNotNull(_0x173789[_0x5adb('0x47')])){_0x173789['message']='INTERVAL_IS_NULL';throw _0x173789[_0x5adb('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x173789[_0x5adb('0x47')][_0x5adb('0x48')])){_0x173789[_0x5adb('0x44')]=_0x5adb('0x49');throw _0x173789[_0x5adb('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x5adb('0x4a')](_0x173789[_0x5adb('0x47')][_0x5adb('0x48')]))){_0x173789['message']='INTERVAL_IS_NULL';throw _0x173789[_0x5adb('0x45')]+_0x5adb('0x4b');}};}function msgResponse(_0x586820,_0x2355bc,_0x4a4260){return{'action':_0x586820,'response':_0x2355bc,'message':_0x4a4260,'stack':_0x4a4260};}function myreject(_0x199d3b){return function(_0x58cc5d){return _0x199d3b(msgResponse(_0x5adb('0x4c'),'Error',JSON[_0x5adb('0x4d')](_0x58cc5d)));};}function getSeconds(_0x23a1db,_0x4ccb27){var _0x4761e3=moment(_0x23a1db)['milliseconds'](0x0);var _0xadbe37=moment(_0x4ccb27)[_0x5adb('0x4e')](0x0);return _0x4761e3[_0x5adb('0x4f')](_0xadbe37,'seconds');}function emit(_0x425dc7,_0x2b3b0b,_0xcdaf8e){io['to'](_0x425dc7)[_0x5adb('0x50')](_0x2b3b0b,_0xcdaf8e);}function emitVoiceQueueSummary(_0x22aa95){if(_0x22aa95['type']==='outbound'){var _0x4f491a={'id':_0x22aa95['id'],'name':_0x22aa95['name'],'strategy':_0x22aa95[_0x5adb('0x51')],'answered':_0x22aa95[_0x5adb('0x52')],'available':_0x22aa95[_0x5adb('0x53')],'loggedIn':_0x22aa95[_0x5adb('0x54')],'pTalking':_0x22aa95[_0x5adb('0x55')],'sumBillable':_0x22aa95[_0x5adb('0x56')],'sumDuration':_0x22aa95[_0x5adb('0x57')],'sumHoldTime':_0x22aa95[_0x5adb('0x58')]||0x0,'talking':_0x22aa95['talking'],'total':_0x22aa95['total'],'type':_0x22aa95[_0x5adb('0x59')],'unmanaged':_0x22aa95['unmanaged'],'abandoned':_0x22aa95[_0x5adb('0x5a')],'waiting':_0x22aa95[_0x5adb('0x5b')],'loggedInDb':_0x22aa95[_0x5adb('0x5c')],'dialActive':_0x22aa95[_0x5adb('0x5d')],'dialMethod':_0x22aa95[_0x5adb('0x5e')],'dialOriginateCallerIdName':_0x22aa95['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x22aa95[_0x5adb('0x5f')],'dialOriginateTimeout':_0x22aa95[_0x5adb('0x60')],'dialPrefix':_0x22aa95['dialPrefix'],'outboundAnswerAgiCallsDay':_0x22aa95[_0x5adb('0x61')],'outboundAnswerCallsDay':_0x22aa95[_0x5adb('0x62')],'outboundBlacklistCallsDay':_0x22aa95['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x22aa95[_0x5adb('0x63')],'outboundCongestionCallsDay':_0x22aa95[_0x5adb('0x64')],'outboundDropCallsDayACS':_0x22aa95[_0x5adb('0x65')],'outboundDropCallsDayCallersExit':_0x22aa95[_0x5adb('0x66')],'outboundDropCallsDayTimeout':_0x22aa95[_0x5adb('0x67')],'outboundNoAnswerCallsDay':_0x22aa95[_0x5adb('0x68')],'outboundNoSuchCallsDay':_0x22aa95[_0x5adb('0x69')],'outboundOriginateFailureCallsDay':_0x22aa95['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x22aa95['outboundReCallsDay'],'outboundRejectCallsDay':_0x22aa95[_0x5adb('0x6a')],'outboundUnknownCallsDay':_0x22aa95[_0x5adb('0x6b')],'predictiveIntervalAnsweredCalls':_0x22aa95[_0x5adb('0x6c')],'predictiveIntervalAvgHoldtime':_0x22aa95[_0x5adb('0x6d')],'predictiveIntervalAvgTalktime':_0x22aa95['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x22aa95['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x22aa95[_0x5adb('0x6e')],'predictiveIntervalErlangCalls':_0x22aa95[_0x5adb('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x22aa95[_0x5adb('0x70')],'predictiveIntervalHitRate':_0x22aa95[_0x5adb('0x71')],'predictiveIntervalMultiplicativeFactor':_0x22aa95[_0x5adb('0x72')],'predictiveIntervalPauses':_0x22aa95['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x22aa95[_0x5adb('0x73')],'predictiveIntervalTotalCalls':_0x22aa95[_0x5adb('0x74')],'message':_0x22aa95['message'],'originated':_0x22aa95[_0x5adb('0x75')],'erlangCalls':_0x22aa95[_0x5adb('0x76')],'erlangCallToSecond':_0x22aa95[_0x5adb('0x77')],'erlangAbandonmentRate':_0x22aa95[_0x5adb('0x78')],'erlangBusyFactor':_0x22aa95[_0x5adb('0x79')],'startPredictive':_0x22aa95[_0x5adb('0x29')],'startProgressive':_0x22aa95[_0x5adb('0x7a')]};if(_0x22aa95[_0x5adb('0x7b')]){_0x4f491a['Trunk']={'id':_0x22aa95[_0x5adb('0x7b')]['id'],'name':_0x22aa95['Trunk']['name'],'active':_0x22aa95['Trunk'][_0x5adb('0x7c')],'callerid':_0x22aa95[_0x5adb('0x7b')][_0x5adb('0x7d')]};}if(_0x22aa95['Interval']){_0x4f491a[_0x5adb('0x47')]={'id':_0x22aa95['Interval']['id'],'name':_0x22aa95[_0x5adb('0x47')][_0x5adb('0x45')]};}var _0x3f9dc7=md5(JSON['stringify'](_0x4f491a));if(_0x22aa95[_0x5adb('0x2')]!==_0x3f9dc7){_0x22aa95['md5']=_0x3f9dc7;emit(util[_0x5adb('0x7e')](_0x5adb('0x7f'),_0x4f491a['name']),_0x5adb('0x80'),_0x4f491a);}}}function emitCampaignSummary(_0x1ab97b){if(_0x1ab97b[_0x5adb('0x59')]===_0x5adb('0x81')){emit(util[_0x5adb('0x7e')]('campaign:ivr:%s',_0x1ab97b[_0x5adb('0x45')]),_0x5adb('0x82'),_0x1ab97b);}}function checkGetDataPredictive(_0x3bcf6f){if(isNotNull(_0x3bcf6f)&&!_[_0x5adb('0x4a')](_0x3bcf6f)){loggerPredictive['info'](_0x5adb('0x83'));loggerPredictive[_0x5adb('0x84')](_0x5adb('0x85'),_0x3bcf6f['predictiveIntervalTotalCalls']);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x86'),_0x3bcf6f[_0x5adb('0x6c')]);loggerPredictive[_0x5adb('0x84')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3bcf6f[_0x5adb('0x6e')]);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x87'),_0x3bcf6f[_0x5adb('0x88')]);loggerPredictive[_0x5adb('0x84')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3bcf6f[_0x5adb('0x6d')]);loggerPredictive['info'](_0x5adb('0x89'),_0x3bcf6f['predictiveIntervalAvgTalktime']);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8a'));if(_0x3bcf6f[_0x5adb('0x74')]>0x0){if(!_[_0x5adb('0x43')](_0x3bcf6f['predictiveIntervalAvgTalktime'])&&_0x3bcf6f[_0x5adb('0x8b')]>0x0){return!![];}loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8c'));if(!_['isUndefined'](_0x3bcf6f['predictiveIntervalAvgHoldtime'])&&_0x3bcf6f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8d'));}else{loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8e'));}}else{loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8f'));}return![];}function mergeDataErlangB(_0x204b9b){return function(_0x8d7810){loggerPredictive[_0x5adb('0x84')](_0x5adb('0x90'));loggerPredictive[_0x5adb('0x84')](_0x5adb('0x91'),_0x8d7810[_0x5adb('0x76')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x8d7810[_0x5adb('0x77')]);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x92'),_0x8d7810[_0x5adb('0x78')]);loggerPredictive['info'](_0x5adb('0x93'),_0x8d7810[_0x5adb('0x79')]);loggerPredictive['info'](_0x5adb('0x92'),_0x8d7810[_0x5adb('0x78')]);loggerPredictive[_0x5adb('0x84')]('---------------------------');_[_0x5adb('0x94')](_0x204b9b,_0x8d7810);};}function getDiff(_0x409357){var _0x19df2f=moment()[_0x5adb('0x4e')](0x0);var _0x330290=moment(_0x409357)[_0x5adb('0x4e')](0x0);return _0x19df2f['diff'](_0x330290,_0x5adb('0x95'));}function ifInterval(_0x1f042f,_0x4488e7){if(_['isUndefined'](_0x4488e7)){return![];}return getDiff(_0x4488e7)<_0x1f042f*0x3c;}function freeVariablesPredictive(_0xcd71d2){if(isNotNull(_0xcd71d2)){if(!_[_0x5adb('0x43')](_0xcd71d2[_0x5adb('0x7a')])){_0xcd71d2['startProgressive']=undefined;loggerPredictive[_0x5adb('0x84')](_0xcd71d2['name'],_0x5adb('0x96'));}if(!_[_0x5adb('0x43')](_0xcd71d2[_0x5adb('0x29')])){_0xcd71d2['startPredictive']=undefined;loggerPredictive[_0x5adb('0x84')](_0xcd71d2[_0x5adb('0x45')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x5adb('0x43')](_0xcd71d2[_0x5adb('0x97')])){clearInterval(_0xcd71d2[_0x5adb('0x97')]);_0xcd71d2[_0x5adb('0x97')]=undefined;loggerPredictive['info'](_0xcd71d2[_0x5adb('0x45')],_0x5adb('0x98'));}}}function erlangb(_0x307f07,_0x16716e){if(_0x16716e===0x0){return 0x0;}var _0x5b7556=0x1;for(var _0x53a4bc=0x1;_0x53a4bc<=_0x16716e;_0x53a4bc+=0x1){_0x5b7556=0x1+_0x5b7556*_0x53a4bc/_0x307f07;}return 0x1/_0x5b7556;}function isVoiceQueueOutbound(_0x304512){return _0x304512==='outbound';}function isNotPreview(_0x4d635f){return _0x4d635f!=='preview';}function isCampaignIvr(_0x174a83){return _0x174a83===_0x5adb('0x81');}function getCallerId(_0x48bb5c,_0x395350,_0x91e023){if(!_[_0x5adb('0x43')](_0x91e023)&&typeof _0x91e023===_0x5adb('0x99')&&!_[_0x5adb('0x4a')](_0x91e023)){if(!_[_0x5adb('0x43')](_0x395350)&&typeof _0x395350===_0x5adb('0x99')&&!_[_0x5adb('0x4a')](_0x395350)){return util['format']('\x22%s\x22\x20<%s>',_0x395350,_0x91e023);}return util['format'](_0x5adb('0x9a'),_0x91e023,_0x91e023);}if(!_[_0x5adb('0x43')](_0x48bb5c)&&typeof _0x48bb5c===_0x5adb('0x99')&&!_[_0x5adb('0x4a')](_0x48bb5c)){return _0x48bb5c;}return _0x5adb('0x9b');}function loggerCatchQueueSummary(_0x2f6ef7,_0x386c76){return function(_0x25f761){freeVariablesPredictive(_0x386c76);emitVoiceQueueSummary(_0x386c76);emitCampaignSummary(_0x386c76);loggerSyncQueueSummary['debug'](_0x2f6ef7,util['inspect'](_0x25f761,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1fc73b,_0x56df90){return function(_0x114ee4){loggerPredictive[_0x5adb('0x9c')](_0x56df90[_0x5adb('0x45')],_0x1fc73b);loggerPredictive[_0x5adb('0x9c')](_0x114ee4[_0x5adb('0x9d')]);freeVariablesPredictive(_0x56df90);};}function loggerCatch(_0x236f59){return function(_0x338aee){logger[_0x5adb('0x9c')](_0x236f59,util['inspect'](_0x338aee,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xedde86){return _0xedde86&&!_[_0x5adb('0x43')](_0xedde86)&&_0xedde86[_0x5adb('0x9e')]>0x0;}function decremetOriginate(_0x5d3aa4){if(!_[_0x5adb('0x43')](_0x5d3aa4)&&_0x5d3aa4!==null){if(typeof _0x5d3aa4[_0x5adb('0x75')]!=='undefined'){if(_0x5d3aa4[_0x5adb('0x75')]>0x0){_0x5d3aa4['originated']-=0x1;}else{logger[_0x5adb('0x9c')](_0x5adb('0x9f'));}}}else{logger['error'](_0x5adb('0xa0'));}}function checkContactLowerLimitOriginate(_0x1ceb72,_0x3d49f2,_0x20e356){if(_0x3d49f2>_0x20e356){for(var _0x57b0dc=0x0;_0x57b0dc<_0x3d49f2-_0x20e356;_0x57b0dc+=0x1){decremetOriginate(_0x1ceb72);}}}function loggerGetContactDialer(_0x10f54a,_0x3cee6c,_0xad8e0c){return function(_0x49a8a6){checkContactLowerLimitOriginate(_0x3cee6c,_0xad8e0c,0x0);logger[_0x5adb('0x9c')](_0x10f54a,util[_0x5adb('0xa1')](_0x49a8a6,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2362b8){return function(_0x4a15ec){if(isNotNull(_0x4a15ec)&&isNotNull(_0x4a15ec[0x0])){if(_0x4a15ec[0x0]['contactsRescheduled']>0x0){_0x2362b8[_0x5adb('0x44')]='RESCHEDULED_CONTACTS';logger[_0x5adb('0x84')](_0x5adb('0xa2')+_0x2362b8[_0x5adb('0x45')],_0x4a15ec[0x0]['contactsRescheduled'],_0x5adb('0xa3'));}else{_0x2362b8[_0x5adb('0x44')]=_0x5adb('0xa4');logger[_0x5adb('0x84')](_0x5adb('0xa5')+_0x2362b8['name']);}}};}function notSendMessagesQueue(_0x2a3084){if(_0x2a3084[_0x5adb('0xa6')]){freeVariablesPredictive(_0x2a3084);if(_0x2a3084[_0x5adb('0x75')]===0x0&&_0x2a3084[_0x5adb('0xa7')]===0x0&&_0x2a3084['waiting']===0x0&&(_0x2a3084[_0x5adb('0x55')]||0x0)===0x0){_0x2a3084[_0x5adb('0xa6')]=![];_0x2a3084[_0x5adb('0x53')]=0x0;_0x2a3084[_0x5adb('0x44')]=_0x5adb('0x46');loggerSyncQueueSummary[_0x5adb('0xa8')](_0x5adb('0xa9'),_0x2a3084['name'],_0x5adb('0xaa'));}else{_0x2a3084[_0x5adb('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x5adb('0xa8')](_0x5adb('0xa9'),_0x2a3084['name'],_0x5adb('0xab'));}emitVoiceQueueSummary(_0x2a3084);}}function notSendMessagesCampaign(_0x50f8ed){if(_0x50f8ed[_0x5adb('0xa6')]){if(_0x50f8ed[_0x5adb('0x75')]===0x0){_0x50f8ed['sendMessageOneNotActive']=![];_0x50f8ed[_0x5adb('0x44')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x5adb('0xa8')](_0x5adb('0xac'),_0x50f8ed[_0x5adb('0x45')],_0x5adb('0xaa'));}else{_0x50f8ed[_0x5adb('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x5adb('0xa8')](_0x5adb('0xac'),_0x50f8ed[_0x5adb('0x45')],_0x5adb('0xab'));}emitCampaignSummary(_0x50f8ed);}}function createObjHistory(_0x47c631,_0x5e875c,_0x3f3db9,_0x461a07,_0x2e5c96){_0x47c631[_0x5adb('0x44')]=_0x3f3db9;var _0x277668=new Action(_0x47c631,_0x5e875c);var _0xc74e86=new History(_0x277668);_0xc74e86[_0x5adb('0xad')]=_0x461a07;_0xc74e86['statedesc']=_0x2e5c96;_0xc74e86[_0x5adb('0xae')]=_0x277668[_0x5adb('0xaf')];return _0xc74e86;}Dialer[_0x5adb('0xb0')][_0x5adb('0x3f')]=function(){var _0x55a9e8=this;setInterval(function(){_0x55a9e8[_0x5adb('0xb1')](_0x55a9e8[_0x5adb('0x28')],_0x5adb('0xb2'));_0x55a9e8[_0x5adb('0xb1')](_0x55a9e8[_0x5adb('0x26')],_0x5adb('0xb3'));},0x32c8);};Dialer[_0x5adb('0xb0')][_0x5adb('0xb1')]=function(_0x1f753e,_0x51ea1e){var _0x2a3e17=this;for(var _0x456799 in _0x1f753e){if(typeof _0x1f753e[_0x456799]!=='undefined'){this[_0x5adb('0x1e')][_0x5adb('0x1b')](function(){if(!_[_0x5adb('0xb4')](_0x1f753e[_0x456799])){return ami[_0x5adb('0xb5')]({'action':_0x5adb('0xb6'),'channel':_0x1f753e[_0x456799][_0x5adb('0xb7')]})[_0x5adb('0xb8')](function(_0x350bb1){if(_0x350bb1['message']===_0x5adb('0xb9')){setTimeout(function(){if(_0x1f753e[_0x456799]&&_0x1f753e[_0x456799][_0x5adb('0x59')]!=='ivr'){_0x2a3e17[_0x5adb('0xba')](_0x2a3e17[_0x5adb('0x20')][_0x1f753e[_0x456799][_0x5adb('0xbb')]]);logger['error']('[Dialer][checkChannel]',_0x51ea1e,_0x456799,_0x1f753e[_0x456799][_0x5adb('0xbb')]);delete _0x1f753e[_0x456799];}if(_0x1f753e[_0x456799]&&_0x1f753e[_0x456799][_0x5adb('0x59')]===_0x5adb('0x81')){_0x2a3e17['updateOriginated'](_0x2a3e17[_0x5adb('0x21')][_0x1f753e[_0x456799][_0x5adb('0xbb')]]);logger[_0x5adb('0x9c')](_0x5adb('0xbc'),_0x51ea1e,_0x456799,_0x1f753e[_0x456799][_0x5adb('0xbb')]);delete _0x1f753e[_0x456799];}},0x2328);}});}});}}};Dialer[_0x5adb('0xb0')][_0x5adb('0xbd')]=function(_0x463e84){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0xbd')](_0x463e84))[_0x5adb('0xb8')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x5adb('0xbf')]=function(_0x44756a){return Promise['resolve']()[_0x5adb('0x41')](cmHopperBlack[_0x5adb('0xbf')](_0x44756a))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xc0')));};Dialer[_0x5adb('0xb0')][_0x5adb('0xc1')]=function(_0x15626b,_0x327ac6,_0x42dddf){return Promise['resolve']()[_0x5adb('0x41')](cmHopperAdditionalPhone[_0x5adb('0xc1')](_0x15626b,_0x327ac6,_0x42dddf))[_0x5adb('0xb8')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x5adb('0xb0')][_0x5adb('0xc2')]=function(_0x2b6e56,_0x209653,_0x64475f){return Promise[_0x5adb('0xbe')]()['then'](cmHopperAdditionalPhone[_0x5adb('0xc2')](_0x2b6e56,_0x209653,_0x64475f))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xc3')));};Dialer[_0x5adb('0xb0')][_0x5adb('0xc4')]=function(_0x3a201a){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopperBlack[_0x5adb('0xc4')](_0x3a201a))[_0x5adb('0xb8')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x5adb('0xb0')]['averageHandleTime']=function(_0x3343fc){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopperHistory[_0x5adb('0xc5')](_0x3343fc))[_0x5adb('0xb8')](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0x5adb('0xc6')]=function(_0xa385eb){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0xc6')](_0xa385eb))[_0x5adb('0xb8')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x5adb('0xc7')]=function(_0xd5b95d,_0x9d80fd,_0x4f5721){return Promise['resolve']()[_0x5adb('0x41')](cmHopper['unlockContact'](_0xd5b95d,_0x9d80fd,_0x4f5721))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xc8')));};Dialer['prototype']['getContactDialer']=function(_0x43b91c,_0x4bb198,_0x4961bc,_0x2b7aba,_0x1537a9){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0xc9')](_0x43b91c,_0x4bb198,_0x4961bc,_0x2b7aba))[_0x5adb('0xb8')](function(_0xa51ffc){_0x1537a9[_0x5adb('0xca')]-=_0x4961bc;_0x1537a9[_0x5adb('0xca')]=_0x1537a9[_0x5adb('0xca')]>0x0?_0x1537a9[_0x5adb('0xca')]:0x0;loggerCatch(_0x5adb('0xcb'))(_0xa51ffc);});};Dialer[_0x5adb('0xb0')]['getContactDialerIvr']=function(_0xb3a828,_0x56d563,_0x409910,_0x4c7163){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0xcc')](_0xb3a828,_0x56d563,_0x409910))[_0x5adb('0xb8')](function(_0xfb8035){_0x4c7163[_0x5adb('0xca')]-=_0x56d563;_0x4c7163[_0x5adb('0xca')]=_0x4c7163[_0x5adb('0xca')]>0x0?_0x4c7163[_0x5adb('0xca')]:0x0;loggerCatch(_0x5adb('0xcd'))(_0xfb8035);});};Dialer['prototype'][_0x5adb('0xce')]=function(_0x30e648){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](voiceQueueRt[_0x5adb('0xce')](_0x30e648))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xcf')));};Dialer[_0x5adb('0xb0')]['moveContactManagedDialer']=function(_0xe7ddc4){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper['moveContactManagedDialer'](_0xe7ddc4))[_0x5adb('0xb8')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x5adb('0xb0')]['createHistory']=function(_0x54da7c){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopperHistory[_0x5adb('0xd0')](_0x54da7c))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xd1')));};Dialer[_0x5adb('0xb0')][_0x5adb('0xba')]=function(_0xa1911a){if(!_[_0x5adb('0x43')](_0xa1911a)&&_0xa1911a!==null){if(typeof _0xa1911a[_0x5adb('0x75')]!==_0x5adb('0xd2')){if(_0xa1911a[_0x5adb('0x75')]>0x0){_0xa1911a['originated']-=0x1;}else{logger[_0x5adb('0x9c')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x5adb('0x9c')](_0x5adb('0xd3'));}};Dialer['prototype'][_0x5adb('0xd4')]=function(_0x4e54dd,_0x55dd31){var _0x4b367d=this;return function(_0x78c975){_0x4b367d[_0x5adb('0xba')](_0x55dd31);logger[_0x5adb('0x9c')](_0x4e54dd,util[_0x5adb('0xa1')](_0x78c975,{'showHidden':![],'depth':null}));};};Dialer[_0x5adb('0xb0')][_0x5adb('0xd5')]=function(_0x5dd55f,_0x4293e5,_0x263421){var _0x88aac7={'state':0x19,'statedesc':_0x5adb('0xd6')};this[_0x5adb('0xba')](_0x4293e5);this['saveInDb'](_['merge'](_0x88aac7,_[_0x5adb('0xd7')](_0x263421,[_0x5adb('0xd8'),_0x5adb('0xd9'),_0x5adb('0xda'),_0x5adb('0xdb'),_0x5adb('0xdc')])),_0x5adb('0xdd'),_0x5adb('0xde'));logger[_0x5adb('0x9c')](_0x5dd55f);};Dialer['prototype'][_0x5adb('0xdf')]=function(_0x2d7264){return _0x2d7264==='Success';};Dialer['prototype']['isTrunkReachable']=function(_0x2cbec9){return!_[_0x5adb('0x43')](_0x2cbec9)&&_0x2cbec9&&!_[_0x5adb('0x43')](_0x2cbec9['name'])&&!_['isUndefined'](_0x2cbec9[_0x5adb('0x7c')])&&_0x2cbec9[_0x5adb('0x7c')]&&(this[_0x5adb('0x23')][util[_0x5adb('0x7e')](_0x5adb('0xe0'),_0x2cbec9[_0x5adb('0x45')])]['status']==='reachable'||this[_0x5adb('0x23')][util['format'](_0x5adb('0xe0'),_0x2cbec9[_0x5adb('0x45')])]['status']===_0x5adb('0xe1'));};Dialer[_0x5adb('0xb0')][_0x5adb('0xe2')]=function(_0x2aebe2,_0x57a42f,_0x131a9f){this[_0x5adb('0xd0')](_0x2aebe2)[_0x5adb('0xb8')](loggerCatch(_0x57a42f));this[_0x5adb('0xe3')](_0x2aebe2)['catch'](loggerCatch(_0x131a9f));};Dialer[_0x5adb('0xb0')]['syncVarSet']=function(_0x29cc2f){var _0x1748c0=this;var _0x2c7167=this[_0x5adb('0x28')][_0x29cc2f[_0x5adb('0xe4')]];var _0x190c08;if(!_['isNil'](_0x29cc2f)&&!_[_0x5adb('0xb4')](_0x29cc2f[_0x5adb('0xe5')])&&!_[_0x5adb('0xb4')](_0x29cc2f[_0x5adb('0xe5')]['amdstatus'])&&_0x29cc2f[_0x5adb('0xe6')]==='xcally-motion-dialer'&&_0x2c7167){if(_0x2c7167['type']!=='ivr'&&this[_0x5adb('0x20')][_0x2c7167['queue']]['dialAMDActive']&&_0x29cc2f[_0x5adb('0xe7')]===_0x5adb('0xe8')){delete this[_0x5adb('0x28')][_0x29cc2f[_0x5adb('0xe4')]];this[_0x5adb('0xba')](this[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]]);this['voiceQueues'][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0x62')]+=0x1;this['voiceQueues'][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0x61')]+=0x1;_0x190c08=new Hangup(_0x2c7167,_0x29cc2f);_0x190c08[_0x5adb('0xad')]=0x12;_0x190c08[_0x5adb('0xe9')]=_0x5adb('0xea');_0x190c08[_0x5adb('0xeb')]=_0x5adb('0xec');ami[_0x5adb('0x50')](_0x5adb('0xed'),ut[_0x5adb('0xee')](_0x190c08,_0x5adb('0xef')));this[_0x5adb('0xe2')](_0x190c08,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x2c7167[_0x5adb('0x59')]!==_0x5adb('0x81')&&this[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]]['dialAMDActive']&&_0x29cc2f[_0x5adb('0xe7')]===_0x5adb('0xf0')){return new Promise(function(_0x397018,_0xb9ac38){delete _0x1748c0[_0x5adb('0x28')][_0x29cc2f['uniqueid']];_0x1748c0['updateOriginated'](_0x1748c0[_0x5adb('0x20')][_0x2c7167['queue']]);_0x1748c0[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0x62')]+=0x1;_0x1748c0[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0x61')]+=0x1;var _0x5e17ea=_0x1748c0[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]];var _0x3ba052=new Hangup(_0x2c7167,_0x29cc2f);_0x3ba052[_0x5adb('0xad')]=0x13;_0x3ba052[_0x5adb('0xe9')]=_0x5adb('0xf1');_0x3ba052[_0x5adb('0xeb')]='AMD';_0x3ba052['countmachineretry']+=0x1;_0x3ba052['countglobal']+=0x1;_0x3ba052[_0x5adb('0xef')]=!![];ami['emit'](_0x5adb('0xed'),ut['buildObj'](_0x3ba052,'amd'));_0x1748c0[_0x5adb('0xd0')](_0x3ba052)[_0x5adb('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3ba052['countbusyretry']+_0x3ba052[_0x5adb('0xf2')]+_0x3ba052[_0x5adb('0xf3')]+_0x3ba052[_0x5adb('0xf4')]+_0x3ba052['countdropretry']+_0x3ba052[_0x5adb('0xf5')]+_0x3ba052['countmachineretry']+_0x3ba052['countagentrejectretry']>=_0x5e17ea[_0x5adb('0xf6')]){_0x1748c0[_0x5adb('0xf7')](_0x3ba052,_0x397018,_0xb9ac38,_0x5adb('0xf8'));}else{if(_0x3ba052['countmachineretry']>=_0x5e17ea['dialMachineMaxRetry']){_0x1748c0[_0x5adb('0xf9')](_0x3ba052,_0x397018,_0xb9ac38,_0x5adb('0xfa'));}else{_0x1748c0['rescheduleContact']({'active':![],'countmachineretry':_0x3ba052['countmachineretry'],'scheduledat':moment()[_0x5adb('0xfb')](_0x5e17ea[_0x5adb('0xfc')],'minutes')[_0x5adb('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ba052[_0x5adb('0xd8')],'ListId':_0x3ba052['ListId'],'VoiceQueueId':_0x3ba052[_0x5adb('0xdb')]||undefined,'CampaignId':_0x3ba052[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xfd')));_0x397018({'reschedule':0x1});}}});}if(_0x2c7167[_0x5adb('0x59')]==='ivr'&&this[_0x5adb('0x21')][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0xfe')]&&_0x29cc2f['value']===_0x5adb('0xe8')){delete this[_0x5adb('0x28')][_0x29cc2f[_0x5adb('0xe4')]];this[_0x5adb('0xba')](this['campaigns'][_0x2c7167[_0x5adb('0xbb')]]);_0x190c08=new Hangup(_0x2c7167,_0x29cc2f);_0x190c08[_0x5adb('0xad')]=0x12;_0x190c08[_0x5adb('0xe9')]='HangupInAMD';_0x190c08[_0x5adb('0xeb')]='AMD';ami[_0x5adb('0x50')](_0x5adb('0xed'),ut[_0x5adb('0xee')](_0x190c08,_0x5adb('0xef')));this[_0x5adb('0xe2')](_0x190c08,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x2c7167['type']===_0x5adb('0x81')&&this['campaigns'][_0x2c7167['queue']][_0x5adb('0xfe')]&&_0x29cc2f[_0x5adb('0xe7')]===_0x5adb('0xf0')){return new Promise(function(_0x124658,_0x20b54a){delete _0x1748c0[_0x5adb('0x28')][_0x29cc2f[_0x5adb('0xe4')]];_0x1748c0[_0x5adb('0xba')](_0x1748c0['campaigns'][_0x2c7167[_0x5adb('0xbb')]]);_0x1748c0[_0x5adb('0x21')][_0x2c7167['queue']][_0x5adb('0x62')]+=0x1;_0x1748c0[_0x5adb('0x21')][_0x2c7167['queue']][_0x5adb('0x61')]+=0x1;var _0x50e2de=_0x1748c0[_0x5adb('0x21')][_0x2c7167[_0x5adb('0xbb')]];var _0x3d782b=new Hangup(_0x2c7167,_0x29cc2f);_0x3d782b[_0x5adb('0xad')]=0x13;_0x3d782b[_0x5adb('0xe9')]=_0x5adb('0xf1');_0x3d782b[_0x5adb('0xeb')]=_0x5adb('0xec');_0x3d782b['countmachineretry']+=0x1;_0x3d782b[_0x5adb('0xff')]+=0x1;_0x3d782b['amd']=!![];ami[_0x5adb('0x50')]('custom:amd',ut[_0x5adb('0xee')](_0x3d782b,'amd'));_0x1748c0[_0x5adb('0xd0')](_0x3d782b)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x100')));if(_0x3d782b[_0x5adb('0x101')]+_0x3d782b[_0x5adb('0xf2')]+_0x3d782b[_0x5adb('0xf3')]+_0x3d782b[_0x5adb('0xf4')]+_0x3d782b[_0x5adb('0x102')]+_0x3d782b[_0x5adb('0xf5')]+_0x3d782b[_0x5adb('0x103')]+_0x3d782b[_0x5adb('0x104')]>=_0x50e2de[_0x5adb('0xf6')]){_0x1748c0[_0x5adb('0xf7')](_0x3d782b,_0x124658,_0x20b54a,'reason19\x20machine....');}else{if(_0x3d782b[_0x5adb('0x103')]>=_0x50e2de['dialMachineMaxRetry']){_0x1748c0[_0x5adb('0xf9')](_0x3d782b,_0x124658,_0x20b54a,_0x5adb('0xfa'));}else{_0x1748c0[_0x5adb('0xc6')]({'active':![],'countmachineretry':_0x3d782b['countmachineretry'],'scheduledat':moment()['add'](_0x50e2de['dialMachineRetryFrequency'],'minutes')[_0x5adb('0x7e')](_0x5adb('0x105')),'ContactId':_0x3d782b[_0x5adb('0xd8')],'ListId':_0x3d782b[_0x5adb('0xd9')],'VoiceQueueId':_0x3d782b[_0x5adb('0xdb')]||undefined,'CampaignId':_0x3d782b[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xfd')));_0x124658({'reschedule':0x1});}}});}}};Dialer[_0x5adb('0xb0')]['syncHangup']=function(_0x39bf82){var _0x197b7f=this[_0x5adb('0x28')][_0x39bf82[_0x5adb('0xe4')]];var _0x1ba4ba;if(_0x197b7f&&_0x197b7f[_0x5adb('0x59')]==='ivr'){delete this['uniqueId'][_0x39bf82['uniqueid']];this[_0x5adb('0xba')](this[_0x5adb('0x21')][_0x197b7f[_0x5adb('0xbb')]]);this[_0x5adb('0x21')][_0x197b7f[_0x5adb('0xbb')]]['ivrAnswerCallsDay']+=0x1;_0x1ba4ba=new Hangup(_0x197b7f,_0x39bf82);this[_0x5adb('0xd0')](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x106')));this[_0x5adb('0xe3')](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x107')));}if(_0x197b7f&&_0x197b7f[_0x5adb('0x59')]!==_0x5adb('0x81')&&isNotNull(this[_0x5adb('0x20')][_0x197b7f[_0x5adb('0xbb')]][_0x5adb('0x108')])){delete this[_0x5adb('0x28')][_0x39bf82[_0x5adb('0xe4')]];this['updateOriginated'](this[_0x5adb('0x20')][_0x197b7f['queue']]);this[_0x5adb('0x20')][_0x197b7f[_0x5adb('0xbb')]][_0x5adb('0x62')]+=0x1;this[_0x5adb('0x20')][_0x197b7f[_0x5adb('0xbb')]][_0x5adb('0x61')]+=0x1;_0x1ba4ba=new Hangup(_0x197b7f,_0x39bf82);_0x1ba4ba[_0x5adb('0xad')]=0x10;_0x1ba4ba[_0x5adb('0xe9')]='AnswerAGI';_0x1ba4ba[_0x5adb('0xeb')]='AGI';this['createHistory'](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x106')));this['moveContactManagedDialer'](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch('[syncHangupIvr]'));}if(_0x197b7f&&_0x197b7f[_0x5adb('0x59')]!==_0x5adb('0x81')&&!isNotNull(this['voiceQueues'][_0x197b7f[_0x5adb('0xbb')]]['dialQueueProject'])){delete this[_0x5adb('0x28')][_0x39bf82[_0x5adb('0xe4')]];this[_0x5adb('0xba')](this[_0x5adb('0x20')][_0x197b7f[_0x5adb('0xbb')]]);this['voiceQueues'][_0x197b7f['queue']][_0x5adb('0x6b')]+=0x1;_0x1ba4ba=new Hangup(_0x197b7f,_0x39bf82);_0x1ba4ba[_0x5adb('0xad')]=0xc;_0x1ba4ba['statedesc']=_0x39bf82[_0x5adb('0x109')];_0x1ba4ba[_0x5adb('0xeb')]=_0x5adb('0x10a');this[_0x5adb('0xd0')](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x106')));this[_0x5adb('0xe3')](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x5adb('0xb0')][_0x5adb('0x34')]=function(_0x287a1d){var _0x5ad23d=this['uniqueId'][_0x287a1d[_0x5adb('0xe4')]];if(this['voiceQueues'][_0x287a1d['queue']]){if(_0x5ad23d&&_0x5ad23d[_0x5adb('0x59')]!==_0x5adb('0x81')){delete this[_0x5adb('0x28')][_0x287a1d[_0x5adb('0xe4')]];this['voiceQueues'][_0x287a1d[_0x5adb('0xbb')]][_0x5adb('0x62')]+=0x1;var _0x5962a1=new AgentComplete(_0x5ad23d,_0x287a1d);if(_0x287a1d[_0x5adb('0x10b')]===_0x5adb('0x10c')){_0x5962a1['agiafterat']=this[_0x5adb('0x20')][_0x287a1d[_0x5adb('0xbb')]][_0x5adb('0x10d')]&&this['voiceQueues'][_0x287a1d[_0x5adb('0xbb')]][_0x5adb('0x10e')]?moment()['format'](_0x5adb('0x105')):undefined;}this[_0x5adb('0xd0')](_0x5962a1)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x10f')));this[_0x5adb('0xe3')](_0x5962a1)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x5adb('0xb0')][_0x5adb('0x2d')]=function(_0x207368){if(this[_0x5adb('0x20')][_0x207368[_0x5adb('0xbb')]]){if(this[_0x5adb('0x28')][_0x207368[_0x5adb('0xe4')]]&&this['uniqueId'][_0x207368[_0x5adb('0xe4')]][_0x5adb('0x59')]!==_0x5adb('0x81')){this[_0x5adb('0xba')](this[_0x5adb('0x20')][_0x207368['queue']]);this[_0x5adb('0x28')][_0x207368[_0x5adb('0xe4')]]['answertime']=moment()['format'](_0x5adb('0x105'));}}};Dialer[_0x5adb('0xb0')][_0x5adb('0x110')]=function(_0x253398,_0x2d7c4b){this[_0x5adb('0xd0')](_0x253398)['catch'](loggerCatch(_0x5adb('0x10f')));if(_0x2d7c4b==0x0){this[_0x5adb('0xe3')](_0x253398)['catch'](loggerCatch(_0x5adb('0x111')));}};Dialer['prototype'][_0x5adb('0x30')]=function(_0x2cbebd){var _0x3f03dd=this[_0x5adb('0x28')][_0x2cbebd['uniqueid']];var _0x488778=this;var _0x2712a7=![];var _0x1cdc58;var _0x2db42c;if(this['voiceQueues'][_0x2cbebd[_0x5adb('0xbb')]]){if(_0x3f03dd&&_0x3f03dd['type']!=='ivr'){delete this[_0x5adb('0x28')][_0x2cbebd[_0x5adb('0xe4')]];this['updateOriginated'](this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]]);_0x3f03dd[_0x5adb('0x112')]=moment()['format'](_0x5adb('0x105'));var _0x2a3f2e=new QueueCallerAbandon(_0x3f03dd,_0x2cbebd);if(getSeconds(_0x3f03dd[_0x5adb('0x112')],_0x3f03dd[_0x5adb('0x113')])>=_0x3f03dd['dialQueueTimeout']){this['voiceQueues'][_0x2cbebd['queue']][_0x5adb('0x6e')]+=0x1;this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x70')]+=0x1;_0x2a3f2e[_0x5adb('0xad')]=0xa;_0x2a3f2e[_0x5adb('0xe9')]=_0x5adb('0x114');_0x2a3f2e['dropreason']='TIMEOUT';_0x2a3f2e[_0x5adb('0x115')]=this['voiceQueues'][_0x2cbebd[_0x5adb('0xbb')]]['dialQueueProject2']?moment()[_0x5adb('0x7e')](_0x5adb('0x105')):undefined;_0x2a3f2e[_0x5adb('0x102')]+=0x1;_0x2a3f2e[_0x5adb('0xff')]+=0x1;_0x1cdc58=this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x116')];_0x2db42c=this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x117')];_0x488778[_0x5adb('0xc1')](_0x2a3f2e,_0x2a3f2e[_0x5adb('0xad')],_0x3f03dd[_0x5adb('0x118')])['then'](function(_0x2985d9){_0x2712a7=_0x2985d9[_0x5adb('0x119')]==0x1;if(_0x2a3f2e[_0x5adb('0x102')]>=_0x488778[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x11a')]){_0x488778['queueCallerAbandonCreateState'](_0x2a3f2e,_0x2985d9[_0x5adb('0x119')]);}else{_0x488778[_0x5adb('0xc6')]({'active':![],'countdropretry':_0x2a3f2e[_0x5adb('0x102')],'scheduledat':moment()[_0x5adb('0xfb')](_0x488778[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x116')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x3f03dd[_0x5adb('0xd8')],'ListId':_0x3f03dd['ListId'],'VoiceQueueId':_0x3f03dd[_0x5adb('0xdb')]||undefined,'CampaignId':_0x3f03dd['CampaignId']||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x11c')));var _0x198dac=new History(_0x2a3f2e);_0x198dac[_0x5adb('0xad')]=0xa;_0x198dac[_0x5adb('0xe9')]='Drop';_0x198dac['starttime']=moment()['format'](_0x5adb('0x105'));_0x198dac[_0x5adb('0xae')]=_0x198dac[_0x5adb('0xaf')];_0x198dac['calleridname']=_0x2a3f2e['calleridname'];_0x198dac[_0x5adb('0x11d')]=_0x2a3f2e[_0x5adb('0x11d')];_0x488778[_0x5adb('0xd0')](_0x198dac)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x5adb('0x41')](function(){if(_0x2712a7)_0x488778[_0x5adb('0xc2')](_0x2a3f2e,_0x1cdc58,_0x2db42c)[_0x5adb('0x41')](function(){return 0x1;});});}else{this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x88')]+=0x1;this['voiceQueues'][_0x2cbebd['queue']][_0x5adb('0x66')]+=0x1;_0x2a3f2e[_0x5adb('0xad')]=0xb;_0x2a3f2e[_0x5adb('0xe9')]=_0x5adb('0x11e');_0x2a3f2e[_0x5adb('0x11f')]='CALLEREXIT';_0x2a3f2e['countabandonedretry']+=0x1;_0x2a3f2e['countglobal']+=0x1;_0x1cdc58=this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x120')];_0x2db42c=this['voiceQueues'][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x117')];_0x488778[_0x5adb('0xc1')](_0x2a3f2e,_0x2a3f2e[_0x5adb('0xad')],_0x3f03dd[_0x5adb('0x118')])[_0x5adb('0x41')](function(_0x166372){if(_0x2a3f2e[_0x5adb('0xf5')]>=_0x488778['voiceQueues'][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x121')]){_0x488778[_0x5adb('0x110')](_0x2a3f2e,_0x166372[_0x5adb('0x119')]);}else{_0x488778[_0x5adb('0xc6')]({'active':![],'countabandonedretry':_0x2a3f2e[_0x5adb('0xf5')],'scheduledat':moment()[_0x5adb('0xfb')](_0x488778[_0x5adb('0x20')][_0x2cbebd['queue']][_0x5adb('0x120')],'minutes')[_0x5adb('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f03dd['ContactId'],'ListId':_0x3f03dd['ListId'],'VoiceQueueId':_0x3f03dd['VoiceQueueId']||undefined,'CampaignId':_0x3f03dd[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x122')));var _0x1cf766=new History(_0x2a3f2e);_0x1cf766[_0x5adb('0xad')]=0xb;_0x1cf766['statedesc']=_0x5adb('0x11e');_0x1cf766[_0x5adb('0xaf')]=moment()[_0x5adb('0x7e')](_0x5adb('0x105'));_0x1cf766[_0x5adb('0xae')]=_0x1cf766['starttime'];_0x1cf766['calleridname']=_0x2a3f2e['calleridname'];_0x1cf766[_0x5adb('0x11d')]=_0x2a3f2e['calleridnum'];_0x488778['createHistory'](_0x1cf766)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x5adb('0x41')](function(){if(_0x2712a7)_0x488778[_0x5adb('0xc2')](_0x2a3f2e,_0x1cdc58,_0x2db42c)[_0x5adb('0x41')](function(){return 0x1;});});}}}};Dialer[_0x5adb('0xb0')]['syncNewExten']=function(_0x3655f2){if(this[_0x5adb('0x26')][_0x3655f2[_0x5adb('0xe4')]]){this[_0x5adb('0x26')][_0x3655f2[_0x5adb('0xe4')]]['channel']=_0x3655f2['channel'];}if(this[_0x5adb('0x28')][_0x3655f2[_0x5adb('0xe4')]]){this[_0x5adb('0x28')][_0x3655f2[_0x5adb('0xe4')]][_0x5adb('0xb7')]=_0x3655f2[_0x5adb('0xb7')];}};Dialer[_0x5adb('0xb0')][_0x5adb('0x3c')]=function(_0x9e204d){if(strategy[this[_0x5adb('0x20')][this[_0x5adb('0x26')][_0x9e204d['actionid']][_0x5adb('0xbb')]]['strategy']]===_0x5adb('0x1a')){if(this[_0x5adb('0x26')][_0x9e204d['actionid']]&&_[_0x5adb('0xb4')](this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]]['locked'])&&_0x9e204d['status']==='1'&&_0x9e204d[_0x5adb('0x124')]==='0'){if(this[_0x5adb('0x22')][_0x9e204d['stateinterface']]){if(!this['agents'][_0x9e204d['stateinterface']][_0x5adb('0x125')]){this[_0x5adb('0x22')][_0x9e204d[_0x5adb('0x126')]][_0x5adb('0x125')]=!![];this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0x125')]=!![];this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0x126')]=_0x9e204d['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0xbb')]][_0x5adb('0x51')]]||_0x5adb('0x19'))==='rrmemory'){if(this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]]){if(this[_0x5adb('0x22')][_0x9e204d[_0x5adb('0x126')]]){this['actions'][_0x9e204d[_0x5adb('0x123')]]['stateinterface']=_0x9e204d[_0x5adb('0x126')];if(_[_0x5adb('0xb4')](this[_0x5adb('0x2a')][this['actions'][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0xbb')]])){this[_0x5adb('0x2a')][this[_0x5adb('0x26')][_0x9e204d['actionid']]['queue']]=[];}this[_0x5adb('0x2a')][this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0xbb')]]['push'](_[_0x5adb('0x94')](_[_0x5adb('0xd7')](this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]],['idHopper','stateinterface']),{'status':_0x9e204d['status'],'paused':_0x9e204d[_0x5adb('0x124')]}));}}}};function unlockQueueStatus(_0x36a8a9,_0x40d7c6){setTimeout(function(){if(_[_0x5adb('0x43')](_0x36a8a9[_0x5adb('0x127')])){loggerBooked[_0x5adb('0x9c')](_0x5adb('0x128'),_0x40d7c6);}_0x36a8a9[_0x5adb('0x127')]=!![];loggerBooked[_0x5adb('0x84')](_0x5adb('0x129'),_0x40d7c6,JSON[_0x5adb('0x4d')](_[_0x5adb('0xd7')](_0x36a8a9,[_0x5adb('0x45'),_0x5adb('0x127')])));},0x1f3);}Dialer[_0x5adb('0xb0')]['syncQueueStatusComplete']=function(_0x155af8){var _0x1ae29c=this;var _0x1788ab=_0x1ae29c['voiceQueues'][_0x1ae29c[_0x5adb('0x26')][_0x155af8['actionid']][_0x5adb('0xbb')]];if(strategy[this[_0x5adb('0x20')][this[_0x5adb('0x26')][_0x155af8['actionid']][_0x5adb('0xbb')]][_0x5adb('0x51')]]===_0x5adb('0x1a')){if(this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]&&this['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0x126')]){this[_0x5adb('0x1f')][_0x5adb('0x12a')](this[_0x5adb('0x26')][_0x155af8['actionid']]['idHopper'],this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0x126')])[_0x5adb('0xb8')](function(_0x5bb6b3){logger[_0x5adb('0x9c')](_0x5adb('0x12b'),util[_0x5adb('0xa1')](_0x5bb6b3,{'showHidden':![],'depth':null}));})[_0x5adb('0x1d')](function(){_0x1ae29c[_0x5adb('0xba')](_0x1ae29c[_0x5adb('0x20')][_0x1ae29c['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]]);_0x1ae29c['agents'][_0x1ae29c[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0x126')]][_0x5adb('0x125')]=![];delete _0x1ae29c[_0x5adb('0x26')][_0x155af8['actionid']];unlockQueueStatus(_0x1788ab);});}else{this[_0x5adb('0xba')](this[_0x5adb('0x20')][this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xd8')],'ListId':this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xd9')],'VoiceQueueId':this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x155af8[_0x5adb('0x123')]]['CampaignId']||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x12c')));delete this[_0x5adb('0x26')][_0x155af8['actionid']];unlockQueueStatus(_0x1788ab);}}else if((strategy[this[_0x5adb('0x20')][this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]]['strategy']]||_0x5adb('0x19'))===_0x5adb('0x19')){var _0x2ff7a8;if(this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]&&!_[_0x5adb('0x4a')](this[_0x5adb('0x2a')][this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]['queue']])){if(this[_0x5adb('0x2b')][_0x1ae29c[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]['queue']]){this[_0x5adb('0x2b')][_0x1ae29c[_0x5adb('0x26')][_0x155af8['actionid']]['queue']]=this[_0x5adb('0x2b')][this[_0x5adb('0x26')][_0x155af8['actionid']]['queue']]?this['queueBookedRR'][this[_0x5adb('0x26')][_0x155af8['actionid']][_0x5adb('0xbb')]]:this['queueBooked'][this[_0x5adb('0x26')][_0x155af8['actionid']][_0x5adb('0xbb')]]?this[_0x5adb('0x2a')][this['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]]['_rr']||0x0:0x0;}this[_0x5adb('0x2a')][this['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]][_0x5adb('0x12d')]=this['queueBookedRR'][this['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]];for(var _0x336dc1=0x0;_0x336dc1=0x0;})['catch'](myreject(_0x5b4c89)));}}else{_0x5d2297[_0x5adb('0x141')](ami[_0x5adb('0xb5')]({'action':_0x5adb('0x142'),'command':util['format'](_0x5adb('0x145'),_0x38b753,!_[_0x5adb('0x43')](config[_0x5adb('0x146')][_0x4d29d0])?_0x4d29d0:'')})[_0x5adb('0x41')](function(_0x3d8eaa){return _0x3d8eaa[_0x5adb('0x147')][_0x5adb('0x144')](_0x5adb('0x148'))>=0x0;})['catch'](myreject(_0x5b4c89)));}Promise[_0x5adb('0x149')](_0x5d2297)[_0x5adb('0x41')](function(_0x17859d){var _0x551d24=_[_0x5adb('0x14a')](_0x17859d);if(_0x551d24){return _0x435429(_0x551d24);}else{_0x5b1e82['message']=_0x3902cc?'GLOBAL_INTERVAL_IS_OVERTIME':_0x5adb('0x14b');return _0x5b4c89(msgResponse(_0x5adb('0x14c'),_0x5adb('0x13d'),_0x5adb('0x14d')+_0x3902cc+'\x20'+_0x5e7437+_0x5adb('0x14e')+util[_0x5adb('0xa1')](_0x38b753,{'showHidden':![],'depth':null})+_0x5adb('0x14f')+_0x4d29d0));}})[_0x5adb('0xb8')](function(_0x3af147){return _0x5b4c89(msgResponse('ifTime',_0x5adb('0x13d'),JSON[_0x5adb('0x4d')](_0x3af147)));});});};Dialer['prototype'][_0x5adb('0x150')]=function(_0x374d57){var _0x3d83e9=this;return function(){switch(_0x374d57['dialMethod']){case _0x5adb('0x151'):freeVariablesPredictive(_0x374d57);_0x3d83e9[_0x5adb('0x152')](_0x374d57,0x1);break;case _0x5adb('0x153'):freeVariablesPredictive(_0x374d57);_0x3d83e9[_0x5adb('0x152')](_0x374d57,_0x374d57[_0x5adb('0x154')]);break;case _0x5adb('0x8'):_0x3d83e9[_0x5adb('0x8')](_0x374d57);break;case _0x5adb('0x7'):freeVariablesPredictive(_0x374d57);_0x3d83e9['handlePower'](_0x374d57,0x1);break;default:freeVariablesPredictive(_0x374d57);logger[_0x5adb('0x9c')]('Queue',_0x374d57[_0x5adb('0x45')],_0x5adb('0x155'));}};};Dialer[_0x5adb('0xb0')][_0x5adb('0x156')]=function(_0x4b0119){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0x157')](_0x4b0119['id'],previewRecallmeReminderInterval))[_0x5adb('0x41')](function(_0x5cf162){for(var _0x4729c0=0x0;_0x4729c0<_0x5cf162[_0x5adb('0x9e')];_0x4729c0++){var _0x33fd82=_0x5cf162[_0x4729c0][_0x5adb('0x158')][_0x5adb('0x45')];if(_0x33fd82)io['to'](util[_0x5adb('0x7e')](_0x5adb('0x159'),_0x33fd82))[_0x5adb('0x50')]('user:dialPreviewRecallReminder',{'hopper':_0x5cf162[_0x4729c0]});}})['catch'](function(){});};Dialer[_0x5adb('0xb0')][_0x5adb('0x15a')]=function(_0xf8d33d){var _0x410af3=this;return function(){_0x410af3[_0x5adb('0x15b')](_0xf8d33d);};};Dialer['prototype']['syncQueueSummary']=function(_0x54edcf){var _0x444ec5=this;if(isNotPreview(_0x54edcf['dialMethod'])){if(isVoiceQueueOutbound(_0x54edcf[_0x5adb('0x59')])&&isActive(_0x54edcf['dialActive'])){_0x54edcf['sendMessageOneNotActive']=!![];Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](checkIsLoggedIn(_0x54edcf,_0x54edcf[_0x5adb('0x54')]))[_0x5adb('0x41')](checkIsActive(_0x54edcf,_0x54edcf[_0x5adb('0x5d')]))[_0x5adb('0x41')](checkInterval(_0x54edcf))[_0x5adb('0x41')](_0x444ec5['checkIsTrunkReachable'](_0x54edcf))[_0x5adb('0x41')](_0x444ec5[_0x5adb('0x15c')](_0x54edcf['dialGlobalInterval'],_0x54edcf[_0x5adb('0x15d')],_0x54edcf[_0x5adb('0x45')],_0x54edcf))[_0x5adb('0x41')](_0x444ec5[_0x5adb('0x13b')](_0x54edcf['Interval'],_0x54edcf[_0x5adb('0x15d')],_0x54edcf[_0x5adb('0x45')],_0x54edcf))[_0x5adb('0x41')](_0x444ec5[_0x5adb('0x150')](_0x54edcf))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x54edcf));}else{notSendMessagesQueue(_0x54edcf);}}else{freeVariablesPredictive(_0x54edcf);}};Dialer['prototype'][_0x5adb('0x37')]=_[_0x5adb('0x15e')](function(){var _0x2c1fa5=_[_0x5adb('0x15f')](this[_0x5adb('0x20')],function(_0xa558a7){return _0xa558a7['dialPreviewRecallmeReminder'];});var _0x61e16f=_[_0x5adb('0x15f')](this[_0x5adb('0x22')],function(_0x165665){return _0x165665[_0x5adb('0x160')]&&_0x165665[_0x5adb('0xb6')]===_0x5adb('0x161');});if(_0x2c1fa5[_0x5adb('0x9e')]>0x0&&_0x61e16f[_0x5adb('0x9e')]>0x0){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper['handlePreviewRecallNotifications'](_[_0x5adb('0x162')](_0x2c1fa5,'id'),previewRecallmeReminderInterval,_[_0x5adb('0x162')](_0x61e16f,'id')))[_0x5adb('0x41')](function(_0x345a80){for(var _0x394036=0x0;_0x394036<_0x345a80['length'];_0x394036++){var _0x3902a2=_0x345a80[_0x394036][_0x5adb('0x158')][_0x5adb('0x45')];if(_0x3902a2)io['to'](util['format'](_0x5adb('0x159'),_0x3902a2))[_0x5adb('0x50')](_0x5adb('0x163'),{'hopper':_0x345a80[_0x394036]});}})[_0x5adb('0xb8')](function(_0x528149){logger['error'](_0x5adb('0x156'),_0x528149);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x5adb('0x136')]=function(){var _0x48828c=this;var _0x4cd8ef;for(var _0x5d8a35 in this[_0x5adb('0x21')]){if(typeof this['campaigns'][_0x5d8a35]!==_0x5adb('0xd2')){_0x4cd8ef=this[_0x5adb('0x21')][_0x5d8a35];if(isCampaignIvr(_0x4cd8ef[_0x5adb('0x59')])&&isActive(_0x4cd8ef[_0x5adb('0x7c')])){_0x4cd8ef[_0x5adb('0xa6')]=!![];Promise['resolve']()['then'](checkIsActive(_0x4cd8ef,_0x4cd8ef[_0x5adb('0x7c')]))[_0x5adb('0x41')](checkInterval(_0x4cd8ef))[_0x5adb('0x41')](_0x48828c[_0x5adb('0x164')](_0x4cd8ef))[_0x5adb('0x41')](_0x48828c[_0x5adb('0x15c')](_0x4cd8ef['dialGlobalInterval'],_0x4cd8ef[_0x5adb('0x15d')],_0x4cd8ef[_0x5adb('0x45')],_0x4cd8ef))[_0x5adb('0x41')](_0x48828c[_0x5adb('0x13b')](_0x4cd8ef[_0x5adb('0x47')],_0x4cd8ef[_0x5adb('0x15d')],_0x4cd8ef['name'],_0x4cd8ef))[_0x5adb('0x41')](_0x48828c['launchHandleIvr'](_0x4cd8ef))[_0x5adb('0xb8')](loggerCatchQueueSummary(_0x5adb('0x165'),_0x4cd8ef));}else{notSendMessagesCampaign(_0x4cd8ef);}}}};function getCallerIdRandom(_0xb0b2a5,_0x52534e){var _0x44893e;var _0x186d67;var _0x34750b;if(_0x52534e<=0x0){_0x52534e=0x1;}_0x44893e=new RegExp(_0x5adb('0x166')+_0x52534e+'}$');_0x186d67=Math[_0x5adb('0x167')](0xa,_0x52534e-0x1);_0x34750b=Math[_0x5adb('0x167')](0xa,_0x52534e)-0x1;return util[_0x5adb('0x7e')]('%s',_[_0x5adb('0x168')](_0xb0b2a5,_0x44893e,_['random'](_0x186d67,_0x34750b)));}function extractCalleridName(_0x387ac3){var _0x31d31a=_0x387ac3[_0x5adb('0x169')](/"(.*?)"/);return _0x31d31a?_0x31d31a[0x1]:_0x387ac3;}Dialer[_0x5adb('0xb0')][_0x5adb('0x16a')]=function(_0x14708c,_0x49eb6f){var _0x3314e2=this;var _0x2fd728=uuid['v4']();this['actions'][_0x2fd728]=new Action(_0x14708c,_0x49eb6f,_0x2fd728);return new Promise(function(_0x545ef7,_0x9757d7){if(_['isUndefined'](_0x14708c)&&typeof _0x14708c!==_0x5adb('0x16b')){return _0x9757d7(msgResponse(_0x5adb('0x16c'),'Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x49eb6f['phone'])||_0x49eb6f[_0x5adb('0x16d')]===null){return _0x9757d7(msgResponse(_0x5adb('0x16c'),_0x5adb('0x13d'),_0x5adb('0x16e')));}var _0x604c7={'XMD-CALLERID':_0x3314e2['actions'][_0x2fd728][_0x5adb('0x16f')](),'XMD-AGI':_0x14708c[_0x5adb('0x108')]?util[_0x5adb('0x7e')](_0x5adb('0x170'),ipAgi,_0x14708c['dialQueueProject']):_0x5adb('0x171'),'XMD-AGIAFTER':_0x14708c[_0x5adb('0x10d')]?util['format'](_0x5adb('0x170'),ipAgi,_0x14708c[_0x5adb('0x10d')]):_0x5adb('0x171'),'XMD-QUEUE':_0x14708c[_0x5adb('0x59')]===_0x5adb('0x172')?util['format']('\x22%s,%s%s,,,%s\x22',_0x14708c[_0x5adb('0x45')],_0x14708c[_0x5adb('0x173')]||'',_0x14708c[_0x5adb('0x10e')]?'c':'',_0x14708c[_0x5adb('0x174')]||0x3):_0x5adb('0x171'),'XMD-CONTACTID':_0x49eb6f['ContactId'],'XMD-CDRTYPE':_0x5adb('0x6'),'CALLERID(all)':_0x3314e2[_0x5adb('0x26')][_0x2fd728][_0x5adb('0x16f')](),'XMD-AMD':_0x14708c[_0x5adb('0xfe')]?_0x5adb('0x175'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x14708c[_0x5adb('0xfe')]){_0x604c7['XMD-AMDINITIALSILENCE']=_0x14708c['dialAMDInitialSilence']||0x9c4;_0x604c7[_0x5adb('0x176')]=_0x14708c[_0x5adb('0x177')]||0x5dc;_0x604c7['XMD-AMDAFTERGREETINGSILENCE']=_0x14708c[_0x5adb('0x178')]||0x320;_0x604c7['XMD-AMDTOTALANALYSISTIME']=_0x14708c[_0x5adb('0x179')]||0x1388;_0x604c7[_0x5adb('0x17a')]=_0x14708c[_0x5adb('0x17b')]||0x64;_0x604c7[_0x5adb('0x17c')]=_0x14708c[_0x5adb('0x17d')]||0x32;_0x604c7['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x14708c[_0x5adb('0x17e')]||0x3;_0x604c7[_0x5adb('0x17f')]=_0x14708c[_0x5adb('0x180')]||0x100;_0x604c7[_0x5adb('0x181')]=_0x14708c[_0x5adb('0x182')]||0x1388;}if(_0x14708c[_0x5adb('0x59')]===_0x5adb('0x172')){_0x604c7[_0x5adb('0x183')]=_0x49eb6f[_0x5adb('0xdb')];}else{_0x604c7[_0x5adb('0x184')]=_0x49eb6f[_0x5adb('0xdc')];}for(var _0x436da4 in _0x49eb6f['Contact']){if(typeof _0x49eb6f[_0x5adb('0x185')][_0x436da4]!=='undefined'){if(isNotNull(_0x49eb6f['Contact'][_0x436da4])&&_0x436da4!=='id'&&_0x436da4!==_0x5adb('0x186')&&_0x436da4!==_0x5adb('0x187')&&_0x436da4!==_0x5adb('0x188')){_0x604c7[util[_0x5adb('0x7e')]('%s%s',_0x5adb('0x189'),_[_0x5adb('0x18a')](_0x436da4))]=_0x49eb6f[_0x5adb('0x185')][_0x436da4];}}}var _0x432f6d=_0x3314e2[_0x5adb('0x137')](_0x14708c[_0x5adb('0x7b')])?getCallerId(_0x14708c[_0x5adb('0x7b')]['callerid'],_0x14708c['dialOriginateCallerIdName'],_0x14708c[_0x5adb('0x18b')]>0x0?getCallerIdRandom(_0x14708c[_0x5adb('0x5f')],_0x14708c[_0x5adb('0x18b')]):_0x14708c[_0x5adb('0x5f')]):getCallerId(_[_0x5adb('0xb4')](_0x14708c[_0x5adb('0x138')])?_0x14708c['Trunk'][_0x5adb('0x7d')]:_0x14708c['TrunkBackup'][_0x5adb('0x7d')],_0x14708c['dialOriginateCallerIdName'],_0x14708c['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x14708c[_0x5adb('0x5f')],_0x14708c['dialRandomLastDigitCallerIdNumber']):_0x14708c[_0x5adb('0x5f')]);if(_0x432f6d){_0x604c7[_0x5adb('0x18c')]=_0x3314e2[_0x5adb('0x26')][_0x2fd728][_0x5adb('0x18d')]=extractCalleridName(_0x432f6d);_0x604c7[_0x5adb('0x18e')]=_0x49eb6f[_0x5adb('0x16d')];}_0x14708c[_0x5adb('0x18f')]=_0x604c7;return ami[_0x5adb('0xb5')]({'actionid':_0x2fd728,'action':'originate','channel':_0x3314e2[_0x5adb('0x137')](_0x14708c['Trunk'])?util[_0x5adb('0x7e')]('SIP/%s/%s%s',_0x14708c[_0x5adb('0x7b')][_0x5adb('0x45')],isNotNull(_0x14708c[_0x5adb('0x190')])?_0x14708c['dialPrefix'][_0x5adb('0x191')]()||'':'',_0x14708c[_0x5adb('0x192')]>0x0?_0x49eb6f[_0x5adb('0x16d')][_0x5adb('0x193')](_0x14708c[_0x5adb('0x192')]):_0x49eb6f[_0x5adb('0x16d')]):util[_0x5adb('0x7e')](_0x5adb('0x194'),_['isNil'](_0x14708c[_0x5adb('0x138')])?_0x14708c['Trunk']['name']:_0x14708c[_0x5adb('0x138')]['name'],isNotNull(_0x14708c['dialPrefix'])?_0x14708c['dialPrefix']['trim']()||'':'',_0x14708c[_0x5adb('0x192')]>0x0?_0x49eb6f[_0x5adb('0x16d')][_0x5adb('0x193')](_0x14708c['dialCutDigit']):_0x49eb6f[_0x5adb('0x16d')]),'callerid':_0x432f6d,'Exten':_0x5adb('0x195'),'Context':_0x5adb('0x196'),'Priority':'1','variable':_0x604c7,'timeout':(_0x14708c[_0x5adb('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2fd728})[_0x5adb('0x41')](function(_0x1f66f8){return _0x545ef7(_0x1f66f8);})[_0x5adb('0xb8')](function(_0xafc0e0){_0x14708c[_0x5adb('0x197')]+=0x1;var _0x2bc519=new History(_0x3314e2[_0x5adb('0x26')][_0x2fd728]);logger['error'](util[_0x5adb('0x7e')](_0x5adb('0x198'),JSON[_0x5adb('0x4d')](_0xafc0e0)));_0x2bc519[_0x5adb('0xad')]=0xe;_0x2bc519[_0x5adb('0xe9')]=_0x5adb('0x199');_0x2bc519[_0x5adb('0xaf')]=moment()[_0x5adb('0x7e')](_0x5adb('0x105'));_0x2bc519['endtime']=_0x2bc519[_0x5adb('0xaf')];_0x3314e2['createHistory'](_0x2bc519)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x19a')));_0x3314e2[_0x5adb('0xe3')](_0x2bc519)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x19a')))['finally'](function(){delete _0x3314e2[_0x5adb('0x26')][_0x2fd728];return _0x9757d7(msgResponse(_0x5adb('0x16c'),_0x5adb('0x19b'),_0x5adb('0x19c')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x6e169){var _0x24fa0a=this[_0x5adb('0x26')][_0x6e169[_0x5adb('0x123')]];if(_0x24fa0a){delete this['actions'][_0x6e169[_0x5adb('0x123')]];_0x24fa0a[_0x5adb('0x113')]=moment()[_0x5adb('0x7e')](_0x5adb('0x105'));var _0x5f4a9e=_0x24fa0a[_0x5adb('0x59')]==='ivr'?this['campaigns'][_0x24fa0a['queue']]:this[_0x5adb('0x20')][_0x24fa0a[_0x5adb('0x19d')]()];if(!this[_0x5adb('0xdf')](_0x6e169[_0x5adb('0x19e')])){this['updateOriginated'](_0x5f4a9e);return this[_0x5adb('0x19f')](_0x24fa0a,_0x5f4a9e,_0x6e169)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1a0')));}this[_0x5adb('0x28')][_0x6e169[_0x5adb('0xe4')]]=_0x24fa0a;}};Dialer[_0x5adb('0xb0')]['checkRetriveMax']=function(_0x2907d3,_0x367de1,_0x4bb8b2){var _0x143674=new History(_0x367de1);if(_0x143674[_0x5adb('0x101')]+_0x143674[_0x5adb('0xf2')]+_0x143674['countnoanswerretry']+_0x143674[_0x5adb('0xf4')]+_0x143674[_0x5adb('0x102')]+_0x143674[_0x5adb('0xf5')]+_0x143674['countmachineretry']+_0x143674['countagentrejectretry']>=_0x4bb8b2['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2907d3){case 0x3:if(_0x143674['countnoanswerretry']>=_0x4bb8b2[_0x5adb('0x1a1')]-0x1){return!![];}this[_0x5adb('0xc6')]({'active':![],'countnoanswerretry':_0x143674[_0x5adb('0xf3')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x1a2')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674['VoiceQueueId']||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x143674[_0x5adb('0x101')]>=_0x4bb8b2['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x143674[_0x5adb('0x101')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x1a3')],_0x5adb('0x11b'))[_0x5adb('0x7e')](_0x5adb('0x105')),'ContactId':_0x143674['ContactId'],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674['CampaignId']||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1a4')));break;case 0x8:if(_0x143674[_0x5adb('0xf2')]>=_0x4bb8b2[_0x5adb('0x1a5')]-0x1){return!![];}this[_0x5adb('0xc6')]({'active':![],'countcongestionretry':_0x143674[_0x5adb('0xf2')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x1a6')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674['VoiceQueueId']||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})['catch'](loggerCatch(_0x5adb('0x1a7')));break;case 0x0:if(_0x143674[_0x5adb('0xf4')]>=_0x4bb8b2['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x5adb('0xc6')]({'active':![],'countnosuchnumberretry':_0x143674[_0x5adb('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x4bb8b2[_0x5adb('0x1a8')],_0x5adb('0x11b'))[_0x5adb('0x7e')](_0x5adb('0x105')),'ContactId':_0x143674['ContactId'],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x143674[_0x5adb('0x102')]>=_0x4bb8b2[_0x5adb('0x11a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x143674[_0x5adb('0x102')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x116')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x143674[_0x5adb('0xf5')]>=_0x4bb8b2['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x5adb('0xc6')]({'active':![],'countabandonedretry':_0x143674[_0x5adb('0xf5')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x120')],_0x5adb('0x11b'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674['CampaignId']||undefined})[_0x5adb('0xb8')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x143674[_0x5adb('0x103')]>=_0x4bb8b2['dialMachineMaxRetry']-0x1){return!![];}this[_0x5adb('0xc6')]({'active':![],'countmachineretry':_0x143674[_0x5adb('0x103')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0xfc')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xfd')));break;case 0x14:if(_0x143674[_0x5adb('0x104')]>=_0x4bb8b2[_0x5adb('0x1a9')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x143674[_0x5adb('0x104')]+=0x1,'scheduledat':moment()['add'](_0x4bb8b2[_0x5adb('0x1aa')],_0x5adb('0x11b'))[_0x5adb('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674['VoiceQueueId']||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1ab')));break;default:return!![];}};Dialer[_0x5adb('0xb0')][_0x5adb('0x19f')]=function(_0x53244e,_0x2f2084,_0x182eed){var _0x3a65e1=this;var _0x129e87=new History(_0x53244e);var _0x3602a4=![];var _0x262632;var _0x58f288;return new Promise(function(_0x3fcac5,_0xf6790b){if(_[_0x5adb('0x43')](_0x2f2084)&&typeof _0x2f2084!==_0x5adb('0x16b')){return _0xf6790b(msgResponse(_0x5adb('0x1ac'),_0x5adb('0x13d'),'entity\x20is\x20undefine'));}if(_[_0x5adb('0x43')](_0x182eed)&&typeof _0x182eed!==_0x5adb('0x16b')){return _0xf6790b(msgResponse('[callProgressDetecting]',_0x5adb('0x13d'),_0x5adb('0x1ad')));}_0x3a65e1[_0x5adb('0xc1')](_0x129e87,_0x182eed['reason'],_0x2f2084)['then'](function(_0x2e9eab){if(_0x2e9eab['additional']==0x1)_0x3602a4=!![];switch(_0x182eed['reason']){case'0':_0x2f2084[_0x5adb('0x69')]+=0x1;_0x129e87[_0x5adb('0xad')]=0x0;_0x129e87['statedesc']=_0x5adb('0x1ae');_0x129e87['countnosuchnumberretry']+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;ami['emit'](_0x5adb('0x1af'),ut[_0x5adb('0xee')](_0x53244e,_0x5adb('0x1b0')));_0x262632=_0x2f2084[_0x5adb('0x1a8')];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1[_0x5adb('0xd0')](_0x129e87)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x100')));if(_0x3a65e1[_0x5adb('0x1b1')](0x0,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87['countnosuchnumberretry']>=_0x2f2084['dialNoSuchNumberMaxRetry']){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1b2'));}else{_0x3a65e1['stateGlobal'](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1b2'));}}break;case'3':_0x2f2084[_0x5adb('0x68')]+=0x1;_0x129e87[_0x5adb('0xad')]=0x3;_0x129e87[_0x5adb('0xe9')]='NoAnswer';_0x129e87[_0x5adb('0xf3')]+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;var _0x34b459=ut['buildNoAnswerEventPayload'](_0x53244e,_0x2f2084);ami[_0x5adb('0x50')]('custom:agentnoanswer',_0x34b459);_0x262632=_0x2f2084[_0x5adb('0x1a2')];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1[_0x5adb('0xd0')](_0x129e87)['catch'](loggerCatch(_0x5adb('0x1b3')));if(_0x3a65e1[_0x5adb('0x1b1')](0x3,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87[_0x5adb('0xf3')]>=_0x2f2084[_0x5adb('0x1a1')]){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1b4'));}else{_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1b4'));}}break;case'5':_0x2f2084['outboundBusyCallsDay']+=0x1;_0x129e87['state']=0x5;_0x129e87[_0x5adb('0xe9')]=_0x5adb('0x1b5');_0x129e87['countbusyretry']+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;ami['emit'](_0x5adb('0x1b6'),ut[_0x5adb('0xee')](_0x53244e,_0x5adb('0x1b7')));_0x262632=_0x2f2084['dialBusyRetryFrequency'];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1['createHistory'](_0x129e87)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1b8')));if(_0x3a65e1['checkRetriveMax'](0x5,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87['countbusyretry']>=_0x2f2084[_0x5adb('0x1b9')]){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1ba'));}else{_0x3a65e1['stateGlobal'](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1ba'));}}break;case'8':_0x2f2084[_0x5adb('0x64')]+=0x1;_0x129e87[_0x5adb('0xad')]=0x8;_0x129e87[_0x5adb('0xe9')]='Congestion';_0x129e87[_0x5adb('0xf2')]+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;_0x262632=_0x2f2084[_0x5adb('0x1a6')];_0x58f288=_0x2f2084[_0x5adb('0x117')];ami[_0x5adb('0x50')]('custom:agentcongestion',ut[_0x5adb('0xee')](_0x53244e,_0x5adb('0x1bb')));_0x3a65e1[_0x5adb('0xd0')](_0x129e87)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1bc')));if(_0x3a65e1[_0x5adb('0x1b1')](0x8,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87[_0x5adb('0xf2')]>=_0x2f2084['dialCongestionMaxRetry']){_0x3a65e1['createStateFinal'](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1bd'));}else{_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1bd'));}}break;case'11':_0x2f2084[_0x5adb('0x1be')]+=0x1;_0x129e87['state']=0xb;_0x129e87[_0x5adb('0xe9')]=_0x5adb('0x11e');_0x129e87[_0x5adb('0xf5')]+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;_0x262632=_0x2f2084['dialAbandonedRetryFrequency'];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1[_0x5adb('0xd0')](_0x129e87)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x3a65e1[_0x5adb('0x1b1')](0xb,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87['countabandonedretry']>=_0x2f2084[_0x5adb('0x121')]){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,'reason\x2011\x20abandoned');}else{_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1bf'));}}break;case'20':_0x2f2084['outboundRejectCallsDay']+=0x1;_0x129e87[_0x5adb('0xad')]=0x14;_0x129e87['statedesc']=_0x5adb('0x1c0');_0x129e87[_0x5adb('0x104')]+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;_0x262632=_0x2f2084[_0x5adb('0x1aa')];_0x58f288=_0x2f2084[_0x5adb('0x117')];ami[_0x5adb('0x50')]('custom:agentreject',ut['buildObj'](_0x53244e,_0x5adb('0x1c1')));_0x3a65e1['createHistory'](_0x129e87)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1c2')));if(_0x3a65e1['checkRetriveMax'](0x14,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87[_0x5adb('0x104')]>=_0x2f2084['dialAgentRejectMaxRetry']){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1c3'));}else{_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1c3'));}}break;default:_0x2f2084[_0x5adb('0x6b')]+=0x1;_0x129e87[_0x5adb('0xad')]=0xc;_0x129e87['statedesc']=_0x182eed[_0x5adb('0x10b')];_0x262632=_0x2f2084[_0x5adb('0x1aa')];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1[_0x5adb('0xd0')](_0x129e87)['catch'](loggerCatch(_0x5adb('0x1c4')));if(_0x3a65e1[_0x5adb('0x1b1')](_0x182eed['reason'],_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87['countbusyretry']+_0x129e87['countcongestionretry']+_0x129e87[_0x5adb('0xf3')]+_0x129e87[_0x5adb('0xf4')]+_0x129e87[_0x5adb('0x102')]+_0x129e87[_0x5adb('0xf5')]+_0x129e87[_0x5adb('0x103')]+_0x129e87[_0x5adb('0x104')]>=_0x2f2084[_0x5adb('0xf6')]){_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x182eed[_0x5adb('0x10b')]);}else{_0x3a65e1['createStateFinal'](_0x129e87,_0x3fcac5,_0xf6790b,_0x182eed[_0x5adb('0x10b')]);}}}})['then'](function(){if(_0x3602a4){_0x3a65e1[_0x5adb('0xc2')](_0x129e87,_0x262632,_0x58f288)['then'](function(){return _0x3fcac5(0x1);});}});});};Dialer[_0x5adb('0xb0')]['stateGlobal']=function(_0x4fc3dc,_0x4c2cb9,_0x516657,_0x26cec1){var _0x23b1d9=new Final(_0x4fc3dc);_0x23b1d9['state']=0xf;_0x23b1d9[_0x5adb('0xe9')]=_0x5adb('0x1c5');this['createStateFinal'](_0x23b1d9,_0x4c2cb9,_0x516657,_0x26cec1);};Dialer['prototype'][_0x5adb('0xf9')]=function(_0x3cd6cf,_0x5def53,_0x45d291,_0x5a81e0){this[_0x5adb('0xe3')](_0x3cd6cf)[_0x5adb('0x41')](function(){return _0x5def53(msgResponse(_0x5adb('0x1ac'),_0x5adb('0x1c6'),_0x5a81e0));})[_0x5adb('0xb8')](function(){return _0x45d291(msgResponse('[moveContactManagedDialer][0]','Failure',_0x5adb('0x1c7')));});};Dialer[_0x5adb('0xb0')][_0x5adb('0x8')]=function(_0x32b724){var _0x2262cd=_0x32b724['dialPredictiveOptimizationPercentage']/0x64;var _0x27598b=_0x32b724['outboundDropCallsDayTimeout']/(_0x32b724[_0x5adb('0x67')]+_0x32b724[_0x5adb('0x62')]);var _0x4c882d=Math['round'](_0x32b724[_0x5adb('0x73')]*(_0x32b724[_0x5adb('0x1c8')]/0x64));var _0x2e63fa=Math[_0x5adb('0x1c9')](_0x32b724[_0x5adb('0x73')]*(_0x32b724[_0x5adb('0x1ca')]/0x64));var _0x3c71ab=_0x32b724[_0x5adb('0x53')]+_0x32b724[_0x5adb('0xa7')];var _0x3873ba=Math[_0x5adb('0x1cb')](_0x32b724[_0x5adb('0x76')]*_0x32b724['erlangAbandonmentRate']*_0x32b724['predictiveIntervalHitRate']*_0x32b724['predictiveIntervalMultiplicativeFactor']);if(_[_0x5adb('0x43')](_0x32b724[_0x5adb('0x7a')])){if(!_[_0x5adb('0x43')](_0x32b724['startPredictive'])){_0x32b724[_0x5adb('0x29')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x5adb('0x1cc'));}if(!_[_0x5adb('0x43')](_0x32b724[_0x5adb('0x97')])){loggerPredictive['error'](_0x5adb('0x1cd'),_0x5adb('0x1ce'));clearInterval(_0x32b724[_0x5adb('0x97')]);_0x32b724[_0x5adb('0x97')]=undefined;}_0x32b724[_0x5adb('0x7a')]=moment()['format'](_0x5adb('0x105'));loggerPredictive['info'](_0x32b724[_0x5adb('0x45')],_0x5adb('0x1cf'),_0x32b724[_0x5adb('0x7a')]);this[_0x5adb('0x152')](_0x32b724,0x1);}else if(ifInterval(_0x32b724[_0x5adb('0x1d0')],_0x32b724[_0x5adb('0x7a')])){this[_0x5adb('0x152')](_0x32b724,0x1);loggerPredictiveCalls['info'](_0x5adb('0x1d1'),_0x32b724['startProgressive'],_0x32b724['name']);_0x32b724[_0x5adb('0x76')]=0x0;_0x32b724[_0x5adb('0x70')]=0x0;}else if(_0x2262cd<_0x27598b&&_0x32b724['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x32b724);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x5adb('0x1d2'),_0x27598b,_0x5adb('0x7a'),_0x32b724['name']);}else if(_0x3873ba<_0x32b724[_0x5adb('0x70')]&&_0x32b724['dialPredictiveOptimization']===_0x5adb('0x1d3')){freeVariablesPredictive(_0x32b724);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x5adb('0x1d4'),_0x3873ba,'Drop\x20in\x20this\x20interval',_0x32b724[_0x5adb('0x70')],_0x5adb('0x7a'),_0x32b724['name']);}else if(!ifInterval(_0x32b724[_0x5adb('0x1d0')],_0x32b724[_0x5adb('0x7a')])&&_['isUndefined'](_0x32b724[_0x5adb('0x29')])&&!_[_0x5adb('0x43')](_0x32b724[_0x5adb('0x7a')])){_0x32b724[_0x5adb('0x29')]=moment()[_0x5adb('0x7e')](_0x5adb('0x105'));loggerPredictive['info'](_0x32b724['name'],_0x5adb('0x1d5'),_0x32b724[_0x5adb('0x29')]);this[_0x5adb('0x1d6')](_0x32b724['dialPredictiveInterval'])[_0x5adb('0x41')](this[_0x5adb('0x1d7')](_0x32b724))['then'](mergeDataErlangB(_0x32b724))[_0x5adb('0x41')](this[_0x5adb('0x1d8')](_0x32b724))[_0x5adb('0xb8')](loggerCatchPredictive(_0x5adb('0x1d9'),_0x32b724));}else if(!ifInterval(_0x32b724['dialPredictiveInterval'],_0x32b724['startPredictive'])){_0x32b724[_0x5adb('0x70')]=0x0;_0x32b724[_0x5adb('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5adb('0x84')](_0x32b724[_0x5adb('0x45')],_0x5adb('0x1da'),_0x32b724[_0x5adb('0x29')]);clearInterval(_0x32b724[_0x5adb('0x97')]);_0x32b724[_0x5adb('0x97')]=undefined;this[_0x5adb('0x1d6')](_0x32b724['dialPredictiveInterval'])[_0x5adb('0x41')](this['getDataPredictive'](_0x32b724))['then'](mergeDataErlangB(_0x32b724))['then'](this[_0x5adb('0x1d8')](_0x32b724))['catch'](loggerCatchPredictive(_0x5adb('0x1db'),_0x32b724));}else if(_0x32b724[_0x5adb('0x73')]&&_0x3c71ab<_0x32b724[_0x5adb('0x73')]-_0x2e63fa){freeVariablesPredictive(_0x32b724);loggerPredictive[_0x5adb('0x84')](_0x32b724[_0x5adb('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3c71ab,_0x5adb('0x1dc'),_0x32b724[_0x5adb('0x73')],'-',_0x2e63fa,'=',_0x32b724[_0x5adb('0x73')]-_0x2e63fa,')');}else if(_0x32b724[_0x5adb('0x73')]&&_0x3c71ab>_0x32b724[_0x5adb('0x73')]+_0x4c882d){freeVariablesPredictive(_0x32b724);loggerPredictive['info'](_0x32b724[_0x5adb('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3c71ab,_0x5adb('0x1dd'),_0x32b724[_0x5adb('0x73')],'+',_0x4c882d,'=',_0x32b724[_0x5adb('0x73')]+_0x4c882d,')');}};Dialer[_0x5adb('0xb0')][_0x5adb('0x1d7')]=function(_0x282177){var _0x1d60d5=this;return function(_0x14dcb5){return new Promise(function(_0x103e3a,_0x1deba7){_[_0x5adb('0x94')](_0x282177,_0x14dcb5[0x0]);if(checkGetDataPredictive(_0x14dcb5[0x0])){var _0xe5ced9=_0x282177['predictiveIntervalAvailable']=_0x282177[_0x5adb('0xa7')]+_0x282177['available'];var _0x2f5e18=_0x282177['dialPredictiveInterval']*0x3c;var _0x46be5d=_0x14dcb5[0x0][_0x5adb('0x8b')]+_0x14dcb5[0x0]['predictiveIntervalAvgHoldtime'];var _0x258690=(_0x14dcb5[0x0]['predictiveIntervalAnsweredCalls']+_0x14dcb5[0x0][_0x5adb('0x6e')]+_0x14dcb5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x14dcb5[0x0][_0x5adb('0x74')];_0x282177[_0x5adb('0x71')]=_0x258690>0x0?_0x258690:0x1;switch(_0x282177[_0x5adb('0x1de')]){case _0x5adb('0x1d3'):var _0x51573c=_0x282177[_0x5adb('0x1df')]/0x64;return _0x1d60d5[_0x5adb('0x1e0')](_0xe5ced9,_0x2f5e18,_0x46be5d,_0x258690,_0x51573c)[_0x5adb('0x41')](function(_0x503112){return _0x103e3a(_0x503112);});case'agentBusyFactor':var _0x2d5583=_0x282177[_0x5adb('0x1df')]/0x64;return _0x1d60d5[_0x5adb('0x1e1')](_0xe5ced9,_0x2f5e18,_0x46be5d,_0x258690,_0x2d5583)['then'](function(_0x4ff01c){return _0x103e3a(_0x4ff01c);});default:return _0x1deba7(msgResponse(_0x5adb('0x1e2'),_0x5adb('0x13d'),_0x5adb('0x1e3')));}}else{return _0x1deba7(msgResponse(_0x5adb('0x1e2'),_0x5adb('0x13d'),_0x5adb('0x1e4')));}});};};Dialer[_0x5adb('0xb0')]['getDataPredictiveOld']=function(_0x3486af){var _0x7a83dd=this;return function(_0x21d855){return new Promise(function(_0x4ad569,_0x3a2c09){_[_0x5adb('0x94')](_0x3486af,_0x21d855[0x0]);if(checkGetDataPredictive(_0x21d855[0x0])){loggerPredictive[_0x5adb('0x84')](JSON[_0x5adb('0x4d')](_0x21d855[0x0]));if(_0x3486af['dialPredictiveOptimization']===_0x5adb('0x1d3')){return _0x7a83dd['getVoiceQueueRtPauses'](_0x3486af['id'])['then'](function(_0x2cb2e3){var _0x42cbd9=_0x3486af[_0x5adb('0x54')]-_0x2cb2e3[0x0][_0x5adb('0x1e5')];var _0x2f0323=_0x3486af[_0x5adb('0x1d0')]*0x3c;var _0x5af834=_0x21d855[0x0]['predictiveIntervalAvgTalktime']+_0x21d855[0x0][_0x5adb('0x6d')];var _0x5a8755=(_0x21d855[0x0][_0x5adb('0x6c')]+_0x21d855[0x0][_0x5adb('0x6e')]+_0x21d855[0x0][_0x5adb('0x88')])/_0x21d855[0x0][_0x5adb('0x74')];var _0x293db1=_0x3486af['dialPredictiveOptimizationPercentage']/0x64;_0x3486af['predictiveIntervalPauses']=_0x2cb2e3[0x0][_0x5adb('0x1e5')]||0x0;_0x3486af[_0x5adb('0x71')]=_0x5a8755>0x0?_0x5a8755:0x1;return _0x7a83dd[_0x5adb('0x1e0')](_0x42cbd9,_0x2f0323,_0x5af834,_0x5a8755,_0x293db1);})['then'](function(_0x3a97dd){return _0x4ad569(_0x3a97dd);})['catch'](function(_0x190653){return _0x3a2c09(msgResponse('[CatchErlangB]',_0x5adb('0x13d'),JSON[_0x5adb('0x4d')](_0x190653)));});}if(_0x3486af[_0x5adb('0x1de')]==='agentBusyFactor'){return _0x7a83dd[_0x5adb('0xce')](_0x3486af['id'])[_0x5adb('0x41')](function(_0xcd99ec){var _0x538b72=_0x3486af[_0x5adb('0x54')]-_0xcd99ec[0x0][_0x5adb('0x1e5')];var _0x25bc2a=_0x3486af[_0x5adb('0x1d0')]*0x3c;var _0x1f2913=_0x21d855[0x0]['predictiveIntervalAvgTalktime']+_0x21d855[0x0][_0x5adb('0x6d')];var _0x11be18=(_0x21d855[0x0][_0x5adb('0x6c')]+_0x21d855[0x0][_0x5adb('0x6e')]+_0x21d855[0x0][_0x5adb('0x88')])/_0x21d855[0x0][_0x5adb('0x74')];var _0x949b35=_0x3486af['dialPredictiveOptimizationPercentage']/0x64;_0x3486af[_0x5adb('0x1e6')]=_0xcd99ec[0x0][_0x5adb('0x1e5')]||0x0;_0x3486af[_0x5adb('0x71')]=_0x11be18>0x0?_0x11be18:0x1;return _0x7a83dd['busyFactor'](_0x538b72,_0x25bc2a,_0x1f2913,_0x11be18,_0x949b35);})[_0x5adb('0x41')](function(_0x46af7e){return _0x4ad569(_0x46af7e);})[_0x5adb('0xb8')](function(_0xd3124a){return _0x3a2c09(msgResponse(_0x5adb('0x1e7'),_0x5adb('0x13d'),JSON['stringify'](_0xd3124a)));});}}else{return _0x3a2c09(msgResponse(_0x5adb('0x1e2'),'Failure',_0x5adb('0x1e4')));}});};};Dialer[_0x5adb('0xb0')]['startMethodPredictive']=function(_0xdeb1f9){var _0x39c601=this;return function(){var _0x144788=0x0;var _0x555dc4=Math[_0x5adb('0x1cb')](_0xdeb1f9[_0x5adb('0x77')]*0x3e8);if(_0x555dc4>0x0){_0x555dc4=_0x555dc4<0x64?0x64:_0x555dc4;loggerPredictive[_0x5adb('0x84')](_0xdeb1f9[_0x5adb('0x45')],_0x5adb('0x1e8'),_0x555dc4,_0x5adb('0x4e'));_0xdeb1f9[_0x5adb('0x97')]=setInterval(function(){_0x39c601['handlePredictive'](_0xdeb1f9);loggerPredictiveCalls[_0x5adb('0x84')](_0x5adb('0x1e9'),_0x144788+=0x1);},_0x555dc4);}else{loggerPredictive['info'](_0xdeb1f9[_0x5adb('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x5adb('0x1ea')]=function(_0x25f9fb,_0x531d34){var _0x23ba9e=this;return function(_0xec07b9){if(_['isEmpty'](_0xec07b9)){if(_[_0x5adb('0xb4')](_0x531d34[_0x5adb('0xda')])||!_0x531d34['recallme']){if(_0x25f9fb[_0x5adb('0x5e')]===_0x5adb('0x7')){_0x25f9fb[_0x5adb('0x127')]=_[_0x5adb('0x43')](_0x25f9fb[_0x5adb('0x127')])?!![]:_0x25f9fb[_0x5adb('0x127')];var _0x28135f=uuid['v4']();_0x23ba9e['actions'][_0x28135f]=new Action(_0x25f9fb,_0x531d34,_0x28135f);loggerBooked['info'](_0x5adb('0x1eb'),_0x28135f,_0x5adb('0x1ec'),JSON[_0x5adb('0x4d')](_0x25f9fb[_0x5adb('0x127')]),_0x5adb('0x1ed'),_0x25f9fb[_0x5adb('0x45')]);if(_0x25f9fb[_0x5adb('0x127')]){_0x25f9fb[_0x5adb('0x127')]=![];_0x23ba9e['queueBooked'][_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xbb')]]=[];ami[_0x5adb('0xb5')]({'actionid':_0x28135f,'action':'queuestatus','queue':_0x25f9fb[_0x5adb('0x45')]})[_0x5adb('0xb8')](function(){_0x23ba9e['updateOriginated'](_0x25f9fb);_0x23ba9e[_0x5adb('0xc6')]({'active':![],'ContactId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xd8')],'ListId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xd9')],'VoiceQueueId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xdb')]||undefined,'CampaignId':_0x23ba9e['actions'][_0x28135f][_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1ee')));delete _0x23ba9e[_0x5adb('0x26')][_0x28135f];});}else{loggerBooked[_0x5adb('0x84')](_0x5adb('0x1ef'),JSON[_0x5adb('0x4d')](_0x25f9fb['queueStatusComplete']),_0x5adb('0x1ed'),_0x25f9fb['name']);_0x23ba9e['updateOriginated'](_0x25f9fb);_0x23ba9e['rescheduleContact']({'active':![],'ContactId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xd8')],'ListId':_0x23ba9e['actions'][_0x28135f]['ListId'],'VoiceQueueId':_0x23ba9e['actions'][_0x28135f][_0x5adb('0xdb')]||undefined,'CampaignId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xdc')]||undefined})['catch'](loggerCatch(_0x5adb('0x1ee')));delete _0x23ba9e[_0x5adb('0x26')][_0x28135f];}}else{return _0x23ba9e[_0x5adb('0x16a')](_0x25f9fb,_0x531d34);}}else{if(getDiff(_0x531d34[_0x5adb('0x1f0')])<_0x25f9fb[_0x5adb('0x1f1')]*0x3c){if(_0x531d34[_0x5adb('0x158')]&&!_0x531d34[_0x5adb('0x158')]['voicePause']){_0x23ba9e['preview'][_0x5adb('0x12a')](_0x531d34['id'])[_0x5adb('0x1d')](function(){_0x23ba9e[_0x5adb('0xba')](_0x25f9fb);});}else{_0x23ba9e['unlockContact']({'active':![]},_0x531d34['id'],0x1)['finally'](function(){_0x23ba9e['updateOriginated'](_0x25f9fb);});}}else{_0x25f9fb[_0x5adb('0x1f2')]+=0x1;_0x23ba9e[_0x5adb('0xba')](_0x25f9fb);if(_0x25f9fb[_0x5adb('0x1f3')]){_0x23ba9e[_0x5adb('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x531d34[_0x5adb('0xd8')],'ListId':_0x531d34[_0x5adb('0xd9')],'VoiceQueueId':_0x531d34[_0x5adb('0xdb')]||undefined,'CampaignId':_0x531d34[_0x5adb('0xdc')]||undefined})['catch'](loggerCatch(_0x5adb('0x1f4')));_0x23ba9e[_0x5adb('0xd0')](createObjHistory(_0x25f9fb,_0x531d34,_0x5adb('0x1f5'),0x17,_0x5adb('0x1f6')))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1f7')));}else{_0x23ba9e[_0x5adb('0xe2')](createObjHistory(_0x25f9fb,_0x531d34,_0x5adb('0x1f8'),0x16,_0x5adb('0x1f9')),_0x5adb('0x1fa'),_0x5adb('0x1fb'));}}}}else{_0x25f9fb[_0x5adb('0x1fc')]+=0x1;_0x23ba9e[_0x5adb('0xe2')](createObjHistory(_0x25f9fb,_0x531d34,_0x5adb('0x1fd'),0xd,_0x5adb('0x1fe')),_0x5adb('0x1ff'),_0x5adb('0x200'));throw'inBlackList';}};};Dialer[_0x5adb('0xb0')][_0x5adb('0x15b')]=function(_0x15ac80){var _0x94e26c=this;var _0x453f13=_0x15ac80[_0x5adb('0x201')]-_0x15ac80[_0x5adb('0x75')]-_0x15ac80[_0x5adb('0xca')];emitCampaignSummary(_0x15ac80);if(_0x453f13>0x0){if(_0x453f13>this[_0x5adb('0x24')]){_0x453f13=this[_0x5adb('0x24')];}_0x15ac80[_0x5adb('0xca')]+=_0x453f13;this['getContactDialerIvr'](_0x15ac80['id'],_0x453f13,_0x15ac80[_0x5adb('0x202')],_0x15ac80)[_0x5adb('0x41')](function(_0x31a86a){_0x15ac80[_0x5adb('0xca')]-=_0x453f13;_0x15ac80['temp']=_0x15ac80['temp']>0x0?_0x15ac80['temp']:0x0;if(!checkContactEmpty(_0x31a86a)){_0x15ac80[_0x5adb('0x44')]=_0x5adb('0xa4');logger[_0x5adb('0x84')](_0x5adb('0x203')+_0x15ac80['name']);}else{_0x15ac80['originated']+=_0x31a86a[_0x5adb('0x9e')];_0x15ac80[_0x5adb('0x44')]=_0x5adb('0x204');for(var _0x2d2117=0x0;_0x2d2117<_0x31a86a['length'];_0x2d2117+=0x1){_0x15ac80['ivrTotalCallsDays']+=0x1;if(_[_0x5adb('0xb4')](_0x31a86a[_0x2d2117])||_['isNil'](_0x31a86a[_0x2d2117][_0x5adb('0x185')])||_['isNil'](_0x31a86a[_0x2d2117][_0x5adb('0x16d')])){_0x94e26c['emptyContact']('[actionOriginate]\x20',_0x15ac80,_0x31a86a[_0x2d2117]);}else{_0x94e26c[_0x5adb('0xc4')](_['pick'](_0x31a86a[_0x2d2117],[_0x5adb('0xdc'),_0x5adb('0x16d')]))['then'](_0x94e26c['checkContactBlack'](_0x15ac80,_0x31a86a[_0x2d2117]))[_0x5adb('0xb8')](_0x94e26c[_0x5adb('0xd4')](_0x5adb('0x205'),_0x15ac80));}}}})[_0x5adb('0xb8')](loggerGetContactDialer(_0x5adb('0x206'),_0x15ac80,_0x453f13));}};Dialer[_0x5adb('0xb0')][_0x5adb('0x152')]=function(_0x5a2933,_0x568521){var _0x4e41e6=this;var _0x2587b4=[];var _0x49f355=_0x568521>=0x1?_0x568521:0x1;if(_0x5a2933[_0x5adb('0x5e')]===_0x5adb('0x7')){_0x49f355=0x1;}var _0x5df8c4=Math[_0x5adb('0x1cb')](_0x5a2933['available']*_0x49f355)-_0x5a2933[_0x5adb('0x75')]-_0x5a2933[_0x5adb('0xca')];emitVoiceQueueSummary(_0x5a2933);if(_0x5a2933[_0x5adb('0x207')]>0x0){var _0x6d698=_0x5a2933[_0x5adb('0x207')]-_0x5a2933['originated']-_0x5a2933[_0x5adb('0xa7')]-_0x5a2933[_0x5adb('0xca')]-_0x5a2933['pTalking'];if(_0x5df8c4>_0x6d698){_0x5df8c4=_0x6d698;}}if(_0x5df8c4>0x0){if(_0x5a2933[_0x5adb('0x5e')]===_0x5adb('0x7')){_0x5df8c4=0x1;}if(_0x5df8c4>this['maxNumberOriginate']){_0x5df8c4=this[_0x5adb('0x24')];}_0x5a2933[_0x5adb('0xca')]+=_0x5df8c4;for(var _0x3caa67 in this[_0x5adb('0x22')]){if(typeof this[_0x5adb('0x22')][_0x3caa67]!==_0x5adb('0xd2')){if(this['agents'][_0x3caa67][_0x5adb('0xad')]===_0x5adb('0x208')&&this[_0x5adb('0x22')][_0x3caa67]['status']===_0x5adb('0x161')){_0x2587b4[_0x5adb('0x141')](this['agents'][_0x3caa67]['id']);}}}this['getContactDialer'](_0x5a2933['id'],_0x2587b4,_0x5df8c4,_0x5a2933['dialOrderByScheduledAt'],_0x5a2933)[_0x5adb('0x41')](function(_0x5c7166){_0x5a2933[_0x5adb('0xca')]-=_0x5df8c4;_0x5a2933[_0x5adb('0xca')]=_0x5a2933[_0x5adb('0xca')]>0x0?_0x5a2933[_0x5adb('0xca')]:0x0;if(!checkContactEmpty(_0x5c7166)){_0x4e41e6[_0x5adb('0xbd')](_0x5a2933)[_0x5adb('0x41')](sendMessageReschedule(_0x5a2933))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x209')));}else{_0x5a2933[_0x5adb('0x75')]+=_0x5c7166[_0x5adb('0x9e')];_0x5a2933[_0x5adb('0x44')]=_0x5a2933[_0x5adb('0x5e')]===_0x5adb('0x7')?_0x5adb('0x175'):'RUNNING';for(var _0x53d8fb=0x0;_0x53d8fb<_0x5c7166[_0x5adb('0x9e')];_0x53d8fb+=0x1){if(_[_0x5adb('0xb4')](_0x5c7166[_0x53d8fb])||_[_0x5adb('0xb4')](_0x5c7166[_0x53d8fb][_0x5adb('0x185')])||_['isNil'](_0x5c7166[_0x53d8fb][_0x5adb('0x16d')])){_0x4e41e6[_0x5adb('0xd5')](_0x5adb('0x20a'),_0x5a2933,_0x5c7166[_0x53d8fb]);}else{_0x4e41e6[_0x5adb('0xbf')](_[_0x5adb('0xd7')](_0x5c7166[_0x53d8fb],[_0x5adb('0xdb'),_0x5adb('0x16d')]))[_0x5adb('0x41')](_0x4e41e6[_0x5adb('0x1ea')](_0x5a2933,_0x5c7166[_0x53d8fb]))['catch'](_0x4e41e6['loggerHandler'](_0x5adb('0x20a'),_0x5a2933));}}}})[_0x5adb('0xb8')](loggerGetContactDialer(_0x5adb('0x20b'),_0x5a2933,_0x5df8c4));}};Dialer[_0x5adb('0xb0')][_0x5adb('0x97')]=function(_0x53a482){if(_0x53a482[_0x5adb('0x207')]>0x0){var _0x250255=_0x53a482[_0x5adb('0x207')]-_0x53a482[_0x5adb('0x75')]-_0x53a482['talking'];if(_0x250255>0x0){this[_0x5adb('0x20c')](_0x53a482);}else{loggerPredictiveCalls[_0x5adb('0x84')]('[handlePredictive][limitChannel]');}}else{this[_0x5adb('0x20c')](_0x53a482);}};Dialer[_0x5adb('0xb0')][_0x5adb('0x20c')]=function(_0x517683){var _0x12a509=this;var _0x3ad7bf=[];_0x517683[_0x5adb('0x75')]+=0x1;for(var _0x2aa949 in this['agents']){if(typeof this['agents'][_0x2aa949]!==_0x5adb('0xd2')){if(this['agents'][_0x2aa949][_0x5adb('0xad')]==='not_inuse'&&this[_0x5adb('0x22')][_0x2aa949][_0x5adb('0xb6')]===_0x5adb('0x161')){_0x3ad7bf[_0x5adb('0x141')](this[_0x5adb('0x22')][_0x2aa949]['id']);}}}this[_0x5adb('0xc9')](_0x517683['id'],_0x3ad7bf,0x1,_0x517683[_0x5adb('0x202')],_0x517683)[_0x5adb('0x41')](function(_0x118ca7){if(!checkContactEmpty(_0x118ca7)){checkContactLowerLimitOriginate(_0x517683,0x1,0x0);_0x12a509['countReScheduled'](_0x517683)[_0x5adb('0x41')](sendMessageReschedule(_0x517683))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x209')));}else{_0x517683[_0x5adb('0x44')]=_0x5adb('0x204');if(_[_0x5adb('0xb4')](_0x118ca7[0x0])||_[_0x5adb('0xb4')](_0x118ca7[0x0][_0x5adb('0x185')])||_[_0x5adb('0xb4')](_0x118ca7[0x0]['phone'])){_0x12a509['emptyContact']('[actionOriginate]\x20',_0x517683,_0x118ca7[0x0]);}else{_0x12a509['checkIsBlackList'](_[_0x5adb('0xd7')](_0x118ca7[0x0],[_0x5adb('0xdb'),_0x5adb('0x16d')]))[_0x5adb('0x41')](_0x12a509[_0x5adb('0x1ea')](_0x517683,_0x118ca7[0x0]))['catch'](_0x12a509[_0x5adb('0xd4')](_0x5adb('0x20d'),_0x517683));}}})[_0x5adb('0xb8')](loggerGetContactDialer(_0x5adb('0x20e'),_0x517683,0x1));emitVoiceQueueSummary(_0x517683);};Dialer[_0x5adb('0xb0')][_0x5adb('0x1e0')]=function(_0x5bb8f2,_0x1439f4,_0x4513a9,_0xe473fd,_0x454189,_0x13550a){loggerPredictive[_0x5adb('0x84')](_0x5adb('0x20f'));loggerPredictive[_0x5adb('0x84')]('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',_0x5bb8f2);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x210'),_0x1439f4);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x211'),_0x4513a9);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x212'),_0xe473fd);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x213'),_0x454189);loggerPredictive['info'](_0x5adb('0x8a'));return new Promise(function(_0x188481,_0x2c3ef1){if(_0x5bb8f2<=0x0||isNaN(_0x5bb8f2)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),_0x5adb('0x19b'),_0x5adb('0x215')+_0x5bb8f2));}if(_0x4513a9<=0x0||isNaN(_0x4513a9)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),_0x5adb('0x19b'),_0x5adb('0x216')+_0x4513a9));}if(_0xe473fd<=0x0||isNaN(_0xe473fd)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),'Error',_0x5adb('0x217')+_0xe473fd));}if(_0x1439f4<=0x0||isNaN(_0x1439f4)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),_0x5adb('0x19b'),_0x5adb('0x218')+_0x1439f4));}if(_0x454189<=0x0||isNaN(_0x454189)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),'Error',_0x5adb('0x219')+_0x454189));}_0x13550a=_0x13550a||0x0;var _0x1b1352=0x1/_0x4513a9;var _0x587acc=0x0;var _0x38cf0f=0x0;var _0x4155e7=0x0;var _0x2f8a17=0x0;for(var _0x487d27=0x0;_0x4155e7<_0x454189;_0x487d27+=0x1){_0x38cf0f=_0x487d27/_0x1439f4;_0x587acc=(_0xe473fd*_0x38cf0f+_0x13550a)/_0x1b1352;_0x4155e7=erlangb(_0x587acc,_0x5bb8f2);_0x2f8a17=_0x587acc/_0x5bb8f2*(0x1-erlangb(_0x587acc,_0x5bb8f2));}return _0x188481({'erlangCalls':_0x487d27,'erlangCallToSecond':_0x1439f4/_0x487d27,'erlangAbandonmentRate':_0x4155e7,'erlangBusyFactor':_0x2f8a17});});};Dialer['prototype'][_0x5adb('0x1e1')]=function(_0x552d89,_0xc38d68,_0xc05e33,_0x168cb8,_0x2ed5d6,_0x50c31c){loggerPredictive[_0x5adb('0x84')](_0x5adb('0x21a'));loggerPredictive[_0x5adb('0x84')]('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',_0x552d89);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x210'),_0xc38d68);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x211'),_0xc05e33);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x212'),_0x168cb8);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x21b'),_0x2ed5d6);loggerPredictive[_0x5adb('0x84')]('---------------------------');return new Promise(function(_0x4ceb3e,_0x55a8cb){if(_0x552d89<=0x0||isNaN(_0x552d89)){return _0x55a8cb(msgResponse('[busyFactor]',_0x5adb('0x19b'),_0x5adb('0x215')+_0x552d89));}if(_0xc05e33<=0x0||isNaN(_0xc05e33)){return _0x55a8cb(msgResponse(_0x5adb('0x21c'),_0x5adb('0x19b'),'Ts\x20=\x20'+_0xc05e33));}if(_0x168cb8<=0x0||isNaN(_0x168cb8)){return _0x55a8cb(msgResponse(_0x5adb('0x21c'),'Error',_0x5adb('0x217')+_0x168cb8));}if(_0xc38d68<=0x0||isNaN(_0xc38d68)){return _0x55a8cb(msgResponse(_0x5adb('0x21c'),_0x5adb('0x19b'),_0x5adb('0x218')+_0xc38d68));}if(_0x2ed5d6<=0x0||isNaN(_0x2ed5d6)){return _0x55a8cb(msgResponse(_0x5adb('0x21c'),_0x5adb('0x19b'),_0x5adb('0x21d')+_0x2ed5d6));}_0x50c31c=_0x50c31c||0x0;var _0x2cb0d5=0x1/_0xc05e33;var _0x25bd61=0x0;var _0x30d644=0x0;var _0x2814b4=0x0;var _0x558759=0x0;for(var _0x333f94=0x0;_0x558759<_0x2ed5d6;_0x333f94+=0x1){_0x30d644=_0x333f94/_0xc38d68;_0x25bd61=(_0x168cb8*_0x30d644+_0x50c31c)/_0x2cb0d5;_0x2814b4=erlangb(_0x25bd61,_0x552d89);_0x558759=_0x25bd61/_0x552d89*(0x1-erlangb(_0x25bd61,_0x552d89));}return _0x4ceb3e({'erlangCalls':_0x333f94,'erlangCallToSecond':_0xc38d68/_0x333f94,'erlangAbandonmentRate':_0x2814b4,'erlangBusyFactor':_0x558759});});};module[_0x5adb('0x21e')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 337b2fa..69208d0 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 _0x522e=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x29691f,_0x5a569a){var _0x230bd0=function(_0x5d5235){while(--_0x5d5235){_0x29691f['push'](_0x29691f['shift']());}};_0x230bd0(++_0x5a569a);}(_0x522e,0x9c));var _0xe522=function(_0x8e97fb,_0x491639){_0x8e97fb=_0x8e97fb-0x0;var _0x11169e=_0x522e[_0x8e97fb];return _0x11169e;};'use strict';var util=require(_0xe522('0x0'));var _=require(_0xe522('0x1'));var moment=require('moment');function getSeconds(_0x1fdb53,_0x212155){var _0xd01ac8=moment(_0x1fdb53)['milliseconds'](0x0);var _0x5bd53d=moment(_0x212155)[_0xe522('0x2')](0x0);return _0xd01ac8[_0xe522('0x3')](_0x5bd53d,_0xe522('0x4'));}function QueueCallerAbandon(_0x4963e6,_0x180985){this[_0xe522('0x5')]=_0x4963e6[_0xe522('0x5')];this['type']=_0x4963e6[_0xe522('0x6')];this['campaigntype']=_0x4963e6['type']==='outbound'?_0xe522('0x7'):_0x4963e6['type'];this[_0xe522('0x8')]=_0x4963e6[_0xe522('0x8')];this['countcongestionretry']=_0x4963e6[_0xe522('0x9')];this[_0xe522('0xa')]=_0x4963e6[_0xe522('0xa')];this[_0xe522('0xb')]=_0x4963e6['countbusyretry']+_0x4963e6[_0xe522('0x9')]+_0x4963e6['countnoanswerretry']+_0x4963e6['countnosuchnumberretry']+_0x4963e6[_0xe522('0xc')]+_0x4963e6[_0xe522('0xd')]+_0x4963e6[_0xe522('0xe')]+_0x4963e6['countagentrejectretry'];this['countnosuchnumberretry']=_0x4963e6['countnosuchnumberretry'];this[_0xe522('0xc')]=_0x4963e6[_0xe522('0xc')];this[_0xe522('0xd')]=_0x4963e6[_0xe522('0xd')];this[_0xe522('0xe')]=_0x4963e6[_0xe522('0xe')];this[_0xe522('0xf')]=_0x4963e6[_0xe522('0xf')];this['uniqueid']=_0x180985[_0xe522('0x10')];this[_0xe522('0x11')]=_0x4963e6['name'];this['calleridnum']=_0x4963e6['number'];this[_0xe522('0x12')]=_0x4963e6[_0xe522('0x12')];this[_0xe522('0x13')]=_0x4963e6[_0xe522('0x13')];this[_0xe522('0x14')]=_0x4963e6[_0xe522('0x14')];this[_0xe522('0x15')]=this[_0xe522('0x14')];this[_0xe522('0x16')]=getSeconds(_0x4963e6['responsetime'],_0x4963e6[_0xe522('0x12')]);this[_0xe522('0x17')]=getSeconds(this[_0xe522('0x14')],_0x4963e6[_0xe522('0x13')]);this['talktime']=0x0;this[_0xe522('0x7')]=_0x180985[_0xe522('0x7')];this[_0xe522('0x18')]=_0x180985[_0xe522('0x19')];this['reason']=_0x180985[_0xe522('0x1a')];this[_0xe522('0x1b')]=_0x4963e6[_0xe522('0x1b')];this[_0xe522('0x1c')]=_0x4963e6[_0xe522('0x1c')];this[_0xe522('0x1d')]=_0x4963e6[_0xe522('0x1d')];this[_0xe522('0x1e')]=_0x4963e6[_0xe522('0x1e')];this[_0xe522('0x1f')]=_0x4963e6[_0xe522('0x1f')];this['ListId']=_0x4963e6[_0xe522('0x20')];this['UserId']=_0x4963e6[_0xe522('0x21')];this[_0xe522('0x22')]=_0x4963e6[_0xe522('0x22')];this['CampaignId']=_0x4963e6[_0xe522('0x23')];this[_0xe522('0x24')]=_0x4963e6[_0xe522('0x24')]||'';this[_0xe522('0x25')]=_0x4963e6[_0xe522('0x25')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x901b=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId'];(function(_0xf3b124,_0x5bd998){var _0x16aa63=function(_0x25a72b){while(--_0x25a72b){_0xf3b124['push'](_0xf3b124['shift']());}};_0x16aa63(++_0x5bd998);}(_0x901b,0x15d));var _0xb901=function(_0x2593ee,_0x555ca3){_0x2593ee=_0x2593ee-0x0;var _0x236ca3=_0x901b[_0x2593ee];return _0x236ca3;};'use strict';var util=require(_0xb901('0x0'));var _=require(_0xb901('0x1'));var moment=require(_0xb901('0x2'));function getSeconds(_0x35836b,_0x29a572){var _0x409e6f=moment(_0x35836b)['milliseconds'](0x0);var _0x559b35=moment(_0x29a572)[_0xb901('0x3')](0x0);return _0x409e6f[_0xb901('0x4')](_0x559b35,'seconds');}function QueueCallerAbandon(_0x365754,_0x3975de){this[_0xb901('0x5')]=_0x365754[_0xb901('0x5')];this[_0xb901('0x6')]=_0x365754[_0xb901('0x6')];this[_0xb901('0x7')]=_0x365754[_0xb901('0x6')]===_0xb901('0x8')?_0xb901('0x9'):_0x365754[_0xb901('0x6')];this['countbusyretry']=_0x365754[_0xb901('0xa')];this['countcongestionretry']=_0x365754[_0xb901('0xb')];this[_0xb901('0xc')]=_0x365754[_0xb901('0xc')];this[_0xb901('0xd')]=_0x365754[_0xb901('0xa')]+_0x365754[_0xb901('0xb')]+_0x365754[_0xb901('0xc')]+_0x365754[_0xb901('0xe')]+_0x365754[_0xb901('0xf')]+_0x365754[_0xb901('0x10')]+_0x365754[_0xb901('0x11')]+_0x365754[_0xb901('0x12')];this['countnosuchnumberretry']=_0x365754[_0xb901('0xe')];this[_0xb901('0xf')]=_0x365754[_0xb901('0xf')];this[_0xb901('0x10')]=_0x365754[_0xb901('0x10')];this[_0xb901('0x11')]=_0x365754[_0xb901('0x11')];this[_0xb901('0x12')]=_0x365754[_0xb901('0x12')];this[_0xb901('0x13')]=_0x3975de['uniqueid'];this[_0xb901('0x14')]=_0x365754[_0xb901('0x15')];this[_0xb901('0x16')]=_0x365754[_0xb901('0x17')];this['starttime']=_0x365754[_0xb901('0x18')];this[_0xb901('0x19')]=_0x365754[_0xb901('0x19')];this[_0xb901('0x1a')]=_0x365754[_0xb901('0x1a')];this[_0xb901('0x1b')]=this[_0xb901('0x1a')];this[_0xb901('0x1c')]=getSeconds(_0x365754[_0xb901('0x19')],_0x365754['starttime']);this[_0xb901('0x1d')]=getSeconds(this[_0xb901('0x1a')],_0x365754[_0xb901('0x19')]);this['talktime']=0x0;this[_0xb901('0x9')]=_0x3975de[_0xb901('0x9')];this[_0xb901('0x1e')]=_0x3975de['connectedlinename'];this[_0xb901('0x1f')]=_0x3975de['reason'];this[_0xb901('0x20')]=_0x365754[_0xb901('0x20')];this[_0xb901('0x21')]=_0x365754[_0xb901('0x21')];this['callbackat']=_0x365754['callbackat'];this[_0xb901('0x22')]=_0x365754[_0xb901('0x22')];this[_0xb901('0x23')]=_0x365754[_0xb901('0x23')];this[_0xb901('0x24')]=_0x365754[_0xb901('0x24')];this[_0xb901('0x25')]=_0x365754['UserId'];this[_0xb901('0x26')]=_0x365754[_0xb901('0x26')];this[_0xb901('0x27')]=_0x365754[_0xb901('0x27')];this[_0xb901('0x28')]=_0x365754[_0xb901('0x28')]||'';this[_0xb901('0x29')]=_0x365754['originatecalleridname']||'';}module[_0xb901('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 9ceb6fd..05d1d52 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(_0x2a375f,_0x2e39a5){var _0x42a081=function(_0x181a71){while(--_0x181a71){_0x2a375f['push'](_0x2a375f['shift']());}};_0x42a081(++_0x2e39a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x3a37a3,_0x3a74e6){var _0x19434d=function(_0x1f2a7f){while(--_0x1f2a7f){_0x3a37a3['push'](_0x3a37a3['shift']());}};_0x19434d(++_0x3a74e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 749233f..9ccf18e 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 _0xd027=['notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','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','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','status','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf'];(function(_0x4b4238,_0x180369){var _0x5c6f26=function(_0x4f5848){while(--_0x4f5848){_0x4b4238['push'](_0x4b4238['shift']());}};_0x5c6f26(++_0x180369);}(_0xd027,0x197));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var _=require(_0x7d02('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x7d02('0x1'));var path=require(_0x7d02('0x2'));var tiff2pdf=require(_0x7d02('0x3'));var gs=require(_0x7d02('0x4'));var logger=require(_0x7d02('0x5'))(_0x7d02('0x6'));var ami=require(_0x7d02('0x7'));var rpcDb=require(_0x7d02('0x8'));var Channel=require('./channel');var ut=require(_0x7d02('0x9'));var Action=require(_0x7d02('0xa'));var faxAccount=require(_0x7d02('0xb'));var attachment=require(_0x7d02('0xc'));var faxMessage=require(_0x7d02('0xd'));function Fax(_0x310426){this[_0x7d02('0xe')]={};this[_0x7d02('0xf')]=_0x310426[_0x7d02('0xf')];this[_0x7d02('0x10')]=_0x310426[_0x7d02('0x10')];this[_0x7d02('0x11')]={};ami['on'](_0x7d02('0x12'),this['syncNewchannel'][_0x7d02('0x13')](this));ami['on'](_0x7d02('0x14'),this['syncVarSet'][_0x7d02('0x13')](this));ami['on'](_0x7d02('0x15'),this[_0x7d02('0x16')][_0x7d02('0x13')](this));ami['on']('newexten',this[_0x7d02('0x17')]['bind'](this));ami['on'](_0x7d02('0x18'),this[_0x7d02('0x19')]['bind'](this));ami['on'](_0x7d02('0x1a'),this[_0x7d02('0x1b')]['bind'](this));ami['on'](_0x7d02('0x1c'),this[_0x7d02('0x1d')][_0x7d02('0x13')](this));ami['on']('originateresponse',this[_0x7d02('0x1e')][_0x7d02('0x13')](this));}Fax[_0x7d02('0x1f')][_0x7d02('0x20')]=function(_0x3c4fa9){if(_0x3c4fa9[_0x7d02('0x21')]===_0x7d02('0x22')){for(var _0x3024d2 in this[_0x7d02('0xf')]){if(this[_0x7d02('0xf')][_0x7d02('0x23')](_0x3024d2)){if(_0x3c4fa9[_0x7d02('0x24')]===this[_0x7d02('0xf')][_0x3024d2][_0x7d02('0x25')]){this[_0x7d02('0xe')][_0x3c4fa9[_0x7d02('0x26')]]={};this['channels'][_0x3c4fa9[_0x7d02('0x26')]][_0x7d02('0x27')]=_0x3c4fa9[_0x7d02('0x27')];this[_0x7d02('0xe')][_0x3c4fa9[_0x7d02('0x26')]]['id']=this[_0x7d02('0xf')][_0x3024d2]['id'];this[_0x7d02('0xe')][_0x3c4fa9['uniqueid']][_0x7d02('0x28')]=this[_0x7d02('0xf')][_0x3024d2][_0x7d02('0x28')];logger[_0x7d02('0x29')](_0x3c4fa9[_0x7d02('0x26')],_0x7d02('0x2a'));}}}}if(this[_0x7d02('0x11')][_0x3c4fa9[_0x7d02('0x26')]]){this[_0x7d02('0xe')][_0x3c4fa9[_0x7d02('0x26')]]={};this[_0x7d02('0xe')][_0x3c4fa9['uniqueid']][_0x7d02('0x27')]=_0x3c4fa9[_0x7d02('0x27')];logger[_0x7d02('0x29')](_0x3c4fa9['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x7d02('0x1f')][_0x7d02('0x2b')]=function(_0x169e1a){if(this[_0x7d02('0xe')][_0x169e1a[_0x7d02('0x26')]]){for(var _0x452b8e in _0x169e1a[_0x7d02('0x2c')]){if(_0x169e1a[_0x7d02('0x2c')]['hasOwnProperty'](_0x452b8e)){this['channels'][_0x169e1a['uniqueid']][_0x452b8e]=_0x169e1a[_0x7d02('0x2d')];}}}};Fax[_0x7d02('0x1f')][_0x7d02('0x16')]=function(_0x2ab1ae){if(this['channels'][_0x2ab1ae[_0x7d02('0x26')]]){this['channels'][_0x2ab1ae['uniqueid']][_0x7d02('0x2e')]=_0x2ab1ae[_0x7d02('0x2e')];this[_0x7d02('0xe')][_0x2ab1ae[_0x7d02('0x26')]]['channelstatedesc']=_0x2ab1ae[_0x7d02('0x2f')];}};Fax[_0x7d02('0x1f')][_0x7d02('0x17')]=function(_0x4bac3e){if(this[_0x7d02('0xe')][_0x4bac3e[_0x7d02('0x26')]]){for(var _0x22cf7e in _0x4bac3e[_0x7d02('0x2c')]){if(_0x4bac3e[_0x7d02('0x2c')][_0x7d02('0x23')](_0x22cf7e)){this[_0x7d02('0xe')][_0x4bac3e[_0x7d02('0x26')]][_0x22cf7e]=_0x4bac3e[_0x7d02('0x2d')];}}}};Fax[_0x7d02('0x1f')][_0x7d02('0x19')]=function(_0x376d78){if(this['channels'][_0x376d78[_0x7d02('0x26')]]){this[_0x7d02('0xe')][_0x376d78[_0x7d02('0x26')]][_0x7d02('0x30')]=_0x376d78['operation'];this['channels'][_0x376d78[_0x7d02('0x26')]]['status']=_0x376d78['status'];this[_0x7d02('0xe')][_0x376d78['uniqueid']]['localstationid']=_0x376d78[_0x7d02('0x25')];this['channels'][_0x376d78[_0x7d02('0x26')]]['filename']=_0x376d78[_0x7d02('0x31')];logger['info'](_0x376d78[_0x7d02('0x26')],_0x7d02('0x32'));}};Fax[_0x7d02('0x1f')]['syncReceiveFax']=function(_0x4e9be4){var _0x388842=this;if(this[_0x7d02('0xe')][_0x4e9be4[_0x7d02('0x26')]]){var _0x6f7a4c=this[_0x7d02('0xe')][_0x4e9be4[_0x7d02('0x26')]]['id'];this[_0x7d02('0xe')][_0x4e9be4[_0x7d02('0x26')]][_0x7d02('0x33')]=_0x4e9be4[_0x7d02('0x33')];this[_0x7d02('0xe')][_0x4e9be4['uniqueid']]['pagestransferred']=_0x4e9be4['pagestransferred'];this[_0x7d02('0xe')][_0x4e9be4[_0x7d02('0x26')]][_0x7d02('0x25')]=_0x4e9be4[_0x7d02('0x25')];this[_0x7d02('0xe')][_0x4e9be4[_0x7d02('0x26')]][_0x7d02('0x34')]=_0x4e9be4[_0x7d02('0x34')];this[_0x7d02('0xe')][_0x4e9be4[_0x7d02('0x26')]][_0x7d02('0x35')]=_0x4e9be4[_0x7d02('0x35')];this[_0x7d02('0xe')][_0x4e9be4['uniqueid']]['filename']=_0x4e9be4[_0x7d02('0x31')];this['channels'][_0x4e9be4['uniqueid']][_0x7d02('0x36')]=_0x4e9be4[_0x7d02('0x36')];if(this[_0x7d02('0xe')][_0x4e9be4[_0x7d02('0x26')]][_0x7d02('0x37')]>0x0){tiff2pdf(_0x4e9be4[_0x7d02('0x31')],_0x7d02('0x38'),function(_0x55019b){logger[_0x7d02('0x29')](_0x4e9be4[_0x7d02('0x26')],'\x20result\x20conversion\x20file\x20',_0x55019b[_0x7d02('0x39')]);attachment['create']({'name':path['parse'](_0x4e9be4[_0x7d02('0x31')])[_0x7d02('0x28')],'basename':path[_0x7d02('0x3a')](_0x4e9be4[_0x7d02('0x31')])[_0x7d02('0x28')]+_0x7d02('0x3b'),'type':_0x7d02('0x3c')})['then'](function(_0x1e68f6){faxAccount[_0x7d02('0x3d')](_0x6f7a4c,{'from':_0x4e9be4[_0x7d02('0x36')],'mapKey':_0x7d02('0x6'),'body':path[_0x7d02('0x3a')](_0x4e9be4['filename'])['name']+_0x7d02('0x3b'),'AttachmentId':_0x1e68f6['id']})[_0x7d02('0x3e')](function(_0x326936){logger[_0x7d02('0x3f')](_0x4e9be4[_0x7d02('0x26')],'\x20notify\x20',JSON[_0x7d02('0x40')](_0x326936));});})['catch'](function(_0x1de432){logger[_0x7d02('0x3f')](_0x4e9be4[_0x7d02('0x26')],_0x7d02('0x41'),JSON[_0x7d02('0x40')](_0x1de432));});});}logger[_0x7d02('0x29')](_0x4e9be4[_0x7d02('0x26')],_0x7d02('0x41'));}};Fax[_0x7d02('0x1f')]['syncOriginateResponse']=function(_0x5283eb){if(this[_0x7d02('0x11')][_0x5283eb[_0x7d02('0x26')]]){_[_0x7d02('0x42')](this['channels'][_0x5283eb[_0x7d02('0x26')]],_[_0x7d02('0x43')](_0x5283eb,['response',_0x7d02('0x44')]));}};function updateStatus(_0x377ce0){if(_0x377ce0['AttachmentId']){faxMessage[_0x7d02('0x45')](_0x377ce0[_0x7d02('0x46')],{'failMessage':_0x7d02('0x47')})[_0x7d02('0x48')](function(_0x3bdf15){ut[_0x7d02('0x49')]('[Fax][Message][Error][Updated]',_0x3bdf15);})['catch'](function(_0x5ca4fb){ut[_0x7d02('0x49')]('[Fax][Message][Error][NoUpdate1]',_0x5ca4fb);});}else{ut[_0x7d02('0x49')](_0x7d02('0x4a'));}}Fax[_0x7d02('0x1f')][_0x7d02('0x4b')]=function(_0x7550a0,_0x3b0295,_0x57542f){var _0xc670e0=this;var _0x249619={};if(_0x3b0295){_0x249619={'read':_0x3b0295};}else{_0x249619={'failMessage':_0x57542f};}if(this[_0x7d02('0x11')][_0x7550a0]['AttachmentId']){faxMessage[_0x7d02('0x45')](this['actions'][_0x7550a0][_0x7d02('0x46')],_0x249619)['then'](function(_0x4bd773){ut[_0x7d02('0x49')](_0x7d02('0x4c'),_0x4bd773);})[_0x7d02('0x3e')](function(_0x587d14){ut[_0x7d02('0x49')]('[Fax][Message][NoUpdate1]',_0x587d14);})[_0x7d02('0x4d')](function(){delete _0xc670e0[_0x7d02('0xe')][_0x7550a0];delete _0xc670e0['actions'][_0x7550a0];});}else{ut[_0x7d02('0x49')](_0x7d02('0x4e'));delete this['channels'][_0x7550a0];delete this[_0x7d02('0x11')][_0x7550a0];}};Fax[_0x7d02('0x1f')][_0x7d02('0x1d')]=function(_0xe88aa6){var _0x5c7032=this;if(this['channels'][_0xe88aa6[_0x7d02('0x26')]]){if(this[_0x7d02('0x11')][_0xe88aa6[_0x7d02('0x26')]]){this[_0x7d02('0xe')][_0xe88aa6[_0x7d02('0x26')]]['id']=this['actions'][_0xe88aa6[_0x7d02('0x26')]]['id'];this[_0x7d02('0xe')][_0xe88aa6[_0x7d02('0x26')]][_0x7d02('0x28')]=this[_0x7d02('0x11')][_0xe88aa6[_0x7d02('0x26')]][_0x7d02('0x28')];}logger[_0x7d02('0x29')](_0xe88aa6[_0x7d02('0x26')],this['actions'][_0xe88aa6[_0x7d02('0x26')]]?'\x20hangup\x20sendFile\x20':_0x7d02('0x4f'),JSON['stringify'](this[_0x7d02('0xe')][_0xe88aa6['uniqueid']]));if(this[_0x7d02('0x11')][_0xe88aa6[_0x7d02('0x26')]]){if(this[_0x7d02('0xe')][_0xe88aa6[_0x7d02('0x26')]][_0x7d02('0x50')]>0x0&&this[_0x7d02('0xe')][_0xe88aa6[_0x7d02('0x26')]][_0x7d02('0x18')]==='SUCCESS'){this[_0x7d02('0x4b')](_0xe88aa6['uniqueid'],!![]);}else{this[_0x7d02('0x4b')](_0xe88aa6['uniqueid'],![],this[_0x7d02('0xe')][_0xe88aa6[_0x7d02('0x26')]][_0x7d02('0x51')]?'SENDING\x20FAILED:\x20'+this[_0x7d02('0xe')][_0xe88aa6[_0x7d02('0x26')]][_0x7d02('0x51')]:_0x7d02('0x52'));}}}};Fax[_0x7d02('0x1f')]['send']=function(_0x1247e0){var _0x567190=this;return new BPromise(function(_0x7931c9,_0x40d6a9){_0x567190['execOriginate'](_0x1247e0,_0x567190[_0x7d02('0xf')][_0x1247e0[_0x7d02('0x53')]])[_0x7d02('0x48')](function(_0x1780db){ut[_0x7d02('0x49')](_0x7d02('0x54'),_0x1780db);_0x7931c9(ut[_0x7d02('0x39')](_0x7d02('0x55')));})[_0x7d02('0x3e')](function(_0x23dbee){ut[_0x7d02('0x49')](_0x7d02('0x56'),_0x23dbee);updateStatus(_0x1247e0);_0x40d6a9(ut['message'](_0x7d02('0x57')));});});};Fax[_0x7d02('0x1f')][_0x7d02('0x58')]=function(_0x43910e){var _0x46eb75=this;return new BPromise(function(_0x58591d,_0x57cf51){var _0x8abcfc=_0x46eb75[_0x7d02('0x59')](_0x46eb75['faxAccounts'][_0x43910e[_0x7d02('0x53')]][_0x7d02('0x5a')],_0x43910e);if(_0x8abcfc[_0x7d02('0x5b')]){_0x58591d(ut[_0x7d02('0x39')](_0x7d02('0x5c')));}else{_0x57cf51(ut[_0x7d02('0x39')](_0x8abcfc[_0x7d02('0x39')]));}});};function originate(_0xdc1a5f,_0x211159,_0x1703a3){return new BPromise(function(_0x5651ca,_0x5e4b89){if(_0x1703a3){var _0x5b9364=util[_0x7d02('0x5d')](_0x7d02('0x5e'),path[_0x7d02('0x3a')](_0xdc1a5f['path'])[_0x7d02('0x28')],_0xdc1a5f['path']);gs[_0x7d02('0x5f')](_0x5b9364)[_0x7d02('0x48')](function(){_0xdc1a5f[_0x7d02('0x2')]=util[_0x7d02('0x5d')](_0x7d02('0x60'),path['parse'](_0xdc1a5f[_0x7d02('0x2')])[_0x7d02('0x61')],path['parse'](_0xdc1a5f[_0x7d02('0x2')])[_0x7d02('0x28')]);_0x211159[_0x7d02('0x62')]=_0xdc1a5f['path'];ut[_0x7d02('0x49')](_0x7d02('0x63'),'');ami[_0x7d02('0x64')](ut[_0x7d02('0x65')](_0xdc1a5f,_0x211159))[_0x7d02('0x48')](function(_0x319519){_0x5651ca(_0x319519);})['catch'](function(_0x13f85d){_0x5e4b89(_0x13f85d);});})[_0x7d02('0x3e')](function(_0xd174e0){_0x5e4b89(_0xd174e0);});}else{ami[_0x7d02('0x64')](ut[_0x7d02('0x65')](_0xdc1a5f,_0x211159))[_0x7d02('0x48')](function(_0x17e39b){_0x5651ca(_0x17e39b);})[_0x7d02('0x3e')](function(_0x4efa48){_0x5e4b89(_0x4efa48);});}});}Fax['prototype']['execOriginate']=function(_0x506f21,_0x325416){var _0x379c54=this;return new BPromise(function(_0x1ac245,_0x10b4d2){var _0x1278c9=uuid['v4']();var _0x5c3d00=ut[_0x7d02('0x66')](_0x506f21,_0x325416);_0x379c54[_0x7d02('0x11')][_0x1278c9]=new Action(_0x1278c9,_0x325416,_0x506f21);var _0x4dc9ad=_0x379c54[_0x7d02('0x11')][_0x1278c9];if(path[_0x7d02('0x3a')](_0x506f21[_0x7d02('0x2')])[_0x7d02('0x67')]==='.pdf'){originate(_0x4dc9ad,_0x5c3d00,!![])[_0x7d02('0x48')](function(_0x2c5727){_0x1ac245(_0x2c5727);})[_0x7d02('0x3e')](function(_0x37f6ca){_0x10b4d2(_0x37f6ca);});}else{originate(_0x4dc9ad,_0x5c3d00,![])[_0x7d02('0x48')](function(_0xe8d893){_0x1ac245(_0xe8d893);})[_0x7d02('0x3e')](function(_0xc9f017){_0x10b4d2(_0xc9f017);});}});};Fax['prototype'][_0x7d02('0x68')]=function(_0xde17f8){return!_[_0x7d02('0x69')](_0xde17f8)&&!_[_0x7d02('0x69')](_0xde17f8['name'])&&!_['isNil'](_0xde17f8[_0x7d02('0x6a')])&&_0xde17f8[_0x7d02('0x6a')]&&!_[_0x7d02('0x69')](this[_0x7d02('0x10')][util[_0x7d02('0x5d')](_0x7d02('0x6b'),_0xde17f8['name'])])&&!_[_0x7d02('0x69')](this[_0x7d02('0x10')][util[_0x7d02('0x5d')](_0x7d02('0x6b'),_0xde17f8[_0x7d02('0x28')])]['status'])&&(this[_0x7d02('0x10')][util[_0x7d02('0x5d')](_0x7d02('0x6b'),_0xde17f8[_0x7d02('0x28')])][_0x7d02('0x6c')]==='reachable'||this[_0x7d02('0x10')][util[_0x7d02('0x5d')](_0x7d02('0x6b'),_0xde17f8['name'])][_0x7d02('0x6c')]===_0x7d02('0x6d'));};Fax['prototype'][_0x7d02('0x59')]=function(_0x4e7698,_0xc9ab15){if(!this['isTrunkReachable'](_0x4e7698)){ut['logger'](_0x7d02('0x6e'),_[_0x7d02('0x69')](_0x4e7698)?'':_0x4e7698[_0x7d02('0x28')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x7d02('0x6f')};}if(_[_0x7d02('0x69')](_0xc9ab15['fax'])){ut[_0x7d02('0x49')](_0x7d02('0x70'),JSON[_0x7d02('0x40')](_0xc9ab15));return{'isValid':![],'message':_0x7d02('0x71')};}if(_[_0x7d02('0x69')](_0xc9ab15[_0x7d02('0x2')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x7d02('0x40')](_0xc9ab15));return{'isValid':![],'message':_0x7d02('0x72')};}return{'isValid':!![],'message':_0x7d02('0x73')};};module[_0x7d02('0x74')]=Fax; \ No newline at end of file +var _0xa4ce=['stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SENDING\x20FAILED:\x20','faxstatusstring','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error'];(function(_0x56e711,_0x5917c8){var _0x1cf38f=function(_0x145210){while(--_0x145210){_0x56e711['push'](_0x56e711['shift']());}};_0x1cf38f(++_0x5917c8);}(_0xa4ce,0x193));var _0xea4c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa4ce[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0xea4c('0x0'));var _=require(_0xea4c('0x1'));var BPromise=require(_0xea4c('0x2'));var uuid=require(_0xea4c('0x3'));var moment=require(_0xea4c('0x4'));var path=require(_0xea4c('0x5'));var tiff2pdf=require(_0xea4c('0x6'));var gs=require(_0xea4c('0x7'));var logger=require(_0xea4c('0x8'))(_0xea4c('0x9'));var ami=require('../ami');var rpcDb=require(_0xea4c('0xa'));var Channel=require('./channel');var ut=require(_0xea4c('0xb'));var Action=require(_0xea4c('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xea4c('0xd'));function Fax(_0x4276a7){this[_0xea4c('0xe')]={};this[_0xea4c('0xf')]=_0x4276a7[_0xea4c('0xf')];this[_0xea4c('0x10')]=_0x4276a7['trunks'];this[_0xea4c('0x11')]={};ami['on'](_0xea4c('0x12'),this[_0xea4c('0x13')][_0xea4c('0x14')](this));ami['on']('varset',this[_0xea4c('0x15')]['bind'](this));ami['on'](_0xea4c('0x16'),this[_0xea4c('0x17')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x18'),this[_0xea4c('0x19')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x1a'),this[_0xea4c('0x1b')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x1c'),this[_0xea4c('0x1d')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x1e'),this[_0xea4c('0x1f')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x20'),this[_0xea4c('0x21')][_0xea4c('0x14')](this));}Fax[_0xea4c('0x22')][_0xea4c('0x13')]=function(_0x55ff64){if(_0x55ff64[_0xea4c('0x23')]===_0xea4c('0x24')){for(var _0x422795 in this[_0xea4c('0xf')]){if(this[_0xea4c('0xf')]['hasOwnProperty'](_0x422795)){if(_0x55ff64[_0xea4c('0x25')]===this[_0xea4c('0xf')][_0x422795][_0xea4c('0x26')]){this[_0xea4c('0xe')][_0x55ff64[_0xea4c('0x27')]]={};this['channels'][_0x55ff64['uniqueid']][_0xea4c('0x28')]=_0x55ff64[_0xea4c('0x28')];this[_0xea4c('0xe')][_0x55ff64[_0xea4c('0x27')]]['id']=this[_0xea4c('0xf')][_0x422795]['id'];this['channels'][_0x55ff64['uniqueid']][_0xea4c('0x29')]=this[_0xea4c('0xf')][_0x422795][_0xea4c('0x29')];logger[_0xea4c('0x2a')](_0x55ff64[_0xea4c('0x27')],_0xea4c('0x2b'));}}}}if(this[_0xea4c('0x11')][_0x55ff64[_0xea4c('0x27')]]){this['channels'][_0x55ff64[_0xea4c('0x27')]]={};this[_0xea4c('0xe')][_0x55ff64[_0xea4c('0x27')]][_0xea4c('0x28')]=_0x55ff64['channel'];logger[_0xea4c('0x2a')](_0x55ff64['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xea4c('0x22')][_0xea4c('0x15')]=function(_0x5c71e7){if(this['channels'][_0x5c71e7[_0xea4c('0x27')]]){for(var _0x4241c3 in _0x5c71e7[_0xea4c('0x2c')]){if(_0x5c71e7[_0xea4c('0x2c')][_0xea4c('0x2d')](_0x4241c3)){this[_0xea4c('0xe')][_0x5c71e7[_0xea4c('0x27')]][_0x4241c3]=_0x5c71e7['value'];}}}};Fax[_0xea4c('0x22')][_0xea4c('0x17')]=function(_0x1c79ef){if(this[_0xea4c('0xe')][_0x1c79ef[_0xea4c('0x27')]]){this[_0xea4c('0xe')][_0x1c79ef[_0xea4c('0x27')]][_0xea4c('0x2e')]=_0x1c79ef[_0xea4c('0x2e')];this['channels'][_0x1c79ef['uniqueid']][_0xea4c('0x2f')]=_0x1c79ef[_0xea4c('0x2f')];}};Fax[_0xea4c('0x22')][_0xea4c('0x19')]=function(_0x30909c){if(this['channels'][_0x30909c[_0xea4c('0x27')]]){for(var _0xbe8909 in _0x30909c[_0xea4c('0x2c')]){if(_0x30909c['variable'][_0xea4c('0x2d')](_0xbe8909)){this['channels'][_0x30909c[_0xea4c('0x27')]][_0xbe8909]=_0x30909c['value'];}}}};Fax['prototype'][_0xea4c('0x1b')]=function(_0x186e8f){if(this[_0xea4c('0xe')][_0x186e8f['uniqueid']]){this[_0xea4c('0xe')][_0x186e8f[_0xea4c('0x27')]][_0xea4c('0x30')]=_0x186e8f['operation'];this[_0xea4c('0xe')][_0x186e8f[_0xea4c('0x27')]][_0xea4c('0x31')]=_0x186e8f[_0xea4c('0x31')];this[_0xea4c('0xe')][_0x186e8f[_0xea4c('0x27')]]['localstationid']=_0x186e8f[_0xea4c('0x26')];this[_0xea4c('0xe')][_0x186e8f[_0xea4c('0x27')]][_0xea4c('0x32')]=_0x186e8f[_0xea4c('0x32')];logger[_0xea4c('0x2a')](_0x186e8f[_0xea4c('0x27')],_0xea4c('0x33'));}};Fax[_0xea4c('0x22')][_0xea4c('0x1d')]=function(_0x5a800f){var _0x3b38b9=this;if(this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]]){var _0x7bd931=this[_0xea4c('0xe')][_0x5a800f['uniqueid']]['id'];this[_0xea4c('0xe')][_0x5a800f['uniqueid']][_0xea4c('0x34')]=_0x5a800f[_0xea4c('0x34')];this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]][_0xea4c('0x35')]=_0x5a800f[_0xea4c('0x35')];this[_0xea4c('0xe')][_0x5a800f['uniqueid']]['localstationid']=_0x5a800f[_0xea4c('0x26')];this[_0xea4c('0xe')][_0x5a800f['uniqueid']][_0xea4c('0x36')]=_0x5a800f['resolution'];this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]][_0xea4c('0x37')]=_0x5a800f[_0xea4c('0x37')];this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]]['filename']=_0x5a800f['filename'];this['channels'][_0x5a800f[_0xea4c('0x27')]]['calleridnum']=_0x5a800f[_0xea4c('0x38')];if(this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]][_0xea4c('0x35')]>0x0){tiff2pdf(_0x5a800f[_0xea4c('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x373d85){logger[_0xea4c('0x2a')](_0x5a800f[_0xea4c('0x27')],_0xea4c('0x39'),_0x373d85[_0xea4c('0x3a')]);attachment[_0xea4c('0x3b')]({'name':path[_0xea4c('0x3c')](_0x5a800f[_0xea4c('0x32')])[_0xea4c('0x29')],'basename':path[_0xea4c('0x3c')](_0x5a800f[_0xea4c('0x32')])[_0xea4c('0x29')]+_0xea4c('0x3d'),'type':'application/pdf'})['then'](function(_0x38788c){faxAccount[_0xea4c('0x3e')](_0x7bd931,{'from':_0x5a800f[_0xea4c('0x38')],'mapKey':_0xea4c('0x9'),'body':path[_0xea4c('0x3c')](_0x5a800f['filename'])[_0xea4c('0x29')]+_0xea4c('0x3d'),'AttachmentId':_0x38788c['id']})[_0xea4c('0x3f')](function(_0x59c142){logger[_0xea4c('0x40')](_0x5a800f[_0xea4c('0x27')],'\x20notify\x20',JSON[_0xea4c('0x41')](_0x59c142));});})[_0xea4c('0x3f')](function(_0x10ea51){logger[_0xea4c('0x40')](_0x5a800f[_0xea4c('0x27')],_0xea4c('0x42'),JSON[_0xea4c('0x41')](_0x10ea51));});});}logger[_0xea4c('0x2a')](_0x5a800f[_0xea4c('0x27')],_0xea4c('0x42'));}};Fax[_0xea4c('0x22')][_0xea4c('0x21')]=function(_0x4a2c60){if(this[_0xea4c('0x11')][_0x4a2c60[_0xea4c('0x27')]]){_[_0xea4c('0x43')](this[_0xea4c('0xe')][_0x4a2c60['uniqueid']],_[_0xea4c('0x44')](_0x4a2c60,[_0xea4c('0x45'),_0xea4c('0x46')]));}};function updateStatus(_0x42ed1f){if(_0x42ed1f[_0xea4c('0x47')]){faxMessage['update'](_0x42ed1f[_0xea4c('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xea4c('0x48')](function(_0x1cb39b){ut['logger']('[Fax][Message][Error][Updated]',_0x1cb39b);})['catch'](function(_0x52a4f5){ut[_0xea4c('0x49')](_0xea4c('0x4a'),_0x52a4f5);});}else{ut[_0xea4c('0x49')](_0xea4c('0x4b'));}}Fax[_0xea4c('0x22')][_0xea4c('0x4c')]=function(_0x19bfe8,_0xe0e822,_0x28a94a){var _0x3206f0=this;var _0x449357={};if(_0xe0e822){_0x449357={'read':_0xe0e822};}else{_0x449357={'failMessage':_0x28a94a};}if(this[_0xea4c('0x11')][_0x19bfe8]['AttachmentId']){faxMessage[_0xea4c('0x4d')](this[_0xea4c('0x11')][_0x19bfe8]['AttachmentId'],_0x449357)['then'](function(_0xc34c41){ut[_0xea4c('0x49')](_0xea4c('0x4e'),_0xc34c41);})['catch'](function(_0x48e5a1){ut[_0xea4c('0x49')](_0xea4c('0x4f'),_0x48e5a1);})[_0xea4c('0x50')](function(){delete _0x3206f0[_0xea4c('0xe')][_0x19bfe8];delete _0x3206f0['actions'][_0x19bfe8];});}else{ut[_0xea4c('0x49')](_0xea4c('0x51'));delete this[_0xea4c('0xe')][_0x19bfe8];delete this['actions'][_0x19bfe8];}};Fax[_0xea4c('0x22')][_0xea4c('0x1f')]=function(_0x59e97d){var _0x3b607=this;if(this['channels'][_0x59e97d[_0xea4c('0x27')]]){if(this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]]){this['channels'][_0x59e97d[_0xea4c('0x27')]]['id']=this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]]['id'];this[_0xea4c('0xe')][_0x59e97d[_0xea4c('0x27')]]['name']=this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]][_0xea4c('0x29')];}logger[_0xea4c('0x2a')](_0x59e97d[_0xea4c('0x27')],this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]]?_0xea4c('0x52'):_0xea4c('0x53'),JSON[_0xea4c('0x41')](this['channels'][_0x59e97d[_0xea4c('0x27')]]));if(this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]]){if(this[_0xea4c('0xe')][_0x59e97d[_0xea4c('0x27')]][_0xea4c('0x54')]>0x0&&this['channels'][_0x59e97d[_0xea4c('0x27')]]['faxstatus']==='SUCCESS'){this['updateStatus'](_0x59e97d[_0xea4c('0x27')],!![]);}else{this['updateStatus'](_0x59e97d[_0xea4c('0x27')],![],this['channels'][_0x59e97d[_0xea4c('0x27')]]['faxstatusstring']?_0xea4c('0x55')+this[_0xea4c('0xe')][_0x59e97d[_0xea4c('0x27')]][_0xea4c('0x56')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x2ba293){var _0x1bab8a=this;return new BPromise(function(_0x498696,_0x15ba03){_0x1bab8a[_0xea4c('0x57')](_0x2ba293,_0x1bab8a['faxAccounts'][_0x2ba293[_0xea4c('0x58')]])[_0xea4c('0x48')](function(_0x350ade){ut['logger'](_0xea4c('0x59'),_0x350ade);_0x498696(ut[_0xea4c('0x3a')]('Fax\x20received'));})[_0xea4c('0x3f')](function(_0x5958e9){ut[_0xea4c('0x49')](_0xea4c('0x5a'),_0x5958e9);updateStatus(_0x2ba293);_0x15ba03(ut[_0xea4c('0x3a')](_0xea4c('0x5b')));});});};Fax[_0xea4c('0x22')][_0xea4c('0x5c')]=function(_0x2976f3){var _0x47bbc5=this;return new BPromise(function(_0x1ada24,_0x5b23f5){var _0x5c14e0=_0x47bbc5['checkTrunk'](_0x47bbc5[_0xea4c('0xf')][_0x2976f3['FaxAccountId']][_0xea4c('0x5d')],_0x2976f3);if(_0x5c14e0['isValid']){_0x1ada24(ut[_0xea4c('0x3a')](_0xea4c('0x5e')));}else{_0x5b23f5(ut[_0xea4c('0x3a')](_0x5c14e0[_0xea4c('0x3a')]));}});};function originate(_0x495ed1,_0xca0eed,_0x2553c3){return new BPromise(function(_0x34c839,_0x31080d){if(_0x2553c3){var _0x4d39bb=util[_0xea4c('0x5f')](_0xea4c('0x60'),path[_0xea4c('0x3c')](_0x495ed1[_0xea4c('0x5')])[_0xea4c('0x29')],_0x495ed1[_0xea4c('0x5')]);gs[_0xea4c('0x61')](_0x4d39bb)['then'](function(){_0x495ed1[_0xea4c('0x5')]=util[_0xea4c('0x5f')]('%s/%s.tif',path[_0xea4c('0x3c')](_0x495ed1[_0xea4c('0x5')])[_0xea4c('0x62')],path[_0xea4c('0x3c')](_0x495ed1[_0xea4c('0x5')])[_0xea4c('0x29')]);_0xca0eed[_0xea4c('0x63')]=_0x495ed1[_0xea4c('0x5')];ut[_0xea4c('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xea4c('0x64')](ut['variablesAction'](_0x495ed1,_0xca0eed))[_0xea4c('0x48')](function(_0x5be7ca){_0x34c839(_0x5be7ca);})['catch'](function(_0x57bb57){_0x31080d(_0x57bb57);});})[_0xea4c('0x3f')](function(_0x9d987e){_0x31080d(_0x9d987e);});}else{ami[_0xea4c('0x64')](ut['variablesAction'](_0x495ed1,_0xca0eed))[_0xea4c('0x48')](function(_0x2ad5c7){_0x34c839(_0x2ad5c7);})[_0xea4c('0x3f')](function(_0x303ac1){_0x31080d(_0x303ac1);});}});}Fax[_0xea4c('0x22')][_0xea4c('0x57')]=function(_0x313884,_0x45625b){var _0x452f47=this;return new BPromise(function(_0x25f5bf,_0x5ee19f){var _0x1970f7=uuid['v4']();var _0xf5043b=ut[_0xea4c('0x65')](_0x313884,_0x45625b);_0x452f47[_0xea4c('0x11')][_0x1970f7]=new Action(_0x1970f7,_0x45625b,_0x313884);var _0x357033=_0x452f47['actions'][_0x1970f7];if(path[_0xea4c('0x3c')](_0x313884[_0xea4c('0x5')])[_0xea4c('0x66')]===_0xea4c('0x3d')){originate(_0x357033,_0xf5043b,!![])[_0xea4c('0x48')](function(_0x37298a){_0x25f5bf(_0x37298a);})[_0xea4c('0x3f')](function(_0x1968e9){_0x5ee19f(_0x1968e9);});}else{originate(_0x357033,_0xf5043b,![])[_0xea4c('0x48')](function(_0x4ae5c5){_0x25f5bf(_0x4ae5c5);})[_0xea4c('0x3f')](function(_0x3ceed5){_0x5ee19f(_0x3ceed5);});}});};Fax[_0xea4c('0x22')][_0xea4c('0x67')]=function(_0x5c5559){return!_[_0xea4c('0x68')](_0x5c5559)&&!_[_0xea4c('0x68')](_0x5c5559[_0xea4c('0x29')])&&!_[_0xea4c('0x68')](_0x5c5559[_0xea4c('0x69')])&&_0x5c5559['active']&&!_[_0xea4c('0x68')](this['trunks'][util[_0xea4c('0x5f')](_0xea4c('0x6a'),_0x5c5559['name'])])&&!_[_0xea4c('0x68')](this[_0xea4c('0x10')][util[_0xea4c('0x5f')]('SIP/%s',_0x5c5559[_0xea4c('0x29')])]['status'])&&(this[_0xea4c('0x10')][util[_0xea4c('0x5f')](_0xea4c('0x6a'),_0x5c5559[_0xea4c('0x29')])][_0xea4c('0x31')]===_0xea4c('0x6b')||this['trunks'][util['format'](_0xea4c('0x6a'),_0x5c5559['name'])][_0xea4c('0x31')]==='unmonitored');};Fax[_0xea4c('0x22')][_0xea4c('0x6c')]=function(_0x3c0c1b,_0x303701){if(!this['isTrunkReachable'](_0x3c0c1b)){ut[_0xea4c('0x49')](_0xea4c('0x6d'),_[_0xea4c('0x68')](_0x3c0c1b)?'':_0x3c0c1b['name']+_0xea4c('0x6e'));return{'isValid':![],'message':_0xea4c('0x6f')};}if(_[_0xea4c('0x68')](_0x303701[_0xea4c('0x9')])){ut[_0xea4c('0x49')](_0xea4c('0x70'),JSON['stringify'](_0x303701));return{'isValid':![],'message':_0xea4c('0x71')};}if(_['isNil'](_0x303701['path'])){ut['logger'](_0xea4c('0x72'),JSON[_0xea4c('0x41')](_0x303701));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xea4c('0x73')};};module[_0xea4c('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index bcede45..19dcb1d 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 _0xe62d=['inspect','then','notify','catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x2b7de4,_0x2dc3ad){var _0x58dc02=function(_0x2b3cfb){while(--_0x2b3cfb){_0x2b7de4['push'](_0x2b7de4['shift']());}};_0x58dc02(++_0x2dc3ad);}(_0xe62d,0xaa));var _0xde62=function(_0xe31502,_0x24688d){_0xe31502=_0xe31502-0x0;var _0x171c63=_0xe62d[_0xe31502];return _0x171c63;};'use strict';var util=require('util');var BPromise=require(_0xde62('0x0'));var logger=require(_0xde62('0x1'))(_0xde62('0x2'));var _=require(_0xde62('0x3'));var faxAccount=require(_0xde62('0x4'));function loggerCatch(_0x807262){return function(_0xf537a8){logger[_0xde62('0x5')](_0x807262,util[_0xde62('0x6')](_0xf537a8,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x56de8c,_0x544ac1){return BPromise['resolve']()[_0xde62('0x7')](faxAccount[_0xde62('0x8')](_0x56de8c,_0x544ac1))[_0xde62('0x9')](loggerCatch(_0xde62('0xa')));}; \ No newline at end of file +var _0x9477=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x9477,0x17b));var _0x7947=function(_0x7c99d,_0x1d55dd){_0x7c99d=_0x7c99d-0x0;var _0x3c02ce=_0x9477[_0x7c99d];return _0x3c02ce;};'use strict';var util=require(_0x7947('0x0'));var BPromise=require(_0x7947('0x1'));var logger=require(_0x7947('0x2'))(_0x7947('0x3'));var _=require(_0x7947('0x4'));var faxAccount=require(_0x7947('0x5'));function loggerCatch(_0x497c3a){return function(_0x55125e){logger[_0x7947('0x6')](_0x497c3a,util[_0x7947('0x7')](_0x55125e,{'showHidden':![],'depth':null}));};}exports[_0x7947('0x8')]=function(_0x38f378,_0x4ac176){return BPromise[_0x7947('0x9')]()[_0x7947('0xa')](faxAccount[_0x7947('0x8')](_0x38f378,_0x4ac176))[_0x7947('0xb')](loggerCatch(_0x7947('0xc')));}; \ 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 5eaf0f3..9d54e4b 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 _0xcd21=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xcd21,0x1c7));var _0x1cd2=function(_0x273f2b,_0x2d2e73){_0x273f2b=_0x273f2b-0x0;var _0xa29b80=_0xcd21[_0x273f2b];return _0xa29b80;};'use strict';var util=require(_0x1cd2('0x0'));var logger=require(_0x1cd2('0x1'))(_0x1cd2('0x2'));var BPromise=require(_0x1cd2('0x3'));var exec=require(_0x1cd2('0x4'))['exec'];exports[_0x1cd2('0x5')]=function(_0x1dbeb3){return new BPromise(function(_0x2d464f,_0x36ab78){exec(_0x1dbeb3,function(_0x485be6,_0x2215f0,_0x305b8c){logger[_0x1cd2('0x6')](_0x1cd2('0x7'),_0x2215f0);if(_0x485be6){logger[_0x1cd2('0x6')](_0x1cd2('0x7'),_0x1cd2('0x8'),util[_0x1cd2('0x9')](_0x485be6,{'showHidden':![],'depth':null}),_0x2215f0,_0x305b8c);_0x36ab78(_0x485be6);}_0x2d464f(_0x2215f0);});});}; \ No newline at end of file +var _0xaad8=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird'];(function(_0x5de58f,_0x438e81){var _0x18ec2f=function(_0x4450d3){while(--_0x4450d3){_0x5de58f['push'](_0x5de58f['shift']());}};_0x18ec2f(++_0x438e81);}(_0xaad8,0x115));var _0x8aad=function(_0x2cf58a,_0x2f6336){_0x2cf58a=_0x2cf58a-0x0;var _0x2f25e3=_0xaad8[_0x2cf58a];return _0x2f25e3;};'use strict';var util=require('util');var logger=require(_0x8aad('0x0'))(_0x8aad('0x1'));var BPromise=require(_0x8aad('0x2'));var exec=require(_0x8aad('0x3'))[_0x8aad('0x4')];exports[_0x8aad('0x5')]=function(_0x1a92c4){return new BPromise(function(_0x2fd1bc,_0x2125ee){exec(_0x1a92c4,function(_0x59c79c,_0x2ae5f2,_0x1ac1ac){logger[_0x8aad('0x6')](_0x8aad('0x7'),_0x2ae5f2);if(_0x59c79c){logger[_0x8aad('0x6')](_0x8aad('0x7'),_0x8aad('0x8'),util[_0x8aad('0x9')](_0x59c79c,{'showHidden':![],'depth':null}),_0x2ae5f2,_0x1ac1ac);_0x2125ee(_0x59c79c);}_0x2fd1bc(_0x2ae5f2);});});}; \ 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 6d434b0..cd8e401 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 _0x0236=['message','logger','info','inspect','ecm','headerinfo','maxrate','\x22%s\x22','modem','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax'];(function(_0x27351f,_0x2a8c87){var _0x31bbc0=function(_0x20b97b){while(--_0x20b97b){_0x27351f['push'](_0x27351f['shift']());}};_0x31bbc0(++_0x2a8c87);}(_0x0236,0xcb));var _0x6023=function(_0x3ef8a9,_0x59a7c2){_0x3ef8a9=_0x3ef8a9-0x0;var _0x424f63=_0x0236[_0x3ef8a9];return _0x424f63;};'use strict';var util=require(_0x6023('0x0'));var _=require(_0x6023('0x1'));var moment=require('moment');var logger=require(_0x6023('0x2'))(_0x6023('0x3'));exports[_0x6023('0x4')]=function(_0x2664a5){return{'message':_0x2664a5};};exports[_0x6023('0x5')]=function(_0x2fd981,_0x3e09a3){logger[_0x6023('0x6')](_0x2fd981,util[_0x6023('0x7')](_0x3e09a3,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2e0645,_0x3b005e){var _0x3194dd={'XMF-ECM':_0x3b005e[_0x6023('0x8')],'XMF-HEADERINFO':_0x3b005e[_0x6023('0x9')],'XMF-MINRATE':_0x3b005e['minrate'],'XMF-MAXRATE':_0x3b005e[_0x6023('0xa')],'XMF-MODEM':util['format'](_0x6023('0xb'),_0x3b005e[_0x6023('0xc')]),'XMF-GATEWAY':_0x3b005e['gateway'],'XMF-FAXDETECT':_0x3b005e['faxdetect'],'XMF-T38TIMEOUT':_0x3b005e[_0x6023('0xd')],'XMF-LOCALSTATIONID':_0x3b005e[_0x6023('0xe')],'XMF-PATH':_0x2e0645[_0x6023('0xf')]};return _0x3194dd;};exports[_0x6023('0x10')]=function(_0x1720fb,_0x3e15cf){return{'actionid':_0x1720fb[_0x6023('0x11')],'action':_0x6023('0x12'),'channel':_0x1720fb[_0x6023('0x13')],'Exten':_0x6023('0x14'),'Context':_0x6023('0x15'),'Priority':'1','callerid':util['format'](_0x6023('0x16'),_0x1720fb[_0x6023('0x9')]?_0x1720fb[_0x6023('0x9')]:'',_0x1720fb[_0x6023('0xe')]),'variable':_0x3e15cf,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1720fb['uniqueid']};}; \ No newline at end of file +var _0x48d0=['modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','uniqueid','util','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x4b0553,_0xa77d27){var _0x4826cc=function(_0x4c47ac){while(--_0x4c47ac){_0x4b0553['push'](_0x4b0553['shift']());}};_0x4826cc(++_0xa77d27);}(_0x48d0,0xd3));var _0x048d=function(_0x3b6f7d,_0x5e8c7a){_0x3b6f7d=_0x3b6f7d-0x0;var _0x125b88=_0x48d0[_0x3b6f7d];return _0x125b88;};'use strict';var util=require(_0x048d('0x0'));var _=require(_0x048d('0x1'));var moment=require('moment');var logger=require(_0x048d('0x2'))(_0x048d('0x3'));exports[_0x048d('0x4')]=function(_0x4ec740){return{'message':_0x4ec740};};exports[_0x048d('0x5')]=function(_0x1e9131,_0x57d051){logger[_0x048d('0x6')](_0x1e9131,util[_0x048d('0x7')](_0x57d051,{'showHidden':![],'depth':null}));};exports[_0x048d('0x8')]=function(_0x49c342,_0x16b9b6){var _0x339f60={'XMF-ECM':_0x16b9b6['ecm'],'XMF-HEADERINFO':_0x16b9b6[_0x048d('0x9')],'XMF-MINRATE':_0x16b9b6[_0x048d('0xa')],'XMF-MAXRATE':_0x16b9b6[_0x048d('0xb')],'XMF-MODEM':util[_0x048d('0xc')](_0x048d('0xd'),_0x16b9b6[_0x048d('0xe')]),'XMF-GATEWAY':_0x16b9b6[_0x048d('0xf')],'XMF-FAXDETECT':_0x16b9b6[_0x048d('0x10')],'XMF-T38TIMEOUT':_0x16b9b6[_0x048d('0x11')],'XMF-LOCALSTATIONID':_0x16b9b6[_0x048d('0x12')],'XMF-PATH':_0x49c342[_0x048d('0x13')]};return _0x339f60;};exports[_0x048d('0x14')]=function(_0x5bede6,_0x40243){return{'actionid':_0x5bede6['uniqueid'],'action':_0x048d('0x15'),'channel':_0x5bede6[_0x048d('0x16')],'Exten':_0x048d('0x17'),'Context':'from-sip','Priority':'1','callerid':util[_0x048d('0xc')]('\x22%s\x22\x20<%s>',_0x5bede6[_0x048d('0x9')]?_0x5bede6[_0x048d('0x9')]:'',_0x5bede6[_0x048d('0x12')]),'variable':_0x40243,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5bede6[_0x048d('0x18')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e3e3569..ec60a84 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 _0x8477=['./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','hour','get','resolve','then','getAgents','initAgents','initTelephones','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','./realtime','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue'];(function(_0x3d5eee,_0x4550a4){var _0xb7a22=function(_0x29131f){while(--_0x29131f){_0x3d5eee['push'](_0x3d5eee['shift']());}};_0xb7a22(++_0x4550a4);}(_0x8477,0x198));var _0x7847=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8477[_0x178e48];return _0x440d7e;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var server=require('./server');var Realtime=require(_0x7847('0x0'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x7847('0x1'));var Dialer=require(_0x7847('0x2'));var Preview=require('./preview');var Fax=require(_0x7847('0x3'));var user=require(_0x7847('0x4'));var voiceQueue=require(_0x7847('0x5'));var voiceQueueReport=require(_0x7847('0x6'));var voiceCallReport=require(_0x7847('0x7'));var trunk=require(_0x7847('0x8'));var trigger=require(_0x7847('0x9'));var template=require(_0x7847('0xa'));var cmHopperHistory=require(_0x7847('0xb'));var campaign=require(_0x7847('0xc'));var voiceExtension=require(_0x7847('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x7847('0xe'));var salesforce=require(_0x7847('0xf'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x7847('0x10'));var vtiger=require(_0x7847('0x11'));var freshsales=require(_0x7847('0x12'));var servicenow=require(_0x7847('0x13'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x7847('0x14'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x7847('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7847('0x16')](_0x7847('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7847('0x17')]()[_0x7847('0x18')](user[_0x7847('0x19')]())[_0x7847('0x18')](realtime[_0x7847('0x1a')]())['then'](user['getTelephones']())['then'](realtime[_0x7847('0x1b')]())[_0x7847('0x18')](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0x7847('0x18')](voiceQueue[_0x7847('0x1c')]())['then'](realtime[_0x7847('0x1d')]())[_0x7847('0x18')](trigger[_0x7847('0x1e')]())['then'](realtime[_0x7847('0x1f')]())['then'](template[_0x7847('0x20')]())[_0x7847('0x18')](realtime[_0x7847('0x21')]())[_0x7847('0x18')](zendesk[_0x7847('0x22')]())['then'](realtime[_0x7847('0x23')]())[_0x7847('0x18')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x7847('0x24')]())[_0x7847('0x18')](sugarcrm[_0x7847('0x25')]())[_0x7847('0x18')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x7847('0x26')]())[_0x7847('0x18')](realtime[_0x7847('0x27')]())[_0x7847('0x18')](desk[_0x7847('0x28')]())['then'](realtime[_0x7847('0x29')]())[_0x7847('0x18')](zoho[_0x7847('0x2a')]())[_0x7847('0x18')](realtime['initZohoAccounts']())['then'](vtiger[_0x7847('0x2b')]())[_0x7847('0x18')](realtime['initVtigerAccounts']())[_0x7847('0x18')](freshsales[_0x7847('0x2c')]())[_0x7847('0x18')](realtime[_0x7847('0x2d')]())[_0x7847('0x18')](servicenow[_0x7847('0x2e')]())[_0x7847('0x18')](realtime[_0x7847('0x2f')]())[_0x7847('0x18')](dynamics365[_0x7847('0x30')]())[_0x7847('0x18')](realtime[_0x7847('0x31')]())[_0x7847('0x18')](campaign[_0x7847('0x32')]())[_0x7847('0x18')](realtime[_0x7847('0x33')]())[_0x7847('0x18')](voiceExtension[_0x7847('0x34')]())[_0x7847('0x18')](realtime[_0x7847('0x35')]())['then'](faxAccount[_0x7847('0x36')]())[_0x7847('0x18')](realtime[_0x7847('0x37')]())[_0x7847('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x7847('0x17')]()[_0x7847('0x18')](voiceQueueReport[_0x7847('0x38')]())[_0x7847('0x18')](realtime[_0x7847('0x39')]())['then'](cmHopperHistory[_0x7847('0x3a')]())[_0x7847('0x18')](realtime[_0x7847('0x3b')]())[_0x7847('0x18')](cmHopperHistory[_0x7847('0x3c')]())[_0x7847('0x18')](realtime[_0x7847('0x3d')]())[_0x7847('0x18')](voiceCallReport[_0x7847('0x3e')]())['then'](realtime[_0x7847('0x3f')]())[_0x7847('0x40')](function(_0xbb34c1){logger[_0x7847('0x41')]('[index.js][initParams]',util[_0x7847('0x42')](_0xbb34c1,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7847('0x43')](realtime,preview,fax)[_0x7847('0x18')](function(_0x5f4db8){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x7847('0x44')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3f7e45){logger[_0x7847('0x41')]('[index.js][main]',util[_0x7847('0x42')](_0x3f7e45,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xe87d=['getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','bluebird','util','./server','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./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/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts'];(function(_0x542967,_0x277658){var _0x81f5f3=function(_0x43e55f){while(--_0x43e55f){_0x542967['push'](_0x542967['shift']());}};_0x81f5f3(++_0x277658);}(_0xe87d,0x12f));var _0xde87=function(_0x23c3f5,_0x1e0dba){_0x23c3f5=_0x23c3f5-0x0;var _0x50a8b3=_0xe87d[_0x23c3f5];return _0x50a8b3;};'use strict';var BPromise=require(_0xde87('0x0'));var util=require(_0xde87('0x1'));var moment=require('moment');var server=require(_0xde87('0x2'));var Realtime=require('./realtime');var Report=require(_0xde87('0x3'));var Acw=require(_0xde87('0x4'));var Trigger=require(_0xde87('0x5'));var Dialer=require(_0xde87('0x6'));var Preview=require('./preview');var Fax=require(_0xde87('0x7'));var user=require(_0xde87('0x8'));var voiceQueue=require(_0xde87('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xde87('0xa'));var trunk=require(_0xde87('0xb'));var trigger=require(_0xde87('0xc'));var template=require(_0xde87('0xd'));var cmHopperHistory=require(_0xde87('0xe'));var campaign=require(_0xde87('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xde87('0x10'));var zendesk=require(_0xde87('0x11'));var salesforce=require(_0xde87('0x12'));var sugarcrm=require(_0xde87('0x13'));var freshdesk=require(_0xde87('0x14'));var desk=require(_0xde87('0x15'));var zoho=require(_0xde87('0x16'));var vtiger=require(_0xde87('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xde87('0x18'));var dynamics365=require(_0xde87('0x19'));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(_0xde87('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xde87('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xde87('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xde87('0x1d')]()[_0xde87('0x1e')](user[_0xde87('0x1f')]())['then'](realtime[_0xde87('0x20')]())[_0xde87('0x1e')](user['getTelephones']())[_0xde87('0x1e')](realtime[_0xde87('0x21')]())[_0xde87('0x1e')](trunk[_0xde87('0x22')]())[_0xde87('0x1e')](realtime[_0xde87('0x23')]())[_0xde87('0x1e')](voiceQueue[_0xde87('0x24')]())[_0xde87('0x1e')](realtime['initVoiceQueues']())[_0xde87('0x1e')](trigger[_0xde87('0x25')]())['then'](realtime[_0xde87('0x26')]())[_0xde87('0x1e')](template[_0xde87('0x27')]())['then'](realtime['initTemplates']())[_0xde87('0x1e')](zendesk[_0xde87('0x28')]())['then'](realtime[_0xde87('0x29')]())['then'](salesforce[_0xde87('0x2a')]())[_0xde87('0x1e')](realtime['initSalesforceAccounts']())[_0xde87('0x1e')](sugarcrm[_0xde87('0x2b')]())[_0xde87('0x1e')](realtime[_0xde87('0x2c')]())[_0xde87('0x1e')](freshdesk['getFreshdeskAccounts']())[_0xde87('0x1e')](realtime[_0xde87('0x2d')]())[_0xde87('0x1e')](desk[_0xde87('0x2e')]())['then'](realtime['initDeskAccounts']())[_0xde87('0x1e')](zoho[_0xde87('0x2f')]())['then'](realtime['initZohoAccounts']())[_0xde87('0x1e')](vtiger[_0xde87('0x30')]())[_0xde87('0x1e')](realtime['initVtigerAccounts']())[_0xde87('0x1e')](freshsales['getFreshsalesAccounts']())[_0xde87('0x1e')](realtime[_0xde87('0x31')]())[_0xde87('0x1e')](servicenow[_0xde87('0x32')]())[_0xde87('0x1e')](realtime['initServicenowAccounts']())[_0xde87('0x1e')](dynamics365[_0xde87('0x33')]())[_0xde87('0x1e')](realtime[_0xde87('0x34')]())[_0xde87('0x1e')](campaign[_0xde87('0x35')]())[_0xde87('0x1e')](realtime[_0xde87('0x36')]())[_0xde87('0x1e')](voiceExtension['getVoiceExtensions']())[_0xde87('0x1e')](realtime[_0xde87('0x37')]())[_0xde87('0x1e')](faxAccount['getFaxAccounts']())[_0xde87('0x1e')](realtime[_0xde87('0x38')]())[_0xde87('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0xde87('0x1d')]()[_0xde87('0x1e')](voiceQueueReport[_0xde87('0x39')]())[_0xde87('0x1e')](realtime[_0xde87('0x3a')]())['then'](cmHopperHistory[_0xde87('0x3b')]())[_0xde87('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0xde87('0x1e')](cmHopperHistory[_0xde87('0x3c')]())[_0xde87('0x1e')](realtime['initCampaignHopperHistory']())[_0xde87('0x1e')](voiceCallReport[_0xde87('0x3d')]())[_0xde87('0x1e')](realtime[_0xde87('0x3e')]())[_0xde87('0x3f')](function(_0x383774){logger[_0xde87('0x40')](_0xde87('0x41'),util[_0xde87('0x42')](_0x383774,{'showHidden':![],'depth':null}));});}function main(){return server[_0xde87('0x43')](realtime,preview,fax)['then'](function(_0x3200b6){return initRealtime();})[_0xde87('0x1e')](function(){return initParams();})[_0xde87('0x1e')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xde87('0x3f')](function(_0x576cab){logger[_0xde87('0x40')](_0xde87('0x44'),util[_0xde87('0x42')](_0x576cab,{'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 c7cb862..ada57ee 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0xd7629e,_0x5a3eb3){var _0x4762ea=function(_0x479147){while(--_0x479147){_0xd7629e['push'](_0xd7629e['shift']());}};_0x4762ea(++_0x5a3eb3);}(_0xe706,0xa3));var _0x6e70=function(_0x4c5a24,_0x5ef60c){_0x4c5a24=_0x4c5a24-0x0;var _0x4b067e=_0xe706[_0x4c5a24];return _0x4b067e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x23dc1a,_0x87949d){var _0x5a8c07=function(_0x5471ae){while(--_0x5471ae){_0x23dc1a['push'](_0x23dc1a['shift']());}};_0x5a8c07(++_0x87949d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xcb91[_0x422be2];return _0x1b820e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 4753cbf..ec06768 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 _0x1e79=['Trunk','SquareProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','TrunkBackup'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1e79,0xce));var _0x91e7=function(_0x5c6f53,_0x5f08f6){_0x5c6f53=_0x5c6f53-0x0;var _0x4b9fff=_0x1e79[_0x5c6f53];return _0x4b9fff;};'use strict';function Campaign(_0x145e23){this['id']=_0x145e23['id']||0x0;this['name']=_0x145e23['name']||'';this['type']=_0x145e23[_0x91e7('0x0')]||_0x91e7('0x1');this[_0x91e7('0x2')]=0x0;this[_0x91e7('0x3')]=0x0;this[_0x91e7('0x4')]=0x0;this[_0x91e7('0x5')]=0x0;this[_0x91e7('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x91e7('0x7')]=_0x145e23[_0x91e7('0x7')];this[_0x91e7('0x8')]=_0x145e23['limitCalls'];this[_0x91e7('0x9')]=_0x145e23[_0x91e7('0x9')]||null;this['dialGlobalInterval']=_0x145e23[_0x91e7('0xa')]?_0x145e23['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x145e23[_0x91e7('0xb')];this[_0x91e7('0xc')]=_0x145e23[_0x91e7('0xc')];this[_0x91e7('0xd')]=_0x145e23[_0x91e7('0xd')]||0x1e;this[_0x91e7('0xe')]=_0x145e23[_0x91e7('0xe')];this[_0x91e7('0xf')]=_0x145e23['dialCongestionRetryFrequency'];this[_0x91e7('0x10')]=_0x145e23[_0x91e7('0x10')];this[_0x91e7('0x11')]=_0x145e23['dialBusyRetryFrequency'];this[_0x91e7('0x12')]=_0x145e23[_0x91e7('0x12')];this[_0x91e7('0x13')]=_0x145e23['dialNoAnswerRetryFrequency'];this[_0x91e7('0x14')]=_0x145e23[_0x91e7('0x14')];this[_0x91e7('0x15')]=_0x145e23['dialNoSuchNumberMaxRetry']||0x3;this[_0x91e7('0x16')]=_0x145e23[_0x91e7('0x16')]||0x96;this['dialDropMaxRetry']=_0x145e23['dialDropMaxRetry']||0x3;this[_0x91e7('0x17')]=_0x145e23['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x145e23[_0x91e7('0x18')]||0x3;this[_0x91e7('0x19')]=_0x145e23[_0x91e7('0x19')]||0x96;this['dialMachineMaxRetry']=_0x145e23[_0x91e7('0x1a')]||0x3;this[_0x91e7('0x1b')]=_0x145e23[_0x91e7('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x145e23[_0x91e7('0x1c')]||0x3;this[_0x91e7('0x1d')]=_0x145e23[_0x91e7('0x1d')]||0x96;this[_0x91e7('0x1e')]=_0x145e23[_0x91e7('0x1e')]||_0x91e7('0x1f');this['dialPrefix']=_0x145e23['dialPrefix']||undefined;this[_0x91e7('0x20')]=_0x145e23['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x145e23['dialCutDigit']||undefined;this[_0x91e7('0x21')]=_0x145e23[_0x91e7('0x21')]?_0x145e23['TrunkBackup']:undefined;this[_0x91e7('0x22')]=_0x145e23[_0x91e7('0x22')]?_0x145e23[_0x91e7('0x22')]:undefined;this['Interval']=_0x145e23['Interval']?_0x145e23['Interval']:undefined;this[_0x91e7('0x23')]=_0x145e23[_0x91e7('0x23')]?_0x145e23['SquareProject']:undefined;this['dialQueueProject']=_0x145e23[_0x91e7('0x23')]?_0x145e23[_0x91e7('0x23')][_0x91e7('0x24')]:undefined;this[_0x91e7('0x25')]=_0x145e23[_0x91e7('0x25')]||![];this[_0x91e7('0x26')]=_0x145e23[_0x91e7('0x26')];this[_0x91e7('0x27')]=_0x145e23[_0x91e7('0x27')];this[_0x91e7('0x28')]=_0x145e23[_0x91e7('0x28')];this[_0x91e7('0x29')]=_0x145e23[_0x91e7('0x29')];this[_0x91e7('0x2a')]=_0x145e23[_0x91e7('0x2a')];this[_0x91e7('0x2b')]=_0x145e23[_0x91e7('0x2b')];this[_0x91e7('0x2c')]=_0x145e23['dialAMDMaximumNumberOfWords'];this[_0x91e7('0x2d')]=_0x145e23['dialAMDSilenceThreshold'];this[_0x91e7('0x2e')]=_0x145e23['dialAMDMaximumWordLength'];}module[_0x91e7('0x2f')]=Campaign; \ No newline at end of file +var _0x195f=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting'];(function(_0x103aa0,_0x4b2079){var _0x128855=function(_0x26d234){while(--_0x26d234){_0x103aa0['push'](_0x103aa0['shift']());}};_0x128855(++_0x4b2079);}(_0x195f,0xed));var _0xf195=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0x195f[_0x4ec13d];return _0x3c3fa7;};'use strict';function Campaign(_0x480638){this['id']=_0x480638['id']||0x0;this[_0xf195('0x0')]=_0x480638['name']||'';this[_0xf195('0x1')]=_0x480638[_0xf195('0x1')]||_0xf195('0x2');this[_0xf195('0x3')]=0x0;this[_0xf195('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xf195('0x5')]=0x0;this[_0xf195('0x6')]='';this[_0xf195('0x7')]=!![];this[_0xf195('0x8')]=_0x480638[_0xf195('0x8')];this['limitCalls']=_0x480638['limitCalls'];this[_0xf195('0x9')]=_0x480638['dialTimezone']||null;this[_0xf195('0xa')]=_0x480638[_0xf195('0xa')]?_0x480638[_0xf195('0xa')]:null;this['dialOriginateCallerIdName']=_0x480638[_0xf195('0xb')];this[_0xf195('0xc')]=_0x480638[_0xf195('0xc')];this[_0xf195('0xd')]=_0x480638[_0xf195('0xd')]||0x1e;this[_0xf195('0xe')]=_0x480638[_0xf195('0xe')];this['dialCongestionRetryFrequency']=_0x480638[_0xf195('0xf')];this[_0xf195('0x10')]=_0x480638[_0xf195('0x10')];this['dialBusyRetryFrequency']=_0x480638['dialBusyRetryFrequency'];this[_0xf195('0x11')]=_0x480638[_0xf195('0x11')];this['dialNoAnswerRetryFrequency']=_0x480638[_0xf195('0x12')];this[_0xf195('0x13')]=_0x480638[_0xf195('0x13')];this[_0xf195('0x14')]=_0x480638[_0xf195('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x480638['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x480638[_0xf195('0x15')]||0x3;this[_0xf195('0x16')]=_0x480638[_0xf195('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x480638['dialAbandonedMaxRetry']||0x3;this[_0xf195('0x17')]=_0x480638['dialAbandonedRetryFrequency']||0x96;this[_0xf195('0x18')]=_0x480638[_0xf195('0x18')]||0x3;this[_0xf195('0x19')]=_0x480638[_0xf195('0x19')]||0x96;this[_0xf195('0x1a')]=_0x480638['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x480638['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x480638[_0xf195('0x1b')]||_0xf195('0x1c');this[_0xf195('0x1d')]=_0x480638[_0xf195('0x1d')]||undefined;this[_0xf195('0x1e')]=_0x480638[_0xf195('0x1e')]||undefined;this[_0xf195('0x1f')]=_0x480638[_0xf195('0x1f')]||undefined;this[_0xf195('0x20')]=_0x480638[_0xf195('0x20')]?_0x480638[_0xf195('0x20')]:undefined;this['Trunk']=_0x480638[_0xf195('0x21')]?_0x480638['Trunk']:undefined;this[_0xf195('0x22')]=_0x480638['Interval']?_0x480638[_0xf195('0x22')]:undefined;this[_0xf195('0x23')]=_0x480638[_0xf195('0x23')]?_0x480638[_0xf195('0x23')]:undefined;this[_0xf195('0x24')]=_0x480638['SquareProject']?_0x480638[_0xf195('0x23')][_0xf195('0x0')]:undefined;this['dialAMDActive']=_0x480638[_0xf195('0x25')]||![];this['dialAMDInitialSilence']=_0x480638['dialAMDInitialSilence'];this[_0xf195('0x26')]=_0x480638[_0xf195('0x26')];this['dialAMDAfterGreetingSilence']=_0x480638['dialAMDAfterGreetingSilence'];this[_0xf195('0x27')]=_0x480638[_0xf195('0x27')];this[_0xf195('0x28')]=_0x480638['dialAMDMinWordLength'];this[_0xf195('0x29')]=_0x480638['dialAMDBetweenWordsSilence'];this[_0xf195('0x2a')]=_0x480638[_0xf195('0x2a')];this[_0xf195('0x2b')]=_0x480638['dialAMDSilenceThreshold'];this[_0xf195('0x2c')]=_0x480638[_0xf195('0x2c')];}module[_0xf195('0x2d')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6d2395c..81943e1 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 _0x1f20=['holdtime','type','tag','monitor','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel','calleridnum','connectedlinenum','connectedlinename','context','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds'];(function(_0x4b851f,_0x2487fe){var _0x4519d1=function(_0x2fa676){while(--_0x2fa676){_0x4b851f['push'](_0x4b851f['shift']());}};_0x4519d1(++_0x2487fe);}(_0x1f20,0x11c));var _0x01f2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1f20[_0x3ab51d];return _0x29a04e;};'use strict';function Channel(){this[_0x01f2('0x0')]=null;this[_0x01f2('0x1')]='';this['destinationchannel']='';this[_0x01f2('0x2')]=0x0;this['calleridname']='';this[_0x01f2('0x3')]=undefined;this[_0x01f2('0x4')]=undefined;this['accountcode']=0x0;this[_0x01f2('0x5')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x01f2('0x6')]=0x0;this[_0x01f2('0x7')]=![];this[_0x01f2('0x8')]=null;this[_0x01f2('0x9')]=null;this[_0x01f2('0xa')]=![];this[_0x01f2('0xb')]=![];this[_0x01f2('0xc')]='';this[_0x01f2('0xd')]='';this[_0x01f2('0xe')]=0x0;this[_0x01f2('0xf')]=0x0;this[_0x01f2('0x10')]=0x0;this[_0x01f2('0x11')]=null;this[_0x01f2('0x12')]=null;this['disposition']=null;this[_0x01f2('0x13')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x01f2('0x14')]=[];this[_0x01f2('0x15')]=undefined;this[_0x01f2('0x16')]=undefined;this[_0x01f2('0x17')]=undefined;this['mohtime']=0x0;}module[_0x01f2('0x18')]=Channel; \ No newline at end of file +var _0x3c32=['endtime','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','linkedid','exten','answered','answertime'];(function(_0x4d4475,_0x71afc){var _0x4016bb=function(_0x17aae6){while(--_0x17aae6){_0x4d4475['push'](_0x4d4475['shift']());}};_0x4016bb(++_0x71afc);}(_0x3c32,0x161));var _0x23c3=function(_0x362d70,_0x300dba){_0x362d70=_0x362d70-0x0;var _0x2a5f8d=_0x3c32[_0x362d70];return _0x2a5f8d;};'use strict';function Channel(){this[_0x23c3('0x0')]=null;this[_0x23c3('0x1')]='';this[_0x23c3('0x2')]='';this['calleridnum']=0x0;this[_0x23c3('0x3')]='';this[_0x23c3('0x4')]=undefined;this[_0x23c3('0x5')]=undefined;this['accountcode']=0x0;this[_0x23c3('0x6')]='';this['uniqueid']=0x0;this[_0x23c3('0x7')]=0x0;this[_0x23c3('0x8')]=0x0;this[_0x23c3('0x9')]=![];this[_0x23c3('0xa')]=null;this[_0x23c3('0xb')]=null;this['unmanaged']=![];this['abandoned']=![];this['lastapplication']='';this[_0x23c3('0xc')]='';this[_0x23c3('0xd')]=0x0;this[_0x23c3('0xe')]=0x0;this[_0x23c3('0xf')]=0x0;this[_0x23c3('0x10')]=null;this[_0x23c3('0x11')]=null;this[_0x23c3('0x12')]=null;this[_0x23c3('0x13')]=![];this[_0x23c3('0x14')]=null;this[_0x23c3('0x15')]=null;this[_0x23c3('0x16')]=[];this[_0x23c3('0x17')]=undefined;this[_0x23c3('0x18')]=undefined;this[_0x23c3('0x19')]=undefined;this[_0x23c3('0x1a')]=0x0;}module[_0x23c3('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ba558b3..096ee99 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 _0x300f=['consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username','remoteUri','authType','consumerKey'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0x300f,0x103));var _0xf300=function(_0x2740af,_0x58af9d){_0x2740af=_0x2740af-0x0;var _0x58c9ce=_0x300f[_0x2740af];return _0x58c9ce;};'use strict';function DeskAccount(_0x1c7816){this['id']=_0x1c7816['id']||0x0;this[_0xf300('0x0')]=_0x1c7816[_0xf300('0x0')]||'';this[_0xf300('0x1')]=_0x1c7816[_0xf300('0x1')]||'';this['remoteUri']=_0x1c7816[_0xf300('0x2')]||'';this['authType']=_0x1c7816[_0xf300('0x3')]||'';this['password']=_0x1c7816['password']||'';this[_0xf300('0x4')]=_0x1c7816[_0xf300('0x4')]||'';this[_0xf300('0x5')]=_0x1c7816[_0xf300('0x5')]||'';this[_0xf300('0x6')]=_0x1c7816['token']||'';this[_0xf300('0x7')]=_0x1c7816[_0xf300('0x7')]||'';this['type']=_0x1c7816['type']||'';this[_0xf300('0x8')]=_0x1c7816[_0xf300('0x8')]||'';this[_0xf300('0x9')]=_0x1c7816[_0xf300('0x9')]||{};}module[_0xf300('0xa')]=DeskAccount; \ No newline at end of file +var _0x789d=['token','tokenSecret','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerSecret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x789d,0x17b));var _0xd789=function(_0x96383e,_0x35b28f){_0x96383e=_0x96383e-0x0;var _0x419e14=_0x789d[_0x96383e];return _0x419e14;};'use strict';function DeskAccount(_0x4cca0e){this['id']=_0x4cca0e['id']||0x0;this[_0xd789('0x0')]=_0x4cca0e[_0xd789('0x0')]||'';this[_0xd789('0x1')]=_0x4cca0e[_0xd789('0x1')]||'';this[_0xd789('0x2')]=_0x4cca0e[_0xd789('0x2')]||'';this[_0xd789('0x3')]=_0x4cca0e[_0xd789('0x3')]||'';this[_0xd789('0x4')]=_0x4cca0e['password']||'';this['consumerKey']=_0x4cca0e['consumerKey']||'';this[_0xd789('0x5')]=_0x4cca0e[_0xd789('0x5')]||'';this[_0xd789('0x6')]=_0x4cca0e[_0xd789('0x6')]||'';this[_0xd789('0x7')]=_0x4cca0e[_0xd789('0x7')]||'';this['type']=_0x4cca0e['type']||'';this[_0xd789('0x8')]=_0x4cca0e['serverUrl']||'';this[_0xd789('0x9')]=_0x4cca0e[_0xd789('0x9')]||{};}module[_0xd789('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 41cd26b..cba90b6 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 _0xa15a=['clientSecret','serverUrl','modernAuthentication','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x1d49f3,_0x40c152){var _0x583d8b=function(_0x1c8e4c){while(--_0x1c8e4c){_0x1d49f3['push'](_0x1d49f3['shift']());}};_0x583d8b(++_0x40c152);}(_0xa15a,0x123));var _0xaa15=function(_0x540990,_0x31445d){_0x540990=_0x540990-0x0;var _0x12fb9f=_0xa15a[_0x540990];return _0x12fb9f;};'use strict';function Dynamics365Account(_0x4aa3d9){this['id']=_0x4aa3d9['id']||0x0;this[_0xaa15('0x0')]=_0x4aa3d9[_0xaa15('0x0')]||'';this[_0xaa15('0x1')]=_0x4aa3d9[_0xaa15('0x1')]||'';this[_0xaa15('0x2')]=_0x4aa3d9['password']||'';this[_0xaa15('0x3')]=_0x4aa3d9[_0xaa15('0x3')]||'';this[_0xaa15('0x4')]=_0x4aa3d9['tenantId']||'';this[_0xaa15('0x5')]=_0x4aa3d9[_0xaa15('0x5')]||'';this['clientSecret']=_0x4aa3d9[_0xaa15('0x6')]||{};this[_0xaa15('0x7')]=_0x4aa3d9['serverUrl']||'';this[_0xaa15('0x8')]=_0x4aa3d9[_0xaa15('0x8')]||![];this['Configurations']=_0x4aa3d9['Configurations']||{};this['CloudProvider']=_0x4aa3d9[_0xaa15('0x9')]||{};}module[_0xaa15('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x8bd8=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','name','username','password'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x8bd8,0x89));var _0x88bd=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8bd8[_0x2d7f0e];return _0x110b07;};'use strict';function Dynamics365Account(_0x2a25e7){this['id']=_0x2a25e7['id']||0x0;this[_0x88bd('0x0')]=_0x2a25e7[_0x88bd('0x0')]||'';this[_0x88bd('0x1')]=_0x2a25e7['username']||'';this[_0x88bd('0x2')]=_0x2a25e7['password']||'';this[_0x88bd('0x3')]=_0x2a25e7[_0x88bd('0x3')]||'';this[_0x88bd('0x4')]=_0x2a25e7[_0x88bd('0x4')]||'';this[_0x88bd('0x5')]=_0x2a25e7[_0x88bd('0x5')]||'';this[_0x88bd('0x6')]=_0x2a25e7['clientSecret']||{};this[_0x88bd('0x7')]=_0x2a25e7['serverUrl']||'';this['modernAuthentication']=_0x2a25e7[_0x88bd('0x8')]||![];this[_0x88bd('0x9')]=_0x2a25e7[_0x88bd('0x9')]||{};this['CloudProvider']=_0x2a25e7['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 1f45689..790a57f 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 _0xb391=['tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x1f03ad,_0xf4a230){var _0x1db925=function(_0x256e8a){while(--_0x256e8a){_0x1f03ad['push'](_0x1f03ad['shift']());}};_0x1db925(++_0xf4a230);}(_0xb391,0x137));var _0x1b39=function(_0x416d60,_0x56dde9){_0x416d60=_0x416d60-0x0;var _0x286bd7=_0xb391[_0x416d60];return _0x286bd7;};'use strict';function FaxAccount(_0x3672d6){this['id']=_0x3672d6['id']||0x0;this[_0x1b39('0x0')]=_0x3672d6['name']||'';this[_0x1b39('0x1')]=_0x3672d6[_0x1b39('0x1')];this[_0x1b39('0x2')]=_0x3672d6['ecm'];this[_0x1b39('0x3')]=_0x3672d6[_0x1b39('0x3')];this[_0x1b39('0x4')]=_0x3672d6[_0x1b39('0x4')];this[_0x1b39('0x5')]=_0x3672d6[_0x1b39('0x5')]||0x960;this[_0x1b39('0x6')]=_0x3672d6['maxrate']||0x3840;this[_0x1b39('0x7')]=_0x3672d6[_0x1b39('0x7')]||_0x1b39('0x8');this[_0x1b39('0x9')]=_0x3672d6[_0x1b39('0x9')]||'no';this['faxdetect']=_0x3672d6[_0x1b39('0xa')]||'no';this[_0x1b39('0xb')]=_0x3672d6[_0x1b39('0xb')]||0x1388;this['tech']=_0x3672d6[_0x1b39('0xc')]||'SIP';this[_0x1b39('0xd')]=_0x3672d6[_0x1b39('0xd')]?_0x3672d6[_0x1b39('0xd')]:undefined;this[_0x1b39('0xe')]=_0x3672d6['ListId'];this[_0x1b39('0xf')]=_0x3672d6[_0x1b39('0xf')];}module[_0x1b39('0x10')]=FaxAccount; \ No newline at end of file +var _0xd382=['faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway'];(function(_0x3c2efd,_0x405f28){var _0x433b01=function(_0xd9f231){while(--_0xd9f231){_0x3c2efd['push'](_0x3c2efd['shift']());}};_0x433b01(++_0x405f28);}(_0xd382,0xc7));var _0x2d38=function(_0x4f655a,_0x1a21a9){_0x4f655a=_0x4f655a-0x0;var _0x15da36=_0xd382[_0x4f655a];return _0x15da36;};'use strict';function FaxAccount(_0x3dc47f){this['id']=_0x3dc47f['id']||0x0;this[_0x2d38('0x0')]=_0x3dc47f['name']||'';this[_0x2d38('0x1')]=_0x3dc47f['description'];this[_0x2d38('0x2')]=_0x3dc47f['ecm'];this['headerinfo']=_0x3dc47f[_0x2d38('0x3')];this[_0x2d38('0x4')]=_0x3dc47f[_0x2d38('0x4')];this['minrate']=_0x3dc47f[_0x2d38('0x5')]||0x960;this['maxrate']=_0x3dc47f[_0x2d38('0x6')]||0x3840;this['modem']=_0x3dc47f['modem']||_0x2d38('0x7');this[_0x2d38('0x8')]=_0x3dc47f[_0x2d38('0x8')]||'no';this[_0x2d38('0x9')]=_0x3dc47f[_0x2d38('0x9')]||'no';this['t38timeout']=_0x3dc47f['t38timeout']||0x1388;this[_0x2d38('0xa')]=_0x3dc47f[_0x2d38('0xa')]||_0x2d38('0xb');this[_0x2d38('0xc')]=_0x3dc47f[_0x2d38('0xc')]?_0x3dc47f[_0x2d38('0xc')]:undefined;this[_0x2d38('0xd')]=_0x3dc47f['ListId'];this['key']=_0x3dc47f[_0x2d38('0xe')];}module[_0x2d38('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index aa8ce1e..30204eb 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 _0xa18c=['Configurations','name','username','apiKey','token','serverUrl'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xa18c,0x1d5));var _0xca18=function(_0x106f84,_0x4ffb33){_0x106f84=_0x106f84-0x0;var _0x4e0238=_0xa18c[_0x106f84];return _0x4e0238;};'use strict';function FreshdeskAccount(_0x3b393f){this['id']=_0x3b393f['id']||0x0;this[_0xca18('0x0')]=_0x3b393f['name']||'';this[_0xca18('0x1')]=_0x3b393f[_0xca18('0x1')]||'';this[_0xca18('0x2')]=_0x3b393f[_0xca18('0x3')]||'';this['remoteUri']=_0x3b393f['remoteUri']||'';this['serverUrl']=_0x3b393f[_0xca18('0x4')]||'';this[_0xca18('0x5')]=_0x3b393f['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xd3ed=['exports','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x4f187d,_0x4f3568){var _0x35063f=function(_0x20dc78){while(--_0x20dc78){_0x4f187d['push'](_0x4f187d['shift']());}};_0x35063f(++_0x4f3568);}(_0xd3ed,0xf7));var _0xdd3e=function(_0x3978d3,_0x5b9984){_0x3978d3=_0x3978d3-0x0;var _0x2f1dfa=_0xd3ed[_0x3978d3];return _0x2f1dfa;};'use strict';function FreshdeskAccount(_0x33daab){this['id']=_0x33daab['id']||0x0;this['name']=_0x33daab['name']||'';this['username']=_0x33daab[_0xdd3e('0x0')]||'';this[_0xdd3e('0x1')]=_0x33daab['token']||'';this[_0xdd3e('0x2')]=_0x33daab['remoteUri']||'';this['serverUrl']=_0x33daab[_0xdd3e('0x3')]||'';this[_0xdd3e('0x4')]=_0x33daab[_0xdd3e('0x4')]||{};}module[_0xdd3e('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f26ad5d..39368d1 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 _0xbea5=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xbea5,0x177));var _0x5bea=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xbea5[_0x37c22c];return _0x119d79;};'use strict';function FreshsalesAccount(_0x518a55){this['id']=_0x518a55['id']||0x0;this[_0x5bea('0x0')]=_0x518a55['name']||'';this[_0x5bea('0x1')]=_0x518a55[_0x5bea('0x1')]||'';this[_0x5bea('0x2')]=_0x518a55[_0x5bea('0x3')]||'';this[_0x5bea('0x4')]=_0x518a55['remoteUri']||'';this['serverUrl']=_0x518a55[_0x5bea('0x5')]||'';this['Configurations']=_0x518a55[_0x5bea('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xf3cc=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x34eabc,_0x51d411){_0x34eabc=_0x34eabc-0x0;var _0x43e72f=_0xf3cc[_0x34eabc];return _0x43e72f;};'use strict';function FreshsalesAccount(_0x48162b){this['id']=_0x48162b['id']||0x0;this[_0xcf3c('0x0')]=_0x48162b[_0xcf3c('0x0')]||'';this[_0xcf3c('0x1')]=_0x48162b['username']||'';this[_0xcf3c('0x2')]=_0x48162b[_0xcf3c('0x3')]||'';this[_0xcf3c('0x4')]=_0x48162b['remoteUri']||'';this[_0xcf3c('0x5')]=_0x48162b[_0xcf3c('0x5')]||'';this['Configurations']=_0x48162b[_0xcf3c('0x6')]||{};}module[_0xcf3c('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 ae7792a..9402c4a 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 _0xab71=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete'];(function(_0x550839,_0xf664c){var _0x145c26=function(_0x254fc8){while(--_0x254fc8){_0x550839['push'](_0x550839['shift']());}};_0x145c26(++_0xf664c);}(_0xab71,0x163));var _0x1ab7=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0xab71[_0x132558];return _0x34f138;};'use strict';function QueueReport(){this[_0x1ab7('0x0')]=_0x1ab7('0x1');this['uniqueid']='';this[_0x1ab7('0x2')]='';this['calleridname']='';this['queue']='';this[_0x1ab7('0x3')]=null;this['queuecallerleaveAt']=null;this[_0x1ab7('0x4')]=0x1;this[_0x1ab7('0x5')]=0x1;this[_0x1ab7('0x6')]=![];this[_0x1ab7('0x7')]=null;this[_0x1ab7('0x8')]=![];this[_0x1ab7('0x9')]=null;this[_0x1ab7('0xa')]=![];this[_0x1ab7('0xb')]=null;this[_0x1ab7('0xc')]=0x1;this[_0x1ab7('0xd')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x1ab7('0xe')]='';this[_0x1ab7('0xf')]='';this[_0x1ab7('0x10')]='';this[_0x1ab7('0x11')]='';this[_0x1ab7('0x12')]=0x0;this[_0x1ab7('0x13')]=![];this[_0x1ab7('0x14')]='';this[_0x1ab7('0x15')]=_0x1ab7('0x16');this[_0x1ab7('0x17')]=0x0;this[_0x1ab7('0x18')]={};}module[_0x1ab7('0x19')]=QueueReport; \ No newline at end of file +var _0xbe56=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridnum','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0xbe56,0x13d));var _0x6be5=function(_0xf4c2a,_0x326579){_0xf4c2a=_0xf4c2a-0x0;var _0x18e9b8=_0xbe56[_0xf4c2a];return _0x18e9b8;};'use strict';function QueueReport(){this[_0x6be5('0x0')]='inbound';this[_0x6be5('0x1')]='';this[_0x6be5('0x2')]='';this['calleridname']='';this['queue']='';this[_0x6be5('0x3')]=null;this[_0x6be5('0x4')]=null;this[_0x6be5('0x5')]=0x1;this[_0x6be5('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x6be5('0x7')]=null;this['queuecallercomplete']=![];this[_0x6be5('0x8')]=null;this[_0x6be5('0x9')]=![];this[_0x6be5('0xa')]=null;this['originalposition']=0x1;this[_0x6be5('0xb')]='';this[_0x6be5('0xc')]='';this[_0x6be5('0xd')]='';this[_0x6be5('0xe')]='';this[_0x6be5('0xf')]='';this[_0x6be5('0x10')]='';this[_0x6be5('0x11')]='';this[_0x6be5('0x12')]=0x0;this['assigned']=![];this[_0x6be5('0x13')]='';this[_0x6be5('0x14')]=_0x6be5('0x15');this[_0x6be5('0x16')]=0x0;this[_0x6be5('0x17')]={};}module[_0x6be5('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 0e42ea2..1a7bd0b 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 _0x9676=['clientId','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password'];(function(_0x4d18c2,_0x9b85d0){var _0x1cadf9=function(_0xbb421c){while(--_0xbb421c){_0x4d18c2['push'](_0x4d18c2['shift']());}};_0x1cadf9(++_0x9b85d0);}(_0x9676,0xce));var _0x6967=function(_0x5bdccf,_0x2bbf15){_0x5bdccf=_0x5bdccf-0x0;var _0x3c4c74=_0x9676[_0x5bdccf];return _0x3c4c74;};'use strict';function SalesforceAccount(_0x3c23bd){this['id']=_0x3c23bd['id']||0x0;this[_0x6967('0x0')]=_0x3c23bd[_0x6967('0x0')]||'';this[_0x6967('0x1')]=_0x3c23bd[_0x6967('0x1')]||'';this[_0x6967('0x2')]=_0x3c23bd['remoteUri']||'';this[_0x6967('0x3')]=_0x3c23bd[_0x6967('0x3')]||'';this[_0x6967('0x4')]=_0x3c23bd[_0x6967('0x4')]||'';this['clientSecret']=_0x3c23bd['clientSecret']||'';this[_0x6967('0x5')]=_0x3c23bd[_0x6967('0x5')]||'';this[_0x6967('0x6')]=_0x3c23bd[_0x6967('0x6')]||_0x6967('0x7');this['serverUrl']=_0x3c23bd[_0x6967('0x8')]||'';this[_0x6967('0x9')]=_0x3c23bd[_0x6967('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x27d7=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x27d7,0xa4));var _0x727d=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x27d7[_0x210d7f];return _0x42d687;};'use strict';function SalesforceAccount(_0x52e768){this['id']=_0x52e768['id']||0x0;this['name']=_0x52e768[_0x727d('0x0')]||'';this[_0x727d('0x1')]=_0x52e768['username']||'';this[_0x727d('0x2')]=_0x52e768['remoteUri']||'';this[_0x727d('0x3')]=_0x52e768[_0x727d('0x3')]||'';this[_0x727d('0x4')]=_0x52e768[_0x727d('0x4')]||'';this['clientSecret']=_0x52e768[_0x727d('0x5')]||'';this['securityToken']=_0x52e768[_0x727d('0x6')]||'';this[_0x727d('0x7')]=_0x52e768[_0x727d('0x7')]||_0x727d('0x8');this[_0x727d('0x9')]=_0x52e768[_0x727d('0x9')]||'';this[_0x727d('0xa')]=_0x52e768[_0x727d('0xa')]||{};}module[_0x727d('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index e4d831d..bba90e4 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 _0x50f1=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1479cc,_0x47b7d2){var _0x47ff61=function(_0x634b3c){while(--_0x634b3c){_0x1479cc['push'](_0x1479cc['shift']());}};_0x47ff61(++_0x47b7d2);}(_0x50f1,0x147));var _0x150f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x50f1[_0x20a584];return _0x4b41a8;};'use strict';function ServicenowAccount(_0x170a3c){this['id']=_0x170a3c['id']||0x0;this[_0x150f('0x0')]=_0x170a3c[_0x150f('0x0')]||'';this['username']=_0x170a3c[_0x150f('0x1')]||'';this[_0x150f('0x2')]=_0x170a3c[_0x150f('0x2')]||'';this[_0x150f('0x3')]=_0x170a3c[_0x150f('0x3')]||'';this[_0x150f('0x4')]=_0x170a3c[_0x150f('0x4')]||'';this[_0x150f('0x5')]=_0x170a3c[_0x150f('0x5')]||{};}module[_0x150f('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xa790=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xa34bda,_0x34f584){var _0x37c970=function(_0xa3eca2){while(--_0xa3eca2){_0xa34bda['push'](_0xa34bda['shift']());}};_0x37c970(++_0x34f584);}(_0xa790,0x174));var _0x0a79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa790[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x33b134){this['id']=_0x33b134['id']||0x0;this[_0x0a79('0x0')]=_0x33b134[_0x0a79('0x0')]||'';this[_0x0a79('0x1')]=_0x33b134[_0x0a79('0x1')]||'';this[_0x0a79('0x2')]=_0x33b134['password']||'';this[_0x0a79('0x3')]=_0x33b134[_0x0a79('0x3')]||'';this[_0x0a79('0x4')]=_0x33b134[_0x0a79('0x4')]||'';this[_0x0a79('0x5')]=_0x33b134['Configurations']||{};}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 71e99f3..fac2034 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 _0x42ac=['username','password','serverUrl','Configurations','exports','name'];(function(_0x1abf95,_0x260b49){var _0x4550ae=function(_0x48db67){while(--_0x48db67){_0x1abf95['push'](_0x1abf95['shift']());}};_0x4550ae(++_0x260b49);}(_0x42ac,0xa1));var _0xc42a=function(_0x54fc2b,_0x5767d4){_0x54fc2b=_0x54fc2b-0x0;var _0x4d1b04=_0x42ac[_0x54fc2b];return _0x4d1b04;};'use strict';function SugarcrmAccount(_0x2352b0){this['id']=_0x2352b0['id']||0x0;this[_0xc42a('0x0')]=_0x2352b0[_0xc42a('0x0')]||'';this[_0xc42a('0x1')]=_0x2352b0[_0xc42a('0x1')]||'';this['password']=_0x2352b0[_0xc42a('0x2')]||'';this['remoteUri']=_0x2352b0['remoteUri']||'';this[_0xc42a('0x3')]=_0x2352b0[_0xc42a('0x3')]||'';this[_0xc42a('0x4')]=_0x2352b0[_0xc42a('0x4')]||{};}module[_0xc42a('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x86c9=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x86c9,0x100));var _0x986c=function(_0x39a7f3,_0x99b34d){_0x39a7f3=_0x39a7f3-0x0;var _0x46b4f9=_0x86c9[_0x39a7f3];return _0x46b4f9;};'use strict';function SugarcrmAccount(_0x2174aa){this['id']=_0x2174aa['id']||0x0;this['name']=_0x2174aa[_0x986c('0x0')]||'';this[_0x986c('0x1')]=_0x2174aa[_0x986c('0x1')]||'';this[_0x986c('0x2')]=_0x2174aa[_0x986c('0x2')]||'';this[_0x986c('0x3')]=_0x2174aa['remoteUri']||'';this[_0x986c('0x4')]=_0x2174aa[_0x986c('0x4')]||'';this['Configurations']=_0x2174aa[_0x986c('0x5')]||{};}module[_0x986c('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 45f37be..77a20f4 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 _0x7b84=['address','exports','name','accountcode','state','status','unknown'];(function(_0x1af227,_0x39e8ac){var _0x3fb366=function(_0x287295){while(--_0x287295){_0x1af227['push'](_0x1af227['shift']());}};_0x3fb366(++_0x39e8ac);}(_0x7b84,0x80));var _0x47b8=function(_0x1033aa,_0x1463f0){_0x1033aa=_0x1033aa-0x0;var _0x589756=_0x7b84[_0x1033aa];return _0x589756;};'use strict';function Telephone(_0x11d873){this['id']=_0x11d873['id']||0x0;this[_0x47b8('0x0')]=_0x11d873[_0x47b8('0x0')]||'';this['accountcode']=_0x11d873[_0x47b8('0x1')]||'';this[_0x47b8('0x2')]='unknown';this['stateTime']=0x0;this[_0x47b8('0x3')]=_0x47b8('0x4');this[_0x47b8('0x5')]='';}module[_0x47b8('0x6')]=Telephone; \ No newline at end of file +var _0x7462=['status','address','exports','name','accountcode','stateTime'];(function(_0xf5df05,_0x1b35c6){var _0xe6db6d=function(_0x4febe1){while(--_0x4febe1){_0xf5df05['push'](_0xf5df05['shift']());}};_0xe6db6d(++_0x1b35c6);}(_0x7462,0x165));var _0x2746=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x7462[_0x4629ee];return _0x47fb5b;};'use strict';function Telephone(_0x5605cb){this['id']=_0x5605cb['id']||0x0;this[_0x2746('0x0')]=_0x5605cb['name']||'';this['accountcode']=_0x5605cb[_0x2746('0x1')]||'';this['state']='unknown';this[_0x2746('0x2')]=0x0;this[_0x2746('0x3')]='unknown';this[_0x2746('0x4')]='';}module[_0x2746('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 f70f438..de91d3a 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(_0x8c9c9a,_0x4020e1){var _0x326e55=function(_0x273258){while(--_0x273258){_0x8c9c9a['push'](_0x8c9c9a['shift']());}};_0x326e55(++_0x4020e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x554d04,_0x145393){var _0x3c91c1=function(_0x49b122){while(--_0x49b122){_0x554d04['push'](_0x554d04['shift']());}};_0x3c91c1(++_0x145393);}(_0xb10b,0x12a));var _0xbb10=function(_0x30505b,_0x3b6c06){_0x30505b=_0x30505b-0x0;var _0x4f7466=_0xb10b[_0x30505b];return _0x4f7466;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 3b13241..cebe595 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x4ef925,_0x236cb5){var _0x396b8f=function(_0x346cf2){while(--_0x346cf2){_0x4ef925['push'](_0x4ef925['shift']());}};_0x396b8f(++_0x236cb5);}(_0xda3f,0xec));var _0xfda3=function(_0x8ab76e,_0x216e80){_0x8ab76e=_0x8ab76e-0x0;var _0x5a46fd=_0xda3f[_0x8ab76e];return _0x5a46fd;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0xea5fef,_0x1811ee){var _0x2958c4=function(_0x266e88){while(--_0x266e88){_0xea5fef['push'](_0xea5fef['shift']());}};_0x2958c4(++_0x1811ee);}(_0x8603,0x190));var _0x3860=function(_0x5c1d0d,_0x3fc558){_0x5c1d0d=_0x5c1d0d-0x0;var _0x3853d1=_0x8603[_0x5c1d0d];return _0x3853d1;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index dcd091c..a42a8b1 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 _0x2600=['state','stateTime','status','unknown','registry','indexOf','split','host','port','domain','domainport','registrationtime','address','defaultuser','exports','active','name'];(function(_0xea57db,_0x2b5907){var _0x36b22e=function(_0x3d6c06){while(--_0x3d6c06){_0xea57db['push'](_0xea57db['shift']());}};_0x36b22e(++_0x2b5907);}(_0x2600,0x174));var _0x0260=function(_0x38cf85,_0x234c29){_0x38cf85=_0x38cf85-0x0;var _0x5a4c10=_0x2600[_0x38cf85];return _0x5a4c10;};'use strict';function Trunk(_0x38b0ef){this['id']=_0x38b0ef['id']||0x0;this[_0x0260('0x0')]=_0x38b0ef[_0x0260('0x0')]||![];this[_0x0260('0x1')]=_0x38b0ef[_0x0260('0x1')]||'';this[_0x0260('0x2')]='unknown';this[_0x0260('0x3')]=0x0;this[_0x0260('0x4')]=_0x0260('0x5');this['registry']=_0x38b0ef[_0x0260('0x6')]&&_0x38b0ef[_0x0260('0x6')][_0x0260('0x7')](':')?_0x38b0ef[_0x0260('0x6')][_0x0260('0x8')](':')[0x0]:'';this[_0x0260('0x9')]='';this[_0x0260('0xa')]='';this[_0x0260('0xb')]='';this[_0x0260('0xc')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0x0260('0xd')]='';this[_0x0260('0xe')]='';this[_0x0260('0xf')]=_0x38b0ef[_0x0260('0xf')]||'';}module[_0x0260('0x10')]=Trunk; \ No newline at end of file +var _0x9dd5=['registrationtime','defaultuser','exports','active','name','state','unknown','registry','indexOf','split','host','port','domain'];(function(_0x52e64,_0x6ba4e8){var _0x282b80=function(_0xc11939){while(--_0xc11939){_0x52e64['push'](_0x52e64['shift']());}};_0x282b80(++_0x6ba4e8);}(_0x9dd5,0x148));var _0x59dd=function(_0x4edfef,_0x3d9692){_0x4edfef=_0x4edfef-0x0;var _0x10384f=_0x9dd5[_0x4edfef];return _0x10384f;};'use strict';function Trunk(_0x22f4e8){this['id']=_0x22f4e8['id']||0x0;this[_0x59dd('0x0')]=_0x22f4e8[_0x59dd('0x0')]||![];this[_0x59dd('0x1')]=_0x22f4e8[_0x59dd('0x1')]||'';this[_0x59dd('0x2')]=_0x59dd('0x3');this['stateTime']=0x0;this['status']=_0x59dd('0x3');this[_0x59dd('0x4')]=_0x22f4e8[_0x59dd('0x4')]&&_0x22f4e8[_0x59dd('0x4')][_0x59dd('0x5')](':')?_0x22f4e8[_0x59dd('0x4')][_0x59dd('0x6')](':')[0x0]:'';this[_0x59dd('0x7')]='';this[_0x59dd('0x8')]='';this[_0x59dd('0x9')]='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0x59dd('0x3');this[_0x59dd('0xa')]='';this['address']='';this[_0x59dd('0xb')]=_0x22f4e8[_0x59dd('0xb')]||'';}module[_0x59dd('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 33148f6..01ed6de 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 _0xc564=['none','exports','exten','recordingFormat'];(function(_0x57a44c,_0x1a41e3){var _0x3fd165=function(_0x3debb9){while(--_0x3debb9){_0x57a44c['push'](_0x57a44c['shift']());}};_0x3fd165(++_0x1a41e3);}(_0xc564,0xfa));var _0x4c56=function(_0x5f1f52,_0x44abd7){_0x5f1f52=_0x5f1f52-0x0;var _0x3a3ae3=_0xc564[_0x5f1f52];return _0x3a3ae3;};'use strict';function voiceExtension(_0x4f159e){this['id']=_0x4f159e['id']||0x0;this['exten']=_0x4f159e[_0x4c56('0x0')]||'';this[_0x4c56('0x1')]=_0x4f159e['recordingFormat']||_0x4c56('0x2');this['mandatoryDisposition']=_0x4f159e['mandatoryDisposition']||![];}module[_0x4c56('0x3')]=voiceExtension; \ No newline at end of file +var _0x8691=['exten','recordingFormat','none','exports'];(function(_0x57e799,_0x5938d6){var _0x8a389d=function(_0x1df75b){while(--_0x1df75b){_0x57e799['push'](_0x57e799['shift']());}};_0x8a389d(++_0x5938d6);}(_0x8691,0x190));var _0x1869=function(_0x27c46d,_0x446b75){_0x27c46d=_0x27c46d-0x0;var _0x3f3d04=_0x8691[_0x27c46d];return _0x3f3d04;};'use strict';function voiceExtension(_0x55e573){this['id']=_0x55e573['id']||0x0;this[_0x1869('0x0')]=_0x55e573[_0x1869('0x0')]||'';this[_0x1869('0x1')]=_0x55e573[_0x1869('0x1')]||_0x1869('0x2');this['mandatoryDisposition']=_0x55e573['mandatoryDisposition']||![];}module[_0x1869('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 fcd39b0..9d1ee64 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 _0xeb36=['ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','unknown','not_inuse','busy','unavailable'];(function(_0x15b512,_0x1e3e8c){var _0x21c513=function(_0x1903f7){while(--_0x1903f7){_0x15b512['push'](_0x15b512['shift']());}};_0x21c513(++_0x1e3e8c);}(_0xeb36,0x1cc));var _0x6eb3=function(_0x3f4a26,_0x1cad6c){_0x3f4a26=_0x3f4a26-0x0;var _0x113314=_0xeb36[_0x3f4a26];return _0x113314;};'use strict';var statusDesc=[_0x6eb3('0x0'),_0x6eb3('0x1'),'inuse',_0x6eb3('0x2'),'invalid',_0x6eb3('0x3'),_0x6eb3('0x4'),_0x6eb3('0x5'),_0x6eb3('0x6')];var monitorFormat={'wav':_0x6eb3('0x7'),'wav49':_0x6eb3('0x8'),'gsm':_0x6eb3('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x6eb3('0xa')};function VoiceQueue(_0x5ce8fd){this['id']=_0x5ce8fd['id']||0x0;this[_0x6eb3('0xb')]=_0x5ce8fd[_0x6eb3('0xb')]||'';this[_0x6eb3('0xc')]=_0x5ce8fd['monitor_format']||'';this['type']=_0x5ce8fd[_0x6eb3('0xd')]||_0x6eb3('0xe');this['waiting']=0x0;this[_0x6eb3('0xf')]=0x0;this[_0x6eb3('0x10')]=0x0;this[_0x6eb3('0x11')]=0x0;this[_0x6eb3('0x12')]=0x0;this[_0x6eb3('0x13')]=0x0;this[_0x6eb3('0x14')]=0x0;this[_0x6eb3('0x15')]=0x0;this[_0x6eb3('0x16')]=0x0;this[_0x6eb3('0x17')]=0x0;this[_0x6eb3('0x18')]=0x0;this['acw']=_0x5ce8fd['acw']||![];this[_0x6eb3('0x19')]=_0x5ce8fd[_0x6eb3('0x19')]||0xa;this[_0x6eb3('0x1a')]=_0x5ce8fd['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x6eb3('0x1b')]=0x0;this[_0x6eb3('0x1c')]=0x0;this[_0x6eb3('0x1d')]=_0x5ce8fd[_0x6eb3('0x1d')]||null;this[_0x6eb3('0x1e')]=_0x5ce8fd['dialGlobalInterval']?_0x5ce8fd[_0x6eb3('0x1e')]:null;this[_0x6eb3('0x1f')]=_0x5ce8fd[_0x6eb3('0x1f')];this[_0x6eb3('0x20')]=_0x5ce8fd[_0x6eb3('0x20')]||_0x6eb3('0x21');this[_0x6eb3('0x22')]=_0x5ce8fd[_0x6eb3('0x22')]||0x0;this[_0x6eb3('0x23')]=_0x5ce8fd[_0x6eb3('0x23')]||0x0;this[_0x6eb3('0x24')]=_0x5ce8fd['dialPowerLevel']||0x1;this[_0x6eb3('0x25')]=_0x5ce8fd[_0x6eb3('0x25')]||_0x6eb3('0x26');this[_0x6eb3('0x27')]=_0x5ce8fd[_0x6eb3('0x27')]||0.03;this[_0x6eb3('0x28')]=_0x5ce8fd[_0x6eb3('0x28')]||0x258;this[_0x6eb3('0x29')]=_0x5ce8fd[_0x6eb3('0x29')]||_0x6eb3('0x2a');this[_0x6eb3('0x2b')]=_0x5ce8fd[_0x6eb3('0x2b')]||_0x6eb3('0x2a');this[_0x6eb3('0x2c')]=_0x5ce8fd[_0x6eb3('0x2c')]||0x1e;this['dialQueueOptions']=_0x5ce8fd[_0x6eb3('0x2d')]||'tTxX';this[_0x6eb3('0x2e')]=_0x5ce8fd[_0x6eb3('0x2e')]||0x3;this[_0x6eb3('0x2f')]=_0x5ce8fd[_0x6eb3('0x2f')]||undefined;this[_0x6eb3('0x30')]=_0x5ce8fd[_0x6eb3('0x30')]||0x3;this[_0x6eb3('0x31')]=_0x5ce8fd[_0x6eb3('0x31')]||0x96;this['dialBusyMaxRetry']=_0x5ce8fd[_0x6eb3('0x32')]||0x3;this[_0x6eb3('0x33')]=_0x5ce8fd[_0x6eb3('0x33')]||0x96;this[_0x6eb3('0x34')]=_0x5ce8fd[_0x6eb3('0x34')]||0x3;this['dialNoAnswerRetryFrequency']=_0x5ce8fd['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x5ce8fd['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5ce8fd[_0x6eb3('0x35')]||0x96;this['dialDropMaxRetry']=_0x5ce8fd[_0x6eb3('0x36')]||0x3;this['dialDropRetryFrequency']=_0x5ce8fd[_0x6eb3('0x37')]||0x96;this[_0x6eb3('0x38')]=_0x5ce8fd[_0x6eb3('0x38')]||0x3;this[_0x6eb3('0x39')]=_0x5ce8fd[_0x6eb3('0x39')]||0x96;this[_0x6eb3('0x3a')]=_0x5ce8fd[_0x6eb3('0x3a')]||0x3;this[_0x6eb3('0x3b')]=_0x5ce8fd[_0x6eb3('0x3b')]||0x96;this[_0x6eb3('0x3c')]=_0x5ce8fd[_0x6eb3('0x3c')]||0x3;this[_0x6eb3('0x3d')]=_0x5ce8fd[_0x6eb3('0x3d')]||0x96;this['callAdditionalPhoneAfterMin']=_0x5ce8fd[_0x6eb3('0x3e')]||0x3;this[_0x6eb3('0x3f')]=_0x5ce8fd[_0x6eb3('0x3f')]||0x4;this[_0x6eb3('0x40')]=_0x5ce8fd[_0x6eb3('0x40')]?_0x5ce8fd[_0x6eb3('0x40')]:undefined;this[_0x6eb3('0x41')]=_0x5ce8fd[_0x6eb3('0x41')]?_0x5ce8fd[_0x6eb3('0x41')]:undefined;this[_0x6eb3('0x42')]=_0x5ce8fd[_0x6eb3('0x42')]||undefined;this[_0x6eb3('0x43')]=_0x5ce8fd[_0x6eb3('0x43')]?_0x5ce8fd['Interval']:undefined;this[_0x6eb3('0x44')]=_0x5ce8fd[_0x6eb3('0x44')]||'DESC';this[_0x6eb3('0x45')]=_0x5ce8fd[_0x6eb3('0x45')]||undefined;this[_0x6eb3('0x46')]=_0x5ce8fd[_0x6eb3('0x46')]||undefined;this[_0x6eb3('0x47')]=strategy[_0x5ce8fd[_0x6eb3('0x47')]]||'rrmemory';this[_0x6eb3('0x48')]=!![];this['dialAMDActive']=_0x5ce8fd[_0x6eb3('0x49')]||![];this[_0x6eb3('0x4a')]=_0x5ce8fd['dialAMDInitialSilence'];this[_0x6eb3('0x4b')]=_0x5ce8fd[_0x6eb3('0x4b')];this['dialAMDAfterGreetingSilence']=_0x5ce8fd[_0x6eb3('0x4c')];this['dialAMDTotalAnalysisTime']=_0x5ce8fd[_0x6eb3('0x4d')];this['dialAMDMinWordLength']=_0x5ce8fd[_0x6eb3('0x4e')];this['dialAMDBetweenWordsSilence']=_0x5ce8fd[_0x6eb3('0x4f')];this[_0x6eb3('0x50')]=_0x5ce8fd[_0x6eb3('0x50')];this['dialAMDSilenceThreshold']=_0x5ce8fd['dialAMDSilenceThreshold'];this[_0x6eb3('0x51')]=_0x5ce8fd[_0x6eb3('0x51')];this[_0x6eb3('0x52')]=0x0;this[_0x6eb3('0x53')]=0x0;this[_0x6eb3('0x54')]=_0x5ce8fd[_0x6eb3('0x54')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x6eb3('0x55')]=0x0;this[_0x6eb3('0x56')]=0x0;this[_0x6eb3('0x57')]=0x0;this[_0x6eb3('0x58')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x6eb3('0x59')]=0x0;this[_0x6eb3('0x5a')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x6eb3('0x5b')]=0x0;this[_0x6eb3('0x5c')]=0x0;this['startProgressive']=undefined;this[_0x6eb3('0x5d')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x6eb3('0x5e')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x6eb3('0x5f')]=0x0;this[_0x6eb3('0x60')]=0x0;this[_0x6eb3('0x61')]=0x0;this[_0x6eb3('0x62')]=0x0;this['predictiveIntervalMaxThreshold']=_0x5ce8fd[_0x6eb3('0x63')]||0x14;this[_0x6eb3('0x64')]=_0x5ce8fd[_0x6eb3('0x63')]||0xa;this[_0x6eb3('0x65')]=0x0;this[_0x6eb3('0x66')]=0x0;this[_0x6eb3('0x67')]=0x1;this[_0x6eb3('0x68')]=0x0;this[_0x6eb3('0x69')]=0x0;this[_0x6eb3('0x6a')]=0x0;this[_0x6eb3('0x6b')]=0x0;this[_0x6eb3('0x6c')]=_0x5ce8fd[_0x6eb3('0x6c')]||0x1e;this[_0x6eb3('0x6d')]=_0x5ce8fd['dialRecallInQueue']||![];this[_0x6eb3('0x6e')]=!!_0x5ce8fd['dialPreviewAutoRecallMe']||![];this[_0x6eb3('0x6f')]=!!_0x5ce8fd[_0x6eb3('0x6f')]||![];this[_0x6eb3('0x70')]=_0x5ce8fd['dialQueueProject2']||undefined;this[_0x6eb3('0x71')]=_0x5ce8fd[_0x6eb3('0x71')]||![];this['dialAgiAfterHangupAgent']=_0x5ce8fd[_0x6eb3('0x72')]||![];this[_0x6eb3('0xc')]=monitorFormat[_0x5ce8fd[_0x6eb3('0xc')]]?monitorFormat[_0x5ce8fd[_0x6eb3('0xc')]]:undefined;this['mandatoryDisposition']=_0x5ce8fd['mandatoryDisposition']||![];this[_0x6eb3('0x73')]=_0x5ce8fd[_0x6eb3('0x73')]?_0x5ce8fd[_0x6eb3('0x73')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x032b=['queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','ringing','ringinuse','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','acw','acwTimeout','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy'];(function(_0x56d377,_0x7aef7f){var _0x4c102d=function(_0x2c59d4){while(--_0x2c59d4){_0x56d377['push'](_0x56d377['shift']());}};_0x4c102d(++_0x7aef7f);}(_0x032b,0x197));var _0xb032=function(_0x74118b,_0x239694){_0x74118b=_0x74118b-0x0;var _0x257525=_0x032b[_0x74118b];return _0x257525;};'use strict';var statusDesc=[_0xb032('0x0'),_0xb032('0x1'),_0xb032('0x2'),'busy',_0xb032('0x3'),'unavailable',_0xb032('0x4'),_0xb032('0x5'),'onhold'];var monitorFormat={'wav':_0xb032('0x6'),'wav49':_0xb032('0x7'),'gsm':_0xb032('0x8')};var strategy={'rrmemory':_0xb032('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x2ffa10){this['id']=_0x2ffa10['id']||0x0;this[_0xb032('0xa')]=_0x2ffa10[_0xb032('0xa')]||'';this[_0xb032('0xb')]=_0x2ffa10[_0xb032('0xb')]||'';this[_0xb032('0xc')]=_0x2ffa10['type']||_0xb032('0xd');this['waiting']=0x0;this['talking']=0x0;this[_0xb032('0xe')]=0x0;this[_0xb032('0xf')]=0x0;this[_0xb032('0x10')]=0x0;this[_0xb032('0x11')]=0x0;this['sumBillable']=0x0;this[_0xb032('0x12')]=0x0;this[_0xb032('0x13')]=0x0;this['loggedIn']=0x0;this[_0xb032('0x14')]=0x0;this[_0xb032('0x15')]=_0x2ffa10[_0xb032('0x15')]||![];this[_0xb032('0x16')]=_0x2ffa10[_0xb032('0x16')]||0xa;this['autopause']=_0x2ffa10['autopause']||'no';this[_0xb032('0x17')]=!![];this['message']='';this[_0xb032('0x18')]=0x0;this[_0xb032('0x19')]=0x0;this[_0xb032('0x1a')]=_0x2ffa10[_0xb032('0x1a')]||null;this['dialGlobalInterval']=_0x2ffa10[_0xb032('0x1b')]?_0x2ffa10[_0xb032('0x1b')]:null;this[_0xb032('0x1c')]=_0x2ffa10[_0xb032('0x1c')];this[_0xb032('0x1d')]=_0x2ffa10['dialMethod']||_0xb032('0x1e');this['dialLimitChannel']=_0x2ffa10[_0xb032('0x1f')]||0x0;this['dialLimitQueue']=_0x2ffa10[_0xb032('0x20')]||0x0;this['dialPowerLevel']=_0x2ffa10[_0xb032('0x21')]||0x1;this[_0xb032('0x22')]=_0x2ffa10[_0xb032('0x22')]||_0xb032('0x23');this[_0xb032('0x24')]=_0x2ffa10[_0xb032('0x24')]||0.03;this['dialPredictiveInterval']=_0x2ffa10[_0xb032('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x2ffa10[_0xb032('0x26')]||'anonymous';this[_0xb032('0x27')]=_0x2ffa10[_0xb032('0x27')]||_0xb032('0x28');this['dialOriginateTimeout']=_0x2ffa10[_0xb032('0x29')]||0x1e;this[_0xb032('0x2a')]=_0x2ffa10[_0xb032('0x2a')]||'tTxX';this[_0xb032('0x2b')]=_0x2ffa10[_0xb032('0x2b')]||0x3;this[_0xb032('0x2c')]=_0x2ffa10[_0xb032('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x2ffa10[_0xb032('0x2d')]||0x3;this[_0xb032('0x2e')]=_0x2ffa10['dialCongestionRetryFrequency']||0x96;this[_0xb032('0x2f')]=_0x2ffa10['dialBusyMaxRetry']||0x3;this[_0xb032('0x30')]=_0x2ffa10[_0xb032('0x30')]||0x96;this[_0xb032('0x31')]=_0x2ffa10[_0xb032('0x31')]||0x3;this[_0xb032('0x32')]=_0x2ffa10[_0xb032('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2ffa10['dialNoSuchNumberMaxRetry']||0x3;this[_0xb032('0x33')]=_0x2ffa10[_0xb032('0x33')]||0x96;this[_0xb032('0x34')]=_0x2ffa10['dialDropMaxRetry']||0x3;this[_0xb032('0x35')]=_0x2ffa10[_0xb032('0x35')]||0x96;this[_0xb032('0x36')]=_0x2ffa10[_0xb032('0x36')]||0x3;this[_0xb032('0x37')]=_0x2ffa10[_0xb032('0x37')]||0x96;this[_0xb032('0x38')]=_0x2ffa10[_0xb032('0x38')]||0x3;this['dialMachineRetryFrequency']=_0x2ffa10['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x2ffa10[_0xb032('0x39')]||0x3;this[_0xb032('0x3a')]=_0x2ffa10[_0xb032('0x3a')]||0x96;this[_0xb032('0x3b')]=_0x2ffa10[_0xb032('0x3b')]||0x3;this[_0xb032('0x3c')]=_0x2ffa10[_0xb032('0x3c')]||0x4;this['Trunk']=_0x2ffa10[_0xb032('0x3d')]?_0x2ffa10[_0xb032('0x3d')]:undefined;this[_0xb032('0x3e')]=_0x2ffa10[_0xb032('0x3e')]?_0x2ffa10['TrunkBackup']:undefined;this['dialPrefix']=_0x2ffa10[_0xb032('0x3f')]||undefined;this[_0xb032('0x40')]=_0x2ffa10[_0xb032('0x40')]?_0x2ffa10[_0xb032('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x2ffa10['dialOrderByScheduledAt']||_0xb032('0x41');this[_0xb032('0x42')]=_0x2ffa10['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x2ffa10[_0xb032('0x43')]||undefined;this[_0xb032('0x44')]=strategy[_0x2ffa10[_0xb032('0x44')]]||_0xb032('0x9');this[_0xb032('0x45')]=!![];this['dialAMDActive']=_0x2ffa10[_0xb032('0x46')]||![];this['dialAMDInitialSilence']=_0x2ffa10[_0xb032('0x47')];this['dialAMDGreeting']=_0x2ffa10[_0xb032('0x48')];this[_0xb032('0x49')]=_0x2ffa10[_0xb032('0x49')];this[_0xb032('0x4a')]=_0x2ffa10[_0xb032('0x4a')];this['dialAMDMinWordLength']=_0x2ffa10[_0xb032('0x4b')];this['dialAMDBetweenWordsSilence']=_0x2ffa10[_0xb032('0x4c')];this['dialAMDMaximumNumberOfWords']=_0x2ffa10['dialAMDMaximumNumberOfWords'];this[_0xb032('0x4d')]=_0x2ffa10[_0xb032('0x4d')];this[_0xb032('0x4e')]=_0x2ffa10[_0xb032('0x4e')];this[_0xb032('0x4f')]=0x0;this[_0xb032('0x50')]=0x0;this[_0xb032('0x51')]=_0x2ffa10[_0xb032('0x51')];this[_0xb032('0x52')]=0x0;this[_0xb032('0x53')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0xb032('0x54')]=0x0;this[_0xb032('0x55')]=0x0;this[_0xb032('0x56')]=0x0;this[_0xb032('0x57')]=0x0;this[_0xb032('0x58')]=0x0;this[_0xb032('0x59')]=0x0;this[_0xb032('0x5a')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb032('0x5b')]=0x0;this[_0xb032('0x5c')]=0x0;this[_0xb032('0x5d')]=undefined;this[_0xb032('0x5e')]=undefined;this[_0xb032('0x5f')]=undefined;this[_0xb032('0x60')]=1.05;this[_0xb032('0x61')]=0x0;this[_0xb032('0x62')]=0x0;this[_0xb032('0x63')]=0x0;this[_0xb032('0x64')]=0x0;this[_0xb032('0x65')]=0x0;this[_0xb032('0x66')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xb032('0x67')]=0x0;this[_0xb032('0x68')]=_0x2ffa10['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xb032('0x69')]=_0x2ffa10['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xb032('0x6a')]=0x1;this[_0xb032('0x6b')]=0x0;this[_0xb032('0x6c')]=0x0;this[_0xb032('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0xb032('0x6e')]=_0x2ffa10[_0xb032('0x6e')]||0x1e;this[_0xb032('0x6f')]=_0x2ffa10[_0xb032('0x6f')]||![];this[_0xb032('0x70')]=!!_0x2ffa10[_0xb032('0x70')]||![];this['dialPreviewRecallmeReminder']=!!_0x2ffa10['dialPreviewRecallmeReminder']||![];this[_0xb032('0x71')]=_0x2ffa10[_0xb032('0x71')]||undefined;this[_0xb032('0x72')]=_0x2ffa10['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x2ffa10[_0xb032('0x73')]||![];this[_0xb032('0xb')]=monitorFormat[_0x2ffa10[_0xb032('0xb')]]?monitorFormat[_0x2ffa10['monitor_format']]:undefined;this[_0xb032('0x74')]=_0x2ffa10['mandatoryDisposition']||![];this[_0xb032('0x75')]=_0x2ffa10[_0xb032('0x75')]?_0x2ffa10['mandatoryDispositionPause']:undefined;}module[_0xb032('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 691ee03..fd80dec 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 _0xd663=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x3462b6,_0x215c99){var _0x766bfd=function(_0x4a05d7){while(--_0x4a05d7){_0x3462b6['push'](_0x3462b6['shift']());}};_0x766bfd(++_0x215c99);}(_0xd663,0xf0));var _0x3d66=function(_0x23c962,_0x29cad2){_0x23c962=_0x23c962-0x0;var _0x4cc2ff=_0xd663[_0x23c962];return _0x4cc2ff;};'use strict';function VtigerAccount(_0x435cc2){this['id']=_0x435cc2['id']||0x0;this[_0x3d66('0x0')]=_0x435cc2[_0x3d66('0x0')]||'';this['username']=_0x435cc2[_0x3d66('0x1')]||'';this[_0x3d66('0x2')]=_0x435cc2[_0x3d66('0x2')]||'';this['remoteUri']=_0x435cc2[_0x3d66('0x3')]||'';this[_0x3d66('0x4')]=_0x435cc2[_0x3d66('0x4')]||'';this['Configurations']=_0x435cc2[_0x3d66('0x5')]||{};}module[_0x3d66('0x6')]=VtigerAccount; \ No newline at end of file +var _0x8677=['exports','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8677,0x1c3));var _0x7867=function(_0x419e80,_0x395855){_0x419e80=_0x419e80-0x0;var _0x35f9d5=_0x8677[_0x419e80];return _0x35f9d5;};'use strict';function VtigerAccount(_0x1d7b54){this['id']=_0x1d7b54['id']||0x0;this['name']=_0x1d7b54['name']||'';this[_0x7867('0x0')]=_0x1d7b54['username']||'';this[_0x7867('0x1')]=_0x1d7b54[_0x7867('0x1')]||'';this[_0x7867('0x2')]=_0x1d7b54[_0x7867('0x2')]||'';this[_0x7867('0x3')]=_0x1d7b54[_0x7867('0x3')]||'';this['Configurations']=_0x1d7b54[_0x7867('0x4')]||{};}module[_0x7867('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e57c3e6..6b50a92 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 _0x8b29=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0x8b29,0x1ee));var _0x98b2=function(_0x4b18ed,_0x4099df){_0x4b18ed=_0x4b18ed-0x0;var _0x5e3a07=_0x8b29[_0x4b18ed];return _0x5e3a07;};'use strict';function ZendeskAccount(_0x2aeeeb){this['id']=_0x2aeeeb['id']||0x0;this[_0x98b2('0x0')]=_0x2aeeeb[_0x98b2('0x0')]||'';this['username']=_0x2aeeeb[_0x98b2('0x1')]||'';this[_0x98b2('0x2')]=_0x2aeeeb[_0x98b2('0x2')]||'';this[_0x98b2('0x3')]=_0x2aeeeb[_0x98b2('0x3')]||'';this[_0x98b2('0x4')]=_0x2aeeeb[_0x98b2('0x4')]||'';this[_0x98b2('0x5')]=_0x2aeeeb[_0x98b2('0x5')]||'';this[_0x98b2('0x6')]=_0x2aeeeb['type']||_0x98b2('0x7');this[_0x98b2('0x8')]=_0x2aeeeb[_0x98b2('0x8')]||'';this[_0x98b2('0x9')]=_0x2aeeeb[_0x98b2('0x9')]||{};}module[_0x98b2('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x8cf5=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x597b57,_0x5183de){var _0x4336a1=function(_0x3f3244){while(--_0x3f3244){_0x597b57['push'](_0x597b57['shift']());}};_0x4336a1(++_0x5183de);}(_0x8cf5,0x13a));var _0x58cf=function(_0x55eeea,_0x450b2c){_0x55eeea=_0x55eeea-0x0;var _0x26dc71=_0x8cf5[_0x55eeea];return _0x26dc71;};'use strict';function ZendeskAccount(_0x5c3eec){this['id']=_0x5c3eec['id']||0x0;this[_0x58cf('0x0')]=_0x5c3eec[_0x58cf('0x0')]||'';this[_0x58cf('0x1')]=_0x5c3eec[_0x58cf('0x1')]||'';this[_0x58cf('0x2')]=_0x5c3eec[_0x58cf('0x2')]||'';this['token']=_0x5c3eec[_0x58cf('0x3')]||'';this[_0x58cf('0x4')]=_0x5c3eec['remoteUri']||'';this[_0x58cf('0x5')]=_0x5c3eec[_0x58cf('0x5')]||'';this['type']=_0x5c3eec['type']||_0x58cf('0x6');this[_0x58cf('0x7')]=_0x5c3eec['serverUrl']||'';this[_0x58cf('0x8')]=_0x5c3eec[_0x58cf('0x8')]||{};}module[_0x58cf('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a82c02b..e94d667 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 _0xc813=['clientSecret','serverUrl','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x96c6c8,_0x2fd12e){var _0x2e5cee=function(_0x79b4d6){while(--_0x79b4d6){_0x96c6c8['push'](_0x96c6c8['shift']());}};_0x2e5cee(++_0x2fd12e);}(_0xc813,0x145));var _0x3c81=function(_0x5afeab,_0x536dcd){_0x5afeab=_0x5afeab-0x0;var _0x419cd3=_0xc813[_0x5afeab];return _0x419cd3;};'use strict';function ZohoAccount(_0x2c19ff){this['id']=_0x2c19ff['id']||0x0;this[_0x3c81('0x0')]=_0x2c19ff['name']||'';this['description']=_0x2c19ff[_0x3c81('0x1')]||'';this[_0x3c81('0x2')]=_0x2c19ff[_0x3c81('0x2')]||'';this[_0x3c81('0x3')]=_0x2c19ff[_0x3c81('0x3')]||'';this[_0x3c81('0x4')]=_0x2c19ff[_0x3c81('0x4')]||'';this[_0x3c81('0x5')]=_0x2c19ff['clientSecret']||'';this[_0x3c81('0x6')]=_0x2c19ff[_0x3c81('0x6')]||'';this['code']=_0x2c19ff['code']||'';this[_0x3c81('0x7')]=_0x2c19ff['refreshToken']||'';this[_0x3c81('0x8')]=_0x2c19ff[_0x3c81('0x8')]||{};}module[_0x3c81('0x9')]=ZohoAccount; \ No newline at end of file +var _0x512d=['refreshToken','Configurations','exports','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x26a8f1,_0x266a0b){var _0x2e6552=function(_0x1d82d7){while(--_0x1d82d7){_0x26a8f1['push'](_0x26a8f1['shift']());}};_0x2e6552(++_0x266a0b);}(_0x512d,0xdf));var _0xd512=function(_0x2f3f86,_0x341d72){_0x2f3f86=_0x2f3f86-0x0;var _0x1468fb=_0x512d[_0x2f3f86];return _0x1468fb;};'use strict';function ZohoAccount(_0x50ef2c){this['id']=_0x50ef2c['id']||0x0;this['name']=_0x50ef2c['name']||'';this[_0xd512('0x0')]=_0x50ef2c[_0xd512('0x0')]||'';this[_0xd512('0x1')]=_0x50ef2c[_0xd512('0x1')]||'';this[_0xd512('0x2')]=_0x50ef2c['zone']||'';this[_0xd512('0x3')]=_0x50ef2c[_0xd512('0x3')]||'';this[_0xd512('0x4')]=_0x50ef2c[_0xd512('0x4')]||'';this[_0xd512('0x5')]=_0x50ef2c[_0xd512('0x5')]||'';this[_0xd512('0x6')]=_0x50ef2c[_0xd512('0x6')]||'';this[_0xd512('0x7')]=_0x50ef2c[_0xd512('0x7')]||'';this[_0xd512('0x8')]=_0x50ef2c[_0xd512('0x8')]||{};}module[_0xd512('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 0a1ff0e..be7c314 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 _0xfb11=['originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xfb11[_0x13e741];return _0x3f8bb3;};'use strict';var util=require(_0x1fb1('0x0'));var _=require('lodash');var moment=require(_0x1fb1('0x1'));function checkNameSurname(_0x34e2d6,_0x51c055,_0x1461ad){var _0x5af9cc='';if(!_[_0x1fb1('0x2')](_0x51c055)&&'string'===typeof _0x51c055){_0x5af9cc+=_0x51c055;}if(!_[_0x1fb1('0x2')](_0x1461ad)&&_0x1fb1('0x3')===typeof _0x1461ad){_0x5af9cc+='\x20'+_0x1461ad;}if(_0x5af9cc!==''){return _0x5af9cc;}return _0x34e2d6;}function Action(_0x5af469,_0x25d44f,_0x133727,_0x4c098d,_0x1859da){this[_0x1fb1('0x4')]=_0x133727||undefined;this[_0x1fb1('0x5')]=_0x5af469['id'];this[_0x1fb1('0x6')]=_0x25d44f[_0x1fb1('0x7')];this[_0x1fb1('0x8')]=_0x25d44f[_0x1fb1('0x8')];this[_0x1fb1('0x9')]=_0x1fb1('0x6');this[_0x1fb1('0xa')]=![];this['membername']=_[_0x1fb1('0x2')](_0x5af469['Agent'])?undefined:_0x5af469[_0x1fb1('0xb')]['name'];this[_0x1fb1('0xc')]=this[_0x1fb1('0xd')]?util[_0x1fb1('0xe')](_0x1fb1('0xf'),this[_0x1fb1('0xd')]):_0x4c098d||undefined;this[_0x1fb1('0x10')]=checkNameSurname(_0x5af469['Contact'][_0x1fb1('0x11')],_0x5af469[_0x1fb1('0x12')][_0x1fb1('0x13')],_0x5af469[_0x1fb1('0x12')][_0x1fb1('0x14')]);this[_0x1fb1('0x15')]=_0x5af469[_0x1fb1('0x15')]||![];this[_0x1fb1('0x16')]=_0x5af469[_0x1fb1('0x11')];this['scheduledat']=_0x5af469['scheduledat'];this[_0x1fb1('0x17')]=_0x5af469[_0x1fb1('0x17')]||0x0;this[_0x1fb1('0x18')]=_0x5af469['countcongestionretry']||0x0;this[_0x1fb1('0x19')]=_0x5af469[_0x1fb1('0x19')]||0x0;this[_0x1fb1('0x1a')]=(_0x5af469[_0x1fb1('0x17')]||0x0)+(_0x5af469[_0x1fb1('0x18')]||0x0)+(_0x5af469[_0x1fb1('0x19')]||0x0)+(_0x5af469[_0x1fb1('0x1b')]||0x0)+(_0x5af469[_0x1fb1('0x1c')]||0x0)+(_0x5af469[_0x1fb1('0x1d')]||0x0)+(_0x5af469['countmachineretry']||0x0)+(_0x5af469[_0x1fb1('0x1e')]||0x0);this['countnosuchnumberretry']=_0x5af469['countnosuchnumberretry']||0x0;this[_0x1fb1('0x1c')]=_0x5af469[_0x1fb1('0x1c')]||0x0;this[_0x1fb1('0x1d')]=_0x5af469['countabandonedretry']||0x0;this[_0x1fb1('0x1f')]=_0x5af469['countmachineretry']||0x0;this['countagentrejectretry']=_0x5af469['countagentrejectretry']||0x0;this[_0x1fb1('0x20')]=_0x5af469[_0x1fb1('0x20')];this[_0x1fb1('0x21')]=_0x5af469[_0x1fb1('0x21')];this[_0x1fb1('0x22')]=_0x5af469['callbackat'];this[_0x1fb1('0x23')]=_0x5af469[_0x1fb1('0x23')];this[_0x1fb1('0x24')]=_0x5af469[_0x1fb1('0x24')];this[_0x1fb1('0x25')]=_0x5af469[_0x1fb1('0x25')];this[_0x1fb1('0x26')]=_[_0x1fb1('0x2')](_0x5af469['Agent'])?_0x5af469[_0x1fb1('0x26')]:_0x5af469[_0x1fb1('0xb')]['id'];this[_0x1fb1('0x27')]=_0x5af469[_0x1fb1('0x27')];this[_0x1fb1('0x28')]='';this[_0x1fb1('0x29')]='';}Action[_0x1fb1('0x2a')][_0x1fb1('0x2b')]=function(){return util[_0x1fb1('0xe')](_0x1fb1('0x2c'),this[_0x1fb1('0x10')],this[_0x1fb1('0x2d')]);};module[_0x1fb1('0x2e')]=Action; \ No newline at end of file +var _0x8aad=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','isNil','uniqueid','idContact','queue','name','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0xcff735,_0x39f060){var _0xcea608=function(_0x4ef4f5){while(--_0x4ef4f5){_0xcff735['push'](_0xcff735['shift']());}};_0xcea608(++_0x39f060);}(_0x8aad,0x146));var _0xd8aa=function(_0x2624a5,_0x522f54){_0x2624a5=_0x2624a5-0x0;var _0x2e3dba=_0x8aad[_0x2624a5];return _0x2e3dba;};'use strict';var util=require(_0xd8aa('0x0'));var _=require(_0xd8aa('0x1'));var moment=require('moment');function checkNameSurname(_0x11554c,_0x5bcfd1,_0x276f03){var _0xb610c0='';if(!_['isNil'](_0x5bcfd1)&&'string'===typeof _0x5bcfd1){_0xb610c0+=_0x5bcfd1;}if(!_[_0xd8aa('0x2')](_0x276f03)&&'string'===typeof _0x276f03){_0xb610c0+='\x20'+_0x276f03;}if(_0xb610c0!==''){return _0xb610c0;}return _0x11554c;}function Action(_0x53248c,_0x16b648,_0x43ddeb,_0x16ea12,_0x4a4b10){this[_0xd8aa('0x3')]=_0x43ddeb||undefined;this[_0xd8aa('0x4')]=_0x53248c['id'];this[_0xd8aa('0x5')]=_0x16b648[_0xd8aa('0x6')];this['type']=_0x16b648['type'];this[_0xd8aa('0x7')]=_0xd8aa('0x5');this[_0xd8aa('0x8')]=![];this[_0xd8aa('0x9')]=_[_0xd8aa('0x2')](_0x53248c['Agent'])?undefined:_0x53248c[_0xd8aa('0xa')][_0xd8aa('0x6')];this[_0xd8aa('0xb')]=this[_0xd8aa('0x9')]?util[_0xd8aa('0xc')](_0xd8aa('0xd'),this[_0xd8aa('0x9')]):_0x16ea12||undefined;this[_0xd8aa('0xe')]=checkNameSurname(_0x53248c[_0xd8aa('0xf')][_0xd8aa('0x10')],_0x53248c['Contact']['firstName'],_0x53248c[_0xd8aa('0xf')][_0xd8aa('0x11')]);this[_0xd8aa('0x12')]=_0x53248c['active']||![];this[_0xd8aa('0x13')]=_0x53248c[_0xd8aa('0x10')];this[_0xd8aa('0x14')]=_0x53248c[_0xd8aa('0x14')];this['countbusyretry']=_0x53248c[_0xd8aa('0x15')]||0x0;this[_0xd8aa('0x16')]=_0x53248c['countcongestionretry']||0x0;this[_0xd8aa('0x17')]=_0x53248c[_0xd8aa('0x17')]||0x0;this[_0xd8aa('0x18')]=(_0x53248c[_0xd8aa('0x15')]||0x0)+(_0x53248c[_0xd8aa('0x16')]||0x0)+(_0x53248c['countnoanswerretry']||0x0)+(_0x53248c[_0xd8aa('0x19')]||0x0)+(_0x53248c[_0xd8aa('0x1a')]||0x0)+(_0x53248c[_0xd8aa('0x1b')]||0x0)+(_0x53248c[_0xd8aa('0x1c')]||0x0)+(_0x53248c['countagentrejectretry']||0x0);this[_0xd8aa('0x19')]=_0x53248c[_0xd8aa('0x19')]||0x0;this[_0xd8aa('0x1a')]=_0x53248c[_0xd8aa('0x1a')]||0x0;this[_0xd8aa('0x1b')]=_0x53248c['countabandonedretry']||0x0;this[_0xd8aa('0x1c')]=_0x53248c[_0xd8aa('0x1c')]||0x0;this[_0xd8aa('0x1d')]=_0x53248c['countagentrejectretry']||0x0;this[_0xd8aa('0x1e')]=_0x53248c[_0xd8aa('0x1e')];this[_0xd8aa('0x1f')]=_0x53248c[_0xd8aa('0x1f')];this[_0xd8aa('0x20')]=_0x53248c[_0xd8aa('0x20')];this[_0xd8aa('0x21')]=_0x53248c[_0xd8aa('0x21')];this[_0xd8aa('0x22')]=_0x53248c[_0xd8aa('0x22')];this[_0xd8aa('0x23')]=_0x53248c[_0xd8aa('0x23')];this[_0xd8aa('0x24')]=_['isNil'](_0x53248c[_0xd8aa('0xa')])?_0x53248c[_0xd8aa('0x24')]:_0x53248c[_0xd8aa('0xa')]['id'];this[_0xd8aa('0x25')]=_0x53248c[_0xd8aa('0x25')];this[_0xd8aa('0x26')]='';this[_0xd8aa('0x27')]='';}Action[_0xd8aa('0x28')][_0xd8aa('0x29')]=function(){return util[_0xd8aa('0xc')]('\x22%s\x22\x20<%s>',this[_0xd8aa('0xe')],this[_0xd8aa('0x2a')]);};module[_0xd8aa('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 60d94b6..58cf12e 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 _0xe71a=['originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice_queue:save','info','voice:queue:%s','emit','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','loopCampaigns','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','actions','Queue','originated:\x20','stringify','queue','dialAnswer','contactId','UserId','ListId','Action','status','channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','totalGlobal','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','Answer','crateCustomerReportQueue','talktime','uniqueid','countbusyretry','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','activeContact','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','Contact','phone','VoiceQueueId','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','SIP/%s','reachable','unlock','unlockContact','pick','execRun','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridNumber','addVariables','toLowerVariables','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][cause]','destuniqueid','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','uuid','moment','md5','ioredis','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','socket.io-emitter','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','type','outbound','name','answered','available','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message'];(function(_0x1d13c8,_0x1554e6){var _0x3a3b03=function(_0x3d488d){while(--_0x3d488d){_0x1d13c8['push'](_0x1d13c8['shift']());}};_0x3a3b03(++_0x1554e6);}(_0xe71a,0x104));var _0xae71=function(_0x144ec4,_0x3a4d44){_0x144ec4=_0x144ec4-0x0;var _0x224de8=_0xe71a[_0x144ec4];return _0x224de8;};'use strict';var util=require(_0xae71('0x0'));var _=require('lodash');var uuid=require(_0xae71('0x1'));var moment=require(_0xae71('0x2'));var md5=require(_0xae71('0x3'));var Redis=require(_0xae71('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xae71('0x5'));var loggerAction=require('../../../config/logger')(_0xae71('0x6'));var ami=require(_0xae71('0x7'));var rpcDb=require(_0xae71('0x8'));var cmHopperAdditionalPhone=require(_0xae71('0x9'));var Action=require(_0xae71('0xa'));var ut=require(_0xae71('0xb'));config[_0xae71('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xae71('0xd'))(new Redis(config[_0xae71('0xc')]));var Sequence=function(){};Sequence[_0xae71('0xe')][_0xae71('0xf')]=function(_0x565d75){this[_0xae71('0x10')]=this[_0xae71('0x10')]?this[_0xae71('0x10')]['finally'](_0x565d75):_0x565d75();};function Preview(_0x4ec752){this['sequence']=new Sequence();this[_0xae71('0x11')]=_0x4ec752[_0xae71('0x12')];this['trunks']=_0x4ec752[_0xae71('0x13')];this['actions']={};this[_0xae71('0x14')]=_0x4ec752[_0xae71('0x14')];this[_0xae71('0x15')]=0x0;ami['on'](_0xae71('0x16'),this[_0xae71('0x17')][_0xae71('0x18')](this));ami['on'](_0xae71('0x19'),this['syncHangup'][_0xae71('0x18')](this));ami['on'](_0xae71('0x1a'),this[_0xae71('0x1b')][_0xae71('0x18')](this));ami['on']('dialend',this[_0xae71('0x1c')][_0xae71('0x18')](this));ami['on']('newexten',this['syncNewExten'][_0xae71('0x18')](this));ami['on'](_0xae71('0x1d'),this[_0xae71('0x1e')][_0xae71('0x18')](this));ami['on'](_0xae71('0x1f'),this[_0xae71('0x20')][_0xae71('0x18')](this));ami['on'](_0xae71('0x21'),this[_0xae71('0x22')][_0xae71('0x18')](this));this['loopCampaigns'](this[_0xae71('0x11')]);}function emit(_0x50d077,_0x13e5f4,_0x2ae262){io['to'](_0x50d077)['emit'](_0x13e5f4,_0x2ae262);}function emitCampaignPreview(_0x44e53a){if(_0x44e53a[_0xae71('0x23')]===_0xae71('0x24')){var _0x403e98={'id':_0x44e53a['id'],'name':_0x44e53a[_0xae71('0x25')],'strategy':_0x44e53a['strategy'],'answered':_0x44e53a[_0xae71('0x26')],'available':_0x44e53a[_0xae71('0x27')],'loggedIn':_0x44e53a['loggedIn'],'pTalking':_0x44e53a[_0xae71('0x28')],'sumBillable':_0x44e53a[_0xae71('0x29')],'sumDuration':_0x44e53a['sumDuration'],'sumHoldTime':_0x44e53a[_0xae71('0x2a')]||0x0,'talking':_0x44e53a[_0xae71('0x2b')],'total':_0x44e53a[_0xae71('0x2c')],'type':_0x44e53a['type'],'unmanaged':_0x44e53a[_0xae71('0x2d')],'abandoned':_0x44e53a[_0xae71('0x2e')],'waiting':_0x44e53a[_0xae71('0x2f')],'loggedInDb':_0x44e53a['loggedInDb'],'dialActive':_0x44e53a[_0xae71('0x30')],'dialMethod':_0x44e53a[_0xae71('0x31')],'dialOriginateCallerIdName':_0x44e53a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x44e53a[_0xae71('0x32')],'dialOriginateTimeout':_0x44e53a[_0xae71('0x33')],'dialPrefix':_0x44e53a[_0xae71('0x34')],'outboundAnswerAgiCallsDay':_0x44e53a['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x44e53a[_0xae71('0x35')],'outboundBlacklistCallsDay':_0x44e53a[_0xae71('0x36')],'outboundBusyCallsDay':_0x44e53a[_0xae71('0x37')],'outboundCongestionCallsDay':_0x44e53a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x44e53a[_0xae71('0x38')],'outboundDropCallsDayCallersExit':_0x44e53a['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x44e53a[_0xae71('0x39')],'outboundNoAnswerCallsDay':_0x44e53a[_0xae71('0x3a')],'outboundNoSuchCallsDay':_0x44e53a[_0xae71('0x3b')],'outboundOriginateFailureCallsDay':_0x44e53a[_0xae71('0x3c')],'outboundReCallsDay':_0x44e53a['outboundReCallsDay'],'outboundRejectCallsDay':_0x44e53a[_0xae71('0x3d')],'outboundUnknownCallsDay':_0x44e53a[_0xae71('0x3e')],'outboundAbandonedCallsDay':_0x44e53a[_0xae71('0x3f')],'predictiveIntervalAnsweredCalls':_0x44e53a[_0xae71('0x40')],'predictiveIntervalAvgHoldtime':_0x44e53a[_0xae71('0x41')],'predictiveIntervalAvgTalktime':_0x44e53a[_0xae71('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x44e53a['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x44e53a[_0xae71('0x43')],'predictiveIntervalErlangCalls':_0x44e53a['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x44e53a[_0xae71('0x44')],'predictiveIntervalHitRate':_0x44e53a['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x44e53a[_0xae71('0x45')],'predictiveIntervalPauses':_0x44e53a[_0xae71('0x46')],'predictiveIntervalAvailable':_0x44e53a[_0xae71('0x47')],'predictiveIntervalTotalCalls':_0x44e53a[_0xae71('0x48')],'message':_0x44e53a[_0xae71('0x49')],'originated':_0x44e53a[_0xae71('0x4a')],'erlangCalls':_0x44e53a[_0xae71('0x4b')],'erlangCallToSecond':_0x44e53a[_0xae71('0x4c')],'erlangAbandonmentRate':_0x44e53a[_0xae71('0x4d')],'erlangBusyFactor':_0x44e53a[_0xae71('0x4e')],'startPredictive':_0x44e53a[_0xae71('0x4f')],'startProgressive':_0x44e53a[_0xae71('0x50')]};if(_0x44e53a[_0xae71('0x51')]){_0x403e98['Trunk']={'id':_0x44e53a[_0xae71('0x51')]['id'],'name':_0x44e53a[_0xae71('0x51')][_0xae71('0x25')],'active':_0x44e53a['Trunk'][_0xae71('0x52')],'callerid':_0x44e53a[_0xae71('0x51')][_0xae71('0x53')]};}if(_0x44e53a['Interval']){_0x403e98[_0xae71('0x54')]={'id':_0x44e53a[_0xae71('0x54')]['id'],'name':_0x44e53a[_0xae71('0x54')]['name']};}var _0x54c774=md5(JSON['stringify'](_0x403e98));if(_0x44e53a[_0xae71('0x3')]!==_0x54c774){_0x44e53a[_0xae71('0x3')]=_0x54c774;emit(util[_0xae71('0x55')]('voice:queue:%s',_0x403e98[_0xae71('0x25')]),_0xae71('0x56'),_0x403e98);}}}function emitVoiceQueueChannelRemove(_0x5e7047){logger[_0xae71('0x57')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x5e7047));emit(util[_0xae71('0x55')](_0xae71('0x58'),_0x5e7047[_0xae71('0x25')]),'voice_queue_channel:remove',_0x5e7047);io[_0xae71('0x59')]('voice_queue_presence:remove',_0x5e7047);}function notSendMessagesQueue(_0x144e13){if(_0x144e13['sendMessageOneNotActive']){if(_0x144e13[_0xae71('0x4a')]===0x0&&_0x144e13['pTalking']===0x0){_0x144e13[_0xae71('0x5a')]=![];_0x144e13[_0xae71('0x27')]=0x0;_0x144e13['paused']=0x0;_0x144e13[_0xae71('0x49')]=_0xae71('0x5b');ut[_0xae71('0x5c')](_0xae71('0x5d'),_0x144e13[_0xae71('0x25')]+_0xae71('0x5e'));}else{_0x144e13['message']='DEACTIVATED';ut[_0xae71('0x5c')](_0xae71('0x5d'),_0x144e13['name']+'\x20is\x20deactivated');}emitCampaignPreview(_0x144e13);}}Preview[_0xae71('0xe')][_0xae71('0x5f')]=function(){var _0x2dbe9d=this;setInterval(function(){_0x2dbe9d[_0xae71('0x60')]();},0x7cf);};Preview['prototype'][_0xae71('0x60')]=function(){var _0x2ed038=this[_0xae71('0x11')];this[_0xae71('0x15')]+=0x1;for(var _0x4161a5 in _0x2ed038){if(_0x2ed038['hasOwnProperty'](_0x4161a5)&&(_0x2ed038[_0x4161a5][_0xae71('0x31')]==='preview'||_0x2ed038[_0x4161a5]['dialMethod']===_0xae71('0x61'))&&_0x2ed038[_0x4161a5][_0xae71('0x23')]==='outbound'){if(this[_0xae71('0x15')]>0x7){this[_0xae71('0x15')]=0x0;this[_0xae71('0x62')]();}}if(_0x2ed038[_0xae71('0x63')](_0x4161a5)&&_0x2ed038[_0x4161a5]['dialMethod']===_0xae71('0x5')&&_0x2ed038[_0x4161a5][_0xae71('0x23')]===_0xae71('0x24')){if(_0x2ed038[_0x4161a5]['dialActive']){this[_0xae71('0x64')](_0x2ed038[_0x4161a5]);if(_0x2ed038[_0x4161a5][_0xae71('0x65')])this[_0xae71('0x66')](_0x2ed038[_0x4161a5]);}else{notSendMessagesQueue(_0x2ed038[_0x4161a5]);}}}};Preview[_0xae71('0xe')][_0xae71('0x67')]=function(_0x15756f){var _0x3c28ab=this;this['sequence'][_0xae71('0xf')](function(){if(!_[_0xae71('0x68')](_0x3c28ab[_0xae71('0x69')][_0x15756f])){loggerAction[_0xae71('0x57')]('[clearZombieChannels][talking]',_0x15756f,_0xae71('0x6a'),_0x3c28ab[_0xae71('0x69')][_0x15756f]['queue'],_0xae71('0x6b'),JSON[_0xae71('0x6c')](_0x3c28ab[_0xae71('0x11')][_0x3c28ab[_0xae71('0x69')][_0x15756f][_0xae71('0x6d')]][_0xae71('0x4a')]),'pTalking:\x20',JSON[_0xae71('0x6c')](_0x3c28ab[_0xae71('0x11')][_0x3c28ab[_0xae71('0x69')][_0x15756f][_0xae71('0x6d')]][_0xae71('0x28')]),JSON[_0xae71('0x6c')](_0x3c28ab[_0xae71('0x69')][_0x15756f][_0xae71('0x6e')]),JSON[_0xae71('0x6c')](_['pick'](_0x3c28ab[_0xae71('0x69')][_0x15756f],[_0xae71('0x6f'),_0xae71('0x70'),'VoiceQueueId',_0xae71('0x71')])));return ami[_0xae71('0x72')]({'action':_0xae71('0x73'),'channel':_0x3c28ab[_0xae71('0x69')][_0x15756f][_0xae71('0x74')]})['catch'](function(_0x19197b){if(_0x19197b['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3c28ab['actions'][_0x15756f]){ut[_0xae71('0x75')](_0x3c28ab['campaignsPreview'][_0x3c28ab[_0xae71('0x69')][_0x15756f][_0xae71('0x6d')]],_0xae71('0x76'));if(_0x3c28ab[_0xae71('0x69')][_0x15756f][_0xae71('0x6e')]===!![]){ut['decrementTalkink'](_0x3c28ab[_0xae71('0x11')][_0x3c28ab[_0xae71('0x69')][_0x15756f][_0xae71('0x6d')]],_0xae71('0x76'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x15756f,_0x3c28ab[_0xae71('0x69')][_0x15756f][_0xae71('0x6d')]);}ut[_0xae71('0x77')](_0xae71('0x78')+_0x15756f,_0x3c28ab[_0xae71('0x69')][_0x15756f][_0xae71('0x6d')]);delete _0x3c28ab[_0xae71('0x69')][_0x15756f];}},0x2328);}});}});};Preview[_0xae71('0xe')]['clearZombieChannels']=function(){var _0x5ea02d=this;loggerAction[_0xae71('0x57')](_0xae71('0x79'),_[_0xae71('0x7a')](this[_0xae71('0x69')]));for(var _0x17a4b0 in this['actions']){if(_0x5ea02d['actions'][_0xae71('0x63')](_0x17a4b0)){_0x5ea02d[_0xae71('0x67')](_0x17a4b0);}}};Preview[_0xae71('0xe')][_0xae71('0x66')]=function(_0x5e779a){var _0x5595cf=this;rpcDb['getContactRecallMe'](_0x5e779a['id'],ut[_0xae71('0x7b')](this['agents']))[_0xae71('0x7c')](function(_0x1fa510){if(!_[_0xae71('0x68')](_0x1fa510)){for(var _0x4ba944=0x0;_0x4ba944<_0x1fa510[_0xae71('0x7d')];_0x4ba944+=0x1){if(ut[_0xae71('0x7e')](_0x1fa510[_0x4ba944][_0xae71('0x7f')])<_0x5e779a[_0xae71('0x80')]*0x3c){if(_0x1fa510[_0x4ba944][_0xae71('0x81')]&&!_0x1fa510[_0x4ba944][_0xae71('0x81')][_0xae71('0x82')]){_0x5595cf[_0xae71('0x83')](_0x1fa510[_0x4ba944]['id'])[_0xae71('0x7c')](ut['logger2'](_0xae71('0x84')))[_0xae71('0x85')](ut[_0xae71('0x86')]('[RecallMe]'));}else{rpcDb[_0xae71('0x87')](_0x1fa510[_0x4ba944]['id']);}}else{var _0x1c29fb=new Action(_0x1fa510[_0x4ba944],_0x5e779a);_0x1c29fb[_0xae71('0x88')]=moment()[_0xae71('0x55')](_0xae71('0x89'));_0x5e779a['outboundReCallsDay']+=0x1;ut[_0xae71('0x8a')](_0x1c29fb,0x17,_0xae71('0x8b'));if(_0x5e779a[_0xae71('0x8c')]){rpcDb[_0xae71('0x8d')](ut['createBody'](_0x1fa510[_0x4ba944]));rpcDb['createCustomerHistory'](_0x1c29fb,_0xae71('0x8e'));}else{ut[_0xae71('0x8a')](_0x1c29fb,0x16,_0xae71('0x8f'));rpcDb[_0xae71('0x90')](_0x1c29fb,_0xae71('0x91'));rpcDb[_0xae71('0x92')](_0x1c29fb,_0xae71('0x91'));}}}}})[_0xae71('0x85')](ut['logger2'](_0xae71('0x93')));};Preview['prototype'][_0xae71('0x64')]=function(_0x559249){_0x559249[_0xae71('0x5a')]=!![];if(ut[_0xae71('0x94')](_0x559249[_0xae71('0x95')])){_0x559249[_0xae71('0x49')]=_0xae71('0x96');}else if(!ut[_0xae71('0x97')](_0x559249['dialActive'])){_0x559249[_0xae71('0x49')]=_0xae71('0x5b');}else if(!this[_0xae71('0x98')](_0x559249[_0xae71('0x51')])){if(!this[_0xae71('0x98')](_0x559249[_0xae71('0x99')])){_0x559249[_0xae71('0x49')]=_0xae71('0x9a');}else{_0x559249[_0xae71('0x49')]=_0xae71('0x9b');}}else{_0x559249[_0xae71('0x49')]=_0xae71('0x9b');}emitCampaignPreview(_0x559249);};Preview[_0xae71('0xe')]['callProgressDetectingCustomer']=function(_0x19deee,_0x2b3f6e,_0x311a2b){var _0x249c0d=this;var _0x5480a0=this[_0xae71('0x69')][_0x2b3f6e];var _0x186870=this['campaignsPreview'][_0x5480a0[_0xae71('0x6d')]];var _0x485660;var _0x59c6fd=![];var _0x3d3c7b=0x2;var _0x216923=0x3;if(_0x186870){switch(_0x311a2b){case'1':_0x186870['outboundNoSuchCallsDay']+=0x1;_0x5480a0[_0xae71('0x9c')]+=0x1;_0x5480a0[_0xae71('0x9d')]=ut['totalGlobal'](_0x5480a0);ut[_0xae71('0x8a')](_0x5480a0,0x0,'NoSuchNumber');ami[_0xae71('0x59')](_0xae71('0x9e'),ut[_0xae71('0x9f')](_0x5480a0,_0xae71('0xa0')));rpcDb['createCustomerHistory'](_0x5480a0,'[callProgressDetectingCustomer][logNoSuch]');_0x249c0d[_0xae71('0xa1')](_0x5480a0,'0',_0x186870)[_0xae71('0x7c')](function(_0x4fc76e){_0x59c6fd=_0x4fc76e[_0xae71('0xa2')]==0x1;_0x3d3c7b=_0x186870['dialNoSuchNumberRetryFrequency'];_0x216923=_0x186870['callAdditionalPhoneAfterMin'];if(!_0x59c6fd){if(ut[_0xae71('0xa3')](_0x5480a0)>=_0x186870['dialGlobalMaxRetry']){_0x485660=ut[_0xae71('0xa4')](_0x5480a0,0xf,_0xae71('0xa5'));rpcDb[_0xae71('0x92')](_0x485660,_0xae71('0xa6'));}else{if(_0x5480a0[_0xae71('0x9c')]>=_0x186870[_0xae71('0xa7')]){rpcDb[_0xae71('0x92')](_0x5480a0,_0xae71('0xa6'));}else{rpcDb[_0xae71('0xa8')](ut[_0xae71('0xa9')](_0x5480a0,_0xae71('0x9c'),_0x186870[_0xae71('0xaa')]),_0x5480a0[_0xae71('0xab')],_0x5480a0['activeContact']);}}delete this[_0xae71('0x69')][_0x19deee[_0xae71('0xac')]];}else{_0x5480a0['countnosuchnumberretry']++;logger[_0xae71('0x57')]('actioncountonusuch',_0x5480a0[_0xae71('0x9c')]);logger['info']('id',_0x5480a0['idContact']);_0x249c0d[_0xae71('0xad')]({'id':_0x5480a0[_0xae71('0xae')],'field':{'countnosuchnumberretry':_0x5480a0[_0xae71('0x9c')]}})[_0xae71('0x7c')](function(){_0x249c0d[_0xae71('0xaf')](_0x5480a0,_0x3d3c7b,_0x216923)[_0xae71('0x7c')](function(){});});}});break;case _0xae71('0xb0'):var _0x4d485b=moment()[_0xae71('0x55')](_0xae71('0x89'));_0x5480a0[_0xae71('0xb1')]=_0x4d485b;_0x5480a0[_0xae71('0xb2')]=_0x4d485b;_0x5480a0[_0xae71('0x6e')]=!![];_0x186870[_0xae71('0x28')]+=0x1;logger[_0xae71('0x57')](_0xae71('0xb3'),_0x5480a0['uniqueid'],_0xae71('0xb4'),_0x186870[_0xae71('0x25')],_0xae71('0xb5'),_0x186870[_0xae71('0x28')]);ami[_0xae71('0x59')](_0xae71('0xb6'),ut[_0xae71('0x9f')](_0x5480a0,'connect',this[_0xae71('0x11')][_0x5480a0[_0xae71('0x6d')]]));if(_0x186870[_0xae71('0xb7')]){ami[_0xae71('0x59')](_0xae71('0xb8'),ut[_0xae71('0xb9')](_0x5480a0));}break;case'16':ami[_0xae71('0x59')](_0xae71('0xba'),ut[_0xae71('0x9f')](_0x5480a0,_0xae71('0xbb'),this['campaignsPreview'][_0x5480a0[_0xae71('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0xae71('0x9f')](_0x5480a0,_0xae71('0xbb')));_0x186870[_0xae71('0x35')]+=0x1;_0x186870['total']+=0x1;_0x186870[_0xae71('0x26')]+=0x1;ut[_0xae71('0xbc')](_0x186870,'[16]');_0x5480a0[_0xae71('0x9d')]=ut[_0xae71('0xa3')](_0x5480a0);ut[_0xae71('0x8a')](_0x5480a0,0x4,_0xae71('0xbd'));rpcDb[_0xae71('0x90')](_0x5480a0,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xae71('0x92')](_0x5480a0,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xae71('0xbe')](_0x5480a0);_0x186870['sumDuration']+=_0x5480a0['talktime'];_0x186870[_0xae71('0x29')]+=_0x5480a0[_0xae71('0xbf')];logger[_0xae71('0x57')]('[syncHangup][talking][decrement]',_0x5480a0[_0xae71('0xc0')],_0xae71('0xb4'),_0x186870['name'],_0xae71('0xb5'),_0x186870[_0xae71('0x28')]);delete this['actions'][_0x19deee[_0xae71('0xac')]];break;case'BUSY':_0x186870[_0xae71('0x37')]+=0x1;_0x5480a0[_0xae71('0xc1')]+=0x1;_0x5480a0[_0xae71('0x9d')]=ut[_0xae71('0xa3')](_0x5480a0);ut[_0xae71('0x8a')](_0x5480a0,0x5,'Busy');_0x3d3c7b=_0x186870[_0xae71('0xc2')];_0x216923=_0x186870[_0xae71('0xc3')];ami[_0xae71('0x59')]('custom:agentbusy',ut[_0xae71('0x9f')](_0x5480a0,'busy'));rpcDb[_0xae71('0x90')](_0x5480a0,_0xae71('0xc4'));_0x249c0d[_0xae71('0xa1')](_0x5480a0,'5',_0x186870)[_0xae71('0x7c')](function(_0x10fa8b){_0x59c6fd=_0x10fa8b[_0xae71('0xa2')]==0x1;if(!_0x59c6fd){if(ut[_0xae71('0xa3')](_0x5480a0)>=_0x186870[_0xae71('0xc5')]){_0x485660=ut[_0xae71('0xa4')](_0x5480a0,0xf,_0xae71('0xa5'));rpcDb[_0xae71('0x92')](_0x485660,_0xae71('0xc6'));}else{if(_0x5480a0[_0xae71('0xc1')]>=_0x186870[_0xae71('0xc7')]){rpcDb[_0xae71('0x92')](_0x5480a0,_0xae71('0xc4'));}else{rpcDb[_0xae71('0xa8')](ut[_0xae71('0xa9')](_0x5480a0,_0xae71('0xc1'),_0x186870[_0xae71('0xc2')]),_0x5480a0[_0xae71('0xab')],_0x5480a0[_0xae71('0xc8')]);}}}else{_0x5480a0[_0xae71('0xc1')]++;_0x249c0d['incrementPreviewCounters']({'id':_0x5480a0[_0xae71('0xae')],'field':{'countbusyretry':_0x5480a0[_0xae71('0xc1')]}})[_0xae71('0x7c')](function(){_0x249c0d[_0xae71('0xaf')](_0x5480a0,_0x3d3c7b,_0x216923)[_0xae71('0x7c')](function(){});});}});break;case _0xae71('0xc9'):_0x186870[_0xae71('0x3a')]+=0x1;_0x5480a0[_0xae71('0xca')]+=0x1;_0x5480a0['countglobal']=ut[_0xae71('0xa3')](_0x5480a0);ut[_0xae71('0x8a')](_0x5480a0,0x3,_0xae71('0xcb'));_0x3d3c7b=_0x186870[_0xae71('0xcc')];_0x216923=_0x186870[_0xae71('0xc3')];var _0x4d413f=ut['buildNoAnswerEventPayload'](_0x5480a0,_0x186870);ami['emit']('custom:agentnoanswer',_0x4d413f);rpcDb[_0xae71('0x90')](_0x5480a0,_0xae71('0xcd'));_0x249c0d[_0xae71('0xa1')](_0x5480a0,'3',_0x186870)[_0xae71('0x7c')](function(_0x2a3bc8){_0x59c6fd=_0x2a3bc8[_0xae71('0xa2')]==0x1;if(!_0x59c6fd){if(ut[_0xae71('0xa3')](_0x5480a0)>=_0x186870[_0xae71('0xc5')]){_0x485660=ut[_0xae71('0xa4')](_0x5480a0,0xf,_0xae71('0xa5'));rpcDb[_0xae71('0x92')](_0x485660,_0xae71('0xce'));}else{if(_0x5480a0[_0xae71('0xca')]>=_0x186870[_0xae71('0xcf')]){rpcDb[_0xae71('0x92')](_0x5480a0,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xae71('0xa9')](_0x5480a0,'countnoanswerretry',_0x186870[_0xae71('0xcc')]),_0x5480a0[_0xae71('0xab')],_0x5480a0[_0xae71('0xc8')]);}}}else{_0x5480a0[_0xae71('0xca')]++;_0x249c0d[_0xae71('0xad')]({'id':_0x5480a0[_0xae71('0xae')],'field':{'countnoanswerretry':_0x5480a0[_0xae71('0xca')]}})[_0xae71('0x7c')](function(){_0x249c0d[_0xae71('0xaf')](_0x5480a0,_0x3d3c7b,_0x216923)[_0xae71('0x7c')](function(){});});}});break;case _0xae71('0xd0'):_0x186870[_0xae71('0xd1')]+=0x1;_0x5480a0[_0xae71('0xd2')]+=0x1;_0x5480a0[_0xae71('0x9d')]=ut[_0xae71('0xa3')](_0x5480a0);ut[_0xae71('0x8a')](_0x5480a0,0x8,_0xae71('0xd3'));_0x3d3c7b=_0x186870[_0xae71('0xd4')];_0x216923=_0x186870[_0xae71('0xc3')];ami['emit']('custom:agentcongestion',ut[_0xae71('0x9f')](_0x5480a0,'congestion'));rpcDb['createCustomerHistory'](_0x5480a0,_0xae71('0xd5'));_0x249c0d[_0xae71('0xa1')](_0x5480a0,'8',_0x186870)['then'](function(_0xb7f33c){_0x59c6fd=_0xb7f33c[_0xae71('0xa2')]==0x1;if(!_0x59c6fd){if(ut['totalGlobal'](_0x5480a0)>=_0x186870[_0xae71('0xc5')]){_0x485660=ut[_0xae71('0xa4')](_0x5480a0,0xf,_0xae71('0xa5'));rpcDb[_0xae71('0x92')](_0x485660,_0xae71('0xd6'));}else{if(_0x5480a0['countcongestionretry']>=_0x186870[_0xae71('0xd7')]){rpcDb[_0xae71('0x92')](_0x5480a0,_0xae71('0xd5'));}else{rpcDb[_0xae71('0xa8')](ut[_0xae71('0xa9')](_0x5480a0,'countcongestionretry',_0x186870[_0xae71('0xc2')]),_0x5480a0['unlockAgent'],_0x5480a0[_0xae71('0xc8')]);}}}else{_0x5480a0[_0xae71('0xd2')]++;_0x249c0d[_0xae71('0xad')]({'id':_0x5480a0['idContact'],'field':{'countcongestionretry':_0x5480a0[_0xae71('0xd2')]}})['then'](function(){_0x249c0d[_0xae71('0xaf')](_0x5480a0,_0x3d3c7b,_0x216923)[_0xae71('0x7c')](function(){});});}});break;case _0xae71('0xd8'):_0x186870[_0xae71('0x3d')]+=0x1;_0x5480a0['countagentrejectretry']+=0x1;_0x5480a0[_0xae71('0x9d')]=ut[_0xae71('0xa3')](_0x5480a0);ut[_0xae71('0x8a')](_0x5480a0,0x14,_0xae71('0xd9'));_0x3d3c7b=_0x186870[_0xae71('0xda')];_0x216923=_0x186870[_0xae71('0xc3')];ami[_0xae71('0x59')](_0xae71('0xdb'),ut[_0xae71('0x9f')](_0x5480a0,'agentreject'));rpcDb[_0xae71('0x90')](_0x5480a0,_0xae71('0xdc'));_0x249c0d['verifyAdditionalPhones'](_0x5480a0,'20',_0x186870)[_0xae71('0x7c')](function(_0x5b8596){_0x59c6fd=_0x5b8596[_0xae71('0xa2')]==0x1;if(!_0x59c6fd){if(ut[_0xae71('0xa3')](_0x5480a0)>=_0x186870['dialGlobalMaxRetry']){_0x485660=ut[_0xae71('0xa4')](_0x5480a0,0x14,_0xae71('0xd9'));rpcDb['createCustomerFinal'](_0x485660,_0xae71('0xdd'));}else{if(_0x5480a0[_0xae71('0xde')]>=_0x186870[_0xae71('0xdf')]){rpcDb['createCustomerFinal'](_0x5480a0,_0xae71('0xdd'));}else{rpcDb[_0xae71('0xa8')](ut['scheduledAt'](_0x5480a0,'countagentrejectretry',_0x186870[_0xae71('0xda')]),_0x5480a0[_0xae71('0xab')],_0x5480a0[_0xae71('0xc8')]);}}}else{_0x5480a0[_0xae71('0xca')]++;_0x249c0d['incrementPreviewCounters']({'id':_0x5480a0[_0xae71('0xae')],'field':{'countnoanswerretry':_0x5480a0[_0xae71('0xca')]}})['then'](function(){_0x249c0d[_0xae71('0xaf')](_0x5480a0,_0x3d3c7b,_0x216923)['then'](function(){});});}});break;case _0xae71('0xe0'):_0x186870[_0xae71('0x3f')]+=0x1;_0x5480a0[_0xae71('0xe1')]+=0x1;_0x5480a0[_0xae71('0x9d')]=ut['totalGlobal'](_0x5480a0);ut['logCustomer'](_0x5480a0,0xb,_0xae71('0xe2'));rpcDb[_0xae71('0x90')](_0x5480a0,_0xae71('0xe3'));_0x249c0d[_0xae71('0xa1')](_0x5480a0,'11',_0x186870)[_0xae71('0x7c')](function(_0x3d652f){_0x59c6fd=_0x3d652f['additional']==0x1;if(!_0x59c6fd){if(ut[_0xae71('0xa3')](_0x5480a0)>=_0x186870[_0xae71('0xc5')]){_0x485660=ut[_0xae71('0xa4')](_0x5480a0,0xf,'Global');rpcDb['createCustomerFinal'](_0x485660,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5480a0[_0xae71('0xe4')]>=_0x186870['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x5480a0,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xae71('0xa8')](ut[_0xae71('0xa9')](_0x5480a0,_0xae71('0xe1'),_0x186870['dialAbandonedRetryFrequency']),_0x5480a0[_0xae71('0xab')],_0x5480a0[_0xae71('0xc8')]);}}}else{_0x5480a0[_0xae71('0xca')]++;_0x249c0d[_0xae71('0xad')]({'id':_0x5480a0[_0xae71('0xae')],'field':{'countnoanswerretry':_0x5480a0[_0xae71('0xca')]}})[_0xae71('0x7c')](function(){_0x249c0d[_0xae71('0xaf')](_0x5480a0,_0x3d3c7b,_0x216923)[_0xae71('0x7c')](function(){});});}});break;case'18':_0x186870[_0xae71('0x3e')]+=0x1;_0x5480a0['countmachineretry']+=0x1;_0x5480a0[_0xae71('0x9d')]=ut[_0xae71('0xa3')](_0x5480a0);ut[_0xae71('0x8a')](_0x5480a0,0x12,_0x19deee[_0xae71('0xe5')]||_0x19deee[_0xae71('0xe6')]);ami['emit'](_0xae71('0xe7'),ut[_0xae71('0x9f')](_0x5480a0,_0xae71('0xe8')));rpcDb['createCustomerHistory'](_0x5480a0,'[callProgressDetectingCustomer][hangupInAMD]');_0x249c0d['verifyAdditionalPhones'](_0x5480a0,'18',_0x186870)[_0xae71('0x7c')](function(_0x2002c7){_0x59c6fd=_0x2002c7[_0xae71('0xa2')]==0x1;if(!_0x59c6fd){if(ut[_0xae71('0xa3')](_0x5480a0)>=_0x186870[_0xae71('0xc5')]){_0x485660=ut[_0xae71('0xa4')](_0x5480a0,0x12,_0xae71('0xa5'));rpcDb[_0xae71('0x92')](_0x485660,_0xae71('0xe9'));}else{rpcDb[_0xae71('0x92')](_0x5480a0,_0xae71('0xe9'));}}else{_0x5480a0[_0xae71('0xca')]++;_0x249c0d[_0xae71('0xad')]({'id':_0x5480a0['idContact'],'field':{'countnoanswerretry':_0x5480a0[_0xae71('0xca')]}})[_0xae71('0x7c')](function(){_0x249c0d[_0xae71('0xaf')](_0x5480a0,_0x3d3c7b,_0x216923)['then'](function(){});});}});delete this[_0xae71('0x69')][_0x19deee['linkedid']];break;case'19':_0x186870['outboundUnknownCallsDay']+=0x1;_0x5480a0[_0xae71('0x9d')]=ut[_0xae71('0xa3')](_0x5480a0);ut[_0xae71('0x8a')](_0x5480a0,0x13,_0x19deee['cause-txt']||_0x19deee[_0xae71('0xe6')]);ami[_0xae71('0x59')](_0xae71('0xe7'),ut[_0xae71('0x9f')](_0x5480a0,_0xae71('0xe8')));rpcDb[_0xae71('0x90')](_0x5480a0,_0xae71('0xea'));_0x249c0d[_0xae71('0xa1')](_0x5480a0,'18',_0x186870)[_0xae71('0x7c')](function(_0x8c54e2){_0x59c6fd=_0x8c54e2['additional']==0x1;if(!_0x59c6fd){if(ut[_0xae71('0xa3')](_0x5480a0)>=_0x186870[_0xae71('0xc5')]){_0x485660=ut[_0xae71('0xa4')](_0x5480a0,0xf,_0xae71('0xa5'));rpcDb['createCustomerFinal'](_0x485660,_0xae71('0xea'));}else{rpcDb[_0xae71('0x92')](_0x5480a0,_0xae71('0xea'));}}else{_0x5480a0[_0xae71('0xca')]++;_0x249c0d[_0xae71('0xad')]({'id':_0x5480a0[_0xae71('0xae')],'field':{'countnoanswerretry':_0x5480a0[_0xae71('0xca')]}})[_0xae71('0x7c')](function(){_0x249c0d['swapAdditionalPhones'](_0x5480a0,_0x3d3c7b,_0x216923)[_0xae71('0x7c')](function(){});});}});delete this[_0xae71('0x69')][_0x19deee[_0xae71('0xac')]];break;default:if(_0x5480a0[_0xae71('0x6e')]){ut[_0xae71('0xbc')](_0x186870,_0xae71('0xeb'));ut[_0xae71('0x77')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x186870[_0xae71('0x25')],_0x19deee);}_0x186870[_0xae71('0x3e')]+=0x1;_0x5480a0['countglobal']=ut['totalGlobal'](_0x5480a0);ut['logCustomer'](_0x5480a0,0xc,_0x19deee[_0xae71('0xe5')]||_0x19deee[_0xae71('0xe6')]);_0x3d3c7b=_0x186870[_0xae71('0xda')];_0x216923=_0x186870[_0xae71('0xc3')];rpcDb[_0xae71('0x90')](_0x5480a0,_0xae71('0xec'));_0x249c0d['verifyAdditionalPhones'](_0x5480a0,'20',_0x186870)[_0xae71('0x7c')](function(_0x6e6fe8){_0x59c6fd=_0x6e6fe8[_0xae71('0xa2')]==0x1;if(!_0x59c6fd){if(ut[_0xae71('0xa3')](_0x5480a0)>=_0x186870[_0xae71('0xc5')]){_0x485660=ut[_0xae71('0xa4')](_0x5480a0,0xf,'Global');rpcDb[_0xae71('0x92')](_0x485660,_0xae71('0xed'));}else{rpcDb[_0xae71('0x92')](_0x5480a0,_0xae71('0xed'));}delete this['actions'][_0x19deee['linkedid']];}else{_0x249c0d[_0xae71('0xaf')](_0x5480a0,_0x3d3c7b,_0x216923)[_0xae71('0x7c')](function(){});}});}if(!(_0x5480a0['dialAnswer']&&_0x311a2b==='16')){ut['updateOriginated'](_0x186870,_0xae71('0xee'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x5480a0[_0xae71('0xc0')],_0xae71('0xb4'),_0x186870[_0xae71('0x25')],_0xae71('0x6b'),_0x186870[_0xae71('0x4a')]);}if(_0x311a2b!==_0xae71('0xb0')){delete this[_0xae71('0x69')][_0x19deee['linkedid']];delete this[_0xae71('0x69')][_0x19deee[_0xae71('0xef')]];}}};Preview[_0xae71('0xe')][_0xae71('0xf0')]=function(_0x100ee1,_0x4d5bca,_0x40e457){if(_[_0xae71('0xf1')](_0x4d5bca)&&_0xae71('0xf2')!==typeof _0x4d5bca){return;}if(_[_0xae71('0xf1')](_0x40e457)&&_0xae71('0xf2')!==typeof _0x40e457){return;}switch(_0x40e457[_0xae71('0xf3')]){case'0':ut[_0xae71('0xf4')](_0x100ee1,0x0,_0xae71('0xf5'));rpcDb['createAgentHistory'](_0x100ee1,_0xae71('0xf6'));break;case'3':ut[_0xae71('0xf4')](_0x100ee1,0x3,_0xae71('0xcb'));rpcDb[_0xae71('0xf7')](_0x100ee1,_0xae71('0xf8'));break;case'5':ut[_0xae71('0xf4')](_0x100ee1,0x5,_0xae71('0xf9'));rpcDb[_0xae71('0xf7')](_0x100ee1,_0xae71('0xfa'));break;case'8':ut[_0xae71('0xf4')](_0x100ee1,0x8,'Congestion');rpcDb['createAgentHistory'](_0x100ee1,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x100ee1,0x16,_0xae71('0xfb'));rpcDb[_0xae71('0xf7')](_0x100ee1,_0xae71('0xfc'));break;default:ut['logAgent'](_0x100ee1,0xc,_0x40e457[_0xae71('0xf3')]);rpcDb[_0xae71('0xf7')](_0x100ee1,_0xae71('0xfd'));}ut['updateOriginated'](_0x4d5bca,_0xae71('0xfe'));logger[_0xae71('0x57')]('[originated][decrement][callProgressDetectingAgent]',_0x100ee1[_0xae71('0xc0')],_0xae71('0xb4'),_0x4d5bca[_0xae71('0x25')],'originated:\x20',_0x4d5bca[_0xae71('0x4a')]);delete this[_0xae71('0x69')][_0x100ee1[_0xae71('0xc0')]];};Preview[_0xae71('0xe')][_0xae71('0xa1')]=function(_0x44bbac,_0x4cd0ec,_0x3b5e94){return Promise['resolve']()[_0xae71('0x7c')](cmHopperAdditionalPhone[_0xae71('0xa1')](_0x44bbac,_0x4cd0ec,_0x3b5e94))[_0xae71('0x85')](logger[_0xae71('0x57')](_0xae71('0xff')));};Preview[_0xae71('0xe')][_0xae71('0xaf')]=function(_0x263754,_0x58cb21,_0x23b9fa){return Promise[_0xae71('0x100')]()[_0xae71('0x7c')](cmHopperAdditionalPhone[_0xae71('0xaf')](_0x263754,_0x58cb21,_0x23b9fa))[_0xae71('0x85')](logger['info'](_0xae71('0x101')));};Preview[_0xae71('0xe')][_0xae71('0xad')]=function(_0x1331ea){return Promise['resolve']()[_0xae71('0x7c')](cmHopperAdditionalPhone[_0xae71('0xad')](_0x1331ea))[_0xae71('0x85')](logger[_0xae71('0x57')]('[incrementPreviewCounters]\x20'));};Preview[_0xae71('0xe')]['checkInBlack']=function(_0x4bd9f2,_0x1c898d,_0x37c1ca,_0x26bc13,_0x3de370){var _0x50f9e2=this;return new Promise(function(_0x312dfb,_0x5f4863){if(_[_0xae71('0x68')](_0x1c898d)||_['isNil'](_0x1c898d[_0xae71('0x102')])||_[_0xae71('0x68')](_0x1c898d[_0xae71('0x103')])||_[_0xae71('0x68')](_0x1c898d[_0xae71('0x104')])){_0x5f4863(ut[_0xae71('0x49')]('Contact\x20is\x20undefined',_0x26bc13,_0x3de370));return;}var _0x39a9af=uuid['v4']();var _0x158897=_0x50f9e2[_0xae71('0x11')][_0x1c898d['Queue'][_0xae71('0x25')]];var _0x878cdf=_0x37c1ca?_0x50f9e2[_0xae71('0x14')][_0x37c1ca]['id']:undefined;_0x50f9e2[_0xae71('0x69')][_0x39a9af]=new Action(_0x1c898d,_0x158897,_0x39a9af,_0x37c1ca,_0x878cdf);var _0x3c2f67=_0x50f9e2[_0xae71('0x69')][_0x39a9af];_0x3c2f67[_0xae71('0xab')]=_0x26bc13;_0x3c2f67[_0xae71('0xc8')]=_0x3de370;_0x3c2f67[_0xae71('0x105')]=_0x37c1ca;if(_[_0xae71('0x106')](_0x4bd9f2)){_0x50f9e2[_0xae71('0x107')](_0x3c2f67,_0x158897,_0x1c898d,_0x37c1ca)[_0xae71('0x7c')](function(_0x385a2c){logger[_0xae71('0x57')](_0xae71('0x108'),_0xae71('0x109')+_0x3c2f67[_0xae71('0x6d')]+_0xae71('0x10a')+_0x3c2f67['idContact'],JSON[_0xae71('0x6c')](_0x385a2c));ami[_0xae71('0x59')](_0xae71('0x10b'),ut[_0xae71('0x9f')](_0x3c2f67,_0xae71('0x10c'),_0x50f9e2['campaignsPreview'][_0x3c2f67[_0xae71('0x6d')]]));_0x312dfb(ut[_0xae71('0x49')](_0xae71('0x10d')));})['catch'](function(_0x43b4e8){ut[_0xae71('0x5c')](_0xae71('0x10e'),_0x43b4e8);_0x5f4863(ut['message'](_0xae71('0x10f'),_0x26bc13,_0x3de370));});}else{_0x158897[_0xae71('0x36')]+=0x1;ut['logBlacklist'](_0x3c2f67);rpcDb[_0xae71('0x110')](_0x3c2f67,_0xae71('0x111'));delete _0x50f9e2[_0xae71('0x69')][_0x39a9af];_0x5f4863(ut['message']('Contact\x20in\x20black\x20List',_0x26bc13,_0x3de370));}});};Preview[_0xae71('0xe')][_0xae71('0x98')]=function(_0x233cff){return!_[_0xae71('0x68')](_0x233cff)&&!_['isNil'](_0x233cff[_0xae71('0x25')])&&!_['isNil'](_0x233cff['active'])&&_0x233cff[_0xae71('0x52')]&&!_[_0xae71('0x68')](this['trunks'][util[_0xae71('0x55')]('SIP/%s',_0x233cff['name'])])&&!_[_0xae71('0x68')](this['trunks'][util['format'](_0xae71('0x112'),_0x233cff['name'])][_0xae71('0x73')])&&(this[_0xae71('0x13')][util['format'](_0xae71('0x112'),_0x233cff[_0xae71('0x25')])][_0xae71('0x73')]===_0xae71('0x113')||this[_0xae71('0x13')][util[_0xae71('0x55')](_0xae71('0x112'),_0x233cff['name'])][_0xae71('0x73')]==='unmonitored');};Preview[_0xae71('0xe')][_0xae71('0x83')]=function(_0x2f1c9f,_0x2bd5b8){var _0x4bf12d=this;return new Promise(function(_0x1cf876,_0xec6bfa){_0x4bf12d['execRun'](_0x2f1c9f,_0x2bd5b8)[_0xae71('0x7c')](function(_0x55a343){_0x1cf876(_['pick'](_0x55a343,[_0xae71('0x49')]));})[_0xae71('0x85')](function(_0xce1ea4){if(_0xce1ea4[_0xae71('0x114')]){rpcDb[_0xae71('0x115')](_0x2f1c9f);}if(_0xce1ea4[_0xae71('0x52')]){rpcDb[_0xae71('0x87')](_0x2f1c9f);}_0xec6bfa(_[_0xae71('0x116')](_0xce1ea4,[_0xae71('0x49')]));});});};Preview[_0xae71('0xe')][_0xae71('0x117')]=function(_0x52dafb,_0x355a0f){var _0xb78ab8=this;return new Promise(function(_0x3acfc4,_0x31034d){var _0x1b7c58,_0x88b1e3;rpcDb[_0xae71('0x118')](_0x52dafb)[_0xae71('0x7c')](function(_0x3534a9){if(!_[_0xae71('0x68')](_0x3534a9[0x0])){_0x88b1e3=_0x3534a9[0x0][_0xae71('0x119')]?![]:!![];_0x1b7c58=_0x3534a9[0x0][_0xae71('0x119')]?!![]:![];_0x1b7c58=_0x355a0f?!![]:_0x1b7c58;}var _0x4b5c44=_0xb78ab8['validateContact'](_0x3534a9);if(_0x4b5c44[_0xae71('0x11a')]){rpcDb[_0xae71('0x11b')](_['pick'](_0x3534a9[0x0],['VoiceQueueId',_0xae71('0x103')]))[_0xae71('0x7c')](function(_0x170156){_0xb78ab8['checkInBlack'](_0x170156,_0x3534a9[0x0],_0x355a0f,_0x88b1e3,_0x1b7c58)[_0xae71('0x7c')](function(_0x3afe67){_0x3acfc4(_0x3afe67);})[_0xae71('0x85')](function(_0x1750fa){_0x31034d(_0x1750fa);});})[_0xae71('0x85')](function(_0x2f8ae4){ut['logger']('[Preview][checkIsBlackList]',_0x2f8ae4);_0x31034d(ut[_0xae71('0x49')]('Call\x20unsuccessful',_0x88b1e3,_0x1b7c58));});}else{_0x31034d(ut['message'](_0x4b5c44[_0xae71('0x49')],_0x88b1e3,_0x1b7c58));}})[_0xae71('0x85')](function(_0x1c5331){ut[_0xae71('0x5c')](_0xae71('0x11c'),_0x1c5331);_0x31034d(ut[_0xae71('0x49')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xae71('0xe')][_0xae71('0x11d')]=function(_0x402e57){if(_['isNil'](_0x402e57)||_[_0xae71('0x106')](_0x402e57)||!_[_0xae71('0x68')](_0x402e57[0x0][_0xae71('0x81')])&&_[_0xae71('0x68')](_0x402e57[0x0][_0xae71('0x81')][_0xae71('0x25')])){ut['logger'](_0xae71('0x11e'),_0x402e57);return{'isValid':![],'message':_0xae71('0x11f')};}var _0x48962d=this[_0xae71('0x11')][_0x402e57[0x0]['Queue']['name']];_0x48962d[_0xae71('0x49')]=_0xae71('0x9b');if(_['isNil'](_0x48962d)){ut[_0xae71('0x5c')](_0xae71('0x120'),_0x48962d);return{'isValid':![],'message':_0xae71('0x121')};}if(!this['isTrunkReachable'](_0x48962d['Trunk'])){ut[_0xae71('0x5c')](_0xae71('0x122'),_0xae71('0x123')+_0x48962d[_0xae71('0x25')]+_0xae71('0x124'));if(!this['isTrunkReachable'](_0x48962d[_0xae71('0x99')])){ut[_0xae71('0x5c')](_0xae71('0x122'),_0x48962d['name']+_0xae71('0x125'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xae71('0x97')](_0x48962d['dialActive'])){ut[_0xae71('0x5c')](_0xae71('0x126'),_0x48962d[_0xae71('0x25')]+_0xae71('0x127'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x48962d['name']+_0xae71('0x127')};}return{'isValid':!![],'message':_0xae71('0x128')};};Preview[_0xae71('0xe')][_0xae71('0x107')]=function(_0x4bf9c0,_0x147c8b,_0x222974,_0x282ee5){var _0x151e1a=this;return new Promise(function(_0x188c37,_0x4e6389){var _0x32f762=_0x4bf9c0['uniqueid'];var _0x4015c1=_0x151e1a[_0xae71('0x98')](_0x147c8b[_0xae71('0x51')])?util[_0xae71('0x55')](_0xae71('0x129'),_0x147c8b[_0xae71('0x51')]['name'],_[_0xae71('0x68')](_0x147c8b[_0xae71('0x34')])?'':_0x147c8b[_0xae71('0x34')][_0xae71('0x12a')]()||'',_0x147c8b[_0xae71('0x12b')]>0x0?_0x222974[_0xae71('0x103')]['substring'](_0x147c8b['dialCutDigit']):_0x222974[_0xae71('0x103')]):util[_0xae71('0x55')]('SIP/%s/%s%s',_[_0xae71('0x68')](_0x147c8b[_0xae71('0x99')])?_0x147c8b['Trunk'][_0xae71('0x25')]:_0x147c8b['TrunkBackup'][_0xae71('0x25')],_[_0xae71('0x68')](_0x147c8b[_0xae71('0x34')])?'':_0x147c8b[_0xae71('0x34')][_0xae71('0x12a')]()||'',_0x147c8b[_0xae71('0x12b')]>0x0?_0x222974[_0xae71('0x103')][_0xae71('0x12c')](_0x147c8b[_0xae71('0x12b')]):_0x222974[_0xae71('0x103')]);var _0x433257=_0x151e1a[_0xae71('0x98')](_0x147c8b['Trunk'])?ut[_0xae71('0x12d')](_0x147c8b[_0xae71('0x51')]['callerid'],_0x147c8b[_0xae71('0x12e')],_0x147c8b[_0xae71('0x12f')]>0x0?ut['getCallerIdRandom'](_0x147c8b[_0xae71('0x32')],_0x147c8b['dialRandomLastDigitCallerIdNumber']):_0x147c8b[_0xae71('0x32')]):ut[_0xae71('0x12d')](_[_0xae71('0x68')](_0x147c8b[_0xae71('0x99')])?_0x147c8b[_0xae71('0x51')][_0xae71('0x53')]:_0x147c8b[_0xae71('0x99')][_0xae71('0x53')],_0x147c8b[_0xae71('0x12e')],_0x147c8b[_0xae71('0x12f')]>0x0?ut['getCallerIdRandom'](_0x147c8b[_0xae71('0x32')],_0x147c8b['dialRandomLastDigitCallerIdNumber']):_0x147c8b[_0xae71('0x32')]);if(_0x433257){_0x4bf9c0[_0xae71('0x130')]=ut['extractCalleridName'](_0x433257);_0x4bf9c0['originatecalleridnum']=ut[_0xae71('0x131')](_0x433257);}var _0x5361fb=ut[_0xae71('0x132')](_0x147c8b,_0x222974,_0x4015c1,_0x433257,_0x32f762,_0x4bf9c0);_['merge'](_0x4bf9c0,ut[_0xae71('0x133')](_0x5361fb));_0x4bf9c0[_0xae71('0x88')]=moment()[_0xae71('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x147c8b[_0xae71('0x134')]=_0x5361fb;ami['Action'](ut['variablesAction'](_0x4bf9c0,_0x147c8b,_0x5361fb,_0x4bf9c0[_0xae71('0xc8')],_0x282ee5))[_0xae71('0x7c')](function(_0x34f172){_0x147c8b[_0xae71('0x4a')]+=0x1;logger[_0xae71('0x57')](_0xae71('0x135'),_0x32f762,'\x20Queue',_0x147c8b[_0xae71('0x25')],_0xae71('0x6b'),_0x147c8b[_0xae71('0x4a')]);_0x188c37(_0x34f172);})[_0xae71('0x85')](function(_0x2516fb){ut[_0xae71('0xf4')](_0x4bf9c0,0xe,_0xae71('0x136'));rpcDb['createAgentHistory'](_0x4bf9c0,_0xae71('0x137'));_0x4e6389(_0x2516fb);});});};Preview[_0xae71('0xe')]['syncNewExten']=function(_0x36431d){if(this[_0xae71('0x69')][_0x36431d[_0xae71('0xac')]]){this['actions'][_0x36431d[_0xae71('0xac')]][_0xae71('0x74')]=_0x36431d[_0xae71('0x74')];}};Preview[_0xae71('0xe')][_0xae71('0x17')]=function(_0x3100b8){var _0x2bff61=this;var _0x4b72f2=this[_0xae71('0x69')][_0x3100b8[_0xae71('0x138')]];if(_0x4b72f2){if(_0x4b72f2['lookAgent']&&this['agents'][_0x4b72f2[_0xae71('0x105')]]){ut[_0xae71('0x139')](_0x4b72f2,this['agents'][_0x4b72f2['lookAgent']][_0xae71('0x25')],this[_0xae71('0x14')][_0x4b72f2[_0xae71('0x105')]]['id']);}var _0xefb7e4=_[_0xae71('0x13a')](_0x4b72f2);_0xefb7e4[_0xae71('0xb1')]=moment()[_0xae71('0x55')](_0xae71('0x89'));var _0x472495=_0x2bff61[_0xae71('0x11')][_0x4b72f2[_0xae71('0x6d')]];if(ut[_0xae71('0x13b')](_0x3100b8['response'])){if(_0x4b72f2['unlockAgent']){rpcDb[_0xae71('0x115')](_0x4b72f2[_0xae71('0xae')]);}if(_0x4b72f2[_0xae71('0xc8')]){rpcDb[_0xae71('0x87')](_0x4b72f2[_0xae71('0xae')]);}ami[_0xae71('0x59')]('custom:agentringnoanswer',ut['buildObj'](_0x4b72f2,_0xae71('0x13c'),this[_0xae71('0x11')][_0x4b72f2['queue']]));this['callProgressDetectingAgent'](_0xefb7e4,_0x472495,_0x3100b8);}else{_0x4b72f2[_0xae71('0x88')]=moment()[_0xae71('0x55')](_0xae71('0x89'));ut[_0xae71('0xf4')](_0xefb7e4,0x4,_0xae71('0xbd'));rpcDb[_0xae71('0xf7')](_0xefb7e4,_0xae71('0x13d'));}}};Preview[_0xae71('0xe')][_0xae71('0x13e')]=function(_0x2c2301){var _0x85cd98=this[_0xae71('0x69')][_0x2c2301[_0xae71('0xac')]];var _0x10000b;if(_0x85cd98){_0x10000b=this[_0xae71('0x11')][_0x85cd98[_0xae71('0x6d')]];logger['info']('[syncHangup][talking]',_0x2c2301[_0xae71('0xac')],'\x20Queue',_0x10000b['name'],_0xae71('0xb5'),_0x10000b[_0xae71('0x28')]);}if(this['actions'][_0x2c2301['linkedid']]&&_0x2c2301[_0xae71('0xac')]!==_0x2c2301[_0xae71('0xc0')]){if(_0x2c2301[_0xae71('0x13f')]==='16'&&this[_0xae71('0x69')][_0x2c2301['linkedid']]['dialAnswer']){this[_0xae71('0x140')](_0x2c2301,_0x2c2301[_0xae71('0xac')],_0x2c2301[_0xae71('0x13f')]);}else if(this[_0xae71('0x69')][_0x2c2301[_0xae71('0xac')]][_0xae71('0x6e')]){logger[_0xae71('0x57')]('[syncHangup][talking][cause]',_0x2c2301['linkedid'],_0x2c2301[_0xae71('0x13f')],_0xae71('0xb4'),_0x10000b[_0xae71('0x25')],_0xae71('0xb5'),_0x10000b[_0xae71('0x28')]);this[_0xae71('0x140')](_0x2c2301,_0x2c2301['linkedid'],_0x2c2301['cause']);}}else if(_0x85cd98&&_['isNil'](_0x85cd98[_0xae71('0x141')])&&_0x10000b[_0xae71('0x142')]&&_0x2c2301[_0xae71('0xac')]===_0x2c2301[_0xae71('0xc0')]&&_['isNil'](_0x2c2301[_0xae71('0xf3')])&&_0x2c2301[_0xae71('0x13f')]==='16'&&_0x2c2301[_0xae71('0x143')]==='6'&&_[_0xae71('0xf1')](_0x85cd98['transfer'])){if(_0x85cd98[_0xae71('0xab')]){rpcDb[_0xae71('0x115')](_0x85cd98[_0xae71('0xae')]);}if(_0x85cd98[_0xae71('0xc8')]){rpcDb[_0xae71('0x87')](_0x85cd98[_0xae71('0xae')]);}_0x2c2301[_0xae71('0xf3')]='22';this[_0xae71('0xf0')](_0x85cd98,_0x10000b,_0x2c2301);}else if(_0x85cd98&&_0x85cd98[_0xae71('0x144')]){if(_0x2c2301[_0xae71('0x13f')]==='16'&&this[_0xae71('0x69')][_0x2c2301[_0xae71('0xac')]][_0xae71('0x6e')]){logger[_0xae71('0x57')]('[syncHangup][talking][transfer]',_0x2c2301[_0xae71('0xac')],_0x2c2301[_0xae71('0x13f')],_0xae71('0xb4'),_0x10000b[_0xae71('0x25')],_0xae71('0xb5'),_0x10000b[_0xae71('0x28')]);this['callProgressDetectingCustomer'](_0x2c2301,_0x2c2301[_0xae71('0xac')],_0x2c2301[_0xae71('0x13f')]);}else if(this['actions'][_0x2c2301['linkedid']][_0xae71('0x6e')]){logger[_0xae71('0x57')](_0xae71('0x145'),_0x2c2301[_0xae71('0xac')],_0x2c2301['cause'],'\x20Queue',_0x10000b[_0xae71('0x25')],'pTalking:\x20',_0x10000b['pTalking']);this['callProgressDetectingCustomer'](_0x2c2301,_0x2c2301[_0xae71('0xac')],_0x2c2301[_0xae71('0x13f')]);}}};Preview['prototype'][_0xae71('0x1c')]=function(_0x1eb3fe){if(this['actions'][_0x1eb3fe[_0xae71('0xef')]]&&_0x1eb3fe[_0xae71('0xef')]!==_0x1eb3fe[_0xae71('0x146')]){this[_0xae71('0x140')](_0x1eb3fe,_0x1eb3fe[_0xae71('0xef')],_0x1eb3fe[_0xae71('0xe6')]);}};Preview['prototype'][_0xae71('0x1b')]=function(_0x535efc){if(this[_0xae71('0x69')][_0x535efc[_0xae71('0xac')]]&&_0x535efc['linkedid']!==_0x535efc['uniqueid']&&!this[_0xae71('0x69')][_0x535efc['linkedid']]['dialAnswer']){if(_0x535efc[_0xae71('0x13f')]==='1'){this[_0xae71('0x140')](_0x535efc,_0x535efc[_0xae71('0xac')],_0x535efc[_0xae71('0x13f')]);}}};Preview[_0xae71('0xe')]['addVariable']=function(_0x5ed107,_0x17a7e9,_0x297373){if(this['actions'][_0x5ed107]){if(_[_0xae71('0x68')](this[_0xae71('0x69')][_0x5ed107][_0xae71('0x134')])){this['actions'][_0x5ed107][_0xae71('0x134')]={};}this[_0xae71('0x69')][_0x5ed107][_0xae71('0x134')][_0x17a7e9]=_0x297373;}};Preview['prototype']['syncVarSet']=function(_0x4da613){try{if(!_[_0xae71('0x68')](_0x4da613)){if(ut['filterKey'](_[_0xae71('0x147')](_0x4da613['variable'])[0x0])){this['addVariable'](_0x4da613[_0xae71('0xc0')],_[_0xae71('0x147')](_0x4da613[_0xae71('0x148')])[0x0],_0x4da613[_0xae71('0x149')]);}}}catch(_0x5d750a){logger['error'](_0xae71('0x14a'),util[_0xae71('0x14b')](_0x5d750a,{'showHidden':![],'depth':null}));}};Preview[_0xae71('0xe')][_0xae71('0x20')]=function(_0x14fe3b){if(_0x14fe3b){if(this['actions'][_0x14fe3b['transfertargetlinkedid']]){this[_0xae71('0x69')][_0x14fe3b[_0xae71('0x14c')]][_0xae71('0x144')]=!![];}}};Preview['prototype'][_0xae71('0x22')]=function(_0x59b313){if(_0x59b313){if(this[_0xae71('0x69')][_0x59b313['transfererlinkedid']]){this['actions'][_0x59b313[_0xae71('0x14d')]][_0xae71('0x144')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x9f4c=['outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','outbound','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','sequence','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','countnosuchnumberretry','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','activeContact','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentcomplete','decrementTalkink','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','linkedid','countbusyretry','countglobal','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','additional','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','unlockAgent','congestion','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','checkInBlack','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','TrunkBackup','getCallerId','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','[originated][increment]','OriginateError','logLookAgent','clone','isFailure','custom:agentringnoanswer','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','disableContact','[syncHangup][talking][cause]','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','transfer','exports','util','uuid','md5','ioredis','preview','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','name','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay'];(function(_0x7713c1,_0xd3f22b){var _0x5d25e6=function(_0xd5f315){while(--_0xd5f315){_0x7713c1['push'](_0x7713c1['shift']());}};_0x5d25e6(++_0xd3f22b);}(_0x9f4c,0x10b));var _0xc9f4=function(_0x52ad49,_0xc54a06){_0x52ad49=_0x52ad49-0x0;var _0x4b1bf3=_0x9f4c[_0x52ad49];return _0x4b1bf3;};'use strict';var util=require(_0xc9f4('0x0'));var _=require('lodash');var uuid=require(_0xc9f4('0x1'));var moment=require('moment');var md5=require(_0xc9f4('0x2'));var Redis=require(_0xc9f4('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xc9f4('0x4'));var loggerAction=require(_0xc9f4('0x5'))(_0xc9f4('0x6'));var ami=require('../ami');var rpcDb=require(_0xc9f4('0x7'));var cmHopperAdditionalPhone=require(_0xc9f4('0x8'));var Action=require(_0xc9f4('0x9'));var ut=require(_0xc9f4('0xa'));config[_0xc9f4('0xb')]=_['defaults'](config[_0xc9f4('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc9f4('0xb')]));var Sequence=function(){};Sequence[_0xc9f4('0xc')][_0xc9f4('0xd')]=function(_0x213116){this[_0xc9f4('0xe')]=this['tail']?this[_0xc9f4('0xe')][_0xc9f4('0xf')](_0x213116):_0x213116();};function Preview(_0x323836){this['sequence']=new Sequence();this[_0xc9f4('0x10')]=_0x323836[_0xc9f4('0x11')];this['trunks']=_0x323836[_0xc9f4('0x12')];this[_0xc9f4('0x13')]={};this[_0xc9f4('0x14')]=_0x323836['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xc9f4('0x15'),this[_0xc9f4('0x16')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x18'),this[_0xc9f4('0x19')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x1a'),this[_0xc9f4('0x1b')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x1c'),this[_0xc9f4('0x1d')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x1e'),this[_0xc9f4('0x1f')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x20'),this[_0xc9f4('0x21')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x22'),this[_0xc9f4('0x23')]['bind'](this));ami['on']('blindtransfer',this[_0xc9f4('0x24')]['bind'](this));this[_0xc9f4('0x25')](this[_0xc9f4('0x10')]);}function emit(_0x21645a,_0x580bcd,_0x281128){io['to'](_0x21645a)[_0xc9f4('0x26')](_0x580bcd,_0x281128);}function emitCampaignPreview(_0x3f43d5){if(_0x3f43d5[_0xc9f4('0x27')]==='outbound'){var _0x2f8ee9={'id':_0x3f43d5['id'],'name':_0x3f43d5[_0xc9f4('0x28')],'strategy':_0x3f43d5['strategy'],'answered':_0x3f43d5[_0xc9f4('0x29')],'available':_0x3f43d5[_0xc9f4('0x2a')],'loggedIn':_0x3f43d5[_0xc9f4('0x2b')],'pTalking':_0x3f43d5[_0xc9f4('0x2c')],'sumBillable':_0x3f43d5[_0xc9f4('0x2d')],'sumDuration':_0x3f43d5['sumDuration'],'sumHoldTime':_0x3f43d5[_0xc9f4('0x2e')]||0x0,'talking':_0x3f43d5[_0xc9f4('0x2f')],'total':_0x3f43d5[_0xc9f4('0x30')],'type':_0x3f43d5[_0xc9f4('0x27')],'unmanaged':_0x3f43d5[_0xc9f4('0x31')],'abandoned':_0x3f43d5[_0xc9f4('0x32')],'waiting':_0x3f43d5[_0xc9f4('0x33')],'loggedInDb':_0x3f43d5[_0xc9f4('0x34')],'dialActive':_0x3f43d5[_0xc9f4('0x35')],'dialMethod':_0x3f43d5[_0xc9f4('0x36')],'dialOriginateCallerIdName':_0x3f43d5[_0xc9f4('0x37')],'dialOriginateCallerIdNumber':_0x3f43d5[_0xc9f4('0x38')],'dialOriginateTimeout':_0x3f43d5[_0xc9f4('0x39')],'dialPrefix':_0x3f43d5[_0xc9f4('0x3a')],'outboundAnswerAgiCallsDay':_0x3f43d5[_0xc9f4('0x3b')],'outboundAnswerCallsDay':_0x3f43d5[_0xc9f4('0x3c')],'outboundBlacklistCallsDay':_0x3f43d5[_0xc9f4('0x3d')],'outboundBusyCallsDay':_0x3f43d5[_0xc9f4('0x3e')],'outboundCongestionCallsDay':_0x3f43d5[_0xc9f4('0x3f')],'outboundDropCallsDayACS':_0x3f43d5[_0xc9f4('0x40')],'outboundDropCallsDayCallersExit':_0x3f43d5[_0xc9f4('0x41')],'outboundDropCallsDayTimeout':_0x3f43d5['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3f43d5['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3f43d5[_0xc9f4('0x42')],'outboundOriginateFailureCallsDay':_0x3f43d5['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3f43d5[_0xc9f4('0x43')],'outboundRejectCallsDay':_0x3f43d5[_0xc9f4('0x44')],'outboundUnknownCallsDay':_0x3f43d5[_0xc9f4('0x45')],'outboundAbandonedCallsDay':_0x3f43d5[_0xc9f4('0x46')],'predictiveIntervalAnsweredCalls':_0x3f43d5['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3f43d5['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3f43d5['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3f43d5[_0xc9f4('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x3f43d5['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3f43d5[_0xc9f4('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f43d5['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3f43d5[_0xc9f4('0x49')],'predictiveIntervalMultiplicativeFactor':_0x3f43d5[_0xc9f4('0x4a')],'predictiveIntervalPauses':_0x3f43d5[_0xc9f4('0x4b')],'predictiveIntervalAvailable':_0x3f43d5['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3f43d5[_0xc9f4('0x4c')],'message':_0x3f43d5[_0xc9f4('0x4d')],'originated':_0x3f43d5[_0xc9f4('0x4e')],'erlangCalls':_0x3f43d5[_0xc9f4('0x4f')],'erlangCallToSecond':_0x3f43d5['erlangCallToSecond'],'erlangAbandonmentRate':_0x3f43d5[_0xc9f4('0x50')],'erlangBusyFactor':_0x3f43d5['erlangBusyFactor'],'startPredictive':_0x3f43d5[_0xc9f4('0x51')],'startProgressive':_0x3f43d5[_0xc9f4('0x52')]};if(_0x3f43d5[_0xc9f4('0x53')]){_0x2f8ee9[_0xc9f4('0x53')]={'id':_0x3f43d5[_0xc9f4('0x53')]['id'],'name':_0x3f43d5[_0xc9f4('0x53')][_0xc9f4('0x28')],'active':_0x3f43d5[_0xc9f4('0x53')][_0xc9f4('0x54')],'callerid':_0x3f43d5[_0xc9f4('0x53')][_0xc9f4('0x55')]};}if(_0x3f43d5['Interval']){_0x2f8ee9[_0xc9f4('0x56')]={'id':_0x3f43d5[_0xc9f4('0x56')]['id'],'name':_0x3f43d5[_0xc9f4('0x56')][_0xc9f4('0x28')]};}var _0x4ae484=md5(JSON['stringify'](_0x2f8ee9));if(_0x3f43d5[_0xc9f4('0x2')]!==_0x4ae484){_0x3f43d5[_0xc9f4('0x2')]=_0x4ae484;emit(util[_0xc9f4('0x57')](_0xc9f4('0x58'),_0x2f8ee9[_0xc9f4('0x28')]),_0xc9f4('0x59'),_0x2f8ee9);}}}function emitVoiceQueueChannelRemove(_0x3257a0){logger['info'](_0xc9f4('0x5a'),JSON[_0xc9f4('0x5b')](_0x3257a0));emit(util[_0xc9f4('0x57')]('voice:queue:%s',_0x3257a0['name']),'voice_queue_channel:remove',_0x3257a0);io[_0xc9f4('0x26')](_0xc9f4('0x5c'),_0x3257a0);}function notSendMessagesQueue(_0x8d7d7a){if(_0x8d7d7a[_0xc9f4('0x5d')]){if(_0x8d7d7a[_0xc9f4('0x4e')]===0x0&&_0x8d7d7a[_0xc9f4('0x2c')]===0x0){_0x8d7d7a['sendMessageOneNotActive']=![];_0x8d7d7a[_0xc9f4('0x2a')]=0x0;_0x8d7d7a[_0xc9f4('0x5e')]=0x0;_0x8d7d7a[_0xc9f4('0x4d')]=_0xc9f4('0x5f');ut[_0xc9f4('0x60')](_0xc9f4('0x61'),_0x8d7d7a[_0xc9f4('0x28')]+_0xc9f4('0x62'));}else{_0x8d7d7a[_0xc9f4('0x4d')]=_0xc9f4('0x63');ut[_0xc9f4('0x60')](_0xc9f4('0x61'),_0x8d7d7a[_0xc9f4('0x28')]+_0xc9f4('0x64'));}emitCampaignPreview(_0x8d7d7a);}}Preview[_0xc9f4('0xc')]['loopCampaigns']=function(){var _0x37711f=this;setInterval(function(){_0x37711f[_0xc9f4('0x65')]();},0x7cf);};Preview[_0xc9f4('0xc')][_0xc9f4('0x65')]=function(){var _0x1b5f30=this[_0xc9f4('0x10')];this[_0xc9f4('0x66')]+=0x1;for(var _0x3f3d9b in _0x1b5f30){if(_0x1b5f30[_0xc9f4('0x67')](_0x3f3d9b)&&(_0x1b5f30[_0x3f3d9b]['dialMethod']===_0xc9f4('0x4')||_0x1b5f30[_0x3f3d9b][_0xc9f4('0x36')]==='booked')&&_0x1b5f30[_0x3f3d9b]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xc9f4('0x66')]=0x0;this['clearZombieChannels']();}}if(_0x1b5f30['hasOwnProperty'](_0x3f3d9b)&&_0x1b5f30[_0x3f3d9b]['dialMethod']===_0xc9f4('0x4')&&_0x1b5f30[_0x3f3d9b][_0xc9f4('0x27')]===_0xc9f4('0x68')){if(_0x1b5f30[_0x3f3d9b][_0xc9f4('0x35')]){this[_0xc9f4('0x69')](_0x1b5f30[_0x3f3d9b]);if(_0x1b5f30[_0x3f3d9b][_0xc9f4('0x6a')])this['recallMe'](_0x1b5f30[_0x3f3d9b]);}else{notSendMessagesQueue(_0x1b5f30[_0x3f3d9b]);}}}};Preview['prototype'][_0xc9f4('0x6b')]=function(_0x3fb6bd){var _0x1474c5=this;this[_0xc9f4('0x6c')][_0xc9f4('0xd')](function(){if(!_[_0xc9f4('0x6d')](_0x1474c5['actions'][_0x3fb6bd])){loggerAction[_0xc9f4('0x6e')](_0xc9f4('0x6f'),_0x3fb6bd,_0xc9f4('0x70'),_0x1474c5['actions'][_0x3fb6bd][_0xc9f4('0x71')],_0xc9f4('0x72'),JSON[_0xc9f4('0x5b')](_0x1474c5['campaignsPreview'][_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd]['queue']][_0xc9f4('0x4e')]),_0xc9f4('0x73'),JSON[_0xc9f4('0x5b')](_0x1474c5[_0xc9f4('0x10')][_0x1474c5['actions'][_0x3fb6bd][_0xc9f4('0x71')]]['pTalking']),JSON[_0xc9f4('0x5b')](_0x1474c5['actions'][_0x3fb6bd][_0xc9f4('0x74')]),JSON[_0xc9f4('0x5b')](_['pick'](_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd],['contactId',_0xc9f4('0x75'),_0xc9f4('0x76'),_0xc9f4('0x77')])));return ami[_0xc9f4('0x78')]({'action':_0xc9f4('0x79'),'channel':_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd][_0xc9f4('0x7a')]})[_0xc9f4('0x7b')](function(_0x4fb2e0){if(_0x4fb2e0[_0xc9f4('0x4d')]===_0xc9f4('0x7c')){setTimeout(function(){if(_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd]){ut['updateOriginated'](_0x1474c5['campaignsPreview'][_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd][_0xc9f4('0x71')]],_0xc9f4('0x7d'));if(_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd]['dialAnswer']===!![]){ut['decrementTalkink'](_0x1474c5[_0xc9f4('0x10')][_0x1474c5['actions'][_0x3fb6bd][_0xc9f4('0x71')]],_0xc9f4('0x7d'));ut[_0xc9f4('0x7e')](_0xc9f4('0x7f')+_0x3fb6bd,_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd][_0xc9f4('0x71')]);}ut[_0xc9f4('0x7e')]('[Dialer][checkChannel][Preview]'+_0x3fb6bd,_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd]['queue']);delete _0x1474c5[_0xc9f4('0x13')][_0x3fb6bd];}},0x2328);}});}});};Preview[_0xc9f4('0xc')][_0xc9f4('0x80')]=function(){var _0x5d95fa=this;loggerAction[_0xc9f4('0x6e')]('[action]',_['size'](this['actions']));for(var _0x341a83 in this[_0xc9f4('0x13')]){if(_0x5d95fa[_0xc9f4('0x13')][_0xc9f4('0x67')](_0x341a83)){_0x5d95fa[_0xc9f4('0x6b')](_0x341a83);}}};Preview[_0xc9f4('0xc')]['recallMe']=function(_0x2fbb1f){var _0x3c72a6=this;rpcDb[_0xc9f4('0x81')](_0x2fbb1f['id'],ut[_0xc9f4('0x82')](this[_0xc9f4('0x14')]))['then'](function(_0x1642ca){if(!_[_0xc9f4('0x6d')](_0x1642ca)){for(var _0x3ce567=0x0;_0x3ce567<_0x1642ca[_0xc9f4('0x83')];_0x3ce567+=0x1){if(ut[_0xc9f4('0x84')](_0x1642ca[_0x3ce567][_0xc9f4('0x85')])<_0x2fbb1f['dialRecallMeTimeout']*0x3c){if(_0x1642ca[_0x3ce567][_0xc9f4('0x86')]&&!_0x1642ca[_0x3ce567][_0xc9f4('0x86')][_0xc9f4('0x87')]){_0x3c72a6[_0xc9f4('0x88')](_0x1642ca[_0x3ce567]['id'])[_0xc9f4('0x89')](ut[_0xc9f4('0x8a')](_0xc9f4('0x8b')))[_0xc9f4('0x7b')](ut['logger2'](_0xc9f4('0x8b')));}else{rpcDb['disableContact'](_0x1642ca[_0x3ce567]['id']);}}else{var _0x1ee7e8=new Action(_0x1642ca[_0x3ce567],_0x2fbb1f);_0x1ee7e8[_0xc9f4('0x8c')]=moment()[_0xc9f4('0x57')](_0xc9f4('0x8d'));_0x2fbb1f[_0xc9f4('0x43')]+=0x1;ut[_0xc9f4('0x8e')](_0x1ee7e8,0x17,_0xc9f4('0x8f'));if(_0x2fbb1f[_0xc9f4('0x90')]){rpcDb[_0xc9f4('0x91')](ut[_0xc9f4('0x92')](_0x1642ca[_0x3ce567]));rpcDb[_0xc9f4('0x93')](_0x1ee7e8,_0xc9f4('0x94'));}else{ut['logCustomer'](_0x1ee7e8,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x1ee7e8,'[HistoryRecallClose]');rpcDb[_0xc9f4('0x95')](_0x1ee7e8,_0xc9f4('0x96'));}}}}})[_0xc9f4('0x7b')](ut[_0xc9f4('0x8a')](_0xc9f4('0x97')));};Preview['prototype']['setMessage']=function(_0x42859b){_0x42859b[_0xc9f4('0x5d')]=!![];if(ut[_0xc9f4('0x98')](_0x42859b[_0xc9f4('0x2b')])){_0x42859b[_0xc9f4('0x4d')]=_0xc9f4('0x99');}else if(!ut['isActive'](_0x42859b[_0xc9f4('0x35')])){_0x42859b[_0xc9f4('0x4d')]=_0xc9f4('0x5f');}else if(!this[_0xc9f4('0x9a')](_0x42859b[_0xc9f4('0x53')])){if(!this[_0xc9f4('0x9a')](_0x42859b['TrunkBackup'])){_0x42859b['message']=_0xc9f4('0x9b');}else{_0x42859b[_0xc9f4('0x4d')]=_0xc9f4('0x9c');}}else{_0x42859b[_0xc9f4('0x4d')]='ACTIVE';}emitCampaignPreview(_0x42859b);};Preview[_0xc9f4('0xc')]['callProgressDetectingCustomer']=function(_0x2f43b1,_0x14c416,_0x2b816c){var _0x80fb98=this;var _0x2582d5=this['actions'][_0x14c416];var _0x24b44a=this['campaignsPreview'][_0x2582d5['queue']];var _0x7ff11a;var _0x27dc5f=![];var _0x1ccb78=0x2;var _0x308502=0x3;if(_0x24b44a){switch(_0x2b816c){case'1':_0x24b44a[_0xc9f4('0x42')]+=0x1;_0x2582d5['countnosuchnumberretry']+=0x1;_0x2582d5['countglobal']=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x0,_0xc9f4('0x9e'));ami['emit']('custom:agentnosuchnumber',ut[_0xc9f4('0x9f')](_0x2582d5,_0xc9f4('0xa0')));rpcDb[_0xc9f4('0x93')](_0x2582d5,_0xc9f4('0xa1'));_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'0',_0x24b44a)['then'](function(_0x2fb822){_0x27dc5f=_0x2fb822['additional']==0x1;_0x1ccb78=_0x24b44a[_0xc9f4('0xa3')];_0x308502=_0x24b44a['callAdditionalPhoneAfterMin'];if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,'Global');rpcDb[_0xc9f4('0x95')](_0x7ff11a,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2582d5[_0xc9f4('0xa6')]>=_0x24b44a[_0xc9f4('0xa7')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xa8'));}else{rpcDb['rescheduleContact'](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xa6'),_0x24b44a['dialNoSuchNumberRetryFrequency']),_0x2582d5['unlockAgent'],_0x2582d5[_0xc9f4('0xaa')]);}}delete this[_0xc9f4('0x13')][_0x2f43b1['linkedid']];}else{_0x2582d5[_0xc9f4('0xa6')]++;logger[_0xc9f4('0x6e')]('actioncountonusuch',_0x2582d5[_0xc9f4('0xa6')]);logger[_0xc9f4('0x6e')]('id',_0x2582d5[_0xc9f4('0xab')]);_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnosuchnumberretry':_0x2582d5['countnosuchnumberretry']}})[_0xc9f4('0x89')](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});break;case _0xc9f4('0xae'):var _0x500a45=moment()[_0xc9f4('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2582d5[_0xc9f4('0xaf')]=_0x500a45;_0x2582d5[_0xc9f4('0xb0')]=_0x500a45;_0x2582d5[_0xc9f4('0x74')]=!![];_0x24b44a[_0xc9f4('0x2c')]+=0x1;logger[_0xc9f4('0x6e')](_0xc9f4('0xb1'),_0x2582d5['uniqueid'],_0xc9f4('0xb2'),_0x24b44a[_0xc9f4('0x28')],_0xc9f4('0x73'),_0x24b44a['pTalking']);ami['emit'](_0xc9f4('0xb3'),ut[_0xc9f4('0x9f')](_0x2582d5,_0xc9f4('0xb4'),this[_0xc9f4('0x10')][_0x2582d5[_0xc9f4('0x71')]]));if(_0x24b44a[_0xc9f4('0xb5')]){ami[_0xc9f4('0x26')]('custom:agentConnectPreview',ut['buildAcw'](_0x2582d5));}break;case'16':ami[_0xc9f4('0x26')](_0xc9f4('0xb6'),ut[_0xc9f4('0x9f')](_0x2582d5,'complete',this[_0xc9f4('0x10')][_0x2582d5['queue']]));emitVoiceQueueChannelRemove(ut[_0xc9f4('0x9f')](_0x2582d5,'complete'));_0x24b44a[_0xc9f4('0x3c')]+=0x1;_0x24b44a[_0xc9f4('0x30')]+=0x1;_0x24b44a['answered']+=0x1;ut[_0xc9f4('0xb7')](_0x24b44a,'[16]');_0x2582d5['countglobal']=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x4,_0xc9f4('0xb8'));rpcDb[_0xc9f4('0x93')](_0x2582d5,_0xc9f4('0xb9'));rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xba'));rpcDb[_0xc9f4('0xbb')](_0x2582d5);_0x24b44a['sumDuration']+=_0x2582d5['talktime'];_0x24b44a[_0xc9f4('0x2d')]+=_0x2582d5[_0xc9f4('0xbc')];logger[_0xc9f4('0x6e')](_0xc9f4('0xbd'),_0x2582d5[_0xc9f4('0xbe')],'\x20Queue',_0x24b44a[_0xc9f4('0x28')],_0xc9f4('0x73'),_0x24b44a[_0xc9f4('0x2c')]);delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xbf')]];break;case'BUSY':_0x24b44a[_0xc9f4('0x3e')]+=0x1;_0x2582d5[_0xc9f4('0xc0')]+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut['totalGlobal'](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x5,_0xc9f4('0xc2'));_0x1ccb78=_0x24b44a[_0xc9f4('0xc3')];_0x308502=_0x24b44a[_0xc9f4('0xc4')];ami[_0xc9f4('0x26')](_0xc9f4('0xc5'),ut['buildObj'](_0x2582d5,'busy'));rpcDb['createCustomerHistory'](_0x2582d5,_0xc9f4('0xc6'));_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'5',_0x24b44a)[_0xc9f4('0x89')](function(_0xa09bd7){_0x27dc5f=_0xa09bd7['additional']==0x1;if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,'Global');rpcDb[_0xc9f4('0x95')](_0x7ff11a,_0xc9f4('0xc7'));}else{if(_0x2582d5[_0xc9f4('0xc0')]>=_0x24b44a[_0xc9f4('0xc8')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xc6'));}else{rpcDb[_0xc9f4('0xc9')](ut['scheduledAt'](_0x2582d5,_0xc9f4('0xc0'),_0x24b44a[_0xc9f4('0xc3')]),_0x2582d5['unlockAgent'],_0x2582d5[_0xc9f4('0xaa')]);}}}else{_0x2582d5[_0xc9f4('0xc0')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5['idContact'],'field':{'countbusyretry':_0x2582d5[_0xc9f4('0xc0')]}})['then'](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)['then'](function(){});});}});break;case _0xc9f4('0xca'):_0x24b44a[_0xc9f4('0xcb')]+=0x1;_0x2582d5[_0xc9f4('0xcc')]+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x3,_0xc9f4('0xcd'));_0x1ccb78=_0x24b44a[_0xc9f4('0xce')];_0x308502=_0x24b44a[_0xc9f4('0xc4')];var _0x56f8ec=ut['buildNoAnswerEventPayload'](_0x2582d5,_0x24b44a);ami['emit'](_0xc9f4('0xcf'),_0x56f8ec);rpcDb[_0xc9f4('0x93')](_0x2582d5,'[callProgressDetectingCustomer][logNoAnswer]');_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'3',_0x24b44a)[_0xc9f4('0x89')](function(_0x1f046c){_0x27dc5f=_0x1f046c[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut[_0xc9f4('0x9d')](_0x2582d5)>=_0x24b44a['dialGlobalMaxRetry']){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,_0xc9f4('0xd1'));rpcDb[_0xc9f4('0x95')](_0x7ff11a,_0xc9f4('0xd2'));}else{if(_0x2582d5[_0xc9f4('0xcc')]>=_0x24b44a[_0xc9f4('0xd3')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xcc'),_0x24b44a[_0xc9f4('0xce')]),_0x2582d5[_0xc9f4('0xd5')],_0x2582d5['activeContact']);}}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5['countnoanswerretry']}})[_0xc9f4('0x89')](function(){_0x80fb98['swapAdditionalPhones'](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});break;case'CONGESTION':_0x24b44a[_0xc9f4('0x3f')]+=0x1;_0x2582d5['countcongestionretry']+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x8,'Congestion');_0x1ccb78=_0x24b44a['dialCongestionRetryFrequency'];_0x308502=_0x24b44a[_0xc9f4('0xc4')];ami['emit']('custom:agentcongestion',ut[_0xc9f4('0x9f')](_0x2582d5,_0xc9f4('0xd6')));rpcDb['createCustomerHistory'](_0x2582d5,'[callProgressDetectingCustomer][logCongestion]');_0x80fb98['verifyAdditionalPhones'](_0x2582d5,'8',_0x24b44a)[_0xc9f4('0x89')](function(_0x2b981c){_0x27dc5f=_0x2b981c[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut[_0xc9f4('0x9d')](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,_0xc9f4('0xd1'));rpcDb[_0xc9f4('0x95')](_0x7ff11a,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2582d5[_0xc9f4('0xd7')]>=_0x24b44a[_0xc9f4('0xd8')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xd9'));}else{rpcDb[_0xc9f4('0xc9')](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xd7'),_0x24b44a['dialBusyRetryFrequency']),_0x2582d5[_0xc9f4('0xd5')],_0x2582d5[_0xc9f4('0xaa')]);}}}else{_0x2582d5[_0xc9f4('0xd7')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countcongestionretry':_0x2582d5[_0xc9f4('0xd7')]}})[_0xc9f4('0x89')](function(){_0x80fb98['swapAdditionalPhones'](_0x2582d5,_0x1ccb78,_0x308502)['then'](function(){});});}});break;case _0xc9f4('0xda'):_0x24b44a[_0xc9f4('0x44')]+=0x1;_0x2582d5[_0xc9f4('0xdb')]+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x14,_0xc9f4('0xdc'));_0x1ccb78=_0x24b44a[_0xc9f4('0xdd')];_0x308502=_0x24b44a[_0xc9f4('0xc4')];ami[_0xc9f4('0x26')](_0xc9f4('0xde'),ut['buildObj'](_0x2582d5,_0xc9f4('0xdf')));rpcDb[_0xc9f4('0x93')](_0x2582d5,_0xc9f4('0xe0'));_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'20',_0x24b44a)[_0xc9f4('0x89')](function(_0x9f64e1){_0x27dc5f=_0x9f64e1[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut[_0xc9f4('0x9d')](_0x2582d5)>=_0x24b44a['dialGlobalMaxRetry']){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0x14,_0xc9f4('0xdc'));rpcDb['createCustomerFinal'](_0x7ff11a,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2582d5['countagentrejectretry']>=_0x24b44a['dialAgentRejectMaxRetry']){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xe1'));}else{rpcDb[_0xc9f4('0xc9')](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xdb'),_0x24b44a['dialAgentRejectRetryFrequency']),_0x2582d5['unlockAgent'],_0x2582d5[_0xc9f4('0xaa')]);}}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5[_0xc9f4('0xcc')]}})[_0xc9f4('0x89')](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});break;case'ABANDONED':_0x24b44a[_0xc9f4('0x46')]+=0x1;_0x2582d5[_0xc9f4('0xe2')]+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0xb,_0xc9f4('0xe3'));rpcDb[_0xc9f4('0x93')](_0x2582d5,_0xc9f4('0xe4'));_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'11',_0x24b44a)[_0xc9f4('0x89')](function(_0x1b7ae4){_0x27dc5f=_0x1b7ae4[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,'Global');rpcDb[_0xc9f4('0x95')](_0x7ff11a,_0xc9f4('0xe4'));}else{if(_0x2582d5[_0xc9f4('0xe5')]>=_0x24b44a[_0xc9f4('0xe6')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xe4'));}else{rpcDb[_0xc9f4('0xc9')](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xe2'),_0x24b44a[_0xc9f4('0xe7')]),_0x2582d5[_0xc9f4('0xd5')],_0x2582d5[_0xc9f4('0xaa')]);}}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5[_0xc9f4('0xcc')]}})['then'](function(){_0x80fb98['swapAdditionalPhones'](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});break;case'18':_0x24b44a['outboundUnknownCallsDay']+=0x1;_0x2582d5['countmachineretry']+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x12,_0x2f43b1[_0xc9f4('0xe8')]||_0x2f43b1[_0xc9f4('0xe9')]);ami['emit']('custom:amd',ut[_0xc9f4('0x9f')](_0x2582d5,'amd'));rpcDb[_0xc9f4('0x93')](_0x2582d5,'[callProgressDetectingCustomer][hangupInAMD]');_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'18',_0x24b44a)['then'](function(_0x5e368f){_0x27dc5f=_0x5e368f['additional']==0x1;if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0x12,'Global');rpcDb['createCustomerFinal'](_0x7ff11a,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xc9f4('0x95')](_0x2582d5,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5[_0xc9f4('0xcc')]}})[_0xc9f4('0x89')](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});delete this[_0xc9f4('0x13')][_0x2f43b1['linkedid']];break;case'19':_0x24b44a[_0xc9f4('0x45')]+=0x1;_0x2582d5['countglobal']=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x13,_0x2f43b1[_0xc9f4('0xe8')]||_0x2f43b1[_0xc9f4('0xe9')]);ami[_0xc9f4('0x26')](_0xc9f4('0xea'),ut[_0xc9f4('0x9f')](_0x2582d5,_0xc9f4('0xeb')));rpcDb[_0xc9f4('0x93')](_0x2582d5,'[callProgressDetectingCustomer][machine]');_0x80fb98['verifyAdditionalPhones'](_0x2582d5,'18',_0x24b44a)[_0xc9f4('0x89')](function(_0x3122e5){_0x27dc5f=_0x3122e5[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,_0xc9f4('0xd1'));rpcDb[_0xc9f4('0x95')](_0x7ff11a,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xec'));}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98['incrementPreviewCounters']({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5[_0xc9f4('0xcc')]}})[_0xc9f4('0x89')](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xbf')]];break;default:if(_0x2582d5[_0xc9f4('0x74')]){ut[_0xc9f4('0xb7')](_0x24b44a,_0xc9f4('0xed'));ut[_0xc9f4('0x7e')](_0xc9f4('0xee')+_0x24b44a[_0xc9f4('0x28')],_0x2f43b1);}_0x24b44a['outboundUnknownCallsDay']+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut['totalGlobal'](_0x2582d5);ut['logCustomer'](_0x2582d5,0xc,_0x2f43b1[_0xc9f4('0xe8')]||_0x2f43b1['dialstatus']);_0x1ccb78=_0x24b44a['dialAgentRejectRetryFrequency'];_0x308502=_0x24b44a[_0xc9f4('0xc4')];rpcDb['createCustomerHistory'](_0x2582d5,'[callProgressDetectingCustomer][logUnknown]');_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'20',_0x24b44a)[_0xc9f4('0x89')](function(_0x4fa7e6){_0x27dc5f=_0x4fa7e6['additional']==0x1;if(!_0x27dc5f){if(ut[_0xc9f4('0x9d')](_0x2582d5)>=_0x24b44a['dialGlobalMaxRetry']){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,_0xc9f4('0xd1'));rpcDb[_0xc9f4('0x95')](_0x7ff11a,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xef'));}delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xbf')]];}else{_0x80fb98['swapAdditionalPhones'](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});}});}if(!(_0x2582d5[_0xc9f4('0x74')]&&_0x2b816c==='16')){ut[_0xc9f4('0xf0')](_0x24b44a,'[callProgressDetectingCustomer]');logger[_0xc9f4('0x6e')](_0xc9f4('0xf1'),_0x2582d5[_0xc9f4('0xbe')],'\x20Queue',_0x24b44a[_0xc9f4('0x28')],_0xc9f4('0x72'),_0x24b44a['originated']);}if(_0x2b816c!==_0xc9f4('0xae')){delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xbf')]];delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xf2')]];}}};Preview['prototype'][_0xc9f4('0xf3')]=function(_0x20888c,_0xef34db,_0x3dd490){if(_[_0xc9f4('0xf4')](_0xef34db)&&'object'!==typeof _0xef34db){return;}if(_[_0xc9f4('0xf4')](_0x3dd490)&&'object'!==typeof _0x3dd490){return;}switch(_0x3dd490[_0xc9f4('0xf5')]){case'0':ut['logAgent'](_0x20888c,0x0,_0xc9f4('0x9e'));rpcDb[_0xc9f4('0xf6')](_0x20888c,_0xc9f4('0xf7'));break;case'3':ut[_0xc9f4('0xf8')](_0x20888c,0x3,_0xc9f4('0xcd'));rpcDb[_0xc9f4('0xf6')](_0x20888c,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x20888c,0x5,_0xc9f4('0xc2'));rpcDb[_0xc9f4('0xf6')](_0x20888c,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xc9f4('0xf8')](_0x20888c,0x8,_0xc9f4('0xf9'));rpcDb[_0xc9f4('0xf6')](_0x20888c,_0xc9f4('0xfa'));break;case'22':ut[_0xc9f4('0xf8')](_0x20888c,0x16,_0xc9f4('0xfb'));rpcDb[_0xc9f4('0xf6')](_0x20888c,_0xc9f4('0xfc'));break;default:ut['logAgent'](_0x20888c,0xc,_0x3dd490[_0xc9f4('0xf5')]);rpcDb[_0xc9f4('0xf6')](_0x20888c,_0xc9f4('0xfa'));}ut[_0xc9f4('0xf0')](_0xef34db,_0xc9f4('0xfd'));logger[_0xc9f4('0x6e')](_0xc9f4('0xfe'),_0x20888c[_0xc9f4('0xbe')],'\x20Queue',_0xef34db[_0xc9f4('0x28')],_0xc9f4('0x72'),_0xef34db[_0xc9f4('0x4e')]);delete this[_0xc9f4('0x13')][_0x20888c[_0xc9f4('0xbe')]];};Preview[_0xc9f4('0xc')][_0xc9f4('0xa2')]=function(_0xbd503a,_0x5125db,_0x3b8ff0){return Promise['resolve']()[_0xc9f4('0x89')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0xbd503a,_0x5125db,_0x3b8ff0))[_0xc9f4('0x7b')](logger[_0xc9f4('0x6e')](_0xc9f4('0xff')));};Preview[_0xc9f4('0xc')][_0xc9f4('0xad')]=function(_0x2b00a8,_0x24afa7,_0x22c6f9){return Promise[_0xc9f4('0x100')]()[_0xc9f4('0x89')](cmHopperAdditionalPhone[_0xc9f4('0xad')](_0x2b00a8,_0x24afa7,_0x22c6f9))[_0xc9f4('0x7b')](logger[_0xc9f4('0x6e')](_0xc9f4('0x101')));};Preview[_0xc9f4('0xc')]['incrementPreviewCounters']=function(_0x355a18){return Promise[_0xc9f4('0x100')]()[_0xc9f4('0x89')](cmHopperAdditionalPhone[_0xc9f4('0xac')](_0x355a18))[_0xc9f4('0x7b')](logger[_0xc9f4('0x6e')]('[incrementPreviewCounters]\x20'));};Preview[_0xc9f4('0xc')][_0xc9f4('0x102')]=function(_0x37004e,_0x2b6104,_0x56fdc8,_0x1fb3fb,_0x31331a){var _0x3cc07e=this;return new Promise(function(_0x234ab5,_0x10592e){if(_[_0xc9f4('0x6d')](_0x2b6104)||_[_0xc9f4('0x6d')](_0x2b6104['Contact'])||_[_0xc9f4('0x6d')](_0x2b6104['phone'])||_[_0xc9f4('0x6d')](_0x2b6104['VoiceQueueId'])){_0x10592e(ut[_0xc9f4('0x4d')]('Contact\x20is\x20undefined',_0x1fb3fb,_0x31331a));return;}var _0x79d6a6=uuid['v4']();var _0x440ee4=_0x3cc07e['campaignsPreview'][_0x2b6104[_0xc9f4('0x70')][_0xc9f4('0x28')]];var _0x4817c6=_0x56fdc8?_0x3cc07e['agents'][_0x56fdc8]['id']:undefined;_0x3cc07e['actions'][_0x79d6a6]=new Action(_0x2b6104,_0x440ee4,_0x79d6a6,_0x56fdc8,_0x4817c6);var _0x2e0e6c=_0x3cc07e['actions'][_0x79d6a6];_0x2e0e6c['unlockAgent']=_0x1fb3fb;_0x2e0e6c[_0xc9f4('0xaa')]=_0x31331a;_0x2e0e6c[_0xc9f4('0x103')]=_0x56fdc8;if(_['isEmpty'](_0x37004e)){_0x3cc07e[_0xc9f4('0x104')](_0x2e0e6c,_0x440ee4,_0x2b6104,_0x56fdc8)[_0xc9f4('0x89')](function(_0x4840f3){logger['info'](_0xc9f4('0x105'),_0xc9f4('0x106')+_0x2e0e6c[_0xc9f4('0x71')]+_0xc9f4('0x107')+_0x2e0e6c['idContact'],JSON[_0xc9f4('0x5b')](_0x4840f3));ami[_0xc9f4('0x26')](_0xc9f4('0x108'),ut[_0xc9f4('0x9f')](_0x2e0e6c,_0xc9f4('0x109'),_0x3cc07e[_0xc9f4('0x10')][_0x2e0e6c[_0xc9f4('0x71')]]));_0x234ab5(ut[_0xc9f4('0x4d')](_0xc9f4('0x10a')));})[_0xc9f4('0x7b')](function(_0x160032){ut[_0xc9f4('0x60')](_0xc9f4('0x10b'),_0x160032);_0x10592e(ut[_0xc9f4('0x4d')](_0xc9f4('0x10c'),_0x1fb3fb,_0x31331a));});}else{_0x440ee4['outboundBlacklistCallsDay']+=0x1;ut[_0xc9f4('0x10d')](_0x2e0e6c);rpcDb[_0xc9f4('0x10e')](_0x2e0e6c,_0xc9f4('0x10f'));delete _0x3cc07e[_0xc9f4('0x13')][_0x79d6a6];_0x10592e(ut[_0xc9f4('0x4d')]('Contact\x20in\x20black\x20List',_0x1fb3fb,_0x31331a));}});};Preview[_0xc9f4('0xc')][_0xc9f4('0x9a')]=function(_0x5579cc){return!_[_0xc9f4('0x6d')](_0x5579cc)&&!_['isNil'](_0x5579cc['name'])&&!_[_0xc9f4('0x6d')](_0x5579cc[_0xc9f4('0x54')])&&_0x5579cc['active']&&!_['isNil'](this[_0xc9f4('0x12')][util['format']('SIP/%s',_0x5579cc[_0xc9f4('0x28')])])&&!_[_0xc9f4('0x6d')](this[_0xc9f4('0x12')][util[_0xc9f4('0x57')]('SIP/%s',_0x5579cc[_0xc9f4('0x28')])][_0xc9f4('0x79')])&&(this[_0xc9f4('0x12')][util[_0xc9f4('0x57')](_0xc9f4('0x110'),_0x5579cc['name'])][_0xc9f4('0x79')]==='reachable'||this['trunks'][util[_0xc9f4('0x57')](_0xc9f4('0x110'),_0x5579cc[_0xc9f4('0x28')])][_0xc9f4('0x79')]===_0xc9f4('0x111'));};Preview[_0xc9f4('0xc')][_0xc9f4('0x88')]=function(_0x2f42a2,_0x19a40d){var _0x183ddd=this;return new Promise(function(_0x55e08f,_0x403de7){_0x183ddd[_0xc9f4('0x112')](_0x2f42a2,_0x19a40d)[_0xc9f4('0x89')](function(_0x364738){_0x55e08f(_[_0xc9f4('0x113')](_0x364738,[_0xc9f4('0x4d')]));})[_0xc9f4('0x7b')](function(_0x267fb1){if(_0x267fb1[_0xc9f4('0x114')]){rpcDb[_0xc9f4('0x115')](_0x2f42a2);}if(_0x267fb1[_0xc9f4('0x54')]){rpcDb['disableContact'](_0x2f42a2);}_0x403de7(_[_0xc9f4('0x113')](_0x267fb1,[_0xc9f4('0x4d')]));});});};Preview[_0xc9f4('0xc')]['execRun']=function(_0x166667,_0x19fba2){var _0x2d7205=this;return new Promise(function(_0x27dc60,_0x454f28){var _0x2b92bc,_0x19a898;rpcDb[_0xc9f4('0x116')](_0x166667)['then'](function(_0x1df7c1){if(!_['isNil'](_0x1df7c1[0x0])){_0x19a898=_0x1df7c1[0x0][_0xc9f4('0x117')]?![]:!![];_0x2b92bc=_0x1df7c1[0x0][_0xc9f4('0x117')]?!![]:![];_0x2b92bc=_0x19fba2?!![]:_0x2b92bc;}var _0xf10c56=_0x2d7205['validateContact'](_0x1df7c1);if(_0xf10c56[_0xc9f4('0x118')]){rpcDb[_0xc9f4('0x119')](_[_0xc9f4('0x113')](_0x1df7c1[0x0],['VoiceQueueId',_0xc9f4('0x11a')]))[_0xc9f4('0x89')](function(_0x439e02){_0x2d7205[_0xc9f4('0x102')](_0x439e02,_0x1df7c1[0x0],_0x19fba2,_0x19a898,_0x2b92bc)[_0xc9f4('0x89')](function(_0x4b688a){_0x27dc60(_0x4b688a);})[_0xc9f4('0x7b')](function(_0x1f3e26){_0x454f28(_0x1f3e26);});})[_0xc9f4('0x7b')](function(_0x3285a3){ut[_0xc9f4('0x60')](_0xc9f4('0x11b'),_0x3285a3);_0x454f28(ut[_0xc9f4('0x4d')](_0xc9f4('0x11c'),_0x19a898,_0x2b92bc));});}else{_0x454f28(ut['message'](_0xf10c56[_0xc9f4('0x4d')],_0x19a898,_0x2b92bc));}})[_0xc9f4('0x7b')](function(_0x100114){ut[_0xc9f4('0x60')](_0xc9f4('0x11d'),_0x100114);_0x454f28(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0xc9f4('0xc')][_0xc9f4('0x11e')]=function(_0x264fa1){if(_[_0xc9f4('0x6d')](_0x264fa1)||_[_0xc9f4('0x11f')](_0x264fa1)||!_[_0xc9f4('0x6d')](_0x264fa1[0x0][_0xc9f4('0x86')])&&_[_0xc9f4('0x6d')](_0x264fa1[0x0]['Agent'][_0xc9f4('0x28')])){ut[_0xc9f4('0x60')](_0xc9f4('0x120'),_0x264fa1);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5a07e1=this[_0xc9f4('0x10')][_0x264fa1[0x0][_0xc9f4('0x70')][_0xc9f4('0x28')]];_0x5a07e1[_0xc9f4('0x4d')]=_0xc9f4('0x9c');if(_[_0xc9f4('0x6d')](_0x5a07e1)){ut[_0xc9f4('0x60')](_0xc9f4('0x121'),_0x5a07e1);return{'isValid':![],'message':_0xc9f4('0x122')};}if(!this['isTrunkReachable'](_0x5a07e1[_0xc9f4('0x53')])){ut['logger'](_0xc9f4('0x123'),_0xc9f4('0x124')+_0x5a07e1[_0xc9f4('0x28')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xc9f4('0x9a')](_0x5a07e1['TrunkBackup'])){ut[_0xc9f4('0x60')](_0xc9f4('0x123'),_0x5a07e1[_0xc9f4('0x28')]+_0xc9f4('0x125'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xc9f4('0x126')](_0x5a07e1[_0xc9f4('0x35')])){ut[_0xc9f4('0x60')](_0xc9f4('0x127'),_0x5a07e1[_0xc9f4('0x28')]+_0xc9f4('0x128'));return{'isValid':![],'message':_0xc9f4('0x124')+_0x5a07e1['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xc9f4('0x129')};};Preview[_0xc9f4('0xc')][_0xc9f4('0x104')]=function(_0x491403,_0x464e00,_0x455cd8,_0x265eef){var _0x184662=this;return new Promise(function(_0x1eaf9c,_0x73a75b){var _0x428222=_0x491403[_0xc9f4('0xbe')];var _0x486fe8=_0x184662[_0xc9f4('0x9a')](_0x464e00['Trunk'])?util[_0xc9f4('0x57')](_0xc9f4('0x12a'),_0x464e00[_0xc9f4('0x53')][_0xc9f4('0x28')],_[_0xc9f4('0x6d')](_0x464e00['dialPrefix'])?'':_0x464e00[_0xc9f4('0x3a')][_0xc9f4('0x12b')]()||'',_0x464e00['dialCutDigit']>0x0?_0x455cd8[_0xc9f4('0x11a')][_0xc9f4('0x12c')](_0x464e00[_0xc9f4('0x12d')]):_0x455cd8[_0xc9f4('0x11a')]):util['format'](_0xc9f4('0x12a'),_['isNil'](_0x464e00[_0xc9f4('0x12e')])?_0x464e00[_0xc9f4('0x53')][_0xc9f4('0x28')]:_0x464e00[_0xc9f4('0x12e')]['name'],_[_0xc9f4('0x6d')](_0x464e00[_0xc9f4('0x3a')])?'':_0x464e00['dialPrefix'][_0xc9f4('0x12b')]()||'',_0x464e00[_0xc9f4('0x12d')]>0x0?_0x455cd8['phone'][_0xc9f4('0x12c')](_0x464e00[_0xc9f4('0x12d')]):_0x455cd8[_0xc9f4('0x11a')]);var _0x522afc=_0x184662[_0xc9f4('0x9a')](_0x464e00[_0xc9f4('0x53')])?ut[_0xc9f4('0x12f')](_0x464e00[_0xc9f4('0x53')][_0xc9f4('0x55')],_0x464e00['dialOriginateCallerIdName'],_0x464e00['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x464e00[_0xc9f4('0x38')],_0x464e00[_0xc9f4('0x130')]):_0x464e00[_0xc9f4('0x38')]):ut[_0xc9f4('0x12f')](_[_0xc9f4('0x6d')](_0x464e00[_0xc9f4('0x12e')])?_0x464e00[_0xc9f4('0x53')][_0xc9f4('0x55')]:_0x464e00['TrunkBackup'][_0xc9f4('0x55')],_0x464e00[_0xc9f4('0x37')],_0x464e00[_0xc9f4('0x130')]>0x0?ut['getCallerIdRandom'](_0x464e00['dialOriginateCallerIdNumber'],_0x464e00[_0xc9f4('0x130')]):_0x464e00['dialOriginateCallerIdNumber']);if(_0x522afc){_0x491403['originatecalleridname']=ut[_0xc9f4('0x131')](_0x522afc);_0x491403[_0xc9f4('0x132')]=ut[_0xc9f4('0x133')](_0x522afc);}var _0x403ff2=ut[_0xc9f4('0x134')](_0x464e00,_0x455cd8,_0x486fe8,_0x522afc,_0x428222,_0x491403);_[_0xc9f4('0x135')](_0x491403,ut[_0xc9f4('0x136')](_0x403ff2));_0x491403[_0xc9f4('0x8c')]=moment()[_0xc9f4('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x464e00[_0xc9f4('0x137')]=_0x403ff2;ami[_0xc9f4('0x78')](ut['variablesAction'](_0x491403,_0x464e00,_0x403ff2,_0x491403[_0xc9f4('0xaa')],_0x265eef))[_0xc9f4('0x89')](function(_0x1bf036){_0x464e00[_0xc9f4('0x4e')]+=0x1;logger['info'](_0xc9f4('0x138'),_0x428222,'\x20Queue',_0x464e00[_0xc9f4('0x28')],'originated:\x20',_0x464e00[_0xc9f4('0x4e')]);_0x1eaf9c(_0x1bf036);})[_0xc9f4('0x7b')](function(_0x494f2a){ut[_0xc9f4('0xf8')](_0x491403,0xe,_0xc9f4('0x139'));rpcDb[_0xc9f4('0xf6')](_0x491403,'[originateFailure][logOriginateFailure]');_0x73a75b(_0x494f2a);});});};Preview['prototype'][_0xc9f4('0x1f')]=function(_0x121bbd){if(this['actions'][_0x121bbd[_0xc9f4('0xbf')]]){this['actions'][_0x121bbd['linkedid']][_0xc9f4('0x7a')]=_0x121bbd[_0xc9f4('0x7a')];}};Preview[_0xc9f4('0xc')]['syncOriginateResponse']=function(_0x686107){var _0x1feec3=this;var _0x489f1e=this['actions'][_0x686107['actionid']];if(_0x489f1e){if(_0x489f1e[_0xc9f4('0x103')]&&this['agents'][_0x489f1e[_0xc9f4('0x103')]]){ut[_0xc9f4('0x13a')](_0x489f1e,this[_0xc9f4('0x14')][_0x489f1e[_0xc9f4('0x103')]][_0xc9f4('0x28')],this[_0xc9f4('0x14')][_0x489f1e[_0xc9f4('0x103')]]['id']);}var _0x2a8034=_[_0xc9f4('0x13b')](_0x489f1e);_0x2a8034['responsetime']=moment()[_0xc9f4('0x57')](_0xc9f4('0x8d'));var _0x49f0da=_0x1feec3[_0xc9f4('0x10')][_0x489f1e[_0xc9f4('0x71')]];if(ut[_0xc9f4('0x13c')](_0x686107['response'])){if(_0x489f1e['unlockAgent']){rpcDb['unlockContact'](_0x489f1e[_0xc9f4('0xab')]);}if(_0x489f1e[_0xc9f4('0xaa')]){rpcDb['disableContact'](_0x489f1e[_0xc9f4('0xab')]);}ami[_0xc9f4('0x26')](_0xc9f4('0x13d'),ut[_0xc9f4('0x9f')](_0x489f1e,'rejected',this[_0xc9f4('0x10')][_0x489f1e['queue']]));this['callProgressDetectingAgent'](_0x2a8034,_0x49f0da,_0x686107);}else{_0x489f1e[_0xc9f4('0x8c')]=moment()['format'](_0xc9f4('0x8d'));ut[_0xc9f4('0xf8')](_0x2a8034,0x4,_0xc9f4('0xb8'));rpcDb[_0xc9f4('0xf6')](_0x2a8034,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xc9f4('0xc')]['syncHangup']=function(_0x251d7a){var _0x356406=this[_0xc9f4('0x13')][_0x251d7a['linkedid']];var _0x5d8bfe;if(_0x356406){_0x5d8bfe=this[_0xc9f4('0x10')][_0x356406[_0xc9f4('0x71')]];logger[_0xc9f4('0x6e')](_0xc9f4('0x13e'),_0x251d7a['linkedid'],_0xc9f4('0xb2'),_0x5d8bfe[_0xc9f4('0x28')],'pTalking:\x20',_0x5d8bfe[_0xc9f4('0x2c')]);}if(this[_0xc9f4('0x13')][_0x251d7a['linkedid']]&&_0x251d7a[_0xc9f4('0xbf')]!==_0x251d7a['uniqueid']){if(_0x251d7a[_0xc9f4('0x13f')]==='16'&&this[_0xc9f4('0x13')][_0x251d7a[_0xc9f4('0xbf')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x251d7a,_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')]);}else if(this['actions'][_0x251d7a[_0xc9f4('0xbf')]][_0xc9f4('0x74')]){logger[_0xc9f4('0x6e')]('[syncHangup][talking][cause]',_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')],_0xc9f4('0xb2'),_0x5d8bfe['name'],_0xc9f4('0x73'),_0x5d8bfe[_0xc9f4('0x2c')]);this[_0xc9f4('0x140')](_0x251d7a,_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')]);}}else if(_0x356406&&_[_0xc9f4('0x6d')](_0x356406[_0xc9f4('0x141')])&&_0x5d8bfe[_0xc9f4('0x142')]&&_0x251d7a[_0xc9f4('0xbf')]===_0x251d7a[_0xc9f4('0xbe')]&&_['isNil'](_0x251d7a['reason'])&&_0x251d7a[_0xc9f4('0x13f')]==='16'&&_0x251d7a[_0xc9f4('0x143')]==='6'&&_[_0xc9f4('0xf4')](_0x356406['transfer'])){if(_0x356406[_0xc9f4('0xd5')]){rpcDb[_0xc9f4('0x115')](_0x356406[_0xc9f4('0xab')]);}if(_0x356406[_0xc9f4('0xaa')]){rpcDb[_0xc9f4('0x144')](_0x356406[_0xc9f4('0xab')]);}_0x251d7a['reason']='22';this['callProgressDetectingAgent'](_0x356406,_0x5d8bfe,_0x251d7a);}else if(_0x356406&&_0x356406['transfer']){if(_0x251d7a[_0xc9f4('0x13f')]==='16'&&this[_0xc9f4('0x13')][_0x251d7a[_0xc9f4('0xbf')]][_0xc9f4('0x74')]){logger[_0xc9f4('0x6e')]('[syncHangup][talking][transfer]',_0x251d7a[_0xc9f4('0xbf')],_0x251d7a['cause'],_0xc9f4('0xb2'),_0x5d8bfe['name'],_0xc9f4('0x73'),_0x5d8bfe[_0xc9f4('0x2c')]);this['callProgressDetectingCustomer'](_0x251d7a,_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')]);}else if(this[_0xc9f4('0x13')][_0x251d7a[_0xc9f4('0xbf')]][_0xc9f4('0x74')]){logger['info'](_0xc9f4('0x145'),_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')],_0xc9f4('0xb2'),_0x5d8bfe[_0xc9f4('0x28')],_0xc9f4('0x73'),_0x5d8bfe[_0xc9f4('0x2c')]);this['callProgressDetectingCustomer'](_0x251d7a,_0x251d7a[_0xc9f4('0xbf')],_0x251d7a['cause']);}}};Preview[_0xc9f4('0xc')][_0xc9f4('0x1d')]=function(_0x2331b4){if(this[_0xc9f4('0x13')][_0x2331b4[_0xc9f4('0xf2')]]&&_0x2331b4[_0xc9f4('0xf2')]!==_0x2331b4['destuniqueid']){this[_0xc9f4('0x140')](_0x2331b4,_0x2331b4[_0xc9f4('0xf2')],_0x2331b4['dialstatus']);}};Preview[_0xc9f4('0xc')][_0xc9f4('0x1b')]=function(_0x354b94){if(this[_0xc9f4('0x13')][_0x354b94['linkedid']]&&_0x354b94[_0xc9f4('0xbf')]!==_0x354b94[_0xc9f4('0xbe')]&&!this['actions'][_0x354b94['linkedid']][_0xc9f4('0x74')]){if(_0x354b94['cause']==='1'){this['callProgressDetectingCustomer'](_0x354b94,_0x354b94['linkedid'],_0x354b94[_0xc9f4('0x13f')]);}}};Preview[_0xc9f4('0xc')]['addVariable']=function(_0x4b3f86,_0x4eaffa,_0x42ca29){if(this[_0xc9f4('0x13')][_0x4b3f86]){if(_[_0xc9f4('0x6d')](this['actions'][_0x4b3f86][_0xc9f4('0x137')])){this[_0xc9f4('0x13')][_0x4b3f86][_0xc9f4('0x137')]={};}this[_0xc9f4('0x13')][_0x4b3f86]['variables'][_0x4eaffa]=_0x42ca29;}};Preview[_0xc9f4('0xc')][_0xc9f4('0x21')]=function(_0x339f39){try{if(!_['isNil'](_0x339f39)){if(ut['filterKey'](_[_0xc9f4('0x146')](_0x339f39[_0xc9f4('0x147')])[0x0])){this[_0xc9f4('0x148')](_0x339f39[_0xc9f4('0xbe')],_[_0xc9f4('0x146')](_0x339f39[_0xc9f4('0x147')])[0x0],_0x339f39[_0xc9f4('0x149')]);}}}catch(_0x3ddd69){logger[_0xc9f4('0x14a')](_0xc9f4('0x14b'),util[_0xc9f4('0x14c')](_0x3ddd69,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xc9f4('0x23')]=function(_0x57c410){if(_0x57c410){if(this[_0xc9f4('0x13')][_0x57c410[_0xc9f4('0x14d')]]){this[_0xc9f4('0x13')][_0x57c410[_0xc9f4('0x14d')]]['transfer']=!![];}}};Preview[_0xc9f4('0xc')][_0xc9f4('0x24')]=function(_0x2c5256){if(_0x2c5256){if(this[_0xc9f4('0x13')][_0x2c5256[_0xc9f4('0x14e')]]){this[_0xc9f4('0x13')][_0x2c5256[_0xc9f4('0x14e')]][_0xc9f4('0x14f')]=!![];}}};module[_0xc9f4('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 19a6377..588de98 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 _0xcd36=['holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','then','createHistory','[createHistory]\x20','resolve','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview'];(function(_0x7eee7,_0x3779a1){var _0x469f62=function(_0x553717){while(--_0x553717){_0x7eee7['push'](_0x7eee7['shift']());}};_0x469f62(++_0x3779a1);}(_0xcd36,0xf2));var _0x6cd3=function(_0x25959e,_0x4dd8b5){_0x25959e=_0x25959e-0x0;var _0x9b159f=_0xcd36[_0x25959e];return _0x9b159f;};'use strict';var util=require(_0x6cd3('0x0'));var BPromise=require(_0x6cd3('0x1'));var logger=require('../../../config/logger')(_0x6cd3('0x2'));var _=require(_0x6cd3('0x3'));var cmHopper=require(_0x6cd3('0x4'));var cmHopperFinal=require(_0x6cd3('0x5'));var cmHopperHistory=require(_0x6cd3('0x6'));var cmHopperBlack=require(_0x6cd3('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x6cd3('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4698a3){return function(_0x4a94de){logger[_0x6cd3('0x9')](_0x4698a3,util[_0x6cd3('0xa')](_0x4a94de,{'showHidden':![],'depth':null}));};}function create(_0x195da9){return BPromise['resolve']()[_0x6cd3('0xb')](cmHopperHistory[_0x6cd3('0xc')](_0x195da9))['catch'](loggerCatch(_0x6cd3('0xd')));}function createAgent(_0x3b56a7){return BPromise[_0x6cd3('0xe')]()['then'](agentReportPreview[_0x6cd3('0xc')](_0x3b56a7))[_0x6cd3('0xf')](loggerCatch(_0x6cd3('0xd')));}function moveContact(_0x4e987e){return BPromise[_0x6cd3('0xe')]()[_0x6cd3('0xb')](cmHopper[_0x6cd3('0x10')](_0x4e987e,!![]))[_0x6cd3('0xf')](loggerCatch(_0x6cd3('0x11')));}exports['checkIsBlackList']=function(_0x4c00fb){return BPromise['resolve']()['then'](cmHopperBlack[_0x6cd3('0x12')](_0x4c00fb))['catch'](loggerCatch(_0x6cd3('0x13')));};exports[_0x6cd3('0x14')]=function(_0x4a3a3d){return BPromise[_0x6cd3('0xe')]()[_0x6cd3('0xb')](cmHopper['getContactPreview'](_0x4a3a3d))['catch'](loggerCatch(_0x6cd3('0x15')));};exports[_0x6cd3('0xc')]=function(_0x4cfb36,_0x24ff67){create(_0x4cfb36)['catch'](loggerCatch(_0x24ff67));moveContact(_0x4cfb36)[_0x6cd3('0xf')](loggerCatch(_0x24ff67));};exports[_0x6cd3('0x16')]=function(_0x4290cc,_0x1ea582){createAgent(_0x4290cc)['catch'](loggerCatch(_0x1ea582));};exports[_0x6cd3('0x17')]=function(_0x461ea2,_0x1a823c){create(_0x461ea2)[_0x6cd3('0xf')](loggerCatch(_0x1a823c));};exports['createCustomerFinal']=function(_0x5cbf2d,_0x3a6d1d){moveContact(_0x5cbf2d)['catch'](loggerCatch(_0x3a6d1d));};exports[_0x6cd3('0x18')]=function(_0x4e73c5,_0x2badc9,_0x35b61d){if(_0x2badc9){_0x4e73c5[_0x6cd3('0x19')]=null;}if(_0x35b61d){_0x4e73c5[_0x6cd3('0x1a')]=![];}return BPromise[_0x6cd3('0xe')]()['then'](cmHopper[_0x6cd3('0x18')](_0x4e73c5))[_0x6cd3('0xf')](loggerCatch(_0x6cd3('0x1b')));};exports[_0x6cd3('0x1c')]=function(_0x46fe02){return BPromise[_0x6cd3('0xe')]()['then'](cmHopper['countReScheduled'](_0x46fe02))[_0x6cd3('0xf')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x2ebc75){return BPromise['resolve']()[_0x6cd3('0xb')](cmHopper[_0x6cd3('0x1d')]({'UserId':null},_0x2ebc75,0x1))[_0x6cd3('0xf')](loggerCatch(_0x6cd3('0x1e')));};exports[_0x6cd3('0x1f')]=function(_0x5a9b71){return BPromise[_0x6cd3('0xe')]()[_0x6cd3('0xb')](cmHopper['unlockContact']({'active':![]},_0x5a9b71,0x1))[_0x6cd3('0xf')](loggerCatch(_0x6cd3('0x20')));};exports['crateCustomerReportQueue']=function(_0x31c01a){var _0x4df85d={};_0x4df85d['type']=_0x31c01a['type'];_0x4df85d[_0x6cd3('0x21')]=_0x31c01a['uniqueid'];_0x4df85d[_0x6cd3('0x22')]=_0x31c01a['calleridnum'];_0x4df85d[_0x6cd3('0x23')]=_0x31c01a['calleridname'];_0x4df85d[_0x6cd3('0x24')]=_0x31c01a[_0x6cd3('0x24')];_0x4df85d[_0x6cd3('0x25')]=_0x31c01a['answertime'];_0x4df85d[_0x6cd3('0x26')]=_0x31c01a[_0x6cd3('0x27')];_0x4df85d[_0x6cd3('0x28')]=0x1;_0x4df85d[_0x6cd3('0x29')]=_0x31c01a[_0x6cd3('0x2a')];_0x4df85d['connectedlinename']=_0x31c01a[_0x6cd3('0x2b')];_0x4df85d[_0x6cd3('0x2c')]=_0x6cd3('0x2d');_0x4df85d[_0x6cd3('0x2e')]=_0x6cd3('0x2f');_0x4df85d[_0x6cd3('0x30')]=0x0;_0x4df85d[_0x6cd3('0x31')]=0x1;_0x4df85d['lastAssignedTo']=_0x31c01a[_0x6cd3('0x2b')];_0x4df85d[_0x6cd3('0x32')]=_0x6cd3('0x33');return BPromise[_0x6cd3('0xe')]()[_0x6cd3('0xb')](voiceQueueReport[_0x6cd3('0x34')](_0x4df85d))[_0x6cd3('0xf')](loggerCatch(_0x6cd3('0x35')));};exports[_0x6cd3('0x36')]=function(_0x4015e6,_0x500f60){return BPromise[_0x6cd3('0xe')]()[_0x6cd3('0xb')](cmHopper[_0x6cd3('0x36')](_0x4015e6,_0x500f60))[_0x6cd3('0xf')](loggerCatch(_0x6cd3('0x37')));};exports[_0x6cd3('0x38')]=function(_0x4643dd){return BPromise[_0x6cd3('0xe')]()[_0x6cd3('0xb')](cmHopper[_0x6cd3('0x18')](_0x4643dd,!![],!![]))[_0x6cd3('0xf')](loggerCatch(_0x6cd3('0x39')));}; \ No newline at end of file +var _0x2534=['createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect'];(function(_0x21f9b0,_0x5e016f){var _0x422b28=function(_0x22327f){while(--_0x22327f){_0x21f9b0['push'](_0x21f9b0['shift']());}};_0x422b28(++_0x5e016f);}(_0x2534,0xe4));var _0x4253=function(_0x3f4d9d,_0x44cc3e){_0x3f4d9d=_0x3f4d9d-0x0;var _0xf7244c=_0x2534[_0x3f4d9d];return _0xf7244c;};'use strict';var util=require('util');var BPromise=require(_0x4253('0x0'));var logger=require(_0x4253('0x1'))(_0x4253('0x2'));var _=require(_0x4253('0x3'));var cmHopper=require(_0x4253('0x4'));var cmHopperFinal=require(_0x4253('0x5'));var cmHopperHistory=require(_0x4253('0x6'));var cmHopperBlack=require(_0x4253('0x7'));var voiceQueueRt=require(_0x4253('0x8'));var agentReportPreview=require(_0x4253('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x55a11f){return function(_0x4a5595){logger[_0x4253('0xa')](_0x55a11f,util[_0x4253('0xb')](_0x4a5595,{'showHidden':![],'depth':null}));};}function create(_0x2eca5f){return BPromise['resolve']()['then'](cmHopperHistory[_0x4253('0xc')](_0x2eca5f))[_0x4253('0xd')](loggerCatch(_0x4253('0xe')));}function createAgent(_0x3c044f){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](agentReportPreview['createHistory'](_0x3c044f))[_0x4253('0xd')](loggerCatch(_0x4253('0xe')));}function moveContact(_0x3c2978){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper[_0x4253('0x11')](_0x3c2978,!![]))['catch'](loggerCatch(_0x4253('0x12')));}exports[_0x4253('0x13')]=function(_0x36539a){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopperBlack['checkIsBlackList'](_0x36539a))['catch'](loggerCatch(_0x4253('0x14')));};exports[_0x4253('0x15')]=function(_0x5c2b2e){return BPromise['resolve']()['then'](cmHopper[_0x4253('0x15')](_0x5c2b2e))[_0x4253('0xd')](loggerCatch(_0x4253('0x16')));};exports[_0x4253('0xc')]=function(_0x5607d1,_0x565aaa){create(_0x5607d1)[_0x4253('0xd')](loggerCatch(_0x565aaa));moveContact(_0x5607d1)[_0x4253('0xd')](loggerCatch(_0x565aaa));};exports[_0x4253('0x17')]=function(_0x2c9fea,_0x1ed271){createAgent(_0x2c9fea)[_0x4253('0xd')](loggerCatch(_0x1ed271));};exports['createCustomerHistory']=function(_0xc03425,_0x200972){create(_0xc03425)['catch'](loggerCatch(_0x200972));};exports[_0x4253('0x18')]=function(_0x247040,_0x427f3d){moveContact(_0x247040)[_0x4253('0xd')](loggerCatch(_0x427f3d));};exports[_0x4253('0x19')]=function(_0x426f40,_0x1dc370,_0x11fcc7){if(_0x1dc370){_0x426f40[_0x4253('0x1a')]=null;}if(_0x11fcc7){_0x426f40[_0x4253('0x1b')]=![];}return BPromise['resolve']()[_0x4253('0x10')](cmHopper[_0x4253('0x19')](_0x426f40))[_0x4253('0xd')](loggerCatch(_0x4253('0x1c')));};exports['countReScheduled']=function(_0x39d093){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper[_0x4253('0x1d')](_0x39d093))[_0x4253('0xd')](loggerCatch(_0x4253('0x1e')));};exports['unlockContact']=function(_0x3e0c7d){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper['unlockContact']({'UserId':null},_0x3e0c7d,0x1))[_0x4253('0xd')](loggerCatch(_0x4253('0x1f')));};exports[_0x4253('0x20')]=function(_0x142675){return BPromise[_0x4253('0xf')]()['then'](cmHopper['unlockContact']({'active':![]},_0x142675,0x1))[_0x4253('0xd')](loggerCatch(_0x4253('0x21')));};exports[_0x4253('0x22')]=function(_0x445317){var _0x3eedcb={};_0x3eedcb[_0x4253('0x23')]=_0x445317[_0x4253('0x23')];_0x3eedcb[_0x4253('0x24')]=_0x445317[_0x4253('0x24')];_0x3eedcb['calleridnum']=_0x445317[_0x4253('0x25')];_0x3eedcb[_0x4253('0x26')]=_0x445317[_0x4253('0x26')];_0x3eedcb[_0x4253('0x27')]=_0x445317[_0x4253('0x27')];_0x3eedcb[_0x4253('0x28')]=_0x445317['answertime'];_0x3eedcb[_0x4253('0x29')]=_0x445317[_0x4253('0x2a')];_0x3eedcb['queuecallercomplete']=0x1;_0x3eedcb[_0x4253('0x2b')]=_0x445317[_0x4253('0x2c')];_0x3eedcb[_0x4253('0x2d')]=_0x445317['membername'];_0x3eedcb[_0x4253('0x2e')]=_0x4253('0x2f');_0x3eedcb[_0x4253('0x30')]=_0x4253('0x31');_0x3eedcb[_0x4253('0x32')]=0x0;_0x3eedcb[_0x4253('0x33')]=0x1;_0x3eedcb[_0x4253('0x34')]=_0x445317['membername'];_0x3eedcb[_0x4253('0x35')]=_0x4253('0x36');return BPromise[_0x4253('0xf')]()['then'](voiceQueueReport[_0x4253('0x37')](_0x3eedcb))[_0x4253('0xd')](loggerCatch(_0x4253('0x38')));};exports[_0x4253('0x39')]=function(_0x1b2eca,_0x2087af){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper[_0x4253('0x39')](_0x1b2eca,_0x2087af))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x4253('0x3a')]=function(_0x694c29){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper[_0x4253('0x19')](_0x694c29,!![],!![]))[_0x4253('0xd')](loggerCatch(_0x4253('0x3b')));}; \ 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 226403d..014d274 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 _0xecd8=['minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','countbusyretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','bridgepeer','\x5cw{0,','pow','replace','extractCalleridName','extractCalleridNumber','match','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','logAgent','state','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','countcongestionretry','countagentrejectretry','cloneAction','clone','scheduledAt','scheduledat','add'];(function(_0x2e1fc1,_0x31f54b){var _0x1249be=function(_0x3700e9){while(--_0x3700e9){_0x2e1fc1['push'](_0x2e1fc1['shift']());}};_0x1249be(++_0x31f54b);}(_0xecd8,0xd3));var _0x8ecd=function(_0x35a6b7,_0x147fc5){_0x35a6b7=_0x35a6b7-0x0;var _0x3822a2=_0xecd8[_0x35a6b7];return _0x3822a2;};'use strict';var util=require(_0x8ecd('0x0'));var _=require(_0x8ecd('0x1'));var moment=require('moment');var logger=require(_0x8ecd('0x2'))(_0x8ecd('0x3'));var ipAgi=process[_0x8ecd('0x4')]['XCALLY_IP_AGI']||_0x8ecd('0x5');function getSeconds(_0x357389,_0x484088){var _0x157ac7=moment(_0x357389)[_0x8ecd('0x6')](0x0);var _0x1e19c2=moment(_0x484088)[_0x8ecd('0x6')](0x0);return _0x157ac7['diff'](_0x1e19c2,_0x8ecd('0x7'));}exports[_0x8ecd('0x8')]=function(_0x562e13){return function(_0x5a9b31){logger['error'](_0x562e13,util[_0x8ecd('0x9')](_0x5a9b31,{'showHidden':![],'depth':null}));};};exports[_0x8ecd('0xa')]=function(_0x691f3a,_0x3598c5){logger[_0x8ecd('0xb')](_0x691f3a,util['inspect'](_0x3598c5,{'showHidden':![],'depth':null}));};exports[_0x8ecd('0xc')]=function(_0x5a6490,_0x5c81ce){logger[_0x8ecd('0xd')](_0x5a6490,util['inspect'](_0x5c81ce,{'showHidden':![],'depth':null}));};exports[_0x8ecd('0xe')]=function(_0xc7607e){return function(_0xbc0442){logger[_0x8ecd('0xb')](_0xc7607e,util[_0x8ecd('0x9')](_0xbc0442,{'showHidden':![],'depth':null}));};};exports[_0x8ecd('0xf')]=function(_0x335375,_0x3fa7f8,_0x2d92fd){return{'message':_0x335375,'unlock':_0x3fa7f8,'active':_0x2d92fd};};exports['getCallerId']=function(_0x4ea305,_0x5f31c5,_0x3462ee){if(!_['isUndefined'](_0x3462ee)&&_0x8ecd('0x10')===typeof _0x3462ee&&!_[_0x8ecd('0x11')](_0x3462ee)){if(!_[_0x8ecd('0x12')](_0x5f31c5)&&_0x8ecd('0x10')===typeof _0x5f31c5&&!_[_0x8ecd('0x11')](_0x5f31c5)){return util[_0x8ecd('0x13')](_0x8ecd('0x14'),_0x5f31c5,_0x3462ee);}return util[_0x8ecd('0x13')](_0x8ecd('0x14'),_0x3462ee,_0x3462ee);}if(!_[_0x8ecd('0x12')](_0x4ea305)&&_0x8ecd('0x10')===typeof _0x4ea305&&!_['isEmpty'](_0x4ea305)){return _0x4ea305;}return'\x22\x22\x20<>';};exports[_0x8ecd('0x15')]=function(_0x30503e){if(_[_0x8ecd('0x16')](_0x30503e)){return![];}return _0x30503e;};exports[_0x8ecd('0x17')]=function(_0x5c4e08,_0x46de11,_0x354739,_0x311184,_0x2e33b0,_0x2bf4b8){var _0x580daf={'XMD-QUEUE':_0x46de11[_0x8ecd('0x18')]?_0x46de11['Queue']['name']:'','XMD-CALLERID':_0x311184,'XMD-CALLERID-PREVIEW':_0x2bf4b8?util[_0x8ecd('0x13')](_0x8ecd('0x14'),_0x2bf4b8[_0x8ecd('0x19')],_0x2bf4b8[_0x8ecd('0x1a')]):_0x311184,'XMD-DIALID':_0x2e33b0,'XMD-CONTACTID':_0x46de11[_0x8ecd('0x1b')],'XMD-CDRTYPE':_0x8ecd('0x1c'),'CALLERID(all)':_0x311184,'XMD-VOICEQUEUEID':_0x46de11[_0x8ecd('0x1d')],'XMD-DIALCHANNEL':_0x354739,'XMD-DIALTIMEOUT':_0x5c4e08['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x8ecd('0x13')](_0x8ecd('0x1e'),_0x5c4e08[_0x8ecd('0x1f')]?'g':'',_[_0x8ecd('0x11')](_0x5c4e08[_0x8ecd('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5c4e08[_0x8ecd('0x21')]||'','XMD-AGI':_0x5c4e08[_0x8ecd('0x22')]?util[_0x8ecd('0x13')](_0x8ecd('0x23'),ipAgi,_0x5c4e08[_0x8ecd('0x22')]):_0x8ecd('0x24'),'XMD-AGIAFTER':_0x5c4e08[_0x8ecd('0x1f')]?util[_0x8ecd('0x13')](_0x8ecd('0x23'),ipAgi,_0x5c4e08[_0x8ecd('0x1f')]):_0x8ecd('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x2bf4b8?_0x2bf4b8[_0x8ecd('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x2bf4b8?_0x2bf4b8['originatecalleridname']:'','XMD-DESTINATION':_0x8ecd('0x26'),'SIPADDHEADER':_0x8ecd('0x27')};if(!_[_0x8ecd('0x11')](_0x5c4e08[_0x8ecd('0x20')])){_0x580daf[util['format']('%s',_0x8ecd('0x28'))]=_0x5c4e08['monitor_format'];_0x580daf[util[_0x8ecd('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2e33b0;}if(_0x46de11&&_0x46de11[_0x8ecd('0x29')]){for(var _0x1da7c2 in _0x46de11[_0x8ecd('0x29')]){if(_0x46de11['Contact'][_0x8ecd('0x2a')](_0x1da7c2)){if(!_[_0x8ecd('0x16')](_0x46de11[_0x8ecd('0x29')][_0x1da7c2])&&_0x1da7c2!=='id'&&_0x1da7c2!==_0x8ecd('0x2b')&&_0x1da7c2!==_0x8ecd('0x2c')&&_0x1da7c2!=='updatedAt'){_0x580daf[util['format'](_0x8ecd('0x2d'),_0x8ecd('0x2e'),_[_0x8ecd('0x2f')](_0x1da7c2))]=_0x46de11[_0x8ecd('0x29')][_0x1da7c2];}}}}return _0x580daf;};exports[_0x8ecd('0x30')]=function(_0x3dc632){var _0x3a441b={};for(var _0xab82d2 in _0x3dc632){if(_0x3dc632[_0x8ecd('0x2a')](_0xab82d2)){_0x3a441b[util[_0x8ecd('0x13')]('%s',_[_0x8ecd('0x31')](_0xab82d2))]=_0x3dc632[_0xab82d2];}}return{'variables':_0x3a441b};};exports[_0x8ecd('0x32')]=function(_0x58e65d,_0xcc03ca){if(!_[_0x8ecd('0x16')](_0x58e65d)){if(_0x58e65d['hasOwnProperty'](_0x8ecd('0x33'))){if(_0x58e65d[_0x8ecd('0x33')]>0x0){_0x58e65d[_0x8ecd('0x33')]-=0x1;}else{logger[_0x8ecd('0xd')](_0x8ecd('0x34'),_0xcc03ca);}}}else{logger['error'](_0x8ecd('0x35'),_0xcc03ca);}};exports[_0x8ecd('0x36')]=function(_0x115f1a){var _0x5e8736=moment()[_0x8ecd('0x13')](_0x8ecd('0x37'));_0x115f1a['state']=0xd;_0x115f1a[_0x8ecd('0x38')]='Blacklist';_0x115f1a[_0x8ecd('0x39')]=_0x5e8736;_0x115f1a[_0x8ecd('0x3a')]=_0x5e8736;_0x115f1a['endtime']=_0x5e8736;};exports[_0x8ecd('0x3b')]=function(_0x437b83,_0x3af46c,_0x47f71d){var _0x357d5c=moment()[_0x8ecd('0x13')](_0x8ecd('0x37'));_0x437b83[_0x8ecd('0x3c')]=_0x3af46c;_0x437b83[_0x8ecd('0x38')]=_0x47f71d;_0x437b83[_0x8ecd('0x3a')]=_0x357d5c;_0x437b83['ringtime']=getSeconds(_0x437b83[_0x8ecd('0x3a')],_0x437b83[_0x8ecd('0x39')]);};exports[_0x8ecd('0x3d')]=function(_0x3d45b2,_0x47b88d,_0x5aa2ee){_0x3d45b2[_0x8ecd('0x3e')]=_0x47b88d;_0x3d45b2[_0x8ecd('0x3f')]=_0x5aa2ee;};exports[_0x8ecd('0x40')]=function(_0x102480,_0x22cebf,_0x521a54){var _0x5644b3=moment()[_0x8ecd('0x13')](_0x8ecd('0x37'));_0x102480[_0x8ecd('0x3c')]=_0x22cebf;_0x102480['statedesc']=_0x521a54;_0x102480['responsetime']=_0x102480['responsetime']?_0x102480[_0x8ecd('0x3a')]:_0x5644b3;_0x102480[_0x8ecd('0x41')]=_0x102480[_0x8ecd('0x41')]?_0x102480[_0x8ecd('0x41')]:_0x5644b3;_0x102480[_0x8ecd('0x42')]=getSeconds(_0x102480['responsetime']||0x0,_0x102480['starttime']||0x0);_0x102480[_0x8ecd('0x43')]=_0x102480[_0x8ecd('0x44')]?getSeconds(_0x102480[_0x8ecd('0x41')],_0x102480[_0x8ecd('0x44')]):0x0;};exports[_0x8ecd('0x45')]=function(_0x5cb592){return _0x5cb592===_0x8ecd('0x46');};exports[_0x8ecd('0x47')]=function(_0x4fe37b,_0x2653c3,_0x38f230,_0x4369a8,_0x5d79ff){var _0x35dab7=_0x4369a8?_0x8ecd('0x48'):_0x4fe37b[_0x8ecd('0x19')];_0x35dab7=_0x5d79ff?_0x8ecd('0x49'):_0x35dab7;return{'actionid':_0x4fe37b[_0x8ecd('0x4a')],'action':_0x8ecd('0x4b'),'channel':_0x4fe37b[_0x8ecd('0x4c')],'callerid':util['format'](_0x8ecd('0x14'),_0x35dab7,_0x4fe37b['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x8ecd('0x4d'),'Priority':'1','variable':_0x38f230,'timeout':(_0x2653c3['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4fe37b[_0x8ecd('0x4a')]};};exports['totalGlobal']=function(_0x11d32c){return _0x11d32c['countbusyretry']+_0x11d32c[_0x8ecd('0x4e')]+_0x11d32c['countnoanswerretry']+_0x11d32c[_0x8ecd('0x4f')]+_0x11d32c['countnosuchnumberretry'];};exports[_0x8ecd('0x50')]=function(_0x4456f4){var _0x1b9e03=_[_0x8ecd('0x51')](_0x4456f4);_0x1b9e03['state']=0xf;_0x1b9e03[_0x8ecd('0x38')]='Global';return _0x1b9e03;};exports[_0x8ecd('0x52')]=function(_0x562e65,_0xbb2508,_0x2770a7){var _0x33c9a6={};_0x33c9a6[_0xbb2508]=_0x562e65[_0xbb2508];_0x33c9a6['active']=![];_0x33c9a6[_0x8ecd('0x53')]=moment()[_0x8ecd('0x54')](_0x2770a7,_0x8ecd('0x55'))['format'](_0x8ecd('0x37'));_0x33c9a6[_0x8ecd('0x1b')]=_0x562e65[_0x8ecd('0x1b')];_0x33c9a6[_0x8ecd('0x56')]=_0x562e65['ListId'];_0x33c9a6[_0x8ecd('0x1d')]=_0x562e65['VoiceQueueId']||undefined;return _0x33c9a6;};exports[_0x8ecd('0x57')]=function(_0x10710a,_0x4e70a7){if(!_[_0x8ecd('0x16')](_0x10710a)){if(_0x10710a[_0x8ecd('0x58')]>0x0){_0x10710a[_0x8ecd('0x58')]-=0x1;}else{logger[_0x8ecd('0xd')](_0x4e70a7,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x8ecd('0xd')](_0x4e70a7,_0x8ecd('0x59'));}};exports['IsNotLoggedIn']=function(_0x1937af){if(_0x1937af<=0x0){return!![];}return![];};function buildObj(_0x5190fb,_0x5745e5,_0x2276b1){_0x5190fb['lastevent']=_0x5745e5;_0x5190fb[_0x8ecd('0x5a')]=_0x5190fb[_0x8ecd('0x5b')];_0x5190fb[_0x8ecd('0x5c')]=_0x5190fb['channelAgent'];_0x5190fb[_0x8ecd('0x5d')]=_0x8ecd('0x5e');if(_0x2276b1){_0x5190fb[_0x8ecd('0x5f')]=_0x2276b1[_0x8ecd('0x5f')];}return _0x5190fb;}exports[_0x8ecd('0x60')]=buildObj;exports[_0x8ecd('0x61')]=function(_0x513a97){var _0x34f736={};_0x34f736[_0x8ecd('0x5b')]=_0x513a97[_0x8ecd('0x5b')];_0x34f736[_0x8ecd('0x5c')]=_0x513a97[_0x8ecd('0x4c')];_0x34f736['uniqueid']=_0x513a97[_0x8ecd('0x4a')];return _0x34f736;};exports[_0x8ecd('0x62')]=function(_0x4c4e36){var _0x8c176d=[];for(var _0x47429b in _0x4c4e36){if(_0x4c4e36[_0x8ecd('0x2a')](_0x47429b)){if(!_[_0x8ecd('0x16')](_0x4c4e36[_0x47429b])&&_0x4c4e36[_0x47429b][_0x8ecd('0x3c')]===_0x8ecd('0x63')&&_0x4c4e36[_0x47429b]['status']===_0x8ecd('0x64')){_0x8c176d[_0x8ecd('0x65')](_0x4c4e36[_0x47429b]['id']);}}}return _0x8c176d;};exports[_0x8ecd('0x66')]=function(_0x3a01ca){var _0xdf6c8b=moment()['milliseconds'](0x0);var _0x412c2c=moment(_0x3a01ca)[_0x8ecd('0x6')](0x0);return _0xdf6c8b['diff'](_0x412c2c,_0x8ecd('0x7'));};exports[_0x8ecd('0x67')]=function(_0x35884d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x35884d['ContactId'],'ListId':_0x35884d[_0x8ecd('0x56')],'VoiceQueueId':_0x35884d[_0x8ecd('0x1d')]||undefined,'CampaignId':_0x35884d[_0x8ecd('0x68')]||undefined};};exports[_0x8ecd('0x69')]=function(_0x21dde1){if(_0x21dde1===_0x8ecd('0x4a')||_0x21dde1===_0x8ecd('0x6a')||_0x21dde1===_0x8ecd('0x5b')||_0x21dde1===_0x8ecd('0x6b')||_0x21dde1===_0x8ecd('0x6c')||_0x21dde1===_0x8ecd('0x6d')||_0x21dde1===_0x8ecd('0x3e')||_0x21dde1===_0x8ecd('0x4c')||_0x21dde1===_0x8ecd('0x19')||_0x21dde1===_0x8ecd('0x6e')||_0x21dde1===_0x8ecd('0x1a')||_0x21dde1===_0x8ecd('0x53')||_0x21dde1===_0x8ecd('0x6f')||_0x21dde1==='countcongestionretry'||_0x21dde1===_0x8ecd('0x70')||_0x21dde1===_0x8ecd('0x71')||_0x21dde1===_0x8ecd('0x72')||_0x21dde1===_0x8ecd('0x73')||_0x21dde1===_0x8ecd('0x74')||_0x21dde1===_0x8ecd('0x75')||_0x21dde1==='ContactId'||_0x21dde1===_0x8ecd('0x56')||_0x21dde1===_0x8ecd('0x3f')||_0x21dde1===_0x8ecd('0x1d')||_0x21dde1===_0x8ecd('0x76')||_0x21dde1==='xmd-voicequeueid'||_0x21dde1===_0x8ecd('0x77')||_0x21dde1==='xmd-phone'||_0x21dde1==='xmd-listid'||_0x21dde1===_0x8ecd('0x78')||_0x21dde1==='xmd-dialtimeout'||_0x21dde1===_0x8ecd('0x79')||_0x21dde1===_0x8ecd('0x7a')||_0x21dde1===_0x8ecd('0x7b')||_0x21dde1===_0x8ecd('0x7c')||_0x21dde1===_0x8ecd('0x7d')||_0x21dde1===_0x8ecd('0x7e')||_0x21dde1===_0x8ecd('0x7f')||_0x21dde1===_0x8ecd('0x80')||_0x21dde1===_0x8ecd('0x81')||_0x21dde1==='rtpaudioqosbridged'||_0x21dde1==='rtpaudioqosjitter'||_0x21dde1==='rtpaudioqosjitterbridged'||_0x21dde1==='rtpaudioqosloss'||_0x21dde1===_0x8ecd('0x82')||_0x21dde1===_0x8ecd('0x83')||_0x21dde1===_0x8ecd('0x84')||_0x21dde1===_0x8ecd('0x81')||_0x21dde1==='rtpaudioqosbridged'||_0x21dde1===_0x8ecd('0x85')||_0x21dde1===_0x8ecd('0x86')||_0x21dde1===_0x8ecd('0x87')||_0x21dde1===_0x8ecd('0x82')||_0x21dde1===_0x8ecd('0x83')||_0x21dde1===_0x8ecd('0x84')||_0x21dde1===_0x8ecd('0x88')||_0x21dde1==='bridgepvtcallid'||_0x21dde1===_0x8ecd('0x3c')||_0x21dde1===_0x8ecd('0x38')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x443110,_0x1daf7a){var _0x51c598,_0x5ec126,_0x4c1044;if(_0x1daf7a<=0x0){_0x1daf7a=0x1;}_0x51c598=new RegExp(_0x8ecd('0x89')+_0x1daf7a+'}$');_0x5ec126=Math[_0x8ecd('0x8a')](0xa,_0x1daf7a-0x1);_0x4c1044=Math[_0x8ecd('0x8a')](0xa,_0x1daf7a)-0x1;return util[_0x8ecd('0x13')]('%s',_[_0x8ecd('0x8b')](_0x443110,_0x51c598,_['random'](_0x5ec126,_0x4c1044)));};exports[_0x8ecd('0x8c')]=function(_0x2f94ae){var _0x5e6621=_0x2f94ae['match'](/"(.*?)"/);return _0x5e6621?_0x5e6621[0x1]:_0x2f94ae;};exports[_0x8ecd('0x8d')]=function(_0xfb9178){var _0x2cd25d=_0xfb9178[_0x8ecd('0x8e')](/<(.*?)>/);return _0x2cd25d?_0x2cd25d[0x1]:_0xfb9178;};function buildNoAnswerEventPayload(_0x266e3d,_0x277acf){var _0x4afedb=buildObj(_0x266e3d,_0x8ecd('0x8f'));if(!_[_0x8ecd('0x11')](_0x277acf[_0x8ecd('0x90')])){Object['keys'](_0x277acf[_0x8ecd('0x90')])[_0x8ecd('0x91')](function(_0x5982ae){_0x4afedb[_0x5982ae[_0x8ecd('0x92')]()]=_0x277acf[_0x8ecd('0x90')][_0x5982ae];});}return _0x4afedb;}exports[_0x8ecd('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x9519=['rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','preview','env','XCALLY_IP_AGI','milliseconds','seconds','loggerCatch','inspect','logger','info','loggerError','error','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','endtime','logAgent','responsetime','ringtime','membername','UserId','logCustomer','statedesc','starttime','talktime','answertime','RECALL','BOOKED','uniqueid','originate','calleridnum','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','interface','channelAgent','motionChannel','mandatoryDisposition','buildAcw','queue','agentReadyId','status','push','getDiff','createBody','filterKey','idContact','type','active','scheduledat','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter'];(function(_0x4634bd,_0x14daa3){var _0x4a17df=function(_0x27c210){while(--_0x27c210){_0x4634bd['push'](_0x4634bd['shift']());}};_0x4a17df(++_0x14daa3);}(_0x9519,0x9d));var _0x9951=function(_0x38ec8c,_0x5e4b2e){_0x38ec8c=_0x38ec8c-0x0;var _0x120927=_0x9519[_0x38ec8c];return _0x120927;};'use strict';var util=require('util');var _=require(_0x9951('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x9951('0x1'));var ipAgi=process[_0x9951('0x2')][_0x9951('0x3')]||'127.0.0.1';function getSeconds(_0x5f172d,_0x279cd2){var _0x4dc527=moment(_0x5f172d)[_0x9951('0x4')](0x0);var _0x579771=moment(_0x279cd2)[_0x9951('0x4')](0x0);return _0x4dc527['diff'](_0x579771,_0x9951('0x5'));}exports[_0x9951('0x6')]=function(_0x5660d8){return function(_0x27775d){logger['error'](_0x5660d8,util[_0x9951('0x7')](_0x27775d,{'showHidden':![],'depth':null}));};};exports[_0x9951('0x8')]=function(_0x20537b,_0xe2744e){logger[_0x9951('0x9')](_0x20537b,util[_0x9951('0x7')](_0xe2744e,{'showHidden':![],'depth':null}));};exports[_0x9951('0xa')]=function(_0x461fea,_0xec0d5a){logger[_0x9951('0xb')](_0x461fea,util[_0x9951('0x7')](_0xec0d5a,{'showHidden':![],'depth':null}));};exports[_0x9951('0xc')]=function(_0x5b7e13){return function(_0x41ff62){logger[_0x9951('0x9')](_0x5b7e13,util[_0x9951('0x7')](_0x41ff62,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x2600fc,_0x3e0894,_0x5e6c83){return{'message':_0x2600fc,'unlock':_0x3e0894,'active':_0x5e6c83};};exports[_0x9951('0xd')]=function(_0x348528,_0x9a46a0,_0x2e4d8a){if(!_[_0x9951('0xe')](_0x2e4d8a)&&_0x9951('0xf')===typeof _0x2e4d8a&&!_[_0x9951('0x10')](_0x2e4d8a)){if(!_[_0x9951('0xe')](_0x9a46a0)&&_0x9951('0xf')===typeof _0x9a46a0&&!_['isEmpty'](_0x9a46a0)){return util[_0x9951('0x11')](_0x9951('0x12'),_0x9a46a0,_0x2e4d8a);}return util[_0x9951('0x11')](_0x9951('0x12'),_0x2e4d8a,_0x2e4d8a);}if(!_[_0x9951('0xe')](_0x348528)&&'string'===typeof _0x348528&&!_[_0x9951('0x10')](_0x348528)){return _0x348528;}return _0x9951('0x13');};exports[_0x9951('0x14')]=function(_0x45898c){if(_[_0x9951('0x15')](_0x45898c)){return![];}return _0x45898c;};exports['addVariables']=function(_0x2729ce,_0xc194a9,_0x547fcc,_0x4149a9,_0x36b63a,_0x43f865){var _0x36ddee={'XMD-QUEUE':_0xc194a9[_0x9951('0x16')]?_0xc194a9['Queue']['name']:'','XMD-CALLERID':_0x4149a9,'XMD-CALLERID-PREVIEW':_0x43f865?util[_0x9951('0x11')]('\x22%s\x22\x20<%s>',_0x43f865[_0x9951('0x17')],_0x43f865['calleridnum']):_0x4149a9,'XMD-DIALID':_0x36b63a,'XMD-CONTACTID':_0xc194a9[_0x9951('0x18')],'XMD-CDRTYPE':_0x9951('0x19'),'CALLERID(all)':_0x4149a9,'XMD-VOICEQUEUEID':_0xc194a9[_0x9951('0x1a')],'XMD-DIALCHANNEL':_0x547fcc,'XMD-DIALTIMEOUT':_0x2729ce[_0x9951('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x9951('0x11')](_0x9951('0x1c'),_0x2729ce['dialQueueProject2']?'g':'',_[_0x9951('0x10')](_0x2729ce['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2729ce[_0x9951('0x1d')]||'','XMD-AGI':_0x2729ce[_0x9951('0x1e')]?util[_0x9951('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2729ce[_0x9951('0x1e')]):_0x9951('0x1f'),'XMD-AGIAFTER':_0x2729ce[_0x9951('0x20')]?util[_0x9951('0x11')](_0x9951('0x21'),ipAgi,_0x2729ce['dialQueueProject2']):_0x9951('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x43f865?_0x43f865['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x43f865?_0x43f865[_0x9951('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x9951('0x23')};if(!_[_0x9951('0x10')](_0x2729ce['monitor_format'])){_0x36ddee[util[_0x9951('0x11')]('%s',_0x9951('0x24'))]=_0x2729ce[_0x9951('0x25')];_0x36ddee[util[_0x9951('0x11')]('%s',_0x9951('0x26'))]=_0x36b63a;}if(_0xc194a9&&_0xc194a9['Contact']){for(var _0x55b1fa in _0xc194a9['Contact']){if(_0xc194a9['Contact'][_0x9951('0x27')](_0x55b1fa)){if(!_[_0x9951('0x15')](_0xc194a9['Contact'][_0x55b1fa])&&_0x55b1fa!=='id'&&_0x55b1fa!==_0x9951('0x28')&&_0x55b1fa!==_0x9951('0x29')&&_0x55b1fa!==_0x9951('0x2a')){_0x36ddee[util[_0x9951('0x11')](_0x9951('0x2b'),'XMD-',_[_0x9951('0x2c')](_0x55b1fa))]=_0xc194a9['Contact'][_0x55b1fa];}}}}return _0x36ddee;};exports[_0x9951('0x2d')]=function(_0x44de9d){var _0x5179b3={};for(var _0x38d211 in _0x44de9d){if(_0x44de9d[_0x9951('0x27')](_0x38d211)){_0x5179b3[util[_0x9951('0x11')]('%s',_[_0x9951('0x2e')](_0x38d211))]=_0x44de9d[_0x38d211];}}return{'variables':_0x5179b3};};exports[_0x9951('0x2f')]=function(_0x1c4cd0,_0x2a9eba){if(!_[_0x9951('0x15')](_0x1c4cd0)){if(_0x1c4cd0['hasOwnProperty'](_0x9951('0x30'))){if(_0x1c4cd0[_0x9951('0x30')]>0x0){_0x1c4cd0[_0x9951('0x30')]-=0x1;}else{logger[_0x9951('0xb')](_0x9951('0x31'),_0x2a9eba);}}}else{logger[_0x9951('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2a9eba);}};exports['logBlacklist']=function(_0x425ef2){var _0x2569d5=moment()[_0x9951('0x11')](_0x9951('0x32'));_0x425ef2[_0x9951('0x33')]=0xd;_0x425ef2['statedesc']='Blacklist';_0x425ef2['starttime']=_0x2569d5;_0x425ef2['responsetime']=_0x2569d5;_0x425ef2[_0x9951('0x34')]=_0x2569d5;};exports[_0x9951('0x35')]=function(_0x2ab8b3,_0x34ecae,_0x41cc04){var _0x1c217e=moment()['format'](_0x9951('0x32'));_0x2ab8b3['state']=_0x34ecae;_0x2ab8b3['statedesc']=_0x41cc04;_0x2ab8b3[_0x9951('0x36')]=_0x1c217e;_0x2ab8b3[_0x9951('0x37')]=getSeconds(_0x2ab8b3[_0x9951('0x36')],_0x2ab8b3['starttime']);};exports['logLookAgent']=function(_0x5d889e,_0x2feb6c,_0x252e16){_0x5d889e[_0x9951('0x38')]=_0x2feb6c;_0x5d889e[_0x9951('0x39')]=_0x252e16;};exports[_0x9951('0x3a')]=function(_0x374cd5,_0x2ded2b,_0x581081){var _0x53872e=moment()[_0x9951('0x11')](_0x9951('0x32'));_0x374cd5[_0x9951('0x33')]=_0x2ded2b;_0x374cd5[_0x9951('0x3b')]=_0x581081;_0x374cd5[_0x9951('0x36')]=_0x374cd5[_0x9951('0x36')]?_0x374cd5[_0x9951('0x36')]:_0x53872e;_0x374cd5[_0x9951('0x34')]=_0x374cd5[_0x9951('0x34')]?_0x374cd5[_0x9951('0x34')]:_0x53872e;_0x374cd5['ringtime']=getSeconds(_0x374cd5[_0x9951('0x36')]||0x0,_0x374cd5[_0x9951('0x3c')]||0x0);_0x374cd5[_0x9951('0x3d')]=_0x374cd5['answertime']?getSeconds(_0x374cd5[_0x9951('0x34')],_0x374cd5[_0x9951('0x3e')]):0x0;};exports['isFailure']=function(_0x7b432d){return _0x7b432d==='Failure';};exports['variablesAction']=function(_0x316c03,_0x1fc89c,_0x594c6e,_0x46fdbf,_0x1c4e3f){var _0x26e4e8=_0x46fdbf?_0x9951('0x3f'):_0x316c03[_0x9951('0x17')];_0x26e4e8=_0x1c4e3f?_0x9951('0x40'):_0x26e4e8;return{'actionid':_0x316c03[_0x9951('0x41')],'action':_0x9951('0x42'),'channel':_0x316c03['channelAgent'],'callerid':util[_0x9951('0x11')]('\x22%s\x22\x20<%s>',_0x26e4e8,_0x316c03[_0x9951('0x43')]),'Exten':_0x9951('0x44'),'Context':_0x9951('0x45'),'Priority':'1','variable':_0x594c6e,'timeout':(_0x1fc89c[_0x9951('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x316c03[_0x9951('0x41')]};};exports[_0x9951('0x47')]=function(_0x560a23){return _0x560a23[_0x9951('0x48')]+_0x560a23[_0x9951('0x49')]+_0x560a23['countnoanswerretry']+_0x560a23['countagentrejectretry']+_0x560a23[_0x9951('0x4a')];};exports[_0x9951('0x4b')]=function(_0x5b1e31){var _0x4b09e1=_[_0x9951('0x4c')](_0x5b1e31);_0x4b09e1['state']=0xf;_0x4b09e1[_0x9951('0x3b')]=_0x9951('0x4d');return _0x4b09e1;};exports[_0x9951('0x4e')]=function(_0x2c1098,_0x59854f,_0x58bc4f){var _0x56b441={};_0x56b441[_0x59854f]=_0x2c1098[_0x59854f];_0x56b441['active']=![];_0x56b441['scheduledat']=moment()['add'](_0x58bc4f,'minutes')['format'](_0x9951('0x32'));_0x56b441['ContactId']=_0x2c1098[_0x9951('0x18')];_0x56b441[_0x9951('0x4f')]=_0x2c1098[_0x9951('0x4f')];_0x56b441[_0x9951('0x1a')]=_0x2c1098[_0x9951('0x1a')]||undefined;return _0x56b441;};exports['decrementTalkink']=function(_0x111d98,_0x35373c){if(!_[_0x9951('0x15')](_0x111d98)){if(_0x111d98[_0x9951('0x50')]>0x0){_0x111d98[_0x9951('0x50')]-=0x1;}else{logger[_0x9951('0xb')](_0x35373c,_0x9951('0x51'));}}else{logger['error'](_0x35373c,_0x9951('0x52'));}};exports[_0x9951('0x53')]=function(_0x522feb){if(_0x522feb<=0x0){return!![];}return![];};function buildObj(_0x35ec94,_0x37e3c4,_0x3996f3){_0x35ec94[_0x9951('0x54')]=_0x37e3c4;_0x35ec94[_0x9951('0x55')]=_0x35ec94['queue'];_0x35ec94[_0x9951('0x56')]=_0x35ec94[_0x9951('0x57')];_0x35ec94[_0x9951('0x58')]='voice';if(_0x3996f3){_0x35ec94[_0x9951('0x59')]=_0x3996f3[_0x9951('0x59')];}return _0x35ec94;}exports['buildObj']=buildObj;exports[_0x9951('0x5a')]=function(_0x372ca6){var _0xc1bab={};_0xc1bab[_0x9951('0x5b')]=_0x372ca6[_0x9951('0x5b')];_0xc1bab[_0x9951('0x56')]=_0x372ca6[_0x9951('0x57')];_0xc1bab['uniqueid']=_0x372ca6['uniqueid'];return _0xc1bab;};exports[_0x9951('0x5c')]=function(_0x3294aa){var _0x56ace2=[];for(var _0x1bd951 in _0x3294aa){if(_0x3294aa['hasOwnProperty'](_0x1bd951)){if(!_['isNil'](_0x3294aa[_0x1bd951])&&_0x3294aa[_0x1bd951]['state']==='not_inuse'&&_0x3294aa[_0x1bd951][_0x9951('0x5d')]==='reachable'){_0x56ace2[_0x9951('0x5e')](_0x3294aa[_0x1bd951]['id']);}}}return _0x56ace2;};exports[_0x9951('0x5f')]=function(_0x169e65){var _0x2c79b2=moment()[_0x9951('0x4')](0x0);var _0x1e707b=moment(_0x169e65)[_0x9951('0x4')](0x0);return _0x2c79b2['diff'](_0x1e707b,_0x9951('0x5'));};exports[_0x9951('0x60')]=function(_0x5c58c6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c58c6[_0x9951('0x18')],'ListId':_0x5c58c6['ListId'],'VoiceQueueId':_0x5c58c6[_0x9951('0x1a')]||undefined,'CampaignId':_0x5c58c6['CampaignId']||undefined};};exports[_0x9951('0x61')]=function(_0xa2c55d){if(_0xa2c55d===_0x9951('0x41')||_0xa2c55d===_0x9951('0x62')||_0xa2c55d===_0x9951('0x5b')||_0xa2c55d===_0x9951('0x63')||_0xa2c55d==='campaigntype'||_0xa2c55d==='dialAnswer'||_0xa2c55d==='membername'||_0xa2c55d==='channelAgent'||_0xa2c55d===_0x9951('0x17')||_0xa2c55d===_0x9951('0x64')||_0xa2c55d===_0x9951('0x43')||_0xa2c55d===_0x9951('0x65')||_0xa2c55d==='countbusyretry'||_0xa2c55d===_0x9951('0x49')||_0xa2c55d==='countnoanswerretry'||_0xa2c55d==='countglobal'||_0xa2c55d===_0x9951('0x66')||_0xa2c55d===_0x9951('0x67')||_0xa2c55d==='callbackat'||_0xa2c55d===_0x9951('0x68')||_0xa2c55d==='ContactId'||_0xa2c55d===_0x9951('0x4f')||_0xa2c55d===_0x9951('0x39')||_0xa2c55d===_0x9951('0x1a')||_0xa2c55d==='sipcallid'||_0xa2c55d===_0x9951('0x69')||_0xa2c55d===_0x9951('0x6a')||_0xa2c55d===_0x9951('0x6b')||_0xa2c55d===_0x9951('0x6c')||_0xa2c55d===_0x9951('0x6d')||_0xa2c55d===_0x9951('0x6e')||_0xa2c55d===_0x9951('0x6f')||_0xa2c55d===_0x9951('0x70')||_0xa2c55d==='xmd-dialchannel'||_0xa2c55d===_0x9951('0x71')||_0xa2c55d==='xmd-cdrtype'||_0xa2c55d===_0x9951('0x72')||_0xa2c55d==='xmd-agiafter'||_0xa2c55d===_0x9951('0x73')||_0xa2c55d===_0x9951('0x74')||_0xa2c55d===_0x9951('0x75')||_0xa2c55d===_0x9951('0x76')||_0xa2c55d===_0x9951('0x77')||_0xa2c55d===_0x9951('0x78')||_0xa2c55d==='rtpaudioqoslossbridged'||_0xa2c55d==='rtpaudioqosrtt'||_0xa2c55d==='rtpaudioqosrttbridged'||_0xa2c55d===_0x9951('0x74')||_0xa2c55d===_0x9951('0x75')||_0xa2c55d===_0x9951('0x76')||_0xa2c55d===_0x9951('0x77')||_0xa2c55d==='rtpaudioqosloss'||_0xa2c55d===_0x9951('0x79')||_0xa2c55d===_0x9951('0x7a')||_0xa2c55d===_0x9951('0x7b')||_0xa2c55d===_0x9951('0x7c')||_0xa2c55d===_0x9951('0x7d')||_0xa2c55d===_0x9951('0x33')||_0xa2c55d===_0x9951('0x3b')){return![];}return!![];};exports[_0x9951('0x7e')]=function(_0x126fad,_0x5822f3){var _0x3555b8,_0x36dea8,_0x1f1917;if(_0x5822f3<=0x0){_0x5822f3=0x1;}_0x3555b8=new RegExp('\x5cw{0,'+_0x5822f3+'}$');_0x36dea8=Math[_0x9951('0x7f')](0xa,_0x5822f3-0x1);_0x1f1917=Math[_0x9951('0x7f')](0xa,_0x5822f3)-0x1;return util[_0x9951('0x11')]('%s',_[_0x9951('0x80')](_0x126fad,_0x3555b8,_['random'](_0x36dea8,_0x1f1917)));};exports[_0x9951('0x81')]=function(_0x100b51){var _0x16dd8c=_0x100b51[_0x9951('0x82')](/"(.*?)"/);return _0x16dd8c?_0x16dd8c[0x1]:_0x100b51;};exports[_0x9951('0x83')]=function(_0x397dd7){var _0x531597=_0x397dd7[_0x9951('0x82')](/<(.*?)>/);return _0x531597?_0x531597[0x1]:_0x397dd7;};function buildNoAnswerEventPayload(_0x34d08c,_0x508e74){var _0x30cb65=buildObj(_0x34d08c,_0x9951('0x84'));if(!_[_0x9951('0x10')](_0x508e74[_0x9951('0x85')])){Object[_0x9951('0x86')](_0x508e74[_0x9951('0x85')])[_0x9951('0x87')](function(_0x31d842){_0x30cb65[_0x31d842[_0x9951('0x88')]()]=_0x508e74['variables'][_0x31d842];});}return _0x30cb65;}exports[_0x9951('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 72e5b97..d6133c7 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 _0xf99e=['voicequeuechannelredirect','queueadd','string','boolean','queueremove','voicequeuechannelhangup'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf99e,0xd9));var _0xef99=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0xf99e[_0x54bac5];return _0xc15971;};'use strict';exports[_0xef99('0x0')]={'queue':{'type':_0xef99('0x1'),'required':!![]},'interface':{'type':_0xef99('0x1'),'required':!![]},'membername':{'type':_0xef99('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xef99('0x2'),'required':![]}};exports[_0xef99('0x3')]={'queue':{'type':_0xef99('0x1'),'required':!![]},'interface':{'type':_0xef99('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0xef99('0x2')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xef99('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xef99('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xef99('0x1')},'mixmonitorid':{'type':_0xef99('0x1')}};exports[_0xef99('0x4')]={'uniqueid':{'type':_0xef99('0x1'),'required':!![]}};exports[_0xef99('0x5')]={'uniqueid':{'type':_0xef99('0x1'),'required':!![]},'exten':{'type':_0xef99('0x1'),'required':!![]},'context':{'type':_0xef99('0x1')}}; \ No newline at end of file +var _0x2481=['string','number','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x2481,0x103));var _0x1248=function(_0x49f104,_0x129159){_0x49f104=_0x49f104-0x0;var _0x21ea5d=_0x2481[_0x49f104];return _0x21ea5d;};'use strict';exports[_0x1248('0x0')]={'queue':{'type':_0x1248('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x1248('0x2'),'required':![]},'paused':{'type':_0x1248('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x1248('0x1'),'required':!![]}};exports[_0x1248('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x1248('0x3')},'reason':{'type':_0x1248('0x1'),'required':![]}};exports[_0x1248('0x5')]={'module':{'type':_0x1248('0x1'),'required':![]}};exports[_0x1248('0x6')]={'uniqueid':{'type':_0x1248('0x1'),'required':!![]}};exports[_0x1248('0x7')]={'uniqueid':{'type':_0x1248('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x1248('0x1')},'mixmonitorid':{'type':_0x1248('0x1')}};exports[_0x1248('0x8')]={'uniqueid':{'type':_0x1248('0x1'),'required':!![]}};exports[_0x1248('0x9')]={'uniqueid':{'type':_0x1248('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index da8ad7c..63355a7 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 _0x3c72=['outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initSalesforceAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','merge','faxAccounts','exports','util','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','format','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c72,0x1ee));var _0x23c7=function(_0x15eeee,_0x1e96ef){_0x15eeee=_0x15eeee-0x0;var _0x3a7658=_0x3c72[_0x15eeee];return _0x3a7658;};'use strict';var util=require(_0x23c7('0x0'));var _=require(_0x23c7('0x1'));var moment=require(_0x23c7('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x23c7('0x3'));var Trunk=require(_0x23c7('0x4'));var VoiceQueue=require(_0x23c7('0x5'));var Trigger=require(_0x23c7('0x6'));var Template=require(_0x23c7('0x7'));var Campaign=require(_0x23c7('0x8'));var VoiceExtension=require(_0x23c7('0x9'));var ZendeskAccount=require(_0x23c7('0xa'));var SalesforceAccount=require(_0x23c7('0xb'));var FreshdeskAccount=require(_0x23c7('0xc'));var SugarcrmAccount=require(_0x23c7('0xd'));var ZohoAccount=require(_0x23c7('0xe'));var DeskAccount=require(_0x23c7('0xf'));var VtigerAccount=require(_0x23c7('0x10'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x23c7('0x11'));var FreshsalesAccount=require(_0x23c7('0x12'));var FaxAccount=require(_0x23c7('0x13'));var Realtime=function(){this[_0x23c7('0x14')]={};this[_0x23c7('0x15')]={};this[_0x23c7('0x16')]={};this[_0x23c7('0x17')]={};this[_0x23c7('0x18')]={};this['campaigns']={};this[_0x23c7('0x19')]={};this[_0x23c7('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0x23c7('0x1b')]={};this[_0x23c7('0x1c')]={};this[_0x23c7('0x1d')]={};this[_0x23c7('0x1e')]={};this[_0x23c7('0x1f')]={};this['freshdeskAccounts']={};this[_0x23c7('0x20')]={};this[_0x23c7('0x21')]={};this[_0x23c7('0x22')]={};this[_0x23c7('0x23')]={};this[_0x23c7('0x24')]={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x4a8ee3,_0x20090a,_0x3f92d2){var _0x2a2038=_[_0x23c7('0x25')](_0x4a8ee3,function(_0x177adc,_0x3d1b2e){return _0x177adc[_0x3f92d2];});for(var _0x53cc3c in _0x20090a){if(_0x20090a[_0x23c7('0x26')](_0x53cc3c)){if(!_0x2a2038[_0x53cc3c]){delete _0x20090a[_0x53cc3c];}}}}function freeIsNotKeySip(_0x5e9ba1,_0x3bd98e){var _0x5ce1f6=_[_0x23c7('0x25')](_0x5e9ba1,function(_0x2fe5ef,_0x5a1df8){return util['format'](_0x23c7('0x27'),_0x2fe5ef[_0x23c7('0x28')]);});for(var _0x2f5a37 in _0x3bd98e){if(_0x3bd98e['hasOwnProperty'](_0x2f5a37)){if(!_0x5ce1f6[_0x2f5a37]){delete _0x3bd98e[_0x2f5a37];}}}}function freeIsNotKeyAgent(_0x8a83b6,_0x15c115){var _0x40c0e6=_[_0x23c7('0x25')](_0x8a83b6,function(_0x561500,_0x6e9b27){var _0x4ab331=_[_0x23c7('0x29')](_0x561500['interface'])?util[_0x23c7('0x2a')](_0x23c7('0x27'),_0x561500['name']):_0x561500[_0x23c7('0x2b')];return _0x4ab331;});for(var _0x484c00 in _0x15c115){if(_0x15c115['hasOwnProperty'](_0x484c00)){if(!_0x40c0e6[_0x484c00]){delete _0x15c115[_0x484c00];}}}}function clearVoiceCallReports(_0x596756){_0x596756[_0x23c7('0x2c')]=0x0;_0x596756['answered']=0x0;_0x596756[_0x23c7('0x2d')]=0x0;_0x596756[_0x23c7('0x2e')]=0x0;_0x596756[_0x23c7('0x2f')]=0x0;}function clearCampaigns(_0x53b250){if(!_[_0x23c7('0x30')](_0x53b250)){for(var _0x184d46 in _0x53b250){if(_0x53b250[_0x23c7('0x26')](_0x184d46)){_0x53b250[_0x184d46][_0x23c7('0x31')]=0x0;_0x53b250[_0x184d46][_0x23c7('0x32')]=0x0;}}}}function clearVoiceQueues(_0x36ff4b){if(!_[_0x23c7('0x30')](_0x36ff4b)){for(var _0x5d7a61 in _0x36ff4b){if(_0x36ff4b[_0x23c7('0x26')](_0x5d7a61)){_0x36ff4b[_0x5d7a61]['total']=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x33')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x34')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x35')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x2d')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x2e')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x2f')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x36')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x37')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x38')]=0x0;_0x36ff4b[_0x5d7a61]['outboundCongestionCallsDay']=0x0;_0x36ff4b[_0x5d7a61]['outboundNoSuchCallsDay']=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x39')]=0x0;_0x36ff4b[_0x5d7a61]['outboundDropCallsDayTimeout']=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x3a')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x3b')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x3c')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x3d')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x3e')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x36')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x3f')]=0x0;_0x36ff4b[_0x5d7a61][_0x23c7('0x40')]=!![];}}}}Realtime[_0x23c7('0x41')][_0x23c7('0x42')]=function(_0x256e8a,_0x7bff29){for(var _0x47a819 in _0x7bff29){if(_0x256e8a[_0x23c7('0x26')](_0x47a819)){_0x256e8a[_0x47a819]=_0x7bff29[_0x47a819];}}};Realtime['prototype'][_0x23c7('0x43')]=function(){var _0x24d51d=this;return function(_0x27e28a){if(_0x27e28a){freeIsNotKeyAgent(_0x27e28a,_0x24d51d[_0x23c7('0x14')]);for(var _0x48fa91=0x0,_0x31bd8b={},_0x2ab569={};_0x48fa91<_0x27e28a[_0x23c7('0x44')];_0x48fa91+=0x1){_0x31bd8b=_0x27e28a[_0x48fa91];var _0x2a22ac=_[_0x23c7('0x29')](_0x31bd8b['interface'])?util['format']('SIP/%s',_0x31bd8b['name']):_0x31bd8b[_0x23c7('0x2b')];if(_[_0x23c7('0x45')](_0x24d51d[_0x23c7('0x14')][_0x2a22ac])){_0x24d51d['agents'][_0x2a22ac]=new Agent(_0x31bd8b);}else{_0x24d51d[_0x23c7('0x42')](_0x24d51d[_0x23c7('0x14')][_0x2a22ac],_0x31bd8b);}}}return _0x24d51d[_0x23c7('0x14')];};};Realtime[_0x23c7('0x41')][_0x23c7('0x46')]=function(){var _0x3f71f1=this;return function(_0x4d7fa5){if(_0x4d7fa5){freeIsNotKeySip(_0x4d7fa5,_0x3f71f1[_0x23c7('0x15')]);for(var _0x4824ef=0x0,_0xbdb878={},_0x516f19={};_0x4824ef<_0x4d7fa5[_0x23c7('0x44')];_0x4824ef+=0x1){_0xbdb878=_0x4d7fa5[_0x4824ef];if(_[_0x23c7('0x45')](_0x3f71f1['telephones'][util[_0x23c7('0x2a')](_0x23c7('0x27'),_0xbdb878[_0x23c7('0x28')])])){_0x3f71f1['telephones'][util['format'](_0x23c7('0x27'),_0xbdb878['name'])]=new Telephone(_0xbdb878);}else{_0x3f71f1['mergeFromDatabase'](_0x3f71f1[_0x23c7('0x15')][util[_0x23c7('0x2a')](_0x23c7('0x27'),_0xbdb878['name'])],_0xbdb878);}}}return _0x3f71f1['telephones'];};};Realtime[_0x23c7('0x41')][_0x23c7('0x47')]=function(){var _0x1bb9d3=this;return function(_0x21789e){if(_0x21789e){freeIsNotKeySip(_0x21789e,_0x1bb9d3['trunks']);for(var _0x32948c=0x0,_0x23eb87={},_0x4265ae={};_0x32948c<_0x21789e['length'];_0x32948c+=0x1){_0x23eb87=_0x21789e[_0x32948c];if(_[_0x23c7('0x45')](_0x1bb9d3[_0x23c7('0x16')][util[_0x23c7('0x2a')](_0x23c7('0x27'),_0x23eb87['name'])])){_0x1bb9d3[_0x23c7('0x16')][util[_0x23c7('0x2a')](_0x23c7('0x27'),_0x23eb87[_0x23c7('0x28')])]=new Trunk(_0x23eb87);}else{_0x1bb9d3['mergeFromDatabase'](_0x1bb9d3['trunks'][util[_0x23c7('0x2a')](_0x23c7('0x27'),_0x23eb87[_0x23c7('0x28')])],_0x23eb87);}}}return _0x1bb9d3[_0x23c7('0x16')];};};Realtime[_0x23c7('0x41')][_0x23c7('0x48')]=function(){var _0x1ee16a=this;return function(_0x2c88fe){if(_0x2c88fe){freeIsNotKey(_0x2c88fe,_0x1ee16a[_0x23c7('0x17')],_0x23c7('0x28'));for(var _0x5e4e8c=0x0,_0xd5635d={},_0x43c41d={};_0x5e4e8c<_0x2c88fe[_0x23c7('0x44')];_0x5e4e8c+=0x1){_0xd5635d=_0x2c88fe[_0x5e4e8c];if(_['isUndefined'](_0x1ee16a[_0x23c7('0x17')][_0xd5635d[_0x23c7('0x28')]])){_0x1ee16a[_0x23c7('0x17')][_0xd5635d[_0x23c7('0x28')]]=new VoiceQueue(_0xd5635d);}else{_0x1ee16a['mergeFromDatabase'](_0x1ee16a['voiceQueues'][_0xd5635d[_0x23c7('0x28')]],_0xd5635d);}}}return _0x1ee16a[_0x23c7('0x17')];};};Realtime['prototype'][_0x23c7('0x49')]=function(){var _0x513ba0=this;return function(_0x59a81d){if(_0x59a81d){freeIsNotKey(_0x59a81d,_0x513ba0[_0x23c7('0x18')],'id');for(var _0x60a0f4=0x0,_0xb02656={},_0x17ef3e={};_0x60a0f4<_0x59a81d[_0x23c7('0x44')];_0x60a0f4+=0x1){_0xb02656=_0x59a81d[_0x60a0f4];if(_[_0x23c7('0x45')](_0x513ba0[_0x23c7('0x18')][_0xb02656['id']])){_0x513ba0['triggers'][_0xb02656['id']]=new Trigger(_0xb02656);}else{_0x513ba0[_0x23c7('0x42')](_0x513ba0[_0x23c7('0x18')][_0xb02656['id']],_0xb02656);}}}return _0x513ba0[_0x23c7('0x18')];};};Realtime[_0x23c7('0x41')]['initTemplates']=function(){var _0x44035e=this;return function(_0x59004e){if(_0x59004e){freeIsNotKey(_0x59004e,_0x44035e['templates'],'id');for(var _0x3b74d4=0x0,_0x301c40={},_0x3fc277={};_0x3b74d4<_0x59004e[_0x23c7('0x44')];_0x3b74d4+=0x1){_0x301c40=_0x59004e[_0x3b74d4];if(_[_0x23c7('0x45')](_0x44035e[_0x23c7('0x19')][_0x301c40['id']])){_0x44035e[_0x23c7('0x19')][_0x301c40['id']]=new Template(_0x301c40);}else{_0x44035e[_0x23c7('0x42')](_0x44035e[_0x23c7('0x19')][_0x301c40['id']],_0x301c40);}}}return _0x44035e[_0x23c7('0x19')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x3db939=this;return function(_0x72ae6c){if(_0x72ae6c){freeIsNotKey(_0x72ae6c,_0x3db939['zendeskAccounts'],'id');for(var _0x6dceb5=0x0,_0x184bf3={},_0x53f821={};_0x6dceb5<_0x72ae6c[_0x23c7('0x44')];_0x6dceb5+=0x1){_0x184bf3=_0x72ae6c[_0x6dceb5];if(_[_0x23c7('0x45')](_0x3db939[_0x23c7('0x1d')][_0x184bf3['id']])){_0x3db939[_0x23c7('0x1d')][_0x184bf3['id']]=new ZendeskAccount(_0x184bf3);}else{_0x3db939[_0x23c7('0x42')](_0x3db939[_0x23c7('0x1d')][_0x184bf3['id']],_0x184bf3);}}}return _0x3db939[_0x23c7('0x1d')];};};Realtime['prototype'][_0x23c7('0x4a')]=function(){var _0x52aadf=this;return function(_0x52a81c){if(_0x52a81c){freeIsNotKey(_0x52a81c,_0x52aadf['salesforceAccounts'],'id');for(var _0x4e9ce=0x0,_0x32f7aa={},_0x368372={};_0x4e9ce<_0x52a81c['length'];_0x4e9ce+=0x1){_0x32f7aa=_0x52a81c[_0x4e9ce];if(_[_0x23c7('0x45')](_0x52aadf[_0x23c7('0x1e')][_0x32f7aa['id']])){_0x52aadf[_0x23c7('0x1e')][_0x32f7aa['id']]=new SalesforceAccount(_0x32f7aa);}else{_0x52aadf[_0x23c7('0x42')](_0x52aadf[_0x23c7('0x1e')][_0x32f7aa['id']],_0x32f7aa);}}}return _0x52aadf[_0x23c7('0x1e')];};};Realtime[_0x23c7('0x41')]['initFreshdeskAccounts']=function(){var _0x47d522=this;return function(_0x58c64a){if(_0x58c64a){freeIsNotKey(_0x58c64a,_0x47d522['freshdeskAccounts'],'id');for(var _0x9be4b8=0x0,_0x3dbac0={},_0x19e776={};_0x9be4b8<_0x58c64a[_0x23c7('0x44')];_0x9be4b8+=0x1){_0x3dbac0=_0x58c64a[_0x9be4b8];if(_[_0x23c7('0x45')](_0x47d522[_0x23c7('0x4b')][_0x3dbac0['id']])){_0x47d522[_0x23c7('0x4b')][_0x3dbac0['id']]=new FreshdeskAccount(_0x3dbac0);}else{_0x47d522[_0x23c7('0x42')](_0x47d522[_0x23c7('0x4b')][_0x3dbac0['id']],_0x3dbac0);}}}return _0x47d522[_0x23c7('0x4b')];};};Realtime['prototype'][_0x23c7('0x4c')]=function(){var _0x481d66=this;return function(_0x18640f){if(_0x18640f){freeIsNotKey(_0x18640f,_0x481d66[_0x23c7('0x20')],'id');for(var _0x46e233=0x0,_0x317dee={},_0x3f34c9={};_0x46e233<_0x18640f[_0x23c7('0x44')];_0x46e233+=0x1){_0x317dee=_0x18640f[_0x46e233];if(_[_0x23c7('0x45')](_0x481d66[_0x23c7('0x20')][_0x317dee['id']])){_0x481d66[_0x23c7('0x20')][_0x317dee['id']]=new ZohoAccount(_0x317dee);}else{_0x481d66[_0x23c7('0x42')](_0x481d66[_0x23c7('0x20')][_0x317dee['id']],_0x317dee);}}}return _0x481d66[_0x23c7('0x20')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x3c7c51=this;return function(_0x506a7d){if(_0x506a7d){freeIsNotKey(_0x506a7d,_0x3c7c51[_0x23c7('0x21')],'id');for(var _0x44907d=0x0,_0x5b64b7={},_0x3dfb7c={};_0x44907d<_0x506a7d[_0x23c7('0x44')];_0x44907d+=0x1){_0x5b64b7=_0x506a7d[_0x44907d];if(_[_0x23c7('0x45')](_0x3c7c51[_0x23c7('0x21')][_0x5b64b7['id']])){_0x3c7c51[_0x23c7('0x21')][_0x5b64b7['id']]=new DeskAccount(_0x5b64b7);}else{_0x3c7c51[_0x23c7('0x42')](_0x3c7c51['deskAccounts'][_0x5b64b7['id']],_0x5b64b7);}}}return _0x3c7c51[_0x23c7('0x21')];};};Realtime[_0x23c7('0x41')][_0x23c7('0x4d')]=function(){var _0x321f56=this;return function(_0x40f5a2){if(_0x40f5a2){freeIsNotKey(_0x40f5a2,_0x321f56[_0x23c7('0x1f')],'id');for(var _0x4bd94d=0x0,_0x42f508={},_0x16b1bf={};_0x4bd94d<_0x40f5a2[_0x23c7('0x44')];_0x4bd94d+=0x1){_0x42f508=_0x40f5a2[_0x4bd94d];if(_[_0x23c7('0x45')](_0x321f56[_0x23c7('0x1f')][_0x42f508['id']])){_0x321f56[_0x23c7('0x1f')][_0x42f508['id']]=new SugarcrmAccount(_0x42f508);}else{_0x321f56[_0x23c7('0x42')](_0x321f56['sugarcrmAccounts'][_0x42f508['id']],_0x42f508);}}}return _0x321f56[_0x23c7('0x1f')];};};Realtime[_0x23c7('0x41')][_0x23c7('0x4e')]=function(){var _0x5abbc7=this;return function(_0x261ead){if(_0x261ead){freeIsNotKey(_0x261ead,_0x5abbc7['vtigerAccounts'],'id');for(var _0x41980a=0x0,_0x486e2b={},_0x49098e={};_0x41980a<_0x261ead['length'];_0x41980a+=0x1){_0x486e2b=_0x261ead[_0x41980a];if(_[_0x23c7('0x45')](_0x5abbc7[_0x23c7('0x22')][_0x486e2b['id']])){_0x5abbc7[_0x23c7('0x22')][_0x486e2b['id']]=new VtigerAccount(_0x486e2b);}else{_0x5abbc7[_0x23c7('0x42')](_0x5abbc7[_0x23c7('0x22')][_0x486e2b['id']],_0x486e2b);}}}return _0x5abbc7[_0x23c7('0x22')];};};Realtime['prototype'][_0x23c7('0x4f')]=function(){var _0x329bf8=this;return function(_0x9ee39f){if(_0x9ee39f){freeIsNotKey(_0x9ee39f,_0x329bf8[_0x23c7('0x23')],'id');for(var _0x1d0c4f=0x0,_0x2d64c7={},_0x57d43f={};_0x1d0c4f<_0x9ee39f[_0x23c7('0x44')];_0x1d0c4f+=0x1){_0x2d64c7=_0x9ee39f[_0x1d0c4f];if(_[_0x23c7('0x45')](_0x329bf8[_0x23c7('0x23')][_0x2d64c7['id']])){_0x329bf8[_0x23c7('0x23')][_0x2d64c7['id']]=new ServicenowAccount(_0x2d64c7);}else{_0x329bf8[_0x23c7('0x42')](_0x329bf8[_0x23c7('0x23')][_0x2d64c7['id']],_0x2d64c7);}}}return _0x329bf8[_0x23c7('0x23')];};};Realtime[_0x23c7('0x41')][_0x23c7('0x50')]=function(){var _0x28b8e2=this;return function(_0x52ac32){if(_0x52ac32){freeIsNotKey(_0x52ac32,_0x28b8e2[_0x23c7('0x24')],'id');for(var _0x247cee=0x0,_0x3779d9={},_0x19c349={};_0x247cee<_0x52ac32[_0x23c7('0x44')];_0x247cee+=0x1){_0x3779d9=_0x52ac32[_0x247cee];if(_['isUndefined'](_0x28b8e2[_0x23c7('0x24')][_0x3779d9['id']])){_0x28b8e2['dynamics365Accounts'][_0x3779d9['id']]=new Dynamics365Account(_0x3779d9);}else{_0x28b8e2['mergeFromDatabase'](_0x28b8e2[_0x23c7('0x24')][_0x3779d9['id']],_0x3779d9);}}}return _0x28b8e2[_0x23c7('0x24')];};};Realtime['prototype'][_0x23c7('0x51')]=function(){var _0x583583=this;return function(_0x2bd688){if(_0x2bd688){freeIsNotKey(_0x2bd688,_0x583583[_0x23c7('0x52')],'id');for(var _0x473f02=0x0,_0x2713c1={},_0x59196d={};_0x473f02<_0x2bd688[_0x23c7('0x44')];_0x473f02+=0x1){_0x2713c1=_0x2bd688[_0x473f02];if(_[_0x23c7('0x45')](_0x583583[_0x23c7('0x52')][_0x2713c1['id']])){_0x583583[_0x23c7('0x52')][_0x2713c1['id']]=new FreshsalesAccount(_0x2713c1);}else{_0x583583[_0x23c7('0x42')](_0x583583['freshsalesAccounts'][_0x2713c1['id']],_0x2713c1);}}}return _0x583583[_0x23c7('0x52')];};};Realtime[_0x23c7('0x41')]['initVoiceQueueHopperHistory']=function(){var _0x4d44f9=this;return function(_0x12c26f){for(var _0x1abd7f=0x0;_0x1abd7f<_0x12c26f[_0x23c7('0x44')];_0x1abd7f+=0x1){_['merge'](_0x4d44f9[_0x23c7('0x17')][_0x12c26f[_0x1abd7f]['name']],_0x12c26f[_0x1abd7f]);}return _0x4d44f9[_0x23c7('0x17')];};};Realtime[_0x23c7('0x41')][_0x23c7('0x53')]=function(){var _0x2873d9=this;return function(_0x4e46fe){clearVoiceQueues(_0x2873d9[_0x23c7('0x17')]);if(_0x4e46fe){_0x4e46fe=_[_0x23c7('0x54')](_0x4e46fe,_0x23c7('0x55'));for(var _0x550d20 in _0x4e46fe){if(_0x4e46fe[_0x23c7('0x26')](_0x550d20)){var _0x584807={};for(var _0x1125da=0x0;_0x1125da<_0x4e46fe[_0x550d20][_0x23c7('0x44')];_0x1125da+=0x1){var _0x16bd82=_0x4e46fe[_0x550d20][_0x1125da][_0x23c7('0x56')];if(_0x2873d9['voiceQueues'][_0x16bd82]){if(_0x4e46fe[_0x550d20][_0x1125da][_0x23c7('0x57')]){_0x2873d9[_0x23c7('0x17')][_0x16bd82][_0x23c7('0x34')]+=0x1;}if(_0x4e46fe[_0x550d20][_0x1125da][_0x23c7('0x58')]){_0x2873d9[_0x23c7('0x17')][_0x16bd82]['abandoned']+=0x1;}_0x2873d9[_0x23c7('0x17')][_0x16bd82][_0x23c7('0x2d')]+=moment(_0x4e46fe[_0x550d20][_0x1125da]['queuecallerleaveAt'])[_0x23c7('0x59')](moment(_0x4e46fe[_0x550d20][_0x1125da][_0x23c7('0x5a')]),_0x23c7('0x5b'))||0x0;if(_0x1125da===_0x4e46fe[_0x550d20][_0x23c7('0x44')]-0x1){_0x2873d9['voiceQueues'][_0x16bd82][_0x23c7('0x2e')]+=moment(_0x4e46fe[_0x550d20][_0x1125da][_0x23c7('0x5c')]||_0x4e46fe[_0x550d20][_0x1125da][_0x23c7('0x5d')]||_0x4e46fe[_0x550d20][_0x1125da][_0x23c7('0x5e')])[_0x23c7('0x59')](moment(_0x4e46fe[_0x550d20][_0x1125da]['queuecallerjoinAt']),_0x23c7('0x5b'))||0x0;_0x2873d9['voiceQueues'][_0x16bd82][_0x23c7('0x2c')]+=0x1;if(_0x4e46fe[_0x550d20][_0x1125da][_0x23c7('0x5f')]){_0x2873d9['voiceQueues'][_0x16bd82][_0x23c7('0x33')]+=0x1;_0x2873d9[_0x23c7('0x17')][_0x16bd82][_0x23c7('0x2f')]+=moment(_0x4e46fe[_0x550d20][_0x1125da]['queuecallercompleteAt'])[_0x23c7('0x59')](moment(_0x4e46fe[_0x550d20][_0x1125da][_0x23c7('0x60')]),_0x23c7('0x5b'))||0x0;}}else{_0x2873d9[_0x23c7('0x17')][_0x16bd82][_0x23c7('0x2e')]+=_0x2873d9[_0x23c7('0x17')][_0x16bd82][_0x23c7('0x2d')]||0x0;}}}}}}return _0x2873d9[_0x23c7('0x17')];};};Realtime[_0x23c7('0x41')][_0x23c7('0x61')]=function(){var _0x5064b3=this;return function(_0x481922){clearVoiceCallReports(_0x5064b3[_0x23c7('0x1a')]);if(_0x481922){for(var _0x268c5c=0x0;_0x268c5c<_0x481922['length'];_0x268c5c+=0x1){_0x5064b3[_0x23c7('0x1a')][_0x23c7('0x2c')]+=0x1;_0x5064b3['outbound'][_0x23c7('0x2e')]+=_0x481922[_0x268c5c][_0x23c7('0x62')];if(_0x481922[_0x268c5c][_0x23c7('0x63')]===_0x23c7('0x64')){_0x5064b3[_0x23c7('0x1a')][_0x23c7('0x33')]+=0x1;_0x5064b3['outbound'][_0x23c7('0x2d')]+=_0x481922[_0x268c5c][_0x23c7('0x62')]-_0x481922[_0x268c5c][_0x23c7('0x65')]||0x0;_0x5064b3[_0x23c7('0x1a')]['sumBillable']+=_0x481922[_0x268c5c]['billableseconds'];}}}return _0x5064b3[_0x23c7('0x1a')];};};Realtime[_0x23c7('0x41')][_0x23c7('0x66')]=function(){var _0x4b3085=this;return function(_0x5c5ebe){if(_0x5c5ebe){freeIsNotKey(_0x5c5ebe,_0x4b3085[_0x23c7('0x67')],_0x23c7('0x28'));for(var _0x3d465a=0x0,_0xcf9e3b={};_0x3d465a<_0x5c5ebe[_0x23c7('0x44')];_0x3d465a+=0x1){_0xcf9e3b=_0x5c5ebe[_0x3d465a];if(_[_0x23c7('0x45')](_0x4b3085[_0x23c7('0x67')][_0xcf9e3b[_0x23c7('0x28')]])){_0x4b3085[_0x23c7('0x67')][_0xcf9e3b['name']]=new Campaign(_0xcf9e3b);}else{_0x4b3085[_0x23c7('0x42')](_0x4b3085[_0x23c7('0x67')][_0xcf9e3b[_0x23c7('0x28')]],_0xcf9e3b);_0x4b3085['campaigns'][_0xcf9e3b[_0x23c7('0x28')]][_0x23c7('0x68')]=_0xcf9e3b['SquareProject']?_0xcf9e3b[_0x23c7('0x69')][_0x23c7('0x28')]:undefined;}}}return _0x4b3085[_0x23c7('0x67')];};};Realtime[_0x23c7('0x41')]['initVoiceExtensions']=function(){var _0x455d0a=this;return function(_0x46eafa){if(_0x46eafa){freeIsNotKey(_0x46eafa,_0x455d0a[_0x23c7('0x6a')],'id');for(var _0x4d040e=0x0,_0x4a3fc4={};_0x4d040e<_0x46eafa[_0x23c7('0x44')];_0x4d040e+=0x1){_0x4a3fc4=_0x46eafa[_0x4d040e];if(_[_0x23c7('0x45')](_0x455d0a[_0x23c7('0x6a')][_0x4a3fc4['id']])){_0x455d0a[_0x23c7('0x6a')][_0x4a3fc4['id']]=new VoiceExtension(_0x4a3fc4);}else{_0x455d0a[_0x23c7('0x42')](_0x455d0a[_0x23c7('0x6a')][_0x4a3fc4['id']],_0x4a3fc4);}}}return _0x455d0a[_0x23c7('0x6a')];};};Realtime[_0x23c7('0x41')][_0x23c7('0x6b')]=function(){var _0x504329=this;return function(_0x220aa8){clearCampaigns(_0x504329['campaigns']);for(var _0x318285=0x0;_0x318285<_0x220aa8['length'];_0x318285+=0x1){_[_0x23c7('0x6c')](_0x504329[_0x23c7('0x67')][_0x220aa8[_0x318285][_0x23c7('0x28')]],_0x220aa8[_0x318285]);}return _0x504329[_0x23c7('0x67')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x2824ed=this;return function(_0x1488c1){if(_0x1488c1){freeIsNotKey(_0x1488c1,_0x2824ed['faxAccounts'],'id');for(var _0x1a3268=0x0,_0x1a1eab={},_0x397271={};_0x1a3268<_0x1488c1[_0x23c7('0x44')];_0x1a3268+=0x1){_0x1a1eab=_0x1488c1[_0x1a3268];if(_[_0x23c7('0x45')](_0x2824ed[_0x23c7('0x6d')][_0x1a1eab['id']])){_0x2824ed[_0x23c7('0x6d')][_0x1a1eab['id']]=new FaxAccount(_0x1a1eab);}else{_0x2824ed[_0x23c7('0x42')](_0x2824ed[_0x23c7('0x6d')][_0x1a1eab['id']],_0x1a1eab);}}}return _0x2824ed['faxAccounts'];};};module[_0x23c7('0x6e')]=Realtime; \ No newline at end of file +var _0x9aac=['agents','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','name','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','mergeFromDatabase','telephones','initTrunks','trunks','initVoiceQueues','initTriggers','triggers','initZendeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','merge','initFaxAccounts','faxAccounts','exports','util','moment','../model/agent','../model/trunk','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount'];(function(_0x506fa6,_0x453d83){var _0x40eb00=function(_0x1e240a){while(--_0x1e240a){_0x506fa6['push'](_0x506fa6['shift']());}};_0x40eb00(++_0x453d83);}(_0x9aac,0x135));var _0xc9aa=function(_0x6b61de,_0x156fe0){_0x6b61de=_0x6b61de-0x0;var _0x468a10=_0x9aac[_0x6b61de];return _0x468a10;};'use strict';var util=require(_0xc9aa('0x0'));var _=require('lodash');var moment=require(_0xc9aa('0x1'));var Agent=require(_0xc9aa('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0xc9aa('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xc9aa('0x4'));var Template=require('../model/template');var Campaign=require(_0xc9aa('0x5'));var VoiceExtension=require(_0xc9aa('0x6'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xc9aa('0x7'));var FreshdeskAccount=require(_0xc9aa('0x8'));var SugarcrmAccount=require(_0xc9aa('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xc9aa('0xa'));var VtigerAccount=require(_0xc9aa('0xb'));var ServicenowAccount=require(_0xc9aa('0xc'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xc9aa('0xd'));var FaxAccount=require(_0xc9aa('0xe'));var Realtime=function(){this[_0xc9aa('0xf')]={};this['telephones']={};this['trunks']={};this[_0xc9aa('0x10')]={};this['triggers']={};this[_0xc9aa('0x11')]={};this[_0xc9aa('0x12')]={};this[_0xc9aa('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc9aa('0x14')]={};this[_0xc9aa('0x15')]={};this[_0xc9aa('0x16')]={};this[_0xc9aa('0x17')]={};this[_0xc9aa('0x18')]={};this[_0xc9aa('0x19')]={};this[_0xc9aa('0x1a')]={};this[_0xc9aa('0x1b')]={};this[_0xc9aa('0x1c')]={};this[_0xc9aa('0x1d')]={};this[_0xc9aa('0x1e')]={};this[_0xc9aa('0x1f')]={};this[_0xc9aa('0x20')]={};this[_0xc9aa('0x21')]={};this['dynamics365Accounts']={};this[_0xc9aa('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x5b351f,_0x477ca5,_0x553805){var _0x13ed6c=_[_0xc9aa('0x23')](_0x5b351f,function(_0x4b42a4,_0x35f3b4){return _0x4b42a4[_0x553805];});for(var _0x28a1a0 in _0x477ca5){if(_0x477ca5[_0xc9aa('0x24')](_0x28a1a0)){if(!_0x13ed6c[_0x28a1a0]){delete _0x477ca5[_0x28a1a0];}}}}function freeIsNotKeySip(_0x4bacb3,_0x2999e0){var _0x13d32d=_[_0xc9aa('0x23')](_0x4bacb3,function(_0x22ad7f,_0x3a806e){return util[_0xc9aa('0x25')]('SIP/%s',_0x22ad7f[_0xc9aa('0x26')]);});for(var _0x55037f in _0x2999e0){if(_0x2999e0[_0xc9aa('0x24')](_0x55037f)){if(!_0x13d32d[_0x55037f]){delete _0x2999e0[_0x55037f];}}}}function freeIsNotKeyAgent(_0x5b5ffc,_0x7c837f){var _0x5e51e9=_[_0xc9aa('0x23')](_0x5b5ffc,function(_0x3f8bfd,_0x214c09){var _0x465f52=_['isNil'](_0x3f8bfd[_0xc9aa('0x27')])?util[_0xc9aa('0x25')](_0xc9aa('0x28'),_0x3f8bfd[_0xc9aa('0x26')]):_0x3f8bfd[_0xc9aa('0x27')];return _0x465f52;});for(var _0x4fdeef in _0x7c837f){if(_0x7c837f[_0xc9aa('0x24')](_0x4fdeef)){if(!_0x5e51e9[_0x4fdeef]){delete _0x7c837f[_0x4fdeef];}}}}function clearVoiceCallReports(_0xdd020f){_0xdd020f[_0xc9aa('0x29')]=0x0;_0xdd020f[_0xc9aa('0x2a')]=0x0;_0xdd020f[_0xc9aa('0x2b')]=0x0;_0xdd020f[_0xc9aa('0x2c')]=0x0;_0xdd020f[_0xc9aa('0x2d')]=0x0;}function clearCampaigns(_0x4dab46){if(!_[_0xc9aa('0x2e')](_0x4dab46)){for(var _0x40e628 in _0x4dab46){if(_0x4dab46['hasOwnProperty'](_0x40e628)){_0x4dab46[_0x40e628]['ivrTotalCallsDays']=0x0;_0x4dab46[_0x40e628][_0xc9aa('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x10a62e){if(!_[_0xc9aa('0x2e')](_0x10a62e)){for(var _0x464cac in _0x10a62e){if(_0x10a62e[_0xc9aa('0x24')](_0x464cac)){_0x10a62e[_0x464cac][_0xc9aa('0x29')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x2a')]=0x0;_0x10a62e[_0x464cac]['unmanaged']=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x30')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x2b')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x2c')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x2d')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x31')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x32')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x33')]=0x0;_0x10a62e[_0x464cac]['outboundCongestionCallsDay']=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x34')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x35')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x36')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x37')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x38')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x39')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x3a')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x3b')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x31')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x3c')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x3d')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1ebcc8,_0x5cdcef){for(var _0x3e5bdc in _0x5cdcef){if(_0x1ebcc8[_0xc9aa('0x24')](_0x3e5bdc)){_0x1ebcc8[_0x3e5bdc]=_0x5cdcef[_0x3e5bdc];}}};Realtime[_0xc9aa('0x3e')]['initAgents']=function(){var _0x5d68fa=this;return function(_0x852ac8){if(_0x852ac8){freeIsNotKeyAgent(_0x852ac8,_0x5d68fa['agents']);for(var _0x40bec1=0x0,_0x646f83={},_0x4ae06c={};_0x40bec1<_0x852ac8[_0xc9aa('0x3f')];_0x40bec1+=0x1){_0x646f83=_0x852ac8[_0x40bec1];var _0x3e2669=_[_0xc9aa('0x40')](_0x646f83[_0xc9aa('0x27')])?util['format'](_0xc9aa('0x28'),_0x646f83[_0xc9aa('0x26')]):_0x646f83['interface'];if(_[_0xc9aa('0x41')](_0x5d68fa[_0xc9aa('0xf')][_0x3e2669])){_0x5d68fa[_0xc9aa('0xf')][_0x3e2669]=new Agent(_0x646f83);}else{_0x5d68fa[_0xc9aa('0x42')](_0x5d68fa[_0xc9aa('0xf')][_0x3e2669],_0x646f83);}}}return _0x5d68fa[_0xc9aa('0xf')];};};Realtime['prototype']['initTelephones']=function(){var _0x3914e9=this;return function(_0x45d4ca){if(_0x45d4ca){freeIsNotKeySip(_0x45d4ca,_0x3914e9[_0xc9aa('0x43')]);for(var _0x44c360=0x0,_0x2da11d={},_0x24fae6={};_0x44c360<_0x45d4ca[_0xc9aa('0x3f')];_0x44c360+=0x1){_0x2da11d=_0x45d4ca[_0x44c360];if(_['isUndefined'](_0x3914e9[_0xc9aa('0x43')][util[_0xc9aa('0x25')](_0xc9aa('0x28'),_0x2da11d[_0xc9aa('0x26')])])){_0x3914e9['telephones'][util['format']('SIP/%s',_0x2da11d[_0xc9aa('0x26')])]=new Telephone(_0x2da11d);}else{_0x3914e9[_0xc9aa('0x42')](_0x3914e9[_0xc9aa('0x43')][util[_0xc9aa('0x25')](_0xc9aa('0x28'),_0x2da11d[_0xc9aa('0x26')])],_0x2da11d);}}}return _0x3914e9[_0xc9aa('0x43')];};};Realtime['prototype'][_0xc9aa('0x44')]=function(){var _0x2bf707=this;return function(_0x1d8ff2){if(_0x1d8ff2){freeIsNotKeySip(_0x1d8ff2,_0x2bf707[_0xc9aa('0x45')]);for(var _0x5938e5=0x0,_0x5ba45d={},_0x43d026={};_0x5938e5<_0x1d8ff2['length'];_0x5938e5+=0x1){_0x5ba45d=_0x1d8ff2[_0x5938e5];if(_[_0xc9aa('0x41')](_0x2bf707[_0xc9aa('0x45')][util[_0xc9aa('0x25')](_0xc9aa('0x28'),_0x5ba45d['name'])])){_0x2bf707[_0xc9aa('0x45')][util['format'](_0xc9aa('0x28'),_0x5ba45d[_0xc9aa('0x26')])]=new Trunk(_0x5ba45d);}else{_0x2bf707[_0xc9aa('0x42')](_0x2bf707[_0xc9aa('0x45')][util[_0xc9aa('0x25')]('SIP/%s',_0x5ba45d[_0xc9aa('0x26')])],_0x5ba45d);}}}return _0x2bf707['trunks'];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x46')]=function(){var _0x2e2f1a=this;return function(_0x42b7b8){if(_0x42b7b8){freeIsNotKey(_0x42b7b8,_0x2e2f1a[_0xc9aa('0x10')],_0xc9aa('0x26'));for(var _0x392bcd=0x0,_0x49798f={},_0x4975a9={};_0x392bcd<_0x42b7b8[_0xc9aa('0x3f')];_0x392bcd+=0x1){_0x49798f=_0x42b7b8[_0x392bcd];if(_['isUndefined'](_0x2e2f1a[_0xc9aa('0x10')][_0x49798f['name']])){_0x2e2f1a[_0xc9aa('0x10')][_0x49798f[_0xc9aa('0x26')]]=new VoiceQueue(_0x49798f);}else{_0x2e2f1a[_0xc9aa('0x42')](_0x2e2f1a[_0xc9aa('0x10')][_0x49798f[_0xc9aa('0x26')]],_0x49798f);}}}return _0x2e2f1a[_0xc9aa('0x10')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x47')]=function(){var _0x3e0cf4=this;return function(_0x40da91){if(_0x40da91){freeIsNotKey(_0x40da91,_0x3e0cf4[_0xc9aa('0x48')],'id');for(var _0x150f3e=0x0,_0x5bda7c={},_0x164c0b={};_0x150f3e<_0x40da91[_0xc9aa('0x3f')];_0x150f3e+=0x1){_0x5bda7c=_0x40da91[_0x150f3e];if(_[_0xc9aa('0x41')](_0x3e0cf4['triggers'][_0x5bda7c['id']])){_0x3e0cf4['triggers'][_0x5bda7c['id']]=new Trigger(_0x5bda7c);}else{_0x3e0cf4['mergeFromDatabase'](_0x3e0cf4['triggers'][_0x5bda7c['id']],_0x5bda7c);}}}return _0x3e0cf4['triggers'];};};Realtime['prototype']['initTemplates']=function(){var _0x44c5db=this;return function(_0x4d191b){if(_0x4d191b){freeIsNotKey(_0x4d191b,_0x44c5db[_0xc9aa('0x12')],'id');for(var _0x25ab8e=0x0,_0xcf250a={},_0x710cec={};_0x25ab8e<_0x4d191b[_0xc9aa('0x3f')];_0x25ab8e+=0x1){_0xcf250a=_0x4d191b[_0x25ab8e];if(_[_0xc9aa('0x41')](_0x44c5db['templates'][_0xcf250a['id']])){_0x44c5db[_0xc9aa('0x12')][_0xcf250a['id']]=new Template(_0xcf250a);}else{_0x44c5db[_0xc9aa('0x42')](_0x44c5db[_0xc9aa('0x12')][_0xcf250a['id']],_0xcf250a);}}}return _0x44c5db['templates'];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x49')]=function(){var _0x26194c=this;return function(_0x1831bd){if(_0x1831bd){freeIsNotKey(_0x1831bd,_0x26194c['zendeskAccounts'],'id');for(var _0x589529=0x0,_0x402906={},_0x43f164={};_0x589529<_0x1831bd[_0xc9aa('0x3f')];_0x589529+=0x1){_0x402906=_0x1831bd[_0x589529];if(_[_0xc9aa('0x41')](_0x26194c[_0xc9aa('0x1a')][_0x402906['id']])){_0x26194c[_0xc9aa('0x1a')][_0x402906['id']]=new ZendeskAccount(_0x402906);}else{_0x26194c[_0xc9aa('0x42')](_0x26194c['zendeskAccounts'][_0x402906['id']],_0x402906);}}}return _0x26194c['zendeskAccounts'];};};Realtime[_0xc9aa('0x3e')]['initSalesforceAccounts']=function(){var _0x476c08=this;return function(_0x216e42){if(_0x216e42){freeIsNotKey(_0x216e42,_0x476c08[_0xc9aa('0x1b')],'id');for(var _0x77ae93=0x0,_0x4cb558={},_0x5f1cf2={};_0x77ae93<_0x216e42[_0xc9aa('0x3f')];_0x77ae93+=0x1){_0x4cb558=_0x216e42[_0x77ae93];if(_[_0xc9aa('0x41')](_0x476c08['salesforceAccounts'][_0x4cb558['id']])){_0x476c08[_0xc9aa('0x1b')][_0x4cb558['id']]=new SalesforceAccount(_0x4cb558);}else{_0x476c08[_0xc9aa('0x42')](_0x476c08[_0xc9aa('0x1b')][_0x4cb558['id']],_0x4cb558);}}}return _0x476c08[_0xc9aa('0x1b')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x17924e=this;return function(_0x27d702){if(_0x27d702){freeIsNotKey(_0x27d702,_0x17924e[_0xc9aa('0x1d')],'id');for(var _0x476d8a=0x0,_0x1470b3={},_0x7ac27={};_0x476d8a<_0x27d702[_0xc9aa('0x3f')];_0x476d8a+=0x1){_0x1470b3=_0x27d702[_0x476d8a];if(_[_0xc9aa('0x41')](_0x17924e[_0xc9aa('0x1d')][_0x1470b3['id']])){_0x17924e[_0xc9aa('0x1d')][_0x1470b3['id']]=new FreshdeskAccount(_0x1470b3);}else{_0x17924e['mergeFromDatabase'](_0x17924e[_0xc9aa('0x1d')][_0x1470b3['id']],_0x1470b3);}}}return _0x17924e[_0xc9aa('0x1d')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4a')]=function(){var _0x3dfae1=this;return function(_0x338c76){if(_0x338c76){freeIsNotKey(_0x338c76,_0x3dfae1[_0xc9aa('0x1e')],'id');for(var _0x32d0c4=0x0,_0x947ad6={},_0x1c1cd4={};_0x32d0c4<_0x338c76['length'];_0x32d0c4+=0x1){_0x947ad6=_0x338c76[_0x32d0c4];if(_[_0xc9aa('0x41')](_0x3dfae1[_0xc9aa('0x1e')][_0x947ad6['id']])){_0x3dfae1[_0xc9aa('0x1e')][_0x947ad6['id']]=new ZohoAccount(_0x947ad6);}else{_0x3dfae1[_0xc9aa('0x42')](_0x3dfae1[_0xc9aa('0x1e')][_0x947ad6['id']],_0x947ad6);}}}return _0x3dfae1['zohoAccounts'];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4b')]=function(){var _0x25b5b7=this;return function(_0xdbb4e3){if(_0xdbb4e3){freeIsNotKey(_0xdbb4e3,_0x25b5b7['deskAccounts'],'id');for(var _0x4a4816=0x0,_0xbc766b={},_0x2ddbfb={};_0x4a4816<_0xdbb4e3[_0xc9aa('0x3f')];_0x4a4816+=0x1){_0xbc766b=_0xdbb4e3[_0x4a4816];if(_[_0xc9aa('0x41')](_0x25b5b7[_0xc9aa('0x1f')][_0xbc766b['id']])){_0x25b5b7[_0xc9aa('0x1f')][_0xbc766b['id']]=new DeskAccount(_0xbc766b);}else{_0x25b5b7[_0xc9aa('0x42')](_0x25b5b7[_0xc9aa('0x1f')][_0xbc766b['id']],_0xbc766b);}}}return _0x25b5b7[_0xc9aa('0x1f')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4c')]=function(){var _0x364613=this;return function(_0x33f26b){if(_0x33f26b){freeIsNotKey(_0x33f26b,_0x364613[_0xc9aa('0x1c')],'id');for(var _0x1f8e54=0x0,_0x1a70ec={},_0x1be28a={};_0x1f8e54<_0x33f26b[_0xc9aa('0x3f')];_0x1f8e54+=0x1){_0x1a70ec=_0x33f26b[_0x1f8e54];if(_[_0xc9aa('0x41')](_0x364613[_0xc9aa('0x1c')][_0x1a70ec['id']])){_0x364613['sugarcrmAccounts'][_0x1a70ec['id']]=new SugarcrmAccount(_0x1a70ec);}else{_0x364613['mergeFromDatabase'](_0x364613['sugarcrmAccounts'][_0x1a70ec['id']],_0x1a70ec);}}}return _0x364613[_0xc9aa('0x1c')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4d')]=function(){var _0x252dc0=this;return function(_0x2d8c59){if(_0x2d8c59){freeIsNotKey(_0x2d8c59,_0x252dc0[_0xc9aa('0x20')],'id');for(var _0x40fe29=0x0,_0x234965={},_0x544daf={};_0x40fe29<_0x2d8c59[_0xc9aa('0x3f')];_0x40fe29+=0x1){_0x234965=_0x2d8c59[_0x40fe29];if(_[_0xc9aa('0x41')](_0x252dc0[_0xc9aa('0x20')][_0x234965['id']])){_0x252dc0[_0xc9aa('0x20')][_0x234965['id']]=new VtigerAccount(_0x234965);}else{_0x252dc0[_0xc9aa('0x42')](_0x252dc0[_0xc9aa('0x20')][_0x234965['id']],_0x234965);}}}return _0x252dc0[_0xc9aa('0x20')];};};Realtime[_0xc9aa('0x3e')]['initServicenowAccounts']=function(){var _0x48a039=this;return function(_0x17e74f){if(_0x17e74f){freeIsNotKey(_0x17e74f,_0x48a039[_0xc9aa('0x21')],'id');for(var _0x32ad94=0x0,_0x1ad9f8={},_0x2ecdc6={};_0x32ad94<_0x17e74f[_0xc9aa('0x3f')];_0x32ad94+=0x1){_0x1ad9f8=_0x17e74f[_0x32ad94];if(_[_0xc9aa('0x41')](_0x48a039[_0xc9aa('0x21')][_0x1ad9f8['id']])){_0x48a039[_0xc9aa('0x21')][_0x1ad9f8['id']]=new ServicenowAccount(_0x1ad9f8);}else{_0x48a039['mergeFromDatabase'](_0x48a039['servicenowAccounts'][_0x1ad9f8['id']],_0x1ad9f8);}}}return _0x48a039[_0xc9aa('0x21')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4e')]=function(){var _0x5dd229=this;return function(_0x518ee4){if(_0x518ee4){freeIsNotKey(_0x518ee4,_0x5dd229[_0xc9aa('0x4f')],'id');for(var _0x24031f=0x0,_0x5b6637={},_0x1f0f88={};_0x24031f<_0x518ee4[_0xc9aa('0x3f')];_0x24031f+=0x1){_0x5b6637=_0x518ee4[_0x24031f];if(_[_0xc9aa('0x41')](_0x5dd229[_0xc9aa('0x4f')][_0x5b6637['id']])){_0x5dd229['dynamics365Accounts'][_0x5b6637['id']]=new Dynamics365Account(_0x5b6637);}else{_0x5dd229[_0xc9aa('0x42')](_0x5dd229['dynamics365Accounts'][_0x5b6637['id']],_0x5b6637);}}}return _0x5dd229['dynamics365Accounts'];};};Realtime['prototype'][_0xc9aa('0x50')]=function(){var _0xdcb73=this;return function(_0x3a433f){if(_0x3a433f){freeIsNotKey(_0x3a433f,_0xdcb73[_0xc9aa('0x22')],'id');for(var _0x38fe0a=0x0,_0x17a611={},_0x12bb09={};_0x38fe0a<_0x3a433f[_0xc9aa('0x3f')];_0x38fe0a+=0x1){_0x17a611=_0x3a433f[_0x38fe0a];if(_[_0xc9aa('0x41')](_0xdcb73[_0xc9aa('0x22')][_0x17a611['id']])){_0xdcb73[_0xc9aa('0x22')][_0x17a611['id']]=new FreshsalesAccount(_0x17a611);}else{_0xdcb73[_0xc9aa('0x42')](_0xdcb73[_0xc9aa('0x22')][_0x17a611['id']],_0x17a611);}}}return _0xdcb73[_0xc9aa('0x22')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x347972=this;return function(_0x3a6d5e){for(var _0x14e308=0x0;_0x14e308<_0x3a6d5e[_0xc9aa('0x3f')];_0x14e308+=0x1){_['merge'](_0x347972[_0xc9aa('0x10')][_0x3a6d5e[_0x14e308]['name']],_0x3a6d5e[_0x14e308]);}return _0x347972[_0xc9aa('0x10')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x51')]=function(){var _0x1d3d9b=this;return function(_0x3d1b38){clearVoiceQueues(_0x1d3d9b[_0xc9aa('0x10')]);if(_0x3d1b38){_0x3d1b38=_[_0xc9aa('0x52')](_0x3d1b38,_0xc9aa('0x53'));for(var _0x3892a0 in _0x3d1b38){if(_0x3d1b38[_0xc9aa('0x24')](_0x3892a0)){var _0x51518d={};for(var _0x5f1d8f=0x0;_0x5f1d8f<_0x3d1b38[_0x3892a0][_0xc9aa('0x3f')];_0x5f1d8f+=0x1){var _0x198ce1=_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x54')];if(_0x1d3d9b['voiceQueues'][_0x198ce1]){if(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x55')]){_0x1d3d9b['voiceQueues'][_0x198ce1][_0xc9aa('0x56')]+=0x1;}if(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x57')]){_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1][_0xc9aa('0x30')]+=0x1;}_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1][_0xc9aa('0x2b')]+=moment(_0x3d1b38[_0x3892a0][_0x5f1d8f]['queuecallerleaveAt'])['diff'](moment(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x58')]),_0xc9aa('0x59'))||0x0;if(_0x5f1d8f===_0x3d1b38[_0x3892a0][_0xc9aa('0x3f')]-0x1){_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1]['sumDuration']+=moment(_0x3d1b38[_0x3892a0][_0x5f1d8f]['queuecallercompleteAt']||_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x5a')]||_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x5b')])[_0xc9aa('0x5c')](moment(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x58')]),_0xc9aa('0x59'))||0x0;_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1][_0xc9aa('0x29')]+=0x1;if(_0x3d1b38[_0x3892a0][_0x5f1d8f]['queuecallercomplete']){_0x1d3d9b['voiceQueues'][_0x198ce1]['answered']+=0x1;_0x1d3d9b['voiceQueues'][_0x198ce1]['sumBillable']+=moment(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x5d')])['diff'](moment(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x5e')]),_0xc9aa('0x59'))||0x0;}}else{_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1][_0xc9aa('0x2c')]+=_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1]['sumHoldTime']||0x0;}}}}}}return _0x1d3d9b[_0xc9aa('0x10')];};};Realtime['prototype'][_0xc9aa('0x5f')]=function(){var _0x5ed6c0=this;return function(_0x168269){clearVoiceCallReports(_0x5ed6c0[_0xc9aa('0x13')]);if(_0x168269){for(var _0x33a4fb=0x0;_0x33a4fb<_0x168269[_0xc9aa('0x3f')];_0x33a4fb+=0x1){_0x5ed6c0[_0xc9aa('0x13')][_0xc9aa('0x29')]+=0x1;_0x5ed6c0[_0xc9aa('0x13')]['sumDuration']+=_0x168269[_0x33a4fb]['duration'];if(_0x168269[_0x33a4fb][_0xc9aa('0x60')]===_0xc9aa('0x61')){_0x5ed6c0['outbound'][_0xc9aa('0x2a')]+=0x1;_0x5ed6c0[_0xc9aa('0x13')][_0xc9aa('0x2b')]+=_0x168269[_0x33a4fb][_0xc9aa('0x62')]-_0x168269[_0x33a4fb][_0xc9aa('0x63')]||0x0;_0x5ed6c0[_0xc9aa('0x13')][_0xc9aa('0x2d')]+=_0x168269[_0x33a4fb][_0xc9aa('0x63')];}}}return _0x5ed6c0[_0xc9aa('0x13')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x64')]=function(){var _0x5a60e4=this;return function(_0xe30f9c){if(_0xe30f9c){freeIsNotKey(_0xe30f9c,_0x5a60e4[_0xc9aa('0x11')],_0xc9aa('0x26'));for(var _0x269ac4=0x0,_0x4cc158={};_0x269ac4<_0xe30f9c[_0xc9aa('0x3f')];_0x269ac4+=0x1){_0x4cc158=_0xe30f9c[_0x269ac4];if(_['isUndefined'](_0x5a60e4[_0xc9aa('0x11')][_0x4cc158[_0xc9aa('0x26')]])){_0x5a60e4['campaigns'][_0x4cc158[_0xc9aa('0x26')]]=new Campaign(_0x4cc158);}else{_0x5a60e4[_0xc9aa('0x42')](_0x5a60e4[_0xc9aa('0x11')][_0x4cc158['name']],_0x4cc158);_0x5a60e4[_0xc9aa('0x11')][_0x4cc158['name']][_0xc9aa('0x65')]=_0x4cc158[_0xc9aa('0x66')]?_0x4cc158[_0xc9aa('0x66')][_0xc9aa('0x26')]:undefined;}}}return _0x5a60e4[_0xc9aa('0x11')];};};Realtime[_0xc9aa('0x3e')]['initVoiceExtensions']=function(){var _0x1d6c8a=this;return function(_0x1f27c7){if(_0x1f27c7){freeIsNotKey(_0x1f27c7,_0x1d6c8a['voiceExtensions'],'id');for(var _0x1d62ab=0x0,_0xd2bee9={};_0x1d62ab<_0x1f27c7[_0xc9aa('0x3f')];_0x1d62ab+=0x1){_0xd2bee9=_0x1f27c7[_0x1d62ab];if(_[_0xc9aa('0x41')](_0x1d6c8a[_0xc9aa('0x14')][_0xd2bee9['id']])){_0x1d6c8a[_0xc9aa('0x14')][_0xd2bee9['id']]=new VoiceExtension(_0xd2bee9);}else{_0x1d6c8a[_0xc9aa('0x42')](_0x1d6c8a[_0xc9aa('0x14')][_0xd2bee9['id']],_0xd2bee9);}}}return _0x1d6c8a[_0xc9aa('0x14')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x67')]=function(){var _0x287769=this;return function(_0x5e7ce8){clearCampaigns(_0x287769['campaigns']);for(var _0x2a6f76=0x0;_0x2a6f76<_0x5e7ce8['length'];_0x2a6f76+=0x1){_[_0xc9aa('0x68')](_0x287769[_0xc9aa('0x11')][_0x5e7ce8[_0x2a6f76][_0xc9aa('0x26')]],_0x5e7ce8[_0x2a6f76]);}return _0x287769[_0xc9aa('0x11')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x69')]=function(){var _0x4de703=this;return function(_0x11295f){if(_0x11295f){freeIsNotKey(_0x11295f,_0x4de703[_0xc9aa('0x6a')],'id');for(var _0x3559a7=0x0,_0x4601e0={},_0x50d3ef={};_0x3559a7<_0x11295f[_0xc9aa('0x3f')];_0x3559a7+=0x1){_0x4601e0=_0x11295f[_0x3559a7];if(_[_0xc9aa('0x41')](_0x4de703['faxAccounts'][_0x4601e0['id']])){_0x4de703[_0xc9aa('0x6a')][_0x4601e0['id']]=new FaxAccount(_0x4601e0);}else{_0x4de703[_0xc9aa('0x42')](_0x4de703[_0xc9aa('0x6a')][_0x4601e0['id']],_0x4601e0);}}}return _0x4de703['faxAccounts'];};};module[_0xc9aa('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 00a53ac..0a7938d 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 _0xa4d8=['channel','getAgentByInternal','calleridnum','internal','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','calleridname','transfers','linkedid','transfereelinkedid','UserId','split','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','isArray','forEach','startsWith','substring','mobile','indexOf','lastIndexOf','attendedTransfer','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','interface','format','length','connectedlinenum','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','getCallType'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xa4d8,0xdb));var _0x8a4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x8a4d('0x0'));var util=require(_0x8a4d('0x1'));var config=require(_0x8a4d('0x2'));var ami=require(_0x8a4d('0x3'));var RpcVoiceAgentReport=require(_0x8a4d('0x4'));var RpcVoiceCallReport=require(_0x8a4d('0x5'));var RpcVoiceDialReport=require(_0x8a4d('0x6'));var RpcMemberReport=require(_0x8a4d('0x7'));var RpcVoiceQueueReport=require(_0x8a4d('0x8'));var RpcVoiceRecording=require(_0x8a4d('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x8a4d('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x8a4d('0xb'));var UserReport=require('./userReport');function Report(_0x361789){this[_0x8a4d('0xc')]=_0x361789;this[_0x8a4d('0xd')]=_0x361789['agents'];this[_0x8a4d('0xe')]=_0x361789['telephones'];}Report[_0x8a4d('0xf')][_0x8a4d('0x10')]=function(_0x17149a){var _0xd8f0e8=new VoiceQueueReport(this['realtime']);var _0x45efe0=new VoiceAgentReport(this['realtime']);var _0x4203fc=new VoiceDialReport(this['realtime']);var _0x37cfa6=new VoiceCallReport(this['realtime']);var _0x5a6442=new UserReport(this[_0x8a4d('0xc')]);if(config[_0x8a4d('0x11')]&&config['xdr'][_0x8a4d('0x12')]){ami['on'](_0x8a4d('0x13'),this[_0x8a4d('0x14')][_0x8a4d('0x15')](this));ami['on'](_0x8a4d('0x16'),this[_0x8a4d('0x17')][_0x8a4d('0x15')](this));ami['on'](_0x8a4d('0x18'),this[_0x8a4d('0x19')]['bind'](this));ami['on'](_0x8a4d('0x1a'),this[_0x8a4d('0x1b')][_0x8a4d('0x15')](this));ami['on'](_0x8a4d('0x1c'),this[_0x8a4d('0x1d')][_0x8a4d('0x15')](this));ami['on'](_0x8a4d('0x1e'),this['attendedTransfer'][_0x8a4d('0x15')](this));}};Report[_0x8a4d('0xf')][_0x8a4d('0x1f')]=function(_0x3d0b9a){var _0x22696b;_0x22696b=_[_0x8a4d('0x20')](this[_0x8a4d('0xd')],function(_0x161b2c){return _0x161b2c[_0x8a4d('0x21')]==_0x3d0b9a||_0x161b2c[_0x8a4d('0x22')]==_0x3d0b9a;});if(_[_0x8a4d('0x23')](_0x22696b)){var _0x55ee99=_['find'](this[_0x8a4d('0xe')],function(_0x220fa7){return _0x220fa7[_0x8a4d('0x21')]==_0x3d0b9a||_0x220fa7[_0x8a4d('0x22')]==_0x3d0b9a;});if(_0x55ee99){_0x22696b=_[_0x8a4d('0x20')](this[_0x8a4d('0xd')],function(_0x1d88b7){return _0x1d88b7[_0x8a4d('0x24')]==util[_0x8a4d('0x25')]('SIP/%s',_0x55ee99['name']);});}}return _0x22696b;};Report['prototype']['voiceQueueReport']=function(_0x5a141b){for(var _0x454e26=0x0;_0x454e26<_0x5a141b[_0x8a4d('0x26')];_0x454e26+=0x1){var _0x263242=this[_0x8a4d('0x1f')](_0x5a141b[_0x454e26][_0x8a4d('0x27')]);if(_0x263242){_0x5a141b[_0x454e26]['accountcode']=_0x263242[_0x8a4d('0x21')];_0x5a141b[_0x454e26]['assigned']=!![];_0x5a141b[_0x454e26][_0x8a4d('0x28')]=_0x263242[_0x8a4d('0x22')];_0x5a141b[_0x454e26][_0x8a4d('0x24')]=_[_0x8a4d('0x23')](_0x263242['interface'])?util[_0x8a4d('0x25')](_0x8a4d('0x29'),_0x263242[_0x8a4d('0x22')]):_0x263242['interface'];if(_0x5a141b[_0x454e26][_0x8a4d('0x2a')]){_0x5a141b[_0x454e26]['queuecallercompleteAt']=moment()[_0x8a4d('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5a141b[_0x454e26][_0x8a4d('0x2b')]){_0x5a141b[_0x454e26][_0x8a4d('0x2c')]=moment()[_0x8a4d('0x25')](_0x8a4d('0x2d'));}RpcMemberReport[_0x8a4d('0x14')](_0x5a141b[_0x454e26]);}RpcVoiceQueueReport[_0x8a4d('0x2e')](_0x5a141b[_0x454e26]);}};function extractCalleridNumber(_0x2fd7c7){var _0x5b14d5=_0x2fd7c7['match'](/<(.*?)>/);return _0x5b14d5?_0x5b14d5[0x1]:_0x2fd7c7;}Report[_0x8a4d('0xf')]['getAgentByInternal']=function(_0x3ee406){for(var _0xe9a283=0x0;_0xe9a283',_0x3f6d66[_0x8a4d('0x43')],_0x3f6d66['calleridnum']);}if(RpcVoiceTransferReport[_0x8a4d('0x44')][_0x3f6d66[_0x8a4d('0x45')]]){var _0x869dc9=RpcVoiceTransferReport[_0x8a4d('0x44')][_0x3f6d66[_0x8a4d('0x45')]];_0x869dc9[_0x8a4d('0x46')]=_0x3f6d66['uniqueid'];RpcVoiceTransferReport[_0x8a4d('0x1d')](_0x869dc9);delete RpcVoiceTransferReport[_0x8a4d('0x44')][_0x3f6d66[_0x8a4d('0x45')]];}if(_[_0x8a4d('0x23')](_0x3f6d66[_0x8a4d('0x36')])){_0x3f6d66[_0x8a4d('0x36')]=this[_0x8a4d('0x2f')](_0x3f6d66);}if(_[_0x8a4d('0x23')](_0x3f6d66[_0x8a4d('0x47')])){var _0x4fe5e0=_0x3f6d66[_0x8a4d('0x30')][_0x8a4d('0x48')]('-')[0x0];var _0x3e59d6=this[_0x8a4d('0xd')][_0x4fe5e0];if(!_0x3e59d6)_0x3e59d6=this[_0x8a4d('0x31')](_0x3f6d66[_0x8a4d('0x21')]);if(_0x3e59d6){_0x3f6d66[_0x8a4d('0x47')]=_0x3e59d6['id'];_0x3f6d66['membername']=_0x3e59d6['name'];}}RpcVoiceCallReport['create'](_0x3f6d66);if(_0x3f6d66[_0x8a4d('0x49')]){for(var _0xefc7f8=0x0;_0xefc7f8<_0x3f6d66[_0x8a4d('0x4a')][_0x8a4d('0x26')];_0xefc7f8+=0x1){_0x3f6d66[_0x8a4d('0x4b')]=_0x3f6d66['monitors'][_0xefc7f8][_0x8a4d('0x4c')];_0x3f6d66[_0x8a4d('0x4d')]=_0x3f6d66[_0x8a4d('0x4a')][_0xefc7f8][_0x8a4d('0x4d')];if(_0x3f6d66[_0x8a4d('0x35')]==_0x8a4d('0x3e')){_0x3f6d66['calleridnum']=_0x3f6d66[_0x8a4d('0x27')];_0x3f6d66[_0x8a4d('0x43')]=_0x3f6d66[_0x8a4d('0x4e')];_0x3f6d66[_0x8a4d('0x27')]=_0x3f6d66[_0x8a4d('0x21')];_0x3f6d66[_0x8a4d('0x4e')]=_0x3f6d66[_0x8a4d('0x4f')];_0x3f6d66[_0x8a4d('0x35')]=_0x3f6d66[_0x8a4d('0x40')];}else if(_0x3f6d66[_0x8a4d('0x35')]=='xcally-motion-dialer'){_0x3f6d66['calleridnum']=_0x3f6d66[_0x8a4d('0x34')];_0x3f6d66[_0x8a4d('0x35')]=_0x3f6d66[_0x8a4d('0x40')];}RpcVoiceRecording[_0x8a4d('0x2e')](_0x3f6d66);}}};Report[_0x8a4d('0xf')][_0x8a4d('0x19')]=function(_0x1aa0ee){if(_[_0x8a4d('0x50')](_0x1aa0ee)){_0x1aa0ee[_0x8a4d('0x51')](function(_0x4bb854){RpcVoiceAgentReport[_0x8a4d('0x2e')](_0x4bb854);});}else{RpcVoiceAgentReport[_0x8a4d('0x2e')](_0x1aa0ee);}};Report[_0x8a4d('0xf')]['voiceDialReport']=function(_0x270174){RpcVoiceDialReport['create'](_0x270174);var _0x494d2e;var _0xf3db47;var _0x1a5364=_0x270174[_0x8a4d('0x30')];if(_[_0x8a4d('0x52')](_0x1a5364,'Local')){_0xf3db47=_0x1a5364[_0x8a4d('0x53')](_0x1a5364['indexOf']('/')+0x1,_0x1a5364['indexOf']('@'));_0x494d2e=_[_0x8a4d('0x20')](this['agents'],function(_0x4a1b55){return _0x4a1b55[_0x8a4d('0x54')]==_0xf3db47||_0x4a1b55['phone']==_0xf3db47||_0x4a1b55['accountcode']==_0xf3db47;});}else{_0xf3db47=_0x1a5364[_0x8a4d('0x53')](_0x1a5364[_0x8a4d('0x55')]('/')+0x1,_0x1a5364[_0x8a4d('0x56')]('-'));_0x494d2e=this[_0x8a4d('0x1f')](_0xf3db47);}if(_0x494d2e){_0x270174['interface']=_[_0x8a4d('0x23')](_0x494d2e[_0x8a4d('0x24')])?util[_0x8a4d('0x25')]('SIP/%s',_0x494d2e[_0x8a4d('0x22')]):_0x494d2e[_0x8a4d('0x24')];_0x270174[_0x8a4d('0x4f')]=_0x494d2e[_0x8a4d('0x22')];_0x270174[_0x8a4d('0x21')]=_0x494d2e[_0x8a4d('0x21')];RpcMemberReport[_0x8a4d('0x1b')](_0x270174);}};Report[_0x8a4d('0xf')]['blindTransfer']=function(_0x4cfd7b){RpcVoiceTransferReport[_0x8a4d('0x44')][_0x4cfd7b['transfererlinkedid']]=_0x4cfd7b;};Report[_0x8a4d('0xf')]['attendedTransfer']=function(_0x2c26a7){RpcVoiceTransferReport[_0x8a4d('0x57')](_0x2c26a7);};module[_0x8a4d('0x58')]=Report; \ No newline at end of file +var _0x3c50=['exten','connectedlinename','membername','xcally-motion-dialer','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','lastIndexOf','exports','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','SIP/%s','voiceQueueReport','length','connectedlinenum','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','split','outbound','internal','destination','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','calleridname','transfers','linkedid','uniqueid','UserId','monitors','monitorFilename','filename','createdAt'];(function(_0xa10fd2,_0x43c361){var _0xcc2828=function(_0x2d3f11){while(--_0x2d3f11){_0xa10fd2['push'](_0xa10fd2['shift']());}};_0xcc2828(++_0x43c361);}(_0x3c50,0x175));var _0x03c5=function(_0x15db3a,_0x5d3904){_0x15db3a=_0x15db3a-0x0;var _0x3b6a09=_0x3c50[_0x15db3a];return _0x3b6a09;};'use strict';var _=require('lodash');var moment=require(_0x03c5('0x0'));var util=require('util');var config=require(_0x03c5('0x1'));var ami=require(_0x03c5('0x2'));var RpcVoiceAgentReport=require(_0x03c5('0x3'));var RpcVoiceCallReport=require(_0x03c5('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x03c5('0x5'));var RpcVoiceQueueReport=require(_0x03c5('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x03c5('0x7'));var VoiceQueueReport=require(_0x03c5('0x8'));var VoiceCallReport=require(_0x03c5('0x9'));var VoiceAgentReport=require(_0x03c5('0xa'));var VoiceDialReport=require(_0x03c5('0xb'));var UserReport=require('./userReport');function Report(_0x59cdf2){this[_0x03c5('0xc')]=_0x59cdf2;this[_0x03c5('0xd')]=_0x59cdf2[_0x03c5('0xd')];this['telephones']=_0x59cdf2[_0x03c5('0xe')];}Report[_0x03c5('0xf')][_0x03c5('0x10')]=function(_0x96448){var _0x542ac1=new VoiceQueueReport(this[_0x03c5('0xc')]);var _0x49598a=new VoiceAgentReport(this[_0x03c5('0xc')]);var _0x428e0d=new VoiceDialReport(this[_0x03c5('0xc')]);var _0x2f10fc=new VoiceCallReport(this['realtime']);var _0x1ab336=new UserReport(this[_0x03c5('0xc')]);if(config[_0x03c5('0x11')]&&config[_0x03c5('0x11')][_0x03c5('0x12')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x03c5('0x13')](this));ami['on']('custom:voiceCallReport',this[_0x03c5('0x14')]['bind'](this));ami['on'](_0x03c5('0x15'),this[_0x03c5('0x16')][_0x03c5('0x13')](this));ami['on'](_0x03c5('0x17'),this['voiceDialReport'][_0x03c5('0x13')](this));ami['on'](_0x03c5('0x18'),this[_0x03c5('0x19')]['bind'](this));ami['on']('attendedtransfer',this[_0x03c5('0x1a')][_0x03c5('0x13')](this));}};Report[_0x03c5('0xf')][_0x03c5('0x1b')]=function(_0x66d68a){var _0x2504d0;_0x2504d0=_[_0x03c5('0x1c')](this['agents'],function(_0x5a6325){return _0x5a6325['accountcode']==_0x66d68a||_0x5a6325[_0x03c5('0x1d')]==_0x66d68a;});if(_[_0x03c5('0x1e')](_0x2504d0)){var _0x306760=_[_0x03c5('0x1c')](this[_0x03c5('0xe')],function(_0x202945){return _0x202945[_0x03c5('0x1f')]==_0x66d68a||_0x202945['name']==_0x66d68a;});if(_0x306760){_0x2504d0=_[_0x03c5('0x1c')](this['agents'],function(_0x2fa7f5){return _0x2fa7f5[_0x03c5('0x20')]==util['format'](_0x03c5('0x21'),_0x306760[_0x03c5('0x1d')]);});}}return _0x2504d0;};Report['prototype'][_0x03c5('0x22')]=function(_0x110c4d){for(var _0x2b7632=0x0;_0x2b7632<_0x110c4d[_0x03c5('0x23')];_0x2b7632+=0x1){var _0x408acb=this['findAgent'](_0x110c4d[_0x2b7632][_0x03c5('0x24')]);if(_0x408acb){_0x110c4d[_0x2b7632]['accountcode']=_0x408acb[_0x03c5('0x1f')];_0x110c4d[_0x2b7632]['assigned']=!![];_0x110c4d[_0x2b7632][_0x03c5('0x25')]=_0x408acb[_0x03c5('0x1d')];_0x110c4d[_0x2b7632]['interface']=_[_0x03c5('0x1e')](_0x408acb[_0x03c5('0x20')])?util[_0x03c5('0x26')](_0x03c5('0x21'),_0x408acb[_0x03c5('0x1d')]):_0x408acb[_0x03c5('0x20')];if(_0x110c4d[_0x2b7632][_0x03c5('0x27')]){_0x110c4d[_0x2b7632][_0x03c5('0x28')]=moment()[_0x03c5('0x26')](_0x03c5('0x29'));}if(_0x110c4d[_0x2b7632][_0x03c5('0x2a')]){_0x110c4d[_0x2b7632][_0x03c5('0x2b')]=moment()['format'](_0x03c5('0x29'));}RpcMemberReport[_0x03c5('0x22')](_0x110c4d[_0x2b7632]);}RpcVoiceQueueReport[_0x03c5('0x2c')](_0x110c4d[_0x2b7632]);}};function extractCalleridNumber(_0x1583f0){var _0x52ad22=_0x1583f0[_0x03c5('0x2d')](/<(.*?)>/);return _0x52ad22?_0x52ad22[0x1]:_0x1583f0;}Report['prototype'][_0x03c5('0x2e')]=function(_0x18d4f3){for(var _0x19d622=0x0;_0x19d622',_0x1dcfe4[_0x03c5('0x44')],_0x1dcfe4[_0x03c5('0x3f')]);}if(RpcVoiceTransferReport[_0x03c5('0x45')][_0x1dcfe4[_0x03c5('0x46')]]){var _0x39149e=RpcVoiceTransferReport[_0x03c5('0x45')][_0x1dcfe4[_0x03c5('0x46')]];_0x39149e['transfereelinkedid']=_0x1dcfe4[_0x03c5('0x47')];RpcVoiceTransferReport['blindTransfer'](_0x39149e);delete RpcVoiceTransferReport[_0x03c5('0x45')][_0x1dcfe4[_0x03c5('0x46')]];}if(_[_0x03c5('0x1e')](_0x1dcfe4[_0x03c5('0x35')])){_0x1dcfe4[_0x03c5('0x35')]=this[_0x03c5('0x30')](_0x1dcfe4);}if(_[_0x03c5('0x1e')](_0x1dcfe4[_0x03c5('0x48')])){var _0xc16154=_0x1dcfe4['channel'][_0x03c5('0x31')]('-')[0x0];var _0x15dd99=this[_0x03c5('0xd')][_0xc16154];if(!_0x15dd99)_0x15dd99=this['getAgentByInternal'](_0x1dcfe4[_0x03c5('0x1f')]);if(_0x15dd99){_0x1dcfe4[_0x03c5('0x48')]=_0x15dd99['id'];_0x1dcfe4['membername']=_0x15dd99[_0x03c5('0x1d')];}}RpcVoiceCallReport[_0x03c5('0x2c')](_0x1dcfe4);if(_0x1dcfe4['monitor']){for(var _0x263460=0x0;_0x263460<_0x1dcfe4[_0x03c5('0x49')][_0x03c5('0x23')];_0x263460+=0x1){_0x1dcfe4[_0x03c5('0x4a')]=_0x1dcfe4['monitors'][_0x263460][_0x03c5('0x4b')];_0x1dcfe4[_0x03c5('0x4c')]=_0x1dcfe4['monitors'][_0x263460][_0x03c5('0x4c')];if(_0x1dcfe4[_0x03c5('0x4d')]==_0x03c5('0x3d')){_0x1dcfe4[_0x03c5('0x3f')]=_0x1dcfe4[_0x03c5('0x24')];_0x1dcfe4[_0x03c5('0x44')]=_0x1dcfe4[_0x03c5('0x4e')];_0x1dcfe4[_0x03c5('0x24')]=_0x1dcfe4[_0x03c5('0x1f')];_0x1dcfe4['connectedlinename']=_0x1dcfe4[_0x03c5('0x4f')];_0x1dcfe4[_0x03c5('0x4d')]=_0x1dcfe4['originatecalleridnum'];}else if(_0x1dcfe4[_0x03c5('0x4d')]==_0x03c5('0x50')){_0x1dcfe4[_0x03c5('0x3f')]=_0x1dcfe4[_0x03c5('0x34')];_0x1dcfe4[_0x03c5('0x4d')]=_0x1dcfe4[_0x03c5('0x40')];}RpcVoiceRecording[_0x03c5('0x2c')](_0x1dcfe4);}}};Report[_0x03c5('0xf')]['voiceAgentReport']=function(_0x480991){if(_['isArray'](_0x480991)){_0x480991[_0x03c5('0x51')](function(_0x4e2213){RpcVoiceAgentReport['create'](_0x4e2213);});}else{RpcVoiceAgentReport[_0x03c5('0x2c')](_0x480991);}};Report[_0x03c5('0xf')][_0x03c5('0x52')]=function(_0x326f0e){RpcVoiceDialReport[_0x03c5('0x2c')](_0x326f0e);var _0x4d3078;var _0x314b4c;var _0x431aeb=_0x326f0e[_0x03c5('0x42')];if(_[_0x03c5('0x53')](_0x431aeb,_0x03c5('0x54'))){_0x314b4c=_0x431aeb[_0x03c5('0x55')](_0x431aeb[_0x03c5('0x56')]('/')+0x1,_0x431aeb[_0x03c5('0x56')]('@'));_0x4d3078=_[_0x03c5('0x1c')](this[_0x03c5('0xd')],function(_0x2058f3){return _0x2058f3[_0x03c5('0x57')]==_0x314b4c||_0x2058f3['phone']==_0x314b4c||_0x2058f3[_0x03c5('0x1f')]==_0x314b4c;});}else{_0x314b4c=_0x431aeb[_0x03c5('0x55')](_0x431aeb[_0x03c5('0x56')]('/')+0x1,_0x431aeb[_0x03c5('0x58')]('-'));_0x4d3078=this[_0x03c5('0x1b')](_0x314b4c);}if(_0x4d3078){_0x326f0e[_0x03c5('0x20')]=_[_0x03c5('0x1e')](_0x4d3078['interface'])?util['format'](_0x03c5('0x21'),_0x4d3078[_0x03c5('0x1d')]):_0x4d3078[_0x03c5('0x20')];_0x326f0e[_0x03c5('0x4f')]=_0x4d3078['name'];_0x326f0e['accountcode']=_0x4d3078[_0x03c5('0x1f')];RpcMemberReport[_0x03c5('0x52')](_0x326f0e);}};Report[_0x03c5('0xf')]['blindTransfer']=function(_0x1a2a93){RpcVoiceTransferReport['transfers'][_0x1a2a93['transfererlinkedid']]=_0x1a2a93;};Report['prototype'][_0x03c5('0x1a')]=function(_0x350c5c){RpcVoiceTransferReport[_0x03c5('0x1a')](_0x350c5c);};module[_0x03c5('0x59')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index ecaea2c..2f41f97 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x796b=['[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','trunk:save','syncDeviceState','device','[userReport][devicestatechange]','agents','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','name','startsWith','Local','substring','indexOf','find','mobile','phone','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registryentry','registry','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','then','isUndefined','emit','isNotNull','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','stateRegistry','merge','omit','event','actionid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x796b,0x108));var _0xb796=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x796b[_0x4b7b62];return _0x2280df;};'use strict';var _=require('lodash');var moment=require(_0xb796('0x0'));var util=require('util');var Redis=require(_0xb796('0x1'));var BPromise=require(_0xb796('0x2'));var config=require(_0xb796('0x3'));var logger=require(_0xb796('0x4'))(_0xb796('0x5'));var ami=require(_0xb796('0x6'));config[_0xb796('0x7')]=_[_0xb796('0x8')](config[_0xb796('0x7')],{'host':_0xb796('0x9'),'port':0x18eb});var io=require(_0xb796('0xa'))(new Redis(config['redis']));function UserReport(_0x5030df){this['trunks']=_0x5030df[_0xb796('0xb')];this['agents']=_0x5030df['agents'];this[_0xb796('0xc')]=_0x5030df[_0xb796('0xc')];ami['on'](_0xb796('0xd'),this['syncRegistry']['bind'](this));ami['on'](_0xb796('0xe'),this[_0xb796('0xf')][_0xb796('0x10')](this));ami['on'](_0xb796('0x11'),this['syncDeviceState'][_0xb796('0x10')](this));ami['on'](_0xb796('0x12'),this[_0xb796('0x13')][_0xb796('0x10')](this));return this[_0xb796('0x14')]();}function showSipRegistrations(){Promise[_0xb796('0x15')]()['then'](ami[_0xb796('0x16')]())[_0xb796('0x17')](function(_0x10828a){logger[_0xb796('0x18')](_0xb796('0x19'),util[_0xb796('0x1a')](_0x10828a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0xb796('0x1b')]())[_0xb796('0x17')](function(_0x57c368){logger['error'](_0xb796('0x1c'),util[_0xb796('0x1a')](_0x57c368,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xb796('0x15')]()['then'](ami['actionSipPeerStatus']())[_0xb796('0x17')](function(_0x54e499){logger['error'](_0xb796('0x1d'),util[_0xb796('0x1a')](_0x54e499,{'showHidden':![],'depth':null}));});}UserReport[_0xb796('0x1e')][_0xb796('0x14')]=function(){setInterval(function(){BPromise[_0xb796('0x15')]()[_0xb796('0x1f')](showSipRegistrations())[_0xb796('0x1f')](listDeviceStates())[_0xb796('0x1f')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x5818c3){return _0x5818c3!==null&&!_[_0xb796('0x20')](_0x5818c3);};UserReport[_0xb796('0x1e')][_0xb796('0x21')]=function(_0x47ab3c,_0x3a4ede,_0x2da2b4){io['to'](_0x47ab3c)['emit'](_0x3a4ede,_0x2da2b4);};UserReport[_0xb796('0x1e')][_0xb796('0xf')]=function(_0x3e873e){try{if(this[_0xb796('0x22')](_0x3e873e)){logger['info'](_0xb796('0x23'),_0x3e873e['username'],_0x3e873e[_0xb796('0x24')]);logger[_0xb796('0x25')](_0xb796('0x26'),util[_0xb796('0x1a')](_0x3e873e,{'showHidden':![],'depth':null}));var _0x1d3912=_['find'](this[_0xb796('0xb')],{'defaultuser':_0x3e873e['username']});if(_0x1d3912){_0x3e873e[_0xb796('0x27')]=_0x3e873e['state'];_[_0xb796('0x28')](_0x1d3912,_[_0xb796('0x29')](_0x3e873e,[_0xb796('0x2a'),_0xb796('0x2b'),'username',_0xb796('0x24')]));logger['debug'](_0xb796('0x2c'),util['inspect'](_0x1d3912,{'showHidden':![],'depth':null}));this[_0xb796('0x21')](util[_0xb796('0x2d')](_0xb796('0x2e'),_0x1d3912['name']),_0xb796('0x2f'),_0x1d3912);}}}catch(_0x33a2db){logger[_0xb796('0x18')]('[userReport][registry]',util[_0xb796('0x1a')](_0x33a2db,{'showHidden':![],'depth':null}));}};UserReport[_0xb796('0x1e')][_0xb796('0x30')]=function(_0x54b0b0){try{if(this['isNotNull'](_0x54b0b0)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x54b0b0[_0xb796('0x31')],_0x54b0b0['state']);logger['debug'](_0xb796('0x32'),util[_0xb796('0x1a')](_0x54b0b0,{'showHidden':![],'depth':null}));if(this[_0xb796('0x33')][_0x54b0b0[_0xb796('0x31')]]){if(!this[_0xb796('0x33')][_0x54b0b0[_0xb796('0x31')]]['local']||_0x54b0b0[_0xb796('0x24')][_0xb796('0x34')]()==_0xb796('0x35')){this[_0xb796('0x33')][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x36')]=![];if(this[_0xb796('0x33')][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x24')]!==_0x54b0b0[_0xb796('0x24')]['toLowerCase']()){this[_0xb796('0x33')][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x37')]=_[_0xb796('0x38')](moment()[_0xb796('0x2d')]('x'));}this['agents'][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x24')]=_0x54b0b0[_0xb796('0x24')][_0xb796('0x34')]();this[_0xb796('0x33')][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x39')](_0x54b0b0);}}else if(this[_0xb796('0xc')][_0x54b0b0[_0xb796('0x31')]]){if(this[_0xb796('0xc')][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x24')]!==_0x54b0b0['state'][_0xb796('0x34')]()){this[_0xb796('0xc')][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x37')]=_[_0xb796('0x38')](moment()[_0xb796('0x2d')]('x'));}this[_0xb796('0xc')][_0x54b0b0['device']][_0xb796('0x24')]=_0x54b0b0[_0xb796('0x24')][_0xb796('0x34')]();logger[_0xb796('0x25')](_0xb796('0x3a'),util[_0xb796('0x1a')](this[_0xb796('0xc')][_0x54b0b0['device']],{'showHidden':![],'depth':null}));this[_0xb796('0x21')](util['format'](_0xb796('0x3b'),this[_0xb796('0xc')][_0x54b0b0['device']]['name']),_0xb796('0x3c'),this[_0xb796('0xc')][_0x54b0b0[_0xb796('0x31')]]);}else if(this[_0xb796('0xb')][_0x54b0b0['device']]){if(this[_0xb796('0xb')][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x24')]!==_0x54b0b0[_0xb796('0x24')][_0xb796('0x34')]()){this['trunks'][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x37')]=_[_0xb796('0x38')](moment()[_0xb796('0x2d')]('x'));}this['trunks'][_0x54b0b0['device']][_0xb796('0x24')]=_0x54b0b0[_0xb796('0x24')][_0xb796('0x34')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xb796('0xb')][_0x54b0b0[_0xb796('0x31')]],{'showHidden':![],'depth':null}));this[_0xb796('0x21')](util[_0xb796('0x2d')](_0xb796('0x2e'),this['trunks'][_0x54b0b0[_0xb796('0x31')]][_0xb796('0x3d')]),'trunk:save',this['trunks'][_0x54b0b0[_0xb796('0x31')]]);}else if(_[_0xb796('0x3e')](_0x54b0b0['device'],_0xb796('0x3f'))){var _0x10d534=_0x54b0b0[_0xb796('0x31')];var _0x15a0ab=_0x10d534[_0xb796('0x40')](_0x10d534[_0xb796('0x41')]('/')+0x1,_0x10d534[_0xb796('0x41')]('@'));var _0x25de34=_[_0xb796('0x42')](this[_0xb796('0x33')],function(_0x35adeb){return _0x35adeb[_0xb796('0x43')]==_0x15a0ab||_0x35adeb[_0xb796('0x44')]==_0x15a0ab||_0x35adeb['accountcode']==_0x15a0ab;});if(_0x25de34){if(_0x25de34[_0xb796('0x24')]!==_0x54b0b0[_0xb796('0x24')][_0xb796('0x34')]()){_0x25de34[_0xb796('0x37')]=_[_0xb796('0x38')](moment()['format']('x'));}_0x25de34[_0xb796('0x24')]=_0x54b0b0[_0xb796('0x24')][_0xb796('0x34')]();_0x25de34[_0xb796('0x36')]=!![];_0x25de34[_0xb796('0x39')](_0x54b0b0);}}}}catch(_0x40ac22){logger[_0xb796('0x18')](_0xb796('0x32'),util[_0xb796('0x1a')](_0x40ac22,{'showHidden':![],'depth':null}));}};UserReport[_0xb796('0x1e')][_0xb796('0x13')]=function(_0x5efb39){try{if(this['isNotNull'](_0x5efb39)&&this[_0xb796('0x22')](_0x5efb39['peerstatus'])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x5efb39[_0xb796('0x45')],_0x5efb39['address'],_0x5efb39['peerstatus']);logger[_0xb796('0x25')](_0xb796('0x46'),util[_0xb796('0x1a')](_0x5efb39,{'showHidden':![],'depth':null}));if(this[_0xb796('0x33')][_0x5efb39[_0xb796('0x45')]]){if(!this['agents'][_0x5efb39[_0xb796('0x45')]][_0xb796('0x36')]||_0x5efb39[_0xb796('0x12')][_0xb796('0x34')]()==_0xb796('0x47')){this[_0xb796('0x33')][_0x5efb39[_0xb796('0x45')]][_0xb796('0x36')]=![];this['agents'][_0x5efb39[_0xb796('0x45')]][_0xb796('0x48')]=_0x5efb39['peerstatus']['toLowerCase']();this['agents'][_0x5efb39[_0xb796('0x45')]][_0xb796('0x49')]=_0x5efb39[_0xb796('0x49')];this[_0xb796('0x33')][_0x5efb39[_0xb796('0x45')]][_0xb796('0x39')](_0x5efb39);}}else if(this[_0xb796('0xc')][_0x5efb39['peer']]){this[_0xb796('0xc')][_0x5efb39['peer']][_0xb796('0x48')]=_0x5efb39[_0xb796('0x12')]['toLowerCase']();this[_0xb796('0xc')][_0x5efb39['peer']]['address']=_0x5efb39['address'];logger[_0xb796('0x25')](_0xb796('0x4a'),util['inspect'](this[_0xb796('0xc')][_0x5efb39[_0xb796('0x45')]],{'showHidden':![],'depth':null}));this[_0xb796('0x21')](util[_0xb796('0x2d')](_0xb796('0x3b'),this['telephones'][_0x5efb39[_0xb796('0x45')]][_0xb796('0x3d')]),'telephone:save',this[_0xb796('0xc')][_0x5efb39['peer']]);}else if(this[_0xb796('0xb')][_0x5efb39['peer']]){this[_0xb796('0xb')][_0x5efb39['peer']][_0xb796('0x48')]=_0x5efb39[_0xb796('0x12')]['toLowerCase']();this[_0xb796('0xb')][_0x5efb39[_0xb796('0x45')]][_0xb796('0x49')]=_0x5efb39[_0xb796('0x49')];logger[_0xb796('0x25')](_0xb796('0x4b'),util[_0xb796('0x1a')](this['trunks'][_0x5efb39['peer']],{'showHidden':![],'depth':null}));this[_0xb796('0x21')](util[_0xb796('0x2d')]('trunk:%s',this[_0xb796('0xb')][_0x5efb39[_0xb796('0x45')]]['name']),_0xb796('0x2f'),this[_0xb796('0xb')][_0x5efb39['peer']]);}}}catch(_0x8a9b5){logger['error'](_0xb796('0x46'),util[_0xb796('0x1a')](_0x8a9b5,{'showHidden':![],'depth':null}));}};module[_0xb796('0x4c')]=UserReport; \ No newline at end of file +var _0x6e6c=['[userReport][sippeerstatus]','prototype','emit','isNotNull','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','peerstatus','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','ioredis','bluebird','ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','[userReport][devicestatelist]'];(function(_0x335ff2,_0x43bb4c){var _0x51c8ab=function(_0x255a85){while(--_0x255a85){_0x335ff2['push'](_0x335ff2['shift']());}};_0x51c8ab(++_0x43bb4c);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var moment=require(_0xc6e6('0x1'));var util=require('util');var Redis=require(_0xc6e6('0x2'));var BPromise=require(_0xc6e6('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xc6e6('0x4'));var ami=require('../ami');config[_0xc6e6('0x5')]=_['defaults'](config[_0xc6e6('0x5')],{'host':_0xc6e6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc6e6('0x5')]));function UserReport(_0x30a10b){this['trunks']=_0x30a10b[_0xc6e6('0x7')];this[_0xc6e6('0x8')]=_0x30a10b['agents'];this[_0xc6e6('0x9')]=_0x30a10b['telephones'];ami['on'](_0xc6e6('0xa'),this[_0xc6e6('0xb')][_0xc6e6('0xc')](this));ami['on'](_0xc6e6('0xd'),this[_0xc6e6('0xb')][_0xc6e6('0xc')](this));ami['on'](_0xc6e6('0xe'),this[_0xc6e6('0xf')][_0xc6e6('0xc')](this));ami['on']('peerstatus',this[_0xc6e6('0x10')]['bind'](this));return this[_0xc6e6('0x11')]();}function showSipRegistrations(){Promise[_0xc6e6('0x12')]()[_0xc6e6('0x13')](ami[_0xc6e6('0x14')]())['catch'](function(_0x149ac6){logger[_0xc6e6('0x15')](_0xc6e6('0x16'),util[_0xc6e6('0x17')](_0x149ac6,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xc6e6('0x12')]()['then'](ami[_0xc6e6('0x18')]())[_0xc6e6('0x19')](function(_0x569474){logger[_0xc6e6('0x15')](_0xc6e6('0x1a'),util[_0xc6e6('0x17')](_0x569474,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami['actionSipPeerStatus']())[_0xc6e6('0x19')](function(_0x554262){logger[_0xc6e6('0x15')](_0xc6e6('0x1b'),util[_0xc6e6('0x17')](_0x554262,{'showHidden':![],'depth':null}));});}UserReport[_0xc6e6('0x1c')][_0xc6e6('0x11')]=function(){setInterval(function(){BPromise[_0xc6e6('0x12')]()[_0xc6e6('0x13')](showSipRegistrations())[_0xc6e6('0x13')](listDeviceStates())[_0xc6e6('0x13')](showPeersStatus());},0x32c8);};UserReport[_0xc6e6('0x1c')]['isNotNull']=function(_0x428401){return _0x428401!==null&&!_['isUndefined'](_0x428401);};UserReport[_0xc6e6('0x1c')][_0xc6e6('0x1d')]=function(_0x2be6fc,_0x2f69f1,_0x4f1d68){io['to'](_0x2be6fc)[_0xc6e6('0x1d')](_0x2f69f1,_0x4f1d68);};UserReport[_0xc6e6('0x1c')][_0xc6e6('0xb')]=function(_0x36ebfa){try{if(this[_0xc6e6('0x1e')](_0x36ebfa)){logger['info'](_0xc6e6('0x1f'),_0x36ebfa['username'],_0x36ebfa[_0xc6e6('0x20')]);logger[_0xc6e6('0x21')](_0xc6e6('0x22'),util[_0xc6e6('0x17')](_0x36ebfa,{'showHidden':![],'depth':null}));var _0x53a1bf=_[_0xc6e6('0x23')](this['trunks'],{'defaultuser':_0x36ebfa[_0xc6e6('0x24')]});if(_0x53a1bf){_0x36ebfa['stateRegistry']=_0x36ebfa[_0xc6e6('0x20')];_[_0xc6e6('0x25')](_0x53a1bf,_[_0xc6e6('0x26')](_0x36ebfa,[_0xc6e6('0x27'),_0xc6e6('0x28'),'username',_0xc6e6('0x20')]));logger[_0xc6e6('0x21')](_0xc6e6('0x29'),util[_0xc6e6('0x17')](_0x53a1bf,{'showHidden':![],'depth':null}));this['emit'](util[_0xc6e6('0x2a')]('trunk:%s',_0x53a1bf[_0xc6e6('0x2b')]),_0xc6e6('0x2c'),_0x53a1bf);}}}catch(_0x12c616){logger[_0xc6e6('0x15')](_0xc6e6('0x22'),util[_0xc6e6('0x17')](_0x12c616,{'showHidden':![],'depth':null}));}};UserReport[_0xc6e6('0x1c')][_0xc6e6('0xf')]=function(_0x185a59){try{if(this[_0xc6e6('0x1e')](_0x185a59)){logger[_0xc6e6('0x2d')](_0xc6e6('0x2e'),_0x185a59[_0xc6e6('0x2f')],_0x185a59[_0xc6e6('0x20')]);logger[_0xc6e6('0x21')](_0xc6e6('0x30'),util[_0xc6e6('0x17')](_0x185a59,{'showHidden':![],'depth':null}));if(this['agents'][_0x185a59[_0xc6e6('0x2f')]]){if(!this[_0xc6e6('0x8')][_0x185a59['device']]['local']||_0x185a59[_0xc6e6('0x20')][_0xc6e6('0x31')]()==_0xc6e6('0x32')){this[_0xc6e6('0x8')][_0x185a59[_0xc6e6('0x2f')]][_0xc6e6('0x33')]=![];if(this['agents'][_0x185a59[_0xc6e6('0x2f')]][_0xc6e6('0x20')]!==_0x185a59[_0xc6e6('0x20')]['toLowerCase']()){this['agents'][_0x185a59[_0xc6e6('0x2f')]][_0xc6e6('0x34')]=_[_0xc6e6('0x35')](moment()[_0xc6e6('0x2a')]('x'));}this['agents'][_0x185a59['device']][_0xc6e6('0x20')]=_0x185a59['state'][_0xc6e6('0x31')]();this['agents'][_0x185a59[_0xc6e6('0x2f')]][_0xc6e6('0x36')](_0x185a59);}}else if(this[_0xc6e6('0x9')][_0x185a59[_0xc6e6('0x2f')]]){if(this['telephones'][_0x185a59['device']][_0xc6e6('0x20')]!==_0x185a59[_0xc6e6('0x20')][_0xc6e6('0x31')]()){this[_0xc6e6('0x9')][_0x185a59['device']]['stateTime']=_[_0xc6e6('0x35')](moment()[_0xc6e6('0x2a')]('x'));}this[_0xc6e6('0x9')][_0x185a59[_0xc6e6('0x2f')]]['state']=_0x185a59[_0xc6e6('0x20')][_0xc6e6('0x31')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xc6e6('0x17')](this['telephones'][_0x185a59[_0xc6e6('0x2f')]],{'showHidden':![],'depth':null}));this[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x37'),this['telephones'][_0x185a59[_0xc6e6('0x2f')]]['name']),_0xc6e6('0x38'),this[_0xc6e6('0x9')][_0x185a59[_0xc6e6('0x2f')]]);}else if(this[_0xc6e6('0x7')][_0x185a59[_0xc6e6('0x2f')]]){if(this[_0xc6e6('0x7')][_0x185a59[_0xc6e6('0x2f')]][_0xc6e6('0x20')]!==_0x185a59[_0xc6e6('0x20')]['toLowerCase']()){this[_0xc6e6('0x7')][_0x185a59[_0xc6e6('0x2f')]][_0xc6e6('0x34')]=_[_0xc6e6('0x35')](moment()['format']('x'));}this[_0xc6e6('0x7')][_0x185a59[_0xc6e6('0x2f')]][_0xc6e6('0x20')]=_0x185a59[_0xc6e6('0x20')]['toLowerCase']();logger[_0xc6e6('0x21')](_0xc6e6('0x39'),util[_0xc6e6('0x17')](this[_0xc6e6('0x7')][_0x185a59[_0xc6e6('0x2f')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xc6e6('0x2a')]('trunk:%s',this[_0xc6e6('0x7')][_0x185a59['device']][_0xc6e6('0x2b')]),_0xc6e6('0x2c'),this[_0xc6e6('0x7')][_0x185a59[_0xc6e6('0x2f')]]);}else if(_[_0xc6e6('0x3a')](_0x185a59[_0xc6e6('0x2f')],_0xc6e6('0x3b'))){var _0xe76dcd=_0x185a59['device'];var _0x270526=_0xe76dcd[_0xc6e6('0x3c')](_0xe76dcd[_0xc6e6('0x3d')]('/')+0x1,_0xe76dcd['indexOf']('@'));var _0x16bae9=_[_0xc6e6('0x23')](this[_0xc6e6('0x8')],function(_0x42ed90){return _0x42ed90[_0xc6e6('0x3e')]==_0x270526||_0x42ed90[_0xc6e6('0x3f')]==_0x270526||_0x42ed90[_0xc6e6('0x40')]==_0x270526;});if(_0x16bae9){if(_0x16bae9[_0xc6e6('0x20')]!==_0x185a59[_0xc6e6('0x20')][_0xc6e6('0x31')]()){_0x16bae9[_0xc6e6('0x34')]=_[_0xc6e6('0x35')](moment()[_0xc6e6('0x2a')]('x'));}_0x16bae9[_0xc6e6('0x20')]=_0x185a59['state'][_0xc6e6('0x31')]();_0x16bae9['local']=!![];_0x16bae9[_0xc6e6('0x36')](_0x185a59);}}}}catch(_0x45f4ee){logger['error']('[userReport][devicestatechange]',util['inspect'](_0x45f4ee,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x3edc16){try{if(this[_0xc6e6('0x1e')](_0x3edc16)&&this[_0xc6e6('0x1e')](_0x3edc16[_0xc6e6('0x41')])){logger[_0xc6e6('0x2d')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x3edc16['peer'],_0x3edc16[_0xc6e6('0x42')],_0x3edc16[_0xc6e6('0x41')]);logger[_0xc6e6('0x21')](_0xc6e6('0x43'),util['inspect'](_0x3edc16,{'showHidden':![],'depth':null}));if(this[_0xc6e6('0x8')][_0x3edc16[_0xc6e6('0x44')]]){if(!this[_0xc6e6('0x8')][_0x3edc16[_0xc6e6('0x44')]][_0xc6e6('0x33')]||_0x3edc16['peerstatus'][_0xc6e6('0x31')]()==_0xc6e6('0x45')){this[_0xc6e6('0x8')][_0x3edc16['peer']][_0xc6e6('0x33')]=![];this[_0xc6e6('0x8')][_0x3edc16[_0xc6e6('0x44')]][_0xc6e6('0x46')]=_0x3edc16[_0xc6e6('0x41')]['toLowerCase']();this[_0xc6e6('0x8')][_0x3edc16[_0xc6e6('0x44')]][_0xc6e6('0x42')]=_0x3edc16[_0xc6e6('0x42')];this[_0xc6e6('0x8')][_0x3edc16['peer']]['updateStatusRealtime'](_0x3edc16);}}else if(this['telephones'][_0x3edc16[_0xc6e6('0x44')]]){this[_0xc6e6('0x9')][_0x3edc16[_0xc6e6('0x44')]][_0xc6e6('0x46')]=_0x3edc16[_0xc6e6('0x41')][_0xc6e6('0x31')]();this['telephones'][_0x3edc16[_0xc6e6('0x44')]]['address']=_0x3edc16[_0xc6e6('0x42')];logger[_0xc6e6('0x21')](_0xc6e6('0x47'),util['inspect'](this[_0xc6e6('0x9')][_0x3edc16['peer']],{'showHidden':![],'depth':null}));this[_0xc6e6('0x1d')](util['format']('telephone:%s',this[_0xc6e6('0x9')][_0x3edc16['peer']]['name']),_0xc6e6('0x38'),this[_0xc6e6('0x9')][_0x3edc16[_0xc6e6('0x44')]]);}else if(this[_0xc6e6('0x7')][_0x3edc16[_0xc6e6('0x44')]]){this[_0xc6e6('0x7')][_0x3edc16[_0xc6e6('0x44')]][_0xc6e6('0x46')]=_0x3edc16['peerstatus'][_0xc6e6('0x31')]();this[_0xc6e6('0x7')][_0x3edc16[_0xc6e6('0x44')]][_0xc6e6('0x42')]=_0x3edc16['address'];logger[_0xc6e6('0x21')](_0xc6e6('0x48'),util[_0xc6e6('0x17')](this['trunks'][_0x3edc16['peer']],{'showHidden':![],'depth':null}));this[_0xc6e6('0x1d')](util['format']('trunk:%s',this[_0xc6e6('0x7')][_0x3edc16[_0xc6e6('0x44')]][_0xc6e6('0x2b')]),_0xc6e6('0x2c'),this[_0xc6e6('0x7')][_0x3edc16[_0xc6e6('0x44')]]);}}}catch(_0x38a636){logger[_0xc6e6('0x15')](_0xc6e6('0x43'),util[_0xc6e6('0x17')](_0x38a636,{'showHidden':![],'depth':null}));}};module[_0xc6e6('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index c32a945..bb80462 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f54=['custom:agentconnect','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','transfer','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','agentcompleteAt','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','diff','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','bind','queuecallerabandon','agentcomplete','syncAgentComplete','varset','hangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isUndefined','isNotNull','info','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','queue','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:'];(function(_0x1d586d,_0x3fcc44){var _0x5a0a3e=function(_0xbfcfb0){while(--_0xbfcfb0){_0x1d586d['push'](_0x1d586d['shift']());}};_0x5a0a3e(++_0x3fcc44);}(_0x6f54,0xf2));var _0x46f5=function(_0x3e1ea9,_0xdf10cb){_0x3e1ea9=_0x3e1ea9-0x0;var _0x1b3b68=_0x6f54[_0x3e1ea9];return _0x1b3b68;};'use strict';var _=require(_0x46f5('0x0'));var moment=require('moment');var util=require(_0x46f5('0x1'));var Redis=require(_0x46f5('0x2'));var config=require(_0x46f5('0x3'));var logger=require(_0x46f5('0x4'))(_0x46f5('0x5'));var ami=require(_0x46f5('0x6'));config[_0x46f5('0x7')]=_['defaults'](config[_0x46f5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x46f5('0x8'))(new Redis(config[_0x46f5('0x7')]));function VoiceAgentReport(_0x15fb75){this[_0x46f5('0x9')]={};this[_0x46f5('0xa')]=_0x15fb75['channels'];this[_0x46f5('0xb')]=_0x15fb75[_0x46f5('0xb')];this[_0x46f5('0xc')]=_0x15fb75[_0x46f5('0xc')];this[_0x46f5('0xd')]={};ami['on'](_0x46f5('0xe'),this[_0x46f5('0xf')]['bind'](this));ami['on'](_0x46f5('0x10'),this[_0x46f5('0x11')]['bind'](this));ami['on']('agentringnoanswer',this[_0x46f5('0x12')][_0x46f5('0x13')](this));ami['on'](_0x46f5('0x14'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x46f5('0x15'),this[_0x46f5('0x16')]['bind'](this));ami['on'](_0x46f5('0x17'),this['syncVarSet'][_0x46f5('0x13')](this));ami['on'](_0x46f5('0x18'),this['syncHangup'][_0x46f5('0x13')](this));ami['on'](_0x46f5('0x19'),this[_0x46f5('0x1a')][_0x46f5('0x13')](this));ami['on']('musiconholdstop',this[_0x46f5('0x1b')][_0x46f5('0x13')](this));ami['on']('attendedtransfer',this[_0x46f5('0x1c')][_0x46f5('0x13')](this));ami['on']('blindtransfer',this[_0x46f5('0x1d')][_0x46f5('0x13')](this));}VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0x1f')]=function(_0x5b4ac4,_0x8f3aac,_0x41cf4c){io['to'](_0x5b4ac4)[_0x46f5('0x1f')](_0x8f3aac,_0x41cf4c);};VoiceAgentReport[_0x46f5('0x1e')]['isNotNull']=function(_0x58a313){return _0x58a313!==null&&!_[_0x46f5('0x20')](_0x58a313);};VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0xf')]=function(_0xbfaa19){try{if(this[_0x46f5('0x21')](_0xbfaa19)){logger[_0x46f5('0x22')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xbfaa19[_0x46f5('0x23')],_0xbfaa19[_0x46f5('0x24')],_0xbfaa19[_0x46f5('0x25')]);logger[_0x46f5('0x26')](_0x46f5('0x27'),_0xbfaa19['uniqueid'],util[_0x46f5('0x28')](_0xbfaa19,{'showHidden':![],'depth':null}));if(_[_0x46f5('0x20')](this[_0x46f5('0x9')][_0xbfaa19['uniqueid']])){this[_0x46f5('0x9')][_0xbfaa19[_0x46f5('0x23')]]={};}if(_['isUndefined'](this[_0x46f5('0x9')][_0xbfaa19[_0x46f5('0x23')]][_0xbfaa19[_0x46f5('0x25')]])){this[_0x46f5('0x9')][_0xbfaa19[_0x46f5('0x23')]][_0xbfaa19['destuniqueid']]={'agentcalledAt':moment()[_0x46f5('0x29')](_0x46f5('0x2a')),'lastevent':'called','mandatoryDisposition':this['voiceQueues'][_0xbfaa19[_0x46f5('0x2b')]]?this[_0x46f5('0xb')][_0xbfaa19['queue']]['mandatoryDisposition']||![]:![],'type':this['voiceQueues'][_0xbfaa19['queue']]?this[_0x46f5('0xb')][_0xbfaa19[_0x46f5('0x2b')]]['type']||_0x46f5('0x2c'):_0x46f5('0x2c'),'variables':this['variables'][_0xbfaa19['uniqueid']],'motionChannel':'voice'};}_[_0x46f5('0x2d')](this[_0x46f5('0x9')][_0xbfaa19['uniqueid']][_0xbfaa19[_0x46f5('0x25')]],_[_0x46f5('0x2e')](_0xbfaa19,[_0x46f5('0x2f'),_0x46f5('0x30')]));logger[_0x46f5('0x26')](_0x46f5('0x31'),_0xbfaa19['uniqueid'],util['inspect'](this[_0x46f5('0x9')][_0xbfaa19[_0x46f5('0x23')]][_0xbfaa19[_0x46f5('0x25')]],{'showHidden':![],'depth':null}));ami[_0x46f5('0x1f')](_0x46f5('0x32'),this['channels'][_0xbfaa19[_0x46f5('0x23')]][_0xbfaa19['destuniqueid']]);var _0x1fc3a6={'id':this[_0x46f5('0xc')][_0xbfaa19[_0x46f5('0x33')]]['id'],'calleridnum':this[_0x46f5('0x9')][_0xbfaa19[_0x46f5('0x23')]][_0xbfaa19[_0x46f5('0x25')]][_0x46f5('0x34')],'queue':this['channels'][_0xbfaa19[_0x46f5('0x23')]][_0xbfaa19[_0x46f5('0x25')]][_0x46f5('0x2b')],'variables':this['channels'][_0xbfaa19[_0x46f5('0x23')]][_0xbfaa19[_0x46f5('0x25')]][_0x46f5('0xd')]};logger['debug'](_0x46f5('0x35'),_0xbfaa19[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x1fc3a6,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x46f5('0x36'),_0xbfaa19[_0x46f5('0x24')]),_0x46f5('0x37'),_0x1fc3a6);}}catch(_0x36cc74){logger[_0x46f5('0x38')](_0x46f5('0x39'),_0xbfaa19[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x36cc74,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0x11')]=function(_0x15a488){try{if(this[_0x46f5('0x21')](_0x15a488)){if(this[_0x46f5('0x9')][_0x15a488['uniqueid']]){logger[_0x46f5('0x26')](_0x46f5('0x3a'),_0x15a488[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x15a488,{'showHidden':![],'depth':null}));for(var _0x7211d1 in this['channels'][_0x15a488[_0x46f5('0x23')]]){if(this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]]['hasOwnProperty'](_0x7211d1)){if(_0x15a488[_0x46f5('0x25')]===_0x7211d1){logger[_0x46f5('0x22')](_0x46f5('0x3b'),_0x15a488[_0x46f5('0x23')],_0x15a488['membername'],_0x15a488[_0x46f5('0x25')]);this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x3c')]=moment()[_0x46f5('0x29')](_0x46f5('0x2a'));this['channels'][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x3d')]=_0x15a488[_0x46f5('0x3d')];this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x3e')]=_0x15a488[_0x46f5('0x3e')];this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x3f')]=_0x15a488['destchannelstate'];this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x40')]=_0x15a488[_0x46f5('0x40')];this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1]['holdtime']=_0x15a488[_0x46f5('0x41')];this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1]['lastevent']=_0x46f5('0x42');if(this['voiceChannels'][this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x23')]]){var _0x37daf4=this[_0x46f5('0xa')][this['channels'][_0x15a488['uniqueid']][_0x7211d1][_0x46f5('0x23')]]['routealias'];this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x43')]=_0x37daf4;_0x15a488[_0x46f5('0x43')]=_0x37daf4;}_[_0x46f5('0x2d')](this['agents'][_0x15a488[_0x46f5('0x33')]],_[_0x46f5('0x44')](_0x15a488,['queue','destconnectedlinenum',_0x46f5('0x43')]));logger[_0x46f5('0x26')](_0x46f5('0x45'),_0x15a488[_0x46f5('0x23')],util[_0x46f5('0x28')](this[_0x46f5('0x9')][_0x15a488['uniqueid']][_0x15a488['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x46f5('0x1f')](_0x46f5('0x46'),this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x15a488['destuniqueid']]);logger[_0x46f5('0x26')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x15a488[_0x46f5('0x23')],util['inspect'](this[_0x46f5('0x9')][_0x15a488['uniqueid']][_0x15a488['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x46f5('0x1f')](util[_0x46f5('0x29')](_0x46f5('0x36'),_0x15a488[_0x46f5('0x24')]),_0x46f5('0x47'),this['channels'][_0x15a488[_0x46f5('0x23')]][_0x15a488['destuniqueid']]);}else if(!this[_0x46f5('0x9')][_0x15a488['uniqueid']][_0x7211d1][_0x46f5('0x48')]&&!this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x15')]){logger[_0x46f5('0x22')](_0x46f5('0x49'),_0x15a488[_0x46f5('0x23')],this[_0x46f5('0x9')][_0x15a488['uniqueid']][_0x7211d1][_0x46f5('0x24')],_0x7211d1);this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x48')]=!![];this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x4a')]=moment()[_0x46f5('0x29')](_0x46f5('0x2a'));this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x4b')]=_0x15a488['destuniqueid'];this[_0x46f5('0x9')][_0x15a488['uniqueid']][_0x7211d1][_0x46f5('0x4c')]=_0x15a488[_0x46f5('0x24')];this['channels'][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x4d')]=_0x46f5('0x4e');this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1][_0x46f5('0x4f')]=_0x46f5('0x4e');logger[_0x46f5('0x26')](_0x46f5('0x50'),_0x15a488['uniqueid'],util['inspect'](this['channels'][_0x15a488[_0x46f5('0x23')]][_0x7211d1],{'showHidden':![],'depth':null}));ami['emit'](_0x46f5('0x51'),this[_0x46f5('0x9')][_0x15a488[_0x46f5('0x23')]][_0x7211d1]);}}}}}}catch(_0xe33c76){logger['error'](_0x46f5('0x52'),_0x15a488[_0x46f5('0x23')],util[_0x46f5('0x28')](_0xe33c76,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x46f5('0x1e')]['syncAgentRingNoAnswer']=function(_0x124a88){try{if(this[_0x46f5('0x21')](_0x124a88)){logger[_0x46f5('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x124a88[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x124a88,{'showHidden':![],'depth':null}));if(this[_0x46f5('0x9')][_0x124a88[_0x46f5('0x23')]]&&this[_0x46f5('0x9')][_0x124a88[_0x46f5('0x23')]][_0x124a88[_0x46f5('0x25')]]){logger[_0x46f5('0x22')](_0x46f5('0x53'),_0x124a88['uniqueid'],_0x124a88[_0x46f5('0x24')],_0x124a88[_0x46f5('0x25')]);this[_0x46f5('0x9')][_0x124a88['uniqueid']][_0x124a88['destuniqueid']]['agentringnoanswer']=!![];this['channels'][_0x124a88[_0x46f5('0x23')]][_0x124a88['destuniqueid']][_0x46f5('0x4a')]=moment()[_0x46f5('0x29')](_0x46f5('0x2a'));this[_0x46f5('0x9')][_0x124a88[_0x46f5('0x23')]][_0x124a88['destuniqueid']][_0x46f5('0x4d')]='rejected';this[_0x46f5('0x9')][_0x124a88['uniqueid']][_0x124a88['destuniqueid']][_0x46f5('0x4f')]='rejected';logger[_0x46f5('0x26')](_0x46f5('0x54'),_0x124a88[_0x46f5('0x23')],util['inspect'](this[_0x46f5('0x9')][_0x124a88['uniqueid']][_0x124a88['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x46f5('0x1f')]('custom:agentringnoanswer',this['channels'][_0x124a88[_0x46f5('0x23')]][_0x124a88[_0x46f5('0x25')]]);}}}catch(_0x39897c){logger['error'](_0x46f5('0x55'),_0x124a88[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x39897c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0x56')]=function(_0x3cf608){try{if(this[_0x46f5('0x21')](_0x3cf608)){logger[_0x46f5('0x26')](_0x46f5('0x57'),_0x3cf608[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x3cf608,{'showHidden':![],'depth':null}));if(this[_0x46f5('0x9')][_0x3cf608[_0x46f5('0x23')]]){for(var _0x173be6 in this['channels'][_0x3cf608['uniqueid']]){if(this[_0x46f5('0x9')][_0x3cf608['uniqueid']][_0x46f5('0x58')](_0x173be6)&&!this[_0x46f5('0x9')][_0x3cf608[_0x46f5('0x23')]][_0x173be6][_0x46f5('0x48')]&&!this[_0x46f5('0x9')][_0x3cf608[_0x46f5('0x23')]][_0x173be6][_0x46f5('0x15')]){logger[_0x46f5('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3cf608[_0x46f5('0x23')],this[_0x46f5('0x9')][_0x3cf608['uniqueid']][_0x173be6][_0x46f5('0x24')],_0x173be6);this[_0x46f5('0x9')][_0x3cf608['uniqueid']][_0x173be6][_0x46f5('0x48')]=!![];this['channels'][_0x3cf608[_0x46f5('0x23')]][_0x173be6][_0x46f5('0x4a')]=moment()[_0x46f5('0x29')](_0x46f5('0x2a'));this[_0x46f5('0x9')][_0x3cf608['uniqueid']][_0x173be6][_0x46f5('0x4d')]=_0x46f5('0x59');this[_0x46f5('0x9')][_0x3cf608[_0x46f5('0x23')]][_0x173be6][_0x46f5('0x4f')]=_0x46f5('0x59');logger[_0x46f5('0x26')](_0x46f5('0x5a'),_0x3cf608[_0x46f5('0x23')],util[_0x46f5('0x28')](this[_0x46f5('0x9')][_0x3cf608[_0x46f5('0x23')]][_0x173be6],{'showHidden':![],'depth':null}));ami[_0x46f5('0x1f')](_0x46f5('0x5b'),this['channels'][_0x3cf608['uniqueid']][_0x173be6]);}}}}}catch(_0x454a04){logger[_0x46f5('0x38')]('[%s][voiceAgentReport][queuecallerabandon]',_0x3cf608[_0x46f5('0x23')],util['inspect'](_0x454a04,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0xaf8a5e){try{if(this[_0x46f5('0x21')](_0xaf8a5e)){logger['debug'](_0x46f5('0x5c'),_0xaf8a5e['uniqueid'],util[_0x46f5('0x28')](_0xaf8a5e,{'showHidden':![],'depth':null}));if(this[_0x46f5('0x9')][_0xaf8a5e[_0x46f5('0x23')]]){for(var _0x3502e2 in this[_0x46f5('0x9')][_0xaf8a5e[_0x46f5('0x23')]]){if(this['channels'][_0xaf8a5e[_0x46f5('0x23')]][_0x46f5('0x58')](_0x3502e2)){if(this[_0x46f5('0x9')][_0xaf8a5e[_0x46f5('0x23')]][_0x3502e2]['agentconnectAt']&&!this[_0x46f5('0x9')][_0xaf8a5e['uniqueid']][_0x3502e2]['agentcomplete']){logger[_0x46f5('0x22')](_0x46f5('0x5d'),_0xaf8a5e[_0x46f5('0x23')],this[_0x46f5('0x9')][_0xaf8a5e['uniqueid']][_0x3502e2][_0x46f5('0x24')],_0x3502e2);this[_0x46f5('0x9')][_0xaf8a5e[_0x46f5('0x23')]][_0x3502e2][_0x46f5('0x15')]=!![];this['channels'][_0xaf8a5e[_0x46f5('0x23')]][_0x3502e2]['agentcompleteAt']=moment()[_0x46f5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xaf8a5e['uniqueid']][_0x3502e2][_0x46f5('0x4d')]=_0x46f5('0x5e');this[_0x46f5('0x9')][_0xaf8a5e[_0x46f5('0x23')]][_0x3502e2][_0x46f5('0x4f')]=_0xaf8a5e[_0x46f5('0x4f')]=='transfer'?_0x46f5('0x5f'):_0xaf8a5e[_0x46f5('0x4f')];this[_0x46f5('0x9')][_0xaf8a5e[_0x46f5('0x23')]][_0x3502e2]['talktime']=_0xaf8a5e[_0x46f5('0x60')];if(this[_0x46f5('0xb')][_0xaf8a5e[_0x46f5('0x2b')]]&&this['voiceQueues'][_0xaf8a5e[_0x46f5('0x2b')]][_0x46f5('0x61')]){this[_0x46f5('0x9')][_0xaf8a5e[_0x46f5('0x23')]][_0x3502e2][_0x46f5('0x62')]=this[_0x46f5('0xb')][_0xaf8a5e[_0x46f5('0x2b')]][_0x46f5('0x63')];this[_0x46f5('0x9')][_0xaf8a5e['uniqueid']][_0x3502e2][_0x46f5('0x64')]=!![];}this[_0x46f5('0xc')][_0xaf8a5e[_0x46f5('0x33')]]=_[_0x46f5('0x2e')](this['agents'][_0xaf8a5e[_0x46f5('0x33')]],[_0x46f5('0x2b'),_0x46f5('0x65')]);logger[_0x46f5('0x26')](_0x46f5('0x66'),_0xaf8a5e['uniqueid'],util[_0x46f5('0x28')](this[_0x46f5('0x9')][_0xaf8a5e[_0x46f5('0x23')]][_0x3502e2],{'showHidden':![],'depth':null}));ami[_0x46f5('0x1f')](_0x46f5('0x67'),this[_0x46f5('0x9')][_0xaf8a5e['uniqueid']][_0x3502e2]);logger[_0x46f5('0x26')](_0x46f5('0x68'),_0xaf8a5e[_0x46f5('0x23')],util[_0x46f5('0x28')]({'id':this['agents'][_0xaf8a5e[_0x46f5('0x33')]]['id'],'destaccountcode':_0xaf8a5e[_0x46f5('0x69')]},{'showHidden':![],'depth':null}));this[_0x46f5('0x1f')](util[_0x46f5('0x29')](_0x46f5('0x36'),_0xaf8a5e[_0x46f5('0x24')]),_0x46f5('0x6a'),{'id':this[_0x46f5('0xc')][_0xaf8a5e[_0x46f5('0x33')]]['id'],'destaccountcode':_0xaf8a5e[_0x46f5('0x69')]});}}}}}}catch(_0x4801cc){logger[_0x46f5('0x38')](_0x46f5('0x6b'),_0xaf8a5e[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x4801cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0x6c')]=function(_0x1c1316){try{if(this[_0x46f5('0x21')](_0x1c1316)){logger['debug'](_0x46f5('0x6d'),_0x1c1316['uniqueid'],util[_0x46f5('0x28')](_0x1c1316,{'showHidden':![],'depth':null}));this['addVariable'](_0x1c1316[_0x46f5('0x23')],_[_0x46f5('0x6e')](_0x1c1316['variable'])[0x0],_0x1c1316[_0x46f5('0x6f')]);if(this[_0x46f5('0x9')][_0x1c1316['uniqueid']]){for(var _0x15f3f4 in this[_0x46f5('0x9')][_0x1c1316[_0x46f5('0x23')]]){if(this[_0x46f5('0x9')][_0x1c1316['uniqueid']][_0x46f5('0x58')](_0x15f3f4)){logger[_0x46f5('0x22')](_0x46f5('0x70'),_0x1c1316[_0x46f5('0x23')],_0x15f3f4,_['keys'](_0x1c1316[_0x46f5('0x71')])[0x0],_0x1c1316['value']);if(_[_0x46f5('0x20')](this[_0x46f5('0x9')][_0x1c1316[_0x46f5('0x23')]][_0x15f3f4][_0x46f5('0xd')])){this['channels'][_0x1c1316[_0x46f5('0x23')]][_0x15f3f4][_0x46f5('0xd')]={};}this[_0x46f5('0x9')][_0x1c1316['uniqueid']][_0x15f3f4][_0x46f5('0xd')]=this[_0x46f5('0xd')][_0x1c1316[_0x46f5('0x23')]];}}}}}catch(_0x4c16ad){logger['error'](_0x46f5('0x72'),_0x1c1316['uniqueid'],util['inspect'](_0x4c16ad,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0x73')]=function(_0x5c0347,_0x51a853,_0x5bc487){var _0x8f5e2b=['rtpaudioqos',_0x46f5('0x74'),_0x46f5('0x75'),'rtpaudioqosjitterbridged',_0x46f5('0x76'),_0x46f5('0x77'),'rtpaudioqosrtt',_0x46f5('0x78'),_0x46f5('0x79'),_0x46f5('0x7a'),'bridgepeer',_0x46f5('0x7b'),_0x46f5('0x7c'),'memberdynamic',_0x46f5('0x7d'),_0x46f5('0x7e'),_0x46f5('0x24'),_0x46f5('0x7f'),_0x46f5('0x80')];if(!_[_0x46f5('0x81')](_0x51a853)&&!_[_0x46f5('0x82')](_0x8f5e2b,_0x51a853)){if(_[_0x46f5('0x20')](this['variables'][_0x5c0347])){this[_0x46f5('0xd')][_0x5c0347]={};}this[_0x46f5('0xd')][_0x5c0347][_0x51a853]=_0x5bc487;}};VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0x83')]=function(_0x2767e8){try{if(this['isNotNull'](_0x2767e8)){logger[_0x46f5('0x26')]('[%s][voiceAgentReport][hangup]\x20event:',_0x2767e8[_0x46f5('0x23')],util['inspect'](_0x2767e8,{'showHidden':![],'depth':null}));if(this[_0x46f5('0x9')][_0x2767e8['uniqueid']]){for(var _0x3fe673 in this[_0x46f5('0x9')][_0x2767e8[_0x46f5('0x23')]]){if(this[_0x46f5('0x9')][_0x2767e8[_0x46f5('0x23')]]['hasOwnProperty'](_0x3fe673)){if(this[_0x46f5('0x9')][_0x2767e8['uniqueid']][_0x3fe673]['reason']==_0x46f5('0x84')&&this[_0x46f5('0x9')][_0x2767e8[_0x46f5('0x23')]][_0x3fe673][_0x46f5('0x15')]){logger[_0x46f5('0x22')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x2767e8['uniqueid'],_0x3fe673);this[_0x46f5('0x9')][_0x2767e8[_0x46f5('0x23')]][_0x3fe673]['agentcompleteAt']=moment()[_0x46f5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x46f5('0x26')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x2767e8[_0x46f5('0x23')],util[_0x46f5('0x28')](_[_0x46f5('0x85')](this[_0x46f5('0x9')][_0x2767e8['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x46f5('0x1f')](_0x46f5('0x86'),_['values'](this[_0x46f5('0x9')][_0x2767e8[_0x46f5('0x23')]]));delete this['channels'][_0x2767e8[_0x46f5('0x23')]];}if(this['variables'][_0x2767e8[_0x46f5('0x23')]]){delete this[_0x46f5('0xd')][_0x2767e8[_0x46f5('0x23')]];}}}catch(_0x3d01e1){logger['error']('[%s][voiceAgentReport][hangup]',_0x2767e8[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x3d01e1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0x1c')]=function(_0x5e78b6){try{if(this['isNotNull'](_0x5e78b6)){logger[_0x46f5('0x26')](_0x46f5('0x87'),_0x5e78b6[_0x46f5('0x23')],util['inspect'](_0x5e78b6,{'showHidden':![],'depth':null}));if(this['channels'][_0x5e78b6[_0x46f5('0x88')]]){for(var _0xc5ab6f in this['channels'][_0x5e78b6['transfereeuniqueid']]){if(this[_0x46f5('0x9')][_0x5e78b6[_0x46f5('0x88')]][_0x46f5('0x58')](_0xc5ab6f)){if(_0x5e78b6[_0x46f5('0x89')]===_0xc5ab6f){logger['info']('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5e78b6[_0x46f5('0x23')],this[_0x46f5('0x9')][_0x5e78b6[_0x46f5('0x88')]][_0xc5ab6f][_0x46f5('0x24')],_0xc5ab6f);var _0x1f721e=moment();this[_0x46f5('0x9')][_0x5e78b6[_0x46f5('0x88')]][_0xc5ab6f]['agentcomplete']=!![];this['channels'][_0x5e78b6[_0x46f5('0x88')]][_0xc5ab6f][_0x46f5('0x8a')]=moment()['format'](_0x46f5('0x2a'));this[_0x46f5('0x9')][_0x5e78b6['transfereeuniqueid']][_0xc5ab6f][_0x46f5('0x4d')]=_0x46f5('0x5e');this[_0x46f5('0x9')][_0x5e78b6[_0x46f5('0x88')]][_0xc5ab6f][_0x46f5('0x4f')]=_0x46f5('0x84');this[_0x46f5('0x9')][_0x5e78b6['transfereeuniqueid']][_0xc5ab6f][_0x46f5('0x60')]=_0x1f721e['diff'](this[_0x46f5('0x9')][_0x5e78b6['transfereeuniqueid']][_0xc5ab6f]['agentconnectAt'],'seconds');}}}}if(this['channels'][_0x5e78b6[_0x46f5('0x8b')]]){var _0x2622f4=this[_0x46f5('0x9')][_0x5e78b6[_0x46f5('0x8b')]];this[_0x46f5('0x9')][_0x5e78b6['secondtransfereruniqueid']]=this[_0x46f5('0x9')][_0x5e78b6[_0x46f5('0x88')]];this[_0x46f5('0x9')][_0x5e78b6[_0x46f5('0x88')]]=_0x2622f4;}}}catch(_0x5706ee){logger[_0x46f5('0x38')](_0x46f5('0x8c'),_0x5e78b6[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x5706ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0x1d')]=function(_0x5f3500){try{if(this[_0x46f5('0x21')](_0x5f3500)){logger[_0x46f5('0x26')](_0x46f5('0x8d'),_0x5f3500[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x5f3500,{'showHidden':![],'depth':null}));if(this['channels'][_0x5f3500[_0x46f5('0x88')]]){for(var _0x398dd5 in this[_0x46f5('0x9')][_0x5f3500['transfereeuniqueid']]){if(this[_0x46f5('0x9')][_0x5f3500[_0x46f5('0x88')]][_0x46f5('0x58')](_0x398dd5)){if(_0x5f3500[_0x46f5('0x8e')]===_0x398dd5){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5f3500[_0x46f5('0x23')],this[_0x46f5('0x9')][_0x5f3500[_0x46f5('0x88')]][_0x398dd5][_0x46f5('0x24')],_0x398dd5);var _0x3a28ad=moment();this[_0x46f5('0x9')][_0x5f3500[_0x46f5('0x88')]][_0x398dd5][_0x46f5('0x15')]=!![];this['channels'][_0x5f3500[_0x46f5('0x88')]][_0x398dd5][_0x46f5('0x8a')]=_0x3a28ad;this['channels'][_0x5f3500[_0x46f5('0x88')]][_0x398dd5]['lastevent']='complete';this[_0x46f5('0x9')][_0x5f3500[_0x46f5('0x88')]][_0x398dd5][_0x46f5('0x4f')]=_0x46f5('0x84');this[_0x46f5('0x9')][_0x5f3500[_0x46f5('0x88')]][_0x398dd5][_0x46f5('0x60')]=_0x3a28ad[_0x46f5('0x8f')](this[_0x46f5('0x9')][_0x5f3500[_0x46f5('0x88')]][_0x398dd5][_0x46f5('0x3c')],_0x46f5('0x90'));}}}}}}catch(_0x39f21c){logger[_0x46f5('0x38')](_0x46f5('0x91'),_0x5f3500[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x39f21c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x46f5('0x1e')][_0x46f5('0x1a')]=function(_0x2c5e66){var _0xeab1fe='';try{if(this[_0x46f5('0x21')](_0x2c5e66)){logger['debug'](_0x46f5('0x92'),_0x2c5e66[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x2c5e66,{'showHidden':![],'depth':null}));if(_0x2c5e66[_0x46f5('0x93')]){_0xeab1fe=_0x2c5e66['channel']['substring'](0x0,_0x2c5e66[_0x46f5('0x93')][_0x46f5('0x94')]('-'));if(this[_0x46f5('0xc')][_0xeab1fe]){logger[_0x46f5('0x22')](_0x46f5('0x95'),_0x2c5e66[_0x46f5('0x23')],_0xeab1fe);this[_0x46f5('0xc')][_0xeab1fe][_0x46f5('0x96')]=!![];}}}}catch(_0x1ed988){logger[_0x46f5('0x38')](_0x46f5('0x97'),_0x2c5e66[_0x46f5('0x23')],util[_0x46f5('0x28')](_0x1ed988,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x46f5('0x1e')]['syncMusicOnHoldStop']=function(_0x20f121){var _0x25837e='';try{if(this[_0x46f5('0x21')](_0x20f121)){logger[_0x46f5('0x26')](_0x46f5('0x98'),_0x20f121[_0x46f5('0x23')],util['inspect'](_0x20f121,{'showHidden':![],'depth':null}));if(_0x20f121[_0x46f5('0x93')]){_0x25837e=_0x20f121[_0x46f5('0x93')][_0x46f5('0x99')](0x0,_0x20f121[_0x46f5('0x93')][_0x46f5('0x94')]('-'));if(this[_0x46f5('0xc')][_0x25837e]){logger[_0x46f5('0x22')](_0x46f5('0x9a'),_0x20f121['uniqueid'],_0x25837e);this['agents'][_0x25837e][_0x46f5('0x96')]=![];}}}}catch(_0x2bbb6d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x20f121[_0x46f5('0x23')],util['inspect'](_0x2bbb6d,{'showHidden':![],'depth':null}));}};module[_0x46f5('0x9b')]=VoiceAgentReport; \ No newline at end of file +var _0x07f3=['acwtime','acwTimeout','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','voice','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','interface','calleridnum','debug','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','membername','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','agentcompleteAt','complete','transfer','agent','talktime','acw'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0x07f3,0xd2));var _0x307f=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x07f3[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x307f('0x0'));var moment=require(_0x307f('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x307f('0x2'));var logger=require(_0x307f('0x3'))(_0x307f('0x4'));var ami=require(_0x307f('0x5'));config['redis']=_['defaults'](config[_0x307f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x307f('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x12b272){this['channels']={};this[_0x307f('0x8')]=_0x12b272['channels'];this[_0x307f('0x9')]=_0x12b272[_0x307f('0x9')];this[_0x307f('0xa')]=_0x12b272[_0x307f('0xa')];this[_0x307f('0xb')]={};ami['on'](_0x307f('0xc'),this[_0x307f('0xd')][_0x307f('0xe')](this));ami['on'](_0x307f('0xf'),this[_0x307f('0x10')]['bind'](this));ami['on'](_0x307f('0x11'),this[_0x307f('0x12')][_0x307f('0xe')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on']('agentcomplete',this[_0x307f('0x13')]['bind'](this));ami['on'](_0x307f('0x14'),this[_0x307f('0x15')][_0x307f('0xe')](this));ami['on'](_0x307f('0x16'),this[_0x307f('0x17')][_0x307f('0xe')](this));ami['on'](_0x307f('0x18'),this[_0x307f('0x19')]['bind'](this));ami['on'](_0x307f('0x1a'),this[_0x307f('0x1b')]['bind'](this));ami['on'](_0x307f('0x1c'),this[_0x307f('0x1d')]['bind'](this));ami['on'](_0x307f('0x1e'),this['syncBlindTransfer'][_0x307f('0xe')](this));}VoiceAgentReport[_0x307f('0x1f')][_0x307f('0x20')]=function(_0x51120f,_0x1c14bc,_0x1c9bed){io['to'](_0x51120f)[_0x307f('0x20')](_0x1c14bc,_0x1c9bed);};VoiceAgentReport[_0x307f('0x1f')]['isNotNull']=function(_0x1f713b){return _0x1f713b!==null&&!_[_0x307f('0x21')](_0x1f713b);};VoiceAgentReport[_0x307f('0x1f')][_0x307f('0xd')]=function(_0x35c395){try{if(this[_0x307f('0x22')](_0x35c395)){logger[_0x307f('0x23')](_0x307f('0x24'),_0x35c395['uniqueid'],_0x35c395['membername'],_0x35c395[_0x307f('0x25')]);logger['debug'](_0x307f('0x26'),_0x35c395[_0x307f('0x27')],util[_0x307f('0x28')](_0x35c395,{'showHidden':![],'depth':null}));if(_[_0x307f('0x21')](this[_0x307f('0x29')][_0x35c395['uniqueid']])){this[_0x307f('0x29')][_0x35c395[_0x307f('0x27')]]={};}if(_[_0x307f('0x21')](this[_0x307f('0x29')][_0x35c395[_0x307f('0x27')]][_0x35c395[_0x307f('0x25')]])){this[_0x307f('0x29')][_0x35c395[_0x307f('0x27')]][_0x35c395['destuniqueid']]={'agentcalledAt':moment()[_0x307f('0x2a')](_0x307f('0x2b')),'lastevent':_0x307f('0x2c'),'mandatoryDisposition':this['voiceQueues'][_0x35c395[_0x307f('0x2d')]]?this[_0x307f('0x9')][_0x35c395['queue']][_0x307f('0x2e')]||![]:![],'type':this[_0x307f('0x9')][_0x35c395['queue']]?this['voiceQueues'][_0x35c395[_0x307f('0x2d')]]['type']||_0x307f('0x2f'):_0x307f('0x2f'),'variables':this['variables'][_0x35c395[_0x307f('0x27')]],'motionChannel':_0x307f('0x30')};}_['merge'](this[_0x307f('0x29')][_0x35c395[_0x307f('0x27')]][_0x35c395[_0x307f('0x25')]],_['omit'](_0x35c395,[_0x307f('0x31'),_0x307f('0x32')]));logger['debug'](_0x307f('0x33'),_0x35c395['uniqueid'],util[_0x307f('0x28')](this[_0x307f('0x29')][_0x35c395[_0x307f('0x27')]][_0x35c395['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcalled',this[_0x307f('0x29')][_0x35c395[_0x307f('0x27')]][_0x35c395[_0x307f('0x25')]]);var _0xb1a696={'id':this[_0x307f('0xa')][_0x35c395[_0x307f('0x34')]]['id'],'calleridnum':this[_0x307f('0x29')][_0x35c395[_0x307f('0x27')]][_0x35c395[_0x307f('0x25')]][_0x307f('0x35')],'queue':this[_0x307f('0x29')][_0x35c395['uniqueid']][_0x35c395[_0x307f('0x25')]]['queue'],'variables':this[_0x307f('0x29')][_0x35c395[_0x307f('0x27')]][_0x35c395[_0x307f('0x25')]]['variables']};logger[_0x307f('0x36')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x35c395['uniqueid'],util[_0x307f('0x28')](_0xb1a696,{'showHidden':![],'depth':null}));this[_0x307f('0x20')](util[_0x307f('0x2a')](_0x307f('0x37'),_0x35c395['membername']),_0x307f('0x38'),_0xb1a696);}}catch(_0x1429f5){logger[_0x307f('0x39')](_0x307f('0x3a'),_0x35c395['uniqueid'],util['inspect'](_0x1429f5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x5668ff){try{if(this[_0x307f('0x22')](_0x5668ff)){if(this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]]){logger[_0x307f('0x36')](_0x307f('0x3b'),_0x5668ff[_0x307f('0x27')],util[_0x307f('0x28')](_0x5668ff,{'showHidden':![],'depth':null}));for(var _0x4a9e05 in this[_0x307f('0x29')][_0x5668ff['uniqueid']]){if(this['channels'][_0x5668ff[_0x307f('0x27')]][_0x307f('0x3c')](_0x4a9e05)){if(_0x5668ff[_0x307f('0x25')]===_0x4a9e05){logger[_0x307f('0x23')](_0x307f('0x3d'),_0x5668ff[_0x307f('0x27')],_0x5668ff['membername'],_0x5668ff['destuniqueid']);this[_0x307f('0x29')][_0x5668ff['uniqueid']][_0x4a9e05][_0x307f('0x3e')]=moment()[_0x307f('0x2a')](_0x307f('0x2b'));this['channels'][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x3f')]=_0x5668ff[_0x307f('0x3f')];this[_0x307f('0x29')][_0x5668ff['uniqueid']][_0x4a9e05]['connectedlinenum']=_0x5668ff[_0x307f('0x40')];this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x41')]=_0x5668ff[_0x307f('0x41')];this['channels'][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x42')]=_0x5668ff[_0x307f('0x42')];this['channels'][_0x5668ff['uniqueid']][_0x4a9e05]['holdtime']=_0x5668ff[_0x307f('0x43')];this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05]['lastevent']=_0x307f('0x44');if(this[_0x307f('0x8')][this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x27')]]){var _0x3cb59b=this['voiceChannels'][this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05]['uniqueid']][_0x307f('0x45')];this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x45')]=_0x3cb59b;_0x5668ff[_0x307f('0x45')]=_0x3cb59b;}_['merge'](this[_0x307f('0xa')][_0x5668ff['interface']],_[_0x307f('0x46')](_0x5668ff,[_0x307f('0x2d'),_0x307f('0x47'),'routealias']));logger[_0x307f('0x36')](_0x307f('0x48'),_0x5668ff[_0x307f('0x27')],util['inspect'](this[_0x307f('0x29')][_0x5668ff['uniqueid']][_0x5668ff[_0x307f('0x25')]],{'showHidden':![],'depth':null}));ami[_0x307f('0x20')]('custom:agentconnect',this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x5668ff[_0x307f('0x25')]]);logger[_0x307f('0x36')](_0x307f('0x49'),_0x5668ff[_0x307f('0x27')],util['inspect'](this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x5668ff[_0x307f('0x25')]],{'showHidden':![],'depth':null}));this[_0x307f('0x20')](util[_0x307f('0x2a')](_0x307f('0x37'),_0x5668ff[_0x307f('0x4a')]),'user:agentconnect',this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x5668ff['destuniqueid']]);}else if(!this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x11')]&&!this[_0x307f('0x29')][_0x5668ff['uniqueid']][_0x4a9e05][_0x307f('0x4b')]){logger['info'](_0x307f('0x4c'),_0x5668ff['uniqueid'],this[_0x307f('0x29')][_0x5668ff['uniqueid']][_0x4a9e05][_0x307f('0x4a')],_0x4a9e05);this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x11')]=!![];this['channels'][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x4d')]=moment()[_0x307f('0x2a')](_0x307f('0x2b'));this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x4e')]=_0x5668ff[_0x307f('0x25')];this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x4f')]=_0x5668ff[_0x307f('0x4a')];this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05]['lastevent']='answered_elsewhere';this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05][_0x307f('0x50')]=_0x307f('0x51');logger[_0x307f('0x36')](_0x307f('0x52'),_0x5668ff['uniqueid'],util[_0x307f('0x28')](this[_0x307f('0x29')][_0x5668ff[_0x307f('0x27')]][_0x4a9e05],{'showHidden':![],'depth':null}));ami[_0x307f('0x20')](_0x307f('0x53'),this['channels'][_0x5668ff['uniqueid']][_0x4a9e05]);}}}}}}catch(_0x58e059){logger[_0x307f('0x39')](_0x307f('0x54'),_0x5668ff[_0x307f('0x27')],util[_0x307f('0x28')](_0x58e059,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x307f('0x1f')][_0x307f('0x12')]=function(_0x27255c){try{if(this['isNotNull'](_0x27255c)){logger['debug'](_0x307f('0x55'),_0x27255c['uniqueid'],util[_0x307f('0x28')](_0x27255c,{'showHidden':![],'depth':null}));if(this[_0x307f('0x29')][_0x27255c[_0x307f('0x27')]]&&this[_0x307f('0x29')][_0x27255c['uniqueid']][_0x27255c['destuniqueid']]){logger[_0x307f('0x23')](_0x307f('0x56'),_0x27255c['uniqueid'],_0x27255c[_0x307f('0x4a')],_0x27255c[_0x307f('0x25')]);this[_0x307f('0x29')][_0x27255c[_0x307f('0x27')]][_0x27255c[_0x307f('0x25')]][_0x307f('0x11')]=!![];this[_0x307f('0x29')][_0x27255c[_0x307f('0x27')]][_0x27255c['destuniqueid']][_0x307f('0x4d')]=moment()[_0x307f('0x2a')](_0x307f('0x2b'));this['channels'][_0x27255c[_0x307f('0x27')]][_0x27255c['destuniqueid']][_0x307f('0x57')]=_0x307f('0x58');this[_0x307f('0x29')][_0x27255c['uniqueid']][_0x27255c[_0x307f('0x25')]][_0x307f('0x50')]=_0x307f('0x58');logger[_0x307f('0x36')](_0x307f('0x59'),_0x27255c[_0x307f('0x27')],util[_0x307f('0x28')](this[_0x307f('0x29')][_0x27255c[_0x307f('0x27')]][_0x27255c[_0x307f('0x25')]],{'showHidden':![],'depth':null}));ami['emit'](_0x307f('0x5a'),this[_0x307f('0x29')][_0x27255c[_0x307f('0x27')]][_0x27255c[_0x307f('0x25')]]);}}}catch(_0x17cc1c){logger[_0x307f('0x39')](_0x307f('0x5b'),_0x27255c[_0x307f('0x27')],util[_0x307f('0x28')](_0x17cc1c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x3bf3d2){try{if(this[_0x307f('0x22')](_0x3bf3d2)){logger[_0x307f('0x36')](_0x307f('0x5c'),_0x3bf3d2[_0x307f('0x27')],util[_0x307f('0x28')](_0x3bf3d2,{'showHidden':![],'depth':null}));if(this[_0x307f('0x29')][_0x3bf3d2[_0x307f('0x27')]]){for(var _0x50aa4e in this['channels'][_0x3bf3d2[_0x307f('0x27')]]){if(this[_0x307f('0x29')][_0x3bf3d2[_0x307f('0x27')]][_0x307f('0x3c')](_0x50aa4e)&&!this['channels'][_0x3bf3d2[_0x307f('0x27')]][_0x50aa4e][_0x307f('0x11')]&&!this[_0x307f('0x29')][_0x3bf3d2[_0x307f('0x27')]][_0x50aa4e]['agentcomplete']){logger['info'](_0x307f('0x5d'),_0x3bf3d2[_0x307f('0x27')],this[_0x307f('0x29')][_0x3bf3d2['uniqueid']][_0x50aa4e][_0x307f('0x4a')],_0x50aa4e);this[_0x307f('0x29')][_0x3bf3d2[_0x307f('0x27')]][_0x50aa4e][_0x307f('0x11')]=!![];this[_0x307f('0x29')][_0x3bf3d2[_0x307f('0x27')]][_0x50aa4e][_0x307f('0x4d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3bf3d2[_0x307f('0x27')]][_0x50aa4e][_0x307f('0x57')]='abandoned';this[_0x307f('0x29')][_0x3bf3d2[_0x307f('0x27')]][_0x50aa4e][_0x307f('0x50')]=_0x307f('0x5e');logger[_0x307f('0x36')](_0x307f('0x5f'),_0x3bf3d2[_0x307f('0x27')],util['inspect'](this[_0x307f('0x29')][_0x3bf3d2[_0x307f('0x27')]][_0x50aa4e],{'showHidden':![],'depth':null}));ami[_0x307f('0x20')](_0x307f('0x60'),this[_0x307f('0x29')][_0x3bf3d2[_0x307f('0x27')]][_0x50aa4e]);}}}}}catch(_0x3c2162){logger['error'](_0x307f('0x61'),_0x3bf3d2[_0x307f('0x27')],util[_0x307f('0x28')](_0x3c2162,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x307f('0x1f')][_0x307f('0x13')]=function(_0x198869){try{if(this[_0x307f('0x22')](_0x198869)){logger[_0x307f('0x36')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x198869[_0x307f('0x27')],util['inspect'](_0x198869,{'showHidden':![],'depth':null}));if(this[_0x307f('0x29')][_0x198869[_0x307f('0x27')]]){for(var _0x508bec in this[_0x307f('0x29')][_0x198869[_0x307f('0x27')]]){if(this['channels'][_0x198869[_0x307f('0x27')]]['hasOwnProperty'](_0x508bec)){if(this['channels'][_0x198869[_0x307f('0x27')]][_0x508bec][_0x307f('0x3e')]&&!this[_0x307f('0x29')][_0x198869[_0x307f('0x27')]][_0x508bec][_0x307f('0x4b')]){logger[_0x307f('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x198869[_0x307f('0x27')],this[_0x307f('0x29')][_0x198869['uniqueid']][_0x508bec][_0x307f('0x4a')],_0x508bec);this[_0x307f('0x29')][_0x198869[_0x307f('0x27')]][_0x508bec]['agentcomplete']=!![];this[_0x307f('0x29')][_0x198869[_0x307f('0x27')]][_0x508bec][_0x307f('0x62')]=moment()[_0x307f('0x2a')](_0x307f('0x2b'));this['channels'][_0x198869[_0x307f('0x27')]][_0x508bec]['lastevent']=_0x307f('0x63');this[_0x307f('0x29')][_0x198869[_0x307f('0x27')]][_0x508bec][_0x307f('0x50')]=_0x198869[_0x307f('0x50')]==_0x307f('0x64')?_0x307f('0x65'):_0x198869['reason'];this['channels'][_0x198869[_0x307f('0x27')]][_0x508bec][_0x307f('0x66')]=_0x198869[_0x307f('0x66')];if(this['voiceQueues'][_0x198869[_0x307f('0x2d')]]&&this['voiceQueues'][_0x198869[_0x307f('0x2d')]][_0x307f('0x67')]){this['channels'][_0x198869[_0x307f('0x27')]][_0x508bec][_0x307f('0x68')]=this[_0x307f('0x9')][_0x198869[_0x307f('0x2d')]][_0x307f('0x69')];this[_0x307f('0x29')][_0x198869['uniqueid']][_0x508bec][_0x307f('0x6a')]=!![];}this['agents'][_0x198869[_0x307f('0x34')]]=_[_0x307f('0x6b')](this[_0x307f('0xa')][_0x198869[_0x307f('0x34')]],['queue','destconnectedlinenum']);logger[_0x307f('0x36')](_0x307f('0x6c'),_0x198869['uniqueid'],util[_0x307f('0x28')](this[_0x307f('0x29')][_0x198869[_0x307f('0x27')]][_0x508bec],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x307f('0x29')][_0x198869[_0x307f('0x27')]][_0x508bec]);logger[_0x307f('0x36')](_0x307f('0x6d'),_0x198869[_0x307f('0x27')],util[_0x307f('0x28')]({'id':this[_0x307f('0xa')][_0x198869['interface']]['id'],'destaccountcode':_0x198869[_0x307f('0x6e')]},{'showHidden':![],'depth':null}));this[_0x307f('0x20')](util[_0x307f('0x2a')](_0x307f('0x37'),_0x198869['membername']),'user:agentcomplete',{'id':this[_0x307f('0xa')][_0x198869[_0x307f('0x34')]]['id'],'destaccountcode':_0x198869[_0x307f('0x6e')]});}}}}}}catch(_0xf48639){logger[_0x307f('0x39')](_0x307f('0x6f'),_0x198869[_0x307f('0x27')],util[_0x307f('0x28')](_0xf48639,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x307f('0x1f')][_0x307f('0x15')]=function(_0x4a7329){try{if(this['isNotNull'](_0x4a7329)){logger[_0x307f('0x36')]('[%s][voiceAgentReport][varset]\x20event:',_0x4a7329[_0x307f('0x27')],util['inspect'](_0x4a7329,{'showHidden':![],'depth':null}));this[_0x307f('0x70')](_0x4a7329[_0x307f('0x27')],_[_0x307f('0x71')](_0x4a7329[_0x307f('0x72')])[0x0],_0x4a7329[_0x307f('0x73')]);if(this['channels'][_0x4a7329[_0x307f('0x27')]]){for(var _0xee0cbc in this[_0x307f('0x29')][_0x4a7329[_0x307f('0x27')]]){if(this[_0x307f('0x29')][_0x4a7329[_0x307f('0x27')]][_0x307f('0x3c')](_0xee0cbc)){logger[_0x307f('0x23')](_0x307f('0x74'),_0x4a7329[_0x307f('0x27')],_0xee0cbc,_[_0x307f('0x71')](_0x4a7329[_0x307f('0x72')])[0x0],_0x4a7329[_0x307f('0x73')]);if(_[_0x307f('0x21')](this[_0x307f('0x29')][_0x4a7329[_0x307f('0x27')]][_0xee0cbc][_0x307f('0xb')])){this[_0x307f('0x29')][_0x4a7329[_0x307f('0x27')]][_0xee0cbc][_0x307f('0xb')]={};}this['channels'][_0x4a7329[_0x307f('0x27')]][_0xee0cbc]['variables']=this[_0x307f('0xb')][_0x4a7329[_0x307f('0x27')]];}}}}}catch(_0x5cc3bf){logger[_0x307f('0x39')](_0x307f('0x75'),_0x4a7329[_0x307f('0x27')],util['inspect'](_0x5cc3bf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x5dc085,_0x4eba3d,_0x5066a6){var _0x4e4d71=['rtpaudioqos',_0x307f('0x76'),'rtpaudioqosjitter',_0x307f('0x77'),'rtpaudioqosloss',_0x307f('0x78'),_0x307f('0x79'),_0x307f('0x7a'),'sipcallid','sipuri',_0x307f('0x7b'),_0x307f('0x7c'),_0x307f('0x7d'),_0x307f('0x7e'),'memberinterface',_0x307f('0x7f'),_0x307f('0x4a'),_0x307f('0x80'),_0x307f('0x81')];if(!_['isNil'](_0x4eba3d)&&!_[_0x307f('0x82')](_0x4e4d71,_0x4eba3d)){if(_[_0x307f('0x21')](this['variables'][_0x5dc085])){this[_0x307f('0xb')][_0x5dc085]={};}this[_0x307f('0xb')][_0x5dc085][_0x4eba3d]=_0x5066a6;}};VoiceAgentReport[_0x307f('0x1f')][_0x307f('0x17')]=function(_0x1c003f){try{if(this['isNotNull'](_0x1c003f)){logger[_0x307f('0x36')]('[%s][voiceAgentReport][hangup]\x20event:',_0x1c003f[_0x307f('0x27')],util['inspect'](_0x1c003f,{'showHidden':![],'depth':null}));if(this[_0x307f('0x29')][_0x1c003f[_0x307f('0x27')]]){for(var _0x51b90a in this[_0x307f('0x29')][_0x1c003f['uniqueid']]){if(this[_0x307f('0x29')][_0x1c003f[_0x307f('0x27')]][_0x307f('0x3c')](_0x51b90a)){if(this[_0x307f('0x29')][_0x1c003f[_0x307f('0x27')]][_0x51b90a][_0x307f('0x50')]==_0x307f('0x64')&&this[_0x307f('0x29')][_0x1c003f[_0x307f('0x27')]][_0x51b90a][_0x307f('0x4b')]){logger[_0x307f('0x23')](_0x307f('0x83'),_0x1c003f[_0x307f('0x27')],_0x51b90a);this[_0x307f('0x29')][_0x1c003f[_0x307f('0x27')]][_0x51b90a]['agentcompleteAt']=moment()[_0x307f('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x307f('0x36')](_0x307f('0x84'),_0x1c003f[_0x307f('0x27')],util['inspect'](_['values'](this['channels'][_0x1c003f[_0x307f('0x27')]]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_[_0x307f('0x85')](this['channels'][_0x1c003f[_0x307f('0x27')]]));delete this[_0x307f('0x29')][_0x1c003f[_0x307f('0x27')]];}if(this[_0x307f('0xb')][_0x1c003f['uniqueid']]){delete this[_0x307f('0xb')][_0x1c003f[_0x307f('0x27')]];}}}catch(_0xa6d833){logger['error'](_0x307f('0x86'),_0x1c003f[_0x307f('0x27')],util[_0x307f('0x28')](_0xa6d833,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x307f('0x1f')][_0x307f('0x1d')]=function(_0x38c2a5){try{if(this[_0x307f('0x22')](_0x38c2a5)){logger['debug'](_0x307f('0x87'),_0x38c2a5[_0x307f('0x27')],util[_0x307f('0x28')](_0x38c2a5,{'showHidden':![],'depth':null}));if(this['channels'][_0x38c2a5[_0x307f('0x88')]]){for(var _0x4e2d84 in this['channels'][_0x38c2a5['transfereeuniqueid']]){if(this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x88')]][_0x307f('0x3c')](_0x4e2d84)){if(_0x38c2a5[_0x307f('0x89')]===_0x4e2d84){logger[_0x307f('0x23')](_0x307f('0x8a'),_0x38c2a5['uniqueid'],this['channels'][_0x38c2a5[_0x307f('0x88')]][_0x4e2d84][_0x307f('0x4a')],_0x4e2d84);var _0x3631c3=moment();this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x88')]][_0x4e2d84][_0x307f('0x4b')]=!![];this['channels'][_0x38c2a5[_0x307f('0x88')]][_0x4e2d84][_0x307f('0x62')]=moment()[_0x307f('0x2a')](_0x307f('0x2b'));this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x88')]][_0x4e2d84][_0x307f('0x57')]=_0x307f('0x63');this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x88')]][_0x4e2d84]['reason']=_0x307f('0x64');this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x88')]][_0x4e2d84][_0x307f('0x66')]=_0x3631c3[_0x307f('0x8b')](this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x88')]][_0x4e2d84][_0x307f('0x3e')],_0x307f('0x8c'));}}}}if(this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x8d')]]){var _0x449038=this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x8d')]];this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x8d')]]=this[_0x307f('0x29')][_0x38c2a5[_0x307f('0x88')]];this['channels'][_0x38c2a5[_0x307f('0x88')]]=_0x449038;}}}catch(_0x4cad09){logger[_0x307f('0x39')](_0x307f('0x8e'),_0x38c2a5['uniqueid'],util['inspect'](_0x4cad09,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x307f('0x1f')][_0x307f('0x8f')]=function(_0x343127){try{if(this[_0x307f('0x22')](_0x343127)){logger[_0x307f('0x36')](_0x307f('0x90'),_0x343127[_0x307f('0x27')],util[_0x307f('0x28')](_0x343127,{'showHidden':![],'depth':null}));if(this[_0x307f('0x29')][_0x343127[_0x307f('0x88')]]){for(var _0xb0e966 in this[_0x307f('0x29')][_0x343127[_0x307f('0x88')]]){if(this['channels'][_0x343127[_0x307f('0x88')]][_0x307f('0x3c')](_0xb0e966)){if(_0x343127[_0x307f('0x91')]===_0xb0e966){logger[_0x307f('0x23')](_0x307f('0x92'),_0x343127['uniqueid'],this['channels'][_0x343127[_0x307f('0x88')]][_0xb0e966][_0x307f('0x4a')],_0xb0e966);var _0x10b553=moment();this[_0x307f('0x29')][_0x343127['transfereeuniqueid']][_0xb0e966][_0x307f('0x4b')]=!![];this[_0x307f('0x29')][_0x343127['transfereeuniqueid']][_0xb0e966][_0x307f('0x62')]=_0x10b553;this[_0x307f('0x29')][_0x343127[_0x307f('0x88')]][_0xb0e966][_0x307f('0x57')]='complete';this[_0x307f('0x29')][_0x343127[_0x307f('0x88')]][_0xb0e966][_0x307f('0x50')]=_0x307f('0x64');this[_0x307f('0x29')][_0x343127['transfereeuniqueid']][_0xb0e966]['talktime']=_0x10b553[_0x307f('0x8b')](this[_0x307f('0x29')][_0x343127[_0x307f('0x88')]][_0xb0e966]['agentconnectAt'],_0x307f('0x8c'));}}}}}}catch(_0x58ca63){logger['error'](_0x307f('0x93'),_0x343127[_0x307f('0x27')],util[_0x307f('0x28')](_0x58ca63,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x307f('0x1f')][_0x307f('0x19')]=function(_0x1e494c){var _0x44e47b='';try{if(this[_0x307f('0x22')](_0x1e494c)){logger[_0x307f('0x36')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1e494c[_0x307f('0x27')],util[_0x307f('0x28')](_0x1e494c,{'showHidden':![],'depth':null}));if(_0x1e494c[_0x307f('0x94')]){_0x44e47b=_0x1e494c[_0x307f('0x94')][_0x307f('0x95')](0x0,_0x1e494c[_0x307f('0x94')]['lastIndexOf']('-'));if(this[_0x307f('0xa')][_0x44e47b]){logger[_0x307f('0x23')](_0x307f('0x96'),_0x1e494c[_0x307f('0x27')],_0x44e47b);this[_0x307f('0xa')][_0x44e47b][_0x307f('0x97')]=!![];}}}}catch(_0x5de987){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x1e494c[_0x307f('0x27')],util[_0x307f('0x28')](_0x5de987,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x307f('0x1f')]['syncMusicOnHoldStop']=function(_0x279030){var _0x5e6e4f='';try{if(this[_0x307f('0x22')](_0x279030)){logger[_0x307f('0x36')](_0x307f('0x98'),_0x279030[_0x307f('0x27')],util[_0x307f('0x28')](_0x279030,{'showHidden':![],'depth':null}));if(_0x279030[_0x307f('0x94')]){_0x5e6e4f=_0x279030[_0x307f('0x94')][_0x307f('0x95')](0x0,_0x279030[_0x307f('0x94')][_0x307f('0x99')]('-'));if(this['agents'][_0x5e6e4f]){logger[_0x307f('0x23')](_0x307f('0x9a'),_0x279030[_0x307f('0x27')],_0x5e6e4f);this[_0x307f('0xa')][_0x5e6e4f]['onhold']=![];}}}}catch(_0xfddbae){logger[_0x307f('0x39')](_0x307f('0x9b'),_0x279030[_0x307f('0x27')],util[_0x307f('0x28')](_0xfddbae,{'showHidden':![],'depth':null}));}};module[_0x307f('0x9c')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e8d36a4..32fd8cb 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36e7=['inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','context','from-sip','channel','exten','split','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','keys','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','subtract','duration','lastapplication','lastdata','match','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','seconds','xcally-motion-preview','connectedlinename','destinationchannel','UserId','holdtime','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','user:agentcomplete','transferType','then','isEmpty','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','type','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','outbound','routeid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','util','ioredis','../../../config/logger','ami','../ami','../rpc/setting','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]'];(function(_0xef6502,_0x4d66a0){var _0x4dbb86=function(_0x186698){while(--_0x186698){_0xef6502['push'](_0xef6502['shift']());}};_0x4dbb86(++_0x4d66a0);}(_0x36e7,0x158));var _0x736e=function(_0x4a0f72,_0x307309){_0x4a0f72=_0x4a0f72-0x0;var _0x3a1c70=_0x36e7[_0x4a0f72];return _0x3a1c70;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x736e('0x0'));var path=require('path');var Redis=require(_0x736e('0x1'));var config=require('../../../config/environment');var logger=require(_0x736e('0x2'))(_0x736e('0x3'));var ami=require(_0x736e('0x4'));var Channel=require('../model/channel');var RpcSetting=require(_0x736e('0x5'));var applications=[_0x736e('0x6'),_0x736e('0x7'),_0x736e('0x8'),_0x736e('0x9'),'playback',_0x736e('0xa')];var dispositions=[_0x736e('0xb'),'FAILED',_0x736e('0xc'),'NO\x20ANSWER','NO\x20ANSWER',_0x736e('0xb'),_0x736e('0xd'),_0x736e('0xe'),_0x736e('0xc'),_0x736e('0xc'),_0x736e('0xc')];config[_0x736e('0xf')]=_[_0x736e('0x10')](config['redis'],{'host':_0x736e('0x11'),'port':0x18eb});var io=require(_0x736e('0x12'))(new Redis(config[_0x736e('0xf')]));function VoiceCallReport(_0xb44363){this[_0x736e('0x13')]=_0xb44363['channels'];this[_0x736e('0x14')]=_0xb44363[_0x736e('0x14')];this[_0x736e('0x15')]={};ami['on'](_0x736e('0x16'),this[_0x736e('0x17')]['bind'](this));ami['on'](_0x736e('0x18'),this[_0x736e('0x17')][_0x736e('0x19')](this));ami['on'](_0x736e('0x1a'),this[_0x736e('0x1b')][_0x736e('0x19')](this));ami['on'](_0x736e('0x1c'),this[_0x736e('0x1d')]['bind'](this));ami['on'](_0x736e('0x1e'),this[_0x736e('0x1f')][_0x736e('0x19')](this));ami['on'](_0x736e('0x20'),this[_0x736e('0x21')][_0x736e('0x19')](this));ami['on'](_0x736e('0x22'),this[_0x736e('0x23')][_0x736e('0x19')](this));ami['on'](_0x736e('0x24'),this[_0x736e('0x25')][_0x736e('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x736e('0x19')](this));ami['on'](_0x736e('0x26'),this[_0x736e('0x27')][_0x736e('0x19')](this));ami['on'](_0x736e('0x28'),this['syncMusicOnHoldStop'][_0x736e('0x19')](this));try{logger[_0x736e('0x29')](_0x736e('0x2a'));ami[_0x736e('0x2b')]();}catch(_0x3b0221){logger[_0x736e('0x2c')](_0x736e('0x2d'),util[_0x736e('0x2e')](_0x3b0221,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x736e('0x2f')][_0x736e('0x30')]=function(_0xd71f18){return _0xd71f18!==null&&!_[_0x736e('0x31')](_0xd71f18);};VoiceCallReport[_0x736e('0x2f')][_0x736e('0x32')]=function(_0x3d7e45,_0x2f8c1e,_0xf73068){io['to'](_0x3d7e45)[_0x736e('0x32')](_0x2f8c1e,_0xf73068);};VoiceCallReport[_0x736e('0x2f')][_0x736e('0x23')]=function(_0x5723e6){try{if(this[_0x736e('0x30')](_0x5723e6)){logger['info'](_0x736e('0x33'),_0x5723e6[_0x736e('0x34')],_0x5723e6[_0x736e('0x35')],_0x5723e6[_0x736e('0x36')]);logger[_0x736e('0x37')](_0x736e('0x38'),_0x5723e6[_0x736e('0x34')],util[_0x736e('0x2e')](_0x5723e6,{'showHidden':![],'depth':null}));if(_0x5723e6[_0x736e('0x34')]===_0x5723e6[_0x736e('0x39')]){if(!_[_0x736e('0x31')](this[_0x736e('0x13')][_0x5723e6[_0x736e('0x34')]])){_[_0x736e('0x3a')](this[_0x736e('0x13')][_0x5723e6[_0x736e('0x34')]],_['pick'](_0x5723e6,_['keys'](this[_0x736e('0x13')][_0x5723e6['uniqueid']])));}}if(_0x5723e6[_0x736e('0x3b')]===_0x736e('0x3c')){if(this[_0x736e('0x14')][_0x5723e6[_0x736e('0x3d')]['split']('-')[0x0]]){if(_0x5723e6[_0x736e('0x3e')]=='xcally-motion-preview'){this[_0x736e('0x14')][_0x5723e6[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x40')]=_0x5723e6[_0x736e('0x41')];this[_0x736e('0x32')](util[_0x736e('0x42')](_0x736e('0x43'),this[_0x736e('0x14')][_0x5723e6[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x44')]),_0x736e('0x45'),{'destaccountcode':this[_0x736e('0x14')][_0x5723e6[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x46')],'destconnectedlinenum':_0x5723e6[_0x736e('0x41')]});}}}}}catch(_0x5221c8){logger[_0x736e('0x2c')]('[%s][voiceCallReport][newcallerid]',_0x5723e6['uniqueid'],util[_0x736e('0x2e')](_0x5221c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x736e('0x2f')][_0x736e('0x1b')]=function(_0x3a4932){try{if(this[_0x736e('0x30')](_0x3a4932)){logger[_0x736e('0x37')](_0x736e('0x47'),_0x3a4932['uniqueid'],util['inspect'](_0x3a4932,{'showHidden':![],'depth':null}));if(this[_0x736e('0x13')][_0x3a4932[_0x736e('0x34')]])return;if(_0x3a4932[_0x736e('0x3d')]===_0x736e('0x48'))return;if(_0x3a4932[_0x736e('0x34')]!==_0x3a4932[_0x736e('0x39')]&&!this[_0x736e('0x15')][_0x3a4932[_0x736e('0x39')]])return;logger[_0x736e('0x29')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3a4932[_0x736e('0x34')],_0x3a4932[_0x736e('0x3b')],_0x3a4932[_0x736e('0x3e')]);this['channels'][_0x3a4932[_0x736e('0x34')]]=new Channel();this['channels'][_0x3a4932[_0x736e('0x34')]][_0x736e('0x49')]=moment()['format'](_0x736e('0x4a'));this[_0x736e('0x13')][_0x3a4932[_0x736e('0x34')]][_0x736e('0x4b')]=dispositions[_[_0x736e('0x4c')](_0x3a4932[_0x736e('0x4d')])];_[_0x736e('0x3a')](this[_0x736e('0x13')][_0x3a4932['uniqueid']],_[_0x736e('0x4e')](_0x3a4932,_[_0x736e('0x4f')](this[_0x736e('0x13')][_0x3a4932[_0x736e('0x34')]])));if(_0x3a4932[_0x736e('0x3b')]==='from-sip'){if(this['agents'][_0x3a4932[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]){if(_[_0x736e('0x31')](this[_0x736e('0x14')][_0x3a4932['channel'][_0x736e('0x3f')]('-')[0x0]]['destconnectedlinenum'])){this['agents'][_0x3a4932['channel'][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x40')]=_0x3a4932[_0x736e('0x3e')];logger[_0x736e('0x37')](_0x736e('0x50'),_0x3a4932[_0x736e('0x34')],util[_0x736e('0x2e')]({'id':this[_0x736e('0x14')][_0x3a4932[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x736e('0x14')][_0x3a4932[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3a4932[_0x736e('0x3e')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x736e('0x42')](_0x736e('0x43'),this[_0x736e('0x14')][_0x3a4932[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]['name']),_0x736e('0x45'),{'id':this[_0x736e('0x14')][_0x3a4932[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x736e('0x14')][_0x3a4932['channel'][_0x736e('0x3f')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x3a4932[_0x736e('0x3e')]});}}}}}catch(_0x19c7dc){logger['error'](_0x736e('0x51'),_0x3a4932['uniqueid'],util[_0x736e('0x2e')](_0x19c7dc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x736e('0x2f')][_0x736e('0x17')]=function(_0x1ddb79){try{if(this[_0x736e('0x30')](_0x1ddb79)){logger['debug'](_0x736e('0x52'),_0x1ddb79['uniqueid'],util[_0x736e('0x2e')](_0x1ddb79,{'showHidden':![],'depth':null}));if(_0x1ddb79[_0x736e('0x3d')]===_0x736e('0x48')||_0x1ddb79[_0x736e('0x3e')]==='h')return;if(_0x1ddb79[_0x736e('0x34')]===_0x1ddb79[_0x736e('0x39')]||this[_0x736e('0x15')][_0x1ddb79[_0x736e('0x39')]]){_0x1ddb79[_0x736e('0x53')]=_0x1ddb79[_0x736e('0x53')][_0x736e('0x54')]();_0x1ddb79['applicationdata']=_0x1ddb79[_0x736e('0x55')]||_0x1ddb79['applicationdata'];if(_0x1ddb79[_0x736e('0x55')]&&!_0x1ddb79[_0x736e('0x55')]['startsWith']('CDR(routeAlias)')&&_0x1ddb79[_0x736e('0x53')]!=='queue'){_0x1ddb79['applicationdata']=_0x1ddb79['applicationdata']['toLowerCase']();}logger[_0x736e('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x1ddb79[_0x736e('0x34')],_0x1ddb79[_0x736e('0x53')],_0x1ddb79[_0x736e('0x56')]);if(_[_0x736e('0x31')](this[_0x736e('0x13')][_0x1ddb79['uniqueid']])){this['channels'][_0x1ddb79[_0x736e('0x34')]]=new Channel();this['channels'][_0x1ddb79[_0x736e('0x34')]][_0x736e('0x49')]=_0x1ddb79['duration']?moment()[_0x736e('0x57')](moment[_0x736e('0x58')](_0x1ddb79[_0x736e('0x58')])['seconds'](),'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0x736e('0x4a'));this[_0x736e('0x13')][_0x1ddb79[_0x736e('0x34')]][_0x736e('0x4b')]=_0x736e('0xb');}_['merge'](this[_0x736e('0x13')][_0x1ddb79[_0x736e('0x34')]],_['pick'](_0x1ddb79,_['keys'](this[_0x736e('0x13')][_0x1ddb79[_0x736e('0x34')]])));if(_['includes'](applications,_0x1ddb79[_0x736e('0x53')])){this[_0x736e('0x13')][_0x1ddb79['uniqueid']][_0x736e('0x59')]=_0x1ddb79[_0x736e('0x53')];this[_0x736e('0x13')][_0x1ddb79[_0x736e('0x34')]][_0x736e('0x5a')]=_0x1ddb79[_0x736e('0x56')];if(_0x1ddb79[_0x736e('0x53')]===_0x736e('0x6')&&_['startsWith'](_0x1ddb79[_0x736e('0x56')]['toLowerCase'](),'cdr(')){var _0xfc2a35=_0x1ddb79[_0x736e('0x56')][_0x736e('0x3f')]('=');var _0x188d31=_0xfc2a35[0x0][_0x736e('0x54')]()[_0x736e('0x5b')](/cdr\((.*)\)/);if(_0x188d31){if(_0x188d31[0x1]==='type'&&!_[_0x736e('0x5c')](this[_0x736e('0x13')][_0x1ddb79[_0x736e('0x34')]][_0x188d31[0x1]]))return;this[_0x736e('0x13')][_0x1ddb79[_0x736e('0x34')]][_0x188d31[0x1]]=_0xfc2a35[0x1];}}else if(_0x1ddb79[_0x736e('0x53')]===_0x736e('0x7')){this[_0x736e('0x13')][_0x1ddb79[_0x736e('0x34')]][_0x736e('0x7')]=_0x1ddb79[_0x736e('0x56')][_0x736e('0x3f')](',')[0x0];}}}}}catch(_0x5089da){logger['error'](_0x736e('0x5d'),_0x1ddb79[_0x736e('0x34')],util[_0x736e('0x2e')](_0x5089da,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x736e('0x1d')]=function(_0x4226d2){try{if(this[_0x736e('0x30')](_0x4226d2)){logger[_0x736e('0x29')](_0x736e('0x5e'),_0x4226d2['uniqueid'],_0x4226d2[_0x736e('0x39')],_0x4226d2[_0x736e('0x35')],_0x4226d2['calleridnum']);logger['debug'](_0x736e('0x5f'),_0x4226d2[_0x736e('0x34')],util[_0x736e('0x2e')](_0x4226d2,{'showHidden':![],'depth':null}));if(_0x4226d2[_0x736e('0x4d')]!=='6')return;if(_0x4226d2['uniqueid']!==_0x4226d2['linkedid']){var _0x4d9eaf=moment();if(this['channels'][_0x4226d2[_0x736e('0x39')]]){if(!this[_0x736e('0x13')][_0x4226d2['linkedid']][_0x736e('0x60')]){this[_0x736e('0x13')][_0x4226d2[_0x736e('0x39')]][_0x736e('0x60')]=!![];this['channels'][_0x4226d2[_0x736e('0x39')]][_0x736e('0x61')]=_0x4d9eaf[_0x736e('0x42')](_0x736e('0x4a'));if(this['channels'][_0x4226d2[_0x736e('0x39')]][_0x736e('0x49')]){this['channels'][_0x4226d2[_0x736e('0x39')]]['holdtime']=_0x4d9eaf[_0x736e('0x62')](this['channels'][_0x4226d2['linkedid']][_0x736e('0x49')],_0x736e('0x63'));}}this[_0x736e('0x13')][_0x4226d2['linkedid']]['linkedid']=_0x4226d2[_0x736e('0x34')];if(_0x4226d2[_0x736e('0x36')]!==_0x736e('0x64')){this[_0x736e('0x13')][_0x4226d2['linkedid']][_0x736e('0x41')]=_0x4226d2['calleridnum'];}this[_0x736e('0x13')][_0x4226d2[_0x736e('0x39')]][_0x736e('0x65')]=_0x4226d2[_0x736e('0x35')];this['channels'][_0x4226d2[_0x736e('0x39')]][_0x736e('0x66')]=_0x4226d2['channel'];this['channels'][_0x4226d2['linkedid']][_0x736e('0x4b')]=dispositions[_[_0x736e('0x4c')](_0x4226d2[_0x736e('0x4d')])];if(this[_0x736e('0x14')][_0x4226d2['channel'][_0x736e('0x3f')]('-')[0x0]]){this[_0x736e('0x13')][_0x4226d2[_0x736e('0x39')]][_0x736e('0x67')]=this[_0x736e('0x14')][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]['id'];this['channels'][_0x4226d2[_0x736e('0x39')]]['membername']=this[_0x736e('0x14')][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x44')];}}if(this[_0x736e('0x13')][_0x4226d2['uniqueid']]){if(!this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]][_0x736e('0x60')]){this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]][_0x736e('0x60')]=!![];this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]][_0x736e('0x61')]=_0x4d9eaf[_0x736e('0x42')](_0x736e('0x4a'));if(this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]][_0x736e('0x49')]){this['channels'][_0x4226d2[_0x736e('0x34')]][_0x736e('0x68')]=_0x4d9eaf[_0x736e('0x62')](this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]][_0x736e('0x49')],_0x736e('0x63'));}}if(_0x4226d2[_0x736e('0x36')]!==_0x736e('0x64')){this[_0x736e('0x13')][_0x4226d2['uniqueid']][_0x736e('0x41')]=_0x4226d2['calleridnum'];}this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]]['connectedlinename']=_0x4226d2[_0x736e('0x35')];this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]][_0x736e('0x66')]=_0x4226d2[_0x736e('0x3d')];this[_0x736e('0x13')][_0x4226d2['uniqueid']][_0x736e('0x4b')]=dispositions[_[_0x736e('0x4c')](_0x4226d2[_0x736e('0x4d')])];}}else{if(this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]]){if(this['agents'][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]){this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]][_0x736e('0x67')]=this['agents'][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]['id'];this[_0x736e('0x13')][_0x4226d2['uniqueid']][_0x736e('0x69')]=this[_0x736e('0x14')][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x44')];}}}if(_0x4226d2[_0x736e('0x3b')]===_0x736e('0x3c')){if(this['agents'][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]){this[_0x736e('0x14')][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x40')]=_0x4226d2[_0x736e('0x3e')];var _0x2a0cc7,_0x33fe6c;if(this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]]){_0x2a0cc7=this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]][_0x736e('0x6a')];_0x33fe6c=this[_0x736e('0x13')][_0x4226d2[_0x736e('0x34')]]['queue'];}else if(this['channels'][_0x4226d2[_0x736e('0x39')]]){_0x2a0cc7=this[_0x736e('0x13')][_0x4226d2[_0x736e('0x39')]][_0x736e('0x6a')];_0x33fe6c=this[_0x736e('0x13')][_0x4226d2['linkedid']][_0x736e('0x7')];}this[_0x736e('0x14')][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x7')]=_0x33fe6c;this[_0x736e('0x14')][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x6a')]=_0x2a0cc7;logger[_0x736e('0x37')](_0x736e('0x6b'),_0x4226d2['uniqueid'],util['inspect']({'id':this[_0x736e('0x14')][_0x4226d2[_0x736e('0x3d')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x46')],'destconnectedlinenum':_0x4226d2['exten'],'routealias':_0x2a0cc7,'queue':_0x33fe6c||undefined},{'showHidden':![],'depth':null}));this[_0x736e('0x32')](util['format'](_0x736e('0x43'),this['agents'][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x44')]),_0x736e('0x45'),{'id':this['agents'][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x736e('0x14')][_0x4226d2[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x46')],'destconnectedlinenum':_0x4226d2[_0x736e('0x3e')],'routealias':_0x2a0cc7,'queue':_0x33fe6c||undefined});}}}}catch(_0x32aa1b){logger[_0x736e('0x2c')](_0x736e('0x6c'),_0x4226d2[_0x736e('0x34')],util[_0x736e('0x2e')](_0x32aa1b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x736e('0x2f')]['syncMixMonitorFilename']=function(_0x259c46,_0x24ff6a){try{if(this[_0x736e('0x13')][_0x259c46]){logger[_0x736e('0x29')](_0x736e('0x6d'),_0x259c46,_0x24ff6a);this[_0x736e('0x13')][_0x259c46][_0x736e('0x6e')]=!![];if(_['endsWith'](_0x24ff6a,_0x736e('0x6f'))){_0x24ff6a=_0x24ff6a['replace'](_0x736e('0x6f'),'.WAV');}this['channels'][_0x259c46][_0x736e('0x70')]=_0x24ff6a;var _0x39ff9e=_[_0x736e('0x71')](this[_0x736e('0x13')][_0x259c46]['monitors'],{'filename':_0x24ff6a});if(_[_0x736e('0x5c')](_0x39ff9e)){this[_0x736e('0x13')][_0x259c46][_0x736e('0x72')]['push']({'filename':_0x24ff6a,'createdAt':moment()[_0x736e('0x42')](_0x736e('0x4a')),'mixmonitorid':'','status':_0x736e('0x73')});}}}catch(_0x4bf946){logger[_0x736e('0x2c')](_0x736e('0x74'),_0x259c46,util[_0x736e('0x2e')](_0x4bf946,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x736e('0x1f')]=function(_0x4b3c7f){try{if(this['isNotNull'](_0x4b3c7f)){logger[_0x736e('0x37')]('[%s][voiceCallReport][varset]\x20event:',_0x4b3c7f[_0x736e('0x34')],util['inspect'](_0x4b3c7f,{'showHidden':![],'depth':null}));if(this[_0x736e('0x13')][_0x4b3c7f[_0x736e('0x34')]]&&_0x4b3c7f['channel']!=_0x736e('0x48')){if(this['isNotNull'](_0x4b3c7f[_0x736e('0x75')])){if(this[_0x736e('0x30')](_0x4b3c7f['variable']['mixmonitor_filename'])){logger[_0x736e('0x29')](_0x736e('0x76'),_0x4b3c7f[_0x736e('0x34')],_0x4b3c7f[_0x736e('0x77')]);this[_0x736e('0x78')](_0x4b3c7f[_0x736e('0x34')],_0x4b3c7f[_0x736e('0x77')]);}else if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')][_0x736e('0x79')])){logger[_0x736e('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x4b3c7f[_0x736e('0x34')],_0x4b3c7f['value']);this['channels'][_0x4b3c7f[_0x736e('0x34')]][_0x736e('0x36')]=_0x4b3c7f[_0x736e('0x77')];}else if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')]['xmd-callerid'])){logger['info'](_0x736e('0x7a'),_0x4b3c7f[_0x736e('0x34')],_0x4b3c7f[_0x736e('0x77')]);this['channels'][_0x4b3c7f[_0x736e('0x34')]][_0x736e('0x7b')]=_0x4b3c7f[_0x736e('0x77')];}else if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')][_0x736e('0x7c')])){logger[_0x736e('0x29')](_0x736e('0x7d'),_0x4b3c7f['uniqueid'],_0x4b3c7f['value']);this[_0x736e('0x13')][_0x4b3c7f[_0x736e('0x34')]]['type']=_0x4b3c7f[_0x736e('0x77')];}else if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')]['xmd-queue'])){logger[_0x736e('0x29')](_0x736e('0x7e'),_0x4b3c7f['uniqueid'],_0x4b3c7f[_0x736e('0x77')][_0x736e('0x3f')](',')[0x0]);this['channels'][_0x4b3c7f['uniqueid']][_0x736e('0x7')]=_0x4b3c7f[_0x736e('0x77')][_0x736e('0x3f')](',')[0x0];}else if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')]['xmd-originatecalleridnum'])){logger[_0x736e('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4b3c7f[_0x736e('0x34')],_0x4b3c7f[_0x736e('0x77')]);this[_0x736e('0x13')][_0x4b3c7f[_0x736e('0x34')]][_0x736e('0x7f')]=_0x4b3c7f['value'];}else if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')][_0x736e('0x80')])){logger[_0x736e('0x29')](_0x736e('0x81'),_0x4b3c7f[_0x736e('0x34')],_0x4b3c7f[_0x736e('0x77')]);this[_0x736e('0x13')][_0x4b3c7f[_0x736e('0x34')]]['destination']=_0x4b3c7f[_0x736e('0x77')];}else if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')][_0x736e('0x82')])){logger[_0x736e('0x29')](_0x736e('0x83'),_0x4b3c7f[_0x736e('0x34')],_0x4b3c7f[_0x736e('0x77')]);this[_0x736e('0x13')][_0x4b3c7f[_0x736e('0x34')]]['calleridpreview']=_0x4b3c7f[_0x736e('0x77')];}else if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')][_0x736e('0x84')])){logger[_0x736e('0x29')](_0x736e('0x85'),_0x4b3c7f[_0x736e('0x34')],_0x4b3c7f[_0x736e('0x77')]);this[_0x736e('0x13')][_0x4b3c7f[_0x736e('0x34')]]['queue']=_0x4b3c7f[_0x736e('0x77')];}else if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')][_0x736e('0x86')])){logger[_0x736e('0x29')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4b3c7f['uniqueid'],_0x4b3c7f[_0x736e('0x77')]);this[_0x736e('0x13')][_0x4b3c7f[_0x736e('0x34')]]['sipcalluniqueid']=_0x4b3c7f['value'];}}}else if(this['isNotNull'](_0x4b3c7f[_0x736e('0x75')][_0x736e('0x87')])){if(_0x4b3c7f['value']){var _0x5f7966=path[_0x736e('0x88')](_0x4b3c7f['value'])[_0x736e('0x44')];logger[_0x736e('0x29')](_0x736e('0x76'),_0x5f7966,_0x4b3c7f[_0x736e('0x77')]);this[_0x736e('0x78')](_0x5f7966,_0x4b3c7f[_0x736e('0x77')]);}}else if(this[_0x736e('0x13')][_0x4b3c7f[_0x736e('0x39')]]){if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')])){if(this[_0x736e('0x30')](_0x4b3c7f[_0x736e('0x75')][_0x736e('0x86')])){logger[_0x736e('0x29')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4b3c7f[_0x736e('0x39')],_0x4b3c7f[_0x736e('0x77')]);this[_0x736e('0x13')][_0x4b3c7f[_0x736e('0x39')]][_0x736e('0x89')]=_0x4b3c7f[_0x736e('0x77')];}}}}}catch(_0x10bd7c){logger['error']('[%s][voiceCallReport][varset]',_0x4b3c7f[_0x736e('0x34')],util[_0x736e('0x2e')](_0x10bd7c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x736e('0x2f')][_0x736e('0x21')]=function(_0x2a7515){try{if(this[_0x736e('0x30')](_0x2a7515)){logger['debug'](_0x736e('0x8a'),_0x2a7515[_0x736e('0x34')],util[_0x736e('0x2e')](_0x2a7515,{'showHidden':![],'depth':null}));if(this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]]){if(this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515['linkedid']][_0x736e('0x39')]]){this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]][_0x736e('0x39')]][_0x736e('0x34')]=_0x2a7515['uniqueid'];this['channels'][this['blindTransfers'][_0x2a7515['linkedid']][_0x736e('0x39')]][_0x736e('0x60')]=this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]]['answered'];this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515['linkedid']]['linkedid']][_0x736e('0x61')]=this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]][_0x736e('0x61')];this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]]['linkedid']]['destinationchannel']=this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]]['linkedid']][_0x736e('0x3d')];this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]][_0x736e('0x39')]]['disposition']=this[_0x736e('0x13')][_0x2a7515['uniqueid']]['disposition'];this['channels'][_0x2a7515['uniqueid']]=this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]]['linkedid']];delete this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515['linkedid']][_0x736e('0x39')]];}else if(this['channels'][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]][_0x736e('0x34')]]){this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515['linkedid']]['uniqueid']]['uniqueid']=[this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515['linkedid']][_0x736e('0x34')]][_0x736e('0x39')],this[_0x736e('0x13')][this['blindTransfers'][_0x2a7515[_0x736e('0x39')]][_0x736e('0x34')]][_0x736e('0x39')]=this['channels'][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]][_0x736e('0x34')]][_0x736e('0x34')]][0x0];this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515['linkedid']][_0x736e('0x34')]]['answered']=this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]][_0x736e('0x60')];this[_0x736e('0x13')][this['blindTransfers'][_0x2a7515['linkedid']][_0x736e('0x34')]][_0x736e('0x61')]=this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]][_0x736e('0x61')];this['channels'][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]][_0x736e('0x34')]][_0x736e('0x66')]=this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515['linkedid']][_0x736e('0x34')]][_0x736e('0x3d')];this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]][_0x736e('0x34')]]['disposition']=this['channels'][_0x2a7515[_0x736e('0x34')]]['disposition'];this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]]=this[_0x736e('0x13')][this[_0x736e('0x15')][_0x2a7515[_0x736e('0x39')]]['uniqueid']];delete this['channels'][this[_0x736e('0x15')][_0x2a7515['linkedid']]['uniqueid']];}}if(this['channels'][_0x2a7515[_0x736e('0x34')]]){logger['info'](_0x736e('0x8b'),_0x2a7515[_0x736e('0x34')],_0x2a7515['cause-txt']);var _0x3cbbb1=moment();this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]]['endtime']=_0x3cbbb1[_0x736e('0x42')](_0x736e('0x4a'));this['channels'][_0x2a7515['uniqueid']][_0x736e('0x58')]=_0x3cbbb1[_0x736e('0x62')](this['channels'][_0x2a7515[_0x736e('0x34')]]['starttime'],_0x736e('0x63'));if(this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]][_0x736e('0x60')]){this['channels'][_0x2a7515[_0x736e('0x34')]]['billableseconds']=_0x3cbbb1['diff'](this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]][_0x736e('0x61')],_0x736e('0x63'));this['channels'][_0x2a7515['uniqueid']][_0x736e('0x68')]=this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]][_0x736e('0x58')]-this[_0x736e('0x13')][_0x2a7515[_0x736e('0x34')]][_0x736e('0x8c')];}if(_0x2a7515[_0x736e('0x3b')]===_0x736e('0x3c')){if(this[_0x736e('0x14')][_0x2a7515['channel'][_0x736e('0x3f')]('-')[0x0]]){this[_0x736e('0x14')][_0x2a7515[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]=_[_0x736e('0x8d')](this[_0x736e('0x14')][_0x2a7515[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]],[_0x736e('0x40')]);logger[_0x736e('0x37')](_0x736e('0x8e'),_0x2a7515[_0x736e('0x34')],util[_0x736e('0x2e')]({'id':this['agents'][_0x2a7515[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x2a7515[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]][_0x736e('0x46')]},{'showHidden':![],'depth':null}));this[_0x736e('0x32')](util[_0x736e('0x42')](_0x736e('0x43'),this[_0x736e('0x14')][_0x2a7515['channel']['split']('-')[0x0]]['name']),'user:agentcomplete',{'id':this[_0x736e('0x14')][_0x2a7515[_0x736e('0x3d')][_0x736e('0x3f')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x2a7515[_0x736e('0x3d')]['split']('-')[0x0]][_0x736e('0x46')]});for(var _0x42bdb8=0x0;_0x42bdb80x0?_0x249ecb:0x0;this['voiceQueues'][_0x5c64a9[_0x8bc8('0x68')]][_0x8bc8('0x32')]=this[_0x8bc8('0x12')][_0x5c64a9['queue']]['talking']>_[_0x8bc8('0x70')](_0x5c64a9['loggedin'])?_[_0x8bc8('0x70')](_0x5c64a9[_0x8bc8('0x6f')]):this[_0x8bc8('0x12')][_0x5c64a9['queue']]['talking'];this['emitVoiceQueueSummary'](this[_0x8bc8('0x12')][_0x5c64a9[_0x8bc8('0x68')]],'queuesummary');}logger[_0x8bc8('0x4d')](_0x8bc8('0x71'),util[_0x8bc8('0x41')](this['voiceQueues'][_0x5c64a9[_0x8bc8('0x68')]],{'showHidden':![],'depth':null}));ami[_0x8bc8('0x44')](_0x8bc8('0x72'),this[_0x8bc8('0x12')][_0x5c64a9[_0x8bc8('0x68')]]);}}}catch(_0x1b7a26){logger[_0x8bc8('0x3e')](_0x8bc8('0x67'),util[_0x8bc8('0x41')](_0x1b7a26,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8bc8('0x36')]['syncQueueSummaryComplete']=function(_0x52c06d){logger[_0x8bc8('0x4d')](_0x8bc8('0x73'),util[_0x8bc8('0x41')](_0x52c06d,{'showHidden':![],'depth':null}));ami['emit'](_0x8bc8('0x74'),{});this[_0x8bc8('0x13')]=!![];};VoiceQueueReport['prototype'][_0x8bc8('0x1b')]=function(_0x3b0615){try{if(this[_0x8bc8('0x60')](_0x3b0615)){logger['debug'](_0x8bc8('0x75'),_0x3b0615['uniqueid'],util[_0x8bc8('0x41')](_0x3b0615,{'showHidden':![],'depth':null}));if(_[_0x8bc8('0x61')](this['queueReports'][_0x3b0615[_0x8bc8('0x47')]]))this[_0x8bc8('0xe')][_0x3b0615['uniqueid']]=[];if(_[_0x8bc8('0x61')](this['channels'][_0x3b0615[_0x8bc8('0x47')]]))this[_0x8bc8('0x10')][_0x3b0615[_0x8bc8('0x47')]]={};var _0x125b19=new QueueReport();_0x125b19[_0x8bc8('0x4a')]=_0x3b0615[_0x8bc8('0x68')];_0x125b19[_0x8bc8('0x54')]=this[_0x8bc8('0x12')][_0x125b19[_0x8bc8('0x4a')]]&&this[_0x8bc8('0x12')][_0x125b19[_0x8bc8('0x4a')]][_0x8bc8('0x54')]?this[_0x8bc8('0x12')][_0x125b19['name']][_0x8bc8('0x54')]||_0x8bc8('0x55'):_0x8bc8('0x55');_0x125b19[_0x8bc8('0x68')]=_0x3b0615[_0x8bc8('0x68')];_0x125b19[_0x8bc8('0x76')]=moment()[_0x8bc8('0x48')](_0x8bc8('0x77'));_0x125b19[_0x8bc8('0x78')]=_0x3b0615[_0x8bc8('0x78')];_0x125b19[_0x8bc8('0x79')]=_0x3b0615[_0x8bc8('0x79')];_0x125b19[_0x8bc8('0x47')]=_0x3b0615['uniqueid'];_0x125b19[_0x8bc8('0x7a')]=this[_0x8bc8('0x10')][_0x3b0615[_0x8bc8('0x47')]]['routealias'];logger['info'](_0x8bc8('0x7b'),_0x125b19[_0x8bc8('0x4a')],_0x125b19['type']);_[_0x8bc8('0x7c')](_0x125b19,_[_0x8bc8('0x7d')](_0x3b0615,_['keys'](_0x125b19)));this['queueReports'][_0x3b0615[_0x8bc8('0x47')]][_0x8bc8('0x7e')](_0x125b19);this[_0x8bc8('0x10')][_0x3b0615[_0x8bc8('0x47')]]=_0x125b19;this[_0x8bc8('0x45')](_0x125b19,_0x8bc8('0x1a'));}}catch(_0xb5358b){logger[_0x8bc8('0x3e')](_0x8bc8('0x75'),_0x3b0615[_0x8bc8('0x47')],util['inspect'](_0xb5358b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8bc8('0x36')][_0x8bc8('0x1d')]=function(_0x2eb84e){try{if(this[_0x8bc8('0x60')](_0x2eb84e)){logger[_0x8bc8('0x4d')](_0x8bc8('0x7f'),_0x2eb84e[_0x8bc8('0x47')],util['inspect'](_0x2eb84e,{'showHidden':![],'depth':null}));if(this[_0x8bc8('0xe')][_0x2eb84e[_0x8bc8('0x47')]]){var _0x62d184=_['last'](this[_0x8bc8('0xe')][_0x2eb84e['uniqueid']]);_0x62d184[_0x8bc8('0x80')]=![];_0x62d184[_0x8bc8('0x81')]=null;_0x62d184[_0x8bc8('0x82')]=_0x2eb84e[_0x8bc8('0x82')];_0x62d184[_0x8bc8('0x83')]=_0x2eb84e[_0x8bc8('0x83')];_0x62d184[_0x8bc8('0x1c')]=!![];_0x62d184[_0x8bc8('0x84')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x62d184[_0x8bc8('0x4f')]='ABANDONED';_0x62d184[_0x8bc8('0x85')]=null;logger[_0x8bc8('0x6a')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x62d184['name'],_0x62d184['type']);this[_0x8bc8('0x10')][_0x2eb84e[_0x8bc8('0x47')]]=_0x62d184;this[_0x8bc8('0x4c')](_0x62d184,_0x8bc8('0x1c'));}}}catch(_0x372ddb){logger[_0x8bc8('0x3e')](_0x8bc8('0x7f'),_0x2eb84e[_0x8bc8('0x47')],util['inspect'](_0x372ddb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8bc8('0x36')][_0x8bc8('0x1e')]=function(_0x29f349){try{if(this[_0x8bc8('0x60')](_0x29f349)){logger['debug'](_0x8bc8('0x86'),_0x29f349[_0x8bc8('0x47')],util['inspect'](_0x29f349,{'showHidden':![],'depth':null}));if(this[_0x8bc8('0xe')][_0x29f349[_0x8bc8('0x47')]]){var _0x7d0117=_['last'](this[_0x8bc8('0xe')][_0x29f349[_0x8bc8('0x47')]]);_0x7d0117[_0x8bc8('0x87')]=moment()['format'](_0x8bc8('0x77'));_0x7d0117[_0x8bc8('0x88')]=_0x29f349[_0x8bc8('0x88')];_0x7d0117['connectedlinename']=_0x29f349['connectedlinename'];logger[_0x8bc8('0x6a')](_0x8bc8('0x89'),_0x7d0117[_0x8bc8('0x4a')],_0x7d0117[_0x8bc8('0x54')],_0x29f349[_0x8bc8('0x88')],_0x29f349[_0x8bc8('0x8a')]);this[_0x8bc8('0x10')][_0x29f349[_0x8bc8('0x47')]]=_0x7d0117;this[_0x8bc8('0x45')](_0x7d0117,'queuecallerleave');}}}catch(_0xf54676){logger[_0x8bc8('0x3e')](_0x8bc8('0x86'),_0x29f349[_0x8bc8('0x47')],util[_0x8bc8('0x41')](_0xf54676,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8bc8('0x36')]['syncAgentConnect']=function(_0xe6bfdf){try{if(this[_0x8bc8('0x60')](_0xe6bfdf)){logger['debug'](_0x8bc8('0x8b'),_0xe6bfdf[_0x8bc8('0x47')],util['inspect'](_0xe6bfdf,{'showHidden':![],'depth':null}));if(this[_0x8bc8('0xe')][_0xe6bfdf['uniqueid']]){var _0x4e3abe=_[_0x8bc8('0x8c')](this[_0x8bc8('0xe')][_0xe6bfdf['uniqueid']]);_0x4e3abe[_0x8bc8('0x80')]=!![];_0x4e3abe[_0x8bc8('0x4f')]=_0x8bc8('0x8d');logger[_0x8bc8('0x6a')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4e3abe[_0x8bc8('0x4a')],_0x4e3abe[_0x8bc8('0x54')]);}}}catch(_0x4cc20f){logger['error']('[%s][voiceQueueReport][agentconnect]',_0xe6bfdf[_0x8bc8('0x47')],util[_0x8bc8('0x41')](_0x4cc20f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8bc8('0x20')]=function(_0x57e13e){try{if(this['isNotNull'](_0x57e13e)){logger['debug'](_0x8bc8('0x8e'),_0x57e13e[_0x8bc8('0x47')],util[_0x8bc8('0x41')](_0x57e13e,{'showHidden':![],'depth':null}));if(this[_0x8bc8('0xe')][_0x57e13e[_0x8bc8('0x47')]]){var _0x3a2a55=_[_0x8bc8('0x8c')](this[_0x8bc8('0xe')][_0x57e13e[_0x8bc8('0x47')]]);_0x3a2a55['queuecallerabandon']=![];_0x3a2a55[_0x8bc8('0x84')]=null;_0x3a2a55[_0x8bc8('0x8f')]=!![];_0x3a2a55['lastAssignedTo']=_0x57e13e[_0x8bc8('0x90')];_0x3a2a55[_0x8bc8('0x82')]=_0x57e13e[_0x8bc8('0x82')];_0x3a2a55[_0x8bc8('0x80')]=!![];_0x3a2a55[_0x8bc8('0x91')]=![];_0x3a2a55['queuecallerexitAt']=null;if(!_0x3a2a55[_0x8bc8('0x92')]){if(_0x57e13e['reason']==_0x8bc8('0x92')){_0x3a2a55[_0x8bc8('0x4f')]=_0x8bc8('0x93');logger[_0x8bc8('0x6a')](_0x8bc8('0x94'),_0x3a2a55[_0x8bc8('0x4a')],_0x3a2a55[_0x8bc8('0x54')]);}else{if(_[_0x8bc8('0x95')](_0x57e13e[_0x8bc8('0x3b')][_0x8bc8('0x96')](),'local/')){if(this[_0x8bc8('0xe')][_0x57e13e['linkedid']]){var _0x5b64ff=_['last'](this[_0x8bc8('0xe')][_0x57e13e[_0x8bc8('0x97')]]);_0x5b64ff[_0x8bc8('0x80')]=![];_0x5b64ff['queuecallerexit']=!![];_0x5b64ff['queuecallerexitAt']=moment(_0x3a2a55['queuecallerjoinAt'])[_0x8bc8('0x98')](_0x57e13e['holdtime'],'seconds')[_0x8bc8('0x48')](_0x8bc8('0x77'));_0x5b64ff[_0x8bc8('0x4f')]=_0x8bc8('0x99');_0x5b64ff[_0x8bc8('0x92')]=!![];_0x5b64ff[_0x8bc8('0x9a')]=_0x8bc8('0x9b');_0x5b64ff[_0x8bc8('0x9c')]=_0x57e13e['destexten'];_0x5b64ff[_0x8bc8('0x9d')]=_0x57e13e['uniqueid'];logger[_0x8bc8('0x6a')](_0x8bc8('0x9e'),_0x5b64ff[_0x8bc8('0x4a')],_0x5b64ff['type']);var _0x587e44=this[_0x8bc8('0xe')][_0x57e13e[_0x8bc8('0x97')]];this[_0x8bc8('0xe')][_0x57e13e[_0x8bc8('0x97')]]=this[_0x8bc8('0xe')][_0x57e13e[_0x8bc8('0x47')]];this[_0x8bc8('0xe')][_0x57e13e[_0x8bc8('0x47')]]=_0x587e44;}}else{_0x3a2a55[_0x8bc8('0x4f')]=_0x8bc8('0x9f')+_0x57e13e[_0x8bc8('0xa0')][_0x8bc8('0xa1')]();logger[_0x8bc8('0x6a')](_0x8bc8('0xa2'),_0x3a2a55[_0x8bc8('0x4a')],_0x3a2a55[_0x8bc8('0x54')],_0x3a2a55[_0x8bc8('0x4f')]);}}}this[_0x8bc8('0x10')][_0x57e13e[_0x8bc8('0x47')]]=_0x3a2a55;this[_0x8bc8('0x4c')](_0x3a2a55,_0x8bc8('0x1f'));}}}catch(_0x30de26){logger[_0x8bc8('0x3e')]('[%s][voiceQueueReport][agentcomplete]',_0x57e13e[_0x8bc8('0x47')],util[_0x8bc8('0x41')](_0x30de26,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8bc8('0x36')]['syncVarSet']=function(_0x181269){try{if(this[_0x8bc8('0x60')](_0x181269)){logger[_0x8bc8('0x4d')]('[%s][voiceQueueReport][varset]',_0x181269[_0x8bc8('0x47')],util['inspect'](_0x181269,{'showHidden':![],'depth':null}));this[_0x8bc8('0xa3')](_0x181269[_0x8bc8('0x47')],_[_0x8bc8('0xa4')](_0x181269[_0x8bc8('0xa5')])[0x0],_0x181269[_0x8bc8('0xa6')]);if(this['queueReports'][_0x181269[_0x8bc8('0x47')]]){var _0x5d3bce=_[_0x8bc8('0x8c')](this[_0x8bc8('0xe')][_0x181269[_0x8bc8('0x47')]]);if(_0x5d3bce){if(this[_0x8bc8('0x60')](_0x181269[_0x8bc8('0xa5')])&&this[_0x8bc8('0x60')](_0x181269[_0x8bc8('0xa5')][_0x8bc8('0xa7')])){switch(_0x181269[_0x8bc8('0xa6')]){case _0x8bc8('0xa8'):_0x5d3bce[_0x8bc8('0x91')]=![];_0x5d3bce['queuecallerexitAt']=null;break;case _0x8bc8('0xa9'):_0x5d3bce['lastevent']=_0x8bc8('0xaa');_0x5d3bce['queuecallerexit']=!![];_0x5d3bce[_0x8bc8('0xab')]=moment()[_0x8bc8('0x48')](_0x8bc8('0x77'));_0x5d3bce[_0x8bc8('0x87')]=moment()['format'](_0x8bc8('0x77'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x181269[_0x8bc8('0x47')],util[_0x8bc8('0x41')](_0x5d3bce,{'showHidden':![],'depth':null}));ami[_0x8bc8('0x44')](_0x8bc8('0xac'),_0x5d3bce);break;default:_0x5d3bce[_0x8bc8('0x91')]=!![];_0x5d3bce['queuecallerexitAt']=moment()['format'](_0x8bc8('0x77'));_0x5d3bce[_0x8bc8('0x87')]=moment()[_0x8bc8('0x48')](_0x8bc8('0x77'));}_0x5d3bce[_0x8bc8('0x1c')]=![];_0x5d3bce[_0x8bc8('0x84')]=null;_0x5d3bce[_0x8bc8('0x4f')]=_0x181269[_0x8bc8('0xa6')];this[_0x8bc8('0x10')][_0x181269[_0x8bc8('0x47')]]=_0x5d3bce;this['emitVoiceQueueChannelRemove'](_0x5d3bce,_0x8bc8('0x23'));}else if(this[_0x8bc8('0x60')](_0x181269[_0x8bc8('0xa5')])&&this[_0x8bc8('0x60')](_0x181269['variable'][_0x8bc8('0xad')])){if(!_0x5d3bce[_0x8bc8('0x1c')]){_0x5d3bce[_0x8bc8('0x91')]=!![];_0x5d3bce[_0x8bc8('0xab')]=moment()[_0x8bc8('0x48')](_0x8bc8('0x77'));_0x5d3bce['queuecallerexitreason']=_0x8bc8('0xae');_0x5d3bce[_0x8bc8('0x87')]=moment()[_0x8bc8('0x48')](_0x8bc8('0x77'));this['channels'][_0x181269[_0x8bc8('0x47')]]=_0x5d3bce;}}logger[_0x8bc8('0x6a')](_0x8bc8('0xaf'),_0x181269[_0x8bc8('0x47')],_0x5d3bce['name'],_0x5d3bce[_0x8bc8('0x54')],_[_0x8bc8('0xa4')](_0x181269[_0x8bc8('0xa5')])[0x0],_0x181269['value']);_0x5d3bce['variables']=this[_0x8bc8('0x15')][_0x181269[_0x8bc8('0x47')]];}}}}catch(_0x1dc279){logger[_0x8bc8('0x3e')](_0x8bc8('0xb0'),_0x181269[_0x8bc8('0x47')],util[_0x8bc8('0x41')](_0x1dc279,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8bc8('0x36')][_0x8bc8('0xa3')]=function(_0x3e918c,_0x1ba2bb,_0x295212){var _0x842427=['rtpaudioqos','rtpaudioqosbridged',_0x8bc8('0xb1'),_0x8bc8('0xb2'),_0x8bc8('0xb3'),_0x8bc8('0xb4'),_0x8bc8('0xb5'),_0x8bc8('0xb6'),'sipcallid',_0x8bc8('0xb7'),_0x8bc8('0xb8'),_0x8bc8('0xb9'),_0x8bc8('0xba'),'memberdynamic',_0x8bc8('0xbb'),_0x8bc8('0xbc'),_0x8bc8('0x90'),_0x8bc8('0xbd'),_0x8bc8('0xbe')];if(!_[_0x8bc8('0x38')](_0x1ba2bb)&&!_['includes'](_0x842427,_0x1ba2bb)){if(_['isUndefined'](this[_0x8bc8('0x15')][_0x3e918c])){this[_0x8bc8('0x15')][_0x3e918c]={};}this[_0x8bc8('0x15')][_0x3e918c][_0x1ba2bb]=_0x295212;}};VoiceQueueReport[_0x8bc8('0x36')][_0x8bc8('0xbf')]=function(_0x3318e8,_0x4ff57e,_0x4adae5){var _0x326960={};for(var _0x3612da=0x0;_0x3612da0x0?_0x1bdce3:0x0;this[_0x3964('0x10')][_0x59785a['queue']]['talking']=this[_0x3964('0x10')][_0x59785a[_0x3964('0x61')]][_0x3964('0x52')]>_[_0x3964('0x65')](_0x59785a[_0x3964('0x68')])?_['toNumber'](_0x59785a[_0x3964('0x68')]):this[_0x3964('0x10')][_0x59785a[_0x3964('0x61')]][_0x3964('0x52')];this[_0x3964('0x4b')](this['voiceQueues'][_0x59785a['queue']],'queuesummary');}logger['debug'](_0x3964('0x69'),util[_0x3964('0x3a')](this[_0x3964('0x10')][_0x59785a[_0x3964('0x61')]],{'showHidden':![],'depth':null}));ami[_0x3964('0x3f')]('custom:queuesummary',this['voiceQueues'][_0x59785a[_0x3964('0x61')]]);}}}catch(_0x5d37d8){logger[_0x3964('0x37')]('[voiceQueueReport][queuesummary]',util[_0x3964('0x3a')](_0x5d37d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0x18')]=function(_0x2f4f5b){logger[_0x3964('0x59')](_0x3964('0x6a'),util[_0x3964('0x3a')](_0x2f4f5b,{'showHidden':![],'depth':null}));ami[_0x3964('0x3f')]('custom:queuesummarycomplete',{});this[_0x3964('0x11')]=!![];};VoiceQueueReport['prototype'][_0x3964('0x1a')]=function(_0x4fab77){try{if(this[_0x3964('0x5b')](_0x4fab77)){logger[_0x3964('0x59')](_0x3964('0x6b'),_0x4fab77[_0x3964('0x43')],util['inspect'](_0x4fab77,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x4fab77[_0x3964('0x43')]]))this[_0x3964('0x39')][_0x4fab77['uniqueid']]=[];if(_[_0x3964('0x5c')](this[_0x3964('0xf')][_0x4fab77[_0x3964('0x43')]]))this['channels'][_0x4fab77[_0x3964('0x43')]]={};var _0x377a7c=new QueueReport();_0x377a7c[_0x3964('0x45')]=_0x4fab77[_0x3964('0x61')];_0x377a7c[_0x3964('0x4c')]=this[_0x3964('0x10')][_0x377a7c[_0x3964('0x45')]]&&this['voiceQueues'][_0x377a7c[_0x3964('0x45')]][_0x3964('0x4c')]?this['voiceQueues'][_0x377a7c[_0x3964('0x45')]]['type']||_0x3964('0x6c'):_0x3964('0x6c');_0x377a7c[_0x3964('0x61')]=_0x4fab77[_0x3964('0x61')];_0x377a7c[_0x3964('0x6d')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));_0x377a7c[_0x3964('0x6f')]=_0x4fab77[_0x3964('0x6f')];_0x377a7c[_0x3964('0x70')]=_0x4fab77[_0x3964('0x70')];_0x377a7c[_0x3964('0x43')]=_0x4fab77[_0x3964('0x43')];_0x377a7c[_0x3964('0x71')]=this[_0x3964('0xf')][_0x4fab77[_0x3964('0x43')]][_0x3964('0x71')];logger[_0x3964('0x72')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x377a7c[_0x3964('0x45')],_0x377a7c[_0x3964('0x4c')]);_[_0x3964('0x73')](_0x377a7c,_[_0x3964('0x74')](_0x4fab77,_[_0x3964('0x75')](_0x377a7c)));this[_0x3964('0x39')][_0x4fab77[_0x3964('0x43')]][_0x3964('0x76')](_0x377a7c);this[_0x3964('0xf')][_0x4fab77[_0x3964('0x43')]]=_0x377a7c;this['emitVoiceQueueChannelSave'](_0x377a7c,_0x3964('0x19'));}}catch(_0x98a98b){logger[_0x3964('0x37')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4fab77[_0x3964('0x43')],util[_0x3964('0x3a')](_0x98a98b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3964('0x1c')]=function(_0xbd2634){try{if(this['isNotNull'](_0xbd2634)){logger[_0x3964('0x59')]('[%s][voiceQueueReport][queuecallerabandon]',_0xbd2634[_0x3964('0x43')],util[_0x3964('0x3a')](_0xbd2634,{'showHidden':![],'depth':null}));if(this[_0x3964('0x39')][_0xbd2634[_0x3964('0x43')]]){var _0x1e9c18=_[_0x3964('0x77')](this['queueReports'][_0xbd2634[_0x3964('0x43')]]);_0x1e9c18[_0x3964('0x78')]=![];_0x1e9c18['queuecallercompleteAt']=null;_0x1e9c18[_0x3964('0x79')]=_0xbd2634[_0x3964('0x79')];_0x1e9c18[_0x3964('0x7a')]=_0xbd2634[_0x3964('0x7a')];_0x1e9c18[_0x3964('0x1b')]=!![];_0x1e9c18['queuecallerabandonAt']=moment()[_0x3964('0x49')](_0x3964('0x6e'));_0x1e9c18['queuecallerexitreason']=_0x3964('0x7b');_0x1e9c18['lastAssignedTo']=null;logger[_0x3964('0x72')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1e9c18[_0x3964('0x45')],_0x1e9c18[_0x3964('0x4c')]);this[_0x3964('0xf')][_0xbd2634[_0x3964('0x43')]]=_0x1e9c18;this[_0x3964('0x3d')](_0x1e9c18,_0x3964('0x1b'));}}}catch(_0x260db7){logger['error'](_0x3964('0x7c'),_0xbd2634[_0x3964('0x43')],util[_0x3964('0x3a')](_0x260db7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0x7d')]=function(_0x1eb4af){try{if(this[_0x3964('0x5b')](_0x1eb4af)){logger['debug'](_0x3964('0x7e'),_0x1eb4af[_0x3964('0x43')],util[_0x3964('0x3a')](_0x1eb4af,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1eb4af[_0x3964('0x43')]]){var _0x4b33cf=_[_0x3964('0x77')](this['queueReports'][_0x1eb4af[_0x3964('0x43')]]);_0x4b33cf[_0x3964('0x7f')]=moment()['format'](_0x3964('0x6e'));_0x4b33cf[_0x3964('0x80')]=_0x1eb4af[_0x3964('0x80')];_0x4b33cf[_0x3964('0x81')]=_0x1eb4af[_0x3964('0x81')];logger['info'](_0x3964('0x82'),_0x4b33cf[_0x3964('0x45')],_0x4b33cf[_0x3964('0x4c')],_0x1eb4af[_0x3964('0x80')],_0x1eb4af[_0x3964('0x81')]);this[_0x3964('0xf')][_0x1eb4af['uniqueid']]=_0x4b33cf;this['emitVoiceQueueChannelSave'](_0x4b33cf,_0x3964('0x1d'));}}}catch(_0x36dc6d){logger[_0x3964('0x37')]('[%s][voiceQueueReport][queuecallerleave]',_0x1eb4af[_0x3964('0x43')],util[_0x3964('0x3a')](_0x36dc6d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0x83')]=function(_0x71c4fd){try{if(this[_0x3964('0x5b')](_0x71c4fd)){logger[_0x3964('0x59')](_0x3964('0x84'),_0x71c4fd[_0x3964('0x43')],util[_0x3964('0x3a')](_0x71c4fd,{'showHidden':![],'depth':null}));if(this[_0x3964('0x39')][_0x71c4fd[_0x3964('0x43')]]){var _0x4c713d=_[_0x3964('0x77')](this[_0x3964('0x39')][_0x71c4fd[_0x3964('0x43')]]);_0x4c713d[_0x3964('0x78')]=!![];_0x4c713d[_0x3964('0x48')]=_0x3964('0x85');logger['info'](_0x3964('0x86'),_0x4c713d[_0x3964('0x45')],_0x4c713d[_0x3964('0x4c')]);}}}catch(_0x401d25){logger[_0x3964('0x37')]('[%s][voiceQueueReport][agentconnect]',_0x71c4fd[_0x3964('0x43')],util[_0x3964('0x3a')](_0x401d25,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0x1f')]=function(_0x499136){try{if(this[_0x3964('0x5b')](_0x499136)){logger['debug'](_0x3964('0x87'),_0x499136[_0x3964('0x43')],util[_0x3964('0x3a')](_0x499136,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x499136[_0x3964('0x43')]]){var _0x41e011=_[_0x3964('0x77')](this[_0x3964('0x39')][_0x499136[_0x3964('0x43')]]);_0x41e011[_0x3964('0x1b')]=![];_0x41e011[_0x3964('0x88')]=null;_0x41e011['assigned']=!![];_0x41e011[_0x3964('0x89')]=_0x499136[_0x3964('0x8a')];_0x41e011[_0x3964('0x79')]=_0x499136[_0x3964('0x79')];_0x41e011['queuecallercomplete']=!![];_0x41e011[_0x3964('0x8b')]=![];_0x41e011[_0x3964('0x8c')]=null;if(!_0x41e011['transfer']){if(_0x499136[_0x3964('0x8d')]==_0x3964('0x8e')){_0x41e011[_0x3964('0x48')]=_0x3964('0x8f');logger[_0x3964('0x72')](_0x3964('0x90'),_0x41e011['name'],_0x41e011[_0x3964('0x4c')]);}else{if(_[_0x3964('0x91')](_0x499136[_0x3964('0x34')]['toLowerCase'](),_0x3964('0x92'))){if(this[_0x3964('0x39')][_0x499136['linkedid']]){var _0x92bf13=_['last'](this[_0x3964('0x39')][_0x499136[_0x3964('0x93')]]);_0x92bf13[_0x3964('0x78')]=![];_0x92bf13[_0x3964('0x8b')]=!![];_0x92bf13[_0x3964('0x8c')]=moment(_0x41e011[_0x3964('0x6d')])['add'](_0x499136[_0x3964('0x79')],_0x3964('0x94'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x92bf13['queuecallerexitreason']='FORWARDTRANSFER';_0x92bf13[_0x3964('0x8e')]=!![];_0x92bf13['transfertype']=_0x3964('0x95');_0x92bf13[_0x3964('0x96')]=_0x499136['destexten'];_0x92bf13[_0x3964('0x97')]=_0x499136['uniqueid'];logger['info'](_0x3964('0x98'),_0x92bf13[_0x3964('0x45')],_0x92bf13[_0x3964('0x4c')]);var _0x1ac5d0=this[_0x3964('0x39')][_0x499136[_0x3964('0x93')]];this[_0x3964('0x39')][_0x499136['linkedid']]=this[_0x3964('0x39')][_0x499136[_0x3964('0x43')]];this[_0x3964('0x39')][_0x499136[_0x3964('0x43')]]=_0x1ac5d0;}}else{_0x41e011['queuecallerexitreason']=_0x3964('0x99')+_0x499136[_0x3964('0x8d')][_0x3964('0x9a')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x41e011[_0x3964('0x45')],_0x41e011['type'],_0x41e011[_0x3964('0x48')]);}}}this['channels'][_0x499136[_0x3964('0x43')]]=_0x41e011;this[_0x3964('0x3d')](_0x41e011,_0x3964('0x1e'));}}}catch(_0x1eb967){logger['error'](_0x3964('0x87'),_0x499136[_0x3964('0x43')],util[_0x3964('0x3a')](_0x1eb967,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3964('0x22')]=function(_0x3173f7){try{if(this[_0x3964('0x5b')](_0x3173f7)){logger[_0x3964('0x59')](_0x3964('0x9b'),_0x3173f7['uniqueid'],util['inspect'](_0x3173f7,{'showHidden':![],'depth':null}));this[_0x3964('0x9c')](_0x3173f7['uniqueid'],_[_0x3964('0x75')](_0x3173f7['variable'])[0x0],_0x3173f7['value']);if(this['queueReports'][_0x3173f7[_0x3964('0x43')]]){var _0xdac2a3=_[_0x3964('0x77')](this[_0x3964('0x39')][_0x3173f7[_0x3964('0x43')]]);if(_0xdac2a3){if(this[_0x3964('0x5b')](_0x3173f7[_0x3964('0x9d')])&&this[_0x3964('0x5b')](_0x3173f7[_0x3964('0x9d')][_0x3964('0x9e')])){switch(_0x3173f7[_0x3964('0x9f')]){case _0x3964('0xa0'):_0xdac2a3[_0x3964('0x8b')]=![];_0xdac2a3[_0x3964('0x8c')]=null;break;case'TIMEOUT':_0xdac2a3[_0x3964('0xa1')]=_0x3964('0xa2');_0xdac2a3[_0x3964('0x8b')]=!![];_0xdac2a3[_0x3964('0x8c')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));_0xdac2a3[_0x3964('0x7f')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));logger[_0x3964('0x59')](_0x3964('0xa3'),_0x3173f7[_0x3964('0x43')],util['inspect'](_0xdac2a3,{'showHidden':![],'depth':null}));ami[_0x3964('0x3f')](_0x3964('0xa4'),_0xdac2a3);break;default:_0xdac2a3[_0x3964('0x8b')]=!![];_0xdac2a3['queuecallerexitAt']=moment()[_0x3964('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0xdac2a3[_0x3964('0x7f')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));}_0xdac2a3[_0x3964('0x1b')]=![];_0xdac2a3[_0x3964('0x88')]=null;_0xdac2a3[_0x3964('0x48')]=_0x3173f7[_0x3964('0x9f')];this[_0x3964('0xf')][_0x3173f7[_0x3964('0x43')]]=_0xdac2a3;this['emitVoiceQueueChannelRemove'](_0xdac2a3,_0x3964('0x21'));}else if(this[_0x3964('0x5b')](_0x3173f7[_0x3964('0x9d')])&&this[_0x3964('0x5b')](_0x3173f7['variable'][_0x3964('0xa5')])){if(!_0xdac2a3[_0x3964('0x1b')]){_0xdac2a3[_0x3964('0x8b')]=!![];_0xdac2a3[_0x3964('0x8c')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));_0xdac2a3[_0x3964('0x48')]=_0x3964('0xa6');_0xdac2a3[_0x3964('0x7f')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));this[_0x3964('0xf')][_0x3173f7['uniqueid']]=_0xdac2a3;}}logger['info'](_0x3964('0xa7'),_0x3173f7[_0x3964('0x43')],_0xdac2a3['name'],_0xdac2a3[_0x3964('0x4c')],_[_0x3964('0x75')](_0x3173f7[_0x3964('0x9d')])[0x0],_0x3173f7[_0x3964('0x9f')]);_0xdac2a3[_0x3964('0x13')]=this[_0x3964('0x13')][_0x3173f7[_0x3964('0x43')]];}}}}catch(_0x2bd18c){logger[_0x3964('0x37')](_0x3964('0x9b'),_0x3173f7[_0x3964('0x43')],util['inspect'](_0x2bd18c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')]['addVariable']=function(_0x43071e,_0x5d2ca5,_0x2e589b){var _0x332209=[_0x3964('0xa8'),_0x3964('0xa9'),_0x3964('0xaa'),_0x3964('0xab'),'rtpaudioqosloss',_0x3964('0xac'),_0x3964('0xad'),_0x3964('0xae'),_0x3964('0xaf'),_0x3964('0xb0'),_0x3964('0xb1'),'bridgepvtcallid','membercalls',_0x3964('0xb2'),_0x3964('0xb3'),_0x3964('0xb4'),'membername','memberpenalty',_0x3964('0xb5')];if(!_[_0x3964('0x33')](_0x5d2ca5)&&!_['includes'](_0x332209,_0x5d2ca5)){if(_[_0x3964('0x5c')](this['variables'][_0x43071e])){this[_0x3964('0x13')][_0x43071e]={};}this[_0x3964('0x13')][_0x43071e][_0x5d2ca5]=_0x2e589b;}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0xb6')]=function(_0x512df5,_0x18d0b9,_0x5a8c83){var _0x13583c={};for(var _0x3b6371=0x0;_0x3b6371=0x0?moment(_0x1363c2[_0x8a5d('0x17')])[_0x8a5d('0x18')](_0x1363c2['starttime'],_0x8a5d('0xd')):null,'data1':_0x8a5d('0x19'),'data2':_0x1363c2[_0x8a5d('0x12')],'data3':_0x1363c2[_0x8a5d('0x10')],'data4':_0x1363c2[_0x8a5d('0x1a')]||null,'role':_0x8a5d('0x11'),'internal':_0x1363c2[_0x8a5d('0x12')]?_['toNumber'](_0x1363c2['accountcode']):undefined,'uniqueid':_0x1363c2[_0x8a5d('0x1b')]},'log':_0x8a5d('0x6')});}; \ No newline at end of file +var _0x56f6=['moment','lodash','util','../client','queuecallerexitAt','Request','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','outbound','agent'];(function(_0x30b7b0,_0x5255cf){var _0x5024ef=function(_0x1c82d5){while(--_0x1c82d5){_0x30b7b0['push'](_0x30b7b0['shift']());}};_0x5024ef(++_0x5255cf);}(_0x56f6,0xf0));var _0x656f=function(_0x56808b,_0xea57aa){_0x56808b=_0x56808b-0x0;var _0x3e2c8e=_0x56f6[_0x56808b];return _0x3e2c8e;};'use strict';var moment=require(_0x656f('0x0'));var _=require(_0x656f('0x1'));var util=require(_0x656f('0x2'));var client=require(_0x656f('0x3'));exports['voiceQueueReport']=function(_0x58d378){var _0x140ce8=_0x58d378['queuecallercompleteAt']||_0x58d378[_0x656f('0x4')];return client[_0x656f('0x5')]('CreateMemberReport',{'body':{'channel':_0x656f('0x6'),'membername':_0x58d378['lastAssignedTo'],'interface':_[_0x656f('0x7')](_0x58d378[_0x656f('0x8')])?util[_0x656f('0x9')](_0x656f('0xa'),_0x58d378[_0x656f('0xb')]):_0x58d378[_0x656f('0x8')],'type':_0x656f('0xc'),'enterAt':_0x58d378[_0x656f('0xd')],'exitAt':_0x140ce8,'duration':moment(_0x140ce8)[_0x656f('0xe')](_0x58d378[_0x656f('0xd')],_0x656f('0xf')),'data1':_0x656f('0x10'),'data2':_0x58d378[_0x656f('0x11')],'data3':_0x58d378[_0x656f('0x12')],'data4':null,'data5':_0x58d378[_0x656f('0x13')],'role':'agent','internal':_0x58d378[_0x656f('0x14')]?_[_0x656f('0x15')](_0x58d378[_0x656f('0x14')]):undefined,'uniqueid':_0x58d378[_0x656f('0x16')]},'log':_0x656f('0x17')});};exports[_0x656f('0x18')]=function(_0x524e39){return client[_0x656f('0x5')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x524e39[_0x656f('0x19')],'interface':_0x524e39[_0x656f('0x8')],'type':_0x656f('0xc'),'enterAt':_0x524e39[_0x656f('0x1a')],'exitAt':_0x524e39['endtime'],'duration':moment(_0x524e39['endtime'])[_0x656f('0xe')](_0x524e39['starttime'],_0x656f('0xf'))>=0x0?moment(_0x524e39[_0x656f('0x1b')])[_0x656f('0xe')](_0x524e39[_0x656f('0x1a')],_0x656f('0xf')):null,'data1':_0x656f('0x1c'),'data2':_0x524e39[_0x656f('0x14')],'data3':_0x524e39['exten'],'data4':_0x524e39['dialstring']||null,'role':_0x656f('0x1d'),'internal':_0x524e39[_0x656f('0x14')]?_['toNumber'](_0x524e39[_0x656f('0x14')]):undefined,'uniqueid':_0x524e39[_0x656f('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 09fe366..32ef712 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 _0x0c19=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client'];(function(_0x2c86c1,_0x398182){var _0x4a7965=function(_0x3e3c39){while(--_0x3e3c39){_0x2c86c1['push'](_0x2c86c1['shift']());}};_0x4a7965(++_0x398182);}(_0x0c19,0xf5));var _0x90c1=function(_0x17bb57,_0x56b46a){_0x17bb57=_0x17bb57-0x0;var _0x5d40ec=_0x0c19[_0x17bb57];return _0x5d40ec;};'use strict';var client=require(_0x90c1('0x0'));exports[_0x90c1('0x1')]=function(){return client[_0x90c1('0x2')](_0x90c1('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x90c1('0x4'),_0x90c1('0x5')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x0767=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x474f05,_0x3a9247){var _0x34ae54=function(_0x1cbb23){while(--_0x1cbb23){_0x474f05['push'](_0x474f05['shift']());}};_0x34ae54(++_0x3a9247);}(_0x0767,0x1bf));var _0x7076=function(_0x54d77a,_0xd24d65){_0x54d77a=_0x54d77a-0x0;var _0x588253=_0x0767[_0x54d77a];return _0x588253;};'use strict';var client=require(_0x7076('0x0'));exports[_0x7076('0x1')]=function(){return client[_0x7076('0x2')](_0x7076('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7076('0x4'),_0x7076('0x5')]},'log':_0x7076('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 714408a..f7b6e91 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 _0x1ae7=['Request','GetTemplate','name','../client','getTemplates'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1ae7,0xc6));var _0x71ae=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x1ae7[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0x71ae('0x0'));exports[_0x71ae('0x1')]=function(_0x181944){return function(_0x57ade7){return client[_0x71ae('0x2')](_0x71ae('0x3'),{'options':{'raw':!![],'attributes':['id',_0x71ae('0x4'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x7906=['getTemplates','Request','name','GetTemplate','../client'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x7906,0x15d));var _0x6790=function(_0x11864a,_0x454fd5){_0x11864a=_0x11864a-0x0;var _0x1e087b=_0x7906[_0x11864a];return _0x1e087b;};'use strict';var client=require(_0x6790('0x0'));exports[_0x6790('0x1')]=function(_0x1261c7){return function(_0x55aa7b){return client[_0x6790('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x6790('0x3'),'html']},'log':_0x6790('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 96b2ac8..5cbc6fc 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 _0xf3d0=['AnyConditions','Actions','action','data1','data2','data3','data4','data6','data7','GetTrigger','Request','name','channel','status','AllConditions','field','operator','value','Condition'];(function(_0x1e0ab4,_0x106dcb){var _0x504c1b=function(_0x225818){while(--_0x225818){_0x1e0ab4['push'](_0x1e0ab4['shift']());}};_0x504c1b(++_0x106dcb);}(_0xf3d0,0x1e5));var _0x0f3d=function(_0xc0ff5d,_0x2cbe29){_0xc0ff5d=_0xc0ff5d-0x0;var _0x1e159e=_0xf3d0[_0xc0ff5d];return _0x1e159e;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x5992b2){return function(_0x58f3b6){return client[_0x0f3d('0x0')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x0f3d('0x1'),_0x0f3d('0x2'),_0x0f3d('0x3')],'include':[{'model':'Condition','as':_0x0f3d('0x4'),'attributes':['id',_0x0f3d('0x5'),_0x0f3d('0x6'),_0x0f3d('0x7')]},{'model':_0x0f3d('0x8'),'as':_0x0f3d('0x9'),'attributes':['id',_0x0f3d('0x5'),'operator',_0x0f3d('0x7')]},{'model':'Action','as':_0x0f3d('0xa'),'attributes':['id',_0x0f3d('0xb'),_0x0f3d('0xc'),_0x0f3d('0xd'),_0x0f3d('0xe'),_0x0f3d('0xf'),'data5',_0x0f3d('0x10'),_0x0f3d('0x11')]}]},'log':_0x0f3d('0x12')});};}; \ No newline at end of file +var _0x1b8e=['status','Condition','operator','AnyConditions','field','Action','Actions','data3','data4','data5','data7','../client','name','channel'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x1b8e,0x1d9));var _0xe1b8=function(_0x28d4ba,_0x470d91){_0x28d4ba=_0x28d4ba-0x0;var _0x3504fc=_0x1b8e[_0x28d4ba];return _0x3504fc;};'use strict';var client=require(_0xe1b8('0x0'));exports['getTriggers']=function(_0x48cabb){return function(_0x4ee1db){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xe1b8('0x1'),_0xe1b8('0x2'),_0xe1b8('0x3')],'include':[{'model':_0xe1b8('0x4'),'as':'AllConditions','attributes':['id','field',_0xe1b8('0x5'),'value']},{'model':_0xe1b8('0x4'),'as':_0xe1b8('0x6'),'attributes':['id',_0xe1b8('0x7'),'operator','value']},{'model':_0xe1b8('0x8'),'as':_0xe1b8('0x9'),'attributes':['id','action','data1','data2',_0xe1b8('0xa'),_0xe1b8('0xb'),_0xe1b8('0xc'),'data6',_0xe1b8('0xd')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5f923f7..803eb92 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 _0x093a=['defaultuser','GetTrunk','getTrunks','name','registry'];(function(_0xfbd94b,_0x13edfc){var _0x41d0f3=function(_0x565aaa){while(--_0x565aaa){_0xfbd94b['push'](_0xfbd94b['shift']());}};_0x41d0f3(++_0x13edfc);}(_0x093a,0x16a));var _0xa093=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x093a[_0x307d86];return _0x361745;};'use strict';var client=require('../client');exports[_0xa093('0x0')]=function(_0x208b55){return function(_0x197f08){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa093('0x1'),_0xa093('0x2'),_0xa093('0x3')]},'log':_0xa093('0x4')});};}; \ No newline at end of file +var _0xff25=['Request','GetTrunk','name','registry'];(function(_0x1ba6aa,_0x6e5946){var _0x4a541b=function(_0x1600c6){while(--_0x1600c6){_0x1ba6aa['push'](_0x1ba6aa['shift']());}};_0x4a541b(++_0x6e5946);}(_0xff25,0x190));var _0x5ff2=function(_0x41b09b,_0x5aa4c5){_0x41b09b=_0x41b09b-0x0;var _0x5b6061=_0xff25[_0x41b09b];return _0x5b6061;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x59179f){return function(_0x52c5fb){return client[_0x5ff2('0x0')](_0x5ff2('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5ff2('0x2'),_0x5ff2('0x3'),'defaultuser']},'log':_0x5ff2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f1e11df..2ade70c 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x55f7ec,_0x35fed9){var _0x53ce10=function(_0x4a191d){while(--_0x4a191d){_0x55f7ec['push'](_0x55f7ec['shift']());}};_0x53ce10(++_0x35fed9);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x41ca89,_0x4b3d38){var _0x1874e5=function(_0x33afc9){while(--_0x33afc9){_0x41ca89['push'](_0x41ca89['shift']());}};_0x1874e5(++_0x4b3d38);}(_0x70e0,0x17b));var _0x070e=function(_0x88b86d,_0xdf3ae4){_0x88b86d=_0x88b86d-0x0;var _0x584fea=_0x70e0[_0x88b86d];return _0x584fea;};'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 b1f6145..26310b2 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 _0xa813=['update','Request','UpdateVoiceAgentReport','CreateVoiceAgentReport'];(function(_0x42bbed,_0x2ded4a){var _0x5cba04=function(_0x1f0d37){while(--_0x1f0d37){_0x42bbed['push'](_0x42bbed['shift']());}};_0x5cba04(++_0x2ded4a);}(_0xa813,0x73));var _0x3a81=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa813[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports['create']=function(_0x4b9dba){return client['Request'](_0x3a81('0x0'),{'body':_0x4b9dba,'log':_0x3a81('0x0')});};exports[_0x3a81('0x1')]=function(_0x4c0b89,_0x45113f,_0x24dbec){return client[_0x3a81('0x2')](_0x3a81('0x3'),{'body':_0x4c0b89,'options':{'where':{'uniqueid':_0x45113f,'interface':_0x24dbec,'agentcomplete':!![]}},'log':_0x3a81('0x3')});}; \ No newline at end of file +var _0xf174=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x1a4b39,_0xc72fc8){var _0x35d48b=function(_0x530846){while(--_0x530846){_0x1a4b39['push'](_0x1a4b39['shift']());}};_0x35d48b(++_0xc72fc8);}(_0xf174,0xa8));var _0x4f17=function(_0x339bac,_0x18b94e){_0x339bac=_0x339bac-0x0;var _0x32ddd9=_0xf174[_0x339bac];return _0x32ddd9;};'use strict';var client=require(_0x4f17('0x0'));exports[_0x4f17('0x1')]=function(_0x230d27){return client[_0x4f17('0x2')](_0x4f17('0x3'),{'body':_0x230d27,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x283823,_0x1f4f1f,_0xe3f693){return client[_0x4f17('0x2')](_0x4f17('0x4'),{'body':_0x283823,'options':{'where':{'uniqueid':_0x1f4f1f,'interface':_0xe3f693,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index fa14a27..bcab75c 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 _0xdd73=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','GetVoiceCallReports','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf'];(function(_0x1d2935,_0x352b63){var _0x4a4d73=function(_0x151c9c){while(--_0x151c9c){_0x1d2935['push'](_0x1d2935['shift']());}};_0x4a4d73(++_0x352b63);}(_0xdd73,0x9f));var _0x3dd7=function(_0xa72a90,_0x3d2ff5){_0xa72a90=_0xa72a90-0x0;var _0x264a45=_0xdd73[_0xa72a90];return _0x264a45;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x3dd7('0x0'));var client=require('../client');exports[_0x3dd7('0x1')]=function(_0x12e647){return client[_0x3dd7('0x2')](_0x3dd7('0x3'),{'body':_[_0x3dd7('0x4')](_0x12e647,{'source':_0x12e647[_0x3dd7('0x5')],'destinationcontext':_0x12e647[_0x3dd7('0x6')],'callerid':_0x12e647[_0x3dd7('0x7')],'amaflags':_0x3dd7('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x3dd7('0x9')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x3dd7('0xa')],'createdAt':{'$between':[moment()[_0x3dd7('0xb')](_0x3dd7('0xc'))[_0x3dd7('0xd')](_0x3dd7('0xe')),moment()[_0x3dd7('0xf')](_0x3dd7('0xc'))[_0x3dd7('0xd')](_0x3dd7('0xe'))]}},'attributes':[_0x3dd7('0x10'),'disposition',_0x3dd7('0x11'),'billableseconds']},'log':_0x3dd7('0x12')});};}; \ No newline at end of file +var _0x0d43=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x0d43,0x79));var _0x30d4=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x0d43[_0x387777];return _0x3f84c0;};'use strict';var moment=require('moment');var util=require(_0x30d4('0x0'));var _=require(_0x30d4('0x1'));var client=require(_0x30d4('0x2'));exports[_0x30d4('0x3')]=function(_0x4b6dcf){return client['Request'](_0x30d4('0x4'),{'body':_[_0x30d4('0x5')](_0x4b6dcf,{'source':_0x4b6dcf[_0x30d4('0x6')],'destinationcontext':_0x4b6dcf['context'],'callerid':_0x4b6dcf['callerid'],'amaflags':_0x30d4('0x7')}),'log':_0x30d4('0x4')});};exports[_0x30d4('0x8')]=function(){return function(){return client[_0x30d4('0x9')](_0x30d4('0xa'),{'options':{'where':{'type':[_0x30d4('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x30d4('0xc'))[_0x30d4('0xd')](_0x30d4('0xe')),moment()[_0x30d4('0xf')](_0x30d4('0xc'))[_0x30d4('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x30d4('0x10'),_0x30d4('0x11'),_0x30d4('0x12')]},'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 ce0fcc3..82c5d60 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 _0x9f41=['CreateVoiceDialReport','create','Request'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9f41,0xa6));var _0x19f4=function(_0xf94131,_0x58b63d){_0xf94131=_0xf94131-0x0;var _0xdf5c19=_0x9f41[_0xf94131];return _0xdf5c19;};'use strict';var client=require('../client');exports[_0x19f4('0x0')]=function(_0x180147){return client[_0x19f4('0x1')]('CreateVoiceDialReport',{'body':_0x180147,'log':_0x19f4('0x2')});}; \ No newline at end of file +var _0x7c71=['Request','CreateVoiceDialReport'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7c71,0x1c2));var _0x17c7=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x7c71[_0x4ded65];return _0x5864fb;};'use strict';var client=require('../client');exports['create']=function(_0x182705){return client[_0x17c7('0x0')](_0x17c7('0x1'),{'body':_0x182705,'log':_0x17c7('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 9dcf4c0..ad5843f 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 _0xd547=['recordingFormat','Request','GetVoiceExtension','exten'];(function(_0x2919d5,_0x2e050a){var _0x315e94=function(_0x31b33d){while(--_0x31b33d){_0x2919d5['push'](_0x2919d5['shift']());}};_0x315e94(++_0x2e050a);}(_0xd547,0x1c1));var _0x7d54=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0xd547[_0x2adfb1];return _0xa52d45;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x7d54('0x0')](_0x7d54('0x1'),{'options':{'raw':!![],'attributes':['id',_0x7d54('0x2'),_0x7d54('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x2cbd=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x128e15,_0x2f7ffa){var _0x51ea35=function(_0x121aa0){while(--_0x121aa0){_0x128e15['push'](_0x128e15['shift']());}};_0x51ea35(++_0x2f7ffa);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0x2cbd[_0x44ae0b];return _0x69232a;};'use strict';var client=require(_0xd2cb('0x0'));exports[_0xd2cb('0x1')]=function(){return function(){return client['Request'](_0xd2cb('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd2cb('0x3'),_0xd2cb('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 15d0946..2d1bbd9 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 _0xa0c7=['dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','callAdditionalPhoneAfterMin','Trunk','active','mandatoryDispositionPause','callerid','Interval','getVoiceQueues','Request','name','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval'];(function(_0x5c883f,_0x38f092){var _0x4210cc=function(_0x51be71){while(--_0x51be71){_0x5c883f['push'](_0x5c883f['shift']());}};_0x4210cc(++_0x38f092);}(_0xa0c7,0x175));var _0x7a0c=function(_0xf404b2,_0x53a38e){_0xf404b2=_0xf404b2-0x0;var _0x581e88=_0xa0c7[_0xf404b2];return _0x581e88;};'use strict';var client=require('../client');exports[_0x7a0c('0x0')]=function(){return function(){return client[_0x7a0c('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x7a0c('0x2'),'acw','acwTimeout',_0x7a0c('0x3'),_0x7a0c('0x4'),'type',_0x7a0c('0x5'),_0x7a0c('0x6'),_0x7a0c('0x7'),'dialLimitQueue',_0x7a0c('0x8'),_0x7a0c('0x9'),_0x7a0c('0xa'),_0x7a0c('0xb'),_0x7a0c('0xc'),'dialOriginateCallerIdNumber',_0x7a0c('0xd'),_0x7a0c('0xe'),_0x7a0c('0xf'),_0x7a0c('0x10'),'dialCongestionMaxRetry',_0x7a0c('0x11'),_0x7a0c('0x12'),_0x7a0c('0x13'),'dialNoAnswerMaxRetry',_0x7a0c('0x14'),_0x7a0c('0x15'),_0x7a0c('0x16'),'dialGlobalInterval','dialPrefix',_0x7a0c('0x17'),_0x7a0c('0x18'),'dialAMDInitialSilence','dialAMDGreeting',_0x7a0c('0x19'),_0x7a0c('0x1a'),_0x7a0c('0x1b'),_0x7a0c('0x1c'),_0x7a0c('0x1d'),_0x7a0c('0x1e'),_0x7a0c('0x1f'),_0x7a0c('0x20'),_0x7a0c('0x21'),_0x7a0c('0x22'),_0x7a0c('0x23'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x7a0c('0x24'),_0x7a0c('0x4'),'strategy',_0x7a0c('0x25'),_0x7a0c('0x26'),'dialNoSuchNumberMaxRetry',_0x7a0c('0x27'),_0x7a0c('0x28'),'dialDropRetryFrequency',_0x7a0c('0x29'),_0x7a0c('0x2a'),'dialMachineMaxRetry',_0x7a0c('0x2b'),_0x7a0c('0x2c'),_0x7a0c('0x2d'),_0x7a0c('0x2e'),_0x7a0c('0x2f'),'dialPredictiveIntervalMinThreshold',_0x7a0c('0x30'),'dialPreviewRecallmeReminder',_0x7a0c('0x31')],'include':[{'model':_0x7a0c('0x32'),'as':_0x7a0c('0x32'),'attributes':['id',_0x7a0c('0x2'),'callerid',_0x7a0c('0x33')]},{'model':'Pause','as':_0x7a0c('0x34'),'attributes':['id',_0x7a0c('0x2')]},{'model':_0x7a0c('0x32'),'as':'TrunkBackup','attributes':['id',_0x7a0c('0x2'),_0x7a0c('0x35'),'active']},{'model':_0x7a0c('0x36'),'as':_0x7a0c('0x36'),'attributes':['id',_0x7a0c('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x7a0c('0x2'),'interval']}]}]},'log':_0x7a0c('0x0')});};}; \ No newline at end of file +var _0xf97c=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','autopause','monitor_format','type','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject'];(function(_0x7c961a,_0x59dc5e){var _0x293f1e=function(_0x3dc3e9){while(--_0x3dc3e9){_0x7c961a['push'](_0x7c961a['shift']());}};_0x293f1e(++_0x59dc5e);}(_0xf97c,0x1ba));var _0xcf97=function(_0x17ef88,_0x581af4){_0x17ef88=_0x17ef88-0x0;var _0x1dc0fc=_0xf97c[_0x17ef88];return _0x1dc0fc;};'use strict';var client=require(_0xcf97('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xcf97('0x1')](_0xcf97('0x2'),{'options':{'raw':![],'attributes':['id',_0xcf97('0x3'),'acw','acwTimeout',_0xcf97('0x4'),_0xcf97('0x5'),_0xcf97('0x6'),'dialActive','dialMethod','dialLimitChannel','dialLimitQueue',_0xcf97('0x7'),_0xcf97('0x8'),'dialPredictiveOptimizationPercentage',_0xcf97('0x9'),_0xcf97('0xa'),_0xcf97('0xb'),'dialOriginateTimeout','dialQueueOptions',_0xcf97('0xc'),_0xcf97('0xd'),'dialCongestionMaxRetry',_0xcf97('0xe'),_0xcf97('0xf'),_0xcf97('0x10'),_0xcf97('0x11'),_0xcf97('0x12'),_0xcf97('0x13'),'dialTimezone',_0xcf97('0x14'),_0xcf97('0x15'),'dialCheckDuplicateType',_0xcf97('0x16'),_0xcf97('0x17'),_0xcf97('0x18'),'dialAMDAfterGreetingSilence',_0xcf97('0x19'),_0xcf97('0x1a'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xcf97('0x1b'),_0xcf97('0x1c'),_0xcf97('0x1d'),'dialRecallMeTimeout','dialRecallInQueue',_0xcf97('0x1e'),_0xcf97('0x1f'),'dialAgiAfterHangupClient',_0xcf97('0x20'),_0xcf97('0x5'),_0xcf97('0x21'),_0xcf97('0x22'),'dialCutDigit',_0xcf97('0x23'),_0xcf97('0x24'),_0xcf97('0x25'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0xcf97('0x26'),_0xcf97('0x27'),_0xcf97('0x28'),_0xcf97('0x29'),'dialAgentRejectRetryFrequency',_0xcf97('0x2a'),_0xcf97('0x2b'),_0xcf97('0x2c'),_0xcf97('0x2d'),_0xcf97('0x2e'),_0xcf97('0x2f')],'include':[{'model':_0xcf97('0x30'),'as':'Trunk','attributes':['id','name',_0xcf97('0x31'),_0xcf97('0x32')]},{'model':_0xcf97('0x33'),'as':'mandatoryDispositionPause','attributes':['id',_0xcf97('0x3')]},{'model':_0xcf97('0x30'),'as':_0xcf97('0x34'),'attributes':['id',_0xcf97('0x3'),_0xcf97('0x31'),_0xcf97('0x32')]},{'model':_0xcf97('0x35'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0xcf97('0x35'),'as':_0xcf97('0x36'),'attributes':['id','name',_0xcf97('0x37')]}]}]},'log':_0xcf97('0x38')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 79a71ed..2ff1ca0 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(_0x46d66d,_0x5988b2){var _0x5b7028=function(_0x67a1b1){while(--_0x67a1b1){_0x46d66d['push'](_0x46d66d['shift']());}};_0x5b7028(++_0x5988b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x113f11,_0x645cab){var _0xeb10ab=function(_0x499650){while(--_0x499650){_0x113f11['push'](_0x113f11['shift']());}};_0xeb10ab(++_0x645cab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 288103b..b67a9fc 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 _0x47e5=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x2797be,_0x5934f4){var _0x211244=function(_0x230268){while(--_0x230268){_0x2797be['push'](_0x2797be['shift']());}};_0x211244(++_0x5934f4);}(_0x47e5,0x86));var _0x547e=function(_0x358bf3,_0x40ec1f){_0x358bf3=_0x358bf3-0x0;var _0x248106=_0x47e5[_0x358bf3];return _0x248106;};'use strict';var client=require(_0x547e('0x0'));exports[_0x547e('0x1')]=function(_0x308c4e){return function(){return client[_0x547e('0x2')](_0x547e('0x3'),{'options':{'where':{'VoiceQueueId':_0x308c4e,'paused':!![]},'raw':!![]},'log':_0x547e('0x1')});};}; \ No newline at end of file +var _0x7afe=['getVoiceQueueRtPauses','Request','../client'];(function(_0xe8a9b7,_0x530de2){var _0x4b2b03=function(_0x189697){while(--_0x189697){_0xe8a9b7['push'](_0xe8a9b7['shift']());}};_0x4b2b03(++_0x530de2);}(_0x7afe,0x146));var _0xe7af=function(_0x35ff69,_0x478322){_0x35ff69=_0x35ff69-0x0;var _0x7ebcc6=_0x7afe[_0x35ff69];return _0x7ebcc6;};'use strict';var client=require(_0xe7af('0x0'));exports[_0xe7af('0x1')]=function(_0x4e195c){return function(){return client[_0xe7af('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4e195c,'paused':!![]},'raw':!![]},'log':_0xe7af('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 56d856f..644bd04 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(_0x7230f3,_0x4a25fe){var _0x4740ad=function(_0x54734a){while(--_0x54734a){_0x7230f3['push'](_0x7230f3['shift']());}};_0x4740ad(++_0x4a25fe);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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(_0x230022,_0x49dbd8){var _0x2bd678=function(_0x41f241){while(--_0x41f241){_0x230022['push'](_0x230022['shift']());}};_0x2bd678(++_0x49dbd8);}(_0x7a54,0x106));var _0x47a5=function(_0x259936,_0x3b2bb9){_0x259936=_0x259936-0x0;var _0x4567a1=_0x7a54[_0x259936];return _0x4567a1;};'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 1b30215..17ec942 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 _0x5fcd=['transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid','attended','../client','transfers','blindTransfer','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','CreateVoiceTransferReport','Request','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid'];(function(_0x12571a,_0x32a867){var _0x1907cb=function(_0x1e7f40){while(--_0x1e7f40){_0x12571a['push'](_0x12571a['shift']());}};_0x1907cb(++_0x32a867);}(_0x5fcd,0xb1));var _0xd5fc=function(_0x128c6f,_0x1000ca){_0x128c6f=_0x128c6f-0x0;var _0x2210ac=_0x5fcd[_0x128c6f];return _0x2210ac;};'use strict';var client=require(_0xd5fc('0x0'));exports[_0xd5fc('0x1')]={};exports[_0xd5fc('0x2')]=function(_0x18f3b7){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x18f3b7['result'],'transfererchannel':_0x18f3b7['transfererchannel'],'transferercalleridnum':_0x18f3b7[_0xd5fc('0x3')],'transferercalleridname':_0x18f3b7[_0xd5fc('0x4')],'transfererconnectedlinenum':_0x18f3b7[_0xd5fc('0x5')],'transfererconnectedlinename':_0x18f3b7[_0xd5fc('0x6')],'transfereraccountcode':_0x18f3b7[_0xd5fc('0x7')],'transferercontext':_0x18f3b7['transferercontext'],'transfererexten':_0x18f3b7['transfererexten'],'transfererlinkedid':_0x18f3b7[_0xd5fc('0x8')],'transfereechannel':_0x18f3b7[_0xd5fc('0x9')],'transfereecalleridnum':_0x18f3b7['transfereecalleridnum'],'transfereecalleridname':_0x18f3b7[_0xd5fc('0xa')],'transfereeconnectedlinenum':_0x18f3b7[_0xd5fc('0xb')],'transfereeconnectedlinename':_0x18f3b7['transfereeconnectedlinename'],'transfereeaccountcode':_0x18f3b7[_0xd5fc('0xc')],'transfereecontext':_0x18f3b7[_0xd5fc('0xd')],'transfereeexten':_0x18f3b7[_0xd5fc('0xe')],'transfereelinkedid':_0x18f3b7[_0xd5fc('0xf')],'isexternal':_0x18f3b7[_0xd5fc('0x10')],'context':_0x18f3b7[_0xd5fc('0x11')],'extension':_0x18f3b7[_0xd5fc('0x12')],'type':'blind'},'log':_0xd5fc('0x13')});};exports['attendedTransfer']=function(_0x319fae){return client[_0xd5fc('0x14')](_0xd5fc('0x13'),{'body':{'result':_0x319fae[_0xd5fc('0x15')],'transfererchannel':_0x319fae[_0xd5fc('0x16')],'transferercalleridnum':_0x319fae['origtransferercalleridnum'],'transferercalleridname':_0x319fae[_0xd5fc('0x17')],'transfererconnectedlinenum':_0x319fae['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x319fae[_0xd5fc('0x18')],'transfereraccountcode':_0x319fae['origtransfereraccountcode'],'transferercontext':_0x319fae[_0xd5fc('0x19')],'transfererexten':_0x319fae['secondtransfererexten'],'transfererlinkedid':_0x319fae[_0xd5fc('0x1a')],'transfereechannel':_0x319fae[_0xd5fc('0x1b')],'transfereecalleridnum':_0x319fae[_0xd5fc('0x1c')],'transfereecalleridname':_0x319fae[_0xd5fc('0x1d')],'transfereeconnectedlinenum':_0x319fae[_0xd5fc('0x1e')],'transfereeconnectedlinename':_0x319fae['transfertargetconnectedlinename'],'transfereeaccountcode':_0x319fae[_0xd5fc('0x1f')],'transfereecontext':_0x319fae['transfertargetcontext'],'transfereeexten':_0x319fae['transfertargetexten'],'transfereelinkedid':_0x319fae[_0xd5fc('0x20')],'isexternal':_0x319fae[_0xd5fc('0x10')],'context':_0x319fae['origtransferercontext'],'extension':_0x319fae['origtransfererexten'],'type':_0xd5fc('0x21')},'log':_0xd5fc('0x13')});}; \ No newline at end of file +var _0x5242=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5242,0x13d));var _0x2524=function(_0x155a82,_0xcf36dc){_0x155a82=_0x155a82-0x0;var _0x587a3f=_0x5242[_0x155a82];return _0x587a3f;};'use strict';var client=require('../client');exports[_0x2524('0x0')]={};exports[_0x2524('0x1')]=function(_0x27b643){return client[_0x2524('0x2')](_0x2524('0x3'),{'body':{'result':_0x27b643[_0x2524('0x4')],'transfererchannel':_0x27b643[_0x2524('0x5')],'transferercalleridnum':_0x27b643[_0x2524('0x6')],'transferercalleridname':_0x27b643['transferercalleridname'],'transfererconnectedlinenum':_0x27b643['transfererconnectedlinenum'],'transfererconnectedlinename':_0x27b643['transfererconnectedlinename'],'transfereraccountcode':_0x27b643[_0x2524('0x7')],'transferercontext':_0x27b643[_0x2524('0x8')],'transfererexten':_0x27b643[_0x2524('0x9')],'transfererlinkedid':_0x27b643[_0x2524('0xa')],'transfereechannel':_0x27b643[_0x2524('0xb')],'transfereecalleridnum':_0x27b643[_0x2524('0xc')],'transfereecalleridname':_0x27b643[_0x2524('0xd')],'transfereeconnectedlinenum':_0x27b643[_0x2524('0xe')],'transfereeconnectedlinename':_0x27b643[_0x2524('0xf')],'transfereeaccountcode':_0x27b643[_0x2524('0x10')],'transfereecontext':_0x27b643[_0x2524('0x11')],'transfereeexten':_0x27b643['transfereeexten'],'transfereelinkedid':_0x27b643[_0x2524('0x12')],'isexternal':_0x27b643[_0x2524('0x13')],'context':_0x27b643['context'],'extension':_0x27b643['extension'],'type':_0x2524('0x14')},'log':_0x2524('0x3')});};exports[_0x2524('0x15')]=function(_0x2240bc){return client[_0x2524('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x2240bc[_0x2524('0x4')],'transfererchannel':_0x2240bc[_0x2524('0x16')],'transferercalleridnum':_0x2240bc['origtransferercalleridnum'],'transferercalleridname':_0x2240bc[_0x2524('0x17')],'transfererconnectedlinenum':_0x2240bc[_0x2524('0x18')],'transfererconnectedlinename':_0x2240bc[_0x2524('0x19')],'transfereraccountcode':_0x2240bc[_0x2524('0x1a')],'transferercontext':_0x2240bc[_0x2524('0x1b')],'transfererexten':_0x2240bc[_0x2524('0x1c')],'transfererlinkedid':_0x2240bc[_0x2524('0x1d')],'transfereechannel':_0x2240bc[_0x2524('0x1e')],'transfereecalleridnum':_0x2240bc[_0x2524('0x1f')],'transfereecalleridname':_0x2240bc['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2240bc['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2240bc[_0x2524('0x20')],'transfereeaccountcode':_0x2240bc['transfertargetaccountcode'],'transfereecontext':_0x2240bc[_0x2524('0x21')],'transfereeexten':_0x2240bc[_0x2524('0x22')],'transfereelinkedid':_0x2240bc[_0x2524('0x23')],'isexternal':_0x2240bc[_0x2524('0x13')],'context':_0x2240bc['origtransferercontext'],'extension':_0x2240bc[_0x2524('0x24')],'type':_0x2524('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 95c79fe..909b9c0 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 _0x3495=['startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','omit','undefined','values','ami\x20disconnected','voicechannel','length','map','uniqueid','channel','format','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','keys','Action','catch','message','action','Command','then','content','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x3495,0x1de));var _0x5349=function(_0x3801ae,_0x49734e){_0x3801ae=_0x3801ae-0x0;var _0xc68e05=_0x3495[_0x3801ae];return _0xc68e05;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var jayson=require(_0x5349('0x2'));var schema=require(_0x5349('0x3'));var moment=require(_0x5349('0x4'));var config=require(_0x5349('0x5'));var properties=require(_0x5349('0x6'));var ami=require(_0x5349('0x7'));exports[_0x5349('0x8')]=function(_0x5912ac,_0x4034ba,_0x8283b5){return new Promise(function(_0x5ce2cd,_0xcb5a1){var _0x538385={'QueuePause':function(_0x6fb5dc){return new Promise(function(_0x529323){var _0x393873=util['format'](_0x5349('0x9'),_0x5349('0xa'),_0x6fb5dc[_0x5349('0xb')]);if(_0x5912ac[_0x5349('0xc')]&&_0x5912ac[_0x5349('0xc')][_0x393873]&&_0x5912ac[_0x5349('0xc')][_0x393873][_0x5349('0xd')]){_0x5912ac['timers'][_0x393873][_0x5349('0xe')]();}if(_0x5912ac['agents'][_0x393873]){_0x5912ac[_0x5349('0xf')][_0x393873][_0x5349('0x10')]({'statePause':_0x6fb5dc[_0x5349('0x11')]?!![]:![]});}_0x529323({'code':0xc8,'message':_0x5349('0x12')});});},'Reload':function(_0x2f5172){var _0x3c592a=this;return new Promise(function(_0x642966,_0x52c253){if(ami[_0x5349('0x13')]()==![]){return _0x52c253(_0x3c592a[_0x5349('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x5349('0x15')][_0x5349('0x16')],'ami\x20disconnected'][_0x5349('0x17')]('\x20')));}_0x2f5172=_[_0x5349('0x18')](_0x2f5172,_[_0x5349('0x19')](properties['module']));_0x2f5172['action']='Reload';return ami[_0x5349('0x1a')](_0x2f5172)['then'](function(_0x25898f){_0x642966({'code':0xc8,'message':_0x25898f['message']});})[_0x5349('0x1b')](function(_0x2c1f1){_0x52c253(_0x3c592a[_0x5349('0x14')](0x1f5,_0x2c1f1[_0x5349('0x1c')]));});});},'Command':function(_0x4e128c){var _0x22d1ca=this;return new Promise(function(_0x24e74c,_0x8abbe3){if(ami[_0x5349('0x13')]()==![]){return _0x8abbe3(_0x22d1ca['error'](0x1f4,[config[_0x5349('0x15')]['ip'],config[_0x5349('0x15')]['username'],'ami\x20disconnected']['join']('\x20')));}_0x4e128c=_[_0x5349('0x18')](_0x4e128c,'command');_0x4e128c[_0x5349('0x1d')]=_0x5349('0x1e');return ami[_0x5349('0x1a')](_0x4e128c)[_0x5349('0x1f')](function(_0x2dda33){_0x24e74c({'code':0xc8,'message':_0x2dda33[_0x5349('0x20')]});})[_0x5349('0x1b')](function(_0x43a0c2){_0x8abbe3(_0x22d1ca[_0x5349('0x14')](0x1f5,_0x43a0c2[_0x5349('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x1a84ce){var _0x52520=[];for(var _0x57af6c in _0x5912ac[_0x5349('0x21')]){if(_0x5912ac[_0x5349('0x21')][_0x5349('0x22')](_0x57af6c)){var _0x49435a=_0x5912ac[_0x5349('0x21')][_0x57af6c];var _0x5068fa={'id':_0x49435a['id'],'name':_0x49435a[_0x5349('0xb')],'strategy':_0x49435a[_0x5349('0x23')],'answered':_0x49435a[_0x5349('0x24')],'available':_0x49435a['available'],'loggedIn':_0x49435a[_0x5349('0x25')],'pTalking':_0x49435a[_0x5349('0x26')],'sumBillable':_0x49435a[_0x5349('0x27')],'sumDuration':_0x49435a[_0x5349('0x28')],'sumHoldTime':_0x49435a[_0x5349('0x29')]||0x0,'talking':_0x49435a[_0x5349('0x2a')],'total':_0x49435a[_0x5349('0x2b')],'type':_0x49435a[_0x5349('0x2c')],'unmanaged':_0x49435a[_0x5349('0x2d')],'abandoned':_0x49435a['abandoned'],'waiting':_0x49435a[_0x5349('0x2e')],'loggedInDb':_0x49435a[_0x5349('0x2f')]};if(_0x49435a['type']===_0x5349('0x30')){_0x5068fa['dialActive']=_0x49435a[_0x5349('0x31')];_0x5068fa[_0x5349('0x32')]=_0x49435a[_0x5349('0x32')];_0x5068fa[_0x5349('0x33')]=_0x49435a[_0x5349('0x33')];_0x5068fa[_0x5349('0x34')]=_0x49435a['dialOriginateCallerIdNumber'];_0x5068fa[_0x5349('0x35')]=_0x49435a[_0x5349('0x35')];_0x5068fa[_0x5349('0x36')]=_0x49435a[_0x5349('0x36')];_0x5068fa['temp']=_0x49435a['temp'];_0x5068fa[_0x5349('0x37')]=_0x49435a[_0x5349('0x37')];_0x5068fa[_0x5349('0x38')]=_0x49435a['outboundAnswerCallsDay'];_0x5068fa[_0x5349('0x39')]=_0x49435a['outboundBlacklistCallsDay'];_0x5068fa[_0x5349('0x3a')]=_0x49435a[_0x5349('0x3a')];_0x5068fa[_0x5349('0x3b')]=_0x49435a[_0x5349('0x3b')];_0x5068fa[_0x5349('0x3c')]=_0x49435a[_0x5349('0x3c')];_0x5068fa['outboundDropCallsDayCallersExit']=_0x49435a['outboundDropCallsDayCallersExit'];_0x5068fa[_0x5349('0x3d')]=_0x49435a[_0x5349('0x3d')];_0x5068fa[_0x5349('0x3e')]=_0x49435a[_0x5349('0x3e')];_0x5068fa[_0x5349('0x3f')]=_0x49435a[_0x5349('0x3f')];_0x5068fa[_0x5349('0x40')]=_0x49435a['outboundOriginateFailureCallsDay'];_0x5068fa['outboundReCallsDay']=_0x49435a[_0x5349('0x41')];_0x5068fa['outboundRejectCallsDay']=_0x49435a['outboundRejectCallsDay'];_0x5068fa[_0x5349('0x42')]=_0x49435a['outboundUnknownCallsDay'];_0x5068fa[_0x5349('0x43')]=_0x49435a[_0x5349('0x43')];_0x5068fa[_0x5349('0x44')]=_0x49435a['predictiveIntervalAvgHoldtime'];_0x5068fa[_0x5349('0x45')]=_0x49435a['predictiveIntervalAvgTalktime'];_0x5068fa[_0x5349('0x46')]=_0x49435a[_0x5349('0x46')];_0x5068fa[_0x5349('0x47')]=_0x49435a['predictiveIntervalDroppedCallsTimeout'];_0x5068fa['predictiveIntervalErlangCalls']=_0x49435a['predictiveIntervalErlangCalls'];_0x5068fa[_0x5349('0x48')]=_0x49435a[_0x5349('0x48')];_0x5068fa[_0x5349('0x49')]=_0x49435a[_0x5349('0x49')];_0x5068fa[_0x5349('0x4a')]=_0x49435a[_0x5349('0x4a')];_0x5068fa['predictiveIntervalPauses']=_0x49435a['predictiveIntervalPauses'];_0x5068fa[_0x5349('0x4b')]=_0x49435a[_0x5349('0x4b')];_0x5068fa[_0x5349('0x4c')]=_0x49435a['predictiveIntervalTotalCalls'];_0x5068fa[_0x5349('0x1c')]=_0x49435a[_0x5349('0x1c')];_0x5068fa[_0x5349('0x4d')]=_0x49435a[_0x5349('0x4d')];_0x5068fa['erlangCalls']=_0x49435a[_0x5349('0x4e')];_0x5068fa['erlangCallToSecond']=_0x49435a[_0x5349('0x4f')];_0x5068fa[_0x5349('0x50')]=_0x49435a['erlangAbandonmentRate'];_0x5068fa[_0x5349('0x51')]=_0x49435a[_0x5349('0x51')];_0x5068fa[_0x5349('0x52')]=_0x49435a[_0x5349('0x52')];_0x5068fa[_0x5349('0x53')]=_0x49435a[_0x5349('0x53')];}if(_0x49435a[_0x5349('0x54')]){_0x5068fa['Trunk']={'id':_0x49435a['Trunk']['id'],'name':_0x49435a[_0x5349('0x54')][_0x5349('0xb')],'active':_0x49435a[_0x5349('0x54')][_0x5349('0x55')],'callerid':_0x49435a['Trunk'][_0x5349('0x56')]};}if(_0x49435a['Interval']){_0x5068fa['Interval']={'id':_0x49435a[_0x5349('0x57')]['id'],'name':_0x49435a[_0x5349('0x57')][_0x5349('0xb')]};}_0x52520[_0x5349('0x58')](_0x5068fa);}}_0x1a84ce({'count':_0x52520['length'],'rows':_0x52520});});},'UpdateVoiceQueue':function(_0x34f3f4){return new Promise(function(_0x3f1be1,_0x24194f){var _0x36600b=_[_0x5349('0x59')](_0x5912ac[_0x5349('0x21')],{'id':parseInt(_0x34f3f4['id'])});var _0x2c42ee=_[_0x5349('0x5a')](_0x34f3f4,['id']);if(_0x36600b){for(var _0x33ade9 in _0x2c42ee){if(typeof _0x2c42ee[_0x33ade9]!==_0x5349('0x5b')&&typeof _0x36600b[_0x33ade9]!==_0x5349('0x5b')){_0x36600b[_0x33ade9]=_0x2c42ee[_0x33ade9];}}_0x3f1be1(_0x36600b);}else{_0x24194f();}});},'VoiceChannels':function(){return new Promise(function(_0x2ec89b){var _0x1e683=_[_0x5349('0x5c')](_0x5912ac['channels']);_0x2ec89b({'count':_0x1e683['length'],'rows':_0x1e683});});},'VoiceChannelMixMonitor':function(_0x11d862){var _0x2931af=this;return new Promise(function(_0x37b370,_0x366634){if(ami[_0x5349('0x13')]()==![]){return _0x366634(_0x2931af[_0x5349('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x5349('0x15')][_0x5349('0x16')],_0x5349('0x5d')][_0x5349('0x17')]('\x20')));}var _0x26d06a=schema(properties[_0x5349('0x5e')])['validate'](_0x11d862);if(_0x26d06a[_0x5349('0x5f')]>0x0){return _0x366634(_0x2931af['error'](0x1f4,_[_0x5349('0x60')](_0x26d06a,_0x5349('0x1c'))[_0x5349('0x17')](',\x20')));}var _0x3f4db2=_[_0x5349('0x59')](_0x5912ac['channels'],{'uniqueid':_0x11d862[_0x5349('0x61')]});if(_0x3f4db2&&_0x3f4db2[_0x5349('0x62')]){var _0x3891af=util[_0x5349('0x63')]('%s.%s',_0x11d862[_0x5349('0x64')]||_0x11d862[_0x5349('0x61')],_0x11d862[_0x5349('0x63')]||_0x5349('0x65'));return ami[_0x5349('0x1a')]({'action':_0x5349('0x66'),'channel':_0x3f4db2[_0x5349('0x62')],'file':_0x3891af,'options':_0x5349('0x67')})[_0x5349('0x1f')](function(_0x264763){var _0x477782=_[_0x5349('0x59')](_0x3f4db2[_0x5349('0x68')],{'filename':_0x5349('0x69')+_0x3891af[_0x5349('0x6a')]()});if(_[_0x5349('0x6b')](_0x477782)){_0x3f4db2[_0x5349('0x68')][_0x5349('0x58')]({'filename':'/var/spool/asterisk/monitor/'+_0x3891af[_0x5349('0x6a')](),'createdAt':moment()[_0x5349('0x63')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x264763['mixmonitorid'],'status':_0x5349('0x6c')});}else{_0x477782[_0x5349('0x6d')]=_0x264763[_0x5349('0x6d')];_0x477782[_0x5349('0x6e')]=_0x5349('0x6c');}_0x37b370({'code':0xc8,'message':[_0x11d862[_0x5349('0x61')],_0x5349('0x6f'),_0x264763['mixmonitorid']][_0x5349('0x17')]('\x20'),'mixmonitorid':_0x264763[_0x5349('0x6d')]});})[_0x5349('0x1b')](function(_0x590fc8){_0x366634(_0x2931af['error'](0x1f5,[_0x11d862[_0x5349('0x61')],_0x590fc8[_0x5349('0x1c')][_0x5349('0x6a')]()][_0x5349('0x17')]('\x20')));});}else{return _0x366634(_0x2931af[_0x5349('0x14')](0x1f5,_0x5349('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0xe4b289){var _0x1729fe=this;return new Promise(function(_0x494c5f,_0x2425fd){if(ami['isConnected']()==![]){return _0x2425fd(_0x1729fe[_0x5349('0x14')](0x1f4,[config[_0x5349('0x15')]['ip'],config[_0x5349('0x15')][_0x5349('0x16')],'ami\x20disconnected']['join']('\x20')));}var _0x4c8e70=schema(properties[_0x5349('0x5e')])['validate'](_0xe4b289);if(_0x4c8e70[_0x5349('0x5f')]>0x0){return _0x2425fd(_0x1729fe[_0x5349('0x14')](0x1f4,_[_0x5349('0x60')](_0x4c8e70,_0x5349('0x1c'))[_0x5349('0x17')](',\x20')));}var _0x20f789=_['find'](_0x5912ac[_0x5349('0x71')],{'uniqueid':_0xe4b289[_0x5349('0x61')]});if(_0x20f789){return Promise[_0x5349('0x72')]()[_0x5349('0x1f')](function(){if(_0x20f789[_0x5349('0x62')]){return ami['Action']({'action':_0x5349('0x73'),'channel':_0x20f789['channel'],'mixmonitorid':_0xe4b289[_0x5349('0x6d')]})['catch'](function(){});}})['then'](function(){if(_0x20f789[_0x5349('0x74')]){return ami[_0x5349('0x1a')]({'action':_0x5349('0x73'),'channel':_0x20f789[_0x5349('0x74')],'mixmonitorid':_0xe4b289[_0x5349('0x6d')]})[_0x5349('0x1b')](function(){});}})[_0x5349('0x1f')](function(){var _0x15f347=_['find'](_0x20f789[_0x5349('0x68')],{'mixmonitorid':_0xe4b289[_0x5349('0x6d')]});if(_0x15f347){_0x15f347[_0x5349('0x6e')]=_0x5349('0x75');}})[_0x5349('0x1f')](function(){var _0x5c9efe=util[_0x5349('0x63')]('%s.%s',_0xe4b289[_0x5349('0x64')]||_0xe4b289[_0x5349('0x61')],_0xe4b289[_0x5349('0x63')]||'wav');var _0x9a5857=_['find'](_0x20f789[_0x5349('0x68')],{'filename':'/var/spool/asterisk/monitor/'+_0x5c9efe['toLowerCase']()});if(_0x9a5857){_0x9a5857[_0x5349('0x6e')]=_0x5349('0x75');}})['then'](function(){_0x494c5f({'code':0xc8,'message':[_0xe4b289[_0x5349('0x61')],_0x5349('0x76')][_0x5349('0x17')]('\x20')});})['catch'](function(_0x16ddc5){_0x2425fd(_0x1729fe[_0x5349('0x14')](0x1f5,[_0xe4b289['uniqueid'],_0x16ddc5['message'][_0x5349('0x6a')]()]['join']('\x20')));});}else{return _0x2425fd(_0x1729fe['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x5158a9){var _0xffe718=_[_0x5349('0x5c')](_0x5912ac['queueChannels']);_0x5158a9({'count':_0xffe718[_0x5349('0x5f')],'rows':_0xffe718});});},'VoiceQueuesChannel':function(_0xd9b996){var _0x27271e=this;return new Promise(function(_0x5812b0,_0x5239da){var _0x674054=schema(properties[_0x5349('0x77')])[_0x5349('0x3')](_0xd9b996);if(_0x674054[_0x5349('0x5f')]>0x0){return _0x5239da(_0x27271e[_0x5349('0x14')](0x1f4,_[_0x5349('0x60')](_0x674054,_0x5349('0x1c'))[_0x5349('0x17')](',\x20')));}var _0x25b07f=_[_0x5349('0x59')](_0x5912ac[_0x5349('0x78')],{'uniqueid':_0xd9b996[_0x5349('0x61')]});if(_0x25b07f){_0x5812b0(_0x25b07f);}else{return _0x5239da(_0x27271e[_0x5349('0x14')](0x1f5,_0x5349('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x12f4fe){var _0x20706b=this;return new Promise(function(_0x29e4a3,_0x47a9b0){if(ami['isConnected']()==![]){return _0x47a9b0(_0x20706b[_0x5349('0x14')](0x1f4,[config[_0x5349('0x15')]['ip'],config['asterisk'][_0x5349('0x16')],_0x5349('0x5d')][_0x5349('0x17')]('\x20')));}var _0x501ce3=schema(properties['voicequeuechannelhangup'])['validate'](_0x12f4fe);if(_0x501ce3[_0x5349('0x5f')]>0x0){return _0x47a9b0(_0x20706b['error'](0x1f4,_[_0x5349('0x60')](_0x501ce3,_0x5349('0x1c'))[_0x5349('0x17')](',\x20')));}var _0x3273be=_[_0x5349('0x59')](_0x5912ac[_0x5349('0x78')],{'uniqueid':_0x12f4fe[_0x5349('0x61')]});if(_0x3273be&&_0x3273be['channel']){return ami[_0x5349('0x1a')]({'action':'Hangup','channel':_0x3273be[_0x5349('0x62')]})[_0x5349('0x1f')](function(_0x30cf63){_0x29e4a3({'code':0xc8,'message':[_0x12f4fe[_0x5349('0x61')],_0x30cf63[_0x5349('0x1c')][_0x5349('0x6a')]()][_0x5349('0x17')]('\x20')});})[_0x5349('0x1b')](function(_0x5a58e1){_0x47a9b0(_0x20706b['error'](0x1f5,[_0x12f4fe[_0x5349('0x61')],_0x5a58e1['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x47a9b0(_0x20706b[_0x5349('0x14')](0x1f5,_0x5349('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x30c1c6){var _0x34256e=this;return new Promise(function(_0xd2846c,_0xbe6d32){if(ami[_0x5349('0x13')]()==![]){return _0xbe6d32(_0x34256e[_0x5349('0x14')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x5349('0x16')],_0x5349('0x5d')]['join']('\x20')));}var _0x34bc2c=schema(properties[_0x5349('0x79')])[_0x5349('0x3')](_0x30c1c6);if(_0x34bc2c[_0x5349('0x5f')]>0x0){return _0xbe6d32(_0x34256e[_0x5349('0x14')](0x1f4,_[_0x5349('0x60')](_0x34bc2c,'message')[_0x5349('0x17')](',\x20')));}var _0x5e39ff=_[_0x5349('0x59')](_0x5912ac[_0x5349('0x78')],{'uniqueid':_0x30c1c6[_0x5349('0x61')]});if(_0x5e39ff&&_0x5e39ff[_0x5349('0x62')]){return ami[_0x5349('0x1a')]({'action':_0x5349('0x7a'),'channel':_0x5e39ff[_0x5349('0x62')],'exten':_0x30c1c6['exten'],'context':_0x30c1c6[_0x5349('0x7b')]||_0x5e39ff[_0x5349('0x7b')],'priority':0x1})[_0x5349('0x1f')](function(_0x4ae3c2){_0xd2846c({'code':0xc8,'message':[_0x30c1c6[_0x5349('0x61')],_0x4ae3c2[_0x5349('0x1c')][_0x5349('0x6a')]()]['join']('\x20')});})[_0x5349('0x1b')](function(_0x3915b8){_0xbe6d32(_0x34256e[_0x5349('0x14')](0x1f5,[_0x30c1c6[_0x5349('0x61')],_0x3915b8[_0x5349('0x1c')][_0x5349('0x6a')]()][_0x5349('0x17')]('\x20')));});}else{return _0xbe6d32(_0x34256e[_0x5349('0x14')](0x1f5,_0x5349('0x70')));}});},'Agents':function(_0x95a657){return new Promise(function(_0x407f81){var _0x453377=_[_0x5349('0x5c')](_0x5912ac[_0x5349('0xf')]);if(_0x95a657&&_0x95a657['id']){var _0x51d6f3=_[_0x5349('0x59')](_0x453377,function(_0x1e3d66){return _0x1e3d66['id']===_0x95a657['id'];});_0x407f81(_0x51d6f3);}else{_0x407f81({'count':_0x453377[_0x5349('0x5f')],'rows':_0x453377});}});},'Telephones':function(){return new Promise(function(_0x480856){var _0x534094=_['values'](_0x5912ac[_0x5349('0x7c')]);_0x480856({'count':_0x534094[_0x5349('0x5f')],'rows':_0x534094});});},'Trunks':function(){return new Promise(function(_0x59b15f){var _0x4eb212=_[_0x5349('0x5c')](_0x5912ac[_0x5349('0x7d')]);_0x59b15f({'count':_0x4eb212[_0x5349('0x5f')],'rows':_0x4eb212});});},'OutboundChannels':function(){return new Promise(function(_0x8dc58b){var _0x19f0c0=_[_0x5349('0x5c')](_0x5912ac[_0x5349('0x7e')]);_0x8dc58b({'count':_0x19f0c0[_0x5349('0x5f')],'rows':_0x19f0c0});});},'Outbound':function(){return new Promise(function(_0x53bdba){_0x53bdba(_0x5912ac['outbound']);});},'Campaigns':function(){return new Promise(function(_0x45939b){var _0x455c40=_[_0x5349('0x5c')](_0x5912ac[_0x5349('0x7f')]);_0x45939b({'count':_0x455c40[_0x5349('0x5f')],'rows':_0x455c40});});},'VoiceQueuesPreview':function(_0x44b40e){var _0x4c557d=this;return new Promise(function(_0x3d3193,_0x2715cb){_0x4034ba[_0x5349('0x80')](_0x44b40e['id'])['then'](function(_0x292032){_0x3d3193({'code':0xc8,'message':_0x292032[_0x5349('0x1c')]});})[_0x5349('0x1b')](function(_0x4b5655){_0x2715cb(_0x4c557d['error'](0x1f4,_0x4b5655[_0x5349('0x1c')]));});});},'EventManager':function(_0x280559){var _0x12b7ef=this;return new Promise(function(_0x3ae84c,_0x20d431){if(!_0x280559[_0x5349('0x81')]){return _0x20d431(_0x12b7ef['error'](0x1f4,_0x5349('0x82')));}ami['emit'](_0x5349('0x83')+_0x280559[_0x5349('0x81')],_0x280559['message']);_0x3ae84c({'code':0xc8,'message':_0x280559});});},'FaxAccounts':function(){return new Promise(function(_0x4ba597){var _0x1bc421=_[_0x5349('0x5c')](_0x5912ac[_0x5349('0x84')]);_0x4ba597({'count':_0x1bc421['length'],'rows':_0x1bc421});});},'SendFax':function(_0x472b94){var _0x47d22a=this;return new Promise(function(_0x2e9c08,_0xda7ea6){_0x8283b5[_0x5349('0x85')](_0x472b94)['then'](function(_0x425359){_0x2e9c08({'code':0xc8,'message':_0x425359[_0x5349('0x1c')]});})['catch'](function(_0x8a0a4a){_0xda7ea6(_0x47d22a['error'](0x1f4,_0x8a0a4a[_0x5349('0x1c')]));});});},'CheckAfterSend':function(_0x1c3a52){var _0x43f443=this;return new Promise(function(_0x5d000d,_0x3b3f61){_0x8283b5[_0x5349('0x86')](_0x1c3a52)[_0x5349('0x1f')](function(_0x315223){_0x5d000d({'code':0xc8,'message':_0x315223[_0x5349('0x1c')]});})[_0x5349('0x1b')](function(_0x3af9e4){_0x3b3f61(_0x43f443[_0x5349('0x14')](0x1f4,_0x3af9e4[_0x5349('0x1c')]));});});}};var _0x5e4a78=jayson[_0x5349('0x87')](_0x538385)[_0x5349('0x88')]();_0x5e4a78['on'](_0x5349('0x14'),function(_0x5ebddd){return _0xcb5a1(_0x5ebddd);});_0x5e4a78[_0x5349('0x8')](0x232a,'127.0.0.1',function(){console[_0x5349('0x89')](_0x5349('0x8a'),0x232a);return _0x5ce2cd(_0x5349('0x8b')+0x232a);});});}; \ No newline at end of file +var _0x97c1=['dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','channel','format','%s.%s','filename','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','destinationchannel','StopMixMonitor','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','log','RPC\x20listening\x20on\x20port:','lodash','util','validate','../properties','../ami','listen','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','keys','module','action','Reload','Action','then','message','join','pick','command','Command','content','catch','voiceQueues','hasOwnProperty','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97c1,0xdf));var _0x197c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var jayson=require('jayson/promise');var schema=require(_0x197c('0x2'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x197c('0x3'));var ami=require(_0x197c('0x4'));exports[_0x197c('0x5')]=function(_0x37ac05,_0x40863c,_0x4a6f09){return new Promise(function(_0x5cbff6,_0x1cb6e1){var _0x437214={'QueuePause':function(_0x60fab2){return new Promise(function(_0xfcee35){var _0x5cf5cb=util['format'](_0x197c('0x6'),'SIP',_0x60fab2[_0x197c('0x7')]);if(_0x37ac05[_0x197c('0x8')]&&_0x37ac05[_0x197c('0x8')][_0x5cf5cb]&&_0x37ac05[_0x197c('0x8')][_0x5cf5cb]['timer']){_0x37ac05[_0x197c('0x8')][_0x5cf5cb][_0x197c('0x9')]();}if(_0x37ac05[_0x197c('0xa')][_0x5cf5cb]){_0x37ac05[_0x197c('0xa')][_0x5cf5cb][_0x197c('0xb')]({'statePause':_0x60fab2['pause']?!![]:![]});}_0xfcee35({'code':0xc8,'message':_0x197c('0xc')});});},'Reload':function(_0x668f8){var _0x27e46f=this;return new Promise(function(_0x1adcfa,_0x567658){if(ami[_0x197c('0xd')]()==![]){return _0x567658(_0x27e46f[_0x197c('0xe')](0x1f4,[config[_0x197c('0xf')]['ip'],config[_0x197c('0xf')][_0x197c('0x10')],_0x197c('0x11')]['join']('\x20')));}_0x668f8=_['pick'](_0x668f8,_[_0x197c('0x12')](properties[_0x197c('0x13')]));_0x668f8[_0x197c('0x14')]=_0x197c('0x15');return ami[_0x197c('0x16')](_0x668f8)[_0x197c('0x17')](function(_0x437050){_0x1adcfa({'code':0xc8,'message':_0x437050[_0x197c('0x18')]});})['catch'](function(_0x372311){_0x567658(_0x27e46f['error'](0x1f5,_0x372311['message']));});});},'Command':function(_0x1725d9){var _0x226756=this;return new Promise(function(_0x2eca5e,_0x2ce10d){if(ami['isConnected']()==![]){return _0x2ce10d(_0x226756[_0x197c('0xe')](0x1f4,[config[_0x197c('0xf')]['ip'],config[_0x197c('0xf')]['username'],_0x197c('0x11')][_0x197c('0x19')]('\x20')));}_0x1725d9=_[_0x197c('0x1a')](_0x1725d9,_0x197c('0x1b'));_0x1725d9[_0x197c('0x14')]=_0x197c('0x1c');return ami[_0x197c('0x16')](_0x1725d9)[_0x197c('0x17')](function(_0x8963fd){_0x2eca5e({'code':0xc8,'message':_0x8963fd[_0x197c('0x1d')]});})[_0x197c('0x1e')](function(_0x177bc9){_0x2ce10d(_0x226756[_0x197c('0xe')](0x1f5,_0x177bc9[_0x197c('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x37b040){var _0x25486a=[];for(var _0x5f4a02 in _0x37ac05[_0x197c('0x1f')]){if(_0x37ac05[_0x197c('0x1f')][_0x197c('0x20')](_0x5f4a02)){var _0x499051=_0x37ac05[_0x197c('0x1f')][_0x5f4a02];var _0x3331ac={'id':_0x499051['id'],'name':_0x499051['name'],'strategy':_0x499051['strategy'],'answered':_0x499051[_0x197c('0x21')],'available':_0x499051['available'],'loggedIn':_0x499051[_0x197c('0x22')],'pTalking':_0x499051[_0x197c('0x23')],'sumBillable':_0x499051[_0x197c('0x24')],'sumDuration':_0x499051[_0x197c('0x25')],'sumHoldTime':_0x499051[_0x197c('0x26')]||0x0,'talking':_0x499051[_0x197c('0x27')],'total':_0x499051[_0x197c('0x28')],'type':_0x499051[_0x197c('0x29')],'unmanaged':_0x499051[_0x197c('0x2a')],'abandoned':_0x499051['abandoned'],'waiting':_0x499051['waiting'],'loggedInDb':_0x499051['loggedInDb']};if(_0x499051['type']===_0x197c('0x2b')){_0x3331ac['dialActive']=_0x499051[_0x197c('0x2c')];_0x3331ac[_0x197c('0x2d')]=_0x499051['dialMethod'];_0x3331ac[_0x197c('0x2e')]=_0x499051['dialOriginateCallerIdName'];_0x3331ac[_0x197c('0x2f')]=_0x499051[_0x197c('0x2f')];_0x3331ac[_0x197c('0x30')]=_0x499051[_0x197c('0x30')];_0x3331ac[_0x197c('0x31')]=_0x499051[_0x197c('0x31')];_0x3331ac[_0x197c('0x32')]=_0x499051[_0x197c('0x32')];_0x3331ac[_0x197c('0x33')]=_0x499051['outboundAnswerAgiCallsDay'];_0x3331ac['outboundAnswerCallsDay']=_0x499051[_0x197c('0x34')];_0x3331ac[_0x197c('0x35')]=_0x499051[_0x197c('0x35')];_0x3331ac[_0x197c('0x36')]=_0x499051[_0x197c('0x36')];_0x3331ac[_0x197c('0x37')]=_0x499051[_0x197c('0x37')];_0x3331ac['outboundDropCallsDayACS']=_0x499051['outboundDropCallsDayACS'];_0x3331ac[_0x197c('0x38')]=_0x499051[_0x197c('0x38')];_0x3331ac['outboundDropCallsDayTimeout']=_0x499051['outboundDropCallsDayTimeout'];_0x3331ac[_0x197c('0x39')]=_0x499051[_0x197c('0x39')];_0x3331ac[_0x197c('0x3a')]=_0x499051[_0x197c('0x3a')];_0x3331ac[_0x197c('0x3b')]=_0x499051[_0x197c('0x3b')];_0x3331ac[_0x197c('0x3c')]=_0x499051[_0x197c('0x3c')];_0x3331ac[_0x197c('0x3d')]=_0x499051['outboundRejectCallsDay'];_0x3331ac[_0x197c('0x3e')]=_0x499051[_0x197c('0x3e')];_0x3331ac[_0x197c('0x3f')]=_0x499051[_0x197c('0x3f')];_0x3331ac[_0x197c('0x40')]=_0x499051[_0x197c('0x40')];_0x3331ac['predictiveIntervalAvgTalktime']=_0x499051[_0x197c('0x41')];_0x3331ac[_0x197c('0x42')]=_0x499051[_0x197c('0x42')];_0x3331ac['predictiveIntervalDroppedCallsTimeout']=_0x499051[_0x197c('0x43')];_0x3331ac[_0x197c('0x44')]=_0x499051[_0x197c('0x44')];_0x3331ac[_0x197c('0x45')]=_0x499051[_0x197c('0x45')];_0x3331ac[_0x197c('0x46')]=_0x499051[_0x197c('0x46')];_0x3331ac[_0x197c('0x47')]=_0x499051[_0x197c('0x47')];_0x3331ac[_0x197c('0x48')]=_0x499051['predictiveIntervalPauses'];_0x3331ac[_0x197c('0x49')]=_0x499051[_0x197c('0x49')];_0x3331ac['predictiveIntervalTotalCalls']=_0x499051['predictiveIntervalTotalCalls'];_0x3331ac[_0x197c('0x18')]=_0x499051[_0x197c('0x18')];_0x3331ac[_0x197c('0x4a')]=_0x499051[_0x197c('0x4a')];_0x3331ac[_0x197c('0x4b')]=_0x499051['erlangCalls'];_0x3331ac[_0x197c('0x4c')]=_0x499051[_0x197c('0x4c')];_0x3331ac[_0x197c('0x4d')]=_0x499051[_0x197c('0x4d')];_0x3331ac[_0x197c('0x4e')]=_0x499051['erlangBusyFactor'];_0x3331ac[_0x197c('0x4f')]=_0x499051[_0x197c('0x4f')];_0x3331ac[_0x197c('0x50')]=_0x499051[_0x197c('0x50')];}if(_0x499051[_0x197c('0x51')]){_0x3331ac['Trunk']={'id':_0x499051[_0x197c('0x51')]['id'],'name':_0x499051[_0x197c('0x51')][_0x197c('0x7')],'active':_0x499051[_0x197c('0x51')][_0x197c('0x52')],'callerid':_0x499051[_0x197c('0x51')][_0x197c('0x53')]};}if(_0x499051[_0x197c('0x54')]){_0x3331ac[_0x197c('0x54')]={'id':_0x499051[_0x197c('0x54')]['id'],'name':_0x499051[_0x197c('0x54')]['name']};}_0x25486a['push'](_0x3331ac);}}_0x37b040({'count':_0x25486a['length'],'rows':_0x25486a});});},'UpdateVoiceQueue':function(_0x54d9d5){return new Promise(function(_0x256501,_0x34271f){var _0x5ea915=_[_0x197c('0x55')](_0x37ac05[_0x197c('0x1f')],{'id':parseInt(_0x54d9d5['id'])});var _0x538449=_[_0x197c('0x56')](_0x54d9d5,['id']);if(_0x5ea915){for(var _0x106f24 in _0x538449){if(typeof _0x538449[_0x106f24]!=='undefined'&&typeof _0x5ea915[_0x106f24]!==_0x197c('0x57')){_0x5ea915[_0x106f24]=_0x538449[_0x106f24];}}_0x256501(_0x5ea915);}else{_0x34271f();}});},'VoiceChannels':function(){return new Promise(function(_0x233ae1){var _0x47e652=_[_0x197c('0x58')](_0x37ac05[_0x197c('0x59')]);_0x233ae1({'count':_0x47e652[_0x197c('0x5a')],'rows':_0x47e652});});},'VoiceChannelMixMonitor':function(_0x5b4e52){var _0x3b36e5=this;return new Promise(function(_0x3f26df,_0x220909){if(ami[_0x197c('0xd')]()==![]){return _0x220909(_0x3b36e5['error'](0x1f4,[config[_0x197c('0xf')]['ip'],config[_0x197c('0xf')][_0x197c('0x10')],'ami\x20disconnected']['join']('\x20')));}var _0x3a5089=schema(properties[_0x197c('0x5b')])[_0x197c('0x2')](_0x5b4e52);if(_0x3a5089[_0x197c('0x5a')]>0x0){return _0x220909(_0x3b36e5[_0x197c('0xe')](0x1f4,_[_0x197c('0x5c')](_0x3a5089,'message')[_0x197c('0x19')](',\x20')));}var _0x5cd670=_[_0x197c('0x55')](_0x37ac05[_0x197c('0x59')],{'uniqueid':_0x5b4e52[_0x197c('0x5d')]});if(_0x5cd670&&_0x5cd670[_0x197c('0x5e')]){var _0x34a211=util[_0x197c('0x5f')](_0x197c('0x60'),_0x5b4e52[_0x197c('0x61')]||_0x5b4e52['uniqueid'],_0x5b4e52[_0x197c('0x5f')]||_0x197c('0x62'));return ami[_0x197c('0x16')]({'action':'MixMonitor','channel':_0x5cd670[_0x197c('0x5e')],'file':_0x34a211,'options':'ai(mixmonitorid)'})[_0x197c('0x17')](function(_0x1d2a5f){var _0x1ec51a=_[_0x197c('0x55')](_0x5cd670[_0x197c('0x63')],{'filename':_0x197c('0x64')+_0x34a211[_0x197c('0x65')]()});if(_[_0x197c('0x66')](_0x1ec51a)){_0x5cd670['monitors'][_0x197c('0x67')]({'filename':_0x197c('0x64')+_0x34a211[_0x197c('0x65')](),'createdAt':moment()['format'](_0x197c('0x68')),'mixmonitorid':_0x1d2a5f[_0x197c('0x69')],'status':_0x197c('0x6a')});}else{_0x1ec51a[_0x197c('0x69')]=_0x1d2a5f[_0x197c('0x69')];_0x1ec51a['status']='rec';}_0x3f26df({'code':0xc8,'message':[_0x5b4e52[_0x197c('0x5d')],_0x197c('0x6b'),_0x1d2a5f[_0x197c('0x69')]][_0x197c('0x19')]('\x20'),'mixmonitorid':_0x1d2a5f[_0x197c('0x69')]});})['catch'](function(_0x5c2c1c){_0x220909(_0x3b36e5[_0x197c('0xe')](0x1f5,[_0x5b4e52[_0x197c('0x5d')],_0x5c2c1c['message'][_0x197c('0x65')]()][_0x197c('0x19')]('\x20')));});}else{return _0x220909(_0x3b36e5[_0x197c('0xe')](0x1f5,_0x197c('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0xc10419){var _0x35d83a=this;return new Promise(function(_0x4e8c5b,_0x431100){if(ami[_0x197c('0xd')]()==![]){return _0x431100(_0x35d83a['error'](0x1f4,[config['asterisk']['ip'],config[_0x197c('0xf')]['username'],_0x197c('0x11')][_0x197c('0x19')]('\x20')));}var _0x382602=schema(properties['voicechannel'])[_0x197c('0x2')](_0xc10419);if(_0x382602[_0x197c('0x5a')]>0x0){return _0x431100(_0x35d83a['error'](0x1f4,_[_0x197c('0x5c')](_0x382602,_0x197c('0x18'))[_0x197c('0x19')](',\x20')));}var _0x5ebd0b=_[_0x197c('0x55')](_0x37ac05[_0x197c('0x59')],{'uniqueid':_0xc10419['uniqueid']});if(_0x5ebd0b){return Promise['resolve']()[_0x197c('0x17')](function(){if(_0x5ebd0b[_0x197c('0x5e')]){return ami[_0x197c('0x16')]({'action':'StopMixMonitor','channel':_0x5ebd0b[_0x197c('0x5e')],'mixmonitorid':_0xc10419[_0x197c('0x69')]})[_0x197c('0x1e')](function(){});}})['then'](function(){if(_0x5ebd0b[_0x197c('0x6d')]){return ami[_0x197c('0x16')]({'action':_0x197c('0x6e'),'channel':_0x5ebd0b[_0x197c('0x6d')],'mixmonitorid':_0xc10419[_0x197c('0x69')]})[_0x197c('0x1e')](function(){});}})[_0x197c('0x17')](function(){var _0xaf09a=_[_0x197c('0x55')](_0x5ebd0b[_0x197c('0x63')],{'mixmonitorid':_0xc10419['mixmonitorid']});if(_0xaf09a){_0xaf09a[_0x197c('0x6f')]='stop';}})['then'](function(){var _0x4a8e13=util['format'](_0x197c('0x60'),_0xc10419[_0x197c('0x61')]||_0xc10419[_0x197c('0x5d')],_0xc10419[_0x197c('0x5f')]||'wav');var _0x32d739=_['find'](_0x5ebd0b[_0x197c('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x4a8e13[_0x197c('0x65')]()});if(_0x32d739){_0x32d739['status']=_0x197c('0x70');}})[_0x197c('0x17')](function(){_0x4e8c5b({'code':0xc8,'message':[_0xc10419[_0x197c('0x5d')],_0x197c('0x71')]['join']('\x20')});})[_0x197c('0x1e')](function(_0x304cb7){_0x431100(_0x35d83a[_0x197c('0xe')](0x1f5,[_0xc10419['uniqueid'],_0x304cb7[_0x197c('0x18')][_0x197c('0x65')]()][_0x197c('0x19')]('\x20')));});}else{return _0x431100(_0x35d83a[_0x197c('0xe')](0x1f5,_0x197c('0x6c')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x3d1d6c){var _0x1e6371=_[_0x197c('0x58')](_0x37ac05[_0x197c('0x72')]);_0x3d1d6c({'count':_0x1e6371[_0x197c('0x5a')],'rows':_0x1e6371});});},'VoiceQueuesChannel':function(_0x342efa){var _0x25d3c1=this;return new Promise(function(_0x43c0b2,_0x395fce){var _0x2b1c78=schema(properties[_0x197c('0x73')])[_0x197c('0x2')](_0x342efa);if(_0x2b1c78[_0x197c('0x5a')]>0x0){return _0x395fce(_0x25d3c1['error'](0x1f4,_['map'](_0x2b1c78,'message')[_0x197c('0x19')](',\x20')));}var _0x4b22f2=_[_0x197c('0x55')](_0x37ac05['queueChannels'],{'uniqueid':_0x342efa['uniqueid']});if(_0x4b22f2){_0x43c0b2(_0x4b22f2);}else{return _0x395fce(_0x25d3c1[_0x197c('0xe')](0x1f5,_0x197c('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x2b39fe){var _0x485178=this;return new Promise(function(_0x28e387,_0x238092){if(ami['isConnected']()==![]){return _0x238092(_0x485178[_0x197c('0xe')](0x1f4,[config[_0x197c('0xf')]['ip'],config[_0x197c('0xf')][_0x197c('0x10')],'ami\x20disconnected'][_0x197c('0x19')]('\x20')));}var _0x541dfa=schema(properties[_0x197c('0x74')])['validate'](_0x2b39fe);if(_0x541dfa[_0x197c('0x5a')]>0x0){return _0x238092(_0x485178[_0x197c('0xe')](0x1f4,_[_0x197c('0x5c')](_0x541dfa,'message')[_0x197c('0x19')](',\x20')));}var _0x3bd2ee=_[_0x197c('0x55')](_0x37ac05['queueChannels'],{'uniqueid':_0x2b39fe[_0x197c('0x5d')]});if(_0x3bd2ee&&_0x3bd2ee[_0x197c('0x5e')]){return ami[_0x197c('0x16')]({'action':_0x197c('0x75'),'channel':_0x3bd2ee[_0x197c('0x5e')]})[_0x197c('0x17')](function(_0x4bc7cc){_0x28e387({'code':0xc8,'message':[_0x2b39fe[_0x197c('0x5d')],_0x4bc7cc['message']['toLowerCase']()][_0x197c('0x19')]('\x20')});})[_0x197c('0x1e')](function(_0x58e708){_0x238092(_0x485178[_0x197c('0xe')](0x1f5,[_0x2b39fe[_0x197c('0x5d')],_0x58e708[_0x197c('0x18')][_0x197c('0x65')]()][_0x197c('0x19')]('\x20')));});}else{return _0x238092(_0x485178['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x4ca9b9){var _0x5575fe=this;return new Promise(function(_0x16049c,_0x3d024b){if(ami['isConnected']()==![]){return _0x3d024b(_0x5575fe['error'](0x1f4,[config[_0x197c('0xf')]['ip'],config['asterisk']['username'],_0x197c('0x11')][_0x197c('0x19')]('\x20')));}var _0x1b2dd4=schema(properties[_0x197c('0x76')])[_0x197c('0x2')](_0x4ca9b9);if(_0x1b2dd4[_0x197c('0x5a')]>0x0){return _0x3d024b(_0x5575fe['error'](0x1f4,_[_0x197c('0x5c')](_0x1b2dd4,_0x197c('0x18'))[_0x197c('0x19')](',\x20')));}var _0xee983=_[_0x197c('0x55')](_0x37ac05[_0x197c('0x72')],{'uniqueid':_0x4ca9b9[_0x197c('0x5d')]});if(_0xee983&&_0xee983['channel']){return ami[_0x197c('0x16')]({'action':_0x197c('0x77'),'channel':_0xee983[_0x197c('0x5e')],'exten':_0x4ca9b9[_0x197c('0x78')],'context':_0x4ca9b9[_0x197c('0x79')]||_0xee983[_0x197c('0x79')],'priority':0x1})['then'](function(_0x704f3){_0x16049c({'code':0xc8,'message':[_0x4ca9b9[_0x197c('0x5d')],_0x704f3['message'][_0x197c('0x65')]()][_0x197c('0x19')]('\x20')});})[_0x197c('0x1e')](function(_0x13a742){_0x3d024b(_0x5575fe[_0x197c('0xe')](0x1f5,[_0x4ca9b9['uniqueid'],_0x13a742['message']['toLowerCase']()][_0x197c('0x19')]('\x20')));});}else{return _0x3d024b(_0x5575fe['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x1b7379){return new Promise(function(_0x23472f){var _0x3b9abb=_[_0x197c('0x58')](_0x37ac05[_0x197c('0xa')]);if(_0x1b7379&&_0x1b7379['id']){var _0x542db6=_['find'](_0x3b9abb,function(_0x29de68){return _0x29de68['id']===_0x1b7379['id'];});_0x23472f(_0x542db6);}else{_0x23472f({'count':_0x3b9abb[_0x197c('0x5a')],'rows':_0x3b9abb});}});},'Telephones':function(){return new Promise(function(_0x555cdd){var _0x2e48c9=_[_0x197c('0x58')](_0x37ac05[_0x197c('0x7a')]);_0x555cdd({'count':_0x2e48c9[_0x197c('0x5a')],'rows':_0x2e48c9});});},'Trunks':function(){return new Promise(function(_0x1ff9ee){var _0x1d0616=_['values'](_0x37ac05[_0x197c('0x7b')]);_0x1ff9ee({'count':_0x1d0616[_0x197c('0x5a')],'rows':_0x1d0616});});},'OutboundChannels':function(){return new Promise(function(_0x40f745){var _0x26fe80=_[_0x197c('0x58')](_0x37ac05['outboundChannels']);_0x40f745({'count':_0x26fe80['length'],'rows':_0x26fe80});});},'Outbound':function(){return new Promise(function(_0xe515a1){_0xe515a1(_0x37ac05['outbound']);});},'Campaigns':function(){return new Promise(function(_0x1ea452){var _0x427adb=_[_0x197c('0x58')](_0x37ac05[_0x197c('0x7c')]);_0x1ea452({'count':_0x427adb[_0x197c('0x5a')],'rows':_0x427adb});});},'VoiceQueuesPreview':function(_0x5959b1){var _0x2b6a5d=this;return new Promise(function(_0x176413,_0x2184a3){_0x40863c[_0x197c('0x7d')](_0x5959b1['id'])['then'](function(_0x53428d){_0x176413({'code':0xc8,'message':_0x53428d[_0x197c('0x18')]});})['catch'](function(_0x5505e2){_0x2184a3(_0x2b6a5d[_0x197c('0xe')](0x1f4,_0x5505e2[_0x197c('0x18')]));});});},'EventManager':function(_0x39b79a){var _0x595eec=this;return new Promise(function(_0x4bc9af,_0x4c6322){if(!_0x39b79a[_0x197c('0x7e')]){return _0x4c6322(_0x595eec['error'](0x1f4,_0x197c('0x7f')));}ami[_0x197c('0x80')]('custom:'+_0x39b79a[_0x197c('0x7e')],_0x39b79a[_0x197c('0x18')]);_0x4bc9af({'code':0xc8,'message':_0x39b79a});});},'FaxAccounts':function(){return new Promise(function(_0x5a1026){var _0x31486a=_['values'](_0x37ac05[_0x197c('0x81')]);_0x5a1026({'count':_0x31486a[_0x197c('0x5a')],'rows':_0x31486a});});},'SendFax':function(_0x3f078b){var _0x411c58=this;return new Promise(function(_0x184623,_0x56bdf5){_0x4a6f09[_0x197c('0x82')](_0x3f078b)[_0x197c('0x17')](function(_0x35269e){_0x184623({'code':0xc8,'message':_0x35269e[_0x197c('0x18')]});})[_0x197c('0x1e')](function(_0x33c765){_0x56bdf5(_0x411c58[_0x197c('0xe')](0x1f4,_0x33c765['message']));});});},'CheckAfterSend':function(_0x3e533c){var _0x4b3538=this;return new Promise(function(_0x7b3d35,_0x3c3f7a){_0x4a6f09[_0x197c('0x83')](_0x3e533c)[_0x197c('0x17')](function(_0x4edf13){_0x7b3d35({'code':0xc8,'message':_0x4edf13[_0x197c('0x18')]});})[_0x197c('0x1e')](function(_0x1415c2){_0x3c3f7a(_0x4b3538['error'](0x1f4,_0x1415c2[_0x197c('0x18')]));});});}};var _0x33224d=jayson[_0x197c('0x84')](_0x437214)[_0x197c('0x85')]();_0x33224d['on'](_0x197c('0xe'),function(_0x67c9a3){return _0x1cb6e1(_0x67c9a3);});_0x33224d[_0x197c('0x5')](0x232a,'127.0.0.1',function(){console[_0x197c('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5cbff6(_0x197c('0x87')+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 7653e96..a0d9296 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 _0x2540=['../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','map','routeId','calleridnum','lastName','phone','mobile','fax','createdAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','info','[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','firstName','calleridname','','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','destcalleridnum','Unknown','format','name','trigger:%s','bluebird','ioredis','util'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x2540,0x110));var _0x0254=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x2540[_0x29d915];return _0x160f86;};'use strict';var _=require('lodash');var BPromise=require(_0x0254('0x0'));var Redis=require(_0x0254('0x1'));var util=require(_0x0254('0x2'));var config=require(_0x0254('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x0254('0x4'));config[_0x0254('0x5')]=_[_0x0254('0x6')](config['redis'],{'host':_0x0254('0x7'),'port':0x18eb});var io=require(_0x0254('0x8'))(new Redis(config[_0x0254('0x5')]));function emit(_0x3a6c29,_0x4b08dc,_0x195ea8,_0x397ab7,_0x2f55aa){logger['info']('[CM][%s][%s]',_0x3a6c29,_0x4b08dc['id'],_0x195ea8,_0x397ab7,JSON[_0x0254('0x9')](_0x2f55aa));io['to'](_0x195ea8)[_0x0254('0xa')](_0x397ab7,_0x2f55aa);}exports[_0x0254('0xb')]=function(_0x511b41,_0x66235d,_0xc07628,_0x290159){var _0xdfae7f,_0x5cbd29;var _0x17f460={};var _0x137a98;var _0x317347=Number(_0xc07628[_0x0254('0xc')]);var _0x5a8a4d=_0xc07628[_0x0254('0xd')]?Boolean(Number(_0xc07628['data2'])):![];var _0x33f22a;var _0x152783=![];if(!_[_0x0254('0xe')](_0xc07628[_0x0254('0xf')])){if(_0xc07628[_0x0254('0xf')]=='1')_0x152783=!![];}if(!_0x152783){if(_0x290159['xmd-contactid']){_0x17f460['id']=_0x290159[_0x0254('0x10')];}}if(!_0x17f460['id']){_0x17f460[_0x0254('0x11')]=_0x317347;_0x33f22a=_0xc07628[_0x0254('0x12')]&&_0xc07628[_0x0254('0x12')]!=='0'?_0xc07628['data3']['split'](','):['phone'];_0x17f460['$or']=_[_0x0254('0x13')](_0x33f22a,function(_0x45d5bc){var _0x4435c9={};_0x4435c9[_0x45d5bc]=_0x290159[_0x0254('0x14')]?_0x290159['destcalleridnum']:_0x290159[_0x0254('0x15')];return _0x4435c9;});_0x137a98=_0x290159['routeId']?_0x290159['destcalleridnum']:_0x290159[_0x0254('0x15')];}var _0x45c0d0=['id','firstName',_0x0254('0x16'),_0x0254('0x17'),_0x0254('0x18'),_0x0254('0x19'),_0x0254('0x11'),_0x0254('0x1a'),'scheduledAt',_0x0254('0x1b')];var _0x5a050b=_[_0x0254('0x1c')](_0x45c0d0,_0x33f22a);BPromise[_0x0254('0x1d')]()['then'](cmContactRpc[_0x0254('0x1e')]({'attributes':_0x5a050b,'where':_0x17f460,'phone':_0x137a98}))[_0x0254('0x1f')](function(_0x313713){_0x5cbd29=_0x313713;if(!_[_0x0254('0x20')](_0x5cbd29)){if(_0x5cbd29[_0x0254('0x21')]===0x1){_0xdfae7f=_0x5cbd29[0x0];logger[_0x0254('0x22')](_0x0254('0x23'),_0x290159[_0x0254('0x24')],_0x66235d['id'],_0xdfae7f['id']);}else{logger[_0x0254('0x22')](_0x0254('0x25'),_0x290159[_0x0254('0x24')],_0x66235d['id'],_[_0x0254('0x13')](_0x5cbd29,'id')[_0x0254('0x26')](','));}return;}else{logger[_0x0254('0x22')](_0x0254('0x27'),_0x290159[_0x0254('0x24')],_0x66235d['id']);var _0x19ce14={'ListId':_0x317347};var _0x56e35f=_0xc07628['data4']&&_0xc07628[_0x0254('0x28')]!=='0'?_0xc07628[_0x0254('0x28')]:'phone';if(_0x5a8a4d){logger[_0x0254('0x22')](_0x0254('0x29'),_0x290159[_0x0254('0x24')],_0x66235d['id']);_0x19ce14[_0x56e35f]=_[_0x0254('0xe')](_0x290159[_0x0254('0x14')])?_0x290159[_0x0254('0x15')]:_0x290159['destcalleridnum'];if(_[_0x0254('0xe')](_0x290159['routeId'])){_0x19ce14[_0x0254('0x2a')]=_0x290159[_0x0254('0x2b')]&&_0x290159[_0x0254('0x2b')]!==_0x0254('0x2c')?_0x290159[_0x0254('0x2b')]:'Unknown';}else{_0x19ce14[_0x0254('0x2a')]=_0x290159['destcalleridname']&&_0x290159[_0x0254('0x2d')]!==_0x0254('0x2c')?_0x290159[_0x0254('0x2d')]:'Unknown';}return BPromise[_0x0254('0x1d')]()[_0x0254('0x1f')](cmContactRpc[_0x0254('0x2e')](_0x19ce14))[_0x0254('0x1f')](function(_0x16c6a2){_0xdfae7f=_0x16c6a2;_0x5cbd29[_0x0254('0x2f')](_0x16c6a2);if(_0xdfae7f){logger[_0x0254('0x22')](_0x0254('0x30'),_0x290159[_0x0254('0x24')],_0x66235d['id'],_0xdfae7f['id']);}return;});}else{logger['info'](_0x0254('0x31'),_0x290159[_0x0254('0x24')],_0x66235d['id']);_0x19ce14[_0x56e35f]=_[_0x0254('0xe')](_0x290159[_0x0254('0x14')])?_0x290159['calleridnum']:_0x290159[_0x0254('0x32')];if(_[_0x0254('0xe')](_0x290159[_0x0254('0x14')])){_0x19ce14['firstName']=_0x290159[_0x0254('0x2b')]&&_0x290159['calleridname']!==_0x0254('0x2c')?_0x290159[_0x0254('0x2b')]:_0x0254('0x33');}else{_0x19ce14['firstName']=_0x290159['destcalleridname']&&_0x290159[_0x0254('0x2d')]!==''?_0x290159['destcalleridname']:_0x0254('0x33');}_0xdfae7f=_0x19ce14;_0x5cbd29['push'](_0x19ce14);return;}}})['then'](function(){if(_0x511b41){emit(_0x290159[_0x0254('0x24')],_0x66235d,util[_0x0254('0x34')]('user:%s',_0x511b41[_0x0254('0x35')]),util['format'](_0x0254('0x36'),_0xc07628['action']['toLowerCase']()),{'evt':_['merge'](_0x290159,{'autoCreate':_0x5a8a4d}),'contact':_0xdfae7f===undefined?{}:_0xdfae7f,'contacts':_0x5cbd29['length']===0x0?undefined:_0x5cbd29});}});}; \ No newline at end of file +var _0x620f=['push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','redis','localhost','info','emit','exec','data1','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','calleridnum','destcalleridnum','lastName','mobile','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','','calleridname','Unknown','destcalleridname','resolve'];(function(_0x3452eb,_0x44035e){var _0x4244fd=function(_0x48564b){while(--_0x48564b){_0x3452eb['push'](_0x3452eb['shift']());}};_0x4244fd(++_0x44035e);}(_0x620f,0x1e6));var _0xf620=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x620f[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var BPromise=require(_0xf620('0x0'));var Redis=require(_0xf620('0x1'));var util=require('util');var config=require(_0xf620('0x2'));var logger=require('../../../../config/logger')(_0xf620('0x3'));var cmContactRpc=require(_0xf620('0x4'));config[_0xf620('0x5')]=_['defaults'](config[_0xf620('0x5')],{'host':_0xf620('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf620('0x5')]));function emit(_0x389098,_0x3bc32c,_0x17ccd7,_0x270eba,_0xa5c852){logger[_0xf620('0x7')]('[CM][%s][%s]',_0x389098,_0x3bc32c['id'],_0x17ccd7,_0x270eba,JSON['stringify'](_0xa5c852));io['to'](_0x17ccd7)[_0xf620('0x8')](_0x270eba,_0xa5c852);}exports[_0xf620('0x9')]=function(_0x1ae887,_0x4bef57,_0x2b6188,_0x1abb5d){var _0x135d3e,_0x2b8c04;var _0x14ae95={};var _0x1f5a9a;var _0x15cd5d=Number(_0x2b6188[_0xf620('0xa')]);var _0x102730=_0x2b6188['data2']?Boolean(Number(_0x2b6188['data2'])):![];var _0x5116b3;var _0x28192e=![];if(!_[_0xf620('0xb')](_0x2b6188[_0xf620('0xc')])){if(_0x2b6188[_0xf620('0xc')]=='1')_0x28192e=!![];}if(!_0x28192e){if(_0x1abb5d[_0xf620('0xd')]){_0x14ae95['id']=_0x1abb5d[_0xf620('0xd')];}}if(!_0x14ae95['id']){_0x14ae95[_0xf620('0xe')]=_0x15cd5d;_0x5116b3=_0x2b6188[_0xf620('0xf')]&&_0x2b6188[_0xf620('0xf')]!=='0'?_0x2b6188[_0xf620('0xf')][_0xf620('0x10')](','):['phone'];_0x14ae95[_0xf620('0x11')]=_[_0xf620('0x12')](_0x5116b3,function(_0x124b32){var _0x115c42={};_0x115c42[_0x124b32]=_0x1abb5d[_0xf620('0x13')]?_0x1abb5d['destcalleridnum']:_0x1abb5d[_0xf620('0x14')];return _0x115c42;});_0x1f5a9a=_0x1abb5d[_0xf620('0x13')]?_0x1abb5d[_0xf620('0x15')]:_0x1abb5d[_0xf620('0x14')];}var _0x22505a=['id','firstName',_0xf620('0x16'),'phone',_0xf620('0x17'),'fax',_0xf620('0xe'),_0xf620('0x18'),_0xf620('0x19'),_0xf620('0x1a')];var _0x418ae1=_[_0xf620('0x1b')](_0x22505a,_0x5116b3);BPromise['resolve']()[_0xf620('0x1c')](cmContactRpc[_0xf620('0x1d')]({'attributes':_0x418ae1,'where':_0x14ae95,'phone':_0x1f5a9a}))[_0xf620('0x1c')](function(_0x66f48a){_0x2b8c04=_0x66f48a;if(!_[_0xf620('0x1e')](_0x2b8c04)){if(_0x2b8c04[_0xf620('0x1f')]===0x1){_0x135d3e=_0x2b8c04[0x0];logger[_0xf620('0x7')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1abb5d[_0xf620('0x20')],_0x4bef57['id'],_0x135d3e['id']);}else{logger[_0xf620('0x7')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1abb5d['uniqueid'],_0x4bef57['id'],_['map'](_0x2b8c04,'id')[_0xf620('0x21')](','));}return;}else{logger[_0xf620('0x7')](_0xf620('0x22'),_0x1abb5d[_0xf620('0x20')],_0x4bef57['id']);var _0x27546a={'ListId':_0x15cd5d};var _0x2c8333=_0x2b6188[_0xf620('0x23')]&&_0x2b6188['data4']!=='0'?_0x2b6188['data4']:_0xf620('0x24');if(_0x102730){logger['info'](_0xf620('0x25'),_0x1abb5d[_0xf620('0x20')],_0x4bef57['id']);_0x27546a[_0x2c8333]=_[_0xf620('0xb')](_0x1abb5d[_0xf620('0x13')])?_0x1abb5d[_0xf620('0x14')]:_0x1abb5d[_0xf620('0x15')];if(_[_0xf620('0xb')](_0x1abb5d['routeId'])){_0x27546a[_0xf620('0x26')]=_0x1abb5d['calleridname']&&_0x1abb5d['calleridname']!==_0xf620('0x27')?_0x1abb5d[_0xf620('0x28')]:_0xf620('0x29');}else{_0x27546a[_0xf620('0x26')]=_0x1abb5d[_0xf620('0x2a')]&&_0x1abb5d[_0xf620('0x2a')]!==_0xf620('0x27')?_0x1abb5d['destcalleridname']:'Unknown';}return BPromise[_0xf620('0x2b')]()[_0xf620('0x1c')](cmContactRpc['createContact'](_0x27546a))[_0xf620('0x1c')](function(_0x7d9f10){_0x135d3e=_0x7d9f10;_0x2b8c04[_0xf620('0x2c')](_0x7d9f10);if(_0x135d3e){logger[_0xf620('0x7')](_0xf620('0x2d'),_0x1abb5d[_0xf620('0x20')],_0x4bef57['id'],_0x135d3e['id']);}return;});}else{logger[_0xf620('0x7')](_0xf620('0x2e'),_0x1abb5d[_0xf620('0x20')],_0x4bef57['id']);_0x27546a[_0x2c8333]=_[_0xf620('0xb')](_0x1abb5d['routeId'])?_0x1abb5d[_0xf620('0x14')]:_0x1abb5d[_0xf620('0x15')];if(_[_0xf620('0xb')](_0x1abb5d[_0xf620('0x13')])){_0x27546a[_0xf620('0x26')]=_0x1abb5d['calleridname']&&_0x1abb5d['calleridname']!==_0xf620('0x27')?_0x1abb5d[_0xf620('0x28')]:_0xf620('0x29');}else{_0x27546a[_0xf620('0x26')]=_0x1abb5d[_0xf620('0x2a')]&&_0x1abb5d[_0xf620('0x2a')]!==''?_0x1abb5d[_0xf620('0x2a')]:_0xf620('0x29');}_0x135d3e=_0x27546a;_0x2b8c04['push'](_0x27546a);return;}}})[_0xf620('0x1c')](function(){if(_0x1ae887){emit(_0x1abb5d[_0xf620('0x20')],_0x4bef57,util[_0xf620('0x2f')]('user:%s',_0x1ae887[_0xf620('0x30')]),util[_0xf620('0x2f')](_0xf620('0x31'),_0x2b6188[_0xf620('0x32')][_0xf620('0x33')]()),{'evt':_[_0xf620('0x34')](_0x1abb5d,{'autoCreate':_0x102730}),'contact':_0x135d3e===undefined?{}:_0x135d3e,'contacts':_0x2b8c04[_0xf620('0x1f')]===0x0?undefined:_0x2b8c04});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3d31551..a48ab16 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 _0xe958=['message','event','agent','membername','lastevent','routeId','mailSubstatus','null','created','equals','exports','lodash','url','mustache','ioredis','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','clone','undefined','motionChannel','checkTriggers','hasOwnProperty','checkTrigger','merge','variables','Actions','interface','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','data1','jscripty','trigger:%s','exec','integration','queue','urlforward','script','parse','query','search','replace','channel','AllConditions','length','every','checkConditions','AnyConditions','some','field','account','ChatWebsiteId','value','upperFirst','operator','AccountId'];(function(_0x4edd84,_0x2d4b0d){var _0x516800=function(_0x4d9f36){while(--_0x4d9f36){_0x4edd84['push'](_0x4edd84['shift']());}};_0x516800(++_0x2d4b0d);}(_0xe958,0x191));var _0x8e95=function(_0x1f4e53,_0x4f1510){_0x1f4e53=_0x1f4e53-0x0;var _0x3b42e0=_0xe958[_0x1f4e53];return _0x3b42e0;};'use strict';var util=require('util');var _=require(_0x8e95('0x0'));var url=require(_0x8e95('0x1'));var Mustache=require(_0x8e95('0x2'));var Redis=require(_0x8e95('0x3'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0x8e95('0x4'));var script=require('./script');var config=require(_0x8e95('0x5'));var logger=require(_0x8e95('0x6'))(_0x8e95('0x7'));var ami=require(_0x8e95('0x8'));config[_0x8e95('0x9')]=_[_0x8e95('0xa')](config[_0x8e95('0x9')],{'host':_0x8e95('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8e95('0x9')]));var operators={'equals':function(_0x30fd6a,_0x5cde10){return _0x30fd6a==_0x5cde10;},'not_equals':function(_0x434851,_0x2c635d){return _0x434851!=_0x2c635d;}};var barAndWebActions=[_0x8e95('0xc'),_0x8e95('0x1'),_0x8e95('0xd')];function Trigger(_0x515acc){this[_0x8e95('0xe')]=_0x515acc[_0x8e95('0xe')];this[_0x8e95('0xf')]=_0x515acc[_0x8e95('0xf')];this[_0x8e95('0x10')]=_0x515acc[_0x8e95('0x10')];this[_0x8e95('0x11')]=_0x515acc[_0x8e95('0x11')];this[_0x8e95('0x12')]=_0x515acc['voiceExtensions'];this[_0x8e95('0x13')]=_0x515acc[_0x8e95('0x13')];this[_0x8e95('0x14')]=_0x515acc[_0x8e95('0x14')];this[_0x8e95('0x15')]=_0x515acc[_0x8e95('0x15')];this['sugarcrmAccounts']=_0x515acc[_0x8e95('0x16')];this[_0x8e95('0x17')]=_0x515acc[_0x8e95('0x17')];this[_0x8e95('0x18')]=_0x515acc[_0x8e95('0x18')];this[_0x8e95('0x19')]=_0x515acc['vtigerAccounts'];this['servicenowAccounts']=_0x515acc['servicenowAccounts'];this[_0x8e95('0x1a')]=_0x515acc[_0x8e95('0x1a')];this['freshsalesAccounts']=_0x515acc[_0x8e95('0x1b')];this[_0x8e95('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x8e95('0x14')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x8e95('0x17')],'desk':this[_0x8e95('0x18')],'vtiger':this[_0x8e95('0x19')],'dynamics365':this[_0x8e95('0x1a')],'freshsales':this[_0x8e95('0x1b')],'servicenow':this[_0x8e95('0x1d')]};ami['on']('custom:agentcalled',this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x20'),this[_0x8e95('0x1e')]['bind'](this));ami['on'](_0x8e95('0x21'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x22'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x23'),this['syncCustomEvent'][_0x8e95('0x1f')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x24'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x25'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x26'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x27'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x28'),this[_0x8e95('0x1e')]['bind'](this));ami['on'](_0x8e95('0x29'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x2a'),this[_0x8e95('0x2b')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x2c'),this[_0x8e95('0x2b')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x2d'),this[_0x8e95('0x2b')]['bind'](this));ami['on'](_0x8e95('0x2e'),this['syncCustomEvent'][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x2f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x8e95('0x30'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x31'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on']('custom:outgoingmessage',this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x32'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on'](_0x8e95('0x33'),this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));ami['on']('custom:offlineMessage',this[_0x8e95('0x1e')][_0x8e95('0x1f')](this));}Trigger[_0x8e95('0x34')][_0x8e95('0x35')]=function(_0x5a1d88,_0x29eab3,_0x1fd854){logger[_0x8e95('0x36')](_0x5a1d88,_0x29eab3,JSON['stringify'](_0x1fd854));io['to'](_0x5a1d88)['emit'](_0x29eab3,_0x1fd854);};Trigger[_0x8e95('0x34')][_0x8e95('0x1e')]=function(_0x5f5d39){var _0x595eee=_[_0x8e95('0x37')](_0x5f5d39);if(typeof _0x595eee['motionChannel']===_0x8e95('0x38')){_0x595eee[_0x8e95('0x39')]='voice';}this[_0x8e95('0x3a')](_0x595eee);};Trigger[_0x8e95('0x34')][_0x8e95('0x2b')]=function(_0x5ba940){if(this[_0x8e95('0xf')][_0x5ba940['interface']]){this[_0x8e95('0x1e')](_0x5ba940);}};Trigger['prototype']['checkTriggers']=function(_0x4fecb6){var _0x26567b;for(var _0x588a8b in this['triggers']){if(this[_0x8e95('0xe')][_0x8e95('0x3b')](_0x588a8b)){if(this['triggers'][_0x588a8b]['status']){_0x26567b=this[_0x8e95('0x3c')](this[_0x8e95('0xe')][_0x588a8b],_0x4fecb6);if(_0x26567b){_[_0x8e95('0x3d')](_0x4fecb6,_0x4fecb6[_0x8e95('0x3e')]);for(var _0x9f70b9=0x0,_0x2477f6,_0xd4ba98,_0x2337c2;_0x9f70b90x0){_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(_0x8f1a8d,_0x7fbb28){var _0x41e84b=function(_0x58f23c){while(--_0x58f23c){_0x8f1a8d['push'](_0x8f1a8d['shift']());}};_0x41e84b(++_0x7fbb28);}(_0x7217,0x19e));var _0x7721=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7217[_0xae7c2f];return _0x5d7001;};'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 1b4f48c..138be2e 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 _0x4b38=['recordingFormat','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:','userEmail','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId','message','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','lastIndexOf','enduserId','outbound','GET','contacts?$select=','\x20eq\x20\x27','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField','substring','indexOf','content','incident','POST','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL'];(function(_0x40be59,_0x752493){var _0x3f6047=function(_0x75215a){while(--_0x75215a){_0x40be59['push'](_0x40be59['shift']());}};_0x3f6047(++_0x752493);}(_0x4b38,0x1b9));var _0x84b3=function(_0x3671ce,_0x1d2539){_0x3671ce=_0x3671ce-0x0;var _0x2c6c2b=_0x4b38[_0x3671ce];return _0x2c6c2b;};'use strict';var _=require(_0x84b3('0x0'));var rp=require('request-promise');var util=require(_0x84b3('0x1'));var intUtil=require(_0x84b3('0x2'));var md5=require(_0x84b3('0x3'));var Redis=require(_0x84b3('0x4'));var logger=require(_0x84b3('0x5'))(_0x84b3('0x6'));var config=require(_0x84b3('0x7'));config[_0x84b3('0x8')]=_['defaults'](config['redis'],{'host':_0x84b3('0x9'),'port':0x18eb});var io=require(_0x84b3('0xa'))(new Redis(config[_0x84b3('0x8')]));function getAuthToken(_0x212722,_0x1281e7,_0x27aba1){if(_0x212722[_0x84b3('0xb')]){_0x212722['remoteUri']=_0x212722[_0x84b3('0xc')][_0x84b3('0xd')];_0x212722[_0x84b3('0xe')]=_0x212722[_0x84b3('0xc')][_0x84b3('0xf')];return Promise[_0x84b3('0x10')](_0x212722['CloudProvider'][_0x84b3('0x11')]);}var _0x54b379={'method':'POST','uri':_0x1281e7,'form':{'client_id':_0x212722[_0x84b3('0x12')],'resource':_0x212722['remoteUri'],'username':_0x212722[_0x84b3('0x13')],'password':_0x212722[_0x84b3('0x14')],'grant_type':_0x84b3('0x14'),'client_secret':_0x212722['clientSecret']},'json':!![]};return rp(_0x54b379)[_0x84b3('0x15')](function(_0xe5fd04){return _0xe5fd04[_0x84b3('0x16')];})[_0x84b3('0x17')](function(_0xbb8009){logger[_0x84b3('0x18')]('['+[_0x27aba1[_0x84b3('0x19')]()]+_0x84b3('0x1a'));return _0xbb8009['message'];});}function getUser(_0x599466,_0xd2c062,_0x2ec459,_0x22e5ec,_0x5d137e,_0x35417a){return new Promise(function(_0x4a4017,_0x22228d){return getAuthToken(_0xd2c062,_0x22e5ec,_0x35417a)[_0x84b3('0x15')](function(_0x50210e){var _0x4df9d5={'method':'GET','uri':_0x5d137e+_0x84b3('0x1b'),'headers':{'Authorization':'Bearer\x20'+_0x50210e,'OData-Version':_0x84b3('0x1c')},'json':!![]};return rp(_0x4df9d5);})[_0x84b3('0x15')](function(_0x442fc6){var _0x415cac=_0x442fc6[_0x84b3('0x1d')];var _0x132dbe=![];var _0x31b77e=null;if(!_[_0x84b3('0x1e')](_0x2ec459)){if(intUtil['validateEmail'](_0x2ec459[_0x84b3('0x1f')])){_0x599466['userEmail']=_0x2ec459[_0x84b3('0x1f')];for(_0x31b77e=0x0;_0x31b77e<_0x415cac[_0x84b3('0x20')];_0x31b77e++){if(_0x415cac[_0x31b77e][_0x84b3('0x21')]===_0x2ec459[_0x84b3('0x1f')]&&!_0x415cac[_0x31b77e]['isdisabled']){_0x132dbe=!![];logger[_0x84b3('0x22')]('['+[_0x35417a[_0x84b3('0x19')]()]+_0x84b3('0x23')+_0x415cac[_0x31b77e][_0x84b3('0x24')]+'!');_0x599466[_0x84b3('0x25')]=_0x415cac[_0x31b77e][_0x84b3('0x24')];}}}}if(!_0x132dbe){logger[_0x84b3('0x22')]('['+[_0x35417a[_0x84b3('0x19')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x599466['userEmail']=_0xd2c062[_0x84b3('0x13')];for(_0x31b77e=0x0;_0x31b77e<_0x415cac[_0x84b3('0x20')];_0x31b77e++){if(_0x415cac[_0x31b77e][_0x84b3('0x21')]===_0xd2c062[_0x84b3('0x13')]){_0x599466['userId']=_0x415cac[_0x31b77e][_0x84b3('0x24')];}}}_0x4a4017(_0x599466);})[_0x84b3('0x17')](function(_0x15e037){_0x22228d(_0x15e037[_0x84b3('0x26')]);});});}function createEndUser(_0x19f853,_0x3ceba1,_0x4a4b6,_0x265dc1,_0x2339e1,_0x3da80e,_0x5ed16a){return new Promise(function(_0x63cc7d,_0x278a63){return getAuthToken(_0x3ceba1,_0x4a4b6,_0x3da80e)[_0x84b3('0x15')](function(_0x4d3a60){var _0x513e46=_0x3da80e[_0x84b3('0x27')]()==='outbound'?_0x2339e1[_0x84b3('0x28')]:_0x2339e1[_0x84b3('0x29')];var _0x22b30e={'method':'POST','uri':_0x265dc1+_0x84b3('0x2a'),'body':{'fullname':_0x513e46,'firstname':_0x513e46,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x84b3('0x2b')+_0x19f853['userId']+')'},'headers':{'Authorization':_0x84b3('0x2c')+_0x4d3a60,'OData-Version':_0x84b3('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x22b30e['body'][_0x5ed16a]=_0x513e46;return rp(_0x22b30e);})[_0x84b3('0x15')](function(_0x51fb13){var _0x1c7362=_0x51fb13[_0x84b3('0x2d')][_0x84b3('0x2e')];var _0x36b3d2=_0x1c7362['substring'](_0x1c7362[_0x84b3('0x2f')]('(')+0x1,_0x1c7362[_0x84b3('0x2f')](')'));_0x19f853[_0x84b3('0x30')]=_0x36b3d2;_0x63cc7d(_0x19f853);})[_0x84b3('0x17')](function(_0x4ebb6e){_0x278a63(_0x4ebb6e['message']);});});}function getEndUser(_0x1665c5,_0xcf5654,_0x4e2581,_0x5b10ac,_0x46f224,_0x2cb5d8,_0x445103,_0x112249){var _0x5067ab=_0x2cb5d8[_0x84b3('0x27')]()===_0x84b3('0x31')?_0x46f224[_0x84b3('0x28')]:_0x46f224['calleridnum'];return getAuthToken(_0xcf5654,_0x4e2581,_0x2cb5d8)[_0x84b3('0x15')](function(_0x49b904){_0x112249=_0x112249?_0x112249:'telephone1';var _0x4bcdec={'method':_0x84b3('0x32'),'uri':_0x5b10ac+_0x84b3('0x33')+_0x112249+'&$filter='+_0x112249+_0x84b3('0x34')+_0x5067ab['replace']('+',_0x84b3('0x35'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x49b904,'If-None-Match':null,'OData-Version':_0x84b3('0x1c')},'json':!![]};return rp(_0x4bcdec);})['then'](function(_0x3e0f2f){var _0x549948=![];if(!_0x3e0f2f)return _0x549948;var _0x51fc5a=_0x3e0f2f[_0x84b3('0x1d')];for(var _0xbc5ad9=0x0;_0xbc5ad9<_0x51fc5a['length'];_0xbc5ad9++){if(_0x51fc5a[_0xbc5ad9][_0x112249]===_0x5067ab){_0x549948=!![];_0x1665c5['enduserId']=_0x51fc5a[_0xbc5ad9][_0x84b3('0x36')];}}return _0x549948;})[_0x84b3('0x15')](function(_0x5f3559){if(_0x5f3559)return _0x1665c5;if(_0x445103===_0x84b3('0x37')){logger[_0x84b3('0x22')]('['+[_0x2cb5d8[_0x84b3('0x19')]()]+_0x84b3('0x38'));return _0x1665c5;}return createEndUser(_0x1665c5,_0xcf5654,_0x4e2581,_0x5b10ac,_0x46f224,_0x2cb5d8,_0x112249)[_0x84b3('0x15')](function(_0x2978af){logger[_0x84b3('0x22')]('['+[_0x2cb5d8['toUpperCase']()]+_0x84b3('0x39'),_0x2978af['enduserId']);return _0x2978af;});});}function getCustomFields(_0x4aaa99,_0x5adc9e,_0x57a807){var _0x2ee570={};if(_0x4aaa99[_0x84b3('0x20')]>0x0){_[_0x84b3('0x3a')](_0x4aaa99,function(_0x43e19a){if(_['includes']([_0x84b3('0x3b'),_0x84b3('0x3c')],_0x43e19a[_0x84b3('0x3d')])&&_0x43e19a[_0x84b3('0x3e')]&&!_0x43e19a[_0x84b3('0x3f')]){var _0x376911=_0x43e19a[_0x84b3('0x40')][_0x84b3('0x27')]();var _0x1c4c79=_0x376911[_0x84b3('0x41')](0x0,_0x376911['indexOf']('_'));var _0x2d42bf=_0x376911[_0x84b3('0x41')](_0x376911[_0x84b3('0x42')]('_')+0x1);if(_0x1c4c79===_0x57a807){_0x2ee570[_0x2d42bf]=_0x43e19a[_0x84b3('0x43')];}}});}return _0x2ee570;}function getTicket(_0x5a0035,_0x317fad,_0x27da6f,_0x28fb12,_0x237549,_0x3829af,_0x5175b4){return new Promise(function(_0x4d744d,_0x24042d){var _0x5bb2f9;return getAuthToken(_0x317fad,_0x27da6f,_0x5175b4)[_0x84b3('0x15')](function(_0x18c2a6){if(_0x3829af['ticketType']===_0x84b3('0x44')){_0x5bb2f9={'method':_0x84b3('0x45'),'uri':_0x28fb12+_0x84b3('0x46'),'body':Object[_0x84b3('0x47')]({},{'title':intUtil[_0x84b3('0x48')](_0x3829af[_0x84b3('0x49')],_0x237549,'\x20'),'description':intUtil[_0x84b3('0x48')](_0x3829af[_0x84b3('0x4a')],_0x237549,'\x0a'),'customerid_contact@odata.bind':_0x5a0035[_0x84b3('0x30')]?_0x84b3('0x4b')+_0x5a0035[_0x84b3('0x30')]+')':undefined,'ownerid@odata.bind':_0x84b3('0x2b')+_0x5a0035[_0x84b3('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x3829af[_0x84b3('0x4c')],_0x237549,_0x3829af[_0x84b3('0x4d')])),'headers':{'Authorization':_0x84b3('0x2c')+_0x18c2a6,'OData-Version':_0x84b3('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3829af[_0x84b3('0x4d')]==='phonecall'){var _0x510dc5=_0x5a0035[_0x84b3('0x30')]?[{'partyid_systemuser@odata.bind':_0x84b3('0x2b')+_0x5a0035['userId']+')','participationtypemask':_0x5a0035[_0x84b3('0x4e')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x84b3('0x4b')+_0x5a0035[_0x84b3('0x30')]+')','participationtypemask':_0x5a0035[_0x84b3('0x4e')]===_0x84b3('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5a0035[_0x84b3('0x25')]+')','participationtypemask':_0x5a0035[_0x84b3('0x4e')]===_0x84b3('0x4f')?0x2:0x1}];_0x5bb2f9={'method':'POST','uri':_0x28fb12+'phonecalls','body':Object[_0x84b3('0x47')]({},{'subject':intUtil[_0x84b3('0x48')](_0x3829af['Subjects'],_0x237549,'\x20'),'phonenumber':String(_0x237549[_0x84b3('0x29')]),'description':intUtil[_0x84b3('0x48')](_0x3829af[_0x84b3('0x4a')],_0x237549,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5a0035[_0x84b3('0x30')]?_0x84b3('0x4b')+_0x5a0035[_0x84b3('0x30')]+')':undefined,'ownerid@odata.bind':_0x84b3('0x2b')+_0x5a0035[_0x84b3('0x25')]+')','directioncode':_0x5a0035[_0x84b3('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x510dc5},getCustomFields(_0x3829af[_0x84b3('0x4c')],_0x237549,_0x3829af[_0x84b3('0x4d')])),'headers':{'Authorization':_0x84b3('0x2c')+_0x18c2a6,'OData-Version':_0x84b3('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5bb2f9);})[_0x84b3('0x15')](function(_0xabce5b){var _0x1a3108=_0xabce5b[_0x84b3('0x2d')]['odata-entityid'];var _0x3cdb9c=_0x1a3108[_0x84b3('0x41')](_0x1a3108[_0x84b3('0x2f')]('(')+0x1,_0x1a3108[_0x84b3('0x2f')](')'));_0x5a0035['ticketId']=_0x3cdb9c;_0x4d744d(_0x5a0035);})['catch'](function(_0x1b9456){_0x24042d(_0x1b9456[_0x84b3('0x26')]);});});}function emit(_0x13ba7f,_0x3cfdd4,_0x20103a,_0x482c66){var _0x2c3997={'uri':util[_0x84b3('0x50')](_0x84b3('0x51'),_0x13ba7f,_0x20103a,_0x482c66)};io['to'](util['format'](_0x84b3('0x52'),_0x3cfdd4))['emit'](_0x84b3('0x53'),_0x2c3997);}exports['cs']=function(_0x307b5d,_0x9ae43e,_0x42b957,_0x34e01f,_0x2e3704,_0x58385d,_0x4deadf,_0x8af22){var _0x48022e={};_0x58385d[_0x84b3('0x54')]=_0x58385d[_0x84b3('0xb')]?intUtil[_0x84b3('0x55')](_0x58385d[_0x84b3('0xc')]['data7']):intUtil[_0x84b3('0x55')](_0x58385d[_0x84b3('0x54')]);_0x58385d[_0x84b3('0x56')]=intUtil[_0x84b3('0x55')](_0x58385d[_0x84b3('0x56')]);_0x48022e['callDirection']=_0x8af22===_0x84b3('0x4f')||_0x8af22===_0x84b3('0x57')?_0x84b3('0x4f'):_0x84b3('0x31');var _0x53ad6c=_0x58385d[_0x84b3('0xb')]?util[_0x84b3('0x50')](_0x84b3('0x58'),_0x58385d[_0x84b3('0xc')][_0x84b3('0xd')]):util[_0x84b3('0x50')](_0x84b3('0x58'),_0x58385d[_0x84b3('0x54')]);var _0x17fa8a=util[_0x84b3('0x50')](_0x84b3('0x59'),_0x58385d[_0x84b3('0xe')]);var _0x366886=util[_0x84b3('0x50')](_0x84b3('0x5a'),_0x58385d['serverUrl'],_0x9ae43e[_0x84b3('0x5b')],md5(_0x9ae43e[_0x84b3('0x5b')]));if(_0x2e3704&&_0x2e3704[_0x84b3('0x5c')]){logger[_0x84b3('0x22')]('[QUEUE]','Recording\x20is\x20enabled!');_0x9ae43e[_0x84b3('0x5d')]=_0x366886;}else if(_0x4deadf&&_0x4deadf[_0x84b3('0x5e')]&&_0x4deadf[_0x84b3('0x5e')]!=='none'){logger[_0x84b3('0x22')]('[OUTBOUND]',_0x84b3('0x5f'));_0x9ae43e[_0x84b3('0x5d')]=_0x366886;}else{_0x9ae43e['recordingURL']='';}return getUser(_0x48022e,_0x58385d,_0x34e01f,_0x17fa8a,_0x53ad6c,_0x8af22)[_0x84b3('0x15')](function(_0x571096){logger[_0x84b3('0x22')]('['+_0x8af22[_0x84b3('0x19')]()+_0x84b3('0x60'),_0x571096[_0x84b3('0x25')]);logger[_0x84b3('0x22')]('['+_0x8af22[_0x84b3('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x571096[_0x84b3('0x61')]);return getEndUser(_0x571096,_0x58385d,_0x17fa8a,_0x53ad6c,_0x9ae43e,_0x8af22,_0x42b957['moduleCreate'],_0x42b957[_0x84b3('0x62')]);})[_0x84b3('0x15')](function(_0x3bf4fc){logger[_0x84b3('0x22')]('['+_0x8af22[_0x84b3('0x19')]()+_0x84b3('0x63'),_0x3bf4fc[_0x84b3('0x30')]);logger[_0x84b3('0x22')]('['+_0x8af22[_0x84b3('0x19')]()+_0x84b3('0x64'),_0x9ae43e[_0x84b3('0x29')]);return getTicket(_0x3bf4fc,_0x58385d,_0x17fa8a,_0x53ad6c,_0x9ae43e,_0x42b957,_0x8af22);})[_0x84b3('0x15')](function(_0x43d204){logger[_0x84b3('0x22')](util[_0x84b3('0x50')]('['+_0x8af22[_0x84b3('0x19')]()+_0x84b3('0x65'),_0x42b957[_0x84b3('0x4d')],_0x43d204[_0x84b3('0x66')]));logger['info'](util[_0x84b3('0x50')]('['+_0x8af22['toUpperCase']()+_0x84b3('0x67'),_0x8af22));if(_0x8af22!==_0x84b3('0x57')&&_0x42b957[_0x84b3('0x68')]){logger['info']('['+_0x8af22['toUpperCase']()+']',_0x84b3('0x69'));emit(_0x58385d[_0x84b3('0x54')],_0x34e01f['name'],_0x42b957[_0x84b3('0x4d')],_0x43d204['ticketId']);}})[_0x84b3('0x17')](function(_0x33005e){logger['error']('['+_0x8af22[_0x84b3('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x33005e[_0x84b3('0x26')]);console[_0x84b3('0x18')](_0x84b3('0x6a'),_0x33005e);});}; \ No newline at end of file +var _0x7884=['enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','idField','substring','indexOf','incident','incidents','assign','getString','Subjects','/contacts(','Fields','ticketType','phonecall','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','remoteUri','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data2','resolve','POST','clientId','password','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','email','userEmail','length','isdisabled','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','toLowerCase','destcalleridnum','calleridnum','/systemusers(','userId','body','headers','odata-entityid','lastIndexOf','outbound','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27'];(function(_0x2d91b4,_0x10e178){var _0x184ecd=function(_0x120fc3){while(--_0x120fc3){_0x2d91b4['push'](_0x2d91b4['shift']());}};_0x184ecd(++_0x10e178);}(_0x7884,0x107));var _0x4788=function(_0x26b459,_0x2b100d){_0x26b459=_0x26b459-0x0;var _0x439618=_0x7884[_0x26b459];return _0x439618;};'use strict';var _=require(_0x4788('0x0'));var rp=require(_0x4788('0x1'));var util=require('util');var intUtil=require(_0x4788('0x2'));var md5=require('md5');var Redis=require(_0x4788('0x3'));var logger=require(_0x4788('0x4'))(_0x4788('0x5'));var config=require('../../../../config/environment');config[_0x4788('0x6')]=_[_0x4788('0x7')](config[_0x4788('0x6')],{'host':_0x4788('0x8'),'port':0x18eb});var io=require(_0x4788('0x9'))(new Redis(config[_0x4788('0x6')]));function getAuthToken(_0x30b10d,_0x83a0cd,_0x29fdea){if(_0x30b10d[_0x4788('0xa')]){_0x30b10d['remoteUri']=_0x30b10d['CloudProvider']['data7'];_0x30b10d['tenantId']=_0x30b10d[_0x4788('0xb')][_0x4788('0xc')];return Promise[_0x4788('0xd')](_0x30b10d[_0x4788('0xb')]['data5']);}var _0x26ce57={'method':_0x4788('0xe'),'uri':_0x83a0cd,'form':{'client_id':_0x30b10d[_0x4788('0xf')],'resource':_0x30b10d['remoteUri'],'username':_0x30b10d['username'],'password':_0x30b10d[_0x4788('0x10')],'grant_type':'password','client_secret':_0x30b10d['clientSecret']},'json':!![]};return rp(_0x26ce57)[_0x4788('0x11')](function(_0x3fe69e){return _0x3fe69e['access_token'];})[_0x4788('0x12')](function(_0x596207){logger['error']('['+[_0x29fdea[_0x4788('0x13')]()]+_0x4788('0x14'));return _0x596207[_0x4788('0x15')];});}function getUser(_0x14a085,_0x500c76,_0x3b8bda,_0x2ff1f1,_0x270d2d,_0x40f443){return new Promise(function(_0x262821,_0x18a8bc){return getAuthToken(_0x500c76,_0x2ff1f1,_0x40f443)[_0x4788('0x11')](function(_0x308f32){var _0x57fd63={'method':_0x4788('0x16'),'uri':_0x270d2d+_0x4788('0x17'),'headers':{'Authorization':_0x4788('0x18')+_0x308f32,'OData-Version':_0x4788('0x19')},'json':!![]};return rp(_0x57fd63);})[_0x4788('0x11')](function(_0x417b3a){var _0x352574=_0x417b3a[_0x4788('0x1a')];var _0x17612c=![];var _0x2d48fa=null;if(!_['isNil'](_0x3b8bda)){if(intUtil['validateEmail'](_0x3b8bda[_0x4788('0x1b')])){_0x14a085[_0x4788('0x1c')]=_0x3b8bda[_0x4788('0x1b')];for(_0x2d48fa=0x0;_0x2d48fa<_0x352574[_0x4788('0x1d')];_0x2d48fa++){if(_0x352574[_0x2d48fa]['internalemailaddress']===_0x3b8bda[_0x4788('0x1b')]&&!_0x352574[_0x2d48fa][_0x4788('0x1e')]){_0x17612c=!![];logger[_0x4788('0x1f')]('['+[_0x40f443[_0x4788('0x13')]()]+']\x20Agent\x20found\x20'+_0x352574[_0x2d48fa]['systemuserid']+'!');_0x14a085['userId']=_0x352574[_0x2d48fa]['systemuserid'];}}}}if(!_0x17612c){logger[_0x4788('0x1f')]('['+[_0x40f443[_0x4788('0x13')]()]+_0x4788('0x20'));_0x14a085[_0x4788('0x1c')]=_0x500c76[_0x4788('0x21')];for(_0x2d48fa=0x0;_0x2d48fa<_0x352574[_0x4788('0x1d')];_0x2d48fa++){if(_0x352574[_0x2d48fa][_0x4788('0x22')]===_0x500c76[_0x4788('0x21')]){_0x14a085['userId']=_0x352574[_0x2d48fa]['systemuserid'];}}}_0x262821(_0x14a085);})['catch'](function(_0x3cc327){_0x18a8bc(_0x3cc327[_0x4788('0x15')]);});});}function createEndUser(_0x4919cd,_0x20cb24,_0x239915,_0x1e82e9,_0x5cd3e7,_0x57a39b,_0xf6f26e){return new Promise(function(_0x5dc8c8,_0x2b63cb){return getAuthToken(_0x20cb24,_0x239915,_0x57a39b)[_0x4788('0x11')](function(_0x434d17){var _0x2ec0f6=_0x57a39b[_0x4788('0x23')]()==='outbound'?_0x5cd3e7[_0x4788('0x24')]:_0x5cd3e7[_0x4788('0x25')];var _0x5a0456={'method':_0x4788('0xe'),'uri':_0x1e82e9+'contacts','body':{'fullname':_0x2ec0f6,'firstname':_0x2ec0f6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x4788('0x26')+_0x4919cd[_0x4788('0x27')]+')'},'headers':{'Authorization':_0x4788('0x18')+_0x434d17,'OData-Version':_0x4788('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x5a0456[_0x4788('0x28')][_0xf6f26e]=_0x2ec0f6;return rp(_0x5a0456);})[_0x4788('0x11')](function(_0x2afb8f){var _0x15b256=_0x2afb8f[_0x4788('0x29')][_0x4788('0x2a')];var _0x495c5b=_0x15b256['substring'](_0x15b256[_0x4788('0x2b')]('(')+0x1,_0x15b256[_0x4788('0x2b')](')'));_0x4919cd['enduserId']=_0x495c5b;_0x5dc8c8(_0x4919cd);})[_0x4788('0x12')](function(_0x4bd102){_0x2b63cb(_0x4bd102[_0x4788('0x15')]);});});}function getEndUser(_0x4fade6,_0x5f482a,_0x107434,_0x58b047,_0x2f35fd,_0x2c75cf,_0x438f27,_0x419e1f){var _0x1d2d43=_0x2c75cf['toLowerCase']()===_0x4788('0x2c')?_0x2f35fd['destcalleridnum']:_0x2f35fd['calleridnum'];return getAuthToken(_0x5f482a,_0x107434,_0x2c75cf)[_0x4788('0x11')](function(_0x35bbb9){_0x419e1f=_0x419e1f?_0x419e1f:_0x4788('0x2d');var _0x18a230={'method':'GET','uri':_0x58b047+_0x4788('0x2e')+_0x419e1f+_0x4788('0x2f')+_0x419e1f+_0x4788('0x30')+_0x1d2d43['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x4788('0x18')+_0x35bbb9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18a230);})['then'](function(_0x1bf92b){var _0x4de531=![];if(!_0x1bf92b)return _0x4de531;var _0x334e87=_0x1bf92b[_0x4788('0x1a')];for(var _0x54bb9d=0x0;_0x54bb9d<_0x334e87[_0x4788('0x1d')];_0x54bb9d++){if(_0x334e87[_0x54bb9d][_0x419e1f]===_0x1d2d43){_0x4de531=!![];_0x4fade6[_0x4788('0x31')]=_0x334e87[_0x54bb9d][_0x4788('0x32')];}}return _0x4de531;})[_0x4788('0x11')](function(_0x46cd0d){if(_0x46cd0d)return _0x4fade6;if(_0x438f27===_0x4788('0x33')){logger[_0x4788('0x1f')]('['+[_0x2c75cf[_0x4788('0x13')]()]+_0x4788('0x34'));return _0x4fade6;}return createEndUser(_0x4fade6,_0x5f482a,_0x107434,_0x58b047,_0x2f35fd,_0x2c75cf,_0x419e1f)[_0x4788('0x11')](function(_0x2fae69){logger[_0x4788('0x1f')]('['+[_0x2c75cf[_0x4788('0x13')]()]+_0x4788('0x35'),_0x2fae69[_0x4788('0x31')]);return _0x2fae69;});});}function getCustomFields(_0xbf60b6,_0x15cd94,_0x503c3f){var _0x150141={};if(_0xbf60b6[_0x4788('0x1d')]>0x0){_[_0x4788('0x36')](_0xbf60b6,function(_0x529114){if(_[_0x4788('0x37')]([_0x4788('0x38'),_0x4788('0x39')],_0x529114[_0x4788('0x3a')])&&_0x529114[_0x4788('0x3b')]&&!_0x529114['customField']){var _0x3af799=_0x529114[_0x4788('0x3c')][_0x4788('0x23')]();var _0x35ee30=_0x3af799[_0x4788('0x3d')](0x0,_0x3af799[_0x4788('0x3e')]('_'));var _0x4b89b2=_0x3af799[_0x4788('0x3d')](_0x3af799['indexOf']('_')+0x1);if(_0x35ee30===_0x503c3f){_0x150141[_0x4b89b2]=_0x529114['content'];}}});}return _0x150141;}function getTicket(_0x59923f,_0x5b7a96,_0x478076,_0x3e8a9e,_0xb837bc,_0x4e06ad,_0x15155e){return new Promise(function(_0x56501d,_0x384cd9){var _0x4248dd;return getAuthToken(_0x5b7a96,_0x478076,_0x15155e)[_0x4788('0x11')](function(_0x5ceba3){if(_0x4e06ad['ticketType']===_0x4788('0x3f')){_0x4248dd={'method':_0x4788('0xe'),'uri':_0x3e8a9e+_0x4788('0x40'),'body':Object[_0x4788('0x41')]({},{'title':intUtil[_0x4788('0x42')](_0x4e06ad[_0x4788('0x43')],_0xb837bc,'\x20'),'description':intUtil[_0x4788('0x42')](_0x4e06ad['Descriptions'],_0xb837bc,'\x0a'),'customerid_contact@odata.bind':_0x59923f[_0x4788('0x31')]?_0x4788('0x44')+_0x59923f[_0x4788('0x31')]+')':undefined,'ownerid@odata.bind':_0x4788('0x26')+_0x59923f[_0x4788('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x4e06ad[_0x4788('0x45')],_0xb837bc,_0x4e06ad['ticketType'])),'headers':{'Authorization':_0x4788('0x18')+_0x5ceba3,'OData-Version':_0x4788('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4e06ad[_0x4788('0x46')]===_0x4788('0x47')){var _0x59de7e=_0x59923f[_0x4788('0x31')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x59923f[_0x4788('0x27')]+')','participationtypemask':_0x59923f[_0x4788('0x48')]===_0x4788('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x4788('0x44')+_0x59923f[_0x4788('0x31')]+')','participationtypemask':_0x59923f[_0x4788('0x48')]===_0x4788('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x4788('0x26')+_0x59923f[_0x4788('0x27')]+')','participationtypemask':_0x59923f[_0x4788('0x48')]===_0x4788('0x49')?0x2:0x1}];_0x4248dd={'method':_0x4788('0xe'),'uri':_0x3e8a9e+'phonecalls','body':Object[_0x4788('0x41')]({},{'subject':intUtil[_0x4788('0x42')](_0x4e06ad[_0x4788('0x43')],_0xb837bc,'\x20'),'phonenumber':String(_0xb837bc['calleridnum']),'description':intUtil['getString'](_0x4e06ad['Descriptions'],_0xb837bc,'\x0a'),'regardingobjectid_contact@odata.bind':_0x59923f['enduserId']?_0x4788('0x44')+_0x59923f[_0x4788('0x31')]+')':undefined,'ownerid@odata.bind':_0x4788('0x26')+_0x59923f['userId']+')','directioncode':_0x59923f['callDirection']===_0x4788('0x49')?![]:!![],'phonecall_activity_parties':_0x59de7e},getCustomFields(_0x4e06ad['Fields'],_0xb837bc,_0x4e06ad[_0x4788('0x46')])),'headers':{'Authorization':_0x4788('0x18')+_0x5ceba3,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4248dd);})[_0x4788('0x11')](function(_0x2a5f20){var _0x561f64=_0x2a5f20['headers'][_0x4788('0x2a')];var _0x18f964=_0x561f64[_0x4788('0x3d')](_0x561f64[_0x4788('0x2b')]('(')+0x1,_0x561f64[_0x4788('0x2b')](')'));_0x59923f[_0x4788('0x4a')]=_0x18f964;_0x56501d(_0x59923f);})[_0x4788('0x12')](function(_0x564a7d){_0x384cd9(_0x564a7d['message']);});});}function emit(_0x590799,_0x3bd042,_0x210749,_0x43105d){var _0x4e0f46={'uri':util[_0x4788('0x4b')](_0x4788('0x4c'),_0x590799,_0x210749,_0x43105d)};io['to'](util[_0x4788('0x4b')]('user:%s',_0x3bd042))[_0x4788('0x4d')]('trigger:browser:url',_0x4e0f46);}exports['cs']=function(_0x4e59ee,_0x26a781,_0x3c5e5c,_0x424822,_0x1738ae,_0x2cfeba,_0x37d1ab,_0x46ed10){var _0x45d2be={};_0x2cfeba[_0x4788('0x4e')]=_0x2cfeba[_0x4788('0xa')]?intUtil[_0x4788('0x4f')](_0x2cfeba['CloudProvider'][_0x4788('0x50')]):intUtil[_0x4788('0x4f')](_0x2cfeba[_0x4788('0x4e')]);_0x2cfeba['serverUrl']=intUtil['stripTrailingSlash'](_0x2cfeba[_0x4788('0x51')]);_0x45d2be[_0x4788('0x48')]=_0x46ed10===_0x4788('0x49')||_0x46ed10===_0x4788('0x52')?_0x4788('0x49'):'outbound';var _0x2d52bd=_0x2cfeba[_0x4788('0xa')]?util[_0x4788('0x4b')](_0x4788('0x53'),_0x2cfeba['CloudProvider'][_0x4788('0x50')]):util[_0x4788('0x4b')]('%s/api/data/v9.0/',_0x2cfeba['remoteUri']);var _0x64b019=util['format'](_0x4788('0x54'),_0x2cfeba['tenantId']);var _0x4c39f6=util[_0x4788('0x4b')](_0x4788('0x55'),_0x2cfeba[_0x4788('0x51')],_0x26a781['uniqueid'],md5(_0x26a781[_0x4788('0x56')]));if(_0x1738ae&&_0x1738ae[_0x4788('0x57')]){logger[_0x4788('0x1f')](_0x4788('0x58'),_0x4788('0x59'));_0x26a781[_0x4788('0x5a')]=_0x4c39f6;}else if(_0x37d1ab&&_0x37d1ab[_0x4788('0x5b')]&&_0x37d1ab[_0x4788('0x5b')]!==_0x4788('0x5c')){logger[_0x4788('0x1f')](_0x4788('0x5d'),'Recording\x20is\x20enabled!');_0x26a781[_0x4788('0x5a')]=_0x4c39f6;}else{_0x26a781[_0x4788('0x5a')]='';}return getUser(_0x45d2be,_0x2cfeba,_0x424822,_0x64b019,_0x2d52bd,_0x46ed10)[_0x4788('0x11')](function(_0x44179a){logger[_0x4788('0x1f')]('['+_0x46ed10[_0x4788('0x13')]()+_0x4788('0x5e'),_0x44179a[_0x4788('0x27')]);logger[_0x4788('0x1f')]('['+_0x46ed10[_0x4788('0x13')]()+_0x4788('0x5f'),_0x44179a[_0x4788('0x1c')]);return getEndUser(_0x44179a,_0x2cfeba,_0x64b019,_0x2d52bd,_0x26a781,_0x46ed10,_0x3c5e5c[_0x4788('0x60')],_0x3c5e5c['additionalSearchContact']);})[_0x4788('0x11')](function(_0xdf0d5d){logger[_0x4788('0x1f')]('['+_0x46ed10['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0xdf0d5d[_0x4788('0x31')]);logger[_0x4788('0x1f')]('['+_0x46ed10[_0x4788('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x26a781[_0x4788('0x25')]);return getTicket(_0xdf0d5d,_0x2cfeba,_0x64b019,_0x2d52bd,_0x26a781,_0x3c5e5c,_0x46ed10);})[_0x4788('0x11')](function(_0x2f6c6d){logger[_0x4788('0x1f')](util[_0x4788('0x4b')]('['+_0x46ed10[_0x4788('0x13')]()+_0x4788('0x61'),_0x3c5e5c[_0x4788('0x46')],_0x2f6c6d[_0x4788('0x4a')]));logger[_0x4788('0x1f')](util['format']('['+_0x46ed10['toUpperCase']()+_0x4788('0x62'),_0x46ed10));if(_0x46ed10!==_0x4788('0x52')&&_0x3c5e5c[_0x4788('0x63')]){logger[_0x4788('0x1f')]('['+_0x46ed10[_0x4788('0x13')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2cfeba[_0x4788('0x4e')],_0x424822[_0x4788('0x64')],_0x3c5e5c[_0x4788('0x46')],_0x2f6c6d[_0x4788('0x4a')]);}})[_0x4788('0x12')](function(_0x42fcb3){logger[_0x4788('0x65')]('['+_0x46ed10[_0x4788('0x13')]()+_0x4788('0x66'),_0x42fcb3['message']);console[_0x4788('0x65')](_0x4788('0x67'),_0x42fcb3);});}; \ 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 fb4fc46..c6d40f2 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 _0x3d35=['name','Fields','custom_fields','mapValues','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','Agent\x20found!','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','debug','[HTTP]','stringify','GET','map','forEach','string','type','customField','nameField','toLowerCase','content','toString','includes','picklist','idField','push','variableName','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','calleridname','util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions'];(function(_0x3885b0,_0x5059a4){var _0x339427=function(_0x3bdf4d){while(--_0x3bdf4d){_0x3885b0['push'](_0x3885b0['shift']());}};_0x339427(++_0x5059a4);}(_0x3d35,0x19c));var _0x53d3=function(_0x208b7a,_0x2e3baa){_0x208b7a=_0x208b7a-0x0;var _0x37b7ec=_0x3d35[_0x208b7a];return _0x37b7ec;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x53d3('0x0'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x53d3('0x1'));var logger=require(_0x53d3('0x2'))(_0x53d3('0x3'));config[_0x53d3('0x4')]=_[_0x53d3('0x5')](config[_0x53d3('0x4')],{'host':_0x53d3('0x6'),'port':0x18eb});var io=require(_0x53d3('0x7'))(new Redis(config[_0x53d3('0x4')]));var headers={'Content-Type':_0x53d3('0x8'),'Accept':_0x53d3('0x8')};function emit(_0x41b2b0,_0x3204de,_0x1ccf6d){io['to'](_0x41b2b0)[_0x53d3('0x9')](_0x3204de,_0x1ccf6d);}function getTicket(_0x217830,_0x4482c0,_0x2ad7b3,_0x19c5ca,_0x3811b5){logger[_0x53d3('0xa')](_0x53d3('0xb'));var _0x27dcdc=_[_0x53d3('0xc')]({'responder_id':_0x4482c0['id'],'requester_id':_0x2ad7b3['id'],'name':util[_0x53d3('0xd')](_0x53d3('0xe'),_0x3811b5['calleridname']),'phone':_0x3811b5[_0x53d3('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x53d3('0x10')](_0x19c5ca['Subjects'],_0x3811b5,'\x20'),'description':intUtil['getString'](_0x19c5ca[_0x53d3('0x11')],_0x3811b5,'
'),'tags':getTags(_0x19c5ca['Tags'],_0x53d3('0x12'))},getCustomFields(_0x19c5ca[_0x53d3('0x13')],_0x3811b5));_0x27dcdc[_0x53d3('0x14')]=_[_0x53d3('0x15')](_['keyBy'](_0x27dcdc[_0x53d3('0x14')],'id'),'value');return request({'uri':util[_0x53d3('0xd')](_0x53d3('0x16'),_0x217830['remoteUri']),'method':_0x53d3('0x17'),'body':_0x27dcdc})[_0x53d3('0x18')](function(_0x1b933e){logger['info'](_0x53d3('0x19'));return _0x1b933e;});}function getUser(_0x6542ad,_0x441441){if(intUtil[_0x53d3('0x1a')](_0x441441)){return request({'uri':util['format'](_0x53d3('0x1b'),_0x6542ad[_0x53d3('0x1c')]),'qs':{'email':_0x441441}})[_0x53d3('0x18')](function(_0xd46ba7){if(_0xd46ba7['length']){logger[_0x53d3('0xa')](_0x53d3('0x1d'));return _['find'](_0xd46ba7,function(_0x562ea5){return _0x562ea5[_0x53d3('0x1e')][_0x53d3('0x1f')]===_0x441441;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x53d3('0xd')](_0x53d3('0x20'),_0x6542ad[_0x53d3('0x1c')])})[_0x53d3('0x18')](function(_0x337c05){logger[_0x53d3('0xa')]('Admin\x20account\x20selected.');return _0x337c05;});}});}else{logger[_0x53d3('0xa')](_0x53d3('0x21'));return request({'uri':util[_0x53d3('0xd')](_0x53d3('0x20'),_0x6542ad[_0x53d3('0x1c')])})['then'](function(_0x381ee0){logger['info'](_0x53d3('0x22'));return _0x381ee0;});}}function getEndUser(_0x38cdb6,_0x5a9b2d,_0x251b44){logger[_0x53d3('0xa')]('Searching\x20enduser\x20with\x20phone',_0x251b44);return request({'uri':util[_0x53d3('0xd')](_0x53d3('0x23'),_0x38cdb6['remoteUri']),'qs':{'phone':_0x251b44}})[_0x53d3('0x18')](function(_0x1109ce){if(_0x1109ce[_0x53d3('0x24')]){logger[_0x53d3('0xa')](_0x53d3('0x25'));return _['find'](_0x1109ce,{'phone':_0x251b44});}else{logger[_0x53d3('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x53d3('0xd')](_0x53d3('0x23'),_0x38cdb6[_0x53d3('0x1c')]),'method':'POST','body':{'name':_0x5a9b2d,'phone':_0x251b44}})[_0x53d3('0x18')](function(_0x4ddd28){logger[_0x53d3('0xa')](_0x53d3('0x26'));return _0x4ddd28;});}});}function getAuth(_0xd771ff){return util[_0x53d3('0xd')](_0x53d3('0x27'),new Buffer(_0xd771ff[_0x53d3('0x28')]+':X')['toString']('base64'));}function request(_0x285148){logger[_0x53d3('0x29')](_0x53d3('0x2a'),JSON[_0x53d3('0x2b')](_0x285148));return rp(_['defaults'](_0x285148,{'method':_0x53d3('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x5b6dd6,_0x43c95a){var _0x4d51d7=[];if(_0x5b6dd6&&_0x5b6dd6['length']>0x0){_0x4d51d7=_[_0x53d3('0x2d')](_0x5b6dd6,_0x43c95a);}return _0x4d51d7;}function getCustomFields(_0x4d5f49,_0x4598a8){var _0x5672b3=[];var _0xb17a7e={'custom_fields':[]};if(_0x4d5f49[_0x53d3('0x24')]>0x0){_[_0x53d3('0x2e')](_0x4d5f49,function(_0x5b1597){if(_['includes']([_0x53d3('0x2f'),'picklist'],_0x5b1597[_0x53d3('0x30')])&&_0x5b1597['nameField']&&!_0x5b1597[_0x53d3('0x31')]){_0xb17a7e[_0x5b1597[_0x53d3('0x32')][_0x53d3('0x33')]()]=_0x5b1597[_0x53d3('0x34')][_0x53d3('0x35')]();}else if(_[_0x53d3('0x36')]([_0x53d3('0x2f'),_0x53d3('0x37')],_0x5b1597[_0x53d3('0x30')])&&_0x5b1597[_0x53d3('0x38')]&&_0x5b1597['customField']){_0xb17a7e[_0x53d3('0x14')][_0x53d3('0x39')]({'id':_0x5b1597[_0x53d3('0x38')],'value':_0x5b1597['content'][_0x53d3('0x35')]()});}else if(_0x5b1597[_0x53d3('0x30')]==='variable'&&_0x5b1597[_0x53d3('0x3a')]&&_0x5b1597[_0x53d3('0x38')]&&_0x5b1597[_0x53d3('0x31')]){_0x4598a8[_0x5b1597[_0x53d3('0x3a')]]&&_0xb17a7e[_0x53d3('0x14')][_0x53d3('0x39')]({'id':_0x5b1597['idField'],'value':_0x4598a8[_0x5b1597[_0x53d3('0x3a')]][_0x53d3('0x35')]()});}else if(_0x5b1597[_0x53d3('0x30')]==='customVariable'&&_0x5b1597[_0x53d3('0x3b')]&&_0x5b1597[_0x53d3('0x3b')]['name']&&_0x5b1597[_0x53d3('0x38')]&&_0x5b1597[_0x53d3('0x31')]){_0x4598a8[_0x5b1597[_0x53d3('0x3b')][_0x53d3('0x12')][_0x53d3('0x33')]()]&&_0xb17a7e[_0x53d3('0x14')]['push']({'id':_0x5b1597[_0x53d3('0x38')],'value':_0x4598a8[_0x5b1597[_0x53d3('0x3b')][_0x53d3('0x12')][_0x53d3('0x33')]()][_0x53d3('0x35')]()});}});}return _0xb17a7e;}exports[_0x53d3('0x3c')]=function(_0x350894,_0x30b49a,_0x36ee6b,_0x1fc285,_0x5595b1,_0x3f756e){var _0x1d6ba8,_0x36a51f;_0x3f756e[_0x53d3('0x1c')]=intUtil['stripTrailingSlash'](_0x3f756e[_0x53d3('0x1c')]);_0x3f756e[_0x53d3('0x3d')]=intUtil[_0x53d3('0x3e')](_0x3f756e['serverUrl']);if(_0x5595b1&&_0x5595b1[_0x53d3('0x3f')]){logger[_0x53d3('0xa')](_0x53d3('0x40'),_0x53d3('0x41'));_0x30b49a['recordingURL']=util[_0x53d3('0xd')](_0x53d3('0x42'),_0x3f756e[_0x53d3('0x3d')],_0x30b49a[_0x53d3('0x43')],md5(_0x30b49a[_0x53d3('0x43')]));}else{_0x30b49a[_0x53d3('0x44')]='';}headers['Authorization']=getAuth(_0x3f756e);return getUser(_0x3f756e,_0x1fc285[_0x53d3('0x1f')])[_0x53d3('0x18')](function(_0x511c58){_0x1d6ba8=_0x511c58;logger[_0x53d3('0xa')](_0x53d3('0x45'),_0x1d6ba8['id']);return getEndUser(_0x3f756e,_0x30b49a['calleridname'],_0x30b49a[_0x53d3('0xf')]);})['then'](function(_0x37e69f){_0x36a51f=_0x37e69f;logger['info'](_0x53d3('0x46'),_0x36a51f['id']);return getTicket(_0x3f756e,_0x1d6ba8,_0x36a51f,_0x36ee6b,_0x30b49a);})[_0x53d3('0x18')](function(_0x33058b){if(_0x33058b&&_0x33058b['id']){logger[_0x53d3('0xa')](_0x53d3('0x19'));logger[_0x53d3('0xa')]('The\x20Ticket\x20ID\x20is:',_0x33058b['id']);logger[_0x53d3('0xa')](_0x53d3('0x40'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x53d3('0xd')](_0x53d3('0x47'),_0x1fc285['name']),_0x53d3('0x48'),{'uri':util[_0x53d3('0xd')](_0x53d3('0x49'),_0x3f756e[_0x53d3('0x1c')],_0x33058b['id'])});}})[_0x53d3('0x4a')](function(_0x37d254){logger[_0x53d3('0x4b')](_0x53d3('0x40'),JSON['stringify'](_0x37d254));});};exports['outbound']=function(_0x555769,_0x16d7bf,_0x10ee76,_0x5880a5,_0x128b2d,_0x13c484,_0x44bbb9){var _0x128d29,_0x22676f;_0x13c484['remoteUri']=intUtil[_0x53d3('0x3e')](_0x13c484[_0x53d3('0x1c')]);_0x13c484['serverUrl']=intUtil[_0x53d3('0x3e')](_0x13c484[_0x53d3('0x3d')]);if(_0x44bbb9&&_0x44bbb9[_0x53d3('0x4c')]&&_0x44bbb9['recordingFormat']!=='none'){logger['info'](_0x53d3('0x4d'),'Recording\x20is\x20enabled!');_0x16d7bf[_0x53d3('0x44')]=util[_0x53d3('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c484[_0x53d3('0x3d')],_0x16d7bf['uniqueid'],md5(_0x16d7bf[_0x53d3('0x43')]));}headers[_0x53d3('0x4e')]=getAuth(_0x13c484);return getUser(_0x13c484,_0x5880a5[_0x53d3('0x1f')])['then'](function(_0x23dd26){_0x128d29=_0x23dd26;logger[_0x53d3('0xa')]('The\x20User\x20ID\x20is:',_0x128d29['id']);return getEndUser(_0x13c484,_0x16d7bf[_0x53d3('0x4f')],_0x16d7bf[_0x53d3('0x50')]);})[_0x53d3('0x18')](function(_0xaf654e){_0x22676f=_0xaf654e;logger[_0x53d3('0xa')](_0x53d3('0x46'),_0x22676f['id']);return getTicket(_0x13c484,_0x128d29,_0x22676f,_0x10ee76,_0x16d7bf);})[_0x53d3('0x18')](function(_0x5312a8){if(_0x5312a8&&_0x5312a8['id']){logger[_0x53d3('0xa')]('Ticket\x20created!');logger[_0x53d3('0xa')](_0x53d3('0x51'),_0x5312a8['id']);logger[_0x53d3('0xa')](_0x53d3('0x4d'),_0x53d3('0x52'));emit(util[_0x53d3('0xd')](_0x53d3('0x47'),_0x5880a5[_0x53d3('0x12')]),_0x53d3('0x48'),{'uri':util[_0x53d3('0xd')](_0x53d3('0x49'),_0x13c484[_0x53d3('0x1c')],_0x5312a8['id'])});}})[_0x53d3('0x4a')](function(_0x2e0616){logger[_0x53d3('0x4b')](_0x53d3('0x4d'),JSON[_0x53d3('0x2b')](_0x2e0616));});};exports['unmanaged']=function(_0x5836a2,_0x3d5f37,_0x5966ec,_0x364a97,_0x5b4f3b,_0x13c684){var _0x3fd621,_0x15f6ca;_0x13c684[_0x53d3('0x1c')]=intUtil[_0x53d3('0x3e')](_0x13c684[_0x53d3('0x1c')]);_0x13c684['serverUrl']=intUtil['stripTrailingSlash'](_0x13c684[_0x53d3('0x3d')]);if(_0x5b4f3b&&_0x5b4f3b['monitor_format']){logger[_0x53d3('0xa')]('['+_0x3d5f37[_0x53d3('0x53')][_0x53d3('0x54')]()+']',_0x53d3('0x41'));_0x3d5f37[_0x53d3('0x44')]=util[_0x53d3('0xd')](_0x53d3('0x42'),_0x13c684[_0x53d3('0x3d')],_0x3d5f37[_0x53d3('0x43')],md5(_0x3d5f37[_0x53d3('0x43')]));}else{_0x3d5f37[_0x53d3('0x44')]='';}headers[_0x53d3('0x4e')]=getAuth(_0x13c684);return getUser(_0x13c684,'')[_0x53d3('0x18')](function(_0x45a6e1){_0x3fd621=_0x45a6e1;logger[_0x53d3('0xa')](_0x53d3('0x45'),_0x3fd621['id']);return getEndUser(_0x13c684,_0x3d5f37[_0x53d3('0x55')],_0x3d5f37[_0x53d3('0xf')]);})[_0x53d3('0x18')](function(_0x2c50c7){_0x15f6ca=_0x2c50c7;logger[_0x53d3('0xa')]('The\x20Enduser\x20ID\x20is:',_0x15f6ca['id']);return getTicket(_0x13c684,_0x3fd621,_0x15f6ca,_0x5966ec,_0x3d5f37);})[_0x53d3('0x18')](function(_0x41a898){if(_0x41a898){logger[_0x53d3('0xa')](_0x53d3('0x19'));logger['info'](_0x53d3('0x51'),_0x41a898['id']);}})[_0x53d3('0x4a')](function(_0x221e88){logger[_0x53d3('0x4b')]('['+_0x3d5f37[_0x53d3('0x53')][_0x53d3('0x54')]()+']',JSON[_0x53d3('0x2b')](_0x221e88));});}; \ No newline at end of file +var _0x0dbf=['Tags','name','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','defaults','forEach','includes','string','picklist','type','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','user:%s','catch','error','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','application/json','info','Creating\x20new\x20ticket...','merge','calleridnum','getString','Subjects','Descriptions','
'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x0dbf,0x1b1));var _0xf0db=function(_0x4001ad,_0x1e22dd){_0x4001ad=_0x4001ad-0x0;var _0x4c7ec2=_0x0dbf[_0x4001ad];return _0x4c7ec2;};'use strict';var _=require(_0xf0db('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf0db('0x1'));var Redis=require(_0xf0db('0x2'));var intUtil=require(_0xf0db('0x3'));var config=require(_0xf0db('0x4'));var logger=require('../../../../config/logger')(_0xf0db('0x5'));config[_0xf0db('0x6')]=_['defaults'](config['redis'],{'host':_0xf0db('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf0db('0x6')]));var headers={'Content-Type':_0xf0db('0x8'),'Accept':_0xf0db('0x8')};function emit(_0x5bfff7,_0x5ddf76,_0x4ffd8a){io['to'](_0x5bfff7)['emit'](_0x5ddf76,_0x4ffd8a);}function getTicket(_0x22b98f,_0x5d2a10,_0x34b046,_0xd2ab18,_0x2dd91b){logger[_0xf0db('0x9')](_0xf0db('0xa'));var _0x20551e=_[_0xf0db('0xb')]({'responder_id':_0x5d2a10['id'],'requester_id':_0x34b046['id'],'name':util['format']('Caller\x20-\x20%s',_0x2dd91b['calleridname']),'phone':_0x2dd91b[_0xf0db('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf0db('0xd')](_0xd2ab18[_0xf0db('0xe')],_0x2dd91b,'\x20'),'description':intUtil[_0xf0db('0xd')](_0xd2ab18[_0xf0db('0xf')],_0x2dd91b,_0xf0db('0x10')),'tags':getTags(_0xd2ab18[_0xf0db('0x11')],_0xf0db('0x12'))},getCustomFields(_0xd2ab18['Fields'],_0x2dd91b));_0x20551e[_0xf0db('0x13')]=_[_0xf0db('0x14')](_[_0xf0db('0x15')](_0x20551e[_0xf0db('0x13')],'id'),_0xf0db('0x16'));return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x18'),_0x22b98f[_0xf0db('0x19')]),'method':'POST','body':_0x20551e})[_0xf0db('0x1a')](function(_0x5a25f3){logger[_0xf0db('0x9')](_0xf0db('0x1b'));return _0x5a25f3;});}function getUser(_0xb6deaf,_0x20103f){if(intUtil['validateEmail'](_0x20103f)){return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x1c'),_0xb6deaf[_0xf0db('0x19')]),'qs':{'email':_0x20103f}})['then'](function(_0x3ff02f){if(_0x3ff02f[_0xf0db('0x1d')]){logger[_0xf0db('0x9')](_0xf0db('0x1e'));return _[_0xf0db('0x1f')](_0x3ff02f,function(_0x5277a8){return _0x5277a8[_0xf0db('0x20')][_0xf0db('0x21')]===_0x20103f;});}else{logger[_0xf0db('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xf0db('0x22'),_0xb6deaf['remoteUri'])})[_0xf0db('0x1a')](function(_0x11ba3c){logger[_0xf0db('0x9')](_0xf0db('0x23'));return _0x11ba3c;});}});}else{logger[_0xf0db('0x9')](_0xf0db('0x24'));return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x22'),_0xb6deaf[_0xf0db('0x19')])})['then'](function(_0x1e59fa){logger[_0xf0db('0x9')]('Admin\x20account\x20selected.');return _0x1e59fa;});}}function getEndUser(_0x40e5e2,_0x122722,_0x2ccb38){logger['info'](_0xf0db('0x25'),_0x2ccb38);return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x26'),_0x40e5e2[_0xf0db('0x19')]),'qs':{'phone':_0x2ccb38}})[_0xf0db('0x1a')](function(_0x5cb65a){if(_0x5cb65a[_0xf0db('0x1d')]){logger['info'](_0xf0db('0x27'));return _[_0xf0db('0x1f')](_0x5cb65a,{'phone':_0x2ccb38});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x26'),_0x40e5e2[_0xf0db('0x19')]),'method':_0xf0db('0x28'),'body':{'name':_0x122722,'phone':_0x2ccb38}})[_0xf0db('0x1a')](function(_0x47a1e3){logger['info'](_0xf0db('0x29'));return _0x47a1e3;});}});}function getAuth(_0xf4b2e3){return util['format'](_0xf0db('0x2a'),new Buffer(_0xf4b2e3[_0xf0db('0x2b')]+':X')[_0xf0db('0x2c')]('base64'));}function request(_0x5aec11){logger[_0xf0db('0x2d')](_0xf0db('0x2e'),JSON[_0xf0db('0x2f')](_0x5aec11));return rp(_[_0xf0db('0x30')](_0x5aec11,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5f2ee0,_0x3b8e14){var _0x1fb347=[];if(_0x5f2ee0&&_0x5f2ee0[_0xf0db('0x1d')]>0x0){_0x1fb347=_['map'](_0x5f2ee0,_0x3b8e14);}return _0x1fb347;}function getCustomFields(_0x5ae1eb,_0x44978d){var _0x500a5a=[];var _0x115578={'custom_fields':[]};if(_0x5ae1eb[_0xf0db('0x1d')]>0x0){_[_0xf0db('0x31')](_0x5ae1eb,function(_0x13ff39){if(_[_0xf0db('0x32')]([_0xf0db('0x33'),_0xf0db('0x34')],_0x13ff39[_0xf0db('0x35')])&&_0x13ff39['nameField']&&!_0x13ff39[_0xf0db('0x36')]){_0x115578[_0x13ff39['nameField'][_0xf0db('0x37')]()]=_0x13ff39[_0xf0db('0x38')][_0xf0db('0x2c')]();}else if(_[_0xf0db('0x32')]([_0xf0db('0x33'),_0xf0db('0x34')],_0x13ff39[_0xf0db('0x35')])&&_0x13ff39[_0xf0db('0x39')]&&_0x13ff39[_0xf0db('0x36')]){_0x115578[_0xf0db('0x13')][_0xf0db('0x3a')]({'id':_0x13ff39[_0xf0db('0x39')],'value':_0x13ff39[_0xf0db('0x38')][_0xf0db('0x2c')]()});}else if(_0x13ff39[_0xf0db('0x35')]==='variable'&&_0x13ff39[_0xf0db('0x3b')]&&_0x13ff39['idField']&&_0x13ff39[_0xf0db('0x36')]){_0x44978d[_0x13ff39[_0xf0db('0x3b')]]&&_0x115578[_0xf0db('0x13')][_0xf0db('0x3a')]({'id':_0x13ff39[_0xf0db('0x39')],'value':_0x44978d[_0x13ff39[_0xf0db('0x3b')]][_0xf0db('0x2c')]()});}else if(_0x13ff39[_0xf0db('0x35')]===_0xf0db('0x3c')&&_0x13ff39[_0xf0db('0x3d')]&&_0x13ff39[_0xf0db('0x3d')][_0xf0db('0x12')]&&_0x13ff39[_0xf0db('0x39')]&&_0x13ff39[_0xf0db('0x36')]){_0x44978d[_0x13ff39[_0xf0db('0x3d')][_0xf0db('0x12')][_0xf0db('0x37')]()]&&_0x115578[_0xf0db('0x13')]['push']({'id':_0x13ff39[_0xf0db('0x39')],'value':_0x44978d[_0x13ff39[_0xf0db('0x3d')]['name'][_0xf0db('0x37')]()][_0xf0db('0x2c')]()});}});}return _0x115578;}exports[_0xf0db('0x3e')]=function(_0x281480,_0x50133a,_0x45aa5a,_0x2f76e8,_0x5207c7,_0x17054a){var _0x1808e7,_0x3b27f4;_0x17054a['remoteUri']=intUtil[_0xf0db('0x3f')](_0x17054a[_0xf0db('0x19')]);_0x17054a['serverUrl']=intUtil[_0xf0db('0x3f')](_0x17054a['serverUrl']);if(_0x5207c7&&_0x5207c7[_0xf0db('0x40')]){logger[_0xf0db('0x9')]('[QUEUE]',_0xf0db('0x41'));_0x50133a[_0xf0db('0x42')]=util[_0xf0db('0x17')](_0xf0db('0x43'),_0x17054a[_0xf0db('0x44')],_0x50133a[_0xf0db('0x45')],md5(_0x50133a[_0xf0db('0x45')]));}else{_0x50133a[_0xf0db('0x42')]='';}headers['Authorization']=getAuth(_0x17054a);return getUser(_0x17054a,_0x2f76e8[_0xf0db('0x21')])[_0xf0db('0x1a')](function(_0x421811){_0x1808e7=_0x421811;logger['info'](_0xf0db('0x46'),_0x1808e7['id']);return getEndUser(_0x17054a,_0x50133a[_0xf0db('0x47')],_0x50133a['calleridnum']);})['then'](function(_0x28c590){_0x3b27f4=_0x28c590;logger[_0xf0db('0x9')](_0xf0db('0x48'),_0x3b27f4['id']);return getTicket(_0x17054a,_0x1808e7,_0x3b27f4,_0x45aa5a,_0x50133a);})[_0xf0db('0x1a')](function(_0x2c45bd){if(_0x2c45bd&&_0x2c45bd['id']){logger[_0xf0db('0x9')](_0xf0db('0x1b'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2c45bd['id']);logger[_0xf0db('0x9')]('[QUEUE]',_0xf0db('0x49'));emit(util[_0xf0db('0x17')]('user:%s',_0x2f76e8[_0xf0db('0x12')]),_0xf0db('0x4a'),{'uri':util[_0xf0db('0x17')](_0xf0db('0x4b'),_0x17054a[_0xf0db('0x19')],_0x2c45bd['id'])});}})['catch'](function(_0x25ea3d){logger['error']('[QUEUE]',JSON[_0xf0db('0x2f')](_0x25ea3d));});};exports[_0xf0db('0x4c')]=function(_0x2a922d,_0x1ef453,_0x46c7d8,_0x569532,_0x53e563,_0x313834,_0xafde6d){var _0xea9c38,_0x1c3a58;_0x313834['remoteUri']=intUtil[_0xf0db('0x3f')](_0x313834[_0xf0db('0x19')]);_0x313834[_0xf0db('0x44')]=intUtil[_0xf0db('0x3f')](_0x313834['serverUrl']);if(_0xafde6d&&_0xafde6d[_0xf0db('0x4d')]&&_0xafde6d[_0xf0db('0x4d')]!==_0xf0db('0x4e')){logger[_0xf0db('0x9')]('[OUTBOUND]',_0xf0db('0x41'));_0x1ef453[_0xf0db('0x42')]=util['format'](_0xf0db('0x43'),_0x313834['serverUrl'],_0x1ef453['uniqueid'],md5(_0x1ef453[_0xf0db('0x45')]));}headers[_0xf0db('0x4f')]=getAuth(_0x313834);return getUser(_0x313834,_0x569532[_0xf0db('0x21')])[_0xf0db('0x1a')](function(_0x5f0b44){_0xea9c38=_0x5f0b44;logger[_0xf0db('0x9')](_0xf0db('0x46'),_0xea9c38['id']);return getEndUser(_0x313834,_0x1ef453[_0xf0db('0x50')],_0x1ef453[_0xf0db('0x51')]);})[_0xf0db('0x1a')](function(_0x2278ac){_0x1c3a58=_0x2278ac;logger[_0xf0db('0x9')](_0xf0db('0x48'),_0x1c3a58['id']);return getTicket(_0x313834,_0xea9c38,_0x1c3a58,_0x46c7d8,_0x1ef453);})[_0xf0db('0x1a')](function(_0x522408){if(_0x522408&&_0x522408['id']){logger[_0xf0db('0x9')](_0xf0db('0x1b'));logger[_0xf0db('0x9')](_0xf0db('0x52'),_0x522408['id']);logger[_0xf0db('0x9')](_0xf0db('0x53'),_0xf0db('0x49'));emit(util[_0xf0db('0x17')](_0xf0db('0x54'),_0x569532['name']),_0xf0db('0x4a'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x313834[_0xf0db('0x19')],_0x522408['id'])});}})[_0xf0db('0x55')](function(_0x15d79a){logger[_0xf0db('0x56')](_0xf0db('0x53'),JSON[_0xf0db('0x2f')](_0x15d79a));});};exports[_0xf0db('0x57')]=function(_0x560b18,_0x1534b2,_0x282781,_0x452be5,_0x53e282,_0xdbabc4){var _0x49e2c0,_0x30aa4b;_0xdbabc4[_0xf0db('0x19')]=intUtil[_0xf0db('0x3f')](_0xdbabc4[_0xf0db('0x19')]);_0xdbabc4[_0xf0db('0x44')]=intUtil[_0xf0db('0x3f')](_0xdbabc4[_0xf0db('0x44')]);if(_0x53e282&&_0x53e282[_0xf0db('0x40')]){logger[_0xf0db('0x9')]('['+_0x1534b2[_0xf0db('0x58')][_0xf0db('0x59')]()+']',_0xf0db('0x41'));_0x1534b2[_0xf0db('0x42')]=util[_0xf0db('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xdbabc4[_0xf0db('0x44')],_0x1534b2[_0xf0db('0x45')],md5(_0x1534b2[_0xf0db('0x45')]));}else{_0x1534b2[_0xf0db('0x42')]='';}headers['Authorization']=getAuth(_0xdbabc4);return getUser(_0xdbabc4,'')[_0xf0db('0x1a')](function(_0x473fcb){_0x49e2c0=_0x473fcb;logger[_0xf0db('0x9')]('The\x20User\x20ID\x20is:',_0x49e2c0['id']);return getEndUser(_0xdbabc4,_0x1534b2[_0xf0db('0x47')],_0x1534b2['calleridnum']);})[_0xf0db('0x1a')](function(_0x14c550){_0x30aa4b=_0x14c550;logger['info'](_0xf0db('0x48'),_0x30aa4b['id']);return getTicket(_0xdbabc4,_0x49e2c0,_0x30aa4b,_0x282781,_0x1534b2);})['then'](function(_0x1fd8a6){if(_0x1fd8a6){logger[_0xf0db('0x9')](_0xf0db('0x1b'));logger[_0xf0db('0x9')](_0xf0db('0x52'),_0x1fd8a6['id']);}})[_0xf0db('0x55')](function(_0x516090){logger[_0xf0db('0x56')]('['+_0x1534b2[_0xf0db('0x58')]['toUpperCase']()+']',JSON[_0xf0db('0x2f')](_0x516090));});}; \ 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 000b30c..f410709 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 _0x1d2d=['Admin\x20selected','error','toUpperCase','&f=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','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\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','freshsales','redis','localhost','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId'];(function(_0x42fd32,_0x12d3ae){var _0x328b6f=function(_0x3b9d38){while(--_0x3b9d38){_0x42fd32['push'](_0x42fd32['shift']());}};_0x328b6f(++_0x12d3ae);}(_0x1d2d,0x89));var _0xd1d2=function(_0x55a2e7,_0x2cdeb6){_0x55a2e7=_0x55a2e7-0x0;var _0x44a5f5=_0x1d2d[_0x55a2e7];return _0x44a5f5;};'use strict';var _=require('lodash');var rp=require(_0xd1d2('0x0'));var md5=require(_0xd1d2('0x1'));var util=require(_0xd1d2('0x2'));var moment=require(_0xd1d2('0x3'));var Promise=require(_0xd1d2('0x4'));var Redis=require(_0xd1d2('0x5'));var intUtil=require('./util');var config=require(_0xd1d2('0x6'));var logger=require('../../../../config/logger')(_0xd1d2('0x7'));config[_0xd1d2('0x8')]=_['defaults'](config[_0xd1d2('0x8')],{'host':_0xd1d2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd1d2('0x8')]));function getAdminId(_0x5d3c8e,_0x24411b,_0x106682,_0x5f120a){return new Promise(function(_0x790c07,_0xfc9eb8){var _0x531463=![];var _0x5a8a3d={'method':_0xd1d2('0xa'),'uri':_0x5f120a+_0xd1d2('0xb'),'json':!![]};_0x5a8a3d['headers']=_0x106682;logger[_0xd1d2('0xc')](_0xd1d2('0xd'));return rp(_0x5a8a3d)['then'](function(_0x8b14ec){if(_0x8b14ec){var _0x5300ea=_0x8b14ec[_0xd1d2('0xe')];var _0x18d705=null;for(_0x18d705=0x0;_0x18d705<_0x5300ea[_0xd1d2('0xf')];_0x18d705++){if(_0x5300ea[_0x18d705][_0xd1d2('0x10')]===_0x5d3c8e[_0xd1d2('0x11')]){_0x5d3c8e[_0xd1d2('0x12')]=_0x5300ea[_0x18d705]['id'];_0x531463=!![];}}if(_0x531463){logger[_0xd1d2('0xc')](_0xd1d2('0x13'),_0x5d3c8e[_0xd1d2('0x12')]);_0x790c07(_0x5d3c8e);}else{_0xfc9eb8({'statusCode':0x194,'message':_0xd1d2('0x14')});}}else{_0xfc9eb8({'statusCode':0x194,'message':_0xd1d2('0x14')});}})[_0xd1d2('0x15')](function(_0x5e22a8){logger['error']('['+[_0x24411b['toUpperCase']()]+']',_0x5e22a8[_0xd1d2('0x16')]);_0xfc9eb8(_0x5e22a8);});});}function getUser(_0x185ac0,_0x147f85,_0x2353c8){return function(_0x987d76){return new Promise(function(_0x1a0811,_0x554a3a){var _0x4b41f5={'method':_0xd1d2('0xa'),'uri':_0x2353c8+_0xd1d2('0xb'),'json':!![]};_0x4b41f5[_0xd1d2('0x17')]=_0x147f85;logger[_0xd1d2('0xc')](_0xd1d2('0x18'));return rp(_0x4b41f5)[_0xd1d2('0x19')](function(_0x282948){if(_0x282948){var _0x5f000c=_0x282948['users'];var _0x53b555=![];var _0xd5e478=null;if(_0x987d76[_0xd1d2('0x1a')]!==null){logger[_0xd1d2('0xc')](_0xd1d2('0x1b'),_0x987d76[_0xd1d2('0x1a')]);_0x987d76[_0xd1d2('0x1c')]=_0x987d76[_0xd1d2('0x1a')];for(_0xd5e478=0x0;_0xd5e478<_0x5f000c['length'];_0xd5e478++){if(_0x5f000c[_0xd5e478]['email']===_0x987d76[_0xd1d2('0x1a')]){_0x53b555=!![];_0x987d76['userId']=_0x5f000c[_0xd5e478]['id'];logger[_0xd1d2('0xc')](_0xd1d2('0x1d'),_0x987d76[_0xd1d2('0x1e')]);}}}if(!_0x53b555){logger[_0xd1d2('0xc')](_0xd1d2('0x1f'));_0x987d76['userEmail']=_0x987d76['adminEmail'];_0x987d76[_0xd1d2('0x1e')]=_0x987d76[_0xd1d2('0x12')];_0x53b555=!![];}if(_0x53b555){_0x1a0811(_0x987d76);}else{_0x554a3a({'statusCode':0x194,'message':_0xd1d2('0x14')});}}else{_0x554a3a({'statusCode':0x194,'message':_0xd1d2('0x14')});}})[_0xd1d2('0x15')](function(_0x10a4da){logger[_0xd1d2('0x20')]('['+[_0x185ac0[_0xd1d2('0x21')]()]+']',_0x10a4da[_0xd1d2('0x16')]);_0x554a3a(_0x10a4da);});});};}function searchContact(_0x561a14,_0x1a1bcf,_0x3501da,_0x55fa72){return new Promise(function(_0x4aee7a,_0x17bbf1){var _0x29fdef={'method':_0xd1d2('0xa'),'headers':_0x1a1bcf,'uri':_0x561a14+'/api/lookup?q='+_0x55fa72+_0xd1d2('0x22')+_0x3501da+'&entities=contact','json':!![]};rp(_0x29fdef)[_0xd1d2('0x19')](function(_0x41f8e9){var _0x6a3267=_[_0xd1d2('0x23')](_0x41f8e9[_0xd1d2('0x24')][_0xd1d2('0x24')],[_0x3501da,_0x55fa72]);_0x4aee7a(_0x6a3267);})[_0xd1d2('0x15')](function(_0x558f6d){_0x17bbf1(_0x558f6d);});});}function getEndUser(_0x19b0e4,_0x4a3d47,_0x2e3a71){return function(_0x45a374){return new Promise(function(_0x20fbea,_0x34e55b){logger[_0xd1d2('0xc')](util['format'](_0xd1d2('0x25'),_0x45a374[_0xd1d2('0x26')]));searchContact(_0x2e3a71,_0x4a3d47,_0xd1d2('0x27'),_0x45a374['contactNumber'])[_0xd1d2('0x19')](function(_0x499748){if(_0x499748){_0x45a374[_0xd1d2('0x28')]=_0x499748['id'];logger[_0xd1d2('0xc')](_0xd1d2('0x29'),_0x45a374['endUserId']);return _0x20fbea(_0x45a374);}searchContact(_0x2e3a71,_0x4a3d47,_0xd1d2('0x2a'),_0x45a374[_0xd1d2('0x26')])[_0xd1d2('0x19')](function(_0x4b2f35){if(_0x4b2f35){_0x45a374['endUserId']=_0x4b2f35['id'];logger[_0xd1d2('0xc')]('Contact\x20found\x20work_number:',_0x45a374[_0xd1d2('0x28')]);return _0x20fbea(_0x45a374);}createEndUser(_0x45a374,_0x19b0e4,_0x4a3d47,_0x2e3a71)[_0xd1d2('0x19')](function(_0x264eb0){logger[_0xd1d2('0xc')](_0xd1d2('0x2b'),_0x264eb0[_0xd1d2('0x28')]);return _0x20fbea(_0x264eb0);});});})[_0xd1d2('0x15')](function(_0x1e69f8){_0x34e55b(_0x1e69f8);});});};}function createEndUser(_0x132ff5,_0x484730,_0x53ca81,_0x27a5de){return new Promise(function(_0x10d4df,_0xd874e){var _0x4b5fd7=moment();var _0x4e1c23={'method':_0xd1d2('0x2c'),'uri':_0x27a5de+_0xd1d2('0x2d'),'body':{'contact':{'last_name':_0x132ff5[_0xd1d2('0x26')],'work_number':_0x132ff5['contactNumber'],'mobile_number':_0x132ff5[_0xd1d2('0x26')],'owner_id':_0x132ff5['userId'],'created_at':_0x4b5fd7[_0xd1d2('0x2e')](_0xd1d2('0x2f'))}},'json':!![]};_0x4e1c23['headers']=_0x53ca81;logger[_0xd1d2('0xc')](_0xd1d2('0x30'));return rp(_0x4e1c23)[_0xd1d2('0x19')](function(_0x3380f4){_0x132ff5[_0xd1d2('0x28')]=_0x3380f4[_0xd1d2('0x31')]['id'];_0x10d4df(_0x132ff5);})[_0xd1d2('0x15')](function(_0x408a3c){logger[_0xd1d2('0x20')]('['+[_0x484730[_0xd1d2('0x21')]()]+']',_0x408a3c[_0xd1d2('0x16')]);_0xd874e(_0x408a3c[_0xd1d2('0x16')]);});});}function getTicket(_0x3c95b4,_0x1ce179,_0x23c533,_0x36ff99,_0x5c0534){return function(_0x2bc30a){logger[_0xd1d2('0xc')](_0xd1d2('0x32'));return new Promise(function(_0x2caa1a,_0x661f96){var _0x160b9b=moment();var _0x25298d={'method':_0xd1d2('0x2c'),'uri':_0x23c533+_0xd1d2('0x33'),'body':{'title':intUtil[_0xd1d2('0x34')](_0x36ff99[_0xd1d2('0x35')],_0x5c0534,'\x20'),'description':intUtil['getString'](_0x36ff99['Descriptions'],_0x5c0534,'\x0a'),'owner_id':_0x2bc30a[_0xd1d2('0x1e')],'creater_id':_0x2bc30a[_0xd1d2('0x12')],'targetable_id':_0x2bc30a['endUserId'],'targetable_type':_0xd1d2('0x36'),'created_at':_0x160b9b[_0xd1d2('0x2e')](_0xd1d2('0x2f')),'due_date':_0x160b9b['add'](0x1e,'m')[_0xd1d2('0x2e')](_0xd1d2('0x2f'))},'json':!![]};_0x25298d[_0xd1d2('0x17')]=_0x1ce179;return rp(_0x25298d)[_0xd1d2('0x19')](function(_0x3eccdf){_0x2bc30a[_0xd1d2('0x37')]=_0x3eccdf[_0xd1d2('0x38')]['id'];logger[_0xd1d2('0xc')](_0xd1d2('0x39'),_0x2bc30a[_0xd1d2('0x37')]);_0x2caa1a(_0x2bc30a);})[_0xd1d2('0x15')](function(_0x2ff50a){logger[_0xd1d2('0x20')]('['+[_0x3c95b4['toUpperCase']()]+']',_0x2ff50a[_0xd1d2('0x16')]);_0x661f96(_0x2ff50a[_0xd1d2('0x16')]);});});};}function emit(_0x223dda,_0x1dc2f9,_0x1d660b){var _0x280d37={'uri':_0x223dda+'/contacts/'+_0x1d660b};io['to'](util[_0xd1d2('0x2e')](_0xd1d2('0x3a'),_0x1dc2f9))[_0xd1d2('0x3b')](_0xd1d2('0x3c'),_0x280d37);}exports['cs']=function(_0x3894e5,_0x8c9528,_0x3da10d,_0x50890e,_0x3cd800,_0x49b72c,_0x336f04,_0x468844){var _0x1169f7={};var _0x1195f0={'Authorization':_0xd1d2('0x3d')+_0x49b72c[_0xd1d2('0x3e')]};_0x49b72c[_0xd1d2('0x3f')]=intUtil[_0xd1d2('0x40')](_0x49b72c[_0xd1d2('0x3f')]);_0x49b72c['serverUrl']=intUtil[_0xd1d2('0x40')](_0x49b72c[_0xd1d2('0x41')]);var _0x400bad=_0x49b72c[_0xd1d2('0x3f')];_0x1169f7['adminEmail']=_0x49b72c[_0xd1d2('0x42')];_0x1169f7[_0xd1d2('0x26')]=_0x468844[_0xd1d2('0x43')]()===_0xd1d2('0x44')?_0x8c9528[_0xd1d2('0x45')]:_0x8c9528[_0xd1d2('0x46')];_0x1169f7['callDirection']=_0x468844===_0xd1d2('0x47')||_0x468844===_0xd1d2('0x48')?_0xd1d2('0x47'):_0xd1d2('0x44');if(_0x50890e){_0x1169f7['agentEmail']=_0x50890e[_0xd1d2('0x10')];}var _0x3e041a=util['format'](_0xd1d2('0x49'),_0x49b72c[_0xd1d2('0x41')],_0x8c9528[_0xd1d2('0x4a')],md5(_0x8c9528[_0xd1d2('0x4a')]));if(_0x3cd800&&_0x3cd800[_0xd1d2('0x4b')]){logger['info'](_0xd1d2('0x4c'),_0xd1d2('0x4d'));_0x8c9528[_0xd1d2('0x4e')]=_0x3e041a;}else if(_0x336f04&&_0x336f04[_0xd1d2('0x4f')]&&_0x336f04[_0xd1d2('0x4f')]!=='none'){logger[_0xd1d2('0xc')](_0xd1d2('0x50'),_0xd1d2('0x4d'));_0x8c9528[_0xd1d2('0x4e')]=_0x3e041a;}else{_0x8c9528[_0xd1d2('0x4e')]='';}return getAdminId(_0x1169f7,_0x468844,_0x1195f0,_0x400bad)[_0xd1d2('0x19')](getUser(_0x468844,_0x1195f0,_0x400bad))[_0xd1d2('0x19')](getEndUser(_0x468844,_0x1195f0,_0x400bad))[_0xd1d2('0x19')](getTicket(_0x468844,_0x1195f0,_0x400bad,_0x3da10d,_0x8c9528))[_0xd1d2('0x19')](function(_0x3d8083){logger['info'](util[_0xd1d2('0x2e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3d8083[_0xd1d2('0x37')]));if(_0x468844!=='unmanaged'){logger['info']('['+[_0x468844[_0xd1d2('0x21')]()]+']',_0xd1d2('0x51'));emit(_0x400bad,_0x50890e[_0xd1d2('0x52')],_0x3d8083[_0xd1d2('0x28')]);}})[_0xd1d2('0x15')](function(_0x1c5cdd){logger[_0xd1d2('0x20')]('['+[_0x468844[_0xd1d2('0x21')]()]+_0xd1d2('0x53'),util['inspect'](_0x1c5cdd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc02b=['util','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','Requested\x20Resource\x20not\x20Found','error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','catch','toUpperCase','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','adminId','add','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise'];(function(_0x22f036,_0x3c285d){var _0x1d68c3=function(_0x3327ac){while(--_0x3327ac){_0x22f036['push'](_0x22f036['shift']());}};_0x1d68c3(++_0x3c285d);}(_0xc02b,0xfe));var _0xbc02=function(_0x1123bb,_0x54472a){_0x1123bb=_0x1123bb-0x0;var _0xdeb602=_0xc02b[_0x1123bb];return _0xdeb602;};'use strict';var _=require('lodash');var rp=require(_0xbc02('0x0'));var md5=require('md5');var util=require(_0xbc02('0x1'));var moment=require('moment');var Promise=require(_0xbc02('0x2'));var Redis=require(_0xbc02('0x3'));var intUtil=require(_0xbc02('0x4'));var config=require('../../../../config/environment');var logger=require(_0xbc02('0x5'))(_0xbc02('0x6'));config[_0xbc02('0x7')]=_[_0xbc02('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbc02('0x9'))(new Redis(config[_0xbc02('0x7')]));function getAdminId(_0x46b610,_0x7055da,_0x45a804,_0x53f40e){return new Promise(function(_0x4627f7,_0x58f25a){var _0xe56241=![];var _0x5b04d5={'method':_0xbc02('0xa'),'uri':_0x53f40e+_0xbc02('0xb'),'json':!![]};_0x5b04d5[_0xbc02('0xc')]=_0x45a804;logger[_0xbc02('0xd')](_0xbc02('0xe'));return rp(_0x5b04d5)[_0xbc02('0xf')](function(_0x31f27a){if(_0x31f27a){var _0x17e5f0=_0x31f27a[_0xbc02('0x10')];var _0x44a599=null;for(_0x44a599=0x0;_0x44a599<_0x17e5f0[_0xbc02('0x11')];_0x44a599++){if(_0x17e5f0[_0x44a599][_0xbc02('0x12')]===_0x46b610[_0xbc02('0x13')]){_0x46b610['adminId']=_0x17e5f0[_0x44a599]['id'];_0xe56241=!![];}}if(_0xe56241){logger[_0xbc02('0xd')]('Admin\x20found:',_0x46b610['adminId']);_0x4627f7(_0x46b610);}else{_0x58f25a({'statusCode':0x194,'message':_0xbc02('0x14')});}}else{_0x58f25a({'statusCode':0x194,'message':_0xbc02('0x14')});}})['catch'](function(_0x5115fb){logger[_0xbc02('0x15')]('['+[_0x7055da['toUpperCase']()]+']',_0x5115fb[_0xbc02('0x16')]);_0x58f25a(_0x5115fb);});});}function getUser(_0x411849,_0x37abb9,_0x317e30){return function(_0x3cbf7c){return new Promise(function(_0x42499f,_0x4d35de){var _0x37c9ac={'method':_0xbc02('0xa'),'uri':_0x317e30+_0xbc02('0xb'),'json':!![]};_0x37c9ac[_0xbc02('0xc')]=_0x37abb9;logger['info'](_0xbc02('0x17'));return rp(_0x37c9ac)[_0xbc02('0xf')](function(_0x4beafc){if(_0x4beafc){var _0x548d04=_0x4beafc[_0xbc02('0x10')];var _0x357258=![];var _0x32c8c6=null;if(_0x3cbf7c[_0xbc02('0x18')]!==null){logger['info'](_0xbc02('0x19'),_0x3cbf7c[_0xbc02('0x18')]);_0x3cbf7c[_0xbc02('0x1a')]=_0x3cbf7c[_0xbc02('0x18')];for(_0x32c8c6=0x0;_0x32c8c6<_0x548d04[_0xbc02('0x11')];_0x32c8c6++){if(_0x548d04[_0x32c8c6]['email']===_0x3cbf7c[_0xbc02('0x18')]){_0x357258=!![];_0x3cbf7c[_0xbc02('0x1b')]=_0x548d04[_0x32c8c6]['id'];logger['info'](_0xbc02('0x1c'),_0x3cbf7c[_0xbc02('0x1b')]);}}}if(!_0x357258){logger[_0xbc02('0xd')](_0xbc02('0x1d'));_0x3cbf7c[_0xbc02('0x1a')]=_0x3cbf7c[_0xbc02('0x13')];_0x3cbf7c[_0xbc02('0x1b')]=_0x3cbf7c['adminId'];_0x357258=!![];}if(_0x357258){_0x42499f(_0x3cbf7c);}else{_0x4d35de({'statusCode':0x194,'message':_0xbc02('0x14')});}}else{_0x4d35de({'statusCode':0x194,'message':_0xbc02('0x14')});}})[_0xbc02('0x1e')](function(_0x51e025){logger[_0xbc02('0x15')]('['+[_0x411849[_0xbc02('0x1f')]()]+']',_0x51e025['message']);_0x4d35de(_0x51e025);});});};}function searchContact(_0x313a8c,_0x5b59c2,_0x1e3507,_0x174de1){return new Promise(function(_0x57c24b,_0x29df53){var _0x5b6571={'method':'GET','headers':_0x5b59c2,'uri':_0x313a8c+_0xbc02('0x20')+_0x174de1+'&f='+_0x1e3507+_0xbc02('0x21'),'json':!![]};rp(_0x5b6571)[_0xbc02('0xf')](function(_0x215234){var _0x37fa5b=_[_0xbc02('0x22')](_0x215234[_0xbc02('0x23')][_0xbc02('0x23')],[_0x1e3507,_0x174de1]);_0x57c24b(_0x37fa5b);})['catch'](function(_0x7e7df2){_0x29df53(_0x7e7df2);});});}function getEndUser(_0x4d98ab,_0x635c98,_0x49c074){return function(_0x5d4a9e){return new Promise(function(_0x5b558c,_0x161e1f){logger[_0xbc02('0xd')](util[_0xbc02('0x24')](_0xbc02('0x25'),_0x5d4a9e['contactNumber']));searchContact(_0x49c074,_0x635c98,_0xbc02('0x26'),_0x5d4a9e[_0xbc02('0x27')])[_0xbc02('0xf')](function(_0x38fc0b){if(_0x38fc0b){_0x5d4a9e['endUserId']=_0x38fc0b['id'];logger[_0xbc02('0xd')](_0xbc02('0x28'),_0x5d4a9e['endUserId']);return _0x5b558c(_0x5d4a9e);}searchContact(_0x49c074,_0x635c98,_0xbc02('0x29'),_0x5d4a9e['contactNumber'])[_0xbc02('0xf')](function(_0x221403){if(_0x221403){_0x5d4a9e[_0xbc02('0x2a')]=_0x221403['id'];logger[_0xbc02('0xd')](_0xbc02('0x2b'),_0x5d4a9e[_0xbc02('0x2a')]);return _0x5b558c(_0x5d4a9e);}createEndUser(_0x5d4a9e,_0x4d98ab,_0x635c98,_0x49c074)[_0xbc02('0xf')](function(_0x38f70a){logger[_0xbc02('0xd')]('Contact\x20created:',_0x38f70a['endUserId']);return _0x5b558c(_0x38f70a);});});})[_0xbc02('0x1e')](function(_0x540e88){_0x161e1f(_0x540e88);});});};}function createEndUser(_0x7fedfb,_0x4fc11,_0xade618,_0x5a0b79){return new Promise(function(_0x2fe31b,_0x535836){var _0x34235e=moment();var _0x26d9de={'method':_0xbc02('0x2c'),'uri':_0x5a0b79+_0xbc02('0x2d'),'body':{'contact':{'last_name':_0x7fedfb[_0xbc02('0x27')],'work_number':_0x7fedfb[_0xbc02('0x27')],'mobile_number':_0x7fedfb[_0xbc02('0x27')],'owner_id':_0x7fedfb[_0xbc02('0x1b')],'created_at':_0x34235e['format'](_0xbc02('0x2e'))}},'json':!![]};_0x26d9de[_0xbc02('0xc')]=_0xade618;logger['info'](_0xbc02('0x2f'));return rp(_0x26d9de)[_0xbc02('0xf')](function(_0x100dbb){_0x7fedfb['endUserId']=_0x100dbb[_0xbc02('0x30')]['id'];_0x2fe31b(_0x7fedfb);})[_0xbc02('0x1e')](function(_0x57f953){logger[_0xbc02('0x15')]('['+[_0x4fc11[_0xbc02('0x1f')]()]+']',_0x57f953[_0xbc02('0x16')]);_0x535836(_0x57f953[_0xbc02('0x16')]);});});}function getTicket(_0x44ae97,_0x1f2582,_0x17e602,_0x2c54da,_0x30a106){return function(_0x26ba8c){logger[_0xbc02('0xd')](_0xbc02('0x31'));return new Promise(function(_0x1e0905,_0x42a6b7){var _0x38b2df=moment();var _0x508ff0={'method':_0xbc02('0x2c'),'uri':_0x17e602+_0xbc02('0x32'),'body':{'title':intUtil[_0xbc02('0x33')](_0x2c54da['Subjects'],_0x30a106,'\x20'),'description':intUtil[_0xbc02('0x33')](_0x2c54da[_0xbc02('0x34')],_0x30a106,'\x0a'),'owner_id':_0x26ba8c[_0xbc02('0x1b')],'creater_id':_0x26ba8c[_0xbc02('0x35')],'targetable_id':_0x26ba8c[_0xbc02('0x2a')],'targetable_type':'Contact','created_at':_0x38b2df[_0xbc02('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x38b2df[_0xbc02('0x36')](0x1e,'m')[_0xbc02('0x24')](_0xbc02('0x2e'))},'json':!![]};_0x508ff0[_0xbc02('0xc')]=_0x1f2582;return rp(_0x508ff0)['then'](function(_0x4989ea){_0x26ba8c[_0xbc02('0x37')]=_0x4989ea['task']['id'];logger[_0xbc02('0xd')](_0xbc02('0x38'),_0x26ba8c['ticketId']);_0x1e0905(_0x26ba8c);})['catch'](function(_0x5a0830){logger['error']('['+[_0x44ae97[_0xbc02('0x1f')]()]+']',_0x5a0830[_0xbc02('0x16')]);_0x42a6b7(_0x5a0830[_0xbc02('0x16')]);});});};}function emit(_0x2767aa,_0x221768,_0x197d2a){var _0x341faa={'uri':_0x2767aa+'/contacts/'+_0x197d2a};io['to'](util[_0xbc02('0x24')](_0xbc02('0x39'),_0x221768))[_0xbc02('0x3a')](_0xbc02('0x3b'),_0x341faa);}exports['cs']=function(_0x5c5f52,_0x2c48c9,_0x572197,_0x36a6a4,_0x35441c,_0x3710a5,_0x3fe4a0,_0x13ea01){var _0x387254={};var _0x1349f5={'Authorization':_0xbc02('0x3c')+_0x3710a5[_0xbc02('0x3d')]};_0x3710a5[_0xbc02('0x3e')]=intUtil[_0xbc02('0x3f')](_0x3710a5[_0xbc02('0x3e')]);_0x3710a5[_0xbc02('0x40')]=intUtil['stripTrailingSlash'](_0x3710a5[_0xbc02('0x40')]);var _0x395db9=_0x3710a5[_0xbc02('0x3e')];_0x387254[_0xbc02('0x13')]=_0x3710a5[_0xbc02('0x41')];_0x387254[_0xbc02('0x27')]=_0x13ea01['toLowerCase']()===_0xbc02('0x42')?_0x2c48c9[_0xbc02('0x43')]:_0x2c48c9['calleridnum'];_0x387254[_0xbc02('0x44')]=_0x13ea01===_0xbc02('0x45')||_0x13ea01===_0xbc02('0x46')?_0xbc02('0x45'):_0xbc02('0x42');if(_0x36a6a4){_0x387254[_0xbc02('0x18')]=_0x36a6a4['email'];}var _0x248b3f=util[_0xbc02('0x24')](_0xbc02('0x47'),_0x3710a5[_0xbc02('0x40')],_0x2c48c9[_0xbc02('0x48')],md5(_0x2c48c9[_0xbc02('0x48')]));if(_0x35441c&&_0x35441c[_0xbc02('0x49')]){logger[_0xbc02('0xd')](_0xbc02('0x4a'),_0xbc02('0x4b'));_0x2c48c9['recordingURL']=_0x248b3f;}else if(_0x3fe4a0&&_0x3fe4a0[_0xbc02('0x4c')]&&_0x3fe4a0['recordingFormat']!==_0xbc02('0x4d')){logger['info'](_0xbc02('0x4e'),_0xbc02('0x4b'));_0x2c48c9[_0xbc02('0x4f')]=_0x248b3f;}else{_0x2c48c9[_0xbc02('0x4f')]='';}return getAdminId(_0x387254,_0x13ea01,_0x1349f5,_0x395db9)[_0xbc02('0xf')](getUser(_0x13ea01,_0x1349f5,_0x395db9))[_0xbc02('0xf')](getEndUser(_0x13ea01,_0x1349f5,_0x395db9))[_0xbc02('0xf')](getTicket(_0x13ea01,_0x1349f5,_0x395db9,_0x572197,_0x2c48c9))[_0xbc02('0xf')](function(_0x2755b4){logger[_0xbc02('0xd')](util[_0xbc02('0x24')](_0xbc02('0x50'),_0x2755b4[_0xbc02('0x37')]));if(_0x13ea01!==_0xbc02('0x46')){logger[_0xbc02('0xd')]('['+[_0x13ea01[_0xbc02('0x1f')]()]+']',_0xbc02('0x51'));emit(_0x395db9,_0x36a6a4[_0xbc02('0x52')],_0x2755b4['endUserId']);}})[_0xbc02('0x1e')](function(_0x59e1fd){logger[_0xbc02('0x15')]('['+[_0x13ea01['toUpperCase']()]+_0xbc02('0x53'),util[_0xbc02('0x54')](_0x59e1fd,{'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 1922c46..d38592f 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 _0xfd2f=['routeId','outbound','log','EVENT\x20UNKNOWN','freshdesk','zoho','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue'];(function(_0x23f50f,_0x437357){var _0x26e2f3=function(_0x463099){while(--_0x463099){_0x23f50f['push'](_0x23f50f['shift']());}};_0x26e2f3(++_0x437357);}(_0xfd2f,0x147));var _0xffd2=function(_0x415f3f,_0x4addb7){_0x415f3f=_0x415f3f-0x0;var _0xf78af4=_0xfd2f[_0x415f3f];return _0xf78af4;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xffd2('0x0'));var zoho=require(_0xffd2('0x1'));var desk=require(_0xffd2('0x2'));var vtiger=require(_0xffd2('0x3'));var servicenow=require(_0xffd2('0x4'));var dynamics365=require(_0xffd2('0x5'));var freshsales=require(_0xffd2('0x6'));var integrations=[_0xffd2('0x7'),_0xffd2('0x8'),_0xffd2('0x9'),'freshdesk','zoho',_0xffd2('0xa'),_0xffd2('0xb'),_0xffd2('0xc'),_0xffd2('0xd'),_0xffd2('0xe')];exports[_0xffd2('0xf')]=function(_0x166b52,_0x10e8c6,_0x5be3f5,_0xea568e,_0x458a50,_0x2a1141){if(_0x5be3f5){if(_['includes'](integrations,_0x166b52[_0xffd2('0x10')][_0xffd2('0x11')]())){try{var _0x552286=null;var _0x16b387='';var _0x148481=_0x5be3f5[_0x166b52[_0xffd2('0x10')][_0xffd2('0x11')]()];if(_0x148481){var _0x30f8db=_0x148481[_0x166b52[_0xffd2('0x12')]];if(_0x30f8db){var _0x6ff89e=_[_0xffd2('0x13')](_0x30f8db[_0xffd2('0x14')],{'id':parseInt(_0x166b52[_0xffd2('0x15')],0xa)});if(_0x6ff89e){if(_0xea568e){if(_0x458a50&&_0x10e8c6[_0xffd2('0x16')]){_0x16b387='queue';}else if(_0x10e8c6[_0xffd2('0x17')]){_0x16b387=_0xffd2('0x18');}else{console[_0xffd2('0x19')](_0xffd2('0x1a'),_0x10e8c6);}}else{_0x16b387='unmanaged';}switch(_0x166b52[_0xffd2('0x10')]['toLowerCase']()){case'zendesk':zendesk[_0x16b387](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141);break;case _0xffd2('0x8'):salesforce[_0x16b387](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141);break;case _0xffd2('0x9'):sugarcrm[_0x16b387](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141);break;case _0xffd2('0x1b'):freshdesk[_0x16b387](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141);break;case _0xffd2('0x1c'):zoho[_0x16b387](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141);break;case _0xffd2('0xa'):desk[_0x16b387](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141);break;case _0xffd2('0xb'):vtiger[_0x16b387](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141);break;case _0xffd2('0xd'):freshsales['cs'](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141,_0x16b387);break;case _0xffd2('0xe'):servicenow['cs'](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141,_0x16b387);break;case _0xffd2('0xc'):dynamics365['cs'](_0x166b52,_0x10e8c6,_0x6ff89e,_0xea568e,_0x458a50,_0x30f8db,_0x2a1141,_0x16b387);break;default:console[_0xffd2('0x19')]('unknown\x20integration');}}else{_0x552286=require(_0xffd2('0x1d'))(_0x166b52[_0xffd2('0x10')][_0xffd2('0x11')]());_0x552286[_0xffd2('0x1e')](_0xffd2('0x1f'),util[_0xffd2('0x20')](_0xffd2('0x21'),_0x166b52[_0xffd2('0x10')]['toLowerCase'](),_0x166b52['data3']));}}else{_0x552286=require(_0xffd2('0x1d'))(_0x166b52[_0xffd2('0x10')][_0xffd2('0x11')]());_0x552286[_0xffd2('0x1e')](_0xffd2('0x1f'),util[_0xffd2('0x20')](_0xffd2('0x22'),_0x166b52[_0xffd2('0x10')][_0xffd2('0x11')](),_0x166b52[_0xffd2('0x12')]));}}else{}}catch(_0x298c90){console[_0xffd2('0x1e')](_0x298c90);}}}}; \ No newline at end of file +var _0x7bcd=['unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','dynamics365'];(function(_0xb18b17,_0x121eb1){var _0xd1ff7c=function(_0x3eea6f){while(--_0x3eea6f){_0xb18b17['push'](_0xb18b17['shift']());}};_0xd1ff7c(++_0x121eb1);}(_0x7bcd,0x19e));var _0xd7bc=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x7bcd[_0x470bfb];return _0x2f5d97;};'use strict';var _=require('lodash');var util=require(_0xd7bc('0x0'));var zendesk=require(_0xd7bc('0x1'));var salesforce=require(_0xd7bc('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xd7bc('0x3'));var zoho=require(_0xd7bc('0x4'));var desk=require('./desk');var vtiger=require(_0xd7bc('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0xd7bc('0x6'));var freshsales=require(_0xd7bc('0x7'));var integrations=[_0xd7bc('0x8'),_0xd7bc('0x9'),_0xd7bc('0xa'),_0xd7bc('0xb'),_0xd7bc('0xc'),_0xd7bc('0xd'),_0xd7bc('0xe'),'dynamics365','freshsales',_0xd7bc('0xf')];exports['exec']=function(_0x462153,_0x2d8eac,_0x8dfd3,_0xe8f052,_0x257bdc,_0x2f6ec2){if(_0x8dfd3){if(_[_0xd7bc('0x10')](integrations,_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]())){try{var _0x5eb562=null;var _0x1bb454='';var _0x4dbc2e=_0x8dfd3[_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]()];if(_0x4dbc2e){var _0x2fc381=_0x4dbc2e[_0x462153[_0xd7bc('0x13')]];if(_0x2fc381){var _0xacfa71=_[_0xd7bc('0x14')](_0x2fc381[_0xd7bc('0x15')],{'id':parseInt(_0x462153[_0xd7bc('0x16')],0xa)});if(_0xacfa71){if(_0xe8f052){if(_0x257bdc&&_0x2d8eac['queue']){_0x1bb454=_0xd7bc('0x17');}else if(_0x2d8eac[_0xd7bc('0x18')]){_0x1bb454=_0xd7bc('0x19');}else{console[_0xd7bc('0x1a')](_0xd7bc('0x1b'),_0x2d8eac);}}else{_0x1bb454=_0xd7bc('0x1c');}switch(_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]()){case'zendesk':zendesk[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0x9'):salesforce[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xa'):sugarcrm[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xb'):freshdesk[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xc'):zoho[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xd'):desk[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xe'):vtiger[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case'freshsales':freshsales['cs'](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2,_0x1bb454);break;case _0xd7bc('0xf'):servicenow['cs'](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2,_0x1bb454);break;case _0xd7bc('0x1d'):dynamics365['cs'](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2,_0x1bb454);break;default:console[_0xd7bc('0x1a')](_0xd7bc('0x1e'));}}else{_0x5eb562=require(_0xd7bc('0x1f'))(_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]());_0x5eb562[_0xd7bc('0x20')](_0xd7bc('0x21'),util['format'](_0xd7bc('0x22'),_0x462153['data1']['toLowerCase'](),_0x462153['data3']));}}else{_0x5eb562=require('../../../../config/logger')(_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]());_0x5eb562['error'](_0xd7bc('0x21'),util[_0xd7bc('0x23')](_0xd7bc('0x24'),_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')](),_0x462153[_0xd7bc('0x13')]));}}else{}}catch(_0x2dad0a){console[_0xd7bc('0x20')](_0x2dad0a);}}}}; \ 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 2e27720..2e36db0 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 _0xe89a=['cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','length','Contact','contact','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','format','upperFirst','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','newTab','trigger:browser:url','error','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','calleridnum',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','util','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','ticketType','Task','utc','IsReminderSet','endUserType','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','then','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.'];(function(_0xcb45c5,_0x451c98){var _0x3626eb=function(_0x2c652b){while(--_0x2c652b){_0xcb45c5['push'](_0xcb45c5['shift']());}};_0x3626eb(++_0x451c98);}(_0xe89a,0x1c5));var _0xae89=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe89a[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var rp=require(_0xae89('0x0'));var moment=require(_0xae89('0x1'));var BPromise=require(_0xae89('0x2'));var md5=require(_0xae89('0x3'));var jsforce=require('jsforce');var util=require(_0xae89('0x4'));var Redis=require(_0xae89('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xae89('0x6'))('salesforce');config['redis']=_[_0xae89('0x7')](config[_0xae89('0x8')],{'host':_0xae89('0x9'),'port':0x18eb});var io=require(_0xae89('0xa'))(new Redis(config[_0xae89('0x8')]));function emit(_0x431447,_0x42999c,_0x61edf2){io['to'](_0x431447)[_0xae89('0xb')](_0x42999c,_0x61edf2);}function getTicket(_0x221dde,_0x5bb22f,_0x4984ed,_0x206e17,_0x552345,_0x57252e,_0xc5466,_0x518569){var _0x11aad2=Object[_0xae89('0xc')]({},{'OwnerId':_0x5bb22f['id'],'Subject':intUtil[_0xae89('0xd')](_0x206e17['Subjects'],_0x552345,'\x20'),'Description':intUtil[_0xae89('0xd')](_0x206e17['Descriptions'],_0x552345,'\x0a')},getCustomFields(_0x57252e,_0x552345));if(_0x4984ed){if(_0x206e17[_0xae89('0xe')]===_0xae89('0xf')){_0x11aad2['ActivityDate']=moment[_0xae89('0x10')]();_0x11aad2[_0xae89('0x11')]=![];_0x11aad2['IsRecurrence']=![];if(_0x4984ed[_0xae89('0x12')]==='contact'||_0x4984ed['endUserType']===_0xae89('0x13')){_0x11aad2[_0xae89('0x14')]=_0x4984ed['id'];}else if(_0x4984ed['endUserType']===_0xae89('0x15')){_0x11aad2[_0xae89('0x16')]=_0x4984ed['id'];}}else if(_0x206e17[_0xae89('0xe')]==='Case'){if(_0x4984ed[_0xae89('0x12')]==='contact'){_0x11aad2[_0xae89('0x17')]=_0x4984ed['id'];}else if(_0x4984ed[_0xae89('0x12')]==='account'){_0x11aad2[_0xae89('0x18')]=_0x4984ed['id'];}else if(_0x4984ed[_0xae89('0x12')]===_0xae89('0x13')&&_0x206e17[_0xae89('0x19')]){_0x11aad2[_0x206e17['leadId']]=_0x4984ed['id'];}else{logger['info'](_0xae89('0x1a'));}}}return _0xc5466[_0xae89('0x1b')](_0x206e17['ticketType'])[_0xae89('0x1c')](_0x11aad2);}function getUser(_0x227450,_0x565999,_0x3162a3){if(!_[_0xae89('0x1d')](_0x565999)&&intUtil[_0xae89('0x1e')](_0x565999)){var _0x3cfccb={'Email':_0x565999};var _0x5b9d50={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3162a3[_0xae89('0x1b')]('User')[_0xae89('0x1f')](_0x3cfccb,_0x5b9d50)[_0xae89('0x20')]()['then'](function(_0x4338e7){if(_0x4338e7['length']){var _0x54e127=_['find'](_0x4338e7,function(_0x37c428){return _0x37c428[_0xae89('0x21')]===_0x565999;});if(_0x54e127){logger[_0xae89('0x22')]('Agent\x20%s\x20found.',_0x565999);return BPromise[_0xae89('0x23')]({'id':_0x54e127['Id'],'name':_0x54e127[_0xae89('0x24')]});}}else{logger[_0xae89('0x22')](_0xae89('0x25'),_0x565999);return _0x3162a3[_0xae89('0x26')]()['then'](function(_0x1fff70){return BPromise[_0xae89('0x23')]({'id':_0x1fff70['user_id'],'name':_0x1fff70[_0xae89('0x27')]});});}});}else{logger[_0xae89('0x22')](_0xae89('0x25'),_0x565999);return _0x3162a3['identity']()[_0xae89('0x28')](function(_0x5d0f5f){return BPromise[_0xae89('0x23')]({'id':_0x5d0f5f[_0xae89('0x29')],'name':_0x5d0f5f[_0xae89('0x27')]});});}}function getEndUser(_0x315e1f,_0x463eea,_0x139056,_0x2df7ce,_0x4dda13){var _0x257ef9={'$or':{'Phone':_0x2df7ce}};var _0x36fac4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xae89('0x23')]()['then'](function(){logger['info'](_0xae89('0x2a'),_0x2df7ce,_0x463eea['moduleSearch']);switch(_0x463eea['moduleSearch']){case'contact_lead':var _0x258422=_[_0xae89('0x2b')](_0x257ef9);if(_0x463eea[_0xae89('0x2c')]){var _0xfc3e92={};_0xfc3e92[_0x463eea[_0xae89('0x2c')]]=_0x2df7ce;_[_0xae89('0x2d')](_0x258422[_0xae89('0x2e')],_0xfc3e92);}return _0x4dda13[_0xae89('0x1b')]('Contact')[_0xae89('0x1f')](_0x258422,_0x36fac4)[_0xae89('0x20')]()[_0xae89('0x28')](function(_0x97aabd){if(_0x97aabd&&_0x97aabd['length']){return _0x97aabd;}else{var _0x11dda9=_[_0xae89('0x2b')](_0x257ef9);if(_0x463eea['additionalSearchLead']){var _0x541373={};_0x541373[_0x463eea[_0xae89('0x2f')]]=_0x2df7ce;_[_0xae89('0x2d')](_0x11dda9[_0xae89('0x2e')],_0x541373);}return _0x4dda13[_0xae89('0x1b')](_0xae89('0x30'))[_0xae89('0x1f')](_0x11dda9,_0x36fac4);}});case _0xae89('0x31'):var _0x35410b=_[_0xae89('0x2b')](_0x257ef9);if(_0x463eea['additionalSearchAccount']){var _0xfc3e92={};_0xfc3e92[_0x463eea[_0xae89('0x32')]]=_0x2df7ce;_[_0xae89('0x2d')](_0x35410b[_0xae89('0x2e')],_0xfc3e92);}return _0x4dda13[_0xae89('0x1b')]('Account')['find'](_0x35410b,_0x36fac4)['execute']()[_0xae89('0x28')](function(_0x4bf5c6){if(_0x4bf5c6&&_0x4bf5c6[_0xae89('0x33')]){return _0x4bf5c6;}else{var _0x180ce1=_[_0xae89('0x2b')](_0x257ef9);if(_0x463eea[_0xae89('0x2c')]){var _0x5ca0af={};_0x5ca0af[_0x463eea[_0xae89('0x2c')]]=_0x2df7ce;_[_0xae89('0x2d')](_0x180ce1['$or'],_0x5ca0af);}return _0x4dda13[_0xae89('0x1b')](_0xae89('0x34'))['find'](_0x180ce1,_0x36fac4)[_0xae89('0x28')](function(_0x2d5f2b){if(_0x2d5f2b&&_0x2d5f2b['length']){return _0x2d5f2b;}else{var _0x45efb9=_[_0xae89('0x2b')](_0x257ef9);if(_0x463eea[_0xae89('0x2f')]){var _0x479366={};_0x479366[_0x463eea[_0xae89('0x2f')]]=_0x2df7ce;_[_0xae89('0x2d')](_0x45efb9[_0xae89('0x2e')],_0x479366);}return _0x4dda13[_0xae89('0x1b')](_0xae89('0x30'))[_0xae89('0x1f')](_0x45efb9,_0x36fac4);}});}});case _0xae89('0x35'):var _0x258422=_[_0xae89('0x2b')](_0x257ef9);if(_0x463eea['additionalSearchContact']){var _0xfc3e92={};_0xfc3e92[_0x463eea['additionalSearchContact']]=_0x2df7ce;_['merge'](_0x258422[_0xae89('0x2e')],_0xfc3e92);}return _0x4dda13[_0xae89('0x1b')](_0xae89('0x34'))[_0xae89('0x1f')](_0x258422,_0x36fac4)['execute']();case'lead':var _0x4145e8=_[_0xae89('0x2b')](_0x257ef9);if(_0x463eea['additionalSearchLead']){var _0xfc3e92={};_0xfc3e92[_0x463eea[_0xae89('0x2f')]]=_0x2df7ce;_[_0xae89('0x2d')](_0x4145e8[_0xae89('0x2e')],_0xfc3e92);}return _0x4dda13[_0xae89('0x1b')]('Lead')[_0xae89('0x1f')](_0x4145e8,_0x36fac4);case _0xae89('0x15'):var _0x35410b=_[_0xae89('0x2b')](_0x257ef9);if(_0x463eea[_0xae89('0x32')]){var _0xfc3e92={};_0xfc3e92[_0x463eea['additionalSearchAccount']]=_0x2df7ce;_[_0xae89('0x2d')](_0x35410b[_0xae89('0x2e')],_0xfc3e92);}return _0x4dda13[_0xae89('0x1b')]('Account')['find'](_0x35410b,_0x36fac4);default:return null;}})[_0xae89('0x28')](function(_0x2f9662){if(_0x2f9662&&_0x2f9662[_0xae89('0x33')]){var _0x4beb65=_[_0xae89('0x36')](_0x2f9662);if(_0x4beb65){return BPromise[_0xae89('0x23')]({'id':_0x4beb65['Id'],'name':_0x4beb65[_0xae89('0x24')],'phone':_0x4beb65[_0xae89('0x37')],'endUserType':_0x4beb65[_0xae89('0x38')]['type'][_0xae89('0x39')]()});}}})[_0xae89('0x28')](function(_0x37f447){if(_0x37f447){logger[_0xae89('0x22')](_0xae89('0x3a'),_0x37f447[_0xae89('0x12')],_0x2df7ce);return BPromise['resolve'](_0x37f447);}else{logger[_0xae89('0x22')](_0xae89('0x3b'),_0x2df7ce);var _0x34b2df={'Phone':_0x2df7ce};if(_0x463eea[_0xae89('0x3c')]){if(_0x463eea[_0xae89('0x3c')]===_0xae89('0x35')){logger[_0xae89('0x22')](_0xae89('0x3d'),_0x2df7ce,_0x463eea['moduleCreate']);_0x34b2df[_0xae89('0x3e')]=_0x139056!==_0xae89('0x3f')?_0x139056:util['format'](_0xae89('0x40'),_0x2df7ce);}else if(_0x463eea[_0xae89('0x3c')]===_0xae89('0x13')){logger[_0xae89('0x22')](_0xae89('0x3d'),_0x2df7ce,_0x463eea[_0xae89('0x3c')]);_0x34b2df[_0xae89('0x3e')]=_0x139056!==_0xae89('0x3f')?_0x139056:util['format']('Caller\x20-\x20%s',_0x2df7ce);_0x34b2df[_0xae89('0x41')]='No\x20Company';}else if(_0x463eea[_0xae89('0x3c')]===_0xae89('0x15')){logger['info'](_0xae89('0x3d'),_0x2df7ce,_0x463eea[_0xae89('0x3c')]);_0x34b2df[_0xae89('0x24')]=_0x139056!==_0xae89('0x3f')?_0x139056:util[_0xae89('0x42')](_0xae89('0x40'),_0x2df7ce);}else{return null;}}return _0x4dda13[_0xae89('0x1b')](_[_0xae89('0x43')](_0x463eea[_0xae89('0x3c')]))[_0xae89('0x1c')](_0x34b2df)['then'](function(_0x1b4cc6){return BPromise[_0xae89('0x23')]({'id':_0x1b4cc6['id'],'endUserType':_0x463eea[_0xae89('0x3c')]});});}});}function getCustomFields(_0x4081e3,_0x5b67c3){var _0x45d488={};if(_0x4081e3['length']>0x0){_[_0xae89('0x44')](_0x4081e3,function(_0x5588d9){if(_[_0xae89('0x45')]([_0xae89('0x46'),_0xae89('0x47')],_0x5588d9[_0xae89('0x48')])&&_0x5588d9[_0xae89('0x49')]){_0x45d488[_0x5588d9['idField']]=_0x5588d9[_0xae89('0x4a')][_0xae89('0x4b')]();}else if(_0x5588d9[_0xae89('0x48')]===_0xae89('0x4c')&&_0x5588d9[_0xae89('0x4d')]&&_0x5588d9[_0xae89('0x49')]){_0x5b67c3[_0x5588d9[_0xae89('0x4d')]]&&(_0x45d488[_0x5588d9[_0xae89('0x49')]]=_0x5b67c3[_0x5588d9[_0xae89('0x4d')]][_0xae89('0x4b')]());}else if(_0x5588d9[_0xae89('0x48')]===_0xae89('0x4e')&&_0x5588d9[_0xae89('0x4f')]&&_0x5588d9[_0xae89('0x4f')][_0xae89('0x50')]&&_0x5588d9[_0xae89('0x49')]){_0x5b67c3[_0x5588d9[_0xae89('0x4f')][_0xae89('0x50')][_0xae89('0x39')]()]&&(_0x45d488[_0x5588d9[_0xae89('0x49')]]=_0x5b67c3[_0x5588d9[_0xae89('0x4f')][_0xae89('0x50')][_0xae89('0x39')]()][_0xae89('0x4b')]());}});}return _0x45d488;}function getConnection(_0x5f47f0){var _0x11a7df=_0x5f47f0[_0xae89('0x51')][_0xae89('0x52')](_0x5f47f0['securityToken']);var _0x428b0e=new jsforce[(_0xae89('0x53'))]({'oauth2':{'loginUrl':_0x5f47f0[_0xae89('0x54')]||_0xae89('0x55'),'clientId':_0x5f47f0[_0xae89('0x56')],'clientSecret':_0x5f47f0[_0xae89('0x57')]}});return _0x428b0e[_0xae89('0x58')](_0x5f47f0[_0xae89('0x59')],_0x11a7df)[_0xae89('0x28')](function(){logger[_0xae89('0x22')](_0xae89('0x5a'));return _0x428b0e;});}exports[_0xae89('0x5b')]=function(_0x486ef5,_0x5af155,_0x1f223d,_0x4e7a50,_0x38d24e,_0x441a30){var _0x222807,_0x35c83d,_0x503098,_0x525569;_0x441a30['serverUrl']=intUtil[_0xae89('0x5c')](_0x441a30[_0xae89('0x5d')]);_0x441a30[_0xae89('0x54')]=intUtil[_0xae89('0x5c')](_0x441a30[_0xae89('0x54')]);if(_0x38d24e&&_0x38d24e[_0xae89('0x5e')]){logger[_0xae89('0x22')](_0xae89('0x5f'),'Recording\x20is\x20enabled!');_0x5af155[_0xae89('0x60')]=util['format'](_0xae89('0x61'),_0x441a30['serverUrl'],_0x5af155[_0xae89('0x62')],md5(_0x5af155[_0xae89('0x62')]));}else{_0x5af155[_0xae89('0x60')]='';}return getConnection(_0x441a30)['then'](function(_0xa5bd53){_0x525569=_0xa5bd53;return getUser(_0x441a30,_0x4e7a50[_0xae89('0x63')],_0x525569);})[_0xae89('0x28')](function(_0x11a50f){_0x222807=_0x11a50f;return getEndUser(_0x441a30,_0x1f223d,_0x5af155[_0xae89('0x64')],_0x5af155['calleridnum'],_0x525569);})[_0xae89('0x28')](function(_0x104ed7){_0x35c83d=_0x104ed7;return getTicket(_0x441a30,_0x222807,_0x35c83d,_0x1f223d,_0x5af155,_0x1f223d[_0xae89('0x65')],_0x525569,'queue');})['then'](function(_0x57fc4a){_0x503098=_0x57fc4a;logger[_0xae89('0x22')](_0xae89('0x66'),_0x503098['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x503098['id'],_0x4e7a50['name'],_0x441a30['type']);switch(_0x441a30['type']){case _0xae89('0x67'):emit(util['format'](_0xae89('0x68'),_0x4e7a50[_0xae89('0x50')]),'trigger:salesforce:display',{'recordId':_0x503098['id']});break;case _0xae89('0x69'):emit(util[_0xae89('0x42')](_0xae89('0x68'),_0x4e7a50[_0xae89('0x50')]),_0xae89('0x6a'),{'uri':util[_0xae89('0x42')]('%s/%s/e',_0x525569['instanceUrl'],_0x503098['id'])});break;default:logger[_0xae89('0x6b')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xae89('0x6c')](function(_0xaff12e){logger[_0xae89('0x6b')](_0xae89('0x5f'),_0xaff12e);});};exports[_0xae89('0x6d')]=function(_0x2c0e80,_0x4d0ac0,_0x28c2a0,_0x2d0c63,_0x3da983,_0x263c6e,_0x5c900b){var _0xc11e44,_0x36389f,_0x55c0ab,_0x54b259;_0x263c6e[_0xae89('0x5d')]=intUtil[_0xae89('0x5c')](_0x263c6e[_0xae89('0x5d')]);_0x263c6e[_0xae89('0x54')]=intUtil[_0xae89('0x5c')](_0x263c6e[_0xae89('0x54')]);if(_0x5c900b&&_0x5c900b[_0xae89('0x6e')]&&_0x5c900b['recordingFormat']!=='none'){logger[_0xae89('0x22')](_0xae89('0x6f'),_0xae89('0x70'));_0x4d0ac0[_0xae89('0x60')]=util['format'](_0xae89('0x61'),_0x263c6e[_0xae89('0x5d')],_0x4d0ac0[_0xae89('0x62')],md5(_0x4d0ac0[_0xae89('0x62')]));}return getConnection(_0x263c6e)['then'](function(_0x224b5e){_0x54b259=_0x224b5e;return getUser(_0x263c6e,_0x2d0c63[_0xae89('0x63')],_0x54b259);})[_0xae89('0x28')](function(_0x2d3a7e){_0xc11e44=_0x2d3a7e;return getEndUser(_0x263c6e,_0x28c2a0,_0x4d0ac0[_0xae89('0x71')],_0x4d0ac0[_0xae89('0x72')],_0x54b259);})[_0xae89('0x28')](function(_0x143529){_0x36389f=_0x143529;return getTicket(_0x263c6e,_0xc11e44,_0x36389f,_0x28c2a0,_0x4d0ac0,_0x28c2a0[_0xae89('0x65')],_0x54b259,_0xae89('0x6d'));})[_0xae89('0x28')](function(_0x2d0b34){_0x55c0ab=_0x2d0b34;logger[_0xae89('0x22')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x55c0ab['id']);logger['info'](_0xae89('0x73'),_0x55c0ab['id'],_0x2d0c63[_0xae89('0x50')],_0x263c6e[_0xae89('0x48')]);switch(_0x263c6e[_0xae89('0x48')]){case _0xae89('0x67'):emit(util[_0xae89('0x42')](_0xae89('0x68'),_0x2d0c63[_0xae89('0x50')]),_0xae89('0x74'),{'recordId':_0x55c0ab['id']});break;case _0xae89('0x69'):emit(util[_0xae89('0x42')](_0xae89('0x68'),_0x2d0c63[_0xae89('0x50')]),_0xae89('0x6a'),{'uri':util[_0xae89('0x42')](_0xae89('0x75'),_0x54b259[_0xae89('0x76')],_0x55c0ab['id'])});break;default:logger[_0xae89('0x6b')](_0xae89('0x6f'),_0xae89('0x77'));}})[_0xae89('0x6c')](function(_0x15647f){logger[_0xae89('0x6b')](_0xae89('0x6f'),_0x15647f);});};exports['unmanaged']=function(_0x1cbde0,_0x2d0aca,_0x40b387,_0x17d65b,_0x252d92,_0x153532){var _0x11e897,_0x342c3a,_0x1455cf,_0xd14f05;_0x153532['serverUrl']=intUtil[_0xae89('0x5c')](_0x153532[_0xae89('0x5d')]);_0x153532['remoteUri']=intUtil[_0xae89('0x5c')](_0x153532[_0xae89('0x54')]);if(_0x252d92&&_0x252d92['monitor_format']){logger[_0xae89('0x22')]('['+_0x2d0aca[_0xae89('0x78')][_0xae89('0x79')]()+']',_0xae89('0x70'));_0x2d0aca[_0xae89('0x60')]=util[_0xae89('0x42')](_0xae89('0x61'),_0x153532['serverUrl'],_0x2d0aca[_0xae89('0x62')],md5(_0x2d0aca['uniqueid']));}else{_0x2d0aca[_0xae89('0x60')]='';}return getConnection(_0x153532)['then'](function(_0x21b7ea){_0xd14f05=_0x21b7ea;if(!_[_0xae89('0x1d')](_0x17d65b)){return getUser(_0x153532,_0x17d65b[_0xae89('0x50')],_0xd14f05);}else{return getUser(_0x153532,null,_0xd14f05);}})['then'](function(_0x50dfe8){_0x11e897=_0x50dfe8;return getEndUser(_0x153532,_0x40b387,_0x2d0aca['calleridname'],_0x2d0aca[_0xae89('0x7a')],_0xd14f05);})[_0xae89('0x28')](function(_0x1d7cf9){_0x342c3a=_0x1d7cf9;return getTicket(_0x153532,_0x11e897,_0x342c3a,_0x40b387,_0x2d0aca,_0x40b387[_0xae89('0x65')],_0xd14f05);})[_0xae89('0x28')](function(_0x4ae6ec){_0x1455cf=_0x4ae6ec;logger[_0xae89('0x22')]('['+_0x2d0aca[_0xae89('0x78')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x1455cf['id']);logger[_0xae89('0x22')]('['+_0x2d0aca[_0xae89('0x78')][_0xae89('0x79')]()+_0xae89('0x7b'),_0x153532[_0xae89('0x48')]);})[_0xae89('0x6c')](function(_0x4e8c4f){logger[_0xae89('0x6b')]('['+_0x2d0aca['lastevent'][_0xae89('0x79')]()+']',_0x4e8c4f);});}; \ No newline at end of file +var _0x4ffe=['recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','catch','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','Task','utc','IsRecurrence','endUserType','lead','WhoId','account','ticketType','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','find','execute','length','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','LastName','','Company','No\x20Company','format','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.'];(function(_0x574b2a,_0x4aac51){var _0x5a34c5=function(_0x1c6315){while(--_0x1c6315){_0x574b2a['push'](_0x574b2a['shift']());}};_0x5a34c5(++_0x4aac51);}(_0x4ffe,0x8f));var _0xe4ff=function(_0x391154,_0x40fb12){_0x391154=_0x391154-0x0;var _0x4b7767=_0x4ffe[_0x391154];return _0x4b7767;};'use strict';var _=require(_0xe4ff('0x0'));var rp=require(_0xe4ff('0x1'));var moment=require(_0xe4ff('0x2'));var BPromise=require(_0xe4ff('0x3'));var md5=require(_0xe4ff('0x4'));var jsforce=require(_0xe4ff('0x5'));var util=require('util');var Redis=require(_0xe4ff('0x6'));var intUtil=require(_0xe4ff('0x7'));var config=require(_0xe4ff('0x8'));var logger=require('../../../../config/logger')(_0xe4ff('0x9'));config[_0xe4ff('0xa')]=_[_0xe4ff('0xb')](config[_0xe4ff('0xa')],{'host':_0xe4ff('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4e90c2,_0x27c070,_0x159808){io['to'](_0x4e90c2)[_0xe4ff('0xd')](_0x27c070,_0x159808);}function getTicket(_0x57c7a9,_0x117a8f,_0x10bfda,_0x4f6e92,_0x24da68,_0x550524,_0x57d9ca,_0x5ae995){var _0x731ed1=Object[_0xe4ff('0xe')]({},{'OwnerId':_0x117a8f['id'],'Subject':intUtil[_0xe4ff('0xf')](_0x4f6e92[_0xe4ff('0x10')],_0x24da68,'\x20'),'Description':intUtil[_0xe4ff('0xf')](_0x4f6e92[_0xe4ff('0x11')],_0x24da68,'\x0a')},getCustomFields(_0x550524,_0x24da68));if(_0x10bfda){if(_0x4f6e92['ticketType']===_0xe4ff('0x12')){_0x731ed1['ActivityDate']=moment[_0xe4ff('0x13')]();_0x731ed1['IsReminderSet']=![];_0x731ed1[_0xe4ff('0x14')]=![];if(_0x10bfda['endUserType']==='contact'||_0x10bfda[_0xe4ff('0x15')]===_0xe4ff('0x16')){_0x731ed1[_0xe4ff('0x17')]=_0x10bfda['id'];}else if(_0x10bfda['endUserType']===_0xe4ff('0x18')){_0x731ed1['WhatId']=_0x10bfda['id'];}}else if(_0x4f6e92[_0xe4ff('0x19')]===_0xe4ff('0x1a')){if(_0x10bfda[_0xe4ff('0x15')]===_0xe4ff('0x1b')){_0x731ed1[_0xe4ff('0x1c')]=_0x10bfda['id'];}else if(_0x10bfda[_0xe4ff('0x15')]==='account'){_0x731ed1[_0xe4ff('0x1d')]=_0x10bfda['id'];}else if(_0x10bfda['endUserType']==='lead'&&_0x4f6e92[_0xe4ff('0x1e')]){_0x731ed1[_0x4f6e92[_0xe4ff('0x1e')]]=_0x10bfda['id'];}else{logger[_0xe4ff('0x1f')](_0xe4ff('0x20'));}}}return _0x57d9ca['sobject'](_0x4f6e92[_0xe4ff('0x19')])[_0xe4ff('0x21')](_0x731ed1);}function getUser(_0x1d2089,_0x10873b,_0xe8e3ec){if(!_[_0xe4ff('0x22')](_0x10873b)&&intUtil[_0xe4ff('0x23')](_0x10873b)){var _0x37c8ed={'Email':_0x10873b};var _0xae002a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xe8e3ec[_0xe4ff('0x24')]('User')[_0xe4ff('0x25')](_0x37c8ed,_0xae002a)[_0xe4ff('0x26')]()['then'](function(_0xb6c505){if(_0xb6c505[_0xe4ff('0x27')]){var _0x3b733a=_[_0xe4ff('0x25')](_0xb6c505,function(_0x1c8344){return _0x1c8344[_0xe4ff('0x28')]===_0x10873b;});if(_0x3b733a){logger['info']('Agent\x20%s\x20found.',_0x10873b);return BPromise[_0xe4ff('0x29')]({'id':_0x3b733a['Id'],'name':_0x3b733a['Name']});}}else{logger['info'](_0xe4ff('0x2a'),_0x10873b);return _0xe8e3ec[_0xe4ff('0x2b')]()[_0xe4ff('0x2c')](function(_0x2b936e){return BPromise['resolve']({'id':_0x2b936e[_0xe4ff('0x2d')],'name':_0x2b936e[_0xe4ff('0x2e')]});});}});}else{logger[_0xe4ff('0x1f')](_0xe4ff('0x2a'),_0x10873b);return _0xe8e3ec[_0xe4ff('0x2b')]()[_0xe4ff('0x2c')](function(_0x37e540){return BPromise[_0xe4ff('0x29')]({'id':_0x37e540[_0xe4ff('0x2d')],'name':_0x37e540[_0xe4ff('0x2e')]});});}}function getEndUser(_0x17ff19,_0x117d20,_0x917a6b,_0xe13036,_0x514ae7){var _0xc10dc3={'$or':{'Phone':_0xe13036}};var _0x22de05={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xe4ff('0x2c')](function(){logger[_0xe4ff('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0xe13036,_0x117d20[_0xe4ff('0x2f')]);switch(_0x117d20[_0xe4ff('0x2f')]){case'contact_lead':var _0x11bf9f=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20['additionalSearchContact']){var _0x4713dc={};_0x4713dc[_0x117d20[_0xe4ff('0x31')]]=_0xe13036;_[_0xe4ff('0x32')](_0x11bf9f[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7['sobject'](_0xe4ff('0x34'))[_0xe4ff('0x25')](_0x11bf9f,_0x22de05)[_0xe4ff('0x26')]()[_0xe4ff('0x2c')](function(_0x17bbc6){if(_0x17bbc6&&_0x17bbc6[_0xe4ff('0x27')]){return _0x17bbc6;}else{var _0x9fa882=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x35')]){var _0x3150d5={};_0x3150d5[_0x117d20[_0xe4ff('0x35')]]=_0xe13036;_[_0xe4ff('0x32')](_0x9fa882[_0xe4ff('0x33')],_0x3150d5);}return _0x514ae7['sobject'](_0xe4ff('0x36'))[_0xe4ff('0x25')](_0x9fa882,_0x22de05);}});case _0xe4ff('0x37'):var _0x2fe9c4=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x38')]){var _0x4713dc={};_0x4713dc[_0x117d20[_0xe4ff('0x38')]]=_0xe13036;_[_0xe4ff('0x32')](_0x2fe9c4[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x39'))['find'](_0x2fe9c4,_0x22de05)[_0xe4ff('0x26')]()[_0xe4ff('0x2c')](function(_0x482723){if(_0x482723&&_0x482723[_0xe4ff('0x27')]){return _0x482723;}else{var _0x115b44=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x31')]){var _0x998092={};_0x998092[_0x117d20[_0xe4ff('0x31')]]=_0xe13036;_[_0xe4ff('0x32')](_0x115b44[_0xe4ff('0x33')],_0x998092);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x34'))[_0xe4ff('0x25')](_0x115b44,_0x22de05)[_0xe4ff('0x2c')](function(_0x5a914b){if(_0x5a914b&&_0x5a914b[_0xe4ff('0x27')]){return _0x5a914b;}else{var _0x367e9b=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20['additionalSearchLead']){var _0x51c9b5={};_0x51c9b5[_0x117d20[_0xe4ff('0x35')]]=_0xe13036;_[_0xe4ff('0x32')](_0x367e9b['$or'],_0x51c9b5);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x36'))[_0xe4ff('0x25')](_0x367e9b,_0x22de05);}});}});case _0xe4ff('0x1b'):var _0x11bf9f=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x31')]){var _0x4713dc={};_0x4713dc[_0x117d20['additionalSearchContact']]=_0xe13036;_[_0xe4ff('0x32')](_0x11bf9f[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7['sobject'](_0xe4ff('0x34'))[_0xe4ff('0x25')](_0x11bf9f,_0x22de05)[_0xe4ff('0x26')]();case _0xe4ff('0x16'):var _0x259e87=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20['additionalSearchLead']){var _0x4713dc={};_0x4713dc[_0x117d20['additionalSearchLead']]=_0xe13036;_[_0xe4ff('0x32')](_0x259e87[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x36'))[_0xe4ff('0x25')](_0x259e87,_0x22de05);case'account':var _0x2fe9c4=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x38')]){var _0x4713dc={};_0x4713dc[_0x117d20[_0xe4ff('0x38')]]=_0xe13036;_[_0xe4ff('0x32')](_0x2fe9c4[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x39'))[_0xe4ff('0x25')](_0x2fe9c4,_0x22de05);default:return null;}})[_0xe4ff('0x2c')](function(_0xe9392f){if(_0xe9392f&&_0xe9392f[_0xe4ff('0x27')]){var _0x204c98=_[_0xe4ff('0x3a')](_0xe9392f);if(_0x204c98){return BPromise[_0xe4ff('0x29')]({'id':_0x204c98['Id'],'name':_0x204c98[_0xe4ff('0x3b')],'phone':_0x204c98['Phone'],'endUserType':_0x204c98[_0xe4ff('0x3c')][_0xe4ff('0x3d')][_0xe4ff('0x3e')]()});}}})[_0xe4ff('0x2c')](function(_0x564b6b){if(_0x564b6b){logger['info'](_0xe4ff('0x3f'),_0x564b6b['endUserType'],_0xe13036);return BPromise[_0xe4ff('0x29')](_0x564b6b);}else{logger[_0xe4ff('0x1f')](_0xe4ff('0x40'),_0xe13036);var _0x2de7be={'Phone':_0xe13036};if(_0x117d20[_0xe4ff('0x41')]){if(_0x117d20[_0xe4ff('0x41')]===_0xe4ff('0x1b')){logger[_0xe4ff('0x1f')](_0xe4ff('0x42'),_0xe13036,_0x117d20[_0xe4ff('0x41')]);_0x2de7be['LastName']=_0x917a6b!==''?_0x917a6b:util['format'](_0xe4ff('0x43'),_0xe13036);}else if(_0x117d20[_0xe4ff('0x41')]===_0xe4ff('0x16')){logger[_0xe4ff('0x1f')](_0xe4ff('0x42'),_0xe13036,_0x117d20[_0xe4ff('0x41')]);_0x2de7be[_0xe4ff('0x44')]=_0x917a6b!==_0xe4ff('0x45')?_0x917a6b:util['format']('Caller\x20-\x20%s',_0xe13036);_0x2de7be[_0xe4ff('0x46')]=_0xe4ff('0x47');}else if(_0x117d20[_0xe4ff('0x41')]==='account'){logger[_0xe4ff('0x1f')](_0xe4ff('0x42'),_0xe13036,_0x117d20[_0xe4ff('0x41')]);_0x2de7be[_0xe4ff('0x3b')]=_0x917a6b!==_0xe4ff('0x45')?_0x917a6b:util[_0xe4ff('0x48')](_0xe4ff('0x43'),_0xe13036);}else{return null;}}return _0x514ae7[_0xe4ff('0x24')](_[_0xe4ff('0x49')](_0x117d20[_0xe4ff('0x41')]))['create'](_0x2de7be)['then'](function(_0x438bd3){return BPromise['resolve']({'id':_0x438bd3['id'],'endUserType':_0x117d20['moduleCreate']});});}});}function getCustomFields(_0x1c2efd,_0x53968e){var _0x1cd601={};if(_0x1c2efd['length']>0x0){_[_0xe4ff('0x4a')](_0x1c2efd,function(_0x5658bf){if(_[_0xe4ff('0x4b')]([_0xe4ff('0x4c'),_0xe4ff('0x4d')],_0x5658bf[_0xe4ff('0x3d')])&&_0x5658bf['idField']){_0x1cd601[_0x5658bf[_0xe4ff('0x4e')]]=_0x5658bf[_0xe4ff('0x4f')]['toString']();}else if(_0x5658bf[_0xe4ff('0x3d')]===_0xe4ff('0x50')&&_0x5658bf[_0xe4ff('0x51')]&&_0x5658bf[_0xe4ff('0x4e')]){_0x53968e[_0x5658bf[_0xe4ff('0x51')]]&&(_0x1cd601[_0x5658bf[_0xe4ff('0x4e')]]=_0x53968e[_0x5658bf['variableName']][_0xe4ff('0x52')]());}else if(_0x5658bf[_0xe4ff('0x3d')]===_0xe4ff('0x53')&&_0x5658bf[_0xe4ff('0x54')]&&_0x5658bf[_0xe4ff('0x54')][_0xe4ff('0x55')]&&_0x5658bf[_0xe4ff('0x4e')]){_0x53968e[_0x5658bf[_0xe4ff('0x54')]['name'][_0xe4ff('0x3e')]()]&&(_0x1cd601[_0x5658bf['idField']]=_0x53968e[_0x5658bf[_0xe4ff('0x54')][_0xe4ff('0x55')][_0xe4ff('0x3e')]()][_0xe4ff('0x52')]());}});}return _0x1cd601;}function getConnection(_0x45cf61){var _0x3bcf1c=_0x45cf61[_0xe4ff('0x56')][_0xe4ff('0x57')](_0x45cf61[_0xe4ff('0x58')]);var _0xdb2730=new jsforce['Connection']({'oauth2':{'loginUrl':_0x45cf61[_0xe4ff('0x59')]||_0xe4ff('0x5a'),'clientId':_0x45cf61[_0xe4ff('0x5b')],'clientSecret':_0x45cf61[_0xe4ff('0x5c')]}});return _0xdb2730['login'](_0x45cf61[_0xe4ff('0x5d')],_0x3bcf1c)['then'](function(){logger[_0xe4ff('0x1f')]('Connection\x20established.');return _0xdb2730;});}exports[_0xe4ff('0x5e')]=function(_0x59866e,_0x31f2f2,_0x29b8a9,_0x54b156,_0x1e8b84,_0x22bc78){var _0x4d2e7b,_0x27bbc1,_0x48768e,_0x238ebf;_0x22bc78[_0xe4ff('0x5f')]=intUtil[_0xe4ff('0x60')](_0x22bc78[_0xe4ff('0x5f')]);_0x22bc78[_0xe4ff('0x59')]=intUtil[_0xe4ff('0x60')](_0x22bc78[_0xe4ff('0x59')]);if(_0x1e8b84&&_0x1e8b84['monitor_format']){logger[_0xe4ff('0x1f')](_0xe4ff('0x61'),_0xe4ff('0x62'));_0x31f2f2[_0xe4ff('0x63')]=util[_0xe4ff('0x48')](_0xe4ff('0x64'),_0x22bc78['serverUrl'],_0x31f2f2[_0xe4ff('0x65')],md5(_0x31f2f2[_0xe4ff('0x65')]));}else{_0x31f2f2[_0xe4ff('0x63')]='';}return getConnection(_0x22bc78)[_0xe4ff('0x2c')](function(_0x8303ca){_0x238ebf=_0x8303ca;return getUser(_0x22bc78,_0x54b156[_0xe4ff('0x66')],_0x238ebf);})[_0xe4ff('0x2c')](function(_0x1235d3){_0x4d2e7b=_0x1235d3;return getEndUser(_0x22bc78,_0x29b8a9,_0x31f2f2[_0xe4ff('0x67')],_0x31f2f2[_0xe4ff('0x68')],_0x238ebf);})[_0xe4ff('0x2c')](function(_0xbc37b3){_0x27bbc1=_0xbc37b3;return getTicket(_0x22bc78,_0x4d2e7b,_0x27bbc1,_0x29b8a9,_0x31f2f2,_0x29b8a9['Fields'],_0x238ebf,_0xe4ff('0x5e'));})['then'](function(_0x40dcfe){_0x48768e=_0x40dcfe;logger[_0xe4ff('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x48768e['id']);logger['info'](_0xe4ff('0x69'),_0x48768e['id'],_0x54b156[_0xe4ff('0x55')],_0x22bc78[_0xe4ff('0x3d')]);switch(_0x22bc78[_0xe4ff('0x3d')]){case'integrationTab':emit(util[_0xe4ff('0x48')](_0xe4ff('0x6a'),_0x54b156[_0xe4ff('0x55')]),_0xe4ff('0x6b'),{'recordId':_0x48768e['id']});break;case _0xe4ff('0x6c'):emit(util[_0xe4ff('0x48')](_0xe4ff('0x6a'),_0x54b156[_0xe4ff('0x55')]),_0xe4ff('0x6d'),{'uri':util[_0xe4ff('0x48')]('%s/%s/e',_0x238ebf[_0xe4ff('0x6e')],_0x48768e['id'])});break;default:logger[_0xe4ff('0x6f')](_0xe4ff('0x70'));}})['catch'](function(_0x47e27d){logger[_0xe4ff('0x6f')](_0xe4ff('0x61'),_0x47e27d);});};exports['outbound']=function(_0x57d62b,_0x2843a8,_0x17da05,_0x967094,_0x401941,_0xb29baa,_0x4fdd23){var _0x14e08c,_0x50a37f,_0x4455db,_0x425d2f;_0xb29baa[_0xe4ff('0x5f')]=intUtil['stripTrailingSlash'](_0xb29baa['serverUrl']);_0xb29baa['remoteUri']=intUtil[_0xe4ff('0x60')](_0xb29baa[_0xe4ff('0x59')]);if(_0x4fdd23&&_0x4fdd23[_0xe4ff('0x71')]&&_0x4fdd23['recordingFormat']!==_0xe4ff('0x72')){logger[_0xe4ff('0x1f')](_0xe4ff('0x73'),'Recording\x20is\x20enabled!');_0x2843a8['recordingURL']=util[_0xe4ff('0x48')](_0xe4ff('0x64'),_0xb29baa[_0xe4ff('0x5f')],_0x2843a8['uniqueid'],md5(_0x2843a8[_0xe4ff('0x65')]));}return getConnection(_0xb29baa)[_0xe4ff('0x2c')](function(_0x3c8bea){_0x425d2f=_0x3c8bea;return getUser(_0xb29baa,_0x967094[_0xe4ff('0x66')],_0x425d2f);})[_0xe4ff('0x2c')](function(_0x2b47b0){_0x14e08c=_0x2b47b0;return getEndUser(_0xb29baa,_0x17da05,_0x2843a8['destcalleridname'],_0x2843a8[_0xe4ff('0x74')],_0x425d2f);})[_0xe4ff('0x2c')](function(_0x336256){_0x50a37f=_0x336256;return getTicket(_0xb29baa,_0x14e08c,_0x50a37f,_0x17da05,_0x2843a8,_0x17da05[_0xe4ff('0x75')],_0x425d2f,'outbound');})[_0xe4ff('0x2c')](function(_0x2395ba){_0x4455db=_0x2395ba;logger[_0xe4ff('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4455db['id']);logger['info'](_0xe4ff('0x76'),_0x4455db['id'],_0x967094[_0xe4ff('0x55')],_0xb29baa['type']);switch(_0xb29baa['type']){case _0xe4ff('0x77'):emit(util['format'](_0xe4ff('0x6a'),_0x967094[_0xe4ff('0x55')]),'trigger:salesforce:display',{'recordId':_0x4455db['id']});break;case'newTab':emit(util[_0xe4ff('0x48')](_0xe4ff('0x6a'),_0x967094[_0xe4ff('0x55')]),_0xe4ff('0x6d'),{'uri':util[_0xe4ff('0x48')](_0xe4ff('0x78'),_0x425d2f[_0xe4ff('0x6e')],_0x4455db['id'])});break;default:logger[_0xe4ff('0x6f')](_0xe4ff('0x73'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xe4ff('0x79')](function(_0x48e289){logger[_0xe4ff('0x6f')]('[OUTBOUND]',_0x48e289);});};exports[_0xe4ff('0x7a')]=function(_0x5475fb,_0x4ffcbd,_0xc29d78,_0x1e6baf,_0x408345,_0x555d93){var _0x10dcbb,_0x209f2b,_0x1154bc,_0x2b66de;_0x555d93[_0xe4ff('0x5f')]=intUtil[_0xe4ff('0x60')](_0x555d93[_0xe4ff('0x5f')]);_0x555d93[_0xe4ff('0x59')]=intUtil[_0xe4ff('0x60')](_0x555d93[_0xe4ff('0x59')]);if(_0x408345&&_0x408345[_0xe4ff('0x7b')]){logger[_0xe4ff('0x1f')]('['+_0x4ffcbd[_0xe4ff('0x7c')][_0xe4ff('0x7d')]()+']',_0xe4ff('0x62'));_0x4ffcbd[_0xe4ff('0x63')]=util[_0xe4ff('0x48')](_0xe4ff('0x64'),_0x555d93[_0xe4ff('0x5f')],_0x4ffcbd[_0xe4ff('0x65')],md5(_0x4ffcbd[_0xe4ff('0x65')]));}else{_0x4ffcbd[_0xe4ff('0x63')]='';}return getConnection(_0x555d93)[_0xe4ff('0x2c')](function(_0x2fa809){_0x2b66de=_0x2fa809;if(!_['isNil'](_0x1e6baf)){return getUser(_0x555d93,_0x1e6baf[_0xe4ff('0x55')],_0x2b66de);}else{return getUser(_0x555d93,null,_0x2b66de);}})[_0xe4ff('0x2c')](function(_0x185765){_0x10dcbb=_0x185765;return getEndUser(_0x555d93,_0xc29d78,_0x4ffcbd[_0xe4ff('0x67')],_0x4ffcbd[_0xe4ff('0x68')],_0x2b66de);})[_0xe4ff('0x2c')](function(_0x2eaf8e){_0x209f2b=_0x2eaf8e;return getTicket(_0x555d93,_0x10dcbb,_0x209f2b,_0xc29d78,_0x4ffcbd,_0xc29d78['Fields'],_0x2b66de);})[_0xe4ff('0x2c')](function(_0x4a5a07){_0x1154bc=_0x4a5a07;logger[_0xe4ff('0x1f')]('['+_0x4ffcbd['lastevent'][_0xe4ff('0x7d')]()+_0xe4ff('0x7e'),_0x1154bc['id']);logger[_0xe4ff('0x1f')]('['+_0x4ffcbd[_0xe4ff('0x7c')][_0xe4ff('0x7d')]()+_0xe4ff('0x7f'),_0x555d93[_0xe4ff('0x3d')]);})[_0xe4ff('0x79')](function(_0x4959af){logger[_0xe4ff('0x6f')]('['+_0x4ffcbd[_0xe4ff('0x7c')][_0xe4ff('0x7d')]()+']',_0x4959af);});}; \ 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 718c7ad..7673e42 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 _0x79ee=['incident','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/logger','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','message','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','userEmail','adminEmail','],\x20getUser\x20crm','catch','error','POST','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','includes','string','nameField','toLowerCase','content','toString','customField','idField','type','variableName','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry'];(function(_0x466726,_0x1a594b){var _0x2ca489=function(_0x37be6f){while(--_0x37be6f){_0x466726['push'](_0x466726['shift']());}};_0x2ca489(++_0x1a594b);}(_0x79ee,0xf4));var _0xe79e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x79ee[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var Promise=require(_0xe79e('0x0'));var rp=require(_0xe79e('0x1'));var util=require(_0xe79e('0x2'));var md5=require(_0xe79e('0x3'));var Redis=require(_0xe79e('0x4'));var intUtil=require(_0xe79e('0x5'));var config=require('../../../../config/environment');var logger=require(_0xe79e('0x6'))('servicenow');config['redis']=_[_0xe79e('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe79e('0x8'))(new Redis(config['redis']));function getAdminUser(_0x4f5cd8,_0x53a34e,_0x1e278a,_0x35c662,_0x1d7ce1,_0x32399d){return new Promise(function(_0xc493f8,_0x116c69){var _0x198427={'method':_0xe79e('0x9'),'uri':_0x35c662+_0xe79e('0xa')+'&'+_0x1d7ce1+'&'+_0x32399d,'auth':_0x53a34e,'json':!![]};return rp(_0x198427)[_0xe79e('0xb')](function(_0x40c5aa){if(_0x40c5aa[_0xe79e('0xc')][_0xe79e('0xd')]>0x0){_0x1e278a[_0xe79e('0xe')]=_0x40c5aa[_0xe79e('0xc')][0x0][_0xe79e('0xf')];}logger[_0xe79e('0x10')]('['+[_0x4f5cd8[_0xe79e('0x11')]()]+_0xe79e('0x12'),_0x1e278a);_0xc493f8(_0x1e278a);})['catch'](function(_0x32ad47){logger['error']('['+[_0x4f5cd8[_0xe79e('0x11')]()]+']',_0x32ad47['message']);_0x116c69(_0x32ad47[_0xe79e('0x13')]);});});}function getUser(_0x3dade1,_0x31860d,_0x167030,_0x1dd7a9,_0x3f47c8){return function(_0x4c76ff){logger['info']('['+[_0x3dade1['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x4c76ff);return new Promise(function(_0x280c37,_0x3cc333){if(intUtil[_0xe79e('0x14')](_0x4c76ff['userEmail'])){var _0x36b035={'method':_0xe79e('0x9'),'uri':_0x167030+_0xe79e('0x15')+_0x4c76ff['userEmail']+'&'+_0x1dd7a9+'&'+_0x3f47c8,'auth':_0x31860d,'json':!![]};logger[_0xe79e('0x10')]('['+[_0x3dade1['toUpperCase']()]+_0xe79e('0x16'),_0x36b035);return rp(_0x36b035)[_0xe79e('0xb')](function(_0x9e7541){logger[_0xe79e('0x10')]('['+[_0x3dade1['toUpperCase']()]+_0xe79e('0x17'),_0x9e7541);if(_0x9e7541[_0xe79e('0xc')][_0xe79e('0xd')]>0x0&&String(_0x9e7541[_0xe79e('0xc')][0x0][_0xe79e('0x18')])===_0xe79e('0x19')){_0x4c76ff[_0xe79e('0x1a')]=_0x9e7541[_0xe79e('0xc')][0x0][_0xe79e('0xf')];}else{_0x4c76ff[_0xe79e('0x1a')]=_0x4c76ff[_0xe79e('0xe')];_0x4c76ff[_0xe79e('0x1b')]=_0x4c76ff[_0xe79e('0x1c')];}logger['info']('['+[_0x3dade1[_0xe79e('0x11')]()]+_0xe79e('0x1d'),_0x4c76ff);_0x280c37(_0x4c76ff);})[_0xe79e('0x1e')](function(_0x41f953){logger[_0xe79e('0x1f')]('['+[_0x3dade1[_0xe79e('0x11')]()]+']',_0x41f953[_0xe79e('0x13')]);_0x3cc333(_0x41f953[_0xe79e('0x13')]);});}else{logger[_0xe79e('0x10')]('['+[_0x3dade1[_0xe79e('0x11')]()]+']\x20using\x20admin\x20profile');_0x4c76ff['userId']=_0x4c76ff[_0xe79e('0xe')];_0x4c76ff['userEmail']=_0x4c76ff['adminEmail'];_0x280c37(_0x4c76ff);}});};}function createEndUser(_0x2495c2,_0x2d9ca7,_0x59ba15,_0x24e8da,_0x31c60a){logger[_0xe79e('0x10')]('['+[_0x2495c2[_0xe79e('0x11')]()]+'],\x20createEndUser\x20input\x20crm',_0x59ba15);return new Promise(function(_0x4dca61,_0x40852e){var _0x4845c1={'method':_0xe79e('0x20'),'uri':_0x24e8da+'sys_user?'+_0x31c60a,'body':{'user_name':_0x59ba15[_0xe79e('0x21')],'roles':_0xe79e('0x22'),'first_name':_0x59ba15['endUserNumber'],'active':_0xe79e('0x19'),'date_format':_0xe79e('0x23'),'phone':_0x59ba15[_0xe79e('0x21')]},'auth':_0x2d9ca7,'json':!![]};return rp(_0x4845c1)[_0xe79e('0xb')](function(_0x2012a3){logger[_0xe79e('0x10')]('['+[_0x2495c2[_0xe79e('0x11')]()]+'],\x20EndUser\x20schema',_0x2012a3[_0xe79e('0xc')]);_0x59ba15[_0xe79e('0x24')]=_0x2012a3[_0xe79e('0xc')][_0xe79e('0xf')];_0x4dca61(_0x59ba15);})[_0xe79e('0x1e')](function(_0x4f2cd0){logger[_0xe79e('0x1f')]('['+[_0x2495c2['toUpperCase']()]+']',_0x4f2cd0[_0xe79e('0x13')]);_0x40852e(_0x4f2cd0[_0xe79e('0x13')]);});});}function getEndUser(_0x32c7d6,_0x3b7b7e,_0x44dcb0,_0x259591,_0x1a3c16){return function(_0x73f142){logger[_0xe79e('0x10')]('['+[_0x32c7d6[_0xe79e('0x11')]()]+_0xe79e('0x25'),_0x73f142);return new Promise(function(_0x1bfb64,_0x159151){var _0xe87033={'method':_0xe79e('0x9'),'uri':_0x44dcb0+_0xe79e('0x26')+_0x73f142['endUserNumber']+'&'+_0x259591+'&'+_0x1a3c16,'auth':_0x3b7b7e,'json':!![]};return rp(_0xe87033)['then'](function(_0x4bf3f6){if(_0x4bf3f6[_0xe79e('0xc')][_0xe79e('0xd')]>0x0){_0x73f142[_0xe79e('0x24')]=_0x4bf3f6[_0xe79e('0xc')][0x0]['sys_id'];logger[_0xe79e('0x10')]('['+[_0x32c7d6[_0xe79e('0x11')]()]+'],\x20getEndUser\x20crm',_0x73f142);_0x1bfb64(_0x73f142);}else{return createEndUser(_0x32c7d6,_0x3b7b7e,_0x73f142,_0x44dcb0,_0x259591)[_0xe79e('0xb')](function(_0x5e4220){logger['info']('['+[_0x32c7d6[_0xe79e('0x11')]()]+_0xe79e('0x27'),_0x5e4220);_0x1bfb64(_0x5e4220);});}})[_0xe79e('0x1e')](function(_0x15a224){logger[_0xe79e('0x1f')]('['+[_0x32c7d6[_0xe79e('0x11')]()]+']',_0x15a224[_0xe79e('0x13')]);_0x159151(_0x15a224[_0xe79e('0x13')]);});});};}function getCustomFields(_0x5645b3,_0x5f515e){var _0x19fa45={};if(_0x5645b3[_0xe79e('0xd')]>0x0){_['forEach'](_0x5645b3,function(_0x2f2dc7){if(_[_0xe79e('0x28')]([_0xe79e('0x29'),'picklist'],_0x2f2dc7['type'])&&_0x2f2dc7[_0xe79e('0x2a')]&&!_0x2f2dc7['customField']){_0x19fa45[_0x2f2dc7[_0xe79e('0x2a')][_0xe79e('0x2b')]()]=_0x2f2dc7[_0xe79e('0x2c')][_0xe79e('0x2d')]();}else if(_['includes']([_0xe79e('0x29'),'picklist'],_0x2f2dc7['type'])&&_0x2f2dc7['idField']&&_0x2f2dc7[_0xe79e('0x2e')]){_0x19fa45[_0x2f2dc7[_0xe79e('0x2f')][_0xe79e('0x2b')]()]=_0x2f2dc7[_0xe79e('0x2c')][_0xe79e('0x2d')]();}else if(_0x2f2dc7[_0xe79e('0x30')]==='variable'&&_0x2f2dc7[_0xe79e('0x31')]&&_0x2f2dc7[_0xe79e('0x2f')]&&_0x2f2dc7[_0xe79e('0x2e')]){_0x19fa45[_0x2f2dc7[_0xe79e('0x2f')][_0xe79e('0x2b')]()]=_0x5f515e[_0x2f2dc7[_0xe79e('0x31')]][_0xe79e('0x2d')]();}else if(_0x2f2dc7[_0xe79e('0x30')]==='customVariable'&&_0x2f2dc7['Variable']&&_0x2f2dc7[_0xe79e('0x32')][_0xe79e('0x33')]&&_0x2f2dc7[_0xe79e('0x2f')]&&_0x2f2dc7['customField']){_0x19fa45[_0x2f2dc7['idField']['toLowerCase']()]=_0x5f515e[_0x2f2dc7[_0xe79e('0x32')]['name'][_0xe79e('0x2b')]()]['toString']();}});}return _0x19fa45;}function getTicket(_0x5624bb,_0x11ee85,_0x13fc05,_0x17a93c,_0x1abda5,_0x751b39){return function(_0x3caaae){logger[_0xe79e('0x10')]('['+[_0x5624bb['toUpperCase']()]+_0xe79e('0x34'),_0x3caaae);return new Promise(function(_0xbc0112,_0x1bc87b){var _0x11e62c=_0x5624bb[_0xe79e('0x2b')]()==='outbound'?_0x3caaae[_0xe79e('0x1a')]:_0x3caaae[_0xe79e('0x24')];var _0xe608f3={'method':_0xe79e('0x20'),'uri':_0x13fc05+'incident'+'?'+_0x751b39,'body':Object[_0xe79e('0x35')]({},{'active':_0xe79e('0x19'),'caller_id':_0x11e62c,'assigned_to':_0x3caaae[_0xe79e('0x1a')],'short_description':intUtil[_0xe79e('0x36')](_0x17a93c[_0xe79e('0x37')],_0x1abda5,'\x20'),'description':intUtil['getString'](_0x17a93c[_0xe79e('0x38')],_0x1abda5,'\x0a')},getCustomFields(_0x17a93c['Fields'],_0x1abda5)),'auth':_0x11ee85,'json':!![]};return rp(_0xe608f3)[_0xe79e('0xb')](function(_0x1208b2){logger['info']('['+[_0x5624bb[_0xe79e('0x11')]()]+_0xe79e('0x39'),_0x1208b2[_0xe79e('0xc')]);_0x3caaae[_0xe79e('0x3a')]=_0x1208b2[_0xe79e('0xc')][_0xe79e('0xf')];_0x3caaae[_0xe79e('0x3b')]=_0x1208b2['result'][_0xe79e('0x3c')];logger[_0xe79e('0x10')]('['+[_0x5624bb[_0xe79e('0x11')]()]+_0xe79e('0x3d'),_0x3caaae);_0xbc0112(_0x3caaae);})['catch'](function(_0x5f5dc1){logger[_0xe79e('0x1f')]('['+[_0x5624bb[_0xe79e('0x11')]()]+']',_0x5f5dc1[_0xe79e('0x13')]);_0x1bc87b(_0x5f5dc1[_0xe79e('0x13')]);});});};}function createRemoteTag(_0x3668b0,_0x3ec0d6,_0x168bad,_0x11823f){return new Promise(function(_0x5b3c9a,_0x1691e6){var _0x3919ff={'method':'POST','uri':_0x168bad+'label'+'?'+_0x11823f,'body':{'short_description':_0x3668b0,'global':!![],'active':!![],'name':_0x3668b0},'auth':_0x3ec0d6,'json':!![]};return rp(_0x3919ff)['then'](function(_0x32e439){var _0x4b255d=_0x32e439[_0xe79e('0xc')][_0xe79e('0xf')];_0x5b3c9a(_0x4b255d);});});}function getRemoteTag(_0x38f3c9,_0x4ebe7a,_0x104682,_0x35f958,_0x50d8e5){return new Promise(function(_0x2f05b7,_0x3de505){var _0x32547a={'method':_0xe79e('0x9'),'uri':_0x104682+_0xe79e('0x3e')+_0xe79e('0x3f')+_0x38f3c9+'&'+_0x35f958,'auth':_0x4ebe7a,'json':!![]};return rp(_0x32547a)['then'](function(_0x20416e){if(_0x20416e['result'][_0xe79e('0xd')]>0x0){var _0x48d48d=_0x20416e[_0xe79e('0xc')][0x0][_0xe79e('0xf')];_0x2f05b7(_0x48d48d);}else{return createRemoteTag(_0x38f3c9,_0x4ebe7a,_0x104682,_0x35f958)[_0xe79e('0xb')](function(_0x54060d){_0x2f05b7(_0x54060d);});}});});}function assignTagToIncident(_0x319a22,_0x301bb4,_0x52a72b,_0x1d9faa,_0x412b89){return new Promise(function(_0x1c1b84,_0x10fb5a){var _0x2cb61a={'method':_0xe79e('0x20'),'uri':_0x52a72b+_0xe79e('0x40')+'?'+_0x412b89,'body':{'label':_0x319a22,'table':_0xe79e('0x41'),'id_type':'Incident','table_key':_0x1d9faa[_0xe79e('0x3a')],'title':_0xe79e('0x42')+_0x1d9faa['ticketNumber'],'id_display':_0x1d9faa[_0xe79e('0x3b')]},'auth':_0x301bb4,'json':!![]};return rp(_0x2cb61a)[_0xe79e('0xb')](function(_0x18c725){_0x1c1b84();})['catch'](function(){_0x1c1b84();});});}function manageTags(_0x3f78c3,_0xc414b7,_0x46c2c3,_0x209737,_0x4393a8,_0x312576,_0x360da1){return new Promise(function(_0xc53b74,_0x3ee2ba){var _0x36afb1=[];_0xc414b7[_0xe79e('0x43')](function(_0x55ead8){_0x36afb1[_0xe79e('0x44')](getRemoteTag(_0x55ead8,_0x46c2c3,_0x209737,_0x312576,_0x360da1));});return Promise[_0xe79e('0x45')](_0x36afb1)[_0xe79e('0xb')](function(_0x5ea03a){if(_0x5ea03a[_0xe79e('0xd')]){logger[_0xe79e('0x10')]('['+[_0x3f78c3[_0xe79e('0x11')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5ea03a);var _0x1f809a=[];_0x5ea03a[_0xe79e('0x43')](function(_0x310a1e){_0x1f809a[_0xe79e('0x44')](assignTagToIncident(_0x310a1e,_0x46c2c3,_0x209737,_0x4393a8,_0x312576));});return Promise[_0xe79e('0x45')](_0x1f809a)[_0xe79e('0xb')](function(){_0xc53b74();})[_0xe79e('0x1e')](function(){_0xc53b74();});}else{_0xc53b74();}});});}function getTags(_0x525d60,_0x3d044c,_0x1821a8,_0x2fcb88,_0x39a91f,_0x5197a6){return function(_0x155eef){return new Promise(function(_0x33bf43,_0x529d9c){var _0x2ed903=[];var _0x31f301=_0x2fcb88[_0xe79e('0x46')];if(_0x31f301&&_0x31f301['length']>0x0){_0x2ed903=_['map'](_0x31f301,'name');}if(_0x2ed903['length']>0x0){return manageTags(_0x525d60,_0x2ed903,_0x3d044c,_0x1821a8,_0x155eef,_0x39a91f,_0x5197a6)['then'](function(){_0x33bf43(_0x155eef);});}else{_0x33bf43(_0x155eef);}});};}function emit(_0xaf2580,_0x1d2d98,_0x335d80){var _0x4d861e=_0xe79e('0x47')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xe79e('0x48')+_0xe79e('0x49');var _0x32a368={'uri':_0xaf2580+_0xe79e('0x4a')+_0x335d80+_0x4d861e};io['to'](util[_0xe79e('0x4b')](_0xe79e('0x4c'),_0x1d2d98))[_0xe79e('0x4d')](_0xe79e('0x4e'),_0x32a368);}exports['cs']=function(_0x2a9804,_0x53cb02,_0x42a70a,_0x47986a,_0x251a80,_0x334533,_0x25a5aa,_0x2fa123){var _0x13c56e={};var _0x1edc5d={'user':_0x334533[_0xe79e('0x4f')],'pass':_0x334533[_0xe79e('0x50')]};var _0x49785b='sysparm_limit=1';var _0x5dbf9e='sysparm_display_value=true';_0x334533[_0xe79e('0x51')]=intUtil['stripTrailingSlash'](_0x334533[_0xe79e('0x51')]);_0x334533[_0xe79e('0x52')]=intUtil[_0xe79e('0x53')](_0x334533[_0xe79e('0x52')]);var _0x3a829c=util[_0xe79e('0x4b')](_0xe79e('0x54'),_0x334533[_0xe79e('0x51')]);_0x13c56e['userEmail']=!_[_0xe79e('0x55')](_0x47986a)?_0x47986a[_0xe79e('0x56')]:null;_0x13c56e[_0xe79e('0x1c')]=_0x334533[_0xe79e('0x56')];_0x13c56e[_0xe79e('0x21')]=_0x2fa123[_0xe79e('0x2b')]()==='outbound'?_0x53cb02[_0xe79e('0x57')]:_0x53cb02[_0xe79e('0x58')];_0x13c56e[_0xe79e('0x59')]=_0x2fa123===_0xe79e('0x5a')||_0x2fa123==='unmanaged'?'queue':_0xe79e('0x5b');var _0x24af19=util[_0xe79e('0x4b')](_0xe79e('0x5c'),_0x334533[_0xe79e('0x52')],_0x53cb02[_0xe79e('0x5d')],md5(_0x53cb02[_0xe79e('0x5d')]));if(_0x251a80&&_0x251a80[_0xe79e('0x5e')]){logger[_0xe79e('0x10')](_0xe79e('0x5f'),_0xe79e('0x60'));_0x53cb02['recordingURL']=_0x24af19;}else if(_0x25a5aa&&_0x25a5aa[_0xe79e('0x61')]&&_0x25a5aa[_0xe79e('0x61')]!=='none'){logger['info'](_0xe79e('0x62'),_0xe79e('0x60'));_0x53cb02['recordingURL']=_0x24af19;}else{_0x53cb02[_0xe79e('0x63')]='';}return getAdminUser(_0x2fa123,_0x1edc5d,_0x13c56e,_0x3a829c,_0x5dbf9e,_0x49785b)[_0xe79e('0xb')](getUser(_0x2fa123,_0x1edc5d,_0x3a829c,_0x5dbf9e,_0x49785b))[_0xe79e('0xb')](getEndUser(_0x2fa123,_0x1edc5d,_0x3a829c,_0x5dbf9e,_0x49785b))['then'](getTicket(_0x2fa123,_0x1edc5d,_0x3a829c,_0x42a70a,_0x53cb02,_0x5dbf9e))['then'](function(_0x1c4e63){logger[_0xe79e('0x10')](util[_0xe79e('0x4b')](_0xe79e('0x64'),_0x1c4e63['ticketId']));logger[_0xe79e('0x10')](util[_0xe79e('0x4b')]('call\x20direction:\x20%s',_0x2fa123));if(_0x2fa123!=='unmanaged'){logger['info']('['+[_0x2fa123['toUpperCase']()]+']',_0xe79e('0x65'));emit(_0x334533[_0xe79e('0x51')],_0x47986a[_0xe79e('0x33')],_0x1c4e63[_0xe79e('0x3a')]);}})[_0xe79e('0x1e')](function(_0x58ceb2){logger['error']('['+[_0x2fa123[_0xe79e('0x11')]()]+_0xe79e('0x66'),util['inspect'](_0x58ceb2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0fd8=['Fields','ticketNumber','number','label','Incident','ticketId','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','nameField','toLowerCase','idField','customField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions'];(function(_0x490d4b,_0x5ab8b9){var _0x257f65=function(_0x5d190b){while(--_0x5d190b){_0x490d4b['push'](_0x490d4b['shift']());}};_0x257f65(++_0x5ab8b9);}(_0x0fd8,0x94));var _0x80fd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0fd8[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x80fd('0x0'));var Promise=require(_0x80fd('0x1'));var rp=require(_0x80fd('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x80fd('0x3'));var intUtil=require(_0x80fd('0x4'));var config=require(_0x80fd('0x5'));var logger=require(_0x80fd('0x6'))(_0x80fd('0x7'));config[_0x80fd('0x8')]=_[_0x80fd('0x9')](config[_0x80fd('0x8')],{'host':_0x80fd('0xa'),'port':0x18eb});var io=require(_0x80fd('0xb'))(new Redis(config[_0x80fd('0x8')]));function getAdminUser(_0xda64ee,_0x5cfe69,_0x19053e,_0x335fa9,_0x19890b,_0x306cf3){return new Promise(function(_0x36e2f8,_0x2eb3c9){var _0x2fd874={'method':'GET','uri':_0x335fa9+_0x80fd('0xc')+'&'+_0x19890b+'&'+_0x306cf3,'auth':_0x5cfe69,'json':!![]};return rp(_0x2fd874)['then'](function(_0x4b0edb){if(_0x4b0edb[_0x80fd('0xd')][_0x80fd('0xe')]>0x0){_0x19053e[_0x80fd('0xf')]=_0x4b0edb['result'][0x0]['sys_id'];}logger[_0x80fd('0x10')]('['+[_0xda64ee[_0x80fd('0x11')]()]+_0x80fd('0x12'),_0x19053e);_0x36e2f8(_0x19053e);})[_0x80fd('0x13')](function(_0x1440ea){logger[_0x80fd('0x14')]('['+[_0xda64ee[_0x80fd('0x11')]()]+']',_0x1440ea['message']);_0x2eb3c9(_0x1440ea[_0x80fd('0x15')]);});});}function getUser(_0x4113fd,_0x5d987d,_0x3323ea,_0x17dd7b,_0x183be9){return function(_0x34a5e5){logger['info']('['+[_0x4113fd[_0x80fd('0x11')]()]+_0x80fd('0x16'),_0x34a5e5);return new Promise(function(_0x135367,_0x3b69b9){if(intUtil[_0x80fd('0x17')](_0x34a5e5[_0x80fd('0x18')])){var _0x234877={'method':_0x80fd('0x19'),'uri':_0x3323ea+_0x80fd('0x1a')+_0x34a5e5[_0x80fd('0x18')]+'&'+_0x17dd7b+'&'+_0x183be9,'auth':_0x5d987d,'json':!![]};logger[_0x80fd('0x10')]('['+[_0x4113fd[_0x80fd('0x11')]()]+_0x80fd('0x1b'),_0x234877);return rp(_0x234877)['then'](function(_0x2d7815){logger[_0x80fd('0x10')]('['+[_0x4113fd[_0x80fd('0x11')]()]+'],\x20getUser\x20entity',_0x2d7815);if(_0x2d7815[_0x80fd('0xd')][_0x80fd('0xe')]>0x0&&String(_0x2d7815[_0x80fd('0xd')][0x0][_0x80fd('0x1c')])===_0x80fd('0x1d')){_0x34a5e5[_0x80fd('0x1e')]=_0x2d7815[_0x80fd('0xd')][0x0][_0x80fd('0x1f')];}else{_0x34a5e5[_0x80fd('0x1e')]=_0x34a5e5[_0x80fd('0xf')];_0x34a5e5[_0x80fd('0x18')]=_0x34a5e5[_0x80fd('0x20')];}logger[_0x80fd('0x10')]('['+[_0x4113fd[_0x80fd('0x11')]()]+_0x80fd('0x21'),_0x34a5e5);_0x135367(_0x34a5e5);})[_0x80fd('0x13')](function(_0x473f10){logger[_0x80fd('0x14')]('['+[_0x4113fd[_0x80fd('0x11')]()]+']',_0x473f10[_0x80fd('0x15')]);_0x3b69b9(_0x473f10['message']);});}else{logger[_0x80fd('0x10')]('['+[_0x4113fd['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x34a5e5[_0x80fd('0x1e')]=_0x34a5e5['adminId'];_0x34a5e5[_0x80fd('0x18')]=_0x34a5e5[_0x80fd('0x20')];_0x135367(_0x34a5e5);}});};}function createEndUser(_0x562851,_0x5db6fe,_0x3cea0a,_0x555d6f,_0x57f1f6){logger['info']('['+[_0x562851['toUpperCase']()]+_0x80fd('0x22'),_0x3cea0a);return new Promise(function(_0x45d0e2,_0x153479){var _0x1d0df5={'method':_0x80fd('0x23'),'uri':_0x555d6f+_0x80fd('0x24')+_0x57f1f6,'body':{'user_name':_0x3cea0a[_0x80fd('0x25')],'roles':_0x80fd('0x26'),'first_name':_0x3cea0a['endUserNumber'],'active':_0x80fd('0x1d'),'date_format':_0x80fd('0x27'),'phone':_0x3cea0a[_0x80fd('0x25')]},'auth':_0x5db6fe,'json':!![]};return rp(_0x1d0df5)[_0x80fd('0x28')](function(_0x148cb4){logger[_0x80fd('0x10')]('['+[_0x562851['toUpperCase']()]+_0x80fd('0x29'),_0x148cb4[_0x80fd('0xd')]);_0x3cea0a[_0x80fd('0x2a')]=_0x148cb4[_0x80fd('0xd')][_0x80fd('0x1f')];_0x45d0e2(_0x3cea0a);})['catch'](function(_0xf55e49){logger[_0x80fd('0x14')]('['+[_0x562851['toUpperCase']()]+']',_0xf55e49['message']);_0x153479(_0xf55e49['message']);});});}function getEndUser(_0x7341db,_0x54f929,_0x11b09b,_0x9c08a,_0x4b71cf){return function(_0x174653){logger['info']('['+[_0x7341db[_0x80fd('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x174653);return new Promise(function(_0x49fabf,_0x107618){var _0x46c766={'method':_0x80fd('0x19'),'uri':_0x11b09b+_0x80fd('0x2b')+_0x174653['endUserNumber']+'&'+_0x9c08a+'&'+_0x4b71cf,'auth':_0x54f929,'json':!![]};return rp(_0x46c766)[_0x80fd('0x28')](function(_0x5b1990){if(_0x5b1990[_0x80fd('0xd')][_0x80fd('0xe')]>0x0){_0x174653[_0x80fd('0x2a')]=_0x5b1990['result'][0x0][_0x80fd('0x1f')];logger['info']('['+[_0x7341db[_0x80fd('0x11')]()]+_0x80fd('0x2c'),_0x174653);_0x49fabf(_0x174653);}else{return createEndUser(_0x7341db,_0x54f929,_0x174653,_0x11b09b,_0x9c08a)[_0x80fd('0x28')](function(_0xe1afaa){logger[_0x80fd('0x10')]('['+[_0x7341db[_0x80fd('0x11')]()]+_0x80fd('0x2d'),_0xe1afaa);_0x49fabf(_0xe1afaa);});}})['catch'](function(_0x338ac1){logger[_0x80fd('0x14')]('['+[_0x7341db['toUpperCase']()]+']',_0x338ac1[_0x80fd('0x15')]);_0x107618(_0x338ac1[_0x80fd('0x15')]);});});};}function getCustomFields(_0x5da1f7,_0x57e9fd){var _0x2c3a30={};if(_0x5da1f7['length']>0x0){_['forEach'](_0x5da1f7,function(_0x366687){if(_[_0x80fd('0x2e')]([_0x80fd('0x2f'),_0x80fd('0x30')],_0x366687['type'])&&_0x366687[_0x80fd('0x31')]&&!_0x366687['customField']){_0x2c3a30[_0x366687[_0x80fd('0x31')][_0x80fd('0x32')]()]=_0x366687['content']['toString']();}else if(_['includes']([_0x80fd('0x2f'),_0x80fd('0x30')],_0x366687['type'])&&_0x366687[_0x80fd('0x33')]&&_0x366687[_0x80fd('0x34')]){_0x2c3a30[_0x366687[_0x80fd('0x33')][_0x80fd('0x32')]()]=_0x366687['content'][_0x80fd('0x35')]();}else if(_0x366687['type']===_0x80fd('0x36')&&_0x366687[_0x80fd('0x37')]&&_0x366687[_0x80fd('0x33')]&&_0x366687[_0x80fd('0x34')]){_0x2c3a30[_0x366687[_0x80fd('0x33')][_0x80fd('0x32')]()]=_0x57e9fd[_0x366687['variableName']][_0x80fd('0x35')]();}else if(_0x366687['type']===_0x80fd('0x38')&&_0x366687[_0x80fd('0x39')]&&_0x366687[_0x80fd('0x39')][_0x80fd('0x3a')]&&_0x366687[_0x80fd('0x33')]&&_0x366687[_0x80fd('0x34')]){_0x2c3a30[_0x366687[_0x80fd('0x33')][_0x80fd('0x32')]()]=_0x57e9fd[_0x366687['Variable'][_0x80fd('0x3a')][_0x80fd('0x32')]()]['toString']();}});}return _0x2c3a30;}function getTicket(_0x529e37,_0x4e4f43,_0x4daa9e,_0x2c2dac,_0x5b71d9,_0x1a0273){return function(_0x164836){logger[_0x80fd('0x10')]('['+[_0x529e37[_0x80fd('0x11')]()]+_0x80fd('0x3b'),_0x164836);return new Promise(function(_0x86251a,_0x168d8c){var _0x2e71df=_0x529e37[_0x80fd('0x32')]()===_0x80fd('0x3c')?_0x164836['userId']:_0x164836[_0x80fd('0x2a')];var _0x295738={'method':_0x80fd('0x23'),'uri':_0x4daa9e+_0x80fd('0x3d')+'?'+_0x1a0273,'body':Object[_0x80fd('0x3e')]({},{'active':'true','caller_id':_0x2e71df,'assigned_to':_0x164836['userId'],'short_description':intUtil['getString'](_0x2c2dac[_0x80fd('0x3f')],_0x5b71d9,'\x20'),'description':intUtil[_0x80fd('0x40')](_0x2c2dac[_0x80fd('0x41')],_0x5b71d9,'\x0a')},getCustomFields(_0x2c2dac[_0x80fd('0x42')],_0x5b71d9)),'auth':_0x4e4f43,'json':!![]};return rp(_0x295738)[_0x80fd('0x28')](function(_0x26fd89){logger[_0x80fd('0x10')]('['+[_0x529e37[_0x80fd('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x26fd89[_0x80fd('0xd')]);_0x164836['ticketId']=_0x26fd89['result'][_0x80fd('0x1f')];_0x164836[_0x80fd('0x43')]=_0x26fd89['result'][_0x80fd('0x44')];logger[_0x80fd('0x10')]('['+[_0x529e37[_0x80fd('0x11')]()]+']\x20getTicket\x20crm',_0x164836);_0x86251a(_0x164836);})[_0x80fd('0x13')](function(_0x445253){logger[_0x80fd('0x14')]('['+[_0x529e37[_0x80fd('0x11')]()]+']',_0x445253[_0x80fd('0x15')]);_0x168d8c(_0x445253['message']);});});};}function createRemoteTag(_0xe9e1ed,_0x42ac7a,_0x141122,_0x412600){return new Promise(function(_0xf5a371,_0x2d059b){var _0x1ed542={'method':_0x80fd('0x23'),'uri':_0x141122+_0x80fd('0x45')+'?'+_0x412600,'body':{'short_description':_0xe9e1ed,'global':!![],'active':!![],'name':_0xe9e1ed},'auth':_0x42ac7a,'json':!![]};return rp(_0x1ed542)[_0x80fd('0x28')](function(_0x439c36){var _0x415386=_0x439c36[_0x80fd('0xd')]['sys_id'];_0xf5a371(_0x415386);});});}function getRemoteTag(_0x417163,_0x967dd3,_0x178961,_0x4dc0ce,_0xf1b6f7){return new Promise(function(_0xa3c73,_0x5bd55e){var _0x62588c={'method':_0x80fd('0x19'),'uri':_0x178961+'label'+'?sysparm_query=name%3D'+_0x417163+'&'+_0x4dc0ce,'auth':_0x967dd3,'json':!![]};return rp(_0x62588c)['then'](function(_0x5c3f09){if(_0x5c3f09[_0x80fd('0xd')][_0x80fd('0xe')]>0x0){var _0x2a9395=_0x5c3f09['result'][0x0][_0x80fd('0x1f')];_0xa3c73(_0x2a9395);}else{return createRemoteTag(_0x417163,_0x967dd3,_0x178961,_0x4dc0ce)[_0x80fd('0x28')](function(_0x2099d9){_0xa3c73(_0x2099d9);});}});});}function assignTagToIncident(_0x34aeba,_0x445040,_0x5a2347,_0x2d1665,_0xfed5f0){return new Promise(function(_0x3c903c,_0x2e07a1){var _0x43926a={'method':_0x80fd('0x23'),'uri':_0x5a2347+'label_entry'+'?'+_0xfed5f0,'body':{'label':_0x34aeba,'table':_0x80fd('0x3d'),'id_type':_0x80fd('0x46'),'table_key':_0x2d1665[_0x80fd('0x47')],'title':_0x80fd('0x48')+_0x2d1665['ticketNumber'],'id_display':_0x2d1665[_0x80fd('0x43')]},'auth':_0x445040,'json':!![]};return rp(_0x43926a)[_0x80fd('0x28')](function(_0xcc3569){_0x3c903c();})['catch'](function(){_0x3c903c();});});}function manageTags(_0x170456,_0x1d2e56,_0x186911,_0x4f87ce,_0x563ed8,_0x505e2e,_0x2ec3d9){return new Promise(function(_0x310c89,_0xb39c58){var _0x46f6d1=[];_0x1d2e56[_0x80fd('0x49')](function(_0x29fdfe){_0x46f6d1[_0x80fd('0x4a')](getRemoteTag(_0x29fdfe,_0x186911,_0x4f87ce,_0x505e2e,_0x2ec3d9));});return Promise[_0x80fd('0x4b')](_0x46f6d1)[_0x80fd('0x28')](function(_0x27c55b){if(_0x27c55b['length']){logger[_0x80fd('0x10')]('['+[_0x170456[_0x80fd('0x11')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x27c55b);var _0x51d0dd=[];_0x27c55b[_0x80fd('0x49')](function(_0x1877e4){_0x51d0dd['push'](assignTagToIncident(_0x1877e4,_0x186911,_0x4f87ce,_0x563ed8,_0x505e2e));});return Promise[_0x80fd('0x4b')](_0x51d0dd)['then'](function(){_0x310c89();})[_0x80fd('0x13')](function(){_0x310c89();});}else{_0x310c89();}});});}function getTags(_0x5ad61e,_0x75f6e7,_0x1a50a9,_0x464475,_0x146a29,_0x1299ae){return function(_0x4c126a){return new Promise(function(_0x102822,_0x1df6db){var _0x462cb7=[];var _0x27e52b=_0x464475[_0x80fd('0x4c')];if(_0x27e52b&&_0x27e52b[_0x80fd('0xe')]>0x0){_0x462cb7=_[_0x80fd('0x4d')](_0x27e52b,_0x80fd('0x3a'));}if(_0x462cb7[_0x80fd('0xe')]>0x0){return manageTags(_0x5ad61e,_0x462cb7,_0x75f6e7,_0x1a50a9,_0x4c126a,_0x146a29,_0x1299ae)['then'](function(){_0x102822(_0x4c126a);});}else{_0x102822(_0x4c126a);}});};}function emit(_0x48fce6,_0x1c63a2,_0x454133){var _0x4b9840='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x80fd('0x4e')+_0x80fd('0x4f');var _0x5c9a15={'uri':_0x48fce6+_0x80fd('0x50')+_0x454133+_0x4b9840};io['to'](util[_0x80fd('0x51')](_0x80fd('0x52'),_0x1c63a2))[_0x80fd('0x53')](_0x80fd('0x54'),_0x5c9a15);}exports['cs']=function(_0x43ec2b,_0x391977,_0x54d4b7,_0x8ab3e8,_0x212bfd,_0x2558d2,_0x556eb7,_0x709e95){var _0x541d86={};var _0xb85bd8={'user':_0x2558d2['username'],'pass':_0x2558d2[_0x80fd('0x55')]};var _0x14fce4=_0x80fd('0x56');var _0x437af0=_0x80fd('0x57');_0x2558d2[_0x80fd('0x58')]=intUtil[_0x80fd('0x59')](_0x2558d2[_0x80fd('0x58')]);_0x2558d2['serverUrl']=intUtil[_0x80fd('0x59')](_0x2558d2['serverUrl']);var _0x5184f6=util['format'](_0x80fd('0x5a'),_0x2558d2[_0x80fd('0x58')]);_0x541d86[_0x80fd('0x18')]=!_[_0x80fd('0x5b')](_0x8ab3e8)?_0x8ab3e8[_0x80fd('0x5c')]:null;_0x541d86[_0x80fd('0x20')]=_0x2558d2['email'];_0x541d86[_0x80fd('0x25')]=_0x709e95['toLowerCase']()===_0x80fd('0x3c')?_0x391977[_0x80fd('0x5d')]:_0x391977[_0x80fd('0x5e')];_0x541d86['callDirection']=_0x709e95===_0x80fd('0x5f')||_0x709e95==='unmanaged'?_0x80fd('0x5f'):_0x80fd('0x3c');var _0x258f44=util['format'](_0x80fd('0x60'),_0x2558d2['serverUrl'],_0x391977[_0x80fd('0x61')],md5(_0x391977[_0x80fd('0x61')]));if(_0x212bfd&&_0x212bfd[_0x80fd('0x62')]){logger['info'](_0x80fd('0x63'),_0x80fd('0x64'));_0x391977[_0x80fd('0x65')]=_0x258f44;}else if(_0x556eb7&&_0x556eb7[_0x80fd('0x66')]&&_0x556eb7[_0x80fd('0x66')]!==_0x80fd('0x67')){logger[_0x80fd('0x10')]('[OUTBOUND]',_0x80fd('0x64'));_0x391977['recordingURL']=_0x258f44;}else{_0x391977[_0x80fd('0x65')]='';}return getAdminUser(_0x709e95,_0xb85bd8,_0x541d86,_0x5184f6,_0x437af0,_0x14fce4)[_0x80fd('0x28')](getUser(_0x709e95,_0xb85bd8,_0x5184f6,_0x437af0,_0x14fce4))[_0x80fd('0x28')](getEndUser(_0x709e95,_0xb85bd8,_0x5184f6,_0x437af0,_0x14fce4))['then'](getTicket(_0x709e95,_0xb85bd8,_0x5184f6,_0x54d4b7,_0x391977,_0x437af0))[_0x80fd('0x28')](function(_0x116f0c){logger[_0x80fd('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x116f0c[_0x80fd('0x47')]));logger[_0x80fd('0x10')](util[_0x80fd('0x51')]('call\x20direction:\x20%s',_0x709e95));if(_0x709e95!=='unmanaged'){logger[_0x80fd('0x10')]('['+[_0x709e95['toUpperCase']()]+']',_0x80fd('0x68'));emit(_0x2558d2[_0x80fd('0x58')],_0x8ab3e8[_0x80fd('0x3a')],_0x116f0c[_0x80fd('0x47')]);}})['catch'](function(_0xda628c){logger['error']('['+[_0x709e95['toUpperCase']()]+_0x80fd('0x69'),util[_0x80fd('0x6a')](_0xda628c,{'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 71d100e..4e120b0 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 _0xb9d1=['resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','','Caller\x20-\x20%s','first_name','debug','[HTTP]','map','forEach','type','nameField','customField','content','toString','string','idField','variable','customVariable','Variable','toLowerCase','custom_fields','login','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','length','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','user_name','value','Agent\x20found!'];(function(_0x384e42,_0x43a028){var _0x28465e=function(_0x259ad0){while(--_0x259ad0){_0x384e42['push'](_0x384e42['shift']());}};_0x28465e(++_0x43a028);}(_0xb9d1,0x145));var _0x1b9d=function(_0x38338a,_0x4ff88c){_0x38338a=_0x38338a-0x0;var _0x166c63=_0xb9d1[_0x38338a];return _0x166c63;};'use strict';var _=require(_0x1b9d('0x0'));var rp=require(_0x1b9d('0x1'));var BPromise=require(_0x1b9d('0x2'));var md5=require(_0x1b9d('0x3'));var util=require(_0x1b9d('0x4'));var Redis=require(_0x1b9d('0x5'));var intUtil=require(_0x1b9d('0x6'));var config=require(_0x1b9d('0x7'));var logger=require(_0x1b9d('0x8'))(_0x1b9d('0x9'));config[_0x1b9d('0xa')]=_['defaults'](config[_0x1b9d('0xa')],{'host':_0x1b9d('0xb'),'port':0x18eb});var io=require(_0x1b9d('0xc'))(new Redis(config[_0x1b9d('0xa')]));var def={'method':_0x1b9d('0xd'),'json':!![]};function emit(_0x2b9506,_0x360b26,_0x41babb){io['to'](_0x2b9506)[_0x1b9d('0xe')](_0x360b26,_0x41babb);}function getTicket(_0x110db0,_0x553b22,_0x1c9c78,_0x46b55f,_0x27f6b9,_0x275b7f,_0x4ad054,_0x127ffb){logger[_0x1b9d('0xf')](_0x1b9d('0x10'));var _0x1becf6=new Date();var _0x3ec1ab=[{'name':'name','value':intUtil[_0x1b9d('0x11')](_0x46b55f[_0x1b9d('0x12')],_0x27f6b9,'\x20')},{'name':_0x1b9d('0x13'),'value':_0x553b22['id']},{'name':_0x1b9d('0x14'),'value':_0x553b22['id']},{'name':_0x1b9d('0x15'),'value':intUtil[_0x1b9d('0x11')](_0x46b55f[_0x1b9d('0x16')],_0x27f6b9,'\x0a')},{'name':_0x1b9d('0x17'),'value':_0x1becf6[_0x1b9d('0x18')]()['slice'](0x0,0x13)[_0x1b9d('0x19')]('T','\x20')},{'name':_0x1b9d('0x1a'),'value':'0'},{'name':_0x1b9d('0x1b'),'value':'15'},{'name':_0x1b9d('0x1c'),'value':_0x1c9c78['id']},{'name':_0x1b9d('0x1d'),'value':_0x1b9d('0x1e')},{'name':_0x1b9d('0x1f'),'value':_0x1c9c78[_0x1b9d('0x20')]},{'name':_0x1b9d('0x21'),'value':_0x127ffb}];if(_0x275b7f[_0x1b9d('0x22')]){_['forEach'](_0x275b7f,function(_0x113fe4){if(_0x27f6b9[_0x113fe4[_0x1b9d('0x23')]]){_0x3ec1ab[_0x1b9d('0x24')]({'name':_0x113fe4['idField'],'value':_0x27f6b9[_0x113fe4[_0x1b9d('0x23')]]});}});}return request({'form':{'method':_0x1b9d('0x25'),'input_type':'JSON','response_type':_0x1b9d('0x26'),'rest_data':JSON[_0x1b9d('0x27')]({'session':_0x4ad054['id'],'module_name':_0x1b9d('0x28'),'name_value_list':_0x3ec1ab})}});}function getAuth(_0x4e51aa){return util[_0x1b9d('0x29')](_0x1b9d('0x2a'),new Buffer(_0x4e51aa[_0x1b9d('0x2b')]+':X')['toString'](_0x1b9d('0x2c')));}function getServerInfo(_0x582d71){return request({'form':{'method':_0x1b9d('0x2d'),'input_type':_0x1b9d('0x26'),'response_type':_0x1b9d('0x26'),'rest_data':JSON['stringify']({'session':_0x582d71['id']})}});}function getUser(_0x5a2f67,_0x5e393c,_0x7aa3f0){if(!_[_0x1b9d('0x2e')](_0x5e393c)){logger[_0x1b9d('0xf')]('Getting\x20agent\x20with\x20name',_0x5e393c);return request({'form':{'method':_0x1b9d('0x2f'),'input_type':_0x1b9d('0x26'),'response_type':_0x1b9d('0x26'),'rest_data':JSON['stringify']({'session':_0x7aa3f0['id'],'module_name':_0x1b9d('0x30'),'query':util['format'](_0x1b9d('0x31'),_0x5e393c),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1b9d('0x32')](function(_0x53cd3e){if(_0x53cd3e[_0x1b9d('0x33')]['length']){var _0x259f94=_[_0x1b9d('0x34')](_0x53cd3e['entry_list'],function(_0x18831b){return _0x18831b['name_value_list'][_0x1b9d('0x35')][_0x1b9d('0x36')]===_0x5e393c;});if(_0x259f94){logger[_0x1b9d('0xf')](_0x1b9d('0x37'));return BPromise[_0x1b9d('0x38')]({'id':_0x259f94[_0x1b9d('0x39')]['id']['value'],'name':_0x259f94[_0x1b9d('0x39')][_0x1b9d('0x20')][_0x1b9d('0x36')]});}}logger['info'](_0x1b9d('0x3a'));return BPromise[_0x1b9d('0x38')]({'id':_0x7aa3f0['name_value_list'][_0x1b9d('0x3b')][_0x1b9d('0x36')],'name':_0x7aa3f0[_0x1b9d('0x39')][_0x1b9d('0x35')][_0x1b9d('0x36')]});});}else{logger['info'](_0x1b9d('0x3c'));return BPromise[_0x1b9d('0x38')]({'id':_0x7aa3f0[_0x1b9d('0x39')][_0x1b9d('0x3b')]['value'],'name':_0x7aa3f0['name_value_list'][_0x1b9d('0x35')][_0x1b9d('0x36')]});}}function getEndUser(_0x4c71f4,_0x2b5773,_0x3e01d0,_0x5c51bb){logger[_0x1b9d('0xf')](_0x1b9d('0x3d'),_0x3e01d0);return request({'form':{'method':_0x1b9d('0x2f'),'input_type':_0x1b9d('0x26'),'response_type':_0x1b9d('0x26'),'rest_data':JSON[_0x1b9d('0x27')]({'session':_0x5c51bb['id'],'module_name':_0x1b9d('0x1e'),'query':util[_0x1b9d('0x29')](_0x1b9d('0x3e'),_0x3e01d0),'order_by':'','offset':'0','select_fields':['id','name',_0x1b9d('0x3f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1b9d('0x32')](function(_0x32292a){if(_0x32292a[_0x1b9d('0x33')][_0x1b9d('0x22')]){var _0x2a98d2=_[_0x1b9d('0x34')](_0x32292a['entry_list'],function(_0x2e5459){return _0x2e5459[_0x1b9d('0x39')][_0x1b9d('0x3f')]['value']===_0x3e01d0;});if(_0x2a98d2){logger[_0x1b9d('0xf')](_0x1b9d('0x40'));return BPromise[_0x1b9d('0x38')]({'id':_0x2a98d2[_0x1b9d('0x39')]['id']['value'],'name':_0x2a98d2['name_value_list'][_0x1b9d('0x20')][_0x1b9d('0x36')],'phone':_0x2a98d2[_0x1b9d('0x39')]['phone_home']['value']});}}else{logger[_0x1b9d('0xf')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x1b9d('0x25'),'input_type':_0x1b9d('0x26'),'response_type':_0x1b9d('0x26'),'rest_data':JSON[_0x1b9d('0x27')]({'session':_0x5c51bb['id'],'module_name':_0x1b9d('0x1e'),'name_value_list':[{'name':'first_name','value':_0x2b5773!==_0x1b9d('0x41')?_0x2b5773:util[_0x1b9d('0x29')](_0x1b9d('0x42'),_0x3e01d0)},{'name':_0x1b9d('0x3f'),'value':_0x3e01d0}]})}})['then'](function(_0x36366a){logger[_0x1b9d('0xf')]('Enduser\x20created.');return BPromise[_0x1b9d('0x38')]({'id':_0x36366a['id'],'name':_0x36366a[_0x1b9d('0x33')][_0x1b9d('0x43')][_0x1b9d('0x36')],'phone':_0x36366a[_0x1b9d('0x33')][_0x1b9d('0x3f')][_0x1b9d('0x36')]});});}});}function request(_0xbc1aab){logger[_0x1b9d('0x44')](_0x1b9d('0x45'),JSON[_0x1b9d('0x27')](_0xbc1aab));return rp(_['merge'](def,_0xbc1aab));}function getTags(_0x3cfc72,_0x552b05){var _0xa4c3f0=[];if(_0x3cfc72&&_0x3cfc72['length']>0x0){_0xa4c3f0=_[_0x1b9d('0x46')](_0x3cfc72,_0x552b05);}return _0xa4c3f0;}function getCustomFields(_0x2c0584,_0x3c1b49){var _0x32fa93=[];var _0x545b53={'custom_fields':[]};if(_0x2c0584[_0x1b9d('0x22')]>0x0){_[_0x1b9d('0x47')](_0x2c0584,function(_0x35847c){if(_0x35847c[_0x1b9d('0x48')]==='string'&&_0x35847c[_0x1b9d('0x49')]&&!_0x35847c[_0x1b9d('0x4a')]){_0x545b53[_0x35847c['nameField']['toLowerCase']()]=_0x35847c[_0x1b9d('0x4b')][_0x1b9d('0x4c')]();}else if(_0x35847c[_0x1b9d('0x48')]===_0x1b9d('0x4d')&&_0x35847c[_0x1b9d('0x4e')]&&_0x35847c[_0x1b9d('0x4a')]){_0x545b53['custom_fields'][_0x1b9d('0x24')]({'id':_0x35847c['idField'],'value':_0x35847c[_0x1b9d('0x4b')][_0x1b9d('0x4c')]()});}else if(_0x35847c[_0x1b9d('0x48')]===_0x1b9d('0x4f')&&_0x35847c['variableName']&&_0x35847c[_0x1b9d('0x4e')]&&_0x35847c[_0x1b9d('0x4a')]){_0x3c1b49[_0x35847c[_0x1b9d('0x23')]]&&_0x545b53['custom_fields']['push']({'id':_0x35847c[_0x1b9d('0x4e')],'value':_0x3c1b49[_0x35847c['variableName']]['toString']()});}else if(_0x35847c['type']===_0x1b9d('0x50')&&_0x35847c[_0x1b9d('0x51')]&&_0x35847c['Variable'][_0x1b9d('0x20')]&&_0x35847c[_0x1b9d('0x4e')]&&_0x35847c[_0x1b9d('0x4a')]){_0x3c1b49[_0x35847c[_0x1b9d('0x51')][_0x1b9d('0x20')][_0x1b9d('0x52')]()]&&_0x545b53[_0x1b9d('0x53')][_0x1b9d('0x24')]({'id':_0x35847c[_0x1b9d('0x4e')],'value':_0x3c1b49[_0x35847c['Variable']['name'][_0x1b9d('0x52')]()]['toString']()});}});}return _0x545b53;}function getConnection(_0x581d25){return request({'method':_0x1b9d('0xd'),'form':{'method':_0x1b9d('0x54'),'input_type':_0x1b9d('0x26'),'response_type':_0x1b9d('0x26'),'rest_data':JSON[_0x1b9d('0x27')]({'user_auth':{'user_name':_0x581d25['username'],'password':_0x581d25[_0x1b9d('0x55')],'encryption':_0x1b9d('0x56')},'application':_0x1b9d('0x57')})}})[_0x1b9d('0x32')](function(_0x1a9ebc){var _0x203814=_0x1a9ebc;if(_0x203814['id']){def['sessionID']=_0x203814['id'];return BPromise[_0x1b9d('0x38')](_0x203814);}else{throw new Error(util['format'](_0x1b9d('0x58'),_0x581d25['id']));}});}function setRelationship(_0x282f15,_0x3c0d58,_0x245eb3,_0x5b1798){return request({'form':{'method':'set_relationship','input_type':_0x1b9d('0x26'),'response_type':_0x1b9d('0x26'),'rest_data':JSON[_0x1b9d('0x27')]({'session':_0x282f15['id'],'module_name':_0x1b9d('0x28'),'module_id':_0x245eb3['id'],'link_field_name':_0x5b1798,'related_ids':[_0x3c0d58['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1b9d('0x59')]=function(_0x1430a9,_0x3d0422,_0x32570f,_0x590f2a,_0xa66748,_0x11d8af){var _0x28ac19,_0x1848df,_0x2c5e22,_0x509a50;_0x11d8af[_0x1b9d('0x5a')]=intUtil[_0x1b9d('0x5b')](_0x11d8af[_0x1b9d('0x5a')]);_0x11d8af[_0x1b9d('0x5c')]=intUtil[_0x1b9d('0x5b')](_0x11d8af['serverUrl']);def['uri']=util['format'](_0x1b9d('0x5d'),_0x11d8af[_0x1b9d('0x5a')]);if(_0xa66748&&_0xa66748[_0x1b9d('0x5e')]){logger[_0x1b9d('0xf')]('[QUEUE]',_0x1b9d('0x5f'));_0x3d0422[_0x1b9d('0x60')]=util[_0x1b9d('0x29')](_0x1b9d('0x61'),_0x11d8af[_0x1b9d('0x5c')],_0x3d0422[_0x1b9d('0x62')],md5(_0x3d0422['uniqueid']));}else{_0x3d0422[_0x1b9d('0x60')]='';}return getConnection(_0x11d8af)[_0x1b9d('0x32')](function(_0x162a48){_0x509a50=_0x162a48;return getUser(_0x11d8af,_0x590f2a[_0x1b9d('0x20')],_0x509a50);})[_0x1b9d('0x32')](function(_0x178bc4){_0x28ac19=_0x178bc4;logger[_0x1b9d('0xf')]('The\x20User\x20ID\x20is:',_0x28ac19['id']);return getEndUser(_0x11d8af,_0x3d0422[_0x1b9d('0x63')],_0x3d0422[_0x1b9d('0x64')],_0x509a50);})['then'](function(_0x1044b2){_0x1848df=_0x1044b2;logger[_0x1b9d('0xf')]('The\x20Enduser\x20ID\x20is:',_0x1848df['id']);return getTicket(_0x11d8af,_0x28ac19,_0x1848df,_0x32570f,_0x3d0422,_0x32570f[_0x1b9d('0x65')],_0x509a50,'Inbound');})[_0x1b9d('0x32')](function(_0x39be60){_0x2c5e22=_0x39be60;logger[_0x1b9d('0xf')]('Ticket\x20created!');logger[_0x1b9d('0xf')](_0x1b9d('0x66'),_0x2c5e22['id']);return setRelationship(_0x509a50,_0x28ac19,_0x2c5e22,_0x1b9d('0x67'));})[_0x1b9d('0x32')](function(){return setRelationship(_0x509a50,_0x1848df,_0x2c5e22,_0x1b9d('0x68'));})[_0x1b9d('0x32')](function(){return getServerInfo(_0x509a50);})[_0x1b9d('0x32')](function(_0x19d2a0){var _0x41e993=parseInt(_0x19d2a0[_0x1b9d('0x69')][_0x1b9d('0x6a')](0x0));var _0x4ab530=util['format'](_0x1b9d('0x6b'),_0x11d8af[_0x1b9d('0x5a')],_0x2c5e22['id']);if(_0x41e993>0x6){_0x4ab530=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x11d8af[_0x1b9d('0x5a')],_0x2c5e22['id']);}logger[_0x1b9d('0xf')](_0x1b9d('0x6c'),_0x1b9d('0x6d'));emit(util[_0x1b9d('0x29')](_0x1b9d('0x6e'),_0x590f2a[_0x1b9d('0x20')]),_0x1b9d('0x6f'),{'uri':_0x4ab530});})[_0x1b9d('0x70')](function(_0x73a036){logger[_0x1b9d('0x71')](_0x1b9d('0x6c'),JSON['stringify'](_0x73a036));});};exports[_0x1b9d('0x72')]=function(_0x515fc9,_0x2db77a,_0xf76c6e,_0x32883e,_0x5413aa,_0x2ddaf3,_0x128c05){var _0xc33964,_0x4ef854,_0x4585c8,_0x57dec1;_0x2ddaf3[_0x1b9d('0x5a')]=intUtil[_0x1b9d('0x5b')](_0x2ddaf3[_0x1b9d('0x5a')]);_0x2ddaf3['serverUrl']=intUtil[_0x1b9d('0x5b')](_0x2ddaf3[_0x1b9d('0x5c')]);def[_0x1b9d('0x73')]=util['format'](_0x1b9d('0x5d'),_0x2ddaf3[_0x1b9d('0x5a')]);if(_0x128c05&&_0x128c05[_0x1b9d('0x74')]&&_0x128c05[_0x1b9d('0x74')]!==_0x1b9d('0x75')){logger['info']('[OUTBOUND]',_0x1b9d('0x5f'));_0x2db77a[_0x1b9d('0x60')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ddaf3['serverUrl'],_0x2db77a[_0x1b9d('0x62')],md5(_0x2db77a['uniqueid']));}return getConnection(_0x2ddaf3)[_0x1b9d('0x32')](function(_0x5dbd65){_0x57dec1=_0x5dbd65;return getUser(_0x2ddaf3,_0x32883e[_0x1b9d('0x20')],_0x57dec1);})['then'](function(_0x491cf2){_0xc33964=_0x491cf2;logger[_0x1b9d('0xf')](_0x1b9d('0x76'),_0xc33964['id']);return getEndUser(_0x2ddaf3,_0x2db77a['destcalleridname'],_0x2db77a[_0x1b9d('0x77')],_0x57dec1);})[_0x1b9d('0x32')](function(_0x3925e2){_0x4ef854=_0x3925e2;logger[_0x1b9d('0xf')](_0x1b9d('0x78'),_0x4ef854['id']);return getTicket(_0x2ddaf3,_0xc33964,_0x4ef854,_0xf76c6e,_0x2db77a,_0xf76c6e['Fields'],_0x57dec1,'Outbound');})[_0x1b9d('0x32')](function(_0x21a8ba){_0x4585c8=_0x21a8ba;logger[_0x1b9d('0xf')](_0x1b9d('0x79'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4585c8['id']);return setRelationship(_0x57dec1,_0xc33964,_0x4585c8,_0x1b9d('0x67'));})[_0x1b9d('0x32')](function(){return setRelationship(_0x57dec1,_0x4ef854,_0x4585c8,_0x1b9d('0x68'));})[_0x1b9d('0x32')](function(){return getServerInfo(_0x57dec1);})['then'](function(_0x33a17b){var _0x3a2229=parseInt(_0x33a17b[_0x1b9d('0x69')][_0x1b9d('0x6a')](0x0));var _0x11e834=util[_0x1b9d('0x29')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2ddaf3[_0x1b9d('0x5a')],_0x4585c8['id']);if(_0x3a2229>0x6){_0x11e834=util[_0x1b9d('0x29')](_0x1b9d('0x7a'),_0x2ddaf3[_0x1b9d('0x5a')],_0x4585c8['id']);}logger['info']('[OUTBOUND]',_0x1b9d('0x6d'));emit(util[_0x1b9d('0x29')](_0x1b9d('0x6e'),_0x32883e['name']),_0x1b9d('0x6f'),{'uri':_0x11e834});})[_0x1b9d('0x70')](function(_0x4ece27){logger[_0x1b9d('0x71')](_0x1b9d('0x7b'),JSON[_0x1b9d('0x27')](_0x4ece27));});};exports[_0x1b9d('0x7c')]=function(_0x51df1d,_0x1cea0a,_0x29a99f,_0x3bb268,_0x4ed480,_0x3d9d1a){var _0x566c4b,_0x596f8d,_0xd9bf41,_0x1f47c2;_0x3d9d1a[_0x1b9d('0x5a')]=intUtil['stripTrailingSlash'](_0x3d9d1a[_0x1b9d('0x5a')]);_0x3d9d1a['serverUrl']=intUtil[_0x1b9d('0x5b')](_0x3d9d1a[_0x1b9d('0x5c')]);def[_0x1b9d('0x73')]=util[_0x1b9d('0x29')](_0x1b9d('0x5d'),_0x3d9d1a[_0x1b9d('0x5a')]);if(_0x4ed480&&_0x4ed480[_0x1b9d('0x5e')]){logger[_0x1b9d('0xf')]('['+_0x1cea0a[_0x1b9d('0x7d')][_0x1b9d('0x7e')]()+']',_0x1b9d('0x5f'));_0x1cea0a['recordingURL']=util[_0x1b9d('0x29')](_0x1b9d('0x61'),_0x3d9d1a['serverUrl'],_0x1cea0a[_0x1b9d('0x62')],md5(_0x1cea0a[_0x1b9d('0x62')]));}else{_0x1cea0a['recordingURL']='';}return getConnection(_0x3d9d1a)['then'](function(_0x512afe){_0x1f47c2=_0x512afe;if(!_['isNil'](_0x3bb268)){return getUser(_0x3d9d1a,_0x3bb268[_0x1b9d('0x20')],_0x1f47c2);}else{return getUser(_0x3d9d1a,null,_0x1f47c2);}})[_0x1b9d('0x32')](function(_0x3503f4){_0x566c4b=_0x3503f4;logger[_0x1b9d('0xf')](_0x1b9d('0x76'),_0x566c4b['id']);return getEndUser(_0x3d9d1a,_0x1cea0a[_0x1b9d('0x63')],_0x1cea0a[_0x1b9d('0x64')],_0x1f47c2);})[_0x1b9d('0x32')](function(_0x5082eb){_0x596f8d=_0x5082eb;logger[_0x1b9d('0xf')](_0x1b9d('0x78'),_0x596f8d['id']);return getTicket(_0x3d9d1a,_0x566c4b,_0x596f8d,_0x29a99f,_0x1cea0a,_0x29a99f[_0x1b9d('0x65')],_0x1f47c2,'Inbound');})[_0x1b9d('0x32')](function(_0x395a93){_0xd9bf41=_0x395a93;logger['info']('Ticket\x20created!');logger[_0x1b9d('0xf')](_0x1b9d('0x66'),_0xd9bf41['id']);return setRelationship(_0x1f47c2,_0x566c4b,_0xd9bf41,'users');})['then'](function(){return setRelationship(_0x1f47c2,_0x596f8d,_0xd9bf41,_0x1b9d('0x68'));})[_0x1b9d('0x32')](function(){return getServerInfo(_0x1f47c2);})['catch'](function(_0x2e41fc){logger['error']('['+_0x1cea0a[_0x1b9d('0x7d')][_0x1b9d('0x7e')]()+']',JSON[_0x1b9d('0x27')](_0x2e41fc));});}; \ No newline at end of file +var _0x8f7c=['user:%s','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','POST','emit','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','slice','duration_minutes','parent_id','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','get_server_info','isNil','info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','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\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','debug','[HTTP]','map','type','nameField','customField','toLowerCase','string','custom_fields','content','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s'];(function(_0x59987a,_0x399e11){var _0x460646=function(_0x32c3c0){while(--_0x32c3c0){_0x59987a['push'](_0x59987a['shift']());}};_0x460646(++_0x399e11);}(_0x8f7c,0x179));var _0xc8f7=function(_0x33801c,_0x3041e2){_0x33801c=_0x33801c-0x0;var _0x183319=_0x8f7c[_0x33801c];return _0x183319;};'use strict';var _=require(_0xc8f7('0x0'));var rp=require(_0xc8f7('0x1'));var BPromise=require(_0xc8f7('0x2'));var md5=require(_0xc8f7('0x3'));var util=require(_0xc8f7('0x4'));var Redis=require(_0xc8f7('0x5'));var intUtil=require(_0xc8f7('0x6'));var config=require(_0xc8f7('0x7'));var logger=require(_0xc8f7('0x8'))(_0xc8f7('0x9'));config['redis']=_[_0xc8f7('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc8f7('0xb')]));var def={'method':_0xc8f7('0xc'),'json':!![]};function emit(_0x35814a,_0x177189,_0x2a679f){io['to'](_0x35814a)[_0xc8f7('0xd')](_0x177189,_0x2a679f);}function getTicket(_0x24b825,_0xb05496,_0x5b314a,_0x365dc7,_0x1f8b59,_0x295083,_0x1842aa,_0x1c2cc6){logger['info'](_0xc8f7('0xe'));var _0xcc601a=new Date();var _0x5d00e7=[{'name':_0xc8f7('0xf'),'value':intUtil['getString'](_0x365dc7[_0xc8f7('0x10')],_0x1f8b59,'\x20')},{'name':_0xc8f7('0x11'),'value':_0xb05496['id']},{'name':_0xc8f7('0x12'),'value':_0xb05496['id']},{'name':_0xc8f7('0x13'),'value':intUtil[_0xc8f7('0x14')](_0x365dc7[_0xc8f7('0x15')],_0x1f8b59,'\x0a')},{'name':'date_start','value':_0xcc601a[_0xc8f7('0x16')]()[_0xc8f7('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xc8f7('0x18'),'value':'15'},{'name':_0xc8f7('0x19'),'value':_0x5b314a['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xc8f7('0x1a'),'value':_0x5b314a[_0xc8f7('0xf')]},{'name':_0xc8f7('0x1b'),'value':_0x1c2cc6}];if(_0x295083[_0xc8f7('0x1c')]){_[_0xc8f7('0x1d')](_0x295083,function(_0x1adacc){if(_0x1f8b59[_0x1adacc[_0xc8f7('0x1e')]]){_0x5d00e7[_0xc8f7('0x1f')]({'name':_0x1adacc[_0xc8f7('0x20')],'value':_0x1f8b59[_0x1adacc[_0xc8f7('0x1e')]]});}});}return request({'form':{'method':_0xc8f7('0x21'),'input_type':_0xc8f7('0x22'),'response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'session':_0x1842aa['id'],'module_name':_0xc8f7('0x24'),'name_value_list':_0x5d00e7})}});}function getAuth(_0x5747b4){return util[_0xc8f7('0x25')]('Basic\x20%s',new Buffer(_0x5747b4[_0xc8f7('0x26')]+':X')[_0xc8f7('0x27')]('base64'));}function getServerInfo(_0x5b3c3e){return request({'form':{'method':_0xc8f7('0x28'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5b3c3e['id']})}});}function getUser(_0x536b1d,_0x5d90b3,_0x16598e){if(!_[_0xc8f7('0x29')](_0x5d90b3)){logger[_0xc8f7('0x2a')]('Getting\x20agent\x20with\x20name',_0x5d90b3);return request({'form':{'method':_0xc8f7('0x2b'),'input_type':_0xc8f7('0x22'),'response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'session':_0x16598e['id'],'module_name':_0xc8f7('0x2c'),'query':util[_0xc8f7('0x25')](_0xc8f7('0x2d'),_0x5d90b3),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc8f7('0x2e')](function(_0x358940){if(_0x358940[_0xc8f7('0x2f')]['length']){var _0x5d8d06=_[_0xc8f7('0x30')](_0x358940[_0xc8f7('0x2f')],function(_0x16fab9){return _0x16fab9[_0xc8f7('0x31')][_0xc8f7('0x32')][_0xc8f7('0x33')]===_0x5d90b3;});if(_0x5d8d06){logger[_0xc8f7('0x2a')](_0xc8f7('0x34'));return BPromise[_0xc8f7('0x35')]({'id':_0x5d8d06[_0xc8f7('0x31')]['id']['value'],'name':_0x5d8d06[_0xc8f7('0x31')][_0xc8f7('0xf')]['value']});}}logger[_0xc8f7('0x2a')](_0xc8f7('0x36'));return BPromise[_0xc8f7('0x35')]({'id':_0x16598e[_0xc8f7('0x31')][_0xc8f7('0x37')][_0xc8f7('0x33')],'name':_0x16598e[_0xc8f7('0x31')][_0xc8f7('0x32')]['value']});});}else{logger['info'](_0xc8f7('0x38'));return BPromise[_0xc8f7('0x35')]({'id':_0x16598e[_0xc8f7('0x31')][_0xc8f7('0x37')][_0xc8f7('0x33')],'name':_0x16598e['name_value_list'][_0xc8f7('0x32')][_0xc8f7('0x33')]});}}function getEndUser(_0x2aa021,_0x1c2538,_0x2a4c0d,_0x4f9cbc){logger['info'](_0xc8f7('0x39'),_0x2a4c0d);return request({'form':{'method':_0xc8f7('0x2b'),'input_type':_0xc8f7('0x22'),'response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'session':_0x4f9cbc['id'],'module_name':_0xc8f7('0x3a'),'query':util[_0xc8f7('0x25')](_0xc8f7('0x3b'),_0x2a4c0d),'order_by':'','offset':'0','select_fields':['id',_0xc8f7('0xf'),_0xc8f7('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc8f7('0x2e')](function(_0x32c8cf){if(_0x32c8cf['entry_list']['length']){var _0x58b1b4=_[_0xc8f7('0x30')](_0x32c8cf['entry_list'],function(_0x713346){return _0x713346[_0xc8f7('0x31')][_0xc8f7('0x3c')]['value']===_0x2a4c0d;});if(_0x58b1b4){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x58b1b4[_0xc8f7('0x31')]['id'][_0xc8f7('0x33')],'name':_0x58b1b4[_0xc8f7('0x31')]['name'][_0xc8f7('0x33')],'phone':_0x58b1b4[_0xc8f7('0x31')][_0xc8f7('0x3c')][_0xc8f7('0x33')]});}}else{logger[_0xc8f7('0x2a')](_0xc8f7('0x3d'));return request({'form':{'method':_0xc8f7('0x21'),'input_type':'JSON','response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'session':_0x4f9cbc['id'],'module_name':_0xc8f7('0x3a'),'name_value_list':[{'name':'first_name','value':_0x1c2538!==_0xc8f7('0x3e')?_0x1c2538:util[_0xc8f7('0x25')]('Caller\x20-\x20%s',_0x2a4c0d)},{'name':_0xc8f7('0x3c'),'value':_0x2a4c0d}]})}})[_0xc8f7('0x2e')](function(_0x93c449){logger['info'](_0xc8f7('0x3f'));return BPromise[_0xc8f7('0x35')]({'id':_0x93c449['id'],'name':_0x93c449[_0xc8f7('0x2f')][_0xc8f7('0x40')][_0xc8f7('0x33')],'phone':_0x93c449['entry_list'][_0xc8f7('0x3c')][_0xc8f7('0x33')]});});}});}function request(_0x48c8bb){logger[_0xc8f7('0x41')](_0xc8f7('0x42'),JSON[_0xc8f7('0x23')](_0x48c8bb));return rp(_['merge'](def,_0x48c8bb));}function getTags(_0x5ca4b8,_0x4e5f7b){var _0x3e5ced=[];if(_0x5ca4b8&&_0x5ca4b8[_0xc8f7('0x1c')]>0x0){_0x3e5ced=_[_0xc8f7('0x43')](_0x5ca4b8,_0x4e5f7b);}return _0x3e5ced;}function getCustomFields(_0x4f80f8,_0x205c3f){var _0x338c0a=[];var _0x3b050b={'custom_fields':[]};if(_0x4f80f8['length']>0x0){_[_0xc8f7('0x1d')](_0x4f80f8,function(_0x6dc96e){if(_0x6dc96e[_0xc8f7('0x44')]==='string'&&_0x6dc96e[_0xc8f7('0x45')]&&!_0x6dc96e[_0xc8f7('0x46')]){_0x3b050b[_0x6dc96e[_0xc8f7('0x45')][_0xc8f7('0x47')]()]=_0x6dc96e['content'][_0xc8f7('0x27')]();}else if(_0x6dc96e[_0xc8f7('0x44')]===_0xc8f7('0x48')&&_0x6dc96e[_0xc8f7('0x20')]&&_0x6dc96e['customField']){_0x3b050b[_0xc8f7('0x49')]['push']({'id':_0x6dc96e[_0xc8f7('0x20')],'value':_0x6dc96e[_0xc8f7('0x4a')][_0xc8f7('0x27')]()});}else if(_0x6dc96e[_0xc8f7('0x44')]===_0xc8f7('0x4b')&&_0x6dc96e[_0xc8f7('0x1e')]&&_0x6dc96e[_0xc8f7('0x20')]&&_0x6dc96e[_0xc8f7('0x46')]){_0x205c3f[_0x6dc96e[_0xc8f7('0x1e')]]&&_0x3b050b[_0xc8f7('0x49')][_0xc8f7('0x1f')]({'id':_0x6dc96e[_0xc8f7('0x20')],'value':_0x205c3f[_0x6dc96e[_0xc8f7('0x1e')]][_0xc8f7('0x27')]()});}else if(_0x6dc96e['type']===_0xc8f7('0x4c')&&_0x6dc96e[_0xc8f7('0x4d')]&&_0x6dc96e[_0xc8f7('0x4d')]['name']&&_0x6dc96e[_0xc8f7('0x20')]&&_0x6dc96e[_0xc8f7('0x46')]){_0x205c3f[_0x6dc96e[_0xc8f7('0x4d')][_0xc8f7('0xf')]['toLowerCase']()]&&_0x3b050b[_0xc8f7('0x49')][_0xc8f7('0x1f')]({'id':_0x6dc96e[_0xc8f7('0x20')],'value':_0x205c3f[_0x6dc96e[_0xc8f7('0x4d')][_0xc8f7('0xf')][_0xc8f7('0x47')]()][_0xc8f7('0x27')]()});}});}return _0x3b050b;}function getConnection(_0x410bc1){return request({'method':_0xc8f7('0xc'),'form':{'method':_0xc8f7('0x4e'),'input_type':_0xc8f7('0x22'),'response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'user_auth':{'user_name':_0x410bc1[_0xc8f7('0x4f')],'password':_0x410bc1[_0xc8f7('0x50')],'encryption':_0xc8f7('0x51')},'application':_0xc8f7('0x52')})}})[_0xc8f7('0x2e')](function(_0x28db66){var _0x2e0cab=_0x28db66;if(_0x2e0cab['id']){def[_0xc8f7('0x53')]=_0x2e0cab['id'];return BPromise[_0xc8f7('0x35')](_0x2e0cab);}else{throw new Error(util[_0xc8f7('0x25')](_0xc8f7('0x54'),_0x410bc1['id']));}});}function setRelationship(_0x25920c,_0x5eedb2,_0x945556,_0x5f3fcf){return request({'form':{'method':_0xc8f7('0x55'),'input_type':'JSON','response_type':_0xc8f7('0x22'),'rest_data':JSON['stringify']({'session':_0x25920c['id'],'module_name':_0xc8f7('0x24'),'module_id':_0x945556['id'],'link_field_name':_0x5f3fcf,'related_ids':[_0x5eedb2['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x195a32,_0x163d23,_0x20966c,_0x53329f,_0x27107e,_0x21ea98){var _0x3437ef,_0x2bbe6b,_0x1abe35,_0x552917;_0x21ea98['remoteUri']=intUtil[_0xc8f7('0x56')](_0x21ea98[_0xc8f7('0x57')]);_0x21ea98[_0xc8f7('0x58')]=intUtil[_0xc8f7('0x56')](_0x21ea98[_0xc8f7('0x58')]);def[_0xc8f7('0x59')]=util[_0xc8f7('0x25')](_0xc8f7('0x5a'),_0x21ea98[_0xc8f7('0x57')]);if(_0x27107e&&_0x27107e[_0xc8f7('0x5b')]){logger['info'](_0xc8f7('0x5c'),_0xc8f7('0x5d'));_0x163d23[_0xc8f7('0x5e')]=util[_0xc8f7('0x25')](_0xc8f7('0x5f'),_0x21ea98[_0xc8f7('0x58')],_0x163d23[_0xc8f7('0x60')],md5(_0x163d23[_0xc8f7('0x60')]));}else{_0x163d23[_0xc8f7('0x5e')]='';}return getConnection(_0x21ea98)[_0xc8f7('0x2e')](function(_0x321ba5){_0x552917=_0x321ba5;return getUser(_0x21ea98,_0x53329f[_0xc8f7('0xf')],_0x552917);})[_0xc8f7('0x2e')](function(_0x30fb27){_0x3437ef=_0x30fb27;logger[_0xc8f7('0x2a')](_0xc8f7('0x61'),_0x3437ef['id']);return getEndUser(_0x21ea98,_0x163d23[_0xc8f7('0x62')],_0x163d23['calleridnum'],_0x552917);})['then'](function(_0x4b7248){_0x2bbe6b=_0x4b7248;logger['info'](_0xc8f7('0x63'),_0x2bbe6b['id']);return getTicket(_0x21ea98,_0x3437ef,_0x2bbe6b,_0x20966c,_0x163d23,_0x20966c[_0xc8f7('0x64')],_0x552917,_0xc8f7('0x65'));})[_0xc8f7('0x2e')](function(_0x3bc8ba){_0x1abe35=_0x3bc8ba;logger[_0xc8f7('0x2a')](_0xc8f7('0x66'));logger[_0xc8f7('0x2a')](_0xc8f7('0x67'),_0x1abe35['id']);return setRelationship(_0x552917,_0x3437ef,_0x1abe35,_0xc8f7('0x68'));})['then'](function(){return setRelationship(_0x552917,_0x2bbe6b,_0x1abe35,_0xc8f7('0x69'));})[_0xc8f7('0x2e')](function(){return getServerInfo(_0x552917);})[_0xc8f7('0x2e')](function(_0x126f0e){var _0x206751=parseInt(_0x126f0e[_0xc8f7('0x6a')][_0xc8f7('0x6b')](0x0));var _0x2bd534=util[_0xc8f7('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x21ea98[_0xc8f7('0x57')],_0x1abe35['id']);if(_0x206751>0x6){_0x2bd534=util['format'](_0xc8f7('0x6c'),_0x21ea98[_0xc8f7('0x57')],_0x1abe35['id']);}logger[_0xc8f7('0x2a')]('[QUEUE]',_0xc8f7('0x6d'));emit(util[_0xc8f7('0x25')]('user:%s',_0x53329f[_0xc8f7('0xf')]),_0xc8f7('0x6e'),{'uri':_0x2bd534});})[_0xc8f7('0x6f')](function(_0x38c589){logger[_0xc8f7('0x70')](_0xc8f7('0x5c'),JSON[_0xc8f7('0x23')](_0x38c589));});};exports[_0xc8f7('0x71')]=function(_0x4d1d7c,_0x26e5a2,_0x3a2283,_0x2b4638,_0x37b18c,_0x34b637,_0x35456a){var _0xc7d9c5,_0x4d56a4,_0x1b4638,_0x1a4ee2;_0x34b637['remoteUri']=intUtil[_0xc8f7('0x56')](_0x34b637[_0xc8f7('0x57')]);_0x34b637[_0xc8f7('0x58')]=intUtil['stripTrailingSlash'](_0x34b637[_0xc8f7('0x58')]);def[_0xc8f7('0x59')]=util[_0xc8f7('0x25')](_0xc8f7('0x5a'),_0x34b637[_0xc8f7('0x57')]);if(_0x35456a&&_0x35456a['recordingFormat']&&_0x35456a[_0xc8f7('0x72')]!=='none'){logger[_0xc8f7('0x2a')](_0xc8f7('0x73'),'Recording\x20is\x20enabled!');_0x26e5a2[_0xc8f7('0x5e')]=util[_0xc8f7('0x25')](_0xc8f7('0x5f'),_0x34b637[_0xc8f7('0x58')],_0x26e5a2[_0xc8f7('0x60')],md5(_0x26e5a2[_0xc8f7('0x60')]));}return getConnection(_0x34b637)[_0xc8f7('0x2e')](function(_0x2d6d43){_0x1a4ee2=_0x2d6d43;return getUser(_0x34b637,_0x2b4638[_0xc8f7('0xf')],_0x1a4ee2);})[_0xc8f7('0x2e')](function(_0x6c55bc){_0xc7d9c5=_0x6c55bc;logger[_0xc8f7('0x2a')]('The\x20User\x20ID\x20is:',_0xc7d9c5['id']);return getEndUser(_0x34b637,_0x26e5a2['destcalleridname'],_0x26e5a2[_0xc8f7('0x74')],_0x1a4ee2);})[_0xc8f7('0x2e')](function(_0x1df834){_0x4d56a4=_0x1df834;logger['info'](_0xc8f7('0x63'),_0x4d56a4['id']);return getTicket(_0x34b637,_0xc7d9c5,_0x4d56a4,_0x3a2283,_0x26e5a2,_0x3a2283[_0xc8f7('0x64')],_0x1a4ee2,_0xc8f7('0x75'));})[_0xc8f7('0x2e')](function(_0x59a476){_0x1b4638=_0x59a476;logger[_0xc8f7('0x2a')]('Ticket\x20created!');logger[_0xc8f7('0x2a')](_0xc8f7('0x67'),_0x1b4638['id']);return setRelationship(_0x1a4ee2,_0xc7d9c5,_0x1b4638,_0xc8f7('0x68'));})[_0xc8f7('0x2e')](function(){return setRelationship(_0x1a4ee2,_0x4d56a4,_0x1b4638,_0xc8f7('0x69'));})['then'](function(){return getServerInfo(_0x1a4ee2);})[_0xc8f7('0x2e')](function(_0x10b8e0){var _0x211848=parseInt(_0x10b8e0[_0xc8f7('0x6a')][_0xc8f7('0x6b')](0x0));var _0x6d6e60=util['format'](_0xc8f7('0x76'),_0x34b637[_0xc8f7('0x57')],_0x1b4638['id']);if(_0x211848>0x6){_0x6d6e60=util[_0xc8f7('0x25')](_0xc8f7('0x6c'),_0x34b637[_0xc8f7('0x57')],_0x1b4638['id']);}logger[_0xc8f7('0x2a')](_0xc8f7('0x73'),_0xc8f7('0x6d'));emit(util['format'](_0xc8f7('0x77'),_0x2b4638['name']),_0xc8f7('0x6e'),{'uri':_0x6d6e60});})[_0xc8f7('0x6f')](function(_0x3fa8a2){logger[_0xc8f7('0x70')](_0xc8f7('0x73'),JSON['stringify'](_0x3fa8a2));});};exports[_0xc8f7('0x78')]=function(_0x43d585,_0x1412f0,_0x149b0c,_0x23ddf1,_0x5d1339,_0x86c735){var _0x384968,_0x37de94,_0x799f29,_0x24666c;_0x86c735[_0xc8f7('0x57')]=intUtil[_0xc8f7('0x56')](_0x86c735[_0xc8f7('0x57')]);_0x86c735[_0xc8f7('0x58')]=intUtil[_0xc8f7('0x56')](_0x86c735[_0xc8f7('0x58')]);def['uri']=util[_0xc8f7('0x25')](_0xc8f7('0x5a'),_0x86c735[_0xc8f7('0x57')]);if(_0x5d1339&&_0x5d1339['monitor_format']){logger['info']('['+_0x1412f0[_0xc8f7('0x79')][_0xc8f7('0x7a')]()+']','Recording\x20is\x20enabled!');_0x1412f0[_0xc8f7('0x5e')]=util[_0xc8f7('0x25')](_0xc8f7('0x5f'),_0x86c735['serverUrl'],_0x1412f0[_0xc8f7('0x60')],md5(_0x1412f0[_0xc8f7('0x60')]));}else{_0x1412f0[_0xc8f7('0x5e')]='';}return getConnection(_0x86c735)[_0xc8f7('0x2e')](function(_0x269568){_0x24666c=_0x269568;if(!_[_0xc8f7('0x29')](_0x23ddf1)){return getUser(_0x86c735,_0x23ddf1[_0xc8f7('0xf')],_0x24666c);}else{return getUser(_0x86c735,null,_0x24666c);}})['then'](function(_0x1283d4){_0x384968=_0x1283d4;logger[_0xc8f7('0x2a')](_0xc8f7('0x61'),_0x384968['id']);return getEndUser(_0x86c735,_0x1412f0[_0xc8f7('0x62')],_0x1412f0[_0xc8f7('0x7b')],_0x24666c);})['then'](function(_0x31981e){_0x37de94=_0x31981e;logger[_0xc8f7('0x2a')](_0xc8f7('0x63'),_0x37de94['id']);return getTicket(_0x86c735,_0x384968,_0x37de94,_0x149b0c,_0x1412f0,_0x149b0c[_0xc8f7('0x64')],_0x24666c,_0xc8f7('0x65'));})[_0xc8f7('0x2e')](function(_0x59dda2){_0x799f29=_0x59dda2;logger[_0xc8f7('0x2a')](_0xc8f7('0x66'));logger['info'](_0xc8f7('0x67'),_0x799f29['id']);return setRelationship(_0x24666c,_0x384968,_0x799f29,'users');})[_0xc8f7('0x2e')](function(){return setRelationship(_0x24666c,_0x37de94,_0x799f29,_0xc8f7('0x69'));})[_0xc8f7('0x2e')](function(){return getServerInfo(_0x24666c);})[_0xc8f7('0x6f')](function(_0x182ab1){logger[_0xc8f7('0x70')]('['+_0x1412f0[_0xc8f7('0x79')][_0xc8f7('0x7a')]()+']',JSON['stringify'](_0x182ab1));});}; \ 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 9ac2859..4b0a6ae 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 _0xced2=['keyType','key','format','%s:\x20%s','keyContent','name','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','type','string','content','variable','variableName','push','customVariable','Variable','toLowerCase','toString'];(function(_0x4f3579,_0x22c620){var _0x166fdc=function(_0x219baf){while(--_0x219baf){_0x4f3579['push'](_0x4f3579['shift']());}};_0x166fdc(++_0x22c620);}(_0xced2,0x75));var _0x2ced=function(_0x2d9311,_0x458a07){_0x2d9311=_0x2d9311-0x0;var _0x5e4e1c=_0xced2[_0x2d9311];return _0x5e4e1c;};'use strict';var _=require(_0x2ced('0x0'));var util=require(_0x2ced('0x1'));exports[_0x2ced('0x2')]=function(_0x1697e5,_0x4b5fc1,_0x46c198){var _0x5bb57d=[];if(_0x1697e5['length']>0x0){var _0x23cd7f=_['sortBy'](_0x1697e5,['id']);for(var _0x36a974=0x0;_0x36a974<_0x23cd7f['length'];_0x36a974++){var _0x4105c6=_0x23cd7f[_0x36a974];if(_0x4105c6[_0x2ced('0x3')]===_0x2ced('0x4')){_0x5bb57d['push'](_0x4105c6[_0x2ced('0x5')]);}else if(_0x4105c6[_0x2ced('0x3')]===_0x2ced('0x6')&&_0x4105c6[_0x2ced('0x7')]){_0x4b5fc1[_0x4105c6['variableName']]&&_0x5bb57d[_0x2ced('0x8')](_0x4b5fc1[_0x4105c6['variableName']]['toString']());}else if(_0x4105c6[_0x2ced('0x3')]===_0x2ced('0x9')&&_0x4105c6[_0x2ced('0xa')]&&_0x4105c6[_0x2ced('0xa')]['name']){_0x4b5fc1[_0x4105c6[_0x2ced('0xa')]['name']['toLowerCase']()]&&_0x5bb57d[_0x2ced('0x8')](_0x4b5fc1[_0x4105c6[_0x2ced('0xa')]['name'][_0x2ced('0xb')]()][_0x2ced('0xc')]());}else if(_0x4105c6[_0x2ced('0x3')]==='keyValue'){if(_0x4105c6[_0x2ced('0xd')]===_0x2ced('0x4')&&_0x4105c6[_0x2ced('0xe')]){_0x5bb57d[_0x2ced('0x8')](util[_0x2ced('0xf')](_0x2ced('0x10'),_0x4105c6['key'],_0x4105c6[_0x2ced('0x11')]));}else if(_0x4105c6['keyType']==='variable'&&_0x4105c6[_0x2ced('0x7')]&&_0x4105c6[_0x2ced('0xe')]){_0x4b5fc1[_0x4105c6[_0x2ced('0x7')]]&&_0x5bb57d[_0x2ced('0x8')](util[_0x2ced('0xf')](_0x2ced('0x10'),_0x4105c6['key'],_0x4b5fc1[_0x4105c6[_0x2ced('0x7')]]));}else if(_0x4105c6['keyType']===_0x2ced('0x9')&&_0x4105c6[_0x2ced('0xa')]&&_0x4105c6[_0x2ced('0xa')][_0x2ced('0x12')]&&_0x4105c6[_0x2ced('0xe')]){_0x4b5fc1[_0x4105c6[_0x2ced('0xa')][_0x2ced('0x12')]['toLowerCase']()]&&_0x5bb57d['push'](util[_0x2ced('0xf')]('%s:\x20%s',_0x4105c6['key'],_0x4b5fc1[_0x4105c6['Variable']['name'][_0x2ced('0xb')]()]));}}}}return _0x5bb57d[_0x2ced('0x13')](_0x46c198);};exports[_0x2ced('0x14')]=function(_0xa554ba){var _0x3cb296=_0xa554ba['slice'](-0x1);if(_0x3cb296==='/'){_0xa554ba=_0xa554ba[_0x2ced('0x15')](0x0,_0xa554ba[_0x2ced('0x16')](_0x3cb296));}return _0xa554ba;};exports[_0x2ced('0x17')]=function(_0x2fbb95){if(!_[_0x2ced('0x18')](_0x2fbb95)&&_0x2fbb95!==''){var _0x7cc63c=/^(([^<>()\[\]\\.,;:\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 _0x7cc63c[_0x2ced('0x19')](String(_0x2fbb95)[_0x2ced('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x7eb4=['push','variable','variableName','toString','Variable','name','toLowerCase','keyType','string','key','format','%s:\x20%s','customVariable','join','slice','substring','lastIndexOf','test','lodash','util','getString','length','sortBy','type'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7eb4,0x11a));var _0x47eb=function(_0x12287a,_0x22f00c){_0x12287a=_0x12287a-0x0;var _0x2141a0=_0x7eb4[_0x12287a];return _0x2141a0;};'use strict';var _=require(_0x47eb('0x0'));var util=require(_0x47eb('0x1'));exports[_0x47eb('0x2')]=function(_0x46222f,_0x4052ec,_0x169354){var _0x137677=[];if(_0x46222f[_0x47eb('0x3')]>0x0){var _0x27156e=_[_0x47eb('0x4')](_0x46222f,['id']);for(var _0x420b04=0x0;_0x420b04<_0x27156e[_0x47eb('0x3')];_0x420b04++){var _0x3342fe=_0x27156e[_0x420b04];if(_0x3342fe[_0x47eb('0x5')]==='string'){_0x137677[_0x47eb('0x6')](_0x3342fe['content']);}else if(_0x3342fe[_0x47eb('0x5')]===_0x47eb('0x7')&&_0x3342fe[_0x47eb('0x8')]){_0x4052ec[_0x3342fe['variableName']]&&_0x137677[_0x47eb('0x6')](_0x4052ec[_0x3342fe[_0x47eb('0x8')]][_0x47eb('0x9')]());}else if(_0x3342fe[_0x47eb('0x5')]==='customVariable'&&_0x3342fe[_0x47eb('0xa')]&&_0x3342fe[_0x47eb('0xa')]['name']){_0x4052ec[_0x3342fe['Variable'][_0x47eb('0xb')][_0x47eb('0xc')]()]&&_0x137677[_0x47eb('0x6')](_0x4052ec[_0x3342fe[_0x47eb('0xa')][_0x47eb('0xb')][_0x47eb('0xc')]()][_0x47eb('0x9')]());}else if(_0x3342fe[_0x47eb('0x5')]==='keyValue'){if(_0x3342fe[_0x47eb('0xd')]===_0x47eb('0xe')&&_0x3342fe[_0x47eb('0xf')]){_0x137677[_0x47eb('0x6')](util[_0x47eb('0x10')](_0x47eb('0x11'),_0x3342fe[_0x47eb('0xf')],_0x3342fe['keyContent']));}else if(_0x3342fe[_0x47eb('0xd')]===_0x47eb('0x7')&&_0x3342fe[_0x47eb('0x8')]&&_0x3342fe[_0x47eb('0xf')]){_0x4052ec[_0x3342fe[_0x47eb('0x8')]]&&_0x137677[_0x47eb('0x6')](util[_0x47eb('0x10')](_0x47eb('0x11'),_0x3342fe[_0x47eb('0xf')],_0x4052ec[_0x3342fe[_0x47eb('0x8')]]));}else if(_0x3342fe['keyType']===_0x47eb('0x12')&&_0x3342fe[_0x47eb('0xa')]&&_0x3342fe[_0x47eb('0xa')][_0x47eb('0xb')]&&_0x3342fe[_0x47eb('0xf')]){_0x4052ec[_0x3342fe[_0x47eb('0xa')][_0x47eb('0xb')][_0x47eb('0xc')]()]&&_0x137677[_0x47eb('0x6')](util[_0x47eb('0x10')](_0x47eb('0x11'),_0x3342fe['key'],_0x4052ec[_0x3342fe[_0x47eb('0xa')]['name']['toLowerCase']()]));}}}}return _0x137677[_0x47eb('0x13')](_0x169354);};exports['stripTrailingSlash']=function(_0x954b3b){var _0x1c533a=_0x954b3b[_0x47eb('0x14')](-0x1);if(_0x1c533a==='/'){_0x954b3b=_0x954b3b[_0x47eb('0x15')](0x0,_0x954b3b[_0x47eb('0x16')](_0x1c533a));}return _0x954b3b;};exports['validateEmail']=function(_0x1bdf5b){if(!_['isNil'](_0x1bdf5b)&&_0x1bdf5b!==''){var _0x5701cc=/^(([^<>()\[\]\\.,;:\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 _0x5701cc[_0x47eb('0x17')](String(_0x1bdf5b)['toLowerCase']());}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 77c0621..a8f4d11 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x272d4e,_0x4adf01){var _0x17863a=function(_0x1e7829){while(--_0x1e7829){_0x272d4e['push'](_0x272d4e['shift']());}};_0x17863a(++_0x4adf01);}(_0xe706,0xa3));var _0x6e70=function(_0x5cc4de,_0x2df335){_0x5cc4de=_0x5cc4de-0x0;var _0x1bf255=_0xe706[_0x5cc4de];return _0x1bf255;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _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(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 833553f..b9846c8 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 _0x6a88=['end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','authType','token','%s/token:%s','username','Basic\x20%s','base64','[HTTP]','stringify','forEach','string','picklist','type','nameField','content','toString','includes','customField','custom_fields','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','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','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','getString','Descriptions','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0x6a88,0x125));var _0x86a8=function(_0xdb47d8,_0x933e5b){_0xdb47d8=_0xdb47d8-0x0;var _0x5cdfd9=_0x6a88[_0xdb47d8];return _0x5cdfd9;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x86a8('0x0'));var util=require(_0x86a8('0x1'));var Redis=require(_0x86a8('0x2'));var intUtil=require('./util');var config=require(_0x86a8('0x3'));var logger=require(_0x86a8('0x4'))(_0x86a8('0x5'));config[_0x86a8('0x6')]=_[_0x86a8('0x7')](config[_0x86a8('0x6')],{'host':_0x86a8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x86a8('0x6')]));function emit(_0xf73f35,_0x3c4345,_0x25054a){io['to'](_0xf73f35)['emit'](_0x3c4345,_0x25054a);}var headers={'Content-Type':_0x86a8('0x9'),'Accept':_0x86a8('0x9')};function getTicket(_0x486c69,_0x3a7def,_0x5f2a38,_0x2df7af,_0x6b674c){logger[_0x86a8('0xa')](_0x86a8('0xb'));return request({'uri':util[_0x86a8('0xc')](_0x86a8('0xd'),_0x486c69['remoteUri']),'method':_0x86a8('0xe'),'body':{'ticket':_[_0x86a8('0xf')]({'requester_id':_0x5f2a38['id'],'submitter_id':_0x3a7def?_0x3a7def['id']:undefined,'assignee_id':_0x3a7def?_0x3a7def['id']:undefined,'tags':getTags(_0x2df7af[_0x86a8('0x10')],_0x86a8('0x11')),'subject':intUtil[_0x86a8('0x12')](_0x2df7af['Subjects'],_0x6b674c,'\x20'),'description':intUtil['getString'](_0x2df7af[_0x86a8('0x13')],_0x6b674c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x86a8('0x12')](_0x2df7af[_0x86a8('0x13')],_0x6b674c,'\x0a')}},getCustomFields(_0x2df7af['Fields'],_0x6b674c))}})[_0x86a8('0x14')](function(_0x222a76){logger[_0x86a8('0xa')]('Ticket\x20created!');return _0x222a76[_0x86a8('0x15')];});}function getUser(_0x5b6828,_0x4836e9){if(intUtil[_0x86a8('0x16')](_0x4836e9)){logger[_0x86a8('0xa')](_0x86a8('0x17'),_0x4836e9);return request({'uri':util[_0x86a8('0xc')](_0x86a8('0x18'),_0x5b6828[_0x86a8('0x19')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x4836e9)}})['then'](function(_0x502dfd){if(_0x502dfd['count']){logger[_0x86a8('0xa')](_0x86a8('0x1a'));return _[_0x86a8('0x1b')](_0x502dfd[_0x86a8('0x1c')],{'email':_0x4836e9,'role':_0x86a8('0x1d')});}else{logger[_0x86a8('0xa')](_0x86a8('0x1e'));return request({'uri':util[_0x86a8('0xc')]('%s/users/me.json',_0x5b6828[_0x86a8('0x19')])})[_0x86a8('0x14')](function(_0x432e03){logger['info'](_0x86a8('0x1f'));return _0x432e03[_0x86a8('0x20')];});}});}else{logger[_0x86a8('0xa')](_0x86a8('0x1e'));return request({'uri':util[_0x86a8('0xc')](_0x86a8('0x21'),_0x5b6828[_0x86a8('0x19')])})[_0x86a8('0x14')](function(_0x187d84){logger[_0x86a8('0xa')](_0x86a8('0x1f'));return _0x187d84[_0x86a8('0x20')];});}}function getEndUser(_0x5d0671,_0x153d71,_0x3e2340){logger[_0x86a8('0xa')](_0x86a8('0x22'),_0x3e2340);return request({'uri':util[_0x86a8('0xc')](_0x86a8('0x18'),_0x5d0671[_0x86a8('0x19')]),'qs':{'query':util['format'](_0x86a8('0x23'),_0x3e2340)}})[_0x86a8('0x14')](function(_0x32ae1d){var _0x5e6a81;if(_0x32ae1d[_0x86a8('0x1c')][_0x86a8('0x24')]){_0x32ae1d['results']=_['filter'](_0x32ae1d['results'],{'suspended':![],'role':_0x86a8('0x25')});if(_0x32ae1d[_0x86a8('0x1c')][_0x86a8('0x24')]){_0x5e6a81=_[_0x86a8('0x26')](_0x32ae1d['results']);}}if(_0x5e6a81){logger[_0x86a8('0xa')](_0x86a8('0x27'));return _0x5e6a81;}else{logger[_0x86a8('0xa')](_0x86a8('0x28'));return request({'uri':util['format']('%s/users.json',_0x5d0671[_0x86a8('0x19')]),'method':_0x86a8('0xe'),'body':{'user':{'role':_0x86a8('0x25'),'name':util['format'](_0x86a8('0x29'),_0x153d71||_0x3e2340),'phone':_0x3e2340}}})[_0x86a8('0x14')](function(_0xaca6bd){logger['info'](_0x86a8('0x2a'));return _0xaca6bd[_0x86a8('0x20')];});}});}function getAuth(_0x24d9b9){var _0x3c5315;if(_0x24d9b9['authType']===_0x86a8('0x2b')){_0x3c5315=util[_0x86a8('0xc')](_0x86a8('0x2c'),_0x24d9b9['username'],_0x24d9b9[_0x86a8('0x2b')]);}else if(_0x24d9b9[_0x86a8('0x2d')]===_0x86a8('0x2e')){_0x3c5315=util[_0x86a8('0xc')](_0x86a8('0x2f'),_0x24d9b9[_0x86a8('0x30')],_0x24d9b9[_0x86a8('0x2e')]);}return util[_0x86a8('0xc')](_0x86a8('0x31'),new Buffer(_0x3c5315)['toString'](_0x86a8('0x32')));}function request(_0x4362de){logger['debug'](_0x86a8('0x33'),JSON[_0x86a8('0x34')](_0x4362de));return rp(_[_0x86a8('0x7')](_0x4362de,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3ae2a4,_0x3eab7a){var _0x464d57=[];if(_0x3ae2a4&&_0x3ae2a4['length']>0x0){_0x464d57=_['map'](_0x3ae2a4,_0x3eab7a);}return _0x464d57;}function getCustomFields(_0x2b0034,_0x3c0970){var _0x460822=[];var _0x4a7cd3={'custom_fields':[]};if(_0x2b0034['length']>0x0){_[_0x86a8('0x35')](_0x2b0034,function(_0x30c138){if(_['includes']([_0x86a8('0x36'),_0x86a8('0x37')],_0x30c138[_0x86a8('0x38')])&&_0x30c138['nameField']&&!_0x30c138['customField']){_0x4a7cd3[_0x30c138[_0x86a8('0x39')]['toLowerCase']()]=_0x30c138[_0x86a8('0x3a')][_0x86a8('0x3b')]();}else if(_[_0x86a8('0x3c')](['string','picklist'],_0x30c138[_0x86a8('0x38')])&&_0x30c138['idField']&&_0x30c138[_0x86a8('0x3d')]){_0x4a7cd3[_0x86a8('0x3e')][_0x86a8('0x3f')]({'id':_0x30c138[_0x86a8('0x40')],'value':_0x30c138[_0x86a8('0x3a')][_0x86a8('0x3b')]()});}else if(_0x30c138[_0x86a8('0x38')]===_0x86a8('0x41')&&_0x30c138[_0x86a8('0x42')]&&_0x30c138[_0x86a8('0x40')]&&_0x30c138[_0x86a8('0x3d')]){_0x3c0970[_0x30c138[_0x86a8('0x42')]]&&_0x4a7cd3[_0x86a8('0x3e')]['push']({'id':_0x30c138[_0x86a8('0x40')],'value':_0x3c0970[_0x30c138['variableName']]['toString']()});}else if(_0x30c138[_0x86a8('0x38')]===_0x86a8('0x43')&&_0x30c138[_0x86a8('0x44')]&&_0x30c138[_0x86a8('0x44')]['name']&&_0x30c138[_0x86a8('0x40')]&&_0x30c138[_0x86a8('0x3d')]){_0x3c0970[_0x30c138['Variable'][_0x86a8('0x11')]['toLowerCase']()]&&_0x4a7cd3['custom_fields']['push']({'id':_0x30c138[_0x86a8('0x40')],'value':_0x3c0970[_0x30c138['Variable'][_0x86a8('0x11')][_0x86a8('0x45')]()][_0x86a8('0x3b')]()});}});}return _0x4a7cd3;}exports[_0x86a8('0x46')]=function(_0x29efcb,_0x38990d,_0x348c6f,_0x2f5290,_0x1d7370,_0x5673b1){var _0x92fec3,_0x34a236;_0x5673b1[_0x86a8('0x19')]=intUtil[_0x86a8('0x47')](_0x5673b1[_0x86a8('0x19')]);_0x5673b1[_0x86a8('0x48')]=intUtil[_0x86a8('0x47')](_0x5673b1[_0x86a8('0x48')]);if(_0x1d7370&&_0x1d7370[_0x86a8('0x49')]){logger[_0x86a8('0xa')](_0x86a8('0x4a'),_0x86a8('0x4b'));_0x38990d[_0x86a8('0x4c')]=util[_0x86a8('0xc')](_0x86a8('0x4d'),_0x5673b1[_0x86a8('0x48')],_0x38990d[_0x86a8('0x4e')],md5(_0x38990d['uniqueid']));}else{_0x38990d[_0x86a8('0x4c')]='';}headers[_0x86a8('0x4f')]=getAuth(_0x5673b1);return getUser(_0x5673b1,_0x2f5290[_0x86a8('0x50')])[_0x86a8('0x14')](function(_0x55ecd4){_0x92fec3=_0x55ecd4;logger[_0x86a8('0xa')](_0x86a8('0x51'),_0x92fec3['id']);return getEndUser(_0x5673b1,_0x38990d[_0x86a8('0x52')],_0x38990d['calleridnum']);})['then'](function(_0x972ddf){_0x34a236=_0x972ddf;logger['info'](_0x86a8('0x53'),_0x34a236['id']);return getTicket(_0x5673b1,_0x92fec3,_0x34a236,_0x348c6f,_0x38990d);})[_0x86a8('0x14')](function(_0x44cbb5){if(_0x44cbb5){logger[_0x86a8('0xa')](_0x86a8('0x54'),_0x44cbb5['id']);switch(_0x5673b1[_0x86a8('0x38')]){case'integrationTab':logger[_0x86a8('0xa')](_0x86a8('0x4a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x86a8('0x55'),_0x5673b1[_0x86a8('0x19')],_0x92fec3['id'],_0x44cbb5['id']),'method':'POST'});case _0x86a8('0x56'):logger[_0x86a8('0xa')](_0x86a8('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x86a8('0xc')](_0x86a8('0x57'),_0x2f5290[_0x86a8('0x11')]),_0x86a8('0x58'),{'uri':util[_0x86a8('0xc')]('%s/agent/tickets/%s',_0x5673b1[_0x86a8('0x19')][_0x86a8('0x59')](_0x86a8('0x5a'),''),_0x44cbb5['id'])});break;default:logger[_0x86a8('0x5b')]('[QUEUE]',_0x86a8('0x5c'));}}})[_0x86a8('0x5d')](function(_0x54961a){logger['error'](_0x86a8('0x5e'),util[_0x86a8('0x5f')](_0x54961a,{'showHidden':!![],'depth':null}));});};exports[_0x86a8('0x60')]=function(_0x54e511,_0x5bdb97,_0xc593fb,_0x3ee695,_0x563209,_0x59baa5,_0x4f1457){var _0x2d716e,_0xa11b0;_0x59baa5[_0x86a8('0x19')]=intUtil[_0x86a8('0x47')](_0x59baa5[_0x86a8('0x19')]);_0x59baa5['serverUrl']=intUtil[_0x86a8('0x47')](_0x59baa5[_0x86a8('0x48')]);if(_0x4f1457&&_0x4f1457[_0x86a8('0x61')]&&_0x4f1457[_0x86a8('0x61')]!==_0x86a8('0x62')){logger['info']('[OUTBOUND]',_0x86a8('0x4b'));_0x5bdb97[_0x86a8('0x4c')]=util[_0x86a8('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x59baa5[_0x86a8('0x48')],_0x5bdb97[_0x86a8('0x4e')],md5(_0x5bdb97[_0x86a8('0x4e')]));}headers[_0x86a8('0x4f')]=getAuth(_0x59baa5);return getUser(_0x59baa5,_0x3ee695['email'])['then'](function(_0xbb1719){_0x2d716e=_0xbb1719;logger[_0x86a8('0xa')]('The\x20User\x20ID\x20is:',_0x2d716e['id']);return getEndUser(_0x59baa5,_0x5bdb97[_0x86a8('0x63')],_0x5bdb97[_0x86a8('0x64')]);})['then'](function(_0x4262ca){_0xa11b0=_0x4262ca;logger[_0x86a8('0xa')](_0x86a8('0x53'),_0xa11b0['id']);return getTicket(_0x59baa5,_0x2d716e,_0xa11b0,_0xc593fb,_0x5bdb97);})[_0x86a8('0x14')](function(_0x22645d){if(_0x22645d){logger[_0x86a8('0xa')](_0x86a8('0x54'),_0x22645d['id']);switch(_0x59baa5[_0x86a8('0x38')]){case _0x86a8('0x65'):logger[_0x86a8('0xa')](_0x86a8('0x66'),_0x86a8('0x67'));return request({'uri':util['format'](_0x86a8('0x55'),_0x59baa5['remoteUri'],_0x2d716e['id'],_0x22645d['id']),'method':'POST'});case'newTab':logger['info'](_0x86a8('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x86a8('0xc')](_0x86a8('0x57'),_0x3ee695[_0x86a8('0x11')]),'trigger:browser:url',{'uri':util['format'](_0x86a8('0x68'),_0x59baa5[_0x86a8('0x19')][_0x86a8('0x59')]('/api/v2',''),_0x22645d['id'])});break;default:logger[_0x86a8('0x5b')]('[OUTBOUND]',_0x86a8('0x5c'));}}})[_0x86a8('0x5d')](function(_0x4838d){logger[_0x86a8('0x5b')](_0x86a8('0x69'),util['inspect'](_0x4838d,{'showHidden':!![],'depth':null}));});};exports[_0x86a8('0x6a')]=function(_0x2500f2,_0x39f065,_0x18fbae,_0x1f6f05,_0x19a24f,_0xad907f){var _0x199ae2,_0xc6fdc7;_0xad907f[_0x86a8('0x19')]=intUtil[_0x86a8('0x47')](_0xad907f[_0x86a8('0x19')]);_0xad907f[_0x86a8('0x48')]=intUtil['stripTrailingSlash'](_0xad907f[_0x86a8('0x48')]);if(_0x19a24f&&_0x19a24f[_0x86a8('0x49')]){logger[_0x86a8('0xa')]('['+_0x39f065['lastevent'][_0x86a8('0x6b')]()+']',_0x86a8('0x4b'));_0x39f065[_0x86a8('0x4c')]=util[_0x86a8('0xc')](_0x86a8('0x4d'),_0xad907f[_0x86a8('0x48')],_0x39f065[_0x86a8('0x4e')],md5(_0x39f065[_0x86a8('0x4e')]));}else{_0x39f065[_0x86a8('0x4c')]='';}headers[_0x86a8('0x4f')]=getAuth(_0xad907f);return getUser(_0xad907f)['then'](function(_0x5e5e1b){_0x199ae2=_0x5e5e1b;logger[_0x86a8('0xa')](_0x86a8('0x51'),_0x199ae2['id']);return getEndUser(_0xad907f,_0x39f065['calleridname'],_0x39f065['calleridnum']);})[_0x86a8('0x14')](function(_0x5ec5b9){_0xc6fdc7=_0x5ec5b9;logger['info'](_0x86a8('0x53'),_0xc6fdc7['id']);return getTicket(_0xad907f,_0x199ae2,_0xc6fdc7,_0x18fbae,_0x39f065);})['then'](function(_0x38ae40){if(_0x38ae40){logger[_0x86a8('0xa')]('The\x20Ticket\x20ID\x20is:',_0x38ae40['id']);}})[_0x86a8('0x5d')](function(_0xa96e72){logger[_0x86a8('0x5b')]('['+_0x39f065[_0x86a8('0x6c')][_0x86a8('0x6b')]()+']'+_0x86a8('0x6d'),util[_0x86a8('0x5f')](_0xa96e72,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1980=['first','Enduser\x20found!','%s/users.json','end-user','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','user:%s','error','unmanaged','lastevent','toUpperCase','Authorization','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter'];(function(_0x17b493,_0x5c7fbf){var _0x2fcbf2=function(_0x2e95b5){while(--_0x2e95b5){_0x17b493['push'](_0x17b493['shift']());}};_0x2fcbf2(++_0x5c7fbf);}(_0x1980,0x138));var _0x0198=function(_0x6b9865,_0x13202f){_0x6b9865=_0x6b9865-0x0;var _0x4c2935=_0x1980[_0x6b9865];return _0x4c2935;};'use strict';var _=require(_0x0198('0x0'));var rp=require(_0x0198('0x1'));var md5=require(_0x0198('0x2'));var util=require(_0x0198('0x3'));var Redis=require(_0x0198('0x4'));var intUtil=require(_0x0198('0x5'));var config=require(_0x0198('0x6'));var logger=require(_0x0198('0x7'))(_0x0198('0x8'));config['redis']=_[_0x0198('0x9')](config[_0x0198('0xa')],{'host':_0x0198('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0198('0xa')]));function emit(_0x46d8af,_0x71843a,_0x8b31c4){io['to'](_0x46d8af)[_0x0198('0xc')](_0x71843a,_0x8b31c4);}var headers={'Content-Type':_0x0198('0xd'),'Accept':'application/json'};function getTicket(_0x1bf874,_0x3b3e5e,_0x674967,_0x339492,_0x23e969){logger['info'](_0x0198('0xe'));return request({'uri':util[_0x0198('0xf')](_0x0198('0x10'),_0x1bf874[_0x0198('0x11')]),'method':_0x0198('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x674967['id'],'submitter_id':_0x3b3e5e?_0x3b3e5e['id']:undefined,'assignee_id':_0x3b3e5e?_0x3b3e5e['id']:undefined,'tags':getTags(_0x339492[_0x0198('0x13')],'name'),'subject':intUtil[_0x0198('0x14')](_0x339492[_0x0198('0x15')],_0x23e969,'\x20'),'description':intUtil[_0x0198('0x14')](_0x339492[_0x0198('0x16')],_0x23e969,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0198('0x14')](_0x339492[_0x0198('0x16')],_0x23e969,'\x0a')}},getCustomFields(_0x339492[_0x0198('0x17')],_0x23e969))}})[_0x0198('0x18')](function(_0x2136c5){logger[_0x0198('0x19')](_0x0198('0x1a'));return _0x2136c5[_0x0198('0x1b')];});}function getUser(_0x2e10b9,_0x2b6514){if(intUtil[_0x0198('0x1c')](_0x2b6514)){logger['info'](_0x0198('0x1d'),_0x2b6514);return request({'uri':util[_0x0198('0xf')]('%s/search.json',_0x2e10b9[_0x0198('0x11')]),'qs':{'query':util[_0x0198('0xf')](_0x0198('0x1e'),_0x2b6514)}})[_0x0198('0x18')](function(_0x47510d){if(_0x47510d[_0x0198('0x1f')]){logger['info'](_0x0198('0x20'));return _[_0x0198('0x21')](_0x47510d[_0x0198('0x22')],{'email':_0x2b6514,'role':_0x0198('0x23')});}else{logger[_0x0198('0x19')](_0x0198('0x24'));return request({'uri':util[_0x0198('0xf')](_0x0198('0x25'),_0x2e10b9[_0x0198('0x11')])})['then'](function(_0x324727){logger['info'](_0x0198('0x26'));return _0x324727[_0x0198('0x27')];});}});}else{logger[_0x0198('0x19')](_0x0198('0x24'));return request({'uri':util['format'](_0x0198('0x25'),_0x2e10b9[_0x0198('0x11')])})['then'](function(_0x4889b4){logger[_0x0198('0x19')](_0x0198('0x26'));return _0x4889b4[_0x0198('0x27')];});}}function getEndUser(_0x3b6e05,_0x91aaf1,_0xb76ceb){logger[_0x0198('0x19')](_0x0198('0x28'),_0xb76ceb);return request({'uri':util['format'](_0x0198('0x29'),_0x3b6e05[_0x0198('0x11')]),'qs':{'query':util['format'](_0x0198('0x2a'),_0xb76ceb)}})['then'](function(_0x100061){var _0xf936b7;if(_0x100061[_0x0198('0x22')][_0x0198('0x2b')]){_0x100061['results']=_[_0x0198('0x2c')](_0x100061[_0x0198('0x22')],{'suspended':![],'role':'end-user'});if(_0x100061[_0x0198('0x22')][_0x0198('0x2b')]){_0xf936b7=_[_0x0198('0x2d')](_0x100061[_0x0198('0x22')]);}}if(_0xf936b7){logger[_0x0198('0x19')](_0x0198('0x2e'));return _0xf936b7;}else{logger[_0x0198('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x0198('0xf')](_0x0198('0x2f'),_0x3b6e05[_0x0198('0x11')]),'method':_0x0198('0x12'),'body':{'user':{'role':_0x0198('0x30'),'name':util[_0x0198('0xf')]('Caller\x20-\x20%s',_0x91aaf1||_0xb76ceb),'phone':_0xb76ceb}}})['then'](function(_0x10fa2f){logger[_0x0198('0x19')]('Enduser\x20created.');return _0x10fa2f['user'];});}});}function getAuth(_0x21b6b3){var _0x2770cf;if(_0x21b6b3[_0x0198('0x31')]===_0x0198('0x32')){_0x2770cf=util[_0x0198('0xf')]('%s:%s',_0x21b6b3['username'],_0x21b6b3[_0x0198('0x32')]);}else if(_0x21b6b3[_0x0198('0x31')]===_0x0198('0x33')){_0x2770cf=util['format'](_0x0198('0x34'),_0x21b6b3[_0x0198('0x35')],_0x21b6b3[_0x0198('0x33')]);}return util[_0x0198('0xf')](_0x0198('0x36'),new Buffer(_0x2770cf)[_0x0198('0x37')](_0x0198('0x38')));}function request(_0x2fdd12){logger[_0x0198('0x39')](_0x0198('0x3a'),JSON[_0x0198('0x3b')](_0x2fdd12));return rp(_[_0x0198('0x9')](_0x2fdd12,{'method':_0x0198('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x1870ae,_0x16e737){var _0x6cdbc=[];if(_0x1870ae&&_0x1870ae['length']>0x0){_0x6cdbc=_[_0x0198('0x3d')](_0x1870ae,_0x16e737);}return _0x6cdbc;}function getCustomFields(_0xb1ae3e,_0x4b1dd5){var _0x1a0d9f=[];var _0xc00df5={'custom_fields':[]};if(_0xb1ae3e[_0x0198('0x2b')]>0x0){_[_0x0198('0x3e')](_0xb1ae3e,function(_0x3f1992){if(_[_0x0198('0x3f')]([_0x0198('0x40'),_0x0198('0x41')],_0x3f1992[_0x0198('0x42')])&&_0x3f1992['nameField']&&!_0x3f1992[_0x0198('0x43')]){_0xc00df5[_0x3f1992[_0x0198('0x44')][_0x0198('0x45')]()]=_0x3f1992['content'][_0x0198('0x37')]();}else if(_[_0x0198('0x3f')](['string','picklist'],_0x3f1992['type'])&&_0x3f1992[_0x0198('0x46')]&&_0x3f1992[_0x0198('0x43')]){_0xc00df5[_0x0198('0x47')][_0x0198('0x48')]({'id':_0x3f1992[_0x0198('0x46')],'value':_0x3f1992[_0x0198('0x49')][_0x0198('0x37')]()});}else if(_0x3f1992[_0x0198('0x42')]===_0x0198('0x4a')&&_0x3f1992[_0x0198('0x4b')]&&_0x3f1992[_0x0198('0x46')]&&_0x3f1992[_0x0198('0x43')]){_0x4b1dd5[_0x3f1992['variableName']]&&_0xc00df5[_0x0198('0x47')]['push']({'id':_0x3f1992[_0x0198('0x46')],'value':_0x4b1dd5[_0x3f1992[_0x0198('0x4b')]][_0x0198('0x37')]()});}else if(_0x3f1992[_0x0198('0x42')]===_0x0198('0x4c')&&_0x3f1992[_0x0198('0x4d')]&&_0x3f1992[_0x0198('0x4d')][_0x0198('0x4e')]&&_0x3f1992['idField']&&_0x3f1992['customField']){_0x4b1dd5[_0x3f1992['Variable'][_0x0198('0x4e')][_0x0198('0x45')]()]&&_0xc00df5[_0x0198('0x47')][_0x0198('0x48')]({'id':_0x3f1992[_0x0198('0x46')],'value':_0x4b1dd5[_0x3f1992[_0x0198('0x4d')][_0x0198('0x4e')][_0x0198('0x45')]()][_0x0198('0x37')]()});}});}return _0xc00df5;}exports[_0x0198('0x4f')]=function(_0x253485,_0x40d5da,_0x37426b,_0x3892c9,_0x555936,_0x3356ce){var _0x5f2843,_0x3c43ab;_0x3356ce['remoteUri']=intUtil[_0x0198('0x50')](_0x3356ce[_0x0198('0x11')]);_0x3356ce[_0x0198('0x51')]=intUtil[_0x0198('0x50')](_0x3356ce[_0x0198('0x51')]);if(_0x555936&&_0x555936[_0x0198('0x52')]){logger['info'](_0x0198('0x53'),_0x0198('0x54'));_0x40d5da['recordingURL']=util[_0x0198('0xf')](_0x0198('0x55'),_0x3356ce[_0x0198('0x51')],_0x40d5da[_0x0198('0x56')],md5(_0x40d5da[_0x0198('0x56')]));}else{_0x40d5da['recordingURL']='';}headers['Authorization']=getAuth(_0x3356ce);return getUser(_0x3356ce,_0x3892c9[_0x0198('0x57')])[_0x0198('0x18')](function(_0x37643a){_0x5f2843=_0x37643a;logger[_0x0198('0x19')](_0x0198('0x58'),_0x5f2843['id']);return getEndUser(_0x3356ce,_0x40d5da[_0x0198('0x59')],_0x40d5da[_0x0198('0x5a')]);})['then'](function(_0x5c500c){_0x3c43ab=_0x5c500c;logger[_0x0198('0x19')](_0x0198('0x5b'),_0x3c43ab['id']);return getTicket(_0x3356ce,_0x5f2843,_0x3c43ab,_0x37426b,_0x40d5da);})[_0x0198('0x18')](function(_0x3285ba){if(_0x3285ba){logger['info'](_0x0198('0x5c'),_0x3285ba['id']);switch(_0x3356ce[_0x0198('0x42')]){case _0x0198('0x5d'):logger[_0x0198('0x19')](_0x0198('0x53'),_0x0198('0x5e'));return request({'uri':util[_0x0198('0xf')](_0x0198('0x5f'),_0x3356ce[_0x0198('0x11')],_0x5f2843['id'],_0x3285ba['id']),'method':_0x0198('0x12')});case _0x0198('0x60'):logger['info'](_0x0198('0x53'),_0x0198('0x61'));emit(util[_0x0198('0xf')]('user:%s',_0x3892c9['name']),_0x0198('0x62'),{'uri':util[_0x0198('0xf')](_0x0198('0x63'),_0x3356ce[_0x0198('0x11')][_0x0198('0x64')](_0x0198('0x65'),''),_0x3285ba['id'])});break;default:logger['error'](_0x0198('0x53'),_0x0198('0x66'));}}})[_0x0198('0x67')](function(_0x10a837){logger['error'](_0x0198('0x68'),util[_0x0198('0x69')](_0x10a837,{'showHidden':!![],'depth':null}));});};exports[_0x0198('0x6a')]=function(_0x4429dc,_0x3f27eb,_0x5f3cc5,_0x57a52a,_0x13e699,_0x1afbdf,_0x5e83fb){var _0x4a5788,_0x2eb19b;_0x1afbdf[_0x0198('0x11')]=intUtil[_0x0198('0x50')](_0x1afbdf[_0x0198('0x11')]);_0x1afbdf['serverUrl']=intUtil['stripTrailingSlash'](_0x1afbdf[_0x0198('0x51')]);if(_0x5e83fb&&_0x5e83fb[_0x0198('0x6b')]&&_0x5e83fb[_0x0198('0x6b')]!==_0x0198('0x6c')){logger[_0x0198('0x19')](_0x0198('0x6d'),_0x0198('0x54'));_0x3f27eb[_0x0198('0x6e')]=util[_0x0198('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1afbdf['serverUrl'],_0x3f27eb['uniqueid'],md5(_0x3f27eb['uniqueid']));}headers['Authorization']=getAuth(_0x1afbdf);return getUser(_0x1afbdf,_0x57a52a[_0x0198('0x57')])['then'](function(_0x51e913){_0x4a5788=_0x51e913;logger[_0x0198('0x19')](_0x0198('0x58'),_0x4a5788['id']);return getEndUser(_0x1afbdf,_0x3f27eb[_0x0198('0x6f')],_0x3f27eb['destcalleridnum']);})['then'](function(_0x367ce1){_0x2eb19b=_0x367ce1;logger[_0x0198('0x19')]('The\x20Enduser\x20ID\x20is:',_0x2eb19b['id']);return getTicket(_0x1afbdf,_0x4a5788,_0x2eb19b,_0x5f3cc5,_0x3f27eb);})['then'](function(_0x431c90){if(_0x431c90){logger[_0x0198('0x19')]('The\x20Ticket\x20ID\x20is:',_0x431c90['id']);switch(_0x1afbdf[_0x0198('0x42')]){case _0x0198('0x5d'):logger[_0x0198('0x19')](_0x0198('0x6d'),_0x0198('0x5e'));return request({'uri':util[_0x0198('0xf')](_0x0198('0x5f'),_0x1afbdf[_0x0198('0x11')],_0x4a5788['id'],_0x431c90['id']),'method':_0x0198('0x12')});case'newTab':logger[_0x0198('0x19')]('[OUTBOUND]',_0x0198('0x61'));emit(util['format'](_0x0198('0x70'),_0x57a52a[_0x0198('0x4e')]),'trigger:browser:url',{'uri':util['format'](_0x0198('0x63'),_0x1afbdf[_0x0198('0x11')][_0x0198('0x64')]('/api/v2',''),_0x431c90['id'])});break;default:logger[_0x0198('0x71')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0198('0x67')](function(_0x976ee4){logger[_0x0198('0x71')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x0198('0x69')](_0x976ee4,{'showHidden':!![],'depth':null}));});};exports[_0x0198('0x72')]=function(_0x2ad219,_0x39c732,_0x46d142,_0x13e2ae,_0x5f4728,_0x3a8911){var _0x229b00,_0x52c33a;_0x3a8911['remoteUri']=intUtil[_0x0198('0x50')](_0x3a8911[_0x0198('0x11')]);_0x3a8911[_0x0198('0x51')]=intUtil[_0x0198('0x50')](_0x3a8911[_0x0198('0x51')]);if(_0x5f4728&&_0x5f4728[_0x0198('0x52')]){logger[_0x0198('0x19')]('['+_0x39c732[_0x0198('0x73')][_0x0198('0x74')]()+']',_0x0198('0x54'));_0x39c732['recordingURL']=util[_0x0198('0xf')](_0x0198('0x55'),_0x3a8911[_0x0198('0x51')],_0x39c732[_0x0198('0x56')],md5(_0x39c732[_0x0198('0x56')]));}else{_0x39c732[_0x0198('0x6e')]='';}headers[_0x0198('0x75')]=getAuth(_0x3a8911);return getUser(_0x3a8911)[_0x0198('0x18')](function(_0x592c7f){_0x229b00=_0x592c7f;logger[_0x0198('0x19')](_0x0198('0x58'),_0x229b00['id']);return getEndUser(_0x3a8911,_0x39c732[_0x0198('0x59')],_0x39c732[_0x0198('0x5a')]);})[_0x0198('0x18')](function(_0x2c9b28){_0x52c33a=_0x2c9b28;logger[_0x0198('0x19')](_0x0198('0x5b'),_0x52c33a['id']);return getTicket(_0x3a8911,_0x229b00,_0x52c33a,_0x46d142,_0x39c732);})[_0x0198('0x18')](function(_0x268ed8){if(_0x268ed8){logger[_0x0198('0x19')](_0x0198('0x5c'),_0x268ed8['id']);}})['catch'](function(_0x47acaa){logger['error']('['+_0x39c732[_0x0198('0x73')][_0x0198('0x74')]()+']'+_0x0198('0x76'),util['inspect'](_0x47acaa,{'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 0f25017..7c480cb 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 _0x928f=['isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Owner','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','complete','Answered','rejected','abandoned','Abandoned','timeout','Call_Start_Time','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','queue','stripTrailingSlash','host','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','calleridname','lodash','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users'];(function(_0x46376c,_0x9c88d0){var _0x1477a0=function(_0x4c5ad1){while(--_0x4c5ad1){_0x46376c['push'](_0x46376c['shift']());}};_0x1477a0(++_0x9c88d0);}(_0x928f,0x196));var _0xf928=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x928f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf928('0x0'));var rp=require('request-promise');var md5=require(_0xf928('0x1'));var util=require('util');var intUtil=require(_0xf928('0x2'));var moment=require(_0xf928('0x3'));var Redis=require(_0xf928('0x4'));var BPromise=require(_0xf928('0x5'));var config=require(_0xf928('0x6'));var logger=require(_0xf928('0x7'))(_0xf928('0x8'));config[_0xf928('0x9')]=_[_0xf928('0xa')](config[_0xf928('0x9')],{'host':_0xf928('0xb'),'port':0x18eb});var io=require(_0xf928('0xc'))(new Redis(config[_0xf928('0x9')]));function emit(_0x43cb43,_0x211e1e,_0x1ddc66){io['to'](_0x43cb43)[_0xf928('0xd')](_0x211e1e,_0x1ddc66);}function request(_0x29e635){logger[_0xf928('0xe')](_0xf928('0xf'),JSON[_0xf928('0x10')](_0x29e635));return rp(_0x29e635);}function getCustomFields(_0x41f04a,_0x4f3ebf){var _0x5dc7dc={};if(_0x41f04a[_0xf928('0x11')]>0x0){_['forEach'](_0x41f04a,function(_0xc8ac48){if(_[_0xf928('0x12')]([_0xf928('0x13'),_0xf928('0x14')],_0xc8ac48[_0xf928('0x15')])&&_0xc8ac48[_0xf928('0x16')]){_0x5dc7dc[_0xc8ac48['idField']]=_0xc8ac48[_0xf928('0x17')][_0xf928('0x18')]();}else if(_0xc8ac48[_0xf928('0x15')]===_0xf928('0x19')&&_0xc8ac48['variableName']&&_0xc8ac48[_0xf928('0x16')]&&_0x4f3ebf[_0xc8ac48[_0xf928('0x1a')]]){_0x5dc7dc[_0xc8ac48[_0xf928('0x16')]]=_0x4f3ebf[_0xc8ac48[_0xf928('0x1a')]][_0xf928('0x18')]();}else if(_0xc8ac48[_0xf928('0x15')]===_0xf928('0x1b')&&_0xc8ac48['Variable']&&_0xc8ac48[_0xf928('0x1c')][_0xf928('0x1d')]&&_0xc8ac48['idField']&&_0x4f3ebf[_0xc8ac48[_0xf928('0x1c')][_0xf928('0x1d')][_0xf928('0x1e')]()]){_0x5dc7dc[_0xc8ac48[_0xf928('0x16')]]=_0x4f3ebf[_0xc8ac48['Variable'][_0xf928('0x1d')][_0xf928('0x1e')]()]['toString']();}});}return _0x5dc7dc;}function getName(_0x4b43f0){if(_0x4b43f0[_0xf928('0x1f')]('\x20')>0x0){var _0x25a9f2=_0x4b43f0[_0xf928('0x20')](/ (.+)/);if(_0x25a9f2[0x1]){return _0x25a9f2;}}return[_0x4b43f0,_0x4b43f0];}var accountsTokens={};function getAccessToken(_0x33ebaa){return new Promise(function(_0x506ec4,_0x256567){if(!_[_0xf928('0x21')](accountsTokens[_0x33ebaa['id']])&&!_[_0xf928('0x21')](accountsTokens[_0x33ebaa['id']][_0xf928('0x22')])){if(moment()[_0xf928('0x23')](accountsTokens[_0x33ebaa['id']][_0xf928('0x24')])){_0x506ec4(accountsTokens[_0x33ebaa['id']][_0xf928('0x22')]);}}var _0x5c1c6c;switch(_0x33ebaa[_0xf928('0x25')]){case'US':_0x5c1c6c=_0xf928('0x26');break;case'AU':_0x5c1c6c=_0xf928('0x27');break;case'EU':_0x5c1c6c=_0xf928('0x28');break;case'IN':_0x5c1c6c=_0xf928('0x29');break;case'CN':_0x5c1c6c=_0xf928('0x2a');break;default:_0x5c1c6c='https://accounts.zoho.eu';break;}var _0x26f99e={'method':_0xf928('0x2b'),'uri':_0x5c1c6c+_0xf928('0x2c'),'qs':{'refresh_token':_0x33ebaa[_0xf928('0x2d')],'client_id':_0x33ebaa[_0xf928('0x2e')],'client_secret':_0x33ebaa[_0xf928('0x2f')],'grant_type':_0xf928('0x30')},'json':!![]};return rp(_0x26f99e)['then'](function(_0x1db87e){accountsTokens[_0x33ebaa['id']]={'access_token':_0x1db87e[_0xf928('0x22')],'expires_in':moment()[_0xf928('0x31')](_0x1db87e['expires_in'],_0xf928('0x32'))};_0x506ec4(_0x1db87e['access_token']);})[_0xf928('0x33')](function(_0x14d1a1){logger[_0xf928('0x34')]('Failing\x20creating\x20the\x20access_token',_0x14d1a1[_0xf928('0x35')]);_0x256567(_0x14d1a1);});});}function getUser(_0x2c0621,_0x4171f3,_0x51e612,_0x48f798){logger[_0xf928('0x36')](_0xf928('0x37'));return request({'method':_0xf928('0x38'),'uri':util[_0xf928('0x39')](_0xf928('0x3a'),_0x4171f3),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xf928('0x3b')+_0x2c0621},'json':!![]})[_0xf928('0x3c')](function(_0x340c5f){if(_0x340c5f[_0xf928('0x3d')]){var _0x321b77=-0x1;if(_[_0xf928('0x3e')](_0x340c5f[_0xf928('0x3d')])){if(!_[_0xf928('0x21')](_0x48f798)){_0x321b77=_[_0xf928('0x3f')](_0x340c5f[_0xf928('0x3d')],function(_0x40b8f3){return _0x40b8f3[_0xf928('0x40')]===_0x48f798;});}if(_0x321b77>=0x0){logger[_0xf928('0x36')](_0xf928('0x41'));}else{logger['info'](_0xf928('0x42'));_0x321b77=_['findIndex'](_0x340c5f[_0xf928('0x3d')],function(_0x4459b0){return _0x4459b0['profile'][_0xf928('0x1d')]===_0xf928('0x43');});}return _0x340c5f['users'][_0x321b77];}else{if(_0x340c5f['user'][_0xf928('0x44')]['name']===_0xf928('0x43')){logger[_0xf928('0x36')](_0xf928('0x42'));user=_0x340c5f['user'];return user;}else{logger[_0xf928('0x34')](_0xf928('0x45'),JSON['stringify'](_0x340c5f));throw new Error(_0xf928('0x46')+JSON[_0xf928('0x10')](_0x340c5f));}}}else{logger['error'](_0xf928('0x45'),JSON[_0xf928('0x10')](_0x340c5f));throw new Error(_0xf928('0x46')+JSON[_0xf928('0x10')](_0x340c5f));}})[_0xf928('0x33')](function(_0x29950e){console[_0xf928('0x34')](_0x29950e);});}function getZohoUser(_0x3b119f,_0x54169f){return new BPromise(function(_0x2f03ee,_0x491ad8){request(_0x3b119f)[_0xf928('0x3c')](function(_0x1e5e94){var _0x176084=null;if(_0x1e5e94){_0x176084=_0x1e5e94[_0xf928('0x47')][0x0];_0x176084[_0xf928('0x48')]=_0x54169f;}_0x2f03ee(_0x176084);})['catch'](function(_0x3dd926){_0x491ad8(_0x3dd926);});});}function createEndUser(_0x2ad237,_0x36ff95,_0x4938b1,_0x4d2938,_0x1c7335,_0x5d40bd){var _0x4938b1=getName(_0x4938b1);return request({'method':_0xf928('0x2b'),'uri':_0xf928('0x49')+_0x36ff95+_0xf928('0x4a')+_[_0xf928('0x4b')](_0x5d40bd[_0xf928('0x4c')])+'s','body':{'data':[{'Last_Name':_0x4938b1[0x1],'First_Name':_0x4938b1[0x0],'Phone':_0x4d2938,'Owner':{'name':!_[_0xf928('0x21')](_0x1c7335[_0xf928('0x4d')][_0xf928('0x1d')])?_0x1c7335['role'][_0xf928('0x1d')]:!_[_0xf928('0x21')](_0x1c7335['first_name'])?_0x1c7335[_0xf928('0x4e')]+'\x20'+_0x1c7335[_0xf928('0x4f')]:_0x1c7335[_0xf928('0x4f')],'id':_0x1c7335['id']}}]},'headers':{'Authorization':_0xf928('0x3b')+_0x2ad237},'json':!![]})[_0xf928('0x3c')](function(_0xd0fb49){if(_0xd0fb49&&_0xd0fb49[_0xf928('0x47')][0x0][_0xf928('0x50')]===_0xf928('0x51')){var _0x1ee870=_0xd0fb49[_0xf928('0x47')][0x0][_0xf928('0x52')];_0x1ee870[_0xf928('0x48')]=_['startCase'](_0x5d40bd[_0xf928('0x4c')])+'s';return _0x1ee870;}logger['error'](_0xf928('0x45'),JSON[_0xf928('0x10')](data));throw new Error(_0xf928('0x53')+JSON[_0xf928('0x10')](data));})[_0xf928('0x33')](function(_0x364bb9){console['log'](_0xf928('0x54'),_0x364bb9);});}function getEndUser(_0x760d35,_0x3ea6c8,_0x3e1b71,_0x30af45,_0xdb41fe,_0x2e92b1,_0x3d9aa2){var _0x38b295={'method':_0xf928('0x38'),'uri':'','headers':{'Authorization':_0xf928('0x3b')+_0x760d35},'json':!![]};switch(_0x3d9aa2['moduleSearch']){case _0xf928('0x55'):_0x38b295['uri']=_0xf928('0x49')+_0x3ea6c8+_0xf928('0x56')+_0xdb41fe+'))';return getZohoUser(_0x38b295,_0xf928('0x57'))['then'](function(_0xaf22fb){if(_0xaf22fb)return _0xaf22fb;_0x38b295[_0xf928('0x58')]='https://www.zohoapis.'+_0x3ea6c8+_0xf928('0x59')+_0xdb41fe+'))';return getZohoUser(_0x38b295,_0xf928('0x5a'))['then'](function(_0x33aea7){if(_0x33aea7)return _0x33aea7;if(_0x3d9aa2[_0xf928('0x4c')]!=_0xf928('0x5b')){return createEndUser(_0x760d35,_0x3ea6c8,_0x30af45,_0xdb41fe,_0x2e92b1,_0x3d9aa2);}else{return{};}});});break;case'contact':_0x38b295[_0xf928('0x58')]=_0xf928('0x49')+_0x3ea6c8+_0xf928('0x56')+_0xdb41fe+'))';return getZohoUser(_0x38b295,_0xf928('0x57'))[_0xf928('0x3c')](function(_0x4ed0e4){if(_0x4ed0e4)return _0x4ed0e4;if(_0x3d9aa2[_0xf928('0x4c')]!=_0xf928('0x5b')){return createEndUser(_0x760d35,_0x3ea6c8,_0x30af45,_0xdb41fe,_0x2e92b1,_0x3d9aa2);}else{return{};}});break;case'lead':_0x38b295[_0xf928('0x58')]=_0xf928('0x49')+_0x3ea6c8+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xdb41fe+'))';return getZohoUser(_0x38b295,_0xf928('0x5a'))[_0xf928('0x3c')](function(_0x2613bb){if(_0x2613bb)return _0x2613bb;if(_0x3d9aa2['moduleCreate']!='nothing'){return createEndUser(_0x760d35,_0x3ea6c8,_0x30af45,_0xdb41fe,_0x2e92b1,_0x3d9aa2);}else{return{};}});break;}}function getCall(_0x5ea90a,_0x2a11d7,_0x1b523a,_0x1cad07,_0x525274,_0x2d9c40,_0x129ed4,_0x1fb89f){logger[_0xf928('0x36')]('Creating\x20new\x20call...');var _0x173992={};_0x173992[_0xf928('0x5c')]={'name':!_['isNil'](_0x1cad07[_0xf928('0x4d')][_0xf928('0x1d')])&&!_[_0xf928('0x21')](_0x1cad07[_0xf928('0x44')][_0xf928('0x1d')])&&_0x1cad07['profile'][_0xf928('0x1d')]===_0xf928('0x5d')?_0x1cad07[_0xf928('0x4d')][_0xf928('0x1d')]:!_[_0xf928('0x21')](_0x1cad07[_0xf928('0x4e')])?_0x1cad07[_0xf928('0x4e')]+'\x20'+_0x1cad07['last_name']:_0x1cad07['last_name'],'id':_0x1cad07['id']};_0x173992[_0xf928('0x5e')]=intUtil[_0xf928('0x5f')](_0x2d9c40['Subjects'],_0x129ed4,'\x20');_0x173992[_0xf928('0x60')]=intUtil[_0xf928('0x5f')](_0x2d9c40[_0xf928('0x61')],_0x129ed4,'\x0a');if(_0x525274['enduserType']===_0xf928('0x57')){_0x173992[_0xf928('0x62')]={'name':!_[_0xf928('0x21')](_0x525274[_0xf928('0x63')])?_0x525274['Full_Name']:!_['isNil'](_0x525274['First_Name'])?_0x525274[_0xf928('0x64')]+'\x20'+_0x525274[_0xf928('0x65')]:_0x525274[_0xf928('0x65')],'id':_0x525274['id']};}if(_0x525274['enduserType']===_0xf928('0x5a')){_0x173992[_0xf928('0x66')]={'name':!_[_0xf928('0x21')](_0x525274['Full_Name'])?_0x525274[_0xf928('0x63')]:!_[_0xf928('0x21')](_0x525274[_0xf928('0x64')])?_0x525274[_0xf928('0x64')]+'\x20'+_0x525274[_0xf928('0x65')]:_0x525274[_0xf928('0x65')],'id':_0x525274['id']};_0x173992[_0xf928('0x67')]=_[_0xf928('0x4b')](_0x525274[_0xf928('0x48')]);}if(_0x129ed4[_0xf928('0x68')]){_0x173992[_0xf928('0x69')]=moment[_0xf928('0x6a')](parseInt(_0x129ed4[_0xf928('0x68')])*0x3e8)['format'](_0xf928('0x6b'));}else if(_0x129ed4[_0xf928('0x6c')]&&_0x129ed4[_0xf928('0x6d')]){_0x173992[_0xf928('0x69')]=moment[_0xf928('0x6a')](moment(_0x129ed4[_0xf928('0x6d')],_0xf928('0x6e'))[_0xf928('0x6f')](moment(_0x129ed4[_0xf928('0x70')],'YYYY-MM-DDTHH:mm:ss')))[_0xf928('0x39')]('mm:ss');}switch(_0x129ed4[_0xf928('0x71')]){case'called':_0x173992[_0xf928('0x72')]='Called';break;case _0xf928('0x73'):case'connect':_0x173992[_0xf928('0x72')]=_0xf928('0x74');break;case _0xf928('0x75'):_0x173992['Call_Result']='Rejected';break;case _0xf928('0x76'):_0x173992[_0xf928('0x72')]=_0xf928('0x77');break;case _0xf928('0x78'):_0x173992[_0xf928('0x72')]='Timeout';default:}_0x173992[_0xf928('0x79')]=(_0x1fb89f==='outbound'?moment(_0x129ed4[_0xf928('0x70')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x129ed4['agentcalledAt'])[_0xf928('0x39')](_0xf928('0x6e')))||moment()[_0xf928('0x39')]('YYYY-MM-DDTHH:mm:ss');_0x173992[_0xf928('0x7a')]=_0x1fb89f||_0xf928('0x7b');_0x173992=_[_0xf928('0x7c')](_0x173992,getCustomFields(_0x2d9c40[_0xf928('0x7d')],_0x129ed4));return request({'method':_0xf928('0x2b'),'uri':_0xf928('0x49')+_0x2a11d7+_0xf928('0x7e'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5ea90a},'body':{'data':[_0x173992]},'json':!![]})[_0xf928('0x3c')](function(_0x103a7b){if(_0x103a7b&&_0x103a7b[_0xf928('0x47')][0x0][_0xf928('0x50')]==='SUCCESS'){logger['info']('Call\x20created!');return{'id':_0x103a7b['data'][0x0]['details']['id']};}})[_0xf928('0x33')](function(_0x82150b){logger[_0xf928('0x36')]('err',_0x82150b[_0xf928('0x35')]);console['log']('err',_0x82150b);});}exports[_0xf928('0x7f')]=function(_0x313989,_0x2e69e7,_0x3335ce,_0x489a28,_0x1124ed,_0x541032){var _0x4096be,_0x555efe,_0x382c66;_0x541032['host']=intUtil[_0xf928('0x80')](_0x541032[_0xf928('0x81')]);_0x541032['serverUrl']=intUtil[_0xf928('0x80')](_0x541032[_0xf928('0x82')]);if(_0x1124ed&&_0x1124ed['monitor_format']){logger[_0xf928('0x36')]('[QUEUE]',_0xf928('0x83'));_0x2e69e7[_0xf928('0x84')]=_0x541032[_0xf928('0x82')]+_0xf928('0x85')+_0x2e69e7[_0xf928('0x86')]+_0xf928('0x87')+md5(_0x2e69e7['uniqueid']);}else{_0x2e69e7[_0xf928('0x84')]='';}var _0x3672ec=_0x541032[_0xf928('0x81')]==='zoho.eu'?'eu':_0xf928('0x88');return getAccessToken(_0x541032)[_0xf928('0x3c')](function(_0x204833){_0x382c66=_0x204833;return getUser(_0x382c66,_0x3672ec,_0x541032,_0x489a28['email']);})[_0xf928('0x3c')](function(_0xcbe68a){_0x4096be=_0xcbe68a;logger['info']('The\x20User\x20ID\x20is:',_0x4096be['id']);return getEndUser(_0x382c66,_0x3672ec,_0x541032,_0x2e69e7['calleridname'],_0x2e69e7[_0xf928('0x89')],_0x4096be,_0x3335ce);})[_0xf928('0x3c')](function(_0x41648c){_0x555efe=_0x41648c;return getCall(_0x382c66,_0x3672ec,_0x541032,_0x4096be,_0x555efe,_0x3335ce,_0x2e69e7,_0xf928('0x7b'));})[_0xf928('0x3c')](function(_0x372997){if(_0x372997){logger[_0xf928('0x36')](_0xf928('0x8a'),_0x372997['id']);logger[_0xf928('0x36')](_0xf928('0x8b'),_0xf928('0x8c'));emit(util[_0xf928('0x39')](_0xf928('0x8d'),_0x489a28[_0xf928('0x1d')]),_0xf928('0x8e'),{'uri':_0xf928('0x8f')+_0x541032[_0xf928('0x81')]+_0xf928('0x90')+_0x372997['id']});}})[_0xf928('0x33')](function(_0xb9e5bb){logger[_0xf928('0x34')](_0xf928('0x8b'),JSON[_0xf928('0x10')](_0xb9e5bb));});};exports[_0xf928('0x91')]=function(_0xb15c24,_0x45cc69,_0x1636e3,_0x4f2f4a,_0xe3641a,_0x26ffa2,_0x1842b4){var _0x2b731d,_0x47b3d2,_0x23f565;_0x26ffa2['host']=intUtil[_0xf928('0x80')](_0x26ffa2[_0xf928('0x81')]);_0x26ffa2[_0xf928('0x82')]=intUtil[_0xf928('0x80')](_0x26ffa2[_0xf928('0x82')]);if(_0x1842b4&&_0x1842b4[_0xf928('0x92')]&&_0x1842b4['recordingFormat']!=='none'){logger['info'](_0xf928('0x93'),'Recording\x20is\x20enabled!');_0x45cc69[_0xf928('0x84')]=_0x26ffa2[_0xf928('0x82')]+_0xf928('0x85')+_0x45cc69[_0xf928('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x45cc69[_0xf928('0x86')]);}var _0x186e7b=_0x26ffa2['host']===_0xf928('0x94')?'eu':_0xf928('0x88');return getAccessToken(_0x26ffa2)[_0xf928('0x3c')](function(_0xb4231f){_0x23f565=_0xb4231f;return getUser(_0x23f565,_0x186e7b,_0x26ffa2,_0x4f2f4a[_0xf928('0x40')]);})[_0xf928('0x3c')](function(_0x234a92){_0x2b731d=_0x234a92;logger['info'](_0xf928('0x95'),_0x2b731d['id']);return getEndUser(_0x23f565,_0x186e7b,_0x26ffa2,_0x45cc69[_0xf928('0x96')],_0x45cc69[_0xf928('0x97')],_0x2b731d,_0x1636e3);})[_0xf928('0x3c')](function(_0x2a5c2a){_0x47b3d2=_0x2a5c2a;return getCall(_0x23f565,_0x186e7b,_0x26ffa2,_0x2b731d,_0x47b3d2,_0x1636e3,_0x45cc69,_0xf928('0x98'));})[_0xf928('0x3c')](function(_0x49b50d){if(_0x49b50d){logger[_0xf928('0x36')](_0xf928('0x8a'),_0x49b50d['id']);logger[_0xf928('0x36')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x4f2f4a[_0xf928('0x1d')]),'trigger:browser:url',{'uri':_0xf928('0x8f')+_0x26ffa2['host']+_0xf928('0x90')+_0x49b50d['id']});}})[_0xf928('0x33')](function(_0xfb753b){logger[_0xf928('0x34')](_0xf928('0x93'),JSON['stringify'](_0xfb753b));});};exports[_0xf928('0x99')]=function(_0x2bd50e,_0x49d9ea,_0x2a7b71,_0x24e83e,_0x146962,_0x34e2a0){var _0x2bad7f,_0x2ddccf,_0x26e9c1;_0x34e2a0[_0xf928('0x81')]=intUtil[_0xf928('0x80')](_0x34e2a0['host']);_0x34e2a0[_0xf928('0x82')]=intUtil[_0xf928('0x80')](_0x34e2a0[_0xf928('0x82')]);if(_0x146962&&_0x146962['monitor_format']){logger[_0xf928('0x36')]('['+_0x49d9ea[_0xf928('0x71')][_0xf928('0x9a')]()+']',_0xf928('0x83'));_0x49d9ea[_0xf928('0x84')]=_0x34e2a0[_0xf928('0x82')]+_0xf928('0x85')+_0x49d9ea[_0xf928('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x49d9ea[_0xf928('0x86')]);}else{_0x49d9ea[_0xf928('0x84')]='';}var _0x505221=_0x34e2a0['host']===_0xf928('0x94')?'eu':_0xf928('0x88');return getAccessToken(_0x34e2a0)[_0xf928('0x3c')](function(_0x2ac6f1){_0x26e9c1=_0x2ac6f1;return getUser(_0x26e9c1,_0x505221,_0x34e2a0);})[_0xf928('0x3c')](function(_0x2bce85){_0x2bad7f=_0x2bce85;logger[_0xf928('0x36')](_0xf928('0x95'),_0x2bad7f['id']);return getEndUser(_0x26e9c1,_0x505221,_0x34e2a0,_0x49d9ea[_0xf928('0x9b')],_0x49d9ea[_0xf928('0x89')],_0x2bad7f,_0x2a7b71);})[_0xf928('0x3c')](function(_0x83b7cc){_0x2ddccf=_0x83b7cc;return getCall(_0x26e9c1,_0x505221,_0x34e2a0,_0x2bad7f,_0x2ddccf,_0x2a7b71,_0x49d9ea,_0xf928('0x7b'));})[_0xf928('0x3c')](function(_0x507986){if(_0x507986){logger[_0xf928('0x36')]('The\x20Call\x20ID\x20is:',_0x507986['id']);}})[_0xf928('0x33')](function(_0x47a466){logger['error']('['+_0x49d9ea[_0xf928('0x71')][_0xf928('0x9a')]()+']',JSON[_0xf928('0x10')](_0x47a466));});}; \ No newline at end of file +var _0x2baf=['nothing','Creating\x20new\x20call...','Owner','role','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','utc','mm:ss','answertime','endtime','Call_Duration','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','com','destcalleridname','destcalleridnum','Outbound','user:%s','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','lodash','request-promise','md5','util','moment','bluebird','../../../../config/logger','redis','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','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','clientSecret','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','info','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','/crm/v2/','startCase','moduleCreate','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','https://www.zohoapis.'];(function(_0x1406c8,_0x40a801){var _0x3ec6f8=function(_0xc1183a){while(--_0xc1183a){_0x1406c8['push'](_0x1406c8['shift']());}};_0x3ec6f8(++_0x40a801);}(_0x2baf,0xe7));var _0xf2ba=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x2baf[_0x1bb58c];return _0x277586;};'use strict';var _=require(_0xf2ba('0x0'));var rp=require(_0xf2ba('0x1'));var md5=require(_0xf2ba('0x2'));var util=require(_0xf2ba('0x3'));var intUtil=require('./util');var moment=require(_0xf2ba('0x4'));var Redis=require('ioredis');var BPromise=require(_0xf2ba('0x5'));var config=require('../../../../config/environment');var logger=require(_0xf2ba('0x6'))('zoho');config[_0xf2ba('0x7')]=_['defaults'](config[_0xf2ba('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xf2ba('0x8'))(new Redis(config['redis']));function emit(_0x22b39f,_0x5d00e5,_0x27438d){io['to'](_0x22b39f)[_0xf2ba('0x9')](_0x5d00e5,_0x27438d);}function request(_0xa58870){logger['debug'](_0xf2ba('0xa'),JSON[_0xf2ba('0xb')](_0xa58870));return rp(_0xa58870);}function getCustomFields(_0x2847ad,_0x11d333){var _0x6ee879={};if(_0x2847ad[_0xf2ba('0xc')]>0x0){_[_0xf2ba('0xd')](_0x2847ad,function(_0xd3ed84){if(_[_0xf2ba('0xe')]([_0xf2ba('0xf'),'picklist'],_0xd3ed84[_0xf2ba('0x10')])&&_0xd3ed84[_0xf2ba('0x11')]){_0x6ee879[_0xd3ed84[_0xf2ba('0x11')]]=_0xd3ed84[_0xf2ba('0x12')]['toString']();}else if(_0xd3ed84[_0xf2ba('0x10')]===_0xf2ba('0x13')&&_0xd3ed84[_0xf2ba('0x14')]&&_0xd3ed84[_0xf2ba('0x11')]&&_0x11d333[_0xd3ed84[_0xf2ba('0x14')]]){_0x6ee879[_0xd3ed84['idField']]=_0x11d333[_0xd3ed84[_0xf2ba('0x14')]][_0xf2ba('0x15')]();}else if(_0xd3ed84[_0xf2ba('0x10')]==='customVariable'&&_0xd3ed84[_0xf2ba('0x16')]&&_0xd3ed84[_0xf2ba('0x16')][_0xf2ba('0x17')]&&_0xd3ed84['idField']&&_0x11d333[_0xd3ed84[_0xf2ba('0x16')][_0xf2ba('0x17')][_0xf2ba('0x18')]()]){_0x6ee879[_0xd3ed84['idField']]=_0x11d333[_0xd3ed84['Variable'][_0xf2ba('0x17')][_0xf2ba('0x18')]()][_0xf2ba('0x15')]();}});}return _0x6ee879;}function getName(_0x58f3c7){if(_0x58f3c7[_0xf2ba('0x19')]('\x20')>0x0){var _0x1b1e78=_0x58f3c7[_0xf2ba('0x1a')](/ (.+)/);if(_0x1b1e78[0x1]){return _0x1b1e78;}}return[_0x58f3c7,_0x58f3c7];}var accountsTokens={};function getAccessToken(_0x56b30a){return new Promise(function(_0x1c1ed,_0x151acc){if(!_[_0xf2ba('0x1b')](accountsTokens[_0x56b30a['id']])&&!_[_0xf2ba('0x1b')](accountsTokens[_0x56b30a['id']]['access_token'])){if(moment()[_0xf2ba('0x1c')](accountsTokens[_0x56b30a['id']][_0xf2ba('0x1d')])){_0x1c1ed(accountsTokens[_0x56b30a['id']][_0xf2ba('0x1e')]);}}var _0x131ea2;switch(_0x56b30a[_0xf2ba('0x1f')]){case'US':_0x131ea2=_0xf2ba('0x20');break;case'AU':_0x131ea2=_0xf2ba('0x21');break;case'EU':_0x131ea2='https://accounts.zoho.eu';break;case'IN':_0x131ea2=_0xf2ba('0x22');break;case'CN':_0x131ea2=_0xf2ba('0x23');break;default:_0x131ea2=_0xf2ba('0x24');break;}var _0x2d78b0={'method':_0xf2ba('0x25'),'uri':_0x131ea2+_0xf2ba('0x26'),'qs':{'refresh_token':_0x56b30a[_0xf2ba('0x27')],'client_id':_0x56b30a['clientId'],'client_secret':_0x56b30a[_0xf2ba('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2d78b0)[_0xf2ba('0x29')](function(_0x4a2a89){accountsTokens[_0x56b30a['id']]={'access_token':_0x4a2a89[_0xf2ba('0x1e')],'expires_in':moment()[_0xf2ba('0x2a')](_0x4a2a89[_0xf2ba('0x1d')],_0xf2ba('0x2b'))};_0x1c1ed(_0x4a2a89['access_token']);})['catch'](function(_0x23f941){logger[_0xf2ba('0x2c')](_0xf2ba('0x2d'),_0x23f941['stack']);_0x151acc(_0x23f941);});});}function getUser(_0x281f28,_0x1db6dc,_0x32ee27,_0x14d377){logger['info'](_0xf2ba('0x2e'));return request({'method':_0xf2ba('0x2f'),'uri':util[_0xf2ba('0x30')](_0xf2ba('0x31'),_0x1db6dc),'qs':{'type':_0xf2ba('0x32')},'headers':{'Authorization':_0xf2ba('0x33')+_0x281f28},'json':!![]})[_0xf2ba('0x29')](function(_0x409c68){if(_0x409c68[_0xf2ba('0x34')]){var _0x2836a4=-0x1;if(_[_0xf2ba('0x35')](_0x409c68[_0xf2ba('0x34')])){if(!_[_0xf2ba('0x1b')](_0x14d377)){_0x2836a4=_['findIndex'](_0x409c68[_0xf2ba('0x34')],function(_0x107422){return _0x107422[_0xf2ba('0x36')]===_0x14d377;});}if(_0x2836a4>=0x0){logger[_0xf2ba('0x37')]('Agent\x20found!');}else{logger[_0xf2ba('0x37')](_0xf2ba('0x38'));_0x2836a4=_[_0xf2ba('0x39')](_0x409c68[_0xf2ba('0x34')],function(_0x3485be){return _0x3485be[_0xf2ba('0x3a')][_0xf2ba('0x17')]===_0xf2ba('0x3b');});}return _0x409c68['users'][_0x2836a4];}else{if(_0x409c68[_0xf2ba('0x3c')][_0xf2ba('0x3a')][_0xf2ba('0x17')]==='Administrator'){logger[_0xf2ba('0x37')](_0xf2ba('0x38'));user=_0x409c68[_0xf2ba('0x3c')];return user;}else{logger['error'](_0xf2ba('0x3d'),JSON[_0xf2ba('0xb')](_0x409c68));throw new Error(_0xf2ba('0x3e')+JSON[_0xf2ba('0xb')](_0x409c68));}}}else{logger[_0xf2ba('0x2c')](_0xf2ba('0x3d'),JSON[_0xf2ba('0xb')](_0x409c68));throw new Error(_0xf2ba('0x3e')+JSON['stringify'](_0x409c68));}})[_0xf2ba('0x3f')](function(_0x461733){console[_0xf2ba('0x2c')](_0x461733);});}function getZohoUser(_0x311cf6,_0x5f3674){return new BPromise(function(_0x48a06f,_0x2a96bb){request(_0x311cf6)['then'](function(_0x1a4767){var _0xc814b4=null;if(_0x1a4767){_0xc814b4=_0x1a4767[_0xf2ba('0x40')][0x0];_0xc814b4[_0xf2ba('0x41')]=_0x5f3674;}_0x48a06f(_0xc814b4);})['catch'](function(_0x3d3847){_0x2a96bb(_0x3d3847);});});}function createEndUser(_0x17a9d7,_0x3695a6,_0x51c6a3,_0x1d7523,_0x23e2fc,_0x4401e){var _0x51c6a3=getName(_0x51c6a3);return request({'method':_0xf2ba('0x25'),'uri':'https://www.zohoapis.'+_0x3695a6+_0xf2ba('0x42')+_[_0xf2ba('0x43')](_0x4401e[_0xf2ba('0x44')])+'s','body':{'data':[{'Last_Name':_0x51c6a3[0x1],'First_Name':_0x51c6a3[0x0],'Phone':_0x1d7523,'Owner':{'name':!_[_0xf2ba('0x1b')](_0x23e2fc['role'][_0xf2ba('0x17')])?_0x23e2fc['role'][_0xf2ba('0x17')]:!_['isNil'](_0x23e2fc[_0xf2ba('0x45')])?_0x23e2fc['first_name']+'\x20'+_0x23e2fc['last_name']:_0x23e2fc[_0xf2ba('0x46')],'id':_0x23e2fc['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x17a9d7},'json':!![]})['then'](function(_0x57edab){if(_0x57edab&&_0x57edab[_0xf2ba('0x40')][0x0][_0xf2ba('0x47')]===_0xf2ba('0x48')){var _0xef588b=_0x57edab[_0xf2ba('0x40')][0x0][_0xf2ba('0x49')];_0xef588b[_0xf2ba('0x41')]=_[_0xf2ba('0x43')](_0x4401e[_0xf2ba('0x44')])+'s';return _0xef588b;}logger[_0xf2ba('0x2c')]('The\x20failing\x20result\x20is',JSON[_0xf2ba('0xb')](data));throw new Error('Error:\x20'+JSON[_0xf2ba('0xb')](data));})[_0xf2ba('0x3f')](function(_0x4026bc){console[_0xf2ba('0x4a')](_0xf2ba('0x4b'),_0x4026bc);});}function getEndUser(_0x1fb706,_0x424a29,_0x4dff5c,_0xe1de75,_0x5e437c,_0x174451,_0x2eb5a9){var _0x34c271={'method':_0xf2ba('0x2f'),'uri':'','headers':{'Authorization':_0xf2ba('0x33')+_0x1fb706},'json':!![]};switch(_0x2eb5a9['moduleSearch']){case _0xf2ba('0x4c'):_0x34c271[_0xf2ba('0x4d')]='https://www.zohoapis.'+_0x424a29+_0xf2ba('0x4e')+_0x5e437c+'))';return getZohoUser(_0x34c271,_0xf2ba('0x4f'))['then'](function(_0x1cc92f){if(_0x1cc92f)return _0x1cc92f;_0x34c271['uri']='https://www.zohoapis.'+_0x424a29+_0xf2ba('0x50')+_0x5e437c+'))';return getZohoUser(_0x34c271,_0xf2ba('0x51'))[_0xf2ba('0x29')](function(_0x241414){if(_0x241414)return _0x241414;if(_0x2eb5a9[_0xf2ba('0x44')]!='nothing'){return createEndUser(_0x1fb706,_0x424a29,_0xe1de75,_0x5e437c,_0x174451,_0x2eb5a9);}else{return{};}});});break;case'contact':_0x34c271[_0xf2ba('0x4d')]=_0xf2ba('0x52')+_0x424a29+_0xf2ba('0x4e')+_0x5e437c+'))';return getZohoUser(_0x34c271,_0xf2ba('0x4f'))[_0xf2ba('0x29')](function(_0x33ec39){if(_0x33ec39)return _0x33ec39;if(_0x2eb5a9[_0xf2ba('0x44')]!=_0xf2ba('0x53')){return createEndUser(_0x1fb706,_0x424a29,_0xe1de75,_0x5e437c,_0x174451,_0x2eb5a9);}else{return{};}});break;case'lead':_0x34c271[_0xf2ba('0x4d')]=_0xf2ba('0x52')+_0x424a29+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5e437c+'))';return getZohoUser(_0x34c271,_0xf2ba('0x51'))[_0xf2ba('0x29')](function(_0x5c6d1f){if(_0x5c6d1f)return _0x5c6d1f;if(_0x2eb5a9[_0xf2ba('0x44')]!='nothing'){return createEndUser(_0x1fb706,_0x424a29,_0xe1de75,_0x5e437c,_0x174451,_0x2eb5a9);}else{return{};}});break;}}function getCall(_0x401e77,_0x453d4c,_0x47f4fc,_0x424068,_0x48fc83,_0x2c17b4,_0x5b396e,_0x2e79be){logger[_0xf2ba('0x37')](_0xf2ba('0x54'));var _0x1540f1={};_0x1540f1[_0xf2ba('0x55')]={'name':!_[_0xf2ba('0x1b')](_0x424068[_0xf2ba('0x56')][_0xf2ba('0x17')])&&!_[_0xf2ba('0x1b')](_0x424068['profile']['name'])&&_0x424068[_0xf2ba('0x3a')][_0xf2ba('0x17')]==='administrator'?_0x424068[_0xf2ba('0x56')]['name']:!_['isNil'](_0x424068[_0xf2ba('0x45')])?_0x424068['first_name']+'\x20'+_0x424068['last_name']:_0x424068[_0xf2ba('0x46')],'id':_0x424068['id']};_0x1540f1['Subject']=intUtil[_0xf2ba('0x57')](_0x2c17b4[_0xf2ba('0x58')],_0x5b396e,'\x20');_0x1540f1[_0xf2ba('0x59')]=intUtil[_0xf2ba('0x57')](_0x2c17b4[_0xf2ba('0x5a')],_0x5b396e,'\x0a');if(_0x48fc83[_0xf2ba('0x41')]===_0xf2ba('0x4f')){_0x1540f1[_0xf2ba('0x5b')]={'name':!_[_0xf2ba('0x1b')](_0x48fc83[_0xf2ba('0x5c')])?_0x48fc83[_0xf2ba('0x5c')]:!_[_0xf2ba('0x1b')](_0x48fc83[_0xf2ba('0x5d')])?_0x48fc83[_0xf2ba('0x5d')]+'\x20'+_0x48fc83[_0xf2ba('0x5e')]:_0x48fc83[_0xf2ba('0x5e')],'id':_0x48fc83['id']};}if(_0x48fc83[_0xf2ba('0x41')]===_0xf2ba('0x51')){_0x1540f1[_0xf2ba('0x5f')]={'name':!_[_0xf2ba('0x1b')](_0x48fc83[_0xf2ba('0x5c')])?_0x48fc83[_0xf2ba('0x5c')]:!_['isNil'](_0x48fc83[_0xf2ba('0x5d')])?_0x48fc83[_0xf2ba('0x5d')]+'\x20'+_0x48fc83[_0xf2ba('0x5e')]:_0x48fc83[_0xf2ba('0x5e')],'id':_0x48fc83['id']};_0x1540f1[_0xf2ba('0x60')]=_[_0xf2ba('0x43')](_0x48fc83[_0xf2ba('0x41')]);}if(_0x5b396e['talktime']){_0x1540f1['Call_Duration']=moment[_0xf2ba('0x61')](parseInt(_0x5b396e['talktime'])*0x3e8)['format'](_0xf2ba('0x62'));}else if(_0x5b396e[_0xf2ba('0x63')]&&_0x5b396e[_0xf2ba('0x64')]){_0x1540f1[_0xf2ba('0x65')]=moment['utc'](moment(_0x5b396e[_0xf2ba('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xf2ba('0x66')](moment(_0x5b396e[_0xf2ba('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0xf2ba('0x30')]('mm:ss');}switch(_0x5b396e[_0xf2ba('0x68')]){case _0xf2ba('0x69'):_0x1540f1[_0xf2ba('0x6a')]=_0xf2ba('0x6b');break;case _0xf2ba('0x6c'):case _0xf2ba('0x6d'):_0x1540f1[_0xf2ba('0x6a')]=_0xf2ba('0x6e');break;case _0xf2ba('0x6f'):_0x1540f1[_0xf2ba('0x6a')]=_0xf2ba('0x70');break;case _0xf2ba('0x71'):_0x1540f1[_0xf2ba('0x6a')]=_0xf2ba('0x72');break;case _0xf2ba('0x73'):_0x1540f1['Call_Result']=_0xf2ba('0x74');default:}_0x1540f1[_0xf2ba('0x75')]=(_0x2e79be===_0xf2ba('0x76')?moment(_0x5b396e[_0xf2ba('0x67')])[_0xf2ba('0x30')](_0xf2ba('0x77')):moment(_0x5b396e[_0xf2ba('0x78')])[_0xf2ba('0x30')](_0xf2ba('0x77')))||moment()[_0xf2ba('0x30')]('YYYY-MM-DDTHH:mm:ss');_0x1540f1[_0xf2ba('0x79')]=_0x2e79be||'Inbound';_0x1540f1=_[_0xf2ba('0x7a')](_0x1540f1,getCustomFields(_0x2c17b4[_0xf2ba('0x7b')],_0x5b396e));return request({'method':_0xf2ba('0x25'),'uri':_0xf2ba('0x52')+_0x453d4c+_0xf2ba('0x7c'),'headers':{'Authorization':_0xf2ba('0x33')+_0x401e77},'body':{'data':[_0x1540f1]},'json':!![]})['then'](function(_0x49bbe1){if(_0x49bbe1&&_0x49bbe1[_0xf2ba('0x40')][0x0][_0xf2ba('0x47')]===_0xf2ba('0x48')){logger[_0xf2ba('0x37')]('Call\x20created!');return{'id':_0x49bbe1[_0xf2ba('0x40')][0x0][_0xf2ba('0x49')]['id']};}})['catch'](function(_0x17bdc0){logger[_0xf2ba('0x37')](_0xf2ba('0x7d'),_0x17bdc0['stack']);console[_0xf2ba('0x4a')]('err',_0x17bdc0);});}exports[_0xf2ba('0x7e')]=function(_0x2e2e67,_0x1eddb4,_0x459059,_0x2a5c25,_0x2686fd,_0x1a959c){var _0x5e5821,_0x5bffed,_0x29eae;_0x1a959c[_0xf2ba('0x7f')]=intUtil['stripTrailingSlash'](_0x1a959c[_0xf2ba('0x7f')]);_0x1a959c[_0xf2ba('0x80')]=intUtil[_0xf2ba('0x81')](_0x1a959c['serverUrl']);if(_0x2686fd&&_0x2686fd[_0xf2ba('0x82')]){logger[_0xf2ba('0x37')](_0xf2ba('0x83'),'Recording\x20is\x20enabled!');_0x1eddb4[_0xf2ba('0x84')]=_0x1a959c[_0xf2ba('0x80')]+_0xf2ba('0x85')+_0x1eddb4[_0xf2ba('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x1eddb4[_0xf2ba('0x86')]);}else{_0x1eddb4['recordingURL']='';}var _0x163c6b=_0x1a959c[_0xf2ba('0x7f')]===_0xf2ba('0x87')?'eu':'com';return getAccessToken(_0x1a959c)['then'](function(_0x451e3f){_0x29eae=_0x451e3f;return getUser(_0x29eae,_0x163c6b,_0x1a959c,_0x2a5c25[_0xf2ba('0x36')]);})[_0xf2ba('0x29')](function(_0x1ba3e7){_0x5e5821=_0x1ba3e7;logger[_0xf2ba('0x37')](_0xf2ba('0x88'),_0x5e5821['id']);return getEndUser(_0x29eae,_0x163c6b,_0x1a959c,_0x1eddb4[_0xf2ba('0x89')],_0x1eddb4['calleridnum'],_0x5e5821,_0x459059);})[_0xf2ba('0x29')](function(_0x4e6435){_0x5bffed=_0x4e6435;return getCall(_0x29eae,_0x163c6b,_0x1a959c,_0x5e5821,_0x5bffed,_0x459059,_0x1eddb4,_0xf2ba('0x8a'));})[_0xf2ba('0x29')](function(_0x499461){if(_0x499461){logger[_0xf2ba('0x37')](_0xf2ba('0x8b'),_0x499461['id']);logger['info'](_0xf2ba('0x83'),_0xf2ba('0x8c'));emit(util[_0xf2ba('0x30')]('user:%s',_0x2a5c25['name']),_0xf2ba('0x8d'),{'uri':_0xf2ba('0x8e')+_0x1a959c['host']+_0xf2ba('0x8f')+_0x499461['id']});}})['catch'](function(_0x5d66c3){logger['error'](_0xf2ba('0x83'),JSON['stringify'](_0x5d66c3));});};exports[_0xf2ba('0x76')]=function(_0x154e58,_0x38ad43,_0x2a0798,_0x31e7f8,_0xd27e3d,_0x235925,_0x3e2f12){var _0x48ccca,_0x1b8536,_0x32ed31;_0x235925[_0xf2ba('0x7f')]=intUtil[_0xf2ba('0x81')](_0x235925['host']);_0x235925['serverUrl']=intUtil['stripTrailingSlash'](_0x235925[_0xf2ba('0x80')]);if(_0x3e2f12&&_0x3e2f12[_0xf2ba('0x90')]&&_0x3e2f12['recordingFormat']!==_0xf2ba('0x91')){logger[_0xf2ba('0x37')]('[OUTBOUND]',_0xf2ba('0x92'));_0x38ad43[_0xf2ba('0x84')]=_0x235925['serverUrl']+'/api/voice/recordings/'+_0x38ad43[_0xf2ba('0x86')]+_0xf2ba('0x93')+md5(_0x38ad43[_0xf2ba('0x86')]);}var _0x57da74=_0x235925[_0xf2ba('0x7f')]==='zoho.eu'?'eu':_0xf2ba('0x94');return getAccessToken(_0x235925)['then'](function(_0x11dfa6){_0x32ed31=_0x11dfa6;return getUser(_0x32ed31,_0x57da74,_0x235925,_0x31e7f8[_0xf2ba('0x36')]);})['then'](function(_0x29d28a){_0x48ccca=_0x29d28a;logger['info'](_0xf2ba('0x88'),_0x48ccca['id']);return getEndUser(_0x32ed31,_0x57da74,_0x235925,_0x38ad43[_0xf2ba('0x95')],_0x38ad43[_0xf2ba('0x96')],_0x48ccca,_0x2a0798);})['then'](function(_0xc15901){_0x1b8536=_0xc15901;return getCall(_0x32ed31,_0x57da74,_0x235925,_0x48ccca,_0x1b8536,_0x2a0798,_0x38ad43,_0xf2ba('0x97'));})['then'](function(_0x3bfa16){if(_0x3bfa16){logger[_0xf2ba('0x37')](_0xf2ba('0x8b'),_0x3bfa16['id']);logger[_0xf2ba('0x37')]('[OUTBOUND]',_0xf2ba('0x8c'));emit(util[_0xf2ba('0x30')](_0xf2ba('0x98'),_0x31e7f8['name']),'trigger:browser:url',{'uri':_0xf2ba('0x8e')+_0x235925[_0xf2ba('0x7f')]+_0xf2ba('0x8f')+_0x3bfa16['id']});}})[_0xf2ba('0x3f')](function(_0x1c297e){logger[_0xf2ba('0x2c')](_0xf2ba('0x99'),JSON[_0xf2ba('0xb')](_0x1c297e));});};exports[_0xf2ba('0x9a')]=function(_0x140328,_0x5eefb6,_0x1c7966,_0x16d74b,_0xcb153a,_0xd8efb3){var _0x1bf02e,_0x1dc68b,_0xcec04f;_0xd8efb3['host']=intUtil['stripTrailingSlash'](_0xd8efb3[_0xf2ba('0x7f')]);_0xd8efb3['serverUrl']=intUtil[_0xf2ba('0x81')](_0xd8efb3[_0xf2ba('0x80')]);if(_0xcb153a&&_0xcb153a[_0xf2ba('0x82')]){logger[_0xf2ba('0x37')]('['+_0x5eefb6[_0xf2ba('0x68')][_0xf2ba('0x9b')]()+']',_0xf2ba('0x92'));_0x5eefb6[_0xf2ba('0x84')]=_0xd8efb3[_0xf2ba('0x80')]+_0xf2ba('0x85')+_0x5eefb6[_0xf2ba('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x5eefb6[_0xf2ba('0x86')]);}else{_0x5eefb6[_0xf2ba('0x84')]='';}var _0xaec667=_0xd8efb3[_0xf2ba('0x7f')]===_0xf2ba('0x87')?'eu':_0xf2ba('0x94');return getAccessToken(_0xd8efb3)[_0xf2ba('0x29')](function(_0x1c19cf){_0xcec04f=_0x1c19cf;return getUser(_0xcec04f,_0xaec667,_0xd8efb3);})[_0xf2ba('0x29')](function(_0x528563){_0x1bf02e=_0x528563;logger[_0xf2ba('0x37')](_0xf2ba('0x88'),_0x1bf02e['id']);return getEndUser(_0xcec04f,_0xaec667,_0xd8efb3,_0x5eefb6[_0xf2ba('0x89')],_0x5eefb6[_0xf2ba('0x9c')],_0x1bf02e,_0x1c7966);})[_0xf2ba('0x29')](function(_0x38e9aa){_0x1dc68b=_0x38e9aa;return getCall(_0xcec04f,_0xaec667,_0xd8efb3,_0x1bf02e,_0x1dc68b,_0x1c7966,_0x5eefb6,_0xf2ba('0x8a'));})['then'](function(_0x36b353){if(_0x36b353){logger[_0xf2ba('0x37')]('The\x20Call\x20ID\x20is:',_0x36b353['id']);}})[_0xf2ba('0x3f')](function(_0x1cdb93){logger[_0xf2ba('0x2c')]('['+_0x5eefb6[_0xf2ba('0x68')][_0xf2ba('0x9b')]()+']',JSON[_0xf2ba('0xb')](_0x1cdb93));});}; \ 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 338c09a..bf7b239 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 _0x28ba=['../../../../config/logger','trigger','data2','Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','util','shelljs','mustache'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x28ba,0xb3));var _0xa28b=function(_0x5134fd,_0x491a63){_0x5134fd=_0x5134fd-0x0;var _0x5981cf=_0x28ba[_0x5134fd];return _0x5981cf;};'use strict';var util=require(_0xa28b('0x0'));var sh=require(_0xa28b('0x1'));var Mustache=require(_0xa28b('0x2'));var logger=require(_0xa28b('0x3'))(_0xa28b('0x4'));exports['exec']=function(_0x71e761,_0x1d34db){var _0x132af1=_0x71e761[_0xa28b('0x5')]?_0x71e761[_0xa28b('0x5')]:_0xa28b('0x6');var _0x527f48=_0x71e761[_0xa28b('0x7')]?Mustache[_0xa28b('0x8')](_0x71e761['data3'],_0x1d34db):_0x1d34db;sh['exec'](_0x527f48,function(_0x5b4c64,_0x270567,_0xca173c){if(_0x5b4c64!==0x0){logger[_0xa28b('0x9')](util['format'](_0xa28b('0xa'),_0x132af1,_0x527f48,_0x5b4c64,_0xca173c));}else{logger[_0xa28b('0xb')](util[_0xa28b('0xc')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x132af1,_0x527f48,_0x270567));}});}; \ No newline at end of file +var _0xcd83=['render','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','exec','data2','Script','data3'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd83,0x12e));var _0x3cd8=function(_0x42f921,_0x2c2415){_0x42f921=_0x42f921-0x0;var _0x20bb25=_0xcd83[_0x42f921];return _0x20bb25;};'use strict';var util=require(_0x3cd8('0x0'));var sh=require(_0x3cd8('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0x3cd8('0x2')]=function(_0xd30343,_0x4e9642){var _0x3cf005=_0xd30343[_0x3cd8('0x3')]?_0xd30343[_0x3cd8('0x3')]:_0x3cd8('0x4');var _0xbe7412=_0xd30343[_0x3cd8('0x5')]?Mustache[_0x3cd8('0x6')](_0xd30343[_0x3cd8('0x5')],_0x4e9642):_0x4e9642;sh[_0x3cd8('0x2')](_0xbe7412,function(_0xa9fe09,_0x38030f,_0x251df7){if(_0xa9fe09!==0x0){logger[_0x3cd8('0x7')](util[_0x3cd8('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x3cf005,_0xbe7412,_0xa9fe09,_0x251df7));}else{logger[_0x3cd8('0x9')](util[_0x3cd8('0x8')](_0x3cd8('0xa'),_0x3cf005,_0xbe7412,_0x38030f));}});}; \ 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 ca29d48..b03df5e 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 _0xe570=['render','data2','data5','number','headers','data6','parse','GET','DELETE','POST','data7','body','error','info','format','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','lodash','../../../../config/logger','trigger','data1','toUpperCase'];(function(_0x539dcb,_0x3c188f){var _0xc7987a=function(_0x534022){while(--_0x534022){_0x539dcb['push'](_0x539dcb['shift']());}};_0xc7987a(++_0x3c188f);}(_0xe570,0x1d6));var _0x0e57=function(_0x8efbff,_0x8be49e){_0x8efbff=_0x8efbff-0x0;var _0x1a9aef=_0xe570[_0x8efbff];return _0x1a9aef;};'use strict';var rp=require(_0x0e57('0x0'));var util=require('util');var _=require(_0x0e57('0x1'));var Mustache=require('mustache');var logger=require(_0x0e57('0x2'))(_0x0e57('0x3'));exports['exec']=function(_0xf38d0,_0x234bff){var _0x1561b7,_0x8502b;var _0x32b8ae={'method':_0xf38d0[_0x0e57('0x4')][_0x0e57('0x5')](),'uri':Mustache[_0x0e57('0x6')](_0xf38d0[_0x0e57('0x7')],_0x234bff),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xf38d0[_0x0e57('0x8')])===_0x0e57('0x9')&&parseInt(_0xf38d0[_0x0e57('0x8')])>=0x1&&parseInt(_0xf38d0[_0x0e57('0x8')])<=0xa?parseInt(_0xf38d0[_0x0e57('0x8')])*0x3e8:0x5*0x3e8};try{_0x32b8ae[_0x0e57('0xa')]=_0xf38d0[_0x0e57('0xb')]?JSON[_0x0e57('0xc')](Mustache[_0x0e57('0x6')](_0xf38d0[_0x0e57('0xb')],_0x234bff)):{};}catch(_0x45dbec){logger['error'](_0x45dbec['stack']);}switch(_0xf38d0[_0x0e57('0x4')]['toUpperCase']()){case _0x0e57('0xd'):case _0x0e57('0xe'):_0x1561b7=null;_0x32b8ae['qs']=_0x234bff;break;case _0x0e57('0xf'):case'PUT':if(_0xf38d0[_0x0e57('0x10')]){try{_0x1561b7=JSON[_0x0e57('0xc')](Mustache[_0x0e57('0x6')](_0xf38d0[_0x0e57('0x10')],_0x234bff));_0x32b8ae[_0x0e57('0x11')]=_0x1561b7;}catch(_0x315dbd){logger['error'](_0x315dbd['stack']);logger[_0x0e57('0x12')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x1561b7=_0x234bff;_0x32b8ae[_0x0e57('0x11')]=_0x1561b7;}break;}logger[_0x0e57('0x13')](util[_0x0e57('0x14')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0xf38d0[_0x0e57('0x4')],_0xf38d0[_0x0e57('0x7')],JSON['stringify'](_0x32b8ae)));rp(_0x32b8ae)[_0x0e57('0x15')](function(_0x264422){_0x1561b7=!_['isNil'](_0x1561b7)?_0x0e57('0x16')+_0x1561b7:'';_0x8502b=typeof _0x264422[_0x0e57('0x11')]===_0x0e57('0x17')?JSON['stringify'](_0x264422['body']):_0x264422[_0x0e57('0x11')];logger[_0x0e57('0x13')](util[_0x0e57('0x14')](_0x0e57('0x18'),_0xf38d0[_0x0e57('0x4')],_0xf38d0['data2'],_0x264422[_0x0e57('0x19')],_0x8502b));})['catch'](function(_0x3a6f39){logger[_0x0e57('0x12')](util[_0x0e57('0x14')](_0x0e57('0x1a'),_0xf38d0[_0x0e57('0x4')],_0xf38d0[_0x0e57('0x7')],_0x3a6f39[_0x0e57('0x19')],_0x3a6f39[_0x0e57('0x1b')],_0x3a6f39['message']));});}; \ No newline at end of file +var _0x6f3a=['format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','number','data6','error','stack','GET','DELETE','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f3a,0x192));var _0xa6f3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6f3a[_0x4565bf];return _0x5610ba;};'use strict';var rp=require(_0xa6f3('0x0'));var util=require(_0xa6f3('0x1'));var _=require(_0xa6f3('0x2'));var Mustache=require('mustache');var logger=require(_0xa6f3('0x3'))('trigger');exports[_0xa6f3('0x4')]=function(_0x555c05,_0x50a9a5){var _0x412a16,_0x478cb4;var _0xbe5d2e={'method':_0x555c05[_0xa6f3('0x5')][_0xa6f3('0x6')](),'uri':Mustache[_0xa6f3('0x7')](_0x555c05[_0xa6f3('0x8')],_0x50a9a5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x555c05[_0xa6f3('0x9')])===_0xa6f3('0xa')&&parseInt(_0x555c05[_0xa6f3('0x9')])>=0x1&&parseInt(_0x555c05['data5'])<=0xa?parseInt(_0x555c05[_0xa6f3('0x9')])*0x3e8:0x5*0x3e8};try{_0xbe5d2e['headers']=_0x555c05[_0xa6f3('0xb')]?JSON['parse'](Mustache[_0xa6f3('0x7')](_0x555c05[_0xa6f3('0xb')],_0x50a9a5)):{};}catch(_0x14ec1f){logger[_0xa6f3('0xc')](_0x14ec1f[_0xa6f3('0xd')]);}switch(_0x555c05[_0xa6f3('0x5')][_0xa6f3('0x6')]()){case _0xa6f3('0xe'):case _0xa6f3('0xf'):_0x412a16=null;_0xbe5d2e['qs']=_0x50a9a5;break;case _0xa6f3('0x10'):case'PUT':if(_0x555c05[_0xa6f3('0x11')]){try{_0x412a16=JSON[_0xa6f3('0x12')](Mustache[_0xa6f3('0x7')](_0x555c05[_0xa6f3('0x11')],_0x50a9a5));_0xbe5d2e[_0xa6f3('0x13')]=_0x412a16;}catch(_0xd67671){logger[_0xa6f3('0xc')](_0xd67671[_0xa6f3('0xd')]);logger[_0xa6f3('0xc')](_0xa6f3('0x14'));}}else{_0x412a16=_0x50a9a5;_0xbe5d2e[_0xa6f3('0x13')]=_0x412a16;}break;}logger[_0xa6f3('0x15')](util['format'](_0xa6f3('0x16'),_0x555c05[_0xa6f3('0x5')],_0x555c05[_0xa6f3('0x8')],JSON[_0xa6f3('0x17')](_0xbe5d2e)));rp(_0xbe5d2e)[_0xa6f3('0x18')](function(_0x3a9a11){_0x412a16=!_[_0xa6f3('0x19')](_0x412a16)?_0xa6f3('0x1a')+_0x412a16:'';_0x478cb4=typeof _0x3a9a11[_0xa6f3('0x13')]==='object'?JSON[_0xa6f3('0x17')](_0x3a9a11[_0xa6f3('0x13')]):_0x3a9a11[_0xa6f3('0x13')];logger['info'](util[_0xa6f3('0x1b')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x555c05[_0xa6f3('0x5')],_0x555c05[_0xa6f3('0x8')],_0x3a9a11[_0xa6f3('0x1c')],_0x478cb4));})[_0xa6f3('0x1d')](function(_0x17c6a6){logger['error'](util[_0xa6f3('0x1b')](_0xa6f3('0x1e'),_0x555c05[_0xa6f3('0x5')],_0x555c05[_0xa6f3('0x8')],_0x17c6a6['statusCode'],_0x17c6a6[_0xa6f3('0x1f')],_0x17c6a6[_0xa6f3('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c29a164..25bbefb 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 _0x73a8=['debug','rpc','error','routing','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','request','then'];(function(_0x3fea78,_0x2a1ee1){var _0x3d818d=function(_0x2a93bf){while(--_0x2a93bf){_0x3fea78['push'](_0x3fea78['shift']());}};_0x3d818d(++_0x2a1ee1);}(_0x73a8,0xf6));var _0x873a=function(_0x9dae95,_0x18843d){_0x9dae95=_0x9dae95-0x0;var _0x19b7c6=_0x73a8[_0x9dae95];return _0x19b7c6;};'use strict';var jayson=require(_0x873a('0x0'));var BPromise=require(_0x873a('0x1'));var logger=require(_0x873a('0x2'))('routing');var client=jayson[_0x873a('0x3')]['http']({'port':0x2329});client['Request']=function(_0x1d9312,_0x5ec768){return new BPromise(function(_0xf51117,_0x2a895a){return client[_0x873a('0x4')](_0x1d9312,_0x5ec768)[_0x873a('0x5')](function(_0x4de86f){logger[_0x873a('0x6')](_0x873a('0x7'),'routing',_0x1d9312,_0x5ec768,_0x4de86f);if(_0x4de86f[_0x873a('0x8')]){logger[_0x873a('0x8')](_0x873a('0x7'),_0x873a('0x9'),_0x1d9312,_0x4de86f[_0x873a('0x8')][_0x873a('0xa')],_0x5ec768);return _0x2a895a(_0x4de86f[_0x873a('0x8')][_0x873a('0xa')]);}else{return _0xf51117(_0x4de86f[_0x873a('0xb')]);}})[_0x873a('0xc')](function(_0x4d8411){logger[_0x873a('0x8')](_0x873a('0x7'),_0x873a('0x9'),_0x1d9312,_0x4d8411,_0x5ec768);return _0x2a895a(_0x4d8411);});});};module[_0x873a('0xd')]=client; \ No newline at end of file +var _0xa520=['result','catch','exports','jayson/promise','routing','client','http','Request','debug','error','rpc','message'];(function(_0x5e9831,_0x36eda4){var _0x511bd0=function(_0x108c20){while(--_0x108c20){_0x5e9831['push'](_0x5e9831['shift']());}};_0x511bd0(++_0x36eda4);}(_0xa520,0x15f));var _0x0a52=function(_0x1846f2,_0x353922){_0x1846f2=_0x1846f2-0x0;var _0x3f2021=_0xa520[_0x1846f2];return _0x3f2021;};'use strict';var jayson=require(_0x0a52('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x0a52('0x1'));var client=jayson[_0x0a52('0x2')][_0x0a52('0x3')]({'port':0x2329});client[_0x0a52('0x4')]=function(_0x258e0e,_0x239613){return new BPromise(function(_0x5f12c9,_0xb349e5){return client['request'](_0x258e0e,_0x239613)['then'](function(_0x402174){logger[_0x0a52('0x5')]('rpc',_0x0a52('0x1'),_0x258e0e,_0x239613,_0x402174);if(_0x402174[_0x0a52('0x6')]){logger[_0x0a52('0x6')](_0x0a52('0x7'),_0x0a52('0x1'),_0x258e0e,_0x402174[_0x0a52('0x6')][_0x0a52('0x8')],_0x239613);return _0xb349e5(_0x402174['error'][_0x0a52('0x8')]);}else{return _0x5f12c9(_0x402174[_0x0a52('0x9')]);}})[_0x0a52('0xa')](function(_0x56a3f5){logger[_0x0a52('0x6')]('rpc',_0x0a52('0x1'),_0x258e0e,_0x56a3f5,_0x239613);return _0xb349e5(_0x56a3f5);});});};module[_0x0a52('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 680ab5e..9c989b0 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 _0x4b16=['./rpc/mailAccount','./rpc/setting','email','resolve','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x53b862,_0x36d23e){var _0x183468=function(_0x4957b5){while(--_0x4957b5){_0x53b862['push'](_0x53b862['shift']());}};_0x183468(++_0x36d23e);}(_0x4b16,0xa3));var _0x64b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b16[_0x14add3];return _0x4a174f;};'use strict';var server=require(_0x64b1('0x0'));var Realtime=require(_0x64b1('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x64b1('0x2'));var setting=require(_0x64b1('0x3'));var logger=require('../../config/logger')(_0x64b1('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x64b1('0x5')]()[_0x64b1('0x6')](mailAccount[_0x64b1('0x7')]())['then'](realtime['initMailAccounts']())['then'](function(){email[_0x64b1('0x8')](realtime[_0x64b1('0x9')]);return realtime;});}function main(){return server[_0x64b1('0xa')](realtime,email)[_0x64b1('0x6')](function(){return initRealtime();})[_0x64b1('0x6')](function(){return setting[_0x64b1('0xb')]();})['then'](function(_0x259cbd){return setInterval(initRealtime,_0x259cbd[_0x64b1('0xc')]*0x3e8);})['catch'](function(_0x5a2a32){logger[_0x64b1('0xd')](_0x64b1('0xe'),_0x5a2a32);});}main(); \ No newline at end of file +var _0xe08e=['then','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve'];(function(_0x58968d,_0x34b991){var _0x9c949f=function(_0x37e66b){while(--_0x37e66b){_0x58968d['push'](_0x58968d['shift']());}};_0x9c949f(++_0x34b991);}(_0xe08e,0x1ac));var _0xee08=function(_0x56123b,_0x111c41){_0x56123b=_0x56123b-0x0;var _0x234b51=_0xe08e[_0x56123b];return _0x234b51;};'use strict';var server=require(_0xee08('0x0'));var Realtime=require(_0xee08('0x1'));var EmailChannel=require(_0xee08('0x2'));var mailAccount=require(_0xee08('0x3'));var setting=require('./rpc/setting');var logger=require(_0xee08('0x4'))(_0xee08('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xee08('0x6')]()[_0xee08('0x7')](mailAccount['getMailAccounts']())[_0xee08('0x7')](realtime[_0xee08('0x8')]())['then'](function(){email['refresh'](realtime[_0xee08('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xee08('0x7')](function(){return initRealtime();})[_0xee08('0x7')](function(){return setting[_0xee08('0xa')]();})[_0xee08('0x7')](function(_0x39d9f8){return setInterval(initRealtime,_0x39d9f8[_0xee08('0xb')]*0x3e8);})[_0xee08('0xc')](function(_0x2468b3){logger[_0xee08('0xd')](_0xee08('0xe'),_0x2468b3);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 67a3660..75ba470 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 _0x4ec8=['firstName','lastName','from','lastSync','sendMail','send','Smtp','then','catch','verify','exports','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','custom','provider','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0x174902,_0x5f25b8){var _0x4b9e31=function(_0x2e0b58){while(--_0x2e0b58){_0x174902['push'](_0x174902['shift']());}};_0x4b9e31(++_0x5f25b8);}(_0x4ec8,0x1df));var _0x84ec=function(_0x15c8bf,_0x3f3c50){_0x15c8bf=_0x15c8bf-0x0;var _0x72f98c=_0x4ec8[_0x15c8bf];return _0x72f98c;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x84ec('0x0'));var md5=require(_0x84ec('0x1'));var Redis=require(_0x84ec('0x2'));var config=require('../../../config/environment');var logger=require(_0x84ec('0x3'))(_0x84ec('0x4'));config[_0x84ec('0x5')]=_[_0x84ec('0x6')](config[_0x84ec('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x84ec('0x7'))(new Redis(config[_0x84ec('0x5')]));var EmailImap=require(_0x84ec('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x22d23c){logger[_0x84ec('0x9')](_0x84ec('0xa'));this[_0x84ec('0xb')]=_0x22d23c['mailAccounts'];this[_0x84ec('0xc')]={};this[_0x84ec('0xd')]=new EmailSmtp();}EmailChannel[_0x84ec('0xe')][_0x84ec('0xf')]=function(_0x347d9e){var _0x16dddb=this['mailAccounts'][_0x347d9e];var _0x2a6911={'id':_0x16dddb['id'],'name':_0x16dddb[_0x84ec('0x10')],'key':_0x16dddb[_0x84ec('0x11')],'active':_0x16dddb[_0x84ec('0x12')],'Imap':{'status':_0x16dddb[_0x84ec('0x13')][_0x84ec('0x14')],'messageStatus':_0x16dddb['Imap'][_0x84ec('0x15')],'total':_0x16dddb[_0x84ec('0x13')][_0x84ec('0x16')]}};if(_[_0x84ec('0x17')](md5Accounts[_0x347d9e])){md5Accounts[_0x347d9e]={};}var _0x1d1aee=md5(JSON[_0x84ec('0x18')](_0x2a6911));if(md5Accounts[_0x347d9e]['md5']!==_0x1d1aee){md5Accounts[_0x347d9e][_0x84ec('0x1')]=_0x1d1aee;io[_0x84ec('0xf')](_0x84ec('0x19'),_0x2a6911);}};EmailChannel['prototype'][_0x84ec('0x1a')]=function(_0x18c6cc){for(var _0x299a84 in _0x18c6cc){if(_0x18c6cc['hasOwnProperty'](_0x299a84)){if(_0x18c6cc[_0x299a84]['Imap']&&_0x18c6cc[_0x299a84][_0x84ec('0x12')]){var _0x106e5f=_0x18c6cc[_0x299a84][_0x84ec('0x13')];if(!_0x106e5f['service']&&_0x18c6cc[_0x299a84]['provider']!==_0x84ec('0x1b'))_0x106e5f['service']=_0x18c6cc[_0x299a84][_0x84ec('0x1c')];if(!this[_0x84ec('0xc')][_0x84ec('0x1d')](_0x106e5f['id'])){this['imapAccounts'][_0x106e5f['id']]=new EmailImap(_0x106e5f,_0x18c6cc[_0x299a84][_0x84ec('0x4')]);this[_0x84ec('0xc')][_0x106e5f['id']]['on'](_0x84ec('0x1e'),this['handleImapBox'][_0x84ec('0x1f')](this,_0x299a84));this[_0x84ec('0xc')][_0x106e5f['id']]['on'](_0x84ec('0x4'),this[_0x84ec('0x20')]['bind'](this,_0x299a84));this[_0x84ec('0xc')][_0x106e5f['id']]['on'](_0x84ec('0x21'),this[_0x84ec('0x22')][_0x84ec('0x1f')](this,_0x299a84));this[_0x84ec('0xc')][_0x106e5f['id']]['on'](_0x84ec('0x23'),this[_0x84ec('0x24')]['bind'](this,_0x299a84));}}else{if(_[_0x84ec('0x17')](this['mailAccounts'][_0x299a84][_0x84ec('0x13')])){this['mailAccounts'][_0x299a84][_0x84ec('0x13')]={};}this[_0x84ec('0xb')][_0x299a84][_0x84ec('0x13')][_0x84ec('0x14')]=_0x84ec('0x25');this[_0x84ec('0xb')][_0x299a84][_0x84ec('0x13')][_0x84ec('0x15')]='';this[_0x84ec('0xf')](_0x299a84);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x37b5ba,_0x42f905){if(this[_0x84ec('0xb')][_0x37b5ba]){this[_0x84ec('0xb')][_0x37b5ba][_0x84ec('0x13')][_0x84ec('0x14')]=_0x84ec('0x26');this[_0x84ec('0xb')][_0x37b5ba][_0x84ec('0x13')][_0x84ec('0x15')]=_0x42f905[_0x84ec('0x10')];if(_0x42f905[_0x84ec('0x27')]){this[_0x84ec('0xb')][_0x37b5ba][_0x84ec('0x13')][_0x84ec('0x16')]=_0x42f905[_0x84ec('0x27')][_0x84ec('0x16')];}return this[_0x84ec('0xf')](_0x37b5ba);}};EmailChannel[_0x84ec('0xe')]['handleImapEmail']=function(_0x2d7eeb,_0xffb46c){logger[_0x84ec('0x9')](_0x84ec('0x28'),_0xffb46c[_0x84ec('0x29')],_0xffb46c[_0x84ec('0x2a')],_0xffb46c[_0x84ec('0x2b')],_0x2d7eeb);if(this[_0x84ec('0xb')][_0x2d7eeb]){return mailAccount['notify'](_0x2d7eeb,_0xffb46c)['then'](function(_0x27cf35){if(_0x27cf35){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x4e91fc){logger[_0x84ec('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x84ec('0x18')](_0x4e91fc));});}};EmailChannel[_0x84ec('0xe')][_0x84ec('0x22')]=function(_0x304090){if(this[_0x84ec('0xb')][_0x304090]&&this[_0x84ec('0xb')][_0x304090][_0x84ec('0x13')]){if(this[_0x84ec('0xc')][this[_0x84ec('0xb')][_0x304090][_0x84ec('0x13')]['id']]){delete this[_0x84ec('0xc')][this['mailAccounts'][_0x304090]['Imap']['id']];}this['mailAccounts'][_0x304090][_0x84ec('0x13')][_0x84ec('0x2c')]=moment();this[_0x84ec('0xf')](_0x304090);}};EmailChannel[_0x84ec('0xe')][_0x84ec('0x24')]=function(_0x5d91a6,_0x379c6c){if(this[_0x84ec('0xb')][_0x5d91a6]){this[_0x84ec('0xb')][_0x5d91a6]['Imap'][_0x84ec('0x14')]=_0x84ec('0x23');this[_0x84ec('0xb')][_0x5d91a6][_0x84ec('0x13')][_0x84ec('0x15')]=_0x379c6c;return this[_0x84ec('0xf')](_0x5d91a6);}};EmailChannel[_0x84ec('0xe')][_0x84ec('0x2d')]=function(_0x516565,_0x54702b){return this[_0x84ec('0xd')][_0x84ec('0x2e')](_0x516565,_0x54702b);};EmailChannel['prototype']['verifySmtp']=function(_0x535ddc){var _0x47b9e7=this;if(this['mailAccounts'][_0x535ddc['id']]){if(_[_0x84ec('0x17')](this[_0x84ec('0xb')][_0x535ddc['id']][_0x84ec('0x2f')])){this[_0x84ec('0xb')][_0x535ddc['id']][_0x84ec('0x2f')]={};}this['mailAccounts'][_0x535ddc['id']][_0x84ec('0x2f')][_0x84ec('0x2c')]=moment();return new BPromise(function(_0x1fd701,_0x558a5d){return _0x47b9e7[_0x84ec('0xd')]['verify'](_0x535ddc)[_0x84ec('0x30')](function(_0x1a81df){_0x47b9e7['mailAccounts'][_0x535ddc['id']][_0x84ec('0x2f')][_0x84ec('0x14')]='verified';_0x47b9e7['mailAccounts'][_0x535ddc['id']]['Smtp'][_0x84ec('0x15')]='';_0x47b9e7[_0x84ec('0xf')](_0x535ddc['id']);_0x1fd701(_0x1a81df);})[_0x84ec('0x31')](function(_0x35cf62){_0x47b9e7[_0x84ec('0xb')][_0x535ddc['id']][_0x84ec('0x2f')]['status']='error';_0x47b9e7[_0x84ec('0xb')][_0x535ddc['id']][_0x84ec('0x2f')][_0x84ec('0x15')]=_0x35cf62;_0x47b9e7[_0x84ec('0xf')](_0x535ddc['id']);_0x558a5d(_0x35cf62);});});}return this['smtp'][_0x84ec('0x32')](_0x535ddc);};module[_0x84ec('0x33')]=EmailChannel; \ No newline at end of file +var _0xdd6e=['./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','key','status','Imap','messageStatus','total','isNil','md5','mailAccount:update','refresh','hasOwnProperty','active','service','provider','custom','box','bind','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','lastSync','verify','then','catch','lodash','moment','bluebird','../../../config/environment','../../../config/logger','email','defaults','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd6e,0x110));var _0xedd6=function(_0xe9a765,_0xecf779){_0xe9a765=_0xe9a765-0x0;var _0x3efaa5=_0xdd6e[_0xe9a765];return _0x3efaa5;};'use strict';var _=require(_0xedd6('0x0'));var moment=require(_0xedd6('0x1'));var BPromise=require(_0xedd6('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xedd6('0x3'));var logger=require(_0xedd6('0x4'))(_0xedd6('0x5'));config['redis']=_[_0xedd6('0x6')](config[_0xedd6('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xedd6('0x8'));var EmailSmtp=require(_0xedd6('0x9'));var mailAccount=require(_0xedd6('0xa'));var md5Accounts={};function EmailChannel(_0x3d90bc){logger[_0xedd6('0xb')]('start\x20email\x20channel');this[_0xedd6('0xc')]=_0x3d90bc[_0xedd6('0xc')];this[_0xedd6('0xd')]={};this[_0xedd6('0xe')]=new EmailSmtp();}EmailChannel[_0xedd6('0xf')][_0xedd6('0x10')]=function(_0x103069){var _0x1118e7=this[_0xedd6('0xc')][_0x103069];var _0x4210db={'id':_0x1118e7['id'],'name':_0x1118e7['name'],'key':_0x1118e7[_0xedd6('0x11')],'active':_0x1118e7['active'],'Imap':{'status':_0x1118e7['Imap'][_0xedd6('0x12')],'messageStatus':_0x1118e7[_0xedd6('0x13')][_0xedd6('0x14')],'total':_0x1118e7[_0xedd6('0x13')][_0xedd6('0x15')]}};if(_[_0xedd6('0x16')](md5Accounts[_0x103069])){md5Accounts[_0x103069]={};}var _0x247f14=md5(JSON['stringify'](_0x4210db));if(md5Accounts[_0x103069]['md5']!==_0x247f14){md5Accounts[_0x103069][_0xedd6('0x17')]=_0x247f14;io['emit'](_0xedd6('0x18'),_0x4210db);}};EmailChannel['prototype'][_0xedd6('0x19')]=function(_0x4cfaf5){for(var _0x4c72a7 in _0x4cfaf5){if(_0x4cfaf5[_0xedd6('0x1a')](_0x4c72a7)){if(_0x4cfaf5[_0x4c72a7]['Imap']&&_0x4cfaf5[_0x4c72a7][_0xedd6('0x1b')]){var _0x480c5d=_0x4cfaf5[_0x4c72a7][_0xedd6('0x13')];if(!_0x480c5d[_0xedd6('0x1c')]&&_0x4cfaf5[_0x4c72a7][_0xedd6('0x1d')]!==_0xedd6('0x1e'))_0x480c5d[_0xedd6('0x1c')]=_0x4cfaf5[_0x4c72a7][_0xedd6('0x1d')];if(!this['imapAccounts'][_0xedd6('0x1a')](_0x480c5d['id'])){this['imapAccounts'][_0x480c5d['id']]=new EmailImap(_0x480c5d,_0x4cfaf5[_0x4c72a7]['email']);this['imapAccounts'][_0x480c5d['id']]['on'](_0xedd6('0x1f'),this['handleImapBox'][_0xedd6('0x20')](this,_0x4c72a7));this[_0xedd6('0xd')][_0x480c5d['id']]['on'](_0xedd6('0x5'),this['handleImapEmail'][_0xedd6('0x20')](this,_0x4c72a7));this['imapAccounts'][_0x480c5d['id']]['on'](_0xedd6('0x21'),this[_0xedd6('0x22')][_0xedd6('0x20')](this,_0x4c72a7));this[_0xedd6('0xd')][_0x480c5d['id']]['on'](_0xedd6('0x23'),this[_0xedd6('0x24')][_0xedd6('0x20')](this,_0x4c72a7));}}else{if(_[_0xedd6('0x16')](this[_0xedd6('0xc')][_0x4c72a7]['Imap'])){this[_0xedd6('0xc')][_0x4c72a7]['Imap']={};}this[_0xedd6('0xc')][_0x4c72a7][_0xedd6('0x13')][_0xedd6('0x12')]=_0xedd6('0x25');this['mailAccounts'][_0x4c72a7][_0xedd6('0x13')][_0xedd6('0x14')]='';this['emit'](_0x4c72a7);}}}};EmailChannel['prototype'][_0xedd6('0x26')]=function(_0x4b6810,_0x4f3abb){if(this[_0xedd6('0xc')][_0x4b6810]){this['mailAccounts'][_0x4b6810][_0xedd6('0x13')]['status']=_0xedd6('0x27');this[_0xedd6('0xc')][_0x4b6810][_0xedd6('0x13')]['messageStatus']=_0x4f3abb[_0xedd6('0x28')];if(_0x4f3abb['messages']){this[_0xedd6('0xc')][_0x4b6810]['Imap'][_0xedd6('0x15')]=_0x4f3abb[_0xedd6('0x29')]['total'];}return this[_0xedd6('0x10')](_0x4b6810);}};EmailChannel[_0xedd6('0xf')]['handleImapEmail']=function(_0x8c8c0b,_0x47eb3a){logger['info'](_0xedd6('0x2a'),_0x47eb3a[_0xedd6('0x2b')],_0x47eb3a[_0xedd6('0x2c')],_0x47eb3a['from'],_0x8c8c0b);if(this[_0xedd6('0xc')][_0x8c8c0b]){return mailAccount[_0xedd6('0x2d')](_0x8c8c0b,_0x47eb3a)['then'](function(_0x3e2dac){if(_0x3e2dac){logger[_0xedd6('0xb')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x1c3c61){logger['error'](_0xedd6('0x2e'),JSON[_0xedd6('0x2f')](_0x1c3c61));});}};EmailChannel['prototype'][_0xedd6('0x22')]=function(_0x2377fa){if(this['mailAccounts'][_0x2377fa]&&this[_0xedd6('0xc')][_0x2377fa]['Imap']){if(this[_0xedd6('0xd')][this[_0xedd6('0xc')][_0x2377fa][_0xedd6('0x13')]['id']]){delete this[_0xedd6('0xd')][this[_0xedd6('0xc')][_0x2377fa]['Imap']['id']];}this['mailAccounts'][_0x2377fa][_0xedd6('0x13')]['lastSync']=moment();this[_0xedd6('0x10')](_0x2377fa);}};EmailChannel[_0xedd6('0xf')]['handleImapError']=function(_0x2aa689,_0xea0592){if(this[_0xedd6('0xc')][_0x2aa689]){this[_0xedd6('0xc')][_0x2aa689][_0xedd6('0x13')]['status']=_0xedd6('0x23');this['mailAccounts'][_0x2aa689][_0xedd6('0x13')][_0xedd6('0x14')]=_0xea0592;return this[_0xedd6('0x10')](_0x2aa689);}};EmailChannel[_0xedd6('0xf')][_0xedd6('0x30')]=function(_0x3c9732,_0x3ecc0e){return this[_0xedd6('0xe')][_0xedd6('0x31')](_0x3c9732,_0x3ecc0e);};EmailChannel[_0xedd6('0xf')][_0xedd6('0x32')]=function(_0x60bf20){var _0x534a09=this;if(this['mailAccounts'][_0x60bf20['id']]){if(_[_0xedd6('0x16')](this[_0xedd6('0xc')][_0x60bf20['id']]['Smtp'])){this[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')]={};}this[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')][_0xedd6('0x34')]=moment();return new BPromise(function(_0xd44121,_0x44b470){return _0x534a09[_0xedd6('0xe')][_0xedd6('0x35')](_0x60bf20)[_0xedd6('0x36')](function(_0x200fde){_0x534a09[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')][_0xedd6('0x12')]='verified';_0x534a09[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')]['messageStatus']='';_0x534a09[_0xedd6('0x10')](_0x60bf20['id']);_0xd44121(_0x200fde);})[_0xedd6('0x37')](function(_0x1d5d51){_0x534a09[_0xedd6('0xc')][_0x60bf20['id']]['Smtp'][_0xedd6('0x12')]=_0xedd6('0x23');_0x534a09[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')]['messageStatus']=_0x1d5d51;_0x534a09[_0xedd6('0x10')](_0x60bf20['id']);_0x44b470(_0x1d5d51);});});}return this[_0xedd6('0xe')][_0xedd6('0x35')](_0x60bf20);};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 5d3930e..150a969 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 _0x3e24=['handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','account','stringify','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','once','handleReady','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen'];(function(_0x509f3f,_0x14bdc5){var _0x59a37e=function(_0x287463){while(--_0x287463){_0x509f3f['push'](_0x509f3f['shift']());}};_0x59a37e(++_0x14bdc5);}(_0x3e24,0x167));var _0x43e2=function(_0x53dc8a,_0x35549d){_0x53dc8a=_0x53dc8a-0x0;var _0x145ca7=_0x3e24[_0x53dc8a];return _0x145ca7;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var Imap=require(_0x43e2('0x2'));var simpleParser=require(_0x43e2('0x3'))[_0x43e2('0x4')];var Iconv=require('iconv')[_0x43e2('0x5')];var EventEmitter=require(_0x43e2('0x6'))['EventEmitter'];var utils=require(_0x43e2('0x7'));var logger=require(_0x43e2('0x8'))(_0x43e2('0x9'));function EmailImap(_0x28b144,_0x43b5a7){this[_0x43e2('0xa')]=_0x43e2('0xb');this['account']=this[_0x43e2('0xc')](_0x28b144,_0x43b5a7);this[_0x43e2('0x2')]=new Imap(this['account']);this[_0x43e2('0x2')][_0x43e2('0xd')]('ready',this[_0x43e2('0xe')][_0x43e2('0xf')](this));this['imap'][_0x43e2('0xd')]('end',this['handleEnd']['bind'](this));this[_0x43e2('0x2')]['on'](_0x43e2('0x10'),this[_0x43e2('0x11')][_0x43e2('0xf')](this));this[_0x43e2('0x2')][_0x43e2('0x12')]();}util[_0x43e2('0x13')](EmailImap,EventEmitter);EmailImap[_0x43e2('0x14')][_0x43e2('0xc')]=function(_0x218ae7,_0x377097){var _0x3ccccd={'connTimeout':_0x218ae7['connTimeout']?_0x218ae7[_0x43e2('0x15')]*0x3e8:0x2710,'authTimeout':_0x218ae7[_0x43e2('0x16')]?_0x218ae7[_0x43e2('0x16')]*0x3e8:0x1388};if(_0x218ae7[_0x43e2('0x17')]){_0x3ccccd['user']=_0x218ae7['user'];_0x3ccccd[_0x43e2('0x9')]=_0x377097||_0x218ae7[_0x43e2('0x18')]||_0x43e2('0x19');if(_0x218ae7[_0x43e2('0x1a')]){_0x3ccccd[_0x43e2('0x1b')]=utils[_0x43e2('0x1c')](_0x218ae7[_0x43e2('0x1d')][_0x43e2('0x1e')],_0x218ae7[_0x43e2('0x18')]);}else{_0x3ccccd[_0x43e2('0x1f')]=_0x218ae7['password'];}}else{if(_0x218ae7[_0x43e2('0x20')]){_0x3ccccd[_0x43e2('0x18')]=_0x218ae7['user'];_0x3ccccd[_0x43e2('0x1f')]=_0x218ae7['password'];}}_0x3ccccd[_0x43e2('0x21')]=_0x218ae7[_0x43e2('0x21')];_0x3ccccd[_0x43e2('0x22')]=_0x218ae7[_0x43e2('0x22')]||0x3e1;if(_0x218ae7[_0x43e2('0x23')]){_0x3ccccd['tls']=!![];}else{_0x3ccccd[_0x43e2('0x23')]=![];_0x3ccccd[_0x43e2('0x24')]=_0x43e2('0x25');}return _0x3ccccd;};EmailImap['prototype'][_0x43e2('0xe')]=function(){this[_0x43e2('0x2')][_0x43e2('0x26')](this[_0x43e2('0xa')],![],this['handleOpenBox'][_0x43e2('0xf')](this));};EmailImap[_0x43e2('0x14')][_0x43e2('0x27')]=function(_0x3b7b22,_0x178223){if(_0x3b7b22){this[_0x43e2('0x11')](_0x3b7b22,!![]);}else{this[_0x43e2('0x28')](_0x43e2('0x29'),_0x178223);this[_0x43e2('0x2a')]();}};EmailImap[_0x43e2('0x14')][_0x43e2('0x2b')]=function(_0x1de7e1){if(_0x1de7e1){this['handleError'](_0x1de7e1,!![]);}else{this[_0x43e2('0x2')][_0x43e2('0x2c')]();}};EmailImap['prototype'][_0x43e2('0x2a')]=function(){this[_0x43e2('0x2')][_0x43e2('0x2d')]([_0x43e2('0x2e')],this[_0x43e2('0x2f')]['bind'](this));};EmailImap[_0x43e2('0x14')][_0x43e2('0x2f')]=function(_0x1779f9,_0x3d8e16){if(_0x1779f9){this[_0x43e2('0x11')](_0x1779f9,!![]);}else{if(_0x3d8e16[_0x43e2('0x30')]){try{var _0x53f797=this['imap'][_0x43e2('0x31')](_0x3d8e16,{'bodies':'','markSeen':!![]});_0x53f797['on'](_0x43e2('0x32'),this[_0x43e2('0x33')][_0x43e2('0xf')](this));_0x53f797[_0x43e2('0xd')]('error',this[_0x43e2('0x34')][_0x43e2('0xf')](this));_0x53f797[_0x43e2('0xd')](_0x43e2('0x2c'),this[_0x43e2('0x35')][_0x43e2('0xf')](this));}catch(_0x2fcdd4){logger['error'](_0x2fcdd4);}}else{this['imap'][_0x43e2('0x36')](!![],this[_0x43e2('0x2b')]['bind'](this));}}};EmailImap[_0x43e2('0x14')][_0x43e2('0x33')]=function(_0x4e79ed){_0x4e79ed['on'](_0x43e2('0x37'),this['handleMessageBody']['bind'](this));_0x4e79ed['once'](_0x43e2('0x38'),this['handleMessageAttributes'][_0x43e2('0xf')](this));_0x4e79ed[_0x43e2('0xd')](_0x43e2('0x2c'),this[_0x43e2('0x39')][_0x43e2('0xf')](this));};EmailImap[_0x43e2('0x14')][_0x43e2('0x3a')]=function(_0x13be86){simpleParser(_0x13be86,{'Iconv':Iconv},this[_0x43e2('0x3b')][_0x43e2('0xf')](this));};EmailImap[_0x43e2('0x14')][_0x43e2('0x3c')]=function(){};EmailImap[_0x43e2('0x14')][_0x43e2('0x39')]=function(){};EmailImap[_0x43e2('0x14')][_0x43e2('0x3b')]=function(_0x16fac0,_0x47f74c){if(_0x16fac0){logger['error'](_0x16fac0);}else{var _0x4c3f7d=this;utils[_0x43e2('0x3d')](this[_0x43e2('0x3e')],_0x47f74c,function(_0x490f4d){_0x4c3f7d['emit'](_0x43e2('0x9'),_0x490f4d);});}};EmailImap[_0x43e2('0x14')][_0x43e2('0x35')]=function(){this[_0x43e2('0x2')][_0x43e2('0x36')](!![],this[_0x43e2('0x2b')][_0x43e2('0xf')](this));};EmailImap[_0x43e2('0x14')][_0x43e2('0x34')]=function(_0x39bf87){this[_0x43e2('0x11')](_0x39bf87);this[_0x43e2('0x2')][_0x43e2('0x36')](!![],this[_0x43e2('0x2b')]['bind'](this));};EmailImap[_0x43e2('0x14')]['handleEnd']=function(){this[_0x43e2('0x28')]('end');};EmailImap[_0x43e2('0x14')][_0x43e2('0x11')]=function(_0x273323,_0x4918bc){logger[_0x43e2('0x10')]('handleError',this[_0x43e2('0x3e')][_0x43e2('0x9')],JSON[_0x43e2('0x3f')](_0x273323));var _0x169a61='';if(_0x273323){if(_0x273323['textCode']){_0x169a61=_0x273323['textCode'];}else{for(var _0x95b22f in _0x273323){if(_0x273323[_0x43e2('0x40')](_0x95b22f)){_0x169a61+=_[_0x43e2('0x41')](_0x95b22f)+':\x20'+_0x273323[_0x95b22f]+'\x0a';}}}}if(_0x4918bc){this[_0x43e2('0x2')]['end']();}else{this[_0x43e2('0x28')](_0x43e2('0x10'),_0x169a61);this[_0x43e2('0x28')](_0x43e2('0x2c'));}};module[_0x43e2('0x42')]=EmailImap; \ No newline at end of file +var _0xb934=['service','user','modernAuthentication','xoauth2','data5','password','authentication','host','autotls','openBox','handleOpenBox','emit','readUnseen','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleFetchEnd','stringify','hasOwnProperty','upperFirst','lodash','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb934,0x92));var _0x4b93=function(_0x4a5c95,_0x1f4f83){_0x4a5c95=_0x4a5c95-0x0;var _0xeb6e95=_0xb934[_0x4a5c95];return _0xeb6e95;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var Imap=require(_0x4b93('0x2'));var simpleParser=require('mailparser')[_0x4b93('0x3')];var Iconv=require(_0x4b93('0x4'))[_0x4b93('0x5')];var EventEmitter=require(_0x4b93('0x6'))[_0x4b93('0x7')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x4b93('0x8'));function EmailImap(_0x1fa8af,_0x2ea5ad){this[_0x4b93('0x9')]='INBOX';this[_0x4b93('0xa')]=this[_0x4b93('0xb')](_0x1fa8af,_0x2ea5ad);this[_0x4b93('0x2')]=new Imap(this[_0x4b93('0xa')]);this[_0x4b93('0x2')][_0x4b93('0xc')](_0x4b93('0xd'),this[_0x4b93('0xe')][_0x4b93('0xf')](this));this['imap'][_0x4b93('0xc')](_0x4b93('0x10'),this[_0x4b93('0x11')][_0x4b93('0xf')](this));this[_0x4b93('0x2')]['on'](_0x4b93('0x12'),this[_0x4b93('0x13')][_0x4b93('0xf')](this));this[_0x4b93('0x2')][_0x4b93('0x14')]();}util[_0x4b93('0x15')](EmailImap,EventEmitter);EmailImap[_0x4b93('0x16')][_0x4b93('0xb')]=function(_0x3f4db7,_0x11dd47){var _0x4f7c7a={'connTimeout':_0x3f4db7[_0x4b93('0x17')]?_0x3f4db7[_0x4b93('0x17')]*0x3e8:0x2710,'authTimeout':_0x3f4db7[_0x4b93('0x18')]?_0x3f4db7['authTimeout']*0x3e8:0x1388};if(_0x3f4db7[_0x4b93('0x19')]){_0x4f7c7a[_0x4b93('0x1a')]=_0x3f4db7[_0x4b93('0x1a')];_0x4f7c7a[_0x4b93('0x8')]=_0x11dd47||_0x3f4db7[_0x4b93('0x1a')]||'anonymous@xcally.com';if(_0x3f4db7[_0x4b93('0x1b')]){_0x4f7c7a[_0x4b93('0x1c')]=utils['generateXOAuth2Token'](_0x3f4db7['CloudProvider'][_0x4b93('0x1d')],_0x3f4db7[_0x4b93('0x1a')]);}else{_0x4f7c7a[_0x4b93('0x1e')]=_0x3f4db7[_0x4b93('0x1e')];}}else{if(_0x3f4db7[_0x4b93('0x1f')]){_0x4f7c7a[_0x4b93('0x1a')]=_0x3f4db7[_0x4b93('0x1a')];_0x4f7c7a[_0x4b93('0x1e')]=_0x3f4db7[_0x4b93('0x1e')];}}_0x4f7c7a[_0x4b93('0x20')]=_0x3f4db7[_0x4b93('0x20')];_0x4f7c7a['port']=_0x3f4db7['port']||0x3e1;if(_0x3f4db7['tls']){_0x4f7c7a['tls']=!![];}else{_0x4f7c7a['tls']=![];_0x4f7c7a[_0x4b93('0x21')]='required';}return _0x4f7c7a;};EmailImap[_0x4b93('0x16')][_0x4b93('0xe')]=function(){this[_0x4b93('0x2')][_0x4b93('0x22')](this[_0x4b93('0x9')],![],this[_0x4b93('0x23')][_0x4b93('0xf')](this));};EmailImap[_0x4b93('0x16')]['handleOpenBox']=function(_0x5691ba,_0x1a74eb){if(_0x5691ba){this['handleError'](_0x5691ba,!![]);}else{this[_0x4b93('0x24')]('box',_0x1a74eb);this[_0x4b93('0x25')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x302b93){if(_0x302b93){this[_0x4b93('0x13')](_0x302b93,!![]);}else{this[_0x4b93('0x2')][_0x4b93('0x10')]();}};EmailImap[_0x4b93('0x16')][_0x4b93('0x25')]=function(){this[_0x4b93('0x2')][_0x4b93('0x26')](['UNSEEN'],this[_0x4b93('0x27')][_0x4b93('0xf')](this));};EmailImap[_0x4b93('0x16')]['handleReadUnseen']=function(_0x418371,_0x5f3ab3){if(_0x418371){this['handleError'](_0x418371,!![]);}else{if(_0x5f3ab3[_0x4b93('0x28')]){try{var _0x2fb254=this[_0x4b93('0x2')][_0x4b93('0x29')](_0x5f3ab3,{'bodies':'','markSeen':!![]});_0x2fb254['on'](_0x4b93('0x2a'),this[_0x4b93('0x2b')][_0x4b93('0xf')](this));_0x2fb254[_0x4b93('0xc')](_0x4b93('0x12'),this[_0x4b93('0x2c')]['bind'](this));_0x2fb254[_0x4b93('0xc')]('end',this['handleFetchEnd'][_0x4b93('0xf')](this));}catch(_0x278bdb){logger[_0x4b93('0x12')](_0x278bdb);}}else{this[_0x4b93('0x2')][_0x4b93('0x2d')](!![],this[_0x4b93('0x2e')][_0x4b93('0xf')](this));}}};EmailImap[_0x4b93('0x16')]['handleFetchMessage']=function(_0x34d8d8){_0x34d8d8['on'](_0x4b93('0x2f'),this['handleMessageBody']['bind'](this));_0x34d8d8[_0x4b93('0xc')](_0x4b93('0x30'),this[_0x4b93('0x31')][_0x4b93('0xf')](this));_0x34d8d8[_0x4b93('0xc')]('end',this[_0x4b93('0x32')][_0x4b93('0xf')](this));};EmailImap[_0x4b93('0x16')][_0x4b93('0x33')]=function(_0xef2db3){simpleParser(_0xef2db3,{'Iconv':Iconv},this[_0x4b93('0x34')]['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x4b93('0x32')]=function(){};EmailImap[_0x4b93('0x16')]['handleSimpleParser']=function(_0x365dca,_0x3c22bc){if(_0x365dca){logger[_0x4b93('0x12')](_0x365dca);}else{var _0x349295=this;utils['parser'](this[_0x4b93('0xa')],_0x3c22bc,function(_0x3bcea4){_0x349295['emit'](_0x4b93('0x8'),_0x3bcea4);});}};EmailImap['prototype'][_0x4b93('0x35')]=function(){this['imap']['closeBox'](!![],this[_0x4b93('0x2e')][_0x4b93('0xf')](this));};EmailImap['prototype']['handleFetchError']=function(_0x33eea9){this[_0x4b93('0x13')](_0x33eea9);this[_0x4b93('0x2')][_0x4b93('0x2d')](!![],this[_0x4b93('0x2e')][_0x4b93('0xf')](this));};EmailImap[_0x4b93('0x16')][_0x4b93('0x11')]=function(){this['emit'](_0x4b93('0x10'));};EmailImap['prototype'][_0x4b93('0x13')]=function(_0x5c4cfe,_0x3b5257){logger[_0x4b93('0x12')](_0x4b93('0x13'),this['account'][_0x4b93('0x8')],JSON[_0x4b93('0x36')](_0x5c4cfe));var _0x5f5604='';if(_0x5c4cfe){if(_0x5c4cfe['textCode']){_0x5f5604=_0x5c4cfe['textCode'];}else{for(var _0x48491d in _0x5c4cfe){if(_0x5c4cfe[_0x4b93('0x37')](_0x48491d)){_0x5f5604+=_[_0x4b93('0x38')](_0x48491d)+':\x20'+_0x5c4cfe[_0x48491d]+'\x0a';}}}}if(_0x3b5257){this[_0x4b93('0x2')][_0x4b93('0x10')]();}else{this['emit']('error',_0x5f5604);this[_0x4b93('0x24')](_0x4b93('0x10'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0d6a907..6af6c7d 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 _0x2746=['nodemailer-plugin-inline-base64','prototype','use','sendMail','toString','verify','exports'];(function(_0x5c9d64,_0xc138de){var _0x12eb80=function(_0x338e22){while(--_0x338e22){_0x5c9d64['push'](_0x5c9d64['shift']());}};_0x12eb80(++_0xc138de);}(_0x2746,0x12d));var _0x6274=function(_0x132379,_0x21ed53){_0x132379=_0x132379-0x0;var _0x3bd030=_0x2746[_0x132379];return _0x3bd030;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x6274('0x0'));function EmailSmtp(){}EmailSmtp[_0x6274('0x1')]['send']=function(_0x591166,_0x465b30){return new Promise(function(_0x1bf4d2,_0x26179c){var _0x3d41c1=nodemailer['createTransport'](_0x591166);_0x3d41c1[_0x6274('0x2')]('compile',inlineBase64());_0x3d41c1[_0x6274('0x3')](_0x465b30,function(_0x2f4e3f,_0x3afac2){if(_0x2f4e3f){_0x26179c(_0x2f4e3f[_0x6274('0x4')]());}else{_0x1bf4d2(_0x3afac2);}});});};EmailSmtp['prototype'][_0x6274('0x5')]=function(_0x2f15d4){return new Promise(function(_0x4b613f,_0x9fb7d7){var _0x1538ec=nodemailer['createTransport'](_0x2f15d4);_0x1538ec[_0x6274('0x5')](function(_0x2f6cc2,_0xb77b91){if(_0x2f6cc2){_0x9fb7d7(_0x2f6cc2['toString']());}else{if(_0xb77b91){_0x4b613f(_0xb77b91);}else{_0x9fb7d7('Not\x20verifired');}}});});};module[_0x6274('0x6')]=EmailSmtp; \ No newline at end of file +var _0xcfa6=['send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0xa296fb,_0x56a9ae){var _0x5a0910=function(_0x73f4f0){while(--_0x73f4f0){_0xa296fb['push'](_0xa296fb['shift']());}};_0x5a0910(++_0x56a9ae);}(_0xcfa6,0x6b));var _0x6cfa=function(_0x9a87df,_0x216aa4){_0x9a87df=_0x9a87df-0x0;var _0x4f64b4=_0xcfa6[_0x9a87df];return _0x4f64b4;};'use strict';var nodemailer=require(_0x6cfa('0x0'));var inlineBase64=require(_0x6cfa('0x1'));function EmailSmtp(){}EmailSmtp[_0x6cfa('0x2')][_0x6cfa('0x3')]=function(_0xe7bce7,_0x361984){return new Promise(function(_0x2173bc,_0x1d2a18){var _0x1f4ac5=nodemailer[_0x6cfa('0x4')](_0xe7bce7);_0x1f4ac5['use'](_0x6cfa('0x5'),inlineBase64());_0x1f4ac5[_0x6cfa('0x6')](_0x361984,function(_0x5b840b,_0x2f0992){if(_0x5b840b){_0x1d2a18(_0x5b840b[_0x6cfa('0x7')]());}else{_0x2173bc(_0x2f0992);}});});};EmailSmtp[_0x6cfa('0x2')][_0x6cfa('0x8')]=function(_0x8500bf){return new Promise(function(_0x3bfb53,_0x28a4b5){var _0x4df0e7=nodemailer[_0x6cfa('0x4')](_0x8500bf);_0x4df0e7['verify'](function(_0x36ce55,_0x2ea809){if(_0x36ce55){_0x28a4b5(_0x36ce55[_0x6cfa('0x7')]());}else{if(_0x2ea809){_0x3bfb53(_0x2ea809);}else{_0x28a4b5(_0x6cfa('0x9'));}}});});};module[_0x6cfa('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 74d8edf..3099371 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 _0x1be0=['html','test','includes','attachments','forEach','push','replace','_SRC','_IMG','\x20[Attachment:\x20','\x20]','textAsHtml','body','message','originTo','originCc','email','bcc','attach','type','attachment-','format','%s-%s','now','root','server/files/attachments/','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','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','first','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty'];(function(_0x311e77,_0x49a459){var _0x559c54=function(_0x283a97){while(--_0x283a97){_0x311e77['push'](_0x311e77['shift']());}};_0x559c54(++_0x49a459);}(_0x1be0,0x121));var _0x01be=function(_0x2d51da,_0x35d5da){_0x2d51da=_0x2d51da-0x0;var _0x3137a3=_0x1be0[_0x2d51da];return _0x3137a3;};'use strict';var _=require(_0x01be('0x0'));var moment=require(_0x01be('0x1'));var random=require(_0x01be('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x01be('0x3'));var tnef=require(_0x01be('0x4'));var logger=require(_0x01be('0x5'))('email');var config=require(_0x01be('0x6'));function getAddress(_0x37570c){var _0xe23691=_[_0x01be('0x7')](_0x37570c[_0x01be('0x8')]);return _0xe23691&&_0xe23691['address']?_0xe23691[_0x01be('0x9')]:_0x01be('0xa')+random[_0x01be('0xb')](0x6)+_0x01be('0xc');}function getFirstName(_0x423d9e){var _0xae19dd=_['head'](_0x423d9e[_0x01be('0x8')]);if(_0xae19dd&&_0xae19dd[_0x01be('0xd')]){if(_0xae19dd['name']==_0xae19dd[_0x01be('0x9')]){return _0xae19dd[_0x01be('0xd')][_0x01be('0xe')](0x0,_0xae19dd[_0x01be('0xd')][_0x01be('0xf')]('@'));}var _0x54e08a=_0xae19dd['name'][_0x01be('0x10')](/\s+/);return _0x54e08a[_0x01be('0x11')]>0x1?_0x54e08a[_0x01be('0x12')](0x0,-0x1)[_0x01be('0x13')]('\x20'):_0xae19dd[_0x01be('0xd')];}return _0x01be('0x14');}function getLastName(_0x17ce17){var _0x2f32ab=_[_0x01be('0x7')](_0x17ce17[_0x01be('0x8')]);if(_0x2f32ab&&_0x2f32ab[_0x01be('0xd')]){var _0x1eb6c8=_0x2f32ab[_0x01be('0xd')][_0x01be('0x10')](/\s+/);return _0x1eb6c8[_0x01be('0x11')]>0x1?_0x1eb6c8[_0x01be('0x15')]():'';}return'';}function getMails(_0x3eb6eb,_0x5d9a60){var _0xa71b58='';for(var _0x24fd81=0x0;_0x24fd81<_0x5d9a60['value']['length'];_0x24fd81+=0x1){if(_0x5d9a60[_0x01be('0x8')][_0x24fd81]['address']!==_0x3eb6eb){if(!_[_0x01be('0x16')](_0xa71b58)){_0xa71b58+=',';}_0xa71b58+=_0x5d9a60[_0x01be('0x8')][_0x24fd81][_0x01be('0xd')]||_0x5d9a60[_0x01be('0x8')][_0x24fd81]['address']||'';_0xa71b58+='\x20<';_0xa71b58+=_0x5d9a60['value'][_0x24fd81][_0x01be('0x9')]?_0x5d9a60[_0x01be('0x8')][_0x24fd81][_0x01be('0x9')]:_0x01be('0xa')+random['generate'](0x6)+_0x01be('0xc');_0xa71b58+='>';}}return _0xa71b58;}function parseEmail(_0x8ba4fd,_0xcf4fe3,_0x2855bd){if(_0xcf4fe3[_0x01be('0x17')]){var _0x5b1f56=/)<[^<]*)*<\/script>/gi;while(_0x5b1f56[_0x01be('0x18')](_0xcf4fe3['html'])){_0xcf4fe3[_0x01be('0x17')]=_0xcf4fe3['html']['replace'](_0x5b1f56,'');}if(_0xcf4fe3[_0x01be('0x17')][_0x01be('0x19')]('{_0x34e064[_0x01be('0x1c')](_0x4e299e['filename']);});var _0x3db4ed=/]+>/g;var _0x43b570=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x35c0da=_0xcf4fe3[_0x01be('0x17')][_0x01be('0x1d')](_0x43b570,_0x01be('0x1e'));var _0x2bd878=_0x35c0da[_0x01be('0x1d')](_0x3db4ed,_0x01be('0x1f'));for(let _0x23f689=0x0;_0x23f689<_0x34e064['length'];_0x23f689++){var _0x5d8ce6=_0x2bd878[_0x01be('0x1d')](_0x01be('0x1f'),_0x01be('0x20')+_0x34e064[_0x23f689]+_0x01be('0x21'));_0x2bd878=_0x5d8ce6;}_0xcf4fe3[_0x01be('0x17')]=_0x2bd878;}_0x2855bd['body']=_0xcf4fe3['html'];}else{_0x2855bd['body']=_0xcf4fe3[_0x01be('0x22')];}if(_0x2855bd[_0x01be('0x23')]){_0x2855bd['body']=_0x2855bd[_0x01be('0x23')][_0x01be('0x1d')](/0x0){var _0x4a6f15=['Auto-Submitted:\x20auto-replied',_0x01be('0x34'),_0x01be('0x35')];for(var _0x5e325d=0x0;_0x5e325d<_0xcf4fe3[_0x01be('0x33')][_0x01be('0x11')];_0x5e325d++){var _0x4cd6ab=_['indexOf'](_0x4a6f15,_0xcf4fe3[_0x01be('0x33')][_0x5e325d][_0x01be('0x36')]);if(_0x4cd6ab>=0x0){_0x2855bd[_0x01be('0x37')]=!![];}}}return _0x2855bd;}exports[_0x01be('0x38')]=function(_0x20ea0f,_0x308ea0,_0x227569){var _0x244532={'from':getAddress(_0x308ea0['from']),'firstName':getFirstName(_0x308ea0[_0x01be('0x39')]),'lastName':getLastName(_0x308ea0[_0x01be('0x39')]),'mapKey':_0x01be('0x27'),'message':{'from':getMails(_0x20ea0f['email'],_0x308ea0['from']),'to':_0x20ea0f[_0x01be('0x27')],'cc':'','subject':_0x308ea0[_0x01be('0x3a')]||'','messageId':_0x308ea0[_0x01be('0x3b')],'inReplyTo':_0x308ea0[_0x01be('0x3c')],'sentAt':moment(_0x308ea0[_0x01be('0x3d')])[_0x01be('0x2c')](_0x01be('0x3e')),'attach':![],'attachments':[]}};if(!_0x308ea0[_0x01be('0x17')]&&!_0x308ea0['textAsHtml']){var _0x1b5584=_[_0x01be('0x3f')](_0x308ea0[_0x01be('0x1a')],{'contentType':_0x01be('0x40')});if(_0x1b5584[_0x01be('0x11')]){logger[_0x01be('0x41')](util[_0x01be('0x2c')](_0x01be('0x42'),_0x308ea0[_0x01be('0x3b')]));tnef['parseBuffer'](_[_0x01be('0x43')](_0x1b5584)['content'],function(_0x281768,_0x216fe3){if(_0x216fe3){_0x308ea0[_0x01be('0x17')]=_0x216fe3['BodyHTML']||_0x01be('0x44');if(_0x216fe3[_0x01be('0x45')]){for(var _0x561317=0x0;_0x561317<_0x216fe3[_0x01be('0x45')][_0x01be('0x11')];_0x561317++){var _0x2e3d54=_0x216fe3['Attachments'][_0x561317];_0x244532[_0x01be('0x24')]['attachments'][_0x01be('0x1c')]({'filename':_0x2e3d54[_0x01be('0x46')],'content':Buffer[_0x01be('0x39')](_0x2e3d54[_0x01be('0x47')])});}}}_0x227569(parseEmail(_0x20ea0f,_0x308ea0,_0x244532));});}else{_0x308ea0['html']=_0x01be('0x44');_0x227569(parseEmail(_0x20ea0f,_0x308ea0,_0x244532));}}else{_0x227569(parseEmail(_0x20ea0f,_0x308ea0,_0x244532));}};exports[_0x01be('0x48')]=function(_0x5ccab8,_0x5ad9ca){var _0x36d7cf=[_0x01be('0x49')+(_0x5ad9ca||''),_0x01be('0x4a')+_0x5ccab8,'',''];return Buffer[_0x01be('0x39')](_0x36d7cf['join'](''),_0x01be('0x4b'))[_0x01be('0x4c')](_0x01be('0x4d'));}; \ No newline at end of file +var _0xf617=['%s-%s','now','join','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','email','head','value','address','generate','@xcally.com','name','indexOf','split','length','slice','Anonymous','pop','isEmpty','test','html','includes','','body','0x1?_0x134705[_0x7f61('0x10')](0x0,-0x1)['join']('\x20'):_0x2c8bbc[_0x7f61('0xc')];}return _0x7f61('0x11');}function getLastName(_0x20d89d){var _0x2d6b27=_[_0x7f61('0x7')](_0x20d89d[_0x7f61('0x8')]);if(_0x2d6b27&&_0x2d6b27[_0x7f61('0xc')]){var _0x1726c8=_0x2d6b27[_0x7f61('0xc')][_0x7f61('0xe')](/\s+/);return _0x1726c8[_0x7f61('0xf')]>0x1?_0x1726c8[_0x7f61('0x12')]():'';}return'';}function getMails(_0x691007,_0x35cf22){var _0x5305e9='';for(var _0x415efa=0x0;_0x415efa<_0x35cf22[_0x7f61('0x8')][_0x7f61('0xf')];_0x415efa+=0x1){if(_0x35cf22['value'][_0x415efa][_0x7f61('0x9')]!==_0x691007){if(!_[_0x7f61('0x13')](_0x5305e9)){_0x5305e9+=',';}_0x5305e9+=_0x35cf22[_0x7f61('0x8')][_0x415efa][_0x7f61('0xc')]||_0x35cf22[_0x7f61('0x8')][_0x415efa]['address']||'';_0x5305e9+='\x20<';_0x5305e9+=_0x35cf22[_0x7f61('0x8')][_0x415efa][_0x7f61('0x9')]?_0x35cf22[_0x7f61('0x8')][_0x415efa][_0x7f61('0x9')]:'anonymous'+random['generate'](0x6)+_0x7f61('0xb');_0x5305e9+='>';}}return _0x5305e9;}function parseEmail(_0x589dfb,_0x407ae7,_0x5ac38a){if(_0x407ae7['html']){var _0x50e745=/)<[^<]*)*<\/script>/gi;while(_0x50e745[_0x7f61('0x14')](_0x407ae7['html'])){_0x407ae7[_0x7f61('0x15')]=_0x407ae7[_0x7f61('0x15')]['replace'](_0x50e745,'');}if(_0x407ae7[_0x7f61('0x15')][_0x7f61('0x16')](_0x7f61('0x17'))){var _0xddc4ec=[];_0x407ae7[_0x7f61('0x18')][_0x7f61('0x19')](_0x123dd7=>{_0xddc4ec[_0x7f61('0x1a')](_0x123dd7[_0x7f61('0x1b')]);});var _0x2175b1=/]+>/g;var _0x4651e7=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x45dcb2=_0x407ae7[_0x7f61('0x15')][_0x7f61('0x1c')](_0x4651e7,_0x7f61('0x1d'));var _0x5db072=_0x45dcb2[_0x7f61('0x1c')](_0x2175b1,_0x7f61('0x1e'));for(let _0x340479=0x0;_0x340479<_0xddc4ec[_0x7f61('0xf')];_0x340479++){var _0xd838f8=_0x5db072[_0x7f61('0x1c')](_0x7f61('0x1e'),'\x20[Attachment:\x20'+_0xddc4ec[_0x340479]+_0x7f61('0x1f'));_0x5db072=_0xd838f8;}_0x407ae7['html']=_0x5db072;}_0x5ac38a['body']=_0x407ae7[_0x7f61('0x15')];}else{_0x5ac38a['body']=_0x407ae7['textAsHtml'];}if(_0x5ac38a[_0x7f61('0x20')]){_0x5ac38a['body']=_0x5ac38a[_0x7f61('0x20')][_0x7f61('0x1c')](/0x0){var _0x5f3bc5=[_0x7f61('0x33'),_0x7f61('0x34'),_0x7f61('0x35')];for(var _0x14d3bc=0x0;_0x14d3bc<_0x407ae7[_0x7f61('0x32')][_0x7f61('0xf')];_0x14d3bc++){var _0x45f03c=_[_0x7f61('0xd')](_0x5f3bc5,_0x407ae7[_0x7f61('0x32')][_0x14d3bc][_0x7f61('0x36')]);if(_0x45f03c>=0x0){_0x5ac38a[_0x7f61('0x37')]=!![];}}}return _0x5ac38a;}exports[_0x7f61('0x38')]=function(_0x45ad6a,_0x53a2ed,_0x312320){var _0x5fdf5={'from':getAddress(_0x53a2ed[_0x7f61('0x39')]),'firstName':getFirstName(_0x53a2ed[_0x7f61('0x39')]),'lastName':getLastName(_0x53a2ed[_0x7f61('0x39')]),'mapKey':_0x7f61('0x6'),'message':{'from':getMails(_0x45ad6a[_0x7f61('0x6')],_0x53a2ed[_0x7f61('0x39')]),'to':_0x45ad6a[_0x7f61('0x6')],'cc':'','subject':_0x53a2ed[_0x7f61('0x3a')]||'','messageId':_0x53a2ed['messageId'],'inReplyTo':_0x53a2ed['inReplyTo'],'sentAt':moment(_0x53a2ed[_0x7f61('0x3b')])[_0x7f61('0x29')](_0x7f61('0x3c')),'attach':![],'attachments':[]}};if(!_0x53a2ed['html']&&!_0x53a2ed[_0x7f61('0x3d')]){var _0x42ee1e=_[_0x7f61('0x3e')](_0x53a2ed['attachments'],{'contentType':_0x7f61('0x3f')});if(_0x42ee1e['length']){logger[_0x7f61('0x40')](util[_0x7f61('0x29')](_0x7f61('0x41'),_0x53a2ed[_0x7f61('0x42')]));tnef[_0x7f61('0x43')](_[_0x7f61('0x44')](_0x42ee1e)[_0x7f61('0x30')],function(_0x146d56,_0x523a3f){if(_0x523a3f){_0x53a2ed[_0x7f61('0x15')]=_0x523a3f[_0x7f61('0x45')]||_0x7f61('0x46');if(_0x523a3f[_0x7f61('0x47')]){for(var _0x3d4bfa=0x0;_0x3d4bfa<_0x523a3f[_0x7f61('0x47')][_0x7f61('0xf')];_0x3d4bfa++){var _0x4d938b=_0x523a3f[_0x7f61('0x47')][_0x3d4bfa];_0x5fdf5[_0x7f61('0x22')][_0x7f61('0x18')][_0x7f61('0x1a')]({'filename':_0x4d938b[_0x7f61('0x48')],'content':Buffer[_0x7f61('0x39')](_0x4d938b[_0x7f61('0x49')])});}}}_0x312320(parseEmail(_0x45ad6a,_0x53a2ed,_0x5fdf5));});}else{_0x53a2ed[_0x7f61('0x15')]='

Empty\x20message

';_0x312320(parseEmail(_0x45ad6a,_0x53a2ed,_0x5fdf5));}}else{_0x312320(parseEmail(_0x45ad6a,_0x53a2ed,_0x5fdf5));}};exports['generateXOAuth2Token']=function(_0x2937b3,_0x19f6f7){var _0x322b7e=[_0x7f61('0x4a')+(_0x19f6f7||''),_0x7f61('0x4b')+_0x2937b3,'',''];return Buffer['from'](_0x322b7e[_0x7f61('0x2c')](''),_0x7f61('0x4c'))[_0x7f61('0x4d')](_0x7f61('0x4e'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e5166f4..aa48f81 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 _0x979f=['key','active','Imap','Smtp','lodash','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x979f,0x178));var _0xf979=function(_0xf1d8f2,_0x42e56f){_0xf1d8f2=_0xf1d8f2-0x0;var _0x207931=_0x979f[_0xf1d8f2];return _0x207931;};'use strict';var _=require(_0xf979('0x0'));function MailAccount(_0x2b9b8f){this['id']=_0x2b9b8f['id']||0x0;this[_0xf979('0x1')]=_0x2b9b8f[_0xf979('0x1')]||'Service';this[_0xf979('0x2')]=_0x2b9b8f[_0xf979('0x2')]||'SERV';this[_0xf979('0x3')]=_0x2b9b8f['active']||![];this[_0xf979('0x4')]=_0x2b9b8f[_0xf979('0x4')]||[];this[_0xf979('0x5')]=_0x2b9b8f[_0xf979('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x2417=['lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x33405d,_0xd340e9){var _0x58dc50=function(_0x5e4c8a){while(--_0x5e4c8a){_0x33405d['push'](_0x33405d['shift']());}};_0x58dc50(++_0xd340e9);}(_0x2417,0x128));var _0x7241=function(_0x560623,_0x5c748a){_0x560623=_0x560623-0x0;var _0x2a9089=_0x2417[_0x560623];return _0x2a9089;};'use strict';var _=require(_0x7241('0x0'));function MailAccount(_0x283583){this['id']=_0x283583['id']||0x0;this[_0x7241('0x1')]=_0x283583['name']||_0x7241('0x2');this[_0x7241('0x3')]=_0x283583[_0x7241('0x3')]||_0x7241('0x4');this[_0x7241('0x5')]=_0x283583[_0x7241('0x5')]||![];this['Imap']=_0x283583[_0x7241('0x6')]||[];this[_0x7241('0x7')]=_0x283583[_0x7241('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 78864ef..81daafc 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 _0xb776=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','lodash','../model/mailAccount'];(function(_0x4e5cd6,_0x3f0a14){var _0x3a86db=function(_0x2ccfb3){while(--_0x2ccfb3){_0x4e5cd6['push'](_0x4e5cd6['shift']());}};_0x3a86db(++_0x3f0a14);}(_0xb776,0x13d));var _0x6b77=function(_0x691206,_0x4c9726){_0x691206=_0x691206-0x0;var _0x4bffb4=_0xb776[_0x691206];return _0x4bffb4;};'use strict';var _=require(_0x6b77('0x0'));var MailAccount=require(_0x6b77('0x1'));var Realtime=function(){this[_0x6b77('0x2')]={};};function freeIsNotKey(_0x44d794,_0x201e9d,_0x412f0f){var _0x457864=_[_0x6b77('0x3')](_0x44d794,function(_0x2846fb,_0x31836a){return _0x2846fb[_0x412f0f];});for(var _0x62c10f in _0x201e9d){if(_0x201e9d[_0x6b77('0x4')](_0x62c10f)){if(!_0x457864[_0x62c10f]){delete _0x201e9d[_0x62c10f];}}}}Realtime[_0x6b77('0x5')][_0x6b77('0x6')]=function(_0x29068f,_0x472c6b){for(var _0x51cc83 in _0x472c6b){if(_0x29068f['hasOwnProperty'](_0x51cc83)){_0x29068f[_0x51cc83]=_0x472c6b[_0x51cc83];}}};Realtime[_0x6b77('0x5')][_0x6b77('0x7')]=function(){var _0x304cfb=this;return function(_0x47e584){if(_0x47e584){freeIsNotKey(_0x47e584,_0x304cfb['mailAccounts'],'id');for(var _0x4cb1d9=0x0,_0x403913={},_0x56457f={};_0x4cb1d9<_0x47e584[_0x6b77('0x8')];_0x4cb1d9+=0x1){_0x403913=_0x47e584[_0x4cb1d9];if(_[_0x6b77('0x9')](_0x304cfb[_0x6b77('0x2')][_0x403913['id']])){_0x304cfb[_0x6b77('0x2')][_0x403913['id']]=new MailAccount(_0x403913);}else{_[_0x6b77('0xa')](_0x304cfb[_0x6b77('0x2')][_0x403913['id']],_0x403913);}}}return _0x304cfb[_0x6b77('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0xa311=['lodash','../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','isUndefined','exports'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0xa311,0x1b8));var _0x1a31=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xa311[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x1a31('0x0'));var MailAccount=require(_0x1a31('0x1'));var Realtime=function(){this[_0x1a31('0x2')]={};};function freeIsNotKey(_0x448aeb,_0xcff495,_0x392936){var _0x19df25=_['mapKeys'](_0x448aeb,function(_0x4fa68f,_0x1e1159){return _0x4fa68f[_0x392936];});for(var _0x455d0d in _0xcff495){if(_0xcff495[_0x1a31('0x3')](_0x455d0d)){if(!_0x19df25[_0x455d0d]){delete _0xcff495[_0x455d0d];}}}}Realtime['prototype'][_0x1a31('0x4')]=function(_0x1b23a0,_0x2d7f6a){for(var _0x19982d in _0x2d7f6a){if(_0x1b23a0['hasOwnProperty'](_0x19982d)){_0x1b23a0[_0x19982d]=_0x2d7f6a[_0x19982d];}}};Realtime[_0x1a31('0x5')][_0x1a31('0x6')]=function(){var _0x56ce2c=this;return function(_0x5b6913){if(_0x5b6913){freeIsNotKey(_0x5b6913,_0x56ce2c[_0x1a31('0x2')],'id');for(var _0x4c3c62=0x0,_0x3580d2={},_0x1a4c6d={};_0x4c3c62<_0x5b6913[_0x1a31('0x7')];_0x4c3c62+=0x1){_0x3580d2=_0x5b6913[_0x4c3c62];if(_[_0x1a31('0x8')](_0x56ce2c[_0x1a31('0x2')][_0x3580d2['id']])){_0x56ce2c[_0x1a31('0x2')][_0x3580d2['id']]=new MailAccount(_0x3580d2);}else{_['merge'](_0x56ce2c[_0x1a31('0x2')][_0x3580d2['id']],_0x3580d2);}}}return _0x56ce2c[_0x1a31('0x2')];};};module[_0x1a31('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 53c8cdb..1895045 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 _0x3144=['getMailAccounts','Request','GetMailAccount','provider','service','email','active','ListId','TemplateId','MailServerIn','Imap','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount'];(function(_0x7ff255,_0x262c6a){var _0x2c99e4=function(_0x5b2b06){while(--_0x5b2b06){_0x7ff255['push'](_0x7ff255['shift']());}};_0x2c99e4(++_0x262c6a);}(_0x3144,0x17c));var _0x4314=function(_0x42f493,_0x5d99e9){_0x42f493=_0x42f493-0x0;var _0x4aee00=_0x3144[_0x42f493];return _0x4aee00;};'use strict';var client=require('../client');exports[_0x4314('0x0')]=function(){return function(){return client[_0x4314('0x1')](_0x4314('0x2'),{'options':{'attributes':['id','name',_0x4314('0x3'),_0x4314('0x4'),_0x4314('0x5'),_0x4314('0x6'),'key',_0x4314('0x7'),_0x4314('0x8')],'raw':![],'include':[{'model':_0x4314('0x9'),'as':_0x4314('0xa'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0x4314('0xb'),_0x4314('0xc')],'as':_0x4314('0xd')}]},{'model':_0x4314('0xe'),'as':_0x4314('0xf'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0x4314('0xb'),'data5'],'as':'CloudProvider'}]}]},'log':_0x4314('0x10')});};};exports[_0x4314('0x11')]=function(_0x3b44ef,_0x20e84c){return client['Request'](_0x4314('0x12'),{'account':{'id':_0x3b44ef},'body':_0x20e84c,'log':_0x4314('0x12')});}; \ No newline at end of file +var _0xc962=['active','key','ListId','TemplateId','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','name','provider','service','email'];(function(_0x3ce4c0,_0x4999b2){var _0x51571b=function(_0x511182){while(--_0x511182){_0x3ce4c0['push'](_0x3ce4c0['shift']());}};_0x51571b(++_0x4999b2);}(_0xc962,0x6d));var _0x2c96=function(_0x978b24,_0xd44a9e){_0x978b24=_0x978b24-0x0;var _0x392ce1=_0xc962[_0x978b24];return _0x392ce1;};'use strict';var client=require(_0x2c96('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x2c96('0x1'),_0x2c96('0x2'),_0x2c96('0x3'),_0x2c96('0x4'),_0x2c96('0x5'),_0x2c96('0x6'),_0x2c96('0x7'),_0x2c96('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x2c96('0x9'),'include':[{'model':_0x2c96('0xa'),'attributes':['id',_0x2c96('0x1'),_0x2c96('0x3'),_0x2c96('0xb'),_0x2c96('0xc')],'as':_0x2c96('0xa')}]},{'model':_0x2c96('0xd'),'as':_0x2c96('0xe'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x2c96('0x3'),_0x2c96('0xb'),_0x2c96('0xc')],'as':_0x2c96('0xa')}]}]},'log':_0x2c96('0xf')});};};exports[_0x2c96('0x10')]=function(_0x4b6aa8,_0x48e5a9){return client[_0x2c96('0x11')](_0x2c96('0x12'),{'account':{'id':_0x4b6aa8},'body':_0x48e5a9,'log':_0x2c96('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 9f0f98e..a4c3d6d 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 _0xf3e3=['Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x2f4363,_0x2f3e1b){var _0xd9e20b=function(_0x2bfbc9){while(--_0x2bfbc9){_0x2f4363['push'](_0x2f4363['shift']());}};_0xd9e20b(++_0x2f3e1b);}(_0xf3e3,0xea));var _0x3f3e=function(_0x310006,_0x33a375){_0x310006=_0x310006-0x0;var _0x5109d4=_0xf3e3[_0x310006];return _0x5109d4;};'use strict';var client=require(_0x3f3e('0x0'));exports['getSettings']=function(){return client[_0x3f3e('0x1')](_0x3f3e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3f3e('0x3')]},'log':_0x3f3e('0x4')});}; \ No newline at end of file +var _0xcae0=['loginMailFrequency','GetSettings','../client','getSettings','ShowSetting'];(function(_0x378a97,_0x150885){var _0x5b4c41=function(_0x533d61){while(--_0x533d61){_0x378a97['push'](_0x378a97['shift']());}};_0x5b4c41(++_0x150885);}(_0xcae0,0x1b5));var _0x0cae=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcae0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0cae('0x0'));exports[_0x0cae('0x1')]=function(){return client['Request'](_0x0cae('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0cae('0x3')]},'log':_0x0cae('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 99b5743..c31a1d7 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 d42caf9..fc9aea1 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 _0x5a0e=['localhost','adapter','socket.io-redis','default','../../config/express','once','listening','log','port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','polling','redis','defaults'];(function(_0x52c538,_0x48f45a){var _0x33cb72=function(_0x337637){while(--_0x337637){_0x52c538['push'](_0x52c538['shift']());}};_0x33cb72(++_0x48f45a);}(_0x5a0e,0xe6));var _0xe5a0=function(_0x540f0d,_0x2a093b){_0x540f0d=_0x540f0d-0x0;var _0x5d2fc3=_0x5a0e[_0x540f0d];return _0x5d2fc3;};'use strict';var _=require(_0xe5a0('0x0'));var http=require(_0xe5a0('0x1'));var express=require(_0xe5a0('0x2'));var sticky=require(_0xe5a0('0x3'));var Redis=require(_0xe5a0('0x4'));var config=require(_0xe5a0('0x5'));var app=express();var server=http[_0xe5a0('0x6')](app);server[_0xe5a0('0x7')]=0xdbba0;if(sticky[_0xe5a0('0x8')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':['websocket',_0xe5a0('0x9')]});config[_0xe5a0('0xa')]=_[_0xe5a0('0xb')](config[_0xe5a0('0xa')],{'host':_0xe5a0('0xc'),'port':0x18eb});socketio[_0xe5a0('0xd')](require(_0xe5a0('0xe'))({'pubClient':new Redis(config[_0xe5a0('0xa')]),'subClient':new Redis(config[_0xe5a0('0xa')])}));require('../../config/triggers')[_0xe5a0('0xf')]();require('../../config/socketio')[_0xe5a0('0xf')](socketio);require(_0xe5a0('0x10'))[_0xe5a0('0xf')](app);require('../../routes')[_0xe5a0('0xf')](app);}else{server[_0xe5a0('0x11')](_0xe5a0('0x12'),function(){console[_0xe5a0('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe5a0('0x14')]);});}exports=module[_0xe5a0('0x15')]=app; \ No newline at end of file +var _0xf41d=['../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','http','express','sticky-session','ioredis','../../config/environment','listen','socket.io','websocket','polling','defaults','localhost','adapter','socket.io-redis','redis','../../config/triggers','default','../../config/express'];(function(_0x2cc400,_0x5e8b1d){var _0x17dd5f=function(_0x2c7022){while(--_0x2c7022){_0x2cc400['push'](_0x2cc400['shift']());}};_0x17dd5f(++_0x5e8b1d);}(_0xf41d,0x1e8));var _0xdf41=function(_0x12eee5,_0x3df57b){_0x12eee5=_0x12eee5-0x0;var _0x41e10c=_0xf41d[_0x12eee5];return _0x41e10c;};'use strict';var _=require(_0xdf41('0x0'));var http=require(_0xdf41('0x1'));var express=require(_0xdf41('0x2'));var sticky=require(_0xdf41('0x3'));var Redis=require(_0xdf41('0x4'));var config=require(_0xdf41('0x5'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0xdf41('0x6')](server,config['port'])){var socketio=require(_0xdf41('0x7'))(server,{'transports':[_0xdf41('0x8'),_0xdf41('0x9')]});config['redis']=_[_0xdf41('0xa')](config['redis'],{'host':_0xdf41('0xb'),'port':0x18eb});socketio[_0xdf41('0xc')](require(_0xdf41('0xd'))({'pubClient':new Redis(config[_0xdf41('0xe')]),'subClient':new Redis(config[_0xdf41('0xe')])}));require(_0xdf41('0xf'))[_0xdf41('0x10')]();require('../../config/socketio')['default'](socketio);require(_0xdf41('0x11'))[_0xdf41('0x10')](app);require(_0xdf41('0x12'))[_0xdf41('0x10')](app);}else{server[_0xdf41('0x13')]('listening',function(){console[_0xdf41('0x14')](_0xdf41('0x15'),config[_0xdf41('0x16')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 8583ff5..eeca567 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 _0xc7bc=['result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc7bc,0xb3));var _0xcc7b=function(_0x28da07,_0x119907){_0x28da07=_0x28da07-0x0;var _0x23b5e0=_0xc7bc[_0x28da07];return _0x23b5e0;};'use strict';var jayson=require(_0xcc7b('0x0'));var BPromise=require(_0xcc7b('0x1'));var logger=require(_0xcc7b('0x2'))(_0xcc7b('0x3'));var client=jayson[_0xcc7b('0x4')][_0xcc7b('0x5')]({'port':0x2329});client[_0xcc7b('0x6')]=function(_0x5b2f01,_0x356644){return new BPromise(function(_0x529770,_0x348fe8){return client[_0xcc7b('0x7')](_0x5b2f01,_0x356644)[_0xcc7b('0x8')](function(_0xb38ef6){logger[_0xcc7b('0x9')](_0xcc7b('0xa'),_0xcc7b('0x3'),_0x5b2f01,_0x356644,_0xb38ef6);if(_0xb38ef6[_0xcc7b('0xb')]){logger[_0xcc7b('0xb')]('rpc',_0xcc7b('0x3'),_0x5b2f01,_0xb38ef6[_0xcc7b('0xb')][_0xcc7b('0xc')],_0x356644);return _0x348fe8(_0xb38ef6[_0xcc7b('0xb')]['message']);}else{return _0x529770(_0xb38ef6[_0xcc7b('0xd')]);}})[_0xcc7b('0xe')](function(_0x6a7e81){logger[_0xcc7b('0xb')](_0xcc7b('0xa'),_0xcc7b('0x3'),_0x5b2f01,_0x6a7e81,_0x356644);return _0x348fe8(_0x6a7e81);});});};module[_0xcc7b('0xf')]=client; \ No newline at end of file +var _0xf832=['message','result','catch','exports','bluebird','../../config/logger','routing','client','Request','then','rpc','error'];(function(_0xaa2b9,_0x37ec46){var _0x2fba89=function(_0x4f97fc){while(--_0x4f97fc){_0xaa2b9['push'](_0xaa2b9['shift']());}};_0x2fba89(++_0x37ec46);}(_0xf832,0x1f0));var _0x2f83=function(_0x40977c,_0x10bc83){_0x40977c=_0x40977c-0x0;var _0x31cfee=_0xf832[_0x40977c];return _0x31cfee;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2f83('0x0'));var logger=require(_0x2f83('0x1'))(_0x2f83('0x2'));var client=jayson[_0x2f83('0x3')]['http']({'port':0x2329});client[_0x2f83('0x4')]=function(_0x50a4aa,_0x56166f){return new BPromise(function(_0x11edef,_0x5efb9b){return client['request'](_0x50a4aa,_0x56166f)[_0x2f83('0x5')](function(_0x5bc82d){logger['debug'](_0x2f83('0x6'),_0x2f83('0x2'),_0x50a4aa,_0x56166f,_0x5bc82d);if(_0x5bc82d[_0x2f83('0x7')]){logger[_0x2f83('0x7')](_0x2f83('0x6'),_0x2f83('0x2'),_0x50a4aa,_0x5bc82d[_0x2f83('0x7')]['message'],_0x56166f);return _0x5efb9b(_0x5bc82d[_0x2f83('0x7')][_0x2f83('0x8')]);}else{return _0x11edef(_0x5bc82d[_0x2f83('0x9')]);}})[_0x2f83('0xa')](function(_0x83476d){logger[_0x2f83('0x7')](_0x2f83('0x6'),_0x2f83('0x2'),_0x50a4aa,_0x83476d,_0x56166f);return _0x5efb9b(_0x83476d);});});};module[_0x2f83('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 0b9fbd9..413bfd2 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 _0x74e0=['initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues'];(function(_0x147bd8,_0x15126a){var _0x3d8573=function(_0x4e3475){while(--_0x4e3475){_0x147bd8['push'](_0x147bd8['shift']());}};_0x3d8573(++_0x15126a);}(_0x74e0,0x15a));var _0x074e=function(_0xd457f7,_0x2e2b0b){_0xd457f7=_0xd457f7-0x0;var _0x4bbab0=_0x74e0[_0xd457f7];return _0x4bbab0;};'use strict';var BPromise=require('bluebird');var server=require(_0x074e('0x0'));var Realtime=require(_0x074e('0x1'));var user=require(_0x074e('0x2'));var interval=require(_0x074e('0x3'));var openchannelQueue=require(_0x074e('0x4'));var chatQueue=require(_0x074e('0x5'));var smsQueue=require(_0x074e('0x6'));var mailQueue=require(_0x074e('0x7'));var faxQueue=require(_0x074e('0x8'));var whatsappQueue=require(_0x074e('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x074e('0xa')]()[_0x074e('0xb')](user[_0x074e('0xc')]())[_0x074e('0xb')](realtime[_0x074e('0xd')]())[_0x074e('0xb')](interval[_0x074e('0xe')]())[_0x074e('0xb')](realtime[_0x074e('0xf')]())[_0x074e('0xb')](openchannelQueue[_0x074e('0x10')]())[_0x074e('0xb')](realtime['initOpenchannelQueues']())[_0x074e('0xb')](chatQueue[_0x074e('0x11')]())[_0x074e('0xb')](realtime[_0x074e('0x12')]())[_0x074e('0xb')](smsQueue[_0x074e('0x13')]())[_0x074e('0xb')](realtime[_0x074e('0x14')]())[_0x074e('0xb')](mailQueue[_0x074e('0x15')]())['then'](realtime[_0x074e('0x16')]())[_0x074e('0xb')](faxQueue[_0x074e('0x17')]())['then'](realtime['initFaxQueues']())[_0x074e('0xb')](whatsappQueue[_0x074e('0x18')]())[_0x074e('0xb')](realtime[_0x074e('0x19')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x074e('0xb')](function(_0x313d23){return initRealtime();})[_0x074e('0xb')](function(_0x45edd9){return setInterval(initRealtime,0x1388);})[_0x074e('0x1a')](function(_0x1a8a88){console[_0x074e('0x1b')](_0x1a8a88);});}main(); \ No newline at end of file +var _0xa9af=['initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./rpc/user','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues'];(function(_0x3b9f45,_0x5b6d78){var _0xa5cc67=function(_0x279029){while(--_0x279029){_0x3b9f45['push'](_0x3b9f45['shift']());}};_0xa5cc67(++_0x5b6d78);}(_0xa9af,0xe0));var _0xfa9a=function(_0x2994c9,_0x930e79){_0x2994c9=_0x2994c9-0x0;var _0x4f318c=_0xa9af[_0x2994c9];return _0x4f318c;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0xfa9a('0x0'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xfa9a('0x1'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xfa9a('0x2'));var faxQueue=require(_0xfa9a('0x3'));var whatsappQueue=require(_0xfa9a('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xfa9a('0x5')]()['then'](user[_0xfa9a('0x6')]())[_0xfa9a('0x7')](realtime[_0xfa9a('0x8')]())[_0xfa9a('0x7')](interval[_0xfa9a('0x9')]())[_0xfa9a('0x7')](realtime[_0xfa9a('0xa')]())['then'](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0xfa9a('0xb')]())[_0xfa9a('0x7')](chatQueue[_0xfa9a('0xc')]())['then'](realtime[_0xfa9a('0xd')]())[_0xfa9a('0x7')](smsQueue[_0xfa9a('0xe')]())[_0xfa9a('0x7')](realtime[_0xfa9a('0xf')]())[_0xfa9a('0x7')](mailQueue['getMailQueues']())[_0xfa9a('0x7')](realtime[_0xfa9a('0x10')]())[_0xfa9a('0x7')](faxQueue[_0xfa9a('0x11')]())['then'](realtime[_0xfa9a('0x12')]())['then'](whatsappQueue[_0xfa9a('0x13')]())[_0xfa9a('0x7')](realtime[_0xfa9a('0x14')]())[_0xfa9a('0x7')](function(){return realtime;});}function main(){return server[_0xfa9a('0x15')](realtime)['then'](function(_0x418d63){return initRealtime();})[_0xfa9a('0x7')](function(_0x245cb4){return setInterval(initRealtime,0x1388);})[_0xfa9a('0x16')](function(_0x109dbb){console[_0xfa9a('0x17')](_0x109dbb);});}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 63f0b0f..386722e 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(_0x142fe9,_0xd62236){var _0x26f320=function(_0x2e8d58){while(--_0x2e8d58){_0x142fe9['push'](_0x142fe9['shift']());}};_0x26f320(++_0xd62236);}(_0x326f,0xd1));var _0xf326=function(_0x4cc4a0,_0x41ceb7){_0x4cc4a0=_0x4cc4a0-0x0;var _0x4db81d=_0x326f[_0x4cc4a0];return _0x4db81d;};'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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x3ab46c,_0x4d26cc){_0x3ab46c=_0x3ab46c-0x0;var _0x2c7e90=_0x1261[_0x3ab46c];return _0x2c7e90;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 4137b6c..7c4e143 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 _0x8ac9=['http','request','then','error','catch','sendMailMessage','SendMail','bluebird','client'];(function(_0x70e04,_0x41d243){var _0x5d35b5=function(_0x266583){while(--_0x266583){_0x70e04['push'](_0x70e04['shift']());}};_0x5d35b5(++_0x41d243);}(_0x8ac9,0x178));var _0x98ac=function(_0x298e61,_0x20d8db){_0x298e61=_0x298e61-0x0;var _0x5ba522=_0x8ac9[_0x298e61];return _0x5ba522;};'use strict';var BPromise=require(_0x98ac('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x98ac('0x1')][_0x98ac('0x2')]({'port':0x232b});function request(_0x3a6082,_0x431fa5){return new BPromise(function(_0xe537c8,_0x442ed3){return client[_0x98ac('0x3')](_0x3a6082,_0x431fa5)[_0x98ac('0x4')](function(_0x298107){if(_0x298107[_0x98ac('0x5')]){return _0x442ed3(_0x298107[_0x98ac('0x5')]['message']);}else{return _0xe537c8(_0x298107['result']);}})[_0x98ac('0x6')](function(_0x28fe7c){return _0x442ed3(_0x28fe7c);});});}exports[_0x98ac('0x7')]=function(_0x5cbb58,_0x53b1e6){return request(_0x98ac('0x8'),{'account':_0x5cbb58,'message':_0x53b1e6});}; \ No newline at end of file +var _0x7c08=['bluebird','jayson/promise','client','request','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c08,0xb4));var _0x87c0=function(_0x27fcaf,_0x3900c1){_0x27fcaf=_0x27fcaf-0x0;var _0x4e4a0f=_0x7c08[_0x27fcaf];return _0x4e4a0f;};'use strict';var BPromise=require(_0x87c0('0x0'));var jayson=require(_0x87c0('0x1'));var client=jayson[_0x87c0('0x2')]['http']({'port':0x232b});function request(_0x28dbc0,_0xd79c){return new BPromise(function(_0x5d3ead,_0x1024d9){return client[_0x87c0('0x3')](_0x28dbc0,_0xd79c)['then'](function(_0x4f3665){if(_0x4f3665[_0x87c0('0x4')]){return _0x1024d9(_0x4f3665['error'][_0x87c0('0x5')]);}else{return _0x5d3ead(_0x4f3665[_0x87c0('0x6')]);}})[_0x87c0('0x7')](function(_0x30bd47){return _0x1024d9(_0x30bd47);});});}exports[_0x87c0('0x8')]=function(_0x1bbd8b,_0x1d92a3){return request(_0x87c0('0x9'),{'account':_0x1bbd8b,'message':_0x1d92a3});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 10dcf85..eb71871 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 _0x3e30=['faxCurrentCapacity','smsStatusTime','openchannelStatusTime','busyQueue','stringify','emit','user:save','lodash','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','idle','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','format'];(function(_0x156784,_0x41f00d){var _0x277951=function(_0x24de86){while(--_0x24de86){_0x156784['push'](_0x156784['shift']());}};_0x277951(++_0x41f00d);}(_0x3e30,0x12e));var _0x03e3=function(_0x2ddf0c,_0x134849){_0x2ddf0c=_0x2ddf0c-0x0;var _0x1cb3d2=_0x3e30[_0x2ddf0c];return _0x1cb3d2;};'use strict';var _=require(_0x03e3('0x0'));var moment=require(_0x03e3('0x1'));var md5=require(_0x03e3('0x2'));var Redis=require('ioredis');var config=require(_0x03e3('0x3'));config[_0x03e3('0x4')]=_[_0x03e3('0x5')](config[_0x03e3('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x03e3('0x6'))(new Redis(config[_0x03e3('0x4')]));function Agent(_0x2f304f){this['id']=_0x2f304f['id']||0x0;this['name']=_0x2f304f[_0x03e3('0x7')]||'';this[_0x03e3('0x8')]=_0x2f304f['online']||!![];this['voicePause']=_0x2f304f[_0x03e3('0x9')]||![];this[_0x03e3('0xa')]=_0x2f304f[_0x03e3('0xa')]||![];this[_0x03e3('0xb')]=_0x2f304f['mailPause']||![];this[_0x03e3('0xc')]=_0x2f304f[_0x03e3('0xc')]||![];this[_0x03e3('0xd')]=_0x2f304f[_0x03e3('0xd')]||![];this[_0x03e3('0xe')]=_0x2f304f[_0x03e3('0xe')]||![];this[_0x03e3('0xf')]='unknown';this[_0x03e3('0x10')]=0x0;this[_0x03e3('0x11')]=_0x2f304f[_0x03e3('0x11')]||0x0;this[_0x03e3('0x12')]=0x0;this[_0x03e3('0x13')]=_0x03e3('0x14');this[_0x03e3('0x15')]=0x0;this['mailCapacity']=_0x2f304f[_0x03e3('0x16')]||0x0;this[_0x03e3('0x17')]=0x0;this[_0x03e3('0x18')]=_0x03e3('0x14');this[_0x03e3('0x19')]=0x0;this[_0x03e3('0x1a')]=_0x2f304f[_0x03e3('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x03e3('0x1b')]=_0x03e3('0x14');this['smsStatusTime']=0x0;this[_0x03e3('0x1c')]=_0x2f304f['smsCapacity']||0x0;this[_0x03e3('0x1d')]=0x0;this[_0x03e3('0x1e')]='unknown';this[_0x03e3('0x1f')]=0x0;this[_0x03e3('0x20')]=_0x2f304f[_0x03e3('0x20')]||0x0;this[_0x03e3('0x21')]=0x0;this[_0x03e3('0x22')]=_0x03e3('0x14');this['openchannelStatusTime']=0x0;this[_0x03e3('0x23')]=_0x2f304f['openchannelCapacity']||0x0;this[_0x03e3('0x24')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x03e3('0x2')]='';this[_0x03e3('0x25')]();}Agent[_0x03e3('0x26')][_0x03e3('0x27')]=function(_0x114725){if(this[_0x114725+_0x03e3('0x28')]>0x0){if(this[_0x114725+_0x03e3('0x29')]>0x0&&this[_0x114725+_0x03e3('0x28')]>=this[_0x114725+_0x03e3('0x29')]){return'maxcapacity';}else{return'working';}}else{return _0x03e3('0x2a');}};Agent[_0x03e3('0x26')][_0x03e3('0x25')]=function(){var _0x2267d9=['mail',_0x03e3('0x2b'),_0x03e3('0x2c'),_0x03e3('0x2d'),'sms',_0x03e3('0x2e')];for(var _0x33632f=0x0;_0x33632f<_0x2267d9[_0x03e3('0x2f')];_0x33632f+=0x1){var _0x548caa=this[_0x03e3('0x27')](_0x2267d9[_0x33632f]);if(this[_0x2267d9[_0x33632f]+_0x03e3('0x30')]!==_0x548caa){this[_0x2267d9[_0x33632f]+_0x03e3('0x31')]=_[_0x03e3('0x32')](moment()[_0x03e3('0x33')]('x'));}this[_0x2267d9[_0x33632f]+'Status']=_0x548caa;}var _0x1ba688={'id':this['id'],'name':this['name'],'online':this[_0x03e3('0x8')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x03e3('0xd')],'faxPause':this[_0x03e3('0xc')],'openchannelPause':this[_0x03e3('0xe')],'chatStatus':this[_0x03e3('0xf')],'chatStatusTime':this[_0x03e3('0x10')],'chatCapacity':this[_0x03e3('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x03e3('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x03e3('0x17')],'faxStatus':this[_0x03e3('0x18')],'faxStatusTime':this[_0x03e3('0x19')],'faxCapacity':this[_0x03e3('0x1a')],'faxCurrentCapacity':this[_0x03e3('0x34')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x03e3('0x35')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x03e3('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x03e3('0x20')],'whatsappCurrentCapacity':this[_0x03e3('0x21')],'openchannelStatus':this[_0x03e3('0x22')],'openchannelStatusTime':this[_0x03e3('0x36')],'openchannelCapacity':this[_0x03e3('0x23')],'openchannelCurrentCapacity':this[_0x03e3('0x24')],'busy':this['busy'],'busyQueue':this[_0x03e3('0x37')]};var _0x1dd100=md5(JSON[_0x03e3('0x38')](_0x1ba688));if(this['md5']!==_0x1dd100){this[_0x03e3('0x2')]=_0x1dd100;io[_0x03e3('0x39')](_0x03e3('0x3a'),_0x1ba688);}};module['exports']=Agent; \ No newline at end of file +var _0x6947=['mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','chat','fax','sms','whatsapp','length','Status','StatusTime','format','chatStatus','mailStatusTime','faxStatus','faxStatusTime','smsStatusTime','openchannelStatusTime','stringify','emit','user:save','exports','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x6947,0x72));var _0x7694=function(_0x5331c9,_0x2c11d7){_0x5331c9=_0x5331c9-0x0;var _0x58aebc=_0x6947[_0x5331c9];return _0x58aebc;};'use strict';var _=require('lodash');var moment=require(_0x7694('0x0'));var md5=require('md5');var Redis=require(_0x7694('0x1'));var config=require(_0x7694('0x2'));config[_0x7694('0x3')]=_[_0x7694('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7694('0x5'))(new Redis(config[_0x7694('0x3')]));function Agent(_0x1cb2b5){this['id']=_0x1cb2b5['id']||0x0;this[_0x7694('0x6')]=_0x1cb2b5[_0x7694('0x6')]||'';this[_0x7694('0x7')]=_0x1cb2b5['online']||!![];this[_0x7694('0x8')]=_0x1cb2b5['voicePause']||![];this[_0x7694('0x9')]=_0x1cb2b5[_0x7694('0x9')]||![];this['mailPause']=_0x1cb2b5[_0x7694('0xa')]||![];this[_0x7694('0xb')]=_0x1cb2b5[_0x7694('0xb')]||![];this[_0x7694('0xc')]=_0x1cb2b5[_0x7694('0xc')]||![];this[_0x7694('0xd')]=_0x1cb2b5[_0x7694('0xd')]||![];this['chatStatus']=_0x7694('0xe');this[_0x7694('0xf')]=0x0;this['chatCapacity']=_0x1cb2b5[_0x7694('0x10')]||0x0;this[_0x7694('0x11')]=0x0;this[_0x7694('0x12')]='unknown';this['mailStatusTime']=0x0;this[_0x7694('0x13')]=_0x1cb2b5[_0x7694('0x13')]||0x0;this[_0x7694('0x14')]=0x0;this['faxStatus']=_0x7694('0xe');this['faxStatusTime']=0x0;this[_0x7694('0x15')]=_0x1cb2b5[_0x7694('0x15')]||0x0;this[_0x7694('0x16')]=0x0;this[_0x7694('0x17')]=_0x7694('0xe');this['smsStatusTime']=0x0;this[_0x7694('0x18')]=_0x1cb2b5[_0x7694('0x18')]||0x0;this[_0x7694('0x19')]=0x0;this[_0x7694('0x1a')]='unknown';this[_0x7694('0x1b')]=0x0;this[_0x7694('0x1c')]=_0x1cb2b5[_0x7694('0x1c')]||0x0;this[_0x7694('0x1d')]=0x0;this[_0x7694('0x1e')]=_0x7694('0xe');this['openchannelStatusTime']=0x0;this[_0x7694('0x1f')]=_0x1cb2b5['openchannelCapacity']||0x0;this[_0x7694('0x20')]=0x0;this[_0x7694('0x21')]=![];this[_0x7694('0x22')]=undefined;this[_0x7694('0x23')]='';this[_0x7694('0x24')]();}Agent['prototype'][_0x7694('0x25')]=function(_0x105709){if(this[_0x105709+_0x7694('0x26')]>0x0){if(this[_0x105709+_0x7694('0x27')]>0x0&&this[_0x105709+_0x7694('0x26')]>=this[_0x105709+'Capacity']){return _0x7694('0x28');}else{return _0x7694('0x29');}}else{return _0x7694('0x2a');}};Agent[_0x7694('0x2b')]['updateRealtime']=function(){var _0x21383e=['mail',_0x7694('0x2c'),'openchannel',_0x7694('0x2d'),_0x7694('0x2e'),_0x7694('0x2f')];for(var _0x35b5c6=0x0;_0x35b5c6<_0x21383e[_0x7694('0x30')];_0x35b5c6+=0x1){var _0xbc2650=this[_0x7694('0x25')](_0x21383e[_0x35b5c6]);if(this[_0x21383e[_0x35b5c6]+_0x7694('0x31')]!==_0xbc2650){this[_0x21383e[_0x35b5c6]+_0x7694('0x32')]=_['toNumber'](moment()[_0x7694('0x33')]('x'));}this[_0x21383e[_0x35b5c6]+_0x7694('0x31')]=_0xbc2650;}var _0x2d4a79={'id':this['id'],'name':this[_0x7694('0x6')],'online':this['online'],'voicePause':this[_0x7694('0x8')],'chatPause':this[_0x7694('0x9')],'mailPause':this[_0x7694('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0x7694('0xb')],'openchannelPause':this[_0x7694('0xd')],'chatStatus':this[_0x7694('0x34')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x7694('0x10')],'chatCurrentCapacity':this[_0x7694('0x11')],'mailStatus':this[_0x7694('0x12')],'mailStatusTime':this[_0x7694('0x35')],'mailCapacity':this[_0x7694('0x13')],'mailCurrentCapacity':this[_0x7694('0x14')],'faxStatus':this[_0x7694('0x36')],'faxStatusTime':this[_0x7694('0x37')],'faxCapacity':this[_0x7694('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7694('0x17')],'smsStatusTime':this[_0x7694('0x38')],'smsCapacity':this[_0x7694('0x18')],'smsCurrentCapacity':this[_0x7694('0x19')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x7694('0x1b')],'whatsappCapacity':this[_0x7694('0x1c')],'whatsappCurrentCapacity':this[_0x7694('0x1d')],'openchannelStatus':this[_0x7694('0x1e')],'openchannelStatusTime':this[_0x7694('0x39')],'openchannelCapacity':this[_0x7694('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x7694('0x21')],'busyQueue':this[_0x7694('0x22')]};var _0x3ee892=md5(JSON[_0x7694('0x3a')](_0x2d4a79));if(this[_0x7694('0x23')]!==_0x3ee892){this[_0x7694('0x23')]=_0x3ee892;io[_0x7694('0x3b')](_0x7694('0x3c'),_0x2d4a79);}};module[_0x7694('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 5c112c1..05703c2 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 _0x6d52=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','chat:queue:%s','emit','exports','lodash','md5','util'];(function(_0x32b260,_0x5b128f){var _0x354d8f=function(_0x253c79){while(--_0x253c79){_0x32b260['push'](_0x32b260['shift']());}};_0x354d8f(++_0x5b128f);}(_0x6d52,0x114));var _0x26d5=function(_0x4d996a,_0x358bd2){_0x4d996a=_0x4d996a-0x0;var _0x2dd100=_0x6d52[_0x4d996a];return _0x2dd100;};'use strict';var _=require(_0x26d5('0x0'));var md5=require(_0x26d5('0x1'));var util=require(_0x26d5('0x2'));var Redis=require(_0x26d5('0x3'));var config=require(_0x26d5('0x4'));config[_0x26d5('0x5')]=_[_0x26d5('0x6')](config[_0x26d5('0x5')],{'host':_0x26d5('0x7'),'port':0x18eb});var io=require(_0x26d5('0x8'))(new Redis(config['redis']));function ChatQueue(_0x1a5b7f){this['id']=_0x1a5b7f['id']||0x0;this[_0x26d5('0x9')]=_0x1a5b7f[_0x26d5('0x9')]||'';this[_0x26d5('0xa')]=_0x1a5b7f[_0x26d5('0xa')]||0xa;this['strategy']=_0x1a5b7f[_0x26d5('0xb')]||_0x26d5('0xc');this[_0x26d5('0xd')]=_0x1a5b7f[_0x26d5('0xd')];this[_0x26d5('0xe')]={};this[_0x26d5('0xf')]=0x0;this[_0x26d5('0x1')]='';this[_0x26d5('0x10')]();this[_0x26d5('0x11')]();}ChatQueue[_0x26d5('0x12')][_0x26d5('0x10')]=function(){var _0x1558be=this[_0x26d5('0xe')][_0x26d5('0x13')];this[_0x26d5('0xe')]=_[_0x26d5('0x14')](this[_0x26d5('0xd')],'id');this[_0x26d5('0xe')][_0x26d5('0x13')]=_0x1558be;};ChatQueue['prototype'][_0x26d5('0x11')]=function(){this[_0x26d5('0x15')]=0x0;this[_0x26d5('0x16')]=0x0;for(var _0x1a5571=0x0;_0x1a5571=0x0?this[_0x26d5('0x1a')]:0x0;var _0x281c95={'id':this['id'],'available':this['available'],'loggedIn':this[_0x26d5('0x15')],'name':this[_0x26d5('0x9')],'paused':this[_0x26d5('0x16')],'waiting':this[_0x26d5('0xf')]};var _0x2104d7=md5(JSON[_0x26d5('0x1b')](_0x281c95));if(this[_0x26d5('0x1')]!==_0x2104d7){this[_0x26d5('0x1')]=_0x2104d7;io['to'](util['format'](_0x26d5('0x1c'),_0x281c95[_0x26d5('0x9')]))[_0x26d5('0x1d')]('chat_queue:save',_0x281c95);}};module[_0x26d5('0x1e')]=ChatQueue; \ No newline at end of file +var _0xebea=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','_rr','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xebea,0x180));var _0xaebe=function(_0x476507,_0x5becaf){_0x476507=_0x476507-0x0;var _0x2a16c0=_0xebea[_0x476507];return _0x2a16c0;};'use strict';var _=require(_0xaebe('0x0'));var md5=require('md5');var util=require(_0xaebe('0x1'));var Redis=require('ioredis');var config=require(_0xaebe('0x2'));config['redis']=_[_0xaebe('0x3')](config[_0xaebe('0x4')],{'host':_0xaebe('0x5'),'port':0x18eb});var io=require(_0xaebe('0x6'))(new Redis(config['redis']));function ChatQueue(_0x367bab){this['id']=_0x367bab['id']||0x0;this[_0xaebe('0x7')]=_0x367bab[_0xaebe('0x7')]||'';this[_0xaebe('0x8')]=_0x367bab[_0xaebe('0x8')]||0xa;this[_0xaebe('0x9')]=_0x367bab[_0xaebe('0x9')]||_0xaebe('0xa');this['Agents']=_0x367bab[_0xaebe('0xb')];this[_0xaebe('0xc')]={};this[_0xaebe('0xd')]=0x0;this[_0xaebe('0xe')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xaebe('0xf')]['updateRouting']=function(){var _0x1c0798=this['mapAgentsId'][_0xaebe('0x10')];this[_0xaebe('0xc')]=_['map'](this[_0xaebe('0xb')],'id');this['mapAgentsId']['_rr']=_0x1c0798;};ChatQueue[_0xaebe('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xaebe('0x11')]=0x0;for(var _0x19c347=0x0;_0x19c347=0x0?this[_0xaebe('0x16')]:0x0;var _0x1972c7={'id':this['id'],'available':this[_0xaebe('0x16')],'loggedIn':this[_0xaebe('0x14')],'name':this[_0xaebe('0x7')],'paused':this['paused'],'waiting':this[_0xaebe('0xd')]};var _0xa18096=md5(JSON[_0xaebe('0x17')](_0x1972c7));if(this[_0xaebe('0xe')]!==_0xa18096){this[_0xaebe('0xe')]=_0xa18096;io['to'](util[_0xaebe('0x18')](_0xaebe('0x19'),_0x1972c7[_0xaebe('0x7')]))[_0xaebe('0x1a')](_0xaebe('0x1b'),_0x1972c7);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 2bf74e0..e7d4f08 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 _0xe897=['updateRealtime','loggedIn','paused','length','online','available','stringify','fax:queue:%s','exports','md5','ioredis','../../../config/environment','redis','localhost','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x15d76b,_0xff1299){var _0x2ca157=function(_0x2e7882){while(--_0x2e7882){_0x15d76b['push'](_0x15d76b['shift']());}};_0x2ca157(++_0xff1299);}(_0xe897,0x72));var _0x7e89=function(_0x4b735f,_0x499cac){_0x4b735f=_0x4b735f-0x0;var _0x57eb76=_0xe897[_0x4b735f];return _0x57eb76;};'use strict';var _=require('lodash');var md5=require(_0x7e89('0x0'));var util=require('util');var Redis=require(_0x7e89('0x1'));var config=require(_0x7e89('0x2'));config[_0x7e89('0x3')]=_['defaults'](config[_0x7e89('0x3')],{'host':_0x7e89('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x56c51c){this['id']=_0x56c51c['id']||0x0;this[_0x7e89('0x5')]=_0x56c51c['name']||'';this[_0x7e89('0x6')]=_0x56c51c[_0x7e89('0x6')]||0xa;this['strategy']=_0x56c51c['strategy']||_0x7e89('0x7');this[_0x7e89('0x8')]=_0x56c51c['Agents'];this[_0x7e89('0x9')]={};this[_0x7e89('0xa')]=0x0;this[_0x7e89('0x0')]='';this[_0x7e89('0xb')]();this[_0x7e89('0xc')]();}FaxQueue['prototype'][_0x7e89('0xb')]=function(){var _0x2a974e=this['mapAgentsId']['_rr'];this[_0x7e89('0x9')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x2a974e;};FaxQueue['prototype'][_0x7e89('0xc')]=function(){this[_0x7e89('0xd')]=0x0;this[_0x7e89('0xe')]=0x0;for(var _0x2d2ee5=0x0;_0x2d2ee5=0x0?this[_0x7e89('0x11')]:0x0;var _0x24defb={'id':this['id'],'available':this[_0x7e89('0x11')],'loggedIn':this[_0x7e89('0xd')],'name':this[_0x7e89('0x5')],'paused':this['paused'],'waiting':this[_0x7e89('0xa')]};var _0x573e69=md5(JSON[_0x7e89('0x12')](_0x24defb));if(this[_0x7e89('0x0')]!==_0x573e69){this[_0x7e89('0x0')]=_0x573e69;io['to'](util['format'](_0x7e89('0x13'),_0x24defb[_0x7e89('0x5')]))['emit']('fax_queue:save',_0x24defb);}};module[_0x7e89('0x14')]=FaxQueue; \ No newline at end of file +var _0x1af3=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','faxPause','available','paused','stringify','format','fax:queue:%s','emit','exports','lodash','md5','ioredis','redis','localhost','socket.io-emitter'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x1af3,0x1aa));var _0x31af=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x1af3[_0x237da8];return _0x558825;};'use strict';var _=require(_0x31af('0x0'));var md5=require(_0x31af('0x1'));var util=require('util');var Redis=require(_0x31af('0x2'));var config=require('../../../config/environment');config[_0x31af('0x3')]=_['defaults'](config[_0x31af('0x3')],{'host':_0x31af('0x4'),'port':0x18eb});var io=require(_0x31af('0x5'))(new Redis(config[_0x31af('0x3')]));function FaxQueue(_0x1cb4af){this['id']=_0x1cb4af['id']||0x0;this[_0x31af('0x6')]=_0x1cb4af[_0x31af('0x6')]||'';this[_0x31af('0x7')]=_0x1cb4af['timeout']||0xa;this['strategy']=_0x1cb4af[_0x31af('0x8')]||_0x31af('0x9');this[_0x31af('0xa')]=_0x1cb4af[_0x31af('0xa')];this[_0x31af('0xb')]={};this[_0x31af('0xc')]=0x0;this[_0x31af('0x1')]='';this[_0x31af('0xd')]();this[_0x31af('0xe')]();}FaxQueue[_0x31af('0xf')][_0x31af('0xd')]=function(){var _0x229986=this[_0x31af('0xb')][_0x31af('0x10')];this[_0x31af('0xb')]=_['map'](this['Agents'],'id');this[_0x31af('0xb')]['_rr']=_0x229986;};FaxQueue[_0x31af('0xf')][_0x31af('0xe')]=function(){this[_0x31af('0x11')]=0x0;this['paused']=0x0;for(var _0x4f67a3=0x0;_0x4f67a3=0x0?this['available']:0x0;var _0x4e8041={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x31af('0x6')],'paused':this[_0x31af('0x15')],'waiting':this['waiting']};var _0x1bcc5f=md5(JSON[_0x31af('0x16')](_0x4e8041));if(this[_0x31af('0x1')]!==_0x1bcc5f){this[_0x31af('0x1')]=_0x1bcc5f;io['to'](util[_0x31af('0x17')](_0x31af('0x18'),_0x4e8041[_0x31af('0x6')]))[_0x31af('0x19')]('fax_queue:save',_0x4e8041);}};module[_0x31af('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 4f317ab..8db403f 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 _0x07ef=['name','Intervals','exports'];(function(_0x16a2f1,_0x267357){var _0x7f2ce7=function(_0x3a5689){while(--_0x3a5689){_0x16a2f1['push'](_0x16a2f1['shift']());}};_0x7f2ce7(++_0x267357);}(_0x07ef,0x183));var _0xf07e=function(_0x434467,_0x2c6a75){_0x434467=_0x434467-0x0;var _0x5248ba=_0x07ef[_0x434467];return _0x5248ba;};'use strict';function Interval(_0x2755a4){this['id']=_0x2755a4['id']||0x0;this[_0xf07e('0x0')]=_0x2755a4[_0xf07e('0x0')]||'';this[_0xf07e('0x1')]=_0x2755a4[_0xf07e('0x1')]||{};}module[_0xf07e('0x2')]=Interval; \ No newline at end of file +var _0x4768=['Intervals','exports','name'];(function(_0x5c703c,_0x2f5f8e){var _0x1cca90=function(_0x46a3c0){while(--_0x46a3c0){_0x5c703c['push'](_0x5c703c['shift']());}};_0x1cca90(++_0x2f5f8e);}(_0x4768,0x1f1));var _0x8476=function(_0x108e00,_0x3b11f7){_0x108e00=_0x108e00-0x0;var _0x2c6b1d=_0x4768[_0x108e00];return _0x2c6b1d;};'use strict';function Interval(_0x4c0179){this['id']=_0x4c0179['id']||0x0;this[_0x8476('0x0')]=_0x4c0179['name']||'';this[_0x8476('0x1')]=_0x4c0179[_0x8476('0x1')]||{};}module[_0x8476('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 6b2d3a8..b0b3658 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 _0xd7c2=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','updateRealtime','loggedIn','paused','online','available','stringify','format','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','defaults'];(function(_0x201f40,_0x548741){var _0x382401=function(_0x44735b){while(--_0x44735b){_0x201f40['push'](_0x201f40['shift']());}};_0x382401(++_0x548741);}(_0xd7c2,0x1c5));var _0x2d7c=function(_0x1209cb,_0x1491d3){_0x1209cb=_0x1209cb-0x0;var _0x8badb8=_0xd7c2[_0x1209cb];return _0x8badb8;};'use strict';var _=require(_0x2d7c('0x0'));var md5=require(_0x2d7c('0x1'));var util=require(_0x2d7c('0x2'));var Redis=require(_0x2d7c('0x3'));var config=require('../../../config/environment');config[_0x2d7c('0x4')]=_[_0x2d7c('0x5')](config[_0x2d7c('0x4')],{'host':_0x2d7c('0x6'),'port':0x18eb});var io=require(_0x2d7c('0x7'))(new Redis(config['redis']));function MailQueue(_0x3d9662){this['id']=_0x3d9662['id']||0x0;this[_0x2d7c('0x8')]=_0x3d9662['name']||'';this[_0x2d7c('0x9')]=_0x3d9662[_0x2d7c('0x9')]||0xa;this[_0x2d7c('0xa')]=_0x3d9662[_0x2d7c('0xa')]||_0x2d7c('0xb');this[_0x2d7c('0xc')]=_0x3d9662[_0x2d7c('0xc')];this[_0x2d7c('0xd')]={};this[_0x2d7c('0xe')]=0x0;this[_0x2d7c('0x1')]='';this[_0x2d7c('0xf')]();this['updateRealtime']();}MailQueue['prototype']['updateRouting']=function(){var _0x392240=this['mapAgentsId'][_0x2d7c('0x10')];this[_0x2d7c('0xd')]=_['map'](this[_0x2d7c('0xc')],'id');this[_0x2d7c('0xd')][_0x2d7c('0x10')]=_0x392240;};MailQueue['prototype'][_0x2d7c('0x11')]=function(){this[_0x2d7c('0x12')]=0x0;this[_0x2d7c('0x13')]=0x0;for(var _0x55894a=0x0;_0x55894a=0x0?this[_0x2d7c('0x15')]:0x0;var _0x5c34b0={'id':this['id'],'available':this[_0x2d7c('0x15')],'loggedIn':this[_0x2d7c('0x12')],'name':this[_0x2d7c('0x8')],'paused':this[_0x2d7c('0x13')],'waiting':this[_0x2d7c('0xe')]};var _0x4ed1ee=md5(JSON[_0x2d7c('0x16')](_0x5c34b0));if(this[_0x2d7c('0x1')]!==_0x4ed1ee){this[_0x2d7c('0x1')]=_0x4ed1ee;io['to'](util[_0x2d7c('0x17')]('mail:queue:%s',_0x5c34b0['name']))[_0x2d7c('0x18')](_0x2d7c('0x19'),_0x5c34b0);}};module[_0x2d7c('0x1a')]=MailQueue; \ No newline at end of file +var _0xf90b=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy'];(function(_0x36adaa,_0x583ee4){var _0x111c3d=function(_0x4ea7c7){while(--_0x4ea7c7){_0x36adaa['push'](_0x36adaa['shift']());}};_0x111c3d(++_0x583ee4);}(_0xf90b,0x99));var _0xbf90=function(_0x583595,_0x58b095){_0x583595=_0x583595-0x0;var _0x4e9586=_0xf90b[_0x583595];return _0x4e9586;};'use strict';var _=require(_0xbf90('0x0'));var md5=require(_0xbf90('0x1'));var util=require('util');var Redis=require(_0xbf90('0x2'));var config=require(_0xbf90('0x3'));config['redis']=_['defaults'](config[_0xbf90('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbf90('0x5'))(new Redis(config['redis']));function MailQueue(_0xbaf1a5){this['id']=_0xbaf1a5['id']||0x0;this[_0xbf90('0x6')]=_0xbaf1a5[_0xbf90('0x6')]||'';this['timeout']=_0xbaf1a5[_0xbf90('0x7')]||0xa;this['strategy']=_0xbaf1a5[_0xbf90('0x8')]||_0xbf90('0x9');this[_0xbf90('0xa')]=_0xbaf1a5[_0xbf90('0xa')];this[_0xbf90('0xb')]={};this[_0xbf90('0xc')]=0x0;this[_0xbf90('0x1')]='';this[_0xbf90('0xd')]();this[_0xbf90('0xe')]();}MailQueue['prototype'][_0xbf90('0xd')]=function(){var _0x25f4d9=this[_0xbf90('0xb')][_0xbf90('0xf')];this['mapAgentsId']=_[_0xbf90('0x10')](this[_0xbf90('0xa')],'id');this[_0xbf90('0xb')][_0xbf90('0xf')]=_0x25f4d9;};MailQueue['prototype'][_0xbf90('0xe')]=function(){this[_0xbf90('0x11')]=0x0;this[_0xbf90('0x12')]=0x0;for(var _0x193af5=0x0;_0x193af5=0x0?this[_0xbf90('0x16')]:0x0;var _0x27659a={'id':this['id'],'available':this[_0xbf90('0x16')],'loggedIn':this[_0xbf90('0x11')],'name':this['name'],'paused':this[_0xbf90('0x12')],'waiting':this[_0xbf90('0xc')]};var _0x294537=md5(JSON[_0xbf90('0x17')](_0x27659a));if(this['md5']!==_0x294537){this[_0xbf90('0x1')]=_0x294537;io['to'](util['format'](_0xbf90('0x18'),_0x27659a[_0xbf90('0x6')]))[_0xbf90('0x19')](_0xbf90('0x1a'),_0x27659a);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 4cbf2c8..9125c7f 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x326f,0xd1));var _0xf326=function(_0x2177cb,_0x121c38){_0x2177cb=_0x2177cb-0x0;var _0x31d817=_0x326f[_0x2177cb];return _0x31d817;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x1261,0x144));var _0x1126=function(_0x302b5e,_0x564a8e){_0x302b5e=_0x302b5e-0x0;var _0x523ab7=_0x1261[_0x302b5e];return _0x523ab7;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d367ba2..ae99eb5 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 _0x2e35=['redis','defaults','socket.io-emitter','name','strategy','Agents','waiting','updateRealtime','updateRouting','mapAgentsId','map','length','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','../../../config/environment'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0x2e35,0x1d0));var _0x52e3=function(_0x57bc5f,_0x13691f){_0x57bc5f=_0x57bc5f-0x0;var _0x551301=_0x2e35[_0x57bc5f];return _0x551301;};'use strict';var _=require(_0x52e3('0x0'));var md5=require(_0x52e3('0x1'));var util=require(_0x52e3('0x2'));var Redis=require('ioredis');var config=require(_0x52e3('0x3'));config[_0x52e3('0x4')]=_[_0x52e3('0x5')](config[_0x52e3('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x52e3('0x6'))(new Redis(config[_0x52e3('0x4')]));function SmsQueue(_0x1f6987){this['id']=_0x1f6987['id']||0x0;this[_0x52e3('0x7')]=_0x1f6987['name']||'';this['timeout']=_0x1f6987['timeout']||0xa;this[_0x52e3('0x8')]=_0x1f6987['strategy']||'beepall';this[_0x52e3('0x9')]=_0x1f6987[_0x52e3('0x9')];this['mapAgentsId']={};this[_0x52e3('0xa')]=0x0;this[_0x52e3('0x1')]='';this['updateRouting']();this[_0x52e3('0xb')]();}SmsQueue['prototype'][_0x52e3('0xc')]=function(){var _0x10f70f=this[_0x52e3('0xd')]['_rr'];this[_0x52e3('0xd')]=_[_0x52e3('0xe')](this['Agents'],'id');this[_0x52e3('0xd')]['_rr']=_0x10f70f;};SmsQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x105c80=0x0;_0x105c80=0x0?this['available']:0x0;var _0x3088a2={'id':this['id'],'available':this[_0x52e3('0x14')],'loggedIn':this[_0x52e3('0x11')],'name':this[_0x52e3('0x7')],'paused':this[_0x52e3('0x13')],'waiting':this[_0x52e3('0xa')]};var _0x3f628a=md5(JSON[_0x52e3('0x15')](_0x3088a2));if(this[_0x52e3('0x1')]!==_0x3f628a){this[_0x52e3('0x1')]=_0x3f628a;io['to'](util[_0x52e3('0x16')](_0x52e3('0x17'),_0x3088a2[_0x52e3('0x7')]))[_0x52e3('0x18')](_0x52e3('0x19'),_0x3088a2);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x851e=['emit','exports','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s'];(function(_0x2dfa04,_0x287c21){var _0x5ba187=function(_0x1bd53e){while(--_0x1bd53e){_0x2dfa04['push'](_0x2dfa04['shift']());}};_0x5ba187(++_0x287c21);}(_0x851e,0x1e8));var _0xe851=function(_0x21ccfc,_0x48834e){_0x21ccfc=_0x21ccfc-0x0;var _0x279454=_0x851e[_0x21ccfc];return _0x279454;};'use strict';var _=require(_0xe851('0x0'));var md5=require(_0xe851('0x1'));var util=require(_0xe851('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe851('0x3')]=_[_0xe851('0x4')](config[_0xe851('0x3')],{'host':_0xe851('0x5'),'port':0x18eb});var io=require(_0xe851('0x6'))(new Redis(config['redis']));function SmsQueue(_0x2fbb11){this['id']=_0x2fbb11['id']||0x0;this[_0xe851('0x7')]=_0x2fbb11[_0xe851('0x7')]||'';this[_0xe851('0x8')]=_0x2fbb11[_0xe851('0x8')]||0xa;this['strategy']=_0x2fbb11[_0xe851('0x9')]||'beepall';this['Agents']=_0x2fbb11[_0xe851('0xa')];this[_0xe851('0xb')]={};this[_0xe851('0xc')]=0x0;this[_0xe851('0x1')]='';this['updateRouting']();this[_0xe851('0xd')]();}SmsQueue[_0xe851('0xe')][_0xe851('0xf')]=function(){var _0x4e360f=this[_0xe851('0xb')]['_rr'];this[_0xe851('0xb')]=_[_0xe851('0x10')](this['Agents'],'id');this[_0xe851('0xb')]['_rr']=_0x4e360f;};SmsQueue[_0xe851('0xe')]['updateRealtime']=function(){this[_0xe851('0x11')]=0x0;this[_0xe851('0x12')]=0x0;for(var _0x5960f2=0x0;_0x5960f2=0x0?this['available']:0x0;var _0x2d4cf5={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe851('0x11')],'name':this['name'],'paused':this[_0xe851('0x12')],'waiting':this[_0xe851('0xc')]};var _0x22c767=md5(JSON[_0xe851('0x16')](_0x2d4cf5));if(this[_0xe851('0x1')]!==_0x22c767){this[_0xe851('0x1')]=_0x22c767;io['to'](util[_0xe851('0x17')](_0xe851('0x18'),_0x2d4cf5['name']))[_0xe851('0x19')]('sms_queue:save',_0x2d4cf5);}};module[_0xe851('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b17fbc2..08fb2f8 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 _0x8650=['Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8650,0x6b));var _0x0865=function(_0x25c2a2,_0x56fdd3){_0x25c2a2=_0x25c2a2-0x0;var _0x2cc6df=_0x8650[_0x25c2a2];return _0x2cc6df;};'use strict';var _=require(_0x0865('0x0'));var md5=require(_0x0865('0x1'));var util=require(_0x0865('0x2'));var Redis=require(_0x0865('0x3'));var config=require(_0x0865('0x4'));config[_0x0865('0x5')]=_[_0x0865('0x6')](config[_0x0865('0x5')],{'host':_0x0865('0x7'),'port':0x18eb});var io=require(_0x0865('0x8'))(new Redis(config[_0x0865('0x5')]));function WhatsappQueue(_0x4f0939){this['id']=_0x4f0939['id']||0x0;this[_0x0865('0x9')]=_0x4f0939['name']||'';this[_0x0865('0xa')]=_0x4f0939[_0x0865('0xa')]||0xa;this[_0x0865('0xb')]=_0x4f0939[_0x0865('0xb')]||_0x0865('0xc');this[_0x0865('0xd')]=_0x4f0939['Agents'];this[_0x0865('0xe')]={};this[_0x0865('0xf')]=0x0;this[_0x0865('0x1')]='';this['updateRouting']();this[_0x0865('0x10')]();}WhatsappQueue[_0x0865('0x11')][_0x0865('0x12')]=function(){var _0x2d203b=this['mapAgentsId'][_0x0865('0x13')];this[_0x0865('0xe')]=_['map'](this[_0x0865('0xd')],'id');this['mapAgentsId'][_0x0865('0x13')]=_0x2d203b;};WhatsappQueue['prototype'][_0x0865('0x10')]=function(){this[_0x0865('0x14')]=0x0;this[_0x0865('0x15')]=0x0;for(var _0x2600d7=0x0;_0x2600d7=0x0?this['available']:0x0;var _0x428c33={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0865('0x14')],'name':this['name'],'paused':this[_0x0865('0x15')],'waiting':this[_0x0865('0xf')]};var _0x513698=md5(JSON[_0x0865('0x19')](_0x428c33));if(this[_0x0865('0x1')]!==_0x513698){this[_0x0865('0x1')]=_0x513698;io['to'](util[_0x0865('0x1a')](_0x0865('0x1b'),_0x428c33[_0x0865('0x9')]))[_0x0865('0x1c')](_0x0865('0x1d'),_0x428c33);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xb4dc=['lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xb4dc,0xf0));var _0xcb4d=function(_0x4d2aea,_0x4a8f11){_0x4d2aea=_0x4d2aea-0x0;var _0x1715b8=_0xb4dc[_0x4d2aea];return _0x1715b8;};'use strict';var _=require(_0xcb4d('0x0'));var md5=require(_0xcb4d('0x1'));var util=require(_0xcb4d('0x2'));var Redis=require(_0xcb4d('0x3'));var config=require(_0xcb4d('0x4'));config['redis']=_['defaults'](config[_0xcb4d('0x5')],{'host':_0xcb4d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcb4d('0x5')]));function WhatsappQueue(_0x3cd3d1){this['id']=_0x3cd3d1['id']||0x0;this[_0xcb4d('0x7')]=_0x3cd3d1[_0xcb4d('0x7')]||'';this['timeout']=_0x3cd3d1[_0xcb4d('0x8')]||0xa;this[_0xcb4d('0x9')]=_0x3cd3d1[_0xcb4d('0x9')]||_0xcb4d('0xa');this[_0xcb4d('0xb')]=_0x3cd3d1[_0xcb4d('0xb')];this['mapAgentsId']={};this[_0xcb4d('0xc')]=0x0;this[_0xcb4d('0x1')]='';this[_0xcb4d('0xd')]();this[_0xcb4d('0xe')]();}WhatsappQueue[_0xcb4d('0xf')][_0xcb4d('0xd')]=function(){var _0x2b4ca5=this[_0xcb4d('0x10')][_0xcb4d('0x11')];this['mapAgentsId']=_[_0xcb4d('0x12')](this['Agents'],'id');this['mapAgentsId'][_0xcb4d('0x11')]=_0x2b4ca5;};WhatsappQueue['prototype'][_0xcb4d('0xe')]=function(){this[_0xcb4d('0x13')]=0x0;this[_0xcb4d('0x14')]=0x0;for(var _0x59c8e2=0x0;_0x59c8e2=0x0?this[_0xcb4d('0x18')]:0x0;var _0x33879a={'id':this['id'],'available':this[_0xcb4d('0x18')],'loggedIn':this[_0xcb4d('0x13')],'name':this[_0xcb4d('0x7')],'paused':this['paused'],'waiting':this[_0xcb4d('0xc')]};var _0x48a9dc=md5(JSON[_0xcb4d('0x19')](_0x33879a));if(this[_0xcb4d('0x1')]!==_0x48a9dc){this[_0xcb4d('0x1')]=_0x48a9dc;io['to'](util['format'](_0xcb4d('0x1a'),_0x33879a[_0xcb4d('0x7')]))[_0xcb4d('0x1b')](_0xcb4d('0x1c'),_0x33879a);}};module[_0xcb4d('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 850a0d1..4f9566e 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(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 5f58f23..3b53a4d 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 _0x41f7=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request'];(function(_0x4e5e6c,_0x959eb4){var _0xcf9053=function(_0x3bce18){while(--_0x3bce18){_0x4e5e6c['push'](_0x4e5e6c['shift']());}};_0xcf9053(++_0x959eb4);}(_0x41f7,0x7b));var _0x741f=function(_0x4d9816,_0x5c5aaf){_0x4d9816=_0x4d9816-0x0;var _0x3ed66f=_0x41f7[_0x4d9816];return _0x3ed66f;};'use strict';var client=require(_0x741f('0x0'));exports[_0x741f('0x1')]=function(_0x41555b,_0x7790cd){return client[_0x741f('0x2')](_0x741f('0x3'),{'body':_0x7790cd,'options':{'where':{'id':_0x41555b}},'log':_0x741f('0x4')});};exports[_0x741f('0x5')]=function(_0x1c53f3,_0x2d1fb2){return client[_0x741f('0x2')](_0x741f('0x6'),{'body':_0x2d1fb2,'options':{'where':{'id':_0x1c53f3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xdddf=['Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x49c8a2,_0x58dcff){var _0xe46e67=function(_0x547e69){while(--_0x547e69){_0x49c8a2['push'](_0x49c8a2['shift']());}};_0xe46e67(++_0x58dcff);}(_0xdddf,0x178));var _0xfddd=function(_0x31afb7,_0x21e40b){_0x31afb7=_0x31afb7-0x0;var _0x39e9fd=_0xdddf[_0x31afb7];return _0x39e9fd;};'use strict';var client=require(_0xfddd('0x0'));exports[_0xfddd('0x1')]=function(_0x34f13a,_0x2f3ade){return client[_0xfddd('0x2')](_0xfddd('0x3'),{'body':_0x2f3ade,'options':{'where':{'id':_0x34f13a}},'log':'updateChatInteraction'});};exports[_0xfddd('0x4')]=function(_0x17dbe8,_0x4bb90d){return client[_0xfddd('0x2')](_0xfddd('0x5'),{'body':_0x4bb90d,'options':{'where':{'id':_0x17dbe8}},'log':_0xfddd('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2c9a11d..e8d9f90 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 _0x15da=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x15da,0x124));var _0xa15d=function(_0x316b13,_0x21c7b3){_0x316b13=_0x316b13-0x0;var _0x29ab59=_0x15da[_0x316b13];return _0x29ab59;};'use strict';var client=require(_0xa15d('0x0'));exports[_0xa15d('0x1')]=function(_0x482f51){return client[_0xa15d('0x2')](_0xa15d('0x3'),{'body':_0x482f51,'log':_0xa15d('0x4')});}; \ No newline at end of file +var _0xacb9=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x49bb08,_0x5e51ec){var _0x992beb=function(_0x3ca477){while(--_0x3ca477){_0x49bb08['push'](_0x49bb08['shift']());}};_0x992beb(++_0x5e51ec);}(_0xacb9,0x134));var _0x9acb=function(_0x18a1f6,_0x5356c4){_0x18a1f6=_0x18a1f6-0x0;var _0x493551=_0xacb9[_0x18a1f6];return _0x493551;};'use strict';var client=require(_0x9acb('0x0'));exports[_0x9acb('0x1')]=function(_0x1cd913){return client[_0x9acb('0x2')](_0x9acb('0x3'),{'body':_0x1cd913,'log':_0x9acb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 7b17600..bd03738 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 _0x95d9=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','User','name','online'];(function(_0x21397a,_0x19977b){var _0x48f419=function(_0x476308){while(--_0x476308){_0x21397a['push'](_0x21397a['shift']());}};_0x48f419(++_0x19977b);}(_0x95d9,0x97));var _0x995d=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x95d9[_0xac151d];return _0x111dba;};'use strict';var client=require(_0x995d('0x0'));exports[_0x995d('0x1')]=function(){return function(){return client[_0x995d('0x2')](_0x995d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x995d('0x4'),_0x995d('0x5')],'include':[{'model':_0x995d('0x6'),'as':'Agents','attributes':['id',_0x995d('0x7'),_0x995d('0x8'),_0x995d('0x9')]}]},'log':_0x995d('0x1')});};}; \ No newline at end of file +var _0x4453=['Agents','online','chatPause','../client','getChatQueues','GetChatQueue','name','strategy','User'];(function(_0x79cfbf,_0x39dc91){var _0x19656c=function(_0x5b2c2a){while(--_0x5b2c2a){_0x79cfbf['push'](_0x79cfbf['shift']());}};_0x19656c(++_0x39dc91);}(_0x4453,0x9c));var _0x3445=function(_0x5f0ecc,_0x51c82e){_0x5f0ecc=_0x5f0ecc-0x0;var _0x5e0cbe=_0x4453[_0x5f0ecc];return _0x5e0cbe;};'use strict';var client=require(_0x3445('0x0'));exports[_0x3445('0x1')]=function(){return function(){return client['Request'](_0x3445('0x2'),{'options':{'raw':![],'attributes':['id',_0x3445('0x3'),'timeout',_0x3445('0x4')],'include':[{'model':_0x3445('0x5'),'as':_0x3445('0x6'),'attributes':['id',_0x3445('0x3'),_0x3445('0x7'),_0x3445('0x8')]}]},'log':_0x3445('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index f0e0b60..0374128 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 _0xc678=['Request','CreateChatQueueReport','update','DESC'];(function(_0x9f493f,_0x30c4d8){var _0x827c92=function(_0x35ff1f){while(--_0x35ff1f){_0x9f493f['push'](_0x9f493f['shift']());}};_0x827c92(++_0x30c4d8);}(_0xc678,0x1b4));var _0x8c67=function(_0xf46a3e,_0x51903b){_0xf46a3e=_0xf46a3e-0x0;var _0x30b27b=_0xc678[_0xf46a3e];return _0x30b27b;};'use strict';var client=require('../client');exports['create']=function(_0x3002e5){return client[_0x8c67('0x0')](_0x8c67('0x1'),{'body':_0x3002e5,'log':'CreateChatQueueReport'});};exports[_0x8c67('0x2')]=function(_0x3b01cc,_0xcfea76){return client[_0x8c67('0x0')]('UpdateChatQueueReport',{'body':_0xcfea76,'options':{'where':{'uniqueid':_0x3b01cc},'order':[['id',_0x8c67('0x3')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x323b=['update','UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x3bf737,_0x5380e6){var _0x538fb4=function(_0x56e5a0){while(--_0x56e5a0){_0x3bf737['push'](_0x3bf737['shift']());}};_0x538fb4(++_0x5380e6);}(_0x323b,0x1ad));var _0xb323=function(_0x12b282,_0x320c5f){_0x12b282=_0x12b282-0x0;var _0x15bf13=_0x323b[_0x12b282];return _0x15bf13;};'use strict';var client=require(_0xb323('0x0'));exports['create']=function(_0x124e69){return client[_0xb323('0x1')](_0xb323('0x2'),{'body':_0x124e69,'log':'CreateChatQueueReport'});};exports[_0xb323('0x3')]=function(_0x4532c7,_0x3bcab5){return client[_0xb323('0x1')](_0xb323('0x4'),{'body':_0x3bcab5,'options':{'where':{'uniqueid':_0x4532c7},'order':[['id',_0xb323('0x5')]],'limit':0x1},'log':_0xb323('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c0466c7..75b698b 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(_0x3ce6b2,_0x1fc0b0){var _0x98a558=function(_0x2031d8){while(--_0x2031d8){_0x3ce6b2['push'](_0x3ce6b2['shift']());}};_0x98a558(++_0x1fc0b0);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x7a54,0x106));var _0x47a5=function(_0xcf63b9,_0x221458){_0xcf63b9=_0xcf63b9-0x0;var _0x51797e=_0x7a54[_0xcf63b9];return _0x51797e;};'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 68d9c05..29c1413 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 _0xd997=['create','CreateFaxMessage','createFaxMessage'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xd997,0x1c2));var _0x7d99=function(_0x3d0017,_0x4d0eea){_0x3d0017=_0x3d0017-0x0;var _0x53c942=_0xd997[_0x3d0017];return _0x53c942;};'use strict';var client=require('../client');exports[_0x7d99('0x0')]=function(_0x33cf14){return client['Request'](_0x7d99('0x1'),{'body':_0x33cf14,'log':_0x7d99('0x2')});}; \ No newline at end of file +var _0x2e7e=['../client','create','Request','createFaxMessage'];(function(_0xae282f,_0x2d9368){var _0x5f46d4=function(_0x4f703e){while(--_0x4f703e){_0xae282f['push'](_0xae282f['shift']());}};_0x5f46d4(++_0x2d9368);}(_0x2e7e,0x160));var _0xe2e7=function(_0x14b20d,_0x57dc8f){_0x14b20d=_0x14b20d-0x0;var _0x122357=_0x2e7e[_0x14b20d];return _0x122357;};'use strict';var client=require(_0xe2e7('0x0'));exports[_0xe2e7('0x1')]=function(_0x4b960b){return client[_0xe2e7('0x2')]('CreateFaxMessage',{'body':_0x4b960b,'log':_0xe2e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 9856473..570b0ed 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 _0x3cf1=['../client','Request','GetFaxQueue','name','strategy','User','Agents','online','getFaxQueues'];(function(_0x57f4c9,_0x34e059){var _0x2a974c=function(_0x2fd75b){while(--_0x2fd75b){_0x57f4c9['push'](_0x57f4c9['shift']());}};_0x2a974c(++_0x34e059);}(_0x3cf1,0x144));var _0x13cf=function(_0x1521d1,_0x3f41db){_0x1521d1=_0x1521d1-0x0;var _0x33b625=_0x3cf1[_0x1521d1];return _0x33b625;};'use strict';var client=require(_0x13cf('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x13cf('0x1')](_0x13cf('0x2'),{'options':{'raw':![],'attributes':['id',_0x13cf('0x3'),'timeout',_0x13cf('0x4')],'include':[{'model':_0x13cf('0x5'),'as':_0x13cf('0x6'),'attributes':['id','name',_0x13cf('0x7'),'faxPause']}]},'log':_0x13cf('0x8')});};}; \ No newline at end of file +var _0x5e86=['User','online','faxPause','../client','getFaxQueues','Request','name','strategy'];(function(_0x54e2da,_0x599f6c){var _0x57d65f=function(_0x276b82){while(--_0x276b82){_0x54e2da['push'](_0x54e2da['shift']());}};_0x57d65f(++_0x599f6c);}(_0x5e86,0x1e3));var _0x65e8=function(_0x4e9692,_0x3455be){_0x4e9692=_0x4e9692-0x0;var _0x3b8f5c=_0x5e86[_0x4e9692];return _0x3b8f5c;};'use strict';var client=require(_0x65e8('0x0'));exports[_0x65e8('0x1')]=function(){return function(){return client[_0x65e8('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x65e8('0x3'),'timeout',_0x65e8('0x4')],'include':[{'model':_0x65e8('0x5'),'as':'Agents','attributes':['id',_0x65e8('0x3'),_0x65e8('0x6'),_0x65e8('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 6820bf7..2073dc0 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 _0xe51a=['CreateFaxQueueReport','update','DESC','../client','create','Request'];(function(_0x47ad08,_0x28fcd1){var _0x302699=function(_0x45a213){while(--_0x45a213){_0x47ad08['push'](_0x47ad08['shift']());}};_0x302699(++_0x28fcd1);}(_0xe51a,0x9f));var _0xae51=function(_0x22c4ad,_0x6478b6){_0x22c4ad=_0x22c4ad-0x0;var _0x81b639=_0xe51a[_0x22c4ad];return _0x81b639;};'use strict';var client=require(_0xae51('0x0'));exports[_0xae51('0x1')]=function(_0x4495ac){return client[_0xae51('0x2')]('CreateFaxQueueReport',{'body':_0x4495ac,'log':_0xae51('0x3')});};exports[_0xae51('0x4')]=function(_0x570c5e,_0x4d975d){return client[_0xae51('0x2')]('UpdateFaxQueueReport',{'body':_0x4d975d,'options':{'where':{'uniqueid':_0x570c5e},'order':[['id',_0xae51('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xd602=['Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','update'];(function(_0x387a42,_0x5735df){var _0x1e5843=function(_0x5af3c9){while(--_0x5af3c9){_0x387a42['push'](_0x387a42['shift']());}};_0x1e5843(++_0x5735df);}(_0xd602,0xea));var _0x2d60=function(_0x467507,_0x4fa8c0){_0x467507=_0x467507-0x0;var _0x15768c=_0xd602[_0x467507];return _0x15768c;};'use strict';var client=require(_0x2d60('0x0'));exports[_0x2d60('0x1')]=function(_0x43a073){return client['Request'](_0x2d60('0x2'),{'body':_0x43a073,'log':_0x2d60('0x2')});};exports[_0x2d60('0x3')]=function(_0x3561c7,_0x5c99e3){return client[_0x2d60('0x4')](_0x2d60('0x5'),{'body':_0x5c99e3,'options':{'where':{'uniqueid':_0x3561c7},'order':[['id',_0x2d60('0x6')]],'limit':0x1},'log':_0x2d60('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 79b8055..adae1c2 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 _0x3ca7=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x3ca7,0x1bf));var _0x73ca=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x3ca7[_0x503950];return _0x1657a9;};'use strict';var client=require(_0x73ca('0x0'));exports[_0x73ca('0x1')]=function(){return function(){return client[_0x73ca('0x2')](_0x73ca('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x73ca('0x4')],'include':[{'model':_0x73ca('0x5'),'as':_0x73ca('0x6'),'attributes':['id',_0x73ca('0x4'),_0x73ca('0x7')]}]},'log':_0x73ca('0x1')});};}; \ No newline at end of file +var _0x30c4=['getIntervals','GetInterval','Interval','Intervals','interval','../client'];(function(_0x4361b6,_0x29e3fe){var _0x477231=function(_0x4c570d){while(--_0x4c570d){_0x4361b6['push'](_0x4361b6['shift']());}};_0x477231(++_0x29e3fe);}(_0x30c4,0x13d));var _0x430c=function(_0xea322b,_0x15dc0c){_0xea322b=_0xea322b-0x0;var _0x304ea2=_0x30c4[_0xea322b];return _0x304ea2;};'use strict';var client=require(_0x430c('0x0'));exports[_0x430c('0x1')]=function(){return function(){return client['Request'](_0x430c('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x430c('0x3'),'as':_0x430c('0x4'),'attributes':['id','name',_0x430c('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f7480fb..f2a9df9 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 _0x6a55=['Request','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0xde8f9f,_0x40ad3d){var _0x271d5f=function(_0x5a2b19){while(--_0x5a2b19){_0xde8f9f['push'](_0xde8f9f['shift']());}};_0x271d5f(++_0x40ad3d);}(_0x6a55,0xdb));var _0x56a5=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x6a55[_0x199b1f];return _0x267ac9;};'use strict';var client=require(_0x56a5('0x0'));exports['update']=function(_0x5d894b,_0x4ec858){return client[_0x56a5('0x1')]('UpdateMailInteraction',{'body':_0x4ec858,'options':{'where':{'id':_0x5d894b}},'log':'updateMailInteraction'});};exports[_0x56a5('0x2')]=function(_0x5e5a32,_0x3ff76a){return client['Request'](_0x56a5('0x3'),{'body':_0x3ff76a,'options':{'where':{'id':_0x5e5a32}},'log':_0x56a5('0x4')});}; \ No newline at end of file +var _0xf61e=['addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf61e,0x191));var _0xef61=function(_0x546204,_0x4863b6){_0x546204=_0x546204-0x0;var _0xfbad36=_0xf61e[_0x546204];return _0xfbad36;};'use strict';var client=require(_0xef61('0x0'));exports[_0xef61('0x1')]=function(_0xe535c3,_0xcf15bd){return client[_0xef61('0x2')](_0xef61('0x3'),{'body':_0xcf15bd,'options':{'where':{'id':_0xe535c3}},'log':_0xef61('0x4')});};exports[_0xef61('0x5')]=function(_0x2bd1d0,_0x14122a){return client[_0xef61('0x2')](_0xef61('0x6'),{'body':_0x14122a,'options':{'where':{'id':_0x2bd1d0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 485ab89..dcaa704 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 _0x9645=['Request','CreateMailMessage','create'];(function(_0x2706db,_0x2c03f6){var _0x19939b=function(_0x24266a){while(--_0x24266a){_0x2706db['push'](_0x2706db['shift']());}};_0x19939b(++_0x2c03f6);}(_0x9645,0x1df));var _0x5964=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x9645[_0x1b2422];return _0x376573;};'use strict';var client=require('../client');exports[_0x5964('0x0')]=function(_0x4ed95c){return client[_0x5964('0x1')](_0x5964('0x2'),{'body':_0x4ed95c,'log':'createMailMessage'});}; \ No newline at end of file +var _0x35e1=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x4b3e6e,_0x319d30){var _0x37361f=function(_0x4d0847){while(--_0x4d0847){_0x4b3e6e['push'](_0x4b3e6e['shift']());}};_0x37361f(++_0x319d30);}(_0x35e1,0x1a6));var _0x135e=function(_0x7f3667,_0x30c3f1){_0x7f3667=_0x7f3667-0x0;var _0x2c4c24=_0x35e1[_0x7f3667];return _0x2c4c24;};'use strict';var client=require(_0x135e('0x0'));exports[_0x135e('0x1')]=function(_0x38e69a){return client[_0x135e('0x2')](_0x135e('0x3'),{'body':_0x38e69a,'log':_0x135e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 0d9990c..00db61b 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 _0x49d6=['timeout','name','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x49d6,0x1c4));var _0x649d=function(_0x78e878,_0xacf0b8){_0x78e878=_0x78e878-0x0;var _0x3e6eca=_0x49d6[_0x78e878];return _0x3e6eca;};'use strict';var client=require(_0x649d('0x0'));exports[_0x649d('0x1')]=function(){return function(){return client['Request'](_0x649d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x649d('0x3'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x649d('0x4'),_0x649d('0x5'),_0x649d('0x6')]}]},'log':_0x649d('0x1')});};}; \ No newline at end of file +var _0xabcc=['Agents','online','mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0x78b514,_0x7f6d49){var _0x4d3aba=function(_0xd9869e){while(--_0xd9869e){_0x78b514['push'](_0x78b514['shift']());}};_0x4d3aba(++_0x7f6d49);}(_0xabcc,0x7b));var _0xcabc=function(_0x23fcad,_0x2b4c2e){_0x23fcad=_0x23fcad-0x0;var _0x3e4d60=_0xabcc[_0x23fcad];return _0x3e4d60;};'use strict';var client=require('../client');exports[_0xcabc('0x0')]=function(){return function(){return client[_0xcabc('0x1')](_0xcabc('0x2'),{'options':{'raw':![],'attributes':['id',_0xcabc('0x3'),_0xcabc('0x4'),_0xcabc('0x5')],'include':[{'model':_0xcabc('0x6'),'as':_0xcabc('0x7'),'attributes':['id',_0xcabc('0x3'),_0xcabc('0x8'),_0xcabc('0x9')]}]},'log':_0xcabc('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ee4e3a1..5486fca 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 _0x4c57=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4c57,0xf3));var _0x74c5=function(_0x338435,_0x4f296c){_0x338435=_0x338435-0x0;var _0x3c48a5=_0x4c57[_0x338435];return _0x3c48a5;};'use strict';var client=require(_0x74c5('0x0'));exports[_0x74c5('0x1')]=function(_0x45732d){return client[_0x74c5('0x2')](_0x74c5('0x3'),{'body':_0x45732d,'log':_0x74c5('0x3')});};exports[_0x74c5('0x4')]=function(_0x5f08fa,_0x192fdd){return client[_0x74c5('0x2')](_0x74c5('0x5'),{'body':_0x192fdd,'options':{'where':{'uniqueid':_0x5f08fa},'order':[['id','DESC']],'limit':0x1},'log':_0x74c5('0x5')});}; \ No newline at end of file +var _0x1f10=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1f10,0x149));var _0x01f1=function(_0x1543ab,_0x12fdf3){_0x1543ab=_0x1543ab-0x0;var _0x287673=_0x1f10[_0x1543ab];return _0x287673;};'use strict';var client=require(_0x01f1('0x0'));exports[_0x01f1('0x1')]=function(_0x26c8bb){return client[_0x01f1('0x2')](_0x01f1('0x3'),{'body':_0x26c8bb,'log':'CreateMailQueueReport'});};exports[_0x01f1('0x4')]=function(_0x4825e1,_0x168d39){return client[_0x01f1('0x2')](_0x01f1('0x5'),{'body':_0x168d39,'options':{'where':{'uniqueid':_0x4825e1},'order':[['id',_0x01f1('0x6')]],'limit':0x1},'log':_0x01f1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f92bc39..b093c69 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 _0xd5d6=['Request','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x4c8b9f,_0x27d603){var _0x5d8463=function(_0x179f14){while(--_0x179f14){_0x4c8b9f['push'](_0x4c8b9f['shift']());}};_0x5d8463(++_0x27d603);}(_0xd5d6,0x8e));var _0x6d5d=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xd5d6[_0x363ef8];return _0x148822;};'use strict';var client=require(_0x6d5d('0x0'));exports[_0x6d5d('0x1')]=function(_0x421454,_0x5c6487){return client[_0x6d5d('0x2')](_0x6d5d('0x3'),{'body':_0x5c6487,'options':{'where':{'id':_0x421454}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x47b011,_0x47a558){return client[_0x6d5d('0x2')](_0x6d5d('0x4'),{'body':_0x47a558,'options':{'where':{'id':_0x47b011}},'log':_0x6d5d('0x5')});}; \ No newline at end of file +var _0xf988=['update','Request','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x57841a,_0x3bf283){var _0x588bab=function(_0x8127a7){while(--_0x8127a7){_0x57841a['push'](_0x57841a['shift']());}};_0x588bab(++_0x3bf283);}(_0xf988,0x16d));var _0x8f98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf988[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x8f98('0x0'));exports[_0x8f98('0x1')]=function(_0x1a9771,_0x1e35ab){return client[_0x8f98('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1e35ab,'options':{'where':{'id':_0x1a9771}},'log':_0x8f98('0x3')});};exports['addTags']=function(_0x28a2f9,_0x28a307){return client[_0x8f98('0x2')](_0x8f98('0x4'),{'body':_0x28a307,'options':{'where':{'id':_0x28a2f9}},'log':_0x8f98('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b3dc1d4..4917c17 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 _0xabbd=['createOpenchannelMessage','../client','Request','CreateOpenchannelMessage'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xabbd,0x9d));var _0xdabb=function(_0x29adf6,_0x13e21e){_0x29adf6=_0x29adf6-0x0;var _0x49039d=_0xabbd[_0x29adf6];return _0x49039d;};'use strict';var client=require(_0xdabb('0x0'));exports['create']=function(_0x4f1a42){return client[_0xdabb('0x1')](_0xdabb('0x2'),{'body':_0x4f1a42,'log':_0xdabb('0x3')});}; \ No newline at end of file +var _0x5f2d=['createOpenchannelMessage','../client','CreateOpenchannelMessage'];(function(_0x2a26c9,_0x1de138){var _0xb4fdd7=function(_0xb440d){while(--_0xb440d){_0x2a26c9['push'](_0x2a26c9['shift']());}};_0xb4fdd7(++_0x1de138);}(_0x5f2d,0x1d5));var _0xd5f2=function(_0x172be7,_0x528e8a){_0x172be7=_0x172be7-0x0;var _0x19cd9a=_0x5f2d[_0x172be7];return _0x19cd9a;};'use strict';var client=require(_0xd5f2('0x0'));exports['create']=function(_0x3c4364){return client['Request'](_0xd5f2('0x1'),{'body':_0x3c4364,'log':_0xd5f2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index c434441..cf82b7f 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 _0xf966=['User','Agents','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x3e9859,_0x1da4ed){var _0xa930bd=function(_0x11a845){while(--_0x11a845){_0x3e9859['push'](_0x3e9859['shift']());}};_0xa930bd(++_0x1da4ed);}(_0xf966,0x13b));var _0x6f96=function(_0x3b9322,_0x5337c1){_0x3b9322=_0x3b9322-0x0;var _0x579528=_0xf966[_0x3b9322];return _0x579528;};'use strict';var client=require(_0x6f96('0x0'));exports[_0x6f96('0x1')]=function(){return function(){return client[_0x6f96('0x2')](_0x6f96('0x3'),{'options':{'raw':![],'attributes':['id',_0x6f96('0x4'),'timeout','strategy'],'include':[{'model':_0x6f96('0x5'),'as':_0x6f96('0x6'),'attributes':['id',_0x6f96('0x4'),'online',_0x6f96('0x7')]}]},'log':_0x6f96('0x1')});};}; \ No newline at end of file +var _0xcbdf=['Request','GetOpenchannelQueue','name','User','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x154cbb,_0x43c57f){var _0x494584=function(_0x971bd9){while(--_0x971bd9){_0x154cbb['push'](_0x154cbb['shift']());}};_0x494584(++_0x43c57f);}(_0xcbdf,0xbf));var _0xfcbd=function(_0x557006,_0x12c267){_0x557006=_0x557006-0x0;var _0x10d189=_0xcbdf[_0x557006];return _0x10d189;};'use strict';var client=require('../client');exports[_0xfcbd('0x0')]=function(){return function(){return client[_0xfcbd('0x1')](_0xfcbd('0x2'),{'options':{'raw':![],'attributes':['id',_0xfcbd('0x3'),'timeout','strategy'],'include':[{'model':_0xfcbd('0x4'),'as':_0xfcbd('0x5'),'attributes':['id',_0xfcbd('0x3'),_0xfcbd('0x6'),_0xfcbd('0x7')]}]},'log':_0xfcbd('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3839bb5..3405867 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 _0x59a6=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x4bcbe,_0x3a38c0){var _0x4c0af9=function(_0x3dfc1f){while(--_0x3dfc1f){_0x4bcbe['push'](_0x4bcbe['shift']());}};_0x4c0af9(++_0x3a38c0);}(_0x59a6,0x1b5));var _0x659a=function(_0xadbc49,_0x2214e6){_0xadbc49=_0xadbc49-0x0;var _0x3b05d1=_0x59a6[_0xadbc49];return _0x3b05d1;};'use strict';var client=require(_0x659a('0x0'));exports[_0x659a('0x1')]=function(_0x3f0d29){return client[_0x659a('0x2')](_0x659a('0x3'),{'body':_0x3f0d29,'log':_0x659a('0x3')});};exports[_0x659a('0x4')]=function(_0x51761f,_0x1b13bd){return client[_0x659a('0x2')](_0x659a('0x5'),{'body':_0x1b13bd,'options':{'where':{'uniqueid':_0x51761f},'order':[['id',_0x659a('0x6')]],'limit':0x1},'log':_0x659a('0x5')});}; \ No newline at end of file +var _0xb666=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x5a9ed3,_0x14aca6){var _0xc1fe4e=function(_0x367b1f){while(--_0x367b1f){_0x5a9ed3['push'](_0x5a9ed3['shift']());}};_0xc1fe4e(++_0x14aca6);}(_0xb666,0x1e6));var _0x6b66=function(_0x109dbd,_0x290d2b){_0x109dbd=_0x109dbd-0x0;var _0x395644=_0xb666[_0x109dbd];return _0x395644;};'use strict';var client=require(_0x6b66('0x0'));exports[_0x6b66('0x1')]=function(_0x353493){return client[_0x6b66('0x2')](_0x6b66('0x3'),{'body':_0x353493,'log':_0x6b66('0x3')});};exports['update']=function(_0x3474c2,_0x272f81){return client[_0x6b66('0x2')](_0x6b66('0x4'),{'body':_0x272f81,'options':{'where':{'uniqueid':_0x3474c2},'order':[['id',_0x6b66('0x5')]],'limit':0x1},'log':_0x6b66('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bb2019f..d7aa82c 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 _0x0fda=['addTags','AddTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x2756c3,_0x2f2a68){_0x2756c3=_0x2756c3-0x0;var _0x1d3dfc=_0x0fda[_0x2756c3];return _0x1d3dfc;};'use strict';var client=require(_0xa0fd('0x0'));exports['update']=function(_0x8c3855,_0x28e34c){return client[_0xa0fd('0x1')](_0xa0fd('0x2'),{'body':_0x28e34c,'options':{'where':{'id':_0x8c3855}},'log':_0xa0fd('0x3')});};exports[_0xa0fd('0x4')]=function(_0x13c734,_0x574fca){return client['Request'](_0xa0fd('0x5'),{'body':_0x574fca,'options':{'where':{'id':_0x13c734}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xb957=['UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','Request'];(function(_0x2c24ae,_0x283166){var _0x321bc4=function(_0x57b48f){while(--_0x57b48f){_0x2c24ae['push'](_0x2c24ae['shift']());}};_0x321bc4(++_0x283166);}(_0xb957,0x6d));var _0x7b95=function(_0x5a9fd9,_0x2e7aa2){_0x5a9fd9=_0x5a9fd9-0x0;var _0x1a3ec1=_0xb957[_0x5a9fd9];return _0x1a3ec1;};'use strict';var client=require('../client');exports['update']=function(_0x433f9a,_0x5012da){return client[_0x7b95('0x0')](_0x7b95('0x1'),{'body':_0x5012da,'options':{'where':{'id':_0x433f9a}},'log':_0x7b95('0x2')});};exports['addTags']=function(_0x45db17,_0x2c8a4d){return client[_0x7b95('0x0')](_0x7b95('0x3'),{'body':_0x2c8a4d,'options':{'where':{'id':_0x45db17}},'log':_0x7b95('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index cbbf390..c15dbcf 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 _0x363e=['Request','createSmsMessage'];(function(_0x1b90ed,_0xb2f502){var _0x2eac56=function(_0x49097e){while(--_0x49097e){_0x1b90ed['push'](_0x1b90ed['shift']());}};_0x2eac56(++_0xb2f502);}(_0x363e,0x1cc));var _0xe363=function(_0x1164d9,_0x45f6de){_0x1164d9=_0x1164d9-0x0;var _0x24e6dc=_0x363e[_0x1164d9];return _0x24e6dc;};'use strict';var client=require('../client');exports['create']=function(_0x575661){return client[_0xe363('0x0')]('CreateSmsMessage',{'body':_0x575661,'log':_0xe363('0x1')});}; \ No newline at end of file +var _0x8956=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x9ba197,_0x369eba){var _0x4a915d=function(_0x4410b4){while(--_0x4410b4){_0x9ba197['push'](_0x9ba197['shift']());}};_0x4a915d(++_0x369eba);}(_0x8956,0x94));var _0x6895=function(_0x111c3c,_0x2fa368){_0x111c3c=_0x111c3c-0x0;var _0x18cd53=_0x8956[_0x111c3c];return _0x18cd53;};'use strict';var client=require(_0x6895('0x0'));exports[_0x6895('0x1')]=function(_0x426957){return client[_0x6895('0x2')](_0x6895('0x3'),{'body':_0x426957,'log':_0x6895('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c5f8947..63aa692 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x5d7359,_0x5dc4c1){var _0x59e242=function(_0x52cda3){while(--_0x52cda3){_0x5d7359['push'](_0x5d7359['shift']());}};_0x59e242(++_0x5dc4c1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x4c413a,_0xa6a30a){var _0x347858=function(_0x3028bb){while(--_0x3028bb){_0x4c413a['push'](_0x4c413a['shift']());}};_0x347858(++_0xa6a30a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 43a3c00..04b82c3 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x220e01,_0x379427){var _0x49e7ac=function(_0x3983b8){while(--_0x3983b8){_0x220e01['push'](_0x220e01['shift']());}};_0x49e7ac(++_0x379427);}(_0x55ca,0x126));var _0xa55c=function(_0x17e174,_0x4991f8){_0x17e174=_0x17e174-0x0;var _0x3f26f1=_0x55ca[_0x17e174];return _0x3f26f1;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x1be334,_0x3f3b30){var _0x17d555=function(_0x18dc25){while(--_0x18dc25){_0x1be334['push'](_0x1be334['shift']());}};_0x17d555(++_0x3f3b30);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 5d6dde9..e0e372e 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(_0x565fcc,_0x42d390){var _0x4178c2=function(_0x15e74a){while(--_0x15e74a){_0x565fcc['push'](_0x565fcc['shift']());}};_0x4178c2(++_0x42d390);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x2422f8,_0x349144){var _0x380780=function(_0x223fdb){while(--_0x223fdb){_0x2422f8['push'](_0x2422f8['shift']());}};_0x380780(++_0x349144);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 b02fc21..b31e278 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 _0xd663=['addTags','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x158a01,_0x50bcb8){var _0x94b215=function(_0x295679){while(--_0x295679){_0x158a01['push'](_0x158a01['shift']());}};_0x94b215(++_0x50bcb8);}(_0xd663,0x1ed));var _0x3d66=function(_0x3166f0,_0xa6934c){_0x3166f0=_0x3166f0-0x0;var _0x553e2a=_0xd663[_0x3166f0];return _0x553e2a;};'use strict';var client=require(_0x3d66('0x0'));exports[_0x3d66('0x1')]=function(_0x55a3d4,_0x1fdc60){return client[_0x3d66('0x2')](_0x3d66('0x3'),{'body':_0x1fdc60,'options':{'where':{'id':_0x55a3d4}},'log':_0x3d66('0x4')});};exports[_0x3d66('0x5')]=function(_0x4e9001,_0x28d76b){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x28d76b,'options':{'where':{'id':_0x4e9001}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x7c1a=['UpdateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0xcba6fa,_0xdb3f9c){var _0x12edb5=function(_0x493810){while(--_0x493810){_0xcba6fa['push'](_0xcba6fa['shift']());}};_0x12edb5(++_0xdb3f9c);}(_0x7c1a,0x159));var _0xa7c1=function(_0x1bf36f,_0x4f6a94){_0x1bf36f=_0x1bf36f-0x0;var _0x1f79b6=_0x7c1a[_0x1bf36f];return _0x1f79b6;};'use strict';var client=require(_0xa7c1('0x0'));exports[_0xa7c1('0x1')]=function(_0x285492,_0x38f547){return client[_0xa7c1('0x2')](_0xa7c1('0x3'),{'body':_0x38f547,'options':{'where':{'id':_0x285492}},'log':'updateWhatsappInteraction'});};exports[_0xa7c1('0x4')]=function(_0x132b08,_0x506858){return client[_0xa7c1('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x506858,'options':{'where':{'id':_0x132b08}},'log':_0xa7c1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index e8afca8..a6c6c66 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 _0x8ae3=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x3c8366,_0x46df4c){var _0xae08f1=function(_0x5da3ef){while(--_0x5da3ef){_0x3c8366['push'](_0x3c8366['shift']());}};_0xae08f1(++_0x46df4c);}(_0x8ae3,0x16f));var _0x38ae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ae3[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x38ae('0x0'));exports[_0x38ae('0x1')]=function(_0x5d2675){return client[_0x38ae('0x2')](_0x38ae('0x3'),{'body':_0x5d2675,'log':_0x38ae('0x4')});}; \ No newline at end of file +var _0x9037=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x3bd8ac,_0x2127ec){var _0x4e2050=function(_0xf89fc7){while(--_0xf89fc7){_0x3bd8ac['push'](_0x3bd8ac['shift']());}};_0x4e2050(++_0x2127ec);}(_0x9037,0x1c9));var _0x7903=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9037[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0x7903('0x0')]=function(_0x2ebf3d){return client[_0x7903('0x1')](_0x7903('0x2'),{'body':_0x2ebf3d,'log':_0x7903('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3175bc6..60c24c9 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 _0xabf4=['name','strategy','User','Agents','../client','getWhatsappQueues','GetWhatsappQueue'];(function(_0xb3b90c,_0x288be3){var _0x247a13=function(_0x4dbb32){while(--_0x4dbb32){_0xb3b90c['push'](_0xb3b90c['shift']());}};_0x247a13(++_0x288be3);}(_0xabf4,0x15b));var _0x4abf=function(_0x338c7d,_0x2efd72){_0x338c7d=_0x338c7d-0x0;var _0x2664ac=_0xabf4[_0x338c7d];return _0x2664ac;};'use strict';var client=require(_0x4abf('0x0'));exports[_0x4abf('0x1')]=function(){return function(){return client['Request'](_0x4abf('0x2'),{'options':{'raw':![],'attributes':['id',_0x4abf('0x3'),'timeout',_0x4abf('0x4')],'include':[{'model':_0x4abf('0x5'),'as':_0x4abf('0x6'),'attributes':['id',_0x4abf('0x3'),'online','whatsappPause']}]},'log':_0x4abf('0x1')});};}; \ No newline at end of file +var _0x33d0=['getWhatsappQueues','Request','name','timeout','strategy','User','Agents','whatsappPause','../client'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x33d0,0x10d));var _0x033d=function(_0x17ca43,_0x28d8d9){_0x17ca43=_0x17ca43-0x0;var _0x13ca78=_0x33d0[_0x17ca43];return _0x13ca78;};'use strict';var client=require(_0x033d('0x0'));exports[_0x033d('0x1')]=function(){return function(){return client[_0x033d('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x033d('0x3'),_0x033d('0x4'),_0x033d('0x5')],'include':[{'model':_0x033d('0x6'),'as':_0x033d('0x7'),'attributes':['id',_0x033d('0x3'),'online',_0x033d('0x8')]}]},'log':_0x033d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index c9980b1..f10bc52 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 _0x122c=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x847809,_0x51e79e){var _0x598c3f=function(_0x3b1b13){while(--_0x3b1b13){_0x847809['push'](_0x847809['shift']());}};_0x598c3f(++_0x51e79e);}(_0x122c,0x118));var _0xc122=function(_0x439c9b,_0x523f09){_0x439c9b=_0x439c9b-0x0;var _0x30f989=_0x122c[_0x439c9b];return _0x30f989;};'use strict';var client=require(_0xc122('0x0'));exports[_0xc122('0x1')]=function(_0x3a2219){return client[_0xc122('0x2')](_0xc122('0x3'),{'body':_0x3a2219,'log':_0xc122('0x3')});};exports[_0xc122('0x4')]=function(_0x387f94,_0x276120){return client[_0xc122('0x2')](_0xc122('0x5'),{'body':_0x276120,'options':{'where':{'uniqueid':_0x387f94},'order':[['id',_0xc122('0x6')]],'limit':0x1},'log':_0xc122('0x5')});}; \ No newline at end of file +var _0x986e=['DESC','create','Request','update','UpdateWhatsappQueueReport'];(function(_0x28c5f4,_0x2857fa){var _0x4ee57e=function(_0x3de864){while(--_0x3de864){_0x28c5f4['push'](_0x28c5f4['shift']());}};_0x4ee57e(++_0x2857fa);}(_0x986e,0x105));var _0xe986=function(_0x48e84c,_0x35c8e0){_0x48e84c=_0x48e84c-0x0;var _0x1910ba=_0x986e[_0x48e84c];return _0x1910ba;};'use strict';var client=require('../client');exports[_0xe986('0x0')]=function(_0x449345){return client[_0xe986('0x1')]('CreateWhatsappQueueReport',{'body':_0x449345,'log':'CreateWhatsappQueueReport'});};exports[_0xe986('0x2')]=function(_0xcb6494,_0x469900){return client['Request'](_0xe986('0x3'),{'body':_0x469900,'options':{'where':{'uniqueid':_0xcb6494},'order':[['id',_0xe986('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 387b3af..a11bebf 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 _0xcbfe=['channel','START:%s','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xcbfe,0xc9));var _0xecbf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcbfe[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0xecbf('0x0'));var _=require(_0xecbf('0x1'));var util=require(_0xecbf('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xecbf('0x3'))(_0xecbf('0x4'));var strategy=require(_0xecbf('0x5'));var queue=schema({'name':{'type':_0xecbf('0x6'),'required':!![],'message':_0xecbf('0x7')},'timeout':{'type':'number','message':_0xecbf('0x8')}});function writeLog(_0x58a6f7,_0x4ec8cd,_0x26589c){return logger[_0xecbf('0x9')](util[_0xecbf('0xa')](_0xecbf('0xb'),_0x58a6f7,_0x4ec8cd[_0xecbf('0xc')],_0x26589c));}function handleFindAgent(_0x4eebfd){return function(_0x440108){return _0x440108[_0xecbf('0xc')]['toLowerCase']()===_0x4eebfd[_0xecbf('0xd')]();};}exports[_0xecbf('0xe')]=function(_0x488c7f,_0x546ac7,_0x3bfbf2,_0x2eb746){return function(_0x244d71){try{var _0x4af7aa={'name':_0x546ac7[0x0],'timeout':_0x546ac7[0x1]};var _0x3e0cf5=queue[_0xecbf('0x0')](_0x4af7aa,{'typecast':!![]});if(_0x3e0cf5[_0xecbf('0xf')]){logger[_0xecbf('0x10')](_0xecbf('0x11'),_0x488c7f,_[_0xecbf('0x12')](_0x3e0cf5,_0xecbf('0x13'))[_0xecbf('0x14')](',\x20'));_0x244d71[_0xecbf('0x15')]();}else{var _0x256d54=_[_0xecbf('0x16')](_0x3bfbf2[_0xecbf('0x17')],handleFindAgent(_0x4af7aa[_0xecbf('0xc')]));if(_0x256d54){var _0x31cbcf=(_0x4af7aa[_0xecbf('0x18')]||0xa)*0x3e8;var _0x116321,_0x16384d;var _0x3b47e3=seqqueue[_0xecbf('0x19')](_0x31cbcf);_0x3b47e3['id']=_0x488c7f;_0x3b47e3[_0xecbf('0x1a')]=_0x31cbcf;_0x3b47e3[_0xecbf('0x1b')]=_0x2eb746[_0xecbf('0x1b')];writeLog(_0x488c7f,_0x256d54,util[_0xecbf('0xa')](_0xecbf('0x1c'),_0x31cbcf));_0x3bfbf2['rules'][_0x488c7f]['on']('end',function(){logger[_0xecbf('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x488c7f);clearTimeout(_0x16384d);_0x16384d=undefined;_0x3b47e3[_0xecbf('0x1d')]();if(_0x3bfbf2['rules'][_0x488c7f]){delete _0x3bfbf2[_0xecbf('0x1e')][_0x488c7f];}_0x244d71['stop']();});_0x3bfbf2[_0xecbf('0x1e')][_0x488c7f]['on'](_0xecbf('0x1f'),function(){if(_0x3bfbf2['rules'][_0x488c7f]){delete _0x3bfbf2[_0xecbf('0x1e')][_0x488c7f];}});_0x16384d=setTimeout(function(){logger[_0xecbf('0x9')](_0xecbf('0x20'),_0x488c7f);clearTimeout(_0x16384d);_0x3b47e3['close']();_0x244d71[_0xecbf('0x21')]();},_0x31cbcf);strategy['agent'](_0x3b47e3,_0x256d54,_0x3bfbf2,_0x2eb746);}else{logger[_0xecbf('0x10')](_0xecbf('0x22'),_0x488c7f,_0x4af7aa[_0xecbf('0xc')]);_0x244d71[_0xecbf('0x15')]();}}}catch(_0x5b573c){console[_0xecbf('0x23')](_0x5b573c);logger[_0xecbf('0x10')](_0xecbf('0x24'),_0x488c7f,_0x5b573c[_0xecbf('0x25')]);_0x244d71[_0xecbf('0x15')]();}};}; \ No newline at end of file +var _0x1e3e=['format','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','atimeout','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number'];(function(_0x4c62db,_0x31f9bf){var _0x48e398=function(_0x3003b8){while(--_0x3003b8){_0x4c62db['push'](_0x4c62db['shift']());}};_0x48e398(++_0x31f9bf);}(_0x1e3e,0xfa));var _0xe1e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1e3e[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require('validate');var _=require(_0xe1e3('0x0'));var util=require(_0xe1e3('0x1'));var seqqueue=require(_0xe1e3('0x2'));var logger=require(_0xe1e3('0x3'))(_0xe1e3('0x4'));var strategy=require(_0xe1e3('0x5'));var queue=schema({'name':{'type':_0xe1e3('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xe1e3('0x7'),'message':_0xe1e3('0x8')}});function writeLog(_0x32c044,_0x21f80e,_0x18f17f){return logger['info'](util[_0xe1e3('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x32c044,_0x21f80e['name'],_0x18f17f));}function handleFindAgent(_0x4ee087){return function(_0x1b39a8){return _0x1b39a8[_0xe1e3('0xa')][_0xe1e3('0xb')]()===_0x4ee087[_0xe1e3('0xb')]();};}exports[_0xe1e3('0xc')]=function(_0x195467,_0xc92d0f,_0x296e45,_0x2ea348){return function(_0x373b98){try{var _0x4c5267={'name':_0xc92d0f[0x0],'timeout':_0xc92d0f[0x1]};var _0x42a449=queue[_0xe1e3('0xd')](_0x4c5267,{'typecast':!![]});if(_0x42a449[_0xe1e3('0xe')]){logger['error'](_0xe1e3('0xf'),_0x195467,_[_0xe1e3('0x10')](_0x42a449,_0xe1e3('0x11'))[_0xe1e3('0x12')](',\x20'));_0x373b98[_0xe1e3('0x13')]();}else{var _0xd8062d=_[_0xe1e3('0x14')](_0x296e45['agents'],handleFindAgent(_0x4c5267[_0xe1e3('0xa')]));if(_0xd8062d){var _0x1ca9a5=(_0x4c5267[_0xe1e3('0x15')]||0xa)*0x3e8;var _0xe4893c,_0xb85675;var _0x2f8e1a=seqqueue[_0xe1e3('0x16')](_0x1ca9a5);_0x2f8e1a['id']=_0x195467;_0x2f8e1a[_0xe1e3('0x17')]=_0x1ca9a5;_0x2f8e1a['channel']=_0x2ea348['channel'];writeLog(_0x195467,_0xd8062d,util[_0xe1e3('0x9')]('START:%s',_0x1ca9a5));_0x296e45[_0xe1e3('0x18')][_0x195467]['on'](_0xe1e3('0x19'),function(){logger['info'](_0xe1e3('0x1a'),_0x195467);clearTimeout(_0xb85675);_0xb85675=undefined;_0x2f8e1a[_0xe1e3('0x1b')]();if(_0x296e45['rules'][_0x195467]){delete _0x296e45[_0xe1e3('0x18')][_0x195467];}_0x373b98[_0xe1e3('0x13')]();});_0x296e45[_0xe1e3('0x18')][_0x195467]['on'](_0xe1e3('0x1c'),function(){if(_0x296e45[_0xe1e3('0x18')][_0x195467]){delete _0x296e45[_0xe1e3('0x18')][_0x195467];}});_0xb85675=setTimeout(function(){logger[_0xe1e3('0x1d')](_0xe1e3('0x1e'),_0x195467);clearTimeout(_0xb85675);_0x2f8e1a[_0xe1e3('0x1b')]();_0x373b98[_0xe1e3('0x1f')]();},_0x1ca9a5);strategy[_0xe1e3('0x20')](_0x2f8e1a,_0xd8062d,_0x296e45,_0x2ea348);}else{logger['error'](_0xe1e3('0x21'),_0x195467,_0x4c5267['name']);_0x373b98[_0xe1e3('0x13')]();}}}catch(_0x1f4112){console[_0xe1e3('0x22')](_0x1f4112);logger[_0xe1e3('0x23')](_0xe1e3('0x24'),_0x195467,_0x1f4112['stack']);_0x373b98[_0xe1e3('0x13')]();}};}; \ 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 41dd1ad..03d2cae 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 _0xe305=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','AccountId','upperFirst','isEmpty','body','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','postText','amazonlex','dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing'];(function(_0x16dd0c,_0xfc6585){var _0x31d29c=function(_0x30e860){while(--_0x30e860){_0x16dd0c['push'](_0x16dd0c['shift']());}};_0x31d29c(++_0xfc6585);}(_0xe305,0xb6));var _0x5e30=function(_0x552ddd,_0x1d3201){_0x552ddd=_0x552ddd-0x0;var _0x5d4422=_0xe305[_0x552ddd];return _0x5d4422;};'use strict';var _=require(_0x5e30('0x0'));var moment=require(_0x5e30('0x1'));var AWS=require(_0x5e30('0x2'));var utils=require(_0x5e30('0x3'));var logger=require(_0x5e30('0x4'))(_0x5e30('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5e30('0x6')),'mailMessage':require(_0x5e30('0x7')),'smsMessage':require(_0x5e30('0x8')),'faxMessage':require(_0x5e30('0x9')),'whatsappMessage':require(_0x5e30('0xa'))};exports[_0x5e30('0xb')]=function(_0x27e4ba,_0x22f760){return function(_0x5cb398){try{if(!_[_0x5e30('0xc')](this[_0x5e30('0xd')][_0x5e30('0xe')])){logger[_0x5e30('0xf')](_0x5e30('0x10'),_0x27e4ba,_0x5e30('0x11'));return _0x5cb398[_0x5e30('0x12')]();}var _0x1b7065={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5e30('0x13')](_0x5e30('0x14')),'direction':_0x5e30('0x15')};if(this[_0x5e30('0x16')]===_0x5e30('0x17')||this[_0x5e30('0x16')]===_0x5e30('0x18')){_0x1b7065[_0x5e30('0x19')]=this[_0x5e30('0xd')][_0x5e30('0x19')];}var _0x462621=this[_0x5e30('0x16')];if(_0x462621==='chat'){_0x1b7065[_0x5e30('0x1a')]=this[_0x5e30('0x1b')]['id'];}else{_0x1b7065[_['upperFirst'](_0x462621)+_0x5e30('0x1c')]=this[_0x5e30('0x1b')]['id'];}_0x1b7065[_[_0x5e30('0x1d')](_0x462621)+'InteractionId']=this[_0x5e30('0xd')]['id'];if(this[_0x5e30('0xd')]['created']){var _0x664e1a=_0x22f760[0x4];if(!_[_0x5e30('0x1e')](_0x664e1a)){_0x1b7065[_0x5e30('0x1f')]=utils['getMustacheRender'](_0x664e1a,this);return rpc[_0x462621+_0x5e30('0x20')][_0x5e30('0x21')](_0x1b7065)[_0x5e30('0x22')](function(_0x5976fa){logger[_0x5e30('0xf')](_0x5e30('0x10'),_0x27e4ba,_0x1b7065['body']);})[_0x5e30('0x23')](function(_0x3220cf){logger[_0x5e30('0x24')](_0x5e30('0x10'),_0x27e4ba,JSON[_0x5e30('0x25')](_0x3220cf));})[_0x5e30('0x26')](function(){logger[_0x5e30('0xf')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x27e4ba);_0x5cb398['stop']();});}else{logger[_0x5e30('0xf')](_0x5e30('0x27'),_0x27e4ba);_0x5cb398[_0x5e30('0x28')]();}}else{var _0x12b0ff=this;var _0x29b5fe=new AWS[(_0x5e30('0x29'))]({'accessKeyId':_0x22f760[0x0],'secretAccessKey':_0x22f760[0x1],'region':_0x22f760[0x2]});var _0xa60be2={'botAlias':_0x5e30('0x2a'),'botName':_0x22f760[0x3],'inputText':this[_0x5e30('0x2b')][_0x5e30('0x1f')],'userId':this[_0x5e30('0x16')]+':'+this[_0x5e30('0xd')]['id']['toString']()};_0x29b5fe[_0x5e30('0x2c')](_0xa60be2,function(_0x59aff4,_0x8166e){if(_0x59aff4){logger[_0x5e30('0x24')](_0x5e30('0x10'),_0x27e4ba,_0x59aff4[_0x5e30('0x2b')]);_0x5cb398['next']();}else if(_0x8166e&&_0x8166e['message']){_0x12b0ff['body']['amazonlex']=_0x8166e;_0x1b7065['body']=_0x8166e[_0x5e30('0x2b')];_0x1b7065['providerName']=_0x5e30('0x2d');_0x1b7065['providerResponse']=JSON[_0x5e30('0x25')](_0x8166e);return rpc[_0x462621+_0x5e30('0x20')][_0x5e30('0x21')](_0x1b7065)[_0x5e30('0x22')](function(_0x3de0b0){logger[_0x5e30('0xf')]('[%s][AMAZONLEX]\x20%s',_0x27e4ba,_0x1b7065[_0x5e30('0x1f')]);if(_0x8166e[_0x5e30('0x2e')]=='Failed'){_0x5cb398[_0x5e30('0x12')]();}else{_0x5cb398[_0x5e30('0x28')]();}})['catch'](function(_0x564681){logger[_0x5e30('0x24')](_0x5e30('0x10'),_0x27e4ba,JSON[_0x5e30('0x25')](_0x564681));_0x5cb398[_0x5e30('0x12')]();});}else{_0x5cb398[_0x5e30('0x12')]();}});}}catch(_0xfc50e8){logger['error'](_0x5e30('0x10'),_0x27e4ba,JSON['stringify'](_0xfc50e8));_0x5cb398[_0x5e30('0x28')]();}};}; \ No newline at end of file +var _0xbff7=['catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','then'];(function(_0x5ae93d,_0x48a929){var _0x3bc344=function(_0x37d1e8){while(--_0x37d1e8){_0x5ae93d['push'](_0x5ae93d['shift']());}};_0x3bc344(++_0x48a929);}(_0xbff7,0x197));var _0x7bff=function(_0x50323a,_0x4c0406){_0x50323a=_0x50323a-0x0;var _0x1e65d7=_0xbff7[_0x50323a];return _0x1e65d7;};'use strict';var _=require(_0x7bff('0x0'));var moment=require(_0x7bff('0x1'));var AWS=require(_0x7bff('0x2'));var utils=require(_0x7bff('0x3'));var logger=require(_0x7bff('0x4'))('routing');var rpc={'chatMessage':require(_0x7bff('0x5')),'openchannelMessage':require(_0x7bff('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7bff('0x7')),'whatsappMessage':require(_0x7bff('0x8'))};exports[_0x7bff('0x9')]=function(_0x47f417,_0x279914){return function(_0x30c339){try{if(!_[_0x7bff('0xa')](this[_0x7bff('0xb')][_0x7bff('0xc')])){logger[_0x7bff('0xd')](_0x7bff('0xe'),_0x47f417,_0x7bff('0xf'));return _0x30c339['next']();}var _0x28c819={'ContactId':this[_0x7bff('0x10')]['id'],'sentAt':moment()[_0x7bff('0x11')](_0x7bff('0x12')),'direction':_0x7bff('0x13')};if(this['channel']===_0x7bff('0x14')||this[_0x7bff('0x15')]===_0x7bff('0x16')){_0x28c819[_0x7bff('0x17')]=this[_0x7bff('0xb')][_0x7bff('0x17')];}var _0x309806=this[_0x7bff('0x15')];if(_0x309806===_0x7bff('0x18')){_0x28c819['ChatWebsiteId']=this[_0x7bff('0x19')]['id'];}else{_0x28c819[_['upperFirst'](_0x309806)+'AccountId']=this['account']['id'];}_0x28c819[_[_0x7bff('0x1a')](_0x309806)+_0x7bff('0x1b')]=this[_0x7bff('0xb')]['id'];if(this[_0x7bff('0xb')][_0x7bff('0x1c')]){var _0x4d1d07=_0x279914[0x4];if(!_[_0x7bff('0x1d')](_0x4d1d07)){_0x28c819[_0x7bff('0x1e')]=utils[_0x7bff('0x1f')](_0x4d1d07,this);return rpc[_0x309806+_0x7bff('0x20')]['create'](_0x28c819)[_0x7bff('0x21')](function(_0x44ea84){logger['info'](_0x7bff('0xe'),_0x47f417,_0x28c819[_0x7bff('0x1e')]);})[_0x7bff('0x22')](function(_0x4a4c3e){logger[_0x7bff('0x23')](_0x7bff('0xe'),_0x47f417,JSON[_0x7bff('0x24')](_0x4a4c3e));})[_0x7bff('0x25')](function(){logger[_0x7bff('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x47f417);_0x30c339[_0x7bff('0x26')]();});}else{logger[_0x7bff('0xd')](_0x7bff('0x27'),_0x47f417);_0x30c339[_0x7bff('0x26')]();}}else{var _0x5839ca=this;var _0x46273f=new AWS[(_0x7bff('0x28'))]({'accessKeyId':_0x279914[0x0],'secretAccessKey':_0x279914[0x1],'region':_0x279914[0x2]});var _0x554ec6={'botAlias':_0x7bff('0x29'),'botName':_0x279914[0x3],'inputText':this[_0x7bff('0x2a')][_0x7bff('0x1e')],'userId':this['channel']+':'+this['interaction']['id'][_0x7bff('0x2b')]()};_0x46273f[_0x7bff('0x2c')](_0x554ec6,function(_0x51e590,_0x2b6cf5){if(_0x51e590){logger[_0x7bff('0x23')]('[%s][AMAZONLEX]\x20%s',_0x47f417,_0x51e590['message']);_0x30c339[_0x7bff('0x2d')]();}else if(_0x2b6cf5&&_0x2b6cf5[_0x7bff('0x2a')]){_0x5839ca[_0x7bff('0x1e')][_0x7bff('0x2e')]=_0x2b6cf5;_0x28c819[_0x7bff('0x1e')]=_0x2b6cf5[_0x7bff('0x2a')];_0x28c819['providerName']=_0x7bff('0x2e');_0x28c819['providerResponse']=JSON['stringify'](_0x2b6cf5);return rpc[_0x309806+_0x7bff('0x20')]['create'](_0x28c819)[_0x7bff('0x21')](function(_0x316b3f){logger[_0x7bff('0xd')](_0x7bff('0xe'),_0x47f417,_0x28c819[_0x7bff('0x1e')]);if(_0x2b6cf5[_0x7bff('0x2f')]==_0x7bff('0x30')){_0x30c339[_0x7bff('0x2d')]();}else{_0x30c339[_0x7bff('0x26')]();}})[_0x7bff('0x22')](function(_0x3b27b1){logger[_0x7bff('0x23')](_0x7bff('0xe'),_0x47f417,JSON['stringify'](_0x3b27b1));_0x30c339[_0x7bff('0x2d')]();});}else{_0x30c339['next']();}});}}catch(_0x1cdd43){logger['error'](_0x7bff('0xe'),_0x47f417,JSON[_0x7bff('0x24')](_0x1cdd43));_0x30c339[_0x7bff('0x26')]();}};}; \ 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 88a59e5..ace0a96 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 _0xeaaf=['[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','smtpOptions','then'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0xeaaf,0x19d));var _0xfeaa=function(_0x49bec4,_0x541f3c){_0x49bec4=_0x49bec4-0x0;var _0x4c68ed=_0xeaaf[_0x49bec4];return _0x4c68ed;};'use strict';var _=require(_0xfeaa('0x0'));var moment=require(_0xfeaa('0x1'));var utils=require(_0xfeaa('0x2'));var logger=require(_0xfeaa('0x3'))(_0xfeaa('0x4'));var rpc={'chatMessage':require(_0xfeaa('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xfeaa('0x6')),'faxMessage':require(_0xfeaa('0x7')),'whatsappMessage':require(_0xfeaa('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xfeaa('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xfeaa('0xa')),'whatsappInteraction':require(_0xfeaa('0xb'))};var mailRpc=require(_0xfeaa('0xc'));exports['consequence']=function(_0x52ffe5,_0x15c5b1,_0x1198c1,_0x54b5d3){return function(_0x3061a6){try{var _0xaba1b5=this[_0xfeaa('0xd')];if(_0xaba1b5===_0xfeaa('0xe')&&_0x54b5d3[_0xfeaa('0xf')][_0xfeaa('0x10')]){logger[_0xfeaa('0x11')](_0xfeaa('0x12'),_0x52ffe5,_0xfeaa('0x13'));return _0x3061a6[_0xfeaa('0x14')]();}if(_0x15c5b1[0x0]==='1'&&(_[_0xfeaa('0x15')](this['interaction'][_0xfeaa('0x16')])||!this[_0xfeaa('0x17')]['created'])){logger['info'](_0xfeaa('0x12'),_0x52ffe5,'Autoreply\x20already\x20sent');return _0x3061a6[_0xfeaa('0x14')]();}if(_0x15c5b1[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info'](_0xfeaa('0x18'),_0x52ffe5,_0xfeaa('0x19'));return _0x3061a6[_0xfeaa('0x14')]();}var _0x22d682={'ContactId':this[_0xfeaa('0x1a')]['id'],'sentAt':moment()[_0xfeaa('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xfeaa('0xd')]===_0xfeaa('0xe')){_0x22d682['body']=utils[_0xfeaa('0x1c')](_0x15c5b1[0x2],this);}else{_0x22d682[_0xfeaa('0xf')]=utils[_0xfeaa('0x1c')](_0x15c5b1[0x1],this);}if(this[_0xfeaa('0x1d')]){_0x22d682['to']=this[_0xfeaa('0x1d')][_0xfeaa('0x1e')]||'';if(this[_0xfeaa('0xd')]===_0xfeaa('0xe')&&_0x15c5b1[0x1]==='1'){_0x22d682['cc']=this['message']['cc']||'';}_0x22d682['from']=this[_0xfeaa('0x1d')]['to']||'';_0x22d682[_0xfeaa('0x1f')]=this['message'][_0xfeaa('0x1f')]||'';_0x22d682[_0xfeaa('0x20')]=!![];if(this[_0xfeaa('0x1d')][_0xfeaa('0x21')]){_0x22d682[_0xfeaa('0x21')]='';_0x22d682[_0xfeaa('0x21')]+=_['startsWith'](this[_0xfeaa('0x1d')][_0xfeaa('0x21')],_0xfeaa('0x22'))?'':_0xfeaa('0x23');_0x22d682[_0xfeaa('0x21')]+=this[_0xfeaa('0x1d')][_0xfeaa('0x21')];}}if(this[_0xfeaa('0xd')]==='chat'){_0x22d682[_0xfeaa('0x24')]=this[_0xfeaa('0x25')]['id'];}else{_0x22d682[_[_0xfeaa('0x26')](this[_0xfeaa('0xd')])+_0xfeaa('0x27')]=this['account']['id'];}_0x22d682[_[_0xfeaa('0x26')](this['channel'])+_0xfeaa('0x28')]=this[_0xfeaa('0x17')]['id'];var _0x3a9738=this[_0xfeaa('0x17')];if(rpc[this[_0xfeaa('0xd')]+_0xfeaa('0x29')]){if(this['channel']===_0xfeaa('0xe')){_0x22d682[_0xfeaa('0x2a')]=this[_0xfeaa('0x1d')][_0xfeaa('0x2b')];_0x22d682[_0xfeaa('0x2c')]=_0xfeaa('0x2d')+_[_0xfeaa('0x2e')](_0x22d682[_0xfeaa('0xf')],_0xfeaa('0x2f'),_0xfeaa('0x30'))+_0xfeaa('0x31');_0x22d682[_0xfeaa('0x32')]={'Auto-Submitted':_0xfeaa('0x33'),'X-Auto-Response-Suppress':_0xfeaa('0x34'),'Precedence':_0xfeaa('0x35')};return mailRpc['sendMailMessage'](this[_0xfeaa('0x25')][_0xfeaa('0x36')],_0x22d682)[_0xfeaa('0x37')](function(_0x249238){logger['info'](_0xfeaa('0x38'),_0x52ffe5);_0x22d682[_0xfeaa('0x2b')]=_0x249238[_0xfeaa('0x1d')][_0xfeaa('0x2b')];return rpc[_0xaba1b5+_0xfeaa('0x29')][_0xfeaa('0x39')](_0x22d682);})[_0xfeaa('0x37')](function(_0x3fb20c){logger['info'](_0xfeaa('0x12'),_0x52ffe5,JSON[_0xfeaa('0x3a')](_0x3fb20c));})[_0xfeaa('0x3b')](function(_0x1ca738){logger[_0xfeaa('0x3c')]('[RPC][%s][AUTOREPLY]\x20%s',_0x52ffe5,JSON[_0xfeaa('0x3a')](_0x1ca738));})['finally'](function(){Promise['resolve']()[_0xfeaa('0x37')](function(){if(_0x15c5b1[0x0]!=='2'||_0x3a9738[_0xfeaa('0x3d')])return;return rpc[_0xaba1b5+_0xfeaa('0x3e')][_0xfeaa('0x3f')](_0x3a9738['id'],{'autoreplyExecuted':!![]})[_0xfeaa('0x37')](function(_0xa68ec8){logger[_0xfeaa('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x52ffe5,JSON[_0xfeaa('0x3a')](_0xa68ec8));})[_0xfeaa('0x3b')](function(_0xc73084){logger[_0xfeaa('0x3c')](_0xfeaa('0x40'),_0x52ffe5,JSON[_0xfeaa('0x3a')](_0xc73084));});})[_0xfeaa('0x37')](function(){_0x3061a6[_0xfeaa('0x14')]();});});}else{return rpc[this['channel']+_0xfeaa('0x29')][_0xfeaa('0x39')](_0x22d682)[_0xfeaa('0x37')](function(){logger[_0xfeaa('0x11')](_0xfeaa('0x12'),_0x52ffe5,_0x22d682[_0xfeaa('0xf')]);})[_0xfeaa('0x3b')](function(_0x5f169c){logger['error'](_0xfeaa('0x12'),_0x52ffe5,JSON[_0xfeaa('0x3a')](_0x5f169c));})['finally'](function(){Promise[_0xfeaa('0x41')]()['then'](function(){if(_0x15c5b1[0x0]!=='2'||_0x3a9738[_0xfeaa('0x3d')])return;return rpc[_0xaba1b5+'Interaction'][_0xfeaa('0x3f')](_0x3a9738['id'],{'autoreplyExecuted':!![]})[_0xfeaa('0x37')](function(_0x5b267b){logger[_0xfeaa('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x52ffe5,JSON[_0xfeaa('0x3a')](_0x5b267b));})[_0xfeaa('0x3b')](function(_0x46502d){logger[_0xfeaa('0x3c')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x52ffe5,JSON[_0xfeaa('0x3a')](_0x46502d));});})[_0xfeaa('0x37')](function(){_0x3061a6['next']();});});}}}catch(_0x6b6e6){logger[_0xfeaa('0x3c')](_0xfeaa('0x12'),_0x52ffe5,JSON[_0xfeaa('0x3a')](_0x6b6e6));_0x3061a6[_0xfeaa('0x42')]();}};}; \ No newline at end of file +var _0x40ac=['create','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','out','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','AccountId','InteractionId','Message','messageId','','replace','';_0xf3fbe0[_0xc40a('0x2f')]={'Auto-Submitted':_0xc40a('0x30'),'X-Auto-Response-Suppress':_0xc40a('0x31'),'Precedence':_0xc40a('0x32')};return mailRpc[_0xc40a('0x33')](this['account'][_0xc40a('0x34')],_0xf3fbe0)[_0xc40a('0x35')](function(_0x35b87e){logger[_0xc40a('0x13')](_0xc40a('0x36'),_0x3e1c39);_0xf3fbe0[_0xc40a('0x2a')]=_0x35b87e['message'][_0xc40a('0x2a')];return rpc[_0x2a75e4+'Message'][_0xc40a('0x37')](_0xf3fbe0);})[_0xc40a('0x35')](function(_0x35e4ef){logger[_0xc40a('0x13')]('[%s][AUTOREPLY]\x20%s',_0x3e1c39,JSON['stringify'](_0x35e4ef));})['catch'](function(_0x4027f1){logger[_0xc40a('0x38')](_0xc40a('0x39'),_0x3e1c39,JSON[_0xc40a('0x3a')](_0x4027f1));})[_0xc40a('0x3b')](function(){Promise[_0xc40a('0x3c')]()[_0xc40a('0x35')](function(){if(_0x45bf14[0x0]!=='2'||_0x35057c[_0xc40a('0x1a')])return;return rpc[_0x2a75e4+'Interaction'][_0xc40a('0x3d')](_0x35057c['id'],{'autoreplyExecuted':!![]})[_0xc40a('0x35')](function(_0x555711){logger[_0xc40a('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3e1c39,JSON['stringify'](_0x555711));})['catch'](function(_0x17470b){logger[_0xc40a('0x38')](_0xc40a('0x3e'),_0x3e1c39,JSON[_0xc40a('0x3a')](_0x17470b));});})['then'](function(){_0x30b097[_0xc40a('0x15')]();});});}else{return rpc[this['channel']+_0xc40a('0x29')][_0xc40a('0x37')](_0xf3fbe0)['then'](function(){logger[_0xc40a('0x13')](_0xc40a('0x18'),_0x3e1c39,_0xf3fbe0[_0xc40a('0x12')]);})[_0xc40a('0x3f')](function(_0x354a5d){logger[_0xc40a('0x38')]('[%s][AUTOREPLY]\x20%s',_0x3e1c39,JSON[_0xc40a('0x3a')](_0x354a5d));})['finally'](function(){Promise[_0xc40a('0x3c')]()[_0xc40a('0x35')](function(){if(_0x45bf14[0x0]!=='2'||_0x35057c[_0xc40a('0x1a')])return;return rpc[_0x2a75e4+_0xc40a('0x40')][_0xc40a('0x3d')](_0x35057c['id'],{'autoreplyExecuted':!![]})[_0xc40a('0x35')](function(_0x35ac51){logger[_0xc40a('0x13')](_0xc40a('0x41'),_0x3e1c39,JSON[_0xc40a('0x3a')](_0x35ac51));})[_0xc40a('0x3f')](function(_0x1db780){logger[_0xc40a('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3e1c39,JSON[_0xc40a('0x3a')](_0x1db780));});})[_0xc40a('0x35')](function(){_0x30b097[_0xc40a('0x15')]();});});}}}catch(_0x1e7ecf){logger[_0xc40a('0x38')](_0xc40a('0x18'),_0x3e1c39,JSON[_0xc40a('0x3a')](_0x1e7ecf));_0x30b097[_0xc40a('0x42')]();}};}; \ 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 957fb0d..07bdeb6 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 _0x0db9=['finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0db9,0xbb));var _0x90db=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x0db9[_0x67f95e];return _0x538f5a;};'use strict';var moment=require(_0x90db('0x0'));var logger=require(_0x90db('0x1'))(_0x90db('0x2'));var rpc={'chatInteraction':require(_0x90db('0x3')),'openchannelInteraction':require(_0x90db('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x90db('0x5')),'faxInteraction':require(_0x90db('0x6')),'whatsappInteraction':require(_0x90db('0x7'))};exports['consequence']=function(_0x3e2e3d,_0x1e9645,_0x1d7ddc,_0x1d794f){return function(_0x42b21d){try{logger['info'](_0x90db('0x8'),_0x3e2e3d,_0x1e9645[0x0]);var _0x50252b={'closed':0x1,'closedAt':moment()[_0x90db('0x9')](_0x90db('0xa')),'closeReason':'system','disposition':_0x1e9645[0x0]};if(rpc[_0x1d794f['channel']+'Interaction']){rpc[_0x1d794f[_0x90db('0xb')]+_0x90db('0xc')][_0x90db('0xd')](_0x1d794f[_0x90db('0xe')]['id'],_0x50252b)[_0x90db('0xf')](function(_0x4497de){logger[_0x90db('0x10')](_0x90db('0x11'),_0x3e2e3d,_0x1d794f['interaction']['id']);})['catch'](function(_0x22765b){logger[_0x90db('0x12')]('[%s][CLOSE]\x20%s',_0x3e2e3d,JSON[_0x90db('0x13')](_0x22765b));})[_0x90db('0x14')](function(){_0x42b21d[_0x90db('0x15')]();});}}catch(_0x4772dd){logger[_0x90db('0x12')](_0x90db('0x16'),_0x3e2e3d,JSON['stringify'](_0x4772dd));_0x42b21d[_0x90db('0x15')]();}};}; \ No newline at end of file +var _0x94bb=['../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','interaction','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x381a49,_0x952b58){var _0x4a5ddd=function(_0x3e3a65){while(--_0x3e3a65){_0x381a49['push'](_0x381a49['shift']());}};_0x4a5ddd(++_0x952b58);}(_0x94bb,0x10b));var _0xb94b=function(_0x411631,_0x5cc5c3){_0x411631=_0x411631-0x0;var _0x490190=_0x94bb[_0x411631];return _0x490190;};'use strict';var moment=require(_0xb94b('0x0'));var logger=require(_0xb94b('0x1'))(_0xb94b('0x2'));var rpc={'chatInteraction':require(_0xb94b('0x3')),'openchannelInteraction':require(_0xb94b('0x4')),'smsInteraction':require(_0xb94b('0x5')),'mailInteraction':require(_0xb94b('0x6')),'faxInteraction':require(_0xb94b('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xb94b('0x8')]=function(_0xbad212,_0x424135,_0x436cbf,_0x308b85){return function(_0x5f0d8c){try{logger['info'](_0xb94b('0x9'),_0xbad212,_0x424135[0x0]);var _0x41b0c2={'closed':0x1,'closedAt':moment()[_0xb94b('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x424135[0x0]};if(rpc[_0x308b85[_0xb94b('0xb')]+_0xb94b('0xc')]){rpc[_0x308b85['channel']+_0xb94b('0xc')]['update'](_0x308b85[_0xb94b('0xd')]['id'],_0x41b0c2)['then'](function(_0x4364e5){logger[_0xb94b('0xe')](_0xb94b('0xf'),_0xbad212,_0x308b85['interaction']['id']);})['catch'](function(_0x48fd73){logger[_0xb94b('0x10')](_0xb94b('0x11'),_0xbad212,JSON[_0xb94b('0x12')](_0x48fd73));})[_0xb94b('0x13')](function(){_0x5f0d8c[_0xb94b('0x14')]();});}}catch(_0x9f8178){logger[_0xb94b('0x10')](_0xb94b('0x11'),_0xbad212,JSON['stringify'](_0x9f8178));_0x5f0d8c[_0xb94b('0x14')]();}};}; \ 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 e4ac2a4..52c7531 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 _0x9bd9=['interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','create','body','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','then','dialogflow','result','fulfillment','providerName','stringify','metadata','endConversation','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x1a7ab0,_0x30092f){var _0x4a8687=function(_0x160df1){while(--_0x160df1){_0x1a7ab0['push'](_0x1a7ab0['shift']());}};_0x4a8687(++_0x30092f);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x1867e3,_0x30e5ce){_0x1867e3=_0x1867e3-0x0;var _0x494e32=_0x9bd9[_0x1867e3];return _0x494e32;};'use strict';var _=require(_0x99bd('0x0'));var moment=require(_0x99bd('0x1'));var apiai=require(_0x99bd('0x2'));var md5=require(_0x99bd('0x3'));var utils=require(_0x99bd('0x4'));var logger=require(_0x99bd('0x5'))('routing');var rpc={'chatMessage':require(_0x99bd('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x99bd('0x7')),'smsMessage':require(_0x99bd('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x99bd('0x9'))};exports[_0x99bd('0xa')]=function(_0x1628ac,_0x3807cd){return function(_0x2b8c78){try{if(!_[_0x99bd('0xb')](this[_0x99bd('0xc')][_0x99bd('0xd')])){logger[_0x99bd('0xe')](_0x99bd('0xf'),_0x1628ac,_0x99bd('0x10'));return _0x2b8c78[_0x99bd('0x11')]();}var _0x2ded61={'ContactId':this[_0x99bd('0x12')]['id'],'sentAt':moment()['format'](_0x99bd('0x13')),'direction':'out'};if(this[_0x99bd('0x14')]==='sms'||this[_0x99bd('0x14')]===_0x99bd('0x15')){_0x2ded61['phone']=this[_0x99bd('0xc')]['phone'];}var _0x223921=this['channel'];if(_0x223921===_0x99bd('0x16')){_0x2ded61[_0x99bd('0x17')]=this[_0x99bd('0x18')]['id'];}else{_0x2ded61[_['upperFirst'](_0x223921)+_0x99bd('0x19')]=this[_0x99bd('0x18')]['id'];}_0x2ded61[_[_0x99bd('0x1a')](_0x223921)+_0x99bd('0x1b')]=this[_0x99bd('0xc')]['id'];if(this[_0x99bd('0xc')][_0x99bd('0x1c')]){var _0x1ee2d2=_0x3807cd[0x2];if(!_[_0x99bd('0x1d')](_0x1ee2d2)){_0x2ded61['body']=utils[_0x99bd('0x1e')](_0x1ee2d2,this);return rpc[_0x223921+_0x99bd('0x1f')][_0x99bd('0x20')](_0x2ded61)['then'](function(_0x4b98fc){logger[_0x99bd('0xe')](_0x99bd('0xf'),_0x1628ac,_0x2ded61[_0x99bd('0x21')]);})[_0x99bd('0x22')](function(_0x1bc297){logger['error'](_0x99bd('0xf'),_0x1628ac,JSON['stringify'](_0x1bc297));})[_0x99bd('0x23')](function(){logger[_0x99bd('0xe')](_0x99bd('0x24'),_0x1628ac);_0x2b8c78[_0x99bd('0x25')]();});}else{logger[_0x99bd('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1628ac);_0x2b8c78[_0x99bd('0x25')]();}}else{var _0x229322=this;var _0x3e339c=apiai(_0x3807cd[0x0],{'language':_0x3807cd[0x1]||'en'});return _0x3e339c['textRequest'](this[_0x99bd('0x26')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0x99bd('0x27')](function(_0xfdc455){_0x229322['body'][_0x99bd('0x28')]=_0xfdc455;_0x2ded61[_0x99bd('0x21')]=_0xfdc455[_0x99bd('0x29')][_0x99bd('0x2a')]['speech'];_0x2ded61[_0x99bd('0x2b')]='dialogflow';_0x2ded61['providerResponse']=JSON[_0x99bd('0x2c')](_0xfdc455);return rpc[_0x223921+'Message'][_0x99bd('0x20')](_0x2ded61)['then'](function(_0x348e18){logger[_0x99bd('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x1628ac,_0x2ded61['body']);if(_0xfdc455[_0x99bd('0x29')][_0x99bd('0x2d')][_0x99bd('0x2e')]){_0x2b8c78['next']();}else{_0x2b8c78[_0x99bd('0x25')]();}})[_0x99bd('0x22')](function(_0x2250d8){logger['error'](_0x99bd('0xf'),_0x1628ac,JSON[_0x99bd('0x2c')](_0x2250d8));_0x2b8c78['next']();});})[_0x99bd('0x22')](function(_0x733bca){logger[_0x99bd('0x2f')](_0x99bd('0xf'),_0x1628ac,_0x733bca['message']);_0x2b8c78[_0x99bd('0x11')]();});}}catch(_0x22ef33){logger['error'](_0x99bd('0xf'),_0x1628ac,JSON['stringify'](_0x22ef33));_0x2b8c78['stop']();}};}; \ No newline at end of file +var _0x6bac=['AccountId','account','InteractionId','created','then','body','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','create','metadata','endConversation','next','catch','[%s][DIALOGFLOW]\x20%s','lodash','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','info','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','interaction','upperFirst'];(function(_0xfec1be,_0x5e1c4b){var _0x26a0d4=function(_0x1e9aea){while(--_0x1e9aea){_0xfec1be['push'](_0xfec1be['shift']());}};_0x26a0d4(++_0x5e1c4b);}(_0x6bac,0xa5));var _0xc6ba=function(_0xcb59f0,_0x47b2ec){_0xcb59f0=_0xcb59f0-0x0;var _0x41b999=_0x6bac[_0xcb59f0];return _0x41b999;};'use strict';var _=require(_0xc6ba('0x0'));var moment=require('moment');var apiai=require(_0xc6ba('0x1'));var md5=require(_0xc6ba('0x2'));var utils=require(_0xc6ba('0x3'));var logger=require(_0xc6ba('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc6ba('0x5')),'smsMessage':require(_0xc6ba('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc6ba('0x7'))};exports[_0xc6ba('0x8')]=function(_0x33167e,_0x42858b){return function(_0x12d6e9){try{if(!_[_0xc6ba('0x9')](this['interaction']['UserId'])){logger[_0xc6ba('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x33167e,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x12d6e9['next']();}var _0x530397={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc6ba('0xb')](_0xc6ba('0xc')),'direction':_0xc6ba('0xd')};if(this[_0xc6ba('0xe')]===_0xc6ba('0xf')||this['channel']==='whatsapp'){_0x530397[_0xc6ba('0x10')]=this[_0xc6ba('0x11')][_0xc6ba('0x10')];}var _0x27b00a=this[_0xc6ba('0xe')];if(_0x27b00a==='chat'){_0x530397['ChatWebsiteId']=this['account']['id'];}else{_0x530397[_[_0xc6ba('0x12')](_0x27b00a)+_0xc6ba('0x13')]=this[_0xc6ba('0x14')]['id'];}_0x530397[_[_0xc6ba('0x12')](_0x27b00a)+_0xc6ba('0x15')]=this[_0xc6ba('0x11')]['id'];if(this[_0xc6ba('0x11')][_0xc6ba('0x16')]){var _0x5c1a16=_0x42858b[0x2];if(!_['isEmpty'](_0x5c1a16)){_0x530397['body']=utils['getMustacheRender'](_0x5c1a16,this);return rpc[_0x27b00a+'Message']['create'](_0x530397)[_0xc6ba('0x17')](function(_0x15a135){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x33167e,_0x530397[_0xc6ba('0x18')]);})['catch'](function(_0x125655){logger[_0xc6ba('0x19')]('[%s][DIALOGFLOW]\x20%s',_0x33167e,JSON[_0xc6ba('0x1a')](_0x125655));})[_0xc6ba('0x1b')](function(){logger['info'](_0xc6ba('0x1c'),_0x33167e);_0x12d6e9[_0xc6ba('0x1d')]();});}else{logger[_0xc6ba('0xa')](_0xc6ba('0x1e'),_0x33167e);_0x12d6e9[_0xc6ba('0x1d')]();}}else{var _0x3f7082=this;var _0xc2de63=apiai(_0x42858b[0x0],{'language':_0x42858b[0x1]||'en'});return _0xc2de63[_0xc6ba('0x1f')](this[_0xc6ba('0x20')][_0xc6ba('0x18')],{'sessionId':md5(this[_0xc6ba('0x11')]['id'])})[_0xc6ba('0x17')](function(_0x4a2082){_0x3f7082[_0xc6ba('0x18')][_0xc6ba('0x21')]=_0x4a2082;_0x530397['body']=_0x4a2082[_0xc6ba('0x22')][_0xc6ba('0x23')][_0xc6ba('0x24')];_0x530397[_0xc6ba('0x25')]=_0xc6ba('0x21');_0x530397[_0xc6ba('0x26')]=JSON['stringify'](_0x4a2082);return rpc[_0x27b00a+_0xc6ba('0x27')][_0xc6ba('0x28')](_0x530397)['then'](function(_0x1f2d1a){logger[_0xc6ba('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x33167e,_0x530397[_0xc6ba('0x18')]);if(_0x4a2082['result'][_0xc6ba('0x29')][_0xc6ba('0x2a')]){_0x12d6e9[_0xc6ba('0x2b')]();}else{_0x12d6e9[_0xc6ba('0x1d')]();}})['catch'](function(_0x4fe380){logger[_0xc6ba('0x19')]('[%s][DIALOGFLOW]\x20%s',_0x33167e,JSON[_0xc6ba('0x1a')](_0x4fe380));_0x12d6e9['next']();});})[_0xc6ba('0x2c')](function(_0x1181ca){logger['error'](_0xc6ba('0x2d'),_0x33167e,_0x1181ca[_0xc6ba('0x20')]);_0x12d6e9[_0xc6ba('0x2b')]();});}}catch(_0x1c350b){logger[_0xc6ba('0x19')](_0xc6ba('0x2d'),_0x33167e,JSON['stringify'](_0x1c350b));_0x12d6e9[_0xc6ba('0x1d')]();}};}; \ 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 000f136..9f3a5e1 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 _0xe288=['../../rpc/whatsappMessage','clone','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','getMustacheRender','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','length','fulfillmentText','push','all','next','error','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe288,0x104));var _0x8e28=function(_0x1df14f,_0x122ced){_0x1df14f=_0x1df14f-0x0;var _0x3f6e46=_0xe288[_0x1df14f];return _0x3f6e46;};'use strict';var _=require(_0x8e28('0x0'));var dialogflow=require(_0x8e28('0x1'));var md5=require(_0x8e28('0x2'));var moment=require(_0x8e28('0x3'));var Promise=require(_0x8e28('0x4'));var logger=require(_0x8e28('0x5'))(_0x8e28('0x6'));var utils=require(_0x8e28('0x7'));var rpc={'chatMessage':require(_0x8e28('0x8')),'openchannelMessage':require(_0x8e28('0x9')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8e28('0xa')),'faxMessage':require(_0x8e28('0xb')),'whatsappMessage':require(_0x8e28('0xc'))};function createMessage(_0x53dc76,_0x807217,_0x455626,_0x59374a){return new Promise(function(_0x444f2a,_0x10a3e1){var _0x31b00c=_[_0x8e28('0xd')](_0x455626);_0x31b00c[_0x8e28('0xe')]=_0x59374a;return rpc[_0x807217+_0x8e28('0xf')][_0x8e28('0x10')](_0x31b00c)[_0x8e28('0x11')](function(){logger['info'](_0x8e28('0x12'),_0x53dc76,_0x31b00c[_0x8e28('0xe')]);_0x444f2a();})[_0x8e28('0x13')](function(_0x4850b1){logger['error'](_0x8e28('0x12'),_0x53dc76,JSON[_0x8e28('0x14')](_0x4850b1));_0x10a3e1(_0x4850b1);});});}exports[_0x8e28('0x15')]=function(_0x46d60d,_0x570864){return function(_0x2de3af){try{if(!_['isNil'](this[_0x8e28('0x16')]['UserId'])){logger[_0x8e28('0x17')]('[%s][DIALOGFLOWV2]\x20%s',_0x46d60d,_0x8e28('0x18'));return _0x2de3af['next']();}var _0x129928={'ContactId':this[_0x8e28('0x19')]['id'],'sentAt':moment()[_0x8e28('0x1a')](_0x8e28('0x1b')),'direction':_0x8e28('0x1c')};if(this['channel']==='sms'||this[_0x8e28('0x1d')]===_0x8e28('0x1e')){_0x129928['phone']=this[_0x8e28('0x16')][_0x8e28('0x1f')];}var _0x5a325a=this[_0x8e28('0x1d')];if(_0x5a325a===_0x8e28('0x20')){_0x129928['ChatWebsiteId']=this[_0x8e28('0x21')]['id'];}else{_0x129928[_[_0x8e28('0x22')](_0x5a325a)+_0x8e28('0x23')]=this[_0x8e28('0x21')]['id'];}_0x129928[_[_0x8e28('0x22')](_0x5a325a)+'InteractionId']=this['interaction']['id'];if(this[_0x8e28('0x16')]['created']){var _0x3306ab=_0x570864[0x4];if(!_['isEmpty'](_0x3306ab)){_0x129928[_0x8e28('0xe')]=utils[_0x8e28('0x24')](_0x3306ab,this);return rpc[_0x5a325a+_0x8e28('0xf')]['create'](_0x129928)['then'](function(_0x55ac67){logger[_0x8e28('0x17')](_0x8e28('0x12'),_0x46d60d,_0x129928['body']);})[_0x8e28('0x13')](function(_0x4d61e7){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x46d60d,JSON[_0x8e28('0x14')](_0x4d61e7));})['finally'](function(){logger[_0x8e28('0x17')](_0x8e28('0x25'),_0x46d60d);_0x2de3af[_0x8e28('0x26')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x46d60d);_0x2de3af[_0x8e28('0x26')]();}}else{var _0x1680f8=this;var _0x21bfd7=_0x570864[0x2][_0x8e28('0x27')](/\\n/g,'\x0a');var _0x45c644={'credentials':{'private_key':_0x21bfd7,'client_email':_0x570864[0x1]}};var _0x449197=new dialogflow[(_0x8e28('0x28'))](_0x45c644);var _0x49f009=_0x449197[_0x8e28('0x29')](_0x570864[0x0],md5(_0x1680f8[_0x8e28('0x16')]['id']));var _0x2f6c54={'session':_0x49f009,'queryInput':{'text':{'text':_0x1680f8[_0x8e28('0x2a')]['body'],'languageCode':_0x570864[0x3]||'en'}}};return _0x449197['detectIntent'](_0x2f6c54)[_0x8e28('0x11')](function(_0x22d336){if(_0x22d336&&_0x22d336['length']){_0x1680f8[_0x8e28('0xe')][_0x8e28('0x2b')]=_0x22d336;var _0x354174=_0x22d336[0x0];var _0x3d7f19=_0x354174[_0x8e28('0x2c')][_0x8e28('0x2d')]&&_0x354174[_0x8e28('0x2c')][_0x8e28('0x2d')][_0x8e28('0x2e')]?_0x354174[_0x8e28('0x2c')]['diagnosticInfo'][_0x8e28('0x2e')][_0x8e28('0x2f')]['boolValue']:![];_0x1680f8[_0x8e28('0xe')][_0x8e28('0x30')]=_0x354174[_0x8e28('0x2c')][_0x8e28('0x31')];_0x1680f8[_0x8e28('0xe')][_0x8e28('0x32')]=_0x354174['queryResult']['allRequiredParamsPresent'];_0x1680f8['body'][_0x8e28('0x33')]=_0x354174[_0x8e28('0x2c')][_0x8e28('0x2d')]&&_0x354174[_0x8e28('0x2c')][_0x8e28('0x2d')][_0x8e28('0x2e')]?_0x354174[_0x8e28('0x2c')][_0x8e28('0x2d')][_0x8e28('0x2e')][_0x8e28('0x2f')]['boolValue']:![];_0x1680f8[_0x8e28('0xe')]['DIALOGFLOWV2_INTENTNAME']=_0x354174[_0x8e28('0x2c')]['intent'][_0x8e28('0x34')];_0x1680f8[_0x8e28('0xe')][_0x8e28('0x35')]=_0x354174['queryResult'][_0x8e28('0x36')]['displayName'];_0x1680f8[_0x8e28('0xe')][_0x8e28('0x37')]=_0x354174['queryResult'][_0x8e28('0x36')]['isFallback'];_0x1680f8[_0x8e28('0xe')][_0x8e28('0x38')]=_0x354174[_0x8e28('0x2c')][_0x8e28('0x39')];_0x1680f8['body'][_0x8e28('0x3a')]=_0x354174[_0x8e28('0x2c')][_0x8e28('0x3b')];_0x1680f8[_0x8e28('0xe')]['DIALOGFLOWV2_SCORE']=_0x354174[_0x8e28('0x2c')][_0x8e28('0x3c')];_0x129928[_0x8e28('0x3d')]=_0x8e28('0x2b');_0x129928['providerResponse']=JSON[_0x8e28('0x14')](_0x22d336);var _0x45ce06=[];for(var _0x57f753=0x0;_0x57f753<_0x22d336[_0x8e28('0x3e')];_0x57f753++){var _0x44dae1=_0x22d336[_0x57f753];if(_0x44dae1&&_0x44dae1[_0x8e28('0x2c')]&&_0x44dae1[_0x8e28('0x2c')][_0x8e28('0x3f')]){_0x45ce06[_0x8e28('0x40')](createMessage(_0x46d60d,_0x5a325a,_0x129928,_0x44dae1[_0x8e28('0x2c')]['fulfillmentText']));}}return Promise[_0x8e28('0x41')](_0x45ce06)[_0x8e28('0x11')](function(){if(_0x3d7f19){_0x2de3af[_0x8e28('0x42')]();}else{_0x2de3af['stop']();}})[_0x8e28('0x13')](function(_0x4db567){logger[_0x8e28('0x43')](_0x8e28('0x12'),_0x46d60d,JSON[_0x8e28('0x14')](_0x4db567));_0x2de3af[_0x8e28('0x42')]();});}})[_0x8e28('0x13')](function(_0x2ef73f){logger[_0x8e28('0x43')](_0x8e28('0x12'),_0x46d60d,_0x2ef73f[_0x8e28('0x2a')]);_0x2de3af[_0x8e28('0x42')]();});}}catch(_0x503fe8){logger[_0x8e28('0x43')](_0x8e28('0x12'),_0x46d60d,JSON['stringify'](_0x503fe8));_0x2de3af[_0x8e28('0x26')]();}};}; \ No newline at end of file +var _0x6873=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','getMustacheRender','then','error','finally','stop','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerResponse','next','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','stringify','isNil','interaction','UserId'];(function(_0x3ac577,_0x4e0dee){var _0x3a24d3=function(_0x112481){while(--_0x112481){_0x3ac577['push'](_0x3ac577['shift']());}};_0x3a24d3(++_0x4e0dee);}(_0x6873,0xac));var _0x3687=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0x6873[_0xc14df7];return _0x34a445;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x3687('0x0'));var moment=require(_0x3687('0x1'));var Promise=require(_0x3687('0x2'));var logger=require(_0x3687('0x3'))(_0x3687('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x3687('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3687('0x6')),'smsMessage':require(_0x3687('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3687('0x8'))};function createMessage(_0x2433a7,_0xf81d74,_0x1be8c0,_0x143060){return new Promise(function(_0x761e4f,_0x3c4131){var _0xda11f0=_[_0x3687('0x9')](_0x1be8c0);_0xda11f0['body']=_0x143060;return rpc[_0xf81d74+_0x3687('0xa')][_0x3687('0xb')](_0xda11f0)['then'](function(){logger[_0x3687('0xc')](_0x3687('0xd'),_0x2433a7,_0xda11f0[_0x3687('0xe')]);_0x761e4f();})[_0x3687('0xf')](function(_0x1b0c43){logger['error'](_0x3687('0xd'),_0x2433a7,JSON[_0x3687('0x10')](_0x1b0c43));_0x3c4131(_0x1b0c43);});});}exports['consequence']=function(_0xee2238,_0x2001c0){return function(_0x16bec2){try{if(!_[_0x3687('0x11')](this[_0x3687('0x12')][_0x3687('0x13')])){logger[_0x3687('0xc')](_0x3687('0xd'),_0xee2238,_0x3687('0x14'));return _0x16bec2['next']();}var _0x2afd7f={'ContactId':this[_0x3687('0x15')]['id'],'sentAt':moment()[_0x3687('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x3687('0x17')]===_0x3687('0x18')||this[_0x3687('0x17')]===_0x3687('0x19')){_0x2afd7f[_0x3687('0x1a')]=this[_0x3687('0x12')]['phone'];}var _0x468859=this[_0x3687('0x17')];if(_0x468859===_0x3687('0x1b')){_0x2afd7f[_0x3687('0x1c')]=this['account']['id'];}else{_0x2afd7f[_[_0x3687('0x1d')](_0x468859)+'AccountId']=this[_0x3687('0x1e')]['id'];}_0x2afd7f[_[_0x3687('0x1d')](_0x468859)+_0x3687('0x1f')]=this[_0x3687('0x12')]['id'];if(this[_0x3687('0x12')][_0x3687('0x20')]){var _0x1ad11a=_0x2001c0[0x4];if(!_[_0x3687('0x21')](_0x1ad11a)){_0x2afd7f[_0x3687('0xe')]=utils[_0x3687('0x22')](_0x1ad11a,this);return rpc[_0x468859+_0x3687('0xa')][_0x3687('0xb')](_0x2afd7f)[_0x3687('0x23')](function(_0x203f09){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0xee2238,_0x2afd7f['body']);})[_0x3687('0xf')](function(_0xe0d37){logger[_0x3687('0x24')](_0x3687('0xd'),_0xee2238,JSON[_0x3687('0x10')](_0xe0d37));})[_0x3687('0x25')](function(){logger[_0x3687('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xee2238);_0x16bec2['stop']();});}else{logger[_0x3687('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xee2238);_0x16bec2[_0x3687('0x26')]();}}else{var _0x30be03=this;var _0x4e05e1=_0x2001c0[0x2]['replace'](/\\n/g,'\x0a');var _0x44cb38={'credentials':{'private_key':_0x4e05e1,'client_email':_0x2001c0[0x1]}};var _0x54636b=new dialogflow[(_0x3687('0x27'))](_0x44cb38);var _0x1bc916=_0x54636b[_0x3687('0x28')](_0x2001c0[0x0],md5(_0x30be03[_0x3687('0x12')]['id']));var _0x5a19df={'session':_0x1bc916,'queryInput':{'text':{'text':_0x30be03[_0x3687('0x29')][_0x3687('0xe')],'languageCode':_0x2001c0[0x3]||'en'}}};return _0x54636b[_0x3687('0x2a')](_0x5a19df)['then'](function(_0x2bc5b8){if(_0x2bc5b8&&_0x2bc5b8[_0x3687('0x2b')]){_0x30be03[_0x3687('0xe')][_0x3687('0x2c')]=_0x2bc5b8;var _0x2646e=_0x2bc5b8[0x0];var _0x23375e=_0x2646e['queryResult']['diagnosticInfo']&&_0x2646e[_0x3687('0x2d')][_0x3687('0x2e')]['fields']?_0x2646e['queryResult'][_0x3687('0x2e')][_0x3687('0x2f')][_0x3687('0x30')][_0x3687('0x31')]:![];_0x30be03['body'][_0x3687('0x32')]=_0x2646e[_0x3687('0x2d')][_0x3687('0x33')];_0x30be03[_0x3687('0xe')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2646e[_0x3687('0x2d')]['allRequiredParamsPresent'];_0x30be03['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x2646e[_0x3687('0x2d')][_0x3687('0x2e')]&&_0x2646e[_0x3687('0x2d')][_0x3687('0x2e')]['fields']?_0x2646e[_0x3687('0x2d')]['diagnosticInfo'][_0x3687('0x2f')][_0x3687('0x30')][_0x3687('0x31')]:![];_0x30be03[_0x3687('0xe')]['DIALOGFLOWV2_INTENTNAME']=_0x2646e['queryResult'][_0x3687('0x34')]['name'];_0x30be03[_0x3687('0xe')][_0x3687('0x35')]=_0x2646e[_0x3687('0x2d')][_0x3687('0x34')][_0x3687('0x36')];_0x30be03[_0x3687('0xe')][_0x3687('0x37')]=_0x2646e[_0x3687('0x2d')][_0x3687('0x34')][_0x3687('0x38')];_0x30be03[_0x3687('0xe')][_0x3687('0x39')]=_0x2646e['queryResult'][_0x3687('0x3a')];_0x30be03[_0x3687('0xe')][_0x3687('0x3b')]=_0x2646e['queryResult'][_0x3687('0x3c')];_0x30be03['body'][_0x3687('0x3d')]=_0x2646e[_0x3687('0x2d')]['intentDetectionConfidence'];_0x2afd7f['providerName']=_0x3687('0x2c');_0x2afd7f[_0x3687('0x3e')]=JSON['stringify'](_0x2bc5b8);var _0x45451d=[];for(var _0x123ee6=0x0;_0x123ee6<_0x2bc5b8[_0x3687('0x2b')];_0x123ee6++){var _0x4cfe6c=_0x2bc5b8[_0x123ee6];if(_0x4cfe6c&&_0x4cfe6c[_0x3687('0x2d')]&&_0x4cfe6c[_0x3687('0x2d')]['fulfillmentText']){_0x45451d['push'](createMessage(_0xee2238,_0x468859,_0x2afd7f,_0x4cfe6c[_0x3687('0x2d')]['fulfillmentText']));}}return Promise['all'](_0x45451d)[_0x3687('0x23')](function(){if(_0x23375e){_0x16bec2[_0x3687('0x3f')]();}else{_0x16bec2[_0x3687('0x26')]();}})[_0x3687('0xf')](function(_0x54059a){logger[_0x3687('0x24')](_0x3687('0xd'),_0xee2238,JSON[_0x3687('0x10')](_0x54059a));_0x16bec2[_0x3687('0x3f')]();});}})[_0x3687('0xf')](function(_0x3df0fc){logger[_0x3687('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0xee2238,_0x3df0fc[_0x3687('0x29')]);_0x16bec2[_0x3687('0x3f')]();});}}catch(_0x4d9d23){logger[_0x3687('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0xee2238,JSON[_0x3687('0x10')](_0x4d9d23));_0x16bec2['stop']();}};}; \ 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 09ca3aa..2336486 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 _0x7f84=['priorityTrue','info','condition','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','error','[%s][GOTOIF]\x20%s','map','message','join','stop'];(function(_0x5574ad,_0x57ef3f){var _0x91880e=function(_0x352000){while(--_0x352000){_0x5574ad['push'](_0x5574ad['shift']());}};_0x91880e(++_0x57ef3f);}(_0x7f84,0x1b7));var _0x47f8=function(_0x391d2a,_0x16b229){_0x391d2a=_0x391d2a-0x0;var _0x27deab=_0x7f84[_0x391d2a];return _0x27deab;};'use strict';var schema=require(_0x47f8('0x0'));var _=require(_0x47f8('0x1'));var htmlToText=require(_0x47f8('0x2'));var utils=require(_0x47f8('0x3'));var logger=require('../../../../config/logger')(_0x47f8('0x4'));var gotoif=schema({'condition':{'type':_0x47f8('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x47f8('0x6')},'priorityFalse':{'type':_0x47f8('0x7'),'message':_0x47f8('0x8')}});exports[_0x47f8('0x9')]=function(_0x1fc1d7,_0x517a49){return function(_0x5808a4){try{var _0x530f73={'condition':htmlToText[_0x47f8('0xa')](utils['getMustacheRender'](_0x517a49[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x517a49[0x1],'priorityFalse':_0x517a49[0x2]};var _0x163f42=gotoif['validate'](_0x530f73,{'typecast':!![]});if(_0x163f42['length']){logger[_0x47f8('0xb')](_0x47f8('0xc'),_0x1fc1d7,_[_0x47f8('0xd')](_0x163f42,_0x47f8('0xe'))[_0x47f8('0xf')](',\x20'));_0x5808a4[_0x47f8('0x10')]();}else{try{var _0x5816f5=eval('('+_0x530f73['condition']+')');var _0x35ace1=_0x5816f5?_0x530f73[_0x47f8('0x11')]:_0x530f73['priorityFalse'];logger[_0x47f8('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1fc1d7,_0x530f73[_0x47f8('0x13')],_0x5816f5,_0x35ace1||'next');if(_0x35ace1){var _0x544d90=_['findIndex'](_0x5808a4['rules'](),{'p':_0x35ace1});if(_0x544d90>=0x0){logger[_0x47f8('0x12')](_0x47f8('0x14'),_0x1fc1d7,_0x35ace1||_0x47f8('0x15'),_0x544d90);_0x5808a4['next'](_0x544d90);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1fc1d7,_0x35ace1||_0x47f8('0x15'));_0x5808a4['stop']();}}else{_0x5808a4[_0x47f8('0x15')]();}}catch(_0x4039fa){logger[_0x47f8('0xb')](_0x47f8('0x16'),_0x1fc1d7,_0x4039fa[_0x47f8('0xe')]);_0x5808a4[_0x47f8('0x10')]();}}}catch(_0x5e53be){logger[_0x47f8('0xb')](_0x47f8('0xc'),_0x1fc1d7,JSON[_0x47f8('0x17')](_0x5e53be));_0x5808a4[_0x47f8('0x10')]();}};}; \ No newline at end of file +var _0xe299=['../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','length','error','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','validate','lodash','html-to-text','./utils'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe299,0x140));var _0x9e29=function(_0x128e48,_0x355e5e){_0x128e48=_0x128e48-0x0;var _0x5eb0d2=_0xe299[_0x128e48];return _0x5eb0d2;};'use strict';var schema=require(_0x9e29('0x0'));var _=require(_0x9e29('0x1'));var htmlToText=require(_0x9e29('0x2'));var utils=require(_0x9e29('0x3'));var logger=require(_0x9e29('0x4'))(_0x9e29('0x5'));var gotoif=schema({'condition':{'type':_0x9e29('0x6'),'required':!![],'message':_0x9e29('0x7')},'priorityTrue':{'type':_0x9e29('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x9e29('0x8'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x9e29('0x9')]=function(_0x371ae4,_0x1fd47d){return function(_0x48ff0a){try{var _0x9836d2={'condition':htmlToText[_0x9e29('0xa')](utils['getMustacheRender'](_0x1fd47d[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1fd47d[0x1],'priorityFalse':_0x1fd47d[0x2]};var _0x19f90e=gotoif[_0x9e29('0x0')](_0x9836d2,{'typecast':!![]});if(_0x19f90e[_0x9e29('0xb')]){logger[_0x9e29('0xc')](_0x9e29('0xd'),_0x371ae4,_[_0x9e29('0xe')](_0x19f90e,'message')[_0x9e29('0xf')](',\x20'));_0x48ff0a[_0x9e29('0x10')]();}else{try{var _0x36231e=eval('('+_0x9836d2['condition']+')');var _0x39baef=_0x36231e?_0x9836d2[_0x9e29('0x11')]:_0x9836d2[_0x9e29('0x12')];logger[_0x9e29('0x13')](_0x9e29('0x14'),_0x371ae4,_0x9836d2['condition'],_0x36231e,_0x39baef||_0x9e29('0x15'));if(_0x39baef){var _0x223a19=_[_0x9e29('0x16')](_0x48ff0a[_0x9e29('0x17')](),{'p':_0x39baef});if(_0x223a19>=0x0){logger['info'](_0x9e29('0x18'),_0x371ae4,_0x39baef||'next',_0x223a19);_0x48ff0a[_0x9e29('0x15')](_0x223a19);}else{logger[_0x9e29('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x371ae4,_0x39baef||'next');_0x48ff0a[_0x9e29('0x10')]();}}else{_0x48ff0a[_0x9e29('0x15')]();}}catch(_0x440bec){logger['error'](_0x9e29('0x19'),_0x371ae4,_0x440bec[_0x9e29('0x1a')]);_0x48ff0a[_0x9e29('0x10')]();}}}catch(_0x20e375){logger[_0x9e29('0xc')](_0x9e29('0xd'),_0x371ae4,JSON['stringify'](_0x20e375));_0x48ff0a[_0x9e29('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 90ffdeb..32c49c3 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 _0x7f1a=['validate','length','error','map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x7c10ec,_0x4bde9a){var _0xa7bd3=function(_0x57a0e6){while(--_0x57a0e6){_0x7c10ec['push'](_0x7c10ec['shift']());}};_0xa7bd3(++_0x4bde9a);}(_0x7f1a,0x1f3));var _0xa7f1=function(_0x262b2c,_0x50dc7c){_0x262b2c=_0x262b2c-0x0;var _0x109846=_0x7f1a[_0x262b2c];return _0x109846;};'use strict';var schema=require('validate');var _=require(_0xa7f1('0x0'));var logger=require(_0xa7f1('0x1'))('routing');var gotop=schema({'priority':{'type':_0xa7f1('0x2'),'required':!![],'message':_0xa7f1('0x3')}});exports[_0xa7f1('0x4')]=function(_0xa7fa5a,_0x3c1b39){return function(_0x59da87){try{var _0x26eb42={'priority':_0x3c1b39[0x0]};var _0x5209f2=gotop[_0xa7f1('0x5')](_0x26eb42,{'typecast':!![]});if(_0x5209f2[_0xa7f1('0x6')]){logger[_0xa7f1('0x7')]('[%s][GOTOP]\x20%s',_0xa7fa5a,_[_0xa7f1('0x8')](_0x5209f2,_0xa7f1('0x9'))[_0xa7f1('0xa')](',\x20'));_0x59da87[_0xa7f1('0xb')]();}else{logger[_0xa7f1('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0xa7fa5a,_0x26eb42['priority']);if(_0x26eb42[_0xa7f1('0xd')]){var _0x5834e0=_[_0xa7f1('0xe')](_0x59da87[_0xa7f1('0xf')](),{'p':_0x26eb42[_0xa7f1('0xd')]});if(_0x5834e0>=0x0){logger[_0xa7f1('0xc')](_0xa7f1('0x10'),_0xa7fa5a,_0x26eb42[_0xa7f1('0xd')]||_0xa7f1('0x11'),_0x5834e0);_0x59da87[_0xa7f1('0x11')](_0x5834e0);}else{logger[_0xa7f1('0xc')](_0xa7f1('0x12'),_0xa7fa5a,_0x26eb42[_0xa7f1('0xd')]||_0xa7f1('0x11'));_0x59da87[_0xa7f1('0xb')]();}}else{_0x59da87['next']();}}}catch(_0x3a9689){logger[_0xa7f1('0x7')](_0xa7f1('0x13'),_0xa7fa5a,JSON[_0xa7f1('0x14')](_0x3a9689));_0x59da87[_0xa7f1('0xb')]();}};}; \ No newline at end of file +var _0x3459=['message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3459,0x147));var _0x9345=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3459[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x9345('0x0'));var _=require(_0x9345('0x1'));var logger=require('../../../../config/logger')(_0x9345('0x2'));var gotop=schema({'priority':{'type':_0x9345('0x3'),'required':!![],'message':_0x9345('0x4')}});exports[_0x9345('0x5')]=function(_0x4070c7,_0x526a7b){return function(_0x462074){try{var _0x1bae40={'priority':_0x526a7b[0x0]};var _0x271150=gotop[_0x9345('0x0')](_0x1bae40,{'typecast':!![]});if(_0x271150[_0x9345('0x6')]){logger[_0x9345('0x7')](_0x9345('0x8'),_0x4070c7,_['map'](_0x271150,_0x9345('0x9'))[_0x9345('0xa')](',\x20'));_0x462074[_0x9345('0xb')]();}else{logger[_0x9345('0xc')](_0x9345('0xd'),_0x4070c7,_0x1bae40['priority']);if(_0x1bae40[_0x9345('0xe')]){var _0x5e2c6d=_[_0x9345('0xf')](_0x462074[_0x9345('0x10')](),{'p':_0x1bae40[_0x9345('0xe')]});if(_0x5e2c6d>=0x0){logger[_0x9345('0xc')](_0x9345('0x11'),_0x4070c7,_0x1bae40[_0x9345('0xe')]||'next',_0x5e2c6d);_0x462074[_0x9345('0x12')](_0x5e2c6d);}else{logger[_0x9345('0xc')](_0x9345('0x13'),_0x4070c7,_0x1bae40[_0x9345('0xe')]||_0x9345('0x12'));_0x462074[_0x9345('0xb')]();}}else{_0x462074[_0x9345('0x12')]();}}}catch(_0x500e8c){logger[_0x9345('0x7')]('[%s][GOTOP]\x20%s',_0x4070c7,JSON[_0x9345('0x14')](_0x500e8c));_0x462074[_0x9345('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 9790eee..06fd03e 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 _0x282b=['../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing'];(function(_0x512b68,_0x5a6877){var _0x2544d9=function(_0x30f4d5){while(--_0x30f4d5){_0x512b68['push'](_0x512b68['shift']());}};_0x2544d9(++_0x5a6877);}(_0x282b,0xec));var _0xb282=function(_0x250722,_0xf50231){_0x250722=_0x250722-0x0;var _0x38892c=_0x282b[_0x250722];return _0x38892c;};'use strict';var _=require(_0xb282('0x0'));var utils=require(_0xb282('0x1'));var logger=require(_0xb282('0x2'))(_0xb282('0x3'));var rpc={'chatMessage':require(_0xb282('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb282('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb282('0x6'))};exports[_0xb282('0x7')]=function(_0x283325,_0x1dd19b){return function(_0x3cad41){try{var _0x33635f={'body':utils['getMustacheRender'](_0x1dd19b[0x0],this),'ContactId':this['contact']['id']};if(this[_0xb282('0x8')]===_0xb282('0x9')){_0x33635f['ChatWebsiteId']=this[_0xb282('0xa')]['id'];}else{_0x33635f[_[_0xb282('0xb')](this[_0xb282('0x8')])+_0xb282('0xc')]=this['account']['id'];}_0x33635f[_['upperFirst'](this[_0xb282('0x8')])+_0xb282('0xd')]=this[_0xb282('0xe')]['id'];if(rpc[this[_0xb282('0x8')]+_0xb282('0xf')]){return rpc[this['channel']+'Message'][_0xb282('0x10')](_0x33635f)[_0xb282('0x11')](function(_0x40d7b8){logger[_0xb282('0x12')](_0xb282('0x13'),_0x283325,_0x33635f['body']);_0x3cad41[_0xb282('0x14')]();})['catch'](function(_0xe1d53){logger[_0xb282('0x15')]('[%s][MESSAGE]\x20%s',_0x283325,JSON['stringify'](_0xe1d53));_0x3cad41['stop']();});}}catch(_0x13cea1){logger[_0xb282('0x15')](_0xb282('0x13'),_0x283325,JSON[_0xb282('0x16')](_0x13cea1));_0x3cad41[_0xb282('0x17')]();}};}; \ No newline at end of file +var _0x6738=['[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message','create','then','info'];(function(_0x4f8cba,_0x51d42b){var _0xe240a6=function(_0x5de3ea){while(--_0x5de3ea){_0x4f8cba['push'](_0x4f8cba['shift']());}};_0xe240a6(++_0x51d42b);}(_0x6738,0x16f));var _0x8673=function(_0x1fdce6,_0x4ed182){_0x1fdce6=_0x1fdce6-0x0;var _0x5840c0=_0x6738[_0x1fdce6];return _0x5840c0;};'use strict';var _=require(_0x8673('0x0'));var utils=require('./utils');var logger=require(_0x8673('0x1'))(_0x8673('0x2'));var rpc={'chatMessage':require(_0x8673('0x3')),'openchannelMessage':require(_0x8673('0x4')),'mailMessage':require(_0x8673('0x5')),'smsMessage':require(_0x8673('0x6')),'faxMessage':require(_0x8673('0x7')),'whatsappMessage':require(_0x8673('0x8'))};exports[_0x8673('0x9')]=function(_0x533421,_0x33b762){return function(_0x487a5e){try{var _0x205205={'body':utils[_0x8673('0xa')](_0x33b762[0x0],this),'ContactId':this[_0x8673('0xb')]['id']};if(this[_0x8673('0xc')]==='chat'){_0x205205[_0x8673('0xd')]=this['account']['id'];}else{_0x205205[_[_0x8673('0xe')](this[_0x8673('0xc')])+_0x8673('0xf')]=this[_0x8673('0x10')]['id'];}_0x205205[_['upperFirst'](this['channel'])+_0x8673('0x11')]=this[_0x8673('0x12')]['id'];if(rpc[this[_0x8673('0xc')]+_0x8673('0x13')]){return rpc[this[_0x8673('0xc')]+_0x8673('0x13')][_0x8673('0x14')](_0x205205)[_0x8673('0x15')](function(_0x48a021){logger[_0x8673('0x16')](_0x8673('0x17'),_0x533421,_0x205205[_0x8673('0x18')]);_0x487a5e[_0x8673('0x19')]();})[_0x8673('0x1a')](function(_0x39a0bf){logger['error']('[%s][MESSAGE]\x20%s',_0x533421,JSON[_0x8673('0x1b')](_0x39a0bf));_0x487a5e[_0x8673('0x1c')]();});}}catch(_0x5c1190){logger[_0x8673('0x1d')]('[%s][MESSAGE]\x20%s',_0x533421,JSON[_0x8673('0x1b')](_0x5c1190));_0x487a5e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 2af7da8..0ea9e95 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 _0x209a=['../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','./utils'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x209a,0xc7));var _0xa209=function(_0x23815e,_0x4bb3d6){_0x23815e=_0x23815e-0x0;var _0x15c6c7=_0x209a[_0x23815e];return _0x15c6c7;};'use strict';var utils=require(_0xa209('0x0'));var logger=require(_0xa209('0x1'))(_0xa209('0x2'));exports[_0xa209('0x3')]=function(_0x323728,_0x36df31){return function(_0x3310b7){try{logger['info'](_0xa209('0x4'),_0x323728,utils[_0xa209('0x5')](_0x36df31[0x0],this));_0x3310b7[_0xa209('0x6')]();}catch(_0x274085){logger['error']('[%s][NOOP]\x20%s',_0x323728,JSON[_0xa209('0x7')](_0x274085));_0x3310b7['stop']();}};}; \ No newline at end of file +var _0xce42=['./utils','routing','getMustacheRender','next','error'];(function(_0x431423,_0x481f04){var _0x230e5b=function(_0x32880f){while(--_0x32880f){_0x431423['push'](_0x431423['shift']());}};_0x230e5b(++_0x481f04);}(_0xce42,0xa0));var _0x2ce4=function(_0x4259a3,_0x2f9e82){_0x4259a3=_0x4259a3-0x0;var _0x5dfed4=_0xce42[_0x4259a3];return _0x5dfed4;};'use strict';var utils=require(_0x2ce4('0x0'));var logger=require('../../../../config/logger')(_0x2ce4('0x1'));exports['consequence']=function(_0x5d5625,_0x19080f){return function(_0xe91bfe){try{logger['info']('[%s][NOOP]\x20%s',_0x5d5625,utils[_0x2ce4('0x2')](_0x19080f[0x0],this));_0xe91bfe[_0x2ce4('0x3')]();}catch(_0x3e1e89){logger[_0x2ce4('0x4')]('[%s][NOOP]\x20%s',_0x5d5625,JSON['stringify'](_0x3e1e89));_0xe91bfe['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 1b59447..a60bcc9 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 _0x413e=['error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','timeout','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','consequence','length','join','Queues','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','stop','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','util','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','queue','from','clone','queue_id','account','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','interaction','upperFirst','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch'];(function(_0x42b5e3,_0x530bc0){var _0x1ed5b2=function(_0x4e9538){while(--_0x4e9538){_0x42b5e3['push'](_0x42b5e3['shift']());}};_0x1ed5b2(++_0x530bc0);}(_0x413e,0x14b));var _0xe413=function(_0x13731b,_0x40d15d){_0x13731b=_0x13731b-0x0;var _0xd306cf=_0x413e[_0x13731b];return _0xd306cf;};'use strict';var schema=require(_0xe413('0x0'));var _=require('lodash');var util=require(_0xe413('0x1'));var seqqueue=require('seq-queue');var moment=require(_0xe413('0x2'));var Redis=require(_0xe413('0x3'));var config=require(_0xe413('0x4'));var logger=require('../../../../config/logger')(_0xe413('0x5'));var strategy=require(_0xe413('0x6'));config[_0xe413('0x7')]=_[_0xe413('0x8')](config[_0xe413('0x7')],{'host':_0xe413('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe413('0x7')]));var attributes=['id','queue_id','account',_0xe413('0xa'),_0xe413('0xb'),'joinAt'];function emit(_0x2071d1,_0x24267d,_0x54e422){io['to'](_0x2071d1)['emit'](_0x24267d,_0x54e422);}function emitChannelQueueInteraction(_0x4e2bfd,_0x220f48,_0x146057,_0x1af134,_0x2b89f9,_0x22f3af,_0x508560,_0x41b0a3){var _0x51806d=_[_0xe413('0xc')](_0x146057);_0x51806d[_0xe413('0xd')]=_0x41b0a3;_0x51806d[_0xe413('0xa')]=_0x220f48;_0x51806d[_0xe413('0xe')]=_0x1af134;_0x51806d['id']=_0x2b89f9;if(_0x22f3af){_0x508560[util[_0xe413('0xf')](_0xe413('0x10'),_0x4e2bfd)][_0x2b89f9]=_[_0xe413('0x11')](_0x51806d,attributes);}else{delete _0x508560[util['format'](_0xe413('0x10'),_0x4e2bfd)][_0x2b89f9];}emit(util[_0xe413('0xf')]('%s:queue:%s',_0x4e2bfd,_0x220f48),util[_0xe413('0xf')](_0xe413('0x12'),_0x4e2bfd,_0x22f3af?_0xe413('0x13'):_0xe413('0x14')),_[_0xe413('0x11')](_0x51806d,attributes));}var rpc={'openchannelQueueReport':require(_0xe413('0x15')),'mailQueueReport':require(_0xe413('0x16')),'chatQueueReport':require(_0xe413('0x17')),'smsQueueReport':require(_0xe413('0x18')),'faxQueueReport':require(_0xe413('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xe413('0x1a'),'required':!![],'message':_0xe413('0x1b')},'timeout':{'type':_0xe413('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x25b0b9,_0x4fd12f,_0x156543,_0x4cd8f0){if(_0x25b0b9&&_0x4fd12f&&_0x156543){_0x4fd12f[_0xe413('0x1d')]+=0x1;var _0x5893fe={'uniqueid':_0x25b0b9,'from':_0x156543[_0xe413('0x1e')]?_0x156543[_0xe413('0x1e')][_0xe413('0xb')]:'','joinAt':moment()[_0xe413('0xf')](_0xe413('0x1f')),'ContactId':_0x156543['contact']?_0x156543[_0xe413('0x20')]['id']:null,'ListId':_0x156543[_0xe413('0x21')]?_0x156543[_0xe413('0x21')]['id']:null};_0x5893fe[_['upperFirst'](_0x156543[_0xe413('0x22')])+_0xe413('0x23')]=_0x4fd12f['id']||null;_0x5893fe[_['upperFirst'](_0x156543[_0xe413('0x22')])+'InteractionId']=_0x156543[_0xe413('0x24')]?_0x156543[_0xe413('0x24')]['id']:null;_0x5893fe[_[_0xe413('0x25')](_0x156543[_0xe413('0x22')])+_0xe413('0x26')]=_0x156543[_0xe413('0x27')]?_0x156543[_0xe413('0x27')]['id']:null;_0x5893fe[_[_0xe413('0x25')](_0x156543[_0xe413('0x22')])+(_0x156543['channel']!==_0xe413('0x28')?_0xe413('0x29'):_0xe413('0x2a'))]=_0x156543['account']?_0x156543[_0xe413('0xe')]['id']:null;logger[_0xe413('0x2b')](util[_0xe413('0xf')](_0xe413('0x2c'),_0x25b0b9,_0x4fd12f[_0xe413('0x2d')]));emitChannelQueueInteraction(_0x156543[_0xe413('0x22')],_0x4fd12f[_0xe413('0x2d')],_0x5893fe,_0x156543[_0xe413('0xe')][_0xe413('0x2d')],_0x156543[_0xe413('0x27')]['id'],!![],_0x4cd8f0,_0x4fd12f['id']);if(rpc[_0x156543[_0xe413('0x22')]+_0xe413('0x2e')]){return rpc[_0x156543[_0xe413('0x22')]+_0xe413('0x2e')][_0xe413('0x2f')](_0x5893fe)[_0xe413('0x30')](function(_0x46fa5f){logger[_0xe413('0x31')](_0xe413('0x32'));});}}}function stopRouting(_0x1a7999,_0x574b64,_0x4e4839,_0x46e328){if(_0x1a7999&&_0x574b64){_0x574b64[_0xe413('0x1d')]-=0x1;var _0x4f0d88={'leaveAt':moment()[_0xe413('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xe413('0x33')};logger[_0xe413('0x2b')](util[_0xe413('0xf')](_0xe413('0x34'),_0x1a7999,_0x574b64[_0xe413('0x2d')]));emitChannelQueueInteraction(_0x4e4839[_0xe413('0x22')],_0x574b64[_0xe413('0x2d')],_0x4e4839[_0xe413('0x1e')],_0x4e4839[_0xe413('0xe')]['name'],_0x4e4839['message']['id'],![],_0x46e328,_0x574b64['id']);if(rpc[_0x4e4839[_0xe413('0x22')]+_0xe413('0x2e')]){return rpc[_0x4e4839[_0xe413('0x22')]+_0xe413('0x2e')]['update'](_0x1a7999,_0x4f0d88)[_0xe413('0x30')](function(_0x2137cd){logger[_0xe413('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1876ab,_0x2de603,_0x314874,_0x11a5b1){if(_0x1876ab&&_0x2de603){_0x2de603[_0xe413('0x1d')]-=0x1;var _0x1a172e={'leaveAt':moment()[_0xe413('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xe413('0x35')};logger[_0xe413('0x2b')](util[_0xe413('0xf')](_0xe413('0x36'),_0x1876ab,_0x2de603[_0xe413('0x2d')]));emitChannelQueueInteraction(_0x314874[_0xe413('0x22')],_0x2de603[_0xe413('0x2d')],_0x314874['body'],_0x314874[_0xe413('0xe')]['name'],_0x314874['message']['id'],![],_0x11a5b1);if(rpc[_0x314874[_0xe413('0x22')]+_0xe413('0x2e')]){return rpc[_0x314874[_0xe413('0x22')]+_0xe413('0x2e')][_0xe413('0x37')](_0x1876ab,_0x1a172e)[_0xe413('0x30')](function(_0x3149af){logger[_0xe413('0x31')](_0xe413('0x38'));});}}}function handleFindQueue(_0x2ec52b){return function(_0x3e4a46){return _0x3e4a46['name'][_0xe413('0x39')]()===_0x2ec52b[_0xe413('0x39')]();};}exports[_0xe413('0x3a')]=function(_0x4d5732,_0x583fa0,_0x389bcc,_0x1090d2){return function(_0x404517){try{var _0x2b3024={'name':_0x583fa0[0x0],'timeout':_0x583fa0[0x1]};var _0x5a7ba4=queue['validate'](_0x2b3024,{'typecast':!![]});if(_0x5a7ba4[_0xe413('0x3b')]){logger[_0xe413('0x31')]('[%s][QUEUE]\x20%s',_0x4d5732,_['map'](_0x5a7ba4,'message')[_0xe413('0x3c')](',\x20'));_0x404517['stop']();}else{var _0x1c317f=_['find'](_0x389bcc[_0x1090d2[_0xe413('0x22')]+_0xe413('0x3d')],handleFindQueue(_0x2b3024[_0xe413('0x2d')]));if(_0x1c317f){startRouting(_0x4d5732,_0x1c317f,_0x1090d2,_0x389bcc);var _0x73c8bc=(_0x1c317f['timeout']||0xa)*0x3e8;var _0x15af1f=(_0x2b3024['timeout']||0x14)*0x3e8;var _0x312a4e,_0x55c6ad;if(_0x73c8bc>_0x15af1f){_0x15af1f=_0x73c8bc;}var _0x4c0206=seqqueue[_0xe413('0x3e')](_0x73c8bc);_0x4c0206['id']=_0x4d5732;_0x4c0206[_0xe413('0x3f')]=_0x73c8bc;_0x4c0206[_0xe413('0x40')]=_0x15af1f;_0x4c0206['channel']=_0x1090d2[_0xe413('0x22')];_0x389bcc['rules'][_0x4d5732]['on'](_0xe413('0x41'),function(){logger[_0xe413('0x2b')](_0xe413('0x42'),_0x4d5732);stopRouting(_0x4d5732,_0x1c317f,_0x1090d2,_0x389bcc);clearTimeout(_0x312a4e);_0x312a4e=undefined;_0x4c0206[_0xe413('0x43')](!![]);if(_0x389bcc[_0xe413('0x44')][_0x4d5732]){delete _0x389bcc[_0xe413('0x44')][_0x4d5732];}_0x404517[_0xe413('0x45')]();});_0x389bcc[_0xe413('0x44')][_0x4d5732]['on'](_0xe413('0x46'),function(){if(_0x389bcc[_0xe413('0x44')][_0x4d5732]){delete _0x389bcc[_0xe413('0x44')][_0x4d5732];}});_0x312a4e=setTimeout(function(){logger[_0xe413('0x2b')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4d5732);endRouting(_0x4d5732,_0x1c317f,_0x1090d2,_0x389bcc);clearTimeout(_0x312a4e);_0x4c0206[_0xe413('0x43')](!![]);_0x404517[_0xe413('0x47')]();},_0x15af1f);switch(_0x1c317f['strategy']){case _0xe413('0x48'):strategy['rrmemory'](_0x4c0206,_0x1c317f,_0x389bcc,_0x1090d2);break;default:strategy[_0xe413('0x49')](_0x4c0206,_0x1c317f,_0x389bcc,_0x1090d2);}}else{logger[_0xe413('0x31')](_0xe413('0x4a'),_0x4d5732,_0x2b3024[_0xe413('0x2d')]);_0x404517[_0xe413('0x45')]();}}}catch(_0x5b73d2){console['log'](_0x5b73d2);logger[_0xe413('0x31')](_0xe413('0x4b'),_0x4d5732,_0x5b73d2['stack']);_0x404517[_0xe413('0x45')]();}};}; \ No newline at end of file +var _0x4390=['%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','body','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','./strategy','redis','defaults','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick'];(function(_0x50180c,_0x2978d2){var _0xffe063=function(_0xbfafd4){while(--_0xbfafd4){_0x50180c['push'](_0x50180c['shift']());}};_0xffe063(++_0x2978d2);}(_0x4390,0x88));var _0x0439=function(_0x407d07,_0x515a81){_0x407d07=_0x407d07-0x0;var _0x562ae8=_0x4390[_0x407d07];return _0x562ae8;};'use strict';var schema=require(_0x0439('0x0'));var _=require(_0x0439('0x1'));var util=require(_0x0439('0x2'));var seqqueue=require(_0x0439('0x3'));var moment=require(_0x0439('0x4'));var Redis=require(_0x0439('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x0439('0x6'));config[_0x0439('0x7')]=_[_0x0439('0x8')](config[_0x0439('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0439('0x9'))(new Redis(config[_0x0439('0x7')]));var attributes=['id',_0x0439('0xa'),'account',_0x0439('0xb'),_0x0439('0xc'),_0x0439('0xd')];function emit(_0x422dc6,_0x18190b,_0x497c68){io['to'](_0x422dc6)[_0x0439('0xe')](_0x18190b,_0x497c68);}function emitChannelQueueInteraction(_0x26f430,_0x1a8c75,_0x3845f3,_0x580236,_0x421504,_0x1ab4cc,_0x106085,_0x5a0f7c){var _0x4c0861=_[_0x0439('0xf')](_0x3845f3);_0x4c0861[_0x0439('0xa')]=_0x5a0f7c;_0x4c0861[_0x0439('0xb')]=_0x1a8c75;_0x4c0861[_0x0439('0x10')]=_0x580236;_0x4c0861['id']=_0x421504;if(_0x1ab4cc){_0x106085[util[_0x0439('0x11')](_0x0439('0x12'),_0x26f430)][_0x421504]=_[_0x0439('0x13')](_0x4c0861,attributes);}else{delete _0x106085[util[_0x0439('0x11')](_0x0439('0x12'),_0x26f430)][_0x421504];}emit(util[_0x0439('0x11')](_0x0439('0x14'),_0x26f430,_0x1a8c75),util[_0x0439('0x11')](_0x0439('0x15'),_0x26f430,_0x1ab4cc?'save':'remove'),_[_0x0439('0x13')](_0x4c0861,attributes));}var rpc={'openchannelQueueReport':require(_0x0439('0x16')),'mailQueueReport':require(_0x0439('0x17')),'chatQueueReport':require(_0x0439('0x18')),'smsQueueReport':require(_0x0439('0x19')),'faxQueueReport':require(_0x0439('0x1a')),'whatsappQueueReport':require(_0x0439('0x1b'))};var queue=schema({'name':{'type':_0x0439('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0439('0x1d'),'message':_0x0439('0x1e')}});function startRouting(_0x127ccb,_0x432f64,_0x34143e,_0x8da243){if(_0x127ccb&&_0x432f64&&_0x34143e){_0x432f64[_0x0439('0x1f')]+=0x1;var _0x35e6e1={'uniqueid':_0x127ccb,'from':_0x34143e['body']?_0x34143e['body'][_0x0439('0xc')]:'','joinAt':moment()[_0x0439('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x34143e[_0x0439('0x20')]?_0x34143e[_0x0439('0x20')]['id']:null,'ListId':_0x34143e[_0x0439('0x21')]?_0x34143e[_0x0439('0x21')]['id']:null};_0x35e6e1[_['upperFirst'](_0x34143e[_0x0439('0x22')])+_0x0439('0x23')]=_0x432f64['id']||null;_0x35e6e1[_[_0x0439('0x24')](_0x34143e[_0x0439('0x22')])+_0x0439('0x25')]=_0x34143e[_0x0439('0x26')]?_0x34143e['interaction']['id']:null;_0x35e6e1[_[_0x0439('0x24')](_0x34143e[_0x0439('0x22')])+_0x0439('0x27')]=_0x34143e[_0x0439('0x28')]?_0x34143e['message']['id']:null;_0x35e6e1[_[_0x0439('0x24')](_0x34143e[_0x0439('0x22')])+(_0x34143e[_0x0439('0x22')]!==_0x0439('0x29')?_0x0439('0x2a'):_0x0439('0x2b'))]=_0x34143e['account']?_0x34143e[_0x0439('0x10')]['id']:null;logger[_0x0439('0x2c')](util[_0x0439('0x11')](_0x0439('0x2d'),_0x127ccb,_0x432f64[_0x0439('0x2e')]));emitChannelQueueInteraction(_0x34143e[_0x0439('0x22')],_0x432f64['name'],_0x35e6e1,_0x34143e[_0x0439('0x10')]['name'],_0x34143e[_0x0439('0x28')]['id'],!![],_0x8da243,_0x432f64['id']);if(rpc[_0x34143e['channel']+_0x0439('0x2f')]){return rpc[_0x34143e[_0x0439('0x22')]+'QueueReport'][_0x0439('0x30')](_0x35e6e1)['catch'](function(_0x3a8e22){logger[_0x0439('0x31')](_0x0439('0x32'));});}}}function stopRouting(_0x2bb4cc,_0x1324f3,_0x195bcb,_0x1f4410){if(_0x2bb4cc&&_0x1324f3){_0x1324f3[_0x0439('0x1f')]-=0x1;var _0x7b98d8={'leaveAt':moment()[_0x0439('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x0439('0x33')),'reason':'accepted'};logger[_0x0439('0x2c')](util[_0x0439('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x2bb4cc,_0x1324f3[_0x0439('0x2e')]));emitChannelQueueInteraction(_0x195bcb[_0x0439('0x22')],_0x1324f3[_0x0439('0x2e')],_0x195bcb[_0x0439('0x34')],_0x195bcb[_0x0439('0x10')]['name'],_0x195bcb[_0x0439('0x28')]['id'],![],_0x1f4410,_0x1324f3['id']);if(rpc[_0x195bcb[_0x0439('0x22')]+_0x0439('0x2f')]){return rpc[_0x195bcb[_0x0439('0x22')]+_0x0439('0x2f')][_0x0439('0x35')](_0x2bb4cc,_0x7b98d8)[_0x0439('0x36')](function(_0x546e37){logger['error'](_0x0439('0x37'));});}}}function endRouting(_0x46630d,_0x490ce5,_0x528aa4,_0xb8b1e3){if(_0x46630d&&_0x490ce5){_0x490ce5[_0x0439('0x1f')]-=0x1;var _0x3e03dd={'leaveAt':moment()[_0x0439('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x0439('0x11')](_0x0439('0x33')),'reason':_0x0439('0x38')};logger[_0x0439('0x2c')](util['format'](_0x0439('0x39'),_0x46630d,_0x490ce5[_0x0439('0x2e')]));emitChannelQueueInteraction(_0x528aa4[_0x0439('0x22')],_0x490ce5[_0x0439('0x2e')],_0x528aa4[_0x0439('0x34')],_0x528aa4[_0x0439('0x10')][_0x0439('0x2e')],_0x528aa4[_0x0439('0x28')]['id'],![],_0xb8b1e3);if(rpc[_0x528aa4[_0x0439('0x22')]+_0x0439('0x2f')]){return rpc[_0x528aa4[_0x0439('0x22')]+_0x0439('0x2f')][_0x0439('0x35')](_0x46630d,_0x3e03dd)[_0x0439('0x36')](function(_0x5634af){logger[_0x0439('0x31')](_0x0439('0x37'));});}}}function handleFindQueue(_0x29f898){return function(_0x4b2fef){return _0x4b2fef[_0x0439('0x2e')][_0x0439('0x3a')]()===_0x29f898['toLowerCase']();};}exports[_0x0439('0x3b')]=function(_0x1693b7,_0x14951f,_0x16f659,_0x5484e8){return function(_0x3f26bd){try{var _0x53f262={'name':_0x14951f[0x0],'timeout':_0x14951f[0x1]};var _0x4a3880=queue[_0x0439('0x0')](_0x53f262,{'typecast':!![]});if(_0x4a3880[_0x0439('0x3c')]){logger[_0x0439('0x31')](_0x0439('0x3d'),_0x1693b7,_[_0x0439('0x3e')](_0x4a3880,'message')[_0x0439('0x3f')](',\x20'));_0x3f26bd[_0x0439('0x40')]();}else{var _0x22be1a=_[_0x0439('0x41')](_0x16f659[_0x5484e8[_0x0439('0x22')]+_0x0439('0x42')],handleFindQueue(_0x53f262[_0x0439('0x2e')]));if(_0x22be1a){startRouting(_0x1693b7,_0x22be1a,_0x5484e8,_0x16f659);var _0x9103db=(_0x22be1a['timeout']||0xa)*0x3e8;var _0x251275=(_0x53f262[_0x0439('0x38')]||0x14)*0x3e8;var _0x2d9de8,_0x4f0911;if(_0x9103db>_0x251275){_0x251275=_0x9103db;}var _0x5e8b89=seqqueue[_0x0439('0x43')](_0x9103db);_0x5e8b89['id']=_0x1693b7;_0x5e8b89[_0x0439('0x44')]=_0x9103db;_0x5e8b89['qtimeout']=_0x251275;_0x5e8b89[_0x0439('0x22')]=_0x5484e8[_0x0439('0x22')];_0x16f659['rules'][_0x1693b7]['on']('end',function(){logger[_0x0439('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x1693b7);stopRouting(_0x1693b7,_0x22be1a,_0x5484e8,_0x16f659);clearTimeout(_0x2d9de8);_0x2d9de8=undefined;_0x5e8b89[_0x0439('0x45')](!![]);if(_0x16f659[_0x0439('0x46')][_0x1693b7]){delete _0x16f659[_0x0439('0x46')][_0x1693b7];}_0x3f26bd['stop']();});_0x16f659[_0x0439('0x46')][_0x1693b7]['on'](_0x0439('0x47'),function(){if(_0x16f659[_0x0439('0x46')][_0x1693b7]){delete _0x16f659[_0x0439('0x46')][_0x1693b7];}});_0x2d9de8=setTimeout(function(){logger[_0x0439('0x2c')](_0x0439('0x48'),_0x1693b7);endRouting(_0x1693b7,_0x22be1a,_0x5484e8,_0x16f659);clearTimeout(_0x2d9de8);_0x5e8b89['close'](!![]);_0x3f26bd['next']();},_0x251275);switch(_0x22be1a[_0x0439('0x49')]){case _0x0439('0x4a'):strategy[_0x0439('0x4a')](_0x5e8b89,_0x22be1a,_0x16f659,_0x5484e8);break;default:strategy['beepall'](_0x5e8b89,_0x22be1a,_0x16f659,_0x5484e8);}}else{logger[_0x0439('0x31')](_0x0439('0x4b'),_0x1693b7,_0x53f262[_0x0439('0x2e')]);_0x3f26bd[_0x0439('0x40')]();}}}catch(_0x13034d){console[_0x0439('0x4c')](_0x13034d);logger[_0x0439('0x31')]('[%s][QUEUE]\x20%s',_0x1693b7,_0x13034d[_0x0439('0x4d')]);_0x3f26bd[_0x0439('0x40')]();}};}; \ 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 e78c57b..dfa2459 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 _0xb493=['push','handleRun','bind','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue'];(function(_0x3e42ee,_0x22cde0){var _0x5e68a9=function(_0x168988){while(--_0x168988){_0x3e42ee['push'](_0x3e42ee['shift']());}};_0x5e68a9(++_0x22cde0);}(_0xb493,0x10f));var _0x3b49=function(_0x5d0768,_0x349515){_0x5d0768=_0x5d0768-0x0;var _0x3d6115=_0xb493[_0x5d0768];return _0x3d6115;};'use strict';var _=require(_0x3b49('0x0'));var uuid=require(_0x3b49('0x1'));var util=require(_0x3b49('0x2'));var logger=require('../../../../../config/logger')(_0x3b49('0x3'));var Agent=function(_0x3cb3e6,_0x5133de,_0x4ea249,_0x3acb74){this[_0x3b49('0x4')]=uuid['v4']();this['squeue']=_0x3cb3e6;this[_0x3b49('0x5')]=_0x5133de;this[_0x3b49('0x6')]=_0x4ea249;this['routing']=_0x3acb74;this[_0x3b49('0x7')][_0x3b49('0x8')](this[_0x3b49('0x9')][_0x3b49('0xa')](this),this['handleTimeout'][_0x3b49('0xa')](this));this[_0x3b49('0x7')]['on'](_0x3b49('0xb'),this['handleTimeout'][_0x3b49('0xa')](this));this[_0x3b49('0x7')]['on'](_0x3b49('0xc'),this[_0x3b49('0xd')][_0x3b49('0xa')](this));};Agent[_0x3b49('0xe')][_0x3b49('0x8')]=function(){this[_0x3b49('0x7')][_0x3b49('0x8')](this[_0x3b49('0x9')]['bind'](this),this['handleTimeout'][_0x3b49('0xa')](this));};Agent['prototype'][_0x3b49('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x3b49('0xe')]['handleRun']=function(){logger[_0x3b49('0xf')](_0x3b49('0x10'),this[_0x3b49('0x7')]['id'],this[_0x3b49('0x5')]['id']);if(_[_0x3b49('0x11')](this[_0x3b49('0x6')][_0x3b49('0x12')][this[_0x3b49('0x5')]['id']])){logger[_0x3b49('0xf')](_0x3b49('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x3b49('0x8')][_0x3b49('0xa')](this),0x3e8);}else{if(this[_0x3b49('0x3')][_0x3b49('0x14')]||util['isAgentAvailable'](this[_0x3b49('0x7')]['id'],this[_0x3b49('0x6')][_0x3b49('0x12')][this['agent']['id']],this[_0x3b49('0x7')][_0x3b49('0x15')],![])){this[_0x3b49('0x6')]['agents'][this[_0x3b49('0x5')]['id']]['busy']=!![];this['realtime'][_0x3b49('0x12')][this['agent']['id']][_0x3b49('0x16')]=undefined;util[_0x3b49('0x17')](this[_0x3b49('0x4')],this[_0x3b49('0x7')]['id'],this[_0x3b49('0x6')][_0x3b49('0x12')][this[_0x3b49('0x5')]['id']],null,this['routing']);util['writeLog'](this[_0x3b49('0x7')]['id'],this[_0x3b49('0x6')]['agents'][this[_0x3b49('0x5')]['id']],_0x3b49('0x18')+(this[_0x3b49('0x3')]['forcedOwnership']?_0x3b49('0x19'):''));}else{logger[_0x3b49('0xf')](_0x3b49('0x1a'),this[_0x3b49('0x7')]['id'],this['agent']['id']);setTimeout(this[_0x3b49('0x8')][_0x3b49('0xa')](this),0x3e8);}}};Agent[_0x3b49('0xe')]['handleTimeout']=function(_0x20b92d){if(_['isNil'](this[_0x3b49('0x6')][_0x3b49('0x12')][this['agent']['id']])){return logger['debug'](_0x3b49('0x13'),this[_0x3b49('0x7')]['id'],this['agent']['id']);}else{logger[_0x3b49('0xf')](_0x3b49('0x1b'),this[_0x3b49('0x7')]['id'],this['agent']['id']);util[_0x3b49('0x1c')](this['notificationId'],this[_0x3b49('0x7')]['id'],this[_0x3b49('0x6')]['agents'][this[_0x3b49('0x5')]['id']],null,this[_0x3b49('0x3')]);this['realtime'][_0x3b49('0x12')][this[_0x3b49('0x5')]['id']]['busy']=![];this[_0x3b49('0x6')]['agents'][this[_0x3b49('0x5')]['id']]['busyQueue']=undefined;util[_0x3b49('0x1d')](this['squeue']['id'],this[_0x3b49('0x6')]['agents'][this[_0x3b49('0x5')]['id']],_0x20b92d?_0x3b49('0x1e'):'TIMEOUT');}if(!_0x20b92d){setTimeout(this[_0x3b49('0x8')][_0x3b49('0xa')](this),0x3e8);}};function agent(_0x1c53b7,_0x5da1e6,_0x29710f,_0x3cec38){return new Agent(_0x1c53b7,_0x5da1e6,_0x29710f,_0x3cec38);}module['exports']=agent; \ No newline at end of file +var _0x1812=['[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','bind','handleTimeout','timeout','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','agents','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','prototype'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1812,0xb5));var _0x2181=function(_0x41b934,_0x23518a){_0x41b934=_0x41b934-0x0;var _0x10c248=_0x1812[_0x41b934];return _0x10c248;};'use strict';var _=require(_0x2181('0x0'));var uuid=require(_0x2181('0x1'));var util=require(_0x2181('0x2'));var logger=require(_0x2181('0x3'))(_0x2181('0x4'));var Agent=function(_0x409ca4,_0x3e7019,_0xba10ae,_0x5d5591){this[_0x2181('0x5')]=uuid['v4']();this[_0x2181('0x6')]=_0x409ca4;this['agent']=_0x3e7019;this['realtime']=_0xba10ae;this[_0x2181('0x4')]=_0x5d5591;this['squeue'][_0x2181('0x7')](this[_0x2181('0x8')][_0x2181('0x9')](this),this[_0x2181('0xa')][_0x2181('0x9')](this));this['squeue']['on'](_0x2181('0xb'),this[_0x2181('0xa')]['bind'](this));this[_0x2181('0x6')]['on']('drained',this[_0x2181('0xc')][_0x2181('0x9')](this));};Agent['prototype'][_0x2181('0x7')]=function(){this[_0x2181('0x6')][_0x2181('0x7')](this[_0x2181('0x8')][_0x2181('0x9')](this),this[_0x2181('0xa')][_0x2181('0x9')](this));};Agent['prototype'][_0x2181('0xc')]=function(){this[_0x2181('0xa')](!![]);};Agent['prototype'][_0x2181('0x8')]=function(){logger[_0x2181('0xd')](_0x2181('0xe'),this[_0x2181('0x6')]['id'],this[_0x2181('0xf')]['id']);if(_[_0x2181('0x10')](this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']])){logger[_0x2181('0xd')](_0x2181('0x12'),this[_0x2181('0x6')]['id'],this[_0x2181('0xf')]['id']);setTimeout(this[_0x2181('0x7')][_0x2181('0x9')](this),0x3e8);}else{if(this[_0x2181('0x4')][_0x2181('0x13')]||util['isAgentAvailable'](this[_0x2181('0x6')]['id'],this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']],this[_0x2181('0x6')][_0x2181('0x14')],![])){this[_0x2181('0x11')][_0x2181('0x15')][this[_0x2181('0xf')]['id']][_0x2181('0x16')]=!![];this[_0x2181('0x11')][_0x2181('0x15')][this['agent']['id']][_0x2181('0x17')]=undefined;util[_0x2181('0x18')](this[_0x2181('0x5')],this[_0x2181('0x6')]['id'],this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']],null,this['routing']);util['writeLog'](this[_0x2181('0x6')]['id'],this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']],_0x2181('0x19')+(this[_0x2181('0x4')][_0x2181('0x13')]?_0x2181('0x1a'):''));}else{logger[_0x2181('0xd')](_0x2181('0x1b'),this[_0x2181('0x6')]['id'],this[_0x2181('0xf')]['id']);setTimeout(this[_0x2181('0x7')][_0x2181('0x9')](this),0x3e8);}}};Agent[_0x2181('0x1c')][_0x2181('0xa')]=function(_0xd36a98){if(_[_0x2181('0x10')](this[_0x2181('0x11')][_0x2181('0x15')][this[_0x2181('0xf')]['id']])){return logger[_0x2181('0xd')](_0x2181('0x12'),this['squeue']['id'],this[_0x2181('0xf')]['id']);}else{logger[_0x2181('0xd')](_0x2181('0x1d'),this[_0x2181('0x6')]['id'],this['agent']['id']);util[_0x2181('0x1e')](this[_0x2181('0x5')],this[_0x2181('0x6')]['id'],this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']],null,this[_0x2181('0x4')]);this['realtime'][_0x2181('0x15')][this[_0x2181('0xf')]['id']][_0x2181('0x16')]=![];this[_0x2181('0x11')][_0x2181('0x15')][this[_0x2181('0xf')]['id']][_0x2181('0x17')]=undefined;util[_0x2181('0x1f')](this[_0x2181('0x6')]['id'],this['realtime']['agents'][this[_0x2181('0xf')]['id']],_0xd36a98?_0x2181('0x20'):_0x2181('0x21'));}if(!_0xd36a98){setTimeout(this['push'][_0x2181('0x9')](this),0x3e8);}};function agent(_0x28ddaa,_0x33ccaa,_0x340943,_0x1a6bb1){return new Agent(_0x28ddaa,_0x33ccaa,_0x340943,_0x1a6bb1);}module[_0x2181('0x22')]=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 9a943e4..59ef1d2 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 _0xa1b9=['name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','notificationId','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','queue','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0xa1b9,0x71));var _0x9a1b=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa1b9[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x9a1b('0x0'));var uuid=require('uuid');var util=require(_0x9a1b('0x1'));var logger=require(_0x9a1b('0x2'))(_0x9a1b('0x3'));var Beepall=function(_0x3515cf,_0x353bb4,_0x2250f4,_0x226928){this['notificationId']=uuid['v4']();this[_0x9a1b('0x4')]=_0x3515cf;this[_0x9a1b('0x5')]=_0x353bb4;this[_0x9a1b('0x6')]=_0x2250f4;this[_0x9a1b('0x3')]=_0x226928;this['squeue'][_0x9a1b('0x7')](this['handleRun'][_0x9a1b('0x8')](this),this[_0x9a1b('0x9')][_0x9a1b('0x8')](this));this[_0x9a1b('0x4')]['on'](_0x9a1b('0xa'),this['handleTimeout'][_0x9a1b('0x8')](this));this[_0x9a1b('0x4')]['on'](_0x9a1b('0xb'),this[_0x9a1b('0xc')][_0x9a1b('0x8')](this));};Beepall[_0x9a1b('0xd')][_0x9a1b('0x7')]=function(){this['squeue'][_0x9a1b('0x7')](this[_0x9a1b('0xe')][_0x9a1b('0x8')](this),this['handleTimeout'][_0x9a1b('0x8')](this));};Beepall[_0x9a1b('0xd')][_0x9a1b('0xc')]=function(){this[_0x9a1b('0x9')](!![]);};Beepall[_0x9a1b('0xd')][_0x9a1b('0xe')]=function(){var _0x3fe388=!![];if(!_[_0x9a1b('0xf')](this[_0x9a1b('0x5')])&&!_[_0x9a1b('0xf')](this['queue'][_0x9a1b('0x10')])&&this[_0x9a1b('0x5')]['Agents'][_0x9a1b('0x11')]>0x0){for(var _0xbac830=0x0,_0x80245;_0xbac8300x0){for(var _0x13f8ed=0x0,_0xbcf794;_0x13f8ed0x0&&_0x4d6706[_0x5c4184+'CurrentCapacity']>=_0x4d6706[_0x5c4184+_0x031f('0x1e')]){writeLog(_0x451328,_0x4d6706,_0x5c4184[_0x031f('0x1f')]()+_0x031f('0x20'));return![];}}return!![];};exports['showNotification']=function(_0x35af16,_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617){return sendNotification(!![],_0x35af16,_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617);};exports[_0x031f('0x21')]=function(_0x5395ea,_0xa308b,_0x114e34,_0xb6ed6c,_0xaf5bea){return sendNotification(![],_0x5395ea,_0xa308b,_0x114e34,_0xb6ed6c,_0xaf5bea);};exports[_0x031f('0x22')]=writeLog; \ No newline at end of file +var _0xfdbd=['remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','user:%s','name','emit','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','format','notification:%s','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x34a087,_0x4bd68e){_0x34a087=_0x34a087-0x0;var _0x5c15d7=_0xfdbd[_0x34a087];return _0x5c15d7;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var utils=require(_0xdfdb('0x2'));var Redis=require(_0xdfdb('0x3'));var config=require(_0xdfdb('0x4'));var logger=require(_0xdfdb('0x5'))(_0xdfdb('0x6'));config[_0xdfdb('0x7')]=_[_0xdfdb('0x8')](config['redis'],{'host':_0xdfdb('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdfdb('0x7')]));function sendNotification(_0x41bd5e,_0x489f19,_0x556dc0,_0x590b5d,_0x188508,_0xf72a24){io['to'](util['format'](_0xdfdb('0xa'),_0x590b5d[_0xdfdb('0xb')]))[_0xdfdb('0xc')](_0xdfdb('0xd'),_0x590b5d);var _0x3a44a9=_0xf72a24||{};var _0x1ace28=_0x556dc0[_0xdfdb('0xe')]('.');var _0x47dccc={'uniqueid':_0x489f19,'channel':_0x1ace28[0x0],'id':_0x1ace28[0x1],'title':_0x1ace28[0x0]+_0xdfdb('0xf'),'interactionId':_0x1ace28[0x2],'queue':_0x188508?_0x188508[_0xdfdb('0xb')]:null,'sound':_0x3a44a9['account'][_0xdfdb('0x10')],'shake':_0x3a44a9[_0xdfdb('0x11')][_0xdfdb('0x12')]};try{if(!_0x3a44a9[_0xdfdb('0x13')]){_0x3a44a9[_0xdfdb('0x13')]={};}if(_0x188508){_0x3a44a9[_0xdfdb('0x13')][_0xdfdb('0x14')]=_0x188508;}else if(_0x3a44a9[_0xdfdb('0x13')]['queue']){delete _0x3a44a9['body'][_0xdfdb('0x14')];}_0x47dccc['msg']=utils[_0xdfdb('0x15')](_0x3a44a9[_0xdfdb('0x11')][_0xdfdb('0x16')],_0x3a44a9);}catch(_0x40bc8a){_0x47dccc[_0xdfdb('0x17')]=_0xdfdb('0x18');logger['error'](util['format'](_0xdfdb('0x19'),_0x489f19,_0x40bc8a[_0xdfdb('0x1a')]));}io['to'](util[_0xdfdb('0x1b')]('user:%s',_0x590b5d[_0xdfdb('0xb')]))[_0xdfdb('0xc')](util[_0xdfdb('0x1b')](_0xdfdb('0x1c'),_0x41bd5e?_0xdfdb('0x1d'):_0xdfdb('0x1e')),_0x47dccc);}function writeLog(_0x693a2c,_0x29a639,_0x5b8cb5){return logger[_0xdfdb('0x1f')](util[_0xdfdb('0x1b')](_0xdfdb('0x20'),_0x693a2c,_0x29a639['name'],_0x5b8cb5));}exports[_0xdfdb('0x21')]=function(_0x397f7c,_0x2c7dd1,_0x4d55e5,_0x280e53){if(_0x2c7dd1[_0xdfdb('0x22')]){writeLog(_0x397f7c,_0x2c7dd1,_0xdfdb('0x23'));return![];}if(!_0x2c7dd1['online']){writeLog(_0x397f7c,_0x2c7dd1,_0xdfdb('0x24'));return![];}if(_0x2c7dd1[_0x4d55e5+'Pause']){writeLog(_0x397f7c,_0x2c7dd1,_0xdfdb('0x25'));return![];}if(_0x280e53&&_0x2c7dd1[_0xdfdb('0x26')](_0x4d55e5+_0xdfdb('0x27'))&&_0x2c7dd1[_0xdfdb('0x26')](_0x4d55e5+'CurrentCapacity')){if(_0x2c7dd1[_0x4d55e5+_0xdfdb('0x27')]>0x0&&_0x2c7dd1[_0x4d55e5+_0xdfdb('0x28')]>=_0x2c7dd1[_0x4d55e5+_0xdfdb('0x27')]){writeLog(_0x397f7c,_0x2c7dd1,_0x4d55e5[_0xdfdb('0x29')]()+_0xdfdb('0x2a'));return![];}}return!![];};exports[_0xdfdb('0x2b')]=function(_0x57d24f,_0xec4d22,_0x2d5fe2,_0xdf3a5c,_0x4f8057){return sendNotification(!![],_0x57d24f,_0xec4d22,_0x2d5fe2,_0xdf3a5c,_0x4f8057);};exports[_0xdfdb('0x2c')]=function(_0x5df454,_0xd0cef0,_0x1aec66,_0x19c36f,_0x513fa0){return sendNotification(![],_0x5df454,_0xd0cef0,_0x1aec66,_0x19c36f,_0x513fa0);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 2f1c5b0..17d36a2 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 _0xa952=['isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','consequence','length','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x48744b,_0x25223f){var _0x50920f=function(_0x56e8f8){while(--_0x56e8f8){_0x48744b['push'](_0x48744b['shift']());}};_0x50920f(++_0x25223f);}(_0xa952,0x1b2));var _0x2a95=function(_0x559aca,_0x41a249){_0x559aca=_0x559aca-0x0;var _0x5627fe=_0xa952[_0x559aca];return _0x5627fe;};'use strict';var schema=require(_0x2a95('0x0'));var sh=require(_0x2a95('0x1'));var _=require(_0x2a95('0x2'));var utils=require(_0x2a95('0x3'));var logger=require(_0x2a95('0x4'))(_0x2a95('0x5'));var system=schema({'command':{'type':_0x2a95('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x2a95('0x7')]=function(_0x40acda,_0x3663f9){return function(_0x1c7820){try{var _0x53c54f={'command':_0x3663f9[0x0]};var _0x153806=system[_0x2a95('0x0')](_0x53c54f,{'typecast':!![]});if(_0x153806[_0x2a95('0x8')]){logger['error'](_0x2a95('0x9'),_0x40acda,_['map'](_0x153806,_0x2a95('0xa'))[_0x2a95('0xb')](',\x20'));logger[_0x2a95('0xc')](_0x2a95('0xd'),_0x40acda);_0x1c7820['next']();}else{var _0x38990b=this;var _0x6edd7e=utils['getMustacheRender'](_0x3663f9[0x0],this);logger[_0x2a95('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x40acda,_0x6edd7e);sh[_0x2a95('0xe')](_[_0x2a95('0xf')](_0x6edd7e),function(_0xe06e19,_0x2a6ac9){logger[_0x2a95('0xc')](_0x2a95('0x10'),_0x40acda,_0xe06e19);if(_0xe06e19==0x0){var _0x31e060=_0x2a6ac9[_0x2a95('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x2a95('0x12')](_0x3663f9[0x1])||_['isEmpty'](_0x3663f9[0x1])){logger[_0x2a95('0xc')](_0x2a95('0x13'),_0x40acda);_0x38990b[_0x2a95('0x14')][_0x3663f9[0x1]]=_0x31e060;}else{logger[_0x2a95('0xc')](_0x2a95('0x15'),_0x40acda,_0x3663f9[0x1],_0x31e060);_0x38990b[_0x2a95('0x14')][_0x3663f9[0x1]]=_0x31e060;}}_0x1c7820['next']();});}}catch(_0x4cf661){logger['error'](_0x2a95('0x9'),_0x40acda,_[_0x2a95('0x16')](_0x4cf661)?JSON[_0x2a95('0x17')](_0x4cf661):_0x4cf661);logger[_0x2a95('0xc')](_0x2a95('0xd'),_0x40acda);_0x1c7820['next']();}};}; \ No newline at end of file +var _0x0fca=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x541eaa,_0x1b3dd1){var _0x3fe0f5=function(_0x2e28cc){while(--_0x2e28cc){_0x541eaa['push'](_0x541eaa['shift']());}};_0x3fe0f5(++_0x1b3dd1);}(_0x0fca,0x185));var _0xa0fc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0fca[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0xa0fc('0x0'));var sh=require(_0xa0fc('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xa0fc('0x2'))(_0xa0fc('0x3'));var system=schema({'command':{'type':_0xa0fc('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa0fc('0x5')]=function(_0x2156b7,_0x5d5f88){return function(_0x3effea){try{var _0x10121c={'command':_0x5d5f88[0x0]};var _0x42b04d=system[_0xa0fc('0x0')](_0x10121c,{'typecast':!![]});if(_0x42b04d[_0xa0fc('0x6')]){logger[_0xa0fc('0x7')](_0xa0fc('0x8'),_0x2156b7,_['map'](_0x42b04d,'message')[_0xa0fc('0x9')](',\x20'));logger[_0xa0fc('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2156b7);_0x3effea[_0xa0fc('0xb')]();}else{var _0x29476f=this;var _0x482f2c=utils['getMustacheRender'](_0x5d5f88[0x0],this);logger[_0xa0fc('0xa')](_0xa0fc('0xc'),_0x2156b7,_0x482f2c);sh[_0xa0fc('0xd')](_[_0xa0fc('0xe')](_0x482f2c),function(_0x692ec1,_0x2d0c32){logger[_0xa0fc('0xa')](_0xa0fc('0xf'),_0x2156b7,_0x692ec1);if(_0x692ec1==0x0){var _0x29a2ca=_0x2d0c32[_0xa0fc('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xa0fc('0x11')](_0x5d5f88[0x1])||_[_0xa0fc('0x12')](_0x5d5f88[0x1])){logger['info'](_0xa0fc('0x13'),_0x2156b7);_0x29476f[_0xa0fc('0x14')][_0x5d5f88[0x1]]=_0x29a2ca;}else{logger[_0xa0fc('0xa')](_0xa0fc('0x15'),_0x2156b7,_0x5d5f88[0x1],_0x29a2ca);_0x29476f[_0xa0fc('0x14')][_0x5d5f88[0x1]]=_0x29a2ca;}}_0x3effea[_0xa0fc('0xb')]();});}}catch(_0x55f921){logger[_0xa0fc('0x7')](_0xa0fc('0x8'),_0x2156b7,_[_0xa0fc('0x16')](_0x55f921)?JSON[_0xa0fc('0x17')](_0x55f921):_0x55f921);logger[_0xa0fc('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2156b7);_0x3effea['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 91dd9d0..03209d8 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 _0x0cee=['consequence','length','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x46dcfd,_0x122133){var _0x18b3af=function(_0xd8daa6){while(--_0xd8daa6){_0x46dcfd['push'](_0x46dcfd['shift']());}};_0x18b3af(++_0x122133);}(_0x0cee,0x1d2));var _0xe0ce=function(_0x4da392,_0xb29ed2){_0x4da392=_0x4da392-0x0;var _0xe03c5c=_0x0cee[_0x4da392];return _0xe03c5c;};'use strict';var schema=require(_0xe0ce('0x0'));var _=require(_0xe0ce('0x1'));var rpc={'chatInteraction':require(_0xe0ce('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xe0ce('0x3')),'mailInteraction':require(_0xe0ce('0x4')),'faxInteraction':require(_0xe0ce('0x5')),'whatsappInteraction':require(_0xe0ce('0x6'))};var logger=require(_0xe0ce('0x7'))('routing');var tag=schema({'tag':{'type':_0xe0ce('0x8'),'required':!![],'message':_0xe0ce('0x9')}});exports[_0xe0ce('0xa')]=function(_0x35f6a9,_0x52600c,_0x508e8f,_0x3ef28f){return function(_0x344ef1){try{var _0x2ec422={'tag':_0x52600c[0x0]};var _0x2166ea=tag[_0xe0ce('0x0')](_0x2ec422,{'typecast':!![]});if(_0x2166ea[_0xe0ce('0xb')]){logger['error'](_0xe0ce('0xc'),_0x35f6a9,_['map'](_0x2166ea,_0xe0ce('0xd'))[_0xe0ce('0xe')](',\x20'));logger[_0xe0ce('0xf')](_0xe0ce('0x10'),_0x35f6a9);_0x344ef1[_0xe0ce('0x11')]();}else{var _0x1434b9={'ids':[_0x52600c[0x0]]};if(rpc[_0x3ef28f[_0xe0ce('0x12')]+_0xe0ce('0x13')]){rpc[_0x3ef28f[_0xe0ce('0x12')]+_0xe0ce('0x13')][_0xe0ce('0x14')](_0x3ef28f[_0xe0ce('0x15')]['id'],_0x1434b9)['then'](function(_0x25df5c){logger[_0xe0ce('0xf')](_0xe0ce('0x16'),_0x35f6a9,_0x52600c[0x1],_0x3ef28f[_0xe0ce('0x12')],_0x3ef28f[_0xe0ce('0x15')]['id']);})[_0xe0ce('0x17')](function(_0x2e8cd4){logger[_0xe0ce('0x18')](_0xe0ce('0xc'),_0x35f6a9,JSON[_0xe0ce('0x19')](_0x2e8cd4));logger[_0xe0ce('0xf')](_0xe0ce('0x10'),_0x35f6a9);})[_0xe0ce('0x1a')](function(){_0x344ef1[_0xe0ce('0x11')]();});}}}catch(_0x4db846){logger[_0xe0ce('0x18')](_0xe0ce('0xc'),_0x35f6a9,_[_0xe0ce('0x1b')](_0x4db846)?JSON['stringify'](_0x4db846):_0x4db846);logger[_0xe0ce('0xf')](_0xe0ce('0x10'),_0x35f6a9);_0x344ef1[_0xe0ce('0x11')]();}};}; \ No newline at end of file +var _0xcb7f=['info','next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','error','stringify','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','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','consequence','message','join'];(function(_0x36743b,_0x41426a){var _0xc6db05=function(_0xa1afe5){while(--_0xa1afe5){_0x36743b['push'](_0x36743b['shift']());}};_0xc6db05(++_0x41426a);}(_0xcb7f,0x1cd));var _0xfcb7=function(_0x4ff3a0,_0x2f6a18){_0x4ff3a0=_0x4ff3a0-0x0;var _0x2592a8=_0xcb7f[_0x4ff3a0];return _0x2592a8;};'use strict';var schema=require(_0xfcb7('0x0'));var _=require(_0xfcb7('0x1'));var rpc={'chatInteraction':require(_0xfcb7('0x2')),'openchannelInteraction':require(_0xfcb7('0x3')),'smsInteraction':require(_0xfcb7('0x4')),'mailInteraction':require(_0xfcb7('0x5')),'faxInteraction':require(_0xfcb7('0x6')),'whatsappInteraction':require(_0xfcb7('0x7'))};var logger=require(_0xfcb7('0x8'))(_0xfcb7('0x9'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xfcb7('0xa')}});exports[_0xfcb7('0xb')]=function(_0x9ee710,_0x77be41,_0x59af06,_0x2dd0a1){return function(_0x52ea13){try{var _0x1ac920={'tag':_0x77be41[0x0]};var _0x17a4ea=tag['validate'](_0x1ac920,{'typecast':!![]});if(_0x17a4ea['length']){logger['error']('[%s][TAG]\x20%s',_0x9ee710,_['map'](_0x17a4ea,_0xfcb7('0xc'))[_0xfcb7('0xd')](',\x20'));logger[_0xfcb7('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x9ee710);_0x52ea13[_0xfcb7('0xf')]();}else{var _0x43e23e={'ids':[_0x77be41[0x0]]};if(rpc[_0x2dd0a1[_0xfcb7('0x10')]+_0xfcb7('0x11')]){rpc[_0x2dd0a1[_0xfcb7('0x10')]+_0xfcb7('0x11')][_0xfcb7('0x12')](_0x2dd0a1['interaction']['id'],_0x43e23e)['then'](function(_0xa0718e){logger[_0xfcb7('0xe')](_0xfcb7('0x13'),_0x9ee710,_0x77be41[0x1],_0x2dd0a1[_0xfcb7('0x10')],_0x2dd0a1[_0xfcb7('0x14')]['id']);})['catch'](function(_0x3cef88){logger[_0xfcb7('0x15')]('[%s][TAG]\x20%s',_0x9ee710,JSON[_0xfcb7('0x16')](_0x3cef88));logger[_0xfcb7('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x9ee710);})['finally'](function(){_0x52ea13[_0xfcb7('0xf')]();});}}}catch(_0x4175f9){logger['error']('[%s][TAG]\x20%s',_0x9ee710,_[_0xfcb7('0x17')](_0x4175f9)?JSON[_0xfcb7('0x16')](_0x4175f9):_0x4175f9);logger[_0xfcb7('0xe')](_0xfcb7('0x18'),_0x9ee710);_0x52ea13[_0xfcb7('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index d92b7fa..954b551 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 _0x639e=['urlOnAnswer','?params=','title','jsonrpc','2.0','method','stringify','utf8','POST','application/json-rpc','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','lodash','replace','push'];(function(_0x3a9aac,_0x299e9b){var _0x31b6f5=function(_0x19c315){while(--_0x19c315){_0x3a9aac['push'](_0x3a9aac['shift']());}};_0x31b6f5(++_0x299e9b);}(_0x639e,0x113));var _0xe639=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x639e[_0x10291b];return _0x1d5fbe;};'use strict';var rp=require(_0xe639('0x0'));var logger=require(_0xe639('0x1'))('routing');var _=require(_0xe639('0x2'));var arr=[];exports['consequence']=function(_0x3b9fb2,_0x348148){return function(_0x3a0019){var _0x509da6=_0x348148[0xa];var _0x31ff49=_0x348148[0xb];var _0x780fbf=_0x348148[0xc];var _0x353c2b=_0x348148[0xd];var _0x359fac=_0x348148[0xe];var _0x4749f3=_0x348148[0xf][_0xe639('0x3')](/\n/g,'\x20-\x20');var _0x21ec68=_0x348148[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x31ff49)){arr[_0xe639('0x4')](_0x31ff49);var _0x21d216=_0x348148[0x3];var _0x2b97f5=_0x348148[0x4];var _0x36e423=_0x348148[0x1];var _0xc72822=_0x348148[0x0];var _0x47c736={};_0x47c736[_0xe639('0x5')]=_0x348148[0x8]+_0xe639('0x6')+_0x780fbf+'|'+_0x509da6+'|'+_0x353c2b+'|'+_0x31ff49+'|'+_0x359fac;_0x47c736['urlOnRing']=_0x348148[0x7]+_0xe639('0x6')+_0x780fbf+'|'+_0x509da6+'|'+_0x353c2b+'|'+_0x31ff49+'|'+_0x359fac+'|'+_0x4749f3+'|'+_0x21ec68;_0x47c736[_0xe639('0x7')]=_0x348148[0x9];var _0x21e129={};_0x21e129[_0xe639('0x8')]=_0xe639('0x9');_0x21e129[_0xe639('0xa')]='login';var _0x445b6d=[];_0x445b6d[_0xe639('0x4')](_0x348148[0x2]);_0x445b6d['push'](_0x348148[0x5]);_0x445b6d[_0xe639('0x4')](_0x348148[0x6]);_0x21e129['params']=_0x445b6d;_0x21e129['id']=0x1;var _0x4662ac=JSON[_0xe639('0xb')](_0x21e129);var _0x38cdef={'encoding':_0xe639('0xc'),'method':_0xe639('0xd'),'timeout':0x2710,'url':_0x21d216,'headers':{'Content-Type':_0xe639('0xe')},'body':_0x4662ac};return rp(_0x38cdef)['then'](function(_0x516d81){const _0x2f33d6=JSON[_0xe639('0xf')](_0x516d81);if(!_0x2f33d6['result'][_0xe639('0x10')]){throw new Error(_0xe639('0x11'));}var _0x59eccf=_0x31ff49;var _0x4a71e5=_0xe639('0x12')+_0x36e423+_0xe639('0x13')+_0xc72822+'&sessionId='+_0x59eccf+_0xe639('0x14')+JSON[_0xe639('0xb')](_0x47c736);var _0x540c88=_0x2b97f5+'?'+_0x4a71e5;return rp(_0x540c88);})['then'](function(_0x3b26c1){logger[_0xe639('0x15')](_0xe639('0x16'),_0x3b9fb2,_0x3b26c1);_0x3a0019[_0xe639('0x17')]();})[_0xe639('0x18')](function(_0x35f437){logger['error'](_0xe639('0x19'),_0x3b9fb2,_[_0xe639('0x1a')](_0x35f437)?JSON[_0xe639('0xb')](_0x35f437):_0x35f437);_0x3a0019['stop']();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x3b9fb2);_0x3a0019[_0xe639('0x1b')]();}};}; \ No newline at end of file +var _0xcce4=['jsonrpc','2.0','method','login','push','params','stringify','utf8','POST','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','urlOnAnswer','?params=','urlOnRing','title'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xcce4,0x11f));var _0x4cce=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xcce4[_0x3f7598];return _0x51fb16;};'use strict';var rp=require(_0x4cce('0x0'));var logger=require(_0x4cce('0x1'))(_0x4cce('0x2'));var _=require(_0x4cce('0x3'));var arr=[];exports['consequence']=function(_0x13d01e,_0xde1cc8){return function(_0xd67b94){var _0x5b7a73=_0xde1cc8[0xa];var _0x3f3e96=_0xde1cc8[0xb];var _0x8fc519=_0xde1cc8[0xc];var _0x360a18=_0xde1cc8[0xd];var _0x3df8b4=_0xde1cc8[0xe];var _0x3bab0d=_0xde1cc8[0xf][_0x4cce('0x4')](/\n/g,_0x4cce('0x5'));var _0x2ba004=_0xde1cc8[0x10][_0x4cce('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x3f3e96)){arr['push'](_0x3f3e96);var _0x391915=_0xde1cc8[0x3];var _0xdc12c6=_0xde1cc8[0x4];var _0x3f1dce=_0xde1cc8[0x1];var _0x348cba=_0xde1cc8[0x0];var _0x12c6ac={};_0x12c6ac[_0x4cce('0x6')]=_0xde1cc8[0x8]+_0x4cce('0x7')+_0x8fc519+'|'+_0x5b7a73+'|'+_0x360a18+'|'+_0x3f3e96+'|'+_0x3df8b4;_0x12c6ac[_0x4cce('0x8')]=_0xde1cc8[0x7]+_0x4cce('0x7')+_0x8fc519+'|'+_0x5b7a73+'|'+_0x360a18+'|'+_0x3f3e96+'|'+_0x3df8b4+'|'+_0x3bab0d+'|'+_0x2ba004;_0x12c6ac[_0x4cce('0x9')]=_0xde1cc8[0x9];var _0x5608a3={};_0x5608a3[_0x4cce('0xa')]=_0x4cce('0xb');_0x5608a3[_0x4cce('0xc')]=_0x4cce('0xd');var _0x3939d5=[];_0x3939d5[_0x4cce('0xe')](_0xde1cc8[0x2]);_0x3939d5[_0x4cce('0xe')](_0xde1cc8[0x5]);_0x3939d5['push'](_0xde1cc8[0x6]);_0x5608a3[_0x4cce('0xf')]=_0x3939d5;_0x5608a3['id']=0x1;var _0x57c887=JSON[_0x4cce('0x10')](_0x5608a3);var _0x2f7f6d={'encoding':_0x4cce('0x11'),'method':_0x4cce('0x12'),'timeout':0x2710,'url':_0x391915,'headers':{'Content-Type':'application/json-rpc'},'body':_0x57c887};return rp(_0x2f7f6d)[_0x4cce('0x13')](function(_0x1b3ca9){const _0x1f9de8=JSON[_0x4cce('0x14')](_0x1b3ca9);if(!_0x1f9de8[_0x4cce('0x15')][_0x4cce('0x16')]){throw new Error(_0x4cce('0x17'));}var _0x3dc5e8=_0x3f3e96;var _0x5c67d0=_0x4cce('0x18')+_0x3f1dce+'&serviceId='+_0x348cba+'&sessionId='+_0x3dc5e8+_0x4cce('0x19')+JSON[_0x4cce('0x10')](_0x12c6ac);var _0x441ab5=_0xdc12c6+'?'+_0x5c67d0;return rp(_0x441ab5);})[_0x4cce('0x13')](function(_0x523a6f){logger[_0x4cce('0x1a')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x13d01e,_0x523a6f);_0xd67b94[_0x4cce('0x1b')]();})[_0x4cce('0x1c')](function(_0x3e5ea5){logger[_0x4cce('0x1d')](_0x4cce('0x1e'),_0x13d01e,_[_0x4cce('0x1f')](_0x3e5ea5)?JSON[_0x4cce('0x10')](_0x3e5ea5):_0x3e5ea5);_0xd67b94[_0x4cce('0x1b')]();});}else{logger[_0x4cce('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x13d01e);_0xd67b94[_0x4cce('0x20')]();}};}; \ 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 11854d3..4e839fe 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4e4c50,_0x637a2f){var _0x4146d7=function(_0x371c10){while(--_0x371c10){_0x4e4c50['push'](_0x4e4c50['shift']());}};_0x4146d7(++_0x637a2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4e4ec8,_0x49edfe){var _0x2f4586=function(_0x3c382c){while(--_0x3c382c){_0x4e4ec8['push'](_0x4e4ec8['shift']());}};_0x2f4586(++_0x49edfe);}(_0xe706,0xa3));var _0x6e70=function(_0x27a824,_0x50dc82){_0x27a824=_0x27a824-0x0;var _0x5a1a7b=_0xe706[_0x27a824];return _0x5a1a7b;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 0cb9b4e..c220662 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 _0xac55=['channel','message','interaction','isArray','applications','length','join','.js','app','toLowerCase','appdata','split','mail','push','slice','dialogflow','amazonlex','getMustacheRender','ChatWebsiteId','ContactId','body','./interval','./applications/','consequence','priority','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','stack','agent','agents','busyQueue','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval'];(function(_0x143c8e,_0x270a76){var _0x1e8d0c=function(_0x436bcf){while(--_0x436bcf){_0x143c8e['push'](_0x143c8e['shift']());}};_0x1e8d0c(++_0x270a76);}(_0xac55,0x1c8));var _0x5ac5=function(_0x3c909d,_0x169bbc){_0x3c909d=_0x3c909d-0x0;var _0x27c53e=_0xac55[_0x3c909d];return _0x27c53e;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var path=require(_0x5ac5('0x2'));var fs=require('fs');var jayson=require(_0x5ac5('0x3'));var BPromise=require('bluebird');var utils=require(_0x5ac5('0x4'));var logger=require(_0x5ac5('0x5'))(_0x5ac5('0x6'));var rpc={'openchannelQueueReport':require(_0x5ac5('0x7')),'mailQueueReport':require(_0x5ac5('0x8')),'chatQueueReport':require(_0x5ac5('0x9')),'smsQueueReport':require(_0x5ac5('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x5ac5('0xb'));function getId(_0x247752,_0x2bee03,_0x42551a){return util[_0x5ac5('0xc')](_0x5ac5('0xd'),_0x247752,_0x2bee03||0x0,_0x42551a||0x0);}function getIntervals(_0x18f785,_0x5b84a3){var _0x5ea6f4=[];if(!_[_0x5ac5('0xe')](_0x5b84a3[_0x5ac5('0xf')])&&!_['isNil'](_0x18f785[_0x5b84a3[_0x5ac5('0xf')]])&&!_[_0x5ac5('0xe')](_0x18f785[_0x5b84a3['IntervalId']][_0x5ac5('0x10')])){_0x5ea6f4=_[_0x5ac5('0x11')](_0x18f785[_0x5b84a3['IntervalId']][_0x5ac5('0x10')],_0x5ac5('0x12'));}else if(!_[_0x5ac5('0xe')](_0x5b84a3[_0x5ac5('0x12')])){_0x5ea6f4=[_0x5b84a3[_0x5ac5('0x12')]];}return _0x5ea6f4;}exports['listen']=function(_0xe37d9a){_0xe37d9a['rules']={};return new BPromise(function(_0x1ce256,_0x40ee8a){var _0x58e6f7={'Start':function(_0x1633d1){var _0x57377b=this;return new Promise(function(_0x2a145d,_0x340195){if(_0x1633d1){try{var _0x30244d=[];var _0x1282be=getId(_0x1633d1[_0x5ac5('0x13')],_0x1633d1[_0x5ac5('0x14')]?_0x1633d1[_0x5ac5('0x14')]['id']:0x0,_0x1633d1['interaction']?_0x1633d1[_0x5ac5('0x15')]['id']:0x0);if(_0x1633d1['applications']&&_[_0x5ac5('0x16')](_0x1633d1[_0x5ac5('0x17')])&&_0x1633d1['applications'][_0x5ac5('0x18')]){for(var _0x5725b6=0x0;_0x5725b6<_0x1633d1[_0x5ac5('0x17')]['length'];_0x5725b6+=0x1){var _0x5aa45d=_0x1633d1[_0x5ac5('0x17')][_0x5725b6];if(fs['existsSync'](path[_0x5ac5('0x19')](__dirname,_0x5ac5('0x17'),_0x5aa45d['app']+_0x5ac5('0x1a')))){var _0x4ac526=[];switch(_0x5aa45d[_0x5ac5('0x1b')][_0x5ac5('0x1c')]()){case'autoreply':var _0x47a898=_0x5aa45d[_0x5ac5('0x1d')][_0x5ac5('0x1e')](',');if(_0x1633d1[_0x5ac5('0x13')]===_0x5ac5('0x1f')){_0x4ac526[_0x5ac5('0x20')](_0x47a898[0x0]);_0x4ac526['push'](_0x47a898[0x1]);_0x4ac526[_0x5ac5('0x20')](_0x47a898[_0x5ac5('0x21')](0x2,_0x47a898[_0x5ac5('0x18')])[_0x5ac5('0x19')](','));}else{_0x4ac526['push'](_0x47a898[0x0]);_0x4ac526[_0x5ac5('0x20')](_0x47a898['slice'](0x1,_0x47a898[_0x5ac5('0x18')])[_0x5ac5('0x19')](','));}break;case _0x5ac5('0x22'):var _0x2cb82f=_0x5aa45d[_0x5ac5('0x1d')][_0x5ac5('0x1e')](',');_0x4ac526['push'](_0x2cb82f[0x0]);_0x4ac526[_0x5ac5('0x20')](_0x2cb82f[0x1]);_0x4ac526['push'](_0x2cb82f[_0x5ac5('0x21')](0x2,_0x2cb82f[_0x5ac5('0x18')])[_0x5ac5('0x19')](','));break;case'dialogflowv2':var _0x283c41=_0x5aa45d[_0x5ac5('0x1d')][_0x5ac5('0x1e')](',');_0x4ac526[_0x5ac5('0x20')](_0x283c41[0x0]);_0x4ac526['push'](_0x283c41[0x1]);_0x4ac526[_0x5ac5('0x20')](_0x283c41[0x2]);_0x4ac526['push'](_0x283c41[0x3]);_0x4ac526[_0x5ac5('0x20')](_0x283c41[_0x5ac5('0x21')](0x4,_0x283c41[_0x5ac5('0x18')])[_0x5ac5('0x19')](','));break;case _0x5ac5('0x23'):var _0x4b3c1a=_0x5aa45d[_0x5ac5('0x1d')][_0x5ac5('0x1e')](',');_0x4ac526[_0x5ac5('0x20')](_0x4b3c1a[0x0]);_0x4ac526['push'](_0x4b3c1a[0x1]);_0x4ac526[_0x5ac5('0x20')](_0x4b3c1a[0x2]);_0x4ac526['push'](_0x4b3c1a[0x3]);_0x4ac526[_0x5ac5('0x20')](_0x4b3c1a[_0x5ac5('0x21')](0x4,_0x4b3c1a[_0x5ac5('0x18')])[_0x5ac5('0x19')](','));break;case _0x5ac5('0x14'):_0x4ac526['push'](_0x5aa45d[_0x5ac5('0x1d')]);break;case'tag':_0x4ac526[_0x5ac5('0x20')](_0x5aa45d['TagId']);_0x4ac526[_0x5ac5('0x20')](_0x5aa45d[_0x5ac5('0x1d')]);break;case'tvox':var _0x2bd707=utils[_0x5ac5('0x24')](_0x1633d1['account']['notificationTemplate'],_0x1633d1);var _0x1391c5=_0x5aa45d[_0x5ac5('0x1d')][_0x5ac5('0x1e')](',');_0x4ac526[_0x5ac5('0x20')](_0x1391c5[0x0]);_0x4ac526[_0x5ac5('0x20')](_0x1391c5[0x1]);_0x4ac526[_0x5ac5('0x20')](_0x1391c5[0x2]);_0x4ac526['push'](_0x1391c5[0x3]);_0x4ac526['push'](_0x1391c5[0x4]);_0x4ac526['push'](_0x1391c5[0x5]);_0x4ac526[_0x5ac5('0x20')](_0x1391c5[0x6]);_0x4ac526[_0x5ac5('0x20')](_0x1391c5[0x7]);_0x4ac526['push'](_0x1391c5[0x8]);_0x4ac526[_0x5ac5('0x20')](_0x1391c5[0x9]);_0x4ac526[_0x5ac5('0x20')](_0x1391c5[0xa]);_0x4ac526[_0x5ac5('0x20')](_0x1633d1[_0x5ac5('0x15')]['id']);_0x4ac526[_0x5ac5('0x20')](_0x1633d1[_0x5ac5('0x14')]['id']);_0x4ac526[_0x5ac5('0x20')](_0x5aa45d[_0x5ac5('0x25')]);_0x4ac526[_0x5ac5('0x20')](_0x1633d1['interaction'][_0x5ac5('0x26')]);_0x4ac526['push'](_0x1633d1[_0x5ac5('0x27')][_0x5ac5('0x27')]);_0x4ac526[_0x5ac5('0x20')](_0x2bd707);break;default:_0x4ac526=_[_0x5ac5('0xe')](_0x5aa45d[_0x5ac5('0x1d')])?[]:_0x5aa45d[_0x5ac5('0x1d')][_0x5ac5('0x1e')](',');}var _0x37cfad={'id':util[_0x5ac5('0xc')]('%s:%s:%s',_0x1282be,_0x5aa45d['id'],_0x5aa45d[_0x5ac5('0x1b')]),'condition':require(_0x5ac5('0x28'))['condition'](_0x1282be,getIntervals(_0xe37d9a['intervals'],_0x5aa45d),_0xe37d9a),'consequence':require(_0x5ac5('0x29')+_0x5aa45d['app'])[_0x5ac5('0x2a')](_0x1282be,_0x4ac526,_0xe37d9a,_0x1633d1),'p':_0x5aa45d[_0x5ac5('0x2b')]||0x0};logger['info']('Push\x20new\x20rule',_0x37cfad['id'],_0x5ac5('0x2c'),getIntervals(_0xe37d9a[_0x5ac5('0x2d')],_0x5aa45d)[_0x5ac5('0x19')](_0x5ac5('0x2e')));_0x30244d[_0x5ac5('0x20')](_0x37cfad);}else{logger[_0x5ac5('0x2f')](_0x5ac5('0x30'),path['join'](__dirname,_0x5ac5('0x17'),_0x5aa45d[_0x5ac5('0x1b')]+_0x5ac5('0x1a')));}}_0xe37d9a[_0x5ac5('0x31')][_0x1282be]=new RuleEngine(_0x30244d);_0xe37d9a[_0x5ac5('0x31')][_0x1282be][_0x5ac5('0x32')](_0x1633d1,function(_0x5b5f84){logger[_0x5ac5('0x33')](_0x5ac5('0x34'),JSON[_0x5ac5('0x35')](_0x5b5f84[_0x5ac5('0x36')]));if(_0xe37d9a['rules'][_0x1282be]){_0xe37d9a[_0x5ac5('0x31')][_0x1282be][_0x5ac5('0x37')](_0x5ac5('0x38'));}});return _0x2a145d({'code':0xc8,'message':_0x1633d1});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x2a145d({'code':0xc8,'message':_0x1633d1});}}catch(_0x1835be){logger[_0x5ac5('0x2f')](_0x1835be[_0x5ac5('0x39')]);return _0x340195(_0x57377b[_0x5ac5('0x2f')](0x1f4,_0x1835be));}}return _0x340195('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2d7475){var _0x5d143b=this;return new Promise(function(_0x3aff8f,_0x3dfeba){if(_0x2d7475['agent']&&_0x2d7475[_0x5ac5('0x3a')]['id']){if(_0xe37d9a['agents'][_0x2d7475[_0x5ac5('0x3a')]['id']]){_0xe37d9a[_0x5ac5('0x3b')][_0x2d7475[_0x5ac5('0x3a')]['id']]['busy']=![];_0xe37d9a['agents'][_0x2d7475[_0x5ac5('0x3a')]['id']][_0x5ac5('0x3c')]=undefined;}}if(_0x2d7475[_0x5ac5('0x14')]&&_0x2d7475[_0x5ac5('0x14')]['id']){try{var _0xbe6f34=getId(_0x2d7475[_0x5ac5('0x13')],_0x2d7475[_0x5ac5('0x14')]?_0x2d7475[_0x5ac5('0x14')]['id']:0x0,_0x2d7475[_0x5ac5('0x15')]?_0x2d7475['interaction']['id']:0x0);if(_0xe37d9a[_0x5ac5('0x31')][_0xbe6f34]){_0xe37d9a[_0x5ac5('0x31')][_0xbe6f34][_0x5ac5('0x37')]('end');if(rpc[_0x2d7475['channel']+_0x5ac5('0x3d')]){rpc[_0x2d7475[_0x5ac5('0x13')]+_0x5ac5('0x3d')]['update'](_0xbe6f34,{'UserId':_0x2d7475[_0x5ac5('0x14')][_0x5ac5('0x3e')]})[_0x5ac5('0x3f')](function(){logger[_0x5ac5('0x2f')](_0x5ac5('0x40'));});}}return _0x3aff8f({'code':0xc8,'message':_0x2d7475});}catch(_0x327952){logger[_0x5ac5('0x2f')](_0x327952['stack']);return _0x3dfeba(_0x5d143b['error'](0x1f4,_0x327952));}}logger['error'](_0x5ac5('0x41'));return _0x3dfeba(_0x5d143b[_0x5ac5('0x2f')](0x1f4,_0x5ac5('0x41')));});},'RejectMessage':function(_0x503623){var _0x1973f6=this;return new Promise(function(_0x31345e,_0x270825){if(_0x503623[_0x5ac5('0x3a')]&&_0x503623[_0x5ac5('0x3a')]['id']){try{if(_0xe37d9a['agents'][_0x503623['agent']['id']]){_0xe37d9a['agents'][_0x503623[_0x5ac5('0x3a')]['id']][_0x5ac5('0x42')]=![];_0xe37d9a[_0x5ac5('0x3b')][_0x503623[_0x5ac5('0x3a')]['id']][_0x5ac5('0x3c')]=undefined;}return _0x31345e({'code':0xc8,'message':_0x503623});}catch(_0x2501c3){logger[_0x5ac5('0x2f')](_0x2501c3[_0x5ac5('0x39')]);return _0x270825(_0x1973f6[_0x5ac5('0x2f')](0x1f4,_0x2501c3));}}logger[_0x5ac5('0x2f')](_0x5ac5('0x41'));return _0x270825(_0x1973f6[_0x5ac5('0x2f')](0x1f4,_0x5ac5('0x41')));});},'AbandonInteraction':function(_0x252030){var _0x285e1d=this;return new Promise(function(_0x49b721,_0x3a2945){if(_0x252030[_0x5ac5('0x13')]&&_0x252030['interaction']&&_0x252030[_0x5ac5('0x15')]['id']){try{var _0x45bd57=getId(_0x252030[_0x5ac5('0x13')],_0x252030[_0x5ac5('0x14')]?_0x252030[_0x5ac5('0x14')]['id']:0x0,_0x252030[_0x5ac5('0x15')]?_0x252030['interaction']['id']:0x0);if(_0xe37d9a[_0x5ac5('0x31')][_0x45bd57]){_0xe37d9a[_0x5ac5('0x31')][_0x45bd57][_0x5ac5('0x37')]('end');}return _0x49b721({'code':0xc8,'message':_0x252030});}catch(_0x26b9d4){logger[_0x5ac5('0x2f')](_0x26b9d4['stack']);return _0x3a2945(_0x285e1d[_0x5ac5('0x2f')](0x1f4,_0x26b9d4));}}logger[_0x5ac5('0x2f')]('message\x20is\x20empty');return _0x3a2945(_0x285e1d['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x277090){var _0x7429bf=this;return new Promise(function(_0x2bd926,_0x6df231){if(_0xe37d9a[_0x5ac5('0x3b')][_0x5ac5('0x43')](_0x277090['id'])){for(var _0x4ee231 in _0x277090[_0x5ac5('0x44')]){if(_0x277090[_0x5ac5('0x44')][_0x5ac5('0x43')](_0x4ee231)){if(_0xe37d9a[_0x5ac5('0x3b')][_0x277090['id']][_0x5ac5('0x43')](_0x4ee231+'CurrentCapacity')){_0xe37d9a['agents'][_0x277090['id']][_0x4ee231+'CurrentCapacity']=parseInt(_0x277090[_0x5ac5('0x44')][_0x4ee231],0xa);}}}_0xe37d9a[_0x5ac5('0x3b')][_0x277090['id']][_0x5ac5('0x45')]();return _0x2bd926({'code':0xc8,'message':_0xe37d9a[_0x5ac5('0x3b')][_0x277090['id']]});}else{return _0x6df231(_0x7429bf['error'](0x1f4,_0x5ac5('0x46')));}});},'Agents':function(_0x38b128){return new Promise(function(_0x3a72ea){var _0x4b30d7=_['values'](_0xe37d9a['agents']);if(_0x38b128&&_0x38b128['id']){var _0x2190e2=_[_0x5ac5('0x47')](_0x4b30d7,function(_0x41b98d){return _0x41b98d['id']===_0x38b128['id'];});_0x3a72ea(_0x2190e2);}else{_0x3a72ea({'count':_0x4b30d7[_0x5ac5('0x18')],'rows':_0x4b30d7});}});},'ChatQueues':function(){return new Promise(function(_0x387cab){var _0x3b7e70=[];for(var _0x53a641 in _0xe37d9a[_0x5ac5('0x48')]){if(_0xe37d9a['chatQueues']['hasOwnProperty'](_0x53a641)){var _0x3eda7f=_0xe37d9a[_0x5ac5('0x48')][_0x53a641];var _0x2b9438={'id':_0x3eda7f['id'],'available':_0x3eda7f[_0x5ac5('0x49')],'loggedIn':_0x3eda7f[_0x5ac5('0x4a')],'name':_0x3eda7f[_0x5ac5('0x4b')],'paused':_0x3eda7f[_0x5ac5('0x4c')],'waiting':_0x3eda7f[_0x5ac5('0x4d')]};_0x3b7e70[_0x5ac5('0x20')](_0x2b9438);}}_0x387cab({'count':_0x3b7e70[_0x5ac5('0x18')],'rows':_0x3b7e70});});},'MailQueues':function(){return new Promise(function(_0x13e80b){var _0x1f7768=[];for(var _0x299b02 in _0xe37d9a[_0x5ac5('0x4e')]){if(_0xe37d9a[_0x5ac5('0x4e')][_0x5ac5('0x43')](_0x299b02)){var _0x356f1b=_0xe37d9a[_0x5ac5('0x4e')][_0x299b02];var _0x116126={'id':_0x356f1b['id'],'available':_0x356f1b[_0x5ac5('0x49')],'loggedIn':_0x356f1b[_0x5ac5('0x4a')],'name':_0x356f1b['name'],'paused':_0x356f1b[_0x5ac5('0x4c')],'waiting':_0x356f1b['waiting']};_0x1f7768[_0x5ac5('0x20')](_0x116126);}}_0x13e80b({'count':_0x1f7768['length'],'rows':_0x1f7768});});},'OpenchannelQueues':function(){return new Promise(function(_0x27457e){var _0x58b9e2=[];for(var _0x565620 in _0xe37d9a[_0x5ac5('0x4f')]){if(_0xe37d9a['openchannelQueues'][_0x5ac5('0x43')](_0x565620)){var _0x396c9d=_0xe37d9a['openchannelQueues'][_0x565620];var _0x337645={'id':_0x396c9d['id'],'available':_0x396c9d[_0x5ac5('0x49')],'loggedIn':_0x396c9d[_0x5ac5('0x4a')],'name':_0x396c9d[_0x5ac5('0x4b')],'paused':_0x396c9d[_0x5ac5('0x4c')],'waiting':_0x396c9d[_0x5ac5('0x4d')]};_0x58b9e2['push'](_0x337645);}}_0x27457e({'count':_0x58b9e2[_0x5ac5('0x18')],'rows':_0x58b9e2});});},'SmsQueues':function(){return new Promise(function(_0x5b5758){var _0x23cbe6=[];for(var _0x2099a6 in _0xe37d9a[_0x5ac5('0x50')]){if(_0xe37d9a['smsQueues'][_0x5ac5('0x43')](_0x2099a6)){var _0xca16ec=_0xe37d9a[_0x5ac5('0x50')][_0x2099a6];var _0x4c5c66={'id':_0xca16ec['id'],'available':_0xca16ec[_0x5ac5('0x49')],'loggedIn':_0xca16ec[_0x5ac5('0x4a')],'name':_0xca16ec[_0x5ac5('0x4b')],'paused':_0xca16ec[_0x5ac5('0x4c')],'waiting':_0xca16ec[_0x5ac5('0x4d')]};_0x23cbe6['push'](_0x4c5c66);}}_0x5b5758({'count':_0x23cbe6['length'],'rows':_0x23cbe6});});},'FaxQueues':function(){return new Promise(function(_0x201713){var _0x220c1c=[];for(var _0x19aca2 in _0xe37d9a[_0x5ac5('0x51')]){if(_0xe37d9a[_0x5ac5('0x51')][_0x5ac5('0x43')](_0x19aca2)){var _0x53dd2d=_0xe37d9a[_0x5ac5('0x51')][_0x19aca2];var _0x2442a4={'id':_0x53dd2d['id'],'available':_0x53dd2d[_0x5ac5('0x49')],'loggedIn':_0x53dd2d[_0x5ac5('0x4a')],'name':_0x53dd2d[_0x5ac5('0x4b')],'paused':_0x53dd2d[_0x5ac5('0x4c')],'waiting':_0x53dd2d[_0x5ac5('0x4d')]};_0x220c1c[_0x5ac5('0x20')](_0x2442a4);}}_0x201713({'count':_0x220c1c[_0x5ac5('0x18')],'rows':_0x220c1c});});},'WhatsappQueues':function(){return new Promise(function(_0x2aae0c){var _0x579499=[];for(var _0x38e4fc in _0xe37d9a[_0x5ac5('0x52')]){if(_0xe37d9a[_0x5ac5('0x52')]['hasOwnProperty'](_0x38e4fc)){var _0x5a97f4=_0xe37d9a[_0x5ac5('0x52')][_0x38e4fc];var _0x27777b={'id':_0x5a97f4['id'],'available':_0x5a97f4[_0x5ac5('0x49')],'loggedIn':_0x5a97f4[_0x5ac5('0x4a')],'name':_0x5a97f4[_0x5ac5('0x4b')],'paused':_0x5a97f4[_0x5ac5('0x4c')],'waiting':_0x5a97f4['waiting']};_0x579499[_0x5ac5('0x20')](_0x27777b);}}_0x2aae0c({'count':_0x579499['length'],'rows':_0x579499});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1411d2){var _0x816369=_[_0x5ac5('0x53')](_0xe37d9a[_0x5ac5('0x54')]);_0x1411d2({'count':_0x816369['length'],'rows':_0x816369});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x29f547){var _0x4ad41b=_[_0x5ac5('0x53')](_0xe37d9a[_0x5ac5('0x55')]);_0x29f547({'count':_0x4ad41b[_0x5ac5('0x18')],'rows':_0x4ad41b});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5046e0){var _0x28dd3d=_['values'](_0xe37d9a[_0x5ac5('0x56')]);_0x5046e0({'count':_0x28dd3d[_0x5ac5('0x18')],'rows':_0x28dd3d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2b7943){var _0xdf5bdd=_['values'](_0xe37d9a['smsQueuesWaitingInteractions']);_0x2b7943({'count':_0xdf5bdd[_0x5ac5('0x18')],'rows':_0xdf5bdd});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5493af){var _0x59010a=_[_0x5ac5('0x53')](_0xe37d9a[_0x5ac5('0x57')]);_0x5493af({'count':_0x59010a[_0x5ac5('0x18')],'rows':_0x59010a});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2b248e){var _0x5cde48=_[_0x5ac5('0x53')](_0xe37d9a[_0x5ac5('0x58')]);_0x2b248e({'count':_0x5cde48[_0x5ac5('0x18')],'rows':_0x5cde48});});}};var _0x4d4082=jayson[_0x5ac5('0x59')](_0x58e6f7)[_0x5ac5('0x5a')]();_0x4d4082['on']('error',function(_0x164709){logger['error'](JSON[_0x5ac5('0x35')](_0x164709));return _0x40ee8a(_0x164709);});_0x4d4082[_0x5ac5('0x5b')](0x232c,_0x5ac5('0x5c'),function(){console[_0x5ac5('0x5d')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x1ce256(_0x5ac5('0x5e')+0x232c);});});}; \ No newline at end of file +var _0x6282=['loggedIn','name','mailQueues','available','waiting','openchannelQueues','paused','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','complete','info','stack','agent','agents','busyQueue','end','QueueReport','update','UserId','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','find','chatQueues'];(function(_0x2f7ecd,_0xcc0ccc){var _0x15d19b=function(_0x3d21fc){while(--_0x3d21fc){_0x2f7ecd['push'](_0x2f7ecd['shift']());}};_0x15d19b(++_0xcc0ccc);}(_0x6282,0x76));var _0x2628=function(_0xf51fbb,_0x66212d){_0xf51fbb=_0xf51fbb-0x0;var _0x2298ee=_0x6282[_0xf51fbb];return _0x2298ee;};'use strict';var _=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var fs=require('fs');var jayson=require(_0x2628('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var logger=require(_0x2628('0x4'))(_0x2628('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x2628('0x6')),'chatQueueReport':require(_0x2628('0x7')),'smsQueueReport':require(_0x2628('0x8')),'faxQueueReport':require(_0x2628('0x9')),'whatsappQueueReport':require(_0x2628('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0xb6b945,_0x144ae8,_0x2170a7){return util[_0x2628('0xb')](_0x2628('0xc'),_0xb6b945,_0x144ae8||0x0,_0x2170a7||0x0);}function getIntervals(_0x241628,_0x403569){var _0x1d12a5=[];if(!_[_0x2628('0xd')](_0x403569[_0x2628('0xe')])&&!_[_0x2628('0xd')](_0x241628[_0x403569[_0x2628('0xe')]])&&!_[_0x2628('0xd')](_0x241628[_0x403569[_0x2628('0xe')]][_0x2628('0xf')])){_0x1d12a5=_['map'](_0x241628[_0x403569['IntervalId']][_0x2628('0xf')],_0x2628('0x10'));}else if(!_[_0x2628('0xd')](_0x403569[_0x2628('0x10')])){_0x1d12a5=[_0x403569['interval']];}return _0x1d12a5;}exports['listen']=function(_0x1081a4){_0x1081a4[_0x2628('0x11')]={};return new BPromise(function(_0x4d2cfb,_0x2395fe){var _0x2f59ca={'Start':function(_0x513aee){var _0x645884=this;return new Promise(function(_0x16e67a,_0x457163){if(_0x513aee){try{var _0x4f418d=[];var _0x13a728=getId(_0x513aee[_0x2628('0x12')],_0x513aee['message']?_0x513aee[_0x2628('0x13')]['id']:0x0,_0x513aee['interaction']?_0x513aee[_0x2628('0x14')]['id']:0x0);if(_0x513aee[_0x2628('0x15')]&&_['isArray'](_0x513aee[_0x2628('0x15')])&&_0x513aee[_0x2628('0x15')]['length']){for(var _0x165824=0x0;_0x165824<_0x513aee['applications'][_0x2628('0x16')];_0x165824+=0x1){var _0x4976ce=_0x513aee['applications'][_0x165824];if(fs[_0x2628('0x17')](path[_0x2628('0x18')](__dirname,_0x2628('0x15'),_0x4976ce[_0x2628('0x19')]+_0x2628('0x1a')))){var _0x1911a2=[];switch(_0x4976ce[_0x2628('0x19')][_0x2628('0x1b')]()){case _0x2628('0x1c'):var _0x57a799=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');if(_0x513aee[_0x2628('0x12')]===_0x2628('0x1f')){_0x1911a2[_0x2628('0x20')](_0x57a799[0x0]);_0x1911a2['push'](_0x57a799[0x1]);_0x1911a2[_0x2628('0x20')](_0x57a799[_0x2628('0x21')](0x2,_0x57a799[_0x2628('0x16')])[_0x2628('0x18')](','));}else{_0x1911a2[_0x2628('0x20')](_0x57a799[0x0]);_0x1911a2['push'](_0x57a799['slice'](0x1,_0x57a799[_0x2628('0x16')])[_0x2628('0x18')](','));}break;case _0x2628('0x22'):var _0x41c18e=_0x4976ce[_0x2628('0x1d')]['split'](',');_0x1911a2[_0x2628('0x20')](_0x41c18e[0x0]);_0x1911a2[_0x2628('0x20')](_0x41c18e[0x1]);_0x1911a2[_0x2628('0x20')](_0x41c18e[_0x2628('0x21')](0x2,_0x41c18e[_0x2628('0x16')])[_0x2628('0x18')](','));break;case'dialogflowv2':var _0x541eef=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');_0x1911a2[_0x2628('0x20')](_0x541eef[0x0]);_0x1911a2[_0x2628('0x20')](_0x541eef[0x1]);_0x1911a2['push'](_0x541eef[0x2]);_0x1911a2[_0x2628('0x20')](_0x541eef[0x3]);_0x1911a2[_0x2628('0x20')](_0x541eef[_0x2628('0x21')](0x4,_0x541eef[_0x2628('0x16')])['join'](','));break;case _0x2628('0x23'):var _0x1dd96a=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');_0x1911a2['push'](_0x1dd96a[0x0]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[0x1]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[0x2]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[0x3]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[_0x2628('0x21')](0x4,_0x1dd96a[_0x2628('0x16')])[_0x2628('0x18')](','));break;case _0x2628('0x13'):_0x1911a2[_0x2628('0x20')](_0x4976ce['appdata']);break;case _0x2628('0x24'):_0x1911a2[_0x2628('0x20')](_0x4976ce[_0x2628('0x25')]);_0x1911a2[_0x2628('0x20')](_0x4976ce[_0x2628('0x1d')]);break;case'tvox':var _0x4ba58c=utils[_0x2628('0x26')](_0x513aee[_0x2628('0x27')][_0x2628('0x28')],_0x513aee);var _0x572e2d=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');_0x1911a2[_0x2628('0x20')](_0x572e2d[0x0]);_0x1911a2['push'](_0x572e2d[0x1]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x2]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x3]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x4]);_0x1911a2['push'](_0x572e2d[0x5]);_0x1911a2['push'](_0x572e2d[0x6]);_0x1911a2['push'](_0x572e2d[0x7]);_0x1911a2['push'](_0x572e2d[0x8]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x9]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0xa]);_0x1911a2[_0x2628('0x20')](_0x513aee['interaction']['id']);_0x1911a2[_0x2628('0x20')](_0x513aee[_0x2628('0x13')]['id']);_0x1911a2[_0x2628('0x20')](_0x4976ce['ChatWebsiteId']);_0x1911a2[_0x2628('0x20')](_0x513aee[_0x2628('0x14')][_0x2628('0x29')]);_0x1911a2[_0x2628('0x20')](_0x513aee[_0x2628('0x2a')][_0x2628('0x2a')]);_0x1911a2[_0x2628('0x20')](_0x4ba58c);break;default:_0x1911a2=_['isNil'](_0x4976ce[_0x2628('0x1d')])?[]:_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');}var _0x3dd851={'id':util[_0x2628('0xb')](_0x2628('0x2b'),_0x13a728,_0x4976ce['id'],_0x4976ce['app']),'condition':require(_0x2628('0x2c'))['condition'](_0x13a728,getIntervals(_0x1081a4[_0x2628('0x2d')],_0x4976ce),_0x1081a4),'consequence':require(_0x2628('0x2e')+_0x4976ce[_0x2628('0x19')])[_0x2628('0x2f')](_0x13a728,_0x1911a2,_0x1081a4,_0x513aee),'p':_0x4976ce[_0x2628('0x30')]||0x0};logger['info'](_0x2628('0x31'),_0x3dd851['id'],'on\x20interval',getIntervals(_0x1081a4['intervals'],_0x4976ce)[_0x2628('0x18')](_0x2628('0x32')));_0x4f418d[_0x2628('0x20')](_0x3dd851);}else{logger[_0x2628('0x33')](_0x2628('0x34'),path['join'](__dirname,_0x2628('0x15'),_0x4976ce[_0x2628('0x19')]+_0x2628('0x1a')));}}_0x1081a4[_0x2628('0x11')][_0x13a728]=new RuleEngine(_0x4f418d);_0x1081a4[_0x2628('0x11')][_0x13a728]['execute'](_0x513aee,function(_0x4665e8){logger['info'](_0x2628('0x35'),JSON[_0x2628('0x36')](_0x4665e8[_0x2628('0x37')]));if(_0x1081a4[_0x2628('0x11')][_0x13a728]){_0x1081a4['rules'][_0x13a728]['emit'](_0x2628('0x38'));}});return _0x16e67a({'code':0xc8,'message':_0x513aee});}else{logger[_0x2628('0x39')]('No\x20applications\x20to\x20execute');return _0x16e67a({'code':0xc8,'message':_0x513aee});}}catch(_0x23726f){logger[_0x2628('0x33')](_0x23726f[_0x2628('0x3a')]);return _0x457163(_0x645884[_0x2628('0x33')](0x1f4,_0x23726f));}}return _0x457163('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2e363a){var _0x1b6822=this;return new Promise(function(_0x1a34ee,_0x29847f){if(_0x2e363a[_0x2628('0x3b')]&&_0x2e363a[_0x2628('0x3b')]['id']){if(_0x1081a4[_0x2628('0x3c')][_0x2e363a[_0x2628('0x3b')]['id']]){_0x1081a4['agents'][_0x2e363a[_0x2628('0x3b')]['id']]['busy']=![];_0x1081a4[_0x2628('0x3c')][_0x2e363a['agent']['id']][_0x2628('0x3d')]=undefined;}}if(_0x2e363a[_0x2628('0x13')]&&_0x2e363a[_0x2628('0x13')]['id']){try{var _0x2b8fb9=getId(_0x2e363a[_0x2628('0x12')],_0x2e363a['message']?_0x2e363a[_0x2628('0x13')]['id']:0x0,_0x2e363a['interaction']?_0x2e363a[_0x2628('0x14')]['id']:0x0);if(_0x1081a4[_0x2628('0x11')][_0x2b8fb9]){_0x1081a4[_0x2628('0x11')][_0x2b8fb9]['emit'](_0x2628('0x3e'));if(rpc[_0x2e363a[_0x2628('0x12')]+'QueueReport']){rpc[_0x2e363a[_0x2628('0x12')]+_0x2628('0x3f')][_0x2628('0x40')](_0x2b8fb9,{'UserId':_0x2e363a[_0x2628('0x13')][_0x2628('0x41')]})['catch'](function(){logger[_0x2628('0x33')]('error\x20update\x20queue\x20report');});}}return _0x1a34ee({'code':0xc8,'message':_0x2e363a});}catch(_0x307ab6){logger[_0x2628('0x33')](_0x307ab6[_0x2628('0x3a')]);return _0x29847f(_0x1b6822[_0x2628('0x33')](0x1f4,_0x307ab6));}}logger[_0x2628('0x33')](_0x2628('0x42'));return _0x29847f(_0x1b6822[_0x2628('0x33')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x7fc50){var _0x11a733=this;return new Promise(function(_0xdcf3ac,_0x403c78){if(_0x7fc50[_0x2628('0x3b')]&&_0x7fc50[_0x2628('0x3b')]['id']){try{if(_0x1081a4[_0x2628('0x3c')][_0x7fc50[_0x2628('0x3b')]['id']]){_0x1081a4[_0x2628('0x3c')][_0x7fc50['agent']['id']]['busy']=![];_0x1081a4[_0x2628('0x3c')][_0x7fc50[_0x2628('0x3b')]['id']][_0x2628('0x3d')]=undefined;}return _0xdcf3ac({'code':0xc8,'message':_0x7fc50});}catch(_0xc7abb4){logger[_0x2628('0x33')](_0xc7abb4['stack']);return _0x403c78(_0x11a733['error'](0x1f4,_0xc7abb4));}}logger[_0x2628('0x33')]('message\x20is\x20empty');return _0x403c78(_0x11a733[_0x2628('0x33')](0x1f4,_0x2628('0x42')));});},'AbandonInteraction':function(_0x45227a){var _0x313e45=this;return new Promise(function(_0x2a5872,_0x2e677){if(_0x45227a[_0x2628('0x12')]&&_0x45227a[_0x2628('0x14')]&&_0x45227a[_0x2628('0x14')]['id']){try{var _0x3a656d=getId(_0x45227a[_0x2628('0x12')],_0x45227a[_0x2628('0x13')]?_0x45227a[_0x2628('0x13')]['id']:0x0,_0x45227a[_0x2628('0x14')]?_0x45227a[_0x2628('0x14')]['id']:0x0);if(_0x1081a4[_0x2628('0x11')][_0x3a656d]){_0x1081a4[_0x2628('0x11')][_0x3a656d][_0x2628('0x43')](_0x2628('0x3e'));}return _0x2a5872({'code':0xc8,'message':_0x45227a});}catch(_0x2c5424){logger[_0x2628('0x33')](_0x2c5424[_0x2628('0x3a')]);return _0x2e677(_0x313e45['error'](0x1f4,_0x2c5424));}}logger[_0x2628('0x33')](_0x2628('0x42'));return _0x2e677(_0x313e45['error'](0x1f4,_0x2628('0x42')));});},'AgentCapacity':function(_0x382c0b){var _0x208707=this;return new Promise(function(_0x1bf368,_0x13187b){if(_0x1081a4[_0x2628('0x3c')][_0x2628('0x44')](_0x382c0b['id'])){for(var _0x167cd1 in _0x382c0b['capacity']){if(_0x382c0b[_0x2628('0x45')][_0x2628('0x44')](_0x167cd1)){if(_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']]['hasOwnProperty'](_0x167cd1+_0x2628('0x46'))){_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']][_0x167cd1+_0x2628('0x46')]=parseInt(_0x382c0b[_0x2628('0x45')][_0x167cd1],0xa);}}}_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']][_0x2628('0x47')]();return _0x1bf368({'code':0xc8,'message':_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']]});}else{return _0x13187b(_0x208707['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x49d412){return new Promise(function(_0x28d22a){var _0x4be311=_['values'](_0x1081a4[_0x2628('0x3c')]);if(_0x49d412&&_0x49d412['id']){var _0x36bcaf=_[_0x2628('0x48')](_0x4be311,function(_0x570f37){return _0x570f37['id']===_0x49d412['id'];});_0x28d22a(_0x36bcaf);}else{_0x28d22a({'count':_0x4be311['length'],'rows':_0x4be311});}});},'ChatQueues':function(){return new Promise(function(_0x5af7e8){var _0x54f9c0=[];for(var _0x3a3477 in _0x1081a4[_0x2628('0x49')]){if(_0x1081a4[_0x2628('0x49')][_0x2628('0x44')](_0x3a3477)){var _0x2a4fc0=_0x1081a4['chatQueues'][_0x3a3477];var _0x597bb2={'id':_0x2a4fc0['id'],'available':_0x2a4fc0['available'],'loggedIn':_0x2a4fc0[_0x2628('0x4a')],'name':_0x2a4fc0[_0x2628('0x4b')],'paused':_0x2a4fc0['paused'],'waiting':_0x2a4fc0['waiting']};_0x54f9c0[_0x2628('0x20')](_0x597bb2);}}_0x5af7e8({'count':_0x54f9c0[_0x2628('0x16')],'rows':_0x54f9c0});});},'MailQueues':function(){return new Promise(function(_0x54869e){var _0x189c92=[];for(var _0x3a3a66 in _0x1081a4[_0x2628('0x4c')]){if(_0x1081a4['mailQueues']['hasOwnProperty'](_0x3a3a66)){var _0xdbd0ef=_0x1081a4[_0x2628('0x4c')][_0x3a3a66];var _0x58274b={'id':_0xdbd0ef['id'],'available':_0xdbd0ef[_0x2628('0x4d')],'loggedIn':_0xdbd0ef[_0x2628('0x4a')],'name':_0xdbd0ef[_0x2628('0x4b')],'paused':_0xdbd0ef['paused'],'waiting':_0xdbd0ef[_0x2628('0x4e')]};_0x189c92[_0x2628('0x20')](_0x58274b);}}_0x54869e({'count':_0x189c92['length'],'rows':_0x189c92});});},'OpenchannelQueues':function(){return new Promise(function(_0x22278f){var _0x93072a=[];for(var _0x219aeb in _0x1081a4[_0x2628('0x4f')]){if(_0x1081a4['openchannelQueues'][_0x2628('0x44')](_0x219aeb)){var _0xdfddbe=_0x1081a4[_0x2628('0x4f')][_0x219aeb];var _0x4a2190={'id':_0xdfddbe['id'],'available':_0xdfddbe['available'],'loggedIn':_0xdfddbe['loggedIn'],'name':_0xdfddbe[_0x2628('0x4b')],'paused':_0xdfddbe[_0x2628('0x50')],'waiting':_0xdfddbe[_0x2628('0x4e')]};_0x93072a[_0x2628('0x20')](_0x4a2190);}}_0x22278f({'count':_0x93072a['length'],'rows':_0x93072a});});},'SmsQueues':function(){return new Promise(function(_0x52d1ce){var _0x187f55=[];for(var _0x355444 in _0x1081a4['smsQueues']){if(_0x1081a4[_0x2628('0x51')][_0x2628('0x44')](_0x355444)){var _0x2b5053=_0x1081a4[_0x2628('0x51')][_0x355444];var _0x121435={'id':_0x2b5053['id'],'available':_0x2b5053[_0x2628('0x4d')],'loggedIn':_0x2b5053['loggedIn'],'name':_0x2b5053[_0x2628('0x4b')],'paused':_0x2b5053['paused'],'waiting':_0x2b5053[_0x2628('0x4e')]};_0x187f55['push'](_0x121435);}}_0x52d1ce({'count':_0x187f55[_0x2628('0x16')],'rows':_0x187f55});});},'FaxQueues':function(){return new Promise(function(_0x353412){var _0x24d571=[];for(var _0x1f6267 in _0x1081a4[_0x2628('0x52')]){if(_0x1081a4[_0x2628('0x52')][_0x2628('0x44')](_0x1f6267)){var _0xfa1f4=_0x1081a4[_0x2628('0x52')][_0x1f6267];var _0x12e835={'id':_0xfa1f4['id'],'available':_0xfa1f4[_0x2628('0x4d')],'loggedIn':_0xfa1f4[_0x2628('0x4a')],'name':_0xfa1f4[_0x2628('0x4b')],'paused':_0xfa1f4[_0x2628('0x50')],'waiting':_0xfa1f4[_0x2628('0x4e')]};_0x24d571['push'](_0x12e835);}}_0x353412({'count':_0x24d571[_0x2628('0x16')],'rows':_0x24d571});});},'WhatsappQueues':function(){return new Promise(function(_0x3170fb){var _0x443456=[];for(var _0xd41484 in _0x1081a4[_0x2628('0x53')]){if(_0x1081a4[_0x2628('0x53')][_0x2628('0x44')](_0xd41484)){var _0x3d52c6=_0x1081a4['whatsappQueues'][_0xd41484];var _0x29aacc={'id':_0x3d52c6['id'],'available':_0x3d52c6['available'],'loggedIn':_0x3d52c6[_0x2628('0x4a')],'name':_0x3d52c6['name'],'paused':_0x3d52c6[_0x2628('0x50')],'waiting':_0x3d52c6[_0x2628('0x4e')]};_0x443456[_0x2628('0x20')](_0x29aacc);}}_0x3170fb({'count':_0x443456[_0x2628('0x16')],'rows':_0x443456});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x211b28){var _0x57d96a=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x55')]);_0x211b28({'count':_0x57d96a[_0x2628('0x16')],'rows':_0x57d96a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1c3e42){var _0x7caf20=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x56')]);_0x1c3e42({'count':_0x7caf20[_0x2628('0x16')],'rows':_0x7caf20});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2dfe66){var _0x14387e=_[_0x2628('0x54')](_0x1081a4['openchannelQueuesWaitingInteractions']);_0x2dfe66({'count':_0x14387e[_0x2628('0x16')],'rows':_0x14387e});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4a6902){var _0x118d26=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x57')]);_0x4a6902({'count':_0x118d26[_0x2628('0x16')],'rows':_0x118d26});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4b5de9){var _0x50032b=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x58')]);_0x4b5de9({'count':_0x50032b['length'],'rows':_0x50032b});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2b33d){var _0x4796fe=_['values'](_0x1081a4[_0x2628('0x59')]);_0x2b33d({'count':_0x4796fe[_0x2628('0x16')],'rows':_0x4796fe});});}};var _0x47f297=jayson[_0x2628('0x5a')](_0x2f59ca)['http']();_0x47f297['on']('error',function(_0xc9e57c){logger[_0x2628('0x33')](JSON[_0x2628('0x36')](_0xc9e57c));return _0x2395fe(_0xc9e57c);});_0x47f297[_0x2628('0x5b')](0x232c,_0x2628('0x5c'),function(){console[_0x2628('0x5d')](_0x2628('0x5e'),0x232c);return _0x4d2cfb(_0x2628('0x5f')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 10de3e6..955c9e9 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 _0x7ef4=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','lodash','routing','client','http','then','error','result','catch','condition','info'];(function(_0x52ea0e,_0x46d90c){var _0x2f0922=function(_0x27afb5){while(--_0x27afb5){_0x52ea0e['push'](_0x52ea0e['shift']());}};_0x2f0922(++_0x46d90c);}(_0x7ef4,0xfa));var _0x47ef=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7ef4[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x47ef('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x47ef('0x1'));var logger=require('../../../config/logger')(_0x47ef('0x2'));var client=jayson[_0x47ef('0x3')][_0x47ef('0x4')]({'port':0x232a});function request(_0x65f094,_0x1339fb){return new BPromise(function(_0x109a6a,_0x11356f){return client['request'](_0x65f094,_0x1339fb)[_0x47ef('0x5')](function(_0x945b2c){if(_0x945b2c[_0x47ef('0x6')]){return _0x11356f(_0x945b2c['error']['message']);}else{return _0x109a6a(_0x945b2c[_0x47ef('0x7')]);}})[_0x47ef('0x8')](function(_0x27e2ec){return _0x11356f(_0x27e2ec);});});}exports[_0x47ef('0x9')]=function(_0x1f08a4,_0x202d3b,_0x3fbcbd){return function(_0x2c0c96){if(_0x3fbcbd['rules']&&!_0x3fbcbd['rules'][_0x1f08a4]){logger[_0x47ef('0xa')](_0x47ef('0xb'),_0x1f08a4);return _0x2c0c96[_0x47ef('0xc')]();}var _0x22e529=[];for(var _0x6092bc=0x0;_0x6092bc<_0x202d3b[_0x47ef('0xd')];_0x6092bc+=0x1){_0x22e529['push'](request(_0x47ef('0xe'),{'command':util[_0x47ef('0xf')](_0x47ef('0x10'),_0x202d3b[_0x6092bc])})['then'](function(_0x2868ec){return _0x2868ec&&_0x2868ec['message']&&_0x2868ec[_0x47ef('0x11')][_0x47ef('0x12')](_0x47ef('0x13'))>=0x0?!![]:![];})[_0x47ef('0x8')](function(_0x4680c8){logger[_0x47ef('0x6')](_0x47ef('0x14'),_0x1f08a4,_0x202d3b[_0x6092bc]);}));}BPromise[_0x47ef('0x15')](_0x22e529)[_0x47ef('0x5')](function(_0x434f47){var _0x47d8aa=_[_0x47ef('0x16')](_0x434f47);logger['info'](_0x47ef('0x17'),_0x1f08a4,_0x202d3b[_0x47ef('0x18')](_0x47ef('0x19')),_0x47d8aa);_0x2c0c96[_0x47ef('0x1a')](_0x47d8aa);})['catch'](function(_0x70eb4c){console[_0x47ef('0x1b')](_0x70eb4c);logger[_0x47ef('0x6')](_0x47ef('0x17'),_0x1f08a4,_0x202d3b[_0x47ef('0x18')](_0x47ef('0x19')),_0x70eb4c[_0x47ef('0x1c')]);_0x2c0c96[_0x47ef('0xc')]();});};}; \ No newline at end of file +var _0xa17a=['stack','util','bluebird','jayson/promise','lodash','routing','client','http','error','catch','rules','stop','push','format','then','message','true','[%s][INTERVAL]\x20%s','all','some','info','\x20|\x20','when','log','join'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xa17a,0x7e));var _0xaa17=function(_0x4addaa,_0x443146){_0x4addaa=_0x4addaa-0x0;var _0x3eb2eb=_0xa17a[_0x4addaa];return _0x3eb2eb;};'use strict';var util=require(_0xaa17('0x0'));var BPromise=require(_0xaa17('0x1'));var jayson=require(_0xaa17('0x2'));var _=require(_0xaa17('0x3'));var logger=require('../../../config/logger')(_0xaa17('0x4'));var client=jayson[_0xaa17('0x5')][_0xaa17('0x6')]({'port':0x232a});function request(_0x5d0bd9,_0x2c9690){return new BPromise(function(_0x370521,_0x43d95a){return client['request'](_0x5d0bd9,_0x2c9690)['then'](function(_0xe384a5){if(_0xe384a5[_0xaa17('0x7')]){return _0x43d95a(_0xe384a5[_0xaa17('0x7')]['message']);}else{return _0x370521(_0xe384a5['result']);}})[_0xaa17('0x8')](function(_0x7d430d){return _0x43d95a(_0x7d430d);});});}exports['condition']=function(_0x303d18,_0x170e7c,_0x412fc7){return function(_0x465163){if(_0x412fc7[_0xaa17('0x9')]&&!_0x412fc7[_0xaa17('0x9')][_0x303d18]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x303d18);return _0x465163[_0xaa17('0xa')]();}var _0x563434=[];for(var _0x163e65=0x0;_0x163e65<_0x170e7c['length'];_0x163e65+=0x1){_0x563434[_0xaa17('0xb')](request('Command',{'command':util[_0xaa17('0xc')]('iftime\x20%s',_0x170e7c[_0x163e65])})[_0xaa17('0xd')](function(_0x14e8ab){return _0x14e8ab&&_0x14e8ab['message']&&_0x14e8ab[_0xaa17('0xe')]['indexOf'](_0xaa17('0xf'))>=0x0?!![]:![];})['catch'](function(_0x4c5992){logger[_0xaa17('0x7')](_0xaa17('0x10'),_0x303d18,_0x170e7c[_0x163e65]);}));}BPromise[_0xaa17('0x11')](_0x563434)[_0xaa17('0xd')](function(_0x2e9efa){var _0x57dccc=_[_0xaa17('0x12')](_0x2e9efa);logger[_0xaa17('0x13')]('[%s][INTERVAL]\x20%s\x20%s',_0x303d18,_0x170e7c['join'](_0xaa17('0x14')),_0x57dccc);_0x465163[_0xaa17('0x15')](_0x57dccc);})[_0xaa17('0x8')](function(_0xad3415){console[_0xaa17('0x16')](_0xad3415);logger[_0xaa17('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x303d18,_0x170e7c[_0xaa17('0x17')](_0xaa17('0x14')),_0xad3415[_0xaa17('0x18')]);_0x465163['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index bc166d8..c21e32e 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 _0x44a3=['agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','destuniqueid','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','then','type','agentcomplete','acw'];(function(_0x26a9ad,_0x11a04f){var _0x31d9bc=function(_0x44a770){while(--_0x44a770){_0x26a9ad['push'](_0x26a9ad['shift']());}};_0x31d9bc(++_0x11a04f);}(_0x44a3,0x1a9));var _0x344a=function(_0x53361f,_0x3b2cb6){_0x53361f=_0x53361f-0x0;var _0x279237=_0x44a3[_0x53361f];return _0x279237;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var utils=require(_0x344a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x23cef2,_0xdffe0b){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x5'),_0x23cef2['uniqueid'],_0x23cef2[_0x344a('0x6')],_0x23cef2[_0x344a('0x7')],_0x23cef2[_0x344a('0x8')],_0x23cef2[_0x344a('0x9')],_0x23cef2[_0x344a('0xa')],_0x23cef2['connectedlinenum'],_0x23cef2['lastevent']));if(_0x23cef2['queue']){utils['getVoiceQueueByName'](_0x23cef2[_0x344a('0x7')])[_0x344a('0xb')](function(_0x3c725e){if(_0x3c725e){_0x23cef2[_0x344a('0xc')]=_0x3c725e[_0x344a('0xc')];_0x23cef2['agentacw']=_0x23cef2[_0x344a('0xd')]?_0x3c725e[_0x344a('0xe')]:![];_0x23cef2['acwtime']=_0x23cef2[_0x344a('0xf')]?_0x3c725e['acwTimeout']:0x0;}utils[_0x344a('0x10')]('CreateVoiceAgentReport',_0x23cef2);});}else{utils[_0x344a('0x10')](_0x344a('0x11'),_0x23cef2);}if(_0xdffe0b){delete transfers[_0x23cef2['uniqueid']];}else{delete agents[_0x23cef2['destuniqueid']];}}exports[_0x344a('0x12')]=function(_0x2ad7eb){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x2ad7eb);agents[_0x2ad7eb['destuniqueid']]=_0x2ad7eb;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x17')]=utils[_0x344a('0x18')]();agents[_0x2ad7eb[_0x344a('0x16')]]['lastevent']='called';agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x19')]=null;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x1a')]=null;utils['info'](util[_0x344a('0x4')](_0x344a('0x1b'),_0x2ad7eb['uniqueid'],agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x8')],_0x2ad7eb[_0x344a('0x16')]));}catch(_0x45a827){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x45a827);}};exports[_0x344a('0x1d')]=function(_0x450922){try{if(!_['isNil'](agents[_0x450922[_0x344a('0x16')]])){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x1e'),_0x450922[_0x344a('0x15')]),_0x450922);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x1f'),_0x450922[_0x344a('0x15')],agents[_0x450922[_0x344a('0x16')]][_0x344a('0x8')],_0x450922[_0x344a('0x16')]));agents[_0x450922[_0x344a('0x16')]][_0x344a('0x1d')]=!![];agents[_0x450922['destuniqueid']][_0x344a('0x20')]=utils['now']();agents[_0x450922[_0x344a('0x16')]]['lastevent']=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x22')]=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x23')]=_0x450922[_0x344a('0x24')]?parseInt(_0x450922[_0x344a('0x24')])/0x3e8:0x0;agents[_0x450922['destuniqueid']][_0x344a('0x25')]=0x0;unanswered[_0x344a('0x26')](_0x450922[_0x344a('0x16')]);}}catch(_0xc02d6){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentringnoanswer]',_0x450922[_0x344a('0x15')]),_0xc02d6);}};exports['queuecallerabandon']=function(_0x593cf6){try{_[_0x344a('0x27')](agents,function(_0x14fa86,_0x5a36bb){if(_0x14fa86['uniqueid']==_0x593cf6['uniqueid']&&!_['includes'](unanswered,_0x14fa86[_0x344a('0x16')])){utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][queuecallerabandon]',_0x593cf6[_0x344a('0x15')]),_0x593cf6);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x28'),_0x593cf6[_0x344a('0x15')],_0x14fa86[_0x344a('0x8')],_0x14fa86[_0x344a('0x16')]));_0x14fa86['agentringnoanswer']=!![];_0x14fa86[_0x344a('0x20')]=utils['now']();_0x14fa86['lastevent']='abandoned';_0x14fa86[_0x344a('0x22')]=_0x344a('0x29');_0x14fa86[_0x344a('0x23')]=_0x593cf6[_0x344a('0x23')];_0x14fa86[_0x344a('0x25')]=0x0;writeDB(_0x14fa86);}});}catch(_0xdf6a8f){utils['error'](util[_0x344a('0x4')](_0x344a('0x2a'),_0x593cf6[_0x344a('0x15')]),_0xdf6a8f);}};exports['agentconnect']=function(_0x3698eb){try{if(agents[_0x3698eb[_0x344a('0x16')]]){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb['uniqueid']),_0x3698eb);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x2c'),_0x3698eb[_0x344a('0x15')],agents[_0x3698eb[_0x344a('0x16')]]['membername'],_0x3698eb[_0x344a('0x16')]));agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x2d')]=utils[_0x344a('0x18')]();agents[_0x3698eb[_0x344a('0x16')]]['connectedlinenum']=_0x3698eb[_0x344a('0x19')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x1a')]=_0x3698eb[_0x344a('0x1a')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];agents[_0x3698eb[_0x344a('0x16')]]['lastevent']=_0x344a('0x2e');_[_0x344a('0x27')](agents,function(_0x3d34c3,_0x28bad9){if(_0x3d34c3[_0x344a('0x16')]!=_0x3698eb['destuniqueid']&&_0x3d34c3[_0x344a('0x15')]==_0x3698eb[_0x344a('0x15')]){_0x3d34c3[_0x344a('0x25')]=0x0;_0x3d34c3[_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];_0x3d34c3[_0x344a('0x1d')]=!![];_0x3d34c3[_0x344a('0x20')]=utils[_0x344a('0x18')]();_0x3d34c3[_0x344a('0x2f')]='answered_elsewhere';_0x3d34c3[_0x344a('0x22')]=_0x344a('0x30');_0x3d34c3[_0x344a('0x31')]=_0x3698eb[_0x344a('0x16')];_0x3d34c3['answeredelsewheremembername']=_0x3698eb[_0x344a('0x8')];writeDB(_0x3d34c3);}});}}catch(_0x3069ca){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb[_0x344a('0x15')]),_0x3069ca);}};exports[_0x344a('0xd')]=function(_0x372e7d){try{if(!_[_0x344a('0x32')](agents[_0x372e7d[_0x344a('0x16')]])){utils[_0x344a('0x13')](util['format'](_0x344a('0x33'),_0x372e7d[_0x344a('0x15')]),_0x372e7d);utils['info'](util[_0x344a('0x4')](_0x344a('0x34'),_0x372e7d['uniqueid'],agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x8')],_0x372e7d['destuniqueid']));agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0xd')]=!![];agents[_0x372e7d[_0x344a('0x16')]]['agentcompleteAt']=utils[_0x344a('0x18')]();agents[_0x372e7d['destuniqueid']][_0x344a('0x25')]=utils[_0x344a('0x35')](agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x36')],agents[_0x372e7d['destuniqueid']]['agentconnectAt']);agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x22')]=_0x372e7d[_0x344a('0x22')];agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x2f')]=_0x344a('0x37');writeDB(agents[_0x372e7d[_0x344a('0x16')]]);}}catch(_0x23c214){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentcomplete]',_0x372e7d[_0x344a('0x15')]),_0x23c214);}};exports[_0x344a('0x38')]=function(_0x6fad37){try{if(!_[_0x344a('0x32')](agents[_0x6fad37['transfereruniqueid']])){utils[_0x344a('0x13')](util['format']('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x6fad37);utils[_0x344a('0x3')](util['format'](_0x344a('0x39'),_0x6fad37[_0x344a('0x15')],agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x8')],agents[_0x6fad37['transfereruniqueid']][_0x344a('0x15')]));agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3b')]=!![];agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3c')]=_0x344a('0x3d');agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3e')]=_0x6fad37[_0x344a('0x3f')];agents[_0x6fad37[_0x344a('0x3a')]]['transferuniqueid']=agents[_0x6fad37[_0x344a('0x3a')]]['uniqueid'];}}catch(_0x1b7f6c){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x1b7f6c);}};exports[_0x344a('0x40')]=function(_0x188c6b){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x41'),_0x188c6b[_0x344a('0x42')]),_0x188c6b);if(_0x188c6b[_0x344a('0x42')]==_0x188c6b[_0x344a('0x43')]){if(!_['isNil'](agents[_0x188c6b[_0x344a('0x44')]])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b[_0x344a('0x42')],agents[_0x188c6b['secondtransfereruniqueid']][_0x344a('0x8')]));agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x3b')]=!![];agents[_0x188c6b[_0x344a('0x44')]]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x44')]]['transferexten']=_0x188c6b[_0x344a('0x47')];agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x48')]=_0x188c6b[_0x344a('0x42')];}if(_0x188c6b[_0x344a('0x49')]&&agents[_0x188c6b[_0x344a('0x49')]]){agents[_0x188c6b[_0x344a('0x49')]]['agententerreason']=0x1;transfers[_0x188c6b['transfereeuniqueid']]=_['clone'](agents[_0x188c6b[_0x344a('0x49')]]);transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0xa')]=agents[_0x188c6b[_0x344a('0x44')]]['calleridnum'];transfers[_0x188c6b[_0x344a('0x49')]]['calleridname']=agents[_0x188c6b['secondtransfereruniqueid']]['calleridname'];transfers[_0x188c6b['transfereeuniqueid']][_0x344a('0x17')]=utils[_0x344a('0x18')]();transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x2d')]=utils['now']();transfers[_0x188c6b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x4a')]=0x2;}}else if(_0x188c6b[_0x344a('0x44')]==_0x188c6b[_0x344a('0x4b')]){if(!_[_0x344a('0x32')](agents[_0x188c6b['origtransfereruniqueid']])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b['origtransfereruniqueid'],agents[_0x188c6b[_0x344a('0x42')]]['membername']));agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x3b')]=!![];agents[_0x188c6b['origtransfereruniqueid']]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x42')]]['transferexten']=_0x188c6b[_0x344a('0x4c')];agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x48')]=_0x188c6b[_0x344a('0x44')];}if(_0x188c6b[_0x344a('0x4d')]&&agents[_0x188c6b['transfertargetuniqueid']]){agents[_0x188c6b['transfertargetuniqueid']][_0x344a('0x4a')]=0x1;transfers[_0x188c6b[_0x344a('0x4d')]]=_[_0x344a('0x4e')](agents[_0x188c6b[_0x344a('0x4d')]]);transfers[_0x188c6b['transfertargetuniqueid']]['calleridnum']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0xa')];transfers[_0x188c6b[_0x344a('0x4d')]]['calleridname']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0x4f')];transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x17')]=utils['now']();transfers[_0x188c6b[_0x344a('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x23')]=0x0;transfers[_0x188c6b[_0x344a('0x4d')]][_0x344a('0x4a')]=0x2;}}}catch(_0xce0446){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][attendedtransfer]',_0x188c6b[_0x344a('0x42')]),_0xce0446);}};exports[_0x344a('0x50')]=function(_0x20a892){try{utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][hangup]',_0x20a892[_0x344a('0x15')]),_0x20a892);if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892['uniqueid']][_0x344a('0x22')]===_0x344a('0x21')){if(_0x20a892[_0x344a('0x51')]==='21'){agents[_0x20a892[_0x344a('0x15')]]['reason']=_0x344a('0x52');agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]=_0x344a('0x52');}utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892['uniqueid']][_0x344a('0x8')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]));writeDB(agents[_0x20a892[_0x344a('0x15')]]);var _0x212b08=unanswered[_0x344a('0x54')](_0x20a892['uniqueid']);if(_0x212b08>-0x1){unanswered[_0x344a('0x55')](_0x212b08,0x1);}}if(transfers[_0x20a892[_0x344a('0x15')]]){transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0xd')]=!![];transfers[_0x20a892['uniqueid']][_0x344a('0x36')]=utils[_0x344a('0x18')]();transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x25')]=utils[_0x344a('0x35')](transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')],transfers[_0x20a892[_0x344a('0x15')]]['agentconnectAt']);transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=_0x344a('0x56');transfers[_0x20a892[_0x344a('0x15')]]['lastevent']=_0x344a('0x37');utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],transfers[_0x20a892[_0x344a('0x15')]]['membername'],transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],transfers[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(transfers[_0x20a892[_0x344a('0x15')]],!![]);}if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]){agents[_0x20a892[_0x344a('0x15')]]['agentcomplete']=!![];agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')]=utils[_0x344a('0x18')]();agents[_0x20a892['uniqueid']][_0x344a('0x25')]=utils['diffTime'](agents[_0x20a892['uniqueid']][_0x344a('0x36')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]);agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x3b')]?_0x344a('0x3b'):'agent';agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]='complete';utils['info'](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892[_0x344a('0x15')]]['membername'],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(agents[_0x20a892[_0x344a('0x15')]]);}}catch(_0x1c50c3){utils[_0x344a('0x1c')](util['format'](_0x344a('0x57'),_0x20a892[_0x344a('0x15')]),_0x1c50c3);}}; \ No newline at end of file +var _0xa478=['push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','agentacw','request','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime'];(function(_0x22be4f,_0x1a0366){var _0x1300d0=function(_0x66e9d6){while(--_0x66e9d6){_0x22be4f['push'](_0x22be4f['shift']());}};_0x1300d0(++_0x1a0366);}(_0xa478,0x136));var _0x8a47=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xa478[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var utils=require(_0x8a47('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44be2c,_0x2c3f60){utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x5'),_0x44be2c[_0x8a47('0x6')],_0x44be2c[_0x8a47('0x7')],_0x44be2c[_0x8a47('0x8')],_0x44be2c[_0x8a47('0x9')],_0x44be2c['interface'],_0x44be2c[_0x8a47('0xa')],_0x44be2c[_0x8a47('0xb')],_0x44be2c[_0x8a47('0xc')]));if(_0x44be2c[_0x8a47('0x8')]){utils['getVoiceQueueByName'](_0x44be2c[_0x8a47('0x8')])['then'](function(_0x7b6e61){if(_0x7b6e61){_0x44be2c[_0x8a47('0xd')]=_0x7b6e61[_0x8a47('0xd')];_0x44be2c['agentacw']=_0x44be2c[_0x8a47('0xe')]?_0x7b6e61[_0x8a47('0xf')]:![];_0x44be2c['acwtime']=_0x44be2c[_0x8a47('0x10')]?_0x7b6e61['acwTimeout']:0x0;}utils[_0x8a47('0x11')](_0x8a47('0x12'),_0x44be2c);});}else{utils[_0x8a47('0x11')]('CreateVoiceAgentReport',_0x44be2c);}if(_0x2c3f60){delete transfers[_0x44be2c['uniqueid']];}else{delete agents[_0x44be2c['destuniqueid']];}}exports[_0x8a47('0x13')]=function(_0x12539c){try{utils['debug'](util[_0x8a47('0x4')](_0x8a47('0x14'),_0x12539c[_0x8a47('0x6')]),_0x12539c);agents[_0x12539c[_0x8a47('0x15')]]=_0x12539c;agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0x16')]=utils[_0x8a47('0x17')]();agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0xc')]=_0x8a47('0x18');agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0xb')]=null;agents[_0x12539c[_0x8a47('0x15')]]['connectedlinename']=null;utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x19'),_0x12539c['uniqueid'],agents[_0x12539c[_0x8a47('0x15')]]['membername'],_0x12539c['destuniqueid']));}catch(_0x1cf650){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x14'),_0x12539c[_0x8a47('0x6')]),_0x1cf650);}};exports[_0x8a47('0x1b')]=function(_0x44e119){try{if(!_[_0x8a47('0x1c')](agents[_0x44e119[_0x8a47('0x15')]])){utils[_0x8a47('0x1d')](util['format'](_0x8a47('0x1e'),_0x44e119['uniqueid']),_0x44e119);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x1f'),_0x44e119[_0x8a47('0x6')],agents[_0x44e119['destuniqueid']][_0x8a47('0x9')],_0x44e119['destuniqueid']));agents[_0x44e119['destuniqueid']]['agentringnoanswer']=!![];agents[_0x44e119['destuniqueid']][_0x8a47('0x20')]=utils[_0x8a47('0x17')]();agents[_0x44e119['destuniqueid']][_0x8a47('0xc')]=_0x8a47('0x21');agents[_0x44e119[_0x8a47('0x15')]][_0x8a47('0x22')]=_0x8a47('0x21');agents[_0x44e119[_0x8a47('0x15')]][_0x8a47('0x23')]=_0x44e119['ringtime']?parseInt(_0x44e119[_0x8a47('0x24')])/0x3e8:0x0;agents[_0x44e119['destuniqueid']][_0x8a47('0x25')]=0x0;unanswered[_0x8a47('0x26')](_0x44e119['destuniqueid']);}}catch(_0x1e89b1){utils['error'](util['format'](_0x8a47('0x1e'),_0x44e119[_0x8a47('0x6')]),_0x1e89b1);}};exports[_0x8a47('0x27')]=function(_0x12f0b7){try{_[_0x8a47('0x28')](agents,function(_0x18bfd3,_0x58aa06){if(_0x18bfd3[_0x8a47('0x6')]==_0x12f0b7['uniqueid']&&!_['includes'](unanswered,_0x18bfd3[_0x8a47('0x15')])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x29'),_0x12f0b7[_0x8a47('0x6')]),_0x12f0b7);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x2a'),_0x12f0b7[_0x8a47('0x6')],_0x18bfd3[_0x8a47('0x9')],_0x18bfd3['destuniqueid']));_0x18bfd3[_0x8a47('0x1b')]=!![];_0x18bfd3[_0x8a47('0x20')]=utils[_0x8a47('0x17')]();_0x18bfd3['lastevent']=_0x8a47('0x2b');_0x18bfd3[_0x8a47('0x22')]='abandoned';_0x18bfd3[_0x8a47('0x23')]=_0x12f0b7[_0x8a47('0x23')];_0x18bfd3[_0x8a47('0x25')]=0x0;writeDB(_0x18bfd3);}});}catch(_0x20551b){utils['error'](util['format'](_0x8a47('0x29'),_0x12f0b7[_0x8a47('0x6')]),_0x20551b);}};exports[_0x8a47('0x2c')]=function(_0x42c5d7){try{if(agents[_0x42c5d7[_0x8a47('0x15')]]){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')]('[%s][agents][agentconnect]',_0x42c5d7['uniqueid']),_0x42c5d7);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x2d'),_0x42c5d7[_0x8a47('0x6')],agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0x9')],_0x42c5d7[_0x8a47('0x15')]));agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0x2e')]=utils[_0x8a47('0x17')]();agents[_0x42c5d7[_0x8a47('0x15')]]['connectedlinenum']=_0x42c5d7[_0x8a47('0xb')];agents[_0x42c5d7['destuniqueid']]['connectedlinename']=_0x42c5d7['connectedlinename'];agents[_0x42c5d7['destuniqueid']]['holdtime']=_0x42c5d7[_0x8a47('0x24')];agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0xc')]=_0x8a47('0x2f');_[_0x8a47('0x28')](agents,function(_0x20ba1c,_0x25c45b){if(_0x20ba1c[_0x8a47('0x15')]!=_0x42c5d7['destuniqueid']&&_0x20ba1c['uniqueid']==_0x42c5d7[_0x8a47('0x6')]){_0x20ba1c[_0x8a47('0x25')]=0x0;_0x20ba1c[_0x8a47('0x23')]=_0x42c5d7[_0x8a47('0x24')];_0x20ba1c['agentringnoanswer']=!![];_0x20ba1c[_0x8a47('0x20')]=utils[_0x8a47('0x17')]();_0x20ba1c[_0x8a47('0xc')]=_0x8a47('0x30');_0x20ba1c[_0x8a47('0x22')]='answered_elsewhere';_0x20ba1c[_0x8a47('0x31')]=_0x42c5d7[_0x8a47('0x15')];_0x20ba1c[_0x8a47('0x32')]=_0x42c5d7['membername'];writeDB(_0x20ba1c);}});}}catch(_0x2b3874){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x33'),_0x42c5d7['uniqueid']),_0x2b3874);}};exports[_0x8a47('0xe')]=function(_0x2f523f){try{if(!_[_0x8a47('0x1c')](agents[_0x2f523f[_0x8a47('0x15')]])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')]('[%s][agents][agentcomplete]',_0x2f523f['uniqueid']),_0x2f523f);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x34'),_0x2f523f['uniqueid'],agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x9')],_0x2f523f['destuniqueid']));agents[_0x2f523f['destuniqueid']][_0x8a47('0xe')]=!![];agents[_0x2f523f['destuniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x25')]=utils[_0x8a47('0x36')](agents[_0x2f523f[_0x8a47('0x15')]]['agentcompleteAt'],agents[_0x2f523f['destuniqueid']][_0x8a47('0x2e')]);agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x22')]=_0x2f523f[_0x8a47('0x22')];agents[_0x2f523f[_0x8a47('0x15')]]['lastevent']='complete';writeDB(agents[_0x2f523f[_0x8a47('0x15')]]);}}catch(_0x531faa){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')]('[%s][agents][agentcomplete]',_0x2f523f[_0x8a47('0x6')]),_0x531faa);}};exports[_0x8a47('0x37')]=function(_0x14e22c){try{if(!_[_0x8a47('0x1c')](agents[_0x14e22c[_0x8a47('0x38')]])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x39'),_0x14e22c['uniqueid']),_0x14e22c);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x3a'),_0x14e22c[_0x8a47('0x6')],agents[_0x14e22c['transfereruniqueid']][_0x8a47('0x9')],agents[_0x14e22c[_0x8a47('0x38')]][_0x8a47('0x6')]));agents[_0x14e22c[_0x8a47('0x38')]][_0x8a47('0x3b')]=!![];agents[_0x14e22c[_0x8a47('0x38')]]['transfertype']='blind';agents[_0x14e22c[_0x8a47('0x38')]]['transferexten']=_0x14e22c[_0x8a47('0x3c')];agents[_0x14e22c[_0x8a47('0x38')]]['transferuniqueid']=agents[_0x14e22c[_0x8a47('0x38')]]['uniqueid'];}}catch(_0x315111){utils['error'](util[_0x8a47('0x4')]('[%s][agents][blindtransfer]',_0x14e22c[_0x8a47('0x6')]),_0x315111);}};exports[_0x8a47('0x3d')]=function(_0xdaa896){try{utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x3e'),_0xdaa896[_0x8a47('0x3f')]),_0xdaa896);if(_0xdaa896[_0x8a47('0x3f')]==_0xdaa896[_0x8a47('0x40')]){if(!_[_0x8a47('0x1c')](agents[_0xdaa896[_0x8a47('0x41')]])){utils['info'](util[_0x8a47('0x4')](_0x8a47('0x42'),_0xdaa896['origtransfereruniqueid'],agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x9')]));agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x3b')]=!![];agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x43')]=_0x8a47('0x44');agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x45')]=_0xdaa896[_0x8a47('0x46')];agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x47')]=_0xdaa896['origtransfereruniqueid'];}if(_0xdaa896[_0x8a47('0x48')]&&agents[_0xdaa896[_0x8a47('0x48')]]){agents[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x49')]=0x1;transfers[_0xdaa896[_0x8a47('0x48')]]=_[_0x8a47('0x4a')](agents[_0xdaa896[_0x8a47('0x48')]]);transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0xa')]=agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0xa')];transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x4b')]=agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x4b')];transfers[_0xdaa896[_0x8a47('0x48')]]['agentcalledAt']=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfereeuniqueid']][_0x8a47('0x2e')]=utils[_0x8a47('0x17')]();transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x23')]=0x0;transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x49')]=0x2;}}else if(_0xdaa896['secondtransfereruniqueid']==_0xdaa896[_0x8a47('0x4c')]){if(!_[_0x8a47('0x1c')](agents[_0xdaa896[_0x8a47('0x3f')]])){utils['info'](util['format'](_0x8a47('0x42'),_0xdaa896[_0x8a47('0x3f')],agents[_0xdaa896['origtransfereruniqueid']][_0x8a47('0x9')]));agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x3b')]=!![];agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x43')]=_0x8a47('0x44');agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x45')]=_0xdaa896[_0x8a47('0x4d')];agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x47')]=_0xdaa896[_0x8a47('0x41')];}if(_0xdaa896[_0x8a47('0x4e')]&&agents[_0xdaa896['transfertargetuniqueid']]){agents[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x49')]=0x1;transfers[_0xdaa896[_0x8a47('0x4e')]]=_[_0x8a47('0x4a')](agents[_0xdaa896[_0x8a47('0x4e')]]);transfers[_0xdaa896[_0x8a47('0x4e')]]['calleridnum']=agents[_0xdaa896[_0x8a47('0x3f')]]['calleridnum'];transfers[_0xdaa896['transfertargetuniqueid']][_0x8a47('0x4b')]=agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x4b')];transfers[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x16')]=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfertargetuniqueid']]['agentconnectAt']=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfertargetuniqueid']][_0x8a47('0x23')]=0x0;transfers[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x49')]=0x2;}}}catch(_0x39d8f4){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x3e'),_0xdaa896[_0x8a47('0x3f')]),_0x39d8f4);}};exports['hangup']=function(_0x5c1e7e){try{utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x4f'),_0x5c1e7e['uniqueid']),_0x5c1e7e);if(agents[_0x5c1e7e['uniqueid']]&&agents[_0x5c1e7e['uniqueid']][_0x8a47('0x22')]==='timeout'){if(_0x5c1e7e[_0x8a47('0x50')]==='21'){agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')]=_0x8a47('0x51');agents[_0x5c1e7e['uniqueid']][_0x8a47('0xc')]='rejected';}utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x52'),_0x5c1e7e['uniqueid'],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],agents[_0x5c1e7e['uniqueid']][_0x8a47('0x22')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(agents[_0x5c1e7e[_0x8a47('0x6')]]);var _0x4c6dbe=unanswered[_0x8a47('0x53')](_0x5c1e7e[_0x8a47('0x6')]);if(_0x4c6dbe>-0x1){unanswered[_0x8a47('0x54')](_0x4c6dbe,0x1);}}if(transfers[_0x5c1e7e['uniqueid']]){transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xe')]=!![];transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x25')]=utils[_0x8a47('0x36')](transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x35')],transfers[_0x5c1e7e[_0x8a47('0x6')]]['agentconnectAt']);transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x22')]=_0x8a47('0x55');transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]=_0x8a47('0x56');utils[_0x8a47('0x3')](util[_0x8a47('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5c1e7e[_0x8a47('0x6')],transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x22')],transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(transfers[_0x5c1e7e[_0x8a47('0x6')]],!![]);}if(agents[_0x5c1e7e[_0x8a47('0x6')]]&&agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x2e')]){agents[_0x5c1e7e[_0x8a47('0x6')]]['agentcomplete']=!![];agents[_0x5c1e7e['uniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();agents[_0x5c1e7e[_0x8a47('0x6')]]['talktime']=utils[_0x8a47('0x36')](agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x35')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x2e')]);agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')]=agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x3b')]?_0x8a47('0x3b'):_0x8a47('0x55');agents[_0x5c1e7e[_0x8a47('0x6')]]['lastevent']=_0x8a47('0x56');utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x52'),_0x5c1e7e[_0x8a47('0x6')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(agents[_0x5c1e7e['uniqueid']]);}}catch(_0x98d7ae){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x4f'),_0x5c1e7e[_0x8a47('0x6')]),_0x98d7ae);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 0abe43e..74b358e 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 _0x8e20=['xmd-queue','lastapplication','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','includes','noop','set','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','calleridnum','accountcode','request','CreateVoiceCallReport','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','source','variable','value','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue'];(function(_0x10f9fe,_0x207c91){var _0x161aae=function(_0x587603){while(--_0x587603){_0x10f9fe['push'](_0x10f9fe['shift']());}};_0x161aae(++_0x207c91);}(_0x8e20,0x1af));var _0x08e2=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x8e20[_0x425716];return _0x2d39af;};'use strict';var _=require(_0x08e2('0x0'));var util=require(_0x08e2('0x1'));var utils=require(_0x08e2('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x08e2('0x3'),_0x08e2('0x4'),'FAILED',_0x08e2('0x3'),_0x08e2('0x3'),_0x08e2('0x3'),_0x08e2('0x5'),_0x08e2('0x6'),'FAILED',_0x08e2('0x4'),_0x08e2('0x4')];var channels={};function writeDB(_0x5e5a52){var _0x24af30;if(transfers[_0x08e2('0x7')][_0x5e5a52[_0x08e2('0x8')]]){_0x24af30=_0x5e5a52[_0x08e2('0x8')];_0x5e5a52[_0x08e2('0x8')]=transfers[_0x08e2('0x7')][_0x5e5a52['uniqueid']][_0x08e2('0x9')];}utils['info'](util['format'](_0x08e2('0xa'),_0x5e5a52[_0x08e2('0x8')],_0x5e5a52[_0x08e2('0xb')],_0x5e5a52[_0x08e2('0xc')],_0x5e5a52['membername'],_0x5e5a52['interface'],_0x5e5a52[_0x08e2('0xd')],_0x5e5a52['connectedlinenum'],_0x5e5a52['lastevent']));if(_0x5e5a52[_0x08e2('0xe')]){utils['getUserByInternal'](_0x5e5a52[_0x08e2('0xe')])['then'](function(_0x42b1c0){if(_0x42b1c0){_0x5e5a52['UserId']=_0x42b1c0['id'];}utils['request']('CreateVoiceCallReport',_0x5e5a52);});}else{utils[_0x08e2('0xf')](_0x08e2('0x10'),_0x5e5a52);}if(channels[_0x5e5a52[_0x08e2('0x8')]]){delete channels[_0x5e5a52['uniqueid']];}else if(_0x24af30&&channels[_0x24af30]){if(!transfers['blinds'][_0x24af30]['recording'])delete transfers['blinds'][_0x24af30];delete channels[_0x24af30];}}exports['newchannel']=function(_0x5daeeb){try{utils[_0x08e2('0x11')](util[_0x08e2('0x12')](_0x08e2('0x13'),_0x5daeeb[_0x08e2('0x8')]),_0x5daeeb);if(_0x5daeeb[_0x08e2('0x8')]==_0x5daeeb[_0x08e2('0x14')]&&_0x5daeeb[_0x08e2('0xb')]!=_0x08e2('0x15')){utils[_0x08e2('0x16')](util[_0x08e2('0x12')](_0x08e2('0x17'),_0x5daeeb['uniqueid'],_0x5daeeb['context'],_0x5daeeb['exten']));channels[_0x5daeeb[_0x08e2('0x8')]]={'uniqueid':_0x5daeeb[_0x08e2('0x8')],'accountcode':_0x5daeeb['accountcode'],'source':_0x5daeeb[_0x08e2('0xd')],'destination':_0x5daeeb['exten'],'destinationcontext':_0x5daeeb[_0x08e2('0x18')],'channel':_0x5daeeb['channel'],'starttime':utils[_0x08e2('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x08e2('0x3'),'amaflags':_0x08e2('0x1a')};}}catch(_0x3dbd7e){utils[_0x08e2('0x1b')](util['format']('[%s][calls][newchannel]',_0x5daeeb['uniqueid']),_0x3dbd7e);}};exports[_0x08e2('0x1c')]=function(_0x1cf01a){try{utils[_0x08e2('0x11')](util[_0x08e2('0x12')](_0x08e2('0x1d'),_0x1cf01a['uniqueid']),_0x1cf01a);if(!_['isNil'](channels[_0x1cf01a[_0x08e2('0x8')]])&&_0x1cf01a[_0x08e2('0x1e')]==0x6){utils[_0x08e2('0x16')](util[_0x08e2('0x12')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x1cf01a[_0x08e2('0x8')],_0x1cf01a['context'],_0x1cf01a[_0x08e2('0xb')]));if(_[_0x08e2('0x1f')](channels[_0x1cf01a[_0x08e2('0x8')]][_0x08e2('0x20')])){channels[_0x1cf01a[_0x08e2('0x8')]][_0x08e2('0x20')]=utils[_0x08e2('0x19')]();}}else if(!_[_0x08e2('0x1f')](channels[_0x1cf01a['linkedid']])&&_0x1cf01a[_0x08e2('0x1e')]==0x6&&_0x1cf01a[_0x08e2('0x18')]!=_0x08e2('0x21')){utils[_0x08e2('0x16')](util['format'](_0x08e2('0x22'),_0x1cf01a[_0x08e2('0x8')],_0x1cf01a['linkedid'],_0x1cf01a[_0x08e2('0x18')],_0x1cf01a['channel']));channels[_0x1cf01a['linkedid']][_0x08e2('0xe')]=_0x1cf01a[_0x08e2('0xe')];channels[_0x1cf01a[_0x08e2('0x14')]][_0x08e2('0x23')]=_0x1cf01a[_0x08e2('0xb')];if(_['isNil'](channels[_0x1cf01a[_0x08e2('0x14')]][_0x08e2('0x24')])){channels[_0x1cf01a['linkedid']][_0x08e2('0x24')]=utils[_0x08e2('0x19')]();}channels[_0x1cf01a['linkedid']][_0x08e2('0x25')]=dispositions[_[_0x08e2('0x26')](_0x1cf01a['channelstate'])]||_0x08e2('0x5');}}catch(_0x3777dc){utils[_0x08e2('0x1b')](util[_0x08e2('0x12')](_0x08e2('0x1d'),_0x1cf01a['uniqueid']),_0x3777dc);}};exports[_0x08e2('0x27')]=function(_0x2c4768){try{if(!_[_0x08e2('0x1f')](channels[_0x2c4768['uniqueid']])){utils[_0x08e2('0x11')](util[_0x08e2('0x12')](_0x08e2('0x28'),_0x2c4768[_0x08e2('0x8')]),_0x2c4768);if(_[_0x08e2('0x1f')](channels[_0x2c4768[_0x08e2('0x8')]][_0x08e2('0x29')])){channels[_0x2c4768['uniqueid']]['callerid']=_0x2c4768[_0x08e2('0x2a')]+'\x20<'+_0x2c4768[_0x08e2('0xd')]+'>';}utils[_0x08e2('0x16')](util[_0x08e2('0x12')](_0x08e2('0x2b'),_0x2c4768[_0x08e2('0x8')],channels[_0x2c4768[_0x08e2('0x8')]]['callerid'],_0x2c4768['cause-txt']));channels[_0x2c4768[_0x08e2('0x8')]]['endtime']=utils[_0x08e2('0x19')]();channels[_0x2c4768[_0x08e2('0x8')]][_0x08e2('0x2c')]=utils[_0x08e2('0x2d')](channels[_0x2c4768[_0x08e2('0x8')]][_0x08e2('0x2e')],channels[_0x2c4768['uniqueid']][_0x08e2('0x2f')]);channels[_0x2c4768[_0x08e2('0x8')]][_0x08e2('0x30')]=channels[_0x2c4768['uniqueid']][_0x08e2('0x24')]?utils['diffTime'](channels[_0x2c4768[_0x08e2('0x8')]][_0x08e2('0x2e')],channels[_0x2c4768[_0x08e2('0x8')]]['answertime']):0x0;writeDB(channels[_0x2c4768[_0x08e2('0x8')]]);}}catch(_0x5bdf91){utils[_0x08e2('0x1b')](util[_0x08e2('0x12')]('[%s][calls][hangup]',_0x2c4768[_0x08e2('0x8')]),_0x5bdf91);}};exports[_0x08e2('0x31')]=function(_0x3a6861){try{if(!_[_0x08e2('0x1f')](channels[_0x3a6861[_0x08e2('0x32')]])){utils[_0x08e2('0x11')](util[_0x08e2('0x12')](_0x08e2('0x33'),_0x3a6861[_0x08e2('0x34')]),_0x3a6861);if(channels[_0x3a6861[_0x08e2('0x32')]][_0x08e2('0xb')]==_0x3a6861[_0x08e2('0x35')]){utils[_0x08e2('0x16')](util[_0x08e2('0x12')](_0x08e2('0x36'),_0x3a6861[_0x08e2('0x34')],_0x3a6861[_0x08e2('0x32')],_0x3a6861['secondtransfererchannel']));channels[_0x3a6861[_0x08e2('0x32')]]['destinationchannel']=_0x3a6861[_0x08e2('0x37')];channels[_0x3a6861[_0x08e2('0x32')]][_0x08e2('0x38')]=_0x08e2('0x39');}else if(channels[_0x3a6861[_0x08e2('0x32')]][_0x08e2('0xb')]=_0x3a6861[_0x08e2('0x3a')]){utils[_0x08e2('0x16')](util['format'](_0x08e2('0x36'),_0x3a6861[_0x08e2('0x34')],_0x3a6861[_0x08e2('0x32')],_0x3a6861[_0x08e2('0x3b')]));channels[_0x3a6861[_0x08e2('0x32')]]['destinationchannel']=_0x3a6861[_0x08e2('0x3b')];channels[_0x3a6861['localtwolinkedid']][_0x08e2('0x38')]=_0x08e2('0x39');}}}catch(_0x234a7e){utils[_0x08e2('0x1b')](util[_0x08e2('0x12')](_0x08e2('0x33'),_0x3a6861[_0x08e2('0x34')]),_0x234a7e);}};exports[_0x08e2('0x3c')]=function(_0x909eb0){try{if(!_[_0x08e2('0x1f')](channels[_0x909eb0[_0x08e2('0x8')]])){utils[_0x08e2('0x11')](util[_0x08e2('0x12')](_0x08e2('0x3d'),_0x909eb0['uniqueid']),_0x909eb0);channels[_0x909eb0[_0x08e2('0x8')]][_0x08e2('0x3e')]=utils[_0x08e2('0x19')]();utils[_0x08e2('0x16')](util[_0x08e2('0x12')](_0x08e2('0x3f'),_0x909eb0[_0x08e2('0x8')],channels[_0x909eb0[_0x08e2('0x8')]][_0x08e2('0x3e')]));}}catch(_0x470b5d){utils[_0x08e2('0x1b')](util[_0x08e2('0x12')](_0x08e2('0x3d'),_0x909eb0['uniqueid']),_0x470b5d);}};exports[_0x08e2('0x40')]=function(_0x49c079){try{if(!_[_0x08e2('0x1f')](channels[_0x49c079['uniqueid']])){utils[_0x08e2('0x11')](util[_0x08e2('0x12')](_0x08e2('0x41'),_0x49c079['uniqueid']),_0x49c079);if(!_[_0x08e2('0x1f')](channels[_0x49c079[_0x08e2('0x8')]]['musiconholdstartAt'])){channels[_0x49c079[_0x08e2('0x8')]][_0x08e2('0x42')]+=utils[_0x08e2('0x2d')](utils['now'](),channels[_0x49c079['uniqueid']][_0x08e2('0x3e')]);utils[_0x08e2('0x16')](util[_0x08e2('0x12')](_0x08e2('0x43'),_0x49c079[_0x08e2('0x8')],channels[_0x49c079[_0x08e2('0x8')]][_0x08e2('0x42')]));delete channels[_0x49c079['uniqueid']][_0x08e2('0x3e')];}}}catch(_0x244a0e){utils['error'](util[_0x08e2('0x12')](_0x08e2('0x41'),_0x49c079['uniqueid']),_0x244a0e);}};exports['varset']=function(_0x26a456){try{if(!_[_0x08e2('0x1f')](channels[_0x26a456['uniqueid']])){utils[_0x08e2('0x11')](util[_0x08e2('0x12')](_0x08e2('0x44'),_0x26a456['uniqueid']),_0x26a456);if(!_[_0x08e2('0x1f')](_0x26a456['variable'][_0x08e2('0x45')])){utils[_0x08e2('0x16')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x26a456[_0x08e2('0x8')],_0x26a456['value']));channels[_0x26a456[_0x08e2('0x8')]][_0x08e2('0x46')]=_0x26a456['value'];}if(!_[_0x08e2('0x1f')](_0x26a456[_0x08e2('0x47')]['xmd-phone'])){utils[_0x08e2('0x16')](util[_0x08e2('0x12')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x26a456[_0x08e2('0x8')],_0x26a456[_0x08e2('0x48')]));channels[_0x26a456[_0x08e2('0x8')]][_0x08e2('0x49')]=_0x26a456[_0x08e2('0x48')];channels[_0x26a456[_0x08e2('0x8')]][_0x08e2('0x29')]='\x22'+_0x26a456[_0x08e2('0x48')]+_0x08e2('0x4a')+_0x26a456[_0x08e2('0x48')]+'>';}if(!_[_0x08e2('0x1f')](_0x26a456[_0x08e2('0x47')][_0x08e2('0x4b')])||!_['isNil'](_0x26a456[_0x08e2('0x47')][_0x08e2('0x4c')])){utils[_0x08e2('0x16')](util['format'](_0x08e2('0x4d'),_0x26a456[_0x08e2('0x8')],!_[_0x08e2('0x1f')](_0x26a456[_0x08e2('0x47')][_0x08e2('0x4b')])?_0x08e2('0x4b'):_0x08e2('0x4c'),_0x26a456[_0x08e2('0x48')]));channels[_0x26a456[_0x08e2('0x8')]][_0x08e2('0x29')]=_0x26a456[_0x08e2('0x48')];}if(!_[_0x08e2('0x1f')](_0x26a456[_0x08e2('0x47')]['xmd-queue'])||!_[_0x08e2('0x1f')](_0x26a456[_0x08e2('0x47')][_0x08e2('0x4e')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x26a456[_0x08e2('0x8')],!_['isNil'](_0x26a456['variable'][_0x08e2('0x4f')])?_0x08e2('0x4f'):_0x08e2('0x4e'),_0x26a456[_0x08e2('0x48')]));channels[_0x26a456[_0x08e2('0x8')]][_0x08e2('0x50')]='Queue';channels[_0x26a456['uniqueid']][_0x08e2('0x51')]=_0x26a456[_0x08e2('0x48')];channels[_0x26a456[_0x08e2('0x8')]]['queue']=!![];}if(!_[_0x08e2('0x1f')](_0x26a456['variable'][_0x08e2('0x52')])){utils[_0x08e2('0x16')](util[_0x08e2('0x12')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x26a456[_0x08e2('0x8')],_0x26a456[_0x08e2('0x48')]));channels[_0x26a456['uniqueid']][_0x08e2('0x53')]=_0x26a456[_0x08e2('0x48')];}if(!_[_0x08e2('0x1f')](_0x26a456[_0x08e2('0x47')][_0x08e2('0x54')])){utils[_0x08e2('0x16')](util[_0x08e2('0x12')](_0x08e2('0x55'),_0x26a456[_0x08e2('0x8')],_0x26a456[_0x08e2('0x48')]));channels[_0x26a456[_0x08e2('0x8')]][_0x08e2('0x56')]=_0x26a456[_0x08e2('0x48')];}if(!_[_0x08e2('0x1f')](_0x26a456['variable']['outboundrouteid'])){utils[_0x08e2('0x16')](util[_0x08e2('0x12')](_0x08e2('0x57'),_0x26a456['uniqueid'],_0x26a456[_0x08e2('0x48')]));channels[_0x26a456[_0x08e2('0x8')]]['routeid']=_0x26a456[_0x08e2('0x48')];}if(!_[_0x08e2('0x1f')](_0x26a456[_0x08e2('0x47')]['sipcallid'])){utils[_0x08e2('0x16')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x26a456[_0x08e2('0x8')],_0x26a456['value']));channels[_0x26a456[_0x08e2('0x8')]][_0x08e2('0x58')]=_0x26a456['value'];}}}catch(_0x3bf9ab){utils[_0x08e2('0x1b')](util[_0x08e2('0x12')](_0x08e2('0x44'),_0x26a456[_0x08e2('0x8')]),_0x3bf9ab);}};exports['newexten']=function(_0x3127b3){try{if(!_['isNil'](channels[_0x3127b3[_0x08e2('0x8')]])){utils[_0x08e2('0x11')](util['format'](_0x08e2('0x59'),_0x3127b3[_0x08e2('0x8')]),_0x3127b3);utils[_0x08e2('0x16')](util[_0x08e2('0x12')](_0x08e2('0x5a'),_0x3127b3[_0x08e2('0x8')],_0x3127b3[_0x08e2('0x5b')],_0x3127b3[_0x08e2('0x5c')]));if(_0x3127b3[_0x08e2('0x5b')][_0x08e2('0x5d')]()=='set'&&_[_0x08e2('0x5e')](_0x3127b3[_0x08e2('0x5c')]['toLowerCase'](),'cdr')){var _0x3b4f14=_0x3127b3[_0x08e2('0x5c')][_0x08e2('0x5f')]('=');var _0x53d249=_0x3b4f14[0x0][_0x08e2('0x60')](_0x3b4f14[0x0][_0x08e2('0x61')]('(')+0x1,_0x3b4f14[0x0][_0x08e2('0x61')](')'));var _0x345824=_0x3b4f14[0x1];channels[_0x3127b3[_0x08e2('0x8')]][_0x53d249]=_0x345824;}if(!_[_0x08e2('0x62')]([_0x08e2('0x27'),_0x08e2('0x63'),'execif',_0x08e2('0x64'),_0x08e2('0x65')],_0x3127b3[_0x08e2('0x5b')]['toLowerCase']())){channels[_0x3127b3[_0x08e2('0x8')]]['lastapplication']=_0x3127b3[_0x08e2('0x5b')];channels[_0x3127b3['uniqueid']][_0x08e2('0x51')]=_0x3127b3['appdata'];}}}catch(_0x184fa3){utils[_0x08e2('0x1b')](util[_0x08e2('0x12')](_0x08e2('0x59'),_0x3127b3[_0x08e2('0x8')]),_0x184fa3);}}; \ No newline at end of file +var _0x3025=['[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','format','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','now','disposition','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','_attended','error','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]','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','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x3025,0x1c7));var _0x5302=function(_0x1915b8,_0x220304){_0x1915b8=_0x1915b8-0x0;var _0x4516f0=_0x3025[_0x1915b8];return _0x4516f0;};'use strict';var _=require(_0x5302('0x0'));var util=require(_0x5302('0x1'));var utils=require(_0x5302('0x2'));var transfers=require(_0x5302('0x3'));var dispositions=[_0x5302('0x4'),_0x5302('0x5'),_0x5302('0x5'),_0x5302('0x4'),_0x5302('0x4'),'NO\x20ANSWER',_0x5302('0x6'),_0x5302('0x7'),'FAILED',_0x5302('0x5'),'FAILED'];var channels={};function writeDB(_0x41c3d6){var _0x2e9c66;if(transfers['blinds'][_0x41c3d6[_0x5302('0x8')]]){_0x2e9c66=_0x41c3d6[_0x5302('0x8')];_0x41c3d6['uniqueid']=transfers[_0x5302('0x9')][_0x41c3d6[_0x5302('0x8')]][_0x5302('0xa')];}utils[_0x5302('0xb')](util['format'](_0x5302('0xc'),_0x41c3d6[_0x5302('0x8')],_0x41c3d6[_0x5302('0xd')],_0x41c3d6[_0x5302('0xe')],_0x41c3d6['membername'],_0x41c3d6[_0x5302('0xf')],_0x41c3d6['calleridnum'],_0x41c3d6['connectedlinenum'],_0x41c3d6[_0x5302('0x10')]));if(_0x41c3d6[_0x5302('0x11')]){utils[_0x5302('0x12')](_0x41c3d6[_0x5302('0x11')])['then'](function(_0x55c129){if(_0x55c129){_0x41c3d6['UserId']=_0x55c129['id'];}utils[_0x5302('0x13')](_0x5302('0x14'),_0x41c3d6);});}else{utils['request'](_0x5302('0x14'),_0x41c3d6);}if(channels[_0x41c3d6['uniqueid']]){delete channels[_0x41c3d6['uniqueid']];}else if(_0x2e9c66&&channels[_0x2e9c66]){if(!transfers[_0x5302('0x9')][_0x2e9c66]['recording'])delete transfers[_0x5302('0x9')][_0x2e9c66];delete channels[_0x2e9c66];}}exports['newchannel']=function(_0x14a335){try{utils[_0x5302('0x15')](util['format'](_0x5302('0x16'),_0x14a335['uniqueid']),_0x14a335);if(_0x14a335[_0x5302('0x8')]==_0x14a335[_0x5302('0x17')]&&_0x14a335[_0x5302('0xd')]!='OutgoingSpoolFailed'){utils[_0x5302('0xb')](util['format'](_0x5302('0x18'),_0x14a335[_0x5302('0x8')],_0x14a335[_0x5302('0x19')],_0x14a335[_0x5302('0x1a')]));channels[_0x14a335[_0x5302('0x8')]]={'uniqueid':_0x14a335[_0x5302('0x8')],'accountcode':_0x14a335['accountcode'],'source':_0x14a335[_0x5302('0x1b')],'destination':_0x14a335[_0x5302('0x1a')],'destinationcontext':_0x14a335[_0x5302('0x19')],'channel':_0x14a335[_0x5302('0xd')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x5e33d8){utils['error'](util[_0x5302('0x1c')](_0x5302('0x16'),_0x14a335[_0x5302('0x8')]),_0x5e33d8);}};exports['newstate']=function(_0x14d863){try{utils['debug'](util['format'](_0x5302('0x1d'),_0x14d863[_0x5302('0x8')]),_0x14d863);if(!_[_0x5302('0x1e')](channels[_0x14d863[_0x5302('0x8')]])&&_0x14d863[_0x5302('0x1f')]==0x6){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x20'),_0x14d863[_0x5302('0x8')],_0x14d863[_0x5302('0x19')],_0x14d863[_0x5302('0xd')]));if(_[_0x5302('0x1e')](channels[_0x14d863[_0x5302('0x8')]][_0x5302('0x21')])){channels[_0x14d863[_0x5302('0x8')]]['systemanswertime']=utils['now']();}}else if(!_[_0x5302('0x1e')](channels[_0x14d863[_0x5302('0x17')]])&&_0x14d863[_0x5302('0x1f')]==0x6&&_0x14d863['context']!=_0x5302('0x22')){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x23'),_0x14d863[_0x5302('0x8')],_0x14d863[_0x5302('0x17')],_0x14d863['context'],_0x14d863[_0x5302('0xd')]));channels[_0x14d863['linkedid']][_0x5302('0x11')]=_0x14d863[_0x5302('0x11')];channels[_0x14d863[_0x5302('0x17')]]['destinationchannel']=_0x14d863[_0x5302('0xd')];if(_[_0x5302('0x1e')](channels[_0x14d863[_0x5302('0x17')]][_0x5302('0x24')])){channels[_0x14d863[_0x5302('0x17')]][_0x5302('0x24')]=utils[_0x5302('0x25')]();}channels[_0x14d863[_0x5302('0x17')]][_0x5302('0x26')]=dispositions[_[_0x5302('0x27')](_0x14d863[_0x5302('0x1f')])]||_0x5302('0x6');}}catch(_0x540ea0){utils['error'](util[_0x5302('0x1c')](_0x5302('0x1d'),_0x14d863[_0x5302('0x8')]),_0x540ea0);}};exports['hangup']=function(_0x1ea551){try{if(!_[_0x5302('0x1e')](channels[_0x1ea551['uniqueid']])){utils[_0x5302('0x15')](util[_0x5302('0x1c')]('[%s][calls][hangup]',_0x1ea551[_0x5302('0x8')]),_0x1ea551);if(_[_0x5302('0x1e')](channels[_0x1ea551[_0x5302('0x8')]][_0x5302('0x28')])){channels[_0x1ea551['uniqueid']][_0x5302('0x28')]=_0x1ea551[_0x5302('0x29')]+'\x20<'+_0x1ea551['calleridnum']+'>';}utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x2a'),_0x1ea551[_0x5302('0x8')],channels[_0x1ea551[_0x5302('0x8')]]['callerid'],_0x1ea551['cause-txt']));channels[_0x1ea551[_0x5302('0x8')]][_0x5302('0x2b')]=utils[_0x5302('0x25')]();channels[_0x1ea551['uniqueid']]['duration']=utils[_0x5302('0x2c')](channels[_0x1ea551['uniqueid']][_0x5302('0x2b')],channels[_0x1ea551[_0x5302('0x8')]][_0x5302('0x2d')]);channels[_0x1ea551[_0x5302('0x8')]]['billableseconds']=channels[_0x1ea551['uniqueid']][_0x5302('0x24')]?utils[_0x5302('0x2c')](channels[_0x1ea551[_0x5302('0x8')]]['endtime'],channels[_0x1ea551[_0x5302('0x8')]][_0x5302('0x24')]):0x0;writeDB(channels[_0x1ea551[_0x5302('0x8')]]);}}catch(_0x557a36){utils['error'](util['format'](_0x5302('0x2e'),_0x1ea551[_0x5302('0x8')]),_0x557a36);}};exports[_0x5302('0x2f')]=function(_0x20f3ad){try{if(!_[_0x5302('0x1e')](channels[_0x20f3ad[_0x5302('0x30')]])){utils[_0x5302('0x15')](util[_0x5302('0x1c')](_0x5302('0x31'),_0x20f3ad['origtransfereruniqueid']),_0x20f3ad);if(channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0xd')]==_0x20f3ad[_0x5302('0x32')]){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x33'),_0x20f3ad['origtransfereruniqueid'],_0x20f3ad[_0x5302('0x30')],_0x20f3ad[_0x5302('0x34')]));channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0x35')]=_0x20f3ad[_0x5302('0x34')];channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0x36')]='_attended';}else if(channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0xd')]=_0x20f3ad[_0x5302('0x37')]){utils['info'](util[_0x5302('0x1c')](_0x5302('0x33'),_0x20f3ad[_0x5302('0x38')],_0x20f3ad[_0x5302('0x30')],_0x20f3ad['origtransfererchannel']));channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0x35')]=_0x20f3ad[_0x5302('0x39')];channels[_0x20f3ad[_0x5302('0x30')]]['userfield']=_0x5302('0x3a');}}}catch(_0x263946){utils[_0x5302('0x3b')](util[_0x5302('0x1c')](_0x5302('0x31'),_0x20f3ad[_0x5302('0x38')]),_0x263946);}};exports[_0x5302('0x3c')]=function(_0x3f0e21){try{if(!_['isNil'](channels[_0x3f0e21[_0x5302('0x8')]])){utils['debug'](util[_0x5302('0x1c')](_0x5302('0x3d'),_0x3f0e21[_0x5302('0x8')]),_0x3f0e21);channels[_0x3f0e21[_0x5302('0x8')]][_0x5302('0x3e')]=utils[_0x5302('0x25')]();utils['info'](util[_0x5302('0x1c')](_0x5302('0x3f'),_0x3f0e21[_0x5302('0x8')],channels[_0x3f0e21[_0x5302('0x8')]][_0x5302('0x3e')]));}}catch(_0x2a0c23){utils[_0x5302('0x3b')](util[_0x5302('0x1c')](_0x5302('0x3d'),_0x3f0e21['uniqueid']),_0x2a0c23);}};exports[_0x5302('0x40')]=function(_0x51fe90){try{if(!_[_0x5302('0x1e')](channels[_0x51fe90[_0x5302('0x8')]])){utils['debug'](util[_0x5302('0x1c')]('[%s][calls][musiconholdstop]',_0x51fe90['uniqueid']),_0x51fe90);if(!_[_0x5302('0x1e')](channels[_0x51fe90[_0x5302('0x8')]][_0x5302('0x3e')])){channels[_0x51fe90[_0x5302('0x8')]][_0x5302('0x41')]+=utils['diffTime'](utils[_0x5302('0x25')](),channels[_0x51fe90[_0x5302('0x8')]][_0x5302('0x3e')]);utils['info'](util[_0x5302('0x1c')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x51fe90[_0x5302('0x8')],channels[_0x51fe90['uniqueid']][_0x5302('0x41')]));delete channels[_0x51fe90[_0x5302('0x8')]]['musiconholdstartAt'];}}}catch(_0x2ccdba){utils[_0x5302('0x3b')](util['format'](_0x5302('0x42'),_0x51fe90[_0x5302('0x8')]),_0x2ccdba);}};exports[_0x5302('0x43')]=function(_0x3debd3){try{if(!_[_0x5302('0x1e')](channels[_0x3debd3['uniqueid']])){utils['debug'](util[_0x5302('0x1c')](_0x5302('0x44'),_0x3debd3[_0x5302('0x8')]),_0x3debd3);if(!_['isNil'](_0x3debd3[_0x5302('0x45')][_0x5302('0x46')])){utils['info'](util[_0x5302('0x1c')](_0x5302('0x47'),_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x49')]=_0x3debd3['value'];}if(!_[_0x5302('0x1e')](_0x3debd3[_0x5302('0x45')]['xmd-phone'])){utils[_0x5302('0xb')](util['format'](_0x5302('0x4a'),_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]]['destination']=_0x3debd3[_0x5302('0x48')];channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x28')]='\x22'+_0x3debd3[_0x5302('0x48')]+_0x5302('0x4b')+_0x3debd3[_0x5302('0x48')]+'>';}if(!_['isNil'](_0x3debd3['variable'][_0x5302('0x4c')])||!_[_0x5302('0x1e')](_0x3debd3[_0x5302('0x45')][_0x5302('0x4d')])){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x4e'),_0x3debd3['uniqueid'],!_['isNil'](_0x3debd3[_0x5302('0x45')][_0x5302('0x4c')])?_0x5302('0x4c'):'xmd-callerid',_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]]['callerid']=_0x3debd3[_0x5302('0x48')];}if(!_['isNil'](_0x3debd3[_0x5302('0x45')][_0x5302('0x4f')])||!_[_0x5302('0x1e')](_0x3debd3[_0x5302('0x45')][_0x5302('0x50')])){utils['info'](util[_0x5302('0x1c')](_0x5302('0x4e'),_0x3debd3[_0x5302('0x8')],!_[_0x5302('0x1e')](_0x3debd3['variable'][_0x5302('0x4f')])?_0x5302('0x4f'):_0x5302('0x50'),_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x51')]=_0x5302('0x52');channels[_0x3debd3['uniqueid']][_0x5302('0x53')]=_0x3debd3[_0x5302('0x48')];channels[_0x3debd3['uniqueid']][_0x5302('0xe')]=!![];}if(!_[_0x5302('0x1e')](_0x3debd3[_0x5302('0x45')][_0x5302('0x54')])){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x55'),_0x3debd3['uniqueid'],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x56')]=_0x3debd3[_0x5302('0x48')];}if(!_['isNil'](_0x3debd3['variable'][_0x5302('0x57')])){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x58'),_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]]['type']=_0x3debd3[_0x5302('0x48')];}if(!_[_0x5302('0x1e')](_0x3debd3['variable'][_0x5302('0x59')])){utils[_0x5302('0xb')](util[_0x5302('0x1c')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x5a')]=_0x3debd3[_0x5302('0x48')];}if(!_['isNil'](_0x3debd3['variable']['sipcallid'])){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x5b'),_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]]['sipcallid']=_0x3debd3[_0x5302('0x48')];}}}catch(_0x22c2bf){utils['error'](util[_0x5302('0x1c')](_0x5302('0x44'),_0x3debd3[_0x5302('0x8')]),_0x22c2bf);}};exports[_0x5302('0x5c')]=function(_0x317556){try{if(!_[_0x5302('0x1e')](channels[_0x317556['uniqueid']])){utils[_0x5302('0x15')](util[_0x5302('0x1c')](_0x5302('0x5d'),_0x317556[_0x5302('0x8')]),_0x317556);utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x5e'),_0x317556[_0x5302('0x8')],_0x317556[_0x5302('0x5f')],_0x317556['appdata']));if(_0x317556[_0x5302('0x5f')][_0x5302('0x60')]()==_0x5302('0x61')&&_[_0x5302('0x62')](_0x317556['appdata']['toLowerCase'](),_0x5302('0x63'))){var _0xf2564d=_0x317556[_0x5302('0x64')][_0x5302('0x65')]('=');var _0x3a06d5=_0xf2564d[0x0][_0x5302('0x66')](_0xf2564d[0x0][_0x5302('0x67')]('(')+0x1,_0xf2564d[0x0][_0x5302('0x67')](')'));var _0x10fad5=_0xf2564d[0x1];channels[_0x317556[_0x5302('0x8')]][_0x3a06d5]=_0x10fad5;}if(!_[_0x5302('0x68')](['hangup',_0x5302('0x69'),_0x5302('0x6a'),'set',_0x5302('0x6b')],_0x317556[_0x5302('0x5f')][_0x5302('0x60')]())){channels[_0x317556[_0x5302('0x8')]]['lastapplication']=_0x317556[_0x5302('0x5f')];channels[_0x317556[_0x5302('0x8')]][_0x5302('0x53')]=_0x317556[_0x5302('0x64')];}}}catch(_0x40331c){utils[_0x5302('0x3b')](util[_0x5302('0x1c')](_0x5302('0x5d'),_0x317556[_0x5302('0x8')]),_0x40331c);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index dca46d5..a67a869 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 _0x3b55=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info'];(function(_0x270dfc,_0x6d8431){var _0x44fecb=function(_0x510743){while(--_0x510743){_0x270dfc['push'](_0x270dfc['shift']());}};_0x44fecb(++_0x6d8431);}(_0x3b55,0x98));var _0x53b5=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x3b55[_0x2fd69d];return _0x5d5ef3;};'use strict';var utils=require('./utils');exports[_0x53b5('0x0')]=function(){utils[_0x53b5('0x1')](_0x53b5('0x2'));};exports[_0x53b5('0x3')]=function(){utils[_0x53b5('0x1')](_0x53b5('0x4'));};exports[_0x53b5('0x5')]=function(){utils[_0x53b5('0x1')]('[core]\x20fullybooted');};exports[_0x53b5('0x6')]=function(_0x5407e2){utils[_0x53b5('0x6')](_0x53b5('0x7'),_0x5407e2);};exports[_0x53b5('0x8')]=function(){utils[_0x53b5('0x1')](_0x53b5('0x9'));};exports[_0x53b5('0xa')]=function(_0x330587){}; \ No newline at end of file +var _0xccc2=['info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x456a76,_0x3fb41e){var _0x311207=function(_0x49151e){while(--_0x49151e){_0x456a76['push'](_0x456a76['shift']());}};_0x311207(++_0x3fb41e);}(_0xccc2,0xb9));var _0x2ccc=function(_0x41669a,_0x56a70f){_0x41669a=_0x41669a-0x0;var _0x427693=_0xccc2[_0x41669a];return _0x427693;};'use strict';var utils=require(_0x2ccc('0x0'));exports[_0x2ccc('0x1')]=function(){utils[_0x2ccc('0x2')](_0x2ccc('0x3'));};exports[_0x2ccc('0x4')]=function(){utils[_0x2ccc('0x2')](_0x2ccc('0x5'));};exports['fullybooted']=function(){utils['info'](_0x2ccc('0x6'));};exports['error']=function(_0x4f601c){utils[_0x2ccc('0x7')]('[core]\x20error',_0x4f601c);};exports[_0x2ccc('0x8')]=function(){utils[_0x2ccc('0x2')](_0x2ccc('0x9'));};exports[_0x2ccc('0xa')]=function(_0x575528){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index bce3499..4d99dfc 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 _0x757b=['[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','answertime','lodash','util','./utils','format','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x757b,0x71));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb757('0x0'));var util=require(_0xb757('0x1'));var utils=require(_0xb757('0x2'));var dials={};function writeDB(_0x1d72a7){utils['info'](util[_0xb757('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1d72a7[_0xb757('0x4')],_0x1d72a7['channel'],_0x1d72a7[_0xb757('0x5')],_0x1d72a7[_0xb757('0x6')],_0x1d72a7[_0xb757('0x7')],_0x1d72a7[_0xb757('0x8')]));utils[_0xb757('0x9')](_0xb757('0xa'),_0x1d72a7);delete dials[_0x1d72a7['uniqueid']];}exports[_0xb757('0xb')]=function(_0x34c182){try{utils[_0xb757('0xc')](util[_0xb757('0x3')](_0xb757('0xd'),_0x34c182[_0xb757('0x4')]),_0x34c182);utils[_0xb757('0xe')](util[_0xb757('0x3')](_0xb757('0xf'),_0x34c182[_0xb757('0x4')],_0x34c182['application'],_0x34c182[_0xb757('0x10')]));if(_0x34c182[_0xb757('0x11')][_0xb757('0x12')]()==_0xb757('0x13')&&_[_0xb757('0x14')](_0x34c182[_0xb757('0x10')][_0xb757('0x12')](),_0xb757('0x15'))){var _0x4f0495=_0x34c182[_0xb757('0x10')][_0xb757('0x16')]('=');dials[_0x34c182['uniqueid']]={'routeId':_0x4f0495[0x1]};}}catch(_0x402a22){utils[_0xb757('0x17')](util[_0xb757('0x3')](_0xb757('0xd'),_0x34c182['uniqueid']),_0x402a22);}};exports[_0xb757('0x18')]=function(_0x43f9b8){try{utils[_0xb757('0xc')](util[_0xb757('0x3')](_0xb757('0x19'),_0x43f9b8[_0xb757('0x4')]),_0x43f9b8);if(!_[_0xb757('0x1a')](_0x43f9b8[_0xb757('0x1b')][_0xb757('0x1c')])){utils[_0xb757('0xe')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x43f9b8[_0xb757('0x4')],_0x43f9b8[_0xb757('0x1d')]));dials[_0x43f9b8[_0xb757('0x4')]]={'routeId':_0x43f9b8[_0xb757('0x1d')]};}}catch(_0x300509){utils[_0xb757('0x17')](util[_0xb757('0x3')]('[%s][dials][varset]',_0x43f9b8['uniqueid']),_0x300509);}};exports['dialbegin']=function(_0x2a6339){try{if(!_['isNil'](dials[_0x2a6339[_0xb757('0x4')]])){utils[_0xb757('0xc')](util[_0xb757('0x3')](_0xb757('0x1e'),_0x2a6339[_0xb757('0x4')]),_0x2a6339);dials[_0x2a6339[_0xb757('0x4')]]=_[_0xb757('0x1f')](dials[_0x2a6339[_0xb757('0x4')]],_0x2a6339);dials[_0x2a6339[_0xb757('0x4')]][_0xb757('0x20')]=utils[_0xb757('0x21')]();dials[_0x2a6339[_0xb757('0x4')]][_0xb757('0x22')]=_0xb757('0x23');utils[_0xb757('0xe')](util[_0xb757('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2a6339[_0xb757('0x4')],dials[_0x2a6339['uniqueid']][_0xb757('0x20')]));}}catch(_0x508b25){utils[_0xb757('0x17')](util[_0xb757('0x3')](_0xb757('0x1e'),_0x2a6339[_0xb757('0x4')]),_0x508b25);}};exports[_0xb757('0x24')]=function(_0x3c0136){try{if(!_[_0xb757('0x1a')](dials[_0x3c0136[_0xb757('0x4')]])){utils[_0xb757('0xc')](util[_0xb757('0x3')]('[%s][dials][dialend]',_0x3c0136[_0xb757('0x4')]),_0x3c0136);dials[_0x3c0136[_0xb757('0x4')]][_0xb757('0x8')]=_0x3c0136[_0xb757('0x8')];if(_0x3c0136[_0xb757('0x8')]==_0xb757('0x25')){dials[_0x3c0136[_0xb757('0x4')]]=_[_0xb757('0x1f')](dials[_0x3c0136[_0xb757('0x4')]],_0x3c0136);dials[_0x3c0136[_0xb757('0x4')]]['answertime']=utils[_0xb757('0x21')]();dials[_0x3c0136[_0xb757('0x4')]][_0xb757('0x22')]=_0xb757('0x26');utils['info'](util[_0xb757('0x3')](_0xb757('0x27'),_0x3c0136[_0xb757('0x4')],_0x3c0136['dialstatus'],dials[_0x3c0136[_0xb757('0x4')]]['answertime']));}else{utils[_0xb757('0xe')](util[_0xb757('0x3')](_0xb757('0x28'),_0x3c0136['uniqueid'],_0x3c0136[_0xb757('0x8')]));}}}catch(_0x21615e){utils[_0xb757('0x17')](util[_0xb757('0x3')]('[%s][dials][dialend]',_0x3c0136['uniqueid']),_0x21615e);}};exports[_0xb757('0x29')]=function(_0x2a6dca){try{if(!_['isNil'](dials[_0x2a6dca[_0xb757('0x4')]])){utils[_0xb757('0xc')](util['format'](_0xb757('0x2a'),_0x2a6dca[_0xb757('0x4')]),_0x2a6dca);utils['info'](util['format'](_0xb757('0x2b'),_0x2a6dca[_0xb757('0x4')],_0x2a6dca['calleridnum'],_0x2a6dca[_0xb757('0x2c')],_0x2a6dca[_0xb757('0x2d')]));dials[_0x2a6dca[_0xb757('0x4')]]=_[_0xb757('0x1f')](dials[_0x2a6dca['uniqueid']],{'endtime':utils[_0xb757('0x21')](),'lastevent':'complete'});dials[_0x2a6dca['uniqueid']][_0xb757('0x2e')]=utils[_0xb757('0x2f')](dials[_0x2a6dca[_0xb757('0x4')]][_0xb757('0x30')],dials[_0x2a6dca[_0xb757('0x4')]][_0xb757('0x20')]);dials[_0x2a6dca[_0xb757('0x4')]][_0xb757('0x31')]=utils[_0xb757('0x2f')](dials[_0x2a6dca[_0xb757('0x4')]]['answertime']||dials[_0x2a6dca['uniqueid']][_0xb757('0x30')],dials[_0x2a6dca[_0xb757('0x4')]][_0xb757('0x20')]);dials[_0x2a6dca['uniqueid']][_0xb757('0x32')]=dials[_0x2a6dca[_0xb757('0x4')]]['answertime']?utils[_0xb757('0x2f')](dials[_0x2a6dca[_0xb757('0x4')]]['endtime'],dials[_0x2a6dca[_0xb757('0x4')]][_0xb757('0x33')]):0x0;writeDB(dials[_0x2a6dca[_0xb757('0x4')]]);}}catch(_0x301177){utils[_0xb757('0x17')](util[_0xb757('0x3')](_0xb757('0x2a'),_0x2a6dca['uniqueid']),_0x301177);}}; \ No newline at end of file +var _0x5465=['connectedlinenum','dialstatus','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','debug','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','calleridnum','calleridname','cause-txt','complete','duration','diffTime','billableseconds','endtime','[%s][dials][hangup]','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x5465,0x18f));var _0x5546=function(_0x497cd6,_0x4e8d01){_0x497cd6=_0x497cd6-0x0;var _0xf2b10b=_0x5465[_0x497cd6];return _0xf2b10b;};'use strict';var _=require(_0x5546('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0xfb5a69){utils[_0x5546('0x1')](util[_0x5546('0x2')](_0x5546('0x3'),_0xfb5a69[_0x5546('0x4')],_0xfb5a69['channel'],_0xfb5a69[_0x5546('0x5')],_0xfb5a69['calleridnum'],_0xfb5a69[_0x5546('0x6')],_0xfb5a69[_0x5546('0x7')]));utils['request']('CreateVoiceDialReport',_0xfb5a69);delete dials[_0xfb5a69[_0x5546('0x4')]];}exports['newexten']=function(_0x2893a5){try{utils['debug'](util[_0x5546('0x2')](_0x5546('0x8'),_0x2893a5[_0x5546('0x4')]),_0x2893a5);utils[_0x5546('0x1')](util['format'](_0x5546('0x9'),_0x2893a5[_0x5546('0x4')],_0x2893a5[_0x5546('0xa')],_0x2893a5[_0x5546('0xb')]));if(_0x2893a5[_0x5546('0xa')][_0x5546('0xc')]()=='set'&&_['startsWith'](_0x2893a5[_0x5546('0xb')][_0x5546('0xc')](),_0x5546('0xd'))){var _0x4a0659=_0x2893a5['appdata'][_0x5546('0xe')]('=');dials[_0x2893a5[_0x5546('0x4')]]={'routeId':_0x4a0659[0x1]};}}catch(_0x143887){utils['error'](util[_0x5546('0x2')](_0x5546('0x8'),_0x2893a5[_0x5546('0x4')]),_0x143887);}};exports[_0x5546('0xf')]=function(_0x38af67){try{utils['debug'](util[_0x5546('0x2')](_0x5546('0x10'),_0x38af67[_0x5546('0x4')]),_0x38af67);if(!_[_0x5546('0x11')](_0x38af67[_0x5546('0x12')][_0x5546('0x13')])){utils[_0x5546('0x1')](util[_0x5546('0x2')](_0x5546('0x14'),_0x38af67['uniqueid'],_0x38af67[_0x5546('0x15')]));dials[_0x38af67[_0x5546('0x4')]]={'routeId':_0x38af67[_0x5546('0x15')]};}}catch(_0x3a9159){utils[_0x5546('0x16')](util[_0x5546('0x2')]('[%s][dials][varset]',_0x38af67[_0x5546('0x4')]),_0x3a9159);}};exports[_0x5546('0x17')]=function(_0x34995e){try{if(!_[_0x5546('0x11')](dials[_0x34995e[_0x5546('0x4')]])){utils[_0x5546('0x18')](util[_0x5546('0x2')](_0x5546('0x19'),_0x34995e[_0x5546('0x4')]),_0x34995e);dials[_0x34995e[_0x5546('0x4')]]=_[_0x5546('0x1a')](dials[_0x34995e[_0x5546('0x4')]],_0x34995e);dials[_0x34995e[_0x5546('0x4')]][_0x5546('0x1b')]=utils[_0x5546('0x1c')]();dials[_0x34995e[_0x5546('0x4')]][_0x5546('0x1d')]=_0x5546('0x1e');utils[_0x5546('0x1')](util['format'](_0x5546('0x1f'),_0x34995e[_0x5546('0x4')],dials[_0x34995e[_0x5546('0x4')]]['starttime']));}}catch(_0x5dd1fd){utils[_0x5546('0x16')](util[_0x5546('0x2')]('[%s][dials][dialbegin]',_0x34995e[_0x5546('0x4')]),_0x5dd1fd);}};exports[_0x5546('0x20')]=function(_0xc37e22){try{if(!_[_0x5546('0x11')](dials[_0xc37e22[_0x5546('0x4')]])){utils['debug'](util[_0x5546('0x2')](_0x5546('0x21'),_0xc37e22[_0x5546('0x4')]),_0xc37e22);dials[_0xc37e22[_0x5546('0x4')]][_0x5546('0x7')]=_0xc37e22['dialstatus'];if(_0xc37e22[_0x5546('0x7')]=='ANSWER'){dials[_0xc37e22[_0x5546('0x4')]]=_[_0x5546('0x1a')](dials[_0xc37e22[_0x5546('0x4')]],_0xc37e22);dials[_0xc37e22['uniqueid']][_0x5546('0x22')]=utils[_0x5546('0x1c')]();dials[_0xc37e22[_0x5546('0x4')]]['lastevent']=_0x5546('0x23');utils[_0x5546('0x1')](util[_0x5546('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0xc37e22['uniqueid'],_0xc37e22['dialstatus'],dials[_0xc37e22[_0x5546('0x4')]][_0x5546('0x22')]));}else{utils[_0x5546('0x1')](util[_0x5546('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0xc37e22['uniqueid'],_0xc37e22['dialstatus']));}}}catch(_0x1b56bc){utils[_0x5546('0x16')](util[_0x5546('0x2')]('[%s][dials][dialend]',_0xc37e22[_0x5546('0x4')]),_0x1b56bc);}};exports['hangup']=function(_0x28914a){try{if(!_[_0x5546('0x11')](dials[_0x28914a[_0x5546('0x4')]])){utils[_0x5546('0x18')](util[_0x5546('0x2')]('[%s][dials][hangup]',_0x28914a[_0x5546('0x4')]),_0x28914a);utils[_0x5546('0x1')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x28914a[_0x5546('0x4')],_0x28914a[_0x5546('0x24')],_0x28914a[_0x5546('0x25')],_0x28914a[_0x5546('0x26')]));dials[_0x28914a[_0x5546('0x4')]]=_[_0x5546('0x1a')](dials[_0x28914a[_0x5546('0x4')]],{'endtime':utils[_0x5546('0x1c')](),'lastevent':_0x5546('0x27')});dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x28')]=utils[_0x5546('0x29')](dials[_0x28914a[_0x5546('0x4')]]['endtime'],dials[_0x28914a[_0x5546('0x4')]]['starttime']);dials[_0x28914a[_0x5546('0x4')]]['holdtime']=utils[_0x5546('0x29')](dials[_0x28914a['uniqueid']][_0x5546('0x22')]||dials[_0x28914a[_0x5546('0x4')]]['endtime'],dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x1b')]);dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x2a')]=dials[_0x28914a[_0x5546('0x4')]]['answertime']?utils[_0x5546('0x29')](dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x2b')],dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x22')]):0x0;writeDB(dials[_0x28914a[_0x5546('0x4')]]);}}catch(_0x2ce0fa){utils[_0x5546('0x16')](util[_0x5546('0x2')](_0x5546('0x2c'),_0x28914a[_0x5546('0x4')]),_0x2ce0fa);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index d856f0f..ad42d0f 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 _0x7f99=['[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','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]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','util','xdr','disabled','env','production','local','asterisk','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer'];(function(_0x22dbc6,_0x47a0c1){var _0x29d561=function(_0x2c4ecc){while(--_0x2c4ecc){_0x22dbc6['push'](_0x22dbc6['shift']());}};_0x29d561(++_0x47a0c1);}(_0x7f99,0xfd));var _0x97f9=function(_0x5cd32e,_0x223795){_0x5cd32e=_0x5cd32e-0x0;var _0xfe4afc=_0x7f99[_0x5cd32e];return _0xfe4afc;};var AsteriskManager=require('asterisk-manager');var config=require(_0x97f9('0x0'));var utils=require('./utils');var util=require(_0x97f9('0x1'));var isXDREnabled=config[_0x97f9('0x2')]&&config[_0x97f9('0x2')][_0x97f9('0x3')]?!config[_0x97f9('0x2')][_0x97f9('0x3')]:!![];var isProduction=config[_0x97f9('0x4')]===_0x97f9('0x5')||![];var isLocalAsterisk=config[_0x97f9('0x2')]&&config[_0x97f9('0x2')][_0x97f9('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x97f9('0x7')]['port'],config['asterisk']['ip'],config['asterisk']['username'],config[_0x97f9('0x7')]['password'],!![]);ami[_0x97f9('0x8')]();if(!isXDREnabled){utils[_0x97f9('0x9')](_0x97f9('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x97f9('0x9')](_0x97f9('0xb'));}else{var agents=require(_0x97f9('0xc'));var calls=require(_0x97f9('0xd'));var queues=require(_0x97f9('0xe'));var recordings=require(_0x97f9('0xf'));var members=require(_0x97f9('0x10'));var dials=require(_0x97f9('0x11'));var transfers=require(_0x97f9('0x12'));var core=require(_0x97f9('0x13'));ami['on'](_0x97f9('0x14'),core['connect']);ami['on']('shutdown',core[_0x97f9('0x15')]);ami['on']('fullybooted',core[_0x97f9('0x16')]);ami['on']('error',core[_0x97f9('0x17')]);ami['on']('close',core[_0x97f9('0x18')]);ami['on'](_0x97f9('0x19'),core['managerevent']);ami['on'](_0x97f9('0x1a'),function(_0x2577c9){try{utils[_0x97f9('0x1b')](util[_0x97f9('0x1c')]('[%s][index][devicestatechange]',_0x2577c9[_0x97f9('0x1d')]),_0x2577c9);members[_0x97f9('0x1a')](_0x2577c9);}catch(_0x9c929){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x1e'),_0x2577c9[_0x97f9('0x1d')]),_0x9c929);}});ami['on'](_0x97f9('0x1f'),function(_0x36da50){try{utils[_0x97f9('0x1b')](util[_0x97f9('0x1c')](_0x97f9('0x20'),_0x36da50['uniqueid']),_0x36da50);agents['agentcalled'](_0x36da50);}catch(_0x14e6b8){utils[_0x97f9('0x17')](util['format'](_0x97f9('0x20'),_0x36da50[_0x97f9('0x21')]),_0x14e6b8);}});ami['on'](_0x97f9('0x22'),function(_0x2ddbb7){try{utils['debug'](util[_0x97f9('0x1c')]('[%s][index][agentringnoanswer]',_0x2ddbb7['uniqueid']),_0x2ddbb7);agents['agentringnoanswer'](_0x2ddbb7);}catch(_0x4faf6){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x23'),_0x2ddbb7[_0x97f9('0x21')]),_0x4faf6);}});ami['on'](_0x97f9('0x24'),function(_0x2e50b2){try{utils[_0x97f9('0x1b')](util['format']('[%s][index][agentconnect]',_0x2e50b2[_0x97f9('0x21')]),_0x2e50b2);agents[_0x97f9('0x24')](_0x2e50b2);queues[_0x97f9('0x24')](_0x2e50b2);}catch(_0xe20c20){utils[_0x97f9('0x17')](util['format'](_0x97f9('0x25'),_0x2e50b2[_0x97f9('0x21')]),_0xe20c20);}});ami['on'](_0x97f9('0x26'),function(_0x58918a){try{utils['debug'](util[_0x97f9('0x1c')](_0x97f9('0x27'),_0x58918a[_0x97f9('0x21')]),_0x58918a);agents[_0x97f9('0x26')](_0x58918a);queues[_0x97f9('0x26')](_0x58918a);members[_0x97f9('0x26')](_0x58918a);}catch(_0x519fab){utils['error'](util['format']('[%s][index][agentcomplete]',_0x58918a['uniqueid']),_0x519fab);}});ami['on'](_0x97f9('0x28'),function(_0x434c8b){try{utils[_0x97f9('0x1b')](util[_0x97f9('0x1c')](_0x97f9('0x29'),_0x434c8b[_0x97f9('0x21')]),_0x434c8b);agents[_0x97f9('0x28')](_0x434c8b);queues[_0x97f9('0x28')](_0x434c8b);}catch(_0x430fad){utils['error'](util[_0x97f9('0x1c')](_0x97f9('0x29'),_0x434c8b['uniqueid']),_0x430fad);}});ami['on'](_0x97f9('0x2a'),function(_0x3eba33){try{utils['debug'](util[_0x97f9('0x1c')](_0x97f9('0x2b'),_0x3eba33['uniqueid']),_0x3eba33);queues[_0x97f9('0x2a')](_0x3eba33);recordings['queuecallerjoin'](_0x3eba33);}catch(_0x1ad4aa){utils['error'](util[_0x97f9('0x1c')](_0x97f9('0x2b'),_0x3eba33['uniqueid']),_0x1ad4aa);}});ami['on'](_0x97f9('0x2c'),function(_0x3f6784){try{utils[_0x97f9('0x1b')](util[_0x97f9('0x1c')](_0x97f9('0x2d'),_0x3f6784[_0x97f9('0x21')]),_0x3f6784);queues[_0x97f9('0x2c')](_0x3f6784);}catch(_0x2cd8a5){utils[_0x97f9('0x17')](util['format'](_0x97f9('0x2d'),_0x3f6784[_0x97f9('0x21')]),_0x2cd8a5);}});ami['on']('musiconholdstart',function(_0x5bc6a1){try{utils['debug'](util['format'](_0x97f9('0x2e'),_0x5bc6a1['uniqueid']),_0x5bc6a1);queues[_0x97f9('0x2f')](_0x5bc6a1);calls[_0x97f9('0x2f')](_0x5bc6a1);}catch(_0x544010){utils[_0x97f9('0x17')](util['format']('[%s][index][musiconholdstart]',_0x5bc6a1[_0x97f9('0x21')]),_0x544010);}});ami['on'](_0x97f9('0x30'),function(_0x1391c1){try{utils[_0x97f9('0x1b')](util['format'](_0x97f9('0x31'),_0x1391c1[_0x97f9('0x21')]),_0x1391c1);queues[_0x97f9('0x30')](_0x1391c1);calls['musiconholdstop'](_0x1391c1);}catch(_0x5f3702){utils[_0x97f9('0x17')](util['format']('[%s][index][musiconholdstop]',_0x1391c1[_0x97f9('0x21')]),_0x5f3702);}});ami['on']('newstate',function(_0x48044d){try{utils[_0x97f9('0x1b')](util['format'](_0x97f9('0x32'),_0x48044d['uniqueid']),_0x48044d);calls[_0x97f9('0x33')](_0x48044d);recordings['newstate'](_0x48044d);}catch(_0x2c7449){utils[_0x97f9('0x17')](util['format'](_0x97f9('0x32'),_0x48044d[_0x97f9('0x21')]),_0x2c7449);}});ami['on']('hangup',function(_0x9df79d){try{utils[_0x97f9('0x1b')](util[_0x97f9('0x1c')]('[%s][index][hangup]',_0x9df79d['uniqueid']),_0x9df79d);calls[_0x97f9('0x34')](_0x9df79d);recordings['hangup'](_0x9df79d);dials['hangup'](_0x9df79d);agents[_0x97f9('0x34')](_0x9df79d);queues['hangup'](_0x9df79d);}catch(_0x46418b){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x35'),_0x9df79d[_0x97f9('0x21')]),_0x46418b);}});ami['on']('cdr',function(_0x30b3dd){try{utils[_0x97f9('0x1b')](util['format'](_0x97f9('0x36'),_0x30b3dd[_0x97f9('0x21')]),_0x30b3dd);members[_0x97f9('0x37')](_0x30b3dd);}catch(_0x33b8d2){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x36'),_0x30b3dd[_0x97f9('0x21')]),_0x33b8d2);}});ami['on'](_0x97f9('0x38'),function(_0x1bef12){try{utils[_0x97f9('0x1b')](util[_0x97f9('0x1c')](_0x97f9('0x39'),_0x1bef12[_0x97f9('0x21')]),_0x1bef12);queues[_0x97f9('0x38')](_0x1bef12);agents[_0x97f9('0x38')](_0x1bef12);transfers[_0x97f9('0x38')](_0x1bef12);recordings[_0x97f9('0x38')](_0x1bef12);}catch(_0x394d5c){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x39'),_0x1bef12['uniqueid']),_0x394d5c);}});ami['on'](_0x97f9('0x3a'),function(_0x35a2e9){try{utils[_0x97f9('0x1b')](util[_0x97f9('0x1c')](_0x97f9('0x3b'),_0x35a2e9[_0x97f9('0x3c')]),_0x35a2e9);queues[_0x97f9('0x3a')](_0x35a2e9);transfers[_0x97f9('0x3a')](_0x35a2e9);agents['attendedtransfer'](_0x35a2e9);calls['attendedtransfer'](_0x35a2e9);}catch(_0x277814){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x3b'),_0x35a2e9['origtransfereruniqueid']),_0x277814);}});ami['on'](_0x97f9('0x3d'),function(_0x363c19){try{utils['debug'](util[_0x97f9('0x1c')](_0x97f9('0x3e'),_0x363c19['uniqueid']),_0x363c19);queues[_0x97f9('0x3d')](_0x363c19);recordings['varset'](_0x363c19);calls[_0x97f9('0x3d')](_0x363c19);dials[_0x97f9('0x3d')](_0x363c19);}catch(_0x2aa747){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x3e'),_0x363c19['uniqueid']),_0x2aa747);}});ami['on'](_0x97f9('0x3f'),function(_0x1ae876){try{utils['debug'](util[_0x97f9('0x1c')](_0x97f9('0x40'),_0x1ae876[_0x97f9('0x21')]),_0x1ae876);calls[_0x97f9('0x3f')](_0x1ae876);recordings[_0x97f9('0x3f')](_0x1ae876);dials[_0x97f9('0x3f')](_0x1ae876);}catch(_0x2e9f91){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x40'),_0x1ae876['uniqueid']),_0x2e9f91);}});ami['on'](_0x97f9('0x41'),function(_0x1dc5cf){try{utils[_0x97f9('0x1b')](util['format'](_0x97f9('0x42'),_0x1dc5cf[_0x97f9('0x21')]),_0x1dc5cf);calls['newchannel'](_0x1dc5cf);recordings[_0x97f9('0x41')](_0x1dc5cf);}catch(_0x3d92bd){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x42'),_0x1dc5cf[_0x97f9('0x21')]),_0x3d92bd);}});ami['on']('dialbegin',function(_0x407179){try{utils[_0x97f9('0x1b')](util[_0x97f9('0x1c')](_0x97f9('0x43'),_0x407179['uniqueid']),_0x407179);dials[_0x97f9('0x44')](_0x407179);}catch(_0x114bb0){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x45'),_0x407179['uniqueid']),_0x114bb0);}});ami['on'](_0x97f9('0x46'),function(_0x41a6a1){try{utils[_0x97f9('0x1b')](util[_0x97f9('0x1c')](_0x97f9('0x47'),_0x41a6a1[_0x97f9('0x21')]),_0x41a6a1);dials[_0x97f9('0x46')](_0x41a6a1);}catch(_0x3fc1a2){utils[_0x97f9('0x17')](util[_0x97f9('0x1c')](_0x97f9('0x47'),_0x41a6a1[_0x97f9('0x21')]),_0x3fc1a2);}});} \ No newline at end of file +var _0x07f6=['dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x07f6,0x1b8));var _0x607f=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x07f6[_0x30bd66];return _0x74c9dd;};var AsteriskManager=require(_0x607f('0x0'));var config=require(_0x607f('0x1'));var utils=require(_0x607f('0x2'));var util=require(_0x607f('0x3'));var isXDREnabled=config[_0x607f('0x4')]&&config[_0x607f('0x4')][_0x607f('0x5')]?!config[_0x607f('0x4')][_0x607f('0x5')]:!![];var isProduction=config[_0x607f('0x6')]===_0x607f('0x7')||![];var isLocalAsterisk=config[_0x607f('0x4')]&&config[_0x607f('0x4')][_0x607f('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x607f('0x9')][_0x607f('0xa')],config['asterisk']['ip'],config[_0x607f('0x9')][_0x607f('0xb')],config['asterisk']['password'],!![]);ami[_0x607f('0xc')]();if(!isXDREnabled){utils[_0x607f('0xd')](_0x607f('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x607f('0xd')](_0x607f('0xf'));}else{var agents=require(_0x607f('0x10'));var calls=require(_0x607f('0x11'));var queues=require(_0x607f('0x12'));var recordings=require(_0x607f('0x13'));var members=require(_0x607f('0x14'));var dials=require(_0x607f('0x15'));var transfers=require(_0x607f('0x16'));var core=require('./core.controller');ami['on']('connect',core[_0x607f('0x17')]);ami['on'](_0x607f('0x18'),core['shutdown']);ami['on']('fullybooted',core[_0x607f('0x19')]);ami['on'](_0x607f('0x1a'),core[_0x607f('0x1a')]);ami['on'](_0x607f('0x1b'),core[_0x607f('0x1b')]);ami['on'](_0x607f('0x1c'),core['managerevent']);ami['on'](_0x607f('0x1d'),function(_0x5f293c){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x20'),_0x5f293c[_0x607f('0x21')]),_0x5f293c);members[_0x607f('0x1d')](_0x5f293c);}catch(_0x239367){utils['error'](util[_0x607f('0x1f')](_0x607f('0x20'),_0x5f293c[_0x607f('0x21')]),_0x239367);}});ami['on']('agentcalled',function(_0x503d92){try{utils['debug'](util[_0x607f('0x1f')]('[%s][index][agentcalled]',_0x503d92[_0x607f('0x22')]),_0x503d92);agents['agentcalled'](_0x503d92);}catch(_0x3b3884){utils['error'](util[_0x607f('0x1f')](_0x607f('0x23'),_0x503d92[_0x607f('0x22')]),_0x3b3884);}});ami['on'](_0x607f('0x24'),function(_0x448b0f){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x25'),_0x448b0f[_0x607f('0x22')]),_0x448b0f);agents['agentringnoanswer'](_0x448b0f);}catch(_0x4a4f5b){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x25'),_0x448b0f[_0x607f('0x22')]),_0x4a4f5b);}});ami['on']('agentconnect',function(_0x368c6e){try{utils['debug'](util[_0x607f('0x1f')]('[%s][index][agentconnect]',_0x368c6e[_0x607f('0x22')]),_0x368c6e);agents[_0x607f('0x26')](_0x368c6e);queues[_0x607f('0x26')](_0x368c6e);}catch(_0x556ff8){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x27'),_0x368c6e['uniqueid']),_0x556ff8);}});ami['on'](_0x607f('0x28'),function(_0x4d368c){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x29'),_0x4d368c[_0x607f('0x22')]),_0x4d368c);agents[_0x607f('0x28')](_0x4d368c);queues[_0x607f('0x28')](_0x4d368c);members[_0x607f('0x28')](_0x4d368c);}catch(_0x4d0474){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x29'),_0x4d368c['uniqueid']),_0x4d0474);}});ami['on'](_0x607f('0x2a'),function(_0x211d5a){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x2b'),_0x211d5a[_0x607f('0x22')]),_0x211d5a);agents[_0x607f('0x2a')](_0x211d5a);queues[_0x607f('0x2a')](_0x211d5a);}catch(_0xbd465a){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x2b'),_0x211d5a[_0x607f('0x22')]),_0xbd465a);}});ami['on']('queuecallerjoin',function(_0x43c75e){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')]('[%s][index][queuecallerjoin]',_0x43c75e['uniqueid']),_0x43c75e);queues[_0x607f('0x2c')](_0x43c75e);recordings[_0x607f('0x2c')](_0x43c75e);}catch(_0x1b907d){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x2d'),_0x43c75e['uniqueid']),_0x1b907d);}});ami['on']('queuecallerleave',function(_0x26f223){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x2e'),_0x26f223[_0x607f('0x22')]),_0x26f223);queues[_0x607f('0x2f')](_0x26f223);}catch(_0x58d754){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x2e'),_0x26f223[_0x607f('0x22')]),_0x58d754);}});ami['on'](_0x607f('0x30'),function(_0x4c1eec){try{utils['debug'](util[_0x607f('0x1f')](_0x607f('0x31'),_0x4c1eec[_0x607f('0x22')]),_0x4c1eec);queues['musiconholdstart'](_0x4c1eec);calls[_0x607f('0x30')](_0x4c1eec);}catch(_0x55b1f0){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x31'),_0x4c1eec[_0x607f('0x22')]),_0x55b1f0);}});ami['on'](_0x607f('0x32'),function(_0x1893fd){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')]('[%s][index][musiconholdstop]',_0x1893fd[_0x607f('0x22')]),_0x1893fd);queues['musiconholdstop'](_0x1893fd);calls['musiconholdstop'](_0x1893fd);}catch(_0x302df4){utils['error'](util[_0x607f('0x1f')](_0x607f('0x33'),_0x1893fd[_0x607f('0x22')]),_0x302df4);}});ami['on'](_0x607f('0x34'),function(_0x418323){try{utils[_0x607f('0x1e')](util['format']('[%s][index][newstate]',_0x418323['uniqueid']),_0x418323);calls[_0x607f('0x34')](_0x418323);recordings[_0x607f('0x34')](_0x418323);}catch(_0x57019b){utils['error'](util[_0x607f('0x1f')](_0x607f('0x35'),_0x418323['uniqueid']),_0x57019b);}});ami['on']('hangup',function(_0x41e106){try{utils['debug'](util['format'](_0x607f('0x36'),_0x41e106[_0x607f('0x22')]),_0x41e106);calls[_0x607f('0x37')](_0x41e106);recordings[_0x607f('0x37')](_0x41e106);dials[_0x607f('0x37')](_0x41e106);agents[_0x607f('0x37')](_0x41e106);queues[_0x607f('0x37')](_0x41e106);}catch(_0x4f9b90){utils[_0x607f('0x1a')](util['format'](_0x607f('0x36'),_0x41e106[_0x607f('0x22')]),_0x4f9b90);}});ami['on'](_0x607f('0x38'),function(_0x48c5bf){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x39'),_0x48c5bf[_0x607f('0x22')]),_0x48c5bf);members['cdr'](_0x48c5bf);}catch(_0x1c4c33){utils[_0x607f('0x1a')](util[_0x607f('0x1f')]('[%s][index][cdr]',_0x48c5bf[_0x607f('0x22')]),_0x1c4c33);}});ami['on'](_0x607f('0x3a'),function(_0x2d9bbc){try{utils[_0x607f('0x1e')](util['format'](_0x607f('0x3b'),_0x2d9bbc[_0x607f('0x22')]),_0x2d9bbc);queues[_0x607f('0x3a')](_0x2d9bbc);agents[_0x607f('0x3a')](_0x2d9bbc);transfers[_0x607f('0x3a')](_0x2d9bbc);recordings[_0x607f('0x3a')](_0x2d9bbc);}catch(_0x51fd07){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x3b'),_0x2d9bbc[_0x607f('0x22')]),_0x51fd07);}});ami['on']('attendedtransfer',function(_0x39a071){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x3c'),_0x39a071['origtransfereruniqueid']),_0x39a071);queues[_0x607f('0x3d')](_0x39a071);transfers[_0x607f('0x3d')](_0x39a071);agents[_0x607f('0x3d')](_0x39a071);calls[_0x607f('0x3d')](_0x39a071);}catch(_0x511b93){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x3c'),_0x39a071[_0x607f('0x3e')]),_0x511b93);}});ami['on'](_0x607f('0x3f'),function(_0xefe536){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x40'),_0xefe536[_0x607f('0x22')]),_0xefe536);queues[_0x607f('0x3f')](_0xefe536);recordings[_0x607f('0x3f')](_0xefe536);calls[_0x607f('0x3f')](_0xefe536);dials[_0x607f('0x3f')](_0xefe536);}catch(_0x31b414){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x40'),_0xefe536[_0x607f('0x22')]),_0x31b414);}});ami['on'](_0x607f('0x41'),function(_0x367e08){try{utils['debug'](util['format'](_0x607f('0x42'),_0x367e08['uniqueid']),_0x367e08);calls[_0x607f('0x41')](_0x367e08);recordings[_0x607f('0x41')](_0x367e08);dials['newexten'](_0x367e08);}catch(_0x30432f){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x42'),_0x367e08[_0x607f('0x22')]),_0x30432f);}});ami['on'](_0x607f('0x43'),function(_0x3864f4){try{utils['debug'](util['format'](_0x607f('0x44'),_0x3864f4[_0x607f('0x22')]),_0x3864f4);calls[_0x607f('0x43')](_0x3864f4);recordings[_0x607f('0x43')](_0x3864f4);}catch(_0x162bfb){utils[_0x607f('0x1a')](util[_0x607f('0x1f')]('[%s][index][newchannel]',_0x3864f4['uniqueid']),_0x162bfb);}});ami['on'](_0x607f('0x45'),function(_0x29fda1){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x46'),_0x29fda1[_0x607f('0x22')]),_0x29fda1);dials[_0x607f('0x45')](_0x29fda1);}catch(_0x2f9d55){utils['error'](util[_0x607f('0x1f')]('[%s]dialbegin',_0x29fda1['uniqueid']),_0x2f9d55);}});ami['on'](_0x607f('0x47'),function(_0x39c627){try{utils['debug'](util[_0x607f('0x1f')](_0x607f('0x48'),_0x39c627[_0x607f('0x22')]),_0x39c627);dials['dialend'](_0x39c627);}catch(_0x243403){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x48'),_0x39c627[_0x607f('0x22')]),_0x243403);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 61df520..b8f197f 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 _0x80c7=['some','startsWith','devicestatechange','format','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','error','agentcomplete','isNil','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','split','catch','[%s][members][writeDB]'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x80c7,0x8d));var _0x780c=function(_0x1f7bf0,_0x1c02b4){_0x1f7bf0=_0x1f7bf0-0x0;var _0xf0049c=_0x80c7[_0x1f7bf0];return _0xf0049c;};'use strict';var _=require(_0x780c('0x0'));var util=require(_0x780c('0x1'));var utils=require(_0x780c('0x2'));var members={};var exclude=[_0x780c('0x3'),'Queue:'];function writeDB(_0x5589b0){utils[_0x780c('0x4')](util['format'](_0x780c('0x5'),_0x5589b0[_0x780c('0x6')],_0x5589b0[_0x780c('0x7')],_0x5589b0[_0x780c('0x8')],_0x5589b0[_0x780c('0x9')],_0x5589b0[_0x780c('0xa')],_0x5589b0[_0x780c('0xb')]));if(_0x5589b0[_0x780c('0x7')]){utils[_0x780c('0xc')](_0x5589b0[_0x780c('0x7')])[_0x780c('0xd')](function(_0x54a4ed){if(_0x54a4ed){_0x5589b0[_0x780c('0xa')]=_0x54a4ed[_0x780c('0xe')];_0x5589b0['internal']=_0x54a4ed[_0x780c('0xf')];utils[_0x780c('0x10')](_0x780c('0x11'),_0x5589b0);}else{utils['getUserByName'](_0x5589b0[_0x780c('0x7')][_0x780c('0x12')]('/')[0x1])[_0x780c('0xd')](function(_0x24fe4e){if(_0x24fe4e){_0x5589b0[_0x780c('0xa')]=_0x24fe4e[_0x780c('0xe')];_0x5589b0[_0x780c('0xf')]=_0x24fe4e[_0x780c('0xf')];utils[_0x780c('0x10')](_0x780c('0x11'),_0x5589b0);}});}})[_0x780c('0x13')](function(_0x24dc45){utils['error'](util['format'](_0x780c('0x14'),_0x5589b0[_0x780c('0x6')]),_0x24dc45);});}delete members[_0x5589b0['interface']];}function startsWith(_0x5b74fb,_0x2c8c23){return _[_0x780c('0x15')](_0x5b74fb,function(_0x21b69b){return _[_0x780c('0x16')](_0x2c8c23,_0x21b69b);});}exports[_0x780c('0x17')]=function(_0x33c514){try{utils['debug'](util[_0x780c('0x18')](_0x780c('0x19'),members[_0x33c514[_0x780c('0x1a')]]?members[_0x33c514[_0x780c('0x1a')]]['uniqueid']:_0x33c514[_0x780c('0x1a')]),_0x33c514);utils[_0x780c('0x4')](util[_0x780c('0x18')](_0x780c('0x1b'),members[_0x33c514['device']]?members[_0x33c514[_0x780c('0x1a')]][_0x780c('0x6')]:_0x33c514['device'],_0x33c514['state'],_0x33c514['device']));switch(_0x33c514[_0x780c('0x1c')]){case _0x780c('0x1d'):case _0x780c('0x1e'):if(!startsWith(exclude,_0x33c514[_0x780c('0x1a')])){members[_0x33c514[_0x780c('0x1a')]]={'channel':_0x780c('0x1f'),'interface':_0x33c514[_0x780c('0x1a')],'type':_0x780c('0x20'),'enterAt':utils[_0x780c('0x21')](),'role':_0x780c('0x22')};}break;case _0x780c('0x23'):if(!_['isNil'](members[_0x33c514[_0x780c('0x1a')]])){members[_0x33c514[_0x780c('0x1a')]][_0x780c('0x24')]=utils['now']();members[_0x33c514[_0x780c('0x1a')]][_0x780c('0x25')]=utils[_0x780c('0x26')](members[_0x33c514[_0x780c('0x1a')]][_0x780c('0x24')],members[_0x33c514[_0x780c('0x1a')]]['enterAt']);if(members[_0x33c514[_0x780c('0x1a')]][_0x780c('0x6')]){writeDB(members[_0x33c514[_0x780c('0x1a')]]);}}break;default:break;}}catch(_0x56ca81){utils[_0x780c('0x27')](util[_0x780c('0x18')](_0x780c('0x19'),members[_0x33c514[_0x780c('0x1a')]]?members[_0x33c514[_0x780c('0x1a')]][_0x780c('0x6')]:_0x33c514[_0x780c('0x1a')]),_0x56ca81);}};exports[_0x780c('0x28')]=function(_0x2a19b1){try{if(!_[_0x780c('0x29')](members[_0x2a19b1[_0x780c('0x7')]])){utils[_0x780c('0x2a')](util[_0x780c('0x18')](_0x780c('0x2b'),_0x2a19b1['uniqueid']),_0x2a19b1);utils[_0x780c('0x4')](util[_0x780c('0x18')](_0x780c('0x2c'),_0x2a19b1[_0x780c('0x6')],_0x2a19b1[_0x780c('0x7')],_0x2a19b1[_0x780c('0x2d')]));members[_0x2a19b1['interface']]=_[_0x780c('0x2e')](members[_0x2a19b1[_0x780c('0x7')]],{'data4':_0x2a19b1[_0x780c('0x2d')],'uniqueid':_0x2a19b1[_0x780c('0x6')]});}}catch(_0x5c52ef){utils['error'](util[_0x780c('0x18')](_0x780c('0x2b'),_0x2a19b1['uniqueid']),_0x5c52ef);}};exports['cdr']=function(_0x57932b){try{utils[_0x780c('0x2a')](util[_0x780c('0x18')](_0x780c('0x2f'),_0x57932b['uniqueid']),_0x57932b);if(_0x57932b[_0x780c('0x8')]){var _0x483f75=_0x57932b['channel'][_0x780c('0x12')]('-')[0x0];if(!_[_0x780c('0x29')](members[_0x483f75])){members[_0x483f75]=_[_0x780c('0x2e')](members[_0x483f75],{'data1':members[_0x483f75][_0x780c('0x30')]||_0x57932b[_0x780c('0xb')],'data2':members[_0x483f75][_0x780c('0x9')]||_0x57932b['source'],'data3':members[_0x483f75][_0x780c('0x31')]||_0x57932b[_0x780c('0x32')],'uniqueid':members[_0x483f75]['uniqueid']||_0x57932b['uniqueid']});utils[_0x780c('0x4')](util[_0x780c('0x18')](_0x780c('0x33'),_0x57932b[_0x780c('0x6')],members[_0x483f75][_0x780c('0x30')],members[_0x483f75][_0x780c('0x9')],members[_0x483f75][_0x780c('0x31')]));if(members[_0x483f75][_0x780c('0x24')]){writeDB(members[_0x483f75]);}}}if(_0x57932b[_0x780c('0x34')]){var _0x2ea276=_0x57932b['destinationchannel'][_0x780c('0x12')]('-')[0x0];if(!_[_0x780c('0x29')](members[_0x2ea276])){members[_0x2ea276]=_['assign'](members[_0x2ea276],{'data1':members[_0x2ea276][_0x780c('0x30')]||_0x57932b[_0x780c('0xb')],'data2':members[_0x2ea276]['data2']||_0x57932b[_0x780c('0x35')],'data3':members[_0x2ea276]['data3']||_0x57932b[_0x780c('0x32')],'uniqueid':members[_0x2ea276][_0x780c('0x6')]||_0x57932b[_0x780c('0x6')]});utils['info'](util['format'](_0x780c('0x33'),_0x57932b[_0x780c('0x6')],members[_0x2ea276][_0x780c('0x30')],members[_0x2ea276][_0x780c('0x9')],members[_0x2ea276][_0x780c('0x31')]));if(members[_0x2ea276][_0x780c('0x24')]){writeDB(members[_0x2ea276]);}}}}catch(_0x35631a){utils[_0x780c('0x27')](util['format'](_0x780c('0x2f'),_0x57932b[_0x780c('0x6')]),_0x35631a);}}; \ No newline at end of file +var _0x3f91=['source','data2','data3','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','membername','name','internal','CreateMemberReport','getUserByName','request','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3f91,0x99));var _0x13f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f91[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x13f9('0x0'));var members={};var exclude=[_0x13f9('0x1'),_0x13f9('0x2')];function writeDB(_0x4baca5){utils[_0x13f9('0x3')](util[_0x13f9('0x4')](_0x13f9('0x5'),_0x4baca5[_0x13f9('0x6')],_0x4baca5[_0x13f9('0x7')],_0x4baca5[_0x13f9('0x8')],_0x4baca5['data2'],_0x4baca5['membername'],_0x4baca5[_0x13f9('0x9')]));if(_0x4baca5[_0x13f9('0x7')]){utils[_0x13f9('0xa')](_0x4baca5[_0x13f9('0x7')])[_0x13f9('0xb')](function(_0x3f009a){if(_0x3f009a){_0x4baca5[_0x13f9('0xc')]=_0x3f009a[_0x13f9('0xd')];_0x4baca5[_0x13f9('0xe')]=_0x3f009a[_0x13f9('0xe')];utils['request'](_0x13f9('0xf'),_0x4baca5);}else{utils[_0x13f9('0x10')](_0x4baca5[_0x13f9('0x7')]['split']('/')[0x1])[_0x13f9('0xb')](function(_0x492c44){if(_0x492c44){_0x4baca5[_0x13f9('0xc')]=_0x492c44['name'];_0x4baca5[_0x13f9('0xe')]=_0x492c44[_0x13f9('0xe')];utils[_0x13f9('0x11')]('CreateMemberReport',_0x4baca5);}});}})[_0x13f9('0x12')](function(_0x1df23d){utils[_0x13f9('0x13')](util[_0x13f9('0x4')](_0x13f9('0x14'),_0x4baca5['uniqueid']),_0x1df23d);});}delete members[_0x4baca5['interface']];}function startsWith(_0x410b57,_0x103e32){return _[_0x13f9('0x15')](_0x410b57,function(_0x3783c5){return _['startsWith'](_0x103e32,_0x3783c5);});}exports['devicestatechange']=function(_0x1faeec){try{utils[_0x13f9('0x16')](util[_0x13f9('0x4')](_0x13f9('0x17'),members[_0x1faeec[_0x13f9('0x18')]]?members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x6')]:_0x1faeec[_0x13f9('0x18')]),_0x1faeec);utils['info'](util['format'](_0x13f9('0x19'),members[_0x1faeec[_0x13f9('0x18')]]?members[_0x1faeec['device']][_0x13f9('0x6')]:_0x1faeec[_0x13f9('0x18')],_0x1faeec[_0x13f9('0x1a')],_0x1faeec['device']));switch(_0x1faeec[_0x13f9('0x1a')]){case'INUSE':case _0x13f9('0x1b'):if(!startsWith(exclude,_0x1faeec[_0x13f9('0x18')])){members[_0x1faeec['device']]={'channel':_0x13f9('0x1c'),'interface':_0x1faeec['device'],'type':_0x13f9('0x1d'),'enterAt':utils[_0x13f9('0x1e')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x13f9('0x1f')](members[_0x1faeec['device']])){members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x20')]=utils[_0x13f9('0x1e')]();members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x21')]=utils[_0x13f9('0x22')](members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x20')],members[_0x1faeec[_0x13f9('0x18')]]['enterAt']);if(members[_0x1faeec['device']][_0x13f9('0x6')]){writeDB(members[_0x1faeec[_0x13f9('0x18')]]);}}break;default:break;}}catch(_0x256ffd){utils[_0x13f9('0x13')](util[_0x13f9('0x4')](_0x13f9('0x17'),members[_0x1faeec[_0x13f9('0x18')]]?members[_0x1faeec[_0x13f9('0x18')]]['uniqueid']:_0x1faeec[_0x13f9('0x18')]),_0x256ffd);}};exports[_0x13f9('0x23')]=function(_0x3f03e7){try{if(!_['isNil'](members[_0x3f03e7[_0x13f9('0x7')]])){utils[_0x13f9('0x16')](util['format']('[%s][members][agentcomplete]',_0x3f03e7['uniqueid']),_0x3f03e7);utils[_0x13f9('0x3')](util[_0x13f9('0x4')](_0x13f9('0x24'),_0x3f03e7[_0x13f9('0x6')],_0x3f03e7[_0x13f9('0x7')],_0x3f03e7[_0x13f9('0x25')]));members[_0x3f03e7[_0x13f9('0x7')]]=_[_0x13f9('0x26')](members[_0x3f03e7[_0x13f9('0x7')]],{'data4':_0x3f03e7[_0x13f9('0x25')],'uniqueid':_0x3f03e7['uniqueid']});}}catch(_0x33026f){utils[_0x13f9('0x13')](util[_0x13f9('0x4')](_0x13f9('0x27'),_0x3f03e7[_0x13f9('0x6')]),_0x33026f);}};exports[_0x13f9('0x28')]=function(_0xb14908){try{utils[_0x13f9('0x16')](util[_0x13f9('0x4')](_0x13f9('0x29'),_0xb14908['uniqueid']),_0xb14908);if(_0xb14908[_0x13f9('0x8')]){var _0x25d696=_0xb14908[_0x13f9('0x8')]['split']('-')[0x0];if(!_['isNil'](members[_0x25d696])){members[_0x25d696]=_[_0x13f9('0x26')](members[_0x25d696],{'data1':members[_0x25d696][_0x13f9('0x2a')]||_0xb14908['type'],'data2':members[_0x25d696]['data2']||_0xb14908[_0x13f9('0x2b')],'data3':members[_0x25d696]['data3']||_0xb14908['destination'],'uniqueid':members[_0x25d696][_0x13f9('0x6')]||_0xb14908[_0x13f9('0x6')]});utils[_0x13f9('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xb14908[_0x13f9('0x6')],members[_0x25d696][_0x13f9('0x2a')],members[_0x25d696][_0x13f9('0x2c')],members[_0x25d696][_0x13f9('0x2d')]));if(members[_0x25d696][_0x13f9('0x20')]){writeDB(members[_0x25d696]);}}}if(_0xb14908[_0x13f9('0x2e')]){var _0x4b5a1a=_0xb14908[_0x13f9('0x2e')]['split']('-')[0x0];if(!_[_0x13f9('0x1f')](members[_0x4b5a1a])){members[_0x4b5a1a]=_['assign'](members[_0x4b5a1a],{'data1':members[_0x4b5a1a][_0x13f9('0x2a')]||_0xb14908[_0x13f9('0x9')],'data2':members[_0x4b5a1a][_0x13f9('0x2c')]||_0xb14908[_0x13f9('0x2b')],'data3':members[_0x4b5a1a][_0x13f9('0x2d')]||_0xb14908[_0x13f9('0x2f')],'uniqueid':members[_0x4b5a1a]['uniqueid']||_0xb14908['uniqueid']});utils[_0x13f9('0x3')](util[_0x13f9('0x4')](_0x13f9('0x30'),_0xb14908[_0x13f9('0x6')],members[_0x4b5a1a][_0x13f9('0x2a')],members[_0x4b5a1a][_0x13f9('0x2c')],members[_0x4b5a1a]['data3']));if(members[_0x4b5a1a][_0x13f9('0x20')]){writeDB(members[_0x4b5a1a]);}}}}catch(_0x1901e6){utils['error'](util[_0x13f9('0x4')](_0x13f9('0x29'),_0xb14908[_0x13f9('0x6')]),_0x1901e6);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 3ac9bbb..8dcf739 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 _0xd9c9=['secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','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','queue','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','variable','queuestatus','CONTINUE','queuecallerabandonAt','value','toUpperCase','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','assigned','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerleaveAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid'];(function(_0x410194,_0x235ccc){var _0x1724fa=function(_0x25ec64){while(--_0x25ec64){_0x410194['push'](_0x410194['shift']());}};_0x1724fa(++_0x235ccc);}(_0xd9c9,0x6f));var _0x9d9c=function(_0x1c0e91,_0xd8625e){_0x1c0e91=_0x1c0e91-0x0;var _0x34322c=_0xd9c9[_0x1c0e91];return _0x34322c;};'use strict';var _=require(_0x9d9c('0x0'));var util=require(_0x9d9c('0x1'));var utils=require(_0x9d9c('0x2'));var queues={};function writeDB(_0x1e3861){utils['info'](util['format'](_0x9d9c('0x3'),_0x1e3861[_0x9d9c('0x4')],_0x1e3861['channel'],_0x1e3861[_0x9d9c('0x5')],_0x1e3861['lastAssignedTo'],_0x1e3861['calleridnum'],_0x1e3861[_0x9d9c('0x6')],_0x1e3861[_0x9d9c('0x7')]));if(_0x1e3861[_0x9d9c('0x5')]){utils[_0x9d9c('0x8')](_0x1e3861[_0x9d9c('0x5')])[_0x9d9c('0x9')](function(_0x3492ee){if(_0x3492ee){_0x1e3861[_0x9d9c('0xa')]=_0x3492ee[_0x9d9c('0xa')];}utils[_0x9d9c('0xb')](_0x9d9c('0xc'),_0x1e3861);});}else{utils[_0x9d9c('0xb')](_0x9d9c('0xc'),_0x1e3861);}if(_0x1e3861[_0x9d9c('0xd')]){delete queues[_0x1e3861[_0x9d9c('0xd')]];}else{delete queues[_0x1e3861['uniqueid']];}}exports[_0x9d9c('0xe')]=function(_0x531806){try{utils[_0x9d9c('0xf')](util['format'](_0x9d9c('0x10'),_0x531806[_0x9d9c('0x4')]),_0x531806);utils[_0x9d9c('0x11')](util[_0x9d9c('0x12')](_0x9d9c('0x13'),_0x531806[_0x9d9c('0x4')],_0x531806['queue'],_0x531806[_0x9d9c('0x14')]));queues[_0x531806[_0x9d9c('0x4')]]=_[_0x9d9c('0x15')](_0x531806,{'originalposition':_0x531806[_0x9d9c('0x14')],'queuecallerjoinAt':utils[_0x9d9c('0x16')](),'mohtime':0x0});}catch(_0x4ab5f3){utils[_0x9d9c('0x17')](util[_0x9d9c('0x12')](_0x9d9c('0x10'),_0x531806[_0x9d9c('0x4')]),_0x4ab5f3);}};exports['hangup']=function(_0x40c2ab){try{if(!_[_0x9d9c('0x18')](queues[_0x40c2ab['uniqueid']])){utils[_0x9d9c('0xf')](util['format']('[%s][queues][hangup]',_0x40c2ab[_0x9d9c('0x4')]),_0x40c2ab);if(queues[_0x40c2ab['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x40c2ab[_0x9d9c('0x4')]][_0x9d9c('0x19')]&&!queues[_0x40c2ab[_0x9d9c('0x4')]][_0x9d9c('0x1a')]){queues[_0x40c2ab[_0x9d9c('0x4')]][_0x9d9c('0x1b')]=!![];queues[_0x40c2ab['uniqueid']][_0x9d9c('0x1c')]=utils[_0x9d9c('0x16')]();queues[_0x40c2ab[_0x9d9c('0x4')]][_0x9d9c('0x7')]=_0x9d9c('0x1d');}utils['info'](util[_0x9d9c('0x12')](_0x9d9c('0x1e'),_0x40c2ab[_0x9d9c('0x4')],queues[_0x40c2ab[_0x9d9c('0x4')]][_0x9d9c('0x1f')],queues[_0x40c2ab[_0x9d9c('0x4')]][_0x9d9c('0x7')]));writeDB(queues[_0x40c2ab[_0x9d9c('0x4')]]);}else if(queues[_0x40c2ab[_0x9d9c('0x4')]][_0x9d9c('0xd')]){utils[_0x9d9c('0x11')](util[_0x9d9c('0x12')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x40c2ab[_0x9d9c('0x4')],queues[_0x40c2ab[_0x9d9c('0x4')]]['name'],queues[_0x40c2ab['uniqueid']][_0x9d9c('0xd')]));queues[queues[_0x40c2ab[_0x9d9c('0x4')]][_0x9d9c('0xd')]]=queues[_0x40c2ab[_0x9d9c('0x4')]];queues[queues[_0x40c2ab[_0x9d9c('0x4')]][_0x9d9c('0xd')]][_0x9d9c('0x20')]=0x2;delete queues[_0x40c2ab[_0x9d9c('0x4')]];}}}catch(_0x27ef6a){utils['error'](util[_0x9d9c('0x12')](_0x9d9c('0x21'),_0x40c2ab['uniqueid']),_0x27ef6a);}};exports[_0x9d9c('0x22')]=function(_0x4f6ac2){try{utils['debug'](util[_0x9d9c('0x12')]('[%s][queues][varset]',_0x4f6ac2[_0x9d9c('0x4')]),_0x4f6ac2);if(!_['isNil'](_0x4f6ac2[_0x9d9c('0x23')][_0x9d9c('0x24')])&&_0x4f6ac2['value']['toUpperCase']()!==_0x9d9c('0x25')){if(!_[_0x9d9c('0x18')](queues[_0x4f6ac2[_0x9d9c('0x4')]])){queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x19')]=![];queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x26')]=null;queues[_0x4f6ac2[_0x9d9c('0x4')]]['queuecallerexit']=!![];queues[_0x4f6ac2[_0x9d9c('0x4')]]['queuecallerexitAt']=utils[_0x9d9c('0x16')]();queues[_0x4f6ac2['uniqueid']]['queuecallerexitreason']=_0x4f6ac2[_0x9d9c('0x27')][_0x9d9c('0x28')]();utils['info'](util[_0x9d9c('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4f6ac2['uniqueid'],queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x1f')],_0x4f6ac2[_0x9d9c('0x27')],queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x7')]));writeDB(queues[_0x4f6ac2['uniqueid']]);}}else if(!_[_0x9d9c('0x18')](_0x4f6ac2[_0x9d9c('0x23')][_0x9d9c('0x29')])){if(!_['isNil'](queues[_0x4f6ac2[_0x9d9c('0x4')]])&&!queues[_0x4f6ac2[_0x9d9c('0x4')]]['queuecallerabandon']){queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x19')]=![];queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x26')]=null;queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x1a')]=!![];queues[_0x4f6ac2['uniqueid']][_0x9d9c('0x2a')]=utils[_0x9d9c('0x16')]();queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x7')]=_0x9d9c('0x2b');utils[_0x9d9c('0x11')](util[_0x9d9c('0x12')](_0x9d9c('0x2c'),_0x4f6ac2[_0x9d9c('0x4')],queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x1f')],_0x4f6ac2[_0x9d9c('0x27')],queues[_0x4f6ac2[_0x9d9c('0x4')]][_0x9d9c('0x7')]));}}}catch(_0x4b7085){utils[_0x9d9c('0x17')](util[_0x9d9c('0x12')]('[%s][queues][varset]',_0x4f6ac2[_0x9d9c('0x4')]),_0x4b7085);}};exports['queuecallerabandon']=function(_0x5ea84a){try{if(!_[_0x9d9c('0x18')](queues[_0x5ea84a[_0x9d9c('0x4')]])){utils[_0x9d9c('0xf')](util[_0x9d9c('0x12')](_0x9d9c('0x2d'),_0x5ea84a[_0x9d9c('0x4')]),_0x5ea84a);queues[_0x5ea84a[_0x9d9c('0x4')]][_0x9d9c('0x1a')]=![];queues[_0x5ea84a[_0x9d9c('0x4')]][_0x9d9c('0x2a')]=null;queues[_0x5ea84a[_0x9d9c('0x4')]]['queuecallerabandon']=!![];queues[_0x5ea84a['uniqueid']][_0x9d9c('0x26')]=utils[_0x9d9c('0x16')]();queues[_0x5ea84a[_0x9d9c('0x4')]]['queuecallerexitreason']=_0x9d9c('0x2e');utils[_0x9d9c('0x11')](util[_0x9d9c('0x12')](_0x9d9c('0x2f'),_0x5ea84a[_0x9d9c('0x4')],queues[_0x5ea84a[_0x9d9c('0x4')]][_0x9d9c('0x1f')],queues[_0x5ea84a[_0x9d9c('0x4')]][_0x9d9c('0x7')]));}}catch(_0x4b3556){utils[_0x9d9c('0x17')](util['format'](_0x9d9c('0x2d'),_0x5ea84a[_0x9d9c('0x4')]),_0x4b3556);}};exports[_0x9d9c('0x30')]=function(_0x591281){try{if(!_[_0x9d9c('0x18')](queues[_0x591281[_0x9d9c('0x4')]])){utils[_0x9d9c('0xf')](util[_0x9d9c('0x12')](_0x9d9c('0x31'),_0x591281[_0x9d9c('0x4')]),_0x591281);utils[_0x9d9c('0x11')](util[_0x9d9c('0x12')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x591281[_0x9d9c('0x4')],queues[_0x591281[_0x9d9c('0x4')]]['name'],_0x591281[_0x9d9c('0x32')],_0x591281[_0x9d9c('0x33')]));queues[_0x591281['uniqueid']][_0x9d9c('0x30')]=!![];queues[_0x591281[_0x9d9c('0x4')]]['queuecallerleaveAt']=utils[_0x9d9c('0x16')]();queues[_0x591281['uniqueid']][_0x9d9c('0x34')]=utils[_0x9d9c('0x35')](queues[_0x591281[_0x9d9c('0x4')]]['queuecallerleaveAt'],queues[_0x591281[_0x9d9c('0x4')]][_0x9d9c('0x36')]);queues[_0x591281[_0x9d9c('0x4')]]['position']=_0x591281[_0x9d9c('0x14')];queues[_0x591281[_0x9d9c('0x4')]][_0x9d9c('0x37')]=_0x591281['count'];queues[_0x591281[_0x9d9c('0x4')]][_0x9d9c('0x32')]=_0x591281['connectedlinenum'];queues[_0x591281[_0x9d9c('0x4')]][_0x9d9c('0x33')]=_0x591281[_0x9d9c('0x33')];}}catch(_0x2e3313){utils[_0x9d9c('0x17')](util[_0x9d9c('0x12')](_0x9d9c('0x31'),_0x591281[_0x9d9c('0x4')]),_0x2e3313);}};exports[_0x9d9c('0x38')]=function(_0x7e664f){try{if(!_[_0x9d9c('0x18')](queues[_0x7e664f[_0x9d9c('0x4')]])){utils[_0x9d9c('0xf')](util[_0x9d9c('0x12')](_0x9d9c('0x39'),_0x7e664f[_0x9d9c('0x4')]),_0x7e664f);utils[_0x9d9c('0x11')](util[_0x9d9c('0x12')](_0x9d9c('0x3a'),_0x7e664f[_0x9d9c('0x4')],queues[_0x7e664f[_0x9d9c('0x4')]][_0x9d9c('0x1f')],_0x7e664f[_0x9d9c('0x3b')],_0x7e664f[_0x9d9c('0x3c')]));queues[_0x7e664f[_0x9d9c('0x4')]][_0x9d9c('0x19')]=![];queues[_0x7e664f['uniqueid']][_0x9d9c('0x19')]=![];queues[_0x7e664f[_0x9d9c('0x4')]][_0x9d9c('0x26')]=null;queues[_0x7e664f[_0x9d9c('0x4')]][_0x9d9c('0x1a')]=![];queues[_0x7e664f['uniqueid']][_0x9d9c('0x7')]=null;queues[_0x7e664f['uniqueid']][_0x9d9c('0x2a')]=null;queues[_0x7e664f[_0x9d9c('0x4')]]['assigned']=!![];queues[_0x7e664f['uniqueid']][_0x9d9c('0x6')]=_0x7e664f['destaccountcode'];queues[_0x7e664f[_0x9d9c('0x4')]][_0x9d9c('0x3d')]=_0x7e664f[_0x9d9c('0x3b')];}}catch(_0x47c04a){utils[_0x9d9c('0x17')](util[_0x9d9c('0x12')](_0x9d9c('0x39'),_0x7e664f[_0x9d9c('0x4')]),_0x47c04a);}};exports[_0x9d9c('0x3e')]=function(_0x98f522){try{if(!_['isNil'](queues[_0x98f522[_0x9d9c('0x4')]])){if(queues[_0x98f522[_0x9d9c('0x4')]]['queuecallerleaveAt']){utils[_0x9d9c('0xf')](util[_0x9d9c('0x12')]('[%s][queues][agentcomplete]',_0x98f522[_0x9d9c('0x4')]),_0x98f522);queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x19')]=![];queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x19')]=![];queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x26')]=null;queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x1a')]=![];queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x2a')]=null;queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x3f')]=!![];queues[_0x98f522[_0x9d9c('0x4')]]['lastAssignedTo']=_0x98f522['membername'];queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x1b')]=!![];queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x1c')]=utils[_0x9d9c('0x16')]();if(_0x98f522[_0x9d9c('0x40')]=='transfer'){if(!queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x41')]){queues[_0x98f522['uniqueid']][_0x9d9c('0x7')]=_0x9d9c('0x42');}}else{queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x7')]='COMPLETEDBY'+_0x98f522[_0x9d9c('0x40')]['toUpperCase']();}utils['info'](util['format'](_0x9d9c('0x43'),_0x98f522[_0x9d9c('0x4')],queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x1f')],_0x98f522[_0x9d9c('0x3b')],queues[_0x98f522[_0x9d9c('0x4')]][_0x9d9c('0x7')]));writeDB(queues[_0x98f522[_0x9d9c('0x4')]]);}}}catch(_0x5b5908){utils[_0x9d9c('0x17')](util['format'](_0x9d9c('0x44'),_0x98f522['uniqueid']),_0x5b5908);}};exports['blindtransfer']=function(_0x4ee947){try{if(!_[_0x9d9c('0x18')](queues[_0x4ee947['transfereeuniqueid']])){utils[_0x9d9c('0xf')](util['format'](_0x9d9c('0x45'),_0x4ee947[_0x9d9c('0x4')]),_0x4ee947);queues[_0x4ee947[_0x9d9c('0x46')]][_0x9d9c('0x41')]=!![];queues[_0x4ee947['transfereeuniqueid']][_0x9d9c('0x47')]=_0x9d9c('0x48');queues[_0x4ee947['transfereeuniqueid']]['transferexten']=_0x4ee947[_0x9d9c('0x49')];queues[_0x4ee947[_0x9d9c('0x46')]]['transferuniqueid']=_0x4ee947['transfereeuniqueid'];queues[_0x4ee947[_0x9d9c('0x46')]][_0x9d9c('0x7')]='BLINDTRANSFER';utils['info'](util[_0x9d9c('0x12')](_0x9d9c('0x4a'),_0x4ee947[_0x9d9c('0x4')],queues[_0x4ee947[_0x9d9c('0x46')]][_0x9d9c('0x1f')],_0x4ee947[_0x9d9c('0x46')],_0x4ee947['extension']));}}catch(_0x5a332e){utils[_0x9d9c('0x17')](util['format']('[%s][queues][blindtransfer]',_0x4ee947['uniqueid']),_0x5a332e);}};exports[_0x9d9c('0x4b')]=function(_0x4c7776){try{utils[_0x9d9c('0xf')](util[_0x9d9c('0x12')](_0x9d9c('0x4c'),_0x4c7776['origtransfereruniqueid']),_0x4c7776);if(_0x4c7776[_0x9d9c('0x4d')]==_0x4c7776['origtransfererlinkedid']){if(!_[_0x9d9c('0x18')](queues[_0x4c7776[_0x9d9c('0x4e')]])){utils['info'](util['format'](_0x9d9c('0x4f'),_0x4c7776['origtransfereruniqueid'],queues[_0x4c7776[_0x9d9c('0x4e')]][_0x9d9c('0x1f')],_0x4c7776['origtransfererexten']));queues[_0x4c7776[_0x9d9c('0x4e')]]['transfer']=!![];queues[_0x4c7776[_0x9d9c('0x4e')]][_0x9d9c('0x47')]=_0x9d9c('0x50');queues[_0x4c7776[_0x9d9c('0x4e')]][_0x9d9c('0x51')]=_0x4c7776[_0x9d9c('0x52')];queues[_0x4c7776[_0x9d9c('0x4e')]]['transferuniqueid']=_0x4c7776['origtransfereruniqueid'];queues[_0x4c7776['secondtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x9d9c('0x18')](queues[_0x4c7776['origtransfererlinkedid']])){if(_0x4c7776[_0x9d9c('0x53')]&&queues[_0x4c7776['transfereelinkedid']]){queues[_0x4c7776[_0x9d9c('0x53')]][_0x9d9c('0x20')]=0x1;queues[_0x4c7776['transfereeuniqueid']]=_[_0x9d9c('0x54')](queues[_0x4c7776['transfereelinkedid']]);queues[_0x4c7776[_0x9d9c('0x46')]][_0x9d9c('0xd')]=_0x4c7776[_0x9d9c('0x55')];queues[_0x4c7776[_0x9d9c('0x46')]][_0x9d9c('0x20')]=0x2;queues[_0x4c7776[_0x9d9c('0x46')]][_0x9d9c('0x56')]=queues[_0x4c7776[_0x9d9c('0x4e')]][_0x9d9c('0x56')];queues[_0x4c7776[_0x9d9c('0x46')]]['calleridname']=queues[_0x4c7776[_0x9d9c('0x4e')]][_0x9d9c('0x57')];queues[_0x4c7776[_0x9d9c('0x46')]][_0x9d9c('0x36')]=utils['now']();queues[_0x4c7776['transfereeuniqueid']][_0x9d9c('0x58')]=utils[_0x9d9c('0x16')]();queues[_0x4c7776[_0x9d9c('0x46')]][_0x9d9c('0x34')]=0x0;queues[_0x4c7776[_0x9d9c('0x46')]][_0x9d9c('0x59')]=0x0;utils['info'](util[_0x9d9c('0x12')](_0x9d9c('0x5a'),_0x4c7776['origtransfereruniqueid'],queues[_0x4c7776[_0x9d9c('0x46')]][_0x9d9c('0x1f')],queues[_0x4c7776['transfereeuniqueid']][_0x9d9c('0x56')],queues[_0x4c7776[_0x9d9c('0x46')]][_0x9d9c('0x57')]));}else{utils['info'](util[_0x9d9c('0x12')](_0x9d9c('0x5b'),_0x4c7776['origtransfereruniqueid'],queues[_0x4c7776[_0x9d9c('0x5c')]]['name'],_0x4c7776[_0x9d9c('0x4e')]));queues[_0x4c7776[_0x9d9c('0x5c')]][_0x9d9c('0xd')]=_0x4c7776[_0x9d9c('0x4e')];}}}else if(_0x4c7776[_0x9d9c('0x5d')]==_0x4c7776[_0x9d9c('0x4e')]){if(!_['isNil'](queues[_0x4c7776[_0x9d9c('0x5c')]])){utils['info'](util[_0x9d9c('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4c7776[_0x9d9c('0x4d')],queues[_0x4c7776[_0x9d9c('0x5c')]][_0x9d9c('0x1f')],_0x4c7776[_0x9d9c('0x5d')],_0x4c7776[_0x9d9c('0x5e')]));queues[_0x4c7776[_0x9d9c('0x5c')]][_0x9d9c('0x41')]=!![];queues[_0x4c7776['origtransfererlinkedid']][_0x9d9c('0x47')]=_0x9d9c('0x50');queues[_0x4c7776[_0x9d9c('0x5c')]][_0x9d9c('0x51')]=_0x4c7776[_0x9d9c('0x5e')];queues[_0x4c7776[_0x9d9c('0x5c')]]['transferuniqueid']=_0x4c7776[_0x9d9c('0x5d')];queues[_0x4c7776[_0x9d9c('0x5c')]][_0x9d9c('0x7')]=_0x9d9c('0x5f');}if(!_[_0x9d9c('0x18')](queues[_0x4c7776[_0x9d9c('0x4e')]])){if(_0x4c7776['transfertargetlinkedid']&&queues[_0x4c7776[_0x9d9c('0x60')]]){queues[_0x4c7776[_0x9d9c('0x60')]][_0x9d9c('0x20')]=0x1;queues[_0x4c7776[_0x9d9c('0x55')]]=_['clone'](queues[_0x4c7776[_0x9d9c('0x60')]]);queues[_0x4c7776[_0x9d9c('0x55')]]['transfereduniqueid']=_0x4c7776[_0x9d9c('0x55')];queues[_0x4c7776[_0x9d9c('0x55')]][_0x9d9c('0x20')]=0x2;queues[_0x4c7776[_0x9d9c('0x55')]][_0x9d9c('0x56')]=queues[_0x4c7776[_0x9d9c('0x5c')]]['calleridnum'];queues[_0x4c7776['transfertargetuniqueid']][_0x9d9c('0x57')]=queues[_0x4c7776[_0x9d9c('0x5c')]][_0x9d9c('0x57')];queues[_0x4c7776[_0x9d9c('0x55')]][_0x9d9c('0x36')]=utils[_0x9d9c('0x16')]();queues[_0x4c7776[_0x9d9c('0x55')]][_0x9d9c('0x58')]=utils[_0x9d9c('0x16')]();queues[_0x4c7776[_0x9d9c('0x55')]][_0x9d9c('0x34')]=0x0;queues[_0x4c7776['transfertargetuniqueid']][_0x9d9c('0x59')]=0x0;utils[_0x9d9c('0x11')](util[_0x9d9c('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x4c7776['origtransfereruniqueid'],queues[_0x4c7776[_0x9d9c('0x55')]][_0x9d9c('0x1f')],queues[_0x4c7776[_0x9d9c('0x55')]][_0x9d9c('0xd')],queues[_0x4c7776[_0x9d9c('0x55')]][_0x9d9c('0x56')],queues[_0x4c7776[_0x9d9c('0x55')]]['calleridname']));}else{utils['info'](util[_0x9d9c('0x12')](_0x9d9c('0x5b'),_0x4c7776[_0x9d9c('0x4d')],queues[_0x4c7776[_0x9d9c('0x4e')]][_0x9d9c('0x1f')],_0x4c7776[_0x9d9c('0x5c')]));queues[_0x4c7776[_0x9d9c('0x4e')]][_0x9d9c('0xd')]=_0x4c7776[_0x9d9c('0x5c')];}}}}catch(_0x228dd0){utils[_0x9d9c('0x17')](util['format'](_0x9d9c('0x4c'),_0x4c7776['origtransfereruniqueid']),_0x228dd0);}};exports[_0x9d9c('0x61')]=function(_0x43e621){try{if(!_[_0x9d9c('0x18')](queues[_0x43e621['uniqueid']])){utils['debug'](util[_0x9d9c('0x12')](_0x9d9c('0x62'),_0x43e621[_0x9d9c('0x4')]),_0x43e621);queues[_0x43e621[_0x9d9c('0x4')]]['musiconholdstartAt']=utils[_0x9d9c('0x16')]();utils[_0x9d9c('0x11')](util[_0x9d9c('0x12')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x43e621['uniqueid'],queues[_0x43e621[_0x9d9c('0x4')]][_0x9d9c('0x1f')],queues[_0x43e621[_0x9d9c('0x4')]][_0x9d9c('0x63')]));}}catch(_0x3f550f){utils['error'](util[_0x9d9c('0x12')](_0x9d9c('0x62'),_0x43e621[_0x9d9c('0x4')]),_0x3f550f);}};exports[_0x9d9c('0x64')]=function(_0x20c3a8){try{if(!_['isNil'](queues[_0x20c3a8[_0x9d9c('0x4')]])){if(!_[_0x9d9c('0x18')](queues[_0x20c3a8['uniqueid']][_0x9d9c('0x63')])){utils['debug'](util[_0x9d9c('0x12')]('[%s][queues][musiconholdstop]',_0x20c3a8[_0x9d9c('0x4')]),_0x20c3a8);queues[_0x20c3a8[_0x9d9c('0x4')]][_0x9d9c('0x59')]+=utils[_0x9d9c('0x35')](utils['now'](),queues[_0x20c3a8['uniqueid']][_0x9d9c('0x63')]);utils[_0x9d9c('0x11')](util[_0x9d9c('0x12')](_0x9d9c('0x65'),_0x20c3a8[_0x9d9c('0x4')],queues[_0x20c3a8[_0x9d9c('0x4')]][_0x9d9c('0x1f')],queues[_0x20c3a8[_0x9d9c('0x4')]][_0x9d9c('0x59')]));delete queues[_0x20c3a8[_0x9d9c('0x4')]][_0x9d9c('0x63')];}}}catch(_0x1987e6){utils['error'](util[_0x9d9c('0x12')]('[%s][queues][musiconholdstop]',_0x20c3a8['uniqueid']),_0x1987e6);}}; \ No newline at end of file +var _0x64ba=['queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','[%s][queues][agentconnect]','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x64ba,0x10e));var _0xa64b=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x64ba[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xa64b('0x0'));var util=require(_0xa64b('0x1'));var utils=require(_0xa64b('0x2'));var queues={};function writeDB(_0x5645a0){utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x5'),_0x5645a0[_0xa64b('0x6')],_0x5645a0['channel'],_0x5645a0[_0xa64b('0x7')],_0x5645a0[_0xa64b('0x8')],_0x5645a0[_0xa64b('0x9')],_0x5645a0[_0xa64b('0xa')],_0x5645a0[_0xa64b('0xb')]));if(_0x5645a0['queue']){utils[_0xa64b('0xc')](_0x5645a0['queue'])[_0xa64b('0xd')](function(_0x58958c){if(_0x58958c){_0x5645a0[_0xa64b('0xe')]=_0x58958c['type'];}utils[_0xa64b('0xf')](_0xa64b('0x10'),_0x5645a0);});}else{utils[_0xa64b('0xf')](_0xa64b('0x10'),_0x5645a0);}if(_0x5645a0[_0xa64b('0x11')]){delete queues[_0x5645a0[_0xa64b('0x11')]];}else{delete queues[_0x5645a0['uniqueid']];}}exports[_0xa64b('0x12')]=function(_0x51bdaa){try{utils[_0xa64b('0x13')](util[_0xa64b('0x4')]('[%s][queues][queuecallerjoin]',_0x51bdaa[_0xa64b('0x6')]),_0x51bdaa);utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x14'),_0x51bdaa['uniqueid'],_0x51bdaa[_0xa64b('0x7')],_0x51bdaa[_0xa64b('0x15')]));queues[_0x51bdaa[_0xa64b('0x6')]]=_[_0xa64b('0x16')](_0x51bdaa,{'originalposition':_0x51bdaa[_0xa64b('0x15')],'queuecallerjoinAt':utils[_0xa64b('0x17')](),'mohtime':0x0});}catch(_0x1e15d4){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x19'),_0x51bdaa[_0xa64b('0x6')]),_0x1e15d4);}};exports['hangup']=function(_0x236f1d){try{if(!_[_0xa64b('0x1a')](queues[_0x236f1d[_0xa64b('0x6')]])){utils[_0xa64b('0x13')](util['format'](_0xa64b('0x1b'),_0x236f1d[_0xa64b('0x6')]),_0x236f1d);if(queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x1c')]){if(!queues[_0x236f1d[_0xa64b('0x6')]]['queuecallerabandon']&&!queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x1d')]){queues[_0x236f1d['uniqueid']]['queuecallercomplete']=!![];queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x1e')]=utils[_0xa64b('0x17')]();queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0xb')]=_0xa64b('0x1f');}utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x236f1d[_0xa64b('0x6')],queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x20')],queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0xb')]));writeDB(queues[_0x236f1d[_0xa64b('0x6')]]);}else if(queues[_0x236f1d['uniqueid']]['transfereduniqueid']){utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x21'),_0x236f1d['uniqueid'],queues[_0x236f1d['uniqueid']][_0xa64b('0x20')],queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x11')]));queues[queues[_0x236f1d['uniqueid']][_0xa64b('0x11')]]=queues[_0x236f1d[_0xa64b('0x6')]];queues[queues[_0x236f1d[_0xa64b('0x6')]]['transfereduniqueid']][_0xa64b('0x22')]=0x2;delete queues[_0x236f1d['uniqueid']];}}}catch(_0x31d07d){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x1b'),_0x236f1d[_0xa64b('0x6')]),_0x31d07d);}};exports[_0xa64b('0x23')]=function(_0x3baba1){try{utils[_0xa64b('0x13')](util[_0xa64b('0x4')]('[%s][queues][varset]',_0x3baba1[_0xa64b('0x6')]),_0x3baba1);if(!_['isNil'](_0x3baba1[_0xa64b('0x24')]['queuestatus'])&&_0x3baba1[_0xa64b('0x25')][_0xa64b('0x26')]()!==_0xa64b('0x27')){if(!_[_0xa64b('0x1a')](queues[_0x3baba1['uniqueid']])){queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x28')]=![];queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x29')]=null;queues[_0x3baba1[_0xa64b('0x6')]]['queuecallerexit']=!![];queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x2a')]=utils[_0xa64b('0x17')]();queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0xb')]=_0x3baba1['value'][_0xa64b('0x26')]();utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x2b'),_0x3baba1['uniqueid'],queues[_0x3baba1['uniqueid']][_0xa64b('0x20')],_0x3baba1[_0xa64b('0x25')],queues[_0x3baba1['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x3baba1[_0xa64b('0x6')]]);}}else if(!_[_0xa64b('0x1a')](_0x3baba1['variable'][_0xa64b('0x2c')])){if(!_[_0xa64b('0x1a')](queues[_0x3baba1[_0xa64b('0x6')]])&&!queues[_0x3baba1['uniqueid']][_0xa64b('0x28')]){queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x28')]=![];queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x29')]=null;queues[_0x3baba1['uniqueid']][_0xa64b('0x1d')]=!![];queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x2a')]=utils[_0xa64b('0x17')]();queues[_0x3baba1['uniqueid']][_0xa64b('0xb')]=_0xa64b('0x2d');utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3baba1[_0xa64b('0x6')],queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x20')],_0x3baba1[_0xa64b('0x25')],queues[_0x3baba1[_0xa64b('0x6')]]['queuecallerexitreason']));}}}catch(_0x5f29b6){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x2e'),_0x3baba1[_0xa64b('0x6')]),_0x5f29b6);}};exports[_0xa64b('0x28')]=function(_0x5db566){try{if(!_['isNil'](queues[_0x5db566[_0xa64b('0x6')]])){utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x2f'),_0x5db566[_0xa64b('0x6')]),_0x5db566);queues[_0x5db566[_0xa64b('0x6')]][_0xa64b('0x1d')]=![];queues[_0x5db566['uniqueid']][_0xa64b('0x2a')]=null;queues[_0x5db566['uniqueid']][_0xa64b('0x28')]=!![];queues[_0x5db566[_0xa64b('0x6')]]['queuecallerabandonAt']=utils[_0xa64b('0x17')]();queues[_0x5db566['uniqueid']][_0xa64b('0xb')]='ABANDONED';utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5db566[_0xa64b('0x6')],queues[_0x5db566['uniqueid']][_0xa64b('0x20')],queues[_0x5db566[_0xa64b('0x6')]][_0xa64b('0xb')]));}}catch(_0xc7ddac){utils['error'](util[_0xa64b('0x4')]('[%s][queues][queuecallerabandon]',_0x5db566[_0xa64b('0x6')]),_0xc7ddac);}};exports[_0xa64b('0x30')]=function(_0x44fc3e){try{if(!_['isNil'](queues[_0x44fc3e[_0xa64b('0x6')]])){utils['debug'](util['format'](_0xa64b('0x31'),_0x44fc3e[_0xa64b('0x6')]),_0x44fc3e);utils[_0xa64b('0x3')](util['format'](_0xa64b('0x32'),_0x44fc3e[_0xa64b('0x6')],queues[_0x44fc3e[_0xa64b('0x6')]]['name'],_0x44fc3e[_0xa64b('0x33')],_0x44fc3e[_0xa64b('0x34')]));queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x30')]=!![];queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x1c')]=utils[_0xa64b('0x17')]();queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x35')]=utils['diffTime'](queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x1c')],queues[_0x44fc3e['uniqueid']][_0xa64b('0x36')]);queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x15')]=_0x44fc3e['position'];queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x37')]=_0x44fc3e[_0xa64b('0x37')];queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x33')]=_0x44fc3e[_0xa64b('0x33')];queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x34')]=_0x44fc3e[_0xa64b('0x34')];}}catch(_0x41c7b9){utils[_0xa64b('0x18')](util['format'](_0xa64b('0x31'),_0x44fc3e['uniqueid']),_0x41c7b9);}};exports['agentconnect']=function(_0x57ca7f){try{if(!_[_0xa64b('0x1a')](queues[_0x57ca7f[_0xa64b('0x6')]])){utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x38'),_0x57ca7f[_0xa64b('0x6')]),_0x57ca7f);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x57ca7f['uniqueid'],queues[_0x57ca7f[_0xa64b('0x6')]]['name'],_0x57ca7f[_0xa64b('0x39')],_0x57ca7f['destaccountcode']));queues[_0x57ca7f['uniqueid']][_0xa64b('0x28')]=![];queues[_0x57ca7f[_0xa64b('0x6')]]['queuecallerabandon']=![];queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0x29')]=null;queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0x1d')]=![];queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0xb')]=null;queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0x2a')]=null;queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0x3a')]=!![];queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0xa')]=_0x57ca7f[_0xa64b('0x3b')];queues[_0x57ca7f['uniqueid']][_0xa64b('0x8')]=_0x57ca7f[_0xa64b('0x39')];}}catch(_0x2c0934){utils[_0xa64b('0x18')](util['format']('[%s][queues][agentconnect]',_0x57ca7f[_0xa64b('0x6')]),_0x2c0934);}};exports[_0xa64b('0x3c')]=function(_0x881464){try{if(!_[_0xa64b('0x1a')](queues[_0x881464[_0xa64b('0x6')]])){if(queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x1c')]){utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x3d'),_0x881464[_0xa64b('0x6')]),_0x881464);queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x28')]=![];queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x28')]=![];queues[_0x881464['uniqueid']][_0xa64b('0x29')]=null;queues[_0x881464[_0xa64b('0x6')]]['queuecallerexit']=![];queues[_0x881464['uniqueid']][_0xa64b('0x2a')]=null;queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x3a')]=!![];queues[_0x881464['uniqueid']]['lastAssignedTo']=_0x881464[_0xa64b('0x39')];queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x3e')]=!![];queues[_0x881464['uniqueid']][_0xa64b('0x1e')]=utils[_0xa64b('0x17')]();if(_0x881464[_0xa64b('0x3f')]==_0xa64b('0x40')){if(!queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x40')]){queues[_0x881464['uniqueid']]['queuecallerexitreason']=_0xa64b('0x41');}}else{queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0xb')]='COMPLETEDBY'+_0x881464[_0xa64b('0x3f')][_0xa64b('0x26')]();}utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x42'),_0x881464['uniqueid'],queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x20')],_0x881464[_0xa64b('0x39')],queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0xb')]));writeDB(queues[_0x881464[_0xa64b('0x6')]]);}}}catch(_0x27d139){utils[_0xa64b('0x18')](util['format'](_0xa64b('0x3d'),_0x881464[_0xa64b('0x6')]),_0x27d139);}};exports[_0xa64b('0x43')]=function(_0x349f71){try{if(!_[_0xa64b('0x1a')](queues[_0x349f71[_0xa64b('0x44')]])){utils['debug'](util['format'](_0xa64b('0x45'),_0x349f71['uniqueid']),_0x349f71);queues[_0x349f71['transfereeuniqueid']][_0xa64b('0x40')]=!![];queues[_0x349f71['transfereeuniqueid']][_0xa64b('0x46')]='BLIND';queues[_0x349f71[_0xa64b('0x44')]][_0xa64b('0x47')]=_0x349f71[_0xa64b('0x48')];queues[_0x349f71[_0xa64b('0x44')]][_0xa64b('0x49')]=_0x349f71[_0xa64b('0x44')];queues[_0x349f71[_0xa64b('0x44')]][_0xa64b('0xb')]=_0xa64b('0x4a');utils[_0xa64b('0x3')](util['format'](_0xa64b('0x4b'),_0x349f71[_0xa64b('0x6')],queues[_0x349f71[_0xa64b('0x44')]]['name'],_0x349f71['transfereeuniqueid'],_0x349f71[_0xa64b('0x48')]));}}catch(_0x113a7e){utils['error'](util[_0xa64b('0x4')]('[%s][queues][blindtransfer]',_0x349f71[_0xa64b('0x6')]),_0x113a7e);}};exports['attendedtransfer']=function(_0x568efc){try{utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x4c'),_0x568efc[_0xa64b('0x4d')]),_0x568efc);if(_0x568efc[_0xa64b('0x4d')]==_0x568efc['origtransfererlinkedid']){if(!_[_0xa64b('0x1a')](queues[_0x568efc[_0xa64b('0x4e')]])){utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x20')],_0x568efc[_0xa64b('0x4f')]));queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x40')]=!![];queues[_0x568efc['secondtransfererlinkedid']][_0xa64b('0x46')]='ATTENDED';queues[_0x568efc['secondtransfererlinkedid']][_0xa64b('0x47')]=_0x568efc[_0xa64b('0x4f')];queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x49')]=_0x568efc[_0xa64b('0x4d')];queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0xb')]=_0xa64b('0x50');}if(!_[_0xa64b('0x1a')](queues[_0x568efc['origtransfererlinkedid']])){if(_0x568efc['transfereelinkedid']&&queues[_0x568efc[_0xa64b('0x51')]]){queues[_0x568efc['transfereelinkedid']][_0xa64b('0x22')]=0x1;queues[_0x568efc[_0xa64b('0x44')]]=_[_0xa64b('0x52')](queues[_0x568efc[_0xa64b('0x51')]]);queues[_0x568efc['transfereeuniqueid']][_0xa64b('0x11')]=_0x568efc[_0xa64b('0x53')];queues[_0x568efc[_0xa64b('0x44')]][_0xa64b('0x22')]=0x2;queues[_0x568efc[_0xa64b('0x44')]]['calleridnum']=queues[_0x568efc[_0xa64b('0x4e')]]['calleridnum'];queues[_0x568efc['transfereeuniqueid']][_0xa64b('0x54')]=queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x54')];queues[_0x568efc['transfereeuniqueid']][_0xa64b('0x36')]=utils['now']();queues[_0x568efc[_0xa64b('0x44')]][_0xa64b('0x1c')]=utils[_0xa64b('0x17')]();queues[_0x568efc[_0xa64b('0x44')]][_0xa64b('0x35')]=0x0;queues[_0x568efc[_0xa64b('0x44')]]['mohtime']=0x0;utils['info'](util[_0xa64b('0x4')](_0xa64b('0x55'),_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x44')]]['name'],queues[_0x568efc[_0xa64b('0x44')]][_0xa64b('0x9')],queues[_0x568efc['transfereeuniqueid']][_0xa64b('0x54')]));}else{utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x568efc[_0xa64b('0x4d')],queues[_0x568efc['origtransfererlinkedid']][_0xa64b('0x20')],_0x568efc[_0xa64b('0x4e')]));queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x11')]=_0x568efc[_0xa64b('0x4e')];}}}else if(_0x568efc[_0xa64b('0x57')]==_0x568efc[_0xa64b('0x4e')]){if(!_[_0xa64b('0x1a')](queues[_0x568efc[_0xa64b('0x56')]])){utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x20')],_0x568efc[_0xa64b('0x57')],_0x568efc[_0xa64b('0x58')]));queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x40')]=!![];queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x46')]=_0xa64b('0x59');queues[_0x568efc[_0xa64b('0x56')]]['transferexten']=_0x568efc[_0xa64b('0x58')];queues[_0x568efc[_0xa64b('0x56')]]['transferuniqueid']=_0x568efc['secondtransfereruniqueid'];queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0xb')]=_0xa64b('0x50');}if(!_['isNil'](queues[_0x568efc['secondtransfererlinkedid']])){if(_0x568efc['transfertargetlinkedid']&&queues[_0x568efc[_0xa64b('0x5a')]]){queues[_0x568efc[_0xa64b('0x5a')]][_0xa64b('0x22')]=0x1;queues[_0x568efc[_0xa64b('0x53')]]=_[_0xa64b('0x52')](queues[_0x568efc[_0xa64b('0x5a')]]);queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x11')]=_0x568efc[_0xa64b('0x53')];queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x22')]=0x2;queues[_0x568efc[_0xa64b('0x53')]]['calleridnum']=queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x9')];queues[_0x568efc['transfertargetuniqueid']][_0xa64b('0x54')]=queues[_0x568efc[_0xa64b('0x56')]]['calleridname'];queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x36')]=utils[_0xa64b('0x17')]();queues[_0x568efc[_0xa64b('0x53')]]['queuecallerleaveAt']=utils[_0xa64b('0x17')]();queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x35')]=0x0;queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x5b')]=0x0;utils['info'](util[_0xa64b('0x4')](_0xa64b('0x5c'),_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x20')],queues[_0x568efc[_0xa64b('0x53')]]['transfereduniqueid'],queues[_0x568efc[_0xa64b('0x53')]]['calleridnum'],queues[_0x568efc['transfertargetuniqueid']][_0xa64b('0x54')]));}else{utils[_0xa64b('0x3')](util['format'](_0xa64b('0x5d'),_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x20')],_0x568efc['origtransfererlinkedid']));queues[_0x568efc[_0xa64b('0x4e')]]['transfereduniqueid']=_0x568efc[_0xa64b('0x56')];}}}}catch(_0x53de27){utils[_0xa64b('0x18')](util[_0xa64b('0x4')]('[%s][queues][attendedtransfer]',_0x568efc['origtransfereruniqueid']),_0x53de27);}};exports['musiconholdstart']=function(_0x300f2e){try{if(!_[_0xa64b('0x1a')](queues[_0x300f2e[_0xa64b('0x6')]])){utils['debug'](util[_0xa64b('0x4')](_0xa64b('0x5e'),_0x300f2e[_0xa64b('0x6')]),_0x300f2e);queues[_0x300f2e[_0xa64b('0x6')]][_0xa64b('0x5f')]=utils[_0xa64b('0x17')]();utils['info'](util['format'](_0xa64b('0x60'),_0x300f2e[_0xa64b('0x6')],queues[_0x300f2e[_0xa64b('0x6')]][_0xa64b('0x20')],queues[_0x300f2e['uniqueid']][_0xa64b('0x5f')]));}}catch(_0x498775){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x5e'),_0x300f2e[_0xa64b('0x6')]),_0x498775);}};exports[_0xa64b('0x61')]=function(_0x9f920b){try{if(!_[_0xa64b('0x1a')](queues[_0x9f920b[_0xa64b('0x6')]])){if(!_[_0xa64b('0x1a')](queues[_0x9f920b['uniqueid']]['musiconholdstartAt'])){utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x62'),_0x9f920b[_0xa64b('0x6')]),_0x9f920b);queues[_0x9f920b[_0xa64b('0x6')]][_0xa64b('0x5b')]+=utils['diffTime'](utils['now'](),queues[_0x9f920b[_0xa64b('0x6')]][_0xa64b('0x5f')]);utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x63'),_0x9f920b[_0xa64b('0x6')],queues[_0x9f920b[_0xa64b('0x6')]]['name'],queues[_0x9f920b['uniqueid']][_0xa64b('0x5b')]));delete queues[_0x9f920b['uniqueid']][_0xa64b('0x5f')];}}}catch(_0x2b1903){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x62'),_0x9f920b[_0xa64b('0x6')]),_0x2b1903);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 323ef22..cbfcdbf 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 _0xa2d9=['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','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','[%s][recordings][writeDB]','uniqueid','blinds','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','format','channelstate','info','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','accountcode','[%s][recordings][newstate]','varset','variable','isNil','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','monitors','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','split','lastIndexOf','[%s][recordings][newexten]'];(function(_0x29b848,_0x4daf42){var _0x1603ca=function(_0xe01238){while(--_0xe01238){_0x29b848['push'](_0x29b848['shift']());}};_0x1603ca(++_0x4daf42);}(_0xa2d9,0x9e));var _0x9a2d=function(_0x58ad5c,_0x553b93){_0x58ad5c=_0x58ad5c-0x0;var _0x2005d3=_0xa2d9[_0x58ad5c];return _0x2005d3;};'use strict';var _=require(_0x9a2d('0x0'));var util=require('util');var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x3cb9b6){var _0x1e5be9;utils['info'](util['format'](_0x9a2d('0x1'),_0x3cb9b6[_0x9a2d('0x2')]));if(transfers['blinds'][_0x3cb9b6[_0x9a2d('0x2')]]){_0x1e5be9=_0x3cb9b6[_0x9a2d('0x2')];_0x3cb9b6[_0x9a2d('0x2')]=transfers[_0x9a2d('0x3')][_0x3cb9b6['uniqueid']]['transfereeuniqueid'];}if(_0x3cb9b6['accountcode']){utils[_0x9a2d('0x4')](_0x3cb9b6['accountcode'])[_0x9a2d('0x5')](function(_0x5ec210){if(_0x5ec210){_0x3cb9b6[_0x9a2d('0x6')]=_0x5ec210[_0x9a2d('0x7')];_0x3cb9b6[_0x9a2d('0x8')]=_0x5ec210['id'];}utils['request']('CreateVoiceRecording',_0x3cb9b6);});}else{utils[_0x9a2d('0x9')](_0x9a2d('0xa'),_0x3cb9b6);}if(_0x1e5be9)delete transfers[_0x9a2d('0x3')][_0x1e5be9];}exports[_0x9a2d('0xb')]=function(_0x267910){try{utils[_0x9a2d('0xc')](util['format'](_0x9a2d('0xd'),_0x267910['uniqueid']),_0x267910);if(_0x267910['uniqueid']==_0x267910[_0x9a2d('0xe')]){utils['info'](util['format'](_0x9a2d('0xf'),_0x267910['uniqueid'],_0x267910[_0x9a2d('0x10')],_0x267910[_0x9a2d('0x11')]));recordings[_0x267910[_0x9a2d('0x2')]]={'uniqueid':_0x267910['uniqueid'],'accountcode':_0x267910['accountcode'],'exten':_0x267910['exten'],'context':_0x267910[_0x9a2d('0x10')],'channel':_0x267910['channel'],'monitors':[]};}}catch(_0x325229){utils[_0x9a2d('0x12')](util['format'](_0x9a2d('0xd'),_0x267910[_0x9a2d('0x2')]),_0x325229);}};exports[_0x9a2d('0x13')]=function(_0x2e41da){try{utils[_0x9a2d('0xc')](util[_0x9a2d('0x14')]('[%s][recordings][newstate]',_0x2e41da[_0x9a2d('0x2')]),_0x2e41da);if(!_['isNil'](recordings[_0x2e41da['uniqueid']])&&_0x2e41da[_0x9a2d('0x15')]==0x6){utils[_0x9a2d('0x16')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2e41da[_0x9a2d('0x2')],_0x2e41da[_0x9a2d('0x10')],_0x2e41da['channel']));}else if(!_['isNil'](recordings[_0x2e41da[_0x9a2d('0xe')]])&&_0x2e41da[_0x9a2d('0x15')]==0x6&&_0x2e41da[_0x9a2d('0x10')]!=_0x9a2d('0x17')){utils[_0x9a2d('0x16')](util['format'](_0x9a2d('0x18'),_0x2e41da[_0x9a2d('0x2')],_0x2e41da[_0x9a2d('0xe')],_0x2e41da[_0x9a2d('0x10')],_0x2e41da[_0x9a2d('0x19')]));recordings[_0x2e41da[_0x9a2d('0xe')]]['accountcode']=_0x2e41da[_0x9a2d('0x1a')];}}catch(_0x47c055){utils[_0x9a2d('0x12')](util[_0x9a2d('0x14')](_0x9a2d('0x1b'),_0x2e41da[_0x9a2d('0x2')]),_0x47c055);}};exports[_0x9a2d('0x1c')]=function(_0x17a49e){try{if(!_['isNil'](_0x17a49e[_0x9a2d('0x1d')])&&!_[_0x9a2d('0x1e')](_0x17a49e[_0x9a2d('0x1d')][_0x9a2d('0x1f')])){utils[_0x9a2d('0xc')](util[_0x9a2d('0x14')](_0x9a2d('0x20'),_0x17a49e[_0x9a2d('0x2')]),_0x17a49e);utils['info'](util[_0x9a2d('0x14')](_0x9a2d('0x21'),_0x17a49e['uniqueid'],_0x17a49e[_0x9a2d('0x1d')],_0x17a49e[_0x9a2d('0x22')]));if(_[_0x9a2d('0x23')](_0x17a49e[_0x9a2d('0x22')],_0x9a2d('0x24'))){_0x17a49e['value']=_0x17a49e[_0x9a2d('0x22')][_0x9a2d('0x25')](_0x9a2d('0x24'),_0x9a2d('0x26'));}if(recordings[_0x17a49e[_0x9a2d('0xe')]]){var _0x1a583e=_[_0x9a2d('0x27')](recordings[_0x17a49e[_0x9a2d('0xe')]]['monitors'],{'value':_0x17a49e[_0x9a2d('0x22')]});if(_['isNil'](_0x1a583e)){recordings[_0x17a49e[_0x9a2d('0xe')]]['monitors'][_0x9a2d('0x28')]({'value':_0x17a49e[_0x9a2d('0x22')]});}}}}catch(_0x55b329){utils[_0x9a2d('0x12')](util['format'](_0x9a2d('0x20'),_0x17a49e[_0x9a2d('0x2')]),_0x55b329);}};exports['hangup']=function(_0x3f767f){try{if(!_[_0x9a2d('0x1e')](recordings[_0x3f767f[_0x9a2d('0x2')]])){utils[_0x9a2d('0xc')](util[_0x9a2d('0x14')](_0x9a2d('0x29'),_0x3f767f['uniqueid']),_0x3f767f);utils[_0x9a2d('0x16')](util[_0x9a2d('0x14')](_0x9a2d('0x2a'),_0x3f767f['uniqueid'],_0x3f767f[_0x9a2d('0x2b')],_0x3f767f[_0x9a2d('0x2c')],_0x3f767f['cause-txt']));recordings[_0x3f767f[_0x9a2d('0x2')]][_0x9a2d('0x2b')]=_0x3f767f[_0x9a2d('0x2b')];recordings[_0x3f767f[_0x9a2d('0x2')]]['calleridname']=_0x3f767f[_0x9a2d('0x2c')];recordings[_0x3f767f['uniqueid']][_0x9a2d('0x2d')]=_0x3f767f[_0x9a2d('0x2d')];recordings[_0x3f767f['uniqueid']][_0x9a2d('0x2e')]=_0x3f767f[_0x9a2d('0x2e')];if(recordings[_0x3f767f[_0x9a2d('0x2')]][_0x9a2d('0x2f')]==_0x9a2d('0x30')&&recordings[_0x3f767f['uniqueid']][_0x9a2d('0x1a')]){recordings[_0x3f767f[_0x9a2d('0x2')]][_0x9a2d('0x2d')]=recordings[_0x3f767f[_0x9a2d('0x2')]][_0x9a2d('0x1a')];recordings[_0x3f767f[_0x9a2d('0x2')]][_0x9a2d('0x2e')]='';}recordings[_0x3f767f['uniqueid']][_0x9a2d('0x31')][_0x9a2d('0x32')](function(_0xa1780c){var _0x40cf4a=_[_0x9a2d('0x33')](recordings[_0x3f767f[_0x9a2d('0x2')]]);_0x40cf4a[_0x9a2d('0x22')]=_0xa1780c[_0x9a2d('0x22')];writeDB(_0x40cf4a);});delete recordings[_0x3f767f[_0x9a2d('0x2')]];}}catch(_0x28ae72){utils[_0x9a2d('0x12')](util['format'](_0x9a2d('0x29'),_0x3f767f[_0x9a2d('0x2')]),_0x28ae72);}};exports[_0x9a2d('0x34')]=function(_0x1fff72){try{if(!_[_0x9a2d('0x1e')](recordings[_0x1fff72[_0x9a2d('0x2')]])){utils[_0x9a2d('0xc')](util['format']('[%s][recordings][newexten]',_0x1fff72[_0x9a2d('0x2')]),_0x1fff72);utils['info'](util[_0x9a2d('0x14')](_0x9a2d('0x35'),_0x1fff72['uniqueid'],_0x1fff72[_0x9a2d('0x36')],_0x1fff72[_0x9a2d('0x37')]));if(_0x1fff72[_0x9a2d('0x36')]['toLowerCase']()==_0x9a2d('0x38')&&_[_0x9a2d('0x39')](_0x1fff72['appdata']['toLowerCase'](),'cdr')){var _0x5afc44=_0x1fff72['appdata'][_0x9a2d('0x3a')]('=');var _0x95da51=_0x5afc44[0x0]['substring'](_0x5afc44[0x0][_0x9a2d('0x3b')]('(')+0x1,_0x5afc44[0x0]['lastIndexOf'](')'));var _0x3d3e4e=_0x5afc44[0x1];recordings[_0x1fff72['uniqueid']][_0x95da51]=_0x3d3e4e;}}}catch(_0x380796){utils[_0x9a2d('0x12')](util[_0x9a2d('0x14')](_0x9a2d('0x3c'),_0x1fff72['uniqueid']),_0x380796);}};exports[_0x9a2d('0x3d')]=function(_0x3e2cb8){try{if(!_[_0x9a2d('0x1e')](recordings[_0x3e2cb8[_0x9a2d('0x2')]])){utils[_0x9a2d('0xc')](util[_0x9a2d('0x14')](_0x9a2d('0x3e'),_0x3e2cb8[_0x9a2d('0x2')]),_0x3e2cb8);utils[_0x9a2d('0x16')](util[_0x9a2d('0x14')](_0x9a2d('0x3f'),_0x3e2cb8['uniqueid'],_0x3e2cb8[_0x9a2d('0x40')]));recordings[_0x3e2cb8[_0x9a2d('0x2')]]['queue']=_0x3e2cb8[_0x9a2d('0x40')];}}catch(_0x50a4af){utils[_0x9a2d('0x12')](util[_0x9a2d('0x14')](_0x9a2d('0x3e'),_0x3e2cb8[_0x9a2d('0x2')]),_0x50a4af);}};exports[_0x9a2d('0x41')]=function(_0x5732b9){try{utils[_0x9a2d('0xc')](util[_0x9a2d('0x14')](_0x9a2d('0x42'),_0x5732b9[_0x9a2d('0x2')]),_0x5732b9);utils[_0x9a2d('0x16')](util[_0x9a2d('0x14')](_0x9a2d('0x43'),_0x5732b9[_0x9a2d('0x2')],_0x5732b9[_0x9a2d('0x44')],_0x5732b9[_0x9a2d('0x45')],_0x5732b9['transfereecalleridnum'],_0x5732b9[_0x9a2d('0x46')]));if(recordings[_0x5732b9['transfereruniqueid']]&&transfers['blinds'][_0x5732b9[_0x9a2d('0x47')]]){transfers['blinds'][_0x5732b9[_0x9a2d('0x47')]][_0x9a2d('0x48')]=!![];}}catch(_0x131458){utils[_0x9a2d('0x12')](util[_0x9a2d('0x14')](_0x9a2d('0x42'),_0x5732b9['uniqueid']),_0x131458);}}; \ No newline at end of file +var _0x6ff4=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','outbound','connectedlinename','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newstate]','isNil','channel','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename'];(function(_0x20d73e,_0x39f9ec){var _0x52e84b=function(_0x11a4ac){while(--_0x11a4ac){_0x20d73e['push'](_0x20d73e['shift']());}};_0x52e84b(++_0x39f9ec);}(_0x6ff4,0xf6));var _0x46ff=function(_0x250d30,_0x47671e){_0x250d30=_0x250d30-0x0;var _0x55326a=_0x6ff4[_0x250d30];return _0x55326a;};'use strict';var _=require(_0x46ff('0x0'));var util=require('util');var utils=require(_0x46ff('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x3ade27){var _0x3241b2;utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x4'),_0x3ade27[_0x46ff('0x5')]));if(transfers[_0x46ff('0x6')][_0x3ade27[_0x46ff('0x5')]]){_0x3241b2=_0x3ade27['uniqueid'];_0x3ade27['uniqueid']=transfers[_0x46ff('0x6')][_0x3ade27[_0x46ff('0x5')]][_0x46ff('0x7')];}if(_0x3ade27[_0x46ff('0x8')]){utils['getUserByInternal'](_0x3ade27['accountcode'])[_0x46ff('0x9')](function(_0x3aacda){if(_0x3aacda){_0x3ade27['membername']=_0x3aacda['name'];_0x3ade27[_0x46ff('0xa')]=_0x3aacda['id'];}utils[_0x46ff('0xb')]('CreateVoiceRecording',_0x3ade27);});}else{utils[_0x46ff('0xb')](_0x46ff('0xc'),_0x3ade27);}if(_0x3241b2)delete transfers[_0x46ff('0x6')][_0x3241b2];}exports[_0x46ff('0xd')]=function(_0x396a2c){try{utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0xf'),_0x396a2c['uniqueid']),_0x396a2c);if(_0x396a2c[_0x46ff('0x5')]==_0x396a2c['linkedid']){utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x10'),_0x396a2c['uniqueid'],_0x396a2c[_0x46ff('0x11')],_0x396a2c[_0x46ff('0x12')]));recordings[_0x396a2c[_0x46ff('0x5')]]={'uniqueid':_0x396a2c[_0x46ff('0x5')],'accountcode':_0x396a2c[_0x46ff('0x8')],'exten':_0x396a2c[_0x46ff('0x12')],'context':_0x396a2c[_0x46ff('0x11')],'channel':_0x396a2c['channel'],'monitors':[]};}}catch(_0x279b47){utils[_0x46ff('0x13')](util[_0x46ff('0x3')](_0x46ff('0xf'),_0x396a2c[_0x46ff('0x5')]),_0x279b47);}};exports['newstate']=function(_0xb9aece){try{utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0x14'),_0xb9aece['uniqueid']),_0xb9aece);if(!_[_0x46ff('0x15')](recordings[_0xb9aece[_0x46ff('0x5')]])&&_0xb9aece['channelstate']==0x6){utils[_0x46ff('0x2')](util[_0x46ff('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0xb9aece[_0x46ff('0x5')],_0xb9aece['context'],_0xb9aece[_0x46ff('0x16')]));}else if(!_['isNil'](recordings[_0xb9aece[_0x46ff('0x17')]])&&_0xb9aece[_0x46ff('0x18')]==0x6&&_0xb9aece[_0x46ff('0x11')]!=_0x46ff('0x19')){utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x1a'),_0xb9aece['uniqueid'],_0xb9aece[_0x46ff('0x17')],_0xb9aece[_0x46ff('0x11')],_0xb9aece[_0x46ff('0x16')]));recordings[_0xb9aece[_0x46ff('0x17')]]['accountcode']=_0xb9aece[_0x46ff('0x8')];}}catch(_0x25ac3a){utils[_0x46ff('0x13')](util[_0x46ff('0x3')](_0x46ff('0x14'),_0xb9aece['uniqueid']),_0x25ac3a);}};exports[_0x46ff('0x1b')]=function(_0x85f30c){try{if(!_['isNil'](_0x85f30c[_0x46ff('0x1c')])&&!_[_0x46ff('0x15')](_0x85f30c['variable'][_0x46ff('0x1d')])){utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0x1e'),_0x85f30c[_0x46ff('0x5')]),_0x85f30c);utils[_0x46ff('0x2')](util['format'](_0x46ff('0x1f'),_0x85f30c[_0x46ff('0x5')],_0x85f30c[_0x46ff('0x1c')],_0x85f30c['value']));if(_[_0x46ff('0x20')](_0x85f30c[_0x46ff('0x21')],_0x46ff('0x22'))){_0x85f30c[_0x46ff('0x21')]=_0x85f30c[_0x46ff('0x21')]['replace'](_0x46ff('0x22'),'.WAV');}if(recordings[_0x85f30c[_0x46ff('0x17')]]){var _0x312d37=_[_0x46ff('0x23')](recordings[_0x85f30c['linkedid']][_0x46ff('0x24')],{'value':_0x85f30c[_0x46ff('0x21')]});if(_[_0x46ff('0x15')](_0x312d37)){recordings[_0x85f30c[_0x46ff('0x17')]][_0x46ff('0x24')][_0x46ff('0x25')]({'value':_0x85f30c['value']});}}}}catch(_0x31a0fe){utils[_0x46ff('0x13')](util[_0x46ff('0x3')](_0x46ff('0x1e'),_0x85f30c[_0x46ff('0x5')]),_0x31a0fe);}};exports[_0x46ff('0x26')]=function(_0x5eacb0){try{if(!_[_0x46ff('0x15')](recordings[_0x5eacb0[_0x46ff('0x5')]])){utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0x27'),_0x5eacb0[_0x46ff('0x5')]),_0x5eacb0);utils[_0x46ff('0x2')](util['format'](_0x46ff('0x28'),_0x5eacb0[_0x46ff('0x5')],_0x5eacb0[_0x46ff('0x29')],_0x5eacb0[_0x46ff('0x2a')],_0x5eacb0[_0x46ff('0x2b')]));recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x29')]=_0x5eacb0[_0x46ff('0x29')];recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x2a')]=_0x5eacb0[_0x46ff('0x2a')];recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x2c')]=_0x5eacb0['connectedlinenum'];recordings[_0x5eacb0[_0x46ff('0x5')]]['connectedlinename']=_0x5eacb0['connectedlinename'];if(recordings[_0x5eacb0[_0x46ff('0x5')]]['type']==_0x46ff('0x2d')&&recordings[_0x5eacb0[_0x46ff('0x5')]]['accountcode']){recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x2c')]=recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x8')];recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x2e')]='';}recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x24')]['forEach'](function(_0x2d590b){var _0x168f5a=_[_0x46ff('0x2f')](recordings[_0x5eacb0[_0x46ff('0x5')]]);_0x168f5a[_0x46ff('0x21')]=_0x2d590b[_0x46ff('0x21')];writeDB(_0x168f5a);});delete recordings[_0x5eacb0[_0x46ff('0x5')]];}}catch(_0x4d7bb7){utils[_0x46ff('0x13')](util[_0x46ff('0x3')]('[%s][recordings][hangup]',_0x5eacb0[_0x46ff('0x5')]),_0x4d7bb7);}};exports[_0x46ff('0x30')]=function(_0x3d7fe4){try{if(!_['isNil'](recordings[_0x3d7fe4[_0x46ff('0x5')]])){utils['debug'](util[_0x46ff('0x3')](_0x46ff('0x31'),_0x3d7fe4[_0x46ff('0x5')]),_0x3d7fe4);utils['info'](util[_0x46ff('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3d7fe4[_0x46ff('0x5')],_0x3d7fe4[_0x46ff('0x32')],_0x3d7fe4[_0x46ff('0x33')]));if(_0x3d7fe4['application'][_0x46ff('0x34')]()=='set'&&_['startsWith'](_0x3d7fe4[_0x46ff('0x33')][_0x46ff('0x34')](),_0x46ff('0x35'))){var _0x5db205=_0x3d7fe4[_0x46ff('0x33')][_0x46ff('0x36')]('=');var _0x409587=_0x5db205[0x0][_0x46ff('0x37')](_0x5db205[0x0][_0x46ff('0x38')]('(')+0x1,_0x5db205[0x0][_0x46ff('0x38')](')'));var _0x40195d=_0x5db205[0x1];recordings[_0x3d7fe4[_0x46ff('0x5')]][_0x409587]=_0x40195d;}}}catch(_0x384800){utils[_0x46ff('0x13')](util[_0x46ff('0x3')](_0x46ff('0x31'),_0x3d7fe4[_0x46ff('0x5')]),_0x384800);}};exports[_0x46ff('0x39')]=function(_0x180741){try{if(!_[_0x46ff('0x15')](recordings[_0x180741[_0x46ff('0x5')]])){utils[_0x46ff('0xe')](util[_0x46ff('0x3')]('[%s][recordings][queuecallerjoin]',_0x180741[_0x46ff('0x5')]),_0x180741);utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x3a'),_0x180741[_0x46ff('0x5')],_0x180741[_0x46ff('0x3b')]));recordings[_0x180741[_0x46ff('0x5')]][_0x46ff('0x3b')]=_0x180741[_0x46ff('0x3b')];}}catch(_0x4f7739){utils[_0x46ff('0x13')](util['format'](_0x46ff('0x3c'),_0x180741[_0x46ff('0x5')]),_0x4f7739);}};exports[_0x46ff('0x3d')]=function(_0x3b3d83){try{utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0x3e'),_0x3b3d83['uniqueid']),_0x3b3d83);utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x3f'),_0x3b3d83[_0x46ff('0x5')],_0x3b3d83['transferercalleridnum'],_0x3b3d83[_0x46ff('0x40')],_0x3b3d83[_0x46ff('0x41')],_0x3b3d83[_0x46ff('0x42')]));if(recordings[_0x3b3d83[_0x46ff('0x43')]]&&transfers[_0x46ff('0x6')][_0x3b3d83[_0x46ff('0x43')]]){transfers['blinds'][_0x3b3d83['transfereruniqueid']][_0x46ff('0x44')]=!![];}}catch(_0x29999e){utils[_0x46ff('0x13')](util[_0x46ff('0x3')]('[%s][recordings][blindtransfer]',_0x3b3d83[_0x46ff('0x5')]),_0x29999e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 1a68d52..4c90368 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 _0x1bd8=['transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil'];(function(_0x576cd5,_0x48085b){var _0x1b1bb1=function(_0x177d2b){while(--_0x177d2b){_0x576cd5['push'](_0x576cd5['shift']());}};_0x1b1bb1(++_0x48085b);}(_0x1bd8,0xe2));var _0x81bd=function(_0x479795,_0x1afcba){_0x479795=_0x479795-0x0;var _0x5f09b7=_0x1bd8[_0x479795];return _0x5f09b7;};'use strict';var _=require(_0x81bd('0x0'));var util=require(_0x81bd('0x1'));var utils=require(_0x81bd('0x2'));function writeDB(_0x3459a3){utils[_0x81bd('0x3')](util[_0x81bd('0x4')](_0x81bd('0x5'),_0x3459a3[_0x81bd('0x6')]===_0x81bd('0x7')?_0x3459a3[_0x81bd('0x8')]:_0x3459a3[_0x81bd('0x9')],_0x3459a3[_0x81bd('0x6')]));utils[_0x81bd('0xa')](_0x81bd('0xb'),_0x3459a3);}exports['blinds']={};exports['blindtransfer']=function(_0x2ac9c7){try{utils[_0x81bd('0xc')](util['format']('[%s][transfers][blindtransfer]',_0x2ac9c7[_0x81bd('0x9')]),_0x2ac9c7);utils['info'](util['format'](_0x81bd('0xd'),_0x2ac9c7[_0x81bd('0x9')],_0x2ac9c7['transferercalleridnum'],_0x2ac9c7[_0x81bd('0xe')],_0x2ac9c7[_0x81bd('0xf')],_0x2ac9c7[_0x81bd('0x10')]));_0x2ac9c7[_0x81bd('0x6')]=_0x81bd('0x11');exports['blinds'][_0x2ac9c7[_0x81bd('0x12')]]=_0x2ac9c7;writeDB(_0x2ac9c7);}catch(_0x2fb7f1){utils[_0x81bd('0x13')](util['format']('[%s][transfers][blindtransfer]',_0x2ac9c7[_0x81bd('0x9')]),_0x2fb7f1);}};exports[_0x81bd('0x14')]=function(_0x59e09e){try{utils[_0x81bd('0xc')](util['format'](_0x81bd('0x15'),_0x59e09e[_0x81bd('0x8')]),_0x59e09e);utils[_0x81bd('0x3')](util[_0x81bd('0x4')](_0x81bd('0x16'),_0x59e09e['origtransfereruniqueid'],_0x59e09e[_0x81bd('0x17')],_0x59e09e[_0x81bd('0x18')],_0x59e09e[_0x81bd('0x19')],_0x59e09e[_0x81bd('0x1a')]));_0x59e09e=_[_0x81bd('0x1b')](_0x59e09e,{'transfererchannel':_0x59e09e[_0x81bd('0x1c')],'transferercalleridnum':_0x59e09e[_0x81bd('0x17')],'transferercalleridname':_0x59e09e[_0x81bd('0x18')],'transfererconnectedlinenum':_0x59e09e[_0x81bd('0x1d')],'transfererconnectedlinename':_0x59e09e[_0x81bd('0x1e')],'transfereraccountcode':_0x59e09e[_0x81bd('0x1f')],'transferercontext':_0x59e09e[_0x81bd('0x20')],'transfererexten':_0x59e09e[_0x81bd('0x21')],'transfererlinkedid':_0x59e09e[_0x81bd('0x22')],'context':_0x59e09e[_0x81bd('0x23')],'extension':_0x59e09e[_0x81bd('0x24')],'type':'attended'});if(_[_0x81bd('0x25')](_0x59e09e[_0x81bd('0x26')])){_0x59e09e=_[_0x81bd('0x1b')](_0x59e09e,{'transfereechannel':_0x59e09e[_0x81bd('0x27')],'transfereecalleridnum':_0x59e09e[_0x81bd('0x19')],'transfereecalleridname':_0x59e09e[_0x81bd('0x1a')],'transfereeconnectedlinenum':_0x59e09e[_0x81bd('0x28')],'transfereeconnectedlinename':_0x59e09e[_0x81bd('0x29')],'transfereeaccountcode':_0x59e09e[_0x81bd('0x2a')],'transfereecontext':_0x59e09e['transfertargetcontext'],'transfereeexten':_0x59e09e['transfertargetexten'],'transfereelinkedid':_0x59e09e[_0x81bd('0x2b')]});}writeDB(_0x59e09e);}catch(_0x1bc681){utils['error'](util[_0x81bd('0x4')](_0x81bd('0x15'),_0x59e09e[_0x81bd('0x8')]),_0x1bc681);}}; \ No newline at end of file +var _0x6559=['[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','type','CreateVoiceTransferReport','debug'];(function(_0x23009f,_0x13b826){var _0x58b937=function(_0x4b0e58){while(--_0x4b0e58){_0x23009f['push'](_0x23009f['shift']());}};_0x58b937(++_0x13b826);}(_0x6559,0x1ca));var _0x9655=function(_0x7f96cb,_0x11b2da){_0x7f96cb=_0x7f96cb-0x0;var _0x1b3010=_0x6559[_0x7f96cb];return _0x1b3010;};'use strict';var _=require(_0x9655('0x0'));var util=require('util');var utils=require(_0x9655('0x1'));function writeDB(_0x5b043d){utils[_0x9655('0x2')](util[_0x9655('0x3')](_0x9655('0x4'),_0x5b043d['type']===_0x9655('0x5')?_0x5b043d['origtransfereruniqueid']:_0x5b043d[_0x9655('0x6')],_0x5b043d[_0x9655('0x7')]));utils['request'](_0x9655('0x8'),_0x5b043d);}exports['blinds']={};exports['blindtransfer']=function(_0x599dd0){try{utils[_0x9655('0x9')](util[_0x9655('0x3')](_0x9655('0xa'),_0x599dd0[_0x9655('0x6')]),_0x599dd0);utils[_0x9655('0x2')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x599dd0[_0x9655('0x6')],_0x599dd0[_0x9655('0xb')],_0x599dd0[_0x9655('0xc')],_0x599dd0[_0x9655('0xd')],_0x599dd0[_0x9655('0xe')]));_0x599dd0[_0x9655('0x7')]='blind';exports['blinds'][_0x599dd0[_0x9655('0xf')]]=_0x599dd0;writeDB(_0x599dd0);}catch(_0x58a77f){utils[_0x9655('0x10')](util[_0x9655('0x3')](_0x9655('0xa'),_0x599dd0[_0x9655('0x6')]),_0x58a77f);}};exports[_0x9655('0x11')]=function(_0x2313ff){try{utils[_0x9655('0x9')](util['format'](_0x9655('0x12'),_0x2313ff[_0x9655('0x13')]),_0x2313ff);utils['info'](util['format'](_0x9655('0x14'),_0x2313ff[_0x9655('0x13')],_0x2313ff[_0x9655('0x15')],_0x2313ff[_0x9655('0x16')],_0x2313ff[_0x9655('0x17')],_0x2313ff[_0x9655('0x18')]));_0x2313ff=_[_0x9655('0x19')](_0x2313ff,{'transfererchannel':_0x2313ff[_0x9655('0x1a')],'transferercalleridnum':_0x2313ff[_0x9655('0x15')],'transferercalleridname':_0x2313ff[_0x9655('0x16')],'transfererconnectedlinenum':_0x2313ff[_0x9655('0x1b')],'transfererconnectedlinename':_0x2313ff[_0x9655('0x1c')],'transfereraccountcode':_0x2313ff['origtransfereraccountcode'],'transferercontext':_0x2313ff[_0x9655('0x1d')],'transfererexten':_0x2313ff[_0x9655('0x1e')],'transfererlinkedid':_0x2313ff['origtransfererlinkedid'],'context':_0x2313ff[_0x9655('0x1f')],'extension':_0x2313ff[_0x9655('0x20')],'type':'attended'});if(_[_0x9655('0x21')](_0x2313ff[_0x9655('0x22')])){_0x2313ff=_['assign'](_0x2313ff,{'transfereechannel':_0x2313ff[_0x9655('0x23')],'transfereecalleridnum':_0x2313ff[_0x9655('0x17')],'transfereecalleridname':_0x2313ff[_0x9655('0x18')],'transfereeconnectedlinenum':_0x2313ff[_0x9655('0x24')],'transfereeconnectedlinename':_0x2313ff['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2313ff[_0x9655('0x25')],'transfereecontext':_0x2313ff[_0x9655('0x26')],'transfereeexten':_0x2313ff['transfertargetexten'],'transfereelinkedid':_0x2313ff['transfertargetlinkedid']});}writeDB(_0x2313ff);}catch(_0x2ad8c){utils[_0x9655('0x10')](util[_0x9655('0x3')](_0x9655('0x12'),_0x2313ff['origtransfereruniqueid']),_0x2ad8c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 03f4202..248fed0 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 _0xced7=['type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','subtractTime','subtract','seconds','format','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xced7,0xc7));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x7ced('0x0'));var jayson=require(_0x7ced('0x1'));var moment=require(_0x7ced('0x2'));var util=require(_0x7ced('0x3'));var client=jayson[_0x7ced('0x4')][_0x7ced('0x5')]({'port':0x2329});var logger=require(_0x7ced('0x6'))(_0x7ced('0x7'));exports[_0x7ced('0x8')]=function(_0x58a642,_0x1caa0d){logger[_0x7ced('0x8')](_0x58a642,_0x1caa0d?util[_0x7ced('0x9')](_0x1caa0d,{'showHidden':![],'depth':null}):'');};exports[_0x7ced('0xa')]=function(_0x1bb692,_0x2229cb){logger[_0x7ced('0xa')](_0x1bb692,_0x2229cb?util[_0x7ced('0x9')](_0x2229cb,{'showHidden':![],'depth':null}):'');};exports[_0x7ced('0xb')]=function(_0x1a61a7,_0x3e2627){logger['error'](_0x1a61a7,_0x3e2627?util[_0x7ced('0x9')](_0x3e2627,{'showHidden':![],'depth':null}):'');};exports[_0x7ced('0xc')]=function(_0x2475be,_0x7a2bae){return client[_0x7ced('0xc')](_0x2475be,{'body':_0x7a2bae})[_0x7ced('0xd')](function(_0x56fa6d){logger[_0x7ced('0xa')](_0x7ced('0xe'),_0x2475be,_0x56fa6d?util[_0x7ced('0x9')](_0x56fa6d,{'showHidden':![],'depth':null}):'');})[_0x7ced('0xf')](function(_0x326002){logger[_0x7ced('0xb')](_0x7ced('0xe'),_0x2475be,_0x326002?util[_0x7ced('0x9')](_0x326002,{'showHidden':![],'depth':null}):'');});};function getUser(_0x20eb4f){return client[_0x7ced('0xc')](_0x7ced('0x10'),{'options':{'raw':!![],'attributes':['id',_0x7ced('0x11'),'name','interface'],'where':_0x20eb4f,'limit':0x1}})['then'](function(_0x4c3095){logger[_0x7ced('0xa')](_0x7ced('0x12'),JSON[_0x7ced('0x13')](_0x20eb4f),_0x4c3095?util[_0x7ced('0x9')](_0x4c3095,{'showHidden':![],'depth':null}):'');return _0x4c3095[_0x7ced('0x14')][_0x7ced('0x15')]?_0x4c3095[_0x7ced('0x14')][0x0]:null;});}exports['getUserByInternal']=function(_0x4c5f41){return new BPromise(function(_0x25fcad,_0x2ec70a){if(_0x4c5f41){return getUser({'internal':_0x4c5f41})[_0x7ced('0xd')](function(_0x186c3b){logger[_0x7ced('0x8')](_0x7ced('0x16'),_0x4c5f41,_0x186c3b?'found':_0x7ced('0x17'));return _0x25fcad(_0x186c3b);})[_0x7ced('0xf')](function(_0xcc6faa){logger['error']('[utils][getUserByInternal]',_0xcc6faa?util['inspect'](_0xcc6faa,{'showHidden':![],'depth':null}):'');return _0x25fcad(null);});}return _0x25fcad(null);});};exports[_0x7ced('0x18')]=function(_0x4dc200){return new BPromise(function(_0x4dab4a,_0x7be5cb){if(_0x4dc200){return getUser({'interface':_0x4dc200})[_0x7ced('0xd')](function(_0x4768b6){logger[_0x7ced('0x8')](_0x7ced('0x19'),_0x4dc200,_0x4768b6?_0x7ced('0x1a'):'notfound');return _0x4dab4a(_0x4768b6);})[_0x7ced('0xf')](function(_0x13fd9a){logger[_0x7ced('0xb')](_0x7ced('0x1b'),_0x13fd9a?util[_0x7ced('0x9')](_0x13fd9a,{'showHidden':![],'depth':null}):'');return _0x4dab4a(null);});}return _0x4dab4a(null);});};exports['getUserByName']=function(_0x46e5ab){return new BPromise(function(_0x33a9db,_0x2b2d55){if(_0x46e5ab){return getUser({'name':_0x46e5ab})['then'](function(_0x15527b){logger[_0x7ced('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x46e5ab,_0x15527b?'found':_0x7ced('0x17'));return _0x33a9db(_0x15527b);})[_0x7ced('0xf')](function(_0xa095df){logger[_0x7ced('0xb')](_0x7ced('0x1c'),_0xa095df?util['inspect'](_0xa095df,{'showHidden':![],'depth':null}):'');return _0x33a9db(null);});}return _0x33a9db(null);});};exports[_0x7ced('0x1d')]=function(_0x29e426){return new BPromise(function(_0x1bca00,_0x397506){if(_0x29e426){return client[_0x7ced('0xc')](_0x7ced('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0x7ced('0x1f'),'acw',_0x7ced('0x20')],'where':{'name':_0x29e426},'limit':0x1}})[_0x7ced('0xd')](function(_0x5ec3f0){logger[_0x7ced('0xa')](_0x7ced('0x21'),_0x29e426,_0x5ec3f0?util[_0x7ced('0x9')](_0x5ec3f0,{'showHidden':![],'depth':null}):'');logger[_0x7ced('0x8')](_0x7ced('0x22'),_0x29e426,_0x5ec3f0?_0x7ced('0x1a'):_0x7ced('0x17'));return _0x1bca00(_0x5ec3f0[_0x7ced('0x14')][_0x7ced('0x15')]?_0x5ec3f0[_0x7ced('0x14')][0x0]:null);})['catch'](function(_0x52d0e3){logger['error'](_0x7ced('0x23'),_0x52d0e3?util['inspect'](_0x52d0e3,{'showHidden':![],'depth':null}):'');return _0x1bca00(null);});}return _0x1bca00(null);});};exports[_0x7ced('0x24')]=function(_0x3c664c,_0x39aed7){return moment(_0x3c664c)['add'](_0x39aed7,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7ced('0x25')]=function(_0x5360a7,_0x36e260){return moment(_0x5360a7)[_0x7ced('0x26')](_0x36e260,_0x7ced('0x27'))[_0x7ced('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7ced('0x29')]=function(_0x2cfeab,_0x1141ab){return moment(_0x2cfeab)['diff'](moment(_0x1141ab),_0x7ced('0x27'));};exports[_0x7ced('0x2a')]=function(_0x3806e9,_0x30666a){return parseInt(_0x3806e9,0xa)+parseInt(_0x30666a,0xa);};exports[_0x7ced('0x2b')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7ced('0x2c')]=function(_0x11579d,_0x1beaaa){if(_0x1beaaa){return moment(_0x11579d)[_0x7ced('0x2c')](_0x1beaaa);}return!![];};exports['isBefore']=function(_0x446325,_0x503899){if(_0x503899){return moment(_0x446325)[_0x7ced('0x2d')](_0x503899);}else if(_0x446325){return!![];}return![];}; \ No newline at end of file +var _0x01db=['[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diff','seconds','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','name','interface'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x01db,0x7b));var _0xb01d=function(_0x5123a7,_0x90a77a){_0x5123a7=_0x5123a7-0x0;var _0x386278=_0x01db[_0x5123a7];return _0x386278;};'use strict';var BPromise=require(_0xb01d('0x0'));var jayson=require(_0xb01d('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xb01d('0x2')][_0xb01d('0x3')]({'port':0x2329});var logger=require(_0xb01d('0x4'))(_0xb01d('0x5'));exports['info']=function(_0x2e5525,_0x48324c){logger[_0xb01d('0x6')](_0x2e5525,_0x48324c?util[_0xb01d('0x7')](_0x48324c,{'showHidden':![],'depth':null}):'');};exports[_0xb01d('0x8')]=function(_0x40d904,_0x1b5df8){logger['debug'](_0x40d904,_0x1b5df8?util['inspect'](_0x1b5df8,{'showHidden':![],'depth':null}):'');};exports[_0xb01d('0x9')]=function(_0x592133,_0x3c90a5){logger[_0xb01d('0x9')](_0x592133,_0x3c90a5?util[_0xb01d('0x7')](_0x3c90a5,{'showHidden':![],'depth':null}):'');};exports[_0xb01d('0xa')]=function(_0x57c56e,_0x2bbb3c){return client['request'](_0x57c56e,{'body':_0x2bbb3c})[_0xb01d('0xb')](function(_0x1df6a1){logger[_0xb01d('0x8')]('[utils][request]\x20name:%s',_0x57c56e,_0x1df6a1?util[_0xb01d('0x7')](_0x1df6a1,{'showHidden':![],'depth':null}):'');})[_0xb01d('0xc')](function(_0x18e132){logger['error']('[utils][request]\x20name:%s',_0x57c56e,_0x18e132?util[_0xb01d('0x7')](_0x18e132,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2c7c54){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xb01d('0xd'),_0xb01d('0xe')],'where':_0x2c7c54,'limit':0x1}})[_0xb01d('0xb')](function(_0x568d00){logger[_0xb01d('0x8')](_0xb01d('0xf'),JSON[_0xb01d('0x10')](_0x2c7c54),_0x568d00?util[_0xb01d('0x7')](_0x568d00,{'showHidden':![],'depth':null}):'');return _0x568d00[_0xb01d('0x11')][_0xb01d('0x12')]?_0x568d00[_0xb01d('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0x17543c){return new BPromise(function(_0x70274e,_0x1534cf){if(_0x17543c){return getUser({'internal':_0x17543c})[_0xb01d('0xb')](function(_0x306126){logger['info'](_0xb01d('0x13'),_0x17543c,_0x306126?'found':_0xb01d('0x14'));return _0x70274e(_0x306126);})[_0xb01d('0xc')](function(_0x73788e){logger[_0xb01d('0x9')](_0xb01d('0x15'),_0x73788e?util[_0xb01d('0x7')](_0x73788e,{'showHidden':![],'depth':null}):'');return _0x70274e(null);});}return _0x70274e(null);});};exports[_0xb01d('0x16')]=function(_0x10f3cb){return new BPromise(function(_0x1cdd1f,_0x4eead4){if(_0x10f3cb){return getUser({'interface':_0x10f3cb})[_0xb01d('0xb')](function(_0x51d28a){logger[_0xb01d('0x6')](_0xb01d('0x17'),_0x10f3cb,_0x51d28a?_0xb01d('0x18'):_0xb01d('0x14'));return _0x1cdd1f(_0x51d28a);})[_0xb01d('0xc')](function(_0x40cd03){logger['error'](_0xb01d('0x19'),_0x40cd03?util[_0xb01d('0x7')](_0x40cd03,{'showHidden':![],'depth':null}):'');return _0x1cdd1f(null);});}return _0x1cdd1f(null);});};exports['getUserByName']=function(_0xba1480){return new BPromise(function(_0x44d467,_0x9959ea){if(_0xba1480){return getUser({'name':_0xba1480})[_0xb01d('0xb')](function(_0x189fd0){logger[_0xb01d('0x6')](_0xb01d('0x1a'),_0xba1480,_0x189fd0?_0xb01d('0x18'):_0xb01d('0x14'));return _0x44d467(_0x189fd0);})[_0xb01d('0xc')](function(_0xc7de70){logger[_0xb01d('0x9')](_0xb01d('0x1b'),_0xc7de70?util[_0xb01d('0x7')](_0xc7de70,{'showHidden':![],'depth':null}):'');return _0x44d467(null);});}return _0x44d467(null);});};exports[_0xb01d('0x1c')]=function(_0x522de2){return new BPromise(function(_0x367772,_0x40c233){if(_0x522de2){return client['request'](_0xb01d('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xb01d('0xd'),_0xb01d('0x1e'),_0xb01d('0x1f'),_0xb01d('0x20')],'where':{'name':_0x522de2},'limit':0x1}})['then'](function(_0x3547f8){logger['debug'](_0xb01d('0x21'),_0x522de2,_0x3547f8?util['inspect'](_0x3547f8,{'showHidden':![],'depth':null}):'');logger[_0xb01d('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x522de2,_0x3547f8?_0xb01d('0x18'):_0xb01d('0x14'));return _0x367772(_0x3547f8[_0xb01d('0x11')][_0xb01d('0x12')]?_0x3547f8[_0xb01d('0x11')][0x0]:null);})['catch'](function(_0x1a9392){logger[_0xb01d('0x9')](_0xb01d('0x22'),_0x1a9392?util['inspect'](_0x1a9392,{'showHidden':![],'depth':null}):'');return _0x367772(null);});}return _0x367772(null);});};exports[_0xb01d('0x23')]=function(_0x11dc44,_0x103442){return moment(_0x11dc44)['add'](_0x103442,'seconds')['format'](_0xb01d('0x24'));};exports[_0xb01d('0x25')]=function(_0x43081c,_0x2f5f38){return moment(_0x43081c)[_0xb01d('0x26')](_0x2f5f38,'seconds')[_0xb01d('0x27')](_0xb01d('0x24'));};exports['diffTime']=function(_0x4f39a1,_0x350bb3){return moment(_0x4f39a1)[_0xb01d('0x28')](moment(_0x350bb3),_0xb01d('0x29'));};exports[_0xb01d('0x2a')]=function(_0x2d1201,_0x1c13b9){return parseInt(_0x2d1201,0xa)+parseInt(_0x1c13b9,0xa);};exports[_0xb01d('0x2b')]=function(){return moment()[_0xb01d('0x27')](_0xb01d('0x24'));};exports['isAfter']=function(_0x18b2b8,_0x6a9359){if(_0x6a9359){return moment(_0x18b2b8)[_0xb01d('0x2c')](_0x6a9359);}return!![];};exports[_0xb01d('0x2d')]=function(_0x178301,_0x5685f2){if(_0x5685f2){return moment(_0x178301)[_0xb01d('0x2d')](_0x5685f2);}else if(_0x178301){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 63c1595..d314ed6 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x811b=['client','role','name','ensureDir','catch','user','then','no-user','data','timestamp','error','api','auth','set','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','statusCode','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','responseTime','agent_name','test','url','setupLoggers','fs-extra','path','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally'];(function(_0x25362f,_0x12e601){var _0x34d3a5=function(_0x395cba){while(--_0x395cba){_0x25362f['push'](_0x25362f['shift']());}};_0x34d3a5(++_0x12e601);}(_0x811b,0x1a4));var _0xb811=function(_0x78d11b,_0x1c2611){_0x78d11b=_0x78d11b-0x0;var _0x5f2e27=_0x811b[_0x78d11b];return _0x5f2e27;};var fs=require(_0xb811('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require(_0xb811('0x1'));var util=require(_0xb811('0x2'));var fileLogger=require(_0xb811('0x3'))[_0xb811('0x4')];var safeTemplate=require(_0xb811('0x5'))['safeTemplate'];var maskSensitiveData=require(_0xb811('0x6'))[_0xb811('0x7')];function ClientSideLogger(){function _0x2c351e(_0x1a86eb){var _0x8f45e=path[_0xb811('0x8')](_0xb811('0x9'),_0xb811('0xa'),_0xb811('0xb'));var _0x53d4b8=path[_0xb811('0x8')](_0xb811('0xc'),_0x1a86eb[_0xb811('0xd')]+'-'+_0x1a86eb[_0xb811('0xe')]);return fs[_0xb811('0xf')](path[_0xb811('0x8')](_0x8f45e,_0x53d4b8))['then'](function(){var _0x422c7f=fileLogger('client',path[_0xb811('0x8')](_0x8f45e,_0x53d4b8));return _0x422c7f;})[_0xb811('0x10')](function(_0x34f0d1){throw _0x34f0d1;});}this[_0xb811('0xa')]=function(_0x45670d,_0x2e4318,_0x4e9600,_0xf2f371){return _0x2c351e(_0x45670d[_0xb811('0x11')])[_0xb811('0x12')](function(_0x210ae6){var _0x31e569=_0x210ae6[_0x2e4318];return _0x31e569;})[_0xb811('0x12')](function(_0x3dae41){var _0x246699=_0x45670d[_0xb811('0x11')]?_0x45670d['user']['id']:_0xb811('0x13');var _0x3bcd13=_0xf2f371[_0xb811('0x14')];var _0x36898f=_0xf2f371[_0xb811('0x15')];var _0x1ab806=new Date(Number(_0x36898f));return _0x3dae41(_0x246699,_0x1ab806,_0x4e9600,_0x3bcd13);})['catch'](function(_0x44705f){fileLogger(_0xb811('0xc'))[_0xb811('0x16')](_0x44705f);});};}function setupLoggers(_0x5e44ce){return new Promise(function(_0x2a143c){var _0x23501b=new ClientSideLogger();var _0x1d3d12=fileLogger(_0xb811('0x17'));var _0x439534=fileLogger(_0xb811('0x18'));_0x5e44ce[_0xb811('0x19')]('client-side-logger',_0x23501b);_0x5e44ce['use'](ewinston['logger']({'winstonInstance':_0x1d3d12,'meta':![],'statusLevels':!![],'msg':function(_0x2ff3a1,_0x9b12b1){var _0x9cc7e=_0xb811('0x1a');if(!_[_0xb811('0x1b')](_0x2ff3a1[_0xb811('0x1c')])){_0x9cc7e+=_0xb811('0x1d');var _0x28eac5=_0x2ff3a1[_0xb811('0x1c')];maskSensitiveData(_0x28eac5);}return safeTemplate(util[_0xb811('0x1e')](_0x9cc7e,_0x2ff3a1['method'],_0x2ff3a1[_0xb811('0x1f')][_0xb811('0x20')]?_0x2ff3a1[_0xb811('0x1f')][_0xb811('0x20')]:_0x2ff3a1[_0xb811('0x21')][_0xb811('0x22')]||_0x2ff3a1['ip'],_0x2ff3a1['url'],_0x9b12b1[_0xb811('0x23')],_0x9b12b1['responseTime'],_0x2ff3a1['user']?_0x2ff3a1[_0xb811('0x11')]['id']:null,_0x2ff3a1[_0xb811('0x11')]?_0x2ff3a1['user'][_0xb811('0xe')]:null,_0x2ff3a1['user']?_0x2ff3a1[_0xb811('0x11')]['role']:null,_0x28eac5?util[_0xb811('0x24')](_0x28eac5,![],null):''));}}));_0x5e44ce[_0xb811('0x25')](ewinston['logger']({'winstonInstance':_0x439534,'meta':![],'statusLevels':!![],'msg':function(_0x67a362,_0x42c3c3){var _0x27219c=_0xb811('0x26');if(_0x67a362[_0xb811('0x1c')]&&_0x67a362[_0xb811('0x1c')][_0xb811('0x27')]&&_0x67a362[_0xb811('0x1c')][_0xb811('0x28')]){_0x27219c=_0xb811('0x29');}return util[_0xb811('0x1e')](_0x27219c,_0x67a362[_0xb811('0x2a')],_0x67a362[_0xb811('0x1f')][_0xb811('0x20')]?_0x67a362[_0xb811('0x1f')][_0xb811('0x20')]:_0x67a362['connection']['remoteAddress']||_0x67a362['ip'],_0x67a362['url'],_0x42c3c3['statusCode'],_0x42c3c3[_0xb811('0x2b')],_0x67a362[_0xb811('0x11')]?_0x67a362['user']['id']:null,_0x67a362[_0xb811('0x11')]?_0x67a362[_0xb811('0x11')][_0xb811('0xe')]:null,_0x67a362[_0xb811('0x11')]?_0x67a362[_0xb811('0x11')][_0xb811('0xd')]:null,_0x67a362[_0xb811('0x1c')]&&_0x67a362[_0xb811('0x1c')][_0xb811('0x27')]?_0x67a362[_0xb811('0x1c')]['device']:'other',_0x67a362[_0xb811('0x1c')]&&_0x67a362['body'][_0xb811('0x28')]?_0x67a362[_0xb811('0x1c')][_0xb811('0x28')]:'',_0x67a362[_0xb811('0x1c')]&&_0x67a362['body'][_0xb811('0x2c')]?_0x67a362[_0xb811('0x1c')][_0xb811('0x2c')]:'');},'ignoreRoute':function(_0xa4afe1){var _0x1c3099=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1c3099[_0xb811('0x2d')](_0xa4afe1[_0xb811('0x2e')]);}}));return _0x2a143c();});}exports[_0xb811('0x2f')]=setupLoggers; \ No newline at end of file +var _0x0464=['user','no-user','data','timestamp','catch','error','api','auth','set','use','logger','isEmpty','body','\x20body=%s','format','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','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)','method','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./safe-template','./mask-sensitive-data','join','/var','log','xcally','role','name','ensureDir','then','client'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0x0464,0x10a));var _0x4046=function(_0x31caa9,_0x369d05){_0x31caa9=_0x31caa9-0x0;var _0x2eb0f1=_0x0464[_0x31caa9];return _0x2eb0f1;};var fs=require(_0x4046('0x0'));var _=require(_0x4046('0x1'));var ewinston=require(_0x4046('0x2'));var path=require(_0x4046('0x3'));var util=require(_0x4046('0x4'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0x4046('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x4046('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x5ca83b(_0xeb445a){var _0x418b17=path[_0x4046('0x7')](_0x4046('0x8'),_0x4046('0x9'),_0x4046('0xa'));var _0x1ff6e8=path[_0x4046('0x7')]('client',_0xeb445a[_0x4046('0xb')]+'-'+_0xeb445a[_0x4046('0xc')]);return fs[_0x4046('0xd')](path['join'](_0x418b17,_0x1ff6e8))[_0x4046('0xe')](function(){var _0x14bb95=fileLogger(_0x4046('0xf'),path[_0x4046('0x7')](_0x418b17,_0x1ff6e8));return _0x14bb95;})['catch'](function(_0x5ccb81){throw _0x5ccb81;});}this[_0x4046('0x9')]=function(_0x2e52c8,_0x113a7c,_0x2cf165,_0x3d527e){return _0x5ca83b(_0x2e52c8[_0x4046('0x10')])[_0x4046('0xe')](function(_0x39afe0){var _0x34d970=_0x39afe0[_0x113a7c];return _0x34d970;})[_0x4046('0xe')](function(_0x3195bf){var _0xa65b18=_0x2e52c8[_0x4046('0x10')]?_0x2e52c8['user']['id']:_0x4046('0x11');var _0x217c3d=_0x3d527e[_0x4046('0x12')];var _0x371b6c=_0x3d527e[_0x4046('0x13')];var _0x3bbae5=new Date(Number(_0x371b6c));return _0x3195bf(_0xa65b18,_0x3bbae5,_0x2cf165,_0x217c3d);})[_0x4046('0x14')](function(_0x39d315){fileLogger(_0x4046('0xf'))[_0x4046('0x15')](_0x39d315);});};}function setupLoggers(_0x395bd5){return new Promise(function(_0xd922a4){var _0x1e3bff=new ClientSideLogger();var _0x5a0438=fileLogger(_0x4046('0x16'));var _0x72065e=fileLogger(_0x4046('0x17'));_0x395bd5[_0x4046('0x18')]('client-side-logger',_0x1e3bff);_0x395bd5[_0x4046('0x19')](ewinston[_0x4046('0x1a')]({'winstonInstance':_0x5a0438,'meta':![],'statusLevels':!![],'msg':function(_0x347815,_0x4de0bf){var _0x19f1b0='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x4046('0x1b')](_0x347815[_0x4046('0x1c')])){_0x19f1b0+=_0x4046('0x1d');var _0x38b194=_0x347815['body'];maskSensitiveData(_0x38b194);}return safeTemplate(util[_0x4046('0x1e')](_0x19f1b0,_0x347815['method'],_0x347815['headers'][_0x4046('0x1f')]?_0x347815[_0x4046('0x20')]['x-forwarded-for']:_0x347815[_0x4046('0x21')][_0x4046('0x22')]||_0x347815['ip'],_0x347815[_0x4046('0x23')],_0x4de0bf[_0x4046('0x24')],_0x4de0bf[_0x4046('0x25')],_0x347815[_0x4046('0x10')]?_0x347815[_0x4046('0x10')]['id']:null,_0x347815['user']?_0x347815['user']['name']:null,_0x347815['user']?_0x347815['user'][_0x4046('0xb')]:null,_0x38b194?util[_0x4046('0x26')](_0x38b194,![],null):''));}}));_0x395bd5[_0x4046('0x19')](ewinston[_0x4046('0x1a')]({'winstonInstance':_0x72065e,'meta':![],'statusLevels':!![],'msg':function(_0x2a5480,_0xd05b69){var _0x42be18='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2a5480[_0x4046('0x1c')]&&_0x2a5480[_0x4046('0x1c')][_0x4046('0x27')]&&_0x2a5480[_0x4046('0x1c')][_0x4046('0x28')]){_0x42be18=_0x4046('0x29');}return util['format'](_0x42be18,_0x2a5480[_0x4046('0x2a')],_0x2a5480[_0x4046('0x20')][_0x4046('0x1f')]?_0x2a5480[_0x4046('0x20')][_0x4046('0x1f')]:_0x2a5480['connection']['remoteAddress']||_0x2a5480['ip'],_0x2a5480[_0x4046('0x23')],_0xd05b69[_0x4046('0x24')],_0xd05b69[_0x4046('0x25')],_0x2a5480[_0x4046('0x10')]?_0x2a5480[_0x4046('0x10')]['id']:null,_0x2a5480[_0x4046('0x10')]?_0x2a5480['user'][_0x4046('0xc')]:null,_0x2a5480[_0x4046('0x10')]?_0x2a5480[_0x4046('0x10')][_0x4046('0xb')]:null,_0x2a5480[_0x4046('0x1c')]&&_0x2a5480[_0x4046('0x1c')]['device']?_0x2a5480[_0x4046('0x1c')][_0x4046('0x27')]:_0x4046('0x2b'),_0x2a5480['body']&&_0x2a5480[_0x4046('0x1c')][_0x4046('0x28')]?_0x2a5480[_0x4046('0x1c')][_0x4046('0x28')]:'',_0x2a5480[_0x4046('0x1c')]&&_0x2a5480[_0x4046('0x1c')][_0x4046('0x2c')]?_0x2a5480['body'][_0x4046('0x2c')]:'');},'ignoreRoute':function(_0x3a6465){var _0x13c157=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x13c157[_0x4046('0x2d')](_0x3a6465[_0x4046('0x23')]);}}));return _0xd922a4();});}exports[_0x4046('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index eecaca4..ff06340 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1287=['Logger','error','File','%s-%s','consoleLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','%s-%s.log','message','replace','{{{','format','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','transports','Console','warn'];(function(_0x431af1,_0x546240){var _0x5187a3=function(_0x805b4a){while(--_0x805b4a){_0x431af1['push'](_0x431af1['shift']());}};_0x5187a3(++_0x546240);}(_0x1287,0x71));var _0x7128=function(_0x66af67,_0x4b0284){_0x66af67=_0x66af67-0x0;var _0x4202a9=_0x1287[_0x66af67];return _0x4202a9;};'use strict';var path=require(_0x7128('0x0'));var util=require(_0x7128('0x1'));var moment=require(_0x7128('0x2'));var winston=require(_0x7128('0x3'));var config=require(_0x7128('0x4'));var debugLevel=config[_0x7128('0x5')]?config['debugLevel'][_0x7128('0x6')]():_0x7128('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x7128('0x8'),'warn':'bold\x20yellow','info':_0x7128('0x9'),'print':_0x7128('0xa'),'success':_0x7128('0xb'),'http':_0x7128('0xc'),'verbose':_0x7128('0xd'),'debug':_0x7128('0xe'),'silly':_0x7128('0xf')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x1f66e0,_0x1f7895,_0x35d9c6){var _0x5aa83a=_0x1f66e0||'/var/log/xcally';return path['join'](_0x5aa83a,util['format'](_0x7128('0x10'),_0x1f7895,_0x35d9c6));}function formatter(_0x2a921c,_0x6416c2){_0x6416c2[_0x7128('0x11')]=_0x6416c2['message'][_0x7128('0x12')](/@@{/g,_0x7128('0x13'))[_0x7128('0x12')](/}@@/g,'}}}')[_0x7128('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x7128('0x14')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x7128('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),_0x6416c2['level'][_0x7128('0x15')](),_0x2a921c,_0x6416c2[_0x7128('0x11')]);}function fileFormat(_0x271b90,_0x3fe8f1){_0x3fe8f1[_0x7128('0x11')]=_0x3fe8f1[_0x7128('0x11')][_0x7128('0x12')](/@@{/g,'{{{')[_0x7128('0x12')](/}@@/g,'}}}')[_0x7128('0x12')](/@{/g,'{{')[_0x7128('0x12')](/}@/g,'}}');var _0x1e77ea=_0x3fe8f1[_0x7128('0x16')]&&Object[_0x7128('0x17')](_0x3fe8f1[_0x7128('0x16')])[_0x7128('0x18')]?'\x0a\x09'+JSON[_0x7128('0x19')](_0x3fe8f1[_0x7128('0x16')]):'';return util[_0x7128('0x14')](_0x7128('0x1a'),moment()[_0x7128('0x14')](_0x7128('0x1b')),_0x3fe8f1['level'][_0x7128('0x15')](),_0x271b90,_0x3fe8f1[_0x7128('0x11')],_0x1e77ea);}function consoleLogger(){var _0x52c5e6=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7128('0x1c'))][(_0x7128('0x1d'))]({'level':_0x7128('0x1e'),'json':![],'formatter':function(_0x3b3b74){return formatter('',_0x3b3b74);}})]});return _0x52c5e6;}function fileLogger(_0x5ab4d4,_0x154088){var _0x368c50=new winston[(_0x7128('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7128('0x1c'))]['File']({'name':util[_0x7128('0x14')]('%s-%s',_0x5ab4d4,_0x7128('0x20')),'filename':getLogFileName(_0x154088,_0x5ab4d4,_0x7128('0x20')),'level':_0x7128('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1fd449){return fileFormat(_0x5ab4d4,_0x1fd449);}}),new winston['transports'][(_0x7128('0x21'))]({'name':util[_0x7128('0x14')](_0x7128('0x22'),_0x5ab4d4,debugLevel),'filename':getLogFileName(_0x154088,_0x5ab4d4,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x39408b){return fileFormat(_0x5ab4d4,_0x39408b);}}),new winston['transports'][(_0x7128('0x1d'))]({'level':_0x7128('0x1e'),'json':![],'formatter':function(_0x44bd63){return fileFormat(_0x5ab4d4,_0x44bd63);}})]});return _0x368c50;}exports[_0x7128('0x23')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xf368=['Logger','transports','File','%s-%s','error','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20blue','bold\x20cyan','addColors','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','}}}','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Console','warn'];(function(_0x187718,_0x427383){var _0x29ddf4=function(_0x2ec62a){while(--_0x2ec62a){_0x187718['push'](_0x187718['shift']());}};_0x29ddf4(++_0x427383);}(_0xf368,0x13e));var _0x8f36=function(_0x2b8569,_0x3c25e2){_0x2b8569=_0x2b8569-0x0;var _0x4e8b61=_0xf368[_0x2b8569];return _0x4e8b61;};'use strict';var path=require(_0x8f36('0x0'));var util=require(_0x8f36('0x1'));var moment=require(_0x8f36('0x2'));var winston=require(_0x8f36('0x3'));var config=require('../config/environment');var debugLevel=config[_0x8f36('0x4')]?config[_0x8f36('0x4')][_0x8f36('0x5')]():_0x8f36('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x8f36('0x7'),'error':_0x8f36('0x8'),'warn':_0x8f36('0x9'),'info':_0x8f36('0xa'),'print':'bold\x20white','success':_0x8f36('0xb'),'http':_0x8f36('0xc'),'verbose':'bold\x20magenta','debug':_0x8f36('0xd'),'silly':_0x8f36('0xe')};winston[_0x8f36('0xf')](XC_LOG_COLORS);function getLogFileName(_0xb26dd3,_0x3f66c5,_0x3753f2){var _0x4987af=_0xb26dd3||'/var/log/xcally';return path['join'](_0x4987af,util[_0x8f36('0x10')](_0x8f36('0x11'),_0x3f66c5,_0x3753f2));}function formatter(_0x4ec685,_0x66d94b){_0x66d94b[_0x8f36('0x12')]=_0x66d94b['message'][_0x8f36('0x13')](/@@{/g,_0x8f36('0x14'))[_0x8f36('0x13')](/}@@/g,'}}}')[_0x8f36('0x13')](/@{/g,'{{')[_0x8f36('0x13')](/}@/g,'}}');return util['format'](_0x8f36('0x15'),moment()[_0x8f36('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x66d94b[_0x8f36('0x16')][_0x8f36('0x17')](),_0x4ec685,_0x66d94b[_0x8f36('0x12')]);}function fileFormat(_0x553a2e,_0xdc4026){_0xdc4026[_0x8f36('0x12')]=_0xdc4026[_0x8f36('0x12')][_0x8f36('0x13')](/@@{/g,_0x8f36('0x14'))[_0x8f36('0x13')](/}@@/g,_0x8f36('0x18'))['replace'](/@{/g,'{{')[_0x8f36('0x13')](/}@/g,'}}');var _0x31698e=_0xdc4026[_0x8f36('0x19')]&&Object[_0x8f36('0x1a')](_0xdc4026[_0x8f36('0x19')])[_0x8f36('0x1b')]?'\x0a\x09'+JSON[_0x8f36('0x1c')](_0xdc4026[_0x8f36('0x19')]):'';return util[_0x8f36('0x10')](_0x8f36('0x1d'),moment()[_0x8f36('0x10')](_0x8f36('0x1e')),_0xdc4026[_0x8f36('0x16')]['toUpperCase'](),_0x553a2e,_0xdc4026[_0x8f36('0x12')],_0x31698e);}function consoleLogger(){var _0xf3677c=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x8f36('0x1f'))]({'level':_0x8f36('0x20'),'json':![],'formatter':function(_0x3bf348){return formatter('',_0x3bf348);}})]});return _0xf3677c;}function fileLogger(_0x4c7567,_0x1db806){var _0x5bf870=new winston[(_0x8f36('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8f36('0x22'))][(_0x8f36('0x23'))]({'name':util[_0x8f36('0x10')](_0x8f36('0x24'),_0x4c7567,_0x8f36('0x25')),'filename':getLogFileName(_0x1db806,_0x4c7567,_0x8f36('0x25')),'level':_0x8f36('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x368a57){return fileFormat(_0x4c7567,_0x368a57);}}),new winston[(_0x8f36('0x22'))][(_0x8f36('0x23'))]({'name':util['format'](_0x8f36('0x24'),_0x4c7567,debugLevel),'filename':getLogFileName(_0x1db806,_0x4c7567,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x227883){return fileFormat(_0x4c7567,_0x227883);}}),new winston[(_0x8f36('0x22'))][(_0x8f36('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x5af09b){return fileFormat(_0x4c7567,_0x5af09b);}})]});return _0x5bf870;}exports['consoleLogger']=consoleLogger;exports[_0x8f36('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index e967058..ab603e1 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x1967,0x173));var _0x7196=function(_0x5597c6,_0x5bf618){_0x5597c6=_0x5597c6-0x0;var _0x122dfa=_0x1967[_0x5597c6];return _0x122dfa;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x15184c,_0x35a6e){var _0x35ca27=function(_0x1a9cc7){while(--_0x1a9cc7){_0x15184c['push'](_0x15184c['shift']());}};_0x35ca27(++_0x35a6e);}(_0x2ef3,0xba));var _0x32ef=function(_0x32ce4b,_0x13e723){_0x32ce4b=_0x32ce4b-0x0;var _0x2d1fb6=_0x2ef3[_0x32ce4b];return _0x2d1fb6;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 3d3e8bc..6d243fd 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x26dddb,_0x357835){var _0x5a1b78=function(_0x30a782){while(--_0x30a782){_0x26dddb['push'](_0x26dddb['shift']());}};_0x5a1b78(++_0x357835);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file +var _0xb7e7=['reduce','safeTemplate','lodash','{\x20{\x20','string','isArray','map'];(function(_0x2c0099,_0x2da125){var _0x37f9ba=function(_0x57e477){while(--_0x57e477){_0x2c0099['push'](_0x2c0099['shift']());}};_0x37f9ba(++_0x2da125);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb7e7[_0xc4001c];return _0x49f7bc;};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